From: Cris Di Sclafani Date: Thu, 27 Aug 2020 16:21:07 +0000 (+0200) Subject: Built motion from commit (unavailable).|2.5.0 X-Git-Url: http://repos.xcallymotion.com/base//%22angular-material.themes.css/%22?a=commitdiff_plain;h=e63d3cc69c20c5bf3eb8fd56ff7421d5544d7c8e;p=motion2.git Built motion from commit (unavailable).|2.5.0 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index e5d8807..f60e9ff 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1 +1 @@ -define({ "name": "xCALLY Motion API", "version": "2.5.0", "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-08-27T15:43:47.694Z", "url": "http://apidocjs.com", "version": "0.19.0" } }); +define({ "name": "xCALLY Motion API", "version": "2.5.0", "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-08-27T16:14:11.701Z", "url": "http://apidocjs.com", "version": "0.19.0" } }); diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 12e5750..186c7d2 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -1 +1 @@ -{ "name": "xCALLY Motion API", "version": "2.5.0", "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-08-27T15:43:47.694Z", "url": "http://apidocjs.com", "version": "0.19.0" } } +{ "name": "xCALLY Motion API", "version": "2.5.0", "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-08-27T16:14:11.701Z", "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 a87af4e..822414a 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 _0xbaec=['TEXT','VIRTUAL','getDataValue','STRING','motionbar','jscripty','urlForward','browser','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]'];(function(_0x210cd5,_0x11c0b8){var _0x3a592b=function(_0x7b8724){while(--_0x7b8724){_0x210cd5['push'](_0x210cd5['shift']());}};_0x3a592b(++_0x11c0b8);}(_0xbaec,0x121));var _0xcbae=function(_0x53c33c,_0x27223d){_0x53c33c=_0x53c33c-0x0;var _0x277750=_0xbaec[_0x53c33c];return _0x277750;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xcbae('0x0')],'get':function(_0x452699){return this[_0xcbae('0x1')]('action');}},'action':{'type':Sequelize[_0xcbae('0x2')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager','integration',_0xcbae('0x3'),_0xcbae('0x4'),_0xcbae('0x5'),_0xcbae('0x6'),_0xcbae('0x7'),'script']],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0xcbae('0x8')},'data1':{'type':Sequelize[_0xcbae('0x2')](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[_0xcbae('0x2')](0x1000),'comment':_0xcbae('0x9')},'data3':{'type':Sequelize[_0xcbae('0x2')](0x1000),'comment':_0xcbae('0xa')},'data4':{'type':Sequelize[_0xcbae('0x2')](0x1000)},'data5':{'type':Sequelize[_0xcbae('0x2')](0x1000)},'data6':{'type':Sequelize[_0xcbae('0x2')]},'data7':{'type':Sequelize[_0xcbae('0xb')]}}; \ No newline at end of file +var _0xe9c1=['integration','motionbar','script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','TEXT','sequelize','VIRTUAL','getDataValue','action','STRING','contactManager'];(function(_0x3868a2,_0x3bffa5){var _0x801165=function(_0x3af77c){while(--_0x3af77c){_0x3868a2['push'](_0x3868a2['shift']());}};_0x801165(++_0x3bffa5);}(_0xe9c1,0x192));var _0x1e9c=function(_0x3fbe2f,_0x5d0383){_0x3fbe2f=_0x3fbe2f-0x0;var _0x1bb161=_0xe9c1[_0x3fbe2f];return _0x1bb161;};'use strict';var Sequelize=require(_0x1e9c('0x0'));module['exports']={'name':{'type':Sequelize[_0x1e9c('0x1')],'get':function(_0x50b067){return this[_0x1e9c('0x2')](_0x1e9c('0x3'));}},'action':{'type':Sequelize[_0x1e9c('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x1e9c('0x5'),_0x1e9c('0x6'),_0x1e9c('0x7'),'jscripty','urlForward','browser','bot',_0x1e9c('0x8')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x1e9c('0x4')](0x1000),'comment':_0x1e9c('0x9')},'data2':{'type':Sequelize[_0x1e9c('0x4')](0x1000),'comment':_0x1e9c('0xa')},'data3':{'type':Sequelize[_0x1e9c('0x4')](0x1000),'comment':'motionbar[NULL,NULL,WinAppArguments]'},'data4':{'type':Sequelize[_0x1e9c('0x4')](0x1000)},'data5':{'type':Sequelize[_0x1e9c('0x4')](0x1000)},'data6':{'type':Sequelize[_0x1e9c('0x4')]},'data7':{'type':Sequelize[_0x1e9c('0xb')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 4929497..b092dcc 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 _0x464c=['Action','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','update','then','end','stack','name','send','body','find','params','catch','destroy'];(function(_0x3a815e,_0x5e449e){var _0x3f5fe3=function(_0x3ee2c1){while(--_0x3ee2c1){_0x3a815e['push'](_0x3a815e['shift']());}};_0x3f5fe3(++_0x5e449e);}(_0x464c,0xc1));var _0xc464=function(_0x5d0609,_0x127562){_0x5d0609=_0x5d0609-0x0;var _0xaa3fd1=_0x464c[_0x5d0609];return _0xaa3fd1;};'use strict';var pdf=require(_0xc464('0x0'));var emlformat=require(_0xc464('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc464('0x2'));var jsonpatch=require(_0xc464('0x3'));var rp=require(_0xc464('0x4'));var moment=require(_0xc464('0x5'));var BPromise=require(_0xc464('0x6'));var Mustache=require(_0xc464('0x7'));var util=require('util');var path=require(_0xc464('0x8'));var sox=require(_0xc464('0x9'));var csv=require(_0xc464('0xa'));var ejs=require(_0xc464('0xb'));var fs=require('fs');var _=require(_0xc464('0xc'));var squel=require(_0xc464('0xd'));var crypto=require(_0xc464('0xe'));var jsforce=require(_0xc464('0xf'));var deskjs=require(_0xc464('0x10'));var toCsv=require(_0xc464('0xa'));var querystring=require(_0xc464('0x11'));var Papa=require(_0xc464('0x12'));var Redis=require(_0xc464('0x13'));var authService=require(_0xc464('0x14'));var qs=require(_0xc464('0x15'));var as=require(_0xc464('0x16'));var hardwareService=require(_0xc464('0x17'));var logger=require(_0xc464('0x18'))(_0xc464('0x19'));var utils=require(_0xc464('0x1a'));var config=require(_0xc464('0x1b'));var db=require(_0xc464('0x1c'))['db'];function respondWithStatusCode(_0x24cd2f,_0x5ada6a){_0x5ada6a=_0x5ada6a||0xcc;return function(_0x441378){if(_0x441378){return _0x24cd2f[_0xc464('0x1d')](_0x5ada6a);}return _0x24cd2f[_0xc464('0x1e')](_0x5ada6a)['end']();};}function respondWithResult(_0x39ae13,_0x5dd02f){_0x5dd02f=_0x5dd02f||0xc8;return function(_0x1dafab){if(_0x1dafab){return _0x39ae13['status'](_0x5dd02f)[_0xc464('0x1f')](_0x1dafab);}};}function respondWithFilteredResult(_0x250773,_0x36e30f){return function(_0x11914a){if(_0x11914a){var _0x2cd23d=_0x11914a['count'],_0x124366=_0x36e30f[_0xc464('0x20')],_0x347284=_0x36e30f['offset']+_0x36e30f[_0xc464('0x21')],_0x5171a5;if(_0x347284>=_0x2cd23d){_0x347284=_0x2cd23d;_0x5171a5=0xc8;}else{_0x5171a5=0xce;}_0x250773[_0xc464('0x1e')](_0x5171a5);return _0x250773[_0xc464('0x22')](_0xc464('0x23'),_0x124366+'-'+_0x347284+'/'+_0x2cd23d)[_0xc464('0x1f')](_0x11914a);}return null;};}function patchUpdates(_0x35fbc6){return function(_0x49f4ca){try{jsonpatch['apply'](_0x49f4ca,_0x35fbc6,!![]);}catch(_0x41dfd8){return BPromise['reject'](_0x41dfd8);}return _0x49f4ca['save']();};}function saveUpdates(_0x39c3f2,_0x332bb9){return function(_0x41b8f6){if(_0x41b8f6){return _0x41b8f6[_0xc464('0x24')](_0x39c3f2)[_0xc464('0x25')](function(_0x439a58){return _0x439a58;});}return null;};}function removeEntity(_0x1b2db7,_0x2b7752){return function(_0x1654ee){if(_0x1654ee){return _0x1654ee['destroy']()[_0xc464('0x25')](function(){_0x1b2db7[_0xc464('0x1e')](0xcc)[_0xc464('0x26')]();});}};}function handleEntityNotFound(_0x74e202,_0x5b6c13){return function(_0x360f15){if(!_0x360f15){_0x74e202[_0xc464('0x1d')](0x194);}return _0x360f15;};}function handleError(_0x18139e,_0x25c29e){_0x25c29e=_0x25c29e||0x1f4;return function(_0x35ceee){logger['error'](_0x35ceee[_0xc464('0x27')]);if(_0x35ceee[_0xc464('0x28')]){delete _0x35ceee[_0xc464('0x28')];}_0x18139e['status'](_0x25c29e)[_0xc464('0x29')](_0x35ceee);};}exports[_0xc464('0x24')]=function(_0x37f559,_0xe2eedf){if(_0x37f559[_0xc464('0x2a')]['id']){delete _0x37f559['body']['id'];}return db['Action'][_0xc464('0x2b')]({'where':{'id':_0x37f559[_0xc464('0x2c')]['id']}})[_0xc464('0x25')](handleEntityNotFound(_0xe2eedf,null))['then'](saveUpdates(_0x37f559['body'],null))[_0xc464('0x25')](respondWithResult(_0xe2eedf,null))[_0xc464('0x2d')](handleError(_0xe2eedf,null));};exports[_0xc464('0x2e')]=function(_0x29079a,_0x19cf2a){return db[_0xc464('0x2f')][_0xc464('0x2b')]({'where':{'id':_0x29079a[_0xc464('0x2c')]['id']}})[_0xc464('0x25')](handleEntityNotFound(_0x19cf2a,null))[_0xc464('0x25')](removeEntity(_0x19cf2a,null))[_0xc464('0x2d')](handleError(_0x19cf2a,null));}; \ No newline at end of file +var _0xcff4=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','error','name','Action','find','catch','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js'];(function(_0x51f233,_0x48c6b4){var _0x2a19bf=function(_0x145e03){while(--_0x145e03){_0x51f233['push'](_0x51f233['shift']());}};_0x2a19bf(++_0x48c6b4);}(_0xcff4,0x18d));var _0x4cff=function(_0x25f2f8,_0x44c2ef){_0x25f2f8=_0x25f2f8-0x0;var _0x206cc1=_0xcff4[_0x25f2f8];return _0x206cc1;};'use strict';var pdf=require(_0x4cff('0x0'));var emlformat=require(_0x4cff('0x1'));var rimraf=require(_0x4cff('0x2'));var zipdir=require(_0x4cff('0x3'));var jsonpatch=require(_0x4cff('0x4'));var rp=require(_0x4cff('0x5'));var moment=require(_0x4cff('0x6'));var BPromise=require(_0x4cff('0x7'));var Mustache=require('mustache');var util=require(_0x4cff('0x8'));var path=require(_0x4cff('0x9'));var sox=require(_0x4cff('0xa'));var csv=require(_0x4cff('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4cff('0xc'));var squel=require(_0x4cff('0xd'));var crypto=require(_0x4cff('0xe'));var jsforce=require(_0x4cff('0xf'));var deskjs=require(_0x4cff('0x10'));var toCsv=require(_0x4cff('0xb'));var querystring=require(_0x4cff('0x11'));var Papa=require(_0x4cff('0x12'));var Redis=require('ioredis');var authService=require(_0x4cff('0x13'));var qs=require(_0x4cff('0x14'));var as=require(_0x4cff('0x15'));var hardwareService=require(_0x4cff('0x16'));var logger=require(_0x4cff('0x17'))(_0x4cff('0x18'));var utils=require(_0x4cff('0x19'));var config=require('../../config/environment');var db=require(_0x4cff('0x1a'))['db'];function respondWithStatusCode(_0x46e80e,_0x2a3d5a){_0x2a3d5a=_0x2a3d5a||0xcc;return function(_0x43e4e3){if(_0x43e4e3){return _0x46e80e[_0x4cff('0x1b')](_0x2a3d5a);}return _0x46e80e[_0x4cff('0x1c')](_0x2a3d5a)[_0x4cff('0x1d')]();};}function respondWithResult(_0x3ef59b,_0x145463){_0x145463=_0x145463||0xc8;return function(_0x572f33){if(_0x572f33){return _0x3ef59b[_0x4cff('0x1c')](_0x145463)[_0x4cff('0x1e')](_0x572f33);}};}function respondWithFilteredResult(_0x1d475e,_0x4db8ef){return function(_0x269d79){if(_0x269d79){var _0xea3002=_0x269d79[_0x4cff('0x1f')],_0xc89d6f=_0x4db8ef[_0x4cff('0x20')],_0x2d97a4=_0x4db8ef[_0x4cff('0x20')]+_0x4db8ef[_0x4cff('0x21')],_0x16a730;if(_0x2d97a4>=_0xea3002){_0x2d97a4=_0xea3002;_0x16a730=0xc8;}else{_0x16a730=0xce;}_0x1d475e[_0x4cff('0x1c')](_0x16a730);return _0x1d475e[_0x4cff('0x22')](_0x4cff('0x23'),_0xc89d6f+'-'+_0x2d97a4+'/'+_0xea3002)[_0x4cff('0x1e')](_0x269d79);}return null;};}function patchUpdates(_0x259276){return function(_0x56bdee){try{jsonpatch['apply'](_0x56bdee,_0x259276,!![]);}catch(_0x242e2a){return BPromise[_0x4cff('0x24')](_0x242e2a);}return _0x56bdee[_0x4cff('0x25')]();};}function saveUpdates(_0xe6f0c6,_0x414b82){return function(_0x153428){if(_0x153428){return _0x153428[_0x4cff('0x26')](_0xe6f0c6)[_0x4cff('0x27')](function(_0x17cce8){return _0x17cce8;});}return null;};}function removeEntity(_0x247625,_0x424ffb){return function(_0x5ac8c2){if(_0x5ac8c2){return _0x5ac8c2['destroy']()[_0x4cff('0x27')](function(){_0x247625['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x500d01,_0x58b274){return function(_0x414775){if(!_0x414775){_0x500d01[_0x4cff('0x1b')](0x194);}return _0x414775;};}function handleError(_0x1730d6,_0x35bbe3){_0x35bbe3=_0x35bbe3||0x1f4;return function(_0x4967f8){logger[_0x4cff('0x28')](_0x4967f8['stack']);if(_0x4967f8[_0x4cff('0x29')]){delete _0x4967f8[_0x4cff('0x29')];}_0x1730d6[_0x4cff('0x1c')](_0x35bbe3)['send'](_0x4967f8);};}exports[_0x4cff('0x26')]=function(_0x5f4fbe,_0x819164){if(_0x5f4fbe['body']['id']){delete _0x5f4fbe['body']['id'];}return db[_0x4cff('0x2a')][_0x4cff('0x2b')]({'where':{'id':_0x5f4fbe['params']['id']}})[_0x4cff('0x27')](handleEntityNotFound(_0x819164,null))[_0x4cff('0x27')](saveUpdates(_0x5f4fbe['body'],null))['then'](respondWithResult(_0x819164,null))[_0x4cff('0x2c')](handleError(_0x819164,null));};exports['destroy']=function(_0x1b788f,_0x1b1a49){return db[_0x4cff('0x2a')][_0x4cff('0x2b')]({'where':{'id':_0x1b788f[_0x4cff('0x2d')]['id']}})[_0x4cff('0x27')](handleEntityNotFound(_0x1b1a49,null))[_0x4cff('0x27')](removeEntity(_0x1b1a49,null))[_0x4cff('0x2c')](handleError(_0x1b1a49,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index deac726..2f93dcb 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 _0xe872=['../../config/environment','./action.attributes','exports','Action','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x282f9a,_0x63dff){var _0x52528c=function(_0xcf1c4c){while(--_0xcf1c4c){_0x282f9a['push'](_0x282f9a['shift']());}};_0x52528c(++_0x63dff);}(_0xe872,0x1e4));var _0x2e87=function(_0x54929d,_0x2412dc){_0x54929d=_0x54929d-0x0;var _0x3f19ff=_0xe872[_0x54929d];return _0x3f19ff;};'use strict';var _=require(_0x2e87('0x0'));var util=require('util');var logger=require(_0x2e87('0x1'))(_0x2e87('0x2'));var moment=require(_0x2e87('0x3'));var BPromise=require(_0x2e87('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2e87('0x5'));var rimraf=require('rimraf');var config=require(_0x2e87('0x6'));var attributes=require(_0x2e87('0x7'));module[_0x2e87('0x8')]=function(_0xf7ba9e,_0x424539){return _0xf7ba9e['define'](_0x2e87('0x9'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3411=['../../config/environment','define','Action','tools_actions','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x4bc599,_0x401afb){var _0x36cd63=function(_0x267060){while(--_0x267060){_0x4bc599['push'](_0x4bc599['shift']());}};_0x36cd63(++_0x401afb);}(_0x3411,0x160));var _0x1341=function(_0x51a9bb,_0x2f60a7){_0x51a9bb=_0x51a9bb-0x0;var _0x348400=_0x3411[_0x51a9bb];return _0x348400;};'use strict';var _=require(_0x1341('0x0'));var util=require(_0x1341('0x1'));var logger=require(_0x1341('0x2'))(_0x1341('0x3'));var moment=require(_0x1341('0x4'));var BPromise=require('bluebird');var rp=require(_0x1341('0x5'));var fs=require('fs');var path=require(_0x1341('0x6'));var rimraf=require(_0x1341('0x7'));var config=require(_0x1341('0x8'));var attributes=require('./action.attributes');module['exports']=function(_0x2e3db0,_0xcbf1d0){return _0x2e3db0[_0x1341('0x9')](_0x1341('0xa'),attributes,{'tableName':_0x1341('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index d018354..4674623 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(_0x61f1c2,_0x547805){var _0x259881=function(_0x1e90d4){while(--_0x1e90d4){_0x61f1c2['push'](_0x61f1c2['shift']());}};_0x259881(++_0x547805);}(_0x70e0,0x17b));var _0x070e=function(_0x5bcb07,_0xad9e2c){_0x5bcb07=_0x5bcb07-0x0;var _0x372b1a=_0x70e0[_0x5bcb07];return _0x372b1a;};'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(_0xf4c45a,_0xe90f7){var _0x6d293=function(_0x1eef5d){while(--_0x1eef5d){_0xf4c45a['push'](_0xf4c45a['shift']());}};_0x6d293(++_0xe90f7);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x166e96,_0x55191d){_0x166e96=_0x166e96-0x0;var _0x553d73=_0xcb91[_0x166e96];return _0x553d73;};'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 8e81f7a..fe68c7f 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 _0x0f88=['Router','../../components/auth/service','../../config/environment','./action.controller','put','isAuthenticated','delete','/:id','destroy','util','path','connect-timeout','express'];(function(_0xbaf699,_0x4aa945){var _0x55a131=function(_0x219dd7){while(--_0x219dd7){_0xbaf699['push'](_0xbaf699['shift']());}};_0x55a131(++_0x4aa945);}(_0x0f88,0x10d));var _0x80f8=function(_0x482431,_0x22caff){_0x482431=_0x482431-0x0;var _0x484ade=_0x0f88[_0x482431];return _0x484ade;};'use strict';var multer=require('multer');var util=require(_0x80f8('0x0'));var path=require(_0x80f8('0x1'));var timeout=require(_0x80f8('0x2'));var express=require(_0x80f8('0x3'));var router=express[_0x80f8('0x4')]();var auth=require(_0x80f8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x80f8('0x6'));var controller=require(_0x80f8('0x7'));router[_0x80f8('0x8')]('/:id',auth[_0x80f8('0x9')](),controller['update']);router[_0x80f8('0xa')](_0x80f8('0xb'),auth[_0x80f8('0x9')](),controller[_0x80f8('0xc')]);module['exports']=router; \ No newline at end of file +var _0xc14c=['destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','update'];(function(_0x5dc098,_0x1fc061){var _0x187d9c=function(_0x1eddca){while(--_0x1eddca){_0x5dc098['push'](_0x5dc098['shift']());}};_0x187d9c(++_0x1fc061);}(_0xc14c,0x1cf));var _0xcc14=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc14c[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xcc14('0x0'));var util=require(_0xcc14('0x1'));var path=require(_0xcc14('0x2'));var timeout=require(_0xcc14('0x3'));var express=require(_0xcc14('0x4'));var router=express[_0xcc14('0x5')]();var auth=require(_0xcc14('0x6'));var interaction=require(_0xcc14('0x7'));var config=require(_0xcc14('0x8'));var controller=require('./action.controller');router[_0xcc14('0x9')](_0xcc14('0xa'),auth[_0xcc14('0xb')](),controller[_0xcc14('0xc')]);router['delete']('/:id',auth[_0xcc14('0xb')](),controller[_0xcc14('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index a2ec28f..986b762 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 _0xc0d9=['sequelize','STRING','TEXT'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xc0d9,0x13e));var _0x9c0d=function(_0x46dbf9,_0x1e517e){_0x46dbf9=_0x46dbf9-0x0;var _0x24572d=_0xc0d9[_0x46dbf9];return _0x24572d;};'use strict';var Sequelize=require(_0x9c0d('0x0'));module['exports']={'name':{'type':Sequelize[_0x9c0d('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x9c0d('0x1')]},'parent':{'type':Sequelize[_0x9c0d('0x1')]},'table':{'type':Sequelize[_0x9c0d('0x1')]},'conditions':{'type':Sequelize[_0x9c0d('0x2')]},'joins':{'type':Sequelize[_0x9c0d('0x2')]}}; \ No newline at end of file +var _0x219f=['STRING','TEXT','sequelize','exports'];(function(_0x1bea94,_0x264b1f){var _0x7d1695=function(_0xef1ca5){while(--_0xef1ca5){_0x1bea94['push'](_0x1bea94['shift']());}};_0x7d1695(++_0x264b1f);}(_0x219f,0xb2));var _0xf219=function(_0x1ae2b2,_0x18f2e2){_0x1ae2b2=_0x1ae2b2-0x0;var _0x4c1746=_0x219f[_0x1ae2b2];return _0x4c1746;};'use strict';var Sequelize=require(_0xf219('0x0'));module[_0xf219('0x1')]={'name':{'type':Sequelize[_0xf219('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xf219('0x2')]},'parent':{'type':Sequelize[_0xf219('0x2')]},'table':{'type':Sequelize[_0xf219('0x2')]},'conditions':{'type':Sequelize[_0xf219('0x3')]},'joins':{'type':Sequelize[_0xf219('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 78d5889..26348e6 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 _0x7ed2=['ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','DESC','alias','SELECT','No\x20available\x20data','output','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','COUNT(*)','runReport','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','count','offset','limit','set','save','update','then','destroy','get','stack','name','send','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','rows','catch','show','params','length','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','CustomReports','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','left_join','right_join','cross_join','SUM(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','Sequelize','AnalyticMetric','findAll','keyBy','select','from','MetricId','metric','function','replace','format','groupBy','orderBy','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','join','COUNT(%s)','COUNT(DISTINCT\x20%s)','includes','getFields'];(function(_0x3af542,_0x3d4e5f){var _0x5f1716=function(_0x1990e6){while(--_0x1990e6){_0x3af542['push'](_0x3af542['shift']());}};_0x5f1716(++_0x3d4e5f);}(_0x7ed2,0x16b));var _0x27ed=function(_0x59a488,_0x2475ae){_0x59a488=_0x59a488-0x0;var _0x1ad526=_0x7ed2[_0x59a488];return _0x1ad526;};'use strict';var pdf=require(_0x27ed('0x0'));var emlformat=require(_0x27ed('0x1'));var rimraf=require(_0x27ed('0x2'));var zipdir=require(_0x27ed('0x3'));var jsonpatch=require(_0x27ed('0x4'));var rp=require(_0x27ed('0x5'));var moment=require(_0x27ed('0x6'));var BPromise=require(_0x27ed('0x7'));var Mustache=require(_0x27ed('0x8'));var util=require(_0x27ed('0x9'));var path=require(_0x27ed('0xa'));var sox=require(_0x27ed('0xb'));var csv=require('to-csv');var ejs=require(_0x27ed('0xc'));var fs=require('fs');var _=require(_0x27ed('0xd'));var squel=require(_0x27ed('0xe'));var crypto=require(_0x27ed('0xf'));var jsforce=require(_0x27ed('0x10'));var deskjs=require(_0x27ed('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x27ed('0x12'));var Redis=require('ioredis');var authService=require(_0x27ed('0x13'));var qs=require(_0x27ed('0x14'));var as=require(_0x27ed('0x15'));var hardwareService=require(_0x27ed('0x16'));var logger=require(_0x27ed('0x17'))(_0x27ed('0x18'));var utils=require(_0x27ed('0x19'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d5d08,_0x40b1b8){_0x40b1b8=_0x40b1b8||0xcc;return function(_0x3e2ed3){if(_0x3e2ed3){return _0x5d5d08[_0x27ed('0x1a')](_0x40b1b8);}return _0x5d5d08[_0x27ed('0x1b')](_0x40b1b8)[_0x27ed('0x1c')]();};}function respondWithResult(_0x2622ab,_0x23e1cc){_0x23e1cc=_0x23e1cc||0xc8;return function(_0x24c0bb){if(_0x24c0bb){return _0x2622ab['status'](_0x23e1cc)[_0x27ed('0x1d')](_0x24c0bb);}};}function respondWithFilteredResult(_0x50840b,_0x19bdf5){return function(_0x4c7aa3){if(_0x4c7aa3){var _0x1ba62b=_0x4c7aa3[_0x27ed('0x1e')],_0x38789c=_0x19bdf5[_0x27ed('0x1f')],_0x395935=_0x19bdf5['offset']+_0x19bdf5[_0x27ed('0x20')],_0x1d8cad;if(_0x395935>=_0x1ba62b){_0x395935=_0x1ba62b;_0x1d8cad=0xc8;}else{_0x1d8cad=0xce;}_0x50840b[_0x27ed('0x1b')](_0x1d8cad);return _0x50840b[_0x27ed('0x21')]('Content-Range',_0x38789c+'-'+_0x395935+'/'+_0x1ba62b)[_0x27ed('0x1d')](_0x4c7aa3);}return null;};}function patchUpdates(_0x576732){return function(_0x371846){try{jsonpatch['apply'](_0x371846,_0x576732,!![]);}catch(_0x355bd0){return BPromise['reject'](_0x355bd0);}return _0x371846[_0x27ed('0x22')]();};}function saveUpdates(_0x2e05ee,_0x5e2df9){return function(_0x41e4cd){if(_0x41e4cd){return _0x41e4cd[_0x27ed('0x23')](_0x2e05ee)[_0x27ed('0x24')](function(_0x5b1645){return _0x5b1645;});}return null;};}function removeEntity(_0x1add8b,_0x19179e){return function(_0x1e1cab){if(_0x1e1cab){return _0x1e1cab[_0x27ed('0x25')]()[_0x27ed('0x24')](function(){var _0xee150a=_0x1e1cab[_0x27ed('0x26')]({'plain':!![]});var _0x24cd8f='CustomReports';return db['UserProfileResource']['destroy']({'where':{'type':_0x24cd8f,'resourceId':_0xee150a['id']}})[_0x27ed('0x24')](function(){return _0x1e1cab;});})['then'](function(){_0x1add8b[_0x27ed('0x1b')](0xcc)[_0x27ed('0x1c')]();});}};}function handleEntityNotFound(_0x43f900,_0x5dba37){return function(_0x4462a7){if(!_0x4462a7){_0x43f900['sendStatus'](0x194);}return _0x4462a7;};}function handleError(_0x156496,_0x5d1099){_0x5d1099=_0x5d1099||0x1f4;return function(_0xe73c91){logger['error'](_0xe73c91[_0x27ed('0x27')]);if(_0xe73c91[_0x27ed('0x28')]){delete _0xe73c91[_0x27ed('0x28')];}_0x156496[_0x27ed('0x1b')](_0x5d1099)[_0x27ed('0x29')](_0xe73c91);};}exports['index']=function(_0x295690,_0x554a89){var _0x2b0b6d={},_0x451b8e={},_0x31b91d={'count':0x0,'rows':[]};var _0x10874a=_['map'](db[_0x27ed('0x2a')][_0x27ed('0x2b')],function(_0x448835){return{'name':_0x448835[_0x27ed('0x2c')],'type':_0x448835[_0x27ed('0x2d')][_0x27ed('0x2e')]};});_0x451b8e[_0x27ed('0x2f')]=_[_0x27ed('0x30')](_0x10874a,_0x27ed('0x28'));_0x451b8e['query']=_[_0x27ed('0x31')](_0x295690[_0x27ed('0x32')]);_0x451b8e[_0x27ed('0x33')]=_[_0x27ed('0x34')](_0x451b8e[_0x27ed('0x2f')],_0x451b8e['query']);_0x2b0b6d[_0x27ed('0x35')]=_[_0x27ed('0x34')](_0x451b8e['model'],qs['fields'](_0x295690[_0x27ed('0x32')][_0x27ed('0x36')]));_0x2b0b6d[_0x27ed('0x35')]=_0x2b0b6d[_0x27ed('0x35')]['length']?_0x2b0b6d[_0x27ed('0x35')]:_0x451b8e[_0x27ed('0x2f')];if(!_0x295690[_0x27ed('0x32')][_0x27ed('0x37')](_0x27ed('0x38'))){_0x2b0b6d[_0x27ed('0x20')]=qs[_0x27ed('0x20')](_0x295690['query'][_0x27ed('0x20')]);_0x2b0b6d[_0x27ed('0x1f')]=qs[_0x27ed('0x1f')](_0x295690[_0x27ed('0x32')][_0x27ed('0x1f')]);}_0x2b0b6d[_0x27ed('0x39')]=qs[_0x27ed('0x3a')](_0x295690[_0x27ed('0x32')]['sort']);_0x2b0b6d[_0x27ed('0x3b')]=qs[_0x27ed('0x33')](_['pick'](_0x295690[_0x27ed('0x32')],_0x451b8e[_0x27ed('0x33')]));if(_0x295690[_0x27ed('0x32')][_0x27ed('0x3c')]){_0x2b0b6d[_0x27ed('0x3b')]=_[_0x27ed('0x3d')](_0x2b0b6d[_0x27ed('0x3b')],{'$or':_['map'](_0x10874a,function(_0x32c846){if(_0x32c846[_0x27ed('0x2d')]!=='VIRTUAL'){var _0x318f86={};_0x318f86[_0x32c846[_0x27ed('0x28')]]={'$like':'%'+_0x295690[_0x27ed('0x32')][_0x27ed('0x3c')]+'%'};return _0x318f86;}})});}_0x2b0b6d=_[_0x27ed('0x3d')]({},_0x2b0b6d,_0x295690[_0x27ed('0x3e')]);var _0x764fc7={'where':_0x2b0b6d[_0x27ed('0x3b')]};return db[_0x27ed('0x2a')][_0x27ed('0x1e')](_0x764fc7)[_0x27ed('0x24')](function(_0x5b7f35){_0x31b91d['count']=_0x5b7f35;if(_0x295690['query'][_0x27ed('0x3f')]){_0x2b0b6d[_0x27ed('0x40')]=[{'all':!![]}];}return db[_0x27ed('0x2a')]['findAll'](_0x2b0b6d);})[_0x27ed('0x24')](function(_0x67d58b){_0x31b91d[_0x27ed('0x41')]=_0x67d58b;return _0x31b91d;})[_0x27ed('0x24')](respondWithFilteredResult(_0x554a89,_0x2b0b6d))[_0x27ed('0x42')](handleError(_0x554a89,null));};exports[_0x27ed('0x43')]=function(_0x3647c2,_0x4500ce){var _0x4c7f58={'raw':![],'where':{'id':_0x3647c2[_0x27ed('0x44')]['id']}},_0x5a0914={};_0x5a0914[_0x27ed('0x2f')]=_[_0x27ed('0x31')](db[_0x27ed('0x2a')][_0x27ed('0x2b')]);_0x5a0914[_0x27ed('0x32')]=_['keys'](_0x3647c2['query']);_0x5a0914['filters']=_[_0x27ed('0x34')](_0x5a0914['model'],_0x5a0914[_0x27ed('0x32')]);_0x4c7f58[_0x27ed('0x35')]=_['intersection'](_0x5a0914[_0x27ed('0x2f')],qs[_0x27ed('0x36')](_0x3647c2[_0x27ed('0x32')][_0x27ed('0x36')]));_0x4c7f58[_0x27ed('0x35')]=_0x4c7f58[_0x27ed('0x35')][_0x27ed('0x45')]?_0x4c7f58[_0x27ed('0x35')]:_0x5a0914[_0x27ed('0x2f')];if(_0x3647c2[_0x27ed('0x32')][_0x27ed('0x3f')]){_0x4c7f58[_0x27ed('0x40')]=[{'all':!![]}];}_0x4c7f58=_[_0x27ed('0x3d')]({},_0x4c7f58,_0x3647c2[_0x27ed('0x3e')]);return db[_0x27ed('0x2a')][_0x27ed('0x46')](_0x4c7f58)[_0x27ed('0x24')](handleEntityNotFound(_0x4500ce,null))[_0x27ed('0x24')](respondWithResult(_0x4500ce,null))[_0x27ed('0x42')](handleError(_0x4500ce,null));};exports['create']=function(_0x3ca87e,_0x43797c){return db[_0x27ed('0x2a')]['create'](_0x3ca87e[_0x27ed('0x47')],{})['then'](function(_0x28a75d){var _0x5c6829=_0x3ca87e[_0x27ed('0x48')]['get']({'plain':!![]});if(!_0x5c6829)throw new Error(_0x27ed('0x49'));if(_0x5c6829[_0x27ed('0x4a')]===_0x27ed('0x48')){var _0x43d1b5=_0x28a75d[_0x27ed('0x26')]({'plain':!![]});var _0x4005bd=_0x27ed('0x4b');return db[_0x27ed('0x4c')]['find']({'where':{'name':_0x4005bd,'userProfileId':_0x5c6829[_0x27ed('0x4d')]},'raw':!![]})[_0x27ed('0x24')](function(_0x3b5803){if(_0x3b5803&&_0x3b5803[_0x27ed('0x4e')]===0x0){return db[_0x27ed('0x4f')][_0x27ed('0x50')]({'name':_0x43d1b5[_0x27ed('0x28')],'resourceId':_0x43d1b5['id'],'type':_0x27ed('0x51'),'sectionId':_0x3b5803['id']},{})[_0x27ed('0x24')](function(){return _0x28a75d;});}else{return _0x28a75d;}})[_0x27ed('0x42')](function(_0x5071ab){logger[_0x27ed('0x52')](_0x27ed('0x53'),_0x5071ab);throw _0x5071ab;});}return _0x28a75d;})['then'](respondWithResult(_0x43797c,0xc9))[_0x27ed('0x42')](handleError(_0x43797c,null));};exports[_0x27ed('0x23')]=function(_0x444548,_0x115017){if(_0x444548[_0x27ed('0x47')]['id']){delete _0x444548['body']['id'];}return db['AnalyticCustomReport'][_0x27ed('0x46')]({'where':{'id':_0x444548[_0x27ed('0x44')]['id']}})[_0x27ed('0x24')](handleEntityNotFound(_0x115017,null))[_0x27ed('0x24')](saveUpdates(_0x444548['body'],null))[_0x27ed('0x24')](respondWithResult(_0x115017,null))['catch'](handleError(_0x115017,null));};exports[_0x27ed('0x25')]=function(_0x3a97a2,_0x131913){return db[_0x27ed('0x2a')][_0x27ed('0x46')]({'where':{'id':_0x3a97a2['params']['id']}})[_0x27ed('0x24')](handleEntityNotFound(_0x131913,null))[_0x27ed('0x24')](removeEntity(_0x131913,null))[_0x27ed('0x42')](handleError(_0x131913,null));};exports['preview']=function(_0x1003fe,_0xf488be){var _0x3640f6=0xa;var _0x6513f5=['join',_0x27ed('0x54'),_0x27ed('0x55'),_0x27ed('0x56')];var _0x1713bb={'SUM':_0x27ed('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x27ed('0x58'),'MIN':_0x27ed('0x59'),'AVG':_0x27ed('0x5a'),'GROUP_CONCAT':_0x27ed('0x5b'),'GROUP_CONCAT ASC':_0x27ed('0x5c'),'GROUP_CONCAT DESC':_0x27ed('0x5d')};var _0x12631d={'SEC_TO_TIME':_0x27ed('0x5e'),'DATE':_0x27ed('0x5f'),'HOUR':_0x27ed('0x60'),'ROUND':_0x27ed('0x61'),'UNIX_TIMESTAMP':_0x27ed('0x62')};var _0x3caf22=function(_0x1c6f79){return!_['includes']([_0x27ed('0x63'),_0x27ed('0x64'),_0x27ed('0x65'),_0x27ed('0x66')],_0x1c6f79);};var _0x50d562=function(_0x2dd075){if(!_0x2dd075||!_0x2dd075[_0x27ed('0x67')]['length']){return'';}for(var _0x57ec73='(',_0x1c3d7d=0x0;_0x1c3d7d<_0x2dd075[_0x27ed('0x67')]['length'];_0x1c3d7d+=0x1){_0x1c3d7d>0x0&&(_0x57ec73+='\x20'+_0x2dd075[_0x27ed('0x68')]+'\x20');_0x57ec73+=_0x2dd075[_0x27ed('0x67')][_0x1c3d7d][_0x27ed('0x69')]?_0x50d562(_0x2dd075[_0x27ed('0x67')][_0x1c3d7d][_0x27ed('0x69')]):_0x2dd075[_0x27ed('0x67')][_0x1c3d7d][_0x27ed('0x6a')]+'\x20'+_0x2dd075[_0x27ed('0x67')][_0x1c3d7d][_0x27ed('0x6b')]+(_0x3caf22(_0x2dd075[_0x27ed('0x67')][_0x1c3d7d][_0x27ed('0x6b')])?'\x20'+_0x2dd075[_0x27ed('0x67')][_0x1c3d7d][_0x27ed('0x6c')]:'');}return _0x57ec73+')';};var _0x3e05ea={'where':{'id':_0x1003fe[_0x27ed('0x44')]['id']}},_0x2315e4,_0x3bfb6d,_0xc72d9a,_0x38bb68,_0x2b0031;_0x3e05ea=_['merge']({},_0x3e05ea,_0x1003fe['options']);return db[_0x27ed('0x2a')][_0x27ed('0x46')](_0x3e05ea)[_0x27ed('0x24')](function(_0x391936){if(_0x391936){_0x2315e4=_0x391936;return _0x391936['getFields']();}return null;})[_0x27ed('0x24')](function(_0x22489f){if(_0x22489f){if(!_0x22489f[_0x27ed('0x45')]){throw new db[(_0x27ed('0x6d'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x3bfb6d=_0x22489f;return db[_0x27ed('0x6e')][_0x27ed('0x6f')]({'raw':!![]});}return null;})[_0x27ed('0x24')](function(_0x395fe1){if(_0x395fe1){_0xc72d9a=_[_0x27ed('0x70')](_0x395fe1,'id');var _0x4447ca;var _0x1a8289=squel[_0x27ed('0x71')]();_0x1a8289[_0x27ed('0x72')](_0x2315e4['table']);for(var _0x2ce823=0x0;_0x2ce823<_0x3bfb6d[_0x27ed('0x45')];_0x2ce823+=0x1){_0x4447ca=_0x3bfb6d[_0x2ce823][_0x27ed('0x73')]?_0xc72d9a[_0x3bfb6d[_0x2ce823][_0x27ed('0x73')]][_0x27ed('0x74')]:_0x3bfb6d[_0x2ce823][_0x27ed('0x6a')];_0x4447ca=_0x3bfb6d[_0x2ce823][_0x27ed('0x75')]?_[_0x27ed('0x76')](_0x1713bb[_0x3bfb6d[_0x2ce823][_0x27ed('0x75')]],'%s',_0x4447ca):_0x4447ca;_0x4447ca=_0x3bfb6d[_0x2ce823][_0x27ed('0x77')]?_['replace'](_0x12631d[_0x3bfb6d[_0x2ce823][_0x27ed('0x77')]],'%s',_0x4447ca):_0x4447ca;if(_0x3bfb6d[_0x2ce823][_0x27ed('0x78')]){_0x1a8289[_0x27ed('0x69')](_0x4447ca);}_0x3bfb6d[_0x2ce823][_0x27ed('0x79')]&&_0x1a8289[_0x27ed('0x39')](_0x4447ca,_0x3bfb6d[_0x2ce823][_0x27ed('0x79')]==='DESC'?![]:!![]);_0x1a8289[_0x27ed('0x6a')](_0x4447ca,_0x3bfb6d[_0x2ce823]['alias']||_0x4447ca);}if(_0x2315e4[_0x27ed('0x7a')]){_0x2315e4[_0x27ed('0x7a')]=JSON[_0x27ed('0x7b')](_0x2315e4[_0x27ed('0x7a')]);for(var _0x2cf948=0x0;_0x2cf948<_0x2315e4[_0x27ed('0x7a')]['length'];_0x2cf948+=0x1){if(_0x2315e4[_0x27ed('0x7a')][_0x2cf948][_0x27ed('0x2d')]&&_['includes'](_0x6513f5,_0x2315e4[_0x27ed('0x7a')][_0x2cf948]['type'])&&_0x2315e4[_0x27ed('0x7a')][_0x2cf948][_0x27ed('0x7c')]&&_0x2315e4[_0x27ed('0x7a')][_0x2cf948][_0x27ed('0x7d')]&&_0x2315e4[_0x27ed('0x7a')][_0x2cf948][_0x27ed('0x7e')]){_0x1a8289[_0x2315e4[_0x27ed('0x7a')][_0x2cf948][_0x27ed('0x2d')]](_0x2315e4[_0x27ed('0x7a')][_0x2cf948][_0x27ed('0x7d')],null,util[_0x27ed('0x77')](_0x27ed('0x7f'),_0x2315e4[_0x27ed('0x80')],_0x2315e4[_0x27ed('0x7a')][_0x2cf948][_0x27ed('0x7c')],_0x2315e4[_0x27ed('0x7a')][_0x2cf948]['foreignTable'],_0x2315e4[_0x27ed('0x7a')][_0x2cf948][_0x27ed('0x7e')]));}}}if(_0x2315e4[_0x27ed('0x81')]){_0x2315e4[_0x27ed('0x81')]=JSON[_0x27ed('0x7b')](_0x2315e4['conditions']);_0x1a8289['where'](_0x50d562(_0x2315e4['conditions'][_0x27ed('0x69')]));}_0x2b0031=_0x1a8289[_0x27ed('0x82')]();_0x1a8289[_0x27ed('0x20')](_0x3640f6);_0x1a8289['offset'](0x0);logger[_0x27ed('0x83')](_0x27ed('0x84'),_0x1a8289[_0x27ed('0x85')]());return db[_0x27ed('0x86')]['query'](_0x1a8289[_0x27ed('0x85')](),{'type':db[_0x27ed('0x86')][_0x27ed('0x87')]['SELECT']});}})[_0x27ed('0x24')](respondWithResult(_0xf488be,null))[_0x27ed('0x42')](handleError(_0xf488be,null));};function runReport(_0x59c722,_0x72e5e4,_0x15d3f4){var _0x176076=_0x72e5e4['name'];var _0x14d9b9=0xa;var _0x3a8524=[_0x27ed('0x88'),_0x27ed('0x54'),'right_join','cross_join'];var _0x3eac89={'SUM':'SUM(%s)','COUNT':_0x27ed('0x89'),'COUNT DISTINCT':_0x27ed('0x8a'),'MAX':_0x27ed('0x58'),'MIN':_0x27ed('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x27ed('0x5b'),'GROUP_CONCAT ASC':_0x27ed('0x5c'),'GROUP_CONCAT DESC':_0x27ed('0x5d')};var _0x74ef32={'SEC_TO_TIME':_0x27ed('0x5e'),'DATE':'DATE(%s)','HOUR':_0x27ed('0x60'),'ROUND':_0x27ed('0x61'),'UNIX_TIMESTAMP':_0x27ed('0x62')};var _0x259534=function(_0x55b62e){return!_[_0x27ed('0x8b')]([_0x27ed('0x63'),_0x27ed('0x64'),_0x27ed('0x65'),_0x27ed('0x66')],_0x55b62e);};var _0x4ad2be=function(_0x550b3d){if(!_0x550b3d||!_0x550b3d[_0x27ed('0x67')][_0x27ed('0x45')]){return'';}for(var _0x3e6af3='(',_0x1acb74=0x0;_0x1acb74<_0x550b3d[_0x27ed('0x67')][_0x27ed('0x45')];_0x1acb74+=0x1){_0x1acb74>0x0&&(_0x3e6af3+='\x20'+_0x550b3d[_0x27ed('0x68')]+'\x20');_0x3e6af3+=_0x550b3d[_0x27ed('0x67')][_0x1acb74][_0x27ed('0x69')]?_0x4ad2be(_0x550b3d[_0x27ed('0x67')][_0x1acb74][_0x27ed('0x69')]):_0x550b3d['rules'][_0x1acb74][_0x27ed('0x6a')]+'\x20'+_0x550b3d[_0x27ed('0x67')][_0x1acb74][_0x27ed('0x6b')]+(_0x259534(_0x550b3d[_0x27ed('0x67')][_0x1acb74]['condition'])?'\x20'+_0x550b3d[_0x27ed('0x67')][_0x1acb74][_0x27ed('0x6c')]:'');}return _0x3e6af3+')';};var _0x527b71={'where':{'id':_0x59c722['id']}},_0x4668a6,_0x1e245d,_0x128cb0,_0x5e3ea4,_0x243e27;_0x527b71=_[_0x27ed('0x3d')]({},_0x527b71,_0x15d3f4);return db[_0x27ed('0x2a')][_0x27ed('0x46')](_0x527b71)[_0x27ed('0x24')](function(_0x23662e){if(_0x23662e){_0x4668a6=_0x23662e;return _0x23662e[_0x27ed('0x8c')]();}return null;})[_0x27ed('0x24')](function(_0x52826a){if(_0x52826a){if(!_0x52826a['length']){throw new db['Sequelize'][(_0x27ed('0x8d'))](_0x27ed('0x8e'),0x193);}_0x1e245d=_0x52826a;return db[_0x27ed('0x6e')][_0x27ed('0x6f')]({'raw':!![]});}return null;})[_0x27ed('0x24')](function(_0x3663b6){if(_0x3663b6){_0x128cb0=_[_0x27ed('0x70')](_0x3663b6,'id');var _0x2426d4;var _0x36bd72=squel[_0x27ed('0x71')]();_0x36bd72['from'](_0x4668a6[_0x27ed('0x80')]);for(var _0x297c98=0x0;_0x297c98<_0x1e245d['length'];_0x297c98+=0x1){_0x2426d4=_0x1e245d[_0x297c98][_0x27ed('0x73')]?_0x128cb0[_0x1e245d[_0x297c98]['MetricId']][_0x27ed('0x74')]:_0x1e245d[_0x297c98][_0x27ed('0x6a')];_0x2426d4=_0x1e245d[_0x297c98][_0x27ed('0x75')]?_[_0x27ed('0x76')](_0x3eac89[_0x1e245d[_0x297c98][_0x27ed('0x75')]],'%s',_0x2426d4):_0x2426d4;_0x2426d4=_0x1e245d[_0x297c98][_0x27ed('0x77')]?_[_0x27ed('0x76')](_0x74ef32[_0x1e245d[_0x297c98][_0x27ed('0x77')]],'%s',_0x2426d4):_0x2426d4;if(_0x1e245d[_0x297c98][_0x27ed('0x78')]){_0x36bd72[_0x27ed('0x69')](_0x2426d4);}_0x1e245d[_0x297c98]['orderBy']&&_0x36bd72['order'](_0x2426d4,_0x1e245d[_0x297c98][_0x27ed('0x79')]===_0x27ed('0x8f')?![]:!![]);_0x36bd72[_0x27ed('0x6a')](_0x2426d4,_0x1e245d[_0x297c98][_0x27ed('0x90')]||_0x2426d4);}if(_0x4668a6['joins']){_0x4668a6[_0x27ed('0x7a')]=JSON[_0x27ed('0x7b')](_0x4668a6[_0x27ed('0x7a')]);for(var _0x4564a1=0x0;_0x4564a1<_0x4668a6[_0x27ed('0x7a')]['length'];_0x4564a1+=0x1){if(_0x4668a6[_0x27ed('0x7a')][_0x4564a1][_0x27ed('0x2d')]&&_['includes'](_0x3a8524,_0x4668a6[_0x27ed('0x7a')][_0x4564a1]['type'])&&_0x4668a6[_0x27ed('0x7a')][_0x4564a1]['parentKey']&&_0x4668a6['joins'][_0x4564a1]['foreignTable']&&_0x4668a6['joins'][_0x4564a1]['foreignKey']){_0x36bd72[_0x4668a6[_0x27ed('0x7a')][_0x4564a1][_0x27ed('0x2d')]](_0x4668a6[_0x27ed('0x7a')][_0x4564a1][_0x27ed('0x7d')],null,util[_0x27ed('0x77')]('%s.%s\x20=\x20%s.%s',_0x4668a6[_0x27ed('0x80')],_0x4668a6['joins'][_0x4564a1][_0x27ed('0x7c')],_0x4668a6['joins'][_0x4564a1][_0x27ed('0x7d')],_0x4668a6[_0x27ed('0x7a')][_0x4564a1][_0x27ed('0x7e')]));}}}if(_0x4668a6[_0x27ed('0x81')]){_0x4668a6[_0x27ed('0x81')]=JSON['parse'](_0x4668a6[_0x27ed('0x81')]);_0x36bd72['where'](_0x4ad2be(_0x4668a6['conditions'][_0x27ed('0x69')]));}_0x243e27=_0x36bd72['clone']();_0x36bd72[_0x27ed('0x20')](_0x14d9b9);_0x36bd72[_0x27ed('0x1f')](0x0);logger['debug'](_0x27ed('0x84'),_0x36bd72['toString']());return db[_0x27ed('0x86')][_0x27ed('0x32')](_0x36bd72[_0x27ed('0x85')](),{'type':db['sequelize'][_0x27ed('0x87')][_0x27ed('0x91')]});}})[_0x27ed('0x24')](function(_0x3b4d80){if(!_0x3b4d80[_0x27ed('0x45')]){throw new db['Sequelize'][(_0x27ed('0x8d'))](_0x27ed('0x92'),0xcc);}if(_0x72e5e4[_0x27ed('0x93')]==='web'){return null;}var _0x2e2deb=_[_0x27ed('0x3d')](_0x72e5e4,{'name':_0x72e5e4[_0x27ed('0x94')]||_0x72e5e4[_0x27ed('0x28')]||_0x4668a6[_0x27ed('0x28')],'basename':_0x176076,'savename':util['format'](_0x27ed('0x95'),_0x72e5e4[_0x27ed('0x28')]||_0x4668a6[_0x27ed('0x28')],require(_0x27ed('0x96'))[_0x27ed('0x97')](0x4),_0x72e5e4[_0x27ed('0x93')]||_0x27ed('0x98')),'reportId':_0x4668a6['id'],'reportType':_0x27ed('0x99')});return db[_0x27ed('0x9a')][_0x27ed('0x50')](_0x2e2deb,{'raw':!![]});})[_0x27ed('0x24')](function(_0x459f2f){if(_0x4668a6[_0x27ed('0x80')]==='cdr'){_0x243e27[_0x27ed('0x3b')](_0x4668a6['table']+_0x27ed('0x9b'),_0x72e5e4[_0x27ed('0x9c')],_0x72e5e4['endDate']);}else{_0x243e27[_0x27ed('0x3b')](_0x4668a6[_0x27ed('0x80')]+_0x27ed('0x9d'),_0x72e5e4['startDate'],_0x72e5e4[_0x27ed('0x9e')]);}if(_0x459f2f){logger[_0x27ed('0x9f')](_0x27ed('0xa0'),_0x243e27[_0x27ed('0x85')]());require(_0x27ed('0xa1'))[_0x27ed('0xa2')](path['join'](__dirname,'../../components/export/',_0x459f2f[_0x27ed('0x93')]),[_0x459f2f['id'],_0x243e27[_0x27ed('0x85')](),path['join'](__dirname,_0x27ed('0xa3'),_0x459f2f[_0x27ed('0xa4')]),_0x176076]);return _0x459f2f;}else{var _0xcaf6ed=squel[_0x27ed('0x71')]();_0xcaf6ed[_0x27ed('0x72')]('('+_0x243e27[_0x27ed('0x85')]()+')',_0x27ed('0xa5'));_0xcaf6ed['field'](_0x27ed('0xa6'),_0x27ed('0x1e'));_0x243e27['limit'](_0x72e5e4[_0x27ed('0x20')]||_0x14d9b9);_0x243e27[_0x27ed('0x1f')](_0x72e5e4['offset']||0x0);return db[_0x27ed('0x86')][_0x27ed('0x32')](_0xcaf6ed[_0x27ed('0x85')](),{'type':db[_0x27ed('0x86')][_0x27ed('0x87')]['SELECT']})[_0x27ed('0x24')](function(_0x17636d){if(!_0x17636d[_0x27ed('0x45')]){_0x5e3ea4=0x0;}else{_0x5e3ea4=_0x17636d[0x0][_0x27ed('0x1e')]||0x0;}return db[_0x27ed('0x86')]['query'](_0x243e27[_0x27ed('0x85')](),{'type':db[_0x27ed('0x86')][_0x27ed('0x87')][_0x27ed('0x91')]});})[_0x27ed('0x24')](function(_0x1addc9){return{'rows':_0x1addc9||[],'count':_0x5e3ea4};});}});}exports['run']=function(_0x325e61,_0x4e6e23){return runReport(_0x325e61[_0x27ed('0x44')],_0x325e61[_0x27ed('0x32')],_0x325e61[_0x27ed('0x3e')])[_0x27ed('0x24')](respondWithResult(_0x4e6e23,null))['catch'](handleError(_0x4e6e23,null));};exports[_0x27ed('0xa7')]=runReport;exports[_0x27ed('0x32')]=function(_0x41d190,_0x343d0a){var _0x338107=0xa;var _0x4afed6=[_0x27ed('0x88'),_0x27ed('0x54'),_0x27ed('0x55'),_0x27ed('0x56')];var _0x499037={'SUM':_0x27ed('0x57'),'COUNT':_0x27ed('0x89'),'COUNT DISTINCT':_0x27ed('0x8a'),'MAX':_0x27ed('0x58'),'MIN':_0x27ed('0x59'),'AVG':_0x27ed('0x5a'),'GROUP_CONCAT':_0x27ed('0x5b'),'GROUP_CONCAT ASC':_0x27ed('0x5c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x20cf87={'SEC_TO_TIME':_0x27ed('0x5e'),'DATE':_0x27ed('0x5f'),'HOUR':_0x27ed('0x60'),'ROUND':_0x27ed('0x61'),'UNIX_TIMESTAMP':_0x27ed('0x62')};var _0x429b96=function(_0x7104bd){return!_[_0x27ed('0x8b')]([_0x27ed('0x63'),_0x27ed('0x64'),_0x27ed('0x65'),_0x27ed('0x66')],_0x7104bd);};var _0x2e71c6=function(_0xe328ef){if(!_0xe328ef||!_0xe328ef[_0x27ed('0x67')]['length']){return'';}for(var _0x3c3f3f='(',_0x2811b2=0x0;_0x2811b2<_0xe328ef['rules'][_0x27ed('0x45')];_0x2811b2+=0x1){_0x2811b2>0x0&&(_0x3c3f3f+='\x20'+_0xe328ef[_0x27ed('0x68')]+'\x20');_0x3c3f3f+=_0xe328ef[_0x27ed('0x67')][_0x2811b2][_0x27ed('0x69')]?_0x2e71c6(_0xe328ef[_0x27ed('0x67')][_0x2811b2][_0x27ed('0x69')]):_0xe328ef[_0x27ed('0x67')][_0x2811b2][_0x27ed('0x6a')]+'\x20'+_0xe328ef['rules'][_0x2811b2]['condition']+(_0x429b96(_0xe328ef[_0x27ed('0x67')][_0x2811b2]['condition'])?'\x20'+_0xe328ef['rules'][_0x2811b2][_0x27ed('0x6c')]:'');}return _0x3c3f3f+')';};var _0x3974eb={'where':{'id':_0x41d190[_0x27ed('0x44')]['id']}},_0x37f3bc,_0x5c31cf,_0x58a279,_0x429e67,_0x3b0c03;_0x3974eb=_['merge']({},_0x3974eb,_0x41d190[_0x27ed('0x3e')]);return db[_0x27ed('0x2a')][_0x27ed('0x46')](_0x3974eb)[_0x27ed('0x24')](function(_0x3c4cb5){if(_0x3c4cb5){_0x37f3bc=_0x3c4cb5;return _0x3c4cb5[_0x27ed('0x8c')]();}return null;})['then'](function(_0x4a05df){if(_0x4a05df){if(!_0x4a05df['length']){throw new db[(_0x27ed('0x6d'))]['ValidationErrorItem'](_0x27ed('0x8e'),0x193);}_0x5c31cf=_0x4a05df;return db[_0x27ed('0x6e')][_0x27ed('0x6f')]({'raw':!![]});}return null;})[_0x27ed('0x24')](function(_0x4e37ef){if(_0x4e37ef){_0x58a279=_[_0x27ed('0x70')](_0x4e37ef,'id');var _0x5ead8d;var _0x192eb4=squel[_0x27ed('0x71')]();_0x192eb4[_0x27ed('0x72')](_0x37f3bc[_0x27ed('0x80')]);for(var _0xf6c494=0x0;_0xf6c494<_0x5c31cf[_0x27ed('0x45')];_0xf6c494+=0x1){_0x5ead8d=_0x5c31cf[_0xf6c494]['MetricId']?_0x58a279[_0x5c31cf[_0xf6c494][_0x27ed('0x73')]][_0x27ed('0x74')]:_0x5c31cf[_0xf6c494][_0x27ed('0x6a')];_0x5ead8d=_0x5c31cf[_0xf6c494][_0x27ed('0x75')]?_[_0x27ed('0x76')](_0x499037[_0x5c31cf[_0xf6c494]['function']],'%s',_0x5ead8d):_0x5ead8d;_0x5ead8d=_0x5c31cf[_0xf6c494]['format']?_[_0x27ed('0x76')](_0x20cf87[_0x5c31cf[_0xf6c494][_0x27ed('0x77')]],'%s',_0x5ead8d):_0x5ead8d;if(_0x5c31cf[_0xf6c494][_0x27ed('0x78')]){_0x192eb4['group'](_0x5ead8d);}_0x5c31cf[_0xf6c494][_0x27ed('0x79')]&&_0x192eb4['order'](_0x5ead8d,_0x5c31cf[_0xf6c494]['orderBy']===_0x27ed('0x8f')?![]:!![]);_0x192eb4[_0x27ed('0x6a')](_0x5ead8d,_0x5c31cf[_0xf6c494]['alias']||_0x5ead8d);}if(_0x37f3bc['joins']){_0x37f3bc['joins']=JSON[_0x27ed('0x7b')](_0x37f3bc['joins']);for(var _0x2e626c=0x0;_0x2e626c<_0x37f3bc[_0x27ed('0x7a')][_0x27ed('0x45')];_0x2e626c+=0x1){if(_0x37f3bc[_0x27ed('0x7a')][_0x2e626c][_0x27ed('0x2d')]&&_[_0x27ed('0x8b')](_0x4afed6,_0x37f3bc['joins'][_0x2e626c][_0x27ed('0x2d')])&&_0x37f3bc['joins'][_0x2e626c][_0x27ed('0x7c')]&&_0x37f3bc[_0x27ed('0x7a')][_0x2e626c][_0x27ed('0x7d')]&&_0x37f3bc[_0x27ed('0x7a')][_0x2e626c][_0x27ed('0x7e')]){_0x192eb4[_0x37f3bc[_0x27ed('0x7a')][_0x2e626c]['type']](_0x37f3bc['joins'][_0x2e626c][_0x27ed('0x7d')],null,util[_0x27ed('0x77')]('%s.%s\x20=\x20%s.%s',_0x37f3bc['table'],_0x37f3bc['joins'][_0x2e626c][_0x27ed('0x7c')],_0x37f3bc[_0x27ed('0x7a')][_0x2e626c]['foreignTable'],_0x37f3bc['joins'][_0x2e626c][_0x27ed('0x7e')]));}}}if(_0x37f3bc[_0x27ed('0x81')]){_0x37f3bc[_0x27ed('0x81')]=JSON[_0x27ed('0x7b')](_0x37f3bc[_0x27ed('0x81')]);_0x192eb4[_0x27ed('0x3b')](_0x2e71c6(_0x37f3bc[_0x27ed('0x81')][_0x27ed('0x69')]));}_0x3b0c03=_0x192eb4[_0x27ed('0x82')]();_0x192eb4['limit'](_0x338107);_0x192eb4[_0x27ed('0x1f')](0x0);logger[_0x27ed('0x83')](_0x27ed('0x84'),_0x192eb4[_0x27ed('0x85')]());return db[_0x27ed('0x86')][_0x27ed('0x32')](_0x192eb4['toString'](),{'type':db['sequelize'][_0x27ed('0x87')][_0x27ed('0x91')]});}})[_0x27ed('0x24')](function(){return{'sql':_0x3b0c03['toString']()};})[_0x27ed('0x24')](respondWithResult(_0x343d0a,null))[_0x27ed('0x42')](handleError(_0x343d0a,null));}; \ No newline at end of file +var _0x1b31=['index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','AnalyticCustomReport','count','include','findAll','rows','catch','params','length','includeAll','options','body','get','role','user','Reports','UserProfileSection','find','userProfileId','autoAssociation','create','CustomReports','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%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','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','table','MetricId','metric','function','replace','format','groupBy','group','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','toString','sequelize','QueryTypes','SELECT','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','select','from','orderBy','clone','Limited\x20Query:','output','web','fullPath','%s-%s.%s','generate','csv','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','COUNT(*)','run','runReport','%s.%s\x20=\x20%s.%s','debug','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','stack','name','send'];(function(_0x460590,_0xb2d2ab){var _0x123854=function(_0x30e0da){while(--_0x30e0da){_0x460590['push'](_0x460590['shift']());}};_0x123854(++_0xb2d2ab);}(_0x1b31,0x7e));var _0x11b3=function(_0x267f1a,_0x48953c){_0x267f1a=_0x267f1a-0x0;var _0x54da21=_0x1b31[_0x267f1a];return _0x54da21;};'use strict';var pdf=require(_0x11b3('0x0'));var emlformat=require(_0x11b3('0x1'));var rimraf=require(_0x11b3('0x2'));var zipdir=require(_0x11b3('0x3'));var jsonpatch=require(_0x11b3('0x4'));var rp=require(_0x11b3('0x5'));var moment=require(_0x11b3('0x6'));var BPromise=require(_0x11b3('0x7'));var Mustache=require(_0x11b3('0x8'));var util=require('util');var path=require(_0x11b3('0x9'));var sox=require(_0x11b3('0xa'));var csv=require(_0x11b3('0xb'));var ejs=require(_0x11b3('0xc'));var fs=require('fs');var _=require(_0x11b3('0xd'));var squel=require(_0x11b3('0xe'));var crypto=require('crypto');var jsforce=require(_0x11b3('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x11b3('0xb'));var querystring=require(_0x11b3('0x10'));var Papa=require('papaparse');var Redis=require(_0x11b3('0x11'));var authService=require(_0x11b3('0x12'));var qs=require(_0x11b3('0x13'));var as=require(_0x11b3('0x14'));var hardwareService=require(_0x11b3('0x15'));var logger=require(_0x11b3('0x16'))(_0x11b3('0x17'));var utils=require(_0x11b3('0x18'));var config=require(_0x11b3('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf5401c,_0x5bd020){_0x5bd020=_0x5bd020||0xcc;return function(_0x1b83bc){if(_0x1b83bc){return _0xf5401c[_0x11b3('0x1a')](_0x5bd020);}return _0xf5401c[_0x11b3('0x1b')](_0x5bd020)[_0x11b3('0x1c')]();};}function respondWithResult(_0x2cb113,_0x516839){_0x516839=_0x516839||0xc8;return function(_0x2d59e1){if(_0x2d59e1){return _0x2cb113['status'](_0x516839)[_0x11b3('0x1d')](_0x2d59e1);}};}function respondWithFilteredResult(_0x5ee968,_0x3e90da){return function(_0x3ca712){if(_0x3ca712){var _0x20c956=_0x3ca712['count'],_0x47897e=_0x3e90da['offset'],_0x2aed94=_0x3e90da[_0x11b3('0x1e')]+_0x3e90da[_0x11b3('0x1f')],_0x3b92f8;if(_0x2aed94>=_0x20c956){_0x2aed94=_0x20c956;_0x3b92f8=0xc8;}else{_0x3b92f8=0xce;}_0x5ee968['status'](_0x3b92f8);return _0x5ee968[_0x11b3('0x20')](_0x11b3('0x21'),_0x47897e+'-'+_0x2aed94+'/'+_0x20c956)[_0x11b3('0x1d')](_0x3ca712);}return null;};}function patchUpdates(_0x3d0cd3){return function(_0x30e851){try{jsonpatch['apply'](_0x30e851,_0x3d0cd3,!![]);}catch(_0x48001d){return BPromise[_0x11b3('0x22')](_0x48001d);}return _0x30e851[_0x11b3('0x23')]();};}function saveUpdates(_0x494c44,_0x2c9a09){return function(_0x26e485){if(_0x26e485){return _0x26e485[_0x11b3('0x24')](_0x494c44)[_0x11b3('0x25')](function(_0x37da93){return _0x37da93;});}return null;};}function removeEntity(_0x117c2c,_0x1598ed){return function(_0x16e774){if(_0x16e774){return _0x16e774['destroy']()[_0x11b3('0x25')](function(){var _0x48d288=_0x16e774['get']({'plain':!![]});var _0xdbe55d='CustomReports';return db['UserProfileResource'][_0x11b3('0x26')]({'where':{'type':_0xdbe55d,'resourceId':_0x48d288['id']}})[_0x11b3('0x25')](function(){return _0x16e774;});})[_0x11b3('0x25')](function(){_0x117c2c['status'](0xcc)[_0x11b3('0x1c')]();});}};}function handleEntityNotFound(_0x5c52c7,_0x1e3f48){return function(_0x455aef){if(!_0x455aef){_0x5c52c7[_0x11b3('0x1a')](0x194);}return _0x455aef;};}function handleError(_0x1daa65,_0x5e3b71){_0x5e3b71=_0x5e3b71||0x1f4;return function(_0x5f4c84){logger['error'](_0x5f4c84[_0x11b3('0x27')]);if(_0x5f4c84['name']){delete _0x5f4c84[_0x11b3('0x28')];}_0x1daa65['status'](_0x5e3b71)[_0x11b3('0x29')](_0x5f4c84);};}exports[_0x11b3('0x2a')]=function(_0x476f68,_0xdb7902){var _0x2f1ac6={},_0x196116={},_0x26a378={'count':0x0,'rows':[]};var _0x13d9ed=_[_0x11b3('0x2b')](db['AnalyticCustomReport'][_0x11b3('0x2c')],function(_0x41a8e9){return{'name':_0x41a8e9[_0x11b3('0x2d')],'type':_0x41a8e9[_0x11b3('0x2e')][_0x11b3('0x2f')]};});_0x196116[_0x11b3('0x30')]=_[_0x11b3('0x2b')](_0x13d9ed,_0x11b3('0x28'));_0x196116[_0x11b3('0x31')]=_[_0x11b3('0x32')](_0x476f68[_0x11b3('0x31')]);_0x196116[_0x11b3('0x33')]=_[_0x11b3('0x34')](_0x196116[_0x11b3('0x30')],_0x196116[_0x11b3('0x31')]);_0x2f1ac6[_0x11b3('0x35')]=_[_0x11b3('0x34')](_0x196116['model'],qs[_0x11b3('0x36')](_0x476f68[_0x11b3('0x31')]['fields']));_0x2f1ac6[_0x11b3('0x35')]=_0x2f1ac6[_0x11b3('0x35')]['length']?_0x2f1ac6[_0x11b3('0x35')]:_0x196116[_0x11b3('0x30')];if(!_0x476f68[_0x11b3('0x31')]['hasOwnProperty'](_0x11b3('0x37'))){_0x2f1ac6['limit']=qs[_0x11b3('0x1f')](_0x476f68[_0x11b3('0x31')]['limit']);_0x2f1ac6['offset']=qs['offset'](_0x476f68['query'][_0x11b3('0x1e')]);}_0x2f1ac6[_0x11b3('0x38')]=qs[_0x11b3('0x39')](_0x476f68[_0x11b3('0x31')][_0x11b3('0x39')]);_0x2f1ac6[_0x11b3('0x3a')]=qs[_0x11b3('0x33')](_[_0x11b3('0x3b')](_0x476f68['query'],_0x196116[_0x11b3('0x33')]));if(_0x476f68['query']['filter']){_0x2f1ac6['where']=_[_0x11b3('0x3c')](_0x2f1ac6[_0x11b3('0x3a')],{'$or':_[_0x11b3('0x2b')](_0x13d9ed,function(_0x10562d){if(_0x10562d[_0x11b3('0x2e')]!==_0x11b3('0x3d')){var _0x3536ca={};_0x3536ca[_0x10562d[_0x11b3('0x28')]]={'$like':'%'+_0x476f68[_0x11b3('0x31')]['filter']+'%'};return _0x3536ca;}})});}_0x2f1ac6=_[_0x11b3('0x3c')]({},_0x2f1ac6,_0x476f68['options']);var _0x1b09d1={'where':_0x2f1ac6['where']};return db[_0x11b3('0x3e')][_0x11b3('0x3f')](_0x1b09d1)[_0x11b3('0x25')](function(_0x26a918){_0x26a378[_0x11b3('0x3f')]=_0x26a918;if(_0x476f68[_0x11b3('0x31')]['includeAll']){_0x2f1ac6[_0x11b3('0x40')]=[{'all':!![]}];}return db[_0x11b3('0x3e')][_0x11b3('0x41')](_0x2f1ac6);})[_0x11b3('0x25')](function(_0x41624f){_0x26a378[_0x11b3('0x42')]=_0x41624f;return _0x26a378;})[_0x11b3('0x25')](respondWithFilteredResult(_0xdb7902,_0x2f1ac6))[_0x11b3('0x43')](handleError(_0xdb7902,null));};exports['show']=function(_0x10f7ba,_0x33135f){var _0x27bdc7={'raw':![],'where':{'id':_0x10f7ba[_0x11b3('0x44')]['id']}},_0x5954c6={};_0x5954c6[_0x11b3('0x30')]=_[_0x11b3('0x32')](db[_0x11b3('0x3e')][_0x11b3('0x2c')]);_0x5954c6[_0x11b3('0x31')]=_['keys'](_0x10f7ba[_0x11b3('0x31')]);_0x5954c6['filters']=_['intersection'](_0x5954c6[_0x11b3('0x30')],_0x5954c6[_0x11b3('0x31')]);_0x27bdc7['attributes']=_[_0x11b3('0x34')](_0x5954c6[_0x11b3('0x30')],qs[_0x11b3('0x36')](_0x10f7ba[_0x11b3('0x31')][_0x11b3('0x36')]));_0x27bdc7['attributes']=_0x27bdc7[_0x11b3('0x35')][_0x11b3('0x45')]?_0x27bdc7['attributes']:_0x5954c6[_0x11b3('0x30')];if(_0x10f7ba[_0x11b3('0x31')][_0x11b3('0x46')]){_0x27bdc7[_0x11b3('0x40')]=[{'all':!![]}];}_0x27bdc7=_[_0x11b3('0x3c')]({},_0x27bdc7,_0x10f7ba[_0x11b3('0x47')]);return db['AnalyticCustomReport']['find'](_0x27bdc7)[_0x11b3('0x25')](handleEntityNotFound(_0x33135f,null))[_0x11b3('0x25')](respondWithResult(_0x33135f,null))['catch'](handleError(_0x33135f,null));};exports['create']=function(_0x44c7bd,_0x149abe){return db[_0x11b3('0x3e')]['create'](_0x44c7bd[_0x11b3('0x48')],{})[_0x11b3('0x25')](function(_0x460b50){var _0x12cc90=_0x44c7bd['user'][_0x11b3('0x49')]({'plain':!![]});if(!_0x12cc90)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x12cc90[_0x11b3('0x4a')]===_0x11b3('0x4b')){var _0x334888=_0x460b50['get']({'plain':!![]});var _0x365c1d=_0x11b3('0x4c');return db[_0x11b3('0x4d')][_0x11b3('0x4e')]({'where':{'name':_0x365c1d,'userProfileId':_0x12cc90[_0x11b3('0x4f')]},'raw':!![]})['then'](function(_0x5f3290){if(_0x5f3290&&_0x5f3290[_0x11b3('0x50')]===0x0){return db['UserProfileResource'][_0x11b3('0x51')]({'name':_0x334888[_0x11b3('0x28')],'resourceId':_0x334888['id'],'type':_0x11b3('0x52'),'sectionId':_0x5f3290['id']},{})[_0x11b3('0x25')](function(){return _0x460b50;});}else{return _0x460b50;}})[_0x11b3('0x43')](function(_0x36e9e1){logger[_0x11b3('0x53')](_0x11b3('0x54'),_0x36e9e1);throw _0x36e9e1;});}return _0x460b50;})[_0x11b3('0x25')](respondWithResult(_0x149abe,0xc9))[_0x11b3('0x43')](handleError(_0x149abe,null));};exports[_0x11b3('0x24')]=function(_0x1ae886,_0x478de5){if(_0x1ae886[_0x11b3('0x48')]['id']){delete _0x1ae886[_0x11b3('0x48')]['id'];}return db[_0x11b3('0x3e')][_0x11b3('0x4e')]({'where':{'id':_0x1ae886['params']['id']}})['then'](handleEntityNotFound(_0x478de5,null))['then'](saveUpdates(_0x1ae886[_0x11b3('0x48')],null))['then'](respondWithResult(_0x478de5,null))[_0x11b3('0x43')](handleError(_0x478de5,null));};exports[_0x11b3('0x26')]=function(_0x4357fa,_0x3f943c){return db[_0x11b3('0x3e')][_0x11b3('0x4e')]({'where':{'id':_0x4357fa[_0x11b3('0x44')]['id']}})[_0x11b3('0x25')](handleEntityNotFound(_0x3f943c,null))['then'](removeEntity(_0x3f943c,null))[_0x11b3('0x43')](handleError(_0x3f943c,null));};exports[_0x11b3('0x55')]=function(_0x54c1c1,_0x46c046){var _0x23f386=0xa;var _0x2d8779=[_0x11b3('0x56'),_0x11b3('0x57'),_0x11b3('0x58'),_0x11b3('0x59')];var _0x37dd42={'SUM':_0x11b3('0x5a'),'COUNT':_0x11b3('0x5b'),'COUNT DISTINCT':_0x11b3('0x5c'),'MAX':_0x11b3('0x5d'),'MIN':_0x11b3('0x5e'),'AVG':_0x11b3('0x5f'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x11b3('0x60'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x30f081={'SEC_TO_TIME':_0x11b3('0x61'),'DATE':_0x11b3('0x62'),'HOUR':_0x11b3('0x63'),'ROUND':_0x11b3('0x64'),'UNIX_TIMESTAMP':_0x11b3('0x65')};var _0xb6396a=function(_0x327feb){return!_[_0x11b3('0x66')]([_0x11b3('0x67'),_0x11b3('0x68'),_0x11b3('0x69'),_0x11b3('0x6a')],_0x327feb);};var _0x133228=function(_0x2511aa){if(!_0x2511aa||!_0x2511aa[_0x11b3('0x6b')]['length']){return'';}for(var _0x48af38='(',_0x3f85ff=0x0;_0x3f85ff<_0x2511aa[_0x11b3('0x6b')][_0x11b3('0x45')];_0x3f85ff+=0x1){_0x3f85ff>0x0&&(_0x48af38+='\x20'+_0x2511aa[_0x11b3('0x6c')]+'\x20');_0x48af38+=_0x2511aa['rules'][_0x3f85ff]['group']?_0x133228(_0x2511aa[_0x11b3('0x6b')][_0x3f85ff]['group']):_0x2511aa[_0x11b3('0x6b')][_0x3f85ff][_0x11b3('0x6d')]+'\x20'+_0x2511aa[_0x11b3('0x6b')][_0x3f85ff][_0x11b3('0x6e')]+(_0xb6396a(_0x2511aa[_0x11b3('0x6b')][_0x3f85ff]['condition'])?'\x20'+_0x2511aa[_0x11b3('0x6b')][_0x3f85ff]['value']:'');}return _0x48af38+')';};var _0x3f9353={'where':{'id':_0x54c1c1['params']['id']}},_0x1d5da2,_0x1c208d,_0x1a1c59,_0xe9674d,_0x5c39c9;_0x3f9353=_[_0x11b3('0x3c')]({},_0x3f9353,_0x54c1c1[_0x11b3('0x47')]);return db[_0x11b3('0x3e')][_0x11b3('0x4e')](_0x3f9353)['then'](function(_0x1ec1b5){if(_0x1ec1b5){_0x1d5da2=_0x1ec1b5;return _0x1ec1b5[_0x11b3('0x6f')]();}return null;})[_0x11b3('0x25')](function(_0xa087c5){if(_0xa087c5){if(!_0xa087c5[_0x11b3('0x45')]){throw new db[(_0x11b3('0x70'))][(_0x11b3('0x71'))](_0x11b3('0x72'),0x193);}_0x1c208d=_0xa087c5;return db[_0x11b3('0x73')][_0x11b3('0x41')]({'raw':!![]});}return null;})[_0x11b3('0x25')](function(_0x573fbe){if(_0x573fbe){_0x1a1c59=_[_0x11b3('0x74')](_0x573fbe,'id');var _0x5e7a5b;var _0xe27e39=squel['select']();_0xe27e39['from'](_0x1d5da2[_0x11b3('0x75')]);for(var _0x6bbed6=0x0;_0x6bbed6<_0x1c208d[_0x11b3('0x45')];_0x6bbed6+=0x1){_0x5e7a5b=_0x1c208d[_0x6bbed6][_0x11b3('0x76')]?_0x1a1c59[_0x1c208d[_0x6bbed6]['MetricId']][_0x11b3('0x77')]:_0x1c208d[_0x6bbed6]['field'];_0x5e7a5b=_0x1c208d[_0x6bbed6][_0x11b3('0x78')]?_[_0x11b3('0x79')](_0x37dd42[_0x1c208d[_0x6bbed6][_0x11b3('0x78')]],'%s',_0x5e7a5b):_0x5e7a5b;_0x5e7a5b=_0x1c208d[_0x6bbed6]['format']?_['replace'](_0x30f081[_0x1c208d[_0x6bbed6][_0x11b3('0x7a')]],'%s',_0x5e7a5b):_0x5e7a5b;if(_0x1c208d[_0x6bbed6][_0x11b3('0x7b')]){_0xe27e39[_0x11b3('0x7c')](_0x5e7a5b);}_0x1c208d[_0x6bbed6]['orderBy']&&_0xe27e39[_0x11b3('0x38')](_0x5e7a5b,_0x1c208d[_0x6bbed6]['orderBy']===_0x11b3('0x7d')?![]:!![]);_0xe27e39[_0x11b3('0x6d')](_0x5e7a5b,_0x1c208d[_0x6bbed6][_0x11b3('0x7e')]||_0x5e7a5b);}if(_0x1d5da2['joins']){_0x1d5da2[_0x11b3('0x7f')]=JSON[_0x11b3('0x80')](_0x1d5da2[_0x11b3('0x7f')]);for(var _0x421f80=0x0;_0x421f80<_0x1d5da2[_0x11b3('0x7f')]['length'];_0x421f80+=0x1){if(_0x1d5da2[_0x11b3('0x7f')][_0x421f80][_0x11b3('0x2e')]&&_[_0x11b3('0x66')](_0x2d8779,_0x1d5da2[_0x11b3('0x7f')][_0x421f80][_0x11b3('0x2e')])&&_0x1d5da2[_0x11b3('0x7f')][_0x421f80][_0x11b3('0x81')]&&_0x1d5da2['joins'][_0x421f80][_0x11b3('0x82')]&&_0x1d5da2[_0x11b3('0x7f')][_0x421f80][_0x11b3('0x83')]){_0xe27e39[_0x1d5da2['joins'][_0x421f80][_0x11b3('0x2e')]](_0x1d5da2[_0x11b3('0x7f')][_0x421f80][_0x11b3('0x82')],null,util[_0x11b3('0x7a')]('%s.%s\x20=\x20%s.%s',_0x1d5da2['table'],_0x1d5da2[_0x11b3('0x7f')][_0x421f80][_0x11b3('0x81')],_0x1d5da2[_0x11b3('0x7f')][_0x421f80][_0x11b3('0x82')],_0x1d5da2[_0x11b3('0x7f')][_0x421f80]['foreignKey']));}}}if(_0x1d5da2['conditions']){_0x1d5da2[_0x11b3('0x84')]=JSON[_0x11b3('0x80')](_0x1d5da2[_0x11b3('0x84')]);_0xe27e39[_0x11b3('0x3a')](_0x133228(_0x1d5da2[_0x11b3('0x84')][_0x11b3('0x7c')]));}_0x5c39c9=_0xe27e39['clone']();_0xe27e39[_0x11b3('0x1f')](_0x23f386);_0xe27e39[_0x11b3('0x1e')](0x0);logger['debug']('Limited\x20Query:',_0xe27e39[_0x11b3('0x85')]());return db[_0x11b3('0x86')][_0x11b3('0x31')](_0xe27e39[_0x11b3('0x85')](),{'type':db[_0x11b3('0x86')][_0x11b3('0x87')][_0x11b3('0x88')]});}})[_0x11b3('0x25')](respondWithResult(_0x46c046,null))[_0x11b3('0x43')](handleError(_0x46c046,null));};function runReport(_0x123d86,_0x112332,_0x438b8f){var _0xc6726e=_0x112332[_0x11b3('0x28')];var _0x30a3bb=0xa;var _0x2cde6e=[_0x11b3('0x56'),_0x11b3('0x57'),_0x11b3('0x58'),_0x11b3('0x59')];var _0x2aa810={'SUM':_0x11b3('0x5a'),'COUNT':_0x11b3('0x5b'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x11b3('0x5e'),'AVG':_0x11b3('0x5f'),'GROUP_CONCAT':_0x11b3('0x89'),'GROUP_CONCAT ASC':_0x11b3('0x60'),'GROUP_CONCAT DESC':_0x11b3('0x8a')};var _0x3cbeb5={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x11b3('0x62'),'HOUR':_0x11b3('0x63'),'ROUND':_0x11b3('0x64'),'UNIX_TIMESTAMP':_0x11b3('0x65')};var _0x36c3d0=function(_0x32dd58){return!_['includes']([_0x11b3('0x67'),_0x11b3('0x68'),_0x11b3('0x69'),_0x11b3('0x6a')],_0x32dd58);};var _0x40dae9=function(_0x595723){if(!_0x595723||!_0x595723[_0x11b3('0x6b')][_0x11b3('0x45')]){return'';}for(var _0x3306f1='(',_0x31d588=0x0;_0x31d588<_0x595723[_0x11b3('0x6b')][_0x11b3('0x45')];_0x31d588+=0x1){_0x31d588>0x0&&(_0x3306f1+='\x20'+_0x595723[_0x11b3('0x6c')]+'\x20');_0x3306f1+=_0x595723[_0x11b3('0x6b')][_0x31d588]['group']?_0x40dae9(_0x595723['rules'][_0x31d588]['group']):_0x595723[_0x11b3('0x6b')][_0x31d588][_0x11b3('0x6d')]+'\x20'+_0x595723[_0x11b3('0x6b')][_0x31d588][_0x11b3('0x6e')]+(_0x36c3d0(_0x595723[_0x11b3('0x6b')][_0x31d588][_0x11b3('0x6e')])?'\x20'+_0x595723['rules'][_0x31d588]['value']:'');}return _0x3306f1+')';};var _0x41efa3={'where':{'id':_0x123d86['id']}},_0x2d4aec,_0x3a5ae8,_0x126a71,_0x5f2f4b,_0x56234c;_0x41efa3=_['merge']({},_0x41efa3,_0x438b8f);return db[_0x11b3('0x3e')][_0x11b3('0x4e')](_0x41efa3)['then'](function(_0x49f2e1){if(_0x49f2e1){_0x2d4aec=_0x49f2e1;return _0x49f2e1[_0x11b3('0x6f')]();}return null;})['then'](function(_0x6f26d7){if(_0x6f26d7){if(!_0x6f26d7[_0x11b3('0x45')]){throw new db[(_0x11b3('0x70'))][(_0x11b3('0x71'))](_0x11b3('0x72'),0x193);}_0x3a5ae8=_0x6f26d7;return db['AnalyticMetric'][_0x11b3('0x41')]({'raw':!![]});}return null;})[_0x11b3('0x25')](function(_0x533ff5){if(_0x533ff5){_0x126a71=_[_0x11b3('0x74')](_0x533ff5,'id');var _0x55c138;var _0x53ae4d=squel[_0x11b3('0x8b')]();_0x53ae4d[_0x11b3('0x8c')](_0x2d4aec['table']);for(var _0x54b6d6=0x0;_0x54b6d6<_0x3a5ae8[_0x11b3('0x45')];_0x54b6d6+=0x1){_0x55c138=_0x3a5ae8[_0x54b6d6][_0x11b3('0x76')]?_0x126a71[_0x3a5ae8[_0x54b6d6]['MetricId']][_0x11b3('0x77')]:_0x3a5ae8[_0x54b6d6][_0x11b3('0x6d')];_0x55c138=_0x3a5ae8[_0x54b6d6][_0x11b3('0x78')]?_[_0x11b3('0x79')](_0x2aa810[_0x3a5ae8[_0x54b6d6][_0x11b3('0x78')]],'%s',_0x55c138):_0x55c138;_0x55c138=_0x3a5ae8[_0x54b6d6]['format']?_[_0x11b3('0x79')](_0x3cbeb5[_0x3a5ae8[_0x54b6d6][_0x11b3('0x7a')]],'%s',_0x55c138):_0x55c138;if(_0x3a5ae8[_0x54b6d6][_0x11b3('0x7b')]){_0x53ae4d[_0x11b3('0x7c')](_0x55c138);}_0x3a5ae8[_0x54b6d6][_0x11b3('0x8d')]&&_0x53ae4d[_0x11b3('0x38')](_0x55c138,_0x3a5ae8[_0x54b6d6][_0x11b3('0x8d')]==='DESC'?![]:!![]);_0x53ae4d[_0x11b3('0x6d')](_0x55c138,_0x3a5ae8[_0x54b6d6][_0x11b3('0x7e')]||_0x55c138);}if(_0x2d4aec[_0x11b3('0x7f')]){_0x2d4aec[_0x11b3('0x7f')]=JSON[_0x11b3('0x80')](_0x2d4aec[_0x11b3('0x7f')]);for(var _0x27203e=0x0;_0x27203e<_0x2d4aec[_0x11b3('0x7f')][_0x11b3('0x45')];_0x27203e+=0x1){if(_0x2d4aec['joins'][_0x27203e][_0x11b3('0x2e')]&&_['includes'](_0x2cde6e,_0x2d4aec[_0x11b3('0x7f')][_0x27203e]['type'])&&_0x2d4aec['joins'][_0x27203e][_0x11b3('0x81')]&&_0x2d4aec[_0x11b3('0x7f')][_0x27203e][_0x11b3('0x82')]&&_0x2d4aec['joins'][_0x27203e][_0x11b3('0x83')]){_0x53ae4d[_0x2d4aec['joins'][_0x27203e]['type']](_0x2d4aec[_0x11b3('0x7f')][_0x27203e][_0x11b3('0x82')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x2d4aec[_0x11b3('0x75')],_0x2d4aec[_0x11b3('0x7f')][_0x27203e]['parentKey'],_0x2d4aec[_0x11b3('0x7f')][_0x27203e][_0x11b3('0x82')],_0x2d4aec['joins'][_0x27203e]['foreignKey']));}}}if(_0x2d4aec['conditions']){_0x2d4aec[_0x11b3('0x84')]=JSON[_0x11b3('0x80')](_0x2d4aec[_0x11b3('0x84')]);_0x53ae4d[_0x11b3('0x3a')](_0x40dae9(_0x2d4aec['conditions'][_0x11b3('0x7c')]));}_0x56234c=_0x53ae4d[_0x11b3('0x8e')]();_0x53ae4d[_0x11b3('0x1f')](_0x30a3bb);_0x53ae4d[_0x11b3('0x1e')](0x0);logger['debug'](_0x11b3('0x8f'),_0x53ae4d[_0x11b3('0x85')]());return db[_0x11b3('0x86')][_0x11b3('0x31')](_0x53ae4d[_0x11b3('0x85')](),{'type':db[_0x11b3('0x86')][_0x11b3('0x87')]['SELECT']});}})[_0x11b3('0x25')](function(_0x224576){if(!_0x224576['length']){throw new db['Sequelize'][(_0x11b3('0x71'))]('No\x20available\x20data',0xcc);}if(_0x112332[_0x11b3('0x90')]===_0x11b3('0x91')){return null;}var _0x4ce360=_[_0x11b3('0x3c')](_0x112332,{'name':_0x112332[_0x11b3('0x92')]||_0x112332[_0x11b3('0x28')]||_0x2d4aec[_0x11b3('0x28')],'basename':_0xc6726e,'savename':util[_0x11b3('0x7a')](_0x11b3('0x93'),_0x112332[_0x11b3('0x28')]||_0x2d4aec['name'],require('randomstring')[_0x11b3('0x94')](0x4),_0x112332[_0x11b3('0x90')]||_0x11b3('0x95')),'reportId':_0x2d4aec['id'],'reportType':_0x11b3('0x96')});return db['AnalyticExtractedReport']['create'](_0x4ce360,{'raw':!![]});})[_0x11b3('0x25')](function(_0x5cb1ed){if(_0x2d4aec[_0x11b3('0x75')]===_0x11b3('0x97')){_0x56234c['where'](_0x2d4aec[_0x11b3('0x75')]+_0x11b3('0x98'),_0x112332[_0x11b3('0x99')],_0x112332[_0x11b3('0x9a')]);}else{_0x56234c[_0x11b3('0x3a')](_0x2d4aec[_0x11b3('0x75')]+_0x11b3('0x9b'),_0x112332[_0x11b3('0x99')],_0x112332[_0x11b3('0x9a')]);}if(_0x5cb1ed){logger[_0x11b3('0x9c')](_0x11b3('0x9d'),_0x56234c[_0x11b3('0x85')]());require(_0x11b3('0x9e'))[_0x11b3('0x9f')](path[_0x11b3('0x56')](__dirname,_0x11b3('0xa0'),_0x5cb1ed[_0x11b3('0x90')]),[_0x5cb1ed['id'],_0x56234c[_0x11b3('0x85')](),path[_0x11b3('0x56')](__dirname,_0x11b3('0xa1'),_0x5cb1ed[_0x11b3('0xa2')]),_0xc6726e]);return _0x5cb1ed;}else{var _0x25aeea=squel[_0x11b3('0x8b')]();_0x25aeea[_0x11b3('0x8c')]('('+_0x56234c[_0x11b3('0x85')]()+')','countTable');_0x25aeea['field'](_0x11b3('0xa3'),_0x11b3('0x3f'));_0x56234c[_0x11b3('0x1f')](_0x112332[_0x11b3('0x1f')]||_0x30a3bb);_0x56234c[_0x11b3('0x1e')](_0x112332[_0x11b3('0x1e')]||0x0);return db[_0x11b3('0x86')][_0x11b3('0x31')](_0x25aeea[_0x11b3('0x85')](),{'type':db[_0x11b3('0x86')]['QueryTypes'][_0x11b3('0x88')]})[_0x11b3('0x25')](function(_0x59b334){if(!_0x59b334[_0x11b3('0x45')]){_0x5f2f4b=0x0;}else{_0x5f2f4b=_0x59b334[0x0]['count']||0x0;}return db[_0x11b3('0x86')][_0x11b3('0x31')](_0x56234c[_0x11b3('0x85')](),{'type':db[_0x11b3('0x86')]['QueryTypes'][_0x11b3('0x88')]});})[_0x11b3('0x25')](function(_0x1f63e8){return{'rows':_0x1f63e8||[],'count':_0x5f2f4b};});}});}exports[_0x11b3('0xa4')]=function(_0x340ebd,_0x215693){return runReport(_0x340ebd[_0x11b3('0x44')],_0x340ebd['query'],_0x340ebd[_0x11b3('0x47')])[_0x11b3('0x25')](respondWithResult(_0x215693,null))[_0x11b3('0x43')](handleError(_0x215693,null));};exports[_0x11b3('0xa5')]=runReport;exports[_0x11b3('0x31')]=function(_0x1a45b8,_0x4da79e){var _0x295f65=0xa;var _0x29bffa=[_0x11b3('0x56'),_0x11b3('0x57'),_0x11b3('0x58'),_0x11b3('0x59')];var _0x3c36d2={'SUM':'SUM(%s)','COUNT':_0x11b3('0x5b'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x11b3('0x5e'),'AVG':_0x11b3('0x5f'),'GROUP_CONCAT':_0x11b3('0x89'),'GROUP_CONCAT ASC':_0x11b3('0x60'),'GROUP_CONCAT DESC':_0x11b3('0x8a')};var _0x44e52e={'SEC_TO_TIME':_0x11b3('0x61'),'DATE':_0x11b3('0x62'),'HOUR':_0x11b3('0x63'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x11b3('0x65')};var _0x53f219=function(_0x49c1d8){return!_[_0x11b3('0x66')]([_0x11b3('0x67'),'IS\x20NOT\x20NULL',_0x11b3('0x69'),_0x11b3('0x6a')],_0x49c1d8);};var _0x426a98=function(_0x257bbe){if(!_0x257bbe||!_0x257bbe[_0x11b3('0x6b')][_0x11b3('0x45')]){return'';}for(var _0x456d3e='(',_0x36725c=0x0;_0x36725c<_0x257bbe[_0x11b3('0x6b')][_0x11b3('0x45')];_0x36725c+=0x1){_0x36725c>0x0&&(_0x456d3e+='\x20'+_0x257bbe['operator']+'\x20');_0x456d3e+=_0x257bbe[_0x11b3('0x6b')][_0x36725c][_0x11b3('0x7c')]?_0x426a98(_0x257bbe['rules'][_0x36725c][_0x11b3('0x7c')]):_0x257bbe['rules'][_0x36725c][_0x11b3('0x6d')]+'\x20'+_0x257bbe[_0x11b3('0x6b')][_0x36725c][_0x11b3('0x6e')]+(_0x53f219(_0x257bbe[_0x11b3('0x6b')][_0x36725c]['condition'])?'\x20'+_0x257bbe[_0x11b3('0x6b')][_0x36725c]['value']:'');}return _0x456d3e+')';};var _0x6e8a47={'where':{'id':_0x1a45b8[_0x11b3('0x44')]['id']}},_0x467ed4,_0x5e1159,_0x4d2557,_0x3f5fea,_0x37369c;_0x6e8a47=_[_0x11b3('0x3c')]({},_0x6e8a47,_0x1a45b8[_0x11b3('0x47')]);return db[_0x11b3('0x3e')][_0x11b3('0x4e')](_0x6e8a47)[_0x11b3('0x25')](function(_0x103526){if(_0x103526){_0x467ed4=_0x103526;return _0x103526[_0x11b3('0x6f')]();}return null;})[_0x11b3('0x25')](function(_0x129be2){if(_0x129be2){if(!_0x129be2[_0x11b3('0x45')]){throw new db[(_0x11b3('0x70'))][(_0x11b3('0x71'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5e1159=_0x129be2;return db[_0x11b3('0x73')][_0x11b3('0x41')]({'raw':!![]});}return null;})[_0x11b3('0x25')](function(_0x307e18){if(_0x307e18){_0x4d2557=_['keyBy'](_0x307e18,'id');var _0x446bfd;var _0x298ea6=squel[_0x11b3('0x8b')]();_0x298ea6['from'](_0x467ed4[_0x11b3('0x75')]);for(var _0x49cbfb=0x0;_0x49cbfb<_0x5e1159[_0x11b3('0x45')];_0x49cbfb+=0x1){_0x446bfd=_0x5e1159[_0x49cbfb][_0x11b3('0x76')]?_0x4d2557[_0x5e1159[_0x49cbfb][_0x11b3('0x76')]]['metric']:_0x5e1159[_0x49cbfb][_0x11b3('0x6d')];_0x446bfd=_0x5e1159[_0x49cbfb][_0x11b3('0x78')]?_[_0x11b3('0x79')](_0x3c36d2[_0x5e1159[_0x49cbfb][_0x11b3('0x78')]],'%s',_0x446bfd):_0x446bfd;_0x446bfd=_0x5e1159[_0x49cbfb]['format']?_[_0x11b3('0x79')](_0x44e52e[_0x5e1159[_0x49cbfb][_0x11b3('0x7a')]],'%s',_0x446bfd):_0x446bfd;if(_0x5e1159[_0x49cbfb][_0x11b3('0x7b')]){_0x298ea6[_0x11b3('0x7c')](_0x446bfd);}_0x5e1159[_0x49cbfb][_0x11b3('0x8d')]&&_0x298ea6[_0x11b3('0x38')](_0x446bfd,_0x5e1159[_0x49cbfb][_0x11b3('0x8d')]===_0x11b3('0x7d')?![]:!![]);_0x298ea6[_0x11b3('0x6d')](_0x446bfd,_0x5e1159[_0x49cbfb][_0x11b3('0x7e')]||_0x446bfd);}if(_0x467ed4[_0x11b3('0x7f')]){_0x467ed4[_0x11b3('0x7f')]=JSON[_0x11b3('0x80')](_0x467ed4[_0x11b3('0x7f')]);for(var _0x25bf1d=0x0;_0x25bf1d<_0x467ed4['joins'][_0x11b3('0x45')];_0x25bf1d+=0x1){if(_0x467ed4[_0x11b3('0x7f')][_0x25bf1d]['type']&&_[_0x11b3('0x66')](_0x29bffa,_0x467ed4[_0x11b3('0x7f')][_0x25bf1d][_0x11b3('0x2e')])&&_0x467ed4[_0x11b3('0x7f')][_0x25bf1d][_0x11b3('0x81')]&&_0x467ed4[_0x11b3('0x7f')][_0x25bf1d][_0x11b3('0x82')]&&_0x467ed4[_0x11b3('0x7f')][_0x25bf1d]['foreignKey']){_0x298ea6[_0x467ed4[_0x11b3('0x7f')][_0x25bf1d][_0x11b3('0x2e')]](_0x467ed4[_0x11b3('0x7f')][_0x25bf1d][_0x11b3('0x82')],null,util[_0x11b3('0x7a')](_0x11b3('0xa6'),_0x467ed4[_0x11b3('0x75')],_0x467ed4[_0x11b3('0x7f')][_0x25bf1d]['parentKey'],_0x467ed4[_0x11b3('0x7f')][_0x25bf1d][_0x11b3('0x82')],_0x467ed4[_0x11b3('0x7f')][_0x25bf1d]['foreignKey']));}}}if(_0x467ed4[_0x11b3('0x84')]){_0x467ed4[_0x11b3('0x84')]=JSON[_0x11b3('0x80')](_0x467ed4[_0x11b3('0x84')]);_0x298ea6[_0x11b3('0x3a')](_0x426a98(_0x467ed4[_0x11b3('0x84')][_0x11b3('0x7c')]));}_0x37369c=_0x298ea6['clone']();_0x298ea6[_0x11b3('0x1f')](_0x295f65);_0x298ea6[_0x11b3('0x1e')](0x0);logger[_0x11b3('0xa7')]('Limited\x20Query:',_0x298ea6[_0x11b3('0x85')]());return db[_0x11b3('0x86')][_0x11b3('0x31')](_0x298ea6[_0x11b3('0x85')](),{'type':db[_0x11b3('0x86')]['QueryTypes'][_0x11b3('0x88')]});}})[_0x11b3('0x25')](function(){return{'sql':_0x37369c[_0x11b3('0x85')]()};})[_0x11b3('0x25')](respondWithResult(_0x4da79e,null))[_0x11b3('0x43')](handleError(_0x4da79e,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 00ae4c1..31849c3 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 _0x59d0=['../../config/logger','api','bluebird','request-promise','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports'];(function(_0x8b8564,_0x162976){var _0x360c61=function(_0x164cc9){while(--_0x164cc9){_0x8b8564['push'](_0x8b8564['shift']());}};_0x360c61(++_0x162976);}(_0x59d0,0x99));var _0x059d=function(_0x28bdc0,_0x29a707){_0x28bdc0=_0x28bdc0-0x0;var _0x89a93=_0x59d0[_0x28bdc0];return _0x89a93;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x059d('0x0'))(_0x059d('0x1'));var moment=require('moment');var BPromise=require(_0x059d('0x2'));var rp=require(_0x059d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x059d('0x4'));module[_0x059d('0x5')]=function(_0x2738c0,_0x4c96a5){return _0x2738c0[_0x059d('0x6')](_0x059d('0x7'),attributes,{'tableName':_0x059d('0x8'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea26=['moment','bluebird','request-promise','path','rimraf','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','../../config/logger','api'];(function(_0xf34109,_0x380779){var _0x570bfc=function(_0x1ad086){while(--_0x1ad086){_0xf34109['push'](_0xf34109['shift']());}};_0x570bfc(++_0x380779);}(_0xea26,0x8d));var _0x6ea2=function(_0x38c596,_0x520267){_0x38c596=_0x38c596-0x0;var _0x1c095f=_0xea26[_0x38c596];return _0x1c095f;};'use strict';var _=require(_0x6ea2('0x0'));var util=require('util');var logger=require(_0x6ea2('0x1'))(_0x6ea2('0x2'));var moment=require(_0x6ea2('0x3'));var BPromise=require(_0x6ea2('0x4'));var rp=require(_0x6ea2('0x5'));var fs=require('fs');var path=require(_0x6ea2('0x6'));var rimraf=require(_0x6ea2('0x7'));var config=require('../../config/environment');var attributes=require('./analyticCustomReport.attributes');module[_0x6ea2('0x8')]=function(_0x327ecb,_0x17d75b){return _0x327ecb[_0x6ea2('0x9')](_0x6ea2('0xa'),attributes,{'tableName':_0x6ea2('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 610ab10..444a2b7 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 _0xf06f=['request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','AnalyticCustomReport,\x20%s,\x20%s'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xf06f,0x1cb));var _0xff06=function(_0x482f97,_0x569929){_0x482f97=_0x482f97-0x0;var _0x4870eb=_0xf06f[_0x482f97];return _0x4870eb;};'use strict';var _=require(_0xff06('0x0'));var util=require(_0xff06('0x1'));var moment=require(_0xff06('0x2'));var BPromise=require(_0xff06('0x3'));var rs=require(_0xff06('0x4'));var fs=require('fs');var Redis=require(_0xff06('0x5'));var db=require(_0xff06('0x6'))['db'];var utils=require(_0xff06('0x7'));var logger=require(_0xff06('0x8'))(_0xff06('0x9'));var config=require('../../config/environment');var jayson=require(_0xff06('0xa'));var client=jayson[_0xff06('0xb')][_0xff06('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2621b0,_0xa4ddcc,_0xfecd1b){return new BPromise(function(_0x5037c5,_0x1587a7){return client[_0xff06('0xd')](_0x2621b0,_0xfecd1b)[_0xff06('0xe')](function(_0x34f5fd){logger['info'](_0xff06('0xf'),_0xa4ddcc,_0xff06('0x10'));logger[_0xff06('0x11')](_0xff06('0x12'),_0xa4ddcc,'request\x20sent',JSON[_0xff06('0x13')](_0x34f5fd));if(_0x34f5fd['error']){if(_0x34f5fd[_0xff06('0x14')]['code']===0x1f4){logger[_0xff06('0x14')]('AnalyticCustomReport,\x20%s,\x20%s',_0xa4ddcc,_0x34f5fd[_0xff06('0x14')][_0xff06('0x15')]);return _0x1587a7(_0x34f5fd[_0xff06('0x14')][_0xff06('0x15')]);}logger[_0xff06('0x14')](_0xff06('0xf'),_0xa4ddcc,_0x34f5fd[_0xff06('0x14')][_0xff06('0x15')]);return _0x5037c5(_0x34f5fd[_0xff06('0x14')]['message']);}else{logger[_0xff06('0x16')](_0xff06('0xf'),_0xa4ddcc,'request\x20sent');_0x5037c5(_0x34f5fd[_0xff06('0x17')][_0xff06('0x15')]);}})[_0xff06('0x18')](function(_0x411ff9){logger[_0xff06('0x14')](_0xff06('0xf'),_0xa4ddcc,_0x411ff9);_0x1587a7(_0x411ff9);});});} \ No newline at end of file +var _0x7844=['moment','../../mysqldb','../../config/logger','rpc','../../config/environment','request','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util'];(function(_0x3e224a,_0x112ec2){var _0x3028bc=function(_0x5d3324){while(--_0x5d3324){_0x3e224a['push'](_0x3e224a['shift']());}};_0x3028bc(++_0x112ec2);}(_0x7844,0x19d));var _0x4784=function(_0x3ba8c2,_0x3a10ef){_0x3ba8c2=_0x3ba8c2-0x0;var _0x3f8dd5=_0x7844[_0x3ba8c2];return _0x3f8dd5;};'use strict';var _=require('lodash');var util=require(_0x4784('0x0'));var moment=require(_0x4784('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4784('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x4784('0x3'))(_0x4784('0x4'));var config=require(_0x4784('0x5'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xb2cde,_0x144e8c,_0x122125){return new BPromise(function(_0x267e12,_0x19084a){return client[_0x4784('0x6')](_0xb2cde,_0x122125)[_0x4784('0x7')](function(_0x88d20){logger['info'](_0x4784('0x8'),_0x144e8c,_0x4784('0x9'));logger[_0x4784('0xa')](_0x4784('0xb'),_0x144e8c,_0x4784('0x9'),JSON[_0x4784('0xc')](_0x88d20));if(_0x88d20[_0x4784('0xd')]){if(_0x88d20[_0x4784('0xd')][_0x4784('0xe')]===0x1f4){logger['error'](_0x4784('0x8'),_0x144e8c,_0x88d20[_0x4784('0xd')][_0x4784('0xf')]);return _0x19084a(_0x88d20[_0x4784('0xd')]['message']);}logger[_0x4784('0xd')](_0x4784('0x8'),_0x144e8c,_0x88d20[_0x4784('0xd')]['message']);return _0x267e12(_0x88d20[_0x4784('0xd')][_0x4784('0xf')]);}else{logger[_0x4784('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x144e8c,'request\x20sent');_0x267e12(_0x88d20['result']['message']);}})[_0x4784('0x11')](function(_0x118817){logger[_0x4784('0xd')](_0x4784('0x8'),_0x144e8c,_0x118817);_0x19084a(_0x118817);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index c32f332..79b436f 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 _0xcc05=['run','query','put','update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','index','get','/:id','/:id/preview','/:id/run'];(function(_0x22e0dd,_0x204e12){var _0x21f71b=function(_0x5aec1a){while(--_0x5aec1a){_0x22e0dd['push'](_0x22e0dd['shift']());}};_0x21f71b(++_0x204e12);}(_0xcc05,0x102));var _0x5cc0=function(_0x53c506,_0x1c0fe8){_0x53c506=_0x53c506-0x0;var _0x165888=_0xcc05[_0x53c506];return _0x165888;};'use strict';var multer=require(_0x5cc0('0x0'));var util=require(_0x5cc0('0x1'));var path=require(_0x5cc0('0x2'));var timeout=require(_0x5cc0('0x3'));var express=require(_0x5cc0('0x4'));var router=express['Router']();var auth=require(_0x5cc0('0x5'));var interaction=require(_0x5cc0('0x6'));var config=require(_0x5cc0('0x7'));var controller=require(_0x5cc0('0x8'));router['get']('/',auth[_0x5cc0('0x9')](),controller[_0x5cc0('0xa')]);router[_0x5cc0('0xb')](_0x5cc0('0xc'),auth[_0x5cc0('0x9')](),controller['show']);router[_0x5cc0('0xb')](_0x5cc0('0xd'),auth['isAuthenticated'](),controller['preview']);router[_0x5cc0('0xb')](_0x5cc0('0xe'),auth[_0x5cc0('0x9')](),controller[_0x5cc0('0xf')]);router[_0x5cc0('0xb')]('/:id/query',auth[_0x5cc0('0x9')](),controller[_0x5cc0('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x5cc0('0x11')](_0x5cc0('0xc'),auth[_0x5cc0('0x9')](),controller[_0x5cc0('0x12')]);router[_0x5cc0('0x13')](_0x5cc0('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x5cc0('0x14')]=router; \ No newline at end of file +var _0xdaf6=['post','create','update','delete','exports','multer','path','express','Router','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query'];(function(_0x420b24,_0x382adc){var _0x4da552=function(_0x4e1623){while(--_0x4e1623){_0x420b24['push'](_0x420b24['shift']());}};_0x4da552(++_0x382adc);}(_0xdaf6,0xa6));var _0x6daf=function(_0x43ee7e,_0x78e09b){_0x43ee7e=_0x43ee7e-0x0;var _0x22d326=_0xdaf6[_0x43ee7e];return _0x22d326;};'use strict';var multer=require(_0x6daf('0x0'));var util=require('util');var path=require(_0x6daf('0x1'));var timeout=require('connect-timeout');var express=require(_0x6daf('0x2'));var router=express[_0x6daf('0x3')]();var auth=require(_0x6daf('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6daf('0x5'));var controller=require(_0x6daf('0x6'));router[_0x6daf('0x7')]('/',auth[_0x6daf('0x8')](),controller[_0x6daf('0x9')]);router[_0x6daf('0x7')](_0x6daf('0xa'),auth[_0x6daf('0x8')](),controller[_0x6daf('0xb')]);router[_0x6daf('0x7')](_0x6daf('0xc'),auth[_0x6daf('0x8')](),controller[_0x6daf('0xd')]);router[_0x6daf('0x7')](_0x6daf('0xe'),auth['isAuthenticated'](),controller[_0x6daf('0xf')]);router[_0x6daf('0x7')](_0x6daf('0x10'),auth[_0x6daf('0x8')](),controller[_0x6daf('0x11')]);router[_0x6daf('0x12')]('/',auth[_0x6daf('0x8')](),controller[_0x6daf('0x13')]);router['put'](_0x6daf('0xa'),auth['isAuthenticated'](),controller[_0x6daf('0x14')]);router[_0x6daf('0x15')]('/:id',auth[_0x6daf('0x8')](),controller['destroy']);module[_0x6daf('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index b692509..755e93e 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 _0x7ac3=['STRING','TEXT','sequelize','exports'];(function(_0x43e914,_0x5774df){var _0x34b8e2=function(_0x9da7ab){while(--_0x9da7ab){_0x43e914['push'](_0x43e914['shift']());}};_0x34b8e2(++_0x5774df);}(_0x7ac3,0x136));var _0x37ac=function(_0x2a0139,_0x42d2e0){_0x2a0139=_0x2a0139-0x0;var _0x2462d9=_0x7ac3[_0x2a0139];return _0x2462d9;};'use strict';var Sequelize=require(_0x37ac('0x0'));module[_0x37ac('0x1')]={'name':{'type':Sequelize[_0x37ac('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x37ac('0x2')]},'table':{'type':Sequelize[_0x37ac('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x37ac('0x3')]}}; \ No newline at end of file +var _0xabbb=['STRING','TEXT'];(function(_0xea9dd8,_0x45dc1c){var _0x18a0b0=function(_0x5bcbad){while(--_0x5bcbad){_0xea9dd8['push'](_0xea9dd8['shift']());}};_0x18a0b0(++_0x45dc1c);}(_0xabbb,0x1d2));var _0xbabb=function(_0xb6baf0,_0x2b9cce){_0xb6baf0=_0xb6baf0-0x0;var _0x2f3c36=_0xabbb[_0xb6baf0];return _0x2f3c36;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xbabb('0x0')]},'parent':{'type':Sequelize[_0xbabb('0x0')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xbabb('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index ce75f33..5d8ae19 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 _0x0b3b=['conditions','group','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','join','left_join','SUM(%s)','operator','AnalyticMetric','order','QueryTypes','No\x20available\x20data','output','web','fullPath','randomstring','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','fork','../../files/reports','savename','countTable','COUNT(*)','run','runReport','COUNT(DISTINCT\x20%s)','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','DefaultReports','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticDefaultReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','includeAll','findAll','rows','show','params','rawAttributes','length','include','options','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','right_join','cross_join','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','includes','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s'];(function(_0x1abb4d,_0x13e318){var _0x55686e=function(_0x56b6e4){while(--_0x56b6e4){_0x1abb4d['push'](_0x1abb4d['shift']());}};_0x55686e(++_0x13e318);}(_0x0b3b,0xcd));var _0xb0b3=function(_0x1d174c,_0xd71a94){_0x1d174c=_0x1d174c-0x0;var _0x193cbf=_0x0b3b[_0x1d174c];return _0x193cbf;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb0b3('0x0'));var rimraf=require(_0xb0b3('0x1'));var zipdir=require(_0xb0b3('0x2'));var jsonpatch=require(_0xb0b3('0x3'));var rp=require(_0xb0b3('0x4'));var moment=require(_0xb0b3('0x5'));var BPromise=require(_0xb0b3('0x6'));var Mustache=require(_0xb0b3('0x7'));var util=require(_0xb0b3('0x8'));var path=require(_0xb0b3('0x9'));var sox=require(_0xb0b3('0xa'));var csv=require('to-csv');var ejs=require(_0xb0b3('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb0b3('0xc'));var crypto=require(_0xb0b3('0xd'));var jsforce=require(_0xb0b3('0xe'));var deskjs=require(_0xb0b3('0xf'));var toCsv=require(_0xb0b3('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb0b3('0x11'));var qs=require(_0xb0b3('0x12'));var as=require(_0xb0b3('0x13'));var hardwareService=require(_0xb0b3('0x14'));var logger=require(_0xb0b3('0x15'))(_0xb0b3('0x16'));var utils=require(_0xb0b3('0x17'));var config=require('../../config/environment');var db=require(_0xb0b3('0x18'))['db'];function respondWithStatusCode(_0x442ab8,_0x5d9f21){_0x5d9f21=_0x5d9f21||0xcc;return function(_0x46ff50){if(_0x46ff50){return _0x442ab8['sendStatus'](_0x5d9f21);}return _0x442ab8[_0xb0b3('0x19')](_0x5d9f21)[_0xb0b3('0x1a')]();};}function respondWithResult(_0x315d5b,_0x2f654d){_0x2f654d=_0x2f654d||0xc8;return function(_0x3692ac){if(_0x3692ac){return _0x315d5b[_0xb0b3('0x19')](_0x2f654d)[_0xb0b3('0x1b')](_0x3692ac);}};}function respondWithFilteredResult(_0x2c284d,_0x7bfb7){return function(_0x49a115){if(_0x49a115){var _0xd13b9d=_0x49a115[_0xb0b3('0x1c')],_0x4299bb=_0x7bfb7['offset'],_0x5baf49=_0x7bfb7[_0xb0b3('0x1d')]+_0x7bfb7[_0xb0b3('0x1e')],_0x411543;if(_0x5baf49>=_0xd13b9d){_0x5baf49=_0xd13b9d;_0x411543=0xc8;}else{_0x411543=0xce;}_0x2c284d['status'](_0x411543);return _0x2c284d['set'](_0xb0b3('0x1f'),_0x4299bb+'-'+_0x5baf49+'/'+_0xd13b9d)['json'](_0x49a115);}return null;};}function patchUpdates(_0x55a2b3){return function(_0x27b06e){try{jsonpatch[_0xb0b3('0x20')](_0x27b06e,_0x55a2b3,!![]);}catch(_0xdf1655){return BPromise[_0xb0b3('0x21')](_0xdf1655);}return _0x27b06e[_0xb0b3('0x22')]();};}function saveUpdates(_0x1a5ee2,_0x3b48bf){return function(_0x59f3b4){if(_0x59f3b4){return _0x59f3b4[_0xb0b3('0x23')](_0x1a5ee2)[_0xb0b3('0x24')](function(_0x570dd9){return _0x570dd9;});}return null;};}function removeEntity(_0x1d87f1,_0x472076){return function(_0x1ce586){if(_0x1ce586){return _0x1ce586[_0xb0b3('0x25')]()[_0xb0b3('0x24')](function(){var _0x48e07c=_0x1ce586['get']({'plain':!![]});var _0x2f24df=_0xb0b3('0x26');return db[_0xb0b3('0x27')]['destroy']({'where':{'type':_0x2f24df,'resourceId':_0x48e07c['id']}})[_0xb0b3('0x24')](function(){return _0x1ce586;});})[_0xb0b3('0x24')](function(){_0x1d87f1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x10eba9,_0x18763f){return function(_0xb3266c){if(!_0xb3266c){_0x10eba9[_0xb0b3('0x28')](0x194);}return _0xb3266c;};}function handleError(_0x28b41f,_0x551a1a){_0x551a1a=_0x551a1a||0x1f4;return function(_0xbdfb12){logger[_0xb0b3('0x29')](_0xbdfb12[_0xb0b3('0x2a')]);if(_0xbdfb12[_0xb0b3('0x2b')]){delete _0xbdfb12[_0xb0b3('0x2b')];}_0x28b41f[_0xb0b3('0x19')](_0x551a1a)[_0xb0b3('0x2c')](_0xbdfb12);};}exports[_0xb0b3('0x2d')]=function(_0x2aab3c,_0x1ddf24){var _0x4487ee={},_0x154f2c={},_0x38f838={'count':0x0,'rows':[]};var _0x40f453=_[_0xb0b3('0x2e')](db[_0xb0b3('0x2f')]['rawAttributes'],function(_0x21d503){return{'name':_0x21d503[_0xb0b3('0x30')],'type':_0x21d503[_0xb0b3('0x31')][_0xb0b3('0x32')]};});_0x154f2c[_0xb0b3('0x33')]=_[_0xb0b3('0x2e')](_0x40f453,'name');_0x154f2c[_0xb0b3('0x34')]=_[_0xb0b3('0x35')](_0x2aab3c[_0xb0b3('0x34')]);_0x154f2c[_0xb0b3('0x36')]=_[_0xb0b3('0x37')](_0x154f2c[_0xb0b3('0x33')],_0x154f2c[_0xb0b3('0x34')]);_0x4487ee[_0xb0b3('0x38')]=_[_0xb0b3('0x37')](_0x154f2c[_0xb0b3('0x33')],qs[_0xb0b3('0x39')](_0x2aab3c[_0xb0b3('0x34')][_0xb0b3('0x39')]));_0x4487ee['attributes']=_0x4487ee[_0xb0b3('0x38')]['length']?_0x4487ee[_0xb0b3('0x38')]:_0x154f2c[_0xb0b3('0x33')];if(!_0x2aab3c[_0xb0b3('0x34')][_0xb0b3('0x3a')](_0xb0b3('0x3b'))){_0x4487ee[_0xb0b3('0x1e')]=qs[_0xb0b3('0x1e')](_0x2aab3c[_0xb0b3('0x34')][_0xb0b3('0x1e')]);_0x4487ee[_0xb0b3('0x1d')]=qs[_0xb0b3('0x1d')](_0x2aab3c[_0xb0b3('0x34')][_0xb0b3('0x1d')]);}_0x4487ee['order']=qs[_0xb0b3('0x3c')](_0x2aab3c[_0xb0b3('0x34')]['sort']);_0x4487ee['where']=qs[_0xb0b3('0x36')](_[_0xb0b3('0x3d')](_0x2aab3c[_0xb0b3('0x34')],_0x154f2c[_0xb0b3('0x36')]));if(_0x2aab3c[_0xb0b3('0x34')][_0xb0b3('0x3e')]){_0x4487ee[_0xb0b3('0x3f')]=_['merge'](_0x4487ee[_0xb0b3('0x3f')],{'$or':_[_0xb0b3('0x2e')](_0x40f453,function(_0x38bd10){if(_0x38bd10[_0xb0b3('0x31')]!==_0xb0b3('0x40')){var _0x515d39={};_0x515d39[_0x38bd10[_0xb0b3('0x2b')]]={'$like':'%'+_0x2aab3c[_0xb0b3('0x34')][_0xb0b3('0x3e')]+'%'};return _0x515d39;}})});}_0x4487ee=_[_0xb0b3('0x41')]({},_0x4487ee,_0x2aab3c['options']);var _0x31a3c4={'where':_0x4487ee[_0xb0b3('0x3f')]};return db[_0xb0b3('0x2f')][_0xb0b3('0x1c')](_0x31a3c4)[_0xb0b3('0x24')](function(_0x31a082){_0x38f838['count']=_0x31a082;if(_0x2aab3c[_0xb0b3('0x34')][_0xb0b3('0x42')]){_0x4487ee['include']=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0xb0b3('0x43')](_0x4487ee);})[_0xb0b3('0x24')](function(_0x286f2c){_0x38f838[_0xb0b3('0x44')]=_0x286f2c;return _0x38f838;})[_0xb0b3('0x24')](respondWithFilteredResult(_0x1ddf24,_0x4487ee))['catch'](handleError(_0x1ddf24,null));};exports[_0xb0b3('0x45')]=function(_0x2bccb3,_0x4772a2){var _0x2737a4={'raw':!![],'where':{'id':_0x2bccb3[_0xb0b3('0x46')]['id']}},_0x25448c={};_0x25448c[_0xb0b3('0x33')]=_[_0xb0b3('0x35')](db[_0xb0b3('0x2f')][_0xb0b3('0x47')]);_0x25448c[_0xb0b3('0x34')]=_['keys'](_0x2bccb3['query']);_0x25448c[_0xb0b3('0x36')]=_[_0xb0b3('0x37')](_0x25448c[_0xb0b3('0x33')],_0x25448c[_0xb0b3('0x34')]);_0x2737a4['attributes']=_[_0xb0b3('0x37')](_0x25448c[_0xb0b3('0x33')],qs['fields'](_0x2bccb3['query'][_0xb0b3('0x39')]));_0x2737a4['attributes']=_0x2737a4['attributes'][_0xb0b3('0x48')]?_0x2737a4[_0xb0b3('0x38')]:_0x25448c[_0xb0b3('0x33')];if(_0x2bccb3[_0xb0b3('0x34')][_0xb0b3('0x42')]){_0x2737a4[_0xb0b3('0x49')]=[{'all':!![]}];}_0x2737a4=_['merge']({},_0x2737a4,_0x2bccb3[_0xb0b3('0x4a')]);return db[_0xb0b3('0x2f')][_0xb0b3('0x4b')](_0x2737a4)[_0xb0b3('0x24')](handleEntityNotFound(_0x4772a2,null))[_0xb0b3('0x24')](respondWithResult(_0x4772a2,null))[_0xb0b3('0x4c')](handleError(_0x4772a2,null));};exports[_0xb0b3('0x4d')]=function(_0x13464f,_0x32c859){return db['AnalyticDefaultReport'][_0xb0b3('0x4d')](_0x13464f['body'],{})['then'](function(_0x599eae){var _0x1260be=_0x13464f[_0xb0b3('0x4e')][_0xb0b3('0x4f')]({'plain':!![]});if(!_0x1260be)throw new Error(_0xb0b3('0x50'));if(_0x1260be['role']==='user'){var _0x787cf3=_0x599eae[_0xb0b3('0x4f')]({'plain':!![]});var _0x1732dd=_0xb0b3('0x51');return db[_0xb0b3('0x52')][_0xb0b3('0x4b')]({'where':{'name':_0x1732dd,'userProfileId':_0x1260be['userProfileId']},'raw':!![]})[_0xb0b3('0x24')](function(_0x5ec8db){if(_0x5ec8db&&_0x5ec8db[_0xb0b3('0x53')]===0x0){return db[_0xb0b3('0x27')][_0xb0b3('0x4d')]({'name':_0x787cf3[_0xb0b3('0x2b')],'resourceId':_0x787cf3['id'],'type':_0xb0b3('0x26'),'sectionId':_0x5ec8db['id']},{})[_0xb0b3('0x24')](function(){return _0x599eae;});}else{return _0x599eae;}})[_0xb0b3('0x4c')](function(_0x1e96d0){logger[_0xb0b3('0x29')](_0xb0b3('0x54'),_0x1e96d0);throw _0x1e96d0;});}return _0x599eae;})['then'](respondWithResult(_0x32c859,0xc9))[_0xb0b3('0x4c')](handleError(_0x32c859,null));};exports[_0xb0b3('0x23')]=function(_0x4ca7c7,_0x5914d3){if(_0x4ca7c7['body']['id']){delete _0x4ca7c7[_0xb0b3('0x55')]['id'];}return db[_0xb0b3('0x2f')][_0xb0b3('0x4b')]({'where':{'id':_0x4ca7c7[_0xb0b3('0x46')]['id']}})[_0xb0b3('0x24')](handleEntityNotFound(_0x5914d3,null))[_0xb0b3('0x24')](saveUpdates(_0x4ca7c7['body'],null))[_0xb0b3('0x24')](respondWithResult(_0x5914d3,null))[_0xb0b3('0x4c')](handleError(_0x5914d3,null));};exports[_0xb0b3('0x25')]=function(_0x4e61ba,_0xcd1787){return db['AnalyticDefaultReport'][_0xb0b3('0x4b')]({'where':{'id':_0x4e61ba['params']['id']}})[_0xb0b3('0x24')](handleEntityNotFound(_0xcd1787,null))[_0xb0b3('0x24')](removeEntity(_0xcd1787,null))[_0xb0b3('0x4c')](handleError(_0xcd1787,null));};exports['preview']=function(_0x5f356e,_0x180a3f){var _0x5b4f4b=0xa;var _0x112273=['join','left_join',_0xb0b3('0x56'),_0xb0b3('0x57')];var _0x3e294e={'SUM':'SUM(%s)','COUNT':_0xb0b3('0x58'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xb0b3('0x59'),'MIN':_0xb0b3('0x5a'),'AVG':_0xb0b3('0x5b'),'GROUP_CONCAT':_0xb0b3('0x5c'),'GROUP_CONCAT ASC':_0xb0b3('0x5d'),'GROUP_CONCAT DESC':_0xb0b3('0x5e')};var _0xdbedb8={'SEC_TO_TIME':_0xb0b3('0x5f'),'DATE':_0xb0b3('0x60'),'HOUR':_0xb0b3('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xb0b3('0x62')};var _0x225d39=function(_0x52e602){return!_['includes']([_0xb0b3('0x63'),_0xb0b3('0x64'),_0xb0b3('0x65'),_0xb0b3('0x66')],_0x52e602);};var _0x537b24=function(_0x5b77b1){if(!_0x5b77b1||!_0x5b77b1[_0xb0b3('0x67')][_0xb0b3('0x48')]){return'';}for(var _0x49f9e3='(',_0x39c309=0x0;_0x39c309<_0x5b77b1[_0xb0b3('0x67')]['length'];_0x39c309+=0x1){_0x39c309>0x0&&(_0x49f9e3+='\x20'+_0x5b77b1['operator']+'\x20');_0x49f9e3+=_0x5b77b1[_0xb0b3('0x67')][_0x39c309]['group']?_0x537b24(_0x5b77b1[_0xb0b3('0x67')][_0x39c309]['group']):_0x5b77b1[_0xb0b3('0x67')][_0x39c309][_0xb0b3('0x68')]+'\x20'+_0x5b77b1[_0xb0b3('0x67')][_0x39c309][_0xb0b3('0x69')]+(_0x225d39(_0x5b77b1[_0xb0b3('0x67')][_0x39c309]['condition'])?'\x20'+_0x5b77b1['rules'][_0x39c309][_0xb0b3('0x6a')]:'');}return _0x49f9e3+')';};var _0x22d404={'where':{'id':_0x5f356e[_0xb0b3('0x46')]['id']}},_0x4ed4b0,_0x25dc43,_0x18d2db,_0x284889,_0x2f5d3e;_0x22d404=_[_0xb0b3('0x41')]({},_0x22d404,_0x5f356e[_0xb0b3('0x4a')]);return db['AnalyticDefaultReport'][_0xb0b3('0x4b')](_0x22d404)[_0xb0b3('0x24')](function(_0x312495){if(_0x312495){_0x4ed4b0=_0x312495;return _0x312495[_0xb0b3('0x6b')]();}return null;})[_0xb0b3('0x24')](function(_0x2d06ad){if(_0x2d06ad){if(!_0x2d06ad['length']){throw new db[(_0xb0b3('0x6c'))][(_0xb0b3('0x6d'))](_0xb0b3('0x6e'),0x193);}_0x25dc43=_0x2d06ad;return db['AnalyticMetric'][_0xb0b3('0x43')]({'raw':!![]});}return null;})[_0xb0b3('0x24')](function(_0x4fda97){if(_0x4fda97){_0x18d2db=_[_0xb0b3('0x6f')](_0x4fda97,'id');var _0x18c58c;var _0x2da0db=squel[_0xb0b3('0x70')]();_0x2da0db[_0xb0b3('0x71')](_0x4ed4b0[_0xb0b3('0x72')]);for(var _0xcb0a4a=0x0;_0xcb0a4a<_0x25dc43[_0xb0b3('0x48')];_0xcb0a4a+=0x1){_0x18c58c=_0x25dc43[_0xcb0a4a][_0xb0b3('0x73')]?_0x18d2db[_0x25dc43[_0xcb0a4a][_0xb0b3('0x73')]][_0xb0b3('0x74')]:_0x25dc43[_0xcb0a4a][_0xb0b3('0x68')];_0x18c58c=_0x25dc43[_0xcb0a4a][_0xb0b3('0x75')]?_[_0xb0b3('0x76')](_0x3e294e[_0x25dc43[_0xcb0a4a][_0xb0b3('0x75')]],'%s',_0x18c58c):_0x18c58c;_0x18c58c=_0x25dc43[_0xcb0a4a][_0xb0b3('0x77')]?_['replace'](_0xdbedb8[_0x25dc43[_0xcb0a4a]['format']],'%s',_0x18c58c):_0x18c58c;if(_0x25dc43[_0xcb0a4a][_0xb0b3('0x78')]){_0x2da0db['group'](_0x18c58c);}_0x25dc43[_0xcb0a4a][_0xb0b3('0x79')]&&_0x2da0db['order'](_0x18c58c,_0x25dc43[_0xcb0a4a][_0xb0b3('0x79')]===_0xb0b3('0x7a')?![]:!![]);_0x2da0db[_0xb0b3('0x68')](_0x18c58c,_0x25dc43[_0xcb0a4a][_0xb0b3('0x7b')]||_0x18c58c);}if(_0x4ed4b0[_0xb0b3('0x7c')]){_0x4ed4b0[_0xb0b3('0x7c')]=JSON[_0xb0b3('0x7d')](_0x4ed4b0[_0xb0b3('0x7c')]);for(var _0x118bd2=0x0;_0x118bd2<_0x4ed4b0['joins'][_0xb0b3('0x48')];_0x118bd2+=0x1){if(_0x4ed4b0['joins'][_0x118bd2]['type']&&_[_0xb0b3('0x7e')](_0x112273,_0x4ed4b0['joins'][_0x118bd2]['type'])&&_0x4ed4b0['joins'][_0x118bd2][_0xb0b3('0x7f')]&&_0x4ed4b0[_0xb0b3('0x7c')][_0x118bd2][_0xb0b3('0x80')]&&_0x4ed4b0['joins'][_0x118bd2][_0xb0b3('0x81')]){_0x2da0db[_0x4ed4b0[_0xb0b3('0x7c')][_0x118bd2][_0xb0b3('0x31')]](_0x4ed4b0[_0xb0b3('0x7c')][_0x118bd2][_0xb0b3('0x80')],null,util[_0xb0b3('0x77')](_0xb0b3('0x82'),_0x4ed4b0[_0xb0b3('0x72')],_0x4ed4b0[_0xb0b3('0x7c')][_0x118bd2]['parentKey'],_0x4ed4b0[_0xb0b3('0x7c')][_0x118bd2][_0xb0b3('0x80')],_0x4ed4b0[_0xb0b3('0x7c')][_0x118bd2][_0xb0b3('0x81')]));}}}if(_0x4ed4b0[_0xb0b3('0x83')]){_0x4ed4b0[_0xb0b3('0x83')]=JSON[_0xb0b3('0x7d')](_0x4ed4b0[_0xb0b3('0x83')]);_0x2da0db[_0xb0b3('0x3f')](_0x537b24(_0x4ed4b0['conditions'][_0xb0b3('0x84')]));}_0x2f5d3e=_0x2da0db[_0xb0b3('0x85')]();_0x2da0db[_0xb0b3('0x1e')](_0x5b4f4b);_0x2da0db['offset'](0x0);logger[_0xb0b3('0x86')](_0xb0b3('0x87'),_0x2da0db[_0xb0b3('0x88')]());return db['sequelize'][_0xb0b3('0x34')](_0x2da0db[_0xb0b3('0x88')](),{'type':db[_0xb0b3('0x89')]['QueryTypes'][_0xb0b3('0x8a')]});}})[_0xb0b3('0x24')](respondWithResult(_0x180a3f,null))[_0xb0b3('0x4c')](handleError(_0x180a3f,null));};function runReport(_0x3e6352,_0x697f82,_0x51719b){var _0x4a8f09=_0x697f82[_0xb0b3('0x2b')];var _0x35619f=0xa;var _0x386221=[_0xb0b3('0x8b'),_0xb0b3('0x8c'),_0xb0b3('0x56'),_0xb0b3('0x57')];var _0x3e313a={'SUM':_0xb0b3('0x8d'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xb0b3('0x59'),'MIN':_0xb0b3('0x5a'),'AVG':_0xb0b3('0x5b'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xb0b3('0x5d'),'GROUP_CONCAT DESC':_0xb0b3('0x5e')};var _0x558782={'SEC_TO_TIME':_0xb0b3('0x5f'),'DATE':_0xb0b3('0x60'),'HOUR':_0xb0b3('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5e34ab=function(_0x3eab04){return!_['includes']([_0xb0b3('0x63'),_0xb0b3('0x64'),_0xb0b3('0x65'),'IS\x20NOT\x20EMPTY'],_0x3eab04);};var _0x15eee7=function(_0x2a864a){if(!_0x2a864a||!_0x2a864a[_0xb0b3('0x67')][_0xb0b3('0x48')]){return'';}for(var _0x4cf013='(',_0xf8aa6c=0x0;_0xf8aa6c<_0x2a864a[_0xb0b3('0x67')][_0xb0b3('0x48')];_0xf8aa6c+=0x1){_0xf8aa6c>0x0&&(_0x4cf013+='\x20'+_0x2a864a[_0xb0b3('0x8e')]+'\x20');_0x4cf013+=_0x2a864a[_0xb0b3('0x67')][_0xf8aa6c][_0xb0b3('0x84')]?_0x15eee7(_0x2a864a[_0xb0b3('0x67')][_0xf8aa6c][_0xb0b3('0x84')]):_0x2a864a['rules'][_0xf8aa6c][_0xb0b3('0x68')]+'\x20'+_0x2a864a['rules'][_0xf8aa6c][_0xb0b3('0x69')]+(_0x5e34ab(_0x2a864a[_0xb0b3('0x67')][_0xf8aa6c][_0xb0b3('0x69')])?'\x20'+_0x2a864a[_0xb0b3('0x67')][_0xf8aa6c]['value']:'');}return _0x4cf013+')';};var _0x37f7d3={'where':{'id':_0x3e6352['id']}},_0x350621,_0x7cbe68,_0x349355,_0x390b30,_0x4fb3e0;_0x37f7d3=_[_0xb0b3('0x41')]({},_0x37f7d3,_0x51719b);return db[_0xb0b3('0x2f')][_0xb0b3('0x4b')](_0x37f7d3)[_0xb0b3('0x24')](function(_0x4dffed){if(_0x4dffed){_0x350621=_0x4dffed;return _0x4dffed[_0xb0b3('0x6b')]();}return null;})['then'](function(_0x13fca9){if(_0x13fca9){if(!_0x13fca9[_0xb0b3('0x48')]){throw new db[(_0xb0b3('0x6c'))][(_0xb0b3('0x6d'))](_0xb0b3('0x6e'),0x193);}_0x7cbe68=_0x13fca9;return db[_0xb0b3('0x8f')][_0xb0b3('0x43')]({'raw':!![]});}return null;})[_0xb0b3('0x24')](function(_0x5947b1){if(_0x5947b1){_0x349355=_['keyBy'](_0x5947b1,'id');var _0x301ec6;var _0x591db5=squel[_0xb0b3('0x70')]();_0x591db5['from'](_0x350621[_0xb0b3('0x72')]);for(var _0x5a186a=0x0;_0x5a186a<_0x7cbe68[_0xb0b3('0x48')];_0x5a186a+=0x1){_0x301ec6=_0x7cbe68[_0x5a186a][_0xb0b3('0x73')]?_0x349355[_0x7cbe68[_0x5a186a][_0xb0b3('0x73')]][_0xb0b3('0x74')]:_0x7cbe68[_0x5a186a][_0xb0b3('0x68')];_0x301ec6=_0x7cbe68[_0x5a186a]['function']?_['replace'](_0x3e313a[_0x7cbe68[_0x5a186a][_0xb0b3('0x75')]],'%s',_0x301ec6):_0x301ec6;_0x301ec6=_0x7cbe68[_0x5a186a]['format']?_[_0xb0b3('0x76')](_0x558782[_0x7cbe68[_0x5a186a][_0xb0b3('0x77')]],'%s',_0x301ec6):_0x301ec6;if(_0x7cbe68[_0x5a186a]['groupBy']){_0x591db5[_0xb0b3('0x84')](_0x301ec6);}_0x7cbe68[_0x5a186a][_0xb0b3('0x79')]&&_0x591db5[_0xb0b3('0x90')](_0x301ec6,_0x7cbe68[_0x5a186a][_0xb0b3('0x79')]===_0xb0b3('0x7a')?![]:!![]);_0x591db5[_0xb0b3('0x68')](_0x301ec6,_0x7cbe68[_0x5a186a][_0xb0b3('0x7b')]||_0x301ec6);}if(_0x350621[_0xb0b3('0x7c')]){_0x350621['joins']=JSON[_0xb0b3('0x7d')](_0x350621[_0xb0b3('0x7c')]);for(var _0x3de7d9=0x0;_0x3de7d9<_0x350621[_0xb0b3('0x7c')][_0xb0b3('0x48')];_0x3de7d9+=0x1){if(_0x350621[_0xb0b3('0x7c')][_0x3de7d9][_0xb0b3('0x31')]&&_[_0xb0b3('0x7e')](_0x386221,_0x350621['joins'][_0x3de7d9][_0xb0b3('0x31')])&&_0x350621[_0xb0b3('0x7c')][_0x3de7d9][_0xb0b3('0x7f')]&&_0x350621[_0xb0b3('0x7c')][_0x3de7d9]['foreignTable']&&_0x350621[_0xb0b3('0x7c')][_0x3de7d9][_0xb0b3('0x81')]){_0x591db5[_0x350621[_0xb0b3('0x7c')][_0x3de7d9]['type']](_0x350621[_0xb0b3('0x7c')][_0x3de7d9][_0xb0b3('0x80')],null,util['format'](_0xb0b3('0x82'),_0x350621[_0xb0b3('0x72')],_0x350621[_0xb0b3('0x7c')][_0x3de7d9][_0xb0b3('0x7f')],_0x350621[_0xb0b3('0x7c')][_0x3de7d9]['foreignTable'],_0x350621[_0xb0b3('0x7c')][_0x3de7d9]['foreignKey']));}}}if(_0x350621['conditions']){_0x350621[_0xb0b3('0x83')]=JSON['parse'](_0x350621[_0xb0b3('0x83')]);_0x591db5[_0xb0b3('0x3f')](_0x15eee7(_0x350621['conditions'][_0xb0b3('0x84')]));}_0x4fb3e0=_0x591db5['clone']();_0x591db5['limit'](_0x35619f);_0x591db5[_0xb0b3('0x1d')](0x0);logger[_0xb0b3('0x86')]('Limited\x20Query:',_0x591db5[_0xb0b3('0x88')]());return db[_0xb0b3('0x89')][_0xb0b3('0x34')](_0x591db5[_0xb0b3('0x88')](),{'type':db[_0xb0b3('0x89')][_0xb0b3('0x91')]['SELECT']});}})[_0xb0b3('0x24')](function(_0x3c80b1){if(!_0x3c80b1['length']){throw new db['Sequelize'][(_0xb0b3('0x6d'))](_0xb0b3('0x92'),0xcc);}if(_0x697f82[_0xb0b3('0x93')]===_0xb0b3('0x94')){return null;}var _0x70674f=_[_0xb0b3('0x41')](_0x697f82,{'name':_0x697f82[_0xb0b3('0x95')]||_0x697f82['name']||_0x350621[_0xb0b3('0x2b')],'basename':_0x4a8f09,'savename':util[_0xb0b3('0x77')]('%s-%s.%s',_0x697f82[_0xb0b3('0x2b')]||_0x350621[_0xb0b3('0x2b')],require(_0xb0b3('0x96'))['generate'](0x4),_0x697f82['output']||_0xb0b3('0x97')),'reportId':_0x350621['id'],'reportType':_0xb0b3('0x98')});return db[_0xb0b3('0x99')][_0xb0b3('0x4d')](_0x70674f,{'raw':!![]});})[_0xb0b3('0x24')](function(_0x3d76fd){if(_0x350621['table']===_0xb0b3('0x9a')){_0x4fb3e0[_0xb0b3('0x3f')](_0x350621[_0xb0b3('0x72')]+_0xb0b3('0x9b'),_0x697f82['startDate'],_0x697f82['endDate']);}else{_0x4fb3e0[_0xb0b3('0x3f')](_0x350621[_0xb0b3('0x72')]+_0xb0b3('0x9c'),_0x697f82[_0xb0b3('0x9d')],_0x697f82[_0xb0b3('0x9e')]);}if(_0x3d76fd){logger[_0xb0b3('0x9f')]('Run\x20Query:',_0x4fb3e0[_0xb0b3('0x88')]());require('child_process')[_0xb0b3('0xa0')](path[_0xb0b3('0x8b')](__dirname,'../../components/export/',_0x3d76fd[_0xb0b3('0x93')]),[_0x3d76fd['id'],_0x4fb3e0[_0xb0b3('0x88')](),path[_0xb0b3('0x8b')](__dirname,_0xb0b3('0xa1'),_0x3d76fd[_0xb0b3('0xa2')]),_0x4a8f09]);return _0x3d76fd;}else{var _0x12f0df=squel[_0xb0b3('0x70')]();_0x12f0df[_0xb0b3('0x71')]('('+_0x4fb3e0[_0xb0b3('0x88')]()+')',_0xb0b3('0xa3'));_0x12f0df[_0xb0b3('0x68')](_0xb0b3('0xa4'),'count');_0x4fb3e0[_0xb0b3('0x1e')](_0x697f82[_0xb0b3('0x1e')]||_0x35619f);_0x4fb3e0[_0xb0b3('0x1d')](_0x697f82[_0xb0b3('0x1d')]||0x0);return db[_0xb0b3('0x89')][_0xb0b3('0x34')](_0x12f0df[_0xb0b3('0x88')](),{'type':db['sequelize'][_0xb0b3('0x91')][_0xb0b3('0x8a')]})[_0xb0b3('0x24')](function(_0xf87322){if(!_0xf87322[_0xb0b3('0x48')]){_0x390b30=0x0;}else{_0x390b30=_0xf87322[0x0][_0xb0b3('0x1c')]||0x0;}return db['sequelize'][_0xb0b3('0x34')](_0x4fb3e0['toString'](),{'type':db['sequelize'][_0xb0b3('0x91')][_0xb0b3('0x8a')]});})[_0xb0b3('0x24')](function(_0x57db83){return{'rows':_0x57db83||[],'count':_0x390b30};});}});}exports[_0xb0b3('0xa5')]=function(_0xaef851,_0x3fc7a5){return runReport(_0xaef851[_0xb0b3('0x46')],_0xaef851[_0xb0b3('0x34')],_0xaef851['options'])[_0xb0b3('0x24')](respondWithResult(_0x3fc7a5,null))[_0xb0b3('0x4c')](handleError(_0x3fc7a5,null));};exports[_0xb0b3('0xa6')]=runReport;exports['query']=function(_0x560a3a,_0x25d8b3){var _0x42b143=0xa;var _0x396eaa=['join',_0xb0b3('0x8c'),_0xb0b3('0x56'),_0xb0b3('0x57')];var _0x2ce535={'SUM':_0xb0b3('0x8d'),'COUNT':_0xb0b3('0x58'),'COUNT DISTINCT':_0xb0b3('0xa7'),'MAX':_0xb0b3('0x59'),'MIN':_0xb0b3('0x5a'),'AVG':_0xb0b3('0x5b'),'GROUP_CONCAT':_0xb0b3('0x5c'),'GROUP_CONCAT ASC':_0xb0b3('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5c4d4b={'SEC_TO_TIME':_0xb0b3('0x5f'),'DATE':_0xb0b3('0x60'),'HOUR':_0xb0b3('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xb0b3('0x62')};var _0x3dfd3c=function(_0x2d03eb){return!_[_0xb0b3('0x7e')]([_0xb0b3('0x63'),_0xb0b3('0x64'),_0xb0b3('0x65'),_0xb0b3('0x66')],_0x2d03eb);};var _0x366470=function(_0x3694ba){if(!_0x3694ba||!_0x3694ba['rules'][_0xb0b3('0x48')]){return'';}for(var _0x59c406='(',_0x1ad80f=0x0;_0x1ad80f<_0x3694ba['rules']['length'];_0x1ad80f+=0x1){_0x1ad80f>0x0&&(_0x59c406+='\x20'+_0x3694ba['operator']+'\x20');_0x59c406+=_0x3694ba[_0xb0b3('0x67')][_0x1ad80f][_0xb0b3('0x84')]?_0x366470(_0x3694ba['rules'][_0x1ad80f][_0xb0b3('0x84')]):_0x3694ba[_0xb0b3('0x67')][_0x1ad80f][_0xb0b3('0x68')]+'\x20'+_0x3694ba['rules'][_0x1ad80f][_0xb0b3('0x69')]+(_0x3dfd3c(_0x3694ba[_0xb0b3('0x67')][_0x1ad80f]['condition'])?'\x20'+_0x3694ba[_0xb0b3('0x67')][_0x1ad80f][_0xb0b3('0x6a')]:'');}return _0x59c406+')';};var _0x4b765a={'where':{'id':_0x560a3a[_0xb0b3('0x46')]['id']}},_0x440306,_0x1ae5c6,_0x409172,_0x442000,_0x41947d;_0x4b765a=_[_0xb0b3('0x41')]({},_0x4b765a,_0x560a3a[_0xb0b3('0x4a')]);return db[_0xb0b3('0x2f')][_0xb0b3('0x4b')](_0x4b765a)['then'](function(_0x155bca){if(_0x155bca){_0x440306=_0x155bca;return _0x155bca[_0xb0b3('0x6b')]();}return null;})['then'](function(_0x55b35d){if(_0x55b35d){if(!_0x55b35d['length']){throw new db[(_0xb0b3('0x6c'))][(_0xb0b3('0x6d'))](_0xb0b3('0x6e'),0x193);}_0x1ae5c6=_0x55b35d;return db[_0xb0b3('0x8f')][_0xb0b3('0x43')]({'raw':!![]});}return null;})[_0xb0b3('0x24')](function(_0x2315f3){if(_0x2315f3){_0x409172=_[_0xb0b3('0x6f')](_0x2315f3,'id');var _0x90925c;var _0x45602d=squel[_0xb0b3('0x70')]();_0x45602d[_0xb0b3('0x71')](_0x440306[_0xb0b3('0x72')]);for(var _0x4ea665=0x0;_0x4ea665<_0x1ae5c6[_0xb0b3('0x48')];_0x4ea665+=0x1){_0x90925c=_0x1ae5c6[_0x4ea665][_0xb0b3('0x73')]?_0x409172[_0x1ae5c6[_0x4ea665][_0xb0b3('0x73')]][_0xb0b3('0x74')]:_0x1ae5c6[_0x4ea665]['field'];_0x90925c=_0x1ae5c6[_0x4ea665][_0xb0b3('0x75')]?_[_0xb0b3('0x76')](_0x2ce535[_0x1ae5c6[_0x4ea665][_0xb0b3('0x75')]],'%s',_0x90925c):_0x90925c;_0x90925c=_0x1ae5c6[_0x4ea665][_0xb0b3('0x77')]?_[_0xb0b3('0x76')](_0x5c4d4b[_0x1ae5c6[_0x4ea665][_0xb0b3('0x77')]],'%s',_0x90925c):_0x90925c;if(_0x1ae5c6[_0x4ea665][_0xb0b3('0x78')]){_0x45602d[_0xb0b3('0x84')](_0x90925c);}_0x1ae5c6[_0x4ea665][_0xb0b3('0x79')]&&_0x45602d['order'](_0x90925c,_0x1ae5c6[_0x4ea665][_0xb0b3('0x79')]===_0xb0b3('0x7a')?![]:!![]);_0x45602d[_0xb0b3('0x68')](_0x90925c,_0x1ae5c6[_0x4ea665]['alias']||_0x90925c);}if(_0x440306[_0xb0b3('0x7c')]){_0x440306['joins']=JSON['parse'](_0x440306['joins']);for(var _0x46f0bf=0x0;_0x46f0bf<_0x440306['joins'][_0xb0b3('0x48')];_0x46f0bf+=0x1){if(_0x440306[_0xb0b3('0x7c')][_0x46f0bf][_0xb0b3('0x31')]&&_[_0xb0b3('0x7e')](_0x396eaa,_0x440306[_0xb0b3('0x7c')][_0x46f0bf][_0xb0b3('0x31')])&&_0x440306[_0xb0b3('0x7c')][_0x46f0bf][_0xb0b3('0x7f')]&&_0x440306['joins'][_0x46f0bf][_0xb0b3('0x80')]&&_0x440306[_0xb0b3('0x7c')][_0x46f0bf]['foreignKey']){_0x45602d[_0x440306[_0xb0b3('0x7c')][_0x46f0bf]['type']](_0x440306[_0xb0b3('0x7c')][_0x46f0bf][_0xb0b3('0x80')],null,util['format'](_0xb0b3('0x82'),_0x440306[_0xb0b3('0x72')],_0x440306['joins'][_0x46f0bf][_0xb0b3('0x7f')],_0x440306[_0xb0b3('0x7c')][_0x46f0bf][_0xb0b3('0x80')],_0x440306[_0xb0b3('0x7c')][_0x46f0bf][_0xb0b3('0x81')]));}}}if(_0x440306[_0xb0b3('0x83')]){_0x440306[_0xb0b3('0x83')]=JSON['parse'](_0x440306[_0xb0b3('0x83')]);_0x45602d[_0xb0b3('0x3f')](_0x366470(_0x440306[_0xb0b3('0x83')][_0xb0b3('0x84')]));}_0x41947d=_0x45602d[_0xb0b3('0x85')]();_0x45602d['limit'](_0x42b143);_0x45602d[_0xb0b3('0x1d')](0x0);logger['debug'](_0xb0b3('0x87'),_0x45602d[_0xb0b3('0x88')]());return db['sequelize'][_0xb0b3('0x34')](_0x45602d[_0xb0b3('0x88')](),{'type':db[_0xb0b3('0x89')][_0xb0b3('0x91')][_0xb0b3('0x8a')]});}})[_0xb0b3('0x24')](function(){return{'sql':_0x41947d['toString']()};})[_0xb0b3('0x24')](respondWithResult(_0x25d8b3,null))[_0xb0b3('0x4c')](handleError(_0x25d8b3,null));}; \ No newline at end of file +var _0x141b=['ROUND(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','table','MetricId','metric','replace','function','format','groupBy','orderBy','order','DESC','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','COUNT(DISTINCT\x20%s)','MAX(%s)','SEC_TO_TIME(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','AnalyticMetric','No\x20available\x20data','output','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','cross_join','html-pdf','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/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','apply','reject','update','then','destroy','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','VIRTUAL','filter','options','AnalyticDefaultReport','count','includeAll','include','findAll','catch','params','find','create','body','user','get','Reports','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','SUM(%s)','COUNT(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)'];(function(_0x43bfcb,_0x54034c){var _0x34ab56=function(_0x495fe8){while(--_0x495fe8){_0x43bfcb['push'](_0x43bfcb['shift']());}};_0x34ab56(++_0x54034c);}(_0x141b,0xee));var _0xb141=function(_0x3a499b,_0x142412){_0x3a499b=_0x3a499b-0x0;var _0x3367fc=_0x141b[_0x3a499b];return _0x3367fc;};'use strict';var pdf=require(_0xb141('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb141('0x1'));var moment=require(_0xb141('0x2'));var BPromise=require(_0xb141('0x3'));var Mustache=require(_0xb141('0x4'));var util=require(_0xb141('0x5'));var path=require(_0xb141('0x6'));var sox=require(_0xb141('0x7'));var csv=require(_0xb141('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb141('0x9'));var squel=require(_0xb141('0xa'));var crypto=require(_0xb141('0xb'));var jsforce=require(_0xb141('0xc'));var deskjs=require(_0xb141('0xd'));var toCsv=require(_0xb141('0x8'));var querystring=require(_0xb141('0xe'));var Papa=require(_0xb141('0xf'));var Redis=require(_0xb141('0x10'));var authService=require(_0xb141('0x11'));var qs=require(_0xb141('0x12'));var as=require(_0xb141('0x13'));var hardwareService=require(_0xb141('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xb141('0x15'));var config=require(_0xb141('0x16'));var db=require(_0xb141('0x17'))['db'];function respondWithStatusCode(_0x478440,_0x356401){_0x356401=_0x356401||0xcc;return function(_0x412751){if(_0x412751){return _0x478440[_0xb141('0x18')](_0x356401);}return _0x478440['status'](_0x356401)[_0xb141('0x19')]();};}function respondWithResult(_0x378215,_0x4ede7b){_0x4ede7b=_0x4ede7b||0xc8;return function(_0x571239){if(_0x571239){return _0x378215[_0xb141('0x1a')](_0x4ede7b)[_0xb141('0x1b')](_0x571239);}};}function respondWithFilteredResult(_0x7601a6,_0x27dba9){return function(_0x1ccbb4){if(_0x1ccbb4){var _0x14b0cb=_0x1ccbb4['count'],_0x26acd3=_0x27dba9['offset'],_0xe80f4e=_0x27dba9[_0xb141('0x1c')]+_0x27dba9['limit'],_0x3d588d;if(_0xe80f4e>=_0x14b0cb){_0xe80f4e=_0x14b0cb;_0x3d588d=0xc8;}else{_0x3d588d=0xce;}_0x7601a6[_0xb141('0x1a')](_0x3d588d);return _0x7601a6['set']('Content-Range',_0x26acd3+'-'+_0xe80f4e+'/'+_0x14b0cb)['json'](_0x1ccbb4);}return null;};}function patchUpdates(_0x1350f8){return function(_0x2c5993){try{jsonpatch[_0xb141('0x1d')](_0x2c5993,_0x1350f8,!![]);}catch(_0x51820e){return BPromise[_0xb141('0x1e')](_0x51820e);}return _0x2c5993['save']();};}function saveUpdates(_0x1b3518,_0x450328){return function(_0x522e22){if(_0x522e22){return _0x522e22[_0xb141('0x1f')](_0x1b3518)[_0xb141('0x20')](function(_0x3849f0){return _0x3849f0;});}return null;};}function removeEntity(_0x37a640,_0x3f6344){return function(_0x346012){if(_0x346012){return _0x346012[_0xb141('0x21')]()['then'](function(){var _0x304a69=_0x346012['get']({'plain':!![]});var _0x5cd4fa='DefaultReports';return db[_0xb141('0x22')][_0xb141('0x21')]({'where':{'type':_0x5cd4fa,'resourceId':_0x304a69['id']}})[_0xb141('0x20')](function(){return _0x346012;});})[_0xb141('0x20')](function(){_0x37a640[_0xb141('0x1a')](0xcc)[_0xb141('0x19')]();});}};}function handleEntityNotFound(_0x1c9775,_0x498ef2){return function(_0x450006){if(!_0x450006){_0x1c9775[_0xb141('0x18')](0x194);}return _0x450006;};}function handleError(_0x15e17a,_0x570068){_0x570068=_0x570068||0x1f4;return function(_0x483f8f){logger[_0xb141('0x23')](_0x483f8f[_0xb141('0x24')]);if(_0x483f8f[_0xb141('0x25')]){delete _0x483f8f[_0xb141('0x25')];}_0x15e17a[_0xb141('0x1a')](_0x570068)[_0xb141('0x26')](_0x483f8f);};}exports['index']=function(_0x5abba7,_0x5aee43){var _0xef82e0={},_0x29eb00={},_0x40b3de={'count':0x0,'rows':[]};var _0x216684=_[_0xb141('0x27')](db['AnalyticDefaultReport'][_0xb141('0x28')],function(_0x124e41){return{'name':_0x124e41[_0xb141('0x29')],'type':_0x124e41[_0xb141('0x2a')][_0xb141('0x2b')]};});_0x29eb00[_0xb141('0x2c')]=_[_0xb141('0x27')](_0x216684,_0xb141('0x25'));_0x29eb00['query']=_[_0xb141('0x2d')](_0x5abba7[_0xb141('0x2e')]);_0x29eb00[_0xb141('0x2f')]=_['intersection'](_0x29eb00['model'],_0x29eb00[_0xb141('0x2e')]);_0xef82e0['attributes']=_[_0xb141('0x30')](_0x29eb00[_0xb141('0x2c')],qs[_0xb141('0x31')](_0x5abba7['query']['fields']));_0xef82e0[_0xb141('0x32')]=_0xef82e0[_0xb141('0x32')][_0xb141('0x33')]?_0xef82e0[_0xb141('0x32')]:_0x29eb00[_0xb141('0x2c')];if(!_0x5abba7[_0xb141('0x2e')][_0xb141('0x34')](_0xb141('0x35'))){_0xef82e0[_0xb141('0x36')]=qs[_0xb141('0x36')](_0x5abba7[_0xb141('0x2e')][_0xb141('0x36')]);_0xef82e0['offset']=qs[_0xb141('0x1c')](_0x5abba7['query']['offset']);}_0xef82e0['order']=qs[_0xb141('0x37')](_0x5abba7[_0xb141('0x2e')][_0xb141('0x37')]);_0xef82e0[_0xb141('0x38')]=qs[_0xb141('0x2f')](_[_0xb141('0x39')](_0x5abba7[_0xb141('0x2e')],_0x29eb00['filters']));if(_0x5abba7[_0xb141('0x2e')]['filter']){_0xef82e0[_0xb141('0x38')]=_[_0xb141('0x3a')](_0xef82e0[_0xb141('0x38')],{'$or':_[_0xb141('0x27')](_0x216684,function(_0x2039b8){if(_0x2039b8['type']!==_0xb141('0x3b')){var _0x260c34={};_0x260c34[_0x2039b8['name']]={'$like':'%'+_0x5abba7[_0xb141('0x2e')][_0xb141('0x3c')]+'%'};return _0x260c34;}})});}_0xef82e0=_['merge']({},_0xef82e0,_0x5abba7[_0xb141('0x3d')]);var _0x133900={'where':_0xef82e0[_0xb141('0x38')]};return db[_0xb141('0x3e')][_0xb141('0x3f')](_0x133900)[_0xb141('0x20')](function(_0x5504c1){_0x40b3de[_0xb141('0x3f')]=_0x5504c1;if(_0x5abba7[_0xb141('0x2e')][_0xb141('0x40')]){_0xef82e0[_0xb141('0x41')]=[{'all':!![]}];}return db[_0xb141('0x3e')][_0xb141('0x42')](_0xef82e0);})[_0xb141('0x20')](function(_0x5e0410){_0x40b3de['rows']=_0x5e0410;return _0x40b3de;})[_0xb141('0x20')](respondWithFilteredResult(_0x5aee43,_0xef82e0))[_0xb141('0x43')](handleError(_0x5aee43,null));};exports['show']=function(_0x57380a,_0xcd0577){var _0x3896ab={'raw':!![],'where':{'id':_0x57380a[_0xb141('0x44')]['id']}},_0x1f0909={};_0x1f0909[_0xb141('0x2c')]=_[_0xb141('0x2d')](db[_0xb141('0x3e')]['rawAttributes']);_0x1f0909[_0xb141('0x2e')]=_[_0xb141('0x2d')](_0x57380a[_0xb141('0x2e')]);_0x1f0909['filters']=_[_0xb141('0x30')](_0x1f0909[_0xb141('0x2c')],_0x1f0909[_0xb141('0x2e')]);_0x3896ab['attributes']=_[_0xb141('0x30')](_0x1f0909[_0xb141('0x2c')],qs[_0xb141('0x31')](_0x57380a[_0xb141('0x2e')][_0xb141('0x31')]));_0x3896ab['attributes']=_0x3896ab[_0xb141('0x32')][_0xb141('0x33')]?_0x3896ab[_0xb141('0x32')]:_0x1f0909[_0xb141('0x2c')];if(_0x57380a['query'][_0xb141('0x40')]){_0x3896ab[_0xb141('0x41')]=[{'all':!![]}];}_0x3896ab=_['merge']({},_0x3896ab,_0x57380a[_0xb141('0x3d')]);return db[_0xb141('0x3e')][_0xb141('0x45')](_0x3896ab)[_0xb141('0x20')](handleEntityNotFound(_0xcd0577,null))['then'](respondWithResult(_0xcd0577,null))[_0xb141('0x43')](handleError(_0xcd0577,null));};exports[_0xb141('0x46')]=function(_0x3cbcf5,_0x7e01a5){return db['AnalyticDefaultReport'][_0xb141('0x46')](_0x3cbcf5[_0xb141('0x47')],{})[_0xb141('0x20')](function(_0xc85c8d){var _0x40ef97=_0x3cbcf5[_0xb141('0x48')]['get']({'plain':!![]});if(!_0x40ef97)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40ef97['role']==='user'){var _0x201cf3=_0xc85c8d[_0xb141('0x49')]({'plain':!![]});var _0x3e9045=_0xb141('0x4a');return db[_0xb141('0x4b')][_0xb141('0x45')]({'where':{'name':_0x3e9045,'userProfileId':_0x40ef97[_0xb141('0x4c')]},'raw':!![]})['then'](function(_0x1a55bb){if(_0x1a55bb&&_0x1a55bb['autoAssociation']===0x0){return db['UserProfileResource'][_0xb141('0x46')]({'name':_0x201cf3[_0xb141('0x25')],'resourceId':_0x201cf3['id'],'type':'DefaultReports','sectionId':_0x1a55bb['id']},{})[_0xb141('0x20')](function(){return _0xc85c8d;});}else{return _0xc85c8d;}})['catch'](function(_0x39c0b9){logger[_0xb141('0x23')](_0xb141('0x4d'),_0x39c0b9);throw _0x39c0b9;});}return _0xc85c8d;})[_0xb141('0x20')](respondWithResult(_0x7e01a5,0xc9))['catch'](handleError(_0x7e01a5,null));};exports[_0xb141('0x1f')]=function(_0x3af39a,_0x550ed3){if(_0x3af39a['body']['id']){delete _0x3af39a[_0xb141('0x47')]['id'];}return db[_0xb141('0x3e')]['find']({'where':{'id':_0x3af39a[_0xb141('0x44')]['id']}})[_0xb141('0x20')](handleEntityNotFound(_0x550ed3,null))[_0xb141('0x20')](saveUpdates(_0x3af39a[_0xb141('0x47')],null))[_0xb141('0x20')](respondWithResult(_0x550ed3,null))[_0xb141('0x43')](handleError(_0x550ed3,null));};exports[_0xb141('0x21')]=function(_0x8b8f37,_0x2a6de2){return db[_0xb141('0x3e')]['find']({'where':{'id':_0x8b8f37[_0xb141('0x44')]['id']}})['then'](handleEntityNotFound(_0x2a6de2,null))[_0xb141('0x20')](removeEntity(_0x2a6de2,null))[_0xb141('0x43')](handleError(_0x2a6de2,null));};exports[_0xb141('0x4e')]=function(_0x5078be,_0x2a8f88){var _0x49acaf=0xa;var _0x22596a=[_0xb141('0x4f'),_0xb141('0x50'),_0xb141('0x51'),'cross_join'];var _0x54c99a={'SUM':_0xb141('0x52'),'COUNT':_0xb141('0x53'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xb141('0x54'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb141('0x55'),'GROUP_CONCAT ASC':_0xb141('0x56'),'GROUP_CONCAT DESC':_0xb141('0x57')};var _0x30a940={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xb141('0x58'),'HOUR':_0xb141('0x59'),'ROUND':_0xb141('0x5a'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x42cf14=function(_0x12539c){return!_[_0xb141('0x5b')]([_0xb141('0x5c'),'IS\x20NOT\x20NULL',_0xb141('0x5d'),_0xb141('0x5e')],_0x12539c);};var _0x44527c=function(_0x1f502a){if(!_0x1f502a||!_0x1f502a[_0xb141('0x5f')][_0xb141('0x33')]){return'';}for(var _0x28de9c='(',_0xb44b2e=0x0;_0xb44b2e<_0x1f502a[_0xb141('0x5f')][_0xb141('0x33')];_0xb44b2e+=0x1){_0xb44b2e>0x0&&(_0x28de9c+='\x20'+_0x1f502a[_0xb141('0x60')]+'\x20');_0x28de9c+=_0x1f502a[_0xb141('0x5f')][_0xb44b2e][_0xb141('0x61')]?_0x44527c(_0x1f502a[_0xb141('0x5f')][_0xb44b2e][_0xb141('0x61')]):_0x1f502a[_0xb141('0x5f')][_0xb44b2e][_0xb141('0x62')]+'\x20'+_0x1f502a['rules'][_0xb44b2e][_0xb141('0x63')]+(_0x42cf14(_0x1f502a['rules'][_0xb44b2e]['condition'])?'\x20'+_0x1f502a[_0xb141('0x5f')][_0xb44b2e][_0xb141('0x64')]:'');}return _0x28de9c+')';};var _0x5bfc24={'where':{'id':_0x5078be['params']['id']}},_0x320c2b,_0x2205cd,_0x25d066,_0x11eba2,_0x145419;_0x5bfc24=_['merge']({},_0x5bfc24,_0x5078be[_0xb141('0x3d')]);return db[_0xb141('0x3e')][_0xb141('0x45')](_0x5bfc24)[_0xb141('0x20')](function(_0xc596b){if(_0xc596b){_0x320c2b=_0xc596b;return _0xc596b[_0xb141('0x65')]();}return null;})[_0xb141('0x20')](function(_0x58a5e9){if(_0x58a5e9){if(!_0x58a5e9[_0xb141('0x33')]){throw new db[(_0xb141('0x66'))][(_0xb141('0x67'))](_0xb141('0x68'),0x193);}_0x2205cd=_0x58a5e9;return db['AnalyticMetric'][_0xb141('0x42')]({'raw':!![]});}return null;})[_0xb141('0x20')](function(_0x2c143c){if(_0x2c143c){_0x25d066=_[_0xb141('0x69')](_0x2c143c,'id');var _0x453c4e;var _0xd750c6=squel[_0xb141('0x6a')]();_0xd750c6[_0xb141('0x6b')](_0x320c2b[_0xb141('0x6c')]);for(var _0x549ffb=0x0;_0x549ffb<_0x2205cd[_0xb141('0x33')];_0x549ffb+=0x1){_0x453c4e=_0x2205cd[_0x549ffb][_0xb141('0x6d')]?_0x25d066[_0x2205cd[_0x549ffb][_0xb141('0x6d')]][_0xb141('0x6e')]:_0x2205cd[_0x549ffb][_0xb141('0x62')];_0x453c4e=_0x2205cd[_0x549ffb]['function']?_[_0xb141('0x6f')](_0x54c99a[_0x2205cd[_0x549ffb][_0xb141('0x70')]],'%s',_0x453c4e):_0x453c4e;_0x453c4e=_0x2205cd[_0x549ffb]['format']?_[_0xb141('0x6f')](_0x30a940[_0x2205cd[_0x549ffb][_0xb141('0x71')]],'%s',_0x453c4e):_0x453c4e;if(_0x2205cd[_0x549ffb][_0xb141('0x72')]){_0xd750c6['group'](_0x453c4e);}_0x2205cd[_0x549ffb][_0xb141('0x73')]&&_0xd750c6[_0xb141('0x74')](_0x453c4e,_0x2205cd[_0x549ffb][_0xb141('0x73')]===_0xb141('0x75')?![]:!![]);_0xd750c6[_0xb141('0x62')](_0x453c4e,_0x2205cd[_0x549ffb][_0xb141('0x76')]||_0x453c4e);}if(_0x320c2b[_0xb141('0x77')]){_0x320c2b['joins']=JSON[_0xb141('0x78')](_0x320c2b[_0xb141('0x77')]);for(var _0x1f8e2c=0x0;_0x1f8e2c<_0x320c2b[_0xb141('0x77')][_0xb141('0x33')];_0x1f8e2c+=0x1){if(_0x320c2b[_0xb141('0x77')][_0x1f8e2c][_0xb141('0x2a')]&&_[_0xb141('0x5b')](_0x22596a,_0x320c2b[_0xb141('0x77')][_0x1f8e2c][_0xb141('0x2a')])&&_0x320c2b[_0xb141('0x77')][_0x1f8e2c][_0xb141('0x79')]&&_0x320c2b['joins'][_0x1f8e2c][_0xb141('0x7a')]&&_0x320c2b[_0xb141('0x77')][_0x1f8e2c]['foreignKey']){_0xd750c6[_0x320c2b['joins'][_0x1f8e2c][_0xb141('0x2a')]](_0x320c2b[_0xb141('0x77')][_0x1f8e2c]['foreignTable'],null,util[_0xb141('0x71')](_0xb141('0x7b'),_0x320c2b['table'],_0x320c2b[_0xb141('0x77')][_0x1f8e2c][_0xb141('0x79')],_0x320c2b['joins'][_0x1f8e2c][_0xb141('0x7a')],_0x320c2b[_0xb141('0x77')][_0x1f8e2c][_0xb141('0x7c')]));}}}if(_0x320c2b['conditions']){_0x320c2b[_0xb141('0x7d')]=JSON[_0xb141('0x78')](_0x320c2b['conditions']);_0xd750c6[_0xb141('0x38')](_0x44527c(_0x320c2b['conditions'][_0xb141('0x61')]));}_0x145419=_0xd750c6[_0xb141('0x7e')]();_0xd750c6['limit'](_0x49acaf);_0xd750c6[_0xb141('0x1c')](0x0);logger[_0xb141('0x7f')](_0xb141('0x80'),_0xd750c6[_0xb141('0x81')]());return db['sequelize'][_0xb141('0x2e')](_0xd750c6[_0xb141('0x81')](),{'type':db[_0xb141('0x82')][_0xb141('0x83')][_0xb141('0x84')]});}})[_0xb141('0x20')](respondWithResult(_0x2a8f88,null))['catch'](handleError(_0x2a8f88,null));};function runReport(_0x354fd8,_0x387364,_0x19c465){var _0x586550=_0x387364[_0xb141('0x25')];var _0x5d7448=0xa;var _0x56d1ac=[_0xb141('0x4f'),_0xb141('0x50'),'right_join','cross_join'];var _0x2009eb={'SUM':'SUM(%s)','COUNT':_0xb141('0x53'),'COUNT DISTINCT':_0xb141('0x85'),'MAX':_0xb141('0x86'),'MIN':_0xb141('0x54'),'AVG':'AVG(%s)','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 _0x417dbe={'SEC_TO_TIME':_0xb141('0x87'),'DATE':'DATE(%s)','HOUR':_0xb141('0x59'),'ROUND':_0xb141('0x5a'),'UNIX_TIMESTAMP':_0xb141('0x88')};var _0x3ffdf7=function(_0x5563d2){return!_[_0xb141('0x5b')]([_0xb141('0x5c'),_0xb141('0x89'),_0xb141('0x5d'),_0xb141('0x5e')],_0x5563d2);};var _0x2e9f8b=function(_0x26279c){if(!_0x26279c||!_0x26279c[_0xb141('0x5f')]['length']){return'';}for(var _0x4068bd='(',_0x26b5a5=0x0;_0x26b5a5<_0x26279c[_0xb141('0x5f')]['length'];_0x26b5a5+=0x1){_0x26b5a5>0x0&&(_0x4068bd+='\x20'+_0x26279c['operator']+'\x20');_0x4068bd+=_0x26279c['rules'][_0x26b5a5][_0xb141('0x61')]?_0x2e9f8b(_0x26279c[_0xb141('0x5f')][_0x26b5a5]['group']):_0x26279c[_0xb141('0x5f')][_0x26b5a5][_0xb141('0x62')]+'\x20'+_0x26279c[_0xb141('0x5f')][_0x26b5a5]['condition']+(_0x3ffdf7(_0x26279c[_0xb141('0x5f')][_0x26b5a5]['condition'])?'\x20'+_0x26279c[_0xb141('0x5f')][_0x26b5a5][_0xb141('0x64')]:'');}return _0x4068bd+')';};var _0x1597ab={'where':{'id':_0x354fd8['id']}},_0x13cb11,_0x3f69f1,_0x25864b,_0x25aad9,_0x362e9a;_0x1597ab=_[_0xb141('0x3a')]({},_0x1597ab,_0x19c465);return db[_0xb141('0x3e')]['find'](_0x1597ab)[_0xb141('0x20')](function(_0x312c25){if(_0x312c25){_0x13cb11=_0x312c25;return _0x312c25[_0xb141('0x65')]();}return null;})[_0xb141('0x20')](function(_0x82ad27){if(_0x82ad27){if(!_0x82ad27[_0xb141('0x33')]){throw new db['Sequelize']['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x3f69f1=_0x82ad27;return db[_0xb141('0x8a')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x1259c7){if(_0x1259c7){_0x25864b=_[_0xb141('0x69')](_0x1259c7,'id');var _0x53b42f;var _0x18f9c6=squel['select']();_0x18f9c6[_0xb141('0x6b')](_0x13cb11[_0xb141('0x6c')]);for(var _0x5e239c=0x0;_0x5e239c<_0x3f69f1[_0xb141('0x33')];_0x5e239c+=0x1){_0x53b42f=_0x3f69f1[_0x5e239c][_0xb141('0x6d')]?_0x25864b[_0x3f69f1[_0x5e239c][_0xb141('0x6d')]][_0xb141('0x6e')]:_0x3f69f1[_0x5e239c]['field'];_0x53b42f=_0x3f69f1[_0x5e239c][_0xb141('0x70')]?_[_0xb141('0x6f')](_0x2009eb[_0x3f69f1[_0x5e239c][_0xb141('0x70')]],'%s',_0x53b42f):_0x53b42f;_0x53b42f=_0x3f69f1[_0x5e239c][_0xb141('0x71')]?_[_0xb141('0x6f')](_0x417dbe[_0x3f69f1[_0x5e239c][_0xb141('0x71')]],'%s',_0x53b42f):_0x53b42f;if(_0x3f69f1[_0x5e239c]['groupBy']){_0x18f9c6[_0xb141('0x61')](_0x53b42f);}_0x3f69f1[_0x5e239c]['orderBy']&&_0x18f9c6[_0xb141('0x74')](_0x53b42f,_0x3f69f1[_0x5e239c]['orderBy']===_0xb141('0x75')?![]:!![]);_0x18f9c6[_0xb141('0x62')](_0x53b42f,_0x3f69f1[_0x5e239c][_0xb141('0x76')]||_0x53b42f);}if(_0x13cb11[_0xb141('0x77')]){_0x13cb11[_0xb141('0x77')]=JSON['parse'](_0x13cb11[_0xb141('0x77')]);for(var _0x361e13=0x0;_0x361e13<_0x13cb11[_0xb141('0x77')][_0xb141('0x33')];_0x361e13+=0x1){if(_0x13cb11[_0xb141('0x77')][_0x361e13][_0xb141('0x2a')]&&_[_0xb141('0x5b')](_0x56d1ac,_0x13cb11['joins'][_0x361e13]['type'])&&_0x13cb11['joins'][_0x361e13][_0xb141('0x79')]&&_0x13cb11[_0xb141('0x77')][_0x361e13][_0xb141('0x7a')]&&_0x13cb11['joins'][_0x361e13][_0xb141('0x7c')]){_0x18f9c6[_0x13cb11[_0xb141('0x77')][_0x361e13][_0xb141('0x2a')]](_0x13cb11[_0xb141('0x77')][_0x361e13]['foreignTable'],null,util[_0xb141('0x71')](_0xb141('0x7b'),_0x13cb11[_0xb141('0x6c')],_0x13cb11[_0xb141('0x77')][_0x361e13][_0xb141('0x79')],_0x13cb11[_0xb141('0x77')][_0x361e13][_0xb141('0x7a')],_0x13cb11['joins'][_0x361e13][_0xb141('0x7c')]));}}}if(_0x13cb11[_0xb141('0x7d')]){_0x13cb11[_0xb141('0x7d')]=JSON[_0xb141('0x78')](_0x13cb11[_0xb141('0x7d')]);_0x18f9c6[_0xb141('0x38')](_0x2e9f8b(_0x13cb11['conditions']['group']));}_0x362e9a=_0x18f9c6['clone']();_0x18f9c6[_0xb141('0x36')](_0x5d7448);_0x18f9c6[_0xb141('0x1c')](0x0);logger['debug'](_0xb141('0x80'),_0x18f9c6[_0xb141('0x81')]());return db[_0xb141('0x82')]['query'](_0x18f9c6[_0xb141('0x81')](),{'type':db[_0xb141('0x82')][_0xb141('0x83')][_0xb141('0x84')]});}})[_0xb141('0x20')](function(_0x5bdfe2){if(!_0x5bdfe2[_0xb141('0x33')]){throw new db[(_0xb141('0x66'))][(_0xb141('0x67'))](_0xb141('0x8b'),0xcc);}if(_0x387364[_0xb141('0x8c')]==='web'){return null;}var _0x2c5c00=_['merge'](_0x387364,{'name':_0x387364[_0xb141('0x8d')]||_0x387364[_0xb141('0x25')]||_0x13cb11[_0xb141('0x25')],'basename':_0x586550,'savename':util[_0xb141('0x71')](_0xb141('0x8e'),_0x387364[_0xb141('0x25')]||_0x13cb11['name'],require(_0xb141('0x8f'))[_0xb141('0x90')](0x4),_0x387364[_0xb141('0x8c')]||_0xb141('0x91')),'reportId':_0x13cb11['id'],'reportType':_0xb141('0x92')});return db[_0xb141('0x93')][_0xb141('0x46')](_0x2c5c00,{'raw':!![]});})['then'](function(_0x29b051){if(_0x13cb11[_0xb141('0x6c')]===_0xb141('0x94')){_0x362e9a['where'](_0x13cb11[_0xb141('0x6c')]+_0xb141('0x95'),_0x387364[_0xb141('0x96')],_0x387364['endDate']);}else{_0x362e9a['where'](_0x13cb11[_0xb141('0x6c')]+_0xb141('0x97'),_0x387364[_0xb141('0x96')],_0x387364[_0xb141('0x98')]);}if(_0x29b051){logger[_0xb141('0x99')](_0xb141('0x9a'),_0x362e9a[_0xb141('0x81')]());require('child_process')[_0xb141('0x9b')](path[_0xb141('0x4f')](__dirname,_0xb141('0x9c'),_0x29b051[_0xb141('0x8c')]),[_0x29b051['id'],_0x362e9a[_0xb141('0x81')](),path[_0xb141('0x4f')](__dirname,_0xb141('0x9d'),_0x29b051[_0xb141('0x9e')]),_0x586550]);return _0x29b051;}else{var _0x7b4ccb=squel[_0xb141('0x6a')]();_0x7b4ccb[_0xb141('0x6b')]('('+_0x362e9a[_0xb141('0x81')]()+')',_0xb141('0x9f'));_0x7b4ccb[_0xb141('0x62')](_0xb141('0xa0'),_0xb141('0x3f'));_0x362e9a['limit'](_0x387364[_0xb141('0x36')]||_0x5d7448);_0x362e9a[_0xb141('0x1c')](_0x387364[_0xb141('0x1c')]||0x0);return db[_0xb141('0x82')][_0xb141('0x2e')](_0x7b4ccb[_0xb141('0x81')](),{'type':db[_0xb141('0x82')][_0xb141('0x83')]['SELECT']})[_0xb141('0x20')](function(_0x29ce4c){if(!_0x29ce4c[_0xb141('0x33')]){_0x25aad9=0x0;}else{_0x25aad9=_0x29ce4c[0x0]['count']||0x0;}return db[_0xb141('0x82')]['query'](_0x362e9a[_0xb141('0x81')](),{'type':db[_0xb141('0x82')]['QueryTypes']['SELECT']});})[_0xb141('0x20')](function(_0x173595){return{'rows':_0x173595||[],'count':_0x25aad9};});}});}exports[_0xb141('0xa1')]=function(_0xd7cda3,_0x4bf458){return runReport(_0xd7cda3[_0xb141('0x44')],_0xd7cda3[_0xb141('0x2e')],_0xd7cda3['options'])[_0xb141('0x20')](respondWithResult(_0x4bf458,null))[_0xb141('0x43')](handleError(_0x4bf458,null));};exports[_0xb141('0xa2')]=runReport;exports[_0xb141('0x2e')]=function(_0x2682cb,_0x34ac44){var _0xcd6a45=0xa;var _0x20dea8=[_0xb141('0x4f'),_0xb141('0x50'),_0xb141('0x51'),_0xb141('0xa3')];var _0x264baa={'SUM':'SUM(%s)','COUNT':_0xb141('0x53'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xb141('0x54'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb141('0x55'),'GROUP_CONCAT ASC':_0xb141('0x56'),'GROUP_CONCAT DESC':_0xb141('0x57')};var _0x47dfe7={'SEC_TO_TIME':_0xb141('0x87'),'DATE':_0xb141('0x58'),'HOUR':_0xb141('0x59'),'ROUND':_0xb141('0x5a'),'UNIX_TIMESTAMP':_0xb141('0x88')};var _0x13dbe3=function(_0x1cf068){return!_[_0xb141('0x5b')]([_0xb141('0x5c'),_0xb141('0x89'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x1cf068);};var _0x4042d9=function(_0x34f38c){if(!_0x34f38c||!_0x34f38c[_0xb141('0x5f')][_0xb141('0x33')]){return'';}for(var _0xbc8d04='(',_0x51e711=0x0;_0x51e711<_0x34f38c['rules'][_0xb141('0x33')];_0x51e711+=0x1){_0x51e711>0x0&&(_0xbc8d04+='\x20'+_0x34f38c[_0xb141('0x60')]+'\x20');_0xbc8d04+=_0x34f38c[_0xb141('0x5f')][_0x51e711][_0xb141('0x61')]?_0x4042d9(_0x34f38c['rules'][_0x51e711][_0xb141('0x61')]):_0x34f38c[_0xb141('0x5f')][_0x51e711][_0xb141('0x62')]+'\x20'+_0x34f38c[_0xb141('0x5f')][_0x51e711][_0xb141('0x63')]+(_0x13dbe3(_0x34f38c[_0xb141('0x5f')][_0x51e711][_0xb141('0x63')])?'\x20'+_0x34f38c[_0xb141('0x5f')][_0x51e711]['value']:'');}return _0xbc8d04+')';};var _0x1f245d={'where':{'id':_0x2682cb[_0xb141('0x44')]['id']}},_0x4188fd,_0x3b7d06,_0x16b8c6,_0x219aaa,_0x11fd13;_0x1f245d=_[_0xb141('0x3a')]({},_0x1f245d,_0x2682cb[_0xb141('0x3d')]);return db[_0xb141('0x3e')][_0xb141('0x45')](_0x1f245d)[_0xb141('0x20')](function(_0xd4a258){if(_0xd4a258){_0x4188fd=_0xd4a258;return _0xd4a258[_0xb141('0x65')]();}return null;})[_0xb141('0x20')](function(_0x522af9){if(_0x522af9){if(!_0x522af9['length']){throw new db['Sequelize']['ValidationErrorItem'](_0xb141('0x68'),0x193);}_0x3b7d06=_0x522af9;return db[_0xb141('0x8a')]['findAll']({'raw':!![]});}return null;})[_0xb141('0x20')](function(_0x38e9c6){if(_0x38e9c6){_0x16b8c6=_[_0xb141('0x69')](_0x38e9c6,'id');var _0x2627e2;var _0x444d5f=squel[_0xb141('0x6a')]();_0x444d5f[_0xb141('0x6b')](_0x4188fd[_0xb141('0x6c')]);for(var _0x27917c=0x0;_0x27917c<_0x3b7d06[_0xb141('0x33')];_0x27917c+=0x1){_0x2627e2=_0x3b7d06[_0x27917c]['MetricId']?_0x16b8c6[_0x3b7d06[_0x27917c][_0xb141('0x6d')]]['metric']:_0x3b7d06[_0x27917c][_0xb141('0x62')];_0x2627e2=_0x3b7d06[_0x27917c]['function']?_[_0xb141('0x6f')](_0x264baa[_0x3b7d06[_0x27917c][_0xb141('0x70')]],'%s',_0x2627e2):_0x2627e2;_0x2627e2=_0x3b7d06[_0x27917c][_0xb141('0x71')]?_[_0xb141('0x6f')](_0x47dfe7[_0x3b7d06[_0x27917c][_0xb141('0x71')]],'%s',_0x2627e2):_0x2627e2;if(_0x3b7d06[_0x27917c]['groupBy']){_0x444d5f['group'](_0x2627e2);}_0x3b7d06[_0x27917c][_0xb141('0x73')]&&_0x444d5f['order'](_0x2627e2,_0x3b7d06[_0x27917c][_0xb141('0x73')]==='DESC'?![]:!![]);_0x444d5f[_0xb141('0x62')](_0x2627e2,_0x3b7d06[_0x27917c][_0xb141('0x76')]||_0x2627e2);}if(_0x4188fd['joins']){_0x4188fd['joins']=JSON[_0xb141('0x78')](_0x4188fd[_0xb141('0x77')]);for(var _0x3261b4=0x0;_0x3261b4<_0x4188fd['joins']['length'];_0x3261b4+=0x1){if(_0x4188fd['joins'][_0x3261b4][_0xb141('0x2a')]&&_['includes'](_0x20dea8,_0x4188fd['joins'][_0x3261b4][_0xb141('0x2a')])&&_0x4188fd[_0xb141('0x77')][_0x3261b4][_0xb141('0x79')]&&_0x4188fd[_0xb141('0x77')][_0x3261b4]['foreignTable']&&_0x4188fd[_0xb141('0x77')][_0x3261b4][_0xb141('0x7c')]){_0x444d5f[_0x4188fd[_0xb141('0x77')][_0x3261b4]['type']](_0x4188fd[_0xb141('0x77')][_0x3261b4]['foreignTable'],null,util[_0xb141('0x71')](_0xb141('0x7b'),_0x4188fd['table'],_0x4188fd[_0xb141('0x77')][_0x3261b4][_0xb141('0x79')],_0x4188fd['joins'][_0x3261b4][_0xb141('0x7a')],_0x4188fd[_0xb141('0x77')][_0x3261b4][_0xb141('0x7c')]));}}}if(_0x4188fd[_0xb141('0x7d')]){_0x4188fd[_0xb141('0x7d')]=JSON[_0xb141('0x78')](_0x4188fd['conditions']);_0x444d5f[_0xb141('0x38')](_0x4042d9(_0x4188fd[_0xb141('0x7d')]['group']));}_0x11fd13=_0x444d5f[_0xb141('0x7e')]();_0x444d5f[_0xb141('0x36')](_0xcd6a45);_0x444d5f['offset'](0x0);logger[_0xb141('0x7f')](_0xb141('0x80'),_0x444d5f['toString']());return db[_0xb141('0x82')][_0xb141('0x2e')](_0x444d5f[_0xb141('0x81')](),{'type':db[_0xb141('0x82')][_0xb141('0x83')]['SELECT']});}})['then'](function(){return{'sql':_0x11fd13[_0xb141('0x81')]()};})['then'](respondWithResult(_0x34ac44,null))['catch'](handleError(_0x34ac44,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 3c6b1b9..7c351dd 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 _0xcebd=['request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport','lodash','../../config/logger','api','moment'];(function(_0x157fef,_0x14ef86){var _0x1f4c1c=function(_0x2c0a56){while(--_0x2c0a56){_0x157fef['push'](_0x157fef['shift']());}};_0x1f4c1c(++_0x14ef86);}(_0xcebd,0x15c));var _0xdceb=function(_0x2c78d0,_0x424bcf){_0x2c78d0=_0x2c78d0-0x0;var _0xec6dfa=_0xcebd[_0x2c78d0];return _0xec6dfa;};'use strict';var _=require(_0xdceb('0x0'));var util=require('util');var logger=require(_0xdceb('0x1'))(_0xdceb('0x2'));var moment=require(_0xdceb('0x3'));var BPromise=require('bluebird');var rp=require(_0xdceb('0x4'));var fs=require('fs');var path=require(_0xdceb('0x5'));var rimraf=require(_0xdceb('0x6'));var config=require(_0xdceb('0x7'));var attributes=require(_0xdceb('0x8'));module['exports']=function(_0x5ea0cf,_0x2fdd32){return _0x5ea0cf[_0xdceb('0x9')](_0xdceb('0xa'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7b40=['rimraf','./analyticDefaultReport.attributes','define','analytics_default_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x7b40,0x7c));var _0x07b4=function(_0x5e2e72,_0x17455e){_0x5e2e72=_0x5e2e72-0x0;var _0x40d6ec=_0x7b40[_0x5e2e72];return _0x40d6ec;};'use strict';var _=require(_0x07b4('0x0'));var util=require(_0x07b4('0x1'));var logger=require(_0x07b4('0x2'))(_0x07b4('0x3'));var moment=require(_0x07b4('0x4'));var BPromise=require(_0x07b4('0x5'));var rp=require(_0x07b4('0x6'));var fs=require('fs');var path=require(_0x07b4('0x7'));var rimraf=require(_0x07b4('0x8'));var config=require('../../config/environment');var attributes=require(_0x07b4('0x9'));module['exports']=function(_0x2e7f47,_0xd45f4d){return _0x2e7f47[_0x07b4('0xa')]('AnalyticDefaultReport',attributes,{'tableName':_0x07b4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 4c364bf..32b29b8 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 _0x4a1d=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash'];(function(_0x3b7c3a,_0x31249f){var _0x395dba=function(_0x3418cb){while(--_0x3418cb){_0x3b7c3a['push'](_0x3b7c3a['shift']());}};_0x395dba(++_0x31249f);}(_0x4a1d,0x77));var _0xd4a1=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x4a1d[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0xd4a1('0x0'));var util=require(_0xd4a1('0x1'));var moment=require(_0xd4a1('0x2'));var BPromise=require(_0xd4a1('0x3'));var rs=require(_0xd4a1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd4a1('0x5'))['db'];var utils=require(_0xd4a1('0x6'));var logger=require(_0xd4a1('0x7'))(_0xd4a1('0x8'));var config=require(_0xd4a1('0x9'));var jayson=require(_0xd4a1('0xa'));var client=jayson[_0xd4a1('0xb')][_0xd4a1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5cfa45,_0x3140b8,_0x1c2e6f){return new BPromise(function(_0x2b91a6,_0x3a9ecc){return client[_0xd4a1('0xd')](_0x5cfa45,_0x1c2e6f)['then'](function(_0x503a27){logger[_0xd4a1('0xe')](_0xd4a1('0xf'),_0x3140b8,_0xd4a1('0x10'));logger[_0xd4a1('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x3140b8,_0xd4a1('0x10'),JSON[_0xd4a1('0x12')](_0x503a27));if(_0x503a27[_0xd4a1('0x13')]){if(_0x503a27['error'][_0xd4a1('0x14')]===0x1f4){logger[_0xd4a1('0x13')](_0xd4a1('0xf'),_0x3140b8,_0x503a27[_0xd4a1('0x13')]['message']);return _0x3a9ecc(_0x503a27[_0xd4a1('0x13')][_0xd4a1('0x15')]);}logger[_0xd4a1('0x13')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3140b8,_0x503a27[_0xd4a1('0x13')][_0xd4a1('0x15')]);return _0x2b91a6(_0x503a27[_0xd4a1('0x13')][_0xd4a1('0x15')]);}else{logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x3140b8,_0xd4a1('0x10'));_0x2b91a6(_0x503a27[_0xd4a1('0x16')][_0xd4a1('0x15')]);}})[_0xd4a1('0x17')](function(_0x212d0c){logger['error'](_0xd4a1('0xf'),_0x3140b8,_0x212d0c);_0x3a9ecc(_0x212d0c);});});} \ No newline at end of file +var _0x35a9=['util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','code','error','AnalyticDefaultReport,\x20%s,\x20%s','message','result','catch'];(function(_0x33f3dd,_0x50c4a7){var _0x438811=function(_0x244a6f){while(--_0x244a6f){_0x33f3dd['push'](_0x33f3dd['shift']());}};_0x438811(++_0x50c4a7);}(_0x35a9,0x73));var _0x935a=function(_0x19295f,_0x24dc91){_0x19295f=_0x19295f-0x0;var _0x4ec239=_0x35a9[_0x19295f];return _0x4ec239;};'use strict';var _=require('lodash');var util=require(_0x935a('0x0'));var moment=require(_0x935a('0x1'));var BPromise=require(_0x935a('0x2'));var rs=require(_0x935a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x935a('0x4'));var logger=require('../../config/logger')(_0x935a('0x5'));var config=require(_0x935a('0x6'));var jayson=require(_0x935a('0x7'));var client=jayson[_0x935a('0x8')][_0x935a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xca82cf,_0xa3490c,_0x16a5c2){return new BPromise(function(_0x534830,_0x78e624){return client[_0x935a('0xa')](_0xca82cf,_0x16a5c2)[_0x935a('0xb')](function(_0x1d82bb){logger[_0x935a('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s',_0xa3490c,_0x935a('0xd'));logger[_0x935a('0xe')](_0x935a('0xf'),_0xa3490c,'request\x20sent',JSON[_0x935a('0x10')](_0x1d82bb));if(_0x1d82bb['error']){if(_0x1d82bb['error'][_0x935a('0x11')]===0x1f4){logger[_0x935a('0x12')](_0x935a('0x13'),_0xa3490c,_0x1d82bb[_0x935a('0x12')][_0x935a('0x14')]);return _0x78e624(_0x1d82bb[_0x935a('0x12')][_0x935a('0x14')]);}logger[_0x935a('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0xa3490c,_0x1d82bb[_0x935a('0x12')][_0x935a('0x14')]);return _0x534830(_0x1d82bb[_0x935a('0x12')][_0x935a('0x14')]);}else{logger[_0x935a('0xc')](_0x935a('0x13'),_0xa3490c,_0x935a('0xd'));_0x534830(_0x1d82bb[_0x935a('0x15')][_0x935a('0x14')]);}})[_0x935a('0x16')](function(_0x4dbf52){logger[_0x935a('0x12')](_0x935a('0x13'),_0xa3490c,_0x4dbf52);_0x78e624(_0x4dbf52);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 5924661..dc75d9d 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 _0x869f=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller','isAuthenticated','index','get','/:id','show','/:id/preview','preview','/:id/run','/:id/query','query','post','create','put','update','delete','multer'];(function(_0x285d34,_0x42dd2d){var _0x59e21d=function(_0x386777){while(--_0x386777){_0x285d34['push'](_0x285d34['shift']());}};_0x59e21d(++_0x42dd2d);}(_0x869f,0xa7));var _0xf869=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x869f[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0xf869('0x0'));var util=require(_0xf869('0x1'));var path=require(_0xf869('0x2'));var timeout=require(_0xf869('0x3'));var express=require(_0xf869('0x4'));var router=express[_0xf869('0x5')]();var auth=require(_0xf869('0x6'));var interaction=require(_0xf869('0x7'));var config=require('../../config/environment');var controller=require(_0xf869('0x8'));router['get']('/',auth[_0xf869('0x9')](),controller[_0xf869('0xa')]);router[_0xf869('0xb')](_0xf869('0xc'),auth[_0xf869('0x9')](),controller[_0xf869('0xd')]);router[_0xf869('0xb')](_0xf869('0xe'),auth[_0xf869('0x9')](),controller[_0xf869('0xf')]);router['get'](_0xf869('0x10'),auth[_0xf869('0x9')](),controller['run']);router[_0xf869('0xb')](_0xf869('0x11'),auth[_0xf869('0x9')](),controller[_0xf869('0x12')]);router[_0xf869('0x13')]('/',auth[_0xf869('0x9')](),controller[_0xf869('0x14')]);router[_0xf869('0x15')](_0xf869('0xc'),auth[_0xf869('0x9')](),controller[_0xf869('0x16')]);router[_0xf869('0x17')]('/:id',auth[_0xf869('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5c73=['get','isAuthenticated','index','/:id','show','preview','/:id/run','run','/:id/query','put','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x807a89,_0x294104){var _0x4409e9=function(_0x29ab76){while(--_0x29ab76){_0x807a89['push'](_0x807a89['shift']());}};_0x4409e9(++_0x294104);}(_0x5c73,0x124));var _0x35c7=function(_0x15c638,_0x4c2d8e){_0x15c638=_0x15c638-0x0;var _0x519ac9=_0x5c73[_0x15c638];return _0x519ac9;};'use strict';var multer=require(_0x35c7('0x0'));var util=require(_0x35c7('0x1'));var path=require(_0x35c7('0x2'));var timeout=require(_0x35c7('0x3'));var express=require(_0x35c7('0x4'));var router=express[_0x35c7('0x5')]();var auth=require(_0x35c7('0x6'));var interaction=require(_0x35c7('0x7'));var config=require('../../config/environment');var controller=require('./analyticDefaultReport.controller');router[_0x35c7('0x8')]('/',auth[_0x35c7('0x9')](),controller[_0x35c7('0xa')]);router[_0x35c7('0x8')](_0x35c7('0xb'),auth[_0x35c7('0x9')](),controller[_0x35c7('0xc')]);router[_0x35c7('0x8')]('/:id/preview',auth[_0x35c7('0x9')](),controller[_0x35c7('0xd')]);router['get'](_0x35c7('0xe'),auth[_0x35c7('0x9')](),controller[_0x35c7('0xf')]);router[_0x35c7('0x8')](_0x35c7('0x10'),auth[_0x35c7('0x9')](),controller['query']);router['post']('/',auth[_0x35c7('0x9')](),controller['create']);router[_0x35c7('0x11')](_0x35c7('0xb'),auth[_0x35c7('0x9')](),controller['update']);router[_0x35c7('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x35c7('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 12805d5..04cc057 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 _0xced1=['moment','STRING','csv','pdf','DATE','Loading','ENUM','scheduled','manual','INTEGER','sequelize'];(function(_0x460e05,_0x37f195){var _0x48dcd9=function(_0x29712d){while(--_0x29712d){_0x460e05['push'](_0x460e05['shift']());}};_0x48dcd9(++_0x37f195);}(_0xced1,0x128));var _0x1ced=function(_0x412e27,_0x20a978){_0x412e27=_0x412e27-0x0;var _0x53da42=_0xced1[_0x412e27];return _0x53da42;};'use strict';var Sequelize=require(_0x1ced('0x0'));var moment=require(_0x1ced('0x1'));module['exports']={'name':{'type':Sequelize[_0x1ced('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x1ced('0x2')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x1ced('0x3'),_0x1ced('0x4'),'xlsx'),'allowNull':![],'defaultValue':_0x1ced('0x3')},'savename':{'type':Sequelize[_0x1ced('0x2')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x1ced('0x5')]},'status':{'type':Sequelize[_0x1ced('0x2')],'defaultValue':_0x1ced('0x6')},'type':{'type':Sequelize[_0x1ced('0x7')]('manual',_0x1ced('0x8')),'allowNull':![],'defaultValue':_0x1ced('0x9')},'reportId':{'type':Sequelize[_0x1ced('0xa')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x1ced('0x2')]}}; \ No newline at end of file +var _0xc544=['INTEGER','UNSIGNED','sequelize','moment','exports','STRING','ENUM','csv','pdf','xlsx','DATE','Loading','manual','scheduled'];(function(_0x20bfb2,_0x15f711){var _0x1141f9=function(_0x389e79){while(--_0x389e79){_0x20bfb2['push'](_0x20bfb2['shift']());}};_0x1141f9(++_0x15f711);}(_0xc544,0xe2));var _0x4c54=function(_0x363282,_0x5e438f){_0x363282=_0x363282-0x0;var _0x29c3d8=_0xc544[_0x363282];return _0x29c3d8;};'use strict';var Sequelize=require(_0x4c54('0x0'));var moment=require(_0x4c54('0x1'));module[_0x4c54('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x4c54('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x4c54('0x4')](_0x4c54('0x5'),_0x4c54('0x6'),_0x4c54('0x7')),'allowNull':![],'defaultValue':_0x4c54('0x5')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x4c54('0x8')]},'endDate':{'type':Sequelize[_0x4c54('0x8')]},'status':{'type':Sequelize[_0x4c54('0x3')],'defaultValue':_0x4c54('0x9')},'type':{'type':Sequelize[_0x4c54('0x4')](_0x4c54('0xa'),_0x4c54('0xb')),'allowNull':![],'defaultValue':_0x4c54('0xa')},'reportId':{'type':Sequelize[_0x4c54('0xc')](0xb)[_0x4c54('0xd')]},'reportType':{'type':Sequelize[_0x4c54('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index a44bece..fce6b36 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 _0x34e7=['path','sox','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','json','offset','status','set','Content-Range','reject','save','update','then','destroy','get','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','attributes','fields','length','hasOwnProperty','limit','order','sort','filter','where','VIRTUAL','merge','options','AnalyticExtractedReport','count','includeAll','include','findAll','rows','catch','show','params','model','intersection','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ExtractedReports','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','download','basename','savename','output','existsSync','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','join','format','%s.%s','toLowerCase','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x461bca,_0x524ccd){var _0x5f4579=function(_0x508ff6){while(--_0x508ff6){_0x461bca['push'](_0x461bca['shift']());}};_0x5f4579(++_0x524ccd);}(_0x34e7,0x120));var _0x734e=function(_0x15b539,_0x4ece18){_0x15b539=_0x15b539-0x0;var _0x2b6dbe=_0x34e7[_0x15b539];return _0x2b6dbe;};'use strict';var pdf=require(_0x734e('0x0'));var emlformat=require(_0x734e('0x1'));var rimraf=require(_0x734e('0x2'));var zipdir=require(_0x734e('0x3'));var jsonpatch=require(_0x734e('0x4'));var rp=require(_0x734e('0x5'));var moment=require('moment');var BPromise=require(_0x734e('0x6'));var Mustache=require(_0x734e('0x7'));var util=require(_0x734e('0x8'));var path=require(_0x734e('0x9'));var sox=require(_0x734e('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x734e('0xb'));var crypto=require(_0x734e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x734e('0xd'));var toCsv=require(_0x734e('0xe'));var querystring=require('querystring');var Papa=require(_0x734e('0xf'));var Redis=require(_0x734e('0x10'));var authService=require(_0x734e('0x11'));var qs=require(_0x734e('0x12'));var as=require(_0x734e('0x13'));var hardwareService=require(_0x734e('0x14'));var logger=require(_0x734e('0x15'))(_0x734e('0x16'));var utils=require(_0x734e('0x17'));var config=require(_0x734e('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2edd16,_0x41a0ec){_0x41a0ec=_0x41a0ec||0xcc;return function(_0x47a6ec){if(_0x47a6ec){return _0x2edd16[_0x734e('0x19')](_0x41a0ec);}return _0x2edd16['status'](_0x41a0ec)['end']();};}function respondWithResult(_0x2bc09c,_0x32de1d){_0x32de1d=_0x32de1d||0xc8;return function(_0x199396){if(_0x199396){return _0x2bc09c['status'](_0x32de1d)[_0x734e('0x1a')](_0x199396);}};}function respondWithFilteredResult(_0x30378b,_0x1c0255){return function(_0x23b83c){if(_0x23b83c){var _0x36ec06=_0x23b83c['count'],_0x41e1a4=_0x1c0255[_0x734e('0x1b')],_0x37a592=_0x1c0255['offset']+_0x1c0255['limit'],_0x395ebf;if(_0x37a592>=_0x36ec06){_0x37a592=_0x36ec06;_0x395ebf=0xc8;}else{_0x395ebf=0xce;}_0x30378b[_0x734e('0x1c')](_0x395ebf);return _0x30378b[_0x734e('0x1d')](_0x734e('0x1e'),_0x41e1a4+'-'+_0x37a592+'/'+_0x36ec06)['json'](_0x23b83c);}return null;};}function patchUpdates(_0x2fca3b){return function(_0x23f6b3){try{jsonpatch['apply'](_0x23f6b3,_0x2fca3b,!![]);}catch(_0x238d82){return BPromise[_0x734e('0x1f')](_0x238d82);}return _0x23f6b3[_0x734e('0x20')]();};}function saveUpdates(_0x2378c0,_0x2c59bd){return function(_0x1edfc0){if(_0x1edfc0){return _0x1edfc0[_0x734e('0x21')](_0x2378c0)[_0x734e('0x22')](function(_0x2c4465){return _0x2c4465;});}return null;};}function removeEntity(_0x221e5f,_0x2cd19c){return function(_0xfbb12){if(_0xfbb12){return _0xfbb12[_0x734e('0x23')]()[_0x734e('0x22')](function(){var _0x4edfb9=_0xfbb12[_0x734e('0x24')]({'plain':!![]});var _0x3a31f6='ExtractedReports';return db['UserProfileResource'][_0x734e('0x23')]({'where':{'type':_0x3a31f6,'resourceId':_0x4edfb9['id']}})[_0x734e('0x22')](function(){return _0xfbb12;});})[_0x734e('0x22')](function(){_0x221e5f[_0x734e('0x1c')](0xcc)[_0x734e('0x25')]();});}};}function handleEntityNotFound(_0x231799,_0x1aa9d7){return function(_0x59f395){if(!_0x59f395){_0x231799[_0x734e('0x19')](0x194);}return _0x59f395;};}function handleError(_0x1199c2,_0x46dd9f){_0x46dd9f=_0x46dd9f||0x1f4;return function(_0x20f1e7){logger[_0x734e('0x26')](_0x20f1e7[_0x734e('0x27')]);if(_0x20f1e7[_0x734e('0x28')]){delete _0x20f1e7['name'];}_0x1199c2['status'](_0x46dd9f)[_0x734e('0x29')](_0x20f1e7);};}exports[_0x734e('0x2a')]=function(_0x4e43d1,_0xaae8bd){var _0x54ee94={},_0x234b1b={},_0x5ab522={'count':0x0,'rows':[]};var _0x2e1b0e=_[_0x734e('0x2b')](db['AnalyticExtractedReport'][_0x734e('0x2c')],function(_0x4573d8){return{'name':_0x4573d8[_0x734e('0x2d')],'type':_0x4573d8[_0x734e('0x2e')][_0x734e('0x2f')]};});_0x234b1b['model']=_[_0x734e('0x2b')](_0x2e1b0e,_0x734e('0x28'));_0x234b1b[_0x734e('0x30')]=_[_0x734e('0x31')](_0x4e43d1[_0x734e('0x30')]);_0x234b1b[_0x734e('0x32')]=_['intersection'](_0x234b1b['model'],_0x234b1b[_0x734e('0x30')]);_0x54ee94[_0x734e('0x33')]=_['intersection'](_0x234b1b['model'],qs[_0x734e('0x34')](_0x4e43d1['query']['fields']));_0x54ee94['attributes']=_0x54ee94[_0x734e('0x33')][_0x734e('0x35')]?_0x54ee94[_0x734e('0x33')]:_0x234b1b['model'];if(!_0x4e43d1[_0x734e('0x30')][_0x734e('0x36')]('nolimit')){_0x54ee94[_0x734e('0x37')]=qs[_0x734e('0x37')](_0x4e43d1[_0x734e('0x30')][_0x734e('0x37')]);_0x54ee94['offset']=qs[_0x734e('0x1b')](_0x4e43d1[_0x734e('0x30')]['offset']);}_0x54ee94[_0x734e('0x38')]=qs['sort'](_0x4e43d1[_0x734e('0x30')][_0x734e('0x39')]);_0x54ee94['where']=qs[_0x734e('0x32')](_['pick'](_0x4e43d1[_0x734e('0x30')],_0x234b1b[_0x734e('0x32')]));if(_0x4e43d1[_0x734e('0x30')][_0x734e('0x3a')]){_0x54ee94[_0x734e('0x3b')]=_['merge'](_0x54ee94[_0x734e('0x3b')],{'$or':_['map'](_0x2e1b0e,function(_0x5d0c5b){if(_0x5d0c5b[_0x734e('0x2e')]!==_0x734e('0x3c')){var _0x4a583b={};_0x4a583b[_0x5d0c5b['name']]={'$like':'%'+_0x4e43d1[_0x734e('0x30')]['filter']+'%'};return _0x4a583b;}})});}_0x54ee94=_[_0x734e('0x3d')]({},_0x54ee94,_0x4e43d1[_0x734e('0x3e')]);var _0x459de4={'where':_0x54ee94[_0x734e('0x3b')]};return db[_0x734e('0x3f')]['count'](_0x459de4)[_0x734e('0x22')](function(_0x485ab){_0x5ab522[_0x734e('0x40')]=_0x485ab;if(_0x4e43d1[_0x734e('0x30')][_0x734e('0x41')]){_0x54ee94[_0x734e('0x42')]=[{'all':!![]}];}return db[_0x734e('0x3f')][_0x734e('0x43')](_0x54ee94);})[_0x734e('0x22')](function(_0x388d87){_0x5ab522[_0x734e('0x44')]=_0x388d87;return _0x5ab522;})['then'](respondWithFilteredResult(_0xaae8bd,_0x54ee94))[_0x734e('0x45')](handleError(_0xaae8bd,null));};exports[_0x734e('0x46')]=function(_0x17c6ae,_0x4246ee){var _0x4d090c={'raw':!![],'where':{'id':_0x17c6ae[_0x734e('0x47')]['id']}},_0x276218={};_0x276218[_0x734e('0x48')]=_[_0x734e('0x31')](db[_0x734e('0x3f')][_0x734e('0x2c')]);_0x276218[_0x734e('0x30')]=_[_0x734e('0x31')](_0x17c6ae[_0x734e('0x30')]);_0x276218[_0x734e('0x32')]=_[_0x734e('0x49')](_0x276218[_0x734e('0x48')],_0x276218['query']);_0x4d090c[_0x734e('0x33')]=_[_0x734e('0x49')](_0x276218[_0x734e('0x48')],qs[_0x734e('0x34')](_0x17c6ae[_0x734e('0x30')][_0x734e('0x34')]));_0x4d090c[_0x734e('0x33')]=_0x4d090c['attributes'][_0x734e('0x35')]?_0x4d090c[_0x734e('0x33')]:_0x276218[_0x734e('0x48')];if(_0x17c6ae[_0x734e('0x30')]['includeAll']){_0x4d090c[_0x734e('0x42')]=[{'all':!![]}];}_0x4d090c=_[_0x734e('0x3d')]({},_0x4d090c,_0x17c6ae[_0x734e('0x3e')]);return db['AnalyticExtractedReport']['find'](_0x4d090c)['then'](handleEntityNotFound(_0x4246ee,null))[_0x734e('0x22')](respondWithResult(_0x4246ee,null))[_0x734e('0x45')](handleError(_0x4246ee,null));};exports[_0x734e('0x4a')]=function(_0x5cb2de,_0x4f9ad5){return db[_0x734e('0x3f')][_0x734e('0x4a')](_0x5cb2de['body'],{})[_0x734e('0x22')](function(_0x2643d4){var _0x2a2ddb=_0x5cb2de[_0x734e('0x4b')][_0x734e('0x24')]({'plain':!![]});if(!_0x2a2ddb)throw new Error(_0x734e('0x4c'));if(_0x2a2ddb[_0x734e('0x4d')]==='user'){var _0x239632=_0x2643d4['get']({'plain':!![]});var _0x4d161e=_0x734e('0x4e');return db[_0x734e('0x4f')]['find']({'where':{'name':_0x4d161e,'userProfileId':_0x2a2ddb['userProfileId']},'raw':!![]})[_0x734e('0x22')](function(_0x137a9b){if(_0x137a9b&&_0x137a9b[_0x734e('0x50')]===0x0){return db[_0x734e('0x51')][_0x734e('0x4a')]({'name':_0x239632[_0x734e('0x28')],'resourceId':_0x239632['id'],'type':_0x137a9b['name'],'sectionId':_0x137a9b['id']},{})[_0x734e('0x22')](function(){return _0x2643d4;});}else{return _0x2643d4;}})[_0x734e('0x45')](function(_0x2b1598){logger[_0x734e('0x26')](_0x734e('0x52'),_0x2b1598);throw _0x2b1598;});}return _0x2643d4;})[_0x734e('0x22')](respondWithResult(_0x4f9ad5,0xc9))[_0x734e('0x45')](handleError(_0x4f9ad5,null));};exports['update']=function(_0x4fdb47,_0x29c932){if(_0x4fdb47[_0x734e('0x53')]['id']){delete _0x4fdb47['body']['id'];}return db['AnalyticExtractedReport']['find']({'where':{'id':_0x4fdb47[_0x734e('0x47')]['id']}})[_0x734e('0x22')](handleEntityNotFound(_0x29c932,null))[_0x734e('0x22')](saveUpdates(_0x4fdb47[_0x734e('0x53')],null))[_0x734e('0x22')](respondWithResult(_0x29c932,null))[_0x734e('0x45')](handleError(_0x29c932,null));};exports[_0x734e('0x23')]=function(_0x417faa,_0x25713b){return db[_0x734e('0x3f')][_0x734e('0x54')]({'where':{'id':_0x417faa[_0x734e('0x47')]['id']}})[_0x734e('0x22')](handleEntityNotFound(_0x25713b,null))[_0x734e('0x22')](removeEntity(_0x25713b,null))[_0x734e('0x45')](handleError(_0x25713b,null));};exports[_0x734e('0x55')]=function(_0x380735,_0x36664a,_0x4d97a3){return db['AnalyticExtractedReport'][_0x734e('0x54')]({'where':{'id':_0x380735[_0x734e('0x47')]['id']},'attributes':['name',_0x734e('0x56'),_0x734e('0x57'),_0x734e('0x58')],'raw':!![]})[_0x734e('0x22')](handleEntityNotFound(_0x36664a,null))[_0x734e('0x22')](function(_0x34d600){if(_0x34d600){if(!fs[_0x734e('0x59')](path['join'](config[_0x734e('0x5a')],_0x734e('0x5b'),_0x34d600[_0x734e('0x57')]))){throw new db[(_0x734e('0x5c'))][(_0x734e('0x5d'))](_0x734e('0x5e'));}if(_0x380735[_0x734e('0x30')]['exists']){return _0x36664a[_0x734e('0x19')](0xc8);}return _0x36664a[_0x734e('0x55')](path[_0x734e('0x5f')](config[_0x734e('0x5a')],_0x734e('0x5b'),_0x34d600[_0x734e('0x57')]),util[_0x734e('0x60')](_0x734e('0x61'),_0x34d600[_0x734e('0x56')]||_0x34d600[_0x734e('0x28')],_0x34d600[_0x734e('0x58')][_0x734e('0x62')]()));}})[_0x734e('0x45')](handleError(_0x36664a,null));}; \ No newline at end of file +var _0x60f1=['merge','VIRTUAL','options','include','findAll','show','params','includeAll','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','basename','savename','output','existsSync','root','server/files/reports','Sequelize','ValidationError','download','join','format','toLowerCase','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','Content-Range','apply','reject','update','destroy','then','get','ExtractedReports','end','error','stack','name','send','map','AnalyticExtractedReport','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter'];(function(_0x4b1473,_0x570c61){var _0x4eb602=function(_0x4ee4ab){while(--_0x4ee4ab){_0x4b1473['push'](_0x4b1473['shift']());}};_0x4eb602(++_0x570c61);}(_0x60f1,0x78));var _0x160f=function(_0x2a98e3,_0x488997){_0x2a98e3=_0x2a98e3-0x0;var _0x370a71=_0x60f1[_0x2a98e3];return _0x370a71;};'use strict';var pdf=require(_0x160f('0x0'));var emlformat=require(_0x160f('0x1'));var rimraf=require(_0x160f('0x2'));var zipdir=require(_0x160f('0x3'));var jsonpatch=require(_0x160f('0x4'));var rp=require(_0x160f('0x5'));var moment=require(_0x160f('0x6'));var BPromise=require(_0x160f('0x7'));var Mustache=require(_0x160f('0x8'));var util=require('util');var path=require(_0x160f('0x9'));var sox=require(_0x160f('0xa'));var csv=require(_0x160f('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x160f('0xc'));var crypto=require(_0x160f('0xd'));var jsforce=require(_0x160f('0xe'));var deskjs=require(_0x160f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x160f('0x10'));var Papa=require('papaparse');var Redis=require(_0x160f('0x11'));var authService=require(_0x160f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x160f('0x13'));var hardwareService=require(_0x160f('0x14'));var logger=require('../../config/logger')(_0x160f('0x15'));var utils=require('../../config/utils');var config=require(_0x160f('0x16'));var db=require(_0x160f('0x17'))['db'];function respondWithStatusCode(_0x17c2e5,_0x5409b5){_0x5409b5=_0x5409b5||0xcc;return function(_0x686416){if(_0x686416){return _0x17c2e5[_0x160f('0x18')](_0x5409b5);}return _0x17c2e5[_0x160f('0x19')](_0x5409b5)['end']();};}function respondWithResult(_0x461d6b,_0x33fc48){_0x33fc48=_0x33fc48||0xc8;return function(_0x24b95c){if(_0x24b95c){return _0x461d6b[_0x160f('0x19')](_0x33fc48)['json'](_0x24b95c);}};}function respondWithFilteredResult(_0xf2fa69,_0x3ca79b){return function(_0x536a39){if(_0x536a39){var _0xa947bb=_0x536a39[_0x160f('0x1a')],_0x363b27=_0x3ca79b['offset'],_0x4fcd11=_0x3ca79b[_0x160f('0x1b')]+_0x3ca79b[_0x160f('0x1c')],_0x23d28a;if(_0x4fcd11>=_0xa947bb){_0x4fcd11=_0xa947bb;_0x23d28a=0xc8;}else{_0x23d28a=0xce;}_0xf2fa69[_0x160f('0x19')](_0x23d28a);return _0xf2fa69['set'](_0x160f('0x1d'),_0x363b27+'-'+_0x4fcd11+'/'+_0xa947bb)['json'](_0x536a39);}return null;};}function patchUpdates(_0x376cf7){return function(_0xeef203){try{jsonpatch[_0x160f('0x1e')](_0xeef203,_0x376cf7,!![]);}catch(_0x4d4bd2){return BPromise[_0x160f('0x1f')](_0x4d4bd2);}return _0xeef203['save']();};}function saveUpdates(_0x2d4f5e,_0x4dbc2f){return function(_0x565461){if(_0x565461){return _0x565461[_0x160f('0x20')](_0x2d4f5e)['then'](function(_0x242a1d){return _0x242a1d;});}return null;};}function removeEntity(_0x4ca09c,_0x5e375f){return function(_0x446baa){if(_0x446baa){return _0x446baa[_0x160f('0x21')]()[_0x160f('0x22')](function(){var _0x220f4e=_0x446baa[_0x160f('0x23')]({'plain':!![]});var _0x5596c7=_0x160f('0x24');return db['UserProfileResource'][_0x160f('0x21')]({'where':{'type':_0x5596c7,'resourceId':_0x220f4e['id']}})['then'](function(){return _0x446baa;});})[_0x160f('0x22')](function(){_0x4ca09c[_0x160f('0x19')](0xcc)[_0x160f('0x25')]();});}};}function handleEntityNotFound(_0x5e20c4,_0x46bd4e){return function(_0x5177ea){if(!_0x5177ea){_0x5e20c4['sendStatus'](0x194);}return _0x5177ea;};}function handleError(_0x5e6f2d,_0x49c570){_0x49c570=_0x49c570||0x1f4;return function(_0x272b5b){logger[_0x160f('0x26')](_0x272b5b[_0x160f('0x27')]);if(_0x272b5b[_0x160f('0x28')]){delete _0x272b5b['name'];}_0x5e6f2d['status'](_0x49c570)[_0x160f('0x29')](_0x272b5b);};}exports['index']=function(_0x1e99b7,_0x48f40f){var _0x1a7dd0={},_0x3bb9ff={},_0x35127a={'count':0x0,'rows':[]};var _0x2e4e2b=_[_0x160f('0x2a')](db[_0x160f('0x2b')][_0x160f('0x2c')],function(_0x43d79a){return{'name':_0x43d79a['fieldName'],'type':_0x43d79a[_0x160f('0x2d')]['key']};});_0x3bb9ff[_0x160f('0x2e')]=_[_0x160f('0x2a')](_0x2e4e2b,_0x160f('0x28'));_0x3bb9ff[_0x160f('0x2f')]=_[_0x160f('0x30')](_0x1e99b7[_0x160f('0x2f')]);_0x3bb9ff[_0x160f('0x31')]=_['intersection'](_0x3bb9ff[_0x160f('0x2e')],_0x3bb9ff[_0x160f('0x2f')]);_0x1a7dd0[_0x160f('0x32')]=_[_0x160f('0x33')](_0x3bb9ff['model'],qs[_0x160f('0x34')](_0x1e99b7[_0x160f('0x2f')]['fields']));_0x1a7dd0[_0x160f('0x32')]=_0x1a7dd0[_0x160f('0x32')][_0x160f('0x35')]?_0x1a7dd0[_0x160f('0x32')]:_0x3bb9ff['model'];if(!_0x1e99b7[_0x160f('0x2f')][_0x160f('0x36')](_0x160f('0x37'))){_0x1a7dd0[_0x160f('0x1c')]=qs[_0x160f('0x1c')](_0x1e99b7[_0x160f('0x2f')][_0x160f('0x1c')]);_0x1a7dd0[_0x160f('0x1b')]=qs[_0x160f('0x1b')](_0x1e99b7[_0x160f('0x2f')][_0x160f('0x1b')]);}_0x1a7dd0[_0x160f('0x38')]=qs[_0x160f('0x39')](_0x1e99b7[_0x160f('0x2f')][_0x160f('0x39')]);_0x1a7dd0[_0x160f('0x3a')]=qs[_0x160f('0x31')](_['pick'](_0x1e99b7['query'],_0x3bb9ff[_0x160f('0x31')]));if(_0x1e99b7[_0x160f('0x2f')][_0x160f('0x3b')]){_0x1a7dd0[_0x160f('0x3a')]=_[_0x160f('0x3c')](_0x1a7dd0[_0x160f('0x3a')],{'$or':_[_0x160f('0x2a')](_0x2e4e2b,function(_0x42d19e){if(_0x42d19e[_0x160f('0x2d')]!==_0x160f('0x3d')){var _0x3e9afa={};_0x3e9afa[_0x42d19e[_0x160f('0x28')]]={'$like':'%'+_0x1e99b7[_0x160f('0x2f')][_0x160f('0x3b')]+'%'};return _0x3e9afa;}})});}_0x1a7dd0=_[_0x160f('0x3c')]({},_0x1a7dd0,_0x1e99b7[_0x160f('0x3e')]);var _0x53d997={'where':_0x1a7dd0[_0x160f('0x3a')]};return db[_0x160f('0x2b')][_0x160f('0x1a')](_0x53d997)['then'](function(_0x5908cb){_0x35127a[_0x160f('0x1a')]=_0x5908cb;if(_0x1e99b7[_0x160f('0x2f')]['includeAll']){_0x1a7dd0[_0x160f('0x3f')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x160f('0x40')](_0x1a7dd0);})[_0x160f('0x22')](function(_0x413775){_0x35127a['rows']=_0x413775;return _0x35127a;})[_0x160f('0x22')](respondWithFilteredResult(_0x48f40f,_0x1a7dd0))['catch'](handleError(_0x48f40f,null));};exports[_0x160f('0x41')]=function(_0x321cff,_0x23d495){var _0x4c07f2={'raw':!![],'where':{'id':_0x321cff[_0x160f('0x42')]['id']}},_0xc45347={};_0xc45347['model']=_['keys'](db[_0x160f('0x2b')]['rawAttributes']);_0xc45347['query']=_[_0x160f('0x30')](_0x321cff[_0x160f('0x2f')]);_0xc45347[_0x160f('0x31')]=_[_0x160f('0x33')](_0xc45347[_0x160f('0x2e')],_0xc45347[_0x160f('0x2f')]);_0x4c07f2[_0x160f('0x32')]=_[_0x160f('0x33')](_0xc45347[_0x160f('0x2e')],qs[_0x160f('0x34')](_0x321cff['query'][_0x160f('0x34')]));_0x4c07f2[_0x160f('0x32')]=_0x4c07f2[_0x160f('0x32')][_0x160f('0x35')]?_0x4c07f2[_0x160f('0x32')]:_0xc45347[_0x160f('0x2e')];if(_0x321cff[_0x160f('0x2f')][_0x160f('0x43')]){_0x4c07f2[_0x160f('0x3f')]=[{'all':!![]}];}_0x4c07f2=_[_0x160f('0x3c')]({},_0x4c07f2,_0x321cff[_0x160f('0x3e')]);return db[_0x160f('0x2b')][_0x160f('0x44')](_0x4c07f2)['then'](handleEntityNotFound(_0x23d495,null))[_0x160f('0x22')](respondWithResult(_0x23d495,null))['catch'](handleError(_0x23d495,null));};exports[_0x160f('0x45')]=function(_0x44d467,_0x23ca76){return db[_0x160f('0x2b')]['create'](_0x44d467[_0x160f('0x46')],{})[_0x160f('0x22')](function(_0x52d8ee){var _0x548385=_0x44d467[_0x160f('0x47')][_0x160f('0x23')]({'plain':!![]});if(!_0x548385)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x548385[_0x160f('0x48')]==='user'){var _0xdc8f88=_0x52d8ee[_0x160f('0x23')]({'plain':!![]});var _0x2af5cb=_0x160f('0x24');return db[_0x160f('0x49')]['find']({'where':{'name':_0x2af5cb,'userProfileId':_0x548385[_0x160f('0x4a')]},'raw':!![]})[_0x160f('0x22')](function(_0x538ada){if(_0x538ada&&_0x538ada[_0x160f('0x4b')]===0x0){return db[_0x160f('0x4c')][_0x160f('0x45')]({'name':_0xdc8f88[_0x160f('0x28')],'resourceId':_0xdc8f88['id'],'type':_0x538ada[_0x160f('0x28')],'sectionId':_0x538ada['id']},{})['then'](function(){return _0x52d8ee;});}else{return _0x52d8ee;}})[_0x160f('0x4d')](function(_0x361abd){logger[_0x160f('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x361abd);throw _0x361abd;});}return _0x52d8ee;})['then'](respondWithResult(_0x23ca76,0xc9))['catch'](handleError(_0x23ca76,null));};exports['update']=function(_0x321e28,_0x1fd02a){if(_0x321e28[_0x160f('0x46')]['id']){delete _0x321e28['body']['id'];}return db[_0x160f('0x2b')][_0x160f('0x44')]({'where':{'id':_0x321e28[_0x160f('0x42')]['id']}})['then'](handleEntityNotFound(_0x1fd02a,null))[_0x160f('0x22')](saveUpdates(_0x321e28[_0x160f('0x46')],null))[_0x160f('0x22')](respondWithResult(_0x1fd02a,null))[_0x160f('0x4d')](handleError(_0x1fd02a,null));};exports[_0x160f('0x21')]=function(_0x29b090,_0x420e76){return db[_0x160f('0x2b')]['find']({'where':{'id':_0x29b090[_0x160f('0x42')]['id']}})[_0x160f('0x22')](handleEntityNotFound(_0x420e76,null))[_0x160f('0x22')](removeEntity(_0x420e76,null))[_0x160f('0x4d')](handleError(_0x420e76,null));};exports['download']=function(_0x5070f6,_0x490ca2,_0x211c16){return db[_0x160f('0x2b')][_0x160f('0x44')]({'where':{'id':_0x5070f6['params']['id']},'attributes':[_0x160f('0x28'),_0x160f('0x4e'),_0x160f('0x4f'),_0x160f('0x50')],'raw':!![]})[_0x160f('0x22')](handleEntityNotFound(_0x490ca2,null))['then'](function(_0x383875){if(_0x383875){if(!fs[_0x160f('0x51')](path['join'](config[_0x160f('0x52')],_0x160f('0x53'),_0x383875['savename']))){throw new db[(_0x160f('0x54'))][(_0x160f('0x55'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x5070f6[_0x160f('0x2f')]['exists']){return _0x490ca2[_0x160f('0x18')](0xc8);}return _0x490ca2[_0x160f('0x56')](path[_0x160f('0x57')](config[_0x160f('0x52')],'server/files/reports',_0x383875['savename']),util[_0x160f('0x58')]('%s.%s',_0x383875[_0x160f('0x4e')]||_0x383875[_0x160f('0x28')],_0x383875['output'][_0x160f('0x59')]()));}})[_0x160f('0x4d')](handleError(_0x490ca2,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 69029d0..71cf98f 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 _0xf958=['rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','api','moment','bluebird','request-promise','path'];(function(_0x444dd9,_0x3af3ec){var _0x1f646a=function(_0x1b6ddc){while(--_0x1b6ddc){_0x444dd9['push'](_0x444dd9['shift']());}};_0x1f646a(++_0x3af3ec);}(_0xf958,0x1db));var _0x8f95=function(_0x22ae54,_0x5d0b55){_0x22ae54=_0x22ae54-0x0;var _0x14005c=_0xf958[_0x22ae54];return _0x14005c;};'use strict';var _=require(_0x8f95('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8f95('0x1'));var moment=require(_0x8f95('0x2'));var BPromise=require(_0x8f95('0x3'));var rp=require(_0x8f95('0x4'));var fs=require('fs');var path=require(_0x8f95('0x5'));var rimraf=require(_0x8f95('0x6'));var config=require(_0x8f95('0x7'));var attributes=require(_0x8f95('0x8'));module[_0x8f95('0x9')]=function(_0x13261a,_0x38d4ad){return _0x13261a[_0x8f95('0xa')](_0x8f95('0xb'),attributes,{'tableName':_0x8f95('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb29a=['util','api','moment','bluebird','request-promise','../../config/environment','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash'];(function(_0x253080,_0x14c809){var _0x190a85=function(_0x5e4836){while(--_0x5e4836){_0x253080['push'](_0x253080['shift']());}};_0x190a85(++_0x14c809);}(_0xb29a,0xc5));var _0xab29=function(_0x255774,_0x48064f){_0x255774=_0x255774-0x0;var _0x38a9b6=_0xb29a[_0x255774];return _0x38a9b6;};'use strict';var _=require(_0xab29('0x0'));var util=require(_0xab29('0x1'));var logger=require('../../config/logger')(_0xab29('0x2'));var moment=require(_0xab29('0x3'));var BPromise=require(_0xab29('0x4'));var rp=require(_0xab29('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xab29('0x6'));var attributes=require('./analyticExtractedReport.attributes');module[_0xab29('0x7')]=function(_0x45dae5,_0x1c2602){return _0x45dae5[_0xab29('0x8')](_0xab29('0x9'),attributes,{'tableName':_0xab29('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index d01358f..28f7904 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 _0x6526=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','bluebird'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6526,0x1df));var _0x6652=function(_0x28edda,_0xbd447a){_0x28edda=_0x28edda-0x0;var _0x21f4a4=_0x6526[_0x28edda];return _0x21f4a4;};'use strict';var _=require(_0x6652('0x0'));var util=require(_0x6652('0x1'));var moment=require(_0x6652('0x2'));var BPromise=require(_0x6652('0x3'));var rs=require(_0x6652('0x4'));var fs=require('fs');var Redis=require(_0x6652('0x5'));var db=require(_0x6652('0x6'))['db'];var utils=require(_0x6652('0x7'));var logger=require(_0x6652('0x8'))(_0x6652('0x9'));var config=require('../../config/environment');var jayson=require(_0x6652('0xa'));var client=jayson[_0x6652('0xb')][_0x6652('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3db347,_0x4bb65a,_0x1e14ff){return new BPromise(function(_0x53e9b9,_0x41e150){return client[_0x6652('0xd')](_0x3db347,_0x1e14ff)['then'](function(_0xa9385){logger['info'](_0x6652('0xe'),_0x4bb65a,_0x6652('0xf'));logger['debug'](_0x6652('0x10'),_0x4bb65a,'request\x20sent',JSON['stringify'](_0xa9385));if(_0xa9385[_0x6652('0x11')]){if(_0xa9385[_0x6652('0x11')][_0x6652('0x12')]===0x1f4){logger[_0x6652('0x11')](_0x6652('0xe'),_0x4bb65a,_0xa9385[_0x6652('0x11')][_0x6652('0x13')]);return _0x41e150(_0xa9385[_0x6652('0x11')]['message']);}logger[_0x6652('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4bb65a,_0xa9385[_0x6652('0x11')][_0x6652('0x13')]);return _0x53e9b9(_0xa9385[_0x6652('0x11')]['message']);}else{logger[_0x6652('0x14')](_0x6652('0xe'),_0x4bb65a,'request\x20sent');_0x53e9b9(_0xa9385[_0x6652('0x15')][_0x6652('0x13')]);}})[_0x6652('0x16')](function(_0xa4170c){logger[_0x6652('0x11')](_0x6652('0xe'),_0x4bb65a,_0xa4170c);_0x41e150(_0xa4170c);});});} \ No newline at end of file +var _0x94a4=['message','info','catch','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','AnalyticExtractedReport,\x20%s,\x20%s','debug','request\x20sent','error','code'];(function(_0x5166c5,_0x30af8b){var _0x345930=function(_0x2db9bb){while(--_0x2db9bb){_0x5166c5['push'](_0x5166c5['shift']());}};_0x345930(++_0x30af8b);}(_0x94a4,0x9b));var _0x494a=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0x94a4[_0x725b8e];return _0x43ac45;};'use strict';var _=require(_0x494a('0x0'));var util=require('util');var moment=require(_0x494a('0x1'));var BPromise=require('bluebird');var rs=require(_0x494a('0x2'));var fs=require('fs');var Redis=require(_0x494a('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x494a('0x4'))(_0x494a('0x5'));var config=require(_0x494a('0x6'));var jayson=require(_0x494a('0x7'));var client=jayson[_0x494a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fe552,_0x326f6c,_0x4039db){return new BPromise(function(_0x5c0e06,_0x49d1d5){return client[_0x494a('0x9')](_0x4fe552,_0x4039db)[_0x494a('0xa')](function(_0x2f01c1){logger['info'](_0x494a('0xb'),_0x326f6c,'request\x20sent');logger[_0x494a('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x326f6c,_0x494a('0xd'),JSON['stringify'](_0x2f01c1));if(_0x2f01c1[_0x494a('0xe')]){if(_0x2f01c1['error'][_0x494a('0xf')]===0x1f4){logger[_0x494a('0xe')](_0x494a('0xb'),_0x326f6c,_0x2f01c1[_0x494a('0xe')][_0x494a('0x10')]);return _0x49d1d5(_0x2f01c1[_0x494a('0xe')]['message']);}logger[_0x494a('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x326f6c,_0x2f01c1['error'][_0x494a('0x10')]);return _0x5c0e06(_0x2f01c1[_0x494a('0xe')][_0x494a('0x10')]);}else{logger[_0x494a('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x326f6c,_0x494a('0xd'));_0x5c0e06(_0x2f01c1['result'][_0x494a('0x10')]);}})[_0x494a('0x12')](function(_0x1ee735){logger[_0x494a('0xe')](_0x494a('0xb'),_0x326f6c,_0x1ee735);_0x49d1d5(_0x1ee735);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 8ef43dc..f177178 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 _0xe361=['get','isAuthenticated','index','/:id','show','/:id/download','download','put','delete','util','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller'];(function(_0x36f99f,_0x10dfa2){var _0x85cb3b=function(_0x26d6b7){while(--_0x26d6b7){_0x36f99f['push'](_0x36f99f['shift']());}};_0x85cb3b(++_0x10dfa2);}(_0xe361,0x7e));var _0x1e36=function(_0x25d2fa,_0x1d35c6){_0x25d2fa=_0x25d2fa-0x0;var _0x42d4aa=_0xe361[_0x25d2fa];return _0x42d4aa;};'use strict';var multer=require('multer');var util=require(_0x1e36('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x1e36('0x1'));var config=require(_0x1e36('0x2'));var controller=require(_0x1e36('0x3'));router[_0x1e36('0x4')]('/',auth[_0x1e36('0x5')](),controller[_0x1e36('0x6')]);router[_0x1e36('0x4')](_0x1e36('0x7'),auth[_0x1e36('0x5')](),controller[_0x1e36('0x8')]);router[_0x1e36('0x4')](_0x1e36('0x9'),auth[_0x1e36('0x5')](),controller[_0x1e36('0xa')]);router['post']('/',auth[_0x1e36('0x5')](),controller['create']);router[_0x1e36('0xb')](_0x1e36('0x7'),auth['isAuthenticated'](),controller['update']);router[_0x1e36('0xc')](_0x1e36('0x7'),auth[_0x1e36('0x5')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4cad=['/:id/download','download','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show'];(function(_0x1e4150,_0x55b02a){var _0x1ce3ee=function(_0x59324e){while(--_0x59324e){_0x1e4150['push'](_0x1e4150['shift']());}};_0x1ce3ee(++_0x55b02a);}(_0x4cad,0x1a9));var _0xd4ca=function(_0x3ff80a,_0x41e284){_0x3ff80a=_0x3ff80a-0x0;var _0x1bf2b9=_0x4cad[_0x3ff80a];return _0x1bf2b9;};'use strict';var multer=require(_0xd4ca('0x0'));var util=require(_0xd4ca('0x1'));var path=require(_0xd4ca('0x2'));var timeout=require(_0xd4ca('0x3'));var express=require(_0xd4ca('0x4'));var router=express[_0xd4ca('0x5')]();var auth=require(_0xd4ca('0x6'));var interaction=require(_0xd4ca('0x7'));var config=require(_0xd4ca('0x8'));var controller=require(_0xd4ca('0x9'));router[_0xd4ca('0xa')]('/',auth[_0xd4ca('0xb')](),controller[_0xd4ca('0xc')]);router[_0xd4ca('0xa')](_0xd4ca('0xd'),auth[_0xd4ca('0xb')](),controller[_0xd4ca('0xe')]);router[_0xd4ca('0xa')](_0xd4ca('0xf'),auth['isAuthenticated'](),controller[_0xd4ca('0x10')]);router[_0xd4ca('0x11')]('/',auth[_0xd4ca('0xb')](),controller[_0xd4ca('0x12')]);router['put']('/:id',auth[_0xd4ca('0xb')](),controller['update']);router[_0xd4ca('0x13')](_0xd4ca('0xd'),auth[_0xd4ca('0xb')](),controller[_0xd4ca('0x14')]);module[_0xd4ca('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index f69c0b5..77b3523 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 _0x7217=['STRING','BOOLEAN','sequelize','TEXT'];(function(_0x49640b,_0x591a40){var _0x3b382c=function(_0x58dd52){while(--_0x58dd52){_0x49640b['push'](_0x49640b['shift']());}};_0x3b382c(++_0x591a40);}(_0x7217,0x19e));var _0x7721=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x7217[_0x29b609];return _0x54c952;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'field':{'type':Sequelize[_0x7721('0x1')]},'alias':{'type':Sequelize[_0x7721('0x2')]},'function':{'type':Sequelize[_0x7721('0x2')]},'format':{'type':Sequelize[_0x7721('0x2')]},'groupBy':{'type':Sequelize[_0x7721('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x5fc3=['sequelize','exports','STRING','BOOLEAN'];(function(_0x2fa2de,_0x286e8c){var _0x5fb68f=function(_0x29c361){while(--_0x29c361){_0x2fa2de['push'](_0x2fa2de['shift']());}};_0x5fb68f(++_0x286e8c);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3227c1,_0x4318c5){_0x3227c1=_0x3227c1-0x0;var _0x31fd48=_0x5fc3[_0x3227c1];return _0x31fd48;};'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 592c190..05c6235 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 _0xb511=['../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','Content-Range','json','reject','then','stack','name','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','type','VIRTUAL','AnalyticFieldReport','include','rows','catch','show','params','includeAll','options','find','create','body','bulkCreate','update','destroy','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','findAll','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0xc144be,_0x385142){var _0x4ffd89=function(_0x4d5ca1){while(--_0x4d5ca1){_0xc144be['push'](_0xc144be['shift']());}};_0x4ffd89(++_0x385142);}(_0xb511,0x165));var _0x1b51=function(_0x5b13a8,_0x2f7062){_0x5b13a8=_0x5b13a8-0x0;var _0x2887d3=_0xb511[_0x5b13a8];return _0x2887d3;};'use strict';var pdf=require(_0x1b51('0x0'));var emlformat=require(_0x1b51('0x1'));var rimraf=require(_0x1b51('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1b51('0x3'));var rp=require(_0x1b51('0x4'));var moment=require('moment');var BPromise=require(_0x1b51('0x5'));var Mustache=require(_0x1b51('0x6'));var util=require(_0x1b51('0x7'));var path=require('path');var sox=require(_0x1b51('0x8'));var csv=require(_0x1b51('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1b51('0xa'));var squel=require(_0x1b51('0xb'));var crypto=require('crypto');var jsforce=require(_0x1b51('0xc'));var deskjs=require(_0x1b51('0xd'));var toCsv=require(_0x1b51('0x9'));var querystring=require(_0x1b51('0xe'));var Papa=require(_0x1b51('0xf'));var Redis=require(_0x1b51('0x10'));var authService=require(_0x1b51('0x11'));var qs=require(_0x1b51('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1b51('0x13'));var logger=require(_0x1b51('0x14'))(_0x1b51('0x15'));var utils=require(_0x1b51('0x16'));var config=require(_0x1b51('0x17'));var db=require(_0x1b51('0x18'))['db'];function respondWithStatusCode(_0x4bf4eb,_0xfa36a5){_0xfa36a5=_0xfa36a5||0xcc;return function(_0x11e29e){if(_0x11e29e){return _0x4bf4eb[_0x1b51('0x19')](_0xfa36a5);}return _0x4bf4eb[_0x1b51('0x1a')](_0xfa36a5)[_0x1b51('0x1b')]();};}function respondWithResult(_0x46c991,_0x159c9a){_0x159c9a=_0x159c9a||0xc8;return function(_0x58a1db){if(_0x58a1db){return _0x46c991[_0x1b51('0x1a')](_0x159c9a)['json'](_0x58a1db);}};}function respondWithFilteredResult(_0x5db91e,_0x46b28f){return function(_0x3c427a){if(_0x3c427a){var _0x4bfe72=_0x3c427a['count'],_0x231475=_0x46b28f[_0x1b51('0x1c')],_0x3ece8d=_0x46b28f[_0x1b51('0x1c')]+_0x46b28f[_0x1b51('0x1d')],_0x3f3850;if(_0x3ece8d>=_0x4bfe72){_0x3ece8d=_0x4bfe72;_0x3f3850=0xc8;}else{_0x3f3850=0xce;}_0x5db91e[_0x1b51('0x1a')](_0x3f3850);return _0x5db91e['set'](_0x1b51('0x1e'),_0x231475+'-'+_0x3ece8d+'/'+_0x4bfe72)[_0x1b51('0x1f')](_0x3c427a);}return null;};}function patchUpdates(_0x153c33){return function(_0x556762){try{jsonpatch['apply'](_0x556762,_0x153c33,!![]);}catch(_0x1d67f3){return BPromise[_0x1b51('0x20')](_0x1d67f3);}return _0x556762['save']();};}function saveUpdates(_0x2c9e54,_0x695f55){return function(_0x527647){if(_0x527647){return _0x527647['update'](_0x2c9e54)[_0x1b51('0x21')](function(_0xb4ddf6){return _0xb4ddf6;});}return null;};}function removeEntity(_0x15e196,_0x17381b){return function(_0x5628cf){if(_0x5628cf){return _0x5628cf['destroy']()[_0x1b51('0x21')](function(){_0x15e196[_0x1b51('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cfab4,_0x4ba07e){return function(_0x4a2e45){if(!_0x4a2e45){_0x2cfab4[_0x1b51('0x19')](0x194);}return _0x4a2e45;};}function handleError(_0x4b43c8,_0x1eac36){_0x1eac36=_0x1eac36||0x1f4;return function(_0x2a720f){logger['error'](_0x2a720f[_0x1b51('0x22')]);if(_0x2a720f[_0x1b51('0x23')]){delete _0x2a720f[_0x1b51('0x23')];}_0x4b43c8[_0x1b51('0x1a')](_0x1eac36)['send'](_0x2a720f);};}exports['index']=function(_0x3544ad,_0x1a6c68){var _0x9f3268={},_0x46797d={},_0x25cb80={'count':0x0,'rows':[]};var _0x23cfcd=_[_0x1b51('0x24')](db['AnalyticFieldReport'][_0x1b51('0x25')],function(_0x1108ba){return{'name':_0x1108ba[_0x1b51('0x26')],'type':_0x1108ba['type'][_0x1b51('0x27')]};});_0x46797d[_0x1b51('0x28')]=_[_0x1b51('0x24')](_0x23cfcd,_0x1b51('0x23'));_0x46797d[_0x1b51('0x29')]=_[_0x1b51('0x2a')](_0x3544ad[_0x1b51('0x29')]);_0x46797d['filters']=_[_0x1b51('0x2b')](_0x46797d[_0x1b51('0x28')],_0x46797d[_0x1b51('0x29')]);_0x9f3268[_0x1b51('0x2c')]=_[_0x1b51('0x2b')](_0x46797d[_0x1b51('0x28')],qs[_0x1b51('0x2d')](_0x3544ad[_0x1b51('0x29')][_0x1b51('0x2d')]));_0x9f3268['attributes']=_0x9f3268[_0x1b51('0x2c')][_0x1b51('0x2e')]?_0x9f3268['attributes']:_0x46797d[_0x1b51('0x28')];if(!_0x3544ad['query'][_0x1b51('0x2f')](_0x1b51('0x30'))){_0x9f3268[_0x1b51('0x1d')]=qs[_0x1b51('0x1d')](_0x3544ad['query'][_0x1b51('0x1d')]);_0x9f3268[_0x1b51('0x1c')]=qs[_0x1b51('0x1c')](_0x3544ad[_0x1b51('0x29')]['offset']);}_0x9f3268['order']=qs[_0x1b51('0x31')](_0x3544ad[_0x1b51('0x29')][_0x1b51('0x31')]);_0x9f3268[_0x1b51('0x32')]=qs[_0x1b51('0x33')](_['pick'](_0x3544ad[_0x1b51('0x29')],_0x46797d[_0x1b51('0x33')]));if(_0x3544ad[_0x1b51('0x29')][_0x1b51('0x34')]){_0x9f3268[_0x1b51('0x32')]=_[_0x1b51('0x35')](_0x9f3268['where'],{'$or':_[_0x1b51('0x24')](_0x23cfcd,function(_0x2137e5){if(_0x2137e5[_0x1b51('0x36')]!==_0x1b51('0x37')){var _0x5a936a={};_0x5a936a[_0x2137e5[_0x1b51('0x23')]]={'$like':'%'+_0x3544ad[_0x1b51('0x29')][_0x1b51('0x34')]+'%'};return _0x5a936a;}})});}_0x9f3268=_[_0x1b51('0x35')]({},_0x9f3268,_0x3544ad['options']);var _0x2861c3={'where':_0x9f3268[_0x1b51('0x32')]};return db[_0x1b51('0x38')]['count'](_0x2861c3)['then'](function(_0x12bdce){_0x25cb80['count']=_0x12bdce;if(_0x3544ad[_0x1b51('0x29')]['includeAll']){_0x9f3268[_0x1b51('0x39')]=[{'all':!![]}];}return db[_0x1b51('0x38')]['findAll'](_0x9f3268);})[_0x1b51('0x21')](function(_0x5d32d0){_0x25cb80[_0x1b51('0x3a')]=_0x5d32d0;return _0x25cb80;})[_0x1b51('0x21')](respondWithFilteredResult(_0x1a6c68,_0x9f3268))[_0x1b51('0x3b')](handleError(_0x1a6c68,null));};exports[_0x1b51('0x3c')]=function(_0x12a00f,_0x14328f){var _0x488c1b={'raw':![],'where':{'id':_0x12a00f[_0x1b51('0x3d')]['id']}},_0xab381f={};_0xab381f[_0x1b51('0x28')]=_[_0x1b51('0x2a')](db[_0x1b51('0x38')][_0x1b51('0x25')]);_0xab381f['query']=_[_0x1b51('0x2a')](_0x12a00f[_0x1b51('0x29')]);_0xab381f[_0x1b51('0x33')]=_[_0x1b51('0x2b')](_0xab381f[_0x1b51('0x28')],_0xab381f[_0x1b51('0x29')]);_0x488c1b['attributes']=_[_0x1b51('0x2b')](_0xab381f[_0x1b51('0x28')],qs['fields'](_0x12a00f[_0x1b51('0x29')][_0x1b51('0x2d')]));_0x488c1b[_0x1b51('0x2c')]=_0x488c1b[_0x1b51('0x2c')][_0x1b51('0x2e')]?_0x488c1b[_0x1b51('0x2c')]:_0xab381f[_0x1b51('0x28')];if(_0x12a00f[_0x1b51('0x29')][_0x1b51('0x3e')]){_0x488c1b[_0x1b51('0x39')]=[{'all':!![]}];}_0x488c1b=_[_0x1b51('0x35')]({},_0x488c1b,_0x12a00f[_0x1b51('0x3f')]);return db[_0x1b51('0x38')][_0x1b51('0x40')](_0x488c1b)['then'](handleEntityNotFound(_0x14328f,null))[_0x1b51('0x21')](respondWithResult(_0x14328f,null))[_0x1b51('0x3b')](handleError(_0x14328f,null));};exports[_0x1b51('0x41')]=function(_0x1bf9ba,_0x1a15b3){return db[_0x1b51('0x38')]['create'](_0x1bf9ba[_0x1b51('0x42')],{})[_0x1b51('0x21')](respondWithResult(_0x1a15b3,0xc9))[_0x1b51('0x3b')](handleError(_0x1a15b3,null));};exports[_0x1b51('0x43')]=function(_0x2b9105,_0xcce418){return db['AnalyticFieldReport'][_0x1b51('0x43')](_0x2b9105[_0x1b51('0x42')],{'raw':![],'individualHooks':!![]})[_0x1b51('0x21')](respondWithResult(_0xcce418,0xc9))['catch'](handleError(_0xcce418,null));};exports[_0x1b51('0x44')]=function(_0x122ee3,_0x34a17f){if(_0x122ee3[_0x1b51('0x42')]['id']){delete _0x122ee3[_0x1b51('0x42')]['id'];}return db[_0x1b51('0x38')][_0x1b51('0x40')]({'where':{'id':_0x122ee3[_0x1b51('0x3d')]['id']}})['then'](handleEntityNotFound(_0x34a17f,null))['then'](saveUpdates(_0x122ee3['body'],null))[_0x1b51('0x21')](respondWithResult(_0x34a17f,null))[_0x1b51('0x3b')](handleError(_0x34a17f,null));};exports['destroy']=function(_0x481a9c,_0x56736b){return db[_0x1b51('0x38')][_0x1b51('0x40')]({'where':{'id':_0x481a9c['params']['id']}})[_0x1b51('0x21')](handleEntityNotFound(_0x56736b,null))[_0x1b51('0x21')](removeEntity(_0x56736b,null))[_0x1b51('0x3b')](handleError(_0x56736b,null));};exports['bulkDestroy']=function(_0x18c1ee,_0xdc909){return db[_0x1b51('0x38')][_0x1b51('0x45')]({'where':{'id':_0x18c1ee['query']['ids']||[]},'raw':![],'individualHooks':!![]})[_0x1b51('0x21')](respondWithResult(_0xdc909,0xcc))[_0x1b51('0x3b')](handleError(_0xdc909,null));};exports['addFields']=function(_0x2b0d49,_0x18707e,_0xe4b27a){return db[_0x1b51('0x46')][_0x1b51('0x47')]({'where':{'id':_0x2b0d49[_0x1b51('0x3d')]['id']}})['then'](handleEntityNotFound(_0x18707e,null))['then'](function(_0x1b9eab){if(_0x1b9eab){return db[_0x1b51('0x48')][_0x1b51('0x49')](function(_0x373e70){return db[_0x1b51('0x38')]['destroy']({'where':{'CustomReportId':_0x2b0d49['params']['id']},'transaction':_0x373e70})[_0x1b51('0x21')](function(_0x4b8dea){var _0x49ae18=_['map'](_0x2b0d49[_0x1b51('0x42')],function(_0x21d579){delete _0x21d579['id'];_0x21d579[_0x1b51('0x4a')]=_0x2b0d49[_0x1b51('0x3d')]['id'];return _0x21d579;});return db[_0x1b51('0x38')][_0x1b51('0x43')](_0x49ae18,{'transaction':_0x373e70});});})[_0x1b51('0x21')](function(){return db[_0x1b51('0x38')][_0x1b51('0x4b')]({'where':{'CustomReportId':_0x2b0d49[_0x1b51('0x3d')]['id']}});});}})[_0x1b51('0x21')](respondWithResult(_0x18707e,null))[_0x1b51('0x3b')](handleError(_0x18707e,null));}; \ No newline at end of file +var _0xe829=['offset','set','Content-Range','json','apply','reject','save','then','error','stack','name','index','map','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','AnalyticFieldReport','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','bulkCreate','update','destroy','bulkDestroy','ids','addFields','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe829,0xde));var _0x9e82=function(_0x54de5d,_0x1f8b26){_0x54de5d=_0x54de5d-0x0;var _0x1b349e=_0xe829[_0x54de5d];return _0x1b349e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9e82('0x0'));var rimraf=require(_0x9e82('0x1'));var zipdir=require(_0x9e82('0x2'));var jsonpatch=require(_0x9e82('0x3'));var rp=require(_0x9e82('0x4'));var moment=require(_0x9e82('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9e82('0x6'));var util=require(_0x9e82('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9e82('0x8'));var fs=require('fs');var _=require(_0x9e82('0x9'));var squel=require(_0x9e82('0xa'));var crypto=require('crypto');var jsforce=require(_0x9e82('0xb'));var deskjs=require(_0x9e82('0xc'));var toCsv=require(_0x9e82('0xd'));var querystring=require(_0x9e82('0xe'));var Papa=require('papaparse');var Redis=require(_0x9e82('0xf'));var authService=require(_0x9e82('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9e82('0x11'));var hardwareService=require(_0x9e82('0x12'));var logger=require('../../config/logger')(_0x9e82('0x13'));var utils=require(_0x9e82('0x14'));var config=require(_0x9e82('0x15'));var db=require(_0x9e82('0x16'))['db'];function respondWithStatusCode(_0x239d5c,_0x5a835d){_0x5a835d=_0x5a835d||0xcc;return function(_0x2cd0f6){if(_0x2cd0f6){return _0x239d5c[_0x9e82('0x17')](_0x5a835d);}return _0x239d5c[_0x9e82('0x18')](_0x5a835d)[_0x9e82('0x19')]();};}function respondWithResult(_0x583c49,_0x570223){_0x570223=_0x570223||0xc8;return function(_0x5e7529){if(_0x5e7529){return _0x583c49['status'](_0x570223)['json'](_0x5e7529);}};}function respondWithFilteredResult(_0xa4bd12,_0x567ff9){return function(_0x2f39a3){if(_0x2f39a3){var _0x42b785=_0x2f39a3[_0x9e82('0x1a')],_0x1bdf3f=_0x567ff9[_0x9e82('0x1b')],_0x37cea0=_0x567ff9['offset']+_0x567ff9['limit'],_0x4fa628;if(_0x37cea0>=_0x42b785){_0x37cea0=_0x42b785;_0x4fa628=0xc8;}else{_0x4fa628=0xce;}_0xa4bd12[_0x9e82('0x18')](_0x4fa628);return _0xa4bd12[_0x9e82('0x1c')](_0x9e82('0x1d'),_0x1bdf3f+'-'+_0x37cea0+'/'+_0x42b785)[_0x9e82('0x1e')](_0x2f39a3);}return null;};}function patchUpdates(_0xfbeb43){return function(_0x14c522){try{jsonpatch[_0x9e82('0x1f')](_0x14c522,_0xfbeb43,!![]);}catch(_0x478abd){return BPromise[_0x9e82('0x20')](_0x478abd);}return _0x14c522[_0x9e82('0x21')]();};}function saveUpdates(_0x3463e6,_0x5b4352){return function(_0x266963){if(_0x266963){return _0x266963['update'](_0x3463e6)[_0x9e82('0x22')](function(_0x2fd0fa){return _0x2fd0fa;});}return null;};}function removeEntity(_0x463357,_0xede436){return function(_0x3f8c4f){if(_0x3f8c4f){return _0x3f8c4f['destroy']()[_0x9e82('0x22')](function(){_0x463357[_0x9e82('0x18')](0xcc)[_0x9e82('0x19')]();});}};}function handleEntityNotFound(_0x370d2d,_0x50d8d2){return function(_0x551f4d){if(!_0x551f4d){_0x370d2d[_0x9e82('0x17')](0x194);}return _0x551f4d;};}function handleError(_0x16e006,_0x2c3895){_0x2c3895=_0x2c3895||0x1f4;return function(_0x1c0646){logger[_0x9e82('0x23')](_0x1c0646[_0x9e82('0x24')]);if(_0x1c0646['name']){delete _0x1c0646[_0x9e82('0x25')];}_0x16e006['status'](_0x2c3895)['send'](_0x1c0646);};}exports[_0x9e82('0x26')]=function(_0x4a8329,_0x5a5a4e){var _0x371df8={},_0x1ac8ee={},_0x2ceb2a={'count':0x0,'rows':[]};var _0x2690ef=_[_0x9e82('0x27')](db['AnalyticFieldReport']['rawAttributes'],function(_0x402aee){return{'name':_0x402aee[_0x9e82('0x28')],'type':_0x402aee[_0x9e82('0x29')]['key']};});_0x1ac8ee['model']=_[_0x9e82('0x27')](_0x2690ef,_0x9e82('0x25'));_0x1ac8ee[_0x9e82('0x2a')]=_[_0x9e82('0x2b')](_0x4a8329[_0x9e82('0x2a')]);_0x1ac8ee[_0x9e82('0x2c')]=_['intersection'](_0x1ac8ee['model'],_0x1ac8ee['query']);_0x371df8['attributes']=_[_0x9e82('0x2d')](_0x1ac8ee[_0x9e82('0x2e')],qs[_0x9e82('0x2f')](_0x4a8329['query'][_0x9e82('0x2f')]));_0x371df8[_0x9e82('0x30')]=_0x371df8['attributes'][_0x9e82('0x31')]?_0x371df8[_0x9e82('0x30')]:_0x1ac8ee[_0x9e82('0x2e')];if(!_0x4a8329[_0x9e82('0x2a')][_0x9e82('0x32')](_0x9e82('0x33'))){_0x371df8[_0x9e82('0x34')]=qs[_0x9e82('0x34')](_0x4a8329[_0x9e82('0x2a')][_0x9e82('0x34')]);_0x371df8[_0x9e82('0x1b')]=qs[_0x9e82('0x1b')](_0x4a8329[_0x9e82('0x2a')][_0x9e82('0x1b')]);}_0x371df8[_0x9e82('0x35')]=qs[_0x9e82('0x36')](_0x4a8329[_0x9e82('0x2a')][_0x9e82('0x36')]);_0x371df8[_0x9e82('0x37')]=qs[_0x9e82('0x2c')](_[_0x9e82('0x38')](_0x4a8329[_0x9e82('0x2a')],_0x1ac8ee[_0x9e82('0x2c')]));if(_0x4a8329[_0x9e82('0x2a')][_0x9e82('0x39')]){_0x371df8[_0x9e82('0x37')]=_[_0x9e82('0x3a')](_0x371df8['where'],{'$or':_['map'](_0x2690ef,function(_0x48e0ea){if(_0x48e0ea['type']!==_0x9e82('0x3b')){var _0x4163ed={};_0x4163ed[_0x48e0ea[_0x9e82('0x25')]]={'$like':'%'+_0x4a8329[_0x9e82('0x2a')][_0x9e82('0x39')]+'%'};return _0x4163ed;}})});}_0x371df8=_[_0x9e82('0x3a')]({},_0x371df8,_0x4a8329[_0x9e82('0x3c')]);var _0x3934b3={'where':_0x371df8[_0x9e82('0x37')]};return db[_0x9e82('0x3d')][_0x9e82('0x1a')](_0x3934b3)[_0x9e82('0x22')](function(_0x50903e){_0x2ceb2a[_0x9e82('0x1a')]=_0x50903e;if(_0x4a8329[_0x9e82('0x2a')][_0x9e82('0x3e')]){_0x371df8['include']=[{'all':!![]}];}return db[_0x9e82('0x3d')][_0x9e82('0x3f')](_0x371df8);})[_0x9e82('0x22')](function(_0x4953e8){_0x2ceb2a[_0x9e82('0x40')]=_0x4953e8;return _0x2ceb2a;})[_0x9e82('0x22')](respondWithFilteredResult(_0x5a5a4e,_0x371df8))[_0x9e82('0x41')](handleError(_0x5a5a4e,null));};exports[_0x9e82('0x42')]=function(_0x1d652b,_0x146a84){var _0xe426df={'raw':![],'where':{'id':_0x1d652b[_0x9e82('0x43')]['id']}},_0x179a7b={};_0x179a7b[_0x9e82('0x2e')]=_[_0x9e82('0x2b')](db['AnalyticFieldReport'][_0x9e82('0x44')]);_0x179a7b[_0x9e82('0x2a')]=_[_0x9e82('0x2b')](_0x1d652b['query']);_0x179a7b['filters']=_['intersection'](_0x179a7b[_0x9e82('0x2e')],_0x179a7b[_0x9e82('0x2a')]);_0xe426df[_0x9e82('0x30')]=_['intersection'](_0x179a7b[_0x9e82('0x2e')],qs[_0x9e82('0x2f')](_0x1d652b[_0x9e82('0x2a')][_0x9e82('0x2f')]));_0xe426df[_0x9e82('0x30')]=_0xe426df[_0x9e82('0x30')]['length']?_0xe426df[_0x9e82('0x30')]:_0x179a7b['model'];if(_0x1d652b['query'][_0x9e82('0x3e')]){_0xe426df[_0x9e82('0x45')]=[{'all':!![]}];}_0xe426df=_[_0x9e82('0x3a')]({},_0xe426df,_0x1d652b[_0x9e82('0x3c')]);return db[_0x9e82('0x3d')][_0x9e82('0x46')](_0xe426df)[_0x9e82('0x22')](handleEntityNotFound(_0x146a84,null))[_0x9e82('0x22')](respondWithResult(_0x146a84,null))['catch'](handleError(_0x146a84,null));};exports[_0x9e82('0x47')]=function(_0x58f508,_0x26137e){return db[_0x9e82('0x3d')][_0x9e82('0x47')](_0x58f508[_0x9e82('0x48')],{})[_0x9e82('0x22')](respondWithResult(_0x26137e,0xc9))[_0x9e82('0x41')](handleError(_0x26137e,null));};exports[_0x9e82('0x49')]=function(_0x418ca3,_0x35ea66){return db['AnalyticFieldReport'][_0x9e82('0x49')](_0x418ca3[_0x9e82('0x48')],{'raw':![],'individualHooks':!![]})[_0x9e82('0x22')](respondWithResult(_0x35ea66,0xc9))[_0x9e82('0x41')](handleError(_0x35ea66,null));};exports[_0x9e82('0x4a')]=function(_0x43817b,_0x3a7070){if(_0x43817b[_0x9e82('0x48')]['id']){delete _0x43817b[_0x9e82('0x48')]['id'];}return db[_0x9e82('0x3d')][_0x9e82('0x46')]({'where':{'id':_0x43817b[_0x9e82('0x43')]['id']}})[_0x9e82('0x22')](handleEntityNotFound(_0x3a7070,null))[_0x9e82('0x22')](saveUpdates(_0x43817b['body'],null))[_0x9e82('0x22')](respondWithResult(_0x3a7070,null))[_0x9e82('0x41')](handleError(_0x3a7070,null));};exports[_0x9e82('0x4b')]=function(_0x37ecfe,_0x45a5bf){return db[_0x9e82('0x3d')][_0x9e82('0x46')]({'where':{'id':_0x37ecfe[_0x9e82('0x43')]['id']}})[_0x9e82('0x22')](handleEntityNotFound(_0x45a5bf,null))[_0x9e82('0x22')](removeEntity(_0x45a5bf,null))[_0x9e82('0x41')](handleError(_0x45a5bf,null));};exports[_0x9e82('0x4c')]=function(_0x383d86,_0x30414c){return db[_0x9e82('0x3d')]['destroy']({'where':{'id':_0x383d86[_0x9e82('0x2a')][_0x9e82('0x4d')]||[]},'raw':![],'individualHooks':!![]})[_0x9e82('0x22')](respondWithResult(_0x30414c,0xcc))['catch'](handleError(_0x30414c,null));};exports[_0x9e82('0x4e')]=function(_0x32719c,_0x2c7016,_0x377895){return db['AnalyticCustomReport'][_0x9e82('0x4f')]({'where':{'id':_0x32719c[_0x9e82('0x43')]['id']}})[_0x9e82('0x22')](handleEntityNotFound(_0x2c7016,null))[_0x9e82('0x22')](function(_0x566c1b){if(_0x566c1b){return db[_0x9e82('0x50')][_0x9e82('0x51')](function(_0x4a016d){return db[_0x9e82('0x3d')][_0x9e82('0x4b')]({'where':{'CustomReportId':_0x32719c[_0x9e82('0x43')]['id']},'transaction':_0x4a016d})[_0x9e82('0x22')](function(_0x213574){var _0x199e6b=_['map'](_0x32719c[_0x9e82('0x48')],function(_0x5c9ef6){delete _0x5c9ef6['id'];_0x5c9ef6[_0x9e82('0x52')]=_0x32719c[_0x9e82('0x43')]['id'];return _0x5c9ef6;});return db[_0x9e82('0x3d')][_0x9e82('0x49')](_0x199e6b,{'transaction':_0x4a016d});});})[_0x9e82('0x22')](function(){return db[_0x9e82('0x3d')][_0x9e82('0x3f')]({'where':{'CustomReportId':_0x32719c['params']['id']}});});}})[_0x9e82('0x22')](respondWithResult(_0x2c7016,null))[_0x9e82('0x41')](handleError(_0x2c7016,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 012531b..34a9849 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 _0x23ad=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api'];(function(_0x18abd2,_0x22d4b3){var _0x1dcad6=function(_0xcc08c4){while(--_0xcc08c4){_0x18abd2['push'](_0x18abd2['shift']());}};_0x1dcad6(++_0x22d4b3);}(_0x23ad,0x13e));var _0xd23a=function(_0x251f43,_0x4cec62){_0x251f43=_0x251f43-0x0;var _0xab1edc=_0x23ad[_0x251f43];return _0xab1edc;};'use strict';var _=require(_0xd23a('0x0'));var util=require(_0xd23a('0x1'));var logger=require(_0xd23a('0x2'))(_0xd23a('0x3'));var moment=require(_0xd23a('0x4'));var BPromise=require(_0xd23a('0x5'));var rp=require(_0xd23a('0x6'));var fs=require('fs');var path=require(_0xd23a('0x7'));var rimraf=require(_0xd23a('0x8'));var config=require(_0xd23a('0x9'));var attributes=require(_0xd23a('0xa'));module[_0xd23a('0xb')]=function(_0x432314,_0xe0aa6f){return _0x432314['define'](_0xd23a('0xc'),attributes,{'tableName':_0xd23a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x46cc=['path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','lodash','util','moment','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x46cc,0x193));var _0xc46c=function(_0x1853e5,_0x2193d4){_0x1853e5=_0x1853e5-0x0;var _0x26baad=_0x46cc[_0x1853e5];return _0x26baad;};'use strict';var _=require(_0xc46c('0x0'));var util=require(_0xc46c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc46c('0x2'));var BPromise=require('bluebird');var rp=require(_0xc46c('0x3'));var fs=require('fs');var path=require(_0xc46c('0x4'));var rimraf=require(_0xc46c('0x5'));var config=require(_0xc46c('0x6'));var attributes=require(_0xc46c('0x7'));module[_0xc46c('0x8')]=function(_0xdbe7d0,_0x1b7d18){return _0xdbe7d0[_0xc46c('0x9')](_0xc46c('0xa'),attributes,{'tableName':'analytics_report_fields','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 a4101f9..4081de1 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 _0x0c54=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','then','info','AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0x24026c,_0x1cb315){var _0x30a89e=function(_0x487334){while(--_0x487334){_0x24026c['push'](_0x24026c['shift']());}};_0x30a89e(++_0x1cb315);}(_0x0c54,0x1cc));var _0x40c5=function(_0x5eaa0b,_0x433b2f){_0x5eaa0b=_0x5eaa0b-0x0;var _0x28b295=_0x0c54[_0x5eaa0b];return _0x28b295;};'use strict';var _=require(_0x40c5('0x0'));var util=require(_0x40c5('0x1'));var moment=require('moment');var BPromise=require(_0x40c5('0x2'));var rs=require(_0x40c5('0x3'));var fs=require('fs');var Redis=require(_0x40c5('0x4'));var db=require(_0x40c5('0x5'))['db'];var utils=require(_0x40c5('0x6'));var logger=require('../../config/logger')(_0x40c5('0x7'));var config=require(_0x40c5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x40c5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5acbdd,_0x3e2799,_0x39e8cf){return new BPromise(function(_0x4a6021,_0x19bea0){return client['request'](_0x5acbdd,_0x39e8cf)[_0x40c5('0xa')](function(_0x1a73dc){logger[_0x40c5('0xb')](_0x40c5('0xc'),_0x3e2799,'request\x20sent');logger[_0x40c5('0xd')](_0x40c5('0xe'),_0x3e2799,_0x40c5('0xf'),JSON[_0x40c5('0x10')](_0x1a73dc));if(_0x1a73dc[_0x40c5('0x11')]){if(_0x1a73dc[_0x40c5('0x11')][_0x40c5('0x12')]===0x1f4){logger[_0x40c5('0x11')](_0x40c5('0xc'),_0x3e2799,_0x1a73dc[_0x40c5('0x11')][_0x40c5('0x13')]);return _0x19bea0(_0x1a73dc['error'][_0x40c5('0x13')]);}logger[_0x40c5('0x11')](_0x40c5('0xc'),_0x3e2799,_0x1a73dc['error']['message']);return _0x4a6021(_0x1a73dc[_0x40c5('0x11')][_0x40c5('0x13')]);}else{logger[_0x40c5('0xb')](_0x40c5('0xc'),_0x3e2799,'request\x20sent');_0x4a6021(_0x1a73dc[_0x40c5('0x14')][_0x40c5('0x13')]);}})[_0x40c5('0x15')](function(_0x17b6f3){logger['error'](_0x40c5('0xc'),_0x3e2799,_0x17b6f3);_0x19bea0(_0x17b6f3);});});} \ No newline at end of file +var _0x9d63=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x313002,_0x1b748e){var _0x8664e5=function(_0x496dfe){while(--_0x496dfe){_0x313002['push'](_0x313002['shift']());}};_0x8664e5(++_0x1b748e);}(_0x9d63,0x11f));var _0x39d6=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x9d63[_0x2a6809];return _0x11c371;};'use strict';var _=require(_0x39d6('0x0'));var util=require(_0x39d6('0x1'));var moment=require(_0x39d6('0x2'));var BPromise=require(_0x39d6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x39d6('0x4'));var db=require(_0x39d6('0x5'))['db'];var utils=require(_0x39d6('0x6'));var logger=require(_0x39d6('0x7'))(_0x39d6('0x8'));var config=require('../../config/environment');var jayson=require(_0x39d6('0x9'));var client=jayson[_0x39d6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27b81a,_0x30f4e7,_0x1f89fb){return new BPromise(function(_0x443391,_0x2cfc09){return client[_0x39d6('0xb')](_0x27b81a,_0x1f89fb)[_0x39d6('0xc')](function(_0x179e0a){logger[_0x39d6('0xd')](_0x39d6('0xe'),_0x30f4e7,_0x39d6('0xf'));logger['debug']('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x30f4e7,_0x39d6('0xf'),JSON[_0x39d6('0x10')](_0x179e0a));if(_0x179e0a[_0x39d6('0x11')]){if(_0x179e0a[_0x39d6('0x11')][_0x39d6('0x12')]===0x1f4){logger[_0x39d6('0x11')](_0x39d6('0xe'),_0x30f4e7,_0x179e0a[_0x39d6('0x11')][_0x39d6('0x13')]);return _0x2cfc09(_0x179e0a[_0x39d6('0x11')][_0x39d6('0x13')]);}logger[_0x39d6('0x11')](_0x39d6('0xe'),_0x30f4e7,_0x179e0a[_0x39d6('0x11')][_0x39d6('0x13')]);return _0x443391(_0x179e0a[_0x39d6('0x11')][_0x39d6('0x13')]);}else{logger[_0x39d6('0xd')](_0x39d6('0xe'),_0x30f4e7,'request\x20sent');_0x443391(_0x179e0a[_0x39d6('0x14')][_0x39d6('0x13')]);}})[_0x39d6('0x15')](function(_0x3764c4){logger[_0x39d6('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x30f4e7,_0x3764c4);_0x2cfc09(_0x3764c4);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index a7d6c4d..281d1c5 100644 --- a/server/api/analyticFieldReport/index.js +++ b/server/api/analyticFieldReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['../../config/environment','./analyticFieldReport.controller','get','isAuthenticated','index','/:id','post','create','/create_many','bulkCreate','/:id/create_many','addFields','update','delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x4f7239,_0x317962){var _0x1f1a78=function(_0x504ece){while(--_0x504ece){_0x4f7239['push'](_0x4f7239['shift']());}};_0x1f1a78(++_0x317962);}(_0x814b,0x1a2));var _0xb814=function(_0x2c96f6,_0x877207){_0x2c96f6=_0x2c96f6-0x0;var _0x6d4808=_0x814b[_0x2c96f6];return _0x6d4808;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb814('0x6'));var config=require(_0xb814('0x7'));var controller=require(_0xb814('0x8'));router[_0xb814('0x9')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xb')]);router['get'](_0xb814('0xc'),auth[_0xb814('0xa')](),controller['show']);router[_0xb814('0xd')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xe')]);router[_0xb814('0xd')](_0xb814('0xf'),auth[_0xb814('0xa')](),controller[_0xb814('0x10')]);router[_0xb814('0xd')](_0xb814('0x11'),auth[_0xb814('0xa')](),controller[_0xb814('0x12')]);router['put'](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router[_0xb814('0x14')](_0xb814('0x15'),auth[_0xb814('0xa')](),controller[_0xb814('0x16')]);router[_0xb814('0x14')](_0xb814('0xc'),auth[_0xb814('0xa')](),controller[_0xb814('0x17')]);module[_0xb814('0x18')]=router; \ No newline at end of file +var _0x814b=['../../config/environment','./analyticFieldReport.controller','get','isAuthenticated','index','/:id','post','create','/create_many','bulkCreate','/:id/create_many','addFields','update','delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x124ecb,_0xacb83f){var _0x490ca0=function(_0x4089f4){while(--_0x4089f4){_0x124ecb['push'](_0x124ecb['shift']());}};_0x490ca0(++_0xacb83f);}(_0x814b,0x1a2));var _0xb814=function(_0x2b948f,_0x398e62){_0x2b948f=_0x2b948f-0x0;var _0x1237bc=_0x814b[_0x2b948f];return _0x1237bc;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb814('0x6'));var config=require(_0xb814('0x7'));var controller=require(_0xb814('0x8'));router[_0xb814('0x9')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xb')]);router['get'](_0xb814('0xc'),auth[_0xb814('0xa')](),controller['show']);router[_0xb814('0xd')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xe')]);router[_0xb814('0xd')](_0xb814('0xf'),auth[_0xb814('0xa')](),controller[_0xb814('0x10')]);router[_0xb814('0xd')](_0xb814('0x11'),auth[_0xb814('0xa')](),controller[_0xb814('0x12')]);router['put'](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router[_0xb814('0x14')](_0xb814('0x15'),auth[_0xb814('0xa')](),controller[_0xb814('0x16')]);router[_0xb814('0x14')](_0xb814('0xc'),auth[_0xb814('0xa')](),controller[_0xb814('0x17')]);module[_0xb814('0x18')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 83cf4d6..e0fbc35 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 _0xff30=['sequelize','exports','STRING','name','TEXT'];(function(_0x1f45a9,_0x42ac06){var _0xcdcf39=function(_0x125c6c){while(--_0x125c6c){_0x1f45a9['push'](_0x1f45a9['shift']());}};_0xcdcf39(++_0x42ac06);}(_0xff30,0x104));var _0x0ff3=function(_0x461e43,_0xc57f71){_0x461e43=_0x461e43-0x0;var _0x52919c=_0xff30[_0x461e43];return _0x52919c;};'use strict';var Sequelize=require(_0x0ff3('0x0'));module[_0x0ff3('0x1')]={'name':{'type':Sequelize[_0x0ff3('0x2')],'allowNull':![],'unique':_0x0ff3('0x3')},'table':{'type':Sequelize[_0x0ff3('0x2')]},'metric':{'type':Sequelize[_0x0ff3('0x4')]},'description':{'type':Sequelize[_0x0ff3('0x2')]}}; \ No newline at end of file +var _0x8dd6=['TEXT','sequelize','STRING','name'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x8dd6,0xcd));var _0x68dd=function(_0x2a4e5e,_0x483233){_0x2a4e5e=_0x2a4e5e-0x0;var _0x171963=_0x8dd6[_0x2a4e5e];return _0x171963;};'use strict';var Sequelize=require(_0x68dd('0x0'));module['exports']={'name':{'type':Sequelize[_0x68dd('0x1')],'allowNull':![],'unique':_0x68dd('0x2')},'table':{'type':Sequelize[_0x68dd('0x1')]},'metric':{'type':Sequelize[_0x68dd('0x3')]},'description':{'type':Sequelize[_0x68dd('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 3d90714..a648dac 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 _0xb49f=['map','AnalyticMetric','rawAttributes','type','query','filters','attributes','intersection','model','fields','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','options','includeAll','findAll','rows','show','params','keys','length','include','merge','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','status','end','count','limit','set','Content-Range','json','apply','save','update','then','destroy','get','Metrics','error','stack','name','send'];(function(_0x20c5f8,_0xea1b44){var _0x34fde0=function(_0x364b98){while(--_0x364b98){_0x20c5f8['push'](_0x20c5f8['shift']());}};_0x34fde0(++_0xea1b44);}(_0xb49f,0x75));var _0xfb49=function(_0x49ecf7,_0x5a6d71){_0x49ecf7=_0x49ecf7-0x0;var _0x217540=_0xb49f[_0x49ecf7];return _0x217540;};'use strict';var pdf=require(_0xfb49('0x0'));var emlformat=require(_0xfb49('0x1'));var rimraf=require(_0xfb49('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfb49('0x3'));var rp=require(_0xfb49('0x4'));var moment=require(_0xfb49('0x5'));var BPromise=require(_0xfb49('0x6'));var Mustache=require(_0xfb49('0x7'));var util=require(_0xfb49('0x8'));var path=require('path');var sox=require(_0xfb49('0x9'));var csv=require('to-csv');var ejs=require(_0xfb49('0xa'));var fs=require('fs');var _=require(_0xfb49('0xb'));var squel=require(_0xfb49('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfb49('0xd'));var toCsv=require(_0xfb49('0xe'));var querystring=require('querystring');var Papa=require(_0xfb49('0xf'));var Redis=require(_0xfb49('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xfb49('0x11'));var as=require(_0xfb49('0x12'));var hardwareService=require(_0xfb49('0x13'));var logger=require(_0xfb49('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xfb49('0x15'))['db'];function respondWithStatusCode(_0x399689,_0x4913dc){_0x4913dc=_0x4913dc||0xcc;return function(_0x121724){if(_0x121724){return _0x399689[_0xfb49('0x16')](_0x4913dc);}return _0x399689[_0xfb49('0x17')](_0x4913dc)[_0xfb49('0x18')]();};}function respondWithResult(_0x2fedf8,_0x1aaa73){_0x1aaa73=_0x1aaa73||0xc8;return function(_0x23b52d){if(_0x23b52d){return _0x2fedf8['status'](_0x1aaa73)['json'](_0x23b52d);}};}function respondWithFilteredResult(_0x45c4e9,_0x1b71a8){return function(_0x135f55){if(_0x135f55){var _0x6ed728=_0x135f55[_0xfb49('0x19')],_0x526cbf=_0x1b71a8['offset'],_0x106645=_0x1b71a8['offset']+_0x1b71a8[_0xfb49('0x1a')],_0x1a0cab;if(_0x106645>=_0x6ed728){_0x106645=_0x6ed728;_0x1a0cab=0xc8;}else{_0x1a0cab=0xce;}_0x45c4e9[_0xfb49('0x17')](_0x1a0cab);return _0x45c4e9[_0xfb49('0x1b')](_0xfb49('0x1c'),_0x526cbf+'-'+_0x106645+'/'+_0x6ed728)[_0xfb49('0x1d')](_0x135f55);}return null;};}function patchUpdates(_0xc2b91a){return function(_0x4c7280){try{jsonpatch[_0xfb49('0x1e')](_0x4c7280,_0xc2b91a,!![]);}catch(_0x44d962){return BPromise['reject'](_0x44d962);}return _0x4c7280[_0xfb49('0x1f')]();};}function saveUpdates(_0x11c335,_0x2d7cf2){return function(_0x55a1b2){if(_0x55a1b2){return _0x55a1b2[_0xfb49('0x20')](_0x11c335)[_0xfb49('0x21')](function(_0x5d9848){return _0x5d9848;});}return null;};}function removeEntity(_0x40fa6b,_0x38a051){return function(_0x402b9d){if(_0x402b9d){return _0x402b9d[_0xfb49('0x22')]()['then'](function(){var _0x247a16=_0x402b9d[_0xfb49('0x23')]({'plain':!![]});var _0xdc2870=_0xfb49('0x24');return db['UserProfileResource'][_0xfb49('0x22')]({'where':{'type':_0xdc2870,'resourceId':_0x247a16['id']}})['then'](function(){return _0x402b9d;});})[_0xfb49('0x21')](function(){_0x40fa6b['status'](0xcc)[_0xfb49('0x18')]();});}};}function handleEntityNotFound(_0x2faabc,_0x3866ad){return function(_0x3dca70){if(!_0x3dca70){_0x2faabc['sendStatus'](0x194);}return _0x3dca70;};}function handleError(_0x575d51,_0x32fadd){_0x32fadd=_0x32fadd||0x1f4;return function(_0x40a136){logger[_0xfb49('0x25')](_0x40a136[_0xfb49('0x26')]);if(_0x40a136[_0xfb49('0x27')]){delete _0x40a136['name'];}_0x575d51[_0xfb49('0x17')](_0x32fadd)[_0xfb49('0x28')](_0x40a136);};}exports['index']=function(_0xa20643,_0x42e6fb){var _0x17c7b5={},_0x48a8e3={},_0xb3bd9b={'count':0x0,'rows':[]};var _0x1b5979=_[_0xfb49('0x29')](db[_0xfb49('0x2a')][_0xfb49('0x2b')],function(_0x50b4fa){return{'name':_0x50b4fa['fieldName'],'type':_0x50b4fa[_0xfb49('0x2c')]['key']};});_0x48a8e3['model']=_[_0xfb49('0x29')](_0x1b5979,'name');_0x48a8e3[_0xfb49('0x2d')]=_['keys'](_0xa20643['query']);_0x48a8e3[_0xfb49('0x2e')]=_['intersection'](_0x48a8e3['model'],_0x48a8e3[_0xfb49('0x2d')]);_0x17c7b5[_0xfb49('0x2f')]=_[_0xfb49('0x30')](_0x48a8e3[_0xfb49('0x31')],qs[_0xfb49('0x32')](_0xa20643[_0xfb49('0x2d')]['fields']));_0x17c7b5['attributes']=_0x17c7b5['attributes']['length']?_0x17c7b5[_0xfb49('0x2f')]:_0x48a8e3['model'];if(!_0xa20643[_0xfb49('0x2d')][_0xfb49('0x33')](_0xfb49('0x34'))){_0x17c7b5[_0xfb49('0x1a')]=qs['limit'](_0xa20643['query']['limit']);_0x17c7b5[_0xfb49('0x35')]=qs['offset'](_0xa20643[_0xfb49('0x2d')]['offset']);}_0x17c7b5[_0xfb49('0x36')]=qs[_0xfb49('0x37')](_0xa20643['query'][_0xfb49('0x37')]);_0x17c7b5['where']=qs[_0xfb49('0x2e')](_[_0xfb49('0x38')](_0xa20643[_0xfb49('0x2d')],_0x48a8e3[_0xfb49('0x2e')]));if(_0xa20643['query'][_0xfb49('0x39')]){_0x17c7b5[_0xfb49('0x3a')]=_['merge'](_0x17c7b5['where'],{'$or':_[_0xfb49('0x29')](_0x1b5979,function(_0xecb577){if(_0xecb577[_0xfb49('0x2c')]!=='VIRTUAL'){var _0xea8c26={};_0xea8c26[_0xecb577['name']]={'$like':'%'+_0xa20643[_0xfb49('0x2d')][_0xfb49('0x39')]+'%'};return _0xea8c26;}})});}_0x17c7b5=_['merge']({},_0x17c7b5,_0xa20643[_0xfb49('0x3b')]);var _0x17fa21={'where':_0x17c7b5[_0xfb49('0x3a')]};return db[_0xfb49('0x2a')][_0xfb49('0x19')](_0x17fa21)[_0xfb49('0x21')](function(_0x48473a){_0xb3bd9b['count']=_0x48473a;if(_0xa20643[_0xfb49('0x2d')][_0xfb49('0x3c')]){_0x17c7b5['include']=[{'all':!![]}];}return db['AnalyticMetric'][_0xfb49('0x3d')](_0x17c7b5);})[_0xfb49('0x21')](function(_0x286efd){_0xb3bd9b[_0xfb49('0x3e')]=_0x286efd;return _0xb3bd9b;})[_0xfb49('0x21')](respondWithFilteredResult(_0x42e6fb,_0x17c7b5))['catch'](handleError(_0x42e6fb,null));};exports[_0xfb49('0x3f')]=function(_0x22381d,_0x24b917){var _0x1b14cd={'raw':!![],'where':{'id':_0x22381d[_0xfb49('0x40')]['id']}},_0x46eaf6={};_0x46eaf6[_0xfb49('0x31')]=_[_0xfb49('0x41')](db['AnalyticMetric'][_0xfb49('0x2b')]);_0x46eaf6[_0xfb49('0x2d')]=_[_0xfb49('0x41')](_0x22381d[_0xfb49('0x2d')]);_0x46eaf6['filters']=_[_0xfb49('0x30')](_0x46eaf6[_0xfb49('0x31')],_0x46eaf6[_0xfb49('0x2d')]);_0x1b14cd[_0xfb49('0x2f')]=_[_0xfb49('0x30')](_0x46eaf6[_0xfb49('0x31')],qs[_0xfb49('0x32')](_0x22381d['query'][_0xfb49('0x32')]));_0x1b14cd[_0xfb49('0x2f')]=_0x1b14cd[_0xfb49('0x2f')][_0xfb49('0x42')]?_0x1b14cd[_0xfb49('0x2f')]:_0x46eaf6[_0xfb49('0x31')];if(_0x22381d[_0xfb49('0x2d')][_0xfb49('0x3c')]){_0x1b14cd[_0xfb49('0x43')]=[{'all':!![]}];}_0x1b14cd=_[_0xfb49('0x44')]({},_0x1b14cd,_0x22381d[_0xfb49('0x3b')]);return db[_0xfb49('0x2a')][_0xfb49('0x45')](_0x1b14cd)['then'](handleEntityNotFound(_0x24b917,null))['then'](respondWithResult(_0x24b917,null))[_0xfb49('0x46')](handleError(_0x24b917,null));};exports[_0xfb49('0x47')]=function(_0x55b211,_0x2a21af){return db[_0xfb49('0x2a')][_0xfb49('0x47')](_0x55b211[_0xfb49('0x48')],{})[_0xfb49('0x21')](function(_0x2da3d0){var _0x2a3ad4=_0x55b211['user'][_0xfb49('0x23')]({'plain':!![]});if(!_0x2a3ad4)throw new Error(_0xfb49('0x49'));if(_0x2a3ad4[_0xfb49('0x4a')]===_0xfb49('0x4b')){var _0x2eabb9=_0x2da3d0[_0xfb49('0x23')]({'plain':!![]});var _0x288424=_0xfb49('0x24');return db[_0xfb49('0x4c')][_0xfb49('0x45')]({'where':{'name':_0x288424,'userProfileId':_0x2a3ad4['userProfileId']},'raw':!![]})[_0xfb49('0x21')](function(_0x263b21){if(_0x263b21&&_0x263b21['autoAssociation']===0x0){return db[_0xfb49('0x4d')][_0xfb49('0x47')]({'name':_0x2eabb9[_0xfb49('0x27')],'resourceId':_0x2eabb9['id'],'type':_0x263b21[_0xfb49('0x27')],'sectionId':_0x263b21['id']},{})[_0xfb49('0x21')](function(){return _0x2da3d0;});}else{return _0x2da3d0;}})[_0xfb49('0x46')](function(_0x186109){logger[_0xfb49('0x25')](_0xfb49('0x4e'),_0x186109);throw _0x186109;});}return _0x2da3d0;})[_0xfb49('0x21')](respondWithResult(_0x2a21af,0xc9))[_0xfb49('0x46')](handleError(_0x2a21af,null));};exports[_0xfb49('0x20')]=function(_0x49d81e,_0x3af9be){if(_0x49d81e[_0xfb49('0x48')]['id']){delete _0x49d81e[_0xfb49('0x48')]['id'];}return db[_0xfb49('0x2a')][_0xfb49('0x45')]({'where':{'id':_0x49d81e[_0xfb49('0x40')]['id']}})[_0xfb49('0x21')](handleEntityNotFound(_0x3af9be,null))['then'](saveUpdates(_0x49d81e[_0xfb49('0x48')],null))[_0xfb49('0x21')](respondWithResult(_0x3af9be,null))['catch'](handleError(_0x3af9be,null));};exports[_0xfb49('0x22')]=function(_0x4cd477,_0x201209){return db[_0xfb49('0x2a')][_0xfb49('0x45')]({'where':{'id':_0x4cd477[_0xfb49('0x40')]['id']}})[_0xfb49('0x21')](handleEntityNotFound(_0x201209,null))[_0xfb49('0x21')](removeEntity(_0x201209,null))[_0xfb49('0x46')](handleError(_0x201209,null));}; \ No newline at end of file +var _0x3a2b=['VIRTUAL','include','findAll','rows','catch','params','length','includeAll','options','create','body','user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','crypto','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','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','then','get','Metrics','destroy','stack','name','index','AnalyticMetric','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x479509,_0x1daf8a){var _0x382da8=function(_0x39d77c){while(--_0x39d77c){_0x479509['push'](_0x479509['shift']());}};_0x382da8(++_0x1daf8a);}(_0x3a2b,0x157));var _0xb3a2=function(_0x1f5ac4,_0x141af9){_0x1f5ac4=_0x1f5ac4-0x0;var _0x34da42=_0x3a2b[_0x1f5ac4];return _0x34da42;};'use strict';var pdf=require(_0xb3a2('0x0'));var emlformat=require(_0xb3a2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb3a2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb3a2('0x3'));var moment=require(_0xb3a2('0x4'));var BPromise=require(_0xb3a2('0x5'));var Mustache=require(_0xb3a2('0x6'));var util=require('util');var path=require(_0xb3a2('0x7'));var sox=require(_0xb3a2('0x8'));var csv=require('to-csv');var ejs=require(_0xb3a2('0x9'));var fs=require('fs');var _=require(_0xb3a2('0xa'));var squel=require('squel');var crypto=require(_0xb3a2('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb3a2('0xc'));var toCsv=require(_0xb3a2('0xd'));var querystring=require(_0xb3a2('0xe'));var Papa=require(_0xb3a2('0xf'));var Redis=require(_0xb3a2('0x10'));var authService=require(_0xb3a2('0x11'));var qs=require(_0xb3a2('0x12'));var as=require(_0xb3a2('0x13'));var hardwareService=require(_0xb3a2('0x14'));var logger=require(_0xb3a2('0x15'))('api');var utils=require(_0xb3a2('0x16'));var config=require(_0xb3a2('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52cd32,_0x624fd9){_0x624fd9=_0x624fd9||0xcc;return function(_0x34f19d){if(_0x34f19d){return _0x52cd32[_0xb3a2('0x18')](_0x624fd9);}return _0x52cd32[_0xb3a2('0x19')](_0x624fd9)[_0xb3a2('0x1a')]();};}function respondWithResult(_0x3b1f5c,_0x398ee1){_0x398ee1=_0x398ee1||0xc8;return function(_0x1ea872){if(_0x1ea872){return _0x3b1f5c['status'](_0x398ee1)[_0xb3a2('0x1b')](_0x1ea872);}};}function respondWithFilteredResult(_0x26c1a7,_0x52fa0a){return function(_0x29ecf5){if(_0x29ecf5){var _0x3ae864=_0x29ecf5[_0xb3a2('0x1c')],_0x5ce7df=_0x52fa0a[_0xb3a2('0x1d')],_0x255d8b=_0x52fa0a[_0xb3a2('0x1d')]+_0x52fa0a[_0xb3a2('0x1e')],_0x456127;if(_0x255d8b>=_0x3ae864){_0x255d8b=_0x3ae864;_0x456127=0xc8;}else{_0x456127=0xce;}_0x26c1a7[_0xb3a2('0x19')](_0x456127);return _0x26c1a7[_0xb3a2('0x1f')](_0xb3a2('0x20'),_0x5ce7df+'-'+_0x255d8b+'/'+_0x3ae864)['json'](_0x29ecf5);}return null;};}function patchUpdates(_0x26bee7){return function(_0x583b93){try{jsonpatch['apply'](_0x583b93,_0x26bee7,!![]);}catch(_0x1f537f){return BPromise['reject'](_0x1f537f);}return _0x583b93[_0xb3a2('0x21')]();};}function saveUpdates(_0x4c6cec,_0x4db4fd){return function(_0x5a93fa){if(_0x5a93fa){return _0x5a93fa['update'](_0x4c6cec)[_0xb3a2('0x22')](function(_0x7e1261){return _0x7e1261;});}return null;};}function removeEntity(_0x3c6335,_0x569783){return function(_0x3dcc59){if(_0x3dcc59){return _0x3dcc59['destroy']()['then'](function(){var _0x3fa1c0=_0x3dcc59[_0xb3a2('0x23')]({'plain':!![]});var _0x43e7d3=_0xb3a2('0x24');return db['UserProfileResource'][_0xb3a2('0x25')]({'where':{'type':_0x43e7d3,'resourceId':_0x3fa1c0['id']}})[_0xb3a2('0x22')](function(){return _0x3dcc59;});})[_0xb3a2('0x22')](function(){_0x3c6335[_0xb3a2('0x19')](0xcc)[_0xb3a2('0x1a')]();});}};}function handleEntityNotFound(_0x118ffa,_0x11ba3b){return function(_0xfd67b9){if(!_0xfd67b9){_0x118ffa[_0xb3a2('0x18')](0x194);}return _0xfd67b9;};}function handleError(_0x46ae8b,_0x21c1f6){_0x21c1f6=_0x21c1f6||0x1f4;return function(_0x2c23c0){logger['error'](_0x2c23c0[_0xb3a2('0x26')]);if(_0x2c23c0['name']){delete _0x2c23c0[_0xb3a2('0x27')];}_0x46ae8b['status'](_0x21c1f6)['send'](_0x2c23c0);};}exports[_0xb3a2('0x28')]=function(_0x9458ed,_0x3589d5){var _0x1c4311={},_0x2249fd={},_0x3c8306={'count':0x0,'rows':[]};var _0x5cc95a=_['map'](db[_0xb3a2('0x29')][_0xb3a2('0x2a')],function(_0x585010){return{'name':_0x585010[_0xb3a2('0x2b')],'type':_0x585010[_0xb3a2('0x2c')][_0xb3a2('0x2d')]};});_0x2249fd['model']=_[_0xb3a2('0x2e')](_0x5cc95a,'name');_0x2249fd[_0xb3a2('0x2f')]=_[_0xb3a2('0x30')](_0x9458ed[_0xb3a2('0x2f')]);_0x2249fd[_0xb3a2('0x31')]=_['intersection'](_0x2249fd[_0xb3a2('0x32')],_0x2249fd[_0xb3a2('0x2f')]);_0x1c4311[_0xb3a2('0x33')]=_[_0xb3a2('0x34')](_0x2249fd['model'],qs[_0xb3a2('0x35')](_0x9458ed[_0xb3a2('0x2f')]['fields']));_0x1c4311['attributes']=_0x1c4311[_0xb3a2('0x33')]['length']?_0x1c4311[_0xb3a2('0x33')]:_0x2249fd[_0xb3a2('0x32')];if(!_0x9458ed['query'][_0xb3a2('0x36')](_0xb3a2('0x37'))){_0x1c4311['limit']=qs['limit'](_0x9458ed[_0xb3a2('0x2f')][_0xb3a2('0x1e')]);_0x1c4311[_0xb3a2('0x1d')]=qs[_0xb3a2('0x1d')](_0x9458ed[_0xb3a2('0x2f')][_0xb3a2('0x1d')]);}_0x1c4311[_0xb3a2('0x38')]=qs[_0xb3a2('0x39')](_0x9458ed[_0xb3a2('0x2f')][_0xb3a2('0x39')]);_0x1c4311[_0xb3a2('0x3a')]=qs[_0xb3a2('0x31')](_[_0xb3a2('0x3b')](_0x9458ed[_0xb3a2('0x2f')],_0x2249fd[_0xb3a2('0x31')]));if(_0x9458ed[_0xb3a2('0x2f')][_0xb3a2('0x3c')]){_0x1c4311['where']=_[_0xb3a2('0x3d')](_0x1c4311['where'],{'$or':_[_0xb3a2('0x2e')](_0x5cc95a,function(_0x55575c){if(_0x55575c[_0xb3a2('0x2c')]!==_0xb3a2('0x3e')){var _0x240ef3={};_0x240ef3[_0x55575c['name']]={'$like':'%'+_0x9458ed[_0xb3a2('0x2f')][_0xb3a2('0x3c')]+'%'};return _0x240ef3;}})});}_0x1c4311=_[_0xb3a2('0x3d')]({},_0x1c4311,_0x9458ed['options']);var _0xe7259={'where':_0x1c4311[_0xb3a2('0x3a')]};return db['AnalyticMetric'][_0xb3a2('0x1c')](_0xe7259)['then'](function(_0x34707c){_0x3c8306[_0xb3a2('0x1c')]=_0x34707c;if(_0x9458ed[_0xb3a2('0x2f')]['includeAll']){_0x1c4311[_0xb3a2('0x3f')]=[{'all':!![]}];}return db[_0xb3a2('0x29')][_0xb3a2('0x40')](_0x1c4311);})['then'](function(_0x3d279c){_0x3c8306[_0xb3a2('0x41')]=_0x3d279c;return _0x3c8306;})['then'](respondWithFilteredResult(_0x3589d5,_0x1c4311))[_0xb3a2('0x42')](handleError(_0x3589d5,null));};exports['show']=function(_0x5c42e9,_0xf78d7a){var _0xf45a6e={'raw':!![],'where':{'id':_0x5c42e9[_0xb3a2('0x43')]['id']}},_0x20cd8a={};_0x20cd8a[_0xb3a2('0x32')]=_[_0xb3a2('0x30')](db[_0xb3a2('0x29')][_0xb3a2('0x2a')]);_0x20cd8a[_0xb3a2('0x2f')]=_[_0xb3a2('0x30')](_0x5c42e9['query']);_0x20cd8a['filters']=_[_0xb3a2('0x34')](_0x20cd8a[_0xb3a2('0x32')],_0x20cd8a[_0xb3a2('0x2f')]);_0xf45a6e['attributes']=_[_0xb3a2('0x34')](_0x20cd8a[_0xb3a2('0x32')],qs['fields'](_0x5c42e9[_0xb3a2('0x2f')][_0xb3a2('0x35')]));_0xf45a6e[_0xb3a2('0x33')]=_0xf45a6e[_0xb3a2('0x33')][_0xb3a2('0x44')]?_0xf45a6e[_0xb3a2('0x33')]:_0x20cd8a[_0xb3a2('0x32')];if(_0x5c42e9[_0xb3a2('0x2f')][_0xb3a2('0x45')]){_0xf45a6e[_0xb3a2('0x3f')]=[{'all':!![]}];}_0xf45a6e=_[_0xb3a2('0x3d')]({},_0xf45a6e,_0x5c42e9[_0xb3a2('0x46')]);return db[_0xb3a2('0x29')]['find'](_0xf45a6e)[_0xb3a2('0x22')](handleEntityNotFound(_0xf78d7a,null))[_0xb3a2('0x22')](respondWithResult(_0xf78d7a,null))[_0xb3a2('0x42')](handleError(_0xf78d7a,null));};exports['create']=function(_0x3a3c77,_0x26f30b){return db[_0xb3a2('0x29')][_0xb3a2('0x47')](_0x3a3c77[_0xb3a2('0x48')],{})[_0xb3a2('0x22')](function(_0x8a2e9){var _0x52d085=_0x3a3c77[_0xb3a2('0x49')][_0xb3a2('0x23')]({'plain':!![]});if(!_0x52d085)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x52d085[_0xb3a2('0x4a')]===_0xb3a2('0x49')){var _0x9055a1=_0x8a2e9[_0xb3a2('0x23')]({'plain':!![]});var _0x2d4162=_0xb3a2('0x24');return db['UserProfileSection']['find']({'where':{'name':_0x2d4162,'userProfileId':_0x52d085[_0xb3a2('0x4b')]},'raw':!![]})[_0xb3a2('0x22')](function(_0x2f0431){if(_0x2f0431&&_0x2f0431[_0xb3a2('0x4c')]===0x0){return db[_0xb3a2('0x4d')][_0xb3a2('0x47')]({'name':_0x9055a1['name'],'resourceId':_0x9055a1['id'],'type':_0x2f0431[_0xb3a2('0x27')],'sectionId':_0x2f0431['id']},{})[_0xb3a2('0x22')](function(){return _0x8a2e9;});}else{return _0x8a2e9;}})[_0xb3a2('0x42')](function(_0x30bd05){logger['error'](_0xb3a2('0x4e'),_0x30bd05);throw _0x30bd05;});}return _0x8a2e9;})[_0xb3a2('0x22')](respondWithResult(_0x26f30b,0xc9))[_0xb3a2('0x42')](handleError(_0x26f30b,null));};exports[_0xb3a2('0x4f')]=function(_0x14867b,_0x6305fc){if(_0x14867b[_0xb3a2('0x48')]['id']){delete _0x14867b[_0xb3a2('0x48')]['id'];}return db['AnalyticMetric'][_0xb3a2('0x50')]({'where':{'id':_0x14867b['params']['id']}})[_0xb3a2('0x22')](handleEntityNotFound(_0x6305fc,null))[_0xb3a2('0x22')](saveUpdates(_0x14867b[_0xb3a2('0x48')],null))[_0xb3a2('0x22')](respondWithResult(_0x6305fc,null))[_0xb3a2('0x42')](handleError(_0x6305fc,null));};exports['destroy']=function(_0x5026b5,_0x8d2094){return db['AnalyticMetric'][_0xb3a2('0x50')]({'where':{'id':_0x5026b5[_0xb3a2('0x43')]['id']}})['then'](handleEntityNotFound(_0x8d2094,null))[_0xb3a2('0x22')](removeEntity(_0x8d2094,null))[_0xb3a2('0x42')](handleError(_0x8d2094,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 772e82d..b051e97 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 _0xa4ff=['exports','define','AnalyticMetric','lodash','../../config/logger','bluebird','request-promise','../../config/environment','./analyticMetric.attributes'];(function(_0x80bed5,_0x49f0d0){var _0x12e325=function(_0x6937e3){while(--_0x6937e3){_0x80bed5['push'](_0x80bed5['shift']());}};_0x12e325(++_0x49f0d0);}(_0xa4ff,0xa5));var _0xfa4f=function(_0x11a0a0,_0x4e8dcb){_0x11a0a0=_0x11a0a0-0x0;var _0x57d04f=_0xa4ff[_0x11a0a0];return _0x57d04f;};'use strict';var _=require(_0xfa4f('0x0'));var util=require('util');var logger=require(_0xfa4f('0x1'))('api');var moment=require('moment');var BPromise=require(_0xfa4f('0x2'));var rp=require(_0xfa4f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfa4f('0x4'));var attributes=require(_0xfa4f('0x5'));module[_0xfa4f('0x6')]=function(_0x2b10d4,_0x23d930){return _0x2b10d4[_0xfa4f('0x7')](_0xfa4f('0x8'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x680f=['lodash','../../config/logger','moment','bluebird','request-promise','AnalyticMetric','analytics_metrics'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x680f,0xaf));var _0xf680=function(_0xb5adad,_0x2e59a2){_0xb5adad=_0xb5adad-0x0;var _0x3558b4=_0x680f[_0xb5adad];return _0x3558b4;};'use strict';var _=require(_0xf680('0x0'));var util=require('util');var logger=require(_0xf680('0x1'))('api');var moment=require(_0xf680('0x2'));var BPromise=require(_0xf680('0x3'));var rp=require(_0xf680('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./analyticMetric.attributes');module['exports']=function(_0x1d0bb1,_0x359ce0){return _0x1d0bb1['define'](_0xf680('0x5'),attributes,{'tableName':_0xf680('0x6'),'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 fc9a4d9..0a4cc04 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 _0x6904=['AnalyticMetric,\x20%s,\x20%s','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info'];(function(_0x44b3f6,_0x2f0b79){var _0x4a6207=function(_0x5835fb){while(--_0x5835fb){_0x44b3f6['push'](_0x44b3f6['shift']());}};_0x4a6207(++_0x2f0b79);}(_0x6904,0x15d));var _0x4690=function(_0x2f71f6,_0x3a1f4d){_0x2f71f6=_0x2f71f6-0x0;var _0x2b23ea=_0x6904[_0x2f71f6];return _0x2b23ea;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4690('0x0'));var BPromise=require(_0x4690('0x1'));var rs=require(_0x4690('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4690('0x3'))['db'];var utils=require(_0x4690('0x4'));var logger=require(_0x4690('0x5'))('rpc');var config=require(_0x4690('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4690('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x28eea2,_0x3ef5e8,_0x4be107){return new BPromise(function(_0x47c234,_0x564fe5){return client[_0x4690('0x8')](_0x28eea2,_0x4be107)[_0x4690('0x9')](function(_0x21bf06){logger[_0x4690('0xa')](_0x4690('0xb'),_0x3ef5e8,'request\x20sent');logger[_0x4690('0xc')](_0x4690('0xd'),_0x3ef5e8,_0x4690('0xe'),JSON[_0x4690('0xf')](_0x21bf06));if(_0x21bf06[_0x4690('0x10')]){if(_0x21bf06[_0x4690('0x10')][_0x4690('0x11')]===0x1f4){logger[_0x4690('0x10')](_0x4690('0xb'),_0x3ef5e8,_0x21bf06['error'][_0x4690('0x12')]);return _0x564fe5(_0x21bf06['error'][_0x4690('0x12')]);}logger[_0x4690('0x10')](_0x4690('0xb'),_0x3ef5e8,_0x21bf06['error'][_0x4690('0x12')]);return _0x47c234(_0x21bf06['error'][_0x4690('0x12')]);}else{logger['info'](_0x4690('0xb'),_0x3ef5e8,_0x4690('0xe'));_0x47c234(_0x21bf06['result'][_0x4690('0x12')]);}})[_0x4690('0x13')](function(_0x3e5d69){logger[_0x4690('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x3ef5e8,_0x3e5d69);_0x564fe5(_0x3e5d69);});});} \ No newline at end of file +var _0xcff0=['error','code','AnalyticMetric,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x154ba2,_0x3696d5){var _0x5ef18b=function(_0x2a3214){while(--_0x2a3214){_0x154ba2['push'](_0x154ba2['shift']());}};_0x5ef18b(++_0x3696d5);}(_0xcff0,0x1be));var _0x0cff=function(_0x33dcdb,_0xeb82ad){_0x33dcdb=_0x33dcdb-0x0;var _0x409cc7=_0xcff0[_0x33dcdb];return _0x409cc7;};'use strict';var _=require(_0x0cff('0x0'));var util=require(_0x0cff('0x1'));var moment=require(_0x0cff('0x2'));var BPromise=require(_0x0cff('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0cff('0x4'));var db=require(_0x0cff('0x5'))['db'];var utils=require(_0x0cff('0x6'));var logger=require(_0x0cff('0x7'))(_0x0cff('0x8'));var config=require(_0x0cff('0x9'));var jayson=require(_0x0cff('0xa'));var client=jayson['client'][_0x0cff('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f99ab,_0x2e6590,_0x484ae4){return new BPromise(function(_0x5963fe,_0x39a10b){return client[_0x0cff('0xc')](_0x1f99ab,_0x484ae4)['then'](function(_0x22867a){logger[_0x0cff('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x2e6590,'request\x20sent');logger['debug'](_0x0cff('0xe'),_0x2e6590,_0x0cff('0xf'),JSON['stringify'](_0x22867a));if(_0x22867a[_0x0cff('0x10')]){if(_0x22867a[_0x0cff('0x10')][_0x0cff('0x11')]===0x1f4){logger[_0x0cff('0x10')](_0x0cff('0x12'),_0x2e6590,_0x22867a[_0x0cff('0x10')]['message']);return _0x39a10b(_0x22867a[_0x0cff('0x10')][_0x0cff('0x13')]);}logger[_0x0cff('0x10')](_0x0cff('0x12'),_0x2e6590,_0x22867a[_0x0cff('0x10')]['message']);return _0x5963fe(_0x22867a[_0x0cff('0x10')]['message']);}else{logger[_0x0cff('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x2e6590,'request\x20sent');_0x5963fe(_0x22867a[_0x0cff('0x14')][_0x0cff('0x13')]);}})[_0x0cff('0x15')](function(_0x3e23ba){logger[_0x0cff('0x10')](_0x0cff('0x12'),_0x2e6590,_0x3e23ba);_0x39a10b(_0x3e23ba);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 9bdab8a..f558022 100644 --- a/server/api/analyticMetric/index.js +++ b/server/api/analyticMetric/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1967=['get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller'];(function(_0x565c79,_0x13391b){var _0x492b07=function(_0x1398bc){while(--_0x1398bc){_0x565c79['push'](_0x565c79['shift']());}};_0x492b07(++_0x13391b);}(_0x1967,0x173));var _0x7196=function(_0x33c69b,_0x39d9f2){_0x33c69b=_0x33c69b-0x0;var _0x1794de=_0x1967[_0x33c69b];return _0x1794de;};'use strict';var multer=require('multer');var util=require(_0x7196('0x0'));var path=require(_0x7196('0x1'));var timeout=require(_0x7196('0x2'));var express=require(_0x7196('0x3'));var router=express[_0x7196('0x4')]();var auth=require(_0x7196('0x5'));var interaction=require(_0x7196('0x6'));var config=require(_0x7196('0x7'));var controller=require(_0x7196('0x8'));router[_0x7196('0x9')]('/',auth['isAuthenticated'](),controller[_0x7196('0xa')]);router[_0x7196('0x9')](_0x7196('0xb'),auth[_0x7196('0xc')](),controller[_0x7196('0xd')]);router[_0x7196('0xe')]('/',auth['isAuthenticated'](),controller[_0x7196('0xf')]);router[_0x7196('0x10')](_0x7196('0xb'),auth[_0x7196('0xc')](),controller[_0x7196('0x11')]);router['delete']('/:id',auth[_0x7196('0xc')](),controller[_0x7196('0x12')]);module[_0x7196('0x13')]=router; \ No newline at end of file +var _0x7880=['Router','../../components/auth/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','util','path','connect-timeout','express'];(function(_0x4b935a,_0x327ee3){var _0xa298f0=function(_0x3e07c2){while(--_0x3e07c2){_0x4b935a['push'](_0x4b935a['shift']());}};_0xa298f0(++_0x327ee3);}(_0x7880,0x1f4));var _0x0788=function(_0x577f71,_0x3a8951){_0x577f71=_0x577f71-0x0;var _0xfec7c2=_0x7880[_0x577f71];return _0xfec7c2;};'use strict';var multer=require('multer');var util=require(_0x0788('0x0'));var path=require(_0x0788('0x1'));var timeout=require(_0x0788('0x2'));var express=require(_0x0788('0x3'));var router=express[_0x0788('0x4')]();var auth=require(_0x0788('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0788('0x6'));var controller=require(_0x0788('0x7'));router[_0x0788('0x8')]('/',auth[_0x0788('0x9')](),controller[_0x0788('0xa')]);router[_0x0788('0x8')](_0x0788('0xb'),auth[_0x0788('0x9')](),controller[_0x0788('0xc')]);router[_0x0788('0xd')]('/',auth['isAuthenticated'](),controller[_0x0788('0xe')]);router['put'](_0x0788('0xb'),auth['isAuthenticated'](),controller[_0x0788('0xf')]);router[_0x0788('0x10')](_0x0788('0xb'),auth[_0x0788('0x9')](),controller[_0x0788('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 4f4213f..38e2a35 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 _0x5fcf=['TEXT','sequelize'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x5fcf,0x1d1));var _0xf5fc=function(_0x2e47b8,_0x4d86c0){_0x2e47b8=_0x2e47b8-0x0;var _0xf66803=_0x5fcf[_0x2e47b8];return _0xf66803;};'use strict';var Sequelize=require(_0xf5fc('0x0'));module['exports']={'tree':{'type':Sequelize[_0xf5fc('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xdf55=['sequelize','exports','TEXT'];(function(_0x30a208,_0x1e2d6d){var _0x5f2755=function(_0x468f0c){while(--_0x468f0c){_0x30a208['push'](_0x30a208['shift']());}};_0x5f2755(++_0x1e2d6d);}(_0xdf55,0x153));var _0x5df5=function(_0xc66c50,_0x4dfbc1){_0xc66c50=_0xc66c50-0x0;var _0x48bc6f=_0xdf55[_0xc66c50];return _0x48bc6f;};'use strict';var Sequelize=require(_0x5df5('0x0'));module[_0x5df5('0x1')]={'tree':{'type':Sequelize[_0x5df5('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 62fe947..81fb421 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 _0xb10b=['where','merge','AnalyticTreeReport','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(_0x5201c9,_0xea0b21){var _0x3de224=function(_0x18bd6e){while(--_0x18bd6e){_0x5201c9['push'](_0x5201c9['shift']());}};_0x3de224(++_0xea0b21);}(_0xb10b,0x12a));var _0xbb10=function(_0x132b71,_0x25f23e){_0x132b71=_0x132b71-0x0;var _0x224664=_0xb10b[_0x132b71];return _0x224664;};'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['AnalyticTreeReport'][_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')]));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 _0x36ee=['nolimit','order','sort','pick','where','merge','type','filter','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','AnalyticTreeReport','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty'];(function(_0x481d24,_0x3e348d){var _0x48872c=function(_0x1ca2cb){while(--_0x1ca2cb){_0x481d24['push'](_0x481d24['shift']());}};_0x48872c(++_0x3e348d);}(_0x36ee,0xe8));var _0xe36e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x36ee[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe36e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe36e('0x1'));var rp=require(_0xe36e('0x2'));var moment=require(_0xe36e('0x3'));var BPromise=require(_0xe36e('0x4'));var Mustache=require(_0xe36e('0x5'));var util=require(_0xe36e('0x6'));var path=require(_0xe36e('0x7'));var sox=require(_0xe36e('0x8'));var csv=require(_0xe36e('0x9'));var ejs=require(_0xe36e('0xa'));var fs=require('fs');var _=require(_0xe36e('0xb'));var squel=require(_0xe36e('0xc'));var crypto=require('crypto');var jsforce=require(_0xe36e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe36e('0x9'));var querystring=require(_0xe36e('0xe'));var Papa=require(_0xe36e('0xf'));var Redis=require('ioredis');var authService=require(_0xe36e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe36e('0x11'));var hardwareService=require(_0xe36e('0x12'));var logger=require(_0xe36e('0x13'))(_0xe36e('0x14'));var utils=require(_0xe36e('0x15'));var config=require(_0xe36e('0x16'));var db=require(_0xe36e('0x17'))['db'];function respondWithStatusCode(_0x265473,_0x4fbdb2){_0x4fbdb2=_0x4fbdb2||0xcc;return function(_0x32981d){if(_0x32981d){return _0x265473[_0xe36e('0x18')](_0x4fbdb2);}return _0x265473[_0xe36e('0x19')](_0x4fbdb2)[_0xe36e('0x1a')]();};}function respondWithResult(_0x5c3f3c,_0x3e264a){_0x3e264a=_0x3e264a||0xc8;return function(_0x521afa){if(_0x521afa){return _0x5c3f3c['status'](_0x3e264a)[_0xe36e('0x1b')](_0x521afa);}};}function respondWithFilteredResult(_0x300f21,_0x26fb37){return function(_0x278135){if(_0x278135){var _0xd6828e=_0x278135[_0xe36e('0x1c')],_0x924cd5=_0x26fb37[_0xe36e('0x1d')],_0x2096f6=_0x26fb37['offset']+_0x26fb37[_0xe36e('0x1e')],_0x39bae8;if(_0x2096f6>=_0xd6828e){_0x2096f6=_0xd6828e;_0x39bae8=0xc8;}else{_0x39bae8=0xce;}_0x300f21[_0xe36e('0x19')](_0x39bae8);return _0x300f21['set'](_0xe36e('0x1f'),_0x924cd5+'-'+_0x2096f6+'/'+_0xd6828e)['json'](_0x278135);}return null;};}function patchUpdates(_0x471400){return function(_0x303784){try{jsonpatch['apply'](_0x303784,_0x471400,!![]);}catch(_0x472825){return BPromise[_0xe36e('0x20')](_0x472825);}return _0x303784[_0xe36e('0x21')]();};}function saveUpdates(_0x597331,_0x21e95e){return function(_0x21bcf9){if(_0x21bcf9){return _0x21bcf9[_0xe36e('0x22')](_0x597331)[_0xe36e('0x23')](function(_0x2c4e30){return _0x2c4e30;});}return null;};}function removeEntity(_0x360b95,_0x4f438a){return function(_0xd71137){if(_0xd71137){return _0xd71137[_0xe36e('0x24')]()[_0xe36e('0x23')](function(){_0x360b95[_0xe36e('0x19')](0xcc)[_0xe36e('0x1a')]();});}};}function handleEntityNotFound(_0x53e13a,_0x598a7a){return function(_0x4749a8){if(!_0x4749a8){_0x53e13a[_0xe36e('0x18')](0x194);}return _0x4749a8;};}function handleError(_0xb0cd85,_0xb32195){_0xb32195=_0xb32195||0x1f4;return function(_0x31c12c){logger[_0xe36e('0x25')](_0x31c12c[_0xe36e('0x26')]);if(_0x31c12c['name']){delete _0x31c12c[_0xe36e('0x27')];}_0xb0cd85[_0xe36e('0x19')](_0xb32195)[_0xe36e('0x28')](_0x31c12c);};}exports[_0xe36e('0x29')]=function(_0x5e58d8,_0x2d757c){var _0x5a3133={},_0xf7b02e={},_0x5993de={'count':0x0,'rows':[]};var _0x19f001=_['map'](db[_0xe36e('0x2a')]['rawAttributes'],function(_0x3b1045){return{'name':_0x3b1045['fieldName'],'type':_0x3b1045['type']['key']};});_0xf7b02e['model']=_[_0xe36e('0x2b')](_0x19f001,_0xe36e('0x27'));_0xf7b02e['query']=_['keys'](_0x5e58d8[_0xe36e('0x2c')]);_0xf7b02e[_0xe36e('0x2d')]=_[_0xe36e('0x2e')](_0xf7b02e[_0xe36e('0x2f')],_0xf7b02e[_0xe36e('0x2c')]);_0x5a3133[_0xe36e('0x30')]=_['intersection'](_0xf7b02e[_0xe36e('0x2f')],qs[_0xe36e('0x31')](_0x5e58d8['query'][_0xe36e('0x31')]));_0x5a3133[_0xe36e('0x30')]=_0x5a3133[_0xe36e('0x30')][_0xe36e('0x32')]?_0x5a3133[_0xe36e('0x30')]:_0xf7b02e[_0xe36e('0x2f')];if(!_0x5e58d8[_0xe36e('0x2c')][_0xe36e('0x33')](_0xe36e('0x34'))){_0x5a3133[_0xe36e('0x1e')]=qs[_0xe36e('0x1e')](_0x5e58d8['query'][_0xe36e('0x1e')]);_0x5a3133['offset']=qs['offset'](_0x5e58d8[_0xe36e('0x2c')]['offset']);}_0x5a3133[_0xe36e('0x35')]=qs[_0xe36e('0x36')](_0x5e58d8[_0xe36e('0x2c')][_0xe36e('0x36')]);_0x5a3133['where']=qs['filters'](_[_0xe36e('0x37')](_0x5e58d8[_0xe36e('0x2c')],_0xf7b02e[_0xe36e('0x2d')]));if(_0x5e58d8[_0xe36e('0x2c')]['filter']){_0x5a3133[_0xe36e('0x38')]=_[_0xe36e('0x39')](_0x5a3133[_0xe36e('0x38')],{'$or':_['map'](_0x19f001,function(_0x2c58d1){if(_0x2c58d1[_0xe36e('0x3a')]!=='VIRTUAL'){var _0x40cbe5={};_0x40cbe5[_0x2c58d1[_0xe36e('0x27')]]={'$like':'%'+_0x5e58d8[_0xe36e('0x2c')][_0xe36e('0x3b')]+'%'};return _0x40cbe5;}})});}_0x5a3133=_[_0xe36e('0x39')]({},_0x5a3133,_0x5e58d8[_0xe36e('0x3c')]);var _0x130edb={'where':_0x5a3133[_0xe36e('0x38')]};return db[_0xe36e('0x2a')][_0xe36e('0x1c')](_0x130edb)[_0xe36e('0x23')](function(_0x39dd9b){_0x5993de[_0xe36e('0x1c')]=_0x39dd9b;if(_0x5e58d8['query'][_0xe36e('0x3d')]){_0x5a3133[_0xe36e('0x3e')]=[{'all':!![]}];}return db[_0xe36e('0x2a')][_0xe36e('0x3f')](_0x5a3133);})[_0xe36e('0x23')](function(_0x4d133b){_0x5993de['rows']=_0x4d133b;return _0x5993de;})[_0xe36e('0x23')](respondWithFilteredResult(_0x2d757c,_0x5a3133))[_0xe36e('0x40')](handleError(_0x2d757c,null));};exports[_0xe36e('0x41')]=function(_0x537e1a,_0x27caff){var _0x34a1ba={'raw':!![],'where':{'id':_0x537e1a[_0xe36e('0x42')]['id']}},_0xff4f63={};_0xff4f63['model']=_[_0xe36e('0x43')](db[_0xe36e('0x2a')]['rawAttributes']);_0xff4f63[_0xe36e('0x2c')]=_['keys'](_0x537e1a[_0xe36e('0x2c')]);_0xff4f63[_0xe36e('0x2d')]=_[_0xe36e('0x2e')](_0xff4f63[_0xe36e('0x2f')],_0xff4f63[_0xe36e('0x2c')]);_0x34a1ba['attributes']=_[_0xe36e('0x2e')](_0xff4f63[_0xe36e('0x2f')],qs[_0xe36e('0x31')](_0x537e1a[_0xe36e('0x2c')][_0xe36e('0x31')]));_0x34a1ba[_0xe36e('0x30')]=_0x34a1ba['attributes'][_0xe36e('0x32')]?_0x34a1ba[_0xe36e('0x30')]:_0xff4f63[_0xe36e('0x2f')];if(_0x537e1a[_0xe36e('0x2c')][_0xe36e('0x3d')]){_0x34a1ba['include']=[{'all':!![]}];}_0x34a1ba=_[_0xe36e('0x39')]({},_0x34a1ba,_0x537e1a[_0xe36e('0x3c')]);return db[_0xe36e('0x2a')][_0xe36e('0x44')](_0x34a1ba)[_0xe36e('0x23')](handleEntityNotFound(_0x27caff,null))[_0xe36e('0x23')](respondWithResult(_0x27caff,null))[_0xe36e('0x40')](handleError(_0x27caff,null));};exports[_0xe36e('0x45')]=function(_0x43c2d4,_0x52e744){return db['AnalyticTreeReport'][_0xe36e('0x45')](_0x43c2d4['body'],{})[_0xe36e('0x23')](respondWithResult(_0x52e744,0xc9))[_0xe36e('0x40')](handleError(_0x52e744,null));};exports[_0xe36e('0x22')]=function(_0x25aa09,_0x51641c){if(_0x25aa09[_0xe36e('0x46')]['id']){delete _0x25aa09[_0xe36e('0x46')]['id'];}return db['AnalyticTreeReport'][_0xe36e('0x44')]({'where':{'id':_0x25aa09[_0xe36e('0x42')]['id']}})[_0xe36e('0x23')](handleEntityNotFound(_0x51641c,null))[_0xe36e('0x23')](saveUpdates(_0x25aa09[_0xe36e('0x46')],null))[_0xe36e('0x23')](respondWithResult(_0x51641c,null))[_0xe36e('0x40')](handleError(_0x51641c,null));};exports[_0xe36e('0x24')]=function(_0x17555e,_0x3a99aa){return db[_0xe36e('0x2a')][_0xe36e('0x44')]({'where':{'id':_0x17555e[_0xe36e('0x42')]['id']}})[_0xe36e('0x23')](handleEntityNotFound(_0x3a99aa,null))[_0xe36e('0x23')](removeEntity(_0x3a99aa,null))['catch'](handleError(_0x3a99aa,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 90ce45c..1cae187 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 _0x3d2f=['exports','define','AnalyticTreeReport','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4a0fe7,_0xbbee84){var _0xc0734b=function(_0x1af95a){while(--_0x1af95a){_0x4a0fe7['push'](_0x4a0fe7['shift']());}};_0xc0734b(++_0xbbee84);}(_0x3d2f,0x18f));var _0xf3d2=function(_0x455a49,_0x441ef7){_0x455a49=_0x455a49-0x0;var _0x2c1e7a=_0x3d2f[_0x455a49];return _0x2c1e7a;};'use strict';var _=require(_0xf3d2('0x0'));var util=require(_0xf3d2('0x1'));var logger=require('../../config/logger')(_0xf3d2('0x2'));var moment=require(_0xf3d2('0x3'));var BPromise=require(_0xf3d2('0x4'));var rp=require(_0xf3d2('0x5'));var fs=require('fs');var path=require(_0xf3d2('0x6'));var rimraf=require(_0xf3d2('0x7'));var config=require(_0xf3d2('0x8'));var attributes=require('./analyticTreeReport.attributes');module[_0xf3d2('0x9')]=function(_0xcd029e,_0x1a1317){return _0xcd029e[_0xf3d2('0xa')](_0xf3d2('0xb'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7382=['AnalyticTreeReport','util','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define'];(function(_0x11e8fa,_0x1edbc3){var _0xd1ddde=function(_0x454b37){while(--_0x454b37){_0x11e8fa['push'](_0x11e8fa['shift']());}};_0xd1ddde(++_0x1edbc3);}(_0x7382,0x111));var _0x2738=function(_0x328fc8,_0x7d633a){_0x328fc8=_0x328fc8-0x0;var _0x2ba955=_0x7382[_0x328fc8];return _0x2ba955;};'use strict';var _=require('lodash');var util=require(_0x2738('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2738('0x1'));var rimraf=require(_0x2738('0x2'));var config=require(_0x2738('0x3'));var attributes=require(_0x2738('0x4'));module[_0x2738('0x5')]=function(_0x5bb77c,_0x1958d2){return _0x5bb77c[_0x2738('0x6')](_0x2738('0x7'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 4812120..e143a5e 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 _0x6fc5=['debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent'];(function(_0x100e36,_0x4da225){var _0x1df0c9=function(_0xe4b84f){while(--_0xe4b84f){_0x100e36['push'](_0x100e36['shift']());}};_0x1df0c9(++_0x4da225);}(_0x6fc5,0x14c));var _0x56fc=function(_0x5dd612,_0x2f439a){_0x5dd612=_0x5dd612-0x0;var _0x3ba967=_0x6fc5[_0x5dd612];return _0x3ba967;};'use strict';var _=require(_0x56fc('0x0'));var util=require(_0x56fc('0x1'));var moment=require(_0x56fc('0x2'));var BPromise=require(_0x56fc('0x3'));var rs=require(_0x56fc('0x4'));var fs=require('fs');var Redis=require(_0x56fc('0x5'));var db=require(_0x56fc('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x56fc('0x7'))(_0x56fc('0x8'));var config=require(_0x56fc('0x9'));var jayson=require(_0x56fc('0xa'));var client=jayson[_0x56fc('0xb')][_0x56fc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xb07207,_0x497d06,_0x389924){return new BPromise(function(_0x1134a1,_0xdd43cd){return client[_0x56fc('0xd')](_0xb07207,_0x389924)[_0x56fc('0xe')](function(_0x3df5ea){logger[_0x56fc('0xf')](_0x56fc('0x10'),_0x497d06,_0x56fc('0x11'));logger[_0x56fc('0x12')](_0x56fc('0x13'),_0x497d06,_0x56fc('0x11'),JSON[_0x56fc('0x14')](_0x3df5ea));if(_0x3df5ea['error']){if(_0x3df5ea[_0x56fc('0x15')][_0x56fc('0x16')]===0x1f4){logger['error'](_0x56fc('0x10'),_0x497d06,_0x3df5ea['error'][_0x56fc('0x17')]);return _0xdd43cd(_0x3df5ea[_0x56fc('0x15')]['message']);}logger[_0x56fc('0x15')](_0x56fc('0x10'),_0x497d06,_0x3df5ea[_0x56fc('0x15')][_0x56fc('0x17')]);return _0x1134a1(_0x3df5ea[_0x56fc('0x15')][_0x56fc('0x17')]);}else{logger[_0x56fc('0xf')](_0x56fc('0x10'),_0x497d06,_0x56fc('0x11'));_0x1134a1(_0x3df5ea[_0x56fc('0x18')]['message']);}})['catch'](function(_0x42d0af){logger[_0x56fc('0x15')](_0x56fc('0x10'),_0x497d06,_0x42d0af);_0xdd43cd(_0x42d0af);});});} \ No newline at end of file +var _0xd31d=['../../config/utils','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','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x2e904a,_0x50c221){var _0x153445=function(_0x2d1d1e){while(--_0x2d1d1e){_0x2e904a['push'](_0x2e904a['shift']());}};_0x153445(++_0x50c221);}(_0xd31d,0x84));var _0xdd31=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xd31d[_0x9aada2];return _0x196dff;};'use strict';var _=require(_0xdd31('0x0'));var util=require(_0xdd31('0x1'));var moment=require(_0xdd31('0x2'));var BPromise=require('bluebird');var rs=require(_0xdd31('0x3'));var fs=require('fs');var Redis=require(_0xdd31('0x4'));var db=require(_0xdd31('0x5'))['db'];var utils=require(_0xdd31('0x6'));var logger=require('../../config/logger')(_0xdd31('0x7'));var config=require(_0xdd31('0x8'));var jayson=require(_0xdd31('0x9'));var client=jayson[_0xdd31('0xa')][_0xdd31('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x528b39,_0x156053,_0x34d697){return new BPromise(function(_0x1f3bb9,_0x2e94ff){return client[_0xdd31('0xc')](_0x528b39,_0x34d697)['then'](function(_0x587cf5){logger[_0xdd31('0xd')](_0xdd31('0xe'),_0x156053,_0xdd31('0xf'));logger[_0xdd31('0x10')](_0xdd31('0x11'),_0x156053,_0xdd31('0xf'),JSON[_0xdd31('0x12')](_0x587cf5));if(_0x587cf5[_0xdd31('0x13')]){if(_0x587cf5[_0xdd31('0x13')][_0xdd31('0x14')]===0x1f4){logger[_0xdd31('0x13')](_0xdd31('0xe'),_0x156053,_0x587cf5['error'][_0xdd31('0x15')]);return _0x2e94ff(_0x587cf5[_0xdd31('0x13')][_0xdd31('0x15')]);}logger[_0xdd31('0x13')](_0xdd31('0xe'),_0x156053,_0x587cf5[_0xdd31('0x13')][_0xdd31('0x15')]);return _0x1f3bb9(_0x587cf5['error'][_0xdd31('0x15')]);}else{logger[_0xdd31('0xd')](_0xdd31('0xe'),_0x156053,'request\x20sent');_0x1f3bb9(_0x587cf5[_0xdd31('0x16')][_0xdd31('0x15')]);}})['catch'](function(_0x4a91d1){logger[_0xdd31('0x13')](_0xdd31('0xe'),_0x156053,_0x4a91d1);_0x2e94ff(_0x4a91d1);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 175d574..7c2eab1 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 _0x93d2=['express','Router','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','create','put','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x2c5255,_0x4340c3){var _0x30d0ea=function(_0x131ba1){while(--_0x131ba1){_0x2c5255['push'](_0x2c5255['shift']());}};_0x30d0ea(++_0x4340c3);}(_0x93d2,0x19b));var _0x293d=function(_0x52ab8a,_0xee034b){_0x52ab8a=_0x52ab8a-0x0;var _0x5d6ddc=_0x93d2[_0x52ab8a];return _0x5d6ddc;};'use strict';var multer=require(_0x293d('0x0'));var util=require('util');var path=require(_0x293d('0x1'));var timeout=require(_0x293d('0x2'));var express=require(_0x293d('0x3'));var router=express[_0x293d('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x293d('0x5'));var config=require(_0x293d('0x6'));var controller=require(_0x293d('0x7'));router[_0x293d('0x8')]('/',auth[_0x293d('0x9')](),controller[_0x293d('0xa')]);router[_0x293d('0x8')](_0x293d('0xb'),auth[_0x293d('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x293d('0xc')]);router[_0x293d('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x293d('0xe')]);router[_0x293d('0xf')]('/:id',auth[_0x293d('0x9')](),controller[_0x293d('0x10')]);module[_0x293d('0x11')]=router; \ No newline at end of file +var _0x2aaf=['Router','../../components/auth/service','./analyticTreeReport.controller','get','isAuthenticated','/:id','show','put','update','delete','destroy','multer','util','path','express'];(function(_0x27fad1,_0x1e26c1){var _0x3edb5e=function(_0x131e88){while(--_0x131e88){_0x27fad1['push'](_0x27fad1['shift']());}};_0x3edb5e(++_0x1e26c1);}(_0x2aaf,0xce));var _0xf2aa=function(_0x33ee9c,_0x4b36cd){_0x33ee9c=_0x33ee9c-0x0;var _0x118541=_0x2aaf[_0x33ee9c];return _0x118541;};'use strict';var multer=require(_0xf2aa('0x0'));var util=require(_0xf2aa('0x1'));var path=require(_0xf2aa('0x2'));var timeout=require('connect-timeout');var express=require(_0xf2aa('0x3'));var router=express[_0xf2aa('0x4')]();var auth=require(_0xf2aa('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf2aa('0x6'));router[_0xf2aa('0x7')]('/',auth[_0xf2aa('0x8')](),controller['index']);router['get'](_0xf2aa('0x9'),auth[_0xf2aa('0x8')](),controller[_0xf2aa('0xa')]);router['post']('/',auth[_0xf2aa('0x8')](),controller['create']);router[_0xf2aa('0xb')](_0xf2aa('0x9'),auth['isAuthenticated'](),controller[_0xf2aa('0xc')]);router[_0xf2aa('0xd')](_0xf2aa('0x9'),auth[_0xf2aa('0x8')](),controller[_0xf2aa('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 e56a199..738a774 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 _0x1dcf=['sequelize','exports','STRING'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x1dcf,0x7e));var _0xf1dc=function(_0x30d7dd,_0x278e33){_0x30d7dd=_0x30d7dd-0x0;var _0x3d442a=_0x1dcf[_0x30d7dd];return _0x3d442a;};'use strict';var Sequelize=require(_0xf1dc('0x0'));module[_0xf1dc('0x1')]={'name':{'type':Sequelize[_0xf1dc('0x2')]},'basename':{'type':Sequelize[_0xf1dc('0x2')]},'type':{'type':Sequelize[_0xf1dc('0x2')]}}; \ No newline at end of file +var _0xbcc5=['exports','STRING','sequelize'];(function(_0x19afe9,_0x3072d5){var _0x27644e=function(_0x1f9f80){while(--_0x1f9f80){_0x19afe9['push'](_0x19afe9['shift']());}};_0x27644e(++_0x3072d5);}(_0xbcc5,0x7d));var _0x5bcc=function(_0x19f790,_0x1d65fd){_0x19f790=_0x19f790-0x0;var _0x3f3bc7=_0xbcc5[_0x19f790];return _0x3f3bc7;};'use strict';var Sequelize=require(_0x5bcc('0x0'));module[_0x5bcc('0x1')]={'name':{'type':Sequelize[_0x5bcc('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 1ce7012..56f6970 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 _0xd8ef=['squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','map','Attachment','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','catch','params','length','include','find','clone','get','omit','updatedAt','body','createdAt','file','originalname','basename','filename','mimetype','create','download','findOne','join','root','server/files/attachments/','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','lodash'];(function(_0x4419f4,_0x2f3600){var _0x227861=function(_0x3ce929){while(--_0x3ce929){_0x4419f4['push'](_0x4419f4['shift']());}};_0x227861(++_0x2f3600);}(_0xd8ef,0x1a7));var _0xfd8e=function(_0x555d1a,_0x302602){_0x555d1a=_0x555d1a-0x0;var _0xfabb41=_0xd8ef[_0x555d1a];return _0xfabb41;};'use strict';var pdf=require(_0xfd8e('0x0'));var emlformat=require(_0xfd8e('0x1'));var rimraf=require(_0xfd8e('0x2'));var zipdir=require(_0xfd8e('0x3'));var jsonpatch=require(_0xfd8e('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfd8e('0x5'));var util=require(_0xfd8e('0x6'));var path=require(_0xfd8e('0x7'));var sox=require(_0xfd8e('0x8'));var csv=require(_0xfd8e('0x9'));var ejs=require(_0xfd8e('0xa'));var fs=require('fs');var _=require(_0xfd8e('0xb'));var squel=require(_0xfd8e('0xc'));var crypto=require(_0xfd8e('0xd'));var jsforce=require(_0xfd8e('0xe'));var deskjs=require(_0xfd8e('0xf'));var toCsv=require(_0xfd8e('0x9'));var querystring=require(_0xfd8e('0x10'));var Papa=require('papaparse');var Redis=require(_0xfd8e('0x11'));var authService=require(_0xfd8e('0x12'));var qs=require(_0xfd8e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfd8e('0x14'));var logger=require('../../config/logger')(_0xfd8e('0x15'));var utils=require(_0xfd8e('0x16'));var config=require(_0xfd8e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1916ab,_0x39f630){_0x39f630=_0x39f630||0xcc;return function(_0x4c3f96){if(_0x4c3f96){return _0x1916ab[_0xfd8e('0x18')](_0x39f630);}return _0x1916ab[_0xfd8e('0x19')](_0x39f630)[_0xfd8e('0x1a')]();};}function respondWithResult(_0x3e14fb,_0x447a7a){_0x447a7a=_0x447a7a||0xc8;return function(_0x3fca54){if(_0x3fca54){return _0x3e14fb[_0xfd8e('0x19')](_0x447a7a)[_0xfd8e('0x1b')](_0x3fca54);}};}function respondWithFilteredResult(_0xe46425,_0x213aef){return function(_0x26f38a){if(_0x26f38a){var _0x406c4=_0x26f38a[_0xfd8e('0x1c')],_0x156606=_0x213aef['offset'],_0x1c8a5d=_0x213aef['offset']+_0x213aef[_0xfd8e('0x1d')],_0x1d1728;if(_0x1c8a5d>=_0x406c4){_0x1c8a5d=_0x406c4;_0x1d1728=0xc8;}else{_0x1d1728=0xce;}_0xe46425['status'](_0x1d1728);return _0xe46425[_0xfd8e('0x1e')](_0xfd8e('0x1f'),_0x156606+'-'+_0x1c8a5d+'/'+_0x406c4)[_0xfd8e('0x1b')](_0x26f38a);}return null;};}function patchUpdates(_0x4d3ea8){return function(_0x427ec9){try{jsonpatch[_0xfd8e('0x20')](_0x427ec9,_0x4d3ea8,!![]);}catch(_0x5df91d){return BPromise[_0xfd8e('0x21')](_0x5df91d);}return _0x427ec9[_0xfd8e('0x22')]();};}function saveUpdates(_0x41d315,_0x556f1d){return function(_0x15a34b){if(_0x15a34b){return _0x15a34b[_0xfd8e('0x23')](_0x41d315)['then'](function(_0x3f02d0){return _0x3f02d0;});}return null;};}function removeEntity(_0x141fdd,_0x1326fd){return function(_0x2da0e9){if(_0x2da0e9){return _0x2da0e9[_0xfd8e('0x24')]()[_0xfd8e('0x25')](function(){_0x141fdd[_0xfd8e('0x19')](0xcc)[_0xfd8e('0x1a')]();});}};}function handleEntityNotFound(_0x10b945,_0x2e1059){return function(_0x3dabb9){if(!_0x3dabb9){_0x10b945[_0xfd8e('0x18')](0x194);}return _0x3dabb9;};}function handleError(_0x13dacd,_0x1e78ee){_0x1e78ee=_0x1e78ee||0x1f4;return function(_0x70a828){logger['error'](_0x70a828[_0xfd8e('0x26')]);if(_0x70a828['name']){delete _0x70a828[_0xfd8e('0x27')];}_0x13dacd[_0xfd8e('0x19')](_0x1e78ee)[_0xfd8e('0x28')](_0x70a828);};}exports[_0xfd8e('0x29')]=function(_0x3f79c2,_0x312594){var _0x4d8b52={},_0x58e3be={},_0x469796={'count':0x0,'rows':[]};var _0xd93a34=_[_0xfd8e('0x2a')](db[_0xfd8e('0x2b')][_0xfd8e('0x2c')],function(_0x59ea5d){return{'name':_0x59ea5d['fieldName'],'type':_0x59ea5d[_0xfd8e('0x2d')][_0xfd8e('0x2e')]};});_0x58e3be[_0xfd8e('0x2f')]=_[_0xfd8e('0x2a')](_0xd93a34,'name');_0x58e3be[_0xfd8e('0x30')]=_[_0xfd8e('0x31')](_0x3f79c2[_0xfd8e('0x30')]);_0x58e3be['filters']=_[_0xfd8e('0x32')](_0x58e3be[_0xfd8e('0x2f')],_0x58e3be[_0xfd8e('0x30')]);_0x4d8b52[_0xfd8e('0x33')]=_[_0xfd8e('0x32')](_0x58e3be[_0xfd8e('0x2f')],qs[_0xfd8e('0x34')](_0x3f79c2[_0xfd8e('0x30')]['fields']));_0x4d8b52[_0xfd8e('0x33')]=_0x4d8b52['attributes']['length']?_0x4d8b52[_0xfd8e('0x33')]:_0x58e3be[_0xfd8e('0x2f')];if(!_0x3f79c2[_0xfd8e('0x30')][_0xfd8e('0x35')]('nolimit')){_0x4d8b52[_0xfd8e('0x1d')]=qs[_0xfd8e('0x1d')](_0x3f79c2[_0xfd8e('0x30')][_0xfd8e('0x1d')]);_0x4d8b52[_0xfd8e('0x36')]=qs[_0xfd8e('0x36')](_0x3f79c2[_0xfd8e('0x30')]['offset']);}_0x4d8b52[_0xfd8e('0x37')]=qs[_0xfd8e('0x38')](_0x3f79c2[_0xfd8e('0x30')][_0xfd8e('0x38')]);_0x4d8b52[_0xfd8e('0x39')]=qs[_0xfd8e('0x3a')](_[_0xfd8e('0x3b')](_0x3f79c2[_0xfd8e('0x30')],_0x58e3be[_0xfd8e('0x3a')]));if(_0x3f79c2[_0xfd8e('0x30')][_0xfd8e('0x3c')]){_0x4d8b52[_0xfd8e('0x39')]=_[_0xfd8e('0x3d')](_0x4d8b52[_0xfd8e('0x39')],{'$or':_['map'](_0xd93a34,function(_0x3e2852){if(_0x3e2852[_0xfd8e('0x2d')]!==_0xfd8e('0x3e')){var _0x3b6164={};_0x3b6164[_0x3e2852[_0xfd8e('0x27')]]={'$like':'%'+_0x3f79c2[_0xfd8e('0x30')]['filter']+'%'};return _0x3b6164;}})});}_0x4d8b52=_[_0xfd8e('0x3d')]({},_0x4d8b52,_0x3f79c2[_0xfd8e('0x3f')]);var _0x4569e2={'where':_0x4d8b52[_0xfd8e('0x39')]};return db['Attachment'][_0xfd8e('0x1c')](_0x4569e2)[_0xfd8e('0x25')](function(_0x359ce6){_0x469796[_0xfd8e('0x1c')]=_0x359ce6;if(_0x3f79c2['query'][_0xfd8e('0x40')]){_0x4d8b52['include']=[{'all':!![]}];}return db[_0xfd8e('0x2b')]['findAll'](_0x4d8b52);})['then'](function(_0x480cd4){_0x469796['rows']=_0x480cd4;return _0x469796;})[_0xfd8e('0x25')](respondWithFilteredResult(_0x312594,_0x4d8b52))[_0xfd8e('0x41')](handleError(_0x312594,null));};exports['show']=function(_0x51d02d,_0x338aac){var _0x183b9a={'raw':!![],'where':{'id':_0x51d02d[_0xfd8e('0x42')]['id']}},_0x46e88f={};_0x46e88f['model']=_[_0xfd8e('0x31')](db[_0xfd8e('0x2b')]['rawAttributes']);_0x46e88f[_0xfd8e('0x30')]=_['keys'](_0x51d02d[_0xfd8e('0x30')]);_0x46e88f[_0xfd8e('0x3a')]=_[_0xfd8e('0x32')](_0x46e88f['model'],_0x46e88f[_0xfd8e('0x30')]);_0x183b9a[_0xfd8e('0x33')]=_['intersection'](_0x46e88f[_0xfd8e('0x2f')],qs['fields'](_0x51d02d[_0xfd8e('0x30')][_0xfd8e('0x34')]));_0x183b9a[_0xfd8e('0x33')]=_0x183b9a[_0xfd8e('0x33')][_0xfd8e('0x43')]?_0x183b9a[_0xfd8e('0x33')]:_0x46e88f[_0xfd8e('0x2f')];if(_0x51d02d[_0xfd8e('0x30')][_0xfd8e('0x40')]){_0x183b9a[_0xfd8e('0x44')]=[{'all':!![]}];}_0x183b9a=_['merge']({},_0x183b9a,_0x51d02d['options']);return db['Attachment'][_0xfd8e('0x45')](_0x183b9a)[_0xfd8e('0x25')](handleEntityNotFound(_0x338aac,null))['then'](respondWithResult(_0x338aac,null))['catch'](handleError(_0x338aac,null));};exports[_0xfd8e('0x46')]=function(_0x3a25d9,_0x55c5ba){var _0x1fccd3={'where':{'id':_0x3a25d9[_0xfd8e('0x42')]['id']}},_0xe16697={};_0xe16697[_0xfd8e('0x2f')]=_['keys'](db[_0xfd8e('0x2b')][_0xfd8e('0x2c')]);_0x1fccd3['attributes']=_[_0xfd8e('0x32')](_0xe16697[_0xfd8e('0x2f')],qs['fields'](_0x3a25d9[_0xfd8e('0x30')][_0xfd8e('0x34')]));_0x1fccd3[_0xfd8e('0x33')]=_0x1fccd3[_0xfd8e('0x33')][_0xfd8e('0x43')]?_0x1fccd3[_0xfd8e('0x33')]:_0xe16697[_0xfd8e('0x2f')];if(_0x3a25d9['query']['includeAll']){_0x1fccd3[_0xfd8e('0x44')]=[{'all':!![]}];}_0x1fccd3=_[_0xfd8e('0x3d')]({},_0x1fccd3,_0x3a25d9[_0xfd8e('0x3f')]);return db[_0xfd8e('0x2b')][_0xfd8e('0x45')](_0x1fccd3)[_0xfd8e('0x25')](handleEntityNotFound(_0x55c5ba,null))[_0xfd8e('0x25')](function(_0x527000){if(_0x527000){var _0x1243b8=_0x527000[_0xfd8e('0x47')]({'plain':!![]});_0x1243b8=qs[_0xfd8e('0x48')](_0x1243b8,['id','createdAt',_0xfd8e('0x49')]);_0x3a25d9[_0xfd8e('0x4a')]=_[_0xfd8e('0x48')](_0x3a25d9[_0xfd8e('0x4a')],['id',_0xfd8e('0x4b'),_0xfd8e('0x49')]);return db[_0xfd8e('0x2b')]['create'](_['merge'](_0x1243b8,_0x3a25d9[_0xfd8e('0x4a')]),{'include':_0x3a25d9[_0xfd8e('0x30')][_0xfd8e('0x40')]?[{'all':!![]}]:undefined});}})[_0xfd8e('0x25')](respondWithResult(_0x55c5ba,0xc9))[_0xfd8e('0x41')](handleError(_0x55c5ba,null));};exports[_0xfd8e('0x23')]=function(_0x5326ea,_0x1009ba){if(_0x5326ea[_0xfd8e('0x4a')]['id']){delete _0x5326ea[_0xfd8e('0x4a')]['id'];}return db[_0xfd8e('0x2b')][_0xfd8e('0x45')]({'where':{'id':_0x5326ea[_0xfd8e('0x42')]['id']}})[_0xfd8e('0x25')](handleEntityNotFound(_0x1009ba,null))[_0xfd8e('0x25')](saveUpdates(_0x5326ea['body'],null))[_0xfd8e('0x25')](respondWithResult(_0x1009ba,null))['catch'](handleError(_0x1009ba,null));};exports['destroy']=function(_0x58f0d8,_0x4cb324){return db[_0xfd8e('0x2b')][_0xfd8e('0x45')]({'where':{'id':_0x58f0d8[_0xfd8e('0x42')]['id']}})[_0xfd8e('0x25')](handleEntityNotFound(_0x4cb324,null))[_0xfd8e('0x25')](removeEntity(_0x4cb324,null))[_0xfd8e('0x41')](handleError(_0x4cb324,null));};exports['create']=function(_0x1bf02d,_0x2f256c,_0x6cd429){_0x1bf02d[_0xfd8e('0x4a')][_0xfd8e('0x27')]=_0x1bf02d[_0xfd8e('0x4c')][_0xfd8e('0x4d')];_0x1bf02d['body'][_0xfd8e('0x4e')]=_0x1bf02d[_0xfd8e('0x4c')][_0xfd8e('0x4f')];_0x1bf02d['body'][_0xfd8e('0x2d')]=_0x1bf02d['file'][_0xfd8e('0x50')];return db['Attachment'][_0xfd8e('0x51')](_0x1bf02d['body'])['then'](respondWithResult(_0x2f256c,0xc9))[_0xfd8e('0x41')](handleError(_0x2f256c,null));};exports[_0xfd8e('0x52')]=function(_0x490001,_0x1a6886,_0xc12528){return db['Attachment'][_0xfd8e('0x53')]({'where':{'id':_0x490001[_0xfd8e('0x42')]['id']},'raw':!![]})[_0xfd8e('0x25')](handleEntityNotFound(_0x1a6886,null))[_0xfd8e('0x25')](function(_0x182bc2){if(_0x182bc2){return _0x1a6886[_0xfd8e('0x52')](path[_0xfd8e('0x54')](config[_0xfd8e('0x55')],_0xfd8e('0x56'),_0x182bc2[_0xfd8e('0x4e')]));}})['catch'](handleError(_0x1a6886,null));}; \ No newline at end of file +var _0x01ff=['include','findAll','catch','show','params','keys','omit','updatedAt','body','create','find','file','originalname','basename','filename','mimetype','download','findOne','join','root','server/files/attachments/','html-pdf','eml-format','request-promise','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','limit','Content-Range','apply','update','then','destroy','end','error','stack','name','index','map','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','Attachment','count','includeAll'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x01ff,0x1dd));var _0xf01f=function(_0xc9c94b,_0x27a331){_0xc9c94b=_0xc9c94b-0x0;var _0x40b439=_0x01ff[_0xc9c94b];return _0x40b439;};'use strict';var pdf=require(_0xf01f('0x0'));var emlformat=require(_0xf01f('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf01f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf01f('0x3'));var path=require('path');var sox=require(_0xf01f('0x4'));var csv=require(_0xf01f('0x5'));var ejs=require(_0xf01f('0x6'));var fs=require('fs');var _=require(_0xf01f('0x7'));var squel=require(_0xf01f('0x8'));var crypto=require(_0xf01f('0x9'));var jsforce=require(_0xf01f('0xa'));var deskjs=require(_0xf01f('0xb'));var toCsv=require(_0xf01f('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf01f('0xc'));var qs=require(_0xf01f('0xd'));var as=require(_0xf01f('0xe'));var hardwareService=require(_0xf01f('0xf'));var logger=require(_0xf01f('0x10'))(_0xf01f('0x11'));var utils=require(_0xf01f('0x12'));var config=require('../../config/environment');var db=require(_0xf01f('0x13'))['db'];function respondWithStatusCode(_0x9b9fd6,_0x505e96){_0x505e96=_0x505e96||0xcc;return function(_0x5781c1){if(_0x5781c1){return _0x9b9fd6[_0xf01f('0x14')](_0x505e96);}return _0x9b9fd6[_0xf01f('0x15')](_0x505e96)['end']();};}function respondWithResult(_0x363fd1,_0x2c5cf6){_0x2c5cf6=_0x2c5cf6||0xc8;return function(_0x4e2f37){if(_0x4e2f37){return _0x363fd1[_0xf01f('0x15')](_0x2c5cf6)[_0xf01f('0x16')](_0x4e2f37);}};}function respondWithFilteredResult(_0x3757e5,_0x108ef9){return function(_0x288262){if(_0x288262){var _0x1cf424=_0x288262['count'],_0x542ed5=_0x108ef9[_0xf01f('0x17')],_0x290928=_0x108ef9['offset']+_0x108ef9[_0xf01f('0x18')],_0x1164cb;if(_0x290928>=_0x1cf424){_0x290928=_0x1cf424;_0x1164cb=0xc8;}else{_0x1164cb=0xce;}_0x3757e5[_0xf01f('0x15')](_0x1164cb);return _0x3757e5['set'](_0xf01f('0x19'),_0x542ed5+'-'+_0x290928+'/'+_0x1cf424)[_0xf01f('0x16')](_0x288262);}return null;};}function patchUpdates(_0x48a3ac){return function(_0x3eab17){try{jsonpatch[_0xf01f('0x1a')](_0x3eab17,_0x48a3ac,!![]);}catch(_0x523021){return BPromise['reject'](_0x523021);}return _0x3eab17['save']();};}function saveUpdates(_0x16c130,_0x1a1563){return function(_0x42bdd7){if(_0x42bdd7){return _0x42bdd7[_0xf01f('0x1b')](_0x16c130)[_0xf01f('0x1c')](function(_0x465d5f){return _0x465d5f;});}return null;};}function removeEntity(_0x5cd5ab,_0x47e99f){return function(_0x3f9851){if(_0x3f9851){return _0x3f9851[_0xf01f('0x1d')]()[_0xf01f('0x1c')](function(){_0x5cd5ab['status'](0xcc)[_0xf01f('0x1e')]();});}};}function handleEntityNotFound(_0x5e7e6b,_0x17daa4){return function(_0x1fe5f8){if(!_0x1fe5f8){_0x5e7e6b[_0xf01f('0x14')](0x194);}return _0x1fe5f8;};}function handleError(_0x8c4a4b,_0x2980b8){_0x2980b8=_0x2980b8||0x1f4;return function(_0x4e68b5){logger[_0xf01f('0x1f')](_0x4e68b5[_0xf01f('0x20')]);if(_0x4e68b5[_0xf01f('0x21')]){delete _0x4e68b5[_0xf01f('0x21')];}_0x8c4a4b[_0xf01f('0x15')](_0x2980b8)['send'](_0x4e68b5);};}exports[_0xf01f('0x22')]=function(_0x52c6a4,_0x492ffc){var _0x4fdec0={},_0x248522={},_0x3aaaa3={'count':0x0,'rows':[]};var _0x298a0d=_[_0xf01f('0x23')](db['Attachment']['rawAttributes'],function(_0x194b50){return{'name':_0x194b50[_0xf01f('0x24')],'type':_0x194b50[_0xf01f('0x25')]['key']};});_0x248522[_0xf01f('0x26')]=_[_0xf01f('0x23')](_0x298a0d,'name');_0x248522[_0xf01f('0x27')]=_['keys'](_0x52c6a4[_0xf01f('0x27')]);_0x248522[_0xf01f('0x28')]=_[_0xf01f('0x29')](_0x248522['model'],_0x248522['query']);_0x4fdec0[_0xf01f('0x2a')]=_[_0xf01f('0x29')](_0x248522[_0xf01f('0x26')],qs[_0xf01f('0x2b')](_0x52c6a4[_0xf01f('0x27')][_0xf01f('0x2b')]));_0x4fdec0['attributes']=_0x4fdec0['attributes'][_0xf01f('0x2c')]?_0x4fdec0[_0xf01f('0x2a')]:_0x248522[_0xf01f('0x26')];if(!_0x52c6a4[_0xf01f('0x27')][_0xf01f('0x2d')]('nolimit')){_0x4fdec0[_0xf01f('0x18')]=qs[_0xf01f('0x18')](_0x52c6a4[_0xf01f('0x27')][_0xf01f('0x18')]);_0x4fdec0[_0xf01f('0x17')]=qs[_0xf01f('0x17')](_0x52c6a4['query'][_0xf01f('0x17')]);}_0x4fdec0[_0xf01f('0x2e')]=qs[_0xf01f('0x2f')](_0x52c6a4[_0xf01f('0x27')][_0xf01f('0x2f')]);_0x4fdec0[_0xf01f('0x30')]=qs[_0xf01f('0x28')](_['pick'](_0x52c6a4[_0xf01f('0x27')],_0x248522[_0xf01f('0x28')]));if(_0x52c6a4['query'][_0xf01f('0x31')]){_0x4fdec0[_0xf01f('0x30')]=_[_0xf01f('0x32')](_0x4fdec0[_0xf01f('0x30')],{'$or':_[_0xf01f('0x23')](_0x298a0d,function(_0x52ba4c){if(_0x52ba4c['type']!=='VIRTUAL'){var _0x44cc2b={};_0x44cc2b[_0x52ba4c['name']]={'$like':'%'+_0x52c6a4[_0xf01f('0x27')][_0xf01f('0x31')]+'%'};return _0x44cc2b;}})});}_0x4fdec0=_[_0xf01f('0x32')]({},_0x4fdec0,_0x52c6a4[_0xf01f('0x33')]);var _0x56e0f4={'where':_0x4fdec0[_0xf01f('0x30')]};return db[_0xf01f('0x34')][_0xf01f('0x35')](_0x56e0f4)[_0xf01f('0x1c')](function(_0x29df28){_0x3aaaa3[_0xf01f('0x35')]=_0x29df28;if(_0x52c6a4[_0xf01f('0x27')][_0xf01f('0x36')]){_0x4fdec0[_0xf01f('0x37')]=[{'all':!![]}];}return db['Attachment'][_0xf01f('0x38')](_0x4fdec0);})[_0xf01f('0x1c')](function(_0x3957b7){_0x3aaaa3['rows']=_0x3957b7;return _0x3aaaa3;})['then'](respondWithFilteredResult(_0x492ffc,_0x4fdec0))[_0xf01f('0x39')](handleError(_0x492ffc,null));};exports[_0xf01f('0x3a')]=function(_0x5fd325,_0x6f4382){var _0xa3cd92={'raw':!![],'where':{'id':_0x5fd325['params']['id']}},_0x1e165c={};_0x1e165c[_0xf01f('0x26')]=_['keys'](db[_0xf01f('0x34')]['rawAttributes']);_0x1e165c[_0xf01f('0x27')]=_['keys'](_0x5fd325['query']);_0x1e165c[_0xf01f('0x28')]=_[_0xf01f('0x29')](_0x1e165c[_0xf01f('0x26')],_0x1e165c['query']);_0xa3cd92[_0xf01f('0x2a')]=_[_0xf01f('0x29')](_0x1e165c['model'],qs[_0xf01f('0x2b')](_0x5fd325[_0xf01f('0x27')][_0xf01f('0x2b')]));_0xa3cd92[_0xf01f('0x2a')]=_0xa3cd92[_0xf01f('0x2a')][_0xf01f('0x2c')]?_0xa3cd92[_0xf01f('0x2a')]:_0x1e165c[_0xf01f('0x26')];if(_0x5fd325['query'][_0xf01f('0x36')]){_0xa3cd92[_0xf01f('0x37')]=[{'all':!![]}];}_0xa3cd92=_[_0xf01f('0x32')]({},_0xa3cd92,_0x5fd325['options']);return db[_0xf01f('0x34')]['find'](_0xa3cd92)[_0xf01f('0x1c')](handleEntityNotFound(_0x6f4382,null))['then'](respondWithResult(_0x6f4382,null))['catch'](handleError(_0x6f4382,null));};exports['clone']=function(_0x3f9bbe,_0x582fa0){var _0x4ec348={'where':{'id':_0x3f9bbe[_0xf01f('0x3b')]['id']}},_0x5bbaae={};_0x5bbaae[_0xf01f('0x26')]=_[_0xf01f('0x3c')](db['Attachment']['rawAttributes']);_0x4ec348['attributes']=_[_0xf01f('0x29')](_0x5bbaae[_0xf01f('0x26')],qs['fields'](_0x3f9bbe[_0xf01f('0x27')]['fields']));_0x4ec348[_0xf01f('0x2a')]=_0x4ec348[_0xf01f('0x2a')][_0xf01f('0x2c')]?_0x4ec348[_0xf01f('0x2a')]:_0x5bbaae[_0xf01f('0x26')];if(_0x3f9bbe[_0xf01f('0x27')][_0xf01f('0x36')]){_0x4ec348[_0xf01f('0x37')]=[{'all':!![]}];}_0x4ec348=_[_0xf01f('0x32')]({},_0x4ec348,_0x3f9bbe['options']);return db[_0xf01f('0x34')]['find'](_0x4ec348)['then'](handleEntityNotFound(_0x582fa0,null))[_0xf01f('0x1c')](function(_0x2a4c31){if(_0x2a4c31){var _0x17f752=_0x2a4c31['get']({'plain':!![]});_0x17f752=qs[_0xf01f('0x3d')](_0x17f752,['id','createdAt',_0xf01f('0x3e')]);_0x3f9bbe[_0xf01f('0x3f')]=_[_0xf01f('0x3d')](_0x3f9bbe['body'],['id','createdAt','updatedAt']);return db['Attachment'][_0xf01f('0x40')](_[_0xf01f('0x32')](_0x17f752,_0x3f9bbe[_0xf01f('0x3f')]),{'include':_0x3f9bbe['query'][_0xf01f('0x36')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x582fa0,0xc9))['catch'](handleError(_0x582fa0,null));};exports[_0xf01f('0x1b')]=function(_0x594c7c,_0x12a9a3){if(_0x594c7c[_0xf01f('0x3f')]['id']){delete _0x594c7c[_0xf01f('0x3f')]['id'];}return db['Attachment'][_0xf01f('0x41')]({'where':{'id':_0x594c7c[_0xf01f('0x3b')]['id']}})['then'](handleEntityNotFound(_0x12a9a3,null))[_0xf01f('0x1c')](saveUpdates(_0x594c7c[_0xf01f('0x3f')],null))[_0xf01f('0x1c')](respondWithResult(_0x12a9a3,null))[_0xf01f('0x39')](handleError(_0x12a9a3,null));};exports[_0xf01f('0x1d')]=function(_0x1920aa,_0x98c4be){return db['Attachment'][_0xf01f('0x41')]({'where':{'id':_0x1920aa['params']['id']}})[_0xf01f('0x1c')](handleEntityNotFound(_0x98c4be,null))[_0xf01f('0x1c')](removeEntity(_0x98c4be,null))[_0xf01f('0x39')](handleError(_0x98c4be,null));};exports[_0xf01f('0x40')]=function(_0x5f37f6,_0x2912c2,_0x17543b){_0x5f37f6['body']['name']=_0x5f37f6[_0xf01f('0x42')][_0xf01f('0x43')];_0x5f37f6[_0xf01f('0x3f')][_0xf01f('0x44')]=_0x5f37f6[_0xf01f('0x42')][_0xf01f('0x45')];_0x5f37f6['body'][_0xf01f('0x25')]=_0x5f37f6[_0xf01f('0x42')][_0xf01f('0x46')];return db[_0xf01f('0x34')][_0xf01f('0x40')](_0x5f37f6[_0xf01f('0x3f')])['then'](respondWithResult(_0x2912c2,0xc9))[_0xf01f('0x39')](handleError(_0x2912c2,null));};exports[_0xf01f('0x47')]=function(_0x4bf9b7,_0x286f04,_0x3fdc82){return db[_0xf01f('0x34')][_0xf01f('0x48')]({'where':{'id':_0x4bf9b7[_0xf01f('0x3b')]['id']},'raw':!![]})[_0xf01f('0x1c')](handleEntityNotFound(_0x286f04,null))[_0xf01f('0x1c')](function(_0x4424f4){if(_0x4424f4){return _0x286f04[_0xf01f('0x47')](path[_0xf01f('0x49')](config[_0xf01f('0x4a')],_0xf01f('0x4b'),_0x4424f4[_0xf01f('0x44')]));}})[_0xf01f('0x39')](handleError(_0x286f04,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 64eaf04..95fd5fc 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 _0xf894=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments','lodash','util'];(function(_0x85fbb2,_0x55d447){var _0x2c94e5=function(_0x3bd403){while(--_0x3bd403){_0x85fbb2['push'](_0x85fbb2['shift']());}};_0x2c94e5(++_0x55d447);}(_0xf894,0xfd));var _0x4f89=function(_0x49ae3a,_0x2ab2ea){_0x49ae3a=_0x49ae3a-0x0;var _0x466575=_0xf894[_0x49ae3a];return _0x466575;};'use strict';var _=require(_0x4f89('0x0'));var util=require(_0x4f89('0x1'));var logger=require(_0x4f89('0x2'))(_0x4f89('0x3'));var moment=require(_0x4f89('0x4'));var BPromise=require(_0x4f89('0x5'));var rp=require(_0x4f89('0x6'));var fs=require('fs');var path=require(_0x4f89('0x7'));var rimraf=require(_0x4f89('0x8'));var config=require(_0x4f89('0x9'));var attributes=require(_0x4f89('0xa'));module[_0x4f89('0xb')]=function(_0x8837a0,_0x343593){return _0x8837a0[_0x4f89('0xc')](_0x4f89('0xd'),attributes,{'tableName':_0x4f89('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb5fa=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports','Attachment','attachments','lodash','util','../../config/logger','api'];(function(_0xa0e439,_0x4564ba){var _0x47d3c2=function(_0x3ad73b){while(--_0x3ad73b){_0xa0e439['push'](_0xa0e439['shift']());}};_0x47d3c2(++_0x4564ba);}(_0xb5fa,0xf8));var _0xab5f=function(_0x254753,_0x3b8712){_0x254753=_0x254753-0x0;var _0x5cea99=_0xb5fa[_0x254753];return _0x5cea99;};'use strict';var _=require(_0xab5f('0x0'));var util=require(_0xab5f('0x1'));var logger=require(_0xab5f('0x2'))(_0xab5f('0x3'));var moment=require(_0xab5f('0x4'));var BPromise=require(_0xab5f('0x5'));var rp=require(_0xab5f('0x6'));var fs=require('fs');var path=require(_0xab5f('0x7'));var rimraf=require(_0xab5f('0x8'));var config=require(_0xab5f('0x9'));var attributes=require(_0xab5f('0xa'));module[_0xab5f('0xb')]=function(_0x52f546,_0x4b40ca){return _0x52f546['define'](_0xab5f('0xc'),attributes,{'tableName':_0xab5f('0xd'),'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 ba9eca0..79c7fe9 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 _0x6552=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateAttachment','Attachment','create','body','options','raw','stringify','util','moment','bluebird'];(function(_0xc43d5a,_0x1c381b){var _0x3ab8bf=function(_0x58d0a0){while(--_0x58d0a0){_0xc43d5a['push'](_0xc43d5a['shift']());}};_0x3ab8bf(++_0x1c381b);}(_0x6552,0x98));var _0x2655=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x6552[_0x2b10c6];return _0x3789d2;};'use strict';var _=require('lodash');var util=require(_0x2655('0x0'));var moment=require(_0x2655('0x1'));var BPromise=require(_0x2655('0x2'));var rs=require(_0x2655('0x3'));var fs=require('fs');var Redis=require(_0x2655('0x4'));var db=require(_0x2655('0x5'))['db'];var utils=require(_0x2655('0x6'));var logger=require(_0x2655('0x7'))(_0x2655('0x8'));var config=require(_0x2655('0x9'));var jayson=require(_0x2655('0xa'));var client=jayson[_0x2655('0xb')][_0x2655('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x133708,_0x1e78de,_0x4d8246){return new BPromise(function(_0x1b403b,_0x213a0e){return client[_0x2655('0xd')](_0x133708,_0x4d8246)[_0x2655('0xe')](function(_0x274e95){logger[_0x2655('0xf')](_0x2655('0x10'),_0x1e78de,_0x2655('0x11'));logger[_0x2655('0x12')](_0x2655('0x13'),_0x1e78de,_0x2655('0x11'),JSON['stringify'](_0x274e95));if(_0x274e95[_0x2655('0x14')]){if(_0x274e95['error']['code']===0x1f4){logger[_0x2655('0x14')](_0x2655('0x10'),_0x1e78de,_0x274e95['error'][_0x2655('0x15')]);return _0x213a0e(_0x274e95[_0x2655('0x14')][_0x2655('0x15')]);}logger[_0x2655('0x14')](_0x2655('0x10'),_0x1e78de,_0x274e95[_0x2655('0x14')]['message']);return _0x1b403b(_0x274e95[_0x2655('0x14')]['message']);}else{logger[_0x2655('0xf')]('Attachment,\x20%s,\x20%s',_0x1e78de,_0x2655('0x11'));_0x1b403b(_0x274e95[_0x2655('0x16')]['message']);}})[_0x2655('0x17')](function(_0x1bb6ac){logger[_0x2655('0x14')]('Attachment,\x20%s,\x20%s',_0x1e78de,_0x1bb6ac);_0x213a0e(_0x1bb6ac);});});}exports[_0x2655('0x18')]=function(_0x7420c){var _0x5a5dd2=this;return new Promise(function(_0x595528,_0x4e40ad){return db[_0x2655('0x19')][_0x2655('0x1a')](_0x7420c[_0x2655('0x1b')],{'raw':_0x7420c['options']?_0x7420c[_0x2655('0x1c')][_0x2655('0x1d')]===undefined?!![]:![]:!![]})[_0x2655('0xe')](function(_0x5077f7){logger[_0x2655('0xf')](_0x2655('0x18'),_0x7420c);logger[_0x2655('0x12')](_0x2655('0x18'),_0x7420c,JSON[_0x2655('0x1e')](_0x5077f7));_0x595528(_0x5077f7);})[_0x2655('0x17')](function(_0x4cf93){logger[_0x2655('0x14')](_0x2655('0x18'),_0x4cf93[_0x2655('0x15')],_0x7420c);_0x4e40ad(_0x5a5dd2['error'](0x1f4,_0x4cf93[_0x2655('0x15')]));});});}; \ No newline at end of file +var _0x45e8=['result','Attachment','create','body','raw','CreateAttachment','catch','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4a9cbb,_0x512bb3){var _0x44c8cc=function(_0xdadf1){while(--_0xdadf1){_0x4a9cbb['push'](_0x4a9cbb['shift']());}};_0x44c8cc(++_0x512bb3);}(_0x45e8,0x89));var _0x845e=function(_0x5d9295,_0x5f5bc6){_0x5d9295=_0x5d9295-0x0;var _0x4f2534=_0x45e8[_0x5d9295];return _0x4f2534;};'use strict';var _=require('lodash');var util=require(_0x845e('0x0'));var moment=require(_0x845e('0x1'));var BPromise=require('bluebird');var rs=require(_0x845e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x845e('0x3'))['db'];var utils=require(_0x845e('0x4'));var logger=require('../../config/logger')(_0x845e('0x5'));var config=require(_0x845e('0x6'));var jayson=require(_0x845e('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x478bf1,_0x154e89,_0x4e960c){return new BPromise(function(_0xbf164c,_0x1e0f5d){return client[_0x845e('0x8')](_0x478bf1,_0x4e960c)[_0x845e('0x9')](function(_0x1e6fcf){logger[_0x845e('0xa')](_0x845e('0xb'),_0x154e89,_0x845e('0xc'));logger[_0x845e('0xd')](_0x845e('0xe'),_0x154e89,_0x845e('0xc'),JSON[_0x845e('0xf')](_0x1e6fcf));if(_0x1e6fcf[_0x845e('0x10')]){if(_0x1e6fcf[_0x845e('0x10')][_0x845e('0x11')]===0x1f4){logger[_0x845e('0x10')](_0x845e('0xb'),_0x154e89,_0x1e6fcf[_0x845e('0x10')][_0x845e('0x12')]);return _0x1e0f5d(_0x1e6fcf['error'][_0x845e('0x12')]);}logger['error'](_0x845e('0xb'),_0x154e89,_0x1e6fcf[_0x845e('0x10')][_0x845e('0x12')]);return _0xbf164c(_0x1e6fcf[_0x845e('0x10')]['message']);}else{logger[_0x845e('0xa')](_0x845e('0xb'),_0x154e89,_0x845e('0xc'));_0xbf164c(_0x1e6fcf[_0x845e('0x13')][_0x845e('0x12')]);}})['catch'](function(_0x2d995c){logger[_0x845e('0x10')](_0x845e('0xb'),_0x154e89,_0x2d995c);_0x1e0f5d(_0x2d995c);});});}exports['CreateAttachment']=function(_0x32fb27){var _0x40929f=this;return new Promise(function(_0xe00833,_0x436ca4){return db[_0x845e('0x14')][_0x845e('0x15')](_0x32fb27[_0x845e('0x16')],{'raw':_0x32fb27['options']?_0x32fb27['options'][_0x845e('0x17')]===undefined?!![]:![]:!![]})[_0x845e('0x9')](function(_0x221d60){logger[_0x845e('0xa')](_0x845e('0x18'),_0x32fb27);logger[_0x845e('0xd')]('CreateAttachment',_0x32fb27,JSON[_0x845e('0xf')](_0x221d60));_0xe00833(_0x221d60);})[_0x845e('0x19')](function(_0x46602c){logger[_0x845e('0x10')](_0x845e('0x18'),_0x46602c[_0x845e('0x12')],_0x32fb27);_0x436ca4(_0x40929f[_0x845e('0x10')](0x1f4,_0x46602c[_0x845e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index aa97c93..b6513d6 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 _0x4658=['Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/download','post','/:id/clone','clone','join','root','format','originalname','file','create','put','delete','exports','multer','util','path','connect-timeout'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x4658,0x74));var _0x8465=function(_0x572415,_0x350020){_0x572415=_0x572415-0x0;var _0xc66576=_0x4658[_0x572415];return _0xc66576;};'use strict';var multer=require(_0x8465('0x0'));var util=require(_0x8465('0x1'));var path=require(_0x8465('0x2'));var timeout=require(_0x8465('0x3'));var express=require('express');var router=express[_0x8465('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x8465('0x5'));var config=require('../../config/environment');var controller=require('./attachment.controller');router[_0x8465('0x6')]('/',auth[_0x8465('0x7')](),controller[_0x8465('0x8')]);router['get'](_0x8465('0x9'),auth[_0x8465('0x7')](),controller[_0x8465('0xa')]);router[_0x8465('0x6')](_0x8465('0xb'),auth['isAuthenticated'](),controller['download']);router[_0x8465('0xc')](_0x8465('0xd'),auth[_0x8465('0x7')](),controller[_0x8465('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3cf0c8,_0x313f8f,_0x1d147b){_0x1d147b(null,path[_0x8465('0xf')](config[_0x8465('0x10')],'server/files/attachments/'));},'filename':function(_0x2503d5,_0x1252a6,_0x3d6563){_0x3d6563(null,util[_0x8465('0x11')]('%s-%s',Date['now'](),_0x1252a6[_0x8465('0x12')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8465('0xc')]('/',upload['single'](_0x8465('0x13')),controller[_0x8465('0x14')]);router[_0x8465('0x15')]('/:id',auth[_0x8465('0x7')](),controller['update']);router[_0x8465('0x16')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x8465('0x17')]=router; \ No newline at end of file +var _0x39d7=['%s-%s','now','originalname','replace','file','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','download','post','clone','diskStorage','join','root','server/files/attachments/','format'];(function(_0x4c030e,_0x250028){var _0x225b6c=function(_0x59223e){while(--_0x59223e){_0x4c030e['push'](_0x4c030e['shift']());}};_0x225b6c(++_0x250028);}(_0x39d7,0x12d));var _0x739d=function(_0x18ca41,_0x4b407f){_0x18ca41=_0x18ca41-0x0;var _0x4eb2e6=_0x39d7[_0x18ca41];return _0x4eb2e6;};'use strict';var multer=require(_0x739d('0x0'));var util=require(_0x739d('0x1'));var path=require(_0x739d('0x2'));var timeout=require('connect-timeout');var express=require(_0x739d('0x3'));var router=express[_0x739d('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x739d('0x5'));var config=require('../../config/environment');var controller=require('./attachment.controller');router[_0x739d('0x6')]('/',auth[_0x739d('0x7')](),controller[_0x739d('0x8')]);router['get'](_0x739d('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x739d('0x6')]('/:id/download',auth[_0x739d('0x7')](),controller[_0x739d('0xa')]);router[_0x739d('0xb')]('/:id/clone',auth['isAuthenticated'](),controller[_0x739d('0xc')]);var upload=multer({'storage':multer[_0x739d('0xd')]({'destination':function(_0x10bbb1,_0x39dbcd,_0x286c83){_0x286c83(null,path[_0x739d('0xe')](config[_0x739d('0xf')],_0x739d('0x10')));},'filename':function(_0x17f479,_0xb2dc6b,_0x24dc90){_0x24dc90(null,util[_0x739d('0x11')](_0x739d('0x12'),Date[_0x739d('0x13')](),_0xb2dc6b[_0x739d('0x14')][_0x739d('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x739d('0xb')]('/',upload['single'](_0x739d('0x16')),controller[_0x739d('0x17')]);router[_0x739d('0x18')](_0x739d('0x9'),auth['isAuthenticated'](),controller[_0x739d('0x19')]);router[_0x739d('0x1a')]('/:id',auth[_0x739d('0x7')](),controller[_0x739d('0x1b')]);module[_0x739d('0x1c')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 9b7eb3e..343b4b6 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 _0x1b0b=['map','emails','value','admin','user','agent','then','blocked','blockedAt','add','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','catch','passport','Strategy','moment','../../mysqldb','../../components/auth/service','signToken','authenticate','google','profile','email','callback','/login','use','clientSecret','callbackURL','Setting','allowedLoginAttempts','blockDuration','User','find'];(function(_0x32c57d,_0x5795e8){var _0x4aadae=function(_0x3612ab){while(--_0x3612ab){_0x32c57d['push'](_0x32c57d['shift']());}};_0x4aadae(++_0x5795e8);}(_0x1b0b,0x16d));var _0xb1b0=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x1b0b[_0x4792c8];return _0x35edb1;};'use strict';var _=require('lodash');var passport=require(_0xb1b0('0x0'));var GoogleStrategy=require('passport-google-oauth20')[_0xb1b0('0x1')];var moment=require(_0xb1b0('0x2'));var db=require(_0xb1b0('0x3'))['db'];var config=require('../../config/environment');var signToken=require(_0xb1b0('0x4'))[_0xb1b0('0x5')];var utils=require('../../config/utils');exports['login']=passport[_0xb1b0('0x6')](_0xb1b0('0x7'),{'failureRedirect':'/login','scope':[_0xb1b0('0x8'),_0xb1b0('0x9')],'session':![]});exports[_0xb1b0('0xa')]=passport[_0xb1b0('0x6')]('google',{'failureRedirect':_0xb1b0('0xb'),'session':![]});passport[_0xb1b0('0xc')](new GoogleStrategy({'clientID':config['google']?config[_0xb1b0('0x7')]['clientID']:'id','clientSecret':config['google']?config['google'][_0xb1b0('0xd')]:'secret','callbackURL':config['google']?config[_0xb1b0('0x7')][_0xb1b0('0xe')]:''},function(_0x59c408,_0x30f93a,_0x5d7d12,_0x1aa09c){var _0x94fcb9,_0x88662c;return db[_0xb1b0('0xf')]['findOne']({'where':{'id':0x1},'attributes':[_0xb1b0('0x10'),_0xb1b0('0x11')],'raw':!![]})['then'](function(_0x28e819){_0x94fcb9=_0x28e819;return db[_0xb1b0('0x12')][_0xb1b0('0x13')]({'where':{'email':_[_0xb1b0('0x14')](_0x5d7d12[_0xb1b0('0x15')],_0xb1b0('0x16')),'role':{'$or':[_0xb1b0('0x17'),_0xb1b0('0x18'),_0xb1b0('0x19')]}}});})[_0xb1b0('0x1a')](function(_0x4b6737){_0x88662c=_0x4b6737;if(_0x88662c){if(_0x88662c['disabled']){return _0x1aa09c('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x94fcb9[_0xb1b0('0x11')]>0x0){if(_0x88662c[_0xb1b0('0x1b')]){if(moment(_0x88662c[_0xb1b0('0x1c')])[_0xb1b0('0x1d')](_0x94fcb9['blockDuration'],_0xb1b0('0x1e'))>moment()){return _0x1aa09c(_0xb1b0('0x1f'));}else{return utils[_0xb1b0('0x20')](_0x88662c,0x0,![],null)[_0xb1b0('0x1a')](function(){return utils['getLicense'](_0x88662c);})['then'](function(){return _0x1aa09c(null,_0x88662c);});}}else{return utils['getLicense'](_0x88662c)[_0xb1b0('0x1a')](function(){return _0x1aa09c(null,_0x88662c);});}}else{return utils[_0xb1b0('0x21')](_0x88662c)[_0xb1b0('0x1a')](function(){return _0x1aa09c(null,_0x88662c);});}}return _0x1aa09c(_0xb1b0('0x1f'));})[_0xb1b0('0x22')](function(_0x5edab3){_0x1aa09c(_0x5edab3);});})); \ No newline at end of file +var _0xfe4d=['then','User','find','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','minutes','clearBlockUser','getLicense','catch','passport','passport-google-oauth20','Strategy','moment','../../mysqldb','../../config/environment','signToken','../../config/utils','login','authenticate','profile','callback','google','/login','use','clientID','Setting','findOne','allowedLoginAttempts','blockDuration'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xfe4d,0x178));var _0xdfe4=function(_0x5c8736,_0x2a2a03){_0x5c8736=_0x5c8736-0x0;var _0x142bdb=_0xfe4d[_0x5c8736];return _0x142bdb;};'use strict';var _=require('lodash');var passport=require(_0xdfe4('0x0'));var GoogleStrategy=require(_0xdfe4('0x1'))[_0xdfe4('0x2')];var moment=require(_0xdfe4('0x3'));var db=require(_0xdfe4('0x4'))['db'];var config=require(_0xdfe4('0x5'));var signToken=require('../../components/auth/service')[_0xdfe4('0x6')];var utils=require(_0xdfe4('0x7'));exports[_0xdfe4('0x8')]=passport[_0xdfe4('0x9')]('google',{'failureRedirect':'/login','scope':[_0xdfe4('0xa'),'email'],'session':![]});exports[_0xdfe4('0xb')]=passport[_0xdfe4('0x9')](_0xdfe4('0xc'),{'failureRedirect':_0xdfe4('0xd'),'session':![]});passport[_0xdfe4('0xe')](new GoogleStrategy({'clientID':config[_0xdfe4('0xc')]?config[_0xdfe4('0xc')][_0xdfe4('0xf')]:'id','clientSecret':config[_0xdfe4('0xc')]?config[_0xdfe4('0xc')]['clientSecret']:'secret','callbackURL':config[_0xdfe4('0xc')]?config[_0xdfe4('0xc')]['callbackURL']:''},function(_0x4d0874,_0x483507,_0x31ba1a,_0xfa972e){var _0x5449aa,_0x4cf903;return db[_0xdfe4('0x10')][_0xdfe4('0x11')]({'where':{'id':0x1},'attributes':[_0xdfe4('0x12'),_0xdfe4('0x13')],'raw':!![]})[_0xdfe4('0x14')](function(_0x51e4e7){_0x5449aa=_0x51e4e7;return db[_0xdfe4('0x15')][_0xdfe4('0x16')]({'where':{'email':_['map'](_0x31ba1a['emails'],_0xdfe4('0x17')),'role':{'$or':[_0xdfe4('0x18'),_0xdfe4('0x19'),_0xdfe4('0x1a')]}}});})[_0xdfe4('0x14')](function(_0x1f4d45){_0x4cf903=_0x1f4d45;if(_0x4cf903){if(_0x4cf903['disabled']){return _0xfa972e(_0xdfe4('0x1b'));}else if(_0x5449aa[_0xdfe4('0x13')]>0x0){if(_0x4cf903[_0xdfe4('0x1c')]){if(moment(_0x4cf903['blockedAt'])['add'](_0x5449aa[_0xdfe4('0x13')],_0xdfe4('0x1d'))>moment()){return _0xfa972e(_0xdfe4('0x1b'));}else{return utils[_0xdfe4('0x1e')](_0x4cf903,0x0,![],null)[_0xdfe4('0x14')](function(){return utils['getLicense'](_0x4cf903);})[_0xdfe4('0x14')](function(){return _0xfa972e(null,_0x4cf903);});}}else{return utils[_0xdfe4('0x1f')](_0x4cf903)[_0xdfe4('0x14')](function(){return _0xfa972e(null,_0x4cf903);});}}else{return utils['getLicense'](_0x4cf903)[_0xdfe4('0x14')](function(){return _0xfa972e(null,_0x4cf903);});}}return _0xfa972e(_0xdfe4('0x1b'));})[_0xdfe4('0x20')](function(_0x463142){_0xfa972e(_0x463142);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 355ec7a..583cefb 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 _0x3dd5=['login','/callback','callback','setTokenCookie','exports','express','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get'];(function(_0x384281,_0x16f552){var _0x4dc6b4=function(_0x111621){while(--_0x111621){_0x384281['push'](_0x384281['shift']());}};_0x4dc6b4(++_0x16f552);}(_0x3dd5,0x73));var _0x53dd=function(_0x25a38d,_0x482218){_0x25a38d=_0x25a38d-0x0;var _0x342d50=_0x3dd5[_0x25a38d];return _0x342d50;};'use strict';var express=require(_0x53dd('0x0'));var passport=require('passport');var router=express[_0x53dd('0x1')]();var controller=require(_0x53dd('0x2'));var userController=require(_0x53dd('0x3'));var authService=require(_0x53dd('0x4'));router[_0x53dd('0x5')]('/',controller[_0x53dd('0x6')]);router[_0x53dd('0x5')](_0x53dd('0x7'),controller[_0x53dd('0x8')],authService['isMiddleware'],userController[_0x53dd('0x6')],authService[_0x53dd('0x9')]);module[_0x53dd('0xa')]=router; \ No newline at end of file +var _0x25a3=['isMiddleware','express','passport','Router','../user/user.controller.js','get','login','callback'];(function(_0x24875d,_0x4fb24d){var _0x181471=function(_0x4ecd6d){while(--_0x4ecd6d){_0x24875d['push'](_0x24875d['shift']());}};_0x181471(++_0x4fb24d);}(_0x25a3,0x121));var _0x325a=function(_0x3c67e4,_0xedd28b){_0x3c67e4=_0x3c67e4-0x0;var _0x1a348b=_0x25a3[_0x3c67e4];return _0x1a348b;};'use strict';var express=require(_0x325a('0x0'));var passport=require(_0x325a('0x1'));var router=express[_0x325a('0x2')]();var controller=require('./authGoogle.controller');var userController=require(_0x325a('0x3'));var authService=require('../../components/auth/service');router[_0x325a('0x4')]('/',controller[_0x325a('0x5')]);router[_0x325a('0x4')]('/callback',controller[_0x325a('0x6')],authService[_0x325a('0x7')],userController[_0x325a('0x5')],authService['setTokenCookie']);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index c58c2ee..1b8355f 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 _0x71a9=['You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','http://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','params','token','securePassword','save','status','Password\x20reset!','use','util','passport-local','Strategy','jayson/promise','lodash','moment','../../config/utils','client','Setting','allowedLoginAttempts','blockDuration','then','findOne','name','password','salt','role','disabled','blocked','blockedAt','loginAttempts','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','add','minutes','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','host','port','authentication','auth','merge','format','\x22%s\x22\x20<%s>','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','send','message','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','login','authenticate','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','body','Email\x20parameter\x20is\x20missing','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','xCally\x20Motion\x20Password\x20Reset'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x71a9,0x192));var _0x971a=function(_0x5014f8,_0x4fb30c){_0x5014f8=_0x5014f8-0x0;var _0x1b7a42=_0x71a9[_0x5014f8];return _0x1b7a42;};'use strict';var util=require(_0x971a('0x0'));var passport=require('passport');var LocalStrategy=require(_0x971a('0x1'))[_0x971a('0x2')];var jayson=require(_0x971a('0x3'));var _=require(_0x971a('0x4'));var rs=require('randomstring');var moment=require(_0x971a('0x5'));var db=require('../../mysqldb')['db'];var authService=require('../../components/auth/service');var utils=require(_0x971a('0x6'));var client=jayson[_0x971a('0x7')]['http']({'port':0x232b});function localAuthenticate(_0x3fa473,_0x36285a,_0x4f9136,_0xcbd510){var _0x3dc52d,_0x371b00;return db[_0x971a('0x8')]['findOne']({'where':{'id':0x1},'attributes':[_0x971a('0x9'),_0x971a('0xa')],'raw':!![]})[_0x971a('0xb')](function(_0x59c82f){_0x3dc52d=_0x59c82f;return _0x3fa473[_0x971a('0xc')]({'attributes':['id',_0x971a('0xd'),_0x971a('0xe'),_0x971a('0xf'),_0x971a('0x10'),_0x971a('0x11'),_0x971a('0x12'),_0x971a('0x13'),_0x971a('0x14')],'where':{'name':_0x36285a,'role':{'$or':['admin',_0x971a('0x15'),_0x971a('0x16')]}}});})[_0x971a('0xb')](function(_0x5acb08){if(!_0x5acb08||_0x5acb08&&_0x5acb08[_0x971a('0xd')]!==_0x36285a){throw new Error(_0x971a('0x17'));}else{_0x371b00=_0x5acb08;return _0x371b00;}})['then'](function(){_0x371b00['authenticate'](_0x4f9136,function(_0x44b043,_0x38f2b7){var _0xdb2a5a=_0x371b00['loginAttempts']+0x1;if(_0x44b043){return _0xcbd510(_0x44b043);}else if(!_0x38f2b7){if(_0x371b00[_0x971a('0x11')]){return _0xcbd510(null,![],{'message':_0x971a('0x17')});}else if(_0x3dc52d['allowedLoginAttempts']>0x0){if(_0x371b00['blocked']){if(_0x3dc52d[_0x971a('0xa')]>0x0){if(moment(_0x371b00['blockedAt'])['add'](_0x3dc52d[_0x971a('0xa')],'minutes')>moment()){return _0xcbd510(null,![],{'message':_0x971a('0x17')});}else{return utils[_0x971a('0x18')](_0x371b00,_0xdb2a5a,![],null)['then'](function(){return _0xcbd510(null,![],{'message':_0x971a('0x17')});});}}else{return _0xcbd510(null,![],{'message':_0x971a('0x17')});}}else{if(_0xdb2a5a>=_0x3dc52d[_0x971a('0x9')]){return utils[_0x971a('0x18')](_0x371b00,0x0,!![],moment())[_0x971a('0xb')](function(){return _0xcbd510(null,![],{'message':_0x971a('0x17')});});}else{return utils[_0x971a('0x18')](_0x371b00,_0xdb2a5a,![],null)['then'](function(){return _0xcbd510(null,![],{'message':_0x971a('0x17')});});}}}else{return _0xcbd510(null,![],{'message':_0x971a('0x17')});}}else{if(_0x371b00[_0x971a('0x11')]){return _0xcbd510(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x3dc52d[_0x971a('0x9')]>0x0){if(_0x371b00[_0x971a('0x12')]){if(_0x3dc52d[_0x971a('0xa')]>0x0){if(moment(_0x371b00[_0x971a('0x13')])[_0x971a('0x19')](_0x3dc52d[_0x971a('0xa')],_0x971a('0x1a'))>moment()){return _0xcbd510(null,![],{'message':_0x971a('0x17')});}else{return utils[_0x971a('0x18')](_0x371b00,0x0,![],null)[_0x971a('0xb')](function(){return utils[_0x971a('0x1b')](_0x371b00);})['then'](function(){return _0xcbd510(null,_0x371b00);});}}else{return _0xcbd510(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x971a('0x18')](_0x371b00,0x0,![],null)[_0x971a('0xb')](function(){return utils[_0x971a('0x1b')](_0x371b00);})[_0x971a('0xb')](function(){return _0xcbd510(null,_0x371b00);})[_0x971a('0x1c')](function(_0x4cb602){return _0xcbd510(null,![],_0x4cb602);});}}else{if(_0x371b00[_0x971a('0x12')]){return _0xcbd510(null,![],{'message':_0x971a('0x17')});}else{return utils[_0x971a('0x1b')](_0x371b00)[_0x971a('0xb')](function(){return _0xcbd510(null,_0x371b00);});}}}});})['catch'](function(_0x4feb4b){return _0xcbd510(null,![],_0x4feb4b);});}function sendServiceMail(_0x265052){return db[_0x971a('0x1d')][_0x971a('0x1e')]({'where':{'service':!![]},'attributes':['id',_0x971a('0xd'),_0x971a('0x1f')],'include':[{'model':db[_0x971a('0x20')],'as':_0x971a('0x21')}]})[_0x971a('0xb')](function(_0x19e856){if(!_0x19e856){throw new Error(_0x971a('0x22'));}var _0x533ac0={'tls':{'rejectUnauthorized':![]}};if(_0x19e856[_0x971a('0x21')]['service']){_0x533ac0['service']=_0x19e856[_0x971a('0x21')]['service'];}else{_0x533ac0[_0x971a('0x23')]=_0x19e856[_0x971a('0x21')][_0x971a('0x23')];_0x533ac0['port']=_0x19e856[_0x971a('0x21')][_0x971a('0x24')];_0x533ac0['secure']=_0x19e856[_0x971a('0x21')]['secure'];}if(_0x19e856['Smtp'][_0x971a('0x25')]){_0x533ac0[_0x971a('0x26')]={'user':_0x19e856['Smtp']['user'],'pass':_0x19e856['Smtp']['pass']};}var _0x373216={'account':_0x533ac0,'message':_[_0x971a('0x27')]({'from':util[_0x971a('0x28')](_0x971a('0x29'),_0x19e856[_0x971a('0xd')],_0x19e856['email']||_0x19e856[_0x971a('0x21')][_0x971a('0x15')])},_0x265052)};return client['request'](_0x971a('0x2a'),_0x373216);})[_0x971a('0xb')](function(_0x595fcf){if(_0x595fcf[_0x971a('0x2b')]){throw new Error(util[_0x971a('0x28')](_0x971a('0x2c'),_0x595fcf['error']['message']||JSON[_0x971a('0x2d')](_0x595fcf[_0x971a('0x2b')])));}return!![];});}function handleError(_0x9bec4,_0x30f5e2,_0x4b1ad8){return _0x9bec4['status'](_0x30f5e2||0x1f4)[_0x971a('0x2e')]({'message':_0x4b1ad8?_0x4b1ad8[_0x971a('0x2f')]||_0x4b1ad8:''});}function checkPasswordPattern(_0x3c5079,_0x102ec1,_0x2c72ab){if(_0x2c72ab){var _0x4b6da6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4b6da6[_0x971a('0x30')](_0x102ec1)){return _0x3c5079;}else{throw new Error(_0x971a('0x31'));}}else{return _0x3c5079;}}exports[_0x971a('0x32')]=function(_0x1fbb52,_0x17c6d1,_0x12c3c0){passport[_0x971a('0x33')](_0x971a('0x34'),function(_0x4690bf,_0x121026,_0x37afc1){var _0x357745=_0x4690bf||_0x37afc1;if(_0x357745){return handleError(_0x17c6d1,0x191,_0x357745);}if(!_0x121026){return handleError(_0x17c6d1,0x194,{'message':_0x971a('0x35')});}else{var _0x2bd094={'payload':{'id':_0x121026['id'],'role':_0x121026[_0x971a('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0x971a('0x36')](_0x2bd094)[_0x971a('0xb')](function(_0x5ef847){_0x17c6d1[_0x971a('0x37')]({'id':_0x121026['id'],'token':_0x5ef847,'statusCall':'','isAlreadyLogged':_0x121026[_0x971a('0x38')]});});}})(_0x1fbb52,_0x17c6d1,_0x12c3c0);};exports['forgot']=function(_0x38584b,_0xab8d48,_0x458642){if(!_0x38584b[_0x971a('0x39')][_0x971a('0x1f')]){return handleError(_0xab8d48,0x1f4,{'message':_0x971a('0x3a')});}var _0x4e27a7=rs['generate']();_0x38584b[_0x971a('0x39')]['email']=_0x38584b[_0x971a('0x39')][_0x971a('0x1f')]['trim']()['toLowerCase']();var _0x1fd80e;return db[_0x971a('0x8')][_0x971a('0xc')]({'where':{'id':0x1},'attributes':[_0x971a('0x9'),_0x971a('0xa')],'raw':!![]})[_0x971a('0xb')](function(_0x3132bf){_0x1fd80e=_0x3132bf;return db[_0x971a('0x3b')][_0x971a('0x1e')]({'where':{'email':_0x38584b['body']['email']}});})['then'](function(_0x58ab25){if(!_0x58ab25){throw new Error(_0x971a('0x3c'));}if(_0x58ab25[_0x971a('0x11')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x58ab25[_0x971a('0x12')]){if(moment(_0x58ab25[_0x971a('0x13')])['add'](_0x1fd80e['blockDuration'],'minutes')>moment()){throw new Error(_0x971a('0x3d'));}else{_0x58ab25['blocked']=![];_0x58ab25['blockedAt']=null;}}_0x58ab25[_0x971a('0x3e')]=_0x4e27a7;_0x58ab25[_0x971a('0x3f')]=Date[_0x971a('0x40')]()+0x36ee80;return _0x58ab25['save']();})[_0x971a('0xb')](function(){return sendServiceMail({'to':_0x38584b['body'][_0x971a('0x1f')],'subject':_0x971a('0x41'),'text':_0x971a('0x42')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x971a('0x43')+_0x38584b[_0x971a('0x44')][_0x971a('0x23')]+_0x971a('0x45')+_0x4e27a7+'\x0a\x0a'+_0x971a('0x46')});})[_0x971a('0xb')](function(){_0xab8d48['status'](0xc8)[_0x971a('0x2e')]({'message':'Reset\x20Email\x20sent!'});})[_0x971a('0x1c')](function(_0x167ffa){return handleError(_0xab8d48,0x1f4,_0x167ffa);});};exports['reset']=function(_0xe65d03,_0x29282f,_0x19240b){var _0x30b745;return db[_0x971a('0x3b')]['find']({'where':{'resetPasswordToken':_0xe65d03[_0x971a('0x47')][_0x971a('0x48')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x971a('0xb')](function(_0xdaf0a0){_0x30b745=_0xdaf0a0;if(!_0x30b745){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x971a('0x8')][_0x971a('0xc')]({'attributes':['id',_0x971a('0x49')]});})[_0x971a('0xb')](function(_0x49a41d){return checkPasswordPattern(_0x49a41d,_0xe65d03[_0x971a('0x39')][_0x971a('0xe')],_0x49a41d['securePassword']);})[_0x971a('0xb')](function(){_0x30b745['password']=_0xe65d03[_0x971a('0x39')][_0x971a('0xe')];_0x30b745[_0x971a('0x3e')]=null;_0x30b745[_0x971a('0x3f')]=null;return _0x30b745[_0x971a('0x4a')]();})[_0x971a('0xb')](function(){_0x29282f[_0x971a('0x4b')](0xc8)[_0x971a('0x2e')]({'message':_0x971a('0x4c')});})[_0x971a('0x1c')](function(_0x6c41b6){return handleError(_0x29282f,0x1f4,_0x6c41b6);});};passport[_0x971a('0x4d')](new LocalStrategy({'usernameField':_0x971a('0xd'),'passwordField':_0x971a('0xe')},function(_0xfd9a6d,_0x20a52a,_0x7e2bfa){return localAuthenticate(db['User'],_0xfd9a6d,_0x20a52a,_0x7e2bfa);})); \ No newline at end of file +var _0x5664=['token','now','securePassword','password','resetPasswordToken','Password\x20reset!','use','util','passport','passport-local','Strategy','lodash','randomstring','moment','../../mysqldb','../../config/utils','client','http','Setting','findOne','blockDuration','name','salt','role','disabled','blocked','blockedAt','then','authenticate','loginAttempts','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','add','minutes','clearBlockUser','allowedLoginAttempts','getLicense','catch','MailAccount','find','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','auth','user','pass','merge','format','\x22%s\x22\x20<%s>','email','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','test','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','forgot','body','generate','trim','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','http://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','User','params'];(function(_0x127c3c,_0x4d3b3b){var _0x9902ac=function(_0x37162b){while(--_0x37162b){_0x127c3c['push'](_0x127c3c['shift']());}};_0x9902ac(++_0x4d3b3b);}(_0x5664,0x1ab));var _0x4566=function(_0x437d7f,_0x1feb46){_0x437d7f=_0x437d7f-0x0;var _0x31058c=_0x5664[_0x437d7f];return _0x31058c;};'use strict';var util=require(_0x4566('0x0'));var passport=require(_0x4566('0x1'));var LocalStrategy=require(_0x4566('0x2'))[_0x4566('0x3')];var jayson=require('jayson/promise');var _=require(_0x4566('0x4'));var rs=require(_0x4566('0x5'));var moment=require(_0x4566('0x6'));var db=require(_0x4566('0x7'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x4566('0x8'));var client=jayson[_0x4566('0x9')][_0x4566('0xa')]({'port':0x232b});function localAuthenticate(_0x3b21e6,_0x5320b5,_0x30afd1,_0xd07cf0){var _0x563977,_0x2e9886;return db[_0x4566('0xb')][_0x4566('0xc')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x4566('0xd')],'raw':!![]})['then'](function(_0x36aea5){_0x563977=_0x36aea5;return _0x3b21e6[_0x4566('0xc')]({'attributes':['id',_0x4566('0xe'),'password',_0x4566('0xf'),_0x4566('0x10'),_0x4566('0x11'),_0x4566('0x12'),_0x4566('0x13'),'loginAttempts'],'where':{'name':_0x5320b5,'role':{'$or':['admin','user','agent']}}});})[_0x4566('0x14')](function(_0x644877){if(!_0x644877||_0x644877&&_0x644877[_0x4566('0xe')]!==_0x5320b5){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x2e9886=_0x644877;return _0x2e9886;}})['then'](function(){_0x2e9886[_0x4566('0x15')](_0x30afd1,function(_0x40df03,_0x45dbfe){var _0x3c337d=_0x2e9886[_0x4566('0x16')]+0x1;if(_0x40df03){return _0xd07cf0(_0x40df03);}else if(!_0x45dbfe){if(_0x2e9886[_0x4566('0x11')]){return _0xd07cf0(null,![],{'message':_0x4566('0x17')});}else if(_0x563977['allowedLoginAttempts']>0x0){if(_0x2e9886['blocked']){if(_0x563977['blockDuration']>0x0){if(moment(_0x2e9886[_0x4566('0x13')])[_0x4566('0x18')](_0x563977[_0x4566('0xd')],_0x4566('0x19'))>moment()){return _0xd07cf0(null,![],{'message':_0x4566('0x17')});}else{return utils[_0x4566('0x1a')](_0x2e9886,_0x3c337d,![],null)[_0x4566('0x14')](function(){return _0xd07cf0(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0xd07cf0(null,![],{'message':_0x4566('0x17')});}}else{if(_0x3c337d>=_0x563977[_0x4566('0x1b')]){return utils['clearBlockUser'](_0x2e9886,0x0,!![],moment())[_0x4566('0x14')](function(){return _0xd07cf0(null,![],{'message':_0x4566('0x17')});});}else{return utils[_0x4566('0x1a')](_0x2e9886,_0x3c337d,![],null)[_0x4566('0x14')](function(){return _0xd07cf0(null,![],{'message':_0x4566('0x17')});});}}}else{return _0xd07cf0(null,![],{'message':_0x4566('0x17')});}}else{if(_0x2e9886[_0x4566('0x11')]){return _0xd07cf0(null,![],{'message':_0x4566('0x17')});}else if(_0x563977[_0x4566('0x1b')]>0x0){if(_0x2e9886[_0x4566('0x12')]){if(_0x563977['blockDuration']>0x0){if(moment(_0x2e9886['blockedAt'])[_0x4566('0x18')](_0x563977['blockDuration'],_0x4566('0x19'))>moment()){return _0xd07cf0(null,![],{'message':_0x4566('0x17')});}else{return utils[_0x4566('0x1a')](_0x2e9886,0x0,![],null)[_0x4566('0x14')](function(){return utils[_0x4566('0x1c')](_0x2e9886);})[_0x4566('0x14')](function(){return _0xd07cf0(null,_0x2e9886);});}}else{return _0xd07cf0(null,![],{'message':_0x4566('0x17')});}}else{return utils[_0x4566('0x1a')](_0x2e9886,0x0,![],null)[_0x4566('0x14')](function(){return utils[_0x4566('0x1c')](_0x2e9886);})[_0x4566('0x14')](function(){return _0xd07cf0(null,_0x2e9886);})[_0x4566('0x1d')](function(_0x5b7153){return _0xd07cf0(null,![],_0x5b7153);});}}else{if(_0x2e9886[_0x4566('0x12')]){return _0xd07cf0(null,![],{'message':_0x4566('0x17')});}else{return utils['getLicense'](_0x2e9886)[_0x4566('0x14')](function(){return _0xd07cf0(null,_0x2e9886);});}}}});})['catch'](function(_0xade498){return _0xd07cf0(null,![],_0xade498);});}function sendServiceMail(_0x2cf5aa){return db[_0x4566('0x1e')][_0x4566('0x1f')]({'where':{'service':!![]},'attributes':['id',_0x4566('0xe'),'email'],'include':[{'model':db[_0x4566('0x20')],'as':_0x4566('0x21')}]})['then'](function(_0x3d7fc6){if(!_0x3d7fc6){throw new Error(_0x4566('0x22'));}var _0x3b55ea={'tls':{'rejectUnauthorized':![]}};if(_0x3d7fc6[_0x4566('0x21')]['service']){_0x3b55ea[_0x4566('0x23')]=_0x3d7fc6['Smtp'][_0x4566('0x23')];}else{_0x3b55ea[_0x4566('0x24')]=_0x3d7fc6[_0x4566('0x21')]['host'];_0x3b55ea[_0x4566('0x25')]=_0x3d7fc6[_0x4566('0x21')][_0x4566('0x25')];_0x3b55ea[_0x4566('0x26')]=_0x3d7fc6['Smtp'][_0x4566('0x26')];}if(_0x3d7fc6['Smtp']['authentication']){_0x3b55ea[_0x4566('0x27')]={'user':_0x3d7fc6['Smtp'][_0x4566('0x28')],'pass':_0x3d7fc6['Smtp'][_0x4566('0x29')]};}var _0x22a11d={'account':_0x3b55ea,'message':_[_0x4566('0x2a')]({'from':util[_0x4566('0x2b')](_0x4566('0x2c'),_0x3d7fc6[_0x4566('0xe')],_0x3d7fc6[_0x4566('0x2d')]||_0x3d7fc6[_0x4566('0x21')][_0x4566('0x28')])},_0x2cf5aa)};return client[_0x4566('0x2e')](_0x4566('0x2f'),_0x22a11d);})[_0x4566('0x14')](function(_0xf17b73){if(_0xf17b73[_0x4566('0x30')]){throw new Error(util['format'](_0x4566('0x31'),_0xf17b73['error'][_0x4566('0x32')]||JSON[_0x4566('0x33')](_0xf17b73[_0x4566('0x30')])));}return!![];});}function handleError(_0x149813,_0x289b7f,_0x3bfaa8){return _0x149813[_0x4566('0x34')](_0x289b7f||0x1f4)[_0x4566('0x35')]({'message':_0x3bfaa8?_0x3bfaa8[_0x4566('0x32')]||_0x3bfaa8:''});}function checkPasswordPattern(_0x28ff51,_0x15b0e5,_0x20dfeb){if(_0x20dfeb){var _0x3fc9e2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3fc9e2[_0x4566('0x36')](_0x15b0e5)){return _0x28ff51;}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 _0x28ff51;}}exports[_0x4566('0x37')]=function(_0x2e9095,_0x560c31,_0x12aae6){passport['authenticate'](_0x4566('0x38'),function(_0x18a79c,_0x2dcd1a,_0x358814){var _0x23137e=_0x18a79c||_0x358814;if(_0x23137e){return handleError(_0x560c31,0x191,_0x23137e);}if(!_0x2dcd1a){return handleError(_0x560c31,0x194,{'message':_0x4566('0x39')});}else{var _0x119c70={'payload':{'id':_0x2dcd1a['id'],'role':_0x2dcd1a['role']},'options':{'expiresIn':0x15180}};return authService[_0x4566('0x3a')](_0x119c70)[_0x4566('0x14')](function(_0x2bc966){_0x560c31['json']({'id':_0x2dcd1a['id'],'token':_0x2bc966,'statusCall':'','isAlreadyLogged':_0x2dcd1a['online']});});}})(_0x2e9095,_0x560c31,_0x12aae6);};exports[_0x4566('0x3b')]=function(_0xedf24,_0xa09232,_0x1f0cdd){if(!_0xedf24[_0x4566('0x3c')][_0x4566('0x2d')]){return handleError(_0xa09232,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x30c495=rs[_0x4566('0x3d')]();_0xedf24[_0x4566('0x3c')][_0x4566('0x2d')]=_0xedf24[_0x4566('0x3c')][_0x4566('0x2d')][_0x4566('0x3e')]()['toLowerCase']();var _0x3977d2;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0x4566('0x1b'),'blockDuration'],'raw':!![]})[_0x4566('0x14')](function(_0x214e51){_0x3977d2=_0x214e51;return db['User'][_0x4566('0x1f')]({'where':{'email':_0xedf24['body'][_0x4566('0x2d')]}});})[_0x4566('0x14')](function(_0x3e0826){if(!_0x3e0826){throw new Error(_0x4566('0x3f'));}if(_0x3e0826[_0x4566('0x11')]){throw new Error(_0x4566('0x40'));}if(_0x3e0826[_0x4566('0x12')]){if(moment(_0x3e0826[_0x4566('0x13')])['add'](_0x3977d2[_0x4566('0xd')],_0x4566('0x19'))>moment()){throw new Error(_0x4566('0x41'));}else{_0x3e0826[_0x4566('0x12')]=![];_0x3e0826[_0x4566('0x13')]=null;}}_0x3e0826['resetPasswordToken']=_0x30c495;_0x3e0826['resetPasswordExpires']=Date['now']()+0x36ee80;return _0x3e0826[_0x4566('0x42')]();})[_0x4566('0x14')](function(){return sendServiceMail({'to':_0xedf24['body']['email'],'subject':_0x4566('0x43'),'text':_0x4566('0x44')+_0x4566('0x45')+_0x4566('0x46')+_0xedf24[_0x4566('0x47')]['host']+_0x4566('0x48')+_0x30c495+'\x0a\x0a'+_0x4566('0x49')});})[_0x4566('0x14')](function(){_0xa09232['status'](0xc8)[_0x4566('0x35')]({'message':'Reset\x20Email\x20sent!'});})[_0x4566('0x1d')](function(_0x5c0dcc){return handleError(_0xa09232,0x1f4,_0x5c0dcc);});};exports[_0x4566('0x4a')]=function(_0x1ba99b,_0x43aa05,_0x1240ab){var _0x5acbc7;return db[_0x4566('0x4b')][_0x4566('0x1f')]({'where':{'resetPasswordToken':_0x1ba99b[_0x4566('0x4c')][_0x4566('0x4d')],'resetPasswordExpires':{'$gt':Date[_0x4566('0x4e')]()}}})['then'](function(_0x2aa043){_0x5acbc7=_0x2aa043;if(!_0x5acbc7){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x4566('0xb')]['findOne']({'attributes':['id',_0x4566('0x4f')]});})[_0x4566('0x14')](function(_0x490ac8){return checkPasswordPattern(_0x490ac8,_0x1ba99b['body'][_0x4566('0x50')],_0x490ac8[_0x4566('0x4f')]);})[_0x4566('0x14')](function(){_0x5acbc7['password']=_0x1ba99b[_0x4566('0x3c')][_0x4566('0x50')];_0x5acbc7[_0x4566('0x51')]=null;_0x5acbc7['resetPasswordExpires']=null;return _0x5acbc7[_0x4566('0x42')]();})[_0x4566('0x14')](function(){_0x43aa05['status'](0xc8)[_0x4566('0x35')]({'message':_0x4566('0x52')});})[_0x4566('0x1d')](function(_0x11d980){return handleError(_0x43aa05,0x1f4,_0x11d980);});};passport[_0x4566('0x53')](new LocalStrategy({'usernameField':_0x4566('0xe'),'passwordField':_0x4566('0x50')},function(_0x5145bf,_0x2938e9,_0x2ac98a){return localAuthenticate(db['User'],_0x5145bf,_0x2938e9,_0x2ac98a);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 8abecf3..5d27535 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 _0x50c6=['reset','express','Router','post','login','forgot','/reset/:token'];(function(_0x36a5c9,_0x7b3c53){var _0xa02505=function(_0x253920){while(--_0x253920){_0x36a5c9['push'](_0x36a5c9['shift']());}};_0xa02505(++_0x7b3c53);}(_0x50c6,0x71));var _0x650c=function(_0x3aa3c1,_0x57fef1){_0x3aa3c1=_0x3aa3c1-0x0;var _0xf24090=_0x50c6[_0x3aa3c1];return _0xf24090;};'use strict';var express=require(_0x650c('0x0'));var router=express[_0x650c('0x1')]();var controller=require('./authLocal.controller');router[_0x650c('0x2')]('/',controller[_0x650c('0x3')]);router[_0x650c('0x2')]('/forgot',controller[_0x650c('0x4')]);router[_0x650c('0x2')](_0x650c('0x5'),controller[_0x650c('0x6')]);module['exports']=router; \ No newline at end of file +var _0x8636=['exports','Router','./authLocal.controller','post','login','/forgot','forgot','/reset/:token','reset'];(function(_0x46e114,_0x34049a){var _0x29cf07=function(_0x43efe2){while(--_0x43efe2){_0x46e114['push'](_0x46e114['shift']());}};_0x29cf07(++_0x34049a);}(_0x8636,0xc7));var _0x6863=function(_0xfc7019,_0x277c9e){_0xfc7019=_0xfc7019-0x0;var _0x2af8f4=_0x8636[_0xfc7019];return _0x2af8f4;};'use strict';var express=require('express');var router=express[_0x6863('0x0')]();var controller=require(_0x6863('0x1'));router[_0x6863('0x2')]('/',controller[_0x6863('0x3')]);router[_0x6863('0x2')](_0x6863('0x4'),controller[_0x6863('0x5')]);router[_0x6863('0x2')](_0x6863('0x6'),controller[_0x6863('0x7')]);module[_0x6863('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 7bf2e7b..8d19756 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 _0x46e5=['INTEGER','sequelize','STRING','BOOLEAN'];(function(_0x3063f4,_0x3a2dde){var _0x57fa53=function(_0x10ff4a){while(--_0x10ff4a){_0x3063f4['push'](_0x3063f4['shift']());}};_0x57fa53(++_0x3a2dde);}(_0x46e5,0xbd));var _0x546e=function(_0x54112f,_0x597d77){_0x54112f=_0x54112f-0x0;var _0x106968=_0x46e5[_0x54112f];return _0x106968;};'use strict';var Sequelize=require(_0x546e('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x546e('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x546e('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x546e('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x7d96=['STRING','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7d96,0xe4));var _0x67d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7d96[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x67d9('0x0'));module[_0x67d9('0x1')]={'name':{'type':Sequelize[_0x67d9('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x67d9('0x2')]},'description':{'type':Sequelize[_0x67d9('0x2')]},'status':{'type':Sequelize[_0x67d9('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x67d9('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index c1b303e..aea115f 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 _0x7e10=['lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Automation','includeAll','catch','show','params','include','find','create','body','destroy','addConditions','Condition','ids','getConditions','findOne','addActions','Action','getActions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs'];(function(_0x5ad294,_0x1477c7){var _0x20a450=function(_0x3fa506){while(--_0x3fa506){_0x5ad294['push'](_0x5ad294['shift']());}};_0x20a450(++_0x1477c7);}(_0x7e10,0x9c));var _0x07e1=function(_0xff1909,_0x5bc502){_0xff1909=_0xff1909-0x0;var _0x579767=_0x7e10[_0xff1909];return _0x579767;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x07e1('0x0'));var rimraf=require(_0x07e1('0x1'));var zipdir=require(_0x07e1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x07e1('0x3'));var moment=require(_0x07e1('0x4'));var BPromise=require(_0x07e1('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x07e1('0x6'));var sox=require(_0x07e1('0x7'));var csv=require(_0x07e1('0x8'));var ejs=require(_0x07e1('0x9'));var fs=require('fs');var _=require(_0x07e1('0xa'));var squel=require(_0x07e1('0xb'));var crypto=require('crypto');var jsforce=require(_0x07e1('0xc'));var deskjs=require(_0x07e1('0xd'));var toCsv=require('to-csv');var querystring=require(_0x07e1('0xe'));var Papa=require(_0x07e1('0xf'));var Redis=require('ioredis');var authService=require(_0x07e1('0x10'));var qs=require(_0x07e1('0x11'));var as=require(_0x07e1('0x12'));var hardwareService=require(_0x07e1('0x13'));var logger=require(_0x07e1('0x14'))(_0x07e1('0x15'));var utils=require(_0x07e1('0x16'));var config=require('../../config/environment');var db=require(_0x07e1('0x17'))['db'];function respondWithStatusCode(_0x444b9d,_0x494443){_0x494443=_0x494443||0xcc;return function(_0x42a806){if(_0x42a806){return _0x444b9d[_0x07e1('0x18')](_0x494443);}return _0x444b9d[_0x07e1('0x19')](_0x494443)[_0x07e1('0x1a')]();};}function respondWithResult(_0x26f5ff,_0x5173d4){_0x5173d4=_0x5173d4||0xc8;return function(_0x60260c){if(_0x60260c){return _0x26f5ff[_0x07e1('0x19')](_0x5173d4)[_0x07e1('0x1b')](_0x60260c);}};}function respondWithFilteredResult(_0x2cc8a7,_0x5907aa){return function(_0x43a7d4){if(_0x43a7d4){var _0x505ac6=_0x43a7d4[_0x07e1('0x1c')],_0x1b9547=_0x5907aa[_0x07e1('0x1d')],_0x448ea5=_0x5907aa[_0x07e1('0x1d')]+_0x5907aa[_0x07e1('0x1e')],_0x191c14;if(_0x448ea5>=_0x505ac6){_0x448ea5=_0x505ac6;_0x191c14=0xc8;}else{_0x191c14=0xce;}_0x2cc8a7[_0x07e1('0x19')](_0x191c14);return _0x2cc8a7[_0x07e1('0x1f')](_0x07e1('0x20'),_0x1b9547+'-'+_0x448ea5+'/'+_0x505ac6)[_0x07e1('0x1b')](_0x43a7d4);}return null;};}function patchUpdates(_0x484bb6){return function(_0x519cd5){try{jsonpatch[_0x07e1('0x21')](_0x519cd5,_0x484bb6,!![]);}catch(_0x22049b){return BPromise[_0x07e1('0x22')](_0x22049b);}return _0x519cd5[_0x07e1('0x23')]();};}function saveUpdates(_0x70eb19,_0x5c2772){return function(_0x2e8d02){if(_0x2e8d02){return _0x2e8d02[_0x07e1('0x24')](_0x70eb19)[_0x07e1('0x25')](function(_0x1c4878){return _0x1c4878;});}return null;};}function removeEntity(_0x2dde20,_0x4f980b){return function(_0x109ef6){if(_0x109ef6){return _0x109ef6['destroy']()[_0x07e1('0x25')](function(){_0x2dde20[_0x07e1('0x19')](0xcc)[_0x07e1('0x1a')]();});}};}function handleEntityNotFound(_0xbc4f65,_0x96ca84){return function(_0x3c01c0){if(!_0x3c01c0){_0xbc4f65[_0x07e1('0x18')](0x194);}return _0x3c01c0;};}function handleError(_0x3cfe35,_0x4d1e06){_0x4d1e06=_0x4d1e06||0x1f4;return function(_0x1984b7){logger[_0x07e1('0x26')](_0x1984b7['stack']);if(_0x1984b7['name']){delete _0x1984b7[_0x07e1('0x27')];}_0x3cfe35[_0x07e1('0x19')](_0x4d1e06)[_0x07e1('0x28')](_0x1984b7);};}exports[_0x07e1('0x29')]=function(_0x3a13c4,_0x1ce134){var _0x38ad81={},_0x205fe1={},_0x30934a={'count':0x0,'rows':[]};var _0x37a0a7=_['map'](db['Automation'][_0x07e1('0x2a')],function(_0x57823e){return{'name':_0x57823e[_0x07e1('0x2b')],'type':_0x57823e[_0x07e1('0x2c')][_0x07e1('0x2d')]};});_0x205fe1[_0x07e1('0x2e')]=_[_0x07e1('0x2f')](_0x37a0a7,_0x07e1('0x27'));_0x205fe1[_0x07e1('0x30')]=_[_0x07e1('0x31')](_0x3a13c4[_0x07e1('0x30')]);_0x205fe1[_0x07e1('0x32')]=_[_0x07e1('0x33')](_0x205fe1[_0x07e1('0x2e')],_0x205fe1['query']);_0x38ad81[_0x07e1('0x34')]=_[_0x07e1('0x33')](_0x205fe1[_0x07e1('0x2e')],qs[_0x07e1('0x35')](_0x3a13c4[_0x07e1('0x30')][_0x07e1('0x35')]));_0x38ad81[_0x07e1('0x34')]=_0x38ad81['attributes'][_0x07e1('0x36')]?_0x38ad81[_0x07e1('0x34')]:_0x205fe1['model'];if(!_0x3a13c4['query'][_0x07e1('0x37')](_0x07e1('0x38'))){_0x38ad81[_0x07e1('0x1e')]=qs[_0x07e1('0x1e')](_0x3a13c4[_0x07e1('0x30')][_0x07e1('0x1e')]);_0x38ad81['offset']=qs['offset'](_0x3a13c4['query'][_0x07e1('0x1d')]);}_0x38ad81[_0x07e1('0x39')]=qs[_0x07e1('0x3a')](_0x3a13c4[_0x07e1('0x30')][_0x07e1('0x3a')]);_0x38ad81[_0x07e1('0x3b')]=qs[_0x07e1('0x32')](_[_0x07e1('0x3c')](_0x3a13c4[_0x07e1('0x30')],_0x205fe1['filters']));if(_0x3a13c4[_0x07e1('0x30')][_0x07e1('0x3d')]){_0x38ad81[_0x07e1('0x3b')]=_[_0x07e1('0x3e')](_0x38ad81[_0x07e1('0x3b')],{'$or':_[_0x07e1('0x2f')](_0x37a0a7,function(_0x578684){if(_0x578684[_0x07e1('0x2c')]!==_0x07e1('0x3f')){var _0x28a714={};_0x28a714[_0x578684[_0x07e1('0x27')]]={'$like':'%'+_0x3a13c4['query'][_0x07e1('0x3d')]+'%'};return _0x28a714;}})});}_0x38ad81=_['merge']({},_0x38ad81,_0x3a13c4[_0x07e1('0x40')]);var _0x2c6944={'where':_0x38ad81['where']};return db[_0x07e1('0x41')][_0x07e1('0x1c')](_0x2c6944)['then'](function(_0x1fa9b7){_0x30934a['count']=_0x1fa9b7;if(_0x3a13c4['query'][_0x07e1('0x42')]){_0x38ad81['include']=[{'all':!![]}];}return db[_0x07e1('0x41')]['findAll'](_0x38ad81);})['then'](function(_0x3f3090){_0x30934a['rows']=_0x3f3090;return _0x30934a;})['then'](respondWithFilteredResult(_0x1ce134,_0x38ad81))[_0x07e1('0x43')](handleError(_0x1ce134,null));};exports[_0x07e1('0x44')]=function(_0x3b1acc,_0x539760){var _0x489e94={'raw':![],'where':{'id':_0x3b1acc[_0x07e1('0x45')]['id']}},_0x207434={};_0x207434[_0x07e1('0x2e')]=_['keys'](db[_0x07e1('0x41')][_0x07e1('0x2a')]);_0x207434['query']=_[_0x07e1('0x31')](_0x3b1acc[_0x07e1('0x30')]);_0x207434[_0x07e1('0x32')]=_[_0x07e1('0x33')](_0x207434['model'],_0x207434[_0x07e1('0x30')]);_0x489e94[_0x07e1('0x34')]=_[_0x07e1('0x33')](_0x207434[_0x07e1('0x2e')],qs[_0x07e1('0x35')](_0x3b1acc[_0x07e1('0x30')]['fields']));_0x489e94[_0x07e1('0x34')]=_0x489e94['attributes'][_0x07e1('0x36')]?_0x489e94[_0x07e1('0x34')]:_0x207434[_0x07e1('0x2e')];if(_0x3b1acc[_0x07e1('0x30')][_0x07e1('0x42')]){_0x489e94[_0x07e1('0x46')]=[{'all':!![]}];}_0x489e94=_[_0x07e1('0x3e')]({},_0x489e94,_0x3b1acc[_0x07e1('0x40')]);return db['Automation'][_0x07e1('0x47')](_0x489e94)[_0x07e1('0x25')](handleEntityNotFound(_0x539760,null))['then'](respondWithResult(_0x539760,null))[_0x07e1('0x43')](handleError(_0x539760,null));};exports[_0x07e1('0x48')]=function(_0x1ff48f,_0x49b8d0){return db[_0x07e1('0x41')][_0x07e1('0x48')](_0x1ff48f['body'],{})[_0x07e1('0x25')](respondWithResult(_0x49b8d0,0xc9))[_0x07e1('0x43')](handleError(_0x49b8d0,null));};exports['update']=function(_0x1b67c3,_0x4960fd){if(_0x1b67c3[_0x07e1('0x49')]['id']){delete _0x1b67c3[_0x07e1('0x49')]['id'];}return db[_0x07e1('0x41')][_0x07e1('0x47')]({'where':{'id':_0x1b67c3[_0x07e1('0x45')]['id']}})[_0x07e1('0x25')](handleEntityNotFound(_0x4960fd,null))[_0x07e1('0x25')](saveUpdates(_0x1b67c3[_0x07e1('0x49')],null))[_0x07e1('0x25')](respondWithResult(_0x4960fd,null))[_0x07e1('0x43')](handleError(_0x4960fd,null));};exports[_0x07e1('0x4a')]=function(_0x175186,_0x5456ce){return db[_0x07e1('0x41')][_0x07e1('0x47')]({'where':{'id':_0x175186[_0x07e1('0x45')]['id']}})[_0x07e1('0x25')](handleEntityNotFound(_0x5456ce,null))[_0x07e1('0x25')](removeEntity(_0x5456ce,null))['catch'](handleError(_0x5456ce,null));};exports[_0x07e1('0x4b')]=function(_0xd478dd,_0x1c5cbe,_0x39b880){return db[_0x07e1('0x4c')][_0x07e1('0x47')]({'where':{'id':_0xd478dd[_0x07e1('0x45')]['id']}})[_0x07e1('0x25')](handleEntityNotFound(_0x1c5cbe,null))[_0x07e1('0x25')](function(_0x51ed3f){if(_0x51ed3f){return _0x51ed3f[_0x07e1('0x4b')](_0xd478dd[_0x07e1('0x49')][_0x07e1('0x4d')],_['omit'](_0xd478dd[_0x07e1('0x49')],[_0x07e1('0x4d'),'id'])||{});}})[_0x07e1('0x25')](respondWithResult(_0x1c5cbe,null))[_0x07e1('0x43')](handleError(_0x1c5cbe,null));};exports[_0x07e1('0x4e')]=function(_0x2049db,_0x2cadc4,_0x16bc54){var _0x50540b={};var _0x38d65d={};var _0x4f852f;var _0x4743fe;return db['Automation'][_0x07e1('0x4f')]({'where':{'id':_0x2049db[_0x07e1('0x45')]['id']}})['then'](handleEntityNotFound(_0x2cadc4,null))[_0x07e1('0x25')](function(_0x131cfa){if(_0x131cfa){_0x4f852f=_0x131cfa;_0x38d65d['model']=_[_0x07e1('0x31')](db[_0x07e1('0x4c')]['rawAttributes']);_0x38d65d[_0x07e1('0x30')]=_[_0x07e1('0x31')](_0x2049db['query']);_0x38d65d[_0x07e1('0x32')]=_[_0x07e1('0x33')](_0x38d65d[_0x07e1('0x2e')],_0x38d65d['query']);_0x50540b[_0x07e1('0x34')]=_[_0x07e1('0x33')](_0x38d65d[_0x07e1('0x2e')],qs[_0x07e1('0x35')](_0x2049db['query'][_0x07e1('0x35')]));_0x50540b[_0x07e1('0x34')]=_0x50540b[_0x07e1('0x34')]['length']?_0x50540b[_0x07e1('0x34')]:_0x38d65d[_0x07e1('0x2e')];_0x50540b[_0x07e1('0x39')]=qs[_0x07e1('0x3a')](_0x2049db[_0x07e1('0x30')]['sort']);_0x50540b[_0x07e1('0x3b')]=qs[_0x07e1('0x32')](_[_0x07e1('0x3c')](_0x2049db['query'],_0x38d65d['filters']));if(_0x2049db[_0x07e1('0x30')][_0x07e1('0x3d')]){_0x50540b[_0x07e1('0x3b')]=_['merge'](_0x50540b[_0x07e1('0x3b')],{'$or':_[_0x07e1('0x2f')](_0x50540b[_0x07e1('0x34')],function(_0x42cf10){var _0x47d07e={};_0x47d07e[_0x42cf10]={'$like':'%'+_0x2049db['query'][_0x07e1('0x3d')]+'%'};return _0x47d07e;})});}_0x50540b=_[_0x07e1('0x3e')]({},_0x50540b,_0x2049db[_0x07e1('0x40')]);return _0x4f852f[_0x07e1('0x4e')](_0x50540b);}})[_0x07e1('0x25')](function(_0x259feb){if(_0x259feb){_0x4743fe=_0x259feb['length'];if(!_0x2049db['query'][_0x07e1('0x37')](_0x07e1('0x38'))){_0x50540b[_0x07e1('0x1e')]=qs[_0x07e1('0x1e')](_0x2049db[_0x07e1('0x30')][_0x07e1('0x1e')]);_0x50540b[_0x07e1('0x1d')]=qs['offset'](_0x2049db['query'][_0x07e1('0x1d')]);}return _0x4f852f[_0x07e1('0x4e')](_0x50540b);}})[_0x07e1('0x25')](function(_0x1d1654){if(_0x1d1654){return _0x1d1654?{'count':_0x4743fe,'rows':_0x1d1654}:null;}})[_0x07e1('0x25')](respondWithResult(_0x2cadc4,null))['catch'](handleError(_0x2cadc4,null));};exports[_0x07e1('0x50')]=function(_0x4dab2c,_0x5bd529,_0x4c7ea6){return db[_0x07e1('0x51')][_0x07e1('0x47')]({'where':{'id':_0x4dab2c[_0x07e1('0x45')]['id']}})['then'](handleEntityNotFound(_0x5bd529,null))['then'](function(_0x5ae227){if(_0x5ae227){return _0x5ae227['addActions'](_0x4dab2c['body'][_0x07e1('0x4d')],_['omit'](_0x4dab2c['body'],[_0x07e1('0x4d'),'id'])||{});}})[_0x07e1('0x25')](respondWithResult(_0x5bd529,null))[_0x07e1('0x43')](handleError(_0x5bd529,null));};exports['getActions']=function(_0x16b279,_0x4fa9b3,_0x3f0c13){var _0x4c5ef2={};var _0x25f393={};var _0x5a0ffb;var _0x125f3e;return db['Automation']['findOne']({'where':{'id':_0x16b279[_0x07e1('0x45')]['id']}})[_0x07e1('0x25')](handleEntityNotFound(_0x4fa9b3,null))[_0x07e1('0x25')](function(_0x320dbb){if(_0x320dbb){_0x5a0ffb=_0x320dbb;_0x25f393[_0x07e1('0x2e')]=_[_0x07e1('0x31')](db['Action'][_0x07e1('0x2a')]);_0x25f393['query']=_[_0x07e1('0x31')](_0x16b279[_0x07e1('0x30')]);_0x25f393[_0x07e1('0x32')]=_[_0x07e1('0x33')](_0x25f393[_0x07e1('0x2e')],_0x25f393['query']);_0x4c5ef2[_0x07e1('0x34')]=_[_0x07e1('0x33')](_0x25f393['model'],qs[_0x07e1('0x35')](_0x16b279['query'][_0x07e1('0x35')]));_0x4c5ef2[_0x07e1('0x34')]=_0x4c5ef2[_0x07e1('0x34')][_0x07e1('0x36')]?_0x4c5ef2[_0x07e1('0x34')]:_0x25f393[_0x07e1('0x2e')];_0x4c5ef2[_0x07e1('0x39')]=qs['sort'](_0x16b279['query'][_0x07e1('0x3a')]);_0x4c5ef2[_0x07e1('0x3b')]=qs[_0x07e1('0x32')](_[_0x07e1('0x3c')](_0x16b279[_0x07e1('0x30')],_0x25f393[_0x07e1('0x32')]));if(_0x16b279[_0x07e1('0x30')][_0x07e1('0x3d')]){_0x4c5ef2[_0x07e1('0x3b')]=_[_0x07e1('0x3e')](_0x4c5ef2[_0x07e1('0x3b')],{'$or':_['map'](_0x4c5ef2[_0x07e1('0x34')],function(_0x36fea5){var _0x19a444={};_0x19a444[_0x36fea5]={'$like':'%'+_0x16b279[_0x07e1('0x30')][_0x07e1('0x3d')]+'%'};return _0x19a444;})});}_0x4c5ef2=_['merge']({},_0x4c5ef2,_0x16b279['options']);return _0x5a0ffb[_0x07e1('0x52')](_0x4c5ef2);}})[_0x07e1('0x25')](function(_0x27a229){if(_0x27a229){_0x125f3e=_0x27a229[_0x07e1('0x36')];if(!_0x16b279[_0x07e1('0x30')][_0x07e1('0x37')](_0x07e1('0x38'))){_0x4c5ef2[_0x07e1('0x1e')]=qs['limit'](_0x16b279['query']['limit']);_0x4c5ef2[_0x07e1('0x1d')]=qs['offset'](_0x16b279[_0x07e1('0x30')]['offset']);}return _0x5a0ffb[_0x07e1('0x52')](_0x4c5ef2);}})['then'](function(_0x5ca14e){if(_0x5ca14e){return _0x5ca14e?{'count':_0x125f3e,'rows':_0x5ca14e}:null;}})['then'](respondWithResult(_0x4fa9b3,null))[_0x07e1('0x43')](handleError(_0x4fa9b3,null));}; \ No newline at end of file +var _0xc60d=['then','end','error','stack','name','index','map','Automation','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','addConditions','Condition','ids','omit','getConditions','findOne','limit','addActions','Action','getActions','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','sox','to-csv','lodash','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','reject','save','update'];(function(_0x2d299b,_0x298102){var _0x4a1b80=function(_0x3e2d56){while(--_0x3e2d56){_0x2d299b['push'](_0x2d299b['shift']());}};_0x4a1b80(++_0x298102);}(_0xc60d,0xcb));var _0xdc60=function(_0x2c4cee,_0xed54d6){_0x2c4cee=_0x2c4cee-0x0;var _0x4cad54=_0xc60d[_0x2c4cee];return _0x4cad54;};'use strict';var pdf=require(_0xdc60('0x0'));var emlformat=require(_0xdc60('0x1'));var rimraf=require(_0xdc60('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdc60('0x3'));var rp=require('request-promise');var moment=require(_0xdc60('0x4'));var BPromise=require(_0xdc60('0x5'));var Mustache=require(_0xdc60('0x6'));var util=require('util');var path=require('path');var sox=require(_0xdc60('0x7'));var csv=require(_0xdc60('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdc60('0x9'));var squel=require(_0xdc60('0xa'));var crypto=require(_0xdc60('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xdc60('0xc'));var toCsv=require(_0xdc60('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xdc60('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xdc60('0xe'));var as=require(_0xdc60('0xf'));var hardwareService=require(_0xdc60('0x10'));var logger=require(_0xdc60('0x11'))('api');var utils=require(_0xdc60('0x12'));var config=require(_0xdc60('0x13'));var db=require(_0xdc60('0x14'))['db'];function respondWithStatusCode(_0x1faf08,_0x2b1c86){_0x2b1c86=_0x2b1c86||0xcc;return function(_0x3a1be3){if(_0x3a1be3){return _0x1faf08[_0xdc60('0x15')](_0x2b1c86);}return _0x1faf08['status'](_0x2b1c86)['end']();};}function respondWithResult(_0x207ef8,_0x59720b){_0x59720b=_0x59720b||0xc8;return function(_0x4a4875){if(_0x4a4875){return _0x207ef8[_0xdc60('0x16')](_0x59720b)[_0xdc60('0x17')](_0x4a4875);}};}function respondWithFilteredResult(_0x520ae7,_0x933cba){return function(_0x630b57){if(_0x630b57){var _0x4dfa01=_0x630b57[_0xdc60('0x18')],_0x2d7e9a=_0x933cba[_0xdc60('0x19')],_0x544c87=_0x933cba[_0xdc60('0x19')]+_0x933cba['limit'],_0x3a0276;if(_0x544c87>=_0x4dfa01){_0x544c87=_0x4dfa01;_0x3a0276=0xc8;}else{_0x3a0276=0xce;}_0x520ae7[_0xdc60('0x16')](_0x3a0276);return _0x520ae7[_0xdc60('0x1a')](_0xdc60('0x1b'),_0x2d7e9a+'-'+_0x544c87+'/'+_0x4dfa01)[_0xdc60('0x17')](_0x630b57);}return null;};}function patchUpdates(_0x33f50f){return function(_0x58a675){try{jsonpatch['apply'](_0x58a675,_0x33f50f,!![]);}catch(_0x548a77){return BPromise[_0xdc60('0x1c')](_0x548a77);}return _0x58a675[_0xdc60('0x1d')]();};}function saveUpdates(_0x3f6a7e,_0x21ae9f){return function(_0x33d5eb){if(_0x33d5eb){return _0x33d5eb[_0xdc60('0x1e')](_0x3f6a7e)[_0xdc60('0x1f')](function(_0x4b26a8){return _0x4b26a8;});}return null;};}function removeEntity(_0x3fa3a0,_0x246db6){return function(_0x38729a){if(_0x38729a){return _0x38729a['destroy']()[_0xdc60('0x1f')](function(){_0x3fa3a0[_0xdc60('0x16')](0xcc)[_0xdc60('0x20')]();});}};}function handleEntityNotFound(_0x3b4910,_0x4395f6){return function(_0x103c1f){if(!_0x103c1f){_0x3b4910['sendStatus'](0x194);}return _0x103c1f;};}function handleError(_0x22c0d7,_0x540084){_0x540084=_0x540084||0x1f4;return function(_0x29d337){logger[_0xdc60('0x21')](_0x29d337[_0xdc60('0x22')]);if(_0x29d337[_0xdc60('0x23')]){delete _0x29d337[_0xdc60('0x23')];}_0x22c0d7['status'](_0x540084)['send'](_0x29d337);};}exports[_0xdc60('0x24')]=function(_0x42b9d6,_0x2e5ad6){var _0xee179a={},_0xd34368={},_0x274ff2={'count':0x0,'rows':[]};var _0x4b7c66=_[_0xdc60('0x25')](db[_0xdc60('0x26')]['rawAttributes'],function(_0x2ad323){return{'name':_0x2ad323['fieldName'],'type':_0x2ad323[_0xdc60('0x27')]['key']};});_0xd34368['model']=_[_0xdc60('0x25')](_0x4b7c66,_0xdc60('0x23'));_0xd34368[_0xdc60('0x28')]=_[_0xdc60('0x29')](_0x42b9d6[_0xdc60('0x28')]);_0xd34368[_0xdc60('0x2a')]=_[_0xdc60('0x2b')](_0xd34368[_0xdc60('0x2c')],_0xd34368[_0xdc60('0x28')]);_0xee179a[_0xdc60('0x2d')]=_['intersection'](_0xd34368['model'],qs['fields'](_0x42b9d6['query'][_0xdc60('0x2e')]));_0xee179a['attributes']=_0xee179a[_0xdc60('0x2d')][_0xdc60('0x2f')]?_0xee179a[_0xdc60('0x2d')]:_0xd34368[_0xdc60('0x2c')];if(!_0x42b9d6[_0xdc60('0x28')][_0xdc60('0x30')](_0xdc60('0x31'))){_0xee179a['limit']=qs['limit'](_0x42b9d6[_0xdc60('0x28')]['limit']);_0xee179a[_0xdc60('0x19')]=qs[_0xdc60('0x19')](_0x42b9d6[_0xdc60('0x28')][_0xdc60('0x19')]);}_0xee179a[_0xdc60('0x32')]=qs[_0xdc60('0x33')](_0x42b9d6[_0xdc60('0x28')]['sort']);_0xee179a[_0xdc60('0x34')]=qs[_0xdc60('0x2a')](_[_0xdc60('0x35')](_0x42b9d6[_0xdc60('0x28')],_0xd34368[_0xdc60('0x2a')]));if(_0x42b9d6[_0xdc60('0x28')]['filter']){_0xee179a['where']=_[_0xdc60('0x36')](_0xee179a[_0xdc60('0x34')],{'$or':_[_0xdc60('0x25')](_0x4b7c66,function(_0x323511){if(_0x323511[_0xdc60('0x27')]!==_0xdc60('0x37')){var _0x19f79e={};_0x19f79e[_0x323511[_0xdc60('0x23')]]={'$like':'%'+_0x42b9d6[_0xdc60('0x28')][_0xdc60('0x38')]+'%'};return _0x19f79e;}})});}_0xee179a=_[_0xdc60('0x36')]({},_0xee179a,_0x42b9d6[_0xdc60('0x39')]);var _0x320545={'where':_0xee179a[_0xdc60('0x34')]};return db[_0xdc60('0x26')][_0xdc60('0x18')](_0x320545)[_0xdc60('0x1f')](function(_0x502951){_0x274ff2[_0xdc60('0x18')]=_0x502951;if(_0x42b9d6[_0xdc60('0x28')][_0xdc60('0x3a')]){_0xee179a[_0xdc60('0x3b')]=[{'all':!![]}];}return db[_0xdc60('0x26')][_0xdc60('0x3c')](_0xee179a);})['then'](function(_0x402c4c){_0x274ff2[_0xdc60('0x3d')]=_0x402c4c;return _0x274ff2;})[_0xdc60('0x1f')](respondWithFilteredResult(_0x2e5ad6,_0xee179a))[_0xdc60('0x3e')](handleError(_0x2e5ad6,null));};exports['show']=function(_0x6aa02e,_0x161280){var _0x388435={'raw':![],'where':{'id':_0x6aa02e[_0xdc60('0x3f')]['id']}},_0x3d32f2={};_0x3d32f2[_0xdc60('0x2c')]=_[_0xdc60('0x29')](db['Automation'][_0xdc60('0x40')]);_0x3d32f2[_0xdc60('0x28')]=_[_0xdc60('0x29')](_0x6aa02e[_0xdc60('0x28')]);_0x3d32f2[_0xdc60('0x2a')]=_[_0xdc60('0x2b')](_0x3d32f2[_0xdc60('0x2c')],_0x3d32f2['query']);_0x388435[_0xdc60('0x2d')]=_['intersection'](_0x3d32f2[_0xdc60('0x2c')],qs[_0xdc60('0x2e')](_0x6aa02e[_0xdc60('0x28')][_0xdc60('0x2e')]));_0x388435[_0xdc60('0x2d')]=_0x388435[_0xdc60('0x2d')][_0xdc60('0x2f')]?_0x388435[_0xdc60('0x2d')]:_0x3d32f2[_0xdc60('0x2c')];if(_0x6aa02e['query'][_0xdc60('0x3a')]){_0x388435['include']=[{'all':!![]}];}_0x388435=_[_0xdc60('0x36')]({},_0x388435,_0x6aa02e[_0xdc60('0x39')]);return db[_0xdc60('0x26')][_0xdc60('0x41')](_0x388435)[_0xdc60('0x1f')](handleEntityNotFound(_0x161280,null))[_0xdc60('0x1f')](respondWithResult(_0x161280,null))[_0xdc60('0x3e')](handleError(_0x161280,null));};exports[_0xdc60('0x42')]=function(_0x56ac9d,_0x5e48fd){return db[_0xdc60('0x26')]['create'](_0x56ac9d[_0xdc60('0x43')],{})[_0xdc60('0x1f')](respondWithResult(_0x5e48fd,0xc9))[_0xdc60('0x3e')](handleError(_0x5e48fd,null));};exports[_0xdc60('0x1e')]=function(_0x29c84a,_0x40185b){if(_0x29c84a['body']['id']){delete _0x29c84a['body']['id'];}return db[_0xdc60('0x26')][_0xdc60('0x41')]({'where':{'id':_0x29c84a['params']['id']}})['then'](handleEntityNotFound(_0x40185b,null))[_0xdc60('0x1f')](saveUpdates(_0x29c84a['body'],null))[_0xdc60('0x1f')](respondWithResult(_0x40185b,null))[_0xdc60('0x3e')](handleError(_0x40185b,null));};exports['destroy']=function(_0x1124bb,_0x32ccf8){return db[_0xdc60('0x26')][_0xdc60('0x41')]({'where':{'id':_0x1124bb[_0xdc60('0x3f')]['id']}})[_0xdc60('0x1f')](handleEntityNotFound(_0x32ccf8,null))['then'](removeEntity(_0x32ccf8,null))[_0xdc60('0x3e')](handleError(_0x32ccf8,null));};exports[_0xdc60('0x44')]=function(_0xce2f9a,_0x3d9126,_0x158c00){return db[_0xdc60('0x45')][_0xdc60('0x41')]({'where':{'id':_0xce2f9a['params']['id']}})[_0xdc60('0x1f')](handleEntityNotFound(_0x3d9126,null))[_0xdc60('0x1f')](function(_0x7ab559){if(_0x7ab559){return _0x7ab559[_0xdc60('0x44')](_0xce2f9a[_0xdc60('0x43')][_0xdc60('0x46')],_[_0xdc60('0x47')](_0xce2f9a[_0xdc60('0x43')],[_0xdc60('0x46'),'id'])||{});}})[_0xdc60('0x1f')](respondWithResult(_0x3d9126,null))[_0xdc60('0x3e')](handleError(_0x3d9126,null));};exports[_0xdc60('0x48')]=function(_0x1c4bbb,_0x5da584,_0x3d0c08){var _0x3a0cb0={};var _0x2e4f2e={};var _0x46e778;var _0x22e045;return db[_0xdc60('0x26')][_0xdc60('0x49')]({'where':{'id':_0x1c4bbb[_0xdc60('0x3f')]['id']}})[_0xdc60('0x1f')](handleEntityNotFound(_0x5da584,null))[_0xdc60('0x1f')](function(_0x58136b){if(_0x58136b){_0x46e778=_0x58136b;_0x2e4f2e[_0xdc60('0x2c')]=_['keys'](db['Condition']['rawAttributes']);_0x2e4f2e['query']=_[_0xdc60('0x29')](_0x1c4bbb[_0xdc60('0x28')]);_0x2e4f2e[_0xdc60('0x2a')]=_[_0xdc60('0x2b')](_0x2e4f2e[_0xdc60('0x2c')],_0x2e4f2e[_0xdc60('0x28')]);_0x3a0cb0[_0xdc60('0x2d')]=_['intersection'](_0x2e4f2e[_0xdc60('0x2c')],qs['fields'](_0x1c4bbb[_0xdc60('0x28')][_0xdc60('0x2e')]));_0x3a0cb0[_0xdc60('0x2d')]=_0x3a0cb0['attributes'][_0xdc60('0x2f')]?_0x3a0cb0['attributes']:_0x2e4f2e[_0xdc60('0x2c')];_0x3a0cb0[_0xdc60('0x32')]=qs[_0xdc60('0x33')](_0x1c4bbb['query'][_0xdc60('0x33')]);_0x3a0cb0['where']=qs['filters'](_[_0xdc60('0x35')](_0x1c4bbb[_0xdc60('0x28')],_0x2e4f2e[_0xdc60('0x2a')]));if(_0x1c4bbb[_0xdc60('0x28')][_0xdc60('0x38')]){_0x3a0cb0[_0xdc60('0x34')]=_[_0xdc60('0x36')](_0x3a0cb0['where'],{'$or':_[_0xdc60('0x25')](_0x3a0cb0[_0xdc60('0x2d')],function(_0x3737a8){var _0x1908e5={};_0x1908e5[_0x3737a8]={'$like':'%'+_0x1c4bbb[_0xdc60('0x28')][_0xdc60('0x38')]+'%'};return _0x1908e5;})});}_0x3a0cb0=_[_0xdc60('0x36')]({},_0x3a0cb0,_0x1c4bbb['options']);return _0x46e778[_0xdc60('0x48')](_0x3a0cb0);}})[_0xdc60('0x1f')](function(_0x39811f){if(_0x39811f){_0x22e045=_0x39811f['length'];if(!_0x1c4bbb[_0xdc60('0x28')][_0xdc60('0x30')]('nolimit')){_0x3a0cb0[_0xdc60('0x4a')]=qs[_0xdc60('0x4a')](_0x1c4bbb[_0xdc60('0x28')][_0xdc60('0x4a')]);_0x3a0cb0[_0xdc60('0x19')]=qs['offset'](_0x1c4bbb[_0xdc60('0x28')]['offset']);}return _0x46e778[_0xdc60('0x48')](_0x3a0cb0);}})[_0xdc60('0x1f')](function(_0x1d30c2){if(_0x1d30c2){return _0x1d30c2?{'count':_0x22e045,'rows':_0x1d30c2}:null;}})[_0xdc60('0x1f')](respondWithResult(_0x5da584,null))[_0xdc60('0x3e')](handleError(_0x5da584,null));};exports[_0xdc60('0x4b')]=function(_0x434fbc,_0x2a2de4,_0x1c1400){return db[_0xdc60('0x4c')]['find']({'where':{'id':_0x434fbc[_0xdc60('0x3f')]['id']}})[_0xdc60('0x1f')](handleEntityNotFound(_0x2a2de4,null))[_0xdc60('0x1f')](function(_0x17aa9a){if(_0x17aa9a){return _0x17aa9a[_0xdc60('0x4b')](_0x434fbc[_0xdc60('0x43')][_0xdc60('0x46')],_[_0xdc60('0x47')](_0x434fbc[_0xdc60('0x43')],[_0xdc60('0x46'),'id'])||{});}})[_0xdc60('0x1f')](respondWithResult(_0x2a2de4,null))[_0xdc60('0x3e')](handleError(_0x2a2de4,null));};exports[_0xdc60('0x4d')]=function(_0x38aeaf,_0x314f1c,_0x4a5f89){var _0x4df928={};var _0x260067={};var _0x2970a9;var _0x2e5dc4;return db[_0xdc60('0x26')][_0xdc60('0x49')]({'where':{'id':_0x38aeaf[_0xdc60('0x3f')]['id']}})[_0xdc60('0x1f')](handleEntityNotFound(_0x314f1c,null))[_0xdc60('0x1f')](function(_0x18a366){if(_0x18a366){_0x2970a9=_0x18a366;_0x260067[_0xdc60('0x2c')]=_[_0xdc60('0x29')](db[_0xdc60('0x4c')]['rawAttributes']);_0x260067[_0xdc60('0x28')]=_['keys'](_0x38aeaf[_0xdc60('0x28')]);_0x260067[_0xdc60('0x2a')]=_['intersection'](_0x260067['model'],_0x260067['query']);_0x4df928['attributes']=_[_0xdc60('0x2b')](_0x260067[_0xdc60('0x2c')],qs[_0xdc60('0x2e')](_0x38aeaf['query'][_0xdc60('0x2e')]));_0x4df928[_0xdc60('0x2d')]=_0x4df928['attributes'][_0xdc60('0x2f')]?_0x4df928[_0xdc60('0x2d')]:_0x260067[_0xdc60('0x2c')];_0x4df928['order']=qs['sort'](_0x38aeaf['query']['sort']);_0x4df928['where']=qs[_0xdc60('0x2a')](_['pick'](_0x38aeaf['query'],_0x260067[_0xdc60('0x2a')]));if(_0x38aeaf[_0xdc60('0x28')][_0xdc60('0x38')]){_0x4df928['where']=_[_0xdc60('0x36')](_0x4df928[_0xdc60('0x34')],{'$or':_[_0xdc60('0x25')](_0x4df928[_0xdc60('0x2d')],function(_0x864f8f){var _0x344e97={};_0x344e97[_0x864f8f]={'$like':'%'+_0x38aeaf[_0xdc60('0x28')]['filter']+'%'};return _0x344e97;})});}_0x4df928=_[_0xdc60('0x36')]({},_0x4df928,_0x38aeaf[_0xdc60('0x39')]);return _0x2970a9[_0xdc60('0x4d')](_0x4df928);}})[_0xdc60('0x1f')](function(_0x32bd7d){if(_0x32bd7d){_0x2e5dc4=_0x32bd7d[_0xdc60('0x2f')];if(!_0x38aeaf[_0xdc60('0x28')][_0xdc60('0x30')](_0xdc60('0x31'))){_0x4df928[_0xdc60('0x4a')]=qs[_0xdc60('0x4a')](_0x38aeaf['query'][_0xdc60('0x4a')]);_0x4df928[_0xdc60('0x19')]=qs[_0xdc60('0x19')](_0x38aeaf['query'][_0xdc60('0x19')]);}return _0x2970a9['getActions'](_0x4df928);}})[_0xdc60('0x1f')](function(_0x94ae20){if(_0x94ae20){return _0x94ae20?{'count':_0x2e5dc4,'rows':_0x94ae20}:null;}})[_0xdc60('0x1f')](respondWithResult(_0x314f1c,null))[_0xdc60('0x3e')](handleError(_0x314f1c,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 0e3623a..46e82ca 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 _0x2e03=['path','rimraf','../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','util','api','moment'];(function(_0x7a30ab,_0x316099){var _0x5cc7d6=function(_0x9ef2df){while(--_0x9ef2df){_0x7a30ab['push'](_0x7a30ab['shift']());}};_0x5cc7d6(++_0x316099);}(_0x2e03,0xa2));var _0x32e0=function(_0x3485c3,_0x5f1a7f){_0x3485c3=_0x3485c3-0x0;var _0x44723e=_0x2e03[_0x3485c3];return _0x44723e;};'use strict';var _=require('lodash');var util=require(_0x32e0('0x0'));var logger=require('../../config/logger')(_0x32e0('0x1'));var moment=require(_0x32e0('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x32e0('0x3'));var rimraf=require(_0x32e0('0x4'));var config=require(_0x32e0('0x5'));var attributes=require(_0x32e0('0x6'));module[_0x32e0('0x7')]=function(_0x4a2534,_0x49dc2e){return _0x4a2534[_0x32e0('0x8')](_0x32e0('0x9'),attributes,{'tableName':_0x32e0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d31=['request-promise','path','rimraf','../../config/environment','./automation.attributes','define','tools_automations','api','moment'];(function(_0x37e629,_0x47100e){var _0x21e4a5=function(_0x5ca638){while(--_0x5ca638){_0x37e629['push'](_0x37e629['shift']());}};_0x21e4a5(++_0x47100e);}(_0x0d31,0x178));var _0x10d3=function(_0x56899b,_0x80fce){_0x56899b=_0x56899b-0x0;var _0x47d591=_0x0d31[_0x56899b];return _0x47d591;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x10d3('0x0'));var moment=require(_0x10d3('0x1'));var BPromise=require('bluebird');var rp=require(_0x10d3('0x2'));var fs=require('fs');var path=require(_0x10d3('0x3'));var rimraf=require(_0x10d3('0x4'));var config=require(_0x10d3('0x5'));var attributes=require(_0x10d3('0x6'));module['exports']=function(_0x430db2,_0x711166){return _0x430db2[_0x10d3('0x7')]('Automation',attributes,{'tableName':_0x10d3('0x8'),'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 5092620..c972eb9 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 _0x78ef=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','bluebird','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x78ef,0x162));var _0xf78e=function(_0x30858e,_0xbde112){_0x30858e=_0x30858e-0x0;var _0x2255e0=_0x78ef[_0x30858e];return _0x2255e0;};'use strict';var _=require('lodash');var util=require(_0xf78e('0x0'));var moment=require('moment');var BPromise=require(_0xf78e('0x1'));var rs=require(_0xf78e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf78e('0x3'))['db'];var utils=require(_0xf78e('0x4'));var logger=require(_0xf78e('0x5'))(_0xf78e('0x6'));var config=require(_0xf78e('0x7'));var jayson=require(_0xf78e('0x8'));var client=jayson[_0xf78e('0x9')][_0xf78e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3125a5,_0x4b902f,_0x27092f){return new BPromise(function(_0x9819e1,_0x146085){return client['request'](_0x3125a5,_0x27092f)[_0xf78e('0xb')](function(_0x490c9c){logger[_0xf78e('0xc')](_0xf78e('0xd'),_0x4b902f,_0xf78e('0xe'));logger[_0xf78e('0xf')]('Automation,\x20%s,\x20%s,\x20%s',_0x4b902f,'request\x20sent',JSON['stringify'](_0x490c9c));if(_0x490c9c[_0xf78e('0x10')]){if(_0x490c9c[_0xf78e('0x10')][_0xf78e('0x11')]===0x1f4){logger[_0xf78e('0x10')](_0xf78e('0xd'),_0x4b902f,_0x490c9c[_0xf78e('0x10')][_0xf78e('0x12')]);return _0x146085(_0x490c9c['error']['message']);}logger['error']('Automation,\x20%s,\x20%s',_0x4b902f,_0x490c9c['error'][_0xf78e('0x12')]);return _0x9819e1(_0x490c9c[_0xf78e('0x10')][_0xf78e('0x12')]);}else{logger['info'](_0xf78e('0xd'),_0x4b902f,'request\x20sent');_0x9819e1(_0x490c9c[_0xf78e('0x13')][_0xf78e('0x12')]);}})[_0xf78e('0x14')](function(_0x4ce606){logger[_0xf78e('0x10')](_0xf78e('0xd'),_0x4b902f,_0x4ce606);_0x146085(_0x4ce606);});});} \ No newline at end of file +var _0x6029=['moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','request','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','util'];(function(_0x96f74c,_0xfc30a4){var _0x379222=function(_0x1bbde9){while(--_0x1bbde9){_0x96f74c['push'](_0x96f74c['shift']());}};_0x379222(++_0xfc30a4);}(_0x6029,0x18f));var _0x9602=function(_0x50c752,_0x4b521b){_0x50c752=_0x50c752-0x0;var _0x5d5b63=_0x6029[_0x50c752];return _0x5d5b63;};'use strict';var _=require('lodash');var util=require(_0x9602('0x0'));var moment=require(_0x9602('0x1'));var BPromise=require(_0x9602('0x2'));var rs=require(_0x9602('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9602('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9602('0x5'))('rpc');var config=require(_0x9602('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9602('0x7')][_0x9602('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4e8d9d,_0x3bec3f,_0xf0b797){return new BPromise(function(_0x2f4c26,_0x9c9b38){return client[_0x9602('0x9')](_0x4e8d9d,_0xf0b797)['then'](function(_0xdad35){logger[_0x9602('0xa')](_0x9602('0xb'),_0x3bec3f,_0x9602('0xc'));logger[_0x9602('0xd')](_0x9602('0xe'),_0x3bec3f,_0x9602('0xc'),JSON['stringify'](_0xdad35));if(_0xdad35['error']){if(_0xdad35['error'][_0x9602('0xf')]===0x1f4){logger[_0x9602('0x10')](_0x9602('0xb'),_0x3bec3f,_0xdad35[_0x9602('0x10')][_0x9602('0x11')]);return _0x9c9b38(_0xdad35[_0x9602('0x10')][_0x9602('0x11')]);}logger[_0x9602('0x10')](_0x9602('0xb'),_0x3bec3f,_0xdad35[_0x9602('0x10')][_0x9602('0x11')]);return _0x2f4c26(_0xdad35[_0x9602('0x10')][_0x9602('0x11')]);}else{logger[_0x9602('0xa')](_0x9602('0xb'),_0x3bec3f,_0x9602('0xc'));_0x2f4c26(_0xdad35[_0x9602('0x12')][_0x9602('0x11')]);}})[_0x9602('0x13')](function(_0x112dff){logger[_0x9602('0x10')]('Automation,\x20%s,\x20%s',_0x3bec3f,_0x112dff);_0x9c9b38(_0x112dff);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 54fd508..e70958b 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 _0x56d3=['create','addConditions','post','addActions','put','/:id','update','delete','destroy','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','show','/:id/conditions','getConditions','getActions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x56d3,0x191));var _0x356d=function(_0x3fc237,_0x531b37){_0x3fc237=_0x3fc237-0x0;var _0x5ae25b=_0x56d3[_0x3fc237];return _0x5ae25b;};'use strict';var multer=require(_0x356d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x356d('0x1'));var express=require(_0x356d('0x2'));var router=express['Router']();var auth=require(_0x356d('0x3'));var interaction=require(_0x356d('0x4'));var config=require(_0x356d('0x5'));var controller=require(_0x356d('0x6'));router[_0x356d('0x7')]('/',auth[_0x356d('0x8')](),controller['index']);router[_0x356d('0x7')]('/:id',auth[_0x356d('0x8')](),controller[_0x356d('0x9')]);router[_0x356d('0x7')](_0x356d('0xa'),auth[_0x356d('0x8')](),controller[_0x356d('0xb')]);router[_0x356d('0x7')]('/:id/actions',auth[_0x356d('0x8')](),controller[_0x356d('0xc')]);router['post']('/',auth[_0x356d('0x8')](),controller[_0x356d('0xd')]);router['post'](_0x356d('0xa'),auth[_0x356d('0x8')](),controller[_0x356d('0xe')]);router[_0x356d('0xf')]('/:id/actions',auth[_0x356d('0x8')](),controller[_0x356d('0x10')]);router[_0x356d('0x11')](_0x356d('0x12'),auth[_0x356d('0x8')](),controller[_0x356d('0x13')]);router[_0x356d('0x14')]('/:id',auth[_0x356d('0x8')](),controller[_0x356d('0x15')]);module[_0x356d('0x16')]=router; \ No newline at end of file +var _0xa095=['getActions','post','create','addConditions','addActions','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/conditions','getConditions','/:id/actions'];(function(_0x5666b6,_0x1cde2b){var _0x3a9efd=function(_0x55f163){while(--_0x55f163){_0x5666b6['push'](_0x5666b6['shift']());}};_0x3a9efd(++_0x1cde2b);}(_0xa095,0x7c));var _0x5a09=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xa095[_0x13d07a];return _0x5ee0ee;};'use strict';var multer=require(_0x5a09('0x0'));var util=require(_0x5a09('0x1'));var path=require('path');var timeout=require(_0x5a09('0x2'));var express=require('express');var router=express[_0x5a09('0x3')]();var auth=require(_0x5a09('0x4'));var interaction=require(_0x5a09('0x5'));var config=require(_0x5a09('0x6'));var controller=require('./automation.controller');router[_0x5a09('0x7')]('/',auth[_0x5a09('0x8')](),controller[_0x5a09('0x9')]);router[_0x5a09('0x7')](_0x5a09('0xa'),auth['isAuthenticated'](),controller['show']);router['get'](_0x5a09('0xb'),auth[_0x5a09('0x8')](),controller[_0x5a09('0xc')]);router[_0x5a09('0x7')](_0x5a09('0xd'),auth[_0x5a09('0x8')](),controller[_0x5a09('0xe')]);router[_0x5a09('0xf')]('/',auth[_0x5a09('0x8')](),controller[_0x5a09('0x10')]);router[_0x5a09('0xf')](_0x5a09('0xb'),auth['isAuthenticated'](),controller[_0x5a09('0x11')]);router[_0x5a09('0xf')](_0x5a09('0xd'),auth['isAuthenticated'](),controller[_0x5a09('0x12')]);router['put'](_0x5a09('0xa'),auth[_0x5a09('0x8')](),controller[_0x5a09('0x13')]);router[_0x5a09('0x14')](_0x5a09('0xa'),auth['isAuthenticated'](),controller[_0x5a09('0x15')]);module[_0x5a09('0x16')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index a92a1e1..80f25c8 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 _0x04e2=['#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','DESC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting'];(function(_0x214edc,_0x49c42c){var _0x3f5c00=function(_0x4da394){while(--_0x4da394){_0x214edc['push'](_0x214edc['shift']());}};_0x3f5c00(++_0x49c42c);}(_0x04e2,0xfe));var _0x204e=function(_0x57b323,_0x39fd47){_0x57b323=_0x57b323-0x0;var _0x2d165c=_0x04e2[_0x57b323];return _0x2d165c;};'use strict';var Sequelize=require(_0x204e('0x0'));module[_0x204e('0x1')]={'name':{'type':Sequelize[_0x204e('0x2')],'unique':_0x204e('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x204e('0x4')]('ivr'),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x204e('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x204e('0x5')},'limitCalls':{'type':Sequelize[_0x204e('0x6')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x204e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x204e('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x204e('0x6')](0x3)[_0x204e('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x204e('0x8')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x204e('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x204e('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x204e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x204e('0x9')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x204e('0x6')](0x3)[_0x204e('0x7')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x204e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x204e('0xa')},'dialGlobalMaxRetry':{'type':Sequelize[_0x204e('0x6')](0x3)[_0x204e('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x204e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x204e('0xb')},'dialCheckDuplicateType':{'type':Sequelize[_0x204e('0x4')]('always',_0x204e('0xc'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x204e('0xd')},'dialAMDInitialSilence':{'type':Sequelize[_0x204e('0x6')](0x9)[_0x204e('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x204e('0xe')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x204e('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x204e('0xf')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x204e('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x204e('0x6')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x204e('0x10')},'dialAMDMinWordLength':{'type':Sequelize[_0x204e('0x6')](0x9)[_0x204e('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x204e('0x11')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x204e('0x6')](0x9)[_0x204e('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x204e('0x6')](0x9)[_0x204e('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x204e('0x12')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x204e('0x6')](0x5)[_0x204e('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x204e('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x204e('0x13')},'dialOrderByScheduledAt':{'type':Sequelize[_0x204e('0x4')](_0x204e('0x14'),'ASC'),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x204e('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x204e('0x6')](0x3)[_0x204e('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x204e('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x204e('0x15')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x204e('0x6')](0x3)[_0x204e('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x204e('0x16')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x204e('0x6')](0x5)[_0x204e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x204e('0x17')},'dialDropMaxRetry':{'type':Sequelize[_0x204e('0x6')](0x3)[_0x204e('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x204e('0x18')},'dialDropRetryFrequency':{'type':Sequelize[_0x204e('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x204e('0x6')](0x3)[_0x204e('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x204e('0x6')](0x5)[_0x204e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x204e('0x19')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x204e('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x204e('0x1a')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x204e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x204e('0x1b')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x204e('0x6')](0x3)[_0x204e('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x204e('0x1c')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x204e('0x6')](0x5)[_0x204e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x204e('0x1d')}}; \ No newline at end of file +var _0x2198=['INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','ENUM','BOOLEAN'];(function(_0x1035ab,_0x2f9249){var _0x451ef1=function(_0x179cbb){while(--_0x179cbb){_0x1035ab['push'](_0x1035ab['shift']());}};_0x451ef1(++_0x2f9249);}(_0x2198,0x131));var _0x8219=function(_0x3cc621,_0x2e6c1c){_0x3cc621=_0x3cc621-0x0;var _0x2a2e85=_0x2198[_0x3cc621];return _0x2a2e85;};'use strict';var Sequelize=require(_0x8219('0x0'));module[_0x8219('0x1')]={'name':{'type':Sequelize[_0x8219('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x8219('0x3')]('ivr'),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x8219('0x4')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x8219('0x5')](0x4)[_0x8219('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x8219('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x8219('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x8219('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x8219('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8219('0x8')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8219('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x8219('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x8219('0x5')](0x5)[_0x8219('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8219('0x9')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x8219('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x8219('0xa')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x8219('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8219('0xb')},'dialGlobalMaxRetry':{'type':Sequelize[_0x8219('0x5')](0x3)[_0x8219('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x8219('0xc')},'dialTimezone':{'type':Sequelize[_0x8219('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x8219('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x8219('0x3')](_0x8219('0xd'),_0x8219('0xe'),'onlyIfOpen'),'defaultValue':_0x8219('0xd')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x8219('0xf')},'dialAMDInitialSilence':{'type':Sequelize[_0x8219('0x5')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x8219('0x10')},'dialAMDGreeting':{'type':Sequelize[_0x8219('0x5')](0x9)[_0x8219('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x8219('0x5')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x8219('0x11')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x8219('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8219('0x12')},'dialAMDMinWordLength':{'type':Sequelize[_0x8219('0x5')](0x9)[_0x8219('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x8219('0x5')](0x9)[_0x8219('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x8219('0x13')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x8219('0x5')](0x9)[_0x8219('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x8219('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x8219('0x14')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x8219('0x5')](0x9)[_0x8219('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8219('0x15')},'dialOrderByScheduledAt':{'type':Sequelize[_0x8219('0x3')](_0x8219('0x16'),'ASC'),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x8219('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x8219('0x5')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x8219('0x5')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8219('0x17')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8219('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8219('0x18')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x8219('0x5')](0x5)[_0x8219('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8219('0x19')},'dialDropMaxRetry':{'type':Sequelize[_0x8219('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x8219('0x5')](0x5)[_0x8219('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8219('0x1a')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x8219('0x5')](0x5)[_0x8219('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8219('0x1b')},'dialMachineMaxRetry':{'type':Sequelize[_0x8219('0x5')](0x3)[_0x8219('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8219('0x1c')},'dialMachineRetryFrequency':{'type':Sequelize[_0x8219('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x8219('0x5')](0x3)[_0x8219('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8219('0x1d')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x8219('0x5')](0x5)[_0x8219('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8219('0x1e')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 2dc2b92..da941bb 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 _0x9c44=['../../config/logger','api','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','IvrCampaigns','UserProfileResource','destroy','error','name','send','map','Campaign','rawAttributes','fieldName','query','keys','intersection','model','attributes','fields','order','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','show','params','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','UserProfileSection','getHoppers','findOne','CmHopper','hasOwnProperty','nolimit','sort','CampaignId','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','spread','dialCheckDuplicateType','always','into','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','CmListId','toString','NOW()','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','CampaignId\x20=\x20?','onlyIfOpen','insert','phone\x20IS\x20NOT\x20NULL','push','sequelize','all','removeLists','ids','addBlackLists','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x506d2f,_0x5ab76e){var _0x101255=function(_0x1596b1){while(--_0x1596b1){_0x506d2f['push'](_0x506d2f['shift']());}};_0x101255(++_0x5ab76e);}(_0x9c44,0x178));var _0x49c4=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x9c44[_0x4b369d];return _0x571a98;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x49c4('0x0'));var zipdir=require(_0x49c4('0x1'));var jsonpatch=require(_0x49c4('0x2'));var rp=require(_0x49c4('0x3'));var moment=require(_0x49c4('0x4'));var BPromise=require(_0x49c4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x49c4('0x6'));var sox=require('sox');var csv=require(_0x49c4('0x7'));var ejs=require(_0x49c4('0x8'));var fs=require('fs');var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0x7'));var querystring=require(_0x49c4('0xd'));var Papa=require(_0x49c4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0xf'));var as=require(_0x49c4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x11'))(_0x49c4('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x49c4('0x13'))['db'];function respondWithStatusCode(_0x6d1b08,_0x5487cd){_0x5487cd=_0x5487cd||0xcc;return function(_0x7df3a9){if(_0x7df3a9){return _0x6d1b08[_0x49c4('0x14')](_0x5487cd);}return _0x6d1b08['status'](_0x5487cd)[_0x49c4('0x15')]();};}function respondWithResult(_0x280996,_0x21f15a){_0x21f15a=_0x21f15a||0xc8;return function(_0x2decee){if(_0x2decee){return _0x280996[_0x49c4('0x16')](_0x21f15a)[_0x49c4('0x17')](_0x2decee);}};}function respondWithFilteredResult(_0x75ea8,_0x3de397){return function(_0x58d177){if(_0x58d177){var _0x3acd06=_0x58d177[_0x49c4('0x18')],_0x141003=_0x3de397['offset'],_0x13a2db=_0x3de397[_0x49c4('0x19')]+_0x3de397[_0x49c4('0x1a')],_0x81e831;if(_0x13a2db>=_0x3acd06){_0x13a2db=_0x3acd06;_0x81e831=0xc8;}else{_0x81e831=0xce;}_0x75ea8['status'](_0x81e831);return _0x75ea8['set'](_0x49c4('0x1b'),_0x141003+'-'+_0x13a2db+'/'+_0x3acd06)[_0x49c4('0x17')](_0x58d177);}return null;};}function patchUpdates(_0x3addb2){return function(_0x59f29b){try{jsonpatch[_0x49c4('0x1c')](_0x59f29b,_0x3addb2,!![]);}catch(_0x50b151){return BPromise[_0x49c4('0x1d')](_0x50b151);}return _0x59f29b[_0x49c4('0x1e')]();};}function saveUpdates(_0xe31fcc,_0x291526){return function(_0x382040){if(_0x382040){return _0x382040[_0x49c4('0x1f')](_0xe31fcc)[_0x49c4('0x20')](function(_0x46e475){return _0x46e475;});}return null;};}function removeEntity(_0x2197d2,_0x578447){return function(_0x527126){if(_0x527126){return _0x527126['destroy']()[_0x49c4('0x20')](function(){var _0x4f0b62=_0x527126['get']({'plain':!![]});var _0x2263ae=_0x49c4('0x21');return db[_0x49c4('0x22')][_0x49c4('0x23')]({'where':{'type':_0x2263ae,'resourceId':_0x4f0b62['id']}})['then'](function(){return _0x527126;});})['then'](function(){_0x2197d2[_0x49c4('0x16')](0xcc)[_0x49c4('0x15')]();});}};}function handleEntityNotFound(_0x565423,_0x207358){return function(_0x43e014){if(!_0x43e014){_0x565423[_0x49c4('0x14')](0x194);}return _0x43e014;};}function handleError(_0xa7a826,_0x531d92){_0x531d92=_0x531d92||0x1f4;return function(_0x543ea2){logger[_0x49c4('0x24')](_0x543ea2['stack']);if(_0x543ea2[_0x49c4('0x25')]){delete _0x543ea2[_0x49c4('0x25')];}_0xa7a826[_0x49c4('0x16')](_0x531d92)[_0x49c4('0x26')](_0x543ea2);};}exports['index']=function(_0x889909,_0x2b2793){var _0x46e04d={},_0x4f28a2={},_0x6329b3={'count':0x0,'rows':[]};var _0x29f835=_[_0x49c4('0x27')](db[_0x49c4('0x28')][_0x49c4('0x29')],function(_0x2cbd88){return{'name':_0x2cbd88[_0x49c4('0x2a')],'type':_0x2cbd88['type']['key']};});_0x4f28a2['model']=_[_0x49c4('0x27')](_0x29f835,_0x49c4('0x25'));_0x4f28a2[_0x49c4('0x2b')]=_[_0x49c4('0x2c')](_0x889909[_0x49c4('0x2b')]);_0x4f28a2['filters']=_[_0x49c4('0x2d')](_0x4f28a2[_0x49c4('0x2e')],_0x4f28a2[_0x49c4('0x2b')]);_0x46e04d[_0x49c4('0x2f')]=_['intersection'](_0x4f28a2['model'],qs[_0x49c4('0x30')](_0x889909[_0x49c4('0x2b')][_0x49c4('0x30')]));_0x46e04d[_0x49c4('0x2f')]=_0x46e04d[_0x49c4('0x2f')]['length']?_0x46e04d[_0x49c4('0x2f')]:_0x4f28a2[_0x49c4('0x2e')];if(!_0x889909[_0x49c4('0x2b')]['hasOwnProperty']('nolimit')){_0x46e04d[_0x49c4('0x1a')]=qs[_0x49c4('0x1a')](_0x889909[_0x49c4('0x2b')][_0x49c4('0x1a')]);_0x46e04d[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x889909[_0x49c4('0x2b')][_0x49c4('0x19')]);}_0x46e04d[_0x49c4('0x31')]=qs['sort'](_0x889909[_0x49c4('0x2b')]['sort']);_0x46e04d[_0x49c4('0x32')]=qs[_0x49c4('0x33')](_[_0x49c4('0x34')](_0x889909[_0x49c4('0x2b')],_0x4f28a2['filters']));if(_0x889909[_0x49c4('0x2b')][_0x49c4('0x35')]){_0x46e04d[_0x49c4('0x32')]=_['merge'](_0x46e04d[_0x49c4('0x32')],{'$or':_[_0x49c4('0x27')](_0x29f835,function(_0x178987){if(_0x178987[_0x49c4('0x36')]!==_0x49c4('0x37')){var _0x24c177={};_0x24c177[_0x178987[_0x49c4('0x25')]]={'$like':'%'+_0x889909[_0x49c4('0x2b')][_0x49c4('0x35')]+'%'};return _0x24c177;}})});}_0x46e04d=_[_0x49c4('0x38')]({},_0x46e04d,_0x889909[_0x49c4('0x39')]);var _0x4e0663={'where':_0x46e04d[_0x49c4('0x32')]};return db[_0x49c4('0x28')][_0x49c4('0x18')](_0x4e0663)[_0x49c4('0x20')](function(_0x41ad28){_0x6329b3[_0x49c4('0x18')]=_0x41ad28;if(_0x889909[_0x49c4('0x2b')][_0x49c4('0x3a')]){_0x46e04d[_0x49c4('0x3b')]=[{'all':!![]}];}return db[_0x49c4('0x28')][_0x49c4('0x3c')](_0x46e04d);})[_0x49c4('0x20')](function(_0x326142){_0x6329b3['rows']=_0x326142;return _0x6329b3;})[_0x49c4('0x20')](respondWithFilteredResult(_0x2b2793,_0x46e04d))['catch'](handleError(_0x2b2793,null));};exports[_0x49c4('0x3d')]=function(_0x4915bc,_0x28d4fb){var _0x1480da={'raw':![],'where':{'id':_0x4915bc[_0x49c4('0x3e')]['id']}},_0x239327={};_0x239327['model']=_['keys'](db[_0x49c4('0x28')][_0x49c4('0x29')]);_0x239327[_0x49c4('0x2b')]=_[_0x49c4('0x2c')](_0x4915bc['query']);_0x239327[_0x49c4('0x33')]=_[_0x49c4('0x2d')](_0x239327[_0x49c4('0x2e')],_0x239327[_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2f')]=_[_0x49c4('0x2d')](_0x239327[_0x49c4('0x2e')],qs[_0x49c4('0x30')](_0x4915bc[_0x49c4('0x2b')]['fields']));_0x1480da[_0x49c4('0x2f')]=_0x1480da['attributes'][_0x49c4('0x3f')]?_0x1480da[_0x49c4('0x2f')]:_0x239327[_0x49c4('0x2e')];if(_0x4915bc[_0x49c4('0x2b')][_0x49c4('0x3a')]){_0x1480da['include']=[{'all':!![]}];}_0x1480da=_[_0x49c4('0x38')]({},_0x1480da,_0x4915bc[_0x49c4('0x39')]);return db[_0x49c4('0x28')][_0x49c4('0x40')](_0x1480da)[_0x49c4('0x20')](handleEntityNotFound(_0x28d4fb,null))[_0x49c4('0x20')](respondWithResult(_0x28d4fb,null))[_0x49c4('0x41')](handleError(_0x28d4fb,null));};exports['create']=function(_0x3bac1b,_0x5cfff9){return db[_0x49c4('0x28')][_0x49c4('0x42')](_0x3bac1b[_0x49c4('0x43')],{})[_0x49c4('0x20')](function(_0x2d8087){var _0x30bea5=_0x3bac1b[_0x49c4('0x44')]['get']({'plain':!![]});if(!_0x30bea5)throw new Error(_0x49c4('0x45'));if(_0x30bea5[_0x49c4('0x46')]==='user'){var _0x1e1ac4=_0x2d8087[_0x49c4('0x47')]({'plain':!![]});var _0xfbe179=_0x49c4('0x21');return db['UserProfileSection']['find']({'where':{'name':_0xfbe179,'userProfileId':_0x30bea5[_0x49c4('0x48')]},'raw':!![]})['then'](function(_0x4597c3){if(_0x4597c3&&_0x4597c3[_0x49c4('0x49')]===0x0){return db[_0x49c4('0x22')][_0x49c4('0x42')]({'name':_0x1e1ac4[_0x49c4('0x25')],'resourceId':_0x1e1ac4['id'],'type':_0x4597c3[_0x49c4('0x25')],'sectionId':_0x4597c3['id']},{})[_0x49c4('0x20')](function(){return _0x2d8087;});}else{return _0x2d8087;}})['catch'](function(_0x1f26c2){logger[_0x49c4('0x24')](_0x49c4('0x4a'),_0x1f26c2);throw _0x1f26c2;});}return _0x2d8087;})[_0x49c4('0x20')](respondWithResult(_0x5cfff9,0xc9))[_0x49c4('0x41')](handleError(_0x5cfff9,null));};exports[_0x49c4('0x4b')]=function(_0x156748,_0x25d174){var _0x1e0b4f={'where':{'id':_0x156748['params']['id']}},_0x1856be={};_0x1856be['model']=_[_0x49c4('0x2c')](db[_0x49c4('0x28')]['rawAttributes']);_0x1e0b4f['attributes']=_[_0x49c4('0x2d')](_0x1856be['model'],qs['fields'](_0x156748[_0x49c4('0x2b')][_0x49c4('0x30')]));_0x1e0b4f[_0x49c4('0x2f')]=_0x1e0b4f[_0x49c4('0x2f')][_0x49c4('0x3f')]?_0x1e0b4f[_0x49c4('0x2f')]:_0x1856be[_0x49c4('0x2e')];if(_0x156748['query'][_0x49c4('0x3a')]){_0x1e0b4f[_0x49c4('0x3b')]=[{'all':!![]}];}_0x1e0b4f=_[_0x49c4('0x38')]({},_0x1e0b4f,_0x156748[_0x49c4('0x39')]);return db[_0x49c4('0x28')][_0x49c4('0x40')](_0x1e0b4f)['then'](handleEntityNotFound(_0x25d174,null))['then'](function(_0x1ef0c1){if(_0x1ef0c1){var _0x155c43=_0x1ef0c1[_0x49c4('0x47')]({'plain':!![]});_0x155c43=qs[_0x49c4('0x4c')](_0x155c43,['id',_0x49c4('0x4d'),_0x49c4('0x4e')]);_0x156748[_0x49c4('0x43')]=_['omit'](_0x156748[_0x49c4('0x43')],['id',_0x49c4('0x4d'),'updatedAt']);return db[_0x49c4('0x28')]['create'](_[_0x49c4('0x38')](_0x155c43,_0x156748[_0x49c4('0x43')]),{'include':_0x156748[_0x49c4('0x2b')][_0x49c4('0x3a')]?[{'all':!![]}]:undefined})[_0x49c4('0x20')](function(_0x3e44d7){var _0x3eb66d=_0x156748[_0x49c4('0x44')]['get']({'plain':!![]});if(!_0x3eb66d)throw new Error(_0x49c4('0x45'));if(_0x3eb66d[_0x49c4('0x46')]==='user'){var _0x10dec7=_0x3e44d7[_0x49c4('0x47')]({'plain':!![]});var _0x4fefbd=_0x49c4('0x21');return db[_0x49c4('0x4f')]['find']({'where':{'name':_0x4fefbd,'userProfileId':_0x3eb66d['userProfileId']},'raw':!![]})['then'](function(_0x513879){if(_0x513879&&_0x513879[_0x49c4('0x49')]===0x0){return db['UserProfileResource'][_0x49c4('0x42')]({'name':_0x10dec7[_0x49c4('0x25')],'resourceId':_0x10dec7['id'],'type':_0x513879['name'],'sectionId':_0x513879['id']},{})[_0x49c4('0x20')](function(){return _0x3e44d7;});}else{return _0x3e44d7;}})[_0x49c4('0x41')](function(_0x5ac9f0){logger[_0x49c4('0x24')](_0x49c4('0x4a'),_0x5ac9f0);throw _0x5ac9f0;});}return _0x3e44d7;});}})[_0x49c4('0x20')](respondWithResult(_0x25d174,0xc9))[_0x49c4('0x41')](handleError(_0x25d174,null));};exports['update']=function(_0x431921,_0x16d0e1){if(_0x431921[_0x49c4('0x43')]['id']){delete _0x431921[_0x49c4('0x43')]['id'];}return db['Campaign'][_0x49c4('0x40')]({'where':{'id':_0x431921['params']['id']}})['then'](handleEntityNotFound(_0x16d0e1,null))['then'](saveUpdates(_0x431921['body'],null))[_0x49c4('0x20')](respondWithResult(_0x16d0e1,null))[_0x49c4('0x41')](handleError(_0x16d0e1,null));};exports[_0x49c4('0x23')]=function(_0x28bbf3,_0x5b056e){return db['Campaign'][_0x49c4('0x40')]({'where':{'id':_0x28bbf3[_0x49c4('0x3e')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x5b056e,null))[_0x49c4('0x20')](removeEntity(_0x5b056e,null))[_0x49c4('0x41')](handleError(_0x5b056e,null));};exports[_0x49c4('0x50')]=function(_0x3ba0d6,_0x3b949d,_0x4d49e0){var _0x2276db={'raw':!![],'where':{}};var _0x55e2ba={};var _0x25e8be={'count':0x0,'rows':[]};return db[_0x49c4('0x28')][_0x49c4('0x51')]({'where':{'id':_0x3ba0d6[_0x49c4('0x3e')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x3b949d,null))[_0x49c4('0x20')](function(_0x13d657){if(_0x13d657){_0x55e2ba[_0x49c4('0x2e')]=_[_0x49c4('0x2c')](db[_0x49c4('0x52')][_0x49c4('0x29')]);_0x55e2ba[_0x49c4('0x2b')]=_[_0x49c4('0x2c')](_0x3ba0d6[_0x49c4('0x2b')]);_0x55e2ba[_0x49c4('0x33')]=_[_0x49c4('0x2d')](_0x55e2ba[_0x49c4('0x2e')],_0x55e2ba[_0x49c4('0x2b')]);_0x2276db['attributes']=_['intersection'](_0x55e2ba[_0x49c4('0x2e')],qs[_0x49c4('0x30')](_0x3ba0d6['query'][_0x49c4('0x30')]));_0x2276db[_0x49c4('0x2f')]=_0x2276db[_0x49c4('0x2f')][_0x49c4('0x3f')]?_0x2276db['attributes']:_0x55e2ba['model'];if(!_0x3ba0d6['query'][_0x49c4('0x53')](_0x49c4('0x54'))){_0x2276db[_0x49c4('0x1a')]=qs[_0x49c4('0x1a')](_0x3ba0d6[_0x49c4('0x2b')][_0x49c4('0x1a')]);_0x2276db[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x3ba0d6[_0x49c4('0x2b')]['offset']);}_0x2276db[_0x49c4('0x31')]=qs[_0x49c4('0x55')](_0x3ba0d6[_0x49c4('0x2b')]['sort']);_0x2276db[_0x49c4('0x32')]=qs[_0x49c4('0x33')](_[_0x49c4('0x34')](_0x3ba0d6[_0x49c4('0x2b')],_0x55e2ba[_0x49c4('0x33')]));_0x2276db[_0x49c4('0x32')][_0x49c4('0x56')]=_0x13d657['id'];if(_0x3ba0d6[_0x49c4('0x2b')]['filter']){_0x2276db[_0x49c4('0x32')]=_[_0x49c4('0x38')](_0x2276db[_0x49c4('0x32')],{'$or':_[_0x49c4('0x27')](_0x2276db[_0x49c4('0x2f')],function(_0x4a204d){var _0x57a8d8={};_0x57a8d8[_0x4a204d]={'$like':'%'+_0x3ba0d6[_0x49c4('0x2b')]['filter']+'%'};return _0x57a8d8;})});}_0x2276db=_[_0x49c4('0x38')]({},_0x2276db,_0x3ba0d6['options']);return db[_0x49c4('0x52')][_0x49c4('0x18')]({'where':_0x2276db[_0x49c4('0x32')]})[_0x49c4('0x20')](function(_0x4eb9f7){_0x25e8be[_0x49c4('0x18')]=_0x4eb9f7;if(_0x3ba0d6[_0x49c4('0x2b')][_0x49c4('0x3a')]){_0x2276db[_0x49c4('0x3b')]=[{'all':!![]}];}return db[_0x49c4('0x52')][_0x49c4('0x3c')](_0x2276db);})[_0x49c4('0x20')](function(_0x23bb1c){_0x25e8be[_0x49c4('0x57')]=_0x23bb1c;return _0x25e8be;});}})[_0x49c4('0x20')](respondWithFilteredResult(_0x3b949d,_0x2276db))['catch'](handleError(_0x3b949d,null));};exports[_0x49c4('0x58')]=function(_0x46e4fd,_0x549719,_0x15bee0){var _0x5c7e8c={'raw':!![],'where':{}};var _0x1e6644={};var _0x1bfb8d={'count':0x0,'rows':[]};return db[_0x49c4('0x28')][_0x49c4('0x51')]({'where':{'id':_0x46e4fd[_0x49c4('0x3e')]['id']}})['then'](handleEntityNotFound(_0x549719,null))[_0x49c4('0x20')](function(_0x2329b6){if(_0x2329b6){_0x1e6644['model']=_[_0x49c4('0x2c')](db[_0x49c4('0x59')]['rawAttributes']);_0x1e6644[_0x49c4('0x2b')]=_[_0x49c4('0x2c')](_0x46e4fd['query']);_0x1e6644[_0x49c4('0x33')]=_[_0x49c4('0x2d')](_0x1e6644[_0x49c4('0x2e')],_0x1e6644[_0x49c4('0x2b')]);_0x5c7e8c['attributes']=_[_0x49c4('0x2d')](_0x1e6644[_0x49c4('0x2e')],qs['fields'](_0x46e4fd[_0x49c4('0x2b')]['fields']));_0x5c7e8c['attributes']=_0x5c7e8c[_0x49c4('0x2f')]['length']?_0x5c7e8c['attributes']:_0x1e6644[_0x49c4('0x2e')];if(!_0x46e4fd[_0x49c4('0x2b')]['hasOwnProperty'](_0x49c4('0x54'))){_0x5c7e8c['limit']=qs['limit'](_0x46e4fd['query'][_0x49c4('0x1a')]);_0x5c7e8c[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x46e4fd[_0x49c4('0x2b')]['offset']);}_0x5c7e8c['order']=qs[_0x49c4('0x55')](_0x46e4fd['query'][_0x49c4('0x55')]);_0x5c7e8c['where']=qs[_0x49c4('0x33')](_[_0x49c4('0x34')](_0x46e4fd[_0x49c4('0x2b')],_0x1e6644[_0x49c4('0x33')]));_0x5c7e8c[_0x49c4('0x32')][_0x49c4('0x56')]=_0x2329b6['id'];if(_0x46e4fd[_0x49c4('0x2b')]['filter']){_0x5c7e8c[_0x49c4('0x32')]=_[_0x49c4('0x38')](_0x5c7e8c[_0x49c4('0x32')],{'$or':_[_0x49c4('0x27')](_0x5c7e8c[_0x49c4('0x2f')],function(_0x4fe16a){var _0xdb366f={};_0xdb366f[_0x4fe16a]={'$like':'%'+_0x46e4fd[_0x49c4('0x2b')][_0x49c4('0x35')]+'%'};return _0xdb366f;})});}_0x5c7e8c=_['merge']({},_0x5c7e8c,_0x46e4fd['options']);return db[_0x49c4('0x59')][_0x49c4('0x18')]({'where':_0x5c7e8c[_0x49c4('0x32')]})[_0x49c4('0x20')](function(_0x432b71){_0x1bfb8d['count']=_0x432b71;if(_0x46e4fd[_0x49c4('0x2b')][_0x49c4('0x3a')]){_0x5c7e8c[_0x49c4('0x3b')]=[{'all':!![]}];}return db[_0x49c4('0x59')]['findAll'](_0x5c7e8c);})['then'](function(_0x2ca918){_0x1bfb8d[_0x49c4('0x57')]=_0x2ca918;return _0x1bfb8d;});}})[_0x49c4('0x20')](respondWithFilteredResult(_0x549719,_0x5c7e8c))[_0x49c4('0x41')](handleError(_0x549719,null));};exports[_0x49c4('0x5a')]=function(_0x5413d8,_0x389edb,_0x3c869e){var _0x44f20d={'raw':!![],'where':{}};var _0x1b0111={};var _0x2cddc1={'count':0x0,'rows':[]};return db[_0x49c4('0x28')]['findOne']({'where':{'id':_0x5413d8[_0x49c4('0x3e')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x389edb,null))[_0x49c4('0x20')](function(_0x2dd3f2){if(_0x2dd3f2){_0x1b0111['model']=_['keys'](db[_0x49c4('0x5b')]['rawAttributes']);_0x1b0111[_0x49c4('0x2b')]=_['keys'](_0x5413d8[_0x49c4('0x2b')]);_0x1b0111[_0x49c4('0x33')]=_[_0x49c4('0x2d')](_0x1b0111[_0x49c4('0x2e')],_0x1b0111['query']);_0x44f20d['attributes']=_[_0x49c4('0x2d')](_0x1b0111[_0x49c4('0x2e')],qs[_0x49c4('0x30')](_0x5413d8['query']['fields']));_0x44f20d[_0x49c4('0x2f')]=_0x44f20d['attributes']['length']?_0x44f20d[_0x49c4('0x2f')]:_0x1b0111['model'];if(!_0x5413d8[_0x49c4('0x2b')][_0x49c4('0x53')]('nolimit')){_0x44f20d[_0x49c4('0x1a')]=qs[_0x49c4('0x1a')](_0x5413d8['query']['limit']);_0x44f20d[_0x49c4('0x19')]=qs['offset'](_0x5413d8[_0x49c4('0x2b')][_0x49c4('0x19')]);}_0x44f20d[_0x49c4('0x31')]=qs[_0x49c4('0x55')](_0x5413d8[_0x49c4('0x2b')][_0x49c4('0x55')]);_0x44f20d[_0x49c4('0x32')]=qs['filters'](_[_0x49c4('0x34')](_0x5413d8[_0x49c4('0x2b')],_0x1b0111[_0x49c4('0x33')]));_0x44f20d[_0x49c4('0x32')][_0x49c4('0x56')]=_0x2dd3f2['id'];if(_0x5413d8['query'][_0x49c4('0x35')]){_0x44f20d['where']=_[_0x49c4('0x38')](_0x44f20d[_0x49c4('0x32')],{'$or':_[_0x49c4('0x27')](_0x44f20d[_0x49c4('0x2f')],function(_0x5acbf7){var _0x293e47={};_0x293e47[_0x5acbf7]={'$like':'%'+_0x5413d8[_0x49c4('0x2b')][_0x49c4('0x35')]+'%'};return _0x293e47;})});}_0x44f20d=_[_0x49c4('0x38')]({},_0x44f20d,_0x5413d8[_0x49c4('0x39')]);return db[_0x49c4('0x5b')]['count']({'where':_0x44f20d[_0x49c4('0x32')]})['then'](function(_0xac53ad){_0x2cddc1[_0x49c4('0x18')]=_0xac53ad;if(_0x5413d8[_0x49c4('0x2b')][_0x49c4('0x3a')]){_0x44f20d['include']=[{'all':!![]}];}return db[_0x49c4('0x5b')][_0x49c4('0x3c')](_0x44f20d);})['then'](function(_0x1e0b7d){_0x2cddc1[_0x49c4('0x57')]=_0x1e0b7d;return _0x2cddc1;});}})['then'](respondWithFilteredResult(_0x389edb,_0x44f20d))['catch'](handleError(_0x389edb,null));};exports[_0x49c4('0x5c')]=function(_0x3e5915,_0x35b7e6,_0x1aa3a3){var _0x32afd4={'raw':!![],'where':{}};var _0x15e403={};var _0x184d47={'count':0x0,'rows':[]};return db[_0x49c4('0x28')][_0x49c4('0x51')]({'where':{'id':_0x3e5915[_0x49c4('0x3e')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x35b7e6,null))['then'](function(_0x58692b){if(_0x58692b){_0x15e403[_0x49c4('0x2e')]=_[_0x49c4('0x2c')](db[_0x49c4('0x5d')]['rawAttributes']);_0x15e403[_0x49c4('0x2b')]=_[_0x49c4('0x2c')](_0x3e5915['query']);_0x15e403[_0x49c4('0x33')]=_['intersection'](_0x15e403[_0x49c4('0x2e')],_0x15e403[_0x49c4('0x2b')]);_0x32afd4[_0x49c4('0x2f')]=_[_0x49c4('0x2d')](_0x15e403['model'],qs[_0x49c4('0x30')](_0x3e5915[_0x49c4('0x2b')][_0x49c4('0x30')]));_0x32afd4[_0x49c4('0x2f')]=_0x32afd4[_0x49c4('0x2f')]['length']?_0x32afd4['attributes']:_0x15e403['model'];if(!_0x3e5915[_0x49c4('0x2b')][_0x49c4('0x53')](_0x49c4('0x54'))){_0x32afd4[_0x49c4('0x1a')]=qs[_0x49c4('0x1a')](_0x3e5915['query'][_0x49c4('0x1a')]);_0x32afd4[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x3e5915[_0x49c4('0x2b')]['offset']);}_0x32afd4[_0x49c4('0x31')]=qs[_0x49c4('0x55')](_0x3e5915[_0x49c4('0x2b')][_0x49c4('0x55')]);_0x32afd4[_0x49c4('0x32')]=qs['filters'](_[_0x49c4('0x34')](_0x3e5915[_0x49c4('0x2b')],_0x15e403[_0x49c4('0x33')]));_0x32afd4['where'][_0x49c4('0x56')]=_0x58692b['id'];if(_0x3e5915[_0x49c4('0x2b')][_0x49c4('0x35')]){_0x32afd4['where']=_[_0x49c4('0x38')](_0x32afd4['where'],{'$or':_['map'](_0x32afd4[_0x49c4('0x2f')],function(_0x14d930){var _0x4ef4aa={};_0x4ef4aa[_0x14d930]={'$like':'%'+_0x3e5915[_0x49c4('0x2b')][_0x49c4('0x35')]+'%'};return _0x4ef4aa;})});}_0x32afd4=_[_0x49c4('0x38')]({},_0x32afd4,_0x3e5915[_0x49c4('0x39')]);return db[_0x49c4('0x5d')][_0x49c4('0x18')]({'where':_0x32afd4[_0x49c4('0x32')]})[_0x49c4('0x20')](function(_0x59dbef){_0x184d47['count']=_0x59dbef;if(_0x3e5915[_0x49c4('0x2b')][_0x49c4('0x3a')]){_0x32afd4[_0x49c4('0x3b')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x32afd4);})[_0x49c4('0x20')](function(_0x3222ec){_0x184d47[_0x49c4('0x57')]=_0x3222ec;return _0x184d47;});}})[_0x49c4('0x20')](respondWithFilteredResult(_0x35b7e6,_0x32afd4))[_0x49c4('0x41')](handleError(_0x35b7e6,null));};exports[_0x49c4('0x5e')]=function(_0xbabd3b,_0x49809d,_0x318008){var _0x1e2dd3={};var _0xa42e74={};var _0x3e504b;var _0x352b67;return db[_0x49c4('0x28')]['findOne']({'where':{'id':_0xbabd3b[_0x49c4('0x3e')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x49809d,null))[_0x49c4('0x20')](function(_0x318aaf){if(_0x318aaf){_0x3e504b=_0x318aaf;_0xa42e74['model']=_['keys'](db[_0x49c4('0x5f')]['rawAttributes']);_0xa42e74[_0x49c4('0x2b')]=_[_0x49c4('0x2c')](_0xbabd3b[_0x49c4('0x2b')]);_0xa42e74[_0x49c4('0x33')]=_[_0x49c4('0x2d')](_0xa42e74[_0x49c4('0x2e')],_0xa42e74[_0x49c4('0x2b')]);_0x1e2dd3[_0x49c4('0x2f')]=_[_0x49c4('0x2d')](_0xa42e74[_0x49c4('0x2e')],qs[_0x49c4('0x30')](_0xbabd3b[_0x49c4('0x2b')]['fields']));_0x1e2dd3[_0x49c4('0x2f')]=_0x1e2dd3[_0x49c4('0x2f')][_0x49c4('0x3f')]?_0x1e2dd3['attributes']:_0xa42e74[_0x49c4('0x2e')];_0x1e2dd3['order']=qs[_0x49c4('0x55')](_0xbabd3b[_0x49c4('0x2b')][_0x49c4('0x55')]);_0x1e2dd3[_0x49c4('0x32')]=qs['filters'](_[_0x49c4('0x34')](_0xbabd3b['query'],_0xa42e74['filters']));if(_0xbabd3b[_0x49c4('0x2b')][_0x49c4('0x35')]){_0x1e2dd3[_0x49c4('0x32')]=_['merge'](_0x1e2dd3['where'],{'$or':_[_0x49c4('0x27')](_0x1e2dd3[_0x49c4('0x2f')],function(_0x2d3845){var _0x330512={};_0x330512[_0x2d3845]={'$like':'%'+_0xbabd3b[_0x49c4('0x2b')][_0x49c4('0x35')]+'%'};return _0x330512;})});}_0x1e2dd3=_[_0x49c4('0x38')]({},_0x1e2dd3,_0xbabd3b[_0x49c4('0x39')]);return _0x3e504b[_0x49c4('0x5e')](_0x1e2dd3);}})['then'](function(_0x3466ef){if(_0x3466ef){_0x352b67=_0x3466ef[_0x49c4('0x3f')];if(!_0xbabd3b['query']['hasOwnProperty'](_0x49c4('0x54'))){_0x1e2dd3['limit']=qs[_0x49c4('0x1a')](_0xbabd3b['query'][_0x49c4('0x1a')]);_0x1e2dd3['offset']=qs[_0x49c4('0x19')](_0xbabd3b[_0x49c4('0x2b')][_0x49c4('0x19')]);}return _0x3e504b[_0x49c4('0x5e')](_0x1e2dd3);}})['then'](function(_0x57a3b1){if(_0x57a3b1){return _0x57a3b1?{'count':_0x352b67,'rows':_0x57a3b1}:null;}})[_0x49c4('0x20')](respondWithResult(_0x49809d,null))[_0x49c4('0x41')](handleError(_0x49809d,null));};exports[_0x49c4('0x60')]=function(_0x5737b4,_0x367d3d,_0x1814c4){var _0x5ae29d,_0x5f2411;return db[_0x49c4('0x28')][_0x49c4('0x40')]({'where':{'id':_0x5737b4[_0x49c4('0x3e')]['id']}})['then'](handleEntityNotFound(_0x367d3d,null))[_0x49c4('0x20')](function(_0x3da1a3){if(_0x3da1a3){_0x5f2411=_0x3da1a3;return _0x3da1a3[_0x49c4('0x60')](_0x5737b4[_0x49c4('0x43')]['ids'],_[_0x49c4('0x4c')](_0x5737b4['body'],['ids','id'])||{});}return null;})[_0x49c4('0x61')](function(_0x171530){var _0x12fda9;_0x5ae29d=_0x171530||[];var _0x24ff20=[];if(_0x171530){for(var _0x5adb90=0x0;_0x5adb90<_0x171530[_0x49c4('0x3f')];_0x5adb90+=0x1){var _0x947dd8=_0x171530[_0x5adb90][_0x49c4('0x47')]({'plain':!![]});_0x5f2411[_0x49c4('0x62')]=_0x5737b4['body'][_0x49c4('0x62')]?_0x5737b4['body']['dialCheckDuplicateType']:_0x5f2411[_0x49c4('0x62')];switch(_0x5f2411[_0x49c4('0x62')]){case _0x49c4('0x63'):_0x12fda9=squel['insert']()[_0x49c4('0x64')]('cm_hopper')[_0x49c4('0x65')]([_0x49c4('0x66'),_0x49c4('0x67'),_0x49c4('0x68'),_0x49c4('0x69'),_0x49c4('0x56'),_0x49c4('0x4d'),'updatedAt'],squel[_0x49c4('0x6a')]()[_0x49c4('0x6b')](_0x49c4('0x66'),_0x49c4('0x66'))['field']('NOW()','scheduledAt')[_0x49c4('0x6b')]('id',_0x49c4('0x68'))[_0x49c4('0x6b')](_0x947dd8[_0x49c4('0x6c')][_0x49c4('0x6d')](),_0x49c4('0x69'))[_0x49c4('0x6b')](_0x5737b4['params']['id'][_0x49c4('0x6d')](),_0x49c4('0x56'))['field']('NOW()','createdAt')[_0x49c4('0x6b')](_0x49c4('0x6e'),_0x49c4('0x4e'))[_0x49c4('0x6f')](_0x49c4('0x70'))[_0x49c4('0x32')](_0x49c4('0x71'))['where'](_0x49c4('0x72'),_0x947dd8[_0x49c4('0x6c')][_0x49c4('0x6d')]())[_0x49c4('0x32')]('phone\x20IS\x20NOT\x20NULL')[_0x49c4('0x32')](_0x49c4('0x73'),squel[_0x49c4('0x6a')]()[_0x49c4('0x6b')](_0x49c4('0x74'))['from'](_0x49c4('0x75'))['where']('CampaignId\x20=\x20?',_0x5737b4[_0x49c4('0x3e')]['id'][_0x49c4('0x6d')]()))[_0x49c4('0x32')](_0x49c4('0x73'),squel[_0x49c4('0x6a')]()['field'](_0x49c4('0x76'))[_0x49c4('0x6f')](_0x49c4('0x77'))['where'](_0x49c4('0x78'),_0x5737b4[_0x49c4('0x3e')]['id']['toString']())))[_0x49c4('0x6d')]();break;case _0x49c4('0x79'):_0x12fda9=squel[_0x49c4('0x7a')]()[_0x49c4('0x64')](_0x49c4('0x77'))[_0x49c4('0x65')]([_0x49c4('0x66'),'scheduledAt',_0x49c4('0x68'),_0x49c4('0x69'),_0x49c4('0x56'),_0x49c4('0x4d'),_0x49c4('0x4e')],squel['select']()[_0x49c4('0x6b')](_0x49c4('0x66'),_0x49c4('0x66'))[_0x49c4('0x6b')](_0x49c4('0x6e'),'scheduledAt')[_0x49c4('0x6b')]('id',_0x49c4('0x68'))[_0x49c4('0x6b')](_0x947dd8[_0x49c4('0x6c')][_0x49c4('0x6d')](),_0x49c4('0x69'))[_0x49c4('0x6b')](_0x5737b4[_0x49c4('0x3e')]['id'][_0x49c4('0x6d')](),_0x49c4('0x56'))['field'](_0x49c4('0x6e'),_0x49c4('0x4d'))[_0x49c4('0x6b')](_0x49c4('0x6e'),_0x49c4('0x4e'))['from']('cm_contacts')[_0x49c4('0x32')](_0x49c4('0x71'))[_0x49c4('0x32')](_0x49c4('0x72'),_0x947dd8[_0x49c4('0x6c')][_0x49c4('0x6d')]())['where'](_0x49c4('0x7b'))[_0x49c4('0x32')]('phone\x20NOT\x20IN\x20(?)',squel[_0x49c4('0x6a')]()['field'](_0x49c4('0x76'))[_0x49c4('0x6f')](_0x49c4('0x77'))['where'](_0x49c4('0x78'),_0x5737b4['params']['id'][_0x49c4('0x6d')]())))['toString']();break;default:_0x12fda9=squel['insert']()[_0x49c4('0x64')](_0x49c4('0x77'))[_0x49c4('0x65')]([_0x49c4('0x66'),_0x49c4('0x67'),_0x49c4('0x68'),'ListId','CampaignId',_0x49c4('0x4d'),_0x49c4('0x4e')],squel[_0x49c4('0x6a')]()[_0x49c4('0x6b')](_0x49c4('0x66'),_0x49c4('0x66'))[_0x49c4('0x6b')]('NOW()','scheduledAt')['field']('id','ContactId')[_0x49c4('0x6b')](_0x947dd8['CmListId'][_0x49c4('0x6d')](),_0x49c4('0x69'))[_0x49c4('0x6b')](_0x5737b4['params']['id']['toString'](),_0x49c4('0x56'))[_0x49c4('0x6b')]('NOW()',_0x49c4('0x4d'))[_0x49c4('0x6b')](_0x49c4('0x6e'),_0x49c4('0x4e'))[_0x49c4('0x6f')](_0x49c4('0x70'))['where'](_0x49c4('0x71'))[_0x49c4('0x32')](_0x49c4('0x72'),_0x947dd8['CmListId'][_0x49c4('0x6d')]())[_0x49c4('0x32')](_0x49c4('0x7b')))[_0x49c4('0x6d')]();}_0x24ff20[_0x49c4('0x7c')](db[_0x49c4('0x7d')][_0x49c4('0x2b')](_0x12fda9));}return BPromise[_0x49c4('0x7e')](_0x24ff20);}})['then'](function(){return _0x5ae29d;})[_0x49c4('0x20')](respondWithResult(_0x367d3d,null))[_0x49c4('0x41')](handleError(_0x367d3d,null));};exports[_0x49c4('0x7f')]=function(_0xa87ddd,_0x19175d,_0x471ec6){return db['Campaign'][_0x49c4('0x40')]({'where':{'id':_0xa87ddd[_0x49c4('0x3e')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x19175d,null))[_0x49c4('0x20')](function(_0x4462ec){if(_0x4462ec){return _0x4462ec[_0x49c4('0x7f')](_0xa87ddd[_0x49c4('0x2b')][_0x49c4('0x80')]);}})[_0x49c4('0x20')](function(_0xc641bc){if(_0xc641bc){return db[_0x49c4('0x52')][_0x49c4('0x23')]({'where':{'ListId':_0xa87ddd[_0x49c4('0x2b')][_0x49c4('0x80')],'CampaignId':_0xa87ddd['params']['id']}})['then'](function(){return _0xc641bc;});}})[_0x49c4('0x20')](respondWithStatusCode(_0x19175d,null))[_0x49c4('0x41')](handleError(_0x19175d,null));};exports['getBlackLists']=function(_0x5c46f5,_0x452cbb,_0x57062c){var _0x125fa4={'raw':!![],'where':{}};var _0x8a4230={};var _0x1ac2c0={'count':0x0,'rows':[]};return db[_0x49c4('0x28')][_0x49c4('0x51')]({'where':{'id':_0x5c46f5[_0x49c4('0x3e')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x452cbb,null))[_0x49c4('0x20')](function(_0x58b96c){if(_0x58b96c){_0x8a4230[_0x49c4('0x2e')]=_[_0x49c4('0x2c')](db[_0x49c4('0x5f')][_0x49c4('0x29')]);_0x8a4230[_0x49c4('0x2b')]=_['keys'](_0x5c46f5[_0x49c4('0x2b')]);_0x8a4230[_0x49c4('0x33')]=_['intersection'](_0x8a4230[_0x49c4('0x2e')],_0x8a4230[_0x49c4('0x2b')]);_0x125fa4['attributes']=_[_0x49c4('0x2d')](_0x8a4230[_0x49c4('0x2e')],qs[_0x49c4('0x30')](_0x5c46f5['query'][_0x49c4('0x30')]));_0x125fa4[_0x49c4('0x2f')]=_0x125fa4[_0x49c4('0x2f')][_0x49c4('0x3f')]?_0x125fa4['attributes']:_0x8a4230[_0x49c4('0x2e')];if(!_0x5c46f5['query'][_0x49c4('0x53')](_0x49c4('0x54'))){_0x125fa4[_0x49c4('0x1a')]=qs[_0x49c4('0x1a')](_0x5c46f5['query'][_0x49c4('0x1a')]);_0x125fa4[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x5c46f5[_0x49c4('0x2b')][_0x49c4('0x19')]);}_0x125fa4[_0x49c4('0x31')]=qs['sort'](_0x5c46f5['query'][_0x49c4('0x55')]);_0x125fa4[_0x49c4('0x32')]=qs[_0x49c4('0x33')](_[_0x49c4('0x34')](_0x5c46f5[_0x49c4('0x2b')],_0x8a4230[_0x49c4('0x33')]));_0x125fa4[_0x49c4('0x32')][_0x49c4('0x56')]=_0x58b96c['id'];if(_0x5c46f5[_0x49c4('0x2b')][_0x49c4('0x35')]){_0x125fa4[_0x49c4('0x32')]=_[_0x49c4('0x38')](_0x125fa4['where'],{'$or':_[_0x49c4('0x27')](_0x125fa4[_0x49c4('0x2f')],function(_0x491203){var _0x154017={};_0x154017[_0x491203]={'$like':'%'+_0x5c46f5['query'][_0x49c4('0x35')]+'%'};return _0x154017;})});}_0x125fa4=_[_0x49c4('0x38')]({},_0x125fa4,_0x5c46f5['options']);return db[_0x49c4('0x5f')][_0x49c4('0x18')]({'where':_0x125fa4[_0x49c4('0x32')]})[_0x49c4('0x20')](function(_0x29ae49){_0x1ac2c0['count']=_0x29ae49;if(_0x5c46f5[_0x49c4('0x2b')]['includeAll']){_0x125fa4[_0x49c4('0x3b')]=[{'all':!![]}];}return db[_0x49c4('0x5f')][_0x49c4('0x3c')](_0x125fa4);})['then'](function(_0x236111){_0x1ac2c0[_0x49c4('0x57')]=_0x236111;return _0x1ac2c0;});}})[_0x49c4('0x20')](respondWithFilteredResult(_0x452cbb,_0x125fa4))['catch'](handleError(_0x452cbb,null));};exports['addBlackLists']=function(_0x256d6b,_0x590586,_0x30dfdc){var _0x3dfc99,_0x3900a6;return db[_0x49c4('0x28')]['find']({'where':{'id':_0x256d6b['params']['id']}})['then'](handleEntityNotFound(_0x590586,null))[_0x49c4('0x20')](function(_0x417cef){if(_0x417cef){_0x3900a6=_0x417cef;return _0x417cef[_0x49c4('0x81')](_0x256d6b[_0x49c4('0x43')]['ids'],_[_0x49c4('0x4c')](_0x256d6b[_0x49c4('0x43')],[_0x49c4('0x80'),'id'])||{});}return null;})[_0x49c4('0x61')](function(_0x2e2f80){var _0xe3af68;_0x3dfc99=_0x2e2f80||[];var _0xc2f3d0=[];if(_0x2e2f80){for(var _0x1d2931=0x0;_0x1d2931<_0x2e2f80[_0x49c4('0x3f')];_0x1d2931+=0x1){var _0x39e6f5=_0x2e2f80[_0x1d2931][_0x49c4('0x47')]({'plain':!![]});_0xe3af68=squel['insert']()[_0x49c4('0x64')]('cm_hopper_black')[_0x49c4('0x65')]([_0x49c4('0x66'),_0x49c4('0x68'),_0x49c4('0x69'),'CampaignId',_0x49c4('0x4d'),'updatedAt'],squel['select']()['field'](_0x49c4('0x66'),_0x49c4('0x66'))[_0x49c4('0x6b')]('id','ContactId')[_0x49c4('0x6b')](_0x39e6f5['CmListId'][_0x49c4('0x6d')](),_0x49c4('0x69'))[_0x49c4('0x6b')](_0x256d6b['params']['id'][_0x49c4('0x6d')](),_0x49c4('0x56'))[_0x49c4('0x6b')](_0x49c4('0x6e'),_0x49c4('0x4d'))['field'](_0x49c4('0x6e'),_0x49c4('0x4e'))[_0x49c4('0x6f')](_0x49c4('0x70'))['where']('deletedAt\x20IS\x20NULL')[_0x49c4('0x32')](_0x49c4('0x72'),_0x39e6f5['CmListId'][_0x49c4('0x6d')]())[_0x49c4('0x32')](_0x49c4('0x7b')))[_0x49c4('0x6d')]();_0xc2f3d0['push'](db[_0x49c4('0x7d')][_0x49c4('0x2b')](_0xe3af68));}return BPromise['all'](_0xc2f3d0);}})['then'](function(){return _0x3dfc99;})[_0x49c4('0x20')](respondWithResult(_0x590586,null))[_0x49c4('0x41')](handleError(_0x590586,null));};exports[_0x49c4('0x82')]=function(_0x56fe72,_0x1241b6,_0x5ee9f1){return db[_0x49c4('0x28')]['find']({'where':{'id':_0x56fe72[_0x49c4('0x3e')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x1241b6,null))[_0x49c4('0x20')](function(_0x13e8e2){if(_0x13e8e2){return _0x13e8e2['removeBlackLists'](_0x56fe72['query']['ids']);}})[_0x49c4('0x20')](function(_0x96bce0){if(_0x96bce0){return db[_0x49c4('0x5d')][_0x49c4('0x23')]({'where':{'ListId':_0x56fe72['query']['ids'],'CampaignId':_0x56fe72[_0x49c4('0x3e')]['id']}})['then'](function(){return _0x96bce0;});}})[_0x49c4('0x20')](respondWithStatusCode(_0x1241b6,null))[_0x49c4('0x41')](handleError(_0x1241b6,null));}; \ No newline at end of file +var _0x5b02=['name','index','map','Campaign','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','filter','options','include','findAll','catch','show','params','includeAll','find','body','user','get','autoAssociation','create','error','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','getHoppers','findOne','CmHopper','pick','rows','getHopperHistories','CampaignId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','ids','spread','dialCheckDuplicateType','always','into','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','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','onlyIfOpen','COALESCE(phone,\x27\x27)','sequelize','all','removeLists','getBlackLists','CmList','addBlackLists','insert','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','then','IvrCampaigns','UserProfileResource','stack'];(function(_0x5d3fbc,_0x3d0609){var _0x3186c7=function(_0x6001a7){while(--_0x6001a7){_0x5d3fbc['push'](_0x5d3fbc['shift']());}};_0x3186c7(++_0x3d0609);}(_0x5b02,0xe9));var _0x25b0=function(_0x5a3daf,_0x34c209){_0x5a3daf=_0x5a3daf-0x0;var _0x18509b=_0x5b02[_0x5a3daf];return _0x18509b;};'use strict';var pdf=require(_0x25b0('0x0'));var emlformat=require(_0x25b0('0x1'));var rimraf=require(_0x25b0('0x2'));var zipdir=require(_0x25b0('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x25b0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x25b0('0x5'));var util=require(_0x25b0('0x6'));var path=require(_0x25b0('0x7'));var sox=require(_0x25b0('0x8'));var csv=require(_0x25b0('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x25b0('0xa'));var squel=require(_0x25b0('0xb'));var crypto=require('crypto');var jsforce=require(_0x25b0('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x25b0('0xd'));var Papa=require(_0x25b0('0xe'));var Redis=require(_0x25b0('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x25b0('0x10'));var as=require(_0x25b0('0x11'));var hardwareService=require(_0x25b0('0x12'));var logger=require(_0x25b0('0x13'))(_0x25b0('0x14'));var utils=require(_0x25b0('0x15'));var config=require(_0x25b0('0x16'));var db=require(_0x25b0('0x17'))['db'];function respondWithStatusCode(_0x193c2b,_0x1d3178){_0x1d3178=_0x1d3178||0xcc;return function(_0x184452){if(_0x184452){return _0x193c2b[_0x25b0('0x18')](_0x1d3178);}return _0x193c2b[_0x25b0('0x19')](_0x1d3178)[_0x25b0('0x1a')]();};}function respondWithResult(_0x1ceeb1,_0x42cc07){_0x42cc07=_0x42cc07||0xc8;return function(_0x293203){if(_0x293203){return _0x1ceeb1[_0x25b0('0x19')](_0x42cc07)[_0x25b0('0x1b')](_0x293203);}};}function respondWithFilteredResult(_0x3b89e7,_0x40071c){return function(_0x5ac18d){if(_0x5ac18d){var _0x51542b=_0x5ac18d[_0x25b0('0x1c')],_0xfe1ea6=_0x40071c[_0x25b0('0x1d')],_0x4b2357=_0x40071c[_0x25b0('0x1d')]+_0x40071c['limit'],_0xa8280a;if(_0x4b2357>=_0x51542b){_0x4b2357=_0x51542b;_0xa8280a=0xc8;}else{_0xa8280a=0xce;}_0x3b89e7[_0x25b0('0x19')](_0xa8280a);return _0x3b89e7[_0x25b0('0x1e')](_0x25b0('0x1f'),_0xfe1ea6+'-'+_0x4b2357+'/'+_0x51542b)[_0x25b0('0x1b')](_0x5ac18d);}return null;};}function patchUpdates(_0xe750bf){return function(_0x25872d){try{jsonpatch['apply'](_0x25872d,_0xe750bf,!![]);}catch(_0x348d36){return BPromise[_0x25b0('0x20')](_0x348d36);}return _0x25872d[_0x25b0('0x21')]();};}function saveUpdates(_0x1507b5,_0x1dc691){return function(_0xea4162){if(_0xea4162){return _0xea4162[_0x25b0('0x22')](_0x1507b5)[_0x25b0('0x23')](function(_0x7bdaf9){return _0x7bdaf9;});}return null;};}function removeEntity(_0x35939f,_0x2b2eda){return function(_0x3ce1da){if(_0x3ce1da){return _0x3ce1da['destroy']()[_0x25b0('0x23')](function(){var _0x16623c=_0x3ce1da['get']({'plain':!![]});var _0x2d7c17=_0x25b0('0x24');return db[_0x25b0('0x25')]['destroy']({'where':{'type':_0x2d7c17,'resourceId':_0x16623c['id']}})['then'](function(){return _0x3ce1da;});})['then'](function(){_0x35939f[_0x25b0('0x19')](0xcc)[_0x25b0('0x1a')]();});}};}function handleEntityNotFound(_0x99bd3a,_0x24f847){return function(_0xdbb459){if(!_0xdbb459){_0x99bd3a[_0x25b0('0x18')](0x194);}return _0xdbb459;};}function handleError(_0x40268a,_0x75ce7a){_0x75ce7a=_0x75ce7a||0x1f4;return function(_0x22e024){logger['error'](_0x22e024[_0x25b0('0x26')]);if(_0x22e024[_0x25b0('0x27')]){delete _0x22e024['name'];}_0x40268a['status'](_0x75ce7a)['send'](_0x22e024);};}exports[_0x25b0('0x28')]=function(_0x3f0a54,_0x251fad){var _0x105129={},_0x214377={},_0x3285ae={'count':0x0,'rows':[]};var _0x12676b=_[_0x25b0('0x29')](db[_0x25b0('0x2a')][_0x25b0('0x2b')],function(_0x1e217c){return{'name':_0x1e217c[_0x25b0('0x2c')],'type':_0x1e217c[_0x25b0('0x2d')]['key']};});_0x214377['model']=_[_0x25b0('0x29')](_0x12676b,'name');_0x214377['query']=_[_0x25b0('0x2e')](_0x3f0a54[_0x25b0('0x2f')]);_0x214377[_0x25b0('0x30')]=_[_0x25b0('0x31')](_0x214377[_0x25b0('0x32')],_0x214377['query']);_0x105129[_0x25b0('0x33')]=_[_0x25b0('0x31')](_0x214377['model'],qs[_0x25b0('0x34')](_0x3f0a54[_0x25b0('0x2f')]['fields']));_0x105129[_0x25b0('0x33')]=_0x105129['attributes'][_0x25b0('0x35')]?_0x105129[_0x25b0('0x33')]:_0x214377[_0x25b0('0x32')];if(!_0x3f0a54[_0x25b0('0x2f')][_0x25b0('0x36')](_0x25b0('0x37'))){_0x105129[_0x25b0('0x38')]=qs[_0x25b0('0x38')](_0x3f0a54[_0x25b0('0x2f')]['limit']);_0x105129[_0x25b0('0x1d')]=qs[_0x25b0('0x1d')](_0x3f0a54[_0x25b0('0x2f')][_0x25b0('0x1d')]);}_0x105129[_0x25b0('0x39')]=qs[_0x25b0('0x3a')](_0x3f0a54[_0x25b0('0x2f')][_0x25b0('0x3a')]);_0x105129[_0x25b0('0x3b')]=qs[_0x25b0('0x30')](_['pick'](_0x3f0a54[_0x25b0('0x2f')],_0x214377[_0x25b0('0x30')]));if(_0x3f0a54[_0x25b0('0x2f')]['filter']){_0x105129[_0x25b0('0x3b')]=_[_0x25b0('0x3c')](_0x105129[_0x25b0('0x3b')],{'$or':_[_0x25b0('0x29')](_0x12676b,function(_0x17f67c){if(_0x17f67c[_0x25b0('0x2d')]!==_0x25b0('0x3d')){var _0x391493={};_0x391493[_0x17f67c['name']]={'$like':'%'+_0x3f0a54['query'][_0x25b0('0x3e')]+'%'};return _0x391493;}})});}_0x105129=_[_0x25b0('0x3c')]({},_0x105129,_0x3f0a54[_0x25b0('0x3f')]);var _0x52c0af={'where':_0x105129[_0x25b0('0x3b')]};return db['Campaign'][_0x25b0('0x1c')](_0x52c0af)[_0x25b0('0x23')](function(_0xbd0db5){_0x3285ae[_0x25b0('0x1c')]=_0xbd0db5;if(_0x3f0a54[_0x25b0('0x2f')]['includeAll']){_0x105129[_0x25b0('0x40')]=[{'all':!![]}];}return db[_0x25b0('0x2a')][_0x25b0('0x41')](_0x105129);})[_0x25b0('0x23')](function(_0x428799){_0x3285ae['rows']=_0x428799;return _0x3285ae;})[_0x25b0('0x23')](respondWithFilteredResult(_0x251fad,_0x105129))[_0x25b0('0x42')](handleError(_0x251fad,null));};exports[_0x25b0('0x43')]=function(_0x44c400,_0x35fc00){var _0x1adf8d={'raw':![],'where':{'id':_0x44c400[_0x25b0('0x44')]['id']}},_0x51deba={};_0x51deba[_0x25b0('0x32')]=_[_0x25b0('0x2e')](db[_0x25b0('0x2a')]['rawAttributes']);_0x51deba[_0x25b0('0x2f')]=_['keys'](_0x44c400[_0x25b0('0x2f')]);_0x51deba[_0x25b0('0x30')]=_[_0x25b0('0x31')](_0x51deba[_0x25b0('0x32')],_0x51deba['query']);_0x1adf8d[_0x25b0('0x33')]=_[_0x25b0('0x31')](_0x51deba[_0x25b0('0x32')],qs['fields'](_0x44c400[_0x25b0('0x2f')][_0x25b0('0x34')]));_0x1adf8d[_0x25b0('0x33')]=_0x1adf8d[_0x25b0('0x33')][_0x25b0('0x35')]?_0x1adf8d[_0x25b0('0x33')]:_0x51deba[_0x25b0('0x32')];if(_0x44c400['query'][_0x25b0('0x45')]){_0x1adf8d[_0x25b0('0x40')]=[{'all':!![]}];}_0x1adf8d=_[_0x25b0('0x3c')]({},_0x1adf8d,_0x44c400['options']);return db[_0x25b0('0x2a')][_0x25b0('0x46')](_0x1adf8d)[_0x25b0('0x23')](handleEntityNotFound(_0x35fc00,null))[_0x25b0('0x23')](respondWithResult(_0x35fc00,null))[_0x25b0('0x42')](handleError(_0x35fc00,null));};exports['create']=function(_0x1e8a8d,_0x1cf933){return db[_0x25b0('0x2a')]['create'](_0x1e8a8d[_0x25b0('0x47')],{})[_0x25b0('0x23')](function(_0x1fea01){var _0x1d6d55=_0x1e8a8d[_0x25b0('0x48')][_0x25b0('0x49')]({'plain':!![]});if(!_0x1d6d55)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1d6d55['role']==='user'){var _0x1eb908=_0x1fea01['get']({'plain':!![]});var _0x48bc07=_0x25b0('0x24');return db['UserProfileSection'][_0x25b0('0x46')]({'where':{'name':_0x48bc07,'userProfileId':_0x1d6d55['userProfileId']},'raw':!![]})['then'](function(_0x394e52){if(_0x394e52&&_0x394e52[_0x25b0('0x4a')]===0x0){return db[_0x25b0('0x25')][_0x25b0('0x4b')]({'name':_0x1eb908[_0x25b0('0x27')],'resourceId':_0x1eb908['id'],'type':_0x394e52[_0x25b0('0x27')],'sectionId':_0x394e52['id']},{})[_0x25b0('0x23')](function(){return _0x1fea01;});}else{return _0x1fea01;}})[_0x25b0('0x42')](function(_0x2e68ad){logger[_0x25b0('0x4c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2e68ad);throw _0x2e68ad;});}return _0x1fea01;})['then'](respondWithResult(_0x1cf933,0xc9))['catch'](handleError(_0x1cf933,null));};exports[_0x25b0('0x4d')]=function(_0xa45e87,_0x2a28fb){var _0x422d9d={'where':{'id':_0xa45e87[_0x25b0('0x44')]['id']}},_0x14db4c={};_0x14db4c[_0x25b0('0x32')]=_['keys'](db[_0x25b0('0x2a')]['rawAttributes']);_0x422d9d[_0x25b0('0x33')]=_['intersection'](_0x14db4c['model'],qs[_0x25b0('0x34')](_0xa45e87['query']['fields']));_0x422d9d[_0x25b0('0x33')]=_0x422d9d[_0x25b0('0x33')][_0x25b0('0x35')]?_0x422d9d[_0x25b0('0x33')]:_0x14db4c[_0x25b0('0x32')];if(_0xa45e87[_0x25b0('0x2f')][_0x25b0('0x45')]){_0x422d9d[_0x25b0('0x40')]=[{'all':!![]}];}_0x422d9d=_[_0x25b0('0x3c')]({},_0x422d9d,_0xa45e87[_0x25b0('0x3f')]);return db['Campaign']['find'](_0x422d9d)[_0x25b0('0x23')](handleEntityNotFound(_0x2a28fb,null))[_0x25b0('0x23')](function(_0x47a13d){if(_0x47a13d){var _0xef5172=_0x47a13d[_0x25b0('0x49')]({'plain':!![]});_0xef5172=qs[_0x25b0('0x4e')](_0xef5172,['id',_0x25b0('0x4f'),_0x25b0('0x50')]);_0xa45e87['body']=_[_0x25b0('0x4e')](_0xa45e87[_0x25b0('0x47')],['id',_0x25b0('0x4f'),'updatedAt']);return db[_0x25b0('0x2a')][_0x25b0('0x4b')](_[_0x25b0('0x3c')](_0xef5172,_0xa45e87[_0x25b0('0x47')]),{'include':_0xa45e87[_0x25b0('0x2f')][_0x25b0('0x45')]?[{'all':!![]}]:undefined})[_0x25b0('0x23')](function(_0x2ccf0c){var _0x28682b=_0xa45e87[_0x25b0('0x48')][_0x25b0('0x49')]({'plain':!![]});if(!_0x28682b)throw new Error(_0x25b0('0x51'));if(_0x28682b[_0x25b0('0x52')]===_0x25b0('0x48')){var _0x561634=_0x2ccf0c[_0x25b0('0x49')]({'plain':!![]});var _0x4592bf='IvrCampaigns';return db[_0x25b0('0x53')]['find']({'where':{'name':_0x4592bf,'userProfileId':_0x28682b[_0x25b0('0x54')]},'raw':!![]})[_0x25b0('0x23')](function(_0x4cd91f){if(_0x4cd91f&&_0x4cd91f[_0x25b0('0x4a')]===0x0){return db[_0x25b0('0x25')][_0x25b0('0x4b')]({'name':_0x561634['name'],'resourceId':_0x561634['id'],'type':_0x4cd91f[_0x25b0('0x27')],'sectionId':_0x4cd91f['id']},{})['then'](function(){return _0x2ccf0c;});}else{return _0x2ccf0c;}})[_0x25b0('0x42')](function(_0x257f20){logger['error'](_0x25b0('0x55'),_0x257f20);throw _0x257f20;});}return _0x2ccf0c;});}})[_0x25b0('0x23')](respondWithResult(_0x2a28fb,0xc9))['catch'](handleError(_0x2a28fb,null));};exports[_0x25b0('0x22')]=function(_0x5b1aef,_0x5e7724){if(_0x5b1aef['body']['id']){delete _0x5b1aef[_0x25b0('0x47')]['id'];}return db[_0x25b0('0x2a')][_0x25b0('0x46')]({'where':{'id':_0x5b1aef['params']['id']}})[_0x25b0('0x23')](handleEntityNotFound(_0x5e7724,null))[_0x25b0('0x23')](saveUpdates(_0x5b1aef[_0x25b0('0x47')],null))[_0x25b0('0x23')](respondWithResult(_0x5e7724,null))[_0x25b0('0x42')](handleError(_0x5e7724,null));};exports[_0x25b0('0x56')]=function(_0x1568f4,_0x452f19){return db[_0x25b0('0x2a')][_0x25b0('0x46')]({'where':{'id':_0x1568f4[_0x25b0('0x44')]['id']}})[_0x25b0('0x23')](handleEntityNotFound(_0x452f19,null))[_0x25b0('0x23')](removeEntity(_0x452f19,null))[_0x25b0('0x42')](handleError(_0x452f19,null));};exports[_0x25b0('0x57')]=function(_0x1f418e,_0x19fa5c,_0x5ab1bb){var _0x24a32b={'raw':!![],'where':{}};var _0x4daaab={};var _0x210ae3={'count':0x0,'rows':[]};return db[_0x25b0('0x2a')][_0x25b0('0x58')]({'where':{'id':_0x1f418e[_0x25b0('0x44')]['id']}})['then'](handleEntityNotFound(_0x19fa5c,null))[_0x25b0('0x23')](function(_0x646457){if(_0x646457){_0x4daaab[_0x25b0('0x32')]=_[_0x25b0('0x2e')](db[_0x25b0('0x59')][_0x25b0('0x2b')]);_0x4daaab['query']=_['keys'](_0x1f418e[_0x25b0('0x2f')]);_0x4daaab['filters']=_[_0x25b0('0x31')](_0x4daaab[_0x25b0('0x32')],_0x4daaab[_0x25b0('0x2f')]);_0x24a32b['attributes']=_[_0x25b0('0x31')](_0x4daaab[_0x25b0('0x32')],qs[_0x25b0('0x34')](_0x1f418e[_0x25b0('0x2f')]['fields']));_0x24a32b[_0x25b0('0x33')]=_0x24a32b[_0x25b0('0x33')][_0x25b0('0x35')]?_0x24a32b['attributes']:_0x4daaab[_0x25b0('0x32')];if(!_0x1f418e[_0x25b0('0x2f')][_0x25b0('0x36')](_0x25b0('0x37'))){_0x24a32b[_0x25b0('0x38')]=qs[_0x25b0('0x38')](_0x1f418e[_0x25b0('0x2f')][_0x25b0('0x38')]);_0x24a32b['offset']=qs[_0x25b0('0x1d')](_0x1f418e[_0x25b0('0x2f')][_0x25b0('0x1d')]);}_0x24a32b[_0x25b0('0x39')]=qs['sort'](_0x1f418e['query'][_0x25b0('0x3a')]);_0x24a32b[_0x25b0('0x3b')]=qs[_0x25b0('0x30')](_[_0x25b0('0x5a')](_0x1f418e['query'],_0x4daaab[_0x25b0('0x30')]));_0x24a32b[_0x25b0('0x3b')]['CampaignId']=_0x646457['id'];if(_0x1f418e[_0x25b0('0x2f')][_0x25b0('0x3e')]){_0x24a32b['where']=_['merge'](_0x24a32b[_0x25b0('0x3b')],{'$or':_[_0x25b0('0x29')](_0x24a32b[_0x25b0('0x33')],function(_0x2ea20e){var _0x112ac6={};_0x112ac6[_0x2ea20e]={'$like':'%'+_0x1f418e[_0x25b0('0x2f')][_0x25b0('0x3e')]+'%'};return _0x112ac6;})});}_0x24a32b=_[_0x25b0('0x3c')]({},_0x24a32b,_0x1f418e[_0x25b0('0x3f')]);return db[_0x25b0('0x59')][_0x25b0('0x1c')]({'where':_0x24a32b[_0x25b0('0x3b')]})[_0x25b0('0x23')](function(_0x51867c){_0x210ae3[_0x25b0('0x1c')]=_0x51867c;if(_0x1f418e['query'][_0x25b0('0x45')]){_0x24a32b[_0x25b0('0x40')]=[{'all':!![]}];}return db['CmHopper'][_0x25b0('0x41')](_0x24a32b);})[_0x25b0('0x23')](function(_0x2e1bef){_0x210ae3[_0x25b0('0x5b')]=_0x2e1bef;return _0x210ae3;});}})[_0x25b0('0x23')](respondWithFilteredResult(_0x19fa5c,_0x24a32b))[_0x25b0('0x42')](handleError(_0x19fa5c,null));};exports[_0x25b0('0x5c')]=function(_0x3f6b41,_0x2e729f,_0xd5351e){var _0x36252f={'raw':!![],'where':{}};var _0x581e22={};var _0x4de403={'count':0x0,'rows':[]};return db[_0x25b0('0x2a')][_0x25b0('0x58')]({'where':{'id':_0x3f6b41['params']['id']}})['then'](handleEntityNotFound(_0x2e729f,null))[_0x25b0('0x23')](function(_0x516dc5){if(_0x516dc5){_0x581e22[_0x25b0('0x32')]=_[_0x25b0('0x2e')](db['CmHopperHistory'][_0x25b0('0x2b')]);_0x581e22[_0x25b0('0x2f')]=_['keys'](_0x3f6b41[_0x25b0('0x2f')]);_0x581e22[_0x25b0('0x30')]=_[_0x25b0('0x31')](_0x581e22[_0x25b0('0x32')],_0x581e22[_0x25b0('0x2f')]);_0x36252f['attributes']=_['intersection'](_0x581e22[_0x25b0('0x32')],qs['fields'](_0x3f6b41['query']['fields']));_0x36252f[_0x25b0('0x33')]=_0x36252f[_0x25b0('0x33')][_0x25b0('0x35')]?_0x36252f['attributes']:_0x581e22['model'];if(!_0x3f6b41[_0x25b0('0x2f')][_0x25b0('0x36')]('nolimit')){_0x36252f['limit']=qs['limit'](_0x3f6b41[_0x25b0('0x2f')][_0x25b0('0x38')]);_0x36252f[_0x25b0('0x1d')]=qs[_0x25b0('0x1d')](_0x3f6b41['query'][_0x25b0('0x1d')]);}_0x36252f[_0x25b0('0x39')]=qs[_0x25b0('0x3a')](_0x3f6b41[_0x25b0('0x2f')][_0x25b0('0x3a')]);_0x36252f[_0x25b0('0x3b')]=qs[_0x25b0('0x30')](_[_0x25b0('0x5a')](_0x3f6b41[_0x25b0('0x2f')],_0x581e22[_0x25b0('0x30')]));_0x36252f[_0x25b0('0x3b')][_0x25b0('0x5d')]=_0x516dc5['id'];if(_0x3f6b41[_0x25b0('0x2f')][_0x25b0('0x3e')]){_0x36252f[_0x25b0('0x3b')]=_[_0x25b0('0x3c')](_0x36252f[_0x25b0('0x3b')],{'$or':_[_0x25b0('0x29')](_0x36252f['attributes'],function(_0x5b0091){var _0x14ac78={};_0x14ac78[_0x5b0091]={'$like':'%'+_0x3f6b41['query'][_0x25b0('0x3e')]+'%'};return _0x14ac78;})});}_0x36252f=_['merge']({},_0x36252f,_0x3f6b41['options']);return db['CmHopperHistory']['count']({'where':_0x36252f['where']})[_0x25b0('0x23')](function(_0x10e42a){_0x4de403[_0x25b0('0x1c')]=_0x10e42a;if(_0x3f6b41['query'][_0x25b0('0x45')]){_0x36252f[_0x25b0('0x40')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x25b0('0x41')](_0x36252f);})[_0x25b0('0x23')](function(_0x26b73e){_0x4de403[_0x25b0('0x5b')]=_0x26b73e;return _0x4de403;});}})[_0x25b0('0x23')](respondWithFilteredResult(_0x2e729f,_0x36252f))[_0x25b0('0x42')](handleError(_0x2e729f,null));};exports[_0x25b0('0x5e')]=function(_0x1bfafe,_0x16d442,_0x476a66){var _0x289c16={'raw':!![],'where':{}};var _0x116f56={};var _0x112a28={'count':0x0,'rows':[]};return db[_0x25b0('0x2a')][_0x25b0('0x58')]({'where':{'id':_0x1bfafe[_0x25b0('0x44')]['id']}})[_0x25b0('0x23')](handleEntityNotFound(_0x16d442,null))['then'](function(_0x2e6b99){if(_0x2e6b99){_0x116f56[_0x25b0('0x32')]=_[_0x25b0('0x2e')](db[_0x25b0('0x5f')][_0x25b0('0x2b')]);_0x116f56['query']=_[_0x25b0('0x2e')](_0x1bfafe['query']);_0x116f56[_0x25b0('0x30')]=_['intersection'](_0x116f56['model'],_0x116f56[_0x25b0('0x2f')]);_0x289c16['attributes']=_[_0x25b0('0x31')](_0x116f56[_0x25b0('0x32')],qs['fields'](_0x1bfafe[_0x25b0('0x2f')][_0x25b0('0x34')]));_0x289c16[_0x25b0('0x33')]=_0x289c16[_0x25b0('0x33')]['length']?_0x289c16[_0x25b0('0x33')]:_0x116f56[_0x25b0('0x32')];if(!_0x1bfafe[_0x25b0('0x2f')]['hasOwnProperty'](_0x25b0('0x37'))){_0x289c16[_0x25b0('0x38')]=qs[_0x25b0('0x38')](_0x1bfafe[_0x25b0('0x2f')][_0x25b0('0x38')]);_0x289c16['offset']=qs['offset'](_0x1bfafe[_0x25b0('0x2f')][_0x25b0('0x1d')]);}_0x289c16[_0x25b0('0x39')]=qs[_0x25b0('0x3a')](_0x1bfafe[_0x25b0('0x2f')][_0x25b0('0x3a')]);_0x289c16[_0x25b0('0x3b')]=qs[_0x25b0('0x30')](_[_0x25b0('0x5a')](_0x1bfafe[_0x25b0('0x2f')],_0x116f56[_0x25b0('0x30')]));_0x289c16[_0x25b0('0x3b')][_0x25b0('0x5d')]=_0x2e6b99['id'];if(_0x1bfafe['query'][_0x25b0('0x3e')]){_0x289c16['where']=_[_0x25b0('0x3c')](_0x289c16[_0x25b0('0x3b')],{'$or':_[_0x25b0('0x29')](_0x289c16[_0x25b0('0x33')],function(_0x837602){var _0x65610={};_0x65610[_0x837602]={'$like':'%'+_0x1bfafe['query'][_0x25b0('0x3e')]+'%'};return _0x65610;})});}_0x289c16=_['merge']({},_0x289c16,_0x1bfafe[_0x25b0('0x3f')]);return db['CmHopperFinal'][_0x25b0('0x1c')]({'where':_0x289c16[_0x25b0('0x3b')]})[_0x25b0('0x23')](function(_0x5f8934){_0x112a28[_0x25b0('0x1c')]=_0x5f8934;if(_0x1bfafe[_0x25b0('0x2f')]['includeAll']){_0x289c16['include']=[{'all':!![]}];}return db[_0x25b0('0x5f')][_0x25b0('0x41')](_0x289c16);})[_0x25b0('0x23')](function(_0x3010d0){_0x112a28['rows']=_0x3010d0;return _0x112a28;});}})[_0x25b0('0x23')](respondWithFilteredResult(_0x16d442,_0x289c16))[_0x25b0('0x42')](handleError(_0x16d442,null));};exports[_0x25b0('0x60')]=function(_0x130ef5,_0x595e96,_0x2b20e8){var _0xc6c16b={'raw':!![],'where':{}};var _0x52bcb7={};var _0xd3cba0={'count':0x0,'rows':[]};return db[_0x25b0('0x2a')][_0x25b0('0x58')]({'where':{'id':_0x130ef5[_0x25b0('0x44')]['id']}})[_0x25b0('0x23')](handleEntityNotFound(_0x595e96,null))[_0x25b0('0x23')](function(_0x2949d2){if(_0x2949d2){_0x52bcb7[_0x25b0('0x32')]=_[_0x25b0('0x2e')](db[_0x25b0('0x61')]['rawAttributes']);_0x52bcb7[_0x25b0('0x2f')]=_['keys'](_0x130ef5[_0x25b0('0x2f')]);_0x52bcb7[_0x25b0('0x30')]=_[_0x25b0('0x31')](_0x52bcb7[_0x25b0('0x32')],_0x52bcb7[_0x25b0('0x2f')]);_0xc6c16b['attributes']=_[_0x25b0('0x31')](_0x52bcb7[_0x25b0('0x32')],qs[_0x25b0('0x34')](_0x130ef5[_0x25b0('0x2f')][_0x25b0('0x34')]));_0xc6c16b['attributes']=_0xc6c16b['attributes'][_0x25b0('0x35')]?_0xc6c16b[_0x25b0('0x33')]:_0x52bcb7[_0x25b0('0x32')];if(!_0x130ef5[_0x25b0('0x2f')]['hasOwnProperty'](_0x25b0('0x37'))){_0xc6c16b['limit']=qs[_0x25b0('0x38')](_0x130ef5[_0x25b0('0x2f')][_0x25b0('0x38')]);_0xc6c16b[_0x25b0('0x1d')]=qs[_0x25b0('0x1d')](_0x130ef5[_0x25b0('0x2f')][_0x25b0('0x1d')]);}_0xc6c16b[_0x25b0('0x39')]=qs[_0x25b0('0x3a')](_0x130ef5['query'][_0x25b0('0x3a')]);_0xc6c16b['where']=qs[_0x25b0('0x30')](_[_0x25b0('0x5a')](_0x130ef5[_0x25b0('0x2f')],_0x52bcb7[_0x25b0('0x30')]));_0xc6c16b[_0x25b0('0x3b')]['CampaignId']=_0x2949d2['id'];if(_0x130ef5[_0x25b0('0x2f')][_0x25b0('0x3e')]){_0xc6c16b[_0x25b0('0x3b')]=_[_0x25b0('0x3c')](_0xc6c16b['where'],{'$or':_['map'](_0xc6c16b[_0x25b0('0x33')],function(_0x45b728){var _0x2b3c95={};_0x2b3c95[_0x45b728]={'$like':'%'+_0x130ef5[_0x25b0('0x2f')]['filter']+'%'};return _0x2b3c95;})});}_0xc6c16b=_['merge']({},_0xc6c16b,_0x130ef5[_0x25b0('0x3f')]);return db['CmHopperBlack'][_0x25b0('0x1c')]({'where':_0xc6c16b[_0x25b0('0x3b')]})[_0x25b0('0x23')](function(_0x107814){_0xd3cba0[_0x25b0('0x1c')]=_0x107814;if(_0x130ef5['query'][_0x25b0('0x45')]){_0xc6c16b[_0x25b0('0x40')]=[{'all':!![]}];}return db[_0x25b0('0x61')]['findAll'](_0xc6c16b);})[_0x25b0('0x23')](function(_0x31908d){_0xd3cba0[_0x25b0('0x5b')]=_0x31908d;return _0xd3cba0;});}})['then'](respondWithFilteredResult(_0x595e96,_0xc6c16b))[_0x25b0('0x42')](handleError(_0x595e96,null));};exports['getLists']=function(_0x508ef3,_0x401907,_0xcb86ba){var _0x584acd={};var _0x17cd9e={};var _0x4e663b;var _0x35d3f5;return db['Campaign']['findOne']({'where':{'id':_0x508ef3[_0x25b0('0x44')]['id']}})[_0x25b0('0x23')](handleEntityNotFound(_0x401907,null))[_0x25b0('0x23')](function(_0x4539bf){if(_0x4539bf){_0x4e663b=_0x4539bf;_0x17cd9e['model']=_[_0x25b0('0x2e')](db['CmList'][_0x25b0('0x2b')]);_0x17cd9e[_0x25b0('0x2f')]=_[_0x25b0('0x2e')](_0x508ef3[_0x25b0('0x2f')]);_0x17cd9e[_0x25b0('0x30')]=_[_0x25b0('0x31')](_0x17cd9e[_0x25b0('0x32')],_0x17cd9e[_0x25b0('0x2f')]);_0x584acd[_0x25b0('0x33')]=_['intersection'](_0x17cd9e[_0x25b0('0x32')],qs[_0x25b0('0x34')](_0x508ef3[_0x25b0('0x2f')][_0x25b0('0x34')]));_0x584acd[_0x25b0('0x33')]=_0x584acd[_0x25b0('0x33')][_0x25b0('0x35')]?_0x584acd[_0x25b0('0x33')]:_0x17cd9e[_0x25b0('0x32')];_0x584acd['order']=qs['sort'](_0x508ef3[_0x25b0('0x2f')][_0x25b0('0x3a')]);_0x584acd[_0x25b0('0x3b')]=qs[_0x25b0('0x30')](_[_0x25b0('0x5a')](_0x508ef3[_0x25b0('0x2f')],_0x17cd9e[_0x25b0('0x30')]));if(_0x508ef3[_0x25b0('0x2f')][_0x25b0('0x3e')]){_0x584acd[_0x25b0('0x3b')]=_[_0x25b0('0x3c')](_0x584acd['where'],{'$or':_[_0x25b0('0x29')](_0x584acd[_0x25b0('0x33')],function(_0x38534c){var _0x4db8a4={};_0x4db8a4[_0x38534c]={'$like':'%'+_0x508ef3[_0x25b0('0x2f')][_0x25b0('0x3e')]+'%'};return _0x4db8a4;})});}_0x584acd=_[_0x25b0('0x3c')]({},_0x584acd,_0x508ef3['options']);return _0x4e663b[_0x25b0('0x62')](_0x584acd);}})[_0x25b0('0x23')](function(_0x59a505){if(_0x59a505){_0x35d3f5=_0x59a505[_0x25b0('0x35')];if(!_0x508ef3[_0x25b0('0x2f')]['hasOwnProperty'](_0x25b0('0x37'))){_0x584acd[_0x25b0('0x38')]=qs[_0x25b0('0x38')](_0x508ef3[_0x25b0('0x2f')]['limit']);_0x584acd[_0x25b0('0x1d')]=qs[_0x25b0('0x1d')](_0x508ef3[_0x25b0('0x2f')][_0x25b0('0x1d')]);}return _0x4e663b[_0x25b0('0x62')](_0x584acd);}})[_0x25b0('0x23')](function(_0x391778){if(_0x391778){return _0x391778?{'count':_0x35d3f5,'rows':_0x391778}:null;}})[_0x25b0('0x23')](respondWithResult(_0x401907,null))[_0x25b0('0x42')](handleError(_0x401907,null));};exports[_0x25b0('0x63')]=function(_0x570ceb,_0x547f76,_0x3a2bed){var _0x5e1ac6,_0x357887;return db[_0x25b0('0x2a')][_0x25b0('0x46')]({'where':{'id':_0x570ceb[_0x25b0('0x44')]['id']}})['then'](handleEntityNotFound(_0x547f76,null))[_0x25b0('0x23')](function(_0x43a751){if(_0x43a751){_0x357887=_0x43a751;return _0x43a751['addLists'](_0x570ceb[_0x25b0('0x47')][_0x25b0('0x64')],_[_0x25b0('0x4e')](_0x570ceb[_0x25b0('0x47')],[_0x25b0('0x64'),'id'])||{});}return null;})[_0x25b0('0x65')](function(_0x74a656){var _0x37e91b;_0x5e1ac6=_0x74a656||[];var _0x230ec6=[];if(_0x74a656){for(var _0x586995=0x0;_0x586995<_0x74a656[_0x25b0('0x35')];_0x586995+=0x1){var _0xce464=_0x74a656[_0x586995]['get']({'plain':!![]});_0x357887[_0x25b0('0x66')]=_0x570ceb[_0x25b0('0x47')][_0x25b0('0x66')]?_0x570ceb[_0x25b0('0x47')][_0x25b0('0x66')]:_0x357887[_0x25b0('0x66')];switch(_0x357887[_0x25b0('0x66')]){case _0x25b0('0x67'):_0x37e91b=squel['insert']()[_0x25b0('0x68')](_0x25b0('0x69'))[_0x25b0('0x6a')]([_0x25b0('0x6b'),'scheduledAt',_0x25b0('0x6c'),_0x25b0('0x6d'),_0x25b0('0x5d'),_0x25b0('0x4f'),_0x25b0('0x50')],squel[_0x25b0('0x6e')]()[_0x25b0('0x6f')](_0x25b0('0x6b'),'phone')[_0x25b0('0x6f')]('NOW()',_0x25b0('0x70'))[_0x25b0('0x6f')]('id','ContactId')['field'](_0xce464[_0x25b0('0x71')]['toString'](),_0x25b0('0x6d'))[_0x25b0('0x6f')](_0x570ceb[_0x25b0('0x44')]['id'][_0x25b0('0x72')](),'CampaignId')[_0x25b0('0x6f')](_0x25b0('0x73'),_0x25b0('0x4f'))[_0x25b0('0x6f')](_0x25b0('0x73'),'updatedAt')[_0x25b0('0x74')](_0x25b0('0x75'))[_0x25b0('0x3b')](_0x25b0('0x76'))[_0x25b0('0x3b')](_0x25b0('0x77'),_0xce464['CmListId']['toString']())[_0x25b0('0x3b')](_0x25b0('0x78'))[_0x25b0('0x3b')]('phone\x20NOT\x20IN\x20(?)',squel[_0x25b0('0x6e')]()[_0x25b0('0x6f')](_0x25b0('0x79'))[_0x25b0('0x74')](_0x25b0('0x7a'))['where'](_0x25b0('0x7b'),_0x570ceb[_0x25b0('0x44')]['id'][_0x25b0('0x72')]()))['where'](_0x25b0('0x7c'),squel[_0x25b0('0x6e')]()[_0x25b0('0x6f')]('COALESCE(phone,\x27\x27)')[_0x25b0('0x74')]('cm_hopper')[_0x25b0('0x3b')]('CampaignId\x20=\x20?',_0x570ceb[_0x25b0('0x44')]['id'][_0x25b0('0x72')]())))[_0x25b0('0x72')]();break;case _0x25b0('0x7d'):_0x37e91b=squel['insert']()['into'](_0x25b0('0x69'))[_0x25b0('0x6a')]([_0x25b0('0x6b'),'scheduledAt','ContactId',_0x25b0('0x6d'),'CampaignId',_0x25b0('0x4f'),'updatedAt'],squel[_0x25b0('0x6e')]()[_0x25b0('0x6f')]('phone',_0x25b0('0x6b'))[_0x25b0('0x6f')](_0x25b0('0x73'),'scheduledAt')['field']('id',_0x25b0('0x6c'))['field'](_0xce464['CmListId']['toString'](),_0x25b0('0x6d'))[_0x25b0('0x6f')](_0x570ceb[_0x25b0('0x44')]['id'][_0x25b0('0x72')](),_0x25b0('0x5d'))[_0x25b0('0x6f')]('NOW()','createdAt')[_0x25b0('0x6f')]('NOW()',_0x25b0('0x50'))[_0x25b0('0x74')](_0x25b0('0x75'))[_0x25b0('0x3b')](_0x25b0('0x76'))['where']('ListId\x20=\x20?',_0xce464[_0x25b0('0x71')][_0x25b0('0x72')]())[_0x25b0('0x3b')](_0x25b0('0x78'))[_0x25b0('0x3b')](_0x25b0('0x7c'),squel[_0x25b0('0x6e')]()[_0x25b0('0x6f')](_0x25b0('0x7e'))['from'](_0x25b0('0x69'))['where'](_0x25b0('0x7b'),_0x570ceb[_0x25b0('0x44')]['id'][_0x25b0('0x72')]())))['toString']();break;default:_0x37e91b=squel['insert']()[_0x25b0('0x68')](_0x25b0('0x69'))['fromQuery'](['phone',_0x25b0('0x70'),'ContactId',_0x25b0('0x6d'),'CampaignId','createdAt',_0x25b0('0x50')],squel['select']()['field'](_0x25b0('0x6b'),_0x25b0('0x6b'))[_0x25b0('0x6f')](_0x25b0('0x73'),_0x25b0('0x70'))[_0x25b0('0x6f')]('id','ContactId')['field'](_0xce464[_0x25b0('0x71')][_0x25b0('0x72')](),_0x25b0('0x6d'))[_0x25b0('0x6f')](_0x570ceb[_0x25b0('0x44')]['id']['toString'](),'CampaignId')[_0x25b0('0x6f')](_0x25b0('0x73'),_0x25b0('0x4f'))[_0x25b0('0x6f')](_0x25b0('0x73'),_0x25b0('0x50'))['from'](_0x25b0('0x75'))['where'](_0x25b0('0x76'))[_0x25b0('0x3b')](_0x25b0('0x77'),_0xce464['CmListId']['toString']())['where'](_0x25b0('0x78')))[_0x25b0('0x72')]();}_0x230ec6['push'](db[_0x25b0('0x7f')]['query'](_0x37e91b));}return BPromise[_0x25b0('0x80')](_0x230ec6);}})[_0x25b0('0x23')](function(){return _0x5e1ac6;})[_0x25b0('0x23')](respondWithResult(_0x547f76,null))[_0x25b0('0x42')](handleError(_0x547f76,null));};exports[_0x25b0('0x81')]=function(_0x3ec4d3,_0xddc1dd,_0x4cc93e){return db[_0x25b0('0x2a')][_0x25b0('0x46')]({'where':{'id':_0x3ec4d3['params']['id']}})[_0x25b0('0x23')](handleEntityNotFound(_0xddc1dd,null))['then'](function(_0x175554){if(_0x175554){return _0x175554[_0x25b0('0x81')](_0x3ec4d3[_0x25b0('0x2f')][_0x25b0('0x64')]);}})['then'](function(_0x59f251){if(_0x59f251){return db[_0x25b0('0x59')][_0x25b0('0x56')]({'where':{'ListId':_0x3ec4d3['query'][_0x25b0('0x64')],'CampaignId':_0x3ec4d3['params']['id']}})[_0x25b0('0x23')](function(){return _0x59f251;});}})[_0x25b0('0x23')](respondWithStatusCode(_0xddc1dd,null))[_0x25b0('0x42')](handleError(_0xddc1dd,null));};exports[_0x25b0('0x82')]=function(_0x401cbd,_0x593684,_0x4f3a26){var _0x3094eb={'raw':!![],'where':{}};var _0xc35dde={};var _0x539c7d={'count':0x0,'rows':[]};return db[_0x25b0('0x2a')]['findOne']({'where':{'id':_0x401cbd['params']['id']}})[_0x25b0('0x23')](handleEntityNotFound(_0x593684,null))[_0x25b0('0x23')](function(_0x552a7b){if(_0x552a7b){_0xc35dde[_0x25b0('0x32')]=_[_0x25b0('0x2e')](db[_0x25b0('0x83')][_0x25b0('0x2b')]);_0xc35dde['query']=_[_0x25b0('0x2e')](_0x401cbd['query']);_0xc35dde[_0x25b0('0x30')]=_[_0x25b0('0x31')](_0xc35dde[_0x25b0('0x32')],_0xc35dde[_0x25b0('0x2f')]);_0x3094eb[_0x25b0('0x33')]=_[_0x25b0('0x31')](_0xc35dde[_0x25b0('0x32')],qs[_0x25b0('0x34')](_0x401cbd[_0x25b0('0x2f')][_0x25b0('0x34')]));_0x3094eb[_0x25b0('0x33')]=_0x3094eb[_0x25b0('0x33')][_0x25b0('0x35')]?_0x3094eb[_0x25b0('0x33')]:_0xc35dde[_0x25b0('0x32')];if(!_0x401cbd[_0x25b0('0x2f')][_0x25b0('0x36')](_0x25b0('0x37'))){_0x3094eb[_0x25b0('0x38')]=qs['limit'](_0x401cbd[_0x25b0('0x2f')]['limit']);_0x3094eb[_0x25b0('0x1d')]=qs['offset'](_0x401cbd['query'][_0x25b0('0x1d')]);}_0x3094eb[_0x25b0('0x39')]=qs['sort'](_0x401cbd[_0x25b0('0x2f')]['sort']);_0x3094eb[_0x25b0('0x3b')]=qs[_0x25b0('0x30')](_['pick'](_0x401cbd['query'],_0xc35dde[_0x25b0('0x30')]));_0x3094eb['where'][_0x25b0('0x5d')]=_0x552a7b['id'];if(_0x401cbd['query'][_0x25b0('0x3e')]){_0x3094eb[_0x25b0('0x3b')]=_['merge'](_0x3094eb[_0x25b0('0x3b')],{'$or':_[_0x25b0('0x29')](_0x3094eb[_0x25b0('0x33')],function(_0x285e35){var _0x24d95d={};_0x24d95d[_0x285e35]={'$like':'%'+_0x401cbd[_0x25b0('0x2f')][_0x25b0('0x3e')]+'%'};return _0x24d95d;})});}_0x3094eb=_[_0x25b0('0x3c')]({},_0x3094eb,_0x401cbd[_0x25b0('0x3f')]);return db[_0x25b0('0x83')][_0x25b0('0x1c')]({'where':_0x3094eb['where']})[_0x25b0('0x23')](function(_0x4fc1ff){_0x539c7d[_0x25b0('0x1c')]=_0x4fc1ff;if(_0x401cbd['query']['includeAll']){_0x3094eb[_0x25b0('0x40')]=[{'all':!![]}];}return db[_0x25b0('0x83')][_0x25b0('0x41')](_0x3094eb);})[_0x25b0('0x23')](function(_0x9cdb65){_0x539c7d[_0x25b0('0x5b')]=_0x9cdb65;return _0x539c7d;});}})['then'](respondWithFilteredResult(_0x593684,_0x3094eb))[_0x25b0('0x42')](handleError(_0x593684,null));};exports[_0x25b0('0x84')]=function(_0x4977f1,_0x350f71,_0x183063){var _0x2ee488,_0x56b823;return db[_0x25b0('0x2a')][_0x25b0('0x46')]({'where':{'id':_0x4977f1['params']['id']}})[_0x25b0('0x23')](handleEntityNotFound(_0x350f71,null))['then'](function(_0x38a7a6){if(_0x38a7a6){_0x56b823=_0x38a7a6;return _0x38a7a6[_0x25b0('0x84')](_0x4977f1[_0x25b0('0x47')][_0x25b0('0x64')],_[_0x25b0('0x4e')](_0x4977f1[_0x25b0('0x47')],[_0x25b0('0x64'),'id'])||{});}return null;})[_0x25b0('0x65')](function(_0x55f507){var _0x38cff8;_0x2ee488=_0x55f507||[];var _0x59f3ba=[];if(_0x55f507){for(var _0x4281a5=0x0;_0x4281a5<_0x55f507[_0x25b0('0x35')];_0x4281a5+=0x1){var _0x589e59=_0x55f507[_0x4281a5]['get']({'plain':!![]});_0x38cff8=squel[_0x25b0('0x85')]()[_0x25b0('0x68')](_0x25b0('0x86'))[_0x25b0('0x6a')]([_0x25b0('0x6b'),'ContactId',_0x25b0('0x6d'),_0x25b0('0x5d'),'createdAt',_0x25b0('0x50')],squel['select']()[_0x25b0('0x6f')](_0x25b0('0x6b'),_0x25b0('0x6b'))[_0x25b0('0x6f')]('id',_0x25b0('0x6c'))[_0x25b0('0x6f')](_0x589e59[_0x25b0('0x71')][_0x25b0('0x72')](),_0x25b0('0x6d'))[_0x25b0('0x6f')](_0x4977f1[_0x25b0('0x44')]['id'][_0x25b0('0x72')](),_0x25b0('0x5d'))['field'](_0x25b0('0x73'),'createdAt')[_0x25b0('0x6f')](_0x25b0('0x73'),_0x25b0('0x50'))[_0x25b0('0x74')]('cm_contacts')[_0x25b0('0x3b')](_0x25b0('0x76'))[_0x25b0('0x3b')](_0x25b0('0x77'),_0x589e59[_0x25b0('0x71')]['toString']())[_0x25b0('0x3b')](_0x25b0('0x78')))[_0x25b0('0x72')]();_0x59f3ba['push'](db[_0x25b0('0x7f')][_0x25b0('0x2f')](_0x38cff8));}return BPromise[_0x25b0('0x80')](_0x59f3ba);}})['then'](function(){return _0x2ee488;})[_0x25b0('0x23')](respondWithResult(_0x350f71,null))['catch'](handleError(_0x350f71,null));};exports[_0x25b0('0x87')]=function(_0x1ba258,_0x45f989,_0x1a78e7){return db[_0x25b0('0x2a')][_0x25b0('0x46')]({'where':{'id':_0x1ba258[_0x25b0('0x44')]['id']}})['then'](handleEntityNotFound(_0x45f989,null))[_0x25b0('0x23')](function(_0x1da85c){if(_0x1da85c){return _0x1da85c[_0x25b0('0x87')](_0x1ba258[_0x25b0('0x2f')]['ids']);}})[_0x25b0('0x23')](function(_0x1bb37b){if(_0x1bb37b){return db[_0x25b0('0x61')]['destroy']({'where':{'ListId':_0x1ba258[_0x25b0('0x2f')][_0x25b0('0x64')],'CampaignId':_0x1ba258[_0x25b0('0x44')]['id']}})['then'](function(){return _0x1bb37b;});}})[_0x25b0('0x23')](respondWithStatusCode(_0x45f989,null))['catch'](handleError(_0x45f989,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index ef93470..f63962f 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 _0x8dd7=['define','Campaign','campaigns','lodash','util','api','path','rimraf','../../config/environment','./campaign.attributes','exports'];(function(_0x506090,_0x44d91c){var _0x152fc3=function(_0x660ab1){while(--_0x660ab1){_0x506090['push'](_0x506090['shift']());}};_0x152fc3(++_0x44d91c);}(_0x8dd7,0xc9));var _0x78dd=function(_0x8712b7,_0x35660a){_0x8712b7=_0x8712b7-0x0;var _0x45d4ee=_0x8dd7[_0x8712b7];return _0x45d4ee;};'use strict';var _=require(_0x78dd('0x0'));var util=require(_0x78dd('0x1'));var logger=require('../../config/logger')(_0x78dd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x78dd('0x3'));var rimraf=require(_0x78dd('0x4'));var config=require(_0x78dd('0x5'));var attributes=require(_0x78dd('0x6'));module[_0x78dd('0x7')]=function(_0x398660,_0x122996){return _0x398660[_0x78dd('0x8')](_0x78dd('0x9'),attributes,{'tableName':_0x78dd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8bcb=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Campaign','campaigns','lodash','../../config/logger','api'];(function(_0x3ed0d5,_0x5f0e1f){var _0x5e4563=function(_0x1517ea){while(--_0x1517ea){_0x3ed0d5['push'](_0x3ed0d5['shift']());}};_0x5e4563(++_0x5f0e1f);}(_0x8bcb,0x1c4));var _0xb8bc=function(_0x3a53f2,_0x2e5f6f){_0x3a53f2=_0x3a53f2-0x0;var _0x1033bf=_0x8bcb[_0x3a53f2];return _0x1033bf;};'use strict';var _=require(_0xb8bc('0x0'));var util=require('util');var logger=require(_0xb8bc('0x1'))(_0xb8bc('0x2'));var moment=require(_0xb8bc('0x3'));var BPromise=require(_0xb8bc('0x4'));var rp=require(_0xb8bc('0x5'));var fs=require('fs');var path=require(_0xb8bc('0x6'));var rimraf=require(_0xb8bc('0x7'));var config=require(_0xb8bc('0x8'));var attributes=require('./campaign.attributes');module[_0xb8bc('0x9')]=function(_0x2541ea,_0x4e1e80){return _0x2541ea[_0xb8bc('0xa')](_0xb8bc('0xb'),attributes,{'tableName':_0xb8bc('0xc'),'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 d4a9682..a74c63a 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(_0x1f6012,_0xaa905b){var _0x2eec52=function(_0x443065){while(--_0x443065){_0x1f6012['push'](_0x1f6012['shift']());}};_0x2eec52(++_0xaa905b);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file +var _0x9957=['catch','GetCampaign','findAll','raw','options','where','attributes','limit','map','include','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x76fd56,_0x18ffbc){var _0x3aa596=function(_0x9c1529){while(--_0x9c1529){_0x76fd56['push'](_0x76fd56['shift']());}};_0x3aa596(++_0x18ffbc);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index b02bfa1..dda7f3f 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 _0xc9b3=['post','create','/:id/clone','clone','update','delete','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists'];(function(_0x541a45,_0x12c03c){var _0xba45dc=function(_0x337419){while(--_0x337419){_0x541a45['push'](_0x541a45['shift']());}};_0xba45dc(++_0x12c03c);}(_0xc9b3,0x152));var _0x3c9b=function(_0x5d5c9f,_0x470088){_0x5d5c9f=_0x5d5c9f-0x0;var _0xd8ccdf=_0xc9b3[_0x5d5c9f];return _0xd8ccdf;};'use strict';var multer=require(_0x3c9b('0x0'));var util=require(_0x3c9b('0x1'));var path=require(_0x3c9b('0x2'));var timeout=require(_0x3c9b('0x3'));var express=require(_0x3c9b('0x4'));var router=express[_0x3c9b('0x5')]();var auth=require(_0x3c9b('0x6'));var interaction=require(_0x3c9b('0x7'));var config=require('../../config/environment');var controller=require('./campaign.controller');router[_0x3c9b('0x8')]('/',auth[_0x3c9b('0x9')](),controller['index']);router[_0x3c9b('0x8')](_0x3c9b('0xa'),auth[_0x3c9b('0x9')](),controller[_0x3c9b('0xb')]);router[_0x3c9b('0x8')](_0x3c9b('0xc'),auth[_0x3c9b('0x9')](),controller[_0x3c9b('0xd')]);router[_0x3c9b('0x8')](_0x3c9b('0xe'),auth['isAuthenticated'](),controller[_0x3c9b('0xf')]);router[_0x3c9b('0x8')]('/:id/hopper_finals',auth[_0x3c9b('0x9')](),controller['getHopperFinals']);router[_0x3c9b('0x8')](_0x3c9b('0x10'),auth['isAuthenticated'](),controller[_0x3c9b('0x11')]);router['get'](_0x3c9b('0x12'),auth[_0x3c9b('0x9')](),controller[_0x3c9b('0x13')]);router[_0x3c9b('0x8')](_0x3c9b('0x14'),auth[_0x3c9b('0x9')](),controller[_0x3c9b('0x15')]);router[_0x3c9b('0x16')]('/',auth[_0x3c9b('0x9')](),controller[_0x3c9b('0x17')]);router[_0x3c9b('0x16')](_0x3c9b('0x18'),auth['isAuthenticated'](),controller[_0x3c9b('0x19')]);router['post'](_0x3c9b('0x12'),auth['isAuthenticated'](),controller['addLists']);router[_0x3c9b('0x16')]('/:id/blacklists',auth[_0x3c9b('0x9')](),controller['addBlackLists']);router['put'](_0x3c9b('0xa'),auth[_0x3c9b('0x9')](),controller[_0x3c9b('0x1a')]);router['delete'](_0x3c9b('0xa'),auth[_0x3c9b('0x9')](),controller['destroy']);router['delete'](_0x3c9b('0x12'),auth[_0x3c9b('0x9')](),controller['removeLists']);router[_0x3c9b('0x1b')](_0x3c9b('0x14'),auth[_0x3c9b('0x9')](),controller[_0x3c9b('0x1c')]);module[_0x3c9b('0x1d')]=router; \ No newline at end of file +var _0x986b=['/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','/:id/lists','getLists','getBlackLists','post','/:id/clone','/:id/blacklists','addBlackLists','put','delete','destroy','removeLists','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./campaign.controller','isAuthenticated','index','get','/:id','show','/:id/hoppers','getHoppers'];(function(_0x4aee99,_0x4edf86){var _0x259039=function(_0xfee06b){while(--_0xfee06b){_0x4aee99['push'](_0x4aee99['shift']());}};_0x259039(++_0x4edf86);}(_0x986b,0xd0));var _0xb986=function(_0x59a8fc,_0x237b8c){_0x59a8fc=_0x59a8fc-0x0;var _0x3319c0=_0x986b[_0x59a8fc];return _0x3319c0;};'use strict';var multer=require(_0xb986('0x0'));var util=require(_0xb986('0x1'));var path=require(_0xb986('0x2'));var timeout=require(_0xb986('0x3'));var express=require(_0xb986('0x4'));var router=express[_0xb986('0x5')]();var auth=require(_0xb986('0x6'));var interaction=require(_0xb986('0x7'));var config=require('../../config/environment');var controller=require(_0xb986('0x8'));router['get']('/',auth[_0xb986('0x9')](),controller[_0xb986('0xa')]);router[_0xb986('0xb')](_0xb986('0xc'),auth[_0xb986('0x9')](),controller[_0xb986('0xd')]);router[_0xb986('0xb')](_0xb986('0xe'),auth[_0xb986('0x9')](),controller[_0xb986('0xf')]);router['get'](_0xb986('0x10'),auth[_0xb986('0x9')](),controller[_0xb986('0x11')]);router[_0xb986('0xb')](_0xb986('0x12'),auth[_0xb986('0x9')](),controller['getHopperFinals']);router[_0xb986('0xb')](_0xb986('0x13'),auth[_0xb986('0x9')](),controller['getHopperBlacks']);router[_0xb986('0xb')](_0xb986('0x14'),auth[_0xb986('0x9')](),controller[_0xb986('0x15')]);router[_0xb986('0xb')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0xb986('0x16')]);router['post']('/',auth[_0xb986('0x9')](),controller['create']);router[_0xb986('0x17')](_0xb986('0x18'),auth[_0xb986('0x9')](),controller['clone']);router[_0xb986('0x17')](_0xb986('0x14'),auth[_0xb986('0x9')](),controller['addLists']);router[_0xb986('0x17')](_0xb986('0x19'),auth['isAuthenticated'](),controller[_0xb986('0x1a')]);router[_0xb986('0x1b')](_0xb986('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xb986('0x1c')](_0xb986('0xc'),auth[_0xb986('0x9')](),controller[_0xb986('0x1d')]);router[_0xb986('0x1c')](_0xb986('0x14'),auth['isAuthenticated'](),controller[_0xb986('0x1e')]);router['delete']('/:id/blacklists',auth[_0xb986('0x9')](),controller['removeBlackLists']);module[_0xb986('0x1f')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index f7bd700..7c575c7 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 _0x8787=['STRING','key','sequelize','exports','TEXT'];(function(_0x5db2f6,_0x3f213b){var _0x541835=function(_0x2f8faa){while(--_0x2f8faa){_0x5db2f6['push'](_0x5db2f6['shift']());}};_0x541835(++_0x3f213b);}(_0x8787,0x70));var _0x7878=function(_0x3bdaa3,_0x399889){_0x3bdaa3=_0x3bdaa3-0x0;var _0x5611a4=_0x8787[_0x3bdaa3];return _0x5611a4;};'use strict';var Sequelize=require(_0x7878('0x0'));module[_0x7878('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x7878('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7878('0x3')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x7878('0x4'));}}}; \ No newline at end of file +var _0x1d87=['TEXT','getDataValue','key','sequelize','exports','STRING'];(function(_0x46e077,_0x174e84){var _0x47a34f=function(_0x3085b0){while(--_0x3085b0){_0x46e077['push'](_0x46e077['shift']());}};_0x47a34f(++_0x174e84);}(_0x1d87,0x147));var _0x71d8=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0x1d87[_0x54d4fe];return _0x1ab5bb;};'use strict';var Sequelize=require(_0x71d8('0x0'));module[_0x71d8('0x1')]={'key':{'type':Sequelize[_0x71d8('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x71d8('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x71d8('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x71d8('0x4')](_0x71d8('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 909ff29..5743963 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 _0x9957=['limit','set','Content-Range','reject','save','then','destroy','get','CannedAnswers','UserProfileResource','stack','name','send','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','filter','options','CannedAnswer','count','include','catch','show','params','keys','length','includeAll','find','update','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','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','sendStatus','status','end','json','offset'];(function(_0x32482f,_0x3a031b){var _0x52106c=function(_0x1a6859){while(--_0x1a6859){_0x32482f['push'](_0x32482f['shift']());}};_0x52106c(++_0x3a031b);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];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(){var _0x32a09a=_0x460924[_0x7995('0x26')]({'plain':!![]});var _0x204507=_0x7995('0x27');return db[_0x7995('0x28')][_0x7995('0x25')]({'where':{'type':_0x204507,'resourceId':_0x32a09a['id']}})[_0x7995('0x24')](function(){return _0x460924;});})[_0x7995('0x24')](function(){_0x350fd9['status'](0xcc)[_0x7995('0x1c')]();});}};}function handleEntityNotFound(_0x34e70c,_0x401dc3){return function(_0x268ce7){if(!_0x268ce7){_0x34e70c[_0x7995('0x1a')](0x194);}return _0x268ce7;};}function handleError(_0x2a307e,_0x56691a){_0x56691a=_0x56691a||0x1f4;return function(_0x47625f){logger['error'](_0x47625f[_0x7995('0x29')]);if(_0x47625f[_0x7995('0x2a')]){delete _0x47625f[_0x7995('0x2a')];}_0x2a307e[_0x7995('0x1b')](_0x56691a)[_0x7995('0x2b')](_0x47625f);};}exports['index']=function(_0x9b2a15,_0x514445){var _0x456a28={},_0x3250e0={},_0x4253e5={'count':0x0,'rows':[]};var _0x574574=_['map'](db['CannedAnswer'][_0x7995('0x2c')],function(_0xe6b0b3){return{'name':_0xe6b0b3[_0x7995('0x2d')],'type':_0xe6b0b3[_0x7995('0x2e')][_0x7995('0x2f')]};});_0x3250e0[_0x7995('0x30')]=_['map'](_0x574574,'name');_0x3250e0[_0x7995('0x31')]=_['keys'](_0x9b2a15[_0x7995('0x31')]);_0x3250e0[_0x7995('0x32')]=_[_0x7995('0x33')](_0x3250e0[_0x7995('0x30')],_0x3250e0[_0x7995('0x31')]);_0x456a28['attributes']=_[_0x7995('0x33')](_0x3250e0[_0x7995('0x30')],qs['fields'](_0x9b2a15['query']['fields']));_0x456a28[_0x7995('0x34')]=_0x456a28[_0x7995('0x34')]['length']?_0x456a28[_0x7995('0x34')]:_0x3250e0['model'];if(!_0x9b2a15[_0x7995('0x31')][_0x7995('0x35')](_0x7995('0x36'))){_0x456a28['limit']=qs['limit'](_0x9b2a15[_0x7995('0x31')]['limit']);_0x456a28['offset']=qs[_0x7995('0x1e')](_0x9b2a15[_0x7995('0x31')]['offset']);}_0x456a28[_0x7995('0x37')]=qs[_0x7995('0x38')](_0x9b2a15[_0x7995('0x31')][_0x7995('0x38')]);_0x456a28[_0x7995('0x39')]=qs['filters'](_[_0x7995('0x3a')](_0x9b2a15[_0x7995('0x31')],_0x3250e0[_0x7995('0x32')]));if(_0x9b2a15[_0x7995('0x31')]['filter']){_0x456a28[_0x7995('0x39')]=_[_0x7995('0x3b')](_0x456a28[_0x7995('0x39')],{'$or':_[_0x7995('0x3c')](_0x574574,function(_0x1f5bee){if(_0x1f5bee[_0x7995('0x2e')]!=='VIRTUAL'){var _0x183a68={};_0x183a68[_0x1f5bee[_0x7995('0x2a')]]={'$like':'%'+_0x9b2a15[_0x7995('0x31')][_0x7995('0x3d')]+'%'};return _0x183a68;}})});}_0x456a28=_[_0x7995('0x3b')]({},_0x456a28,_0x9b2a15[_0x7995('0x3e')]);var _0x14d638={'where':_0x456a28[_0x7995('0x39')]};return db[_0x7995('0x3f')][_0x7995('0x40')](_0x14d638)[_0x7995('0x24')](function(_0x270d52){_0x4253e5[_0x7995('0x40')]=_0x270d52;if(_0x9b2a15['query']['includeAll']){_0x456a28[_0x7995('0x41')]=[{'all':!![]}];}return db[_0x7995('0x3f')]['findAll'](_0x456a28);})['then'](function(_0x3f8522){_0x4253e5['rows']=_0x3f8522;return _0x4253e5;})['then'](respondWithFilteredResult(_0x514445,_0x456a28))[_0x7995('0x42')](handleError(_0x514445,null));};exports[_0x7995('0x43')]=function(_0x35c8ff,_0x576b96){var _0x46ac4f={'raw':!![],'where':{'id':_0x35c8ff[_0x7995('0x44')]['id']}},_0x5e85b9={};_0x5e85b9['model']=_['keys'](db[_0x7995('0x3f')][_0x7995('0x2c')]);_0x5e85b9[_0x7995('0x31')]=_[_0x7995('0x45')](_0x35c8ff['query']);_0x5e85b9[_0x7995('0x32')]=_[_0x7995('0x33')](_0x5e85b9[_0x7995('0x30')],_0x5e85b9[_0x7995('0x31')]);_0x46ac4f['attributes']=_['intersection'](_0x5e85b9[_0x7995('0x30')],qs['fields'](_0x35c8ff[_0x7995('0x31')]['fields']));_0x46ac4f[_0x7995('0x34')]=_0x46ac4f['attributes'][_0x7995('0x46')]?_0x46ac4f[_0x7995('0x34')]:_0x5e85b9['model'];if(_0x35c8ff[_0x7995('0x31')][_0x7995('0x47')]){_0x46ac4f[_0x7995('0x41')]=[{'all':!![]}];}_0x46ac4f=_[_0x7995('0x3b')]({},_0x46ac4f,_0x35c8ff['options']);return db[_0x7995('0x3f')][_0x7995('0x48')](_0x46ac4f)[_0x7995('0x24')](handleEntityNotFound(_0x576b96,null))['then'](respondWithResult(_0x576b96,null))[_0x7995('0x42')](handleError(_0x576b96,null));};exports[_0x7995('0x49')]=function(_0x511567,_0x3d8ae3){if(_0x511567[_0x7995('0x4a')]['id']){delete _0x511567['body']['id'];}return db[_0x7995('0x3f')][_0x7995('0x48')]({'where':{'id':_0x511567['params']['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x3d8ae3,null))['then'](saveUpdates(_0x511567[_0x7995('0x4a')],null))[_0x7995('0x24')](respondWithResult(_0x3d8ae3,null))[_0x7995('0x42')](handleError(_0x3d8ae3,null));};exports[_0x7995('0x25')]=function(_0xddf537,_0x14b537){return db[_0x7995('0x3f')]['find']({'where':{'id':_0xddf537[_0x7995('0x44')]['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x14b537,null))[_0x7995('0x24')](removeEntity(_0x14b537,null))['catch'](handleError(_0x14b537,null));};exports[_0x7995('0x4b')]=function(_0x1fe77e,_0x12d4b8){var _0x47d1d8={'key':_0x1fe77e['body']['key']};if(_0x1fe77e[_0x7995('0x4a')][_0x7995('0x4c')]){_0x47d1d8['MailAccountId']=_0x1fe77e[_0x7995('0x4a')][_0x7995('0x4c')];}else if(_0x1fe77e[_0x7995('0x4a')][_0x7995('0x4d')]){_0x47d1d8[_0x7995('0x4d')]=_0x1fe77e['body'][_0x7995('0x4d')];}else if(_0x1fe77e['body'][_0x7995('0x4e')]){_0x47d1d8[_0x7995('0x4e')]=_0x1fe77e[_0x7995('0x4a')]['OpenchannelAccountId'];}else if(_0x1fe77e['body']['ChatWebsiteId']){_0x47d1d8['ChatWebsiteId']=_0x1fe77e[_0x7995('0x4a')][_0x7995('0x4f')];}return db[_0x7995('0x3f')][_0x7995('0x48')]({'where':_0x47d1d8})[_0x7995('0x24')](function(_0x357e60){if(_0x357e60){throw new db[(_0x7995('0x50'))][(_0x7995('0x51'))](_0x7995('0x52'));}return db[_0x7995('0x3f')][_0x7995('0x4b')](_0x1fe77e[_0x7995('0x4a')]);})[_0x7995('0x24')](function(_0x35bea3){var _0x1ea1dc=_0x1fe77e[_0x7995('0x53')][_0x7995('0x26')]({'plain':!![]});if(!_0x1ea1dc)throw new Error(_0x7995('0x54'));if(_0x1ea1dc[_0x7995('0x55')]==='user'){var _0x56a374=_0x35bea3[_0x7995('0x26')]({'plain':!![]});return db[_0x7995('0x56')][_0x7995('0x48')]({'where':{'name':'CannedAnswers','userProfileId':_0x1ea1dc['userProfileId']},'raw':!![]})[_0x7995('0x24')](function(_0x197b52){if(_0x197b52&&_0x197b52[_0x7995('0x57')]===0x0){return db[_0x7995('0x28')]['create']({'name':_0x56a374[_0x7995('0x2a')],'resourceId':_0x56a374['id'],'type':_0x197b52[_0x7995('0x2a')],'sectionId':_0x197b52['id']},{})[_0x7995('0x24')](function(){return _0x35bea3;});}else{return _0x35bea3;}})[_0x7995('0x42')](function(_0x502d43){logger['error'](_0x7995('0x58'),_0x502d43);throw _0x502d43;});}return _0x35bea3;})[_0x7995('0x24')](respondWithResult(_0x12d4b8,0xc9))[_0x7995('0x42')](handleError(_0x12d4b8,null));}; \ No newline at end of file +var _0x34e8=['filters','intersection','attributes','fields','length','order','sort','pick','filter','where','merge','options','include','findAll','catch','show','includeAll','find','body','params','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','The\x20inserted\x20key\x20already\x20exists.','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','CannedAnswers','destroy','sendStatus','error','stack','name','map','CannedAnswer','rawAttributes','fieldName','type','key','model','keys','query'];(function(_0x3c4d94,_0x15153a){var _0x10e0c7=function(_0x10b8d3){while(--_0x10b8d3){_0x3c4d94['push'](_0x3c4d94['shift']());}};_0x10e0c7(++_0x15153a);}(_0x34e8,0x12c));var _0x834e=function(_0x131b28,_0x1df6db){_0x131b28=_0x131b28-0x0;var _0x318ac8=_0x34e8[_0x131b28];return _0x318ac8;};'use strict';var pdf=require(_0x834e('0x0'));var emlformat=require(_0x834e('0x1'));var rimraf=require(_0x834e('0x2'));var zipdir=require(_0x834e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x834e('0x4'));var moment=require(_0x834e('0x5'));var BPromise=require(_0x834e('0x6'));var Mustache=require(_0x834e('0x7'));var util=require(_0x834e('0x8'));var path=require(_0x834e('0x9'));var sox=require(_0x834e('0xa'));var csv=require('to-csv');var ejs=require(_0x834e('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0x10'));var querystring=require(_0x834e('0x11'));var Papa=require(_0x834e('0x12'));var Redis=require(_0x834e('0x13'));var authService=require(_0x834e('0x14'));var qs=require(_0x834e('0x15'));var as=require(_0x834e('0x16'));var hardwareService=require(_0x834e('0x17'));var logger=require(_0x834e('0x18'))(_0x834e('0x19'));var utils=require(_0x834e('0x1a'));var config=require(_0x834e('0x1b'));var db=require(_0x834e('0x1c'))['db'];function respondWithStatusCode(_0x538bb3,_0x5e5b6d){_0x5e5b6d=_0x5e5b6d||0xcc;return function(_0x6cd9b9){if(_0x6cd9b9){return _0x538bb3['sendStatus'](_0x5e5b6d);}return _0x538bb3[_0x834e('0x1d')](_0x5e5b6d)[_0x834e('0x1e')]();};}function respondWithResult(_0x28e659,_0x21cc0a){_0x21cc0a=_0x21cc0a||0xc8;return function(_0x50e860){if(_0x50e860){return _0x28e659[_0x834e('0x1d')](_0x21cc0a)[_0x834e('0x1f')](_0x50e860);}};}function respondWithFilteredResult(_0x57274a,_0x316205){return function(_0x4a9cdc){if(_0x4a9cdc){var _0x38a8cd=_0x4a9cdc[_0x834e('0x20')],_0x36d443=_0x316205[_0x834e('0x21')],_0x478afe=_0x316205['offset']+_0x316205[_0x834e('0x22')],_0x43ac41;if(_0x478afe>=_0x38a8cd){_0x478afe=_0x38a8cd;_0x43ac41=0xc8;}else{_0x43ac41=0xce;}_0x57274a[_0x834e('0x1d')](_0x43ac41);return _0x57274a[_0x834e('0x23')](_0x834e('0x24'),_0x36d443+'-'+_0x478afe+'/'+_0x38a8cd)[_0x834e('0x1f')](_0x4a9cdc);}return null;};}function patchUpdates(_0x254677){return function(_0x1dd214){try{jsonpatch['apply'](_0x1dd214,_0x254677,!![]);}catch(_0x2545b4){return BPromise[_0x834e('0x25')](_0x2545b4);}return _0x1dd214[_0x834e('0x26')]();};}function saveUpdates(_0x325a99,_0x4ab05d){return function(_0x45a630){if(_0x45a630){return _0x45a630[_0x834e('0x27')](_0x325a99)['then'](function(_0x1b4bdf){return _0x1b4bdf;});}return null;};}function removeEntity(_0x28d687,_0x8d406e){return function(_0x5c55ca){if(_0x5c55ca){return _0x5c55ca['destroy']()[_0x834e('0x28')](function(){var _0x34563b=_0x5c55ca['get']({'plain':!![]});var _0x25ee1d=_0x834e('0x29');return db['UserProfileResource'][_0x834e('0x2a')]({'where':{'type':_0x25ee1d,'resourceId':_0x34563b['id']}})[_0x834e('0x28')](function(){return _0x5c55ca;});})[_0x834e('0x28')](function(){_0x28d687['status'](0xcc)[_0x834e('0x1e')]();});}};}function handleEntityNotFound(_0x3e310f,_0x5e1cc5){return function(_0x5bef62){if(!_0x5bef62){_0x3e310f[_0x834e('0x2b')](0x194);}return _0x5bef62;};}function handleError(_0x508a1d,_0x2826ec){_0x2826ec=_0x2826ec||0x1f4;return function(_0x3f1b0b){logger[_0x834e('0x2c')](_0x3f1b0b[_0x834e('0x2d')]);if(_0x3f1b0b[_0x834e('0x2e')]){delete _0x3f1b0b[_0x834e('0x2e')];}_0x508a1d['status'](_0x2826ec)['send'](_0x3f1b0b);};}exports['index']=function(_0x58c1d7,_0x2c7a8d){var _0x567cea={},_0x106d6a={},_0x5dacc1={'count':0x0,'rows':[]};var _0xb5bc06=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x4551f5){return{'name':_0x4551f5[_0x834e('0x32')],'type':_0x4551f5[_0x834e('0x33')][_0x834e('0x34')]};});_0x106d6a[_0x834e('0x35')]=_['map'](_0xb5bc06,_0x834e('0x2e'));_0x106d6a['query']=_[_0x834e('0x36')](_0x58c1d7[_0x834e('0x37')]);_0x106d6a[_0x834e('0x38')]=_[_0x834e('0x39')](_0x106d6a[_0x834e('0x35')],_0x106d6a[_0x834e('0x37')]);_0x567cea[_0x834e('0x3a')]=_[_0x834e('0x39')](_0x106d6a[_0x834e('0x35')],qs[_0x834e('0x3b')](_0x58c1d7['query'][_0x834e('0x3b')]));_0x567cea[_0x834e('0x3a')]=_0x567cea[_0x834e('0x3a')][_0x834e('0x3c')]?_0x567cea['attributes']:_0x106d6a[_0x834e('0x35')];if(!_0x58c1d7[_0x834e('0x37')]['hasOwnProperty']('nolimit')){_0x567cea['limit']=qs[_0x834e('0x22')](_0x58c1d7[_0x834e('0x37')][_0x834e('0x22')]);_0x567cea[_0x834e('0x21')]=qs[_0x834e('0x21')](_0x58c1d7[_0x834e('0x37')]['offset']);}_0x567cea[_0x834e('0x3d')]=qs['sort'](_0x58c1d7[_0x834e('0x37')][_0x834e('0x3e')]);_0x567cea['where']=qs[_0x834e('0x38')](_[_0x834e('0x3f')](_0x58c1d7['query'],_0x106d6a['filters']));if(_0x58c1d7[_0x834e('0x37')][_0x834e('0x40')]){_0x567cea[_0x834e('0x41')]=_[_0x834e('0x42')](_0x567cea[_0x834e('0x41')],{'$or':_['map'](_0xb5bc06,function(_0x1c5ed6){if(_0x1c5ed6['type']!=='VIRTUAL'){var _0x1b2edf={};_0x1b2edf[_0x1c5ed6['name']]={'$like':'%'+_0x58c1d7[_0x834e('0x37')][_0x834e('0x40')]+'%'};return _0x1b2edf;}})});}_0x567cea=_[_0x834e('0x42')]({},_0x567cea,_0x58c1d7[_0x834e('0x43')]);var _0x2b7933={'where':_0x567cea['where']};return db[_0x834e('0x30')][_0x834e('0x20')](_0x2b7933)[_0x834e('0x28')](function(_0x58c5fb){_0x5dacc1[_0x834e('0x20')]=_0x58c5fb;if(_0x58c1d7[_0x834e('0x37')]['includeAll']){_0x567cea[_0x834e('0x44')]=[{'all':!![]}];}return db['CannedAnswer'][_0x834e('0x45')](_0x567cea);})[_0x834e('0x28')](function(_0x4a18bb){_0x5dacc1['rows']=_0x4a18bb;return _0x5dacc1;})[_0x834e('0x28')](respondWithFilteredResult(_0x2c7a8d,_0x567cea))[_0x834e('0x46')](handleError(_0x2c7a8d,null));};exports[_0x834e('0x47')]=function(_0xbc1571,_0x8ad264){var _0x23feea={'raw':!![],'where':{'id':_0xbc1571['params']['id']}},_0x195204={};_0x195204[_0x834e('0x35')]=_['keys'](db[_0x834e('0x30')]['rawAttributes']);_0x195204[_0x834e('0x37')]=_['keys'](_0xbc1571[_0x834e('0x37')]);_0x195204[_0x834e('0x38')]=_['intersection'](_0x195204[_0x834e('0x35')],_0x195204[_0x834e('0x37')]);_0x23feea[_0x834e('0x3a')]=_[_0x834e('0x39')](_0x195204[_0x834e('0x35')],qs[_0x834e('0x3b')](_0xbc1571[_0x834e('0x37')][_0x834e('0x3b')]));_0x23feea[_0x834e('0x3a')]=_0x23feea[_0x834e('0x3a')]['length']?_0x23feea[_0x834e('0x3a')]:_0x195204[_0x834e('0x35')];if(_0xbc1571['query'][_0x834e('0x48')]){_0x23feea[_0x834e('0x44')]=[{'all':!![]}];}_0x23feea=_[_0x834e('0x42')]({},_0x23feea,_0xbc1571[_0x834e('0x43')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x23feea)['then'](handleEntityNotFound(_0x8ad264,null))['then'](respondWithResult(_0x8ad264,null))[_0x834e('0x46')](handleError(_0x8ad264,null));};exports[_0x834e('0x27')]=function(_0x30568e,_0x40ff5a){if(_0x30568e[_0x834e('0x4a')]['id']){delete _0x30568e[_0x834e('0x4a')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x30568e[_0x834e('0x4b')]['id']}})[_0x834e('0x28')](handleEntityNotFound(_0x40ff5a,null))[_0x834e('0x28')](saveUpdates(_0x30568e[_0x834e('0x4a')],null))[_0x834e('0x28')](respondWithResult(_0x40ff5a,null))[_0x834e('0x46')](handleError(_0x40ff5a,null));};exports[_0x834e('0x2a')]=function(_0x1a3855,_0x3df078){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1a3855[_0x834e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3df078,null))[_0x834e('0x28')](removeEntity(_0x3df078,null))[_0x834e('0x46')](handleError(_0x3df078,null));};exports['create']=function(_0x3c00a3,_0x3b0988){var _0x55d491={'key':_0x3c00a3[_0x834e('0x4a')][_0x834e('0x34')]};if(_0x3c00a3[_0x834e('0x4a')][_0x834e('0x4c')]){_0x55d491[_0x834e('0x4c')]=_0x3c00a3[_0x834e('0x4a')][_0x834e('0x4c')];}else if(_0x3c00a3['body'][_0x834e('0x4d')]){_0x55d491[_0x834e('0x4d')]=_0x3c00a3[_0x834e('0x4a')][_0x834e('0x4d')];}else if(_0x3c00a3[_0x834e('0x4a')][_0x834e('0x4e')]){_0x55d491[_0x834e('0x4e')]=_0x3c00a3[_0x834e('0x4a')]['OpenchannelAccountId'];}else if(_0x3c00a3[_0x834e('0x4a')]['ChatWebsiteId']){_0x55d491[_0x834e('0x4f')]=_0x3c00a3['body'][_0x834e('0x4f')];}return db['CannedAnswer']['find']({'where':_0x55d491})[_0x834e('0x28')](function(_0x3e1bee){if(_0x3e1bee){throw new db['Sequelize']['ValidationError'](_0x834e('0x50'));}return db[_0x834e('0x30')][_0x834e('0x51')](_0x3c00a3[_0x834e('0x4a')]);})[_0x834e('0x28')](function(_0x315858){var _0x3d3f2b=_0x3c00a3[_0x834e('0x52')]['get']({'plain':!![]});if(!_0x3d3f2b)throw new Error(_0x834e('0x53'));if(_0x3d3f2b[_0x834e('0x54')]==='user'){var _0x281342=_0x315858['get']({'plain':!![]});return db[_0x834e('0x55')][_0x834e('0x49')]({'where':{'name':'CannedAnswers','userProfileId':_0x3d3f2b[_0x834e('0x56')]},'raw':!![]})[_0x834e('0x28')](function(_0x2de29a){if(_0x2de29a&&_0x2de29a[_0x834e('0x57')]===0x0){return db['UserProfileResource'][_0x834e('0x51')]({'name':_0x281342[_0x834e('0x2e')],'resourceId':_0x281342['id'],'type':_0x2de29a[_0x834e('0x2e')],'sectionId':_0x2de29a['id']},{})['then'](function(){return _0x315858;});}else{return _0x315858;}})[_0x834e('0x46')](function(_0x1fcae9){logger[_0x834e('0x2c')](_0x834e('0x58'),_0x1fcae9);throw _0x1fcae9;});}return _0x315858;})[_0x834e('0x28')](respondWithResult(_0x3b0988,0xc9))[_0x834e('0x46')](handleError(_0x3b0988,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 64e340f..fba02b1 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 _0x69d5=['tools_canned_answers','utf8mb4','lodash','util','api','moment','request-promise','rimraf','../../config/environment','./cannedAnswer.attributes','exports'];(function(_0x26d406,_0x2ff7d0){var _0x5af2f0=function(_0x5ad01d){while(--_0x5ad01d){_0x26d406['push'](_0x26d406['shift']());}};_0x5af2f0(++_0x2ff7d0);}(_0x69d5,0x18e));var _0x569d=function(_0x420234,_0x1a9f85){_0x420234=_0x420234-0x0;var _0x1065db=_0x69d5[_0x420234];return _0x1065db;};'use strict';var _=require(_0x569d('0x0'));var util=require(_0x569d('0x1'));var logger=require('../../config/logger')(_0x569d('0x2'));var moment=require(_0x569d('0x3'));var BPromise=require('bluebird');var rp=require(_0x569d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x569d('0x5'));var config=require(_0x569d('0x6'));var attributes=require(_0x569d('0x7'));module[_0x569d('0x8')]=function(_0x6ce114,_0x3977cf){return _0x6ce114['define']('CannedAnswer',attributes,{'tableName':_0x569d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x569d('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8ce3=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','CannedAnswer','tools_canned_answers','utf8mb4'];(function(_0x2af59c,_0x8ac7d8){var _0x2c9b17=function(_0x30b641){while(--_0x30b641){_0x2af59c['push'](_0x2af59c['shift']());}};_0x2c9b17(++_0x8ac7d8);}(_0x8ce3,0xc3));var _0x38ce=function(_0x108d63,_0x14491b){_0x108d63=_0x108d63-0x0;var _0x51d6df=_0x8ce3[_0x108d63];return _0x51d6df;};'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':!![],'charset':_0x38ce('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 732b0ae..f61a7ea 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 _0x7208=['../../config/environment','client','request','info','CannedAnswer,\x20%s,\x20%s','CannedAnswer,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','moment','bluebird','randomstring','../../config/logger','rpc'];(function(_0x435404,_0x4bb5c1){var _0x471adb=function(_0x7602d1){while(--_0x7602d1){_0x435404['push'](_0x435404['shift']());}};_0x471adb(++_0x4bb5c1);}(_0x7208,0x78));var _0x8720=function(_0x305c9d,_0x2a668f){_0x305c9d=_0x305c9d-0x0;var _0x57e6c8=_0x7208[_0x305c9d];return _0x57e6c8;};'use strict';var _=require('lodash');var util=require(_0x8720('0x0'));var moment=require(_0x8720('0x1'));var BPromise=require(_0x8720('0x2'));var rs=require(_0x8720('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8720('0x4'))(_0x8720('0x5'));var config=require(_0x8720('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8720('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x140150,_0x5ddd36,_0x201d45){return new BPromise(function(_0x437226,_0x27d335){return client[_0x8720('0x8')](_0x140150,_0x201d45)['then'](function(_0x904d5a){logger[_0x8720('0x9')](_0x8720('0xa'),_0x5ddd36,'request\x20sent');logger['debug'](_0x8720('0xb'),_0x5ddd36,_0x8720('0xc'),JSON['stringify'](_0x904d5a));if(_0x904d5a[_0x8720('0xd')]){if(_0x904d5a[_0x8720('0xd')][_0x8720('0xe')]===0x1f4){logger[_0x8720('0xd')](_0x8720('0xa'),_0x5ddd36,_0x904d5a[_0x8720('0xd')][_0x8720('0xf')]);return _0x27d335(_0x904d5a['error'][_0x8720('0xf')]);}logger[_0x8720('0xd')]('CannedAnswer,\x20%s,\x20%s',_0x5ddd36,_0x904d5a[_0x8720('0xd')][_0x8720('0xf')]);return _0x437226(_0x904d5a['error']['message']);}else{logger[_0x8720('0x9')](_0x8720('0xa'),_0x5ddd36,_0x8720('0xc'));_0x437226(_0x904d5a[_0x8720('0x10')]['message']);}})[_0x8720('0x11')](function(_0x5c7692){logger[_0x8720('0xd')](_0x8720('0xa'),_0x5ddd36,_0x5c7692);_0x27d335(_0x5c7692);});});} \ No newline at end of file +var _0xdcc7=['jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','CannedAnswer,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0xef4ef0,_0x3c72f9){var _0x39b60b=function(_0x1d824c){while(--_0x1d824c){_0xef4ef0['push'](_0xef4ef0['shift']());}};_0x39b60b(++_0x3c72f9);}(_0xdcc7,0x1c7));var _0x7dcc=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xdcc7[_0x40220a];return _0x3903cc;};'use strict';var _=require('lodash');var util=require(_0x7dcc('0x0'));var moment=require(_0x7dcc('0x1'));var BPromise=require('bluebird');var rs=require(_0x7dcc('0x2'));var fs=require('fs');var Redis=require(_0x7dcc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7dcc('0x4'));var logger=require(_0x7dcc('0x5'))('rpc');var config=require(_0x7dcc('0x6'));var jayson=require(_0x7dcc('0x7'));var client=jayson[_0x7dcc('0x8')][_0x7dcc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2dd162,_0x9311f7,_0xf50f44){return new BPromise(function(_0x39b76d,_0x152df7){return client[_0x7dcc('0xa')](_0x2dd162,_0xf50f44)[_0x7dcc('0xb')](function(_0x2f35da){logger[_0x7dcc('0xc')]('CannedAnswer,\x20%s,\x20%s',_0x9311f7,_0x7dcc('0xd'));logger[_0x7dcc('0xe')]('CannedAnswer,\x20%s,\x20%s,\x20%s',_0x9311f7,_0x7dcc('0xd'),JSON[_0x7dcc('0xf')](_0x2f35da));if(_0x2f35da[_0x7dcc('0x10')]){if(_0x2f35da['error'][_0x7dcc('0x11')]===0x1f4){logger[_0x7dcc('0x10')](_0x7dcc('0x12'),_0x9311f7,_0x2f35da['error'][_0x7dcc('0x13')]);return _0x152df7(_0x2f35da[_0x7dcc('0x10')]['message']);}logger[_0x7dcc('0x10')](_0x7dcc('0x12'),_0x9311f7,_0x2f35da[_0x7dcc('0x10')][_0x7dcc('0x13')]);return _0x39b76d(_0x2f35da[_0x7dcc('0x10')][_0x7dcc('0x13')]);}else{logger[_0x7dcc('0xc')](_0x7dcc('0x12'),_0x9311f7,_0x7dcc('0xd'));_0x39b76d(_0x2f35da[_0x7dcc('0x14')]['message']);}})[_0x7dcc('0x15')](function(_0x300f54){logger['error']('CannedAnswer,\x20%s,\x20%s',_0x9311f7,_0x300f54);_0x152df7(_0x300f54);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 9dbe02f..308e451 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 _0xcc45=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','isAuthenticated','get','show','create','/:id','update','delete','exports','multer','path','connect-timeout','express'];(function(_0x494ba0,_0x5b4d0b){var _0x98dbf7=function(_0x2e7052){while(--_0x2e7052){_0x494ba0['push'](_0x494ba0['shift']());}};_0x98dbf7(++_0x5b4d0b);}(_0xcc45,0x12c));var _0x5cc4=function(_0x49f5da,_0x2de846){_0x49f5da=_0x49f5da-0x0;var _0x19a93b=_0xcc45[_0x49f5da];return _0x19a93b;};'use strict';var multer=require(_0x5cc4('0x0'));var util=require('util');var path=require(_0x5cc4('0x1'));var timeout=require(_0x5cc4('0x2'));var express=require(_0x5cc4('0x3'));var router=express['Router']();var auth=require(_0x5cc4('0x4'));var interaction=require(_0x5cc4('0x5'));var config=require(_0x5cc4('0x6'));var controller=require(_0x5cc4('0x7'));router['get']('/',auth[_0x5cc4('0x8')](),controller['index']);router[_0x5cc4('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x5cc4('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5cc4('0xb')]);router['put'](_0x5cc4('0xc'),auth['isAuthenticated'](),controller[_0x5cc4('0xd')]);router[_0x5cc4('0xe')](_0x5cc4('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x5cc4('0xf')]=router; \ No newline at end of file +var _0xb1ed=['create','put','delete','destroy','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','/:id','show','post'];(function(_0x458709,_0x1981ea){var _0x48cbd7=function(_0x358194){while(--_0x358194){_0x458709['push'](_0x458709['shift']());}};_0x48cbd7(++_0x1981ea);}(_0xb1ed,0x8b));var _0xdb1e=function(_0x38b2d9,_0x19fd42){_0x38b2d9=_0x38b2d9-0x0;var _0x23a3e1=_0xb1ed[_0x38b2d9];return _0x23a3e1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdb1e('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdb1e('0x1')]();var auth=require(_0xdb1e('0x2'));var interaction=require(_0xdb1e('0x3'));var config=require(_0xdb1e('0x4'));var controller=require(_0xdb1e('0x5'));router[_0xdb1e('0x6')]('/',auth[_0xdb1e('0x7')](),controller['index']);router[_0xdb1e('0x6')](_0xdb1e('0x8'),auth['isAuthenticated'](),controller[_0xdb1e('0x9')]);router[_0xdb1e('0xa')]('/',auth['isAuthenticated'](),controller[_0xdb1e('0xb')]);router[_0xdb1e('0xc')](_0xdb1e('0x8'),auth[_0xdb1e('0x7')](),controller['update']);router[_0xdb1e('0xd')](_0xdb1e('0x8'),auth[_0xdb1e('0x7')](),controller[_0xdb1e('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 6aef111..e8aeac2 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 _0xba29=['INTEGER','sequelize','1970-01-01\x2000:00:01','STRING'];(function(_0x1c1d9d,_0x1c56f7){var _0x371c8e=function(_0xb02399){while(--_0xb02399){_0x1c1d9d['push'](_0x1c1d9d['shift']());}};_0x371c8e(++_0x1c56f7);}(_0xba29,0x15d));var _0x9ba2=function(_0x36d4d3,_0x242d0d){_0x36d4d3=_0x36d4d3-0x0;var _0x150b93=_0xba29[_0x36d4d3];return _0x150b93;};'use strict';var Sequelize=require(_0x9ba2('0x0'));module['exports']={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x9ba2('0x1')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x9ba2('0x2')]},'dst':{'type':Sequelize[_0x9ba2('0x2')]},'dcontext':{'type':Sequelize[_0x9ba2('0x2')]},'channel':{'type':Sequelize[_0x9ba2('0x2')]},'dstchannel':{'type':Sequelize[_0x9ba2('0x2')]},'lastapp':{'type':Sequelize[_0x9ba2('0x2')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x9ba2('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x9ba2('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x9ba2('0x2')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x9ba2('0x2')]},'linkedid':{'type':Sequelize[_0x9ba2('0x2')]},'sequence':{'type':Sequelize[_0x9ba2('0x2')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x9ba2('0x2')]}}; \ No newline at end of file +var _0x85ae=['1970-01-01\x2000:00:01','STRING','INTEGER','sequelize'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x85ae,0x1ab));var _0xe85a=function(_0x4d8b36,_0x247487){_0x4d8b36=_0x4d8b36-0x0;var _0x16b9d0=_0x85ae[_0x4d8b36];return _0x16b9d0;};'use strict';var Sequelize=require(_0xe85a('0x0'));module['exports']={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0xe85a('0x1')},'clid':{'type':Sequelize[_0xe85a('0x2')]},'src':{'type':Sequelize[_0xe85a('0x2')]},'dst':{'type':Sequelize[_0xe85a('0x2')]},'dcontext':{'type':Sequelize[_0xe85a('0x2')]},'channel':{'type':Sequelize[_0xe85a('0x2')]},'dstchannel':{'type':Sequelize[_0xe85a('0x2')]},'lastapp':{'type':Sequelize[_0xe85a('0x2')]},'lastdata':{'type':Sequelize[_0xe85a('0x2')]},'duration':{'type':Sequelize[_0xe85a('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xe85a('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xe85a('0x2')]},'amaflags':{'type':Sequelize[_0xe85a('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xe85a('0x2')]},'uniqueid':{'type':Sequelize[_0xe85a('0x2')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0xe85a('0x2')]},'peeraccount':{'type':Sequelize[_0xe85a('0x2')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0xe85a('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index b9453ae..556ab55 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 _0x2141=['filter','where','VIRTUAL','options','includeAll','include','findAll','catch','show','keys','create','body','find','params','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','status','count','offset','limit','Content-Range','json','apply','save','then','end','stack','send','index','map','Cdr','fieldName','type','model','name','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','pick'];(function(_0x24af46,_0x40d457){var _0x3bb5af=function(_0x3ad6ef){while(--_0x3ad6ef){_0x24af46['push'](_0x24af46['shift']());}};_0x3bb5af(++_0x40d457);}(_0x2141,0x1ba));var _0x1214=function(_0x2f43d9,_0x2710d9){_0x2f43d9=_0x2f43d9-0x0;var _0x583789=_0x2141[_0x2f43d9];return _0x583789;};'use strict';var pdf=require(_0x1214('0x0'));var emlformat=require(_0x1214('0x1'));var rimraf=require(_0x1214('0x2'));var zipdir=require(_0x1214('0x3'));var jsonpatch=require(_0x1214('0x4'));var rp=require(_0x1214('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1214('0x6'));var util=require(_0x1214('0x7'));var path=require(_0x1214('0x8'));var sox=require(_0x1214('0x9'));var csv=require(_0x1214('0xa'));var ejs=require(_0x1214('0xb'));var fs=require('fs');var _=require(_0x1214('0xc'));var squel=require(_0x1214('0xd'));var crypto=require(_0x1214('0xe'));var jsforce=require(_0x1214('0xf'));var deskjs=require(_0x1214('0x10'));var toCsv=require(_0x1214('0xa'));var querystring=require(_0x1214('0x11'));var Papa=require(_0x1214('0x12'));var Redis=require(_0x1214('0x13'));var authService=require(_0x1214('0x14'));var qs=require(_0x1214('0x15'));var as=require(_0x1214('0x16'));var hardwareService=require(_0x1214('0x17'));var logger=require('../../config/logger')(_0x1214('0x18'));var utils=require(_0x1214('0x19'));var config=require(_0x1214('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3283fd,_0x5e8a48){_0x5e8a48=_0x5e8a48||0xcc;return function(_0xc193b5){if(_0xc193b5){return _0x3283fd['sendStatus'](_0x5e8a48);}return _0x3283fd[_0x1214('0x1b')](_0x5e8a48)['end']();};}function respondWithResult(_0x593ab8,_0x4a382a){_0x4a382a=_0x4a382a||0xc8;return function(_0xf35f7a){if(_0xf35f7a){return _0x593ab8[_0x1214('0x1b')](_0x4a382a)['json'](_0xf35f7a);}};}function respondWithFilteredResult(_0x271e41,_0x40b443){return function(_0x4060fe){if(_0x4060fe){var _0x56b2fb=_0x4060fe[_0x1214('0x1c')],_0x4a2811=_0x40b443[_0x1214('0x1d')],_0x302b3f=_0x40b443[_0x1214('0x1d')]+_0x40b443[_0x1214('0x1e')],_0x13e8ad;if(_0x302b3f>=_0x56b2fb){_0x302b3f=_0x56b2fb;_0x13e8ad=0xc8;}else{_0x13e8ad=0xce;}_0x271e41[_0x1214('0x1b')](_0x13e8ad);return _0x271e41['set'](_0x1214('0x1f'),_0x4a2811+'-'+_0x302b3f+'/'+_0x56b2fb)[_0x1214('0x20')](_0x4060fe);}return null;};}function patchUpdates(_0x1dc429){return function(_0x4f729c){try{jsonpatch[_0x1214('0x21')](_0x4f729c,_0x1dc429,!![]);}catch(_0x2d3ec3){return BPromise['reject'](_0x2d3ec3);}return _0x4f729c[_0x1214('0x22')]();};}function saveUpdates(_0x23d4bd,_0x39e52f){return function(_0xda87b3){if(_0xda87b3){return _0xda87b3['update'](_0x23d4bd)[_0x1214('0x23')](function(_0x50b9ce){return _0x50b9ce;});}return null;};}function removeEntity(_0x550a96,_0x35ee48){return function(_0x2ad704){if(_0x2ad704){return _0x2ad704['destroy']()[_0x1214('0x23')](function(){_0x550a96[_0x1214('0x1b')](0xcc)[_0x1214('0x24')]();});}};}function handleEntityNotFound(_0x5e403d,_0x222b15){return function(_0x31626f){if(!_0x31626f){_0x5e403d['sendStatus'](0x194);}return _0x31626f;};}function handleError(_0x5c6223,_0x75df2e){_0x75df2e=_0x75df2e||0x1f4;return function(_0x113b0a){logger['error'](_0x113b0a[_0x1214('0x25')]);if(_0x113b0a['name']){delete _0x113b0a['name'];}_0x5c6223['status'](_0x75df2e)[_0x1214('0x26')](_0x113b0a);};}exports[_0x1214('0x27')]=function(_0x328aa4,_0x57d1fb){var _0x76c1d4={},_0x408322={},_0xe5eb1={'count':0x0,'rows':[]};var _0x23f0bc=_[_0x1214('0x28')](db[_0x1214('0x29')]['rawAttributes'],function(_0x133a44){return{'name':_0x133a44[_0x1214('0x2a')],'type':_0x133a44[_0x1214('0x2b')]['key']};});_0x408322[_0x1214('0x2c')]=_['map'](_0x23f0bc,_0x1214('0x2d'));_0x408322[_0x1214('0x2e')]=_['keys'](_0x328aa4[_0x1214('0x2e')]);_0x408322[_0x1214('0x2f')]=_[_0x1214('0x30')](_0x408322[_0x1214('0x2c')],_0x408322[_0x1214('0x2e')]);_0x76c1d4['attributes']=_[_0x1214('0x30')](_0x408322[_0x1214('0x2c')],qs[_0x1214('0x31')](_0x328aa4['query'][_0x1214('0x31')]));_0x76c1d4['attributes']=_0x76c1d4[_0x1214('0x32')][_0x1214('0x33')]?_0x76c1d4[_0x1214('0x32')]:_0x408322['model'];if(!_0x328aa4[_0x1214('0x2e')][_0x1214('0x34')]('nolimit')){_0x76c1d4[_0x1214('0x1e')]=qs['limit'](_0x328aa4[_0x1214('0x2e')][_0x1214('0x1e')]);_0x76c1d4[_0x1214('0x1d')]=qs[_0x1214('0x1d')](_0x328aa4[_0x1214('0x2e')][_0x1214('0x1d')]);}_0x76c1d4['order']=qs[_0x1214('0x35')](_0x328aa4[_0x1214('0x2e')][_0x1214('0x35')]);_0x76c1d4['where']=qs[_0x1214('0x2f')](_[_0x1214('0x36')](_0x328aa4['query'],_0x408322[_0x1214('0x2f')]));if(_0x328aa4[_0x1214('0x2e')][_0x1214('0x37')]){_0x76c1d4[_0x1214('0x38')]=_['merge'](_0x76c1d4[_0x1214('0x38')],{'$or':_['map'](_0x23f0bc,function(_0xfe7d63){if(_0xfe7d63[_0x1214('0x2b')]!==_0x1214('0x39')){var _0x3b54e4={};_0x3b54e4[_0xfe7d63['name']]={'$like':'%'+_0x328aa4['query']['filter']+'%'};return _0x3b54e4;}})});}_0x76c1d4=_['merge']({},_0x76c1d4,_0x328aa4[_0x1214('0x3a')]);var _0x2daa0a={'where':_0x76c1d4[_0x1214('0x38')]};return db[_0x1214('0x29')][_0x1214('0x1c')](_0x2daa0a)[_0x1214('0x23')](function(_0x3bde44){_0xe5eb1[_0x1214('0x1c')]=_0x3bde44;if(_0x328aa4[_0x1214('0x2e')][_0x1214('0x3b')]){_0x76c1d4[_0x1214('0x3c')]=[{'all':!![]}];}return db[_0x1214('0x29')][_0x1214('0x3d')](_0x76c1d4);})[_0x1214('0x23')](function(_0x3ceb54){_0xe5eb1['rows']=_0x3ceb54;return _0xe5eb1;})['then'](respondWithFilteredResult(_0x57d1fb,_0x76c1d4))[_0x1214('0x3e')](handleError(_0x57d1fb,null));};exports[_0x1214('0x3f')]=function(_0x4b9fd4,_0x15ea6a){var _0x2c9f9b={'raw':!![],'where':{'id':_0x4b9fd4['params']['id']}},_0x51bfe3={};_0x51bfe3[_0x1214('0x2c')]=_[_0x1214('0x40')](db['Cdr']['rawAttributes']);_0x51bfe3[_0x1214('0x2e')]=_[_0x1214('0x40')](_0x4b9fd4[_0x1214('0x2e')]);_0x51bfe3[_0x1214('0x2f')]=_[_0x1214('0x30')](_0x51bfe3[_0x1214('0x2c')],_0x51bfe3[_0x1214('0x2e')]);_0x2c9f9b[_0x1214('0x32')]=_[_0x1214('0x30')](_0x51bfe3['model'],qs[_0x1214('0x31')](_0x4b9fd4[_0x1214('0x2e')]['fields']));_0x2c9f9b['attributes']=_0x2c9f9b[_0x1214('0x32')][_0x1214('0x33')]?_0x2c9f9b['attributes']:_0x51bfe3[_0x1214('0x2c')];if(_0x4b9fd4[_0x1214('0x2e')][_0x1214('0x3b')]){_0x2c9f9b[_0x1214('0x3c')]=[{'all':!![]}];}_0x2c9f9b=_['merge']({},_0x2c9f9b,_0x4b9fd4[_0x1214('0x3a')]);return db[_0x1214('0x29')]['find'](_0x2c9f9b)[_0x1214('0x23')](handleEntityNotFound(_0x15ea6a,null))[_0x1214('0x23')](respondWithResult(_0x15ea6a,null))[_0x1214('0x3e')](handleError(_0x15ea6a,null));};exports[_0x1214('0x41')]=function(_0x309c74,_0x3f169f){return db['Cdr'][_0x1214('0x41')](_0x309c74['body'],{})['then'](respondWithResult(_0x3f169f,0xc9))[_0x1214('0x3e')](handleError(_0x3f169f,null));};exports['update']=function(_0x338284,_0x147a80){if(_0x338284[_0x1214('0x42')]['id']){delete _0x338284[_0x1214('0x42')]['id'];}return db[_0x1214('0x29')][_0x1214('0x43')]({'where':{'id':_0x338284[_0x1214('0x44')]['id']}})[_0x1214('0x23')](handleEntityNotFound(_0x147a80,null))[_0x1214('0x23')](saveUpdates(_0x338284[_0x1214('0x42')],null))[_0x1214('0x23')](respondWithResult(_0x147a80,null))[_0x1214('0x3e')](handleError(_0x147a80,null));};exports[_0x1214('0x45')]=function(_0x3ca3b4,_0x26e7be){return db[_0x1214('0x29')][_0x1214('0x43')]({'where':{'id':_0x3ca3b4[_0x1214('0x44')]['id']}})[_0x1214('0x23')](handleEntityNotFound(_0x26e7be,null))['then'](removeEntity(_0x26e7be,null))[_0x1214('0x3e')](handleError(_0x26e7be,null));};exports[_0x1214('0x46')]=function(_0x3de1d7,_0x3959b7){return db[_0x1214('0x29')]['describe']()[_0x1214('0x23')](respondWithResult(_0x3959b7,null))['catch'](handleError(_0x3959b7,null));}; \ No newline at end of file +var _0x3e9e=['describe','html-pdf','rimraf','bluebird','mustache','util','path','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','Cdr','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','includeAll','include','find','create','body','params'];(function(_0x165a7a,_0x4e11f1){var _0x3d17c2=function(_0x1ea275){while(--_0x1ea275){_0x165a7a['push'](_0x165a7a['shift']());}};_0x3d17c2(++_0x4e11f1);}(_0x3e9e,0x91));var _0xe3e9=function(_0x163168,_0xce23a2){_0x163168=_0x163168-0x0;var _0xa26b25=_0x3e9e[_0x163168];return _0xa26b25;};'use strict';var pdf=require(_0xe3e9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe3e9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe3e9('0x2'));var Mustache=require(_0xe3e9('0x3'));var util=require(_0xe3e9('0x4'));var path=require(_0xe3e9('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe3e9('0x6'));var fs=require('fs');var _=require(_0xe3e9('0x7'));var squel=require(_0xe3e9('0x8'));var crypto=require(_0xe3e9('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xe3e9('0xa'));var toCsv=require('to-csv');var querystring=require(_0xe3e9('0xb'));var Papa=require(_0xe3e9('0xc'));var Redis=require('ioredis');var authService=require(_0xe3e9('0xd'));var qs=require(_0xe3e9('0xe'));var as=require(_0xe3e9('0xf'));var hardwareService=require(_0xe3e9('0x10'));var logger=require(_0xe3e9('0x11'))(_0xe3e9('0x12'));var utils=require(_0xe3e9('0x13'));var config=require('../../config/environment');var db=require(_0xe3e9('0x14'))['db'];function respondWithStatusCode(_0x3ecf5d,_0x2c13b1){_0x2c13b1=_0x2c13b1||0xcc;return function(_0x25d278){if(_0x25d278){return _0x3ecf5d[_0xe3e9('0x15')](_0x2c13b1);}return _0x3ecf5d[_0xe3e9('0x16')](_0x2c13b1)[_0xe3e9('0x17')]();};}function respondWithResult(_0xc5777a,_0x1a6434){_0x1a6434=_0x1a6434||0xc8;return function(_0x118b26){if(_0x118b26){return _0xc5777a[_0xe3e9('0x16')](_0x1a6434)[_0xe3e9('0x18')](_0x118b26);}};}function respondWithFilteredResult(_0x3e0cb6,_0xb4dda){return function(_0x5cc81d){if(_0x5cc81d){var _0x580cf2=_0x5cc81d[_0xe3e9('0x19')],_0x55ebec=_0xb4dda[_0xe3e9('0x1a')],_0xe35294=_0xb4dda['offset']+_0xb4dda[_0xe3e9('0x1b')],_0x44ecb2;if(_0xe35294>=_0x580cf2){_0xe35294=_0x580cf2;_0x44ecb2=0xc8;}else{_0x44ecb2=0xce;}_0x3e0cb6[_0xe3e9('0x16')](_0x44ecb2);return _0x3e0cb6[_0xe3e9('0x1c')](_0xe3e9('0x1d'),_0x55ebec+'-'+_0xe35294+'/'+_0x580cf2)['json'](_0x5cc81d);}return null;};}function patchUpdates(_0x5cefcb){return function(_0x3207ab){try{jsonpatch[_0xe3e9('0x1e')](_0x3207ab,_0x5cefcb,!![]);}catch(_0x5f1caa){return BPromise[_0xe3e9('0x1f')](_0x5f1caa);}return _0x3207ab[_0xe3e9('0x20')]();};}function saveUpdates(_0x929f4d,_0x6e6fb1){return function(_0x5b1fa9){if(_0x5b1fa9){return _0x5b1fa9['update'](_0x929f4d)[_0xe3e9('0x21')](function(_0x572b3e){return _0x572b3e;});}return null;};}function removeEntity(_0x1211e3,_0x9baa24){return function(_0x2a7c0f){if(_0x2a7c0f){return _0x2a7c0f[_0xe3e9('0x22')]()[_0xe3e9('0x21')](function(){_0x1211e3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f321b,_0xaf7ee){return function(_0x436f30){if(!_0x436f30){_0x5f321b[_0xe3e9('0x15')](0x194);}return _0x436f30;};}function handleError(_0x3c8fc1,_0x4aa2f7){_0x4aa2f7=_0x4aa2f7||0x1f4;return function(_0x5305bc){logger[_0xe3e9('0x23')](_0x5305bc[_0xe3e9('0x24')]);if(_0x5305bc[_0xe3e9('0x25')]){delete _0x5305bc[_0xe3e9('0x25')];}_0x3c8fc1[_0xe3e9('0x16')](_0x4aa2f7)[_0xe3e9('0x26')](_0x5305bc);};}exports[_0xe3e9('0x27')]=function(_0x131667,_0x2febad){var _0xe12d68={},_0x6c3690={},_0x28a7ec={'count':0x0,'rows':[]};var _0x342bd5=_['map'](db[_0xe3e9('0x28')][_0xe3e9('0x29')],function(_0x327fee){return{'name':_0x327fee['fieldName'],'type':_0x327fee[_0xe3e9('0x2a')][_0xe3e9('0x2b')]};});_0x6c3690[_0xe3e9('0x2c')]=_['map'](_0x342bd5,_0xe3e9('0x25'));_0x6c3690[_0xe3e9('0x2d')]=_[_0xe3e9('0x2e')](_0x131667[_0xe3e9('0x2d')]);_0x6c3690[_0xe3e9('0x2f')]=_[_0xe3e9('0x30')](_0x6c3690['model'],_0x6c3690['query']);_0xe12d68[_0xe3e9('0x31')]=_['intersection'](_0x6c3690[_0xe3e9('0x2c')],qs[_0xe3e9('0x32')](_0x131667[_0xe3e9('0x2d')]['fields']));_0xe12d68[_0xe3e9('0x31')]=_0xe12d68[_0xe3e9('0x31')][_0xe3e9('0x33')]?_0xe12d68[_0xe3e9('0x31')]:_0x6c3690[_0xe3e9('0x2c')];if(!_0x131667['query'][_0xe3e9('0x34')](_0xe3e9('0x35'))){_0xe12d68[_0xe3e9('0x1b')]=qs[_0xe3e9('0x1b')](_0x131667['query'][_0xe3e9('0x1b')]);_0xe12d68[_0xe3e9('0x1a')]=qs['offset'](_0x131667['query'][_0xe3e9('0x1a')]);}_0xe12d68['order']=qs[_0xe3e9('0x36')](_0x131667[_0xe3e9('0x2d')][_0xe3e9('0x36')]);_0xe12d68[_0xe3e9('0x37')]=qs['filters'](_[_0xe3e9('0x38')](_0x131667[_0xe3e9('0x2d')],_0x6c3690['filters']));if(_0x131667[_0xe3e9('0x2d')][_0xe3e9('0x39')]){_0xe12d68[_0xe3e9('0x37')]=_[_0xe3e9('0x3a')](_0xe12d68['where'],{'$or':_['map'](_0x342bd5,function(_0x46ceca){if(_0x46ceca[_0xe3e9('0x2a')]!==_0xe3e9('0x3b')){var _0x13ae2c={};_0x13ae2c[_0x46ceca['name']]={'$like':'%'+_0x131667['query'][_0xe3e9('0x39')]+'%'};return _0x13ae2c;}})});}_0xe12d68=_[_0xe3e9('0x3a')]({},_0xe12d68,_0x131667[_0xe3e9('0x3c')]);var _0xb9062c={'where':_0xe12d68['where']};return db[_0xe3e9('0x28')][_0xe3e9('0x19')](_0xb9062c)[_0xe3e9('0x21')](function(_0x26d8a7){_0x28a7ec[_0xe3e9('0x19')]=_0x26d8a7;if(_0x131667[_0xe3e9('0x2d')]['includeAll']){_0xe12d68['include']=[{'all':!![]}];}return db[_0xe3e9('0x28')][_0xe3e9('0x3d')](_0xe12d68);})[_0xe3e9('0x21')](function(_0x101120){_0x28a7ec[_0xe3e9('0x3e')]=_0x101120;return _0x28a7ec;})[_0xe3e9('0x21')](respondWithFilteredResult(_0x2febad,_0xe12d68))[_0xe3e9('0x3f')](handleError(_0x2febad,null));};exports[_0xe3e9('0x40')]=function(_0x4da888,_0x7f0410){var _0x4a7021={'raw':!![],'where':{'id':_0x4da888['params']['id']}},_0x3534dc={};_0x3534dc[_0xe3e9('0x2c')]=_[_0xe3e9('0x2e')](db[_0xe3e9('0x28')]['rawAttributes']);_0x3534dc['query']=_[_0xe3e9('0x2e')](_0x4da888[_0xe3e9('0x2d')]);_0x3534dc[_0xe3e9('0x2f')]=_[_0xe3e9('0x30')](_0x3534dc[_0xe3e9('0x2c')],_0x3534dc[_0xe3e9('0x2d')]);_0x4a7021[_0xe3e9('0x31')]=_[_0xe3e9('0x30')](_0x3534dc[_0xe3e9('0x2c')],qs[_0xe3e9('0x32')](_0x4da888[_0xe3e9('0x2d')][_0xe3e9('0x32')]));_0x4a7021[_0xe3e9('0x31')]=_0x4a7021['attributes'][_0xe3e9('0x33')]?_0x4a7021['attributes']:_0x3534dc[_0xe3e9('0x2c')];if(_0x4da888[_0xe3e9('0x2d')][_0xe3e9('0x41')]){_0x4a7021[_0xe3e9('0x42')]=[{'all':!![]}];}_0x4a7021=_['merge']({},_0x4a7021,_0x4da888[_0xe3e9('0x3c')]);return db[_0xe3e9('0x28')][_0xe3e9('0x43')](_0x4a7021)['then'](handleEntityNotFound(_0x7f0410,null))[_0xe3e9('0x21')](respondWithResult(_0x7f0410,null))[_0xe3e9('0x3f')](handleError(_0x7f0410,null));};exports['create']=function(_0x4c54d0,_0x5ade1f){return db[_0xe3e9('0x28')][_0xe3e9('0x44')](_0x4c54d0[_0xe3e9('0x45')],{})[_0xe3e9('0x21')](respondWithResult(_0x5ade1f,0xc9))[_0xe3e9('0x3f')](handleError(_0x5ade1f,null));};exports['update']=function(_0x3ac886,_0x1628a3){if(_0x3ac886[_0xe3e9('0x45')]['id']){delete _0x3ac886['body']['id'];}return db[_0xe3e9('0x28')][_0xe3e9('0x43')]({'where':{'id':_0x3ac886[_0xe3e9('0x46')]['id']}})[_0xe3e9('0x21')](handleEntityNotFound(_0x1628a3,null))[_0xe3e9('0x21')](saveUpdates(_0x3ac886['body'],null))['then'](respondWithResult(_0x1628a3,null))[_0xe3e9('0x3f')](handleError(_0x1628a3,null));};exports[_0xe3e9('0x22')]=function(_0x37ceed,_0x33b2c3){return db[_0xe3e9('0x28')][_0xe3e9('0x43')]({'where':{'id':_0x37ceed['params']['id']}})[_0xe3e9('0x21')](handleEntityNotFound(_0x33b2c3,null))['then'](removeEntity(_0x33b2c3,null))[_0xe3e9('0x3f')](handleError(_0x33b2c3,null));};exports[_0xe3e9('0x47')]=function(_0xb651d9,_0x3115c2){return db['Cdr']['describe']()[_0xe3e9('0x21')](respondWithResult(_0x3115c2,null))[_0xe3e9('0x3f')](handleError(_0x3115c2,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index a30a4ff..0ee6878 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 _0x01d9=['Cdr','cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cdr.attributes','exports','define'];(function(_0x880aed,_0x16597b){var _0x40df37=function(_0x303925){while(--_0x303925){_0x880aed['push'](_0x880aed['shift']());}};_0x40df37(++_0x16597b);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var logger=require(_0x901d('0x2'))(_0x901d('0x3'));var moment=require('moment');var BPromise=require(_0x901d('0x4'));var rp=require(_0x901d('0x5'));var fs=require('fs');var path=require(_0x901d('0x6'));var rimraf=require(_0x901d('0x7'));var config=require(_0x901d('0x8'));var attributes=require(_0x901d('0x9'));module[_0x901d('0xa')]=function(_0x4e7842,_0x1e5d7d){return _0x4e7842[_0x901d('0xb')](_0x901d('0xc'),attributes,{'tableName':_0x901d('0xd'),'paranoid':![],'indexes':[{'name':_0x901d('0xe'),'fields':[_0x901d('0xe')]},{'name':_0x901d('0xf'),'fields':[_0x901d('0xf')]},{'name':_0x901d('0x10'),'fields':[_0x901d('0x10')]},{'name':_0x901d('0x11'),'fields':[_0x901d('0x11')]},{'name':_0x901d('0x12'),'fields':['src']},{'name':_0x901d('0x13'),'fields':['uniqueid']}],'timestamps':![]});}; \ No newline at end of file +var _0xf61e=['src','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cdr.attributes','exports','define','cdr','accountcode','disposition','dst'];(function(_0x136619,_0x31c9b2){var _0x38c4a5=function(_0x10b74d){while(--_0x10b74d){_0x136619['push'](_0x136619['shift']());}};_0x38c4a5(++_0x31c9b2);}(_0xf61e,0x191));var _0xef61=function(_0x53cb2a,_0x38da33){_0x53cb2a=_0x53cb2a-0x0;var _0x361471=_0xf61e[_0x53cb2a];return _0x361471;};'use strict';var _=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var logger=require(_0xef61('0x2'))(_0xef61('0x3'));var moment=require(_0xef61('0x4'));var BPromise=require(_0xef61('0x5'));var rp=require(_0xef61('0x6'));var fs=require('fs');var path=require(_0xef61('0x7'));var rimraf=require(_0xef61('0x8'));var config=require(_0xef61('0x9'));var attributes=require(_0xef61('0xa'));module[_0xef61('0xb')]=function(_0x5b00b2,_0x9e17f4){return _0x5b00b2[_0xef61('0xc')]('Cdr',attributes,{'tableName':_0xef61('0xd'),'paranoid':![],'indexes':[{'name':_0xef61('0xe'),'fields':[_0xef61('0xe')]},{'name':'calldate','fields':['calldate']},{'name':_0xef61('0xf'),'fields':[_0xef61('0xf')]},{'name':_0xef61('0x10'),'fields':[_0xef61('0x10')]},{'name':_0xef61('0x11'),'fields':[_0xef61('0x11')]},{'name':_0xef61('0x12'),'fields':[_0xef61('0x12')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 714aaed..e2f82a4 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 _0x326b=['stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','Cdr,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3f72a6,_0x3bbe7e){var _0x3861a7=function(_0x15ceb7){while(--_0x15ceb7){_0x3f72a6['push'](_0x3f72a6['shift']());}};_0x3861a7(++_0x3bbe7e);}(_0x326b,0xed));var _0xb326=function(_0x2bfe52,_0x43946e){_0x2bfe52=_0x2bfe52-0x0;var _0x1cf649=_0x326b[_0x2bfe52];return _0x1cf649;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb326('0x0'));var BPromise=require(_0xb326('0x1'));var rs=require(_0xb326('0x2'));var fs=require('fs');var Redis=require(_0xb326('0x3'));var db=require(_0xb326('0x4'))['db'];var utils=require(_0xb326('0x5'));var logger=require('../../config/logger')(_0xb326('0x6'));var config=require(_0xb326('0x7'));var jayson=require(_0xb326('0x8'));var client=jayson[_0xb326('0x9')][_0xb326('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e2f25,_0x156c99,_0x4dd094){return new BPromise(function(_0x3d1006,_0x298462){return client['request'](_0x2e2f25,_0x4dd094)['then'](function(_0x5ab299){logger[_0xb326('0xb')](_0xb326('0xc'),_0x156c99,_0xb326('0xd'));logger[_0xb326('0xe')]('Cdr,\x20%s,\x20%s,\x20%s',_0x156c99,_0xb326('0xd'),JSON[_0xb326('0xf')](_0x5ab299));if(_0x5ab299[_0xb326('0x10')]){if(_0x5ab299[_0xb326('0x10')][_0xb326('0x11')]===0x1f4){logger['error']('Cdr,\x20%s,\x20%s',_0x156c99,_0x5ab299[_0xb326('0x10')][_0xb326('0x12')]);return _0x298462(_0x5ab299[_0xb326('0x10')]['message']);}logger['error'](_0xb326('0xc'),_0x156c99,_0x5ab299[_0xb326('0x10')][_0xb326('0x12')]);return _0x3d1006(_0x5ab299['error'][_0xb326('0x12')]);}else{logger[_0xb326('0xb')](_0xb326('0xc'),_0x156c99,'request\x20sent');_0x3d1006(_0x5ab299[_0xb326('0x13')]['message']);}})[_0xb326('0x14')](function(_0x26541e){logger[_0xb326('0x10')](_0xb326('0xc'),_0x156c99,_0x26541e);_0x298462(_0x26541e);});});} \ No newline at end of file +var _0x87c5=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Cdr,\x20%s,\x20%s','result','util','moment','bluebird','randomstring'];(function(_0x3f6e6c,_0x3bf609){var _0x2f24cc=function(_0x542f22){while(--_0x542f22){_0x3f6e6c['push'](_0x3f6e6c['shift']());}};_0x2f24cc(++_0x3bf609);}(_0x87c5,0xee));var _0x587c=function(_0x47fd66,_0x11f24c){_0x47fd66=_0x47fd66-0x0;var _0x273556=_0x87c5[_0x47fd66];return _0x273556;};'use strict';var _=require('lodash');var util=require(_0x587c('0x0'));var moment=require(_0x587c('0x1'));var BPromise=require(_0x587c('0x2'));var rs=require(_0x587c('0x3'));var fs=require('fs');var Redis=require(_0x587c('0x4'));var db=require(_0x587c('0x5'))['db'];var utils=require(_0x587c('0x6'));var logger=require('../../config/logger')(_0x587c('0x7'));var config=require(_0x587c('0x8'));var jayson=require(_0x587c('0x9'));var client=jayson[_0x587c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5cef10,_0x57dd90,_0x504699){return new BPromise(function(_0x36940d,_0x305b37){return client[_0x587c('0xb')](_0x5cef10,_0x504699)[_0x587c('0xc')](function(_0x5004be){logger['info']('Cdr,\x20%s,\x20%s',_0x57dd90,_0x587c('0xd'));logger[_0x587c('0xe')](_0x587c('0xf'),_0x57dd90,_0x587c('0xd'),JSON[_0x587c('0x10')](_0x5004be));if(_0x5004be[_0x587c('0x11')]){if(_0x5004be['error'][_0x587c('0x12')]===0x1f4){logger[_0x587c('0x11')]('Cdr,\x20%s,\x20%s',_0x57dd90,_0x5004be['error'][_0x587c('0x13')]);return _0x305b37(_0x5004be[_0x587c('0x11')]['message']);}logger['error'](_0x587c('0x14'),_0x57dd90,_0x5004be['error'][_0x587c('0x13')]);return _0x36940d(_0x5004be[_0x587c('0x11')][_0x587c('0x13')]);}else{logger['info'](_0x587c('0x14'),_0x57dd90,_0x587c('0xd'));_0x36940d(_0x5004be[_0x587c('0x15')][_0x587c('0x13')]);}})['catch'](function(_0x34b9c8){logger[_0x587c('0x11')](_0x587c('0x14'),_0x57dd90,_0x34b9c8);_0x305b37(_0x34b9c8);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index ccbc54c..3a94944 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 _0xc771=['create','update','delete','/:id','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cdr.controller','get','isAuthenticated','index','/describe','describe','show'];(function(_0x3cdc95,_0x50be7e){var _0x26931f=function(_0x2ddd74){while(--_0x2ddd74){_0x3cdc95['push'](_0x3cdc95['shift']());}};_0x26931f(++_0x50be7e);}(_0xc771,0xc3));var _0x1c77=function(_0x359b02,_0x38ecdd){_0x359b02=_0x359b02-0x0;var _0x3d8041=_0xc771[_0x359b02];return _0x3d8041;};'use strict';var multer=require('multer');var util=require(_0x1c77('0x0'));var path=require(_0x1c77('0x1'));var timeout=require(_0x1c77('0x2'));var express=require(_0x1c77('0x3'));var router=express[_0x1c77('0x4')]();var auth=require(_0x1c77('0x5'));var interaction=require(_0x1c77('0x6'));var config=require('../../config/environment');var controller=require(_0x1c77('0x7'));router[_0x1c77('0x8')]('/',auth[_0x1c77('0x9')](),controller[_0x1c77('0xa')]);router[_0x1c77('0x8')](_0x1c77('0xb'),auth[_0x1c77('0x9')](),controller[_0x1c77('0xc')]);router[_0x1c77('0x8')]('/:id',auth[_0x1c77('0x9')](),controller[_0x1c77('0xd')]);router['post']('/',auth[_0x1c77('0x9')](),controller[_0x1c77('0xe')]);router['put']('/:id',auth[_0x1c77('0x9')](),controller[_0x1c77('0xf')]);router[_0x1c77('0x10')](_0x1c77('0x11'),auth[_0x1c77('0x9')](),controller[_0x1c77('0x12')]);module['exports']=router; \ No newline at end of file +var _0x0802=['multer','util','path','connect-timeout','Router','../../components/auth/service','./cdr.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','delete','destroy'];(function(_0x2d66d2,_0xdf2cd0){var _0x24217a=function(_0x2df2d4){while(--_0x2df2d4){_0x2d66d2['push'](_0x2d66d2['shift']());}};_0x24217a(++_0xdf2cd0);}(_0x0802,0x144));var _0x2080=function(_0x28a089,_0xd50422){_0x28a089=_0x28a089-0x0;var _0x322e37=_0x0802[_0x28a089];return _0x322e37;};'use strict';var multer=require(_0x2080('0x0'));var util=require(_0x2080('0x1'));var path=require(_0x2080('0x2'));var timeout=require(_0x2080('0x3'));var express=require('express');var router=express[_0x2080('0x4')]();var auth=require(_0x2080('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2080('0x6'));router[_0x2080('0x7')]('/',auth[_0x2080('0x8')](),controller[_0x2080('0x9')]);router[_0x2080('0x7')](_0x2080('0xa'),auth[_0x2080('0x8')](),controller[_0x2080('0xb')]);router[_0x2080('0x7')](_0x2080('0xc'),auth[_0x2080('0x8')](),controller[_0x2080('0xd')]);router['post']('/',auth[_0x2080('0x8')](),controller[_0x2080('0xe')]);router[_0x2080('0xf')]('/:id',auth[_0x2080('0x8')](),controller['update']);router[_0x2080('0x10')](_0x2080('0xc'),auth[_0x2080('0x8')](),controller[_0x2080('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 4f097ac..5a67a6f 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 _0x73a1=['sequelize','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x2085f3,_0x50105b){var _0x384e3c=function(_0x235fa0){while(--_0x235fa0){_0x2085f3['push'](_0x2085f3['shift']());}};_0x384e3c(++_0x50105b);}(_0x73a1,0x114));var _0x173a=function(_0x594e11,_0x28f652){_0x594e11=_0x594e11-0x0;var _0x5418ad=_0x73a1[_0x594e11];return _0x5418ad;};'use strict';var Sequelize=require(_0x173a('0x0'));module['exports']={'priority':{'type':Sequelize[_0x173a('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x173a('0x2')],'allowNull':![],'defaultValue':_0x173a('0x3')},'appdata':{'type':Sequelize[_0x173a('0x4')]()},'description':{'type':Sequelize[_0x173a('0x2')]},'interval':{'type':Sequelize[_0x173a('0x2')],'defaultValue':_0x173a('0x5')}}; \ No newline at end of file +var _0x99cf=['STRING','*,*,*,*','sequelize','noop'];(function(_0x249c3f,_0x86aebc){var _0x3a9c12=function(_0x55c1fd){while(--_0x55c1fd){_0x249c3f['push'](_0x249c3f['shift']());}};_0x3a9c12(++_0x86aebc);}(_0x99cf,0x66));var _0xf99c=function(_0x55fd56,_0x1ce5d0){_0x55fd56=_0x55fd56-0x0;var _0x1da532=_0x99cf[_0x55fd56];return _0x1da532;};'use strict';var Sequelize=require(_0xf99c('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf99c('0x1')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xf99c('0x2')]},'interval':{'type':Sequelize[_0xf99c('0x2')],'defaultValue':_0xf99c('0x3')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 23a78d3..9bb9d3a 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 _0x85e3=['show','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','model','includeAll','include','merge','options','find','catch','body','params','eml-format','zip-dir','fast-json-patch','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','sendStatus','error','name'];(function(_0x591e3d,_0x5bf531){var _0x5bcf2a=function(_0x438a88){while(--_0x438a88){_0x591e3d['push'](_0x591e3d['shift']());}};_0x5bcf2a(++_0x5bf531);}(_0x85e3,0x194));var _0x385e=function(_0x5e1cea,_0x3eb912){_0x5e1cea=_0x5e1cea-0x0;var _0x3595eb=_0x85e3[_0x5e1cea];return _0x3595eb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x385e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x385e('0x1'));var jsonpatch=require(_0x385e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x385e('0x3'));var util=require('util');var path=require(_0x385e('0x4'));var sox=require(_0x385e('0x5'));var csv=require(_0x385e('0x6'));var ejs=require(_0x385e('0x7'));var fs=require('fs');var _=require(_0x385e('0x8'));var squel=require(_0x385e('0x9'));var crypto=require(_0x385e('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x385e('0xb'));var toCsv=require('to-csv');var querystring=require(_0x385e('0xc'));var Papa=require(_0x385e('0xd'));var Redis=require('ioredis');var authService=require(_0x385e('0xe'));var qs=require(_0x385e('0xf'));var as=require(_0x385e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x385e('0x11'))(_0x385e('0x12'));var utils=require(_0x385e('0x13'));var config=require('../../config/environment');var db=require(_0x385e('0x14'))['db'];function respondWithStatusCode(_0x538df9,_0xd84a72){_0xd84a72=_0xd84a72||0xcc;return function(_0x3a5b1d){if(_0x3a5b1d){return _0x538df9['sendStatus'](_0xd84a72);}return _0x538df9[_0x385e('0x15')](_0xd84a72)[_0x385e('0x16')]();};}function respondWithResult(_0x1f7eca,_0x18126a){_0x18126a=_0x18126a||0xc8;return function(_0x23999e){if(_0x23999e){return _0x1f7eca[_0x385e('0x15')](_0x18126a)[_0x385e('0x17')](_0x23999e);}};}function respondWithFilteredResult(_0x2dd276,_0x4cad1c){return function(_0x465c30){if(_0x465c30){var _0xbd0ff7=_0x465c30[_0x385e('0x18')],_0x3d58f0=_0x4cad1c[_0x385e('0x19')],_0x4e9bf8=_0x4cad1c['offset']+_0x4cad1c[_0x385e('0x1a')],_0x1f2d91;if(_0x4e9bf8>=_0xbd0ff7){_0x4e9bf8=_0xbd0ff7;_0x1f2d91=0xc8;}else{_0x1f2d91=0xce;}_0x2dd276[_0x385e('0x15')](_0x1f2d91);return _0x2dd276[_0x385e('0x1b')](_0x385e('0x1c'),_0x3d58f0+'-'+_0x4e9bf8+'/'+_0xbd0ff7)['json'](_0x465c30);}return null;};}function patchUpdates(_0x53f357){return function(_0x47c2a1){try{jsonpatch['apply'](_0x47c2a1,_0x53f357,!![]);}catch(_0x86f14){return BPromise['reject'](_0x86f14);}return _0x47c2a1[_0x385e('0x1d')]();};}function saveUpdates(_0x42ee73,_0x37c9d2){return function(_0x48bee7){if(_0x48bee7){return _0x48bee7[_0x385e('0x1e')](_0x42ee73)[_0x385e('0x1f')](function(_0x36810a){return _0x36810a;});}return null;};}function removeEntity(_0x518ae4,_0x13d8ae){return function(_0x3373d7){if(_0x3373d7){return _0x3373d7[_0x385e('0x20')]()[_0x385e('0x1f')](function(){_0x518ae4[_0x385e('0x15')](0xcc)[_0x385e('0x16')]();});}};}function handleEntityNotFound(_0x28979f,_0x1ad63f){return function(_0x1dece2){if(!_0x1dece2){_0x28979f[_0x385e('0x21')](0x194);}return _0x1dece2;};}function handleError(_0x2c7074,_0x19a930){_0x19a930=_0x19a930||0x1f4;return function(_0x222731){logger[_0x385e('0x22')](_0x222731['stack']);if(_0x222731[_0x385e('0x23')]){delete _0x222731[_0x385e('0x23')];}_0x2c7074[_0x385e('0x15')](_0x19a930)['send'](_0x222731);};}exports[_0x385e('0x24')]=function(_0x61658e,_0x52457b){var _0x38f5eb={'raw':!![],'where':{'id':_0x61658e['params']['id']}},_0x1f8b42={};_0x1f8b42['model']=_[_0x385e('0x25')](db[_0x385e('0x26')][_0x385e('0x27')]);_0x1f8b42['query']=_['keys'](_0x61658e[_0x385e('0x28')]);_0x1f8b42[_0x385e('0x29')]=_[_0x385e('0x2a')](_0x1f8b42['model'],_0x1f8b42[_0x385e('0x28')]);_0x38f5eb[_0x385e('0x2b')]=_[_0x385e('0x2a')](_0x1f8b42['model'],qs[_0x385e('0x2c')](_0x61658e[_0x385e('0x28')][_0x385e('0x2c')]));_0x38f5eb['attributes']=_0x38f5eb[_0x385e('0x2b')][_0x385e('0x2d')]?_0x38f5eb[_0x385e('0x2b')]:_0x1f8b42[_0x385e('0x2e')];if(_0x61658e[_0x385e('0x28')][_0x385e('0x2f')]){_0x38f5eb[_0x385e('0x30')]=[{'all':!![]}];}_0x38f5eb=_[_0x385e('0x31')]({},_0x38f5eb,_0x61658e[_0x385e('0x32')]);return db[_0x385e('0x26')][_0x385e('0x33')](_0x38f5eb)[_0x385e('0x1f')](handleEntityNotFound(_0x52457b,null))['then'](respondWithResult(_0x52457b,null))[_0x385e('0x34')](handleError(_0x52457b,null));};exports[_0x385e('0x1e')]=function(_0x24a0a9,_0xb27802){if(_0x24a0a9[_0x385e('0x35')]['id']){delete _0x24a0a9['body']['id'];}return db[_0x385e('0x26')]['find']({'where':{'id':_0x24a0a9[_0x385e('0x36')]['id']}})[_0x385e('0x1f')](handleEntityNotFound(_0xb27802,null))[_0x385e('0x1f')](saveUpdates(_0x24a0a9['body'],null))['then'](respondWithResult(_0xb27802,null))[_0x385e('0x34')](handleError(_0xb27802,null));};exports[_0x385e('0x20')]=function(_0x51f4d0,_0x5439ca){return db[_0x385e('0x26')][_0x385e('0x33')]({'where':{'id':_0x51f4d0[_0x385e('0x36')]['id']}})[_0x385e('0x1f')](handleEntityNotFound(_0x5439ca,null))[_0x385e('0x1f')](removeEntity(_0x5439ca,null))[_0x385e('0x34')](handleError(_0x5439ca,null));}; \ No newline at end of file +var _0x5a43=['limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','show','params','model','keys','ChatApplication','query','intersection','attributes','length','includeAll','merge','find','catch','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','sendStatus','status','end','json','count','offset'];(function(_0x5bf420,_0x2d068d){var _0x1c5255=function(_0x4964a2){while(--_0x4964a2){_0x5bf420['push'](_0x5bf420['shift']());}};_0x1c5255(++_0x2d068d);}(_0x5a43,0x193));var _0x35a4=function(_0x5eff97,_0x2a97b7){_0x5eff97=_0x5eff97-0x0;var _0x11a173=_0x5a43[_0x5eff97];return _0x11a173;};'use strict';var pdf=require(_0x35a4('0x0'));var emlformat=require(_0x35a4('0x1'));var rimraf=require(_0x35a4('0x2'));var zipdir=require(_0x35a4('0x3'));var jsonpatch=require(_0x35a4('0x4'));var rp=require('request-promise');var moment=require(_0x35a4('0x5'));var BPromise=require(_0x35a4('0x6'));var Mustache=require('mustache');var util=require(_0x35a4('0x7'));var path=require(_0x35a4('0x8'));var sox=require(_0x35a4('0x9'));var csv=require('to-csv');var ejs=require(_0x35a4('0xa'));var fs=require('fs');var _=require(_0x35a4('0xb'));var squel=require(_0x35a4('0xc'));var crypto=require(_0x35a4('0xd'));var jsforce=require(_0x35a4('0xe'));var deskjs=require(_0x35a4('0xf'));var toCsv=require('to-csv');var querystring=require(_0x35a4('0x10'));var Papa=require('papaparse');var Redis=require(_0x35a4('0x11'));var authService=require(_0x35a4('0x12'));var qs=require(_0x35a4('0x13'));var as=require(_0x35a4('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35a4('0x15'))('api');var utils=require(_0x35a4('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x811d3d,_0x3581a7){_0x3581a7=_0x3581a7||0xcc;return function(_0x1277c2){if(_0x1277c2){return _0x811d3d[_0x35a4('0x17')](_0x3581a7);}return _0x811d3d[_0x35a4('0x18')](_0x3581a7)[_0x35a4('0x19')]();};}function respondWithResult(_0x118f7b,_0x138eb2){_0x138eb2=_0x138eb2||0xc8;return function(_0x2bc013){if(_0x2bc013){return _0x118f7b[_0x35a4('0x18')](_0x138eb2)[_0x35a4('0x1a')](_0x2bc013);}};}function respondWithFilteredResult(_0x3babb9,_0x505bfe){return function(_0xb23ef8){if(_0xb23ef8){var _0x4a22c4=_0xb23ef8[_0x35a4('0x1b')],_0x225b62=_0x505bfe['offset'],_0x253051=_0x505bfe[_0x35a4('0x1c')]+_0x505bfe[_0x35a4('0x1d')],_0x2ef73d;if(_0x253051>=_0x4a22c4){_0x253051=_0x4a22c4;_0x2ef73d=0xc8;}else{_0x2ef73d=0xce;}_0x3babb9[_0x35a4('0x18')](_0x2ef73d);return _0x3babb9[_0x35a4('0x1e')](_0x35a4('0x1f'),_0x225b62+'-'+_0x253051+'/'+_0x4a22c4)[_0x35a4('0x1a')](_0xb23ef8);}return null;};}function patchUpdates(_0x7dcce7){return function(_0x2edb50){try{jsonpatch[_0x35a4('0x20')](_0x2edb50,_0x7dcce7,!![]);}catch(_0x4d8b17){return BPromise[_0x35a4('0x21')](_0x4d8b17);}return _0x2edb50[_0x35a4('0x22')]();};}function saveUpdates(_0x3afb94,_0x40b368){return function(_0x4d5367){if(_0x4d5367){return _0x4d5367[_0x35a4('0x23')](_0x3afb94)[_0x35a4('0x24')](function(_0x3f0b2e){return _0x3f0b2e;});}return null;};}function removeEntity(_0x5a1b64,_0x6d478d){return function(_0x598af8){if(_0x598af8){return _0x598af8[_0x35a4('0x25')]()['then'](function(){_0x5a1b64[_0x35a4('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf5f15e,_0x3201cb){return function(_0x43eb15){if(!_0x43eb15){_0xf5f15e[_0x35a4('0x17')](0x194);}return _0x43eb15;};}function handleError(_0x5c9727,_0xec4374){_0xec4374=_0xec4374||0x1f4;return function(_0x5ab469){logger['error'](_0x5ab469[_0x35a4('0x26')]);if(_0x5ab469['name']){delete _0x5ab469[_0x35a4('0x27')];}_0x5c9727[_0x35a4('0x18')](_0xec4374)['send'](_0x5ab469);};}exports[_0x35a4('0x28')]=function(_0x58c4e8,_0x568556){var _0x13a38d={'raw':!![],'where':{'id':_0x58c4e8[_0x35a4('0x29')]['id']}},_0x34b548={};_0x34b548[_0x35a4('0x2a')]=_[_0x35a4('0x2b')](db[_0x35a4('0x2c')]['rawAttributes']);_0x34b548[_0x35a4('0x2d')]=_['keys'](_0x58c4e8[_0x35a4('0x2d')]);_0x34b548['filters']=_[_0x35a4('0x2e')](_0x34b548[_0x35a4('0x2a')],_0x34b548[_0x35a4('0x2d')]);_0x13a38d[_0x35a4('0x2f')]=_[_0x35a4('0x2e')](_0x34b548[_0x35a4('0x2a')],qs['fields'](_0x58c4e8['query']['fields']));_0x13a38d[_0x35a4('0x2f')]=_0x13a38d['attributes'][_0x35a4('0x30')]?_0x13a38d[_0x35a4('0x2f')]:_0x34b548[_0x35a4('0x2a')];if(_0x58c4e8[_0x35a4('0x2d')][_0x35a4('0x31')]){_0x13a38d['include']=[{'all':!![]}];}_0x13a38d=_[_0x35a4('0x32')]({},_0x13a38d,_0x58c4e8['options']);return db[_0x35a4('0x2c')][_0x35a4('0x33')](_0x13a38d)[_0x35a4('0x24')](handleEntityNotFound(_0x568556,null))[_0x35a4('0x24')](respondWithResult(_0x568556,null))[_0x35a4('0x34')](handleError(_0x568556,null));};exports[_0x35a4('0x23')]=function(_0x12af38,_0x3e47fc){if(_0x12af38['body']['id']){delete _0x12af38[_0x35a4('0x35')]['id'];}return db[_0x35a4('0x2c')][_0x35a4('0x33')]({'where':{'id':_0x12af38[_0x35a4('0x29')]['id']}})[_0x35a4('0x24')](handleEntityNotFound(_0x3e47fc,null))[_0x35a4('0x24')](saveUpdates(_0x12af38[_0x35a4('0x35')],null))[_0x35a4('0x24')](respondWithResult(_0x3e47fc,null))['catch'](handleError(_0x3e47fc,null));};exports['destroy']=function(_0x2ac870,_0x2c1d62){return db['ChatApplication'][_0x35a4('0x33')]({'where':{'id':_0x2ac870[_0x35a4('0x29')]['id']}})[_0x35a4('0x24')](handleEntityNotFound(_0x2c1d62,null))[_0x35a4('0x24')](removeEntity(_0x2c1d62,null))[_0x35a4('0x34')](handleError(_0x2c1d62,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index a4292bd..5548976 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 _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file +var _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 2ba81a5..ed21ab5 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 _0x6db5=['request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ChatApplication,\x20%s,\x20%s'];(function(_0x1b7602,_0x36b39c){var _0x5b8083=function(_0x58b32c){while(--_0x58b32c){_0x1b7602['push'](_0x1b7602['shift']());}};_0x5b8083(++_0x36b39c);}(_0x6db5,0x85));var _0x56db=function(_0xcaad39,_0xb6cfc){_0xcaad39=_0xcaad39-0x0;var _0x4bba05=_0x6db5[_0xcaad39];return _0x4bba05;};'use strict';var _=require(_0x56db('0x0'));var util=require(_0x56db('0x1'));var moment=require(_0x56db('0x2'));var BPromise=require(_0x56db('0x3'));var rs=require(_0x56db('0x4'));var fs=require('fs');var Redis=require(_0x56db('0x5'));var db=require(_0x56db('0x6'))['db'];var utils=require(_0x56db('0x7'));var logger=require(_0x56db('0x8'))(_0x56db('0x9'));var config=require(_0x56db('0xa'));var jayson=require(_0x56db('0xb'));var client=jayson[_0x56db('0xc')][_0x56db('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x18b028,_0x4173f2,_0x2ec4a9){return new BPromise(function(_0x2efc8c,_0x1c60bb){return client[_0x56db('0xe')](_0x18b028,_0x2ec4a9)['then'](function(_0x162278){logger[_0x56db('0xf')](_0x56db('0x10'),_0x4173f2,_0x56db('0x11'));logger[_0x56db('0x12')](_0x56db('0x13'),_0x4173f2,_0x56db('0x11'),JSON[_0x56db('0x14')](_0x162278));if(_0x162278[_0x56db('0x15')]){if(_0x162278[_0x56db('0x15')][_0x56db('0x16')]===0x1f4){logger[_0x56db('0x15')](_0x56db('0x10'),_0x4173f2,_0x162278['error'][_0x56db('0x17')]);return _0x1c60bb(_0x162278[_0x56db('0x15')][_0x56db('0x17')]);}logger[_0x56db('0x15')]('ChatApplication,\x20%s,\x20%s',_0x4173f2,_0x162278['error'][_0x56db('0x17')]);return _0x2efc8c(_0x162278['error'][_0x56db('0x17')]);}else{logger[_0x56db('0xf')](_0x56db('0x10'),_0x4173f2,_0x56db('0x11'));_0x2efc8c(_0x162278['result'][_0x56db('0x17')]);}})[_0x56db('0x18')](function(_0x52f9a5){logger['error']('ChatApplication,\x20%s,\x20%s',_0x4173f2,_0x52f9a5);_0x1c60bb(_0x52f9a5);});});} \ No newline at end of file +var _0xda13=['then','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request'];(function(_0x501d8f,_0x4312e1){var _0x2f76ae=function(_0x5becaf){while(--_0x5becaf){_0x501d8f['push'](_0x501d8f['shift']());}};_0x2f76ae(++_0x4312e1);}(_0xda13,0x199));var _0x3da1=function(_0xfc5a04,_0xb77332){_0xfc5a04=_0xfc5a04-0x0;var _0x24b690=_0xda13[_0xfc5a04];return _0x24b690;};'use strict';var _=require('lodash');var util=require(_0x3da1('0x0'));var moment=require(_0x3da1('0x1'));var BPromise=require(_0x3da1('0x2'));var rs=require(_0x3da1('0x3'));var fs=require('fs');var Redis=require(_0x3da1('0x4'));var db=require(_0x3da1('0x5'))['db'];var utils=require(_0x3da1('0x6'));var logger=require('../../config/logger')(_0x3da1('0x7'));var config=require('../../config/environment');var jayson=require(_0x3da1('0x8'));var client=jayson['client'][_0x3da1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x528e19,_0x1bf1aa,_0xf4b1f8){return new BPromise(function(_0x10fec5,_0x38ae98){return client[_0x3da1('0xa')](_0x528e19,_0xf4b1f8)[_0x3da1('0xb')](function(_0x5c4886){logger['info'](_0x3da1('0xc'),_0x1bf1aa,_0x3da1('0xd'));logger[_0x3da1('0xe')](_0x3da1('0xf'),_0x1bf1aa,_0x3da1('0xd'),JSON[_0x3da1('0x10')](_0x5c4886));if(_0x5c4886[_0x3da1('0x11')]){if(_0x5c4886[_0x3da1('0x11')]['code']===0x1f4){logger['error'](_0x3da1('0xc'),_0x1bf1aa,_0x5c4886[_0x3da1('0x11')][_0x3da1('0x12')]);return _0x38ae98(_0x5c4886[_0x3da1('0x11')]['message']);}logger[_0x3da1('0x11')]('ChatApplication,\x20%s,\x20%s',_0x1bf1aa,_0x5c4886[_0x3da1('0x11')][_0x3da1('0x12')]);return _0x10fec5(_0x5c4886['error']['message']);}else{logger[_0x3da1('0x13')](_0x3da1('0xc'),_0x1bf1aa,_0x3da1('0xd'));_0x10fec5(_0x5c4886[_0x3da1('0x14')]['message']);}})['catch'](function(_0x1415be){logger[_0x3da1('0x11')](_0x3da1('0xc'),_0x1bf1aa,_0x1415be);_0x38ae98(_0x1415be);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 0fa4387..49766da 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 _0xe068=['../../components/interaction/service','./chatApplication.controller','get','/:id','show','put','isAuthenticated','update','delete','destroy','exports','multer','util','path','express'];(function(_0x3f8c22,_0x898ed4){var _0x182113=function(_0x494a13){while(--_0x494a13){_0x3f8c22['push'](_0x3f8c22['shift']());}};_0x182113(++_0x898ed4);}(_0xe068,0xb0));var _0x8e06=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe068[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8e06('0x0'));var util=require(_0x8e06('0x1'));var path=require(_0x8e06('0x2'));var timeout=require('connect-timeout');var express=require(_0x8e06('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x8e06('0x4'));var config=require('../../config/environment');var controller=require(_0x8e06('0x5'));router[_0x8e06('0x6')](_0x8e06('0x7'),auth['isAuthenticated'](),controller[_0x8e06('0x8')]);router[_0x8e06('0x9')]('/:id',auth[_0x8e06('0xa')](),controller[_0x8e06('0xb')]);router[_0x8e06('0xc')]('/:id',auth[_0x8e06('0xa')](),controller[_0x8e06('0xd')]);module[_0x8e06('0xe')]=router; \ No newline at end of file +var _0x71be=['path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','/:id','show','put','isAuthenticated','update','delete','destroy','multer','util'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x71be,0x1b1));var _0xe71b=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0x71be[_0x24259d];return _0x5a701;};'use strict';var multer=require(_0xe71b('0x0'));var util=require(_0xe71b('0x1'));var path=require(_0xe71b('0x2'));var timeout=require(_0xe71b('0x3'));var express=require('express');var router=express[_0xe71b('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xe71b('0x5'));var config=require(_0xe71b('0x6'));var controller=require('./chatApplication.controller');router[_0xe71b('0x7')](_0xe71b('0x8'),auth['isAuthenticated'](),controller[_0xe71b('0x9')]);router[_0xe71b('0xa')](_0xe71b('0x8'),auth[_0xe71b('0xb')](),controller[_0xe71b('0xc')]);router[_0xe71b('0xd')](_0xe71b('0x8'),auth[_0xe71b('0xb')](),controller[_0xe71b('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 f5e791d..fadb09b 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 _0xd281=['BOOLEAN','sequelize','exports','STRING'];(function(_0x453929,_0x3ce496){var _0x1e4425=function(_0xd21a7f){while(--_0xd21a7f){_0x453929['push'](_0x453929['shift']());}};_0x1e4425(++_0x3ce496);}(_0xd281,0x1a1));var _0x1d28=function(_0x4e49cb,_0x5773c3){_0x4e49cb=_0x4e49cb-0x0;var _0x8aeff3=_0xd281[_0x4e49cb];return _0x8aeff3;};'use strict';var Sequelize=require(_0x1d28('0x0'));module[_0x1d28('0x1')]={'name':{'type':Sequelize[_0x1d28('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x1d28('0x2')]},'write':{'type':Sequelize[_0x1d28('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x4ef5=['sequelize','STRING','BOOLEAN'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x4ef5,0x153));var _0x54ef=function(_0x99a019,_0x3bb6fa){_0x99a019=_0x99a019-0x0;var _0x197564=_0x4ef5[_0x99a019];return _0x197564;};'use strict';var Sequelize=require(_0x54ef('0x0'));module['exports']={'name':{'type':Sequelize[_0x54ef('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x54ef('0x1')]},'write':{'type':Sequelize[_0x54ef('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 7f1b2d3..593454a 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 _0x55eb=['fieldName','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','show','options','find','create','body','params','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','getMembers','findOne','User','hasOwnProperty','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','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','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','name','send','index','map','ChatGroup','rawAttributes'];(function(_0x40eb12,_0x9a5be4){var _0x34aaba=function(_0x21b174){while(--_0x21b174){_0x40eb12['push'](_0x40eb12['shift']());}};_0x34aaba(++_0x9a5be4);}(_0x55eb,0x99));var _0xb55e=function(_0x46cfa9,_0x352979){_0x46cfa9=_0x46cfa9-0x0;var _0xc7177f=_0x55eb[_0x46cfa9];return _0xc7177f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb55e('0x0'));var rimraf=require(_0xb55e('0x1'));var zipdir=require(_0xb55e('0x2'));var jsonpatch=require(_0xb55e('0x3'));var rp=require('request-promise');var moment=require(_0xb55e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb55e('0x5'));var util=require(_0xb55e('0x6'));var path=require(_0xb55e('0x7'));var sox=require(_0xb55e('0x8'));var csv=require('to-csv');var ejs=require(_0xb55e('0x9'));var fs=require('fs');var _=require(_0xb55e('0xa'));var squel=require('squel');var crypto=require(_0xb55e('0xb'));var jsforce=require(_0xb55e('0xc'));var deskjs=require(_0xb55e('0xd'));var toCsv=require(_0xb55e('0xe'));var querystring=require('querystring');var Papa=require(_0xb55e('0xf'));var Redis=require(_0xb55e('0x10'));var authService=require(_0xb55e('0x11'));var qs=require(_0xb55e('0x12'));var as=require(_0xb55e('0x13'));var hardwareService=require(_0xb55e('0x14'));var logger=require(_0xb55e('0x15'))(_0xb55e('0x16'));var utils=require(_0xb55e('0x17'));var config=require('../../config/environment');var db=require(_0xb55e('0x18'))['db'];config[_0xb55e('0x19')]=_[_0xb55e('0x1a')](config[_0xb55e('0x19')],{'host':_0xb55e('0x1b'),'port':0x18eb});var socket=require(_0xb55e('0x1c'))(new Redis(config[_0xb55e('0x19')]));require('./chatGroup.socket')[_0xb55e('0x1d')](socket);var jayson=require(_0xb55e('0x1e'));var client=jayson[_0xb55e('0x1f')]['http']({'port':0x232a});function checkPasswordPattern(_0x2dbff3,_0x12c484,_0x1cff93){if(_0x1cff93){var _0x2afbf7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2afbf7[_0xb55e('0x20')](_0x12c484)){return _0x2dbff3;}else{throw new db[(_0xb55e('0x21'))]['ValidationError'](_0xb55e('0x22'));}}else{return _0x2dbff3;}}function respondWithRpcPromise(_0x3827ad,_0x56ab69,_0x26fe40,_0x2729e8){return new BPromise(function(_0x3215f9,_0x4795f3){var _0x39147f=_0x2729e8||client;return _0x39147f[_0xb55e('0x23')](_0x3827ad,_0x26fe40)[_0xb55e('0x24')](function(_0x43db44){logger[_0xb55e('0x25')](_0xb55e('0x26'),_0x56ab69,_0xb55e('0x27'));logger['debug'](_0xb55e('0x28'),_0x56ab69,'request\x20sent',JSON[_0xb55e('0x29')](_0x43db44));if(_0x43db44[_0xb55e('0x2a')]){if(_0x43db44[_0xb55e('0x2a')][_0xb55e('0x2b')]===0x1f4){logger[_0xb55e('0x2a')](_0xb55e('0x26'),_0x56ab69,_0x43db44[_0xb55e('0x2a')][_0xb55e('0x2c')]);return _0x4795f3(_0x43db44[_0xb55e('0x2a')][_0xb55e('0x2c')]);}logger[_0xb55e('0x2a')]('ChatGroup,\x20%s,\x20%s',_0x56ab69,_0x43db44[_0xb55e('0x2a')][_0xb55e('0x2c')]);return _0x3215f9(_0x43db44[_0xb55e('0x2a')][_0xb55e('0x2c')]);}else{logger['info'](_0xb55e('0x26'),_0x56ab69,_0xb55e('0x27'));_0x3215f9(_0x43db44['result'][_0xb55e('0x2c')]);}})[_0xb55e('0x2d')](function(_0x393f3c){logger[_0xb55e('0x2a')](_0xb55e('0x26'),_0x56ab69,_0x393f3c);_0x4795f3(_0x393f3c);});});}function respondWithStatusCode(_0x1aa32d,_0x140e8c){_0x140e8c=_0x140e8c||0xcc;return function(_0x4b9d56){if(_0x4b9d56){return _0x1aa32d[_0xb55e('0x2e')](_0x140e8c);}return _0x1aa32d[_0xb55e('0x2f')](_0x140e8c)[_0xb55e('0x30')]();};}function respondWithResult(_0x5e6815,_0x11ffe5){_0x11ffe5=_0x11ffe5||0xc8;return function(_0x554534){if(_0x554534){return _0x5e6815[_0xb55e('0x2f')](_0x11ffe5)[_0xb55e('0x31')](_0x554534);}};}function respondWithFilteredResult(_0x47c1aa,_0x13ad8f){return function(_0x456b6d){if(_0x456b6d){var _0x2a1ce1=_0x456b6d[_0xb55e('0x32')],_0x8649be=_0x13ad8f[_0xb55e('0x33')],_0x4a6bd2=_0x13ad8f[_0xb55e('0x33')]+_0x13ad8f[_0xb55e('0x34')],_0x284440;if(_0x4a6bd2>=_0x2a1ce1){_0x4a6bd2=_0x2a1ce1;_0x284440=0xc8;}else{_0x284440=0xce;}_0x47c1aa[_0xb55e('0x2f')](_0x284440);return _0x47c1aa[_0xb55e('0x35')]('Content-Range',_0x8649be+'-'+_0x4a6bd2+'/'+_0x2a1ce1)[_0xb55e('0x31')](_0x456b6d);}return null;};}function patchUpdates(_0x4d32bc){return function(_0x1aee2b){try{jsonpatch[_0xb55e('0x36')](_0x1aee2b,_0x4d32bc,!![]);}catch(_0x11bff7){return BPromise[_0xb55e('0x37')](_0x11bff7);}return _0x1aee2b[_0xb55e('0x38')]();};}function saveUpdates(_0x372f65,_0x38e0b1){return function(_0x1c0d80){if(_0x1c0d80){return _0x1c0d80[_0xb55e('0x39')](_0x372f65)[_0xb55e('0x24')](function(_0x18cfe6){return _0x18cfe6;});}return null;};}function removeEntity(_0xa6693f,_0x544608){return function(_0x14e939){if(_0x14e939){return _0x14e939[_0xb55e('0x3a')]()[_0xb55e('0x24')](function(){_0xa6693f[_0xb55e('0x2f')](0xcc)[_0xb55e('0x30')]();});}};}function handleEntityNotFound(_0x1fde48,_0x1ae556){return function(_0xd901f1){if(!_0xd901f1){_0x1fde48['sendStatus'](0x194);}return _0xd901f1;};}function handleError(_0x474ecc,_0x21ce0c){_0x21ce0c=_0x21ce0c||0x1f4;return function(_0x103f41){logger['error'](_0x103f41['stack']);if(_0x103f41[_0xb55e('0x3b')]){delete _0x103f41[_0xb55e('0x3b')];}_0x474ecc[_0xb55e('0x2f')](_0x21ce0c)[_0xb55e('0x3c')](_0x103f41);};}exports[_0xb55e('0x3d')]=function(_0x3d5826,_0x7a98ae){var _0xb60818={},_0x3f759d={},_0x4e8ef0={'count':0x0,'rows':[]};var _0x1e421b=_[_0xb55e('0x3e')](db[_0xb55e('0x3f')][_0xb55e('0x40')],function(_0x39aa92){return{'name':_0x39aa92[_0xb55e('0x41')],'type':_0x39aa92['type']['key']};});_0x3f759d[_0xb55e('0x42')]=_[_0xb55e('0x3e')](_0x1e421b,_0xb55e('0x3b'));_0x3f759d[_0xb55e('0x43')]=_[_0xb55e('0x44')](_0x3d5826[_0xb55e('0x43')]);_0x3f759d[_0xb55e('0x45')]=_[_0xb55e('0x46')](_0x3f759d[_0xb55e('0x42')],_0x3f759d[_0xb55e('0x43')]);_0xb60818['attributes']=_['intersection'](_0x3f759d['model'],qs['fields'](_0x3d5826[_0xb55e('0x43')][_0xb55e('0x47')]));_0xb60818[_0xb55e('0x48')]=_0xb60818[_0xb55e('0x48')][_0xb55e('0x49')]?_0xb60818['attributes']:_0x3f759d[_0xb55e('0x42')];if(!_0x3d5826[_0xb55e('0x43')]['hasOwnProperty'](_0xb55e('0x4a'))){_0xb60818['limit']=qs[_0xb55e('0x34')](_0x3d5826[_0xb55e('0x43')][_0xb55e('0x34')]);_0xb60818['offset']=qs[_0xb55e('0x33')](_0x3d5826[_0xb55e('0x43')][_0xb55e('0x33')]);}_0xb60818[_0xb55e('0x4b')]=qs[_0xb55e('0x4c')](_0x3d5826[_0xb55e('0x43')][_0xb55e('0x4c')]);_0xb60818[_0xb55e('0x4d')]=qs[_0xb55e('0x45')](_[_0xb55e('0x4e')](_0x3d5826[_0xb55e('0x43')],_0x3f759d['filters']));if(_0x3d5826[_0xb55e('0x43')][_0xb55e('0x4f')]){_0xb60818[_0xb55e('0x4d')]=_[_0xb55e('0x50')](_0xb60818[_0xb55e('0x4d')],{'$or':_[_0xb55e('0x3e')](_0x1e421b,function(_0x11c3e3){if(_0x11c3e3['type']!=='VIRTUAL'){var _0x588bed={};_0x588bed[_0x11c3e3[_0xb55e('0x3b')]]={'$like':'%'+_0x3d5826[_0xb55e('0x43')]['filter']+'%'};return _0x588bed;}})});}_0xb60818=_['merge']({},_0xb60818,_0x3d5826['options']);var _0x5eb7d6={'where':_0xb60818[_0xb55e('0x4d')]};return db[_0xb55e('0x3f')][_0xb55e('0x32')](_0x5eb7d6)[_0xb55e('0x24')](function(_0x238d2e){_0x4e8ef0['count']=_0x238d2e;if(_0x3d5826['query'][_0xb55e('0x51')]){_0xb60818[_0xb55e('0x52')]=[{'all':!![]}];}return db[_0xb55e('0x3f')][_0xb55e('0x53')](_0xb60818);})['then'](function(_0x1ad7e8){_0x4e8ef0['rows']=_0x1ad7e8;return _0x4e8ef0;})[_0xb55e('0x24')](respondWithFilteredResult(_0x7a98ae,_0xb60818))[_0xb55e('0x2d')](handleError(_0x7a98ae,null));};exports[_0xb55e('0x54')]=function(_0x4b10ad,_0x5482b0){var _0x1e3044={'raw':!![],'where':{'id':_0x4b10ad['params']['id']}},_0x35dda8={};_0x35dda8[_0xb55e('0x42')]=_['keys'](db['ChatGroup'][_0xb55e('0x40')]);_0x35dda8[_0xb55e('0x43')]=_[_0xb55e('0x44')](_0x4b10ad[_0xb55e('0x43')]);_0x35dda8[_0xb55e('0x45')]=_[_0xb55e('0x46')](_0x35dda8['model'],_0x35dda8[_0xb55e('0x43')]);_0x1e3044[_0xb55e('0x48')]=_[_0xb55e('0x46')](_0x35dda8['model'],qs[_0xb55e('0x47')](_0x4b10ad[_0xb55e('0x43')]['fields']));_0x1e3044['attributes']=_0x1e3044[_0xb55e('0x48')]['length']?_0x1e3044[_0xb55e('0x48')]:_0x35dda8[_0xb55e('0x42')];if(_0x4b10ad['query'][_0xb55e('0x51')]){_0x1e3044[_0xb55e('0x52')]=[{'all':!![]}];}_0x1e3044=_[_0xb55e('0x50')]({},_0x1e3044,_0x4b10ad[_0xb55e('0x55')]);return db[_0xb55e('0x3f')][_0xb55e('0x56')](_0x1e3044)[_0xb55e('0x24')](handleEntityNotFound(_0x5482b0,null))[_0xb55e('0x24')](respondWithResult(_0x5482b0,null))[_0xb55e('0x2d')](handleError(_0x5482b0,null));};exports[_0xb55e('0x57')]=function(_0x3512e7,_0x4fef1b){return db[_0xb55e('0x3f')][_0xb55e('0x57')](_0x3512e7[_0xb55e('0x58')],{})[_0xb55e('0x24')](respondWithResult(_0x4fef1b,0xc9))[_0xb55e('0x2d')](handleError(_0x4fef1b,null));};exports['update']=function(_0x1c83c1,_0xed299a){if(_0x1c83c1[_0xb55e('0x58')]['id']){delete _0x1c83c1[_0xb55e('0x58')]['id'];}return db[_0xb55e('0x3f')][_0xb55e('0x56')]({'where':{'id':_0x1c83c1[_0xb55e('0x59')]['id']}})[_0xb55e('0x24')](handleEntityNotFound(_0xed299a,null))[_0xb55e('0x24')](saveUpdates(_0x1c83c1[_0xb55e('0x58')],null))[_0xb55e('0x24')](respondWithResult(_0xed299a,null))[_0xb55e('0x2d')](handleError(_0xed299a,null));};exports[_0xb55e('0x3a')]=function(_0x128402,_0x2f67b5){return db['ChatGroup'][_0xb55e('0x56')]({'where':{'id':_0x128402[_0xb55e('0x59')]['id']}})['then'](handleEntityNotFound(_0x2f67b5,null))[_0xb55e('0x24')](removeEntity(_0x2f67b5,null))[_0xb55e('0x2d')](handleError(_0x2f67b5,null));};exports[_0xb55e('0x5a')]=function(_0x22178f,_0x558694){return db['ChatGroup']['describe']()[_0xb55e('0x24')](respondWithResult(_0x558694,null))[_0xb55e('0x2d')](handleError(_0x558694,null));};exports[_0xb55e('0x5b')]=function(_0x499478,_0x2a5746,_0xba9fe2){return db[_0xb55e('0x5c')][_0xb55e('0x32')]({'where':{'ChatGroupId':_0x499478[_0xb55e('0x59')]['id'],'ToId':_0x499478[_0xb55e('0x5d')]['id'],'read':![]}})[_0xb55e('0x24')](function(_0x5dd958){return{'id':_[_0xb55e('0x5e')](_0x499478[_0xb55e('0x59')]['id']),'count':_0x5dd958};})[_0xb55e('0x24')](respondWithResult(_0x2a5746,null))[_0xb55e('0x2d')](handleError(_0x2a5746,null));};exports[_0xb55e('0x5f')]=function(_0x5d6e1c,_0x590a9b,_0x119935){return db[_0xb55e('0x3f')][_0xb55e('0x56')]({'where':{'id':_0x5d6e1c[_0xb55e('0x59')]['id']}})[_0xb55e('0x24')](handleEntityNotFound(_0x590a9b,null))[_0xb55e('0x24')](function(_0x36fb75){if(_0x36fb75){return _0x36fb75[_0xb55e('0x5f')](_0x5d6e1c[_0xb55e('0x58')][_0xb55e('0x60')],_['omit'](_0x5d6e1c['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x590a9b,null))[_0xb55e('0x2d')](handleError(_0x590a9b,null));};exports[_0xb55e('0x61')]=function(_0x16f2c6,_0xdc643e,_0x2ea5cc){var _0x4d624f={};var _0x10dbc6={};var _0x43d026;var _0x32839c;return db[_0xb55e('0x3f')][_0xb55e('0x62')]({'where':{'id':_0x16f2c6[_0xb55e('0x59')]['id']}})['then'](handleEntityNotFound(_0xdc643e,null))[_0xb55e('0x24')](function(_0x182d50){if(_0x182d50){_0x43d026=_0x182d50;_0x10dbc6[_0xb55e('0x42')]=_[_0xb55e('0x44')](db[_0xb55e('0x63')][_0xb55e('0x40')]);_0x10dbc6[_0xb55e('0x43')]=_['keys'](_0x16f2c6[_0xb55e('0x43')]);_0x10dbc6[_0xb55e('0x45')]=_[_0xb55e('0x46')](_0x10dbc6[_0xb55e('0x42')],_0x10dbc6[_0xb55e('0x43')]);_0x4d624f[_0xb55e('0x48')]=_[_0xb55e('0x46')](_0x10dbc6[_0xb55e('0x42')],qs['fields'](_0x16f2c6[_0xb55e('0x43')]['fields']));_0x4d624f[_0xb55e('0x48')]=_0x4d624f[_0xb55e('0x48')][_0xb55e('0x49')]?_0x4d624f[_0xb55e('0x48')]:_0x10dbc6[_0xb55e('0x42')];_0x4d624f[_0xb55e('0x4b')]=qs[_0xb55e('0x4c')](_0x16f2c6[_0xb55e('0x43')][_0xb55e('0x4c')]);_0x4d624f[_0xb55e('0x4d')]=qs['filters'](_['pick'](_0x16f2c6[_0xb55e('0x43')],_0x10dbc6[_0xb55e('0x45')]));if(_0x16f2c6['query']['filter']){_0x4d624f['where']=_[_0xb55e('0x50')](_0x4d624f['where'],{'$or':_['map'](_0x4d624f['attributes'],function(_0x40de86){var _0x28ac20={};_0x28ac20[_0x40de86]={'$like':'%'+_0x16f2c6[_0xb55e('0x43')][_0xb55e('0x4f')]+'%'};return _0x28ac20;})});}_0x4d624f=_[_0xb55e('0x50')]({},_0x4d624f,_0x16f2c6[_0xb55e('0x55')]);return _0x43d026[_0xb55e('0x61')](_0x4d624f);}})[_0xb55e('0x24')](function(_0x57c3c4){if(_0x57c3c4){_0x32839c=_0x57c3c4['length'];if(!_0x16f2c6[_0xb55e('0x43')][_0xb55e('0x64')](_0xb55e('0x4a'))){_0x4d624f[_0xb55e('0x34')]=qs['limit'](_0x16f2c6[_0xb55e('0x43')][_0xb55e('0x34')]);_0x4d624f[_0xb55e('0x33')]=qs[_0xb55e('0x33')](_0x16f2c6[_0xb55e('0x43')][_0xb55e('0x33')]);}return _0x43d026['getMembers'](_0x4d624f);}})[_0xb55e('0x24')](function(_0x884a08){if(_0x884a08){return _0x884a08?{'count':_0x32839c,'rows':_0x884a08}:null;}})['then'](respondWithResult(_0xdc643e,null))[_0xb55e('0x2d')](handleError(_0xdc643e,null));};exports[_0xb55e('0x65')]=function(_0x1ed3dc,_0xb3d96e,_0x266852){return db['ChatGroup']['find']({'where':{'id':_0x1ed3dc[_0xb55e('0x59')]['id']}})[_0xb55e('0x24')](handleEntityNotFound(_0xb3d96e,null))[_0xb55e('0x24')](function(_0x57fd76){if(_0x57fd76){return _0x57fd76[_0xb55e('0x65')](_0x1ed3dc['query'][_0xb55e('0x60')]);}})[_0xb55e('0x24')](respondWithStatusCode(_0xb3d96e,null))[_0xb55e('0x2d')](handleError(_0xb3d96e,null));};exports[_0xb55e('0x66')]=function(_0x46ecfd,_0x508566,_0x4ee062){if(_0x46ecfd[_0xb55e('0x58')]['id']){delete _0x46ecfd[_0xb55e('0x58')]['id'];}return db[_0xb55e('0x3f')][_0xb55e('0x56')]({'where':{'id':_0x46ecfd[_0xb55e('0x59')]['id']}})[_0xb55e('0x24')](handleEntityNotFound(_0x508566,null))['then'](function(_0x52c84b){if(_0x52c84b){_0x46ecfd[_0xb55e('0x58')][_0xb55e('0x67')]=_0x52c84b['id'];return db[_0xb55e('0x5c')][_0xb55e('0x57')](_0x46ecfd[_0xb55e('0x58')]);}})['then'](respondWithResult(_0x508566,null))['catch'](handleError(_0x508566,null));};exports[_0xb55e('0x68')]=function(_0xe942f8,_0x4bf0f4,_0x508264){var _0x323e0e={};var _0x3a1aed={};var _0x3f5c77;var _0x3e71c3;return db['ChatGroup']['findOne']({'where':{'id':_0xe942f8[_0xb55e('0x59')]['id']}})[_0xb55e('0x24')](handleEntityNotFound(_0x4bf0f4,null))[_0xb55e('0x24')](function(_0x713470){if(_0x713470){_0x3f5c77=_0x713470;_0x3a1aed[_0xb55e('0x42')]=_[_0xb55e('0x44')](db[_0xb55e('0x5c')][_0xb55e('0x40')]);_0x3a1aed[_0xb55e('0x43')]=_[_0xb55e('0x44')](_0xe942f8[_0xb55e('0x43')]);_0x3a1aed['filters']=_[_0xb55e('0x46')](_0x3a1aed[_0xb55e('0x42')],_0x3a1aed[_0xb55e('0x43')]);_0x323e0e['attributes']=_['intersection'](_0x3a1aed['model'],qs[_0xb55e('0x47')](_0xe942f8[_0xb55e('0x43')]['fields']));_0x323e0e[_0xb55e('0x48')]=_0x323e0e[_0xb55e('0x48')][_0xb55e('0x49')]?_0x323e0e['attributes']:_0x3a1aed[_0xb55e('0x42')];_0x323e0e[_0xb55e('0x4b')]=qs[_0xb55e('0x4c')](_0xe942f8[_0xb55e('0x43')][_0xb55e('0x4c')]);_0x323e0e[_0xb55e('0x4d')]=qs[_0xb55e('0x45')](_['pick'](_0xe942f8[_0xb55e('0x43')],_0x3a1aed[_0xb55e('0x45')]));if(_0xe942f8['query'][_0xb55e('0x4f')]){_0x323e0e[_0xb55e('0x4d')]=_[_0xb55e('0x50')](_0x323e0e[_0xb55e('0x4d')],{'$or':_['map'](_0x323e0e[_0xb55e('0x48')],function(_0x4b223){var _0x20d3c3={};_0x20d3c3[_0x4b223]={'$like':'%'+_0xe942f8[_0xb55e('0x43')][_0xb55e('0x4f')]+'%'};return _0x20d3c3;})});}if(_0xe942f8[_0xb55e('0x43')][_0xb55e('0x69')]){var _0x4ac4ff=_0xe942f8[_0xb55e('0x43')][_0xb55e('0x69')][_0xb55e('0x6a')](',');var _0x485f72={};_0x485f72[_0x4ac4ff[0x0]]={'$gte':moment(_0x4ac4ff[0x1])[_0xb55e('0x6b')](_0xb55e('0x6c'))};_0x323e0e['where']=_['merge'](_0x323e0e['where'],_0x485f72);}_0x323e0e=_[_0xb55e('0x50')]({},_0x323e0e,_0xe942f8[_0xb55e('0x55')]);return _0x3f5c77['getMessages'](_0x323e0e);}})['then'](function(_0x5b8b36){if(_0x5b8b36){_0x3e71c3=_0x5b8b36[_0xb55e('0x49')];if(!_0xe942f8[_0xb55e('0x43')][_0xb55e('0x64')](_0xb55e('0x4a'))){_0x323e0e[_0xb55e('0x34')]=qs[_0xb55e('0x34')](_0xe942f8[_0xb55e('0x43')][_0xb55e('0x34')]);_0x323e0e['offset']=qs[_0xb55e('0x33')](_0xe942f8[_0xb55e('0x43')][_0xb55e('0x33')]);}return _0x3f5c77[_0xb55e('0x68')](_0x323e0e);}})[_0xb55e('0x24')](function(_0x4e9a6c){if(_0x4e9a6c){return _0x4e9a6c?{'count':_0x3e71c3,'rows':_0x4e9a6c}:null;}})[_0xb55e('0x24')](respondWithResult(_0x4bf0f4,null))[_0xb55e('0x2d')](handleError(_0x4bf0f4,null));}; \ No newline at end of file +var _0xffe1=['findAll','rows','show','params','find','create','body','describe','getUnread','toInteger','addMembers','ids','omit','findOne','pick','getMembers','hasOwnProperty','nolimit','removeMembers','addMessage','ChatGroupId','ChatInternalMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','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','ChatGroup,\x20%s,\x20%s','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','map','ChatGroup','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','length','order','sort','where','filter','merge','VIRTUAL','options','then','include'];(function(_0x57d13b,_0x52d8cb){var _0x467696=function(_0x153000){while(--_0x153000){_0x57d13b['push'](_0x57d13b['shift']());}};_0x467696(++_0x52d8cb);}(_0xffe1,0x1d2));var _0x1ffe=function(_0x34a7f2,_0x241d91){_0x34a7f2=_0x34a7f2-0x0;var _0x62e5b1=_0xffe1[_0x34a7f2];return _0x62e5b1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1ffe('0x0'));var rimraf=require(_0x1ffe('0x1'));var zipdir=require(_0x1ffe('0x2'));var jsonpatch=require(_0x1ffe('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1ffe('0x4'));var util=require(_0x1ffe('0x5'));var path=require(_0x1ffe('0x6'));var sox=require(_0x1ffe('0x7'));var csv=require(_0x1ffe('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1ffe('0x9'));var squel=require(_0x1ffe('0xa'));var crypto=require(_0x1ffe('0xb'));var jsforce=require(_0x1ffe('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1ffe('0xd'));var Redis=require(_0x1ffe('0xe'));var authService=require(_0x1ffe('0xf'));var qs=require(_0x1ffe('0x10'));var as=require(_0x1ffe('0x11'));var hardwareService=require(_0x1ffe('0x12'));var logger=require(_0x1ffe('0x13'))(_0x1ffe('0x14'));var utils=require(_0x1ffe('0x15'));var config=require(_0x1ffe('0x16'));var db=require('../../mysqldb')['db'];config[_0x1ffe('0x17')]=_[_0x1ffe('0x18')](config[_0x1ffe('0x17')],{'host':_0x1ffe('0x19'),'port':0x18eb});var socket=require(_0x1ffe('0x1a'))(new Redis(config[_0x1ffe('0x17')]));require(_0x1ffe('0x1b'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x1ffe('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x20221d,_0x5a62a,_0x2db73e){if(_0x2db73e){var _0x28a1ea=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x28a1ea[_0x1ffe('0x1d')](_0x5a62a)){return _0x20221d;}else{throw new db[(_0x1ffe('0x1e'))][(_0x1ffe('0x1f'))](_0x1ffe('0x20'));}}else{return _0x20221d;}}function respondWithRpcPromise(_0x49df46,_0x247f7c,_0x5982fe,_0x2ab9be){return new BPromise(function(_0x1d0a99,_0xe878f1){var _0x37c96e=_0x2ab9be||client;return _0x37c96e[_0x1ffe('0x21')](_0x49df46,_0x5982fe)['then'](function(_0xb2c0b1){logger['info'](_0x1ffe('0x22'),_0x247f7c,'request\x20sent');logger['debug'](_0x1ffe('0x23'),_0x247f7c,_0x1ffe('0x24'),JSON[_0x1ffe('0x25')](_0xb2c0b1));if(_0xb2c0b1['error']){if(_0xb2c0b1[_0x1ffe('0x26')][_0x1ffe('0x27')]===0x1f4){logger[_0x1ffe('0x26')](_0x1ffe('0x22'),_0x247f7c,_0xb2c0b1[_0x1ffe('0x26')][_0x1ffe('0x28')]);return _0xe878f1(_0xb2c0b1[_0x1ffe('0x26')][_0x1ffe('0x28')]);}logger[_0x1ffe('0x26')](_0x1ffe('0x22'),_0x247f7c,_0xb2c0b1[_0x1ffe('0x26')][_0x1ffe('0x28')]);return _0x1d0a99(_0xb2c0b1[_0x1ffe('0x26')]['message']);}else{logger[_0x1ffe('0x29')]('ChatGroup,\x20%s,\x20%s',_0x247f7c,_0x1ffe('0x24'));_0x1d0a99(_0xb2c0b1[_0x1ffe('0x2a')][_0x1ffe('0x28')]);}})[_0x1ffe('0x2b')](function(_0x422add){logger['error']('ChatGroup,\x20%s,\x20%s',_0x247f7c,_0x422add);_0xe878f1(_0x422add);});});}function respondWithStatusCode(_0x57c302,_0x430888){_0x430888=_0x430888||0xcc;return function(_0x2ae488){if(_0x2ae488){return _0x57c302[_0x1ffe('0x2c')](_0x430888);}return _0x57c302[_0x1ffe('0x2d')](_0x430888)[_0x1ffe('0x2e')]();};}function respondWithResult(_0x500fbc,_0x2468d4){_0x2468d4=_0x2468d4||0xc8;return function(_0x145393){if(_0x145393){return _0x500fbc[_0x1ffe('0x2d')](_0x2468d4)[_0x1ffe('0x2f')](_0x145393);}};}function respondWithFilteredResult(_0x5a9d0e,_0x33da1d){return function(_0x197d56){if(_0x197d56){var _0x13437a=_0x197d56[_0x1ffe('0x30')],_0x335846=_0x33da1d[_0x1ffe('0x31')],_0x67bc77=_0x33da1d['offset']+_0x33da1d[_0x1ffe('0x32')],_0x5e278e;if(_0x67bc77>=_0x13437a){_0x67bc77=_0x13437a;_0x5e278e=0xc8;}else{_0x5e278e=0xce;}_0x5a9d0e[_0x1ffe('0x2d')](_0x5e278e);return _0x5a9d0e[_0x1ffe('0x33')](_0x1ffe('0x34'),_0x335846+'-'+_0x67bc77+'/'+_0x13437a)[_0x1ffe('0x2f')](_0x197d56);}return null;};}function patchUpdates(_0x369579){return function(_0x5435c5){try{jsonpatch[_0x1ffe('0x35')](_0x5435c5,_0x369579,!![]);}catch(_0x57d87e){return BPromise[_0x1ffe('0x36')](_0x57d87e);}return _0x5435c5[_0x1ffe('0x37')]();};}function saveUpdates(_0x2d1246,_0x40c89b){return function(_0x2aa087){if(_0x2aa087){return _0x2aa087[_0x1ffe('0x38')](_0x2d1246)['then'](function(_0x5f1a9b){return _0x5f1a9b;});}return null;};}function removeEntity(_0x1bddd7,_0x335335){return function(_0x44d3b0){if(_0x44d3b0){return _0x44d3b0[_0x1ffe('0x39')]()['then'](function(){_0x1bddd7[_0x1ffe('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e76c9,_0x31c435){return function(_0xfde619){if(!_0xfde619){_0x5e76c9[_0x1ffe('0x2c')](0x194);}return _0xfde619;};}function handleError(_0x1df086,_0x7b5dd){_0x7b5dd=_0x7b5dd||0x1f4;return function(_0x5ca66d){logger['error'](_0x5ca66d[_0x1ffe('0x3a')]);if(_0x5ca66d[_0x1ffe('0x3b')]){delete _0x5ca66d['name'];}_0x1df086[_0x1ffe('0x2d')](_0x7b5dd)['send'](_0x5ca66d);};}exports[_0x1ffe('0x3c')]=function(_0x4bcafc,_0x2bc95d){var _0x598fff={},_0x2b8b43={},_0x1b2c5b={'count':0x0,'rows':[]};var _0x5b8345=_[_0x1ffe('0x3d')](db[_0x1ffe('0x3e')][_0x1ffe('0x3f')],function(_0x45af59){return{'name':_0x45af59[_0x1ffe('0x40')],'type':_0x45af59[_0x1ffe('0x41')][_0x1ffe('0x42')]};});_0x2b8b43['model']=_['map'](_0x5b8345,_0x1ffe('0x3b'));_0x2b8b43['query']=_[_0x1ffe('0x43')](_0x4bcafc['query']);_0x2b8b43[_0x1ffe('0x44')]=_[_0x1ffe('0x45')](_0x2b8b43[_0x1ffe('0x46')],_0x2b8b43[_0x1ffe('0x47')]);_0x598fff[_0x1ffe('0x48')]=_[_0x1ffe('0x45')](_0x2b8b43[_0x1ffe('0x46')],qs[_0x1ffe('0x49')](_0x4bcafc[_0x1ffe('0x47')][_0x1ffe('0x49')]));_0x598fff[_0x1ffe('0x48')]=_0x598fff[_0x1ffe('0x48')][_0x1ffe('0x4a')]?_0x598fff[_0x1ffe('0x48')]:_0x2b8b43[_0x1ffe('0x46')];if(!_0x4bcafc[_0x1ffe('0x47')]['hasOwnProperty']('nolimit')){_0x598fff[_0x1ffe('0x32')]=qs[_0x1ffe('0x32')](_0x4bcafc[_0x1ffe('0x47')][_0x1ffe('0x32')]);_0x598fff[_0x1ffe('0x31')]=qs['offset'](_0x4bcafc[_0x1ffe('0x47')][_0x1ffe('0x31')]);}_0x598fff[_0x1ffe('0x4b')]=qs[_0x1ffe('0x4c')](_0x4bcafc[_0x1ffe('0x47')][_0x1ffe('0x4c')]);_0x598fff[_0x1ffe('0x4d')]=qs[_0x1ffe('0x44')](_['pick'](_0x4bcafc['query'],_0x2b8b43['filters']));if(_0x4bcafc[_0x1ffe('0x47')][_0x1ffe('0x4e')]){_0x598fff[_0x1ffe('0x4d')]=_[_0x1ffe('0x4f')](_0x598fff[_0x1ffe('0x4d')],{'$or':_['map'](_0x5b8345,function(_0x230bc9){if(_0x230bc9[_0x1ffe('0x41')]!==_0x1ffe('0x50')){var _0x49b102={};_0x49b102[_0x230bc9['name']]={'$like':'%'+_0x4bcafc['query']['filter']+'%'};return _0x49b102;}})});}_0x598fff=_[_0x1ffe('0x4f')]({},_0x598fff,_0x4bcafc[_0x1ffe('0x51')]);var _0x5d3b87={'where':_0x598fff[_0x1ffe('0x4d')]};return db[_0x1ffe('0x3e')][_0x1ffe('0x30')](_0x5d3b87)[_0x1ffe('0x52')](function(_0x53c920){_0x1b2c5b[_0x1ffe('0x30')]=_0x53c920;if(_0x4bcafc[_0x1ffe('0x47')]['includeAll']){_0x598fff[_0x1ffe('0x53')]=[{'all':!![]}];}return db[_0x1ffe('0x3e')][_0x1ffe('0x54')](_0x598fff);})[_0x1ffe('0x52')](function(_0x5ba1f4){_0x1b2c5b[_0x1ffe('0x55')]=_0x5ba1f4;return _0x1b2c5b;})['then'](respondWithFilteredResult(_0x2bc95d,_0x598fff))[_0x1ffe('0x2b')](handleError(_0x2bc95d,null));};exports[_0x1ffe('0x56')]=function(_0x36f0d3,_0x428856){var _0x4b0a53={'raw':!![],'where':{'id':_0x36f0d3[_0x1ffe('0x57')]['id']}},_0x4dbd1a={};_0x4dbd1a[_0x1ffe('0x46')]=_[_0x1ffe('0x43')](db[_0x1ffe('0x3e')][_0x1ffe('0x3f')]);_0x4dbd1a[_0x1ffe('0x47')]=_[_0x1ffe('0x43')](_0x36f0d3['query']);_0x4dbd1a['filters']=_[_0x1ffe('0x45')](_0x4dbd1a[_0x1ffe('0x46')],_0x4dbd1a[_0x1ffe('0x47')]);_0x4b0a53[_0x1ffe('0x48')]=_[_0x1ffe('0x45')](_0x4dbd1a[_0x1ffe('0x46')],qs[_0x1ffe('0x49')](_0x36f0d3['query'][_0x1ffe('0x49')]));_0x4b0a53[_0x1ffe('0x48')]=_0x4b0a53['attributes'][_0x1ffe('0x4a')]?_0x4b0a53[_0x1ffe('0x48')]:_0x4dbd1a[_0x1ffe('0x46')];if(_0x36f0d3[_0x1ffe('0x47')]['includeAll']){_0x4b0a53[_0x1ffe('0x53')]=[{'all':!![]}];}_0x4b0a53=_['merge']({},_0x4b0a53,_0x36f0d3['options']);return db[_0x1ffe('0x3e')][_0x1ffe('0x58')](_0x4b0a53)['then'](handleEntityNotFound(_0x428856,null))[_0x1ffe('0x52')](respondWithResult(_0x428856,null))[_0x1ffe('0x2b')](handleError(_0x428856,null));};exports[_0x1ffe('0x59')]=function(_0x5f4de4,_0x23f481){return db[_0x1ffe('0x3e')][_0x1ffe('0x59')](_0x5f4de4['body'],{})[_0x1ffe('0x52')](respondWithResult(_0x23f481,0xc9))['catch'](handleError(_0x23f481,null));};exports[_0x1ffe('0x38')]=function(_0x18351c,_0x461746){if(_0x18351c[_0x1ffe('0x5a')]['id']){delete _0x18351c[_0x1ffe('0x5a')]['id'];}return db[_0x1ffe('0x3e')][_0x1ffe('0x58')]({'where':{'id':_0x18351c[_0x1ffe('0x57')]['id']}})[_0x1ffe('0x52')](handleEntityNotFound(_0x461746,null))[_0x1ffe('0x52')](saveUpdates(_0x18351c[_0x1ffe('0x5a')],null))['then'](respondWithResult(_0x461746,null))['catch'](handleError(_0x461746,null));};exports[_0x1ffe('0x39')]=function(_0x2c6f25,_0x57c96f){return db['ChatGroup'][_0x1ffe('0x58')]({'where':{'id':_0x2c6f25['params']['id']}})['then'](handleEntityNotFound(_0x57c96f,null))[_0x1ffe('0x52')](removeEntity(_0x57c96f,null))[_0x1ffe('0x2b')](handleError(_0x57c96f,null));};exports[_0x1ffe('0x5b')]=function(_0x154970,_0x3e2aea){return db[_0x1ffe('0x3e')]['describe']()[_0x1ffe('0x52')](respondWithResult(_0x3e2aea,null))[_0x1ffe('0x2b')](handleError(_0x3e2aea,null));};exports[_0x1ffe('0x5c')]=function(_0x5d1b11,_0xec389c,_0x1db611){return db['ChatInternalMessage'][_0x1ffe('0x30')]({'where':{'ChatGroupId':_0x5d1b11['params']['id'],'ToId':_0x5d1b11['user']['id'],'read':![]}})[_0x1ffe('0x52')](function(_0x5b66bc){return{'id':_[_0x1ffe('0x5d')](_0x5d1b11[_0x1ffe('0x57')]['id']),'count':_0x5b66bc};})[_0x1ffe('0x52')](respondWithResult(_0xec389c,null))[_0x1ffe('0x2b')](handleError(_0xec389c,null));};exports[_0x1ffe('0x5e')]=function(_0x109bce,_0x35715e,_0x570c04){return db[_0x1ffe('0x3e')]['find']({'where':{'id':_0x109bce[_0x1ffe('0x57')]['id']}})[_0x1ffe('0x52')](handleEntityNotFound(_0x35715e,null))[_0x1ffe('0x52')](function(_0x7e8bd5){if(_0x7e8bd5){return _0x7e8bd5[_0x1ffe('0x5e')](_0x109bce[_0x1ffe('0x5a')][_0x1ffe('0x5f')],_[_0x1ffe('0x60')](_0x109bce[_0x1ffe('0x5a')],[_0x1ffe('0x5f'),'id'])||{});}})[_0x1ffe('0x52')](respondWithResult(_0x35715e,null))[_0x1ffe('0x2b')](handleError(_0x35715e,null));};exports['getMembers']=function(_0x1ea0af,_0x59919d,_0x920253){var _0x3c5d42={};var _0x5b8e4d={};var _0x5df296;var _0x225405;return db[_0x1ffe('0x3e')][_0x1ffe('0x61')]({'where':{'id':_0x1ea0af['params']['id']}})[_0x1ffe('0x52')](handleEntityNotFound(_0x59919d,null))[_0x1ffe('0x52')](function(_0x5b521a){if(_0x5b521a){_0x5df296=_0x5b521a;_0x5b8e4d[_0x1ffe('0x46')]=_[_0x1ffe('0x43')](db['User']['rawAttributes']);_0x5b8e4d[_0x1ffe('0x47')]=_[_0x1ffe('0x43')](_0x1ea0af[_0x1ffe('0x47')]);_0x5b8e4d[_0x1ffe('0x44')]=_[_0x1ffe('0x45')](_0x5b8e4d[_0x1ffe('0x46')],_0x5b8e4d[_0x1ffe('0x47')]);_0x3c5d42[_0x1ffe('0x48')]=_['intersection'](_0x5b8e4d['model'],qs[_0x1ffe('0x49')](_0x1ea0af[_0x1ffe('0x47')][_0x1ffe('0x49')]));_0x3c5d42[_0x1ffe('0x48')]=_0x3c5d42[_0x1ffe('0x48')]['length']?_0x3c5d42['attributes']:_0x5b8e4d[_0x1ffe('0x46')];_0x3c5d42[_0x1ffe('0x4b')]=qs[_0x1ffe('0x4c')](_0x1ea0af[_0x1ffe('0x47')]['sort']);_0x3c5d42[_0x1ffe('0x4d')]=qs[_0x1ffe('0x44')](_[_0x1ffe('0x62')](_0x1ea0af[_0x1ffe('0x47')],_0x5b8e4d[_0x1ffe('0x44')]));if(_0x1ea0af[_0x1ffe('0x47')][_0x1ffe('0x4e')]){_0x3c5d42[_0x1ffe('0x4d')]=_['merge'](_0x3c5d42[_0x1ffe('0x4d')],{'$or':_[_0x1ffe('0x3d')](_0x3c5d42[_0x1ffe('0x48')],function(_0x32f025){var _0x2a5e54={};_0x2a5e54[_0x32f025]={'$like':'%'+_0x1ea0af[_0x1ffe('0x47')]['filter']+'%'};return _0x2a5e54;})});}_0x3c5d42=_[_0x1ffe('0x4f')]({},_0x3c5d42,_0x1ea0af[_0x1ffe('0x51')]);return _0x5df296[_0x1ffe('0x63')](_0x3c5d42);}})[_0x1ffe('0x52')](function(_0x317b2e){if(_0x317b2e){_0x225405=_0x317b2e['length'];if(!_0x1ea0af[_0x1ffe('0x47')][_0x1ffe('0x64')](_0x1ffe('0x65'))){_0x3c5d42['limit']=qs['limit'](_0x1ea0af[_0x1ffe('0x47')][_0x1ffe('0x32')]);_0x3c5d42[_0x1ffe('0x31')]=qs[_0x1ffe('0x31')](_0x1ea0af[_0x1ffe('0x47')][_0x1ffe('0x31')]);}return _0x5df296[_0x1ffe('0x63')](_0x3c5d42);}})['then'](function(_0x5a4181){if(_0x5a4181){return _0x5a4181?{'count':_0x225405,'rows':_0x5a4181}:null;}})[_0x1ffe('0x52')](respondWithResult(_0x59919d,null))[_0x1ffe('0x2b')](handleError(_0x59919d,null));};exports[_0x1ffe('0x66')]=function(_0x3dfe1a,_0x256e58,_0x24f7fb){return db['ChatGroup'][_0x1ffe('0x58')]({'where':{'id':_0x3dfe1a[_0x1ffe('0x57')]['id']}})[_0x1ffe('0x52')](handleEntityNotFound(_0x256e58,null))[_0x1ffe('0x52')](function(_0x290c0b){if(_0x290c0b){return _0x290c0b[_0x1ffe('0x66')](_0x3dfe1a[_0x1ffe('0x47')][_0x1ffe('0x5f')]);}})[_0x1ffe('0x52')](respondWithStatusCode(_0x256e58,null))[_0x1ffe('0x2b')](handleError(_0x256e58,null));};exports[_0x1ffe('0x67')]=function(_0x2b50cc,_0x1bd923,_0x5ede3f){if(_0x2b50cc[_0x1ffe('0x5a')]['id']){delete _0x2b50cc[_0x1ffe('0x5a')]['id'];}return db[_0x1ffe('0x3e')][_0x1ffe('0x58')]({'where':{'id':_0x2b50cc[_0x1ffe('0x57')]['id']}})[_0x1ffe('0x52')](handleEntityNotFound(_0x1bd923,null))[_0x1ffe('0x52')](function(_0x406183){if(_0x406183){_0x2b50cc[_0x1ffe('0x5a')][_0x1ffe('0x68')]=_0x406183['id'];return db['ChatInternalMessage']['create'](_0x2b50cc[_0x1ffe('0x5a')]);}})['then'](respondWithResult(_0x1bd923,null))[_0x1ffe('0x2b')](handleError(_0x1bd923,null));};exports['getMessages']=function(_0x439ff8,_0x30f2b1,_0x2e269a){var _0x31b1d6={};var _0x127cc3={};var _0xea93e6;var _0x3e233c;return db[_0x1ffe('0x3e')][_0x1ffe('0x61')]({'where':{'id':_0x439ff8[_0x1ffe('0x57')]['id']}})[_0x1ffe('0x52')](handleEntityNotFound(_0x30f2b1,null))[_0x1ffe('0x52')](function(_0x2c7e51){if(_0x2c7e51){_0xea93e6=_0x2c7e51;_0x127cc3[_0x1ffe('0x46')]=_[_0x1ffe('0x43')](db[_0x1ffe('0x69')]['rawAttributes']);_0x127cc3[_0x1ffe('0x47')]=_['keys'](_0x439ff8[_0x1ffe('0x47')]);_0x127cc3[_0x1ffe('0x44')]=_[_0x1ffe('0x45')](_0x127cc3[_0x1ffe('0x46')],_0x127cc3[_0x1ffe('0x47')]);_0x31b1d6[_0x1ffe('0x48')]=_[_0x1ffe('0x45')](_0x127cc3['model'],qs[_0x1ffe('0x49')](_0x439ff8[_0x1ffe('0x47')][_0x1ffe('0x49')]));_0x31b1d6[_0x1ffe('0x48')]=_0x31b1d6[_0x1ffe('0x48')][_0x1ffe('0x4a')]?_0x31b1d6[_0x1ffe('0x48')]:_0x127cc3['model'];_0x31b1d6[_0x1ffe('0x4b')]=qs[_0x1ffe('0x4c')](_0x439ff8[_0x1ffe('0x47')][_0x1ffe('0x4c')]);_0x31b1d6[_0x1ffe('0x4d')]=qs[_0x1ffe('0x44')](_['pick'](_0x439ff8['query'],_0x127cc3['filters']));if(_0x439ff8['query'][_0x1ffe('0x4e')]){_0x31b1d6[_0x1ffe('0x4d')]=_[_0x1ffe('0x4f')](_0x31b1d6[_0x1ffe('0x4d')],{'$or':_['map'](_0x31b1d6[_0x1ffe('0x48')],function(_0x2d96f9){var _0x2a484f={};_0x2a484f[_0x2d96f9]={'$like':'%'+_0x439ff8[_0x1ffe('0x47')][_0x1ffe('0x4e')]+'%'};return _0x2a484f;})});}if(_0x439ff8['query'][_0x1ffe('0x6a')]){var _0x3b5967=_0x439ff8[_0x1ffe('0x47')]['$gte']['split'](',');var _0x22e1f4={};_0x22e1f4[_0x3b5967[0x0]]={'$gte':moment(_0x3b5967[0x1])[_0x1ffe('0x6b')](_0x1ffe('0x6c'))};_0x31b1d6[_0x1ffe('0x4d')]=_['merge'](_0x31b1d6[_0x1ffe('0x4d')],_0x22e1f4);}_0x31b1d6=_[_0x1ffe('0x4f')]({},_0x31b1d6,_0x439ff8[_0x1ffe('0x51')]);return _0xea93e6[_0x1ffe('0x6d')](_0x31b1d6);}})['then'](function(_0x22a07c){if(_0x22a07c){_0x3e233c=_0x22a07c['length'];if(!_0x439ff8['query'][_0x1ffe('0x64')](_0x1ffe('0x65'))){_0x31b1d6['limit']=qs['limit'](_0x439ff8[_0x1ffe('0x47')][_0x1ffe('0x32')]);_0x31b1d6[_0x1ffe('0x31')]=qs[_0x1ffe('0x31')](_0x439ff8[_0x1ffe('0x47')][_0x1ffe('0x31')]);}return _0xea93e6[_0x1ffe('0x6d')](_0x31b1d6);}})['then'](function(_0x26af72){if(_0x26af72){return _0x26af72?{'count':_0x3e233c,'rows':_0x26af72}:null;}})['then'](respondWithResult(_0x30f2b1,null))['catch'](handleError(_0x30f2b1,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 95833e5..3feb4c0 100644 --- a/server/api/chatGroup/chatGroup.events.js +++ b/server/api/chatGroup/chatGroup.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['exports','../../mysqldb','ChatGroup','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x2032,0xd9));var _0x2203=function(_0x49405a,_0x5b238d){_0x49405a=_0x49405a-0x0;var _0x326380=_0x2032[_0x49405a];return _0x326380;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x2203('0x0'))['db'][_0x2203('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x2203('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2203('0x3'),'afterDestroy':_0x2203('0x4')};function emitEvent(_0x4b4c7f){return function(_0x46c49a,_0x880dcd,_0x44ccfd){ChatGroupEvents[_0x2203('0x5')](_0x4b4c7f+':'+_0x46c49a['id'],_0x46c49a);ChatGroupEvents[_0x2203('0x5')](_0x4b4c7f,_0x46c49a);_0x44ccfd(null);};}for(var e in events){if(events[_0x2203('0x6')](e)){var event=events[e];ChatGroup[_0x2203('0x7')](e,emitEvent(event));}}module[_0x2203('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0x2ef3=['setMaxListeners','save','update','emit','hook','exports','events','../../mysqldb','ChatGroup'];(function(_0x23c2c3,_0x27ecc8){var _0x41e09f=function(_0x5e6873){while(--_0x5e6873){_0x23c2c3['push'](_0x23c2c3['shift']());}};_0x41e09f(++_0x27ecc8);}(_0x2ef3,0xba));var _0x32ef=function(_0x5ab036,_0x1a39ce){_0x5ab036=_0x5ab036-0x0;var _0x52555c=_0x2ef3[_0x5ab036];return _0x52555c;};'use strict';var EventEmitter=require(_0x32ef('0x0'));var ChatGroup=require(_0x32ef('0x1'))['db'][_0x32ef('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x32ef('0x3')](0x0);var events={'afterCreate':_0x32ef('0x4'),'afterUpdate':_0x32ef('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38f865){return function(_0x38b7f3,_0x524ab6,_0x402857){ChatGroupEvents[_0x32ef('0x6')](_0x38f865+':'+_0x38b7f3['id'],_0x38b7f3);ChatGroupEvents['emit'](_0x38f865,_0x38b7f3);_0x402857(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x32ef('0x7')](e,emitEvent(event));}}module[_0x32ef('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 6bf2fc9..edf5638 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 _0x3379=['exports','ChatGroup','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./chatGroup.attributes'];(function(_0x3ebcf5,_0x2888e6){var _0x516214=function(_0x295256){while(--_0x295256){_0x3ebcf5['push'](_0x3ebcf5['shift']());}};_0x516214(++_0x2888e6);}(_0x3379,0x115));var _0x9337=function(_0x20f8dc,_0x20b2e6){_0x20f8dc=_0x20f8dc-0x0;var _0x597902=_0x3379[_0x20f8dc];return _0x597902;};'use strict';var _=require(_0x9337('0x0'));var util=require(_0x9337('0x1'));var logger=require(_0x9337('0x2'))(_0x9337('0x3'));var moment=require('moment');var BPromise=require(_0x9337('0x4'));var rp=require(_0x9337('0x5'));var fs=require('fs');var path=require(_0x9337('0x6'));var rimraf=require(_0x9337('0x7'));var config=require('../../config/environment');var attributes=require(_0x9337('0x8'));module[_0x9337('0x9')]=function(_0x390772,_0x677c38){return _0x390772['define'](_0x9337('0xa'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd1f9=['./chatGroup.attributes','define','ChatGroup','chat_groups','../../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);}(_0xd1f9,0x88));var _0x9d1f=function(_0x35825e,_0x657421){_0x35825e=_0x35825e-0x0;var _0x4f4d90=_0xd1f9[_0x35825e];return _0x4f4d90;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9d1f('0x0'))(_0x9d1f('0x1'));var moment=require(_0x9d1f('0x2'));var BPromise=require(_0x9d1f('0x3'));var rp=require(_0x9d1f('0x4'));var fs=require('fs');var path=require(_0x9d1f('0x5'));var rimraf=require(_0x9d1f('0x6'));var config=require(_0x9d1f('0x7'));var attributes=require(_0x9d1f('0x8'));module['exports']=function(_0x3c4bad,_0x1a72d8){return _0x3c4bad[_0x9d1f('0x9')](_0x9d1f('0xa'),attributes,{'tableName':_0x9d1f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 601e8dc..d689214 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 _0xf974=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./chatGroup.socket','register','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x172c68,_0x18c24e){var _0x1e002d=function(_0x3a0bb5){while(--_0x3a0bb5){_0x172c68['push'](_0x172c68['shift']());}};_0x1e002d(++_0x18c24e);}(_0xf974,0xe4));var _0x4f97=function(_0x1477c9,_0x280ad1){_0x1477c9=_0x1477c9-0x0;var _0x44e973=_0xf974[_0x1477c9];return _0x44e973;};'use strict';var _=require(_0x4f97('0x0'));var util=require(_0x4f97('0x1'));var moment=require(_0x4f97('0x2'));var BPromise=require(_0x4f97('0x3'));var rs=require(_0x4f97('0x4'));var fs=require('fs');var Redis=require(_0x4f97('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4f97('0x6'));var logger=require('../../config/logger')(_0x4f97('0x7'));var config=require(_0x4f97('0x8'));var jayson=require(_0x4f97('0x9'));var client=jayson[_0x4f97('0xa')][_0x4f97('0xb')]({'port':0x232a});config['redis']=_[_0x4f97('0xc')](config[_0x4f97('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x4f97('0xe'))(new Redis(config[_0x4f97('0xd')]));require(_0x4f97('0xf'))[_0x4f97('0x10')](socket);function respondWithRpcPromise(_0x52ccdb,_0x11ce11,_0x1a5b7e){return new BPromise(function(_0x37ab9d,_0x52132f){return client['request'](_0x52ccdb,_0x1a5b7e)[_0x4f97('0x11')](function(_0x3168bf){logger[_0x4f97('0x12')](_0x4f97('0x13'),_0x11ce11,_0x4f97('0x14'));logger[_0x4f97('0x15')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x11ce11,'request\x20sent',JSON['stringify'](_0x3168bf));if(_0x3168bf['error']){if(_0x3168bf[_0x4f97('0x16')][_0x4f97('0x17')]===0x1f4){logger[_0x4f97('0x16')](_0x4f97('0x13'),_0x11ce11,_0x3168bf['error'][_0x4f97('0x18')]);return _0x52132f(_0x3168bf[_0x4f97('0x16')][_0x4f97('0x18')]);}logger['error'](_0x4f97('0x13'),_0x11ce11,_0x3168bf['error'][_0x4f97('0x18')]);return _0x37ab9d(_0x3168bf['error']['message']);}else{logger['info'](_0x4f97('0x13'),_0x11ce11,_0x4f97('0x14'));_0x37ab9d(_0x3168bf['result']['message']);}})[_0x4f97('0x19')](function(_0x2369c8){logger[_0x4f97('0x16')](_0x4f97('0x13'),_0x11ce11,_0x2369c8);_0x52132f(_0x2369c8);});});} \ No newline at end of file +var _0x9b18=['redis','defaults','localhost','./chatGroup.socket','register','request','info','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x49cd43,_0x43b2a1){var _0x172e50=function(_0x1170ca){while(--_0x1170ca){_0x49cd43['push'](_0x49cd43['shift']());}};_0x172e50(++_0x43b2a1);}(_0x9b18,0x13c));var _0x89b1=function(_0xbb14db,_0x3ee8c6){_0xbb14db=_0xbb14db-0x0;var _0x36bed7=_0x9b18[_0xbb14db];return _0x36bed7;};'use strict';var _=require(_0x89b1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x89b1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x89b1('0x2'));var db=require(_0x89b1('0x3'))['db'];var utils=require(_0x89b1('0x4'));var logger=require(_0x89b1('0x5'))('rpc');var config=require(_0x89b1('0x6'));var jayson=require(_0x89b1('0x7'));var client=jayson['client'][_0x89b1('0x8')]({'port':0x232a});config[_0x89b1('0x9')]=_[_0x89b1('0xa')](config[_0x89b1('0x9')],{'host':_0x89b1('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x89b1('0x9')]));require(_0x89b1('0xc'))[_0x89b1('0xd')](socket);function respondWithRpcPromise(_0x31be37,_0x1e8fa1,_0x332470){return new BPromise(function(_0xac8c28,_0x313365){return client[_0x89b1('0xe')](_0x31be37,_0x332470)['then'](function(_0x218b01){logger[_0x89b1('0xf')](_0x89b1('0x10'),_0x1e8fa1,'request\x20sent');logger[_0x89b1('0x11')](_0x89b1('0x12'),_0x1e8fa1,'request\x20sent',JSON[_0x89b1('0x13')](_0x218b01));if(_0x218b01[_0x89b1('0x14')]){if(_0x218b01[_0x89b1('0x14')][_0x89b1('0x15')]===0x1f4){logger[_0x89b1('0x14')]('ChatGroup,\x20%s,\x20%s',_0x1e8fa1,_0x218b01[_0x89b1('0x14')][_0x89b1('0x16')]);return _0x313365(_0x218b01[_0x89b1('0x14')][_0x89b1('0x16')]);}logger[_0x89b1('0x14')](_0x89b1('0x10'),_0x1e8fa1,_0x218b01['error'][_0x89b1('0x16')]);return _0xac8c28(_0x218b01[_0x89b1('0x14')][_0x89b1('0x16')]);}else{logger[_0x89b1('0xf')]('ChatGroup,\x20%s,\x20%s',_0x1e8fa1,'request\x20sent');_0xac8c28(_0x218b01[_0x89b1('0x17')][_0x89b1('0x16')]);}})[_0x89b1('0x18')](function(_0x51ae62){logger[_0x89b1('0x14')](_0x89b1('0x10'),_0x1e8fa1,_0x51ae62);_0x313365(_0x51ae62);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 391bb1d..79d1971 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 _0x7479=['register','chatGroup:','./chatGroup.events','save','remove','update','removeListener'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x7479,0x18a));var _0x9747=function(_0x4b3409,_0x5169d6){_0x4b3409=_0x4b3409-0x0;var _0x558200=_0x7479[_0x4b3409];return _0x558200;};'use strict';var ChatGroupEvents=require(_0x9747('0x0'));var events=[_0x9747('0x1'),_0x9747('0x2'),_0x9747('0x3')];function createListener(_0x50ac09,_0x3f6ea0){return function(_0x4749d1){_0x3f6ea0['emit'](_0x50ac09,_0x4749d1);};}function removeListener(_0x5be184,_0x2f10eb){return function(){ChatGroupEvents[_0x9747('0x4')](_0x5be184,_0x2f10eb);};}exports[_0x9747('0x5')]=function(_0x1f8942){for(var _0x19e410=0x0,_0x572bdb=events['length'];_0x19e410<_0x572bdb;_0x19e410++){var _0x2a4c1b=events[_0x19e410];var _0x2673ea=createListener(_0x9747('0x6')+_0x2a4c1b,_0x1f8942);ChatGroupEvents['on'](_0x2a4c1b,_0x2673ea);}}; \ No newline at end of file +var _0xd466=['update','removeListener','register','length','chatGroup:','./chatGroup.events','save','remove'];(function(_0x26a7d1,_0x20d6b2){var _0xb55047=function(_0x3d280b){while(--_0x3d280b){_0x26a7d1['push'](_0x26a7d1['shift']());}};_0xb55047(++_0x20d6b2);}(_0xd466,0x1dd));var _0x6d46=function(_0x16bfb0,_0x572237){_0x16bfb0=_0x16bfb0-0x0;var _0x1bd329=_0xd466[_0x16bfb0];return _0x1bd329;};'use strict';var ChatGroupEvents=require(_0x6d46('0x0'));var events=[_0x6d46('0x1'),_0x6d46('0x2'),_0x6d46('0x3')];function createListener(_0x215f4d,_0x5a1dd6){return function(_0x5557c7){_0x5a1dd6['emit'](_0x215f4d,_0x5557c7);};}function removeListener(_0x2cccef,_0x59e604){return function(){ChatGroupEvents[_0x6d46('0x4')](_0x2cccef,_0x59e604);};}exports[_0x6d46('0x5')]=function(_0x47387b){for(var _0x4c162e=0x0,_0x36f786=events[_0x6d46('0x6')];_0x4c162e<_0x36f786;_0x4c162e++){var _0x4cc29e=events[_0x4c162e];var _0x3909da=createListener(_0x6d46('0x7')+_0x4cc29e,_0x47387b);ChatGroupEvents['on'](_0x4cc29e,_0x3909da);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 8cb5597..6c14e0a 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 _0xc2dc=['show','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','addMessage','put','update','delete','destroy','removeMembers','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','isAuthenticated','get','/:id'];(function(_0x3fdc4c,_0x42ec50){var _0x206e98=function(_0x57404f){while(--_0x57404f){_0x3fdc4c['push'](_0x3fdc4c['shift']());}};_0x206e98(++_0x42ec50);}(_0xc2dc,0xf0));var _0xcc2d=function(_0x7fd9e9,_0x1765d0){_0x7fd9e9=_0x7fd9e9-0x0;var _0x285d92=_0xc2dc[_0x7fd9e9];return _0x285d92;};'use strict';var multer=require(_0xcc2d('0x0'));var util=require('util');var path=require(_0xcc2d('0x1'));var timeout=require(_0xcc2d('0x2'));var express=require(_0xcc2d('0x3'));var router=express[_0xcc2d('0x4')]();var auth=require(_0xcc2d('0x5'));var interaction=require(_0xcc2d('0x6'));var config=require(_0xcc2d('0x7'));var controller=require(_0xcc2d('0x8'));router['get']('/',auth[_0xcc2d('0x9')](),controller['index']);router[_0xcc2d('0xa')]('/describe',auth[_0xcc2d('0x9')](),controller['describe']);router[_0xcc2d('0xa')](_0xcc2d('0xb'),auth[_0xcc2d('0x9')](),controller[_0xcc2d('0xc')]);router[_0xcc2d('0xa')]('/:id/unread',auth[_0xcc2d('0x9')](),controller[_0xcc2d('0xd')]);router[_0xcc2d('0xa')](_0xcc2d('0xe'),auth['isAuthenticated'](),controller[_0xcc2d('0xf')]);router['get'](_0xcc2d('0x10'),auth[_0xcc2d('0x9')](),controller[_0xcc2d('0x11')]);router[_0xcc2d('0x12')]('/',auth[_0xcc2d('0x9')](),controller[_0xcc2d('0x13')]);router[_0xcc2d('0x12')](_0xcc2d('0xe'),auth[_0xcc2d('0x9')](),controller[_0xcc2d('0x14')]);router[_0xcc2d('0x12')](_0xcc2d('0x10'),auth[_0xcc2d('0x9')](),controller[_0xcc2d('0x15')]);router[_0xcc2d('0x16')](_0xcc2d('0xb'),auth['isAuthenticated'](),controller[_0xcc2d('0x17')]);router[_0xcc2d('0x18')](_0xcc2d('0xb'),auth[_0xcc2d('0x9')](),controller[_0xcc2d('0x19')]);router[_0xcc2d('0x18')](_0xcc2d('0xe'),auth[_0xcc2d('0x9')](),controller[_0xcc2d('0x1a')]);module[_0xcc2d('0x1b')]=router; \ No newline at end of file +var _0xac64=['create','addMessage','put','update','delete','destroy','removeMembers','exports','multer','util','path','connect-timeout','express','../../config/environment','./chatGroup.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post'];(function(_0x5b4e46,_0xe6008d){var _0x5a229f=function(_0x13e01a){while(--_0x13e01a){_0x5b4e46['push'](_0x5b4e46['shift']());}};_0x5a229f(++_0xe6008d);}(_0xac64,0x1c8));var _0x4ac6=function(_0x25c1a5,_0x599dc9){_0x25c1a5=_0x25c1a5-0x0;var _0x3abc0a=_0xac64[_0x25c1a5];return _0x3abc0a;};'use strict';var multer=require(_0x4ac6('0x0'));var util=require(_0x4ac6('0x1'));var path=require(_0x4ac6('0x2'));var timeout=require(_0x4ac6('0x3'));var express=require(_0x4ac6('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4ac6('0x5'));var controller=require(_0x4ac6('0x6'));router[_0x4ac6('0x7')]('/',auth[_0x4ac6('0x8')](),controller['index']);router[_0x4ac6('0x7')](_0x4ac6('0x9'),auth[_0x4ac6('0x8')](),controller[_0x4ac6('0xa')]);router[_0x4ac6('0x7')](_0x4ac6('0xb'),auth[_0x4ac6('0x8')](),controller[_0x4ac6('0xc')]);router['get'](_0x4ac6('0xd'),auth[_0x4ac6('0x8')](),controller[_0x4ac6('0xe')]);router[_0x4ac6('0x7')](_0x4ac6('0xf'),auth[_0x4ac6('0x8')](),controller[_0x4ac6('0x10')]);router[_0x4ac6('0x7')](_0x4ac6('0x11'),auth['isAuthenticated'](),controller[_0x4ac6('0x12')]);router[_0x4ac6('0x13')]('/',auth['isAuthenticated'](),controller[_0x4ac6('0x14')]);router['post'](_0x4ac6('0xf'),auth['isAuthenticated'](),controller['addMembers']);router[_0x4ac6('0x13')](_0x4ac6('0x11'),auth[_0x4ac6('0x8')](),controller[_0x4ac6('0x15')]);router[_0x4ac6('0x16')]('/:id',auth[_0x4ac6('0x8')](),controller[_0x4ac6('0x17')]);router[_0x4ac6('0x18')]('/:id',auth[_0x4ac6('0x8')](),controller[_0x4ac6('0x19')]);router[_0x4ac6('0x18')](_0x4ac6('0xf'),auth['isAuthenticated'](),controller[_0x4ac6('0x1a')]);module[_0x4ac6('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 8acbdf7..4dba36e 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 _0x3f2e=['TEXT','STRING','DATE','long','sequelize','BOOLEAN','INTEGER','ENUM','thumb','star'];(function(_0xfbf2d3,_0xb18179){var _0x5587aa=function(_0x2cc58b){while(--_0x2cc58b){_0xfbf2d3['push'](_0xfbf2d3['shift']());}};_0x5587aa(++_0xb18179);}(_0x3f2e,0x1da));var _0xe3f2=function(_0x3d118a,_0xc2c0d7){_0x3d118a=_0x3d118a-0x0;var _0xbdfbf3=_0x3f2e[_0x3d118a];return _0xbdfbf3;};'use strict';var Sequelize=require(_0xe3f2('0x0'));module['exports']={'closed':{'type':Sequelize[_0xe3f2('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xe3f2('0x2')]},'ratingType':{'type':Sequelize[_0xe3f2('0x3')]('star',_0xe3f2('0x4')),'defaultValue':_0xe3f2('0x5')},'ratingMessage':{'type':Sequelize[_0xe3f2('0x6')]},'pathTranscript':{'type':Sequelize[_0xe3f2('0x6')]},'mailTranscript':{'type':Sequelize[_0xe3f2('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xe3f2('0x8')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xe3f2('0x7')]},'browserName':{'type':Sequelize[_0xe3f2('0x7')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0xe3f2('0x7')]},'osVersion':{'type':Sequelize[_0xe3f2('0x7')]},'deviceModel':{'type':Sequelize[_0xe3f2('0x7')]},'deviceVendor':{'type':Sequelize[_0xe3f2('0x7')]},'deviceType':{'type':Sequelize[_0xe3f2('0x7')]},'referer':{'type':Sequelize[_0xe3f2('0x6')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xe3f2('0x6')](_0xe3f2('0x9'))},'read1stAt':{'type':Sequelize[_0xe3f2('0x8')]},'lastMsgAt':{'type':Sequelize[_0xe3f2('0x8')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xe3f2('0x7')]},'customerPort':{'type':Sequelize[_0xe3f2('0x7')]}}; \ No newline at end of file +var _0x66aa=['ENUM','star','thumb','TEXT','STRING','DATE','long','out','sequelize','exports','BOOLEAN','INTEGER'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x66aa,0xbc));var _0xa66a=function(_0x550465,_0x180361){_0x550465=_0x550465-0x0;var _0xc71cb6=_0x66aa[_0x550465];return _0xc71cb6;};'use strict';var Sequelize=require(_0xa66a('0x0'));module[_0xa66a('0x1')]={'closed':{'type':Sequelize[_0xa66a('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xa66a('0x3')]},'ratingType':{'type':Sequelize[_0xa66a('0x4')](_0xa66a('0x5'),_0xa66a('0x6')),'defaultValue':_0xa66a('0x5')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0xa66a('0x7')]},'mailTranscript':{'type':Sequelize[_0xa66a('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xa66a('0x9')]},'disposition':{'type':Sequelize[_0xa66a('0x8')]},'note':{'type':Sequelize[_0xa66a('0x8')]},'browserName':{'type':Sequelize[_0xa66a('0x8')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0xa66a('0x8')]},'osVersion':{'type':Sequelize[_0xa66a('0x8')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0xa66a('0x8')]},'deviceType':{'type':Sequelize[_0xa66a('0x8')]},'referer':{'type':Sequelize[_0xa66a('0x7')]},'customerIp':{'type':Sequelize[_0xa66a('0x8')]},'formData':{'type':Sequelize[_0xa66a('0x7')](_0xa66a('0xa'))},'read1stAt':{'type':Sequelize[_0xa66a('0x9')]},'lastMsgAt':{'type':Sequelize[_0xa66a('0x9')]},'lastMsgDirection':{'type':Sequelize[_0xa66a('0x4')]('in',_0xa66a('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xa66a('0x8')]},'customerPort':{'type':Sequelize[_0xa66a('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 8ae0a28..b465524 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 _0x4b19=['entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','originalname','basename','filename','file','mimetype','attachmentDownload','findOne','Unauthorized','Attachment','attachId','join','root','server/files/attachments/','close','mailTranscript','server/files/chat/upload/','transcript-%s.txt','now','pathTranscript','ChatMessage','Messages','ChatWebsite','agentAlias','System','customer','format','%s%d','Visitor','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','MailAccount','MailServerOut','Smtp','service','port','secure','authentication','SendMail','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','omit','getMessages','sort','ChatInteractionId','includeAll','findAll','getMyMessages','includeAgent','addTags','setTags','ids','Tag','emit','removeTags','download','unix','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','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','%s\x20#%d','Chat','YYYY-MM-DD','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','browserName','customerIp','tail','existsSync','createReadStream','pipe','out','Contact','server','views','downloadInteraction.html','toFile','transcript-','.pdf','log','unlinkSync','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','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','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','name','Users','map','fullname','TagIds','Tags','split','push','catch','index','ChatInteraction','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','select','field','color','tools_tags','u.id','u.fullname','ui.ChatInteractionId','from','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','$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','buildExpression','text','start','forEach','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','keys','some','compact','isEmpty','i.ChatWebsiteId\x20IN\x20?','createdAt','$gte','parse','$lte','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','resolve','ChatWebsiteId','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','all','rows','params','include','options','create','describe','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x5d695b,_0x3f9907){var _0x2fdda7=function(_0x1f93ac){while(--_0x1f93ac){_0x5d695b['push'](_0x5d695b['shift']());}};_0x2fdda7(++_0x3f9907);}(_0x4b19,0x195));var _0x94b1=function(_0x27526e,_0x3f2c11){_0x27526e=_0x27526e-0x0;var _0x1db58f=_0x4b19[_0x27526e];return _0x1db58f;};'use strict';var pdf=require(_0x94b1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x94b1('0x1'));var zipdir=require(_0x94b1('0x2'));var jsonpatch=require(_0x94b1('0x3'));var rp=require('request-promise');var moment=require(_0x94b1('0x4'));var BPromise=require(_0x94b1('0x5'));var Mustache=require(_0x94b1('0x6'));var util=require('util');var path=require(_0x94b1('0x7'));var sox=require(_0x94b1('0x8'));var csv=require('to-csv');var ejs=require(_0x94b1('0x9'));var fs=require('fs');var _=require(_0x94b1('0xa'));var squel=require('squel');var crypto=require(_0x94b1('0xb'));var jsforce=require(_0x94b1('0xc'));var deskjs=require(_0x94b1('0xd'));var toCsv=require('to-csv');var querystring=require(_0x94b1('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x94b1('0xf'));var qs=require(_0x94b1('0x10'));var as=require(_0x94b1('0x11'));var hardwareService=require(_0x94b1('0x12'));var logger=require(_0x94b1('0x13'))(_0x94b1('0x14'));var utils=require('../../config/utils');var config=require(_0x94b1('0x15'));var db=require(_0x94b1('0x16'))['db'];config[_0x94b1('0x17')]=_[_0x94b1('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x94b1('0x19'))(new Redis(config[_0x94b1('0x17')]));require('./chatInteraction.socket')['register'](socket);var jayson=require(_0x94b1('0x1a'));var client=jayson[_0x94b1('0x1b')]['http']({'port':0x232b});var client9004=jayson[_0x94b1('0x1b')]['http']({'port':0x232c});function checkPasswordPattern(_0x4ea6a4,_0x192c03,_0x1f0560){if(_0x1f0560){var _0x258e98=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x258e98[_0x94b1('0x1c')](_0x192c03)){return _0x4ea6a4;}else{throw new db['Sequelize'][(_0x94b1('0x1d'))](_0x94b1('0x1e'));}}else{return _0x4ea6a4;}}function respondWithRpcPromise(_0xa29b90,_0x224099,_0x3a6ae0,_0x1abb7f){return new BPromise(function(_0x2d33dc,_0x59d7cf){var _0x30f969=_0x1abb7f||client;return _0x30f969[_0x94b1('0x1f')](_0xa29b90,_0x3a6ae0)[_0x94b1('0x20')](function(_0x5deb20){logger[_0x94b1('0x21')](_0x94b1('0x22'),_0x224099,'request\x20sent');logger[_0x94b1('0x23')](_0x94b1('0x24'),_0x224099,_0x94b1('0x25'),JSON[_0x94b1('0x26')](_0x5deb20));if(_0x5deb20[_0x94b1('0x27')]){if(_0x5deb20[_0x94b1('0x27')][_0x94b1('0x28')]===0x1f4){logger[_0x94b1('0x27')](_0x94b1('0x22'),_0x224099,_0x5deb20[_0x94b1('0x27')]['message']);return _0x59d7cf(_0x5deb20[_0x94b1('0x27')][_0x94b1('0x29')]);}logger[_0x94b1('0x27')]('ChatInteraction,\x20%s,\x20%s',_0x224099,_0x5deb20[_0x94b1('0x27')]['message']);return _0x2d33dc(_0x5deb20[_0x94b1('0x27')][_0x94b1('0x29')]);}else{logger[_0x94b1('0x21')](_0x94b1('0x22'),_0x224099,'request\x20sent');_0x2d33dc(_0x5deb20['result'][_0x94b1('0x29')]);}})['catch'](function(_0x1aa525){logger['error'](_0x94b1('0x22'),_0x224099,_0x1aa525);_0x59d7cf(_0x1aa525);});});}function respondWithStatusCode(_0x2f06b1,_0x1eda8c){_0x1eda8c=_0x1eda8c||0xcc;return function(_0x4c2732){if(_0x4c2732){return _0x2f06b1[_0x94b1('0x2a')](_0x1eda8c);}return _0x2f06b1[_0x94b1('0x2b')](_0x1eda8c)[_0x94b1('0x2c')]();};}function respondWithResult(_0x319618,_0xd86145){_0xd86145=_0xd86145||0xc8;return function(_0x43b67c){if(_0x43b67c){return _0x319618[_0x94b1('0x2b')](_0xd86145)[_0x94b1('0x2d')](_0x43b67c);}};}function respondWithFilteredResult(_0x1e79e2,_0x597af3){return function(_0x2eb1fa){if(_0x2eb1fa){var _0xf621ea=_0x2eb1fa[_0x94b1('0x2e')],_0x47f019=_0x597af3[_0x94b1('0x2f')],_0x42630a=_0x597af3[_0x94b1('0x2f')]+_0x597af3[_0x94b1('0x30')],_0x1fe766;if(_0x42630a>=_0xf621ea){_0x42630a=_0xf621ea;_0x1fe766=0xc8;}else{_0x1fe766=0xce;}_0x1e79e2['status'](_0x1fe766);return _0x1e79e2[_0x94b1('0x31')]('Content-Range',_0x47f019+'-'+_0x42630a+'/'+_0xf621ea)[_0x94b1('0x2d')](_0x2eb1fa);}return null;};}function patchUpdates(_0x51d67c){return function(_0x57e497){try{jsonpatch[_0x94b1('0x32')](_0x57e497,_0x51d67c,!![]);}catch(_0x171d44){return BPromise[_0x94b1('0x33')](_0x171d44);}return _0x57e497[_0x94b1('0x34')]();};}function saveUpdates(_0x35b97c,_0x195514){return function(_0x26f33d){if(_0x26f33d){return _0x26f33d[_0x94b1('0x35')](_0x35b97c)[_0x94b1('0x20')](function(_0x18de6f){return _0x18de6f;});}return null;};}function removeEntity(_0x3cd875,_0xaff15e){return function(_0x500772){if(_0x500772){return _0x500772['destroy']()[_0x94b1('0x20')](function(){_0x3cd875[_0x94b1('0x2b')](0xcc)[_0x94b1('0x2c')]();});}};}function handleEntityNotFound(_0x2f5e6c,_0x2c7e43){return function(_0x2ba486){if(!_0x2ba486){_0x2f5e6c[_0x94b1('0x2a')](0x194);}return _0x2ba486;};}function handleError(_0x36a2f8,_0x4285dd){_0x4285dd=_0x4285dd||0x1f4;return function(_0x586eaa){logger[_0x94b1('0x27')](_0x586eaa['stack']);if(_0x586eaa[_0x94b1('0x36')]){delete _0x586eaa[_0x94b1('0x36')];}_0x36a2f8[_0x94b1('0x2b')](_0x4285dd)['send'](_0x586eaa);};}function getInteractionUsers(_0x357798,_0x21dd65){return new BPromise(function(_0x27c9e4,_0x5628eb){try{if(_0x21dd65[_0x357798['id']]){_0x357798[_0x94b1('0x37')]=_[_0x94b1('0x38')](_0x21dd65[_0x357798['id']],function(_0x1d4168){return{'id':_0x1d4168['id'],'fullname':_0x1d4168[_0x94b1('0x39')]};});}}catch(_0x3e5b02){_0x5628eb(_0x3e5b02);}_0x27c9e4(_0x357798);});}function getInteractionTags(_0x2e6fb9,_0x292964){return new BPromise(function(_0x127e6c,_0x737da9){try{if(_0x2e6fb9[_0x94b1('0x3a')]){_0x2e6fb9[_0x94b1('0x3b')]=[];_0x2e6fb9[_0x94b1('0x3a')][_0x94b1('0x3c')](',')['forEach'](function(_0x34b148){_0x2e6fb9[_0x94b1('0x3b')][_0x94b1('0x3d')](_0x292964[_0x34b148]);});}delete _0x2e6fb9[_0x94b1('0x3a')];}catch(_0x2e6d0f){_0x737da9(_0x2e6d0f);}_0x127e6c(_0x2e6fb9);});}function updateChatInteraction(_0x5c05c6,_0xc6732a,_0x158d1a){return new BPromise(function(_0x186575,_0x300747){return getInteractionUsers(_0x5c05c6,_0x158d1a)[_0x94b1('0x20')](function(_0x2c9398){return getInteractionTags(_0x2c9398,_0xc6732a);})['then'](function(_0x439323){_0x186575(_0x439323);})[_0x94b1('0x3e')](function(_0x592daa){_0x300747(_0x592daa);});});}exports[_0x94b1('0x3f')]=function(_0x19d4e4,_0x59311b){var _0x2c7359={},_0x442157={},_0x287bac={'count':0x0,'rows':[]};var _0x4b5068=_[_0x94b1('0x38')](db[_0x94b1('0x40')][_0x94b1('0x41')],function(_0xeb94e4){return{'name':_0xeb94e4[_0x94b1('0x42')],'type':_0xeb94e4[_0x94b1('0x43')][_0x94b1('0x44')]};});_0x442157['model']=_[_0x94b1('0x38')](_0x4b5068,_0x94b1('0x36'));_0x442157[_0x94b1('0x45')]=_['keys'](_0x19d4e4[_0x94b1('0x45')]);_0x442157[_0x94b1('0x46')]=_['intersection'](_0x442157[_0x94b1('0x47')],_0x442157[_0x94b1('0x45')]);_0x2c7359[_0x94b1('0x48')]=_[_0x94b1('0x49')](_0x442157[_0x94b1('0x47')],qs[_0x94b1('0x4a')](_0x19d4e4[_0x94b1('0x45')][_0x94b1('0x4a')]));_0x2c7359[_0x94b1('0x48')]=_0x2c7359[_0x94b1('0x48')][_0x94b1('0x4b')]?_0x2c7359[_0x94b1('0x48')]:_0x442157[_0x94b1('0x47')];if(!_0x19d4e4[_0x94b1('0x45')][_0x94b1('0x4c')](_0x94b1('0x4d'))){_0x2c7359[_0x94b1('0x30')]=qs[_0x94b1('0x30')](_0x19d4e4[_0x94b1('0x45')]['limit']);_0x2c7359[_0x94b1('0x2f')]=qs['offset'](_0x19d4e4[_0x94b1('0x45')][_0x94b1('0x2f')]);}_0x2c7359[_0x94b1('0x4e')]=qs['sort'](_0x19d4e4['query']['sort']);_0x2c7359[_0x94b1('0x4f')]=qs[_0x94b1('0x46')](_[_0x94b1('0x50')](_0x19d4e4['query'],_0x442157['filters']));var _0x4d2af3=[];var _0x227f50=squel[_0x94b1('0x51')]()[_0x94b1('0x52')]('id')[_0x94b1('0x52')](_0x94b1('0x36'))[_0x94b1('0x52')](_0x94b1('0x53'))['from'](_0x94b1('0x54'));var _0x1986af=squel[_0x94b1('0x51')]()[_0x94b1('0x52')](_0x94b1('0x55'))[_0x94b1('0x52')](_0x94b1('0x56'))[_0x94b1('0x52')](_0x94b1('0x57'))[_0x94b1('0x58')](_0x94b1('0x59'),'ui')[_0x94b1('0x5a')](_0x94b1('0x5b'),'u',_0x94b1('0x5c'));var _0x4c968d=squel[_0x94b1('0x51')]()[_0x94b1('0x58')](_0x94b1('0x5d'),'i')[_0x94b1('0x5a')](_0x94b1('0x5e'),'c',_0x94b1('0x5f'))[_0x94b1('0x5a')](_0x94b1('0x5b'),'o',_0x94b1('0x60'))['left_join'](_0x94b1('0x61'),'a',_0x94b1('0x62'))[_0x94b1('0x5a')](_0x94b1('0x63'),'me',_0x94b1('0x64'))[_0x94b1('0x5a')]('chat_interaction_has_tags','it',_0x94b1('0x65'))[_0x94b1('0x5a')](_0x94b1('0x54'),'t',_0x94b1('0x66'));var _0x240581=squel[_0x94b1('0x67')]();var _0x2d985e=[];var _0x15b80c=squel[_0x94b1('0x67')]();var _0x502d2c;if(_0x19d4e4['query'][_0x94b1('0x68')]){_0x502d2c=as[_0x94b1('0x69')](_0x19d4e4[_0x94b1('0x45')][_0x94b1('0x68')]);var _0x21caaa=_0x502d2c[_0x94b1('0x6a')];for(var _0x152a22=0x0;_0x152a22<_0x502d2c[_0x94b1('0x6b')][_0x94b1('0x4b')];_0x152a22++){var _0x65157d=_0x502d2c[_0x94b1('0x6b')][_0x152a22];var _0xacf1f4='i';var _0x4d22ac=_['find'](_0x4b5068,[_0x94b1('0x36'),_0x65157d[_0x94b1('0x52')]]);if(!_0x4d22ac){switch(_0x65157d[_0x94b1('0x52')]){case _0x94b1('0x6c'):if(_0x65157d[_0x94b1('0x6d')]==0x1){_0x4c968d['having']('`'+_0x65157d[_0x94b1('0x52')]+_0x94b1('0x6e'));}else{_0x4c968d[_0x94b1('0x6f')]('`'+_0x65157d[_0x94b1('0x52')]+_0x94b1('0x70'));}break;case'Contact':if(_0x65157d['operator']===_0x94b1('0x71')){if(_0x65157d[_0x94b1('0x6d')][_0x94b1('0x3c')]('\x20')['length']>0x1){_0x240581[_0x21caaa](_0x94b1('0x72'),qs[_0x94b1('0x73')](_0x65157d['value']),null);}else{var _0x5ee8a5='%'+_0x65157d[_0x94b1('0x6d')]+'%';_0x240581[_0x21caaa](_0x94b1('0x74'),_0x5ee8a5,_0x5ee8a5,_0x5ee8a5);}}else{_0x4d22ac=_[_0x94b1('0x75')](_0x4b5068,[_0x94b1('0x36'),_0x94b1('0x76')]);_0x65157d[_0x94b1('0x52')]=_0x94b1('0x76');_0x6b2878=as[_0x94b1('0x77')](_0xacf1f4,_0x4d22ac['type'],_0x65157d);_0x240581[_0x21caaa](_0x6b2878[_0x94b1('0x78')],_0x6b2878['value'][_0x94b1('0x79')],_0x6b2878[_0x94b1('0x6d')][_0x94b1('0x2c')]);}break;case'Tag':var _0x1b70b2=_0x65157d['value'][_0x94b1('0x3c')](',')[_0x94b1('0x38')](function(_0x137a37){return Number(_0x137a37);});_0x1b70b2[_0x94b1('0x7a')](function(_0x331682){_0x15b80c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x331682+',%');});_0x2d985e=_['union'](_0x2d985e,_0x1b70b2);break;case _0x94b1('0x7b'):if(_0x65157d[_0x94b1('0x7c')]===_0x94b1('0x71')){_0x240581[_0x21caaa](_0x94b1('0x7d'),'%'+_0x65157d[_0x94b1('0x6d')]+'%',null);}else{_0x4d22ac=_[_0x94b1('0x75')](_0x4b5068,[_0x94b1('0x36'),_0x94b1('0x7e')]);_0x65157d['field']='UserId';_0x6b2878=as[_0x94b1('0x77')](_0xacf1f4,_0x4d22ac['type'],_0x65157d);_0x240581[_0x21caaa](_0x6b2878[_0x94b1('0x78')],_0x6b2878['value'][_0x94b1('0x79')],_0x6b2878[_0x94b1('0x6d')][_0x94b1('0x2c')]);}break;case _0x94b1('0x7f'):_0x6b2878=as[_0x94b1('0x77')]('me',null,_0x65157d);_0x240581[_0x21caaa](_0x6b2878[_0x94b1('0x78')],_0x6b2878['value'][_0x94b1('0x79')],_0x6b2878[_0x94b1('0x6d')][_0x94b1('0x2c')]);break;}}else{var _0x6b2878=as[_0x94b1('0x77')](_0xacf1f4,_0x4d22ac[_0x94b1('0x43')],_0x65157d);_0x240581[_0x21caaa](_0x6b2878[_0x94b1('0x78')],_0x6b2878['value'][_0x94b1('0x79')],_0x6b2878[_0x94b1('0x6d')][_0x94b1('0x2c')]);}}}else{var _0xd40396=_(_0x19d4e4[_0x94b1('0x45')])[_0x94b1('0x80')]()[_0x94b1('0x38')](function(_0x4b5cf7){return _[_0x94b1('0x81')](_0x4b5068,['name',_0x4b5cf7])?_0x4b5cf7:undefined;})[_0x94b1('0x82')]()[_0x94b1('0x6d')]();if(!_[_0x94b1('0x83')](_0xd40396)){_0xd40396[_0x94b1('0x7a')](function(_0x47bc66){if(_0x47bc66==='ChatWebsiteId'){_0x4c968d[_0x94b1('0x4f')](_0x94b1('0x84'),[]['concat'](_0x19d4e4[_0x94b1('0x45')][_0x47bc66]));}else if(_0x47bc66===_0x94b1('0x85')){var _0xc57189=JSON['parse'](_0x19d4e4[_0x94b1('0x45')][_0x47bc66])[_0x94b1('0x86')];var _0x40874c=JSON[_0x94b1('0x87')](_0x19d4e4['query'][_0x47bc66])[_0x94b1('0x88')];_0x4c968d['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0xc57189,_0x40874c);}else{if(_0x19d4e4['query'][_0x47bc66]===_0x94b1('0x89')){_0x4c968d[_0x94b1('0x4f')]('i.'+_0x47bc66+_0x94b1('0x8a'));}else{_0x4c968d['where']('i.'+_0x47bc66+'\x20=\x20?',_0x19d4e4['query'][_0x47bc66]);}}});}if(_0x19d4e4[_0x94b1('0x45')][_0x94b1('0x8b')]){if(_0x19d4e4['query']['read']==0x1){_0x4c968d['having'](_0x94b1('0x8c'));}else{_0x4c968d[_0x94b1('0x6f')](_0x94b1('0x8d'));}}if(_0x19d4e4[_0x94b1('0x45')]['tag']){_0x2d985e=_['isArray'](_0x19d4e4[_0x94b1('0x45')][_0x94b1('0x8e')])?_0x19d4e4[_0x94b1('0x45')][_0x94b1('0x8e')]:new Array(_0x19d4e4['query']['tag']);_0x2d985e['forEach'](function(_0x355543){_0x15b80c['or'](_0x94b1('0x8f'),'%,'+_0x355543+',%');});}if(_0x19d4e4[_0x94b1('0x45')][_0x94b1('0x90')]){var _0xa4dfd1=_0x19d4e4['query'][_0x94b1('0x90')][_0x94b1('0x91')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x94b1('0x92'));if(qs['isNumeric'](_0xa4dfd1)){_0x240581['or']('i.id\x20LIKE\x20?',_0xa4dfd1+'%');}else{_0x240581['or'](_0x94b1('0x93'),qs['getFullTextValue'](_0xa4dfd1))['or'](_0x94b1('0x94'),_0xa4dfd1+'%');}}}_0x4c968d[_0x94b1('0x4f')](_0x240581);_0x4c968d[_0x94b1('0x95')](_0x94b1('0x96'));var _0x219b5d={'type':db['Sequelize'][_0x94b1('0x97')]['SELECT'],'raw':!![]};var _0x101517=_0x4c968d[_0x94b1('0x98')]();_0x101517[_0x94b1('0x52')]('i.id');_0x101517[_0x94b1('0x52')](_0x94b1('0x99'),'unreadMessages');if(_0x2c7359['order']){_0x2c7359[_0x94b1('0x4e')][_0x94b1('0x7a')](function(_0x2a0d93){_0x4c968d[_0x94b1('0x4e')]('i.'+_0x2a0d93[0x0],_0x2a0d93[0x1]==='DESC'?![]:!![]);});}if(!_[_0x94b1('0x83')](_0x2d985e)){_0x4c968d['having'](_0x15b80c);_0x101517[_0x94b1('0x4f')]('t.id\x20IN\x20?',_0x2d985e);}BPromise[_0x94b1('0x9a')]()['then'](function(){if(!_0x502d2c){if(_0x19d4e4['query'][_0x94b1('0x9b')]||_0x19d4e4[_0x94b1('0x45')]['journey'])return;_0x101517[_0x94b1('0x4f')](_0x94b1('0x9c'));_0x4c968d[_0x94b1('0x4f')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}return _0x19d4e4[_0x94b1('0x9d')][_0x94b1('0x9e')]({'attributes':['id'],'raw':!![]})[_0x94b1('0x20')](function(_0x5d722e){if(_[_0x94b1('0x83')](_0x5d722e)){_0x101517['where']('i.ChatWebsiteId\x20IS\x20NULL');_0x4c968d[_0x94b1('0x4f')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x101517[_0x94b1('0x4f')]('i.ChatWebsiteId\x20IN\x20?',_[_0x94b1('0x38')](_0x5d722e,'id'));_0x4c968d['where'](_0x94b1('0x84'),_['map'](_0x5d722e,'id'));}});})[_0x94b1('0x20')](function(){db[_0x94b1('0x9f')][_0x94b1('0x45')](_0x101517[_0x94b1('0xa0')](),_0x219b5d)[_0x94b1('0x20')](function(_0xd11449){_0x287bac['count']=_0xd11449[_0x94b1('0x4b')];if(_0x287bac[_0x94b1('0x2e')]===0x0)return[];return db[_0x94b1('0x9f')][_0x94b1('0x45')](_0x227f50[_0x94b1('0xa0')](),_0x219b5d)[_0x94b1('0x20')](function(_0x5093d8){_0x4d2af3=_[_0x94b1('0xa1')](_0x5093d8,'id');_0x219b5d=_[_0x94b1('0xa2')](_0x219b5d,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x19d4e4[_0x94b1('0x45')][_0x94b1('0x4a')]){_0x2c7359[_0x94b1('0x48')][_0x94b1('0x7a')](function(_0x2d3c76){_0x4c968d[_0x94b1('0x52')]('i.'+_0x2d3c76);});}else{_0x4c968d[_0x94b1('0x52')](_0x94b1('0x99'),_0x94b1('0x6c'));_0x4c968d[_0x94b1('0x52')](_0x94b1('0xa3'),_0x94b1('0xa4'));_0x4c968d[_0x94b1('0x52')](_0x94b1('0xa5'),_0x94b1('0xa6'));_0x4c968d[_0x94b1('0x52')](_0x94b1('0xa7'));_0x4c968d[_0x94b1('0x52')](_0x94b1('0xa8'),_0x94b1('0xa9'));_0x4c968d[_0x94b1('0x52')](_0x94b1('0xaa'),_0x94b1('0xab'));_0x4c968d[_0x94b1('0x52')](_0x94b1('0xac'),_0x94b1('0xad'));_0x4c968d[_0x94b1('0x52')](_0x94b1('0xae'),_0x94b1('0xaf'));_0x4c968d[_0x94b1('0x52')](_0x94b1('0xb0'),_0x94b1('0xb1'));_0x4c968d['field'](_0x94b1('0xb2'),_0x94b1('0xb3'));_0x4c968d['field']('o.fullname',_0x94b1('0xb4'));_0x4c968d['field'](_0x94b1('0xb5'),'Owner.internal');_0x4c968d[_0x94b1('0x52')](_0x94b1('0xb6'),_0x94b1('0x3a'));}_0x4c968d['limit'](_0x2c7359['limit']);_0x4c968d[_0x94b1('0x2f')](_0x2c7359[_0x94b1('0x2f')]);return db[_0x94b1('0x9f')][_0x94b1('0x45')](_0x4c968d[_0x94b1('0xa0')](),_0x219b5d);})[_0x94b1('0x20')](function(_0x2ddfa6){_0x1986af['where'](_0x94b1('0xb7'),_[_0x94b1('0x38')](_0x2ddfa6,'id'));return db[_0x94b1('0x9f')][_0x94b1('0x45')](_0x1986af[_0x94b1('0xa0')](),_0x219b5d)[_0x94b1('0x20')](function(_0x516659){var _0x27267f=_[_0x94b1('0xb8')](_0x516659,'ChatInteractionId');var _0x22e08e=[];_0x2ddfa6[_0x94b1('0x7a')](function(_0x5ab0af){_0x22e08e[_0x94b1('0x3d')](updateChatInteraction(_0x5ab0af,_0x4d2af3,_0x27267f));});return BPromise[_0x94b1('0xb9')](_0x22e08e);});});})[_0x94b1('0x20')](function(_0x568ad6){_0x287bac[_0x94b1('0xba')]=_0x568ad6;return _0x287bac;})[_0x94b1('0x20')](respondWithFilteredResult(_0x59311b,_0x2c7359));})['catch'](handleError(_0x59311b,null));};exports['show']=function(_0x438cdb,_0x3d1e1e){var _0x26c84a={'raw':![],'where':{'id':_0x438cdb[_0x94b1('0xbb')]['id']}},_0x4e44c4={};_0x4e44c4[_0x94b1('0x47')]=_[_0x94b1('0x80')](db[_0x94b1('0x40')][_0x94b1('0x41')]);_0x4e44c4[_0x94b1('0x45')]=_['keys'](_0x438cdb[_0x94b1('0x45')]);_0x4e44c4[_0x94b1('0x46')]=_[_0x94b1('0x49')](_0x4e44c4[_0x94b1('0x47')],_0x4e44c4[_0x94b1('0x45')]);_0x26c84a['attributes']=_[_0x94b1('0x49')](_0x4e44c4['model'],qs['fields'](_0x438cdb[_0x94b1('0x45')][_0x94b1('0x4a')]));_0x26c84a[_0x94b1('0x48')]=_0x26c84a[_0x94b1('0x48')]['length']?_0x26c84a[_0x94b1('0x48')]:_0x4e44c4[_0x94b1('0x47')];if(_0x438cdb[_0x94b1('0x45')]['includeAll']){_0x26c84a[_0x94b1('0xbc')]=[{'all':!![]}];}_0x26c84a=_[_0x94b1('0xa2')]({},_0x26c84a,_0x438cdb[_0x94b1('0xbd')]);return db['ChatInteraction'][_0x94b1('0x75')](_0x26c84a)[_0x94b1('0x20')](handleEntityNotFound(_0x3d1e1e,null))['then'](respondWithResult(_0x3d1e1e,null))[_0x94b1('0x3e')](handleError(_0x3d1e1e,null));};exports[_0x94b1('0xbe')]=function(_0x13c0c3,_0x3923c5){return db[_0x94b1('0x40')]['create'](_0x13c0c3['body'],{})['then'](respondWithResult(_0x3923c5,0xc9))[_0x94b1('0x3e')](handleError(_0x3923c5,null));};exports[_0x94b1('0x35')]=function(_0x22202e,_0x5a4eb6){if(_0x22202e[_0x94b1('0x7f')]['id']){delete _0x22202e[_0x94b1('0x7f')]['id'];}return db[_0x94b1('0x40')][_0x94b1('0x75')]({'where':{'id':_0x22202e[_0x94b1('0xbb')]['id']}})[_0x94b1('0x20')](handleEntityNotFound(_0x5a4eb6,null))[_0x94b1('0x20')](saveUpdates(_0x22202e[_0x94b1('0x7f')],null))[_0x94b1('0x20')](respondWithResult(_0x5a4eb6,null))[_0x94b1('0x3e')](handleError(_0x5a4eb6,null));};exports['destroy']=function(_0x2254c6,_0x23f144){return db[_0x94b1('0x40')][_0x94b1('0x75')]({'where':{'id':_0x2254c6[_0x94b1('0xbb')]['id']}})[_0x94b1('0x20')](handleEntityNotFound(_0x23f144,null))[_0x94b1('0x20')](removeEntity(_0x23f144,null))[_0x94b1('0x3e')](handleError(_0x23f144,null));};exports[_0x94b1('0xbf')]=function(_0x4b6ae3,_0x5bd532){return db['ChatInteraction'][_0x94b1('0xbf')]()[_0x94b1('0x20')](respondWithResult(_0x5bd532,null))[_0x94b1('0x3e')](handleError(_0x5bd532,null));};exports[_0x94b1('0xc0')]=function(_0x51b24c,_0x1057de){if(_0x51b24c[_0x94b1('0x7f')]['id']){delete _0x51b24c[_0x94b1('0x7f')]['id'];}return db[_0x94b1('0x40')][_0x94b1('0x75')]({'where':{'id':_0x51b24c[_0x94b1('0xbb')]['id']}})['then'](handleEntityNotFound(_0x1057de,null))['then'](saveUpdates(_0x51b24c['body'],null))['then'](respondWithResult(_0x1057de,null))[_0x94b1('0x3e')](handleError(_0x1057de,null));};exports[_0x94b1('0xc1')]=function(_0x213bcd,_0x45ad88,_0x193aec){if(_0x213bcd[_0x94b1('0x7f')]['id']){delete _0x213bcd[_0x94b1('0x7f')]['id'];}return db[_0x94b1('0x40')]['find']({'where':{'id':_0x213bcd[_0x94b1('0xbb')]['id']}})[_0x94b1('0x20')](function(_0x175436){if(!_0x175436){logger['error'](_0x94b1('0xc2'),_0x94b1('0xc1'),0x194,_0x94b1('0xc3'));_0x45ad88[_0x94b1('0x2a')](0x194);}else{if(_0x175436[_0x94b1('0x7e')]){throw new db['Sequelize'][(_0x94b1('0x1d'))](_0x94b1('0xc4'));}}return _0x175436;})[_0x94b1('0x20')](function(_0x2f4211){if(_0x2f4211){return _0x2f4211[_0x94b1('0x35')]({'closed':_0x213bcd[_0x94b1('0x7f')][_0x94b1('0xc5')],'disposition':_0x213bcd[_0x94b1('0x7f')][_0x94b1('0xc6')]})[_0x94b1('0x20')](function(_0x51a3be){return _0x51a3be;});}})['then'](function(_0x848cf8){return respondWithRpcPromise(_0x94b1('0xc7'),_0x94b1('0xc1'),_0x213bcd[_0x94b1('0x7f')],client9004);})[_0x94b1('0x20')](respondWithResult(_0x45ad88,null))[_0x94b1('0x3e')](handleError(_0x45ad88,null));};exports['attachmentUpload']=function(_0x448480,_0x4dd54c,_0xafaac){_0x448480['body'][_0x94b1('0x36')]=_0x448480['file'][_0x94b1('0xc8')];_0x448480[_0x94b1('0x7f')][_0x94b1('0xc9')]=_0x448480['file'][_0x94b1('0xca')];_0x448480[_0x94b1('0x7f')][_0x94b1('0x43')]=_0x448480[_0x94b1('0xcb')][_0x94b1('0xcc')];return db['Attachment']['create'](_0x448480[_0x94b1('0x7f')])[_0x94b1('0x20')](respondWithResult(_0x4dd54c,0xc9))[_0x94b1('0x3e')](handleError(_0x4dd54c,null));};exports[_0x94b1('0xcd')]=function(_0x408933,_0x540d60,_0x5eead5){return db[_0x94b1('0x40')][_0x94b1('0xce')]({'where':{'id':_0x408933[_0x94b1('0xbb')]['id']},'raw':!![]})[_0x94b1('0x20')](handleEntityNotFound(_0x540d60,null))['then'](function(_0x560ca0){if(_0x560ca0){if(_0x560ca0[_0x94b1('0xc5')]){return _0x540d60[_0x94b1('0x2b')](0x193)['json']({'status':0x193,'message':_0x94b1('0xcf')});}return db[_0x94b1('0xd0')][_0x94b1('0xce')]({'where':{'id':_0x408933[_0x94b1('0x45')][_0x94b1('0xd1')]},'raw':!![]})['then'](handleEntityNotFound(_0x540d60,null));}})[_0x94b1('0x20')](function(_0x5e4296){if(_0x5e4296){return _0x540d60['download'](path[_0x94b1('0xd2')](config[_0x94b1('0xd3')],_0x94b1('0xd4'),_0x5e4296[_0x94b1('0xc9')]));}})[_0x94b1('0x3e')](handleError(_0x540d60,null));};exports[_0x94b1('0xd5')]=function(_0x4195a2,_0x3925f6){var _0x1bb516=null;var _0x4742f8=null;var _0x13a409=null;var _0x547c8a=null;if(_0x4195a2[_0x94b1('0x7f')]['id']){delete _0x4195a2['body']['id'];}if(_0x4195a2[_0x94b1('0x7f')][_0x94b1('0xd6')]){_0x547c8a=path[_0x94b1('0xd2')](config[_0x94b1('0xd3')],_0x94b1('0xd7'),util['format'](_0x94b1('0xd8'),Date[_0x94b1('0xd9')]()));_0x4195a2[_0x94b1('0x7f')][_0x94b1('0xda')]=_0x547c8a;}return db['ChatInteraction']['find']({'where':{'id':_0x4195a2[_0x94b1('0xbb')]['id']},'include':[{'model':db[_0x94b1('0xdb')],'as':_0x94b1('0xdc'),'include':[{'model':db['User'],'as':_0x94b1('0x7b')}]}]})[_0x94b1('0x20')](handleEntityNotFound(_0x3925f6,null))[_0x94b1('0x20')](saveUpdates(_0x4195a2[_0x94b1('0x7f')],null))[_0x94b1('0x20')](function(_0x2f495d){if(_0x2f495d){_0x1bb516=_0x2f495d;return db[_0x94b1('0xdd')][_0x94b1('0x75')]({'where':{'id':_0x1bb516[_0x94b1('0x9b')]}});}})['then'](function(_0x1a9d61){if(_0x1a9d61){_0x13a409=_0x1a9d61;return db['CmContact'][_0x94b1('0x75')]({'where':{'id':_0x1bb516['ContactId']}});}})[_0x94b1('0x20')](function(_0x1edb79){if(_0x1edb79){_0x4742f8=_0x1edb79;if(_0x547c8a){var _0x216789=null;for(var _0x452429=0x1;_0x452429<_0x1bb516[_0x94b1('0xdc')][_0x94b1('0x4b')];++_0x452429){_0x216789=_0x1bb516[_0x94b1('0xdc')][_0x452429];var _0x2d5543=_0x216789['UserId']?util['format']('%s%d',_0x13a409[_0x94b1('0xde')],_0x216789[_0x94b1('0x7e')]):_0x94b1('0xdf');var _0x4bae16=_0x4195a2[_0x94b1('0x7f')][_0x94b1('0xe0')]||util[_0x94b1('0xe1')](_0x94b1('0xe2'),_0x94b1('0xe3'),_0x216789['ContactId']);switch(_0x13a409[_0x94b1('0xe4')]){case _0x94b1('0xe5'):_0x2d5543=_0x216789[_0x94b1('0x7e')]?util[_0x94b1('0xe1')](_0x94b1('0xe2'),_0x13a409[_0x94b1('0xde')],_0x216789[_0x94b1('0x7e')]):_0x94b1('0xdf');break;case _0x94b1('0xe6'):_0x2d5543=_0x216789[_0x94b1('0x7e')]?_0x216789[_0x94b1('0x7b')][_0x94b1('0xe7')]||_0x216789[_0x94b1('0x7b')][_0x94b1('0x39')]:'System';break;case _0x94b1('0xe8'):_0x2d5543=_0x216789[_0x94b1('0x7e')]?_0x216789[_0x94b1('0x7b')][_0x94b1('0x39')]:_0x94b1('0xdf');break;default:_0x2d5543=_0x216789[_0x94b1('0x7e')]?util[_0x94b1('0xe1')](_0x94b1('0xe2'),_0x13a409[_0x94b1('0xde')],_0x216789[_0x94b1('0x7e')]):_0x94b1('0xdf');}var _0x4ebe4b=util[_0x94b1('0xe1')](_0x94b1('0xe9'),moment(_0x216789[_0x94b1('0x85')])['format'](_0x94b1('0xea')),_0x216789[_0x94b1('0xeb')]==='in'?_0x4bae16:_0x2d5543,_0x216789[_0x94b1('0x7f')]);if(!_0x216789[_0x94b1('0xec')]){fs['appendFileSync'](_0x547c8a,_0x4ebe4b);}}return db[_0x94b1('0xed')][_0x94b1('0xce')]({'where':{'service':!![]},'include':[{'model':db[_0x94b1('0xee')],'as':'Smtp','raw':!![]}]});}}})[_0x94b1('0x20')](function(_0x509f1a){if(_0x509f1a&&_0x509f1a[_0x94b1('0xef')]&&_0x4195a2[_0x94b1('0x7f')]){var _0x30522d={'tls':{'rejectUnauthorized':![]}};if(_0x509f1a[_0x94b1('0xef')][_0x94b1('0xf0')]){_0x30522d['service']=_0x509f1a[_0x94b1('0xef')][_0x94b1('0xf0')];}else{_0x30522d['host']=_0x509f1a[_0x94b1('0xef')]['host'];_0x30522d[_0x94b1('0xf1')]=_0x509f1a[_0x94b1('0xef')][_0x94b1('0xf1')];_0x30522d[_0x94b1('0xf2')]=_0x509f1a[_0x94b1('0xef')][_0x94b1('0xf2')];}if(_0x509f1a[_0x94b1('0xef')][_0x94b1('0xf3')]){_0x30522d['auth']={'user':_0x509f1a['Smtp'][_0x94b1('0x9d')],'pass':_0x509f1a[_0x94b1('0xef')]['pass']};}return respondWithRpcPromise(_0x94b1('0xf4'),'sendMail',{'account':_0x30522d,'message':{'from':util[_0x94b1('0xe1')]('\x22%s\x22\x20<%s>',_0x509f1a['name'],_0x509f1a['email']||_0x509f1a['Smtp'][_0x94b1('0x9d')]),'to':_0x4195a2['body'][_0x94b1('0xd6')],'subject':_0x94b1('0xf5'),'text':util[_0x94b1('0xe1')](_0x94b1('0xf6'),_0x4195a2['body'][_0x94b1('0xd6')]),'attachments':[{'path':_0x547c8a}]}})[_0x94b1('0x20')](function(){return _0x1bb516;})[_0x94b1('0x3e')](function(_0x112eab){console[_0x94b1('0x27')](_0x112eab);});}else{return _0x1bb516;}})['then'](respondWithStatusCode(_0x3925f6,0xc8))[_0x94b1('0x3e')](handleError(_0x3925f6,null));};exports['addMessage']=function(_0x2f4baf,_0x20830a,_0x221c40){return db[_0x94b1('0xdb')]['find']({'where':{'id':_0x2f4baf['params']['id']}})[_0x94b1('0x20')](handleEntityNotFound(_0x20830a,null))['then'](function(_0x460d4e){if(_0x460d4e){return _0x460d4e[_0x94b1('0xf7')](_0x2f4baf[_0x94b1('0x7f')]['ids'],_[_0x94b1('0xf8')](_0x2f4baf[_0x94b1('0x7f')],['ids','id'])||{});}})['then'](respondWithResult(_0x20830a,null))[_0x94b1('0x3e')](handleError(_0x20830a,null));};exports[_0x94b1('0xf9')]=function(_0x562b18,_0xd822e7,_0x35f198){var _0x2f2f21={'raw':![],'where':{}};var _0x23e4b3={};var _0x1a7888={'count':0x0,'rows':[]};return db[_0x94b1('0x40')][_0x94b1('0xce')]({'where':{'id':_0x562b18[_0x94b1('0xbb')]['id']}})[_0x94b1('0x20')](handleEntityNotFound(_0xd822e7,null))[_0x94b1('0x20')](function(_0x2dcf42){if(_0x2dcf42){_0x23e4b3[_0x94b1('0x47')]=_['keys'](db[_0x94b1('0xdb')]['rawAttributes']);_0x23e4b3[_0x94b1('0x45')]=_[_0x94b1('0x80')](_0x562b18[_0x94b1('0x45')]);_0x23e4b3[_0x94b1('0x46')]=_['intersection'](_0x23e4b3[_0x94b1('0x47')],_0x23e4b3[_0x94b1('0x45')]);_0x2f2f21['attributes']=_[_0x94b1('0x49')](_0x23e4b3[_0x94b1('0x47')],qs['fields'](_0x562b18[_0x94b1('0x45')]['fields']));_0x2f2f21[_0x94b1('0x48')]=_0x2f2f21['attributes'][_0x94b1('0x4b')]?_0x2f2f21[_0x94b1('0x48')]:_0x23e4b3[_0x94b1('0x47')];if(!_0x562b18[_0x94b1('0x45')][_0x94b1('0x4c')](_0x94b1('0x4d'))){_0x2f2f21['limit']=qs[_0x94b1('0x30')](_0x562b18[_0x94b1('0x45')]['limit']);_0x2f2f21[_0x94b1('0x2f')]=qs[_0x94b1('0x2f')](_0x562b18[_0x94b1('0x45')][_0x94b1('0x2f')]);}_0x2f2f21[_0x94b1('0x4e')]=qs[_0x94b1('0xfa')](_0x562b18[_0x94b1('0x45')][_0x94b1('0xfa')]);_0x2f2f21[_0x94b1('0x4f')]=qs[_0x94b1('0x46')](_[_0x94b1('0x50')](_0x562b18[_0x94b1('0x45')],_0x23e4b3[_0x94b1('0x46')]));_0x2f2f21[_0x94b1('0x4f')][_0x94b1('0xfb')]=_0x2dcf42['id'];if(_0x562b18['query'][_0x94b1('0x90')]){_0x2f2f21[_0x94b1('0x4f')]=_[_0x94b1('0xa2')](_0x2f2f21[_0x94b1('0x4f')],{'$or':_[_0x94b1('0x38')](_0x2f2f21[_0x94b1('0x48')],function(_0x3c847f){var _0x2af531={};_0x2af531[_0x3c847f]={'$like':'%'+_0x562b18['query'][_0x94b1('0x90')]+'%'};return _0x2af531;})});}if(_0x562b18[_0x94b1('0x45')][_0x94b1('0x86')]){var _0x206c71=_0x562b18[_0x94b1('0x45')][_0x94b1('0x86')][_0x94b1('0x3c')](',');var _0x51a884={};_0x51a884[_0x206c71[0x0]]={'$gte':moment(_0x206c71[0x1])[_0x94b1('0xe1')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2f2f21[_0x94b1('0x4f')]=_['merge'](_0x2f2f21[_0x94b1('0x4f')],_0x51a884);}_0x2f2f21=_['merge']({},_0x2f2f21,_0x562b18['options']);return db[_0x94b1('0xdb')][_0x94b1('0x2e')]({'where':_0x2f2f21[_0x94b1('0x4f')]})[_0x94b1('0x20')](function(_0x40d853){_0x1a7888['count']=_0x40d853;if(_0x562b18[_0x94b1('0x45')][_0x94b1('0xfc')]){_0x2f2f21[_0x94b1('0xbc')]=[{'all':!![]}];}return db['ChatMessage'][_0x94b1('0xfd')](_0x2f2f21);})[_0x94b1('0x20')](function(_0x146dfc){_0x1a7888[_0x94b1('0xba')]=_0x146dfc;return _0x1a7888;});}})[_0x94b1('0x20')](respondWithFilteredResult(_0xd822e7,_0x2f2f21))[_0x94b1('0x3e')](handleError(_0xd822e7,null));};exports[_0x94b1('0xfe')]=function(_0x4ad7db,_0x285419,_0x1375e1){var _0x1f9bd1={'where':{}},_0x32d816={},_0x187582={'count':0x0,'rows':[]};return db[_0x94b1('0x40')][_0x94b1('0xce')]({'where':{'id':_0x4ad7db[_0x94b1('0xbb')]['id']}})['then'](handleEntityNotFound(_0x285419,null))[_0x94b1('0x20')](function(_0x5ddecc){if(_0x5ddecc){_0x32d816[_0x94b1('0x47')]=_[_0x94b1('0x80')](db[_0x94b1('0xdb')][_0x94b1('0x41')]);_0x32d816[_0x94b1('0x45')]=_[_0x94b1('0x80')](_0x4ad7db[_0x94b1('0x45')]);_0x32d816['filters']=_[_0x94b1('0x49')](_0x32d816[_0x94b1('0x47')],_0x32d816['query']);_0x1f9bd1[_0x94b1('0x48')]=_[_0x94b1('0x49')](_0x32d816[_0x94b1('0x47')],qs[_0x94b1('0x4a')](_0x4ad7db[_0x94b1('0x45')][_0x94b1('0x4a')]));_0x1f9bd1['attributes']=_0x1f9bd1[_0x94b1('0x48')][_0x94b1('0x4b')]?_0x1f9bd1['attributes']:_0x32d816[_0x94b1('0x47')];if(!_0x4ad7db[_0x94b1('0x45')][_0x94b1('0x4c')](_0x94b1('0x4d'))){_0x1f9bd1[_0x94b1('0x30')]=qs['limit'](_0x4ad7db['query'][_0x94b1('0x30')]);_0x1f9bd1['offset']=qs[_0x94b1('0x2f')](_0x4ad7db[_0x94b1('0x45')][_0x94b1('0x2f')]);}_0x1f9bd1[_0x94b1('0x4e')]=qs[_0x94b1('0xfa')](_0x4ad7db['query'][_0x94b1('0xfa')]);_0x1f9bd1[_0x94b1('0x4f')]=qs['filters'](_[_0x94b1('0x50')](_0x4ad7db['query'],_0x32d816[_0x94b1('0x46')]));_0x1f9bd1['where']['ChatInteractionId']=_0x5ddecc['id'];if(_0x4ad7db[_0x94b1('0x45')][_0x94b1('0x90')]){_0x1f9bd1[_0x94b1('0x4f')]=_[_0x94b1('0xa2')](_0x1f9bd1[_0x94b1('0x4f')],{'$or':_[_0x94b1('0x38')](_0x1f9bd1[_0x94b1('0x48')],function(_0x578013){var _0x3243db={};_0x3243db[_0x578013]={'$like':'%'+_0x4ad7db['query'][_0x94b1('0x90')]+'%'};return _0x3243db;})});}_0x1f9bd1[_0x94b1('0x4f')]['secret']=![];if(_0x4ad7db[_0x94b1('0x45')]['id']){_0x1f9bd1[_0x94b1('0x4f')]['id']={'$gt':_0x4ad7db[_0x94b1('0x45')]['id']};}_0x1f9bd1=_[_0x94b1('0xa2')]({},_0x1f9bd1,_0x4ad7db[_0x94b1('0xbd')]);return db[_0x94b1('0xdb')][_0x94b1('0x2e')]({'where':_0x1f9bd1['where']})[_0x94b1('0x20')](function(_0x659a05){_0x187582[_0x94b1('0x2e')]=_0x659a05;_0x1f9bd1[_0x94b1('0xbc')]=[];if(_0x4ad7db[_0x94b1('0x45')][_0x94b1('0xff')]){_0x1f9bd1['include'][_0x94b1('0x3d')]({'model':db[_0x94b1('0x7b')],'as':_0x94b1('0x7b'),'attributes':['id',_0x94b1('0x39'),'alias']});}if(_0x4ad7db['query'][_0x94b1('0xfc')]){_0x1f9bd1[_0x94b1('0xbc')]=[{'all':!![]}];}return db['ChatMessage'][_0x94b1('0xfd')](_0x1f9bd1);})[_0x94b1('0x20')](function(_0x23fb6e){_0x187582[_0x94b1('0xba')]=_0x23fb6e;return _0x187582;});}})[_0x94b1('0x20')](respondWithFilteredResult(_0x285419,_0x1f9bd1))[_0x94b1('0x3e')](handleError(_0x285419,null));};exports[_0x94b1('0x100')]=function(_0x268e4f,_0x4484cb,_0x17e886){return db[_0x94b1('0x40')][_0x94b1('0x75')]({'where':{'id':_0x268e4f[_0x94b1('0xbb')]['id']}})[_0x94b1('0x20')](handleEntityNotFound(_0x4484cb,null))[_0x94b1('0x20')](function(_0x4e5905){if(_0x4e5905){return _0x4e5905[_0x94b1('0x101')](_0x268e4f[_0x94b1('0x7f')][_0x94b1('0x102')],_['omit'](_0x268e4f[_0x94b1('0x7f')],[_0x94b1('0x102'),'id'])||{})['spread'](function(){return db[_0x94b1('0x103')]['findAll']({'attributes':['id','name',_0x94b1('0x53')],'where':{'id':_0x268e4f[_0x94b1('0x7f')][_0x94b1('0x102')]}});})[_0x94b1('0x20')](function(_0x5c7caa){socket[_0x94b1('0x104')]('chatInteractionTags:save',{'id':Number(_0x268e4f[_0x94b1('0xbb')]['id']),'tags':_0x5c7caa||[]});return{'id':Number(_0x268e4f['params']['id']),'tags':_0x5c7caa||[]};});}})['then'](respondWithResult(_0x4484cb,null))['catch'](handleError(_0x4484cb,null));};exports[_0x94b1('0x105')]=function(_0x27baab,_0x23ab4a,_0x5b16f8){return db[_0x94b1('0x40')][_0x94b1('0x75')]({'where':{'id':_0x27baab[_0x94b1('0xbb')]['id']}})[_0x94b1('0x20')](handleEntityNotFound(_0x23ab4a,null))[_0x94b1('0x20')](function(_0x223fd1){if(_0x223fd1){return _0x223fd1[_0x94b1('0x105')](_0x27baab[_0x94b1('0x45')]['ids']);}})[_0x94b1('0x20')](respondWithStatusCode(_0x23ab4a,null))['catch'](handleError(_0x23ab4a,null));};exports[_0x94b1('0x106')]=function(_0xbe4ab5,_0x10d28f){var _0x400b07=moment()[_0x94b1('0x107')]()[_0x94b1('0xa0')]();var _0x2e1cbe=path[_0x94b1('0xd2')](config[_0x94b1('0xd3')],'server',_0x94b1('0x108'),_0x94b1('0x109'));var _0x4beaa8=path[_0x94b1('0xd2')](config[_0x94b1('0xd3')],'server',_0x94b1('0x108'),_0x94b1('0x10a'));var _0x36b436=path[_0x94b1('0xd2')](_0x2e1cbe,_0x400b07);var _0x1f0de4=util[_0x94b1('0xe1')](_0x94b1('0x10b'),_0xbe4ab5[_0x94b1('0xbb')]['id'],_0x400b07);var _0x16136d=path[_0x94b1('0xd2')](_0x2e1cbe,_0x1f0de4);var _0x25a28b=[];_0x25a28b[_0x94b1('0x3d')]({'model':db[_0x94b1('0x7b')],'as':'User','attributes':['id',_0x94b1('0x39')],'raw':!![]});_0x25a28b[_0x94b1('0x3d')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x94b1('0x10c'),_0x94b1('0x10d')],'raw':!![]});if(_0xbe4ab5[_0x94b1('0x45')][_0x94b1('0x10a')]){_0x25a28b[_0x94b1('0x3d')]({'model':db[_0x94b1('0xd0')],'as':'Attachment','raw':!![]});}var _0x3dd722=[{'model':db['ChatMessage'],'as':_0x94b1('0xdc'),'attributes':['id',_0x94b1('0x7f'),_0x94b1('0x85'),'direction',_0x94b1('0xec'),_0x94b1('0x8b')],'include':_0x25a28b}];_0x3dd722['push']({'model':db[_0x94b1('0xdd')],'as':_0x94b1('0x10e'),'attributes':['id',_0x94b1('0x36')]});_0x3dd722[_0x94b1('0x3d')]({'model':db[_0x94b1('0x7b')],'as':_0x94b1('0x10f'),'attributes':['id',_0x94b1('0x39')]});return db['ChatInteraction'][_0x94b1('0x75')]({'where':{'id':_0xbe4ab5['params']['id']},'include':_0x3dd722})[_0x94b1('0x20')](handleEntityNotFound(_0x10d28f,null))['then'](function(_0x2d4863){if(_0x2d4863){var _0x527204=_0x2d4863[_0x94b1('0x110')]({'plain':!![]});fs[_0x94b1('0x111')](_0x36b436);var _0x252c8f={'format':'A4','border':_0x94b1('0x112'),'header':{'height':_0x94b1('0x113'),'contents':{'first':_0x94b1('0x114')}},'footer':{'height':_0x94b1('0x115'),'contents':{'default':util[_0x94b1('0xe1')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\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[_0x94b1('0xe1')](_0x94b1('0x116'),_0x94b1('0x117'),_0x527204['id']),moment()['format'](_0x94b1('0x118'))[_0x94b1('0xa0')]())}}};var _0x1046b8={'channel':_0x94b1('0x117'),'account':_0x527204[_0x94b1('0x10e')][_0x94b1('0x36')],'agent':_0x527204[_0x94b1('0x10f')]?_0x527204['Owner']['fullname']:_0x94b1('0x119'),'createdAt':moment(_0x527204[_0x94b1('0x85')])[_0x94b1('0xe1')](_0x94b1('0x11a'))[_0x94b1('0xa0')](),'closedAt':_0x527204[_0x94b1('0xc5')]?moment(_0x527204[_0x94b1('0x11b')])[_0x94b1('0xe1')](_0x94b1('0x11a'))[_0x94b1('0xa0')]():'','disposition':_0x527204[_0x94b1('0xc6')],'chatInfo':{'browser':_0x527204[_0x94b1('0x11c')],'os':_0x527204['osName'],'referer':_0x527204['referer'],'customerIp':_0x527204[_0x94b1('0x11d')],'customerPort':_0x527204['customerPort']?_0x527204['customerPort']:_0x94b1('0x119')},'messages':_(_0x527204[_0x94b1('0xdc')])[_0x94b1('0x11e')]()[_0x94b1('0x90')]({'secret':![]})[_0x94b1('0x38')](function(_0x1bed17){if(_0x1bed17[_0x94b1('0xd0')]){var _0x136ac3=path[_0x94b1('0xd2')](_0x4beaa8,_0x1bed17['Attachment']['basename']);if(fs[_0x94b1('0x11f')](_0x136ac3)){fs[_0x94b1('0x120')](_0x136ac3)[_0x94b1('0x121')](fs['createWriteStream'](path[_0x94b1('0xd2')](_0x36b436,_0x1bed17['Attachment'][_0x94b1('0xc9')])));}}return{'date':moment(_0x1bed17[_0x94b1('0x85')])['format'](_0x94b1('0x11a'))['toString'](),'sender':_0x1bed17[_0x94b1('0xeb')]===_0x94b1('0x122')?_0x1bed17[_0x94b1('0x7b')]?_0x1bed17[_0x94b1('0x7b')][_0x94b1('0x39')]:_0x94b1('0xdf'):_0x1bed17[_0x94b1('0x123')][_0x94b1('0x10c')]+(_0x1bed17['Contact']['lastName']?'\x20'+_0x1bed17[_0x94b1('0x123')][_0x94b1('0x10d')]:''),'body':_0x1bed17[_0x94b1('0xd0')]?_0x1bed17[_0x94b1('0xd0')][_0x94b1('0xc9')]:_0x1bed17[_0x94b1('0x7f')],'direction':_0x1bed17[_0x94b1('0xeb')]==='out'?'A':'C','secret':_0x1bed17['secret'],'read':_0x1bed17[_0x94b1('0x8b')],'attachment':_0x1bed17['Attachment']};})['value']()};return ejs['renderFile'](path[_0x94b1('0xd2')](config[_0x94b1('0xd3')],_0x94b1('0x124'),_0x94b1('0x125'),_0x94b1('0x126')),{'interaction':_0x1046b8})['then'](function(_0x42fdec){return new BPromise(function(_0x49e927,_0x4fa504){pdf['create'](_0x42fdec,_0x252c8f)[_0x94b1('0x127')](path[_0x94b1('0xd2')](_0x36b436,_0x94b1('0x128')+_0x527204['id']+'-'+_0x400b07+_0x94b1('0x129')),function(_0x46eecd,_0x376f68){if(_0x46eecd)return _0x4fa504(_0x46eecd);_0x49e927(_0x376f68);});});})[_0x94b1('0x20')](function(){return new BPromise(function(_0x39958f,_0xbc244b){zipdir(_0x36b436,{'saveTo':_0x16136d},function(_0x6ee6d2,_0x267a44){if(_0x6ee6d2)return _0xbc244b(_0x6ee6d2);return _0x39958f(_0x267a44);});})[_0x94b1('0x20')](function(){return new BPromise(function(_0x64e990,_0xeeef69){rimraf(_0x36b436,function(_0x5d0ddd){if(_0x5d0ddd)_0xeeef69(_0x5d0ddd);return _0x64e990();});});})[_0x94b1('0x20')](function(){return _0x10d28f[_0x94b1('0x106')](_0x16136d,_0x1f0de4,function(_0x3bee5e){if(_0x3bee5e){console[_0x94b1('0x12a')]('err',_0x3bee5e);}else{fs[_0x94b1('0x12b')](_0x16136d);}});});});}else{return _0x10d28f[_0x94b1('0x2a')](0xc8);}})[_0x94b1('0x3e')](handleError(_0x10d28f,null));}; \ No newline at end of file +var _0x84e7=['request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','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','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','sendStatus','status','json','count','offset','limit','set','save','update','destroy','end','name','send','Users','map','TagIds','Tags','split','push','index','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','select','field','color','from','tools_tags','u.fullname','ui.ChatInteractionId','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','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','keys','some','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`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)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','merge','ChatInteraction','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.fax','o.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','show','params','rawAttributes','include','options','create','describe','customUpdate','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','file','originalname','basename','filename','mimetype','Attachment','findOne','Unauthorized','attachId','download','join','root','server/files/attachments/','close','mailTranscript','format','now','pathTranscript','ChatMessage','Messages','ChatWebsite','CmContact','agentAlias','customer','%s%d','Visitor','agentIdentifier','website_alias','agent_alias','alias','fullname','System','agent_fullname','[%s]\x20%s:\x20%s\x0a','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','port','secure','authentication','SendMail','\x22%s\x22\x20<%s>','email','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','getMessages','hasOwnProperty','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','ids','omit','spread','Tag','emit','chatInteractionTags:save','removeTags','unix','tmp','server','files','attachments','transcript-%d-%s.zip','Account','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\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','N.A.','closedAt','browserName','osName','customerIp','customerPort','tail','existsSync','pipe','out','lastName','renderFile','views','downloadInteraction.html','toFile','.pdf','log','err','eml-format','rimraf','fast-json-patch'];(function(_0x414039,_0x556090){var _0x47919f=function(_0x4209c9){while(--_0x4209c9){_0x414039['push'](_0x414039['shift']());}};_0x47919f(++_0x556090);}(_0x84e7,0x122));var _0x784e=function(_0x5c426e,_0x2f19e3){_0x5c426e=_0x5c426e-0x0;var _0xc0fe6c=_0x84e7[_0x5c426e];return _0xc0fe6c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x784e('0x0'));var rimraf=require(_0x784e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x784e('0x2'));var rp=require(_0x784e('0x3'));var moment=require('moment');var BPromise=require(_0x784e('0x4'));var Mustache=require(_0x784e('0x5'));var util=require(_0x784e('0x6'));var path=require(_0x784e('0x7'));var sox=require(_0x784e('0x8'));var csv=require(_0x784e('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x784e('0xa'));var squel=require('squel');var crypto=require(_0x784e('0xb'));var jsforce=require(_0x784e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x784e('0x9'));var querystring=require(_0x784e('0xd'));var Papa=require(_0x784e('0xe'));var Redis=require(_0x784e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x784e('0x10'));var hardwareService=require(_0x784e('0x11'));var logger=require(_0x784e('0x12'))(_0x784e('0x13'));var utils=require('../../config/utils');var config=require(_0x784e('0x14'));var db=require(_0x784e('0x15'))['db'];config[_0x784e('0x16')]=_[_0x784e('0x17')](config[_0x784e('0x16')],{'host':_0x784e('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x784e('0x16')]));require('./chatInteraction.socket')[_0x784e('0x19')](socket);var jayson=require(_0x784e('0x1a'));var client=jayson[_0x784e('0x1b')][_0x784e('0x1c')]({'port':0x232b});var client9004=jayson[_0x784e('0x1b')][_0x784e('0x1c')]({'port':0x232c});function checkPasswordPattern(_0x947397,_0x39abb5,_0x8a90cf){if(_0x8a90cf){var _0x567eb9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x567eb9['test'](_0x39abb5)){return _0x947397;}else{throw new db[(_0x784e('0x1d'))][(_0x784e('0x1e'))](_0x784e('0x1f'));}}else{return _0x947397;}}function respondWithRpcPromise(_0x25281f,_0x3ac83,_0x19072b,_0x1dc568){return new BPromise(function(_0x504ebf,_0x2524d0){var _0x285ddd=_0x1dc568||client;return _0x285ddd[_0x784e('0x20')](_0x25281f,_0x19072b)[_0x784e('0x21')](function(_0x440cd6){logger[_0x784e('0x22')](_0x784e('0x23'),_0x3ac83,'request\x20sent');logger['debug'](_0x784e('0x24'),_0x3ac83,'request\x20sent',JSON[_0x784e('0x25')](_0x440cd6));if(_0x440cd6[_0x784e('0x26')]){if(_0x440cd6['error']['code']===0x1f4){logger[_0x784e('0x26')](_0x784e('0x23'),_0x3ac83,_0x440cd6[_0x784e('0x26')][_0x784e('0x27')]);return _0x2524d0(_0x440cd6['error']['message']);}logger['error'](_0x784e('0x23'),_0x3ac83,_0x440cd6[_0x784e('0x26')]['message']);return _0x504ebf(_0x440cd6[_0x784e('0x26')]['message']);}else{logger[_0x784e('0x22')]('ChatInteraction,\x20%s,\x20%s',_0x3ac83,_0x784e('0x28'));_0x504ebf(_0x440cd6[_0x784e('0x29')][_0x784e('0x27')]);}})[_0x784e('0x2a')](function(_0x5cb14f){logger[_0x784e('0x26')](_0x784e('0x23'),_0x3ac83,_0x5cb14f);_0x2524d0(_0x5cb14f);});});}function respondWithStatusCode(_0x12a246,_0x2def08){_0x2def08=_0x2def08||0xcc;return function(_0x54e558){if(_0x54e558){return _0x12a246[_0x784e('0x2b')](_0x2def08);}return _0x12a246[_0x784e('0x2c')](_0x2def08)['end']();};}function respondWithResult(_0x5cb5a3,_0x3c30b7){_0x3c30b7=_0x3c30b7||0xc8;return function(_0x40c31b){if(_0x40c31b){return _0x5cb5a3[_0x784e('0x2c')](_0x3c30b7)[_0x784e('0x2d')](_0x40c31b);}};}function respondWithFilteredResult(_0x2e8a79,_0x294a75){return function(_0x150757){if(_0x150757){var _0x14768f=_0x150757[_0x784e('0x2e')],_0x42bdfb=_0x294a75[_0x784e('0x2f')],_0x2e18d6=_0x294a75[_0x784e('0x2f')]+_0x294a75[_0x784e('0x30')],_0x328b70;if(_0x2e18d6>=_0x14768f){_0x2e18d6=_0x14768f;_0x328b70=0xc8;}else{_0x328b70=0xce;}_0x2e8a79['status'](_0x328b70);return _0x2e8a79[_0x784e('0x31')]('Content-Range',_0x42bdfb+'-'+_0x2e18d6+'/'+_0x14768f)[_0x784e('0x2d')](_0x150757);}return null;};}function patchUpdates(_0x14bb3b){return function(_0x14547a){try{jsonpatch['apply'](_0x14547a,_0x14bb3b,!![]);}catch(_0x18d8f4){return BPromise['reject'](_0x18d8f4);}return _0x14547a[_0x784e('0x32')]();};}function saveUpdates(_0x3525d6,_0x4fc7b3){return function(_0x23b3b0){if(_0x23b3b0){return _0x23b3b0[_0x784e('0x33')](_0x3525d6)['then'](function(_0x58744f){return _0x58744f;});}return null;};}function removeEntity(_0x444d1e,_0x360e5f){return function(_0x425722){if(_0x425722){return _0x425722[_0x784e('0x34')]()[_0x784e('0x21')](function(){_0x444d1e['status'](0xcc)[_0x784e('0x35')]();});}};}function handleEntityNotFound(_0xcbc600,_0x5bb0a6){return function(_0x3c95da){if(!_0x3c95da){_0xcbc600['sendStatus'](0x194);}return _0x3c95da;};}function handleError(_0x4adb1f,_0x582355){_0x582355=_0x582355||0x1f4;return function(_0x177e54){logger[_0x784e('0x26')](_0x177e54['stack']);if(_0x177e54[_0x784e('0x36')]){delete _0x177e54[_0x784e('0x36')];}_0x4adb1f[_0x784e('0x2c')](_0x582355)[_0x784e('0x37')](_0x177e54);};}function getInteractionUsers(_0x1351ef,_0x244727){return new BPromise(function(_0x4c4e59,_0x5f006b){try{if(_0x244727[_0x1351ef['id']]){_0x1351ef[_0x784e('0x38')]=_[_0x784e('0x39')](_0x244727[_0x1351ef['id']],function(_0x509d95){return{'id':_0x509d95['id'],'fullname':_0x509d95['fullname']};});}}catch(_0x48afec){_0x5f006b(_0x48afec);}_0x4c4e59(_0x1351ef);});}function getInteractionTags(_0x35608e,_0x1facf9){return new BPromise(function(_0x4f1cc0,_0x3fa668){try{if(_0x35608e[_0x784e('0x3a')]){_0x35608e[_0x784e('0x3b')]=[];_0x35608e['TagIds'][_0x784e('0x3c')](',')['forEach'](function(_0x1b0d7a){_0x35608e['Tags'][_0x784e('0x3d')](_0x1facf9[_0x1b0d7a]);});}delete _0x35608e[_0x784e('0x3a')];}catch(_0x5512bd){_0x3fa668(_0x5512bd);}_0x4f1cc0(_0x35608e);});}function updateChatInteraction(_0x4d08ee,_0x1c0aca,_0x459fe2){return new BPromise(function(_0xa2ed54,_0x58fb50){return getInteractionUsers(_0x4d08ee,_0x459fe2)[_0x784e('0x21')](function(_0x3d68e6){return getInteractionTags(_0x3d68e6,_0x1c0aca);})[_0x784e('0x21')](function(_0x1e90bb){_0xa2ed54(_0x1e90bb);})['catch'](function(_0x444300){_0x58fb50(_0x444300);});});}exports[_0x784e('0x3e')]=function(_0x48d0f0,_0x580663){var _0x45dd9d={},_0x39cf7a={},_0x258a2a={'count':0x0,'rows':[]};var _0x18436e=_[_0x784e('0x39')](db['ChatInteraction']['rawAttributes'],function(_0x5e0a18){return{'name':_0x5e0a18[_0x784e('0x3f')],'type':_0x5e0a18[_0x784e('0x40')][_0x784e('0x41')]};});_0x39cf7a[_0x784e('0x42')]=_[_0x784e('0x39')](_0x18436e,'name');_0x39cf7a['query']=_['keys'](_0x48d0f0[_0x784e('0x43')]);_0x39cf7a[_0x784e('0x44')]=_['intersection'](_0x39cf7a[_0x784e('0x42')],_0x39cf7a[_0x784e('0x43')]);_0x45dd9d['attributes']=_[_0x784e('0x45')](_0x39cf7a[_0x784e('0x42')],qs[_0x784e('0x46')](_0x48d0f0[_0x784e('0x43')][_0x784e('0x46')]));_0x45dd9d[_0x784e('0x47')]=_0x45dd9d[_0x784e('0x47')][_0x784e('0x48')]?_0x45dd9d['attributes']:_0x39cf7a[_0x784e('0x42')];if(!_0x48d0f0[_0x784e('0x43')]['hasOwnProperty'](_0x784e('0x49'))){_0x45dd9d[_0x784e('0x30')]=qs[_0x784e('0x30')](_0x48d0f0[_0x784e('0x43')][_0x784e('0x30')]);_0x45dd9d[_0x784e('0x2f')]=qs[_0x784e('0x2f')](_0x48d0f0[_0x784e('0x43')][_0x784e('0x2f')]);}_0x45dd9d[_0x784e('0x4a')]=qs['sort'](_0x48d0f0[_0x784e('0x43')][_0x784e('0x4b')]);_0x45dd9d['where']=qs['filters'](_[_0x784e('0x4c')](_0x48d0f0['query'],_0x39cf7a[_0x784e('0x44')]));var _0x52f7a6=[];var _0x3f0804=squel[_0x784e('0x4d')]()[_0x784e('0x4e')]('id')[_0x784e('0x4e')]('name')['field'](_0x784e('0x4f'))[_0x784e('0x50')](_0x784e('0x51'));var _0x43e88e=squel[_0x784e('0x4d')]()['field']('u.id')[_0x784e('0x4e')](_0x784e('0x52'))['field'](_0x784e('0x53'))[_0x784e('0x50')]('user_has_chat_interactions','ui')[_0x784e('0x54')](_0x784e('0x55'),'u',_0x784e('0x56'));var _0x24a260=squel['select']()['from'](_0x784e('0x57'),'i')['left_join']('cm_contacts','c',_0x784e('0x58'))[_0x784e('0x54')](_0x784e('0x55'),'o',_0x784e('0x59'))[_0x784e('0x54')](_0x784e('0x5a'),'a',_0x784e('0x5b'))['left_join'](_0x784e('0x5c'),'me',_0x784e('0x5d'))['left_join']('chat_interaction_has_tags','it','it.ChatInteractionId\x20=\x20i.id')[_0x784e('0x54')](_0x784e('0x51'),'t',_0x784e('0x5e'));var _0x3969c8=squel[_0x784e('0x5f')]();var _0x4d28d1=[];var _0x3d0b7d=squel[_0x784e('0x5f')]();var _0x13a1bf;if(_0x48d0f0[_0x784e('0x43')]['search']){_0x13a1bf=as[_0x784e('0x60')](_0x48d0f0['query'][_0x784e('0x61')]);var _0x191cda=_0x13a1bf[_0x784e('0x62')];for(var _0xffdfdb=0x0;_0xffdfdb<_0x13a1bf[_0x784e('0x63')][_0x784e('0x48')];_0xffdfdb++){var _0x4ee806=_0x13a1bf[_0x784e('0x63')][_0xffdfdb];var _0x5f50e8='i';var _0x420f13=_[_0x784e('0x64')](_0x18436e,[_0x784e('0x36'),_0x4ee806[_0x784e('0x4e')]]);if(!_0x420f13){switch(_0x4ee806[_0x784e('0x4e')]){case _0x784e('0x65'):if(_0x4ee806[_0x784e('0x66')]==0x1){_0x24a260[_0x784e('0x67')]('`'+_0x4ee806[_0x784e('0x4e')]+_0x784e('0x68'));}else{_0x24a260[_0x784e('0x67')]('`'+_0x4ee806[_0x784e('0x4e')]+_0x784e('0x69'));}break;case _0x784e('0x6a'):if(_0x4ee806[_0x784e('0x6b')]===_0x784e('0x6c')){if(_0x4ee806[_0x784e('0x66')][_0x784e('0x3c')]('\x20')['length']>0x1){_0x3969c8[_0x191cda](_0x784e('0x6d'),qs['getFullTextValue'](_0x4ee806[_0x784e('0x66')]),null);}else{var _0x4bec2f='%'+_0x4ee806[_0x784e('0x66')]+'%';_0x3969c8[_0x191cda](_0x784e('0x6e'),_0x4bec2f,_0x4bec2f,_0x4bec2f);}}else{_0x420f13=_[_0x784e('0x64')](_0x18436e,[_0x784e('0x36'),_0x784e('0x6f')]);_0x4ee806['field']=_0x784e('0x6f');_0x5b36af=as[_0x784e('0x70')](_0x5f50e8,_0x420f13[_0x784e('0x40')],_0x4ee806);_0x3969c8[_0x191cda](_0x5b36af['text'],_0x5b36af['value'][_0x784e('0x71')],_0x5b36af[_0x784e('0x66')]['end']);}break;case'Tag':var _0x58fb7f=_0x4ee806[_0x784e('0x66')][_0x784e('0x3c')](',')[_0x784e('0x39')](function(_0x1c7821){return Number(_0x1c7821);});_0x58fb7f[_0x784e('0x72')](function(_0x5475a4){_0x3d0b7d['or'](_0x784e('0x73'),'%,'+_0x5475a4+',%');});_0x4d28d1=_[_0x784e('0x74')](_0x4d28d1,_0x58fb7f);break;case _0x784e('0x75'):if(_0x4ee806[_0x784e('0x6b')]===_0x784e('0x6c')){_0x3969c8[_0x191cda](_0x784e('0x76'),'%'+_0x4ee806[_0x784e('0x66')]+'%',null);}else{_0x420f13=_[_0x784e('0x64')](_0x18436e,['name','UserId']);_0x4ee806[_0x784e('0x4e')]=_0x784e('0x77');_0x5b36af=as['buildExpression'](_0x5f50e8,_0x420f13[_0x784e('0x40')],_0x4ee806);_0x3969c8[_0x191cda](_0x5b36af[_0x784e('0x78')],_0x5b36af[_0x784e('0x66')][_0x784e('0x71')],_0x5b36af['value'][_0x784e('0x35')]);}break;case _0x784e('0x79'):_0x5b36af=as[_0x784e('0x70')]('me',null,_0x4ee806);_0x3969c8[_0x191cda](_0x5b36af[_0x784e('0x78')],_0x5b36af['value']['start'],_0x5b36af['value'][_0x784e('0x35')]);break;}}else{var _0x5b36af=as['buildExpression'](_0x5f50e8,_0x420f13[_0x784e('0x40')],_0x4ee806);_0x3969c8[_0x191cda](_0x5b36af['text'],_0x5b36af['value'][_0x784e('0x71')],_0x5b36af[_0x784e('0x66')]['end']);}}}else{var _0x5f54c8=_(_0x48d0f0['query'])[_0x784e('0x7a')]()[_0x784e('0x39')](function(_0x57012b){return _[_0x784e('0x7b')](_0x18436e,[_0x784e('0x36'),_0x57012b])?_0x57012b:undefined;})[_0x784e('0x7c')]()[_0x784e('0x66')]();if(!_[_0x784e('0x7d')](_0x5f54c8)){_0x5f54c8['forEach'](function(_0x8cf4c9){if(_0x8cf4c9===_0x784e('0x7e')){_0x24a260['where'](_0x784e('0x7f'),[][_0x784e('0x80')](_0x48d0f0[_0x784e('0x43')][_0x8cf4c9]));}else if(_0x8cf4c9===_0x784e('0x81')){var _0x4da231=JSON[_0x784e('0x82')](_0x48d0f0['query'][_0x8cf4c9])[_0x784e('0x83')];var _0x1e29a4=JSON[_0x784e('0x82')](_0x48d0f0['query'][_0x8cf4c9])[_0x784e('0x84')];_0x24a260[_0x784e('0x85')](_0x784e('0x86'),_0x4da231,_0x1e29a4);}else{if(_0x48d0f0['query'][_0x8cf4c9]===_0x784e('0x87')){_0x24a260[_0x784e('0x85')]('i.'+_0x8cf4c9+_0x784e('0x88'));}else{_0x24a260[_0x784e('0x85')]('i.'+_0x8cf4c9+_0x784e('0x89'),_0x48d0f0['query'][_0x8cf4c9]);}}});}if(_0x48d0f0[_0x784e('0x43')][_0x784e('0x8a')]){if(_0x48d0f0['query']['read']==0x1){_0x24a260[_0x784e('0x67')](_0x784e('0x8b'));}else{_0x24a260[_0x784e('0x67')]('`unreadMessages`\x20>\x200');}}if(_0x48d0f0[_0x784e('0x43')][_0x784e('0x8c')]){_0x4d28d1=_[_0x784e('0x8d')](_0x48d0f0[_0x784e('0x43')][_0x784e('0x8c')])?_0x48d0f0[_0x784e('0x43')][_0x784e('0x8c')]:new Array(_0x48d0f0['query']['tag']);_0x4d28d1[_0x784e('0x72')](function(_0x56d2f2){_0x3d0b7d['or'](_0x784e('0x73'),'%,'+_0x56d2f2+',%');});}if(_0x48d0f0[_0x784e('0x43')][_0x784e('0x8e')]){var _0x4e6f25=_0x48d0f0[_0x784e('0x43')][_0x784e('0x8e')][_0x784e('0x8f')]('\x5c','\x5c\x5c')[_0x784e('0x8f')]('\x27\x27',_0x784e('0x90'));if(qs[_0x784e('0x91')](_0x4e6f25)){_0x3969c8['or'](_0x784e('0x92'),_0x4e6f25+'%');}else{_0x3969c8['or'](_0x784e('0x93'),qs[_0x784e('0x94')](_0x4e6f25))['or'](_0x784e('0x95'),_0x4e6f25+'%');}}}_0x24a260[_0x784e('0x85')](_0x3969c8);_0x24a260[_0x784e('0x96')](_0x784e('0x97'));var _0x3e6787={'type':db[_0x784e('0x1d')][_0x784e('0x98')][_0x784e('0x99')],'raw':!![]};var _0x188caa=_0x24a260[_0x784e('0x9a')]();_0x188caa[_0x784e('0x4e')](_0x784e('0x97'));_0x188caa['field'](_0x784e('0x9b'),_0x784e('0x65'));if(_0x45dd9d[_0x784e('0x4a')]){_0x45dd9d[_0x784e('0x4a')][_0x784e('0x72')](function(_0x18b88a){_0x24a260['order']('i.'+_0x18b88a[0x0],_0x18b88a[0x1]===_0x784e('0x9c')?![]:!![]);});}if(!_['isEmpty'](_0x4d28d1)){_0x24a260[_0x784e('0x67')](_0x3d0b7d);_0x188caa['where']('t.id\x20IN\x20?',_0x4d28d1);}BPromise['resolve']()[_0x784e('0x21')](function(){if(!_0x13a1bf){if(_0x48d0f0[_0x784e('0x43')][_0x784e('0x7e')]||_0x48d0f0[_0x784e('0x43')][_0x784e('0x9d')])return;_0x188caa[_0x784e('0x85')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x24a260[_0x784e('0x85')](_0x784e('0x9e'));return;}return _0x48d0f0[_0x784e('0x9f')]['getChatWebsites']({'attributes':['id'],'raw':!![]})[_0x784e('0x21')](function(_0x2d0136){if(_[_0x784e('0x7d')](_0x2d0136)){_0x188caa[_0x784e('0x85')](_0x784e('0xa0'));_0x24a260[_0x784e('0x85')](_0x784e('0xa0'));}else{_0x188caa['where']('i.ChatWebsiteId\x20IN\x20?',_[_0x784e('0x39')](_0x2d0136,'id'));_0x24a260[_0x784e('0x85')](_0x784e('0x7f'),_[_0x784e('0x39')](_0x2d0136,'id'));}});})[_0x784e('0x21')](function(){db[_0x784e('0xa1')][_0x784e('0x43')](_0x188caa[_0x784e('0xa2')](),_0x3e6787)[_0x784e('0x21')](function(_0x16dcfc){_0x258a2a['count']=_0x16dcfc[_0x784e('0x48')];if(_0x258a2a['count']===0x0)return[];return db['sequelize'][_0x784e('0x43')](_0x3f0804[_0x784e('0xa2')](),_0x3e6787)[_0x784e('0x21')](function(_0x426273){_0x52f7a6=_['keyBy'](_0x426273,'id');_0x3e6787=_[_0x784e('0xa3')](_0x3e6787,{'model':db[_0x784e('0xa4')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x48d0f0[_0x784e('0x43')]['fields']){_0x45dd9d[_0x784e('0x47')][_0x784e('0x72')](function(_0x271d6d){_0x24a260[_0x784e('0x4e')]('i.'+_0x271d6d);});}else{_0x24a260[_0x784e('0x4e')](_0x784e('0x9b'),_0x784e('0x65'));_0x24a260[_0x784e('0x4e')]('a.key',_0x784e('0xa5'));_0x24a260['field'](_0x784e('0xa6'),_0x784e('0xa7'));_0x24a260[_0x784e('0x4e')](_0x784e('0xa8'));_0x24a260[_0x784e('0x4e')]('c.firstName','Contact.firstName');_0x24a260[_0x784e('0x4e')](_0x784e('0xa9'),_0x784e('0xaa'));_0x24a260[_0x784e('0x4e')](_0x784e('0xab'),_0x784e('0xac'));_0x24a260[_0x784e('0x4e')]('c.phone',_0x784e('0xad'));_0x24a260['field'](_0x784e('0xae'),'Contact.mobile');_0x24a260[_0x784e('0x4e')]('c.fax',_0x784e('0xaf'));_0x24a260[_0x784e('0x4e')](_0x784e('0xb0'),'Owner.fullname');_0x24a260['field']('o.internal',_0x784e('0xb1'));_0x24a260[_0x784e('0x4e')](_0x784e('0xb2'),_0x784e('0x3a'));}_0x24a260[_0x784e('0x30')](_0x45dd9d[_0x784e('0x30')]);_0x24a260[_0x784e('0x2f')](_0x45dd9d[_0x784e('0x2f')]);return db[_0x784e('0xa1')]['query'](_0x24a260[_0x784e('0xa2')](),_0x3e6787);})['then'](function(_0x2c5d99){_0x43e88e[_0x784e('0x85')](_0x784e('0xb3'),_[_0x784e('0x39')](_0x2c5d99,'id'));return db[_0x784e('0xa1')]['query'](_0x43e88e[_0x784e('0xa2')](),_0x3e6787)[_0x784e('0x21')](function(_0x47b959){var _0x42e193=_[_0x784e('0xb4')](_0x47b959,_0x784e('0xb5'));var _0x10bb48=[];_0x2c5d99[_0x784e('0x72')](function(_0x3fe83b){_0x10bb48[_0x784e('0x3d')](updateChatInteraction(_0x3fe83b,_0x52f7a6,_0x42e193));});return BPromise[_0x784e('0xb6')](_0x10bb48);});});})[_0x784e('0x21')](function(_0x4dc8ed){_0x258a2a[_0x784e('0xb7')]=_0x4dc8ed;return _0x258a2a;})['then'](respondWithFilteredResult(_0x580663,_0x45dd9d));})[_0x784e('0x2a')](handleError(_0x580663,null));};exports[_0x784e('0xb8')]=function(_0x4c0a56,_0x4db23f){var _0x3716b1={'raw':![],'where':{'id':_0x4c0a56[_0x784e('0xb9')]['id']}},_0x544406={};_0x544406[_0x784e('0x42')]=_[_0x784e('0x7a')](db['ChatInteraction'][_0x784e('0xba')]);_0x544406[_0x784e('0x43')]=_['keys'](_0x4c0a56[_0x784e('0x43')]);_0x544406[_0x784e('0x44')]=_[_0x784e('0x45')](_0x544406[_0x784e('0x42')],_0x544406[_0x784e('0x43')]);_0x3716b1['attributes']=_['intersection'](_0x544406[_0x784e('0x42')],qs[_0x784e('0x46')](_0x4c0a56[_0x784e('0x43')][_0x784e('0x46')]));_0x3716b1['attributes']=_0x3716b1[_0x784e('0x47')]['length']?_0x3716b1[_0x784e('0x47')]:_0x544406[_0x784e('0x42')];if(_0x4c0a56[_0x784e('0x43')]['includeAll']){_0x3716b1[_0x784e('0xbb')]=[{'all':!![]}];}_0x3716b1=_['merge']({},_0x3716b1,_0x4c0a56[_0x784e('0xbc')]);return db[_0x784e('0xa4')][_0x784e('0x64')](_0x3716b1)[_0x784e('0x21')](handleEntityNotFound(_0x4db23f,null))[_0x784e('0x21')](respondWithResult(_0x4db23f,null))[_0x784e('0x2a')](handleError(_0x4db23f,null));};exports[_0x784e('0xbd')]=function(_0x143e3e,_0x44a131){return db[_0x784e('0xa4')][_0x784e('0xbd')](_0x143e3e[_0x784e('0x79')],{})['then'](respondWithResult(_0x44a131,0xc9))[_0x784e('0x2a')](handleError(_0x44a131,null));};exports[_0x784e('0x33')]=function(_0x997e6f,_0x3e1d59){if(_0x997e6f[_0x784e('0x79')]['id']){delete _0x997e6f[_0x784e('0x79')]['id'];}return db[_0x784e('0xa4')]['find']({'where':{'id':_0x997e6f[_0x784e('0xb9')]['id']}})[_0x784e('0x21')](handleEntityNotFound(_0x3e1d59,null))[_0x784e('0x21')](saveUpdates(_0x997e6f[_0x784e('0x79')],null))['then'](respondWithResult(_0x3e1d59,null))[_0x784e('0x2a')](handleError(_0x3e1d59,null));};exports[_0x784e('0x34')]=function(_0x2e8657,_0x375f92){return db[_0x784e('0xa4')][_0x784e('0x64')]({'where':{'id':_0x2e8657[_0x784e('0xb9')]['id']}})[_0x784e('0x21')](handleEntityNotFound(_0x375f92,null))[_0x784e('0x21')](removeEntity(_0x375f92,null))[_0x784e('0x2a')](handleError(_0x375f92,null));};exports[_0x784e('0xbe')]=function(_0x567da5,_0x1db77c){return db['ChatInteraction'][_0x784e('0xbe')]()['then'](respondWithResult(_0x1db77c,null))[_0x784e('0x2a')](handleError(_0x1db77c,null));};exports[_0x784e('0xbf')]=function(_0x274573,_0x46c1fe){if(_0x274573['body']['id']){delete _0x274573[_0x784e('0x79')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x274573[_0x784e('0xb9')]['id']}})[_0x784e('0x21')](handleEntityNotFound(_0x46c1fe,null))[_0x784e('0x21')](saveUpdates(_0x274573['body'],null))[_0x784e('0x21')](respondWithResult(_0x46c1fe,null))[_0x784e('0x2a')](handleError(_0x46c1fe,null));};exports[_0x784e('0xc0')]=function(_0x211b16,_0x210fbc,_0x5d28e7){if(_0x211b16['body']['id']){delete _0x211b16[_0x784e('0x79')]['id'];}return db[_0x784e('0xa4')][_0x784e('0x64')]({'where':{'id':_0x211b16[_0x784e('0xb9')]['id']}})[_0x784e('0x21')](function(_0x4b530d){if(!_0x4b530d){logger[_0x784e('0x26')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x784e('0xc0'),0x194,_0x784e('0xc1'));_0x210fbc[_0x784e('0x2b')](0x194);}else{if(_0x4b530d[_0x784e('0x77')]){throw new db['Sequelize'][(_0x784e('0x1e'))](_0x784e('0xc2'));}}return _0x4b530d;})['then'](function(_0x251ad8){if(_0x251ad8){return _0x251ad8['update']({'closed':_0x211b16[_0x784e('0x79')][_0x784e('0xc3')],'disposition':_0x211b16['body'][_0x784e('0xc4')]})[_0x784e('0x21')](function(_0x4adffa){return _0x4adffa;});}})[_0x784e('0x21')](function(_0x218ac1){return respondWithRpcPromise('AbandonInteraction',_0x784e('0xc0'),_0x211b16[_0x784e('0x79')],client9004);})['then'](respondWithResult(_0x210fbc,null))[_0x784e('0x2a')](handleError(_0x210fbc,null));};exports['attachmentUpload']=function(_0x1b4413,_0x375bf6,_0x29de9b){_0x1b4413[_0x784e('0x79')]['name']=_0x1b4413[_0x784e('0xc5')][_0x784e('0xc6')];_0x1b4413[_0x784e('0x79')][_0x784e('0xc7')]=_0x1b4413[_0x784e('0xc5')][_0x784e('0xc8')];_0x1b4413[_0x784e('0x79')][_0x784e('0x40')]=_0x1b4413[_0x784e('0xc5')][_0x784e('0xc9')];return db[_0x784e('0xca')][_0x784e('0xbd')](_0x1b4413[_0x784e('0x79')])[_0x784e('0x21')](respondWithResult(_0x375bf6,0xc9))[_0x784e('0x2a')](handleError(_0x375bf6,null));};exports['attachmentDownload']=function(_0x17cb46,_0x6e417f,_0xd82ecf){return db['ChatInteraction'][_0x784e('0xcb')]({'where':{'id':_0x17cb46[_0x784e('0xb9')]['id']},'raw':!![]})[_0x784e('0x21')](handleEntityNotFound(_0x6e417f,null))[_0x784e('0x21')](function(_0x20c569){if(_0x20c569){if(_0x20c569[_0x784e('0xc3')]){return _0x6e417f[_0x784e('0x2c')](0x193)[_0x784e('0x2d')]({'status':0x193,'message':_0x784e('0xcc')});}return db[_0x784e('0xca')][_0x784e('0xcb')]({'where':{'id':_0x17cb46[_0x784e('0x43')][_0x784e('0xcd')]},'raw':!![]})[_0x784e('0x21')](handleEntityNotFound(_0x6e417f,null));}})['then'](function(_0x24385d){if(_0x24385d){return _0x6e417f[_0x784e('0xce')](path[_0x784e('0xcf')](config[_0x784e('0xd0')],_0x784e('0xd1'),_0x24385d['basename']));}})[_0x784e('0x2a')](handleError(_0x6e417f,null));};exports[_0x784e('0xd2')]=function(_0x56ad37,_0x4e2f35){var _0x2b4d65=null;var _0x158ba4=null;var _0x52977d=null;var _0x449460=null;if(_0x56ad37[_0x784e('0x79')]['id']){delete _0x56ad37[_0x784e('0x79')]['id'];}if(_0x56ad37['body'][_0x784e('0xd3')]){_0x449460=path[_0x784e('0xcf')](config[_0x784e('0xd0')],'server/files/chat/upload/',util[_0x784e('0xd4')]('transcript-%s.txt',Date[_0x784e('0xd5')]()));_0x56ad37[_0x784e('0x79')][_0x784e('0xd6')]=_0x449460;}return db[_0x784e('0xa4')][_0x784e('0x64')]({'where':{'id':_0x56ad37['params']['id']},'include':[{'model':db[_0x784e('0xd7')],'as':_0x784e('0xd8'),'include':[{'model':db['User'],'as':'User'}]}]})[_0x784e('0x21')](handleEntityNotFound(_0x4e2f35,null))[_0x784e('0x21')](saveUpdates(_0x56ad37[_0x784e('0x79')],null))[_0x784e('0x21')](function(_0x5916b6){if(_0x5916b6){_0x2b4d65=_0x5916b6;return db[_0x784e('0xd9')]['find']({'where':{'id':_0x2b4d65[_0x784e('0x7e')]}});}})[_0x784e('0x21')](function(_0x28c66b){if(_0x28c66b){_0x52977d=_0x28c66b;return db[_0x784e('0xda')][_0x784e('0x64')]({'where':{'id':_0x2b4d65[_0x784e('0x6f')]}});}})['then'](function(_0x22efbd){if(_0x22efbd){_0x158ba4=_0x22efbd;if(_0x449460){var _0x115245=null;for(var _0x4213bc=0x1;_0x4213bc<_0x2b4d65['Messages'][_0x784e('0x48')];++_0x4213bc){_0x115245=_0x2b4d65[_0x784e('0xd8')][_0x4213bc];var _0x348cc2=_0x115245['UserId']?util[_0x784e('0xd4')]('%s%d',_0x52977d[_0x784e('0xdb')],_0x115245[_0x784e('0x77')]):'System';var _0x362592=_0x56ad37[_0x784e('0x79')][_0x784e('0xdc')]||util['format'](_0x784e('0xdd'),_0x784e('0xde'),_0x115245[_0x784e('0x6f')]);switch(_0x52977d[_0x784e('0xdf')]){case _0x784e('0xe0'):_0x348cc2=_0x115245['UserId']?util['format'](_0x784e('0xdd'),_0x52977d[_0x784e('0xdb')],_0x115245[_0x784e('0x77')]):'System';break;case _0x784e('0xe1'):_0x348cc2=_0x115245[_0x784e('0x77')]?_0x115245['User'][_0x784e('0xe2')]||_0x115245[_0x784e('0x75')][_0x784e('0xe3')]:_0x784e('0xe4');break;case _0x784e('0xe5'):_0x348cc2=_0x115245[_0x784e('0x77')]?_0x115245[_0x784e('0x75')]['fullname']:_0x784e('0xe4');break;default:_0x348cc2=_0x115245[_0x784e('0x77')]?util[_0x784e('0xd4')]('%s%d',_0x52977d[_0x784e('0xdb')],_0x115245[_0x784e('0x77')]):_0x784e('0xe4');}var _0x20f070=util[_0x784e('0xd4')](_0x784e('0xe6'),moment(_0x115245['createdAt'])[_0x784e('0xd4')]('MM/DD/YYYY\x20HH:mm:ss'),_0x115245[_0x784e('0xe7')]==='in'?_0x362592:_0x348cc2,_0x115245[_0x784e('0x79')]);if(!_0x115245[_0x784e('0xe8')]){fs[_0x784e('0xe9')](_0x449460,_0x20f070);}}return db[_0x784e('0xea')][_0x784e('0xcb')]({'where':{'service':!![]},'include':[{'model':db[_0x784e('0xeb')],'as':_0x784e('0xec'),'raw':!![]}]});}}})['then'](function(_0x152614){if(_0x152614&&_0x152614[_0x784e('0xec')]&&_0x56ad37['body']){var _0x355f0f={'tls':{'rejectUnauthorized':![]}};if(_0x152614[_0x784e('0xec')][_0x784e('0xed')]){_0x355f0f[_0x784e('0xed')]=_0x152614['Smtp'][_0x784e('0xed')];}else{_0x355f0f['host']=_0x152614[_0x784e('0xec')]['host'];_0x355f0f[_0x784e('0xee')]=_0x152614['Smtp']['port'];_0x355f0f[_0x784e('0xef')]=_0x152614[_0x784e('0xec')][_0x784e('0xef')];}if(_0x152614[_0x784e('0xec')][_0x784e('0xf0')]){_0x355f0f['auth']={'user':_0x152614[_0x784e('0xec')][_0x784e('0x9f')],'pass':_0x152614['Smtp']['pass']};}return respondWithRpcPromise(_0x784e('0xf1'),'sendMail',{'account':_0x355f0f,'message':{'from':util['format'](_0x784e('0xf2'),_0x152614[_0x784e('0x36')],_0x152614[_0x784e('0xf3')]||_0x152614['Smtp'][_0x784e('0x9f')]),'to':_0x56ad37['body'][_0x784e('0xd3')],'subject':_0x784e('0xf4'),'text':util[_0x784e('0xd4')](_0x784e('0xf5'),_0x56ad37['body'][_0x784e('0xd3')]),'attachments':[{'path':_0x449460}]}})[_0x784e('0x21')](function(){return _0x2b4d65;})[_0x784e('0x2a')](function(_0x15a912){console[_0x784e('0x26')](_0x15a912);});}else{return _0x2b4d65;}})['then'](respondWithStatusCode(_0x4e2f35,0xc8))[_0x784e('0x2a')](handleError(_0x4e2f35,null));};exports[_0x784e('0xf6')]=function(_0x1e2ecd,_0x55f3dc,_0x1fa868){return db[_0x784e('0xd7')][_0x784e('0x64')]({'where':{'id':_0x1e2ecd['params']['id']}})['then'](handleEntityNotFound(_0x55f3dc,null))[_0x784e('0x21')](function(_0x206185){if(_0x206185){return _0x206185[_0x784e('0xf6')](_0x1e2ecd[_0x784e('0x79')]['ids'],_['omit'](_0x1e2ecd['body'],['ids','id'])||{});}})[_0x784e('0x21')](respondWithResult(_0x55f3dc,null))[_0x784e('0x2a')](handleError(_0x55f3dc,null));};exports[_0x784e('0xf7')]=function(_0x58945d,_0x552963,_0x1949d4){var _0xae4c88={'raw':![],'where':{}};var _0x2777ba={};var _0x50908e={'count':0x0,'rows':[]};return db[_0x784e('0xa4')][_0x784e('0xcb')]({'where':{'id':_0x58945d[_0x784e('0xb9')]['id']}})[_0x784e('0x21')](handleEntityNotFound(_0x552963,null))['then'](function(_0x2b8e81){if(_0x2b8e81){_0x2777ba[_0x784e('0x42')]=_[_0x784e('0x7a')](db['ChatMessage'][_0x784e('0xba')]);_0x2777ba[_0x784e('0x43')]=_[_0x784e('0x7a')](_0x58945d[_0x784e('0x43')]);_0x2777ba[_0x784e('0x44')]=_[_0x784e('0x45')](_0x2777ba[_0x784e('0x42')],_0x2777ba[_0x784e('0x43')]);_0xae4c88[_0x784e('0x47')]=_[_0x784e('0x45')](_0x2777ba[_0x784e('0x42')],qs['fields'](_0x58945d['query'][_0x784e('0x46')]));_0xae4c88[_0x784e('0x47')]=_0xae4c88['attributes'][_0x784e('0x48')]?_0xae4c88[_0x784e('0x47')]:_0x2777ba[_0x784e('0x42')];if(!_0x58945d[_0x784e('0x43')][_0x784e('0xf8')](_0x784e('0x49'))){_0xae4c88['limit']=qs[_0x784e('0x30')](_0x58945d[_0x784e('0x43')][_0x784e('0x30')]);_0xae4c88[_0x784e('0x2f')]=qs['offset'](_0x58945d['query'][_0x784e('0x2f')]);}_0xae4c88[_0x784e('0x4a')]=qs[_0x784e('0x4b')](_0x58945d[_0x784e('0x43')]['sort']);_0xae4c88[_0x784e('0x85')]=qs[_0x784e('0x44')](_[_0x784e('0x4c')](_0x58945d[_0x784e('0x43')],_0x2777ba[_0x784e('0x44')]));_0xae4c88['where'][_0x784e('0xb5')]=_0x2b8e81['id'];if(_0x58945d[_0x784e('0x43')][_0x784e('0x8e')]){_0xae4c88[_0x784e('0x85')]=_[_0x784e('0xa3')](_0xae4c88[_0x784e('0x85')],{'$or':_[_0x784e('0x39')](_0xae4c88[_0x784e('0x47')],function(_0x4052c7){var _0x32305f={};_0x32305f[_0x4052c7]={'$like':'%'+_0x58945d[_0x784e('0x43')][_0x784e('0x8e')]+'%'};return _0x32305f;})});}if(_0x58945d[_0x784e('0x43')][_0x784e('0x83')]){var _0x2aba31=_0x58945d[_0x784e('0x43')]['$gte']['split'](',');var _0x20da90={};_0x20da90[_0x2aba31[0x0]]={'$gte':moment(_0x2aba31[0x1])[_0x784e('0xd4')](_0x784e('0xf9'))};_0xae4c88[_0x784e('0x85')]=_['merge'](_0xae4c88[_0x784e('0x85')],_0x20da90);}_0xae4c88=_[_0x784e('0xa3')]({},_0xae4c88,_0x58945d[_0x784e('0xbc')]);return db[_0x784e('0xd7')][_0x784e('0x2e')]({'where':_0xae4c88[_0x784e('0x85')]})[_0x784e('0x21')](function(_0x417abe){_0x50908e[_0x784e('0x2e')]=_0x417abe;if(_0x58945d[_0x784e('0x43')]['includeAll']){_0xae4c88[_0x784e('0xbb')]=[{'all':!![]}];}return db[_0x784e('0xd7')][_0x784e('0xfa')](_0xae4c88);})[_0x784e('0x21')](function(_0x1b57ac){_0x50908e['rows']=_0x1b57ac;return _0x50908e;});}})[_0x784e('0x21')](respondWithFilteredResult(_0x552963,_0xae4c88))[_0x784e('0x2a')](handleError(_0x552963,null));};exports['getMyMessages']=function(_0x5c9408,_0x8c778f,_0x40767b){var _0x5bf447={'where':{}},_0x2ade01={},_0x248ea9={'count':0x0,'rows':[]};return db[_0x784e('0xa4')][_0x784e('0xcb')]({'where':{'id':_0x5c9408[_0x784e('0xb9')]['id']}})[_0x784e('0x21')](handleEntityNotFound(_0x8c778f,null))[_0x784e('0x21')](function(_0x14f194){if(_0x14f194){_0x2ade01[_0x784e('0x42')]=_[_0x784e('0x7a')](db[_0x784e('0xd7')]['rawAttributes']);_0x2ade01['query']=_[_0x784e('0x7a')](_0x5c9408[_0x784e('0x43')]);_0x2ade01[_0x784e('0x44')]=_['intersection'](_0x2ade01['model'],_0x2ade01[_0x784e('0x43')]);_0x5bf447[_0x784e('0x47')]=_[_0x784e('0x45')](_0x2ade01[_0x784e('0x42')],qs[_0x784e('0x46')](_0x5c9408[_0x784e('0x43')]['fields']));_0x5bf447[_0x784e('0x47')]=_0x5bf447['attributes'][_0x784e('0x48')]?_0x5bf447[_0x784e('0x47')]:_0x2ade01['model'];if(!_0x5c9408[_0x784e('0x43')][_0x784e('0xf8')]('nolimit')){_0x5bf447['limit']=qs[_0x784e('0x30')](_0x5c9408[_0x784e('0x43')]['limit']);_0x5bf447[_0x784e('0x2f')]=qs[_0x784e('0x2f')](_0x5c9408[_0x784e('0x43')]['offset']);}_0x5bf447[_0x784e('0x4a')]=qs[_0x784e('0x4b')](_0x5c9408['query'][_0x784e('0x4b')]);_0x5bf447[_0x784e('0x85')]=qs[_0x784e('0x44')](_['pick'](_0x5c9408['query'],_0x2ade01[_0x784e('0x44')]));_0x5bf447[_0x784e('0x85')][_0x784e('0xb5')]=_0x14f194['id'];if(_0x5c9408[_0x784e('0x43')][_0x784e('0x8e')]){_0x5bf447[_0x784e('0x85')]=_[_0x784e('0xa3')](_0x5bf447['where'],{'$or':_['map'](_0x5bf447['attributes'],function(_0x52fa6d){var _0x2e5384={};_0x2e5384[_0x52fa6d]={'$like':'%'+_0x5c9408[_0x784e('0x43')][_0x784e('0x8e')]+'%'};return _0x2e5384;})});}_0x5bf447[_0x784e('0x85')][_0x784e('0xe8')]=![];if(_0x5c9408['query']['id']){_0x5bf447[_0x784e('0x85')]['id']={'$gt':_0x5c9408['query']['id']};}_0x5bf447=_[_0x784e('0xa3')]({},_0x5bf447,_0x5c9408[_0x784e('0xbc')]);return db[_0x784e('0xd7')][_0x784e('0x2e')]({'where':_0x5bf447[_0x784e('0x85')]})['then'](function(_0xfb33d){_0x248ea9[_0x784e('0x2e')]=_0xfb33d;_0x5bf447['include']=[];if(_0x5c9408['query']['includeAgent']){_0x5bf447[_0x784e('0xbb')][_0x784e('0x3d')]({'model':db[_0x784e('0x75')],'as':_0x784e('0x75'),'attributes':['id',_0x784e('0xe3'),_0x784e('0xe2')]});}if(_0x5c9408['query']['includeAll']){_0x5bf447[_0x784e('0xbb')]=[{'all':!![]}];}return db[_0x784e('0xd7')]['findAll'](_0x5bf447);})[_0x784e('0x21')](function(_0x4cbd1b){_0x248ea9[_0x784e('0xb7')]=_0x4cbd1b;return _0x248ea9;});}})[_0x784e('0x21')](respondWithFilteredResult(_0x8c778f,_0x5bf447))[_0x784e('0x2a')](handleError(_0x8c778f,null));};exports['addTags']=function(_0x3dc0e2,_0x225c9a,_0x3f325f){return db[_0x784e('0xa4')][_0x784e('0x64')]({'where':{'id':_0x3dc0e2[_0x784e('0xb9')]['id']}})['then'](handleEntityNotFound(_0x225c9a,null))['then'](function(_0x64c755){if(_0x64c755){return _0x64c755[_0x784e('0xfb')](_0x3dc0e2[_0x784e('0x79')][_0x784e('0xfc')],_[_0x784e('0xfd')](_0x3dc0e2[_0x784e('0x79')],['ids','id'])||{})[_0x784e('0xfe')](function(){return db[_0x784e('0xff')]['findAll']({'attributes':['id',_0x784e('0x36'),'color'],'where':{'id':_0x3dc0e2[_0x784e('0x79')][_0x784e('0xfc')]}});})[_0x784e('0x21')](function(_0x43485c){socket[_0x784e('0x100')](_0x784e('0x101'),{'id':Number(_0x3dc0e2[_0x784e('0xb9')]['id']),'tags':_0x43485c||[]});return{'id':Number(_0x3dc0e2[_0x784e('0xb9')]['id']),'tags':_0x43485c||[]};});}})['then'](respondWithResult(_0x225c9a,null))[_0x784e('0x2a')](handleError(_0x225c9a,null));};exports[_0x784e('0x102')]=function(_0x20ff96,_0x291c9b,_0x3885a2){return db['ChatInteraction'][_0x784e('0x64')]({'where':{'id':_0x20ff96['params']['id']}})['then'](handleEntityNotFound(_0x291c9b,null))[_0x784e('0x21')](function(_0x28819e){if(_0x28819e){return _0x28819e[_0x784e('0x102')](_0x20ff96[_0x784e('0x43')][_0x784e('0xfc')]);}})[_0x784e('0x21')](respondWithStatusCode(_0x291c9b,null))['catch'](handleError(_0x291c9b,null));};exports[_0x784e('0xce')]=function(_0x32b484,_0x345b53){var _0x803011=moment()[_0x784e('0x103')]()[_0x784e('0xa2')]();var _0x5a35ae=path[_0x784e('0xcf')](config[_0x784e('0xd0')],'server','files',_0x784e('0x104'));var _0xc8ffee=path[_0x784e('0xcf')](config[_0x784e('0xd0')],_0x784e('0x105'),_0x784e('0x106'),_0x784e('0x107'));var _0x568cd5=path['join'](_0x5a35ae,_0x803011);var _0x1dba3c=util[_0x784e('0xd4')](_0x784e('0x108'),_0x32b484[_0x784e('0xb9')]['id'],_0x803011);var _0x42b7de=path[_0x784e('0xcf')](_0x5a35ae,_0x1dba3c);var _0x1f3dfa=[];_0x1f3dfa['push']({'model':db['User'],'as':_0x784e('0x75'),'attributes':['id',_0x784e('0xe3')],'raw':!![]});_0x1f3dfa[_0x784e('0x3d')]({'model':db['CmContact'],'as':_0x784e('0x6a'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x32b484[_0x784e('0x43')][_0x784e('0x107')]){_0x1f3dfa[_0x784e('0x3d')]({'model':db[_0x784e('0xca')],'as':_0x784e('0xca'),'raw':!![]});}var _0x46e3a0=[{'model':db[_0x784e('0xd7')],'as':_0x784e('0xd8'),'attributes':['id',_0x784e('0x79'),_0x784e('0x81'),'direction','secret','read'],'include':_0x1f3dfa}];_0x46e3a0[_0x784e('0x3d')]({'model':db[_0x784e('0xd9')],'as':_0x784e('0x109'),'attributes':['id','name']});_0x46e3a0[_0x784e('0x3d')]({'model':db[_0x784e('0x75')],'as':'Owner','attributes':['id',_0x784e('0xe3')]});return db['ChatInteraction'][_0x784e('0x64')]({'where':{'id':_0x32b484[_0x784e('0xb9')]['id']},'include':_0x46e3a0})[_0x784e('0x21')](handleEntityNotFound(_0x345b53,null))[_0x784e('0x21')](function(_0x338594){if(_0x338594){var _0x2dbe7a=_0x338594[_0x784e('0x10a')]({'plain':!![]});fs[_0x784e('0x10b')](_0x568cd5);var _0x2ff394={'format':'A4','border':_0x784e('0x10c'),'header':{'height':_0x784e('0x10d'),'contents':{'first':_0x784e('0x10e')}},'footer':{'height':'30px','contents':{'default':util[_0x784e('0xd4')](_0x784e('0x10f'),util[_0x784e('0xd4')]('%s\x20#%d',_0x784e('0x110'),_0x2dbe7a['id']),moment()[_0x784e('0xd4')](_0x784e('0x111'))['toString']())}}};var _0x43960e={'channel':'Chat','account':_0x2dbe7a['Account'][_0x784e('0x36')],'agent':_0x2dbe7a[_0x784e('0x112')]?_0x2dbe7a[_0x784e('0x112')][_0x784e('0xe3')]:_0x784e('0x113'),'createdAt':moment(_0x2dbe7a[_0x784e('0x81')])[_0x784e('0xd4')](_0x784e('0xf9'))[_0x784e('0xa2')](),'closedAt':_0x2dbe7a[_0x784e('0xc3')]?moment(_0x2dbe7a[_0x784e('0x114')])[_0x784e('0xd4')](_0x784e('0xf9'))[_0x784e('0xa2')]():'','disposition':_0x2dbe7a[_0x784e('0xc4')],'chatInfo':{'browser':_0x2dbe7a[_0x784e('0x115')],'os':_0x2dbe7a[_0x784e('0x116')],'referer':_0x2dbe7a['referer'],'customerIp':_0x2dbe7a[_0x784e('0x117')],'customerPort':_0x2dbe7a[_0x784e('0x118')]?_0x2dbe7a['customerPort']:_0x784e('0x113')},'messages':_(_0x2dbe7a['Messages'])[_0x784e('0x119')]()[_0x784e('0x8e')]({'secret':![]})[_0x784e('0x39')](function(_0x46603a){if(_0x46603a['Attachment']){var _0x504a52=path[_0x784e('0xcf')](_0xc8ffee,_0x46603a[_0x784e('0xca')][_0x784e('0xc7')]);if(fs[_0x784e('0x11a')](_0x504a52)){fs['createReadStream'](_0x504a52)[_0x784e('0x11b')](fs['createWriteStream'](path[_0x784e('0xcf')](_0x568cd5,_0x46603a[_0x784e('0xca')][_0x784e('0xc7')])));}}return{'date':moment(_0x46603a['createdAt'])[_0x784e('0xd4')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x46603a[_0x784e('0xe7')]===_0x784e('0x11c')?_0x46603a[_0x784e('0x75')]?_0x46603a['User'][_0x784e('0xe3')]:'System':_0x46603a[_0x784e('0x6a')]['firstName']+(_0x46603a[_0x784e('0x6a')][_0x784e('0x11d')]?'\x20'+_0x46603a[_0x784e('0x6a')][_0x784e('0x11d')]:''),'body':_0x46603a[_0x784e('0xca')]?_0x46603a[_0x784e('0xca')][_0x784e('0xc7')]:_0x46603a[_0x784e('0x79')],'direction':_0x46603a[_0x784e('0xe7')]===_0x784e('0x11c')?'A':'C','secret':_0x46603a['secret'],'read':_0x46603a[_0x784e('0x8a')],'attachment':_0x46603a[_0x784e('0xca')]};})[_0x784e('0x66')]()};return ejs[_0x784e('0x11e')](path[_0x784e('0xcf')](config[_0x784e('0xd0')],_0x784e('0x105'),_0x784e('0x11f'),_0x784e('0x120')),{'interaction':_0x43960e})[_0x784e('0x21')](function(_0x2dfe52){return new BPromise(function(_0x2a9812,_0x200814){pdf[_0x784e('0xbd')](_0x2dfe52,_0x2ff394)[_0x784e('0x121')](path[_0x784e('0xcf')](_0x568cd5,'transcript-'+_0x2dbe7a['id']+'-'+_0x803011+_0x784e('0x122')),function(_0x4689e7,_0x506588){if(_0x4689e7)return _0x200814(_0x4689e7);_0x2a9812(_0x506588);});});})['then'](function(){return new BPromise(function(_0x222523,_0x2d261c){zipdir(_0x568cd5,{'saveTo':_0x42b7de},function(_0x4e8662,_0x117c2e){if(_0x4e8662)return _0x2d261c(_0x4e8662);return _0x222523(_0x117c2e);});})[_0x784e('0x21')](function(){return new BPromise(function(_0x4fa6c3,_0x1b709c){rimraf(_0x568cd5,function(_0x27c406){if(_0x27c406)_0x1b709c(_0x27c406);return _0x4fa6c3();});});})['then'](function(){return _0x345b53[_0x784e('0xce')](_0x42b7de,_0x1dba3c,function(_0x153fab){if(_0x153fab){console[_0x784e('0x123')](_0x784e('0x124'),_0x153fab);}else{fs['unlinkSync'](_0x42b7de);}});});});}else{return _0x345b53[_0x784e('0x2b')](0xc8);}})[_0x784e('0x2a')](handleError(_0x345b53,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 8be9fc1..bc213d7 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 _0xbb4d=['map','findAll','length','emit','catch','hasOwnProperty','hook','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','Users'];(function(_0x10f168,_0x2c7474){var _0x54bb66=function(_0x5e88c3){while(--_0x5e88c3){_0x10f168['push'](_0x10f168['shift']());}};_0x54bb66(++_0x2c7474);}(_0xbb4d,0x19f));var _0xdbb4=function(_0x259b25,_0x37fe57){_0x259b25=_0x259b25-0x0;var _0x531cad=_0xbb4d[_0x259b25];return _0x531cad;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0xdbb4('0x0'))['db'][_0xdbb4('0x1')];var ChatMessage=require(_0xdbb4('0x0'))['db'][_0xdbb4('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xdbb4('0x3')](0x0);var events={'afterCreate':_0xdbb4('0x4'),'afterUpdate':'update','afterDestroy':_0xdbb4('0x5')};function emitEvent(_0x38fb8f){return function(_0x32b8ed,_0xdeed84,_0x584d4d){_0x32b8ed[_0xdbb4('0x6')]({'attributes':['id'],'raw':!![]})[_0xdbb4('0x7')](function(_0x3ff7d2){_0x32b8ed[_0xdbb4('0x8')](_0xdbb4('0x9'),_0x3ff7d2[_0xdbb4('0xa')](function(_0x5c8216){return{'id':_0x5c8216['id']};}));return ChatMessage[_0xdbb4('0xb')]({'where':{'ChatInteractionId':_0x32b8ed['id'],'direction':'in','read':![]},'raw':!![]});})[_0xdbb4('0x7')](function(_0x429227){_0x32b8ed[_0xdbb4('0x8')]('unreadMessages',_0x429227[_0xdbb4('0xc')]);ChatInteractionEvents[_0xdbb4('0xd')](_0x38fb8f+':'+_0x32b8ed['id'],_0x32b8ed);ChatInteractionEvents[_0xdbb4('0xd')](_0x38fb8f,_0x32b8ed);_0x584d4d(null);})[_0xdbb4('0xe')](_0x584d4d(null));};}for(var e in events){if(events[_0xdbb4('0xf')](e)){var event=events[e];ChatInteraction[_0xdbb4('0x10')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0x9108=['remove','getUsers','then','Users','map','setDataValue','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save'];(function(_0x1a65ac,_0x2f682c){var _0x1fea57=function(_0x2a22db){while(--_0x2a22db){_0x1a65ac['push'](_0x1a65ac['shift']());}};_0x1fea57(++_0x2f682c);}(_0x9108,0x1d6));var _0x8910=function(_0x1428a7,_0x17f607){_0x1428a7=_0x1428a7-0x0;var _0xcabdf2=_0x9108[_0x1428a7];return _0xcabdf2;};'use strict';var EventEmitter=require(_0x8910('0x0'));var ChatInteraction=require(_0x8910('0x1'))['db'][_0x8910('0x2')];var ChatMessage=require(_0x8910('0x1'))['db'][_0x8910('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x8910('0x4')](0x0);var events={'afterCreate':_0x8910('0x5'),'afterUpdate':'update','afterDestroy':_0x8910('0x6')};function emitEvent(_0x236ac3){return function(_0x133c27,_0x5b5f39,_0x39147){_0x133c27[_0x8910('0x7')]({'attributes':['id'],'raw':!![]})[_0x8910('0x8')](function(_0x3c0c67){_0x133c27['setDataValue'](_0x8910('0x9'),_0x3c0c67[_0x8910('0xa')](function(_0x142b0f){return{'id':_0x142b0f['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x133c27['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8910('0x8')](function(_0x5a6bec){_0x133c27[_0x8910('0xb')]('unreadMessages',_0x5a6bec[_0x8910('0xc')]);ChatInteractionEvents[_0x8910('0xd')](_0x236ac3+':'+_0x133c27['id'],_0x133c27);ChatInteractionEvents[_0x8910('0xd')](_0x236ac3,_0x133c27);_0x39147(null);})['catch'](_0x39147(null));};}for(var e in events){if(events[_0x8910('0xe')](e)){var event=events[e];ChatInteraction[_0x8910('0xf')](e,emitEvent(event));}}module[_0x8910('0x10')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 17bd2f9..d395daf 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 _0x3972=['moment','bluebird','request-promise','../../config/environment','exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x5dcbc9,_0x258bef){var _0x427be4=function(_0xf4eb5a){while(--_0xf4eb5a){_0x5dcbc9['push'](_0x5dcbc9['shift']());}};_0x427be4(++_0x258bef);}(_0x3972,0x152));var _0x2397=function(_0x18f988,_0x439998){_0x18f988=_0x18f988-0x0;var _0x7d4d43=_0x3972[_0x18f988];return _0x7d4d43;};'use strict';var _=require(_0x2397('0x0'));var util=require('util');var logger=require(_0x2397('0x1'))('api');var moment=require(_0x2397('0x2'));var BPromise=require(_0x2397('0x3'));var rp=require(_0x2397('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2397('0x5'));var attributes=require('./chatInteraction.attributes');module[_0x2397('0x6')]=function(_0x3bd2ee,_0x3795df){return _0x3bd2ee[_0x2397('0x7')](_0x2397('0x8'),attributes,{'tableName':_0x2397('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x25fd35,_0x474ec0,_0x3596e9){if(_0x25fd35[_0x2397('0xa')](_0x2397('0xb'))){_0x25fd35[_0x2397('0xc')]=moment()[_0x2397('0xd')](_0x2397('0xe'));}_0x3596e9(null,_0x25fd35);}},'charset':_0x2397('0xf'),'collate':_0x2397('0x10')});}; \ No newline at end of file +var _0x72eb=['closed','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','chat_interactions','changed'];(function(_0x19318e,_0x46c067){var _0x425540=function(_0xb4e055){while(--_0xb4e055){_0x19318e['push'](_0x19318e['shift']());}};_0x425540(++_0x46c067);}(_0x72eb,0x1b3));var _0xb72e=function(_0x58f3ed,_0x157a58){_0x58f3ed=_0x58f3ed-0x0;var _0x5e6ba1=_0x72eb[_0x58f3ed];return _0x5e6ba1;};'use strict';var _=require(_0xb72e('0x0'));var util=require(_0xb72e('0x1'));var logger=require(_0xb72e('0x2'))(_0xb72e('0x3'));var moment=require(_0xb72e('0x4'));var BPromise=require(_0xb72e('0x5'));var rp=require(_0xb72e('0x6'));var fs=require('fs');var path=require(_0xb72e('0x7'));var rimraf=require(_0xb72e('0x8'));var config=require(_0xb72e('0x9'));var attributes=require(_0xb72e('0xa'));module[_0xb72e('0xb')]=function(_0x2e6f26,_0x47a760){return _0x2e6f26[_0xb72e('0xc')]('ChatInteraction',attributes,{'tableName':_0xb72e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x39a962,_0x1cb308,_0x1a1aaa){if(_0x39a962[_0xb72e('0xe')](_0xb72e('0xf'))){_0x39a962['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x1a1aaa(null,_0x39a962);}},'charset':_0xb72e('0x10'),'collate':_0xb72e('0x11')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 377a1d6..48e2a74 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 _0x4218=['AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','localhost','socket.io-emitter','redis','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateChatInteraction','ChatInteraction','update','options','raw','where','limit','debug','AddTagsToChatInteraction','find','addTags','body','omit','ids','spread'];(function(_0x5c0f10,_0x156f30){var _0x47cf65=function(_0x53d8b1){while(--_0x53d8b1){_0x5c0f10['push'](_0x5c0f10['shift']());}};_0x47cf65(++_0x156f30);}(_0x4218,0x127));var _0x8421=function(_0x5e3f02,_0x407aae){_0x5e3f02=_0x5e3f02-0x0;var _0x594f19=_0x4218[_0x5e3f02];return _0x594f19;};'use strict';var _=require(_0x8421('0x0'));var util=require(_0x8421('0x1'));var moment=require(_0x8421('0x2'));var BPromise=require('bluebird');var rs=require(_0x8421('0x3'));var fs=require('fs');var Redis=require(_0x8421('0x4'));var db=require(_0x8421('0x5'))['db'];var utils=require(_0x8421('0x6'));var logger=require(_0x8421('0x7'))(_0x8421('0x8'));var config=require('../../config/environment');var jayson=require(_0x8421('0x9'));var client=jayson[_0x8421('0xa')][_0x8421('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x8421('0xc'),'port':0x18eb});var socket=require(_0x8421('0xd'))(new Redis(config[_0x8421('0xe')]));require('./chatInteraction.socket')[_0x8421('0xf')](socket);function respondWithRpcPromise(_0x18b391,_0x4de64a,_0x4c9124){return new BPromise(function(_0x432398,_0x44f8d9){return client[_0x8421('0x10')](_0x18b391,_0x4c9124)[_0x8421('0x11')](function(_0x48802c){logger[_0x8421('0x12')](_0x8421('0x13'),_0x4de64a,_0x8421('0x14'));logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x4de64a,'request\x20sent',JSON[_0x8421('0x15')](_0x48802c));if(_0x48802c[_0x8421('0x16')]){if(_0x48802c['error'][_0x8421('0x17')]===0x1f4){logger[_0x8421('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x4de64a,_0x48802c[_0x8421('0x16')][_0x8421('0x18')]);return _0x44f8d9(_0x48802c[_0x8421('0x16')][_0x8421('0x18')]);}logger['error'](_0x8421('0x13'),_0x4de64a,_0x48802c[_0x8421('0x16')][_0x8421('0x18')]);return _0x432398(_0x48802c[_0x8421('0x16')][_0x8421('0x18')]);}else{logger[_0x8421('0x12')](_0x8421('0x13'),_0x4de64a,_0x8421('0x14'));_0x432398(_0x48802c['result']['message']);}})[_0x8421('0x19')](function(_0x18cfd9){logger[_0x8421('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x4de64a,_0x18cfd9);_0x44f8d9(_0x18cfd9);});});}exports[_0x8421('0x1a')]=function(_0x2ad392){var _0x591290=this;return new Promise(function(_0x45d5bc,_0x550756){return db[_0x8421('0x1b')][_0x8421('0x1c')](_0x2ad392['body'],{'raw':_0x2ad392[_0x8421('0x1d')]?_0x2ad392[_0x8421('0x1d')][_0x8421('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ad392['options']?_0x2ad392[_0x8421('0x1d')][_0x8421('0x1f')]||null:null,'attributes':_0x2ad392[_0x8421('0x1d')]?_0x2ad392[_0x8421('0x1d')]['attributes']||null:null,'limit':_0x2ad392['options']?_0x2ad392['options'][_0x8421('0x20')]||null:null})[_0x8421('0x11')](function(_0x2ea2d9){logger[_0x8421('0x12')]('UpdateChatInteraction',_0x2ad392);logger[_0x8421('0x21')](_0x8421('0x1a'),_0x2ad392,JSON[_0x8421('0x15')](_0x2ea2d9));_0x45d5bc(_0x2ea2d9);})[_0x8421('0x19')](function(_0x1904d3){logger[_0x8421('0x16')](_0x8421('0x1a'),_0x1904d3[_0x8421('0x18')],_0x2ad392);_0x550756(_0x591290[_0x8421('0x16')](0x1f4,_0x1904d3[_0x8421('0x18')]));});});};exports[_0x8421('0x22')]=function(_0x79caf5){return new Promise(function(_0x531959,_0x50f78a){return db[_0x8421('0x1b')][_0x8421('0x23')]({'where':_0x79caf5[_0x8421('0x1d')]?_0x79caf5['options'][_0x8421('0x1f')]||null:null})[_0x8421('0x11')](function(_0x4471a8){if(_0x4471a8){return _0x4471a8[_0x8421('0x24')](_0x79caf5[_0x8421('0x25')]['ids'],_[_0x8421('0x26')](_0x79caf5[_0x8421('0x25')],[_0x8421('0x27'),'id'])||{});}})[_0x8421('0x28')](function(_0x1c4e85){logger[_0x8421('0x12')](_0x8421('0x29'),_0x79caf5);logger[_0x8421('0x21')](_0x8421('0x29'),_0x79caf5,JSON[_0x8421('0x15')](_0x1c4e85));_0x531959(_0x1c4e85);})[_0x8421('0x19')](function(_0x121a01){logger[_0x8421('0x16')]('AddTags',_0x121a01[_0x8421('0x18')],_0x79caf5);_0x50f78a(_this[_0x8421('0x16')](0x1f4,_0x121a01[_0x8421('0x18')]));});});}; \ No newline at end of file +var _0xd5f5=['../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','./chatInteraction.socket','register','request','then','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','raw','options','where','info','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xd5f5,0xc2));var _0x5d5f=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xd5f5[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x5d5f('0x0'));var util=require(_0x5d5f('0x1'));var moment=require(_0x5d5f('0x2'));var BPromise=require('bluebird');var rs=require(_0x5d5f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5d5f('0x4'))['db'];var utils=require(_0x5d5f('0x5'));var logger=require(_0x5d5f('0x6'))(_0x5d5f('0x7'));var config=require(_0x5d5f('0x8'));var jayson=require(_0x5d5f('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x5d5f('0xa')]=_[_0x5d5f('0xb')](config[_0x5d5f('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5d5f('0xc'))[_0x5d5f('0xd')](socket);function respondWithRpcPromise(_0x102447,_0x5ca965,_0x5df523){return new BPromise(function(_0x292fab,_0x42effe){return client[_0x5d5f('0xe')](_0x102447,_0x5df523)[_0x5d5f('0xf')](function(_0x5c88e3){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x5ca965,_0x5d5f('0x10'));logger[_0x5d5f('0x11')](_0x5d5f('0x12'),_0x5ca965,'request\x20sent',JSON[_0x5d5f('0x13')](_0x5c88e3));if(_0x5c88e3[_0x5d5f('0x14')]){if(_0x5c88e3[_0x5d5f('0x14')][_0x5d5f('0x15')]===0x1f4){logger[_0x5d5f('0x14')](_0x5d5f('0x16'),_0x5ca965,_0x5c88e3['error'][_0x5d5f('0x17')]);return _0x42effe(_0x5c88e3['error'][_0x5d5f('0x17')]);}logger[_0x5d5f('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x5ca965,_0x5c88e3['error'][_0x5d5f('0x17')]);return _0x292fab(_0x5c88e3['error']['message']);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x5ca965,_0x5d5f('0x10'));_0x292fab(_0x5c88e3[_0x5d5f('0x18')][_0x5d5f('0x17')]);}})[_0x5d5f('0x19')](function(_0x2a2d05){logger[_0x5d5f('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x5ca965,_0x2a2d05);_0x42effe(_0x2a2d05);});});}exports[_0x5d5f('0x1a')]=function(_0x8bd3a9){var _0x423e9f=this;return new Promise(function(_0x370218,_0x203e31){return db[_0x5d5f('0x1b')][_0x5d5f('0x1c')](_0x8bd3a9[_0x5d5f('0x1d')],{'raw':_0x8bd3a9['options']?_0x8bd3a9['options'][_0x5d5f('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8bd3a9[_0x5d5f('0x1f')]?_0x8bd3a9[_0x5d5f('0x1f')][_0x5d5f('0x20')]||null:null,'attributes':_0x8bd3a9[_0x5d5f('0x1f')]?_0x8bd3a9[_0x5d5f('0x1f')]['attributes']||null:null,'limit':_0x8bd3a9[_0x5d5f('0x1f')]?_0x8bd3a9[_0x5d5f('0x1f')]['limit']||null:null})['then'](function(_0x3402c1){logger[_0x5d5f('0x21')](_0x5d5f('0x1a'),_0x8bd3a9);logger[_0x5d5f('0x11')](_0x5d5f('0x1a'),_0x8bd3a9,JSON[_0x5d5f('0x13')](_0x3402c1));_0x370218(_0x3402c1);})[_0x5d5f('0x19')](function(_0x131fc0){logger[_0x5d5f('0x14')](_0x5d5f('0x1a'),_0x131fc0[_0x5d5f('0x17')],_0x8bd3a9);_0x203e31(_0x423e9f['error'](0x1f4,_0x131fc0[_0x5d5f('0x17')]));});});};exports['AddTagsToChatInteraction']=function(_0x4c495f){return new Promise(function(_0x672981,_0x208bfe){return db[_0x5d5f('0x1b')][_0x5d5f('0x22')]({'where':_0x4c495f[_0x5d5f('0x1f')]?_0x4c495f[_0x5d5f('0x1f')]['where']||null:null})[_0x5d5f('0xf')](function(_0x428b63){if(_0x428b63){return _0x428b63[_0x5d5f('0x23')](_0x4c495f[_0x5d5f('0x1d')][_0x5d5f('0x24')],_[_0x5d5f('0x25')](_0x4c495f[_0x5d5f('0x1d')],[_0x5d5f('0x24'),'id'])||{});}})[_0x5d5f('0x26')](function(_0x223289){logger[_0x5d5f('0x21')](_0x5d5f('0x27'),_0x4c495f);logger[_0x5d5f('0x11')](_0x5d5f('0x27'),_0x4c495f,JSON[_0x5d5f('0x13')](_0x223289));_0x672981(_0x223289);})[_0x5d5f('0x19')](function(_0x112702){logger[_0x5d5f('0x14')](_0x5d5f('0x27'),_0x112702[_0x5d5f('0x17')],_0x4c495f);_0x208bfe(_this[_0x5d5f('0x14')](0x1f4,_0x112702[_0x5d5f('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index f5562e2..4a6c0c0 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 _0xfbcb=['length','chatInteraction:','./chatInteraction.events','save','remove','emit','register'];(function(_0x1703c6,_0x42c17f){var _0x5e0b6d=function(_0x400189){while(--_0x400189){_0x1703c6['push'](_0x1703c6['shift']());}};_0x5e0b6d(++_0x42c17f);}(_0xfbcb,0x18a));var _0xbfbc=function(_0x54ceab,_0x5addfc){_0x54ceab=_0x54ceab-0x0;var _0x1e4e18=_0xfbcb[_0x54ceab];return _0x1e4e18;};'use strict';var ChatInteractionEvents=require(_0xbfbc('0x0'));var events=[_0xbfbc('0x1'),_0xbfbc('0x2'),'update'];function createListener(_0x2fac03,_0x35c2c7){return function(_0xcdd87e){_0x35c2c7[_0xbfbc('0x3')](_0x2fac03,_0xcdd87e);};}function removeListener(_0x4825ac,_0xa8985e){return function(){ChatInteractionEvents['removeListener'](_0x4825ac,_0xa8985e);};}exports[_0xbfbc('0x4')]=function(_0x34183a){for(var _0x116c43=0x0,_0x391f6c=events[_0xbfbc('0x5')];_0x116c43<_0x391f6c;_0x116c43++){var _0x244901=events[_0x116c43];var _0x3e9bc9=createListener(_0xbfbc('0x6')+_0x244901,_0x34183a);ChatInteractionEvents['on'](_0x244901,_0x3e9bc9);}}; \ No newline at end of file +var _0xbdef=['update','emit','removeListener','register','chatInteraction:','./chatInteraction.events','save','remove'];(function(_0x4cba56,_0x5b2c44){var _0x3cc9f3=function(_0x5bb80a){while(--_0x5bb80a){_0x4cba56['push'](_0x4cba56['shift']());}};_0x3cc9f3(++_0x5b2c44);}(_0xbdef,0xcd));var _0xfbde=function(_0x127116,_0x2f5d05){_0x127116=_0x127116-0x0;var _0x48acf8=_0xbdef[_0x127116];return _0x48acf8;};'use strict';var ChatInteractionEvents=require(_0xfbde('0x0'));var events=[_0xfbde('0x1'),_0xfbde('0x2'),_0xfbde('0x3')];function createListener(_0x31a40d,_0x30332b){return function(_0x14a01d){_0x30332b[_0xfbde('0x4')](_0x31a40d,_0x14a01d);};}function removeListener(_0x424397,_0xc7356e){return function(){ChatInteractionEvents[_0xfbde('0x5')](_0x424397,_0xc7356e);};}exports[_0xfbde('0x6')]=function(_0x25a0e4){for(var _0x498551=0x0,_0x2fb1c6=events['length'];_0x498551<_0x2fb1c6;_0x498551++){var _0x3ba851=events[_0x498551];var _0x1acd42=createListener(_0xfbde('0x7')+_0x3ba851,_0x25a0e4);ChatInteractionEvents['on'](_0x3ba851,_0x1acd42);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 1af48a8..ec0ce1b 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 _0x9038=['describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','post','create','diskStorage','server/files/attachments/','format','%s-%s','now','replace','/:id/attachment_upload','file','addMessage','/:id/tags','chatinteraction:addtags','put','chat','/:id/custom_update','customUpdate','/:id/abandon','/:id/close','close','delete','tracked','chatinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','/describe'];(function(_0x5a92eb,_0x25c5c1){var _0x28ea30=function(_0x3f5056){while(--_0x3f5056){_0x5a92eb['push'](_0x5a92eb['shift']());}};_0x28ea30(++_0x25c5c1);}(_0x9038,0x1d4));var _0x8903=function(_0x1506be,_0x114985){_0x1506be=_0x1506be-0x0;var _0x4de90d=_0x9038[_0x1506be];return _0x4de90d;};'use strict';var multer=require(_0x8903('0x0'));var util=require(_0x8903('0x1'));var path=require(_0x8903('0x2'));var timeout=require(_0x8903('0x3'));var express=require('express');var router=express[_0x8903('0x4')]();var auth=require(_0x8903('0x5'));var interaction=require(_0x8903('0x6'));var config=require(_0x8903('0x7'));var controller=require(_0x8903('0x8'));router[_0x8903('0x9')]('/',auth[_0x8903('0xa')](),controller['index']);router[_0x8903('0x9')](_0x8903('0xb'),auth['isAuthenticated'](),controller[_0x8903('0xc')]);router[_0x8903('0x9')](_0x8903('0xd'),auth[_0x8903('0xe')](),controller['show']);router[_0x8903('0x9')](_0x8903('0xf'),auth[_0x8903('0xe')](),controller[_0x8903('0x10')]);router[_0x8903('0x9')](_0x8903('0x11'),auth[_0x8903('0xa')](),controller[_0x8903('0x12')]);router[_0x8903('0x9')](_0x8903('0x13'),auth[_0x8903('0xe')](),controller[_0x8903('0x14')]);router[_0x8903('0x9')](_0x8903('0x15'),auth[_0x8903('0xa')](),controller['download']);router[_0x8903('0x16')]('/',auth[_0x8903('0xa')](),controller[_0x8903('0x17')]);var upload=multer({'storage':multer[_0x8903('0x18')]({'destination':function(_0x555878,_0x538cc5,_0x305a01){_0x305a01(null,path['join'](config['root'],_0x8903('0x19')));},'filename':function(_0x41c2db,_0x49133b,_0x448c59){_0x448c59(null,util[_0x8903('0x1a')](_0x8903('0x1b'),Date[_0x8903('0x1c')](),_0x49133b['originalname'][_0x8903('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x8903('0x1e'),upload['single'](_0x8903('0x1f')),controller['attachmentUpload']);router[_0x8903('0x16')](_0x8903('0x11'),auth['isChatInteractionAuthorized'](),controller[_0x8903('0x20')]);router[_0x8903('0x16')](_0x8903('0x21'),auth[_0x8903('0xa')](),interaction['tracked']('chat',_0x8903('0x22')),controller['addTags']);router[_0x8903('0x23')](_0x8903('0xd'),auth[_0x8903('0xa')](),interaction['tracked'](_0x8903('0x24'),'chatinteraction:update'),controller['update']);router[_0x8903('0x23')](_0x8903('0x25'),controller[_0x8903('0x26')]);router[_0x8903('0x23')](_0x8903('0x27'),auth[_0x8903('0xe')](),controller['abandon']);router[_0x8903('0x23')](_0x8903('0x28'),controller[_0x8903('0x29')]);router[_0x8903('0x2a')](_0x8903('0xd'),auth[_0x8903('0xa')](),interaction[_0x8903('0x2b')]('chat',_0x8903('0x2c')),controller[_0x8903('0x2d')]);router[_0x8903('0x2a')](_0x8903('0x21'),auth[_0x8903('0xa')](),controller[_0x8903('0x2e')]);module[_0x8903('0x2f')]=router; \ No newline at end of file +var _0x4ac6=['put','tracked','chatinteraction:update','/:id/custom_update','customUpdate','/:id/abandon','/:id/close','delete','chat','removeTags','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','isAuthenticated','index','get','/describe','/:id','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','download','post','create','diskStorage','join','root','server/files/attachments/','format','now','replace','/:id/attachment_upload','single','file','addMessage','/:id/tags','chatinteraction:addtags'];(function(_0x256664,_0x4b7963){var _0x520773=function(_0x2d006d){while(--_0x2d006d){_0x256664['push'](_0x256664['shift']());}};_0x520773(++_0x4b7963);}(_0x4ac6,0x1a9));var _0x64ac=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4ac6[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x64ac('0x0'));var util=require(_0x64ac('0x1'));var path=require(_0x64ac('0x2'));var timeout=require(_0x64ac('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x64ac('0x4'));var interaction=require(_0x64ac('0x5'));var config=require(_0x64ac('0x6'));var controller=require(_0x64ac('0x7'));router['get']('/',auth[_0x64ac('0x8')](),controller[_0x64ac('0x9')]);router[_0x64ac('0xa')](_0x64ac('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x64ac('0xa')](_0x64ac('0xc'),auth[_0x64ac('0xd')](),controller['show']);router[_0x64ac('0xa')]('/:id/attachment_download',auth['isChatInteractionAuthorized'](),controller[_0x64ac('0xe')]);router[_0x64ac('0xa')](_0x64ac('0xf'),auth[_0x64ac('0x8')](),controller[_0x64ac('0x10')]);router[_0x64ac('0xa')](_0x64ac('0x11'),auth['isChatInteractionAuthorized'](),controller[_0x64ac('0x12')]);router[_0x64ac('0xa')]('/:id/download',auth[_0x64ac('0x8')](),controller[_0x64ac('0x13')]);router[_0x64ac('0x14')]('/',auth[_0x64ac('0x8')](),controller[_0x64ac('0x15')]);var upload=multer({'storage':multer[_0x64ac('0x16')]({'destination':function(_0x48b378,_0x5c0c8e,_0x9d68ce){_0x9d68ce(null,path[_0x64ac('0x17')](config[_0x64ac('0x18')],_0x64ac('0x19')));},'filename':function(_0x5c6b64,_0x5a56f8,_0x1be4cf){_0x1be4cf(null,util[_0x64ac('0x1a')]('%s-%s',Date[_0x64ac('0x1b')](),_0x5a56f8['originalname'][_0x64ac('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x64ac('0x14')](_0x64ac('0x1d'),upload[_0x64ac('0x1e')](_0x64ac('0x1f')),controller['attachmentUpload']);router[_0x64ac('0x14')]('/:id/messages',auth[_0x64ac('0xd')](),controller[_0x64ac('0x20')]);router[_0x64ac('0x14')](_0x64ac('0x21'),auth[_0x64ac('0x8')](),interaction['tracked']('chat',_0x64ac('0x22')),controller['addTags']);router[_0x64ac('0x23')]('/:id',auth[_0x64ac('0x8')](),interaction[_0x64ac('0x24')]('chat',_0x64ac('0x25')),controller['update']);router[_0x64ac('0x23')](_0x64ac('0x26'),controller[_0x64ac('0x27')]);router[_0x64ac('0x23')](_0x64ac('0x28'),auth[_0x64ac('0xd')](),controller['abandon']);router[_0x64ac('0x23')](_0x64ac('0x29'),controller['close']);router[_0x64ac('0x2a')](_0x64ac('0xc'),auth[_0x64ac('0x8')](),interaction[_0x64ac('0x24')](_0x64ac('0x2b'),'chatinteraction:destroy'),controller['destroy']);router[_0x64ac('0x2a')](_0x64ac('0x21'),auth['isAuthenticated'](),controller[_0x64ac('0x2c')]);module[_0x64ac('0x2d')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 18cdf60..1e26556 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 _0x57ca=['exports','TEXT','BOOLEAN','INTEGER'];(function(_0x56ee7a,_0x21d880){var _0x8594e7=function(_0x14a049){while(--_0x14a049){_0x56ee7a['push'](_0x56ee7a['shift']());}};_0x8594e7(++_0x21d880);}(_0x57ca,0x108));var _0xa57c=function(_0x24b9c5,_0x2672cd){_0x24b9c5=_0x24b9c5-0x0;var _0x27fd24=_0x57ca[_0x24b9c5];return _0x27fd24;};'use strict';var Sequelize=require('sequelize');module[_0xa57c('0x0')]={'body':{'type':Sequelize[_0xa57c('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xa57c('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xa57c('0x3')]}}; \ No newline at end of file +var _0x2ef3=['sequelize','exports','TEXT','medium','BOOLEAN','INTEGER'];(function(_0x304dd4,_0x5eb14a){var _0x6929fc=function(_0x1069e0){while(--_0x1069e0){_0x304dd4['push'](_0x304dd4['shift']());}};_0x6929fc(++_0x5eb14a);}(_0x2ef3,0xba));var _0x32ef=function(_0x1a8505,_0x4a69f4){_0x1a8505=_0x1a8505-0x0;var _0x19858c=_0x2ef3[_0x1a8505];return _0x19858c;};'use strict';var Sequelize=require(_0x32ef('0x0'));module[_0x32ef('0x1')]={'body':{'type':Sequelize[_0x32ef('0x2')](_0x32ef('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x32ef('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x32ef('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index e626d8f..2ef31b2 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 _0x139a=['-createdAt','all','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','VIRTUAL','merge','options','ChatInternalMessage','includeAll','include','rows','catch','show','params','find','create','body','describe','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','findAll','agent','user','fullname','role','userpic','online','allowmessenger','-online','VoiceQueue','VoiceQueues','get','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','ToId','read'];(function(_0x15005a,_0x35a6b9){var _0x4d12c6=function(_0x414ed3){while(--_0x414ed3){_0x15005a['push'](_0x15005a['shift']());}};_0x4d12c6(++_0x35a6b9);}(_0x139a,0x155));var _0xa139=function(_0x1d5866,_0x43ff2d){_0x1d5866=_0x1d5866-0x0;var _0x5009e1=_0x139a[_0x1d5866];return _0x5009e1;};'use strict';var pdf=require(_0xa139('0x0'));var emlformat=require(_0xa139('0x1'));var rimraf=require(_0xa139('0x2'));var zipdir=require(_0xa139('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa139('0x4'));var BPromise=require(_0xa139('0x5'));var Mustache=require('mustache');var util=require(_0xa139('0x6'));var path=require(_0xa139('0x7'));var sox=require(_0xa139('0x8'));var csv=require('to-csv');var ejs=require(_0xa139('0x9'));var fs=require('fs');var _=require(_0xa139('0xa'));var squel=require(_0xa139('0xb'));var crypto=require(_0xa139('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa139('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa139('0xe'));var Papa=require(_0xa139('0xf'));var Redis=require(_0xa139('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa139('0x11'));var as=require(_0xa139('0x12'));var hardwareService=require(_0xa139('0x13'));var logger=require(_0xa139('0x14'))(_0xa139('0x15'));var utils=require(_0xa139('0x16'));var config=require(_0xa139('0x17'));var db=require(_0xa139('0x18'))['db'];config[_0xa139('0x19')]=_[_0xa139('0x1a')](config[_0xa139('0x19')],{'host':_0xa139('0x1b'),'port':0x18eb});var socket=require(_0xa139('0x1c'))(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0xa139('0x1d')](socket);function respondWithStatusCode(_0x5f377a,_0x129bce){_0x129bce=_0x129bce||0xcc;return function(_0x30d750){if(_0x30d750){return _0x5f377a[_0xa139('0x1e')](_0x129bce);}return _0x5f377a[_0xa139('0x1f')](_0x129bce)[_0xa139('0x20')]();};}function respondWithResult(_0x1b96f5,_0x22f259){_0x22f259=_0x22f259||0xc8;return function(_0x49cbc9){if(_0x49cbc9){return _0x1b96f5[_0xa139('0x1f')](_0x22f259)[_0xa139('0x21')](_0x49cbc9);}};}function respondWithFilteredResult(_0x10e1b5,_0x151975){return function(_0x356ada){if(_0x356ada){var _0x9a47da=_0x356ada[_0xa139('0x22')],_0x41a803=_0x151975[_0xa139('0x23')],_0x19f8d4=_0x151975['offset']+_0x151975[_0xa139('0x24')],_0x447734;if(_0x19f8d4>=_0x9a47da){_0x19f8d4=_0x9a47da;_0x447734=0xc8;}else{_0x447734=0xce;}_0x10e1b5[_0xa139('0x1f')](_0x447734);return _0x10e1b5['set'](_0xa139('0x25'),_0x41a803+'-'+_0x19f8d4+'/'+_0x9a47da)[_0xa139('0x21')](_0x356ada);}return null;};}function patchUpdates(_0x15ffe2){return function(_0x48d33c){try{jsonpatch[_0xa139('0x26')](_0x48d33c,_0x15ffe2,!![]);}catch(_0x29113a){return BPromise[_0xa139('0x27')](_0x29113a);}return _0x48d33c[_0xa139('0x28')]();};}function saveUpdates(_0x468d4f,_0x45250e){return function(_0x1fe761){if(_0x1fe761){return _0x1fe761[_0xa139('0x29')](_0x468d4f)[_0xa139('0x2a')](function(_0x3a502f){return _0x3a502f;});}return null;};}function removeEntity(_0x7be11a,_0x1eac58){return function(_0x183db8){if(_0x183db8){return _0x183db8[_0xa139('0x2b')]()[_0xa139('0x2a')](function(){_0x7be11a['status'](0xcc)[_0xa139('0x20')]();});}};}function handleEntityNotFound(_0x54657f,_0x373336){return function(_0x11dc0b){if(!_0x11dc0b){_0x54657f[_0xa139('0x1e')](0x194);}return _0x11dc0b;};}function handleError(_0x4550f5,_0x4504bd){_0x4504bd=_0x4504bd||0x1f4;return function(_0x1682b3){logger[_0xa139('0x2c')](_0x1682b3[_0xa139('0x2d')]);if(_0x1682b3[_0xa139('0x2e')]){delete _0x1682b3[_0xa139('0x2e')];}_0x4550f5['status'](_0x4504bd)[_0xa139('0x2f')](_0x1682b3);};}exports[_0xa139('0x30')]=function(_0x46d318,_0x558a3e){var _0x1d354a={},_0x5ed4f3={},_0x3b9c81={'count':0x0,'rows':[]};var _0x57d94c=_[_0xa139('0x31')](db['ChatInternalMessage'][_0xa139('0x32')],function(_0x2befb0){return{'name':_0x2befb0[_0xa139('0x33')],'type':_0x2befb0[_0xa139('0x34')]['key']};});_0x5ed4f3[_0xa139('0x35')]=_[_0xa139('0x31')](_0x57d94c,_0xa139('0x2e'));_0x5ed4f3[_0xa139('0x36')]=_[_0xa139('0x37')](_0x46d318[_0xa139('0x36')]);_0x5ed4f3[_0xa139('0x38')]=_['intersection'](_0x5ed4f3[_0xa139('0x35')],_0x5ed4f3[_0xa139('0x36')]);_0x1d354a[_0xa139('0x39')]=_[_0xa139('0x3a')](_0x5ed4f3[_0xa139('0x35')],qs[_0xa139('0x3b')](_0x46d318[_0xa139('0x36')][_0xa139('0x3b')]));_0x1d354a[_0xa139('0x39')]=_0x1d354a[_0xa139('0x39')][_0xa139('0x3c')]?_0x1d354a[_0xa139('0x39')]:_0x5ed4f3['model'];if(!_0x46d318[_0xa139('0x36')]['hasOwnProperty']('nolimit')){_0x1d354a[_0xa139('0x24')]=qs['limit'](_0x46d318[_0xa139('0x36')][_0xa139('0x24')]);_0x1d354a[_0xa139('0x23')]=qs['offset'](_0x46d318[_0xa139('0x36')][_0xa139('0x23')]);}_0x1d354a[_0xa139('0x3d')]=qs[_0xa139('0x3e')](_0x46d318[_0xa139('0x36')]['sort']);_0x1d354a[_0xa139('0x3f')]=qs['filters'](_[_0xa139('0x40')](_0x46d318[_0xa139('0x36')],_0x5ed4f3[_0xa139('0x38')]));if(_0x46d318[_0xa139('0x36')][_0xa139('0x41')]){_0x1d354a['where']=_['merge'](_0x1d354a[_0xa139('0x3f')],{'$or':_[_0xa139('0x31')](_0x57d94c,function(_0x2ea4c2){if(_0x2ea4c2[_0xa139('0x34')]!==_0xa139('0x42')){var _0x480efc={};_0x480efc[_0x2ea4c2[_0xa139('0x2e')]]={'$like':'%'+_0x46d318[_0xa139('0x36')][_0xa139('0x41')]+'%'};return _0x480efc;}})});}_0x1d354a=_[_0xa139('0x43')]({},_0x1d354a,_0x46d318[_0xa139('0x44')]);var _0x53ff5a={'where':_0x1d354a[_0xa139('0x3f')]};return db[_0xa139('0x45')][_0xa139('0x22')](_0x53ff5a)[_0xa139('0x2a')](function(_0x18108b){_0x3b9c81[_0xa139('0x22')]=_0x18108b;if(_0x46d318[_0xa139('0x36')][_0xa139('0x46')]){_0x1d354a[_0xa139('0x47')]=[{'all':!![]}];}return db[_0xa139('0x45')]['findAll'](_0x1d354a);})[_0xa139('0x2a')](function(_0x15357e){_0x3b9c81[_0xa139('0x48')]=_0x15357e;return _0x3b9c81;})[_0xa139('0x2a')](respondWithFilteredResult(_0x558a3e,_0x1d354a))[_0xa139('0x49')](handleError(_0x558a3e,null));};exports[_0xa139('0x4a')]=function(_0x44cfda,_0xba4a0e){var _0x2a7dc5={'raw':!![],'where':{'id':_0x44cfda[_0xa139('0x4b')]['id']}},_0x404bfc={};_0x404bfc[_0xa139('0x35')]=_[_0xa139('0x37')](db[_0xa139('0x45')][_0xa139('0x32')]);_0x404bfc[_0xa139('0x36')]=_[_0xa139('0x37')](_0x44cfda[_0xa139('0x36')]);_0x404bfc['filters']=_[_0xa139('0x3a')](_0x404bfc[_0xa139('0x35')],_0x404bfc[_0xa139('0x36')]);_0x2a7dc5['attributes']=_[_0xa139('0x3a')](_0x404bfc[_0xa139('0x35')],qs[_0xa139('0x3b')](_0x44cfda[_0xa139('0x36')]['fields']));_0x2a7dc5['attributes']=_0x2a7dc5['attributes'][_0xa139('0x3c')]?_0x2a7dc5[_0xa139('0x39')]:_0x404bfc['model'];if(_0x44cfda['query'][_0xa139('0x46')]){_0x2a7dc5[_0xa139('0x47')]=[{'all':!![]}];}_0x2a7dc5=_[_0xa139('0x43')]({},_0x2a7dc5,_0x44cfda[_0xa139('0x44')]);return db[_0xa139('0x45')][_0xa139('0x4c')](_0x2a7dc5)['then'](handleEntityNotFound(_0xba4a0e,null))['then'](respondWithResult(_0xba4a0e,null))['catch'](handleError(_0xba4a0e,null));};exports[_0xa139('0x4d')]=function(_0x1ed529,_0x520fc2){return db[_0xa139('0x45')][_0xa139('0x4d')](_0x1ed529[_0xa139('0x4e')],{})['then'](respondWithResult(_0x520fc2,0xc9))[_0xa139('0x49')](handleError(_0x520fc2,null));};exports[_0xa139('0x29')]=function(_0x168f89,_0x56646e){if(_0x168f89[_0xa139('0x4e')]['id']){delete _0x168f89[_0xa139('0x4e')]['id'];}return db[_0xa139('0x45')][_0xa139('0x4c')]({'where':{'id':_0x168f89['params']['id']}})[_0xa139('0x2a')](handleEntityNotFound(_0x56646e,null))[_0xa139('0x2a')](saveUpdates(_0x168f89[_0xa139('0x4e')],null))[_0xa139('0x2a')](respondWithResult(_0x56646e,null))[_0xa139('0x49')](handleError(_0x56646e,null));};exports[_0xa139('0x2b')]=function(_0x4f6a59,_0x5c7ce7){return db[_0xa139('0x45')][_0xa139('0x4c')]({'where':{'id':_0x4f6a59['params']['id']}})[_0xa139('0x2a')](handleEntityNotFound(_0x5c7ce7,null))['then'](removeEntity(_0x5c7ce7,null))[_0xa139('0x49')](handleError(_0x5c7ce7,null));};exports[_0xa139('0x4f')]=function(_0x5b0317,_0x4e0d41){return db[_0xa139('0x45')][_0xa139('0x4f')]()[_0xa139('0x2a')](respondWithResult(_0x4e0d41,null))[_0xa139('0x49')](handleError(_0x4e0d41,null));};function wrapUser(_0xe65f71){return function(_0x2112ad){var _0xe01d9=_0xe65f71['get']({'plain':!![]});_0xe01d9[_0xa139('0x50')]=[];if(_0x2112ad){_0xe01d9[_0xa139('0x51')]=_0x2112ad[_0xa139('0x52')];_0xe01d9[_0xa139('0x53')]=_0x2112ad;}else{_0xe01d9[_0xa139('0x51')]=moment(0x0)[_0xa139('0x54')](_0xa139('0x55'));_0xe01d9[_0xa139('0x53')]={};}return _0xe01d9;};}exports[_0xa139('0x56')]=function(_0x78b349,_0x14f6e5,_0x1ca884){var _0x49901e=[];return db[_0xa139('0x57')][_0xa139('0x58')]({'where':{'role':[_0xa139('0x59'),'admin',_0xa139('0x5a')]},'attributes':['id',_0xa139('0x5b'),_0xa139('0x2e'),_0xa139('0x5c'),_0xa139('0x5d'),'internal',_0xa139('0x5e'),'lastLoginAt',_0xa139('0x5f'),'showWebBar'],'order':qs[_0xa139('0x3e')](_0xa139('0x60')),'include':[{'model':db[_0xa139('0x61')],'as':_0xa139('0x62'),'attributes':['id','name',_0xa139('0x34')],'through':{'attributes':[]}}]})['then'](function(_0x29de8d){if(_0x29de8d){var _0x33cc81=_0x78b349[_0xa139('0x5a')][_0xa139('0x63')]({'plain':!![]});if(!_0x33cc81)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x33cc81[_0xa139('0x5c')]==='user'){return db[_0xa139('0x64')][_0xa139('0x4c')]({'where':{'name':_0xa139('0x65'),'userProfileId':_0x33cc81[_0xa139('0x66')]},'raw':!![]})[_0xa139('0x2a')](function(_0x382acd){if(_0x382acd){if(_0x382acd[_0xa139('0x67')]===0x0){return db[_0xa139('0x68')][_0xa139('0x58')]({'where':{'sectionId':_0x382acd['id']},'raw':!![]})[_0xa139('0x2a')](function(_0x5a0e83){var _0x2cc305=[];if(_[_0xa139('0x69')](_0x5a0e83)){_0x2cc305=_[_0xa139('0x41')](_0x29de8d,function(_0x1e084e){if(_0x1e084e[_0xa139('0x5c')]!==_0xa139('0x59')){return _0x1e084e;}});return _0x2cc305;}else{for(var _0x3517ea=0x0;_0x3517ea<_0x29de8d[_0xa139('0x3c')];_0x3517ea++){var _0x1f8560=_0x29de8d[_0x3517ea];if(_0x1f8560[_0xa139('0x5c')]===_0xa139('0x59')){var _0x3f1586=_[_0xa139('0x4c')](_0x5a0e83,function(_0x144371){return _0x144371[_0xa139('0x6a')]===_0x1f8560['id'];});if(_0x3f1586)_0x2cc305[_0xa139('0x6b')](_0x1f8560);}else{_0x2cc305[_0xa139('0x6b')](_0x1f8560);}}return _0x2cc305;}});}else{return _0x29de8d;}}else{var _0x11819c=_[_0xa139('0x41')](_0x29de8d,function(_0x54a9ad){if(_0x54a9ad[_0xa139('0x5c')]!==_0xa139('0x59')){return _0x54a9ad;}});return _0x11819c;}});}else{return _0x29de8d;}}})[_0xa139('0x2a')](function(_0x37d602){var _0x298aa1=[];if(_0x37d602){_0x49901e=_0x37d602;for(var _0x7f7272=0x0;_0x7f7272<_0x37d602[_0xa139('0x3c')];_0x7f7272+=0x1){_0x49901e[_0x7f7272][_0xa139('0x50')]=[];_0x298aa1['push'](db[_0xa139('0x45')]['find']({'where':{'FromId':[_0x78b349['user']['id'],_0x37d602[_0x7f7272]['id']],'ToId':[_0x78b349[_0xa139('0x5a')]['id'],_0x37d602[_0x7f7272]['id']],'ChatGroupId':null},'attributes':['id',_0xa139('0x52'),_0xa139('0x6c'),_0xa139('0x6d'),_0xa139('0x6e'),'body'],'order':qs['sort'](_0xa139('0x6f')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xa139('0x2a')](wrapUser(_0x37d602[_0x7f7272])));}return BPromise[_0xa139('0x70')](_0x298aa1);}return[];})[_0xa139('0x2a')](function(_0x2df791){return{'rows':_0x2df791,'count':_0x2df791['length']};})[_0xa139('0x2a')](respondWithResult(_0x14f6e5,null))[_0xa139('0x49')](handleError(_0x14f6e5,null));}; \ No newline at end of file +var _0x268b=['createdAt','FromId','ToId','read','-createdAt','all','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','register','end','status','count','offset','limit','set','Content-Range','json','reject','save','destroy','then','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','type','key','model','query','filters','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','params','keys','intersection','fields','find','create','body','update','describe','get','messages','lastMessageAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','role','internal','online','lastLoginAt','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','autoAssociation','findAll','isEmpty','resourceId','push'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x268b,0xdc));var _0xb268=function(_0x5a7618,_0x3f44c2){_0x5a7618=_0x5a7618-0x0;var _0x12dc65=_0x268b[_0x5a7618];return _0x12dc65;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb268('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb268('0x1'));var jsonpatch=require(_0xb268('0x2'));var rp=require('request-promise');var moment=require(_0xb268('0x3'));var BPromise=require(_0xb268('0x4'));var Mustache=require('mustache');var util=require(_0xb268('0x5'));var path=require(_0xb268('0x6'));var sox=require(_0xb268('0x7'));var csv=require(_0xb268('0x8'));var ejs=require(_0xb268('0x9'));var fs=require('fs');var _=require(_0xb268('0xa'));var squel=require(_0xb268('0xb'));var crypto=require(_0xb268('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb268('0xd'));var toCsv=require(_0xb268('0x8'));var querystring=require(_0xb268('0xe'));var Papa=require(_0xb268('0xf'));var Redis=require(_0xb268('0x10'));var authService=require(_0xb268('0x11'));var qs=require(_0xb268('0x12'));var as=require(_0xb268('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb268('0x14'))(_0xb268('0x15'));var utils=require('../../config/utils');var config=require(_0xb268('0x16'));var db=require(_0xb268('0x17'))['db'];config['redis']=_['defaults'](config[_0xb268('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xb268('0x19'))(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0xb268('0x1a')](socket);function respondWithStatusCode(_0x3c6203,_0x2c1bc8){_0x2c1bc8=_0x2c1bc8||0xcc;return function(_0x3d9ec0){if(_0x3d9ec0){return _0x3c6203['sendStatus'](_0x2c1bc8);}return _0x3c6203['status'](_0x2c1bc8)[_0xb268('0x1b')]();};}function respondWithResult(_0x27ba7e,_0xba6b8){_0xba6b8=_0xba6b8||0xc8;return function(_0x42c5d2){if(_0x42c5d2){return _0x27ba7e[_0xb268('0x1c')](_0xba6b8)['json'](_0x42c5d2);}};}function respondWithFilteredResult(_0x5a4452,_0x207356){return function(_0x4430f9){if(_0x4430f9){var _0x5b9546=_0x4430f9[_0xb268('0x1d')],_0x215c74=_0x207356['offset'],_0x9114ae=_0x207356[_0xb268('0x1e')]+_0x207356[_0xb268('0x1f')],_0x29f531;if(_0x9114ae>=_0x5b9546){_0x9114ae=_0x5b9546;_0x29f531=0xc8;}else{_0x29f531=0xce;}_0x5a4452[_0xb268('0x1c')](_0x29f531);return _0x5a4452[_0xb268('0x20')](_0xb268('0x21'),_0x215c74+'-'+_0x9114ae+'/'+_0x5b9546)[_0xb268('0x22')](_0x4430f9);}return null;};}function patchUpdates(_0x167138){return function(_0x143f48){try{jsonpatch['apply'](_0x143f48,_0x167138,!![]);}catch(_0x2795a4){return BPromise[_0xb268('0x23')](_0x2795a4);}return _0x143f48[_0xb268('0x24')]();};}function saveUpdates(_0x27f10d,_0x212b40){return function(_0x1f1863){if(_0x1f1863){return _0x1f1863['update'](_0x27f10d)['then'](function(_0x3c7149){return _0x3c7149;});}return null;};}function removeEntity(_0x38e8ab,_0x6734e8){return function(_0xd9f567){if(_0xd9f567){return _0xd9f567[_0xb268('0x25')]()[_0xb268('0x26')](function(){_0x38e8ab['status'](0xcc)[_0xb268('0x1b')]();});}};}function handleEntityNotFound(_0x555d94,_0x53eb2b){return function(_0x351bcd){if(!_0x351bcd){_0x555d94['sendStatus'](0x194);}return _0x351bcd;};}function handleError(_0x5acaad,_0x481c25){_0x481c25=_0x481c25||0x1f4;return function(_0x51ba2e){logger[_0xb268('0x27')](_0x51ba2e[_0xb268('0x28')]);if(_0x51ba2e[_0xb268('0x29')]){delete _0x51ba2e[_0xb268('0x29')];}_0x5acaad[_0xb268('0x1c')](_0x481c25)[_0xb268('0x2a')](_0x51ba2e);};}exports[_0xb268('0x2b')]=function(_0x2941fb,_0xdfbc74){var _0x4444bc={},_0x3e7c6d={},_0x3313fe={'count':0x0,'rows':[]};var _0x574550=_[_0xb268('0x2c')](db[_0xb268('0x2d')][_0xb268('0x2e')],function(_0x2818a3){return{'name':_0x2818a3['fieldName'],'type':_0x2818a3[_0xb268('0x2f')][_0xb268('0x30')]};});_0x3e7c6d[_0xb268('0x31')]=_['map'](_0x574550,_0xb268('0x29'));_0x3e7c6d[_0xb268('0x32')]=_['keys'](_0x2941fb[_0xb268('0x32')]);_0x3e7c6d[_0xb268('0x33')]=_['intersection'](_0x3e7c6d[_0xb268('0x31')],_0x3e7c6d[_0xb268('0x32')]);_0x4444bc[_0xb268('0x34')]=_['intersection'](_0x3e7c6d[_0xb268('0x31')],qs['fields'](_0x2941fb[_0xb268('0x32')]['fields']));_0x4444bc[_0xb268('0x34')]=_0x4444bc[_0xb268('0x34')][_0xb268('0x35')]?_0x4444bc[_0xb268('0x34')]:_0x3e7c6d[_0xb268('0x31')];if(!_0x2941fb['query'][_0xb268('0x36')](_0xb268('0x37'))){_0x4444bc['limit']=qs['limit'](_0x2941fb[_0xb268('0x32')][_0xb268('0x1f')]);_0x4444bc[_0xb268('0x1e')]=qs[_0xb268('0x1e')](_0x2941fb[_0xb268('0x32')][_0xb268('0x1e')]);}_0x4444bc['order']=qs[_0xb268('0x38')](_0x2941fb[_0xb268('0x32')][_0xb268('0x38')]);_0x4444bc[_0xb268('0x39')]=qs[_0xb268('0x33')](_[_0xb268('0x3a')](_0x2941fb[_0xb268('0x32')],_0x3e7c6d[_0xb268('0x33')]));if(_0x2941fb[_0xb268('0x32')][_0xb268('0x3b')]){_0x4444bc['where']=_[_0xb268('0x3c')](_0x4444bc[_0xb268('0x39')],{'$or':_['map'](_0x574550,function(_0x1a9775){if(_0x1a9775[_0xb268('0x2f')]!=='VIRTUAL'){var _0x48c73c={};_0x48c73c[_0x1a9775['name']]={'$like':'%'+_0x2941fb['query'][_0xb268('0x3b')]+'%'};return _0x48c73c;}})});}_0x4444bc=_['merge']({},_0x4444bc,_0x2941fb[_0xb268('0x3d')]);var _0x2d47eb={'where':_0x4444bc[_0xb268('0x39')]};return db[_0xb268('0x2d')]['count'](_0x2d47eb)[_0xb268('0x26')](function(_0x538a1e){_0x3313fe[_0xb268('0x1d')]=_0x538a1e;if(_0x2941fb[_0xb268('0x32')][_0xb268('0x3e')]){_0x4444bc[_0xb268('0x3f')]=[{'all':!![]}];}return db['ChatInternalMessage']['findAll'](_0x4444bc);})[_0xb268('0x26')](function(_0x4c2405){_0x3313fe[_0xb268('0x40')]=_0x4c2405;return _0x3313fe;})[_0xb268('0x26')](respondWithFilteredResult(_0xdfbc74,_0x4444bc))[_0xb268('0x41')](handleError(_0xdfbc74,null));};exports['show']=function(_0x47c5c7,_0xd4a7eb){var _0x5d1d6b={'raw':!![],'where':{'id':_0x47c5c7[_0xb268('0x42')]['id']}},_0x45f270={};_0x45f270[_0xb268('0x31')]=_['keys'](db[_0xb268('0x2d')][_0xb268('0x2e')]);_0x45f270[_0xb268('0x32')]=_[_0xb268('0x43')](_0x47c5c7[_0xb268('0x32')]);_0x45f270['filters']=_['intersection'](_0x45f270['model'],_0x45f270['query']);_0x5d1d6b[_0xb268('0x34')]=_[_0xb268('0x44')](_0x45f270['model'],qs[_0xb268('0x45')](_0x47c5c7[_0xb268('0x32')]['fields']));_0x5d1d6b['attributes']=_0x5d1d6b[_0xb268('0x34')][_0xb268('0x35')]?_0x5d1d6b[_0xb268('0x34')]:_0x45f270[_0xb268('0x31')];if(_0x47c5c7[_0xb268('0x32')][_0xb268('0x3e')]){_0x5d1d6b['include']=[{'all':!![]}];}_0x5d1d6b=_['merge']({},_0x5d1d6b,_0x47c5c7[_0xb268('0x3d')]);return db['ChatInternalMessage'][_0xb268('0x46')](_0x5d1d6b)[_0xb268('0x26')](handleEntityNotFound(_0xd4a7eb,null))[_0xb268('0x26')](respondWithResult(_0xd4a7eb,null))[_0xb268('0x41')](handleError(_0xd4a7eb,null));};exports['create']=function(_0x518c05,_0x28cc4c){return db[_0xb268('0x2d')][_0xb268('0x47')](_0x518c05[_0xb268('0x48')],{})['then'](respondWithResult(_0x28cc4c,0xc9))[_0xb268('0x41')](handleError(_0x28cc4c,null));};exports[_0xb268('0x49')]=function(_0x2f994b,_0x12a374){if(_0x2f994b[_0xb268('0x48')]['id']){delete _0x2f994b['body']['id'];}return db['ChatInternalMessage']['find']({'where':{'id':_0x2f994b[_0xb268('0x42')]['id']}})['then'](handleEntityNotFound(_0x12a374,null))[_0xb268('0x26')](saveUpdates(_0x2f994b[_0xb268('0x48')],null))['then'](respondWithResult(_0x12a374,null))[_0xb268('0x41')](handleError(_0x12a374,null));};exports[_0xb268('0x25')]=function(_0x2ad973,_0x22b402){return db[_0xb268('0x2d')][_0xb268('0x46')]({'where':{'id':_0x2ad973[_0xb268('0x42')]['id']}})[_0xb268('0x26')](handleEntityNotFound(_0x22b402,null))['then'](removeEntity(_0x22b402,null))[_0xb268('0x41')](handleError(_0x22b402,null));};exports[_0xb268('0x4a')]=function(_0x3155ee,_0x2df65e){return db['ChatInternalMessage'][_0xb268('0x4a')]()[_0xb268('0x26')](respondWithResult(_0x2df65e,null))['catch'](handleError(_0x2df65e,null));};function wrapUser(_0x93e589){return function(_0x3945ad){var _0x4117bb=_0x93e589[_0xb268('0x4b')]({'plain':!![]});_0x4117bb[_0xb268('0x4c')]=[];if(_0x3945ad){_0x4117bb[_0xb268('0x4d')]=_0x3945ad['createdAt'];_0x4117bb[_0xb268('0x4e')]=_0x3945ad;}else{_0x4117bb[_0xb268('0x4d')]=moment(0x0)[_0xb268('0x4f')](_0xb268('0x50'));_0x4117bb['lastMessage']={};}return _0x4117bb;};}exports[_0xb268('0x51')]=function(_0x4d6a52,_0x37e554,_0x28fb83){var _0x41f7a7=[];return db[_0xb268('0x52')]['findAll']({'where':{'role':[_0xb268('0x53'),_0xb268('0x54'),_0xb268('0x55')]},'attributes':['id','fullname',_0xb268('0x29'),_0xb268('0x56'),'userpic',_0xb268('0x57'),_0xb268('0x58'),_0xb268('0x59'),'allowmessenger','showWebBar'],'order':qs[_0xb268('0x38')](_0xb268('0x5a')),'include':[{'model':db[_0xb268('0x5b')],'as':_0xb268('0x5c'),'attributes':['id','name',_0xb268('0x2f')],'through':{'attributes':[]}}]})[_0xb268('0x26')](function(_0x59ae04){if(_0x59ae04){var _0x31e41d=_0x4d6a52[_0xb268('0x55')]['get']({'plain':!![]});if(!_0x31e41d)throw new Error(_0xb268('0x5d'));if(_0x31e41d['role']===_0xb268('0x55')){return db[_0xb268('0x5e')]['find']({'where':{'name':_0xb268('0x5f'),'userProfileId':_0x31e41d['userProfileId']},'raw':!![]})[_0xb268('0x26')](function(_0x4f1871){if(_0x4f1871){if(_0x4f1871[_0xb268('0x60')]===0x0){return db['UserProfileResource'][_0xb268('0x61')]({'where':{'sectionId':_0x4f1871['id']},'raw':!![]})['then'](function(_0x224562){var _0x181e51=[];if(_[_0xb268('0x62')](_0x224562)){_0x181e51=_[_0xb268('0x3b')](_0x59ae04,function(_0x249db8){if(_0x249db8[_0xb268('0x56')]!==_0xb268('0x53')){return _0x249db8;}});return _0x181e51;}else{for(var _0x38c3a6=0x0;_0x38c3a6<_0x59ae04[_0xb268('0x35')];_0x38c3a6++){var _0x339208=_0x59ae04[_0x38c3a6];if(_0x339208[_0xb268('0x56')]===_0xb268('0x53')){var _0x527d0f=_[_0xb268('0x46')](_0x224562,function(_0x388303){return _0x388303[_0xb268('0x63')]===_0x339208['id'];});if(_0x527d0f)_0x181e51['push'](_0x339208);}else{_0x181e51[_0xb268('0x64')](_0x339208);}}return _0x181e51;}});}else{return _0x59ae04;}}else{var _0x1a6b61=_[_0xb268('0x3b')](_0x59ae04,function(_0x3a07ed){if(_0x3a07ed[_0xb268('0x56')]!==_0xb268('0x53')){return _0x3a07ed;}});return _0x1a6b61;}});}else{return _0x59ae04;}}})[_0xb268('0x26')](function(_0x40b982){var _0x4807d6=[];if(_0x40b982){_0x41f7a7=_0x40b982;for(var _0x201ab9=0x0;_0x201ab9<_0x40b982[_0xb268('0x35')];_0x201ab9+=0x1){_0x41f7a7[_0x201ab9][_0xb268('0x4c')]=[];_0x4807d6[_0xb268('0x64')](db[_0xb268('0x2d')]['find']({'where':{'FromId':[_0x4d6a52['user']['id'],_0x40b982[_0x201ab9]['id']],'ToId':[_0x4d6a52[_0xb268('0x55')]['id'],_0x40b982[_0x201ab9]['id']],'ChatGroupId':null},'attributes':['id',_0xb268('0x65'),_0xb268('0x66'),_0xb268('0x67'),_0xb268('0x68'),'body'],'order':qs[_0xb268('0x38')](_0xb268('0x69')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xb268('0x26')](wrapUser(_0x40b982[_0x201ab9])));}return BPromise[_0xb268('0x6a')](_0x4807d6);}return[];})[_0xb268('0x26')](function(_0x5091f9){return{'rows':_0x5091f9,'count':_0x5091f9[_0xb268('0x35')]};})[_0xb268('0x26')](respondWithResult(_0x37e554,null))[_0xb268('0x41')](handleError(_0x37e554,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index ba7d6d9..26af012 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 _0x6d65=['events','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','exports'];(function(_0x43d814,_0x55d11a){var _0x4f8389=function(_0x3d917e){while(--_0x3d917e){_0x43d814['push'](_0x43d814['shift']());}};_0x4f8389(++_0x55d11a);}(_0x6d65,0x100));var _0x56d6=function(_0x4e57e2,_0x8d67a2){_0x4e57e2=_0x4e57e2-0x0;var _0x11ac0e=_0x6d65[_0x4e57e2];return _0x11ac0e;};'use strict';var EventEmitter=require(_0x56d6('0x0'));var ChatInternalMessage=require(_0x56d6('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x56d6('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x56d6('0x3'),'afterDestroy':_0x56d6('0x4')};function emitEvent(_0x5ba563){return function(_0x36f63b,_0x2f1716,_0x86a2c){ChatInternalMessageEvents[_0x56d6('0x5')](_0x5ba563+':'+_0x36f63b['id'],_0x36f63b);ChatInternalMessageEvents[_0x56d6('0x5')](_0x5ba563,_0x36f63b);_0x86a2c(null);};}for(var e in events){if(events[_0x56d6('0x6')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x56d6('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x8f1f=['events','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x79d22a,_0x1bff4c){var _0x157b3e=function(_0x2ac641){while(--_0x2ac641){_0x79d22a['push'](_0x79d22a['shift']());}};_0x157b3e(++_0x1bff4c);}(_0x8f1f,0xe1));var _0xf8f1=function(_0x2eb41e,_0x2bdf4c){_0x2eb41e=_0x2eb41e-0x0;var _0x493e89=_0x8f1f[_0x2eb41e];return _0x493e89;};'use strict';var EventEmitter=require(_0xf8f1('0x0'));var ChatInternalMessage=require('../../mysqldb')['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xf8f1('0x1')](0x0);var events={'afterCreate':_0xf8f1('0x2'),'afterUpdate':_0xf8f1('0x3'),'afterDestroy':_0xf8f1('0x4')};function emitEvent(_0x2a5ef6){return function(_0x1d2233,_0x2c6a47,_0x1b973e){ChatInternalMessageEvents['emit'](_0x2a5ef6+':'+_0x1d2233['id'],_0x1d2233);ChatInternalMessageEvents[_0xf8f1('0x5')](_0x2a5ef6,_0x1d2233);_0x1b973e(null);};}for(var e in events){if(events[_0xf8f1('0x6')](e)){var event=events[e];ChatInternalMessage[_0xf8f1('0x7')](e,emitEvent(event));}}module[_0xf8f1('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index a0cab5e..2b286e5 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 _0xb7e7=['ChatInternalMessage','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes','define'];(function(_0x5833e7,_0x3d3958){var _0x5778a5=function(_0x4bf11c){while(--_0x4bf11c){_0x5833e7['push'](_0x5833e7['shift']());}};_0x5778a5(++_0x3d3958);}(_0xb7e7,0x121));var _0x7b7e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xb7e7[_0x31e29a];return _0x32d892;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7b7e('0x9'),'collate':_0x7b7e('0xa')});}; \ No newline at end of file +var _0xa9e0=['define','ChatInternalMessage','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 90a5ee4..99a7dd1 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 _0xac0b=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./chatInternalMessage.socket','request','then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x109dc3,_0xf6b661){var _0x41a1c=function(_0x558639){while(--_0x558639){_0x109dc3['push'](_0x109dc3['shift']());}};_0x41a1c(++_0xf6b661);}(_0xac0b,0x109));var _0xbac0=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xac0b[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xbac0('0x0'));var util=require(_0xbac0('0x1'));var moment=require(_0xbac0('0x2'));var BPromise=require('bluebird');var rs=require(_0xbac0('0x3'));var fs=require('fs');var Redis=require(_0xbac0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbac0('0x5'));var logger=require(_0xbac0('0x6'))(_0xbac0('0x7'));var config=require(_0xbac0('0x8'));var jayson=require(_0xbac0('0x9'));var client=jayson[_0xbac0('0xa')][_0xbac0('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xbac0('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xbac0('0xd'))(new Redis(config['redis']));require(_0xbac0('0xe'))['register'](socket);function respondWithRpcPromise(_0x4fdca7,_0x4b29c3,_0x4cede9){return new BPromise(function(_0x3d830d,_0x10ff41){return client[_0xbac0('0xf')](_0x4fdca7,_0x4cede9)[_0xbac0('0x10')](function(_0x424297){logger['info'](_0xbac0('0x11'),_0x4b29c3,_0xbac0('0x12'));logger[_0xbac0('0x13')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x4b29c3,_0xbac0('0x12'),JSON[_0xbac0('0x14')](_0x424297));if(_0x424297[_0xbac0('0x15')]){if(_0x424297[_0xbac0('0x15')][_0xbac0('0x16')]===0x1f4){logger[_0xbac0('0x15')](_0xbac0('0x11'),_0x4b29c3,_0x424297['error']['message']);return _0x10ff41(_0x424297[_0xbac0('0x15')][_0xbac0('0x17')]);}logger[_0xbac0('0x15')](_0xbac0('0x11'),_0x4b29c3,_0x424297['error'][_0xbac0('0x17')]);return _0x3d830d(_0x424297['error'][_0xbac0('0x17')]);}else{logger[_0xbac0('0x18')](_0xbac0('0x11'),_0x4b29c3,'request\x20sent');_0x3d830d(_0x424297[_0xbac0('0x19')][_0xbac0('0x17')]);}})[_0xbac0('0x1a')](function(_0x1f6038){logger[_0xbac0('0x15')](_0xbac0('0x11'),_0x4b29c3,_0x1f6038);_0x10ff41(_0x1f6038);});});} \ No newline at end of file +var _0xaa08=['ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x573ced,_0x5ac1b1){var _0x609179=function(_0x272cd2){while(--_0x272cd2){_0x573ced['push'](_0x573ced['shift']());}};_0x609179(++_0x5ac1b1);}(_0xaa08,0xaf));var _0x8aa0=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xaa08[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x8aa0('0x0'));var util=require(_0x8aa0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa0('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x8aa0('0x3'));var logger=require('../../config/logger')(_0x8aa0('0x4'));var config=require(_0x8aa0('0x5'));var jayson=require(_0x8aa0('0x6'));var client=jayson[_0x8aa0('0x7')][_0x8aa0('0x8')]({'port':0x232a});config[_0x8aa0('0x9')]=_['defaults'](config[_0x8aa0('0x9')],{'host':_0x8aa0('0xa'),'port':0x18eb});var socket=require(_0x8aa0('0xb'))(new Redis(config[_0x8aa0('0x9')]));require(_0x8aa0('0xc'))['register'](socket);function respondWithRpcPromise(_0x40757f,_0x2470c0,_0x4d1094){return new BPromise(function(_0x46a411,_0x2e642a){return client['request'](_0x40757f,_0x4d1094)[_0x8aa0('0xd')](function(_0x1727cc){logger['info'](_0x8aa0('0xe'),_0x2470c0,_0x8aa0('0xf'));logger[_0x8aa0('0x10')](_0x8aa0('0x11'),_0x2470c0,'request\x20sent',JSON[_0x8aa0('0x12')](_0x1727cc));if(_0x1727cc['error']){if(_0x1727cc['error']['code']===0x1f4){logger[_0x8aa0('0x13')](_0x8aa0('0xe'),_0x2470c0,_0x1727cc['error'][_0x8aa0('0x14')]);return _0x2e642a(_0x1727cc[_0x8aa0('0x13')][_0x8aa0('0x14')]);}logger['error'](_0x8aa0('0xe'),_0x2470c0,_0x1727cc[_0x8aa0('0x13')][_0x8aa0('0x14')]);return _0x46a411(_0x1727cc[_0x8aa0('0x13')]['message']);}else{logger[_0x8aa0('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x2470c0,_0x8aa0('0xf'));_0x46a411(_0x1727cc[_0x8aa0('0x16')][_0x8aa0('0x14')]);}})[_0x8aa0('0x17')](function(_0x4ee64c){logger[_0x8aa0('0x13')](_0x8aa0('0xe'),_0x2470c0,_0x4ee64c);_0x2e642a(_0x4ee64c);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 0d278af..92a1b46 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 _0x3d15=['remove','removeListener','length','save'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x3d15,0x127));var _0x53d1=function(_0x194acc,_0x16a88a){_0x194acc=_0x194acc-0x0;var _0x2b7aab=_0x3d15[_0x194acc];return _0x2b7aab;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x53d1('0x0'),_0x53d1('0x1'),'update'];function createListener(_0x2b5a03,_0x71e505){return function(_0x23f044){_0x71e505['emit'](_0x2b5a03,_0x23f044);};}function removeListener(_0x17f6f3,_0x462ede){return function(){ChatInternalMessageEvents[_0x53d1('0x2')](_0x17f6f3,_0x462ede);};}exports['register']=function(_0x3b3e81){for(var _0x74eec6=0x0,_0x4b4385=events[_0x53d1('0x3')];_0x74eec6<_0x4b4385;_0x74eec6++){var _0x32dfe1=events[_0x74eec6];var _0x1c4833=createListener('chatInternalMessage:'+_0x32dfe1,_0x3b3e81);ChatInternalMessageEvents['on'](_0x32dfe1,_0x1c4833);}}; \ No newline at end of file +var _0xe2cc=['./chatInternalMessage.events','save','emit','removeListener','register','length','chatInternalMessage:'];(function(_0x1e841a,_0x91d3a6){var _0xff04de=function(_0x425caa){while(--_0x425caa){_0x1e841a['push'](_0x1e841a['shift']());}};_0xff04de(++_0x91d3a6);}(_0xe2cc,0x69));var _0xce2c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2cc[_0x14add3];return _0x4a174f;};'use strict';var ChatInternalMessageEvents=require(_0xce2c('0x0'));var events=[_0xce2c('0x1'),'remove','update'];function createListener(_0x3e19dc,_0x1e5b84){return function(_0x2279d5){_0x1e5b84[_0xce2c('0x2')](_0x3e19dc,_0x2279d5);};}function removeListener(_0x25e41a,_0x1a7c4e){return function(){ChatInternalMessageEvents[_0xce2c('0x3')](_0x25e41a,_0x1a7c4e);};}exports[_0xce2c('0x4')]=function(_0x592e10){for(var _0x51e5d0=0x0,_0x14bb4e=events[_0xce2c('0x5')];_0x51e5d0<_0x14bb4e;_0x51e5d0++){var _0x23f678=events[_0x51e5d0];var _0x29632b=createListener(_0xce2c('0x6')+_0x23f678,_0x592e10);ChatInternalMessageEvents['on'](_0x23f678,_0x29632b);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 5db0b94..fb255ee 100644 --- a/server/api/chatInternalMessage/index.js +++ b/server/api/chatInternalMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','describe','/users','isAuthenticated','getUsers','/:id','post','create','put','update','delete','destroy'];(function(_0x17ce0e,_0x773586){var _0x12e994=function(_0x42acbb){while(--_0x42acbb){_0x17ce0e['push'](_0x17ce0e['shift']());}};_0x12e994(++_0x773586);}(_0x70e0,0x17b));var _0x070e=function(_0x490684,_0xfa6463){_0x490684=_0x490684-0x0;var _0x4eb7ec=_0x70e0[_0x490684];return _0x4eb7ec;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var auth=require(_0x070e('0x4'));var interaction=require(_0x070e('0x5'));var config=require(_0x070e('0x6'));var controller=require('./chatInternalMessage.controller');router[_0x070e('0x7')]('/',auth['isAuthenticated'](),controller[_0x070e('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x070e('0x9')]);router[_0x070e('0x7')](_0x070e('0xa'),auth[_0x070e('0xb')](),controller[_0x070e('0xc')]);router[_0x070e('0x7')](_0x070e('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x070e('0xe')]('/',auth[_0x070e('0xb')](),controller[_0x070e('0xf')]);router[_0x070e('0x10')](_0x070e('0xd'),controller[_0x070e('0x11')]);router[_0x070e('0x12')](_0x070e('0xd'),auth[_0x070e('0xb')](),controller[_0x070e('0x13')]);module[_0x070e('0x14')]=router; \ No newline at end of file +var _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(_0x585c44,_0x53e2fe){var _0x2e1a9d=function(_0x55deeb){while(--_0x55deeb){_0x585c44['push'](_0x585c44['shift']());}};_0x2e1a9d(++_0x53e2fe);}(_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')]('/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 f8d76d8..9fa92ce 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 _0x7d40=['exports','TEXT','BOOLEAN','ENUM','out','DATE'];(function(_0x3179e2,_0x346954){var _0xee0a01=function(_0x3dd446){while(--_0x3dd446){_0x3179e2['push'](_0x3179e2['shift']());}};_0xee0a01(++_0x346954);}(_0x7d40,0xcc));var _0x07d4=function(_0x4a5635,_0x443b90){_0x4a5635=_0x4a5635-0x0;var _0x18d602=_0x7d40[_0x4a5635];return _0x18d602;};'use strict';var Sequelize=require('sequelize');module[_0x07d4('0x0')]={'body':{'type':Sequelize[_0x07d4('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x07d4('0x2')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x07d4('0x3')]('in',_0x07d4('0x4')),'defaultValue':_0x07d4('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x07d4('0x5')]}}; \ No newline at end of file +var _0xa291=['ENUM','out','sequelize','medium','BOOLEAN'];(function(_0x18f216,_0xeff4e5){var _0x18be09=function(_0x2a146e){while(--_0x2a146e){_0x18f216['push'](_0x18f216['shift']());}};_0x18be09(++_0xeff4e5);}(_0xa291,0x98));var _0x1a29=function(_0x1b51ea,_0x394fd9){_0x1b51ea=_0x1b51ea-0x0;var _0x18bbdc=_0xa291[_0x1b51ea];return _0x18bbdc;};'use strict';var Sequelize=require(_0x1a29('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x1a29('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x1a29('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x1a29('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1a29('0x3')]('in',_0x1a29('0x4')),'defaultValue':_0x1a29('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index ba0810c..e6b1646 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 _0x2219=['message','result','sendStatus','status','end','json','count','offset','limit','apply','reject','update','then','destroy','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','catch','params','options','create','body','find','chat-interactions','chat','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','format','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','interface','channel','event','accept','acceptmessage','parse','formData','agent','RejectMessage','SIP/%s','EventManager','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','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','info','ChatMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x2219,0xcb));var _0x9221=function(_0x3fcc20,_0x57c31b){_0x3fcc20=_0x3fcc20-0x0;var _0x15d3ce=_0x2219[_0x3fcc20];return _0x15d3ce;};'use strict';var pdf=require(_0x9221('0x0'));var emlformat=require(_0x9221('0x1'));var rimraf=require(_0x9221('0x2'));var zipdir=require(_0x9221('0x3'));var jsonpatch=require(_0x9221('0x4'));var rp=require(_0x9221('0x5'));var moment=require(_0x9221('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x9221('0x7'));var util=require(_0x9221('0x8'));var path=require(_0x9221('0x9'));var sox=require(_0x9221('0xa'));var csv=require(_0x9221('0xb'));var ejs=require(_0x9221('0xc'));var fs=require('fs');var _=require(_0x9221('0xd'));var squel=require('squel');var crypto=require(_0x9221('0xe'));var jsforce=require(_0x9221('0xf'));var deskjs=require(_0x9221('0x10'));var toCsv=require('to-csv');var querystring=require(_0x9221('0x11'));var Papa=require(_0x9221('0x12'));var Redis=require(_0x9221('0x13'));var authService=require(_0x9221('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x9221('0x15'));var hardwareService=require(_0x9221('0x16'));var logger=require(_0x9221('0x17'))(_0x9221('0x18'));var utils=require(_0x9221('0x19'));var config=require(_0x9221('0x1a'));var db=require(_0x9221('0x1b'))['db'];config[_0x9221('0x1c')]=_[_0x9221('0x1d')](config[_0x9221('0x1c')],{'host':_0x9221('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9221('0x1c')]));require(_0x9221('0x1f'))[_0x9221('0x20')](socket);var jayson=require(_0x9221('0x21'));var client=jayson[_0x9221('0x22')][_0x9221('0x23')]({'port':0x232c});var client9002=jayson[_0x9221('0x22')]['http']({'port':0x232a});function checkPasswordPattern(_0x51ac48,_0x261d95,_0xf34abd){if(_0xf34abd){var _0x8a1b2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x8a1b2[_0x9221('0x24')](_0x261d95)){return _0x51ac48;}else{throw new db[(_0x9221('0x25'))][(_0x9221('0x26'))](_0x9221('0x27'));}}else{return _0x51ac48;}}function respondWithRpcPromise(_0x531c45,_0x5ccb14,_0x56e28e,_0x4bdb4a){return new BPromise(function(_0x2eb2d0,_0x3e2a73){var _0x55b6ed=_0x4bdb4a||client;return _0x55b6ed[_0x9221('0x28')](_0x531c45,_0x56e28e)['then'](function(_0x56c5bd){logger[_0x9221('0x29')](_0x9221('0x2a'),_0x5ccb14,'request\x20sent');logger[_0x9221('0x2b')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x5ccb14,_0x9221('0x2c'),JSON[_0x9221('0x2d')](_0x56c5bd));if(_0x56c5bd[_0x9221('0x2e')]){if(_0x56c5bd[_0x9221('0x2e')]['code']===0x1f4){logger[_0x9221('0x2e')]('ChatMessage,\x20%s,\x20%s',_0x5ccb14,_0x56c5bd[_0x9221('0x2e')][_0x9221('0x2f')]);return _0x3e2a73(_0x56c5bd[_0x9221('0x2e')][_0x9221('0x2f')]);}logger['error'](_0x9221('0x2a'),_0x5ccb14,_0x56c5bd[_0x9221('0x2e')]['message']);return _0x2eb2d0(_0x56c5bd['error'][_0x9221('0x2f')]);}else{logger[_0x9221('0x29')]('ChatMessage,\x20%s,\x20%s',_0x5ccb14,_0x9221('0x2c'));_0x2eb2d0(_0x56c5bd[_0x9221('0x30')][_0x9221('0x2f')]);}})['catch'](function(_0x217fbb){logger['error'](_0x9221('0x2a'),_0x5ccb14,_0x217fbb);_0x3e2a73(_0x217fbb);});});}function respondWithStatusCode(_0xa0e5ff,_0x34e40b){_0x34e40b=_0x34e40b||0xcc;return function(_0x39adfe){if(_0x39adfe){return _0xa0e5ff[_0x9221('0x31')](_0x34e40b);}return _0xa0e5ff[_0x9221('0x32')](_0x34e40b)[_0x9221('0x33')]();};}function respondWithResult(_0xbf16b1,_0x41e823){_0x41e823=_0x41e823||0xc8;return function(_0x4bbdcb){if(_0x4bbdcb){return _0xbf16b1[_0x9221('0x32')](_0x41e823)[_0x9221('0x34')](_0x4bbdcb);}};}function respondWithFilteredResult(_0x52d706,_0x51babb){return function(_0xfb28df){if(_0xfb28df){var _0x67deb0=_0xfb28df[_0x9221('0x35')],_0x41edf3=_0x51babb[_0x9221('0x36')],_0x21acad=_0x51babb[_0x9221('0x36')]+_0x51babb[_0x9221('0x37')],_0x21f173;if(_0x21acad>=_0x67deb0){_0x21acad=_0x67deb0;_0x21f173=0xc8;}else{_0x21f173=0xce;}_0x52d706['status'](_0x21f173);return _0x52d706['set']('Content-Range',_0x41edf3+'-'+_0x21acad+'/'+_0x67deb0)[_0x9221('0x34')](_0xfb28df);}return null;};}function patchUpdates(_0x235f0b){return function(_0xbed2ce){try{jsonpatch[_0x9221('0x38')](_0xbed2ce,_0x235f0b,!![]);}catch(_0x313010){return BPromise[_0x9221('0x39')](_0x313010);}return _0xbed2ce['save']();};}function saveUpdates(_0x244a7c,_0x3312b0){return function(_0x2b14d1){if(_0x2b14d1){return _0x2b14d1[_0x9221('0x3a')](_0x244a7c)[_0x9221('0x3b')](function(_0x304f0c){return _0x304f0c;});}return null;};}function removeEntity(_0x3c5554,_0x25b290){return function(_0x950543){if(_0x950543){return _0x950543[_0x9221('0x3c')]()['then'](function(){_0x3c5554[_0x9221('0x32')](0xcc)[_0x9221('0x33')]();});}};}function handleEntityNotFound(_0x4ef4cf,_0x24123d){return function(_0x5abbe8){if(!_0x5abbe8){_0x4ef4cf[_0x9221('0x31')](0x194);}return _0x5abbe8;};}function handleError(_0x2a35db,_0x145364){_0x145364=_0x145364||0x1f4;return function(_0x181d5c){logger[_0x9221('0x2e')](_0x181d5c[_0x9221('0x3d')]);if(_0x181d5c['name']){delete _0x181d5c[_0x9221('0x3e')];}_0x2a35db[_0x9221('0x32')](_0x145364)[_0x9221('0x3f')](_0x181d5c);};}exports[_0x9221('0x40')]=function(_0x1ec982,_0x3dab22){var _0x356412={},_0xf9d242={},_0x23b2dd={'count':0x0,'rows':[]};var _0x353452=_[_0x9221('0x41')](db[_0x9221('0x42')][_0x9221('0x43')],function(_0x46d383){return{'name':_0x46d383[_0x9221('0x44')],'type':_0x46d383[_0x9221('0x45')]['key']};});_0xf9d242['model']=_[_0x9221('0x41')](_0x353452,'name');_0xf9d242['query']=_[_0x9221('0x46')](_0x1ec982[_0x9221('0x47')]);_0xf9d242[_0x9221('0x48')]=_[_0x9221('0x49')](_0xf9d242[_0x9221('0x4a')],_0xf9d242['query']);_0x356412[_0x9221('0x4b')]=_[_0x9221('0x49')](_0xf9d242['model'],qs[_0x9221('0x4c')](_0x1ec982['query'][_0x9221('0x4c')]));_0x356412['attributes']=_0x356412['attributes'][_0x9221('0x4d')]?_0x356412['attributes']:_0xf9d242[_0x9221('0x4a')];if(!_0x1ec982[_0x9221('0x47')]['hasOwnProperty'](_0x9221('0x4e'))){_0x356412[_0x9221('0x37')]=qs[_0x9221('0x37')](_0x1ec982['query'][_0x9221('0x37')]);_0x356412[_0x9221('0x36')]=qs[_0x9221('0x36')](_0x1ec982[_0x9221('0x47')]['offset']);}_0x356412[_0x9221('0x4f')]=qs['sort'](_0x1ec982['query'][_0x9221('0x50')]);_0x356412[_0x9221('0x51')]=qs[_0x9221('0x48')](_['pick'](_0x1ec982[_0x9221('0x47')],_0xf9d242[_0x9221('0x48')]));if(_0x1ec982[_0x9221('0x47')][_0x9221('0x52')]){_0x356412['where']=_[_0x9221('0x53')](_0x356412[_0x9221('0x51')],{'$or':_['map'](_0x353452,function(_0x5b289f){if(_0x5b289f['type']!==_0x9221('0x54')){var _0x496623={};_0x496623[_0x5b289f[_0x9221('0x3e')]]={'$like':'%'+_0x1ec982['query']['filter']+'%'};return _0x496623;}})});}_0x356412=_[_0x9221('0x53')]({},_0x356412,_0x1ec982['options']);var _0x14ee5f={'where':_0x356412[_0x9221('0x51')]};return db['ChatMessage'][_0x9221('0x35')](_0x14ee5f)[_0x9221('0x3b')](function(_0x58602f){_0x23b2dd[_0x9221('0x35')]=_0x58602f;if(_0x1ec982[_0x9221('0x47')][_0x9221('0x55')]){_0x356412[_0x9221('0x56')]=[{'all':!![]}];}return db['ChatMessage'][_0x9221('0x57')](_0x356412);})[_0x9221('0x3b')](function(_0x1a7b4e){_0x23b2dd['rows']=_0x1a7b4e;return _0x23b2dd;})[_0x9221('0x3b')](respondWithFilteredResult(_0x3dab22,_0x356412))[_0x9221('0x58')](handleError(_0x3dab22,null));};exports['show']=function(_0x401939,_0xa5a711){var _0x1a8bdd={'raw':!![],'where':{'id':_0x401939[_0x9221('0x59')]['id']}},_0x532862={};_0x532862['model']=_[_0x9221('0x46')](db[_0x9221('0x42')][_0x9221('0x43')]);_0x532862['query']=_['keys'](_0x401939[_0x9221('0x47')]);_0x532862[_0x9221('0x48')]=_[_0x9221('0x49')](_0x532862[_0x9221('0x4a')],_0x532862[_0x9221('0x47')]);_0x1a8bdd[_0x9221('0x4b')]=_['intersection'](_0x532862[_0x9221('0x4a')],qs[_0x9221('0x4c')](_0x401939[_0x9221('0x47')][_0x9221('0x4c')]));_0x1a8bdd['attributes']=_0x1a8bdd[_0x9221('0x4b')][_0x9221('0x4d')]?_0x1a8bdd[_0x9221('0x4b')]:_0x532862[_0x9221('0x4a')];if(_0x401939[_0x9221('0x47')]['includeAll']){_0x1a8bdd[_0x9221('0x56')]=[{'all':!![]}];}_0x1a8bdd=_[_0x9221('0x53')]({},_0x1a8bdd,_0x401939[_0x9221('0x5a')]);return db['ChatMessage']['find'](_0x1a8bdd)[_0x9221('0x3b')](handleEntityNotFound(_0xa5a711,null))[_0x9221('0x3b')](respondWithResult(_0xa5a711,null))[_0x9221('0x58')](handleError(_0xa5a711,null));};exports[_0x9221('0x5b')]=function(_0x1f1864,_0x596cc5){return db[_0x9221('0x42')]['create'](_0x1f1864[_0x9221('0x5c')],{})[_0x9221('0x3b')](respondWithResult(_0x596cc5,0xc9))[_0x9221('0x58')](handleError(_0x596cc5,null));};exports[_0x9221('0x3a')]=function(_0x398ea8,_0x5c8fe2){if(_0x398ea8[_0x9221('0x5c')]['id']){delete _0x398ea8[_0x9221('0x5c')]['id'];}return db['ChatMessage'][_0x9221('0x5d')]({'where':{'id':_0x398ea8[_0x9221('0x59')]['id']}})['then'](handleEntityNotFound(_0x5c8fe2,null))['then'](saveUpdates(_0x398ea8[_0x9221('0x5c')],null))[_0x9221('0x3b')](respondWithResult(_0x5c8fe2,null))[_0x9221('0x58')](handleError(_0x5c8fe2,null));};exports[_0x9221('0x3c')]=function(_0x1efd4b,_0x5d7435){return db['ChatMessage'][_0x9221('0x5d')]({'where':{'id':_0x1efd4b['params']['id']}})[_0x9221('0x3b')](handleEntityNotFound(_0x5d7435,null))['then'](removeEntity(_0x5d7435,null))[_0x9221('0x58')](handleError(_0x5d7435,null));};exports['describe']=function(_0x443adb,_0x1a7b9e){return db[_0x9221('0x42')]['describe']()[_0x9221('0x3b')](respondWithResult(_0x1a7b9e,null))[_0x9221('0x58')](handleError(_0x1a7b9e,null));};var interaction_log=require(_0x9221('0x17'))(_0x9221('0x5e'));exports['accept']=function(_0x44cecd,_0x4ba02d,_0x48fc21){var _0x59d9fc={'channel':_0x9221('0x5f')};if(_0x44cecd[_0x9221('0x5c')]['id']){delete _0x44cecd[_0x9221('0x5c')]['id'];}_0x44cecd[_0x9221('0x5c')]['read']=!![];_0x44cecd[_0x9221('0x5c')][_0x9221('0x60')]=moment()['format'](_0x9221('0x61'));_0x44cecd['body'][_0x9221('0x62')]=_0x44cecd['body'][_0x9221('0x62')]||_0x44cecd[_0x9221('0x63')]['id'];return db[_0x9221('0x42')][_0x9221('0x5d')]({'where':{'id':_0x44cecd[_0x9221('0x59')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x9221('0x64')}]})['then'](handleEntityNotFound(_0x4ba02d,null))[_0x9221('0x3b')](saveUpdates(_0x44cecd['body'],null))[_0x9221('0x3b')](function(_0x120e22){if(_0x120e22){_0x59d9fc[_0x9221('0x2f')]=_0x120e22[_0x9221('0x65')]({'plain':!![]});return db[_0x9221('0x66')][_0x9221('0x5d')]({'where':{'id':_0x120e22[_0x9221('0x67')]}});}return null;})[_0x9221('0x3b')](handleEntityNotFound(_0x4ba02d,null))[_0x9221('0x3b')](function(_0x239a27){if(_0x239a27){return _0x239a27[_0x9221('0x3a')]({'UserId':_0x44cecd['body'][_0x9221('0x62')],'read1stAt':_[_0x9221('0x68')](_0x239a27[_0x9221('0x69')])?moment()[_0x9221('0x6a')](_0x9221('0x61')):undefined});}return null;})[_0x9221('0x3b')](function(_0x270e47){if(_0x270e47){_0x59d9fc[_0x9221('0x6b')]=_0x270e47[_0x9221('0x65')]({'plain':!![]});interaction_log[_0x9221('0x29')](_0x9221('0x6c'),_0x44cecd[_0x9221('0x63')]['id'],_0x44cecd[_0x9221('0x63')][_0x9221('0x3e')],_0x44cecd['user'][_0x9221('0x6d')],_0x59d9fc[_0x9221('0x6b')]['id'],_0x44cecd['body']?JSON[_0x9221('0x2d')](_0x44cecd[_0x9221('0x5c')]):_0x9221('0x6e'));return respondWithRpcPromise(_0x9221('0x6f'),_0x9221('0x70'),_0x59d9fc);}return null;})[_0x9221('0x3b')](function(_0x18d903){if(_0x18d903){if(_0x44cecd['body']['manual']){_0x59d9fc['message'][_0x9221('0x71')]=util[_0x9221('0x6a')]('SIP/%s',_0x44cecd[_0x9221('0x63')]['name']);_0x59d9fc['message'][_0x9221('0x72')]=_0x59d9fc[_0x9221('0x72')];_0x59d9fc['message'][_0x9221('0x73')]=_0x9221('0x74');return respondWithRpcPromise('EventManager','EventManager',{'event':_0x9221('0x75'),'message':_[_0x9221('0x53')](_0x59d9fc['message'],JSON[_0x9221('0x76')](_0x59d9fc['interaction'][_0x9221('0x77')]))},client9002)[_0x9221('0x3b')](function(){return _0x59d9fc;});}return _0x59d9fc;}return null;})[_0x9221('0x3b')](respondWithResult(_0x4ba02d,null))[_0x9221('0x58')](handleError(_0x4ba02d,null));};var interaction_log=require(_0x9221('0x17'))(_0x9221('0x5e'));exports[_0x9221('0x39')]=function(_0x51deb1,_0x13ccb7,_0x331ebf){var _0x18d9c3={'agent':{},'channel':_0x9221('0x5f')};if(_0x51deb1[_0x9221('0x5c')]['id']){delete _0x51deb1[_0x9221('0x5c')]['id'];}_0x51deb1[_0x9221('0x5c')]['UserId']=_0x51deb1[_0x9221('0x5c')]['UserId']||_0x51deb1[_0x9221('0x63')]['id'];_0x18d9c3[_0x9221('0x78')]['id']=_0x51deb1[_0x9221('0x5c')][_0x9221('0x62')];return db['ChatMessage'][_0x9221('0x5d')]({'where':{'id':_0x51deb1[_0x9221('0x59')]['id'],'UserId':null}})[_0x9221('0x3b')](handleEntityNotFound(_0x13ccb7,null))['then'](function(_0x3761df){if(_0x3761df){_0x18d9c3[_0x9221('0x2f')]=_0x3761df[_0x9221('0x65')]({'plain':!![]});return db[_0x9221('0x66')][_0x9221('0x5d')]({'where':{'id':_0x3761df['ChatInteractionId']}});}return null;})[_0x9221('0x3b')](handleEntityNotFound(_0x13ccb7,null))[_0x9221('0x3b')](function(_0x439175){if(_0x439175){_0x18d9c3['interaction']=_0x439175[_0x9221('0x65')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x51deb1[_0x9221('0x63')]['id'],_0x51deb1['user']['name'],_0x51deb1['user'][_0x9221('0x6d')],_0x18d9c3[_0x9221('0x6b')]['id'],_0x51deb1[_0x9221('0x5c')]?JSON['stringify'](_0x51deb1[_0x9221('0x5c')]):_0x9221('0x6e'));return respondWithRpcPromise(_0x9221('0x79'),'rejectMessage',_0x18d9c3);}return null;})[_0x9221('0x3b')](function(_0x58daf3){if(_0x58daf3){_0x58daf3[_0x9221('0x2f')][_0x9221('0x71')]=util[_0x9221('0x6a')](_0x9221('0x7a'),_0x51deb1[_0x9221('0x63')][_0x9221('0x3e')]);_0x58daf3[_0x9221('0x2f')][_0x9221('0x72')]=_0x18d9c3[_0x9221('0x72')];_0x58daf3[_0x9221('0x2f')][_0x9221('0x73')]=_0x9221('0x39');respondWithRpcPromise(_0x9221('0x7b'),_0x9221('0x7b'),{'event':_0x9221('0x7c'),'message':_0x58daf3[_0x9221('0x2f')]},client9002);return _0x18d9c3;}return null;})['then'](respondWithResult(_0x13ccb7,null))[_0x9221('0x58')](handleError(_0x13ccb7,null));}; \ No newline at end of file +var _0x5e36=['rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','ChatMessage,\x20%s,\x20%s','debug','stringify','error','message','info','request\x20sent','catch','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','end','name','send','index','rawAttributes','fieldName','type','key','model','map','query','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filters','merge','VIRTUAL','filter','options','ChatMessage','includeAll','params','keys','intersection','find','create','body','../../config/logger','chat-interactions','chat','read','readAt','UserId','user','CmContact','get','ChatInteraction','isNil','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','manual','interface','SIP/%s','channel','accept','EventManager','acceptmessage','parse','interaction','formData','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','html-pdf'];(function(_0x13c528,_0x1eabc6){var _0x5baf89=function(_0x18b2e7){while(--_0x18b2e7){_0x13c528['push'](_0x13c528['shift']());}};_0x5baf89(++_0x1eabc6);}(_0x5e36,0x15e));var _0x65e3=function(_0x30ad96,_0x4f74ef){_0x30ad96=_0x30ad96-0x0;var _0x34d451=_0x5e36[_0x30ad96];return _0x34d451;};'use strict';var pdf=require(_0x65e3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x65e3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65e3('0x2'));var rp=require(_0x65e3('0x3'));var moment=require(_0x65e3('0x4'));var BPromise=require(_0x65e3('0x5'));var Mustache=require(_0x65e3('0x6'));var util=require('util');var path=require(_0x65e3('0x7'));var sox=require(_0x65e3('0x8'));var csv=require(_0x65e3('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x65e3('0xa'));var squel=require(_0x65e3('0xb'));var crypto=require(_0x65e3('0xc'));var jsforce=require(_0x65e3('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x65e3('0x9'));var querystring=require('querystring');var Papa=require(_0x65e3('0xe'));var Redis=require(_0x65e3('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x65e3('0x10'));var as=require(_0x65e3('0x11'));var hardwareService=require(_0x65e3('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x65e3('0x13'));var config=require('../../config/environment');var db=require(_0x65e3('0x14'))['db'];config[_0x65e3('0x15')]=_['defaults'](config['redis'],{'host':_0x65e3('0x16'),'port':0x18eb});var socket=require(_0x65e3('0x17'))(new Redis(config[_0x65e3('0x15')]));require(_0x65e3('0x18'))[_0x65e3('0x19')](socket);var jayson=require(_0x65e3('0x1a'));var client=jayson[_0x65e3('0x1b')][_0x65e3('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x65e3('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x3ca461,_0x5e7e61,_0xd3a557){if(_0xd3a557){var _0x359691=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x359691['test'](_0x5e7e61)){return _0x3ca461;}else{throw new db['Sequelize'][(_0x65e3('0x1d'))](_0x65e3('0x1e'));}}else{return _0x3ca461;}}function respondWithRpcPromise(_0x471810,_0x239801,_0x1be0f6,_0x2e47fd){return new BPromise(function(_0x208c68,_0x3ea090){var _0x2bb14d=_0x2e47fd||client;return _0x2bb14d[_0x65e3('0x1f')](_0x471810,_0x1be0f6)['then'](function(_0x2792d3){logger['info'](_0x65e3('0x20'),_0x239801,'request\x20sent');logger[_0x65e3('0x21')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x239801,'request\x20sent',JSON[_0x65e3('0x22')](_0x2792d3));if(_0x2792d3[_0x65e3('0x23')]){if(_0x2792d3[_0x65e3('0x23')]['code']===0x1f4){logger[_0x65e3('0x23')](_0x65e3('0x20'),_0x239801,_0x2792d3[_0x65e3('0x23')][_0x65e3('0x24')]);return _0x3ea090(_0x2792d3['error'][_0x65e3('0x24')]);}logger[_0x65e3('0x23')](_0x65e3('0x20'),_0x239801,_0x2792d3[_0x65e3('0x23')][_0x65e3('0x24')]);return _0x208c68(_0x2792d3[_0x65e3('0x23')][_0x65e3('0x24')]);}else{logger[_0x65e3('0x25')](_0x65e3('0x20'),_0x239801,_0x65e3('0x26'));_0x208c68(_0x2792d3['result'][_0x65e3('0x24')]);}})[_0x65e3('0x27')](function(_0x1df94f){logger['error'](_0x65e3('0x20'),_0x239801,_0x1df94f);_0x3ea090(_0x1df94f);});});}function respondWithStatusCode(_0x35fe89,_0x2fac2e){_0x2fac2e=_0x2fac2e||0xcc;return function(_0x24899a){if(_0x24899a){return _0x35fe89[_0x65e3('0x28')](_0x2fac2e);}return _0x35fe89['status'](_0x2fac2e)['end']();};}function respondWithResult(_0xca1a5f,_0x480825){_0x480825=_0x480825||0xc8;return function(_0x5631ed){if(_0x5631ed){return _0xca1a5f[_0x65e3('0x29')](_0x480825)[_0x65e3('0x2a')](_0x5631ed);}};}function respondWithFilteredResult(_0x1eba49,_0x122aeb){return function(_0x5913ba){if(_0x5913ba){var _0x329208=_0x5913ba[_0x65e3('0x2b')],_0x340e72=_0x122aeb['offset'],_0x1fda61=_0x122aeb[_0x65e3('0x2c')]+_0x122aeb['limit'],_0x2282b4;if(_0x1fda61>=_0x329208){_0x1fda61=_0x329208;_0x2282b4=0xc8;}else{_0x2282b4=0xce;}_0x1eba49[_0x65e3('0x29')](_0x2282b4);return _0x1eba49[_0x65e3('0x2d')](_0x65e3('0x2e'),_0x340e72+'-'+_0x1fda61+'/'+_0x329208)[_0x65e3('0x2a')](_0x5913ba);}return null;};}function patchUpdates(_0x435a67){return function(_0x33f689){try{jsonpatch[_0x65e3('0x2f')](_0x33f689,_0x435a67,!![]);}catch(_0x29d381){return BPromise[_0x65e3('0x30')](_0x29d381);}return _0x33f689['save']();};}function saveUpdates(_0x1bc5e2,_0x2c8872){return function(_0x3c78b3){if(_0x3c78b3){return _0x3c78b3[_0x65e3('0x31')](_0x1bc5e2)[_0x65e3('0x32')](function(_0x5dbd76){return _0x5dbd76;});}return null;};}function removeEntity(_0xd27968,_0x1c45e1){return function(_0x5d0aad){if(_0x5d0aad){return _0x5d0aad[_0x65e3('0x33')]()['then'](function(){_0xd27968['status'](0xcc)[_0x65e3('0x34')]();});}};}function handleEntityNotFound(_0x18e957,_0x577046){return function(_0x49d7e8){if(!_0x49d7e8){_0x18e957['sendStatus'](0x194);}return _0x49d7e8;};}function handleError(_0x28614a,_0x256cd4){_0x256cd4=_0x256cd4||0x1f4;return function(_0x51cc3c){logger[_0x65e3('0x23')](_0x51cc3c['stack']);if(_0x51cc3c[_0x65e3('0x35')]){delete _0x51cc3c[_0x65e3('0x35')];}_0x28614a[_0x65e3('0x29')](_0x256cd4)[_0x65e3('0x36')](_0x51cc3c);};}exports[_0x65e3('0x37')]=function(_0xab7144,_0x47d148){var _0x70606f={},_0x577a09={},_0x28872b={'count':0x0,'rows':[]};var _0x23904d=_['map'](db['ChatMessage'][_0x65e3('0x38')],function(_0x214a37){return{'name':_0x214a37[_0x65e3('0x39')],'type':_0x214a37[_0x65e3('0x3a')][_0x65e3('0x3b')]};});_0x577a09[_0x65e3('0x3c')]=_[_0x65e3('0x3d')](_0x23904d,_0x65e3('0x35'));_0x577a09['query']=_['keys'](_0xab7144[_0x65e3('0x3e')]);_0x577a09['filters']=_['intersection'](_0x577a09[_0x65e3('0x3c')],_0x577a09['query']);_0x70606f['attributes']=_['intersection'](_0x577a09['model'],qs[_0x65e3('0x3f')](_0xab7144[_0x65e3('0x3e')][_0x65e3('0x3f')]));_0x70606f[_0x65e3('0x40')]=_0x70606f[_0x65e3('0x40')][_0x65e3('0x41')]?_0x70606f[_0x65e3('0x40')]:_0x577a09['model'];if(!_0xab7144['query'][_0x65e3('0x42')](_0x65e3('0x43'))){_0x70606f[_0x65e3('0x44')]=qs[_0x65e3('0x44')](_0xab7144[_0x65e3('0x3e')][_0x65e3('0x44')]);_0x70606f[_0x65e3('0x2c')]=qs[_0x65e3('0x2c')](_0xab7144['query'][_0x65e3('0x2c')]);}_0x70606f['order']=qs[_0x65e3('0x45')](_0xab7144['query'][_0x65e3('0x45')]);_0x70606f[_0x65e3('0x46')]=qs['filters'](_[_0x65e3('0x47')](_0xab7144[_0x65e3('0x3e')],_0x577a09[_0x65e3('0x48')]));if(_0xab7144[_0x65e3('0x3e')]['filter']){_0x70606f[_0x65e3('0x46')]=_[_0x65e3('0x49')](_0x70606f[_0x65e3('0x46')],{'$or':_[_0x65e3('0x3d')](_0x23904d,function(_0x12d26a){if(_0x12d26a['type']!==_0x65e3('0x4a')){var _0x31f7ad={};_0x31f7ad[_0x12d26a['name']]={'$like':'%'+_0xab7144['query'][_0x65e3('0x4b')]+'%'};return _0x31f7ad;}})});}_0x70606f=_[_0x65e3('0x49')]({},_0x70606f,_0xab7144[_0x65e3('0x4c')]);var _0x45d9b4={'where':_0x70606f[_0x65e3('0x46')]};return db[_0x65e3('0x4d')][_0x65e3('0x2b')](_0x45d9b4)[_0x65e3('0x32')](function(_0x12de23){_0x28872b['count']=_0x12de23;if(_0xab7144[_0x65e3('0x3e')][_0x65e3('0x4e')]){_0x70606f['include']=[{'all':!![]}];}return db[_0x65e3('0x4d')]['findAll'](_0x70606f);})[_0x65e3('0x32')](function(_0x146143){_0x28872b['rows']=_0x146143;return _0x28872b;})[_0x65e3('0x32')](respondWithFilteredResult(_0x47d148,_0x70606f))[_0x65e3('0x27')](handleError(_0x47d148,null));};exports['show']=function(_0x3f480e,_0x41670f){var _0x18926f={'raw':!![],'where':{'id':_0x3f480e[_0x65e3('0x4f')]['id']}},_0x465d84={};_0x465d84[_0x65e3('0x3c')]=_[_0x65e3('0x50')](db['ChatMessage']['rawAttributes']);_0x465d84['query']=_[_0x65e3('0x50')](_0x3f480e[_0x65e3('0x3e')]);_0x465d84[_0x65e3('0x48')]=_[_0x65e3('0x51')](_0x465d84[_0x65e3('0x3c')],_0x465d84['query']);_0x18926f[_0x65e3('0x40')]=_['intersection'](_0x465d84['model'],qs[_0x65e3('0x3f')](_0x3f480e['query'][_0x65e3('0x3f')]));_0x18926f[_0x65e3('0x40')]=_0x18926f[_0x65e3('0x40')][_0x65e3('0x41')]?_0x18926f['attributes']:_0x465d84['model'];if(_0x3f480e[_0x65e3('0x3e')][_0x65e3('0x4e')]){_0x18926f['include']=[{'all':!![]}];}_0x18926f=_['merge']({},_0x18926f,_0x3f480e[_0x65e3('0x4c')]);return db[_0x65e3('0x4d')][_0x65e3('0x52')](_0x18926f)[_0x65e3('0x32')](handleEntityNotFound(_0x41670f,null))['then'](respondWithResult(_0x41670f,null))[_0x65e3('0x27')](handleError(_0x41670f,null));};exports[_0x65e3('0x53')]=function(_0x415a4d,_0x567766){return db[_0x65e3('0x4d')][_0x65e3('0x53')](_0x415a4d['body'],{})[_0x65e3('0x32')](respondWithResult(_0x567766,0xc9))[_0x65e3('0x27')](handleError(_0x567766,null));};exports['update']=function(_0x5a01c8,_0x1ce294){if(_0x5a01c8[_0x65e3('0x54')]['id']){delete _0x5a01c8[_0x65e3('0x54')]['id'];}return db[_0x65e3('0x4d')][_0x65e3('0x52')]({'where':{'id':_0x5a01c8[_0x65e3('0x4f')]['id']}})[_0x65e3('0x32')](handleEntityNotFound(_0x1ce294,null))[_0x65e3('0x32')](saveUpdates(_0x5a01c8[_0x65e3('0x54')],null))[_0x65e3('0x32')](respondWithResult(_0x1ce294,null))[_0x65e3('0x27')](handleError(_0x1ce294,null));};exports[_0x65e3('0x33')]=function(_0x9a071a,_0xefea7b){return db['ChatMessage'][_0x65e3('0x52')]({'where':{'id':_0x9a071a[_0x65e3('0x4f')]['id']}})[_0x65e3('0x32')](handleEntityNotFound(_0xefea7b,null))[_0x65e3('0x32')](removeEntity(_0xefea7b,null))['catch'](handleError(_0xefea7b,null));};exports['describe']=function(_0x31c4f6,_0xf38aff){return db[_0x65e3('0x4d')]['describe']()[_0x65e3('0x32')](respondWithResult(_0xf38aff,null))['catch'](handleError(_0xf38aff,null));};var interaction_log=require(_0x65e3('0x55'))(_0x65e3('0x56'));exports['accept']=function(_0x27c6ea,_0x26bf3c,_0x111169){var _0x25780b={'channel':_0x65e3('0x57')};if(_0x27c6ea[_0x65e3('0x54')]['id']){delete _0x27c6ea[_0x65e3('0x54')]['id'];}_0x27c6ea[_0x65e3('0x54')][_0x65e3('0x58')]=!![];_0x27c6ea[_0x65e3('0x54')][_0x65e3('0x59')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x27c6ea[_0x65e3('0x54')][_0x65e3('0x5a')]=_0x27c6ea['body'][_0x65e3('0x5a')]||_0x27c6ea[_0x65e3('0x5b')]['id'];return db['ChatMessage'][_0x65e3('0x52')]({'where':{'id':_0x27c6ea[_0x65e3('0x4f')]['id'],'UserId':null},'include':[{'model':db[_0x65e3('0x5c')],'as':'Contact'}]})[_0x65e3('0x32')](handleEntityNotFound(_0x26bf3c,null))[_0x65e3('0x32')](saveUpdates(_0x27c6ea[_0x65e3('0x54')],null))[_0x65e3('0x32')](function(_0x9e449){if(_0x9e449){_0x25780b[_0x65e3('0x24')]=_0x9e449[_0x65e3('0x5d')]({'plain':!![]});return db[_0x65e3('0x5e')][_0x65e3('0x52')]({'where':{'id':_0x9e449['ChatInteractionId']}});}return null;})[_0x65e3('0x32')](handleEntityNotFound(_0x26bf3c,null))[_0x65e3('0x32')](function(_0x5dbeb8){if(_0x5dbeb8){return _0x5dbeb8[_0x65e3('0x31')]({'UserId':_0x27c6ea[_0x65e3('0x54')][_0x65e3('0x5a')],'read1stAt':_[_0x65e3('0x5f')](_0x5dbeb8[_0x65e3('0x60')])?moment()[_0x65e3('0x61')](_0x65e3('0x62')):undefined});}return null;})[_0x65e3('0x32')](function(_0x949bf9){if(_0x949bf9){_0x25780b['interaction']=_0x949bf9[_0x65e3('0x5d')]({'plain':!![]});interaction_log[_0x65e3('0x25')](_0x65e3('0x63'),_0x27c6ea['user']['id'],_0x27c6ea[_0x65e3('0x5b')][_0x65e3('0x35')],_0x27c6ea['user'][_0x65e3('0x64')],_0x25780b['interaction']['id'],_0x27c6ea[_0x65e3('0x54')]?JSON[_0x65e3('0x22')](_0x27c6ea[_0x65e3('0x54')]):_0x65e3('0x65'));return respondWithRpcPromise(_0x65e3('0x66'),'acceptMessage',_0x25780b);}return null;})[_0x65e3('0x32')](function(_0x57dfe0){if(_0x57dfe0){if(_0x27c6ea[_0x65e3('0x54')][_0x65e3('0x67')]){_0x25780b[_0x65e3('0x24')][_0x65e3('0x68')]=util[_0x65e3('0x61')](_0x65e3('0x69'),_0x27c6ea[_0x65e3('0x5b')][_0x65e3('0x35')]);_0x25780b[_0x65e3('0x24')][_0x65e3('0x6a')]=_0x25780b[_0x65e3('0x6a')];_0x25780b['message']['event']=_0x65e3('0x6b');return respondWithRpcPromise('EventManager',_0x65e3('0x6c'),{'event':_0x65e3('0x6d'),'message':_[_0x65e3('0x49')](_0x25780b[_0x65e3('0x24')],JSON[_0x65e3('0x6e')](_0x25780b[_0x65e3('0x6f')][_0x65e3('0x70')]))},client9002)[_0x65e3('0x32')](function(){return _0x25780b;});}return _0x25780b;}return null;})['then'](respondWithResult(_0x26bf3c,null))['catch'](handleError(_0x26bf3c,null));};var interaction_log=require(_0x65e3('0x55'))('chat-interactions');exports['reject']=function(_0x4d8597,_0x7cdbac,_0x53ef27){var _0x2dfe5b={'agent':{},'channel':_0x65e3('0x57')};if(_0x4d8597[_0x65e3('0x54')]['id']){delete _0x4d8597[_0x65e3('0x54')]['id'];}_0x4d8597['body'][_0x65e3('0x5a')]=_0x4d8597[_0x65e3('0x54')]['UserId']||_0x4d8597[_0x65e3('0x5b')]['id'];_0x2dfe5b['agent']['id']=_0x4d8597[_0x65e3('0x54')][_0x65e3('0x5a')];return db[_0x65e3('0x4d')]['find']({'where':{'id':_0x4d8597[_0x65e3('0x4f')]['id'],'UserId':null}})[_0x65e3('0x32')](handleEntityNotFound(_0x7cdbac,null))[_0x65e3('0x32')](function(_0x45be13){if(_0x45be13){_0x2dfe5b['message']=_0x45be13[_0x65e3('0x5d')]({'plain':!![]});return db[_0x65e3('0x5e')][_0x65e3('0x52')]({'where':{'id':_0x45be13[_0x65e3('0x71')]}});}return null;})[_0x65e3('0x32')](handleEntityNotFound(_0x7cdbac,null))[_0x65e3('0x32')](function(_0x3b43c4){if(_0x3b43c4){_0x2dfe5b['interaction']=_0x3b43c4['get']({'plain':!![]});interaction_log[_0x65e3('0x25')](_0x65e3('0x72'),_0x4d8597[_0x65e3('0x5b')]['id'],_0x4d8597[_0x65e3('0x5b')][_0x65e3('0x35')],_0x4d8597[_0x65e3('0x5b')][_0x65e3('0x64')],_0x2dfe5b['interaction']['id'],_0x4d8597[_0x65e3('0x54')]?JSON[_0x65e3('0x22')](_0x4d8597['body']):_0x65e3('0x65'));return respondWithRpcPromise(_0x65e3('0x73'),_0x65e3('0x74'),_0x2dfe5b);}return null;})[_0x65e3('0x32')](function(_0x2bd7a8){if(_0x2bd7a8){_0x2bd7a8[_0x65e3('0x24')][_0x65e3('0x68')]=util[_0x65e3('0x61')]('SIP/%s',_0x4d8597[_0x65e3('0x5b')][_0x65e3('0x35')]);_0x2bd7a8[_0x65e3('0x24')]['channel']=_0x2dfe5b[_0x65e3('0x6a')];_0x2bd7a8[_0x65e3('0x24')]['event']='reject';respondWithRpcPromise(_0x65e3('0x6c'),_0x65e3('0x6c'),{'event':'rejectmessage','message':_0x2bd7a8[_0x65e3('0x24')]},client9002);return _0x2dfe5b;}return null;})['then'](respondWithResult(_0x7cdbac,null))[_0x65e3('0x27')](handleError(_0x7cdbac,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 08f1bbd..1d9cd32 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 _0xb095=['../../mysqldb','ChatMessage','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x333010,_0x5e936b){var _0x5ea9e8=function(_0xf0ab2){while(--_0xf0ab2){_0x333010['push'](_0x333010['shift']());}};_0x5ea9e8(++_0x5e936b);}(_0xb095,0xf2));var _0x5b09=function(_0x2161a9,_0x4af792){_0x2161a9=_0x2161a9-0x0;var _0x58cdf2=_0xb095[_0x2161a9];return _0x58cdf2;};'use strict';var EventEmitter=require(_0x5b09('0x0'));var ChatMessage=require(_0x5b09('0x1'))['db'][_0x5b09('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x5b09('0x3'),'afterDestroy':_0x5b09('0x4')};function emitEvent(_0x1fab89){return function(_0x40266b,_0x5381bd,_0x53d387){ChatMessageEvents[_0x5b09('0x5')](_0x1fab89+':'+_0x40266b['id'],_0x40266b);ChatMessageEvents['emit'](_0x1fab89,_0x40266b);_0x53d387(null);};}for(var e in events){if(events[_0x5b09('0x6')](e)){var event=events[e];ChatMessage[_0x5b09('0x7')](e,emitEvent(event));}}module[_0x5b09('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0x1b71=['update','remove','emit','exports','../../mysqldb','setMaxListeners','save'];(function(_0x396443,_0x43da32){var _0xdea6d1=function(_0x3b3f29){while(--_0x3b3f29){_0x396443['push'](_0x396443['shift']());}};_0xdea6d1(++_0x43da32);}(_0x1b71,0xa5));var _0x11b7=function(_0x2676cd,_0x8431b3){_0x2676cd=_0x2676cd-0x0;var _0x15f1f6=_0x1b71[_0x2676cd];return _0x15f1f6;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x11b7('0x0'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x11b7('0x1')](0x0);var events={'afterCreate':_0x11b7('0x2'),'afterUpdate':_0x11b7('0x3'),'afterDestroy':_0x11b7('0x4')};function emitEvent(_0x597e0d){return function(_0x22059a,_0x5e8b29,_0x3c0565){ChatMessageEvents[_0x11b7('0x5')](_0x597e0d+':'+_0x22059a['id'],_0x22059a);ChatMessageEvents[_0x11b7('0x5')](_0x597e0d,_0x22059a);_0x3c0565(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x11b7('0x6')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 8d11e47..ca8c45e 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 _0x9144=['findOne','ChatInteractionId','update','createdAt','catch','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','FULLTEXT','get','direction','toLowerCase','secret','isNil','UserId','ChatInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9144,0x1d1));var _0x4914=function(_0x2272b5,_0x362458){_0x2272b5=_0x2272b5-0x0;var _0x110156=_0x9144[_0x2272b5];return _0x110156;};'use strict';var _=require(_0x4914('0x0'));var util=require(_0x4914('0x1'));var logger=require(_0x4914('0x2'))(_0x4914('0x3'));var moment=require('moment');var BPromise=require(_0x4914('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4914('0x5'));var config=require(_0x4914('0x6'));var attributes=require(_0x4914('0x7'));module[_0x4914('0x8')]=function(_0x181849,_0x3ff405){return _0x181849[_0x4914('0x9')](_0x4914('0xa'),attributes,{'tableName':_0x4914('0xb'),'paranoid':![],'indexes':[{'name':_0x4914('0xc'),'fields':['body'],'type':_0x4914('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3fc17d,_0x55f5a6,_0x36c1dc){var _0x285cbf=_0x181849['models'];var _0x44cee7=_0x3fc17d[_0x4914('0xe')]({'plain':!![]});if(_0x44cee7[_0x4914('0xf')][_0x4914('0x10')]()==='in'||_0x44cee7[_0x4914('0xf')][_0x4914('0x10')]()==='out'&&!_0x44cee7[_0x4914('0x11')]&&!_[_0x4914('0x12')](_0x44cee7[_0x4914('0x13')])){_0x285cbf[_0x4914('0x14')][_0x4914('0x15')]({'where':{'id':_0x44cee7[_0x4914('0x16')]}})['then'](function(_0x281b0f){if(_0x281b0f){_0x281b0f[_0x4914('0x17')]({'lastMsgAt':_0x44cee7[_0x4914('0x18')],'lastMsgDirection':_0x44cee7[_0x4914('0xf')][_0x4914('0x10')]()});}})[_0x4914('0x19')](function(_0x4fabd0){console['error'](_0x4fabd0);});}_0x36c1dc();}},'charset':'utf8mb4','collate':_0x4914('0x1a')});}; \ No newline at end of file +var _0xf078=['define','ChatMessage','body','FULLTEXT','direction','toLowerCase','out','secret','findOne','ChatInteractionId','then','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','path','../../config/environment','./chatMessage.attributes','exports'];(function(_0x5a0688,_0x4e1028){var _0x57477f=function(_0xe1f67d){while(--_0xe1f67d){_0x5a0688['push'](_0x5a0688['shift']());}};_0x57477f(++_0x4e1028);}(_0xf078,0xc7));var _0x8f07=function(_0x3efdec,_0x187e4c){_0x3efdec=_0x3efdec-0x0;var _0x438d01=_0xf078[_0x3efdec];return _0x438d01;};'use strict';var _=require(_0x8f07('0x0'));var util=require(_0x8f07('0x1'));var logger=require('../../config/logger')(_0x8f07('0x2'));var moment=require('moment');var BPromise=require(_0x8f07('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8f07('0x4'));var rimraf=require('rimraf');var config=require(_0x8f07('0x5'));var attributes=require(_0x8f07('0x6'));module[_0x8f07('0x7')]=function(_0x365def,_0x26fdb5){return _0x365def[_0x8f07('0x8')](_0x8f07('0x9'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x8f07('0xa')],'type':_0x8f07('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x290323,_0x2f349a,_0x2bef53){var _0x17a2d9=_0x365def['models'];var _0x3b7566=_0x290323['get']({'plain':!![]});if(_0x3b7566[_0x8f07('0xc')][_0x8f07('0xd')]()==='in'||_0x3b7566[_0x8f07('0xc')][_0x8f07('0xd')]()===_0x8f07('0xe')&&!_0x3b7566[_0x8f07('0xf')]&&!_['isNil'](_0x3b7566['UserId'])){_0x17a2d9['ChatInteraction'][_0x8f07('0x10')]({'where':{'id':_0x3b7566[_0x8f07('0x11')]}})[_0x8f07('0x12')](function(_0x5c581c){if(_0x5c581c){_0x5c581c['update']({'lastMsgAt':_0x3b7566['createdAt'],'lastMsgDirection':_0x3b7566[_0x8f07('0xc')][_0x8f07('0xd')]()});}})[_0x8f07('0x13')](function(_0x27fe86){console[_0x8f07('0x14')](_0x27fe86);});}_0x2bef53();}},'charset':_0x8f07('0x15'),'collate':_0x8f07('0x16')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 86c784c..2c5f888 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 _0xebe3=['redis','localhost','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateChatMessage','create','body','options','lodash','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults'];(function(_0x545433,_0xe238b6){var _0x1d7243=function(_0x8261fd){while(--_0x8261fd){_0x545433['push'](_0x545433['shift']());}};_0x1d7243(++_0xe238b6);}(_0xebe3,0x16f));var _0x3ebe=function(_0x45118e,_0x2146a1){_0x45118e=_0x45118e-0x0;var _0x525040=_0xebe3[_0x45118e];return _0x525040;};'use strict';var _=require(_0x3ebe('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3ebe('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3ebe('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x3ebe('0x3'))(_0x3ebe('0x4'));var config=require(_0x3ebe('0x5'));var jayson=require(_0x3ebe('0x6'));var client=jayson[_0x3ebe('0x7')][_0x3ebe('0x8')]({'port':0x232a});config['redis']=_[_0x3ebe('0x9')](config[_0x3ebe('0xa')],{'host':_0x3ebe('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3ebe('0xa')]));require('./chatMessage.socket')['register'](socket);function respondWithRpcPromise(_0x32e6d7,_0x163d01,_0x4818df){return new BPromise(function(_0x121554,_0x42f0fe){return client[_0x3ebe('0xc')](_0x32e6d7,_0x4818df)[_0x3ebe('0xd')](function(_0x25bc91){logger['info'](_0x3ebe('0xe'),_0x163d01,_0x3ebe('0xf'));logger[_0x3ebe('0x10')](_0x3ebe('0x11'),_0x163d01,'request\x20sent',JSON[_0x3ebe('0x12')](_0x25bc91));if(_0x25bc91['error']){if(_0x25bc91[_0x3ebe('0x13')][_0x3ebe('0x14')]===0x1f4){logger[_0x3ebe('0x13')](_0x3ebe('0xe'),_0x163d01,_0x25bc91['error'][_0x3ebe('0x15')]);return _0x42f0fe(_0x25bc91[_0x3ebe('0x13')]['message']);}logger['error'](_0x3ebe('0xe'),_0x163d01,_0x25bc91['error'][_0x3ebe('0x15')]);return _0x121554(_0x25bc91['error'][_0x3ebe('0x15')]);}else{logger[_0x3ebe('0x16')]('ChatMessage,\x20%s,\x20%s',_0x163d01,_0x3ebe('0xf'));_0x121554(_0x25bc91[_0x3ebe('0x17')][_0x3ebe('0x15')]);}})[_0x3ebe('0x18')](function(_0x55aa2d){logger[_0x3ebe('0x13')](_0x3ebe('0xe'),_0x163d01,_0x55aa2d);_0x42f0fe(_0x55aa2d);});});}exports[_0x3ebe('0x19')]=function(_0x5872b5){var _0x9e1f57=this;return new Promise(function(_0x316eec,_0x2bcf0e){return db['ChatMessage'][_0x3ebe('0x1a')](_0x5872b5[_0x3ebe('0x1b')],{'raw':_0x5872b5[_0x3ebe('0x1c')]?_0x5872b5['options']['raw']===undefined?!![]:![]:!![]})[_0x3ebe('0xd')](function(_0xd73a42){logger[_0x3ebe('0x16')]('CreateChatMessage',_0x5872b5);logger[_0x3ebe('0x10')](_0x3ebe('0x19'),_0x5872b5,JSON[_0x3ebe('0x12')](_0xd73a42));_0x316eec(_0xd73a42);})[_0x3ebe('0x18')](function(_0x1ed65d){logger[_0x3ebe('0x13')](_0x3ebe('0x19'),_0x1ed65d[_0x3ebe('0x15')],_0x5872b5);_0x2bcf0e(_0x9e1f57['error'](0x1f4,_0x1ed65d[_0x3ebe('0x15')]));});});}; \ No newline at end of file +var _0xdd21=['CreateChatMessage','ChatMessage','create','body','options','raw','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatMessage.socket','register','then','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xdd21,0x138));var _0x1dd2=function(_0x3cee8b,_0x428932){_0x3cee8b=_0x3cee8b-0x0;var _0x44af17=_0xdd21[_0x3cee8b];return _0x44af17;};'use strict';var _=require(_0x1dd2('0x0'));var util=require(_0x1dd2('0x1'));var moment=require('moment');var BPromise=require(_0x1dd2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1dd2('0x3'));var db=require(_0x1dd2('0x4'))['db'];var utils=require(_0x1dd2('0x5'));var logger=require('../../config/logger')(_0x1dd2('0x6'));var config=require(_0x1dd2('0x7'));var jayson=require(_0x1dd2('0x8'));var client=jayson[_0x1dd2('0x9')][_0x1dd2('0xa')]({'port':0x232a});config[_0x1dd2('0xb')]=_['defaults'](config[_0x1dd2('0xb')],{'host':_0x1dd2('0xc'),'port':0x18eb});var socket=require(_0x1dd2('0xd'))(new Redis(config['redis']));require(_0x1dd2('0xe'))[_0x1dd2('0xf')](socket);function respondWithRpcPromise(_0x3e6417,_0x5e9fa7,_0x232786){return new BPromise(function(_0x48a513,_0x4c9d2a){return client['request'](_0x3e6417,_0x232786)[_0x1dd2('0x10')](function(_0x116feb){logger['info'](_0x1dd2('0x11'),_0x5e9fa7,'request\x20sent');logger[_0x1dd2('0x12')](_0x1dd2('0x13'),_0x5e9fa7,_0x1dd2('0x14'),JSON[_0x1dd2('0x15')](_0x116feb));if(_0x116feb['error']){if(_0x116feb[_0x1dd2('0x16')][_0x1dd2('0x17')]===0x1f4){logger[_0x1dd2('0x16')]('ChatMessage,\x20%s,\x20%s',_0x5e9fa7,_0x116feb['error'][_0x1dd2('0x18')]);return _0x4c9d2a(_0x116feb[_0x1dd2('0x16')][_0x1dd2('0x18')]);}logger[_0x1dd2('0x16')]('ChatMessage,\x20%s,\x20%s',_0x5e9fa7,_0x116feb[_0x1dd2('0x16')]['message']);return _0x48a513(_0x116feb[_0x1dd2('0x16')][_0x1dd2('0x18')]);}else{logger[_0x1dd2('0x19')](_0x1dd2('0x11'),_0x5e9fa7,_0x1dd2('0x14'));_0x48a513(_0x116feb[_0x1dd2('0x1a')][_0x1dd2('0x18')]);}})[_0x1dd2('0x1b')](function(_0x5cf3d7){logger['error'](_0x1dd2('0x11'),_0x5e9fa7,_0x5cf3d7);_0x4c9d2a(_0x5cf3d7);});});}exports[_0x1dd2('0x1c')]=function(_0x11d37d){var _0x597a3d=this;return new Promise(function(_0x1f1e5d,_0x4318e3){return db[_0x1dd2('0x1d')][_0x1dd2('0x1e')](_0x11d37d[_0x1dd2('0x1f')],{'raw':_0x11d37d[_0x1dd2('0x20')]?_0x11d37d['options'][_0x1dd2('0x21')]===undefined?!![]:![]:!![]})[_0x1dd2('0x10')](function(_0x4ea6a2){logger[_0x1dd2('0x19')](_0x1dd2('0x1c'),_0x11d37d);logger[_0x1dd2('0x12')](_0x1dd2('0x1c'),_0x11d37d,JSON[_0x1dd2('0x15')](_0x4ea6a2));_0x1f1e5d(_0x4ea6a2);})[_0x1dd2('0x1b')](function(_0x4d06c9){logger['error'](_0x1dd2('0x1c'),_0x4d06c9[_0x1dd2('0x18')],_0x11d37d);_0x4318e3(_0x597a3d[_0x1dd2('0x16')](0x1f4,_0x4d06c9[_0x1dd2('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index e1097dd..834506a 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 _0xb016=['register','./chatMessage.events','save','emit'];(function(_0x5e8c32,_0x1b1f3f){var _0x595f7b=function(_0x38840e){while(--_0x38840e){_0x5e8c32['push'](_0x5e8c32['shift']());}};_0x595f7b(++_0x1b1f3f);}(_0xb016,0x159));var _0x6b01=function(_0x57b222,_0x28fc93){_0x57b222=_0x57b222-0x0;var _0x545981=_0xb016[_0x57b222];return _0x545981;};'use strict';var ChatMessageEvents=require(_0x6b01('0x0'));var events=[_0x6b01('0x1'),'remove','update'];function createListener(_0xf74fa1,_0x531b6a){return function(_0x160a7d){_0x531b6a[_0x6b01('0x2')](_0xf74fa1,_0x160a7d);};}function removeListener(_0x161b59,_0x3b9de1){return function(){ChatMessageEvents['removeListener'](_0x161b59,_0x3b9de1);};}exports[_0x6b01('0x3')]=function(_0x65407a){for(var _0x192b2d=0x0,_0x5759a1=events['length'];_0x192b2d<_0x5759a1;_0x192b2d++){var _0x374aab=events[_0x192b2d];var _0x39f9fa=createListener('chatMessage:'+_0x374aab,_0x65407a);ChatMessageEvents['on'](_0x374aab,_0x39f9fa);}}; \ No newline at end of file +var _0x2675=['register','length','chatMessage:','./chatMessage.events','emit','removeListener'];(function(_0x2c7dc6,_0x3c4ce0){var _0x10002b=function(_0x26f390){while(--_0x26f390){_0x2c7dc6['push'](_0x2c7dc6['shift']());}};_0x10002b(++_0x3c4ce0);}(_0x2675,0x75));var _0x5267=function(_0x10b04c,_0x13a741){_0x10b04c=_0x10b04c-0x0;var _0x455125=_0x2675[_0x10b04c];return _0x455125;};'use strict';var ChatMessageEvents=require(_0x5267('0x0'));var events=['save','remove','update'];function createListener(_0x1da342,_0x2ae442){return function(_0x57c95a){_0x2ae442[_0x5267('0x1')](_0x1da342,_0x57c95a);};}function removeListener(_0x36bdf0,_0x4e2548){return function(){ChatMessageEvents[_0x5267('0x2')](_0x36bdf0,_0x4e2548);};}exports[_0x5267('0x3')]=function(_0x4bd042){for(var _0x10f92c=0x0,_0x20f065=events[_0x5267('0x4')];_0x10f92c<_0x20f065;_0x10f92c++){var _0x527c16=events[_0x10f92c];var _0x9e0a27=createListener(_0x5267('0x5')+_0x527c16,_0x4bd042);ChatMessageEvents['on'](_0x527c16,_0x9e0a27);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 56b50f0..470970c 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 _0x4c09=['/:id','/:id/accept','accept','put','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','show','post','tracked','chat','chatmessage:create','create'];(function(_0x2aee2f,_0xad9887){var _0x19337f=function(_0x2e62d){while(--_0x2e62d){_0x2aee2f['push'](_0x2aee2f['shift']());}};_0x19337f(++_0xad9887);}(_0x4c09,0x182));var _0x94c0=function(_0x3e2480,_0x2eed70){_0x3e2480=_0x3e2480-0x0;var _0x652c0=_0x4c09[_0x3e2480];return _0x652c0;};'use strict';var multer=require(_0x94c0('0x0'));var util=require(_0x94c0('0x1'));var path=require(_0x94c0('0x2'));var timeout=require(_0x94c0('0x3'));var express=require(_0x94c0('0x4'));var router=express[_0x94c0('0x5')]();var auth=require(_0x94c0('0x6'));var interaction=require(_0x94c0('0x7'));var config=require('../../config/environment');var controller=require(_0x94c0('0x8'));router[_0x94c0('0x9')]('/',auth[_0x94c0('0xa')](),controller[_0x94c0('0xb')]);router[_0x94c0('0x9')](_0x94c0('0xc'),auth['isAuthenticated'](),controller[_0x94c0('0xd')]);router[_0x94c0('0x9')]('/:id',auth[_0x94c0('0xa')](),controller[_0x94c0('0xe')]);router[_0x94c0('0xf')]('/',auth[_0x94c0('0xa')](),interaction[_0x94c0('0x10')](_0x94c0('0x11'),_0x94c0('0x12')),controller[_0x94c0('0x13')]);router['put'](_0x94c0('0x14'),controller['update']);router['put'](_0x94c0('0x15'),auth[_0x94c0('0xa')](),controller[_0x94c0('0x16')]);router[_0x94c0('0x17')](_0x94c0('0x18'),auth[_0x94c0('0xa')](),controller[_0x94c0('0x19')]);router[_0x94c0('0x1a')](_0x94c0('0x14'),auth[_0x94c0('0xa')](),controller[_0x94c0('0x1b')]);module[_0x94c0('0x1c')]=router; \ No newline at end of file +var _0x7eed=['get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','/:id/accept','accept','/:id/reject','delete','destroy','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatMessage.controller'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x7eed,0x186));var _0xd7ee=function(_0x45b771,_0x2caece){_0x45b771=_0x45b771-0x0;var _0x7ef73d=_0x7eed[_0x45b771];return _0x7ef73d;};'use strict';var multer=require(_0xd7ee('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd7ee('0x1'));var express=require('express');var router=express[_0xd7ee('0x2')]();var auth=require(_0xd7ee('0x3'));var interaction=require(_0xd7ee('0x4'));var config=require('../../config/environment');var controller=require(_0xd7ee('0x5'));router[_0xd7ee('0x6')]('/',auth[_0xd7ee('0x7')](),controller[_0xd7ee('0x8')]);router[_0xd7ee('0x6')](_0xd7ee('0x9'),auth[_0xd7ee('0x7')](),controller[_0xd7ee('0xa')]);router[_0xd7ee('0x6')](_0xd7ee('0xb'),auth[_0xd7ee('0x7')](),controller[_0xd7ee('0xc')]);router[_0xd7ee('0xd')]('/',auth[_0xd7ee('0x7')](),interaction['tracked']('chat','chatmessage:create'),controller[_0xd7ee('0xe')]);router[_0xd7ee('0xf')](_0xd7ee('0xb'),controller[_0xd7ee('0x10')]);router[_0xd7ee('0xf')](_0xd7ee('0x11'),auth[_0xd7ee('0x7')](),controller[_0xd7ee('0x12')]);router[_0xd7ee('0xf')](_0xd7ee('0x13'),auth[_0xd7ee('0x7')](),controller['reject']);router[_0xd7ee('0x14')](_0xd7ee('0xb'),auth[_0xd7ee('0x7')](),controller[_0xd7ee('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 53a10a4..723b25d 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 _0xc9f4=['TEXT','medium','exports'];(function(_0x16452c,_0x165313){var _0x7a7df7=function(_0x2876d6){while(--_0x2876d6){_0x16452c['push'](_0x16452c['shift']());}};_0x7a7df7(++_0x165313);}(_0xc9f4,0xef));var _0x4c9f=function(_0x39e240,_0xc696da){_0x39e240=_0x39e240-0x0;var _0x231d52=_0xc9f4[_0x39e240];return _0x231d52;};'use strict';var Sequelize=require('sequelize');module[_0x4c9f('0x0')]={'body':{'type':Sequelize[_0x4c9f('0x1')](_0x4c9f('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0xbb24=['sequelize','exports','TEXT'];(function(_0x1b9635,_0x2a8b42){var _0x1280fc=function(_0x1f4916){while(--_0x1f4916){_0x1b9635['push'](_0x1b9635['shift']());}};_0x1280fc(++_0x2a8b42);}(_0xbb24,0x1c5));var _0x4bb2=function(_0x5f4a5a,_0x532d79){_0x5f4a5a=_0x5f4a5a-0x0;var _0x3419a3=_0xbb24[_0x5f4a5a];return _0x3419a3;};'use strict';var Sequelize=require(_0x4bb2('0x0'));module[_0x4bb2('0x1')]={'body':{'type':Sequelize[_0x4bb2('0x2')]('medium'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index cf5b1ff..85550d1 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 _0x25b3=['sendStatus','end','status','json','count','offset','limit','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','ChatOfflineMessage','fieldName','type','model','keys','filters','intersection','query','attributes','fields','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','findAll','rows','catch','show','includeAll','include','find','create','body','update','params','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x25b3,0xc3));var _0x325b=function(_0x5c365f,_0x3b40ed){_0x5c365f=_0x5c365f-0x0;var _0x295e1b=_0x25b3[_0x5c365f];return _0x295e1b;};'use strict';var pdf=require(_0x325b('0x0'));var emlformat=require(_0x325b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x325b('0x2'));var jsonpatch=require(_0x325b('0x3'));var rp=require(_0x325b('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x325b('0x5'));var util=require(_0x325b('0x6'));var path=require(_0x325b('0x7'));var sox=require('sox');var csv=require(_0x325b('0x8'));var ejs=require(_0x325b('0x9'));var fs=require('fs');var _=require(_0x325b('0xa'));var squel=require(_0x325b('0xb'));var crypto=require('crypto');var jsforce=require(_0x325b('0xc'));var deskjs=require(_0x325b('0xd'));var toCsv=require(_0x325b('0x8'));var querystring=require(_0x325b('0xe'));var Papa=require(_0x325b('0xf'));var Redis=require(_0x325b('0x10'));var authService=require(_0x325b('0x11'));var qs=require(_0x325b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x325b('0x13'));var logger=require(_0x325b('0x14'))(_0x325b('0x15'));var utils=require(_0x325b('0x16'));var config=require('../../config/environment');var db=require(_0x325b('0x17'))['db'];function respondWithStatusCode(_0x149516,_0x3c1ca1){_0x3c1ca1=_0x3c1ca1||0xcc;return function(_0x103100){if(_0x103100){return _0x149516[_0x325b('0x18')](_0x3c1ca1);}return _0x149516['status'](_0x3c1ca1)[_0x325b('0x19')]();};}function respondWithResult(_0x44425a,_0x1e3976){_0x1e3976=_0x1e3976||0xc8;return function(_0x35a073){if(_0x35a073){return _0x44425a[_0x325b('0x1a')](_0x1e3976)[_0x325b('0x1b')](_0x35a073);}};}function respondWithFilteredResult(_0x47aaf9,_0x251cae){return function(_0x5237d2){if(_0x5237d2){var _0x2025d8=_0x5237d2[_0x325b('0x1c')],_0x86da8f=_0x251cae[_0x325b('0x1d')],_0x31f6bd=_0x251cae['offset']+_0x251cae[_0x325b('0x1e')],_0x1f8fbc;if(_0x31f6bd>=_0x2025d8){_0x31f6bd=_0x2025d8;_0x1f8fbc=0xc8;}else{_0x1f8fbc=0xce;}_0x47aaf9[_0x325b('0x1a')](_0x1f8fbc);return _0x47aaf9['set'](_0x325b('0x1f'),_0x86da8f+'-'+_0x31f6bd+'/'+_0x2025d8)['json'](_0x5237d2);}return null;};}function patchUpdates(_0x154f7b){return function(_0x1ca0e2){try{jsonpatch['apply'](_0x1ca0e2,_0x154f7b,!![]);}catch(_0x4dd394){return BPromise[_0x325b('0x20')](_0x4dd394);}return _0x1ca0e2[_0x325b('0x21')]();};}function saveUpdates(_0x2b6f77,_0x23dc60){return function(_0x45eece){if(_0x45eece){return _0x45eece['update'](_0x2b6f77)[_0x325b('0x22')](function(_0x1e14d3){return _0x1e14d3;});}return null;};}function removeEntity(_0x4f48b2,_0x62a72){return function(_0x164fee){if(_0x164fee){return _0x164fee[_0x325b('0x23')]()[_0x325b('0x22')](function(){_0x4f48b2[_0x325b('0x1a')](0xcc)[_0x325b('0x19')]();});}};}function handleEntityNotFound(_0x59bb18,_0x3d1ca4){return function(_0x1ea5e1){if(!_0x1ea5e1){_0x59bb18[_0x325b('0x18')](0x194);}return _0x1ea5e1;};}function handleError(_0x3f039f,_0x268941){_0x268941=_0x268941||0x1f4;return function(_0x34ca4a){logger[_0x325b('0x24')](_0x34ca4a[_0x325b('0x25')]);if(_0x34ca4a[_0x325b('0x26')]){delete _0x34ca4a['name'];}_0x3f039f['status'](_0x268941)[_0x325b('0x27')](_0x34ca4a);};}exports[_0x325b('0x28')]=function(_0x26eb51,_0x59084a){var _0x59ecaf={},_0x59d290={},_0x46f044={'count':0x0,'rows':[]};var _0x4e7a37=_[_0x325b('0x29')](db[_0x325b('0x2a')]['rawAttributes'],function(_0x327fc8){return{'name':_0x327fc8[_0x325b('0x2b')],'type':_0x327fc8[_0x325b('0x2c')]['key']};});_0x59d290[_0x325b('0x2d')]=_[_0x325b('0x29')](_0x4e7a37,_0x325b('0x26'));_0x59d290['query']=_[_0x325b('0x2e')](_0x26eb51['query']);_0x59d290[_0x325b('0x2f')]=_[_0x325b('0x30')](_0x59d290[_0x325b('0x2d')],_0x59d290[_0x325b('0x31')]);_0x59ecaf[_0x325b('0x32')]=_[_0x325b('0x30')](_0x59d290[_0x325b('0x2d')],qs[_0x325b('0x33')](_0x26eb51[_0x325b('0x31')][_0x325b('0x33')]));_0x59ecaf[_0x325b('0x32')]=_0x59ecaf[_0x325b('0x32')]['length']?_0x59ecaf[_0x325b('0x32')]:_0x59d290['model'];if(!_0x26eb51[_0x325b('0x31')]['hasOwnProperty'](_0x325b('0x34'))){_0x59ecaf[_0x325b('0x1e')]=qs[_0x325b('0x1e')](_0x26eb51[_0x325b('0x31')][_0x325b('0x1e')]);_0x59ecaf[_0x325b('0x1d')]=qs[_0x325b('0x1d')](_0x26eb51[_0x325b('0x31')][_0x325b('0x1d')]);}_0x59ecaf[_0x325b('0x35')]=qs['sort'](_0x26eb51[_0x325b('0x31')][_0x325b('0x36')]);_0x59ecaf['where']=qs[_0x325b('0x2f')](_[_0x325b('0x37')](_0x26eb51[_0x325b('0x31')],_0x59d290[_0x325b('0x2f')]));if(_0x26eb51[_0x325b('0x31')][_0x325b('0x38')]){_0x59ecaf[_0x325b('0x39')]=_[_0x325b('0x3a')](_0x59ecaf['where'],{'$or':_[_0x325b('0x29')](_0x4e7a37,function(_0x5b9437){if(_0x5b9437[_0x325b('0x2c')]!==_0x325b('0x3b')){var _0x290f89={};_0x290f89[_0x5b9437[_0x325b('0x26')]]={'$like':'%'+_0x26eb51['query'][_0x325b('0x38')]+'%'};return _0x290f89;}})});}_0x59ecaf=_[_0x325b('0x3a')]({},_0x59ecaf,_0x26eb51[_0x325b('0x3c')]);var _0x292212={'where':_0x59ecaf[_0x325b('0x39')]};return db[_0x325b('0x2a')][_0x325b('0x1c')](_0x292212)[_0x325b('0x22')](function(_0x5bee5e){_0x46f044[_0x325b('0x1c')]=_0x5bee5e;if(_0x26eb51['query']['includeAll']){_0x59ecaf['include']=[{'all':!![]}];}return db[_0x325b('0x2a')][_0x325b('0x3d')](_0x59ecaf);})['then'](function(_0x40703d){_0x46f044[_0x325b('0x3e')]=_0x40703d;return _0x46f044;})['then'](respondWithFilteredResult(_0x59084a,_0x59ecaf))[_0x325b('0x3f')](handleError(_0x59084a,null));};exports[_0x325b('0x40')]=function(_0x59fede,_0x46a20c){var _0x176a9b={'raw':!![],'where':{'id':_0x59fede['params']['id']}},_0x5cb20c={};_0x5cb20c['model']=_[_0x325b('0x2e')](db['ChatOfflineMessage']['rawAttributes']);_0x5cb20c[_0x325b('0x31')]=_[_0x325b('0x2e')](_0x59fede[_0x325b('0x31')]);_0x5cb20c[_0x325b('0x2f')]=_['intersection'](_0x5cb20c[_0x325b('0x2d')],_0x5cb20c['query']);_0x176a9b['attributes']=_['intersection'](_0x5cb20c[_0x325b('0x2d')],qs[_0x325b('0x33')](_0x59fede[_0x325b('0x31')][_0x325b('0x33')]));_0x176a9b['attributes']=_0x176a9b[_0x325b('0x32')]['length']?_0x176a9b['attributes']:_0x5cb20c['model'];if(_0x59fede[_0x325b('0x31')][_0x325b('0x41')]){_0x176a9b[_0x325b('0x42')]=[{'all':!![]}];}_0x176a9b=_[_0x325b('0x3a')]({},_0x176a9b,_0x59fede[_0x325b('0x3c')]);return db[_0x325b('0x2a')][_0x325b('0x43')](_0x176a9b)[_0x325b('0x22')](handleEntityNotFound(_0x46a20c,null))['then'](respondWithResult(_0x46a20c,null))[_0x325b('0x3f')](handleError(_0x46a20c,null));};exports[_0x325b('0x44')]=function(_0x517b6a,_0x8e4f88){return db['ChatOfflineMessage'][_0x325b('0x44')](_0x517b6a[_0x325b('0x45')],{})[_0x325b('0x22')](respondWithResult(_0x8e4f88,0xc9))[_0x325b('0x3f')](handleError(_0x8e4f88,null));};exports[_0x325b('0x46')]=function(_0x33a0d,_0x5df4fa){if(_0x33a0d['body']['id']){delete _0x33a0d[_0x325b('0x45')]['id'];}return db['ChatOfflineMessage']['find']({'where':{'id':_0x33a0d[_0x325b('0x47')]['id']}})[_0x325b('0x22')](handleEntityNotFound(_0x5df4fa,null))[_0x325b('0x22')](saveUpdates(_0x33a0d[_0x325b('0x45')],null))[_0x325b('0x22')](respondWithResult(_0x5df4fa,null))[_0x325b('0x3f')](handleError(_0x5df4fa,null));};exports[_0x325b('0x23')]=function(_0x24d787,_0x3fa491){return db['ChatOfflineMessage'][_0x325b('0x43')]({'where':{'id':_0x24d787[_0x325b('0x47')]['id']}})['then'](handleEntityNotFound(_0x3fa491,null))[_0x325b('0x22')](removeEntity(_0x3fa491,null))[_0x325b('0x3f')](handleError(_0x3fa491,null));};exports[_0x325b('0x48')]=function(_0x2c4a39,_0x4af41d){return db[_0x325b('0x2a')][_0x325b('0x48')]()[_0x325b('0x22')](respondWithResult(_0x4af41d,null))[_0x325b('0x3f')](handleError(_0x4af41d,null));}; \ No newline at end of file +var _0xde99=['ChatOfflineMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','offset','order','sort','where','pick','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xde99,0x6c));var _0x9de9=function(_0x5a7b0e,_0x4794cf){_0x5a7b0e=_0x5a7b0e-0x0;var _0x452a68=_0xde99[_0x5a7b0e];return _0x452a68;};'use strict';var pdf=require(_0x9de9('0x0'));var emlformat=require(_0x9de9('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9de9('0x2'));var jsonpatch=require(_0x9de9('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9de9('0x4'));var Mustache=require(_0x9de9('0x5'));var util=require(_0x9de9('0x6'));var path=require(_0x9de9('0x7'));var sox=require('sox');var csv=require(_0x9de9('0x8'));var ejs=require(_0x9de9('0x9'));var fs=require('fs');var _=require(_0x9de9('0xa'));var squel=require('squel');var crypto=require(_0x9de9('0xb'));var jsforce=require(_0x9de9('0xc'));var deskjs=require(_0x9de9('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9de9('0xe'));var Papa=require(_0x9de9('0xf'));var Redis=require(_0x9de9('0x10'));var authService=require(_0x9de9('0x11'));var qs=require(_0x9de9('0x12'));var as=require(_0x9de9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9de9('0x14'))(_0x9de9('0x15'));var utils=require(_0x9de9('0x16'));var config=require(_0x9de9('0x17'));var db=require(_0x9de9('0x18'))['db'];function respondWithStatusCode(_0x48c129,_0x38197f){_0x38197f=_0x38197f||0xcc;return function(_0x7742f3){if(_0x7742f3){return _0x48c129[_0x9de9('0x19')](_0x38197f);}return _0x48c129[_0x9de9('0x1a')](_0x38197f)[_0x9de9('0x1b')]();};}function respondWithResult(_0x3b105d,_0x2b6e27){_0x2b6e27=_0x2b6e27||0xc8;return function(_0x187ced){if(_0x187ced){return _0x3b105d[_0x9de9('0x1a')](_0x2b6e27)[_0x9de9('0x1c')](_0x187ced);}};}function respondWithFilteredResult(_0x4ff010,_0x4e254b){return function(_0x335046){if(_0x335046){var _0x66e191=_0x335046['count'],_0xcdae91=_0x4e254b['offset'],_0x327be5=_0x4e254b['offset']+_0x4e254b[_0x9de9('0x1d')],_0x1e4337;if(_0x327be5>=_0x66e191){_0x327be5=_0x66e191;_0x1e4337=0xc8;}else{_0x1e4337=0xce;}_0x4ff010[_0x9de9('0x1a')](_0x1e4337);return _0x4ff010[_0x9de9('0x1e')](_0x9de9('0x1f'),_0xcdae91+'-'+_0x327be5+'/'+_0x66e191)[_0x9de9('0x1c')](_0x335046);}return null;};}function patchUpdates(_0x1ff4d0){return function(_0x404354){try{jsonpatch['apply'](_0x404354,_0x1ff4d0,!![]);}catch(_0x32e323){return BPromise[_0x9de9('0x20')](_0x32e323);}return _0x404354[_0x9de9('0x21')]();};}function saveUpdates(_0x14a01f,_0x29e723){return function(_0x41732e){if(_0x41732e){return _0x41732e[_0x9de9('0x22')](_0x14a01f)[_0x9de9('0x23')](function(_0x20ecd3){return _0x20ecd3;});}return null;};}function removeEntity(_0x15a555,_0xec659){return function(_0x57da9f){if(_0x57da9f){return _0x57da9f[_0x9de9('0x24')]()[_0x9de9('0x23')](function(){_0x15a555[_0x9de9('0x1a')](0xcc)[_0x9de9('0x1b')]();});}};}function handleEntityNotFound(_0x3e8bd8,_0x4971c1){return function(_0x3c97af){if(!_0x3c97af){_0x3e8bd8[_0x9de9('0x19')](0x194);}return _0x3c97af;};}function handleError(_0x3cb601,_0x1c10e9){_0x1c10e9=_0x1c10e9||0x1f4;return function(_0x49106c){logger[_0x9de9('0x25')](_0x49106c[_0x9de9('0x26')]);if(_0x49106c[_0x9de9('0x27')]){delete _0x49106c[_0x9de9('0x27')];}_0x3cb601[_0x9de9('0x1a')](_0x1c10e9)[_0x9de9('0x28')](_0x49106c);};}exports['index']=function(_0x5ed09c,_0x38bdac){var _0x4446b5={},_0x517a43={},_0x23cd45={'count':0x0,'rows':[]};var _0x171773=_[_0x9de9('0x29')](db[_0x9de9('0x2a')][_0x9de9('0x2b')],function(_0x59d201){return{'name':_0x59d201[_0x9de9('0x2c')],'type':_0x59d201[_0x9de9('0x2d')][_0x9de9('0x2e')]};});_0x517a43['model']=_[_0x9de9('0x29')](_0x171773,_0x9de9('0x27'));_0x517a43[_0x9de9('0x2f')]=_[_0x9de9('0x30')](_0x5ed09c[_0x9de9('0x2f')]);_0x517a43[_0x9de9('0x31')]=_[_0x9de9('0x32')](_0x517a43[_0x9de9('0x33')],_0x517a43[_0x9de9('0x2f')]);_0x4446b5[_0x9de9('0x34')]=_[_0x9de9('0x32')](_0x517a43[_0x9de9('0x33')],qs['fields'](_0x5ed09c[_0x9de9('0x2f')][_0x9de9('0x35')]));_0x4446b5[_0x9de9('0x34')]=_0x4446b5[_0x9de9('0x34')][_0x9de9('0x36')]?_0x4446b5[_0x9de9('0x34')]:_0x517a43[_0x9de9('0x33')];if(!_0x5ed09c['query'][_0x9de9('0x37')]('nolimit')){_0x4446b5[_0x9de9('0x1d')]=qs[_0x9de9('0x1d')](_0x5ed09c[_0x9de9('0x2f')]['limit']);_0x4446b5[_0x9de9('0x38')]=qs[_0x9de9('0x38')](_0x5ed09c[_0x9de9('0x2f')][_0x9de9('0x38')]);}_0x4446b5[_0x9de9('0x39')]=qs[_0x9de9('0x3a')](_0x5ed09c[_0x9de9('0x2f')][_0x9de9('0x3a')]);_0x4446b5[_0x9de9('0x3b')]=qs[_0x9de9('0x31')](_[_0x9de9('0x3c')](_0x5ed09c[_0x9de9('0x2f')],_0x517a43[_0x9de9('0x31')]));if(_0x5ed09c[_0x9de9('0x2f')]['filter']){_0x4446b5[_0x9de9('0x3b')]=_[_0x9de9('0x3d')](_0x4446b5[_0x9de9('0x3b')],{'$or':_[_0x9de9('0x29')](_0x171773,function(_0xde06a7){if(_0xde06a7[_0x9de9('0x2d')]!==_0x9de9('0x3e')){var _0x1f99d7={};_0x1f99d7[_0xde06a7['name']]={'$like':'%'+_0x5ed09c[_0x9de9('0x2f')]['filter']+'%'};return _0x1f99d7;}})});}_0x4446b5=_[_0x9de9('0x3d')]({},_0x4446b5,_0x5ed09c[_0x9de9('0x3f')]);var _0x397203={'where':_0x4446b5['where']};return db[_0x9de9('0x2a')][_0x9de9('0x40')](_0x397203)[_0x9de9('0x23')](function(_0x27b272){_0x23cd45[_0x9de9('0x40')]=_0x27b272;if(_0x5ed09c[_0x9de9('0x2f')][_0x9de9('0x41')]){_0x4446b5[_0x9de9('0x42')]=[{'all':!![]}];}return db[_0x9de9('0x2a')][_0x9de9('0x43')](_0x4446b5);})[_0x9de9('0x23')](function(_0x56dc24){_0x23cd45[_0x9de9('0x44')]=_0x56dc24;return _0x23cd45;})[_0x9de9('0x23')](respondWithFilteredResult(_0x38bdac,_0x4446b5))[_0x9de9('0x45')](handleError(_0x38bdac,null));};exports[_0x9de9('0x46')]=function(_0x2040df,_0x57bd23){var _0x4d3c79={'raw':!![],'where':{'id':_0x2040df['params']['id']}},_0x50f25c={};_0x50f25c[_0x9de9('0x33')]=_[_0x9de9('0x30')](db[_0x9de9('0x2a')][_0x9de9('0x2b')]);_0x50f25c[_0x9de9('0x2f')]=_['keys'](_0x2040df['query']);_0x50f25c['filters']=_['intersection'](_0x50f25c[_0x9de9('0x33')],_0x50f25c['query']);_0x4d3c79[_0x9de9('0x34')]=_[_0x9de9('0x32')](_0x50f25c[_0x9de9('0x33')],qs[_0x9de9('0x35')](_0x2040df[_0x9de9('0x2f')][_0x9de9('0x35')]));_0x4d3c79['attributes']=_0x4d3c79[_0x9de9('0x34')][_0x9de9('0x36')]?_0x4d3c79[_0x9de9('0x34')]:_0x50f25c[_0x9de9('0x33')];if(_0x2040df['query'][_0x9de9('0x41')]){_0x4d3c79['include']=[{'all':!![]}];}_0x4d3c79=_[_0x9de9('0x3d')]({},_0x4d3c79,_0x2040df[_0x9de9('0x3f')]);return db[_0x9de9('0x2a')][_0x9de9('0x47')](_0x4d3c79)[_0x9de9('0x23')](handleEntityNotFound(_0x57bd23,null))[_0x9de9('0x23')](respondWithResult(_0x57bd23,null))['catch'](handleError(_0x57bd23,null));};exports['create']=function(_0x108ff4,_0x24b9c0){return db[_0x9de9('0x2a')][_0x9de9('0x48')](_0x108ff4[_0x9de9('0x49')],{})['then'](respondWithResult(_0x24b9c0,0xc9))[_0x9de9('0x45')](handleError(_0x24b9c0,null));};exports['update']=function(_0x44370e,_0x1236d4){if(_0x44370e['body']['id']){delete _0x44370e['body']['id'];}return db[_0x9de9('0x2a')][_0x9de9('0x47')]({'where':{'id':_0x44370e['params']['id']}})[_0x9de9('0x23')](handleEntityNotFound(_0x1236d4,null))[_0x9de9('0x23')](saveUpdates(_0x44370e[_0x9de9('0x49')],null))[_0x9de9('0x23')](respondWithResult(_0x1236d4,null))[_0x9de9('0x45')](handleError(_0x1236d4,null));};exports[_0x9de9('0x24')]=function(_0x306c67,_0x3b6a67){return db[_0x9de9('0x2a')]['find']({'where':{'id':_0x306c67['params']['id']}})[_0x9de9('0x23')](handleEntityNotFound(_0x3b6a67,null))[_0x9de9('0x23')](removeEntity(_0x3b6a67,null))[_0x9de9('0x45')](handleError(_0x3b6a67,null));};exports['describe']=function(_0x366b5e,_0x15ffe2){return db[_0x9de9('0x2a')][_0x9de9('0x4a')]()[_0x9de9('0x23')](respondWithResult(_0x15ffe2,null))['catch'](handleError(_0x15ffe2,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 1d61d78..2ef72d1 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 _0xa37e=['bluebird','path','../../config/environment','./chatOfflineMessage.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment'];(function(_0x323348,_0x437790){var _0x5b2e0c=function(_0x328302){while(--_0x328302){_0x323348['push'](_0x323348['shift']());}};_0x5b2e0c(++_0x437790);}(_0xa37e,0x97));var _0xea37=function(_0x325227,_0x1148c4){_0x325227=_0x325227-0x0;var _0x29e34e=_0xa37e[_0x325227];return _0x29e34e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xea37('0x0'))(_0xea37('0x1'));var moment=require(_0xea37('0x2'));var BPromise=require(_0xea37('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea37('0x4'));var rimraf=require('rimraf');var config=require(_0xea37('0x5'));var attributes=require(_0xea37('0x6'));module[_0xea37('0x7')]=function(_0x4d380b,_0x57135b){return _0x4d380b[_0xea37('0x8')]('ChatOfflineMessage',attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xea37('0x9'),'collate':_0xea37('0xa')});}; \ No newline at end of file +var _0xd2ea=['./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x557708,_0xef7aa6){var _0x4a4840=function(_0x41fb1b){while(--_0x41fb1b){_0x557708['push'](_0x557708['shift']());}};_0x4a4840(++_0xef7aa6);}(_0xd2ea,0x15f));var _0xad2e=function(_0x5c0f90,_0xcbe32d){_0x5c0f90=_0x5c0f90-0x0;var _0x5375bf=_0xd2ea[_0x5c0f90];return _0x5375bf;};'use strict';var _=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var logger=require(_0xad2e('0x2'))(_0xad2e('0x3'));var moment=require(_0xad2e('0x4'));var BPromise=require('bluebird');var rp=require(_0xad2e('0x5'));var fs=require('fs');var path=require(_0xad2e('0x6'));var rimraf=require(_0xad2e('0x7'));var config=require(_0xad2e('0x8'));var attributes=require(_0xad2e('0x9'));module[_0xad2e('0xa')]=function(_0x29e97f,_0x592e8b){return _0x29e97f[_0xad2e('0xb')](_0xad2e('0xc'),attributes,{'tableName':_0xad2e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xad2e('0xe')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index f26e56c..e59cdd5 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 _0xa086=['bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util'];(function(_0x39c7bc,_0x52cbca){var _0x3aaed4=function(_0x5a3478){while(--_0x5a3478){_0x39c7bc['push'](_0x39c7bc['shift']());}};_0x3aaed4(++_0x52cbca);}(_0xa086,0x8b));var _0x6a08=function(_0x449f77,_0x8368db){_0x449f77=_0x449f77-0x0;var _0x5b36d9=_0xa086[_0x449f77];return _0x5b36d9;};'use strict';var _=require('lodash');var util=require(_0x6a08('0x0'));var moment=require('moment');var BPromise=require(_0x6a08('0x1'));var rs=require(_0x6a08('0x2'));var fs=require('fs');var Redis=require(_0x6a08('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6a08('0x4'))(_0x6a08('0x5'));var config=require(_0x6a08('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6a08('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x49c138,_0x3df389,_0x390612){return new BPromise(function(_0x3f4273,_0xeedf1c){return client[_0x6a08('0x8')](_0x49c138,_0x390612)[_0x6a08('0x9')](function(_0x3d43d3){logger[_0x6a08('0xa')](_0x6a08('0xb'),_0x3df389,_0x6a08('0xc'));logger[_0x6a08('0xd')](_0x6a08('0xe'),_0x3df389,'request\x20sent',JSON['stringify'](_0x3d43d3));if(_0x3d43d3[_0x6a08('0xf')]){if(_0x3d43d3['error'][_0x6a08('0x10')]===0x1f4){logger[_0x6a08('0xf')](_0x6a08('0xb'),_0x3df389,_0x3d43d3[_0x6a08('0xf')][_0x6a08('0x11')]);return _0xeedf1c(_0x3d43d3[_0x6a08('0xf')]['message']);}logger[_0x6a08('0xf')](_0x6a08('0xb'),_0x3df389,_0x3d43d3['error'][_0x6a08('0x11')]);return _0x3f4273(_0x3d43d3[_0x6a08('0xf')]['message']);}else{logger[_0x6a08('0xa')](_0x6a08('0xb'),_0x3df389,_0x6a08('0xc'));_0x3f4273(_0x3d43d3[_0x6a08('0x12')][_0x6a08('0x11')]);}})[_0x6a08('0x13')](function(_0x1b4458){logger['error'](_0x6a08('0xb'),_0x3df389,_0x1b4458);_0xeedf1c(_0x1b4458);});});} \ No newline at end of file +var _0xd202=['jayson/promise','client','http','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xe3cd53,_0x588d2d){var _0x22f7bf=function(_0x2b50d){while(--_0x2b50d){_0xe3cd53['push'](_0xe3cd53['shift']());}};_0x22f7bf(++_0x588d2d);}(_0xd202,0xe2));var _0x2d20=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xd202[_0xc4001c];return _0x49f7bc;};'use strict';var _=require(_0x2d20('0x0'));var util=require(_0x2d20('0x1'));var moment=require(_0x2d20('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d20('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2d20('0x4'));var logger=require(_0x2d20('0x5'))(_0x2d20('0x6'));var config=require(_0x2d20('0x7'));var jayson=require(_0x2d20('0x8'));var client=jayson[_0x2d20('0x9')][_0x2d20('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3783a8,_0x5b0703,_0x39ab48){return new BPromise(function(_0x173c16,_0x48413c){return client['request'](_0x3783a8,_0x39ab48)['then'](function(_0x7b6438){logger['info'](_0x2d20('0xb'),_0x5b0703,_0x2d20('0xc'));logger[_0x2d20('0xd')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x5b0703,_0x2d20('0xc'),JSON['stringify'](_0x7b6438));if(_0x7b6438['error']){if(_0x7b6438[_0x2d20('0xe')]['code']===0x1f4){logger['error'](_0x2d20('0xb'),_0x5b0703,_0x7b6438[_0x2d20('0xe')][_0x2d20('0xf')]);return _0x48413c(_0x7b6438[_0x2d20('0xe')][_0x2d20('0xf')]);}logger[_0x2d20('0xe')](_0x2d20('0xb'),_0x5b0703,_0x7b6438[_0x2d20('0xe')]['message']);return _0x173c16(_0x7b6438[_0x2d20('0xe')][_0x2d20('0xf')]);}else{logger['info'](_0x2d20('0xb'),_0x5b0703,_0x2d20('0xc'));_0x173c16(_0x7b6438[_0x2d20('0x10')][_0x2d20('0xf')]);}})[_0x2d20('0x11')](function(_0x3ca400){logger[_0x2d20('0xe')](_0x2d20('0xb'),_0x5b0703,_0x3ca400);_0x48413c(_0x3ca400);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 5f17120..90c28ef 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 _0xd5f8=['../../components/interaction/service','../../config/environment','index','isAuthenticated','get','/:id','show','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router'];(function(_0x1f72c8,_0x31a3dc){var _0x26cda8=function(_0x19164c){while(--_0x19164c){_0x1f72c8['push'](_0x1f72c8['shift']());}};_0x26cda8(++_0x31a3dc);}(_0xd5f8,0x187));var _0x8d5f=function(_0x30c925,_0x3f9e79){_0x30c925=_0x30c925-0x0;var _0x18bba1=_0xd5f8[_0x30c925];return _0x18bba1;};'use strict';var multer=require(_0x8d5f('0x0'));var util=require(_0x8d5f('0x1'));var path=require('path');var timeout=require(_0x8d5f('0x2'));var express=require(_0x8d5f('0x3'));var router=express[_0x8d5f('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x8d5f('0x5'));var config=require(_0x8d5f('0x6'));var controller=require('./chatOfflineMessage.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x8d5f('0x7')]);router['get']('/describe',auth[_0x8d5f('0x8')](),controller['describe']);router[_0x8d5f('0x9')](_0x8d5f('0xa'),auth[_0x8d5f('0x8')](),controller[_0x8d5f('0xb')]);router[_0x8d5f('0xc')]('/',auth[_0x8d5f('0x8')](),controller[_0x8d5f('0xd')]);router[_0x8d5f('0xe')](_0x8d5f('0xa'),auth[_0x8d5f('0x8')](),controller[_0x8d5f('0xf')]);router[_0x8d5f('0x10')]('/:id',auth[_0x8d5f('0x8')](),controller[_0x8d5f('0x11')]);module['exports']=router; \ No newline at end of file +var _0x363b=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','/:id','post','put','update','delete','destroy','exports'];(function(_0x19ae3c,_0x36ef3a){var _0x5e155a=function(_0x568d89){while(--_0x568d89){_0x19ae3c['push'](_0x19ae3c['shift']());}};_0x5e155a(++_0x36ef3a);}(_0x363b,0xbe));var _0xb363=function(_0x44061b,_0x225ccf){_0x44061b=_0x44061b-0x0;var _0x2893b4=_0x363b[_0x44061b];return _0x2893b4;};'use strict';var multer=require('multer');var util=require(_0xb363('0x0'));var path=require(_0xb363('0x1'));var timeout=require(_0xb363('0x2'));var express=require(_0xb363('0x3'));var router=express['Router']();var auth=require(_0xb363('0x4'));var interaction=require(_0xb363('0x5'));var config=require(_0xb363('0x6'));var controller=require(_0xb363('0x7'));router[_0xb363('0x8')]('/',auth[_0xb363('0x9')](),controller[_0xb363('0xa')]);router[_0xb363('0x8')](_0xb363('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xb363('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xb363('0xd')]('/',auth[_0xb363('0x9')](),controller['create']);router[_0xb363('0xe')]('/:id',auth[_0xb363('0x9')](),controller[_0xb363('0xf')]);router[_0xb363('0x10')](_0xb363('0xc'),auth[_0xb363('0x9')](),controller[_0xb363('0x11')]);module[_0xb363('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 68477db..210c44b 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 _0x69bd=['ENUM','timeout','mouseOver','INTEGER','sequelize','exports','STRING'];(function(_0x5f1de4,_0x47c201){var _0x1aeaf0=function(_0x489f7a){while(--_0x489f7a){_0x5f1de4['push'](_0x5f1de4['shift']());}};_0x1aeaf0(++_0x47c201);}(_0x69bd,0x1ee));var _0xd69b=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0x69bd[_0xc8a931];return _0x28bd27;};'use strict';var Sequelize=require(_0xd69b('0x0'));module[_0xd69b('0x1')]={'name':{'type':Sequelize[_0xd69b('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xd69b('0x3')]('mouseOver',_0xd69b('0x4')),'defaultValue':_0xd69b('0x5')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xd69b('0x6')]}}; \ No newline at end of file +var _0x3bc1=['mouseOver','timeout','INTEGER','sequelize','exports','STRING','ENUM'];(function(_0x28312b,_0x560437){var _0x2ce97c=function(_0x1127b9){while(--_0x1127b9){_0x28312b['push'](_0x28312b['shift']());}};_0x2ce97c(++_0x560437);}(_0x3bc1,0xf8));var _0x13bc=function(_0xa1c6de,_0x2ced73){_0xa1c6de=_0xa1c6de-0x0;var _0x56f97e=_0x3bc1[_0xa1c6de];return _0x56f97e;};'use strict';var Sequelize=require(_0x13bc('0x0'));module[_0x13bc('0x1')]={'name':{'type':Sequelize[_0x13bc('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x13bc('0x3')](_0x13bc('0x4'),_0x13bc('0x5')),'defaultValue':_0x13bc('0x4')},'selector':{'type':Sequelize[_0x13bc('0x2')]},'timeout':{'type':Sequelize[_0x13bc('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 4380aa8..1a43cc8 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 _0xedd9=['offset','limit','Content-Range','reject','update','then','destroy','error','stack','send','show','params','model','keys','rawAttributes','query','intersection','attributes','fields','length','include','merge','options','find','catch','create','ChatProactiveAction','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0xedd9,0xfc));var _0x9edd=function(_0x28e89e,_0xdac59d){_0x28e89e=_0x28e89e-0x0;var _0x1a8201=_0xedd9[_0x28e89e];return _0x1a8201;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9edd('0x0'));var rimraf=require(_0x9edd('0x1'));var zipdir=require(_0x9edd('0x2'));var jsonpatch=require(_0x9edd('0x3'));var rp=require(_0x9edd('0x4'));var moment=require(_0x9edd('0x5'));var BPromise=require(_0x9edd('0x6'));var Mustache=require(_0x9edd('0x7'));var util=require('util');var path=require(_0x9edd('0x8'));var sox=require(_0x9edd('0x9'));var csv=require(_0x9edd('0xa'));var ejs=require(_0x9edd('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0xa'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var db=require(_0x9edd('0x16'))['db'];function respondWithStatusCode(_0x25e64c,_0xfd544a){_0xfd544a=_0xfd544a||0xcc;return function(_0x287ddd){if(_0x287ddd){return _0x25e64c[_0x9edd('0x17')](_0xfd544a);}return _0x25e64c[_0x9edd('0x18')](_0xfd544a)[_0x9edd('0x19')]();};}function respondWithResult(_0x47eb64,_0x176bfa){_0x176bfa=_0x176bfa||0xc8;return function(_0x44fc7c){if(_0x44fc7c){return _0x47eb64[_0x9edd('0x18')](_0x176bfa)[_0x9edd('0x1a')](_0x44fc7c);}};}function respondWithFilteredResult(_0x13b6b6,_0x338f3c){return function(_0x1042aa){if(_0x1042aa){var _0x75a4ab=_0x1042aa[_0x9edd('0x1b')],_0x4ea60f=_0x338f3c['offset'],_0x5f5bf4=_0x338f3c[_0x9edd('0x1c')]+_0x338f3c[_0x9edd('0x1d')],_0x448996;if(_0x5f5bf4>=_0x75a4ab){_0x5f5bf4=_0x75a4ab;_0x448996=0xc8;}else{_0x448996=0xce;}_0x13b6b6[_0x9edd('0x18')](_0x448996);return _0x13b6b6['set'](_0x9edd('0x1e'),_0x4ea60f+'-'+_0x5f5bf4+'/'+_0x75a4ab)['json'](_0x1042aa);}return null;};}function patchUpdates(_0x2cdcef){return function(_0x1083e4){try{jsonpatch['apply'](_0x1083e4,_0x2cdcef,!![]);}catch(_0x498977){return BPromise[_0x9edd('0x1f')](_0x498977);}return _0x1083e4['save']();};}function saveUpdates(_0x27a95a,_0x54a03f){return function(_0x535f37){if(_0x535f37){return _0x535f37[_0x9edd('0x20')](_0x27a95a)[_0x9edd('0x21')](function(_0x4fb7bf){return _0x4fb7bf;});}return null;};}function removeEntity(_0x5823bc,_0x341d67){return function(_0x186186){if(_0x186186){return _0x186186[_0x9edd('0x22')]()['then'](function(){_0x5823bc[_0x9edd('0x18')](0xcc)[_0x9edd('0x19')]();});}};}function handleEntityNotFound(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(!_0x339a0d){_0x44a6c1['sendStatus'](0x194);}return _0x339a0d;};}function handleError(_0x46c383,_0xeaf55a){_0xeaf55a=_0xeaf55a||0x1f4;return function(_0x3a1ea5){logger[_0x9edd('0x23')](_0x3a1ea5[_0x9edd('0x24')]);if(_0x3a1ea5['name']){delete _0x3a1ea5['name'];}_0x46c383[_0x9edd('0x18')](_0xeaf55a)[_0x9edd('0x25')](_0x3a1ea5);};}exports[_0x9edd('0x26')]=function(_0x25e135,_0x3c2227){var _0x4fe471={'raw':!![],'where':{'id':_0x25e135[_0x9edd('0x27')]['id']}},_0x57a2cc={};_0x57a2cc[_0x9edd('0x28')]=_[_0x9edd('0x29')](db['ChatProactiveAction'][_0x9edd('0x2a')]);_0x57a2cc[_0x9edd('0x2b')]=_[_0x9edd('0x29')](_0x25e135[_0x9edd('0x2b')]);_0x57a2cc['filters']=_[_0x9edd('0x2c')](_0x57a2cc[_0x9edd('0x28')],_0x57a2cc[_0x9edd('0x2b')]);_0x4fe471[_0x9edd('0x2d')]=_[_0x9edd('0x2c')](_0x57a2cc[_0x9edd('0x28')],qs[_0x9edd('0x2e')](_0x25e135[_0x9edd('0x2b')][_0x9edd('0x2e')]));_0x4fe471[_0x9edd('0x2d')]=_0x4fe471[_0x9edd('0x2d')][_0x9edd('0x2f')]?_0x4fe471[_0x9edd('0x2d')]:_0x57a2cc[_0x9edd('0x28')];if(_0x25e135[_0x9edd('0x2b')]['includeAll']){_0x4fe471[_0x9edd('0x30')]=[{'all':!![]}];}_0x4fe471=_[_0x9edd('0x31')]({},_0x4fe471,_0x25e135[_0x9edd('0x32')]);return db['ChatProactiveAction'][_0x9edd('0x33')](_0x4fe471)[_0x9edd('0x21')](handleEntityNotFound(_0x3c2227,null))[_0x9edd('0x21')](respondWithResult(_0x3c2227,null))[_0x9edd('0x34')](handleError(_0x3c2227,null));};exports[_0x9edd('0x35')]=function(_0x2bc4ed,_0x473068){return db[_0x9edd('0x36')][_0x9edd('0x35')](_0x2bc4ed[_0x9edd('0x37')],{})[_0x9edd('0x21')](respondWithResult(_0x473068,0xc9))[_0x9edd('0x34')](handleError(_0x473068,null));};exports[_0x9edd('0x20')]=function(_0x14f780,_0x5757fc){if(_0x14f780[_0x9edd('0x37')]['id']){delete _0x14f780['body']['id'];}return db[_0x9edd('0x36')][_0x9edd('0x33')]({'where':{'id':_0x14f780[_0x9edd('0x27')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x5757fc,null))[_0x9edd('0x21')](saveUpdates(_0x14f780['body'],null))[_0x9edd('0x21')](respondWithResult(_0x5757fc,null))[_0x9edd('0x34')](handleError(_0x5757fc,null));};exports[_0x9edd('0x22')]=function(_0x38e9be,_0x1be77f){return db[_0x9edd('0x36')][_0x9edd('0x33')]({'where':{'id':_0x38e9be[_0x9edd('0x27')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x1be77f,null))[_0x9edd('0x21')](removeEntity(_0x1be77f,null))['catch'](handleError(_0x1be77f,null));}; \ No newline at end of file +var _0x9c44=['lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','error','name','send','params','model','keys','rawAttributes','query','filters','intersection','attributes','length','includeAll','include','merge','options','catch','create','ChatProactiveAction','body','find','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs'];(function(_0x21ce7a,_0x33bc32){var _0x222227=function(_0x52bb72){while(--_0x52bb72){_0x21ce7a['push'](_0x21ce7a['shift']());}};_0x222227(++_0x33bc32);}(_0x9c44,0x178));var _0x49c4=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x9c44[_0x36c5b0];return _0xf19333;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x49c4('0x0'));var zipdir=require(_0x49c4('0x1'));var jsonpatch=require(_0x49c4('0x2'));var rp=require(_0x49c4('0x3'));var moment=require(_0x49c4('0x4'));var BPromise=require(_0x49c4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x49c4('0x6'));var sox=require('sox');var csv=require(_0x49c4('0x7'));var ejs=require(_0x49c4('0x8'));var fs=require('fs');var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0x7'));var querystring=require(_0x49c4('0xd'));var Papa=require(_0x49c4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0xf'));var as=require(_0x49c4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x11'))(_0x49c4('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x49c4('0x13'))['db'];function respondWithStatusCode(_0x6d1b08,_0x5487cd){_0x5487cd=_0x5487cd||0xcc;return function(_0x7df3a9){if(_0x7df3a9){return _0x6d1b08[_0x49c4('0x14')](_0x5487cd);}return _0x6d1b08['status'](_0x5487cd)[_0x49c4('0x15')]();};}function respondWithResult(_0x280996,_0x21f15a){_0x21f15a=_0x21f15a||0xc8;return function(_0x2decee){if(_0x2decee){return _0x280996[_0x49c4('0x16')](_0x21f15a)[_0x49c4('0x17')](_0x2decee);}};}function respondWithFilteredResult(_0x75ea8,_0x3de397){return function(_0x58d177){if(_0x58d177){var _0x3acd06=_0x58d177[_0x49c4('0x18')],_0x141003=_0x3de397['offset'],_0x13a2db=_0x3de397[_0x49c4('0x19')]+_0x3de397[_0x49c4('0x1a')],_0x81e831;if(_0x13a2db>=_0x3acd06){_0x13a2db=_0x3acd06;_0x81e831=0xc8;}else{_0x81e831=0xce;}_0x75ea8['status'](_0x81e831);return _0x75ea8['set'](_0x49c4('0x1b'),_0x141003+'-'+_0x13a2db+'/'+_0x3acd06)[_0x49c4('0x17')](_0x58d177);}return null;};}function patchUpdates(_0x3addb2){return function(_0x59f29b){try{jsonpatch[_0x49c4('0x1c')](_0x59f29b,_0x3addb2,!![]);}catch(_0x50b151){return BPromise[_0x49c4('0x1d')](_0x50b151);}return _0x59f29b[_0x49c4('0x1e')]();};}function saveUpdates(_0xe31fcc,_0x291526){return function(_0x382040){if(_0x382040){return _0x382040[_0x49c4('0x1f')](_0xe31fcc)[_0x49c4('0x20')](function(_0x46e475){return _0x46e475;});}return null;};}function removeEntity(_0x2197d2,_0x578447){return function(_0x527126){if(_0x527126){return _0x527126['destroy']()[_0x49c4('0x20')](function(){_0x2197d2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2263ae,_0x15581b){return function(_0x26c640){if(!_0x26c640){_0x2263ae[_0x49c4('0x14')](0x194);}return _0x26c640;};}function handleError(_0x4811c4,_0x5850f2){_0x5850f2=_0x5850f2||0x1f4;return function(_0x180276){logger[_0x49c4('0x21')](_0x180276['stack']);if(_0x180276[_0x49c4('0x22')]){delete _0x180276[_0x49c4('0x22')];}_0x4811c4[_0x49c4('0x16')](_0x5850f2)[_0x49c4('0x23')](_0x180276);};}exports['show']=function(_0x543ea2,_0x449960){var _0x53c199={'raw':!![],'where':{'id':_0x543ea2[_0x49c4('0x24')]['id']}},_0x3800b7={};_0x3800b7[_0x49c4('0x25')]=_[_0x49c4('0x26')](db['ChatProactiveAction'][_0x49c4('0x27')]);_0x3800b7[_0x49c4('0x28')]=_[_0x49c4('0x26')](_0x543ea2[_0x49c4('0x28')]);_0x3800b7[_0x49c4('0x29')]=_[_0x49c4('0x2a')](_0x3800b7[_0x49c4('0x25')],_0x3800b7[_0x49c4('0x28')]);_0x53c199[_0x49c4('0x2b')]=_[_0x49c4('0x2a')](_0x3800b7[_0x49c4('0x25')],qs['fields'](_0x543ea2['query']['fields']));_0x53c199[_0x49c4('0x2b')]=_0x53c199[_0x49c4('0x2b')][_0x49c4('0x2c')]?_0x53c199[_0x49c4('0x2b')]:_0x3800b7[_0x49c4('0x25')];if(_0x543ea2['query'][_0x49c4('0x2d')]){_0x53c199[_0x49c4('0x2e')]=[{'all':!![]}];}_0x53c199=_[_0x49c4('0x2f')]({},_0x53c199,_0x543ea2[_0x49c4('0x30')]);return db['ChatProactiveAction']['find'](_0x53c199)[_0x49c4('0x20')](handleEntityNotFound(_0x449960,null))[_0x49c4('0x20')](respondWithResult(_0x449960,null))[_0x49c4('0x31')](handleError(_0x449960,null));};exports[_0x49c4('0x32')]=function(_0xd38540,_0x4a0c7a){return db[_0x49c4('0x33')][_0x49c4('0x32')](_0xd38540[_0x49c4('0x34')],{})['then'](respondWithResult(_0x4a0c7a,0xc9))['catch'](handleError(_0x4a0c7a,null));};exports[_0x49c4('0x1f')]=function(_0x1991e9,_0x3bec0a){if(_0x1991e9[_0x49c4('0x34')]['id']){delete _0x1991e9[_0x49c4('0x34')]['id'];}return db[_0x49c4('0x33')][_0x49c4('0x35')]({'where':{'id':_0x1991e9[_0x49c4('0x24')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x3bec0a,null))['then'](saveUpdates(_0x1991e9[_0x49c4('0x34')],null))['then'](respondWithResult(_0x3bec0a,null))[_0x49c4('0x31')](handleError(_0x3bec0a,null));};exports[_0x49c4('0x36')]=function(_0x2625a6,_0x1c2830){return db['ChatProactiveAction'][_0x49c4('0x35')]({'where':{'id':_0x2625a6[_0x49c4('0x24')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x1c2830,null))['then'](removeEntity(_0x1c2830,null))[_0x49c4('0x31')](handleError(_0x1c2830,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index aba319f..d1c8c8f 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 _0x2b5b=['bluebird','request-promise','rimraf','../../config/environment','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api','moment'];(function(_0x572179,_0x566588){var _0x3d2995=function(_0x49ff10){while(--_0x49ff10){_0x572179['push'](_0x572179['shift']());}};_0x3d2995(++_0x566588);}(_0x2b5b,0xcb));var _0xb2b5=function(_0x247ba5,_0x50e4e6){_0x247ba5=_0x247ba5-0x0;var _0x2fc9bd=_0x2b5b[_0x247ba5];return _0x2fc9bd;};'use strict';var _=require(_0xb2b5('0x0'));var util=require(_0xb2b5('0x1'));var logger=require(_0xb2b5('0x2'))(_0xb2b5('0x3'));var moment=require(_0xb2b5('0x4'));var BPromise=require(_0xb2b5('0x5'));var rp=require(_0xb2b5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb2b5('0x7'));var config=require(_0xb2b5('0x8'));var attributes=require('./chatProactiveAction.attributes');module[_0xb2b5('0x9')]=function(_0x1e7a9f,_0x1e426a){return _0x1e7a9f[_0xb2b5('0xa')](_0xb2b5('0xb'),attributes,{'tableName':_0xb2b5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc09d=['../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','moment','bluebird','request-promise','path','rimraf'];(function(_0x269ee8,_0x477226){var _0x4d98bd=function(_0x20d4c4){while(--_0x20d4c4){_0x269ee8['push'](_0x269ee8['shift']());}};_0x4d98bd(++_0x477226);}(_0xc09d,0x1c7));var _0xdc09=function(_0xb33b8b,_0x4bb4e7){_0xb33b8b=_0xb33b8b-0x0;var _0x5f0129=_0xc09d[_0xb33b8b];return _0x5f0129;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xdc09('0x0'));var BPromise=require(_0xdc09('0x1'));var rp=require(_0xdc09('0x2'));var fs=require('fs');var path=require(_0xdc09('0x3'));var rimraf=require(_0xdc09('0x4'));var config=require(_0xdc09('0x5'));var attributes=require(_0xdc09('0x6'));module[_0xdc09('0x7')]=function(_0xaf1d4,_0x23a0fa){return _0xaf1d4[_0xdc09('0x8')](_0xdc09('0x9'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index c6a7ce8..3e6d7d9 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 _0x475b=['bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','info','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x44a059,_0x4975ae){var _0x30f970=function(_0x259ed1){while(--_0x259ed1){_0x44a059['push'](_0x44a059['shift']());}};_0x30f970(++_0x4975ae);}(_0x475b,0x1b5));var _0xb475=function(_0x202aa6,_0x4df62e){_0x202aa6=_0x202aa6-0x0;var _0x3809a3=_0x475b[_0x202aa6];return _0x3809a3;};'use strict';var _=require(_0xb475('0x0'));var util=require(_0xb475('0x1'));var moment=require(_0xb475('0x2'));var BPromise=require(_0xb475('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb475('0x4'));var db=require(_0xb475('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb475('0x6'))('rpc');var config=require(_0xb475('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb475('0x8')][_0xb475('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x42657c,_0x5e923f,_0x5101ac){return new BPromise(function(_0x5b1ba6,_0x4fbc9b){return client[_0xb475('0xa')](_0x42657c,_0x5101ac)['then'](function(_0xe6f63){logger[_0xb475('0xb')]('ChatProactiveAction,\x20%s,\x20%s',_0x5e923f,'request\x20sent');logger[_0xb475('0xc')](_0xb475('0xd'),_0x5e923f,_0xb475('0xe'),JSON[_0xb475('0xf')](_0xe6f63));if(_0xe6f63['error']){if(_0xe6f63[_0xb475('0x10')][_0xb475('0x11')]===0x1f4){logger['error'](_0xb475('0x12'),_0x5e923f,_0xe6f63[_0xb475('0x10')][_0xb475('0x13')]);return _0x4fbc9b(_0xe6f63[_0xb475('0x10')]['message']);}logger['error'](_0xb475('0x12'),_0x5e923f,_0xe6f63[_0xb475('0x10')][_0xb475('0x13')]);return _0x5b1ba6(_0xe6f63['error'][_0xb475('0x13')]);}else{logger[_0xb475('0xb')](_0xb475('0x12'),_0x5e923f,_0xb475('0xe'));_0x5b1ba6(_0xe6f63[_0xb475('0x14')]['message']);}})[_0xb475('0x15')](function(_0x2b79d1){logger['error'](_0xb475('0x12'),_0x5e923f,_0x2b79d1);_0x4fbc9b(_0x2b79d1);});});} \ No newline at end of file +var _0xfe88=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','stringify','error','message','request\x20sent','lodash'];(function(_0x219183,_0x82dc3c){var _0x48f381=function(_0x392188){while(--_0x392188){_0x219183['push'](_0x219183['shift']());}};_0x48f381(++_0x82dc3c);}(_0xfe88,0x167));var _0x8fe8=function(_0x18959e,_0x24e830){_0x18959e=_0x18959e-0x0;var _0x308aba=_0xfe88[_0x18959e];return _0x308aba;};'use strict';var _=require(_0x8fe8('0x0'));var util=require('util');var moment=require(_0x8fe8('0x1'));var BPromise=require(_0x8fe8('0x2'));var rs=require(_0x8fe8('0x3'));var fs=require('fs');var Redis=require(_0x8fe8('0x4'));var db=require(_0x8fe8('0x5'))['db'];var utils=require(_0x8fe8('0x6'));var logger=require('../../config/logger')(_0x8fe8('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8fe8('0x8')][_0x8fe8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a0796,_0x2946d7,_0x181598){return new BPromise(function(_0x2e6448,_0x1c746b){return client[_0x8fe8('0xa')](_0x1a0796,_0x181598)[_0x8fe8('0xb')](function(_0x57f0e1){logger[_0x8fe8('0xc')](_0x8fe8('0xd'),_0x2946d7,'request\x20sent');logger['debug']('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x2946d7,'request\x20sent',JSON[_0x8fe8('0xe')](_0x57f0e1));if(_0x57f0e1[_0x8fe8('0xf')]){if(_0x57f0e1[_0x8fe8('0xf')]['code']===0x1f4){logger[_0x8fe8('0xf')](_0x8fe8('0xd'),_0x2946d7,_0x57f0e1[_0x8fe8('0xf')][_0x8fe8('0x10')]);return _0x1c746b(_0x57f0e1[_0x8fe8('0xf')][_0x8fe8('0x10')]);}logger['error'](_0x8fe8('0xd'),_0x2946d7,_0x57f0e1[_0x8fe8('0xf')][_0x8fe8('0x10')]);return _0x2e6448(_0x57f0e1[_0x8fe8('0xf')][_0x8fe8('0x10')]);}else{logger[_0x8fe8('0xc')](_0x8fe8('0xd'),_0x2946d7,_0x8fe8('0x11'));_0x2e6448(_0x57f0e1['result'][_0x8fe8('0x10')]);}})['catch'](function(_0x4b55a7){logger[_0x8fe8('0xf')](_0x8fe8('0xd'),_0x2946d7,_0x4b55a7);_0x1c746b(_0x4b55a7);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 29a3d01..66b9e99 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 _0xbe9f=['../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x12e7d4,_0x44ed1e){var _0xa8f92a=function(_0x5737a4){while(--_0x5737a4){_0x12e7d4['push'](_0x12e7d4['shift']());}};_0xa8f92a(++_0x44ed1e);}(_0xbe9f,0xc2));var _0xfbe9=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xbe9f[_0x5a776b];return _0xbbef59;};'use strict';var multer=require('multer');var util=require(_0xfbe9('0x0'));var path=require(_0xfbe9('0x1'));var timeout=require(_0xfbe9('0x2'));var express=require(_0xfbe9('0x3'));var router=express[_0xfbe9('0x4')]();var auth=require(_0xfbe9('0x5'));var interaction=require(_0xfbe9('0x6'));var config=require(_0xfbe9('0x7'));var controller=require(_0xfbe9('0x8'));router[_0xfbe9('0x9')](_0xfbe9('0xa'),auth['isAuthenticated'](),controller[_0xfbe9('0xb')]);router[_0xfbe9('0xc')]('/',auth[_0xfbe9('0xd')](),controller[_0xfbe9('0xe')]);router[_0xfbe9('0xf')](_0xfbe9('0xa'),auth[_0xfbe9('0xd')](),controller[_0xfbe9('0x10')]);router[_0xfbe9('0x11')](_0xfbe9('0xa'),auth[_0xfbe9('0xd')](),controller[_0xfbe9('0x12')]);module[_0xfbe9('0x13')]=router; \ No newline at end of file +var _0xb574=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','post','put'];(function(_0x6f976,_0x3a3fb4){var _0x587cb7=function(_0x358599){while(--_0x358599){_0x6f976['push'](_0x6f976['shift']());}};_0x587cb7(++_0x3a3fb4);}(_0xb574,0x17b));var _0x4b57=function(_0x26885c,_0x5aeb56){_0x26885c=_0x26885c-0x0;var _0x2067b4=_0xb574[_0x26885c];return _0x2067b4;};'use strict';var multer=require(_0x4b57('0x0'));var util=require(_0x4b57('0x1'));var path=require(_0x4b57('0x2'));var timeout=require(_0x4b57('0x3'));var express=require(_0x4b57('0x4'));var router=express[_0x4b57('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4b57('0x6'));var controller=require('./chatProactiveAction.controller');router[_0x4b57('0x7')]('/:id',auth[_0x4b57('0x8')](),controller['show']);router[_0x4b57('0x9')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4b57('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x4b57('0xb')]);router[_0x4b57('0xc')]('/:id',auth[_0x4b57('0x8')](),controller[_0x4b57('0xd')]);module[_0x4b57('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 3eaf1ab..b8388a7 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 _0x805d=['name','ENUM','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x557fd2,_0x2c0a7a){var _0x1b54a2=function(_0x2e439b){while(--_0x2e439b){_0x557fd2['push'](_0x557fd2['shift']());}};_0x1b54a2(++_0x2c0a7a);}(_0x805d,0x6d));var _0xd805=function(_0x4089cd,_0x21b5f0){_0x4089cd=_0x4089cd-0x0;var _0x579be1=_0x805d[_0x4089cd];return _0x579be1;};'use strict';var Sequelize=require(_0xd805('0x0'));module[_0xd805('0x1')]={'name':{'type':Sequelize[_0xd805('0x2')],'unique':_0xd805('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd805('0x4')]('rrmemory',_0xd805('0x5'),_0xd805('0x6'))}}; \ No newline at end of file +var _0xdffe=['sequelize','exports','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x2ce709,_0x41ab1e){var _0x908e80=function(_0x1a6675){while(--_0x1a6675){_0x2ce709['push'](_0x2ce709['shift']());}};_0x908e80(++_0x41ab1e);}(_0xdffe,0x108));var _0xedff=function(_0x371b36,_0x8606f7){_0x371b36=_0x371b36-0x0;var _0x449638=_0xdffe[_0x371b36];return _0x449638;};'use strict';var Sequelize=require(_0xedff('0x0'));module[_0xedff('0x1')]={'name':{'type':Sequelize[_0xedff('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xedff('0x2')]},'timeout':{'type':Sequelize[_0xedff('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xedff('0x4')](_0xedff('0x5'),_0xedff('0x6'),_0xedff('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index e649f57..4d8ad69 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 _0xe2bc=['stringify','error','code','message','info','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','get','ChatQueues','UserProfileResource','stack','name','index','ChatQueue','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','options','include','findAll','rows','catch','show','params','length','includeAll','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','hasOwnProperty','ChatQueueId','UserChatQueue','User','UserId','agent','updatedAt','SIP','chatPause','getTeams','Team','addTeams','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','ids','select','field','from','join','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','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/environment','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','client','http','test','Sequelize','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s'];(function(_0x398294,_0x5ceb9d){var _0x2a872d=function(_0x390883){while(--_0x390883){_0x398294['push'](_0x398294['shift']());}};_0x2a872d(++_0x5ceb9d);}(_0xe2bc,0x1a6));var _0xce2b=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xe2bc[_0x341e0f];return _0x59555a;};'use strict';var pdf=require(_0xce2b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xce2b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xce2b('0x2'));var rp=require(_0xce2b('0x3'));var moment=require(_0xce2b('0x4'));var BPromise=require(_0xce2b('0x5'));var Mustache=require(_0xce2b('0x6'));var util=require('util');var path=require(_0xce2b('0x7'));var sox=require(_0xce2b('0x8'));var csv=require(_0xce2b('0x9'));var ejs=require(_0xce2b('0xa'));var fs=require('fs');var _=require(_0xce2b('0xb'));var squel=require('squel');var crypto=require(_0xce2b('0xc'));var jsforce=require(_0xce2b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xce2b('0x9'));var querystring=require(_0xce2b('0xe'));var Papa=require(_0xce2b('0xf'));var Redis=require(_0xce2b('0x10'));var authService=require(_0xce2b('0x11'));var qs=require(_0xce2b('0x12'));var as=require(_0xce2b('0x13'));var hardwareService=require(_0xce2b('0x14'));var logger=require(_0xce2b('0x15'))(_0xce2b('0x16'));var utils=require('../../config/utils');var config=require(_0xce2b('0x17'));var db=require('../../mysqldb')['db'];config[_0xce2b('0x18')]=_[_0xce2b('0x19')](config[_0xce2b('0x18')],{'host':_0xce2b('0x1a'),'port':0x18eb});var socket=require(_0xce2b('0x1b'))(new Redis(config[_0xce2b('0x18')]));require(_0xce2b('0x1c'))[_0xce2b('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0xce2b('0x1e')][_0xce2b('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x529b47,_0x5516cf,_0x48f890){if(_0x48f890){var _0x339e5c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x339e5c[_0xce2b('0x20')](_0x5516cf)){return _0x529b47;}else{throw new db[(_0xce2b('0x21'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x529b47;}}function respondWithRpcPromise(_0x216c48,_0x405bda,_0x8bf420,_0x41b4bf){return new BPromise(function(_0x377aa3,_0x32fd68){var _0x39e9be=_0x41b4bf||client;return _0x39e9be[_0xce2b('0x22')](_0x216c48,_0x8bf420)[_0xce2b('0x23')](function(_0x29b9e4){logger['info'](_0xce2b('0x24'),_0x405bda,_0xce2b('0x25'));logger[_0xce2b('0x26')](_0xce2b('0x27'),_0x405bda,_0xce2b('0x25'),JSON[_0xce2b('0x28')](_0x29b9e4));if(_0x29b9e4[_0xce2b('0x29')]){if(_0x29b9e4[_0xce2b('0x29')][_0xce2b('0x2a')]===0x1f4){logger[_0xce2b('0x29')]('ChatQueue,\x20%s,\x20%s',_0x405bda,_0x29b9e4[_0xce2b('0x29')][_0xce2b('0x2b')]);return _0x32fd68(_0x29b9e4[_0xce2b('0x29')][_0xce2b('0x2b')]);}logger[_0xce2b('0x29')](_0xce2b('0x24'),_0x405bda,_0x29b9e4[_0xce2b('0x29')][_0xce2b('0x2b')]);return _0x377aa3(_0x29b9e4[_0xce2b('0x29')][_0xce2b('0x2b')]);}else{logger[_0xce2b('0x2c')]('ChatQueue,\x20%s,\x20%s',_0x405bda,'request\x20sent');_0x377aa3(_0x29b9e4['result'][_0xce2b('0x2b')]);}})['catch'](function(_0x350637){logger[_0xce2b('0x29')]('ChatQueue,\x20%s,\x20%s',_0x405bda,_0x350637);_0x32fd68(_0x350637);});});}function respondWithStatusCode(_0x60eca0,_0x217b7e){_0x217b7e=_0x217b7e||0xcc;return function(_0x5e0ab0){if(_0x5e0ab0){return _0x60eca0[_0xce2b('0x2d')](_0x217b7e);}return _0x60eca0[_0xce2b('0x2e')](_0x217b7e)[_0xce2b('0x2f')]();};}function respondWithResult(_0x50a62f,_0x502fb9){_0x502fb9=_0x502fb9||0xc8;return function(_0x433a89){if(_0x433a89){return _0x50a62f[_0xce2b('0x2e')](_0x502fb9)[_0xce2b('0x30')](_0x433a89);}};}function respondWithFilteredResult(_0x5371a1,_0x4eae27){return function(_0x207b8c){if(_0x207b8c){var _0x2b13e5=_0x207b8c[_0xce2b('0x31')],_0x3284a4=_0x4eae27[_0xce2b('0x32')],_0x4f9615=_0x4eae27[_0xce2b('0x32')]+_0x4eae27[_0xce2b('0x33')],_0x3a8c00;if(_0x4f9615>=_0x2b13e5){_0x4f9615=_0x2b13e5;_0x3a8c00=0xc8;}else{_0x3a8c00=0xce;}_0x5371a1[_0xce2b('0x2e')](_0x3a8c00);return _0x5371a1[_0xce2b('0x34')]('Content-Range',_0x3284a4+'-'+_0x4f9615+'/'+_0x2b13e5)[_0xce2b('0x30')](_0x207b8c);}return null;};}function patchUpdates(_0x560109){return function(_0x21a813){try{jsonpatch[_0xce2b('0x35')](_0x21a813,_0x560109,!![]);}catch(_0x173f93){return BPromise[_0xce2b('0x36')](_0x173f93);}return _0x21a813[_0xce2b('0x37')]();};}function saveUpdates(_0x5f32ab,_0x208a9b){return function(_0x2a2542){if(_0x2a2542){return _0x2a2542[_0xce2b('0x38')](_0x5f32ab)[_0xce2b('0x23')](function(_0x276d0e){return _0x276d0e;});}return null;};}function removeEntity(_0x25b845,_0x29cba2){return function(_0x1d96a2){if(_0x1d96a2){return _0x1d96a2[_0xce2b('0x39')]()[_0xce2b('0x23')](function(){var _0xf6ce9d=_0x1d96a2[_0xce2b('0x3a')]({'plain':!![]});var _0x1838d1=_0xce2b('0x3b');return db[_0xce2b('0x3c')][_0xce2b('0x39')]({'where':{'type':_0x1838d1,'resourceId':_0xf6ce9d['id']}})['then'](function(){return _0x1d96a2;});})[_0xce2b('0x23')](function(){_0x25b845['status'](0xcc)[_0xce2b('0x2f')]();});}};}function handleEntityNotFound(_0x31c003,_0x2f516e){return function(_0xa6ce4e){if(!_0xa6ce4e){_0x31c003[_0xce2b('0x2d')](0x194);}return _0xa6ce4e;};}function handleError(_0xbe1c94,_0x553a04){_0x553a04=_0x553a04||0x1f4;return function(_0x12f1e1){logger[_0xce2b('0x29')](_0x12f1e1[_0xce2b('0x3d')]);if(_0x12f1e1[_0xce2b('0x3e')]){delete _0x12f1e1[_0xce2b('0x3e')];}_0xbe1c94[_0xce2b('0x2e')](_0x553a04)['send'](_0x12f1e1);};}exports[_0xce2b('0x3f')]=function(_0xe6d501,_0x38d764){var _0x30cffb={},_0x280cca={},_0x30aaf5={'count':0x0,'rows':[]};var _0x5a3593=_['map'](db[_0xce2b('0x40')][_0xce2b('0x41')],function(_0x429de0){return{'name':_0x429de0[_0xce2b('0x42')],'type':_0x429de0[_0xce2b('0x43')][_0xce2b('0x44')]};});_0x280cca[_0xce2b('0x45')]=_[_0xce2b('0x46')](_0x5a3593,_0xce2b('0x3e'));_0x280cca[_0xce2b('0x47')]=_[_0xce2b('0x48')](_0xe6d501[_0xce2b('0x47')]);_0x280cca[_0xce2b('0x49')]=_[_0xce2b('0x4a')](_0x280cca[_0xce2b('0x45')],_0x280cca['query']);_0x30cffb[_0xce2b('0x4b')]=_[_0xce2b('0x4a')](_0x280cca['model'],qs[_0xce2b('0x4c')](_0xe6d501['query'][_0xce2b('0x4c')]));_0x30cffb[_0xce2b('0x4b')]=_0x30cffb[_0xce2b('0x4b')]['length']?_0x30cffb[_0xce2b('0x4b')]:_0x280cca[_0xce2b('0x45')];if(!_0xe6d501['query']['hasOwnProperty'](_0xce2b('0x4d'))){_0x30cffb[_0xce2b('0x33')]=qs[_0xce2b('0x33')](_0xe6d501[_0xce2b('0x47')][_0xce2b('0x33')]);_0x30cffb['offset']=qs[_0xce2b('0x32')](_0xe6d501[_0xce2b('0x47')][_0xce2b('0x32')]);}_0x30cffb[_0xce2b('0x4e')]=qs[_0xce2b('0x4f')](_0xe6d501['query'][_0xce2b('0x4f')]);_0x30cffb[_0xce2b('0x50')]=qs[_0xce2b('0x49')](_[_0xce2b('0x51')](_0xe6d501[_0xce2b('0x47')],_0x280cca[_0xce2b('0x49')]));if(_0xe6d501[_0xce2b('0x47')]['filter']){_0x30cffb['where']=_['merge'](_0x30cffb[_0xce2b('0x50')],{'$or':_[_0xce2b('0x46')](_0x5a3593,function(_0x841c2e){if(_0x841c2e['type']!=='VIRTUAL'){var _0x4efd57={};_0x4efd57[_0x841c2e[_0xce2b('0x3e')]]={'$like':'%'+_0xe6d501[_0xce2b('0x47')][_0xce2b('0x52')]+'%'};return _0x4efd57;}})});}_0x30cffb=_['merge']({},_0x30cffb,_0xe6d501[_0xce2b('0x53')]);var _0x83d2a3={'where':_0x30cffb[_0xce2b('0x50')]};return db['ChatQueue'][_0xce2b('0x31')](_0x83d2a3)['then'](function(_0x3b5912){_0x30aaf5[_0xce2b('0x31')]=_0x3b5912;if(_0xe6d501[_0xce2b('0x47')]['includeAll']){_0x30cffb[_0xce2b('0x54')]=[{'all':!![]}];}return db[_0xce2b('0x40')][_0xce2b('0x55')](_0x30cffb);})[_0xce2b('0x23')](function(_0x592b65){_0x30aaf5[_0xce2b('0x56')]=_0x592b65;return _0x30aaf5;})[_0xce2b('0x23')](respondWithFilteredResult(_0x38d764,_0x30cffb))[_0xce2b('0x57')](handleError(_0x38d764,null));};exports[_0xce2b('0x58')]=function(_0x14ecae,_0x4ae40a){var _0x20d4ae={'raw':!![],'where':{'id':_0x14ecae[_0xce2b('0x59')]['id']}},_0x2aeea5={};_0x2aeea5[_0xce2b('0x45')]=_[_0xce2b('0x48')](db['ChatQueue'][_0xce2b('0x41')]);_0x2aeea5['query']=_[_0xce2b('0x48')](_0x14ecae[_0xce2b('0x47')]);_0x2aeea5['filters']=_['intersection'](_0x2aeea5[_0xce2b('0x45')],_0x2aeea5[_0xce2b('0x47')]);_0x20d4ae[_0xce2b('0x4b')]=_['intersection'](_0x2aeea5[_0xce2b('0x45')],qs[_0xce2b('0x4c')](_0x14ecae['query'][_0xce2b('0x4c')]));_0x20d4ae[_0xce2b('0x4b')]=_0x20d4ae[_0xce2b('0x4b')][_0xce2b('0x5a')]?_0x20d4ae[_0xce2b('0x4b')]:_0x2aeea5[_0xce2b('0x45')];if(_0x14ecae['query'][_0xce2b('0x5b')]){_0x20d4ae['include']=[{'all':!![]}];}_0x20d4ae=_[_0xce2b('0x5c')]({},_0x20d4ae,_0x14ecae[_0xce2b('0x53')]);return db[_0xce2b('0x40')][_0xce2b('0x5d')](_0x20d4ae)['then'](handleEntityNotFound(_0x4ae40a,null))[_0xce2b('0x23')](respondWithResult(_0x4ae40a,null))[_0xce2b('0x57')](handleError(_0x4ae40a,null));};exports[_0xce2b('0x5e')]=function(_0xc3c65d,_0x5391e6){return db[_0xce2b('0x40')][_0xce2b('0x5e')](_0xc3c65d[_0xce2b('0x5f')],{})[_0xce2b('0x23')](function(_0x2a4068){var _0x2d9474=_0xc3c65d[_0xce2b('0x60')]['get']({'plain':!![]});if(!_0x2d9474)throw new Error(_0xce2b('0x61'));if(_0x2d9474['role']===_0xce2b('0x60')){var _0x20ccaf=_0x2a4068[_0xce2b('0x3a')]({'plain':!![]});var _0x1546ff=_0xce2b('0x3b');return db[_0xce2b('0x62')][_0xce2b('0x5d')]({'where':{'name':_0x1546ff,'userProfileId':_0x2d9474[_0xce2b('0x63')]},'raw':!![]})['then'](function(_0x3071fe){if(_0x3071fe&&_0x3071fe[_0xce2b('0x64')]===0x0){return db[_0xce2b('0x3c')][_0xce2b('0x5e')]({'name':_0x20ccaf[_0xce2b('0x3e')],'resourceId':_0x20ccaf['id'],'type':_0x3071fe['name'],'sectionId':_0x3071fe['id']},{})[_0xce2b('0x23')](function(){return _0x2a4068;});}else{return _0x2a4068;}})[_0xce2b('0x57')](function(_0x5db856){logger[_0xce2b('0x29')](_0xce2b('0x65'),_0x5db856);throw _0x5db856;});}return _0x2a4068;})[_0xce2b('0x23')](respondWithResult(_0x5391e6,0xc9))[_0xce2b('0x57')](handleError(_0x5391e6,null));};exports[_0xce2b('0x38')]=function(_0x893f84,_0x43213e){if(_0x893f84[_0xce2b('0x5f')]['id']){delete _0x893f84[_0xce2b('0x5f')]['id'];}return db[_0xce2b('0x40')][_0xce2b('0x5d')]({'where':{'id':_0x893f84[_0xce2b('0x59')]['id']}})[_0xce2b('0x23')](handleEntityNotFound(_0x43213e,null))[_0xce2b('0x23')](saveUpdates(_0x893f84['body'],null))[_0xce2b('0x23')](respondWithResult(_0x43213e,null))[_0xce2b('0x57')](handleError(_0x43213e,null));};exports[_0xce2b('0x39')]=function(_0x55b364,_0x2ffb3b){return db[_0xce2b('0x40')]['find']({'where':{'id':_0x55b364[_0xce2b('0x59')]['id']}})[_0xce2b('0x23')](handleEntityNotFound(_0x2ffb3b,null))['then'](removeEntity(_0x2ffb3b,null))[_0xce2b('0x57')](handleError(_0x2ffb3b,null));};exports[_0xce2b('0x66')]=function(_0xce0b23,_0x6df631){return db[_0xce2b('0x40')][_0xce2b('0x66')]()[_0xce2b('0x23')](respondWithResult(_0x6df631,null))['catch'](handleError(_0x6df631,null));};exports[_0xce2b('0x67')]=function(_0x3b710e,_0x53e6b9,_0x288a33){var _0x410c13={'raw':!![],'where':{}},_0x448521={},_0x235b54;return db['ChatQueue'][_0xce2b('0x68')]({'where':{'id':_0x3b710e[_0xce2b('0x59')]['id']}})['then'](handleEntityNotFound(_0x53e6b9,null))['then'](function(_0x4d71e3){if(_0x4d71e3){_0x235b54=_0x4d71e3['get']({'plain':!![]});_0x448521[_0xce2b('0x45')]=_[_0xce2b('0x48')](db['UserChatQueue']['rawAttributes']);_0x448521[_0xce2b('0x47')]=_[_0xce2b('0x48')](_0x3b710e[_0xce2b('0x47')]);_0x448521['filters']=_[_0xce2b('0x4a')](_0x448521[_0xce2b('0x45')],_0x448521['query']);_0x410c13[_0xce2b('0x4b')]=_[_0xce2b('0x4a')](_0x448521[_0xce2b('0x45')],qs[_0xce2b('0x4c')](_0x3b710e['query'][_0xce2b('0x4c')]));_0x410c13[_0xce2b('0x4b')]=_0x410c13['attributes'][_0xce2b('0x5a')]?_0x410c13['attributes']:_0x448521['model'];if(!_0x3b710e[_0xce2b('0x47')][_0xce2b('0x69')](_0xce2b('0x4d'))){_0x410c13[_0xce2b('0x33')]=qs['limit'](_0x3b710e['query'][_0xce2b('0x33')]);_0x410c13[_0xce2b('0x32')]=qs[_0xce2b('0x32')](_0x3b710e[_0xce2b('0x47')][_0xce2b('0x32')]);}_0x410c13[_0xce2b('0x4e')]=qs['sort'](_0x3b710e[_0xce2b('0x47')][_0xce2b('0x4f')]);_0x410c13[_0xce2b('0x50')]=qs[_0xce2b('0x49')](_['pick'](_0x3b710e['query'],_0x448521[_0xce2b('0x49')]));_0x410c13['where'][_0xce2b('0x6a')]=_0x4d71e3['id'];if(_0x3b710e[_0xce2b('0x47')][_0xce2b('0x52')]){_0x410c13['where']=_['merge'](_0x410c13[_0xce2b('0x50')],{'$or':_[_0xce2b('0x46')](_0x410c13[_0xce2b('0x4b')],function(_0x31e5c7){var _0x408009={};_0x408009[_0x31e5c7]={'$like':'%'+_0x3b710e['query'][_0xce2b('0x52')]+'%'};return _0x408009;})});}_0x410c13=_[_0xce2b('0x5c')]({},_0x410c13,_0x3b710e[_0xce2b('0x53')]);return db[_0xce2b('0x6b')][_0xce2b('0x55')](_0x410c13);}})[_0xce2b('0x23')](function(_0x56547e){if(_0x56547e){return db[_0xce2b('0x6c')]['findAndCountAll']({'where':{'id':_['map'](_0x56547e,_0xce2b('0x6d')),'role':_0xce2b('0x6e')},'attributes':['id',_0xce2b('0x3e'),'chatPause',_0xce2b('0x6f'),'createdAt']});}})[_0xce2b('0x23')](function(_0x511ea4){if(_0x511ea4){return{'count':_0x511ea4['count'],'rows':_['map'](_0x511ea4[_0xce2b('0x56')],function(_0x36986d){return{'membername':_0x36986d['name'],'UserId':_0x36986d['id'],'queue_name':_0x235b54['name'],'ChatQueueId':_0x235b54['id'],'interface':util['format']('%s/%s',_0xce2b('0x70'),_0x36986d[_0xce2b('0x3e')]),'penalty':0x0,'paused':_0x36986d[_0xce2b('0x71')],'createdAt':_0x36986d['createdAt'],'updatedAt':_0x36986d[_0xce2b('0x6f')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x53e6b9,_0x410c13))[_0xce2b('0x57')](handleError(_0x53e6b9,null));};exports[_0xce2b('0x72')]=function(_0x433d31,_0x4d902f,_0x3b1ad){var _0x324a92={};var _0x2e862f={};var _0x15d07f;var _0x2a4217;return db[_0xce2b('0x40')][_0xce2b('0x68')]({'where':{'id':_0x433d31[_0xce2b('0x59')]['id']}})[_0xce2b('0x23')](handleEntityNotFound(_0x4d902f,null))[_0xce2b('0x23')](function(_0x217266){if(_0x217266){_0x15d07f=_0x217266;_0x2e862f[_0xce2b('0x45')]=_[_0xce2b('0x48')](db[_0xce2b('0x73')]['rawAttributes']);_0x2e862f['query']=_[_0xce2b('0x48')](_0x433d31[_0xce2b('0x47')]);_0x2e862f['filters']=_[_0xce2b('0x4a')](_0x2e862f['model'],_0x2e862f[_0xce2b('0x47')]);_0x324a92[_0xce2b('0x4b')]=_['intersection'](_0x2e862f[_0xce2b('0x45')],qs['fields'](_0x433d31[_0xce2b('0x47')][_0xce2b('0x4c')]));_0x324a92[_0xce2b('0x4b')]=_0x324a92['attributes'][_0xce2b('0x5a')]?_0x324a92[_0xce2b('0x4b')]:_0x2e862f[_0xce2b('0x45')];_0x324a92['order']=qs[_0xce2b('0x4f')](_0x433d31[_0xce2b('0x47')][_0xce2b('0x4f')]);_0x324a92[_0xce2b('0x50')]=qs[_0xce2b('0x49')](_[_0xce2b('0x51')](_0x433d31[_0xce2b('0x47')],_0x2e862f[_0xce2b('0x49')]));if(_0x433d31['query'][_0xce2b('0x52')]){_0x324a92[_0xce2b('0x50')]=_[_0xce2b('0x5c')](_0x324a92[_0xce2b('0x50')],{'$or':_[_0xce2b('0x46')](_0x324a92[_0xce2b('0x4b')],function(_0x538176){var _0xc36ed8={};_0xc36ed8[_0x538176]={'$like':'%'+_0x433d31[_0xce2b('0x47')][_0xce2b('0x52')]+'%'};return _0xc36ed8;})});}_0x324a92=_['merge']({},_0x324a92,_0x433d31[_0xce2b('0x53')]);return _0x15d07f[_0xce2b('0x72')](_0x324a92);}})['then'](function(_0x42bfd0){if(_0x42bfd0){_0x2a4217=_0x42bfd0['length'];if(!_0x433d31[_0xce2b('0x47')][_0xce2b('0x69')](_0xce2b('0x4d'))){_0x324a92[_0xce2b('0x33')]=qs[_0xce2b('0x33')](_0x433d31[_0xce2b('0x47')][_0xce2b('0x33')]);_0x324a92[_0xce2b('0x32')]=qs[_0xce2b('0x32')](_0x433d31[_0xce2b('0x47')]['offset']);}return _0x15d07f[_0xce2b('0x72')](_0x324a92);}})[_0xce2b('0x23')](function(_0x1371b5){if(_0x1371b5){return _0x1371b5?{'count':_0x2a4217,'rows':_0x1371b5}:null;}})[_0xce2b('0x23')](respondWithResult(_0x4d902f,null))['catch'](handleError(_0x4d902f,null));};exports[_0xce2b('0x74')]=function(_0x64aba0,_0x33673f,_0x534234){var _0x19eb7f=_0x64aba0[_0xce2b('0x5f')]['ids'];return db[_0xce2b('0x73')][_0xce2b('0x55')]({'where':{'id':_0x19eb7f},'attributes':['id'],'include':[{'model':db[_0xce2b('0x6c')],'as':'Agents','attributes':['id',_0xce2b('0x3e'),'online',_0xce2b('0x75'),_0xce2b('0x76')],'raw':!![]}]})[_0xce2b('0x23')](function(_0x2682f3){if(_0x2682f3){var _0x185011=_[_0xce2b('0x77')](_0x2682f3,function(_0x217454){var _0x15c9b0=_0x217454[_0xce2b('0x3a')]({'plain':!![]});return _0x15c9b0[_0xce2b('0x78')];});return db['ChatQueue']['find']({'where':{'id':_0x64aba0['params']['id']}})['then'](function(_0x2148c8){return db[_0xce2b('0x79')][_0xce2b('0x7a')](function(_0x5ab72b){return _0x2148c8[_0xce2b('0x74')](_0x19eb7f,{'transaction':_0x5ab72b})[_0xce2b('0x23')](function(){return BPromise[_0xce2b('0x7b')](_0x185011,function(_0x1f72f4){return db[_0xce2b('0x6b')][_0xce2b('0x7c')]({'where':{'UserId':_0x1f72f4['id'],'ChatQueueId':_0x64aba0[_0xce2b('0x59')]['id']},'transaction':_0x5ab72b});});})[_0xce2b('0x23')](function(){_0x185011[_0xce2b('0x7d')](function(_0x5d82fb){socket[_0xce2b('0x7e')](_0xce2b('0x7f'),{'UserId':_0x5d82fb['id'],'ChatQueueId':_0x2148c8['id']});});});});});}})[_0xce2b('0x23')](respondWithStatusCode(_0x33673f,null))[_0xce2b('0x57')](handleError(_0x33673f,null));};exports[_0xce2b('0x80')]=function(_0x33578f,_0x2bc34d,_0x41a0f6){return db[_0xce2b('0x73')][_0xce2b('0x55')]({'where':{'id':_0x33578f[_0xce2b('0x47')][_0xce2b('0x81')]},'attributes':['id'],'include':[{'model':db[_0xce2b('0x6c')],'as':_0xce2b('0x78'),'attributes':['id'],'raw':!![]}]})[_0xce2b('0x23')](handleEntityNotFound(_0x2bc34d,null))['then'](function(_0x6f09c9){var _0x56d87b=_['map'](_0x6f09c9,'id');var _0x19648c=[];var _0x1dfafd=[];var _0x2f77fa=squel[_0xce2b('0x82')]();_0x2f77fa[_0xce2b('0x83')]('tq.TeamId')[_0xce2b('0x84')]('team_has_chat_queues','tq')[_0xce2b('0x85')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xce2b('0x86'),_0x33578f[_0xce2b('0x59')]['id']);for(var _0x4d0a1d=0x0;_0x4d0a1d<_0x6f09c9[_0xce2b('0x5a')];_0x4d0a1d+=0x1){let _0x496d7d=_0x6f09c9[_0x4d0a1d];for(var _0xcc9a80=0x0;_0xcc9a80<_0x496d7d['Agents'][_0xce2b('0x5a')];_0xcc9a80+=0x1){let _0x3904cb=_0x496d7d['Agents'][_0xcc9a80];var _0x37cc51=_0x2f77fa[_0xce2b('0x87')]();_0x37cc51[_0xce2b('0x50')](_0xce2b('0x88'),_0x3904cb['id']);_0x1dfafd[_0xce2b('0x89')](db[_0xce2b('0x79')]['query'](_0x37cc51['toString'](),{'type':db[_0xce2b('0x79')][_0xce2b('0x8a')][_0xce2b('0x8b')]})[_0xce2b('0x23')](function(_0x5c8120){if(_0x5c8120[_0xce2b('0x5a')]===0x1){return _0x3904cb['id'];}else{var _0x56e3f4=_[_0xce2b('0x8c')](_[_0xce2b('0x46')](_0x5c8120,_0xce2b('0x8d')),function(_0x12c94a){return _[_0xce2b('0x8e')](_0x56d87b,_0x12c94a);});if(_0x56e3f4){return _0x3904cb['id'];}}}));}}return BPromise[_0xce2b('0x8f')](_0x1dfafd)['then'](function(_0x5fd11d){_0x19648c=_(_0x19648c)['union'](_0x5fd11d)[_0xce2b('0x90')]()[_0xce2b('0x91')]();return db[_0xce2b('0x40')][_0xce2b('0x5d')]({'where':{'id':_0x33578f[_0xce2b('0x59')]['id']}})[_0xce2b('0x23')](function(_0x5128ba){return db[_0xce2b('0x79')][_0xce2b('0x7a')](function(_0x4aa809){return _0x5128ba[_0xce2b('0x80')](_0x33578f['query']['ids'],{'transaction':_0x4aa809})['then'](function(){if(!_[_0xce2b('0x92')](_0x19648c)){return _0x5128ba[_0xce2b('0x93')](_0x19648c,{'transaction':_0x4aa809});}})[_0xce2b('0x23')](function(){_0x19648c[_0xce2b('0x7d')](function(_0x56aeae){socket[_0xce2b('0x7e')](_0xce2b('0x94'),{'UserId':_0x56aeae,'ChatQueueId':_0x5128ba['id']});});});});});});})['then'](respondWithStatusCode(_0x2bc34d,null))[_0xce2b('0x57')](handleError(_0x2bc34d,null));};exports[_0xce2b('0x95')]=function(_0x5b8d8f,_0xb94b6f,_0x584215){return db['ChatQueue'][_0xce2b('0x5d')]({'where':{'id':_0x5b8d8f[_0xce2b('0x59')]['id']}})['then'](handleEntityNotFound(_0xb94b6f,null))[_0xce2b('0x23')](function(_0x17a969){if(_0x17a969){return _0x17a969['addAgents'](_0x5b8d8f[_0xce2b('0x5f')][_0xce2b('0x81')],_[_0xce2b('0x96')](_0x5b8d8f[_0xce2b('0x5f')],[_0xce2b('0x81'),'id'])||{})[_0xce2b('0x97')](function(_0x19ce2c){for(var _0x382049=0x0;_0x382049<_0x5b8d8f['body']['ids'][_0xce2b('0x5a')];_0x382049+=0x1){socket['emit']('userChatQueue:save',{'UserId':_0x5b8d8f['body'][_0xce2b('0x81')][_0x382049],'ChatQueueId':_0x5b8d8f['params']['id']});}return _0x19ce2c;});}})[_0xce2b('0x23')](respondWithResult(_0xb94b6f,null))[_0xce2b('0x57')](handleError(_0xb94b6f,null));};exports[_0xce2b('0x93')]=function(_0x2c423a,_0x195f37,_0x503202){return db['ChatQueue'][_0xce2b('0x5d')]({'where':{'id':_0x2c423a['params']['id']}})[_0xce2b('0x23')](handleEntityNotFound(_0x195f37,null))['then'](function(_0x26fbb8){if(_0x26fbb8){return _0x26fbb8[_0xce2b('0x93')](_0x2c423a['query'][_0xce2b('0x81')])['then'](function(){if(_[_0xce2b('0x98')](_0x2c423a[_0xce2b('0x47')][_0xce2b('0x81')])){for(var _0x1accd2=0x0;_0x1accd2<_0x2c423a['query'][_0xce2b('0x81')][_0xce2b('0x5a')];_0x1accd2+=0x1){socket[_0xce2b('0x7e')](_0xce2b('0x94'),{'UserId':Number(_0x2c423a['query'][_0xce2b('0x81')][_0x1accd2]),'ChatQueueId':Number(_0x2c423a[_0xce2b('0x59')]['id'])});}}else{socket[_0xce2b('0x7e')](_0xce2b('0x94'),{'UserId':Number(_0x2c423a[_0xce2b('0x47')][_0xce2b('0x81')]),'ChatQueueId':Number(_0x2c423a[_0xce2b('0x59')]['id'])});}});}})[_0xce2b('0x23')](respondWithStatusCode(_0x195f37,null))['catch'](handleError(_0x195f37,null));};exports[_0xce2b('0x99')]=function(_0x4d8e49,_0x3ba9a6,_0x4f3d2a){var _0x58dfc4={};var _0x4ebf3d={};var _0x53d53a;var _0x368a76;return db[_0xce2b('0x40')][_0xce2b('0x68')]({'where':{'id':_0x4d8e49[_0xce2b('0x59')]['id']}})['then'](handleEntityNotFound(_0x3ba9a6,null))[_0xce2b('0x23')](function(_0x28effd){if(_0x28effd){_0x53d53a=_0x28effd;_0x4ebf3d[_0xce2b('0x45')]=_['keys'](db[_0xce2b('0x6c')][_0xce2b('0x41')]);_0x4ebf3d[_0xce2b('0x47')]=_[_0xce2b('0x48')](_0x4d8e49[_0xce2b('0x47')]);_0x4ebf3d[_0xce2b('0x49')]=_[_0xce2b('0x4a')](_0x4ebf3d[_0xce2b('0x45')],_0x4ebf3d[_0xce2b('0x47')]);_0x58dfc4[_0xce2b('0x4b')]=_[_0xce2b('0x4a')](_0x4ebf3d['model'],qs[_0xce2b('0x4c')](_0x4d8e49[_0xce2b('0x47')][_0xce2b('0x4c')]));_0x58dfc4[_0xce2b('0x4b')]=_0x58dfc4[_0xce2b('0x4b')][_0xce2b('0x5a')]?_0x58dfc4[_0xce2b('0x4b')]:_0x4ebf3d['model'];_0x58dfc4['order']=qs[_0xce2b('0x4f')](_0x4d8e49['query']['sort']);_0x58dfc4[_0xce2b('0x50')]=qs[_0xce2b('0x49')](_[_0xce2b('0x51')](_0x4d8e49[_0xce2b('0x47')],_0x4ebf3d['filters']));if(_0x4d8e49[_0xce2b('0x47')]['filter']){_0x58dfc4[_0xce2b('0x50')]=_[_0xce2b('0x5c')](_0x58dfc4[_0xce2b('0x50')],{'$or':_['map'](_0x58dfc4[_0xce2b('0x4b')],function(_0x1d60a1){var _0x11a611={};_0x11a611[_0x1d60a1]={'$like':'%'+_0x4d8e49[_0xce2b('0x47')]['filter']+'%'};return _0x11a611;})});}_0x58dfc4=_[_0xce2b('0x5c')]({},_0x58dfc4,_0x4d8e49[_0xce2b('0x53')]);return _0x53d53a['getAgents'](_0x58dfc4);}})[_0xce2b('0x23')](function(_0x3ad461){if(_0x3ad461){_0x368a76=_0x3ad461[_0xce2b('0x5a')];if(!_0x4d8e49[_0xce2b('0x47')][_0xce2b('0x69')](_0xce2b('0x4d'))){_0x58dfc4[_0xce2b('0x33')]=qs[_0xce2b('0x33')](_0x4d8e49[_0xce2b('0x47')][_0xce2b('0x33')]);_0x58dfc4['offset']=qs[_0xce2b('0x32')](_0x4d8e49[_0xce2b('0x47')][_0xce2b('0x32')]);}return _0x53d53a[_0xce2b('0x99')](_0x58dfc4);}})[_0xce2b('0x23')](function(_0x41254b){if(_0x41254b){return _0x41254b?{'count':_0x368a76,'rows':_0x41254b}:null;}})[_0xce2b('0x23')](respondWithResult(_0x3ba9a6,null))[_0xce2b('0x57')](handleError(_0x3ba9a6,null));}; \ No newline at end of file +var _0x6657=['merge','type','VIRTUAL','filter','options','includeAll','include','rows','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','order','pick','ChatQueueId','UserChatQueue','User','findAndCountAll','UserId','chatPause','updatedAt','createdAt','format','%s/%s','getTeams','nolimit','addTeams','ids','Team','findAll','Agents','online','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','field','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','includes','all','union','compact','userChatQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','localhost','./chatQueue.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','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','ChatQueues','name','send','index','map','ChatQueue','rawAttributes','fieldName','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters'];(function(_0x336c02,_0x2d2355){var _0x4c8b60=function(_0x5b60c2){while(--_0x5b60c2){_0x336c02['push'](_0x336c02['shift']());}};_0x4c8b60(++_0x2d2355);}(_0x6657,0x17f));var _0x7665=function(_0x3b626c,_0x59535b){_0x3b626c=_0x3b626c-0x0;var _0x5274ef=_0x6657[_0x3b626c];return _0x5274ef;};'use strict';var pdf=require(_0x7665('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7665('0x1'));var zipdir=require(_0x7665('0x2'));var jsonpatch=require(_0x7665('0x3'));var rp=require(_0x7665('0x4'));var moment=require('moment');var BPromise=require(_0x7665('0x5'));var Mustache=require(_0x7665('0x6'));var util=require(_0x7665('0x7'));var path=require(_0x7665('0x8'));var sox=require(_0x7665('0x9'));var csv=require(_0x7665('0xa'));var ejs=require(_0x7665('0xb'));var fs=require('fs');var _=require(_0x7665('0xc'));var squel=require('squel');var crypto=require(_0x7665('0xd'));var jsforce=require(_0x7665('0xe'));var deskjs=require(_0x7665('0xf'));var toCsv=require(_0x7665('0xa'));var querystring=require(_0x7665('0x10'));var Papa=require(_0x7665('0x11'));var Redis=require(_0x7665('0x12'));var authService=require(_0x7665('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7665('0x14'));var hardwareService=require(_0x7665('0x15'));var logger=require(_0x7665('0x16'))('api');var utils=require(_0x7665('0x17'));var config=require('../../config/environment');var db=require(_0x7665('0x18'))['db'];config[_0x7665('0x19')]=_['defaults'](config[_0x7665('0x19')],{'host':_0x7665('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7665('0x19')]));require(_0x7665('0x1b'))['register'](socket);var jayson=require(_0x7665('0x1c'));var client=jayson[_0x7665('0x1d')][_0x7665('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x3bc95e,_0x2719c0,_0x331d8c){if(_0x331d8c){var _0x308e5c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x308e5c[_0x7665('0x1f')](_0x2719c0)){return _0x3bc95e;}else{throw new db[(_0x7665('0x20'))][(_0x7665('0x21'))](_0x7665('0x22'));}}else{return _0x3bc95e;}}function respondWithRpcPromise(_0xf730b0,_0x34dc39,_0x34e7a8,_0x2dab51){return new BPromise(function(_0xa3f5d4,_0x522944){var _0x30dedb=_0x2dab51||client;return _0x30dedb[_0x7665('0x23')](_0xf730b0,_0x34e7a8)['then'](function(_0x32b37a){logger[_0x7665('0x24')](_0x7665('0x25'),_0x34dc39,_0x7665('0x26'));logger['debug'](_0x7665('0x27'),_0x34dc39,_0x7665('0x26'),JSON[_0x7665('0x28')](_0x32b37a));if(_0x32b37a[_0x7665('0x29')]){if(_0x32b37a[_0x7665('0x29')]['code']===0x1f4){logger[_0x7665('0x29')]('ChatQueue,\x20%s,\x20%s',_0x34dc39,_0x32b37a[_0x7665('0x29')][_0x7665('0x2a')]);return _0x522944(_0x32b37a['error']['message']);}logger[_0x7665('0x29')](_0x7665('0x25'),_0x34dc39,_0x32b37a['error'][_0x7665('0x2a')]);return _0xa3f5d4(_0x32b37a[_0x7665('0x29')][_0x7665('0x2a')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x34dc39,'request\x20sent');_0xa3f5d4(_0x32b37a['result'][_0x7665('0x2a')]);}})[_0x7665('0x2b')](function(_0x1129c1){logger['error'](_0x7665('0x25'),_0x34dc39,_0x1129c1);_0x522944(_0x1129c1);});});}function respondWithStatusCode(_0x383d06,_0x50bfa5){_0x50bfa5=_0x50bfa5||0xcc;return function(_0x56b6e8){if(_0x56b6e8){return _0x383d06[_0x7665('0x2c')](_0x50bfa5);}return _0x383d06[_0x7665('0x2d')](_0x50bfa5)[_0x7665('0x2e')]();};}function respondWithResult(_0x23e167,_0x240ee3){_0x240ee3=_0x240ee3||0xc8;return function(_0x3bcb70){if(_0x3bcb70){return _0x23e167['status'](_0x240ee3)[_0x7665('0x2f')](_0x3bcb70);}};}function respondWithFilteredResult(_0x55d046,_0x56d62c){return function(_0x634ebb){if(_0x634ebb){var _0x7425af=_0x634ebb[_0x7665('0x30')],_0x43797a=_0x56d62c[_0x7665('0x31')],_0x34476b=_0x56d62c[_0x7665('0x31')]+_0x56d62c[_0x7665('0x32')],_0x264b6e;if(_0x34476b>=_0x7425af){_0x34476b=_0x7425af;_0x264b6e=0xc8;}else{_0x264b6e=0xce;}_0x55d046[_0x7665('0x2d')](_0x264b6e);return _0x55d046[_0x7665('0x33')](_0x7665('0x34'),_0x43797a+'-'+_0x34476b+'/'+_0x7425af)[_0x7665('0x2f')](_0x634ebb);}return null;};}function patchUpdates(_0x3430a0){return function(_0x42ec7f){try{jsonpatch[_0x7665('0x35')](_0x42ec7f,_0x3430a0,!![]);}catch(_0x28be7c){return BPromise[_0x7665('0x36')](_0x28be7c);}return _0x42ec7f[_0x7665('0x37')]();};}function saveUpdates(_0x588a27,_0x17aec3){return function(_0xd93b75){if(_0xd93b75){return _0xd93b75[_0x7665('0x38')](_0x588a27)[_0x7665('0x39')](function(_0x2bf617){return _0x2bf617;});}return null;};}function removeEntity(_0x2e91f7,_0x4da120){return function(_0x3a7a39){if(_0x3a7a39){return _0x3a7a39[_0x7665('0x3a')]()[_0x7665('0x39')](function(){var _0x1899ad=_0x3a7a39[_0x7665('0x3b')]({'plain':!![]});var _0x495704=_0x7665('0x3c');return db['UserProfileResource'][_0x7665('0x3a')]({'where':{'type':_0x495704,'resourceId':_0x1899ad['id']}})['then'](function(){return _0x3a7a39;});})[_0x7665('0x39')](function(){_0x2e91f7[_0x7665('0x2d')](0xcc)[_0x7665('0x2e')]();});}};}function handleEntityNotFound(_0x2f03bb,_0x3eea5a){return function(_0x3c0ef1){if(!_0x3c0ef1){_0x2f03bb['sendStatus'](0x194);}return _0x3c0ef1;};}function handleError(_0x33f582,_0x3dfab1){_0x3dfab1=_0x3dfab1||0x1f4;return function(_0x99ff2f){logger[_0x7665('0x29')](_0x99ff2f['stack']);if(_0x99ff2f[_0x7665('0x3d')]){delete _0x99ff2f[_0x7665('0x3d')];}_0x33f582[_0x7665('0x2d')](_0x3dfab1)[_0x7665('0x3e')](_0x99ff2f);};}exports[_0x7665('0x3f')]=function(_0x5f4fbf,_0x16d694){var _0x341098={},_0x80529c={},_0x12e605={'count':0x0,'rows':[]};var _0xa67544=_[_0x7665('0x40')](db[_0x7665('0x41')][_0x7665('0x42')],function(_0x42777b){return{'name':_0x42777b[_0x7665('0x43')],'type':_0x42777b['type']['key']};});_0x80529c[_0x7665('0x44')]=_[_0x7665('0x40')](_0xa67544,'name');_0x80529c['query']=_[_0x7665('0x45')](_0x5f4fbf[_0x7665('0x46')]);_0x80529c['filters']=_[_0x7665('0x47')](_0x80529c[_0x7665('0x44')],_0x80529c[_0x7665('0x46')]);_0x341098[_0x7665('0x48')]=_[_0x7665('0x47')](_0x80529c[_0x7665('0x44')],qs[_0x7665('0x49')](_0x5f4fbf[_0x7665('0x46')][_0x7665('0x49')]));_0x341098[_0x7665('0x48')]=_0x341098[_0x7665('0x48')][_0x7665('0x4a')]?_0x341098[_0x7665('0x48')]:_0x80529c[_0x7665('0x44')];if(!_0x5f4fbf['query'][_0x7665('0x4b')]('nolimit')){_0x341098[_0x7665('0x32')]=qs[_0x7665('0x32')](_0x5f4fbf[_0x7665('0x46')][_0x7665('0x32')]);_0x341098[_0x7665('0x31')]=qs['offset'](_0x5f4fbf[_0x7665('0x46')][_0x7665('0x31')]);}_0x341098['order']=qs[_0x7665('0x4c')](_0x5f4fbf['query'][_0x7665('0x4c')]);_0x341098[_0x7665('0x4d')]=qs[_0x7665('0x4e')](_['pick'](_0x5f4fbf['query'],_0x80529c[_0x7665('0x4e')]));if(_0x5f4fbf[_0x7665('0x46')]['filter']){_0x341098[_0x7665('0x4d')]=_[_0x7665('0x4f')](_0x341098[_0x7665('0x4d')],{'$or':_[_0x7665('0x40')](_0xa67544,function(_0x2e38d1){if(_0x2e38d1[_0x7665('0x50')]!==_0x7665('0x51')){var _0x453904={};_0x453904[_0x2e38d1[_0x7665('0x3d')]]={'$like':'%'+_0x5f4fbf[_0x7665('0x46')][_0x7665('0x52')]+'%'};return _0x453904;}})});}_0x341098=_['merge']({},_0x341098,_0x5f4fbf[_0x7665('0x53')]);var _0x5a21ee={'where':_0x341098[_0x7665('0x4d')]};return db[_0x7665('0x41')][_0x7665('0x30')](_0x5a21ee)[_0x7665('0x39')](function(_0x543425){_0x12e605[_0x7665('0x30')]=_0x543425;if(_0x5f4fbf[_0x7665('0x46')][_0x7665('0x54')]){_0x341098[_0x7665('0x55')]=[{'all':!![]}];}return db[_0x7665('0x41')]['findAll'](_0x341098);})[_0x7665('0x39')](function(_0x5044ac){_0x12e605[_0x7665('0x56')]=_0x5044ac;return _0x12e605;})[_0x7665('0x39')](respondWithFilteredResult(_0x16d694,_0x341098))['catch'](handleError(_0x16d694,null));};exports['show']=function(_0x9d5c0b,_0x3b111f){var _0x4296c1={'raw':!![],'where':{'id':_0x9d5c0b['params']['id']}},_0x45c845={};_0x45c845['model']=_[_0x7665('0x45')](db['ChatQueue'][_0x7665('0x42')]);_0x45c845[_0x7665('0x46')]=_[_0x7665('0x45')](_0x9d5c0b['query']);_0x45c845[_0x7665('0x4e')]=_[_0x7665('0x47')](_0x45c845[_0x7665('0x44')],_0x45c845[_0x7665('0x46')]);_0x4296c1[_0x7665('0x48')]=_[_0x7665('0x47')](_0x45c845[_0x7665('0x44')],qs[_0x7665('0x49')](_0x9d5c0b[_0x7665('0x46')][_0x7665('0x49')]));_0x4296c1[_0x7665('0x48')]=_0x4296c1[_0x7665('0x48')][_0x7665('0x4a')]?_0x4296c1[_0x7665('0x48')]:_0x45c845['model'];if(_0x9d5c0b['query'][_0x7665('0x54')]){_0x4296c1[_0x7665('0x55')]=[{'all':!![]}];}_0x4296c1=_['merge']({},_0x4296c1,_0x9d5c0b['options']);return db['ChatQueue'][_0x7665('0x57')](_0x4296c1)[_0x7665('0x39')](handleEntityNotFound(_0x3b111f,null))[_0x7665('0x39')](respondWithResult(_0x3b111f,null))[_0x7665('0x2b')](handleError(_0x3b111f,null));};exports[_0x7665('0x58')]=function(_0x11137c,_0x36151b){return db[_0x7665('0x41')][_0x7665('0x58')](_0x11137c[_0x7665('0x59')],{})['then'](function(_0x49513c){var _0x21471d=_0x11137c[_0x7665('0x5a')][_0x7665('0x3b')]({'plain':!![]});if(!_0x21471d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x21471d[_0x7665('0x5b')]==='user'){var _0x17bbbe=_0x49513c[_0x7665('0x3b')]({'plain':!![]});var _0x3d056c=_0x7665('0x3c');return db[_0x7665('0x5c')][_0x7665('0x57')]({'where':{'name':_0x3d056c,'userProfileId':_0x21471d[_0x7665('0x5d')]},'raw':!![]})[_0x7665('0x39')](function(_0x3a6ce8){if(_0x3a6ce8&&_0x3a6ce8[_0x7665('0x5e')]===0x0){return db[_0x7665('0x5f')]['create']({'name':_0x17bbbe[_0x7665('0x3d')],'resourceId':_0x17bbbe['id'],'type':_0x3a6ce8[_0x7665('0x3d')],'sectionId':_0x3a6ce8['id']},{})[_0x7665('0x39')](function(){return _0x49513c;});}else{return _0x49513c;}})[_0x7665('0x2b')](function(_0x2f11bb){logger[_0x7665('0x29')](_0x7665('0x60'),_0x2f11bb);throw _0x2f11bb;});}return _0x49513c;})[_0x7665('0x39')](respondWithResult(_0x36151b,0xc9))['catch'](handleError(_0x36151b,null));};exports['update']=function(_0x7d8623,_0x2c5896){if(_0x7d8623[_0x7665('0x59')]['id']){delete _0x7d8623[_0x7665('0x59')]['id'];}return db[_0x7665('0x41')][_0x7665('0x57')]({'where':{'id':_0x7d8623['params']['id']}})[_0x7665('0x39')](handleEntityNotFound(_0x2c5896,null))[_0x7665('0x39')](saveUpdates(_0x7d8623[_0x7665('0x59')],null))[_0x7665('0x39')](respondWithResult(_0x2c5896,null))[_0x7665('0x2b')](handleError(_0x2c5896,null));};exports[_0x7665('0x3a')]=function(_0x59c97b,_0x345dbd){return db[_0x7665('0x41')][_0x7665('0x57')]({'where':{'id':_0x59c97b[_0x7665('0x61')]['id']}})['then'](handleEntityNotFound(_0x345dbd,null))[_0x7665('0x39')](removeEntity(_0x345dbd,null))[_0x7665('0x2b')](handleError(_0x345dbd,null));};exports[_0x7665('0x62')]=function(_0x5c0469,_0x41e903){return db['ChatQueue'][_0x7665('0x62')]()[_0x7665('0x39')](respondWithResult(_0x41e903,null))['catch'](handleError(_0x41e903,null));};exports[_0x7665('0x63')]=function(_0x58c138,_0x295197,_0x35d4ea){var _0x59403b={'raw':!![],'where':{}},_0x2af15f={},_0x4d4b4b;return db['ChatQueue'][_0x7665('0x64')]({'where':{'id':_0x58c138[_0x7665('0x61')]['id']}})['then'](handleEntityNotFound(_0x295197,null))['then'](function(_0x3fe1ab){if(_0x3fe1ab){_0x4d4b4b=_0x3fe1ab['get']({'plain':!![]});_0x2af15f[_0x7665('0x44')]=_[_0x7665('0x45')](db['UserChatQueue']['rawAttributes']);_0x2af15f[_0x7665('0x46')]=_[_0x7665('0x45')](_0x58c138[_0x7665('0x46')]);_0x2af15f[_0x7665('0x4e')]=_[_0x7665('0x47')](_0x2af15f[_0x7665('0x44')],_0x2af15f[_0x7665('0x46')]);_0x59403b['attributes']=_[_0x7665('0x47')](_0x2af15f[_0x7665('0x44')],qs[_0x7665('0x49')](_0x58c138[_0x7665('0x46')][_0x7665('0x49')]));_0x59403b[_0x7665('0x48')]=_0x59403b[_0x7665('0x48')]['length']?_0x59403b['attributes']:_0x2af15f[_0x7665('0x44')];if(!_0x58c138['query'][_0x7665('0x4b')]('nolimit')){_0x59403b[_0x7665('0x32')]=qs[_0x7665('0x32')](_0x58c138[_0x7665('0x46')]['limit']);_0x59403b[_0x7665('0x31')]=qs[_0x7665('0x31')](_0x58c138['query']['offset']);}_0x59403b[_0x7665('0x65')]=qs[_0x7665('0x4c')](_0x58c138[_0x7665('0x46')][_0x7665('0x4c')]);_0x59403b[_0x7665('0x4d')]=qs[_0x7665('0x4e')](_[_0x7665('0x66')](_0x58c138[_0x7665('0x46')],_0x2af15f['filters']));_0x59403b['where'][_0x7665('0x67')]=_0x3fe1ab['id'];if(_0x58c138[_0x7665('0x46')]['filter']){_0x59403b[_0x7665('0x4d')]=_['merge'](_0x59403b['where'],{'$or':_[_0x7665('0x40')](_0x59403b[_0x7665('0x48')],function(_0x3fd193){var _0x1a6ffa={};_0x1a6ffa[_0x3fd193]={'$like':'%'+_0x58c138[_0x7665('0x46')]['filter']+'%'};return _0x1a6ffa;})});}_0x59403b=_['merge']({},_0x59403b,_0x58c138['options']);return db[_0x7665('0x68')]['findAll'](_0x59403b);}})[_0x7665('0x39')](function(_0x5f5af2){if(_0x5f5af2){return db[_0x7665('0x69')][_0x7665('0x6a')]({'where':{'id':_[_0x7665('0x40')](_0x5f5af2,_0x7665('0x6b')),'role':'agent'},'attributes':['id','name',_0x7665('0x6c'),_0x7665('0x6d'),_0x7665('0x6e')]});}})[_0x7665('0x39')](function(_0x3b9fd9){if(_0x3b9fd9){return{'count':_0x3b9fd9[_0x7665('0x30')],'rows':_[_0x7665('0x40')](_0x3b9fd9[_0x7665('0x56')],function(_0x29e238){return{'membername':_0x29e238[_0x7665('0x3d')],'UserId':_0x29e238['id'],'queue_name':_0x4d4b4b['name'],'ChatQueueId':_0x4d4b4b['id'],'interface':util[_0x7665('0x6f')](_0x7665('0x70'),'SIP',_0x29e238[_0x7665('0x3d')]),'penalty':0x0,'paused':_0x29e238['chatPause'],'createdAt':_0x29e238['createdAt'],'updatedAt':_0x29e238['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x295197,_0x59403b))['catch'](handleError(_0x295197,null));};exports[_0x7665('0x71')]=function(_0x39408b,_0x506c71,_0x2d6309){var _0xd98de7={};var _0x291e43={};var _0x253763;var _0x4a51e3;return db[_0x7665('0x41')][_0x7665('0x64')]({'where':{'id':_0x39408b['params']['id']}})[_0x7665('0x39')](handleEntityNotFound(_0x506c71,null))[_0x7665('0x39')](function(_0x3b6cba){if(_0x3b6cba){_0x253763=_0x3b6cba;_0x291e43['model']=_[_0x7665('0x45')](db['Team']['rawAttributes']);_0x291e43[_0x7665('0x46')]=_[_0x7665('0x45')](_0x39408b[_0x7665('0x46')]);_0x291e43[_0x7665('0x4e')]=_['intersection'](_0x291e43[_0x7665('0x44')],_0x291e43[_0x7665('0x46')]);_0xd98de7[_0x7665('0x48')]=_[_0x7665('0x47')](_0x291e43[_0x7665('0x44')],qs[_0x7665('0x49')](_0x39408b[_0x7665('0x46')][_0x7665('0x49')]));_0xd98de7[_0x7665('0x48')]=_0xd98de7[_0x7665('0x48')][_0x7665('0x4a')]?_0xd98de7[_0x7665('0x48')]:_0x291e43[_0x7665('0x44')];_0xd98de7[_0x7665('0x65')]=qs['sort'](_0x39408b[_0x7665('0x46')][_0x7665('0x4c')]);_0xd98de7[_0x7665('0x4d')]=qs[_0x7665('0x4e')](_['pick'](_0x39408b[_0x7665('0x46')],_0x291e43[_0x7665('0x4e')]));if(_0x39408b['query'][_0x7665('0x52')]){_0xd98de7[_0x7665('0x4d')]=_['merge'](_0xd98de7[_0x7665('0x4d')],{'$or':_[_0x7665('0x40')](_0xd98de7[_0x7665('0x48')],function(_0x4b6fc7){var _0xd8a3f6={};_0xd8a3f6[_0x4b6fc7]={'$like':'%'+_0x39408b[_0x7665('0x46')][_0x7665('0x52')]+'%'};return _0xd8a3f6;})});}_0xd98de7=_[_0x7665('0x4f')]({},_0xd98de7,_0x39408b['options']);return _0x253763[_0x7665('0x71')](_0xd98de7);}})[_0x7665('0x39')](function(_0x509904){if(_0x509904){_0x4a51e3=_0x509904[_0x7665('0x4a')];if(!_0x39408b[_0x7665('0x46')][_0x7665('0x4b')](_0x7665('0x72'))){_0xd98de7[_0x7665('0x32')]=qs['limit'](_0x39408b[_0x7665('0x46')][_0x7665('0x32')]);_0xd98de7[_0x7665('0x31')]=qs[_0x7665('0x31')](_0x39408b['query'][_0x7665('0x31')]);}return _0x253763['getTeams'](_0xd98de7);}})[_0x7665('0x39')](function(_0x4f3a38){if(_0x4f3a38){return _0x4f3a38?{'count':_0x4a51e3,'rows':_0x4f3a38}:null;}})[_0x7665('0x39')](respondWithResult(_0x506c71,null))[_0x7665('0x2b')](handleError(_0x506c71,null));};exports[_0x7665('0x73')]=function(_0x1ff3ed,_0x1986cf,_0xb074a7){var _0x2e6c4b=_0x1ff3ed[_0x7665('0x59')][_0x7665('0x74')];return db[_0x7665('0x75')][_0x7665('0x76')]({'where':{'id':_0x2e6c4b},'attributes':['id'],'include':[{'model':db[_0x7665('0x69')],'as':_0x7665('0x77'),'attributes':['id','name',_0x7665('0x78'),'voicePause','interface'],'raw':!![]}]})[_0x7665('0x39')](function(_0x15ef32){if(_0x15ef32){var _0x2c125f=_[_0x7665('0x79')](_0x15ef32,function(_0x1a1729){var _0x1e617f=_0x1a1729[_0x7665('0x3b')]({'plain':!![]});return _0x1e617f[_0x7665('0x77')];});return db[_0x7665('0x41')]['find']({'where':{'id':_0x1ff3ed[_0x7665('0x61')]['id']}})[_0x7665('0x39')](function(_0x3a5993){return db[_0x7665('0x7a')][_0x7665('0x7b')](function(_0x442d83){return _0x3a5993['addTeams'](_0x2e6c4b,{'transaction':_0x442d83})[_0x7665('0x39')](function(){return BPromise[_0x7665('0x7c')](_0x2c125f,function(_0x22867d){return db[_0x7665('0x68')][_0x7665('0x7d')]({'where':{'UserId':_0x22867d['id'],'ChatQueueId':_0x1ff3ed[_0x7665('0x61')]['id']},'transaction':_0x442d83});});})['then'](function(){_0x2c125f[_0x7665('0x7e')](function(_0x6949dc){socket[_0x7665('0x7f')](_0x7665('0x80'),{'UserId':_0x6949dc['id'],'ChatQueueId':_0x3a5993['id']});});});});});}})[_0x7665('0x39')](respondWithStatusCode(_0x1986cf,null))[_0x7665('0x2b')](handleError(_0x1986cf,null));};exports[_0x7665('0x81')]=function(_0x3992ff,_0x3c7306,_0x132170){return db[_0x7665('0x75')]['findAll']({'where':{'id':_0x3992ff[_0x7665('0x46')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7665('0x77'),'attributes':['id'],'raw':!![]}]})[_0x7665('0x39')](handleEntityNotFound(_0x3c7306,null))[_0x7665('0x39')](function(_0x3817e8){var _0x2c4204=_[_0x7665('0x40')](_0x3817e8,'id');var _0x2b36c0=[];var _0xe6c095=[];var _0x23a3a9=squel[_0x7665('0x82')]();_0x23a3a9[_0x7665('0x83')]('tq.TeamId')[_0x7665('0x84')](_0x7665('0x85'),'tq')[_0x7665('0x86')](_0x7665('0x87'),'ut',_0x7665('0x88'))['where']('ChatQueueId\x20=\x20?',_0x3992ff[_0x7665('0x61')]['id']);for(var _0x5a4701=0x0;_0x5a4701<_0x3817e8[_0x7665('0x4a')];_0x5a4701+=0x1){let _0x1971fc=_0x3817e8[_0x5a4701];for(var _0x5a9413=0x0;_0x5a9413<_0x1971fc[_0x7665('0x77')][_0x7665('0x4a')];_0x5a9413+=0x1){let _0x523d9b=_0x1971fc[_0x7665('0x77')][_0x5a9413];var _0x275a1e=_0x23a3a9[_0x7665('0x89')]();_0x275a1e[_0x7665('0x4d')](_0x7665('0x8a'),_0x523d9b['id']);_0xe6c095[_0x7665('0x8b')](db['sequelize'][_0x7665('0x46')](_0x275a1e[_0x7665('0x8c')](),{'type':db[_0x7665('0x7a')]['QueryTypes'][_0x7665('0x8d')]})[_0x7665('0x39')](function(_0x4f20f4){if(_0x4f20f4[_0x7665('0x4a')]===0x1){return _0x523d9b['id'];}else{var _0x182657=_[_0x7665('0x8e')](_['map'](_0x4f20f4,'TeamId'),function(_0x530132){return _[_0x7665('0x8f')](_0x2c4204,_0x530132);});if(_0x182657){return _0x523d9b['id'];}}}));}}return BPromise[_0x7665('0x90')](_0xe6c095)[_0x7665('0x39')](function(_0x3f2e83){_0x2b36c0=_(_0x2b36c0)[_0x7665('0x91')](_0x3f2e83)[_0x7665('0x92')]()['value']();return db[_0x7665('0x41')][_0x7665('0x57')]({'where':{'id':_0x3992ff['params']['id']}})[_0x7665('0x39')](function(_0xde8c1){return db['sequelize']['transaction'](function(_0x2fbb83){return _0xde8c1[_0x7665('0x81')](_0x3992ff[_0x7665('0x46')][_0x7665('0x74')],{'transaction':_0x2fbb83})[_0x7665('0x39')](function(){if(!_['isEmpty'](_0x2b36c0)){return _0xde8c1['removeAgents'](_0x2b36c0,{'transaction':_0x2fbb83});}})[_0x7665('0x39')](function(){_0x2b36c0[_0x7665('0x7e')](function(_0x188c1a){socket['emit'](_0x7665('0x93'),{'UserId':_0x188c1a,'ChatQueueId':_0xde8c1['id']});});});});});});})[_0x7665('0x39')](respondWithStatusCode(_0x3c7306,null))[_0x7665('0x2b')](handleError(_0x3c7306,null));};exports[_0x7665('0x94')]=function(_0x940d64,_0x5831af,_0x55fc37){return db[_0x7665('0x41')]['find']({'where':{'id':_0x940d64[_0x7665('0x61')]['id']}})[_0x7665('0x39')](handleEntityNotFound(_0x5831af,null))[_0x7665('0x39')](function(_0x215037){if(_0x215037){return _0x215037[_0x7665('0x94')](_0x940d64['body'][_0x7665('0x74')],_[_0x7665('0x95')](_0x940d64[_0x7665('0x59')],[_0x7665('0x74'),'id'])||{})[_0x7665('0x96')](function(_0x1d8394){for(var _0x51da59=0x0;_0x51da59<_0x940d64['body']['ids'][_0x7665('0x4a')];_0x51da59+=0x1){socket[_0x7665('0x7f')](_0x7665('0x80'),{'UserId':_0x940d64[_0x7665('0x59')][_0x7665('0x74')][_0x51da59],'ChatQueueId':_0x940d64[_0x7665('0x61')]['id']});}return _0x1d8394;});}})[_0x7665('0x39')](respondWithResult(_0x5831af,null))[_0x7665('0x2b')](handleError(_0x5831af,null));};exports[_0x7665('0x97')]=function(_0x168ff9,_0x3d25d8,_0x324a6f){return db[_0x7665('0x41')][_0x7665('0x57')]({'where':{'id':_0x168ff9[_0x7665('0x61')]['id']}})[_0x7665('0x39')](handleEntityNotFound(_0x3d25d8,null))[_0x7665('0x39')](function(_0x245c6d){if(_0x245c6d){return _0x245c6d[_0x7665('0x97')](_0x168ff9[_0x7665('0x46')][_0x7665('0x74')])[_0x7665('0x39')](function(){if(_[_0x7665('0x98')](_0x168ff9[_0x7665('0x46')][_0x7665('0x74')])){for(var _0x4d93ef=0x0;_0x4d93ef<_0x168ff9['query']['ids']['length'];_0x4d93ef+=0x1){socket[_0x7665('0x7f')](_0x7665('0x93'),{'UserId':Number(_0x168ff9[_0x7665('0x46')][_0x7665('0x74')][_0x4d93ef]),'ChatQueueId':Number(_0x168ff9['params']['id'])});}}else{socket[_0x7665('0x7f')](_0x7665('0x93'),{'UserId':Number(_0x168ff9[_0x7665('0x46')]['ids']),'ChatQueueId':Number(_0x168ff9[_0x7665('0x61')]['id'])});}});}})[_0x7665('0x39')](respondWithStatusCode(_0x3d25d8,null))[_0x7665('0x2b')](handleError(_0x3d25d8,null));};exports[_0x7665('0x99')]=function(_0x3d46e1,_0x1776d5,_0x2a42a2){var _0x5469b0={};var _0x4cb2b8={};var _0x5ec428;var _0x4f0c08;return db[_0x7665('0x41')][_0x7665('0x64')]({'where':{'id':_0x3d46e1[_0x7665('0x61')]['id']}})[_0x7665('0x39')](handleEntityNotFound(_0x1776d5,null))[_0x7665('0x39')](function(_0x212273){if(_0x212273){_0x5ec428=_0x212273;_0x4cb2b8[_0x7665('0x44')]=_[_0x7665('0x45')](db['User'][_0x7665('0x42')]);_0x4cb2b8[_0x7665('0x46')]=_[_0x7665('0x45')](_0x3d46e1[_0x7665('0x46')]);_0x4cb2b8[_0x7665('0x4e')]=_[_0x7665('0x47')](_0x4cb2b8[_0x7665('0x44')],_0x4cb2b8[_0x7665('0x46')]);_0x5469b0[_0x7665('0x48')]=_[_0x7665('0x47')](_0x4cb2b8[_0x7665('0x44')],qs['fields'](_0x3d46e1[_0x7665('0x46')][_0x7665('0x49')]));_0x5469b0[_0x7665('0x48')]=_0x5469b0[_0x7665('0x48')]['length']?_0x5469b0[_0x7665('0x48')]:_0x4cb2b8['model'];_0x5469b0[_0x7665('0x65')]=qs[_0x7665('0x4c')](_0x3d46e1[_0x7665('0x46')][_0x7665('0x4c')]);_0x5469b0[_0x7665('0x4d')]=qs[_0x7665('0x4e')](_[_0x7665('0x66')](_0x3d46e1[_0x7665('0x46')],_0x4cb2b8[_0x7665('0x4e')]));if(_0x3d46e1[_0x7665('0x46')]['filter']){_0x5469b0[_0x7665('0x4d')]=_[_0x7665('0x4f')](_0x5469b0['where'],{'$or':_[_0x7665('0x40')](_0x5469b0['attributes'],function(_0x7b321b){var _0x16c86f={};_0x16c86f[_0x7b321b]={'$like':'%'+_0x3d46e1[_0x7665('0x46')][_0x7665('0x52')]+'%'};return _0x16c86f;})});}_0x5469b0=_['merge']({},_0x5469b0,_0x3d46e1[_0x7665('0x53')]);return _0x5ec428[_0x7665('0x99')](_0x5469b0);}})[_0x7665('0x39')](function(_0x208965){if(_0x208965){_0x4f0c08=_0x208965[_0x7665('0x4a')];if(!_0x3d46e1['query'][_0x7665('0x4b')](_0x7665('0x72'))){_0x5469b0[_0x7665('0x32')]=qs[_0x7665('0x32')](_0x3d46e1[_0x7665('0x46')][_0x7665('0x32')]);_0x5469b0[_0x7665('0x31')]=qs[_0x7665('0x31')](_0x3d46e1[_0x7665('0x46')][_0x7665('0x31')]);}return _0x5ec428[_0x7665('0x99')](_0x5469b0);}})[_0x7665('0x39')](function(_0x8e1a92){if(_0x8e1a92){return _0x8e1a92?{'count':_0x4f0c08,'rows':_0x8e1a92}:null;}})[_0x7665('0x39')](respondWithResult(_0x1776d5,null))[_0x7665('0x2b')](handleError(_0x1776d5,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index d03b3c4..76c911d 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(_0x4f26ce,_0x31a151){var _0x37ff6d=function(_0x257217){while(--_0x257217){_0x4f26ce['push'](_0x4f26ce['shift']());}};_0x37ff6d(++_0x31a151);}(_0x5f2f,0x73));var _0xf5f2=function(_0x55b18a,_0x67b547){_0x55b18a=_0x55b18a-0x0;var _0x2172e5=_0x5f2f[_0x55b18a];return _0x2172e5;};'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 _0xb10b=['hasOwnProperty','hook','events','ChatQueue','setMaxListeners','save','remove','emit'];(function(_0x356594,_0x2b8657){var _0x3c47cd=function(_0x3f3e90){while(--_0x3f3e90){_0x356594['push'](_0x356594['shift']());}};_0x3c47cd(++_0x2b8657);}(_0xb10b,0x12a));var _0xbb10=function(_0x5aabcb,_0x219fbd){_0x5aabcb=_0x5aabcb-0x0;var _0x4b6e71=_0xb10b[_0x5aabcb];return _0x4b6e71;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xbb10('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){ChatQueueEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);ChatQueueEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];ChatQueue[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index e6dbf25..f5febdd 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 _0x01ce=['bluebird','request-promise','path','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','lodash','util','../../config/logger','api','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x01ce,0x140));var _0xe01c=function(_0x9cef10,_0x3149d2){_0x9cef10=_0x9cef10-0x0;var _0x467b96=_0x01ce[_0x9cef10];return _0x467b96;};'use strict';var _=require(_0xe01c('0x0'));var util=require(_0xe01c('0x1'));var logger=require(_0xe01c('0x2'))(_0xe01c('0x3'));var moment=require(_0xe01c('0x4'));var BPromise=require(_0xe01c('0x5'));var rp=require(_0xe01c('0x6'));var fs=require('fs');var path=require(_0xe01c('0x7'));var rimraf=require('rimraf');var config=require(_0xe01c('0x8'));var attributes=require(_0xe01c('0x9'));module[_0xe01c('0xa')]=function(_0x57d660,_0x3e1d3d){return _0x57d660[_0xe01c('0xb')](_0xe01c('0xc'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b46=['../../config/environment','ChatQueue','chat_queues','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x5b46,0x99));var _0x65b4=function(_0x4dbbda,_0x13ebb9){_0x4dbbda=_0x4dbbda-0x0;var _0x279353=_0x5b46[_0x4dbbda];return _0x279353;};'use strict';var _=require(_0x65b4('0x0'));var util=require('util');var logger=require(_0x65b4('0x1'))('api');var moment=require(_0x65b4('0x2'));var BPromise=require(_0x65b4('0x3'));var rp=require(_0x65b4('0x4'));var fs=require('fs');var path=require(_0x65b4('0x5'));var rimraf=require(_0x65b4('0x6'));var config=require(_0x65b4('0x7'));var attributes=require('./chatQueue.attributes');module['exports']=function(_0x33376d,_0x538dae){return _0x33376d['define'](_0x65b4('0x8'),attributes,{'tableName':_0x65b4('0x9'),'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 3c4bec0..eec5f4a 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 _0xb4e2=['register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','limit','map','include','model','attributes','ShowChatQueue','find','where','stringify','lodash','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket'];(function(_0xf5ee60,_0x492a07){var _0x30327a=function(_0x3bc609){while(--_0x3bc609){_0xf5ee60['push'](_0xf5ee60['shift']());}};_0x30327a(++_0x492a07);}(_0xb4e2,0x1aa));var _0x2b4e=function(_0x446ea7,_0x296674){_0x446ea7=_0x446ea7-0x0;var _0x90ccf5=_0xb4e2[_0x446ea7];return _0x90ccf5;};'use strict';var _=require(_0x2b4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2b4e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2b4e('0x2'));var logger=require(_0x2b4e('0x3'))(_0x2b4e('0x4'));var config=require(_0x2b4e('0x5'));var jayson=require(_0x2b4e('0x6'));var client=jayson[_0x2b4e('0x7')][_0x2b4e('0x8')]({'port':0x232a});config['redis']=_[_0x2b4e('0x9')](config[_0x2b4e('0xa')],{'host':_0x2b4e('0xb'),'port':0x18eb});var socket=require(_0x2b4e('0xc'))(new Redis(config[_0x2b4e('0xa')]));require(_0x2b4e('0xd'))[_0x2b4e('0xe')](socket);function respondWithRpcPromise(_0x14bb06,_0xfaa7ec,_0x3015e6){return new BPromise(function(_0x16b4ae,_0xa05d7e){return client[_0x2b4e('0xf')](_0x14bb06,_0x3015e6)[_0x2b4e('0x10')](function(_0x493d19){logger[_0x2b4e('0x11')](_0x2b4e('0x12'),_0xfaa7ec,_0x2b4e('0x13'));logger[_0x2b4e('0x14')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0xfaa7ec,_0x2b4e('0x13'),JSON['stringify'](_0x493d19));if(_0x493d19[_0x2b4e('0x15')]){if(_0x493d19[_0x2b4e('0x15')][_0x2b4e('0x16')]===0x1f4){logger[_0x2b4e('0x15')](_0x2b4e('0x12'),_0xfaa7ec,_0x493d19[_0x2b4e('0x15')]['message']);return _0xa05d7e(_0x493d19[_0x2b4e('0x15')][_0x2b4e('0x17')]);}logger[_0x2b4e('0x15')]('ChatQueue,\x20%s,\x20%s',_0xfaa7ec,_0x493d19[_0x2b4e('0x15')][_0x2b4e('0x17')]);return _0x16b4ae(_0x493d19['error'][_0x2b4e('0x17')]);}else{logger['info'](_0x2b4e('0x12'),_0xfaa7ec,_0x2b4e('0x13'));_0x16b4ae(_0x493d19[_0x2b4e('0x18')][_0x2b4e('0x17')]);}})[_0x2b4e('0x19')](function(_0x36d927){logger[_0x2b4e('0x15')](_0x2b4e('0x12'),_0xfaa7ec,_0x36d927);_0xa05d7e(_0x36d927);});});}exports[_0x2b4e('0x1a')]=function(_0x4c8110){var _0x23ca97=this;return new Promise(function(_0x5c920a,_0x4293ae){return db[_0x2b4e('0x1b')][_0x2b4e('0x1c')]({'raw':_0x4c8110[_0x2b4e('0x1d')]?_0x4c8110['options'][_0x2b4e('0x1e')]===undefined?!![]:![]:!![],'where':_0x4c8110[_0x2b4e('0x1d')]?_0x4c8110[_0x2b4e('0x1d')]['where']||null:null,'attributes':_0x4c8110[_0x2b4e('0x1d')]?_0x4c8110[_0x2b4e('0x1d')]['attributes']||null:null,'limit':_0x4c8110[_0x2b4e('0x1d')]?_0x4c8110['options'][_0x2b4e('0x1f')]||null:null,'include':_0x4c8110[_0x2b4e('0x1d')]?_0x4c8110['options']['include']?_[_0x2b4e('0x20')](_0x4c8110[_0x2b4e('0x1d')][_0x2b4e('0x21')],function(_0x47b641){return{'model':db[_0x47b641[_0x2b4e('0x22')]],'as':_0x47b641['as'],'attributes':_0x47b641[_0x2b4e('0x23')],'include':_0x47b641[_0x2b4e('0x21')]?_[_0x2b4e('0x20')](_0x47b641[_0x2b4e('0x21')],function(_0x435926){return{'model':db[_0x435926[_0x2b4e('0x22')]],'as':_0x435926['as'],'attributes':_0x435926[_0x2b4e('0x23')],'include':_0x435926[_0x2b4e('0x21')]?_['map'](_0x435926[_0x2b4e('0x21')],function(_0x2776fb){return{'model':db[_0x2776fb[_0x2b4e('0x22')]],'as':_0x2776fb['as'],'attributes':_0x2776fb[_0x2b4e('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x49d4f5){logger['info'](_0x2b4e('0x1a'),_0x4c8110);logger[_0x2b4e('0x14')](_0x2b4e('0x1a'),_0x4c8110,JSON['stringify'](_0x49d4f5));_0x5c920a(_0x49d4f5);})[_0x2b4e('0x19')](function(_0x5771d7){logger['error'](_0x2b4e('0x1a'),_0x5771d7[_0x2b4e('0x17')],_0x4c8110);_0x4293ae(_0x23ca97[_0x2b4e('0x15')](0x1f4,_0x5771d7[_0x2b4e('0x17')]));});});};exports[_0x2b4e('0x24')]=function(_0x38a067){var _0x473629=this;return new Promise(function(_0x5f2888,_0x159ec6){return db[_0x2b4e('0x1b')][_0x2b4e('0x25')]({'raw':_0x38a067[_0x2b4e('0x1d')]?_0x38a067[_0x2b4e('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x38a067[_0x2b4e('0x1d')]?_0x38a067[_0x2b4e('0x1d')][_0x2b4e('0x26')]||null:null,'attributes':_0x38a067[_0x2b4e('0x1d')]?_0x38a067['options'][_0x2b4e('0x23')]||null:null,'include':_0x38a067[_0x2b4e('0x1d')]?_0x38a067['options']['include']?_[_0x2b4e('0x20')](_0x38a067[_0x2b4e('0x1d')][_0x2b4e('0x21')],function(_0x491c27){return{'model':db[_0x491c27[_0x2b4e('0x22')]],'as':_0x491c27['as'],'attributes':_0x491c27[_0x2b4e('0x23')],'include':_0x491c27[_0x2b4e('0x21')]?_[_0x2b4e('0x20')](_0x491c27['include'],function(_0x584d3a){return{'model':db[_0x584d3a[_0x2b4e('0x22')]],'as':_0x584d3a['as'],'attributes':_0x584d3a[_0x2b4e('0x23')],'include':_0x584d3a[_0x2b4e('0x21')]?_[_0x2b4e('0x20')](_0x584d3a[_0x2b4e('0x21')],function(_0x18ccc5){return{'model':db[_0x18ccc5[_0x2b4e('0x22')]],'as':_0x18ccc5['as'],'attributes':_0x18ccc5['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5a801d){logger[_0x2b4e('0x11')](_0x2b4e('0x24'),_0x38a067);logger[_0x2b4e('0x14')](_0x2b4e('0x24'),_0x38a067,JSON[_0x2b4e('0x27')](_0x5a801d));_0x5f2888(_0x5a801d);})[_0x2b4e('0x19')](function(_0x5b60ff){logger['error'](_0x2b4e('0x24'),_0x5b60ff['message'],_0x38a067);_0x159ec6(_0x473629[_0x2b4e('0x15')](0x1f4,_0x5b60ff[_0x2b4e('0x17')]));});});}; \ No newline at end of file +var _0xcf37=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch','GetChatQueue','ChatQueue','findAll','options','attributes','include','model','map','stringify','ShowChatQueue','raw','where','util','moment'];(function(_0x3e8d8c,_0x1d4fdc){var _0x390bed=function(_0x56097e){while(--_0x56097e){_0x3e8d8c['push'](_0x3e8d8c['shift']());}};_0x390bed(++_0x1d4fdc);}(_0xcf37,0xdc));var _0x7cf3=function(_0x116074,_0x5387fb){_0x116074=_0x116074-0x0;var _0x50eb48=_0xcf37[_0x116074];return _0x50eb48;};'use strict';var _=require('lodash');var util=require(_0x7cf3('0x0'));var moment=require(_0x7cf3('0x1'));var BPromise=require(_0x7cf3('0x2'));var rs=require(_0x7cf3('0x3'));var fs=require('fs');var Redis=require(_0x7cf3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7cf3('0x5'));var logger=require(_0x7cf3('0x6'))(_0x7cf3('0x7'));var config=require(_0x7cf3('0x8'));var jayson=require(_0x7cf3('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x7cf3('0xa')],{'host':_0x7cf3('0xb'),'port':0x18eb});var socket=require(_0x7cf3('0xc'))(new Redis(config['redis']));require(_0x7cf3('0xd'))[_0x7cf3('0xe')](socket);function respondWithRpcPromise(_0x242ffc,_0x2acdde,_0x364a7a){return new BPromise(function(_0x23fe46,_0x53212b){return client[_0x7cf3('0xf')](_0x242ffc,_0x364a7a)[_0x7cf3('0x10')](function(_0x3e9ec1){logger[_0x7cf3('0x11')](_0x7cf3('0x12'),_0x2acdde,'request\x20sent');logger[_0x7cf3('0x13')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x2acdde,_0x7cf3('0x14'),JSON['stringify'](_0x3e9ec1));if(_0x3e9ec1[_0x7cf3('0x15')]){if(_0x3e9ec1[_0x7cf3('0x15')]['code']===0x1f4){logger[_0x7cf3('0x15')](_0x7cf3('0x12'),_0x2acdde,_0x3e9ec1[_0x7cf3('0x15')][_0x7cf3('0x16')]);return _0x53212b(_0x3e9ec1['error'][_0x7cf3('0x16')]);}logger['error'](_0x7cf3('0x12'),_0x2acdde,_0x3e9ec1[_0x7cf3('0x15')][_0x7cf3('0x16')]);return _0x23fe46(_0x3e9ec1[_0x7cf3('0x15')][_0x7cf3('0x16')]);}else{logger[_0x7cf3('0x11')]('ChatQueue,\x20%s,\x20%s',_0x2acdde,'request\x20sent');_0x23fe46(_0x3e9ec1[_0x7cf3('0x17')][_0x7cf3('0x16')]);}})[_0x7cf3('0x18')](function(_0x59cbd3){logger[_0x7cf3('0x15')](_0x7cf3('0x12'),_0x2acdde,_0x59cbd3);_0x53212b(_0x59cbd3);});});}exports[_0x7cf3('0x19')]=function(_0x27ef8d){var _0x369e30=this;return new Promise(function(_0x50cea8,_0x2175c1){return db[_0x7cf3('0x1a')][_0x7cf3('0x1b')]({'raw':_0x27ef8d[_0x7cf3('0x1c')]?_0x27ef8d[_0x7cf3('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x27ef8d[_0x7cf3('0x1c')]?_0x27ef8d[_0x7cf3('0x1c')]['where']||null:null,'attributes':_0x27ef8d['options']?_0x27ef8d['options'][_0x7cf3('0x1d')]||null:null,'limit':_0x27ef8d['options']?_0x27ef8d[_0x7cf3('0x1c')]['limit']||null:null,'include':_0x27ef8d[_0x7cf3('0x1c')]?_0x27ef8d['options'][_0x7cf3('0x1e')]?_['map'](_0x27ef8d[_0x7cf3('0x1c')][_0x7cf3('0x1e')],function(_0x146664){return{'model':db[_0x146664[_0x7cf3('0x1f')]],'as':_0x146664['as'],'attributes':_0x146664[_0x7cf3('0x1d')],'include':_0x146664[_0x7cf3('0x1e')]?_[_0x7cf3('0x20')](_0x146664[_0x7cf3('0x1e')],function(_0x835dd){return{'model':db[_0x835dd['model']],'as':_0x835dd['as'],'attributes':_0x835dd['attributes'],'include':_0x835dd[_0x7cf3('0x1e')]?_[_0x7cf3('0x20')](_0x835dd[_0x7cf3('0x1e')],function(_0x5b8732){return{'model':db[_0x5b8732[_0x7cf3('0x1f')]],'as':_0x5b8732['as'],'attributes':_0x5b8732[_0x7cf3('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x142671){logger[_0x7cf3('0x11')](_0x7cf3('0x19'),_0x27ef8d);logger[_0x7cf3('0x13')](_0x7cf3('0x19'),_0x27ef8d,JSON[_0x7cf3('0x21')](_0x142671));_0x50cea8(_0x142671);})[_0x7cf3('0x18')](function(_0x422582){logger[_0x7cf3('0x15')](_0x7cf3('0x19'),_0x422582['message'],_0x27ef8d);_0x2175c1(_0x369e30[_0x7cf3('0x15')](0x1f4,_0x422582['message']));});});};exports[_0x7cf3('0x22')]=function(_0x7fc6c0){var _0x35f397=this;return new Promise(function(_0x4a5e8a,_0x30bbf5){return db[_0x7cf3('0x1a')]['find']({'raw':_0x7fc6c0[_0x7cf3('0x1c')]?_0x7fc6c0[_0x7cf3('0x1c')][_0x7cf3('0x23')]===undefined?!![]:![]:!![],'where':_0x7fc6c0[_0x7cf3('0x1c')]?_0x7fc6c0[_0x7cf3('0x1c')][_0x7cf3('0x24')]||null:null,'attributes':_0x7fc6c0['options']?_0x7fc6c0[_0x7cf3('0x1c')][_0x7cf3('0x1d')]||null:null,'include':_0x7fc6c0[_0x7cf3('0x1c')]?_0x7fc6c0[_0x7cf3('0x1c')]['include']?_[_0x7cf3('0x20')](_0x7fc6c0[_0x7cf3('0x1c')][_0x7cf3('0x1e')],function(_0x1fc74f){return{'model':db[_0x1fc74f[_0x7cf3('0x1f')]],'as':_0x1fc74f['as'],'attributes':_0x1fc74f[_0x7cf3('0x1d')],'include':_0x1fc74f[_0x7cf3('0x1e')]?_[_0x7cf3('0x20')](_0x1fc74f[_0x7cf3('0x1e')],function(_0x32ea10){return{'model':db[_0x32ea10['model']],'as':_0x32ea10['as'],'attributes':_0x32ea10['attributes'],'include':_0x32ea10['include']?_[_0x7cf3('0x20')](_0x32ea10[_0x7cf3('0x1e')],function(_0xb63c82){return{'model':db[_0xb63c82[_0x7cf3('0x1f')]],'as':_0xb63c82['as'],'attributes':_0xb63c82[_0x7cf3('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7cf3('0x10')](function(_0x2c7f87){logger[_0x7cf3('0x11')](_0x7cf3('0x22'),_0x7fc6c0);logger['debug']('ShowChatQueue',_0x7fc6c0,JSON[_0x7cf3('0x21')](_0x2c7f87));_0x4a5e8a(_0x2c7f87);})['catch'](function(_0x487e73){logger[_0x7cf3('0x15')]('ShowChatQueue',_0x487e73[_0x7cf3('0x16')],_0x7fc6c0);_0x30bbf5(_0x35f397[_0x7cf3('0x15')](0x1f4,_0x487e73['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index b251cab..df85484 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 _0x0b0e=['chatQueue:','./chatQueue.events','remove','emit','removeListener','register'];(function(_0x165b75,_0x55d77c){var _0x28c0da=function(_0x2c3ad1){while(--_0x2c3ad1){_0x165b75['push'](_0x165b75['shift']());}};_0x28c0da(++_0x55d77c);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3bab09,_0x217c29){_0x3bab09=_0x3bab09-0x0;var _0x164376=_0x0b0e[_0x3bab09];return _0x164376;};'use strict';var ChatQueueEvents=require(_0xe0b0('0x0'));var events=['save',_0xe0b0('0x1'),'update'];function createListener(_0x7e5a8a,_0xdf715e){return function(_0x3b5e2b){_0xdf715e[_0xe0b0('0x2')](_0x7e5a8a,_0x3b5e2b);};}function removeListener(_0x28040c,_0x38a058){return function(){ChatQueueEvents[_0xe0b0('0x3')](_0x28040c,_0x38a058);};}exports[_0xe0b0('0x4')]=function(_0x30e20d){for(var _0x28e40f=0x0,_0x219b1c=events['length'];_0x28e40f<_0x219b1c;_0x28e40f++){var _0x50be7f=events[_0x28e40f];var _0x11effc=createListener(_0xe0b0('0x5')+_0x50be7f,_0x30e20d);ChatQueueEvents['on'](_0x50be7f,_0x11effc);}}; \ No newline at end of file +var _0x0b0e=['chatQueue:','./chatQueue.events','remove','emit','removeListener','register'];(function(_0x4e198c,_0x243476){var _0x1e2ef2=function(_0x524934){while(--_0x524934){_0x4e198c['push'](_0x4e198c['shift']());}};_0x1e2ef2(++_0x243476);}(_0x0b0e,0x187));var _0xe0b0=function(_0x5734e1,_0x3e1d75){_0x5734e1=_0x5734e1-0x0;var _0x22c784=_0x0b0e[_0x5734e1];return _0x22c784;};'use strict';var ChatQueueEvents=require(_0xe0b0('0x0'));var events=['save',_0xe0b0('0x1'),'update'];function createListener(_0x7e5a8a,_0xdf715e){return function(_0x3b5e2b){_0xdf715e[_0xe0b0('0x2')](_0x7e5a8a,_0x3b5e2b);};}function removeListener(_0x28040c,_0x38a058){return function(){ChatQueueEvents[_0xe0b0('0x3')](_0x28040c,_0x38a058);};}exports[_0xe0b0('0x4')]=function(_0x30e20d){for(var _0x28e40f=0x0,_0x219b1c=events['length'];_0x28e40f<_0x219b1c;_0x28e40f++){var _0x50be7f=events[_0x28e40f];var _0x11effc=createListener(_0xe0b0('0x5')+_0x50be7f,_0x30e20d);ChatQueueEvents['on'](_0x50be7f,_0x11effc);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index f5f340e..8b1a0d7 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 _0xef15=['./chatQueue.controller','get','/describe','/:id','isAuthenticated','show','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','destroy','delete','removeTeams','removeAgents','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xb57dfe,_0xc39ee5){var _0x48e659=function(_0x5933d9){while(--_0x5933d9){_0xb57dfe['push'](_0xb57dfe['shift']());}};_0x48e659(++_0xc39ee5);}(_0xef15,0x1c2));var _0x5ef1=function(_0x3c5e8b,_0x17513d){_0x3c5e8b=_0x3c5e8b-0x0;var _0x1784b6=_0xef15[_0x3c5e8b];return _0x1784b6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5ef1('0x0'));var timeout=require(_0x5ef1('0x1'));var express=require(_0x5ef1('0x2'));var router=express['Router']();var auth=require(_0x5ef1('0x3'));var interaction=require(_0x5ef1('0x4'));var config=require(_0x5ef1('0x5'));var controller=require(_0x5ef1('0x6'));router[_0x5ef1('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5ef1('0x7')](_0x5ef1('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0x5ef1('0x7')](_0x5ef1('0x9'),auth[_0x5ef1('0xa')](),controller[_0x5ef1('0xb')]);router[_0x5ef1('0x7')]('/:id/members',auth[_0x5ef1('0xa')](),controller['getMembers']);router[_0x5ef1('0x7')](_0x5ef1('0xc'),auth[_0x5ef1('0xa')](),controller[_0x5ef1('0xd')]);router[_0x5ef1('0x7')](_0x5ef1('0xe'),auth[_0x5ef1('0xa')](),controller[_0x5ef1('0xf')]);router[_0x5ef1('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5ef1('0x10')](_0x5ef1('0xc'),auth['isAuthenticated'](),controller[_0x5ef1('0x11')]);router['post'](_0x5ef1('0xe'),auth[_0x5ef1('0xa')](),controller[_0x5ef1('0x12')]);router[_0x5ef1('0x13')]('/:id',auth[_0x5ef1('0xa')](),controller['update']);router['delete']('/:id',auth[_0x5ef1('0xa')](),controller[_0x5ef1('0x14')]);router[_0x5ef1('0x15')]('/:id/teams',auth[_0x5ef1('0xa')](),controller[_0x5ef1('0x16')]);router[_0x5ef1('0x15')](_0x5ef1('0xe'),auth[_0x5ef1('0xa')](),controller[_0x5ef1('0x17')]);module['exports']=router; \ No newline at end of file +var _0x0965=['getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','index','get','/describe','isAuthenticated','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users'];(function(_0x2be91d,_0x595d2d){var _0xb3a0a7=function(_0x5b1532){while(--_0x5b1532){_0x2be91d['push'](_0x2be91d['shift']());}};_0xb3a0a7(++_0x595d2d);}(_0x0965,0x111));var _0x5096=function(_0x510be5,_0x268fba){_0x510be5=_0x510be5-0x0;var _0x2a32ae=_0x0965[_0x510be5];return _0x2a32ae;};'use strict';var multer=require(_0x5096('0x0'));var util=require('util');var path=require(_0x5096('0x1'));var timeout=require(_0x5096('0x2'));var express=require(_0x5096('0x3'));var router=express[_0x5096('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x5096('0x5'));var config=require('../../config/environment');var controller=require('./chatQueue.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x5096('0x6')]);router[_0x5096('0x7')](_0x5096('0x8'),auth[_0x5096('0x9')](),controller[_0x5096('0xa')]);router[_0x5096('0x7')](_0x5096('0xb'),auth[_0x5096('0x9')](),controller['show']);router['get'](_0x5096('0xc'),auth[_0x5096('0x9')](),controller[_0x5096('0xd')]);router[_0x5096('0x7')](_0x5096('0xe'),auth[_0x5096('0x9')](),controller[_0x5096('0xf')]);router[_0x5096('0x7')](_0x5096('0x10'),auth[_0x5096('0x9')](),controller[_0x5096('0x11')]);router[_0x5096('0x12')]('/',auth['isAuthenticated'](),controller[_0x5096('0x13')]);router['post'](_0x5096('0xe'),auth['isAuthenticated'](),controller[_0x5096('0x14')]);router[_0x5096('0x12')](_0x5096('0x10'),auth[_0x5096('0x9')](),controller[_0x5096('0x15')]);router[_0x5096('0x16')](_0x5096('0xb'),auth[_0x5096('0x9')](),controller[_0x5096('0x17')]);router[_0x5096('0x18')]('/:id',auth[_0x5096('0x9')](),controller[_0x5096('0x19')]);router[_0x5096('0x18')](_0x5096('0xe'),auth['isAuthenticated'](),controller[_0x5096('0x1a')]);router[_0x5096('0x18')](_0x5096('0x10'),auth[_0x5096('0x9')](),controller[_0x5096('0x1b')]);module[_0x5096('0x1c')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 30abd33..183c5bf 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 _0x915f=['moment','sequelize','exports','STRING','DATE'];(function(_0x1fbf8d,_0x43874c){var _0x50c7e4=function(_0x134b53){while(--_0x134b53){_0x1fbf8d['push'](_0x1fbf8d['shift']());}};_0x50c7e4(++_0x43874c);}(_0x915f,0xb4));var _0xf915=function(_0x1bf685,_0x2cb26e){_0x1bf685=_0x1bf685-0x0;var _0x1b1164=_0x915f[_0x1bf685];return _0x1b1164;};'use strict';var moment=require(_0xf915('0x0'));var Sequelize=require(_0xf915('0x1'));module[_0xf915('0x2')]={'uniqueid':{'type':Sequelize[_0xf915('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xf915('0x4')]},'leaveAt':{'type':Sequelize[_0xf915('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xf915('0x4')]},'reason':{'type':Sequelize[_0xf915('0x3')]}}; \ No newline at end of file +var _0xf76d=['sequelize','STRING','DATE','moment'];(function(_0x723288,_0x361804){var _0x45fecf=function(_0x39fbe1){while(--_0x39fbe1){_0x723288['push'](_0x723288['shift']());}};_0x45fecf(++_0x361804);}(_0xf76d,0x18f));var _0xdf76=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0xf76d[_0x53cf8e];return _0x459197;};'use strict';var moment=require(_0xdf76('0x0'));var Sequelize=require(_0xdf76('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xdf76('0x2')]},'joinAt':{'type':Sequelize[_0xdf76('0x3')]},'leaveAt':{'type':Sequelize[_0xdf76('0x3')]},'acceptAt':{'type':Sequelize[_0xdf76('0x3')]},'exitAt':{'type':Sequelize[_0xdf76('0x3')]},'reason':{'type':Sequelize[_0xdf76('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 2b4e2b8..9a51bff 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 _0x571b=['query','keys','intersection','model','attributes','length','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','include','ChatQueueReport','findAll','rows','catch','show','params','rawAttributes','fields','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','reject','save','update','then','error','stack','name','send','index','fieldName','type','key','map'];(function(_0x45a54f,_0x176e36){var _0x5243d8=function(_0xa9788){while(--_0xa9788){_0x45a54f['push'](_0x45a54f['shift']());}};_0x5243d8(++_0x176e36);}(_0x571b,0xfc));var _0xb571=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x571b[_0x4c12ec];return _0x3ae42c;};'use strict';var pdf=require(_0xb571('0x0'));var emlformat=require(_0xb571('0x1'));var rimraf=require(_0xb571('0x2'));var zipdir=require(_0xb571('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb571('0x4'));var moment=require('moment');var BPromise=require(_0xb571('0x5'));var Mustache=require(_0xb571('0x6'));var util=require('util');var path=require(_0xb571('0x7'));var sox=require(_0xb571('0x8'));var csv=require(_0xb571('0x9'));var ejs=require(_0xb571('0xa'));var fs=require('fs');var _=require(_0xb571('0xb'));var squel=require(_0xb571('0xc'));var crypto=require(_0xb571('0xd'));var jsforce=require(_0xb571('0xe'));var deskjs=require(_0xb571('0xf'));var toCsv=require(_0xb571('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb571('0x10'));var authService=require(_0xb571('0x11'));var qs=require(_0xb571('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb571('0x13'))(_0xb571('0x14'));var utils=require(_0xb571('0x15'));var config=require(_0xb571('0x16'));var db=require(_0xb571('0x17'))['db'];function respondWithStatusCode(_0xd70880,_0x514f6a){_0x514f6a=_0x514f6a||0xcc;return function(_0x3a4bf3){if(_0x3a4bf3){return _0xd70880[_0xb571('0x18')](_0x514f6a);}return _0xd70880[_0xb571('0x19')](_0x514f6a)[_0xb571('0x1a')]();};}function respondWithResult(_0x3e1ddf,_0x13cedd){_0x13cedd=_0x13cedd||0xc8;return function(_0x148663){if(_0x148663){return _0x3e1ddf[_0xb571('0x19')](_0x13cedd)[_0xb571('0x1b')](_0x148663);}};}function respondWithFilteredResult(_0x271895,_0x3ebfff){return function(_0x582586){if(_0x582586){var _0x5296cf=_0x582586['count'],_0x2f40c8=_0x3ebfff[_0xb571('0x1c')],_0x596902=_0x3ebfff['offset']+_0x3ebfff['limit'],_0x23d9bd;if(_0x596902>=_0x5296cf){_0x596902=_0x5296cf;_0x23d9bd=0xc8;}else{_0x23d9bd=0xce;}_0x271895['status'](_0x23d9bd);return _0x271895[_0xb571('0x1d')](_0xb571('0x1e'),_0x2f40c8+'-'+_0x596902+'/'+_0x5296cf)[_0xb571('0x1b')](_0x582586);}return null;};}function patchUpdates(_0x1fc7fe){return function(_0x17748d){try{jsonpatch['apply'](_0x17748d,_0x1fc7fe,!![]);}catch(_0x246a87){return BPromise[_0xb571('0x1f')](_0x246a87);}return _0x17748d[_0xb571('0x20')]();};}function saveUpdates(_0x4639c5,_0x2ef2e8){return function(_0x2bb944){if(_0x2bb944){return _0x2bb944[_0xb571('0x21')](_0x4639c5)[_0xb571('0x22')](function(_0x578ba3){return _0x578ba3;});}return null;};}function removeEntity(_0x1796c4,_0x1ccb34){return function(_0x57a90d){if(_0x57a90d){return _0x57a90d['destroy']()[_0xb571('0x22')](function(){_0x1796c4[_0xb571('0x19')](0xcc)[_0xb571('0x1a')]();});}};}function handleEntityNotFound(_0x591727,_0x2b5e20){return function(_0x4900cc){if(!_0x4900cc){_0x591727[_0xb571('0x18')](0x194);}return _0x4900cc;};}function handleError(_0x359af7,_0x3be6c3){_0x3be6c3=_0x3be6c3||0x1f4;return function(_0x5de4b5){logger[_0xb571('0x23')](_0x5de4b5[_0xb571('0x24')]);if(_0x5de4b5[_0xb571('0x25')]){delete _0x5de4b5[_0xb571('0x25')];}_0x359af7['status'](_0x3be6c3)[_0xb571('0x26')](_0x5de4b5);};}exports[_0xb571('0x27')]=function(_0xf131de,_0x5f2933){var _0x3a5baa={},_0x5b55eb={},_0x58818b={'count':0x0,'rows':[]};var _0x1c7e74=_['map'](db['ChatQueueReport']['rawAttributes'],function(_0xd5fd94){return{'name':_0xd5fd94[_0xb571('0x28')],'type':_0xd5fd94[_0xb571('0x29')][_0xb571('0x2a')]};});_0x5b55eb['model']=_[_0xb571('0x2b')](_0x1c7e74,_0xb571('0x25'));_0x5b55eb[_0xb571('0x2c')]=_[_0xb571('0x2d')](_0xf131de[_0xb571('0x2c')]);_0x5b55eb['filters']=_[_0xb571('0x2e')](_0x5b55eb[_0xb571('0x2f')],_0x5b55eb[_0xb571('0x2c')]);_0x3a5baa[_0xb571('0x30')]=_[_0xb571('0x2e')](_0x5b55eb[_0xb571('0x2f')],qs['fields'](_0xf131de['query']['fields']));_0x3a5baa[_0xb571('0x30')]=_0x3a5baa[_0xb571('0x30')][_0xb571('0x31')]?_0x3a5baa['attributes']:_0x5b55eb[_0xb571('0x2f')];if(!_0xf131de[_0xb571('0x2c')]['hasOwnProperty'](_0xb571('0x32'))){_0x3a5baa[_0xb571('0x33')]=qs[_0xb571('0x33')](_0xf131de[_0xb571('0x2c')][_0xb571('0x33')]);_0x3a5baa['offset']=qs[_0xb571('0x1c')](_0xf131de[_0xb571('0x2c')]['offset']);}_0x3a5baa[_0xb571('0x34')]=qs[_0xb571('0x35')](_0xf131de[_0xb571('0x2c')][_0xb571('0x35')]);_0x3a5baa[_0xb571('0x36')]=qs['filters'](_[_0xb571('0x37')](_0xf131de[_0xb571('0x2c')],_0x5b55eb['filters']));if(_0xf131de['query'][_0xb571('0x38')]){_0x3a5baa[_0xb571('0x36')]=_['merge'](_0x3a5baa[_0xb571('0x36')],{'$or':_[_0xb571('0x2b')](_0x1c7e74,function(_0x140e74){if(_0x140e74[_0xb571('0x29')]!==_0xb571('0x39')){var _0x4a1598={};_0x4a1598[_0x140e74['name']]={'$like':'%'+_0xf131de[_0xb571('0x2c')][_0xb571('0x38')]+'%'};return _0x4a1598;}})});}_0x3a5baa=_[_0xb571('0x3a')]({},_0x3a5baa,_0xf131de[_0xb571('0x3b')]);var _0x24a997={'where':_0x3a5baa[_0xb571('0x36')]};return db['ChatQueueReport'][_0xb571('0x3c')](_0x24a997)['then'](function(_0x191210){_0x58818b[_0xb571('0x3c')]=_0x191210;if(_0xf131de[_0xb571('0x2c')]['includeAll']){_0x3a5baa[_0xb571('0x3d')]=[{'all':!![]}];}return db[_0xb571('0x3e')][_0xb571('0x3f')](_0x3a5baa);})[_0xb571('0x22')](function(_0x139d7c){_0x58818b[_0xb571('0x40')]=_0x139d7c;return _0x58818b;})[_0xb571('0x22')](respondWithFilteredResult(_0x5f2933,_0x3a5baa))[_0xb571('0x41')](handleError(_0x5f2933,null));};exports[_0xb571('0x42')]=function(_0x241d47,_0x2e170f){var _0x5ae370={'raw':!![],'where':{'id':_0x241d47[_0xb571('0x43')]['id']}},_0x16f0c0={};_0x16f0c0['model']=_[_0xb571('0x2d')](db['ChatQueueReport'][_0xb571('0x44')]);_0x16f0c0[_0xb571('0x2c')]=_[_0xb571('0x2d')](_0x241d47[_0xb571('0x2c')]);_0x16f0c0['filters']=_[_0xb571('0x2e')](_0x16f0c0[_0xb571('0x2f')],_0x16f0c0[_0xb571('0x2c')]);_0x5ae370[_0xb571('0x30')]=_['intersection'](_0x16f0c0['model'],qs[_0xb571('0x45')](_0x241d47[_0xb571('0x2c')][_0xb571('0x45')]));_0x5ae370['attributes']=_0x5ae370[_0xb571('0x30')][_0xb571('0x31')]?_0x5ae370[_0xb571('0x30')]:_0x16f0c0[_0xb571('0x2f')];if(_0x241d47[_0xb571('0x2c')]['includeAll']){_0x5ae370[_0xb571('0x3d')]=[{'all':!![]}];}_0x5ae370=_['merge']({},_0x5ae370,_0x241d47[_0xb571('0x3b')]);return db[_0xb571('0x3e')]['find'](_0x5ae370)[_0xb571('0x22')](handleEntityNotFound(_0x2e170f,null))[_0xb571('0x22')](respondWithResult(_0x2e170f,null))[_0xb571('0x41')](handleError(_0x2e170f,null));};exports[_0xb571('0x46')]=function(_0xb92db,_0x100348){return db[_0xb571('0x3e')][_0xb571('0x46')](_0xb92db['body'],{})[_0xb571('0x22')](respondWithResult(_0x100348,0xc9))[_0xb571('0x41')](handleError(_0x100348,null));};exports[_0xb571('0x21')]=function(_0x5ab1db,_0x1b8d95){if(_0x5ab1db[_0xb571('0x47')]['id']){delete _0x5ab1db[_0xb571('0x47')]['id'];}return db[_0xb571('0x3e')]['find']({'where':{'id':_0x5ab1db[_0xb571('0x43')]['id']}})[_0xb571('0x22')](handleEntityNotFound(_0x1b8d95,null))[_0xb571('0x22')](saveUpdates(_0x5ab1db[_0xb571('0x47')],null))[_0xb571('0x22')](respondWithResult(_0x1b8d95,null))[_0xb571('0x41')](handleError(_0x1b8d95,null));};exports['destroy']=function(_0x3fe915,_0x171005){return db[_0xb571('0x3e')][_0xb571('0x48')]({'where':{'id':_0x3fe915[_0xb571('0x43')]['id']}})[_0xb571('0x22')](handleEntityNotFound(_0x171005,null))[_0xb571('0x22')](removeEntity(_0x171005,null))[_0xb571('0x41')](handleError(_0x171005,null));};exports[_0xb571('0x49')]=function(_0x518e0a,_0x309ff5){return db[_0xb571('0x3e')][_0xb571('0x49')]()[_0xb571('0x22')](respondWithResult(_0x309ff5,null))[_0xb571('0x41')](handleError(_0x309ff5,null));}; \ No newline at end of file +var _0xa5a2=['update','then','destroy','sendStatus','error','name','index','map','ChatQueueReport','type','key','query','keys','filters','intersection','model','fields','length','attributes','hasOwnProperty','limit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','rawAttributes','find','create','body','params','describe','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','set','apply','save'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xa5a2,0xb5));var _0x2a5a=function(_0x38467c,_0x2d3490){_0x38467c=_0x38467c-0x0;var _0x1d09cd=_0xa5a2[_0x38467c];return _0x1d09cd;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2a5a('0x0'));var rimraf=require(_0x2a5a('0x1'));var zipdir=require(_0x2a5a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2a5a('0x3'));var Mustache=require(_0x2a5a('0x4'));var util=require(_0x2a5a('0x5'));var path=require(_0x2a5a('0x6'));var sox=require(_0x2a5a('0x7'));var csv=require(_0x2a5a('0x8'));var ejs=require(_0x2a5a('0x9'));var fs=require('fs');var _=require(_0x2a5a('0xa'));var squel=require(_0x2a5a('0xb'));var crypto=require('crypto');var jsforce=require(_0x2a5a('0xc'));var deskjs=require(_0x2a5a('0xd'));var toCsv=require(_0x2a5a('0x8'));var querystring=require('querystring');var Papa=require(_0x2a5a('0xe'));var Redis=require('ioredis');var authService=require(_0x2a5a('0xf'));var qs=require(_0x2a5a('0x10'));var as=require(_0x2a5a('0x11'));var hardwareService=require(_0x2a5a('0x12'));var logger=require(_0x2a5a('0x13'))(_0x2a5a('0x14'));var utils=require(_0x2a5a('0x15'));var config=require(_0x2a5a('0x16'));var db=require(_0x2a5a('0x17'))['db'];function respondWithStatusCode(_0x5582e5,_0x19bb3c){_0x19bb3c=_0x19bb3c||0xcc;return function(_0x5c47b7){if(_0x5c47b7){return _0x5582e5['sendStatus'](_0x19bb3c);}return _0x5582e5[_0x2a5a('0x18')](_0x19bb3c)[_0x2a5a('0x19')]();};}function respondWithResult(_0x441b50,_0x37d3ff){_0x37d3ff=_0x37d3ff||0xc8;return function(_0x167fd3){if(_0x167fd3){return _0x441b50[_0x2a5a('0x18')](_0x37d3ff)[_0x2a5a('0x1a')](_0x167fd3);}};}function respondWithFilteredResult(_0x9aac47,_0x514424){return function(_0x31daa2){if(_0x31daa2){var _0x3fcb2e=_0x31daa2[_0x2a5a('0x1b')],_0xdd9dbe=_0x514424[_0x2a5a('0x1c')],_0x9f6734=_0x514424[_0x2a5a('0x1c')]+_0x514424['limit'],_0x572ac4;if(_0x9f6734>=_0x3fcb2e){_0x9f6734=_0x3fcb2e;_0x572ac4=0xc8;}else{_0x572ac4=0xce;}_0x9aac47[_0x2a5a('0x18')](_0x572ac4);return _0x9aac47[_0x2a5a('0x1d')]('Content-Range',_0xdd9dbe+'-'+_0x9f6734+'/'+_0x3fcb2e)['json'](_0x31daa2);}return null;};}function patchUpdates(_0x36d023){return function(_0x463fa1){try{jsonpatch[_0x2a5a('0x1e')](_0x463fa1,_0x36d023,!![]);}catch(_0x367802){return BPromise['reject'](_0x367802);}return _0x463fa1[_0x2a5a('0x1f')]();};}function saveUpdates(_0x367ee8,_0x2d0c4c){return function(_0x447fc3){if(_0x447fc3){return _0x447fc3[_0x2a5a('0x20')](_0x367ee8)[_0x2a5a('0x21')](function(_0x13503e){return _0x13503e;});}return null;};}function removeEntity(_0xbe8409,_0x2f5c24){return function(_0x5ea7da){if(_0x5ea7da){return _0x5ea7da[_0x2a5a('0x22')]()[_0x2a5a('0x21')](function(){_0xbe8409[_0x2a5a('0x18')](0xcc)[_0x2a5a('0x19')]();});}};}function handleEntityNotFound(_0x2c6b5d,_0x44678d){return function(_0x15e1d0){if(!_0x15e1d0){_0x2c6b5d[_0x2a5a('0x23')](0x194);}return _0x15e1d0;};}function handleError(_0xc584d6,_0x52d2bf){_0x52d2bf=_0x52d2bf||0x1f4;return function(_0x3a6d02){logger[_0x2a5a('0x24')](_0x3a6d02['stack']);if(_0x3a6d02[_0x2a5a('0x25')]){delete _0x3a6d02[_0x2a5a('0x25')];}_0xc584d6[_0x2a5a('0x18')](_0x52d2bf)['send'](_0x3a6d02);};}exports[_0x2a5a('0x26')]=function(_0xe5fee3,_0x3235fe){var _0x5eff85={},_0x1c6b57={},_0x3868b1={'count':0x0,'rows':[]};var _0x43d4a3=_[_0x2a5a('0x27')](db[_0x2a5a('0x28')]['rawAttributes'],function(_0x609aee){return{'name':_0x609aee['fieldName'],'type':_0x609aee[_0x2a5a('0x29')][_0x2a5a('0x2a')]};});_0x1c6b57['model']=_[_0x2a5a('0x27')](_0x43d4a3,_0x2a5a('0x25'));_0x1c6b57[_0x2a5a('0x2b')]=_[_0x2a5a('0x2c')](_0xe5fee3[_0x2a5a('0x2b')]);_0x1c6b57[_0x2a5a('0x2d')]=_[_0x2a5a('0x2e')](_0x1c6b57[_0x2a5a('0x2f')],_0x1c6b57[_0x2a5a('0x2b')]);_0x5eff85['attributes']=_['intersection'](_0x1c6b57['model'],qs[_0x2a5a('0x30')](_0xe5fee3['query']['fields']));_0x5eff85['attributes']=_0x5eff85['attributes'][_0x2a5a('0x31')]?_0x5eff85[_0x2a5a('0x32')]:_0x1c6b57[_0x2a5a('0x2f')];if(!_0xe5fee3[_0x2a5a('0x2b')][_0x2a5a('0x33')]('nolimit')){_0x5eff85[_0x2a5a('0x34')]=qs[_0x2a5a('0x34')](_0xe5fee3[_0x2a5a('0x2b')][_0x2a5a('0x34')]);_0x5eff85[_0x2a5a('0x1c')]=qs['offset'](_0xe5fee3['query']['offset']);}_0x5eff85[_0x2a5a('0x35')]=qs[_0x2a5a('0x36')](_0xe5fee3[_0x2a5a('0x2b')][_0x2a5a('0x36')]);_0x5eff85[_0x2a5a('0x37')]=qs[_0x2a5a('0x2d')](_[_0x2a5a('0x38')](_0xe5fee3[_0x2a5a('0x2b')],_0x1c6b57[_0x2a5a('0x2d')]));if(_0xe5fee3['query'][_0x2a5a('0x39')]){_0x5eff85[_0x2a5a('0x37')]=_[_0x2a5a('0x3a')](_0x5eff85[_0x2a5a('0x37')],{'$or':_[_0x2a5a('0x27')](_0x43d4a3,function(_0x168ed0){if(_0x168ed0[_0x2a5a('0x29')]!=='VIRTUAL'){var _0x5b52d6={};_0x5b52d6[_0x168ed0[_0x2a5a('0x25')]]={'$like':'%'+_0xe5fee3[_0x2a5a('0x2b')]['filter']+'%'};return _0x5b52d6;}})});}_0x5eff85=_[_0x2a5a('0x3a')]({},_0x5eff85,_0xe5fee3[_0x2a5a('0x3b')]);var _0x47ca95={'where':_0x5eff85[_0x2a5a('0x37')]};return db[_0x2a5a('0x28')][_0x2a5a('0x1b')](_0x47ca95)[_0x2a5a('0x21')](function(_0x3bfe58){_0x3868b1[_0x2a5a('0x1b')]=_0x3bfe58;if(_0xe5fee3['query'][_0x2a5a('0x3c')]){_0x5eff85[_0x2a5a('0x3d')]=[{'all':!![]}];}return db[_0x2a5a('0x28')]['findAll'](_0x5eff85);})['then'](function(_0x33bcb9){_0x3868b1[_0x2a5a('0x3e')]=_0x33bcb9;return _0x3868b1;})['then'](respondWithFilteredResult(_0x3235fe,_0x5eff85))[_0x2a5a('0x3f')](handleError(_0x3235fe,null));};exports[_0x2a5a('0x40')]=function(_0x464d0a,_0xcedf1e){var _0x4b7903={'raw':!![],'where':{'id':_0x464d0a['params']['id']}},_0x3a75db={};_0x3a75db[_0x2a5a('0x2f')]=_[_0x2a5a('0x2c')](db[_0x2a5a('0x28')][_0x2a5a('0x41')]);_0x3a75db['query']=_[_0x2a5a('0x2c')](_0x464d0a['query']);_0x3a75db[_0x2a5a('0x2d')]=_[_0x2a5a('0x2e')](_0x3a75db['model'],_0x3a75db[_0x2a5a('0x2b')]);_0x4b7903[_0x2a5a('0x32')]=_[_0x2a5a('0x2e')](_0x3a75db[_0x2a5a('0x2f')],qs['fields'](_0x464d0a[_0x2a5a('0x2b')][_0x2a5a('0x30')]));_0x4b7903['attributes']=_0x4b7903[_0x2a5a('0x32')]['length']?_0x4b7903[_0x2a5a('0x32')]:_0x3a75db[_0x2a5a('0x2f')];if(_0x464d0a['query']['includeAll']){_0x4b7903['include']=[{'all':!![]}];}_0x4b7903=_[_0x2a5a('0x3a')]({},_0x4b7903,_0x464d0a[_0x2a5a('0x3b')]);return db['ChatQueueReport'][_0x2a5a('0x42')](_0x4b7903)[_0x2a5a('0x21')](handleEntityNotFound(_0xcedf1e,null))[_0x2a5a('0x21')](respondWithResult(_0xcedf1e,null))['catch'](handleError(_0xcedf1e,null));};exports[_0x2a5a('0x43')]=function(_0x57beb0,_0x41c15b){return db[_0x2a5a('0x28')][_0x2a5a('0x43')](_0x57beb0[_0x2a5a('0x44')],{})[_0x2a5a('0x21')](respondWithResult(_0x41c15b,0xc9))[_0x2a5a('0x3f')](handleError(_0x41c15b,null));};exports[_0x2a5a('0x20')]=function(_0x57d3d0,_0x421858){if(_0x57d3d0['body']['id']){delete _0x57d3d0['body']['id'];}return db[_0x2a5a('0x28')][_0x2a5a('0x42')]({'where':{'id':_0x57d3d0[_0x2a5a('0x45')]['id']}})[_0x2a5a('0x21')](handleEntityNotFound(_0x421858,null))[_0x2a5a('0x21')](saveUpdates(_0x57d3d0[_0x2a5a('0x44')],null))[_0x2a5a('0x21')](respondWithResult(_0x421858,null))['catch'](handleError(_0x421858,null));};exports[_0x2a5a('0x22')]=function(_0x2eb525,_0x5ca8f9){return db[_0x2a5a('0x28')]['find']({'where':{'id':_0x2eb525[_0x2a5a('0x45')]['id']}})['then'](handleEntityNotFound(_0x5ca8f9,null))[_0x2a5a('0x21')](removeEntity(_0x5ca8f9,null))['catch'](handleError(_0x5ca8f9,null));};exports[_0x2a5a('0x46')]=function(_0x29a76d,_0x5048ed){return db[_0x2a5a('0x28')][_0x2a5a('0x46')]()[_0x2a5a('0x21')](respondWithResult(_0x5048ed,null))[_0x2a5a('0x3f')](handleError(_0x5048ed,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index f3e0f67..fa0e1e8 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 _0xce42=['path','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x53c412,_0x42577f){var _0x2790b7=function(_0x31e0ee){while(--_0x31e0ee){_0x53c412['push'](_0x53c412['shift']());}};_0x2790b7(++_0x42577f);}(_0xce42,0xb0));var _0x2ce4=function(_0x5c1cdc,_0x322014){_0x5c1cdc=_0x5c1cdc-0x0;var _0x2e8317=_0xce42[_0x5c1cdc];return _0x2e8317;};'use strict';var _=require(_0x2ce4('0x0'));var util=require('util');var logger=require(_0x2ce4('0x1'))(_0x2ce4('0x2'));var moment=require(_0x2ce4('0x3'));var BPromise=require(_0x2ce4('0x4'));var rp=require(_0x2ce4('0x5'));var fs=require('fs');var path=require(_0x2ce4('0x6'));var rimraf=require('rimraf');var config=require(_0x2ce4('0x7'));var attributes=require(_0x2ce4('0x8'));module[_0x2ce4('0x9')]=function(_0x30557d,_0x370efe){return _0x30557d[_0x2ce4('0xa')](_0x2ce4('0xb'),attributes,{'tableName':_0x2ce4('0xc'),'paranoid':![],'indexes':[{'name':_0x2ce4('0xd'),'fields':[_0x2ce4('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x49f2=['request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','ChatQueueReport','report_chat_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird'];(function(_0x47c087,_0x4e6592){var _0xb35aad=function(_0x15823e){while(--_0x15823e){_0x47c087['push'](_0x47c087['shift']());}};_0xb35aad(++_0x4e6592);}(_0x49f2,0x6b));var _0x249f=function(_0x5d7644,_0x33f99a){_0x5d7644=_0x5d7644-0x0;var _0x33eafd=_0x49f2[_0x5d7644];return _0x33eafd;};'use strict';var _=require(_0x249f('0x0'));var util=require('util');var logger=require(_0x249f('0x1'))(_0x249f('0x2'));var moment=require(_0x249f('0x3'));var BPromise=require(_0x249f('0x4'));var rp=require(_0x249f('0x5'));var fs=require('fs');var path=require(_0x249f('0x6'));var rimraf=require(_0x249f('0x7'));var config=require(_0x249f('0x8'));var attributes=require(_0x249f('0x9'));module[_0x249f('0xa')]=function(_0x3f53d8,_0x4b1d4){return _0x3f53d8['define'](_0x249f('0xb'),attributes,{'tableName':_0x249f('0xc'),'paranoid':![],'indexes':[{'name':_0x249f('0xd'),'fields':[_0x249f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 0e8c4a7..004ba5f 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 _0xc3c3=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','info','CreateChatQueueReport','create','body','options','raw','then','catch','ChatQueueReport','update','where','limit','UpdateChatQueueReport','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x1675bf,_0x307a0d){var _0x4138d4=function(_0x1ac3c6){while(--_0x1ac3c6){_0x1675bf['push'](_0x1675bf['shift']());}};_0x4138d4(++_0x307a0d);}(_0xc3c3,0x1e4));var _0x3c3c=function(_0x5ab52d,_0x3ac63e){_0x5ab52d=_0x5ab52d-0x0;var _0x2378c4=_0xc3c3[_0x5ab52d];return _0x2378c4;};'use strict';var _=require(_0x3c3c('0x0'));var util=require(_0x3c3c('0x1'));var moment=require(_0x3c3c('0x2'));var BPromise=require(_0x3c3c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3c3c('0x4'));var db=require(_0x3c3c('0x5'))['db'];var utils=require(_0x3c3c('0x6'));var logger=require(_0x3c3c('0x7'))(_0x3c3c('0x8'));var config=require(_0x3c3c('0x9'));var jayson=require(_0x3c3c('0xa'));var client=jayson[_0x3c3c('0xb')][_0x3c3c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x455e34,_0x1fa8bb,_0x567682){return new BPromise(function(_0x5517b0,_0x20d4c5){return client[_0x3c3c('0xd')](_0x455e34,_0x567682)['then'](function(_0x4bc399){logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x1fa8bb,_0x3c3c('0xe'));logger[_0x3c3c('0xf')](_0x3c3c('0x10'),_0x1fa8bb,'request\x20sent',JSON[_0x3c3c('0x11')](_0x4bc399));if(_0x4bc399[_0x3c3c('0x12')]){if(_0x4bc399[_0x3c3c('0x12')][_0x3c3c('0x13')]===0x1f4){logger[_0x3c3c('0x12')](_0x3c3c('0x14'),_0x1fa8bb,_0x4bc399[_0x3c3c('0x12')][_0x3c3c('0x15')]);return _0x20d4c5(_0x4bc399[_0x3c3c('0x12')]['message']);}logger['error'](_0x3c3c('0x14'),_0x1fa8bb,_0x4bc399['error']['message']);return _0x5517b0(_0x4bc399['error'][_0x3c3c('0x15')]);}else{logger[_0x3c3c('0x16')](_0x3c3c('0x14'),_0x1fa8bb,'request\x20sent');_0x5517b0(_0x4bc399['result'][_0x3c3c('0x15')]);}})['catch'](function(_0x3034de){logger[_0x3c3c('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x1fa8bb,_0x3034de);_0x20d4c5(_0x3034de);});});}exports[_0x3c3c('0x17')]=function(_0x3ab061){var _0x4912e3=this;return new Promise(function(_0x4d5f2d,_0x4e4602){return db['ChatQueueReport'][_0x3c3c('0x18')](_0x3ab061[_0x3c3c('0x19')],{'raw':_0x3ab061['options']?_0x3ab061[_0x3c3c('0x1a')][_0x3c3c('0x1b')]===undefined?!![]:![]:!![]})[_0x3c3c('0x1c')](function(_0x372c94){logger[_0x3c3c('0x16')]('CreateChatQueueReport',_0x3ab061);logger[_0x3c3c('0xf')](_0x3c3c('0x17'),_0x3ab061,JSON[_0x3c3c('0x11')](_0x372c94));_0x4d5f2d(_0x372c94);})[_0x3c3c('0x1d')](function(_0x5cd1b1){logger[_0x3c3c('0x12')]('CreateChatQueueReport',_0x5cd1b1[_0x3c3c('0x15')],_0x3ab061);_0x4e4602(_0x4912e3[_0x3c3c('0x12')](0x1f4,_0x5cd1b1['message']));});});};exports['UpdateChatQueueReport']=function(_0x47971f){var _0x5d0338=this;return new Promise(function(_0x1e372e,_0x49829c){return db[_0x3c3c('0x1e')][_0x3c3c('0x1f')](_0x47971f[_0x3c3c('0x19')],{'raw':_0x47971f[_0x3c3c('0x1a')]?_0x47971f['options'][_0x3c3c('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47971f['options']?_0x47971f[_0x3c3c('0x1a')][_0x3c3c('0x20')]||null:null,'attributes':_0x47971f[_0x3c3c('0x1a')]?_0x47971f[_0x3c3c('0x1a')]['attributes']||null:null,'limit':_0x47971f[_0x3c3c('0x1a')]?_0x47971f['options'][_0x3c3c('0x21')]||null:null})[_0x3c3c('0x1c')](function(_0x3b9ab8){logger[_0x3c3c('0x16')]('UpdateChatQueueReport',_0x47971f);logger[_0x3c3c('0xf')](_0x3c3c('0x22'),_0x47971f,JSON['stringify'](_0x3b9ab8));_0x1e372e(_0x3b9ab8);})[_0x3c3c('0x1d')](function(_0x253aa6){logger['error'](_0x3c3c('0x22'),_0x253aa6['message'],_0x47971f);_0x49829c(_0x5d0338[_0x3c3c('0x12')](0x1f4,_0x253aa6['message']));});});}; \ No newline at end of file +var _0xc522=['options','CreateChatQueueReport','UpdateChatQueueReport','ChatQueueReport','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','body'];(function(_0x176b56,_0x59a871){var _0x1174b7=function(_0xf20f5f){while(--_0xf20f5f){_0x176b56['push'](_0x176b56['shift']());}};_0x1174b7(++_0x59a871);}(_0xc522,0x11d));var _0x2c52=function(_0x4f3217,_0x1e5627){_0x4f3217=_0x4f3217-0x0;var _0xf7d884=_0xc522[_0x4f3217];return _0xf7d884;};'use strict';var _=require(_0x2c52('0x0'));var util=require(_0x2c52('0x1'));var moment=require(_0x2c52('0x2'));var BPromise=require(_0x2c52('0x3'));var rs=require(_0x2c52('0x4'));var fs=require('fs');var Redis=require(_0x2c52('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2c52('0x6'));var logger=require(_0x2c52('0x7'))(_0x2c52('0x8'));var config=require(_0x2c52('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2c52('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16a91b,_0x54e93f,_0x4dfb53){return new BPromise(function(_0x2a837d,_0x2b79f9){return client[_0x2c52('0xb')](_0x16a91b,_0x4dfb53)[_0x2c52('0xc')](function(_0x46d3c8){logger[_0x2c52('0xd')](_0x2c52('0xe'),_0x54e93f,_0x2c52('0xf'));logger[_0x2c52('0x10')](_0x2c52('0x11'),_0x54e93f,_0x2c52('0xf'),JSON[_0x2c52('0x12')](_0x46d3c8));if(_0x46d3c8[_0x2c52('0x13')]){if(_0x46d3c8[_0x2c52('0x13')][_0x2c52('0x14')]===0x1f4){logger[_0x2c52('0x13')]('ChatQueueReport,\x20%s,\x20%s',_0x54e93f,_0x46d3c8[_0x2c52('0x13')][_0x2c52('0x15')]);return _0x2b79f9(_0x46d3c8[_0x2c52('0x13')][_0x2c52('0x15')]);}logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x54e93f,_0x46d3c8['error'][_0x2c52('0x15')]);return _0x2a837d(_0x46d3c8[_0x2c52('0x13')][_0x2c52('0x15')]);}else{logger['info'](_0x2c52('0xe'),_0x54e93f,'request\x20sent');_0x2a837d(_0x46d3c8[_0x2c52('0x16')][_0x2c52('0x15')]);}})[_0x2c52('0x17')](function(_0xda0eb){logger[_0x2c52('0x13')](_0x2c52('0xe'),_0x54e93f,_0xda0eb);_0x2b79f9(_0xda0eb);});});}exports['CreateChatQueueReport']=function(_0x372f04){var _0xa492ba=this;return new Promise(function(_0x59a8fc,_0x588f32){return db['ChatQueueReport']['create'](_0x372f04[_0x2c52('0x18')],{'raw':_0x372f04[_0x2c52('0x19')]?_0x372f04[_0x2c52('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x2c52('0xc')](function(_0x4471b7){logger['info'](_0x2c52('0x1a'),_0x372f04);logger[_0x2c52('0x10')](_0x2c52('0x1a'),_0x372f04,JSON[_0x2c52('0x12')](_0x4471b7));_0x59a8fc(_0x4471b7);})['catch'](function(_0xd8f771){logger['error'](_0x2c52('0x1a'),_0xd8f771['message'],_0x372f04);_0x588f32(_0xa492ba['error'](0x1f4,_0xd8f771[_0x2c52('0x15')]));});});};exports[_0x2c52('0x1b')]=function(_0x1fca72){var _0x3f272b=this;return new Promise(function(_0x2b36d6,_0x29e0c6){return db[_0x2c52('0x1c')]['update'](_0x1fca72[_0x2c52('0x18')],{'raw':_0x1fca72[_0x2c52('0x19')]?_0x1fca72[_0x2c52('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1fca72[_0x2c52('0x19')]?_0x1fca72[_0x2c52('0x19')]['where']||null:null,'attributes':_0x1fca72['options']?_0x1fca72[_0x2c52('0x19')][_0x2c52('0x1d')]||null:null,'limit':_0x1fca72[_0x2c52('0x19')]?_0x1fca72[_0x2c52('0x19')][_0x2c52('0x1e')]||null:null})['then'](function(_0x3ad739){logger[_0x2c52('0xd')]('UpdateChatQueueReport',_0x1fca72);logger[_0x2c52('0x10')](_0x2c52('0x1b'),_0x1fca72,JSON[_0x2c52('0x12')](_0x3ad739));_0x2b36d6(_0x3ad739);})['catch'](function(_0x171e90){logger[_0x2c52('0x13')]('UpdateChatQueueReport',_0x171e90[_0x2c52('0x15')],_0x1fca72);_0x29e0c6(_0x3f272b[_0x2c52('0x13')](0x1f4,_0x171e90[_0x2c52('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 602d24f..f6ce871 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 _0xb088=['exports','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','update','delete','/:id'];(function(_0x2b78f6,_0x8650c3){var _0x32adac=function(_0x3675ca){while(--_0x3675ca){_0x2b78f6['push'](_0x2b78f6['shift']());}};_0x32adac(++_0x8650c3);}(_0xb088,0xa1));var _0x8b08=function(_0x1230dd,_0x524d12){_0x1230dd=_0x1230dd-0x0;var _0x26794a=_0xb088[_0x1230dd];return _0x26794a;};'use strict';var multer=require(_0x8b08('0x0'));var util=require(_0x8b08('0x1'));var path=require(_0x8b08('0x2'));var timeout=require(_0x8b08('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x8b08('0x4'));var config=require(_0x8b08('0x5'));var controller=require(_0x8b08('0x6'));router[_0x8b08('0x7')]('/',auth[_0x8b08('0x8')](),controller[_0x8b08('0x9')]);router[_0x8b08('0x7')](_0x8b08('0xa'),auth[_0x8b08('0x8')](),controller[_0x8b08('0xb')]);router[_0x8b08('0x7')]('/:id',auth[_0x8b08('0x8')](),controller[_0x8b08('0xc')]);router[_0x8b08('0xd')]('/',auth[_0x8b08('0x8')](),controller[_0x8b08('0xe')]);router[_0x8b08('0xf')]('/:id',auth[_0x8b08('0x8')](),controller[_0x8b08('0x10')]);router[_0x8b08('0x11')](_0x8b08('0x12'),auth[_0x8b08('0x8')](),controller['destroy']);module[_0x8b08('0x13')]=router; \ No newline at end of file +var _0x5f7d=['isAuthenticated','index','/describe','show','post','create','put','/:id','update','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x55aa81,_0x4c6cbb){var _0x579bae=function(_0x1eab42){while(--_0x1eab42){_0x55aa81['push'](_0x55aa81['shift']());}};_0x579bae(++_0x4c6cbb);}(_0x5f7d,0x173));var _0xd5f7=function(_0x2dcbdf,_0x2a134f){_0x2dcbdf=_0x2dcbdf-0x0;var _0x3fe4f1=_0x5f7d[_0x2dcbdf];return _0x3fe4f1;};'use strict';var multer=require(_0xd5f7('0x0'));var util=require(_0xd5f7('0x1'));var path=require('path');var timeout=require(_0xd5f7('0x2'));var express=require(_0xd5f7('0x3'));var router=express[_0xd5f7('0x4')]();var auth=require(_0xd5f7('0x5'));var interaction=require(_0xd5f7('0x6'));var config=require(_0xd5f7('0x7'));var controller=require('./chatQueueReport.controller');router[_0xd5f7('0x8')]('/',auth[_0xd5f7('0x9')](),controller[_0xd5f7('0xa')]);router[_0xd5f7('0x8')](_0xd5f7('0xb'),auth[_0xd5f7('0x9')](),controller['describe']);router['get']('/:id',auth[_0xd5f7('0x9')](),controller[_0xd5f7('0xc')]);router[_0xd5f7('0xd')]('/',auth[_0xd5f7('0x9')](),controller[_0xd5f7('0xe')]);router[_0xd5f7('0xf')](_0xd5f7('0x10'),auth[_0xd5f7('0x9')](),controller[_0xd5f7('0x11')]);router['delete'](_0xd5f7('0x10'),auth[_0xd5f7('0x9')](),controller['destroy']);module[_0xd5f7('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 5c96d97..2b3371f 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 _0x4698=['queue','DATE','NOW','moment','sequelize','STRING','ENUM','account'];(function(_0x1ed15c,_0x55f789){var _0x59770e=function(_0x2d1d75){while(--_0x2d1d75){_0x1ed15c['push'](_0x1ed15c['shift']());}};_0x59770e(++_0x55f789);}(_0x4698,0x1e3));var _0x8469=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x4698[_0x521929];return _0x632436;};'use strict';var moment=require(_0x8469('0x0'));var Sequelize=require(_0x8469('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x8469('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x8469('0x3')](_0x8469('0x4'),'agent',_0x8469('0x5')),'allowNull':![],'defaultValue':_0x8469('0x5')},'transferredAt':{'type':Sequelize[_0x8469('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x8469('0x7')]}}; \ No newline at end of file +var _0xe43c=['account','agent','queue','DATE','NOW','sequelize','exports','STRING','ENUM'];(function(_0x390caf,_0x53b3f2){var _0x26f502=function(_0x3e55ce){while(--_0x3e55ce){_0x390caf['push'](_0x390caf['shift']());}};_0x26f502(++_0x53b3f2);}(_0xe43c,0x188));var _0xce43=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xe43c[_0x42cae2];return _0x5f256f;};'use strict';var moment=require('moment');var Sequelize=require(_0xce43('0x0'));module[_0xce43('0x1')]={'uniqueid':{'type':Sequelize[_0xce43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xce43('0x3')](_0xce43('0x4'),_0xce43('0x5'),_0xce43('0x6')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xce43('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xce43('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index dad2890..7736713 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 _0x2432=['../../config/utils','../../config/environment','end','status','json','offset','limit','set','reject','save','then','destroy','sendStatus','error','stack','name','send','index','ChatTransferReport','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','count','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','options','find','create','body','update','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api'];(function(_0x48ecf0,_0x5b3788){var _0x48f5ef=function(_0x4c4e33){while(--_0x4c4e33){_0x48ecf0['push'](_0x48ecf0['shift']());}};_0x48f5ef(++_0x5b3788);}(_0x2432,0x15b));var _0x2243=function(_0x25b9a8,_0x37cc3c){_0x25b9a8=_0x25b9a8-0x0;var _0x123504=_0x2432[_0x25b9a8];return _0x123504;};'use strict';var pdf=require(_0x2243('0x0'));var emlformat=require(_0x2243('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2243('0x2'));var jsonpatch=require(_0x2243('0x3'));var rp=require(_0x2243('0x4'));var moment=require('moment');var BPromise=require(_0x2243('0x5'));var Mustache=require(_0x2243('0x6'));var util=require(_0x2243('0x7'));var path=require(_0x2243('0x8'));var sox=require(_0x2243('0x9'));var csv=require(_0x2243('0xa'));var ejs=require(_0x2243('0xb'));var fs=require('fs');var _=require(_0x2243('0xc'));var squel=require(_0x2243('0xd'));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(_0x2243('0xe'));var authService=require(_0x2243('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x2243('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2243('0x11'));var utils=require(_0x2243('0x12'));var config=require(_0x2243('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1bf7eb,_0x56dde1){_0x56dde1=_0x56dde1||0xcc;return function(_0x9ad8f8){if(_0x9ad8f8){return _0x1bf7eb['sendStatus'](_0x56dde1);}return _0x1bf7eb['status'](_0x56dde1)[_0x2243('0x14')]();};}function respondWithResult(_0x47b92c,_0x4e65a1){_0x4e65a1=_0x4e65a1||0xc8;return function(_0xcc7ed7){if(_0xcc7ed7){return _0x47b92c[_0x2243('0x15')](_0x4e65a1)[_0x2243('0x16')](_0xcc7ed7);}};}function respondWithFilteredResult(_0x5330d1,_0x196539){return function(_0x585c10){if(_0x585c10){var _0x1348a0=_0x585c10['count'],_0x39d208=_0x196539[_0x2243('0x17')],_0x4f1580=_0x196539[_0x2243('0x17')]+_0x196539[_0x2243('0x18')],_0x582ea9;if(_0x4f1580>=_0x1348a0){_0x4f1580=_0x1348a0;_0x582ea9=0xc8;}else{_0x582ea9=0xce;}_0x5330d1[_0x2243('0x15')](_0x582ea9);return _0x5330d1[_0x2243('0x19')]('Content-Range',_0x39d208+'-'+_0x4f1580+'/'+_0x1348a0)['json'](_0x585c10);}return null;};}function patchUpdates(_0x925cbf){return function(_0x4b53ea){try{jsonpatch['apply'](_0x4b53ea,_0x925cbf,!![]);}catch(_0x64c4cd){return BPromise[_0x2243('0x1a')](_0x64c4cd);}return _0x4b53ea[_0x2243('0x1b')]();};}function saveUpdates(_0x2995c0,_0x580c3a){return function(_0x3a905a){if(_0x3a905a){return _0x3a905a['update'](_0x2995c0)[_0x2243('0x1c')](function(_0x2e8d30){return _0x2e8d30;});}return null;};}function removeEntity(_0x1aa943,_0x2c91da){return function(_0x534eaf){if(_0x534eaf){return _0x534eaf[_0x2243('0x1d')]()['then'](function(){_0x1aa943[_0x2243('0x15')](0xcc)[_0x2243('0x14')]();});}};}function handleEntityNotFound(_0xc35bc0,_0x4fb92b){return function(_0x512b6b){if(!_0x512b6b){_0xc35bc0[_0x2243('0x1e')](0x194);}return _0x512b6b;};}function handleError(_0x3c3c08,_0x5db9ab){_0x5db9ab=_0x5db9ab||0x1f4;return function(_0x30d6bf){logger[_0x2243('0x1f')](_0x30d6bf[_0x2243('0x20')]);if(_0x30d6bf['name']){delete _0x30d6bf[_0x2243('0x21')];}_0x3c3c08['status'](_0x5db9ab)[_0x2243('0x22')](_0x30d6bf);};}exports[_0x2243('0x23')]=function(_0x14a677,_0x441a4f){var _0x5c58d3={},_0x5950dc={},_0x11cbd9={'count':0x0,'rows':[]};var _0x5562dc=_['map'](db[_0x2243('0x24')]['rawAttributes'],function(_0x4f8b04){return{'name':_0x4f8b04[_0x2243('0x25')],'type':_0x4f8b04[_0x2243('0x26')][_0x2243('0x27')]};});_0x5950dc['model']=_[_0x2243('0x28')](_0x5562dc,_0x2243('0x21'));_0x5950dc[_0x2243('0x29')]=_[_0x2243('0x2a')](_0x14a677[_0x2243('0x29')]);_0x5950dc[_0x2243('0x2b')]=_[_0x2243('0x2c')](_0x5950dc['model'],_0x5950dc[_0x2243('0x29')]);_0x5c58d3[_0x2243('0x2d')]=_[_0x2243('0x2c')](_0x5950dc[_0x2243('0x2e')],qs[_0x2243('0x2f')](_0x14a677['query'][_0x2243('0x2f')]));_0x5c58d3[_0x2243('0x2d')]=_0x5c58d3[_0x2243('0x2d')]['length']?_0x5c58d3[_0x2243('0x2d')]:_0x5950dc[_0x2243('0x2e')];if(!_0x14a677[_0x2243('0x29')][_0x2243('0x30')](_0x2243('0x31'))){_0x5c58d3[_0x2243('0x18')]=qs['limit'](_0x14a677[_0x2243('0x29')][_0x2243('0x18')]);_0x5c58d3[_0x2243('0x17')]=qs[_0x2243('0x17')](_0x14a677[_0x2243('0x29')][_0x2243('0x17')]);}_0x5c58d3[_0x2243('0x32')]=qs[_0x2243('0x33')](_0x14a677[_0x2243('0x29')]['sort']);_0x5c58d3['where']=qs[_0x2243('0x2b')](_[_0x2243('0x34')](_0x14a677[_0x2243('0x29')],_0x5950dc[_0x2243('0x2b')]));if(_0x14a677[_0x2243('0x29')][_0x2243('0x35')]){_0x5c58d3[_0x2243('0x36')]=_[_0x2243('0x37')](_0x5c58d3[_0x2243('0x36')],{'$or':_['map'](_0x5562dc,function(_0x105c55){if(_0x105c55[_0x2243('0x26')]!==_0x2243('0x38')){var _0x90119c={};_0x90119c[_0x105c55[_0x2243('0x21')]]={'$like':'%'+_0x14a677[_0x2243('0x29')]['filter']+'%'};return _0x90119c;}})});}_0x5c58d3=_['merge']({},_0x5c58d3,_0x14a677['options']);var _0x23240e={'where':_0x5c58d3[_0x2243('0x36')]};return db[_0x2243('0x24')][_0x2243('0x39')](_0x23240e)['then'](function(_0x232a13){_0x11cbd9[_0x2243('0x39')]=_0x232a13;if(_0x14a677[_0x2243('0x29')]['includeAll']){_0x5c58d3[_0x2243('0x3a')]=[{'all':!![]}];}return db[_0x2243('0x24')][_0x2243('0x3b')](_0x5c58d3);})[_0x2243('0x1c')](function(_0x6d7040){_0x11cbd9[_0x2243('0x3c')]=_0x6d7040;return _0x11cbd9;})[_0x2243('0x1c')](respondWithFilteredResult(_0x441a4f,_0x5c58d3))[_0x2243('0x3d')](handleError(_0x441a4f,null));};exports[_0x2243('0x3e')]=function(_0x5b2666,_0x4b4654){var _0x303845={'raw':!![],'where':{'id':_0x5b2666[_0x2243('0x3f')]['id']}},_0x3b8f81={};_0x3b8f81[_0x2243('0x2e')]=_[_0x2243('0x2a')](db[_0x2243('0x24')][_0x2243('0x40')]);_0x3b8f81[_0x2243('0x29')]=_[_0x2243('0x2a')](_0x5b2666[_0x2243('0x29')]);_0x3b8f81['filters']=_[_0x2243('0x2c')](_0x3b8f81[_0x2243('0x2e')],_0x3b8f81[_0x2243('0x29')]);_0x303845[_0x2243('0x2d')]=_['intersection'](_0x3b8f81['model'],qs[_0x2243('0x2f')](_0x5b2666[_0x2243('0x29')][_0x2243('0x2f')]));_0x303845[_0x2243('0x2d')]=_0x303845[_0x2243('0x2d')][_0x2243('0x41')]?_0x303845[_0x2243('0x2d')]:_0x3b8f81[_0x2243('0x2e')];if(_0x5b2666[_0x2243('0x29')][_0x2243('0x42')]){_0x303845[_0x2243('0x3a')]=[{'all':!![]}];}_0x303845=_[_0x2243('0x37')]({},_0x303845,_0x5b2666[_0x2243('0x43')]);return db[_0x2243('0x24')][_0x2243('0x44')](_0x303845)[_0x2243('0x1c')](handleEntityNotFound(_0x4b4654,null))[_0x2243('0x1c')](respondWithResult(_0x4b4654,null))[_0x2243('0x3d')](handleError(_0x4b4654,null));};exports[_0x2243('0x45')]=function(_0x266c9e,_0x430b1f){return db[_0x2243('0x24')][_0x2243('0x45')](_0x266c9e[_0x2243('0x46')],{})[_0x2243('0x1c')](respondWithResult(_0x430b1f,0xc9))[_0x2243('0x3d')](handleError(_0x430b1f,null));};exports[_0x2243('0x47')]=function(_0x5f4322,_0x344c9c){if(_0x5f4322[_0x2243('0x46')]['id']){delete _0x5f4322['body']['id'];}return db[_0x2243('0x24')][_0x2243('0x44')]({'where':{'id':_0x5f4322[_0x2243('0x3f')]['id']}})[_0x2243('0x1c')](handleEntityNotFound(_0x344c9c,null))[_0x2243('0x1c')](saveUpdates(_0x5f4322[_0x2243('0x46')],null))[_0x2243('0x1c')](respondWithResult(_0x344c9c,null))[_0x2243('0x3d')](handleError(_0x344c9c,null));};exports[_0x2243('0x1d')]=function(_0x2cae30,_0x497099){return db[_0x2243('0x24')][_0x2243('0x44')]({'where':{'id':_0x2cae30['params']['id']}})['then'](handleEntityNotFound(_0x497099,null))[_0x2243('0x1c')](removeEntity(_0x497099,null))[_0x2243('0x3d')](handleError(_0x497099,null));};exports[_0x2243('0x48')]=function(_0x5ebda6,_0x3f3d4a){return db[_0x2243('0x24')][_0x2243('0x48')]()[_0x2243('0x1c')](respondWithResult(_0x3f3d4a,null))[_0x2243('0x3d')](handleError(_0x3f3d4a,null));}; \ No newline at end of file +var _0x14f3=['model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','ChatTransferReport','then','includeAll','findAll','catch','show','params','keys','rawAttributes','include','options','create','body','find','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','offset','set','Content-Range','apply','save','update','destroy','stack','name','send','index','type','key'];(function(_0x5dbc49,_0x152d91){var _0x124b24=function(_0x55a1f0){while(--_0x55a1f0){_0x5dbc49['push'](_0x5dbc49['shift']());}};_0x124b24(++_0x152d91);}(_0x14f3,0x69));var _0x314f=function(_0x4991d4,_0x33bd78){_0x4991d4=_0x4991d4-0x0;var _0x3d49ab=_0x14f3[_0x4991d4];return _0x3d49ab;};'use strict';var pdf=require(_0x314f('0x0'));var emlformat=require(_0x314f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x314f('0x2'));var jsonpatch=require(_0x314f('0x3'));var rp=require(_0x314f('0x4'));var moment=require(_0x314f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x314f('0x6'));var util=require(_0x314f('0x7'));var path=require('path');var sox=require(_0x314f('0x8'));var csv=require(_0x314f('0x9'));var ejs=require(_0x314f('0xa'));var fs=require('fs');var _=require(_0x314f('0xb'));var squel=require(_0x314f('0xc'));var crypto=require(_0x314f('0xd'));var jsforce=require(_0x314f('0xe'));var deskjs=require(_0x314f('0xf'));var toCsv=require(_0x314f('0x9'));var querystring=require('querystring');var Papa=require(_0x314f('0x10'));var Redis=require(_0x314f('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x314f('0x12'));var hardwareService=require(_0x314f('0x13'));var logger=require(_0x314f('0x14'))(_0x314f('0x15'));var utils=require(_0x314f('0x16'));var config=require(_0x314f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c61b4,_0x4851ca){_0x4851ca=_0x4851ca||0xcc;return function(_0x4cd76a){if(_0x4cd76a){return _0x3c61b4['sendStatus'](_0x4851ca);}return _0x3c61b4[_0x314f('0x18')](_0x4851ca)[_0x314f('0x19')]();};}function respondWithResult(_0x2bcb3d,_0xe21cb0){_0xe21cb0=_0xe21cb0||0xc8;return function(_0x41353e){if(_0x41353e){return _0x2bcb3d[_0x314f('0x18')](_0xe21cb0)[_0x314f('0x1a')](_0x41353e);}};}function respondWithFilteredResult(_0x4d8a03,_0x554678){return function(_0x2eb1a4){if(_0x2eb1a4){var _0x55a41a=_0x2eb1a4[_0x314f('0x1b')],_0x4e394c=_0x554678[_0x314f('0x1c')],_0xb4678e=_0x554678[_0x314f('0x1c')]+_0x554678['limit'],_0x5b56a8;if(_0xb4678e>=_0x55a41a){_0xb4678e=_0x55a41a;_0x5b56a8=0xc8;}else{_0x5b56a8=0xce;}_0x4d8a03['status'](_0x5b56a8);return _0x4d8a03[_0x314f('0x1d')](_0x314f('0x1e'),_0x4e394c+'-'+_0xb4678e+'/'+_0x55a41a)[_0x314f('0x1a')](_0x2eb1a4);}return null;};}function patchUpdates(_0x617f00){return function(_0x1836d7){try{jsonpatch[_0x314f('0x1f')](_0x1836d7,_0x617f00,!![]);}catch(_0x17541e){return BPromise['reject'](_0x17541e);}return _0x1836d7[_0x314f('0x20')]();};}function saveUpdates(_0x430c16,_0x1d7a58){return function(_0x468690){if(_0x468690){return _0x468690[_0x314f('0x21')](_0x430c16)['then'](function(_0x3d0914){return _0x3d0914;});}return null;};}function removeEntity(_0xe84bbb,_0x5c8159){return function(_0x11b4fe){if(_0x11b4fe){return _0x11b4fe[_0x314f('0x22')]()['then'](function(){_0xe84bbb[_0x314f('0x18')](0xcc)[_0x314f('0x19')]();});}};}function handleEntityNotFound(_0x33c657,_0x598240){return function(_0x44efdf){if(!_0x44efdf){_0x33c657['sendStatus'](0x194);}return _0x44efdf;};}function handleError(_0x3b8da6,_0x5ce0cf){_0x5ce0cf=_0x5ce0cf||0x1f4;return function(_0x391fca){logger['error'](_0x391fca[_0x314f('0x23')]);if(_0x391fca[_0x314f('0x24')]){delete _0x391fca[_0x314f('0x24')];}_0x3b8da6[_0x314f('0x18')](_0x5ce0cf)[_0x314f('0x25')](_0x391fca);};}exports[_0x314f('0x26')]=function(_0x5d4832,_0x488f02){var _0x3b551e={},_0x16217f={},_0x5c7651={'count':0x0,'rows':[]};var _0x3feca1=_['map'](db['ChatTransferReport']['rawAttributes'],function(_0x27a27b){return{'name':_0x27a27b['fieldName'],'type':_0x27a27b[_0x314f('0x27')][_0x314f('0x28')]};});_0x16217f[_0x314f('0x29')]=_[_0x314f('0x2a')](_0x3feca1,_0x314f('0x24'));_0x16217f[_0x314f('0x2b')]=_['keys'](_0x5d4832[_0x314f('0x2b')]);_0x16217f[_0x314f('0x2c')]=_[_0x314f('0x2d')](_0x16217f[_0x314f('0x29')],_0x16217f[_0x314f('0x2b')]);_0x3b551e['attributes']=_[_0x314f('0x2d')](_0x16217f[_0x314f('0x29')],qs[_0x314f('0x2e')](_0x5d4832['query'][_0x314f('0x2e')]));_0x3b551e['attributes']=_0x3b551e[_0x314f('0x2f')][_0x314f('0x30')]?_0x3b551e[_0x314f('0x2f')]:_0x16217f['model'];if(!_0x5d4832['query'][_0x314f('0x31')]('nolimit')){_0x3b551e[_0x314f('0x32')]=qs[_0x314f('0x32')](_0x5d4832[_0x314f('0x2b')][_0x314f('0x32')]);_0x3b551e[_0x314f('0x1c')]=qs['offset'](_0x5d4832[_0x314f('0x2b')][_0x314f('0x1c')]);}_0x3b551e[_0x314f('0x33')]=qs[_0x314f('0x34')](_0x5d4832['query'][_0x314f('0x34')]);_0x3b551e[_0x314f('0x35')]=qs[_0x314f('0x2c')](_[_0x314f('0x36')](_0x5d4832['query'],_0x16217f[_0x314f('0x2c')]));if(_0x5d4832[_0x314f('0x2b')][_0x314f('0x37')]){_0x3b551e['where']=_[_0x314f('0x38')](_0x3b551e['where'],{'$or':_[_0x314f('0x2a')](_0x3feca1,function(_0x33471f){if(_0x33471f[_0x314f('0x27')]!==_0x314f('0x39')){var _0x46de00={};_0x46de00[_0x33471f[_0x314f('0x24')]]={'$like':'%'+_0x5d4832['query'][_0x314f('0x37')]+'%'};return _0x46de00;}})});}_0x3b551e=_[_0x314f('0x38')]({},_0x3b551e,_0x5d4832['options']);var _0x3cca3c={'where':_0x3b551e[_0x314f('0x35')]};return db[_0x314f('0x3a')][_0x314f('0x1b')](_0x3cca3c)[_0x314f('0x3b')](function(_0x10dc0d){_0x5c7651[_0x314f('0x1b')]=_0x10dc0d;if(_0x5d4832[_0x314f('0x2b')][_0x314f('0x3c')]){_0x3b551e['include']=[{'all':!![]}];}return db[_0x314f('0x3a')][_0x314f('0x3d')](_0x3b551e);})['then'](function(_0x310a3b){_0x5c7651['rows']=_0x310a3b;return _0x5c7651;})[_0x314f('0x3b')](respondWithFilteredResult(_0x488f02,_0x3b551e))[_0x314f('0x3e')](handleError(_0x488f02,null));};exports[_0x314f('0x3f')]=function(_0x3fd234,_0x198c5d){var _0x4ef96b={'raw':!![],'where':{'id':_0x3fd234[_0x314f('0x40')]['id']}},_0x3c4d2e={};_0x3c4d2e[_0x314f('0x29')]=_[_0x314f('0x41')](db[_0x314f('0x3a')][_0x314f('0x42')]);_0x3c4d2e[_0x314f('0x2b')]=_['keys'](_0x3fd234[_0x314f('0x2b')]);_0x3c4d2e[_0x314f('0x2c')]=_[_0x314f('0x2d')](_0x3c4d2e[_0x314f('0x29')],_0x3c4d2e['query']);_0x4ef96b[_0x314f('0x2f')]=_[_0x314f('0x2d')](_0x3c4d2e['model'],qs[_0x314f('0x2e')](_0x3fd234[_0x314f('0x2b')][_0x314f('0x2e')]));_0x4ef96b[_0x314f('0x2f')]=_0x4ef96b[_0x314f('0x2f')]['length']?_0x4ef96b[_0x314f('0x2f')]:_0x3c4d2e[_0x314f('0x29')];if(_0x3fd234['query'][_0x314f('0x3c')]){_0x4ef96b[_0x314f('0x43')]=[{'all':!![]}];}_0x4ef96b=_[_0x314f('0x38')]({},_0x4ef96b,_0x3fd234[_0x314f('0x44')]);return db[_0x314f('0x3a')]['find'](_0x4ef96b)[_0x314f('0x3b')](handleEntityNotFound(_0x198c5d,null))[_0x314f('0x3b')](respondWithResult(_0x198c5d,null))[_0x314f('0x3e')](handleError(_0x198c5d,null));};exports[_0x314f('0x45')]=function(_0x3ae3f9,_0xacc8b6){return db[_0x314f('0x3a')][_0x314f('0x45')](_0x3ae3f9[_0x314f('0x46')],{})['then'](respondWithResult(_0xacc8b6,0xc9))['catch'](handleError(_0xacc8b6,null));};exports[_0x314f('0x21')]=function(_0x535ec8,_0xe809af){if(_0x535ec8['body']['id']){delete _0x535ec8[_0x314f('0x46')]['id'];}return db[_0x314f('0x3a')][_0x314f('0x47')]({'where':{'id':_0x535ec8[_0x314f('0x40')]['id']}})[_0x314f('0x3b')](handleEntityNotFound(_0xe809af,null))[_0x314f('0x3b')](saveUpdates(_0x535ec8[_0x314f('0x46')],null))[_0x314f('0x3b')](respondWithResult(_0xe809af,null))[_0x314f('0x3e')](handleError(_0xe809af,null));};exports['destroy']=function(_0x2f8a06,_0x452a02){return db[_0x314f('0x3a')][_0x314f('0x47')]({'where':{'id':_0x2f8a06[_0x314f('0x40')]['id']}})[_0x314f('0x3b')](handleEntityNotFound(_0x452a02,null))[_0x314f('0x3b')](removeEntity(_0x452a02,null))[_0x314f('0x3e')](handleError(_0x452a02,null));};exports[_0x314f('0x48')]=function(_0x367bc9,_0x23629e){return db['ChatTransferReport'][_0x314f('0x48')]()[_0x314f('0x3b')](respondWithResult(_0x23629e,null))[_0x314f('0x3e')](handleError(_0x23629e,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 0ac5989..c0da54d 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 _0x7006=['path','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','lodash','util','api','moment','bluebird'];(function(_0x4db38f,_0x44ce7c){var _0x49c92f=function(_0x153b58){while(--_0x153b58){_0x4db38f['push'](_0x4db38f['shift']());}};_0x49c92f(++_0x44ce7c);}(_0x7006,0xa3));var _0x6700=function(_0x18f64a,_0x1c8248){_0x18f64a=_0x18f64a-0x0;var _0x44687f=_0x7006[_0x18f64a];return _0x44687f;};'use strict';var _=require(_0x6700('0x0'));var util=require(_0x6700('0x1'));var logger=require('../../config/logger')(_0x6700('0x2'));var moment=require(_0x6700('0x3'));var BPromise=require(_0x6700('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6700('0x5'));var rimraf=require('rimraf');var config=require(_0x6700('0x6'));var attributes=require(_0x6700('0x7'));module[_0x6700('0x8')]=function(_0x234f3c,_0x573539){return _0x234f3c[_0x6700('0x9')](_0x6700('0xa'),attributes,{'tableName':_0x6700('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa395=['util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','uniqueid','lodash'];(function(_0x2bd18c,_0x479977){var _0x3be350=function(_0x4c7d96){while(--_0x4c7d96){_0x2bd18c['push'](_0x2bd18c['shift']());}};_0x3be350(++_0x479977);}(_0xa395,0x14f));var _0x5a39=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa395[_0x2a6809];return _0x11c371;};'use strict';var _=require(_0x5a39('0x0'));var util=require(_0x5a39('0x1'));var logger=require(_0x5a39('0x2'))('api');var moment=require(_0x5a39('0x3'));var BPromise=require(_0x5a39('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5a39('0x5'));var rimraf=require(_0x5a39('0x6'));var config=require(_0x5a39('0x7'));var attributes=require(_0x5a39('0x8'));module[_0x5a39('0x9')]=function(_0x178b5f,_0x261187){return _0x178b5f[_0x5a39('0xa')]('ChatTransferReport',attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x5a39('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 7cd5faa..f2aca55 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 _0x074f=['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','stringify','error','code','message','result','lodash','randomstring'];(function(_0x51fd25,_0x2fcbb){var _0x4529ae=function(_0x17ed81){while(--_0x17ed81){_0x51fd25['push'](_0x51fd25['shift']());}};_0x4529ae(++_0x2fcbb);}(_0x074f,0x15e));var _0xf074=function(_0x40c009,_0x5982fc){_0x40c009=_0x40c009-0x0;var _0x5ca863=_0x074f[_0x40c009];return _0x5ca863;};'use strict';var _=require(_0xf074('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf074('0x1'));var fs=require('fs');var Redis=require(_0xf074('0x2'));var db=require(_0xf074('0x3'))['db'];var utils=require(_0xf074('0x4'));var logger=require(_0xf074('0x5'))('rpc');var config=require(_0xf074('0x6'));var jayson=require(_0xf074('0x7'));var client=jayson[_0xf074('0x8')][_0xf074('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf1a13c,_0x4234f5,_0x213da3){return new BPromise(function(_0x11fad8,_0x44193b){return client[_0xf074('0xa')](_0xf1a13c,_0x213da3)[_0xf074('0xb')](function(_0x3a7d8c){logger[_0xf074('0xc')](_0xf074('0xd'),_0x4234f5,_0xf074('0xe'));logger[_0xf074('0xf')](_0xf074('0x10'),_0x4234f5,'request\x20sent',JSON[_0xf074('0x11')](_0x3a7d8c));if(_0x3a7d8c[_0xf074('0x12')]){if(_0x3a7d8c['error'][_0xf074('0x13')]===0x1f4){logger[_0xf074('0x12')](_0xf074('0xd'),_0x4234f5,_0x3a7d8c[_0xf074('0x12')][_0xf074('0x14')]);return _0x44193b(_0x3a7d8c[_0xf074('0x12')]['message']);}logger[_0xf074('0x12')](_0xf074('0xd'),_0x4234f5,_0x3a7d8c[_0xf074('0x12')][_0xf074('0x14')]);return _0x11fad8(_0x3a7d8c[_0xf074('0x12')][_0xf074('0x14')]);}else{logger[_0xf074('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x4234f5,_0xf074('0xe'));_0x11fad8(_0x3a7d8c[_0xf074('0x15')][_0xf074('0x14')]);}})['catch'](function(_0x3195fd){logger[_0xf074('0x12')](_0xf074('0xd'),_0x4234f5,_0x3195fd);_0x44193b(_0x3195fd);});});} \ No newline at end of file +var _0x207e=['error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','ChatTransferReport,\x20%s,\x20%s','ChatTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x5f4cbe,_0x454b60){var _0x68e362=function(_0x499c05){while(--_0x499c05){_0x5f4cbe['push'](_0x5f4cbe['shift']());}};_0x68e362(++_0x454b60);}(_0x207e,0x1bf));var _0xe207=function(_0x50f3e8,_0x57ddec){_0x50f3e8=_0x50f3e8-0x0;var _0x4797a6=_0x207e[_0x50f3e8];return _0x4797a6;};'use strict';var _=require(_0xe207('0x0'));var util=require(_0xe207('0x1'));var moment=require(_0xe207('0x2'));var BPromise=require('bluebird');var rs=require(_0xe207('0x3'));var fs=require('fs');var Redis=require(_0xe207('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe207('0x5'));var logger=require(_0xe207('0x6'))(_0xe207('0x7'));var config=require(_0xe207('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe207('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36b204,_0x48a94f,_0x1f2386){return new BPromise(function(_0x34ac77,_0x8e4633){return client[_0xe207('0xa')](_0x36b204,_0x1f2386)[_0xe207('0xb')](function(_0x547e19){logger[_0xe207('0xc')](_0xe207('0xd'),_0x48a94f,'request\x20sent');logger['debug'](_0xe207('0xe'),_0x48a94f,'request\x20sent',JSON['stringify'](_0x547e19));if(_0x547e19[_0xe207('0xf')]){if(_0x547e19[_0xe207('0xf')][_0xe207('0x10')]===0x1f4){logger[_0xe207('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x48a94f,_0x547e19[_0xe207('0xf')]['message']);return _0x8e4633(_0x547e19[_0xe207('0xf')]['message']);}logger[_0xe207('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x48a94f,_0x547e19['error'][_0xe207('0x11')]);return _0x34ac77(_0x547e19['error'][_0xe207('0x11')]);}else{logger[_0xe207('0xc')](_0xe207('0xd'),_0x48a94f,_0xe207('0x12'));_0x34ac77(_0x547e19[_0xe207('0x13')][_0xe207('0x11')]);}})[_0xe207('0x14')](function(_0x4b0e7c){logger[_0xe207('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x48a94f,_0x4b0e7c);_0x8e4633(_0x4b0e7c);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 7b5dde4..a839712 100644 --- a/server/api/chatTransferReport/index.js +++ b/server/api/chatTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['/describe','/:id','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x23e544,_0x6bafc2){var _0x276fba=function(_0xf32dd2){while(--_0xf32dd2){_0x23e544['push'](_0x23e544['shift']());}};_0x276fba(++_0x6bafc2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1d3e15,_0x2d4ba5){_0x1d3e15=_0x1d3e15-0x0;var _0x3f6062=_0x5f2f[_0x1d3e15];return _0x3f6062;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./chatTransferReport.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['describe']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0xd')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xe')]);router['put'](_0xf5f2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xf5f2('0xf')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);module[_0xf5f2('0x11')]=router; \ No newline at end of file +var _0xb10b=['../../config/environment','./chatTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x123623,_0x9694e2){var _0x3b00d1=function(_0x7e48e0){while(--_0x7e48e0){_0x123623['push'](_0x123623['shift']());}};_0x3b00d1(++_0x9694e2);}(_0xb10b,0x12a));var _0xbb10=function(_0x5c918d,_0x1ca4a7){_0x5c918d=_0x5c918d-0x0;var _0x3c4d98=_0xb10b[_0x5c918d];return _0x3c4d98;};'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('0xe')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0xf')]);router['put']('/:id',auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router[_0xbb10('0x11')]('/:id',auth[_0xbb10('0x9')](),controller['destroy']);module[_0xbb10('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 29352a6..83349b8 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 _0xcc35=['Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','input','name','onlineForm','getDataValue','stringify','Comments','offlineForm','setDataValue','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','address','email','Agent','#9f946a','#ffffff','INTEGER','ENUM','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','BOOLEAN'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xcc35,0xda));var _0x5cc3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcc35[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x5cc3('0x0'));var rs=require(_0x5cc3('0x1'));module[_0x5cc3('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x5cc3('0x3')],'allowNull':![],'unique':_0x5cc3('0x4')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x5cc3('0x3')],'defaultValue':_0x5cc3('0x5')},'mapKeyOffline':{'type':Sequelize[_0x5cc3('0x3')],'defaultValue':_0x5cc3('0x5')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x5cc3('0x6')},'customerAlias':{'type':Sequelize[_0x5cc3('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x5cc3('0x3')],'allowNull':![],'defaultValue':_0x5cc3('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x5cc3('0x3')],'allowNull':![],'defaultValue':'#9f946a','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x5cc3('0x3')],'allowNull':![],'defaultValue':_0x5cc3('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x5cc3('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x5cc3('0x3')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x5cc3('0xa')](_0x5cc3('0xb'),'squared'),'defaultValue':_0x5cc3('0xb')},'header_online':{'type':Sequelize[_0x5cc3('0x3')],'defaultValue':_0x5cc3('0xc')},'start_chat_button':{'type':Sequelize[_0x5cc3('0x3')],'defaultValue':_0x5cc3('0xd')},'offline_chat_button':{'type':Sequelize[_0x5cc3('0x3')],'defaultValue':_0x5cc3('0xe')},'header_offline':{'type':Sequelize[_0x5cc3('0x3')],'defaultValue':_0x5cc3('0xf')},'download_transcript':{'type':Sequelize[_0x5cc3('0x10')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x5cc3('0x9')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x5cc3('0x3')],'defaultValue':_0x5cc3('0x11')},'defaultWhiteLabel':{'type':Sequelize[_0x5cc3('0x10')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x5cc3('0x12')]},'closingQuestion':{'type':Sequelize[_0x5cc3('0x3')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x5cc3('0x13')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0x5cc3('0x3')],'defaultValue':_0x5cc3('0x14')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x5cc3('0x15')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x5cc3('0x16')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x5cc3('0x17')},'conditionAgreement':{'type':Sequelize[_0x5cc3('0x10')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x5cc3('0x10')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x5cc3('0x10')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x5cc3('0x18')},'ratingType':{'type':Sequelize[_0x5cc3('0xa')](_0x5cc3('0x19'),_0x5cc3('0x1a')),'defaultValue':_0x5cc3('0x19')},'ratingStarsNumber':{'type':Sequelize[_0x5cc3('0x9')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x5cc3('0x12')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x5cc3('0x1b'),'variable':null,'config':{'placeholder':_0x5cc3('0x1c'),'type':'text','required':!![]},'props':{'title':_0x5cc3('0x1c'),'helpText':''}},{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x5cc3('0x5'),'type':_0x5cc3('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x5cc3('0x1d'))?JSON['parse'](this[_0x5cc3('0x1e')]('onlineForm')):{};},'set':function(_0x3f50d0){return this['setDataValue'](_0x5cc3('0x1d'),JSON['stringify'](_0x3f50d0));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x5cc3('0x1f')]({'items':[{'type':'input','props':{'title':_0x5cc3('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x5cc3('0x5'),'type':_0x5cc3('0x5')},'variable':null},{'type':'textarea','config':{'placeholder':_0x5cc3('0x20')},'props':{'title':'Comments','helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x5cc3('0x1e')](_0x5cc3('0x21'))?JSON['parse'](this[_0x5cc3('0x1e')](_0x5cc3('0x21'))):{};},'set':function(_0x5dd8ae){return this[_0x5cc3('0x22')](_0x5cc3('0x21'),JSON[_0x5cc3('0x1f')](_0x5dd8ae));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x5cc3('0x23')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x5cc3('0x10')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x5cc3('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x5cc3('0x24')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x5cc3('0x25')},'offlineMessageSubject':{'type':Sequelize[_0x5cc3('0x3')],'defaultValue':_0x5cc3('0x26')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x5cc3('0x27')},'enableUnmanagedNote':{'type':Sequelize[_0x5cc3('0x10')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x5cc3('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x5cc3('0x3')],'defaultValue':_0x5cc3('0x17')},'sendUnmanaged':{'type':Sequelize[_0x5cc3('0x3')],'defaultValue':_0x5cc3('0xe')},'enableCustomerAttachment':{'type':Sequelize[_0x5cc3('0x10')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x5cc3('0x10')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x5cc3('0x12')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x5cc3('0x3')]},'notificationTemplate':{'type':Sequelize[_0x5cc3('0x12')],'defaultValue':function(){return _0x5cc3('0x28');}},'notificationSound':{'type':Sequelize[_0x5cc3('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5cc3('0x10')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x5cc3('0x10')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x5cc3('0x3')],'defaultValue':_0x5cc3('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0x5cc3('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x5cc3('0x3')],'defaultValue':_0x5cc3('0x2a')},'verticalAlignment':{'type':Sequelize[_0x5cc3('0x9')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x5cc3('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x5cc3('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x5cc3('0x10')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x5cc3('0x9')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x5cc3('0x3')],'allowNull':![],'defaultValue':_0x5cc3('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x5cc3('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5cc3('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5cc3('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x5cc3('0x3')],'defaultValue':_0x5cc3('0x2c')},'systemAvatar':{'type':Sequelize[_0x5cc3('0x12')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5cc3('0x9')],'comment':_0x5cc3('0x2d')},'mandatoryDisposition':{'type':Sequelize[_0x5cc3('0x10')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2b6c2d){if(!_0x2b6c2d)this[_0x5cc3('0x22')](_0x5cc3('0x2e'),null);this[_0x5cc3('0x22')]('mandatoryDisposition',_0x2b6c2d);}}}; \ No newline at end of file +var _0xb344=['Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','alternate','System','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','address','Agent','#9f946a','#ffffff','BOOLEAN','ENUM','rounded','squared','Chat','Send','Contact\x20us','INTEGER','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Feedback','star','thumb','stringify','input','name','text','email','onlineForm','parse','setDataValue','textarea','Comments','Leave\x20your\x20comments','getDataValue','offlineForm'];(function(_0x4984f2,_0x2e9df1){var _0x2ee15e=function(_0x2aa8ef){while(--_0x2aa8ef){_0x4984f2['push'](_0x4984f2['shift']());}};_0x2ee15e(++_0x2e9df1);}(_0xb344,0xce));var _0x4b34=function(_0x5f87a7,_0x56023e){_0x5f87a7=_0x5f87a7-0x0;var _0x4337fb=_0xb344[_0x5f87a7];return _0x4337fb;};'use strict';var Sequelize=require(_0x4b34('0x0'));var rs=require(_0x4b34('0x1'));module[_0x4b34('0x2')]={'name':{'type':Sequelize[_0x4b34('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x4b34('0x3')],'allowNull':![],'unique':_0x4b34('0x4')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':'email'},'key':{'type':Sequelize[_0x4b34('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x4b34('0x5')},'customerAlias':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x4b34('0x3')],'allowNull':![],'defaultValue':'#9f946a','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x4b34('0x3')],'allowNull':![],'defaultValue':_0x4b34('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x4b34('0x3')],'allowNull':![],'defaultValue':_0x4b34('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x4b34('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x4b34('0x9')](_0x4b34('0xa'),_0x4b34('0xb')),'defaultValue':_0x4b34('0xa')},'header_online':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':_0x4b34('0xc')},'offline_chat_button':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':_0x4b34('0xd')},'header_offline':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':_0x4b34('0xe')},'download_transcript':{'type':Sequelize[_0x4b34('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x4b34('0xf')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x4b34('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x4b34('0x10')]},'closingQuestion':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':_0x4b34('0x11')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x4b34('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':_0x4b34('0x13')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x4b34('0x14')},'placeholderMessage':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':_0x4b34('0x15')},'closingMessage':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':_0x4b34('0x16')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x4b34('0xd')},'skipMessageButton':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x4b34('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':_0x4b34('0x17')},'ratingType':{'type':Sequelize[_0x4b34('0x9')](_0x4b34('0x18'),_0x4b34('0x19')),'defaultValue':_0x4b34('0x18')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x4b34('0x10')],'defaultValue':function(){return JSON[_0x4b34('0x1a')]({'items':[{'type':_0x4b34('0x1b'),'variable':null,'config':{'placeholder':_0x4b34('0x1c'),'type':_0x4b34('0x1d'),'required':!![]},'props':{'title':_0x4b34('0x1c'),'helpText':''}},{'type':_0x4b34('0x1b'),'props':{'title':_0x4b34('0x1e'),'helpText':''},'config':{'required':!![],'placeholder':_0x4b34('0x1e'),'type':_0x4b34('0x1e')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x4b34('0x1f'))?JSON[_0x4b34('0x20')](this['getDataValue'](_0x4b34('0x1f'))):{};},'set':function(_0x193c5b){return this[_0x4b34('0x21')](_0x4b34('0x1f'),JSON[_0x4b34('0x1a')](_0x193c5b));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x4b34('0x1a')]({'items':[{'type':_0x4b34('0x1b'),'props':{'title':_0x4b34('0x1e'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x4b34('0x1e')},'variable':null},{'type':_0x4b34('0x22'),'config':{'placeholder':_0x4b34('0x23')},'props':{'title':_0x4b34('0x23'),'helpText':_0x4b34('0x24')}}],'fromKey':0x0});},'get':function(){return this[_0x4b34('0x25')]('offlineForm')?JSON[_0x4b34('0x20')](this[_0x4b34('0x25')](_0x4b34('0x26'))):{};},'set':function(_0x348270){return this[_0x4b34('0x21')]('offlineForm',JSON['stringify'](_0x348270));}},'token':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x4b34('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x4b34('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x4b34('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':_0x4b34('0x27')},'offlineMessageSubject':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':_0x4b34('0x28')},'offlineMessageBody':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':_0x4b34('0x29')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':_0x4b34('0x2a')},'skipUnmanaged':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':_0x4b34('0x2b')},'sendUnmanaged':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x4b34('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x4b34('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x4b34('0x10')]},'showAgentAvatar':{'type':Sequelize[_0x4b34('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x4b34('0x3')]},'notificationTemplate':{'type':Sequelize[_0x4b34('0x10')],'defaultValue':function(){return _0x4b34('0x2c');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4b34('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x4b34('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':_0x4b34('0x2d')},'waitForTheAssignedAgent':{'type':Sequelize[_0x4b34('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':_0x4b34('0x2e')},'defaultTitle':{'type':Sequelize[_0x4b34('0x3')]},'customerAvatar':{'type':Sequelize[_0x4b34('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0x4b34('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x4b34('0xf')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x4b34('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x4b34('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4b34('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x4b34('0x3')],'defaultValue':_0x4b34('0x2f')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x4b34('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x590bce){if(!_0x590bce)this[_0x4b34('0x21')](_0x4b34('0x30'),null);this[_0x4b34('0x21')]('mandatoryDisposition',_0x590bce);}}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 6738fe5..38613c7 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 _0xdffa=['include','rows','catch','show','mandatoryDispositionPause','keys','options','find','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','nolimit','pick','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','length','removeAnswers','addLogo','sitepic','filename','agentAvatar','file','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','root','server/files/images/logos/default_logo.png','../../config/license/util','getLicense','custom','existsSync','server/files/images/logos/','download','getAvatar','join','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','isNil','setUA','headers','user-agent','getResult','CmContact','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Applications','account','applications','list','orderBy','asc','Contacts','ListId','contact','first','x-forwarded-for','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','messageId','autoclose','close','*,*,*,*','AttachmentId','User','UserId','agent','waitForTheAssignedAgent','forcedOwnership','startRouting','EventManager','notify','offline','send','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','render','offlineMessageBody','MailServerOut','forwardOfflineAddress','Smtp','service','host','port','secure','authentication','auth','user','pass','SendMail','offlineMessageSubject','addInteraction','omit','Contact','Owner','fullname','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','Interval','virtual','License','increment','chatLicenseExceeded','Intervals','push','all','some','readFileSync','remote','connection','remoteAddress','alignment','textColor','addApplications','transaction','ChatApplication','bulkCreate','findAndCountAll','priority','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','getFields','online','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','addAgents','spread','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','client','http','ValidationError','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','status','end','offset','set','json','apply','reject','update','destroy','get','ChatWebsites','UserProfileResource','sendStatus','stack','name','Pause','map','ChatWebsite','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','filter','VIRTUAL','merge','count','includeAll'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xdffa,0xca));var _0xadff=function(_0x213dd9,_0x45789c){_0x213dd9=_0x213dd9-0x0;var _0x21b837=_0xdffa[_0x213dd9];return _0x21b837;};'use strict';var pdf=require(_0xadff('0x0'));var emlformat=require(_0xadff('0x1'));var rimraf=require(_0xadff('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xadff('0x3'));var moment=require(_0xadff('0x4'));var BPromise=require(_0xadff('0x5'));var Mustache=require(_0xadff('0x6'));var util=require(_0xadff('0x7'));var path=require(_0xadff('0x8'));var sox=require(_0xadff('0x9'));var csv=require(_0xadff('0xa'));var ejs=require(_0xadff('0xb'));var fs=require('fs');var _=require(_0xadff('0xc'));var squel=require(_0xadff('0xd'));var crypto=require(_0xadff('0xe'));var jsforce=require(_0xadff('0xf'));var deskjs=require(_0xadff('0x10'));var toCsv=require(_0xadff('0xa'));var querystring=require(_0xadff('0x11'));var Papa=require(_0xadff('0x12'));var Redis=require('ioredis');var authService=require(_0xadff('0x13'));var qs=require(_0xadff('0x14'));var as=require(_0xadff('0x15'));var hardwareService=require(_0xadff('0x16'));var logger=require(_0xadff('0x17'))('api');var utils=require(_0xadff('0x18'));var config=require('../../config/environment');var db=require(_0xadff('0x19'))['db'];config[_0xadff('0x1a')]=_[_0xadff('0x1b')](config[_0xadff('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xadff('0x1c'))(new Redis(config[_0xadff('0x1a')]));require(_0xadff('0x1d'))[_0xadff('0x1e')](socket);var jayson=require(_0xadff('0x1f'));var client=jayson[_0xadff('0x20')][_0xadff('0x21')]({'port':0x232c});var client9002=jayson[_0xadff('0x20')][_0xadff('0x21')]({'port':0x232a});var client9003=jayson['client'][_0xadff('0x21')]({'port':0x232b});function checkPasswordPattern(_0x183ee5,_0x55eca7,_0x3a2e11){if(_0x3a2e11){var _0x21c5d6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x21c5d6['test'](_0x55eca7)){return _0x183ee5;}else{throw new db['Sequelize'][(_0xadff('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 _0x183ee5;}}function respondWithRpcPromise(_0x315e47,_0x43b693,_0x2fd816,_0x4b1eaa){return new BPromise(function(_0x58ef27,_0xe97386){var _0x47387c=_0x4b1eaa||client;return _0x47387c[_0xadff('0x23')](_0x315e47,_0x2fd816)[_0xadff('0x24')](function(_0x186750){logger[_0xadff('0x25')](_0xadff('0x26'),_0x43b693,_0xadff('0x27'));logger[_0xadff('0x28')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x43b693,_0xadff('0x27'),JSON[_0xadff('0x29')](_0x186750));if(_0x186750[_0xadff('0x2a')]){if(_0x186750[_0xadff('0x2a')][_0xadff('0x2b')]===0x1f4){logger[_0xadff('0x2a')]('ChatWebsite,\x20%s,\x20%s',_0x43b693,_0x186750[_0xadff('0x2a')][_0xadff('0x2c')]);return _0xe97386(_0x186750['error']['message']);}logger[_0xadff('0x2a')](_0xadff('0x26'),_0x43b693,_0x186750[_0xadff('0x2a')]['message']);return _0x58ef27(_0x186750[_0xadff('0x2a')][_0xadff('0x2c')]);}else{logger[_0xadff('0x25')](_0xadff('0x26'),_0x43b693,_0xadff('0x27'));_0x58ef27(_0x186750[_0xadff('0x2d')][_0xadff('0x2c')]);}})['catch'](function(_0x187f8e){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x43b693,_0x187f8e);_0xe97386(_0x187f8e);});});}function respondWithStatusCode(_0x52bfb4,_0x5ce529){_0x5ce529=_0x5ce529||0xcc;return function(_0x41618a){if(_0x41618a){return _0x52bfb4['sendStatus'](_0x5ce529);}return _0x52bfb4[_0xadff('0x2e')](_0x5ce529)[_0xadff('0x2f')]();};}function respondWithResult(_0x234771,_0x178286){_0x178286=_0x178286||0xc8;return function(_0x1de2fc){if(_0x1de2fc){return _0x234771[_0xadff('0x2e')](_0x178286)['json'](_0x1de2fc);}};}function respondWithFilteredResult(_0x1acf64,_0x21e855){return function(_0x6d50f7){if(_0x6d50f7){var _0x307c63=_0x6d50f7['count'],_0x4115ce=_0x21e855['offset'],_0x720fff=_0x21e855[_0xadff('0x30')]+_0x21e855['limit'],_0x21f48b;if(_0x720fff>=_0x307c63){_0x720fff=_0x307c63;_0x21f48b=0xc8;}else{_0x21f48b=0xce;}_0x1acf64['status'](_0x21f48b);return _0x1acf64[_0xadff('0x31')]('Content-Range',_0x4115ce+'-'+_0x720fff+'/'+_0x307c63)[_0xadff('0x32')](_0x6d50f7);}return null;};}function patchUpdates(_0x4fc8b0){return function(_0xc769ad){try{jsonpatch[_0xadff('0x33')](_0xc769ad,_0x4fc8b0,!![]);}catch(_0x5a2976){return BPromise[_0xadff('0x34')](_0x5a2976);}return _0xc769ad['save']();};}function saveUpdates(_0x311e5d,_0x1c0233){return function(_0x170c39){if(_0x170c39){return _0x170c39[_0xadff('0x35')](_0x311e5d)[_0xadff('0x24')](function(_0x1c4bf1){return _0x1c4bf1;});}return null;};}function removeEntity(_0x156b23,_0x2035ca){return function(_0x2ae9a9){if(_0x2ae9a9){return _0x2ae9a9[_0xadff('0x36')]()[_0xadff('0x24')](function(){var _0x3c96e2=_0x2ae9a9[_0xadff('0x37')]({'plain':!![]});var _0x26384a=_0xadff('0x38');return db[_0xadff('0x39')]['destroy']({'where':{'type':_0x26384a,'resourceId':_0x3c96e2['id']}})['then'](function(){return _0x2ae9a9;});})[_0xadff('0x24')](function(){_0x156b23['status'](0xcc)[_0xadff('0x2f')]();});}};}function handleEntityNotFound(_0x518066,_0x1e2bcb){return function(_0x569282){if(!_0x569282){_0x518066[_0xadff('0x3a')](0x194);}return _0x569282;};}function handleError(_0x80254,_0x147a79){_0x147a79=_0x147a79||0x1f4;return function(_0x1d07c6){logger[_0xadff('0x2a')](_0x1d07c6[_0xadff('0x3b')]);if(_0x1d07c6[_0xadff('0x3c')]){delete _0x1d07c6[_0xadff('0x3c')];}_0x80254['status'](_0x147a79)['send'](_0x1d07c6);};}exports['index']=function(_0x530b4b,_0x38a695){var _0x414214={'include':[{'model':db[_0xadff('0x3d')],'as':'mandatoryDispositionPause'}]},_0x287929={},_0x40c2e5={'count':0x0,'rows':[]};var _0x14f5f8=_[_0xadff('0x3e')](db[_0xadff('0x3f')][_0xadff('0x40')],function(_0x144e59){return{'name':_0x144e59[_0xadff('0x41')],'type':_0x144e59[_0xadff('0x42')]['key']};});_0x287929[_0xadff('0x43')]=_[_0xadff('0x3e')](_0x14f5f8,_0xadff('0x3c'));_0x287929[_0xadff('0x44')]=_['keys'](_0x530b4b[_0xadff('0x44')]);_0x287929[_0xadff('0x45')]=_[_0xadff('0x46')](_0x287929['model'],_0x287929[_0xadff('0x44')]);_0x414214[_0xadff('0x47')]=_['intersection'](_0x287929[_0xadff('0x43')],qs['fields'](_0x530b4b['query'][_0xadff('0x48')]));_0x414214[_0xadff('0x47')]=_0x414214[_0xadff('0x47')]['length']?_0x414214[_0xadff('0x47')]:_0x287929[_0xadff('0x43')];if(!_0x530b4b[_0xadff('0x44')][_0xadff('0x49')]('nolimit')){_0x414214[_0xadff('0x4a')]=qs['limit'](_0x530b4b['query'][_0xadff('0x4a')]);_0x414214[_0xadff('0x30')]=qs['offset'](_0x530b4b[_0xadff('0x44')]['offset']);}_0x414214[_0xadff('0x4b')]=qs['sort'](_0x530b4b['query'][_0xadff('0x4c')]);_0x414214[_0xadff('0x4d')]=qs[_0xadff('0x45')](_['pick'](_0x530b4b[_0xadff('0x44')],_0x287929['filters']));if(_0x530b4b[_0xadff('0x44')][_0xadff('0x4e')]){_0x414214[_0xadff('0x4d')]=_['merge'](_0x414214['where'],{'$or':_['map'](_0x14f5f8,function(_0x52b7fa){if(_0x52b7fa[_0xadff('0x42')]!==_0xadff('0x4f')){var _0x266a97={};_0x266a97[_0x52b7fa['name']]={'$like':'%'+_0x530b4b[_0xadff('0x44')]['filter']+'%'};return _0x266a97;}})});}_0x414214=_[_0xadff('0x50')]({},_0x414214,_0x530b4b['options']);var _0x58b001={'where':_0x414214['where']};return db[_0xadff('0x3f')]['count'](_0x58b001)[_0xadff('0x24')](function(_0x41581e){_0x40c2e5[_0xadff('0x51')]=_0x41581e;if(_0x530b4b[_0xadff('0x44')][_0xadff('0x52')]){_0x414214[_0xadff('0x53')]=[{'all':!![]}];}return db[_0xadff('0x3f')]['findAll'](_0x414214);})['then'](function(_0x5f1a9b){_0x40c2e5[_0xadff('0x54')]=_0x5f1a9b;return _0x40c2e5;})['then'](respondWithFilteredResult(_0x38a695,_0x414214))[_0xadff('0x55')](handleError(_0x38a695,null));};exports[_0xadff('0x56')]=function(_0x3f22a6,_0x1fbac1){var _0x558cce={'raw':![],'where':{'id':_0x3f22a6['params']['id']},'include':[{'model':db[_0xadff('0x3d')],'as':_0xadff('0x57')}]},_0x3bb1e2={};_0x3bb1e2[_0xadff('0x43')]=_[_0xadff('0x58')](db[_0xadff('0x3f')][_0xadff('0x40')]);_0x3bb1e2[_0xadff('0x44')]=_[_0xadff('0x58')](_0x3f22a6[_0xadff('0x44')]);_0x3bb1e2[_0xadff('0x45')]=_['intersection'](_0x3bb1e2[_0xadff('0x43')],_0x3bb1e2[_0xadff('0x44')]);_0x558cce[_0xadff('0x47')]=_[_0xadff('0x46')](_0x3bb1e2[_0xadff('0x43')],qs[_0xadff('0x48')](_0x3f22a6[_0xadff('0x44')][_0xadff('0x48')]));_0x558cce[_0xadff('0x47')]=_0x558cce[_0xadff('0x47')]['length']?_0x558cce[_0xadff('0x47')]:_0x3bb1e2[_0xadff('0x43')];if(_0x3f22a6['query'][_0xadff('0x52')]){_0x558cce[_0xadff('0x53')]=[{'all':!![]}];}_0x558cce=_[_0xadff('0x50')]({},_0x558cce,_0x3f22a6[_0xadff('0x59')]);return db[_0xadff('0x3f')][_0xadff('0x5a')](_0x558cce)[_0xadff('0x24')](handleEntityNotFound(_0x1fbac1,null))[_0xadff('0x24')](respondWithResult(_0x1fbac1,null))[_0xadff('0x55')](handleError(_0x1fbac1,null));};exports['create']=function(_0x51679b,_0x3a128f){return db[_0xadff('0x3f')]['create'](_0x51679b['body'],{})[_0xadff('0x24')](function(_0x551d23){var _0x46b515=_0x51679b['user'][_0xadff('0x37')]({'plain':!![]});if(!_0x46b515)throw new Error(_0xadff('0x5b'));if(_0x46b515[_0xadff('0x5c')]==='user'){var _0x1fd977=_0x551d23[_0xadff('0x37')]({'plain':!![]});var _0x334419='ChatWebsites';return db[_0xadff('0x5d')][_0xadff('0x5a')]({'where':{'name':_0x334419,'userProfileId':_0x46b515[_0xadff('0x5e')]},'raw':!![]})[_0xadff('0x24')](function(_0x255a5b){if(_0x255a5b&&_0x255a5b['autoAssociation']===0x0){return db[_0xadff('0x39')][_0xadff('0x5f')]({'name':_0x1fd977[_0xadff('0x3c')],'resourceId':_0x1fd977['id'],'type':_0x255a5b['name'],'sectionId':_0x255a5b['id']},{})[_0xadff('0x24')](function(){return _0x551d23;});}else{return _0x551d23;}})[_0xadff('0x55')](function(_0x3ba379){logger[_0xadff('0x2a')](_0xadff('0x60'),_0x3ba379);throw _0x3ba379;});}return _0x551d23;})[_0xadff('0x24')](respondWithResult(_0x3a128f,0xc9))[_0xadff('0x55')](handleError(_0x3a128f,null));};exports['update']=function(_0x32ec54,_0x318238){if(_0x32ec54[_0xadff('0x61')]['id']){delete _0x32ec54['body']['id'];}return db[_0xadff('0x3f')]['find']({'where':{'id':_0x32ec54['params']['id']},'include':[{'model':db[_0xadff('0x3d')],'as':_0xadff('0x57')}]})['then'](handleEntityNotFound(_0x318238,null))[_0xadff('0x24')](saveUpdates(_0x32ec54[_0xadff('0x61')],null))['then'](respondWithResult(_0x318238,null))[_0xadff('0x55')](handleError(_0x318238,null));};exports[_0xadff('0x36')]=function(_0x4046b3,_0x4bf140){return db[_0xadff('0x3f')][_0xadff('0x5a')]({'where':{'id':_0x4046b3[_0xadff('0x62')]['id']}})['then'](handleEntityNotFound(_0x4bf140,null))[_0xadff('0x24')](removeEntity(_0x4bf140,null))[_0xadff('0x55')](handleError(_0x4bf140,null));};exports[_0xadff('0x63')]=function(_0x4f5e7e,_0xbfb1f1){return db[_0xadff('0x3f')][_0xadff('0x63')]()[_0xadff('0x24')](respondWithResult(_0xbfb1f1,null))['catch'](handleError(_0xbfb1f1,null));};exports[_0xadff('0x64')]=function(_0x597b1a,_0x19988c,_0x366436){if(_0x597b1a[_0xadff('0x61')]['id']){delete _0x597b1a['body']['id'];}return db[_0xadff('0x3f')][_0xadff('0x5a')]({'where':{'id':_0x597b1a['params']['id']}})[_0xadff('0x24')](handleEntityNotFound(_0x19988c,null))[_0xadff('0x24')](function(_0x4ea869){if(_0x4ea869){_0x597b1a[_0xadff('0x61')][_0xadff('0x65')]=_0x4ea869['id'];return db[_0xadff('0x66')][_0xadff('0x5f')](_0x597b1a[_0xadff('0x61')]);}})[_0xadff('0x24')](respondWithResult(_0x19988c,null))[_0xadff('0x55')](handleError(_0x19988c,null));};exports[_0xadff('0x67')]=function(_0x4219d6,_0xb5e85,_0x48e81b){var _0x3e9d9b={'raw':![],'where':{}};var _0x3af2d2={};var _0x19d153={'count':0x0,'rows':[]};return db[_0xadff('0x3f')][_0xadff('0x68')]({'where':{'id':_0x4219d6['params']['id']}})[_0xadff('0x24')](handleEntityNotFound(_0xb5e85,null))['then'](function(_0x270698){if(_0x270698){_0x3af2d2['model']=_[_0xadff('0x58')](db[_0xadff('0x66')][_0xadff('0x40')]);_0x3af2d2['query']=_['keys'](_0x4219d6[_0xadff('0x44')]);_0x3af2d2['filters']=_[_0xadff('0x46')](_0x3af2d2[_0xadff('0x43')],_0x3af2d2[_0xadff('0x44')]);_0x3e9d9b[_0xadff('0x47')]=_[_0xadff('0x46')](_0x3af2d2[_0xadff('0x43')],qs[_0xadff('0x48')](_0x4219d6[_0xadff('0x44')][_0xadff('0x48')]));_0x3e9d9b[_0xadff('0x47')]=_0x3e9d9b[_0xadff('0x47')]['length']?_0x3e9d9b['attributes']:_0x3af2d2[_0xadff('0x43')];if(!_0x4219d6[_0xadff('0x44')][_0xadff('0x49')](_0xadff('0x69'))){_0x3e9d9b[_0xadff('0x4a')]=qs[_0xadff('0x4a')](_0x4219d6[_0xadff('0x44')]['limit']);_0x3e9d9b['offset']=qs[_0xadff('0x30')](_0x4219d6[_0xadff('0x44')]['offset']);}_0x3e9d9b[_0xadff('0x4b')]=qs[_0xadff('0x4c')](_0x4219d6[_0xadff('0x44')][_0xadff('0x4c')]);_0x3e9d9b[_0xadff('0x4d')]=qs[_0xadff('0x45')](_[_0xadff('0x6a')](_0x4219d6['query'],_0x3af2d2['filters']));_0x3e9d9b[_0xadff('0x4d')][_0xadff('0x65')]=_0x270698['id'];if(_0x4219d6[_0xadff('0x44')][_0xadff('0x4e')]){_0x3e9d9b[_0xadff('0x4d')]=_[_0xadff('0x50')](_0x3e9d9b['where'],{'$or':_[_0xadff('0x3e')](_0x3e9d9b['attributes'],function(_0x5a7744){var _0x3cd7fd={};_0x3cd7fd[_0x5a7744]={'$like':'%'+_0x4219d6[_0xadff('0x44')][_0xadff('0x4e')]+'%'};return _0x3cd7fd;})});}_0x3e9d9b=_[_0xadff('0x50')]({},_0x3e9d9b,_0x4219d6[_0xadff('0x59')]);return db[_0xadff('0x66')][_0xadff('0x51')]({'where':_0x3e9d9b[_0xadff('0x4d')]})[_0xadff('0x24')](function(_0x1233e1){_0x19d153['count']=_0x1233e1;if(_0x4219d6['query']['includeAll']){_0x3e9d9b[_0xadff('0x53')]=[{'all':!![]}];}return db[_0xadff('0x66')][_0xadff('0x6b')](_0x3e9d9b);})[_0xadff('0x24')](function(_0x5166c5){_0x19d153[_0xadff('0x54')]=_0x5166c5;return _0x19d153;});}})[_0xadff('0x24')](respondWithFilteredResult(_0xb5e85,_0x3e9d9b))['catch'](handleError(_0xb5e85,null));};exports[_0xadff('0x6c')]=function(_0xda7a62,_0x161f5e,_0x583198){return db[_0xadff('0x3f')]['find']({'where':{'id':_0xda7a62[_0xadff('0x62')]['id']}})['then'](handleEntityNotFound(_0x161f5e,null))[_0xadff('0x24')](function(_0x1b7272){if(_0x1b7272){return _0x1b7272['removeDispositions'](_0xda7a62[_0xadff('0x44')][_0xadff('0x6d')]);}})[_0xadff('0x24')](respondWithStatusCode(_0x161f5e,null))['catch'](handleError(_0x161f5e,null));};exports[_0xadff('0x6e')]=function(_0x242193,_0xd15c65,_0x5425c6){if(_0x242193['body']['id']){delete _0x242193[_0xadff('0x61')]['id'];}return db[_0xadff('0x3f')][_0xadff('0x5a')]({'where':{'id':_0x242193[_0xadff('0x62')]['id']}})[_0xadff('0x24')](handleEntityNotFound(_0xd15c65,null))[_0xadff('0x24')](function(_0x528359){if(_0x528359){_0x242193[_0xadff('0x61')][_0xadff('0x65')]=_0x528359['id'];return db[_0xadff('0x6f')][_0xadff('0x5f')](_0x242193[_0xadff('0x61')]);}})[_0xadff('0x24')](respondWithResult(_0xd15c65,null))[_0xadff('0x55')](handleError(_0xd15c65,null));};exports[_0xadff('0x70')]=function(_0x181482,_0x4d1fed,_0x37e65e){var _0x5a81f6={'raw':![],'where':{}};var _0x261d6d={};var _0x5dffdd={'count':0x0,'rows':[]};return db[_0xadff('0x3f')][_0xadff('0x68')]({'where':{'id':_0x181482['params']['id']}})[_0xadff('0x24')](handleEntityNotFound(_0x4d1fed,null))[_0xadff('0x24')](function(_0x41ef8a){if(_0x41ef8a){_0x261d6d[_0xadff('0x43')]=_[_0xadff('0x58')](db[_0xadff('0x6f')][_0xadff('0x40')]);_0x261d6d[_0xadff('0x44')]=_[_0xadff('0x58')](_0x181482[_0xadff('0x44')]);_0x261d6d[_0xadff('0x45')]=_[_0xadff('0x46')](_0x261d6d[_0xadff('0x43')],_0x261d6d['query']);_0x5a81f6[_0xadff('0x47')]=_[_0xadff('0x46')](_0x261d6d[_0xadff('0x43')],qs[_0xadff('0x48')](_0x181482[_0xadff('0x44')][_0xadff('0x48')]));_0x5a81f6[_0xadff('0x47')]=_0x5a81f6[_0xadff('0x47')][_0xadff('0x71')]?_0x5a81f6['attributes']:_0x261d6d[_0xadff('0x43')];if(!_0x181482[_0xadff('0x44')]['hasOwnProperty'](_0xadff('0x69'))){_0x5a81f6[_0xadff('0x4a')]=qs[_0xadff('0x4a')](_0x181482[_0xadff('0x44')][_0xadff('0x4a')]);_0x5a81f6[_0xadff('0x30')]=qs[_0xadff('0x30')](_0x181482[_0xadff('0x44')]['offset']);}_0x5a81f6[_0xadff('0x4b')]=qs[_0xadff('0x4c')](_0x181482[_0xadff('0x44')]['sort']);_0x5a81f6[_0xadff('0x4d')]=qs[_0xadff('0x45')](_[_0xadff('0x6a')](_0x181482[_0xadff('0x44')],_0x261d6d[_0xadff('0x45')]));_0x5a81f6['where'][_0xadff('0x65')]=_0x41ef8a['id'];if(_0x181482['query']['filter']){_0x5a81f6[_0xadff('0x4d')]=_[_0xadff('0x50')](_0x5a81f6['where'],{'$or':_[_0xadff('0x3e')](_0x5a81f6[_0xadff('0x47')],function(_0x37bbbf){var _0x517588={};_0x517588[_0x37bbbf]={'$like':'%'+_0x181482[_0xadff('0x44')][_0xadff('0x4e')]+'%'};return _0x517588;})});}_0x5a81f6=_[_0xadff('0x50')]({},_0x5a81f6,_0x181482[_0xadff('0x59')]);return db[_0xadff('0x6f')][_0xadff('0x51')]({'where':_0x5a81f6[_0xadff('0x4d')]})[_0xadff('0x24')](function(_0x2adbc1){_0x5dffdd['count']=_0x2adbc1;if(_0x181482['query'][_0xadff('0x52')]){_0x5a81f6[_0xadff('0x53')]=[{'all':!![]}];}return db[_0xadff('0x6f')]['findAll'](_0x5a81f6);})['then'](function(_0x4b0a5b){_0x5dffdd['rows']=_0x4b0a5b;return _0x5dffdd;});}})['then'](respondWithFilteredResult(_0x4d1fed,_0x5a81f6))[_0xadff('0x55')](handleError(_0x4d1fed,null));};exports[_0xadff('0x72')]=function(_0x114f25,_0x5170f4,_0x5b58d6){return db[_0xadff('0x3f')][_0xadff('0x5a')]({'where':{'id':_0x114f25[_0xadff('0x62')]['id']}})[_0xadff('0x24')](handleEntityNotFound(_0x5170f4,null))[_0xadff('0x24')](function(_0x5cda5b){if(_0x5cda5b){return _0x5cda5b['removeAnswers'](_0x114f25[_0xadff('0x44')]['ids']);}})[_0xadff('0x24')](respondWithStatusCode(_0x5170f4,null))['catch'](handleError(_0x5170f4,null));};exports[_0xadff('0x73')]=function(_0x15d734,_0x270ee3,_0x4c4757){_0x15d734[_0xadff('0x61')][_0xadff('0x74')]=_0x15d734['file'][_0xadff('0x75')];return db[_0xadff('0x3f')][_0xadff('0x5a')]({'where':{'id':_0x15d734[_0xadff('0x62')]['id']}})[_0xadff('0x24')](handleEntityNotFound(_0x270ee3,null))[_0xadff('0x24')](saveUpdates(_0x15d734[_0xadff('0x61')],null))[_0xadff('0x24')](respondWithResult(_0x270ee3,null))[_0xadff('0x55')](handleError(_0x270ee3,null));};exports['addAvatar']=function(_0x34eadd,_0x21fdaa,_0x48f1df){_0x34eadd[_0xadff('0x61')][_0xadff('0x76')]=_0x34eadd[_0xadff('0x77')][_0xadff('0x75')];return db[_0xadff('0x3f')][_0xadff('0x5a')]({'where':{'id':_0x34eadd[_0xadff('0x62')]['id']}})[_0xadff('0x24')](handleEntityNotFound(_0x21fdaa,null))[_0xadff('0x24')](saveUpdates(_0x34eadd[_0xadff('0x61')],null))['then'](respondWithResult(_0x21fdaa,null))[_0xadff('0x55')](handleError(_0x21fdaa,null));};exports[_0xadff('0x78')]=function(_0x283bf6,_0x11b59d,_0xd469df){_0x283bf6[_0xadff('0x61')][_0xadff('0x79')]=_0x283bf6[_0xadff('0x77')]['filename'];return db['ChatWebsite'][_0xadff('0x5a')]({'where':{'id':_0x283bf6[_0xadff('0x62')]['id']}})[_0xadff('0x24')](handleEntityNotFound(_0x11b59d,null))['then'](saveUpdates(_0x283bf6[_0xadff('0x61')],null))[_0xadff('0x24')](respondWithResult(_0x11b59d,null))[_0xadff('0x55')](handleError(_0x11b59d,null));};exports[_0xadff('0x7a')]=function(_0x694db6,_0x228a78,_0xd49a86){_0x694db6['body'][_0xadff('0x7b')]=_0x694db6[_0xadff('0x77')][_0xadff('0x75')];return db[_0xadff('0x3f')]['find']({'where':{'id':_0x694db6[_0xadff('0x62')]['id']}})[_0xadff('0x24')](handleEntityNotFound(_0x228a78,null))[_0xadff('0x24')](saveUpdates(_0x694db6[_0xadff('0x61')],null))[_0xadff('0x24')](respondWithResult(_0x228a78,null))[_0xadff('0x55')](handleError(_0x228a78,null));};exports[_0xadff('0x7c')]=function(_0x36e568,_0x1acfd7,_0x4ff2fb){var _0x310912=path['join'](config[_0xadff('0x7d')],_0xadff('0x7e'));var _0x24e16a={'where':{'id':_0x36e568['params']['id']},'attributes':['id',_0xadff('0x74')],'raw':!![]};var _0x4a9111=![];return require(_0xadff('0x7f'))[_0xadff('0x80')]()['then'](function(_0x18994d){if(_0x18994d){_0x4a9111=_0x18994d[_0xadff('0x81')];}})[_0xadff('0x24')](function(){return db[_0xadff('0x3f')][_0xadff('0x5a')](_0x24e16a);})[_0xadff('0x24')](handleEntityNotFound(_0x1acfd7,null))['then'](function(_0x2f82ae){if(_0x2f82ae){if(!_['isNil'](_0x2f82ae[_0xadff('0x74')])){if(fs[_0xadff('0x82')](path['join'](config[_0xadff('0x7d')],_0xadff('0x83'),_0x2f82ae[_0xadff('0x74')]))&&_0x4a9111){_0x310912=path['join'](config[_0xadff('0x7d')],_0xadff('0x83'),_0x2f82ae[_0xadff('0x74')]);}}return _0x1acfd7[_0xadff('0x84')](_0x310912);}})[_0xadff('0x55')](handleError(_0x1acfd7,null));};exports[_0xadff('0x85')]=function(_0x52d5ae,_0x592380,_0x1783dd){var _0x4c1600=path[_0xadff('0x86')](config[_0xadff('0x7d')],_0xadff('0x87'));var _0x462d62={'where':{'id':_0x52d5ae[_0xadff('0x62')]['id']},'attributes':['id',_0xadff('0x76')],'raw':!![]};return db[_0xadff('0x3f')][_0xadff('0x5a')](_0x462d62)[_0xadff('0x24')](handleEntityNotFound(_0x592380,null))[_0xadff('0x24')](function(_0x366667){if(_0x366667){if(!_['isNil'](_0x366667[_0xadff('0x76')])){if(fs[_0xadff('0x82')](path[_0xadff('0x86')](config[_0xadff('0x7d')],_0xadff('0x88'),_0x366667[_0xadff('0x76')]))){_0x4c1600=path[_0xadff('0x86')](config[_0xadff('0x7d')],_0xadff('0x88'),_0x366667['agentAvatar']);}}return _0x592380['download'](_0x4c1600);}})[_0xadff('0x55')](handleError(_0x592380,null));};exports[_0xadff('0x89')]=function(_0x24dfd7,_0xc3d007,_0x379755){var _0x37fd8f=path['join'](config['root'],_0xadff('0x8a'));var _0x4cd402={'where':{'id':_0x24dfd7[_0xadff('0x62')]['id']},'attributes':['id',_0xadff('0x79'),_0xadff('0x8b')],'raw':!![]};return db[_0xadff('0x3f')][_0xadff('0x5a')](_0x4cd402)[_0xadff('0x24')](handleEntityNotFound(_0xc3d007,null))[_0xadff('0x24')](function(_0x87d8a3){if(_0x87d8a3){if(!_['isNil'](_0x87d8a3[_0xadff('0x79')])){if(fs[_0xadff('0x82')](path[_0xadff('0x86')](config[_0xadff('0x7d')],'server/files/images/avatars/',_0x87d8a3[_0xadff('0x79')]))&&_0x87d8a3[_0xadff('0x8b')]){_0x37fd8f=path[_0xadff('0x86')](config[_0xadff('0x7d')],_0xadff('0x88'),_0x87d8a3[_0xadff('0x79')]);}}return _0xc3d007[_0xadff('0x84')](_0x37fd8f);}})[_0xadff('0x55')](handleError(_0xc3d007,null));};exports[_0xadff('0x8c')]=function(_0x5cc61d,_0x8203f3,_0x32be1c){var _0x3df246=path[_0xadff('0x86')](config[_0xadff('0x7d')],_0xadff('0x8d'));var _0x261503={'where':{'id':_0x5cc61d[_0xadff('0x62')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xadff('0x3f')]['find'](_0x261503)['then'](handleEntityNotFound(_0x8203f3,null))[_0xadff('0x24')](function(_0x5eb724){if(_0x5eb724){if(!_[_0xadff('0x8e')](_0x5eb724[_0xadff('0x7b')])){if(fs['existsSync'](path['join'](config[_0xadff('0x7d')],_0xadff('0x88'),_0x5eb724['systemAvatar']))){_0x3df246=path['join'](config[_0xadff('0x7d')],_0xadff('0x88'),_0x5eb724[_0xadff('0x7b')]);}}return _0x8203f3[_0xadff('0x84')](_0x3df246);}})[_0xadff('0x55')](handleError(_0x8203f3,null));};exports['notify']=function(_0x4bbe69,_0x3a6cde,_0xd45f2e){var _0x12c9a1=require('user-agent-parser');var _0x24266e=new _0x12c9a1();var _0x1ededd=_0x24266e[_0xadff('0x8f')](_0x4bbe69[_0xadff('0x90')][_0xadff('0x91')])[_0xadff('0x92')]();var _0x111a79={'body':_0x4bbe69[_0xadff('0x61')],'channel':'chat'};var _0x590c53=[];var _0x4fe40d=[];var _0x2cb21c={};var _0x481fdc=![];return db[_0xadff('0x93')][_0xadff('0x63')]()[_0xadff('0x24')](function(_0x866f3f){if(!_0x866f3f){throw new db['Sequelize'][(_0xadff('0x22'))](_0xadff('0x94'));}_0x590c53=_[_0xadff('0x95')](_[_0xadff('0x58')](_0x866f3f),['createdAt',_0xadff('0x96')]);_0x4fe40d=_[_0xadff('0x95')](_[_0xadff('0x58')](_0x866f3f),[_0xadff('0x97'),'updatedAt',_0xadff('0x98'),'ListId']);if(_0x4bbe69['body']['id']){delete _0x4bbe69[_0xadff('0x61')]['id'];}if(_[_0xadff('0x8e')](_0x4bbe69[_0xadff('0x61')][_0xadff('0x99')])){throw new db[(_0xadff('0x9a'))][(_0xadff('0x22'))](_0xadff('0x9b'));}if(_[_0xadff('0x8e')](_0x4bbe69[_0xadff('0x61')][_0xadff('0x61')])||_0x4bbe69[_0xadff('0x61')][_0xadff('0x61')]===''){throw new db['Sequelize']['ValidationError'](_0xadff('0x9c'));}if(_[_0xadff('0x8e')](_0x4bbe69[_0xadff('0x61')]['mapKey'])){throw new db[(_0xadff('0x9a'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4fe40d);}if(!_[_0xadff('0x9d')](_0x4fe40d,_0x4bbe69[_0xadff('0x61')][_0xadff('0x9e')])){throw new db[(_0xadff('0x9a'))][(_0xadff('0x22'))](_0xadff('0x9f')+_0x4fe40d);}_0x2cb21c[_0x4bbe69[_0xadff('0x61')][_0xadff('0x9e')]]=_0x4bbe69['body'][_0xadff('0x99')];})[_0xadff('0x24')](function(){return db['ChatWebsite'][_0xadff('0x5a')]({'where':{'id':_0x4bbe69[_0xadff('0x62')]['id']},'include':[{'model':db['CmList'],'as':_0xadff('0xa0'),'include':[{'model':db[_0xadff('0x93')],'as':'Contacts','where':_0x2cb21c,'limit':0x1,'order':[[_0xadff('0x96'),'DESC']]}]},{'model':db['ChatApplication'],'as':_0xadff('0xa1')}]});})[_0xadff('0x24')](handleEntityNotFound(_0x3a6cde,null))[_0xadff('0x24')](function(_0xa3f323){if(_0xa3f323&&_0xa3f323['List']){_0x111a79[_0xadff('0xa2')]=_0xa3f323;_0x111a79[_0xadff('0xa3')]=_0xa3f323[_0xadff('0xa1')];_0x111a79[_0xadff('0xa4')]=_0xa3f323[_0xadff('0xa0')];_0x111a79[_0xadff('0xa3')]=_[_0xadff('0xa5')](_0x111a79['applications'],['priority'],[_0xadff('0xa6')]);if(_0x111a79['account']['Applications']){delete _0x111a79[_0xadff('0xa2')][_0xadff('0xa1')];}if(_0x111a79['account'][_0xadff('0xa0')]&&_0x111a79[_0xadff('0xa2')][_0xadff('0xa0')][_0xadff('0xa7')][_0xadff('0x71')]){return _0x111a79[_0xadff('0xa2')][_0xadff('0xa0')][_0xadff('0xa7')][0x0];}var _0x46d30c=_['defaults'](_0x4bbe69[_0xadff('0x61')],{'firstName':_0x4bbe69[_0xadff('0x61')]['from'],'ListId':_0xa3f323[_0xadff('0xa8')]});_0x46d30c[_0x4bbe69[_0xadff('0x61')][_0xadff('0x9e')]]=_0x4bbe69['body'][_0xadff('0x99')];return db['CmContact'][_0xadff('0x5f')](_0x46d30c,{'fields':_0x590c53,'raw':!![]});}})['then'](handleEntityNotFound(_0x3a6cde,null))[_0xadff('0x24')](function(_0x55252f){_0x111a79[_0xadff('0xa9')]=_0x55252f;var _0x4e75f3=_0x4bbe69[_0xadff('0x61')]['customerIp'];if(_0x4bbe69['headers']['cf-connecting-ip']){_0x4e75f3=_0x4bbe69[_0xadff('0x90')]['cf-connecting-ip'];}else if(_0x4bbe69[_0xadff('0x90')]['x-forwarded-for']){_0x4e75f3=_[_0xadff('0xaa')](_0x4bbe69['headers'][_0xadff('0xab')]['split'](','));}if(_0x55252f){var _0x5eefe3={'ContactId':_0x55252f['id'],'ChatWebsiteId':_0x4bbe69[_0xadff('0x62')]['id'],'from':(_0x55252f[_0xadff('0xac')]||'')+'\x20'+(_0x55252f[_0xadff('0xad')]||''),'customerIp':_0x4e75f3,'customerPort':_0x4bbe69[_0xadff('0x90')][_0xadff('0xae')]?_0x4bbe69[_0xadff('0x90')][_0xadff('0xae')]:null,'referer':_0x4bbe69[_0xadff('0x61')][_0xadff('0xaf')],'browserName':_0x1ededd[_0xadff('0xb0')][_0xadff('0x3c')]&&_0x1ededd[_0xadff('0xb0')][_0xadff('0xb1')]?util[_0xadff('0xb2')](_0xadff('0xb3'),_0x1ededd[_0xadff('0xb0')][_0xadff('0x3c')],_0x1ededd[_0xadff('0xb0')][_0xadff('0xb1')]):'unknown','browserVersion':_0x1ededd[_0xadff('0xb0')]['version']||_0xadff('0xb4'),'osName':util[_0xadff('0xb2')]('%s\x20%s',_0x1ededd['os'][_0xadff('0x3c')],_0x1ededd['os'][_0xadff('0xb1')]),'osVersion':_0x1ededd['os']['version'],'deviceModel':_0x1ededd[_0xadff('0xb5')][_0xadff('0x43')]&&_0x1ededd['device'][_0xadff('0xb6')]?util[_0xadff('0xb2')](_0xadff('0xb7'),_0x1ededd[_0xadff('0xb5')]['model'],_0x1ededd[_0xadff('0xb5')][_0xadff('0xb6')],_0x1ededd[_0xadff('0xb5')]['type']):null,'deviceVendor':_0x1ededd[_0xadff('0xb5')]['vendor'],'deviceType':_0x1ededd['device'][_0xadff('0x42')],'formData':JSON[_0xadff('0x29')](_0x4bbe69[_0xadff('0x61')])};var _0x39a3fd={'ChatWebsiteId':_0x4bbe69[_0xadff('0x62')]['id'],'closed':![]};if(_0x4bbe69[_0xadff('0x61')]['threadId']){_0x39a3fd[_0xadff('0xb8')]=_0x4bbe69[_0xadff('0x61')][_0xadff('0xb8')];return db[_0xadff('0xb9')][_0xadff('0x5a')]({'where':_0x39a3fd})[_0xadff('0x24')](function(_0x2e00b0){if(_0x2e00b0){return[_0x2e00b0,![]];}_0x5eefe3[_0xadff('0xb8')]=_0x4bbe69[_0xadff('0x61')][_0xadff('0xb8')];_0x5eefe3[_0xadff('0xba')]=_0x4bbe69[_0xadff('0x61')][_0xadff('0xba')];return db['ChatInteraction'][_0xadff('0x5f')](_0x5eefe3)[_0xadff('0x24')](function(_0x3cfaaa){return[_0x3cfaaa,!![]];});});}_0x39a3fd[_0xadff('0xbb')]=_0x55252f['id'];if(_0x4bbe69['body'][_0xadff('0xbc')]&&_0x4bbe69[_0xadff('0x61')]['interaction']['id']){_0x39a3fd['id']=_0x4bbe69[_0xadff('0x61')][_0xadff('0xbc')]['id'];return db[_0xadff('0xb9')]['find']({'where':_0x39a3fd})['then'](function(_0x2d594f){if(_0x2d594f){return[_0x2d594f,![]];}return db[_0xadff('0xb9')][_0xadff('0x5f')](_0x5eefe3)[_0xadff('0x24')](function(_0x59dd48){return[_0x59dd48,!![]];});});}return db[_0xadff('0xb9')][_0xadff('0x5f')](_0x5eefe3)[_0xadff('0x24')](function(_0x2e650f){return[_0x2e650f,!![]];});}})['spread'](function(_0x230711,_0x4da952){if(_0x230711){_0x481fdc=_0x4da952;if(!_0x4da952){var _0x4ed34e={'from':(_0x111a79[_0xadff('0xa9')][_0xadff('0xac')]||'')+'\x20'+(_0x111a79[_0xadff('0xa9')][_0xadff('0xad')]||'')};if(_0x4bbe69[_0xadff('0x61')][_0xadff('0xb8')]&&_0x4bbe69['body']['messageId']&&_0x4bbe69['body'][_0xadff('0xb8')]!=_0x4bbe69[_0xadff('0x61')][_0xadff('0xbd')]){_0x4ed34e[_0xadff('0xb8')]=_0x4bbe69['body']['messageId'];}return _0x230711['update'](_0x4ed34e);}else{return _0x230711;}}})[_0xadff('0x24')](function(_0x3a4cf8){_0x111a79[_0xadff('0xbc')]=_0x3a4cf8[_0xadff('0x37')]({'plain':!![]});_0x111a79[_0xadff('0xbc')]['created']=_0x481fdc;if(_0x111a79['interaction']['created']){if(_0x111a79[_0xadff('0xa2')][_0xadff('0xbe')]){_0x111a79[_0xadff('0xa3')]['push']({'id':0x0,'priority':_0x111a79['applications'][_0xadff('0x71')]+0x1,'app':_0xadff('0xbf'),'appdata':'unmanaged','interval':_0xadff('0xc0')});}}return db['ChatMessage']['create']({'body':_0x4bbe69[_0xadff('0x61')][_0xadff('0x61')],'ChatWebsiteId':_0x4bbe69['params']['id'],'ChatInteractionId':_0x3a4cf8['id'],'direction':'in','ContactId':_0x111a79[_0xadff('0xa9')]['id'],'AttachmentId':_0x4bbe69[_0xadff('0x61')][_0xadff('0xc1')]});})['then'](function(_0xdbbb02){_0x111a79[_0xadff('0x2c')]=_0xdbbb02;if(_0x111a79[_0xadff('0xbc')]['UserId']){return db[_0xadff('0xc2')][_0xadff('0x5a')]({'attributes':['id',_0xadff('0x3c')],'where':{'id':_0x111a79[_0xadff('0xbc')][_0xadff('0xc3')]}})[_0xadff('0x24')](function(_0x43bd0a){if(_0x43bd0a){_0x111a79[_0xadff('0xa3')]['unshift']({'id':0x0,'priority':0x0,'app':_0xadff('0xc4'),'appdata':_0x43bd0a[_0xadff('0x3c')]+','+(_0x111a79['account'][_0xadff('0xc5')]||0xa),'interval':_0xadff('0xc0')});_0x111a79[_0xadff('0xc6')]=!![];}return respondWithRpcPromise('Start',_0xadff('0xc7'),_0x111a79);});}return respondWithRpcPromise('Start',_0xadff('0xc7'),_0x111a79);})['then'](function(_0x199233){respondWithRpcPromise(_0xadff('0xc8'),_0xadff('0xc8'),{'event':_0xadff('0xc9'),'message':_0x199233},client9002);return _0x199233;})['then'](respondWithResult(_0x3a6cde,null))[_0xadff('0x55')](handleError(_0x3a6cde,null));};exports[_0xadff('0xca')]=function(_0x554e49,_0x1d5183,_0x1c1671){var _0x488627,_0x2ab69f,_0x251522;var _0x5b7790=[];var _0x563fde=[];var _0x47db48={};return db[_0xadff('0x93')][_0xadff('0x63')]()[_0xadff('0x24')](function(_0x475d30){if(!_0x475d30){throw new db[(_0xadff('0x9a'))][(_0xadff('0x22'))]('no\x20available\x20attributes');}_0x563fde=_[_0xadff('0x95')](_['keys'](_0x475d30),['createdAt',_0xadff('0x96')]);_0x5b7790=_[_0xadff('0x95')](_[_0xadff('0x58')](_0x475d30),[_0xadff('0x97'),_0xadff('0x96'),_0xadff('0x98'),_0xadff('0xa8')]);if(_0x554e49[_0xadff('0x61')]['id']){delete _0x554e49[_0xadff('0x61')]['id'];}if(_['isNil'](_0x554e49['body']['from'])){throw _0x1d5183[_0xadff('0x2e')](0x1f4)[_0xadff('0xcb')](new db[(_0xadff('0x9a'))]['ValidationError'](_0xadff('0x9b')));}if(_[_0xadff('0x8e')](_0x554e49[_0xadff('0x61')]['body'])||_0x554e49['body']['body']===''){throw _0x1d5183[_0xadff('0x2e')](0x1f4)['send'](new db['Sequelize'][(_0xadff('0x22'))](_0xadff('0x9c')));}if(_[_0xadff('0x8e')](_0x554e49['body'][_0xadff('0xcc')])){throw _0x1d5183[_0xadff('0x2e')](0x1f4)['send'](new db[(_0xadff('0x9a'))][(_0xadff('0x22'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5b7790));}if(!_[_0xadff('0x9d')](_0x5b7790,_0x554e49[_0xadff('0x61')][_0xadff('0xcc')])){throw _0x1d5183[_0xadff('0x2e')](0x1f4)[_0xadff('0xcb')](new db[(_0xadff('0x9a'))][(_0xadff('0x22'))](_0xadff('0xcd')+_0x5b7790));}_0x47db48[_0x554e49[_0xadff('0x61')][_0xadff('0xcc')]]=_0x554e49[_0xadff('0x61')][_0xadff('0x99')];})[_0xadff('0x24')](function(){return db['ChatWebsite'][_0xadff('0x5a')]({'where':{'id':_0x554e49[_0xadff('0x62')]['id']},'include':[{'model':db['CmList'],'as':_0xadff('0xa0')}]});})['then'](handleEntityNotFound(_0x1d5183,null))[_0xadff('0x24')](function(_0x51d0c5){if(_0x51d0c5&&_0x51d0c5[_0xadff('0xa0')]){_0x2ab69f=_0x51d0c5;var _0x263084=_['defaults'](_0x554e49[_0xadff('0x61')],{'firstName':_0x554e49['body'][_0xadff('0x99')],'phone':_0x554e49[_0xadff('0x61')]['from'],'ListId':_0x51d0c5[_0xadff('0xa8')]});_0x263084[_0x554e49['body'][_0xadff('0xcc')]]=_0x554e49[_0xadff('0x61')][_0xadff('0x99')];return db[_0xadff('0x93')][_0xadff('0xce')]({'where':_0x47db48,'defaults':_0x263084});}})['spread'](function(_0xd31c38){if(_0xd31c38){_0x251522=_0xd31c38;var _0x30ae96=fs['readFileSync'](path[_0xadff('0x86')](config[_0xadff('0x7d')],_0xadff('0xcf')),_0xadff('0xd0'));var _0x25a736=ejs[_0xadff('0xd1')](_0x30ae96,{'body':_['toPairs'](_0x554e49[_0xadff('0x61')][_0xadff('0x61')]),'bodyTitle':_0x2ab69f[_0xadff('0xd2')]});return db['ChatOfflineMessage'][_0xadff('0x5f')]({'body':_0x25a736,'ContactId':_0xd31c38['id'],'ChatWebsiteId':_0x2ab69f['id']});}})[_0xadff('0x24')](function(_0x27dce1){if(_0x27dce1){_0x488627=_0x27dce1;return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xadff('0xd3')],'as':'Smtp','raw':!![]}]});}})[_0xadff('0x24')](function(_0x2dbb7e){if(_0x2dbb7e&&_0x2dbb7e['Smtp']&&_0x2ab69f[_0xadff('0xd4')]){var _0x2816d9={'tls':{'rejectUnauthorized':![]}};if(_0x2dbb7e[_0xadff('0xd5')][_0xadff('0xd6')]){_0x2816d9['service']=_0x2dbb7e[_0xadff('0xd5')][_0xadff('0xd6')];}else{_0x2816d9[_0xadff('0xd7')]=_0x2dbb7e['Smtp'][_0xadff('0xd7')];_0x2816d9['port']=_0x2dbb7e['Smtp'][_0xadff('0xd8')];_0x2816d9[_0xadff('0xd9')]=_0x2dbb7e[_0xadff('0xd5')]['secure'];}if(_0x2dbb7e[_0xadff('0xd5')][_0xadff('0xda')]){_0x2816d9[_0xadff('0xdb')]={'user':_0x2dbb7e[_0xadff('0xd5')][_0xadff('0xdc')],'pass':_0x2dbb7e[_0xadff('0xd5')][_0xadff('0xdd')]};}return respondWithRpcPromise(_0xadff('0xde'),'sendMail',{'account':_0x2816d9,'message':{'from':util[_0xadff('0xb2')]('\x22%s\x22\x20<%s>',_0x2dbb7e[_0xadff('0x3c')],_0x2dbb7e['email']||_0x2dbb7e['Smtp'][_0xadff('0xdc')]),'to':_0x2ab69f['forwardOfflineAddress'],'subject':_0x2ab69f[_0xadff('0xdf')],'text':_0x488627['body']}},client9003)[_0xadff('0x24')](function(){return _0x488627;})['catch'](function(_0x3d38d9){console[_0xadff('0x2a')](_0x3d38d9);});}})['then'](function(){if(_0x488627){return _0x488627;}})[_0xadff('0x24')](respondWithResult(_0x1d5183,null))[_0xadff('0x55')](handleError(_0x1d5183,null));};exports[_0xadff('0xe0')]=function(_0x2748db,_0x40c402,_0x3731eb){return db['ChatInteraction'][_0xadff('0x5a')]({'where':{'id':_0x2748db[_0xadff('0x62')]['id']}})['then'](handleEntityNotFound(_0x40c402,null))[_0xadff('0x24')](function(_0x23ea42){if(_0x23ea42){return _0x23ea42[_0xadff('0xe0')](_0x2748db[_0xadff('0x61')][_0xadff('0x6d')],_[_0xadff('0xe1')](_0x2748db[_0xadff('0x61')],['ids','id'])||{});}})['then'](respondWithResult(_0x40c402,null))['catch'](handleError(_0x40c402,null));};exports['getInteractions']=function(_0x241d18,_0x32a5a0,_0x4d3207){var _0x19d42c={'raw':![],'where':{}};var _0x517049={};var _0x36ad6c={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xadff('0x68')]({'where':{'id':_0x241d18[_0xadff('0x62')]['id']}})[_0xadff('0x24')](handleEntityNotFound(_0x32a5a0,null))[_0xadff('0x24')](function(_0x512bf3){if(_0x512bf3){_0x517049[_0xadff('0x43')]=_[_0xadff('0x58')](db['ChatInteraction'][_0xadff('0x40')]);_0x517049[_0xadff('0x44')]=_[_0xadff('0x58')](_0x241d18['query']);_0x517049[_0xadff('0x45')]=_[_0xadff('0x46')](_0x517049[_0xadff('0x43')],_0x517049[_0xadff('0x44')]);_0x19d42c[_0xadff('0x47')]=_[_0xadff('0x46')](_0x517049['model'],qs[_0xadff('0x48')](_0x241d18[_0xadff('0x44')]['fields']));_0x19d42c[_0xadff('0x47')]=_0x19d42c[_0xadff('0x47')][_0xadff('0x71')]?_0x19d42c['attributes']:_0x517049[_0xadff('0x43')];if(!_0x241d18['query']['hasOwnProperty'](_0xadff('0x69'))){_0x19d42c[_0xadff('0x4a')]=qs[_0xadff('0x4a')](_0x241d18['query'][_0xadff('0x4a')]);_0x19d42c[_0xadff('0x30')]=qs[_0xadff('0x30')](_0x241d18[_0xadff('0x44')][_0xadff('0x30')]);}_0x19d42c[_0xadff('0x4b')]=qs[_0xadff('0x4c')](_0x241d18[_0xadff('0x44')][_0xadff('0x4c')]);_0x19d42c[_0xadff('0x4d')]=qs[_0xadff('0x45')](_[_0xadff('0x6a')](_0x241d18[_0xadff('0x44')],_0x517049['filters']));_0x19d42c[_0xadff('0x4d')][_0xadff('0x65')]=_0x512bf3['id'];if(_0x241d18['query']['filter']){_0x19d42c[_0xadff('0x4d')]=_[_0xadff('0x50')](_0x19d42c[_0xadff('0x4d')],{'$or':_[_0xadff('0x3e')](_0x19d42c['attributes'],function(_0x4df531){var _0x21d6ba={};_0x21d6ba[_0x4df531]={'$like':'%'+_0x241d18[_0xadff('0x44')][_0xadff('0x4e')]+'%'};return _0x21d6ba;})});}_0x19d42c=_[_0xadff('0x50')]({},_0x19d42c,_0x241d18[_0xadff('0x59')]);return db['ChatInteraction'][_0xadff('0x51')]({'where':_0x19d42c[_0xadff('0x4d')]})[_0xadff('0x24')](function(_0x2191a1){_0x36ad6c[_0xadff('0x51')]=_0x2191a1;if(_0x241d18['query'][_0xadff('0x52')]){_0x19d42c[_0xadff('0x53')]=[{'model':db['CmContact'],'as':_0xadff('0xe2'),'required':![]},{'model':db[_0xadff('0xc2')],'as':_0xadff('0xe3'),'attributes':[_0xadff('0x3c'),_0xadff('0xe4'),'internal'],'required':![]},{'model':db[_0xadff('0xe5')],'as':_0xadff('0xe6'),'attributes':['id',_0xadff('0x3c'),_0xadff('0xe7')],'where':_0x241d18[_0xadff('0x44')]['tag']?{'id':_0x241d18['query'][_0xadff('0xe8')]}:undefined,'required':_0x241d18[_0xadff('0x44')][_0xadff('0xe8')]?!![]:![]}];}return db[_0xadff('0xb9')][_0xadff('0x6b')](_0x19d42c);})['then'](function(_0x5d091a){_0x36ad6c[_0xadff('0x54')]=_0x5d091a;return _0x36ad6c;});}})[_0xadff('0x24')](respondWithFilteredResult(_0x32a5a0,_0x19d42c))[_0xadff('0x55')](handleError(_0x32a5a0,null));};function iftimePromise(_0x428146,_0x26bac5){return respondWithRpcPromise(_0xadff('0xe9'),_0xadff('0xea'),{'command':_0x26bac5[_0xadff('0xeb')]?util[_0xadff('0xb2')](_0xadff('0xec'),_0x428146[_0xadff('0xed')],_0x26bac5['timezone']):util[_0xadff('0xb2')](_0xadff('0xee'),_0x428146['interval'])},client9002)[_0xadff('0x24')](function(_0x20ba3e){var _0x5dd404=_0x20ba3e&&_0x20ba3e[_0xadff('0xef')](_0xadff('0xf0'))>=0x0?!![]:![];logger[_0xadff('0x25')](_0xadff('0xf1'),_0x26bac5['id'],_0x428146['id'],_0x428146[_0xadff('0xed')],_0x5dd404?_0xadff('0xf2'):'OFFLINE',_0x26bac5[_0xadff('0xeb')]?_0x26bac5['timezone']:_0xadff('0xf3'));return _0x5dd404;})[_0xadff('0x55')](function(_0x5efd77){logger[_0xadff('0x2a')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x26bac5['id'],_0x428146['id'],_0x428146['interval'],util['inspect'](_0x5efd77,{'showHidden':![],'depth':null}),_0x26bac5['timezone']?_0x26bac5[_0xadff('0xeb')]:'No\x20timezone');return![];});}exports[_0xadff('0xea')]=function(_0x4db30f,_0x2994aa,_0x6f43a2){var _0x275c3d=0x0;var _0x3d6a4a=0x0;var _0x5b1d1c=![];var _0x1a619d;var _0x2508bc;return db[_0xadff('0x3f')][_0xadff('0x5a')]({'where':{'id':_0x4db30f[_0xadff('0x62')]['id']},'include':[{'model':db[_0xadff('0xf4')],'as':_0xadff('0xf4'),'include':[{'model':db['Interval'],'as':'Intervals','attributes':['id',_0xadff('0xed')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x2994aa,null))[_0xadff('0x24')](function(_0x50c0a7){if(_0x50c0a7){_0x1a619d=_0x50c0a7;return _0x50c0a7['getProactiveActions']({'raw':!![]});}})[_0xadff('0x24')](function(_0x56fa4f){if(_0x1a619d){if(_0x56fa4f){_0x2508bc=_0x56fa4f;}}return require(_0xadff('0x7f'))['getLicense']();})[_0xadff('0x24')](function(_0x5290f4){if(_0x5290f4){_0x3d6a4a=_0x5290f4[_0xadff('0xf5')];_0x5b1d1c=_0x5290f4['custom'];}})[_0xadff('0x24')](function(){return db[_0xadff('0xb9')][_0xadff('0x51')]({'where':{'closed':![]}});})[_0xadff('0x24')](function(_0x20d74a){_0x275c3d=_0x20d74a;if(_0x3d6a4a&&_0x20d74a>_0x3d6a4a){return db[_0xadff('0xf6')][_0xadff('0x68')]({'where':{'id':0x1}})['then'](function(_0x41a99e){if(_0x41a99e){_0x41a99e[_0xadff('0xf7')](_0xadff('0xf8'));}});}})[_0xadff('0x24')](function(){if(_0x1a619d[_0xadff('0xf4')]&&_0x1a619d[_0xadff('0xf4')][_0xadff('0xf9')]){var _0x6d594=[];for(var _0x43a6ea=0x0;_0x43a6ea<_0x1a619d[_0xadff('0xf4')]['Intervals'][_0xadff('0x71')];_0x43a6ea++){var _0x1d3187=_0x1a619d[_0xadff('0xf4')][_0xadff('0xf9')][_0x43a6ea]['get']({'plain':!![]});_0x6d594[_0xadff('0xfa')](iftimePromise(_0x1d3187,_0x1a619d));}return BPromise[_0xadff('0xfb')](_0x6d594)['then'](function(_0x4b0556){return _[_0xadff('0xfc')](_0x4b0556);});}else{return!![];}})[_0xadff('0x24')](function(_0x33f651){var _0x8bd6e3=fs[_0xadff('0xfd')](path[_0xadff('0x86')](config[_0xadff('0x7d')],'server/files/chat/iframe.js'),'utf8');var _0x3f0975={'remote':_0x1a619d[_0xadff('0xfe')],'query':querystring[_0xadff('0x29')](_[_0xadff('0x50')](_0x1a619d[_0xadff('0x37')]({'plain':!![]}),{'customerIp':_0x4db30f[_0xadff('0x90')][_0xadff('0xab')]||_0x4db30f['headers']['x-real-ip']||_0x4db30f[_0xadff('0xff')][_0xadff('0x100')]||_0x4db30f['ip'],'referer':_0x4db30f[_0xadff('0x90')][_0xadff('0xaf')],'openedInteractions':_0x275c3d,'maxInteractions':_0x3d6a4a,'virtual':_0x5b1d1c[_0xadff('0xf5')],'online':_0x33f651,'custom':_0x5b1d1c}))['replace'](/'/g,'\x5c\x27')};_0x2994aa[_0xadff('0xcb')](ejs[_0xadff('0xd1')](Mustache['render'](_0x8bd6e3,_0x3f0975),{'proactiveActions':_0x2508bc,'alignment':_0x1a619d[_0xadff('0x101')],'verticalAlignment':_0x1a619d['verticalAlignment'],'div_color':_0x1a619d[_0xadff('0xe7')],'text_color':_0x1a619d[_0xadff('0x102')]}));})['catch'](handleError(_0x2994aa,null));};exports[_0xadff('0x103')]=function(_0x17dbd3,_0x1c94f4,_0x34937b){return db[_0xadff('0x3f')][_0xadff('0x68')]({'where':{'id':_0x17dbd3[_0xadff('0x62')]['id']}})[_0xadff('0x24')](handleEntityNotFound(_0x1c94f4,null))[_0xadff('0x24')](function(_0x59a9ad){if(_0x59a9ad){return db['sequelize'][_0xadff('0x104')](function(_0x636382){return db[_0xadff('0x105')]['destroy']({'where':{'ChatWebsiteId':_0x17dbd3[_0xadff('0x62')]['id']},'transaction':_0x636382})[_0xadff('0x24')](function(_0x2cf9de){var _0x920d7f=_['map'](_0x17dbd3[_0xadff('0x61')],function(_0x9c1c1b){_0x9c1c1b[_0xadff('0x65')]=_0x17dbd3['params']['id'];return _0x9c1c1b;});return db[_0xadff('0x105')][_0xadff('0x106')](_0x920d7f,{'transaction':_0x636382});});})[_0xadff('0x24')](function(){return db[_0xadff('0x105')][_0xadff('0x107')]({'where':{'ChatWebsiteId':_0x17dbd3['params']['id']},'order':_0xadff('0x108')});});}})[_0xadff('0x24')](respondWithResult(_0x1c94f4,null))[_0xadff('0x55')](handleError(_0x1c94f4,null));};exports[_0xadff('0x109')]=function(_0x34ba4e,_0x51612c,_0x32a24a){var _0x45eb65={};var _0x485432={};var _0xba9aae;var _0x162c63;return db[_0xadff('0x3f')][_0xadff('0x68')]({'where':{'id':_0x34ba4e['params']['id']}})['then'](handleEntityNotFound(_0x51612c,null))[_0xadff('0x24')](function(_0x4a9fa5){if(_0x4a9fa5){_0xba9aae=_0x4a9fa5;_0x485432[_0xadff('0x43')]=_['keys'](db[_0xadff('0x105')][_0xadff('0x40')]);_0x485432[_0xadff('0x44')]=_[_0xadff('0x58')](_0x34ba4e[_0xadff('0x44')]);_0x485432[_0xadff('0x45')]=_['intersection'](_0x485432['model'],_0x485432[_0xadff('0x44')]);_0x45eb65['attributes']=_['intersection'](_0x485432[_0xadff('0x43')],qs[_0xadff('0x48')](_0x34ba4e[_0xadff('0x44')]['fields']));_0x45eb65[_0xadff('0x47')]=_0x45eb65[_0xadff('0x47')][_0xadff('0x71')]?_0x45eb65[_0xadff('0x47')]:_0x485432[_0xadff('0x43')];_0x45eb65['order']=qs[_0xadff('0x4c')](_0x34ba4e[_0xadff('0x44')][_0xadff('0x4c')]);_0x45eb65[_0xadff('0x4d')]=qs[_0xadff('0x45')](_[_0xadff('0x6a')](_0x34ba4e[_0xadff('0x44')],_0x485432['filters']));if(_0x34ba4e[_0xadff('0x44')][_0xadff('0x4e')]){_0x45eb65['where']=_[_0xadff('0x50')](_0x45eb65['where'],{'$or':_[_0xadff('0x3e')](_0x45eb65[_0xadff('0x47')],function(_0x51c82f){var _0x1a72ab={};_0x1a72ab[_0x51c82f]={'$like':'%'+_0x34ba4e[_0xadff('0x44')][_0xadff('0x4e')]+'%'};return _0x1a72ab;})});}_0x45eb65=_[_0xadff('0x50')]({},_0x45eb65,_0x34ba4e['options']);return _0xba9aae[_0xadff('0x109')](_0x45eb65);}})[_0xadff('0x24')](function(_0x3090e4){if(_0x3090e4){_0x162c63=_0x3090e4['length'];if(!_0x34ba4e[_0xadff('0x44')][_0xadff('0x49')](_0xadff('0x69'))){_0x45eb65[_0xadff('0x4a')]=qs['limit'](_0x34ba4e['query'][_0xadff('0x4a')]);_0x45eb65[_0xadff('0x30')]=qs['offset'](_0x34ba4e['query'][_0xadff('0x30')]);}return _0xba9aae['getApplications'](_0x45eb65);}})[_0xadff('0x24')](function(_0x160b68){if(_0x160b68){return _0x160b68?{'count':_0x162c63,'rows':_0x160b68}:null;}})[_0xadff('0x24')](respondWithResult(_0x51612c,null))[_0xadff('0x55')](handleError(_0x51612c,null));};exports[_0xadff('0x10a')]=function(_0x4686f8,_0x284362,_0x4fd612){return db[_0xadff('0x10b')]['find']({'where':{'id':_0x4686f8['params']['id']}})[_0xadff('0x24')](handleEntityNotFound(_0x284362,null))[_0xadff('0x24')](function(_0x507e2f){if(_0x507e2f){return _0x507e2f[_0xadff('0x10a')](_0x4686f8[_0xadff('0x61')]['ids'],_[_0xadff('0xe1')](_0x4686f8[_0xadff('0x61')],['ids','id'])||{});}})[_0xadff('0x24')](respondWithResult(_0x284362,null))[_0xadff('0x55')](handleError(_0x284362,null));};exports[_0xadff('0x10c')]=function(_0x5ec6ab,_0x59ba9d,_0x4bc178){var _0x5770dd={};var _0x1f9b90={};var _0x2f075c;var _0x48464f;return db['ChatWebsite'][_0xadff('0x68')]({'where':{'id':_0x5ec6ab['params']['id']}})[_0xadff('0x24')](handleEntityNotFound(_0x59ba9d,null))[_0xadff('0x24')](function(_0xa0df3c){if(_0xa0df3c){_0x2f075c=_0xa0df3c;_0x1f9b90[_0xadff('0x43')]=_['keys'](db['ChatProactiveAction'][_0xadff('0x40')]);_0x1f9b90[_0xadff('0x44')]=_['keys'](_0x5ec6ab['query']);_0x1f9b90[_0xadff('0x45')]=_[_0xadff('0x46')](_0x1f9b90[_0xadff('0x43')],_0x1f9b90[_0xadff('0x44')]);_0x5770dd['attributes']=_[_0xadff('0x46')](_0x1f9b90[_0xadff('0x43')],qs[_0xadff('0x48')](_0x5ec6ab[_0xadff('0x44')][_0xadff('0x48')]));_0x5770dd[_0xadff('0x47')]=_0x5770dd['attributes']['length']?_0x5770dd[_0xadff('0x47')]:_0x1f9b90['model'];_0x5770dd[_0xadff('0x4b')]=qs[_0xadff('0x4c')](_0x5ec6ab['query'][_0xadff('0x4c')]);_0x5770dd[_0xadff('0x4d')]=qs['filters'](_[_0xadff('0x6a')](_0x5ec6ab[_0xadff('0x44')],_0x1f9b90[_0xadff('0x45')]));if(_0x5ec6ab[_0xadff('0x44')]['filter']){_0x5770dd[_0xadff('0x4d')]=_[_0xadff('0x50')](_0x5770dd[_0xadff('0x4d')],{'$or':_[_0xadff('0x3e')](_0x5770dd[_0xadff('0x47')],function(_0x257ef7){var _0x2f6c05={};_0x2f6c05[_0x257ef7]={'$like':'%'+_0x5ec6ab[_0xadff('0x44')][_0xadff('0x4e')]+'%'};return _0x2f6c05;})});}_0x5770dd=_['merge']({},_0x5770dd,_0x5ec6ab[_0xadff('0x59')]);return _0x2f075c[_0xadff('0x10c')](_0x5770dd);}})[_0xadff('0x24')](function(_0x3aee14){if(_0x3aee14){_0x48464f=_0x3aee14[_0xadff('0x71')];if(!_0x5ec6ab['query'][_0xadff('0x49')](_0xadff('0x69'))){_0x5770dd[_0xadff('0x4a')]=qs[_0xadff('0x4a')](_0x5ec6ab['query'][_0xadff('0x4a')]);_0x5770dd[_0xadff('0x30')]=qs[_0xadff('0x30')](_0x5ec6ab[_0xadff('0x44')]['offset']);}return _0x2f075c['getProactiveActions'](_0x5770dd);}})[_0xadff('0x24')](function(_0x8b2456){if(_0x8b2456){return _0x8b2456?{'count':_0x48464f,'rows':_0x8b2456}:null;}})[_0xadff('0x24')](respondWithResult(_0x59ba9d,null))['catch'](handleError(_0x59ba9d,null));};exports[_0xadff('0x10d')]=function(_0x546a8a,_0xc6968,_0x50c5c4){var _0x3a46c5=_0x546a8a[_0xadff('0x44')][_0xadff('0x10e')]==='false'?_0xadff('0x10f'):_0xadff('0x110');return db['ChatWebsite'][_0xadff('0x5a')]({'attributes':['id',_0x3a46c5],'where':{'id':_0x546a8a[_0xadff('0x62')]['id']}})[_0xadff('0x24')](handleEntityNotFound(_0xc6968,null))[_0xadff('0x24')](function(_0x1d9a78){if(_0x1d9a78){var _0x3665f7=_0x1d9a78[_0x3a46c5];var _0x5d7b21=_0x3665f7&&_0x3665f7[_0xadff('0x111')]?_0x3665f7['items']:[];_0xc6968['send']({'fromKey':_[_0xadff('0x8e')](_0x3665f7[_0xadff('0x112')])?undefined:_0x3665f7['fromKey'],'count':_0x5d7b21[_0xadff('0x71')],'rows':_0x5d7b21});}})[_0xadff('0x55')](handleError(_0xc6968,null));};exports[_0xadff('0x113')]=function(_0x56dd7d,_0x178d9b,_0x5a310d){var _0x34b03f={'raw':![],'where':{}};var _0x41b7f1={};var _0x4c29d4={'count':0x0,'rows':[]};return db[_0xadff('0x3f')][_0xadff('0x68')]({'where':{'id':_0x56dd7d['params']['id']}})[_0xadff('0x24')](handleEntityNotFound(_0x178d9b,null))['then'](function(_0x389613){if(_0x389613){_0x41b7f1[_0xadff('0x43')]=_['keys'](db[_0xadff('0x114')][_0xadff('0x40')]);_0x41b7f1[_0xadff('0x44')]=_[_0xadff('0x58')](_0x56dd7d[_0xadff('0x44')]);_0x41b7f1[_0xadff('0x45')]=_[_0xadff('0x46')](_0x41b7f1[_0xadff('0x43')],_0x41b7f1['query']);_0x34b03f[_0xadff('0x47')]=_[_0xadff('0x46')](_0x41b7f1[_0xadff('0x43')],qs['fields'](_0x56dd7d[_0xadff('0x44')][_0xadff('0x48')]));_0x34b03f[_0xadff('0x47')]=_0x34b03f['attributes'][_0xadff('0x71')]?_0x34b03f[_0xadff('0x47')]:_0x41b7f1[_0xadff('0x43')];if(!_0x56dd7d[_0xadff('0x44')][_0xadff('0x49')]('nolimit')){_0x34b03f[_0xadff('0x4a')]=qs['limit'](_0x56dd7d[_0xadff('0x44')][_0xadff('0x4a')]);_0x34b03f[_0xadff('0x30')]=qs['offset'](_0x56dd7d[_0xadff('0x44')]['offset']);}_0x34b03f['order']=qs[_0xadff('0x4c')](_0x56dd7d[_0xadff('0x44')][_0xadff('0x4c')]);_0x34b03f[_0xadff('0x4d')]=qs[_0xadff('0x45')](_[_0xadff('0x6a')](_0x56dd7d[_0xadff('0x44')],_0x41b7f1[_0xadff('0x45')]));_0x34b03f[_0xadff('0x4d')]['ChatWebsiteId']=_0x389613['id'];if(_0x56dd7d['query'][_0xadff('0x4e')]){_0x34b03f[_0xadff('0x4d')]=_[_0xadff('0x50')](_0x34b03f[_0xadff('0x4d')],{'$or':_['map'](_0x34b03f[_0xadff('0x47')],function(_0x308235){var _0xf5addb={};_0xf5addb[_0x308235]={'$like':'%'+_0x56dd7d[_0xadff('0x44')][_0xadff('0x4e')]+'%'};return _0xf5addb;})});}_0x34b03f=_[_0xadff('0x50')]({},_0x34b03f,_0x56dd7d[_0xadff('0x59')]);return db[_0xadff('0x114')][_0xadff('0x51')]({'where':_0x34b03f[_0xadff('0x4d')]})[_0xadff('0x24')](function(_0x1644fe){_0x4c29d4[_0xadff('0x51')]=_0x1644fe;if(_0x56dd7d[_0xadff('0x44')][_0xadff('0x52')]){_0x34b03f['include']=[{'all':!![]}];}else{_0x34b03f['include']=[{'model':db[_0xadff('0x93')],'as':_0xadff('0xe2'),'required':![]}];}return db[_0xadff('0x114')][_0xadff('0x6b')](_0x34b03f);})[_0xadff('0x24')](function(_0x1d3056){_0x4c29d4['rows']=_0x1d3056;return _0x4c29d4;});}})[_0xadff('0x24')](respondWithFilteredResult(_0x178d9b,_0x34b03f))[_0xadff('0x55')](handleError(_0x178d9b,null));};exports[_0xadff('0x115')]=function(_0x275cc7,_0x16b46e,_0x342923){return db[_0xadff('0x3f')][_0xadff('0x5a')]({'where':{'id':_0x275cc7['params']['id']}})['then'](handleEntityNotFound(_0x16b46e,null))[_0xadff('0x24')](function(_0x39e8f1){if(_0x39e8f1){return _0x39e8f1[_0xadff('0x115')](_0x275cc7[_0xadff('0x61')][_0xadff('0x6d')],_[_0xadff('0xe1')](_0x275cc7[_0xadff('0x61')],[_0xadff('0x6d'),'id'])||{})[_0xadff('0x116')](function(_0x3b5319){for(var _0xf45e5c=0x0;_0xf45e5c<_0x275cc7[_0xadff('0x61')]['ids'][_0xadff('0x71')];_0xf45e5c+=0x1){socket[_0xadff('0x117')](_0xadff('0x118'),{'UserId':_0x275cc7['body'][_0xadff('0x6d')][_0xf45e5c],'ChatWebsiteId':_0x275cc7[_0xadff('0x62')]['id']});}return _0x3b5319;});}})['then'](respondWithResult(_0x16b46e,null))[_0xadff('0x55')](handleError(_0x16b46e,null));};exports[_0xadff('0x119')]=function(_0x2ffc72,_0x3bd4ed,_0x1934c1){return db[_0xadff('0x3f')][_0xadff('0x5a')]({'where':{'id':_0x2ffc72[_0xadff('0x62')]['id']}})['then'](handleEntityNotFound(_0x3bd4ed,null))[_0xadff('0x24')](function(_0x315210){if(_0x315210){return _0x315210[_0xadff('0x119')](_0x2ffc72[_0xadff('0x44')][_0xadff('0x6d')])[_0xadff('0x24')](function(){if(_[_0xadff('0x11a')](_0x2ffc72[_0xadff('0x44')][_0xadff('0x6d')])){for(var _0x4eed92=0x0;_0x4eed92<_0x2ffc72[_0xadff('0x44')]['ids']['length'];_0x4eed92+=0x1){socket['emit'](_0xadff('0x11b'),{'UserId':Number(_0x2ffc72['query'][_0xadff('0x6d')][_0x4eed92]),'ChatWebsiteId':Number(_0x2ffc72[_0xadff('0x62')]['id'])});}}else{socket[_0xadff('0x117')]('userChatWebsite:remove',{'UserId':Number(_0x2ffc72['query'][_0xadff('0x6d')]),'ChatWebsiteId':Number(_0x2ffc72['params']['id'])});}});}})[_0xadff('0x24')](respondWithStatusCode(_0x3bd4ed,null))['catch'](handleError(_0x3bd4ed,null));};exports[_0xadff('0x11c')]=function(_0x154841,_0x5da85f,_0x1d1849){var _0x25235d={};var _0xa5ca48={};var _0x3bf4d4;var _0x5cb628;return db[_0xadff('0x3f')][_0xadff('0x68')]({'where':{'id':_0x154841[_0xadff('0x62')]['id']}})[_0xadff('0x24')](handleEntityNotFound(_0x5da85f,null))[_0xadff('0x24')](function(_0x16c551){if(_0x16c551){_0x3bf4d4=_0x16c551;_0xa5ca48[_0xadff('0x43')]=_[_0xadff('0x58')](db[_0xadff('0xc2')][_0xadff('0x40')]);_0xa5ca48[_0xadff('0x44')]=_[_0xadff('0x58')](_0x154841['query']);_0xa5ca48['filters']=_[_0xadff('0x46')](_0xa5ca48['model'],_0xa5ca48[_0xadff('0x44')]);_0x25235d[_0xadff('0x47')]=_[_0xadff('0x46')](_0xa5ca48[_0xadff('0x43')],qs[_0xadff('0x48')](_0x154841[_0xadff('0x44')]['fields']));_0x25235d['attributes']=_0x25235d[_0xadff('0x47')][_0xadff('0x71')]?_0x25235d[_0xadff('0x47')]:_0xa5ca48[_0xadff('0x43')];_0x25235d[_0xadff('0x4b')]=qs[_0xadff('0x4c')](_0x154841['query']['sort']);_0x25235d[_0xadff('0x4d')]=qs['filters'](_[_0xadff('0x6a')](_0x154841[_0xadff('0x44')],_0xa5ca48[_0xadff('0x45')]));if(_0x154841[_0xadff('0x44')][_0xadff('0x4e')]){_0x25235d['where']=_[_0xadff('0x50')](_0x25235d[_0xadff('0x4d')],{'$or':_[_0xadff('0x3e')](_0x25235d['attributes'],function(_0x2828b2){var _0x76e756={};_0x76e756[_0x2828b2]={'$like':'%'+_0x154841['query'][_0xadff('0x4e')]+'%'};return _0x76e756;})});}_0x25235d=_[_0xadff('0x50')]({},_0x25235d,_0x154841[_0xadff('0x59')]);return _0x3bf4d4['getAgents'](_0x25235d);}})[_0xadff('0x24')](function(_0x2df153){if(_0x2df153){_0x5cb628=_0x2df153[_0xadff('0x71')];if(!_0x154841[_0xadff('0x44')][_0xadff('0x49')](_0xadff('0x69'))){_0x25235d[_0xadff('0x4a')]=qs['limit'](_0x154841[_0xadff('0x44')]['limit']);_0x25235d['offset']=qs['offset'](_0x154841[_0xadff('0x44')][_0xadff('0x30')]);}return _0x3bf4d4[_0xadff('0x11c')](_0x25235d);}})['then'](function(_0x3485b6){if(_0x3485b6){return _0x3485b6?{'count':_0x5cb628,'rows':_0x3485b6}:null;}})[_0xadff('0x24')](respondWithResult(_0x5da85f,null))[_0xadff('0x55')](handleError(_0x5da85f,null));}; \ No newline at end of file +var _0x092d=['*,*,*,*','ChatMessage','AttachmentId','User','unshift','agent','forcedOwnership','Start','startRouting','offline','send','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','ChatOfflineMessage','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','offlineMessageSubject','addInteraction','getInteractions','Contact','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','OFFLINE','No\x20timezone','Interval','Intervals','getProactiveActions','virtual','custom','License','increment','chatLicenseExceeded','push','all','some','server/files/chat/iframe.js','remote','x-real-ip','connection','remoteAddress','replace','render','alignment','verticalAlignment','textColor','addApplications','sequelize','transaction','bulkCreate','getApplications','addProactiveActions','chatProactiveAction','omit','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','html-pdf','rimraf','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','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','socket.io-emitter','redis','./chatWebsite.socket','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','request\x20sent','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','get','ChatWebsites','UserProfileResource','stack','name','index','mandatoryDispositionPause','map','ChatWebsite','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','Pause','rawAttributes','find','create','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','removeDispositions','ids','CannedAnswer','pick','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','systemAvatar','getLogo','join','../../config/license/util','getLicense','isNil','existsSync','server/files/images/logos/','root','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','getSystemAvatar','notify','setUA','headers','getResult','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','ChatApplication','Applications','account','applications','orderBy','priority','asc','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','firstName','lastName','x-real-port','referer','browser','version','format','unknown','%s\x20%s','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','close','unmanaged'];(function(_0x246115,_0x398123){var _0x385878=function(_0x534a9c){while(--_0x534a9c){_0x246115['push'](_0x246115['shift']());}};_0x385878(++_0x398123);}(_0x092d,0x182));var _0xd092=function(_0x385fed,_0x3a4757){_0x385fed=_0x385fed-0x0;var _0x52fa25=_0x092d[_0x385fed];return _0x52fa25;};'use strict';var pdf=require(_0xd092('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd092('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd092('0x2'));var rp=require(_0xd092('0x3'));var moment=require(_0xd092('0x4'));var BPromise=require(_0xd092('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd092('0x6'));var sox=require(_0xd092('0x7'));var csv=require(_0xd092('0x8'));var ejs=require(_0xd092('0x9'));var fs=require('fs');var _=require(_0xd092('0xa'));var squel=require(_0xd092('0xb'));var crypto=require('crypto');var jsforce=require(_0xd092('0xc'));var deskjs=require(_0xd092('0xd'));var toCsv=require(_0xd092('0x8'));var querystring=require('querystring');var Papa=require(_0xd092('0xe'));var Redis=require(_0xd092('0xf'));var authService=require(_0xd092('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd092('0x11'));var hardwareService=require(_0xd092('0x12'));var logger=require(_0xd092('0x13'))(_0xd092('0x14'));var utils=require(_0xd092('0x15'));var config=require('../../config/environment');var db=require(_0xd092('0x16'))['db'];config['redis']=_[_0xd092('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd092('0x18'))(new Redis(config[_0xd092('0x19')]));require(_0xd092('0x1a'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xd092('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0xd092('0x1b')][_0xd092('0x1c')]({'port':0x232a});var client9003=jayson[_0xd092('0x1b')][_0xd092('0x1c')]({'port':0x232b});function checkPasswordPattern(_0x3b39c7,_0x3f5cae,_0x21ca8b){if(_0x21ca8b){var _0x52ecb3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x52ecb3['test'](_0x3f5cae)){return _0x3b39c7;}else{throw new db[(_0xd092('0x1d'))]['ValidationError'](_0xd092('0x1e'));}}else{return _0x3b39c7;}}function respondWithRpcPromise(_0x3cf698,_0xb62cc5,_0x5bb944,_0x5822fa){return new BPromise(function(_0x403c42,_0x45d91c){var _0x4ad58c=_0x5822fa||client;return _0x4ad58c[_0xd092('0x1f')](_0x3cf698,_0x5bb944)['then'](function(_0x7d93ae){logger[_0xd092('0x20')]('ChatWebsite,\x20%s,\x20%s',_0xb62cc5,_0xd092('0x21'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0xb62cc5,_0xd092('0x21'),JSON[_0xd092('0x22')](_0x7d93ae));if(_0x7d93ae[_0xd092('0x23')]){if(_0x7d93ae[_0xd092('0x23')][_0xd092('0x24')]===0x1f4){logger[_0xd092('0x23')](_0xd092('0x25'),_0xb62cc5,_0x7d93ae[_0xd092('0x23')][_0xd092('0x26')]);return _0x45d91c(_0x7d93ae['error'][_0xd092('0x26')]);}logger[_0xd092('0x23')](_0xd092('0x25'),_0xb62cc5,_0x7d93ae[_0xd092('0x23')][_0xd092('0x26')]);return _0x403c42(_0x7d93ae[_0xd092('0x23')][_0xd092('0x26')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0xb62cc5,_0xd092('0x21'));_0x403c42(_0x7d93ae[_0xd092('0x27')][_0xd092('0x26')]);}})[_0xd092('0x28')](function(_0x16b1fb){logger[_0xd092('0x23')](_0xd092('0x25'),_0xb62cc5,_0x16b1fb);_0x45d91c(_0x16b1fb);});});}function respondWithStatusCode(_0x407ebf,_0x5e4a2d){_0x5e4a2d=_0x5e4a2d||0xcc;return function(_0x4ac920){if(_0x4ac920){return _0x407ebf[_0xd092('0x29')](_0x5e4a2d);}return _0x407ebf[_0xd092('0x2a')](_0x5e4a2d)[_0xd092('0x2b')]();};}function respondWithResult(_0x33c6b4,_0x3eb20c){_0x3eb20c=_0x3eb20c||0xc8;return function(_0x3b7654){if(_0x3b7654){return _0x33c6b4[_0xd092('0x2a')](_0x3eb20c)['json'](_0x3b7654);}};}function respondWithFilteredResult(_0x34d14c,_0x59948f){return function(_0x564633){if(_0x564633){var _0x28d178=_0x564633[_0xd092('0x2c')],_0x2394a4=_0x59948f[_0xd092('0x2d')],_0x28c9dd=_0x59948f[_0xd092('0x2d')]+_0x59948f['limit'],_0x42249;if(_0x28c9dd>=_0x28d178){_0x28c9dd=_0x28d178;_0x42249=0xc8;}else{_0x42249=0xce;}_0x34d14c[_0xd092('0x2a')](_0x42249);return _0x34d14c['set'](_0xd092('0x2e'),_0x2394a4+'-'+_0x28c9dd+'/'+_0x28d178)[_0xd092('0x2f')](_0x564633);}return null;};}function patchUpdates(_0x2f8ee7){return function(_0x426432){try{jsonpatch[_0xd092('0x30')](_0x426432,_0x2f8ee7,!![]);}catch(_0x465cba){return BPromise[_0xd092('0x31')](_0x465cba);}return _0x426432[_0xd092('0x32')]();};}function saveUpdates(_0x5518ac,_0x3780da){return function(_0x459a5d){if(_0x459a5d){return _0x459a5d[_0xd092('0x33')](_0x5518ac)[_0xd092('0x34')](function(_0x3b65ec){return _0x3b65ec;});}return null;};}function removeEntity(_0x390729,_0x5e82aa){return function(_0x40ed69){if(_0x40ed69){return _0x40ed69[_0xd092('0x35')]()[_0xd092('0x34')](function(){var _0x140284=_0x40ed69[_0xd092('0x36')]({'plain':!![]});var _0x48078c=_0xd092('0x37');return db[_0xd092('0x38')]['destroy']({'where':{'type':_0x48078c,'resourceId':_0x140284['id']}})['then'](function(){return _0x40ed69;});})[_0xd092('0x34')](function(){_0x390729[_0xd092('0x2a')](0xcc)[_0xd092('0x2b')]();});}};}function handleEntityNotFound(_0x5c56e7,_0x2fd17f){return function(_0x1cdd7e){if(!_0x1cdd7e){_0x5c56e7[_0xd092('0x29')](0x194);}return _0x1cdd7e;};}function handleError(_0x331756,_0x5c56d5){_0x5c56d5=_0x5c56d5||0x1f4;return function(_0x3185fb){logger[_0xd092('0x23')](_0x3185fb[_0xd092('0x39')]);if(_0x3185fb['name']){delete _0x3185fb[_0xd092('0x3a')];}_0x331756[_0xd092('0x2a')](_0x5c56d5)['send'](_0x3185fb);};}exports[_0xd092('0x3b')]=function(_0x471e1b,_0x814aef){var _0x383cd7={'include':[{'model':db['Pause'],'as':_0xd092('0x3c')}]},_0x58fc70={},_0x48a05a={'count':0x0,'rows':[]};var _0x2b03b8=_[_0xd092('0x3d')](db[_0xd092('0x3e')]['rawAttributes'],function(_0x52db72){return{'name':_0x52db72[_0xd092('0x3f')],'type':_0x52db72[_0xd092('0x40')][_0xd092('0x41')]};});_0x58fc70[_0xd092('0x42')]=_[_0xd092('0x3d')](_0x2b03b8,_0xd092('0x3a'));_0x58fc70['query']=_[_0xd092('0x43')](_0x471e1b[_0xd092('0x44')]);_0x58fc70[_0xd092('0x45')]=_['intersection'](_0x58fc70['model'],_0x58fc70[_0xd092('0x44')]);_0x383cd7[_0xd092('0x46')]=_[_0xd092('0x47')](_0x58fc70[_0xd092('0x42')],qs[_0xd092('0x48')](_0x471e1b[_0xd092('0x44')][_0xd092('0x48')]));_0x383cd7['attributes']=_0x383cd7[_0xd092('0x46')][_0xd092('0x49')]?_0x383cd7[_0xd092('0x46')]:_0x58fc70[_0xd092('0x42')];if(!_0x471e1b[_0xd092('0x44')][_0xd092('0x4a')](_0xd092('0x4b'))){_0x383cd7[_0xd092('0x4c')]=qs['limit'](_0x471e1b[_0xd092('0x44')][_0xd092('0x4c')]);_0x383cd7['offset']=qs[_0xd092('0x2d')](_0x471e1b[_0xd092('0x44')][_0xd092('0x2d')]);}_0x383cd7[_0xd092('0x4d')]=qs[_0xd092('0x4e')](_0x471e1b['query'][_0xd092('0x4e')]);_0x383cd7[_0xd092('0x4f')]=qs[_0xd092('0x45')](_['pick'](_0x471e1b['query'],_0x58fc70[_0xd092('0x45')]));if(_0x471e1b[_0xd092('0x44')][_0xd092('0x50')]){_0x383cd7[_0xd092('0x4f')]=_[_0xd092('0x51')](_0x383cd7[_0xd092('0x4f')],{'$or':_[_0xd092('0x3d')](_0x2b03b8,function(_0x3615f1){if(_0x3615f1[_0xd092('0x40')]!==_0xd092('0x52')){var _0x5d4145={};_0x5d4145[_0x3615f1[_0xd092('0x3a')]]={'$like':'%'+_0x471e1b['query'][_0xd092('0x50')]+'%'};return _0x5d4145;}})});}_0x383cd7=_['merge']({},_0x383cd7,_0x471e1b[_0xd092('0x53')]);var _0x431ce5={'where':_0x383cd7[_0xd092('0x4f')]};return db[_0xd092('0x3e')][_0xd092('0x2c')](_0x431ce5)['then'](function(_0x5da15f){_0x48a05a['count']=_0x5da15f;if(_0x471e1b[_0xd092('0x44')][_0xd092('0x54')]){_0x383cd7[_0xd092('0x55')]=[{'all':!![]}];}return db[_0xd092('0x3e')][_0xd092('0x56')](_0x383cd7);})[_0xd092('0x34')](function(_0x1c1511){_0x48a05a[_0xd092('0x57')]=_0x1c1511;return _0x48a05a;})[_0xd092('0x34')](respondWithFilteredResult(_0x814aef,_0x383cd7))[_0xd092('0x28')](handleError(_0x814aef,null));};exports['show']=function(_0x5cd5ec,_0x8e031c){var _0x22cf24={'raw':![],'where':{'id':_0x5cd5ec[_0xd092('0x58')]['id']},'include':[{'model':db[_0xd092('0x59')],'as':'mandatoryDispositionPause'}]},_0x2b2637={};_0x2b2637['model']=_[_0xd092('0x43')](db[_0xd092('0x3e')][_0xd092('0x5a')]);_0x2b2637[_0xd092('0x44')]=_[_0xd092('0x43')](_0x5cd5ec[_0xd092('0x44')]);_0x2b2637[_0xd092('0x45')]=_['intersection'](_0x2b2637[_0xd092('0x42')],_0x2b2637[_0xd092('0x44')]);_0x22cf24['attributes']=_[_0xd092('0x47')](_0x2b2637[_0xd092('0x42')],qs['fields'](_0x5cd5ec['query'][_0xd092('0x48')]));_0x22cf24['attributes']=_0x22cf24['attributes'][_0xd092('0x49')]?_0x22cf24[_0xd092('0x46')]:_0x2b2637[_0xd092('0x42')];if(_0x5cd5ec[_0xd092('0x44')][_0xd092('0x54')]){_0x22cf24[_0xd092('0x55')]=[{'all':!![]}];}_0x22cf24=_['merge']({},_0x22cf24,_0x5cd5ec['options']);return db[_0xd092('0x3e')][_0xd092('0x5b')](_0x22cf24)[_0xd092('0x34')](handleEntityNotFound(_0x8e031c,null))[_0xd092('0x34')](respondWithResult(_0x8e031c,null))['catch'](handleError(_0x8e031c,null));};exports[_0xd092('0x5c')]=function(_0x1dbc38,_0x10e39d){return db[_0xd092('0x3e')][_0xd092('0x5c')](_0x1dbc38['body'],{})[_0xd092('0x34')](function(_0x4b628a){var _0x33fdea=_0x1dbc38['user'][_0xd092('0x36')]({'plain':!![]});if(!_0x33fdea)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x33fdea['role']===_0xd092('0x5d')){var _0x26ef5e=_0x4b628a[_0xd092('0x36')]({'plain':!![]});var _0x1b9542=_0xd092('0x37');return db[_0xd092('0x5e')][_0xd092('0x5b')]({'where':{'name':_0x1b9542,'userProfileId':_0x33fdea[_0xd092('0x5f')]},'raw':!![]})[_0xd092('0x34')](function(_0x51e78b){if(_0x51e78b&&_0x51e78b['autoAssociation']===0x0){return db[_0xd092('0x38')][_0xd092('0x5c')]({'name':_0x26ef5e[_0xd092('0x3a')],'resourceId':_0x26ef5e['id'],'type':_0x51e78b[_0xd092('0x3a')],'sectionId':_0x51e78b['id']},{})['then'](function(){return _0x4b628a;});}else{return _0x4b628a;}})['catch'](function(_0x1a517c){logger[_0xd092('0x23')](_0xd092('0x60'),_0x1a517c);throw _0x1a517c;});}return _0x4b628a;})[_0xd092('0x34')](respondWithResult(_0x10e39d,0xc9))[_0xd092('0x28')](handleError(_0x10e39d,null));};exports['update']=function(_0xfac89,_0x4fddec){if(_0xfac89['body']['id']){delete _0xfac89[_0xd092('0x61')]['id'];}return db[_0xd092('0x3e')][_0xd092('0x5b')]({'where':{'id':_0xfac89[_0xd092('0x58')]['id']},'include':[{'model':db[_0xd092('0x59')],'as':_0xd092('0x3c')}]})[_0xd092('0x34')](handleEntityNotFound(_0x4fddec,null))[_0xd092('0x34')](saveUpdates(_0xfac89[_0xd092('0x61')],null))[_0xd092('0x34')](respondWithResult(_0x4fddec,null))[_0xd092('0x28')](handleError(_0x4fddec,null));};exports['destroy']=function(_0x5f3562,_0x7a15cc){return db[_0xd092('0x3e')]['find']({'where':{'id':_0x5f3562['params']['id']}})[_0xd092('0x34')](handleEntityNotFound(_0x7a15cc,null))[_0xd092('0x34')](removeEntity(_0x7a15cc,null))[_0xd092('0x28')](handleError(_0x7a15cc,null));};exports[_0xd092('0x62')]=function(_0x5217a3,_0x2e5ebf){return db['ChatWebsite'][_0xd092('0x62')]()[_0xd092('0x34')](respondWithResult(_0x2e5ebf,null))['catch'](handleError(_0x2e5ebf,null));};exports[_0xd092('0x63')]=function(_0x1a3c26,_0x222b0e,_0x436f53){if(_0x1a3c26[_0xd092('0x61')]['id']){delete _0x1a3c26[_0xd092('0x61')]['id'];}return db['ChatWebsite'][_0xd092('0x5b')]({'where':{'id':_0x1a3c26[_0xd092('0x58')]['id']}})[_0xd092('0x34')](handleEntityNotFound(_0x222b0e,null))[_0xd092('0x34')](function(_0x472e34){if(_0x472e34){_0x1a3c26[_0xd092('0x61')][_0xd092('0x64')]=_0x472e34['id'];return db[_0xd092('0x65')][_0xd092('0x5c')](_0x1a3c26[_0xd092('0x61')]);}})['then'](respondWithResult(_0x222b0e,null))[_0xd092('0x28')](handleError(_0x222b0e,null));};exports[_0xd092('0x66')]=function(_0x3afc16,_0x4ee45a,_0x35b6ff){var _0x13919f={'raw':![],'where':{}};var _0x2b4842={};var _0x464f08={'count':0x0,'rows':[]};return db[_0xd092('0x3e')][_0xd092('0x67')]({'where':{'id':_0x3afc16[_0xd092('0x58')]['id']}})['then'](handleEntityNotFound(_0x4ee45a,null))[_0xd092('0x34')](function(_0x59b0c4){if(_0x59b0c4){_0x2b4842[_0xd092('0x42')]=_[_0xd092('0x43')](db[_0xd092('0x65')][_0xd092('0x5a')]);_0x2b4842[_0xd092('0x44')]=_[_0xd092('0x43')](_0x3afc16[_0xd092('0x44')]);_0x2b4842[_0xd092('0x45')]=_[_0xd092('0x47')](_0x2b4842['model'],_0x2b4842['query']);_0x13919f[_0xd092('0x46')]=_[_0xd092('0x47')](_0x2b4842['model'],qs['fields'](_0x3afc16[_0xd092('0x44')][_0xd092('0x48')]));_0x13919f[_0xd092('0x46')]=_0x13919f[_0xd092('0x46')][_0xd092('0x49')]?_0x13919f[_0xd092('0x46')]:_0x2b4842[_0xd092('0x42')];if(!_0x3afc16[_0xd092('0x44')][_0xd092('0x4a')](_0xd092('0x4b'))){_0x13919f[_0xd092('0x4c')]=qs[_0xd092('0x4c')](_0x3afc16[_0xd092('0x44')][_0xd092('0x4c')]);_0x13919f[_0xd092('0x2d')]=qs[_0xd092('0x2d')](_0x3afc16[_0xd092('0x44')][_0xd092('0x2d')]);}_0x13919f[_0xd092('0x4d')]=qs[_0xd092('0x4e')](_0x3afc16[_0xd092('0x44')][_0xd092('0x4e')]);_0x13919f[_0xd092('0x4f')]=qs['filters'](_['pick'](_0x3afc16[_0xd092('0x44')],_0x2b4842[_0xd092('0x45')]));_0x13919f[_0xd092('0x4f')][_0xd092('0x64')]=_0x59b0c4['id'];if(_0x3afc16['query']['filter']){_0x13919f['where']=_[_0xd092('0x51')](_0x13919f['where'],{'$or':_[_0xd092('0x3d')](_0x13919f[_0xd092('0x46')],function(_0x51203a){var _0x15a01c={};_0x15a01c[_0x51203a]={'$like':'%'+_0x3afc16[_0xd092('0x44')]['filter']+'%'};return _0x15a01c;})});}_0x13919f=_[_0xd092('0x51')]({},_0x13919f,_0x3afc16[_0xd092('0x53')]);return db['Disposition'][_0xd092('0x2c')]({'where':_0x13919f['where']})['then'](function(_0x5008fb){_0x464f08['count']=_0x5008fb;if(_0x3afc16[_0xd092('0x44')][_0xd092('0x54')]){_0x13919f[_0xd092('0x55')]=[{'all':!![]}];}return db[_0xd092('0x65')][_0xd092('0x56')](_0x13919f);})[_0xd092('0x34')](function(_0x3b2ab4){_0x464f08[_0xd092('0x57')]=_0x3b2ab4;return _0x464f08;});}})['then'](respondWithFilteredResult(_0x4ee45a,_0x13919f))[_0xd092('0x28')](handleError(_0x4ee45a,null));};exports[_0xd092('0x68')]=function(_0x260a14,_0x278d28,_0x4843dc){return db['ChatWebsite'][_0xd092('0x5b')]({'where':{'id':_0x260a14['params']['id']}})['then'](handleEntityNotFound(_0x278d28,null))['then'](function(_0xb094cd){if(_0xb094cd){return _0xb094cd['removeDispositions'](_0x260a14[_0xd092('0x44')][_0xd092('0x69')]);}})[_0xd092('0x34')](respondWithStatusCode(_0x278d28,null))[_0xd092('0x28')](handleError(_0x278d28,null));};exports['addAnswer']=function(_0x2fbd22,_0x5181f6,_0x4bfa42){if(_0x2fbd22[_0xd092('0x61')]['id']){delete _0x2fbd22[_0xd092('0x61')]['id'];}return db[_0xd092('0x3e')][_0xd092('0x5b')]({'where':{'id':_0x2fbd22['params']['id']}})[_0xd092('0x34')](handleEntityNotFound(_0x5181f6,null))[_0xd092('0x34')](function(_0xc50837){if(_0xc50837){_0x2fbd22['body'][_0xd092('0x64')]=_0xc50837['id'];return db[_0xd092('0x6a')]['create'](_0x2fbd22[_0xd092('0x61')]);}})[_0xd092('0x34')](respondWithResult(_0x5181f6,null))[_0xd092('0x28')](handleError(_0x5181f6,null));};exports['getAnswers']=function(_0xf5dc99,_0xf18d7f,_0x1a6828){var _0x4f50c7={'raw':![],'where':{}};var _0x4aa6e={};var _0x19f16e={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xd092('0x67')]({'where':{'id':_0xf5dc99['params']['id']}})[_0xd092('0x34')](handleEntityNotFound(_0xf18d7f,null))['then'](function(_0x50fad8){if(_0x50fad8){_0x4aa6e[_0xd092('0x42')]=_['keys'](db[_0xd092('0x6a')][_0xd092('0x5a')]);_0x4aa6e[_0xd092('0x44')]=_[_0xd092('0x43')](_0xf5dc99['query']);_0x4aa6e['filters']=_['intersection'](_0x4aa6e[_0xd092('0x42')],_0x4aa6e['query']);_0x4f50c7['attributes']=_['intersection'](_0x4aa6e['model'],qs[_0xd092('0x48')](_0xf5dc99[_0xd092('0x44')][_0xd092('0x48')]));_0x4f50c7[_0xd092('0x46')]=_0x4f50c7['attributes'][_0xd092('0x49')]?_0x4f50c7[_0xd092('0x46')]:_0x4aa6e[_0xd092('0x42')];if(!_0xf5dc99[_0xd092('0x44')][_0xd092('0x4a')](_0xd092('0x4b'))){_0x4f50c7['limit']=qs[_0xd092('0x4c')](_0xf5dc99[_0xd092('0x44')][_0xd092('0x4c')]);_0x4f50c7['offset']=qs[_0xd092('0x2d')](_0xf5dc99[_0xd092('0x44')][_0xd092('0x2d')]);}_0x4f50c7['order']=qs[_0xd092('0x4e')](_0xf5dc99['query']['sort']);_0x4f50c7['where']=qs[_0xd092('0x45')](_[_0xd092('0x6b')](_0xf5dc99[_0xd092('0x44')],_0x4aa6e[_0xd092('0x45')]));_0x4f50c7[_0xd092('0x4f')][_0xd092('0x64')]=_0x50fad8['id'];if(_0xf5dc99[_0xd092('0x44')][_0xd092('0x50')]){_0x4f50c7['where']=_[_0xd092('0x51')](_0x4f50c7[_0xd092('0x4f')],{'$or':_[_0xd092('0x3d')](_0x4f50c7['attributes'],function(_0x589538){var _0x252db7={};_0x252db7[_0x589538]={'$like':'%'+_0xf5dc99[_0xd092('0x44')][_0xd092('0x50')]+'%'};return _0x252db7;})});}_0x4f50c7=_[_0xd092('0x51')]({},_0x4f50c7,_0xf5dc99[_0xd092('0x53')]);return db[_0xd092('0x6a')][_0xd092('0x2c')]({'where':_0x4f50c7[_0xd092('0x4f')]})[_0xd092('0x34')](function(_0x34d6e3){_0x19f16e[_0xd092('0x2c')]=_0x34d6e3;if(_0xf5dc99[_0xd092('0x44')]['includeAll']){_0x4f50c7[_0xd092('0x55')]=[{'all':!![]}];}return db[_0xd092('0x6a')][_0xd092('0x56')](_0x4f50c7);})['then'](function(_0x9ae31){_0x19f16e['rows']=_0x9ae31;return _0x19f16e;});}})[_0xd092('0x34')](respondWithFilteredResult(_0xf18d7f,_0x4f50c7))['catch'](handleError(_0xf18d7f,null));};exports[_0xd092('0x6c')]=function(_0x2f1359,_0x4dd68d,_0x96a720){return db['ChatWebsite'][_0xd092('0x5b')]({'where':{'id':_0x2f1359[_0xd092('0x58')]['id']}})['then'](handleEntityNotFound(_0x4dd68d,null))[_0xd092('0x34')](function(_0x26a63f){if(_0x26a63f){return _0x26a63f[_0xd092('0x6c')](_0x2f1359[_0xd092('0x44')]['ids']);}})[_0xd092('0x34')](respondWithStatusCode(_0x4dd68d,null))[_0xd092('0x28')](handleError(_0x4dd68d,null));};exports[_0xd092('0x6d')]=function(_0x807b90,_0x1ee8cc,_0x5759ea){_0x807b90[_0xd092('0x61')][_0xd092('0x6e')]=_0x807b90[_0xd092('0x6f')][_0xd092('0x70')];return db[_0xd092('0x3e')][_0xd092('0x5b')]({'where':{'id':_0x807b90['params']['id']}})['then'](handleEntityNotFound(_0x1ee8cc,null))[_0xd092('0x34')](saveUpdates(_0x807b90[_0xd092('0x61')],null))[_0xd092('0x34')](respondWithResult(_0x1ee8cc,null))[_0xd092('0x28')](handleError(_0x1ee8cc,null));};exports[_0xd092('0x71')]=function(_0x421c6c,_0x36a25e,_0x5a07ec){_0x421c6c[_0xd092('0x61')][_0xd092('0x72')]=_0x421c6c[_0xd092('0x6f')][_0xd092('0x70')];return db[_0xd092('0x3e')][_0xd092('0x5b')]({'where':{'id':_0x421c6c['params']['id']}})['then'](handleEntityNotFound(_0x36a25e,null))[_0xd092('0x34')](saveUpdates(_0x421c6c[_0xd092('0x61')],null))['then'](respondWithResult(_0x36a25e,null))[_0xd092('0x28')](handleError(_0x36a25e,null));};exports[_0xd092('0x73')]=function(_0x4b619,_0x524ac3,_0x100c7b){_0x4b619['body']['customerAvatar']=_0x4b619['file'][_0xd092('0x70')];return db[_0xd092('0x3e')]['find']({'where':{'id':_0x4b619[_0xd092('0x58')]['id']}})[_0xd092('0x34')](handleEntityNotFound(_0x524ac3,null))['then'](saveUpdates(_0x4b619[_0xd092('0x61')],null))[_0xd092('0x34')](respondWithResult(_0x524ac3,null))[_0xd092('0x28')](handleError(_0x524ac3,null));};exports['addSystemAvatar']=function(_0x23d35d,_0x39b683,_0x1b9b85){_0x23d35d[_0xd092('0x61')][_0xd092('0x74')]=_0x23d35d[_0xd092('0x6f')]['filename'];return db[_0xd092('0x3e')]['find']({'where':{'id':_0x23d35d[_0xd092('0x58')]['id']}})[_0xd092('0x34')](handleEntityNotFound(_0x39b683,null))[_0xd092('0x34')](saveUpdates(_0x23d35d['body'],null))['then'](respondWithResult(_0x39b683,null))[_0xd092('0x28')](handleError(_0x39b683,null));};exports[_0xd092('0x75')]=function(_0x453b45,_0x175f13,_0x457890){var _0xc0b56c=path[_0xd092('0x76')](config['root'],'server/files/images/logos/default_logo.png');var _0x344654={'where':{'id':_0x453b45[_0xd092('0x58')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x3d898d=![];return require(_0xd092('0x77'))[_0xd092('0x78')]()[_0xd092('0x34')](function(_0x19d383){if(_0x19d383){_0x3d898d=_0x19d383['custom'];}})[_0xd092('0x34')](function(){return db[_0xd092('0x3e')][_0xd092('0x5b')](_0x344654);})[_0xd092('0x34')](handleEntityNotFound(_0x175f13,null))[_0xd092('0x34')](function(_0x550e0a){if(_0x550e0a){if(!_[_0xd092('0x79')](_0x550e0a[_0xd092('0x6e')])){if(fs[_0xd092('0x7a')](path[_0xd092('0x76')](config['root'],_0xd092('0x7b'),_0x550e0a[_0xd092('0x6e')]))&&_0x3d898d){_0xc0b56c=path['join'](config[_0xd092('0x7c')],_0xd092('0x7b'),_0x550e0a[_0xd092('0x6e')]);}}return _0x175f13[_0xd092('0x7d')](_0xc0b56c);}})[_0xd092('0x28')](handleError(_0x175f13,null));};exports[_0xd092('0x7e')]=function(_0x3020e1,_0x3e5b53,_0xbcf532){var _0x1312df=path[_0xd092('0x76')](config[_0xd092('0x7c')],_0xd092('0x7f'));var _0x16d0b1={'where':{'id':_0x3020e1[_0xd092('0x58')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0xd092('0x3e')][_0xd092('0x5b')](_0x16d0b1)['then'](handleEntityNotFound(_0x3e5b53,null))[_0xd092('0x34')](function(_0x5e3e7b){if(_0x5e3e7b){if(!_[_0xd092('0x79')](_0x5e3e7b['agentAvatar'])){if(fs[_0xd092('0x7a')](path[_0xd092('0x76')](config[_0xd092('0x7c')],_0xd092('0x80'),_0x5e3e7b[_0xd092('0x72')]))){_0x1312df=path[_0xd092('0x76')](config['root'],'server/files/images/avatars/',_0x5e3e7b[_0xd092('0x72')]);}}return _0x3e5b53[_0xd092('0x7d')](_0x1312df);}})['catch'](handleError(_0x3e5b53,null));};exports[_0xd092('0x81')]=function(_0x47a998,_0x208b56,_0x5f4e3f){var _0x3a098d=path[_0xd092('0x76')](config['root'],_0xd092('0x82'));var _0x55405b={'where':{'id':_0x47a998['params']['id']},'attributes':['id',_0xd092('0x83'),_0xd092('0x84')],'raw':!![]};return db[_0xd092('0x3e')][_0xd092('0x5b')](_0x55405b)['then'](handleEntityNotFound(_0x208b56,null))[_0xd092('0x34')](function(_0x313daa){if(_0x313daa){if(!_[_0xd092('0x79')](_0x313daa[_0xd092('0x83')])){if(fs[_0xd092('0x7a')](path['join'](config[_0xd092('0x7c')],_0xd092('0x80'),_0x313daa['customerAvatar']))&&_0x313daa[_0xd092('0x84')]){_0x3a098d=path[_0xd092('0x76')](config[_0xd092('0x7c')],_0xd092('0x80'),_0x313daa[_0xd092('0x83')]);}}return _0x208b56[_0xd092('0x7d')](_0x3a098d);}})[_0xd092('0x28')](handleError(_0x208b56,null));};exports[_0xd092('0x85')]=function(_0x3dd786,_0x2741b5,_0xfa92a6){var _0x5b94b8=path[_0xd092('0x76')](config[_0xd092('0x7c')],'server/files/images/avatars/system_avatar.png');var _0x405fc5={'where':{'id':_0x3dd786['params']['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xd092('0x3e')][_0xd092('0x5b')](_0x405fc5)['then'](handleEntityNotFound(_0x2741b5,null))[_0xd092('0x34')](function(_0x48e896){if(_0x48e896){if(!_[_0xd092('0x79')](_0x48e896['systemAvatar'])){if(fs[_0xd092('0x7a')](path[_0xd092('0x76')](config['root'],_0xd092('0x80'),_0x48e896[_0xd092('0x74')]))){_0x5b94b8=path[_0xd092('0x76')](config[_0xd092('0x7c')],_0xd092('0x80'),_0x48e896[_0xd092('0x74')]);}}return _0x2741b5[_0xd092('0x7d')](_0x5b94b8);}})[_0xd092('0x28')](handleError(_0x2741b5,null));};exports[_0xd092('0x86')]=function(_0x3a638d,_0xa2fd49,_0x105f3d){var _0x2414fc=require('user-agent-parser');var _0x4347ff=new _0x2414fc();var _0x69d2c9=_0x4347ff[_0xd092('0x87')](_0x3a638d[_0xd092('0x88')]['user-agent'])[_0xd092('0x89')]();var _0x3f00f0={'body':_0x3a638d['body'],'channel':'chat'};var _0x2f7d56=[];var _0x2ba63f=[];var _0x1554ec={};var _0x2379ab=![];return db[_0xd092('0x8a')]['describe']()[_0xd092('0x34')](function(_0x3f44f4){if(!_0x3f44f4){throw new db['Sequelize'][(_0xd092('0x8b'))](_0xd092('0x8c'));}_0x2f7d56=_[_0xd092('0x8d')](_['keys'](_0x3f44f4),[_0xd092('0x8e'),_0xd092('0x8f')]);_0x2ba63f=_[_0xd092('0x8d')](_[_0xd092('0x43')](_0x3f44f4),[_0xd092('0x8e'),_0xd092('0x8f'),_0xd092('0x90'),_0xd092('0x91')]);if(_0x3a638d[_0xd092('0x61')]['id']){delete _0x3a638d[_0xd092('0x61')]['id'];}if(_[_0xd092('0x79')](_0x3a638d[_0xd092('0x61')][_0xd092('0x92')])){throw new db[(_0xd092('0x1d'))][(_0xd092('0x8b'))](_0xd092('0x93'));}if(_['isNil'](_0x3a638d[_0xd092('0x61')][_0xd092('0x61')])||_0x3a638d[_0xd092('0x61')][_0xd092('0x61')]===''){throw new db['Sequelize'][(_0xd092('0x8b'))](_0xd092('0x94'));}if(_[_0xd092('0x79')](_0x3a638d[_0xd092('0x61')][_0xd092('0x95')])){throw new db[(_0xd092('0x1d'))][(_0xd092('0x8b'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2ba63f);}if(!_[_0xd092('0x96')](_0x2ba63f,_0x3a638d[_0xd092('0x61')][_0xd092('0x95')])){throw new db['Sequelize'][(_0xd092('0x8b'))](_0xd092('0x97')+_0x2ba63f);}_0x1554ec[_0x3a638d[_0xd092('0x61')][_0xd092('0x95')]]=_0x3a638d[_0xd092('0x61')][_0xd092('0x92')];})[_0xd092('0x34')](function(){return db[_0xd092('0x3e')][_0xd092('0x5b')]({'where':{'id':_0x3a638d[_0xd092('0x58')]['id']},'include':[{'model':db[_0xd092('0x98')],'as':_0xd092('0x99'),'include':[{'model':db['CmContact'],'as':_0xd092('0x9a'),'where':_0x1554ec,'limit':0x1,'order':[['updatedAt',_0xd092('0x9b')]]}]},{'model':db[_0xd092('0x9c')],'as':_0xd092('0x9d')}]});})[_0xd092('0x34')](handleEntityNotFound(_0xa2fd49,null))[_0xd092('0x34')](function(_0x8d42ff){if(_0x8d42ff&&_0x8d42ff[_0xd092('0x99')]){_0x3f00f0[_0xd092('0x9e')]=_0x8d42ff;_0x3f00f0[_0xd092('0x9f')]=_0x8d42ff['Applications'];_0x3f00f0['list']=_0x8d42ff[_0xd092('0x99')];_0x3f00f0['applications']=_[_0xd092('0xa0')](_0x3f00f0[_0xd092('0x9f')],[_0xd092('0xa1')],[_0xd092('0xa2')]);if(_0x3f00f0[_0xd092('0x9e')]['Applications']){delete _0x3f00f0[_0xd092('0x9e')][_0xd092('0x9d')];}if(_0x3f00f0[_0xd092('0x9e')][_0xd092('0x99')]&&_0x3f00f0[_0xd092('0x9e')][_0xd092('0x99')]['Contacts'][_0xd092('0x49')]){return _0x3f00f0[_0xd092('0x9e')][_0xd092('0x99')][_0xd092('0x9a')][0x0];}var _0x568754=_[_0xd092('0x17')](_0x3a638d[_0xd092('0x61')],{'firstName':_0x3a638d['body'][_0xd092('0x92')],'ListId':_0x8d42ff['ListId']});_0x568754[_0x3a638d[_0xd092('0x61')]['mapKey']]=_0x3a638d[_0xd092('0x61')]['from'];return db[_0xd092('0x8a')][_0xd092('0x5c')](_0x568754,{'fields':_0x2f7d56,'raw':!![]});}})['then'](handleEntityNotFound(_0xa2fd49,null))[_0xd092('0x34')](function(_0x559c45){_0x3f00f0[_0xd092('0xa3')]=_0x559c45;var _0x5bee9c=_0x3a638d[_0xd092('0x61')][_0xd092('0xa4')];if(_0x3a638d['headers'][_0xd092('0xa5')]){_0x5bee9c=_0x3a638d[_0xd092('0x88')][_0xd092('0xa5')];}else if(_0x3a638d['headers'][_0xd092('0xa6')]){_0x5bee9c=_[_0xd092('0xa7')](_0x3a638d[_0xd092('0x88')][_0xd092('0xa6')]['split'](','));}if(_0x559c45){var _0xabe828={'ContactId':_0x559c45['id'],'ChatWebsiteId':_0x3a638d['params']['id'],'from':(_0x559c45[_0xd092('0xa8')]||'')+'\x20'+(_0x559c45[_0xd092('0xa9')]||''),'customerIp':_0x5bee9c,'customerPort':_0x3a638d[_0xd092('0x88')]['x-real-port']?_0x3a638d['headers'][_0xd092('0xaa')]:null,'referer':_0x3a638d[_0xd092('0x61')][_0xd092('0xab')],'browserName':_0x69d2c9[_0xd092('0xac')][_0xd092('0x3a')]&&_0x69d2c9['browser'][_0xd092('0xad')]?util[_0xd092('0xae')]('%s\x20%s',_0x69d2c9['browser']['name'],_0x69d2c9[_0xd092('0xac')]['version']):_0xd092('0xaf'),'browserVersion':_0x69d2c9[_0xd092('0xac')][_0xd092('0xad')]||_0xd092('0xaf'),'osName':util[_0xd092('0xae')](_0xd092('0xb0'),_0x69d2c9['os']['name'],_0x69d2c9['os'][_0xd092('0xad')]),'osVersion':_0x69d2c9['os']['version'],'deviceModel':_0x69d2c9[_0xd092('0xb1')]['model']&&_0x69d2c9[_0xd092('0xb1')][_0xd092('0xb2')]?util[_0xd092('0xae')](_0xd092('0xb3'),_0x69d2c9[_0xd092('0xb1')][_0xd092('0x42')],_0x69d2c9[_0xd092('0xb1')][_0xd092('0xb2')],_0x69d2c9[_0xd092('0xb1')][_0xd092('0x40')]):null,'deviceVendor':_0x69d2c9[_0xd092('0xb1')][_0xd092('0xb2')],'deviceType':_0x69d2c9[_0xd092('0xb1')][_0xd092('0x40')],'formData':JSON[_0xd092('0x22')](_0x3a638d[_0xd092('0x61')])};var _0x3ce6ac={'ChatWebsiteId':_0x3a638d[_0xd092('0x58')]['id'],'closed':![]};if(_0x3a638d['body']['threadId']){_0x3ce6ac[_0xd092('0xb4')]=_0x3a638d['body']['threadId'];return db[_0xd092('0xb5')][_0xd092('0x5b')]({'where':_0x3ce6ac})[_0xd092('0x34')](function(_0x2aa4e9){if(_0x2aa4e9){return[_0x2aa4e9,![]];}_0xabe828['threadId']=_0x3a638d[_0xd092('0x61')][_0xd092('0xb4')];_0xabe828[_0xd092('0xb6')]=_0x3a638d[_0xd092('0x61')][_0xd092('0xb6')];return db[_0xd092('0xb5')]['create'](_0xabe828)[_0xd092('0x34')](function(_0xc7b14f){return[_0xc7b14f,!![]];});});}_0x3ce6ac[_0xd092('0xb7')]=_0x559c45['id'];if(_0x3a638d['body'][_0xd092('0xb8')]&&_0x3a638d['body']['interaction']['id']){_0x3ce6ac['id']=_0x3a638d[_0xd092('0x61')][_0xd092('0xb8')]['id'];return db[_0xd092('0xb5')][_0xd092('0x5b')]({'where':_0x3ce6ac})[_0xd092('0x34')](function(_0x47b144){if(_0x47b144){return[_0x47b144,![]];}return db[_0xd092('0xb5')]['create'](_0xabe828)['then'](function(_0x509c71){return[_0x509c71,!![]];});});}return db[_0xd092('0xb5')]['create'](_0xabe828)[_0xd092('0x34')](function(_0x1d0e2c){return[_0x1d0e2c,!![]];});}})[_0xd092('0xb9')](function(_0x4d77c2,_0x98948f){if(_0x4d77c2){_0x2379ab=_0x98948f;if(!_0x98948f){var _0x5993f2={'from':(_0x3f00f0[_0xd092('0xa3')][_0xd092('0xa8')]||'')+'\x20'+(_0x3f00f0[_0xd092('0xa3')][_0xd092('0xa9')]||'')};if(_0x3a638d[_0xd092('0x61')][_0xd092('0xb4')]&&_0x3a638d[_0xd092('0x61')][_0xd092('0xba')]&&_0x3a638d[_0xd092('0x61')][_0xd092('0xb4')]!=_0x3a638d[_0xd092('0x61')][_0xd092('0xba')]){_0x5993f2['threadId']=_0x3a638d[_0xd092('0x61')][_0xd092('0xba')];}return _0x4d77c2[_0xd092('0x33')](_0x5993f2);}else{return _0x4d77c2;}}})[_0xd092('0x34')](function(_0x3b47ac){_0x3f00f0['interaction']=_0x3b47ac[_0xd092('0x36')]({'plain':!![]});_0x3f00f0[_0xd092('0xb8')][_0xd092('0xbb')]=_0x2379ab;if(_0x3f00f0['interaction'][_0xd092('0xbb')]){if(_0x3f00f0[_0xd092('0x9e')]['autoclose']){_0x3f00f0[_0xd092('0x9f')]['push']({'id':0x0,'priority':_0x3f00f0['applications'][_0xd092('0x49')]+0x1,'app':_0xd092('0xbc'),'appdata':_0xd092('0xbd'),'interval':_0xd092('0xbe')});}}return db[_0xd092('0xbf')][_0xd092('0x5c')]({'body':_0x3a638d[_0xd092('0x61')][_0xd092('0x61')],'ChatWebsiteId':_0x3a638d[_0xd092('0x58')]['id'],'ChatInteractionId':_0x3b47ac['id'],'direction':'in','ContactId':_0x3f00f0['contact']['id'],'AttachmentId':_0x3a638d['body'][_0xd092('0xc0')]});})[_0xd092('0x34')](function(_0x40f5f9){_0x3f00f0[_0xd092('0x26')]=_0x40f5f9;if(_0x3f00f0[_0xd092('0xb8')]['UserId']){return db[_0xd092('0xc1')][_0xd092('0x5b')]({'attributes':['id',_0xd092('0x3a')],'where':{'id':_0x3f00f0[_0xd092('0xb8')]['UserId']}})['then'](function(_0x30677c){if(_0x30677c){_0x3f00f0[_0xd092('0x9f')][_0xd092('0xc2')]({'id':0x0,'priority':0x0,'app':_0xd092('0xc3'),'appdata':_0x30677c[_0xd092('0x3a')]+','+(_0x3f00f0[_0xd092('0x9e')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});_0x3f00f0[_0xd092('0xc4')]=!![];}return respondWithRpcPromise(_0xd092('0xc5'),_0xd092('0xc6'),_0x3f00f0);});}return respondWithRpcPromise(_0xd092('0xc5'),_0xd092('0xc6'),_0x3f00f0);})[_0xd092('0x34')](function(_0x3f281a){respondWithRpcPromise('EventManager','EventManager',{'event':_0xd092('0x86'),'message':_0x3f281a},client9002);return _0x3f281a;})[_0xd092('0x34')](respondWithResult(_0xa2fd49,null))['catch'](handleError(_0xa2fd49,null));};exports[_0xd092('0xc7')]=function(_0x165748,_0x33994e,_0x9f022e){var _0x5cf1a8,_0x13d201,_0x4305d0;var _0x3eda4f=[];var _0x8c9ec=[];var _0xccfda0={};return db[_0xd092('0x8a')][_0xd092('0x62')]()[_0xd092('0x34')](function(_0x53008c){if(!_0x53008c){throw new db[(_0xd092('0x1d'))]['ValidationError'](_0xd092('0x8c'));}_0x8c9ec=_['difference'](_[_0xd092('0x43')](_0x53008c),[_0xd092('0x8e'),'updatedAt']);_0x3eda4f=_[_0xd092('0x8d')](_[_0xd092('0x43')](_0x53008c),[_0xd092('0x8e'),_0xd092('0x8f'),_0xd092('0x90'),_0xd092('0x91')]);if(_0x165748[_0xd092('0x61')]['id']){delete _0x165748[_0xd092('0x61')]['id'];}if(_[_0xd092('0x79')](_0x165748['body'][_0xd092('0x92')])){throw _0x33994e[_0xd092('0x2a')](0x1f4)[_0xd092('0xc8')](new db[(_0xd092('0x1d'))][(_0xd092('0x8b'))]('from\x20is\x20mandatory'));}if(_[_0xd092('0x79')](_0x165748[_0xd092('0x61')][_0xd092('0x61')])||_0x165748[_0xd092('0x61')][_0xd092('0x61')]===''){throw _0x33994e[_0xd092('0x2a')](0x1f4)['send'](new db[(_0xd092('0x1d'))][(_0xd092('0x8b'))](_0xd092('0x94')));}if(_['isNil'](_0x165748[_0xd092('0x61')][_0xd092('0xc9')])){throw _0x33994e[_0xd092('0x2a')](0x1f4)['send'](new db[(_0xd092('0x1d'))]['ValidationError'](_0xd092('0xca')+_0x3eda4f));}if(!_['includes'](_0x3eda4f,_0x165748[_0xd092('0x61')][_0xd092('0xc9')])){throw _0x33994e[_0xd092('0x2a')](0x1f4)[_0xd092('0xc8')](new db[(_0xd092('0x1d'))]['ValidationError'](_0xd092('0xcb')+_0x3eda4f));}_0xccfda0[_0x165748['body'][_0xd092('0xc9')]]=_0x165748[_0xd092('0x61')][_0xd092('0x92')];})['then'](function(){return db[_0xd092('0x3e')][_0xd092('0x5b')]({'where':{'id':_0x165748['params']['id']},'include':[{'model':db[_0xd092('0x98')],'as':'List'}]});})['then'](handleEntityNotFound(_0x33994e,null))[_0xd092('0x34')](function(_0x2bde25){if(_0x2bde25&&_0x2bde25[_0xd092('0x99')]){_0x13d201=_0x2bde25;var _0x32d7a3=_[_0xd092('0x17')](_0x165748[_0xd092('0x61')],{'firstName':_0x165748[_0xd092('0x61')][_0xd092('0x92')],'phone':_0x165748['body'][_0xd092('0x92')],'ListId':_0x2bde25['ListId']});_0x32d7a3[_0x165748[_0xd092('0x61')]['mapKeyOffline']]=_0x165748[_0xd092('0x61')]['from'];return db[_0xd092('0x8a')][_0xd092('0xcc')]({'where':_0xccfda0,'defaults':_0x32d7a3});}})[_0xd092('0xb9')](function(_0x415612){if(_0x415612){_0x4305d0=_0x415612;var _0x2d8e69=fs[_0xd092('0xcd')](path[_0xd092('0x76')](config[_0xd092('0x7c')],_0xd092('0xce')),_0xd092('0xcf'));var _0x29f595=ejs['render'](_0x2d8e69,{'body':_[_0xd092('0xd0')](_0x165748[_0xd092('0x61')][_0xd092('0x61')]),'bodyTitle':_0x13d201['offlineMessageBody']});return db[_0xd092('0xd1')]['create']({'body':_0x29f595,'ContactId':_0x415612['id'],'ChatWebsiteId':_0x13d201['id']});}})['then'](function(_0x45362b){if(_0x45362b){_0x5cf1a8=_0x45362b;return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xd092('0xd2')],'as':_0xd092('0xd3'),'raw':!![]}]});}})[_0xd092('0x34')](function(_0x51f090){if(_0x51f090&&_0x51f090['Smtp']&&_0x13d201[_0xd092('0xd4')]){var _0x139c22={'tls':{'rejectUnauthorized':![]}};if(_0x51f090[_0xd092('0xd3')]['service']){_0x139c22[_0xd092('0xd5')]=_0x51f090['Smtp'][_0xd092('0xd5')];}else{_0x139c22[_0xd092('0xd6')]=_0x51f090[_0xd092('0xd3')]['host'];_0x139c22[_0xd092('0xd7')]=_0x51f090[_0xd092('0xd3')][_0xd092('0xd7')];_0x139c22['secure']=_0x51f090[_0xd092('0xd3')][_0xd092('0xd8')];}if(_0x51f090['Smtp'][_0xd092('0xd9')]){_0x139c22[_0xd092('0xda')]={'user':_0x51f090[_0xd092('0xd3')][_0xd092('0x5d')],'pass':_0x51f090[_0xd092('0xd3')][_0xd092('0xdb')]};}return respondWithRpcPromise(_0xd092('0xdc'),_0xd092('0xdd'),{'account':_0x139c22,'message':{'from':util[_0xd092('0xae')](_0xd092('0xde'),_0x51f090[_0xd092('0x3a')],_0x51f090['email']||_0x51f090['Smtp'][_0xd092('0x5d')]),'to':_0x13d201[_0xd092('0xd4')],'subject':_0x13d201[_0xd092('0xdf')],'text':_0x5cf1a8[_0xd092('0x61')]}},client9003)['then'](function(){return _0x5cf1a8;})[_0xd092('0x28')](function(_0x5978b8){console[_0xd092('0x23')](_0x5978b8);});}})[_0xd092('0x34')](function(){if(_0x5cf1a8){return _0x5cf1a8;}})[_0xd092('0x34')](respondWithResult(_0x33994e,null))[_0xd092('0x28')](handleError(_0x33994e,null));};exports['addInteraction']=function(_0x436415,_0x205858,_0x29133f){return db[_0xd092('0xb5')][_0xd092('0x5b')]({'where':{'id':_0x436415[_0xd092('0x58')]['id']}})[_0xd092('0x34')](handleEntityNotFound(_0x205858,null))[_0xd092('0x34')](function(_0x4b6dea){if(_0x4b6dea){return _0x4b6dea[_0xd092('0xe0')](_0x436415[_0xd092('0x61')]['ids'],_['omit'](_0x436415[_0xd092('0x61')],[_0xd092('0x69'),'id'])||{});}})[_0xd092('0x34')](respondWithResult(_0x205858,null))[_0xd092('0x28')](handleError(_0x205858,null));};exports[_0xd092('0xe1')]=function(_0x10290c,_0x28e088,_0x14c063){var _0x11996e={'raw':![],'where':{}};var _0x2d677c={};var _0x5802f3={'count':0x0,'rows':[]};return db[_0xd092('0x3e')][_0xd092('0x67')]({'where':{'id':_0x10290c[_0xd092('0x58')]['id']}})[_0xd092('0x34')](handleEntityNotFound(_0x28e088,null))[_0xd092('0x34')](function(_0x588d41){if(_0x588d41){_0x2d677c['model']=_[_0xd092('0x43')](db[_0xd092('0xb5')][_0xd092('0x5a')]);_0x2d677c[_0xd092('0x44')]=_[_0xd092('0x43')](_0x10290c[_0xd092('0x44')]);_0x2d677c[_0xd092('0x45')]=_[_0xd092('0x47')](_0x2d677c[_0xd092('0x42')],_0x2d677c[_0xd092('0x44')]);_0x11996e[_0xd092('0x46')]=_[_0xd092('0x47')](_0x2d677c['model'],qs[_0xd092('0x48')](_0x10290c['query'][_0xd092('0x48')]));_0x11996e[_0xd092('0x46')]=_0x11996e[_0xd092('0x46')][_0xd092('0x49')]?_0x11996e[_0xd092('0x46')]:_0x2d677c['model'];if(!_0x10290c[_0xd092('0x44')][_0xd092('0x4a')](_0xd092('0x4b'))){_0x11996e['limit']=qs[_0xd092('0x4c')](_0x10290c['query'][_0xd092('0x4c')]);_0x11996e[_0xd092('0x2d')]=qs['offset'](_0x10290c['query'][_0xd092('0x2d')]);}_0x11996e[_0xd092('0x4d')]=qs['sort'](_0x10290c['query'][_0xd092('0x4e')]);_0x11996e[_0xd092('0x4f')]=qs[_0xd092('0x45')](_[_0xd092('0x6b')](_0x10290c[_0xd092('0x44')],_0x2d677c[_0xd092('0x45')]));_0x11996e['where'][_0xd092('0x64')]=_0x588d41['id'];if(_0x10290c['query'][_0xd092('0x50')]){_0x11996e[_0xd092('0x4f')]=_[_0xd092('0x51')](_0x11996e[_0xd092('0x4f')],{'$or':_[_0xd092('0x3d')](_0x11996e[_0xd092('0x46')],function(_0x24be7f){var _0xdb101a={};_0xdb101a[_0x24be7f]={'$like':'%'+_0x10290c[_0xd092('0x44')]['filter']+'%'};return _0xdb101a;})});}_0x11996e=_[_0xd092('0x51')]({},_0x11996e,_0x10290c['options']);return db[_0xd092('0xb5')][_0xd092('0x2c')]({'where':_0x11996e['where']})['then'](function(_0x2ee459){_0x5802f3[_0xd092('0x2c')]=_0x2ee459;if(_0x10290c[_0xd092('0x44')][_0xd092('0x54')]){_0x11996e[_0xd092('0x55')]=[{'model':db['CmContact'],'as':_0xd092('0xe2'),'required':![]},{'model':db[_0xd092('0xc1')],'as':'Owner','attributes':[_0xd092('0x3a'),_0xd092('0xe3'),_0xd092('0xe4')],'required':![]},{'model':db[_0xd092('0xe5')],'as':_0xd092('0xe6'),'attributes':['id','name',_0xd092('0xe7')],'where':_0x10290c[_0xd092('0x44')]['tag']?{'id':_0x10290c[_0xd092('0x44')][_0xd092('0xe8')]}:undefined,'required':_0x10290c['query'][_0xd092('0xe8')]?!![]:![]}];}return db[_0xd092('0xb5')][_0xd092('0x56')](_0x11996e);})['then'](function(_0x4ddaee){_0x5802f3[_0xd092('0x57')]=_0x4ddaee;return _0x5802f3;});}})[_0xd092('0x34')](respondWithFilteredResult(_0x28e088,_0x11996e))['catch'](handleError(_0x28e088,null));};function iftimePromise(_0x2690fc,_0xb0c4d3){return respondWithRpcPromise(_0xd092('0xe9'),_0xd092('0xea'),{'command':_0xb0c4d3[_0xd092('0xeb')]?util[_0xd092('0xae')](_0xd092('0xec'),_0x2690fc[_0xd092('0xed')],_0xb0c4d3[_0xd092('0xeb')]):util[_0xd092('0xae')](_0xd092('0xee'),_0x2690fc[_0xd092('0xed')])},client9002)[_0xd092('0x34')](function(_0x369b11){var _0x4c2db2=_0x369b11&&_0x369b11[_0xd092('0xef')](_0xd092('0xf0'))>=0x0?!![]:![];logger[_0xd092('0x20')](_0xd092('0xf1'),_0xb0c4d3['id'],_0x2690fc['id'],_0x2690fc[_0xd092('0xed')],_0x4c2db2?'ONLINE':_0xd092('0xf2'),_0xb0c4d3[_0xd092('0xeb')]?_0xb0c4d3[_0xd092('0xeb')]:_0xd092('0xf3'));return _0x4c2db2;})[_0xd092('0x28')](function(_0x289ce2){logger[_0xd092('0x23')](_0xd092('0xf1'),_0xb0c4d3['id'],_0x2690fc['id'],_0x2690fc[_0xd092('0xed')],util['inspect'](_0x289ce2,{'showHidden':![],'depth':null}),_0xb0c4d3[_0xd092('0xeb')]?_0xb0c4d3['timezone']:_0xd092('0xf3'));return![];});}exports[_0xd092('0xea')]=function(_0x2c6315,_0x4b2388,_0x3fe4e6){var _0x585bce=0x0;var _0x58db02=0x0;var _0x45f791=![];var _0x1fffd3;var _0x51e82e;return db['ChatWebsite'][_0xd092('0x5b')]({'where':{'id':_0x2c6315[_0xd092('0x58')]['id']},'include':[{'model':db[_0xd092('0xf4')],'as':'Interval','include':[{'model':db[_0xd092('0xf4')],'as':_0xd092('0xf5'),'attributes':['id','interval'],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x4b2388,null))[_0xd092('0x34')](function(_0x23bdd4){if(_0x23bdd4){_0x1fffd3=_0x23bdd4;return _0x23bdd4[_0xd092('0xf6')]({'raw':!![]});}})[_0xd092('0x34')](function(_0x552fae){if(_0x1fffd3){if(_0x552fae){_0x51e82e=_0x552fae;}}return require(_0xd092('0x77'))[_0xd092('0x78')]();})[_0xd092('0x34')](function(_0x21a2ac){if(_0x21a2ac){_0x58db02=_0x21a2ac[_0xd092('0xf7')];_0x45f791=_0x21a2ac[_0xd092('0xf8')];}})['then'](function(){return db[_0xd092('0xb5')]['count']({'where':{'closed':![]}});})[_0xd092('0x34')](function(_0x2c01b4){_0x585bce=_0x2c01b4;if(_0x58db02&&_0x2c01b4>_0x58db02){return db[_0xd092('0xf9')][_0xd092('0x67')]({'where':{'id':0x1}})['then'](function(_0xa82c2d){if(_0xa82c2d){_0xa82c2d[_0xd092('0xfa')](_0xd092('0xfb'));}});}})[_0xd092('0x34')](function(){if(_0x1fffd3[_0xd092('0xf4')]&&_0x1fffd3['Interval']['Intervals']){var _0xd455b8=[];for(var _0xf52587=0x0;_0xf52587<_0x1fffd3[_0xd092('0xf4')][_0xd092('0xf5')][_0xd092('0x49')];_0xf52587++){var _0x2ec2cb=_0x1fffd3[_0xd092('0xf4')][_0xd092('0xf5')][_0xf52587][_0xd092('0x36')]({'plain':!![]});_0xd455b8[_0xd092('0xfc')](iftimePromise(_0x2ec2cb,_0x1fffd3));}return BPromise[_0xd092('0xfd')](_0xd455b8)[_0xd092('0x34')](function(_0xe30483){return _[_0xd092('0xfe')](_0xe30483);});}else{return!![];}})[_0xd092('0x34')](function(_0x171835){var _0x5391c2=fs[_0xd092('0xcd')](path['join'](config[_0xd092('0x7c')],_0xd092('0xff')),_0xd092('0xcf'));var _0x5d9082={'remote':_0x1fffd3[_0xd092('0x100')],'query':querystring[_0xd092('0x22')](_[_0xd092('0x51')](_0x1fffd3[_0xd092('0x36')]({'plain':!![]}),{'customerIp':_0x2c6315[_0xd092('0x88')][_0xd092('0xa6')]||_0x2c6315[_0xd092('0x88')][_0xd092('0x101')]||_0x2c6315[_0xd092('0x102')][_0xd092('0x103')]||_0x2c6315['ip'],'referer':_0x2c6315[_0xd092('0x88')][_0xd092('0xab')],'openedInteractions':_0x585bce,'maxInteractions':_0x58db02,'virtual':_0x45f791[_0xd092('0xf7')],'online':_0x171835,'custom':_0x45f791}))[_0xd092('0x104')](/'/g,'\x5c\x27')};_0x4b2388[_0xd092('0xc8')](ejs[_0xd092('0x105')](Mustache['render'](_0x5391c2,_0x5d9082),{'proactiveActions':_0x51e82e,'alignment':_0x1fffd3[_0xd092('0x106')],'verticalAlignment':_0x1fffd3[_0xd092('0x107')],'div_color':_0x1fffd3[_0xd092('0xe7')],'text_color':_0x1fffd3[_0xd092('0x108')]}));})[_0xd092('0x28')](handleError(_0x4b2388,null));};exports[_0xd092('0x109')]=function(_0x33f955,_0x1b477d,_0x25fa67){return db[_0xd092('0x3e')]['findOne']({'where':{'id':_0x33f955[_0xd092('0x58')]['id']}})['then'](handleEntityNotFound(_0x1b477d,null))[_0xd092('0x34')](function(_0x1431dd){if(_0x1431dd){return db[_0xd092('0x10a')][_0xd092('0x10b')](function(_0xd96220){return db[_0xd092('0x9c')][_0xd092('0x35')]({'where':{'ChatWebsiteId':_0x33f955[_0xd092('0x58')]['id']},'transaction':_0xd96220})[_0xd092('0x34')](function(_0x633b0c){var _0x5e6a48=_[_0xd092('0x3d')](_0x33f955[_0xd092('0x61')],function(_0x99ed48){_0x99ed48[_0xd092('0x64')]=_0x33f955[_0xd092('0x58')]['id'];return _0x99ed48;});return db['ChatApplication'][_0xd092('0x10c')](_0x5e6a48,{'transaction':_0xd96220});});})[_0xd092('0x34')](function(){return db['ChatApplication']['findAndCountAll']({'where':{'ChatWebsiteId':_0x33f955[_0xd092('0x58')]['id']},'order':_0xd092('0xa1')});});}})[_0xd092('0x34')](respondWithResult(_0x1b477d,null))[_0xd092('0x28')](handleError(_0x1b477d,null));};exports['getApplications']=function(_0x1a6635,_0x203016,_0x58be7f){var _0x2509d9={};var _0x51986={};var _0x22fd07;var _0x25749b;return db[_0xd092('0x3e')][_0xd092('0x67')]({'where':{'id':_0x1a6635['params']['id']}})[_0xd092('0x34')](handleEntityNotFound(_0x203016,null))[_0xd092('0x34')](function(_0x336ef9){if(_0x336ef9){_0x22fd07=_0x336ef9;_0x51986[_0xd092('0x42')]=_[_0xd092('0x43')](db[_0xd092('0x9c')][_0xd092('0x5a')]);_0x51986[_0xd092('0x44')]=_['keys'](_0x1a6635[_0xd092('0x44')]);_0x51986[_0xd092('0x45')]=_[_0xd092('0x47')](_0x51986[_0xd092('0x42')],_0x51986[_0xd092('0x44')]);_0x2509d9[_0xd092('0x46')]=_[_0xd092('0x47')](_0x51986[_0xd092('0x42')],qs[_0xd092('0x48')](_0x1a6635[_0xd092('0x44')][_0xd092('0x48')]));_0x2509d9[_0xd092('0x46')]=_0x2509d9[_0xd092('0x46')]['length']?_0x2509d9[_0xd092('0x46')]:_0x51986[_0xd092('0x42')];_0x2509d9['order']=qs[_0xd092('0x4e')](_0x1a6635[_0xd092('0x44')][_0xd092('0x4e')]);_0x2509d9[_0xd092('0x4f')]=qs['filters'](_['pick'](_0x1a6635[_0xd092('0x44')],_0x51986['filters']));if(_0x1a6635[_0xd092('0x44')]['filter']){_0x2509d9[_0xd092('0x4f')]=_[_0xd092('0x51')](_0x2509d9[_0xd092('0x4f')],{'$or':_['map'](_0x2509d9['attributes'],function(_0x1bee8f){var _0x26858d={};_0x26858d[_0x1bee8f]={'$like':'%'+_0x1a6635[_0xd092('0x44')][_0xd092('0x50')]+'%'};return _0x26858d;})});}_0x2509d9=_[_0xd092('0x51')]({},_0x2509d9,_0x1a6635[_0xd092('0x53')]);return _0x22fd07[_0xd092('0x10d')](_0x2509d9);}})[_0xd092('0x34')](function(_0x248cba){if(_0x248cba){_0x25749b=_0x248cba['length'];if(!_0x1a6635[_0xd092('0x44')][_0xd092('0x4a')]('nolimit')){_0x2509d9[_0xd092('0x4c')]=qs[_0xd092('0x4c')](_0x1a6635[_0xd092('0x44')][_0xd092('0x4c')]);_0x2509d9[_0xd092('0x2d')]=qs['offset'](_0x1a6635[_0xd092('0x44')][_0xd092('0x2d')]);}return _0x22fd07['getApplications'](_0x2509d9);}})[_0xd092('0x34')](function(_0x3c960a){if(_0x3c960a){return _0x3c960a?{'count':_0x25749b,'rows':_0x3c960a}:null;}})['then'](respondWithResult(_0x203016,null))[_0xd092('0x28')](handleError(_0x203016,null));};exports[_0xd092('0x10e')]=function(_0x5e6e03,_0x4c7f25,_0x148de6){return db[_0xd092('0x10f')]['find']({'where':{'id':_0x5e6e03[_0xd092('0x58')]['id']}})[_0xd092('0x34')](handleEntityNotFound(_0x4c7f25,null))['then'](function(_0x586d9f){if(_0x586d9f){return _0x586d9f['addProactiveActions'](_0x5e6e03[_0xd092('0x61')][_0xd092('0x69')],_[_0xd092('0x110')](_0x5e6e03['body'],[_0xd092('0x69'),'id'])||{});}})[_0xd092('0x34')](respondWithResult(_0x4c7f25,null))[_0xd092('0x28')](handleError(_0x4c7f25,null));};exports[_0xd092('0xf6')]=function(_0x46e813,_0x62f25,_0x2bb3ef){var _0x424415={};var _0x48ffc6={};var _0x403be8;var _0x1114ea;return db[_0xd092('0x3e')][_0xd092('0x67')]({'where':{'id':_0x46e813[_0xd092('0x58')]['id']}})['then'](handleEntityNotFound(_0x62f25,null))[_0xd092('0x34')](function(_0x57253e){if(_0x57253e){_0x403be8=_0x57253e;_0x48ffc6[_0xd092('0x42')]=_[_0xd092('0x43')](db[_0xd092('0x111')][_0xd092('0x5a')]);_0x48ffc6[_0xd092('0x44')]=_[_0xd092('0x43')](_0x46e813[_0xd092('0x44')]);_0x48ffc6[_0xd092('0x45')]=_[_0xd092('0x47')](_0x48ffc6[_0xd092('0x42')],_0x48ffc6[_0xd092('0x44')]);_0x424415[_0xd092('0x46')]=_[_0xd092('0x47')](_0x48ffc6[_0xd092('0x42')],qs[_0xd092('0x48')](_0x46e813[_0xd092('0x44')][_0xd092('0x48')]));_0x424415[_0xd092('0x46')]=_0x424415[_0xd092('0x46')][_0xd092('0x49')]?_0x424415[_0xd092('0x46')]:_0x48ffc6[_0xd092('0x42')];_0x424415[_0xd092('0x4d')]=qs['sort'](_0x46e813[_0xd092('0x44')]['sort']);_0x424415[_0xd092('0x4f')]=qs[_0xd092('0x45')](_[_0xd092('0x6b')](_0x46e813[_0xd092('0x44')],_0x48ffc6['filters']));if(_0x46e813[_0xd092('0x44')][_0xd092('0x50')]){_0x424415[_0xd092('0x4f')]=_[_0xd092('0x51')](_0x424415[_0xd092('0x4f')],{'$or':_[_0xd092('0x3d')](_0x424415[_0xd092('0x46')],function(_0x4812ce){var _0x9b2ff2={};_0x9b2ff2[_0x4812ce]={'$like':'%'+_0x46e813[_0xd092('0x44')]['filter']+'%'};return _0x9b2ff2;})});}_0x424415=_[_0xd092('0x51')]({},_0x424415,_0x46e813[_0xd092('0x53')]);return _0x403be8[_0xd092('0xf6')](_0x424415);}})[_0xd092('0x34')](function(_0x2ab6ac){if(_0x2ab6ac){_0x1114ea=_0x2ab6ac[_0xd092('0x49')];if(!_0x46e813[_0xd092('0x44')][_0xd092('0x4a')](_0xd092('0x4b'))){_0x424415[_0xd092('0x4c')]=qs[_0xd092('0x4c')](_0x46e813[_0xd092('0x44')][_0xd092('0x4c')]);_0x424415['offset']=qs[_0xd092('0x2d')](_0x46e813[_0xd092('0x44')]['offset']);}return _0x403be8[_0xd092('0xf6')](_0x424415);}})['then'](function(_0x2466db){if(_0x2466db){return _0x2466db?{'count':_0x1114ea,'rows':_0x2466db}:null;}})[_0xd092('0x34')](respondWithResult(_0x62f25,null))[_0xd092('0x28')](handleError(_0x62f25,null));};exports[_0xd092('0x112')]=function(_0x39a847,_0x59edc7,_0x2fd01f){var _0x364239=_0x39a847[_0xd092('0x44')][_0xd092('0x113')]===_0xd092('0x114')?_0xd092('0x115'):_0xd092('0x116');return db[_0xd092('0x3e')][_0xd092('0x5b')]({'attributes':['id',_0x364239],'where':{'id':_0x39a847[_0xd092('0x58')]['id']}})[_0xd092('0x34')](handleEntityNotFound(_0x59edc7,null))[_0xd092('0x34')](function(_0x60163a){if(_0x60163a){var _0x47a288=_0x60163a[_0x364239];var _0x46074f=_0x47a288&&_0x47a288[_0xd092('0x117')]?_0x47a288[_0xd092('0x117')]:[];_0x59edc7[_0xd092('0xc8')]({'fromKey':_[_0xd092('0x79')](_0x47a288['fromKey'])?undefined:_0x47a288[_0xd092('0x118')],'count':_0x46074f['length'],'rows':_0x46074f});}})[_0xd092('0x28')](handleError(_0x59edc7,null));};exports[_0xd092('0x119')]=function(_0x1e2d53,_0x175eef,_0x574c0f){var _0x2ff7da={'raw':![],'where':{}};var _0x356f70={};var _0x48bcbd={'count':0x0,'rows':[]};return db[_0xd092('0x3e')][_0xd092('0x67')]({'where':{'id':_0x1e2d53[_0xd092('0x58')]['id']}})['then'](handleEntityNotFound(_0x175eef,null))[_0xd092('0x34')](function(_0x1685f5){if(_0x1685f5){_0x356f70[_0xd092('0x42')]=_[_0xd092('0x43')](db[_0xd092('0xd1')]['rawAttributes']);_0x356f70[_0xd092('0x44')]=_[_0xd092('0x43')](_0x1e2d53[_0xd092('0x44')]);_0x356f70[_0xd092('0x45')]=_[_0xd092('0x47')](_0x356f70[_0xd092('0x42')],_0x356f70[_0xd092('0x44')]);_0x2ff7da[_0xd092('0x46')]=_[_0xd092('0x47')](_0x356f70['model'],qs[_0xd092('0x48')](_0x1e2d53['query'][_0xd092('0x48')]));_0x2ff7da['attributes']=_0x2ff7da[_0xd092('0x46')][_0xd092('0x49')]?_0x2ff7da[_0xd092('0x46')]:_0x356f70[_0xd092('0x42')];if(!_0x1e2d53['query'][_0xd092('0x4a')](_0xd092('0x4b'))){_0x2ff7da[_0xd092('0x4c')]=qs[_0xd092('0x4c')](_0x1e2d53['query'][_0xd092('0x4c')]);_0x2ff7da[_0xd092('0x2d')]=qs[_0xd092('0x2d')](_0x1e2d53[_0xd092('0x44')][_0xd092('0x2d')]);}_0x2ff7da[_0xd092('0x4d')]=qs['sort'](_0x1e2d53[_0xd092('0x44')]['sort']);_0x2ff7da[_0xd092('0x4f')]=qs['filters'](_[_0xd092('0x6b')](_0x1e2d53[_0xd092('0x44')],_0x356f70[_0xd092('0x45')]));_0x2ff7da[_0xd092('0x4f')]['ChatWebsiteId']=_0x1685f5['id'];if(_0x1e2d53[_0xd092('0x44')][_0xd092('0x50')]){_0x2ff7da[_0xd092('0x4f')]=_['merge'](_0x2ff7da[_0xd092('0x4f')],{'$or':_[_0xd092('0x3d')](_0x2ff7da[_0xd092('0x46')],function(_0x98b4c8){var _0x3da31a={};_0x3da31a[_0x98b4c8]={'$like':'%'+_0x1e2d53['query'][_0xd092('0x50')]+'%'};return _0x3da31a;})});}_0x2ff7da=_[_0xd092('0x51')]({},_0x2ff7da,_0x1e2d53[_0xd092('0x53')]);return db[_0xd092('0xd1')]['count']({'where':_0x2ff7da[_0xd092('0x4f')]})[_0xd092('0x34')](function(_0x4e4d2c){_0x48bcbd[_0xd092('0x2c')]=_0x4e4d2c;if(_0x1e2d53['query'][_0xd092('0x54')]){_0x2ff7da[_0xd092('0x55')]=[{'all':!![]}];}else{_0x2ff7da[_0xd092('0x55')]=[{'model':db[_0xd092('0x8a')],'as':_0xd092('0xe2'),'required':![]}];}return db[_0xd092('0xd1')][_0xd092('0x56')](_0x2ff7da);})['then'](function(_0x3d7d97){_0x48bcbd[_0xd092('0x57')]=_0x3d7d97;return _0x48bcbd;});}})[_0xd092('0x34')](respondWithFilteredResult(_0x175eef,_0x2ff7da))[_0xd092('0x28')](handleError(_0x175eef,null));};exports['addAgents']=function(_0x56d81d,_0xe6b90,_0x2228e9){return db[_0xd092('0x3e')][_0xd092('0x5b')]({'where':{'id':_0x56d81d[_0xd092('0x58')]['id']}})[_0xd092('0x34')](handleEntityNotFound(_0xe6b90,null))[_0xd092('0x34')](function(_0x3589b9){if(_0x3589b9){return _0x3589b9['addAgents'](_0x56d81d['body'][_0xd092('0x69')],_[_0xd092('0x110')](_0x56d81d[_0xd092('0x61')],[_0xd092('0x69'),'id'])||{})['spread'](function(_0x3e7fd9){for(var _0x30c03c=0x0;_0x30c03c<_0x56d81d['body']['ids'][_0xd092('0x49')];_0x30c03c+=0x1){socket[_0xd092('0x11a')](_0xd092('0x11b'),{'UserId':_0x56d81d[_0xd092('0x61')]['ids'][_0x30c03c],'ChatWebsiteId':_0x56d81d[_0xd092('0x58')]['id']});}return _0x3e7fd9;});}})[_0xd092('0x34')](respondWithResult(_0xe6b90,null))[_0xd092('0x28')](handleError(_0xe6b90,null));};exports[_0xd092('0x11c')]=function(_0x4066f7,_0xbb2f4,_0xba18cb){return db['ChatWebsite'][_0xd092('0x5b')]({'where':{'id':_0x4066f7[_0xd092('0x58')]['id']}})[_0xd092('0x34')](handleEntityNotFound(_0xbb2f4,null))[_0xd092('0x34')](function(_0x44ded9){if(_0x44ded9){return _0x44ded9['removeAgents'](_0x4066f7[_0xd092('0x44')][_0xd092('0x69')])['then'](function(){if(_[_0xd092('0x11d')](_0x4066f7['query']['ids'])){for(var _0x247b17=0x0;_0x247b17<_0x4066f7[_0xd092('0x44')][_0xd092('0x69')][_0xd092('0x49')];_0x247b17+=0x1){socket[_0xd092('0x11a')](_0xd092('0x11e'),{'UserId':Number(_0x4066f7['query']['ids'][_0x247b17]),'ChatWebsiteId':Number(_0x4066f7[_0xd092('0x58')]['id'])});}}else{socket[_0xd092('0x11a')](_0xd092('0x11e'),{'UserId':Number(_0x4066f7[_0xd092('0x44')]['ids']),'ChatWebsiteId':Number(_0x4066f7[_0xd092('0x58')]['id'])});}});}})[_0xd092('0x34')](respondWithStatusCode(_0xbb2f4,null))[_0xd092('0x28')](handleError(_0xbb2f4,null));};exports[_0xd092('0x11f')]=function(_0x44d0f5,_0x1556a9,_0xed2d52){var _0x41df85={};var _0x3cfaca={};var _0x423191;var _0x1a5cfd;return db[_0xd092('0x3e')]['findOne']({'where':{'id':_0x44d0f5[_0xd092('0x58')]['id']}})[_0xd092('0x34')](handleEntityNotFound(_0x1556a9,null))[_0xd092('0x34')](function(_0x70599e){if(_0x70599e){_0x423191=_0x70599e;_0x3cfaca[_0xd092('0x42')]=_[_0xd092('0x43')](db['User']['rawAttributes']);_0x3cfaca[_0xd092('0x44')]=_[_0xd092('0x43')](_0x44d0f5[_0xd092('0x44')]);_0x3cfaca[_0xd092('0x45')]=_['intersection'](_0x3cfaca['model'],_0x3cfaca[_0xd092('0x44')]);_0x41df85['attributes']=_[_0xd092('0x47')](_0x3cfaca['model'],qs[_0xd092('0x48')](_0x44d0f5[_0xd092('0x44')]['fields']));_0x41df85[_0xd092('0x46')]=_0x41df85['attributes'][_0xd092('0x49')]?_0x41df85[_0xd092('0x46')]:_0x3cfaca[_0xd092('0x42')];_0x41df85[_0xd092('0x4d')]=qs[_0xd092('0x4e')](_0x44d0f5['query'][_0xd092('0x4e')]);_0x41df85[_0xd092('0x4f')]=qs[_0xd092('0x45')](_[_0xd092('0x6b')](_0x44d0f5[_0xd092('0x44')],_0x3cfaca[_0xd092('0x45')]));if(_0x44d0f5[_0xd092('0x44')][_0xd092('0x50')]){_0x41df85[_0xd092('0x4f')]=_[_0xd092('0x51')](_0x41df85[_0xd092('0x4f')],{'$or':_['map'](_0x41df85[_0xd092('0x46')],function(_0x22710b){var _0x467e22={};_0x467e22[_0x22710b]={'$like':'%'+_0x44d0f5['query'][_0xd092('0x50')]+'%'};return _0x467e22;})});}_0x41df85=_['merge']({},_0x41df85,_0x44d0f5[_0xd092('0x53')]);return _0x423191[_0xd092('0x11f')](_0x41df85);}})[_0xd092('0x34')](function(_0x2fd4fd){if(_0x2fd4fd){_0x1a5cfd=_0x2fd4fd[_0xd092('0x49')];if(!_0x44d0f5[_0xd092('0x44')][_0xd092('0x4a')](_0xd092('0x4b'))){_0x41df85[_0xd092('0x4c')]=qs[_0xd092('0x4c')](_0x44d0f5[_0xd092('0x44')][_0xd092('0x4c')]);_0x41df85[_0xd092('0x2d')]=qs['offset'](_0x44d0f5[_0xd092('0x44')][_0xd092('0x2d')]);}return _0x423191[_0xd092('0x11f')](_0x41df85);}})['then'](function(_0x45925f){if(_0x45925f){return _0x45925f?{'count':_0x1a5cfd,'rows':_0x45925f}:null;}})[_0xd092('0x34')](respondWithResult(_0x1556a9,null))['catch'](handleError(_0x1556a9,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 047ded7..084bd88 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 _0xcba7=['../../mysqldb','ChatWebsite','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0xcba7,0x199));var _0x7cba=function(_0x5b97f0,_0x2ef08c){_0x5b97f0=_0x5b97f0-0x0;var _0x2101a8=_0xcba7[_0x5b97f0];return _0x2101a8;};'use strict';var EventEmitter=require(_0x7cba('0x0'));var ChatWebsite=require(_0x7cba('0x1'))['db'][_0x7cba('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x7cba('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7cba('0x4'),'afterDestroy':_0x7cba('0x5')};function emitEvent(_0x3b5d2d){return function(_0x4fa145,_0x251250,_0x154c08){ChatWebsiteEvents[_0x7cba('0x6')](_0x3b5d2d+':'+_0x4fa145['id'],_0x4fa145);ChatWebsiteEvents[_0x7cba('0x6')](_0x3b5d2d,_0x4fa145);_0x154c08(null);};}for(var e in events){if(events[_0x7cba('0x7')](e)){var event=events[e];ChatWebsite[_0x7cba('0x8')](e,emitEvent(event));}}module[_0x7cba('0x9')]=ChatWebsiteEvents; \ No newline at end of file +var _0x6b71=['../../mysqldb','setMaxListeners','save','remove','emit','hook','events'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x6b71,0x12c));var _0x16b7=function(_0x45adaf,_0x21c3c1){_0x45adaf=_0x45adaf-0x0;var _0x15d189=_0x6b71[_0x45adaf];return _0x15d189;};'use strict';var EventEmitter=require(_0x16b7('0x0'));var ChatWebsite=require(_0x16b7('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x16b7('0x2')](0x0);var events={'afterCreate':_0x16b7('0x3'),'afterUpdate':'update','afterDestroy':_0x16b7('0x4')};function emitEvent(_0x7dd5fe){return function(_0x212683,_0x3b15dd,_0x1ba1dc){ChatWebsiteEvents[_0x16b7('0x5')](_0x7dd5fe+':'+_0x212683['id'],_0x212683);ChatWebsiteEvents['emit'](_0x7dd5fe,_0x212683);_0x1ba1dc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x16b7('0x6')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 7c78467..acad374 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 _0x74f0=['define','ChatWebsite','chat_websites','util','moment','bluebird','request-promise','path','./chatWebsite.attributes','exports'];(function(_0x324aa9,_0x1cdc6d){var _0x457f10=function(_0x2cdb4e){while(--_0x2cdb4e){_0x324aa9['push'](_0x324aa9['shift']());}};_0x457f10(++_0x1cdc6d);}(_0x74f0,0xf3));var _0x074f=function(_0x5a585b,_0x3e0674){_0x5a585b=_0x5a585b-0x0;var _0x4cd398=_0x74f0[_0x5a585b];return _0x4cd398;};'use strict';var _=require('lodash');var util=require(_0x074f('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x074f('0x1'));var BPromise=require(_0x074f('0x2'));var rp=require(_0x074f('0x3'));var fs=require('fs');var path=require(_0x074f('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x074f('0x5'));module[_0x074f('0x6')]=function(_0x203f47,_0x126607){return _0x203f47[_0x074f('0x7')](_0x074f('0x8'),attributes,{'tableName':_0x074f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd7a0=['path','rimraf','../../config/environment','exports','define','ChatWebsite','chat_websites','lodash','util','api','bluebird','request-promise'];(function(_0x456032,_0x1a799d){var _0x1a53cd=function(_0x162cc8){while(--_0x162cc8){_0x456032['push'](_0x456032['shift']());}};_0x1a53cd(++_0x1a799d);}(_0xd7a0,0x163));var _0x0d7a=function(_0x1e16f0,_0x569c17){_0x1e16f0=_0x1e16f0-0x0;var _0x402c9b=_0xd7a0[_0x1e16f0];return _0x402c9b;};'use strict';var _=require(_0x0d7a('0x0'));var util=require(_0x0d7a('0x1'));var logger=require('../../config/logger')(_0x0d7a('0x2'));var moment=require('moment');var BPromise=require(_0x0d7a('0x3'));var rp=require(_0x0d7a('0x4'));var fs=require('fs');var path=require(_0x0d7a('0x5'));var rimraf=require(_0x0d7a('0x6'));var config=require(_0x0d7a('0x7'));var attributes=require('./chatWebsite.attributes');module[_0x0d7a('0x8')]=function(_0x37c000,_0x321114){return _0x37c000[_0x0d7a('0x9')](_0x0d7a('0xa'),attributes,{'tableName':_0x0d7a('0xb'),'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 ea91846..e46267a 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 _0x33af=['result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x3fd33b,_0x5d2d11){var _0x32e0fa=function(_0x4cb979){while(--_0x4cb979){_0x3fd33b['push'](_0x3fd33b['shift']());}};_0x32e0fa(++_0x5d2d11);}(_0x33af,0xec));var _0xf33a=function(_0x461119,_0x28ce98){_0x461119=_0x461119-0x0;var _0x4b5ed3=_0x33af[_0x461119];return _0x4b5ed3;};'use strict';var _=require('lodash');var util=require(_0xf33a('0x0'));var moment=require('moment');var BPromise=require(_0xf33a('0x1'));var rs=require(_0xf33a('0x2'));var fs=require('fs');var Redis=require(_0xf33a('0x3'));var db=require(_0xf33a('0x4'))['db'];var utils=require(_0xf33a('0x5'));var logger=require(_0xf33a('0x6'))('rpc');var config=require(_0xf33a('0x7'));var jayson=require(_0xf33a('0x8'));var client=jayson['client'][_0xf33a('0x9')]({'port':0x232a});config[_0xf33a('0xa')]=_[_0xf33a('0xb')](config[_0xf33a('0xa')],{'host':_0xf33a('0xc'),'port':0x18eb});var socket=require(_0xf33a('0xd'))(new Redis(config['redis']));require(_0xf33a('0xe'))[_0xf33a('0xf')](socket);function respondWithRpcPromise(_0x115e08,_0x457b3b,_0x44ee7f){return new BPromise(function(_0x27f30a,_0x5074a2){return client['request'](_0x115e08,_0x44ee7f)[_0xf33a('0x10')](function(_0xb47cde){logger[_0xf33a('0x11')](_0xf33a('0x12'),_0x457b3b,_0xf33a('0x13'));logger['debug'](_0xf33a('0x14'),_0x457b3b,_0xf33a('0x13'),JSON['stringify'](_0xb47cde));if(_0xb47cde['error']){if(_0xb47cde[_0xf33a('0x15')][_0xf33a('0x16')]===0x1f4){logger[_0xf33a('0x15')](_0xf33a('0x12'),_0x457b3b,_0xb47cde[_0xf33a('0x15')][_0xf33a('0x17')]);return _0x5074a2(_0xb47cde[_0xf33a('0x15')][_0xf33a('0x17')]);}logger['error'](_0xf33a('0x12'),_0x457b3b,_0xb47cde['error'][_0xf33a('0x17')]);return _0x27f30a(_0xb47cde[_0xf33a('0x15')]['message']);}else{logger[_0xf33a('0x11')](_0xf33a('0x12'),_0x457b3b,'request\x20sent');_0x27f30a(_0xb47cde[_0xf33a('0x18')][_0xf33a('0x17')]);}})[_0xf33a('0x19')](function(_0x2a9f0e){logger['error'](_0xf33a('0x12'),_0x457b3b,_0x2a9f0e);_0x5074a2(_0x2a9f0e);});});} \ No newline at end of file +var _0x0598=['result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','register','then','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','info'];(function(_0x2697ec,_0x26c105){var _0x20aa02=function(_0x3edd91){while(--_0x3edd91){_0x2697ec['push'](_0x2697ec['shift']());}};_0x20aa02(++_0x26c105);}(_0x0598,0x92));var _0x8059=function(_0x21e941,_0x4c7c50){_0x21e941=_0x21e941-0x0;var _0x4ba335=_0x0598[_0x21e941];return _0x4ba335;};'use strict';var _=require(_0x8059('0x0'));var util=require(_0x8059('0x1'));var moment=require('moment');var BPromise=require(_0x8059('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8059('0x3'))['db'];var utils=require(_0x8059('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8059('0x5'));var client=jayson[_0x8059('0x6')]['http']({'port':0x232a});config['redis']=_[_0x8059('0x7')](config[_0x8059('0x8')],{'host':_0x8059('0x9'),'port':0x18eb});var socket=require(_0x8059('0xa'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0x8059('0xb')](socket);function respondWithRpcPromise(_0x1bf5fd,_0x336f85,_0x5097d6){return new BPromise(function(_0x283b63,_0x52a60d){return client['request'](_0x1bf5fd,_0x5097d6)[_0x8059('0xc')](function(_0x4109a9){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x336f85,'request\x20sent');logger[_0x8059('0xd')](_0x8059('0xe'),_0x336f85,_0x8059('0xf'),JSON[_0x8059('0x10')](_0x4109a9));if(_0x4109a9[_0x8059('0x11')]){if(_0x4109a9['error'][_0x8059('0x12')]===0x1f4){logger['error'](_0x8059('0x13'),_0x336f85,_0x4109a9['error'][_0x8059('0x14')]);return _0x52a60d(_0x4109a9[_0x8059('0x11')][_0x8059('0x14')]);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x336f85,_0x4109a9['error'][_0x8059('0x14')]);return _0x283b63(_0x4109a9[_0x8059('0x11')][_0x8059('0x14')]);}else{logger[_0x8059('0x15')](_0x8059('0x13'),_0x336f85,'request\x20sent');_0x283b63(_0x4109a9[_0x8059('0x16')][_0x8059('0x14')]);}})[_0x8059('0x17')](function(_0x1c4566){logger['error'](_0x8059('0x13'),_0x336f85,_0x1c4566);_0x52a60d(_0x1c4566);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index d97d2bd..f9437b6 100644 --- a/server/api/chatWebsite/chatWebsite.socket.js +++ b/server/api/chatWebsite/chatWebsite.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['remove','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x1b17af,_0x260964){var _0x5491f7=function(_0x191e45){while(--_0x191e45){_0x1b17af['push'](_0x1b17af['shift']());}};_0x5491f7(++_0x260964);}(_0x7a54,0x106));var _0x47a5=function(_0x5226c4,_0x5a2b77){_0x5226c4=_0x5226c4-0x0;var _0x4888d3=_0x7a54[_0x5226c4];return _0x4888d3;};'use strict';var ChatWebsiteEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){ChatWebsiteEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);ChatWebsiteEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file +var _0x5f2f=['remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x19b1c2,_0x205062){var _0x4e1ae5=function(_0x5a1cb7){while(--_0x5a1cb7){_0x19b1c2['push'](_0x19b1c2['shift']());}};_0x4e1ae5(++_0x205062);}(_0x5f2f,0x73));var _0xf5f2=function(_0x37a7bc,_0x1220db){_0x37a7bc=_0x37a7bc-0x0;var _0x2e5f63=_0x5f2f[_0x37a7bc];return _0x2e5f63;};'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 0b16465..dd47aa3 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 _0xba1a=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','get','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','diskStorage','root','server/files/images/logos/','format','%s-%s','now','originalname','single','file','addLogo','join','server/files/images/avatars/','addAvatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','/:id/offline','offline','/:id/interactions','addApplications','addProactiveActions','addAgents','put','/:id','update','delete','removeDispositions','removeAnswers','/:id/users','exports','path','connect-timeout'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xba1a,0xc7));var _0xaba1=function(_0x359f21,_0x37afb8){_0x359f21=_0x359f21-0x0;var _0x2d6ce7=_0xba1a[_0x359f21];return _0x2d6ce7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xaba1('0x0'));var timeout=require(_0xaba1('0x1'));var express=require(_0xaba1('0x2'));var router=express[_0xaba1('0x3')]();var auth=require(_0xaba1('0x4'));var interaction=require(_0xaba1('0x5'));var config=require(_0xaba1('0x6'));var controller=require(_0xaba1('0x7'));router['get']('/',auth[_0xaba1('0x8')](),controller['index']);router[_0xaba1('0x9')]('/describe',auth[_0xaba1('0x8')](),controller[_0xaba1('0xa')]);router[_0xaba1('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xaba1('0xb')]);router[_0xaba1('0x9')](_0xaba1('0xc'),auth[_0xaba1('0x8')](),controller[_0xaba1('0xd')]);router[_0xaba1('0x9')]('/:id/canned_answers',auth[_0xaba1('0x8')](),controller[_0xaba1('0xe')]);router[_0xaba1('0x9')](_0xaba1('0xf'),controller[_0xaba1('0x10')]);router['get'](_0xaba1('0x11'),controller[_0xaba1('0x12')]);router['get'](_0xaba1('0x13'),controller[_0xaba1('0x14')]);router[_0xaba1('0x9')]('/:id/system_avatar',controller['getSystemAvatar']);router['get']('/:id/interactions',auth['isAuthenticated'](),controller['getInteractions']);router[_0xaba1('0x9')]('/:id/snippet',controller[_0xaba1('0x15')]);router[_0xaba1('0x9')](_0xaba1('0x16'),auth[_0xaba1('0x8')](),controller[_0xaba1('0x17')]);router[_0xaba1('0x9')](_0xaba1('0x18'),auth[_0xaba1('0x8')](),controller[_0xaba1('0x19')]);router['get'](_0xaba1('0x1a'),controller[_0xaba1('0x1b')]);router[_0xaba1('0x9')](_0xaba1('0x1c'),auth[_0xaba1('0x8')](),controller[_0xaba1('0x1d')]);router['get']('/:id/users',auth[_0xaba1('0x8')](),controller[_0xaba1('0x1e')]);router[_0xaba1('0x1f')]('/',auth['isAuthenticated'](),controller[_0xaba1('0x20')]);router[_0xaba1('0x1f')](_0xaba1('0xc'),auth[_0xaba1('0x8')](),controller[_0xaba1('0x21')]);router[_0xaba1('0x1f')](_0xaba1('0x22'),auth[_0xaba1('0x8')](),controller[_0xaba1('0x23')]);var upload=multer({'storage':multer[_0xaba1('0x24')]({'destination':function(_0x1b24aa,_0x437264,_0x3e55e3){_0x3e55e3(null,path['join'](config[_0xaba1('0x25')],_0xaba1('0x26')));},'filename':function(_0x5b9888,_0x1dfed8,_0x47be35){_0x47be35(null,util[_0xaba1('0x27')](_0xaba1('0x28'),Date[_0xaba1('0x29')](),_0x1dfed8[_0xaba1('0x2a')]));}})});router['post'](_0xaba1('0xf'),upload[_0xaba1('0x2b')](_0xaba1('0x2c')),controller[_0xaba1('0x2d')]);var upload=multer({'storage':multer[_0xaba1('0x24')]({'destination':function(_0x576f52,_0x3c0419,_0x184df0){_0x184df0(null,path[_0xaba1('0x2e')](config[_0xaba1('0x25')],_0xaba1('0x2f')));},'filename':function(_0x59d976,_0x58c4fc,_0x200639){_0x200639(null,util['format'](_0xaba1('0x28'),Date['now'](),_0x58c4fc[_0xaba1('0x2a')]));}})});router[_0xaba1('0x1f')](_0xaba1('0x11'),upload['single'](_0xaba1('0x2c')),controller[_0xaba1('0x30')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x294695,_0x1db4c3,_0x34a055){_0x34a055(null,path['join'](config['root'],_0xaba1('0x2f')));},'filename':function(_0x41a667,_0x2eb850,_0x537534){_0x537534(null,util[_0xaba1('0x27')](_0xaba1('0x28'),Date[_0xaba1('0x29')](),_0x2eb850['originalname']));}})});router[_0xaba1('0x1f')](_0xaba1('0x13'),upload['single'](_0xaba1('0x2c')),controller[_0xaba1('0x31')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x44f750,_0x4945d2,_0x4e97de){_0x4e97de(null,path[_0xaba1('0x2e')](config[_0xaba1('0x25')],'server/files/images/avatars/'));},'filename':function(_0x227a53,_0x5c8c6d,_0xee5d13){_0xee5d13(null,util[_0xaba1('0x27')](_0xaba1('0x28'),Date['now'](),_0x5c8c6d['originalname']));}})});router[_0xaba1('0x1f')]('/:id/system_avatar',upload[_0xaba1('0x2b')](_0xaba1('0x2c')),controller[_0xaba1('0x32')]);router[_0xaba1('0x1f')](_0xaba1('0x33'),controller[_0xaba1('0x34')]);router[_0xaba1('0x1f')](_0xaba1('0x35'),controller[_0xaba1('0x36')]);router['post'](_0xaba1('0x37'),auth[_0xaba1('0x8')](),controller['addInteraction']);router[_0xaba1('0x1f')](_0xaba1('0x16'),auth[_0xaba1('0x8')](),controller[_0xaba1('0x38')]);router[_0xaba1('0x1f')]('/:id/proactive_actions',auth[_0xaba1('0x8')](),controller[_0xaba1('0x39')]);router[_0xaba1('0x1f')]('/:id/users',auth['isAuthenticated'](),controller[_0xaba1('0x3a')]);router[_0xaba1('0x3b')](_0xaba1('0x3c'),auth[_0xaba1('0x8')](),controller[_0xaba1('0x3d')]);router[_0xaba1('0x3e')](_0xaba1('0x3c'),auth[_0xaba1('0x8')](),controller['destroy']);router[_0xaba1('0x3e')](_0xaba1('0xc'),auth[_0xaba1('0x8')](),controller[_0xaba1('0x3f')]);router[_0xaba1('0x3e')]('/:id/canned_answers',auth[_0xaba1('0x8')](),controller[_0xaba1('0x40')]);router[_0xaba1('0x3e')](_0xaba1('0x41'),auth[_0xaba1('0x8')](),controller['removeAgents']);module[_0xaba1('0x42')]=router; \ No newline at end of file +var _0xf151=['isAuthenticated','index','get','/describe','describe','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','getAvatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getOfflineMessages','getAgents','post','/:id/dispositions','addDisposition','addAnswer','join','root','server/files/images/logos/','format','originalname','single','file','addLogo','server/files/images/avatars/','%s-%s','/:id/avatar','diskStorage','now','/:id/customer_avatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','/:id/offline','offline','addInteraction','addApplications','addAgents','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller'];(function(_0x5c016e,_0x37d67d){var _0x372145=function(_0x540cb1){while(--_0x540cb1){_0x5c016e['push'](_0x5c016e['shift']());}};_0x372145(++_0x37d67d);}(_0xf151,0x183));var _0x1f15=function(_0x5ec5a,_0x5bd7c5){_0x5ec5a=_0x5ec5a-0x0;var _0x2263de=_0xf151[_0x5ec5a];return _0x2263de;};'use strict';var multer=require('multer');var util=require(_0x1f15('0x0'));var path=require(_0x1f15('0x1'));var timeout=require(_0x1f15('0x2'));var express=require(_0x1f15('0x3'));var router=express[_0x1f15('0x4')]();var auth=require(_0x1f15('0x5'));var interaction=require(_0x1f15('0x6'));var config=require(_0x1f15('0x7'));var controller=require(_0x1f15('0x8'));router['get']('/',auth[_0x1f15('0x9')](),controller[_0x1f15('0xa')]);router[_0x1f15('0xb')](_0x1f15('0xc'),auth[_0x1f15('0x9')](),controller[_0x1f15('0xd')]);router[_0x1f15('0xb')]('/:id',auth[_0x1f15('0x9')](),controller['show']);router[_0x1f15('0xb')]('/:id/dispositions',auth[_0x1f15('0x9')](),controller[_0x1f15('0xe')]);router['get'](_0x1f15('0xf'),auth['isAuthenticated'](),controller[_0x1f15('0x10')]);router[_0x1f15('0xb')](_0x1f15('0x11'),controller[_0x1f15('0x12')]);router['get']('/:id/avatar',controller[_0x1f15('0x13')]);router['get']('/:id/customer_avatar',controller[_0x1f15('0x14')]);router[_0x1f15('0xb')](_0x1f15('0x15'),controller[_0x1f15('0x16')]);router[_0x1f15('0xb')](_0x1f15('0x17'),auth['isAuthenticated'](),controller['getInteractions']);router[_0x1f15('0xb')]('/:id/snippet',controller['getSnippet']);router[_0x1f15('0xb')](_0x1f15('0x18'),auth['isAuthenticated'](),controller[_0x1f15('0x19')]);router[_0x1f15('0xb')](_0x1f15('0x1a'),auth[_0x1f15('0x9')](),controller[_0x1f15('0x1b')]);router[_0x1f15('0xb')](_0x1f15('0x1c'),controller['getFields']);router[_0x1f15('0xb')]('/:id/offline_messages',auth[_0x1f15('0x9')](),controller[_0x1f15('0x1d')]);router['get']('/:id/users',auth[_0x1f15('0x9')](),controller[_0x1f15('0x1e')]);router[_0x1f15('0x1f')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1f15('0x1f')](_0x1f15('0x20'),auth[_0x1f15('0x9')](),controller[_0x1f15('0x21')]);router[_0x1f15('0x1f')](_0x1f15('0xf'),auth[_0x1f15('0x9')](),controller[_0x1f15('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x221d88,_0x37c1c7,_0x427fa6){_0x427fa6(null,path[_0x1f15('0x23')](config[_0x1f15('0x24')],_0x1f15('0x25')));},'filename':function(_0x4de1ff,_0x4144a6,_0x3247f5){_0x3247f5(null,util[_0x1f15('0x26')]('%s-%s',Date['now'](),_0x4144a6[_0x1f15('0x27')]));}})});router[_0x1f15('0x1f')](_0x1f15('0x11'),upload[_0x1f15('0x28')](_0x1f15('0x29')),controller[_0x1f15('0x2a')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x471f16,_0x1bd30d,_0x33a669){_0x33a669(null,path[_0x1f15('0x23')](config[_0x1f15('0x24')],_0x1f15('0x2b')));},'filename':function(_0x28ac89,_0x4f0120,_0x3c08df){_0x3c08df(null,util['format'](_0x1f15('0x2c'),Date['now'](),_0x4f0120[_0x1f15('0x27')]));}})});router[_0x1f15('0x1f')](_0x1f15('0x2d'),upload[_0x1f15('0x28')](_0x1f15('0x29')),controller['addAvatar']);var upload=multer({'storage':multer[_0x1f15('0x2e')]({'destination':function(_0x936d47,_0x567dc7,_0x590726){_0x590726(null,path[_0x1f15('0x23')](config['root'],_0x1f15('0x2b')));},'filename':function(_0x5ec5d7,_0x51e92e,_0x3811dc){_0x3811dc(null,util[_0x1f15('0x26')](_0x1f15('0x2c'),Date[_0x1f15('0x2f')](),_0x51e92e['originalname']));}})});router[_0x1f15('0x1f')](_0x1f15('0x30'),upload[_0x1f15('0x28')](_0x1f15('0x29')),controller[_0x1f15('0x31')]);var upload=multer({'storage':multer[_0x1f15('0x2e')]({'destination':function(_0x173d61,_0x1debee,_0x28d3a5){_0x28d3a5(null,path['join'](config['root'],_0x1f15('0x2b')));},'filename':function(_0x3bf157,_0x3573f6,_0x2240f4){_0x2240f4(null,util['format']('%s-%s',Date[_0x1f15('0x2f')](),_0x3573f6[_0x1f15('0x27')]));}})});router[_0x1f15('0x1f')](_0x1f15('0x15'),upload[_0x1f15('0x28')](_0x1f15('0x29')),controller[_0x1f15('0x32')]);router['post'](_0x1f15('0x33'),controller[_0x1f15('0x34')]);router[_0x1f15('0x1f')](_0x1f15('0x35'),controller[_0x1f15('0x36')]);router[_0x1f15('0x1f')](_0x1f15('0x17'),auth['isAuthenticated'](),controller[_0x1f15('0x37')]);router[_0x1f15('0x1f')](_0x1f15('0x18'),auth[_0x1f15('0x9')](),controller[_0x1f15('0x38')]);router[_0x1f15('0x1f')](_0x1f15('0x1a'),auth[_0x1f15('0x9')](),controller['addProactiveActions']);router[_0x1f15('0x1f')]('/:id/users',auth[_0x1f15('0x9')](),controller[_0x1f15('0x39')]);router['put'](_0x1f15('0x3a'),auth[_0x1f15('0x9')](),controller[_0x1f15('0x3b')]);router['delete'](_0x1f15('0x3a'),auth[_0x1f15('0x9')](),controller[_0x1f15('0x3c')]);router[_0x1f15('0x3d')](_0x1f15('0x20'),auth['isAuthenticated'](),controller[_0x1f15('0x3e')]);router[_0x1f15('0x3d')](_0x1f15('0xf'),auth['isAuthenticated'](),controller[_0x1f15('0x3f')]);router[_0x1f15('0x3d')]('/:id/users',auth[_0x1f15('0x9')](),controller[_0x1f15('0x40')]);module[_0x1f15('0x41')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 4182a46..7a4f1d8 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 _0xf31b=['AmazonAWS','Google','sequelize','exports','STRING','ENUM'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xf31b,0x1a0));var _0xbf31=function(_0x1ce18b,_0x273e58){_0x1ce18b=_0x1ce18b-0x0;var _0x32d908=_0xf31b[_0x1ce18b];return _0x32d908;};'use strict';var Sequelize=require(_0xbf31('0x0'));module[_0xbf31('0x1')]={'name':{'type':Sequelize[_0xbf31('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xbf31('0x3')](_0xbf31('0x4'),_0xbf31('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0xbf31('0x2')]},'data2':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x55c1=['STRING','sequelize','exports','Google'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x55c1,0x1e5));var _0x155c=function(_0x4bbc3a,_0x3a6945){_0x4bbc3a=_0x4bbc3a-0x0;var _0x579d56=_0x55c1[_0x4bbc3a];return _0x579d56;};'use strict';var Sequelize=require(_0x155c('0x0'));module[_0x155c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM']('AmazonAWS',_0x155c('0x2')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x155c('0x3')]},'data2':{'type':Sequelize[_0x155c('0x3')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 473759f..94c2ce5 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 _0x45ae=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','send','index','map','CloudProvider','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','catch','create','body','destroy','find','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','papaparse'];(function(_0x5bc5fe,_0x2afaef){var _0x298ea7=function(_0x1c6bd5){while(--_0x1c6bd5){_0x5bc5fe['push'](_0x5bc5fe['shift']());}};_0x298ea7(++_0x2afaef);}(_0x45ae,0xca));var _0xe45a=function(_0xeae1a,_0x18b5cb){_0xeae1a=_0xeae1a-0x0;var _0x56573a=_0x45ae[_0xeae1a];return _0x56573a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe45a('0x0'));var rimraf=require(_0xe45a('0x1'));var zipdir=require(_0xe45a('0x2'));var jsonpatch=require(_0xe45a('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe45a('0x4'));var Mustache=require(_0xe45a('0x5'));var util=require(_0xe45a('0x6'));var path=require('path');var sox=require(_0xe45a('0x7'));var csv=require(_0xe45a('0x8'));var ejs=require(_0xe45a('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe45a('0xa'));var crypto=require(_0xe45a('0xb'));var jsforce=require(_0xe45a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe45a('0x8'));var querystring=require('querystring');var Papa=require(_0xe45a('0xd'));var Redis=require('ioredis');var authService=require(_0xe45a('0xe'));var qs=require(_0xe45a('0xf'));var as=require(_0xe45a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe45a('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xe45a('0x12'));var db=require(_0xe45a('0x13'))['db'];function respondWithStatusCode(_0x2cb725,_0xd371b5){_0xd371b5=_0xd371b5||0xcc;return function(_0xbc2f92){if(_0xbc2f92){return _0x2cb725[_0xe45a('0x14')](_0xd371b5);}return _0x2cb725[_0xe45a('0x15')](_0xd371b5)[_0xe45a('0x16')]();};}function respondWithResult(_0x3b9d4c,_0x24c753){_0x24c753=_0x24c753||0xc8;return function(_0x3803d6){if(_0x3803d6){return _0x3b9d4c[_0xe45a('0x15')](_0x24c753)[_0xe45a('0x17')](_0x3803d6);}};}function respondWithFilteredResult(_0x55badc,_0x27ff21){return function(_0x2c993d){if(_0x2c993d){var _0x4c97fc=_0x2c993d[_0xe45a('0x18')],_0x373e13=_0x27ff21[_0xe45a('0x19')],_0x551f25=_0x27ff21[_0xe45a('0x19')]+_0x27ff21[_0xe45a('0x1a')],_0x1c0cd0;if(_0x551f25>=_0x4c97fc){_0x551f25=_0x4c97fc;_0x1c0cd0=0xc8;}else{_0x1c0cd0=0xce;}_0x55badc[_0xe45a('0x15')](_0x1c0cd0);return _0x55badc[_0xe45a('0x1b')](_0xe45a('0x1c'),_0x373e13+'-'+_0x551f25+'/'+_0x4c97fc)['json'](_0x2c993d);}return null;};}function patchUpdates(_0x4e765b){return function(_0x598d48){try{jsonpatch[_0xe45a('0x1d')](_0x598d48,_0x4e765b,!![]);}catch(_0x4c4e49){return BPromise[_0xe45a('0x1e')](_0x4c4e49);}return _0x598d48[_0xe45a('0x1f')]();};}function saveUpdates(_0x2de886,_0xdfd22c){return function(_0x5330f3){if(_0x5330f3){return _0x5330f3[_0xe45a('0x20')](_0x2de886)[_0xe45a('0x21')](function(_0x43e088){return _0x43e088;});}return null;};}function removeEntity(_0xefeb42,_0x36d9d4){return function(_0x123c14){if(_0x123c14){return _0x123c14['destroy']()[_0xe45a('0x21')](function(){_0xefeb42[_0xe45a('0x15')](0xcc)[_0xe45a('0x16')]();});}};}function handleEntityNotFound(_0x2104a7,_0x4254ef){return function(_0x2b8454){if(!_0x2b8454){_0x2104a7[_0xe45a('0x14')](0x194);}return _0x2b8454;};}function handleError(_0x5a393c,_0x1880ba){_0x1880ba=_0x1880ba||0x1f4;return function(_0x3564f8){logger[_0xe45a('0x22')](_0x3564f8[_0xe45a('0x23')]);if(_0x3564f8['name']){delete _0x3564f8['name'];}_0x5a393c[_0xe45a('0x15')](_0x1880ba)[_0xe45a('0x24')](_0x3564f8);};}exports[_0xe45a('0x25')]=function(_0x3cb882,_0x5cf717){var _0x174106={},_0x5c9af7={},_0x4a5b5a={'count':0x0,'rows':[]};var _0x5d8d8a=_[_0xe45a('0x26')](db[_0xe45a('0x27')][_0xe45a('0x28')],function(_0xe8421e){return{'name':_0xe8421e[_0xe45a('0x29')],'type':_0xe8421e[_0xe45a('0x2a')]['key']};});_0x5c9af7[_0xe45a('0x2b')]=_[_0xe45a('0x26')](_0x5d8d8a,_0xe45a('0x2c'));_0x5c9af7[_0xe45a('0x2d')]=_[_0xe45a('0x2e')](_0x3cb882[_0xe45a('0x2d')]);_0x5c9af7[_0xe45a('0x2f')]=_[_0xe45a('0x30')](_0x5c9af7[_0xe45a('0x2b')],_0x5c9af7['query']);_0x174106[_0xe45a('0x31')]=_['intersection'](_0x5c9af7[_0xe45a('0x2b')],qs['fields'](_0x3cb882[_0xe45a('0x2d')][_0xe45a('0x32')]));_0x174106[_0xe45a('0x31')]=_0x174106['attributes'][_0xe45a('0x33')]?_0x174106[_0xe45a('0x31')]:_0x5c9af7[_0xe45a('0x2b')];if(!_0x3cb882[_0xe45a('0x2d')][_0xe45a('0x34')](_0xe45a('0x35'))){_0x174106[_0xe45a('0x1a')]=qs[_0xe45a('0x1a')](_0x3cb882[_0xe45a('0x2d')][_0xe45a('0x1a')]);_0x174106[_0xe45a('0x19')]=qs['offset'](_0x3cb882[_0xe45a('0x2d')]['offset']);}_0x174106[_0xe45a('0x36')]=qs['sort'](_0x3cb882[_0xe45a('0x2d')][_0xe45a('0x37')]);_0x174106['where']=qs[_0xe45a('0x2f')](_[_0xe45a('0x38')](_0x3cb882[_0xe45a('0x2d')],_0x5c9af7[_0xe45a('0x2f')]),_0x5d8d8a);if(_0x3cb882[_0xe45a('0x2d')][_0xe45a('0x39')]){_0x174106[_0xe45a('0x3a')]=_['merge'](_0x174106[_0xe45a('0x3a')],{'$or':_[_0xe45a('0x26')](_0x5d8d8a,function(_0x16f87d){if(_0x16f87d[_0xe45a('0x2a')]!==_0xe45a('0x3b')){var _0x3c0c90={};_0x3c0c90[_0x16f87d[_0xe45a('0x2c')]]={'$like':'%'+_0x3cb882[_0xe45a('0x2d')][_0xe45a('0x39')]+'%'};return _0x3c0c90;}})});}_0x174106=_[_0xe45a('0x3c')]({},_0x174106,_0x3cb882[_0xe45a('0x3d')]);var _0x1a280c={'where':_0x174106[_0xe45a('0x3a')]};return db[_0xe45a('0x27')][_0xe45a('0x18')](_0x1a280c)[_0xe45a('0x21')](function(_0x1c029f){_0x4a5b5a[_0xe45a('0x18')]=_0x1c029f;if(_0x3cb882[_0xe45a('0x2d')][_0xe45a('0x3e')]){_0x174106['include']=[{'all':!![]}];}return db[_0xe45a('0x27')][_0xe45a('0x3f')](_0x174106);})['then'](function(_0x397ea0){_0x4a5b5a[_0xe45a('0x40')]=_0x397ea0;return _0x4a5b5a;})[_0xe45a('0x21')](respondWithFilteredResult(_0x5cf717,_0x174106))['catch'](handleError(_0x5cf717,null));};exports[_0xe45a('0x41')]=function(_0x34a6a2,_0x34fa3d){var _0x654d7c={'raw':!![],'where':{'id':_0x34a6a2[_0xe45a('0x42')]['id']}},_0x3f8758={};_0x3f8758[_0xe45a('0x2b')]=_[_0xe45a('0x2e')](db[_0xe45a('0x27')][_0xe45a('0x28')]);_0x3f8758['query']=_[_0xe45a('0x2e')](_0x34a6a2[_0xe45a('0x2d')]);_0x3f8758[_0xe45a('0x2f')]=_[_0xe45a('0x30')](_0x3f8758[_0xe45a('0x2b')],_0x3f8758['query']);_0x654d7c[_0xe45a('0x31')]=_['intersection'](_0x3f8758[_0xe45a('0x2b')],qs[_0xe45a('0x32')](_0x34a6a2[_0xe45a('0x2d')][_0xe45a('0x32')]));_0x654d7c[_0xe45a('0x31')]=_0x654d7c[_0xe45a('0x31')][_0xe45a('0x33')]?_0x654d7c[_0xe45a('0x31')]:_0x3f8758[_0xe45a('0x2b')];if(_0x34a6a2[_0xe45a('0x2d')]['includeAll']){_0x654d7c['include']=[{'all':!![]}];}_0x654d7c=_[_0xe45a('0x3c')]({},_0x654d7c,_0x34a6a2[_0xe45a('0x3d')]);return db[_0xe45a('0x27')]['find'](_0x654d7c)[_0xe45a('0x21')](handleEntityNotFound(_0x34fa3d,null))['then'](respondWithResult(_0x34fa3d,null))[_0xe45a('0x43')](handleError(_0x34fa3d,null));};exports[_0xe45a('0x44')]=function(_0xb9c892,_0x30f96d){return db[_0xe45a('0x27')][_0xe45a('0x44')](_0xb9c892[_0xe45a('0x45')],{})[_0xe45a('0x21')](respondWithResult(_0x30f96d,0xc9))['catch'](handleError(_0x30f96d,null));};exports[_0xe45a('0x20')]=function(_0x5a9a64,_0x2afc37){if(_0x5a9a64[_0xe45a('0x45')]['id']){delete _0x5a9a64[_0xe45a('0x45')]['id'];}return db[_0xe45a('0x27')]['find']({'where':{'id':_0x5a9a64[_0xe45a('0x42')]['id']}})['then'](handleEntityNotFound(_0x2afc37,null))[_0xe45a('0x21')](saveUpdates(_0x5a9a64[_0xe45a('0x45')],null))[_0xe45a('0x21')](respondWithResult(_0x2afc37,null))['catch'](handleError(_0x2afc37,null));};exports[_0xe45a('0x46')]=function(_0x5cbc83,_0x27cbdd){return db['CloudProvider'][_0xe45a('0x47')]({'where':{'id':_0x5cbc83[_0xe45a('0x42')]['id']}})[_0xe45a('0x21')](handleEntityNotFound(_0x27cbdd,null))[_0xe45a('0x21')](removeEntity(_0x27cbdd,null))[_0xe45a('0x43')](handleError(_0x27cbdd,null));}; \ No newline at end of file +var _0x03e9=['key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','offset','order','sort','filters','filter','where','merge','VIRTUAL','options','CloudProvider','count','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','length','find','create','body','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','set','Content-Range','reject','save','then','destroy','stack','name','send','index','map','fieldName','type'];(function(_0x406bd9,_0x4adf83){var _0x37495c=function(_0x31f170){while(--_0x31f170){_0x406bd9['push'](_0x406bd9['shift']());}};_0x37495c(++_0x4adf83);}(_0x03e9,0x19c));var _0x903e=function(_0x5dbe96,_0x21d047){_0x5dbe96=_0x5dbe96-0x0;var _0x47edbc=_0x03e9[_0x5dbe96];return _0x47edbc;};'use strict';var pdf=require(_0x903e('0x0'));var emlformat=require(_0x903e('0x1'));var rimraf=require(_0x903e('0x2'));var zipdir=require(_0x903e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x903e('0x4'));var BPromise=require(_0x903e('0x5'));var Mustache=require('mustache');var util=require(_0x903e('0x6'));var path=require(_0x903e('0x7'));var sox=require(_0x903e('0x8'));var csv=require(_0x903e('0x9'));var ejs=require(_0x903e('0xa'));var fs=require('fs');var _=require(_0x903e('0xb'));var squel=require(_0x903e('0xc'));var crypto=require(_0x903e('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x903e('0x9'));var querystring=require(_0x903e('0xe'));var Papa=require(_0x903e('0xf'));var Redis=require(_0x903e('0x10'));var authService=require(_0x903e('0x11'));var qs=require(_0x903e('0x12'));var as=require(_0x903e('0x13'));var hardwareService=require(_0x903e('0x14'));var logger=require(_0x903e('0x15'))(_0x903e('0x16'));var utils=require(_0x903e('0x17'));var config=require(_0x903e('0x18'));var db=require(_0x903e('0x19'))['db'];function respondWithStatusCode(_0x46e945,_0x5c97c2){_0x5c97c2=_0x5c97c2||0xcc;return function(_0xf7497b){if(_0xf7497b){return _0x46e945[_0x903e('0x1a')](_0x5c97c2);}return _0x46e945[_0x903e('0x1b')](_0x5c97c2)[_0x903e('0x1c')]();};}function respondWithResult(_0x37e037,_0x4aee5b){_0x4aee5b=_0x4aee5b||0xc8;return function(_0x2a885f){if(_0x2a885f){return _0x37e037[_0x903e('0x1b')](_0x4aee5b)[_0x903e('0x1d')](_0x2a885f);}};}function respondWithFilteredResult(_0x5d135f,_0x2fa681){return function(_0x5a1dad){if(_0x5a1dad){var _0x237ef8=_0x5a1dad['count'],_0x26aec9=_0x2fa681['offset'],_0x378e3a=_0x2fa681['offset']+_0x2fa681[_0x903e('0x1e')],_0x42593e;if(_0x378e3a>=_0x237ef8){_0x378e3a=_0x237ef8;_0x42593e=0xc8;}else{_0x42593e=0xce;}_0x5d135f['status'](_0x42593e);return _0x5d135f[_0x903e('0x1f')](_0x903e('0x20'),_0x26aec9+'-'+_0x378e3a+'/'+_0x237ef8)[_0x903e('0x1d')](_0x5a1dad);}return null;};}function patchUpdates(_0x4253e6){return function(_0x16f780){try{jsonpatch['apply'](_0x16f780,_0x4253e6,!![]);}catch(_0x2c6c91){return BPromise[_0x903e('0x21')](_0x2c6c91);}return _0x16f780[_0x903e('0x22')]();};}function saveUpdates(_0x2a76af,_0x5a546e){return function(_0x3faf2e){if(_0x3faf2e){return _0x3faf2e['update'](_0x2a76af)[_0x903e('0x23')](function(_0x2743e6){return _0x2743e6;});}return null;};}function removeEntity(_0x2a6788,_0x1ec95d){return function(_0x34ac7d){if(_0x34ac7d){return _0x34ac7d[_0x903e('0x24')]()['then'](function(){_0x2a6788[_0x903e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x449b65,_0x19e0b1){return function(_0x2410c9){if(!_0x2410c9){_0x449b65[_0x903e('0x1a')](0x194);}return _0x2410c9;};}function handleError(_0x5d66a3,_0x44f27f){_0x44f27f=_0x44f27f||0x1f4;return function(_0x433481){logger['error'](_0x433481[_0x903e('0x25')]);if(_0x433481[_0x903e('0x26')]){delete _0x433481[_0x903e('0x26')];}_0x5d66a3[_0x903e('0x1b')](_0x44f27f)[_0x903e('0x27')](_0x433481);};}exports[_0x903e('0x28')]=function(_0x564e29,_0x2a5ed7){var _0x281766={},_0xadb067={},_0x204f2d={'count':0x0,'rows':[]};var _0x55b520=_[_0x903e('0x29')](db['CloudProvider']['rawAttributes'],function(_0x1e973a){return{'name':_0x1e973a[_0x903e('0x2a')],'type':_0x1e973a[_0x903e('0x2b')][_0x903e('0x2c')]};});_0xadb067[_0x903e('0x2d')]=_[_0x903e('0x29')](_0x55b520,_0x903e('0x26'));_0xadb067['query']=_['keys'](_0x564e29[_0x903e('0x2e')]);_0xadb067['filters']=_[_0x903e('0x2f')](_0xadb067['model'],_0xadb067[_0x903e('0x2e')]);_0x281766['attributes']=_[_0x903e('0x2f')](_0xadb067[_0x903e('0x2d')],qs[_0x903e('0x30')](_0x564e29[_0x903e('0x2e')]['fields']));_0x281766['attributes']=_0x281766['attributes']['length']?_0x281766[_0x903e('0x31')]:_0xadb067[_0x903e('0x2d')];if(!_0x564e29[_0x903e('0x2e')][_0x903e('0x32')](_0x903e('0x33'))){_0x281766[_0x903e('0x1e')]=qs[_0x903e('0x1e')](_0x564e29[_0x903e('0x2e')]['limit']);_0x281766[_0x903e('0x34')]=qs[_0x903e('0x34')](_0x564e29[_0x903e('0x2e')][_0x903e('0x34')]);}_0x281766[_0x903e('0x35')]=qs[_0x903e('0x36')](_0x564e29['query']['sort']);_0x281766['where']=qs[_0x903e('0x37')](_['pick'](_0x564e29[_0x903e('0x2e')],_0xadb067[_0x903e('0x37')]),_0x55b520);if(_0x564e29[_0x903e('0x2e')][_0x903e('0x38')]){_0x281766[_0x903e('0x39')]=_[_0x903e('0x3a')](_0x281766[_0x903e('0x39')],{'$or':_[_0x903e('0x29')](_0x55b520,function(_0x14da2d){if(_0x14da2d['type']!==_0x903e('0x3b')){var _0x4bb41f={};_0x4bb41f[_0x14da2d[_0x903e('0x26')]]={'$like':'%'+_0x564e29[_0x903e('0x2e')][_0x903e('0x38')]+'%'};return _0x4bb41f;}})});}_0x281766=_[_0x903e('0x3a')]({},_0x281766,_0x564e29[_0x903e('0x3c')]);var _0x2b7837={'where':_0x281766['where']};return db[_0x903e('0x3d')][_0x903e('0x3e')](_0x2b7837)[_0x903e('0x23')](function(_0x5c5b91){_0x204f2d[_0x903e('0x3e')]=_0x5c5b91;if(_0x564e29[_0x903e('0x2e')][_0x903e('0x3f')]){_0x281766[_0x903e('0x40')]=[{'all':!![]}];}return db[_0x903e('0x3d')][_0x903e('0x41')](_0x281766);})[_0x903e('0x23')](function(_0x9b5866){_0x204f2d[_0x903e('0x42')]=_0x9b5866;return _0x204f2d;})[_0x903e('0x23')](respondWithFilteredResult(_0x2a5ed7,_0x281766))[_0x903e('0x43')](handleError(_0x2a5ed7,null));};exports[_0x903e('0x44')]=function(_0x509b17,_0x67fff0){var _0x2088dc={'raw':!![],'where':{'id':_0x509b17[_0x903e('0x45')]['id']}},_0x5f216e={};_0x5f216e[_0x903e('0x2d')]=_[_0x903e('0x46')](db[_0x903e('0x3d')][_0x903e('0x47')]);_0x5f216e[_0x903e('0x2e')]=_['keys'](_0x509b17[_0x903e('0x2e')]);_0x5f216e[_0x903e('0x37')]=_[_0x903e('0x2f')](_0x5f216e['model'],_0x5f216e[_0x903e('0x2e')]);_0x2088dc[_0x903e('0x31')]=_['intersection'](_0x5f216e[_0x903e('0x2d')],qs[_0x903e('0x30')](_0x509b17['query'][_0x903e('0x30')]));_0x2088dc[_0x903e('0x31')]=_0x2088dc['attributes'][_0x903e('0x48')]?_0x2088dc[_0x903e('0x31')]:_0x5f216e[_0x903e('0x2d')];if(_0x509b17['query']['includeAll']){_0x2088dc[_0x903e('0x40')]=[{'all':!![]}];}_0x2088dc=_[_0x903e('0x3a')]({},_0x2088dc,_0x509b17['options']);return db[_0x903e('0x3d')][_0x903e('0x49')](_0x2088dc)['then'](handleEntityNotFound(_0x67fff0,null))[_0x903e('0x23')](respondWithResult(_0x67fff0,null))['catch'](handleError(_0x67fff0,null));};exports[_0x903e('0x4a')]=function(_0x487a75,_0x32a728){return db[_0x903e('0x3d')]['create'](_0x487a75[_0x903e('0x4b')],{})[_0x903e('0x23')](respondWithResult(_0x32a728,0xc9))[_0x903e('0x43')](handleError(_0x32a728,null));};exports['update']=function(_0x351c23,_0x5058ec){if(_0x351c23[_0x903e('0x4b')]['id']){delete _0x351c23['body']['id'];}return db[_0x903e('0x3d')]['find']({'where':{'id':_0x351c23[_0x903e('0x45')]['id']}})[_0x903e('0x23')](handleEntityNotFound(_0x5058ec,null))[_0x903e('0x23')](saveUpdates(_0x351c23[_0x903e('0x4b')],null))[_0x903e('0x23')](respondWithResult(_0x5058ec,null))[_0x903e('0x43')](handleError(_0x5058ec,null));};exports[_0x903e('0x24')]=function(_0x465270,_0x79c6d4){return db[_0x903e('0x3d')][_0x903e('0x49')]({'where':{'id':_0x465270[_0x903e('0x45')]['id']}})[_0x903e('0x23')](handleEntityNotFound(_0x79c6d4,null))['then'](removeEntity(_0x79c6d4,null))[_0x903e('0x43')](handleError(_0x79c6d4,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index b31e8c4..43c6348 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 _0x9dad=['request-promise','path','rimraf','../../config/environment','exports','define','CloudProvider','cloud_providers','util','bluebird'];(function(_0x32e6a2,_0x5e1e09){var _0xdc473=function(_0x52bf6c){while(--_0x52bf6c){_0x32e6a2['push'](_0x32e6a2['shift']());}};_0xdc473(++_0x5e1e09);}(_0x9dad,0x9e));var _0xd9da=function(_0x5729bf,_0x4d3f5b){_0x5729bf=_0x5729bf-0x0;var _0x5babbd=_0x9dad[_0x5729bf];return _0x5babbd;};'use strict';var _=require('lodash');var util=require(_0xd9da('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xd9da('0x1'));var rp=require(_0xd9da('0x2'));var fs=require('fs');var path=require(_0xd9da('0x3'));var rimraf=require(_0xd9da('0x4'));var config=require(_0xd9da('0x5'));var attributes=require('./cloudProvider.attributes');module[_0xd9da('0x6')]=function(_0x2a037f,_0x31c4b9){return _0x2a037f[_0xd9da('0x7')](_0xd9da('0x8'),attributes,{'tableName':_0xd9da('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b43=['rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1031ab,_0x11a0e6){var _0x15ba29=function(_0x363709){while(--_0x363709){_0x1031ab['push'](_0x1031ab['shift']());}};_0x15ba29(++_0x11a0e6);}(_0x8b43,0xe8));var _0x38b4=function(_0x22a8ae,_0x1e5837){_0x22a8ae=_0x22a8ae-0x0;var _0x244a57=_0x8b43[_0x22a8ae];return _0x244a57;};'use strict';var _=require(_0x38b4('0x0'));var util=require(_0x38b4('0x1'));var logger=require(_0x38b4('0x2'))(_0x38b4('0x3'));var moment=require(_0x38b4('0x4'));var BPromise=require(_0x38b4('0x5'));var rp=require(_0x38b4('0x6'));var fs=require('fs');var path=require(_0x38b4('0x7'));var rimraf=require(_0x38b4('0x8'));var config=require(_0x38b4('0x9'));var attributes=require(_0x38b4('0xa'));module[_0x38b4('0xb')]=function(_0x3a302a,_0x3e3b82){return _0x3a302a[_0x38b4('0xc')](_0x38b4('0xd'),attributes,{'tableName':_0x38b4('0xe'),'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 67519e7..ed54da0 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 _0xd267=['request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','client','then','info','CloudProvider,\x20%s,\x20%s'];(function(_0x4e1bcf,_0x462f1d){var _0x46e82f=function(_0x46109d){while(--_0x46109d){_0x4e1bcf['push'](_0x4e1bcf['shift']());}};_0x46e82f(++_0x462f1d);}(_0xd267,0x7a));var _0x7d26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd267[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x7d26('0x0'));var moment=require(_0x7d26('0x1'));var BPromise=require(_0x7d26('0x2'));var rs=require(_0x7d26('0x3'));var fs=require('fs');var Redis=require(_0x7d26('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7d26('0x5'));var config=require(_0x7d26('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7d26('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ad5a8,_0x240ac0,_0x242b82){return new BPromise(function(_0x32c765,_0x3eb536){return client['request'](_0x3ad5a8,_0x242b82)[_0x7d26('0x8')](function(_0x6b9619){logger[_0x7d26('0x9')](_0x7d26('0xa'),_0x240ac0,_0x7d26('0xb'));logger[_0x7d26('0xc')](_0x7d26('0xd'),_0x240ac0,_0x7d26('0xb'),JSON['stringify'](_0x6b9619));if(_0x6b9619[_0x7d26('0xe')]){if(_0x6b9619['error'][_0x7d26('0xf')]===0x1f4){logger[_0x7d26('0xe')](_0x7d26('0xa'),_0x240ac0,_0x6b9619['error'][_0x7d26('0x10')]);return _0x3eb536(_0x6b9619[_0x7d26('0xe')][_0x7d26('0x10')]);}logger['error'](_0x7d26('0xa'),_0x240ac0,_0x6b9619[_0x7d26('0xe')][_0x7d26('0x10')]);return _0x32c765(_0x6b9619['error'][_0x7d26('0x10')]);}else{logger[_0x7d26('0x9')](_0x7d26('0xa'),_0x240ac0,'request\x20sent');_0x32c765(_0x6b9619[_0x7d26('0x11')][_0x7d26('0x10')]);}})[_0x7d26('0x12')](function(_0x2ef9ef){logger[_0x7d26('0xe')](_0x7d26('0xa'),_0x240ac0,_0x2ef9ef);_0x3eb536(_0x2ef9ef);});});} \ No newline at end of file +var _0x448e=['stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s'];(function(_0x4b7daa,_0x583357){var _0x866f9f=function(_0x39f380){while(--_0x39f380){_0x4b7daa['push'](_0x4b7daa['shift']());}};_0x866f9f(++_0x583357);}(_0x448e,0xc3));var _0xe448=function(_0x57e196,_0x428408){_0x57e196=_0x57e196-0x0;var _0x5941ab=_0x448e[_0x57e196];return _0x5941ab;};'use strict';var _=require(_0xe448('0x0'));var util=require(_0xe448('0x1'));var moment=require('moment');var BPromise=require(_0xe448('0x2'));var rs=require(_0xe448('0x3'));var fs=require('fs');var Redis=require(_0xe448('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe448('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xe448('0x6'));var jayson=require(_0xe448('0x7'));var client=jayson['client'][_0xe448('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x15b61f,_0x1b20cf,_0x1e6c4d){return new BPromise(function(_0x4e0cb1,_0x3c4d67){return client[_0xe448('0x9')](_0x15b61f,_0x1e6c4d)[_0xe448('0xa')](function(_0x10862b){logger[_0xe448('0xb')](_0xe448('0xc'),_0x1b20cf,_0xe448('0xd'));logger['debug'](_0xe448('0xe'),_0x1b20cf,'request\x20sent',JSON[_0xe448('0xf')](_0x10862b));if(_0x10862b[_0xe448('0x10')]){if(_0x10862b[_0xe448('0x10')][_0xe448('0x11')]===0x1f4){logger['error'](_0xe448('0xc'),_0x1b20cf,_0x10862b[_0xe448('0x10')][_0xe448('0x12')]);return _0x3c4d67(_0x10862b[_0xe448('0x10')]['message']);}logger['error'](_0xe448('0xc'),_0x1b20cf,_0x10862b[_0xe448('0x10')][_0xe448('0x12')]);return _0x4e0cb1(_0x10862b[_0xe448('0x10')][_0xe448('0x12')]);}else{logger[_0xe448('0xb')](_0xe448('0xc'),_0x1b20cf,'request\x20sent');_0x4e0cb1(_0x10862b[_0xe448('0x13')]['message']);}})[_0xe448('0x14')](function(_0x17510c){logger[_0xe448('0x10')](_0xe448('0xc'),_0x1b20cf,_0x17510c);_0x3c4d67(_0x17510c);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 5d80e36..30b6f99 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 _0x8bfe=['update','delete','destroy','exports','path','connect-timeout','express','../../components/interaction/service','./cloudProvider.controller','get','index','/:id','isAuthenticated','show','post','put'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x8bfe,0x184));var _0xe8bf=function(_0x2ade6f,_0x18d576){_0x2ade6f=_0x2ade6f-0x0;var _0x28fa0f=_0x8bfe[_0x2ade6f];return _0x28fa0f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe8bf('0x0'));var timeout=require(_0xe8bf('0x1'));var express=require(_0xe8bf('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xe8bf('0x3'));var config=require('../../config/environment');var controller=require(_0xe8bf('0x4'));router[_0xe8bf('0x5')]('/',auth['isAuthenticated'](),controller[_0xe8bf('0x6')]);router[_0xe8bf('0x5')](_0xe8bf('0x7'),auth[_0xe8bf('0x8')](),controller[_0xe8bf('0x9')]);router[_0xe8bf('0xa')]('/',auth[_0xe8bf('0x8')](),controller['create']);router[_0xe8bf('0xb')](_0xe8bf('0x7'),auth[_0xe8bf('0x8')](),controller[_0xe8bf('0xc')]);router[_0xe8bf('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xe8bf('0xe')]);module[_0xe8bf('0xf')]=router; \ No newline at end of file +var _0xc692=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated','show','create','update','delete','/:id','destroy'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc692,0x11e));var _0x2c69=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xc692[_0x3ff085];return _0x2b68c3;};'use strict';var multer=require(_0x2c69('0x0'));var util=require(_0x2c69('0x1'));var path=require(_0x2c69('0x2'));var timeout=require(_0x2c69('0x3'));var express=require(_0x2c69('0x4'));var router=express[_0x2c69('0x5')]();var auth=require(_0x2c69('0x6'));var interaction=require(_0x2c69('0x7'));var config=require(_0x2c69('0x8'));var controller=require(_0x2c69('0x9'));router[_0x2c69('0xa')]('/',auth[_0x2c69('0xb')](),controller['index']);router[_0x2c69('0xa')]('/:id',auth[_0x2c69('0xb')](),controller[_0x2c69('0xc')]);router['post']('/',auth[_0x2c69('0xb')](),controller[_0x2c69('0xd')]);router['put']('/:id',auth[_0x2c69('0xb')](),controller[_0x2c69('0xe')]);router[_0x2c69('0xf')](_0x2c69('0x10'),auth[_0x2c69('0xb')](),controller[_0x2c69('0x11')]);module[_0x2c69('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index fdd0f94..887fc48 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 _0x7a9d=['sequelize','exports','STRING','name'];(function(_0x380307,_0x440ccd){var _0x9ea14b=function(_0x51024c){while(--_0x51024c){_0x380307['push'](_0x380307['shift']());}};_0x9ea14b(++_0x440ccd);}(_0x7a9d,0xb8));var _0xd7a9=function(_0xe285a8,_0x48ff89){_0xe285a8=_0xe285a8-0x0;var _0x2a289e=_0x7a9d[_0xe285a8];return _0x2a289e;};'use strict';var Sequelize=require(_0xd7a9('0x0'));module[_0xd7a9('0x1')]={'name':{'type':Sequelize[_0xd7a9('0x2')],'unique':_0xd7a9('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xd7a9('0x2')]},'companyId':{'type':Sequelize[_0xd7a9('0x2')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xd7a9('0x2')]},'type':{'type':Sequelize[_0xd7a9('0x2')]},'street':{'type':Sequelize[_0xd7a9('0x2')]},'postalCode':{'type':Sequelize[_0xd7a9('0x2')]},'city':{'type':Sequelize[_0xd7a9('0x2')]},'country':{'type':Sequelize[_0xd7a9('0x2')]},'email':{'type':Sequelize[_0xd7a9('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xd7a9('0x2')]},'sStreet':{'type':Sequelize[_0xd7a9('0x2')]},'sPostalCode':{'type':Sequelize[_0xd7a9('0x2')]},'sCity':{'type':Sequelize[_0xd7a9('0x2')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd7a9('0x2')]}}; \ No newline at end of file +var _0x198c=['STRING','sequelize'];(function(_0x1a53b3,_0x177b8a){var _0x11023c=function(_0x3d3249){while(--_0x3d3249){_0x1a53b3['push'](_0x1a53b3['shift']());}};_0x11023c(++_0x177b8a);}(_0x198c,0x15b));var _0xc198=function(_0x30f136,_0x5d1821){_0x30f136=_0x30f136-0x0;var _0x32e07c=_0x198c[_0x30f136];return _0x32e07c;};'use strict';var Sequelize=require(_0xc198('0x0'));module['exports']={'name':{'type':Sequelize[_0xc198('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xc198('0x1')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xc198('0x1')]},'phone':{'type':Sequelize[_0xc198('0x1')]},'fax':{'type':Sequelize[_0xc198('0x1')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xc198('0x1')]},'city':{'type':Sequelize[_0xc198('0x1')]},'country':{'type':Sequelize[_0xc198('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xc198('0x1')]},'sStreet':{'type':Sequelize[_0xc198('0x1')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0xc198('0x1')]},'description':{'type':Sequelize[_0xc198('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index a6a435d..a1e87a9 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 _0x9aef=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','get','Companies','UserProfileResource','destroy','error','stack','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','includeAll','findAll','rows','catch','show','params','rawAttributes','fields','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','addContacts','ids','omit','getContacts','findOne','CmContact','options','html-pdf','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'];(function(_0x4c02d9,_0x48bc4c){var _0x204607=function(_0x28573b){while(--_0x28573b){_0x4c02d9['push'](_0x4c02d9['shift']());}};_0x204607(++_0x48bc4c);}(_0x9aef,0xa3));var _0xf9ae=function(_0x2c8972,_0x32cd0f){_0x2c8972=_0x2c8972-0x0;var _0x2de078=_0x9aef[_0x2c8972];return _0x2de078;};'use strict';var pdf=require(_0xf9ae('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf9ae('0x1'));var zipdir=require(_0xf9ae('0x2'));var jsonpatch=require(_0xf9ae('0x3'));var rp=require(_0xf9ae('0x4'));var moment=require(_0xf9ae('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf9ae('0x6'));var util=require(_0xf9ae('0x7'));var path=require(_0xf9ae('0x8'));var sox=require(_0xf9ae('0x9'));var csv=require(_0xf9ae('0xa'));var ejs=require(_0xf9ae('0xb'));var fs=require('fs');var _=require(_0xf9ae('0xc'));var squel=require(_0xf9ae('0xd'));var crypto=require(_0xf9ae('0xe'));var jsforce=require(_0xf9ae('0xf'));var deskjs=require(_0xf9ae('0x10'));var toCsv=require(_0xf9ae('0xa'));var querystring=require(_0xf9ae('0x11'));var Papa=require(_0xf9ae('0x12'));var Redis=require(_0xf9ae('0x13'));var authService=require(_0xf9ae('0x14'));var qs=require(_0xf9ae('0x15'));var as=require(_0xf9ae('0x16'));var hardwareService=require(_0xf9ae('0x17'));var logger=require(_0xf9ae('0x18'))(_0xf9ae('0x19'));var utils=require(_0xf9ae('0x1a'));var config=require(_0xf9ae('0x1b'));var db=require(_0xf9ae('0x1c'))['db'];function respondWithStatusCode(_0x37802f,_0x494f23){_0x494f23=_0x494f23||0xcc;return function(_0x49aa41){if(_0x49aa41){return _0x37802f[_0xf9ae('0x1d')](_0x494f23);}return _0x37802f[_0xf9ae('0x1e')](_0x494f23)['end']();};}function respondWithResult(_0x161ad7,_0x4916da){_0x4916da=_0x4916da||0xc8;return function(_0x410c10){if(_0x410c10){return _0x161ad7[_0xf9ae('0x1e')](_0x4916da)[_0xf9ae('0x1f')](_0x410c10);}};}function respondWithFilteredResult(_0x4f9aaa,_0x220b50){return function(_0x30a6c9){if(_0x30a6c9){var _0x2db41c=_0x30a6c9[_0xf9ae('0x20')],_0x35596f=_0x220b50[_0xf9ae('0x21')],_0x149560=_0x220b50['offset']+_0x220b50[_0xf9ae('0x22')],_0x5c432b;if(_0x149560>=_0x2db41c){_0x149560=_0x2db41c;_0x5c432b=0xc8;}else{_0x5c432b=0xce;}_0x4f9aaa[_0xf9ae('0x1e')](_0x5c432b);return _0x4f9aaa[_0xf9ae('0x23')](_0xf9ae('0x24'),_0x35596f+'-'+_0x149560+'/'+_0x2db41c)[_0xf9ae('0x1f')](_0x30a6c9);}return null;};}function patchUpdates(_0x2b218a){return function(_0x141d20){try{jsonpatch['apply'](_0x141d20,_0x2b218a,!![]);}catch(_0x401ea0){return BPromise[_0xf9ae('0x25')](_0x401ea0);}return _0x141d20[_0xf9ae('0x26')]();};}function saveUpdates(_0x19bbf7,_0x595c87){return function(_0x30d8fd){if(_0x30d8fd){return _0x30d8fd[_0xf9ae('0x27')](_0x19bbf7)[_0xf9ae('0x28')](function(_0x28facc){return _0x28facc;});}return null;};}function removeEntity(_0x26cb42,_0x1b976e){return function(_0x3bb356){if(_0x3bb356){return _0x3bb356['destroy']()[_0xf9ae('0x28')](function(){var _0x6aefd1=_0x3bb356[_0xf9ae('0x29')]({'plain':!![]});var _0x26dca5=_0xf9ae('0x2a');return db[_0xf9ae('0x2b')][_0xf9ae('0x2c')]({'where':{'type':_0x26dca5,'resourceId':_0x6aefd1['id']}})[_0xf9ae('0x28')](function(){return _0x3bb356;});})['then'](function(){_0x26cb42['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bc92e,_0x8eeb76){return function(_0x230f8c){if(!_0x230f8c){_0x5bc92e[_0xf9ae('0x1d')](0x194);}return _0x230f8c;};}function handleError(_0x47822f,_0x8e47c4){_0x8e47c4=_0x8e47c4||0x1f4;return function(_0x1b0f82){logger[_0xf9ae('0x2d')](_0x1b0f82[_0xf9ae('0x2e')]);if(_0x1b0f82[_0xf9ae('0x2f')]){delete _0x1b0f82[_0xf9ae('0x2f')];}_0x47822f[_0xf9ae('0x1e')](_0x8e47c4)[_0xf9ae('0x30')](_0x1b0f82);};}exports[_0xf9ae('0x31')]=function(_0x171095,_0x17607d){var _0x5f0aaf={},_0x2538de={},_0x12bf0d={'count':0x0,'rows':[]};return db[_0xf9ae('0x32')][_0xf9ae('0x33')]()[_0xf9ae('0x28')](function(_0x54f3d9){_0x2538de[_0xf9ae('0x34')]=_[_0xf9ae('0x35')](_0x54f3d9);_0x2538de[_0xf9ae('0x36')]=_[_0xf9ae('0x35')](_0x171095[_0xf9ae('0x36')]);_0x2538de[_0xf9ae('0x37')]=_[_0xf9ae('0x38')](_0x2538de[_0xf9ae('0x34')],_0x2538de[_0xf9ae('0x36')]);_0x5f0aaf['attributes']=_[_0xf9ae('0x38')](_0x2538de[_0xf9ae('0x34')],qs['fields'](_0x171095[_0xf9ae('0x36')]['fields']));_0x5f0aaf[_0xf9ae('0x39')]=_0x5f0aaf[_0xf9ae('0x39')][_0xf9ae('0x3a')]?_0x5f0aaf[_0xf9ae('0x39')]:_0x2538de['model'];if(!_0x171095[_0xf9ae('0x36')][_0xf9ae('0x3b')](_0xf9ae('0x3c'))){_0x5f0aaf['limit']=qs[_0xf9ae('0x22')](_0x171095[_0xf9ae('0x36')]['limit']);_0x5f0aaf[_0xf9ae('0x21')]=qs['offset'](_0x171095[_0xf9ae('0x36')]['offset']);}_0x5f0aaf[_0xf9ae('0x3d')]=qs[_0xf9ae('0x3e')](_0x171095['query']['sort']);_0x5f0aaf[_0xf9ae('0x3f')]=qs[_0xf9ae('0x37')](_[_0xf9ae('0x40')](_0x171095[_0xf9ae('0x36')],_0x2538de[_0xf9ae('0x37')]));if(_0x171095[_0xf9ae('0x36')][_0xf9ae('0x41')]){_0x5f0aaf[_0xf9ae('0x3f')]=_[_0xf9ae('0x42')](_0x5f0aaf[_0xf9ae('0x3f')],{'$or':_[_0xf9ae('0x43')](_0x5f0aaf[_0xf9ae('0x39')],function(_0x919b7a){var _0x828548={};_0x828548[_0x919b7a]={'$like':'%'+_0x171095[_0xf9ae('0x36')][_0xf9ae('0x41')]+'%'};return _0x828548;})});}_0x5f0aaf=_['merge']({},_0x5f0aaf,_0x171095['options']);var _0x33b19b={'where':_0x5f0aaf[_0xf9ae('0x3f')]};return db['CmCompany'][_0xf9ae('0x20')](_0x33b19b)[_0xf9ae('0x28')](function(_0x20ec22){_0x12bf0d[_0xf9ae('0x20')]=_0x20ec22;if(_0x171095[_0xf9ae('0x36')][_0xf9ae('0x44')]){_0x5f0aaf['include']=[{'all':!![]}];}return db[_0xf9ae('0x32')][_0xf9ae('0x45')](_0x5f0aaf);})[_0xf9ae('0x28')](function(_0x13a82c){_0x12bf0d[_0xf9ae('0x46')]=_0x13a82c;return _0x12bf0d;})[_0xf9ae('0x28')](respondWithFilteredResult(_0x17607d,_0x5f0aaf))['catch'](handleError(_0x17607d,null));})[_0xf9ae('0x47')](handleError(_0x17607d,null));};exports[_0xf9ae('0x48')]=function(_0x38172e,_0x40085a){var _0xef39b5={'raw':![],'where':{'id':_0x38172e[_0xf9ae('0x49')]['id']}},_0x2e2802={};_0x2e2802[_0xf9ae('0x34')]=_[_0xf9ae('0x35')](db[_0xf9ae('0x32')][_0xf9ae('0x4a')]);_0x2e2802['query']=_[_0xf9ae('0x35')](_0x38172e[_0xf9ae('0x36')]);_0x2e2802[_0xf9ae('0x37')]=_['intersection'](_0x2e2802[_0xf9ae('0x34')],_0x2e2802['query']);_0xef39b5[_0xf9ae('0x39')]=_[_0xf9ae('0x38')](_0x2e2802[_0xf9ae('0x34')],qs[_0xf9ae('0x4b')](_0x38172e[_0xf9ae('0x36')]['fields']));_0xef39b5['attributes']=_0xef39b5[_0xf9ae('0x39')][_0xf9ae('0x3a')]?_0xef39b5[_0xf9ae('0x39')]:_0x2e2802[_0xf9ae('0x34')];if(_0x38172e[_0xf9ae('0x36')][_0xf9ae('0x44')]){_0xef39b5[_0xf9ae('0x4c')]=[{'all':!![]}];}_0xef39b5=_[_0xf9ae('0x42')]({},_0xef39b5,_0x38172e['options']);return db[_0xf9ae('0x32')][_0xf9ae('0x4d')](_0xef39b5)[_0xf9ae('0x28')](handleEntityNotFound(_0x40085a,null))[_0xf9ae('0x28')](respondWithResult(_0x40085a,null))[_0xf9ae('0x47')](handleError(_0x40085a,null));};exports[_0xf9ae('0x4e')]=function(_0x3d41ba,_0x32637b){return db[_0xf9ae('0x32')][_0xf9ae('0x4e')](_0x3d41ba[_0xf9ae('0x4f')],{})['then'](function(_0x1586b4){var _0x4b01e0=_0x3d41ba[_0xf9ae('0x50')]['get']({'plain':!![]});if(!_0x4b01e0)throw new Error(_0xf9ae('0x51'));if(_0x4b01e0[_0xf9ae('0x52')]===_0xf9ae('0x50')){var _0x23ff2f=_0x1586b4[_0xf9ae('0x29')]({'plain':!![]});var _0x566f6d=_0xf9ae('0x2a');return db[_0xf9ae('0x53')]['find']({'where':{'name':_0x566f6d,'userProfileId':_0x4b01e0[_0xf9ae('0x54')]},'raw':!![]})[_0xf9ae('0x28')](function(_0x53b338){if(_0x53b338&&_0x53b338['autoAssociation']===0x0){return db[_0xf9ae('0x2b')][_0xf9ae('0x4e')]({'name':_0x23ff2f['name'],'resourceId':_0x23ff2f['id'],'type':_0x53b338['name'],'sectionId':_0x53b338['id']},{})[_0xf9ae('0x28')](function(){return _0x1586b4;});}else{return _0x1586b4;}})['catch'](function(_0x43c3f3){logger[_0xf9ae('0x2d')](_0xf9ae('0x55'),_0x43c3f3);throw _0x43c3f3;});}return _0x1586b4;})[_0xf9ae('0x28')](respondWithResult(_0x32637b,0xc9))['catch'](handleError(_0x32637b,null));};exports['update']=function(_0x366de4,_0x5d5369){if(_0x366de4[_0xf9ae('0x4f')]['id']){delete _0x366de4[_0xf9ae('0x4f')]['id'];}return db[_0xf9ae('0x32')]['find']({'where':{'id':_0x366de4['params']['id']}})[_0xf9ae('0x28')](handleEntityNotFound(_0x5d5369,null))[_0xf9ae('0x28')](saveUpdates(_0x366de4[_0xf9ae('0x4f')],null))['then'](respondWithResult(_0x5d5369,null))[_0xf9ae('0x47')](handleError(_0x5d5369,null));};exports[_0xf9ae('0x2c')]=function(_0x3311ee,_0x18b760){return db[_0xf9ae('0x32')][_0xf9ae('0x4d')]({'where':{'id':_0x3311ee[_0xf9ae('0x49')]['id']}})[_0xf9ae('0x28')](handleEntityNotFound(_0x18b760,null))['then'](removeEntity(_0x18b760,null))[_0xf9ae('0x47')](handleError(_0x18b760,null));};exports[_0xf9ae('0x33')]=function(_0x44fca6,_0x1b8fa1){return db['CmCompany'][_0xf9ae('0x33')]()['then'](respondWithResult(_0x1b8fa1,null))[_0xf9ae('0x47')](handleError(_0x1b8fa1,null));};exports['addContacts']=function(_0x5423dd,_0x177c3f,_0x2f692e){return db['CmContact']['find']({'where':{'id':_0x5423dd[_0xf9ae('0x49')]['id']}})[_0xf9ae('0x28')](handleEntityNotFound(_0x177c3f,null))[_0xf9ae('0x28')](function(_0x4c596a){if(_0x4c596a){return _0x4c596a[_0xf9ae('0x56')](_0x5423dd['body'][_0xf9ae('0x57')],_[_0xf9ae('0x58')](_0x5423dd[_0xf9ae('0x4f')],[_0xf9ae('0x57'),'id'])||{});}})[_0xf9ae('0x28')](respondWithResult(_0x177c3f,null))[_0xf9ae('0x47')](handleError(_0x177c3f,null));};exports[_0xf9ae('0x59')]=function(_0xcaee83,_0x2d498d,_0x2bf201){var _0x48eb56={};var _0x43bb6b={};var _0x571b7b;var _0x2f383a;return db['CmCompany'][_0xf9ae('0x5a')]({'where':{'id':_0xcaee83[_0xf9ae('0x49')]['id']}})[_0xf9ae('0x28')](handleEntityNotFound(_0x2d498d,null))[_0xf9ae('0x28')](function(_0x4e5ff2){if(_0x4e5ff2){_0x571b7b=_0x4e5ff2;_0x43bb6b[_0xf9ae('0x34')]=_['keys'](db[_0xf9ae('0x5b')][_0xf9ae('0x4a')]);_0x43bb6b[_0xf9ae('0x36')]=_[_0xf9ae('0x35')](_0xcaee83[_0xf9ae('0x36')]);_0x43bb6b['filters']=_[_0xf9ae('0x38')](_0x43bb6b[_0xf9ae('0x34')],_0x43bb6b['query']);_0x48eb56[_0xf9ae('0x39')]=_[_0xf9ae('0x38')](_0x43bb6b[_0xf9ae('0x34')],qs['fields'](_0xcaee83[_0xf9ae('0x36')][_0xf9ae('0x4b')]));_0x48eb56[_0xf9ae('0x39')]=_0x48eb56[_0xf9ae('0x39')]['length']?_0x48eb56[_0xf9ae('0x39')]:_0x43bb6b[_0xf9ae('0x34')];_0x48eb56['order']=qs[_0xf9ae('0x3e')](_0xcaee83['query'][_0xf9ae('0x3e')]);_0x48eb56[_0xf9ae('0x3f')]=qs[_0xf9ae('0x37')](_[_0xf9ae('0x40')](_0xcaee83['query'],_0x43bb6b[_0xf9ae('0x37')]));if(_0xcaee83['query']['filter']){_0x48eb56[_0xf9ae('0x3f')]=_[_0xf9ae('0x42')](_0x48eb56[_0xf9ae('0x3f')],{'$or':_[_0xf9ae('0x43')](_0x48eb56[_0xf9ae('0x39')],function(_0x2874d4){var _0x183875={};_0x183875[_0x2874d4]={'$like':'%'+_0xcaee83['query']['filter']+'%'};return _0x183875;})});}_0x48eb56=_['merge']({},_0x48eb56,_0xcaee83[_0xf9ae('0x5c')]);return _0x571b7b[_0xf9ae('0x59')](_0x48eb56);}})[_0xf9ae('0x28')](function(_0x252ccf){if(_0x252ccf){_0x2f383a=_0x252ccf[_0xf9ae('0x3a')];if(!_0xcaee83[_0xf9ae('0x36')][_0xf9ae('0x3b')](_0xf9ae('0x3c'))){_0x48eb56[_0xf9ae('0x22')]=qs[_0xf9ae('0x22')](_0xcaee83[_0xf9ae('0x36')][_0xf9ae('0x22')]);_0x48eb56[_0xf9ae('0x21')]=qs[_0xf9ae('0x21')](_0xcaee83['query'][_0xf9ae('0x21')]);}return _0x571b7b[_0xf9ae('0x59')](_0x48eb56);}})[_0xf9ae('0x28')](function(_0x53e78b){if(_0x53e78b){return _0x53e78b?{'count':_0x2f383a,'rows':_0x53e78b}:null;}})['then'](respondWithResult(_0x2d498d,null))[_0xf9ae('0x47')](handleError(_0x2d498d,null));}; \ No newline at end of file +var _0xebb0=['options','includeAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Companies','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','ids','getContacts','rawAttributes','order','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','save','update','then','destroy','get','UserProfileResource','error','name','send','index','CmCompany','describe','keys','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','map','merge'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xebb0,0x1ab));var _0x0ebb=function(_0x56b540,_0x37f450){_0x56b540=_0x56b540-0x0;var _0xf62ffc=_0xebb0[_0x56b540];return _0xf62ffc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0ebb('0x0'));var rimraf=require(_0x0ebb('0x1'));var zipdir=require(_0x0ebb('0x2'));var jsonpatch=require(_0x0ebb('0x3'));var rp=require(_0x0ebb('0x4'));var moment=require(_0x0ebb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0ebb('0x6'));var util=require('util');var path=require(_0x0ebb('0x7'));var sox=require(_0x0ebb('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x0ebb('0x9'));var squel=require(_0x0ebb('0xa'));var crypto=require(_0x0ebb('0xb'));var jsforce=require(_0x0ebb('0xc'));var deskjs=require(_0x0ebb('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0ebb('0xe'));var Redis=require(_0x0ebb('0xf'));var authService=require(_0x0ebb('0x10'));var qs=require(_0x0ebb('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0ebb('0x12'));var logger=require(_0x0ebb('0x13'))(_0x0ebb('0x14'));var utils=require(_0x0ebb('0x15'));var config=require('../../config/environment');var db=require(_0x0ebb('0x16'))['db'];function respondWithStatusCode(_0x478154,_0x10445f){_0x10445f=_0x10445f||0xcc;return function(_0x44ea2e){if(_0x44ea2e){return _0x478154[_0x0ebb('0x17')](_0x10445f);}return _0x478154[_0x0ebb('0x18')](_0x10445f)[_0x0ebb('0x19')]();};}function respondWithResult(_0x245e5b,_0x1a68ce){_0x1a68ce=_0x1a68ce||0xc8;return function(_0x2519ba){if(_0x2519ba){return _0x245e5b[_0x0ebb('0x18')](_0x1a68ce)[_0x0ebb('0x1a')](_0x2519ba);}};}function respondWithFilteredResult(_0xdc7fe6,_0xc76672){return function(_0x24d9ad){if(_0x24d9ad){var _0x2bef30=_0x24d9ad[_0x0ebb('0x1b')],_0x53dec0=_0xc76672[_0x0ebb('0x1c')],_0x2c9cf3=_0xc76672[_0x0ebb('0x1c')]+_0xc76672['limit'],_0x5b6bbb;if(_0x2c9cf3>=_0x2bef30){_0x2c9cf3=_0x2bef30;_0x5b6bbb=0xc8;}else{_0x5b6bbb=0xce;}_0xdc7fe6['status'](_0x5b6bbb);return _0xdc7fe6[_0x0ebb('0x1d')]('Content-Range',_0x53dec0+'-'+_0x2c9cf3+'/'+_0x2bef30)[_0x0ebb('0x1a')](_0x24d9ad);}return null;};}function patchUpdates(_0x31197b){return function(_0x37e965){try{jsonpatch[_0x0ebb('0x1e')](_0x37e965,_0x31197b,!![]);}catch(_0x44000a){return BPromise['reject'](_0x44000a);}return _0x37e965[_0x0ebb('0x1f')]();};}function saveUpdates(_0x24916c,_0xfc7f49){return function(_0x13fc0e){if(_0x13fc0e){return _0x13fc0e[_0x0ebb('0x20')](_0x24916c)[_0x0ebb('0x21')](function(_0x1255b8){return _0x1255b8;});}return null;};}function removeEntity(_0x4cf645,_0x4a9c89){return function(_0x3c74c1){if(_0x3c74c1){return _0x3c74c1[_0x0ebb('0x22')]()[_0x0ebb('0x21')](function(){var _0x3669df=_0x3c74c1[_0x0ebb('0x23')]({'plain':!![]});var _0x1c0d6d='Companies';return db[_0x0ebb('0x24')][_0x0ebb('0x22')]({'where':{'type':_0x1c0d6d,'resourceId':_0x3669df['id']}})[_0x0ebb('0x21')](function(){return _0x3c74c1;});})[_0x0ebb('0x21')](function(){_0x4cf645['status'](0xcc)[_0x0ebb('0x19')]();});}};}function handleEntityNotFound(_0x5bd7b4,_0x3e7922){return function(_0x396575){if(!_0x396575){_0x5bd7b4[_0x0ebb('0x17')](0x194);}return _0x396575;};}function handleError(_0x54af8d,_0x2753e9){_0x2753e9=_0x2753e9||0x1f4;return function(_0x5bce5b){logger[_0x0ebb('0x25')](_0x5bce5b['stack']);if(_0x5bce5b[_0x0ebb('0x26')]){delete _0x5bce5b[_0x0ebb('0x26')];}_0x54af8d['status'](_0x2753e9)[_0x0ebb('0x27')](_0x5bce5b);};}exports[_0x0ebb('0x28')]=function(_0x44f3b5,_0x2d34e1){var _0x1ff264={},_0x5bd6cd={},_0x3f1160={'count':0x0,'rows':[]};return db[_0x0ebb('0x29')][_0x0ebb('0x2a')]()[_0x0ebb('0x21')](function(_0x552b79){_0x5bd6cd['model']=_['keys'](_0x552b79);_0x5bd6cd['query']=_[_0x0ebb('0x2b')](_0x44f3b5[_0x0ebb('0x2c')]);_0x5bd6cd[_0x0ebb('0x2d')]=_['intersection'](_0x5bd6cd[_0x0ebb('0x2e')],_0x5bd6cd['query']);_0x1ff264[_0x0ebb('0x2f')]=_[_0x0ebb('0x30')](_0x5bd6cd[_0x0ebb('0x2e')],qs[_0x0ebb('0x31')](_0x44f3b5[_0x0ebb('0x2c')]['fields']));_0x1ff264[_0x0ebb('0x2f')]=_0x1ff264[_0x0ebb('0x2f')]['length']?_0x1ff264[_0x0ebb('0x2f')]:_0x5bd6cd[_0x0ebb('0x2e')];if(!_0x44f3b5[_0x0ebb('0x2c')][_0x0ebb('0x32')](_0x0ebb('0x33'))){_0x1ff264['limit']=qs[_0x0ebb('0x34')](_0x44f3b5['query'][_0x0ebb('0x34')]);_0x1ff264[_0x0ebb('0x1c')]=qs[_0x0ebb('0x1c')](_0x44f3b5[_0x0ebb('0x2c')]['offset']);}_0x1ff264['order']=qs[_0x0ebb('0x35')](_0x44f3b5[_0x0ebb('0x2c')][_0x0ebb('0x35')]);_0x1ff264[_0x0ebb('0x36')]=qs[_0x0ebb('0x2d')](_[_0x0ebb('0x37')](_0x44f3b5[_0x0ebb('0x2c')],_0x5bd6cd[_0x0ebb('0x2d')]));if(_0x44f3b5[_0x0ebb('0x2c')][_0x0ebb('0x38')]){_0x1ff264[_0x0ebb('0x36')]=_['merge'](_0x1ff264[_0x0ebb('0x36')],{'$or':_[_0x0ebb('0x39')](_0x1ff264[_0x0ebb('0x2f')],function(_0xb77d0c){var _0x53bd4d={};_0x53bd4d[_0xb77d0c]={'$like':'%'+_0x44f3b5['query'][_0x0ebb('0x38')]+'%'};return _0x53bd4d;})});}_0x1ff264=_[_0x0ebb('0x3a')]({},_0x1ff264,_0x44f3b5[_0x0ebb('0x3b')]);var _0x1a0fea={'where':_0x1ff264[_0x0ebb('0x36')]};return db[_0x0ebb('0x29')][_0x0ebb('0x1b')](_0x1a0fea)[_0x0ebb('0x21')](function(_0x46e58e){_0x3f1160[_0x0ebb('0x1b')]=_0x46e58e;if(_0x44f3b5['query'][_0x0ebb('0x3c')]){_0x1ff264['include']=[{'all':!![]}];}return db[_0x0ebb('0x29')]['findAll'](_0x1ff264);})['then'](function(_0xecc280){_0x3f1160[_0x0ebb('0x3d')]=_0xecc280;return _0x3f1160;})['then'](respondWithFilteredResult(_0x2d34e1,_0x1ff264))[_0x0ebb('0x3e')](handleError(_0x2d34e1,null));})[_0x0ebb('0x3e')](handleError(_0x2d34e1,null));};exports[_0x0ebb('0x3f')]=function(_0x22c6df,_0x2ff372){var _0x302ae0={'raw':![],'where':{'id':_0x22c6df[_0x0ebb('0x40')]['id']}},_0x359cac={};_0x359cac[_0x0ebb('0x2e')]=_[_0x0ebb('0x2b')](db[_0x0ebb('0x29')]['rawAttributes']);_0x359cac['query']=_[_0x0ebb('0x2b')](_0x22c6df[_0x0ebb('0x2c')]);_0x359cac['filters']=_[_0x0ebb('0x30')](_0x359cac[_0x0ebb('0x2e')],_0x359cac['query']);_0x302ae0[_0x0ebb('0x2f')]=_[_0x0ebb('0x30')](_0x359cac[_0x0ebb('0x2e')],qs[_0x0ebb('0x31')](_0x22c6df[_0x0ebb('0x2c')][_0x0ebb('0x31')]));_0x302ae0['attributes']=_0x302ae0[_0x0ebb('0x2f')]['length']?_0x302ae0['attributes']:_0x359cac[_0x0ebb('0x2e')];if(_0x22c6df['query'][_0x0ebb('0x3c')]){_0x302ae0[_0x0ebb('0x41')]=[{'all':!![]}];}_0x302ae0=_['merge']({},_0x302ae0,_0x22c6df['options']);return db[_0x0ebb('0x29')][_0x0ebb('0x42')](_0x302ae0)[_0x0ebb('0x21')](handleEntityNotFound(_0x2ff372,null))[_0x0ebb('0x21')](respondWithResult(_0x2ff372,null))[_0x0ebb('0x3e')](handleError(_0x2ff372,null));};exports[_0x0ebb('0x43')]=function(_0x162d2b,_0x42b1bb){return db['CmCompany']['create'](_0x162d2b[_0x0ebb('0x44')],{})[_0x0ebb('0x21')](function(_0x2311ac){var _0x47938e=_0x162d2b[_0x0ebb('0x45')][_0x0ebb('0x23')]({'plain':!![]});if(!_0x47938e)throw new Error(_0x0ebb('0x46'));if(_0x47938e['role']===_0x0ebb('0x45')){var _0x3e1c55=_0x2311ac[_0x0ebb('0x23')]({'plain':!![]});var _0x433e7b=_0x0ebb('0x47');return db[_0x0ebb('0x48')][_0x0ebb('0x42')]({'where':{'name':_0x433e7b,'userProfileId':_0x47938e[_0x0ebb('0x49')]},'raw':!![]})['then'](function(_0x4a1a59){if(_0x4a1a59&&_0x4a1a59['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x3e1c55[_0x0ebb('0x26')],'resourceId':_0x3e1c55['id'],'type':_0x4a1a59[_0x0ebb('0x26')],'sectionId':_0x4a1a59['id']},{})[_0x0ebb('0x21')](function(){return _0x2311ac;});}else{return _0x2311ac;}})[_0x0ebb('0x3e')](function(_0x40ac1a){logger['error'](_0x0ebb('0x4a'),_0x40ac1a);throw _0x40ac1a;});}return _0x2311ac;})[_0x0ebb('0x21')](respondWithResult(_0x42b1bb,0xc9))[_0x0ebb('0x3e')](handleError(_0x42b1bb,null));};exports[_0x0ebb('0x20')]=function(_0x48721d,_0x4c1a93){if(_0x48721d[_0x0ebb('0x44')]['id']){delete _0x48721d[_0x0ebb('0x44')]['id'];}return db[_0x0ebb('0x29')][_0x0ebb('0x42')]({'where':{'id':_0x48721d[_0x0ebb('0x40')]['id']}})[_0x0ebb('0x21')](handleEntityNotFound(_0x4c1a93,null))['then'](saveUpdates(_0x48721d[_0x0ebb('0x44')],null))[_0x0ebb('0x21')](respondWithResult(_0x4c1a93,null))[_0x0ebb('0x3e')](handleError(_0x4c1a93,null));};exports[_0x0ebb('0x22')]=function(_0x485cd5,_0x1a7274){return db['CmCompany'][_0x0ebb('0x42')]({'where':{'id':_0x485cd5[_0x0ebb('0x40')]['id']}})[_0x0ebb('0x21')](handleEntityNotFound(_0x1a7274,null))['then'](removeEntity(_0x1a7274,null))['catch'](handleError(_0x1a7274,null));};exports[_0x0ebb('0x2a')]=function(_0x5de26e,_0x49356f){return db[_0x0ebb('0x29')][_0x0ebb('0x2a')]()[_0x0ebb('0x21')](respondWithResult(_0x49356f,null))['catch'](handleError(_0x49356f,null));};exports[_0x0ebb('0x4b')]=function(_0x5c5ba0,_0x474238,_0xb9f74b){return db[_0x0ebb('0x4c')][_0x0ebb('0x42')]({'where':{'id':_0x5c5ba0[_0x0ebb('0x40')]['id']}})[_0x0ebb('0x21')](handleEntityNotFound(_0x474238,null))[_0x0ebb('0x21')](function(_0x5ac0d5){if(_0x5ac0d5){return _0x5ac0d5[_0x0ebb('0x4b')](_0x5c5ba0[_0x0ebb('0x44')][_0x0ebb('0x4d')],_['omit'](_0x5c5ba0[_0x0ebb('0x44')],['ids','id'])||{});}})[_0x0ebb('0x21')](respondWithResult(_0x474238,null))['catch'](handleError(_0x474238,null));};exports[_0x0ebb('0x4e')]=function(_0x1d0836,_0x5d4ef5,_0x355ca1){var _0x58a18f={};var _0x3343b5={};var _0x205b1d;var _0xd78a37;return db[_0x0ebb('0x29')]['findOne']({'where':{'id':_0x1d0836[_0x0ebb('0x40')]['id']}})['then'](handleEntityNotFound(_0x5d4ef5,null))[_0x0ebb('0x21')](function(_0x7545c1){if(_0x7545c1){_0x205b1d=_0x7545c1;_0x3343b5[_0x0ebb('0x2e')]=_[_0x0ebb('0x2b')](db[_0x0ebb('0x4c')][_0x0ebb('0x4f')]);_0x3343b5[_0x0ebb('0x2c')]=_[_0x0ebb('0x2b')](_0x1d0836[_0x0ebb('0x2c')]);_0x3343b5[_0x0ebb('0x2d')]=_['intersection'](_0x3343b5[_0x0ebb('0x2e')],_0x3343b5[_0x0ebb('0x2c')]);_0x58a18f[_0x0ebb('0x2f')]=_[_0x0ebb('0x30')](_0x3343b5[_0x0ebb('0x2e')],qs[_0x0ebb('0x31')](_0x1d0836[_0x0ebb('0x2c')][_0x0ebb('0x31')]));_0x58a18f[_0x0ebb('0x2f')]=_0x58a18f[_0x0ebb('0x2f')]['length']?_0x58a18f[_0x0ebb('0x2f')]:_0x3343b5[_0x0ebb('0x2e')];_0x58a18f[_0x0ebb('0x50')]=qs[_0x0ebb('0x35')](_0x1d0836[_0x0ebb('0x2c')][_0x0ebb('0x35')]);_0x58a18f[_0x0ebb('0x36')]=qs['filters'](_[_0x0ebb('0x37')](_0x1d0836[_0x0ebb('0x2c')],_0x3343b5[_0x0ebb('0x2d')]));if(_0x1d0836[_0x0ebb('0x2c')][_0x0ebb('0x38')]){_0x58a18f[_0x0ebb('0x36')]=_['merge'](_0x58a18f[_0x0ebb('0x36')],{'$or':_[_0x0ebb('0x39')](_0x58a18f[_0x0ebb('0x2f')],function(_0x504e6e){var _0x97bd1a={};_0x97bd1a[_0x504e6e]={'$like':'%'+_0x1d0836[_0x0ebb('0x2c')][_0x0ebb('0x38')]+'%'};return _0x97bd1a;})});}_0x58a18f=_['merge']({},_0x58a18f,_0x1d0836[_0x0ebb('0x3b')]);return _0x205b1d[_0x0ebb('0x4e')](_0x58a18f);}})[_0x0ebb('0x21')](function(_0x41b39e){if(_0x41b39e){_0xd78a37=_0x41b39e['length'];if(!_0x1d0836[_0x0ebb('0x2c')][_0x0ebb('0x32')](_0x0ebb('0x33'))){_0x58a18f['limit']=qs[_0x0ebb('0x34')](_0x1d0836[_0x0ebb('0x2c')]['limit']);_0x58a18f['offset']=qs[_0x0ebb('0x1c')](_0x1d0836[_0x0ebb('0x2c')]['offset']);}return _0x205b1d[_0x0ebb('0x4e')](_0x58a18f);}})[_0x0ebb('0x21')](function(_0x3b0e12){if(_0x3b0e12){return _0x3b0e12?{'count':_0xd78a37,'rows':_0x3b0e12}:null;}})['then'](respondWithResult(_0x5d4ef5,null))[_0x0ebb('0x3e')](handleError(_0x5d4ef5,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index a60520d..ec68889 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 _0xe015=['lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./cmCompany.attributes','cm_companies'];(function(_0x23811e,_0x425f5f){var _0x350280=function(_0x1f8d16){while(--_0x1f8d16){_0x23811e['push'](_0x23811e['shift']());}};_0x350280(++_0x425f5f);}(_0xe015,0x13b));var _0x5e01=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xe015[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x5e01('0x0'));var util=require(_0x5e01('0x1'));var logger=require(_0x5e01('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5e01('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5e01('0x4'));var rimraf=require(_0x5e01('0x5'));var config=require(_0x5e01('0x6'));var attributes=require(_0x5e01('0x7'));module['exports']=function(_0x1814cb,_0x3d2da2){return _0x1814cb['define']('CmCompany',attributes,{'tableName':_0x5e01('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e17=['exports','define','CmCompany','cm_companies','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes'];(function(_0x545a3a,_0x3123aa){var _0x5a5493=function(_0x4e6bce){while(--_0x4e6bce){_0x545a3a['push'](_0x545a3a['shift']());}};_0x5a5493(++_0x3123aa);}(_0x0e17,0xd6));var _0x70e1=function(_0x4fc5bd,_0x13cbdb){_0x4fc5bd=_0x4fc5bd-0x0;var _0x5f35d7=_0x0e17[_0x4fc5bd];return _0x5f35d7;};'use strict';var _=require(_0x70e1('0x0'));var util=require(_0x70e1('0x1'));var logger=require(_0x70e1('0x2'))(_0x70e1('0x3'));var moment=require(_0x70e1('0x4'));var BPromise=require(_0x70e1('0x5'));var rp=require(_0x70e1('0x6'));var fs=require('fs');var path=require(_0x70e1('0x7'));var rimraf=require(_0x70e1('0x8'));var config=require(_0x70e1('0x9'));var attributes=require(_0x70e1('0xa'));module[_0x70e1('0xb')]=function(_0x4cb0b1,_0xc64213){return _0x4cb0b1[_0x70e1('0xc')](_0x70e1('0xd'),attributes,{'tableName':_0x70e1('0xe'),'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 11331fa..d04e235 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 _0x36fd=['CmCompany,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x411270,_0x28df20){var _0x2dd9a7=function(_0x3454e2){while(--_0x3454e2){_0x411270['push'](_0x411270['shift']());}};_0x2dd9a7(++_0x28df20);}(_0x36fd,0x11a));var _0xd36f=function(_0x651702,_0x5ad06c){_0x651702=_0x651702-0x0;var _0x55209a=_0x36fd[_0x651702];return _0x55209a;};'use strict';var _=require(_0xd36f('0x0'));var util=require(_0xd36f('0x1'));var moment=require(_0xd36f('0x2'));var BPromise=require(_0xd36f('0x3'));var rs=require(_0xd36f('0x4'));var fs=require('fs');var Redis=require(_0xd36f('0x5'));var db=require(_0xd36f('0x6'))['db'];var utils=require(_0xd36f('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xd36f('0x8'));var jayson=require(_0xd36f('0x9'));var client=jayson[_0xd36f('0xa')][_0xd36f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x458d6c,_0x358525,_0x89b96c){return new BPromise(function(_0x3a98d9,_0x2cf251){return client[_0xd36f('0xc')](_0x458d6c,_0x89b96c)['then'](function(_0xa6f340){logger[_0xd36f('0xd')](_0xd36f('0xe'),_0x358525,_0xd36f('0xf'));logger[_0xd36f('0x10')](_0xd36f('0x11'),_0x358525,'request\x20sent',JSON['stringify'](_0xa6f340));if(_0xa6f340[_0xd36f('0x12')]){if(_0xa6f340[_0xd36f('0x12')][_0xd36f('0x13')]===0x1f4){logger[_0xd36f('0x12')](_0xd36f('0xe'),_0x358525,_0xa6f340['error'][_0xd36f('0x14')]);return _0x2cf251(_0xa6f340['error']['message']);}logger['error'](_0xd36f('0xe'),_0x358525,_0xa6f340[_0xd36f('0x12')][_0xd36f('0x14')]);return _0x3a98d9(_0xa6f340[_0xd36f('0x12')]['message']);}else{logger[_0xd36f('0xd')](_0xd36f('0xe'),_0x358525,_0xd36f('0xf'));_0x3a98d9(_0xa6f340[_0xd36f('0x15')]['message']);}})[_0xd36f('0x16')](function(_0x1068de){logger[_0xd36f('0x12')](_0xd36f('0xe'),_0x358525,_0x1068de);_0x2cf251(_0x1068de);});});} \ No newline at end of file +var _0xb85a=['CmCompany,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','CmCompany,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1f1c98,_0x132e98){var _0x5ee779=function(_0x38e5ce){while(--_0x38e5ce){_0x1f1c98['push'](_0x1f1c98['shift']());}};_0x5ee779(++_0x132e98);}(_0xb85a,0x1ea));var _0xab85=function(_0x1499ed,_0x31884c){_0x1499ed=_0x1499ed-0x0;var _0x821a34=_0xb85a[_0x1499ed];return _0x821a34;};'use strict';var _=require(_0xab85('0x0'));var util=require(_0xab85('0x1'));var moment=require(_0xab85('0x2'));var BPromise=require('bluebird');var rs=require(_0xab85('0x3'));var fs=require('fs');var Redis=require(_0xab85('0x4'));var db=require(_0xab85('0x5'))['db'];var utils=require(_0xab85('0x6'));var logger=require(_0xab85('0x7'))(_0xab85('0x8'));var config=require(_0xab85('0x9'));var jayson=require(_0xab85('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x10e0c3,_0x1fec07,_0x3a768b){return new BPromise(function(_0x9b717d,_0x2a876b){return client[_0xab85('0xb')](_0x10e0c3,_0x3a768b)[_0xab85('0xc')](function(_0x52d9ae){logger['info'](_0xab85('0xd'),_0x1fec07,_0xab85('0xe'));logger[_0xab85('0xf')](_0xab85('0x10'),_0x1fec07,_0xab85('0xe'),JSON['stringify'](_0x52d9ae));if(_0x52d9ae[_0xab85('0x11')]){if(_0x52d9ae[_0xab85('0x11')][_0xab85('0x12')]===0x1f4){logger[_0xab85('0x11')](_0xab85('0xd'),_0x1fec07,_0x52d9ae[_0xab85('0x11')][_0xab85('0x13')]);return _0x2a876b(_0x52d9ae[_0xab85('0x11')][_0xab85('0x13')]);}logger['error'](_0xab85('0xd'),_0x1fec07,_0x52d9ae[_0xab85('0x11')][_0xab85('0x13')]);return _0x9b717d(_0x52d9ae[_0xab85('0x11')][_0xab85('0x13')]);}else{logger[_0xab85('0x14')]('CmCompany,\x20%s,\x20%s',_0x1fec07,_0xab85('0xe'));_0x9b717d(_0x52d9ae['result']['message']);}})[_0xab85('0x15')](function(_0x1bff44){logger[_0xab85('0x11')](_0xab85('0xd'),_0x1fec07,_0x1bff44);_0x2a876b(_0x1bff44);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 2c5387e..42532e1 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 _0xc1c6=['multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe','/:id','show','getContacts','post','/:id/contacts','put','delete','destroy','exports'];(function(_0x4e7ce4,_0x1ee13c){var _0x431441=function(_0x58e3e5){while(--_0x58e3e5){_0x4e7ce4['push'](_0x4e7ce4['shift']());}};_0x431441(++_0x1ee13c);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x6a3061,_0x1fefc1){_0x6a3061=_0x6a3061-0x0;var _0x4c9dd9=_0xc1c6[_0x6a3061];return _0x4c9dd9;};'use strict';var multer=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var path=require(_0x6c1c('0x2'));var timeout=require('connect-timeout');var express=require(_0x6c1c('0x3'));var router=express['Router']();var auth=require(_0x6c1c('0x4'));var interaction=require(_0x6c1c('0x5'));var config=require(_0x6c1c('0x6'));var controller=require('./cmCompany.controller');router['get']('/',auth[_0x6c1c('0x7')](),controller['index']);router[_0x6c1c('0x8')]('/describe',auth[_0x6c1c('0x7')](),controller[_0x6c1c('0x9')]);router[_0x6c1c('0x8')](_0x6c1c('0xa'),auth['isAuthenticated'](),controller[_0x6c1c('0xb')]);router[_0x6c1c('0x8')]('/:id/contacts',auth[_0x6c1c('0x7')](),controller[_0x6c1c('0xc')]);router[_0x6c1c('0xd')]('/',auth[_0x6c1c('0x7')](),controller['create']);router[_0x6c1c('0xd')](_0x6c1c('0xe'),auth[_0x6c1c('0x7')](),controller['addContacts']);router[_0x6c1c('0xf')](_0x6c1c('0xa'),auth[_0x6c1c('0x7')](),controller['update']);router[_0x6c1c('0x10')]('/:id',auth[_0x6c1c('0x7')](),controller[_0x6c1c('0x11')]);module[_0x6c1c('0x12')]=router; \ No newline at end of file +var _0xd046=['create','post','/:id/contacts','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../config/environment','get','/describe','/:id','isAuthenticated'];(function(_0xb74b87,_0x5b85cc){var _0x18d5de=function(_0x4939b1){while(--_0x4939b1){_0xb74b87['push'](_0xb74b87['shift']());}};_0x18d5de(++_0x5b85cc);}(_0xd046,0x129));var _0x6d04=function(_0x3f7a40,_0x100323){_0x3f7a40=_0x3f7a40-0x0;var _0x3b491d=_0xd046[_0x3f7a40];return _0x3b491d;};'use strict';var multer=require('multer');var util=require(_0x6d04('0x0'));var path=require(_0x6d04('0x1'));var timeout=require(_0x6d04('0x2'));var express=require('express');var router=express[_0x6d04('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6d04('0x4'));var controller=require('./cmCompany.controller');router[_0x6d04('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6d04('0x5')](_0x6d04('0x6'),auth['isAuthenticated'](),controller['describe']);router[_0x6d04('0x5')](_0x6d04('0x7'),auth['isAuthenticated'](),controller['show']);router[_0x6d04('0x5')]('/:id/contacts',auth[_0x6d04('0x8')](),controller['getContacts']);router['post']('/',auth['isAuthenticated'](),controller[_0x6d04('0x9')]);router[_0x6d04('0xa')](_0x6d04('0xb'),auth[_0x6d04('0x8')](),controller['addContacts']);router[_0x6d04('0xc')](_0x6d04('0x7'),auth[_0x6d04('0x8')](),controller[_0x6d04('0xd')]);router[_0x6d04('0xe')](_0x6d04('0x7'),auth[_0x6d04('0x8')](),controller[_0x6d04('0xf')]);module[_0x6d04('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index e5bc245..0fd5fb8 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 _0x38ab=['STRING','INTEGER','DATE','NOW','lodash','exports'];(function(_0x210e6b,_0x13d0af){var _0x2471b4=function(_0x1c0dce){while(--_0x1c0dce){_0x210e6b['push'](_0x210e6b['shift']());}};_0x2471b4(++_0x13d0af);}(_0x38ab,0xfa));var _0xb38a=function(_0x21af3a,_0x386e1d){_0x21af3a=_0x21af3a-0x0;var _0x268a49=_0x38ab[_0x21af3a];return _0x268a49;};'use strict';var _=require(_0xb38a('0x0'));var Sequelize=require('sequelize');module[_0xb38a('0x1')]={'firstName':{'type':Sequelize[_0xb38a('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xb38a('0x2')]},'street':{'type':Sequelize[_0xb38a('0x2')]},'postalCode':{'type':Sequelize[_0xb38a('0x2')]},'city':{'type':Sequelize[_0xb38a('0x2')]},'country':{'type':Sequelize[_0xb38a('0x2')]},'dateOfBirth':{'type':Sequelize[_0xb38a('0x2')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0xb38a('0x2')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0xb38a('0x2')]},'facebook':{'type':Sequelize[_0xb38a('0x2')]},'fb_data':{'type':Sequelize[_0xb38a('0x2')]},'twitter':{'type':Sequelize[_0xb38a('0x2')]},'skype':{'type':Sequelize[_0xb38a('0x2')]},'teams':{'type':Sequelize[_0xb38a('0x2')]},'viber':{'type':Sequelize[_0xb38a('0x2')]},'line':{'type':Sequelize[_0xb38a('0x2')]},'wechat':{'type':Sequelize[_0xb38a('0x2')]},'telegram':{'type':Sequelize[_0xb38a('0x2')]},'UserId':{'type':Sequelize[_0xb38a('0x3')]},'priority':{'type':Sequelize[_0xb38a('0x3')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xb38a('0x4')],'defaultValue':Sequelize[_0xb38a('0x5')]}}; \ No newline at end of file +var _0x12b6=['exports','STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash','sequelize'];(function(_0x188d31,_0x576e87){var _0x30ed33=function(_0x15f9a5){while(--_0x15f9a5){_0x188d31['push'](_0x188d31['shift']());}};_0x30ed33(++_0x576e87);}(_0x12b6,0x1e4));var _0x612b=function(_0x3bc6ae,_0x1c6c91){_0x3bc6ae=_0x3bc6ae-0x0;var _0x48ffd8=_0x12b6[_0x3bc6ae];return _0x48ffd8;};'use strict';var _=require(_0x612b('0x0'));var Sequelize=require(_0x612b('0x1'));module[_0x612b('0x2')]={'firstName':{'type':Sequelize[_0x612b('0x3')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x612b('0x3')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x612b('0x3')]},'country':{'type':Sequelize[_0x612b('0x3')]},'dateOfBirth':{'type':Sequelize[_0x612b('0x3')]},'description':{'type':Sequelize[_0x612b('0x4')]},'phone':{'type':Sequelize[_0x612b('0x3')]},'mobile':{'type':Sequelize[_0x612b('0x3')]},'fax':{'type':Sequelize[_0x612b('0x3')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x612b('0x3')]},'facebook':{'type':Sequelize[_0x612b('0x3')]},'fb_data':{'type':Sequelize[_0x612b('0x3')]},'twitter':{'type':Sequelize[_0x612b('0x3')]},'skype':{'type':Sequelize[_0x612b('0x3')]},'teams':{'type':Sequelize[_0x612b('0x3')]},'viber':{'type':Sequelize[_0x612b('0x3')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x612b('0x3')]},'telegram':{'type':Sequelize[_0x612b('0x3')]},'UserId':{'type':Sequelize[_0x612b('0x5')]},'priority':{'type':Sequelize[_0x612b('0x5')](0x2)[_0x612b('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x612b('0x7')],'defaultValue':Sequelize[_0x612b('0x8')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index ce462aa..f84a2dd 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 _0x1dcc=['No\x20ListId\x20specified','No\x20association\x20keys\x20specified!','binding_values','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','server/files/tmp','chmodSync','child_process','fork','CompanyId','File\x20uploaded\x20correctly!','pid','upload','createReadStream','file','parse','meta','import','agent','binding','../../components/import/cm/csv2','stringify','exit','html-pdf','zip-dir','fast-json-patch','bluebird','mustache','util','path','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','startsWith','cf_','push','CmCustomField','trimStart','all','length','type','model','keys','query','attributes','intersection','fields','nolimit','where','filters','select','field','color','from','tools_tags','cm_contacts','left_join','uc.CmContactId\x20=\x20c.id','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','search','sqlOperator','conditions','find','value','split','map','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','dateOfBirth','fieldType','datetime','castTo','buildExpression','text','hasOwnProperty','filter','isNil','forEach','ListId','c.ListId\x20IN\x20?','concat','Contact','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','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.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','c.id','Sequelize','QueryTypes','SELECT','clone','DESC','t.id\x20IN\x20?','some','user','isEmpty','c.ListId\x20IS\x20NULL','sequelize','toString','count','keyBy','merge','CmContact','c.firstName','c.lastName','c.mobile','c.fax','c.deletedAt','TagIds','Tags','rows','params','describe','tags','columnName','displayName','findAll','alias','custom','values','catch','body','get','mergeWith','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','destroy','[CmContact][merge][destroy][CmHopper],\x20%s','info','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','SmsQueueReport','bulkCreate','each','duplicates','$or','spread','show','Tag','tag','$and','omit','format','cf_%d','pickBy','table','id\x20=\x20?','toParam','phone','getTags','findOne','rawAttributes','sort','pick','setTags','ids','order','ContactId','options','includeAll','getHopperHistories','include','getHopperFinals','getJscriptySessions','JscriptySessionReport','uploadCsv'];(function(_0x2bb2f5,_0x1b624c){var _0xb25642=function(_0x5b9a7b){while(--_0x5b9a7b){_0x2bb2f5['push'](_0x2bb2f5['shift']());}};_0xb25642(++_0x1b624c);}(_0x1dcc,0x10a));var _0xc1dc=function(_0x8f87ef,_0x26be33){_0x8f87ef=_0x8f87ef-0x0;var _0x179079=_0x1dcc[_0x8f87ef];return _0x179079;};'use strict';var pdf=require(_0xc1dc('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc1dc('0x1'));var jsonpatch=require(_0xc1dc('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc1dc('0x3'));var Mustache=require(_0xc1dc('0x4'));var util=require(_0xc1dc('0x5'));var path=require(_0xc1dc('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xc1dc('0x7'));var jsforce=require(_0xc1dc('0x8'));var deskjs=require(_0xc1dc('0x9'));var toCsv=require('to-csv');var querystring=require(_0xc1dc('0xa'));var Papa=require(_0xc1dc('0xb'));var Redis=require(_0xc1dc('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xc1dc('0xd'));var as=require(_0xc1dc('0xe'));var hardwareService=require(_0xc1dc('0xf'));var logger=require(_0xc1dc('0x10'))('api');var utils=require('../../config/utils');var config=require(_0xc1dc('0x11'));var db=require(_0xc1dc('0x12'))['db'];config[_0xc1dc('0x13')]=_[_0xc1dc('0x14')](config[_0xc1dc('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0xc1dc('0x15'))(new Redis(config[_0xc1dc('0x13')]));require('./cmContact.socket')[_0xc1dc('0x16')](socket);function respondWithStatusCode(_0x2f18bb,_0x25191c){_0x25191c=_0x25191c||0xcc;return function(_0x746ec4){if(_0x746ec4){return _0x2f18bb[_0xc1dc('0x17')](_0x25191c);}return _0x2f18bb[_0xc1dc('0x18')](_0x25191c)['end']();};}function respondWithResult(_0x26710c,_0x116bdc){_0x116bdc=_0x116bdc||0xc8;return function(_0x1e1745){if(_0x1e1745){return _0x26710c[_0xc1dc('0x18')](_0x116bdc)[_0xc1dc('0x19')](_0x1e1745);}};}function respondWithFilteredResult(_0x562b70,_0x134cb6){return function(_0x380573){if(_0x380573){var _0x59221e=_0x380573['count'],_0x52af53=_0x134cb6[_0xc1dc('0x1a')],_0x407856=_0x134cb6[_0xc1dc('0x1a')]+_0x134cb6[_0xc1dc('0x1b')],_0x1a662d;if(_0x407856>=_0x59221e){_0x407856=_0x59221e;_0x1a662d=0xc8;}else{_0x1a662d=0xce;}_0x562b70[_0xc1dc('0x18')](_0x1a662d);return _0x562b70[_0xc1dc('0x1c')](_0xc1dc('0x1d'),_0x52af53+'-'+_0x407856+'/'+_0x59221e)['json'](_0x380573);}return null;};}function patchUpdates(_0x4a97e0){return function(_0x2f4970){try{jsonpatch[_0xc1dc('0x1e')](_0x2f4970,_0x4a97e0,!![]);}catch(_0xcc4897){return BPromise[_0xc1dc('0x1f')](_0xcc4897);}return _0x2f4970[_0xc1dc('0x20')]();};}function saveUpdates(_0x1b03df,_0x5ecbfe){return function(_0x3e3328){if(_0x3e3328){return _0x3e3328[_0xc1dc('0x21')](_0x1b03df)[_0xc1dc('0x22')](function(_0x20cf54){return _0x20cf54;});}return null;};}function removeEntity(_0x69e848,_0x6e8dda){return function(_0xda656a){if(_0xda656a){return _0xda656a['destroy']()['then'](function(){_0x69e848[_0xc1dc('0x18')](0xcc)[_0xc1dc('0x23')]();});}};}function handleEntityNotFound(_0x399316,_0x4fe422){return function(_0x126211){if(!_0x126211){_0x399316['sendStatus'](0x194);}return _0x126211;};}function handleError(_0x1d1f0a,_0x2cda2e){_0x2cda2e=_0x2cda2e||0x1f4;return function(_0x1a759c){logger[_0xc1dc('0x24')](_0x1a759c[_0xc1dc('0x25')]);if(_0x1a759c['name']){delete _0x1a759c[_0xc1dc('0x26')];}_0x1d1f0a[_0xc1dc('0x18')](_0x2cda2e)[_0xc1dc('0x27')](_0x1a759c);};}exports[_0xc1dc('0x28')]=function(_0x582f19,_0x8007fe){var _0x2d06d2={},_0x367a75={},_0x3288d4={'count':0x0,'rows':[]};return db['CmContact']['describe']()[_0xc1dc('0x22')](function(_0x11ae26){var _0x5e8782=[];for(var _0x560397=0x0;_0x5603970x1){_0x21bf98['or'](_0xc1dc('0x61'),qs[_0xc1dc('0x62')](_0x1517e1),null);}else{if(qs[_0xc1dc('0x63')](_0x1517e1)){_0x21bf98['or'](_0xc1dc('0x64'),_0x1517e1+'%');_0x21bf98['or'](_0xc1dc('0x65'),_0x1517e1+'%');_0x21bf98['or'](_0xc1dc('0x66'),_0x1517e1+'%');_0x21bf98['or'](_0xc1dc('0x67'),_0x1517e1+'%');}else if(qs[_0xc1dc('0x68')](_0x1517e1)){_0x21bf98['or']('c.email\x20LIKE\x20?',_0x1517e1+'%');}else{_0x21bf98['or'](_0xc1dc('0x69'),'%'+_0x1517e1+'%');_0x21bf98['or'](_0xc1dc('0x6a'),'%'+_0x1517e1+'%');_0x21bf98['or'](_0xc1dc('0x6b'),'%'+_0x1517e1+'%');}}}}_0x33f73f[_0xc1dc('0x38')](_0x21bf98);_0x33f73f['group'](_0xc1dc('0x6c'));var _0x2ca0fe={'type':db[_0xc1dc('0x6d')][_0xc1dc('0x6e')][_0xc1dc('0x6f')],'raw':!![]};var _0x4eab0a=_0x33f73f[_0xc1dc('0x70')]()[_0xc1dc('0x3b')]('c.id');if(_0x2d06d2['order']){_0x2d06d2['order'][_0xc1dc('0x59')](function(_0x1cf3b6){_0x33f73f['order']('c.'+_0x1cf3b6[0x0],_0x1cf3b6[0x1]===_0xc1dc('0x71')?![]:!![]);});}if(!_['isEmpty'](_0x56e8c6)){_0x33f73f['having'](_0x3494ea);_0x4eab0a['where'](_0xc1dc('0x72'),_0x56e8c6);}BPromise['resolve']()[_0xc1dc('0x22')](function(){if(_0x28fce3&&!_[_0xc1dc('0x73')](_0x28fce3[_0xc1dc('0x47')],[_0xc1dc('0x3b'),_0xc1dc('0x4e')])){return _0x582f19[_0xc1dc('0x74')]['getLists']({'attributes':['id'],'raw':!![]})[_0xc1dc('0x22')](function(_0x59e16b){if(_[_0xc1dc('0x75')](_0x59e16b)){_0x4eab0a[_0xc1dc('0x38')]('c.ListId\x20IS\x20NULL');_0x33f73f[_0xc1dc('0x38')](_0xc1dc('0x76'));}else{_0x4eab0a[_0xc1dc('0x38')](_0xc1dc('0x5b'),_[_0xc1dc('0x4b')](_0x59e16b,'id'));_0x33f73f[_0xc1dc('0x38')](_0xc1dc('0x5b'),_[_0xc1dc('0x4b')](_0x59e16b,'id'));}});}else{return;}})[_0xc1dc('0x22')](function(){db[_0xc1dc('0x77')][_0xc1dc('0x33')](_0x4eab0a[_0xc1dc('0x78')](),_0x2ca0fe)[_0xc1dc('0x22')](function(_0xa86ce5){_0x3288d4[_0xc1dc('0x79')]=_0xa86ce5[_0xc1dc('0x2f')];if(_0x3288d4[_0xc1dc('0x79')]===0x0)return[];return db[_0xc1dc('0x77')]['query'](_0x23f490[_0xc1dc('0x78')](),_0x2ca0fe);})[_0xc1dc('0x22')](function(_0x6d0bd2){_0x1a8372=_[_0xc1dc('0x7a')](_0x6d0bd2,'id');_0x2ca0fe=_[_0xc1dc('0x7b')](_0x2ca0fe,{'model':db[_0xc1dc('0x7c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x582f19[_0xc1dc('0x33')][_0xc1dc('0x36')]){_0x2d06d2['attributes'][_0xc1dc('0x59')](function(_0x4f02af){_0x33f73f[_0xc1dc('0x3b')]('c.'+_0x4f02af);});}else{_0x33f73f[_0xc1dc('0x3b')](_0xc1dc('0x6c'));_0x33f73f[_0xc1dc('0x3b')](_0xc1dc('0x7d'));_0x33f73f[_0xc1dc('0x3b')](_0xc1dc('0x7e'));_0x33f73f[_0xc1dc('0x3b')]('c.phone');_0x33f73f[_0xc1dc('0x3b')](_0xc1dc('0x7f'));_0x33f73f[_0xc1dc('0x3b')](_0xc1dc('0x80'));_0x33f73f[_0xc1dc('0x3b')]('c.email');_0x33f73f['field']('c.ListId');_0x33f73f[_0xc1dc('0x3b')](_0xc1dc('0x81'));_0x33f73f[_0xc1dc('0x3b')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xc1dc('0x82'));}if(_0x2d06d2[_0xc1dc('0x1b')])_0x33f73f['limit'](_0x2d06d2[_0xc1dc('0x1b')]);if(_0x2d06d2[_0xc1dc('0x1a')])_0x33f73f['offset'](_0x2d06d2[_0xc1dc('0x1a')]);return db[_0xc1dc('0x77')][_0xc1dc('0x33')](_0x33f73f[_0xc1dc('0x78')](),_0x2ca0fe);})['then'](function(_0x2b25b2){_0x2b25b2['forEach'](function(_0x4caaa7){if(_0x4caaa7['TagIds']){_0x4caaa7[_0xc1dc('0x83')]=[];_0x4caaa7[_0xc1dc('0x82')][_0xc1dc('0x4a')](',')[_0xc1dc('0x59')](function(_0x5ec8d3){_0x4caaa7['Tags']['push'](_0x1a8372[_0x5ec8d3]);});}delete _0x4caaa7[_0xc1dc('0x82')];});_0x3288d4[_0xc1dc('0x84')]=_0x2b25b2;return _0x3288d4;})[_0xc1dc('0x22')](respondWithFilteredResult(_0x8007fe,_0x2d06d2));});})['catch'](handleError(_0x8007fe,null));};exports['destroy']=function(_0x492aaf,_0x4c95c7){return db['CmContact'][_0xc1dc('0x48')]({'where':{'id':_0x492aaf[_0xc1dc('0x85')]['id']}})['then'](handleEntityNotFound(_0x4c95c7,null))[_0xc1dc('0x22')](removeEntity(_0x4c95c7,null))['catch'](handleError(_0x4c95c7,null));};exports['describe']=function(_0x447f52,_0x102a7){return db[_0xc1dc('0x7c')][_0xc1dc('0x86')]()[_0xc1dc('0x22')](function(_0x2404f0){delete _0x2404f0[_0xc1dc('0x87')];for(var _0x4bd04d=0x0;_0x4bd04d=_0x4a64b5){_0x452a81=_0x4a64b5;_0x373bf0=0xc8;}else{_0x373bf0=0xce;}_0x192b5c[_0xfc5a('0x1a')](_0x373bf0);return _0x192b5c['set'](_0xfc5a('0x1f'),_0x35a851+'-'+_0x452a81+'/'+_0x4a64b5)[_0xfc5a('0x1c')](_0x22630a);}return null;};}function patchUpdates(_0x45580f){return function(_0x2e0ee1){try{jsonpatch['apply'](_0x2e0ee1,_0x45580f,!![]);}catch(_0x45c56b){return BPromise[_0xfc5a('0x20')](_0x45c56b);}return _0x2e0ee1[_0xfc5a('0x21')]();};}function saveUpdates(_0x1ff072,_0x37f554){return function(_0xd6fe8){if(_0xd6fe8){return _0xd6fe8[_0xfc5a('0x22')](_0x1ff072)[_0xfc5a('0x23')](function(_0x5e1be1){return _0x5e1be1;});}return null;};}function removeEntity(_0x1daecd,_0xd0a50a){return function(_0x2a5d0e){if(_0x2a5d0e){return _0x2a5d0e[_0xfc5a('0x24')]()[_0xfc5a('0x23')](function(){_0x1daecd['status'](0xcc)[_0xfc5a('0x1b')]();});}};}function handleEntityNotFound(_0x5a7828,_0x466aff){return function(_0x16b3e4){if(!_0x16b3e4){_0x5a7828['sendStatus'](0x194);}return _0x16b3e4;};}function handleError(_0x337ebc,_0x149945){_0x149945=_0x149945||0x1f4;return function(_0x5ebd21){logger[_0xfc5a('0x25')](_0x5ebd21[_0xfc5a('0x26')]);if(_0x5ebd21[_0xfc5a('0x27')]){delete _0x5ebd21[_0xfc5a('0x27')];}_0x337ebc[_0xfc5a('0x1a')](_0x149945)['send'](_0x5ebd21);};}exports[_0xfc5a('0x28')]=function(_0x137c8d,_0x5ef287){var _0x193678={},_0x3f59c2={},_0x1f633a={'count':0x0,'rows':[]};return db[_0xfc5a('0x29')][_0xfc5a('0x2a')]()[_0xfc5a('0x23')](function(_0x4089d0){var _0x1222f6=[];for(var _0x398138=0x0;_0x3981380x1){_0x23784a['or'](_0xfc5a('0x65'),qs[_0xfc5a('0x66')](_0x11e733),null);}else{if(qs[_0xfc5a('0x67')](_0x11e733)){_0x23784a['or'](_0xfc5a('0x68'),_0x11e733+'%');_0x23784a['or'](_0xfc5a('0x69'),_0x11e733+'%');_0x23784a['or'](_0xfc5a('0x6a'),_0x11e733+'%');_0x23784a['or'](_0xfc5a('0x6b'),_0x11e733+'%');}else if(qs[_0xfc5a('0x6c')](_0x11e733)){_0x23784a['or']('c.email\x20LIKE\x20?',_0x11e733+'%');}else{_0x23784a['or']('c.firstName\x20LIKE\x20?','%'+_0x11e733+'%');_0x23784a['or'](_0xfc5a('0x6d'),'%'+_0x11e733+'%');_0x23784a['or'](_0xfc5a('0x6e'),'%'+_0x11e733+'%');}}}}_0x1da7e7['where'](_0x23784a);_0x1da7e7['group'](_0xfc5a('0x6f'));var _0x568944={'type':db[_0xfc5a('0x70')][_0xfc5a('0x71')][_0xfc5a('0x72')],'raw':!![]};var _0x9cfdcd=_0x1da7e7[_0xfc5a('0x73')]()['field'](_0xfc5a('0x6f'));if(_0x193678['order']){_0x193678[_0xfc5a('0x74')][_0xfc5a('0x4f')](function(_0x44d108){_0x1da7e7[_0xfc5a('0x74')]('c.'+_0x44d108[0x0],_0x44d108[0x1]===_0xfc5a('0x75')?![]:!![]);});}if(!_[_0xfc5a('0x5b')](_0x2b2ada)){_0x1da7e7[_0xfc5a('0x76')](_0x300ba0);_0x9cfdcd[_0xfc5a('0x3b')](_0xfc5a('0x77'),_0x2b2ada);}BPromise['resolve']()[_0xfc5a('0x23')](function(){if(_0x869cf5&&!_[_0xfc5a('0x78')](_0x869cf5['conditions'],[_0xfc5a('0x3d'),_0xfc5a('0x51')])){return _0x137c8d[_0xfc5a('0x79')][_0xfc5a('0x7a')]({'attributes':['id'],'raw':!![]})[_0xfc5a('0x23')](function(_0x40d43d){if(_['isEmpty'](_0x40d43d)){_0x9cfdcd['where']('c.ListId\x20IS\x20NULL');_0x1da7e7['where']('c.ListId\x20IS\x20NULL');}else{_0x9cfdcd[_0xfc5a('0x3b')]('c.ListId\x20IN\x20?',_[_0xfc5a('0x4e')](_0x40d43d,'id'));_0x1da7e7[_0xfc5a('0x3b')](_0xfc5a('0x7b'),_[_0xfc5a('0x4e')](_0x40d43d,'id'));}});}else{return;}})[_0xfc5a('0x23')](function(){db[_0xfc5a('0x7c')][_0xfc5a('0x34')](_0x9cfdcd['toString'](),_0x568944)['then'](function(_0x7b1f74){_0x1f633a[_0xfc5a('0x1d')]=_0x7b1f74[_0xfc5a('0x31')];if(_0x1f633a[_0xfc5a('0x1d')]===0x0)return[];return db[_0xfc5a('0x7c')][_0xfc5a('0x34')](_0x1c3e13[_0xfc5a('0x7d')](),_0x568944);})[_0xfc5a('0x23')](function(_0x143abd){_0x26fe7c=_['keyBy'](_0x143abd,'id');_0x568944=_[_0xfc5a('0x7e')](_0x568944,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x137c8d[_0xfc5a('0x34')]['fields']){_0x193678[_0xfc5a('0x37')][_0xfc5a('0x4f')](function(_0xb89c54){_0x1da7e7[_0xfc5a('0x3d')]('c.'+_0xb89c54);});}else{_0x1da7e7[_0xfc5a('0x3d')](_0xfc5a('0x6f'));_0x1da7e7[_0xfc5a('0x3d')](_0xfc5a('0x7f'));_0x1da7e7[_0xfc5a('0x3d')](_0xfc5a('0x80'));_0x1da7e7[_0xfc5a('0x3d')]('c.phone');_0x1da7e7[_0xfc5a('0x3d')](_0xfc5a('0x81'));_0x1da7e7['field'](_0xfc5a('0x82'));_0x1da7e7[_0xfc5a('0x3d')]('c.email');_0x1da7e7['field'](_0xfc5a('0x83'));_0x1da7e7[_0xfc5a('0x3d')](_0xfc5a('0x84'));_0x1da7e7[_0xfc5a('0x3d')](_0xfc5a('0x85'),'TagIds');}if(_0x193678['limit'])_0x1da7e7['limit'](_0x193678[_0xfc5a('0x39')]);if(_0x193678['offset'])_0x1da7e7['offset'](_0x193678['offset']);return db['sequelize'][_0xfc5a('0x34')](_0x1da7e7[_0xfc5a('0x7d')](),_0x568944);})[_0xfc5a('0x23')](function(_0x1ce480){_0x1ce480[_0xfc5a('0x4f')](function(_0x3c6919){if(_0x3c6919['TagIds']){_0x3c6919[_0xfc5a('0x86')]=[];_0x3c6919['TagIds']['split'](',')[_0xfc5a('0x4f')](function(_0x640760){_0x3c6919[_0xfc5a('0x86')][_0xfc5a('0x2e')](_0x26fe7c[_0x640760]);});}delete _0x3c6919[_0xfc5a('0x87')];});_0x1f633a['rows']=_0x1ce480;return _0x1f633a;})[_0xfc5a('0x23')](respondWithFilteredResult(_0x5ef287,_0x193678));});})[_0xfc5a('0x88')](handleError(_0x5ef287,null));};exports[_0xfc5a('0x24')]=function(_0x5d09ab,_0x4934f7){return db[_0xfc5a('0x29')][_0xfc5a('0x4a')]({'where':{'id':_0x5d09ab[_0xfc5a('0x89')]['id']}})[_0xfc5a('0x23')](handleEntityNotFound(_0x4934f7,null))['then'](removeEntity(_0x4934f7,null))[_0xfc5a('0x88')](handleError(_0x4934f7,null));};exports[_0xfc5a('0x2a')]=function(_0x13b655,_0x370772){return db[_0xfc5a('0x29')][_0xfc5a('0x2a')]()[_0xfc5a('0x23')](function(_0x182b47){delete _0x182b47[_0xfc5a('0x8a')];for(var _0x34c391=0x0;_0x34c391{}\s\\|]/g,'-');_0x3776ac(null,util[_0xa55c('0x1e')]('%s-%s%s',path[_0xa55c('0x1f')](_0xd643cc[_0xa55c('0x1c')],path[_0xa55c('0x20')](_0xd643cc[_0xa55c('0x1c')])),Date[_0xa55c('0x21')](),path['extname'](_0xd643cc[_0xa55c('0x1c')])));}})});router['post']('/csv',upload['single'](_0xa55c('0x22')),controller['uploadCsv']);var upload=multer({'storage':multer[_0xa55c('0x19')]({'destination':function(_0x190757,_0x3f64de,_0xf0e574){_0xf0e574(null,path[_0xa55c('0x1a')](config[_0xa55c('0x1b')],_0xa55c('0x23')));},'filename':function(_0x11e7f7,_0x192df2,_0x3cd152){_0x192df2[_0xa55c('0x1c')]=_0x192df2['originalname'][_0xa55c('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3cd152(null,util[_0xa55c('0x1e')](_0xa55c('0x24'),path[_0xa55c('0x1f')](_0x192df2['originalname'],path[_0xa55c('0x20')](_0x192df2[_0xa55c('0x1c')])),Date[_0xa55c('0x21')](),path[_0xa55c('0x20')](_0x192df2[_0xa55c('0x1c')])));}})});router[_0xa55c('0x12')]('/upload',upload[_0xa55c('0x25')]('file'),controller[_0xa55c('0x26')]);router[_0xa55c('0x12')](_0xa55c('0x27'),auth[_0xa55c('0x7')](),controller['import']);router[_0xa55c('0x28')](_0xa55c('0x29'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x2a')]);router[_0xa55c('0x2b')](_0xa55c('0x29'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x2c')]);module[_0xa55c('0x2d')]=router; \ No newline at end of file +var _0xa41a=['originalname','extname','/csv','single','file','now','/upload','upload','import','update','delete','/:id','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','describe','isAuthenticated','show','/:id/tags','getTags','/:id/hoppers','/:id/hopper_histories','getHopperFinals','/:id/jscripty_sessions','post','/merge','merge','create','/create_many','bulkCreate','setTags','diskStorage','join','root','server/files/tmp','replace','%s-%s%s','basename'];(function(_0x3d0d07,_0x216be0){var _0x35fb41=function(_0x72054d){while(--_0x72054d){_0x3d0d07['push'](_0x3d0d07['shift']());}};_0x35fb41(++_0x216be0);}(_0xa41a,0x6b));var _0xaa41=function(_0x2b5348,_0x128c37){_0x2b5348=_0x2b5348-0x0;var _0x17c570=_0xa41a[_0x2b5348];return _0x17c570;};'use strict';var multer=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var path=require('path');var timeout=require(_0xaa41('0x2'));var express=require(_0xaa41('0x3'));var router=express[_0xaa41('0x4')]();var auth=require(_0xaa41('0x5'));var interaction=require(_0xaa41('0x6'));var config=require(_0xaa41('0x7'));var controller=require(_0xaa41('0x8'));router[_0xaa41('0x9')]('/',auth['isAuthenticated'](),controller[_0xaa41('0xa')]);router[_0xaa41('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xaa41('0xb')]);router[_0xaa41('0x9')]('/:id',auth[_0xaa41('0xc')](),controller[_0xaa41('0xd')]);router[_0xaa41('0x9')](_0xaa41('0xe'),auth[_0xaa41('0xc')](),controller[_0xaa41('0xf')]);router[_0xaa41('0x9')](_0xaa41('0x10'),auth[_0xaa41('0xc')](),controller['getHoppers']);router[_0xaa41('0x9')](_0xaa41('0x11'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xaa41('0x9')]('/:id/hopper_finals',auth[_0xaa41('0xc')](),controller[_0xaa41('0x12')]);router[_0xaa41('0x9')](_0xaa41('0x13'),auth[_0xaa41('0xc')](),controller['getJscriptySessions']);router[_0xaa41('0x14')](_0xaa41('0x15'),auth[_0xaa41('0xc')](),controller[_0xaa41('0x16')]);router[_0xaa41('0x14')]('/',auth[_0xaa41('0xc')](),controller[_0xaa41('0x17')]);router['post'](_0xaa41('0x18'),auth[_0xaa41('0xc')](),controller[_0xaa41('0x19')]);router[_0xaa41('0x14')](_0xaa41('0xe'),auth[_0xaa41('0xc')](),controller[_0xaa41('0x1a')]);var upload=multer({'storage':multer[_0xaa41('0x1b')]({'destination':function(_0x150ddf,_0x4fe1a4,_0x5cd936){_0x5cd936(null,path[_0xaa41('0x1c')](config[_0xaa41('0x1d')],_0xaa41('0x1e')));},'filename':function(_0x54c488,_0x2bf794,_0x1f692b){_0x2bf794['originalname']=_0x2bf794['originalname'][_0xaa41('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1f692b(null,util['format'](_0xaa41('0x20'),path[_0xaa41('0x21')](_0x2bf794[_0xaa41('0x22')],path[_0xaa41('0x23')](_0x2bf794[_0xaa41('0x22')])),Date['now'](),path[_0xaa41('0x23')](_0x2bf794[_0xaa41('0x22')])));}})});router[_0xaa41('0x14')](_0xaa41('0x24'),upload[_0xaa41('0x25')](_0xaa41('0x26')),controller['uploadCsv']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x16aec5,_0x527cac,_0x493a10){_0x493a10(null,path[_0xaa41('0x1c')](config['root'],'server/files/tmp'));},'filename':function(_0x2d0ac0,_0x9c8c21,_0x392214){_0x9c8c21[_0xaa41('0x22')]=_0x9c8c21[_0xaa41('0x22')][_0xaa41('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x392214(null,util['format'](_0xaa41('0x20'),path[_0xaa41('0x21')](_0x9c8c21[_0xaa41('0x22')],path[_0xaa41('0x23')](_0x9c8c21[_0xaa41('0x22')])),Date[_0xaa41('0x27')](),path[_0xaa41('0x23')](_0x9c8c21[_0xaa41('0x22')])));}})});router['post'](_0xaa41('0x28'),upload['single']('file'),controller[_0xaa41('0x29')]);router[_0xaa41('0x14')]('/upload/:id',auth[_0xaa41('0xc')](),controller[_0xaa41('0x2a')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xaa41('0x2b')]);router[_0xaa41('0x2c')](_0xaa41('0x2d'),auth[_0xaa41('0xc')](),controller['destroy']);module[_0xaa41('0x2e')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 945f4ff..ebd1c43 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 _0x8d6a=['long','type','parse','values','isArray','setDataValue','lodash','exports','VIRTUAL','getDataValue','STRING','alias','name','TEXT'];(function(_0x150fa2,_0x156632){var _0x88e6ba=function(_0x23536e){while(--_0x23536e){_0x150fa2['push'](_0x150fa2['shift']());}};_0x88e6ba(++_0x156632);}(_0x8d6a,0x13a));var _0xa8d6=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x8d6a[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require('sequelize');var _=require(_0xa8d6('0x0'));module[_0xa8d6('0x1')]={'name':{'type':Sequelize[_0xa8d6('0x2')],'get':function(_0x37a154){return this[_0xa8d6('0x3')]('alias');}},'alias':{'type':Sequelize[_0xa8d6('0x4')],'allowNull':![],'set':function(_0x49ec9){this['setDataValue'](_0xa8d6('0x5'),_0x49ec9?_0x49ec9:this[_0xa8d6('0x3')](_0xa8d6('0x6')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0xa8d6('0x7')](_0xa8d6('0x8')),'get':function(){if(this['getDataValue'](_0xa8d6('0x9'))==='select'){return JSON[_0xa8d6('0xa')](this['getDataValue'](_0xa8d6('0xb')));}else{return this[_0xa8d6('0x3')](_0xa8d6('0xb'));}},'set':function(_0x63b867){if(Array[_0xa8d6('0xc')](_0x63b867)){this[_0xa8d6('0xd')](_0xa8d6('0xb'),JSON['stringify'](_0x63b867));}else{this[_0xa8d6('0xd')](_0xa8d6('0xb'),_0x63b867);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xf3a3=['stringify','BOOLEAN','lodash','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','values','isArray'];(function(_0x1d70db,_0x142b63){var _0x3060c6=function(_0x347866){while(--_0x347866){_0x1d70db['push'](_0x1d70db['shift']());}};_0x3060c6(++_0x142b63);}(_0xf3a3,0x146));var _0x3f3a=function(_0x338671,_0x39e1fd){_0x338671=_0x338671-0x0;var _0x2b0225=_0xf3a3[_0x338671];return _0x2b0225;};'use strict';var Sequelize=require('sequelize');var _=require(_0x3f3a('0x0'));module[_0x3f3a('0x1')]={'name':{'type':Sequelize[_0x3f3a('0x2')],'get':function(_0x2d84e3){return this[_0x3f3a('0x3')](_0x3f3a('0x4'));}},'alias':{'type':Sequelize[_0x3f3a('0x5')],'allowNull':![],'set':function(_0x563439){this[_0x3f3a('0x6')]('alias',_0x563439?_0x563439:this['getDataValue'](_0x3f3a('0x7')));}},'type':{'type':Sequelize[_0x3f3a('0x5')],'allowNull':![]},'values':{'type':Sequelize['TEXT']('long'),'get':function(){if(this[_0x3f3a('0x3')]('type')==='select'){return JSON['parse'](this['getDataValue'](_0x3f3a('0x8')));}else{return this[_0x3f3a('0x3')](_0x3f3a('0x8'));}},'set':function(_0x2af8ad){if(Array[_0x3f3a('0x9')](_0x2af8ad)){this[_0x3f3a('0x6')](_0x3f3a('0x8'),JSON[_0x3f3a('0xa')](_0x2af8ad));}else{this[_0x3f3a('0x6')](_0x3f3a('0x8'),_0x2af8ad);}}},'required':{'type':Sequelize[_0x3f3a('0xb')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 779feda..94df8e9 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 _0x7e3d=['find','body','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','queryInterface','addColumn','cm_contacts','format','cf_%d','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','apply','reject','update','then','destroy','error','stack','name','send','CmCustomField','rawAttributes','fieldName','type','model','differenceBy','query','keys','filters','intersection','attributes','fields','nolimit','limit','order','pick','where','merge','map','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','length','include'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x7e3d,0x1b9));var _0xd7e3=function(_0x4ea6af,_0x4aa32e){_0x4ea6af=_0x4ea6af-0x0;var _0x4cb1e6=_0x7e3d[_0x4ea6af];return _0x4cb1e6;};'use strict';var pdf=require(_0xd7e3('0x0'));var emlformat=require(_0xd7e3('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd7e3('0x2'));var jsonpatch=require(_0xd7e3('0x3'));var rp=require(_0xd7e3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd7e3('0x5'));var util=require(_0xd7e3('0x6'));var path=require(_0xd7e3('0x7'));var sox=require(_0xd7e3('0x8'));var csv=require(_0xd7e3('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd7e3('0xa'));var squel=require(_0xd7e3('0xb'));var crypto=require(_0xd7e3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd7e3('0xd'));var toCsv=require(_0xd7e3('0x9'));var querystring=require(_0xd7e3('0xe'));var Papa=require(_0xd7e3('0xf'));var Redis=require(_0xd7e3('0x10'));var authService=require(_0xd7e3('0x11'));var qs=require(_0xd7e3('0x12'));var as=require(_0xd7e3('0x13'));var hardwareService=require(_0xd7e3('0x14'));var logger=require(_0xd7e3('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xd7e3('0x16'));var db=require(_0xd7e3('0x17'))['db'];function respondWithStatusCode(_0x19eeb0,_0x5c91e9){_0x5c91e9=_0x5c91e9||0xcc;return function(_0x365663){if(_0x365663){return _0x19eeb0[_0xd7e3('0x18')](_0x5c91e9);}return _0x19eeb0[_0xd7e3('0x19')](_0x5c91e9)[_0xd7e3('0x1a')]();};}function respondWithResult(_0x2a789e,_0x1632ff){_0x1632ff=_0x1632ff||0xc8;return function(_0x2c8172){if(_0x2c8172){return _0x2a789e[_0xd7e3('0x19')](_0x1632ff)[_0xd7e3('0x1b')](_0x2c8172);}};}function respondWithFilteredResult(_0x1c15cb,_0x341a7c){return function(_0x8eecd3){if(_0x8eecd3){var _0x36a1f6=_0x8eecd3[_0xd7e3('0x1c')],_0x3e1b36=_0x341a7c[_0xd7e3('0x1d')],_0x1dec20=_0x341a7c['offset']+_0x341a7c['limit'],_0x2f117f;if(_0x1dec20>=_0x36a1f6){_0x1dec20=_0x36a1f6;_0x2f117f=0xc8;}else{_0x2f117f=0xce;}_0x1c15cb['status'](_0x2f117f);return _0x1c15cb['set']('Content-Range',_0x3e1b36+'-'+_0x1dec20+'/'+_0x36a1f6)['json'](_0x8eecd3);}return null;};}function patchUpdates(_0x142c11){return function(_0x515f6c){try{jsonpatch[_0xd7e3('0x1e')](_0x515f6c,_0x142c11,!![]);}catch(_0x32c118){return BPromise[_0xd7e3('0x1f')](_0x32c118);}return _0x515f6c['save']();};}function saveUpdates(_0x32f694,_0x470b49){return function(_0x51c354){if(_0x51c354){return _0x51c354[_0xd7e3('0x20')](_0x32f694)[_0xd7e3('0x21')](function(_0x442acf){return _0x442acf;});}return null;};}function removeEntity(_0x103bb1,_0x53830d){return function(_0x2c60f1){if(_0x2c60f1){return _0x2c60f1[_0xd7e3('0x22')]()[_0xd7e3('0x21')](function(){_0x103bb1[_0xd7e3('0x19')](0xcc)[_0xd7e3('0x1a')]();});}};}function handleEntityNotFound(_0x3fa465,_0x4239cf){return function(_0x262f56){if(!_0x262f56){_0x3fa465[_0xd7e3('0x18')](0x194);}return _0x262f56;};}function handleError(_0x56ace4,_0x174ad9){_0x174ad9=_0x174ad9||0x1f4;return function(_0xd98498){logger[_0xd7e3('0x23')](_0xd98498[_0xd7e3('0x24')]);if(_0xd98498[_0xd7e3('0x25')]){delete _0xd98498['name'];}_0x56ace4[_0xd7e3('0x19')](_0x174ad9)[_0xd7e3('0x26')](_0xd98498);};}exports['index']=function(_0x194a29,_0x4a78a7){var _0x3b0e33={},_0x2f1414={},_0x55616e={'count':0x0,'rows':[]};var _0x3d2946=_['map'](db[_0xd7e3('0x27')][_0xd7e3('0x28')],function(_0x155a96){return{'name':_0x155a96[_0xd7e3('0x29')],'type':_0x155a96[_0xd7e3('0x2a')]['key']};});_0x2f1414[_0xd7e3('0x2b')]=_[_0xd7e3('0x2c')](_['map'](_0x3d2946,_0xd7e3('0x25')),[_0xd7e3('0x25')]);_0x2f1414[_0xd7e3('0x2d')]=_[_0xd7e3('0x2e')](_0x194a29['query']);_0x2f1414[_0xd7e3('0x2f')]=_[_0xd7e3('0x30')](_0x2f1414[_0xd7e3('0x2b')],_0x2f1414['query']);_0x3b0e33[_0xd7e3('0x31')]=_[_0xd7e3('0x30')](_0x2f1414[_0xd7e3('0x2b')],qs[_0xd7e3('0x32')](_0x194a29['query']['fields']));_0x3b0e33['attributes']=_0x3b0e33[_0xd7e3('0x31')]['length']?_0x3b0e33[_0xd7e3('0x31')]:_0x2f1414[_0xd7e3('0x2b')];if(!_0x194a29[_0xd7e3('0x2d')]['hasOwnProperty'](_0xd7e3('0x33'))){_0x3b0e33['limit']=qs[_0xd7e3('0x34')](_0x194a29[_0xd7e3('0x2d')]['limit']);_0x3b0e33[_0xd7e3('0x1d')]=qs[_0xd7e3('0x1d')](_0x194a29[_0xd7e3('0x2d')][_0xd7e3('0x1d')]);}_0x3b0e33[_0xd7e3('0x35')]=qs['sort'](_0x194a29[_0xd7e3('0x2d')]['sort']);_0x3b0e33['where']=qs['filters'](_[_0xd7e3('0x36')](_0x194a29[_0xd7e3('0x2d')],_0x2f1414[_0xd7e3('0x2f')]));if(_0x194a29[_0xd7e3('0x2d')]['filter']){_0x3b0e33[_0xd7e3('0x37')]=_[_0xd7e3('0x38')](_0x3b0e33[_0xd7e3('0x37')],{'$or':_[_0xd7e3('0x39')](_0x3d2946,function(_0xdd7146){if(_0xdd7146['type']!==_0xd7e3('0x3a')){var _0x517ae3={};_0x517ae3[_0xdd7146[_0xd7e3('0x25')]]={'$like':'%'+_0x194a29[_0xd7e3('0x2d')][_0xd7e3('0x3b')]+'%'};return _0x517ae3;}})});}_0x3b0e33=_[_0xd7e3('0x38')]({},_0x3b0e33,_0x194a29[_0xd7e3('0x3c')]);var _0x655468={'where':_0x3b0e33[_0xd7e3('0x37')]};return db[_0xd7e3('0x27')]['count'](_0x655468)['then'](function(_0x50aeac){_0x55616e[_0xd7e3('0x1c')]=_0x50aeac;if(_0x194a29['query'][_0xd7e3('0x3d')]){_0x3b0e33['include']=[{'all':!![]}];}return db[_0xd7e3('0x27')][_0xd7e3('0x3e')](_0x3b0e33);})['then'](function(_0x4b39a1){_0x55616e[_0xd7e3('0x3f')]=_0x4b39a1;return _0x55616e;})[_0xd7e3('0x21')](respondWithFilteredResult(_0x4a78a7,_0x3b0e33))[_0xd7e3('0x40')](handleError(_0x4a78a7,null));};exports[_0xd7e3('0x41')]=function(_0x7d23fb,_0x4d8524){var _0x33c553={'raw':!![],'where':{'id':_0x7d23fb[_0xd7e3('0x42')]['id']}},_0x3e3399={};_0x3e3399['model']=_[_0xd7e3('0x2e')](db[_0xd7e3('0x27')][_0xd7e3('0x28')]);_0x3e3399[_0xd7e3('0x2d')]=_[_0xd7e3('0x2e')](_0x7d23fb['query']);_0x3e3399['filters']=_[_0xd7e3('0x30')](_0x3e3399['model'],_0x3e3399[_0xd7e3('0x2d')]);_0x33c553[_0xd7e3('0x31')]=_[_0xd7e3('0x30')](_0x3e3399['model'],qs[_0xd7e3('0x32')](_0x7d23fb[_0xd7e3('0x2d')][_0xd7e3('0x32')]));_0x33c553[_0xd7e3('0x31')]=_0x33c553['attributes'][_0xd7e3('0x43')]?_0x33c553[_0xd7e3('0x31')]:_0x3e3399['model'];if(_0x7d23fb['query'][_0xd7e3('0x3d')]){_0x33c553[_0xd7e3('0x44')]=[{'all':!![]}];}_0x33c553=_[_0xd7e3('0x38')]({},_0x33c553,_0x7d23fb['options']);return db[_0xd7e3('0x27')][_0xd7e3('0x45')](_0x33c553)[_0xd7e3('0x21')](handleEntityNotFound(_0x4d8524,null))[_0xd7e3('0x21')](respondWithResult(_0x4d8524,null))[_0xd7e3('0x40')](handleError(_0x4d8524,null));};exports[_0xd7e3('0x20')]=function(_0x2601af,_0x48f5c1){if(_0x2601af[_0xd7e3('0x46')]['id']){delete _0x2601af[_0xd7e3('0x46')]['id'];}return db[_0xd7e3('0x27')][_0xd7e3('0x45')]({'where':{'id':_0x2601af[_0xd7e3('0x42')]['id']}})[_0xd7e3('0x21')](handleEntityNotFound(_0x48f5c1,null))['then'](saveUpdates(_0x2601af['body'],null))['then'](respondWithResult(_0x48f5c1,null))[_0xd7e3('0x40')](handleError(_0x48f5c1,null));};exports[_0xd7e3('0x22')]=function(_0x3a5409,_0x15c385){return db[_0xd7e3('0x27')][_0xd7e3('0x45')]({'where':{'id':_0x3a5409[_0xd7e3('0x42')]['id']}})[_0xd7e3('0x21')](handleEntityNotFound(_0x15c385,null))['then'](removeEntity(_0x15c385,null))['catch'](handleError(_0x15c385,null));};exports[_0xd7e3('0x47')]=function(_0x339747,_0x55affd){var _0x5d6e6c;return db[_0xd7e3('0x48')][_0xd7e3('0x49')](function(_0x157ca5){return db[_0xd7e3('0x27')][_0xd7e3('0x47')](_0x339747['body'],{'transaction':_0x157ca5})['then'](function(_0x2a2b02){_0x5d6e6c=_0x2a2b02;var _0xd6eb1b={'type':db[_0xd7e3('0x4a')][_0xd7e3('0x4b')],'transaction':_0x157ca5};switch(_0x339747[_0xd7e3('0x46')][_0xd7e3('0x2a')]){case _0xd7e3('0x4c'):_0xd6eb1b[_0xd7e3('0x2a')]=db[_0xd7e3('0x4a')][_0xd7e3('0x4b')];break;case _0xd7e3('0x4d'):_0xd6eb1b[_0xd7e3('0x2a')]=db[_0xd7e3('0x4a')][_0xd7e3('0x4e')];break;case _0xd7e3('0x4f'):_0xd6eb1b['type']=db['Sequelize']['BOOLEAN'];_0xd6eb1b['defaultValue']=![];break;default:}return db[_0xd7e3('0x48')][_0xd7e3('0x50')][_0xd7e3('0x51')](_0xd7e3('0x52'),util[_0xd7e3('0x53')](_0xd7e3('0x54'),_0x5d6e6c['id']),_0xd6eb1b);})['then'](function(){return _0x5d6e6c;});})[_0xd7e3('0x21')](respondWithResult(_0x55affd,0xc9))[_0xd7e3('0x40')](handleError(_0x55affd,null));}; \ No newline at end of file +var _0x9214=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','merge','where','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','update','body','find','sequelize','transaction','create','number','Sequelize','queryInterface','addColumn','format','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','sendStatus','status','end','json','count','offset','limit','set','apply','reject','destroy','then','error','stack','name','send','index','map','CmCustomField','fieldName','key','model','query','keys'];(function(_0x4e76da,_0x291b71){var _0x5f14e8=function(_0x30ad0f){while(--_0x30ad0f){_0x4e76da['push'](_0x4e76da['shift']());}};_0x5f14e8(++_0x291b71);}(_0x9214,0x73));var _0x4921=function(_0x4c8fa9,_0x2a1337){_0x4c8fa9=_0x4c8fa9-0x0;var _0x192648=_0x9214[_0x4c8fa9];return _0x192648;};'use strict';var pdf=require(_0x4921('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4921('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4921('0x2'));var rp=require(_0x4921('0x3'));var moment=require(_0x4921('0x4'));var BPromise=require(_0x4921('0x5'));var Mustache=require(_0x4921('0x6'));var util=require(_0x4921('0x7'));var path=require(_0x4921('0x8'));var sox=require(_0x4921('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x4921('0xa'));var squel=require(_0x4921('0xb'));var crypto=require(_0x4921('0xc'));var jsforce=require(_0x4921('0xd'));var deskjs=require(_0x4921('0xe'));var toCsv=require(_0x4921('0xf'));var querystring=require('querystring');var Papa=require(_0x4921('0x10'));var Redis=require(_0x4921('0x11'));var authService=require(_0x4921('0x12'));var qs=require(_0x4921('0x13'));var as=require(_0x4921('0x14'));var hardwareService=require(_0x4921('0x15'));var logger=require('../../config/logger')(_0x4921('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1987c5,_0x246996){_0x246996=_0x246996||0xcc;return function(_0x227cc7){if(_0x227cc7){return _0x1987c5[_0x4921('0x17')](_0x246996);}return _0x1987c5[_0x4921('0x18')](_0x246996)[_0x4921('0x19')]();};}function respondWithResult(_0x26f24b,_0x39d9bb){_0x39d9bb=_0x39d9bb||0xc8;return function(_0x1c083f){if(_0x1c083f){return _0x26f24b[_0x4921('0x18')](_0x39d9bb)[_0x4921('0x1a')](_0x1c083f);}};}function respondWithFilteredResult(_0x4ac81a,_0x373715){return function(_0x2f61e1){if(_0x2f61e1){var _0xc220d0=_0x2f61e1[_0x4921('0x1b')],_0x200ec2=_0x373715['offset'],_0x240d61=_0x373715[_0x4921('0x1c')]+_0x373715[_0x4921('0x1d')],_0xf3949f;if(_0x240d61>=_0xc220d0){_0x240d61=_0xc220d0;_0xf3949f=0xc8;}else{_0xf3949f=0xce;}_0x4ac81a[_0x4921('0x18')](_0xf3949f);return _0x4ac81a[_0x4921('0x1e')]('Content-Range',_0x200ec2+'-'+_0x240d61+'/'+_0xc220d0)[_0x4921('0x1a')](_0x2f61e1);}return null;};}function patchUpdates(_0xf39a63){return function(_0x2dba81){try{jsonpatch[_0x4921('0x1f')](_0x2dba81,_0xf39a63,!![]);}catch(_0x3ee924){return BPromise[_0x4921('0x20')](_0x3ee924);}return _0x2dba81['save']();};}function saveUpdates(_0x2aacab,_0x3a5f52){return function(_0x27f964){if(_0x27f964){return _0x27f964['update'](_0x2aacab)['then'](function(_0x168e4c){return _0x168e4c;});}return null;};}function removeEntity(_0x122afc,_0x4ae46d){return function(_0xe2a29b){if(_0xe2a29b){return _0xe2a29b[_0x4921('0x21')]()[_0x4921('0x22')](function(){_0x122afc['status'](0xcc)[_0x4921('0x19')]();});}};}function handleEntityNotFound(_0xaf4584,_0x50e1b7){return function(_0x9ddf2f){if(!_0x9ddf2f){_0xaf4584[_0x4921('0x17')](0x194);}return _0x9ddf2f;};}function handleError(_0x34ad61,_0x3be401){_0x3be401=_0x3be401||0x1f4;return function(_0x36ed73){logger[_0x4921('0x23')](_0x36ed73[_0x4921('0x24')]);if(_0x36ed73[_0x4921('0x25')]){delete _0x36ed73[_0x4921('0x25')];}_0x34ad61[_0x4921('0x18')](_0x3be401)[_0x4921('0x26')](_0x36ed73);};}exports[_0x4921('0x27')]=function(_0x4ed017,_0x8c8f7c){var _0x5b9878={},_0x392fba={},_0x3f6643={'count':0x0,'rows':[]};var _0x42a0ed=_[_0x4921('0x28')](db[_0x4921('0x29')]['rawAttributes'],function(_0x36c58e){return{'name':_0x36c58e[_0x4921('0x2a')],'type':_0x36c58e['type'][_0x4921('0x2b')]};});_0x392fba[_0x4921('0x2c')]=_['differenceBy'](_[_0x4921('0x28')](_0x42a0ed,'name'),[_0x4921('0x25')]);_0x392fba[_0x4921('0x2d')]=_[_0x4921('0x2e')](_0x4ed017['query']);_0x392fba['filters']=_[_0x4921('0x2f')](_0x392fba[_0x4921('0x2c')],_0x392fba[_0x4921('0x2d')]);_0x5b9878[_0x4921('0x30')]=_[_0x4921('0x2f')](_0x392fba[_0x4921('0x2c')],qs[_0x4921('0x31')](_0x4ed017[_0x4921('0x2d')][_0x4921('0x31')]));_0x5b9878['attributes']=_0x5b9878[_0x4921('0x30')][_0x4921('0x32')]?_0x5b9878[_0x4921('0x30')]:_0x392fba['model'];if(!_0x4ed017[_0x4921('0x2d')][_0x4921('0x33')](_0x4921('0x34'))){_0x5b9878[_0x4921('0x1d')]=qs[_0x4921('0x1d')](_0x4ed017['query'][_0x4921('0x1d')]);_0x5b9878['offset']=qs['offset'](_0x4ed017[_0x4921('0x2d')][_0x4921('0x1c')]);}_0x5b9878[_0x4921('0x35')]=qs[_0x4921('0x36')](_0x4ed017[_0x4921('0x2d')][_0x4921('0x36')]);_0x5b9878['where']=qs['filters'](_[_0x4921('0x37')](_0x4ed017[_0x4921('0x2d')],_0x392fba[_0x4921('0x38')]));if(_0x4ed017[_0x4921('0x2d')][_0x4921('0x39')]){_0x5b9878['where']=_[_0x4921('0x3a')](_0x5b9878[_0x4921('0x3b')],{'$or':_[_0x4921('0x28')](_0x42a0ed,function(_0x3ca2b4){if(_0x3ca2b4[_0x4921('0x3c')]!==_0x4921('0x3d')){var _0x47b516={};_0x47b516[_0x3ca2b4[_0x4921('0x25')]]={'$like':'%'+_0x4ed017[_0x4921('0x2d')][_0x4921('0x39')]+'%'};return _0x47b516;}})});}_0x5b9878=_[_0x4921('0x3a')]({},_0x5b9878,_0x4ed017[_0x4921('0x3e')]);var _0x2cc85c={'where':_0x5b9878[_0x4921('0x3b')]};return db[_0x4921('0x29')]['count'](_0x2cc85c)[_0x4921('0x22')](function(_0x21cd57){_0x3f6643[_0x4921('0x1b')]=_0x21cd57;if(_0x4ed017[_0x4921('0x2d')][_0x4921('0x3f')]){_0x5b9878[_0x4921('0x40')]=[{'all':!![]}];}return db[_0x4921('0x29')]['findAll'](_0x5b9878);})[_0x4921('0x22')](function(_0x26cad5){_0x3f6643[_0x4921('0x41')]=_0x26cad5;return _0x3f6643;})[_0x4921('0x22')](respondWithFilteredResult(_0x8c8f7c,_0x5b9878))[_0x4921('0x42')](handleError(_0x8c8f7c,null));};exports[_0x4921('0x43')]=function(_0x209947,_0x43889c){var _0x5d579e={'raw':!![],'where':{'id':_0x209947[_0x4921('0x44')]['id']}},_0x54331b={};_0x54331b[_0x4921('0x2c')]=_[_0x4921('0x2e')](db[_0x4921('0x29')][_0x4921('0x45')]);_0x54331b[_0x4921('0x2d')]=_[_0x4921('0x2e')](_0x209947[_0x4921('0x2d')]);_0x54331b[_0x4921('0x38')]=_['intersection'](_0x54331b['model'],_0x54331b[_0x4921('0x2d')]);_0x5d579e[_0x4921('0x30')]=_[_0x4921('0x2f')](_0x54331b[_0x4921('0x2c')],qs[_0x4921('0x31')](_0x209947['query'][_0x4921('0x31')]));_0x5d579e[_0x4921('0x30')]=_0x5d579e[_0x4921('0x30')][_0x4921('0x32')]?_0x5d579e[_0x4921('0x30')]:_0x54331b['model'];if(_0x209947[_0x4921('0x2d')][_0x4921('0x3f')]){_0x5d579e[_0x4921('0x40')]=[{'all':!![]}];}_0x5d579e=_['merge']({},_0x5d579e,_0x209947['options']);return db[_0x4921('0x29')]['find'](_0x5d579e)['then'](handleEntityNotFound(_0x43889c,null))[_0x4921('0x22')](respondWithResult(_0x43889c,null))[_0x4921('0x42')](handleError(_0x43889c,null));};exports[_0x4921('0x46')]=function(_0x1ecf3a,_0x561bbb){if(_0x1ecf3a[_0x4921('0x47')]['id']){delete _0x1ecf3a[_0x4921('0x47')]['id'];}return db[_0x4921('0x29')][_0x4921('0x48')]({'where':{'id':_0x1ecf3a[_0x4921('0x44')]['id']}})[_0x4921('0x22')](handleEntityNotFound(_0x561bbb,null))[_0x4921('0x22')](saveUpdates(_0x1ecf3a[_0x4921('0x47')],null))['then'](respondWithResult(_0x561bbb,null))[_0x4921('0x42')](handleError(_0x561bbb,null));};exports[_0x4921('0x21')]=function(_0x26c2af,_0x7e8cfc){return db['CmCustomField'][_0x4921('0x48')]({'where':{'id':_0x26c2af[_0x4921('0x44')]['id']}})[_0x4921('0x22')](handleEntityNotFound(_0x7e8cfc,null))[_0x4921('0x22')](removeEntity(_0x7e8cfc,null))['catch'](handleError(_0x7e8cfc,null));};exports['create']=function(_0x2419ee,_0x5f091b){var _0x3f9a08;return db[_0x4921('0x49')][_0x4921('0x4a')](function(_0xa33248){return db[_0x4921('0x29')][_0x4921('0x4b')](_0x2419ee[_0x4921('0x47')],{'transaction':_0xa33248})[_0x4921('0x22')](function(_0x306fbb){_0x3f9a08=_0x306fbb;var _0xd52253={'type':db['Sequelize']['TEXT'],'transaction':_0xa33248};switch(_0x2419ee[_0x4921('0x47')][_0x4921('0x3c')]){case'text':_0xd52253[_0x4921('0x3c')]=db['Sequelize']['TEXT'];break;case _0x4921('0x4c'):_0xd52253[_0x4921('0x3c')]=db[_0x4921('0x4d')]['INTEGER'];break;case'switch':_0xd52253['type']=db[_0x4921('0x4d')]['BOOLEAN'];_0xd52253['defaultValue']=![];break;default:}return db[_0x4921('0x49')][_0x4921('0x4e')][_0x4921('0x4f')]('cm_contacts',util[_0x4921('0x50')]('cf_%d',_0x3f9a08['id']),_0xd52253);})['then'](function(){return _0x3f9a08;});})[_0x4921('0x22')](respondWithResult(_0x5f091b,0xc9))['catch'](handleError(_0x5f091b,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index cfdf9f4..10685cc 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 _0xfd58=['exports','CmCustomField','cm_custom_fields','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x2b1163,_0x3229d5){var _0x2b9e8b=function(_0x115e19){while(--_0x115e19){_0x2b1163['push'](_0x2b1163['shift']());}};_0x2b9e8b(++_0x3229d5);}(_0xfd58,0xb3));var _0x8fd5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd58[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8fd5('0x0'));var util=require(_0x8fd5('0x1'));var logger=require('../../config/logger')(_0x8fd5('0x2'));var moment=require(_0x8fd5('0x3'));var BPromise=require('bluebird');var rp=require(_0x8fd5('0x4'));var fs=require('fs');var path=require(_0x8fd5('0x5'));var rimraf=require(_0x8fd5('0x6'));var config=require(_0x8fd5('0x7'));var attributes=require('./cmCustomField.attributes');module[_0x8fd5('0x8')]=function(_0x20bccc,_0x3790a4){return _0x20bccc['define'](_0x8fd5('0x9'),attributes,{'tableName':_0x8fd5('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdbd4=['rimraf','exports','define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x17e4f9,_0x4318be){var _0xf6cb46=function(_0x329493){while(--_0x329493){_0x17e4f9['push'](_0x17e4f9['shift']());}};_0xf6cb46(++_0x4318be);}(_0xdbd4,0x1e6));var _0x4dbd=function(_0x77b119,_0x90de1e){_0x77b119=_0x77b119-0x0;var _0x29595b=_0xdbd4[_0x77b119];return _0x29595b;};'use strict';var _=require(_0x4dbd('0x0'));var util=require(_0x4dbd('0x1'));var logger=require(_0x4dbd('0x2'))(_0x4dbd('0x3'));var moment=require(_0x4dbd('0x4'));var BPromise=require(_0x4dbd('0x5'));var rp=require(_0x4dbd('0x6'));var fs=require('fs');var path=require(_0x4dbd('0x7'));var rimraf=require(_0x4dbd('0x8'));var config=require('../../config/environment');var attributes=require('./cmCustomField.attributes');module[_0x4dbd('0x9')]=function(_0x2c6f11,_0x44afe8){return _0x2c6f11[_0x4dbd('0xa')](_0x4dbd('0xb'),attributes,{'tableName':_0x4dbd('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 67e8c4d..c01cfdf 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 _0xe13a=['code','message','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x482401,_0x5ac6e7){var _0x1e02df=function(_0x4dc63e){while(--_0x4dc63e){_0x482401['push'](_0x482401['shift']());}};_0x1e02df(++_0x5ac6e7);}(_0xe13a,0x178));var _0xae13=function(_0x493b99,_0x4a80a3){_0x493b99=_0x493b99-0x0;var _0x5ab373=_0xe13a[_0x493b99];return _0x5ab373;};'use strict';var _=require('lodash');var util=require(_0xae13('0x0'));var moment=require(_0xae13('0x1'));var BPromise=require(_0xae13('0x2'));var rs=require(_0xae13('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xae13('0x4'))['db'];var utils=require(_0xae13('0x5'));var logger=require(_0xae13('0x6'))(_0xae13('0x7'));var config=require(_0xae13('0x8'));var jayson=require(_0xae13('0x9'));var client=jayson[_0xae13('0xa')][_0xae13('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x341ba4,_0x4ae51f,_0x2f6d10){return new BPromise(function(_0x2b2e1f,_0x27fefd){return client[_0xae13('0xc')](_0x341ba4,_0x2f6d10)[_0xae13('0xd')](function(_0x41bf44){logger[_0xae13('0xe')](_0xae13('0xf'),_0x4ae51f,_0xae13('0x10'));logger['debug'](_0xae13('0x11'),_0x4ae51f,_0xae13('0x10'),JSON[_0xae13('0x12')](_0x41bf44));if(_0x41bf44[_0xae13('0x13')]){if(_0x41bf44[_0xae13('0x13')][_0xae13('0x14')]===0x1f4){logger[_0xae13('0x13')]('CmCustomField,\x20%s,\x20%s',_0x4ae51f,_0x41bf44[_0xae13('0x13')][_0xae13('0x15')]);return _0x27fefd(_0x41bf44['error']['message']);}logger['error']('CmCustomField,\x20%s,\x20%s',_0x4ae51f,_0x41bf44['error'][_0xae13('0x15')]);return _0x2b2e1f(_0x41bf44[_0xae13('0x13')][_0xae13('0x15')]);}else{logger[_0xae13('0xe')](_0xae13('0xf'),_0x4ae51f,_0xae13('0x10'));_0x2b2e1f(_0x41bf44['result'][_0xae13('0x15')]);}})['catch'](function(_0xe10aab){logger[_0xae13('0x13')](_0xae13('0xf'),_0x4ae51f,_0xe10aab);_0x27fefd(_0xe10aab);});});} \ No newline at end of file +var _0xc978=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xc978,0xcd));var _0x8c97=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc978[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8c97('0x0'));var util=require(_0x8c97('0x1'));var moment=require(_0x8c97('0x2'));var BPromise=require(_0x8c97('0x3'));var rs=require(_0x8c97('0x4'));var fs=require('fs');var Redis=require(_0x8c97('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8c97('0x6'));var logger=require(_0x8c97('0x7'))(_0x8c97('0x8'));var config=require(_0x8c97('0x9'));var jayson=require(_0x8c97('0xa'));var client=jayson[_0x8c97('0xb')][_0x8c97('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x524196,_0x41a511,_0x1b5864){return new BPromise(function(_0x332cd1,_0x26ff40){return client[_0x8c97('0xd')](_0x524196,_0x1b5864)[_0x8c97('0xe')](function(_0x17aef0){logger['info'](_0x8c97('0xf'),_0x41a511,_0x8c97('0x10'));logger[_0x8c97('0x11')](_0x8c97('0x12'),_0x41a511,_0x8c97('0x10'),JSON[_0x8c97('0x13')](_0x17aef0));if(_0x17aef0[_0x8c97('0x14')]){if(_0x17aef0[_0x8c97('0x14')][_0x8c97('0x15')]===0x1f4){logger['error'](_0x8c97('0xf'),_0x41a511,_0x17aef0[_0x8c97('0x14')]['message']);return _0x26ff40(_0x17aef0[_0x8c97('0x14')][_0x8c97('0x16')]);}logger['error'](_0x8c97('0xf'),_0x41a511,_0x17aef0['error']['message']);return _0x332cd1(_0x17aef0['error'][_0x8c97('0x16')]);}else{logger[_0x8c97('0x17')](_0x8c97('0xf'),_0x41a511,_0x8c97('0x10'));_0x332cd1(_0x17aef0[_0x8c97('0x18')][_0x8c97('0x16')]);}})[_0x8c97('0x19')](function(_0xe3be1){logger[_0x8c97('0x14')]('CmCustomField,\x20%s,\x20%s',_0x41a511,_0xe3be1);_0x26ff40(_0xe3be1);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 02af5bb..5e11c95 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 _0x4ca7=['exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','show','post','put','/:id','delete'];(function(_0x119280,_0x439c3e){var _0x481797=function(_0x4265cb){while(--_0x4265cb){_0x119280['push'](_0x119280['shift']());}};_0x481797(++_0x439c3e);}(_0x4ca7,0x14b));var _0x74ca=function(_0x5c7e6f,_0x22ab4e){_0x5c7e6f=_0x5c7e6f-0x0;var _0x345842=_0x4ca7[_0x5c7e6f];return _0x345842;};'use strict';var multer=require('multer');var util=require(_0x74ca('0x0'));var path=require('path');var timeout=require(_0x74ca('0x1'));var express=require(_0x74ca('0x2'));var router=express[_0x74ca('0x3')]();var auth=require(_0x74ca('0x4'));var interaction=require(_0x74ca('0x5'));var config=require(_0x74ca('0x6'));var controller=require('./cmCustomField.controller');router['get']('/',auth[_0x74ca('0x7')](),controller['index']);router[_0x74ca('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x74ca('0x9')]);router[_0x74ca('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0x74ca('0xb')](_0x74ca('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x74ca('0xd')]('/:id',auth[_0x74ca('0x7')](),controller['destroy']);module[_0x74ca('0xe')]=router; \ No newline at end of file +var _0x7d77=['multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports'];(function(_0x25533a,_0x2fea52){var _0x179861=function(_0x2f8513){while(--_0x2f8513){_0x25533a['push'](_0x25533a['shift']());}};_0x179861(++_0x2fea52);}(_0x7d77,0x11d));var _0x77d7=function(_0x27c24d,_0x2b50f1){_0x27c24d=_0x27c24d-0x0;var _0x14e722=_0x7d77[_0x27c24d];return _0x14e722;};'use strict';var multer=require(_0x77d7('0x0'));var util=require(_0x77d7('0x1'));var path=require(_0x77d7('0x2'));var timeout=require(_0x77d7('0x3'));var express=require('express');var router=express[_0x77d7('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x77d7('0x5'));var config=require(_0x77d7('0x6'));var controller=require(_0x77d7('0x7'));router[_0x77d7('0x8')]('/',auth[_0x77d7('0x9')](),controller[_0x77d7('0xa')]);router['get'](_0x77d7('0xb'),auth[_0x77d7('0x9')](),controller[_0x77d7('0xc')]);router[_0x77d7('0xd')]('/',auth[_0x77d7('0x9')](),controller[_0x77d7('0xe')]);router[_0x77d7('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x77d7('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x77d7('0x11')]);module[_0x77d7('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index dffb2da..c17f630 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 _0x84ab=['INTEGER','UNSIGNED','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1fef2b,_0x1b2067){var _0x35bbfc=function(_0x31c78b){while(--_0x31c78b){_0x1fef2b['push'](_0x1fef2b['shift']());}};_0x35bbfc(++_0x1b2067);}(_0x84ab,0x12f));var _0xb84a=function(_0x3fc97b,_0x20ca29){_0x3fc97b=_0x3fc97b-0x0;var _0x3a0c82=_0x84ab[_0x3fc97b];return _0x3a0c82;};'use strict';var moment=require(_0xb84a('0x0'));var Sequelize=require(_0xb84a('0x1'));module[_0xb84a('0x2')]={'phone':{'type':Sequelize[_0xb84a('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xb84a('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xb84a('0x5')](_0xb84a('0x6'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb84a('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb84a('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xb84a('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xb84a('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xb84a('0x7')],'unique':_0xb84a('0x9')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xb84a('0x9')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0xb84a('0x7')],'unique':_0xb84a('0x9')},'CampaignId':{'type':Sequelize[_0xb84a('0x7')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb84a('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb84a('0x7')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3c6c=['BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','contactListQueue','moment','exports','STRING'];(function(_0x15389f,_0x4dfdc0){var _0x2011ac=function(_0x6a00df){while(--_0x6a00df){_0x15389f['push'](_0x15389f['shift']());}};_0x2011ac(++_0x4dfdc0);}(_0x3c6c,0x7b));var _0xc3c6=function(_0xc1ab4f,_0x3484c0){_0xc1ab4f=_0xc1ab4f-0x0;var _0x5ae08c=_0x3c6c[_0xc1ab4f];return _0x5ae08c;};'use strict';var moment=require(_0xc3c6('0x0'));var Sequelize=require('sequelize');module[_0xc3c6('0x1')]={'phone':{'type':Sequelize[_0xc3c6('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xc3c6('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xc3c6('0x4')],'defaultValue':moment()[_0xc3c6('0x5')](_0xc3c6('0x6'))},'countbusyretry':{'type':Sequelize[_0xc3c6('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xc3c6('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0xc3c6('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xc3c6('0x4')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xc3c6('0x7')],'unique':_0xc3c6('0x8')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0xc3c6('0x7')],'unique':_0xc3c6('0x8')},'CampaignId':{'type':Sequelize[_0xc3c6('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0xc3c6('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xc3c6('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xc3c6('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xc3c6('0x7')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 7d74bd6..8599cc9 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 _0x1007=['preview','dialOrderByScheduledAt','sequelize','transaction','isEmpty','hopperIds','priority','ASC','scheduledAt','literal','DESC','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','LOCK','UPDATE','CmContact','Contact','CmCompany','Company','CmList','Queue','outbound','isNumber','error','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','html-pdf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','set','apply','save','update','destroy','then','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','concat','$lt','$lte','$eq','$between','$notBetween','$in','$notIn','$notLike','$like','$contains','$contained','$any','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','CmHopper','includeAll','include','params','intersection','length','create','body','catch','describe','find','CampaignId','VoiceQueueId','VoiceQueue','Campaign','omit','dataValues','state','statedesc','deleted','campaign','membername','UserId','user','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','queue','ivr','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','getVoiceQueues'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x1007,0x12d));var _0x7100=function(_0x55c38c,_0x48565a){_0x55c38c=_0x55c38c-0x0;var _0x18c1a7=_0x1007[_0x55c38c];return _0x18c1a7;};'use strict';var pdf=require(_0x7100('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7100('0x1'));var moment=require(_0x7100('0x2'));var BPromise=require(_0x7100('0x3'));var Mustache=require(_0x7100('0x4'));var util=require(_0x7100('0x5'));var path=require(_0x7100('0x6'));var sox=require('sox');var csv=require(_0x7100('0x7'));var ejs=require(_0x7100('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7100('0x9'));var crypto=require(_0x7100('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x7100('0xb'));var toCsv=require(_0x7100('0x7'));var querystring=require('querystring');var Papa=require(_0x7100('0xc'));var Redis=require(_0x7100('0xd'));var authService=require(_0x7100('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x7100('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7100('0x10'))(_0x7100('0x11'));var utils=require(_0x7100('0x12'));var config=require(_0x7100('0x13'));var db=require(_0x7100('0x14'))['db'];function respondWithStatusCode(_0x182c2e,_0x15171e){_0x15171e=_0x15171e||0xcc;return function(_0x12c1cb){if(_0x12c1cb){return _0x182c2e[_0x7100('0x15')](_0x15171e);}return _0x182c2e['status'](_0x15171e)[_0x7100('0x16')]();};}function respondWithResult(_0x1cd75c,_0x5556fa){_0x5556fa=_0x5556fa||0xc8;return function(_0x5e41df){if(_0x5e41df){return _0x1cd75c[_0x7100('0x17')](_0x5556fa)[_0x7100('0x18')](_0x5e41df);}};}function respondWithFilteredResult(_0x5f432d,_0x5592af){return function(_0x14d0de){if(_0x14d0de){var _0x373790=_0x14d0de[_0x7100('0x19')],_0x313373=_0x5592af[_0x7100('0x1a')],_0x2aabbb=_0x5592af['offset']+_0x5592af['limit'],_0x13624f;if(_0x2aabbb>=_0x373790){_0x2aabbb=_0x373790;_0x13624f=0xc8;}else{_0x13624f=0xce;}_0x5f432d['status'](_0x13624f);return _0x5f432d[_0x7100('0x1b')]('Content-Range',_0x313373+'-'+_0x2aabbb+'/'+_0x373790)['json'](_0x14d0de);}return null;};}function patchUpdates(_0x45d5ff){return function(_0x32de5a){try{jsonpatch[_0x7100('0x1c')](_0x32de5a,_0x45d5ff,!![]);}catch(_0x7c766d){return BPromise['reject'](_0x7c766d);}return _0x32de5a[_0x7100('0x1d')]();};}function saveUpdates(_0x1ad293,_0xe2ce3){return function(_0x47569d){if(_0x47569d){return _0x47569d[_0x7100('0x1e')](_0x1ad293)['then'](function(_0xdee32c){return _0xdee32c;});}return null;};}function removeEntity(_0x428eac,_0x75eeac){return function(_0x3ecf00){if(_0x3ecf00){return _0x3ecf00[_0x7100('0x1f')]()[_0x7100('0x20')](function(){_0x428eac[_0x7100('0x17')](0xcc)[_0x7100('0x16')]();});}};}function handleEntityNotFound(_0x4d5240,_0x293ad3){return function(_0x1efc99){if(!_0x1efc99){_0x4d5240['sendStatus'](0x194);}return _0x1efc99;};}function handleError(_0x22486b,_0x345911){_0x345911=_0x345911||0x1f4;return function(_0x45f18e){logger['error'](_0x45f18e['stack']);if(_0x45f18e[_0x7100('0x21')]){delete _0x45f18e[_0x7100('0x21')];}_0x22486b[_0x7100('0x17')](_0x345911)[_0x7100('0x22')](_0x45f18e);};}exports[_0x7100('0x23')]=function(_0x8734c8,_0x569909){var _0x38d170={},_0x38eee5={},_0x10287e={'count':0x0,'rows':[]};var _0x965076=_[_0x7100('0x24')](db['CmHopper'][_0x7100('0x25')],function(_0x38aa30){return{'name':_0x38aa30[_0x7100('0x26')],'type':_0x38aa30[_0x7100('0x27')][_0x7100('0x28')]};});_0x38eee5[_0x7100('0x29')]=_[_0x7100('0x24')](_0x965076,_0x7100('0x21'));_0x38eee5[_0x7100('0x2a')]=_[_0x7100('0x2b')](_0x8734c8[_0x7100('0x2a')]);_0x38eee5[_0x7100('0x2c')]=_['intersection'](_0x38eee5['model'],_0x38eee5[_0x7100('0x2a')]);_0x38eee5['filters']=_[_0x7100('0x2d')](_0x38eee5[_0x7100('0x2c')],['$and','$or','$gt','$gte',_0x7100('0x2e'),_0x7100('0x2f'),'$ne',_0x7100('0x30'),'$not',_0x7100('0x31'),_0x7100('0x32'),_0x7100('0x33'),_0x7100('0x34'),'$like',_0x7100('0x35'),'$iLike','$notILike',_0x7100('0x36'),'$overlap',_0x7100('0x37'),_0x7100('0x38'),_0x7100('0x39')]);_0x38d170[_0x7100('0x3a')]=_['intersection'](_0x38eee5['model'],qs[_0x7100('0x3b')](_0x8734c8[_0x7100('0x2a')][_0x7100('0x3b')]));_0x38d170[_0x7100('0x3a')]=_0x38d170[_0x7100('0x3a')]['length']?_0x38d170[_0x7100('0x3a')]:_0x38eee5[_0x7100('0x29')];if(!_0x8734c8[_0x7100('0x2a')][_0x7100('0x3c')](_0x7100('0x3d'))){_0x38d170['limit']=qs['limit'](_0x8734c8[_0x7100('0x2a')][_0x7100('0x3e')]);_0x38d170[_0x7100('0x1a')]=qs[_0x7100('0x1a')](_0x8734c8[_0x7100('0x2a')][_0x7100('0x1a')]);}_0x38d170[_0x7100('0x3f')]=qs[_0x7100('0x40')](_0x8734c8[_0x7100('0x2a')][_0x7100('0x40')]);_0x38d170[_0x7100('0x41')]=qs[_0x7100('0x2c')](_[_0x7100('0x42')](_0x8734c8['query'],_0x38eee5[_0x7100('0x2c')]));if(_0x8734c8[_0x7100('0x2a')]['filter']){_0x38d170['where']=_[_0x7100('0x43')](_0x38d170[_0x7100('0x41')],{'$or':_[_0x7100('0x24')](_0x965076,function(_0x28017e){if(_0x28017e[_0x7100('0x27')]!==_0x7100('0x44')){var _0x592853={};_0x592853[_0x28017e[_0x7100('0x21')]]={'$like':'%'+_0x8734c8[_0x7100('0x2a')][_0x7100('0x45')]+'%'};return _0x592853;}})});}_0x38d170=_[_0x7100('0x43')]({},_0x38d170,_0x8734c8[_0x7100('0x46')]);var _0x3fc894={'where':_0x38d170[_0x7100('0x41')]};return db[_0x7100('0x47')][_0x7100('0x19')](_0x3fc894)[_0x7100('0x20')](function(_0x331a81){_0x10287e['count']=_0x331a81;if(_0x8734c8['query'][_0x7100('0x48')]){_0x38d170[_0x7100('0x49')]=[{'all':!![]}];}return db[_0x7100('0x47')]['findAll'](_0x38d170);})['then'](function(_0x581722){_0x10287e['rows']=_0x581722;return _0x10287e;})['then'](respondWithFilteredResult(_0x569909,_0x38d170))['catch'](handleError(_0x569909,null));};exports['show']=function(_0xf1e8ae,_0x4075a1){var _0x22071f={'raw':!![],'where':{'id':_0xf1e8ae[_0x7100('0x4a')]['id']}},_0x4174b8={};_0x4174b8[_0x7100('0x29')]=_[_0x7100('0x2b')](db['CmHopper'][_0x7100('0x25')]);_0x4174b8[_0x7100('0x2a')]=_[_0x7100('0x2b')](_0xf1e8ae[_0x7100('0x2a')]);_0x4174b8[_0x7100('0x2c')]=_[_0x7100('0x4b')](_0x4174b8[_0x7100('0x29')],_0x4174b8['query']);_0x22071f[_0x7100('0x3a')]=_[_0x7100('0x4b')](_0x4174b8[_0x7100('0x29')],qs['fields'](_0xf1e8ae[_0x7100('0x2a')][_0x7100('0x3b')]));_0x22071f['attributes']=_0x22071f[_0x7100('0x3a')][_0x7100('0x4c')]?_0x22071f['attributes']:_0x4174b8[_0x7100('0x29')];if(_0xf1e8ae['query'][_0x7100('0x48')]){_0x22071f[_0x7100('0x49')]=[{'all':!![]}];}_0x22071f=_[_0x7100('0x43')]({},_0x22071f,_0xf1e8ae['options']);return db['CmHopper']['find'](_0x22071f)[_0x7100('0x20')](handleEntityNotFound(_0x4075a1,null))['then'](respondWithResult(_0x4075a1,null))['catch'](handleError(_0x4075a1,null));};exports['create']=function(_0x354dfd,_0x171ced){return db[_0x7100('0x47')][_0x7100('0x4d')](_0x354dfd[_0x7100('0x4e')],{})[_0x7100('0x20')](respondWithResult(_0x171ced,0xc9))[_0x7100('0x4f')](handleError(_0x171ced,null));};exports[_0x7100('0x1e')]=function(_0x3e3f19,_0x3b8995){if(_0x3e3f19['body']['id']){delete _0x3e3f19[_0x7100('0x4e')]['id'];}return db['CmHopper']['find']({'where':{'id':_0x3e3f19[_0x7100('0x4a')]['id']}})[_0x7100('0x20')](handleEntityNotFound(_0x3b8995,null))[_0x7100('0x20')](saveUpdates(_0x3e3f19[_0x7100('0x4e')],null))[_0x7100('0x20')](respondWithResult(_0x3b8995,null))[_0x7100('0x4f')](handleError(_0x3b8995,null));};exports[_0x7100('0x50')]=function(_0x119bc3,_0x1fedce){return db['CmHopper'][_0x7100('0x50')]()[_0x7100('0x20')](respondWithResult(_0x1fedce,null))[_0x7100('0x4f')](handleError(_0x1fedce,null));};exports['destroy']=function(_0x3d27e9,_0x2f9fde){var _0x1dff42;return db['CmHopper'][_0x7100('0x51')]({'where':{'id':_0x3d27e9[_0x7100('0x4a')]['id']}})[_0x7100('0x20')](handleEntityNotFound(_0x2f9fde,null))['then'](function(_0xb9a60b){if(_0xb9a60b){return _0xb9a60b[_0x7100('0x1f')]()[_0x7100('0x20')](function(_0x3cae02){return _0x3cae02;});}})[_0x7100('0x20')](function(_0x6f29e9){_0x1dff42=_0x6f29e9;if(_0x6f29e9){if(_0x6f29e9['VoiceQueueId']||_0x6f29e9[_0x7100('0x52')]){return db[_0x6f29e9[_0x7100('0x53')]?_0x7100('0x54'):_0x7100('0x55')]['find']({'where':{'id':_0x6f29e9[_0x7100('0x53')]?_0x6f29e9[_0x7100('0x53')]:_0x6f29e9['CampaignId']},'attributes':['id',_0x7100('0x21')],'raw':!![]});}}})[_0x7100('0x20')](function(_0x5b897e){var _0x59dc4e={};if(_0x5b897e){_[_0x7100('0x43')](_0x59dc4e,_[_0x7100('0x56')](_0x1dff42[_0x7100('0x57')],['createdAt','updatedAt','id']));_0x59dc4e[_0x7100('0x58')]=0x15;_0x59dc4e[_0x7100('0x59')]=_0x7100('0x5a');_0x59dc4e[_0x7100('0x5b')]=_0x5b897e[_0x7100('0x21')];_0x59dc4e[_0x7100('0x5c')]=_0x3d27e9['user']['name'];_0x59dc4e[_0x7100('0x5d')]=_0x3d27e9[_0x7100('0x5e')]['id'];_0x59dc4e[_0x7100('0x5a')]=!![];_0x59dc4e['deletedat']=moment()[_0x7100('0x5f')](_0x7100('0x60'));_0x59dc4e[_0x7100('0x61')]=_0x1dff42['phone'];_0x59dc4e[_0x7100('0x62')]=_0x1dff42[_0x7100('0x53')]?_0x7100('0x63'):_0x7100('0x64');return db['CmContact'][_0x7100('0x51')]({'where':{'id':_0x59dc4e[_0x7100('0x65')]},'attributes':[_0x7100('0x66'),_0x7100('0x67')]})[_0x7100('0x20')](function(_0x3d9b67){if(!_[_0x7100('0x68')](_0x2f9fde)&&!_[_0x7100('0x68')](_0x3d9b67[_0x7100('0x66')])){_0x59dc4e[_0x7100('0x69')]=_0x3d9b67[_0x7100('0x66')];if(!_[_0x7100('0x68')](_0x3d9b67[_0x7100('0x67')])){_0x59dc4e[_0x7100('0x69')]+='\x20'+_0x3d9b67[_0x7100('0x67')];}}})[_0x7100('0x6a')](function(){return db[_0x7100('0x6b')][_0x7100('0x4d')](_0x59dc4e);});}})[_0x7100('0x20')](function(){return _0x2f9fde['status'](0xcc)[_0x7100('0x16')]();})[_0x7100('0x4f')](handleError(_0x2f9fde,null));};exports[_0x7100('0x6c')]=function(_0x14c334,_0x28b7f4,_0x3ff868){var _0x53f19e=[];return db['CmContact']['describe']()[_0x7100('0x20')](function(_0xfe90ca){_0x53f19e=_[_0x7100('0x2b')](_0xfe90ca);return _0x14c334[_0x7100('0x5e')][_0x7100('0x6d')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x7100('0x6e')},'attributes':['id',_0x7100('0x6f')],'raw':!![]});})[_0x7100('0x20')](function(_0x351ca9){if(_0x351ca9&&_0x351ca9[_0x7100('0x4c')]){return db[_0x7100('0x70')][_0x7100('0x71')](function(_0x4c01fc){var _0x442f4f={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x7100('0x5f')](_0x7100('0x60'))},'VoiceQueueId':{'$in':_[_0x7100('0x24')](_0x351ca9,'id')},'$or':[{'UserId':null},{'UserId':_0x14c334['user']['id']}]};var _0x55dc85=[];if(_0x14c334[_0x7100('0x4e')]['direction']&&_0x14c334[_0x7100('0x4e')]['direction']==='prev'){if(!_[_0x7100('0x72')](_0x14c334[_0x7100('0x4e')]['hopperIds'])){_0x442f4f['id']={'$in':_0x14c334['body'][_0x7100('0x73')]};}_0x55dc85=[[_0x7100('0x74'),_0x7100('0x75')],[_0x7100('0x76'),_0x351ca9[0x0][_0x7100('0x6f')]==='ASC'?'DESC':'ASC'],db[_0x7100('0x70')][_0x7100('0x77')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x7100('0x78')]];}else{if(!_[_0x7100('0x72')](_0x14c334[_0x7100('0x4e')][_0x7100('0x73')])){_0x442f4f['id']={'$notIn':_0x14c334[_0x7100('0x4e')]['hopperIds']};}_0x55dc85=[['priority',_0x7100('0x78')],[_0x7100('0x76'),_0x351ca9[0x0][_0x7100('0x6f')]],db[_0x7100('0x70')][_0x7100('0x77')](_0x7100('0x79')),['id',_0x7100('0x75')]];}return db[_0x7100('0x47')]['findOne']({'attributes':['id',_0x7100('0x7a')],'where':_0x442f4f,'order':_0x55dc85,'transaction':_0x4c01fc,'lock':_0x4c01fc[_0x7100('0x7b')][_0x7100('0x7c')],'include':[{'model':db[_0x7100('0x7d')],'as':_0x7100('0x7e'),'attributes':_0x53f19e,'include':[{'model':db[_0x7100('0x7f')],'as':_0x7100('0x80'),'attributes':['id',_0x7100('0x21')]}]},{'model':db[_0x7100('0x81')],'as':'List','attributes':['id',_0x7100('0x21')]},{'model':db[_0x7100('0x54')],'as':_0x7100('0x82'),'attributes':['id','name','dialActive']}]})[_0x7100('0x20')](function(_0x14382c){if(_0x14382c){return _0x14382c[_0x7100('0x1e')]({'UserId':_0x14c334[_0x7100('0x5e')]['id']},{'transaction':_0x4c01fc});}});});}})[_0x7100('0x20')](handleEntityNotFound(_0x28b7f4,null))[_0x7100('0x20')](respondWithResult(_0x28b7f4,null))[_0x7100('0x4f')](handleError(_0x28b7f4,null));};exports['getOpenContacts']=function(_0x1d0d15,_0x28ce3e,_0x3c8aff){return _0x1d0d15[_0x7100('0x5e')][_0x7100('0x6d')]({'where':{'type':_0x7100('0x83'),'dialActive':!![],'dialMethod':_0x7100('0x6e')},'attributes':['id'],'raw':!![]})['then'](function(_0x149cc9){if(_0x149cc9&&_0x149cc9[_0x7100('0x4c')]){return db['CmHopper'][_0x7100('0x19')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x7100('0x5f')](_0x7100('0x60'))},'VoiceQueueId':{'$in':_[_0x7100('0x24')](_0x149cc9,'id')},'$or':[{'UserId':null},{'UserId':_0x1d0d15[_0x7100('0x5e')]['id']}]}});}return 0x0;})['then'](function(_0x6993b9){if(!_[_0x7100('0x68')](_0x6993b9)&&_[_0x7100('0x84')](_0x6993b9)){return _0x28ce3e[_0x7100('0x17')](0xc8)[_0x7100('0x18')]({'contacts':_0x6993b9});}else{logger[_0x7100('0x85')](_0x7100('0x86'),_0x7100('0x87'),0x194,_0x7100('0x88'));_0x28ce3e[_0x7100('0x15')](0x194);}})[_0x7100('0x4f')](handleError(_0x28ce3e,null));}; \ No newline at end of file +var _0x6f6e=['DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','dialOrderByScheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','Contact','Company','CmList','Queue','preview','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','html-pdf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','concat','$gt','$gte','$lt','$eq','$not','$between','$in','$notIn','$notLike','$iLike','$notILike','$like','$contains','$contained','attributes','fields','length','nolimit','sort','filter','merge','where','VIRTUAL','includeAll','findAll','catch','show','include','find','create','body','describe','CampaignId','VoiceQueueId','VoiceQueue','Campaign','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','campaigntype','queue','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','getVoiceQueues','outbound','sequelize','transaction','direction','isEmpty','hopperIds','priority','ASC'];(function(_0x537bcd,_0x13bae1){var _0x6cc881=function(_0x3d470f){while(--_0x3d470f){_0x537bcd['push'](_0x537bcd['shift']());}};_0x6cc881(++_0x13bae1);}(_0x6f6e,0x1b4));var _0xe6f6=function(_0x41d677,_0x17ad95){_0x41d677=_0x41d677-0x0;var _0x507986=_0x6f6e[_0x41d677];return _0x507986;};'use strict';var pdf=require(_0xe6f6('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe6f6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe6f6('0x2'));var moment=require('moment');var BPromise=require(_0xe6f6('0x3'));var Mustache=require(_0xe6f6('0x4'));var util=require(_0xe6f6('0x5'));var path=require(_0xe6f6('0x6'));var sox=require('sox');var csv=require(_0xe6f6('0x7'));var ejs=require(_0xe6f6('0x8'));var fs=require('fs');var _=require(_0xe6f6('0x9'));var squel=require(_0xe6f6('0xa'));var crypto=require(_0xe6f6('0xb'));var jsforce=require(_0xe6f6('0xc'));var deskjs=require(_0xe6f6('0xd'));var toCsv=require(_0xe6f6('0x7'));var querystring=require(_0xe6f6('0xe'));var Papa=require(_0xe6f6('0xf'));var Redis=require('ioredis');var authService=require(_0xe6f6('0x10'));var qs=require(_0xe6f6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe6f6('0x12'));var logger=require(_0xe6f6('0x13'))(_0xe6f6('0x14'));var utils=require(_0xe6f6('0x15'));var config=require(_0xe6f6('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8a37b5,_0x4a8073){_0x4a8073=_0x4a8073||0xcc;return function(_0x116361){if(_0x116361){return _0x8a37b5['sendStatus'](_0x4a8073);}return _0x8a37b5[_0xe6f6('0x17')](_0x4a8073)[_0xe6f6('0x18')]();};}function respondWithResult(_0x3fe8a5,_0x239c75){_0x239c75=_0x239c75||0xc8;return function(_0x554f82){if(_0x554f82){return _0x3fe8a5['status'](_0x239c75)[_0xe6f6('0x19')](_0x554f82);}};}function respondWithFilteredResult(_0x5d891e,_0x3be6be){return function(_0x2300b8){if(_0x2300b8){var _0x252b8a=_0x2300b8[_0xe6f6('0x1a')],_0x441f76=_0x3be6be[_0xe6f6('0x1b')],_0x77d41c=_0x3be6be['offset']+_0x3be6be[_0xe6f6('0x1c')],_0x9d3d44;if(_0x77d41c>=_0x252b8a){_0x77d41c=_0x252b8a;_0x9d3d44=0xc8;}else{_0x9d3d44=0xce;}_0x5d891e[_0xe6f6('0x17')](_0x9d3d44);return _0x5d891e['set'](_0xe6f6('0x1d'),_0x441f76+'-'+_0x77d41c+'/'+_0x252b8a)[_0xe6f6('0x19')](_0x2300b8);}return null;};}function patchUpdates(_0x1fa792){return function(_0x18b573){try{jsonpatch[_0xe6f6('0x1e')](_0x18b573,_0x1fa792,!![]);}catch(_0x3eb527){return BPromise[_0xe6f6('0x1f')](_0x3eb527);}return _0x18b573[_0xe6f6('0x20')]();};}function saveUpdates(_0x4b5caa,_0x35e4f3){return function(_0x2761f1){if(_0x2761f1){return _0x2761f1[_0xe6f6('0x21')](_0x4b5caa)[_0xe6f6('0x22')](function(_0x3c2dbb){return _0x3c2dbb;});}return null;};}function removeEntity(_0x4c6b12,_0x36c9fb){return function(_0xfbfbf6){if(_0xfbfbf6){return _0xfbfbf6[_0xe6f6('0x23')]()[_0xe6f6('0x22')](function(){_0x4c6b12[_0xe6f6('0x17')](0xcc)[_0xe6f6('0x18')]();});}};}function handleEntityNotFound(_0x58130c,_0x251d9b){return function(_0xf33cf8){if(!_0xf33cf8){_0x58130c[_0xe6f6('0x24')](0x194);}return _0xf33cf8;};}function handleError(_0x159f37,_0x428db4){_0x428db4=_0x428db4||0x1f4;return function(_0x1d35cf){logger[_0xe6f6('0x25')](_0x1d35cf[_0xe6f6('0x26')]);if(_0x1d35cf[_0xe6f6('0x27')]){delete _0x1d35cf[_0xe6f6('0x27')];}_0x159f37[_0xe6f6('0x17')](_0x428db4)[_0xe6f6('0x28')](_0x1d35cf);};}exports[_0xe6f6('0x29')]=function(_0x496703,_0x5f47d1){var _0x3f759d={},_0xc910fd={},_0x5ae2af={'count':0x0,'rows':[]};var _0x42168b=_[_0xe6f6('0x2a')](db[_0xe6f6('0x2b')][_0xe6f6('0x2c')],function(_0x2ad6ad){return{'name':_0x2ad6ad[_0xe6f6('0x2d')],'type':_0x2ad6ad[_0xe6f6('0x2e')][_0xe6f6('0x2f')]};});_0xc910fd[_0xe6f6('0x30')]=_['map'](_0x42168b,'name');_0xc910fd['query']=_[_0xe6f6('0x31')](_0x496703[_0xe6f6('0x32')]);_0xc910fd[_0xe6f6('0x33')]=_[_0xe6f6('0x34')](_0xc910fd[_0xe6f6('0x30')],_0xc910fd[_0xe6f6('0x32')]);_0xc910fd[_0xe6f6('0x33')]=_[_0xe6f6('0x35')](_0xc910fd[_0xe6f6('0x33')],['$and','$or',_0xe6f6('0x36'),_0xe6f6('0x37'),_0xe6f6('0x38'),'$lte','$ne',_0xe6f6('0x39'),_0xe6f6('0x3a'),_0xe6f6('0x3b'),'$notBetween',_0xe6f6('0x3c'),_0xe6f6('0x3d'),'$like',_0xe6f6('0x3e'),_0xe6f6('0x3f'),_0xe6f6('0x40'),_0xe6f6('0x41'),'$overlap',_0xe6f6('0x42'),_0xe6f6('0x43'),'$any']);_0x3f759d[_0xe6f6('0x44')]=_['intersection'](_0xc910fd[_0xe6f6('0x30')],qs['fields'](_0x496703[_0xe6f6('0x32')][_0xe6f6('0x45')]));_0x3f759d['attributes']=_0x3f759d[_0xe6f6('0x44')][_0xe6f6('0x46')]?_0x3f759d[_0xe6f6('0x44')]:_0xc910fd['model'];if(!_0x496703[_0xe6f6('0x32')]['hasOwnProperty'](_0xe6f6('0x47'))){_0x3f759d[_0xe6f6('0x1c')]=qs[_0xe6f6('0x1c')](_0x496703[_0xe6f6('0x32')][_0xe6f6('0x1c')]);_0x3f759d['offset']=qs['offset'](_0x496703[_0xe6f6('0x32')][_0xe6f6('0x1b')]);}_0x3f759d['order']=qs[_0xe6f6('0x48')](_0x496703['query'][_0xe6f6('0x48')]);_0x3f759d['where']=qs[_0xe6f6('0x33')](_['pick'](_0x496703['query'],_0xc910fd[_0xe6f6('0x33')]));if(_0x496703[_0xe6f6('0x32')][_0xe6f6('0x49')]){_0x3f759d['where']=_[_0xe6f6('0x4a')](_0x3f759d[_0xe6f6('0x4b')],{'$or':_[_0xe6f6('0x2a')](_0x42168b,function(_0x102cef){if(_0x102cef[_0xe6f6('0x2e')]!==_0xe6f6('0x4c')){var _0x14e54a={};_0x14e54a[_0x102cef[_0xe6f6('0x27')]]={'$like':'%'+_0x496703[_0xe6f6('0x32')][_0xe6f6('0x49')]+'%'};return _0x14e54a;}})});}_0x3f759d=_[_0xe6f6('0x4a')]({},_0x3f759d,_0x496703['options']);var _0x255959={'where':_0x3f759d[_0xe6f6('0x4b')]};return db[_0xe6f6('0x2b')][_0xe6f6('0x1a')](_0x255959)[_0xe6f6('0x22')](function(_0x51ee5a){_0x5ae2af[_0xe6f6('0x1a')]=_0x51ee5a;if(_0x496703['query'][_0xe6f6('0x4d')]){_0x3f759d['include']=[{'all':!![]}];}return db[_0xe6f6('0x2b')][_0xe6f6('0x4e')](_0x3f759d);})[_0xe6f6('0x22')](function(_0x36ca4e){_0x5ae2af['rows']=_0x36ca4e;return _0x5ae2af;})[_0xe6f6('0x22')](respondWithFilteredResult(_0x5f47d1,_0x3f759d))[_0xe6f6('0x4f')](handleError(_0x5f47d1,null));};exports[_0xe6f6('0x50')]=function(_0x3311db,_0x27bca8){var _0x3dcf92={'raw':!![],'where':{'id':_0x3311db['params']['id']}},_0x47f8d3={};_0x47f8d3[_0xe6f6('0x30')]=_[_0xe6f6('0x31')](db['CmHopper'][_0xe6f6('0x2c')]);_0x47f8d3['query']=_[_0xe6f6('0x31')](_0x3311db[_0xe6f6('0x32')]);_0x47f8d3[_0xe6f6('0x33')]=_[_0xe6f6('0x34')](_0x47f8d3['model'],_0x47f8d3[_0xe6f6('0x32')]);_0x3dcf92['attributes']=_[_0xe6f6('0x34')](_0x47f8d3[_0xe6f6('0x30')],qs['fields'](_0x3311db[_0xe6f6('0x32')]['fields']));_0x3dcf92[_0xe6f6('0x44')]=_0x3dcf92[_0xe6f6('0x44')]['length']?_0x3dcf92['attributes']:_0x47f8d3[_0xe6f6('0x30')];if(_0x3311db[_0xe6f6('0x32')][_0xe6f6('0x4d')]){_0x3dcf92[_0xe6f6('0x51')]=[{'all':!![]}];}_0x3dcf92=_[_0xe6f6('0x4a')]({},_0x3dcf92,_0x3311db['options']);return db[_0xe6f6('0x2b')][_0xe6f6('0x52')](_0x3dcf92)['then'](handleEntityNotFound(_0x27bca8,null))['then'](respondWithResult(_0x27bca8,null))[_0xe6f6('0x4f')](handleError(_0x27bca8,null));};exports[_0xe6f6('0x53')]=function(_0xdeb9f5,_0x33facd){return db[_0xe6f6('0x2b')][_0xe6f6('0x53')](_0xdeb9f5[_0xe6f6('0x54')],{})[_0xe6f6('0x22')](respondWithResult(_0x33facd,0xc9))[_0xe6f6('0x4f')](handleError(_0x33facd,null));};exports['update']=function(_0x593f82,_0x35b356){if(_0x593f82[_0xe6f6('0x54')]['id']){delete _0x593f82[_0xe6f6('0x54')]['id'];}return db[_0xe6f6('0x2b')][_0xe6f6('0x52')]({'where':{'id':_0x593f82['params']['id']}})[_0xe6f6('0x22')](handleEntityNotFound(_0x35b356,null))[_0xe6f6('0x22')](saveUpdates(_0x593f82['body'],null))[_0xe6f6('0x22')](respondWithResult(_0x35b356,null))[_0xe6f6('0x4f')](handleError(_0x35b356,null));};exports[_0xe6f6('0x55')]=function(_0x32255d,_0x1b189e){return db[_0xe6f6('0x2b')][_0xe6f6('0x55')]()[_0xe6f6('0x22')](respondWithResult(_0x1b189e,null))[_0xe6f6('0x4f')](handleError(_0x1b189e,null));};exports[_0xe6f6('0x23')]=function(_0x47304d,_0x1f3592){var _0x228299;return db[_0xe6f6('0x2b')][_0xe6f6('0x52')]({'where':{'id':_0x47304d['params']['id']}})[_0xe6f6('0x22')](handleEntityNotFound(_0x1f3592,null))[_0xe6f6('0x22')](function(_0x13b457){if(_0x13b457){return _0x13b457[_0xe6f6('0x23')]()['then'](function(_0x5dc013){return _0x5dc013;});}})[_0xe6f6('0x22')](function(_0x216331){_0x228299=_0x216331;if(_0x216331){if(_0x216331['VoiceQueueId']||_0x216331[_0xe6f6('0x56')]){return db[_0x216331[_0xe6f6('0x57')]?_0xe6f6('0x58'):_0xe6f6('0x59')][_0xe6f6('0x52')]({'where':{'id':_0x216331[_0xe6f6('0x57')]?_0x216331['VoiceQueueId']:_0x216331[_0xe6f6('0x56')]},'attributes':['id',_0xe6f6('0x27')],'raw':!![]});}}})[_0xe6f6('0x22')](function(_0x177c14){var _0x510f2e={};if(_0x177c14){_[_0xe6f6('0x4a')](_0x510f2e,_['omit'](_0x228299[_0xe6f6('0x5a')],[_0xe6f6('0x5b'),_0xe6f6('0x5c'),'id']));_0x510f2e[_0xe6f6('0x5d')]=0x15;_0x510f2e[_0xe6f6('0x5e')]=_0xe6f6('0x5f');_0x510f2e[_0xe6f6('0x60')]=_0x177c14[_0xe6f6('0x27')];_0x510f2e[_0xe6f6('0x61')]=_0x47304d[_0xe6f6('0x62')][_0xe6f6('0x27')];_0x510f2e['UserId']=_0x47304d[_0xe6f6('0x62')]['id'];_0x510f2e[_0xe6f6('0x5f')]=!![];_0x510f2e[_0xe6f6('0x63')]=moment()[_0xe6f6('0x64')](_0xe6f6('0x65'));_0x510f2e['calleridnum']=_0x228299['phone'];_0x510f2e[_0xe6f6('0x66')]=_0x228299['VoiceQueueId']?_0xe6f6('0x67'):'ivr';return db[_0xe6f6('0x68')][_0xe6f6('0x52')]({'where':{'id':_0x510f2e[_0xe6f6('0x69')]},'attributes':[_0xe6f6('0x6a'),_0xe6f6('0x6b')]})['then'](function(_0xe17ef4){if(!_['isNil'](_0x1f3592)&&!_[_0xe6f6('0x6c')](_0xe17ef4[_0xe6f6('0x6a')])){_0x510f2e[_0xe6f6('0x6d')]=_0xe17ef4['firstName'];if(!_[_0xe6f6('0x6c')](_0xe17ef4['lastName'])){_0x510f2e[_0xe6f6('0x6d')]+='\x20'+_0xe17ef4[_0xe6f6('0x6b')];}}})[_0xe6f6('0x6e')](function(){return db['CmHopperFinal'][_0xe6f6('0x53')](_0x510f2e);});}})[_0xe6f6('0x22')](function(){return _0x1f3592[_0xe6f6('0x17')](0xcc)[_0xe6f6('0x18')]();})[_0xe6f6('0x4f')](handleError(_0x1f3592,null));};exports['getPreview']=function(_0x28b803,_0x4d05fb,_0x31e15c){var _0x3668d0=[];return db[_0xe6f6('0x68')]['describe']()[_0xe6f6('0x22')](function(_0x5c4d20){_0x3668d0=_[_0xe6f6('0x31')](_0x5c4d20);return _0x28b803['user'][_0xe6f6('0x6f')]({'where':{'type':_0xe6f6('0x70'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})['then'](function(_0x4342db){if(_0x4342db&&_0x4342db[_0xe6f6('0x46')]){return db[_0xe6f6('0x71')][_0xe6f6('0x72')](function(_0x350467){var _0x1a57aa={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xe6f6('0x65'))},'VoiceQueueId':{'$in':_[_0xe6f6('0x2a')](_0x4342db,'id')},'$or':[{'UserId':null},{'UserId':_0x28b803['user']['id']}]};var _0x22b830=[];if(_0x28b803['body'][_0xe6f6('0x73')]&&_0x28b803[_0xe6f6('0x54')][_0xe6f6('0x73')]==='prev'){if(!_[_0xe6f6('0x74')](_0x28b803[_0xe6f6('0x54')][_0xe6f6('0x75')])){_0x1a57aa['id']={'$in':_0x28b803[_0xe6f6('0x54')][_0xe6f6('0x75')]};}_0x22b830=[[_0xe6f6('0x76'),_0xe6f6('0x77')],['scheduledAt',_0x4342db[0x0]['dialOrderByScheduledAt']===_0xe6f6('0x77')?_0xe6f6('0x78'):_0xe6f6('0x77')],db[_0xe6f6('0x71')][_0xe6f6('0x79')](_0xe6f6('0x7a')),['id',_0xe6f6('0x78')]];}else{if(!_[_0xe6f6('0x74')](_0x28b803[_0xe6f6('0x54')]['hopperIds'])){_0x1a57aa['id']={'$notIn':_0x28b803['body']['hopperIds']};}_0x22b830=[[_0xe6f6('0x76'),'DESC'],[_0xe6f6('0x7b'),_0x4342db[0x0][_0xe6f6('0x7c')]],db['sequelize'][_0xe6f6('0x79')](_0xe6f6('0x7d')),['id',_0xe6f6('0x77')]];}return db[_0xe6f6('0x2b')][_0xe6f6('0x7e')]({'attributes':['id',_0xe6f6('0x7f')],'where':_0x1a57aa,'order':_0x22b830,'transaction':_0x350467,'lock':_0x350467[_0xe6f6('0x80')][_0xe6f6('0x81')],'include':[{'model':db['CmContact'],'as':_0xe6f6('0x82'),'attributes':_0x3668d0,'include':[{'model':db['CmCompany'],'as':_0xe6f6('0x83'),'attributes':['id',_0xe6f6('0x27')]}]},{'model':db[_0xe6f6('0x84')],'as':'List','attributes':['id',_0xe6f6('0x27')]},{'model':db[_0xe6f6('0x58')],'as':_0xe6f6('0x85'),'attributes':['id',_0xe6f6('0x27'),'dialActive']}]})[_0xe6f6('0x22')](function(_0x1d3f2b){if(_0x1d3f2b){return _0x1d3f2b[_0xe6f6('0x21')]({'UserId':_0x28b803['user']['id']},{'transaction':_0x350467});}});});}})[_0xe6f6('0x22')](handleEntityNotFound(_0x4d05fb,null))['then'](respondWithResult(_0x4d05fb,null))[_0xe6f6('0x4f')](handleError(_0x4d05fb,null));};exports['getOpenContacts']=function(_0x14ec38,_0x6ec47f,_0xf240bb){return _0x14ec38[_0xe6f6('0x62')][_0xe6f6('0x6f')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xe6f6('0x86')},'attributes':['id'],'raw':!![]})[_0xe6f6('0x22')](function(_0x352f76){if(_0x352f76&&_0x352f76[_0xe6f6('0x46')]){return db['CmHopper'][_0xe6f6('0x1a')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xe6f6('0x2a')](_0x352f76,'id')},'$or':[{'UserId':null},{'UserId':_0x14ec38[_0xe6f6('0x62')]['id']}]}});}return 0x0;})['then'](function(_0x466c37){if(!_[_0xe6f6('0x6c')](_0x466c37)&&_[_0xe6f6('0x87')](_0x466c37)){return _0x6ec47f[_0xe6f6('0x17')](0xc8)['json']({'contacts':_0x466c37});}else{logger[_0xe6f6('0x25')](_0xe6f6('0x88'),_0xe6f6('0x89'),0x194,_0xe6f6('0x8a'));_0x6ec47f[_0xe6f6('0x24')](0x194);}})[_0xe6f6('0x4f')](handleError(_0x6ec47f,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index a5caedd..06cc546 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 _0xfa93=['rimraf','../../config/environment','./cmHopper.attributes','exports','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xfa93,0x129));var _0x3fa9=function(_0x1766bf,_0x47a3d6){_0x1766bf=_0x1766bf-0x0;var _0x4d67f6=_0xfa93[_0x1766bf];return _0x4d67f6;};'use strict';var _=require(_0x3fa9('0x0'));var util=require(_0x3fa9('0x1'));var logger=require(_0x3fa9('0x2'))(_0x3fa9('0x3'));var moment=require(_0x3fa9('0x4'));var BPromise=require(_0x3fa9('0x5'));var rp=require(_0x3fa9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3fa9('0x7'));var config=require(_0x3fa9('0x8'));var attributes=require(_0x3fa9('0x9'));module[_0x3fa9('0xa')]=function(_0x4d7970,_0x382246){return _0x4d7970['define'](_0x3fa9('0xb'),attributes,{'tableName':_0x3fa9('0xc'),'paranoid':![],'indexes':[{'name':_0x3fa9('0xd'),'fields':[_0x3fa9('0xd')]},{'name':'phone','fields':[_0x3fa9('0xe')]},{'name':_0x3fa9('0xf'),'fields':[_0x3fa9('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x67cf=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./cmHopper.attributes','exports','CmHopper','cm_hopper','scheduledat','phone','priority'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x67cf,0x1d1));var _0xf67c=function(_0x9df3d8,_0x4074e3){_0x9df3d8=_0x9df3d8-0x0;var _0x366da1=_0x67cf[_0x9df3d8];return _0x366da1;};'use strict';var _=require(_0xf67c('0x0'));var util=require(_0xf67c('0x1'));var logger=require(_0xf67c('0x2'))(_0xf67c('0x3'));var moment=require(_0xf67c('0x4'));var BPromise=require(_0xf67c('0x5'));var rp=require(_0xf67c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf67c('0x7'));var config=require('../../config/environment');var attributes=require(_0xf67c('0x8'));module[_0xf67c('0x9')]=function(_0x29d24f,_0x192fc9){return _0x29d24f['define'](_0xf67c('0xa'),attributes,{'tableName':_0xf67c('0xb'),'paranoid':![],'indexes':[{'name':_0xf67c('0xc'),'fields':['scheduledat']},{'name':'phone','fields':[_0xf67c('0xd')]},{'name':_0xf67c('0xe'),'fields':[_0xf67c('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 0b80d0b..e568b7e 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 _0xb10b=['order','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','length','push','CmHopperFinal','MoveContactManagedDialer','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','all','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopper,\x20%s,\x20%s','CmHopper,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','include','map','model','debug','catch','ShowCmHopper','CreateCmHopper','create','body','update','limit','UpdateCmHopper','destroy','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb10b,0x12a));var _0xbb10=function(_0x11731f,_0x2271b5){_0x11731f=_0x11731f-0x0;var _0x14587c=_0xb10b[_0x11731f];return _0x14587c;};'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')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'limit':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['limit']||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1c')],function(_0x407cb4){return{'model':db[_0x407cb4[_0xbb10('0x1e')]],'as':_0x407cb4['as'],'attributes':_0x407cb4[_0xbb10('0x1b')],'include':_0x407cb4[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x407cb4[_0xbb10('0x1c')],function(_0x537898){return{'model':db[_0x537898['model']],'as':_0x537898['as'],'attributes':_0x537898['attributes'],'include':_0x537898[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x537898[_0xbb10('0x1c')],function(_0x4e25ff){return{'model':db[_0x4e25ff[_0xbb10('0x1e')]],'as':_0x4e25ff['as'],'attributes':_0x4e25ff[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x1d5e95){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')]('GetCmHopper',_0x378da8,JSON[_0xbb10('0x11')](_0x1d5e95));_0x575cca(_0x1d5e95);})[_0xbb10('0x20')](function(_0xfc3595){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0xfc3595[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0xfc3595[_0xbb10('0x13')]));});});};exports['ShowCmHopper']=function(_0x448d5c){var _0x56f2da=this;return new Promise(function(_0x16ad2a,_0x1dcc9c){return db[_0xbb10('0x16')]['find']({'raw':_0x448d5c['options']?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x448d5c['options']?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x448d5c[_0xbb10('0x18')]?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'include':_0x448d5c[_0xbb10('0x18')]?_0x448d5c[_0xbb10('0x18')]['include']?_[_0xbb10('0x1d')](_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1c')],function(_0x8c1ce6){return{'model':db[_0x8c1ce6[_0xbb10('0x1e')]],'as':_0x8c1ce6['as'],'attributes':_0x8c1ce6[_0xbb10('0x1b')],'include':_0x8c1ce6[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x8c1ce6[_0xbb10('0x1c')],function(_0x56943c){return{'model':db[_0x56943c[_0xbb10('0x1e')]],'as':_0x56943c['as'],'attributes':_0x56943c[_0xbb10('0x1b')],'include':_0x56943c[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x56943c['include'],function(_0x111762){return{'model':db[_0x111762['model']],'as':_0x111762['as'],'attributes':_0x111762['attributes']};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x40c164){logger[_0xbb10('0xd')](_0xbb10('0x21'),_0x448d5c);logger[_0xbb10('0x1f')](_0xbb10('0x21'),_0x448d5c,JSON['stringify'](_0x40c164));_0x16ad2a(_0x40c164);})[_0xbb10('0x20')](function(_0x25d72f){logger['error']('ShowCmHopper',_0x25d72f['message'],_0x448d5c);_0x1dcc9c(_0x56f2da[_0xbb10('0x12')](0x1f4,_0x25d72f[_0xbb10('0x13')]));});});};exports[_0xbb10('0x22')]=function(_0x4d5a9b){var _0x3c0cd7=this;return new Promise(function(_0x3e8538,_0x4345f3){return db['CmHopper'][_0xbb10('0x23')](_0x4d5a9b[_0xbb10('0x24')],{'raw':_0x4d5a9b[_0xbb10('0x18')]?_0x4d5a9b[_0xbb10('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0x110eb5){logger['info'](_0xbb10('0x22'),_0x4d5a9b);logger[_0xbb10('0x1f')](_0xbb10('0x22'),_0x4d5a9b,JSON[_0xbb10('0x11')](_0x110eb5));_0x3e8538(_0x110eb5);})[_0xbb10('0x20')](function(_0x185a52){logger['error'](_0xbb10('0x22'),_0x185a52[_0xbb10('0x13')],_0x4d5a9b);_0x4345f3(_0x3c0cd7[_0xbb10('0x12')](0x1f4,_0x185a52[_0xbb10('0x13')]));});});};exports['UpdateCmHopper']=function(_0x3fff6c){var _0x331751=this;return new Promise(function(_0x23dc18,_0x403beb){return db['CmHopper'][_0xbb10('0x25')](_0x3fff6c[_0xbb10('0x24')],{'raw':_0x3fff6c['options']?_0x3fff6c['options'][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fff6c['options']?_0x3fff6c[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x3fff6c['options']?_0x3fff6c[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x3fff6c[_0xbb10('0x18')]?_0x3fff6c['options'][_0xbb10('0x26')]||null:null})[_0xbb10('0xc')](function(_0x3b9fdf){logger[_0xbb10('0xd')](_0xbb10('0x27'),_0x3fff6c);logger[_0xbb10('0x1f')](_0xbb10('0x27'),_0x3fff6c,JSON[_0xbb10('0x11')](_0x3b9fdf));_0x23dc18(_0x3b9fdf);})[_0xbb10('0x20')](function(_0x43b948){logger[_0xbb10('0x12')](_0xbb10('0x27'),_0x43b948['message'],_0x3fff6c);_0x403beb(_0x331751[_0xbb10('0x12')](0x1f4,_0x43b948[_0xbb10('0x13')]));});});};exports['DestroyCmHopper']=function(_0x14e1cb){var _0x2f5027=this;return new Promise(function(_0x1a7df6,_0x5a5226){return db[_0xbb10('0x16')][_0xbb10('0x28')]({'where':_0x14e1cb[_0xbb10('0x18')]?_0x14e1cb['options']['where']||null:null})[_0xbb10('0xc')](function(_0x76a208){logger[_0xbb10('0xd')]('DestroyCmHopper',_0x14e1cb);logger['debug'](_0xbb10('0x29'),_0x14e1cb,JSON[_0xbb10('0x11')](_0x76a208));_0x1a7df6(_0x76a208);})[_0xbb10('0x20')](function(_0xf820fe){logger[_0xbb10('0x12')](_0xbb10('0x29'),_0xf820fe[_0xbb10('0x13')],_0x14e1cb);_0x5a5226(_0x2f5027[_0xbb10('0x12')](0x1f4,_0xf820fe[_0xbb10('0x13')]));});});};exports[_0xbb10('0x2a')]=function(_0x550111){var _0x5eafac=this;return new Promise(function(_0x412e13,_0x467dba){return db[_0xbb10('0x2b')][_0xbb10('0x2c')]()[_0xbb10('0xc')](function(_0x440f9e){return db[_0xbb10('0x2d')][_0xbb10('0x2e')](function(_0x1c0d8f){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'where':_0x550111[_0xbb10('0x18')]?_0x550111[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x550111[_0xbb10('0x18')]?_0x550111['options'][_0xbb10('0x1b')]||null:null,'limit':_0x550111['options']?_0x550111[_0xbb10('0x18')][_0xbb10('0x26')]||null:null,'order':_0x550111[_0xbb10('0x18')]?_0x550111[_0xbb10('0x18')][_0xbb10('0x2f')]||null:null,'transaction':_0x1c0d8f,'lock':_0x1c0d8f[_0xbb10('0x30')][_0xbb10('0x31')],'include':[{'model':db[_0xbb10('0x2b')],'as':_0xbb10('0x32'),'attributes':_[_0xbb10('0x33')](_0x440f9e)},{'model':db[_0xbb10('0x34')],'as':_0xbb10('0x35'),'attributes':['id',_0xbb10('0x36'),_0xbb10('0x37')]}]})[_0xbb10('0xc')](function(_0x5de0cc){var _0x4571b6=[];for(var _0x466eb7=0x0;_0x466eb7<_0x5de0cc[_0xbb10('0x38')];_0x466eb7+=0x1){_0x4571b6[_0xbb10('0x39')](_0x5de0cc[_0x466eb7][_0xbb10('0x25')](_0x550111[_0xbb10('0x24')],{'transaction':_0x1c0d8f}));}return BPromise['all'](_0x4571b6);});})[_0xbb10('0xc')](function(_0x4731ce){logger[_0xbb10('0xd')](_0xbb10('0x2a'),_0x550111);logger[_0xbb10('0x1f')](_0xbb10('0x2a'),_0x550111,JSON[_0xbb10('0x11')](_0x4731ce));_0x412e13(_0x4731ce);})[_0xbb10('0x20')](function(_0x205e01){logger[_0xbb10('0x12')](_0xbb10('0x2a'),_0x205e01[_0xbb10('0x13')],_0x550111);_0x467dba(_0x5eafac[_0xbb10('0x12')](0x1f4,_0x205e01['message']));});});});};exports['MoveContactManagedDialer']=function(_0x16272d){var _0x3e6338=this;return new Promise(function(_0x3d0cb7,_0x8b0a7d){return db['sequelize']['transaction'](function(_0x79411e){return db[_0xbb10('0x3a')][_0xbb10('0x23')](_0x16272d[_0xbb10('0x24')],{'raw':_0x16272d[_0xbb10('0x18')]?_0x16272d[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'transaction':_0x79411e})['then'](function(){return db[_0xbb10('0x16')][_0xbb10('0x28')]({'where':_0x16272d['options']?_0x16272d['options']['where']||null:null,'transaction':_0x79411e});});})[_0xbb10('0xc')](function(_0x31c727){logger[_0xbb10('0xd')]('MoveContactManagedDialer',_0x16272d);logger['debug']('MoveContactManagedDialer',_0x16272d,JSON[_0xbb10('0x11')](_0x31c727));_0x3d0cb7(_0x31c727);})[_0xbb10('0x20')](function(_0x45167a){logger['error'](_0xbb10('0x3b'),_0x45167a[_0xbb10('0x13')],_0x16272d);_0x8b0a7d(_0x3e6338['error'](0x1f4,_0x45167a['message']));});});};exports[_0xbb10('0x3c')]=function(_0x308896){var _0xd77753=this;return new Promise(function(_0x237246,_0x54b7c5){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x308896[_0xbb10('0x18')]?_0x308896['options'][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x308896[_0xbb10('0x18')]?_0x308896[_0xbb10('0x18')]['where']||null:null,'attributes':[[db[_0xbb10('0x2d')]['fn'](_0xbb10('0x3d'),db[_0xbb10('0x2d')]['fn']('IF',db[_0xbb10('0x2d')]['literal'](_0xbb10('0x3e')+util[_0xbb10('0x3f')](_0xbb10('0x40'),moment()[_0xbb10('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'))+_0xbb10('0x41')))),_0xbb10('0x42')]]})[_0xbb10('0xc')](function(_0x2ceb3e){logger[_0xbb10('0xd')](_0xbb10('0x3c'),_0x308896);logger[_0xbb10('0x1f')]('CountReScheduled',_0x308896,JSON['stringify'](_0x2ceb3e));_0x237246(_0x2ceb3e);})['catch'](function(_0xdfbc0b){logger[_0xbb10('0x12')](_0xbb10('0x3c'),_0xdfbc0b['message'],_0x308896);_0x54b7c5(_0xd77753['error'](0x1f4,_0xdfbc0b[_0xbb10('0x13')]));});});};exports[_0xbb10('0x43')]=function(_0xd9e743){var _0x3a9677=this;return new Promise(function(_0x260e06,_0x1ad2ed){return db['CmContact'][_0xbb10('0x2c')]()[_0xbb10('0xc')](function(_0x270fdb){return db[_0xbb10('0x2d')][_0xbb10('0x2e')](function(_0x5bfc68){return db['CmHopper']['findAll']({'where':_0xd9e743[_0xbb10('0x18')]?_0xd9e743[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0xd9e743[_0xbb10('0x18')]?_0xd9e743[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':0x1,'order':_0xd9e743['options']?_0xd9e743[_0xbb10('0x18')]['order']||null:null,'group':db['CmHopper']['UserId'],'transaction':_0x5bfc68,'lock':_0x5bfc68[_0xbb10('0x30')][_0xbb10('0x31')],'include':_0xd9e743[_0xbb10('0x18')]?_0xd9e743[_0xbb10('0x18')]['include']?_[_0xbb10('0x1d')](_0xd9e743['options']['include'],function(_0x165fe9){return{'model':db[_0x165fe9[_0xbb10('0x1e')]],'as':_0x165fe9['as'],'attributes':_0x165fe9[_0xbb10('0x1b')],'include':_0x165fe9[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x165fe9['include'],function(_0x2d52ea){return{'model':db[_0x2d52ea[_0xbb10('0x1e')]],'as':_0x2d52ea['as'],'attributes':_0x2d52ea[_0xbb10('0x1b')],'include':_0x2d52ea[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x2d52ea[_0xbb10('0x1c')],function(_0x174395){return{'model':db[_0x174395['model']],'as':_0x174395['as'],'attributes':_0x174395[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x30f3ea){var _0x322b41=[];for(var _0x37b20e=0x0;_0x37b20e<_0x30f3ea[_0xbb10('0x38')];_0x37b20e+=0x1){_0x322b41[_0xbb10('0x39')](_0x30f3ea[_0x37b20e][_0xbb10('0x25')](_0xd9e743['body'],{'transaction':_0x5bfc68}));}return BPromise[_0xbb10('0x44')](_0x322b41);});})[_0xbb10('0xc')](function(_0x145baf){logger['info']('GetContactRecallMe',_0xd9e743);logger['debug'](_0xbb10('0x43'),_0xd9e743,JSON['stringify'](_0x145baf));_0x260e06(_0x145baf);})['catch'](function(_0x1701c5){logger[_0xbb10('0x12')](_0xbb10('0x43'),_0x1701c5[_0xbb10('0x13')],_0xd9e743);_0x1ad2ed(_0x3a9677[_0xbb10('0x12')](0x1f4,_0x1701c5[_0xbb10('0x13')]));});});});}; \ No newline at end of file +var _0x7a54=['stringify','error','code','message','request\x20sent','result','catch','CmHopper','findAll','options','raw','where','attributes','include','map','model','then','GetCmHopper','ShowCmHopper','find','CreateCmHopper','create','update','UpdateCmHopper','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','limit','order','LOCK','UPDATE','keys','User','Agent','name','voicePause','length','body','all','MoveContactManagedDialer','transaction','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','UserId','push','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','CmHopper,\x20%s,\x20%s','debug'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7a54,0x106));var _0x47a5=function(_0x65a4fd,_0x1fcc81){_0x65a4fd=_0x65a4fd-0x0;var _0x42bf21=_0x7a54[_0x65a4fd];return _0x42bf21;};'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')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['GetCmHopper']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'limit':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['limit']||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x5247fd['options'][_0x47a5('0x1b')],function(_0x385687){return{'model':db[_0x385687['model']],'as':_0x385687['as'],'attributes':_0x385687[_0x47a5('0x1a')],'include':_0x385687[_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x385687[_0x47a5('0x1b')],function(_0x3abd6a){return{'model':db[_0x3abd6a['model']],'as':_0x3abd6a['as'],'attributes':_0x3abd6a['attributes'],'include':_0x3abd6a[_0x47a5('0x1b')]?_['map'](_0x3abd6a[_0x47a5('0x1b')],function(_0x5b6c4e){return{'model':db[_0x5b6c4e[_0x47a5('0x1d')]],'as':_0x5b6c4e['as'],'attributes':_0x5b6c4e[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x47a5('0x1e')](function(_0x1dac65){logger[_0x47a5('0xb')](_0x47a5('0x1f'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1f'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1dac65));_0xaf70a6(_0x1dac65);})[_0x47a5('0x14')](function(_0x1127f8){logger[_0x47a5('0xf')](_0x47a5('0x1f'),_0x1127f8['message'],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x1127f8['message']));});});};exports[_0x47a5('0x20')]=function(_0x9ac908){var _0x16901f=this;return new Promise(function(_0x4d6b57,_0x256650){return db[_0x47a5('0x15')][_0x47a5('0x21')]({'raw':_0x9ac908[_0x47a5('0x17')]?_0x9ac908['options']['raw']===undefined?!![]:![]:!![],'where':_0x9ac908[_0x47a5('0x17')]?_0x9ac908[_0x47a5('0x17')]['where']||null:null,'attributes':_0x9ac908['options']?_0x9ac908[_0x47a5('0x17')][_0x47a5('0x1a')]||null:null,'include':_0x9ac908['options']?_0x9ac908[_0x47a5('0x17')]['include']?_[_0x47a5('0x1c')](_0x9ac908[_0x47a5('0x17')]['include'],function(_0x4843c0){return{'model':db[_0x4843c0[_0x47a5('0x1d')]],'as':_0x4843c0['as'],'attributes':_0x4843c0['attributes'],'include':_0x4843c0[_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x4843c0[_0x47a5('0x1b')],function(_0x52749b){return{'model':db[_0x52749b[_0x47a5('0x1d')]],'as':_0x52749b['as'],'attributes':_0x52749b['attributes'],'include':_0x52749b['include']?_[_0x47a5('0x1c')](_0x52749b['include'],function(_0x25cce0){return{'model':db[_0x25cce0['model']],'as':_0x25cce0['as'],'attributes':_0x25cce0[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x47a5('0x1e')](function(_0x38c8d4){logger[_0x47a5('0xb')](_0x47a5('0x20'),_0x9ac908);logger[_0x47a5('0xd')](_0x47a5('0x20'),_0x9ac908,JSON[_0x47a5('0xe')](_0x38c8d4));_0x4d6b57(_0x38c8d4);})[_0x47a5('0x14')](function(_0x4caed5){logger[_0x47a5('0xf')](_0x47a5('0x20'),_0x4caed5['message'],_0x9ac908);_0x256650(_0x16901f[_0x47a5('0xf')](0x1f4,_0x4caed5[_0x47a5('0x11')]));});});};exports[_0x47a5('0x22')]=function(_0x49c4b5){var _0x101f70=this;return new Promise(function(_0x10f660,_0x596097){return db[_0x47a5('0x15')][_0x47a5('0x23')](_0x49c4b5['body'],{'raw':_0x49c4b5['options']?_0x49c4b5['options'][_0x47a5('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x9b5eaf){logger[_0x47a5('0xb')](_0x47a5('0x22'),_0x49c4b5);logger[_0x47a5('0xd')](_0x47a5('0x22'),_0x49c4b5,JSON[_0x47a5('0xe')](_0x9b5eaf));_0x10f660(_0x9b5eaf);})[_0x47a5('0x14')](function(_0x1f3d01){logger[_0x47a5('0xf')](_0x47a5('0x22'),_0x1f3d01[_0x47a5('0x11')],_0x49c4b5);_0x596097(_0x101f70[_0x47a5('0xf')](0x1f4,_0x1f3d01[_0x47a5('0x11')]));});});};exports['UpdateCmHopper']=function(_0x1fbece){var _0x1c36fa=this;return new Promise(function(_0x331474,_0x23bd8d){return db['CmHopper'][_0x47a5('0x24')](_0x1fbece['body'],{'raw':_0x1fbece['options']?_0x1fbece['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1fbece[_0x47a5('0x17')]?_0x1fbece['options'][_0x47a5('0x19')]||null:null,'attributes':_0x1fbece[_0x47a5('0x17')]?_0x1fbece[_0x47a5('0x17')]['attributes']||null:null,'limit':_0x1fbece[_0x47a5('0x17')]?_0x1fbece[_0x47a5('0x17')]['limit']||null:null})['then'](function(_0xbe21d9){logger['info'](_0x47a5('0x25'),_0x1fbece);logger[_0x47a5('0xd')](_0x47a5('0x25'),_0x1fbece,JSON[_0x47a5('0xe')](_0xbe21d9));_0x331474(_0xbe21d9);})[_0x47a5('0x14')](function(_0xf0edbb){logger[_0x47a5('0xf')](_0x47a5('0x25'),_0xf0edbb[_0x47a5('0x11')],_0x1fbece);_0x23bd8d(_0x1c36fa[_0x47a5('0xf')](0x1f4,_0xf0edbb[_0x47a5('0x11')]));});});};exports[_0x47a5('0x26')]=function(_0xe28d76){var _0x3574d4=this;return new Promise(function(_0x4e5e7,_0x3a2b38){return db['CmHopper'][_0x47a5('0x27')]({'where':_0xe28d76[_0x47a5('0x17')]?_0xe28d76['options']['where']||null:null})[_0x47a5('0x1e')](function(_0x560e4e){logger[_0x47a5('0xb')](_0x47a5('0x26'),_0xe28d76);logger['debug']('DestroyCmHopper',_0xe28d76,JSON[_0x47a5('0xe')](_0x560e4e));_0x4e5e7(_0x560e4e);})['catch'](function(_0x2d147c){logger[_0x47a5('0xf')](_0x47a5('0x26'),_0x2d147c[_0x47a5('0x11')],_0xe28d76);_0x3a2b38(_0x3574d4[_0x47a5('0xf')](0x1f4,_0x2d147c[_0x47a5('0x11')]));});});};exports[_0x47a5('0x28')]=function(_0x53e994){var _0x48a0ef=this;return new Promise(function(_0x2dd1db,_0x411230){return db[_0x47a5('0x29')][_0x47a5('0x2a')]()[_0x47a5('0x1e')](function(_0x2c0c86){return db[_0x47a5('0x2b')]['transaction'](function(_0x45cca5){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'where':_0x53e994['options']?_0x53e994[_0x47a5('0x17')]['where']||null:null,'attributes':_0x53e994[_0x47a5('0x17')]?_0x53e994[_0x47a5('0x17')][_0x47a5('0x1a')]||null:null,'limit':_0x53e994[_0x47a5('0x17')]?_0x53e994['options'][_0x47a5('0x2c')]||null:null,'order':_0x53e994[_0x47a5('0x17')]?_0x53e994[_0x47a5('0x17')][_0x47a5('0x2d')]||null:null,'transaction':_0x45cca5,'lock':_0x45cca5[_0x47a5('0x2e')][_0x47a5('0x2f')],'include':[{'model':db[_0x47a5('0x29')],'as':'Contact','attributes':_[_0x47a5('0x30')](_0x2c0c86)},{'model':db[_0x47a5('0x31')],'as':_0x47a5('0x32'),'attributes':['id',_0x47a5('0x33'),_0x47a5('0x34')]}]})[_0x47a5('0x1e')](function(_0x572233){var _0x1ad6a9=[];for(var _0x245a15=0x0;_0x245a15<_0x572233[_0x47a5('0x35')];_0x245a15+=0x1){_0x1ad6a9['push'](_0x572233[_0x245a15][_0x47a5('0x24')](_0x53e994[_0x47a5('0x36')],{'transaction':_0x45cca5}));}return BPromise[_0x47a5('0x37')](_0x1ad6a9);});})['then'](function(_0x57641e){logger[_0x47a5('0xb')](_0x47a5('0x28'),_0x53e994);logger['debug']('GetContactDialer',_0x53e994,JSON[_0x47a5('0xe')](_0x57641e));_0x2dd1db(_0x57641e);})['catch'](function(_0x16bb8a){logger['error']('GetContactDialer',_0x16bb8a[_0x47a5('0x11')],_0x53e994);_0x411230(_0x48a0ef[_0x47a5('0xf')](0x1f4,_0x16bb8a['message']));});});});};exports[_0x47a5('0x38')]=function(_0x72fe){var _0x4b706a=this;return new Promise(function(_0x5b6127,_0x16b4fd){return db[_0x47a5('0x2b')][_0x47a5('0x39')](function(_0x2931e4){return db['CmHopperFinal'][_0x47a5('0x23')](_0x72fe[_0x47a5('0x36')],{'raw':_0x72fe[_0x47a5('0x17')]?_0x72fe['options'][_0x47a5('0x18')]===undefined?!![]:![]:!![],'transaction':_0x2931e4})['then'](function(){return db[_0x47a5('0x15')][_0x47a5('0x27')]({'where':_0x72fe[_0x47a5('0x17')]?_0x72fe[_0x47a5('0x17')][_0x47a5('0x19')]||null:null,'transaction':_0x2931e4});});})['then'](function(_0x144af9){logger['info']('MoveContactManagedDialer',_0x72fe);logger['debug']('MoveContactManagedDialer',_0x72fe,JSON[_0x47a5('0xe')](_0x144af9));_0x5b6127(_0x144af9);})[_0x47a5('0x14')](function(_0x1e2bb4){logger['error']('MoveContactManagedDialer',_0x1e2bb4[_0x47a5('0x11')],_0x72fe);_0x16b4fd(_0x4b706a[_0x47a5('0xf')](0x1f4,_0x1e2bb4[_0x47a5('0x11')]));});});};exports[_0x47a5('0x3a')]=function(_0xc45e25){var _0x4b5d0c=this;return new Promise(function(_0x3474b7,_0x519e9e){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0xc45e25['options']?_0xc45e25[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0xc45e25[_0x47a5('0x17')]?_0xc45e25[_0x47a5('0x17')][_0x47a5('0x19')]||null:null,'attributes':[[db[_0x47a5('0x2b')]['fn'](_0x47a5('0x3b'),db[_0x47a5('0x2b')]['fn']('IF',db['sequelize'][_0x47a5('0x3c')](_0x47a5('0x3d')+util[_0x47a5('0x3e')](_0x47a5('0x3f'),moment()[_0x47a5('0x3e')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x47a5('0x40')))),_0x47a5('0x41')]]})[_0x47a5('0x1e')](function(_0x144aaa){logger[_0x47a5('0xb')](_0x47a5('0x3a'),_0xc45e25);logger[_0x47a5('0xd')](_0x47a5('0x3a'),_0xc45e25,JSON[_0x47a5('0xe')](_0x144aaa));_0x3474b7(_0x144aaa);})[_0x47a5('0x14')](function(_0x1d56f3){logger[_0x47a5('0xf')](_0x47a5('0x3a'),_0x1d56f3[_0x47a5('0x11')],_0xc45e25);_0x519e9e(_0x4b5d0c[_0x47a5('0xf')](0x1f4,_0x1d56f3['message']));});});};exports[_0x47a5('0x42')]=function(_0x284fb8){var _0x30504e=this;return new Promise(function(_0x4b42f3,_0x37ac59){return db[_0x47a5('0x29')][_0x47a5('0x2a')]()[_0x47a5('0x1e')](function(_0x5d9822){return db[_0x47a5('0x2b')]['transaction'](function(_0x2d5ee6){return db['CmHopper'][_0x47a5('0x16')]({'where':_0x284fb8['options']?_0x284fb8[_0x47a5('0x17')][_0x47a5('0x19')]||null:null,'attributes':_0x284fb8[_0x47a5('0x17')]?_0x284fb8['options']['attributes']||null:null,'limit':0x1,'order':_0x284fb8['options']?_0x284fb8[_0x47a5('0x17')][_0x47a5('0x2d')]||null:null,'group':db[_0x47a5('0x15')][_0x47a5('0x43')],'transaction':_0x2d5ee6,'lock':_0x2d5ee6['LOCK'][_0x47a5('0x2f')],'include':_0x284fb8[_0x47a5('0x17')]?_0x284fb8[_0x47a5('0x17')][_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x284fb8[_0x47a5('0x17')][_0x47a5('0x1b')],function(_0x39939a){return{'model':db[_0x39939a[_0x47a5('0x1d')]],'as':_0x39939a['as'],'attributes':_0x39939a[_0x47a5('0x1a')],'include':_0x39939a[_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x39939a['include'],function(_0x1e3212){return{'model':db[_0x1e3212['model']],'as':_0x1e3212['as'],'attributes':_0x1e3212[_0x47a5('0x1a')],'include':_0x1e3212[_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x1e3212[_0x47a5('0x1b')],function(_0x40e584){return{'model':db[_0x40e584[_0x47a5('0x1d')]],'as':_0x40e584['as'],'attributes':_0x40e584[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x47a5('0x1e')](function(_0x11c1db){var _0x254049=[];for(var _0x1cfb37=0x0;_0x1cfb37<_0x11c1db[_0x47a5('0x35')];_0x1cfb37+=0x1){_0x254049[_0x47a5('0x44')](_0x11c1db[_0x1cfb37][_0x47a5('0x24')](_0x284fb8[_0x47a5('0x36')],{'transaction':_0x2d5ee6}));}return BPromise['all'](_0x254049);});})['then'](function(_0x5ccc89){logger['info'](_0x47a5('0x42'),_0x284fb8);logger[_0x47a5('0xd')]('GetContactRecallMe',_0x284fb8,JSON[_0x47a5('0xe')](_0x5ccc89));_0x4b42f3(_0x5ccc89);})[_0x47a5('0x14')](function(_0x1baa5a){logger[_0x47a5('0xf')](_0x47a5('0x42'),_0x1baa5a[_0x47a5('0x11')],_0x284fb8);_0x37ac59(_0x30504e[_0x47a5('0xf')](0x1f4,_0x1baa5a[_0x47a5('0x11')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 688767c..6fb2e70 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 _0x4d5a=['get','/describe','isAuthenticated','describe','/opencontacts','/:id','show','post','create','/preview','put','update','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2861e1,_0x442c99){var _0x2b78a0=function(_0x519e71){while(--_0x519e71){_0x2861e1['push'](_0x2861e1['shift']());}};_0x2b78a0(++_0x442c99);}(_0x4d5a,0x15e));var _0xa4d5=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4d5a[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require('multer');var util=require(_0xa4d5('0x0'));var path=require(_0xa4d5('0x1'));var timeout=require(_0xa4d5('0x2'));var express=require('express');var router=express[_0xa4d5('0x3')]();var auth=require(_0xa4d5('0x4'));var interaction=require(_0xa4d5('0x5'));var config=require(_0xa4d5('0x6'));var controller=require('./cmHopper.controller');router[_0xa4d5('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa4d5('0x7')](_0xa4d5('0x8'),auth[_0xa4d5('0x9')](),controller[_0xa4d5('0xa')]);router[_0xa4d5('0x7')](_0xa4d5('0xb'),auth[_0xa4d5('0x9')](),controller['getOpenContacts']);router['get'](_0xa4d5('0xc'),auth[_0xa4d5('0x9')](),controller[_0xa4d5('0xd')]);router[_0xa4d5('0xe')]('/',auth[_0xa4d5('0x9')](),controller[_0xa4d5('0xf')]);router[_0xa4d5('0xe')](_0xa4d5('0x10'),auth['isAuthenticated'](),controller['getPreview']);router[_0xa4d5('0x11')](_0xa4d5('0xc'),auth[_0xa4d5('0x9')](),controller[_0xa4d5('0x12')]);router['delete']('/:id',auth[_0xa4d5('0x9')](),controller[_0xa4d5('0x13')]);module[_0xa4d5('0x14')]=router; \ No newline at end of file +var _0x6d2d=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','index','describe','getOpenContacts','/:id','show','post','/preview','getPreview','put','delete','destroy','exports','path'];(function(_0x4dba68,_0x53d173){var _0x233acf=function(_0x198b76){while(--_0x198b76){_0x4dba68['push'](_0x4dba68['shift']());}};_0x233acf(++_0x53d173);}(_0x6d2d,0xbc));var _0xd6d2=function(_0x33f336,_0x25e4ab){_0x33f336=_0x33f336-0x0;var _0x2f6e9e=_0x6d2d[_0x33f336];return _0x2f6e9e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd6d2('0x0'));var timeout=require(_0xd6d2('0x1'));var express=require(_0xd6d2('0x2'));var router=express['Router']();var auth=require(_0xd6d2('0x3'));var interaction=require(_0xd6d2('0x4'));var config=require(_0xd6d2('0x5'));var controller=require(_0xd6d2('0x6'));router[_0xd6d2('0x7')]('/',auth[_0xd6d2('0x8')](),controller[_0xd6d2('0x9')]);router[_0xd6d2('0x7')]('/describe',auth[_0xd6d2('0x8')](),controller[_0xd6d2('0xa')]);router[_0xd6d2('0x7')]('/opencontacts',auth[_0xd6d2('0x8')](),controller[_0xd6d2('0xb')]);router[_0xd6d2('0x7')](_0xd6d2('0xc'),auth[_0xd6d2('0x8')](),controller[_0xd6d2('0xd')]);router[_0xd6d2('0xe')]('/',auth[_0xd6d2('0x8')](),controller['create']);router[_0xd6d2('0xe')](_0xd6d2('0xf'),auth[_0xd6d2('0x8')](),controller[_0xd6d2('0x10')]);router[_0xd6d2('0x11')](_0xd6d2('0xc'),auth[_0xd6d2('0x8')](),controller['update']);router[_0xd6d2('0x12')](_0xd6d2('0xc'),auth[_0xd6d2('0x8')](),controller[_0xd6d2('0x13')]);module[_0xd6d2('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 621cbaf..db2d2be 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 _0x11a4=['contactListQueue','sequelize','STRING','INTEGER'];(function(_0x42b09d,_0x5b6392){var _0xa040be=function(_0x1f9027){while(--_0x1f9027){_0x42b09d['push'](_0x42b09d['shift']());}};_0xa040be(++_0x5b6392);}(_0x11a4,0xfd));var _0x411a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x11a4[_0x42cae2];return _0x5f256f;};'use strict';var moment=require('moment');var Sequelize=require(_0x411a('0x0'));module['exports']={'phone':{'type':Sequelize[_0x411a('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x411a('0x2')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x411a('0x2')],'unique':_0x411a('0x3')},'VoiceQueueId':{'type':Sequelize[_0x411a('0x2')],'unique':_0x411a('0x3')}}; \ No newline at end of file +var _0x1e2c=['moment','sequelize','exports','STRING','contactListQueue','INTEGER'];(function(_0x57fa33,_0x2b8222){var _0x12e724=function(_0x481a33){while(--_0x481a33){_0x57fa33['push'](_0x57fa33['shift']());}};_0x12e724(++_0x2b8222);}(_0x1e2c,0x1bc));var _0xc1e2=function(_0x4c2403,_0x1de08c){_0x4c2403=_0x4c2403-0x0;var _0x504c71=_0x1e2c[_0x4c2403];return _0x504c71;};'use strict';var moment=require(_0xc1e2('0x0'));var Sequelize=require(_0xc1e2('0x1'));module[_0xc1e2('0x2')]={'phone':{'type':Sequelize[_0xc1e2('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xc1e2('0x4')},'ListId':{'type':Sequelize[_0xc1e2('0x5')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0xc1e2('0x5')],'unique':_0xc1e2('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index afbb26f..6105ebd 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 _0x110f=['attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','CmHopperBlack','findAll','catch','find','update','body','params','describe','html-pdf','eml-format','request-promise','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','end','count','offset','limit','set','json','apply','reject','save','then','sendStatus','stack','name','map','rawAttributes','type','key','model','query','keys'];(function(_0x4c1381,_0x558ecb){var _0x1bdfc3=function(_0x56b3b3){while(--_0x56b3b3){_0x4c1381['push'](_0x4c1381['shift']());}};_0x1bdfc3(++_0x558ecb);}(_0x110f,0x1e6));var _0xf110=function(_0x4a13ee,_0x52134c){_0x4a13ee=_0x4a13ee-0x0;var _0x3a6749=_0x110f[_0x4a13ee];return _0x3a6749;};'use strict';var pdf=require(_0xf110('0x0'));var emlformat=require(_0xf110('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf110('0x2'));var moment=require('moment');var BPromise=require(_0xf110('0x3'));var Mustache=require(_0xf110('0x4'));var util=require(_0xf110('0x5'));var path=require('path');var sox=require(_0xf110('0x6'));var csv=require(_0xf110('0x7'));var ejs=require(_0xf110('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf110('0x9'));var crypto=require(_0xf110('0xa'));var jsforce=require(_0xf110('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf110('0x7'));var querystring=require(_0xf110('0xc'));var Papa=require(_0xf110('0xd'));var Redis=require('ioredis');var authService=require(_0xf110('0xe'));var qs=require(_0xf110('0xf'));var as=require(_0xf110('0x10'));var hardwareService=require(_0xf110('0x11'));var logger=require('../../config/logger')(_0xf110('0x12'));var utils=require(_0xf110('0x13'));var config=require('../../config/environment');var db=require(_0xf110('0x14'))['db'];function respondWithStatusCode(_0x2c9400,_0x24b5ab){_0x24b5ab=_0x24b5ab||0xcc;return function(_0x3ef19e){if(_0x3ef19e){return _0x2c9400['sendStatus'](_0x24b5ab);}return _0x2c9400[_0xf110('0x15')](_0x24b5ab)[_0xf110('0x16')]();};}function respondWithResult(_0x4179fa,_0x5cc928){_0x5cc928=_0x5cc928||0xc8;return function(_0xb21d63){if(_0xb21d63){return _0x4179fa[_0xf110('0x15')](_0x5cc928)['json'](_0xb21d63);}};}function respondWithFilteredResult(_0x41df62,_0x45919d){return function(_0x40cd2b){if(_0x40cd2b){var _0x325496=_0x40cd2b[_0xf110('0x17')],_0x32df98=_0x45919d[_0xf110('0x18')],_0x47cabf=_0x45919d['offset']+_0x45919d[_0xf110('0x19')],_0x5fbcdd;if(_0x47cabf>=_0x325496){_0x47cabf=_0x325496;_0x5fbcdd=0xc8;}else{_0x5fbcdd=0xce;}_0x41df62[_0xf110('0x15')](_0x5fbcdd);return _0x41df62[_0xf110('0x1a')]('Content-Range',_0x32df98+'-'+_0x47cabf+'/'+_0x325496)[_0xf110('0x1b')](_0x40cd2b);}return null;};}function patchUpdates(_0x4c0ae8){return function(_0x1217a8){try{jsonpatch[_0xf110('0x1c')](_0x1217a8,_0x4c0ae8,!![]);}catch(_0x119e56){return BPromise[_0xf110('0x1d')](_0x119e56);}return _0x1217a8[_0xf110('0x1e')]();};}function saveUpdates(_0x54513e,_0x3c1793){return function(_0xed3418){if(_0xed3418){return _0xed3418['update'](_0x54513e)[_0xf110('0x1f')](function(_0x105c20){return _0x105c20;});}return null;};}function removeEntity(_0x44eb14,_0x42ce23){return function(_0x1634bf){if(_0x1634bf){return _0x1634bf['destroy']()[_0xf110('0x1f')](function(){_0x44eb14[_0xf110('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9980ec,_0xc52064){return function(_0x11eb1c){if(!_0x11eb1c){_0x9980ec[_0xf110('0x20')](0x194);}return _0x11eb1c;};}function handleError(_0x447934,_0x2f91fa){_0x2f91fa=_0x2f91fa||0x1f4;return function(_0x36ac5e){logger['error'](_0x36ac5e[_0xf110('0x21')]);if(_0x36ac5e['name']){delete _0x36ac5e[_0xf110('0x22')];}_0x447934['status'](_0x2f91fa)['send'](_0x36ac5e);};}exports['index']=function(_0x4c587c,_0x16c81e){var _0x1cb61c={},_0x585616={},_0x26a4e2={'count':0x0,'rows':[]};var _0x1c2152=_[_0xf110('0x23')](db['CmHopperBlack'][_0xf110('0x24')],function(_0x2e0570){return{'name':_0x2e0570['fieldName'],'type':_0x2e0570[_0xf110('0x25')][_0xf110('0x26')]};});_0x585616[_0xf110('0x27')]=_[_0xf110('0x23')](_0x1c2152,_0xf110('0x22'));_0x585616[_0xf110('0x28')]=_[_0xf110('0x29')](_0x4c587c[_0xf110('0x28')]);_0x585616['filters']=_['intersection'](_0x585616[_0xf110('0x27')],_0x585616['query']);_0x1cb61c[_0xf110('0x2a')]=_[_0xf110('0x2b')](_0x585616[_0xf110('0x27')],qs[_0xf110('0x2c')](_0x4c587c[_0xf110('0x28')][_0xf110('0x2c')]));_0x1cb61c[_0xf110('0x2a')]=_0x1cb61c[_0xf110('0x2a')][_0xf110('0x2d')]?_0x1cb61c['attributes']:_0x585616[_0xf110('0x27')];if(!_0x4c587c[_0xf110('0x28')][_0xf110('0x2e')](_0xf110('0x2f'))){_0x1cb61c[_0xf110('0x19')]=qs[_0xf110('0x19')](_0x4c587c[_0xf110('0x28')][_0xf110('0x19')]);_0x1cb61c[_0xf110('0x18')]=qs[_0xf110('0x18')](_0x4c587c[_0xf110('0x28')][_0xf110('0x18')]);}_0x1cb61c[_0xf110('0x30')]=qs[_0xf110('0x31')](_0x4c587c['query'][_0xf110('0x31')]);_0x1cb61c[_0xf110('0x32')]=qs[_0xf110('0x33')](_[_0xf110('0x34')](_0x4c587c[_0xf110('0x28')],_0x585616[_0xf110('0x33')]));if(_0x4c587c[_0xf110('0x28')][_0xf110('0x35')]){_0x1cb61c[_0xf110('0x32')]=_[_0xf110('0x36')](_0x1cb61c['where'],{'$or':_[_0xf110('0x23')](_0x1c2152,function(_0x4876c1){if(_0x4876c1[_0xf110('0x25')]!==_0xf110('0x37')){var _0x898e78={};_0x898e78[_0x4876c1[_0xf110('0x22')]]={'$like':'%'+_0x4c587c[_0xf110('0x28')][_0xf110('0x35')]+'%'};return _0x898e78;}})});}_0x1cb61c=_[_0xf110('0x36')]({},_0x1cb61c,_0x4c587c[_0xf110('0x38')]);var _0x12c57b={'where':_0x1cb61c[_0xf110('0x32')]};return db['CmHopperBlack']['count'](_0x12c57b)[_0xf110('0x1f')](function(_0xd400ca){_0x26a4e2[_0xf110('0x17')]=_0xd400ca;if(_0x4c587c[_0xf110('0x28')][_0xf110('0x39')]){_0x1cb61c['include']=[{'all':!![]}];}return db[_0xf110('0x3a')][_0xf110('0x3b')](_0x1cb61c);})[_0xf110('0x1f')](function(_0x21cc49){_0x26a4e2['rows']=_0x21cc49;return _0x26a4e2;})[_0xf110('0x1f')](respondWithFilteredResult(_0x16c81e,_0x1cb61c))[_0xf110('0x3c')](handleError(_0x16c81e,null));};exports['show']=function(_0xd7edcb,_0x2d0056){var _0x8437e0={'raw':!![],'where':{'id':_0xd7edcb['params']['id']}},_0x21e98d={};_0x21e98d[_0xf110('0x27')]=_['keys'](db[_0xf110('0x3a')]['rawAttributes']);_0x21e98d[_0xf110('0x28')]=_[_0xf110('0x29')](_0xd7edcb[_0xf110('0x28')]);_0x21e98d['filters']=_[_0xf110('0x2b')](_0x21e98d['model'],_0x21e98d[_0xf110('0x28')]);_0x8437e0[_0xf110('0x2a')]=_[_0xf110('0x2b')](_0x21e98d[_0xf110('0x27')],qs[_0xf110('0x2c')](_0xd7edcb[_0xf110('0x28')][_0xf110('0x2c')]));_0x8437e0[_0xf110('0x2a')]=_0x8437e0[_0xf110('0x2a')][_0xf110('0x2d')]?_0x8437e0['attributes']:_0x21e98d['model'];if(_0xd7edcb[_0xf110('0x28')][_0xf110('0x39')]){_0x8437e0['include']=[{'all':!![]}];}_0x8437e0=_[_0xf110('0x36')]({},_0x8437e0,_0xd7edcb['options']);return db[_0xf110('0x3a')][_0xf110('0x3d')](_0x8437e0)[_0xf110('0x1f')](handleEntityNotFound(_0x2d0056,null))[_0xf110('0x1f')](respondWithResult(_0x2d0056,null))[_0xf110('0x3c')](handleError(_0x2d0056,null));};exports[_0xf110('0x3e')]=function(_0x2a27b5,_0x3dbd87){if(_0x2a27b5[_0xf110('0x3f')]['id']){delete _0x2a27b5[_0xf110('0x3f')]['id'];}return db['CmHopperBlack'][_0xf110('0x3d')]({'where':{'id':_0x2a27b5[_0xf110('0x40')]['id']}})[_0xf110('0x1f')](handleEntityNotFound(_0x3dbd87,null))[_0xf110('0x1f')](saveUpdates(_0x2a27b5['body'],null))[_0xf110('0x1f')](respondWithResult(_0x3dbd87,null))['catch'](handleError(_0x3dbd87,null));};exports['destroy']=function(_0x45e710,_0x1a8f98){return db[_0xf110('0x3a')]['find']({'where':{'id':_0x45e710[_0xf110('0x40')]['id']}})[_0xf110('0x1f')](handleEntityNotFound(_0x1a8f98,null))[_0xf110('0x1f')](removeEntity(_0x1a8f98,null))[_0xf110('0x3c')](handleError(_0x1a8f98,null));};exports[_0xf110('0x41')]=function(_0x831013,_0x1ac0fb){return db[_0xf110('0x3a')][_0xf110('0x41')]()[_0xf110('0x1f')](respondWithResult(_0x1ac0fb,null))[_0xf110('0x3c')](handleError(_0x1ac0fb,null));}; \ No newline at end of file +var _0x5c3c=['fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','keys','body','find','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','error','name','send','index','map','CmHopperBlack','rawAttributes'];(function(_0x375381,_0x571bfc){var _0x4b1cb5=function(_0x304d4a){while(--_0x304d4a){_0x375381['push'](_0x375381['shift']());}};_0x4b1cb5(++_0x571bfc);}(_0x5c3c,0x132));var _0xc5c3=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x5c3c[_0x2f5ac5];return _0x37c9a8;};'use strict';var pdf=require(_0xc5c3('0x0'));var emlformat=require(_0xc5c3('0x1'));var rimraf=require(_0xc5c3('0x2'));var zipdir=require(_0xc5c3('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc5c3('0x4'));var moment=require(_0xc5c3('0x5'));var BPromise=require(_0xc5c3('0x6'));var Mustache=require(_0xc5c3('0x7'));var util=require(_0xc5c3('0x8'));var path=require(_0xc5c3('0x9'));var sox=require(_0xc5c3('0xa'));var csv=require(_0xc5c3('0xb'));var ejs=require(_0xc5c3('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc5c3('0xd'));var deskjs=require(_0xc5c3('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc5c3('0xf'));var Papa=require(_0xc5c3('0x10'));var Redis=require('ioredis');var authService=require(_0xc5c3('0x11'));var qs=require(_0xc5c3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc5c3('0x13'));var logger=require(_0xc5c3('0x14'))(_0xc5c3('0x15'));var utils=require('../../config/utils');var config=require(_0xc5c3('0x16'));var db=require(_0xc5c3('0x17'))['db'];function respondWithStatusCode(_0x532065,_0x2b56e6){_0x2b56e6=_0x2b56e6||0xcc;return function(_0x44d2b9){if(_0x44d2b9){return _0x532065[_0xc5c3('0x18')](_0x2b56e6);}return _0x532065['status'](_0x2b56e6)[_0xc5c3('0x19')]();};}function respondWithResult(_0x54fa08,_0x1488ab){_0x1488ab=_0x1488ab||0xc8;return function(_0x13a740){if(_0x13a740){return _0x54fa08[_0xc5c3('0x1a')](_0x1488ab)['json'](_0x13a740);}};}function respondWithFilteredResult(_0x5c0341,_0x4445ea){return function(_0x577e1a){if(_0x577e1a){var _0x1bae87=_0x577e1a[_0xc5c3('0x1b')],_0xef8b21=_0x4445ea['offset'],_0x5ecd4b=_0x4445ea[_0xc5c3('0x1c')]+_0x4445ea[_0xc5c3('0x1d')],_0x4ff2de;if(_0x5ecd4b>=_0x1bae87){_0x5ecd4b=_0x1bae87;_0x4ff2de=0xc8;}else{_0x4ff2de=0xce;}_0x5c0341[_0xc5c3('0x1a')](_0x4ff2de);return _0x5c0341[_0xc5c3('0x1e')](_0xc5c3('0x1f'),_0xef8b21+'-'+_0x5ecd4b+'/'+_0x1bae87)['json'](_0x577e1a);}return null;};}function patchUpdates(_0x364f42){return function(_0x41af00){try{jsonpatch[_0xc5c3('0x20')](_0x41af00,_0x364f42,!![]);}catch(_0x2b582a){return BPromise['reject'](_0x2b582a);}return _0x41af00[_0xc5c3('0x21')]();};}function saveUpdates(_0x41578a,_0x3cc612){return function(_0x3ca20a){if(_0x3ca20a){return _0x3ca20a[_0xc5c3('0x22')](_0x41578a)['then'](function(_0xb07420){return _0xb07420;});}return null;};}function removeEntity(_0x159bec,_0x370254){return function(_0x2de266){if(_0x2de266){return _0x2de266[_0xc5c3('0x23')]()[_0xc5c3('0x24')](function(){_0x159bec[_0xc5c3('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52d638,_0x45affe){return function(_0x38dd9e){if(!_0x38dd9e){_0x52d638['sendStatus'](0x194);}return _0x38dd9e;};}function handleError(_0x5c7329,_0x23e2fb){_0x23e2fb=_0x23e2fb||0x1f4;return function(_0x1591e3){logger[_0xc5c3('0x25')](_0x1591e3['stack']);if(_0x1591e3['name']){delete _0x1591e3[_0xc5c3('0x26')];}_0x5c7329[_0xc5c3('0x1a')](_0x23e2fb)[_0xc5c3('0x27')](_0x1591e3);};}exports[_0xc5c3('0x28')]=function(_0x5caf85,_0x21efd6){var _0x5176c4={},_0x2eacec={},_0x4e6e6f={'count':0x0,'rows':[]};var _0x1da259=_[_0xc5c3('0x29')](db[_0xc5c3('0x2a')][_0xc5c3('0x2b')],function(_0x15361c){return{'name':_0x15361c[_0xc5c3('0x2c')],'type':_0x15361c[_0xc5c3('0x2d')]['key']};});_0x2eacec[_0xc5c3('0x2e')]=_['map'](_0x1da259,_0xc5c3('0x26'));_0x2eacec[_0xc5c3('0x2f')]=_['keys'](_0x5caf85['query']);_0x2eacec[_0xc5c3('0x30')]=_[_0xc5c3('0x31')](_0x2eacec[_0xc5c3('0x2e')],_0x2eacec[_0xc5c3('0x2f')]);_0x5176c4['attributes']=_[_0xc5c3('0x31')](_0x2eacec[_0xc5c3('0x2e')],qs[_0xc5c3('0x32')](_0x5caf85[_0xc5c3('0x2f')][_0xc5c3('0x32')]));_0x5176c4[_0xc5c3('0x33')]=_0x5176c4[_0xc5c3('0x33')][_0xc5c3('0x34')]?_0x5176c4[_0xc5c3('0x33')]:_0x2eacec['model'];if(!_0x5caf85[_0xc5c3('0x2f')][_0xc5c3('0x35')](_0xc5c3('0x36'))){_0x5176c4[_0xc5c3('0x1d')]=qs[_0xc5c3('0x1d')](_0x5caf85[_0xc5c3('0x2f')][_0xc5c3('0x1d')]);_0x5176c4['offset']=qs['offset'](_0x5caf85[_0xc5c3('0x2f')]['offset']);}_0x5176c4[_0xc5c3('0x37')]=qs[_0xc5c3('0x38')](_0x5caf85[_0xc5c3('0x2f')][_0xc5c3('0x38')]);_0x5176c4[_0xc5c3('0x39')]=qs['filters'](_[_0xc5c3('0x3a')](_0x5caf85[_0xc5c3('0x2f')],_0x2eacec['filters']));if(_0x5caf85[_0xc5c3('0x2f')][_0xc5c3('0x3b')]){_0x5176c4[_0xc5c3('0x39')]=_[_0xc5c3('0x3c')](_0x5176c4[_0xc5c3('0x39')],{'$or':_[_0xc5c3('0x29')](_0x1da259,function(_0x168056){if(_0x168056[_0xc5c3('0x2d')]!==_0xc5c3('0x3d')){var _0xf4f027={};_0xf4f027[_0x168056['name']]={'$like':'%'+_0x5caf85[_0xc5c3('0x2f')]['filter']+'%'};return _0xf4f027;}})});}_0x5176c4=_['merge']({},_0x5176c4,_0x5caf85[_0xc5c3('0x3e')]);var _0x10e27d={'where':_0x5176c4[_0xc5c3('0x39')]};return db[_0xc5c3('0x2a')][_0xc5c3('0x1b')](_0x10e27d)['then'](function(_0x5eba80){_0x4e6e6f[_0xc5c3('0x1b')]=_0x5eba80;if(_0x5caf85[_0xc5c3('0x2f')]['includeAll']){_0x5176c4[_0xc5c3('0x3f')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xc5c3('0x40')](_0x5176c4);})[_0xc5c3('0x24')](function(_0x44121e){_0x4e6e6f['rows']=_0x44121e;return _0x4e6e6f;})[_0xc5c3('0x24')](respondWithFilteredResult(_0x21efd6,_0x5176c4))[_0xc5c3('0x41')](handleError(_0x21efd6,null));};exports['show']=function(_0x4465c8,_0x599881){var _0x33936c={'raw':!![],'where':{'id':_0x4465c8['params']['id']}},_0x28c35c={};_0x28c35c['model']=_['keys'](db[_0xc5c3('0x2a')][_0xc5c3('0x2b')]);_0x28c35c['query']=_[_0xc5c3('0x42')](_0x4465c8[_0xc5c3('0x2f')]);_0x28c35c[_0xc5c3('0x30')]=_[_0xc5c3('0x31')](_0x28c35c['model'],_0x28c35c[_0xc5c3('0x2f')]);_0x33936c['attributes']=_['intersection'](_0x28c35c[_0xc5c3('0x2e')],qs[_0xc5c3('0x32')](_0x4465c8['query'][_0xc5c3('0x32')]));_0x33936c[_0xc5c3('0x33')]=_0x33936c['attributes'][_0xc5c3('0x34')]?_0x33936c['attributes']:_0x28c35c[_0xc5c3('0x2e')];if(_0x4465c8[_0xc5c3('0x2f')]['includeAll']){_0x33936c[_0xc5c3('0x3f')]=[{'all':!![]}];}_0x33936c=_['merge']({},_0x33936c,_0x4465c8[_0xc5c3('0x3e')]);return db[_0xc5c3('0x2a')]['find'](_0x33936c)[_0xc5c3('0x24')](handleEntityNotFound(_0x599881,null))[_0xc5c3('0x24')](respondWithResult(_0x599881,null))[_0xc5c3('0x41')](handleError(_0x599881,null));};exports[_0xc5c3('0x22')]=function(_0x450c46,_0x41dca5){if(_0x450c46['body']['id']){delete _0x450c46[_0xc5c3('0x43')]['id'];}return db[_0xc5c3('0x2a')][_0xc5c3('0x44')]({'where':{'id':_0x450c46[_0xc5c3('0x45')]['id']}})[_0xc5c3('0x24')](handleEntityNotFound(_0x41dca5,null))['then'](saveUpdates(_0x450c46['body'],null))[_0xc5c3('0x24')](respondWithResult(_0x41dca5,null))[_0xc5c3('0x41')](handleError(_0x41dca5,null));};exports[_0xc5c3('0x23')]=function(_0x5f0ee4,_0x38d82f){return db[_0xc5c3('0x2a')][_0xc5c3('0x44')]({'where':{'id':_0x5f0ee4[_0xc5c3('0x45')]['id']}})[_0xc5c3('0x24')](handleEntityNotFound(_0x38d82f,null))[_0xc5c3('0x24')](removeEntity(_0x38d82f,null))[_0xc5c3('0x41')](handleError(_0x38d82f,null));};exports['describe']=function(_0x259a4d,_0x3ff21e){return db[_0xc5c3('0x2a')]['describe']()[_0xc5c3('0x24')](respondWithResult(_0x3ff21e,null))[_0xc5c3('0x41')](handleError(_0x3ff21e,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 7d4670d..532e9d6 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 _0x8e30=['request-promise','path','rimraf','./cmHopperBlack.attributes','define','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x8e30,0x73));var _0x08e3=function(_0x50fbd4,_0x2d7ed5){_0x50fbd4=_0x50fbd4-0x0;var _0x42005f=_0x8e30[_0x50fbd4];return _0x42005f;};'use strict';var _=require(_0x08e3('0x0'));var util=require(_0x08e3('0x1'));var logger=require(_0x08e3('0x2'))(_0x08e3('0x3'));var moment=require(_0x08e3('0x4'));var BPromise=require(_0x08e3('0x5'));var rp=require(_0x08e3('0x6'));var fs=require('fs');var path=require(_0x08e3('0x7'));var rimraf=require(_0x08e3('0x8'));var config=require('../../config/environment');var attributes=require(_0x08e3('0x9'));module['exports']=function(_0x80ca96,_0xef8ed7){return _0x80ca96[_0x08e3('0xa')]('CmHopperBlack',attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1de5=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./cmHopperBlack.attributes','exports','CmHopperBlack','cm_hopper_black'];(function(_0x1811dd,_0x2ea9a4){var _0x33debb=function(_0x3571cd){while(--_0x3571cd){_0x1811dd['push'](_0x1811dd['shift']());}};_0x33debb(++_0x2ea9a4);}(_0x1de5,0xe4));var _0x51de=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0x1de5[_0x35da42];return _0x370035;};'use strict';var _=require(_0x51de('0x0'));var util=require('util');var logger=require(_0x51de('0x1'))(_0x51de('0x2'));var moment=require(_0x51de('0x3'));var BPromise=require(_0x51de('0x4'));var rp=require(_0x51de('0x5'));var fs=require('fs');var path=require(_0x51de('0x6'));var rimraf=require('rimraf');var config=require(_0x51de('0x7'));var attributes=require(_0x51de('0x8'));module[_0x51de('0x9')]=function(_0x40a936,_0x4217f3){return _0x40a936['define'](_0x51de('0xa'),attributes,{'tableName':_0x51de('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 b8d4f38..2df07c7 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 _0x0efb=['../../config/environment','client','http','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','model','map','then','GetCmHopperBlack','catch','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','destroy','lodash','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0x482267,_0x549708){var _0x59f7bd=function(_0x283f44){while(--_0x283f44){_0x482267['push'](_0x482267['shift']());}};_0x59f7bd(++_0x549708);}(_0x0efb,0xfd));var _0xb0ef=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0x0efb[_0x934425];return _0x31d596;};'use strict';var _=require(_0xb0ef('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb0ef('0x1'));var rs=require(_0xb0ef('0x2'));var fs=require('fs');var Redis=require(_0xb0ef('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb0ef('0x4'))(_0xb0ef('0x5'));var config=require(_0xb0ef('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb0ef('0x7')][_0xb0ef('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1af08f,_0x2b6271,_0x86dcbb){return new BPromise(function(_0x1a0576,_0x366188){return client['request'](_0x1af08f,_0x86dcbb)['then'](function(_0x13c25e){logger[_0xb0ef('0x9')](_0xb0ef('0xa'),_0x2b6271,_0xb0ef('0xb'));logger[_0xb0ef('0xc')](_0xb0ef('0xd'),_0x2b6271,'request\x20sent',JSON[_0xb0ef('0xe')](_0x13c25e));if(_0x13c25e[_0xb0ef('0xf')]){if(_0x13c25e['error'][_0xb0ef('0x10')]===0x1f4){logger[_0xb0ef('0xf')]('CmHopperBlack,\x20%s,\x20%s',_0x2b6271,_0x13c25e[_0xb0ef('0xf')][_0xb0ef('0x11')]);return _0x366188(_0x13c25e[_0xb0ef('0xf')]['message']);}logger[_0xb0ef('0xf')]('CmHopperBlack,\x20%s,\x20%s',_0x2b6271,_0x13c25e['error']['message']);return _0x1a0576(_0x13c25e[_0xb0ef('0xf')]['message']);}else{logger['info'](_0xb0ef('0xa'),_0x2b6271,_0xb0ef('0xb'));_0x1a0576(_0x13c25e[_0xb0ef('0x12')][_0xb0ef('0x11')]);}})['catch'](function(_0xcf06b9){logger[_0xb0ef('0xf')](_0xb0ef('0xa'),_0x2b6271,_0xcf06b9);_0x366188(_0xcf06b9);});});}exports['GetCmHopperBlack']=function(_0x308dc4){var _0x55be2d=this;return new Promise(function(_0x23537c,_0x2f702a){return db[_0xb0ef('0x13')][_0xb0ef('0x14')]({'raw':_0x308dc4[_0xb0ef('0x15')]?_0x308dc4[_0xb0ef('0x15')][_0xb0ef('0x16')]===undefined?!![]:![]:!![],'where':_0x308dc4[_0xb0ef('0x15')]?_0x308dc4[_0xb0ef('0x15')][_0xb0ef('0x17')]||null:null,'attributes':_0x308dc4[_0xb0ef('0x15')]?_0x308dc4['options'][_0xb0ef('0x18')]||null:null,'limit':_0x308dc4[_0xb0ef('0x15')]?_0x308dc4[_0xb0ef('0x15')][_0xb0ef('0x19')]||null:null,'include':_0x308dc4[_0xb0ef('0x15')]?_0x308dc4['options'][_0xb0ef('0x1a')]?_['map'](_0x308dc4[_0xb0ef('0x15')][_0xb0ef('0x1a')],function(_0x35fb01){return{'model':db[_0x35fb01[_0xb0ef('0x1b')]],'as':_0x35fb01['as'],'attributes':_0x35fb01['attributes'],'include':_0x35fb01[_0xb0ef('0x1a')]?_[_0xb0ef('0x1c')](_0x35fb01[_0xb0ef('0x1a')],function(_0xe10a9f){return{'model':db[_0xe10a9f[_0xb0ef('0x1b')]],'as':_0xe10a9f['as'],'attributes':_0xe10a9f[_0xb0ef('0x18')],'include':_0xe10a9f['include']?_['map'](_0xe10a9f[_0xb0ef('0x1a')],function(_0x1fa90f){return{'model':db[_0x1fa90f[_0xb0ef('0x1b')]],'as':_0x1fa90f['as'],'attributes':_0x1fa90f['attributes']};}):[]};}):[]};}):[]:[]})[_0xb0ef('0x1d')](function(_0x34accc){logger[_0xb0ef('0x9')]('GetCmHopperBlack',_0x308dc4);logger['debug'](_0xb0ef('0x1e'),_0x308dc4,JSON[_0xb0ef('0xe')](_0x34accc));_0x23537c(_0x34accc);})[_0xb0ef('0x1f')](function(_0x170bf2){logger[_0xb0ef('0xf')]('GetCmHopperBlack',_0x170bf2[_0xb0ef('0x11')],_0x308dc4);_0x2f702a(_0x55be2d[_0xb0ef('0xf')](0x1f4,_0x170bf2[_0xb0ef('0x11')]));});});};exports[_0xb0ef('0x20')]=function(_0x417572){var _0x101915=this;return new Promise(function(_0x47f9c2,_0x1c6d54){return db[_0xb0ef('0x13')][_0xb0ef('0x21')](_0x417572[_0xb0ef('0x22')],{'raw':_0x417572[_0xb0ef('0x15')]?_0x417572[_0xb0ef('0x15')][_0xb0ef('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x417572['options']?_0x417572[_0xb0ef('0x15')][_0xb0ef('0x17')]||null:null,'attributes':_0x417572[_0xb0ef('0x15')]?_0x417572[_0xb0ef('0x15')][_0xb0ef('0x18')]||null:null,'limit':_0x417572[_0xb0ef('0x15')]?_0x417572['options'][_0xb0ef('0x19')]||null:null})[_0xb0ef('0x1d')](function(_0x288ffe){logger[_0xb0ef('0x9')](_0xb0ef('0x20'),_0x417572);logger[_0xb0ef('0xc')]('UpdateCmHopperBlack',_0x417572,JSON[_0xb0ef('0xe')](_0x288ffe));_0x47f9c2(_0x288ffe);})[_0xb0ef('0x1f')](function(_0x45fdc5){logger['error'](_0xb0ef('0x20'),_0x45fdc5['message'],_0x417572);_0x1c6d54(_0x101915[_0xb0ef('0xf')](0x1f4,_0x45fdc5['message']));});});};exports[_0xb0ef('0x23')]=function(_0x69dc7f){var _0x5dba0a=this;return new Promise(function(_0x5df105,_0x593324){return db[_0xb0ef('0x13')][_0xb0ef('0x24')]({'where':_0x69dc7f[_0xb0ef('0x15')]?_0x69dc7f['options']['where']||null:null})[_0xb0ef('0x1d')](function(_0x299020){logger[_0xb0ef('0x9')](_0xb0ef('0x23'),_0x69dc7f);logger[_0xb0ef('0xc')](_0xb0ef('0x23'),_0x69dc7f,JSON[_0xb0ef('0xe')](_0x299020));_0x5df105(_0x299020);})[_0xb0ef('0x1f')](function(_0x25accf){logger[_0xb0ef('0xf')](_0xb0ef('0x23'),_0x25accf[_0xb0ef('0x11')],_0x69dc7f);_0x593324(_0x5dba0a[_0xb0ef('0xf')](0x1f4,_0x25accf[_0xb0ef('0x11')]));});});}; \ No newline at end of file +var _0x2439=['raw','where','attributes','limit','include','model','then','UpdateCmHopperBlack','update','DestroyCmHopperBlack','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','request\x20sent','debug','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','result','catch','GetCmHopperBlack','CmHopperBlack','options'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x2439,0xbe));var _0x9243=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0x2439[_0x599e60];return _0x468e19;};'use strict';var _=require(_0x9243('0x0'));var util=require(_0x9243('0x1'));var moment=require(_0x9243('0x2'));var BPromise=require(_0x9243('0x3'));var rs=require(_0x9243('0x4'));var fs=require('fs');var Redis=require(_0x9243('0x5'));var db=require(_0x9243('0x6'))['db'];var utils=require(_0x9243('0x7'));var logger=require(_0x9243('0x8'))(_0x9243('0x9'));var config=require(_0x9243('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9243('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x16e345,_0x48fd25,_0x2336fc){return new BPromise(function(_0x30dcf0,_0x2ae000){return client[_0x9243('0xc')](_0x16e345,_0x2336fc)['then'](function(_0x3ac039){logger[_0x9243('0xd')]('CmHopperBlack,\x20%s,\x20%s',_0x48fd25,_0x9243('0xe'));logger[_0x9243('0xf')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x48fd25,_0x9243('0xe'),JSON[_0x9243('0x10')](_0x3ac039));if(_0x3ac039[_0x9243('0x11')]){if(_0x3ac039['error'][_0x9243('0x12')]===0x1f4){logger[_0x9243('0x11')](_0x9243('0x13'),_0x48fd25,_0x3ac039[_0x9243('0x11')]['message']);return _0x2ae000(_0x3ac039[_0x9243('0x11')][_0x9243('0x14')]);}logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x48fd25,_0x3ac039['error'][_0x9243('0x14')]);return _0x30dcf0(_0x3ac039[_0x9243('0x11')][_0x9243('0x14')]);}else{logger[_0x9243('0xd')]('CmHopperBlack,\x20%s,\x20%s',_0x48fd25,'request\x20sent');_0x30dcf0(_0x3ac039[_0x9243('0x15')][_0x9243('0x14')]);}})[_0x9243('0x16')](function(_0x4cfef8){logger[_0x9243('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x48fd25,_0x4cfef8);_0x2ae000(_0x4cfef8);});});}exports[_0x9243('0x17')]=function(_0x1d5f5a){var _0x20ff20=this;return new Promise(function(_0x23d18c,_0x39636e){return db[_0x9243('0x18')]['findAll']({'raw':_0x1d5f5a['options']?_0x1d5f5a[_0x9243('0x19')][_0x9243('0x1a')]===undefined?!![]:![]:!![],'where':_0x1d5f5a[_0x9243('0x19')]?_0x1d5f5a[_0x9243('0x19')][_0x9243('0x1b')]||null:null,'attributes':_0x1d5f5a[_0x9243('0x19')]?_0x1d5f5a[_0x9243('0x19')][_0x9243('0x1c')]||null:null,'limit':_0x1d5f5a['options']?_0x1d5f5a[_0x9243('0x19')][_0x9243('0x1d')]||null:null,'include':_0x1d5f5a[_0x9243('0x19')]?_0x1d5f5a['options'][_0x9243('0x1e')]?_['map'](_0x1d5f5a[_0x9243('0x19')][_0x9243('0x1e')],function(_0x51a17e){return{'model':db[_0x51a17e['model']],'as':_0x51a17e['as'],'attributes':_0x51a17e[_0x9243('0x1c')],'include':_0x51a17e[_0x9243('0x1e')]?_['map'](_0x51a17e['include'],function(_0x26e971){return{'model':db[_0x26e971[_0x9243('0x1f')]],'as':_0x26e971['as'],'attributes':_0x26e971[_0x9243('0x1c')],'include':_0x26e971[_0x9243('0x1e')]?_['map'](_0x26e971['include'],function(_0x338bd3){return{'model':db[_0x338bd3[_0x9243('0x1f')]],'as':_0x338bd3['as'],'attributes':_0x338bd3[_0x9243('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9243('0x20')](function(_0x4aa939){logger[_0x9243('0xd')]('GetCmHopperBlack',_0x1d5f5a);logger[_0x9243('0xf')](_0x9243('0x17'),_0x1d5f5a,JSON[_0x9243('0x10')](_0x4aa939));_0x23d18c(_0x4aa939);})[_0x9243('0x16')](function(_0x75ad46){logger[_0x9243('0x11')](_0x9243('0x17'),_0x75ad46[_0x9243('0x14')],_0x1d5f5a);_0x39636e(_0x20ff20[_0x9243('0x11')](0x1f4,_0x75ad46[_0x9243('0x14')]));});});};exports[_0x9243('0x21')]=function(_0x3040de){var _0x2d4d9d=this;return new Promise(function(_0x5edae6,_0x489eb9){return db[_0x9243('0x18')][_0x9243('0x22')](_0x3040de['body'],{'raw':_0x3040de['options']?_0x3040de[_0x9243('0x19')][_0x9243('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3040de[_0x9243('0x19')]?_0x3040de[_0x9243('0x19')]['where']||null:null,'attributes':_0x3040de[_0x9243('0x19')]?_0x3040de['options'][_0x9243('0x1c')]||null:null,'limit':_0x3040de['options']?_0x3040de['options']['limit']||null:null})[_0x9243('0x20')](function(_0x56f0c2){logger[_0x9243('0xd')](_0x9243('0x21'),_0x3040de);logger['debug'](_0x9243('0x21'),_0x3040de,JSON[_0x9243('0x10')](_0x56f0c2));_0x5edae6(_0x56f0c2);})[_0x9243('0x16')](function(_0x2ea9ad){logger[_0x9243('0x11')](_0x9243('0x21'),_0x2ea9ad[_0x9243('0x14')],_0x3040de);_0x489eb9(_0x2d4d9d[_0x9243('0x11')](0x1f4,_0x2ea9ad[_0x9243('0x14')]));});});};exports['DestroyCmHopperBlack']=function(_0x38991d){var _0x127c66=this;return new Promise(function(_0x2b6af8,_0x57e41c){return db[_0x9243('0x18')]['destroy']({'where':_0x38991d[_0x9243('0x19')]?_0x38991d[_0x9243('0x19')][_0x9243('0x1b')]||null:null})[_0x9243('0x20')](function(_0x48a317){logger[_0x9243('0xd')](_0x9243('0x23'),_0x38991d);logger['debug'](_0x9243('0x23'),_0x38991d,JSON['stringify'](_0x48a317));_0x2b6af8(_0x48a317);})[_0x9243('0x16')](function(_0x19db6e){logger['error']('DestroyCmHopperBlack',_0x19db6e[_0x9243('0x14')],_0x38991d);_0x57e41c(_0x127c66[_0x9243('0x11')](0x1f4,_0x19db6e['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 6752774..579107d 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 _0xf2ca=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','isAuthenticated','index','get','/describe','describe','put','update','delete','/:id'];(function(_0x43d5ea,_0xd22a01){var _0x3e08e5=function(_0x9f7792){while(--_0x9f7792){_0x43d5ea['push'](_0x43d5ea['shift']());}};_0x3e08e5(++_0xd22a01);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x2b47ad,_0x55c7cc){_0x2b47ad=_0x2b47ad-0x0;var _0x1a2426=_0xf2ca[_0x2b47ad];return _0x1a2426;};'use strict';var multer=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var path=require(_0xaf2c('0x2'));var timeout=require('connect-timeout');var express=require(_0xaf2c('0x3'));var router=express[_0xaf2c('0x4')]();var auth=require(_0xaf2c('0x5'));var interaction=require(_0xaf2c('0x6'));var config=require(_0xaf2c('0x7'));var controller=require(_0xaf2c('0x8'));router['get']('/',auth[_0xaf2c('0x9')](),controller[_0xaf2c('0xa')]);router[_0xaf2c('0xb')](_0xaf2c('0xc'),auth['isAuthenticated'](),controller[_0xaf2c('0xd')]);router[_0xaf2c('0xb')]('/:id',auth[_0xaf2c('0x9')](),controller['show']);router[_0xaf2c('0xe')]('/:id',auth[_0xaf2c('0x9')](),controller[_0xaf2c('0xf')]);router[_0xaf2c('0x10')](_0xaf2c('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0xaf2c('0x12')]=router; \ No newline at end of file +var _0x9a19=['/describe','/:id','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index'];(function(_0x2fa11f,_0x2e47cb){var _0xe2e74e=function(_0x2452e5){while(--_0x2452e5){_0x2fa11f['push'](_0x2fa11f['shift']());}};_0xe2e74e(++_0x2e47cb);}(_0x9a19,0x114));var _0x99a1=function(_0x3df9dd,_0x26f5cd){_0x3df9dd=_0x3df9dd-0x0;var _0x4f11e4=_0x9a19[_0x3df9dd];return _0x4f11e4;};'use strict';var multer=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var path=require(_0x99a1('0x2'));var timeout=require('connect-timeout');var express=require(_0x99a1('0x3'));var router=express[_0x99a1('0x4')]();var auth=require(_0x99a1('0x5'));var interaction=require(_0x99a1('0x6'));var config=require(_0x99a1('0x7'));var controller=require(_0x99a1('0x8'));router[_0x99a1('0x9')]('/',auth[_0x99a1('0xa')](),controller[_0x99a1('0xb')]);router[_0x99a1('0x9')](_0x99a1('0xc'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x99a1('0xd'),auth[_0x99a1('0xa')](),controller['show']);router['put'](_0x99a1('0xd'),auth[_0x99a1('0xa')](),controller[_0x99a1('0xe')]);router[_0x99a1('0xf')](_0x99a1('0xd'),auth['isAuthenticated'](),controller[_0x99a1('0x10')]);module[_0x99a1('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index b14d148..0877fd6 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 _0xdeee=['endtime','setDataValue','followuptime','diff','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE'];(function(_0x3e769f,_0x3abef0){var _0x2780ba=function(_0xd038da){while(--_0xd038da){_0x3e769f['push'](_0x3e769f['shift']());}};_0x2780ba(++_0x3abef0);}(_0xdeee,0xf7));var _0xedee=function(_0x4669ee,_0x203ce9){_0x4669ee=_0x4669ee-0x0;var _0x3ff429=_0xdeee[_0x4669ee];return _0x3ff429;};'use strict';var Sequelize=require(_0xedee('0x0'));var moment=require(_0xedee('0x1'));module[_0xedee('0x2')]={'state':{'type':Sequelize[_0xedee('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xedee('0x4')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xedee('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xedee('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xedee('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xedee('0x4')]},'calleridnum':{'type':Sequelize[_0xedee('0x4')]},'calleridname':{'type':Sequelize[_0xedee('0x4')]},'starttime':{'type':Sequelize[_0xedee('0x5')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xedee('0x5')]},'droptime':{'type':Sequelize[_0xedee('0x5')]},'endtime':{'type':Sequelize[_0xedee('0x5')]},'ringtime':{'type':Sequelize[_0xedee('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xedee('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xedee('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xedee('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xedee('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xedee('0x4')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x10faf5){var _0x4e4a79=this['getDataValue'](_0xedee('0x6'));if(_0x4e4a79&&_0x10faf5){this[_0xedee('0x7')](_0xedee('0x8'),moment(_0x10faf5)[_0xedee('0x9')](moment(_0x4e4a79),'seconds'));}return this[_0xedee('0x7')]('dispositionat',_0x10faf5);}},'amd':{'type':Sequelize[_0xedee('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0xedee('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xedee('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xedee('0x5')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xedee('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0xedee('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xedee('0x5')]},'recallme':{'type':Sequelize[_0xedee('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xedee('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xedee('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xedee('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xedee('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xedee('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xcd0b=['STRING','DATE','INTEGER','getDataValue','endtime','setDataValue','followuptime','diff','dispositionat','BOOLEAN','sequelize','moment'];(function(_0x5d2d8c,_0x332d36){var _0x4b4701=function(_0x1ded62){while(--_0x1ded62){_0x5d2d8c['push'](_0x5d2d8c['shift']());}};_0x4b4701(++_0x332d36);}(_0xcd0b,0x14e));var _0xbcd0=function(_0x99bfe7,_0x2a9a92){_0x99bfe7=_0x99bfe7-0x0;var _0x33988c=_0xcd0b[_0x99bfe7];return _0x33988c;};'use strict';var Sequelize=require(_0xbcd0('0x0'));var moment=require(_0xbcd0('0x1'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xbcd0('0x2')]},'scheduledat':{'type':Sequelize[_0xbcd0('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xbcd0('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xbcd0('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xbcd0('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xbcd0('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xbcd0('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xbcd0('0x2')]},'calleridname':{'type':Sequelize[_0xbcd0('0x2')]},'starttime':{'type':Sequelize[_0xbcd0('0x3')]},'responsetime':{'type':Sequelize[_0xbcd0('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xbcd0('0x3')]},'endtime':{'type':Sequelize[_0xbcd0('0x3')]},'ringtime':{'type':Sequelize[_0xbcd0('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xbcd0('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xbcd0('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xbcd0('0x2')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xbcd0('0x2')]},'membername':{'type':Sequelize[_0xbcd0('0x2')]},'reason':{'type':Sequelize[_0xbcd0('0x2')]},'disposition':{'type':Sequelize[_0xbcd0('0x2')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x360146){var _0x2d69c4=this[_0xbcd0('0x5')](_0xbcd0('0x6'));if(_0x2d69c4&&_0x360146){this[_0xbcd0('0x7')](_0xbcd0('0x8'),moment(_0x360146)[_0xbcd0('0x9')](moment(_0x2d69c4),'seconds'));}return this[_0xbcd0('0x7')](_0xbcd0('0xa'),_0x360146);}},'amd':{'type':Sequelize[_0xbcd0('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0xbcd0('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xbcd0('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xbcd0('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xbcd0('0x3')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xbcd0('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xbcd0('0x3')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0xbcd0('0x3')]},'recallme':{'type':Sequelize[_0xbcd0('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xbcd0('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0xbcd0('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xbcd0('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xbcd0('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xbcd0('0x4')],'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 a3c7971..1d86b22 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 _0xb1ad=['toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','group','moveContactsIvrCampaignHopperFinal','Campaign','cm_hopper','CampaignId','CampaignId\x20=\x20?','calleridnum','state\x20=\x204','CmHopper','findOne','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','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','error','stack','name','send','map','rawAttributes','type','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','CmHopperFinal','includeAll','include','findAll','rows','catch','show','params','keys','merge','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','noAnswerContacts','literal','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x2010\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','insert','into','fromQuery','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','select','field','ANY_VALUE(calleridnum)','phone','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','NOW()','updatedAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state'];(function(_0x135c3e,_0x48d75a){var _0x36541c=function(_0x246bd3){while(--_0x246bd3){_0x135c3e['push'](_0x135c3e['shift']());}};_0x36541c(++_0x48d75a);}(_0xb1ad,0x184));var _0xdb1a=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xb1ad[_0xf50820];return _0x2a9b10;};'use strict';var pdf=require(_0xdb1a('0x0'));var emlformat=require(_0xdb1a('0x1'));var rimraf=require(_0xdb1a('0x2'));var zipdir=require(_0xdb1a('0x3'));var jsonpatch=require(_0xdb1a('0x4'));var rp=require(_0xdb1a('0x5'));var moment=require('moment');var BPromise=require(_0xdb1a('0x6'));var Mustache=require(_0xdb1a('0x7'));var util=require(_0xdb1a('0x8'));var path=require(_0xdb1a('0x9'));var sox=require(_0xdb1a('0xa'));var csv=require(_0xdb1a('0xb'));var ejs=require(_0xdb1a('0xc'));var fs=require('fs');var _=require(_0xdb1a('0xd'));var squel=require(_0xdb1a('0xe'));var crypto=require(_0xdb1a('0xf'));var jsforce=require(_0xdb1a('0x10'));var deskjs=require(_0xdb1a('0x11'));var toCsv=require(_0xdb1a('0xb'));var querystring=require(_0xdb1a('0x12'));var Papa=require(_0xdb1a('0x13'));var Redis=require('ioredis');var authService=require(_0xdb1a('0x14'));var qs=require(_0xdb1a('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xdb1a('0x16'));var utils=require(_0xdb1a('0x17'));var config=require(_0xdb1a('0x18'));var db=require(_0xdb1a('0x19'))['db'];function respondWithStatusCode(_0x3cae97,_0x31ccd3){_0x31ccd3=_0x31ccd3||0xcc;return function(_0x3ca28b){if(_0x3ca28b){return _0x3cae97[_0xdb1a('0x1a')](_0x31ccd3);}return _0x3cae97[_0xdb1a('0x1b')](_0x31ccd3)[_0xdb1a('0x1c')]();};}function respondWithResult(_0x40851a,_0x1d69dd){_0x1d69dd=_0x1d69dd||0xc8;return function(_0x857c00){if(_0x857c00){return _0x40851a['status'](_0x1d69dd)[_0xdb1a('0x1d')](_0x857c00);}};}function respondWithFilteredResult(_0x135faf,_0x112be1){return function(_0x4bdec7){if(_0x4bdec7){var _0x28dfe9=_0x4bdec7[_0xdb1a('0x1e')],_0x504d92=_0x112be1['offset'],_0x1c9d2b=_0x112be1[_0xdb1a('0x1f')]+_0x112be1[_0xdb1a('0x20')],_0x3419d5;if(_0x1c9d2b>=_0x28dfe9){_0x1c9d2b=_0x28dfe9;_0x3419d5=0xc8;}else{_0x3419d5=0xce;}_0x135faf[_0xdb1a('0x1b')](_0x3419d5);return _0x135faf['set'](_0xdb1a('0x21'),_0x504d92+'-'+_0x1c9d2b+'/'+_0x28dfe9)[_0xdb1a('0x1d')](_0x4bdec7);}return null;};}function patchUpdates(_0x192d45){return function(_0x15fc44){try{jsonpatch[_0xdb1a('0x22')](_0x15fc44,_0x192d45,!![]);}catch(_0x2882e2){return BPromise['reject'](_0x2882e2);}return _0x15fc44[_0xdb1a('0x23')]();};}function saveUpdates(_0x212f90,_0x386e32){return function(_0x37b776){if(_0x37b776){return _0x37b776[_0xdb1a('0x24')](_0x212f90)[_0xdb1a('0x25')](function(_0x1e6f9d){return _0x1e6f9d;});}return null;};}function removeEntity(_0x20521b,_0x3a9b3a){return function(_0xc92d26){if(_0xc92d26){return _0xc92d26['destroy']()[_0xdb1a('0x25')](function(){_0x20521b['status'](0xcc)[_0xdb1a('0x1c')]();});}};}function handleEntityNotFound(_0x2cc1aa,_0x3d07fc){return function(_0x5d3d24){if(!_0x5d3d24){_0x2cc1aa[_0xdb1a('0x1a')](0x194);}return _0x5d3d24;};}function handleError(_0x58ae1d,_0x3f4d11){_0x3f4d11=_0x3f4d11||0x1f4;return function(_0x37c95e){logger[_0xdb1a('0x26')](_0x37c95e[_0xdb1a('0x27')]);if(_0x37c95e[_0xdb1a('0x28')]){delete _0x37c95e[_0xdb1a('0x28')];}_0x58ae1d[_0xdb1a('0x1b')](_0x3f4d11)[_0xdb1a('0x29')](_0x37c95e);};}exports['index']=function(_0x50c1d7,_0x3a5493){var _0x2c8133={},_0x151af7={},_0x4341b1={'count':0x0,'rows':[]};var _0x29bdfc=_[_0xdb1a('0x2a')](db['CmHopperFinal'][_0xdb1a('0x2b')],function(_0x51f0ff){return{'name':_0x51f0ff['fieldName'],'type':_0x51f0ff[_0xdb1a('0x2c')]['key']};});_0x151af7['model']=_[_0xdb1a('0x2a')](_0x29bdfc,_0xdb1a('0x28'));_0x151af7[_0xdb1a('0x2d')]=_['keys'](_0x50c1d7[_0xdb1a('0x2d')]);_0x151af7[_0xdb1a('0x2e')]=_[_0xdb1a('0x2f')](_0x151af7[_0xdb1a('0x30')],_0x151af7['query']);_0x2c8133[_0xdb1a('0x31')]=_[_0xdb1a('0x2f')](_0x151af7[_0xdb1a('0x30')],qs['fields'](_0x50c1d7[_0xdb1a('0x2d')][_0xdb1a('0x32')]));_0x2c8133[_0xdb1a('0x31')]=_0x2c8133[_0xdb1a('0x31')]['length']?_0x2c8133['attributes']:_0x151af7['model'];if(!_0x50c1d7[_0xdb1a('0x2d')][_0xdb1a('0x33')]('nolimit')){_0x2c8133[_0xdb1a('0x20')]=qs[_0xdb1a('0x20')](_0x50c1d7[_0xdb1a('0x2d')][_0xdb1a('0x20')]);_0x2c8133[_0xdb1a('0x1f')]=qs['offset'](_0x50c1d7['query']['offset']);}_0x2c8133[_0xdb1a('0x34')]=qs['sort'](_0x50c1d7['query'][_0xdb1a('0x35')]);_0x2c8133[_0xdb1a('0x36')]=qs['filters'](_[_0xdb1a('0x37')](_0x50c1d7[_0xdb1a('0x2d')],_0x151af7[_0xdb1a('0x2e')]));if(_0x50c1d7[_0xdb1a('0x2d')][_0xdb1a('0x38')]){_0x2c8133['where']=_['merge'](_0x2c8133[_0xdb1a('0x36')],{'$or':_[_0xdb1a('0x2a')](_0x29bdfc,function(_0x8d7eeb){if(_0x8d7eeb[_0xdb1a('0x2c')]!==_0xdb1a('0x39')){var _0x132d6e={};_0x132d6e[_0x8d7eeb[_0xdb1a('0x28')]]={'$like':'%'+_0x50c1d7['query'][_0xdb1a('0x38')]+'%'};return _0x132d6e;}})});}_0x2c8133=_['merge']({},_0x2c8133,_0x50c1d7['options']);var _0x5d5f21={'where':_0x2c8133['where']};return db[_0xdb1a('0x3a')][_0xdb1a('0x1e')](_0x5d5f21)[_0xdb1a('0x25')](function(_0x3c3755){_0x4341b1[_0xdb1a('0x1e')]=_0x3c3755;if(_0x50c1d7[_0xdb1a('0x2d')][_0xdb1a('0x3b')]){_0x2c8133[_0xdb1a('0x3c')]=[{'all':!![]}];}return db[_0xdb1a('0x3a')][_0xdb1a('0x3d')](_0x2c8133);})[_0xdb1a('0x25')](function(_0x2bf8e1){_0x4341b1[_0xdb1a('0x3e')]=_0x2bf8e1;return _0x4341b1;})[_0xdb1a('0x25')](respondWithFilteredResult(_0x3a5493,_0x2c8133))[_0xdb1a('0x3f')](handleError(_0x3a5493,null));};exports[_0xdb1a('0x40')]=function(_0x4f42fd,_0x593e94){var _0x43e27a={'raw':!![],'where':{'id':_0x4f42fd[_0xdb1a('0x41')]['id']}},_0x4e1e04={};_0x4e1e04[_0xdb1a('0x30')]=_[_0xdb1a('0x42')](db[_0xdb1a('0x3a')][_0xdb1a('0x2b')]);_0x4e1e04[_0xdb1a('0x2d')]=_[_0xdb1a('0x42')](_0x4f42fd[_0xdb1a('0x2d')]);_0x4e1e04[_0xdb1a('0x2e')]=_[_0xdb1a('0x2f')](_0x4e1e04[_0xdb1a('0x30')],_0x4e1e04['query']);_0x43e27a[_0xdb1a('0x31')]=_[_0xdb1a('0x2f')](_0x4e1e04[_0xdb1a('0x30')],qs[_0xdb1a('0x32')](_0x4f42fd[_0xdb1a('0x2d')][_0xdb1a('0x32')]));_0x43e27a[_0xdb1a('0x31')]=_0x43e27a['attributes']['length']?_0x43e27a['attributes']:_0x4e1e04[_0xdb1a('0x30')];if(_0x4f42fd[_0xdb1a('0x2d')]['includeAll']){_0x43e27a[_0xdb1a('0x3c')]=[{'all':!![]}];}_0x43e27a=_[_0xdb1a('0x43')]({},_0x43e27a,_0x4f42fd['options']);return db['CmHopperFinal'][_0xdb1a('0x44')](_0x43e27a)[_0xdb1a('0x25')](handleEntityNotFound(_0x593e94,null))['then'](respondWithResult(_0x593e94,null))[_0xdb1a('0x3f')](handleError(_0x593e94,null));};exports[_0xdb1a('0x45')]=function(_0x1a36dd,_0x4af283){return db[_0xdb1a('0x3a')][_0xdb1a('0x45')]()[_0xdb1a('0x25')](respondWithResult(_0x4af283,null))[_0xdb1a('0x3f')](handleError(_0x4af283,null));};exports['update']=function(_0x37aa5e,_0x452aa8){if(_0x37aa5e[_0xdb1a('0x46')][_0xdb1a('0x47')]){delete _0x37aa5e['body'][_0xdb1a('0x47')];}return db[_0xdb1a('0x3a')][_0xdb1a('0x44')]({'where':{'uniqueid':_0x37aa5e[_0xdb1a('0x41')]['id']}})[_0xdb1a('0x25')](handleEntityNotFound(_0x452aa8,null))[_0xdb1a('0x25')](saveUpdates(_0x37aa5e[_0xdb1a('0x46')],null))[_0xdb1a('0x25')](respondWithResult(_0x452aa8,null))[_0xdb1a('0x3f')](handleError(_0x452aa8,null));};exports[_0xdb1a('0x48')]=function(_0x4f87f6,_0x548e74,_0x536f12){return db[_0xdb1a('0x3a')][_0xdb1a('0x3d')]({'raw':![],'where':{'VoiceQueueId':_0x4f87f6[_0xdb1a('0x41')]['id']},'attributes':[[db[_0xdb1a('0x49')]['fn'](_0xdb1a('0x4a'),db[_0xdb1a('0x49')]['fn']('IF',db[_0xdb1a('0x49')]['literal']('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db['sequelize']['fn'](_0xdb1a('0x4a'),db[_0xdb1a('0x49')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x203,\x201,\x20null'))),_0xdb1a('0x4b')],[db[_0xdb1a('0x49')]['fn'](_0xdb1a('0x4a'),db[_0xdb1a('0x49')]['fn']('IF',db[_0xdb1a('0x49')][_0xdb1a('0x4c')]('`state`\x20=\x205,\x201,\x20null'))),_0xdb1a('0x4d')],[db[_0xdb1a('0x49')]['fn'](_0xdb1a('0x4a'),db[_0xdb1a('0x49')]['fn']('IF',db[_0xdb1a('0x49')][_0xdb1a('0x4c')](_0xdb1a('0x4e')))),_0xdb1a('0x4f')],[db[_0xdb1a('0x49')]['fn']('COUNT',db[_0xdb1a('0x49')]['fn']('IF',db[_0xdb1a('0x49')][_0xdb1a('0x4c')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xdb1a('0x50')],[db[_0xdb1a('0x49')]['fn'](_0xdb1a('0x4a'),db[_0xdb1a('0x49')]['fn']('IF',db[_0xdb1a('0x49')][_0xdb1a('0x4c')](_0xdb1a('0x51')))),'abandonedContacts'],[db[_0xdb1a('0x49')]['fn']('COUNT',db[_0xdb1a('0x49')]['fn']('IF',db['sequelize'][_0xdb1a('0x4c')]('`state`\x20=\x2022,\x201,\x20null'))),_0xdb1a('0x52')],[db['sequelize']['fn'](_0xdb1a('0x4a'),db[_0xdb1a('0x49')]['fn']('IF',db[_0xdb1a('0x49')][_0xdb1a('0x4c')](_0xdb1a('0x53')))),_0xdb1a('0x54')]]})[_0xdb1a('0x25')](handleEntityNotFound(_0x548e74,null))[_0xdb1a('0x25')](respondWithResult(_0x548e74,null))[_0xdb1a('0x3f')](handleError(_0x548e74,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x427292,_0x41ffbf,_0x1bdb0e){return db[_0xdb1a('0x3a')][_0xdb1a('0x3d')]({'raw':![],'where':{'CampaignId':_0x427292[_0xdb1a('0x41')]['id']},'attributes':[[db[_0xdb1a('0x49')]['fn'](_0xdb1a('0x4a'),db['sequelize']['fn']('IF',db[_0xdb1a('0x49')][_0xdb1a('0x4c')](_0xdb1a('0x55')))),_0xdb1a('0x56')],[db['sequelize']['fn']('COUNT',db[_0xdb1a('0x49')]['fn']('IF',db[_0xdb1a('0x49')][_0xdb1a('0x4c')]('`state`\x20=\x203,\x201,\x20null'))),_0xdb1a('0x4b')],[db[_0xdb1a('0x49')]['fn'](_0xdb1a('0x4a'),db['sequelize']['fn']('IF',db[_0xdb1a('0x49')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0xdb1a('0x4d')],[db[_0xdb1a('0x49')]['fn'](_0xdb1a('0x4a'),db[_0xdb1a('0x49')]['fn']('IF',db[_0xdb1a('0x49')][_0xdb1a('0x4c')](_0xdb1a('0x4e')))),_0xdb1a('0x4f')],[db[_0xdb1a('0x49')]['fn'](_0xdb1a('0x4a'),db[_0xdb1a('0x49')]['fn']('IF',db[_0xdb1a('0x49')]['literal'](_0xdb1a('0x57')))),'dropContacts'],[db[_0xdb1a('0x49')]['fn']('COUNT',db[_0xdb1a('0x49')]['fn']('IF',db[_0xdb1a('0x49')][_0xdb1a('0x4c')](_0xdb1a('0x51')))),_0xdb1a('0x58')],[db['sequelize']['fn'](_0xdb1a('0x4a'),db[_0xdb1a('0x49')]['fn']('IF',db[_0xdb1a('0x49')][_0xdb1a('0x4c')](_0xdb1a('0x59')))),_0xdb1a('0x52')],[db['sequelize']['fn'](_0xdb1a('0x4a'),db[_0xdb1a('0x49')]['fn']('IF',db[_0xdb1a('0x49')][_0xdb1a('0x4c')](_0xdb1a('0x53')))),_0xdb1a('0x54')]]})[_0xdb1a('0x25')](handleEntityNotFound(_0x41ffbf,null))[_0xdb1a('0x25')](respondWithResult(_0x41ffbf,null))[_0xdb1a('0x3f')](handleError(_0x41ffbf,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x17c933,_0x2b555e,_0x2aa700){return db['VoiceQueue'][_0xdb1a('0x44')]({'where':{'id':_0x17c933['params']['id']}})[_0xdb1a('0x25')](handleEntityNotFound(_0x2b555e,null))['then'](function(_0x195192){var _0x322656;if(_0x195192){_0x322656=squel[_0xdb1a('0x5a')]()[_0xdb1a('0x5b')]('cm_hopper')[_0xdb1a('0x5c')](['phone',_0xdb1a('0x5d'),_0xdb1a('0x5e'),_0xdb1a('0x5f'),_0xdb1a('0x60'),_0xdb1a('0x61'),'updatedAt'],squel[_0xdb1a('0x62')]()[_0xdb1a('0x63')](_0xdb1a('0x64'),_0xdb1a('0x65'))[_0xdb1a('0x63')]('NOW()','scheduledAt')[_0xdb1a('0x63')](_0xdb1a('0x66'),_0xdb1a('0x5e'))[_0xdb1a('0x63')](_0xdb1a('0x67'),_0xdb1a('0x5f'))[_0xdb1a('0x63')](_0xdb1a('0x68'),_0xdb1a('0x60'))[_0xdb1a('0x63')](_0xdb1a('0x69'),_0xdb1a('0x61'))[_0xdb1a('0x63')](_0xdb1a('0x69'),_0xdb1a('0x6a'))[_0xdb1a('0x6b')](_0xdb1a('0x6c'))[_0xdb1a('0x36')](_0xdb1a('0x6d'),_0x17c933['params']['id']['toString']())[_0xdb1a('0x36')](_0xdb1a('0x6e'),_0x17c933[_0xdb1a('0x46')][_0xdb1a('0x6f')][_0xdb1a('0x70')]())[_0xdb1a('0x36')](_0xdb1a('0x71'))['where'](_0xdb1a('0x72'),squel[_0xdb1a('0x62')]()[_0xdb1a('0x63')](_0xdb1a('0x65'))['from']('cm_hopper')[_0xdb1a('0x36')]('VoiceQueueId\x20=\x20?',_0x17c933[_0xdb1a('0x41')]['id']['toString']()))[_0xdb1a('0x36')](_0xdb1a('0x72'),squel['select']()['field']('calleridnum')[_0xdb1a('0x6b')](_0xdb1a('0x6c'))['where']('VoiceQueueId\x20=\x20?',_0x17c933[_0xdb1a('0x41')]['id'][_0xdb1a('0x70')]())[_0xdb1a('0x36')]('state\x20=\x204'))[_0xdb1a('0x73')](_0xdb1a('0x5e')))['toString']();return db[_0xdb1a('0x49')]['query'](_0x322656);}return[];})[_0xdb1a('0x25')](respondWithResult(_0x2b555e,null))[_0xdb1a('0x3f')](handleError(_0x2b555e,null));};exports[_0xdb1a('0x74')]=function(_0x1121f0,_0x4a25cb,_0x5ed589){return db[_0xdb1a('0x75')][_0xdb1a('0x44')]({'where':{'id':_0x1121f0['params']['id']}})[_0xdb1a('0x25')](handleEntityNotFound(_0x4a25cb,null))[_0xdb1a('0x25')](function(_0x16b83f){var _0x3c36bf;if(_0x16b83f){_0x3c36bf=squel[_0xdb1a('0x5a')]()[_0xdb1a('0x5b')](_0xdb1a('0x76'))[_0xdb1a('0x5c')]([_0xdb1a('0x65'),_0xdb1a('0x5d'),_0xdb1a('0x5e'),_0xdb1a('0x5f'),_0xdb1a('0x77'),_0xdb1a('0x61'),_0xdb1a('0x6a')],squel['select']()[_0xdb1a('0x63')](_0xdb1a('0x64'),'phone')[_0xdb1a('0x63')](_0xdb1a('0x69'),'scheduledAt')['field'](_0xdb1a('0x66'),_0xdb1a('0x5e'))[_0xdb1a('0x63')](_0xdb1a('0x67'),_0xdb1a('0x5f'))['field']('ANY_VALUE(CampaignId)','CampaignId')['field']('NOW()','createdAt')[_0xdb1a('0x63')](_0xdb1a('0x69'),_0xdb1a('0x6a'))['from'](_0xdb1a('0x6c'))[_0xdb1a('0x36')]('CampaignId\x20=\x20?',_0x1121f0[_0xdb1a('0x41')]['id']['toString']())[_0xdb1a('0x36')]('state\x20=\x20?',_0x1121f0[_0xdb1a('0x46')][_0xdb1a('0x6f')][_0xdb1a('0x70')]())[_0xdb1a('0x36')](_0xdb1a('0x71'))[_0xdb1a('0x36')](_0xdb1a('0x72'),squel[_0xdb1a('0x62')]()[_0xdb1a('0x63')](_0xdb1a('0x65'))[_0xdb1a('0x6b')]('cm_hopper')[_0xdb1a('0x36')](_0xdb1a('0x78'),_0x1121f0[_0xdb1a('0x41')]['id'][_0xdb1a('0x70')]()))[_0xdb1a('0x36')](_0xdb1a('0x72'),squel['select']()[_0xdb1a('0x63')](_0xdb1a('0x79'))[_0xdb1a('0x6b')](_0xdb1a('0x6c'))[_0xdb1a('0x36')](_0xdb1a('0x78'),_0x1121f0['params']['id'][_0xdb1a('0x70')]())[_0xdb1a('0x36')](_0xdb1a('0x7a')))[_0xdb1a('0x73')](_0xdb1a('0x5e')))['toString']();return db[_0xdb1a('0x49')]['query'](_0x3c36bf);}return[];})[_0xdb1a('0x25')](respondWithResult(_0x4a25cb,null))[_0xdb1a('0x3f')](handleError(_0x4a25cb,null));};exports['checkContactHopper']=function(_0x272422,_0x2891af,_0x4e3bdf){return db[_0xdb1a('0x7b')][_0xdb1a('0x7c')]({'where':{'VoiceQueueId':_0x272422['body']['VoiceQueueId'],'CampaignId':_0x272422[_0xdb1a('0x46')][_0xdb1a('0x77')],'ContactId':_0x272422['body'][_0xdb1a('0x5e')]}})['then'](handleEntityNotFound(_0x2891af,null))[_0xdb1a('0x25')](function(_0x2fb85c){if(_0x2fb85c){return _0x2fb85c;}return null;})[_0xdb1a('0x25')](respondWithResult(_0x2891af,null))[_0xdb1a('0x3f')](handleError(_0x2891af,null));}; \ No newline at end of file +var _0x192f=['fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','include','findAll','rows','show','params','includeAll','catch','uniqueid','find','body','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','abandonedContacts','reCallContacts','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','VoiceQueueId','select','field','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','NOW()','createdAt','from','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','ListId','CampaignId','updatedAt','cm_hopper_final','CampaignId\x20=\x20?','state\x20=\x20?','findOne','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','then','error','stack','name','send','map','CmHopperFinal','rawAttributes'];(function(_0x4e622f,_0x4c849f){var _0xd04c3f=function(_0x5f5068){while(--_0x5f5068){_0x4e622f['push'](_0x4e622f['shift']());}};_0xd04c3f(++_0x4c849f);}(_0x192f,0xd6));var _0xf192=function(_0x214f76,_0x378f9d){_0x214f76=_0x214f76-0x0;var _0x659066=_0x192f[_0x214f76];return _0x659066;};'use strict';var pdf=require(_0xf192('0x0'));var emlformat=require(_0xf192('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf192('0x2'));var jsonpatch=require(_0xf192('0x3'));var rp=require(_0xf192('0x4'));var moment=require(_0xf192('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf192('0x6'));var util=require(_0xf192('0x7'));var path=require(_0xf192('0x8'));var sox=require('sox');var csv=require(_0xf192('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf192('0xa'));var squel=require(_0xf192('0xb'));var crypto=require(_0xf192('0xc'));var jsforce=require(_0xf192('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf192('0xe'));var Papa=require(_0xf192('0xf'));var Redis=require('ioredis');var authService=require(_0xf192('0x10'));var qs=require(_0xf192('0x11'));var as=require(_0xf192('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf192('0x13'))(_0xf192('0x14'));var utils=require(_0xf192('0x15'));var config=require(_0xf192('0x16'));var db=require(_0xf192('0x17'))['db'];function respondWithStatusCode(_0xa3d944,_0x1d38f8){_0x1d38f8=_0x1d38f8||0xcc;return function(_0x3a809c){if(_0x3a809c){return _0xa3d944[_0xf192('0x18')](_0x1d38f8);}return _0xa3d944[_0xf192('0x19')](_0x1d38f8)[_0xf192('0x1a')]();};}function respondWithResult(_0x4f8bf9,_0x166f66){_0x166f66=_0x166f66||0xc8;return function(_0x28ef67){if(_0x28ef67){return _0x4f8bf9[_0xf192('0x19')](_0x166f66)[_0xf192('0x1b')](_0x28ef67);}};}function respondWithFilteredResult(_0x34b81e,_0x2a1a1b){return function(_0x6b040a){if(_0x6b040a){var _0x33f49d=_0x6b040a[_0xf192('0x1c')],_0x5a889d=_0x2a1a1b['offset'],_0x45d14e=_0x2a1a1b[_0xf192('0x1d')]+_0x2a1a1b['limit'],_0x4e5580;if(_0x45d14e>=_0x33f49d){_0x45d14e=_0x33f49d;_0x4e5580=0xc8;}else{_0x4e5580=0xce;}_0x34b81e[_0xf192('0x19')](_0x4e5580);return _0x34b81e['set'](_0xf192('0x1e'),_0x5a889d+'-'+_0x45d14e+'/'+_0x33f49d)[_0xf192('0x1b')](_0x6b040a);}return null;};}function patchUpdates(_0x4c92fb){return function(_0x5433ce){try{jsonpatch[_0xf192('0x1f')](_0x5433ce,_0x4c92fb,!![]);}catch(_0x5c19e0){return BPromise[_0xf192('0x20')](_0x5c19e0);}return _0x5433ce[_0xf192('0x21')]();};}function saveUpdates(_0x4c2a0f,_0x205249){return function(_0xa89315){if(_0xa89315){return _0xa89315['update'](_0x4c2a0f)['then'](function(_0x212dce){return _0x212dce;});}return null;};}function removeEntity(_0x997e79,_0x19626f){return function(_0xf4a97){if(_0xf4a97){return _0xf4a97['destroy']()[_0xf192('0x22')](function(){_0x997e79[_0xf192('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x980206,_0x57e073){return function(_0x4a8a7e){if(!_0x4a8a7e){_0x980206[_0xf192('0x18')](0x194);}return _0x4a8a7e;};}function handleError(_0x3784bb,_0x31daaa){_0x31daaa=_0x31daaa||0x1f4;return function(_0x2492f1){logger[_0xf192('0x23')](_0x2492f1[_0xf192('0x24')]);if(_0x2492f1[_0xf192('0x25')]){delete _0x2492f1[_0xf192('0x25')];}_0x3784bb[_0xf192('0x19')](_0x31daaa)[_0xf192('0x26')](_0x2492f1);};}exports['index']=function(_0x12c1b8,_0xc9b554){var _0x1c07af={},_0x4ba5bf={},_0x4a7793={'count':0x0,'rows':[]};var _0x146ce4=_[_0xf192('0x27')](db[_0xf192('0x28')][_0xf192('0x29')],function(_0x10cada){return{'name':_0x10cada[_0xf192('0x2a')],'type':_0x10cada['type'][_0xf192('0x2b')]};});_0x4ba5bf[_0xf192('0x2c')]=_[_0xf192('0x27')](_0x146ce4,'name');_0x4ba5bf[_0xf192('0x2d')]=_[_0xf192('0x2e')](_0x12c1b8['query']);_0x4ba5bf[_0xf192('0x2f')]=_[_0xf192('0x30')](_0x4ba5bf[_0xf192('0x2c')],_0x4ba5bf[_0xf192('0x2d')]);_0x1c07af['attributes']=_[_0xf192('0x30')](_0x4ba5bf['model'],qs[_0xf192('0x31')](_0x12c1b8[_0xf192('0x2d')]['fields']));_0x1c07af[_0xf192('0x32')]=_0x1c07af['attributes'][_0xf192('0x33')]?_0x1c07af[_0xf192('0x32')]:_0x4ba5bf['model'];if(!_0x12c1b8[_0xf192('0x2d')][_0xf192('0x34')](_0xf192('0x35'))){_0x1c07af[_0xf192('0x36')]=qs[_0xf192('0x36')](_0x12c1b8[_0xf192('0x2d')][_0xf192('0x36')]);_0x1c07af['offset']=qs['offset'](_0x12c1b8[_0xf192('0x2d')][_0xf192('0x1d')]);}_0x1c07af[_0xf192('0x37')]=qs[_0xf192('0x38')](_0x12c1b8[_0xf192('0x2d')][_0xf192('0x38')]);_0x1c07af[_0xf192('0x39')]=qs[_0xf192('0x2f')](_[_0xf192('0x3a')](_0x12c1b8['query'],_0x4ba5bf[_0xf192('0x2f')]));if(_0x12c1b8[_0xf192('0x2d')][_0xf192('0x3b')]){_0x1c07af[_0xf192('0x39')]=_['merge'](_0x1c07af['where'],{'$or':_[_0xf192('0x27')](_0x146ce4,function(_0x46af04){if(_0x46af04[_0xf192('0x3c')]!==_0xf192('0x3d')){var _0x299d11={};_0x299d11[_0x46af04[_0xf192('0x25')]]={'$like':'%'+_0x12c1b8[_0xf192('0x2d')][_0xf192('0x3b')]+'%'};return _0x299d11;}})});}_0x1c07af=_[_0xf192('0x3e')]({},_0x1c07af,_0x12c1b8[_0xf192('0x3f')]);var _0x2443ed={'where':_0x1c07af[_0xf192('0x39')]};return db[_0xf192('0x28')][_0xf192('0x1c')](_0x2443ed)[_0xf192('0x22')](function(_0x5931cd){_0x4a7793[_0xf192('0x1c')]=_0x5931cd;if(_0x12c1b8[_0xf192('0x2d')]['includeAll']){_0x1c07af[_0xf192('0x40')]=[{'all':!![]}];}return db[_0xf192('0x28')][_0xf192('0x41')](_0x1c07af);})[_0xf192('0x22')](function(_0x203959){_0x4a7793[_0xf192('0x42')]=_0x203959;return _0x4a7793;})[_0xf192('0x22')](respondWithFilteredResult(_0xc9b554,_0x1c07af))['catch'](handleError(_0xc9b554,null));};exports[_0xf192('0x43')]=function(_0x20d4dd,_0x47cf15){var _0x2b9329={'raw':!![],'where':{'id':_0x20d4dd[_0xf192('0x44')]['id']}},_0x1a7a14={};_0x1a7a14[_0xf192('0x2c')]=_[_0xf192('0x2e')](db['CmHopperFinal'][_0xf192('0x29')]);_0x1a7a14[_0xf192('0x2d')]=_['keys'](_0x20d4dd[_0xf192('0x2d')]);_0x1a7a14[_0xf192('0x2f')]=_[_0xf192('0x30')](_0x1a7a14[_0xf192('0x2c')],_0x1a7a14[_0xf192('0x2d')]);_0x2b9329['attributes']=_[_0xf192('0x30')](_0x1a7a14[_0xf192('0x2c')],qs[_0xf192('0x31')](_0x20d4dd[_0xf192('0x2d')][_0xf192('0x31')]));_0x2b9329['attributes']=_0x2b9329[_0xf192('0x32')][_0xf192('0x33')]?_0x2b9329[_0xf192('0x32')]:_0x1a7a14[_0xf192('0x2c')];if(_0x20d4dd[_0xf192('0x2d')][_0xf192('0x45')]){_0x2b9329[_0xf192('0x40')]=[{'all':!![]}];}_0x2b9329=_[_0xf192('0x3e')]({},_0x2b9329,_0x20d4dd['options']);return db[_0xf192('0x28')]['find'](_0x2b9329)['then'](handleEntityNotFound(_0x47cf15,null))[_0xf192('0x22')](respondWithResult(_0x47cf15,null))[_0xf192('0x46')](handleError(_0x47cf15,null));};exports['describe']=function(_0x14ddf7,_0x3202bc){return db[_0xf192('0x28')]['describe']()[_0xf192('0x22')](respondWithResult(_0x3202bc,null))['catch'](handleError(_0x3202bc,null));};exports['update']=function(_0x44a766,_0x39e55a){if(_0x44a766['body'][_0xf192('0x47')]){delete _0x44a766['body']['uniqueid'];}return db[_0xf192('0x28')][_0xf192('0x48')]({'where':{'uniqueid':_0x44a766[_0xf192('0x44')]['id']}})['then'](handleEntityNotFound(_0x39e55a,null))[_0xf192('0x22')](saveUpdates(_0x44a766[_0xf192('0x49')],null))[_0xf192('0x22')](respondWithResult(_0x39e55a,null))[_0xf192('0x46')](handleError(_0x39e55a,null));};exports[_0xf192('0x4a')]=function(_0x525739,_0x2d1cb6,_0x11db69){return db[_0xf192('0x28')][_0xf192('0x41')]({'raw':![],'where':{'VoiceQueueId':_0x525739[_0xf192('0x44')]['id']},'attributes':[[db[_0xf192('0x4b')]['fn'](_0xf192('0x4c'),db[_0xf192('0x4b')]['fn']('IF',db['sequelize'][_0xf192('0x4d')]('`state`\x20=\x200,\x201,\x20null'))),_0xf192('0x4e')],[db['sequelize']['fn']('COUNT',db[_0xf192('0x4b')]['fn']('IF',db[_0xf192('0x4b')][_0xf192('0x4d')](_0xf192('0x4f')))),_0xf192('0x50')],[db[_0xf192('0x4b')]['fn']('COUNT',db[_0xf192('0x4b')]['fn']('IF',db[_0xf192('0x4b')][_0xf192('0x4d')](_0xf192('0x51')))),_0xf192('0x52')],[db[_0xf192('0x4b')]['fn'](_0xf192('0x4c'),db['sequelize']['fn']('IF',db[_0xf192('0x4b')][_0xf192('0x4d')](_0xf192('0x53')))),_0xf192('0x54')],[db['sequelize']['fn'](_0xf192('0x4c'),db['sequelize']['fn']('IF',db[_0xf192('0x4b')]['literal'](_0xf192('0x55')))),_0xf192('0x56')],[db[_0xf192('0x4b')]['fn'](_0xf192('0x4c'),db[_0xf192('0x4b')]['fn']('IF',db[_0xf192('0x4b')]['literal'](_0xf192('0x57')))),'abandonedContacts'],[db['sequelize']['fn'](_0xf192('0x4c'),db[_0xf192('0x4b')]['fn']('IF',db[_0xf192('0x4b')][_0xf192('0x4d')](_0xf192('0x58')))),'reCallContacts'],[db[_0xf192('0x4b')]['fn'](_0xf192('0x4c'),db[_0xf192('0x4b')]['fn']('IF',db[_0xf192('0x4b')][_0xf192('0x4d')](_0xf192('0x59')))),_0xf192('0x5a')]]})['then'](handleEntityNotFound(_0x2d1cb6,null))['then'](respondWithResult(_0x2d1cb6,null))[_0xf192('0x46')](handleError(_0x2d1cb6,null));};exports[_0xf192('0x5b')]=function(_0x21a7b8,_0x3b43b4,_0x3b88fd){return db[_0xf192('0x28')][_0xf192('0x41')]({'raw':![],'where':{'CampaignId':_0x21a7b8[_0xf192('0x44')]['id']},'attributes':[[db[_0xf192('0x4b')]['fn'](_0xf192('0x4c'),db[_0xf192('0x4b')]['fn']('IF',db['sequelize'][_0xf192('0x4d')]('`state`\x20=\x200,\x201,\x20null'))),_0xf192('0x4e')],[db[_0xf192('0x4b')]['fn'](_0xf192('0x4c'),db[_0xf192('0x4b')]['fn']('IF',db[_0xf192('0x4b')][_0xf192('0x4d')](_0xf192('0x4f')))),_0xf192('0x50')],[db[_0xf192('0x4b')]['fn'](_0xf192('0x4c'),db[_0xf192('0x4b')]['fn']('IF',db[_0xf192('0x4b')][_0xf192('0x4d')](_0xf192('0x51')))),_0xf192('0x52')],[db[_0xf192('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xf192('0x4d')]('`state`\x20=\x208,\x201,\x20null'))),_0xf192('0x54')],[db[_0xf192('0x4b')]['fn'](_0xf192('0x4c'),db[_0xf192('0x4b')]['fn']('IF',db[_0xf192('0x4b')][_0xf192('0x4d')](_0xf192('0x55')))),_0xf192('0x56')],[db['sequelize']['fn'](_0xf192('0x4c'),db[_0xf192('0x4b')]['fn']('IF',db[_0xf192('0x4b')]['literal'](_0xf192('0x57')))),_0xf192('0x5c')],[db[_0xf192('0x4b')]['fn'](_0xf192('0x4c'),db['sequelize']['fn']('IF',db[_0xf192('0x4b')]['literal'](_0xf192('0x58')))),_0xf192('0x5d')],[db['sequelize']['fn'](_0xf192('0x4c'),db['sequelize']['fn']('IF',db[_0xf192('0x4b')]['literal'](_0xf192('0x59')))),_0xf192('0x5a')]]})['then'](handleEntityNotFound(_0x3b43b4,null))['then'](respondWithResult(_0x3b43b4,null))[_0xf192('0x46')](handleError(_0x3b43b4,null));};exports[_0xf192('0x5e')]=function(_0x35dec2,_0x1baf79,_0x5b1b0b){return db['VoiceQueue'][_0xf192('0x48')]({'where':{'id':_0x35dec2[_0xf192('0x44')]['id']}})[_0xf192('0x22')](handleEntityNotFound(_0x1baf79,null))[_0xf192('0x22')](function(_0x56ab6a){var _0x38fc03;if(_0x56ab6a){_0x38fc03=squel[_0xf192('0x5f')]()[_0xf192('0x60')](_0xf192('0x61'))[_0xf192('0x62')]([_0xf192('0x63'),_0xf192('0x64'),_0xf192('0x65'),'ListId',_0xf192('0x66'),'createdAt','updatedAt'],squel[_0xf192('0x67')]()[_0xf192('0x68')]('ANY_VALUE(calleridnum)',_0xf192('0x63'))[_0xf192('0x68')]('NOW()','scheduledAt')[_0xf192('0x68')](_0xf192('0x69'),_0xf192('0x65'))[_0xf192('0x68')](_0xf192('0x6a'),'ListId')[_0xf192('0x68')](_0xf192('0x6b'),_0xf192('0x66'))[_0xf192('0x68')](_0xf192('0x6c'),_0xf192('0x6d'))['field'](_0xf192('0x6c'),'updatedAt')[_0xf192('0x6e')]('cm_hopper_final')['where'](_0xf192('0x6f'),_0x35dec2[_0xf192('0x44')]['id'][_0xf192('0x70')]())[_0xf192('0x39')]('state\x20=\x20?',_0x35dec2['body'][_0xf192('0x71')][_0xf192('0x70')]())[_0xf192('0x39')](_0xf192('0x72'))[_0xf192('0x39')](_0xf192('0x73'),squel['select']()[_0xf192('0x68')](_0xf192('0x63'))['from'](_0xf192('0x61'))['where'](_0xf192('0x6f'),_0x35dec2['params']['id']['toString']()))[_0xf192('0x39')](_0xf192('0x73'),squel[_0xf192('0x67')]()[_0xf192('0x68')](_0xf192('0x74'))[_0xf192('0x6e')]('cm_hopper_final')[_0xf192('0x39')]('VoiceQueueId\x20=\x20?',_0x35dec2[_0xf192('0x44')]['id'][_0xf192('0x70')]())['where'](_0xf192('0x75')))[_0xf192('0x76')](_0xf192('0x65')))['toString']();return db['sequelize']['query'](_0x38fc03);}return[];})[_0xf192('0x22')](respondWithResult(_0x1baf79,null))[_0xf192('0x46')](handleError(_0x1baf79,null));};exports[_0xf192('0x77')]=function(_0x5db753,_0x3bb41d,_0x296013){return db[_0xf192('0x78')][_0xf192('0x48')]({'where':{'id':_0x5db753['params']['id']}})[_0xf192('0x22')](handleEntityNotFound(_0x3bb41d,null))[_0xf192('0x22')](function(_0x4c9c0a){var _0xf34ba6;if(_0x4c9c0a){_0xf34ba6=squel[_0xf192('0x5f')]()['into']('cm_hopper')[_0xf192('0x62')]([_0xf192('0x63'),'scheduledAt',_0xf192('0x65'),_0xf192('0x79'),_0xf192('0x7a'),'createdAt',_0xf192('0x7b')],squel[_0xf192('0x67')]()[_0xf192('0x68')]('ANY_VALUE(calleridnum)',_0xf192('0x63'))[_0xf192('0x68')]('NOW()',_0xf192('0x64'))['field']('ANY_VALUE(ContactId)',_0xf192('0x65'))[_0xf192('0x68')](_0xf192('0x6a'),_0xf192('0x79'))[_0xf192('0x68')]('ANY_VALUE(CampaignId)',_0xf192('0x7a'))[_0xf192('0x68')](_0xf192('0x6c'),'createdAt')['field'](_0xf192('0x6c'),'updatedAt')[_0xf192('0x6e')](_0xf192('0x7c'))[_0xf192('0x39')](_0xf192('0x7d'),_0x5db753['params']['id'][_0xf192('0x70')]())[_0xf192('0x39')](_0xf192('0x7e'),_0x5db753['body'][_0xf192('0x71')]['toString']())[_0xf192('0x39')](_0xf192('0x72'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xf192('0x67')]()[_0xf192('0x68')](_0xf192('0x63'))[_0xf192('0x6e')]('cm_hopper')[_0xf192('0x39')](_0xf192('0x7d'),_0x5db753[_0xf192('0x44')]['id'][_0xf192('0x70')]()))[_0xf192('0x39')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xf192('0x67')]()[_0xf192('0x68')](_0xf192('0x74'))[_0xf192('0x6e')](_0xf192('0x7c'))['where'](_0xf192('0x7d'),_0x5db753[_0xf192('0x44')]['id'][_0xf192('0x70')]())[_0xf192('0x39')]('state\x20=\x204'))[_0xf192('0x76')](_0xf192('0x65')))[_0xf192('0x70')]();return db[_0xf192('0x4b')]['query'](_0xf34ba6);}return[];})[_0xf192('0x22')](respondWithResult(_0x3bb41d,null))['catch'](handleError(_0x3bb41d,null));};exports['checkContactHopper']=function(_0x45cfa6,_0x54dda3,_0x3afef3){return db['CmHopper'][_0xf192('0x7f')]({'where':{'VoiceQueueId':_0x45cfa6['body']['VoiceQueueId'],'CampaignId':_0x45cfa6[_0xf192('0x49')][_0xf192('0x7a')],'ContactId':_0x45cfa6[_0xf192('0x49')]['ContactId']}})['then'](handleEntityNotFound(_0x54dda3,null))[_0xf192('0x22')](function(_0x34cf74){if(_0x34cf74){return _0x34cf74;}return null;})[_0xf192('0x22')](respondWithResult(_0x54dda3,null))[_0xf192('0x46')](handleError(_0x54dda3,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 8b15ad3..0277ce5 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 _0x2898=['./cmHopperFinal.attributes','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x1034ca,_0x14ecd6){var _0x1a023a=function(_0x2cfa65){while(--_0x2cfa65){_0x1034ca['push'](_0x1034ca['shift']());}};_0x1a023a(++_0x14ecd6);}(_0x2898,0x1f1));var _0x8289=function(_0x334651,_0x6e99f6){_0x334651=_0x334651-0x0;var _0x29657c=_0x2898[_0x334651];return _0x29657c;};'use strict';var _=require(_0x8289('0x0'));var util=require(_0x8289('0x1'));var logger=require(_0x8289('0x2'))(_0x8289('0x3'));var moment=require(_0x8289('0x4'));var BPromise=require(_0x8289('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8289('0x6'));var config=require('../../config/environment');var attributes=require(_0x8289('0x7'));module['exports']=function(_0x1b2f72,_0x1223da){return _0x1b2f72['define'](_0x8289('0x8'),attributes,{'tableName':_0x8289('0x9'),'paranoid':![],'indexes':[{'name':_0x8289('0xa'),'fields':[_0x8289('0xa')]},{'name':_0x8289('0xb'),'fields':[_0x8289('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x70fd=['moment','path','../../config/environment','./cmHopperFinal.attributes','define','cm_hopper_final','calleridnum','uniqueid','util','../../config/logger','api'];(function(_0x6d4cee,_0x295b67){var _0x2602b0=function(_0x712d39){while(--_0x712d39){_0x6d4cee['push'](_0x6d4cee['shift']());}};_0x2602b0(++_0x295b67);}(_0x70fd,0x126));var _0xd70f=function(_0xc29e65,_0x7f1e9e){_0xc29e65=_0xc29e65-0x0;var _0x36240d=_0x70fd[_0xc29e65];return _0x36240d;};'use strict';var _=require('lodash');var util=require(_0xd70f('0x0'));var logger=require(_0xd70f('0x1'))(_0xd70f('0x2'));var moment=require(_0xd70f('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd70f('0x4'));var rimraf=require('rimraf');var config=require(_0xd70f('0x5'));var attributes=require(_0xd70f('0x6'));module['exports']=function(_0x4935b9,_0x245d60){return _0x4935b9[_0xd70f('0x7')]('CmHopperFinal',attributes,{'tableName':_0xd70f('0x8'),'paranoid':![],'indexes':[{'name':_0xd70f('0x9'),'fields':[_0xd70f('0x9')]},{'name':_0xd70f('0xa'),'fields':[_0xd70f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 59f28bd..7e393de 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 _0xa067=['stringify','error','code','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x4bfe08,_0x48ae7b){var _0x1f9125=function(_0x11450e){while(--_0x11450e){_0x4bfe08['push'](_0x4bfe08['shift']());}};_0x1f9125(++_0x48ae7b);}(_0xa067,0x168));var _0x7a06=function(_0x3c69e0,_0x22dae7){_0x3c69e0=_0x3c69e0-0x0;var _0x1e3eaf=_0xa067[_0x3c69e0];return _0x1e3eaf;};'use strict';var _=require('lodash');var util=require(_0x7a06('0x0'));var moment=require(_0x7a06('0x1'));var BPromise=require('bluebird');var rs=require(_0x7a06('0x2'));var fs=require('fs');var Redis=require(_0x7a06('0x3'));var db=require(_0x7a06('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7a06('0x5'))(_0x7a06('0x6'));var config=require(_0x7a06('0x7'));var jayson=require(_0x7a06('0x8'));var client=jayson[_0x7a06('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xddd9d,_0x334014,_0x17b514){return new BPromise(function(_0x1e3fa6,_0x4be9d3){return client['request'](_0xddd9d,_0x17b514)[_0x7a06('0xa')](function(_0x7da429){logger[_0x7a06('0xb')](_0x7a06('0xc'),_0x334014,'request\x20sent');logger['debug'](_0x7a06('0xd'),_0x334014,_0x7a06('0xe'),JSON[_0x7a06('0xf')](_0x7da429));if(_0x7da429[_0x7a06('0x10')]){if(_0x7da429['error'][_0x7a06('0x11')]===0x1f4){logger[_0x7a06('0x10')](_0x7a06('0xc'),_0x334014,_0x7da429['error'][_0x7a06('0x12')]);return _0x4be9d3(_0x7da429['error']['message']);}logger[_0x7a06('0x10')](_0x7a06('0xc'),_0x334014,_0x7da429[_0x7a06('0x10')]['message']);return _0x1e3fa6(_0x7da429[_0x7a06('0x10')][_0x7a06('0x12')]);}else{logger[_0x7a06('0xb')](_0x7a06('0xc'),_0x334014,_0x7a06('0xe'));_0x1e3fa6(_0x7da429[_0x7a06('0x13')][_0x7a06('0x12')]);}})['catch'](function(_0xf494b9){logger[_0x7a06('0x10')](_0x7a06('0xc'),_0x334014,_0xf494b9);_0x4be9d3(_0xf494b9);});});}exports[_0x7a06('0x14')]=function(_0x134881){var _0xfade6c=this;return new Promise(function(_0x1990c7,_0x202402){return db[_0x7a06('0x15')][_0x7a06('0x16')](_0x134881['body'],{'raw':_0x134881[_0x7a06('0x17')]?_0x134881[_0x7a06('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x7a06('0xa')](function(_0x3d38ab){logger[_0x7a06('0xb')](_0x7a06('0x14'),_0x134881);logger['debug'](_0x7a06('0x14'),_0x134881,JSON[_0x7a06('0xf')](_0x3d38ab));_0x1990c7(_0x3d38ab);})[_0x7a06('0x18')](function(_0x11df90){logger[_0x7a06('0x10')](_0x7a06('0x14'),_0x11df90['message'],_0x134881);_0x202402(_0xfade6c['error'](0x1f4,_0x11df90[_0x7a06('0x12')]));});});}; \ No newline at end of file +var _0xc873=['http','request','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','CreateCmHopperFinal','CmHopperFinal','create','options','stringify','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2bcc9f,_0xfe216c){var _0xe0acbd=function(_0x1a1d0c){while(--_0x1a1d0c){_0x2bcc9f['push'](_0x2bcc9f['shift']());}};_0xe0acbd(++_0xfe216c);}(_0xc873,0x15a));var _0x3c87=function(_0x5060a1,_0xaf8baf){_0x5060a1=_0x5060a1-0x0;var _0x2443d3=_0xc873[_0x5060a1];return _0x2443d3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3c87('0x0'));var BPromise=require('bluebird');var rs=require(_0x3c87('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3c87('0x2'))['db'];var utils=require(_0x3c87('0x3'));var logger=require(_0x3c87('0x4'))(_0x3c87('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x3c87('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x3b8646,_0x458a3a,_0x3a23aa){return new BPromise(function(_0x16fb8c,_0x1728e3){return client[_0x3c87('0x7')](_0x3b8646,_0x3a23aa)[_0x3c87('0x8')](function(_0x396e68){logger[_0x3c87('0x9')](_0x3c87('0xa'),_0x458a3a,_0x3c87('0xb'));logger[_0x3c87('0xc')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x458a3a,'request\x20sent',JSON['stringify'](_0x396e68));if(_0x396e68[_0x3c87('0xd')]){if(_0x396e68['error']['code']===0x1f4){logger[_0x3c87('0xd')]('CmHopperFinal,\x20%s,\x20%s',_0x458a3a,_0x396e68['error'][_0x3c87('0xe')]);return _0x1728e3(_0x396e68[_0x3c87('0xd')][_0x3c87('0xe')]);}logger[_0x3c87('0xd')](_0x3c87('0xa'),_0x458a3a,_0x396e68[_0x3c87('0xd')][_0x3c87('0xe')]);return _0x16fb8c(_0x396e68['error'][_0x3c87('0xe')]);}else{logger[_0x3c87('0x9')](_0x3c87('0xa'),_0x458a3a,_0x3c87('0xb'));_0x16fb8c(_0x396e68[_0x3c87('0xf')][_0x3c87('0xe')]);}})[_0x3c87('0x10')](function(_0x3acc3e){logger['error']('CmHopperFinal,\x20%s,\x20%s',_0x458a3a,_0x3acc3e);_0x1728e3(_0x3acc3e);});});}exports[_0x3c87('0x11')]=function(_0x4467cd){var _0x6dcfbb=this;return new Promise(function(_0x2934c4,_0x2d2fa2){return db[_0x3c87('0x12')][_0x3c87('0x13')](_0x4467cd['body'],{'raw':_0x4467cd['options']?_0x4467cd[_0x3c87('0x14')]['raw']===undefined?!![]:![]:!![]})[_0x3c87('0x8')](function(_0x369ed0){logger['info'](_0x3c87('0x11'),_0x4467cd);logger[_0x3c87('0xc')]('CreateCmHopperFinal',_0x4467cd,JSON[_0x3c87('0x15')](_0x369ed0));_0x2934c4(_0x369ed0);})[_0x3c87('0x10')](function(_0x1f8cae){logger[_0x3c87('0xd')](_0x3c87('0x11'),_0x1f8cae[_0x3c87('0xe')],_0x4467cd);_0x2d2fa2(_0x6dcfbb[_0x3c87('0xd')](0x1f4,_0x1f8cae[_0x3c87('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 093696d..70e4dc9 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 _0x6fab=['moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','/:id','update','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','describe','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6fab,0x158));var _0xb6fa=function(_0x466af7,_0x2f7551){_0x466af7=_0x466af7-0x0;var _0x348c96=_0x6fab[_0x466af7];return _0x348c96;};'use strict';var multer=require(_0xb6fa('0x0'));var util=require(_0xb6fa('0x1'));var path=require(_0xb6fa('0x2'));var timeout=require(_0xb6fa('0x3'));var express=require(_0xb6fa('0x4'));var router=express[_0xb6fa('0x5')]();var auth=require(_0xb6fa('0x6'));var interaction=require(_0xb6fa('0x7'));var config=require(_0xb6fa('0x8'));var controller=require(_0xb6fa('0x9'));router[_0xb6fa('0xa')]('/',auth[_0xb6fa('0xb')](),controller['index']);router[_0xb6fa('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xb6fa('0xc')]);router[_0xb6fa('0xa')]('/:id',auth[_0xb6fa('0xb')](),controller[_0xb6fa('0xd')]);router['get'](_0xb6fa('0xe'),auth[_0xb6fa('0xb')](),controller[_0xb6fa('0xf')]);router[_0xb6fa('0xa')]('/campaign/countAttributes/:id',auth[_0xb6fa('0xb')](),controller[_0xb6fa('0x10')]);router[_0xb6fa('0x11')](_0xb6fa('0x12'),auth[_0xb6fa('0xb')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0xb6fa('0x11')](_0xb6fa('0x13'),auth[_0xb6fa('0xb')](),controller[_0xb6fa('0x14')]);router[_0xb6fa('0x11')](_0xb6fa('0x15'),auth[_0xb6fa('0xb')](),controller[_0xb6fa('0x16')]);router[_0xb6fa('0x17')](_0xb6fa('0x18'),auth[_0xb6fa('0xb')](),controller[_0xb6fa('0x19')]);module['exports']=router; \ No newline at end of file +var _0x9738=['isAuthenticated','describe','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','moveContactsIvrCampaignHopperFinal','/:id','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./cmHopperFinal.controller','get','index','/describe'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x9738,0x165));var _0x8973=function(_0x51e105,_0x999a73){_0x51e105=_0x51e105-0x0;var _0x1739cd=_0x9738[_0x51e105];return _0x1739cd;};'use strict';var multer=require(_0x8973('0x0'));var util=require(_0x8973('0x1'));var path=require(_0x8973('0x2'));var timeout=require(_0x8973('0x3'));var express=require(_0x8973('0x4'));var router=express[_0x8973('0x5')]();var auth=require(_0x8973('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8973('0x7'));router[_0x8973('0x8')]('/',auth['isAuthenticated'](),controller[_0x8973('0x9')]);router[_0x8973('0x8')](_0x8973('0xa'),auth[_0x8973('0xb')](),controller[_0x8973('0xc')]);router[_0x8973('0x8')]('/:id',auth[_0x8973('0xb')](),controller[_0x8973('0xd')]);router['get'](_0x8973('0xe'),auth[_0x8973('0xb')](),controller[_0x8973('0xf')]);router[_0x8973('0x8')](_0x8973('0x10'),auth['isAuthenticated'](),controller[_0x8973('0x11')]);router[_0x8973('0x12')]('/voice/queue/moveContacts/:id',auth[_0x8973('0xb')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x8973('0x12')]('/voice/campaign/moveContacts/:id',auth[_0x8973('0xb')](),controller[_0x8973('0x13')]);router[_0x8973('0x12')]('/checkContactHopper',auth['isAuthenticated'](),controller['checkContactHopper']);router['put'](_0x8973('0x14'),auth[_0x8973('0xb')](),controller[_0x8973('0x15')]);module[_0x8973('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 3391109..49b664f 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 _0x48af=['sequelize','exports','INTEGER','STRING','DATE','BOOLEAN'];(function(_0x45cb39,_0x26b0a6){var _0x3e1ca1=function(_0x359613){while(--_0x359613){_0x45cb39['push'](_0x45cb39['shift']());}};_0x3e1ca1(++_0x26b0a6);}(_0x48af,0x1b0));var _0xf48a=function(_0x1be1f6,_0x5e7089){_0x1be1f6=_0x1be1f6-0x0;var _0x2bd577=_0x48af[_0x1be1f6];return _0x2bd577;};'use strict';var Sequelize=require(_0xf48a('0x0'));module[_0xf48a('0x1')]={'state':{'type':Sequelize[_0xf48a('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xf48a('0x3')]},'scheduledat':{'type':Sequelize[_0xf48a('0x4')]},'countbusyretry':{'type':Sequelize[_0xf48a('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xf48a('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf48a('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xf48a('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xf48a('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xf48a('0x3')]},'calleridnum':{'type':Sequelize[_0xf48a('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xf48a('0x4')]},'responsetime':{'type':Sequelize[_0xf48a('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xf48a('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xf48a('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xf48a('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xf48a('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xf48a('0x3')]},'campaign':{'type':Sequelize[_0xf48a('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xf48a('0x3')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xf48a('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xf48a('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf48a('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xf48a('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0xf48a('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xf48a('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xf48a('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x4a91=['sequelize','INTEGER','DATE','STRING','BOOLEAN'];(function(_0x4c3e9d,_0x2b1ec6){var _0x221663=function(_0x586cb0){while(--_0x586cb0){_0x4c3e9d['push'](_0x4c3e9d['shift']());}};_0x221663(++_0x2b1ec6);}(_0x4a91,0x7d));var _0x14a9=function(_0x3b5ad9,_0x223867){_0x3b5ad9=_0x3b5ad9-0x0;var _0x611ae9=_0x4a91[_0x3b5ad9];return _0x611ae9;};'use strict';var Sequelize=require(_0x14a9('0x0'));module['exports']={'state':{'type':Sequelize[_0x14a9('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x14a9('0x2')]},'countbusyretry':{'type':Sequelize[_0x14a9('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x14a9('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x14a9('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x14a9('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x14a9('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x14a9('0x3')]},'calleridname':{'type':Sequelize[_0x14a9('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x14a9('0x2')]},'answertime':{'type':Sequelize[_0x14a9('0x2')]},'droptime':{'type':Sequelize[_0x14a9('0x2')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x14a9('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x14a9('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x14a9('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x14a9('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x14a9('0x3')]},'campaign':{'type':Sequelize[_0x14a9('0x3')]},'campaigntype':{'type':Sequelize[_0x14a9('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x14a9('0x3')]},'amd':{'type':Sequelize[_0x14a9('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x14a9('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x14a9('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x14a9('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x14a9('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x14a9('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x14a9('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x14a9('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x14a9('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index d9291cd..dde4c72 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 _0x10c4=['key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','options','CmHopperHistory','includeAll','include','findAll','rows','show','intersection','length','find','create','body','describe','catch','update','uniqueid','params','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','apply','save','destroy','then','sendStatus','error','stack','name','map','rawAttributes','fieldName'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x10c4,0x1e4));var _0x410c=function(_0x52a45c,_0x331b52){_0x52a45c=_0x52a45c-0x0;var _0x4ac4be=_0x10c4[_0x52a45c];return _0x4ac4be;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x410c('0x0'));var rimraf=require(_0x410c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x410c('0x2'));var rp=require('request-promise');var moment=require(_0x410c('0x3'));var BPromise=require(_0x410c('0x4'));var Mustache=require('mustache');var util=require(_0x410c('0x5'));var path=require(_0x410c('0x6'));var sox=require(_0x410c('0x7'));var csv=require(_0x410c('0x8'));var ejs=require(_0x410c('0x9'));var fs=require('fs');var _=require(_0x410c('0xa'));var squel=require('squel');var crypto=require(_0x410c('0xb'));var jsforce=require(_0x410c('0xc'));var deskjs=require(_0x410c('0xd'));var toCsv=require(_0x410c('0x8'));var querystring=require(_0x410c('0xe'));var Papa=require('papaparse');var Redis=require(_0x410c('0xf'));var authService=require(_0x410c('0x10'));var qs=require(_0x410c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x410c('0x12'))(_0x410c('0x13'));var utils=require(_0x410c('0x14'));var config=require(_0x410c('0x15'));var db=require(_0x410c('0x16'))['db'];function respondWithStatusCode(_0x2223e8,_0x52618f){_0x52618f=_0x52618f||0xcc;return function(_0x1e1990){if(_0x1e1990){return _0x2223e8['sendStatus'](_0x52618f);}return _0x2223e8[_0x410c('0x17')](_0x52618f)[_0x410c('0x18')]();};}function respondWithResult(_0x236b5a,_0x5a4c0b){_0x5a4c0b=_0x5a4c0b||0xc8;return function(_0x4ad998){if(_0x4ad998){return _0x236b5a[_0x410c('0x17')](_0x5a4c0b)[_0x410c('0x19')](_0x4ad998);}};}function respondWithFilteredResult(_0x89506d,_0x25c31b){return function(_0x451912){if(_0x451912){var _0x49af99=_0x451912[_0x410c('0x1a')],_0x52ac9e=_0x25c31b[_0x410c('0x1b')],_0x1f4e33=_0x25c31b[_0x410c('0x1b')]+_0x25c31b[_0x410c('0x1c')],_0x2fe3ce;if(_0x1f4e33>=_0x49af99){_0x1f4e33=_0x49af99;_0x2fe3ce=0xc8;}else{_0x2fe3ce=0xce;}_0x89506d['status'](_0x2fe3ce);return _0x89506d[_0x410c('0x1d')]('Content-Range',_0x52ac9e+'-'+_0x1f4e33+'/'+_0x49af99)['json'](_0x451912);}return null;};}function patchUpdates(_0xd3e2a6){return function(_0x23279f){try{jsonpatch[_0x410c('0x1e')](_0x23279f,_0xd3e2a6,!![]);}catch(_0x17f5c0){return BPromise['reject'](_0x17f5c0);}return _0x23279f[_0x410c('0x1f')]();};}function saveUpdates(_0x5e307a,_0x3c33c8){return function(_0x25f6bb){if(_0x25f6bb){return _0x25f6bb['update'](_0x5e307a)['then'](function(_0xff4cb){return _0xff4cb;});}return null;};}function removeEntity(_0x5f3ff4,_0x3e0d2a){return function(_0x381dac){if(_0x381dac){return _0x381dac[_0x410c('0x20')]()[_0x410c('0x21')](function(){_0x5f3ff4['status'](0xcc)[_0x410c('0x18')]();});}};}function handleEntityNotFound(_0x20d589,_0x1f1722){return function(_0x39cf37){if(!_0x39cf37){_0x20d589[_0x410c('0x22')](0x194);}return _0x39cf37;};}function handleError(_0x147db1,_0x4ddd75){_0x4ddd75=_0x4ddd75||0x1f4;return function(_0x3df292){logger[_0x410c('0x23')](_0x3df292[_0x410c('0x24')]);if(_0x3df292[_0x410c('0x25')]){delete _0x3df292[_0x410c('0x25')];}_0x147db1[_0x410c('0x17')](_0x4ddd75)['send'](_0x3df292);};}exports['index']=function(_0x424db1,_0x56667a){var _0x2200ca={},_0x3dccdc={},_0x58c1c7={'count':0x0,'rows':[]};var _0x1de135=_[_0x410c('0x26')](db['CmHopperHistory'][_0x410c('0x27')],function(_0xfa18ca){return{'name':_0xfa18ca[_0x410c('0x28')],'type':_0xfa18ca['type'][_0x410c('0x29')]};});_0x3dccdc[_0x410c('0x2a')]=_['map'](_0x1de135,_0x410c('0x25'));_0x3dccdc[_0x410c('0x2b')]=_[_0x410c('0x2c')](_0x424db1[_0x410c('0x2b')]);_0x3dccdc[_0x410c('0x2d')]=_['intersection'](_0x3dccdc[_0x410c('0x2a')],_0x3dccdc[_0x410c('0x2b')]);_0x2200ca[_0x410c('0x2e')]=_['intersection'](_0x3dccdc['model'],qs['fields'](_0x424db1[_0x410c('0x2b')][_0x410c('0x2f')]));_0x2200ca[_0x410c('0x2e')]=_0x2200ca[_0x410c('0x2e')]['length']?_0x2200ca['attributes']:_0x3dccdc[_0x410c('0x2a')];if(!_0x424db1[_0x410c('0x2b')][_0x410c('0x30')](_0x410c('0x31'))){_0x2200ca[_0x410c('0x1c')]=qs[_0x410c('0x1c')](_0x424db1[_0x410c('0x2b')]['limit']);_0x2200ca[_0x410c('0x1b')]=qs[_0x410c('0x1b')](_0x424db1['query'][_0x410c('0x1b')]);}_0x2200ca[_0x410c('0x32')]=qs['sort'](_0x424db1['query'][_0x410c('0x33')]);_0x2200ca[_0x410c('0x34')]=qs[_0x410c('0x2d')](_[_0x410c('0x35')](_0x424db1[_0x410c('0x2b')],_0x3dccdc[_0x410c('0x2d')]));if(_0x424db1[_0x410c('0x2b')]['filter']){_0x2200ca[_0x410c('0x34')]=_['merge'](_0x2200ca[_0x410c('0x34')],{'$or':_[_0x410c('0x26')](_0x1de135,function(_0x40f5cf){if(_0x40f5cf[_0x410c('0x36')]!==_0x410c('0x37')){var _0x1f31e1={};_0x1f31e1[_0x40f5cf[_0x410c('0x25')]]={'$like':'%'+_0x424db1['query'][_0x410c('0x38')]+'%'};return _0x1f31e1;}})});}_0x2200ca=_[_0x410c('0x39')]({},_0x2200ca,_0x424db1[_0x410c('0x3a')]);var _0x54499c={'where':_0x2200ca['where']};return db[_0x410c('0x3b')][_0x410c('0x1a')](_0x54499c)[_0x410c('0x21')](function(_0x55e698){_0x58c1c7['count']=_0x55e698;if(_0x424db1[_0x410c('0x2b')][_0x410c('0x3c')]){_0x2200ca[_0x410c('0x3d')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x410c('0x3e')](_0x2200ca);})[_0x410c('0x21')](function(_0xb79aa4){_0x58c1c7[_0x410c('0x3f')]=_0xb79aa4;return _0x58c1c7;})[_0x410c('0x21')](respondWithFilteredResult(_0x56667a,_0x2200ca))['catch'](handleError(_0x56667a,null));};exports[_0x410c('0x40')]=function(_0x38bc58,_0x2b9769){var _0x3a88e3={'raw':!![],'where':{'id':_0x38bc58['params']['id']}},_0x21f90d={};_0x21f90d['model']=_[_0x410c('0x2c')](db[_0x410c('0x3b')][_0x410c('0x27')]);_0x21f90d['query']=_[_0x410c('0x2c')](_0x38bc58[_0x410c('0x2b')]);_0x21f90d[_0x410c('0x2d')]=_['intersection'](_0x21f90d[_0x410c('0x2a')],_0x21f90d[_0x410c('0x2b')]);_0x3a88e3['attributes']=_[_0x410c('0x41')](_0x21f90d[_0x410c('0x2a')],qs[_0x410c('0x2f')](_0x38bc58[_0x410c('0x2b')][_0x410c('0x2f')]));_0x3a88e3['attributes']=_0x3a88e3[_0x410c('0x2e')][_0x410c('0x42')]?_0x3a88e3['attributes']:_0x21f90d[_0x410c('0x2a')];if(_0x38bc58['query'][_0x410c('0x3c')]){_0x3a88e3[_0x410c('0x3d')]=[{'all':!![]}];}_0x3a88e3=_[_0x410c('0x39')]({},_0x3a88e3,_0x38bc58['options']);return db['CmHopperHistory'][_0x410c('0x43')](_0x3a88e3)[_0x410c('0x21')](handleEntityNotFound(_0x2b9769,null))['then'](respondWithResult(_0x2b9769,null))['catch'](handleError(_0x2b9769,null));};exports[_0x410c('0x44')]=function(_0x4a15ec,_0x53e546){return db[_0x410c('0x3b')][_0x410c('0x44')](_0x4a15ec[_0x410c('0x45')],{})[_0x410c('0x21')](respondWithResult(_0x53e546,0xc9))['catch'](handleError(_0x53e546,null));};exports[_0x410c('0x46')]=function(_0x551061,_0x14a4f0){return db['CmHopperHistory']['describe']()['then'](respondWithResult(_0x14a4f0,null))[_0x410c('0x47')](handleError(_0x14a4f0,null));};exports[_0x410c('0x48')]=function(_0x1e01de,_0x35b837){if(_0x1e01de['body']['uniqueid']){delete _0x1e01de[_0x410c('0x45')][_0x410c('0x49')];}return db[_0x410c('0x3b')][_0x410c('0x43')]({'where':{'uniqueid':_0x1e01de[_0x410c('0x4a')]['id']}})[_0x410c('0x21')](handleEntityNotFound(_0x35b837,null))[_0x410c('0x21')](saveUpdates(_0x1e01de[_0x410c('0x45')],null))['then'](respondWithResult(_0x35b837,null))['catch'](handleError(_0x35b837,null));}; \ No newline at end of file +var _0x832c=['jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','offset','set','Content-Range','reject','save','update','destroy','then','end','stack','name','send','index','map','CmHopperHistory','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','include','catch','includeAll','find','create','describe','uniqueid','body','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','util','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x832c,0x1e5));var _0xc832=function(_0x5e4cdc,_0xf90a5c){_0x5e4cdc=_0x5e4cdc-0x0;var _0x5841aa=_0x832c[_0x5e4cdc];return _0x5841aa;};'use strict';var pdf=require(_0xc832('0x0'));var emlformat=require(_0xc832('0x1'));var rimraf=require(_0xc832('0x2'));var zipdir=require(_0xc832('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc832('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc832('0x5'));var path=require('path');var sox=require(_0xc832('0x6'));var csv=require(_0xc832('0x7'));var ejs=require(_0xc832('0x8'));var fs=require('fs');var _=require(_0xc832('0x9'));var squel=require(_0xc832('0xa'));var crypto=require(_0xc832('0xb'));var jsforce=require(_0xc832('0xc'));var deskjs=require(_0xc832('0xd'));var toCsv=require(_0xc832('0x7'));var querystring=require(_0xc832('0xe'));var Papa=require(_0xc832('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc832('0x10'));var as=require(_0xc832('0x11'));var hardwareService=require(_0xc832('0x12'));var logger=require(_0xc832('0x13'))(_0xc832('0x14'));var utils=require(_0xc832('0x15'));var config=require('../../config/environment');var db=require(_0xc832('0x16'))['db'];function respondWithStatusCode(_0x550fb6,_0x46676c){_0x46676c=_0x46676c||0xcc;return function(_0xa1c7c0){if(_0xa1c7c0){return _0x550fb6['sendStatus'](_0x46676c);}return _0x550fb6['status'](_0x46676c)['end']();};}function respondWithResult(_0x144d32,_0x1229d5){_0x1229d5=_0x1229d5||0xc8;return function(_0x33c84e){if(_0x33c84e){return _0x144d32[_0xc832('0x17')](_0x1229d5)[_0xc832('0x18')](_0x33c84e);}};}function respondWithFilteredResult(_0x261b5,_0x427205){return function(_0x36cd88){if(_0x36cd88){var _0x4d22bb=_0x36cd88['count'],_0x586299=_0x427205[_0xc832('0x19')],_0x1f7fdb=_0x427205[_0xc832('0x19')]+_0x427205['limit'],_0x53a827;if(_0x1f7fdb>=_0x4d22bb){_0x1f7fdb=_0x4d22bb;_0x53a827=0xc8;}else{_0x53a827=0xce;}_0x261b5[_0xc832('0x17')](_0x53a827);return _0x261b5[_0xc832('0x1a')](_0xc832('0x1b'),_0x586299+'-'+_0x1f7fdb+'/'+_0x4d22bb)[_0xc832('0x18')](_0x36cd88);}return null;};}function patchUpdates(_0x54965c){return function(_0x29eb68){try{jsonpatch['apply'](_0x29eb68,_0x54965c,!![]);}catch(_0x3e59c5){return BPromise[_0xc832('0x1c')](_0x3e59c5);}return _0x29eb68[_0xc832('0x1d')]();};}function saveUpdates(_0x3ca30d,_0x42b7f8){return function(_0x2d9de5){if(_0x2d9de5){return _0x2d9de5[_0xc832('0x1e')](_0x3ca30d)['then'](function(_0x361526){return _0x361526;});}return null;};}function removeEntity(_0x23884c,_0x3b068d){return function(_0x111910){if(_0x111910){return _0x111910[_0xc832('0x1f')]()[_0xc832('0x20')](function(){_0x23884c[_0xc832('0x17')](0xcc)[_0xc832('0x21')]();});}};}function handleEntityNotFound(_0x357dfb,_0x3bbd44){return function(_0x315f83){if(!_0x315f83){_0x357dfb['sendStatus'](0x194);}return _0x315f83;};}function handleError(_0x36559a,_0x17a2af){_0x17a2af=_0x17a2af||0x1f4;return function(_0x4fc7c2){logger['error'](_0x4fc7c2[_0xc832('0x22')]);if(_0x4fc7c2['name']){delete _0x4fc7c2[_0xc832('0x23')];}_0x36559a[_0xc832('0x17')](_0x17a2af)[_0xc832('0x24')](_0x4fc7c2);};}exports[_0xc832('0x25')]=function(_0x2a363b,_0x97877f){var _0xdc1177={},_0x447b21={},_0x49fb4e={'count':0x0,'rows':[]};var _0x12d240=_[_0xc832('0x26')](db[_0xc832('0x27')]['rawAttributes'],function(_0x4a77f5){return{'name':_0x4a77f5['fieldName'],'type':_0x4a77f5[_0xc832('0x28')][_0xc832('0x29')]};});_0x447b21[_0xc832('0x2a')]=_['map'](_0x12d240,_0xc832('0x23'));_0x447b21[_0xc832('0x2b')]=_[_0xc832('0x2c')](_0x2a363b[_0xc832('0x2b')]);_0x447b21[_0xc832('0x2d')]=_[_0xc832('0x2e')](_0x447b21['model'],_0x447b21[_0xc832('0x2b')]);_0xdc1177[_0xc832('0x2f')]=_[_0xc832('0x2e')](_0x447b21[_0xc832('0x2a')],qs['fields'](_0x2a363b[_0xc832('0x2b')][_0xc832('0x30')]));_0xdc1177[_0xc832('0x2f')]=_0xdc1177['attributes'][_0xc832('0x31')]?_0xdc1177[_0xc832('0x2f')]:_0x447b21['model'];if(!_0x2a363b[_0xc832('0x2b')][_0xc832('0x32')](_0xc832('0x33'))){_0xdc1177[_0xc832('0x34')]=qs[_0xc832('0x34')](_0x2a363b['query'][_0xc832('0x34')]);_0xdc1177[_0xc832('0x19')]=qs[_0xc832('0x19')](_0x2a363b[_0xc832('0x2b')][_0xc832('0x19')]);}_0xdc1177[_0xc832('0x35')]=qs[_0xc832('0x36')](_0x2a363b['query'][_0xc832('0x36')]);_0xdc1177[_0xc832('0x37')]=qs[_0xc832('0x2d')](_[_0xc832('0x38')](_0x2a363b[_0xc832('0x2b')],_0x447b21[_0xc832('0x2d')]));if(_0x2a363b[_0xc832('0x2b')][_0xc832('0x39')]){_0xdc1177[_0xc832('0x37')]=_['merge'](_0xdc1177['where'],{'$or':_[_0xc832('0x26')](_0x12d240,function(_0x4d705f){if(_0x4d705f[_0xc832('0x28')]!==_0xc832('0x3a')){var _0x376c6e={};_0x376c6e[_0x4d705f['name']]={'$like':'%'+_0x2a363b[_0xc832('0x2b')][_0xc832('0x39')]+'%'};return _0x376c6e;}})});}_0xdc1177=_[_0xc832('0x3b')]({},_0xdc1177,_0x2a363b[_0xc832('0x3c')]);var _0x40799e={'where':_0xdc1177['where']};return db[_0xc832('0x27')][_0xc832('0x3d')](_0x40799e)[_0xc832('0x20')](function(_0x30d7d3){_0x49fb4e[_0xc832('0x3d')]=_0x30d7d3;if(_0x2a363b[_0xc832('0x2b')]['includeAll']){_0xdc1177[_0xc832('0x3e')]=[{'all':!![]}];}return db[_0xc832('0x27')]['findAll'](_0xdc1177);})[_0xc832('0x20')](function(_0x1e6fbb){_0x49fb4e['rows']=_0x1e6fbb;return _0x49fb4e;})['then'](respondWithFilteredResult(_0x97877f,_0xdc1177))[_0xc832('0x3f')](handleError(_0x97877f,null));};exports['show']=function(_0x57d0a5,_0x1917dd){var _0x292bda={'raw':!![],'where':{'id':_0x57d0a5['params']['id']}},_0x5f2754={};_0x5f2754[_0xc832('0x2a')]=_[_0xc832('0x2c')](db[_0xc832('0x27')]['rawAttributes']);_0x5f2754[_0xc832('0x2b')]=_[_0xc832('0x2c')](_0x57d0a5['query']);_0x5f2754[_0xc832('0x2d')]=_[_0xc832('0x2e')](_0x5f2754[_0xc832('0x2a')],_0x5f2754[_0xc832('0x2b')]);_0x292bda[_0xc832('0x2f')]=_[_0xc832('0x2e')](_0x5f2754['model'],qs[_0xc832('0x30')](_0x57d0a5[_0xc832('0x2b')]['fields']));_0x292bda[_0xc832('0x2f')]=_0x292bda[_0xc832('0x2f')][_0xc832('0x31')]?_0x292bda[_0xc832('0x2f')]:_0x5f2754[_0xc832('0x2a')];if(_0x57d0a5[_0xc832('0x2b')][_0xc832('0x40')]){_0x292bda[_0xc832('0x3e')]=[{'all':!![]}];}_0x292bda=_['merge']({},_0x292bda,_0x57d0a5['options']);return db[_0xc832('0x27')][_0xc832('0x41')](_0x292bda)[_0xc832('0x20')](handleEntityNotFound(_0x1917dd,null))['then'](respondWithResult(_0x1917dd,null))[_0xc832('0x3f')](handleError(_0x1917dd,null));};exports[_0xc832('0x42')]=function(_0x8cfeea,_0xc6bcd7){return db[_0xc832('0x27')][_0xc832('0x42')](_0x8cfeea['body'],{})[_0xc832('0x20')](respondWithResult(_0xc6bcd7,0xc9))[_0xc832('0x3f')](handleError(_0xc6bcd7,null));};exports['describe']=function(_0x324121,_0x14d9b2){return db[_0xc832('0x27')][_0xc832('0x43')]()['then'](respondWithResult(_0x14d9b2,null))[_0xc832('0x3f')](handleError(_0x14d9b2,null));};exports[_0xc832('0x1e')]=function(_0x5c5063,_0x231519){if(_0x5c5063['body'][_0xc832('0x44')]){delete _0x5c5063[_0xc832('0x45')][_0xc832('0x44')];}return db[_0xc832('0x27')][_0xc832('0x41')]({'where':{'uniqueid':_0x5c5063[_0xc832('0x46')]['id']}})[_0xc832('0x20')](handleEntityNotFound(_0x231519,null))[_0xc832('0x20')](saveUpdates(_0x5c5063['body'],null))[_0xc832('0x20')](respondWithResult(_0x231519,null))['catch'](handleError(_0x231519,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 950de20..df97476 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 _0x5fd7=['./cmHopperHistory.attributes','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0x1e5c25,_0x374a3d){var _0x52b774=function(_0x463766){while(--_0x463766){_0x1e5c25['push'](_0x1e5c25['shift']());}};_0x52b774(++_0x374a3d);}(_0x5fd7,0x1b8));var _0x75fd=function(_0xb8609a,_0x1e33e2){_0xb8609a=_0xb8609a-0x0;var _0x32c16c=_0x5fd7[_0xb8609a];return _0x32c16c;};'use strict';var _=require(_0x75fd('0x0'));var util=require(_0x75fd('0x1'));var logger=require(_0x75fd('0x2'))(_0x75fd('0x3'));var moment=require('moment');var BPromise=require(_0x75fd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x75fd('0x5'));var rimraf=require(_0x75fd('0x6'));var config=require(_0x75fd('0x7'));var attributes=require(_0x75fd('0x8'));module['exports']=function(_0x585035,_0x536f49){return _0x585035[_0x75fd('0x9')](_0x75fd('0xa'),attributes,{'tableName':_0x75fd('0xb'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0x75fd('0xc')]},{'name':_0x75fd('0xd'),'fields':[_0x75fd('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6f07=['bluebird','path','./cmHopperHistory.attributes','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x6f07,0x1e9));var _0x76f0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6f07[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x76f0('0x0'));var util=require(_0x76f0('0x1'));var logger=require(_0x76f0('0x2'))(_0x76f0('0x3'));var moment=require(_0x76f0('0x4'));var BPromise=require(_0x76f0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76f0('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x76f0('0x7'));module['exports']=function(_0xab62cd,_0x238437){return _0xab62cd[_0x76f0('0x8')](_0x76f0('0x9'),attributes,{'tableName':_0x76f0('0xa'),'paranoid':![],'indexes':[{'name':_0x76f0('0xb'),'fields':['endtime']},{'name':_0x76f0('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index d65a108..7dd1fe4 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 _0x0972=['sequelize','literal','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetVoiceQueueHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','catch','AvgHandleTime','findAll','where','COUNT','col','predictiveIntervalTotalCalls'];(function(_0xf9c824,_0x867745){var _0x1d08e7=function(_0x96ae15){while(--_0x96ae15){_0xf9c824['push'](_0xf9c824['shift']());}};_0x1d08e7(++_0x867745);}(_0x0972,0x64));var _0x2097=function(_0x445263,_0x112482){_0x445263=_0x445263-0x0;var _0x55a10d=_0x0972[_0x445263];return _0x55a10d;};'use strict';var _=require('lodash');var util=require(_0x2097('0x0'));var moment=require('moment');var BPromise=require(_0x2097('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2097('0x2'));var db=require(_0x2097('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2097('0x4'))(_0x2097('0x5'));var config=require(_0x2097('0x6'));var jayson=require(_0x2097('0x7'));var client=jayson[_0x2097('0x8')][_0x2097('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b4f21,_0x59739f,_0x332aac){return new BPromise(function(_0x1e661a,_0x11d263){return client[_0x2097('0xa')](_0x2b4f21,_0x332aac)[_0x2097('0xb')](function(_0x59d947){logger[_0x2097('0xc')](_0x2097('0xd'),_0x59739f,_0x2097('0xe'));logger[_0x2097('0xf')](_0x2097('0x10'),_0x59739f,_0x2097('0xe'),JSON[_0x2097('0x11')](_0x59d947));if(_0x59d947[_0x2097('0x12')]){if(_0x59d947[_0x2097('0x12')][_0x2097('0x13')]===0x1f4){logger[_0x2097('0x12')](_0x2097('0xd'),_0x59739f,_0x59d947[_0x2097('0x12')][_0x2097('0x14')]);return _0x11d263(_0x59d947[_0x2097('0x12')][_0x2097('0x14')]);}logger[_0x2097('0x12')](_0x2097('0xd'),_0x59739f,_0x59d947[_0x2097('0x12')][_0x2097('0x14')]);return _0x1e661a(_0x59d947['error'][_0x2097('0x14')]);}else{logger[_0x2097('0xc')]('CmHopperHistory,\x20%s,\x20%s',_0x59739f,'request\x20sent');_0x1e661a(_0x59d947['result'][_0x2097('0x14')]);}})['catch'](function(_0x28c35c){logger[_0x2097('0x12')](_0x2097('0xd'),_0x59739f,_0x28c35c);_0x11d263(_0x28c35c);});});}exports[_0x2097('0x15')]=function(_0x44c584){var _0x53e2b4=this;return new Promise(function(_0x324652,_0x140094){return db[_0x2097('0x16')][_0x2097('0x17')](_0x44c584[_0x2097('0x18')],{'raw':_0x44c584[_0x2097('0x19')]?_0x44c584[_0x2097('0x19')][_0x2097('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x4d957e){logger[_0x2097('0xc')]('CreateCmHopperHistory',_0x44c584);logger[_0x2097('0xf')](_0x2097('0x15'),_0x44c584,JSON['stringify'](_0x4d957e));_0x324652(_0x4d957e);})[_0x2097('0x1b')](function(_0x5b0582){logger[_0x2097('0x12')](_0x2097('0x15'),_0x5b0582[_0x2097('0x14')],_0x44c584);_0x140094(_0x53e2b4[_0x2097('0x12')](0x1f4,_0x5b0582[_0x2097('0x14')]));});});};exports[_0x2097('0x1c')]=function(_0x56390a){var _0xae5f9=this;return new Promise(function(_0x500234,_0x3f9279){return db[_0x2097('0x16')][_0x2097('0x1d')]({'raw':_0x56390a[_0x2097('0x19')]?_0x56390a['options'][_0x2097('0x1a')]===undefined?!![]:![]:!![],'where':_0x56390a[_0x2097('0x19')]?_0x56390a['options'][_0x2097('0x1e')]||null:null,'attributes':[[db['sequelize']['fn'](_0x2097('0x1f'),db['sequelize'][_0x2097('0x20')]('id')),_0x2097('0x21')],[db[_0x2097('0x22')]['fn'](_0x2097('0x1f'),db[_0x2097('0x22')]['fn']('IF',db[_0x2097('0x22')][_0x2097('0x23')]('`state`\x20=\x204,\x201,\x20null'))),_0x2097('0x24')],[db[_0x2097('0x22')]['fn']('COUNT',db[_0x2097('0x22')]['fn']('IF',db[_0x2097('0x22')]['literal']('`state`\x20=\x2010,\x201,\x20null'))),_0x2097('0x25')],[db[_0x2097('0x22')]['fn'](_0x2097('0x1f'),db[_0x2097('0x22')]['fn']('IF',db[_0x2097('0x22')][_0x2097('0x23')]('`state`\x20=\x2011,\x201,\x20null'))),_0x2097('0x26')],[db['sequelize']['fn'](_0x2097('0x27'),db[_0x2097('0x22')]['fn']('IF',db[_0x2097('0x22')][_0x2097('0x23')](_0x2097('0x28')))),_0x2097('0x29')],[db[_0x2097('0x22')]['fn'](_0x2097('0x27'),db[_0x2097('0x22')]['fn']('IF',db['sequelize'][_0x2097('0x23')](_0x2097('0x2a')))),_0x2097('0x2b')]]})['then'](function(_0x3d97ee){logger[_0x2097('0xc')](_0x2097('0x1c'),_0x56390a);logger[_0x2097('0xf')]('AvgHandleTime',_0x56390a,JSON['stringify'](_0x3d97ee));_0x500234(_0x3d97ee);})['catch'](function(_0x3484ff){logger[_0x2097('0x12')](_0x2097('0x1c'),_0x3484ff[_0x2097('0x14')],_0x56390a);_0x3f9279(_0xae5f9[_0x2097('0x12')](0x1f4,_0x3484ff[_0x2097('0x14')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x379032){var _0xf65266=this;return new Promise(function(_0x2cf259,_0x164eba){return db[_0x2097('0x16')][_0x2097('0x1d')]({'raw':_0x379032['options']?_0x379032[_0x2097('0x19')][_0x2097('0x1a')]===undefined?!![]:![]:!![],'where':_0x379032[_0x2097('0x19')]?_0x379032['options']['where']||null:null,'attributes':[[_0x2097('0x2c'),_0x2097('0x2d')],[db[_0x2097('0x22')]['fn'](_0x2097('0x1f'),db[_0x2097('0x22')]['fn']('IF',db[_0x2097('0x22')][_0x2097('0x23')](_0x2097('0x2e')))),_0x2097('0x2f')],[db[_0x2097('0x22')]['fn'](_0x2097('0x1f'),db[_0x2097('0x22')]['fn']('IF',db['sequelize'][_0x2097('0x23')](_0x2097('0x30')))),_0x2097('0x31')],[db['sequelize']['fn'](_0x2097('0x1f'),db[_0x2097('0x22')]['fn']('IF',db[_0x2097('0x22')][_0x2097('0x23')](_0x2097('0x32')))),_0x2097('0x33')],[db[_0x2097('0x22')]['fn'](_0x2097('0x1f'),db['sequelize']['fn']('IF',db[_0x2097('0x22')][_0x2097('0x23')](_0x2097('0x34')))),_0x2097('0x35')],[db[_0x2097('0x22')]['fn'](_0x2097('0x1f'),db[_0x2097('0x22')]['fn']('IF',db[_0x2097('0x22')]['literal'](_0x2097('0x36')))),'outboundCongestionCallsDay'],[db[_0x2097('0x22')]['fn'](_0x2097('0x1f'),db[_0x2097('0x22')]['fn']('IF',db[_0x2097('0x22')][_0x2097('0x23')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x2097('0x37')],[db[_0x2097('0x22')]['fn'](_0x2097('0x1f'),db[_0x2097('0x22')]['fn']('IF',db[_0x2097('0x22')]['literal'](_0x2097('0x38')))),_0x2097('0x39')],[db[_0x2097('0x22')]['fn'](_0x2097('0x1f'),db[_0x2097('0x22')]['fn']('IF',db[_0x2097('0x22')][_0x2097('0x23')](_0x2097('0x3a')))),'outboundUnknownCallsDay'],[db[_0x2097('0x22')]['fn'](_0x2097('0x1f'),db[_0x2097('0x22')]['fn']('IF',db[_0x2097('0x22')]['literal']('`state`\x20=\x2013,\x201,\x20null'))),'outboundBlacklistCallsDay'],[db[_0x2097('0x22')]['fn'](_0x2097('0x1f'),db['sequelize']['fn']('IF',db[_0x2097('0x22')][_0x2097('0x23')]('`state`\x20=\x2014,\x201,\x20null'))),'outboundOriginateFailureCallsDay'],[db[_0x2097('0x22')]['fn'](_0x2097('0x1f'),db[_0x2097('0x22')]['fn']('IF',db['sequelize'][_0x2097('0x23')](_0x2097('0x3b')))),'outboundRejectCallsDay'],[db[_0x2097('0x22')]['fn'](_0x2097('0x1f'),db[_0x2097('0x22')]['fn']('IF',db[_0x2097('0x22')][_0x2097('0x23')]('`state`\x20=\x2016,\x201,\x20null'))),'outboundAnswerAgiCallsDay'],[db[_0x2097('0x22')]['fn'](_0x2097('0x1f'),db[_0x2097('0x22')]['fn']('IF',db['sequelize']['literal'](_0x2097('0x3c')))),_0x2097('0x3d')],[db['sequelize']['fn'](_0x2097('0x1f'),db[_0x2097('0x22')]['fn']('IF',db[_0x2097('0x22')][_0x2097('0x23')](_0x2097('0x3e')))),'outboundReCallsDay']],'group':[_0x2097('0x2c')]})[_0x2097('0xb')](function(_0x190859){logger['info'](_0x2097('0x3f'),_0x379032);logger[_0x2097('0xf')]('GetVoiceQueueHopperHistory',_0x379032,JSON[_0x2097('0x11')](_0x190859));_0x2cf259(_0x190859);})['catch'](function(_0x30b4cd){logger['error']('GetVoiceQueueHopperHistory',_0x30b4cd['message'],_0x379032);_0x164eba(_0xf65266[_0x2097('0x12')](0x1f4,_0x30b4cd['message']));});});};exports['GetCampaignHopperHistory']=function(_0x11e37f){var _0x52af14=this;return new Promise(function(_0x597322,_0x5465ea){return db['CmHopperHistory'][_0x2097('0x1d')]({'raw':_0x11e37f[_0x2097('0x19')]?_0x11e37f[_0x2097('0x19')][_0x2097('0x1a')]===undefined?!![]:![]:!![],'where':_0x11e37f[_0x2097('0x19')]?_0x11e37f['options'][_0x2097('0x1e')]||null:null,'attributes':[['campaign',_0x2097('0x2d')],[db[_0x2097('0x22')]['fn'](_0x2097('0x1f'),db['sequelize'][_0x2097('0x20')]('id')),_0x2097('0x40')],[db[_0x2097('0x22')]['fn'](_0x2097('0x1f'),db[_0x2097('0x22')]['fn']('IF',db['sequelize']['literal'](_0x2097('0x32')))),_0x2097('0x41')]],'group':['campaign']})['then'](function(_0x4c5f0d){logger['info'](_0x2097('0x42'),_0x11e37f);logger['debug'](_0x2097('0x42'),_0x11e37f,JSON[_0x2097('0x11')](_0x4c5f0d));_0x597322(_0x4c5f0d);})['catch'](function(_0x13558a){logger[_0x2097('0x12')](_0x2097('0x42'),_0x13558a[_0x2097('0x14')],_0x11e37f);_0x5465ea(_0x52af14[_0x2097('0x12')](0x1f4,_0x13558a[_0x2097('0x14')]));});});}; \ No newline at end of file +var _0xe511=['outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','col','ivrTotalCallsDays','GetCampaignHopperHistory','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateCmHopperHistory','CmHopperHistory','body','options','raw','then','AvgHandleTime','findAll','where','sequelize','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','COUNT','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','literal','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','catch','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','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundRejectCallsDay'];(function(_0x34ebcd,_0x2f8150){var _0x1b142a=function(_0xc396c5){while(--_0xc396c5){_0x34ebcd['push'](_0x34ebcd['shift']());}};_0x1b142a(++_0x2f8150);}(_0xe511,0x16f));var _0x1e51=function(_0x43eb54,_0x35e944){_0x43eb54=_0x43eb54-0x0;var _0x3892ac=_0xe511[_0x43eb54];return _0x3892ac;};'use strict';var _=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var moment=require('moment');var BPromise=require(_0x1e51('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1e51('0x3'));var db=require(_0x1e51('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1e51('0x5'))(_0x1e51('0x6'));var config=require(_0x1e51('0x7'));var jayson=require(_0x1e51('0x8'));var client=jayson['client'][_0x1e51('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21ed6b,_0x5c4590,_0x4fa2ba){return new BPromise(function(_0x394ad8,_0x133021){return client['request'](_0x21ed6b,_0x4fa2ba)['then'](function(_0x658941){logger[_0x1e51('0xa')](_0x1e51('0xb'),_0x5c4590,_0x1e51('0xc'));logger[_0x1e51('0xd')](_0x1e51('0xe'),_0x5c4590,'request\x20sent',JSON[_0x1e51('0xf')](_0x658941));if(_0x658941[_0x1e51('0x10')]){if(_0x658941[_0x1e51('0x10')][_0x1e51('0x11')]===0x1f4){logger[_0x1e51('0x10')](_0x1e51('0xb'),_0x5c4590,_0x658941['error'][_0x1e51('0x12')]);return _0x133021(_0x658941[_0x1e51('0x10')][_0x1e51('0x12')]);}logger[_0x1e51('0x10')](_0x1e51('0xb'),_0x5c4590,_0x658941[_0x1e51('0x10')][_0x1e51('0x12')]);return _0x394ad8(_0x658941[_0x1e51('0x10')][_0x1e51('0x12')]);}else{logger[_0x1e51('0xa')]('CmHopperHistory,\x20%s,\x20%s',_0x5c4590,_0x1e51('0xc'));_0x394ad8(_0x658941[_0x1e51('0x13')][_0x1e51('0x12')]);}})['catch'](function(_0xa3b410){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x5c4590,_0xa3b410);_0x133021(_0xa3b410);});});}exports[_0x1e51('0x14')]=function(_0x27dcad){var _0x40ae4c=this;return new Promise(function(_0x4785a5,_0x4d1aae){return db[_0x1e51('0x15')]['create'](_0x27dcad[_0x1e51('0x16')],{'raw':_0x27dcad['options']?_0x27dcad[_0x1e51('0x17')][_0x1e51('0x18')]===undefined?!![]:![]:!![]})[_0x1e51('0x19')](function(_0x183a95){logger['info']('CreateCmHopperHistory',_0x27dcad);logger['debug']('CreateCmHopperHistory',_0x27dcad,JSON[_0x1e51('0xf')](_0x183a95));_0x4785a5(_0x183a95);})['catch'](function(_0x3f7340){logger[_0x1e51('0x10')](_0x1e51('0x14'),_0x3f7340[_0x1e51('0x12')],_0x27dcad);_0x4d1aae(_0x40ae4c[_0x1e51('0x10')](0x1f4,_0x3f7340[_0x1e51('0x12')]));});});};exports[_0x1e51('0x1a')]=function(_0x461d3d){var _0x4bcdd3=this;return new Promise(function(_0x4d04c0,_0x43f5c5){return db[_0x1e51('0x15')][_0x1e51('0x1b')]({'raw':_0x461d3d[_0x1e51('0x17')]?_0x461d3d['options']['raw']===undefined?!![]:![]:!![],'where':_0x461d3d['options']?_0x461d3d[_0x1e51('0x17')][_0x1e51('0x1c')]||null:null,'attributes':[[db[_0x1e51('0x1d')]['fn']('COUNT',db[_0x1e51('0x1d')]['col']('id')),'predictiveIntervalTotalCalls'],[db[_0x1e51('0x1d')]['fn']('COUNT',db[_0x1e51('0x1d')]['fn']('IF',db[_0x1e51('0x1d')]['literal'](_0x1e51('0x1e')))),_0x1e51('0x1f')],[db[_0x1e51('0x1d')]['fn'](_0x1e51('0x20'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x1e51('0x21')))),_0x1e51('0x22')],[db[_0x1e51('0x1d')]['fn'](_0x1e51('0x20'),db[_0x1e51('0x1d')]['fn']('IF',db[_0x1e51('0x1d')][_0x1e51('0x23')](_0x1e51('0x24')))),_0x1e51('0x25')],[db[_0x1e51('0x1d')]['fn'](_0x1e51('0x26'),db['sequelize']['fn']('IF',db[_0x1e51('0x1d')][_0x1e51('0x23')](_0x1e51('0x27')))),_0x1e51('0x28')],[db[_0x1e51('0x1d')]['fn']('AVG',db[_0x1e51('0x1d')]['fn']('IF',db['sequelize'][_0x1e51('0x23')](_0x1e51('0x29')))),_0x1e51('0x2a')]]})['then'](function(_0x3e3742){logger['info'](_0x1e51('0x1a'),_0x461d3d);logger['debug']('AvgHandleTime',_0x461d3d,JSON[_0x1e51('0xf')](_0x3e3742));_0x4d04c0(_0x3e3742);})[_0x1e51('0x2b')](function(_0x45313e){logger['error'](_0x1e51('0x1a'),_0x45313e['message'],_0x461d3d);_0x43f5c5(_0x4bcdd3[_0x1e51('0x10')](0x1f4,_0x45313e[_0x1e51('0x12')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0xd4fd91){var _0x1bab7f=this;return new Promise(function(_0x433cb1,_0xeeff34){return db[_0x1e51('0x15')][_0x1e51('0x1b')]({'raw':_0xd4fd91['options']?_0xd4fd91['options'][_0x1e51('0x18')]===undefined?!![]:![]:!![],'where':_0xd4fd91['options']?_0xd4fd91[_0x1e51('0x17')][_0x1e51('0x1c')]||null:null,'attributes':[[_0x1e51('0x2c'),_0x1e51('0x2d')],[db[_0x1e51('0x1d')]['fn'](_0x1e51('0x20'),db[_0x1e51('0x1d')]['fn']('IF',db[_0x1e51('0x1d')][_0x1e51('0x23')](_0x1e51('0x2e')))),_0x1e51('0x2f')],[db['sequelize']['fn'](_0x1e51('0x20'),db['sequelize']['fn']('IF',db[_0x1e51('0x1d')][_0x1e51('0x23')](_0x1e51('0x30')))),_0x1e51('0x31')],[db[_0x1e51('0x1d')]['fn'](_0x1e51('0x20'),db[_0x1e51('0x1d')]['fn']('IF',db[_0x1e51('0x1d')][_0x1e51('0x23')](_0x1e51('0x1e')))),_0x1e51('0x32')],[db['sequelize']['fn']('COUNT',db[_0x1e51('0x1d')]['fn']('IF',db[_0x1e51('0x1d')][_0x1e51('0x23')](_0x1e51('0x33')))),_0x1e51('0x34')],[db[_0x1e51('0x1d')]['fn'](_0x1e51('0x20'),db[_0x1e51('0x1d')]['fn']('IF',db['sequelize'][_0x1e51('0x23')](_0x1e51('0x35')))),_0x1e51('0x36')],[db[_0x1e51('0x1d')]['fn'](_0x1e51('0x20'),db[_0x1e51('0x1d')]['fn']('IF',db[_0x1e51('0x1d')]['literal'](_0x1e51('0x37')))),_0x1e51('0x38')],[db['sequelize']['fn'](_0x1e51('0x20'),db[_0x1e51('0x1d')]['fn']('IF',db[_0x1e51('0x1d')]['literal'](_0x1e51('0x39')))),_0x1e51('0x3a')],[db[_0x1e51('0x1d')]['fn'](_0x1e51('0x20'),db[_0x1e51('0x1d')]['fn']('IF',db[_0x1e51('0x1d')][_0x1e51('0x23')](_0x1e51('0x3b')))),_0x1e51('0x3c')],[db['sequelize']['fn'](_0x1e51('0x20'),db[_0x1e51('0x1d')]['fn']('IF',db['sequelize'][_0x1e51('0x23')](_0x1e51('0x3d')))),_0x1e51('0x3e')],[db['sequelize']['fn'](_0x1e51('0x20'),db[_0x1e51('0x1d')]['fn']('IF',db[_0x1e51('0x1d')]['literal'](_0x1e51('0x3f')))),'outboundOriginateFailureCallsDay'],[db['sequelize']['fn']('COUNT',db[_0x1e51('0x1d')]['fn']('IF',db[_0x1e51('0x1d')]['literal']('`state`\x20=\x2018,\x201,\x20null'))),_0x1e51('0x40')],[db[_0x1e51('0x1d')]['fn'](_0x1e51('0x20'),db[_0x1e51('0x1d')]['fn']('IF',db[_0x1e51('0x1d')][_0x1e51('0x23')]('`state`\x20=\x2016,\x201,\x20null'))),_0x1e51('0x41')],[db['sequelize']['fn'](_0x1e51('0x20'),db[_0x1e51('0x1d')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2020,\x201,\x20null'))),_0x1e51('0x40')],[db[_0x1e51('0x1d')]['fn'](_0x1e51('0x20'),db['sequelize']['fn']('IF',db[_0x1e51('0x1d')][_0x1e51('0x23')](_0x1e51('0x42')))),_0x1e51('0x43')]],'group':[_0x1e51('0x2c')]})[_0x1e51('0x19')](function(_0x32fe1f){logger[_0x1e51('0xa')]('GetVoiceQueueHopperHistory',_0xd4fd91);logger[_0x1e51('0xd')](_0x1e51('0x44'),_0xd4fd91,JSON[_0x1e51('0xf')](_0x32fe1f));_0x433cb1(_0x32fe1f);})[_0x1e51('0x2b')](function(_0x177b63){logger[_0x1e51('0x10')]('GetVoiceQueueHopperHistory',_0x177b63[_0x1e51('0x12')],_0xd4fd91);_0xeeff34(_0x1bab7f['error'](0x1f4,_0x177b63['message']));});});};exports['GetCampaignHopperHistory']=function(_0xd353e3){var _0xfbc40f=this;return new Promise(function(_0x4b2046,_0x56f9ba){return db[_0x1e51('0x15')][_0x1e51('0x1b')]({'raw':_0xd353e3[_0x1e51('0x17')]?_0xd353e3['options'][_0x1e51('0x18')]===undefined?!![]:![]:!![],'where':_0xd353e3[_0x1e51('0x17')]?_0xd353e3[_0x1e51('0x17')]['where']||null:null,'attributes':[[_0x1e51('0x2c'),_0x1e51('0x2d')],[db[_0x1e51('0x1d')]['fn'](_0x1e51('0x20'),db[_0x1e51('0x1d')][_0x1e51('0x45')]('id')),_0x1e51('0x46')],[db[_0x1e51('0x1d')]['fn']('COUNT',db[_0x1e51('0x1d')]['fn']('IF',db[_0x1e51('0x1d')]['literal']('`state`\x20=\x204,\x201,\x20null'))),'ivrAnswerCallsDay']],'group':[_0x1e51('0x2c')]})[_0x1e51('0x19')](function(_0x2ffd82){logger[_0x1e51('0xa')](_0x1e51('0x47'),_0xd353e3);logger[_0x1e51('0xd')](_0x1e51('0x47'),_0xd353e3,JSON[_0x1e51('0xf')](_0x2ffd82));_0x4b2046(_0x2ffd82);})[_0x1e51('0x2b')](function(_0x47a961){logger['error']('GetCampaignHopperHistory',_0x47a961[_0x1e51('0x12')],_0xd353e3);_0x56f9ba(_0xfbc40f[_0x1e51('0x10')](0x1f4,_0x47a961['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index c572c9a..ea02347 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 _0x0984=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','/:id','show','put','update','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0984,0xff));var _0x4098=function(_0x125145,_0x2154fd){_0x125145=_0x125145-0x0;var _0x5191ea=_0x0984[_0x125145];return _0x5191ea;};'use strict';var multer=require(_0x4098('0x0'));var util=require(_0x4098('0x1'));var path=require(_0x4098('0x2'));var timeout=require('connect-timeout');var express=require(_0x4098('0x3'));var router=express[_0x4098('0x4')]();var auth=require(_0x4098('0x5'));var interaction=require(_0x4098('0x6'));var config=require('../../config/environment');var controller=require(_0x4098('0x7'));router[_0x4098('0x8')]('/',auth[_0x4098('0x9')](),controller[_0x4098('0xa')]);router['get'](_0x4098('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x4098('0xc'),auth[_0x4098('0x9')](),controller[_0x4098('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x4098('0xe')](_0x4098('0xc'),auth['isAuthenticated'](),controller[_0x4098('0xf')]);module[_0x4098('0x10')]=router; \ No newline at end of file +var _0x7919=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','isAuthenticated','index','get','/describe','put','/:id','update','exports','multer','util','path'];(function(_0x1becbd,_0x13b851){var _0x302014=function(_0x41a6fa){while(--_0x41a6fa){_0x1becbd['push'](_0x1becbd['shift']());}};_0x302014(++_0x13b851);}(_0x7919,0xeb));var _0x9791=function(_0x25ed8a,_0xccf6f5){_0x25ed8a=_0x25ed8a-0x0;var _0x23310c=_0x7919[_0x25ed8a];return _0x23310c;};'use strict';var multer=require(_0x9791('0x0'));var util=require(_0x9791('0x1'));var path=require(_0x9791('0x2'));var timeout=require(_0x9791('0x3'));var express=require(_0x9791('0x4'));var router=express[_0x9791('0x5')]();var auth=require(_0x9791('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9791('0x7'));var controller=require(_0x9791('0x8'));router['get']('/',auth[_0x9791('0x9')](),controller[_0x9791('0xa')]);router[_0x9791('0xb')](_0x9791('0xc'),auth[_0x9791('0x9')](),controller['describe']);router[_0x9791('0xb')]('/:id',auth[_0x9791('0x9')](),controller['show']);router['post']('/',auth[_0x9791('0x9')](),controller['create']);router[_0x9791('0xd')](_0x9791('0xe'),auth[_0x9791('0x9')](),controller[_0x9791('0xf')]);module[_0x9791('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 899469b..c520962 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 _0x3ad4=['STRING','sequelize','name'];(function(_0x5b8310,_0x77ea6f){var _0xd3ebc1=function(_0x9dfb29){while(--_0x9dfb29){_0x5b8310['push'](_0x5b8310['shift']());}};_0xd3ebc1(++_0x77ea6f);}(_0x3ad4,0x100));var _0x43ad=function(_0x1dd8f6,_0x3ea487){_0x1dd8f6=_0x1dd8f6-0x0;var _0xf083b7=_0x3ad4[_0x1dd8f6];return _0xf083b7;};'use strict';var Sequelize=require(_0x43ad('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x43ad('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x43ad('0x2')]}}; \ No newline at end of file +var _0xaeb2=['sequelize','exports','STRING'];(function(_0x597644,_0x4b5cea){var _0x5d5d22=function(_0xd69ddd){while(--_0xd69ddd){_0x597644['push'](_0x597644['shift']());}};_0x5d5d22(++_0x4b5cea);}(_0xaeb2,0x171));var _0x2aeb=function(_0x4c45b2,_0x3fc02f){_0x4c45b2=_0x4c45b2-0x0;var _0x14ec15=_0xaeb2[_0x4c45b2];return _0x14ec15;};'use strict';var Sequelize=require(_0x2aeb('0x0'));module[_0x2aeb('0x1')]={'name':{'type':Sequelize[_0x2aeb('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x2aeb('0x2')]},'dialPrefix':{'type':Sequelize[_0x2aeb('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 5b8a8a7..f8b84df 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 _0xcb91=['bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','count','offset','limit','set','apply','update','then','get','Lists','destroy','error','name','index','map','CmList','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','describe','addDisposition','ListId','Disposition','getDispositions','sort','includeAll','rows','removeDispositions','CmContact','tags','isArray','join','each','omit','ids','success','dataValues','errors','push','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContacts','getContactsCsv','isEmpty','now','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','findOne','sequelize','transaction','addCustomFields','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','queryInterface','addColumn','cf_%s','getCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x3e69ae,_0x366e8d){var _0x3d7f42=function(_0x5df093){while(--_0x5df093){_0x3e69ae['push'](_0x3e69ae['shift']());}};_0x3d7f42(++_0x366e8d);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0xcb91[_0x2d34d6];return _0x1d3d12;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1cb9('0x0'));var zipdir=require(_0x1cb9('0x1'));var jsonpatch=require(_0x1cb9('0x2'));var rp=require(_0x1cb9('0x3'));var moment=require('moment');var BPromise=require(_0x1cb9('0x4'));var Mustache=require(_0x1cb9('0x5'));var util=require('util');var path=require(_0x1cb9('0x6'));var sox=require(_0x1cb9('0x7'));var csv=require('to-csv');var ejs=require(_0x1cb9('0x8'));var fs=require('fs');var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xd'));var authService=require(_0x1cb9('0xe'));var qs=require(_0x1cb9('0xf'));var as=require(_0x1cb9('0x10'));var hardwareService=require(_0x1cb9('0x11'));var logger=require('../../config/logger')(_0x1cb9('0x12'));var utils=require(_0x1cb9('0x13'));var config=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];config[_0x1cb9('0x16')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1cb9('0x17'))(new Redis(config[_0x1cb9('0x16')]));require(_0x1cb9('0x18'))[_0x1cb9('0x19')](socket);function respondWithStatusCode(_0x56884d,_0x397727){_0x397727=_0x397727||0xcc;return function(_0x6ef389){if(_0x6ef389){return _0x56884d[_0x1cb9('0x1a')](_0x397727);}return _0x56884d[_0x1cb9('0x1b')](_0x397727)[_0x1cb9('0x1c')]();};}function respondWithResult(_0x5806d8,_0x5572cb){_0x5572cb=_0x5572cb||0xc8;return function(_0xd446a3){if(_0xd446a3){return _0x5806d8[_0x1cb9('0x1b')](_0x5572cb)[_0x1cb9('0x1d')](_0xd446a3);}};}function respondWithFilteredResult(_0x3f1376,_0x3e21e0){return function(_0xf22920){if(_0xf22920){var _0x23d3a9=_0xf22920[_0x1cb9('0x1e')],_0x4e1340=_0x3e21e0[_0x1cb9('0x1f')],_0x479d43=_0x3e21e0[_0x1cb9('0x1f')]+_0x3e21e0[_0x1cb9('0x20')],_0x1b2fa6;if(_0x479d43>=_0x23d3a9){_0x479d43=_0x23d3a9;_0x1b2fa6=0xc8;}else{_0x1b2fa6=0xce;}_0x3f1376[_0x1cb9('0x1b')](_0x1b2fa6);return _0x3f1376[_0x1cb9('0x21')]('Content-Range',_0x4e1340+'-'+_0x479d43+'/'+_0x23d3a9)['json'](_0xf22920);}return null;};}function patchUpdates(_0x1a5a72){return function(_0x5dbfae){try{jsonpatch[_0x1cb9('0x22')](_0x5dbfae,_0x1a5a72,!![]);}catch(_0x2265ea){return BPromise['reject'](_0x2265ea);}return _0x5dbfae['save']();};}function saveUpdates(_0x2e3854,_0x325637){return function(_0x103a63){if(_0x103a63){return _0x103a63[_0x1cb9('0x23')](_0x2e3854)[_0x1cb9('0x24')](function(_0x27db16){return _0x27db16;});}return null;};}function removeEntity(_0x59ebea,_0x55b232){return function(_0x6c6f61){if(_0x6c6f61){return _0x6c6f61['destroy']()[_0x1cb9('0x24')](function(){var _0x2b1275=_0x6c6f61[_0x1cb9('0x25')]({'plain':!![]});var _0x44d3c4=_0x1cb9('0x26');return db['UserProfileResource'][_0x1cb9('0x27')]({'where':{'type':_0x44d3c4,'resourceId':_0x2b1275['id']}})[_0x1cb9('0x24')](function(){return _0x6c6f61;});})['then'](function(){_0x59ebea[_0x1cb9('0x1b')](0xcc)[_0x1cb9('0x1c')]();});}};}function handleEntityNotFound(_0x41a9a0,_0x1804fd){return function(_0x406821){if(!_0x406821){_0x41a9a0[_0x1cb9('0x1a')](0x194);}return _0x406821;};}function handleError(_0x2e28fe,_0xb644b3){_0xb644b3=_0xb644b3||0x1f4;return function(_0x41e5c2){logger[_0x1cb9('0x28')](_0x41e5c2['stack']);if(_0x41e5c2[_0x1cb9('0x29')]){delete _0x41e5c2['name'];}_0x2e28fe[_0x1cb9('0x1b')](_0xb644b3)['send'](_0x41e5c2);};}exports[_0x1cb9('0x2a')]=function(_0x41011c,_0x3cd7f5){var _0x2038aa={},_0x561d89={},_0x1c701f={'count':0x0,'rows':[]};var _0x4eba82=_[_0x1cb9('0x2b')](db[_0x1cb9('0x2c')][_0x1cb9('0x2d')],function(_0x5d8793){return{'name':_0x5d8793[_0x1cb9('0x2e')],'type':_0x5d8793['type'][_0x1cb9('0x2f')]};});_0x561d89['model']=_[_0x1cb9('0x2b')](_0x4eba82,_0x1cb9('0x29'));_0x561d89[_0x1cb9('0x30')]=_[_0x1cb9('0x31')](_0x41011c['query']);_0x561d89[_0x1cb9('0x32')]=_[_0x1cb9('0x33')](_0x561d89[_0x1cb9('0x34')],_0x561d89[_0x1cb9('0x30')]);_0x2038aa[_0x1cb9('0x35')]=_[_0x1cb9('0x33')](_0x561d89[_0x1cb9('0x34')],qs[_0x1cb9('0x36')](_0x41011c[_0x1cb9('0x30')][_0x1cb9('0x36')]));_0x2038aa[_0x1cb9('0x35')]=_0x2038aa[_0x1cb9('0x35')][_0x1cb9('0x37')]?_0x2038aa['attributes']:_0x561d89['model'];if(!_0x41011c[_0x1cb9('0x30')][_0x1cb9('0x38')](_0x1cb9('0x39'))){_0x2038aa[_0x1cb9('0x20')]=qs[_0x1cb9('0x20')](_0x41011c[_0x1cb9('0x30')][_0x1cb9('0x20')]);_0x2038aa[_0x1cb9('0x1f')]=qs['offset'](_0x41011c[_0x1cb9('0x30')][_0x1cb9('0x1f')]);}_0x2038aa[_0x1cb9('0x3a')]=qs['sort'](_0x41011c[_0x1cb9('0x30')]['sort']);_0x2038aa[_0x1cb9('0x3b')]=qs['filters'](_[_0x1cb9('0x3c')](_0x41011c[_0x1cb9('0x30')],_0x561d89[_0x1cb9('0x32')]));if(_0x41011c[_0x1cb9('0x30')][_0x1cb9('0x3d')]){_0x2038aa[_0x1cb9('0x3b')]=_[_0x1cb9('0x3e')](_0x2038aa['where'],{'$or':_['map'](_0x4eba82,function(_0x4111b8){if(_0x4111b8[_0x1cb9('0x3f')]!==_0x1cb9('0x40')){var _0x16ad1c={};_0x16ad1c[_0x4111b8[_0x1cb9('0x29')]]={'$like':'%'+_0x41011c[_0x1cb9('0x30')][_0x1cb9('0x3d')]+'%'};return _0x16ad1c;}})});}_0x2038aa=_['merge']({},_0x2038aa,_0x41011c[_0x1cb9('0x41')]);var _0x47edad={'where':_0x2038aa['where']};return db['CmList'][_0x1cb9('0x1e')](_0x47edad)[_0x1cb9('0x24')](function(_0x1bf51c){_0x1c701f[_0x1cb9('0x1e')]=_0x1bf51c;if(_0x41011c[_0x1cb9('0x30')]['includeAll']){_0x2038aa[_0x1cb9('0x42')]=[{'all':!![]}];}return db['CmList'][_0x1cb9('0x43')](_0x2038aa);})[_0x1cb9('0x24')](function(_0x38d973){_0x1c701f['rows']=_0x38d973;return _0x1c701f;})[_0x1cb9('0x24')](respondWithFilteredResult(_0x3cd7f5,_0x2038aa))['catch'](handleError(_0x3cd7f5,null));};exports[_0x1cb9('0x44')]=function(_0xbc36fc,_0x51a898){var _0x5839aa={'raw':![],'where':{'id':_0xbc36fc[_0x1cb9('0x45')]['id']}},_0x24c643={};_0x24c643[_0x1cb9('0x34')]=_[_0x1cb9('0x31')](db[_0x1cb9('0x2c')]['rawAttributes']);_0x24c643[_0x1cb9('0x30')]=_['keys'](_0xbc36fc['query']);_0x24c643['filters']=_[_0x1cb9('0x33')](_0x24c643[_0x1cb9('0x34')],_0x24c643[_0x1cb9('0x30')]);_0x5839aa[_0x1cb9('0x35')]=_[_0x1cb9('0x33')](_0x24c643[_0x1cb9('0x34')],qs[_0x1cb9('0x36')](_0xbc36fc[_0x1cb9('0x30')][_0x1cb9('0x36')]));_0x5839aa[_0x1cb9('0x35')]=_0x5839aa[_0x1cb9('0x35')]['length']?_0x5839aa[_0x1cb9('0x35')]:_0x24c643[_0x1cb9('0x34')];if(_0xbc36fc[_0x1cb9('0x30')]['includeAll']){_0x5839aa[_0x1cb9('0x42')]=[{'all':!![]}];}_0x5839aa=_[_0x1cb9('0x3e')]({},_0x5839aa,_0xbc36fc[_0x1cb9('0x41')]);return db[_0x1cb9('0x2c')][_0x1cb9('0x46')](_0x5839aa)['then'](handleEntityNotFound(_0x51a898,null))[_0x1cb9('0x24')](respondWithResult(_0x51a898,null))['catch'](handleError(_0x51a898,null));};exports[_0x1cb9('0x47')]=function(_0x4ac483,_0x1cf2ee){return db[_0x1cb9('0x2c')][_0x1cb9('0x47')](_0x4ac483[_0x1cb9('0x48')],{})['then'](function(_0x298475){var _0x1149b9=_0x4ac483[_0x1cb9('0x49')][_0x1cb9('0x25')]({'plain':!![]});if(!_0x1149b9)throw new Error(_0x1cb9('0x4a'));if(_0x1149b9[_0x1cb9('0x4b')]===_0x1cb9('0x49')){var _0x3b6a92=_0x298475[_0x1cb9('0x25')]({'plain':!![]});var _0x17f10e='Lists';return db['UserProfileSection'][_0x1cb9('0x46')]({'where':{'name':_0x17f10e,'userProfileId':_0x1149b9[_0x1cb9('0x4c')]},'raw':!![]})[_0x1cb9('0x24')](function(_0x1e073d){if(_0x1e073d&&_0x1e073d[_0x1cb9('0x4d')]===0x0){return db[_0x1cb9('0x4e')][_0x1cb9('0x47')]({'name':_0x3b6a92[_0x1cb9('0x29')],'resourceId':_0x3b6a92['id'],'type':_0x1e073d[_0x1cb9('0x29')],'sectionId':_0x1e073d['id']},{})[_0x1cb9('0x24')](function(){return _0x298475;});}else{return _0x298475;}})['catch'](function(_0x2cf8e2){logger['error'](_0x1cb9('0x4f'),_0x2cf8e2);throw _0x2cf8e2;});}return _0x298475;})['then'](respondWithResult(_0x1cf2ee,0xc9))[_0x1cb9('0x50')](handleError(_0x1cf2ee,null));};exports['update']=function(_0x5e5174,_0x44e918){if(_0x5e5174[_0x1cb9('0x48')]['id']){delete _0x5e5174[_0x1cb9('0x48')]['id'];}return db['CmList'][_0x1cb9('0x46')]({'where':{'id':_0x5e5174[_0x1cb9('0x45')]['id']}})['then'](handleEntityNotFound(_0x44e918,null))['then'](saveUpdates(_0x5e5174[_0x1cb9('0x48')],null))[_0x1cb9('0x24')](respondWithResult(_0x44e918,null))[_0x1cb9('0x50')](handleError(_0x44e918,null));};exports[_0x1cb9('0x27')]=function(_0x3de325,_0x310d6d){return db[_0x1cb9('0x2c')]['find']({'where':{'id':_0x3de325[_0x1cb9('0x45')]['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x310d6d,null))[_0x1cb9('0x24')](removeEntity(_0x310d6d,null))['catch'](handleError(_0x310d6d,null));};exports[_0x1cb9('0x51')]=function(_0x9893a3,_0x1651c5){return db[_0x1cb9('0x2c')][_0x1cb9('0x51')]()[_0x1cb9('0x24')](respondWithResult(_0x1651c5,null))['catch'](handleError(_0x1651c5,null));};exports[_0x1cb9('0x52')]=function(_0x36c40d,_0x41e81f,_0x128c5b){if(_0x36c40d[_0x1cb9('0x48')]['id']){delete _0x36c40d[_0x1cb9('0x48')]['id'];}return db[_0x1cb9('0x2c')][_0x1cb9('0x46')]({'where':{'id':_0x36c40d[_0x1cb9('0x45')]['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x41e81f,null))[_0x1cb9('0x24')](function(_0x55fb51){if(_0x55fb51){_0x36c40d[_0x1cb9('0x48')][_0x1cb9('0x53')]=_0x55fb51['id'];return db[_0x1cb9('0x54')][_0x1cb9('0x47')](_0x36c40d['body']);}})['then'](respondWithResult(_0x41e81f,null))[_0x1cb9('0x50')](handleError(_0x41e81f,null));};exports[_0x1cb9('0x55')]=function(_0x31eccc,_0x173db5,_0x3c2f9c){var _0x75c734={'raw':![],'where':{}};var _0xc515a6={};var _0xd010a9={'count':0x0,'rows':[]};return db['CmList']['findOne']({'where':{'id':_0x31eccc[_0x1cb9('0x45')]['id']}})['then'](handleEntityNotFound(_0x173db5,null))['then'](function(_0x4ca5bc){if(_0x4ca5bc){_0xc515a6['model']=_['keys'](db[_0x1cb9('0x54')][_0x1cb9('0x2d')]);_0xc515a6[_0x1cb9('0x30')]=_[_0x1cb9('0x31')](_0x31eccc[_0x1cb9('0x30')]);_0xc515a6[_0x1cb9('0x32')]=_['intersection'](_0xc515a6[_0x1cb9('0x34')],_0xc515a6[_0x1cb9('0x30')]);_0x75c734['attributes']=_['intersection'](_0xc515a6[_0x1cb9('0x34')],qs[_0x1cb9('0x36')](_0x31eccc[_0x1cb9('0x30')][_0x1cb9('0x36')]));_0x75c734[_0x1cb9('0x35')]=_0x75c734['attributes']['length']?_0x75c734['attributes']:_0xc515a6[_0x1cb9('0x34')];if(!_0x31eccc[_0x1cb9('0x30')][_0x1cb9('0x38')](_0x1cb9('0x39'))){_0x75c734[_0x1cb9('0x20')]=qs['limit'](_0x31eccc[_0x1cb9('0x30')][_0x1cb9('0x20')]);_0x75c734['offset']=qs['offset'](_0x31eccc[_0x1cb9('0x30')]['offset']);}_0x75c734[_0x1cb9('0x3a')]=qs[_0x1cb9('0x56')](_0x31eccc[_0x1cb9('0x30')][_0x1cb9('0x56')]);_0x75c734[_0x1cb9('0x3b')]=qs[_0x1cb9('0x32')](_['pick'](_0x31eccc[_0x1cb9('0x30')],_0xc515a6[_0x1cb9('0x32')]));_0x75c734[_0x1cb9('0x3b')][_0x1cb9('0x53')]=_0x4ca5bc['id'];if(_0x31eccc['query']['filter']){_0x75c734[_0x1cb9('0x3b')]=_[_0x1cb9('0x3e')](_0x75c734[_0x1cb9('0x3b')],{'$or':_[_0x1cb9('0x2b')](_0x75c734[_0x1cb9('0x35')],function(_0x267a3c){var _0x4f8756={};_0x4f8756[_0x267a3c]={'$like':'%'+_0x31eccc[_0x1cb9('0x30')]['filter']+'%'};return _0x4f8756;})});}_0x75c734=_[_0x1cb9('0x3e')]({},_0x75c734,_0x31eccc[_0x1cb9('0x41')]);return db['Disposition'][_0x1cb9('0x1e')]({'where':_0x75c734[_0x1cb9('0x3b')]})[_0x1cb9('0x24')](function(_0x539514){_0xd010a9[_0x1cb9('0x1e')]=_0x539514;if(_0x31eccc[_0x1cb9('0x30')][_0x1cb9('0x57')]){_0x75c734[_0x1cb9('0x42')]=[{'all':!![]}];}return db[_0x1cb9('0x54')][_0x1cb9('0x43')](_0x75c734);})['then'](function(_0x2b2874){_0xd010a9[_0x1cb9('0x58')]=_0x2b2874;return _0xd010a9;});}})[_0x1cb9('0x24')](respondWithFilteredResult(_0x173db5,_0x75c734))[_0x1cb9('0x50')](handleError(_0x173db5,null));};exports[_0x1cb9('0x59')]=function(_0x1da41c,_0x128a41,_0x37bcd9){return db['CmList'][_0x1cb9('0x46')]({'where':{'id':_0x1da41c[_0x1cb9('0x45')]['id']}})['then'](handleEntityNotFound(_0x128a41,null))[_0x1cb9('0x24')](function(_0x5415fa){if(_0x5415fa){return _0x5415fa[_0x1cb9('0x59')](_0x1da41c['query']['ids']);}})[_0x1cb9('0x24')](respondWithStatusCode(_0x128a41,null))[_0x1cb9('0x50')](handleError(_0x128a41,null));};exports['addContacts']=function(_0x342cb1,_0x5b5419,_0x3d6474){return db[_0x1cb9('0x2c')][_0x1cb9('0x46')]({'where':{'id':_0x342cb1[_0x1cb9('0x45')]['id']}})['then'](handleEntityNotFound(_0x5b5419,null))[_0x1cb9('0x24')](function(_0x3d25a3){if(_0x3d25a3){var _0x2a157d=[];var _0x27cc3c={'success':[],'errors':[]};return db[_0x1cb9('0x5a')][_0x1cb9('0x51')]()['then'](function(_0x248946){if(_0x342cb1[_0x1cb9('0x48')][_0x1cb9('0x5b')]&&_[_0x1cb9('0x5c')](_0x342cb1[_0x1cb9('0x48')][_0x1cb9('0x5b')])){if(_0x342cb1['body'][_0x1cb9('0x5b')][_0x1cb9('0x37')]){_0x342cb1['body'][_0x1cb9('0x5b')]=_0x342cb1[_0x1cb9('0x48')][_0x1cb9('0x5b')][_0x1cb9('0x5d')](';')+';';}else{_0x342cb1[_0x1cb9('0x48')][_0x1cb9('0x5b')]=null;}}else{_0x342cb1[_0x1cb9('0x48')]['tags']=null;}if(_0x342cb1[_0x1cb9('0x48')]&&_['isArray'](_0x342cb1[_0x1cb9('0x48')])){for(var _0xb5eac1=0x0;_0xb5eac1<_0x342cb1['body'][_0x1cb9('0x37')];_0xb5eac1+=0x1){_0x342cb1[_0x1cb9('0x48')][_0xb5eac1][_0x1cb9('0x53')]=_0x342cb1[_0x1cb9('0x45')]['id'];_0x2a157d['push'](_0x342cb1[_0x1cb9('0x48')][_0xb5eac1]);}return BPromise[_0x1cb9('0x5e')](_0x2a157d,function(_0x429371){return db['CmContact'][_0x1cb9('0x47')](_[_0x1cb9('0x5f')](_0x429371,[_0x1cb9('0x60'),'id'])||{},{'fields':_[_0x1cb9('0x31')](_0x248946),'raw':!![]})[_0x1cb9('0x24')](function(_0x1ea329){_0x27cc3c[_0x1cb9('0x61')]['push'](_0x1ea329[_0x1cb9('0x62')]);})['catch'](function(_0x27f1d2){_0x27cc3c[_0x1cb9('0x63')][_0x1cb9('0x64')]({'data':_0x429371,'error':_0x27f1d2[_0x1cb9('0x65')]});});})['then'](function(_0x1ff5e9){return _0x27cc3c;})[_0x1cb9('0x50')](function(_0x5e68a1){return _0x5e68a1;});}else{_0x5b5419[_0x1cb9('0x1b')](0x190)[_0x1cb9('0x1d')]({'message':_0x1cb9('0x66')});}});}})[_0x1cb9('0x24')](respondWithResult(_0x5b5419,null))[_0x1cb9('0x50')](handleError(_0x5b5419,null));};exports['getContacts']=function(_0x5e0e56,_0x544d2d,_0x5ad853){var _0x19daa1;return db[_0x1cb9('0x2c')][_0x1cb9('0x46')]({'where':{'id':_0x5e0e56[_0x1cb9('0x45')]['id']},'include':[{'model':db[_0x1cb9('0x67')],'as':_0x1cb9('0x68')}]})[_0x1cb9('0x24')](handleEntityNotFound(_0x544d2d,null))[_0x1cb9('0x24')](function(_0x4e969a){if(_0x4e969a){_0x19daa1=_0x4e969a;return db[_0x1cb9('0x5a')][_0x1cb9('0x2d')];}})[_0x1cb9('0x24')](function(_0x5eff1e){if(_0x5eff1e){var _0x10977f={};var _0xc6b64c={};_0xc6b64c['model']=_[_0x1cb9('0x69')](_[_0x1cb9('0x31')](_0x5eff1e),_[_0x1cb9('0x2b')](_0x19daa1[_0x1cb9('0x68')],function(_0x5cb5e5){return util[_0x1cb9('0x6a')](_0x1cb9('0x6b'),_0x5cb5e5['id']);}));_0xc6b64c['query']=_['keys'](_0x5e0e56[_0x1cb9('0x30')]);_0xc6b64c[_0x1cb9('0x32')]=_['intersection'](_0xc6b64c['model'],_0xc6b64c[_0x1cb9('0x30')]);_0x10977f[_0x1cb9('0x35')]=_['intersection'](_0xc6b64c['model'],qs[_0x1cb9('0x36')](_0x5e0e56['query']['fields']));_0x10977f['attributes']=_0x10977f[_0x1cb9('0x35')]['length']?_0x10977f[_0x1cb9('0x35')]:_0xc6b64c[_0x1cb9('0x34')];if(!_0x5e0e56[_0x1cb9('0x30')]['hasOwnProperty'](_0x1cb9('0x39'))){_0x10977f[_0x1cb9('0x20')]=qs[_0x1cb9('0x20')](_0x5e0e56['query'][_0x1cb9('0x20')]);_0x10977f[_0x1cb9('0x1f')]=qs[_0x1cb9('0x1f')](_0x5e0e56[_0x1cb9('0x30')][_0x1cb9('0x1f')]);}_0x10977f['order']=qs[_0x1cb9('0x56')](_0x5e0e56[_0x1cb9('0x30')][_0x1cb9('0x56')]);_0x10977f['where']=qs[_0x1cb9('0x32')](_[_0x1cb9('0x3c')](_0x5e0e56[_0x1cb9('0x30')],_0xc6b64c[_0x1cb9('0x32')]));_0x10977f[_0x1cb9('0x6c')]=!![];if(_0x5e0e56['query'][_0x1cb9('0x3d')]){_0x10977f[_0x1cb9('0x3b')]=_[_0x1cb9('0x3e')](_0x10977f[_0x1cb9('0x3b')],{'$or':_[_0x1cb9('0x2b')](_0x10977f[_0x1cb9('0x35')],function(_0x37affa){var _0x36864c={};_0x36864c[_0x37affa]={'$like':'%'+_0x5e0e56[_0x1cb9('0x30')][_0x1cb9('0x3d')]+'%'};return _0x36864c;})});}_0x10977f=_[_0x1cb9('0x3e')]({},_0x10977f,_0x5e0e56[_0x1cb9('0x41')]);return _0x19daa1[_0x1cb9('0x6d')](_0x10977f);}})[_0x1cb9('0x24')](respondWithResult(_0x544d2d,null))[_0x1cb9('0x50')](handleError(_0x544d2d,null));};exports[_0x1cb9('0x6e')]=function(_0x37b290,_0xf25415,_0x48e879){var _0x508a75;return db[_0x1cb9('0x2c')][_0x1cb9('0x46')]({'where':{'id':_0x37b290[_0x1cb9('0x45')]['id']},'include':[{'model':db[_0x1cb9('0x67')],'as':_0x1cb9('0x68')}]})[_0x1cb9('0x24')](handleEntityNotFound(_0xf25415,null))[_0x1cb9('0x24')](function(_0x56251d){if(_0x56251d){_0x508a75=_0x56251d;return db['CmContact'][_0x1cb9('0x2d')];}})[_0x1cb9('0x24')](function(_0x29b478){if(_0x29b478){var _0x11a46b={};var _0xed8968={};_0xed8968['model']=_[_0x1cb9('0x69')](_[_0x1cb9('0x31')](_0x29b478),_[_0x1cb9('0x2b')](_0x508a75['CustomFields'],function(_0x36faa4){return util[_0x1cb9('0x6a')](_0x1cb9('0x6b'),_0x36faa4['id']);}));_0xed8968['query']=_[_0x1cb9('0x31')](_0x37b290[_0x1cb9('0x30')]);_0xed8968[_0x1cb9('0x32')]=_['intersection'](_0xed8968['model'],_0xed8968['query']);_0x11a46b[_0x1cb9('0x35')]=_[_0x1cb9('0x33')](_0xed8968[_0x1cb9('0x34')],qs['fields'](_0x37b290[_0x1cb9('0x30')]['fields']));_0x11a46b['attributes']=_0x11a46b[_0x1cb9('0x35')][_0x1cb9('0x37')]?_0x11a46b[_0x1cb9('0x35')]:_0xed8968[_0x1cb9('0x34')];if(!_0x37b290[_0x1cb9('0x30')][_0x1cb9('0x38')](_0x1cb9('0x39'))){_0x11a46b[_0x1cb9('0x20')]=qs[_0x1cb9('0x20')](_0x37b290[_0x1cb9('0x30')]['limit']);_0x11a46b['offset']=qs[_0x1cb9('0x1f')](_0x37b290[_0x1cb9('0x30')]['offset']);}_0x11a46b['order']=qs['sort'](_0x37b290['query'][_0x1cb9('0x56')]);_0x11a46b[_0x1cb9('0x3b')]=qs['filters'](_[_0x1cb9('0x3c')](_0x37b290[_0x1cb9('0x30')],_0xed8968[_0x1cb9('0x32')]));_0x11a46b[_0x1cb9('0x6c')]=!![];if(_0x37b290[_0x1cb9('0x30')]['filter']){_0x11a46b[_0x1cb9('0x3b')]=_[_0x1cb9('0x3e')](_0x11a46b[_0x1cb9('0x3b')],{'$or':_[_0x1cb9('0x2b')](_0x11a46b['attributes'],function(_0x19f3db){var _0x3d82b0={};_0x3d82b0[_0x19f3db]={'$like':'%'+_0x37b290['query']['filter']+'%'};return _0x3d82b0;})});}_0x11a46b=_['merge']({},_0x11a46b,_0x37b290[_0x1cb9('0x41')]);return _0x508a75['getContacts'](_0x11a46b);}})[_0x1cb9('0x24')](function(_0x3506d7){if(!_[_0x1cb9('0x6f')](_0x3506d7)){var _0xf3c554=toCsv(_0x3506d7);var _0x31d1e5=Date[_0x1cb9('0x70')]();fs['writeFileSync'](util[_0x1cb9('0x6a')](_0x1cb9('0x71'),_0x508a75['id'],_0x31d1e5),_0xf3c554);_0xf25415[_0x1cb9('0x72')](_0x1cb9('0x73'),_0x1cb9('0x74')+util[_0x1cb9('0x6a')](_0x1cb9('0x75'),_0x508a75['id'],_0x31d1e5));_0xf25415[_0x1cb9('0x72')](_0x1cb9('0x76'),_0x1cb9('0x77'));return _0xf25415[_0x1cb9('0x78')](util[_0x1cb9('0x6a')](_0x1cb9('0x71'),_0x508a75['id'],_0x31d1e5));}else{return _0xf25415[_0x1cb9('0x1a')](0xcc);}})[_0x1cb9('0x50')](handleError(_0xf25415,null));};exports['addCustomField']=function(_0x592c04,_0x5aae4c,_0x9b1c60){var _0x35792e;delete _0x592c04['body']['id'];return db[_0x1cb9('0x2c')][_0x1cb9('0x79')]({'where':{'id':_0x592c04[_0x1cb9('0x45')]['id']}})['then'](handleEntityNotFound(_0x5aae4c,null))[_0x1cb9('0x24')](function(_0x3f817e){if(_0x3f817e){return db[_0x1cb9('0x7a')][_0x1cb9('0x7b')](function(_0x45b2e4){return db['CmCustomField'][_0x1cb9('0x47')](_0x592c04['body'],{'transaction':_0x45b2e4})['then'](function(_0x191988){_0x35792e=_0x191988;return _0x3f817e[_0x1cb9('0x7c')](_0x191988,{'transaction':_0x45b2e4});})[_0x1cb9('0x24')](function(){var _0x2e9d88={'type':db[_0x1cb9('0x7d')][_0x1cb9('0x7e')],'transaction':_0x45b2e4};switch(_0x592c04[_0x1cb9('0x48')][_0x1cb9('0x3f')]){case'text':_0x2e9d88[_0x1cb9('0x3f')]=db[_0x1cb9('0x7d')][_0x1cb9('0x7e')];break;case _0x1cb9('0x7f'):_0x2e9d88[_0x1cb9('0x3f')]=db['Sequelize'][_0x1cb9('0x80')];break;case _0x1cb9('0x81'):_0x2e9d88[_0x1cb9('0x3f')]=db[_0x1cb9('0x7d')][_0x1cb9('0x82')];_0x2e9d88['defaultValue']=![];break;default:}return db[_0x1cb9('0x7a')][_0x1cb9('0x83')][_0x1cb9('0x84')]('cm_contacts',util[_0x1cb9('0x6a')](_0x1cb9('0x85'),_0x35792e['id']),_0x2e9d88);})[_0x1cb9('0x24')](function(){return _0x35792e;});});}})[_0x1cb9('0x24')](respondWithResult(_0x5aae4c,null))[_0x1cb9('0x50')](handleError(_0x5aae4c,null));};exports[_0x1cb9('0x86')]=function(_0x4e3ad0,_0x45dc8c,_0x7118bb){var _0x17fdd1={};var _0x5d230a={};var _0x142f08;var _0x2485b9;return db['CmList']['findOne']({'where':{'id':_0x4e3ad0[_0x1cb9('0x45')]['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x45dc8c,null))[_0x1cb9('0x24')](function(_0x208ce1){if(_0x208ce1){_0x142f08=_0x208ce1;_0x5d230a[_0x1cb9('0x34')]=_['keys'](db[_0x1cb9('0x67')][_0x1cb9('0x2d')]);_0x5d230a[_0x1cb9('0x30')]=_[_0x1cb9('0x31')](_0x4e3ad0[_0x1cb9('0x30')]);_0x5d230a['filters']=_['intersection'](_0x5d230a[_0x1cb9('0x34')],_0x5d230a[_0x1cb9('0x30')]);_0x17fdd1[_0x1cb9('0x35')]=_['intersection'](_0x5d230a['model'],qs[_0x1cb9('0x36')](_0x4e3ad0[_0x1cb9('0x30')][_0x1cb9('0x36')]));_0x17fdd1['attributes']=_0x17fdd1['attributes']['length']?_0x17fdd1[_0x1cb9('0x35')]:_0x5d230a[_0x1cb9('0x34')];_0x17fdd1[_0x1cb9('0x3a')]=qs['sort'](_0x4e3ad0[_0x1cb9('0x30')]['sort']);_0x17fdd1[_0x1cb9('0x3b')]=qs[_0x1cb9('0x32')](_[_0x1cb9('0x3c')](_0x4e3ad0[_0x1cb9('0x30')],_0x5d230a[_0x1cb9('0x32')]));_0x17fdd1['where']=_[_0x1cb9('0x3e')](_0x17fdd1['where'],{'$or':[{'ListId':_0x208ce1['id']},{'ListId':null}]});if(_0x4e3ad0[_0x1cb9('0x30')][_0x1cb9('0x3d')]){_0x17fdd1[_0x1cb9('0x3b')]=_[_0x1cb9('0x3e')](_0x17fdd1[_0x1cb9('0x3b')],{'$or':_['map'](_0x17fdd1[_0x1cb9('0x35')],function(_0x174147){var _0xb4ea43={};_0xb4ea43[_0x174147]={'$like':'%'+_0x4e3ad0[_0x1cb9('0x30')][_0x1cb9('0x3d')]+'%'};return _0xb4ea43;})});}_0x17fdd1=_[_0x1cb9('0x3e')]({},_0x17fdd1,_0x4e3ad0[_0x1cb9('0x41')]);return db['CmCustomField']['findAndCountAll'](_0x17fdd1);}})[_0x1cb9('0x24')](respondWithResult(_0x45dc8c,null))[_0x1cb9('0x50')](handleError(_0x45dc8c,null));};exports[_0x1cb9('0x87')]=function(_0x1cdff0,_0x106fe7,_0x54b0d0){return db[_0x1cb9('0x2c')][_0x1cb9('0x46')]({'where':{'id':_0x1cdff0['params']['id']}})['then'](handleEntityNotFound(_0x106fe7,null))[_0x1cb9('0x24')](function(_0x48c8e7){if(_0x48c8e7){return _0x48c8e7[_0x1cb9('0x87')](_0x1cdff0['body'][_0x1cb9('0x60')],_[_0x1cb9('0x5f')](_0x1cdff0[_0x1cb9('0x48')],[_0x1cb9('0x60'),'id'])||{})[_0x1cb9('0x88')](function(_0x345e13){for(var _0x2c7326=0x0;_0x2c7326<_0x1cdff0[_0x1cb9('0x48')][_0x1cb9('0x60')][_0x1cb9('0x37')];_0x2c7326+=0x1){socket[_0x1cb9('0x89')](_0x1cb9('0x8a'),{'UserId':_0x1cdff0['body']['ids'][_0x2c7326],'CmListId':_0x1cdff0['params']['id']});}return _0x345e13;});}})['then'](respondWithResult(_0x106fe7,null))[_0x1cb9('0x50')](handleError(_0x106fe7,null));};exports[_0x1cb9('0x8b')]=function(_0x550877,_0x5b2b21,_0x4e46c1){return db[_0x1cb9('0x2c')][_0x1cb9('0x46')]({'where':{'id':_0x550877[_0x1cb9('0x45')]['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x5b2b21,null))['then'](function(_0x178cba){if(_0x178cba){return _0x178cba[_0x1cb9('0x8b')](_0x550877[_0x1cb9('0x30')]['ids'])[_0x1cb9('0x24')](function(){if(_[_0x1cb9('0x5c')](_0x550877['query'][_0x1cb9('0x60')])){for(var _0x57c3c4=0x0;_0x57c3c4<_0x550877[_0x1cb9('0x30')][_0x1cb9('0x60')][_0x1cb9('0x37')];_0x57c3c4+=0x1){socket[_0x1cb9('0x89')](_0x1cb9('0x8c'),{'UserId':Number(_0x550877[_0x1cb9('0x30')][_0x1cb9('0x60')][_0x57c3c4]),'CmListId':Number(_0x550877['params']['id'])});}}else{socket[_0x1cb9('0x89')](_0x1cb9('0x8c'),{'UserId':Number(_0x550877[_0x1cb9('0x30')][_0x1cb9('0x60')]),'CmListId':Number(_0x550877[_0x1cb9('0x45')]['id'])});}});}})[_0x1cb9('0x24')](respondWithStatusCode(_0x5b2b21,null))[_0x1cb9('0x50')](handleError(_0x5b2b21,null));};exports[_0x1cb9('0x8d')]=function(_0x181146,_0x394a89,_0x4a050d){var _0x183dbf={};var _0x32f255={};var _0x32be25;var _0x3e9fca;return db[_0x1cb9('0x2c')]['findOne']({'where':{'id':_0x181146[_0x1cb9('0x45')]['id']}})['then'](handleEntityNotFound(_0x394a89,null))['then'](function(_0x44f38a){if(_0x44f38a){_0x32be25=_0x44f38a;_0x32f255[_0x1cb9('0x34')]=_[_0x1cb9('0x31')](db[_0x1cb9('0x8e')][_0x1cb9('0x2d')]);_0x32f255[_0x1cb9('0x30')]=_[_0x1cb9('0x31')](_0x181146[_0x1cb9('0x30')]);_0x32f255[_0x1cb9('0x32')]=_['intersection'](_0x32f255['model'],_0x32f255[_0x1cb9('0x30')]);_0x183dbf[_0x1cb9('0x35')]=_[_0x1cb9('0x33')](_0x32f255[_0x1cb9('0x34')],qs[_0x1cb9('0x36')](_0x181146[_0x1cb9('0x30')][_0x1cb9('0x36')]));_0x183dbf[_0x1cb9('0x35')]=_0x183dbf[_0x1cb9('0x35')][_0x1cb9('0x37')]?_0x183dbf['attributes']:_0x32f255[_0x1cb9('0x34')];_0x183dbf[_0x1cb9('0x3a')]=qs[_0x1cb9('0x56')](_0x181146[_0x1cb9('0x30')][_0x1cb9('0x56')]);_0x183dbf[_0x1cb9('0x3b')]=qs['filters'](_[_0x1cb9('0x3c')](_0x181146[_0x1cb9('0x30')],_0x32f255[_0x1cb9('0x32')]));if(_0x181146[_0x1cb9('0x30')][_0x1cb9('0x3d')]){_0x183dbf[_0x1cb9('0x3b')]=_[_0x1cb9('0x3e')](_0x183dbf['where'],{'$or':_[_0x1cb9('0x2b')](_0x183dbf[_0x1cb9('0x35')],function(_0x276900){var _0x45c0e6={};_0x45c0e6[_0x276900]={'$like':'%'+_0x181146[_0x1cb9('0x30')][_0x1cb9('0x3d')]+'%'};return _0x45c0e6;})});}_0x183dbf=_[_0x1cb9('0x3e')]({},_0x183dbf,_0x181146[_0x1cb9('0x41')]);return _0x32be25[_0x1cb9('0x8d')](_0x183dbf);}})[_0x1cb9('0x24')](function(_0x27390a){if(_0x27390a){_0x3e9fca=_0x27390a[_0x1cb9('0x37')];if(!_0x181146[_0x1cb9('0x30')][_0x1cb9('0x38')](_0x1cb9('0x39'))){_0x183dbf[_0x1cb9('0x20')]=qs[_0x1cb9('0x20')](_0x181146[_0x1cb9('0x30')][_0x1cb9('0x20')]);_0x183dbf[_0x1cb9('0x1f')]=qs[_0x1cb9('0x1f')](_0x181146[_0x1cb9('0x30')]['offset']);}return _0x32be25[_0x1cb9('0x8d')](_0x183dbf);}})[_0x1cb9('0x24')](function(_0x16ec06){if(_0x16ec06){return _0x16ec06?{'count':_0x3e9fca,'rows':_0x16ec06}:null;}})[_0x1cb9('0x24')](respondWithResult(_0x394a89,null))[_0x1cb9('0x50')](handleError(_0x394a89,null));}; \ No newline at end of file +var _0x9c44=['fields','attributes','length','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','params','keys','includeAll','find','catch','create','user','role','UserProfileSection','userProfileId','autoAssociation','update','body','describe','ListId','getDispositions','findOne','order','Disposition','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each','omit','success','dataValues','errors','getContacts','CmCustomField','CustomFields','concat','raw','getContactsCsv','cf_%d','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','sequelize','transaction','Sequelize','type','text','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','getCustomFields','findAndCountAll','addAgents','spread','userCmList:save','emit','userCmList:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','redis','localhost','./cmList.socket','register','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','get','Lists','UserProfileResource','destroy','then','end','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','key','model','query','filters','intersection'];(function(_0xd7096e,_0x2bcebb){var _0x8ed2=function(_0x54968c){while(--_0x54968c){_0xd7096e['push'](_0xd7096e['shift']());}};_0x8ed2(++_0x2bcebb);}(_0x9c44,0x178));var _0x49c4=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x9c44[_0x13b02f];return _0x12e9a6;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x49c4('0x0'));var zipdir=require(_0x49c4('0x1'));var jsonpatch=require(_0x49c4('0x2'));var rp=require(_0x49c4('0x3'));var moment=require(_0x49c4('0x4'));var BPromise=require(_0x49c4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x49c4('0x6'));var sox=require('sox');var csv=require(_0x49c4('0x7'));var ejs=require(_0x49c4('0x8'));var fs=require('fs');var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0x7'));var querystring=require(_0x49c4('0xd'));var Papa=require(_0x49c4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0xf'));var as=require(_0x49c4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x11'))(_0x49c4('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x49c4('0x13'))['db'];config[_0x49c4('0x14')]=_['defaults'](config[_0x49c4('0x14')],{'host':_0x49c4('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x49c4('0x14')]));require(_0x49c4('0x16'))[_0x49c4('0x17')](socket);function respondWithStatusCode(_0x2decee,_0x12777c){_0x12777c=_0x12777c||0xcc;return function(_0x18211c){if(_0x18211c){return _0x2decee[_0x49c4('0x18')](_0x12777c);}return _0x2decee[_0x49c4('0x19')](_0x12777c)['end']();};}function respondWithResult(_0x3acd06,_0x141003){_0x141003=_0x141003||0xc8;return function(_0x13a2db){if(_0x13a2db){return _0x3acd06[_0x49c4('0x19')](_0x141003)[_0x49c4('0x1a')](_0x13a2db);}};}function respondWithFilteredResult(_0x53e3a2,_0x44e607){return function(_0x2891f4){if(_0x2891f4){var _0x4c3253=_0x2891f4[_0x49c4('0x1b')],_0x512650=_0x44e607['offset'],_0x3c782d=_0x44e607[_0x49c4('0x1c')]+_0x44e607['limit'],_0x2f82d5;if(_0x3c782d>=_0x4c3253){_0x3c782d=_0x4c3253;_0x2f82d5=0xc8;}else{_0x2f82d5=0xce;}_0x53e3a2[_0x49c4('0x19')](_0x2f82d5);return _0x53e3a2[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x512650+'-'+_0x3c782d+'/'+_0x4c3253)[_0x49c4('0x1a')](_0x2891f4);}return null;};}function patchUpdates(_0x382040){return function(_0x41078c){try{jsonpatch[_0x49c4('0x1f')](_0x41078c,_0x382040,!![]);}catch(_0x46e475){return BPromise[_0x49c4('0x20')](_0x46e475);}return _0x41078c['save']();};}function saveUpdates(_0x527126,_0x57f502){return function(_0x1c99b1){if(_0x1c99b1){return _0x1c99b1['update'](_0x527126)['then'](function(_0x2263ae){return _0x2263ae;});}return null;};}function removeEntity(_0x15581b,_0x26c640){return function(_0xd335e4){if(_0xd335e4){return _0xd335e4['destroy']()['then'](function(){var _0x180276=_0xd335e4[_0x49c4('0x21')]({'plain':!![]});var _0x565423=_0x49c4('0x22');return db[_0x49c4('0x23')][_0x49c4('0x24')]({'where':{'type':_0x565423,'resourceId':_0x180276['id']}})[_0x49c4('0x25')](function(){return _0xd335e4;});})['then'](function(){_0x15581b['status'](0xcc)[_0x49c4('0x26')]();});}};}function handleEntityNotFound(_0x53c199,_0x3800b7){return function(_0x3852b2){if(!_0x3852b2){_0x53c199[_0x49c4('0x18')](0x194);}return _0x3852b2;};}function handleError(_0x372a47,_0x5987ae){_0x5987ae=_0x5987ae||0x1f4;return function(_0x889909){logger[_0x49c4('0x27')](_0x889909[_0x49c4('0x28')]);if(_0x889909[_0x49c4('0x29')]){delete _0x889909[_0x49c4('0x29')];}_0x372a47[_0x49c4('0x19')](_0x5987ae)[_0x49c4('0x2a')](_0x889909);};}exports[_0x49c4('0x2b')]=function(_0x17b50f,_0x2cbd88){var _0x46f7ea={},_0x4ea6ea={},_0x4f4495={'count':0x0,'rows':[]};var _0x59eb84=_[_0x49c4('0x2c')](db[_0x49c4('0x2d')][_0x49c4('0x2e')],function(_0x27e467){return{'name':_0x27e467[_0x49c4('0x2f')],'type':_0x27e467['type'][_0x49c4('0x30')]};});_0x4ea6ea[_0x49c4('0x31')]=_[_0x49c4('0x2c')](_0x59eb84,_0x49c4('0x29'));_0x4ea6ea['query']=_['keys'](_0x17b50f[_0x49c4('0x32')]);_0x4ea6ea[_0x49c4('0x33')]=_[_0x49c4('0x34')](_0x4ea6ea[_0x49c4('0x31')],_0x4ea6ea[_0x49c4('0x32')]);_0x46f7ea['attributes']=_[_0x49c4('0x34')](_0x4ea6ea[_0x49c4('0x31')],qs[_0x49c4('0x35')](_0x17b50f['query']['fields']));_0x46f7ea[_0x49c4('0x36')]=_0x46f7ea[_0x49c4('0x36')][_0x49c4('0x37')]?_0x46f7ea[_0x49c4('0x36')]:_0x4ea6ea[_0x49c4('0x31')];if(!_0x17b50f[_0x49c4('0x32')][_0x49c4('0x38')](_0x49c4('0x39'))){_0x46f7ea[_0x49c4('0x3a')]=qs['limit'](_0x17b50f[_0x49c4('0x32')]['limit']);_0x46f7ea[_0x49c4('0x1c')]=qs[_0x49c4('0x1c')](_0x17b50f[_0x49c4('0x32')][_0x49c4('0x1c')]);}_0x46f7ea['order']=qs[_0x49c4('0x3b')](_0x17b50f[_0x49c4('0x32')][_0x49c4('0x3b')]);_0x46f7ea['where']=qs[_0x49c4('0x33')](_[_0x49c4('0x3c')](_0x17b50f[_0x49c4('0x32')],_0x4ea6ea[_0x49c4('0x33')]));if(_0x17b50f[_0x49c4('0x32')][_0x49c4('0x3d')]){_0x46f7ea[_0x49c4('0x3e')]=_[_0x49c4('0x3f')](_0x46f7ea[_0x49c4('0x3e')],{'$or':_[_0x49c4('0x2c')](_0x59eb84,function(_0x1e506a){if(_0x1e506a['type']!==_0x49c4('0x40')){var _0x20cd21={};_0x20cd21[_0x1e506a[_0x49c4('0x29')]]={'$like':'%'+_0x17b50f[_0x49c4('0x32')][_0x49c4('0x3d')]+'%'};return _0x20cd21;}})});}_0x46f7ea=_[_0x49c4('0x3f')]({},_0x46f7ea,_0x17b50f[_0x49c4('0x41')]);var _0xc9722b={'where':_0x46f7ea[_0x49c4('0x3e')]};return db[_0x49c4('0x2d')][_0x49c4('0x1b')](_0xc9722b)[_0x49c4('0x25')](function(_0x326142){_0x4f4495['count']=_0x326142;if(_0x17b50f[_0x49c4('0x32')]['includeAll']){_0x46f7ea[_0x49c4('0x42')]=[{'all':!![]}];}return db[_0x49c4('0x2d')][_0x49c4('0x43')](_0x46f7ea);})[_0x49c4('0x25')](function(_0x239327){_0x4f4495[_0x49c4('0x44')]=_0x239327;return _0x4f4495;})['then'](respondWithFilteredResult(_0x2cbd88,_0x46f7ea))['catch'](handleError(_0x2cbd88,null));};exports[_0x49c4('0x45')]=function(_0x1e7bdc,_0x38349b){var _0x117151={'raw':![],'where':{'id':_0x1e7bdc[_0x49c4('0x46')]['id']}},_0x490823={};_0x490823[_0x49c4('0x31')]=_[_0x49c4('0x47')](db[_0x49c4('0x2d')][_0x49c4('0x2e')]);_0x490823[_0x49c4('0x32')]=_[_0x49c4('0x47')](_0x1e7bdc[_0x49c4('0x32')]);_0x490823[_0x49c4('0x33')]=_['intersection'](_0x490823[_0x49c4('0x31')],_0x490823['query']);_0x117151[_0x49c4('0x36')]=_[_0x49c4('0x34')](_0x490823[_0x49c4('0x31')],qs[_0x49c4('0x35')](_0x1e7bdc[_0x49c4('0x32')]['fields']));_0x117151[_0x49c4('0x36')]=_0x117151[_0x49c4('0x36')][_0x49c4('0x37')]?_0x117151[_0x49c4('0x36')]:_0x490823[_0x49c4('0x31')];if(_0x1e7bdc[_0x49c4('0x32')][_0x49c4('0x48')]){_0x117151['include']=[{'all':!![]}];}_0x117151=_[_0x49c4('0x3f')]({},_0x117151,_0x1e7bdc['options']);return db[_0x49c4('0x2d')][_0x49c4('0x49')](_0x117151)[_0x49c4('0x25')](handleEntityNotFound(_0x38349b,null))[_0x49c4('0x25')](respondWithResult(_0x38349b,null))[_0x49c4('0x4a')](handleError(_0x38349b,null));};exports[_0x49c4('0x4b')]=function(_0x2c6be1,_0x506c71){return db[_0x49c4('0x2d')][_0x49c4('0x4b')](_0x2c6be1['body'],{})[_0x49c4('0x25')](function(_0xaece5f){var _0xfbe179=_0x2c6be1[_0x49c4('0x4c')]['get']({'plain':!![]});if(!_0xfbe179)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfbe179[_0x49c4('0x4d')]==='user'){var _0x4597c3=_0xaece5f[_0x49c4('0x21')]({'plain':!![]});var _0x3811b2=_0x49c4('0x22');return db[_0x49c4('0x4e')][_0x49c4('0x49')]({'where':{'name':_0x3811b2,'userProfileId':_0xfbe179[_0x49c4('0x4f')]},'raw':!![]})['then'](function(_0x1f26c2){if(_0x1f26c2&&_0x1f26c2[_0x49c4('0x50')]===0x0){return db[_0x49c4('0x23')][_0x49c4('0x4b')]({'name':_0x4597c3[_0x49c4('0x29')],'resourceId':_0x4597c3['id'],'type':_0x1f26c2[_0x49c4('0x29')],'sectionId':_0x1f26c2['id']},{})[_0x49c4('0x25')](function(){return _0xaece5f;});}else{return _0xaece5f;}})[_0x49c4('0x4a')](function(_0x1e0b4f){logger[_0x49c4('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e0b4f);throw _0x1e0b4f;});}return _0xaece5f;})['then'](respondWithResult(_0x506c71,0xc9))[_0x49c4('0x4a')](handleError(_0x506c71,null));};exports[_0x49c4('0x51')]=function(_0x527e74,_0x59a8bc){if(_0x527e74[_0x49c4('0x52')]['id']){delete _0x527e74['body']['id'];}return db['CmList'][_0x49c4('0x49')]({'where':{'id':_0x527e74[_0x49c4('0x46')]['id']}})[_0x49c4('0x25')](handleEntityNotFound(_0x59a8bc,null))[_0x49c4('0x25')](saveUpdates(_0x527e74[_0x49c4('0x52')],null))[_0x49c4('0x25')](respondWithResult(_0x59a8bc,null))[_0x49c4('0x4a')](handleError(_0x59a8bc,null));};exports['destroy']=function(_0x859dde,_0xcc6a2b){return db[_0x49c4('0x2d')][_0x49c4('0x49')]({'where':{'id':_0x859dde[_0x49c4('0x46')]['id']}})[_0x49c4('0x25')](handleEntityNotFound(_0xcc6a2b,null))['then'](removeEntity(_0xcc6a2b,null))['catch'](handleError(_0xcc6a2b,null));};exports[_0x49c4('0x53')]=function(_0x155c43,_0x2a6308){return db[_0x49c4('0x2d')][_0x49c4('0x53')]()[_0x49c4('0x25')](respondWithResult(_0x2a6308,null))[_0x49c4('0x4a')](handleError(_0x2a6308,null));};exports['addDisposition']=function(_0x45d715,_0x33c9a6,_0x4ba4eb){if(_0x45d715[_0x49c4('0x52')]['id']){delete _0x45d715['body']['id'];}return db[_0x49c4('0x2d')][_0x49c4('0x49')]({'where':{'id':_0x45d715[_0x49c4('0x46')]['id']}})[_0x49c4('0x25')](handleEntityNotFound(_0x33c9a6,null))[_0x49c4('0x25')](function(_0x3e44d7){if(_0x3e44d7){_0x45d715[_0x49c4('0x52')][_0x49c4('0x54')]=_0x3e44d7['id'];return db['Disposition'][_0x49c4('0x4b')](_0x45d715[_0x49c4('0x52')]);}})['then'](respondWithResult(_0x33c9a6,null))[_0x49c4('0x4a')](handleError(_0x33c9a6,null));};exports[_0x49c4('0x55')]=function(_0x4fefbd,_0x39c455,_0x42e0e6){var _0x4f50bf={'raw':![],'where':{}};var _0x4dc54d={};var _0x589484={'count':0x0,'rows':[]};return db['CmList'][_0x49c4('0x56')]({'where':{'id':_0x4fefbd['params']['id']}})[_0x49c4('0x25')](handleEntityNotFound(_0x39c455,null))[_0x49c4('0x25')](function(_0x515240){if(_0x515240){_0x4dc54d[_0x49c4('0x31')]=_[_0x49c4('0x47')](db['Disposition'][_0x49c4('0x2e')]);_0x4dc54d[_0x49c4('0x32')]=_[_0x49c4('0x47')](_0x4fefbd[_0x49c4('0x32')]);_0x4dc54d['filters']=_[_0x49c4('0x34')](_0x4dc54d[_0x49c4('0x31')],_0x4dc54d[_0x49c4('0x32')]);_0x4f50bf[_0x49c4('0x36')]=_['intersection'](_0x4dc54d[_0x49c4('0x31')],qs['fields'](_0x4fefbd['query']['fields']));_0x4f50bf['attributes']=_0x4f50bf[_0x49c4('0x36')][_0x49c4('0x37')]?_0x4f50bf[_0x49c4('0x36')]:_0x4dc54d[_0x49c4('0x31')];if(!_0x4fefbd['query']['hasOwnProperty'](_0x49c4('0x39'))){_0x4f50bf[_0x49c4('0x3a')]=qs[_0x49c4('0x3a')](_0x4fefbd[_0x49c4('0x32')][_0x49c4('0x3a')]);_0x4f50bf[_0x49c4('0x1c')]=qs[_0x49c4('0x1c')](_0x4fefbd[_0x49c4('0x32')]['offset']);}_0x4f50bf[_0x49c4('0x57')]=qs['sort'](_0x4fefbd[_0x49c4('0x32')][_0x49c4('0x3b')]);_0x4f50bf[_0x49c4('0x3e')]=qs[_0x49c4('0x33')](_[_0x49c4('0x3c')](_0x4fefbd[_0x49c4('0x32')],_0x4dc54d[_0x49c4('0x33')]));_0x4f50bf[_0x49c4('0x3e')][_0x49c4('0x54')]=_0x515240['id'];if(_0x4fefbd[_0x49c4('0x32')][_0x49c4('0x3d')]){_0x4f50bf[_0x49c4('0x3e')]=_[_0x49c4('0x3f')](_0x4f50bf[_0x49c4('0x3e')],{'$or':_[_0x49c4('0x2c')](_0x4f50bf[_0x49c4('0x36')],function(_0x371e49){var _0x3485c0={};_0x3485c0[_0x371e49]={'$like':'%'+_0x4fefbd['query']['filter']+'%'};return _0x3485c0;})});}_0x4f50bf=_[_0x49c4('0x3f')]({},_0x4f50bf,_0x4fefbd[_0x49c4('0x41')]);return db['Disposition'][_0x49c4('0x1b')]({'where':_0x4f50bf[_0x49c4('0x3e')]})[_0x49c4('0x25')](function(_0x16e7b1){_0x589484['count']=_0x16e7b1;if(_0x4fefbd['query']['includeAll']){_0x4f50bf[_0x49c4('0x42')]=[{'all':!![]}];}return db[_0x49c4('0x58')][_0x49c4('0x43')](_0x4f50bf);})[_0x49c4('0x25')](function(_0x118fc4){_0x589484[_0x49c4('0x44')]=_0x118fc4;return _0x589484;});}})[_0x49c4('0x25')](respondWithFilteredResult(_0x39c455,_0x4f50bf))[_0x49c4('0x4a')](handleError(_0x39c455,null));};exports[_0x49c4('0x59')]=function(_0x54dea5,_0x363b2e,_0x10fb84){return db[_0x49c4('0x2d')]['find']({'where':{'id':_0x54dea5[_0x49c4('0x46')]['id']}})[_0x49c4('0x25')](handleEntityNotFound(_0x363b2e,null))[_0x49c4('0x25')](function(_0xb6031b){if(_0xb6031b){return _0xb6031b[_0x49c4('0x59')](_0x54dea5[_0x49c4('0x32')][_0x49c4('0x5a')]);}})[_0x49c4('0x25')](respondWithStatusCode(_0x363b2e,null))['catch'](handleError(_0x363b2e,null));};exports[_0x49c4('0x5b')]=function(_0x20e2d5,_0x85540f,_0x18e82b){return db[_0x49c4('0x2d')]['find']({'where':{'id':_0x20e2d5['params']['id']}})[_0x49c4('0x25')](handleEntityNotFound(_0x85540f,null))['then'](function(_0x34cf49){if(_0x34cf49){var _0x558880=[];var _0x23516e={'success':[],'errors':[]};return db[_0x49c4('0x5c')][_0x49c4('0x53')]()[_0x49c4('0x25')](function(_0x4eb9f7){if(_0x20e2d5[_0x49c4('0x52')][_0x49c4('0x5d')]&&_[_0x49c4('0x5e')](_0x20e2d5[_0x49c4('0x52')][_0x49c4('0x5d')])){if(_0x20e2d5[_0x49c4('0x52')][_0x49c4('0x5d')][_0x49c4('0x37')]){_0x20e2d5[_0x49c4('0x52')][_0x49c4('0x5d')]=_0x20e2d5['body'][_0x49c4('0x5d')][_0x49c4('0x5f')](';')+';';}else{_0x20e2d5['body'][_0x49c4('0x5d')]=null;}}else{_0x20e2d5['body'][_0x49c4('0x5d')]=null;}if(_0x20e2d5[_0x49c4('0x52')]&&_[_0x49c4('0x5e')](_0x20e2d5[_0x49c4('0x52')])){for(var _0x2c32c0=0x0;_0x2c32c0<_0x20e2d5['body'][_0x49c4('0x37')];_0x2c32c0+=0x1){_0x20e2d5[_0x49c4('0x52')][_0x2c32c0]['ListId']=_0x20e2d5[_0x49c4('0x46')]['id'];_0x558880[_0x49c4('0x60')](_0x20e2d5['body'][_0x2c32c0]);}return BPromise[_0x49c4('0x61')](_0x558880,function(_0x2cb416){return db['CmContact'][_0x49c4('0x4b')](_[_0x49c4('0x62')](_0x2cb416,[_0x49c4('0x5a'),'id'])||{},{'fields':_[_0x49c4('0x47')](_0x4eb9f7),'raw':!![]})['then'](function(_0x999ae2){_0x23516e[_0x49c4('0x63')]['push'](_0x999ae2[_0x49c4('0x64')]);})['catch'](function(_0x4a4cb7){_0x23516e[_0x49c4('0x65')]['push']({'data':_0x2cb416,'error':_0x4a4cb7['message']});});})[_0x49c4('0x25')](function(_0x131064){return _0x23516e;})['catch'](function(_0x23e684){return _0x23e684;});}else{_0x85540f['status'](0x190)['json']({'message':'Malformed\x20request\x20syntax'});}});}})[_0x49c4('0x25')](respondWithResult(_0x85540f,null))[_0x49c4('0x4a')](handleError(_0x85540f,null));};exports[_0x49c4('0x66')]=function(_0x2bfe15,_0x4a5f0b,_0x5b751a){var _0x348693;return db['CmList'][_0x49c4('0x49')]({'where':{'id':_0x2bfe15['params']['id']},'include':[{'model':db[_0x49c4('0x67')],'as':_0x49c4('0x68')}]})[_0x49c4('0x25')](handleEntityNotFound(_0x4a5f0b,null))[_0x49c4('0x25')](function(_0x12d060){if(_0x12d060){_0x348693=_0x12d060;return db[_0x49c4('0x5c')][_0x49c4('0x2e')];}})['then'](function(_0xbde4b2){if(_0xbde4b2){var _0x1518cb={};var _0x44a188={};_0x44a188[_0x49c4('0x31')]=_[_0x49c4('0x69')](_['keys'](_0xbde4b2),_[_0x49c4('0x2c')](_0x348693[_0x49c4('0x68')],function(_0x3f5a6e){return util['format']('cf_%d',_0x3f5a6e['id']);}));_0x44a188[_0x49c4('0x32')]=_[_0x49c4('0x47')](_0x2bfe15[_0x49c4('0x32')]);_0x44a188[_0x49c4('0x33')]=_[_0x49c4('0x34')](_0x44a188['model'],_0x44a188[_0x49c4('0x32')]);_0x1518cb[_0x49c4('0x36')]=_[_0x49c4('0x34')](_0x44a188[_0x49c4('0x31')],qs['fields'](_0x2bfe15['query'][_0x49c4('0x35')]));_0x1518cb[_0x49c4('0x36')]=_0x1518cb[_0x49c4('0x36')][_0x49c4('0x37')]?_0x1518cb[_0x49c4('0x36')]:_0x44a188['model'];if(!_0x2bfe15[_0x49c4('0x32')][_0x49c4('0x38')](_0x49c4('0x39'))){_0x1518cb[_0x49c4('0x3a')]=qs[_0x49c4('0x3a')](_0x2bfe15[_0x49c4('0x32')]['limit']);_0x1518cb[_0x49c4('0x1c')]=qs[_0x49c4('0x1c')](_0x2bfe15[_0x49c4('0x32')][_0x49c4('0x1c')]);}_0x1518cb['order']=qs['sort'](_0x2bfe15[_0x49c4('0x32')]['sort']);_0x1518cb[_0x49c4('0x3e')]=qs['filters'](_[_0x49c4('0x3c')](_0x2bfe15[_0x49c4('0x32')],_0x44a188[_0x49c4('0x33')]));_0x1518cb[_0x49c4('0x6a')]=!![];if(_0x2bfe15['query']['filter']){_0x1518cb[_0x49c4('0x3e')]=_[_0x49c4('0x3f')](_0x1518cb[_0x49c4('0x3e')],{'$or':_['map'](_0x1518cb['attributes'],function(_0x3e7ab3){var _0x4ce733={};_0x4ce733[_0x3e7ab3]={'$like':'%'+_0x2bfe15['query'][_0x49c4('0x3d')]+'%'};return _0x4ce733;})});}_0x1518cb=_['merge']({},_0x1518cb,_0x2bfe15[_0x49c4('0x41')]);return _0x348693[_0x49c4('0x66')](_0x1518cb);}})['then'](respondWithResult(_0x4a5f0b,null))[_0x49c4('0x4a')](handleError(_0x4a5f0b,null));};exports[_0x49c4('0x6b')]=function(_0x49f060,_0x5428a9,_0xdb9820){var _0x493b9a;return db[_0x49c4('0x2d')][_0x49c4('0x49')]({'where':{'id':_0x49f060[_0x49c4('0x46')]['id']},'include':[{'model':db[_0x49c4('0x67')],'as':_0x49c4('0x68')}]})[_0x49c4('0x25')](handleEntityNotFound(_0x5428a9,null))[_0x49c4('0x25')](function(_0x5f07fa){if(_0x5f07fa){_0x493b9a=_0x5f07fa;return db[_0x49c4('0x5c')][_0x49c4('0x2e')];}})[_0x49c4('0x25')](function(_0xcc42bf){if(_0xcc42bf){var _0x3107c9={};var _0x5795e8={};_0x5795e8[_0x49c4('0x31')]=_['concat'](_[_0x49c4('0x47')](_0xcc42bf),_[_0x49c4('0x2c')](_0x493b9a[_0x49c4('0x68')],function(_0x3d662c){return util['format'](_0x49c4('0x6c'),_0x3d662c['id']);}));_0x5795e8[_0x49c4('0x32')]=_[_0x49c4('0x47')](_0x49f060[_0x49c4('0x32')]);_0x5795e8[_0x49c4('0x33')]=_[_0x49c4('0x34')](_0x5795e8['model'],_0x5795e8[_0x49c4('0x32')]);_0x3107c9['attributes']=_[_0x49c4('0x34')](_0x5795e8[_0x49c4('0x31')],qs[_0x49c4('0x35')](_0x49f060[_0x49c4('0x32')]['fields']));_0x3107c9[_0x49c4('0x36')]=_0x3107c9[_0x49c4('0x36')]['length']?_0x3107c9[_0x49c4('0x36')]:_0x5795e8[_0x49c4('0x31')];if(!_0x49f060['query']['hasOwnProperty'](_0x49c4('0x39'))){_0x3107c9[_0x49c4('0x3a')]=qs[_0x49c4('0x3a')](_0x49f060[_0x49c4('0x32')][_0x49c4('0x3a')]);_0x3107c9[_0x49c4('0x1c')]=qs[_0x49c4('0x1c')](_0x49f060[_0x49c4('0x32')][_0x49c4('0x1c')]);}_0x3107c9[_0x49c4('0x57')]=qs[_0x49c4('0x3b')](_0x49f060['query']['sort']);_0x3107c9[_0x49c4('0x3e')]=qs[_0x49c4('0x33')](_[_0x49c4('0x3c')](_0x49f060['query'],_0x5795e8[_0x49c4('0x33')]));_0x3107c9[_0x49c4('0x6a')]=!![];if(_0x49f060['query'][_0x49c4('0x3d')]){_0x3107c9['where']=_[_0x49c4('0x3f')](_0x3107c9[_0x49c4('0x3e')],{'$or':_[_0x49c4('0x2c')](_0x3107c9[_0x49c4('0x36')],function(_0x572433){var _0x2456a0={};_0x2456a0[_0x572433]={'$like':'%'+_0x49f060[_0x49c4('0x32')][_0x49c4('0x3d')]+'%'};return _0x2456a0;})});}_0x3107c9=_[_0x49c4('0x3f')]({},_0x3107c9,_0x49f060[_0x49c4('0x41')]);return _0x493b9a['getContacts'](_0x3107c9);}})['then'](function(_0x5f4d82){if(!_[_0x49c4('0x6d')](_0x5f4d82)){var _0x10655c=toCsv(_0x5f4d82);var _0x228bbb=Date[_0x49c4('0x6e')]();fs[_0x49c4('0x6f')](util['format'](_0x49c4('0x70'),_0x493b9a['id'],_0x228bbb),_0x10655c);_0x5428a9[_0x49c4('0x71')](_0x49c4('0x72'),_0x49c4('0x73')+util['format'](_0x49c4('0x74'),_0x493b9a['id'],_0x228bbb));_0x5428a9[_0x49c4('0x71')](_0x49c4('0x75'),_0x49c4('0x76'));return _0x5428a9[_0x49c4('0x77')](util['format'](_0x49c4('0x70'),_0x493b9a['id'],_0x228bbb));}else{return _0x5428a9[_0x49c4('0x18')](0xcc);}})[_0x49c4('0x4a')](handleError(_0x5428a9,null));};exports['addCustomField']=function(_0x182d2f,_0x11f47f,_0xa1954a){var _0x56341f;delete _0x182d2f[_0x49c4('0x52')]['id'];return db['CmList']['findOne']({'where':{'id':_0x182d2f[_0x49c4('0x46')]['id']}})[_0x49c4('0x25')](handleEntityNotFound(_0x11f47f,null))['then'](function(_0x815b34){if(_0x815b34){return db[_0x49c4('0x78')][_0x49c4('0x79')](function(_0x1ffc9a){return db[_0x49c4('0x67')][_0x49c4('0x4b')](_0x182d2f[_0x49c4('0x52')],{'transaction':_0x1ffc9a})[_0x49c4('0x25')](function(_0x59dbef){_0x56341f=_0x59dbef;return _0x815b34['addCustomFields'](_0x59dbef,{'transaction':_0x1ffc9a});})[_0x49c4('0x25')](function(){var _0x4c85ab={'type':db[_0x49c4('0x7a')]['TEXT'],'transaction':_0x1ffc9a};switch(_0x182d2f['body'][_0x49c4('0x7b')]){case _0x49c4('0x7c'):_0x4c85ab[_0x49c4('0x7b')]=db[_0x49c4('0x7a')][_0x49c4('0x7d')];break;case _0x49c4('0x7e'):_0x4c85ab[_0x49c4('0x7b')]=db[_0x49c4('0x7a')][_0x49c4('0x7f')];break;case _0x49c4('0x80'):_0x4c85ab[_0x49c4('0x7b')]=db[_0x49c4('0x7a')][_0x49c4('0x81')];_0x4c85ab[_0x49c4('0x82')]=![];break;default:}return db['sequelize'][_0x49c4('0x83')][_0x49c4('0x84')](_0x49c4('0x85'),util[_0x49c4('0x86')]('cf_%s',_0x56341f['id']),_0x4c85ab);})['then'](function(){return _0x56341f;});});}})[_0x49c4('0x25')](respondWithResult(_0x11f47f,null))['catch'](handleError(_0x11f47f,null));};exports[_0x49c4('0x87')]=function(_0x1ac087,_0xd6dc2a,_0xfc5a8f){var _0x2bcc8c={};var _0x45a2ef={};var _0x3238e7;var _0xe9e187;return db[_0x49c4('0x2d')][_0x49c4('0x56')]({'where':{'id':_0x1ac087[_0x49c4('0x46')]['id']}})[_0x49c4('0x25')](handleEntityNotFound(_0xd6dc2a,null))['then'](function(_0x22fdb9){if(_0x22fdb9){_0x3238e7=_0x22fdb9;_0x45a2ef[_0x49c4('0x31')]=_[_0x49c4('0x47')](db['CmCustomField'][_0x49c4('0x2e')]);_0x45a2ef['query']=_[_0x49c4('0x47')](_0x1ac087[_0x49c4('0x32')]);_0x45a2ef[_0x49c4('0x33')]=_[_0x49c4('0x34')](_0x45a2ef['model'],_0x45a2ef[_0x49c4('0x32')]);_0x2bcc8c['attributes']=_['intersection'](_0x45a2ef[_0x49c4('0x31')],qs[_0x49c4('0x35')](_0x1ac087[_0x49c4('0x32')]['fields']));_0x2bcc8c['attributes']=_0x2bcc8c[_0x49c4('0x36')][_0x49c4('0x37')]?_0x2bcc8c[_0x49c4('0x36')]:_0x45a2ef[_0x49c4('0x31')];_0x2bcc8c[_0x49c4('0x57')]=qs[_0x49c4('0x3b')](_0x1ac087[_0x49c4('0x32')][_0x49c4('0x3b')]);_0x2bcc8c[_0x49c4('0x3e')]=qs['filters'](_[_0x49c4('0x3c')](_0x1ac087[_0x49c4('0x32')],_0x45a2ef['filters']));_0x2bcc8c['where']=_[_0x49c4('0x3f')](_0x2bcc8c['where'],{'$or':[{'ListId':_0x22fdb9['id']},{'ListId':null}]});if(_0x1ac087[_0x49c4('0x32')]['filter']){_0x2bcc8c[_0x49c4('0x3e')]=_['merge'](_0x2bcc8c[_0x49c4('0x3e')],{'$or':_[_0x49c4('0x2c')](_0x2bcc8c[_0x49c4('0x36')],function(_0x1ab574){var _0x5b1e3d={};_0x5b1e3d[_0x1ab574]={'$like':'%'+_0x1ac087['query'][_0x49c4('0x3d')]+'%'};return _0x5b1e3d;})});}_0x2bcc8c=_[_0x49c4('0x3f')]({},_0x2bcc8c,_0x1ac087[_0x49c4('0x41')]);return db['CmCustomField'][_0x49c4('0x88')](_0x2bcc8c);}})[_0x49c4('0x25')](respondWithResult(_0xd6dc2a,null))['catch'](handleError(_0xd6dc2a,null));};exports['addAgents']=function(_0x43ca05,_0x269170,_0xa0698d){return db['CmList'][_0x49c4('0x49')]({'where':{'id':_0x43ca05[_0x49c4('0x46')]['id']}})[_0x49c4('0x25')](handleEntityNotFound(_0x269170,null))[_0x49c4('0x25')](function(_0x5a0045){if(_0x5a0045){return _0x5a0045[_0x49c4('0x89')](_0x43ca05['body']['ids'],_[_0x49c4('0x62')](_0x43ca05[_0x49c4('0x52')],[_0x49c4('0x5a'),'id'])||{})[_0x49c4('0x8a')](function(_0x5adb90){for(var _0x32b6e4=0x0;_0x32b6e4<_0x43ca05[_0x49c4('0x52')][_0x49c4('0x5a')][_0x49c4('0x37')];_0x32b6e4+=0x1){socket['emit'](_0x49c4('0x8b'),{'UserId':_0x43ca05['body']['ids'][_0x32b6e4],'CmListId':_0x43ca05[_0x49c4('0x46')]['id']});}return _0x5adb90;});}})[_0x49c4('0x25')](respondWithResult(_0x269170,null))[_0x49c4('0x4a')](handleError(_0x269170,null));};exports['removeAgents']=function(_0x336853,_0x4a874a,_0x30b616){return db[_0x49c4('0x2d')][_0x49c4('0x49')]({'where':{'id':_0x336853[_0x49c4('0x46')]['id']}})[_0x49c4('0x25')](handleEntityNotFound(_0x4a874a,null))[_0x49c4('0x25')](function(_0x2b31ac){if(_0x2b31ac){return _0x2b31ac['removeAgents'](_0x336853[_0x49c4('0x32')][_0x49c4('0x5a')])[_0x49c4('0x25')](function(){if(_[_0x49c4('0x5e')](_0x336853['query']['ids'])){for(var _0x4c15ff=0x0;_0x4c15ff<_0x336853[_0x49c4('0x32')][_0x49c4('0x5a')][_0x49c4('0x37')];_0x4c15ff+=0x1){socket[_0x49c4('0x8c')](_0x49c4('0x8d'),{'UserId':Number(_0x336853[_0x49c4('0x32')][_0x49c4('0x5a')][_0x4c15ff]),'CmListId':Number(_0x336853['params']['id'])});}}else{socket[_0x49c4('0x8c')](_0x49c4('0x8d'),{'UserId':Number(_0x336853['query']['ids']),'CmListId':Number(_0x336853['params']['id'])});}});}})[_0x49c4('0x25')](respondWithStatusCode(_0x4a874a,null))[_0x49c4('0x4a')](handleError(_0x4a874a,null));};exports[_0x49c4('0x8e')]=function(_0x3d0013,_0x1069b9,_0x1480d3){var _0x2f36c6={};var _0x5039fc={};var _0x83440b;var _0x3226c4;return db[_0x49c4('0x2d')][_0x49c4('0x56')]({'where':{'id':_0x3d0013['params']['id']}})[_0x49c4('0x25')](handleEntityNotFound(_0x1069b9,null))[_0x49c4('0x25')](function(_0x227c94){if(_0x227c94){_0x83440b=_0x227c94;_0x5039fc[_0x49c4('0x31')]=_[_0x49c4('0x47')](db['User'][_0x49c4('0x2e')]);_0x5039fc['query']=_['keys'](_0x3d0013[_0x49c4('0x32')]);_0x5039fc[_0x49c4('0x33')]=_[_0x49c4('0x34')](_0x5039fc[_0x49c4('0x31')],_0x5039fc[_0x49c4('0x32')]);_0x2f36c6['attributes']=_[_0x49c4('0x34')](_0x5039fc[_0x49c4('0x31')],qs[_0x49c4('0x35')](_0x3d0013['query'][_0x49c4('0x35')]));_0x2f36c6[_0x49c4('0x36')]=_0x2f36c6['attributes'][_0x49c4('0x37')]?_0x2f36c6[_0x49c4('0x36')]:_0x5039fc[_0x49c4('0x31')];_0x2f36c6[_0x49c4('0x57')]=qs[_0x49c4('0x3b')](_0x3d0013[_0x49c4('0x32')][_0x49c4('0x3b')]);_0x2f36c6['where']=qs[_0x49c4('0x33')](_[_0x49c4('0x3c')](_0x3d0013[_0x49c4('0x32')],_0x5039fc[_0x49c4('0x33')]));if(_0x3d0013[_0x49c4('0x32')]['filter']){_0x2f36c6[_0x49c4('0x3e')]=_[_0x49c4('0x3f')](_0x2f36c6[_0x49c4('0x3e')],{'$or':_[_0x49c4('0x2c')](_0x2f36c6[_0x49c4('0x36')],function(_0x50423b){var _0x2582e3={};_0x2582e3[_0x50423b]={'$like':'%'+_0x3d0013[_0x49c4('0x32')][_0x49c4('0x3d')]+'%'};return _0x2582e3;})});}_0x2f36c6=_[_0x49c4('0x3f')]({},_0x2f36c6,_0x3d0013[_0x49c4('0x41')]);return _0x83440b[_0x49c4('0x8e')](_0x2f36c6);}})[_0x49c4('0x25')](function(_0x2a25dc){if(_0x2a25dc){_0x3226c4=_0x2a25dc[_0x49c4('0x37')];if(!_0x3d0013[_0x49c4('0x32')]['hasOwnProperty'](_0x49c4('0x39'))){_0x2f36c6[_0x49c4('0x3a')]=qs[_0x49c4('0x3a')](_0x3d0013[_0x49c4('0x32')][_0x49c4('0x3a')]);_0x2f36c6['offset']=qs['offset'](_0x3d0013[_0x49c4('0x32')][_0x49c4('0x1c')]);}return _0x83440b[_0x49c4('0x8e')](_0x2f36c6);}})[_0x49c4('0x25')](function(_0xd87f7e){if(_0xd87f7e){return _0xd87f7e?{'count':_0x3226c4,'rows':_0xd87f7e}:null;}})[_0x49c4('0x25')](respondWithResult(_0x1069b9,null))['catch'](handleError(_0x1069b9,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 0d89d13..88feefa 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 _0xd0dd=['events','../../mysqldb','CmList','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x212638,_0x2ac680){var _0xc91090=function(_0x10432c){while(--_0x10432c){_0x212638['push'](_0x212638['shift']());}};_0xc91090(++_0x2ac680);}(_0xd0dd,0x1f4));var _0xdd0d=function(_0x3b729a,_0x4558bc){_0x3b729a=_0x3b729a-0x0;var _0x370439=_0xd0dd[_0x3b729a];return _0x370439;};'use strict';var EventEmitter=require(_0xdd0d('0x0'));var CmList=require(_0xdd0d('0x1'))['db'][_0xdd0d('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xdd0d('0x3')](0x0);var events={'afterCreate':_0xdd0d('0x4'),'afterUpdate':_0xdd0d('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1a7ac6){return function(_0x121755,_0x202866,_0x4d6b58){CmListEvents[_0xdd0d('0x6')](_0x1a7ac6+':'+_0x121755['id'],_0x121755);CmListEvents[_0xdd0d('0x6')](_0x1a7ac6,_0x121755);_0x4d6b58(null);};}for(var e in events){if(events[_0xdd0d('0x7')](e)){var event=events[e];CmList[_0xdd0d('0x8')](e,emitEvent(event));}}module[_0xdd0d('0x9')]=CmListEvents; \ No newline at end of file +var _0x98db=['../../mysqldb','CmList','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x3f6460,_0x3bdb9b){var _0x5d9ac6=function(_0x1ebb5e){while(--_0x1ebb5e){_0x3f6460['push'](_0x3f6460['shift']());}};_0x5d9ac6(++_0x3bdb9b);}(_0x98db,0x149));var _0xb98d=function(_0xce9195,_0x1963e1){_0xce9195=_0xce9195-0x0;var _0x530fe6=_0x98db[_0xce9195];return _0x530fe6;};'use strict';var EventEmitter=require(_0xb98d('0x0'));var CmList=require(_0xb98d('0x1'))['db'][_0xb98d('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb98d('0x3')](0x0);var events={'afterCreate':_0xb98d('0x4'),'afterUpdate':'update','afterDestroy':_0xb98d('0x5')};function emitEvent(_0x45dd56){return function(_0x17ff0a,_0x1b0616,_0x2bfeb1){CmListEvents[_0xb98d('0x6')](_0x45dd56+':'+_0x17ff0a['id'],_0x17ff0a);CmListEvents[_0xb98d('0x6')](_0x45dd56,_0x17ff0a);_0x2bfeb1(null);};}for(var e in events){if(events[_0xb98d('0x7')](e)){var event=events[e];CmList[_0xb98d('0x8')](e,emitEvent(event));}}module[_0xb98d('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 7d4da1b..ef94997 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 _0x1c52=['exports','define','CmList','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./cmList.attributes'];(function(_0x5067c6,_0x3f1e9e){var _0xb5daa3=function(_0x45337e){while(--_0x45337e){_0x5067c6['push'](_0x5067c6['shift']());}};_0xb5daa3(++_0x3f1e9e);}(_0x1c52,0xe7));var _0x21c5=function(_0x458f8a,_0x284189){_0x458f8a=_0x458f8a-0x0;var _0x2db426=_0x1c52[_0x458f8a];return _0x2db426;};'use strict';var _=require(_0x21c5('0x0'));var util=require('util');var logger=require(_0x21c5('0x1'))(_0x21c5('0x2'));var moment=require(_0x21c5('0x3'));var BPromise=require(_0x21c5('0x4'));var rp=require(_0x21c5('0x5'));var fs=require('fs');var path=require(_0x21c5('0x6'));var rimraf=require('rimraf');var config=require(_0x21c5('0x7'));var attributes=require(_0x21c5('0x8'));module[_0x21c5('0x9')]=function(_0x2e9a32,_0x5c2519){return _0x2e9a32[_0x21c5('0xa')](_0x21c5('0xb'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2607=['cm_lists','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmList.attributes','CmList'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x2607,0xe5));var _0x7260=function(_0x1d1963,_0x32cc0e){_0x1d1963=_0x1d1963-0x0;var _0x3f58bb=_0x2607[_0x1d1963];return _0x3f58bb;};'use strict';var _=require(_0x7260('0x0'));var util=require(_0x7260('0x1'));var logger=require(_0x7260('0x2'))(_0x7260('0x3'));var moment=require(_0x7260('0x4'));var BPromise=require(_0x7260('0x5'));var rp=require(_0x7260('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7260('0x7'));var config=require(_0x7260('0x8'));var attributes=require(_0x7260('0x9'));module['exports']=function(_0x2460a8,_0x5a9a1c){return _0x2460a8['define'](_0x7260('0xa'),attributes,{'tableName':_0x7260('0xb'),'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 777bc79..446931e 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 _0x7619=['request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','register'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7619,0x1b5));var _0x9761=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7619[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9761('0x0'));var util=require(_0x9761('0x1'));var moment=require(_0x9761('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9761('0x3'));var db=require(_0x9761('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9761('0x5'))(_0x9761('0x6'));var config=require(_0x9761('0x7'));var jayson=require(_0x9761('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x9761('0x9')]=_['defaults'](config[_0x9761('0x9')],{'host':_0x9761('0xa'),'port':0x18eb});var socket=require(_0x9761('0xb'))(new Redis(config[_0x9761('0x9')]));require('./cmList.socket')[_0x9761('0xc')](socket);function respondWithRpcPromise(_0x3f7e85,_0x2e82e2,_0x2defa0){return new BPromise(function(_0xaa7de8,_0x501129){return client[_0x9761('0xd')](_0x3f7e85,_0x2defa0)[_0x9761('0xe')](function(_0x5d7441){logger[_0x9761('0xf')](_0x9761('0x10'),_0x2e82e2,_0x9761('0x11'));logger[_0x9761('0x12')](_0x9761('0x13'),_0x2e82e2,_0x9761('0x11'),JSON[_0x9761('0x14')](_0x5d7441));if(_0x5d7441[_0x9761('0x15')]){if(_0x5d7441[_0x9761('0x15')]['code']===0x1f4){logger[_0x9761('0x15')](_0x9761('0x10'),_0x2e82e2,_0x5d7441[_0x9761('0x15')][_0x9761('0x16')]);return _0x501129(_0x5d7441['error']['message']);}logger[_0x9761('0x15')](_0x9761('0x10'),_0x2e82e2,_0x5d7441[_0x9761('0x15')][_0x9761('0x16')]);return _0xaa7de8(_0x5d7441[_0x9761('0x15')][_0x9761('0x16')]);}else{logger[_0x9761('0xf')]('CmList,\x20%s,\x20%s',_0x2e82e2,_0x9761('0x11'));_0xaa7de8(_0x5d7441[_0x9761('0x17')][_0x9761('0x16')]);}})[_0x9761('0x18')](function(_0x347583){logger[_0x9761('0x15')]('CmList,\x20%s,\x20%s',_0x2e82e2,_0x347583);_0x501129(_0x347583);});});} \ No newline at end of file +var _0xd5d7=['lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','localhost','./cmList.socket','request','CmList,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd5d7,0x8c));var _0x7d5d=function(_0x4a2f7c,_0x3c9183){_0x4a2f7c=_0x4a2f7c-0x0;var _0x1e55a2=_0xd5d7[_0x4a2f7c];return _0x1e55a2;};'use strict';var _=require(_0x7d5d('0x0'));var util=require('util');var moment=require(_0x7d5d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7d5d('0x2'));var db=require(_0x7d5d('0x3'))['db'];var utils=require(_0x7d5d('0x4'));var logger=require(_0x7d5d('0x5'))('rpc');var config=require(_0x7d5d('0x6'));var jayson=require(_0x7d5d('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x7d5d('0x8')]=_['defaults'](config[_0x7d5d('0x8')],{'host':_0x7d5d('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7d5d('0x8')]));require(_0x7d5d('0xa'))['register'](socket);function respondWithRpcPromise(_0x3dd68d,_0x24e630,_0x409d62){return new BPromise(function(_0x400812,_0xde8acf){return client[_0x7d5d('0xb')](_0x3dd68d,_0x409d62)['then'](function(_0x469cb2){logger['info'](_0x7d5d('0xc'),_0x24e630,_0x7d5d('0xd'));logger[_0x7d5d('0xe')]('CmList,\x20%s,\x20%s,\x20%s',_0x24e630,'request\x20sent',JSON['stringify'](_0x469cb2));if(_0x469cb2[_0x7d5d('0xf')]){if(_0x469cb2[_0x7d5d('0xf')][_0x7d5d('0x10')]===0x1f4){logger[_0x7d5d('0xf')](_0x7d5d('0xc'),_0x24e630,_0x469cb2['error'][_0x7d5d('0x11')]);return _0xde8acf(_0x469cb2[_0x7d5d('0xf')][_0x7d5d('0x11')]);}logger[_0x7d5d('0xf')](_0x7d5d('0xc'),_0x24e630,_0x469cb2['error'][_0x7d5d('0x11')]);return _0x400812(_0x469cb2[_0x7d5d('0xf')][_0x7d5d('0x11')]);}else{logger[_0x7d5d('0x12')](_0x7d5d('0xc'),_0x24e630,_0x7d5d('0xd'));_0x400812(_0x469cb2[_0x7d5d('0x13')][_0x7d5d('0x11')]);}})['catch'](function(_0x59b773){logger[_0x7d5d('0xf')]('CmList,\x20%s,\x20%s',_0x24e630,_0x59b773);_0xde8acf(_0x59b773);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 2558a15..4fdf867 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 _0xf2e0=['save','update','emit','removeListener','register','length','cmList:','./cmList.events'];(function(_0x3a52de,_0x6a12b7){var _0x3844d4=function(_0x153ae4){while(--_0x153ae4){_0x3a52de['push'](_0x3a52de['shift']());}};_0x3844d4(++_0x6a12b7);}(_0xf2e0,0xc7));var _0x0f2e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xf2e0[_0x2f5ac5];return _0x37c9a8;};'use strict';var CmListEvents=require(_0x0f2e('0x0'));var events=[_0x0f2e('0x1'),'remove',_0x0f2e('0x2')];function createListener(_0x359e6e,_0x48b292){return function(_0x3261d6){_0x48b292[_0x0f2e('0x3')](_0x359e6e,_0x3261d6);};}function removeListener(_0x363be3,_0x4d60de){return function(){CmListEvents[_0x0f2e('0x4')](_0x363be3,_0x4d60de);};}exports[_0x0f2e('0x5')]=function(_0x256aba){for(var _0x47c448=0x0,_0x51a040=events[_0x0f2e('0x6')];_0x47c448<_0x51a040;_0x47c448++){var _0x53de0f=events[_0x47c448];var _0x1e28ed=createListener(_0x0f2e('0x7')+_0x53de0f,_0x256aba);CmListEvents['on'](_0x53de0f,_0x1e28ed);}}; \ No newline at end of file +var _0xed08=['remove','update','emit','removeListener','register','length','cmList:','save'];(function(_0x1ed034,_0x5d495d){var _0x4a82b7=function(_0x348231){while(--_0x348231){_0x1ed034['push'](_0x1ed034['shift']());}};_0x4a82b7(++_0x5d495d);}(_0xed08,0x67));var _0x8ed0=function(_0x5e553e,_0x44646f){_0x5e553e=_0x5e553e-0x0;var _0x16bd04=_0xed08[_0x5e553e];return _0x16bd04;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x8ed0('0x0'),_0x8ed0('0x1'),_0x8ed0('0x2')];function createListener(_0x13c458,_0xce1ff){return function(_0x1ff91e){_0xce1ff[_0x8ed0('0x3')](_0x13c458,_0x1ff91e);};}function removeListener(_0x33c3ad,_0x14901f){return function(){CmListEvents[_0x8ed0('0x4')](_0x33c3ad,_0x14901f);};}exports[_0x8ed0('0x5')]=function(_0x43ca60){for(var _0x5c1343=0x0,_0x15f266=events[_0x8ed0('0x6')];_0x5c1343<_0x15f266;_0x5c1343++){var _0x1c86e6=events[_0x5c1343];var _0x39642a=createListener(_0x8ed0('0x7')+_0x1c86e6,_0x43ca60);CmListEvents['on'](_0x1c86e6,_0x39642a);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 1867ce4..cde8003 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 _0xce59=['/:id','show','/:id/dispositions','getDispositions','getContacts','/:id/contacts/csv','getCustomFields','/:id/users','getAgents','create','addDisposition','post','/:id/contacts','/:id/fields','addAgents','put','update','delete','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','/describe','describe','get'];(function(_0x2e2d89,_0x4bb615){var _0x3aba90=function(_0x9daf58){while(--_0x9daf58){_0x2e2d89['push'](_0x2e2d89['shift']());}};_0x3aba90(++_0x4bb615);}(_0xce59,0x1f4));var _0x9ce5=function(_0x580d0e,_0x1e5f43){_0x580d0e=_0x580d0e-0x0;var _0xb51111=_0xce59[_0x580d0e];return _0xb51111;};'use strict';var multer=require(_0x9ce5('0x0'));var util=require(_0x9ce5('0x1'));var path=require(_0x9ce5('0x2'));var timeout=require(_0x9ce5('0x3'));var express=require(_0x9ce5('0x4'));var router=express['Router']();var auth=require(_0x9ce5('0x5'));var interaction=require(_0x9ce5('0x6'));var config=require('../../config/environment');var controller=require('./cmList.controller');router['get']('/',auth[_0x9ce5('0x7')](),controller[_0x9ce5('0x8')]);router['get'](_0x9ce5('0x9'),auth['isAuthenticated'](),controller[_0x9ce5('0xa')]);router[_0x9ce5('0xb')](_0x9ce5('0xc'),auth['isAuthenticated'](),controller[_0x9ce5('0xd')]);router[_0x9ce5('0xb')](_0x9ce5('0xe'),auth[_0x9ce5('0x7')](),controller[_0x9ce5('0xf')]);router[_0x9ce5('0xb')]('/:id/contacts',auth[_0x9ce5('0x7')](),controller[_0x9ce5('0x10')]);router[_0x9ce5('0xb')](_0x9ce5('0x11'),auth[_0x9ce5('0x7')](),controller['getContactsCsv']);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x9ce5('0x12')]);router[_0x9ce5('0xb')](_0x9ce5('0x13'),auth['isAuthenticated'](),controller[_0x9ce5('0x14')]);router['post']('/',auth[_0x9ce5('0x7')](),controller[_0x9ce5('0x15')]);router['post'](_0x9ce5('0xe'),auth[_0x9ce5('0x7')](),controller[_0x9ce5('0x16')]);router[_0x9ce5('0x17')](_0x9ce5('0x18'),auth[_0x9ce5('0x7')](),controller['addContacts']);router[_0x9ce5('0x17')](_0x9ce5('0x19'),auth[_0x9ce5('0x7')](),controller['addCustomField']);router['post'](_0x9ce5('0x13'),auth['isAuthenticated'](),controller[_0x9ce5('0x1a')]);router[_0x9ce5('0x1b')]('/:id',auth[_0x9ce5('0x7')](),controller[_0x9ce5('0x1c')]);router[_0x9ce5('0x1d')](_0x9ce5('0xc'),auth[_0x9ce5('0x7')](),controller['destroy']);router['delete'](_0x9ce5('0xe'),auth[_0x9ce5('0x7')](),controller['removeDispositions']);router[_0x9ce5('0x1d')](_0x9ce5('0x13'),auth[_0x9ce5('0x7')](),controller[_0x9ce5('0x1e')]);module[_0x9ce5('0x1f')]=router; \ No newline at end of file +var _0xa3fd=['show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addContacts','addCustomField','addAgents','update','delete','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmList.controller','isAuthenticated','index','get','/describe','/:id'];(function(_0x4635c5,_0x17ecc9){var _0x69e7c8=function(_0x24d98a){while(--_0x24d98a){_0x4635c5['push'](_0x4635c5['shift']());}};_0x69e7c8(++_0x17ecc9);}(_0xa3fd,0x102));var _0xda3f=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xa3fd[_0x164eca];return _0x2ce562;};'use strict';var multer=require(_0xda3f('0x0'));var util=require(_0xda3f('0x1'));var path=require(_0xda3f('0x2'));var timeout=require(_0xda3f('0x3'));var express=require(_0xda3f('0x4'));var router=express[_0xda3f('0x5')]();var auth=require(_0xda3f('0x6'));var interaction=require(_0xda3f('0x7'));var config=require('../../config/environment');var controller=require(_0xda3f('0x8'));router['get']('/',auth[_0xda3f('0x9')](),controller[_0xda3f('0xa')]);router[_0xda3f('0xb')](_0xda3f('0xc'),auth[_0xda3f('0x9')](),controller['describe']);router[_0xda3f('0xb')](_0xda3f('0xd'),auth[_0xda3f('0x9')](),controller[_0xda3f('0xe')]);router[_0xda3f('0xb')](_0xda3f('0xf'),auth['isAuthenticated'](),controller[_0xda3f('0x10')]);router[_0xda3f('0xb')](_0xda3f('0x11'),auth[_0xda3f('0x9')](),controller[_0xda3f('0x12')]);router['get'](_0xda3f('0x13'),auth[_0xda3f('0x9')](),controller['getContactsCsv']);router[_0xda3f('0xb')](_0xda3f('0x14'),auth[_0xda3f('0x9')](),controller[_0xda3f('0x15')]);router[_0xda3f('0xb')](_0xda3f('0x16'),auth[_0xda3f('0x9')](),controller[_0xda3f('0x17')]);router[_0xda3f('0x18')]('/',auth[_0xda3f('0x9')](),controller[_0xda3f('0x19')]);router[_0xda3f('0x18')]('/:id/dispositions',auth[_0xda3f('0x9')](),controller['addDisposition']);router[_0xda3f('0x18')](_0xda3f('0x11'),auth[_0xda3f('0x9')](),controller[_0xda3f('0x1a')]);router['post'](_0xda3f('0x14'),auth['isAuthenticated'](),controller[_0xda3f('0x1b')]);router['post'](_0xda3f('0x16'),auth[_0xda3f('0x9')](),controller[_0xda3f('0x1c')]);router['put'](_0xda3f('0xd'),auth[_0xda3f('0x9')](),controller[_0xda3f('0x1d')]);router[_0xda3f('0x1e')]('/:id',auth[_0xda3f('0x9')](),controller['destroy']);router[_0xda3f('0x1e')](_0xda3f('0xf'),auth[_0xda3f('0x9')](),controller[_0xda3f('0x1f')]);router[_0xda3f('0x1e')](_0xda3f('0x16'),auth[_0xda3f('0x9')](),controller[_0xda3f('0x20')]);module[_0xda3f('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 d72f12e..13e7e5e 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(_0x50e459,_0x11196e){var _0x2e4a07=function(_0x362b2f){while(--_0x362b2f){_0x50e459['push'](_0x50e459['shift']());}};_0x2e4a07(++_0x11196e);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'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(_0x3a60d7,_0x42a292){var _0x32d5ea=function(_0x3fcdd5){while(--_0x3fcdd5){_0x3a60d7['push'](_0x3a60d7['shift']());}};_0x32d5ea(++_0x42a292);}(_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')]={'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 5dd1365..ac53871 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 _0xbc6f=['apply','save','update','then','destroy','error','stack','name','send','body','Condition','find','params','catch','eml-format','zip-dir','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range'];(function(_0x123985,_0x489296){var _0x176258=function(_0x192b10){while(--_0x192b10){_0x123985['push'](_0x123985['shift']());}};_0x176258(++_0x489296);}(_0xbc6f,0x166));var _0xfbc6=function(_0x1c07c3,_0x41e664){_0x1c07c3=_0x1c07c3-0x0;var _0x3728b4=_0xbc6f[_0x1c07c3];return _0x3728b4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfbc6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfbc6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfbc6('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xfbc6('0x3'));var util=require(_0xfbc6('0x4'));var path=require(_0xfbc6('0x5'));var sox=require(_0xfbc6('0x6'));var csv=require(_0xfbc6('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfbc6('0x8'));var squel=require(_0xfbc6('0x9'));var crypto=require(_0xfbc6('0xa'));var jsforce=require(_0xfbc6('0xb'));var deskjs=require(_0xfbc6('0xc'));var toCsv=require(_0xfbc6('0x7'));var querystring=require(_0xfbc6('0xd'));var Papa=require('papaparse');var Redis=require(_0xfbc6('0xe'));var authService=require(_0xfbc6('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xfbc6('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfbc6('0x11'))(_0xfbc6('0x12'));var utils=require(_0xfbc6('0x13'));var config=require('../../config/environment');var db=require(_0xfbc6('0x14'))['db'];function respondWithStatusCode(_0x4aef87,_0x5ec97a){_0x5ec97a=_0x5ec97a||0xcc;return function(_0x40433b){if(_0x40433b){return _0x4aef87[_0xfbc6('0x15')](_0x5ec97a);}return _0x4aef87[_0xfbc6('0x16')](_0x5ec97a)[_0xfbc6('0x17')]();};}function respondWithResult(_0xc3fb53,_0x10ae22){_0x10ae22=_0x10ae22||0xc8;return function(_0x386cf1){if(_0x386cf1){return _0xc3fb53[_0xfbc6('0x16')](_0x10ae22)[_0xfbc6('0x18')](_0x386cf1);}};}function respondWithFilteredResult(_0x2e2bae,_0xbdc135){return function(_0x131764){if(_0x131764){var _0x25f1f1=_0x131764[_0xfbc6('0x19')],_0x1846e0=_0xbdc135[_0xfbc6('0x1a')],_0x409a90=_0xbdc135[_0xfbc6('0x1a')]+_0xbdc135[_0xfbc6('0x1b')],_0xa25066;if(_0x409a90>=_0x25f1f1){_0x409a90=_0x25f1f1;_0xa25066=0xc8;}else{_0xa25066=0xce;}_0x2e2bae[_0xfbc6('0x16')](_0xa25066);return _0x2e2bae['set'](_0xfbc6('0x1c'),_0x1846e0+'-'+_0x409a90+'/'+_0x25f1f1)[_0xfbc6('0x18')](_0x131764);}return null;};}function patchUpdates(_0xcebc61){return function(_0x5d9bfa){try{jsonpatch[_0xfbc6('0x1d')](_0x5d9bfa,_0xcebc61,!![]);}catch(_0x1e0650){return BPromise['reject'](_0x1e0650);}return _0x5d9bfa[_0xfbc6('0x1e')]();};}function saveUpdates(_0x539a1e,_0x1e0bb8){return function(_0x374c6f){if(_0x374c6f){return _0x374c6f[_0xfbc6('0x1f')](_0x539a1e)[_0xfbc6('0x20')](function(_0x48a7fe){return _0x48a7fe;});}return null;};}function removeEntity(_0x43ad2e,_0x3707f2){return function(_0x2671e5){if(_0x2671e5){return _0x2671e5[_0xfbc6('0x21')]()['then'](function(){_0x43ad2e[_0xfbc6('0x16')](0xcc)[_0xfbc6('0x17')]();});}};}function handleEntityNotFound(_0x4a0095,_0x3731b7){return function(_0x4faf24){if(!_0x4faf24){_0x4a0095[_0xfbc6('0x15')](0x194);}return _0x4faf24;};}function handleError(_0x372a59,_0x597c22){_0x597c22=_0x597c22||0x1f4;return function(_0xe8a076){logger[_0xfbc6('0x22')](_0xe8a076[_0xfbc6('0x23')]);if(_0xe8a076[_0xfbc6('0x24')]){delete _0xe8a076['name'];}_0x372a59[_0xfbc6('0x16')](_0x597c22)[_0xfbc6('0x25')](_0xe8a076);};}exports['update']=function(_0x121113,_0x3e2365){if(_0x121113[_0xfbc6('0x26')]['id']){delete _0x121113[_0xfbc6('0x26')]['id'];}return db[_0xfbc6('0x27')][_0xfbc6('0x28')]({'where':{'id':_0x121113['params']['id']}})['then'](handleEntityNotFound(_0x3e2365,null))[_0xfbc6('0x20')](saveUpdates(_0x121113[_0xfbc6('0x26')],null))[_0xfbc6('0x20')](respondWithResult(_0x3e2365,null))['catch'](handleError(_0x3e2365,null));};exports[_0xfbc6('0x21')]=function(_0x31c61d,_0x28b3c9){return db['Condition']['find']({'where':{'id':_0x31c61d[_0xfbc6('0x29')]['id']}})[_0xfbc6('0x20')](handleEntityNotFound(_0x28b3c9,null))[_0xfbc6('0x20')](removeEntity(_0x28b3c9,null))[_0xfbc6('0x2a')](handleError(_0x28b3c9,null));}; \ No newline at end of file +var _0xf431=['end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','body','find','params','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status'];(function(_0xc2af53,_0x2c5084){var _0x2d3661=function(_0x247eca){while(--_0x247eca){_0xc2af53['push'](_0xc2af53['shift']());}};_0x2d3661(++_0x2c5084);}(_0xf431,0x93));var _0x1f43=function(_0x3f25c4,_0x7d5eb5){_0x3f25c4=_0x3f25c4-0x0;var _0x2b213d=_0xf431[_0x3f25c4];return _0x2b213d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1f43('0x0'));var rimraf=require(_0x1f43('0x1'));var zipdir=require(_0x1f43('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1f43('0x3'));var moment=require(_0x1f43('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1f43('0x5'));var util=require(_0x1f43('0x6'));var path=require(_0x1f43('0x7'));var sox=require(_0x1f43('0x8'));var csv=require(_0x1f43('0x9'));var ejs=require(_0x1f43('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x1f43('0xb'));var jsforce=require(_0x1f43('0xc'));var deskjs=require(_0x1f43('0xd'));var toCsv=require(_0x1f43('0x9'));var querystring=require(_0x1f43('0xe'));var Papa=require('papaparse');var Redis=require(_0x1f43('0xf'));var authService=require(_0x1f43('0x10'));var qs=require(_0x1f43('0x11'));var as=require(_0x1f43('0x12'));var hardwareService=require(_0x1f43('0x13'));var logger=require(_0x1f43('0x14'))(_0x1f43('0x15'));var utils=require('../../config/utils');var config=require(_0x1f43('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cbde4,_0x2f9b0d){_0x2f9b0d=_0x2f9b0d||0xcc;return function(_0xa25bbc){if(_0xa25bbc){return _0x4cbde4[_0x1f43('0x17')](_0x2f9b0d);}return _0x4cbde4[_0x1f43('0x18')](_0x2f9b0d)[_0x1f43('0x19')]();};}function respondWithResult(_0x3802c4,_0x94948d){_0x94948d=_0x94948d||0xc8;return function(_0xe5e0c1){if(_0xe5e0c1){return _0x3802c4['status'](_0x94948d)[_0x1f43('0x1a')](_0xe5e0c1);}};}function respondWithFilteredResult(_0x2b8622,_0x297672){return function(_0x1127f6){if(_0x1127f6){var _0x23a6f0=_0x1127f6[_0x1f43('0x1b')],_0x9d7d9b=_0x297672[_0x1f43('0x1c')],_0x1f13f1=_0x297672[_0x1f43('0x1c')]+_0x297672[_0x1f43('0x1d')],_0x349545;if(_0x1f13f1>=_0x23a6f0){_0x1f13f1=_0x23a6f0;_0x349545=0xc8;}else{_0x349545=0xce;}_0x2b8622[_0x1f43('0x18')](_0x349545);return _0x2b8622[_0x1f43('0x1e')](_0x1f43('0x1f'),_0x9d7d9b+'-'+_0x1f13f1+'/'+_0x23a6f0)[_0x1f43('0x1a')](_0x1127f6);}return null;};}function patchUpdates(_0x752acd){return function(_0x472cb9){try{jsonpatch[_0x1f43('0x20')](_0x472cb9,_0x752acd,!![]);}catch(_0xe4db32){return BPromise[_0x1f43('0x21')](_0xe4db32);}return _0x472cb9['save']();};}function saveUpdates(_0x5984ad,_0x1eced8){return function(_0x3e63c7){if(_0x3e63c7){return _0x3e63c7[_0x1f43('0x22')](_0x5984ad)[_0x1f43('0x23')](function(_0x5d2f52){return _0x5d2f52;});}return null;};}function removeEntity(_0x48795c,_0x3c457a){return function(_0x11fb59){if(_0x11fb59){return _0x11fb59[_0x1f43('0x24')]()[_0x1f43('0x23')](function(){_0x48795c[_0x1f43('0x18')](0xcc)[_0x1f43('0x19')]();});}};}function handleEntityNotFound(_0x2385d3,_0x634c3a){return function(_0x4fdd4a){if(!_0x4fdd4a){_0x2385d3[_0x1f43('0x17')](0x194);}return _0x4fdd4a;};}function handleError(_0x5b7809,_0x554aa5){_0x554aa5=_0x554aa5||0x1f4;return function(_0x4efca7){logger['error'](_0x4efca7[_0x1f43('0x25')]);if(_0x4efca7[_0x1f43('0x26')]){delete _0x4efca7['name'];}_0x5b7809['status'](_0x554aa5)['send'](_0x4efca7);};}exports[_0x1f43('0x22')]=function(_0x50098f,_0x14f318){if(_0x50098f['body']['id']){delete _0x50098f[_0x1f43('0x27')]['id'];}return db['Condition'][_0x1f43('0x28')]({'where':{'id':_0x50098f[_0x1f43('0x29')]['id']}})[_0x1f43('0x23')](handleEntityNotFound(_0x14f318,null))[_0x1f43('0x23')](saveUpdates(_0x50098f['body'],null))[_0x1f43('0x23')](respondWithResult(_0x14f318,null))[_0x1f43('0x2a')](handleError(_0x14f318,null));};exports['destroy']=function(_0x46f1ca,_0x34655c){return db['Condition'][_0x1f43('0x28')]({'where':{'id':_0x46f1ca[_0x1f43('0x29')]['id']}})[_0x1f43('0x23')](handleEntityNotFound(_0x34655c,null))['then'](removeEntity(_0x34655c,null))[_0x1f43('0x2a')](handleError(_0x34655c,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index feef117..4924913 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 _0x5b37=['bluebird','request-promise','path','../../config/environment','exports','define','tools_conditions','lodash','util','../../config/logger','api'];(function(_0x212fcc,_0x1a8867){var _0x4d8190=function(_0x347f7b){while(--_0x347f7b){_0x212fcc['push'](_0x212fcc['shift']());}};_0x4d8190(++_0x1a8867);}(_0x5b37,0x151));var _0x75b3=function(_0x113cf9,_0x358825){_0x113cf9=_0x113cf9-0x0;var _0x5842ad=_0x5b37[_0x113cf9];return _0x5842ad;};'use strict';var _=require(_0x75b3('0x0'));var util=require(_0x75b3('0x1'));var logger=require(_0x75b3('0x2'))(_0x75b3('0x3'));var moment=require('moment');var BPromise=require(_0x75b3('0x4'));var rp=require(_0x75b3('0x5'));var fs=require('fs');var path=require(_0x75b3('0x6'));var rimraf=require('rimraf');var config=require(_0x75b3('0x7'));var attributes=require('./condition.attributes');module[_0x75b3('0x8')]=function(_0x487006,_0x549c81){return _0x487006[_0x75b3('0x9')]('Condition',attributes,{'tableName':_0x75b3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2461=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Condition','tools_conditions'];(function(_0x572491,_0x82993d){var _0x5f13fb=function(_0x451304){while(--_0x451304){_0x572491['push'](_0x572491['shift']());}};_0x5f13fb(++_0x82993d);}(_0x2461,0x1d4));var _0x1246=function(_0x2e6718,_0x557dee){_0x2e6718=_0x2e6718-0x0;var _0x4d23fe=_0x2461[_0x2e6718];return _0x4d23fe;};'use strict';var _=require(_0x1246('0x0'));var util=require(_0x1246('0x1'));var logger=require(_0x1246('0x2'))('api');var moment=require(_0x1246('0x3'));var BPromise=require(_0x1246('0x4'));var rp=require(_0x1246('0x5'));var fs=require('fs');var path=require(_0x1246('0x6'));var rimraf=require(_0x1246('0x7'));var config=require(_0x1246('0x8'));var attributes=require('./condition.attributes');module[_0x1246('0x9')]=function(_0x25db03,_0x4738ef){return _0x25db03[_0x1246('0xa')](_0x1246('0xb'),attributes,{'tableName':_0x1246('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 19a99e8..85228d6 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 _0x496b=['error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4052b5,_0x4a1a6a){var _0x4360da=function(_0x4bfb55){while(--_0x4bfb55){_0x4052b5['push'](_0x4052b5['shift']());}};_0x4360da(++_0x4a1a6a);}(_0x496b,0x147));var _0xb496=function(_0x47b15f,_0x103e93){_0x47b15f=_0x47b15f-0x0;var _0x55bf25=_0x496b[_0x47b15f];return _0x55bf25;};'use strict';var _=require(_0xb496('0x0'));var util=require(_0xb496('0x1'));var moment=require(_0xb496('0x2'));var BPromise=require('bluebird');var rs=require(_0xb496('0x3'));var fs=require('fs');var Redis=require(_0xb496('0x4'));var db=require(_0xb496('0x5'))['db'];var utils=require(_0xb496('0x6'));var logger=require('../../config/logger')(_0xb496('0x7'));var config=require(_0xb496('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb496('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4abe16,_0x48b501,_0x52c232){return new BPromise(function(_0x5b0a79,_0x63b379){return client[_0xb496('0xa')](_0x4abe16,_0x52c232)[_0xb496('0xb')](function(_0x8be6e5){logger[_0xb496('0xc')](_0xb496('0xd'),_0x48b501,_0xb496('0xe'));logger[_0xb496('0xf')](_0xb496('0x10'),_0x48b501,'request\x20sent',JSON[_0xb496('0x11')](_0x8be6e5));if(_0x8be6e5[_0xb496('0x12')]){if(_0x8be6e5[_0xb496('0x12')][_0xb496('0x13')]===0x1f4){logger[_0xb496('0x12')]('Condition,\x20%s,\x20%s',_0x48b501,_0x8be6e5['error'][_0xb496('0x14')]);return _0x63b379(_0x8be6e5[_0xb496('0x12')][_0xb496('0x14')]);}logger[_0xb496('0x12')](_0xb496('0xd'),_0x48b501,_0x8be6e5[_0xb496('0x12')][_0xb496('0x14')]);return _0x5b0a79(_0x8be6e5[_0xb496('0x12')][_0xb496('0x14')]);}else{logger[_0xb496('0xc')]('Condition,\x20%s,\x20%s',_0x48b501,_0xb496('0xe'));_0x5b0a79(_0x8be6e5[_0xb496('0x15')]['message']);}})[_0xb496('0x16')](function(_0x485883){logger[_0xb496('0x12')](_0xb496('0xd'),_0x48b501,_0x485883);_0x63b379(_0x485883);});});} \ No newline at end of file +var _0xe644=['Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','Condition,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xe644,0x1bc));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 moment=require('moment');var BPromise=require(_0x4e64('0x2'));var rs=require(_0x4e64('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4e64('0x4'));var logger=require(_0x4e64('0x5'))(_0x4e64('0x6'));var config=require(_0x4e64('0x7'));var jayson=require(_0x4e64('0x8'));var client=jayson[_0x4e64('0x9')][_0x4e64('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57458d,_0xb4bff4,_0xfc6a15){return new BPromise(function(_0x1ec6fd,_0x5004ca){return client[_0x4e64('0xb')](_0x57458d,_0xfc6a15)[_0x4e64('0xc')](function(_0x1078de){logger[_0x4e64('0xd')]('Condition,\x20%s,\x20%s',_0xb4bff4,_0x4e64('0xe'));logger[_0x4e64('0xf')](_0x4e64('0x10'),_0xb4bff4,_0x4e64('0xe'),JSON[_0x4e64('0x11')](_0x1078de));if(_0x1078de[_0x4e64('0x12')]){if(_0x1078de[_0x4e64('0x12')][_0x4e64('0x13')]===0x1f4){logger[_0x4e64('0x12')](_0x4e64('0x14'),_0xb4bff4,_0x1078de['error'][_0x4e64('0x15')]);return _0x5004ca(_0x1078de['error'][_0x4e64('0x15')]);}logger[_0x4e64('0x12')](_0x4e64('0x14'),_0xb4bff4,_0x1078de[_0x4e64('0x12')][_0x4e64('0x15')]);return _0x1ec6fd(_0x1078de['error'][_0x4e64('0x15')]);}else{logger[_0x4e64('0xd')](_0x4e64('0x14'),_0xb4bff4,_0x4e64('0xe'));_0x1ec6fd(_0x1078de['result']['message']);}})[_0x4e64('0x16')](function(_0x4e8ffa){logger[_0x4e64('0x12')](_0x4e64('0x14'),_0xb4bff4,_0x4e8ffa);_0x5004ca(_0x4e8ffa);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 055830f..712dac2 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 _0xd27b=['util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./condition.controller','put','isAuthenticated','update','destroy','exports'];(function(_0xaa11e4,_0x270698){var _0x2a1b22=function(_0x222713){while(--_0x222713){_0xaa11e4['push'](_0xaa11e4['shift']());}};_0x2a1b22(++_0x270698);}(_0xd27b,0x111));var _0xbd27=function(_0x36e8e4,_0x213a61){_0x36e8e4=_0x36e8e4-0x0;var _0x491ac7=_0xd27b[_0x36e8e4];return _0x491ac7;};'use strict';var multer=require('multer');var util=require(_0xbd27('0x0'));var path=require(_0xbd27('0x1'));var timeout=require(_0xbd27('0x2'));var express=require(_0xbd27('0x3'));var router=express[_0xbd27('0x4')]();var auth=require(_0xbd27('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbd27('0x6'));var controller=require(_0xbd27('0x7'));router[_0xbd27('0x8')]('/:id',auth[_0xbd27('0x9')](),controller[_0xbd27('0xa')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xbd27('0xb')]);module[_0xbd27('0xc')]=router; \ No newline at end of file +var _0x0432=['connect-timeout','express','Router','../../config/environment','put','/:id','isAuthenticated','update','delete','destroy','exports','multer','util','path'];(function(_0x4fbd1b,_0x27d578){var _0x447ae7=function(_0x4061e7){while(--_0x4061e7){_0x4fbd1b['push'](_0x4fbd1b['shift']());}};_0x447ae7(++_0x27d578);}(_0x0432,0x115));var _0x2043=function(_0xd891f2,_0x3da9d6){_0xd891f2=_0xd891f2-0x0;var _0x1cc04c=_0x0432[_0xd891f2];return _0x1cc04c;};'use strict';var multer=require(_0x2043('0x0'));var util=require(_0x2043('0x1'));var path=require(_0x2043('0x2'));var timeout=require(_0x2043('0x3'));var express=require(_0x2043('0x4'));var router=express[_0x2043('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2043('0x6'));var controller=require('./condition.controller');router[_0x2043('0x7')](_0x2043('0x8'),auth[_0x2043('0x9')](),controller[_0x2043('0xa')]);router[_0x2043('0xb')](_0x2043('0x8'),auth['isAuthenticated'](),controller[_0x2043('0xc')]);module[_0x2043('0xd')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 99d8526..25f3d62 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 _0x6dd4=['name','sequelize','exports','STRING'];(function(_0x510f02,_0x4b0f01){var _0x412d65=function(_0x258e43){while(--_0x258e43){_0x510f02['push'](_0x510f02['shift']());}};_0x412d65(++_0x4b0f01);}(_0x6dd4,0x129));var _0x46dd=function(_0x3ac054,_0x558393){_0x3ac054=_0x3ac054-0x0;var _0x472577=_0x6dd4[_0x3ac054];return _0x472577;};'use strict';var Sequelize=require(_0x46dd('0x0'));module[_0x46dd('0x1')]={'name':{'type':Sequelize[_0x46dd('0x2')],'allowNull':![],'unique':_0x46dd('0x3')},'description':{'type':Sequelize[_0x46dd('0x2')]}}; \ No newline at end of file +var _0x7118=['name','STRING'];(function(_0x4babf5,_0xb700ad){var _0x253c7d=function(_0x487774){while(--_0x487774){_0x4babf5['push'](_0x4babf5['shift']());}};_0x253c7d(++_0xb700ad);}(_0x7118,0x159));var _0x8711=function(_0x4f535b,_0x372a4a){_0x4f535b=_0x4f535b-0x0;var _0x248eb8=_0x7118[_0x4f535b];return _0x248eb8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8711('0x0')],'allowNull':![],'unique':_0x8711('0x1')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 54b0c5a..60d8c30 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 _0x22d5=['error','index','Dashboard','rawAttributes','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','findAll','rows','catch','show','params','include','options','find','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','includeAll','Unable\x20to\x20retrieve\x20the\x20current\x20user','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','findOne','getItems','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','sendStatus'];(function(_0x46b832,_0x454e18){var _0x42b328=function(_0x204e99){while(--_0x204e99){_0x46b832['push'](_0x46b832['shift']());}};_0x42b328(++_0x454e18);}(_0x22d5,0xc5));var _0x522d=function(_0x330a51,_0x42c33b){_0x330a51=_0x330a51-0x0;var _0x55aa63=_0x22d5[_0x330a51];return _0x55aa63;};'use strict';var pdf=require(_0x522d('0x0'));var emlformat=require(_0x522d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x522d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x522d('0x3'));var moment=require(_0x522d('0x4'));var BPromise=require(_0x522d('0x5'));var Mustache=require('mustache');var util=require(_0x522d('0x6'));var path=require('path');var sox=require(_0x522d('0x7'));var csv=require(_0x522d('0x8'));var ejs=require(_0x522d('0x9'));var fs=require('fs');var _=require(_0x522d('0xa'));var squel=require(_0x522d('0xb'));var crypto=require(_0x522d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x522d('0xd'));var toCsv=require(_0x522d('0x8'));var querystring=require(_0x522d('0xe'));var Papa=require(_0x522d('0xf'));var Redis=require('ioredis');var authService=require(_0x522d('0x10'));var qs=require(_0x522d('0x11'));var as=require(_0x522d('0x12'));var hardwareService=require(_0x522d('0x13'));var logger=require(_0x522d('0x14'))(_0x522d('0x15'));var utils=require(_0x522d('0x16'));var config=require(_0x522d('0x17'));var db=require(_0x522d('0x18'))['db'];config[_0x522d('0x19')]=_[_0x522d('0x1a')](config[_0x522d('0x19')],{'host':_0x522d('0x1b'),'port':0x18eb});var socket=require(_0x522d('0x1c'))(new Redis(config['redis']));require(_0x522d('0x1d'))[_0x522d('0x1e')](socket);function respondWithStatusCode(_0x32fdef,_0x29f6ef){_0x29f6ef=_0x29f6ef||0xcc;return function(_0x2a63d9){if(_0x2a63d9){return _0x32fdef['sendStatus'](_0x29f6ef);}return _0x32fdef[_0x522d('0x1f')](_0x29f6ef)[_0x522d('0x20')]();};}function respondWithResult(_0x5336ba,_0x488c79){_0x488c79=_0x488c79||0xc8;return function(_0x361d88){if(_0x361d88){return _0x5336ba[_0x522d('0x1f')](_0x488c79)['json'](_0x361d88);}};}function respondWithFilteredResult(_0x1ad35e,_0x128639){return function(_0x45512d){if(_0x45512d){var _0x3b009a=_0x45512d[_0x522d('0x21')],_0x3129f0=_0x128639[_0x522d('0x22')],_0x6be763=_0x128639[_0x522d('0x22')]+_0x128639[_0x522d('0x23')],_0x377b85;if(_0x6be763>=_0x3b009a){_0x6be763=_0x3b009a;_0x377b85=0xc8;}else{_0x377b85=0xce;}_0x1ad35e['status'](_0x377b85);return _0x1ad35e[_0x522d('0x24')](_0x522d('0x25'),_0x3129f0+'-'+_0x6be763+'/'+_0x3b009a)[_0x522d('0x26')](_0x45512d);}return null;};}function patchUpdates(_0x1143c2){return function(_0x1eb0df){try{jsonpatch[_0x522d('0x27')](_0x1eb0df,_0x1143c2,!![]);}catch(_0x11d14d){return BPromise[_0x522d('0x28')](_0x11d14d);}return _0x1eb0df[_0x522d('0x29')]();};}function saveUpdates(_0x390d1a,_0x5cfa19){return function(_0x386d61){if(_0x386d61){return _0x386d61[_0x522d('0x2a')](_0x390d1a)[_0x522d('0x2b')](function(_0x315913){return _0x315913;});}return null;};}function removeEntity(_0x33da63,_0x402487){return function(_0x41f724){if(_0x41f724){return _0x41f724[_0x522d('0x2c')]()[_0x522d('0x2b')](function(){var _0x30f06e=_0x41f724[_0x522d('0x2d')]({'plain':!![]});var _0x197d2d=_0x522d('0x2e');return db[_0x522d('0x2f')][_0x522d('0x2c')]({'where':{'type':_0x197d2d,'resourceId':_0x30f06e['id']}})[_0x522d('0x2b')](function(){return _0x41f724;});})[_0x522d('0x2b')](function(){_0x33da63[_0x522d('0x1f')](0xcc)[_0x522d('0x20')]();});}};}function handleEntityNotFound(_0x486472,_0x32fce9){return function(_0x4aece0){if(!_0x4aece0){_0x486472[_0x522d('0x30')](0x194);}return _0x4aece0;};}function handleError(_0x419343,_0x4b0ee1){_0x4b0ee1=_0x4b0ee1||0x1f4;return function(_0xdb7f18){logger[_0x522d('0x31')](_0xdb7f18['stack']);if(_0xdb7f18['name']){delete _0xdb7f18['name'];}_0x419343[_0x522d('0x1f')](_0x4b0ee1)['send'](_0xdb7f18);};}exports[_0x522d('0x32')]=function(_0x2ad9cf,_0x41ce81){var _0xfa52f2={},_0x2285f0={},_0x52f2bb={'count':0x0,'rows':[]};var _0x5094f1=_['map'](db[_0x522d('0x33')][_0x522d('0x34')],function(_0xc307ee){return{'name':_0xc307ee['fieldName'],'type':_0xc307ee['type'][_0x522d('0x35')]};});_0x2285f0[_0x522d('0x36')]=_[_0x522d('0x37')](_0x5094f1,_0x522d('0x38'));_0x2285f0[_0x522d('0x39')]=_[_0x522d('0x3a')](_0x2ad9cf[_0x522d('0x39')]);_0x2285f0[_0x522d('0x3b')]=_[_0x522d('0x3c')](_0x2285f0[_0x522d('0x36')],_0x2285f0['query']);_0xfa52f2[_0x522d('0x3d')]=_[_0x522d('0x3c')](_0x2285f0[_0x522d('0x36')],qs[_0x522d('0x3e')](_0x2ad9cf[_0x522d('0x39')][_0x522d('0x3e')]));_0xfa52f2[_0x522d('0x3d')]=_0xfa52f2[_0x522d('0x3d')][_0x522d('0x3f')]?_0xfa52f2[_0x522d('0x3d')]:_0x2285f0[_0x522d('0x36')];if(!_0x2ad9cf[_0x522d('0x39')][_0x522d('0x40')](_0x522d('0x41'))){_0xfa52f2[_0x522d('0x23')]=qs[_0x522d('0x23')](_0x2ad9cf[_0x522d('0x39')]['limit']);_0xfa52f2[_0x522d('0x22')]=qs[_0x522d('0x22')](_0x2ad9cf['query']['offset']);}_0xfa52f2[_0x522d('0x42')]=qs[_0x522d('0x43')](_0x2ad9cf['query']['sort']);_0xfa52f2[_0x522d('0x44')]=qs[_0x522d('0x3b')](_[_0x522d('0x45')](_0x2ad9cf[_0x522d('0x39')],_0x2285f0[_0x522d('0x3b')]));if(_0x2ad9cf['query']['filter']){_0xfa52f2[_0x522d('0x44')]=_[_0x522d('0x46')](_0xfa52f2[_0x522d('0x44')],{'$or':_[_0x522d('0x37')](_0x5094f1,function(_0x1b4b7f){if(_0x1b4b7f['type']!==_0x522d('0x47')){var _0x5889d0={};_0x5889d0[_0x1b4b7f[_0x522d('0x38')]]={'$like':'%'+_0x2ad9cf[_0x522d('0x39')][_0x522d('0x48')]+'%'};return _0x5889d0;}})});}_0xfa52f2=_[_0x522d('0x46')]({},_0xfa52f2,_0x2ad9cf['options']);var _0x1b65e5={'where':_0xfa52f2['where']};return db[_0x522d('0x33')][_0x522d('0x21')](_0x1b65e5)[_0x522d('0x2b')](function(_0x5b8a42){_0x52f2bb[_0x522d('0x21')]=_0x5b8a42;if(_0x2ad9cf[_0x522d('0x39')]['includeAll']){_0xfa52f2['include']=[{'all':!![]}];}return db[_0x522d('0x33')][_0x522d('0x49')](_0xfa52f2);})['then'](function(_0x4e6832){_0x52f2bb[_0x522d('0x4a')]=_0x4e6832;return _0x52f2bb;})['then'](respondWithFilteredResult(_0x41ce81,_0xfa52f2))[_0x522d('0x4b')](handleError(_0x41ce81,null));};exports[_0x522d('0x4c')]=function(_0x25e41b,_0xbd019a){var _0x308029={'raw':![],'where':{'id':_0x25e41b[_0x522d('0x4d')]['id']}},_0x2b19c0={};_0x2b19c0[_0x522d('0x36')]=_['keys'](db[_0x522d('0x33')]['rawAttributes']);_0x2b19c0[_0x522d('0x39')]=_['keys'](_0x25e41b[_0x522d('0x39')]);_0x2b19c0['filters']=_['intersection'](_0x2b19c0[_0x522d('0x36')],_0x2b19c0[_0x522d('0x39')]);_0x308029[_0x522d('0x3d')]=_[_0x522d('0x3c')](_0x2b19c0[_0x522d('0x36')],qs['fields'](_0x25e41b['query']['fields']));_0x308029[_0x522d('0x3d')]=_0x308029[_0x522d('0x3d')]['length']?_0x308029[_0x522d('0x3d')]:_0x2b19c0[_0x522d('0x36')];if(_0x25e41b['query']['includeAll']){_0x308029[_0x522d('0x4e')]=[{'all':!![]}];}_0x308029=_['merge']({},_0x308029,_0x25e41b[_0x522d('0x4f')]);return db[_0x522d('0x33')][_0x522d('0x50')](_0x308029)['then'](handleEntityNotFound(_0xbd019a,null))[_0x522d('0x2b')](respondWithResult(_0xbd019a,null))['catch'](handleError(_0xbd019a,null));};exports[_0x522d('0x51')]=function(_0x481857,_0x3f8ea9){return db['Dashboard'][_0x522d('0x51')](_0x481857[_0x522d('0x52')],{})[_0x522d('0x2b')](function(_0x10499a){var _0x56f665=_0x481857[_0x522d('0x53')][_0x522d('0x2d')]({'plain':!![]});if(!_0x56f665)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x56f665[_0x522d('0x54')]==='user'){var _0x3fe0c9=_0x10499a[_0x522d('0x2d')]({'plain':!![]});var _0x384340=_0x522d('0x2e');return db['UserProfileSection']['find']({'where':{'name':_0x384340,'userProfileId':_0x56f665[_0x522d('0x55')]},'raw':!![]})[_0x522d('0x2b')](function(_0x3dff0b){if(_0x3dff0b&&_0x3dff0b[_0x522d('0x56')]===0x0){return db[_0x522d('0x2f')][_0x522d('0x51')]({'name':_0x3fe0c9[_0x522d('0x38')],'resourceId':_0x3fe0c9['id'],'type':_0x3dff0b['name'],'sectionId':_0x3dff0b['id']},{})['then'](function(){return _0x10499a;});}else{return _0x10499a;}})[_0x522d('0x4b')](function(_0x15ce25){logger[_0x522d('0x31')](_0x522d('0x57'),_0x15ce25);throw _0x15ce25;});}return _0x10499a;})['then'](respondWithResult(_0x3f8ea9,0xc9))[_0x522d('0x4b')](handleError(_0x3f8ea9,null));};exports[_0x522d('0x58')]=function(_0x515b1f,_0x87d9f1){var _0x4a7d29={'where':{'id':_0x515b1f[_0x522d('0x4d')]['id']}},_0x44a9bc={};_0x44a9bc[_0x522d('0x36')]=_[_0x522d('0x3a')](db[_0x522d('0x33')][_0x522d('0x34')]);_0x4a7d29[_0x522d('0x3d')]=_[_0x522d('0x3c')](_0x44a9bc[_0x522d('0x36')],qs[_0x522d('0x3e')](_0x515b1f['query']['fields']));_0x4a7d29[_0x522d('0x3d')]=_0x4a7d29[_0x522d('0x3d')][_0x522d('0x3f')]?_0x4a7d29[_0x522d('0x3d')]:_0x44a9bc['model'];if(_0x515b1f['query']['includeAll']){_0x4a7d29[_0x522d('0x4e')]=[{'all':!![]}];}_0x4a7d29=_[_0x522d('0x46')]({},_0x4a7d29,_0x515b1f[_0x522d('0x4f')]);return db[_0x522d('0x33')][_0x522d('0x50')](_0x4a7d29)[_0x522d('0x2b')](handleEntityNotFound(_0x87d9f1,null))[_0x522d('0x2b')](function(_0x161777){if(_0x161777){var _0x27a73e=_0x161777[_0x522d('0x2d')]({'plain':!![]});_0x27a73e=qs[_0x522d('0x59')](_0x27a73e,['id','createdAt','updatedAt']);_0x515b1f[_0x522d('0x52')]=_[_0x522d('0x59')](_0x515b1f[_0x522d('0x52')],['id',_0x522d('0x5a'),'updatedAt']);return db['Dashboard'][_0x522d('0x51')](_[_0x522d('0x46')](_0x27a73e,_0x515b1f[_0x522d('0x52')]),{'include':_0x515b1f[_0x522d('0x39')][_0x522d('0x5b')]?[{'all':!![]}]:undefined})[_0x522d('0x2b')](function(_0x5c6a88){var _0x299504=_0x515b1f[_0x522d('0x53')][_0x522d('0x2d')]({'plain':!![]});if(!_0x299504)throw new Error(_0x522d('0x5c'));if(_0x299504[_0x522d('0x54')]===_0x522d('0x53')){var _0x433fee=_0x5c6a88[_0x522d('0x2d')]({'plain':!![]});var _0x4a9ca9='CustomDashboards';return db['UserProfileSection'][_0x522d('0x50')]({'where':{'name':_0x4a9ca9,'userProfileId':_0x299504['userProfileId']},'raw':!![]})[_0x522d('0x2b')](function(_0x55ade8){if(_0x55ade8&&_0x55ade8[_0x522d('0x56')]===0x0){return db['UserProfileResource'][_0x522d('0x51')]({'name':_0x433fee[_0x522d('0x38')],'resourceId':_0x433fee['id'],'type':_0x55ade8[_0x522d('0x38')],'sectionId':_0x55ade8['id']},{})[_0x522d('0x2b')](function(){return _0x5c6a88;});}else{return _0x5c6a88;}})['catch'](function(_0x315ab2){logger['error'](_0x522d('0x57'),_0x315ab2);throw _0x315ab2;});}return _0x5c6a88;});}})['then'](respondWithResult(_0x87d9f1,0xc9))[_0x522d('0x4b')](handleError(_0x87d9f1,null));};exports['update']=function(_0x23a70b,_0x3a27e8){if(_0x23a70b['body']['id']){delete _0x23a70b[_0x522d('0x52')]['id'];}return db['Dashboard'][_0x522d('0x50')]({'where':{'id':_0x23a70b[_0x522d('0x4d')]['id']}})[_0x522d('0x2b')](handleEntityNotFound(_0x3a27e8,null))[_0x522d('0x2b')](saveUpdates(_0x23a70b[_0x522d('0x52')],null))[_0x522d('0x2b')](respondWithResult(_0x3a27e8,null))[_0x522d('0x4b')](handleError(_0x3a27e8,null));};exports[_0x522d('0x2c')]=function(_0x52f1d9,_0x5830e6){return db[_0x522d('0x33')][_0x522d('0x50')]({'where':{'id':_0x52f1d9[_0x522d('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5830e6,null))[_0x522d('0x2b')](removeEntity(_0x5830e6,null))['catch'](handleError(_0x5830e6,null));};function widgetAttributes(_0x3ef383){try{switch(_0x3ef383[_0x522d('0x5d')]){case _0x522d('0x5e'):return[{'name':_0x522d('0x5f'),'value':_0x3ef383['attrUrl']||(_0x3ef383[_0x522d('0x60')]&&_0x3ef383[_0x522d('0x60')][0x0]?_0x3ef383[_0x522d('0x60')][0x0][_0x522d('0x61')]:undefined)||_0x522d('0x62')}];case _0x522d('0x63'):return[{'name':_0x522d('0x64'),'value':_0x3ef383[_0x522d('0x64')]||(_0x3ef383[_0x522d('0x60')]&&_0x3ef383[_0x522d('0x60')][0x0]?_0x3ef383[_0x522d('0x60')][0x0]['value']:undefined)||''}];case'clock':return[{'name':_0x522d('0x65'),'value':_0x3ef383[_0x522d('0x65')]||(_0x3ef383['attrs']&&_0x3ef383[_0x522d('0x60')][0x0]?_0x3ef383['attrs'][0x0][_0x522d('0x61')]:undefined)||_0x522d('0x66')},{'name':_0x522d('0x67'),'value':_0x3ef383[_0x522d('0x67')]||(_0x3ef383[_0x522d('0x60')]&&_0x3ef383[_0x522d('0x60')][0x1]?_0x3ef383[_0x522d('0x60')][0x1][_0x522d('0x61')]:undefined)||'0.00'},{'name':_0x522d('0x68'),'value':_0x3ef383['attrFontSize']||(_0x3ef383[_0x522d('0x60')]&&_0x3ef383[_0x522d('0x60')][0x2]?_0x3ef383[_0x522d('0x60')][0x2][_0x522d('0x61')]:undefined)||0xc}];case _0x522d('0x69'):return[{'name':_0x522d('0x6a'),'value':_0x3ef383['attrMetric']||(_0x3ef383[_0x522d('0x60')]&&_0x3ef383['attrs'][0x0]?_0x3ef383['attrs'][0x0][_0x522d('0x61')]:undefined)||_0x522d('0x6b')},{'name':_0x522d('0x6c'),'value':_0x3ef383[_0x522d('0x6c')]||(_0x3ef383['attrs']&&_0x3ef383['attrs'][0x1]?_0x3ef383[_0x522d('0x60')][0x1][_0x522d('0x61')]:undefined)||[]},{'name':_0x522d('0x68'),'value':_0x3ef383[_0x522d('0x68')]||(_0x3ef383['attrs']&&_0x3ef383['attrs'][0x2]?_0x3ef383[_0x522d('0x60')][0x2]['value']:undefined)||0x14}];case _0x522d('0x6d'):case'pie-chart':return[{'name':_0x522d('0x6e'),'value':_0x3ef383[_0x522d('0x6e')]||(_0x3ef383[_0x522d('0x60')]&&_0x3ef383[_0x522d('0x60')][0x0]?_0x3ef383[_0x522d('0x60')][0x0][_0x522d('0x61')]:undefined)||_0x522d('0x6b')},{'name':_0x522d('0x6f'),'value':_0x3ef383[_0x522d('0x6f')]||(_0x3ef383[_0x522d('0x60')]&&_0x3ef383[_0x522d('0x60')][0x1]?_0x3ef383[_0x522d('0x60')][0x1][_0x522d('0x61')]:undefined)||null},{'name':_0x522d('0x70'),'value':_0x3ef383[_0x522d('0x70')]||(_0x3ef383[_0x522d('0x60')]&&_0x3ef383[_0x522d('0x60')][0x2]?_0x3ef383[_0x522d('0x60')][0x2][_0x522d('0x61')]:undefined)||null},{'name':_0x522d('0x6c'),'value':_0x3ef383['attrVoiceQueues']||(_0x3ef383[_0x522d('0x60')]&&_0x3ef383[_0x522d('0x60')][0x3]?_0x3ef383['attrs'][0x3][_0x522d('0x61')]:undefined)||[]}];case _0x522d('0x71'):return[{'name':'attrReport','type':_0x3ef383[_0x522d('0x72')]||(_0x3ef383[_0x522d('0x60')]&&_0x3ef383[_0x522d('0x60')][0x0]?_0x3ef383['attrs'][0x0][_0x522d('0x5d')]:undefined)||null,'value':_0x3ef383[_0x522d('0x73')]||(_0x3ef383[_0x522d('0x60')]&&_0x3ef383[_0x522d('0x60')][0x0]?_0x3ef383['attrs'][0x0]['value']:undefined)||null},{'name':_0x522d('0x74'),'value':_0x3ef383[_0x522d('0x74')]||(_0x3ef383['attrs']&&_0x3ef383[_0x522d('0x60')][0x1]?_0x3ef383[_0x522d('0x60')][0x1][_0x522d('0x61')]:undefined)||0x0}];default:return[];}}catch(_0x5b8400){logger[_0x522d('0x31')](_0x522d('0x75'),JSON[_0x522d('0x76')](_0x5b8400));return[];}}exports[_0x522d('0x77')]=function(_0x442210,_0x432d84,_0x2c2106){if(_0x442210[_0x522d('0x52')]['id']){delete _0x442210['body']['id'];}return db[_0x522d('0x33')][_0x522d('0x50')]({'where':{'id':_0x442210[_0x522d('0x4d')]['id']}})[_0x522d('0x2b')](handleEntityNotFound(_0x432d84,null))[_0x522d('0x2b')](function(_0x98122e){if(_0x98122e){_0x442210[_0x522d('0x52')]['DashboardId']=_0x98122e['id'];_0x442210[_0x522d('0x52')][_0x522d('0x60')]=widgetAttributes(_0x442210['body']);return db[_0x522d('0x78')][_0x522d('0x51')](_0x442210[_0x522d('0x52')]);}})[_0x522d('0x2b')](respondWithResult(_0x432d84,null))[_0x522d('0x4b')](handleError(_0x432d84,null));};exports['getItems']=function(_0x31b39e,_0x39b90f,_0x35ce6f){var _0x5c3492={};var _0x208659={};var _0x8412c1;var _0x17fc95;return db[_0x522d('0x33')][_0x522d('0x79')]({'where':{'id':_0x31b39e['params']['id']}})['then'](handleEntityNotFound(_0x39b90f,null))['then'](function(_0x5bcb6a){if(_0x5bcb6a){_0x8412c1=_0x5bcb6a;_0x208659['model']=_[_0x522d('0x3a')](db[_0x522d('0x78')][_0x522d('0x34')]);_0x208659[_0x522d('0x39')]=_[_0x522d('0x3a')](_0x31b39e[_0x522d('0x39')]);_0x208659[_0x522d('0x3b')]=_['intersection'](_0x208659[_0x522d('0x36')],_0x208659['query']);_0x5c3492[_0x522d('0x3d')]=_[_0x522d('0x3c')](_0x208659[_0x522d('0x36')],qs[_0x522d('0x3e')](_0x31b39e[_0x522d('0x39')][_0x522d('0x3e')]));_0x5c3492[_0x522d('0x3d')]=_0x5c3492[_0x522d('0x3d')]['length']?_0x5c3492[_0x522d('0x3d')]:_0x208659['model'];_0x5c3492[_0x522d('0x42')]=qs[_0x522d('0x43')](_0x31b39e[_0x522d('0x39')][_0x522d('0x43')]);_0x5c3492[_0x522d('0x44')]=qs[_0x522d('0x3b')](_['pick'](_0x31b39e[_0x522d('0x39')],_0x208659['filters']));if(_0x31b39e[_0x522d('0x39')][_0x522d('0x48')]){_0x5c3492['where']=_['merge'](_0x5c3492[_0x522d('0x44')],{'$or':_[_0x522d('0x37')](_0x5c3492[_0x522d('0x3d')],function(_0x1e8d3d){var _0x3ecd9a={};_0x3ecd9a[_0x1e8d3d]={'$like':'%'+_0x31b39e[_0x522d('0x39')][_0x522d('0x48')]+'%'};return _0x3ecd9a;})});}_0x5c3492=_['merge']({},_0x5c3492,_0x31b39e[_0x522d('0x4f')]);return _0x8412c1[_0x522d('0x7a')](_0x5c3492);}})['then'](function(_0x487d22){if(_0x487d22){_0x17fc95=_0x487d22[_0x522d('0x3f')];if(!_0x31b39e[_0x522d('0x39')][_0x522d('0x40')](_0x522d('0x41'))){_0x5c3492[_0x522d('0x23')]=qs[_0x522d('0x23')](_0x31b39e['query'][_0x522d('0x23')]);_0x5c3492['offset']=qs[_0x522d('0x22')](_0x31b39e['query'][_0x522d('0x22')]);}return _0x8412c1[_0x522d('0x7a')](_0x5c3492);}})[_0x522d('0x2b')](function(_0x821761){if(_0x821761){return _0x821761?{'count':_0x17fc95,'rows':_0x821761}:null;}})['then'](respondWithResult(_0x39b90f,null))[_0x522d('0x4b')](handleError(_0x39b90f,null));}; \ No newline at end of file +var _0xafa8=['length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','includeAll','include','findAll','rows','catch','show','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','options','omit','createdAt','updatedAt','CustomDashboards','UserProfileSection','userProfileId','params','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','lodash','squel','crypto','jsforce','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','sendStatus','end','json','count','offset','status','set','Content-Range','save','update','then','destroy','error','stack','name','send','Dashboard','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields'];(function(_0x50b6d9,_0x1c24ac){var _0x4d956c=function(_0x48058e){while(--_0x48058e){_0x50b6d9['push'](_0x50b6d9['shift']());}};_0x4d956c(++_0x1c24ac);}(_0xafa8,0x135));var _0x8afa=function(_0x4b4277,_0x22676f){_0x4b4277=_0x4b4277-0x0;var _0x1ff405=_0xafa8[_0x4b4277];return _0x1ff405;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8afa('0x0'));var rimraf=require(_0x8afa('0x1'));var zipdir=require(_0x8afa('0x2'));var jsonpatch=require(_0x8afa('0x3'));var rp=require(_0x8afa('0x4'));var moment=require(_0x8afa('0x5'));var BPromise=require(_0x8afa('0x6'));var Mustache=require('mustache');var util=require(_0x8afa('0x7'));var path=require('path');var sox=require(_0x8afa('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x8afa('0x9'));var squel=require(_0x8afa('0xa'));var crypto=require(_0x8afa('0xb'));var jsforce=require(_0x8afa('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8afa('0xd'));var querystring=require(_0x8afa('0xe'));var Papa=require(_0x8afa('0xf'));var Redis=require(_0x8afa('0x10'));var authService=require(_0x8afa('0x11'));var qs=require(_0x8afa('0x12'));var as=require(_0x8afa('0x13'));var hardwareService=require(_0x8afa('0x14'));var logger=require(_0x8afa('0x15'))('api');var utils=require(_0x8afa('0x16'));var config=require(_0x8afa('0x17'));var db=require(_0x8afa('0x18'))['db'];config[_0x8afa('0x19')]=_[_0x8afa('0x1a')](config[_0x8afa('0x19')],{'host':_0x8afa('0x1b'),'port':0x18eb});var socket=require(_0x8afa('0x1c'))(new Redis(config[_0x8afa('0x19')]));require('./dashboard.socket')[_0x8afa('0x1d')](socket);function respondWithStatusCode(_0x522ec9,_0xc468a0){_0xc468a0=_0xc468a0||0xcc;return function(_0x39a113){if(_0x39a113){return _0x522ec9[_0x8afa('0x1e')](_0xc468a0);}return _0x522ec9['status'](_0xc468a0)[_0x8afa('0x1f')]();};}function respondWithResult(_0xf79f1d,_0x3916ce){_0x3916ce=_0x3916ce||0xc8;return function(_0x89bdf6){if(_0x89bdf6){return _0xf79f1d['status'](_0x3916ce)[_0x8afa('0x20')](_0x89bdf6);}};}function respondWithFilteredResult(_0x671b0c,_0x1d157f){return function(_0x4a92c9){if(_0x4a92c9){var _0x23f03b=_0x4a92c9[_0x8afa('0x21')],_0x429292=_0x1d157f[_0x8afa('0x22')],_0xd580cb=_0x1d157f[_0x8afa('0x22')]+_0x1d157f['limit'],_0x1931b7;if(_0xd580cb>=_0x23f03b){_0xd580cb=_0x23f03b;_0x1931b7=0xc8;}else{_0x1931b7=0xce;}_0x671b0c[_0x8afa('0x23')](_0x1931b7);return _0x671b0c[_0x8afa('0x24')](_0x8afa('0x25'),_0x429292+'-'+_0xd580cb+'/'+_0x23f03b)[_0x8afa('0x20')](_0x4a92c9);}return null;};}function patchUpdates(_0x2ae60e){return function(_0x51cbcc){try{jsonpatch['apply'](_0x51cbcc,_0x2ae60e,!![]);}catch(_0x231631){return BPromise['reject'](_0x231631);}return _0x51cbcc[_0x8afa('0x26')]();};}function saveUpdates(_0x1cee0c,_0x48b080){return function(_0x1f0fac){if(_0x1f0fac){return _0x1f0fac[_0x8afa('0x27')](_0x1cee0c)[_0x8afa('0x28')](function(_0x302013){return _0x302013;});}return null;};}function removeEntity(_0x47896f,_0x3b7cf2){return function(_0x5c7c5c){if(_0x5c7c5c){return _0x5c7c5c[_0x8afa('0x29')]()[_0x8afa('0x28')](function(){var _0x1c48fa=_0x5c7c5c['get']({'plain':!![]});var _0xdde12='CustomDashboards';return db['UserProfileResource'][_0x8afa('0x29')]({'where':{'type':_0xdde12,'resourceId':_0x1c48fa['id']}})['then'](function(){return _0x5c7c5c;});})[_0x8afa('0x28')](function(){_0x47896f[_0x8afa('0x23')](0xcc)[_0x8afa('0x1f')]();});}};}function handleEntityNotFound(_0x4dcefc,_0x36462a){return function(_0x1adb0e){if(!_0x1adb0e){_0x4dcefc[_0x8afa('0x1e')](0x194);}return _0x1adb0e;};}function handleError(_0x2fd9f4,_0x2be75b){_0x2be75b=_0x2be75b||0x1f4;return function(_0x47c833){logger[_0x8afa('0x2a')](_0x47c833[_0x8afa('0x2b')]);if(_0x47c833[_0x8afa('0x2c')]){delete _0x47c833['name'];}_0x2fd9f4[_0x8afa('0x23')](_0x2be75b)[_0x8afa('0x2d')](_0x47c833);};}exports['index']=function(_0x5f199d,_0x37b359){var _0x4f6297={},_0x26a1e9={},_0x2155f7={'count':0x0,'rows':[]};var _0x3e0cc7=_['map'](db[_0x8afa('0x2e')][_0x8afa('0x2f')],function(_0x5e7a6b){return{'name':_0x5e7a6b[_0x8afa('0x30')],'type':_0x5e7a6b[_0x8afa('0x31')][_0x8afa('0x32')]};});_0x26a1e9[_0x8afa('0x33')]=_['map'](_0x3e0cc7,_0x8afa('0x2c'));_0x26a1e9['query']=_['keys'](_0x5f199d['query']);_0x26a1e9[_0x8afa('0x34')]=_[_0x8afa('0x35')](_0x26a1e9['model'],_0x26a1e9[_0x8afa('0x36')]);_0x4f6297[_0x8afa('0x37')]=_[_0x8afa('0x35')](_0x26a1e9['model'],qs['fields'](_0x5f199d['query'][_0x8afa('0x38')]));_0x4f6297[_0x8afa('0x37')]=_0x4f6297[_0x8afa('0x37')][_0x8afa('0x39')]?_0x4f6297['attributes']:_0x26a1e9['model'];if(!_0x5f199d['query'][_0x8afa('0x3a')](_0x8afa('0x3b'))){_0x4f6297[_0x8afa('0x3c')]=qs['limit'](_0x5f199d[_0x8afa('0x36')]['limit']);_0x4f6297[_0x8afa('0x22')]=qs[_0x8afa('0x22')](_0x5f199d[_0x8afa('0x36')][_0x8afa('0x22')]);}_0x4f6297[_0x8afa('0x3d')]=qs[_0x8afa('0x3e')](_0x5f199d[_0x8afa('0x36')]['sort']);_0x4f6297[_0x8afa('0x3f')]=qs[_0x8afa('0x34')](_[_0x8afa('0x40')](_0x5f199d[_0x8afa('0x36')],_0x26a1e9[_0x8afa('0x34')]));if(_0x5f199d[_0x8afa('0x36')][_0x8afa('0x41')]){_0x4f6297[_0x8afa('0x3f')]=_[_0x8afa('0x42')](_0x4f6297[_0x8afa('0x3f')],{'$or':_[_0x8afa('0x43')](_0x3e0cc7,function(_0x5c9b2e){if(_0x5c9b2e[_0x8afa('0x31')]!=='VIRTUAL'){var _0x1b3f1b={};_0x1b3f1b[_0x5c9b2e['name']]={'$like':'%'+_0x5f199d[_0x8afa('0x36')]['filter']+'%'};return _0x1b3f1b;}})});}_0x4f6297=_[_0x8afa('0x42')]({},_0x4f6297,_0x5f199d['options']);var _0x540375={'where':_0x4f6297[_0x8afa('0x3f')]};return db[_0x8afa('0x2e')][_0x8afa('0x21')](_0x540375)[_0x8afa('0x28')](function(_0x30287d){_0x2155f7[_0x8afa('0x21')]=_0x30287d;if(_0x5f199d[_0x8afa('0x36')][_0x8afa('0x44')]){_0x4f6297[_0x8afa('0x45')]=[{'all':!![]}];}return db[_0x8afa('0x2e')][_0x8afa('0x46')](_0x4f6297);})[_0x8afa('0x28')](function(_0x67efdb){_0x2155f7[_0x8afa('0x47')]=_0x67efdb;return _0x2155f7;})['then'](respondWithFilteredResult(_0x37b359,_0x4f6297))[_0x8afa('0x48')](handleError(_0x37b359,null));};exports[_0x8afa('0x49')]=function(_0x10e538,_0x2f81ad){var _0x3ca243={'raw':![],'where':{'id':_0x10e538['params']['id']}},_0x585381={};_0x585381[_0x8afa('0x33')]=_[_0x8afa('0x4a')](db[_0x8afa('0x2e')][_0x8afa('0x2f')]);_0x585381[_0x8afa('0x36')]=_['keys'](_0x10e538[_0x8afa('0x36')]);_0x585381[_0x8afa('0x34')]=_[_0x8afa('0x35')](_0x585381[_0x8afa('0x33')],_0x585381[_0x8afa('0x36')]);_0x3ca243[_0x8afa('0x37')]=_[_0x8afa('0x35')](_0x585381[_0x8afa('0x33')],qs[_0x8afa('0x38')](_0x10e538[_0x8afa('0x36')][_0x8afa('0x38')]));_0x3ca243[_0x8afa('0x37')]=_0x3ca243[_0x8afa('0x37')]['length']?_0x3ca243[_0x8afa('0x37')]:_0x585381[_0x8afa('0x33')];if(_0x10e538['query'][_0x8afa('0x44')]){_0x3ca243[_0x8afa('0x45')]=[{'all':!![]}];}_0x3ca243=_['merge']({},_0x3ca243,_0x10e538['options']);return db[_0x8afa('0x2e')][_0x8afa('0x4b')](_0x3ca243)[_0x8afa('0x28')](handleEntityNotFound(_0x2f81ad,null))[_0x8afa('0x28')](respondWithResult(_0x2f81ad,null))['catch'](handleError(_0x2f81ad,null));};exports['create']=function(_0x10afc0,_0x4bf8c2){return db['Dashboard'][_0x8afa('0x4c')](_0x10afc0[_0x8afa('0x4d')],{})[_0x8afa('0x28')](function(_0x541020){var _0x349461=_0x10afc0[_0x8afa('0x4e')]['get']({'plain':!![]});if(!_0x349461)throw new Error(_0x8afa('0x4f'));if(_0x349461[_0x8afa('0x50')]===_0x8afa('0x4e')){var _0xa3d4bb=_0x541020[_0x8afa('0x51')]({'plain':!![]});var _0x965e17='CustomDashboards';return db['UserProfileSection'][_0x8afa('0x4b')]({'where':{'name':_0x965e17,'userProfileId':_0x349461['userProfileId']},'raw':!![]})[_0x8afa('0x28')](function(_0x45a14a){if(_0x45a14a&&_0x45a14a[_0x8afa('0x52')]===0x0){return db[_0x8afa('0x53')][_0x8afa('0x4c')]({'name':_0xa3d4bb[_0x8afa('0x2c')],'resourceId':_0xa3d4bb['id'],'type':_0x45a14a[_0x8afa('0x2c')],'sectionId':_0x45a14a['id']},{})[_0x8afa('0x28')](function(){return _0x541020;});}else{return _0x541020;}})[_0x8afa('0x48')](function(_0x135736){logger[_0x8afa('0x2a')](_0x8afa('0x54'),_0x135736);throw _0x135736;});}return _0x541020;})[_0x8afa('0x28')](respondWithResult(_0x4bf8c2,0xc9))[_0x8afa('0x48')](handleError(_0x4bf8c2,null));};exports[_0x8afa('0x55')]=function(_0x3b5ee4,_0x24c5af){var _0x167dfb={'where':{'id':_0x3b5ee4['params']['id']}},_0x4b0efd={};_0x4b0efd[_0x8afa('0x33')]=_['keys'](db[_0x8afa('0x2e')][_0x8afa('0x2f')]);_0x167dfb[_0x8afa('0x37')]=_['intersection'](_0x4b0efd['model'],qs[_0x8afa('0x38')](_0x3b5ee4[_0x8afa('0x36')][_0x8afa('0x38')]));_0x167dfb[_0x8afa('0x37')]=_0x167dfb[_0x8afa('0x37')][_0x8afa('0x39')]?_0x167dfb[_0x8afa('0x37')]:_0x4b0efd[_0x8afa('0x33')];if(_0x3b5ee4[_0x8afa('0x36')][_0x8afa('0x44')]){_0x167dfb['include']=[{'all':!![]}];}_0x167dfb=_[_0x8afa('0x42')]({},_0x167dfb,_0x3b5ee4[_0x8afa('0x56')]);return db[_0x8afa('0x2e')][_0x8afa('0x4b')](_0x167dfb)[_0x8afa('0x28')](handleEntityNotFound(_0x24c5af,null))[_0x8afa('0x28')](function(_0x21127f){if(_0x21127f){var _0x2e113e=_0x21127f['get']({'plain':!![]});_0x2e113e=qs[_0x8afa('0x57')](_0x2e113e,['id',_0x8afa('0x58'),_0x8afa('0x59')]);_0x3b5ee4[_0x8afa('0x4d')]=_[_0x8afa('0x57')](_0x3b5ee4[_0x8afa('0x4d')],['id',_0x8afa('0x58'),_0x8afa('0x59')]);return db['Dashboard'][_0x8afa('0x4c')](_[_0x8afa('0x42')](_0x2e113e,_0x3b5ee4[_0x8afa('0x4d')]),{'include':_0x3b5ee4[_0x8afa('0x36')][_0x8afa('0x44')]?[{'all':!![]}]:undefined})['then'](function(_0x544ffa){var _0x50cc1a=_0x3b5ee4[_0x8afa('0x4e')][_0x8afa('0x51')]({'plain':!![]});if(!_0x50cc1a)throw new Error(_0x8afa('0x4f'));if(_0x50cc1a[_0x8afa('0x50')]==='user'){var _0x4ade29=_0x544ffa[_0x8afa('0x51')]({'plain':!![]});var _0x349682=_0x8afa('0x5a');return db[_0x8afa('0x5b')][_0x8afa('0x4b')]({'where':{'name':_0x349682,'userProfileId':_0x50cc1a[_0x8afa('0x5c')]},'raw':!![]})[_0x8afa('0x28')](function(_0x39c55f){if(_0x39c55f&&_0x39c55f[_0x8afa('0x52')]===0x0){return db[_0x8afa('0x53')]['create']({'name':_0x4ade29[_0x8afa('0x2c')],'resourceId':_0x4ade29['id'],'type':_0x39c55f[_0x8afa('0x2c')],'sectionId':_0x39c55f['id']},{})[_0x8afa('0x28')](function(){return _0x544ffa;});}else{return _0x544ffa;}})[_0x8afa('0x48')](function(_0xc9c312){logger['error'](_0x8afa('0x54'),_0xc9c312);throw _0xc9c312;});}return _0x544ffa;});}})[_0x8afa('0x28')](respondWithResult(_0x24c5af,0xc9))[_0x8afa('0x48')](handleError(_0x24c5af,null));};exports[_0x8afa('0x27')]=function(_0x1cc0f3,_0xecd37a){if(_0x1cc0f3[_0x8afa('0x4d')]['id']){delete _0x1cc0f3[_0x8afa('0x4d')]['id'];}return db['Dashboard'][_0x8afa('0x4b')]({'where':{'id':_0x1cc0f3[_0x8afa('0x5d')]['id']}})[_0x8afa('0x28')](handleEntityNotFound(_0xecd37a,null))[_0x8afa('0x28')](saveUpdates(_0x1cc0f3[_0x8afa('0x4d')],null))[_0x8afa('0x28')](respondWithResult(_0xecd37a,null))[_0x8afa('0x48')](handleError(_0xecd37a,null));};exports[_0x8afa('0x29')]=function(_0x4c4a30,_0x36d246){return db[_0x8afa('0x2e')][_0x8afa('0x4b')]({'where':{'id':_0x4c4a30[_0x8afa('0x5d')]['id']}})[_0x8afa('0x28')](handleEntityNotFound(_0x36d246,null))['then'](removeEntity(_0x36d246,null))['catch'](handleError(_0x36d246,null));};function widgetAttributes(_0x5094c7){try{switch(_0x5094c7[_0x8afa('0x31')]){case _0x8afa('0x5e'):return[{'name':_0x8afa('0x5f'),'value':_0x5094c7[_0x8afa('0x5f')]||(_0x5094c7['attrs']&&_0x5094c7[_0x8afa('0x60')][0x0]?_0x5094c7[_0x8afa('0x60')][0x0][_0x8afa('0x61')]:undefined)||_0x8afa('0x62')}];case _0x8afa('0x63'):return[{'name':_0x8afa('0x64'),'value':_0x5094c7[_0x8afa('0x64')]||(_0x5094c7[_0x8afa('0x60')]&&_0x5094c7[_0x8afa('0x60')][0x0]?_0x5094c7[_0x8afa('0x60')][0x0][_0x8afa('0x61')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x5094c7[_0x8afa('0x65')]||(_0x5094c7[_0x8afa('0x60')]&&_0x5094c7[_0x8afa('0x60')][0x0]?_0x5094c7['attrs'][0x0][_0x8afa('0x61')]:undefined)||'HH:mm:ss'},{'name':_0x8afa('0x66'),'value':_0x5094c7['attrTimezone']||(_0x5094c7[_0x8afa('0x60')]&&_0x5094c7[_0x8afa('0x60')][0x1]?_0x5094c7[_0x8afa('0x60')][0x1][_0x8afa('0x61')]:undefined)||'0.00'},{'name':_0x8afa('0x67'),'value':_0x5094c7[_0x8afa('0x67')]||(_0x5094c7['attrs']&&_0x5094c7[_0x8afa('0x60')][0x2]?_0x5094c7[_0x8afa('0x60')][0x2][_0x8afa('0x61')]:undefined)||0xc}];case _0x8afa('0x68'):return[{'name':_0x8afa('0x69'),'value':_0x5094c7[_0x8afa('0x69')]||(_0x5094c7[_0x8afa('0x60')]&&_0x5094c7[_0x8afa('0x60')][0x0]?_0x5094c7['attrs'][0x0][_0x8afa('0x61')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x5094c7[_0x8afa('0x6a')]||(_0x5094c7[_0x8afa('0x60')]&&_0x5094c7[_0x8afa('0x60')][0x1]?_0x5094c7[_0x8afa('0x60')][0x1][_0x8afa('0x61')]:undefined)||[]},{'name':_0x8afa('0x67'),'value':_0x5094c7[_0x8afa('0x67')]||(_0x5094c7[_0x8afa('0x60')]&&_0x5094c7['attrs'][0x2]?_0x5094c7[_0x8afa('0x60')][0x2][_0x8afa('0x61')]:undefined)||0x14}];case _0x8afa('0x6b'):case _0x8afa('0x6c'):return[{'name':_0x8afa('0x6d'),'value':_0x5094c7[_0x8afa('0x6d')]||(_0x5094c7[_0x8afa('0x60')]&&_0x5094c7[_0x8afa('0x60')][0x0]?_0x5094c7[_0x8afa('0x60')][0x0][_0x8afa('0x61')]:undefined)||'total'},{'name':_0x8afa('0x6e'),'value':_0x5094c7[_0x8afa('0x6e')]||(_0x5094c7[_0x8afa('0x60')]&&_0x5094c7[_0x8afa('0x60')][0x1]?_0x5094c7[_0x8afa('0x60')][0x1][_0x8afa('0x61')]:undefined)||null},{'name':_0x8afa('0x6f'),'value':_0x5094c7[_0x8afa('0x6f')]||(_0x5094c7[_0x8afa('0x60')]&&_0x5094c7['attrs'][0x2]?_0x5094c7[_0x8afa('0x60')][0x2]['value']:undefined)||null},{'name':_0x8afa('0x6a'),'value':_0x5094c7[_0x8afa('0x6a')]||(_0x5094c7[_0x8afa('0x60')]&&_0x5094c7[_0x8afa('0x60')][0x3]?_0x5094c7[_0x8afa('0x60')][0x3][_0x8afa('0x61')]:undefined)||[]}];case _0x8afa('0x70'):return[{'name':'attrReport','type':_0x5094c7['reportType']||(_0x5094c7['attrs']&&_0x5094c7[_0x8afa('0x60')][0x0]?_0x5094c7[_0x8afa('0x60')][0x0][_0x8afa('0x31')]:undefined)||null,'value':_0x5094c7[_0x8afa('0x71')]||(_0x5094c7[_0x8afa('0x60')]&&_0x5094c7[_0x8afa('0x60')][0x0]?_0x5094c7[_0x8afa('0x60')][0x0][_0x8afa('0x61')]:undefined)||null},{'name':_0x8afa('0x72'),'value':_0x5094c7['attrRefresh']||(_0x5094c7[_0x8afa('0x60')]&&_0x5094c7[_0x8afa('0x60')][0x1]?_0x5094c7[_0x8afa('0x60')][0x1][_0x8afa('0x61')]:undefined)||0x0}];default:return[];}}catch(_0x37a9ea){logger[_0x8afa('0x2a')](_0x8afa('0x73'),JSON[_0x8afa('0x74')](_0x37a9ea));return[];}}exports[_0x8afa('0x75')]=function(_0x4aeead,_0x2798b1,_0x5be293){if(_0x4aeead[_0x8afa('0x4d')]['id']){delete _0x4aeead[_0x8afa('0x4d')]['id'];}return db['Dashboard']['find']({'where':{'id':_0x4aeead[_0x8afa('0x5d')]['id']}})[_0x8afa('0x28')](handleEntityNotFound(_0x2798b1,null))[_0x8afa('0x28')](function(_0x3a1786){if(_0x3a1786){_0x4aeead[_0x8afa('0x4d')][_0x8afa('0x76')]=_0x3a1786['id'];_0x4aeead[_0x8afa('0x4d')]['attrs']=widgetAttributes(_0x4aeead[_0x8afa('0x4d')]);return db[_0x8afa('0x77')][_0x8afa('0x4c')](_0x4aeead[_0x8afa('0x4d')]);}})[_0x8afa('0x28')](respondWithResult(_0x2798b1,null))[_0x8afa('0x48')](handleError(_0x2798b1,null));};exports[_0x8afa('0x78')]=function(_0x21b124,_0x266302,_0xffe008){var _0x1579b7={};var _0x2661e9={};var _0x414769;var _0x5ab7b9;return db[_0x8afa('0x2e')][_0x8afa('0x79')]({'where':{'id':_0x21b124[_0x8afa('0x5d')]['id']}})[_0x8afa('0x28')](handleEntityNotFound(_0x266302,null))[_0x8afa('0x28')](function(_0x3bfdd6){if(_0x3bfdd6){_0x414769=_0x3bfdd6;_0x2661e9['model']=_[_0x8afa('0x4a')](db[_0x8afa('0x77')]['rawAttributes']);_0x2661e9['query']=_[_0x8afa('0x4a')](_0x21b124[_0x8afa('0x36')]);_0x2661e9['filters']=_[_0x8afa('0x35')](_0x2661e9[_0x8afa('0x33')],_0x2661e9[_0x8afa('0x36')]);_0x1579b7[_0x8afa('0x37')]=_[_0x8afa('0x35')](_0x2661e9[_0x8afa('0x33')],qs[_0x8afa('0x38')](_0x21b124[_0x8afa('0x36')][_0x8afa('0x38')]));_0x1579b7['attributes']=_0x1579b7[_0x8afa('0x37')][_0x8afa('0x39')]?_0x1579b7[_0x8afa('0x37')]:_0x2661e9[_0x8afa('0x33')];_0x1579b7[_0x8afa('0x3d')]=qs['sort'](_0x21b124[_0x8afa('0x36')][_0x8afa('0x3e')]);_0x1579b7[_0x8afa('0x3f')]=qs[_0x8afa('0x34')](_[_0x8afa('0x40')](_0x21b124[_0x8afa('0x36')],_0x2661e9[_0x8afa('0x34')]));if(_0x21b124['query'][_0x8afa('0x41')]){_0x1579b7[_0x8afa('0x3f')]=_[_0x8afa('0x42')](_0x1579b7[_0x8afa('0x3f')],{'$or':_[_0x8afa('0x43')](_0x1579b7[_0x8afa('0x37')],function(_0x79358){var _0x16eb12={};_0x16eb12[_0x79358]={'$like':'%'+_0x21b124['query'][_0x8afa('0x41')]+'%'};return _0x16eb12;})});}_0x1579b7=_[_0x8afa('0x42')]({},_0x1579b7,_0x21b124[_0x8afa('0x56')]);return _0x414769[_0x8afa('0x78')](_0x1579b7);}})[_0x8afa('0x28')](function(_0x257a4c){if(_0x257a4c){_0x5ab7b9=_0x257a4c[_0x8afa('0x39')];if(!_0x21b124[_0x8afa('0x36')][_0x8afa('0x3a')]('nolimit')){_0x1579b7[_0x8afa('0x3c')]=qs[_0x8afa('0x3c')](_0x21b124[_0x8afa('0x36')][_0x8afa('0x3c')]);_0x1579b7[_0x8afa('0x22')]=qs[_0x8afa('0x22')](_0x21b124['query'][_0x8afa('0x22')]);}return _0x414769[_0x8afa('0x78')](_0x1579b7);}})[_0x8afa('0x28')](function(_0x35b651){if(_0x35b651){return _0x35b651?{'count':_0x5ab7b9,'rows':_0x35b651}:null;}})[_0x8afa('0x28')](respondWithResult(_0x266302,null))[_0x8afa('0x48')](handleError(_0x266302,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index e7a480b..461c487 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 _0x6c24=['Dashboard','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x383780,_0x3309eb){var _0x3c4bc8=function(_0x1b70ab){while(--_0x1b70ab){_0x383780['push'](_0x383780['shift']());}};_0x3c4bc8(++_0x3309eb);}(_0x6c24,0x1db));var _0x46c2=function(_0x3a077f,_0x576e25){_0x3a077f=_0x3a077f-0x0;var _0x3ea13c=_0x6c24[_0x3a077f];return _0x3ea13c;};'use strict';var EventEmitter=require(_0x46c2('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x46c2('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x46c2('0x2')};function emitEvent(_0x234da1){return function(_0x555f4f,_0x3534b8,_0x57aa0b){DashboardEvents[_0x46c2('0x3')](_0x234da1+':'+_0x555f4f['id'],_0x555f4f);DashboardEvents['emit'](_0x234da1,_0x555f4f);_0x57aa0b(null);};}for(var e in events){if(events[_0x46c2('0x4')](e)){var event=events[e];Dashboard[_0x46c2('0x5')](e,emitEvent(event));}}module[_0x46c2('0x6')]=DashboardEvents; \ No newline at end of file +var _0x6e12=['exports','events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x5d1824,_0xf69d16){var _0x143bdc=function(_0xa8d201){while(--_0xa8d201){_0x5d1824['push'](_0x5d1824['shift']());}};_0x143bdc(++_0xf69d16);}(_0x6e12,0x1e7));var _0x26e1=function(_0x46e68a,_0x5a0d98){_0x46e68a=_0x46e68a-0x0;var _0x5d6551=_0x6e12[_0x46e68a];return _0x5d6551;};'use strict';var EventEmitter=require(_0x26e1('0x0'));var Dashboard=require(_0x26e1('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x26e1('0x2')](0x0);var events={'afterCreate':_0x26e1('0x3'),'afterUpdate':_0x26e1('0x4'),'afterDestroy':'remove'};function emitEvent(_0x58f0cb){return function(_0x5ba942,_0x6a843b,_0x423e97){DashboardEvents[_0x26e1('0x5')](_0x58f0cb+':'+_0x5ba942['id'],_0x5ba942);DashboardEvents['emit'](_0x58f0cb,_0x5ba942);_0x423e97(null);};}for(var e in events){if(events[_0x26e1('0x6')](e)){var event=events[e];Dashboard[_0x26e1('0x7')](e,emitEvent(event));}}module[_0x26e1('0x8')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 0c2b4de..ee0fb9b 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 _0x3845=['path','../../config/environment','./dashboard.attributes','exports','Dashboard','lodash','util','moment','request-promise'];(function(_0x339129,_0x86dcc6){var _0x1570df=function(_0x3b537e){while(--_0x3b537e){_0x339129['push'](_0x339129['shift']());}};_0x1570df(++_0x86dcc6);}(_0x3845,0xcb));var _0x5384=function(_0xca9bcd,_0x54e883){_0xca9bcd=_0xca9bcd-0x0;var _0x521e98=_0x3845[_0xca9bcd];return _0x521e98;};'use strict';var _=require(_0x5384('0x0'));var util=require(_0x5384('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5384('0x2'));var BPromise=require('bluebird');var rp=require(_0x5384('0x3'));var fs=require('fs');var path=require(_0x5384('0x4'));var rimraf=require('rimraf');var config=require(_0x5384('0x5'));var attributes=require(_0x5384('0x6'));module[_0x5384('0x7')]=function(_0x3dd4d6,_0x163ded){return _0x3dd4d6['define'](_0x5384('0x8'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x95e1=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash','util'];(function(_0x4dc845,_0x3ef798){var _0x3c50f6=function(_0x46a1e5){while(--_0x46a1e5){_0x4dc845['push'](_0x4dc845['shift']());}};_0x3c50f6(++_0x3ef798);}(_0x95e1,0xc1));var _0x195e=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x95e1[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x195e('0x0'));var util=require(_0x195e('0x1'));var logger=require(_0x195e('0x2'))(_0x195e('0x3'));var moment=require(_0x195e('0x4'));var BPromise=require(_0x195e('0x5'));var rp=require(_0x195e('0x6'));var fs=require('fs');var path=require(_0x195e('0x7'));var rimraf=require(_0x195e('0x8'));var config=require(_0x195e('0x9'));var attributes=require(_0x195e('0xa'));module[_0x195e('0xb')]=function(_0x4a23fd,_0x2c2c5f){return _0x4a23fd[_0x195e('0xc')](_0x195e('0xd'),attributes,{'tableName':_0x195e('0xe'),'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 1e7eb74..13a6368 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 _0x8cab=['../../config/logger','rpc','../../config/environment','http','localhost','socket.io-emitter','redis','register','then','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','Dashboard,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4dfd78,_0x3ce417){var _0x4377e8=function(_0x4c10f8){while(--_0x4c10f8){_0x4dfd78['push'](_0x4dfd78['shift']());}};_0x4377e8(++_0x3ce417);}(_0x8cab,0x13d));var _0xb8ca=function(_0x8d02f2,_0x3e53d4){_0x8d02f2=_0x8d02f2-0x0;var _0x16512f=_0x8cab[_0x8d02f2];return _0x16512f;};'use strict';var _=require(_0xb8ca('0x0'));var util=require(_0xb8ca('0x1'));var moment=require('moment');var BPromise=require(_0xb8ca('0x2'));var rs=require(_0xb8ca('0x3'));var fs=require('fs');var Redis=require(_0xb8ca('0x4'));var db=require(_0xb8ca('0x5'))['db'];var utils=require(_0xb8ca('0x6'));var logger=require(_0xb8ca('0x7'))(_0xb8ca('0x8'));var config=require(_0xb8ca('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb8ca('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xb8ca('0xb'),'port':0x18eb});var socket=require(_0xb8ca('0xc'))(new Redis(config[_0xb8ca('0xd')]));require('./dashboard.socket')[_0xb8ca('0xe')](socket);function respondWithRpcPromise(_0x19aae2,_0x4dfe27,_0x1b6dd9){return new BPromise(function(_0x551075,_0x3c4eac){return client['request'](_0x19aae2,_0x1b6dd9)[_0xb8ca('0xf')](function(_0x530929){logger['info']('Dashboard,\x20%s,\x20%s',_0x4dfe27,_0xb8ca('0x10'));logger[_0xb8ca('0x11')](_0xb8ca('0x12'),_0x4dfe27,'request\x20sent',JSON[_0xb8ca('0x13')](_0x530929));if(_0x530929[_0xb8ca('0x14')]){if(_0x530929[_0xb8ca('0x14')][_0xb8ca('0x15')]===0x1f4){logger[_0xb8ca('0x14')](_0xb8ca('0x16'),_0x4dfe27,_0x530929[_0xb8ca('0x14')][_0xb8ca('0x17')]);return _0x3c4eac(_0x530929[_0xb8ca('0x14')][_0xb8ca('0x17')]);}logger['error'](_0xb8ca('0x16'),_0x4dfe27,_0x530929[_0xb8ca('0x14')][_0xb8ca('0x17')]);return _0x551075(_0x530929[_0xb8ca('0x14')]['message']);}else{logger[_0xb8ca('0x18')](_0xb8ca('0x16'),_0x4dfe27,_0xb8ca('0x10'));_0x551075(_0x530929[_0xb8ca('0x19')]['message']);}})[_0xb8ca('0x1a')](function(_0x35a7fb){logger['error'](_0xb8ca('0x16'),_0x4dfe27,_0x35a7fb);_0x3c4eac(_0x35a7fb);});});} \ No newline at end of file +var _0xc57c=['defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x1e3d59,_0x3d2e8b){var _0x19c9a4=function(_0x494641){while(--_0x494641){_0x1e3d59['push'](_0x1e3d59['shift']());}};_0x19c9a4(++_0x3d2e8b);}(_0xc57c,0x149));var _0xcc57=function(_0x5f247f,_0x2628ad){_0x5f247f=_0x5f247f-0x0;var _0x27a9b3=_0xc57c[_0x5f247f];return _0x27a9b3;};'use strict';var _=require(_0xcc57('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcc57('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcc57('0x2'));var logger=require('../../config/logger')(_0xcc57('0x3'));var config=require(_0xcc57('0x4'));var jayson=require(_0xcc57('0x5'));var client=jayson[_0xcc57('0x6')][_0xcc57('0x7')]({'port':0x232a});config[_0xcc57('0x8')]=_[_0xcc57('0x9')](config['redis'],{'host':_0xcc57('0xa'),'port':0x18eb});var socket=require(_0xcc57('0xb'))(new Redis(config[_0xcc57('0x8')]));require(_0xcc57('0xc'))[_0xcc57('0xd')](socket);function respondWithRpcPromise(_0x1a8031,_0x35916b,_0x551a73){return new BPromise(function(_0x4c7e7c,_0x51be8c){return client[_0xcc57('0xe')](_0x1a8031,_0x551a73)[_0xcc57('0xf')](function(_0x5a5444){logger[_0xcc57('0x10')](_0xcc57('0x11'),_0x35916b,_0xcc57('0x12'));logger[_0xcc57('0x13')](_0xcc57('0x14'),_0x35916b,_0xcc57('0x12'),JSON[_0xcc57('0x15')](_0x5a5444));if(_0x5a5444[_0xcc57('0x16')]){if(_0x5a5444[_0xcc57('0x16')][_0xcc57('0x17')]===0x1f4){logger['error']('Dashboard,\x20%s,\x20%s',_0x35916b,_0x5a5444['error'][_0xcc57('0x18')]);return _0x51be8c(_0x5a5444[_0xcc57('0x16')][_0xcc57('0x18')]);}logger[_0xcc57('0x16')](_0xcc57('0x11'),_0x35916b,_0x5a5444['error'][_0xcc57('0x18')]);return _0x4c7e7c(_0x5a5444[_0xcc57('0x16')]['message']);}else{logger[_0xcc57('0x10')]('Dashboard,\x20%s,\x20%s',_0x35916b,_0xcc57('0x12'));_0x4c7e7c(_0x5a5444['result'][_0xcc57('0x18')]);}})[_0xcc57('0x19')](function(_0x24b749){logger['error'](_0xcc57('0x11'),_0x35916b,_0x24b749);_0x51be8c(_0x24b749);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index ec7cea2..e1cf03a 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 _0xbdca=['remove','emit','removeListener','register','length','dashboard:','./dashboard.events','save'];(function(_0x453acf,_0x3c10c6){var _0x49c3c1=function(_0x5cfb88){while(--_0x5cfb88){_0x453acf['push'](_0x453acf['shift']());}};_0x49c3c1(++_0x3c10c6);}(_0xbdca,0x7e));var _0xabdc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbdca[_0x3dd15e];return _0x231fd0;};'use strict';var DashboardEvents=require(_0xabdc('0x0'));var events=[_0xabdc('0x1'),_0xabdc('0x2'),'update'];function createListener(_0x34b62c,_0x4ba9b3){return function(_0x5370fc){_0x4ba9b3[_0xabdc('0x3')](_0x34b62c,_0x5370fc);};}function removeListener(_0x24a0d3,_0x19d893){return function(){DashboardEvents[_0xabdc('0x4')](_0x24a0d3,_0x19d893);};}exports[_0xabdc('0x5')]=function(_0x3a00ce){for(var _0x317ae0=0x0,_0x24e2e5=events[_0xabdc('0x6')];_0x317ae0<_0x24e2e5;_0x317ae0++){var _0x238754=events[_0x317ae0];var _0x44da74=createListener(_0xabdc('0x7')+_0x238754,_0x3a00ce);DashboardEvents['on'](_0x238754,_0x44da74);}}; \ No newline at end of file +var _0xfc65=['emit','register','length','./dashboard.events','save'];(function(_0x2f62aa,_0x108e95){var _0x1a341f=function(_0x3aedcf){while(--_0x3aedcf){_0x2f62aa['push'](_0x2f62aa['shift']());}};_0x1a341f(++_0x108e95);}(_0xfc65,0x125));var _0x5fc6=function(_0x59c99b,_0x282514){_0x59c99b=_0x59c99b-0x0;var _0x2e4b23=_0xfc65[_0x59c99b];return _0x2e4b23;};'use strict';var DashboardEvents=require(_0x5fc6('0x0'));var events=[_0x5fc6('0x1'),'remove','update'];function createListener(_0x3005d5,_0xa05a56){return function(_0x28adc7){_0xa05a56[_0x5fc6('0x2')](_0x3005d5,_0x28adc7);};}function removeListener(_0x145cb7,_0x3e9d34){return function(){DashboardEvents['removeListener'](_0x145cb7,_0x3e9d34);};}exports[_0x5fc6('0x3')]=function(_0x204c7d){for(var _0x54ac86=0x0,_0x6d12a1=events[_0x5fc6('0x4')];_0x54ac86<_0x6d12a1;_0x54ac86++){var _0x2ba1df=events[_0x54ac86];var _0x129a0b=createListener('dashboard:'+_0x2ba1df,_0x204c7d);DashboardEvents['on'](_0x2ba1df,_0x129a0b);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 85b5d02..639dd91 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 _0xa9e0=['/:id','/:id/items','post','create','/:id/clone','addItem','put','update','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated'];(function(_0x33f1ef,_0x16e79b){var _0x3e8f49=function(_0x114a84){while(--_0x114a84){_0x33f1ef['push'](_0x33f1ef['shift']());}};_0x3e8f49(++_0x16e79b);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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['show']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['getItems']);router[_0x0a9e('0xb')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xb')](_0x0a9e('0xd'),auth[_0x0a9e('0x8')](),controller['clone']);router['post']('/:id/items',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')]('/:id',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);module[_0x0a9e('0x13')]=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(_0x4b3e49,_0x9e566c){var _0x57e339=function(_0x1430e9){while(--_0x1430e9){_0x4b3e49['push'](_0x4b3e49['shift']());}};_0x57e339(++_0x9e566c);}(_0xb7e7,0x121));var _0x7b7e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xb7e7[_0x3947c9];return _0x2e7871;};'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 ae6696b..beadfe8 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 _0xe425=['lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs','stringify','INTEGER','#ffffff','sequelize','squel'];(function(_0x57f228,_0x5d9ee4){var _0x9df7a3=function(_0x5fd2f1){while(--_0x5fd2f1){_0x57f228['push'](_0x57f228['shift']());}};_0x9df7a3(++_0x5d9ee4);}(_0xe425,0x16a));var _0x5e42=function(_0x1aaeb5,_0x48d8ed){_0x1aaeb5=_0x1aaeb5-0x0;var _0x54451a=_0xe425[_0x1aaeb5];return _0x54451a;};'use strict';var Sequelize=require(_0x5e42('0x0'));var squel=require(_0x5e42('0x1'));var _=require(_0x5e42('0x2'));module[_0x5e42('0x3')]={'title':{'type':Sequelize[_0x5e42('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0x5e42('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x5e42('0x5')](_0x5e42('0x6')),'get':function(){try{return JSON[_0x5e42('0x7')](this[_0x5e42('0x8')](_0x5e42('0x9')));}catch(_0x21ed0b){return[];}},'set':function(_0x402c4a){try{this['setDataValue']('attrs',JSON[_0x5e42('0xa')](_0x402c4a));}catch(_0x2ea5e1){this['setDataValue'](_0x5e42('0x9'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x5e42('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x5e42('0xb')]},'col':{'type':Sequelize[_0x5e42('0xb')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5e42('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x5e42('0x4')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x5e42('0x4')]}}; \ No newline at end of file +var _0x6186=['long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','squel','lodash','exports','STRING','TEXT'];(function(_0x54b933,_0x1b6c35){var _0x2e6dcf=function(_0xcc3c03){while(--_0xcc3c03){_0x54b933['push'](_0x54b933['shift']());}};_0x2e6dcf(++_0x1b6c35);}(_0x6186,0x19f));var _0x6618=function(_0x303064,_0x12f0c2){_0x303064=_0x303064-0x0;var _0x5a1d3d=_0x6186[_0x303064];return _0x5a1d3d;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x6618('0x0'));var _=require(_0x6618('0x1'));module[_0x6618('0x2')]={'title':{'type':Sequelize[_0x6618('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x6618('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x6618('0x4')](_0x6618('0x5')),'get':function(){try{return JSON[_0x6618('0x6')](this[_0x6618('0x7')](_0x6618('0x8')));}catch(_0x54b961){return[];}},'set':function(_0x2cc240){try{this[_0x6618('0x9')](_0x6618('0x8'),JSON[_0x6618('0xa')](_0x2cc240));}catch(_0x18c1c4){this[_0x6618('0x9')](_0x6618('0x8'),JSON[_0x6618('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0x6618('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x6618('0xb')]},'col':{'type':Sequelize[_0x6618('0xb')]},'background':{'type':Sequelize[_0x6618('0x3')],'allowNull':![],'defaultValue':_0x6618('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6618('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x6618('0x3')]}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index f3ca8d8..02b0561 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 _0x19ff=['https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','html-pdf','zip-dir','fast-json-patch','request-promise','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','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./dashboardItem.socket','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','error','stack','name','send','show','params','model','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','options','DashboardItem','find','then','catch','destroy','type','iframe','attrUrl','attrs'];(function(_0x43d495,_0x2d074c){var _0x4ab769=function(_0x569ae4){while(--_0x569ae4){_0x43d495['push'](_0x43d495['shift']());}};_0x4ab769(++_0x2d074c);}(_0x19ff,0x12a));var _0xf19f=function(_0x2fe245,_0x608257){_0x2fe245=_0x2fe245-0x0;var _0x21c004=_0x19ff[_0x2fe245];return _0x21c004;};'use strict';var pdf=require(_0xf19f('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf19f('0x1'));var jsonpatch=require(_0xf19f('0x2'));var rp=require(_0xf19f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf19f('0x4'));var util=require(_0xf19f('0x5'));var path=require(_0xf19f('0x6'));var sox=require('sox');var csv=require(_0xf19f('0x7'));var ejs=require(_0xf19f('0x8'));var fs=require('fs');var _=require(_0xf19f('0x9'));var squel=require(_0xf19f('0xa'));var crypto=require(_0xf19f('0xb'));var jsforce=require(_0xf19f('0xc'));var deskjs=require(_0xf19f('0xd'));var toCsv=require(_0xf19f('0x7'));var querystring=require(_0xf19f('0xe'));var Papa=require(_0xf19f('0xf'));var Redis=require(_0xf19f('0x10'));var authService=require(_0xf19f('0x11'));var qs=require(_0xf19f('0x12'));var as=require(_0xf19f('0x13'));var hardwareService=require(_0xf19f('0x14'));var logger=require(_0xf19f('0x15'))(_0xf19f('0x16'));var utils=require('../../config/utils');var config=require(_0xf19f('0x17'));var db=require(_0xf19f('0x18'))['db'];config[_0xf19f('0x19')]=_[_0xf19f('0x1a')](config[_0xf19f('0x19')],{'host':_0xf19f('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf19f('0x19')]));require(_0xf19f('0x1c'))['register'](socket);function respondWithStatusCode(_0x12fd14,_0x328a48){_0x328a48=_0x328a48||0xcc;return function(_0x40f4d3){if(_0x40f4d3){return _0x12fd14[_0xf19f('0x1d')](_0x328a48);}return _0x12fd14[_0xf19f('0x1e')](_0x328a48)[_0xf19f('0x1f')]();};}function respondWithResult(_0xb3ce48,_0x512dfc){_0x512dfc=_0x512dfc||0xc8;return function(_0x583c22){if(_0x583c22){return _0xb3ce48[_0xf19f('0x1e')](_0x512dfc)[_0xf19f('0x20')](_0x583c22);}};}function respondWithFilteredResult(_0x88c25c,_0x39d685){return function(_0x164420){if(_0x164420){var _0x1c9c6e=_0x164420[_0xf19f('0x21')],_0x418309=_0x39d685[_0xf19f('0x22')],_0x3d26a6=_0x39d685[_0xf19f('0x22')]+_0x39d685[_0xf19f('0x23')],_0x2db30f;if(_0x3d26a6>=_0x1c9c6e){_0x3d26a6=_0x1c9c6e;_0x2db30f=0xc8;}else{_0x2db30f=0xce;}_0x88c25c['status'](_0x2db30f);return _0x88c25c[_0xf19f('0x24')]('Content-Range',_0x418309+'-'+_0x3d26a6+'/'+_0x1c9c6e)[_0xf19f('0x20')](_0x164420);}return null;};}function patchUpdates(_0x48b684){return function(_0x15d258){try{jsonpatch[_0xf19f('0x25')](_0x15d258,_0x48b684,!![]);}catch(_0x972945){return BPromise[_0xf19f('0x26')](_0x972945);}return _0x15d258['save']();};}function saveUpdates(_0x80a855,_0x2845f9){return function(_0x9b277a){if(_0x9b277a){return _0x9b277a[_0xf19f('0x27')](_0x80a855)['then'](function(_0x156bfd){return _0x156bfd;});}return null;};}function removeEntity(_0x5c294b,_0x133179){return function(_0x220e3e){if(_0x220e3e){return _0x220e3e['destroy']()['then'](function(){_0x5c294b['status'](0xcc)[_0xf19f('0x1f')]();});}};}function handleEntityNotFound(_0x496546,_0x47b621){return function(_0x2dc4e9){if(!_0x2dc4e9){_0x496546[_0xf19f('0x1d')](0x194);}return _0x2dc4e9;};}function handleError(_0x1a4d81,_0x20efba){_0x20efba=_0x20efba||0x1f4;return function(_0x1a0613){logger[_0xf19f('0x28')](_0x1a0613[_0xf19f('0x29')]);if(_0x1a0613[_0xf19f('0x2a')]){delete _0x1a0613['name'];}_0x1a4d81[_0xf19f('0x1e')](_0x20efba)[_0xf19f('0x2b')](_0x1a0613);};}exports[_0xf19f('0x2c')]=function(_0x52e227,_0x2d23bd){var _0x3a28a3={'raw':![],'where':{'id':_0x52e227[_0xf19f('0x2d')]['id']}},_0x20f226={};_0x20f226[_0xf19f('0x2e')]=_['keys'](db['DashboardItem'][_0xf19f('0x2f')]);_0x20f226[_0xf19f('0x30')]=_['keys'](_0x52e227['query']);_0x20f226[_0xf19f('0x31')]=_[_0xf19f('0x32')](_0x20f226['model'],_0x20f226[_0xf19f('0x30')]);_0x3a28a3[_0xf19f('0x33')]=_[_0xf19f('0x32')](_0x20f226['model'],qs[_0xf19f('0x34')](_0x52e227[_0xf19f('0x30')][_0xf19f('0x34')]));_0x3a28a3[_0xf19f('0x33')]=_0x3a28a3['attributes'][_0xf19f('0x35')]?_0x3a28a3[_0xf19f('0x33')]:_0x20f226[_0xf19f('0x2e')];if(_0x52e227['query'][_0xf19f('0x36')]){_0x3a28a3[_0xf19f('0x37')]=[{'all':!![]}];}_0x3a28a3=_['merge']({},_0x3a28a3,_0x52e227[_0xf19f('0x38')]);return db[_0xf19f('0x39')][_0xf19f('0x3a')](_0x3a28a3)['then'](handleEntityNotFound(_0x2d23bd,null))[_0xf19f('0x3b')](respondWithResult(_0x2d23bd,null))[_0xf19f('0x3c')](handleError(_0x2d23bd,null));};exports[_0xf19f('0x3d')]=function(_0x4d2513,_0x4221f9){return db[_0xf19f('0x39')][_0xf19f('0x3a')]({'where':{'id':_0x4d2513[_0xf19f('0x2d')]['id']}})[_0xf19f('0x3b')](handleEntityNotFound(_0x4221f9,null))[_0xf19f('0x3b')](removeEntity(_0x4221f9,null))[_0xf19f('0x3c')](handleError(_0x4221f9,null));};function widgetAttributes(_0x5dda52){try{switch(_0x5dda52[_0xf19f('0x3e')]){case _0xf19f('0x3f'):return[{'name':_0xf19f('0x40'),'value':_0x5dda52['attrUrl']||(_0x5dda52[_0xf19f('0x41')]&&_0x5dda52['attrs'][0x0]?_0x5dda52['attrs'][0x0]['value']:undefined)||_0xf19f('0x42')}];case _0xf19f('0x43'):return[{'name':_0xf19f('0x44'),'value':_0x5dda52['attrPath']||(_0x5dda52[_0xf19f('0x41')]&&_0x5dda52[_0xf19f('0x41')][0x0]?_0x5dda52[_0xf19f('0x41')][0x0][_0xf19f('0x45')]:undefined)||''}];case _0xf19f('0x46'):return[{'name':_0xf19f('0x47'),'value':_0x5dda52[_0xf19f('0x47')]||(_0x5dda52[_0xf19f('0x41')]&&_0x5dda52[_0xf19f('0x41')][0x0]?_0x5dda52[_0xf19f('0x41')][0x0]['value']:undefined)||_0xf19f('0x48')},{'name':_0xf19f('0x49'),'value':_0x5dda52[_0xf19f('0x49')]||(_0x5dda52['attrs']&&_0x5dda52['attrs'][0x1]?_0x5dda52[_0xf19f('0x41')][0x1]['value']:undefined)||_0xf19f('0x4a')},{'name':'attrFontSize','value':_0x5dda52[_0xf19f('0x4b')]||(_0x5dda52[_0xf19f('0x41')]&&_0x5dda52[_0xf19f('0x41')][0x2]?_0x5dda52[_0xf19f('0x41')][0x2]['value']:undefined)||0xc}];case _0xf19f('0x4c'):return[{'name':_0xf19f('0x4d'),'value':_0x5dda52['attrMetric']||(_0x5dda52[_0xf19f('0x41')]&&_0x5dda52[_0xf19f('0x41')][0x0]?_0x5dda52['attrs'][0x0][_0xf19f('0x45')]:undefined)||_0xf19f('0x4e')},{'name':_0xf19f('0x4f'),'value':_0x5dda52[_0xf19f('0x4f')]||(_0x5dda52[_0xf19f('0x41')]&&_0x5dda52[_0xf19f('0x41')][0x1]?_0x5dda52[_0xf19f('0x41')][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x5dda52[_0xf19f('0x4b')]||(_0x5dda52['attrs']&&_0x5dda52['attrs'][0x2]?_0x5dda52[_0xf19f('0x41')][0x2][_0xf19f('0x45')]:undefined)||0x14}];case _0xf19f('0x50'):case'pie-chart':return[{'name':_0xf19f('0x51'),'value':_0x5dda52[_0xf19f('0x51')]||(_0x5dda52[_0xf19f('0x41')]&&_0x5dda52['attrs'][0x0]?_0x5dda52[_0xf19f('0x41')][0x0]['value']:undefined)||_0xf19f('0x4e')},{'name':_0xf19f('0x52'),'value':_0x5dda52['attrSerie2']||(_0x5dda52[_0xf19f('0x41')]&&_0x5dda52[_0xf19f('0x41')][0x1]?_0x5dda52[_0xf19f('0x41')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x5dda52[_0xf19f('0x53')]||(_0x5dda52[_0xf19f('0x41')]&&_0x5dda52[_0xf19f('0x41')][0x2]?_0x5dda52[_0xf19f('0x41')][0x2]['value']:undefined)||null},{'name':_0xf19f('0x4f'),'value':_0x5dda52[_0xf19f('0x4f')]||(_0x5dda52['attrs']&&_0x5dda52['attrs'][0x3]?_0x5dda52['attrs'][0x3][_0xf19f('0x45')]:undefined)||[]}];case'web-report':return[{'name':_0xf19f('0x54'),'type':_0x5dda52[_0xf19f('0x55')]||(_0x5dda52[_0xf19f('0x41')]&&_0x5dda52[_0xf19f('0x41')][0x0]?_0x5dda52[_0xf19f('0x41')][0x0]['type']:undefined)||null,'value':_0x5dda52['attrReport']||(_0x5dda52[_0xf19f('0x41')]&&_0x5dda52[_0xf19f('0x41')][0x0]?_0x5dda52['attrs'][0x0][_0xf19f('0x45')]:undefined)||null},{'name':'attrRefresh','value':_0x5dda52[_0xf19f('0x56')]||(_0x5dda52[_0xf19f('0x41')]&&_0x5dda52[_0xf19f('0x41')][0x1]?_0x5dda52[_0xf19f('0x41')][0x1][_0xf19f('0x45')]:undefined)||0x0}];default:return[];}}catch(_0x4e96d8){logger[_0xf19f('0x28')](_0xf19f('0x57'),JSON[_0xf19f('0x58')](_0x4e96d8));return[];}}exports[_0xf19f('0x59')]=function(_0x5ce579,_0x3a7570){if(_0x5ce579[_0xf19f('0x5a')]){_0x5ce579['body']['attrs']=widgetAttributes(_0x5ce579[_0xf19f('0x5a')]);}return db[_0xf19f('0x39')][_0xf19f('0x59')](_0x5ce579[_0xf19f('0x5a')],{})[_0xf19f('0x3b')](respondWithResult(_0x3a7570,0xc9))[_0xf19f('0x3c')](handleError(_0x3a7570,null));};exports[_0xf19f('0x27')]=function(_0xbae2e7,_0xdefb60){if(_0xbae2e7['body']['id']){delete _0xbae2e7['body']['id'];}_0xbae2e7[_0xf19f('0x5a')][_0xf19f('0x41')]=widgetAttributes(_0xbae2e7[_0xf19f('0x5a')]);return db[_0xf19f('0x39')][_0xf19f('0x3a')]({'where':{'id':_0xbae2e7[_0xf19f('0x2d')]['id']}})['then'](handleEntityNotFound(_0xdefb60,null))[_0xf19f('0x3b')](saveUpdates(_0xbae2e7[_0xf19f('0x5a')],null))[_0xf19f('0x3b')](respondWithResult(_0xdefb60,null))[_0xf19f('0x3c')](handleError(_0xdefb60,null));}; \ No newline at end of file +var _0x0cca=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','json','offset','limit','set','apply','reject','save','update','end','error','name','send','show','params','model','DashboardItem','rawAttributes','query','keys','filters','intersection','fields','attributes','length','includeAll','include','merge','options','then','catch','find','iframe','attrs','https://','custom','attrPath','attrHourFormat','value','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','type','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0x3ce2a8,_0x1a47ef){var _0x5a9920=function(_0x5b8e19){while(--_0x5b8e19){_0x3ce2a8['push'](_0x3ce2a8['shift']());}};_0x5a9920(++_0x1a47ef);}(_0x0cca,0x152));var _0xa0cc=function(_0x589aee,_0x140a03){_0x589aee=_0x589aee-0x0;var _0x2f5ed4=_0x0cca[_0x589aee];return _0x2f5ed4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa0cc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa0cc('0x1'));var jsonpatch=require(_0xa0cc('0x2'));var rp=require(_0xa0cc('0x3'));var moment=require(_0xa0cc('0x4'));var BPromise=require(_0xa0cc('0x5'));var Mustache=require('mustache');var util=require(_0xa0cc('0x6'));var path=require(_0xa0cc('0x7'));var sox=require(_0xa0cc('0x8'));var csv=require(_0xa0cc('0x9'));var ejs=require(_0xa0cc('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa0cc('0xb'));var crypto=require(_0xa0cc('0xc'));var jsforce=require(_0xa0cc('0xd'));var deskjs=require(_0xa0cc('0xe'));var toCsv=require(_0xa0cc('0x9'));var querystring=require(_0xa0cc('0xf'));var Papa=require(_0xa0cc('0x10'));var Redis=require('ioredis');var authService=require(_0xa0cc('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa0cc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa0cc('0x13'))(_0xa0cc('0x14'));var utils=require(_0xa0cc('0x15'));var config=require(_0xa0cc('0x16'));var db=require(_0xa0cc('0x17'))['db'];config[_0xa0cc('0x18')]=_[_0xa0cc('0x19')](config[_0xa0cc('0x18')],{'host':_0xa0cc('0x1a'),'port':0x18eb});var socket=require(_0xa0cc('0x1b'))(new Redis(config[_0xa0cc('0x18')]));require(_0xa0cc('0x1c'))[_0xa0cc('0x1d')](socket);function respondWithStatusCode(_0x448d01,_0x5a684c){_0x5a684c=_0x5a684c||0xcc;return function(_0x39c77d){if(_0x39c77d){return _0x448d01[_0xa0cc('0x1e')](_0x5a684c);}return _0x448d01[_0xa0cc('0x1f')](_0x5a684c)['end']();};}function respondWithResult(_0x1c6245,_0x1738f4){_0x1738f4=_0x1738f4||0xc8;return function(_0x8fef95){if(_0x8fef95){return _0x1c6245['status'](_0x1738f4)[_0xa0cc('0x20')](_0x8fef95);}};}function respondWithFilteredResult(_0x557941,_0x403a6e){return function(_0x519206){if(_0x519206){var _0x4255d5=_0x519206['count'],_0x27ecc9=_0x403a6e[_0xa0cc('0x21')],_0x2e16cd=_0x403a6e[_0xa0cc('0x21')]+_0x403a6e[_0xa0cc('0x22')],_0xba1199;if(_0x2e16cd>=_0x4255d5){_0x2e16cd=_0x4255d5;_0xba1199=0xc8;}else{_0xba1199=0xce;}_0x557941[_0xa0cc('0x1f')](_0xba1199);return _0x557941[_0xa0cc('0x23')]('Content-Range',_0x27ecc9+'-'+_0x2e16cd+'/'+_0x4255d5)[_0xa0cc('0x20')](_0x519206);}return null;};}function patchUpdates(_0x54214c){return function(_0xf81c6e){try{jsonpatch[_0xa0cc('0x24')](_0xf81c6e,_0x54214c,!![]);}catch(_0x517b7b){return BPromise[_0xa0cc('0x25')](_0x517b7b);}return _0xf81c6e[_0xa0cc('0x26')]();};}function saveUpdates(_0x305818,_0x3254d5){return function(_0x1d9d0d){if(_0x1d9d0d){return _0x1d9d0d[_0xa0cc('0x27')](_0x305818)['then'](function(_0x3ecbc7){return _0x3ecbc7;});}return null;};}function removeEntity(_0x356d43,_0x9180f9){return function(_0x477766){if(_0x477766){return _0x477766['destroy']()['then'](function(){_0x356d43[_0xa0cc('0x1f')](0xcc)[_0xa0cc('0x28')]();});}};}function handleEntityNotFound(_0x1d1dac,_0x71eb5b){return function(_0x857c0c){if(!_0x857c0c){_0x1d1dac['sendStatus'](0x194);}return _0x857c0c;};}function handleError(_0x1bc3ca,_0x47a5b9){_0x47a5b9=_0x47a5b9||0x1f4;return function(_0x55a0f8){logger[_0xa0cc('0x29')](_0x55a0f8['stack']);if(_0x55a0f8[_0xa0cc('0x2a')]){delete _0x55a0f8[_0xa0cc('0x2a')];}_0x1bc3ca['status'](_0x47a5b9)[_0xa0cc('0x2b')](_0x55a0f8);};}exports[_0xa0cc('0x2c')]=function(_0xa49d61,_0x21a9c6){var _0x346119={'raw':![],'where':{'id':_0xa49d61[_0xa0cc('0x2d')]['id']}},_0x31fceb={};_0x31fceb[_0xa0cc('0x2e')]=_['keys'](db[_0xa0cc('0x2f')][_0xa0cc('0x30')]);_0x31fceb[_0xa0cc('0x31')]=_[_0xa0cc('0x32')](_0xa49d61['query']);_0x31fceb[_0xa0cc('0x33')]=_[_0xa0cc('0x34')](_0x31fceb[_0xa0cc('0x2e')],_0x31fceb[_0xa0cc('0x31')]);_0x346119['attributes']=_['intersection'](_0x31fceb['model'],qs[_0xa0cc('0x35')](_0xa49d61[_0xa0cc('0x31')][_0xa0cc('0x35')]));_0x346119[_0xa0cc('0x36')]=_0x346119[_0xa0cc('0x36')][_0xa0cc('0x37')]?_0x346119['attributes']:_0x31fceb['model'];if(_0xa49d61['query'][_0xa0cc('0x38')]){_0x346119[_0xa0cc('0x39')]=[{'all':!![]}];}_0x346119=_[_0xa0cc('0x3a')]({},_0x346119,_0xa49d61[_0xa0cc('0x3b')]);return db[_0xa0cc('0x2f')]['find'](_0x346119)[_0xa0cc('0x3c')](handleEntityNotFound(_0x21a9c6,null))[_0xa0cc('0x3c')](respondWithResult(_0x21a9c6,null))[_0xa0cc('0x3d')](handleError(_0x21a9c6,null));};exports['destroy']=function(_0x31b6da,_0x496cbd){return db['DashboardItem'][_0xa0cc('0x3e')]({'where':{'id':_0x31b6da[_0xa0cc('0x2d')]['id']}})[_0xa0cc('0x3c')](handleEntityNotFound(_0x496cbd,null))[_0xa0cc('0x3c')](removeEntity(_0x496cbd,null))[_0xa0cc('0x3d')](handleError(_0x496cbd,null));};function widgetAttributes(_0x3b223e){try{switch(_0x3b223e['type']){case _0xa0cc('0x3f'):return[{'name':'attrUrl','value':_0x3b223e['attrUrl']||(_0x3b223e[_0xa0cc('0x40')]&&_0x3b223e[_0xa0cc('0x40')][0x0]?_0x3b223e[_0xa0cc('0x40')][0x0]['value']:undefined)||_0xa0cc('0x41')}];case _0xa0cc('0x42'):return[{'name':_0xa0cc('0x43'),'value':_0x3b223e['attrPath']||(_0x3b223e[_0xa0cc('0x40')]&&_0x3b223e[_0xa0cc('0x40')][0x0]?_0x3b223e[_0xa0cc('0x40')][0x0]['value']:undefined)||''}];case'clock':return[{'name':_0xa0cc('0x44'),'value':_0x3b223e[_0xa0cc('0x44')]||(_0x3b223e['attrs']&&_0x3b223e['attrs'][0x0]?_0x3b223e[_0xa0cc('0x40')][0x0][_0xa0cc('0x45')]:undefined)||_0xa0cc('0x46')},{'name':_0xa0cc('0x47'),'value':_0x3b223e['attrTimezone']||(_0x3b223e[_0xa0cc('0x40')]&&_0x3b223e[_0xa0cc('0x40')][0x1]?_0x3b223e[_0xa0cc('0x40')][0x1][_0xa0cc('0x45')]:undefined)||'0.00'},{'name':_0xa0cc('0x48'),'value':_0x3b223e[_0xa0cc('0x48')]||(_0x3b223e[_0xa0cc('0x40')]&&_0x3b223e[_0xa0cc('0x40')][0x2]?_0x3b223e[_0xa0cc('0x40')][0x2]['value']:undefined)||0xc}];case _0xa0cc('0x49'):return[{'name':_0xa0cc('0x4a'),'value':_0x3b223e['attrMetric']||(_0x3b223e[_0xa0cc('0x40')]&&_0x3b223e[_0xa0cc('0x40')][0x0]?_0x3b223e['attrs'][0x0][_0xa0cc('0x45')]:undefined)||'total'},{'name':_0xa0cc('0x4b'),'value':_0x3b223e[_0xa0cc('0x4b')]||(_0x3b223e[_0xa0cc('0x40')]&&_0x3b223e['attrs'][0x1]?_0x3b223e['attrs'][0x1][_0xa0cc('0x45')]:undefined)||[]},{'name':'attrFontSize','value':_0x3b223e['attrFontSize']||(_0x3b223e[_0xa0cc('0x40')]&&_0x3b223e['attrs'][0x2]?_0x3b223e['attrs'][0x2]['value']:undefined)||0x14}];case _0xa0cc('0x4c'):case _0xa0cc('0x4d'):return[{'name':_0xa0cc('0x4e'),'value':_0x3b223e['attrSerie1']||(_0x3b223e[_0xa0cc('0x40')]&&_0x3b223e[_0xa0cc('0x40')][0x0]?_0x3b223e[_0xa0cc('0x40')][0x0][_0xa0cc('0x45')]:undefined)||'total'},{'name':_0xa0cc('0x4f'),'value':_0x3b223e['attrSerie2']||(_0x3b223e[_0xa0cc('0x40')]&&_0x3b223e[_0xa0cc('0x40')][0x1]?_0x3b223e[_0xa0cc('0x40')][0x1]['value']:undefined)||null},{'name':_0xa0cc('0x50'),'value':_0x3b223e[_0xa0cc('0x50')]||(_0x3b223e[_0xa0cc('0x40')]&&_0x3b223e[_0xa0cc('0x40')][0x2]?_0x3b223e[_0xa0cc('0x40')][0x2][_0xa0cc('0x45')]:undefined)||null},{'name':_0xa0cc('0x4b'),'value':_0x3b223e[_0xa0cc('0x4b')]||(_0x3b223e[_0xa0cc('0x40')]&&_0x3b223e[_0xa0cc('0x40')][0x3]?_0x3b223e[_0xa0cc('0x40')][0x3]['value']:undefined)||[]}];case'web-report':return[{'name':_0xa0cc('0x51'),'type':_0x3b223e[_0xa0cc('0x52')]||(_0x3b223e[_0xa0cc('0x40')]&&_0x3b223e[_0xa0cc('0x40')][0x0]?_0x3b223e[_0xa0cc('0x40')][0x0][_0xa0cc('0x53')]:undefined)||null,'value':_0x3b223e[_0xa0cc('0x51')]||(_0x3b223e['attrs']&&_0x3b223e[_0xa0cc('0x40')][0x0]?_0x3b223e[_0xa0cc('0x40')][0x0][_0xa0cc('0x45')]:undefined)||null},{'name':_0xa0cc('0x54'),'value':_0x3b223e['attrRefresh']||(_0x3b223e['attrs']&&_0x3b223e['attrs'][0x1]?_0x3b223e[_0xa0cc('0x40')][0x1][_0xa0cc('0x45')]:undefined)||0x0}];default:return[];}}catch(_0x258a9b){logger[_0xa0cc('0x29')](_0xa0cc('0x55'),JSON[_0xa0cc('0x56')](_0x258a9b));return[];}}exports[_0xa0cc('0x57')]=function(_0x3a74e7,_0xd4e38){if(_0x3a74e7['body']){_0x3a74e7[_0xa0cc('0x58')][_0xa0cc('0x40')]=widgetAttributes(_0x3a74e7[_0xa0cc('0x58')]);}return db['DashboardItem'][_0xa0cc('0x57')](_0x3a74e7[_0xa0cc('0x58')],{})[_0xa0cc('0x3c')](respondWithResult(_0xd4e38,0xc9))[_0xa0cc('0x3d')](handleError(_0xd4e38,null));};exports[_0xa0cc('0x27')]=function(_0x380613,_0x59f5b5){if(_0x380613[_0xa0cc('0x58')]['id']){delete _0x380613['body']['id'];}_0x380613[_0xa0cc('0x58')][_0xa0cc('0x40')]=widgetAttributes(_0x380613[_0xa0cc('0x58')]);return db[_0xa0cc('0x2f')]['find']({'where':{'id':_0x380613['params']['id']}})[_0xa0cc('0x3c')](handleEntityNotFound(_0x59f5b5,null))[_0xa0cc('0x3c')](saveUpdates(_0x380613[_0xa0cc('0x58')],null))['then'](respondWithResult(_0x59f5b5,null))[_0xa0cc('0x3d')](handleError(_0x59f5b5,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 442e067..a165bb8 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 _0x8a1a=['save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x2eb3db,_0x4a32c0){var _0x358f33=function(_0x1d0588){while(--_0x1d0588){_0x2eb3db['push'](_0x2eb3db['shift']());}};_0x358f33(++_0x4a32c0);}(_0x8a1a,0x110));var _0xa8a1=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0x8a1a[_0x54d4fe];return _0x1ab5bb;};'use strict';var EventEmitter=require(_0xa8a1('0x0'));var DashboardItem=require('../../mysqldb')['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa8a1('0x1'),'afterUpdate':_0xa8a1('0x2'),'afterDestroy':'remove'};function emitEvent(_0x3c1455){return function(_0x56d3eb,_0x4d9b44,_0x1f794b){DashboardItemEvents[_0xa8a1('0x3')](_0x3c1455+':'+_0x56d3eb['id'],_0x56d3eb);DashboardItemEvents[_0xa8a1('0x3')](_0x3c1455,_0x56d3eb);_0x1f794b(null);};}for(var e in events){if(events[_0xa8a1('0x4')](e)){var event=events[e];DashboardItem[_0xa8a1('0x5')](e,emitEvent(event));}}module[_0xa8a1('0x6')]=DashboardItemEvents; \ No newline at end of file +var _0xed00=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','update','remove'];(function(_0xd6af50,_0x4a2652){var _0x11ba01=function(_0x1eda4c){while(--_0x1eda4c){_0xd6af50['push'](_0xd6af50['shift']());}};_0x11ba01(++_0x4a2652);}(_0xed00,0xca));var _0x0ed0=function(_0x895358,_0x32f914){_0x895358=_0x895358-0x0;var _0x26e26e=_0xed00[_0x895358];return _0x26e26e;};'use strict';var EventEmitter=require(_0x0ed0('0x0'));var DashboardItem=require(_0x0ed0('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x0ed0('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0ed0('0x3'),'afterDestroy':_0x0ed0('0x4')};function emitEvent(_0x1644de){return function(_0x14ea52,_0x1fdc39,_0x3ceb6c){DashboardItemEvents[_0x0ed0('0x5')](_0x1644de+':'+_0x14ea52['id'],_0x14ea52);DashboardItemEvents[_0x0ed0('0x5')](_0x1644de,_0x14ea52);_0x3ceb6c(null);};}for(var e in events){if(events[_0x0ed0('0x6')](e)){var event=events[e];DashboardItem[_0x0ed0('0x7')](e,emitEvent(event));}}module[_0x0ed0('0x8')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index f0b405a..2e1c9f9 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 _0xad1b=['util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash'];(function(_0x43dfa1,_0x3455d8){var _0x717ade=function(_0x46a201){while(--_0x46a201){_0x43dfa1['push'](_0x43dfa1['shift']());}};_0x717ade(++_0x3455d8);}(_0xad1b,0x1c6));var _0xbad1=function(_0x47602a,_0x35be20){_0x47602a=_0x47602a-0x0;var _0x333836=_0xad1b[_0x47602a];return _0x333836;};'use strict';var _=require(_0xbad1('0x0'));var util=require(_0xbad1('0x1'));var logger=require(_0xbad1('0x2'))('api');var moment=require(_0xbad1('0x3'));var BPromise=require(_0xbad1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbad1('0x5'));var rimraf=require(_0xbad1('0x6'));var config=require(_0xbad1('0x7'));var attributes=require(_0xbad1('0x8'));module[_0xbad1('0x9')]=function(_0x1d54fc,_0x5e0562){return _0x1d54fc[_0xbad1('0xa')](_0xbad1('0xb'),attributes,{'tableName':_0xbad1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd5ab=['request-promise','define','DashboardItem','lodash','util','api','moment','bluebird'];(function(_0x11cb5d,_0x186502){var _0x2ba781=function(_0x596e7a){while(--_0x596e7a){_0x11cb5d['push'](_0x11cb5d['shift']());}};_0x2ba781(++_0x186502);}(_0xd5ab,0x163));var _0xbd5a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xd5ab[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xbd5a('0x0'));var util=require(_0xbd5a('0x1'));var logger=require('../../config/logger')(_0xbd5a('0x2'));var moment=require(_0xbd5a('0x3'));var BPromise=require(_0xbd5a('0x4'));var rp=require(_0xbd5a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./dashboardItem.attributes');module['exports']=function(_0x2e344d,_0x3e8f2f){return _0x2e344d[_0xbd5a('0x6')](_0xbd5a('0x7'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 6020686..6c79e73 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 _0x368f=['./dashboardItem.socket','register','then','info','DashboardItem,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','localhost','socket.io-emitter'];(function(_0x5d4405,_0x3e4872){var _0xfd017=function(_0x3bb87c){while(--_0x3bb87c){_0x5d4405['push'](_0x5d4405['shift']());}};_0xfd017(++_0x3e4872);}(_0x368f,0x11f));var _0xf368=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x368f[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xf368('0x0'));var util=require(_0xf368('0x1'));var moment=require('moment');var BPromise=require(_0xf368('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf368('0x3'));var db=require(_0xf368('0x4'))['db'];var utils=require(_0xf368('0x5'));var logger=require(_0xf368('0x6'))(_0xf368('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf368('0x8')][_0xf368('0x9')]({'port':0x232a});config[_0xf368('0xa')]=_['defaults'](config['redis'],{'host':_0xf368('0xb'),'port':0x18eb});var socket=require(_0xf368('0xc'))(new Redis(config['redis']));require(_0xf368('0xd'))[_0xf368('0xe')](socket);function respondWithRpcPromise(_0x37b555,_0xc5150b,_0xc93ddb){return new BPromise(function(_0x5f49f0,_0x5e3329){return client['request'](_0x37b555,_0xc93ddb)[_0xf368('0xf')](function(_0x429359){logger[_0xf368('0x10')](_0xf368('0x11'),_0xc5150b,'request\x20sent');logger[_0xf368('0x12')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0xc5150b,_0xf368('0x13'),JSON[_0xf368('0x14')](_0x429359));if(_0x429359[_0xf368('0x15')]){if(_0x429359['error'][_0xf368('0x16')]===0x1f4){logger['error'](_0xf368('0x11'),_0xc5150b,_0x429359[_0xf368('0x15')][_0xf368('0x17')]);return _0x5e3329(_0x429359[_0xf368('0x15')][_0xf368('0x17')]);}logger[_0xf368('0x15')](_0xf368('0x11'),_0xc5150b,_0x429359[_0xf368('0x15')][_0xf368('0x17')]);return _0x5f49f0(_0x429359['error'][_0xf368('0x17')]);}else{logger['info'](_0xf368('0x11'),_0xc5150b,_0xf368('0x13'));_0x5f49f0(_0x429359['result'][_0xf368('0x17')]);}})[_0xf368('0x18')](function(_0x3dbb0c){logger[_0xf368('0x15')](_0xf368('0x11'),_0xc5150b,_0x3dbb0c);_0x5e3329(_0x3dbb0c);});});} \ No newline at end of file +var _0x1e16=['catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','localhost','request','request\x20sent','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','info','result'];(function(_0x4cbdb7,_0x1b82f6){var _0x4ecb18=function(_0x48271f){while(--_0x48271f){_0x4cbdb7['push'](_0x4cbdb7['shift']());}};_0x4ecb18(++_0x1b82f6);}(_0x1e16,0xbe));var _0x61e1=function(_0x2a2166,_0x3a077f){_0x2a2166=_0x2a2166-0x0;var _0x3bcf50=_0x1e16[_0x2a2166];return _0x3bcf50;};'use strict';var _=require(_0x61e1('0x0'));var util=require('util');var moment=require(_0x61e1('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x61e1('0x2'));var db=require(_0x61e1('0x3'))['db'];var utils=require(_0x61e1('0x4'));var logger=require(_0x61e1('0x5'))(_0x61e1('0x6'));var config=require('../../config/environment');var jayson=require(_0x61e1('0x7'));var client=jayson[_0x61e1('0x8')]['http']({'port':0x232a});config[_0x61e1('0x9')]=_['defaults'](config['redis'],{'host':_0x61e1('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x61e1('0x9')]));require('./dashboardItem.socket')['register'](socket);function respondWithRpcPromise(_0x2d8828,_0x32044a,_0x28ca99){return new BPromise(function(_0x4ec780,_0x12c3b4){return client[_0x61e1('0xb')](_0x2d8828,_0x28ca99)['then'](function(_0x2716e7){logger['info']('DashboardItem,\x20%s,\x20%s',_0x32044a,'request\x20sent');logger['debug']('DashboardItem,\x20%s,\x20%s,\x20%s',_0x32044a,_0x61e1('0xc'),JSON[_0x61e1('0xd')](_0x2716e7));if(_0x2716e7[_0x61e1('0xe')]){if(_0x2716e7['error'][_0x61e1('0xf')]===0x1f4){logger[_0x61e1('0xe')](_0x61e1('0x10'),_0x32044a,_0x2716e7[_0x61e1('0xe')][_0x61e1('0x11')]);return _0x12c3b4(_0x2716e7[_0x61e1('0xe')][_0x61e1('0x11')]);}logger['error'](_0x61e1('0x10'),_0x32044a,_0x2716e7[_0x61e1('0xe')][_0x61e1('0x11')]);return _0x4ec780(_0x2716e7['error'][_0x61e1('0x11')]);}else{logger[_0x61e1('0x12')]('DashboardItem,\x20%s,\x20%s',_0x32044a,_0x61e1('0xc'));_0x4ec780(_0x2716e7[_0x61e1('0x13')]['message']);}})[_0x61e1('0x14')](function(_0x512a9a){logger['error'](_0x61e1('0x10'),_0x32044a,_0x512a9a);_0x12c3b4(_0x512a9a);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 5aedef4..be0632f 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 _0x712c=['./dashboardItem.events','save','remove','update','removeListener','register','length','dashboardItem:'];(function(_0x7ba80c,_0x5a64cf){var _0x423725=function(_0x4bd110){while(--_0x4bd110){_0x7ba80c['push'](_0x7ba80c['shift']());}};_0x423725(++_0x5a64cf);}(_0x712c,0x78));var _0xc712=function(_0x5e9be9,_0x1b7e0b){_0x5e9be9=_0x5e9be9-0x0;var _0x57eaee=_0x712c[_0x5e9be9];return _0x57eaee;};'use strict';var DashboardItemEvents=require(_0xc712('0x0'));var events=[_0xc712('0x1'),_0xc712('0x2'),_0xc712('0x3')];function createListener(_0x24fe3e,_0x4a2152){return function(_0x43af54){_0x4a2152['emit'](_0x24fe3e,_0x43af54);};}function removeListener(_0x212916,_0x2aa2e6){return function(){DashboardItemEvents[_0xc712('0x4')](_0x212916,_0x2aa2e6);};}exports[_0xc712('0x5')]=function(_0x45ef73){for(var _0x11cb15=0x0,_0x538e01=events[_0xc712('0x6')];_0x11cb15<_0x538e01;_0x11cb15++){var _0xb07435=events[_0x11cb15];var _0x4eb7e=createListener(_0xc712('0x7')+_0xb07435,_0x45ef73);DashboardItemEvents['on'](_0xb07435,_0x4eb7e);}}; \ No newline at end of file +var _0x8632=['update','emit','removeListener','register','length','save','remove'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x8632,0xec));var _0x2863=function(_0x593564,_0x43583f){_0x593564=_0x593564-0x0;var _0x211a89=_0x8632[_0x593564];return _0x211a89;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x2863('0x0'),_0x2863('0x1'),_0x2863('0x2')];function createListener(_0x4ef096,_0x5ab8bd){return function(_0x26b2bd){_0x5ab8bd[_0x2863('0x3')](_0x4ef096,_0x26b2bd);};}function removeListener(_0x393bcc,_0xcf05b0){return function(){DashboardItemEvents[_0x2863('0x4')](_0x393bcc,_0xcf05b0);};}exports[_0x2863('0x5')]=function(_0x501e48){for(var _0x385ff3=0x0,_0x44c45a=events[_0x2863('0x6')];_0x385ff3<_0x44c45a;_0x385ff3++){var _0x5cf15c=events[_0x385ff3];var _0x550579=createListener('dashboardItem:'+_0x5cf15c,_0x501e48);DashboardItemEvents['on'](_0x5cf15c,_0x550579);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 08fe0fc..3fad872 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 _0x326f=['create','put','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','post'];(function(_0x4ae74b,_0x4c2ad8){var _0x55b780=function(_0x542f3b){while(--_0x542f3b){_0x4ae74b['push'](_0x4ae74b['shift']());}};_0x55b780(++_0x4c2ad8);}(_0x326f,0xd1));var _0xf326=function(_0x3ea4d8,_0x173ee4){_0x3ea4d8=_0x3ea4d8-0x0;var _0x14d3d2=_0x326f[_0x3ea4d8];return _0x14d3d2;};'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')](_0xf326('0x9'),auth[_0xf326('0xa')](),controller['show']);router[_0xf326('0xb')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router[_0xf326('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xf326('0xe')](_0xf326('0x9'),auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);module[_0xf326('0x10')]=router; \ No newline at end of file +var _0x2675=['multer','express','Router','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','post','put','update','destroy'];(function(_0x1d2ebd,_0x362dc8){var _0x4c568d=function(_0x4563b2){while(--_0x4563b2){_0x1d2ebd['push'](_0x1d2ebd['shift']());}};_0x4c568d(++_0x362dc8);}(_0x2675,0x75));var _0x5267=function(_0xccfcd2,_0xc48435){_0xccfcd2=_0xccfcd2-0x0;var _0x3f92c9=_0x2675[_0xccfcd2];return _0x3f92c9;};'use strict';var multer=require(_0x5267('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5267('0x1'));var router=express[_0x5267('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x5267('0x3'));var config=require(_0x5267('0x4'));var controller=require('./dashboardItem.controller');router[_0x5267('0x5')](_0x5267('0x6'),auth[_0x5267('0x7')](),controller[_0x5267('0x8')]);router[_0x5267('0x9')]('/',auth[_0x5267('0x7')](),controller['create']);router[_0x5267('0xa')](_0x5267('0x6'),auth['isAuthenticated'](),controller[_0x5267('0xb')]);router['delete'](_0x5267('0x6'),auth[_0x5267('0x7')](),controller[_0x5267('0xc')]);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 5b76231..ccddbb1 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 _0x42d5=['exports','STRING'];(function(_0x58b542,_0x2dc849){var _0x423500=function(_0x5a8916){while(--_0x5a8916){_0x58b542['push'](_0x58b542['shift']());}};_0x423500(++_0x2dc849);}(_0x42d5,0x114));var _0x542d=function(_0x2c375e,_0x606a7b){_0x2c375e=_0x2c375e-0x0;var _0x20c576=_0x42d5[_0x2c375e];return _0x20c576;};'use strict';var Sequelize=require('sequelize');module[_0x542d('0x0')]={'name':{'type':Sequelize[_0x542d('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x9653=['sequelize','exports','STRING'];(function(_0x53d172,_0x46611b){var _0x1bd0a2=function(_0x19fb52){while(--_0x19fb52){_0x53d172['push'](_0x53d172['shift']());}};_0x1bd0a2(++_0x46611b);}(_0x9653,0x75));var _0x3965=function(_0x2695ea,_0x961e33){_0x2695ea=_0x2695ea-0x0;var _0x262fec=_0x9653[_0x2695ea];return _0x262fec;};'use strict';var Sequelize=require(_0x3965('0x0'));module[_0x3965('0x1')]={'name':{'type':Sequelize[_0x3965('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index caaffbc..c02e373 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 _0xc3b5=['model','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','options','count','includeAll','include','rows','catch','show','params','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','Dispositions','then','sendStatus','error','stack','send','index','map','Disposition','rawAttributes','fieldName','type','key','name','query','keys','filters','intersection'];(function(_0x41385d,_0x16e0de){var _0x3a9bda=function(_0x3323e5){while(--_0x3323e5){_0x41385d['push'](_0x41385d['shift']());}};_0x3a9bda(++_0x16e0de);}(_0xc3b5,0x6f));var _0x5c3b=function(_0x27ef71,_0x3440cb){_0x27ef71=_0x27ef71-0x0;var _0x3fb1e0=_0xc3b5[_0x27ef71];return _0x3fb1e0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x5c3b('0x0'));var zipdir=require(_0x5c3b('0x1'));var jsonpatch=require(_0x5c3b('0x2'));var rp=require(_0x5c3b('0x3'));var moment=require(_0x5c3b('0x4'));var BPromise=require(_0x5c3b('0x5'));var Mustache=require(_0x5c3b('0x6'));var util=require(_0x5c3b('0x7'));var path=require('path');var sox=require(_0x5c3b('0x8'));var csv=require(_0x5c3b('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5c3b('0xa'));var squel=require(_0x5c3b('0xb'));var crypto=require(_0x5c3b('0xc'));var jsforce=require(_0x5c3b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5c3b('0x9'));var querystring=require(_0x5c3b('0xe'));var Papa=require(_0x5c3b('0xf'));var Redis=require(_0x5c3b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5c3b('0x11'));var as=require(_0x5c3b('0x12'));var hardwareService=require(_0x5c3b('0x13'));var logger=require(_0x5c3b('0x14'))(_0x5c3b('0x15'));var utils=require('../../config/utils');var config=require(_0x5c3b('0x16'));var db=require(_0x5c3b('0x17'))['db'];function respondWithStatusCode(_0x589c36,_0x1b2815){_0x1b2815=_0x1b2815||0xcc;return function(_0x3b953d){if(_0x3b953d){return _0x589c36['sendStatus'](_0x1b2815);}return _0x589c36[_0x5c3b('0x18')](_0x1b2815)[_0x5c3b('0x19')]();};}function respondWithResult(_0x3e24bd,_0x2384b9){_0x2384b9=_0x2384b9||0xc8;return function(_0x315e68){if(_0x315e68){return _0x3e24bd[_0x5c3b('0x18')](_0x2384b9)[_0x5c3b('0x1a')](_0x315e68);}};}function respondWithFilteredResult(_0x4f20eb,_0x2f7ab2){return function(_0x5b55be){if(_0x5b55be){var _0x4cf80d=_0x5b55be['count'],_0x195c1e=_0x2f7ab2[_0x5c3b('0x1b')],_0x945338=_0x2f7ab2[_0x5c3b('0x1b')]+_0x2f7ab2[_0x5c3b('0x1c')],_0x18757e;if(_0x945338>=_0x4cf80d){_0x945338=_0x4cf80d;_0x18757e=0xc8;}else{_0x18757e=0xce;}_0x4f20eb['status'](_0x18757e);return _0x4f20eb[_0x5c3b('0x1d')](_0x5c3b('0x1e'),_0x195c1e+'-'+_0x945338+'/'+_0x4cf80d)['json'](_0x5b55be);}return null;};}function patchUpdates(_0x3973bc){return function(_0x4658ce){try{jsonpatch[_0x5c3b('0x1f')](_0x4658ce,_0x3973bc,!![]);}catch(_0x681ac1){return BPromise[_0x5c3b('0x20')](_0x681ac1);}return _0x4658ce[_0x5c3b('0x21')]();};}function saveUpdates(_0x1915c8,_0x1af39c){return function(_0xc63307){if(_0xc63307){return _0xc63307[_0x5c3b('0x22')](_0x1915c8)['then'](function(_0x555495){return _0x555495;});}return null;};}function removeEntity(_0x319f0c,_0x143022){return function(_0x5942f1){if(_0x5942f1){return _0x5942f1[_0x5c3b('0x23')]()['then'](function(){var _0x832a1c=_0x5942f1[_0x5c3b('0x24')]({'plain':!![]});var _0x2bb9dc=_0x5c3b('0x25');return db['UserProfileResource'][_0x5c3b('0x23')]({'where':{'type':_0x2bb9dc,'resourceId':_0x832a1c['id']}})[_0x5c3b('0x26')](function(){return _0x5942f1;});})['then'](function(){_0x319f0c[_0x5c3b('0x18')](0xcc)[_0x5c3b('0x19')]();});}};}function handleEntityNotFound(_0x3a8141,_0x3c3991){return function(_0x511a1c){if(!_0x511a1c){_0x3a8141[_0x5c3b('0x27')](0x194);}return _0x511a1c;};}function handleError(_0x20469d,_0x2099dc){_0x2099dc=_0x2099dc||0x1f4;return function(_0x28b782){logger[_0x5c3b('0x28')](_0x28b782[_0x5c3b('0x29')]);if(_0x28b782['name']){delete _0x28b782['name'];}_0x20469d['status'](_0x2099dc)[_0x5c3b('0x2a')](_0x28b782);};}exports[_0x5c3b('0x2b')]=function(_0x59b640,_0xd93418){var _0x15044e={},_0x421d96={},_0x2a26df={'count':0x0,'rows':[]};var _0x19a73d=_[_0x5c3b('0x2c')](db[_0x5c3b('0x2d')][_0x5c3b('0x2e')],function(_0x30d701){return{'name':_0x30d701[_0x5c3b('0x2f')],'type':_0x30d701[_0x5c3b('0x30')][_0x5c3b('0x31')]};});_0x421d96['model']=_[_0x5c3b('0x2c')](_0x19a73d,_0x5c3b('0x32'));_0x421d96[_0x5c3b('0x33')]=_[_0x5c3b('0x34')](_0x59b640[_0x5c3b('0x33')]);_0x421d96[_0x5c3b('0x35')]=_[_0x5c3b('0x36')](_0x421d96[_0x5c3b('0x37')],_0x421d96[_0x5c3b('0x33')]);_0x15044e[_0x5c3b('0x38')]=_[_0x5c3b('0x36')](_0x421d96[_0x5c3b('0x37')],qs[_0x5c3b('0x39')](_0x59b640[_0x5c3b('0x33')][_0x5c3b('0x39')]));_0x15044e[_0x5c3b('0x38')]=_0x15044e[_0x5c3b('0x38')]['length']?_0x15044e[_0x5c3b('0x38')]:_0x421d96[_0x5c3b('0x37')];if(!_0x59b640[_0x5c3b('0x33')][_0x5c3b('0x3a')]('nolimit')){_0x15044e[_0x5c3b('0x1c')]=qs[_0x5c3b('0x1c')](_0x59b640['query'][_0x5c3b('0x1c')]);_0x15044e[_0x5c3b('0x1b')]=qs[_0x5c3b('0x1b')](_0x59b640[_0x5c3b('0x33')][_0x5c3b('0x1b')]);}_0x15044e[_0x5c3b('0x3b')]=qs[_0x5c3b('0x3c')](_0x59b640[_0x5c3b('0x33')][_0x5c3b('0x3c')]);_0x15044e['where']=qs[_0x5c3b('0x35')](_[_0x5c3b('0x3d')](_0x59b640['query'],_0x421d96['filters']));if(_0x59b640[_0x5c3b('0x33')][_0x5c3b('0x3e')]){_0x15044e[_0x5c3b('0x3f')]=_[_0x5c3b('0x40')](_0x15044e[_0x5c3b('0x3f')],{'$or':_[_0x5c3b('0x2c')](_0x19a73d,function(_0x10fbd8){if(_0x10fbd8['type']!=='VIRTUAL'){var _0x3a641e={};_0x3a641e[_0x10fbd8[_0x5c3b('0x32')]]={'$like':'%'+_0x59b640[_0x5c3b('0x33')][_0x5c3b('0x3e')]+'%'};return _0x3a641e;}})});}_0x15044e=_['merge']({},_0x15044e,_0x59b640[_0x5c3b('0x41')]);var _0x4b9a81={'where':_0x15044e[_0x5c3b('0x3f')]};return db[_0x5c3b('0x2d')][_0x5c3b('0x42')](_0x4b9a81)[_0x5c3b('0x26')](function(_0x2caa63){_0x2a26df[_0x5c3b('0x42')]=_0x2caa63;if(_0x59b640[_0x5c3b('0x33')][_0x5c3b('0x43')]){_0x15044e[_0x5c3b('0x44')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x15044e);})[_0x5c3b('0x26')](function(_0x34f04b){_0x2a26df[_0x5c3b('0x45')]=_0x34f04b;return _0x2a26df;})[_0x5c3b('0x26')](respondWithFilteredResult(_0xd93418,_0x15044e))[_0x5c3b('0x46')](handleError(_0xd93418,null));};exports[_0x5c3b('0x47')]=function(_0x2cec5d,_0x1d9427){var _0x29ffdc={'raw':!![],'where':{'id':_0x2cec5d[_0x5c3b('0x48')]['id']}},_0x56a53e={};_0x56a53e[_0x5c3b('0x37')]=_[_0x5c3b('0x34')](db['Disposition'][_0x5c3b('0x2e')]);_0x56a53e[_0x5c3b('0x33')]=_[_0x5c3b('0x34')](_0x2cec5d[_0x5c3b('0x33')]);_0x56a53e[_0x5c3b('0x35')]=_[_0x5c3b('0x36')](_0x56a53e[_0x5c3b('0x37')],_0x56a53e[_0x5c3b('0x33')]);_0x29ffdc[_0x5c3b('0x38')]=_[_0x5c3b('0x36')](_0x56a53e[_0x5c3b('0x37')],qs['fields'](_0x2cec5d[_0x5c3b('0x33')]['fields']));_0x29ffdc[_0x5c3b('0x38')]=_0x29ffdc[_0x5c3b('0x38')]['length']?_0x29ffdc[_0x5c3b('0x38')]:_0x56a53e[_0x5c3b('0x37')];if(_0x2cec5d[_0x5c3b('0x33')]['includeAll']){_0x29ffdc[_0x5c3b('0x44')]=[{'all':!![]}];}_0x29ffdc=_['merge']({},_0x29ffdc,_0x2cec5d[_0x5c3b('0x41')]);return db[_0x5c3b('0x2d')][_0x5c3b('0x49')](_0x29ffdc)[_0x5c3b('0x26')](handleEntityNotFound(_0x1d9427,null))[_0x5c3b('0x26')](respondWithResult(_0x1d9427,null))[_0x5c3b('0x46')](handleError(_0x1d9427,null));};exports[_0x5c3b('0x4a')]=function(_0x3d6034,_0x42d34f){return db[_0x5c3b('0x2d')][_0x5c3b('0x4a')](_0x3d6034['body'],{})[_0x5c3b('0x26')](function(_0x5ac2aa){var _0x155b22=_0x3d6034[_0x5c3b('0x4b')][_0x5c3b('0x24')]({'plain':!![]});if(!_0x155b22)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x155b22[_0x5c3b('0x4c')]===_0x5c3b('0x4b')){var _0x5c9e2d=_0x5ac2aa[_0x5c3b('0x24')]({'plain':!![]});var _0x7f0100=_0x5c3b('0x25');return db[_0x5c3b('0x4d')][_0x5c3b('0x49')]({'where':{'name':_0x7f0100,'userProfileId':_0x155b22[_0x5c3b('0x4e')]},'raw':!![]})[_0x5c3b('0x26')](function(_0x21e430){if(_0x21e430&&_0x21e430[_0x5c3b('0x4f')]===0x0){return db[_0x5c3b('0x50')][_0x5c3b('0x4a')]({'name':_0x5c9e2d['name'],'resourceId':_0x5c9e2d['id'],'type':_0x21e430['name'],'sectionId':_0x21e430['id']},{})['then'](function(){return _0x5ac2aa;});}else{return _0x5ac2aa;}})[_0x5c3b('0x46')](function(_0x203ae2){logger['error'](_0x5c3b('0x51'),_0x203ae2);throw _0x203ae2;});}return _0x5ac2aa;})[_0x5c3b('0x26')](respondWithResult(_0x42d34f,0xc9))[_0x5c3b('0x46')](handleError(_0x42d34f,null));};exports[_0x5c3b('0x22')]=function(_0x53c2c2,_0x305b49){if(_0x53c2c2[_0x5c3b('0x52')]['id']){delete _0x53c2c2['body']['id'];}return db[_0x5c3b('0x2d')][_0x5c3b('0x49')]({'where':{'id':_0x53c2c2[_0x5c3b('0x48')]['id']}})[_0x5c3b('0x26')](handleEntityNotFound(_0x305b49,null))[_0x5c3b('0x26')](saveUpdates(_0x53c2c2[_0x5c3b('0x52')],null))[_0x5c3b('0x26')](respondWithResult(_0x305b49,null))[_0x5c3b('0x46')](handleError(_0x305b49,null));};exports[_0x5c3b('0x23')]=function(_0x36c734,_0x381e3c){return db[_0x5c3b('0x2d')][_0x5c3b('0x49')]({'where':{'id':_0x36c734['params']['id']}})['then'](handleEntityNotFound(_0x381e3c,null))[_0x5c3b('0x26')](removeEntity(_0x381e3c,null))[_0x5c3b('0x46')](handleError(_0x381e3c,null));}; \ No newline at end of file +var _0xdb94=['bluebird','mustache','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','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','error','name','send','index','map','Disposition','rawAttributes','fieldName','key','model','query','filters','fields','attributes','length','order','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','params','keys','intersection','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','autoAssociation','eml-format','rimraf','fast-json-patch','request-promise','moment'];(function(_0x242f67,_0x133c3a){var _0x3256bf=function(_0x147a21){while(--_0x147a21){_0x242f67['push'](_0x242f67['shift']());}};_0x3256bf(++_0x133c3a);}(_0xdb94,0xe5));var _0x4db9=function(_0x4134d6,_0x255f70){_0x4134d6=_0x4134d6-0x0;var _0x1a9f6c=_0xdb94[_0x4134d6];return _0x1a9f6c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4db9('0x0'));var rimraf=require(_0x4db9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4db9('0x2'));var rp=require(_0x4db9('0x3'));var moment=require(_0x4db9('0x4'));var BPromise=require(_0x4db9('0x5'));var Mustache=require(_0x4db9('0x6'));var util=require('util');var path=require(_0x4db9('0x7'));var sox=require('sox');var csv=require(_0x4db9('0x8'));var ejs=require(_0x4db9('0x9'));var fs=require('fs');var _=require(_0x4db9('0xa'));var squel=require(_0x4db9('0xb'));var crypto=require(_0x4db9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4db9('0xd'));var toCsv=require(_0x4db9('0x8'));var querystring=require(_0x4db9('0xe'));var Papa=require(_0x4db9('0xf'));var Redis=require(_0x4db9('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4db9('0x11'));var as=require(_0x4db9('0x12'));var hardwareService=require(_0x4db9('0x13'));var logger=require(_0x4db9('0x14'))(_0x4db9('0x15'));var utils=require(_0x4db9('0x16'));var config=require('../../config/environment');var db=require(_0x4db9('0x17'))['db'];function respondWithStatusCode(_0x4397fc,_0x59f01c){_0x59f01c=_0x59f01c||0xcc;return function(_0x549c92){if(_0x549c92){return _0x4397fc[_0x4db9('0x18')](_0x59f01c);}return _0x4397fc[_0x4db9('0x19')](_0x59f01c)[_0x4db9('0x1a')]();};}function respondWithResult(_0x4d4046,_0x1a93be){_0x1a93be=_0x1a93be||0xc8;return function(_0x3dde55){if(_0x3dde55){return _0x4d4046[_0x4db9('0x19')](_0x1a93be)[_0x4db9('0x1b')](_0x3dde55);}};}function respondWithFilteredResult(_0x2d89a7,_0x585230){return function(_0x1b1062){if(_0x1b1062){var _0x1a5a9c=_0x1b1062[_0x4db9('0x1c')],_0x5d4d70=_0x585230['offset'],_0x27b387=_0x585230[_0x4db9('0x1d')]+_0x585230[_0x4db9('0x1e')],_0x7df575;if(_0x27b387>=_0x1a5a9c){_0x27b387=_0x1a5a9c;_0x7df575=0xc8;}else{_0x7df575=0xce;}_0x2d89a7['status'](_0x7df575);return _0x2d89a7['set']('Content-Range',_0x5d4d70+'-'+_0x27b387+'/'+_0x1a5a9c)[_0x4db9('0x1b')](_0x1b1062);}return null;};}function patchUpdates(_0x4235ab){return function(_0x48ff99){try{jsonpatch[_0x4db9('0x1f')](_0x48ff99,_0x4235ab,!![]);}catch(_0x1f6b24){return BPromise[_0x4db9('0x20')](_0x1f6b24);}return _0x48ff99[_0x4db9('0x21')]();};}function saveUpdates(_0x439433,_0x28b7f6){return function(_0x34a6ed){if(_0x34a6ed){return _0x34a6ed[_0x4db9('0x22')](_0x439433)[_0x4db9('0x23')](function(_0x41d0c1){return _0x41d0c1;});}return null;};}function removeEntity(_0x29b4ff,_0x102402){return function(_0x4d56a1){if(_0x4d56a1){return _0x4d56a1[_0x4db9('0x24')]()[_0x4db9('0x23')](function(){var _0x56a550=_0x4d56a1[_0x4db9('0x25')]({'plain':!![]});var _0x3f4931=_0x4db9('0x26');return db[_0x4db9('0x27')]['destroy']({'where':{'type':_0x3f4931,'resourceId':_0x56a550['id']}})[_0x4db9('0x23')](function(){return _0x4d56a1;});})['then'](function(){_0x29b4ff[_0x4db9('0x19')](0xcc)[_0x4db9('0x1a')]();});}};}function handleEntityNotFound(_0x135aa7,_0x47e89c){return function(_0x293933){if(!_0x293933){_0x135aa7[_0x4db9('0x18')](0x194);}return _0x293933;};}function handleError(_0x47464d,_0x5e7d29){_0x5e7d29=_0x5e7d29||0x1f4;return function(_0x5f59be){logger[_0x4db9('0x28')](_0x5f59be['stack']);if(_0x5f59be[_0x4db9('0x29')]){delete _0x5f59be[_0x4db9('0x29')];}_0x47464d[_0x4db9('0x19')](_0x5e7d29)[_0x4db9('0x2a')](_0x5f59be);};}exports[_0x4db9('0x2b')]=function(_0x3c3fcf,_0x1d0dc2){var _0x373a7d={},_0x4c4a47={},_0x35f757={'count':0x0,'rows':[]};var _0x57c1af=_[_0x4db9('0x2c')](db[_0x4db9('0x2d')][_0x4db9('0x2e')],function(_0x314e64){return{'name':_0x314e64[_0x4db9('0x2f')],'type':_0x314e64['type'][_0x4db9('0x30')]};});_0x4c4a47[_0x4db9('0x31')]=_[_0x4db9('0x2c')](_0x57c1af,_0x4db9('0x29'));_0x4c4a47['query']=_['keys'](_0x3c3fcf[_0x4db9('0x32')]);_0x4c4a47[_0x4db9('0x33')]=_['intersection'](_0x4c4a47['model'],_0x4c4a47[_0x4db9('0x32')]);_0x373a7d['attributes']=_['intersection'](_0x4c4a47[_0x4db9('0x31')],qs[_0x4db9('0x34')](_0x3c3fcf['query'][_0x4db9('0x34')]));_0x373a7d[_0x4db9('0x35')]=_0x373a7d[_0x4db9('0x35')][_0x4db9('0x36')]?_0x373a7d['attributes']:_0x4c4a47[_0x4db9('0x31')];if(!_0x3c3fcf['query']['hasOwnProperty']('nolimit')){_0x373a7d[_0x4db9('0x1e')]=qs[_0x4db9('0x1e')](_0x3c3fcf['query'][_0x4db9('0x1e')]);_0x373a7d[_0x4db9('0x1d')]=qs['offset'](_0x3c3fcf['query']['offset']);}_0x373a7d[_0x4db9('0x37')]=qs['sort'](_0x3c3fcf[_0x4db9('0x32')]['sort']);_0x373a7d[_0x4db9('0x38')]=qs[_0x4db9('0x33')](_[_0x4db9('0x39')](_0x3c3fcf[_0x4db9('0x32')],_0x4c4a47[_0x4db9('0x33')]));if(_0x3c3fcf['query'][_0x4db9('0x3a')]){_0x373a7d['where']=_[_0x4db9('0x3b')](_0x373a7d[_0x4db9('0x38')],{'$or':_[_0x4db9('0x2c')](_0x57c1af,function(_0x1c895e){if(_0x1c895e[_0x4db9('0x3c')]!==_0x4db9('0x3d')){var _0x52b00c={};_0x52b00c[_0x1c895e[_0x4db9('0x29')]]={'$like':'%'+_0x3c3fcf[_0x4db9('0x32')]['filter']+'%'};return _0x52b00c;}})});}_0x373a7d=_['merge']({},_0x373a7d,_0x3c3fcf[_0x4db9('0x3e')]);var _0x45142f={'where':_0x373a7d[_0x4db9('0x38')]};return db[_0x4db9('0x2d')][_0x4db9('0x1c')](_0x45142f)[_0x4db9('0x23')](function(_0x1a9fe7){_0x35f757[_0x4db9('0x1c')]=_0x1a9fe7;if(_0x3c3fcf[_0x4db9('0x32')][_0x4db9('0x3f')]){_0x373a7d[_0x4db9('0x40')]=[{'all':!![]}];}return db[_0x4db9('0x2d')]['findAll'](_0x373a7d);})[_0x4db9('0x23')](function(_0x4a2121){_0x35f757[_0x4db9('0x41')]=_0x4a2121;return _0x35f757;})[_0x4db9('0x23')](respondWithFilteredResult(_0x1d0dc2,_0x373a7d))['catch'](handleError(_0x1d0dc2,null));};exports['show']=function(_0x248891,_0x2b18a2){var _0x2fc233={'raw':!![],'where':{'id':_0x248891[_0x4db9('0x42')]['id']}},_0x5ddcd4={};_0x5ddcd4['model']=_[_0x4db9('0x43')](db[_0x4db9('0x2d')][_0x4db9('0x2e')]);_0x5ddcd4[_0x4db9('0x32')]=_[_0x4db9('0x43')](_0x248891['query']);_0x5ddcd4[_0x4db9('0x33')]=_[_0x4db9('0x44')](_0x5ddcd4[_0x4db9('0x31')],_0x5ddcd4[_0x4db9('0x32')]);_0x2fc233[_0x4db9('0x35')]=_['intersection'](_0x5ddcd4[_0x4db9('0x31')],qs[_0x4db9('0x34')](_0x248891[_0x4db9('0x32')][_0x4db9('0x34')]));_0x2fc233[_0x4db9('0x35')]=_0x2fc233[_0x4db9('0x35')][_0x4db9('0x36')]?_0x2fc233[_0x4db9('0x35')]:_0x5ddcd4[_0x4db9('0x31')];if(_0x248891['query'][_0x4db9('0x3f')]){_0x2fc233['include']=[{'all':!![]}];}_0x2fc233=_['merge']({},_0x2fc233,_0x248891[_0x4db9('0x3e')]);return db[_0x4db9('0x2d')]['find'](_0x2fc233)['then'](handleEntityNotFound(_0x2b18a2,null))[_0x4db9('0x23')](respondWithResult(_0x2b18a2,null))[_0x4db9('0x45')](handleError(_0x2b18a2,null));};exports[_0x4db9('0x46')]=function(_0x7f0aac,_0x2c2c17){return db[_0x4db9('0x2d')][_0x4db9('0x46')](_0x7f0aac[_0x4db9('0x47')],{})[_0x4db9('0x23')](function(_0x16c695){var _0x43312c=_0x7f0aac['user'][_0x4db9('0x25')]({'plain':!![]});if(!_0x43312c)throw new Error(_0x4db9('0x48'));if(_0x43312c['role']===_0x4db9('0x49')){var _0x5a461d=_0x16c695[_0x4db9('0x25')]({'plain':!![]});var _0x448010=_0x4db9('0x26');return db[_0x4db9('0x4a')][_0x4db9('0x4b')]({'where':{'name':_0x448010,'userProfileId':_0x43312c[_0x4db9('0x4c')]},'raw':!![]})[_0x4db9('0x23')](function(_0x3b8d8c){if(_0x3b8d8c&&_0x3b8d8c[_0x4db9('0x4d')]===0x0){return db[_0x4db9('0x27')][_0x4db9('0x46')]({'name':_0x5a461d[_0x4db9('0x29')],'resourceId':_0x5a461d['id'],'type':_0x3b8d8c[_0x4db9('0x29')],'sectionId':_0x3b8d8c['id']},{})['then'](function(){return _0x16c695;});}else{return _0x16c695;}})['catch'](function(_0x5ececc){logger[_0x4db9('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5ececc);throw _0x5ececc;});}return _0x16c695;})[_0x4db9('0x23')](respondWithResult(_0x2c2c17,0xc9))['catch'](handleError(_0x2c2c17,null));};exports[_0x4db9('0x22')]=function(_0x2ab2aa,_0x5f2072){if(_0x2ab2aa['body']['id']){delete _0x2ab2aa[_0x4db9('0x47')]['id'];}return db[_0x4db9('0x2d')][_0x4db9('0x4b')]({'where':{'id':_0x2ab2aa[_0x4db9('0x42')]['id']}})[_0x4db9('0x23')](handleEntityNotFound(_0x5f2072,null))[_0x4db9('0x23')](saveUpdates(_0x2ab2aa[_0x4db9('0x47')],null))[_0x4db9('0x23')](respondWithResult(_0x5f2072,null))['catch'](handleError(_0x5f2072,null));};exports[_0x4db9('0x24')]=function(_0x43253f,_0x12dc10){return db[_0x4db9('0x2d')][_0x4db9('0x4b')]({'where':{'id':_0x43253f['params']['id']}})[_0x4db9('0x23')](handleEntityNotFound(_0x12dc10,null))[_0x4db9('0x23')](removeEntity(_0x12dc10,null))[_0x4db9('0x45')](handleError(_0x12dc10,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index d06d3b2..7d782c5 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 _0xddf1=['api','moment','bluebird','request-promise','path','../../config/environment','./disposition.attributes','exports','tools_dispositions','name_voice','name','ListId','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','name_openchannel','OpenchannelAccountId','lodash','util','../../config/logger'];(function(_0x3e0c47,_0x448eaa){var _0x142825=function(_0x583ddd){while(--_0x583ddd){_0x3e0c47['push'](_0x3e0c47['shift']());}};_0x142825(++_0x448eaa);}(_0xddf1,0x1b2));var _0x1ddf=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0xddf1[_0x5a3cf0];return _0x5a64ee;};'use strict';var _=require(_0x1ddf('0x0'));var util=require(_0x1ddf('0x1'));var logger=require(_0x1ddf('0x2'))(_0x1ddf('0x3'));var moment=require(_0x1ddf('0x4'));var BPromise=require(_0x1ddf('0x5'));var rp=require(_0x1ddf('0x6'));var fs=require('fs');var path=require(_0x1ddf('0x7'));var rimraf=require('rimraf');var config=require(_0x1ddf('0x8'));var attributes=require(_0x1ddf('0x9'));module[_0x1ddf('0xa')]=function(_0x155b24,_0x1d8b11){return _0x155b24['define']('Disposition',attributes,{'tableName':_0x1ddf('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x1ddf('0xc'),'fields':[_0x1ddf('0xd'),_0x1ddf('0xe')]},{'unique':!![],'name':'name_chat','fields':[_0x1ddf('0xd'),_0x1ddf('0xf')]},{'unique':!![],'name':_0x1ddf('0x10'),'fields':[_0x1ddf('0xd'),_0x1ddf('0x11')]},{'unique':!![],'name':_0x1ddf('0x12'),'fields':['name',_0x1ddf('0x13')]},{'unique':!![],'name':_0x1ddf('0x14'),'fields':[_0x1ddf('0xd'),'FaxAccountId']},{'unique':!![],'name':_0x1ddf('0x15'),'fields':[_0x1ddf('0xd'),_0x1ddf('0x16')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x05ab=['FaxAccountId','name_openchannel','OpenchannelAccountId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','define','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','SmsAccountId','name_fax'];(function(_0x44f675,_0x189410){var _0x4718d9=function(_0x4b3d79){while(--_0x4b3d79){_0x44f675['push'](_0x44f675['shift']());}};_0x4718d9(++_0x189410);}(_0x05ab,0x123));var _0xb05a=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x05ab[_0x422905];return _0x33dc6c;};'use strict';var _=require('lodash');var util=require(_0xb05a('0x0'));var logger=require(_0xb05a('0x1'))(_0xb05a('0x2'));var moment=require(_0xb05a('0x3'));var BPromise=require(_0xb05a('0x4'));var rp=require(_0xb05a('0x5'));var fs=require('fs');var path=require(_0xb05a('0x6'));var rimraf=require(_0xb05a('0x7'));var config=require(_0xb05a('0x8'));var attributes=require(_0xb05a('0x9'));module['exports']=function(_0xc1282,_0x4cb988){return _0xc1282[_0xb05a('0xa')]('Disposition',attributes,{'tableName':_0xb05a('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xb05a('0xc'),'fields':[_0xb05a('0xd'),_0xb05a('0xe')]},{'unique':!![],'name':_0xb05a('0xf'),'fields':['name',_0xb05a('0x10')]},{'unique':!![],'name':_0xb05a('0x11'),'fields':[_0xb05a('0xd'),_0xb05a('0x12')]},{'unique':!![],'name':'name_sms','fields':[_0xb05a('0xd'),_0xb05a('0x13')]},{'unique':!![],'name':_0xb05a('0x14'),'fields':[_0xb05a('0xd'),_0xb05a('0x15')]},{'unique':!![],'name':_0xb05a('0x16'),'fields':[_0xb05a('0xd'),_0xb05a('0x17')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 138f1a6..b1196a6 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 _0xf099=['moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Disposition,\x20%s,\x20%s','request\x20sent','Disposition,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util'];(function(_0x1fe29a,_0x553b9a){var _0xb94d8f=function(_0x373141){while(--_0x373141){_0x1fe29a['push'](_0x1fe29a['shift']());}};_0xb94d8f(++_0x553b9a);}(_0xf099,0x163));var _0x9f09=function(_0x54fbff,_0x53470e){_0x54fbff=_0x54fbff-0x0;var _0x5cf619=_0xf099[_0x54fbff];return _0x5cf619;};'use strict';var _=require(_0x9f09('0x0'));var util=require(_0x9f09('0x1'));var moment=require(_0x9f09('0x2'));var BPromise=require(_0x9f09('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9f09('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9f09('0x5'))(_0x9f09('0x6'));var config=require(_0x9f09('0x7'));var jayson=require(_0x9f09('0x8'));var client=jayson[_0x9f09('0x9')][_0x9f09('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b1879,_0x19f961,_0x17a47a){return new BPromise(function(_0x5485b0,_0x4485c0){return client[_0x9f09('0xb')](_0x4b1879,_0x17a47a)[_0x9f09('0xc')](function(_0x160b10){logger[_0x9f09('0xd')](_0x9f09('0xe'),_0x19f961,_0x9f09('0xf'));logger['debug'](_0x9f09('0x10'),_0x19f961,_0x9f09('0xf'),JSON['stringify'](_0x160b10));if(_0x160b10[_0x9f09('0x11')]){if(_0x160b10[_0x9f09('0x11')]['code']===0x1f4){logger[_0x9f09('0x11')](_0x9f09('0xe'),_0x19f961,_0x160b10['error'][_0x9f09('0x12')]);return _0x4485c0(_0x160b10['error'][_0x9f09('0x12')]);}logger['error'](_0x9f09('0xe'),_0x19f961,_0x160b10[_0x9f09('0x11')]['message']);return _0x5485b0(_0x160b10[_0x9f09('0x11')][_0x9f09('0x12')]);}else{logger['info'](_0x9f09('0xe'),_0x19f961,_0x9f09('0xf'));_0x5485b0(_0x160b10[_0x9f09('0x13')][_0x9f09('0x12')]);}})[_0x9f09('0x14')](function(_0x16110a){logger['error'](_0x9f09('0xe'),_0x19f961,_0x16110a);_0x4485c0(_0x16110a);});});} \ No newline at end of file +var _0x0637=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','util','moment','../../mysqldb','../../config/utils'];(function(_0x236dfb,_0x1a8986){var _0x43996f=function(_0x32f8cf){while(--_0x32f8cf){_0x236dfb['push'](_0x236dfb['shift']());}};_0x43996f(++_0x1a8986);}(_0x0637,0xa3));var _0x7063=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0637[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7063('0x0'));var util=require(_0x7063('0x1'));var moment=require(_0x7063('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7063('0x3'))['db'];var utils=require(_0x7063('0x4'));var logger=require(_0x7063('0x5'))(_0x7063('0x6'));var config=require(_0x7063('0x7'));var jayson=require(_0x7063('0x8'));var client=jayson[_0x7063('0x9')][_0x7063('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x92a5bc,_0x1affb6,_0x343682){return new BPromise(function(_0x53bca5,_0x14ea46){return client[_0x7063('0xb')](_0x92a5bc,_0x343682)[_0x7063('0xc')](function(_0x454de6){logger[_0x7063('0xd')](_0x7063('0xe'),_0x1affb6,_0x7063('0xf'));logger[_0x7063('0x10')]('Disposition,\x20%s,\x20%s,\x20%s',_0x1affb6,_0x7063('0xf'),JSON['stringify'](_0x454de6));if(_0x454de6['error']){if(_0x454de6[_0x7063('0x11')][_0x7063('0x12')]===0x1f4){logger[_0x7063('0x11')](_0x7063('0xe'),_0x1affb6,_0x454de6['error']['message']);return _0x14ea46(_0x454de6[_0x7063('0x11')][_0x7063('0x13')]);}logger[_0x7063('0x11')](_0x7063('0xe'),_0x1affb6,_0x454de6[_0x7063('0x11')]['message']);return _0x53bca5(_0x454de6[_0x7063('0x11')][_0x7063('0x13')]);}else{logger['info']('Disposition,\x20%s,\x20%s',_0x1affb6,_0x7063('0xf'));_0x53bca5(_0x454de6[_0x7063('0x14')][_0x7063('0x13')]);}})['catch'](function(_0x6d3d86){logger[_0x7063('0x11')](_0x7063('0xe'),_0x1affb6,_0x6d3d86);_0x14ea46(_0x6d3d86);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index cde0a43..4d04ef7 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 _0xad07=['delete','destroy','exports','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./disposition.controller','isAuthenticated','/:id','create','update'];(function(_0x35c72c,_0x38dfe3){var _0x36fb68=function(_0x47af30){while(--_0x47af30){_0x35c72c['push'](_0x35c72c['shift']());}};_0x36fb68(++_0x38dfe3);}(_0xad07,0xe3));var _0x7ad0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xad07[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7ad0('0x0'));var util=require(_0x7ad0('0x1'));var path=require('path');var timeout=require(_0x7ad0('0x2'));var express=require(_0x7ad0('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x7ad0('0x4'));var config=require(_0x7ad0('0x5'));var controller=require(_0x7ad0('0x6'));router['get']('/',auth[_0x7ad0('0x7')](),controller['index']);router['get'](_0x7ad0('0x8'),auth[_0x7ad0('0x7')](),controller['show']);router['post']('/',auth[_0x7ad0('0x7')](),controller[_0x7ad0('0x9')]);router['put'](_0x7ad0('0x8'),auth[_0x7ad0('0x7')](),controller[_0x7ad0('0xa')]);router[_0x7ad0('0xb')]('/:id',auth[_0x7ad0('0x7')](),controller[_0x7ad0('0xc')]);module[_0x7ad0('0xd')]=router; \ No newline at end of file +var _0x5ae9=['/:id','create','put','delete','destroy','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./disposition.controller','isAuthenticated','index','get'];(function(_0x1190b6,_0x43c0c5){var _0x486b3b=function(_0x29dda7){while(--_0x29dda7){_0x1190b6['push'](_0x1190b6['shift']());}};_0x486b3b(++_0x43c0c5);}(_0x5ae9,0x19b));var _0x95ae=function(_0x88ffd4,_0x25f7e6){_0x88ffd4=_0x88ffd4-0x0;var _0x528f9c=_0x5ae9[_0x88ffd4];return _0x528f9c;};'use strict';var multer=require(_0x95ae('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x95ae('0x1'));var express=require(_0x95ae('0x2'));var router=express['Router']();var auth=require(_0x95ae('0x3'));var interaction=require(_0x95ae('0x4'));var config=require('../../config/environment');var controller=require(_0x95ae('0x5'));router['get']('/',auth[_0x95ae('0x6')](),controller[_0x95ae('0x7')]);router[_0x95ae('0x8')](_0x95ae('0x9'),auth[_0x95ae('0x6')](),controller['show']);router['post']('/',auth[_0x95ae('0x6')](),controller[_0x95ae('0xa')]);router[_0x95ae('0xb')](_0x95ae('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x95ae('0xc')](_0x95ae('0x9'),auth[_0x95ae('0x6')](),controller[_0x95ae('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 545c3f8..b2dd1ea 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 _0x0142=['mandatoryDispositionPauseId','mandatoryDisposition','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','12000','14400','v17,v27,v29','SIP','IAX','DADHI','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x360e08,_0x4042d7){var _0x3b20ca=function(_0x27ec9b){while(--_0x27ec9b){_0x360e08['push'](_0x360e08['shift']());}};_0x3b20ca(++_0x4042d7);}(_0x0142,0xff));var _0x2014=function(_0x472ded,_0x7b9b67){_0x472ded=_0x472ded-0x0;var _0x4cdf81=_0x0142[_0x472ded];return _0x4cdf81;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2014('0x0')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x2014('0x0')]},'ecm':{'type':Sequelize[_0x2014('0x1')](_0x2014('0x2'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x2014('0x0')],'defaultValue':_0x2014('0x3')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x2014('0x4')},'minrate':{'type':Sequelize['ENUM'](_0x2014('0x5'),_0x2014('0x6'),_0x2014('0x7'),_0x2014('0x8'),_0x2014('0x9'),'14400'),'defaultValue':_0x2014('0x6')},'maxrate':{'type':Sequelize[_0x2014('0x1')](_0x2014('0x5'),'4800',_0x2014('0x7'),_0x2014('0x8'),_0x2014('0x9'),_0x2014('0xa')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x2014('0x0')],'defaultValue':_0x2014('0xb')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x2014('0x0')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x2014('0x1')](_0x2014('0xc'),_0x2014('0xd'),_0x2014('0xe'),'KHOMP'),'defaultValue':_0x2014('0xc')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x2014('0xf')],'defaultValue':function(){return _0x2014('0x10');}},'notificationSound':{'type':Sequelize[_0x2014('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2014('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2014('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2014('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2014('0x12')],'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['BOOLEAN'],'defaultValue':![],'comment':_0x2014('0x13'),'set':function(_0xd0daa9){if(!_0xd0daa9)this[_0x2014('0x14')](_0x2014('0x15'),null);this[_0x2014('0x14')](_0x2014('0x16'),_0xd0daa9);}}}; \ No newline at end of file +var _0x4fcd=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition','sequelize','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','12000','14400','v17,v27,v29','SIP','IAX','DADHI','KHOMP'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x4fcd,0x15f));var _0xd4fc=function(_0x2e1b28,_0x24fc1c){_0x2e1b28=_0x2e1b28-0x0;var _0x3e4a03=_0x4fcd[_0x2e1b28];return _0x3e4a03;};'use strict';var Sequelize=require(_0xd4fc('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd4fc('0x1')]},'ecm':{'type':Sequelize[_0xd4fc('0x2')](_0xd4fc('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0xd4fc('0x1')],'defaultValue':_0xd4fc('0x4')},'localstationid':{'type':Sequelize[_0xd4fc('0x1')],'unique':_0xd4fc('0x5')},'minrate':{'type':Sequelize[_0xd4fc('0x2')](_0xd4fc('0x6'),_0xd4fc('0x7'),_0xd4fc('0x8'),'9600','12000','14400'),'defaultValue':_0xd4fc('0x7')},'maxrate':{'type':Sequelize[_0xd4fc('0x2')]('2400',_0xd4fc('0x7'),_0xd4fc('0x8'),_0xd4fc('0x9'),_0xd4fc('0xa'),_0xd4fc('0xb')),'defaultValue':_0xd4fc('0xb')},'modem':{'type':Sequelize[_0xd4fc('0x1')],'defaultValue':_0xd4fc('0xc')},'gateway':{'type':Sequelize[_0xd4fc('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xd4fc('0x2')](_0xd4fc('0xd'),_0xd4fc('0xe'),_0xd4fc('0xf'),_0xd4fc('0x10')),'defaultValue':_0xd4fc('0xd')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xd4fc('0x11');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd4fc('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd4fc('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd4fc('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd4fc('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd4fc('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd4fc('0x13')],'allowNull':!![],'defaultValue':null,'comment':_0xd4fc('0x14')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x326d04){if(!_0x326d04)this[_0xd4fc('0x15')]('mandatoryDispositionPauseId',null);this[_0xd4fc('0x15')](_0xd4fc('0x16'),_0x326d04);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index c30d429..b22f768 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 _0x892d=['where','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','params','rawAttributes','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','hasOwnProperty','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','ids','omit','getInteractions','FaxInteraction','Contact','User','internal','Tag','Tags','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','appdata','push','Answer','Set','ecm','gateway','faxdetect','maxrate','minrate','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','addAccountApplications','VoiceExtension','updateAccountApplications','tech','key','TrunkId','ListId','findById','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','Contacts','updatedAt','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','CmContact','Send\x20Fax\x20failed','user','out','filename','Messages','Contact\x20not\x20found','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./faxAccount.socket','register','jayson/promise','http','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','FaxAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','status','json','offset','Content-Range','reject','save','then','destroy','get','FaxAccounts','end','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter'];(function(_0x56daff,_0xadca9a){var _0x132c82=function(_0x19e0d7){while(--_0x19e0d7){_0x56daff['push'](_0x56daff['shift']());}};_0x132c82(++_0xadca9a);}(_0x892d,0x136));var _0xd892=function(_0x48d93d,_0x17a2a1){_0x48d93d=_0x48d93d-0x0;var _0x497a42=_0x892d[_0x48d93d];return _0x497a42;};'use strict';var pdf=require(_0xd892('0x0'));var emlformat=require(_0xd892('0x1'));var rimraf=require(_0xd892('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd892('0x3'));var rp=require('request-promise');var moment=require(_0xd892('0x4'));var BPromise=require(_0xd892('0x5'));var Mustache=require(_0xd892('0x6'));var util=require('util');var path=require(_0xd892('0x7'));var sox=require('sox');var csv=require(_0xd892('0x8'));var ejs=require(_0xd892('0x9'));var fs=require('fs');var _=require(_0xd892('0xa'));var squel=require(_0xd892('0xb'));var crypto=require('crypto');var jsforce=require(_0xd892('0xc'));var deskjs=require(_0xd892('0xd'));var toCsv=require(_0xd892('0x8'));var querystring=require(_0xd892('0xe'));var Papa=require(_0xd892('0xf'));var Redis=require(_0xd892('0x10'));var authService=require(_0xd892('0x11'));var qs=require(_0xd892('0x12'));var as=require(_0xd892('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd892('0x14'))(_0xd892('0x15'));var utils=require(_0xd892('0x16'));var config=require(_0xd892('0x17'));var db=require('../../mysqldb')['db'];config[_0xd892('0x18')]=_[_0xd892('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd892('0x1a'))(new Redis(config[_0xd892('0x18')]));require(_0xd892('0x1b'))[_0xd892('0x1c')](socket);var jayson=require(_0xd892('0x1d'));var client=jayson['client'][_0xd892('0x1e')]({'port':0x232c});var client9002=jayson[_0xd892('0x1f')][_0xd892('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x14833a,_0x36ccf4,_0x48aac6){if(_0x48aac6){var _0x1303c2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1303c2[_0xd892('0x20')](_0x36ccf4)){return _0x14833a;}else{throw new db[(_0xd892('0x21'))][(_0xd892('0x22'))](_0xd892('0x23'));}}else{return _0x14833a;}}function respondWithRpcPromise(_0x439477,_0x297f97,_0x8f51f4,_0x3cfc99){return new BPromise(function(_0x5679fb,_0xf09c14){var _0x5bcf26=_0x3cfc99||client;return _0x5bcf26[_0xd892('0x24')](_0x439477,_0x8f51f4)['then'](function(_0xaa24ac){logger[_0xd892('0x25')](_0xd892('0x26'),_0x297f97,'request\x20sent');logger[_0xd892('0x27')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x297f97,_0xd892('0x28'),JSON['stringify'](_0xaa24ac));if(_0xaa24ac[_0xd892('0x29')]){if(_0xaa24ac[_0xd892('0x29')][_0xd892('0x2a')]===0x1f4){logger[_0xd892('0x29')](_0xd892('0x26'),_0x297f97,_0xaa24ac['error'][_0xd892('0x2b')]);return _0xf09c14(_0xaa24ac[_0xd892('0x29')][_0xd892('0x2b')]);}logger[_0xd892('0x29')](_0xd892('0x26'),_0x297f97,_0xaa24ac[_0xd892('0x29')][_0xd892('0x2b')]);return _0x5679fb(_0xaa24ac[_0xd892('0x29')][_0xd892('0x2b')]);}else{logger[_0xd892('0x25')](_0xd892('0x26'),_0x297f97,_0xd892('0x28'));_0x5679fb(_0xaa24ac[_0xd892('0x2c')][_0xd892('0x2b')]);}})[_0xd892('0x2d')](function(_0x43a2f8){logger[_0xd892('0x29')](_0xd892('0x26'),_0x297f97,_0x43a2f8);_0xf09c14(_0x43a2f8);});});}function respondWithStatusCode(_0x3350f7,_0x3a4547){_0x3a4547=_0x3a4547||0xcc;return function(_0x16a5f7){if(_0x16a5f7){return _0x3350f7['sendStatus'](_0x3a4547);}return _0x3350f7[_0xd892('0x2e')](_0x3a4547)['end']();};}function respondWithResult(_0x3cc750,_0x2270c3){_0x2270c3=_0x2270c3||0xc8;return function(_0x5354b8){if(_0x5354b8){return _0x3cc750[_0xd892('0x2e')](_0x2270c3)[_0xd892('0x2f')](_0x5354b8);}};}function respondWithFilteredResult(_0x1ee6f8,_0x2594eb){return function(_0x1008cf){if(_0x1008cf){var _0x4124c2=_0x1008cf['count'],_0x4e4f15=_0x2594eb[_0xd892('0x30')],_0x34b431=_0x2594eb[_0xd892('0x30')]+_0x2594eb['limit'],_0x2b7dc9;if(_0x34b431>=_0x4124c2){_0x34b431=_0x4124c2;_0x2b7dc9=0xc8;}else{_0x2b7dc9=0xce;}_0x1ee6f8[_0xd892('0x2e')](_0x2b7dc9);return _0x1ee6f8['set'](_0xd892('0x31'),_0x4e4f15+'-'+_0x34b431+'/'+_0x4124c2)['json'](_0x1008cf);}return null;};}function patchUpdates(_0x7203a2){return function(_0x47e427){try{jsonpatch['apply'](_0x47e427,_0x7203a2,!![]);}catch(_0x22abbb){return BPromise[_0xd892('0x32')](_0x22abbb);}return _0x47e427[_0xd892('0x33')]();};}function saveUpdates(_0x551f92,_0x553d19){return function(_0x28b744){if(_0x28b744){return _0x28b744['update'](_0x551f92)[_0xd892('0x34')](function(_0xe61c0a){return _0xe61c0a;});}return null;};}function removeEntity(_0x5f308a,_0x57354c){return function(_0x50ea54){if(_0x50ea54){return _0x50ea54[_0xd892('0x35')]()[_0xd892('0x34')](function(){var _0x3416f6=_0x50ea54[_0xd892('0x36')]({'plain':!![]});var _0x5330bf=_0xd892('0x37');return db['UserProfileResource']['destroy']({'where':{'type':_0x5330bf,'resourceId':_0x3416f6['id']}})['then'](function(){return _0x50ea54;});})[_0xd892('0x34')](function(){_0x5f308a['status'](0xcc)[_0xd892('0x38')]();});}};}function handleEntityNotFound(_0x1a51da,_0x3c8b8c){return function(_0x3621ec){if(!_0x3621ec){_0x1a51da[_0xd892('0x39')](0x194);}return _0x3621ec;};}function handleError(_0x22ddb9,_0x6f215f){_0x6f215f=_0x6f215f||0x1f4;return function(_0x502f5a){logger[_0xd892('0x29')](_0x502f5a[_0xd892('0x3a')]);if(_0x502f5a[_0xd892('0x3b')]){delete _0x502f5a[_0xd892('0x3b')];}_0x22ddb9[_0xd892('0x2e')](_0x6f215f)[_0xd892('0x3c')](_0x502f5a);};}exports[_0xd892('0x3d')]=function(_0x467d54,_0x538c9f){var _0x3ab944={'include':[{'model':db[_0xd892('0x3e')],'as':_0xd892('0x3f')}]},_0x18dd65={},_0x37d250={'count':0x0,'rows':[]};var _0x47ef09=_[_0xd892('0x40')](db[_0xd892('0x41')]['rawAttributes'],function(_0x132c49){return{'name':_0x132c49[_0xd892('0x42')],'type':_0x132c49[_0xd892('0x43')]['key']};});_0x18dd65[_0xd892('0x44')]=_[_0xd892('0x40')](_0x47ef09,_0xd892('0x3b'));_0x18dd65[_0xd892('0x45')]=_[_0xd892('0x46')](_0x467d54[_0xd892('0x45')]);_0x18dd65[_0xd892('0x47')]=_[_0xd892('0x48')](_0x18dd65[_0xd892('0x44')],_0x18dd65[_0xd892('0x45')]);_0x3ab944[_0xd892('0x49')]=_['intersection'](_0x18dd65[_0xd892('0x44')],qs[_0xd892('0x4a')](_0x467d54['query'][_0xd892('0x4a')]));_0x3ab944[_0xd892('0x49')]=_0x3ab944['attributes'][_0xd892('0x4b')]?_0x3ab944['attributes']:_0x18dd65['model'];if(!_0x467d54[_0xd892('0x45')]['hasOwnProperty'](_0xd892('0x4c'))){_0x3ab944[_0xd892('0x4d')]=qs[_0xd892('0x4d')](_0x467d54[_0xd892('0x45')][_0xd892('0x4d')]);_0x3ab944[_0xd892('0x30')]=qs[_0xd892('0x30')](_0x467d54['query'][_0xd892('0x30')]);}_0x3ab944[_0xd892('0x4e')]=qs[_0xd892('0x4f')](_0x467d54[_0xd892('0x45')]['sort']);_0x3ab944['where']=qs[_0xd892('0x47')](_[_0xd892('0x50')](_0x467d54[_0xd892('0x45')],_0x18dd65[_0xd892('0x47')]));if(_0x467d54[_0xd892('0x45')][_0xd892('0x51')]){_0x3ab944['where']=_['merge'](_0x3ab944[_0xd892('0x52')],{'$or':_[_0xd892('0x40')](_0x47ef09,function(_0x22ccad){if(_0x22ccad[_0xd892('0x43')]!==_0xd892('0x53')){var _0x58aa5d={};_0x58aa5d[_0x22ccad[_0xd892('0x3b')]]={'$like':'%'+_0x467d54[_0xd892('0x45')][_0xd892('0x51')]+'%'};return _0x58aa5d;}})});}_0x3ab944=_[_0xd892('0x54')]({},_0x3ab944,_0x467d54[_0xd892('0x55')]);var _0x3d7130={'where':_0x3ab944[_0xd892('0x52')]};return db[_0xd892('0x41')]['count'](_0x3d7130)[_0xd892('0x34')](function(_0x178d2b){_0x37d250[_0xd892('0x56')]=_0x178d2b;if(_0x467d54['query'][_0xd892('0x57')]){_0x3ab944[_0xd892('0x58')]=[{'all':!![]}];}return db[_0xd892('0x41')][_0xd892('0x59')](_0x3ab944);})[_0xd892('0x34')](function(_0x1c4da7){_0x37d250[_0xd892('0x5a')]=_0x1c4da7;return _0x37d250;})['then'](respondWithFilteredResult(_0x538c9f,_0x3ab944))['catch'](handleError(_0x538c9f,null));};exports['show']=function(_0x2c2d7a,_0x2b8d79){var _0x4d9327={'raw':![],'where':{'id':_0x2c2d7a[_0xd892('0x5b')]['id']},'include':[{'model':db['Pause'],'as':_0xd892('0x3f')}]},_0x1015ca={};_0x1015ca[_0xd892('0x44')]=_['keys'](db[_0xd892('0x41')][_0xd892('0x5c')]);_0x1015ca[_0xd892('0x45')]=_[_0xd892('0x46')](_0x2c2d7a[_0xd892('0x45')]);_0x1015ca[_0xd892('0x47')]=_[_0xd892('0x48')](_0x1015ca['model'],_0x1015ca[_0xd892('0x45')]);_0x4d9327[_0xd892('0x49')]=_[_0xd892('0x48')](_0x1015ca['model'],qs['fields'](_0x2c2d7a['query'][_0xd892('0x4a')]));_0x4d9327[_0xd892('0x49')]=_0x4d9327[_0xd892('0x49')][_0xd892('0x4b')]?_0x4d9327[_0xd892('0x49')]:_0x1015ca[_0xd892('0x44')];if(_0x2c2d7a[_0xd892('0x45')][_0xd892('0x57')]){_0x4d9327[_0xd892('0x58')]=[{'all':!![]}];}_0x4d9327=_[_0xd892('0x54')]({},_0x4d9327,_0x2c2d7a[_0xd892('0x55')]);return db[_0xd892('0x41')][_0xd892('0x5d')](_0x4d9327)[_0xd892('0x34')](handleEntityNotFound(_0x2b8d79,null))[_0xd892('0x34')](respondWithResult(_0x2b8d79,null))[_0xd892('0x2d')](handleError(_0x2b8d79,null));};exports[_0xd892('0x5e')]=function(_0x5eed29,_0x3d3fc8){return db[_0xd892('0x41')]['create'](_0x5eed29['body'],{})[_0xd892('0x34')](function(_0x4b824b){var _0x18662e=_0x5eed29['user']['get']({'plain':!![]});if(!_0x18662e)throw new Error(_0xd892('0x5f'));if(_0x18662e[_0xd892('0x60')]==='user'){var _0x24e7dd=_0x4b824b[_0xd892('0x36')]({'plain':!![]});var _0x2ff8a2=_0xd892('0x37');return db[_0xd892('0x61')]['find']({'where':{'name':_0x2ff8a2,'userProfileId':_0x18662e[_0xd892('0x62')]},'raw':!![]})[_0xd892('0x34')](function(_0x2d8777){if(_0x2d8777&&_0x2d8777['autoAssociation']===0x0){return db['UserProfileResource'][_0xd892('0x5e')]({'name':_0x24e7dd[_0xd892('0x3b')],'resourceId':_0x24e7dd['id'],'type':_0x2d8777['name'],'sectionId':_0x2d8777['id']},{})[_0xd892('0x34')](function(){return _0x4b824b;});}else{return _0x4b824b;}})[_0xd892('0x2d')](function(_0x14ea4e){logger[_0xd892('0x29')](_0xd892('0x63'),_0x14ea4e);throw _0x14ea4e;});}return _0x4b824b;})['then'](respondWithResult(_0x3d3fc8,0xc9))['catch'](handleError(_0x3d3fc8,null));};exports[_0xd892('0x64')]=function(_0x2f8925,_0x499bab){if(_0x2f8925[_0xd892('0x65')]['id']){delete _0x2f8925[_0xd892('0x65')]['id'];}return db[_0xd892('0x41')][_0xd892('0x5d')]({'where':{'id':_0x2f8925[_0xd892('0x5b')]['id']},'include':[{'model':db[_0xd892('0x3e')],'as':_0xd892('0x3f')}]})[_0xd892('0x34')](handleEntityNotFound(_0x499bab,null))[_0xd892('0x34')](saveUpdates(_0x2f8925[_0xd892('0x65')],null))[_0xd892('0x34')](respondWithResult(_0x499bab,null))[_0xd892('0x2d')](handleError(_0x499bab,null));};exports['destroy']=function(_0x5ab242,_0x39f9a9){return db['FaxAccount'][_0xd892('0x5d')]({'where':{'id':_0x5ab242[_0xd892('0x5b')]['id']}})[_0xd892('0x34')](handleEntityNotFound(_0x39f9a9,null))['then'](removeEntity(_0x39f9a9,null))['catch'](handleError(_0x39f9a9,null));};exports['describe']=function(_0x175e20,_0x474e9f){return db[_0xd892('0x41')]['describe']()[_0xd892('0x34')](respondWithResult(_0x474e9f,null))[_0xd892('0x2d')](handleError(_0x474e9f,null));};exports[_0xd892('0x66')]=function(_0x3ddfb6,_0x19cd0c,_0x17a676){if(_0x3ddfb6[_0xd892('0x65')]['id']){delete _0x3ddfb6['body']['id'];}return db[_0xd892('0x41')][_0xd892('0x5d')]({'where':{'id':_0x3ddfb6['params']['id']}})['then'](handleEntityNotFound(_0x19cd0c,null))[_0xd892('0x34')](function(_0xabd598){if(_0xabd598){_0x3ddfb6[_0xd892('0x65')][_0xd892('0x67')]=_0xabd598['id'];return db[_0xd892('0x68')][_0xd892('0x5e')](_0x3ddfb6[_0xd892('0x65')]);}})[_0xd892('0x34')](respondWithResult(_0x19cd0c,null))[_0xd892('0x2d')](handleError(_0x19cd0c,null));};exports[_0xd892('0x69')]=function(_0x12c798,_0x417a43,_0x4276a6){var _0x2582bb={'raw':![],'where':{}};var _0x2935bc={};var _0x2ae94e={'count':0x0,'rows':[]};return db['FaxAccount'][_0xd892('0x6a')]({'where':{'id':_0x12c798[_0xd892('0x5b')]['id']}})[_0xd892('0x34')](handleEntityNotFound(_0x417a43,null))[_0xd892('0x34')](function(_0x267bb2){if(_0x267bb2){_0x2935bc[_0xd892('0x44')]=_['keys'](db['Disposition'][_0xd892('0x5c')]);_0x2935bc[_0xd892('0x45')]=_[_0xd892('0x46')](_0x12c798[_0xd892('0x45')]);_0x2935bc[_0xd892('0x47')]=_[_0xd892('0x48')](_0x2935bc[_0xd892('0x44')],_0x2935bc[_0xd892('0x45')]);_0x2582bb[_0xd892('0x49')]=_[_0xd892('0x48')](_0x2935bc['model'],qs[_0xd892('0x4a')](_0x12c798[_0xd892('0x45')][_0xd892('0x4a')]));_0x2582bb[_0xd892('0x49')]=_0x2582bb['attributes'][_0xd892('0x4b')]?_0x2582bb[_0xd892('0x49')]:_0x2935bc['model'];if(!_0x12c798[_0xd892('0x45')][_0xd892('0x6b')](_0xd892('0x4c'))){_0x2582bb[_0xd892('0x4d')]=qs[_0xd892('0x4d')](_0x12c798[_0xd892('0x45')]['limit']);_0x2582bb[_0xd892('0x30')]=qs[_0xd892('0x30')](_0x12c798['query'][_0xd892('0x30')]);}_0x2582bb[_0xd892('0x4e')]=qs[_0xd892('0x4f')](_0x12c798[_0xd892('0x45')]['sort']);_0x2582bb[_0xd892('0x52')]=qs['filters'](_[_0xd892('0x50')](_0x12c798[_0xd892('0x45')],_0x2935bc[_0xd892('0x47')]));_0x2582bb[_0xd892('0x52')][_0xd892('0x67')]=_0x267bb2['id'];if(_0x12c798['query'][_0xd892('0x51')]){_0x2582bb['where']=_[_0xd892('0x54')](_0x2582bb[_0xd892('0x52')],{'$or':_['map'](_0x2582bb['attributes'],function(_0x6d88b7){var _0x353e37={};_0x353e37[_0x6d88b7]={'$like':'%'+_0x12c798[_0xd892('0x45')][_0xd892('0x51')]+'%'};return _0x353e37;})});}_0x2582bb=_['merge']({},_0x2582bb,_0x12c798[_0xd892('0x55')]);return db['Disposition'][_0xd892('0x56')]({'where':_0x2582bb[_0xd892('0x52')]})['then'](function(_0x27e9dc){_0x2ae94e['count']=_0x27e9dc;if(_0x12c798[_0xd892('0x45')][_0xd892('0x57')]){_0x2582bb[_0xd892('0x58')]=[{'all':!![]}];}return db[_0xd892('0x68')]['findAll'](_0x2582bb);})[_0xd892('0x34')](function(_0x13b438){_0x2ae94e[_0xd892('0x5a')]=_0x13b438;return _0x2ae94e;});}})[_0xd892('0x34')](respondWithFilteredResult(_0x417a43,_0x2582bb))['catch'](handleError(_0x417a43,null));};exports[_0xd892('0x6c')]=function(_0x38b4b2,_0x1f65f0,_0x5ac75f){return db[_0xd892('0x41')]['find']({'where':{'id':_0x38b4b2[_0xd892('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1f65f0,null))[_0xd892('0x34')](function(_0x461b58){if(_0x461b58){return _0x461b58[_0xd892('0x6c')](_0x38b4b2[_0xd892('0x45')]['ids']);}})[_0xd892('0x34')](respondWithStatusCode(_0x1f65f0,null))[_0xd892('0x2d')](handleError(_0x1f65f0,null));};exports[_0xd892('0x6d')]=function(_0x541079,_0x5f4d9e,_0x5e7f65){if(_0x541079[_0xd892('0x65')]['id']){delete _0x541079['body']['id'];}return db[_0xd892('0x41')][_0xd892('0x5d')]({'where':{'id':_0x541079[_0xd892('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5f4d9e,null))[_0xd892('0x34')](function(_0x43afe2){if(_0x43afe2){_0x541079[_0xd892('0x65')][_0xd892('0x67')]=_0x43afe2['id'];return db[_0xd892('0x6e')]['create'](_0x541079[_0xd892('0x65')]);}})[_0xd892('0x34')](respondWithResult(_0x5f4d9e,null))[_0xd892('0x2d')](handleError(_0x5f4d9e,null));};exports[_0xd892('0x6f')]=function(_0x25197e,_0xa4d17d,_0x50dbdf){var _0x44feae={'raw':![],'where':{}};var _0xd60c40={};var _0x850654={'count':0x0,'rows':[]};return db[_0xd892('0x41')][_0xd892('0x6a')]({'where':{'id':_0x25197e[_0xd892('0x5b')]['id']}})[_0xd892('0x34')](handleEntityNotFound(_0xa4d17d,null))[_0xd892('0x34')](function(_0x367daa){if(_0x367daa){_0xd60c40[_0xd892('0x44')]=_[_0xd892('0x46')](db[_0xd892('0x6e')][_0xd892('0x5c')]);_0xd60c40['query']=_['keys'](_0x25197e['query']);_0xd60c40['filters']=_['intersection'](_0xd60c40[_0xd892('0x44')],_0xd60c40[_0xd892('0x45')]);_0x44feae[_0xd892('0x49')]=_[_0xd892('0x48')](_0xd60c40[_0xd892('0x44')],qs[_0xd892('0x4a')](_0x25197e[_0xd892('0x45')][_0xd892('0x4a')]));_0x44feae['attributes']=_0x44feae[_0xd892('0x49')][_0xd892('0x4b')]?_0x44feae[_0xd892('0x49')]:_0xd60c40[_0xd892('0x44')];if(!_0x25197e[_0xd892('0x45')][_0xd892('0x6b')](_0xd892('0x4c'))){_0x44feae['limit']=qs[_0xd892('0x4d')](_0x25197e[_0xd892('0x45')][_0xd892('0x4d')]);_0x44feae[_0xd892('0x30')]=qs[_0xd892('0x30')](_0x25197e[_0xd892('0x45')][_0xd892('0x30')]);}_0x44feae[_0xd892('0x4e')]=qs[_0xd892('0x4f')](_0x25197e['query'][_0xd892('0x4f')]);_0x44feae[_0xd892('0x52')]=qs['filters'](_['pick'](_0x25197e['query'],_0xd60c40[_0xd892('0x47')]));_0x44feae['where']['FaxAccountId']=_0x367daa['id'];if(_0x25197e[_0xd892('0x45')][_0xd892('0x51')]){_0x44feae[_0xd892('0x52')]=_[_0xd892('0x54')](_0x44feae[_0xd892('0x52')],{'$or':_['map'](_0x44feae['attributes'],function(_0x54a88f){var _0x4fa939={};_0x4fa939[_0x54a88f]={'$like':'%'+_0x25197e[_0xd892('0x45')]['filter']+'%'};return _0x4fa939;})});}_0x44feae=_['merge']({},_0x44feae,_0x25197e['options']);return db[_0xd892('0x6e')][_0xd892('0x56')]({'where':_0x44feae[_0xd892('0x52')]})[_0xd892('0x34')](function(_0x192501){_0x850654[_0xd892('0x56')]=_0x192501;if(_0x25197e[_0xd892('0x45')][_0xd892('0x57')]){_0x44feae[_0xd892('0x58')]=[{'all':!![]}];}return db['CannedAnswer'][_0xd892('0x59')](_0x44feae);})[_0xd892('0x34')](function(_0x2f02da){_0x850654[_0xd892('0x5a')]=_0x2f02da;return _0x850654;});}})['then'](respondWithFilteredResult(_0xa4d17d,_0x44feae))[_0xd892('0x2d')](handleError(_0xa4d17d,null));};exports[_0xd892('0x70')]=function(_0x4c45a1,_0x4026d0,_0x2d99e2){return db['FaxAccount'][_0xd892('0x5d')]({'where':{'id':_0x4c45a1[_0xd892('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4026d0,null))[_0xd892('0x34')](function(_0x2cca7a){if(_0x2cca7a){return _0x2cca7a[_0xd892('0x70')](_0x4c45a1[_0xd892('0x45')]['ids']);}})[_0xd892('0x34')](respondWithStatusCode(_0x4026d0,null))[_0xd892('0x2d')](handleError(_0x4026d0,null));};exports['addInteraction']=function(_0x153430,_0x1b6829,_0x24b324){return db['FaxInteraction']['find']({'where':{'id':_0x153430[_0xd892('0x5b')]['id']}})[_0xd892('0x34')](handleEntityNotFound(_0x1b6829,null))[_0xd892('0x34')](function(_0x1d0c68){if(_0x1d0c68){return _0x1d0c68[_0xd892('0x71')](_0x153430[_0xd892('0x65')][_0xd892('0x72')],_[_0xd892('0x73')](_0x153430['body'],[_0xd892('0x72'),'id'])||{});}})[_0xd892('0x34')](respondWithResult(_0x1b6829,null))[_0xd892('0x2d')](handleError(_0x1b6829,null));};exports[_0xd892('0x74')]=function(_0x54ce47,_0x1755f4,_0x3b92ae){var _0x4c2dc0={'raw':![],'where':{}};var _0x544c39={};var _0x49c1c4={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x54ce47[_0xd892('0x5b')]['id']}})[_0xd892('0x34')](handleEntityNotFound(_0x1755f4,null))[_0xd892('0x34')](function(_0x479ecc){if(_0x479ecc){_0x544c39[_0xd892('0x44')]=_[_0xd892('0x46')](db[_0xd892('0x75')][_0xd892('0x5c')]);_0x544c39[_0xd892('0x45')]=_[_0xd892('0x46')](_0x54ce47['query']);_0x544c39['filters']=_[_0xd892('0x48')](_0x544c39[_0xd892('0x44')],_0x544c39['query']);_0x4c2dc0[_0xd892('0x49')]=_[_0xd892('0x48')](_0x544c39[_0xd892('0x44')],qs[_0xd892('0x4a')](_0x54ce47['query'][_0xd892('0x4a')]));_0x4c2dc0[_0xd892('0x49')]=_0x4c2dc0[_0xd892('0x49')][_0xd892('0x4b')]?_0x4c2dc0[_0xd892('0x49')]:_0x544c39[_0xd892('0x44')];if(!_0x54ce47['query'][_0xd892('0x6b')](_0xd892('0x4c'))){_0x4c2dc0[_0xd892('0x4d')]=qs[_0xd892('0x4d')](_0x54ce47[_0xd892('0x45')][_0xd892('0x4d')]);_0x4c2dc0[_0xd892('0x30')]=qs['offset'](_0x54ce47['query']['offset']);}_0x4c2dc0[_0xd892('0x4e')]=qs[_0xd892('0x4f')](_0x54ce47[_0xd892('0x45')][_0xd892('0x4f')]);_0x4c2dc0['where']=qs['filters'](_[_0xd892('0x50')](_0x54ce47['query'],_0x544c39[_0xd892('0x47')]));_0x4c2dc0[_0xd892('0x52')][_0xd892('0x67')]=_0x479ecc['id'];if(_0x54ce47[_0xd892('0x45')]['filter']){_0x4c2dc0['where']=_[_0xd892('0x54')](_0x4c2dc0[_0xd892('0x52')],{'$or':_['map'](_0x4c2dc0['attributes'],function(_0x2e7128){var _0x4defa1={};_0x4defa1[_0x2e7128]={'$like':'%'+_0x54ce47[_0xd892('0x45')][_0xd892('0x51')]+'%'};return _0x4defa1;})});}_0x4c2dc0=_[_0xd892('0x54')]({},_0x4c2dc0,_0x54ce47['options']);return db['FaxInteraction'][_0xd892('0x56')]({'where':_0x4c2dc0[_0xd892('0x52')]})[_0xd892('0x34')](function(_0x2cef9f){_0x49c1c4['count']=_0x2cef9f;if(_0x54ce47['query'][_0xd892('0x57')]){_0x4c2dc0['include']=[{'model':db['CmContact'],'as':_0xd892('0x76'),'required':![]},{'model':db[_0xd892('0x77')],'as':'Owner','attributes':[_0xd892('0x3b'),'fullname',_0xd892('0x78')],'required':![]},{'model':db[_0xd892('0x79')],'as':_0xd892('0x7a'),'attributes':['id',_0xd892('0x3b'),'color'],'where':_0x54ce47[_0xd892('0x45')][_0xd892('0x7b')]?{'id':_0x54ce47[_0xd892('0x45')][_0xd892('0x7b')]}:undefined,'required':_0x54ce47[_0xd892('0x45')]['tag']?!![]:![]}];}return db['FaxInteraction'][_0xd892('0x59')](_0x4c2dc0);})[_0xd892('0x34')](function(_0x3da97f){_0x49c1c4[_0xd892('0x5a')]=_0x3da97f;return _0x49c1c4;});}})[_0xd892('0x34')](respondWithFilteredResult(_0x1755f4,_0x4c2dc0))['catch'](handleError(_0x1755f4,null));};exports[_0xd892('0x7c')]=function(_0x5d732a,_0x507a88,_0x17c5de){return db[_0xd892('0x41')][_0xd892('0x6a')]({'where':{'id':_0x5d732a['params']['id']}})['then'](handleEntityNotFound(_0x507a88,null))[_0xd892('0x34')](function(_0x2b057d){if(_0x2b057d){return db[_0xd892('0x7d')][_0xd892('0x7e')](function(_0x4a17c9){return db[_0xd892('0x7f')][_0xd892('0x35')]({'where':{'FaxAccountId':_0x5d732a[_0xd892('0x5b')]['id']},'transaction':_0x4a17c9})[_0xd892('0x34')](function(_0xcd9bf8){var _0x482dcd=_[_0xd892('0x40')](_0x5d732a[_0xd892('0x65')],function(_0x4968ea){_0x4968ea[_0xd892('0x67')]=_0x5d732a['params']['id'];return _0x4968ea;});return db[_0xd892('0x7f')][_0xd892('0x80')](_0x482dcd,{'transaction':_0x4a17c9});});})[_0xd892('0x34')](function(){return db[_0xd892('0x7f')][_0xd892('0x81')]({'where':{'FaxAccountId':_0x5d732a[_0xd892('0x5b')]['id']},'order':_0xd892('0x82')});});}})['then'](respondWithResult(_0x507a88,null))[_0xd892('0x2d')](handleError(_0x507a88,null));};exports['getApplications']=function(_0x53c2c1,_0x1dee4e,_0x4770c8){var _0x32673c={};var _0x2ffc34={};var _0x5f1b59;var _0x302450;return db[_0xd892('0x41')][_0xd892('0x6a')]({'where':{'id':_0x53c2c1[_0xd892('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1dee4e,null))[_0xd892('0x34')](function(_0x1c2945){if(_0x1c2945){_0x5f1b59=_0x1c2945;_0x2ffc34['model']=_['keys'](db[_0xd892('0x7f')]['rawAttributes']);_0x2ffc34[_0xd892('0x45')]=_[_0xd892('0x46')](_0x53c2c1[_0xd892('0x45')]);_0x2ffc34[_0xd892('0x47')]=_['intersection'](_0x2ffc34[_0xd892('0x44')],_0x2ffc34[_0xd892('0x45')]);_0x32673c['attributes']=_[_0xd892('0x48')](_0x2ffc34['model'],qs[_0xd892('0x4a')](_0x53c2c1['query']['fields']));_0x32673c[_0xd892('0x49')]=_0x32673c[_0xd892('0x49')]['length']?_0x32673c[_0xd892('0x49')]:_0x2ffc34[_0xd892('0x44')];_0x32673c['order']=qs['sort'](_0x53c2c1['query'][_0xd892('0x4f')]);_0x32673c[_0xd892('0x52')]=qs[_0xd892('0x47')](_['pick'](_0x53c2c1[_0xd892('0x45')],_0x2ffc34[_0xd892('0x47')]));if(_0x53c2c1[_0xd892('0x45')][_0xd892('0x51')]){_0x32673c[_0xd892('0x52')]=_[_0xd892('0x54')](_0x32673c[_0xd892('0x52')],{'$or':_[_0xd892('0x40')](_0x32673c[_0xd892('0x49')],function(_0x279377){var _0x28f4a9={};_0x28f4a9[_0x279377]={'$like':'%'+_0x53c2c1[_0xd892('0x45')][_0xd892('0x51')]+'%'};return _0x28f4a9;})});}_0x32673c=_['merge']({},_0x32673c,_0x53c2c1[_0xd892('0x55')]);return _0x5f1b59[_0xd892('0x83')](_0x32673c);}})[_0xd892('0x34')](function(_0x3516b7){if(_0x3516b7){_0x302450=_0x3516b7[_0xd892('0x4b')];if(!_0x53c2c1[_0xd892('0x45')][_0xd892('0x6b')](_0xd892('0x4c'))){_0x32673c['limit']=qs[_0xd892('0x4d')](_0x53c2c1['query'][_0xd892('0x4d')]);_0x32673c[_0xd892('0x30')]=qs[_0xd892('0x30')](_0x53c2c1[_0xd892('0x45')][_0xd892('0x30')]);}return _0x5f1b59[_0xd892('0x83')](_0x32673c);}})[_0xd892('0x34')](function(_0x4a95cf){if(_0x4a95cf){return _0x4a95cf?{'count':_0x302450,'rows':_0x4a95cf}:null;}})[_0xd892('0x34')](respondWithResult(_0x1dee4e,null))[_0xd892('0x2d')](handleError(_0x1dee4e,null));};function Extension(_0x4508c9,_0x363043,_0x2265e2,_0x287514){this[_0xd892('0x84')]=_0xd892('0x85');this[_0xd892('0x86')]=_0x4508c9[_0xd892('0x87')];this[_0xd892('0x88')]=_0x287514;this[_0xd892('0x43')]=_0xd892('0x89');this[_0xd892('0x8a')]='Fax\x20Extension';this[_0xd892('0x67')]=_0x4508c9['id'];this[_0xd892('0x82')]=_0x363043;this[_0xd892('0x8b')]=_0x2265e2;}function createExtensionsReciveFax(_0x173641){var _0x3007e7=0x1;var _0x26215e=[];_0x26215e[_0xd892('0x8c')](new Extension(_0x173641,_0x3007e7,'',_0xd892('0x8d')));_0x3007e7+=0x1;_0x26215e['push'](new Extension(_0x173641,_0x3007e7,'CDR(type)=inbound-fax',_0xd892('0x8e')));_0x3007e7+=0x1;for(var _0x50ffe8 in _0x173641){if(_0x173641['hasOwnProperty'](_0x50ffe8)&&(_0x50ffe8===_0xd892('0x8f')||_0x50ffe8==='localstationid'||_0x50ffe8===_0xd892('0x90')||_0x50ffe8===_0xd892('0x91')||_0x50ffe8==='headerinfo'||_0x50ffe8===_0xd892('0x92')||_0x50ffe8===_0xd892('0x93')||_0x50ffe8==='modem'||_0x50ffe8===_0xd892('0x94'))){_0x26215e[_0xd892('0x8c')](new Extension(_0x173641,_0x3007e7,_0xd892('0x95')+_0x50ffe8+')='+_0x173641[_0x50ffe8],_0xd892('0x8e')));_0x3007e7+=0x1;}}_0x26215e[_0xd892('0x8c')](new Extension(_0x173641,_0x3007e7,'6',_0xd892('0x96')));_0x3007e7+=0x1;_0x26215e[_0xd892('0x8c')](new Extension(_0x173641,_0x3007e7,_0xd892('0x97'),'ReceiveFax'));_0x3007e7=0x0;return _0x26215e;}exports[_0xd892('0x98')]=function(_0x1581e3,_0x18edbd,_0xbb78fb){var _0x559141;return db[_0xd892('0x7d')][_0xd892('0x7e')](function(_0x2d6570){return db[_0xd892('0x41')][_0xd892('0x5e')](_0x1581e3[_0xd892('0x65')],{'transaction':_0x2d6570})[_0xd892('0x34')](function(_0xfba323){_0x559141=_0xfba323[_0xd892('0x36')]({'plain':!![]});return db[_0xd892('0x99')][_0xd892('0x80')](createExtensionsReciveFax(_0x559141),{'transaction':_0x2d6570});});})[_0xd892('0x34')](function(){return _0x559141;})[_0xd892('0x34')](respondWithResult(_0x18edbd,null))['catch'](handleError(_0x18edbd,null));};exports[_0xd892('0x9a')]=function(_0x352ef2,_0x2f0a7c,_0x426041){var _0x3b1395;return db[_0xd892('0x7d')][_0xd892('0x7e')](function(_0x4ae62d){return db['FaxAccount'][_0xd892('0x64')](_0x352ef2[_0xd892('0x65')],{'where':{'id':_0x352ef2[_0xd892('0x65')]['id']},'transaction':_0x4ae62d})[_0xd892('0x34')](function(_0x158f53){return db['VoiceExtension'][_0xd892('0x35')]({'where':{'FaxAccountId':_0x352ef2[_0xd892('0x65')]['id']},'transaction':_0x4ae62d})[_0xd892('0x34')](function(_0x1e3461){return db[_0xd892('0x99')][_0xd892('0x80')](createExtensionsReciveFax(_['omit'](_0x352ef2[_0xd892('0x65')],[_0xd892('0x9b'),_0xd892('0x9c'),'createdAt','updatedAt',_0xd892('0x9d'),_0xd892('0x9e')])),{'transaction':_0x4ae62d});});});})[_0xd892('0x34')](function(){return db[_0xd892('0x41')][_0xd892('0x9f')](_0x352ef2['body']['id']);})[_0xd892('0x34')](respondWithResult(_0x2f0a7c,null))['catch'](handleError(_0x2f0a7c,null));};exports[_0xd892('0xa0')]=function(_0x1b0f63,_0x177def,_0x5762e9){var _0x3c5bcf={'raw':!![],'where':{}};var _0x568d98={};var _0x26b87f={'count':0x0,'rows':[]};return db['FaxAccount'][_0xd892('0x6a')]({'where':{'id':_0x1b0f63['params']['id']}})[_0xd892('0x34')](handleEntityNotFound(_0x177def,null))[_0xd892('0x34')](function(_0x304fa1){if(_0x304fa1){_0x568d98['model']=_['keys'](db['FaxMessage']['rawAttributes']);_0x568d98[_0xd892('0x45')]=_[_0xd892('0x46')](_0x1b0f63[_0xd892('0x45')]);_0x568d98[_0xd892('0x47')]=_[_0xd892('0x48')](_0x568d98['model'],_0x568d98[_0xd892('0x45')]);_0x3c5bcf[_0xd892('0x49')]=_['intersection'](_0x568d98['model'],qs[_0xd892('0x4a')](_0x1b0f63['query'][_0xd892('0x4a')]));_0x3c5bcf[_0xd892('0x49')]=_0x3c5bcf[_0xd892('0x49')][_0xd892('0x4b')]?_0x3c5bcf['attributes']:_0x568d98['model'];if(!_0x1b0f63['query']['hasOwnProperty'](_0xd892('0x4c'))){_0x3c5bcf['limit']=qs[_0xd892('0x4d')](_0x1b0f63['query'][_0xd892('0x4d')]);_0x3c5bcf[_0xd892('0x30')]=qs[_0xd892('0x30')](_0x1b0f63[_0xd892('0x45')]['offset']);}_0x3c5bcf['order']=qs[_0xd892('0x4f')](_0x1b0f63[_0xd892('0x45')]['sort']);_0x3c5bcf[_0xd892('0x52')]=qs['filters'](_[_0xd892('0x50')](_0x1b0f63[_0xd892('0x45')],_0x568d98[_0xd892('0x47')]));_0x3c5bcf[_0xd892('0x52')]['FaxAccountId']=_0x304fa1['id'];if(_0x1b0f63[_0xd892('0x45')][_0xd892('0x51')]){_0x3c5bcf['where']=_['merge'](_0x3c5bcf[_0xd892('0x52')],{'$or':_[_0xd892('0x40')](_0x3c5bcf['attributes'],function(_0x5ad822){var _0x378711={};_0x378711[_0x5ad822]={'$like':'%'+_0x1b0f63[_0xd892('0x45')][_0xd892('0x51')]+'%'};return _0x378711;})});}if(_0x1b0f63[_0xd892('0x45')][_0xd892('0xa1')]){var _0x31a646=_0x1b0f63[_0xd892('0x45')][_0xd892('0xa1')][_0xd892('0xa2')](',');var _0x46ee78={};_0x46ee78[_0x31a646[0x0]]={'$gte':moment(_0x31a646[0x1])[_0xd892('0xa3')](_0xd892('0xa4'))};_0x3c5bcf['where']=_[_0xd892('0x54')](_0x3c5bcf[_0xd892('0x52')],_0x46ee78);}_0x3c5bcf=_[_0xd892('0x54')]({},_0x3c5bcf,_0x1b0f63[_0xd892('0x55')]);return db['FaxMessage'][_0xd892('0x56')]({'where':_0x3c5bcf[_0xd892('0x52')]})[_0xd892('0x34')](function(_0x488b77){_0x26b87f['count']=_0x488b77;if(_0x1b0f63['query']['includeAll']){_0x3c5bcf[_0xd892('0x58')]=[{'all':!![]}];}return db[_0xd892('0xa5')][_0xd892('0x59')](_0x3c5bcf);})['then'](function(_0x2d33e7){_0x26b87f['rows']=_0x2d33e7;return _0x26b87f;});}})[_0xd892('0x34')](respondWithFilteredResult(_0x177def,_0x3c5bcf))['catch'](handleError(_0x177def,null));};exports[_0xd892('0x3c')]=function(_0x404c7c,_0x5f4c3e,_0x17a16e){var _0x211349,_0x943ea0={},_0x13c007;if(_0x404c7c[_0xd892('0x65')]['to']){_0x13c007=_0x404c7c[_0xd892('0x65')]['to'][0x0];}return db[_0xd892('0x41')][_0xd892('0x5d')]({'where':{'id':_0x404c7c[_0xd892('0x5b')]['id']},'include':[{'model':db[_0xd892('0xa6')],'as':_0xd892('0xa7'),'include':[{'model':db['CmContact'],'as':_0xd892('0xa8'),'where':{'fax':_0x13c007},'limit':0x1,'order':[[_0xd892('0xa9'),'DESC']]}]}]})[_0xd892('0x34')](handleEntityNotFound(_0x5f4c3e,null))[_0xd892('0x34')](function(_0xbfef3b){_0x211349=_0xbfef3b;if(_0x404c7c[_0xd892('0x65')][_0xd892('0xaa')]&&_0x404c7c[_0xd892('0x65')][_0xd892('0xaa')][_0xd892('0x4b')]){for(var _0x340c16=0x0;_0x340c16<_0x404c7c[_0xd892('0x65')][_0xd892('0xaa')][_0xd892('0x4b')];_0x340c16+=0x1){_0x404c7c[_0xd892('0x65')]['attachments'][_0x340c16]={'filename':_0x404c7c[_0xd892('0x65')][_0xd892('0xaa')][_0x340c16][_0xd892('0x3b')],'id':_0x404c7c[_0xd892('0x65')][_0xd892('0xaa')][_0x340c16]['id'],'path':path['join'](config[_0xd892('0xab')],_0xd892('0xac'),_0x404c7c[_0xd892('0x65')][_0xd892('0xaa')][_0x340c16][_0xd892('0xad')])};}}return respondWithRpcPromise(_0xd892('0xae'),'CheckAfterSend',{'FaxAccountId':_['isNil'](_0x404c7c['params']['id'])?undefined:_0x404c7c['params']['id'],'path':_[_0xd892('0xaf')](_0x404c7c['body'][_0xd892('0xaa')][0x0][_0xd892('0x7')])?undefined:_0x404c7c['body'][_0xd892('0xaa')][0x0][_0xd892('0x7')],'fax':_['isNil'](_0x404c7c[_0xd892('0x65')]['to'][0x0])?undefined:_0x404c7c[_0xd892('0x65')]['to'][0x0]},client9002);})[_0xd892('0x34')](function(){if(_0x211349){if(_[_0xd892('0xaf')](_0x404c7c[_0xd892('0x65')][_0xd892('0xb0')])){_0x404c7c[_0xd892('0x65')][_0xd892('0xb0')]=util[_0xd892('0xa3')](_0xd892('0xb1'),_0x211349[_0xd892('0x3b')],_0x211349[_0xd892('0xb2')]);}if(_0x211349[_0xd892('0xa7')]){if(_0x211349[_0xd892('0xa7')][_0xd892('0xa8')][_0xd892('0x4b')]){return _0x211349[_0xd892('0xa7')]['Contacts'][0x0];}else{return db[_0xd892('0xb3')][_0xd892('0x5e')](_['defaults'](_0x404c7c['body'],{'firstName':_0x404c7c['body']['to'][0x0],'phone':_0x404c7c[_0xd892('0x65')]['to'][0x0],'fax':_0x404c7c[_0xd892('0x65')]['to'][0x0],'ListId':_0x211349['ListId']}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0xd892('0xb4'));}})[_0xd892('0x34')](function(_0x28f101){if(_0x28f101){return db[_0xd892('0x75')]['find']({'where':{'ContactId':_0x28f101['id'],'closed':![],'FaxAccountId':_0x211349['id']}})[_0xd892('0x34')](function(_0x217d25){if(_0x217d25){return[_0x217d25,![]];}return db[_0xd892('0x75')]['create']({'UserId':_0x404c7c[_0xd892('0xb5')]['id'],'ContactId':_0x28f101['id'],'FaxAccountId':_0x211349['id'],'fax':_0x404c7c['body']['to'][0x0],'firstMsgDirection':_0xd892('0xb6'),'Messages':[_[_0xd892('0x54')](_0x404c7c[_0xd892('0x65')],{'read':![],'body':_0x404c7c['body'][_0xd892('0xaa')][0x0][_0xd892('0xb7')],'FaxAccountId':_0x211349['id'],'UserId':_0x404c7c[_0xd892('0xb5')]['id'],'ContactId':_0x28f101['id'],'AttachmentId':_0x404c7c[_0xd892('0x65')][_0xd892('0xaa')][0x0]['id']})]},{'include':[{'model':db[_0xd892('0xa5')],'as':_0xd892('0xb8')}]})['then'](function(_0xe8ab55){return[_0xe8ab55,!![]];});});}else{throw new Error(_0xd892('0xb9'));}})['spread'](function(_0x29b1f6,_0x5adcbd){if(_0x5adcbd){return _0x29b1f6;}return db['FaxMessage']['create']({'direction':_0xd892('0xb6'),'read':![],'body':_0x404c7c[_0xd892('0x65')][_0xd892('0xaa')][0x0][_0xd892('0xb7')],'FaxAccountId':_0x211349['id'],'FaxInteractionId':_0x29b1f6['id'],'UserId':_0x404c7c[_0xd892('0xb5')]['id'],'ContactId':_0x29b1f6[_0xd892('0xba')],'AttachmentId':_0x404c7c[_0xd892('0x65')]['attachments'][0x0]['id']})[_0xd892('0x34')](function(_0xaecc7a){_0x29b1f6['dataValues'][_0xd892('0xb8')]=[];_0x29b1f6[_0xd892('0xbb')]['Messages']['push'](_0xaecc7a[_0xd892('0xbb')]);return _0x29b1f6;});})['then'](function(_0x305d25){respondWithRpcPromise(_0xd892('0xbc'),_0xd892('0xbc'),{'FaxAccountId':_[_0xd892('0xaf')](_0x404c7c['params']['id'])?undefined:_0x404c7c['params']['id'],'path':_[_0xd892('0xaf')](_0x404c7c[_0xd892('0x65')][_0xd892('0xaa')][0x0][_0xd892('0x7')])?undefined:_0x404c7c[_0xd892('0x65')][_0xd892('0xaa')][0x0]['path'],'fax':_[_0xd892('0xaf')](_0x404c7c[_0xd892('0x65')]['to'][0x0])?undefined:_0x404c7c['body']['to'][0x0],'AttachmentId':_0x404c7c[_0xd892('0x65')][_0xd892('0xaa')][0x0]['id']},client9002)['then'](function(_0x628b53){logger[_0xd892('0x25')](_0xd892('0xbd'),_0x628b53);})[_0xd892('0x2d')](function(_0xa9410e){logger[_0xd892('0x25')]('SendFaxRpc,\x20%s',_0xa9410e);});return _0x305d25;})['then'](respondWithResult(_0x5f4c3e,null))['catch'](handleError(_0x5f4c3e,null));};exports[_0xd892('0xbe')]=function(_0x16e43d,_0x54af6c,_0x1fb98b){return db[_0xd892('0x41')]['find']({'where':{'id':_0x16e43d[_0xd892('0x5b')]['id']}})[_0xd892('0x34')](handleEntityNotFound(_0x54af6c,null))[_0xd892('0x34')](function(_0x328701){if(_0x328701){return _0x328701[_0xd892('0xbe')](_0x16e43d[_0xd892('0x65')][_0xd892('0x72')],_[_0xd892('0x73')](_0x16e43d['body'],[_0xd892('0x72'),'id'])||{})['spread'](function(_0x2871a2){for(var _0x14ad1e=0x0;_0x14ad1e<_0x16e43d[_0xd892('0x65')][_0xd892('0x72')]['length'];_0x14ad1e+=0x1){socket[_0xd892('0xbf')]('userFaxAccount:save',{'UserId':_0x16e43d['body'][_0xd892('0x72')][_0x14ad1e],'FaxAccountId':_0x16e43d['params']['id']});}return _0x2871a2;});}})['then'](respondWithResult(_0x54af6c,null))[_0xd892('0x2d')](handleError(_0x54af6c,null));};exports['removeAgents']=function(_0x3bf713,_0x42dfac,_0x15f8a7){return db[_0xd892('0x41')][_0xd892('0x5d')]({'where':{'id':_0x3bf713['params']['id']}})[_0xd892('0x34')](handleEntityNotFound(_0x42dfac,null))[_0xd892('0x34')](function(_0x17a094){if(_0x17a094){return _0x17a094[_0xd892('0xc0')](_0x3bf713[_0xd892('0x45')][_0xd892('0x72')])[_0xd892('0x34')](function(){if(_[_0xd892('0xc1')](_0x3bf713[_0xd892('0x45')]['ids'])){for(var _0x5e4c81=0x0;_0x5e4c81<_0x3bf713[_0xd892('0x45')]['ids'][_0xd892('0x4b')];_0x5e4c81+=0x1){socket[_0xd892('0xbf')](_0xd892('0xc2'),{'UserId':Number(_0x3bf713[_0xd892('0x45')][_0xd892('0x72')][_0x5e4c81]),'FaxAccountId':Number(_0x3bf713[_0xd892('0x5b')]['id'])});}}else{socket[_0xd892('0xbf')](_0xd892('0xc2'),{'UserId':Number(_0x3bf713[_0xd892('0x45')][_0xd892('0x72')]),'FaxAccountId':Number(_0x3bf713[_0xd892('0x5b')]['id'])});}});}})[_0xd892('0x34')](respondWithStatusCode(_0x42dfac,null))[_0xd892('0x2d')](handleError(_0x42dfac,null));};exports['getAgents']=function(_0x538a48,_0x6be97d,_0x924a89){var _0x4155a3={};var _0x29a851={};var _0x816e90;var _0x245925;return db[_0xd892('0x41')]['findOne']({'where':{'id':_0x538a48[_0xd892('0x5b')]['id']}})['then'](handleEntityNotFound(_0x6be97d,null))[_0xd892('0x34')](function(_0x2d0e64){if(_0x2d0e64){_0x816e90=_0x2d0e64;_0x29a851[_0xd892('0x44')]=_[_0xd892('0x46')](db[_0xd892('0x77')][_0xd892('0x5c')]);_0x29a851[_0xd892('0x45')]=_['keys'](_0x538a48[_0xd892('0x45')]);_0x29a851[_0xd892('0x47')]=_[_0xd892('0x48')](_0x29a851[_0xd892('0x44')],_0x29a851[_0xd892('0x45')]);_0x4155a3[_0xd892('0x49')]=_[_0xd892('0x48')](_0x29a851[_0xd892('0x44')],qs[_0xd892('0x4a')](_0x538a48[_0xd892('0x45')]['fields']));_0x4155a3[_0xd892('0x49')]=_0x4155a3[_0xd892('0x49')][_0xd892('0x4b')]?_0x4155a3[_0xd892('0x49')]:_0x29a851[_0xd892('0x44')];_0x4155a3[_0xd892('0x4e')]=qs['sort'](_0x538a48[_0xd892('0x45')][_0xd892('0x4f')]);_0x4155a3[_0xd892('0x52')]=qs['filters'](_[_0xd892('0x50')](_0x538a48[_0xd892('0x45')],_0x29a851[_0xd892('0x47')]));if(_0x538a48['query'][_0xd892('0x51')]){_0x4155a3['where']=_['merge'](_0x4155a3['where'],{'$or':_[_0xd892('0x40')](_0x4155a3[_0xd892('0x49')],function(_0xc0d511){var _0xfdfd36={};_0xfdfd36[_0xc0d511]={'$like':'%'+_0x538a48[_0xd892('0x45')]['filter']+'%'};return _0xfdfd36;})});}_0x4155a3=_[_0xd892('0x54')]({},_0x4155a3,_0x538a48['options']);return _0x816e90[_0xd892('0xc3')](_0x4155a3);}})[_0xd892('0x34')](function(_0x241119){if(_0x241119){_0x245925=_0x241119[_0xd892('0x4b')];if(!_0x538a48['query'][_0xd892('0x6b')](_0xd892('0x4c'))){_0x4155a3['limit']=qs[_0xd892('0x4d')](_0x538a48['query']['limit']);_0x4155a3[_0xd892('0x30')]=qs[_0xd892('0x30')](_0x538a48[_0xd892('0x45')][_0xd892('0x30')]);}return _0x816e90[_0xd892('0xc3')](_0x4155a3);}})[_0xd892('0x34')](function(_0x165bf8){if(_0x165bf8){return _0x165bf8?{'count':_0x245925,'rows':_0x165bf8}:null;}})[_0xd892('0x34')](respondWithResult(_0x6be97d,null))[_0xd892('0x2d')](handleError(_0x6be97d,null));}; \ No newline at end of file +var _0xbecd=['fields','create','body','user','role','get','FaxAccounts','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','hasOwnProperty','order','pick','includeAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','CmContact','Contact','User','Owner','fullname','Tag','Tags','color','tag','addApplications','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','from-voip-provider','system','description','Fax\x20Extension','appdata','push','ecm','localstationid','gateway','headerinfo','maxrate','minrate','modem','FAXOPT(','ReceiveFax','addAccountApplications','sequelize','transaction','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','ListId','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','DESC','attachments','root','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List','Contacts','List\x20not\x20found','filename','Messages','Contact\x20not\x20found','out','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','count','limit','Content-Range','save','update','UserProfileResource','destroy','end','stack','name','send','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','model','query','attributes','length','nolimit','offset','sort','filters','filter','merge','where','options','include','findAll','rows','show','params','Pause','keys','intersection'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0xbecd,0x6a));var _0xdbec=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbecd[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0xdbec('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xdbec('0x1'));var zipdir=require(_0xdbec('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdbec('0x3'));var moment=require(_0xdbec('0x4'));var BPromise=require(_0xdbec('0x5'));var Mustache=require(_0xdbec('0x6'));var util=require(_0xdbec('0x7'));var path=require(_0xdbec('0x8'));var sox=require(_0xdbec('0x9'));var csv=require(_0xdbec('0xa'));var ejs=require(_0xdbec('0xb'));var fs=require('fs');var _=require(_0xdbec('0xc'));var squel=require(_0xdbec('0xd'));var crypto=require(_0xdbec('0xe'));var jsforce=require(_0xdbec('0xf'));var deskjs=require(_0xdbec('0x10'));var toCsv=require(_0xdbec('0xa'));var querystring=require('querystring');var Papa=require(_0xdbec('0x11'));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(_0xdbec('0x12'));var logger=require(_0xdbec('0x13'))('api');var utils=require(_0xdbec('0x14'));var config=require(_0xdbec('0x15'));var db=require(_0xdbec('0x16'))['db'];config[_0xdbec('0x17')]=_[_0xdbec('0x18')](config[_0xdbec('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xdbec('0x19'))(new Redis(config[_0xdbec('0x17')]));require('./faxAccount.socket')[_0xdbec('0x1a')](socket);var jayson=require(_0xdbec('0x1b'));var client=jayson['client'][_0xdbec('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0xdbec('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x4a2906,_0x45321f,_0x53420c){if(_0x53420c){var _0x55e40e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x55e40e[_0xdbec('0x1d')](_0x45321f)){return _0x4a2906;}else{throw new db[(_0xdbec('0x1e'))][(_0xdbec('0x1f'))](_0xdbec('0x20'));}}else{return _0x4a2906;}}function respondWithRpcPromise(_0x1dcdd9,_0x392600,_0x309219,_0x5d9ed5){return new BPromise(function(_0x39d49d,_0x439bd9){var _0x3b2ba6=_0x5d9ed5||client;return _0x3b2ba6[_0xdbec('0x21')](_0x1dcdd9,_0x309219)[_0xdbec('0x22')](function(_0xa729e5){logger[_0xdbec('0x23')]('FaxAccount,\x20%s,\x20%s',_0x392600,_0xdbec('0x24'));logger[_0xdbec('0x25')](_0xdbec('0x26'),_0x392600,'request\x20sent',JSON[_0xdbec('0x27')](_0xa729e5));if(_0xa729e5['error']){if(_0xa729e5[_0xdbec('0x28')][_0xdbec('0x29')]===0x1f4){logger[_0xdbec('0x28')](_0xdbec('0x2a'),_0x392600,_0xa729e5[_0xdbec('0x28')][_0xdbec('0x2b')]);return _0x439bd9(_0xa729e5[_0xdbec('0x28')][_0xdbec('0x2b')]);}logger[_0xdbec('0x28')](_0xdbec('0x2a'),_0x392600,_0xa729e5[_0xdbec('0x28')][_0xdbec('0x2b')]);return _0x39d49d(_0xa729e5[_0xdbec('0x28')][_0xdbec('0x2b')]);}else{logger[_0xdbec('0x23')](_0xdbec('0x2a'),_0x392600,_0xdbec('0x24'));_0x39d49d(_0xa729e5[_0xdbec('0x2c')][_0xdbec('0x2b')]);}})[_0xdbec('0x2d')](function(_0x24edd3){logger['error'](_0xdbec('0x2a'),_0x392600,_0x24edd3);_0x439bd9(_0x24edd3);});});}function respondWithStatusCode(_0x26a6b9,_0x2cbe8c){_0x2cbe8c=_0x2cbe8c||0xcc;return function(_0x3e22a0){if(_0x3e22a0){return _0x26a6b9[_0xdbec('0x2e')](_0x2cbe8c);}return _0x26a6b9[_0xdbec('0x2f')](_0x2cbe8c)['end']();};}function respondWithResult(_0x43aa89,_0x2225ae){_0x2225ae=_0x2225ae||0xc8;return function(_0x2696ef){if(_0x2696ef){return _0x43aa89['status'](_0x2225ae)[_0xdbec('0x30')](_0x2696ef);}};}function respondWithFilteredResult(_0x595dcb,_0x2ed99e){return function(_0x546d59){if(_0x546d59){var _0x13ec80=_0x546d59[_0xdbec('0x31')],_0x4f73be=_0x2ed99e['offset'],_0x445ce7=_0x2ed99e['offset']+_0x2ed99e[_0xdbec('0x32')],_0x25c192;if(_0x445ce7>=_0x13ec80){_0x445ce7=_0x13ec80;_0x25c192=0xc8;}else{_0x25c192=0xce;}_0x595dcb[_0xdbec('0x2f')](_0x25c192);return _0x595dcb['set'](_0xdbec('0x33'),_0x4f73be+'-'+_0x445ce7+'/'+_0x13ec80)[_0xdbec('0x30')](_0x546d59);}return null;};}function patchUpdates(_0x1bd720){return function(_0x1c125d){try{jsonpatch['apply'](_0x1c125d,_0x1bd720,!![]);}catch(_0x3b4e2a){return BPromise['reject'](_0x3b4e2a);}return _0x1c125d[_0xdbec('0x34')]();};}function saveUpdates(_0x26d8a7,_0x362e03){return function(_0x3ab063){if(_0x3ab063){return _0x3ab063[_0xdbec('0x35')](_0x26d8a7)[_0xdbec('0x22')](function(_0x4ed734){return _0x4ed734;});}return null;};}function removeEntity(_0x5a11ce,_0x7983e8){return function(_0x43cf04){if(_0x43cf04){return _0x43cf04['destroy']()[_0xdbec('0x22')](function(){var _0x100dcd=_0x43cf04['get']({'plain':!![]});var _0x10c920='FaxAccounts';return db[_0xdbec('0x36')][_0xdbec('0x37')]({'where':{'type':_0x10c920,'resourceId':_0x100dcd['id']}})[_0xdbec('0x22')](function(){return _0x43cf04;});})[_0xdbec('0x22')](function(){_0x5a11ce[_0xdbec('0x2f')](0xcc)[_0xdbec('0x38')]();});}};}function handleEntityNotFound(_0x4e0f96,_0x481e89){return function(_0x1d2f23){if(!_0x1d2f23){_0x4e0f96[_0xdbec('0x2e')](0x194);}return _0x1d2f23;};}function handleError(_0x4c63f1,_0x5dff75){_0x5dff75=_0x5dff75||0x1f4;return function(_0x5e0851){logger['error'](_0x5e0851[_0xdbec('0x39')]);if(_0x5e0851[_0xdbec('0x3a')]){delete _0x5e0851[_0xdbec('0x3a')];}_0x4c63f1['status'](_0x5dff75)[_0xdbec('0x3b')](_0x5e0851);};}exports['index']=function(_0xecf488,_0xfbcbf8){var _0x533b40={'include':[{'model':db['Pause'],'as':_0xdbec('0x3c')}]},_0x5a415f={},_0xcf17fa={'count':0x0,'rows':[]};var _0x73b6e5=_[_0xdbec('0x3d')](db[_0xdbec('0x3e')][_0xdbec('0x3f')],function(_0x2a7153){return{'name':_0x2a7153[_0xdbec('0x40')],'type':_0x2a7153[_0xdbec('0x41')][_0xdbec('0x42')]};});_0x5a415f[_0xdbec('0x43')]=_['map'](_0x73b6e5,'name');_0x5a415f[_0xdbec('0x44')]=_['keys'](_0xecf488['query']);_0x5a415f['filters']=_['intersection'](_0x5a415f['model'],_0x5a415f[_0xdbec('0x44')]);_0x533b40[_0xdbec('0x45')]=_['intersection'](_0x5a415f[_0xdbec('0x43')],qs['fields'](_0xecf488[_0xdbec('0x44')]['fields']));_0x533b40[_0xdbec('0x45')]=_0x533b40['attributes'][_0xdbec('0x46')]?_0x533b40['attributes']:_0x5a415f[_0xdbec('0x43')];if(!_0xecf488[_0xdbec('0x44')]['hasOwnProperty'](_0xdbec('0x47'))){_0x533b40[_0xdbec('0x32')]=qs[_0xdbec('0x32')](_0xecf488[_0xdbec('0x44')][_0xdbec('0x32')]);_0x533b40['offset']=qs[_0xdbec('0x48')](_0xecf488['query'][_0xdbec('0x48')]);}_0x533b40['order']=qs[_0xdbec('0x49')](_0xecf488[_0xdbec('0x44')]['sort']);_0x533b40['where']=qs[_0xdbec('0x4a')](_['pick'](_0xecf488[_0xdbec('0x44')],_0x5a415f[_0xdbec('0x4a')]));if(_0xecf488[_0xdbec('0x44')][_0xdbec('0x4b')]){_0x533b40['where']=_[_0xdbec('0x4c')](_0x533b40[_0xdbec('0x4d')],{'$or':_[_0xdbec('0x3d')](_0x73b6e5,function(_0x458e33){if(_0x458e33[_0xdbec('0x41')]!=='VIRTUAL'){var _0x1f65f6={};_0x1f65f6[_0x458e33[_0xdbec('0x3a')]]={'$like':'%'+_0xecf488[_0xdbec('0x44')][_0xdbec('0x4b')]+'%'};return _0x1f65f6;}})});}_0x533b40=_['merge']({},_0x533b40,_0xecf488[_0xdbec('0x4e')]);var _0x247db6={'where':_0x533b40[_0xdbec('0x4d')]};return db[_0xdbec('0x3e')][_0xdbec('0x31')](_0x247db6)['then'](function(_0x296175){_0xcf17fa[_0xdbec('0x31')]=_0x296175;if(_0xecf488[_0xdbec('0x44')]['includeAll']){_0x533b40[_0xdbec('0x4f')]=[{'all':!![]}];}return db['FaxAccount'][_0xdbec('0x50')](_0x533b40);})[_0xdbec('0x22')](function(_0x9139d6){_0xcf17fa[_0xdbec('0x51')]=_0x9139d6;return _0xcf17fa;})[_0xdbec('0x22')](respondWithFilteredResult(_0xfbcbf8,_0x533b40))[_0xdbec('0x2d')](handleError(_0xfbcbf8,null));};exports[_0xdbec('0x52')]=function(_0x1da059,_0x12b15d){var _0x550372={'raw':![],'where':{'id':_0x1da059[_0xdbec('0x53')]['id']},'include':[{'model':db[_0xdbec('0x54')],'as':_0xdbec('0x3c')}]},_0x519dbe={};_0x519dbe[_0xdbec('0x43')]=_['keys'](db[_0xdbec('0x3e')][_0xdbec('0x3f')]);_0x519dbe[_0xdbec('0x44')]=_[_0xdbec('0x55')](_0x1da059[_0xdbec('0x44')]);_0x519dbe[_0xdbec('0x4a')]=_[_0xdbec('0x56')](_0x519dbe[_0xdbec('0x43')],_0x519dbe[_0xdbec('0x44')]);_0x550372[_0xdbec('0x45')]=_[_0xdbec('0x56')](_0x519dbe['model'],qs[_0xdbec('0x57')](_0x1da059['query']['fields']));_0x550372['attributes']=_0x550372[_0xdbec('0x45')]['length']?_0x550372[_0xdbec('0x45')]:_0x519dbe[_0xdbec('0x43')];if(_0x1da059[_0xdbec('0x44')]['includeAll']){_0x550372[_0xdbec('0x4f')]=[{'all':!![]}];}_0x550372=_[_0xdbec('0x4c')]({},_0x550372,_0x1da059[_0xdbec('0x4e')]);return db[_0xdbec('0x3e')]['find'](_0x550372)[_0xdbec('0x22')](handleEntityNotFound(_0x12b15d,null))[_0xdbec('0x22')](respondWithResult(_0x12b15d,null))['catch'](handleError(_0x12b15d,null));};exports[_0xdbec('0x58')]=function(_0x8d95a3,_0xb24622){return db['FaxAccount'][_0xdbec('0x58')](_0x8d95a3[_0xdbec('0x59')],{})['then'](function(_0x4ee9b3){var _0x2fb331=_0x8d95a3[_0xdbec('0x5a')]['get']({'plain':!![]});if(!_0x2fb331)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2fb331[_0xdbec('0x5b')]===_0xdbec('0x5a')){var _0x380eb5=_0x4ee9b3[_0xdbec('0x5c')]({'plain':!![]});var _0x111a84=_0xdbec('0x5d');return db[_0xdbec('0x5e')][_0xdbec('0x5f')]({'where':{'name':_0x111a84,'userProfileId':_0x2fb331[_0xdbec('0x60')]},'raw':!![]})['then'](function(_0x12dff2){if(_0x12dff2&&_0x12dff2[_0xdbec('0x61')]===0x0){return db[_0xdbec('0x36')][_0xdbec('0x58')]({'name':_0x380eb5['name'],'resourceId':_0x380eb5['id'],'type':_0x12dff2[_0xdbec('0x3a')],'sectionId':_0x12dff2['id']},{})[_0xdbec('0x22')](function(){return _0x4ee9b3;});}else{return _0x4ee9b3;}})[_0xdbec('0x2d')](function(_0x22817d){logger[_0xdbec('0x28')](_0xdbec('0x62'),_0x22817d);throw _0x22817d;});}return _0x4ee9b3;})[_0xdbec('0x22')](respondWithResult(_0xb24622,0xc9))['catch'](handleError(_0xb24622,null));};exports['update']=function(_0x5b2211,_0x5bf783){if(_0x5b2211[_0xdbec('0x59')]['id']){delete _0x5b2211['body']['id'];}return db['FaxAccount'][_0xdbec('0x5f')]({'where':{'id':_0x5b2211[_0xdbec('0x53')]['id']},'include':[{'model':db[_0xdbec('0x54')],'as':'mandatoryDispositionPause'}]})[_0xdbec('0x22')](handleEntityNotFound(_0x5bf783,null))[_0xdbec('0x22')](saveUpdates(_0x5b2211[_0xdbec('0x59')],null))[_0xdbec('0x22')](respondWithResult(_0x5bf783,null))[_0xdbec('0x2d')](handleError(_0x5bf783,null));};exports[_0xdbec('0x37')]=function(_0x5a34cf,_0x2e72bd){return db[_0xdbec('0x3e')]['find']({'where':{'id':_0x5a34cf[_0xdbec('0x53')]['id']}})['then'](handleEntityNotFound(_0x2e72bd,null))[_0xdbec('0x22')](removeEntity(_0x2e72bd,null))[_0xdbec('0x2d')](handleError(_0x2e72bd,null));};exports[_0xdbec('0x63')]=function(_0x3970ac,_0x41693f){return db[_0xdbec('0x3e')][_0xdbec('0x63')]()[_0xdbec('0x22')](respondWithResult(_0x41693f,null))[_0xdbec('0x2d')](handleError(_0x41693f,null));};exports[_0xdbec('0x64')]=function(_0x5aa746,_0x2dacd4,_0x237be4){if(_0x5aa746[_0xdbec('0x59')]['id']){delete _0x5aa746[_0xdbec('0x59')]['id'];}return db[_0xdbec('0x3e')][_0xdbec('0x5f')]({'where':{'id':_0x5aa746[_0xdbec('0x53')]['id']}})['then'](handleEntityNotFound(_0x2dacd4,null))[_0xdbec('0x22')](function(_0xfd7eb7){if(_0xfd7eb7){_0x5aa746[_0xdbec('0x59')][_0xdbec('0x65')]=_0xfd7eb7['id'];return db[_0xdbec('0x66')][_0xdbec('0x58')](_0x5aa746[_0xdbec('0x59')]);}})[_0xdbec('0x22')](respondWithResult(_0x2dacd4,null))['catch'](handleError(_0x2dacd4,null));};exports[_0xdbec('0x67')]=function(_0x3779e0,_0x42face,_0x4bf326){var _0x10bc7b={'raw':![],'where':{}};var _0x5bbfd3={};var _0x517f48={'count':0x0,'rows':[]};return db['FaxAccount'][_0xdbec('0x68')]({'where':{'id':_0x3779e0[_0xdbec('0x53')]['id']}})[_0xdbec('0x22')](handleEntityNotFound(_0x42face,null))['then'](function(_0x3140f6){if(_0x3140f6){_0x5bbfd3[_0xdbec('0x43')]=_[_0xdbec('0x55')](db[_0xdbec('0x66')][_0xdbec('0x3f')]);_0x5bbfd3[_0xdbec('0x44')]=_[_0xdbec('0x55')](_0x3779e0[_0xdbec('0x44')]);_0x5bbfd3[_0xdbec('0x4a')]=_[_0xdbec('0x56')](_0x5bbfd3[_0xdbec('0x43')],_0x5bbfd3[_0xdbec('0x44')]);_0x10bc7b[_0xdbec('0x45')]=_['intersection'](_0x5bbfd3[_0xdbec('0x43')],qs[_0xdbec('0x57')](_0x3779e0[_0xdbec('0x44')]['fields']));_0x10bc7b[_0xdbec('0x45')]=_0x10bc7b[_0xdbec('0x45')][_0xdbec('0x46')]?_0x10bc7b[_0xdbec('0x45')]:_0x5bbfd3[_0xdbec('0x43')];if(!_0x3779e0[_0xdbec('0x44')][_0xdbec('0x69')](_0xdbec('0x47'))){_0x10bc7b['limit']=qs['limit'](_0x3779e0['query'][_0xdbec('0x32')]);_0x10bc7b[_0xdbec('0x48')]=qs['offset'](_0x3779e0['query'][_0xdbec('0x48')]);}_0x10bc7b[_0xdbec('0x6a')]=qs[_0xdbec('0x49')](_0x3779e0['query']['sort']);_0x10bc7b[_0xdbec('0x4d')]=qs[_0xdbec('0x4a')](_[_0xdbec('0x6b')](_0x3779e0[_0xdbec('0x44')],_0x5bbfd3['filters']));_0x10bc7b[_0xdbec('0x4d')][_0xdbec('0x65')]=_0x3140f6['id'];if(_0x3779e0[_0xdbec('0x44')][_0xdbec('0x4b')]){_0x10bc7b[_0xdbec('0x4d')]=_[_0xdbec('0x4c')](_0x10bc7b[_0xdbec('0x4d')],{'$or':_[_0xdbec('0x3d')](_0x10bc7b[_0xdbec('0x45')],function(_0x8a21bc){var _0x5f39ee={};_0x5f39ee[_0x8a21bc]={'$like':'%'+_0x3779e0['query'][_0xdbec('0x4b')]+'%'};return _0x5f39ee;})});}_0x10bc7b=_['merge']({},_0x10bc7b,_0x3779e0[_0xdbec('0x4e')]);return db[_0xdbec('0x66')]['count']({'where':_0x10bc7b[_0xdbec('0x4d')]})[_0xdbec('0x22')](function(_0x561195){_0x517f48['count']=_0x561195;if(_0x3779e0[_0xdbec('0x44')][_0xdbec('0x6c')]){_0x10bc7b[_0xdbec('0x4f')]=[{'all':!![]}];}return db[_0xdbec('0x66')][_0xdbec('0x50')](_0x10bc7b);})[_0xdbec('0x22')](function(_0x28ba5e){_0x517f48[_0xdbec('0x51')]=_0x28ba5e;return _0x517f48;});}})[_0xdbec('0x22')](respondWithFilteredResult(_0x42face,_0x10bc7b))[_0xdbec('0x2d')](handleError(_0x42face,null));};exports[_0xdbec('0x6d')]=function(_0x58bf87,_0x1c73e8,_0x332daa){return db['FaxAccount'][_0xdbec('0x5f')]({'where':{'id':_0x58bf87['params']['id']}})[_0xdbec('0x22')](handleEntityNotFound(_0x1c73e8,null))[_0xdbec('0x22')](function(_0x5c659e){if(_0x5c659e){return _0x5c659e[_0xdbec('0x6d')](_0x58bf87[_0xdbec('0x44')][_0xdbec('0x6e')]);}})[_0xdbec('0x22')](respondWithStatusCode(_0x1c73e8,null))['catch'](handleError(_0x1c73e8,null));};exports[_0xdbec('0x6f')]=function(_0x364ac8,_0x1aea71,_0x5e8551){if(_0x364ac8[_0xdbec('0x59')]['id']){delete _0x364ac8['body']['id'];}return db[_0xdbec('0x3e')][_0xdbec('0x5f')]({'where':{'id':_0x364ac8[_0xdbec('0x53')]['id']}})[_0xdbec('0x22')](handleEntityNotFound(_0x1aea71,null))[_0xdbec('0x22')](function(_0x26d09f){if(_0x26d09f){_0x364ac8['body'][_0xdbec('0x65')]=_0x26d09f['id'];return db[_0xdbec('0x70')][_0xdbec('0x58')](_0x364ac8[_0xdbec('0x59')]);}})[_0xdbec('0x22')](respondWithResult(_0x1aea71,null))[_0xdbec('0x2d')](handleError(_0x1aea71,null));};exports[_0xdbec('0x71')]=function(_0x9a2f7b,_0x3c4b97,_0x10bd24){var _0x5255d1={'raw':![],'where':{}};var _0x3fcdf0={};var _0xf1f41f={'count':0x0,'rows':[]};return db[_0xdbec('0x3e')][_0xdbec('0x68')]({'where':{'id':_0x9a2f7b['params']['id']}})['then'](handleEntityNotFound(_0x3c4b97,null))[_0xdbec('0x22')](function(_0x1ed92){if(_0x1ed92){_0x3fcdf0[_0xdbec('0x43')]=_[_0xdbec('0x55')](db['CannedAnswer']['rawAttributes']);_0x3fcdf0[_0xdbec('0x44')]=_['keys'](_0x9a2f7b[_0xdbec('0x44')]);_0x3fcdf0[_0xdbec('0x4a')]=_[_0xdbec('0x56')](_0x3fcdf0[_0xdbec('0x43')],_0x3fcdf0[_0xdbec('0x44')]);_0x5255d1[_0xdbec('0x45')]=_[_0xdbec('0x56')](_0x3fcdf0[_0xdbec('0x43')],qs['fields'](_0x9a2f7b[_0xdbec('0x44')]['fields']));_0x5255d1[_0xdbec('0x45')]=_0x5255d1[_0xdbec('0x45')][_0xdbec('0x46')]?_0x5255d1[_0xdbec('0x45')]:_0x3fcdf0[_0xdbec('0x43')];if(!_0x9a2f7b[_0xdbec('0x44')][_0xdbec('0x69')](_0xdbec('0x47'))){_0x5255d1[_0xdbec('0x32')]=qs[_0xdbec('0x32')](_0x9a2f7b[_0xdbec('0x44')]['limit']);_0x5255d1[_0xdbec('0x48')]=qs['offset'](_0x9a2f7b['query'][_0xdbec('0x48')]);}_0x5255d1[_0xdbec('0x6a')]=qs['sort'](_0x9a2f7b[_0xdbec('0x44')][_0xdbec('0x49')]);_0x5255d1[_0xdbec('0x4d')]=qs['filters'](_[_0xdbec('0x6b')](_0x9a2f7b['query'],_0x3fcdf0['filters']));_0x5255d1['where'][_0xdbec('0x65')]=_0x1ed92['id'];if(_0x9a2f7b['query']['filter']){_0x5255d1[_0xdbec('0x4d')]=_[_0xdbec('0x4c')](_0x5255d1[_0xdbec('0x4d')],{'$or':_[_0xdbec('0x3d')](_0x5255d1[_0xdbec('0x45')],function(_0x46bfcf){var _0x36f180={};_0x36f180[_0x46bfcf]={'$like':'%'+_0x9a2f7b['query'][_0xdbec('0x4b')]+'%'};return _0x36f180;})});}_0x5255d1=_[_0xdbec('0x4c')]({},_0x5255d1,_0x9a2f7b[_0xdbec('0x4e')]);return db[_0xdbec('0x70')][_0xdbec('0x31')]({'where':_0x5255d1[_0xdbec('0x4d')]})[_0xdbec('0x22')](function(_0x137a10){_0xf1f41f[_0xdbec('0x31')]=_0x137a10;if(_0x9a2f7b[_0xdbec('0x44')][_0xdbec('0x6c')]){_0x5255d1[_0xdbec('0x4f')]=[{'all':!![]}];}return db['CannedAnswer'][_0xdbec('0x50')](_0x5255d1);})[_0xdbec('0x22')](function(_0x3be7af){_0xf1f41f[_0xdbec('0x51')]=_0x3be7af;return _0xf1f41f;});}})['then'](respondWithFilteredResult(_0x3c4b97,_0x5255d1))[_0xdbec('0x2d')](handleError(_0x3c4b97,null));};exports[_0xdbec('0x72')]=function(_0xaefae3,_0x410816,_0x5e9be5){return db[_0xdbec('0x3e')][_0xdbec('0x5f')]({'where':{'id':_0xaefae3['params']['id']}})[_0xdbec('0x22')](handleEntityNotFound(_0x410816,null))['then'](function(_0x4c0ec2){if(_0x4c0ec2){return _0x4c0ec2[_0xdbec('0x72')](_0xaefae3[_0xdbec('0x44')][_0xdbec('0x6e')]);}})[_0xdbec('0x22')](respondWithStatusCode(_0x410816,null))[_0xdbec('0x2d')](handleError(_0x410816,null));};exports[_0xdbec('0x73')]=function(_0x3fd96b,_0x5d29aa,_0xc8f2b){return db['FaxInteraction'][_0xdbec('0x5f')]({'where':{'id':_0x3fd96b[_0xdbec('0x53')]['id']}})[_0xdbec('0x22')](handleEntityNotFound(_0x5d29aa,null))[_0xdbec('0x22')](function(_0xc23834){if(_0xc23834){return _0xc23834['addInteraction'](_0x3fd96b[_0xdbec('0x59')][_0xdbec('0x6e')],_[_0xdbec('0x74')](_0x3fd96b[_0xdbec('0x59')],[_0xdbec('0x6e'),'id'])||{});}})[_0xdbec('0x22')](respondWithResult(_0x5d29aa,null))[_0xdbec('0x2d')](handleError(_0x5d29aa,null));};exports[_0xdbec('0x75')]=function(_0x530a8e,_0x410c1f,_0x3f2952){var _0x49b925={'raw':![],'where':{}};var _0x49dc51={};var _0x5df5ed={'count':0x0,'rows':[]};return db[_0xdbec('0x3e')][_0xdbec('0x68')]({'where':{'id':_0x530a8e[_0xdbec('0x53')]['id']}})[_0xdbec('0x22')](handleEntityNotFound(_0x410c1f,null))[_0xdbec('0x22')](function(_0xbdcebb){if(_0xbdcebb){_0x49dc51[_0xdbec('0x43')]=_[_0xdbec('0x55')](db[_0xdbec('0x76')][_0xdbec('0x3f')]);_0x49dc51[_0xdbec('0x44')]=_[_0xdbec('0x55')](_0x530a8e[_0xdbec('0x44')]);_0x49dc51[_0xdbec('0x4a')]=_[_0xdbec('0x56')](_0x49dc51[_0xdbec('0x43')],_0x49dc51[_0xdbec('0x44')]);_0x49b925[_0xdbec('0x45')]=_[_0xdbec('0x56')](_0x49dc51['model'],qs['fields'](_0x530a8e['query']['fields']));_0x49b925[_0xdbec('0x45')]=_0x49b925[_0xdbec('0x45')][_0xdbec('0x46')]?_0x49b925['attributes']:_0x49dc51[_0xdbec('0x43')];if(!_0x530a8e[_0xdbec('0x44')][_0xdbec('0x69')](_0xdbec('0x47'))){_0x49b925[_0xdbec('0x32')]=qs[_0xdbec('0x32')](_0x530a8e[_0xdbec('0x44')][_0xdbec('0x32')]);_0x49b925[_0xdbec('0x48')]=qs[_0xdbec('0x48')](_0x530a8e['query'][_0xdbec('0x48')]);}_0x49b925[_0xdbec('0x6a')]=qs['sort'](_0x530a8e[_0xdbec('0x44')][_0xdbec('0x49')]);_0x49b925[_0xdbec('0x4d')]=qs['filters'](_[_0xdbec('0x6b')](_0x530a8e[_0xdbec('0x44')],_0x49dc51[_0xdbec('0x4a')]));_0x49b925[_0xdbec('0x4d')][_0xdbec('0x65')]=_0xbdcebb['id'];if(_0x530a8e[_0xdbec('0x44')][_0xdbec('0x4b')]){_0x49b925[_0xdbec('0x4d')]=_['merge'](_0x49b925[_0xdbec('0x4d')],{'$or':_[_0xdbec('0x3d')](_0x49b925[_0xdbec('0x45')],function(_0xc8b457){var _0x564975={};_0x564975[_0xc8b457]={'$like':'%'+_0x530a8e[_0xdbec('0x44')][_0xdbec('0x4b')]+'%'};return _0x564975;})});}_0x49b925=_['merge']({},_0x49b925,_0x530a8e[_0xdbec('0x4e')]);return db[_0xdbec('0x76')][_0xdbec('0x31')]({'where':_0x49b925[_0xdbec('0x4d')]})[_0xdbec('0x22')](function(_0x1eb7bc){_0x5df5ed[_0xdbec('0x31')]=_0x1eb7bc;if(_0x530a8e[_0xdbec('0x44')][_0xdbec('0x6c')]){_0x49b925['include']=[{'model':db[_0xdbec('0x77')],'as':_0xdbec('0x78'),'required':![]},{'model':db[_0xdbec('0x79')],'as':_0xdbec('0x7a'),'attributes':[_0xdbec('0x3a'),_0xdbec('0x7b'),'internal'],'required':![]},{'model':db[_0xdbec('0x7c')],'as':_0xdbec('0x7d'),'attributes':['id',_0xdbec('0x3a'),_0xdbec('0x7e')],'where':_0x530a8e[_0xdbec('0x44')][_0xdbec('0x7f')]?{'id':_0x530a8e[_0xdbec('0x44')][_0xdbec('0x7f')]}:undefined,'required':_0x530a8e[_0xdbec('0x44')]['tag']?!![]:![]}];}return db[_0xdbec('0x76')]['findAll'](_0x49b925);})['then'](function(_0x13fde4){_0x5df5ed[_0xdbec('0x51')]=_0x13fde4;return _0x5df5ed;});}})[_0xdbec('0x22')](respondWithFilteredResult(_0x410c1f,_0x49b925))[_0xdbec('0x2d')](handleError(_0x410c1f,null));};exports[_0xdbec('0x80')]=function(_0x3d1b13,_0x2d6a26,_0x5c9997){return db[_0xdbec('0x3e')][_0xdbec('0x68')]({'where':{'id':_0x3d1b13['params']['id']}})[_0xdbec('0x22')](handleEntityNotFound(_0x2d6a26,null))['then'](function(_0x18d0c6){if(_0x18d0c6){return db['sequelize']['transaction'](function(_0x11478d){return db[_0xdbec('0x81')][_0xdbec('0x37')]({'where':{'FaxAccountId':_0x3d1b13['params']['id']},'transaction':_0x11478d})['then'](function(_0x597607){var _0x19db52=_[_0xdbec('0x3d')](_0x3d1b13['body'],function(_0x30312f){_0x30312f[_0xdbec('0x65')]=_0x3d1b13[_0xdbec('0x53')]['id'];return _0x30312f;});return db['FaxApplication'][_0xdbec('0x82')](_0x19db52,{'transaction':_0x11478d});});})[_0xdbec('0x22')](function(){return db[_0xdbec('0x81')][_0xdbec('0x83')]({'where':{'FaxAccountId':_0x3d1b13[_0xdbec('0x53')]['id']},'order':_0xdbec('0x84')});});}})['then'](respondWithResult(_0x2d6a26,null))[_0xdbec('0x2d')](handleError(_0x2d6a26,null));};exports['getApplications']=function(_0x2d8e4f,_0x37aa4d,_0x2957d9){var _0x1b63c2={};var _0xbc5e02={};var _0xcaacc8;var _0x191ca6;return db[_0xdbec('0x3e')]['findOne']({'where':{'id':_0x2d8e4f['params']['id']}})[_0xdbec('0x22')](handleEntityNotFound(_0x37aa4d,null))[_0xdbec('0x22')](function(_0x284853){if(_0x284853){_0xcaacc8=_0x284853;_0xbc5e02[_0xdbec('0x43')]=_['keys'](db[_0xdbec('0x81')][_0xdbec('0x3f')]);_0xbc5e02[_0xdbec('0x44')]=_[_0xdbec('0x55')](_0x2d8e4f[_0xdbec('0x44')]);_0xbc5e02[_0xdbec('0x4a')]=_[_0xdbec('0x56')](_0xbc5e02[_0xdbec('0x43')],_0xbc5e02[_0xdbec('0x44')]);_0x1b63c2[_0xdbec('0x45')]=_[_0xdbec('0x56')](_0xbc5e02['model'],qs[_0xdbec('0x57')](_0x2d8e4f[_0xdbec('0x44')][_0xdbec('0x57')]));_0x1b63c2['attributes']=_0x1b63c2[_0xdbec('0x45')][_0xdbec('0x46')]?_0x1b63c2[_0xdbec('0x45')]:_0xbc5e02['model'];_0x1b63c2[_0xdbec('0x6a')]=qs[_0xdbec('0x49')](_0x2d8e4f['query'][_0xdbec('0x49')]);_0x1b63c2[_0xdbec('0x4d')]=qs['filters'](_['pick'](_0x2d8e4f[_0xdbec('0x44')],_0xbc5e02[_0xdbec('0x4a')]));if(_0x2d8e4f[_0xdbec('0x44')][_0xdbec('0x4b')]){_0x1b63c2[_0xdbec('0x4d')]=_[_0xdbec('0x4c')](_0x1b63c2[_0xdbec('0x4d')],{'$or':_['map'](_0x1b63c2[_0xdbec('0x45')],function(_0x57e452){var _0x4ec734={};_0x4ec734[_0x57e452]={'$like':'%'+_0x2d8e4f[_0xdbec('0x44')]['filter']+'%'};return _0x4ec734;})});}_0x1b63c2=_[_0xdbec('0x4c')]({},_0x1b63c2,_0x2d8e4f[_0xdbec('0x4e')]);return _0xcaacc8[_0xdbec('0x85')](_0x1b63c2);}})[_0xdbec('0x22')](function(_0xf9131a){if(_0xf9131a){_0x191ca6=_0xf9131a['length'];if(!_0x2d8e4f[_0xdbec('0x44')][_0xdbec('0x69')](_0xdbec('0x47'))){_0x1b63c2[_0xdbec('0x32')]=qs[_0xdbec('0x32')](_0x2d8e4f[_0xdbec('0x44')][_0xdbec('0x32')]);_0x1b63c2[_0xdbec('0x48')]=qs[_0xdbec('0x48')](_0x2d8e4f[_0xdbec('0x44')][_0xdbec('0x48')]);}return _0xcaacc8[_0xdbec('0x85')](_0x1b63c2);}})[_0xdbec('0x22')](function(_0x57f93e){if(_0x57f93e){return _0x57f93e?{'count':_0x191ca6,'rows':_0x57f93e}:null;}})[_0xdbec('0x22')](respondWithResult(_0x37aa4d,null))[_0xdbec('0x2d')](handleError(_0x37aa4d,null));};function Extension(_0x561145,_0x203249,_0x1067d5,_0x12db72){this['context']=_0xdbec('0x86');this['exten']=_0x561145['localstationid'];this['app']=_0x12db72;this[_0xdbec('0x41')]=_0xdbec('0x87');this[_0xdbec('0x88')]=_0xdbec('0x89');this[_0xdbec('0x65')]=_0x561145['id'];this[_0xdbec('0x84')]=_0x203249;this[_0xdbec('0x8a')]=_0x1067d5;}function createExtensionsReciveFax(_0x40abbb){var _0x15720a=0x1;var _0x2a193a=[];_0x2a193a[_0xdbec('0x8b')](new Extension(_0x40abbb,_0x15720a,'','Answer'));_0x15720a+=0x1;_0x2a193a[_0xdbec('0x8b')](new Extension(_0x40abbb,_0x15720a,'CDR(type)=inbound-fax','Set'));_0x15720a+=0x1;for(var _0x56bbd4 in _0x40abbb){if(_0x40abbb[_0xdbec('0x69')](_0x56bbd4)&&(_0x56bbd4===_0xdbec('0x8c')||_0x56bbd4===_0xdbec('0x8d')||_0x56bbd4===_0xdbec('0x8e')||_0x56bbd4==='faxdetect'||_0x56bbd4===_0xdbec('0x8f')||_0x56bbd4===_0xdbec('0x90')||_0x56bbd4===_0xdbec('0x91')||_0x56bbd4===_0xdbec('0x92')||_0x56bbd4==='t38timeout')){_0x2a193a['push'](new Extension(_0x40abbb,_0x15720a,_0xdbec('0x93')+_0x56bbd4+')='+_0x40abbb[_0x56bbd4],'Set'));_0x15720a+=0x1;}}_0x2a193a['push'](new Extension(_0x40abbb,_0x15720a,'6','Wait'));_0x15720a+=0x1;_0x2a193a[_0xdbec('0x8b')](new Extension(_0x40abbb,_0x15720a,'/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',_0xdbec('0x94')));_0x15720a=0x0;return _0x2a193a;}exports[_0xdbec('0x95')]=function(_0x40f0e9,_0x2cbfff,_0x25ef5c){var _0x5e459d;return db[_0xdbec('0x96')][_0xdbec('0x97')](function(_0x4ca5f6){return db[_0xdbec('0x3e')]['create'](_0x40f0e9['body'],{'transaction':_0x4ca5f6})[_0xdbec('0x22')](function(_0x58fea2){_0x5e459d=_0x58fea2[_0xdbec('0x5c')]({'plain':!![]});return db[_0xdbec('0x98')][_0xdbec('0x82')](createExtensionsReciveFax(_0x5e459d),{'transaction':_0x4ca5f6});});})[_0xdbec('0x22')](function(){return _0x5e459d;})['then'](respondWithResult(_0x2cbfff,null))[_0xdbec('0x2d')](handleError(_0x2cbfff,null));};exports[_0xdbec('0x99')]=function(_0x19176c,_0x596b8f,_0x203ddf){var _0x58f169;return db[_0xdbec('0x96')][_0xdbec('0x97')](function(_0x4ae0e5){return db[_0xdbec('0x3e')][_0xdbec('0x35')](_0x19176c['body'],{'where':{'id':_0x19176c[_0xdbec('0x59')]['id']},'transaction':_0x4ae0e5})[_0xdbec('0x22')](function(_0x36e9af){return db[_0xdbec('0x98')]['destroy']({'where':{'FaxAccountId':_0x19176c[_0xdbec('0x59')]['id']},'transaction':_0x4ae0e5})['then'](function(_0x599fd2){return db[_0xdbec('0x98')][_0xdbec('0x82')](createExtensionsReciveFax(_[_0xdbec('0x74')](_0x19176c['body'],[_0xdbec('0x9a'),_0xdbec('0x42'),_0xdbec('0x9b'),_0xdbec('0x9c'),_0xdbec('0x9d'),_0xdbec('0x9e')])),{'transaction':_0x4ae0e5});});});})[_0xdbec('0x22')](function(){return db[_0xdbec('0x3e')]['findById'](_0x19176c[_0xdbec('0x59')]['id']);})[_0xdbec('0x22')](respondWithResult(_0x596b8f,null))['catch'](handleError(_0x596b8f,null));};exports[_0xdbec('0x9f')]=function(_0x20f0a8,_0x2006e0,_0x4b46cd){var _0xdb95d={'raw':!![],'where':{}};var _0x3ce566={};var _0x1e8360={'count':0x0,'rows':[]};return db['FaxAccount'][_0xdbec('0x68')]({'where':{'id':_0x20f0a8[_0xdbec('0x53')]['id']}})[_0xdbec('0x22')](handleEntityNotFound(_0x2006e0,null))[_0xdbec('0x22')](function(_0x4a0ee8){if(_0x4a0ee8){_0x3ce566[_0xdbec('0x43')]=_[_0xdbec('0x55')](db[_0xdbec('0xa0')][_0xdbec('0x3f')]);_0x3ce566[_0xdbec('0x44')]=_['keys'](_0x20f0a8[_0xdbec('0x44')]);_0x3ce566[_0xdbec('0x4a')]=_[_0xdbec('0x56')](_0x3ce566[_0xdbec('0x43')],_0x3ce566[_0xdbec('0x44')]);_0xdb95d['attributes']=_[_0xdbec('0x56')](_0x3ce566['model'],qs[_0xdbec('0x57')](_0x20f0a8[_0xdbec('0x44')][_0xdbec('0x57')]));_0xdb95d[_0xdbec('0x45')]=_0xdb95d['attributes'][_0xdbec('0x46')]?_0xdb95d['attributes']:_0x3ce566[_0xdbec('0x43')];if(!_0x20f0a8['query']['hasOwnProperty']('nolimit')){_0xdb95d['limit']=qs[_0xdbec('0x32')](_0x20f0a8[_0xdbec('0x44')][_0xdbec('0x32')]);_0xdb95d[_0xdbec('0x48')]=qs['offset'](_0x20f0a8[_0xdbec('0x44')][_0xdbec('0x48')]);}_0xdb95d[_0xdbec('0x6a')]=qs[_0xdbec('0x49')](_0x20f0a8['query']['sort']);_0xdb95d[_0xdbec('0x4d')]=qs[_0xdbec('0x4a')](_[_0xdbec('0x6b')](_0x20f0a8[_0xdbec('0x44')],_0x3ce566[_0xdbec('0x4a')]));_0xdb95d['where'][_0xdbec('0x65')]=_0x4a0ee8['id'];if(_0x20f0a8['query']['filter']){_0xdb95d['where']=_['merge'](_0xdb95d[_0xdbec('0x4d')],{'$or':_[_0xdbec('0x3d')](_0xdb95d['attributes'],function(_0x4c83a){var _0x2104f1={};_0x2104f1[_0x4c83a]={'$like':'%'+_0x20f0a8[_0xdbec('0x44')][_0xdbec('0x4b')]+'%'};return _0x2104f1;})});}if(_0x20f0a8['query'][_0xdbec('0xa1')]){var _0x21f251=_0x20f0a8[_0xdbec('0x44')]['$gte'][_0xdbec('0xa2')](',');var _0x1c921e={};_0x1c921e[_0x21f251[0x0]]={'$gte':moment(_0x21f251[0x1])[_0xdbec('0xa3')](_0xdbec('0xa4'))};_0xdb95d[_0xdbec('0x4d')]=_[_0xdbec('0x4c')](_0xdb95d[_0xdbec('0x4d')],_0x1c921e);}_0xdb95d=_[_0xdbec('0x4c')]({},_0xdb95d,_0x20f0a8['options']);return db[_0xdbec('0xa0')]['count']({'where':_0xdb95d[_0xdbec('0x4d')]})[_0xdbec('0x22')](function(_0x1068c6){_0x1e8360[_0xdbec('0x31')]=_0x1068c6;if(_0x20f0a8[_0xdbec('0x44')][_0xdbec('0x6c')]){_0xdb95d[_0xdbec('0x4f')]=[{'all':!![]}];}return db[_0xdbec('0xa0')][_0xdbec('0x50')](_0xdb95d);})['then'](function(_0x5903c9){_0x1e8360[_0xdbec('0x51')]=_0x5903c9;return _0x1e8360;});}})['then'](respondWithFilteredResult(_0x2006e0,_0xdb95d))['catch'](handleError(_0x2006e0,null));};exports[_0xdbec('0x3b')]=function(_0x2a8c61,_0x279034,_0x9709f1){var _0x1d6887,_0x111c03={},_0x465d73;if(_0x2a8c61['body']['to']){_0x465d73=_0x2a8c61[_0xdbec('0x59')]['to'][0x0];}return db[_0xdbec('0x3e')]['find']({'where':{'id':_0x2a8c61[_0xdbec('0x53')]['id']},'include':[{'model':db[_0xdbec('0xa5')],'as':'List','include':[{'model':db[_0xdbec('0x77')],'as':'Contacts','where':{'fax':_0x465d73},'limit':0x1,'order':[[_0xdbec('0x9c'),_0xdbec('0xa6')]]}]}]})['then'](handleEntityNotFound(_0x279034,null))[_0xdbec('0x22')](function(_0x3b84bc){_0x1d6887=_0x3b84bc;if(_0x2a8c61[_0xdbec('0x59')][_0xdbec('0xa7')]&&_0x2a8c61[_0xdbec('0x59')][_0xdbec('0xa7')][_0xdbec('0x46')]){for(var _0x97b5e0=0x0;_0x97b5e0<_0x2a8c61[_0xdbec('0x59')][_0xdbec('0xa7')][_0xdbec('0x46')];_0x97b5e0+=0x1){_0x2a8c61[_0xdbec('0x59')][_0xdbec('0xa7')][_0x97b5e0]={'filename':_0x2a8c61[_0xdbec('0x59')][_0xdbec('0xa7')][_0x97b5e0]['name'],'id':_0x2a8c61[_0xdbec('0x59')][_0xdbec('0xa7')][_0x97b5e0]['id'],'path':path['join'](config[_0xdbec('0xa8')],'server/files/attachments',_0x2a8c61['body'][_0xdbec('0xa7')][_0x97b5e0][_0xdbec('0xa9')])};}}return respondWithRpcPromise(_0xdbec('0xaa'),_0xdbec('0xaa'),{'FaxAccountId':_[_0xdbec('0xab')](_0x2a8c61[_0xdbec('0x53')]['id'])?undefined:_0x2a8c61[_0xdbec('0x53')]['id'],'path':_['isNil'](_0x2a8c61[_0xdbec('0x59')][_0xdbec('0xa7')][0x0][_0xdbec('0x8')])?undefined:_0x2a8c61[_0xdbec('0x59')][_0xdbec('0xa7')][0x0][_0xdbec('0x8')],'fax':_[_0xdbec('0xab')](_0x2a8c61['body']['to'][0x0])?undefined:_0x2a8c61[_0xdbec('0x59')]['to'][0x0]},client9002);})[_0xdbec('0x22')](function(){if(_0x1d6887){if(_[_0xdbec('0xab')](_0x2a8c61[_0xdbec('0x59')][_0xdbec('0xac')])){_0x2a8c61[_0xdbec('0x59')][_0xdbec('0xac')]=util[_0xdbec('0xa3')](_0xdbec('0xad'),_0x1d6887[_0xdbec('0x3a')],_0x1d6887[_0xdbec('0xae')]);}if(_0x1d6887[_0xdbec('0xaf')]){if(_0x1d6887[_0xdbec('0xaf')]['Contacts']['length']){return _0x1d6887[_0xdbec('0xaf')][_0xdbec('0xb0')][0x0];}else{return db['CmContact'][_0xdbec('0x58')](_[_0xdbec('0x18')](_0x2a8c61[_0xdbec('0x59')],{'firstName':_0x2a8c61[_0xdbec('0x59')]['to'][0x0],'phone':_0x2a8c61['body']['to'][0x0],'fax':_0x2a8c61[_0xdbec('0x59')]['to'][0x0],'ListId':_0x1d6887['ListId']}));}}else{throw new Error(_0xdbec('0xb1'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0xdbec('0x22')](function(_0x2bd380){if(_0x2bd380){return db['FaxInteraction']['find']({'where':{'ContactId':_0x2bd380['id'],'closed':![],'FaxAccountId':_0x1d6887['id']}})[_0xdbec('0x22')](function(_0x33357e){if(_0x33357e){return[_0x33357e,![]];}return db['FaxInteraction'][_0xdbec('0x58')]({'UserId':_0x2a8c61['user']['id'],'ContactId':_0x2bd380['id'],'FaxAccountId':_0x1d6887['id'],'fax':_0x2a8c61[_0xdbec('0x59')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xdbec('0x4c')](_0x2a8c61[_0xdbec('0x59')],{'read':![],'body':_0x2a8c61[_0xdbec('0x59')][_0xdbec('0xa7')][0x0][_0xdbec('0xb2')],'FaxAccountId':_0x1d6887['id'],'UserId':_0x2a8c61[_0xdbec('0x5a')]['id'],'ContactId':_0x2bd380['id'],'AttachmentId':_0x2a8c61[_0xdbec('0x59')][_0xdbec('0xa7')][0x0]['id']})]},{'include':[{'model':db[_0xdbec('0xa0')],'as':_0xdbec('0xb3')}]})[_0xdbec('0x22')](function(_0x9f20fb){return[_0x9f20fb,!![]];});});}else{throw new Error(_0xdbec('0xb4'));}})['spread'](function(_0x56edb3,_0x1df014){if(_0x1df014){return _0x56edb3;}return db['FaxMessage'][_0xdbec('0x58')]({'direction':_0xdbec('0xb5'),'read':![],'body':_0x2a8c61[_0xdbec('0x59')][_0xdbec('0xa7')][0x0][_0xdbec('0xb2')],'FaxAccountId':_0x1d6887['id'],'FaxInteractionId':_0x56edb3['id'],'UserId':_0x2a8c61[_0xdbec('0x5a')]['id'],'ContactId':_0x56edb3[_0xdbec('0xb6')],'AttachmentId':_0x2a8c61[_0xdbec('0x59')][_0xdbec('0xa7')][0x0]['id']})['then'](function(_0x473ec9){_0x56edb3['dataValues']['Messages']=[];_0x56edb3[_0xdbec('0xb7')][_0xdbec('0xb3')][_0xdbec('0x8b')](_0x473ec9['dataValues']);return _0x56edb3;});})[_0xdbec('0x22')](function(_0x4dd45){respondWithRpcPromise(_0xdbec('0xb8'),_0xdbec('0xb8'),{'FaxAccountId':_[_0xdbec('0xab')](_0x2a8c61[_0xdbec('0x53')]['id'])?undefined:_0x2a8c61[_0xdbec('0x53')]['id'],'path':_[_0xdbec('0xab')](_0x2a8c61[_0xdbec('0x59')][_0xdbec('0xa7')][0x0]['path'])?undefined:_0x2a8c61[_0xdbec('0x59')][_0xdbec('0xa7')][0x0][_0xdbec('0x8')],'fax':_[_0xdbec('0xab')](_0x2a8c61['body']['to'][0x0])?undefined:_0x2a8c61[_0xdbec('0x59')]['to'][0x0],'AttachmentId':_0x2a8c61['body'][_0xdbec('0xa7')][0x0]['id']},client9002)[_0xdbec('0x22')](function(_0x4f71aa){logger[_0xdbec('0x23')]('SendFaxRpc,\x20%s',_0x4f71aa);})['catch'](function(_0x28c282){logger[_0xdbec('0x23')](_0xdbec('0xb9'),_0x28c282);});return _0x4dd45;})[_0xdbec('0x22')](respondWithResult(_0x279034,null))['catch'](handleError(_0x279034,null));};exports['addAgents']=function(_0x5a1c3d,_0x533aa1,_0x457642){return db[_0xdbec('0x3e')][_0xdbec('0x5f')]({'where':{'id':_0x5a1c3d[_0xdbec('0x53')]['id']}})[_0xdbec('0x22')](handleEntityNotFound(_0x533aa1,null))[_0xdbec('0x22')](function(_0x2c2335){if(_0x2c2335){return _0x2c2335[_0xdbec('0xba')](_0x5a1c3d[_0xdbec('0x59')]['ids'],_[_0xdbec('0x74')](_0x5a1c3d[_0xdbec('0x59')],[_0xdbec('0x6e'),'id'])||{})[_0xdbec('0xbb')](function(_0xb09979){for(var _0x446194=0x0;_0x446194<_0x5a1c3d[_0xdbec('0x59')]['ids'][_0xdbec('0x46')];_0x446194+=0x1){socket[_0xdbec('0xbc')]('userFaxAccount:save',{'UserId':_0x5a1c3d[_0xdbec('0x59')][_0xdbec('0x6e')][_0x446194],'FaxAccountId':_0x5a1c3d[_0xdbec('0x53')]['id']});}return _0xb09979;});}})[_0xdbec('0x22')](respondWithResult(_0x533aa1,null))['catch'](handleError(_0x533aa1,null));};exports[_0xdbec('0xbd')]=function(_0x546c6c,_0x2dd1b4,_0x1e9fa3){return db[_0xdbec('0x3e')]['find']({'where':{'id':_0x546c6c[_0xdbec('0x53')]['id']}})['then'](handleEntityNotFound(_0x2dd1b4,null))[_0xdbec('0x22')](function(_0x372c45){if(_0x372c45){return _0x372c45[_0xdbec('0xbd')](_0x546c6c[_0xdbec('0x44')][_0xdbec('0x6e')])[_0xdbec('0x22')](function(){if(_[_0xdbec('0xbe')](_0x546c6c['query'][_0xdbec('0x6e')])){for(var _0x291621=0x0;_0x291621<_0x546c6c[_0xdbec('0x44')][_0xdbec('0x6e')]['length'];_0x291621+=0x1){socket[_0xdbec('0xbc')](_0xdbec('0xbf'),{'UserId':Number(_0x546c6c['query'][_0xdbec('0x6e')][_0x291621]),'FaxAccountId':Number(_0x546c6c[_0xdbec('0x53')]['id'])});}}else{socket[_0xdbec('0xbc')]('userFaxAccount:remove',{'UserId':Number(_0x546c6c['query']['ids']),'FaxAccountId':Number(_0x546c6c[_0xdbec('0x53')]['id'])});}});}})['then'](respondWithStatusCode(_0x2dd1b4,null))[_0xdbec('0x2d')](handleError(_0x2dd1b4,null));};exports[_0xdbec('0xc0')]=function(_0x5ebe36,_0x33cc3c,_0x1beb41){var _0x590114={};var _0x44d550={};var _0x52ad81;var _0x25dc21;return db['FaxAccount']['findOne']({'where':{'id':_0x5ebe36['params']['id']}})[_0xdbec('0x22')](handleEntityNotFound(_0x33cc3c,null))[_0xdbec('0x22')](function(_0x14e3d5){if(_0x14e3d5){_0x52ad81=_0x14e3d5;_0x44d550[_0xdbec('0x43')]=_[_0xdbec('0x55')](db[_0xdbec('0x79')]['rawAttributes']);_0x44d550[_0xdbec('0x44')]=_[_0xdbec('0x55')](_0x5ebe36[_0xdbec('0x44')]);_0x44d550['filters']=_[_0xdbec('0x56')](_0x44d550[_0xdbec('0x43')],_0x44d550[_0xdbec('0x44')]);_0x590114[_0xdbec('0x45')]=_[_0xdbec('0x56')](_0x44d550[_0xdbec('0x43')],qs[_0xdbec('0x57')](_0x5ebe36[_0xdbec('0x44')]['fields']));_0x590114[_0xdbec('0x45')]=_0x590114[_0xdbec('0x45')][_0xdbec('0x46')]?_0x590114[_0xdbec('0x45')]:_0x44d550['model'];_0x590114[_0xdbec('0x6a')]=qs[_0xdbec('0x49')](_0x5ebe36['query'][_0xdbec('0x49')]);_0x590114[_0xdbec('0x4d')]=qs[_0xdbec('0x4a')](_[_0xdbec('0x6b')](_0x5ebe36[_0xdbec('0x44')],_0x44d550['filters']));if(_0x5ebe36[_0xdbec('0x44')]['filter']){_0x590114[_0xdbec('0x4d')]=_[_0xdbec('0x4c')](_0x590114['where'],{'$or':_[_0xdbec('0x3d')](_0x590114[_0xdbec('0x45')],function(_0xc26158){var _0x1daf94={};_0x1daf94[_0xc26158]={'$like':'%'+_0x5ebe36['query']['filter']+'%'};return _0x1daf94;})});}_0x590114=_[_0xdbec('0x4c')]({},_0x590114,_0x5ebe36[_0xdbec('0x4e')]);return _0x52ad81[_0xdbec('0xc0')](_0x590114);}})[_0xdbec('0x22')](function(_0x485b8a){if(_0x485b8a){_0x25dc21=_0x485b8a[_0xdbec('0x46')];if(!_0x5ebe36[_0xdbec('0x44')][_0xdbec('0x69')](_0xdbec('0x47'))){_0x590114['limit']=qs[_0xdbec('0x32')](_0x5ebe36['query'][_0xdbec('0x32')]);_0x590114[_0xdbec('0x48')]=qs[_0xdbec('0x48')](_0x5ebe36[_0xdbec('0x44')][_0xdbec('0x48')]);}return _0x52ad81[_0xdbec('0xc0')](_0x590114);}})['then'](function(_0x215ec5){if(_0x215ec5){return _0x215ec5?{'count':_0x25dc21,'rows':_0x215ec5}:null;}})['then'](respondWithResult(_0x33cc3c,null))['catch'](handleError(_0x33cc3c,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index a26f550..64f3fcb 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 _0x4d32=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x2dc794,_0x4d2724){var _0x55a6a1=function(_0x3f99ff){while(--_0x3f99ff){_0x2dc794['push'](_0x2dc794['shift']());}};_0x55a6a1(++_0x4d2724);}(_0x4d32,0xe4));var _0x24d3=function(_0x3ad451,_0x204dc2){_0x3ad451=_0x3ad451-0x0;var _0x178759=_0x4d32[_0x3ad451];return _0x178759;};'use strict';var EventEmitter=require(_0x24d3('0x0'));var FaxAccount=require(_0x24d3('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x24d3('0x2')](0x0);var events={'afterCreate':_0x24d3('0x3'),'afterUpdate':_0x24d3('0x4'),'afterDestroy':_0x24d3('0x5')};function emitEvent(_0xf44f07){return function(_0x5df3a0,_0x120c79,_0x24b1f7){FaxAccountEvents[_0x24d3('0x6')](_0xf44f07+':'+_0x5df3a0['id'],_0x5df3a0);FaxAccountEvents[_0x24d3('0x6')](_0xf44f07,_0x5df3a0);_0x24b1f7(null);};}for(var e in events){if(events[_0x24d3('0x7')](e)){var event=events[e];FaxAccount[_0x24d3('0x8')](e,emitEvent(event));}}module[_0x24d3('0x9')]=FaxAccountEvents; \ No newline at end of file +var _0x6297=['hook','exports','events','../../mysqldb','FaxAccount','save','emit'];(function(_0x590c57,_0x573691){var _0x5e6b89=function(_0x25189a){while(--_0x25189a){_0x590c57['push'](_0x590c57['shift']());}};_0x5e6b89(++_0x573691);}(_0x6297,0x10c));var _0x7629=function(_0x56dc2b,_0x202854){_0x56dc2b=_0x56dc2b-0x0;var _0x2eb8f5=_0x6297[_0x56dc2b];return _0x2eb8f5;};'use strict';var EventEmitter=require(_0x7629('0x0'));var FaxAccount=require(_0x7629('0x1'))['db'][_0x7629('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7629('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x542d7e){return function(_0x47dea2,_0x4f6346,_0xcb6b9f){FaxAccountEvents[_0x7629('0x4')](_0x542d7e+':'+_0x47dea2['id'],_0x47dea2);FaxAccountEvents[_0x7629('0x4')](_0x542d7e,_0x47dea2);_0xcb6b9f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x7629('0x5')](e,emitEvent(event));}}module[_0x7629('0x6')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 3562870..88951d0 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 _0x117f=['./faxAccount.attributes','define','FaxAccount','fax_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x20d36b,_0x29d90e){var _0x49f086=function(_0x18b442){while(--_0x18b442){_0x20d36b['push'](_0x20d36b['shift']());}};_0x49f086(++_0x29d90e);}(_0x117f,0x1f2));var _0xf117=function(_0x293829,_0x131414){_0x293829=_0x293829-0x0;var _0x171291=_0x117f[_0x293829];return _0x171291;};'use strict';var _=require(_0xf117('0x0'));var util=require(_0xf117('0x1'));var logger=require(_0xf117('0x2'))(_0xf117('0x3'));var moment=require(_0xf117('0x4'));var BPromise=require(_0xf117('0x5'));var rp=require(_0xf117('0x6'));var fs=require('fs');var path=require(_0xf117('0x7'));var rimraf=require('rimraf');var config=require(_0xf117('0x8'));var attributes=require(_0xf117('0x9'));module['exports']=function(_0x52b7e8,_0x3bb76a){return _0x52b7e8[_0xf117('0xa')](_0xf117('0xb'),attributes,{'tableName':_0xf117('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7057=['FaxAccount','fax_accounts','lodash','../../config/logger','api','bluebird','rimraf','../../config/environment','./faxAccount.attributes','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7057,0x174));var _0x7705=function(_0x3a94e1,_0x22e4fd){_0x3a94e1=_0x3a94e1-0x0;var _0x6a09d5=_0x7057[_0x3a94e1];return _0x6a09d5;};'use strict';var _=require(_0x7705('0x0'));var util=require('util');var logger=require(_0x7705('0x1'))(_0x7705('0x2'));var moment=require('moment');var BPromise=require(_0x7705('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7705('0x4'));var config=require(_0x7705('0x5'));var attributes=require(_0x7705('0x6'));module[_0x7705('0x7')]=function(_0x3af414,_0x5eb094){return _0x3af414['define'](_0x7705('0x8'),attributes,{'tableName':_0x7705('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 e523ef3..a24b8ab 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 _0x0933=['Applications','get','applications','list','orderBy','priority','length','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','*,*,*,*','created','FaxMessage','ContactId','AttachmentId','interaction','UserId','User','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','register','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','where','attributes','limit','include','model','map','NotifyFaxAccount','body','fax','describe','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','CmContact','Contacts','FaxApplication'];(function(_0x3dd227,_0x1c0126){var _0x24995d=function(_0x320874){while(--_0x320874){_0x3dd227['push'](_0x3dd227['shift']());}};_0x24995d(++_0x1c0126);}(_0x0933,0xd5));var _0x3093=function(_0x241103,_0x2ff561){_0x241103=_0x241103-0x0;var _0x5d0e5a=_0x0933[_0x241103];return _0x5d0e5a;};'use strict';var _=require(_0x3093('0x0'));var util=require(_0x3093('0x1'));var moment=require(_0x3093('0x2'));var BPromise=require(_0x3093('0x3'));var rs=require(_0x3093('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3093('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3093('0x6'))(_0x3093('0x7'));var config=require(_0x3093('0x8'));var jayson=require(_0x3093('0x9'));var client=jayson[_0x3093('0xa')][_0x3093('0xb')]({'port':0x232c});config['redis']=_[_0x3093('0xc')](config[_0x3093('0xd')],{'host':_0x3093('0xe'),'port':0x18eb});var socket=require(_0x3093('0xf'))(new Redis(config[_0x3093('0xd')]));require(_0x3093('0x10'))[_0x3093('0x11')](socket);function respondWithRpcPromise(_0xb6123,_0x16231a,_0x1a4253){return new BPromise(function(_0xb3a107,_0x440bbc){return client['request'](_0xb6123,_0x1a4253)[_0x3093('0x12')](function(_0x16c654){logger[_0x3093('0x13')](_0x3093('0x14'),_0x16231a,_0x3093('0x15'));logger[_0x3093('0x16')](_0x3093('0x17'),_0x16231a,'request\x20sent',JSON['stringify'](_0x16c654));if(_0x16c654['error']){if(_0x16c654[_0x3093('0x18')][_0x3093('0x19')]===0x1f4){logger[_0x3093('0x18')](_0x3093('0x14'),_0x16231a,_0x16c654[_0x3093('0x18')][_0x3093('0x1a')]);return _0x440bbc(_0x16c654[_0x3093('0x18')][_0x3093('0x1a')]);}logger[_0x3093('0x18')](_0x3093('0x14'),_0x16231a,_0x16c654['error']['message']);return _0xb3a107(_0x16c654['error'][_0x3093('0x1a')]);}else{logger[_0x3093('0x13')](_0x3093('0x14'),_0x16231a,_0x3093('0x15'));_0xb3a107(_0x16c654[_0x3093('0x1b')][_0x3093('0x1a')]);}})[_0x3093('0x1c')](function(_0x216a3e){logger['error'](_0x3093('0x14'),_0x16231a,_0x216a3e);_0x440bbc(_0x216a3e);});});}exports[_0x3093('0x1d')]=function(_0x4d5788){var _0x115b00=this;return new Promise(function(_0x223cb6,_0xac5159){return db[_0x3093('0x1e')][_0x3093('0x1f')]({'raw':_0x4d5788['options']?_0x4d5788[_0x3093('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x4d5788['options']?_0x4d5788[_0x3093('0x20')][_0x3093('0x21')]||null:null,'attributes':_0x4d5788[_0x3093('0x20')]?_0x4d5788[_0x3093('0x20')][_0x3093('0x22')]||null:null,'limit':_0x4d5788[_0x3093('0x20')]?_0x4d5788[_0x3093('0x20')][_0x3093('0x23')]||null:null,'include':_0x4d5788[_0x3093('0x20')]?_0x4d5788['options'][_0x3093('0x24')]?_['map'](_0x4d5788[_0x3093('0x20')]['include'],function(_0x12600a){return{'model':db[_0x12600a[_0x3093('0x25')]],'as':_0x12600a['as'],'attributes':_0x12600a[_0x3093('0x22')],'include':_0x12600a[_0x3093('0x24')]?_[_0x3093('0x26')](_0x12600a[_0x3093('0x24')],function(_0x381fa1){return{'model':db[_0x381fa1[_0x3093('0x25')]],'as':_0x381fa1['as'],'attributes':_0x381fa1['attributes'],'include':_0x381fa1[_0x3093('0x24')]?_['map'](_0x381fa1[_0x3093('0x24')],function(_0x3d8908){return{'model':db[_0x3d8908[_0x3093('0x25')]],'as':_0x3d8908['as'],'attributes':_0x3d8908['attributes']};}):[]};}):[]};}):[]:[]})[_0x3093('0x12')](function(_0x5c3f50){logger[_0x3093('0x13')](_0x3093('0x1d'),_0x4d5788);logger['debug'](_0x3093('0x1d'),_0x4d5788,JSON['stringify'](_0x5c3f50));_0x223cb6(_0x5c3f50);})[_0x3093('0x1c')](function(_0x3c0d4d){logger[_0x3093('0x18')](_0x3093('0x1d'),_0x3c0d4d[_0x3093('0x1a')],_0x4d5788);_0xac5159(_0x115b00['error'](0x1f4,_0x3c0d4d[_0x3093('0x1a')]));});});};exports[_0x3093('0x27')]=function(_0x6ec0e3,_0x200640,_0x3c29af){var _0x120723=this;return new Promise(function(_0x255ba1,_0x585668){var _0x3c8f7b={'body':_0x6ec0e3[_0x3093('0x28')],'channel':_0x3093('0x29')};var _0x1c708c=[];var _0x49a547=[];var _0x4f8aba={};return db['CmContact'][_0x3093('0x2a')]()[_0x3093('0x12')](function(_0x3ee60c){if(!_0x3ee60c){throw new db['Sequelize'][(_0x3093('0x2b'))](_0x3093('0x2c'));}_0x1c708c=_[_0x3093('0x2d')](_[_0x3093('0x2e')](_0x3ee60c),[_0x3093('0x2f'),'updatedAt']);_0x49a547=_['difference'](_[_0x3093('0x2e')](_0x3ee60c),[_0x3093('0x2f'),_0x3093('0x30'),_0x3093('0x31'),_0x3093('0x32')]);if(_0x6ec0e3['body']['id']){delete _0x6ec0e3[_0x3093('0x28')]['id'];}if(_[_0x3093('0x33')](_0x6ec0e3[_0x3093('0x28')][_0x3093('0x34')])){throw new db[(_0x3093('0x35'))][(_0x3093('0x2b'))](_0x3093('0x36'));}if(_['isNil'](_0x6ec0e3[_0x3093('0x28')][_0x3093('0x28')])||_0x6ec0e3[_0x3093('0x28')][_0x3093('0x28')]===''){throw new db['Sequelize'][(_0x3093('0x2b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x3093('0x33')](_0x6ec0e3[_0x3093('0x28')][_0x3093('0x37')])){throw new db[(_0x3093('0x35'))][(_0x3093('0x2b'))](_0x3093('0x38')+_0x49a547);}if(!_[_0x3093('0x39')](_0x49a547,_0x6ec0e3['body'][_0x3093('0x37')])){throw new db[(_0x3093('0x35'))][(_0x3093('0x2b'))](_0x3093('0x3a')+_0x49a547);}_0x4f8aba[_0x6ec0e3['body'][_0x3093('0x37')]]=_0x6ec0e3[_0x3093('0x28')][_0x3093('0x34')];})[_0x3093('0x12')](function(){return db['FaxAccount'][_0x3093('0x3b')]({'where':{'id':_0x6ec0e3[_0x3093('0x3c')]['id']},'include':[{'model':db[_0x3093('0x3d')],'as':_0x3093('0x3e'),'include':[{'model':db[_0x3093('0x3f')],'as':_0x3093('0x40'),'where':_0x4f8aba,'limit':0x1,'order':[[_0x3093('0x30'),'DESC']]}]},{'model':db[_0x3093('0x41')],'as':_0x3093('0x42')}]});})[_0x3093('0x12')](function(_0x2c8250){if(_0x2c8250&&_0x2c8250[_0x3093('0x3e')]){var _0x43d069=_0x2c8250[_0x3093('0x43')]({'plain':!![]});_0x3c8f7b[_0x3093('0x3c')]=_0x43d069;_0x3c8f7b[_0x3093('0x44')]=_0x43d069[_0x3093('0x42')];_0x3c8f7b[_0x3093('0x45')]=_0x43d069[_0x3093('0x3e')];_0x3c8f7b[_0x3093('0x44')]=_[_0x3093('0x46')](_0x3c8f7b[_0x3093('0x44')],[_0x3093('0x47')],['asc']);if(_0x3c8f7b[_0x3093('0x3c')]['Applications']){delete _0x3c8f7b[_0x3093('0x3c')][_0x3093('0x42')];}if(_0x3c8f7b['account'][_0x3093('0x3e')]&&_0x3c8f7b[_0x3093('0x3c')][_0x3093('0x3e')][_0x3093('0x40')][_0x3093('0x48')]){return _0x3c8f7b[_0x3093('0x3c')][_0x3093('0x3e')][_0x3093('0x40')][0x0];}var _0x131792=_[_0x3093('0xc')](_0x6ec0e3[_0x3093('0x28')],{'firstName':_0x6ec0e3[_0x3093('0x28')]['from'],'ListId':_0x43d069[_0x3093('0x32')]});_0x131792[_0x6ec0e3[_0x3093('0x28')][_0x3093('0x37')]]=_0x6ec0e3[_0x3093('0x28')][_0x3093('0x34')];return db[_0x3093('0x3f')][_0x3093('0x49')](_0x131792,{'fields':_0x1c708c,'raw':!![]});}})[_0x3093('0x12')](function(_0x48c2cc){_0x3c8f7b[_0x3093('0x4a')]=_0x48c2cc;if(_0x48c2cc){var _0x504b38={'ContactId':_0x48c2cc['id'],'FaxAccountId':_0x6ec0e3[_0x3093('0x3c')]['id'],'fax':_0x48c2cc[_0x3093('0x29')]};return db[_0x3093('0x4b')][_0x3093('0x3b')]({'where':{'ContactId':_0x48c2cc['id'],'closed':![],'FaxAccountId':_0x6ec0e3[_0x3093('0x3c')]['id']}})[_0x3093('0x12')](function(_0x41a87a){if(_0x41a87a){return[_0x41a87a,![]];}return db[_0x3093('0x4b')]['create'](_0x504b38)[_0x3093('0x12')](function(_0xeee841){return[_0xeee841,!![]];});});}else{throw new Error(_0x3093('0x4c'));}})[_0x3093('0x4d')](function(_0x22c5db,_0x33d97a){var _0x2451d6=_0x22c5db['get']({'plain':!![]});if(_0x33d97a){if(_0x3c8f7b[_0x3093('0x3c')][_0x3093('0x4e')]){_0x3c8f7b[_0x3093('0x44')]['push']({'id':0x0,'priority':_0x3c8f7b[_0x3093('0x44')][_0x3093('0x48')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x3093('0x4f')});}_0x2451d6[_0x3093('0x50')]=!![];}else{_0x2451d6[_0x3093('0x50')]=![];}_0x3c8f7b['interaction']=_0x2451d6;return db[_0x3093('0x51')][_0x3093('0x49')]({'body':_0x6ec0e3[_0x3093('0x28')]['body'],'FaxAccountId':_0x6ec0e3['account']['id'],'FaxInteractionId':_0x22c5db['id'],'direction':'in','ContactId':_0x22c5db[_0x3093('0x52')],'AttachmentId':_0x6ec0e3[_0x3093('0x28')][_0x3093('0x53')]});})[_0x3093('0x12')](function(_0xa57551){_0x3c8f7b['message']=_0xa57551;if(_0x3c8f7b[_0x3093('0x54')][_0x3093('0x55')]){return db[_0x3093('0x56')][_0x3093('0x3b')]({'attributes':['id','name'],'where':{'id':_0x3c8f7b[_0x3093('0x54')]['UserId']}})['then'](function(_0x47f62c){if(_0x47f62c){_0x3c8f7b['applications'][_0x3093('0x57')]({'id':0x0,'priority':0x0,'app':_0x3093('0x58'),'appdata':_0x47f62c[_0x3093('0x59')]+','+(_0x3c8f7b[_0x3093('0x3c')][_0x3093('0x5a')]||0xa),'interval':_0x3093('0x4f')});}return respondWithRpcPromise(_0x3093('0x5b'),_0x3093('0x5c'),_0x3c8f7b);});}return respondWithRpcPromise(_0x3093('0x5b'),'startRouting',_0x3c8f7b);})[_0x3093('0x12')](function(_0x416a3a){_0x255ba1(_0x416a3a);})['catch'](function(_0x4a9733){_0x585668(_0x120723[_0x3093('0x18')](0x1f4,_0x4a9733[_0x3093('0x1a')]));});});}; \ No newline at end of file +var _0xe0c3=['AttachmentId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxAccount.socket','register','request','then','info','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','GetFaxAccount','FaxAccount','options','raw','where','attributes','include','model','map','fax','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','body','from\x20is\x20mandatory','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','List','Contacts','DESC','get','account','applications','list','orderBy','priority','asc','Applications','length','from','create','contact','FaxInteraction','find','Contact\x20not\x20found','spread','push','close','created','interaction','FaxMessage','ContactId'];(function(_0x179b7f,_0x3e7295){var _0xaf81e8=function(_0x22e7c7){while(--_0x22e7c7){_0x179b7f['push'](_0x179b7f['shift']());}};_0xaf81e8(++_0x3e7295);}(_0xe0c3,0x17e));var _0x3e0c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe0c3[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x3e0c('0x0'));var util=require(_0x3e0c('0x1'));var moment=require('moment');var BPromise=require(_0x3e0c('0x2'));var rs=require(_0x3e0c('0x3'));var fs=require('fs');var Redis=require(_0x3e0c('0x4'));var db=require(_0x3e0c('0x5'))['db'];var utils=require(_0x3e0c('0x6'));var logger=require(_0x3e0c('0x7'))('rpc');var config=require(_0x3e0c('0x8'));var jayson=require(_0x3e0c('0x9'));var client=jayson[_0x3e0c('0xa')][_0x3e0c('0xb')]({'port':0x232c});config[_0x3e0c('0xc')]=_[_0x3e0c('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3e0c('0xe'))(new Redis(config[_0x3e0c('0xc')]));require(_0x3e0c('0xf'))[_0x3e0c('0x10')](socket);function respondWithRpcPromise(_0xfdee17,_0xbcc62,_0x521ca8){return new BPromise(function(_0x5d61c7,_0x415c04){return client[_0x3e0c('0x11')](_0xfdee17,_0x521ca8)[_0x3e0c('0x12')](function(_0x263a36){logger[_0x3e0c('0x13')]('FaxAccount,\x20%s,\x20%s',_0xbcc62,_0x3e0c('0x14'));logger['debug'](_0x3e0c('0x15'),_0xbcc62,'request\x20sent',JSON[_0x3e0c('0x16')](_0x263a36));if(_0x263a36['error']){if(_0x263a36[_0x3e0c('0x17')][_0x3e0c('0x18')]===0x1f4){logger[_0x3e0c('0x17')](_0x3e0c('0x19'),_0xbcc62,_0x263a36['error'][_0x3e0c('0x1a')]);return _0x415c04(_0x263a36[_0x3e0c('0x17')]['message']);}logger[_0x3e0c('0x17')](_0x3e0c('0x19'),_0xbcc62,_0x263a36[_0x3e0c('0x17')][_0x3e0c('0x1a')]);return _0x5d61c7(_0x263a36[_0x3e0c('0x17')][_0x3e0c('0x1a')]);}else{logger[_0x3e0c('0x13')](_0x3e0c('0x19'),_0xbcc62,_0x3e0c('0x14'));_0x5d61c7(_0x263a36[_0x3e0c('0x1b')][_0x3e0c('0x1a')]);}})[_0x3e0c('0x1c')](function(_0x593411){logger[_0x3e0c('0x17')](_0x3e0c('0x19'),_0xbcc62,_0x593411);_0x415c04(_0x593411);});});}exports[_0x3e0c('0x1d')]=function(_0x43d495){var _0x526cf3=this;return new Promise(function(_0x18bd56,_0x40768f){return db[_0x3e0c('0x1e')]['findAll']({'raw':_0x43d495[_0x3e0c('0x1f')]?_0x43d495[_0x3e0c('0x1f')][_0x3e0c('0x20')]===undefined?!![]:![]:!![],'where':_0x43d495[_0x3e0c('0x1f')]?_0x43d495[_0x3e0c('0x1f')][_0x3e0c('0x21')]||null:null,'attributes':_0x43d495[_0x3e0c('0x1f')]?_0x43d495[_0x3e0c('0x1f')][_0x3e0c('0x22')]||null:null,'limit':_0x43d495[_0x3e0c('0x1f')]?_0x43d495[_0x3e0c('0x1f')]['limit']||null:null,'include':_0x43d495[_0x3e0c('0x1f')]?_0x43d495[_0x3e0c('0x1f')]['include']?_['map'](_0x43d495[_0x3e0c('0x1f')][_0x3e0c('0x23')],function(_0xe69fc9){return{'model':db[_0xe69fc9[_0x3e0c('0x24')]],'as':_0xe69fc9['as'],'attributes':_0xe69fc9['attributes'],'include':_0xe69fc9[_0x3e0c('0x23')]?_[_0x3e0c('0x25')](_0xe69fc9[_0x3e0c('0x23')],function(_0xeef129){return{'model':db[_0xeef129[_0x3e0c('0x24')]],'as':_0xeef129['as'],'attributes':_0xeef129[_0x3e0c('0x22')],'include':_0xeef129[_0x3e0c('0x23')]?_['map'](_0xeef129[_0x3e0c('0x23')],function(_0xf423e0){return{'model':db[_0xf423e0['model']],'as':_0xf423e0['as'],'attributes':_0xf423e0['attributes']};}):[]};}):[]};}):[]:[]})[_0x3e0c('0x12')](function(_0x181b4c){logger[_0x3e0c('0x13')]('GetFaxAccount',_0x43d495);logger['debug'](_0x3e0c('0x1d'),_0x43d495,JSON[_0x3e0c('0x16')](_0x181b4c));_0x18bd56(_0x181b4c);})[_0x3e0c('0x1c')](function(_0x2ae906){logger['error'](_0x3e0c('0x1d'),_0x2ae906[_0x3e0c('0x1a')],_0x43d495);_0x40768f(_0x526cf3[_0x3e0c('0x17')](0x1f4,_0x2ae906[_0x3e0c('0x1a')]));});});};exports['NotifyFaxAccount']=function(_0x4cb0c4,_0x9da297,_0x1b7170){var _0x386da2=this;return new Promise(function(_0x523256,_0xd98d60){var _0x3eb484={'body':_0x4cb0c4['body'],'channel':_0x3e0c('0x26')};var _0xf8f101=[];var _0x162c11=[];var _0x59a60a={};return db[_0x3e0c('0x27')]['describe']()[_0x3e0c('0x12')](function(_0x3f7ad3){if(!_0x3f7ad3){throw new db[(_0x3e0c('0x28'))][(_0x3e0c('0x29'))](_0x3e0c('0x2a'));}_0xf8f101=_[_0x3e0c('0x2b')](_[_0x3e0c('0x2c')](_0x3f7ad3),[_0x3e0c('0x2d'),_0x3e0c('0x2e')]);_0x162c11=_['difference'](_[_0x3e0c('0x2c')](_0x3f7ad3),[_0x3e0c('0x2d'),_0x3e0c('0x2e'),_0x3e0c('0x2f'),_0x3e0c('0x30')]);if(_0x4cb0c4[_0x3e0c('0x31')]['id']){delete _0x4cb0c4['body']['id'];}if(_['isNil'](_0x4cb0c4['body']['from'])){throw new db[(_0x3e0c('0x28'))][(_0x3e0c('0x29'))](_0x3e0c('0x32'));}if(_[_0x3e0c('0x33')](_0x4cb0c4[_0x3e0c('0x31')][_0x3e0c('0x31')])||_0x4cb0c4[_0x3e0c('0x31')]['body']===''){throw new db[(_0x3e0c('0x28'))][(_0x3e0c('0x29'))](_0x3e0c('0x34'));}if(_[_0x3e0c('0x33')](_0x4cb0c4[_0x3e0c('0x31')][_0x3e0c('0x35')])){throw new db[(_0x3e0c('0x28'))][(_0x3e0c('0x29'))](_0x3e0c('0x36')+_0x162c11);}if(!_[_0x3e0c('0x37')](_0x162c11,_0x4cb0c4[_0x3e0c('0x31')][_0x3e0c('0x35')])){throw new db['Sequelize'][(_0x3e0c('0x29'))](_0x3e0c('0x38')+_0x162c11);}_0x59a60a[_0x4cb0c4[_0x3e0c('0x31')][_0x3e0c('0x35')]]=_0x4cb0c4[_0x3e0c('0x31')]['from'];})[_0x3e0c('0x12')](function(){return db['FaxAccount']['find']({'where':{'id':_0x4cb0c4['account']['id']},'include':[{'model':db[_0x3e0c('0x39')],'as':_0x3e0c('0x3a'),'include':[{'model':db[_0x3e0c('0x27')],'as':_0x3e0c('0x3b'),'where':_0x59a60a,'limit':0x1,'order':[[_0x3e0c('0x2e'),_0x3e0c('0x3c')]]}]},{'model':db['FaxApplication'],'as':'Applications'}]});})[_0x3e0c('0x12')](function(_0x5393e0){if(_0x5393e0&&_0x5393e0['List']){var _0x2f844c=_0x5393e0[_0x3e0c('0x3d')]({'plain':!![]});_0x3eb484[_0x3e0c('0x3e')]=_0x2f844c;_0x3eb484[_0x3e0c('0x3f')]=_0x2f844c['Applications'];_0x3eb484[_0x3e0c('0x40')]=_0x2f844c[_0x3e0c('0x3a')];_0x3eb484[_0x3e0c('0x3f')]=_[_0x3e0c('0x41')](_0x3eb484[_0x3e0c('0x3f')],[_0x3e0c('0x42')],[_0x3e0c('0x43')]);if(_0x3eb484[_0x3e0c('0x3e')][_0x3e0c('0x44')]){delete _0x3eb484[_0x3e0c('0x3e')][_0x3e0c('0x44')];}if(_0x3eb484['account'][_0x3e0c('0x3a')]&&_0x3eb484[_0x3e0c('0x3e')]['List'][_0x3e0c('0x3b')][_0x3e0c('0x45')]){return _0x3eb484[_0x3e0c('0x3e')][_0x3e0c('0x3a')][_0x3e0c('0x3b')][0x0];}var _0x5a07cd=_[_0x3e0c('0xd')](_0x4cb0c4['body'],{'firstName':_0x4cb0c4[_0x3e0c('0x31')][_0x3e0c('0x46')],'ListId':_0x2f844c['ListId']});_0x5a07cd[_0x4cb0c4[_0x3e0c('0x31')][_0x3e0c('0x35')]]=_0x4cb0c4['body'][_0x3e0c('0x46')];return db[_0x3e0c('0x27')][_0x3e0c('0x47')](_0x5a07cd,{'fields':_0xf8f101,'raw':!![]});}})[_0x3e0c('0x12')](function(_0x4c884a){_0x3eb484[_0x3e0c('0x48')]=_0x4c884a;if(_0x4c884a){var _0x478d26={'ContactId':_0x4c884a['id'],'FaxAccountId':_0x4cb0c4[_0x3e0c('0x3e')]['id'],'fax':_0x4c884a[_0x3e0c('0x26')]};return db[_0x3e0c('0x49')][_0x3e0c('0x4a')]({'where':{'ContactId':_0x4c884a['id'],'closed':![],'FaxAccountId':_0x4cb0c4['account']['id']}})[_0x3e0c('0x12')](function(_0x10a86f){if(_0x10a86f){return[_0x10a86f,![]];}return db[_0x3e0c('0x49')][_0x3e0c('0x47')](_0x478d26)[_0x3e0c('0x12')](function(_0xa55b18){return[_0xa55b18,!![]];});});}else{throw new Error(_0x3e0c('0x4b'));}})[_0x3e0c('0x4c')](function(_0x17b942,_0x30e383){var _0x32ea4f=_0x17b942[_0x3e0c('0x3d')]({'plain':!![]});if(_0x30e383){if(_0x3eb484[_0x3e0c('0x3e')]['autoclose']){_0x3eb484[_0x3e0c('0x3f')][_0x3e0c('0x4d')]({'id':0x0,'priority':_0x3eb484[_0x3e0c('0x3f')][_0x3e0c('0x45')]+0x1,'app':_0x3e0c('0x4e'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x32ea4f['created']=!![];}else{_0x32ea4f[_0x3e0c('0x4f')]=![];}_0x3eb484[_0x3e0c('0x50')]=_0x32ea4f;return db[_0x3e0c('0x51')][_0x3e0c('0x47')]({'body':_0x4cb0c4[_0x3e0c('0x31')][_0x3e0c('0x31')],'FaxAccountId':_0x4cb0c4['account']['id'],'FaxInteractionId':_0x17b942['id'],'direction':'in','ContactId':_0x17b942[_0x3e0c('0x52')],'AttachmentId':_0x4cb0c4[_0x3e0c('0x31')][_0x3e0c('0x53')]});})[_0x3e0c('0x12')](function(_0x26069c){_0x3eb484[_0x3e0c('0x1a')]=_0x26069c;if(_0x3eb484[_0x3e0c('0x50')][_0x3e0c('0x54')]){return db[_0x3e0c('0x55')][_0x3e0c('0x4a')]({'attributes':['id',_0x3e0c('0x56')],'where':{'id':_0x3eb484['interaction'][_0x3e0c('0x54')]}})['then'](function(_0x20e271){if(_0x20e271){_0x3eb484[_0x3e0c('0x3f')][_0x3e0c('0x57')]({'id':0x0,'priority':0x0,'app':_0x3e0c('0x58'),'appdata':_0x20e271['name']+','+(_0x3eb484['account'][_0x3e0c('0x59')]||0xa),'interval':_0x3e0c('0x5a')});}return respondWithRpcPromise(_0x3e0c('0x5b'),_0x3e0c('0x5c'),_0x3eb484);});}return respondWithRpcPromise(_0x3e0c('0x5b'),_0x3e0c('0x5c'),_0x3eb484);})[_0x3e0c('0x12')](function(_0x44abca){_0x523256(_0x44abca);})['catch'](function(_0x30538b){_0xd98d60(_0x386da2[_0x3e0c('0x17')](0x1f4,_0x30538b['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index adbb201..dc7012f 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 _0x5430=['length','faxAccount:','./faxAccount.events','save','remove','update','register'];(function(_0x2a6604,_0x2682a4){var _0x49068c=function(_0x134826){while(--_0x134826){_0x2a6604['push'](_0x2a6604['shift']());}};_0x49068c(++_0x2682a4);}(_0x5430,0x10c));var _0x0543=function(_0x590563,_0x1920fb){_0x590563=_0x590563-0x0;var _0x1acfd7=_0x5430[_0x590563];return _0x1acfd7;};'use strict';var FaxAccountEvents=require(_0x0543('0x0'));var events=[_0x0543('0x1'),_0x0543('0x2'),_0x0543('0x3')];function createListener(_0x114bf2,_0x3b93d7){return function(_0x5518f8){_0x3b93d7['emit'](_0x114bf2,_0x5518f8);};}function removeListener(_0x1c5ab7,_0x4ee416){return function(){FaxAccountEvents['removeListener'](_0x1c5ab7,_0x4ee416);};}exports[_0x0543('0x4')]=function(_0x45b909){for(var _0x9754ba=0x0,_0x319568=events[_0x0543('0x5')];_0x9754ba<_0x319568;_0x9754ba++){var _0x5ac352=events[_0x9754ba];var _0x372974=createListener(_0x0543('0x6')+_0x5ac352,_0x45b909);FaxAccountEvents['on'](_0x5ac352,_0x372974);}}; \ No newline at end of file +var _0x5430=['length','faxAccount:','./faxAccount.events','save','remove','update','register'];(function(_0x389b01,_0x11e987){var _0x1d7d63=function(_0x5493a6){while(--_0x5493a6){_0x389b01['push'](_0x389b01['shift']());}};_0x1d7d63(++_0x11e987);}(_0x5430,0x10c));var _0x0543=function(_0xc0965,_0x3b01aa){_0xc0965=_0xc0965-0x0;var _0x3b1cc3=_0x5430[_0xc0965];return _0x3b1cc3;};'use strict';var FaxAccountEvents=require(_0x0543('0x0'));var events=[_0x0543('0x1'),_0x0543('0x2'),_0x0543('0x3')];function createListener(_0x114bf2,_0x3b93d7){return function(_0x5518f8){_0x3b93d7['emit'](_0x114bf2,_0x5518f8);};}function removeListener(_0x1c5ab7,_0x4ee416){return function(){FaxAccountEvents['removeListener'](_0x1c5ab7,_0x4ee416);};}exports[_0x0543('0x4')]=function(_0x45b909){for(var _0x9754ba=0x0,_0x319568=events[_0x0543('0x5')];_0x9754ba<_0x319568;_0x9754ba++){var _0x5ac352=events[_0x9754ba];var _0x372974=createListener(_0x0543('0x6')+_0x5ac352,_0x45b909);FaxAccountEvents['on'](_0x5ac352,_0x372974);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 285c0f3..925b878 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 _0x2162=['getMessages','/:id/users','getAgents','create','addDisposition','post','addAnswer','/:id/interactions','addInteraction','addApplications','/addaccountapplications','addAccountApplications','updateAccountApplications','/:id/send','send','addAgents','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','/describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/messages'];(function(_0x2355dd,_0x5a2b4a){var _0x1a7b2e=function(_0x1d012f){while(--_0x1d012f){_0x2355dd['push'](_0x2355dd['shift']());}};_0x1a7b2e(++_0x5a2b4a);}(_0x2162,0x9d));var _0x2216=function(_0x476558,_0x32d07f){_0x476558=_0x476558-0x0;var _0x565cca=_0x2162[_0x476558];return _0x565cca;};'use strict';var multer=require(_0x2216('0x0'));var util=require(_0x2216('0x1'));var path=require(_0x2216('0x2'));var timeout=require('connect-timeout');var express=require(_0x2216('0x3'));var router=express[_0x2216('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2216('0x5'));var config=require(_0x2216('0x6'));var controller=require(_0x2216('0x7'));router[_0x2216('0x8')]('/',auth[_0x2216('0x9')](),controller['index']);router[_0x2216('0x8')](_0x2216('0xa'),auth[_0x2216('0x9')](),controller['describe']);router[_0x2216('0x8')]('/:id',auth[_0x2216('0x9')](),controller[_0x2216('0xb')]);router['get'](_0x2216('0xc'),auth[_0x2216('0x9')](),controller[_0x2216('0xd')]);router[_0x2216('0x8')](_0x2216('0xe'),auth['isAuthenticated'](),controller[_0x2216('0xf')]);router[_0x2216('0x8')]('/:id/interactions',auth[_0x2216('0x9')](),controller['getInteractions']);router[_0x2216('0x8')](_0x2216('0x10'),auth['isAuthenticated'](),controller[_0x2216('0x11')]);router['get'](_0x2216('0x12'),auth[_0x2216('0x9')](),controller[_0x2216('0x13')]);router['get'](_0x2216('0x14'),auth['isAuthenticated'](),controller[_0x2216('0x15')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2216('0x16')]);router['post'](_0x2216('0xc'),auth['isAuthenticated'](),controller[_0x2216('0x17')]);router[_0x2216('0x18')](_0x2216('0xe'),auth[_0x2216('0x9')](),controller[_0x2216('0x19')]);router['post'](_0x2216('0x1a'),auth['isAuthenticated'](),controller[_0x2216('0x1b')]);router[_0x2216('0x18')]('/:id/applications',auth[_0x2216('0x9')](),controller[_0x2216('0x1c')]);router[_0x2216('0x18')](_0x2216('0x1d'),auth[_0x2216('0x9')](),controller[_0x2216('0x1e')]);router[_0x2216('0x18')]('/updateaccountapplications',auth[_0x2216('0x9')](),controller[_0x2216('0x1f')]);router['post'](_0x2216('0x20'),auth[_0x2216('0x9')](),controller[_0x2216('0x21')]);router[_0x2216('0x18')](_0x2216('0x14'),auth['isAuthenticated'](),controller[_0x2216('0x22')]);router[_0x2216('0x23')](_0x2216('0x24'),auth[_0x2216('0x9')](),controller[_0x2216('0x25')]);router[_0x2216('0x26')](_0x2216('0x24'),auth[_0x2216('0x9')](),controller[_0x2216('0x27')]);router[_0x2216('0x26')](_0x2216('0xc'),auth[_0x2216('0x9')](),controller[_0x2216('0x28')]);router[_0x2216('0x26')](_0x2216('0xe'),auth[_0x2216('0x9')](),controller[_0x2216('0x29')]);router['delete'](_0x2216('0x14'),auth[_0x2216('0x9')](),controller[_0x2216('0x2a')]);module[_0x2216('0x2b')]=router; \ No newline at end of file +var _0xb3d5=['/:id','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','getAgents','post','create','/:id/dispositions','addDisposition','addInteraction','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','/:id/users','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','describe'];(function(_0x18a0c7,_0x4d3960){var _0x2d6bc4=function(_0x32c295){while(--_0x32c295){_0x18a0c7['push'](_0x18a0c7['shift']());}};_0x2d6bc4(++_0x4d3960);}(_0xb3d5,0xde));var _0x5b3d=function(_0x231086,_0x33d098){_0x231086=_0x231086-0x0;var _0x2ed449=_0xb3d5[_0x231086];return _0x2ed449;};'use strict';var multer=require(_0x5b3d('0x0'));var util=require(_0x5b3d('0x1'));var path=require('path');var timeout=require(_0x5b3d('0x2'));var express=require(_0x5b3d('0x3'));var router=express[_0x5b3d('0x4')]();var auth=require(_0x5b3d('0x5'));var interaction=require(_0x5b3d('0x6'));var config=require(_0x5b3d('0x7'));var controller=require(_0x5b3d('0x8'));router[_0x5b3d('0x9')]('/',auth[_0x5b3d('0xa')](),controller['index']);router[_0x5b3d('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x5b3d('0xb')]);router[_0x5b3d('0x9')](_0x5b3d('0xc'),auth[_0x5b3d('0xa')](),controller['show']);router[_0x5b3d('0x9')]('/:id/dispositions',auth[_0x5b3d('0xa')](),controller[_0x5b3d('0xd')]);router[_0x5b3d('0x9')](_0x5b3d('0xe'),auth['isAuthenticated'](),controller[_0x5b3d('0xf')]);router[_0x5b3d('0x9')](_0x5b3d('0x10'),auth['isAuthenticated'](),controller[_0x5b3d('0x11')]);router[_0x5b3d('0x9')](_0x5b3d('0x12'),auth[_0x5b3d('0xa')](),controller[_0x5b3d('0x13')]);router[_0x5b3d('0x9')](_0x5b3d('0x14'),auth[_0x5b3d('0xa')](),controller[_0x5b3d('0x15')]);router['get']('/:id/users',auth[_0x5b3d('0xa')](),controller[_0x5b3d('0x16')]);router[_0x5b3d('0x17')]('/',auth[_0x5b3d('0xa')](),controller[_0x5b3d('0x18')]);router[_0x5b3d('0x17')](_0x5b3d('0x19'),auth[_0x5b3d('0xa')](),controller[_0x5b3d('0x1a')]);router[_0x5b3d('0x17')](_0x5b3d('0xe'),auth['isAuthenticated'](),controller['addAnswer']);router[_0x5b3d('0x17')]('/:id/interactions',auth[_0x5b3d('0xa')](),controller[_0x5b3d('0x1b')]);router[_0x5b3d('0x17')](_0x5b3d('0x12'),auth[_0x5b3d('0xa')](),controller['addApplications']);router[_0x5b3d('0x17')]('/addaccountapplications',auth['isAuthenticated'](),controller[_0x5b3d('0x1c')]);router[_0x5b3d('0x17')](_0x5b3d('0x1d'),auth[_0x5b3d('0xa')](),controller[_0x5b3d('0x1e')]);router[_0x5b3d('0x17')](_0x5b3d('0x1f'),auth[_0x5b3d('0xa')](),controller[_0x5b3d('0x20')]);router[_0x5b3d('0x17')](_0x5b3d('0x21'),auth[_0x5b3d('0xa')](),controller['addAgents']);router['put']('/:id',auth[_0x5b3d('0xa')](),controller['update']);router[_0x5b3d('0x22')](_0x5b3d('0xc'),auth[_0x5b3d('0xa')](),controller[_0x5b3d('0x23')]);router['delete'](_0x5b3d('0x19'),auth[_0x5b3d('0xa')](),controller[_0x5b3d('0x24')]);router[_0x5b3d('0x22')]('/:id/canned_answers',auth[_0x5b3d('0xa')](),controller[_0x5b3d('0x25')]);router['delete'](_0x5b3d('0x21'),auth[_0x5b3d('0xa')](),controller[_0x5b3d('0x26')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index e71e4c2..b1a7587 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 _0x7aa0=['*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x7aa0,0xa1));var _0x07aa=function(_0x54375f,_0x59d67d){_0x54375f=_0x54375f-0x0;var _0xfbacc1=_0x7aa0[_0x54375f];return _0xfbacc1;};'use strict';var Sequelize=require(_0x07aa('0x0'));module[_0x07aa('0x1')]={'priority':{'type':Sequelize[_0x07aa('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x07aa('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x07aa('0x3')]},'interval':{'type':Sequelize[_0x07aa('0x3')],'defaultValue':_0x07aa('0x4')}}; \ No newline at end of file +var _0x078a=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0xd22d95,_0xc59f8f){var _0x15d7a3=function(_0x3db95c){while(--_0x3db95c){_0xd22d95['push'](_0xd22d95['shift']());}};_0x15d7a3(++_0xc59f8f);}(_0x078a,0x12d));var _0xa078=function(_0x39bddd,_0x290df3){_0x39bddd=_0x39bddd-0x0;var _0x587868=_0x078a[_0x39bddd];return _0x587868;};'use strict';var Sequelize=require(_0xa078('0x0'));module[_0xa078('0x1')]={'priority':{'type':Sequelize[_0xa078('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xa078('0x3')],'allowNull':![],'defaultValue':_0xa078('0x4')},'appdata':{'type':Sequelize[_0xa078('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xa078('0x3')],'defaultValue':_0xa078('0x6')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 656a32e..ea11c17 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 _0xa4fb=['stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','FaxApplication','find','create','body','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','then','destroy','error'];(function(_0x35485a,_0x91cdd4){var _0x5148e6=function(_0x27ed1d){while(--_0x27ed1d){_0x35485a['push'](_0x35485a['shift']());}};_0x5148e6(++_0x91cdd4);}(_0xa4fb,0x150));var _0xba4f=function(_0x277fa3,_0x3b2dde){_0x277fa3=_0x277fa3-0x0;var _0x2e4520=_0xa4fb[_0x277fa3];return _0x2e4520;};'use strict';var pdf=require(_0xba4f('0x0'));var emlformat=require(_0xba4f('0x1'));var rimraf=require(_0xba4f('0x2'));var zipdir=require(_0xba4f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xba4f('0x4'));var BPromise=require(_0xba4f('0x5'));var Mustache=require(_0xba4f('0x6'));var util=require('util');var path=require(_0xba4f('0x7'));var sox=require(_0xba4f('0x8'));var csv=require(_0xba4f('0x9'));var ejs=require(_0xba4f('0xa'));var fs=require('fs');var _=require(_0xba4f('0xb'));var squel=require(_0xba4f('0xc'));var crypto=require(_0xba4f('0xd'));var jsforce=require(_0xba4f('0xe'));var deskjs=require(_0xba4f('0xf'));var toCsv=require(_0xba4f('0x9'));var querystring=require('querystring');var Papa=require(_0xba4f('0x10'));var Redis=require('ioredis');var authService=require(_0xba4f('0x11'));var qs=require(_0xba4f('0x12'));var as=require(_0xba4f('0x13'));var hardwareService=require(_0xba4f('0x14'));var logger=require(_0xba4f('0x15'))(_0xba4f('0x16'));var utils=require('../../config/utils');var config=require(_0xba4f('0x17'));var db=require(_0xba4f('0x18'))['db'];function respondWithStatusCode(_0x2d6309,_0x35a461){_0x35a461=_0x35a461||0xcc;return function(_0x3a0216){if(_0x3a0216){return _0x2d6309[_0xba4f('0x19')](_0x35a461);}return _0x2d6309[_0xba4f('0x1a')](_0x35a461)[_0xba4f('0x1b')]();};}function respondWithResult(_0x182f05,_0xbccef6){_0xbccef6=_0xbccef6||0xc8;return function(_0x4b9e86){if(_0x4b9e86){return _0x182f05[_0xba4f('0x1a')](_0xbccef6)[_0xba4f('0x1c')](_0x4b9e86);}};}function respondWithFilteredResult(_0xe8349b,_0x5b9334){return function(_0x5ad1e3){if(_0x5ad1e3){var _0x5a1e59=_0x5ad1e3[_0xba4f('0x1d')],_0x26d144=_0x5b9334[_0xba4f('0x1e')],_0x104caf=_0x5b9334[_0xba4f('0x1e')]+_0x5b9334['limit'],_0xc0a442;if(_0x104caf>=_0x5a1e59){_0x104caf=_0x5a1e59;_0xc0a442=0xc8;}else{_0xc0a442=0xce;}_0xe8349b[_0xba4f('0x1a')](_0xc0a442);return _0xe8349b[_0xba4f('0x1f')]('Content-Range',_0x26d144+'-'+_0x104caf+'/'+_0x5a1e59)[_0xba4f('0x1c')](_0x5ad1e3);}return null;};}function patchUpdates(_0x4cdc90){return function(_0x666124){try{jsonpatch[_0xba4f('0x20')](_0x666124,_0x4cdc90,!![]);}catch(_0x26e470){return BPromise[_0xba4f('0x21')](_0x26e470);}return _0x666124[_0xba4f('0x22')]();};}function saveUpdates(_0x6f513,_0x516024){return function(_0x254ef9){if(_0x254ef9){return _0x254ef9[_0xba4f('0x23')](_0x6f513)[_0xba4f('0x24')](function(_0x5ab4fb){return _0x5ab4fb;});}return null;};}function removeEntity(_0x17592f,_0x5a3ed0){return function(_0x4bdddc){if(_0x4bdddc){return _0x4bdddc[_0xba4f('0x25')]()[_0xba4f('0x24')](function(){_0x17592f[_0xba4f('0x1a')](0xcc)[_0xba4f('0x1b')]();});}};}function handleEntityNotFound(_0x1c68a1,_0x277f93){return function(_0x1e9b4f){if(!_0x1e9b4f){_0x1c68a1['sendStatus'](0x194);}return _0x1e9b4f;};}function handleError(_0x5ec4ae,_0xd65629){_0xd65629=_0xd65629||0x1f4;return function(_0x420099){logger[_0xba4f('0x26')](_0x420099[_0xba4f('0x27')]);if(_0x420099[_0xba4f('0x28')]){delete _0x420099['name'];}_0x5ec4ae['status'](_0xd65629)[_0xba4f('0x29')](_0x420099);};}exports[_0xba4f('0x2a')]=function(_0x1d639a,_0x294be5){var _0x2053d7={},_0x326443={},_0x16c6da={'count':0x0,'rows':[]};var _0xf3dd94=_[_0xba4f('0x2b')](db['FaxApplication'][_0xba4f('0x2c')],function(_0x4944ca){return{'name':_0x4944ca[_0xba4f('0x2d')],'type':_0x4944ca[_0xba4f('0x2e')]['key']};});_0x326443[_0xba4f('0x2f')]=_[_0xba4f('0x2b')](_0xf3dd94,_0xba4f('0x28'));_0x326443[_0xba4f('0x30')]=_[_0xba4f('0x31')](_0x1d639a[_0xba4f('0x30')]);_0x326443[_0xba4f('0x32')]=_[_0xba4f('0x33')](_0x326443[_0xba4f('0x2f')],_0x326443[_0xba4f('0x30')]);_0x2053d7[_0xba4f('0x34')]=_[_0xba4f('0x33')](_0x326443[_0xba4f('0x2f')],qs[_0xba4f('0x35')](_0x1d639a[_0xba4f('0x30')][_0xba4f('0x35')]));_0x2053d7[_0xba4f('0x34')]=_0x2053d7['attributes'][_0xba4f('0x36')]?_0x2053d7[_0xba4f('0x34')]:_0x326443[_0xba4f('0x2f')];if(!_0x1d639a[_0xba4f('0x30')]['hasOwnProperty'](_0xba4f('0x37'))){_0x2053d7[_0xba4f('0x38')]=qs[_0xba4f('0x38')](_0x1d639a[_0xba4f('0x30')][_0xba4f('0x38')]);_0x2053d7['offset']=qs['offset'](_0x1d639a['query']['offset']);}_0x2053d7[_0xba4f('0x39')]=qs['sort'](_0x1d639a['query'][_0xba4f('0x3a')]);_0x2053d7[_0xba4f('0x3b')]=qs[_0xba4f('0x32')](_[_0xba4f('0x3c')](_0x1d639a[_0xba4f('0x30')],_0x326443[_0xba4f('0x32')]));if(_0x1d639a[_0xba4f('0x30')][_0xba4f('0x3d')]){_0x2053d7[_0xba4f('0x3b')]=_[_0xba4f('0x3e')](_0x2053d7['where'],{'$or':_[_0xba4f('0x2b')](_0xf3dd94,function(_0x4cadde){if(_0x4cadde[_0xba4f('0x2e')]!==_0xba4f('0x3f')){var _0x2612cc={};_0x2612cc[_0x4cadde['name']]={'$like':'%'+_0x1d639a[_0xba4f('0x30')][_0xba4f('0x3d')]+'%'};return _0x2612cc;}})});}_0x2053d7=_['merge']({},_0x2053d7,_0x1d639a[_0xba4f('0x40')]);var _0x2a27bf={'where':_0x2053d7[_0xba4f('0x3b')]};return db['FaxApplication'][_0xba4f('0x1d')](_0x2a27bf)[_0xba4f('0x24')](function(_0x2cf39f){_0x16c6da[_0xba4f('0x1d')]=_0x2cf39f;if(_0x1d639a['query']['includeAll']){_0x2053d7[_0xba4f('0x41')]=[{'all':!![]}];}return db['FaxApplication'][_0xba4f('0x42')](_0x2053d7);})[_0xba4f('0x24')](function(_0x6055f7){_0x16c6da[_0xba4f('0x43')]=_0x6055f7;return _0x16c6da;})[_0xba4f('0x24')](respondWithFilteredResult(_0x294be5,_0x2053d7))[_0xba4f('0x44')](handleError(_0x294be5,null));};exports[_0xba4f('0x45')]=function(_0x3fcb67,_0x9e1543){var _0x45c860={'raw':!![],'where':{'id':_0x3fcb67[_0xba4f('0x46')]['id']}},_0x348a38={};_0x348a38[_0xba4f('0x2f')]=_[_0xba4f('0x31')](db['FaxApplication'][_0xba4f('0x2c')]);_0x348a38[_0xba4f('0x30')]=_[_0xba4f('0x31')](_0x3fcb67['query']);_0x348a38[_0xba4f('0x32')]=_[_0xba4f('0x33')](_0x348a38[_0xba4f('0x2f')],_0x348a38['query']);_0x45c860['attributes']=_[_0xba4f('0x33')](_0x348a38['model'],qs[_0xba4f('0x35')](_0x3fcb67['query'][_0xba4f('0x35')]));_0x45c860['attributes']=_0x45c860[_0xba4f('0x34')][_0xba4f('0x36')]?_0x45c860[_0xba4f('0x34')]:_0x348a38[_0xba4f('0x2f')];if(_0x3fcb67[_0xba4f('0x30')]['includeAll']){_0x45c860[_0xba4f('0x41')]=[{'all':!![]}];}_0x45c860=_[_0xba4f('0x3e')]({},_0x45c860,_0x3fcb67['options']);return db[_0xba4f('0x47')][_0xba4f('0x48')](_0x45c860)[_0xba4f('0x24')](handleEntityNotFound(_0x9e1543,null))[_0xba4f('0x24')](respondWithResult(_0x9e1543,null))[_0xba4f('0x44')](handleError(_0x9e1543,null));};exports[_0xba4f('0x49')]=function(_0x169699,_0x4fe97f){return db[_0xba4f('0x47')][_0xba4f('0x49')](_0x169699[_0xba4f('0x4a')],{})[_0xba4f('0x24')](respondWithResult(_0x4fe97f,0xc9))[_0xba4f('0x44')](handleError(_0x4fe97f,null));};exports[_0xba4f('0x23')]=function(_0x4e265b,_0x3f0eb){if(_0x4e265b[_0xba4f('0x4a')]['id']){delete _0x4e265b[_0xba4f('0x4a')]['id'];}return db[_0xba4f('0x47')][_0xba4f('0x48')]({'where':{'id':_0x4e265b[_0xba4f('0x46')]['id']}})[_0xba4f('0x24')](handleEntityNotFound(_0x3f0eb,null))[_0xba4f('0x24')](saveUpdates(_0x4e265b[_0xba4f('0x4a')],null))[_0xba4f('0x24')](respondWithResult(_0x3f0eb,null))[_0xba4f('0x44')](handleError(_0x3f0eb,null));};exports[_0xba4f('0x25')]=function(_0x3e8938,_0x15703a){return db[_0xba4f('0x47')]['find']({'where':{'id':_0x3e8938[_0xba4f('0x46')]['id']}})['then'](handleEntityNotFound(_0x15703a,null))[_0xba4f('0x24')](removeEntity(_0x15703a,null))['catch'](handleError(_0x15703a,null));}; \ No newline at end of file +var _0xa630=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','name','send','index','FaxApplication','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','nolimit','sort','where','pick','filter','merge','options','include','findAll','rows','catch','params','keys','length','find','create','body','html-pdf','eml-format','fast-json-patch','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa630,0xbe));var _0x0a63=function(_0x3f868e,_0x44641c){_0x3f868e=_0x3f868e-0x0;var _0x587d90=_0xa630[_0x3f868e];return _0x587d90;};'use strict';var pdf=require(_0x0a63('0x0'));var emlformat=require(_0x0a63('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0a63('0x2'));var rp=require('request-promise');var moment=require(_0x0a63('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a63('0x4'));var util=require(_0x0a63('0x5'));var path=require(_0x0a63('0x6'));var sox=require(_0x0a63('0x7'));var csv=require(_0x0a63('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0a63('0x9'));var squel=require(_0x0a63('0xa'));var crypto=require(_0x0a63('0xb'));var jsforce=require(_0x0a63('0xc'));var deskjs=require(_0x0a63('0xd'));var toCsv=require(_0x0a63('0x8'));var querystring=require('querystring');var Papa=require(_0x0a63('0xe'));var Redis=require(_0x0a63('0xf'));var authService=require(_0x0a63('0x10'));var qs=require(_0x0a63('0x11'));var as=require(_0x0a63('0x12'));var hardwareService=require(_0x0a63('0x13'));var logger=require(_0x0a63('0x14'))(_0x0a63('0x15'));var utils=require(_0x0a63('0x16'));var config=require(_0x0a63('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x345f56,_0x420043){_0x420043=_0x420043||0xcc;return function(_0x2fce86){if(_0x2fce86){return _0x345f56[_0x0a63('0x18')](_0x420043);}return _0x345f56['status'](_0x420043)[_0x0a63('0x19')]();};}function respondWithResult(_0x4d68c0,_0x331e99){_0x331e99=_0x331e99||0xc8;return function(_0x19e922){if(_0x19e922){return _0x4d68c0[_0x0a63('0x1a')](_0x331e99)[_0x0a63('0x1b')](_0x19e922);}};}function respondWithFilteredResult(_0x3ea3bb,_0x23b49d){return function(_0x552b1f){if(_0x552b1f){var _0x1e3251=_0x552b1f[_0x0a63('0x1c')],_0x524a98=_0x23b49d[_0x0a63('0x1d')],_0x47788e=_0x23b49d[_0x0a63('0x1d')]+_0x23b49d[_0x0a63('0x1e')],_0x56b314;if(_0x47788e>=_0x1e3251){_0x47788e=_0x1e3251;_0x56b314=0xc8;}else{_0x56b314=0xce;}_0x3ea3bb[_0x0a63('0x1a')](_0x56b314);return _0x3ea3bb[_0x0a63('0x1f')](_0x0a63('0x20'),_0x524a98+'-'+_0x47788e+'/'+_0x1e3251)[_0x0a63('0x1b')](_0x552b1f);}return null;};}function patchUpdates(_0x2fd06c){return function(_0x3cc74d){try{jsonpatch[_0x0a63('0x21')](_0x3cc74d,_0x2fd06c,!![]);}catch(_0x4ea56f){return BPromise['reject'](_0x4ea56f);}return _0x3cc74d[_0x0a63('0x22')]();};}function saveUpdates(_0x586190,_0x2fc87c){return function(_0x5937df){if(_0x5937df){return _0x5937df[_0x0a63('0x23')](_0x586190)[_0x0a63('0x24')](function(_0x145625){return _0x145625;});}return null;};}function removeEntity(_0x46b968,_0x5da46b){return function(_0x398a16){if(_0x398a16){return _0x398a16['destroy']()[_0x0a63('0x24')](function(){_0x46b968[_0x0a63('0x1a')](0xcc)[_0x0a63('0x19')]();});}};}function handleEntityNotFound(_0x20c114,_0x343273){return function(_0x1f929f){if(!_0x1f929f){_0x20c114[_0x0a63('0x18')](0x194);}return _0x1f929f;};}function handleError(_0x53c6e3,_0x567017){_0x567017=_0x567017||0x1f4;return function(_0x5e5987){logger['error'](_0x5e5987['stack']);if(_0x5e5987[_0x0a63('0x25')]){delete _0x5e5987['name'];}_0x53c6e3['status'](_0x567017)[_0x0a63('0x26')](_0x5e5987);};}exports[_0x0a63('0x27')]=function(_0x362d6a,_0x2e2526){var _0x52e7ef={},_0x402692={},_0x498371={'count':0x0,'rows':[]};var _0x25ab82=_['map'](db[_0x0a63('0x28')][_0x0a63('0x29')],function(_0x1b7bdb){return{'name':_0x1b7bdb[_0x0a63('0x2a')],'type':_0x1b7bdb[_0x0a63('0x2b')][_0x0a63('0x2c')]};});_0x402692[_0x0a63('0x2d')]=_[_0x0a63('0x2e')](_0x25ab82,'name');_0x402692[_0x0a63('0x2f')]=_['keys'](_0x362d6a[_0x0a63('0x2f')]);_0x402692[_0x0a63('0x30')]=_[_0x0a63('0x31')](_0x402692[_0x0a63('0x2d')],_0x402692[_0x0a63('0x2f')]);_0x52e7ef['attributes']=_[_0x0a63('0x31')](_0x402692[_0x0a63('0x2d')],qs[_0x0a63('0x32')](_0x362d6a[_0x0a63('0x2f')]['fields']));_0x52e7ef[_0x0a63('0x33')]=_0x52e7ef[_0x0a63('0x33')]['length']?_0x52e7ef['attributes']:_0x402692[_0x0a63('0x2d')];if(!_0x362d6a['query']['hasOwnProperty'](_0x0a63('0x34'))){_0x52e7ef[_0x0a63('0x1e')]=qs['limit'](_0x362d6a[_0x0a63('0x2f')][_0x0a63('0x1e')]);_0x52e7ef[_0x0a63('0x1d')]=qs[_0x0a63('0x1d')](_0x362d6a[_0x0a63('0x2f')]['offset']);}_0x52e7ef['order']=qs[_0x0a63('0x35')](_0x362d6a[_0x0a63('0x2f')][_0x0a63('0x35')]);_0x52e7ef[_0x0a63('0x36')]=qs[_0x0a63('0x30')](_[_0x0a63('0x37')](_0x362d6a['query'],_0x402692[_0x0a63('0x30')]));if(_0x362d6a[_0x0a63('0x2f')]['filter']){_0x52e7ef[_0x0a63('0x36')]=_['merge'](_0x52e7ef['where'],{'$or':_[_0x0a63('0x2e')](_0x25ab82,function(_0x232388){if(_0x232388[_0x0a63('0x2b')]!=='VIRTUAL'){var _0x209447={};_0x209447[_0x232388[_0x0a63('0x25')]]={'$like':'%'+_0x362d6a[_0x0a63('0x2f')][_0x0a63('0x38')]+'%'};return _0x209447;}})});}_0x52e7ef=_[_0x0a63('0x39')]({},_0x52e7ef,_0x362d6a[_0x0a63('0x3a')]);var _0x604a45={'where':_0x52e7ef['where']};return db[_0x0a63('0x28')][_0x0a63('0x1c')](_0x604a45)[_0x0a63('0x24')](function(_0x53d034){_0x498371['count']=_0x53d034;if(_0x362d6a[_0x0a63('0x2f')]['includeAll']){_0x52e7ef[_0x0a63('0x3b')]=[{'all':!![]}];}return db[_0x0a63('0x28')][_0x0a63('0x3c')](_0x52e7ef);})['then'](function(_0x2af987){_0x498371[_0x0a63('0x3d')]=_0x2af987;return _0x498371;})[_0x0a63('0x24')](respondWithFilteredResult(_0x2e2526,_0x52e7ef))[_0x0a63('0x3e')](handleError(_0x2e2526,null));};exports['show']=function(_0x1e3b70,_0x236617){var _0x4234cd={'raw':!![],'where':{'id':_0x1e3b70[_0x0a63('0x3f')]['id']}},_0x2ccd99={};_0x2ccd99[_0x0a63('0x2d')]=_['keys'](db[_0x0a63('0x28')][_0x0a63('0x29')]);_0x2ccd99[_0x0a63('0x2f')]=_[_0x0a63('0x40')](_0x1e3b70[_0x0a63('0x2f')]);_0x2ccd99[_0x0a63('0x30')]=_[_0x0a63('0x31')](_0x2ccd99[_0x0a63('0x2d')],_0x2ccd99[_0x0a63('0x2f')]);_0x4234cd[_0x0a63('0x33')]=_[_0x0a63('0x31')](_0x2ccd99[_0x0a63('0x2d')],qs[_0x0a63('0x32')](_0x1e3b70[_0x0a63('0x2f')][_0x0a63('0x32')]));_0x4234cd[_0x0a63('0x33')]=_0x4234cd[_0x0a63('0x33')][_0x0a63('0x41')]?_0x4234cd['attributes']:_0x2ccd99[_0x0a63('0x2d')];if(_0x1e3b70['query']['includeAll']){_0x4234cd[_0x0a63('0x3b')]=[{'all':!![]}];}_0x4234cd=_[_0x0a63('0x39')]({},_0x4234cd,_0x1e3b70[_0x0a63('0x3a')]);return db[_0x0a63('0x28')][_0x0a63('0x42')](_0x4234cd)[_0x0a63('0x24')](handleEntityNotFound(_0x236617,null))[_0x0a63('0x24')](respondWithResult(_0x236617,null))[_0x0a63('0x3e')](handleError(_0x236617,null));};exports[_0x0a63('0x43')]=function(_0xf00c9a,_0x9e5009){return db[_0x0a63('0x28')][_0x0a63('0x43')](_0xf00c9a[_0x0a63('0x44')],{})[_0x0a63('0x24')](respondWithResult(_0x9e5009,0xc9))[_0x0a63('0x3e')](handleError(_0x9e5009,null));};exports[_0x0a63('0x23')]=function(_0x20b864,_0x366887){if(_0x20b864[_0x0a63('0x44')]['id']){delete _0x20b864['body']['id'];}return db[_0x0a63('0x28')][_0x0a63('0x42')]({'where':{'id':_0x20b864['params']['id']}})['then'](handleEntityNotFound(_0x366887,null))['then'](saveUpdates(_0x20b864['body'],null))[_0x0a63('0x24')](respondWithResult(_0x366887,null))[_0x0a63('0x3e')](handleError(_0x366887,null));};exports['destroy']=function(_0x1abf0b,_0x59c367){return db[_0x0a63('0x28')][_0x0a63('0x42')]({'where':{'id':_0x1abf0b['params']['id']}})['then'](handleEntityNotFound(_0x59c367,null))['then'](removeEntity(_0x59c367,null))[_0x0a63('0x3e')](handleError(_0x59c367,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index fb11dc8..ee4751b 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 _0xf3ee=['lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./faxApplication.attributes','FaxApplication','fax_applications','utf8mb4_unicode_ci'];(function(_0x1daaa9,_0x220393){var _0x1dd221=function(_0x492c61){while(--_0x492c61){_0x1daaa9['push'](_0x1daaa9['shift']());}};_0x1dd221(++_0x220393);}(_0xf3ee,0x108));var _0xef3e=function(_0x4748d1,_0x3a538e){_0x4748d1=_0x4748d1-0x0;var _0x23bfab=_0xf3ee[_0x4748d1];return _0x23bfab;};'use strict';var _=require(_0xef3e('0x0'));var util=require(_0xef3e('0x1'));var logger=require('../../config/logger')(_0xef3e('0x2'));var moment=require('moment');var BPromise=require(_0xef3e('0x3'));var rp=require(_0xef3e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xef3e('0x5'));var config=require(_0xef3e('0x6'));var attributes=require(_0xef3e('0x7'));module['exports']=function(_0x12000d,_0x4b3954){return _0x12000d['define'](_0xef3e('0x8'),attributes,{'tableName':_0xef3e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xef3e('0xa')});}; \ No newline at end of file +var _0xd04f=['utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxApplication.attributes','exports','define','fax_applications','utf8mb4'];(function(_0x376d3f,_0x365cd6){var _0x48ce24=function(_0xac5587){while(--_0xac5587){_0x376d3f['push'](_0x376d3f['shift']());}};_0x48ce24(++_0x365cd6);}(_0xd04f,0xd3));var _0xfd04=function(_0x36e525,_0x45d1fa){_0x36e525=_0x36e525-0x0;var _0x472084=_0xd04f[_0x36e525];return _0x472084;};'use strict';var _=require(_0xfd04('0x0'));var util=require('util');var logger=require(_0xfd04('0x1'))(_0xfd04('0x2'));var moment=require(_0xfd04('0x3'));var BPromise=require(_0xfd04('0x4'));var rp=require(_0xfd04('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfd04('0x6'));var config=require(_0xfd04('0x7'));var attributes=require(_0xfd04('0x8'));module[_0xfd04('0x9')]=function(_0x2ffc5c,_0x3bb67d){return _0x2ffc5c[_0xfd04('0xa')]('FaxApplication',attributes,{'tableName':_0xfd04('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfd04('0xc'),'collate':_0xfd04('0xd')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 40b588e..c158a59 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 _0xff1f=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','FaxApplication','body','raw','options','attributes','UpdateFaxApplication','catch','lodash','util'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0xff1f,0xd0));var _0xfff1=function(_0x53fe97,_0x544271){_0x53fe97=_0x53fe97-0x0;var _0x5c49a2=_0xff1f[_0x53fe97];return _0x5c49a2;};'use strict';var _=require(_0xfff1('0x0'));var util=require(_0xfff1('0x1'));var moment=require(_0xfff1('0x2'));var BPromise=require('bluebird');var rs=require(_0xfff1('0x3'));var fs=require('fs');var Redis=require(_0xfff1('0x4'));var db=require(_0xfff1('0x5'))['db'];var utils=require(_0xfff1('0x6'));var logger=require(_0xfff1('0x7'))(_0xfff1('0x8'));var config=require('../../config/environment');var jayson=require(_0xfff1('0x9'));var client=jayson[_0xfff1('0xa')][_0xfff1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xed3d34,_0x15c012,_0x1b2bbc){return new BPromise(function(_0x51190d,_0x1b6f24){return client[_0xfff1('0xc')](_0xed3d34,_0x1b2bbc)[_0xfff1('0xd')](function(_0xce0b8d){logger[_0xfff1('0xe')](_0xfff1('0xf'),_0x15c012,'request\x20sent');logger[_0xfff1('0x10')](_0xfff1('0x11'),_0x15c012,_0xfff1('0x12'),JSON[_0xfff1('0x13')](_0xce0b8d));if(_0xce0b8d[_0xfff1('0x14')]){if(_0xce0b8d[_0xfff1('0x14')][_0xfff1('0x15')]===0x1f4){logger[_0xfff1('0x14')](_0xfff1('0xf'),_0x15c012,_0xce0b8d[_0xfff1('0x14')][_0xfff1('0x16')]);return _0x1b6f24(_0xce0b8d['error'][_0xfff1('0x16')]);}logger[_0xfff1('0x14')](_0xfff1('0xf'),_0x15c012,_0xce0b8d[_0xfff1('0x14')]['message']);return _0x51190d(_0xce0b8d[_0xfff1('0x14')][_0xfff1('0x16')]);}else{logger[_0xfff1('0xe')](_0xfff1('0xf'),_0x15c012,'request\x20sent');_0x51190d(_0xce0b8d['result'][_0xfff1('0x16')]);}})['catch'](function(_0x1187d1){logger[_0xfff1('0x14')]('FaxApplication,\x20%s,\x20%s',_0x15c012,_0x1187d1);_0x1b6f24(_0x1187d1);});});}exports['UpdateFaxApplication']=function(_0x477cc5){var _0x2e7667=this;return new Promise(function(_0x342500,_0x86db6){return db[_0xfff1('0x17')]['update'](_0x477cc5[_0xfff1('0x18')],{'raw':_0x477cc5['options']?_0x477cc5['options'][_0xfff1('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x477cc5[_0xfff1('0x1a')]?_0x477cc5[_0xfff1('0x1a')]['where']||null:null,'attributes':_0x477cc5['options']?_0x477cc5[_0xfff1('0x1a')][_0xfff1('0x1b')]||null:null,'limit':_0x477cc5[_0xfff1('0x1a')]?_0x477cc5[_0xfff1('0x1a')]['limit']||null:null})['then'](function(_0x1c318c){logger[_0xfff1('0xe')](_0xfff1('0x1c'),_0x477cc5);logger[_0xfff1('0x10')](_0xfff1('0x1c'),_0x477cc5,JSON[_0xfff1('0x13')](_0x1c318c));_0x342500(_0x1c318c);})[_0xfff1('0x1d')](function(_0xb5b4a7){logger[_0xfff1('0x14')](_0xfff1('0x1c'),_0xb5b4a7['message'],_0x477cc5);_0x86db6(_0x2e7667['error'](0x1f4,_0xb5b4a7[_0xfff1('0x16')]));});});}; \ No newline at end of file +var _0xae24=['../../config/environment','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','body','options','where','attributes','limit','stringify','util','moment','bluebird','../../mysqldb','../../config/utils','rpc'];(function(_0x427568,_0x32e4a0){var _0x14f3ae=function(_0xad4afd){while(--_0xad4afd){_0x427568['push'](_0x427568['shift']());}};_0x14f3ae(++_0x32e4a0);}(_0xae24,0x72));var _0x4ae2=function(_0x407cfc,_0xdecdfd){_0x407cfc=_0x407cfc-0x0;var _0x1707ac=_0xae24[_0x407cfc];return _0x1707ac;};'use strict';var _=require('lodash');var util=require(_0x4ae2('0x0'));var moment=require(_0x4ae2('0x1'));var BPromise=require(_0x4ae2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ae2('0x3'))['db'];var utils=require(_0x4ae2('0x4'));var logger=require('../../config/logger')(_0x4ae2('0x5'));var config=require(_0x4ae2('0x6'));var jayson=require(_0x4ae2('0x7'));var client=jayson[_0x4ae2('0x8')][_0x4ae2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ff15b,_0x2a28b4,_0x4b092d){return new BPromise(function(_0x391e45,_0x48d00c){return client[_0x4ae2('0xa')](_0x2ff15b,_0x4b092d)[_0x4ae2('0xb')](function(_0x4864d8){logger[_0x4ae2('0xc')](_0x4ae2('0xd'),_0x2a28b4,_0x4ae2('0xe'));logger[_0x4ae2('0xf')](_0x4ae2('0x10'),_0x2a28b4,_0x4ae2('0xe'),JSON['stringify'](_0x4864d8));if(_0x4864d8['error']){if(_0x4864d8[_0x4ae2('0x11')][_0x4ae2('0x12')]===0x1f4){logger[_0x4ae2('0x11')](_0x4ae2('0xd'),_0x2a28b4,_0x4864d8[_0x4ae2('0x11')]['message']);return _0x48d00c(_0x4864d8['error']['message']);}logger[_0x4ae2('0x11')](_0x4ae2('0xd'),_0x2a28b4,_0x4864d8['error'][_0x4ae2('0x13')]);return _0x391e45(_0x4864d8['error']['message']);}else{logger[_0x4ae2('0xc')](_0x4ae2('0xd'),_0x2a28b4,_0x4ae2('0xe'));_0x391e45(_0x4864d8[_0x4ae2('0x14')][_0x4ae2('0x13')]);}})[_0x4ae2('0x15')](function(_0x1e8b2c){logger[_0x4ae2('0x11')](_0x4ae2('0xd'),_0x2a28b4,_0x1e8b2c);_0x48d00c(_0x1e8b2c);});});}exports[_0x4ae2('0x16')]=function(_0x5e3e7f){var _0x3b278c=this;return new Promise(function(_0x5bbb21,_0x3b6897){return db[_0x4ae2('0x17')]['update'](_0x5e3e7f[_0x4ae2('0x18')],{'raw':_0x5e3e7f[_0x4ae2('0x19')]?_0x5e3e7f['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e3e7f[_0x4ae2('0x19')]?_0x5e3e7f[_0x4ae2('0x19')][_0x4ae2('0x1a')]||null:null,'attributes':_0x5e3e7f[_0x4ae2('0x19')]?_0x5e3e7f['options'][_0x4ae2('0x1b')]||null:null,'limit':_0x5e3e7f['options']?_0x5e3e7f[_0x4ae2('0x19')][_0x4ae2('0x1c')]||null:null})[_0x4ae2('0xb')](function(_0x7d563b){logger[_0x4ae2('0xc')](_0x4ae2('0x16'),_0x5e3e7f);logger[_0x4ae2('0xf')](_0x4ae2('0x16'),_0x5e3e7f,JSON[_0x4ae2('0x1d')](_0x7d563b));_0x5bbb21(_0x7d563b);})[_0x4ae2('0x15')](function(_0x3c454e){logger[_0x4ae2('0x11')](_0x4ae2('0x16'),_0x3c454e[_0x4ae2('0x13')],_0x5e3e7f);_0x3b6897(_0x3b278c[_0x4ae2('0x11')](0x1f4,_0x3c454e['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index b540349..505fcc5 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 _0x7c09=['update','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','/:id','isAuthenticated','show','post','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7c09,0x102));var _0x97c0=function(_0x360793,_0x5b20c9){_0x360793=_0x360793-0x0;var _0x1efcd0=_0x7c09[_0x360793];return _0x1efcd0;};'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('0xc')]('/',auth[_0x97c0('0xa')](),controller['create']);router[_0x97c0('0xd')]('/:id',auth[_0x97c0('0xa')](),controller[_0x97c0('0xe')]);router['delete']('/:id',auth[_0x97c0('0xa')](),controller[_0x97c0('0xf')]);module[_0x97c0('0x10')]=router; \ No newline at end of file +var _0x038b=['update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','create','put'];(function(_0x20f288,_0x42b564){var _0x800caf=function(_0x47aa1e){while(--_0x47aa1e){_0x20f288['push'](_0x20f288['shift']());}};_0x800caf(++_0x42b564);}(_0x038b,0x114));var _0xb038=function(_0x3290a3,_0x3ed31d){_0x3290a3=_0x3290a3-0x0;var _0x514e27=_0x038b[_0x3290a3];return _0x514e27;};'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('./faxApplication.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 diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 9f3b658..f452543 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 _0x0425=['STRING','ENUM','out','sequelize','exports','BOOLEAN','DATE'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0425,0x65));var _0x5042=function(_0x2225ac,_0x21969c){_0x2225ac=_0x2225ac-0x0;var _0x40325b=_0x0425[_0x2225ac];return _0x40325b;};'use strict';var Sequelize=require(_0x5042('0x0'));module[_0x5042('0x1')]={'closed':{'type':Sequelize[_0x5042('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5042('0x3')]},'disposition':{'type':Sequelize[_0x5042('0x4')]},'note':{'type':Sequelize[_0x5042('0x4')]},'read1stAt':{'type':Sequelize[_0x5042('0x3')]},'fax':{'type':Sequelize[_0x5042('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x5042('0x5')]('in',_0x5042('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5042('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x5042('0x5')]('in',_0x5042('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x4662=['DATE','ENUM','out','sequelize','BOOLEAN'];(function(_0x39953f,_0x3fa03c){var _0x4b5178=function(_0x29f7d5){while(--_0x29f7d5){_0x39953f['push'](_0x39953f['shift']());}};_0x4b5178(++_0x3fa03c);}(_0x4662,0x1a7));var _0x2466=function(_0x461903,_0x34eb0d){_0x461903=_0x461903-0x0;var _0x1e0c59=_0x4662[_0x461903];return _0x1e0c59;};'use strict';var Sequelize=require(_0x2466('0x0'));module['exports']={'closed':{'type':Sequelize[_0x2466('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x2466('0x2')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x2466('0x3')]('in',_0x2466('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2466('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x2466('0x3')]('in',_0x2466('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 4f4c635..ed739df 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 _0x1a6e=['sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','split','forEach','Tags','push','index','FaxInteraction','fieldName','key','keys','query','filters','model','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','left_join','users','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','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','buildExpression','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','UserId','body','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','QueryTypes','clone','unreadMessages','DESC','t.id\x20IN\x20?','resolve','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','fields','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','c.email','c.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','rows','catch','params','rawAttributes','includeAll','include','options','describe','addMessage','ids','omit','findOne','FaxMessage','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','removeTags','download','unix','root','files','join','server','attachments','format','transcript-%d-%s.zip','Messages','mkdirSync','basename','createReadStream','createWriteStream','err','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path'];(function(_0x2e4576,_0x348ac1){var _0x84ebf9=function(_0x248089){while(--_0x248089){_0x2e4576['push'](_0x2e4576['shift']());}};_0x84ebf9(++_0x348ac1);}(_0x1a6e,0x193));var _0xe1a6=function(_0xda6d0f,_0x35e271){_0xda6d0f=_0xda6d0f-0x0;var _0x244540=_0x1a6e[_0xda6d0f];return _0x244540;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe1a6('0x0'));var jsonpatch=require(_0xe1a6('0x1'));var rp=require(_0xe1a6('0x2'));var moment=require(_0xe1a6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe1a6('0x4'));var util=require(_0xe1a6('0x5'));var path=require(_0xe1a6('0x6'));var sox=require(_0xe1a6('0x7'));var csv=require('to-csv');var ejs=require(_0xe1a6('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe1a6('0x9'));var crypto=require(_0xe1a6('0xa'));var jsforce=require(_0xe1a6('0xb'));var deskjs=require(_0xe1a6('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe1a6('0xd'));var Papa=require(_0xe1a6('0xe'));var Redis=require(_0xe1a6('0xf'));var authService=require(_0xe1a6('0x10'));var qs=require(_0xe1a6('0x11'));var as=require(_0xe1a6('0x12'));var hardwareService=require(_0xe1a6('0x13'));var logger=require('../../config/logger')(_0xe1a6('0x14'));var utils=require('../../config/utils');var config=require(_0xe1a6('0x15'));var db=require(_0xe1a6('0x16'))['db'];config[_0xe1a6('0x17')]=_[_0xe1a6('0x18')](config[_0xe1a6('0x17')],{'host':_0xe1a6('0x19'),'port':0x18eb});var socket=require(_0xe1a6('0x1a'))(new Redis(config['redis']));require(_0xe1a6('0x1b'))['register'](socket);function respondWithStatusCode(_0x2a0670,_0x4ef256){_0x4ef256=_0x4ef256||0xcc;return function(_0x18b820){if(_0x18b820){return _0x2a0670[_0xe1a6('0x1c')](_0x4ef256);}return _0x2a0670[_0xe1a6('0x1d')](_0x4ef256)[_0xe1a6('0x1e')]();};}function respondWithResult(_0x5279a8,_0x35f6e2){_0x35f6e2=_0x35f6e2||0xc8;return function(_0x537bc5){if(_0x537bc5){return _0x5279a8[_0xe1a6('0x1d')](_0x35f6e2)[_0xe1a6('0x1f')](_0x537bc5);}};}function respondWithFilteredResult(_0xe197f5,_0x2bbe01){return function(_0x2eb5b2){if(_0x2eb5b2){var _0x2a9de7=_0x2eb5b2[_0xe1a6('0x20')],_0x5ba228=_0x2bbe01[_0xe1a6('0x21')],_0x5a898e=_0x2bbe01[_0xe1a6('0x21')]+_0x2bbe01[_0xe1a6('0x22')],_0x320456;if(_0x5a898e>=_0x2a9de7){_0x5a898e=_0x2a9de7;_0x320456=0xc8;}else{_0x320456=0xce;}_0xe197f5[_0xe1a6('0x1d')](_0x320456);return _0xe197f5[_0xe1a6('0x23')](_0xe1a6('0x24'),_0x5ba228+'-'+_0x5a898e+'/'+_0x2a9de7)['json'](_0x2eb5b2);}return null;};}function patchUpdates(_0x2fd577){return function(_0x3e2595){try{jsonpatch[_0xe1a6('0x25')](_0x3e2595,_0x2fd577,!![]);}catch(_0x1d3930){return BPromise[_0xe1a6('0x26')](_0x1d3930);}return _0x3e2595['save']();};}function saveUpdates(_0x58b859,_0x4d14f1){return function(_0x541368){if(_0x541368){return _0x541368[_0xe1a6('0x27')](_0x58b859)[_0xe1a6('0x28')](function(_0x547635){return _0x547635;});}return null;};}function removeEntity(_0x22b24e,_0x40bae0){return function(_0x392242){if(_0x392242){return _0x392242[_0xe1a6('0x29')]()[_0xe1a6('0x28')](function(){_0x22b24e[_0xe1a6('0x1d')](0xcc)[_0xe1a6('0x1e')]();});}};}function handleEntityNotFound(_0x24a4f5,_0x25bc53){return function(_0x4305ec){if(!_0x4305ec){_0x24a4f5[_0xe1a6('0x1c')](0x194);}return _0x4305ec;};}function handleError(_0x2c282d,_0xba56df){_0xba56df=_0xba56df||0x1f4;return function(_0xc33d9){logger[_0xe1a6('0x2a')](_0xc33d9[_0xe1a6('0x2b')]);if(_0xc33d9[_0xe1a6('0x2c')]){delete _0xc33d9[_0xe1a6('0x2c')];}_0x2c282d[_0xe1a6('0x1d')](_0xba56df)[_0xe1a6('0x2d')](_0xc33d9);};}function getInteractionUsers(_0x40f37a,_0x2dfeac){return new BPromise(function(_0x586d77,_0x12818e){try{if(_0x2dfeac[_0x40f37a['id']]){_0x40f37a[_0xe1a6('0x2e')]=_[_0xe1a6('0x2f')](_0x2dfeac[_0x40f37a['id']],function(_0x1c5f62){return{'id':_0x1c5f62['id'],'fullname':_0x1c5f62[_0xe1a6('0x30')]};});}}catch(_0x46347d){_0x12818e(_0x46347d);}_0x586d77(_0x40f37a);});}function getInteractionTags(_0x3fd900,_0x49fc8e){return new BPromise(function(_0x46dd6b,_0x1bd7b5){try{if(_0x3fd900[_0xe1a6('0x31')]){_0x3fd900['Tags']=[];_0x3fd900['TagIds'][_0xe1a6('0x32')](',')[_0xe1a6('0x33')](function(_0x3d57f7){_0x3fd900[_0xe1a6('0x34')][_0xe1a6('0x35')](_0x49fc8e[_0x3d57f7]);});}delete _0x3fd900[_0xe1a6('0x31')];}catch(_0x371320){_0x1bd7b5(_0x371320);}_0x46dd6b(_0x3fd900);});}function updateFaxInteraction(_0x3db2a0,_0x37785a,_0x53bf1b){return new BPromise(function(_0x19962b,_0x136f4b){return getInteractionUsers(_0x3db2a0,_0x53bf1b)[_0xe1a6('0x28')](function(_0x3115df){return getInteractionTags(_0x3115df,_0x37785a);})[_0xe1a6('0x28')](function(_0x2ebfe6){_0x19962b(_0x2ebfe6);})['catch'](function(_0x24dc54){_0x136f4b(_0x24dc54);});});}exports[_0xe1a6('0x36')]=function(_0x1ca367,_0x34a59e){var _0x11350a={},_0x5261c8={},_0x2beed0={'count':0x0,'rows':[]};var _0x58e833=_[_0xe1a6('0x2f')](db[_0xe1a6('0x37')]['rawAttributes'],function(_0xaead8f){return{'name':_0xaead8f[_0xe1a6('0x38')],'type':_0xaead8f['type'][_0xe1a6('0x39')]};});_0x5261c8['model']=_[_0xe1a6('0x2f')](_0x58e833,_0xe1a6('0x2c'));_0x5261c8['query']=_[_0xe1a6('0x3a')](_0x1ca367[_0xe1a6('0x3b')]);_0x5261c8[_0xe1a6('0x3c')]=_['intersection'](_0x5261c8[_0xe1a6('0x3d')],_0x5261c8[_0xe1a6('0x3b')]);_0x11350a[_0xe1a6('0x3e')]=_[_0xe1a6('0x3f')](_0x5261c8[_0xe1a6('0x3d')],qs['fields'](_0x1ca367[_0xe1a6('0x3b')]['fields']));_0x11350a['attributes']=_0x11350a[_0xe1a6('0x3e')][_0xe1a6('0x40')]?_0x11350a[_0xe1a6('0x3e')]:_0x5261c8[_0xe1a6('0x3d')];if(!_0x1ca367[_0xe1a6('0x3b')][_0xe1a6('0x41')](_0xe1a6('0x42'))){_0x11350a[_0xe1a6('0x22')]=qs[_0xe1a6('0x22')](_0x1ca367[_0xe1a6('0x3b')][_0xe1a6('0x22')]);_0x11350a[_0xe1a6('0x21')]=qs[_0xe1a6('0x21')](_0x1ca367['query'][_0xe1a6('0x21')]);}_0x11350a[_0xe1a6('0x43')]=qs[_0xe1a6('0x44')](_0x1ca367[_0xe1a6('0x3b')][_0xe1a6('0x44')]);_0x11350a[_0xe1a6('0x45')]=qs[_0xe1a6('0x3c')](_[_0xe1a6('0x46')](_0x1ca367['query'],_0x5261c8['filters']));var _0x384cde=[];var _0x112821=squel[_0xe1a6('0x47')]()[_0xe1a6('0x48')]('id')[_0xe1a6('0x48')](_0xe1a6('0x2c'))[_0xe1a6('0x48')](_0xe1a6('0x49'))[_0xe1a6('0x4a')](_0xe1a6('0x4b'));var _0xff4fa9=squel[_0xe1a6('0x47')]()[_0xe1a6('0x48')](_0xe1a6('0x4c'))[_0xe1a6('0x48')](_0xe1a6('0x4d'))[_0xe1a6('0x48')](_0xe1a6('0x4e'))['from']('user_has_fax_interactions','ui')[_0xe1a6('0x4f')](_0xe1a6('0x50'),'u','u.id\x20=\x20ui.UserId');var _0x2d3544=squel[_0xe1a6('0x47')]()['from'](_0xe1a6('0x51'),'i')[_0xe1a6('0x4f')](_0xe1a6('0x52'),'c',_0xe1a6('0x53'))['left_join'](_0xe1a6('0x50'),'o','o.id\x20=\x20i.UserId')['left_join'](_0xe1a6('0x54'),'a',_0xe1a6('0x55'))[_0xe1a6('0x4f')](_0xe1a6('0x56'),'me',_0xe1a6('0x57'))[_0xe1a6('0x4f')]('fax_interaction_has_tags','it',_0xe1a6('0x58'))[_0xe1a6('0x4f')](_0xe1a6('0x4b'),'t',_0xe1a6('0x59'));var _0x231f8b=squel[_0xe1a6('0x5a')]();var _0x281948=[];var _0x363ff6=squel[_0xe1a6('0x5a')]();var _0x492c87;if(_0x1ca367[_0xe1a6('0x3b')]['search']){_0x492c87=as[_0xe1a6('0x5b')](_0x1ca367[_0xe1a6('0x3b')][_0xe1a6('0x5c')]);var _0x369b12=_0x492c87[_0xe1a6('0x5d')];for(var _0x7d89eb=0x0;_0x7d89eb<_0x492c87[_0xe1a6('0x5e')][_0xe1a6('0x40')];_0x7d89eb++){var _0x2f544a=_0x492c87[_0xe1a6('0x5e')][_0x7d89eb];var _0x5ce466='i';var _0x3867af=_[_0xe1a6('0x5f')](_0x58e833,['name',_0x2f544a[_0xe1a6('0x48')]]);if(!_0x3867af){switch(_0x2f544a[_0xe1a6('0x48')]){case'unreadMessages':if(_0x2f544a[_0xe1a6('0x60')]==0x1){_0x2d3544[_0xe1a6('0x61')]('`'+_0x2f544a[_0xe1a6('0x48')]+_0xe1a6('0x62'));}else{_0x2d3544['having']('`'+_0x2f544a['field']+_0xe1a6('0x63'));}break;case _0xe1a6('0x64'):if(_0x2f544a['operator']===_0xe1a6('0x65')){if(_0x2f544a[_0xe1a6('0x60')][_0xe1a6('0x32')]('\x20')['length']>0x1){_0x231f8b[_0x369b12](_0xe1a6('0x66'),qs[_0xe1a6('0x67')](_0x2f544a['value']),null);}else{var _0x9e806d='%'+_0x2f544a['value']+'%';_0x231f8b[_0x369b12]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x9e806d,_0x9e806d,_0x9e806d);}}else{_0x3867af=_[_0xe1a6('0x5f')](_0x58e833,[_0xe1a6('0x2c'),_0xe1a6('0x68')]);_0x2f544a['field']=_0xe1a6('0x68');_0x226369=as[_0xe1a6('0x69')](_0x5ce466,_0x3867af[_0xe1a6('0x6a')],_0x2f544a);_0x231f8b[_0x369b12](_0x226369[_0xe1a6('0x6b')],_0x226369[_0xe1a6('0x60')][_0xe1a6('0x6c')],_0x226369[_0xe1a6('0x60')][_0xe1a6('0x1e')]);}break;case _0xe1a6('0x6d'):var _0x395aad=_0x2f544a['value'][_0xe1a6('0x32')](',')[_0xe1a6('0x2f')](function(_0x26067b){return Number(_0x26067b);});_0x395aad[_0xe1a6('0x33')](function(_0x3c0f13){_0x363ff6['or'](_0xe1a6('0x6e'),'%,'+_0x3c0f13+',%');});_0x281948=_[_0xe1a6('0x6f')](_0x281948,_0x395aad);break;case _0xe1a6('0x70'):if(_0x2f544a[_0xe1a6('0x71')]===_0xe1a6('0x65')){_0x231f8b[_0x369b12]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x2f544a[_0xe1a6('0x60')]+'%',null);}else{_0x3867af=_[_0xe1a6('0x5f')](_0x58e833,['name',_0xe1a6('0x72')]);_0x2f544a['field']='UserId';_0x226369=as[_0xe1a6('0x69')](_0x5ce466,_0x3867af[_0xe1a6('0x6a')],_0x2f544a);_0x231f8b[_0x369b12](_0x226369[_0xe1a6('0x6b')],_0x226369[_0xe1a6('0x60')][_0xe1a6('0x6c')],_0x226369['value']['end']);}break;case _0xe1a6('0x73'):_0x226369=as[_0xe1a6('0x69')]('me',null,_0x2f544a);_0x231f8b[_0x369b12](_0x226369[_0xe1a6('0x6b')],_0x226369['value'][_0xe1a6('0x6c')],_0x226369[_0xe1a6('0x60')]['end']);break;}}else{var _0x226369=as[_0xe1a6('0x69')](_0x5ce466,_0x3867af[_0xe1a6('0x6a')],_0x2f544a);_0x231f8b[_0x369b12](_0x226369[_0xe1a6('0x6b')],_0x226369[_0xe1a6('0x60')][_0xe1a6('0x6c')],_0x226369[_0xe1a6('0x60')][_0xe1a6('0x1e')]);}}}else{var _0xfe2710=_(_0x1ca367['query'])[_0xe1a6('0x3a')]()['map'](function(_0x103214){return _['some'](_0x58e833,[_0xe1a6('0x2c'),_0x103214])?_0x103214:undefined;})['compact']()[_0xe1a6('0x60')]();if(!_[_0xe1a6('0x74')](_0xfe2710)){_0xfe2710[_0xe1a6('0x33')](function(_0x437af4){if(_0x437af4===_0xe1a6('0x75')){_0x2d3544[_0xe1a6('0x45')](_0xe1a6('0x76'),[]['concat'](_0x1ca367[_0xe1a6('0x3b')][_0x437af4]));}else if(_0x437af4===_0xe1a6('0x77')){var _0x113430=JSON[_0xe1a6('0x78')](_0x1ca367[_0xe1a6('0x3b')][_0x437af4])[_0xe1a6('0x79')];var _0x127a9a=JSON[_0xe1a6('0x78')](_0x1ca367[_0xe1a6('0x3b')][_0x437af4])[_0xe1a6('0x7a')];_0x2d3544[_0xe1a6('0x45')](_0xe1a6('0x7b'),_0x113430,_0x127a9a);}else{if(_0x1ca367[_0xe1a6('0x3b')][_0x437af4]===_0xe1a6('0x7c')){_0x2d3544['where']('i.'+_0x437af4+_0xe1a6('0x7d'));}else{_0x2d3544[_0xe1a6('0x45')]('i.'+_0x437af4+_0xe1a6('0x7e'),_0x1ca367[_0xe1a6('0x3b')][_0x437af4]);}}});}if(_0x1ca367[_0xe1a6('0x3b')][_0xe1a6('0x7f')]){if(_0x1ca367['query'][_0xe1a6('0x7f')]==0x1){_0x2d3544[_0xe1a6('0x61')]('`unreadMessages`\x20=\x200');}else{_0x2d3544['having'](_0xe1a6('0x80'));}}if(_0x1ca367[_0xe1a6('0x3b')][_0xe1a6('0x81')]){_0x281948=_[_0xe1a6('0x82')](_0x1ca367[_0xe1a6('0x3b')][_0xe1a6('0x81')])?_0x1ca367['query'][_0xe1a6('0x81')]:new Array(_0x1ca367[_0xe1a6('0x3b')][_0xe1a6('0x81')]);_0x281948['forEach'](function(_0x2cae14){_0x363ff6['or'](_0xe1a6('0x6e'),'%,'+_0x2cae14+',%');});}if(_0x1ca367[_0xe1a6('0x3b')][_0xe1a6('0x83')]){var _0x479f8d=_0x1ca367['query'][_0xe1a6('0x83')]['replace']('\x5c','\x5c\x5c')[_0xe1a6('0x84')]('\x27\x27',_0xe1a6('0x85'));if(qs[_0xe1a6('0x86')](_0x479f8d)){_0x231f8b['or'](_0xe1a6('0x87'),_0x479f8d+'%')['or'](_0xe1a6('0x88'),_0x479f8d+'%');}_0x231f8b['or'](_0xe1a6('0x89'),_0x479f8d+'%');}}_0x2d3544['where'](_0x231f8b);_0x2d3544['group'](_0xe1a6('0x8a'));var _0x3a7ff4={'type':db['Sequelize'][_0xe1a6('0x8b')]['SELECT'],'raw':!![]};var _0x52ff2e=_0x2d3544[_0xe1a6('0x8c')]();_0x52ff2e['field']('i.id');_0x52ff2e[_0xe1a6('0x48')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xe1a6('0x8d'));if(_0x11350a[_0xe1a6('0x43')]){_0x11350a[_0xe1a6('0x43')]['forEach'](function(_0x29acb4){_0x2d3544[_0xe1a6('0x43')]('i.'+_0x29acb4[0x0],_0x29acb4[0x1]===_0xe1a6('0x8e')?![]:!![]);});}if(!_[_0xe1a6('0x74')](_0x281948)){_0x2d3544[_0xe1a6('0x61')](_0x363ff6);_0x52ff2e[_0xe1a6('0x45')](_0xe1a6('0x8f'),_0x281948);}BPromise[_0xe1a6('0x90')]()[_0xe1a6('0x28')](function(){if(!_0x492c87){if(_0x1ca367[_0xe1a6('0x3b')][_0xe1a6('0x75')]||_0x1ca367['query'][_0xe1a6('0x91')])return;_0x52ff2e['where'](_0xe1a6('0x92'));_0x2d3544[_0xe1a6('0x45')](_0xe1a6('0x92'));return;}return _0x1ca367[_0xe1a6('0x93')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0xe1a6('0x28')](function(_0x4fc312){if(_[_0xe1a6('0x74')](_0x4fc312)){_0x52ff2e[_0xe1a6('0x45')]('i.FaxAccountId\x20IS\x20NULL');_0x2d3544[_0xe1a6('0x45')](_0xe1a6('0x94'));}else{_0x52ff2e[_0xe1a6('0x45')](_0xe1a6('0x76'),_[_0xe1a6('0x2f')](_0x4fc312,'id'));_0x2d3544[_0xe1a6('0x45')](_0xe1a6('0x76'),_['map'](_0x4fc312,'id'));}});})[_0xe1a6('0x28')](function(){db[_0xe1a6('0x95')][_0xe1a6('0x3b')](_0x52ff2e[_0xe1a6('0x96')](),_0x3a7ff4)[_0xe1a6('0x28')](function(_0x7d03e3){_0x2beed0[_0xe1a6('0x20')]=_0x7d03e3[_0xe1a6('0x40')];if(_0x2beed0[_0xe1a6('0x20')]===0x0)return[];return db['sequelize'][_0xe1a6('0x3b')](_0x112821['toString'](),_0x3a7ff4)[_0xe1a6('0x28')](function(_0x5d02bb){_0x384cde=_[_0xe1a6('0x97')](_0x5d02bb,'id');_0x3a7ff4=_[_0xe1a6('0x98')](_0x3a7ff4,{'model':db[_0xe1a6('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1ca367['query'][_0xe1a6('0x99')]){_0x11350a[_0xe1a6('0x3e')]['forEach'](function(_0x2fc548){_0x2d3544[_0xe1a6('0x48')]('i.'+_0x2fc548);});}else{_0x2d3544[_0xe1a6('0x48')](_0xe1a6('0x9a'),_0xe1a6('0x8d'));_0x2d3544[_0xe1a6('0x48')](_0xe1a6('0x9b'),_0xe1a6('0x9c'));_0x2d3544[_0xe1a6('0x48')](_0xe1a6('0x9d'),_0xe1a6('0x9e'));_0x2d3544[_0xe1a6('0x48')](_0xe1a6('0x9f'));_0x2d3544[_0xe1a6('0x48')]('c.firstName',_0xe1a6('0xa0'));_0x2d3544['field'](_0xe1a6('0xa1'),'Contact.lastName');_0x2d3544['field'](_0xe1a6('0xa2'),'Contact.email');_0x2d3544[_0xe1a6('0x48')](_0xe1a6('0xa3'),'Contact.phone');_0x2d3544[_0xe1a6('0x48')](_0xe1a6('0xa4'),_0xe1a6('0xa5'));_0x2d3544['field']('c.fax',_0xe1a6('0xa6'));_0x2d3544[_0xe1a6('0x48')](_0xe1a6('0xa7'),_0xe1a6('0xa8'));_0x2d3544['field']('o.internal','Owner.internal');_0x2d3544[_0xe1a6('0x48')](_0xe1a6('0xa9'),_0xe1a6('0x31'));}_0x2d3544[_0xe1a6('0x22')](_0x11350a[_0xe1a6('0x22')]);_0x2d3544['offset'](_0x11350a[_0xe1a6('0x21')]);return db[_0xe1a6('0x95')][_0xe1a6('0x3b')](_0x2d3544[_0xe1a6('0x96')](),_0x3a7ff4);})['then'](function(_0x2f674f){_0xff4fa9[_0xe1a6('0x45')](_0xe1a6('0xaa'),_[_0xe1a6('0x2f')](_0x2f674f,'id'));return db[_0xe1a6('0x95')]['query'](_0xff4fa9[_0xe1a6('0x96')](),_0x3a7ff4)[_0xe1a6('0x28')](function(_0xfb1705){var _0x3e74a4=_[_0xe1a6('0xab')](_0xfb1705,_0xe1a6('0xac'));var _0x353487=[];_0x2f674f[_0xe1a6('0x33')](function(_0x66767){_0x353487[_0xe1a6('0x35')](updateFaxInteraction(_0x66767,_0x384cde,_0x3e74a4));});return BPromise['all'](_0x353487);});});})['then'](function(_0x3d7f0e){_0x2beed0[_0xe1a6('0xad')]=_0x3d7f0e;return _0x2beed0;})[_0xe1a6('0x28')](respondWithFilteredResult(_0x34a59e,_0x11350a));})[_0xe1a6('0xae')](handleError(_0x34a59e,null));};exports['show']=function(_0x45e016,_0x27c3c2){var _0x3bea45={'raw':![],'where':{'id':_0x45e016[_0xe1a6('0xaf')]['id']}},_0x17b7ee={};_0x17b7ee[_0xe1a6('0x3d')]=_[_0xe1a6('0x3a')](db['FaxInteraction'][_0xe1a6('0xb0')]);_0x17b7ee[_0xe1a6('0x3b')]=_[_0xe1a6('0x3a')](_0x45e016[_0xe1a6('0x3b')]);_0x17b7ee[_0xe1a6('0x3c')]=_[_0xe1a6('0x3f')](_0x17b7ee[_0xe1a6('0x3d')],_0x17b7ee[_0xe1a6('0x3b')]);_0x3bea45[_0xe1a6('0x3e')]=_[_0xe1a6('0x3f')](_0x17b7ee[_0xe1a6('0x3d')],qs[_0xe1a6('0x99')](_0x45e016[_0xe1a6('0x3b')]['fields']));_0x3bea45[_0xe1a6('0x3e')]=_0x3bea45['attributes'][_0xe1a6('0x40')]?_0x3bea45['attributes']:_0x17b7ee['model'];if(_0x45e016[_0xe1a6('0x3b')][_0xe1a6('0xb1')]){_0x3bea45[_0xe1a6('0xb2')]=[{'all':!![]}];}_0x3bea45=_[_0xe1a6('0x98')]({},_0x3bea45,_0x45e016[_0xe1a6('0xb3')]);return db[_0xe1a6('0x37')][_0xe1a6('0x5f')](_0x3bea45)[_0xe1a6('0x28')](handleEntityNotFound(_0x27c3c2,null))[_0xe1a6('0x28')](respondWithResult(_0x27c3c2,null))[_0xe1a6('0xae')](handleError(_0x27c3c2,null));};exports['create']=function(_0x446798,_0x1a7628){return db[_0xe1a6('0x37')]['create'](_0x446798[_0xe1a6('0x73')],{})[_0xe1a6('0x28')](respondWithResult(_0x1a7628,0xc9))[_0xe1a6('0xae')](handleError(_0x1a7628,null));};exports['update']=function(_0x5dadab,_0x172b8a){if(_0x5dadab[_0xe1a6('0x73')]['id']){delete _0x5dadab[_0xe1a6('0x73')]['id'];}return db[_0xe1a6('0x37')]['find']({'where':{'id':_0x5dadab[_0xe1a6('0xaf')]['id']}})['then'](handleEntityNotFound(_0x172b8a,null))[_0xe1a6('0x28')](saveUpdates(_0x5dadab[_0xe1a6('0x73')],null))[_0xe1a6('0x28')](respondWithResult(_0x172b8a,null))['catch'](handleError(_0x172b8a,null));};exports[_0xe1a6('0x29')]=function(_0x3b157c,_0xaede02){return db['FaxInteraction'][_0xe1a6('0x5f')]({'where':{'id':_0x3b157c[_0xe1a6('0xaf')]['id']}})[_0xe1a6('0x28')](handleEntityNotFound(_0xaede02,null))[_0xe1a6('0x28')](removeEntity(_0xaede02,null))[_0xe1a6('0xae')](handleError(_0xaede02,null));};exports['describe']=function(_0x5823cf,_0x229bbb){return db[_0xe1a6('0x37')][_0xe1a6('0xb4')]()['then'](respondWithResult(_0x229bbb,null))[_0xe1a6('0xae')](handleError(_0x229bbb,null));};exports[_0xe1a6('0xb5')]=function(_0x5b6bb5,_0x5c0796,_0x41b493){return db['FaxMessage'][_0xe1a6('0x5f')]({'where':{'id':_0x5b6bb5[_0xe1a6('0xaf')]['id']}})['then'](handleEntityNotFound(_0x5c0796,null))[_0xe1a6('0x28')](function(_0x54e5a3){if(_0x54e5a3){return _0x54e5a3['addMessage'](_0x5b6bb5[_0xe1a6('0x73')][_0xe1a6('0xb6')],_[_0xe1a6('0xb7')](_0x5b6bb5['body'],['ids','id'])||{});}})[_0xe1a6('0x28')](respondWithResult(_0x5c0796,null))[_0xe1a6('0xae')](handleError(_0x5c0796,null));};exports['getMessages']=function(_0x2384c7,_0x55845e,_0x5c0d1d){var _0x5e35f3={'raw':![],'where':{}};var _0x1e4dd8={};var _0x40dbb3={'count':0x0,'rows':[]};return db[_0xe1a6('0x37')][_0xe1a6('0xb8')]({'where':{'id':_0x2384c7['params']['id']}})[_0xe1a6('0x28')](handleEntityNotFound(_0x55845e,null))[_0xe1a6('0x28')](function(_0x2df0e4){if(_0x2df0e4){_0x1e4dd8[_0xe1a6('0x3d')]=_['keys'](db[_0xe1a6('0xb9')][_0xe1a6('0xb0')]);_0x1e4dd8['query']=_[_0xe1a6('0x3a')](_0x2384c7[_0xe1a6('0x3b')]);_0x1e4dd8['filters']=_[_0xe1a6('0x3f')](_0x1e4dd8[_0xe1a6('0x3d')],_0x1e4dd8[_0xe1a6('0x3b')]);_0x5e35f3[_0xe1a6('0x3e')]=_['intersection'](_0x1e4dd8[_0xe1a6('0x3d')],qs['fields'](_0x2384c7[_0xe1a6('0x3b')][_0xe1a6('0x99')]));_0x5e35f3[_0xe1a6('0x3e')]=_0x5e35f3['attributes'][_0xe1a6('0x40')]?_0x5e35f3[_0xe1a6('0x3e')]:_0x1e4dd8[_0xe1a6('0x3d')];if(!_0x2384c7[_0xe1a6('0x3b')][_0xe1a6('0x41')](_0xe1a6('0x42'))){_0x5e35f3[_0xe1a6('0x22')]=qs['limit'](_0x2384c7['query'][_0xe1a6('0x22')]);_0x5e35f3[_0xe1a6('0x21')]=qs[_0xe1a6('0x21')](_0x2384c7[_0xe1a6('0x3b')]['offset']);}_0x5e35f3[_0xe1a6('0x43')]=qs[_0xe1a6('0x44')](_0x2384c7[_0xe1a6('0x3b')][_0xe1a6('0x44')]);_0x5e35f3[_0xe1a6('0x45')]=qs[_0xe1a6('0x3c')](_[_0xe1a6('0x46')](_0x2384c7[_0xe1a6('0x3b')],_0x1e4dd8['filters']));_0x5e35f3[_0xe1a6('0x45')][_0xe1a6('0xac')]=_0x2df0e4['id'];if(_0x2384c7[_0xe1a6('0x3b')][_0xe1a6('0x83')]){_0x5e35f3['where']=_[_0xe1a6('0x98')](_0x5e35f3[_0xe1a6('0x45')],{'$or':_[_0xe1a6('0x2f')](_0x5e35f3[_0xe1a6('0x3e')],function(_0x18b47c){var _0x40bd36={};_0x40bd36[_0x18b47c]={'$like':'%'+_0x2384c7[_0xe1a6('0x3b')][_0xe1a6('0x83')]+'%'};return _0x40bd36;})});}if(_0x2384c7[_0xe1a6('0x3b')][_0xe1a6('0x79')]){var _0x3acdf8=_0x2384c7[_0xe1a6('0x3b')][_0xe1a6('0x79')][_0xe1a6('0x32')](',');var _0x4d2cdb={};_0x4d2cdb[_0x3acdf8[0x0]]={'$gte':moment(_0x3acdf8[0x1])['format'](_0xe1a6('0xba'))};_0x5e35f3[_0xe1a6('0x45')]=_[_0xe1a6('0x98')](_0x5e35f3[_0xe1a6('0x45')],_0x4d2cdb);}_0x5e35f3=_['merge']({},_0x5e35f3,_0x2384c7[_0xe1a6('0xb3')]);return db[_0xe1a6('0xb9')]['count']({'where':_0x5e35f3[_0xe1a6('0x45')]})[_0xe1a6('0x28')](function(_0x1676d0){_0x40dbb3[_0xe1a6('0x20')]=_0x1676d0;if(_0x2384c7[_0xe1a6('0x3b')][_0xe1a6('0xb1')]){_0x5e35f3[_0xe1a6('0xb2')]=[{'all':!![]}];}return db[_0xe1a6('0xb9')][_0xe1a6('0xbb')](_0x5e35f3);})[_0xe1a6('0x28')](function(_0x13f83b){_0x40dbb3[_0xe1a6('0xad')]=_0x13f83b;return _0x40dbb3;});}})['then'](respondWithFilteredResult(_0x55845e,_0x5e35f3))[_0xe1a6('0xae')](handleError(_0x55845e,null));};exports[_0xe1a6('0xbc')]=function(_0x5d570f,_0x3321f5,_0x5250b3){return db[_0xe1a6('0x37')][_0xe1a6('0x5f')]({'where':{'id':_0x5d570f[_0xe1a6('0xaf')]['id']}})[_0xe1a6('0x28')](handleEntityNotFound(_0x3321f5,null))[_0xe1a6('0x28')](function(_0x18e146){if(_0x18e146){return _0x18e146['setTags'](_0x5d570f['body'][_0xe1a6('0xb6')],_[_0xe1a6('0xb7')](_0x5d570f[_0xe1a6('0x73')],[_0xe1a6('0xb6'),'id'])||{})['spread'](function(){return db[_0xe1a6('0x6d')]['findAll']({'attributes':['id',_0xe1a6('0x2c'),_0xe1a6('0x49')],'where':{'id':_0x5d570f[_0xe1a6('0x73')][_0xe1a6('0xb6')]}});})[_0xe1a6('0x28')](function(_0x160dcc){socket['emit']('faxInteractionTags:save',{'id':Number(_0x5d570f[_0xe1a6('0xaf')]['id']),'tags':_0x160dcc||[]});return{'id':Number(_0x5d570f[_0xe1a6('0xaf')]['id']),'tags':_0x160dcc||[]};});}})['then'](respondWithResult(_0x3321f5,null))[_0xe1a6('0xae')](handleError(_0x3321f5,null));};exports[_0xe1a6('0xbd')]=function(_0x3108ea,_0x12f763,_0x3e1d7d){return db['FaxInteraction'][_0xe1a6('0x5f')]({'where':{'id':_0x3108ea[_0xe1a6('0xaf')]['id']}})[_0xe1a6('0x28')](handleEntityNotFound(_0x12f763,null))['then'](function(_0x57ed25){if(_0x57ed25){return _0x57ed25[_0xe1a6('0xbd')](_0x3108ea[_0xe1a6('0x3b')][_0xe1a6('0xb6')]);}})[_0xe1a6('0x28')](respondWithStatusCode(_0x12f763,null))['catch'](handleError(_0x12f763,null));};exports[_0xe1a6('0xbe')]=function(_0x11f58f,_0x1c6025){var _0x528fff=moment()[_0xe1a6('0xbf')]()[_0xe1a6('0x96')]();var _0x8be27a=path['join'](config[_0xe1a6('0xc0')],'server',_0xe1a6('0xc1'),'tmp');var _0x353706=path[_0xe1a6('0xc2')](config[_0xe1a6('0xc0')],_0xe1a6('0xc3'),_0xe1a6('0xc1'),_0xe1a6('0xc4'));var _0x23f224=path[_0xe1a6('0xc2')](_0x8be27a,_0x528fff);var _0x11ffe7=util[_0xe1a6('0xc5')](_0xe1a6('0xc6'),_0x11f58f['params']['id'],_0x528fff);var _0x126677=path['join'](_0x8be27a,_0x11ffe7);var _0x3aeb73=[];_0x3aeb73[_0xe1a6('0x35')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});var _0x1a823a=[{'model':db['FaxMessage'],'as':_0xe1a6('0xc7'),'attributes':['id',_0xe1a6('0x73'),_0xe1a6('0x77')],'include':_0x3aeb73}];return db[_0xe1a6('0x37')][_0xe1a6('0x5f')]({'where':{'id':_0x11f58f[_0xe1a6('0xaf')]['id']},'include':_0x1a823a})['then'](handleEntityNotFound(_0x1c6025,null))['then'](function(_0x44374f){if(_0x44374f&&_0x44374f['Messages']){var _0x52f1c7=_0x44374f['get']({'plain':!![]});fs[_0xe1a6('0xc8')](_0x23f224);for(var _0x4249bc=0x0;_0x4249bc<_0x52f1c7[_0xe1a6('0xc7')][_0xe1a6('0x40')];_0x4249bc++){var _0x923191=_0x52f1c7[_0xe1a6('0xc7')][_0x4249bc]['Attachment'];if(_0x923191){var _0x35b68d=path['join'](_0x353706,_0x923191[_0xe1a6('0xc9')]);if(fs['existsSync'](_0x35b68d)){fs[_0xe1a6('0xca')](_0x35b68d)['pipe'](fs[_0xe1a6('0xcb')](path[_0xe1a6('0xc2')](_0x23f224,_0x923191[_0xe1a6('0xc9')])));}}}return BPromise[_0xe1a6('0x90')]()[_0xe1a6('0x28')](function(){return new BPromise(function(_0x249e74,_0x5f5811){zipdir(_0x23f224,{'saveTo':_0x126677},function(_0x5bc415,_0x2ac3a2){if(_0x5bc415)return _0x5f5811(_0x5bc415);return _0x249e74(_0x2ac3a2);});})[_0xe1a6('0x28')](function(){return new BPromise(function(_0x46dacb,_0x343078){rimraf(_0x23f224,function(_0x3dcf3f){if(_0x3dcf3f)_0x343078(_0x3dcf3f);return _0x46dacb();});});})[_0xe1a6('0x28')](function(){return _0x1c6025[_0xe1a6('0xbe')](_0x126677,_0x11ffe7,function(_0x428bf9){if(_0x428bf9){console['log'](_0xe1a6('0xcc'),_0x428bf9);}else{fs['unlinkSync'](_0x126677);}});});});}else{return _0x1c6025['sendStatus'](0xc8);}})['catch'](handleError(_0x1c6025,null));}; \ No newline at end of file +var _0x4569=['localhost','register','sendStatus','status','end','offset','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','map','fullname','TagIds','push','catch','FaxInteraction','fieldName','type','model','query','filters','intersection','fields','attributes','length','nolimit','order','where','pick','field','color','tools_tags','u.id','from','left_join','users','select','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','$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?','buildExpression','text','start','Tag','forEach','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','keys','compact','isEmpty','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','group','Sequelize','QueryTypes','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','FaxAccountId','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','count','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','Contact.mobile','Contact.fax','Owner.fullname','Owner.internal','ui.FaxInteractionId\x20IN\x20?','rows','show','rawAttributes','includeAll','include','options','create','body','params','describe','addMessage','ids','omit','getMessages','findOne','FaxMessage','hasOwnProperty','sort','FaxInteractionId','merge','addTags','setTags','spread','findAll','emit','faxInteractionTags:save','removeTags','download','root','server','files','tmp','join','attachments','format','transcript-%d-%s.zip','Attachment','Messages','get','existsSync','createReadStream','createWriteStream','log','err','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x4569,0xaa));var _0x9456=function(_0x3e6234,_0x2480ad){_0x3e6234=_0x3e6234-0x0;var _0x2b4329=_0x4569[_0x3e6234];return _0x2b4329;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9456('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9456('0x1'));var rp=require(_0x9456('0x2'));var moment=require(_0x9456('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9456('0x4'));var util=require(_0x9456('0x5'));var path=require(_0x9456('0x6'));var sox=require(_0x9456('0x7'));var csv=require(_0x9456('0x8'));var ejs=require(_0x9456('0x9'));var fs=require('fs');var _=require(_0x9456('0xa'));var squel=require(_0x9456('0xb'));var crypto=require(_0x9456('0xc'));var jsforce=require(_0x9456('0xd'));var deskjs=require(_0x9456('0xe'));var toCsv=require(_0x9456('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9456('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9456('0x10'));var as=require(_0x9456('0x11'));var hardwareService=require(_0x9456('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x9456('0x13'));var config=require(_0x9456('0x14'));var db=require(_0x9456('0x15'))['db'];config[_0x9456('0x16')]=_[_0x9456('0x17')](config[_0x9456('0x16')],{'host':_0x9456('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9456('0x16')]));require('./faxInteraction.socket')[_0x9456('0x19')](socket);function respondWithStatusCode(_0x188e37,_0x595c4d){_0x595c4d=_0x595c4d||0xcc;return function(_0xff5f57){if(_0xff5f57){return _0x188e37[_0x9456('0x1a')](_0x595c4d);}return _0x188e37[_0x9456('0x1b')](_0x595c4d)[_0x9456('0x1c')]();};}function respondWithResult(_0x226a1f,_0x2e9e0f){_0x2e9e0f=_0x2e9e0f||0xc8;return function(_0x2faad5){if(_0x2faad5){return _0x226a1f['status'](_0x2e9e0f)['json'](_0x2faad5);}};}function respondWithFilteredResult(_0x4eab8e,_0x9430c3){return function(_0x61272f){if(_0x61272f){var _0x22c456=_0x61272f['count'],_0x3272e9=_0x9430c3[_0x9456('0x1d')],_0x48ef0d=_0x9430c3['offset']+_0x9430c3[_0x9456('0x1e')],_0x4a2779;if(_0x48ef0d>=_0x22c456){_0x48ef0d=_0x22c456;_0x4a2779=0xc8;}else{_0x4a2779=0xce;}_0x4eab8e['status'](_0x4a2779);return _0x4eab8e[_0x9456('0x1f')](_0x9456('0x20'),_0x3272e9+'-'+_0x48ef0d+'/'+_0x22c456)['json'](_0x61272f);}return null;};}function patchUpdates(_0x29e2fc){return function(_0x5272ff){try{jsonpatch[_0x9456('0x21')](_0x5272ff,_0x29e2fc,!![]);}catch(_0x50ffdd){return BPromise[_0x9456('0x22')](_0x50ffdd);}return _0x5272ff[_0x9456('0x23')]();};}function saveUpdates(_0x18d42b,_0x276538){return function(_0x216af0){if(_0x216af0){return _0x216af0[_0x9456('0x24')](_0x18d42b)[_0x9456('0x25')](function(_0x10aa93){return _0x10aa93;});}return null;};}function removeEntity(_0x245e39,_0x3d83ef){return function(_0x2e89b8){if(_0x2e89b8){return _0x2e89b8['destroy']()[_0x9456('0x25')](function(){_0x245e39[_0x9456('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x302e01,_0x2c1513){return function(_0x32aeda){if(!_0x32aeda){_0x302e01[_0x9456('0x1a')](0x194);}return _0x32aeda;};}function handleError(_0x529025,_0x5c6f76){_0x5c6f76=_0x5c6f76||0x1f4;return function(_0x385a05){logger['error'](_0x385a05[_0x9456('0x26')]);if(_0x385a05[_0x9456('0x27')]){delete _0x385a05['name'];}_0x529025[_0x9456('0x1b')](_0x5c6f76)[_0x9456('0x28')](_0x385a05);};}function getInteractionUsers(_0x3dcfd1,_0x1eb3a8){return new BPromise(function(_0x402264,_0x28e90d){try{if(_0x1eb3a8[_0x3dcfd1['id']]){_0x3dcfd1['Users']=_[_0x9456('0x29')](_0x1eb3a8[_0x3dcfd1['id']],function(_0xef3f74){return{'id':_0xef3f74['id'],'fullname':_0xef3f74[_0x9456('0x2a')]};});}}catch(_0x419701){_0x28e90d(_0x419701);}_0x402264(_0x3dcfd1);});}function getInteractionTags(_0x59d2f0,_0x1ae7ca){return new BPromise(function(_0x5f07e0,_0x1130f7){try{if(_0x59d2f0[_0x9456('0x2b')]){_0x59d2f0['Tags']=[];_0x59d2f0[_0x9456('0x2b')]['split'](',')['forEach'](function(_0x125165){_0x59d2f0['Tags'][_0x9456('0x2c')](_0x1ae7ca[_0x125165]);});}delete _0x59d2f0['TagIds'];}catch(_0x24321b){_0x1130f7(_0x24321b);}_0x5f07e0(_0x59d2f0);});}function updateFaxInteraction(_0x253aa5,_0x34b718,_0x330561){return new BPromise(function(_0x239a66,_0x45fdba){return getInteractionUsers(_0x253aa5,_0x330561)[_0x9456('0x25')](function(_0x3ffa12){return getInteractionTags(_0x3ffa12,_0x34b718);})[_0x9456('0x25')](function(_0x8d1f7b){_0x239a66(_0x8d1f7b);})[_0x9456('0x2d')](function(_0x426fd6){_0x45fdba(_0x426fd6);});});}exports['index']=function(_0x1b826c,_0x54bb75){var _0x382134={},_0x188ffc={},_0x34faf3={'count':0x0,'rows':[]};var _0x4f8834=_[_0x9456('0x29')](db[_0x9456('0x2e')]['rawAttributes'],function(_0x1365bb){return{'name':_0x1365bb[_0x9456('0x2f')],'type':_0x1365bb[_0x9456('0x30')]['key']};});_0x188ffc[_0x9456('0x31')]=_[_0x9456('0x29')](_0x4f8834,_0x9456('0x27'));_0x188ffc[_0x9456('0x32')]=_['keys'](_0x1b826c[_0x9456('0x32')]);_0x188ffc[_0x9456('0x33')]=_[_0x9456('0x34')](_0x188ffc[_0x9456('0x31')],_0x188ffc[_0x9456('0x32')]);_0x382134['attributes']=_[_0x9456('0x34')](_0x188ffc['model'],qs[_0x9456('0x35')](_0x1b826c[_0x9456('0x32')]['fields']));_0x382134[_0x9456('0x36')]=_0x382134['attributes'][_0x9456('0x37')]?_0x382134[_0x9456('0x36')]:_0x188ffc[_0x9456('0x31')];if(!_0x1b826c['query']['hasOwnProperty'](_0x9456('0x38'))){_0x382134[_0x9456('0x1e')]=qs['limit'](_0x1b826c['query'][_0x9456('0x1e')]);_0x382134[_0x9456('0x1d')]=qs[_0x9456('0x1d')](_0x1b826c[_0x9456('0x32')][_0x9456('0x1d')]);}_0x382134[_0x9456('0x39')]=qs['sort'](_0x1b826c['query']['sort']);_0x382134[_0x9456('0x3a')]=qs['filters'](_[_0x9456('0x3b')](_0x1b826c[_0x9456('0x32')],_0x188ffc[_0x9456('0x33')]));var _0x202948=[];var _0x3994b8=squel['select']()['field']('id')[_0x9456('0x3c')](_0x9456('0x27'))['field'](_0x9456('0x3d'))['from'](_0x9456('0x3e'));var _0x30c03c=squel['select']()[_0x9456('0x3c')](_0x9456('0x3f'))[_0x9456('0x3c')]('u.fullname')[_0x9456('0x3c')]('ui.FaxInteractionId')[_0x9456('0x40')]('user_has_fax_interactions','ui')[_0x9456('0x41')](_0x9456('0x42'),'u','u.id\x20=\x20ui.UserId');var _0x34f3d1=squel[_0x9456('0x43')]()['from'](_0x9456('0x44'),'i')['left_join'](_0x9456('0x45'),'c',_0x9456('0x46'))[_0x9456('0x41')]('users','o',_0x9456('0x47'))[_0x9456('0x41')](_0x9456('0x48'),'a',_0x9456('0x49'))[_0x9456('0x41')](_0x9456('0x4a'),'me',_0x9456('0x4b'))['left_join'](_0x9456('0x4c'),'it',_0x9456('0x4d'))[_0x9456('0x41')](_0x9456('0x3e'),'t',_0x9456('0x4e'));var _0x17a0b5=squel[_0x9456('0x4f')]();var _0x2817e4=[];var _0x40b8e1=squel[_0x9456('0x4f')]();var _0x226318;if(_0x1b826c[_0x9456('0x32')][_0x9456('0x50')]){_0x226318=as['parseSearch'](_0x1b826c[_0x9456('0x32')]['search']);var _0x3f1307=_0x226318[_0x9456('0x51')];for(var _0x3fcd7c=0x0;_0x3fcd7c<_0x226318[_0x9456('0x52')]['length'];_0x3fcd7c++){var _0x19b635=_0x226318[_0x9456('0x52')][_0x3fcd7c];var _0x2ff183='i';var _0x4a24d1=_[_0x9456('0x53')](_0x4f8834,[_0x9456('0x27'),_0x19b635[_0x9456('0x3c')]]);if(!_0x4a24d1){switch(_0x19b635[_0x9456('0x3c')]){case _0x9456('0x54'):if(_0x19b635[_0x9456('0x55')]==0x1){_0x34f3d1[_0x9456('0x56')]('`'+_0x19b635[_0x9456('0x3c')]+_0x9456('0x57'));}else{_0x34f3d1[_0x9456('0x56')]('`'+_0x19b635[_0x9456('0x3c')]+'`\x20>\x200');}break;case'Contact':if(_0x19b635['operator']===_0x9456('0x58')){if(_0x19b635[_0x9456('0x55')][_0x9456('0x59')]('\x20')[_0x9456('0x37')]>0x1){_0x17a0b5[_0x3f1307](_0x9456('0x5a'),qs['getFullTextValue'](_0x19b635[_0x9456('0x55')]),null);}else{var _0x598fed='%'+_0x19b635[_0x9456('0x55')]+'%';_0x17a0b5[_0x3f1307](_0x9456('0x5b'),_0x598fed,_0x598fed,_0x598fed);}}else{_0x4a24d1=_[_0x9456('0x53')](_0x4f8834,['name','ContactId']);_0x19b635[_0x9456('0x3c')]='ContactId';_0x8f1870=as[_0x9456('0x5c')](_0x2ff183,_0x4a24d1[_0x9456('0x30')],_0x19b635);_0x17a0b5[_0x3f1307](_0x8f1870[_0x9456('0x5d')],_0x8f1870[_0x9456('0x55')][_0x9456('0x5e')],_0x8f1870[_0x9456('0x55')]['end']);}break;case _0x9456('0x5f'):var _0xc98629=_0x19b635['value'][_0x9456('0x59')](',')[_0x9456('0x29')](function(_0xcaa4d3){return Number(_0xcaa4d3);});_0xc98629[_0x9456('0x60')](function(_0x520b29){_0x40b8e1['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x520b29+',%');});_0x2817e4=_['union'](_0x2817e4,_0xc98629);break;case'User':if(_0x19b635[_0x9456('0x61')]===_0x9456('0x58')){_0x17a0b5[_0x3f1307](_0x9456('0x62'),'%'+_0x19b635['value']+'%',null);}else{_0x4a24d1=_[_0x9456('0x53')](_0x4f8834,['name',_0x9456('0x63')]);_0x19b635['field']=_0x9456('0x63');_0x8f1870=as[_0x9456('0x5c')](_0x2ff183,_0x4a24d1['type'],_0x19b635);_0x17a0b5[_0x3f1307](_0x8f1870[_0x9456('0x5d')],_0x8f1870['value'][_0x9456('0x5e')],_0x8f1870[_0x9456('0x55')][_0x9456('0x1c')]);}break;case'body':_0x8f1870=as[_0x9456('0x5c')]('me',null,_0x19b635);_0x17a0b5[_0x3f1307](_0x8f1870[_0x9456('0x5d')],_0x8f1870['value'][_0x9456('0x5e')],_0x8f1870['value']['end']);break;}}else{var _0x8f1870=as['buildExpression'](_0x2ff183,_0x4a24d1[_0x9456('0x30')],_0x19b635);_0x17a0b5[_0x3f1307](_0x8f1870[_0x9456('0x5d')],_0x8f1870[_0x9456('0x55')][_0x9456('0x5e')],_0x8f1870['value'][_0x9456('0x1c')]);}}}else{var _0x177af5=_(_0x1b826c[_0x9456('0x32')])[_0x9456('0x64')]()[_0x9456('0x29')](function(_0x179492){return _['some'](_0x4f8834,[_0x9456('0x27'),_0x179492])?_0x179492:undefined;})[_0x9456('0x65')]()[_0x9456('0x55')]();if(!_[_0x9456('0x66')](_0x177af5)){_0x177af5[_0x9456('0x60')](function(_0x28597e){if(_0x28597e==='FaxAccountId'){_0x34f3d1[_0x9456('0x3a')]('i.FaxAccountId\x20IN\x20?',[][_0x9456('0x67')](_0x1b826c[_0x9456('0x32')][_0x28597e]));}else if(_0x28597e===_0x9456('0x68')){var _0xef0b55=JSON['parse'](_0x1b826c[_0x9456('0x32')][_0x28597e])[_0x9456('0x69')];var _0x95453=JSON[_0x9456('0x6a')](_0x1b826c[_0x9456('0x32')][_0x28597e])[_0x9456('0x6b')];_0x34f3d1[_0x9456('0x3a')](_0x9456('0x6c'),_0xef0b55,_0x95453);}else{if(_0x1b826c['query'][_0x28597e]===_0x9456('0x6d')){_0x34f3d1[_0x9456('0x3a')]('i.'+_0x28597e+'\x20IS\x20NULL');}else{_0x34f3d1['where']('i.'+_0x28597e+_0x9456('0x6e'),_0x1b826c[_0x9456('0x32')][_0x28597e]);}}});}if(_0x1b826c['query'][_0x9456('0x6f')]){if(_0x1b826c[_0x9456('0x32')]['read']==0x1){_0x34f3d1[_0x9456('0x56')]('`unreadMessages`\x20=\x200');}else{_0x34f3d1[_0x9456('0x56')]('`unreadMessages`\x20>\x200');}}if(_0x1b826c[_0x9456('0x32')][_0x9456('0x70')]){_0x2817e4=_[_0x9456('0x71')](_0x1b826c[_0x9456('0x32')]['tag'])?_0x1b826c['query']['tag']:new Array(_0x1b826c[_0x9456('0x32')]['tag']);_0x2817e4['forEach'](function(_0x150bd2){_0x40b8e1['or'](_0x9456('0x72'),'%,'+_0x150bd2+',%');});}if(_0x1b826c[_0x9456('0x32')][_0x9456('0x73')]){var _0xaa87b2=_0x1b826c[_0x9456('0x32')][_0x9456('0x73')]['replace']('\x5c','\x5c\x5c')[_0x9456('0x74')]('\x27\x27',_0x9456('0x75'));if(qs[_0x9456('0x76')](_0xaa87b2)){_0x17a0b5['or'](_0x9456('0x77'),_0xaa87b2+'%')['or']('i.fax\x20LIKE\x20?',_0xaa87b2+'%');}_0x17a0b5['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0xaa87b2+'%');}}_0x34f3d1[_0x9456('0x3a')](_0x17a0b5);_0x34f3d1[_0x9456('0x78')]('i.id');var _0x3c12b7={'type':db[_0x9456('0x79')][_0x9456('0x7a')]['SELECT'],'raw':!![]};var _0x4edd94=_0x34f3d1[_0x9456('0x7b')]();_0x4edd94[_0x9456('0x3c')](_0x9456('0x7c'));_0x4edd94[_0x9456('0x3c')](_0x9456('0x7d'),_0x9456('0x54'));if(_0x382134[_0x9456('0x39')]){_0x382134[_0x9456('0x39')][_0x9456('0x60')](function(_0x4e84da){_0x34f3d1['order']('i.'+_0x4e84da[0x0],_0x4e84da[0x1]===_0x9456('0x7e')?![]:!![]);});}if(!_['isEmpty'](_0x2817e4)){_0x34f3d1[_0x9456('0x56')](_0x40b8e1);_0x4edd94[_0x9456('0x3a')](_0x9456('0x7f'),_0x2817e4);}BPromise[_0x9456('0x80')]()['then'](function(){if(!_0x226318){if(_0x1b826c[_0x9456('0x32')][_0x9456('0x81')]||_0x1b826c[_0x9456('0x32')][_0x9456('0x82')])return;_0x4edd94[_0x9456('0x3a')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x34f3d1[_0x9456('0x3a')](_0x9456('0x83'));return;}return _0x1b826c['user']['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0x9456('0x25')](function(_0x2c52a9){if(_[_0x9456('0x66')](_0x2c52a9)){_0x4edd94[_0x9456('0x3a')](_0x9456('0x84'));_0x34f3d1[_0x9456('0x3a')]('i.FaxAccountId\x20IS\x20NULL');}else{_0x4edd94['where']('i.FaxAccountId\x20IN\x20?',_['map'](_0x2c52a9,'id'));_0x34f3d1['where']('i.FaxAccountId\x20IN\x20?',_['map'](_0x2c52a9,'id'));}});})[_0x9456('0x25')](function(){db[_0x9456('0x85')]['query'](_0x4edd94[_0x9456('0x86')](),_0x3c12b7)[_0x9456('0x25')](function(_0x3de543){_0x34faf3[_0x9456('0x87')]=_0x3de543['length'];if(_0x34faf3[_0x9456('0x87')]===0x0)return[];return db[_0x9456('0x85')]['query'](_0x3994b8[_0x9456('0x86')](),_0x3c12b7)[_0x9456('0x25')](function(_0x2a9821){_0x202948=_['keyBy'](_0x2a9821,'id');_0x3c12b7=_['merge'](_0x3c12b7,{'model':db[_0x9456('0x2e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1b826c[_0x9456('0x32')][_0x9456('0x35')]){_0x382134[_0x9456('0x36')][_0x9456('0x60')](function(_0x3e93b2){_0x34f3d1[_0x9456('0x3c')]('i.'+_0x3e93b2);});}else{_0x34f3d1[_0x9456('0x3c')](_0x9456('0x7d'),'unreadMessages');_0x34f3d1[_0x9456('0x3c')]('a.key','Account.key');_0x34f3d1[_0x9456('0x3c')](_0x9456('0x88'),_0x9456('0x89'));_0x34f3d1[_0x9456('0x3c')]('i.*');_0x34f3d1[_0x9456('0x3c')](_0x9456('0x8a'),_0x9456('0x8b'));_0x34f3d1[_0x9456('0x3c')](_0x9456('0x8c'),_0x9456('0x8d'));_0x34f3d1[_0x9456('0x3c')](_0x9456('0x8e'),'Contact.email');_0x34f3d1['field'](_0x9456('0x8f'),_0x9456('0x90'));_0x34f3d1[_0x9456('0x3c')]('c.mobile',_0x9456('0x91'));_0x34f3d1[_0x9456('0x3c')]('c.fax',_0x9456('0x92'));_0x34f3d1['field']('o.fullname',_0x9456('0x93'));_0x34f3d1[_0x9456('0x3c')]('o.internal',_0x9456('0x94'));_0x34f3d1[_0x9456('0x3c')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x9456('0x2b'));}_0x34f3d1[_0x9456('0x1e')](_0x382134[_0x9456('0x1e')]);_0x34f3d1[_0x9456('0x1d')](_0x382134['offset']);return db['sequelize'][_0x9456('0x32')](_0x34f3d1['toString'](),_0x3c12b7);})[_0x9456('0x25')](function(_0x247a93){_0x30c03c['where'](_0x9456('0x95'),_[_0x9456('0x29')](_0x247a93,'id'));return db[_0x9456('0x85')][_0x9456('0x32')](_0x30c03c['toString'](),_0x3c12b7)['then'](function(_0x5a06e4){var _0x30bcde=_['groupBy'](_0x5a06e4,'FaxInteractionId');var _0xa8024a=[];_0x247a93[_0x9456('0x60')](function(_0x43d7f3){_0xa8024a[_0x9456('0x2c')](updateFaxInteraction(_0x43d7f3,_0x202948,_0x30bcde));});return BPromise['all'](_0xa8024a);});});})[_0x9456('0x25')](function(_0x5863a7){_0x34faf3[_0x9456('0x96')]=_0x5863a7;return _0x34faf3;})['then'](respondWithFilteredResult(_0x54bb75,_0x382134));})['catch'](handleError(_0x54bb75,null));};exports[_0x9456('0x97')]=function(_0x1e7b3d,_0x4dbe3d){var _0x3a223f={'raw':![],'where':{'id':_0x1e7b3d['params']['id']}},_0x4087be={};_0x4087be[_0x9456('0x31')]=_['keys'](db[_0x9456('0x2e')][_0x9456('0x98')]);_0x4087be[_0x9456('0x32')]=_[_0x9456('0x64')](_0x1e7b3d[_0x9456('0x32')]);_0x4087be[_0x9456('0x33')]=_[_0x9456('0x34')](_0x4087be[_0x9456('0x31')],_0x4087be['query']);_0x3a223f['attributes']=_['intersection'](_0x4087be[_0x9456('0x31')],qs[_0x9456('0x35')](_0x1e7b3d[_0x9456('0x32')][_0x9456('0x35')]));_0x3a223f['attributes']=_0x3a223f['attributes'][_0x9456('0x37')]?_0x3a223f[_0x9456('0x36')]:_0x4087be[_0x9456('0x31')];if(_0x1e7b3d['query'][_0x9456('0x99')]){_0x3a223f[_0x9456('0x9a')]=[{'all':!![]}];}_0x3a223f=_['merge']({},_0x3a223f,_0x1e7b3d[_0x9456('0x9b')]);return db[_0x9456('0x2e')]['find'](_0x3a223f)['then'](handleEntityNotFound(_0x4dbe3d,null))['then'](respondWithResult(_0x4dbe3d,null))[_0x9456('0x2d')](handleError(_0x4dbe3d,null));};exports['create']=function(_0x2012a7,_0x2c851f){return db[_0x9456('0x2e')][_0x9456('0x9c')](_0x2012a7[_0x9456('0x9d')],{})[_0x9456('0x25')](respondWithResult(_0x2c851f,0xc9))['catch'](handleError(_0x2c851f,null));};exports[_0x9456('0x24')]=function(_0x52bbdf,_0x4e8ba3){if(_0x52bbdf[_0x9456('0x9d')]['id']){delete _0x52bbdf[_0x9456('0x9d')]['id'];}return db[_0x9456('0x2e')][_0x9456('0x53')]({'where':{'id':_0x52bbdf[_0x9456('0x9e')]['id']}})[_0x9456('0x25')](handleEntityNotFound(_0x4e8ba3,null))[_0x9456('0x25')](saveUpdates(_0x52bbdf[_0x9456('0x9d')],null))[_0x9456('0x25')](respondWithResult(_0x4e8ba3,null))['catch'](handleError(_0x4e8ba3,null));};exports['destroy']=function(_0x4b12a3,_0x2188b1){return db[_0x9456('0x2e')][_0x9456('0x53')]({'where':{'id':_0x4b12a3[_0x9456('0x9e')]['id']}})[_0x9456('0x25')](handleEntityNotFound(_0x2188b1,null))[_0x9456('0x25')](removeEntity(_0x2188b1,null))[_0x9456('0x2d')](handleError(_0x2188b1,null));};exports['describe']=function(_0x1f4351,_0x2909a0){return db[_0x9456('0x2e')][_0x9456('0x9f')]()[_0x9456('0x25')](respondWithResult(_0x2909a0,null))[_0x9456('0x2d')](handleError(_0x2909a0,null));};exports['addMessage']=function(_0x27b7f3,_0x5c9d50,_0x4a93eb){return db['FaxMessage'][_0x9456('0x53')]({'where':{'id':_0x27b7f3[_0x9456('0x9e')]['id']}})['then'](handleEntityNotFound(_0x5c9d50,null))[_0x9456('0x25')](function(_0x20fd9a){if(_0x20fd9a){return _0x20fd9a[_0x9456('0xa0')](_0x27b7f3[_0x9456('0x9d')][_0x9456('0xa1')],_[_0x9456('0xa2')](_0x27b7f3[_0x9456('0x9d')],[_0x9456('0xa1'),'id'])||{});}})[_0x9456('0x25')](respondWithResult(_0x5c9d50,null))[_0x9456('0x2d')](handleError(_0x5c9d50,null));};exports[_0x9456('0xa3')]=function(_0x26bb1b,_0x45ea43,_0x266a52){var _0x42975e={'raw':![],'where':{}};var _0x42544c={};var _0x4a8c5b={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x9456('0xa4')]({'where':{'id':_0x26bb1b[_0x9456('0x9e')]['id']}})[_0x9456('0x25')](handleEntityNotFound(_0x45ea43,null))[_0x9456('0x25')](function(_0x24652c){if(_0x24652c){_0x42544c[_0x9456('0x31')]=_['keys'](db[_0x9456('0xa5')][_0x9456('0x98')]);_0x42544c[_0x9456('0x32')]=_[_0x9456('0x64')](_0x26bb1b[_0x9456('0x32')]);_0x42544c[_0x9456('0x33')]=_[_0x9456('0x34')](_0x42544c[_0x9456('0x31')],_0x42544c[_0x9456('0x32')]);_0x42975e[_0x9456('0x36')]=_[_0x9456('0x34')](_0x42544c[_0x9456('0x31')],qs['fields'](_0x26bb1b['query'][_0x9456('0x35')]));_0x42975e[_0x9456('0x36')]=_0x42975e[_0x9456('0x36')][_0x9456('0x37')]?_0x42975e[_0x9456('0x36')]:_0x42544c[_0x9456('0x31')];if(!_0x26bb1b['query'][_0x9456('0xa6')](_0x9456('0x38'))){_0x42975e[_0x9456('0x1e')]=qs[_0x9456('0x1e')](_0x26bb1b[_0x9456('0x32')][_0x9456('0x1e')]);_0x42975e[_0x9456('0x1d')]=qs[_0x9456('0x1d')](_0x26bb1b[_0x9456('0x32')][_0x9456('0x1d')]);}_0x42975e[_0x9456('0x39')]=qs[_0x9456('0xa7')](_0x26bb1b[_0x9456('0x32')]['sort']);_0x42975e[_0x9456('0x3a')]=qs[_0x9456('0x33')](_[_0x9456('0x3b')](_0x26bb1b[_0x9456('0x32')],_0x42544c['filters']));_0x42975e[_0x9456('0x3a')][_0x9456('0xa8')]=_0x24652c['id'];if(_0x26bb1b[_0x9456('0x32')][_0x9456('0x73')]){_0x42975e[_0x9456('0x3a')]=_['merge'](_0x42975e[_0x9456('0x3a')],{'$or':_['map'](_0x42975e[_0x9456('0x36')],function(_0x53472d){var _0x35ab86={};_0x35ab86[_0x53472d]={'$like':'%'+_0x26bb1b[_0x9456('0x32')]['filter']+'%'};return _0x35ab86;})});}if(_0x26bb1b['query'][_0x9456('0x69')]){var _0x43a72f=_0x26bb1b[_0x9456('0x32')][_0x9456('0x69')]['split'](',');var _0x212837={};_0x212837[_0x43a72f[0x0]]={'$gte':moment(_0x43a72f[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x42975e[_0x9456('0x3a')]=_['merge'](_0x42975e[_0x9456('0x3a')],_0x212837);}_0x42975e=_[_0x9456('0xa9')]({},_0x42975e,_0x26bb1b[_0x9456('0x9b')]);return db[_0x9456('0xa5')][_0x9456('0x87')]({'where':_0x42975e[_0x9456('0x3a')]})[_0x9456('0x25')](function(_0x58c379){_0x4a8c5b[_0x9456('0x87')]=_0x58c379;if(_0x26bb1b[_0x9456('0x32')][_0x9456('0x99')]){_0x42975e[_0x9456('0x9a')]=[{'all':!![]}];}return db[_0x9456('0xa5')]['findAll'](_0x42975e);})['then'](function(_0x4abaf9){_0x4a8c5b['rows']=_0x4abaf9;return _0x4a8c5b;});}})[_0x9456('0x25')](respondWithFilteredResult(_0x45ea43,_0x42975e))[_0x9456('0x2d')](handleError(_0x45ea43,null));};exports[_0x9456('0xaa')]=function(_0x5cd858,_0x42cbe8,_0xca02da){return db[_0x9456('0x2e')][_0x9456('0x53')]({'where':{'id':_0x5cd858[_0x9456('0x9e')]['id']}})[_0x9456('0x25')](handleEntityNotFound(_0x42cbe8,null))['then'](function(_0x1b1191){if(_0x1b1191){return _0x1b1191[_0x9456('0xab')](_0x5cd858[_0x9456('0x9d')]['ids'],_[_0x9456('0xa2')](_0x5cd858['body'],[_0x9456('0xa1'),'id'])||{})[_0x9456('0xac')](function(){return db[_0x9456('0x5f')][_0x9456('0xad')]({'attributes':['id','name',_0x9456('0x3d')],'where':{'id':_0x5cd858['body'][_0x9456('0xa1')]}});})['then'](function(_0x1076fa){socket[_0x9456('0xae')](_0x9456('0xaf'),{'id':Number(_0x5cd858[_0x9456('0x9e')]['id']),'tags':_0x1076fa||[]});return{'id':Number(_0x5cd858['params']['id']),'tags':_0x1076fa||[]};});}})['then'](respondWithResult(_0x42cbe8,null))['catch'](handleError(_0x42cbe8,null));};exports[_0x9456('0xb0')]=function(_0x537a9a,_0x563f6a,_0x982ef1){return db[_0x9456('0x2e')][_0x9456('0x53')]({'where':{'id':_0x537a9a['params']['id']}})[_0x9456('0x25')](handleEntityNotFound(_0x563f6a,null))['then'](function(_0x5b034b){if(_0x5b034b){return _0x5b034b[_0x9456('0xb0')](_0x537a9a[_0x9456('0x32')]['ids']);}})[_0x9456('0x25')](respondWithStatusCode(_0x563f6a,null))['catch'](handleError(_0x563f6a,null));};exports[_0x9456('0xb1')]=function(_0x10f7d3,_0x5300d9){var _0x44fa78=moment()['unix']()[_0x9456('0x86')]();var _0x567ca3=path['join'](config[_0x9456('0xb2')],_0x9456('0xb3'),_0x9456('0xb4'),_0x9456('0xb5'));var _0x2b9d04=path[_0x9456('0xb6')](config['root'],_0x9456('0xb3'),_0x9456('0xb4'),_0x9456('0xb7'));var _0x12ca6b=path['join'](_0x567ca3,_0x44fa78);var _0xcbf94c=util[_0x9456('0xb8')](_0x9456('0xb9'),_0x10f7d3['params']['id'],_0x44fa78);var _0x24b1db=path[_0x9456('0xb6')](_0x567ca3,_0xcbf94c);var _0x5c6e61=[];_0x5c6e61[_0x9456('0x2c')]({'model':db[_0x9456('0xba')],'as':'Attachment','raw':!![]});var _0x1ae394=[{'model':db[_0x9456('0xa5')],'as':_0x9456('0xbb'),'attributes':['id','body',_0x9456('0x68')],'include':_0x5c6e61}];return db['FaxInteraction'][_0x9456('0x53')]({'where':{'id':_0x10f7d3[_0x9456('0x9e')]['id']},'include':_0x1ae394})['then'](handleEntityNotFound(_0x5300d9,null))[_0x9456('0x25')](function(_0x27eb21){if(_0x27eb21&&_0x27eb21[_0x9456('0xbb')]){var _0x3f9b22=_0x27eb21[_0x9456('0xbc')]({'plain':!![]});fs['mkdirSync'](_0x12ca6b);for(var _0x2ba0b9=0x0;_0x2ba0b9<_0x3f9b22[_0x9456('0xbb')][_0x9456('0x37')];_0x2ba0b9++){var _0x564027=_0x3f9b22['Messages'][_0x2ba0b9][_0x9456('0xba')];if(_0x564027){var _0x1844f1=path[_0x9456('0xb6')](_0x2b9d04,_0x564027['basename']);if(fs[_0x9456('0xbd')](_0x1844f1)){fs[_0x9456('0xbe')](_0x1844f1)['pipe'](fs[_0x9456('0xbf')](path[_0x9456('0xb6')](_0x12ca6b,_0x564027['basename'])));}}}return BPromise['resolve']()[_0x9456('0x25')](function(){return new BPromise(function(_0x4565da,_0x1d1906){zipdir(_0x12ca6b,{'saveTo':_0x24b1db},function(_0x20bb78,_0x2ccfdb){if(_0x20bb78)return _0x1d1906(_0x20bb78);return _0x4565da(_0x2ccfdb);});})[_0x9456('0x25')](function(){return new BPromise(function(_0x72d528,_0x4d8e49){rimraf(_0x12ca6b,function(_0xbdac38){if(_0xbdac38)_0x4d8e49(_0xbdac38);return _0x72d528();});});})[_0x9456('0x25')](function(){return _0x5300d9[_0x9456('0xb1')](_0x24b1db,_0xcbf94c,function(_0x38c88b){if(_0x38c88b){console[_0x9456('0xc0')](_0x9456('0xc1'),_0x38c88b);}else{fs['unlinkSync'](_0x24b1db);}});});});}else{return _0x5300d9[_0x9456('0x1a')](0xc8);}})[_0x9456('0x2d')](handleError(_0x5300d9,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 425867c..46f3a64 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 _0x2ef3=['remove','then','setDataValue','Users','map','findAll','emit','catch','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2ef3,0xba));var _0x32ef=function(_0x1083a8,_0x4ea006){_0x1083a8=_0x1083a8-0x0;var _0xbbddbd=_0x2ef3[_0x1083a8];return _0xbbddbd;};'use strict';var EventEmitter=require(_0x32ef('0x0'));var FaxInteraction=require(_0x32ef('0x1'))['db'][_0x32ef('0x2')];var FaxMessage=require(_0x32ef('0x1'))['db'][_0x32ef('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x32ef('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x32ef('0x5'),'afterDestroy':_0x32ef('0x6')};function emitEvent(_0x524ab6){return function(_0x402857,_0x37dd1d,_0x4c8104){_0x402857['getUsers']({'attributes':['id'],'raw':!![]})[_0x32ef('0x7')](function(_0x4bfcf8){_0x402857[_0x32ef('0x8')](_0x32ef('0x9'),_0x4bfcf8[_0x32ef('0xa')](function(_0x298066){return{'id':_0x298066['id']};}));return FaxMessage[_0x32ef('0xb')]({'where':{'FaxInteractionId':_0x402857['id'],'direction':'in','read':![]},'raw':!![]});})[_0x32ef('0x7')](function(_0x28275c){_0x402857[_0x32ef('0x8')]('unreadMessages',_0x28275c['length']);FaxInteractionEvents[_0x32ef('0xc')](_0x524ab6+':'+_0x402857['id'],_0x402857);FaxInteractionEvents[_0x32ef('0xc')](_0x524ab6,_0x402857);_0x4c8104(null);})[_0x32ef('0xd')](_0x4c8104(null));};}for(var e in events){if(events[_0x32ef('0xe')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x32ef('0xf')]=FaxInteractionEvents; \ No newline at end of file +var _0x7a54=['setDataValue','map','length','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove','getUsers'];(function(_0x420f17,_0x4eb527){var _0x393bce=function(_0x2fb594){while(--_0x2fb594){_0x420f17['push'](_0x420f17['shift']());}};_0x393bce(++_0x4eb527);}(_0x7a54,0x106));var _0x47a5=function(_0x2ccb50,_0x1993fb){_0x2ccb50=_0x2ccb50-0x0;var _0x4c250d=_0x7a54[_0x2ccb50];return _0x4c250d;};'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 diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 8a881a6..4be845f 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 _0x8792=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closed'];(function(_0x301f7f,_0x31cb97){var _0x2c25d9=function(_0x403b20){while(--_0x403b20){_0x301f7f['push'](_0x301f7f['shift']());}};_0x2c25d9(++_0x31cb97);}(_0x8792,0x146));var _0x2879=function(_0x32249d,_0x1811e2){_0x32249d=_0x32249d-0x0;var _0x10c478=_0x8792[_0x32249d];return _0x10c478;};'use strict';var _=require(_0x2879('0x0'));var util=require(_0x2879('0x1'));var logger=require(_0x2879('0x2'))(_0x2879('0x3'));var moment=require(_0x2879('0x4'));var BPromise=require(_0x2879('0x5'));var rp=require(_0x2879('0x6'));var fs=require('fs');var path=require(_0x2879('0x7'));var rimraf=require('rimraf');var config=require(_0x2879('0x8'));var attributes=require(_0x2879('0x9'));module[_0x2879('0xa')]=function(_0x38faed,_0x25bc71){return _0x38faed[_0x2879('0xb')](_0x2879('0xc'),attributes,{'tableName':_0x2879('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5c9476,_0x536b3a,_0x1efe86){if(_0x5c9476[_0x2879('0xe')](_0x2879('0xf'))){_0x5c9476[_0x2879('0x10')]=moment()[_0x2879('0x11')](_0x2879('0x12'));}_0x1efe86(null,_0x5c9476);}}});}; \ No newline at end of file +var _0xa76d=['../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x2658c8,_0x5197a3){var _0x377f10=function(_0x59aab8){while(--_0x59aab8){_0x2658c8['push'](_0x2658c8['shift']());}};_0x377f10(++_0x5197a3);}(_0xa76d,0x89));var _0xda76=function(_0x1cd231,_0x43a0ee){_0x1cd231=_0x1cd231-0x0;var _0x2cc3bd=_0xa76d[_0x1cd231];return _0x2cc3bd;};'use strict';var _=require(_0xda76('0x0'));var util=require(_0xda76('0x1'));var logger=require(_0xda76('0x2'))(_0xda76('0x3'));var moment=require(_0xda76('0x4'));var BPromise=require(_0xda76('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xda76('0x6'));var config=require(_0xda76('0x7'));var attributes=require(_0xda76('0x8'));module[_0xda76('0x9')]=function(_0x2c1ce6,_0x2a8fc2){return _0x2c1ce6[_0xda76('0xa')](_0xda76('0xb'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x387ed2,_0x2958d3,_0x2b5572){if(_0x387ed2['changed'](_0xda76('0xc'))){_0x387ed2[_0xda76('0xd')]=moment()[_0xda76('0xe')](_0xda76('0xf'));}_0x2b5572(null,_0x387ed2);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 3b1a1c0..4f1cf92 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 _0xa638=['FaxInteraction,\x20%s,\x20%s','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','UpdateFaxInteraction','FaxInteraction','options','raw','where','limit','then','find','addTags','omit','body','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','request'];(function(_0x31b723,_0x367cd0){var _0x445234=function(_0x3fe82e){while(--_0x3fe82e){_0x31b723['push'](_0x31b723['shift']());}};_0x445234(++_0x367cd0);}(_0xa638,0x146));var _0x8a63=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xa638[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x8a63('0x0'));var util=require(_0x8a63('0x1'));var moment=require(_0x8a63('0x2'));var BPromise=require(_0x8a63('0x3'));var rs=require(_0x8a63('0x4'));var fs=require('fs');var Redis=require(_0x8a63('0x5'));var db=require(_0x8a63('0x6'))['db'];var utils=require(_0x8a63('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x8a63('0x8'));var jayson=require(_0x8a63('0x9'));var client=jayson[_0x8a63('0xa')][_0x8a63('0xb')]({'port':0x232a});config[_0x8a63('0xc')]=_[_0x8a63('0xd')](config[_0x8a63('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x8a63('0xe'))(new Redis(config[_0x8a63('0xc')]));require(_0x8a63('0xf'))[_0x8a63('0x10')](socket);function respondWithRpcPromise(_0x18a9fc,_0x1dece7,_0x127e7b){return new BPromise(function(_0x16dcdb,_0x5522c3){return client[_0x8a63('0x11')](_0x18a9fc,_0x127e7b)['then'](function(_0x2cc650){logger['info'](_0x8a63('0x12'),_0x1dece7,'request\x20sent');logger[_0x8a63('0x13')](_0x8a63('0x14'),_0x1dece7,_0x8a63('0x15'),JSON[_0x8a63('0x16')](_0x2cc650));if(_0x2cc650[_0x8a63('0x17')]){if(_0x2cc650['error'][_0x8a63('0x18')]===0x1f4){logger[_0x8a63('0x17')](_0x8a63('0x12'),_0x1dece7,_0x2cc650['error'][_0x8a63('0x19')]);return _0x5522c3(_0x2cc650[_0x8a63('0x17')][_0x8a63('0x19')]);}logger[_0x8a63('0x17')](_0x8a63('0x12'),_0x1dece7,_0x2cc650['error'][_0x8a63('0x19')]);return _0x16dcdb(_0x2cc650[_0x8a63('0x17')][_0x8a63('0x19')]);}else{logger[_0x8a63('0x1a')](_0x8a63('0x12'),_0x1dece7,_0x8a63('0x15'));_0x16dcdb(_0x2cc650[_0x8a63('0x1b')][_0x8a63('0x19')]);}})[_0x8a63('0x1c')](function(_0x631734){logger[_0x8a63('0x17')](_0x8a63('0x12'),_0x1dece7,_0x631734);_0x5522c3(_0x631734);});});}exports[_0x8a63('0x1d')]=function(_0x2f15fc){var _0x2b0da7=this;return new Promise(function(_0x2cbee5,_0xd0655a){return db[_0x8a63('0x1e')]['update'](_0x2f15fc['body'],{'raw':_0x2f15fc[_0x8a63('0x1f')]?_0x2f15fc[_0x8a63('0x1f')][_0x8a63('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f15fc[_0x8a63('0x1f')]?_0x2f15fc[_0x8a63('0x1f')][_0x8a63('0x21')]||null:null,'attributes':_0x2f15fc[_0x8a63('0x1f')]?_0x2f15fc[_0x8a63('0x1f')]['attributes']||null:null,'limit':_0x2f15fc[_0x8a63('0x1f')]?_0x2f15fc[_0x8a63('0x1f')][_0x8a63('0x22')]||null:null})[_0x8a63('0x23')](function(_0x47dacf){logger[_0x8a63('0x1a')](_0x8a63('0x1d'),_0x2f15fc);logger[_0x8a63('0x13')](_0x8a63('0x1d'),_0x2f15fc,JSON['stringify'](_0x47dacf));_0x2cbee5(_0x47dacf);})[_0x8a63('0x1c')](function(_0x3c1c83){logger[_0x8a63('0x17')]('UpdateFaxInteraction',_0x3c1c83[_0x8a63('0x19')],_0x2f15fc);_0xd0655a(_0x2b0da7[_0x8a63('0x17')](0x1f4,_0x3c1c83['message']));});});};exports['AddTagsToFaxInteraction']=function(_0x3e0fe7){return new Promise(function(_0x41be65,_0x401f49){return db['FaxInteraction'][_0x8a63('0x24')]({'where':_0x3e0fe7['options']?_0x3e0fe7[_0x8a63('0x1f')][_0x8a63('0x21')]||null:null})['then'](function(_0x498fab){if(_0x498fab){return _0x498fab[_0x8a63('0x25')](_0x3e0fe7['body']['ids'],_[_0x8a63('0x26')](_0x3e0fe7[_0x8a63('0x27')],[_0x8a63('0x28'),'id'])||{});}})[_0x8a63('0x29')](function(_0x1e6bdd){logger[_0x8a63('0x1a')]('AddTags',_0x3e0fe7);logger[_0x8a63('0x13')](_0x8a63('0x2a'),_0x3e0fe7,JSON['stringify'](_0x1e6bdd));_0x41be65(_0x1e6bdd);})['catch'](function(_0x405561){logger[_0x8a63('0x17')](_0x8a63('0x2a'),_0x405561[_0x8a63('0x19')],_0x3e0fe7);_0x401f49(_this[_0x8a63('0x17')](0x1f4,_0x405561['message']));});});}; \ No newline at end of file +var _0x691d=['request\x20sent','stringify','error','code','message','info','result','catch','UpdateFaxInteraction','update','options','attributes','limit','debug','AddTagsToFaxInteraction','FaxInteraction','find','where','addTags','body','ids','omit','spread','AddTags','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','FaxInteraction,\x20%s,\x20%s'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x691d,0x145));var _0xd691=function(_0x33fa3a,_0x44ebd4){_0x33fa3a=_0x33fa3a-0x0;var _0x2d454f=_0x691d[_0x33fa3a];return _0x2d454f;};'use strict';var _=require(_0xd691('0x0'));var util=require('util');var moment=require(_0xd691('0x1'));var BPromise=require('bluebird');var rs=require(_0xd691('0x2'));var fs=require('fs');var Redis=require(_0xd691('0x3'));var db=require(_0xd691('0x4'))['db'];var utils=require(_0xd691('0x5'));var logger=require(_0xd691('0x6'))(_0xd691('0x7'));var config=require(_0xd691('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd691('0x9')][_0xd691('0xa')]({'port':0x232a});config[_0xd691('0xb')]=_[_0xd691('0xc')](config[_0xd691('0xb')],{'host':_0xd691('0xd'),'port':0x18eb});var socket=require(_0xd691('0xe'))(new Redis(config[_0xd691('0xb')]));require('./faxInteraction.socket')[_0xd691('0xf')](socket);function respondWithRpcPromise(_0xe9e1b9,_0x2b299d,_0x57c402){return new BPromise(function(_0x218cac,_0x471679){return client[_0xd691('0x10')](_0xe9e1b9,_0x57c402)[_0xd691('0x11')](function(_0x599b22){logger['info'](_0xd691('0x12'),_0x2b299d,_0xd691('0x13'));logger['debug']('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x2b299d,_0xd691('0x13'),JSON[_0xd691('0x14')](_0x599b22));if(_0x599b22[_0xd691('0x15')]){if(_0x599b22['error'][_0xd691('0x16')]===0x1f4){logger[_0xd691('0x15')](_0xd691('0x12'),_0x2b299d,_0x599b22[_0xd691('0x15')][_0xd691('0x17')]);return _0x471679(_0x599b22[_0xd691('0x15')][_0xd691('0x17')]);}logger[_0xd691('0x15')]('FaxInteraction,\x20%s,\x20%s',_0x2b299d,_0x599b22['error'][_0xd691('0x17')]);return _0x218cac(_0x599b22[_0xd691('0x15')][_0xd691('0x17')]);}else{logger[_0xd691('0x18')](_0xd691('0x12'),_0x2b299d,_0xd691('0x13'));_0x218cac(_0x599b22[_0xd691('0x19')]['message']);}})[_0xd691('0x1a')](function(_0x9ae61f){logger['error'](_0xd691('0x12'),_0x2b299d,_0x9ae61f);_0x471679(_0x9ae61f);});});}exports[_0xd691('0x1b')]=function(_0x4d2a41){var _0x275ac9=this;return new Promise(function(_0x2e6312,_0x1653b3){return db['FaxInteraction'][_0xd691('0x1c')](_0x4d2a41['body'],{'raw':_0x4d2a41['options']?_0x4d2a41['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d2a41[_0xd691('0x1d')]?_0x4d2a41[_0xd691('0x1d')]['where']||null:null,'attributes':_0x4d2a41[_0xd691('0x1d')]?_0x4d2a41[_0xd691('0x1d')][_0xd691('0x1e')]||null:null,'limit':_0x4d2a41[_0xd691('0x1d')]?_0x4d2a41[_0xd691('0x1d')][_0xd691('0x1f')]||null:null})['then'](function(_0x2eec4b){logger['info'](_0xd691('0x1b'),_0x4d2a41);logger[_0xd691('0x20')](_0xd691('0x1b'),_0x4d2a41,JSON[_0xd691('0x14')](_0x2eec4b));_0x2e6312(_0x2eec4b);})['catch'](function(_0x2f38c8){logger[_0xd691('0x15')](_0xd691('0x1b'),_0x2f38c8[_0xd691('0x17')],_0x4d2a41);_0x1653b3(_0x275ac9[_0xd691('0x15')](0x1f4,_0x2f38c8[_0xd691('0x17')]));});});};exports[_0xd691('0x21')]=function(_0x195741){return new Promise(function(_0x1c42f2,_0x47606c){return db[_0xd691('0x22')][_0xd691('0x23')]({'where':_0x195741[_0xd691('0x1d')]?_0x195741[_0xd691('0x1d')][_0xd691('0x24')]||null:null})[_0xd691('0x11')](function(_0x15283f){if(_0x15283f){return _0x15283f[_0xd691('0x25')](_0x195741[_0xd691('0x26')][_0xd691('0x27')],_[_0xd691('0x28')](_0x195741['body'],['ids','id'])||{});}})[_0xd691('0x29')](function(_0x2d84a3){logger[_0xd691('0x18')](_0xd691('0x2a'),_0x195741);logger[_0xd691('0x20')](_0xd691('0x2a'),_0x195741,JSON['stringify'](_0x2d84a3));_0x1c42f2(_0x2d84a3);})[_0xd691('0x1a')](function(_0x2dd72e){logger[_0xd691('0x15')](_0xd691('0x2a'),_0x2dd72e[_0xd691('0x17')],_0x195741);_0x47606c(_this[_0xd691('0x15')](0x1f4,_0x2dd72e[_0xd691('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 382dd9c..11e94ab 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 _0x7094=['length','faxInteraction:','./faxInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x425ef7,_0x2444ec){var _0x463339=function(_0x157dfb){while(--_0x157dfb){_0x425ef7['push'](_0x425ef7['shift']());}};_0x463339(++_0x2444ec);}(_0x7094,0xda));var _0x4709=function(_0x578ad4,_0x2f3607){_0x578ad4=_0x578ad4-0x0;var _0x4ecc08=_0x7094[_0x578ad4];return _0x4ecc08;};'use strict';var FaxInteractionEvents=require(_0x4709('0x0'));var events=[_0x4709('0x1'),_0x4709('0x2'),_0x4709('0x3')];function createListener(_0x28f7f1,_0x7655d3){return function(_0x106280){_0x7655d3[_0x4709('0x4')](_0x28f7f1,_0x106280);};}function removeListener(_0x12bdb5,_0x54aeed){return function(){FaxInteractionEvents[_0x4709('0x5')](_0x12bdb5,_0x54aeed);};}exports[_0x4709('0x6')]=function(_0x4ddff8){for(var _0x3aa2af=0x0,_0x263039=events[_0x4709('0x7')];_0x3aa2af<_0x263039;_0x3aa2af++){var _0x5d1d8a=events[_0x3aa2af];var _0x5efdb4=createListener(_0x4709('0x8')+_0x5d1d8a,_0x4ddff8);FaxInteractionEvents['on'](_0x5d1d8a,_0x5efdb4);}}; \ No newline at end of file +var _0x0c1f=['removeListener','register','length','faxInteraction:','./faxInteraction.events','save','update','emit'];(function(_0x118473,_0xbb29c){var _0x2634bb=function(_0x37a87b){while(--_0x37a87b){_0x118473['push'](_0x118473['shift']());}};_0x2634bb(++_0xbb29c);}(_0x0c1f,0xec));var _0xf0c1=function(_0x35027c,_0x4af623){_0x35027c=_0x35027c-0x0;var _0x4bba7d=_0x0c1f[_0x35027c];return _0x4bba7d;};'use strict';var FaxInteractionEvents=require(_0xf0c1('0x0'));var events=[_0xf0c1('0x1'),'remove',_0xf0c1('0x2')];function createListener(_0x41648b,_0x591f10){return function(_0x59189c){_0x591f10[_0xf0c1('0x3')](_0x41648b,_0x59189c);};}function removeListener(_0x3251fd,_0x3d8e32){return function(){FaxInteractionEvents[_0xf0c1('0x4')](_0x3251fd,_0x3d8e32);};}exports[_0xf0c1('0x5')]=function(_0x354eeb){for(var _0xbfc4c5=0x0,_0x33cffd=events[_0xf0c1('0x6')];_0xbfc4c5<_0x33cffd;_0xbfc4c5++){var _0x24e236=events[_0xbfc4c5];var _0x23f02e=createListener(_0xf0c1('0x7')+_0x24e236,_0x354eeb);FaxInteractionEvents['on'](_0x24e236,_0x23f02e);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 5dc3f7e..202ea64 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 _0x0911=['delete','/:id','faxinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','post','addMessage','/:id/tags','tracked','fax','update'];(function(_0x4baac3,_0x481c9a){var _0x4fb4bc=function(_0x27d865){while(--_0x27d865){_0x4baac3['push'](_0x4baac3['shift']());}};_0x4fb4bc(++_0x481c9a);}(_0x0911,0x1a9));var _0x1091=function(_0xd299c3,_0x4ba0f1){_0xd299c3=_0xd299c3-0x0;var _0x376574=_0x0911[_0xd299c3];return _0x376574;};'use strict';var multer=require(_0x1091('0x0'));var util=require(_0x1091('0x1'));var path=require(_0x1091('0x2'));var timeout=require(_0x1091('0x3'));var express=require(_0x1091('0x4'));var router=express['Router']();var auth=require(_0x1091('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1091('0x6'));var controller=require(_0x1091('0x7'));router[_0x1091('0x8')]('/',auth[_0x1091('0x9')](),controller[_0x1091('0xa')]);router[_0x1091('0x8')](_0x1091('0xb'),auth[_0x1091('0x9')](),controller[_0x1091('0xc')]);router[_0x1091('0x8')]('/:id',auth[_0x1091('0x9')](),controller[_0x1091('0xd')]);router[_0x1091('0x8')](_0x1091('0xe'),auth[_0x1091('0x9')](),controller[_0x1091('0xf')]);router['get'](_0x1091('0x10'),auth[_0x1091('0x9')](),controller['download']);router['post']('/',auth[_0x1091('0x9')](),controller['create']);router[_0x1091('0x11')]('/:id/messages',auth[_0x1091('0x9')](),controller[_0x1091('0x12')]);router[_0x1091('0x11')](_0x1091('0x13'),auth['isAuthenticated'](),interaction[_0x1091('0x14')](_0x1091('0x15'),'faxinteraction:addtags'),controller['addTags']);router['put']('/:id',auth[_0x1091('0x9')](),interaction[_0x1091('0x14')](_0x1091('0x15'),'faxinteraction:update'),controller[_0x1091('0x16')]);router[_0x1091('0x17')](_0x1091('0x18'),auth[_0x1091('0x9')](),interaction[_0x1091('0x14')]('fax',_0x1091('0x19')),controller[_0x1091('0x1a')]);router[_0x1091('0x17')](_0x1091('0x13'),auth[_0x1091('0x9')](),controller['removeTags']);module[_0x1091('0x1b')]=router; \ No newline at end of file +var _0xa09f=['create','post','addMessage','fax','addTags','/:id','faxinteraction:update','update','delete','tracked','faxinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','express','Router','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','getMessages','/:id/download'];(function(_0x39fddc,_0x2e3041){var _0x4a3cc0=function(_0xb0ffc1){while(--_0xb0ffc1){_0x39fddc['push'](_0x39fddc['shift']());}};_0x4a3cc0(++_0x2e3041);}(_0xa09f,0xdf));var _0xfa09=function(_0xba8162,_0x2c9248){_0xba8162=_0xba8162-0x0;var _0x33c411=_0xa09f[_0xba8162];return _0x33c411;};'use strict';var multer=require(_0xfa09('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfa09('0x1'));var router=express[_0xfa09('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xfa09('0x3'));var config=require(_0xfa09('0x4'));var controller=require(_0xfa09('0x5'));router[_0xfa09('0x6')]('/',auth[_0xfa09('0x7')](),controller[_0xfa09('0x8')]);router[_0xfa09('0x6')]('/describe',auth[_0xfa09('0x7')](),controller['describe']);router['get']('/:id',auth[_0xfa09('0x7')](),controller['show']);router[_0xfa09('0x6')]('/:id/messages',auth[_0xfa09('0x7')](),controller[_0xfa09('0x9')]);router[_0xfa09('0x6')](_0xfa09('0xa'),auth[_0xfa09('0x7')](),controller['download']);router['post']('/',auth[_0xfa09('0x7')](),controller[_0xfa09('0xb')]);router[_0xfa09('0xc')]('/:id/messages',auth[_0xfa09('0x7')](),controller[_0xfa09('0xd')]);router['post']('/:id/tags',auth[_0xfa09('0x7')](),interaction['tracked'](_0xfa09('0xe'),'faxinteraction:addtags'),controller[_0xfa09('0xf')]);router['put'](_0xfa09('0x10'),auth[_0xfa09('0x7')](),interaction['tracked'](_0xfa09('0xe'),_0xfa09('0x11')),controller[_0xfa09('0x12')]);router[_0xfa09('0x13')](_0xfa09('0x10'),auth[_0xfa09('0x7')](),interaction[_0xfa09('0x14')](_0xfa09('0xe'),_0xfa09('0x15')),controller[_0xfa09('0x16')]);router[_0xfa09('0x13')](_0xfa09('0x17'),auth[_0xfa09('0x7')](),controller[_0xfa09('0x18')]);module[_0xfa09('0x19')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 335baa7..641dbe6 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 _0x4e74=['DATE','exports','TEXT','medium','ENUM','out'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0x4e74,0xeb));var _0x44e7=function(_0x53b53e,_0x498437){_0x53b53e=_0x53b53e-0x0;var _0xbb6179=_0x4e74[_0x53b53e];return _0xbb6179;};'use strict';var Sequelize=require('sequelize');module[_0x44e7('0x0')]={'body':{'type':Sequelize[_0x44e7('0x1')](_0x44e7('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x44e7('0x3')]('in',_0x44e7('0x4')),'defaultValue':_0x44e7('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x44e7('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x44e7('0x5')]}}; \ No newline at end of file +var _0x0572=['sequelize','exports','TEXT','BOOLEAN','ENUM','out','DATE'];(function(_0x3c7362,_0x14f4ce){var _0x1aeed6=function(_0x46e204){while(--_0x46e204){_0x3c7362['push'](_0x3c7362['shift']());}};_0x1aeed6(++_0x14f4ce);}(_0x0572,0x142));var _0x2057=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x0572[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require(_0x2057('0x0'));module[_0x2057('0x1')]={'body':{'type':Sequelize[_0x2057('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x2057('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2057('0x4')]('in',_0x2057('0x5')),'defaultValue':_0x2057('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x2057('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x2057('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 5d6aa6e..a612eaa 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 _0xb10b=['read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','manual','interface','channel','EventManager','acceptmessage','fax','agent','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','event','create','Attachment','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','join','root','server','attachments','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','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','sendStatus','end','status','json','count','limit','Content-Range','apply','reject','update','stack','name','send','index','FaxMessage','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','find','body','destroy','describe','fax-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','get','FaxInteraction','isNil'];(function(_0x47b49d,_0x66e6fd){var _0x1af551=function(_0x3c5e0c){while(--_0x3c5e0c){_0x47b49d['push'](_0x47b49d['shift']());}};_0x1af551(++_0x66e6fd);}(_0xb10b,0x12a));var _0xbb10=function(_0x35e083,_0x2a67b7){_0x35e083=_0x35e083-0x0;var _0x4c1d88=_0xb10b[_0x35e083];return _0x4c1d88;};'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'];config[_0xbb10('0x18')]=_[_0xbb10('0x19')](config[_0xbb10('0x18')],{'host':_0xbb10('0x1a'),'port':0x18eb});var socket=require(_0xbb10('0x1b'))(new Redis(config[_0xbb10('0x18')]));require('./faxMessage.socket')[_0xbb10('0x1c')](socket);var jayson=require(_0xbb10('0x1d'));var client=jayson[_0xbb10('0x1e')][_0xbb10('0x1f')]({'port':0x232c});var client9002=jayson[_0xbb10('0x1e')][_0xbb10('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x24a57b,_0x36b5e8,_0x3e26f4){if(_0x3e26f4){var _0x2b184e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2b184e['test'](_0x36b5e8)){return _0x24a57b;}else{throw new db[(_0xbb10('0x20'))][(_0xbb10('0x21'))](_0xbb10('0x22'));}}else{return _0x24a57b;}}function respondWithRpcPromise(_0x42db98,_0x378da8,_0x1682a4,_0x575cca){return new BPromise(function(_0x30efc6,_0xbf2906){var _0xe1c665=_0x575cca||client;return _0xe1c665['request'](_0x42db98,_0x1682a4)[_0xbb10('0x23')](function(_0x19f48d){logger[_0xbb10('0x24')](_0xbb10('0x25'),_0x378da8,_0xbb10('0x26'));logger[_0xbb10('0x27')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x378da8,_0xbb10('0x26'),JSON[_0xbb10('0x28')](_0x19f48d));if(_0x19f48d['error']){if(_0x19f48d['error'][_0xbb10('0x29')]===0x1f4){logger[_0xbb10('0x2a')](_0xbb10('0x25'),_0x378da8,_0x19f48d[_0xbb10('0x2a')][_0xbb10('0x2b')]);return _0xbf2906(_0x19f48d[_0xbb10('0x2a')][_0xbb10('0x2b')]);}logger[_0xbb10('0x2a')](_0xbb10('0x25'),_0x378da8,_0x19f48d[_0xbb10('0x2a')][_0xbb10('0x2b')]);return _0x30efc6(_0x19f48d[_0xbb10('0x2a')]['message']);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x378da8,_0xbb10('0x26'));_0x30efc6(_0x19f48d[_0xbb10('0x2c')][_0xbb10('0x2b')]);}})['catch'](function(_0x2fdde9){logger[_0xbb10('0x2a')](_0xbb10('0x25'),_0x378da8,_0x2fdde9);_0xbf2906(_0x2fdde9);});});}function respondWithStatusCode(_0x1d5e95,_0x1acce9){_0x1acce9=_0x1acce9||0xcc;return function(_0x20d946){if(_0x20d946){return _0x1d5e95[_0xbb10('0x2d')](_0x1acce9);}return _0x1d5e95['status'](_0x1acce9)[_0xbb10('0x2e')]();};}function respondWithResult(_0x21ac54,_0xfc3595){_0xfc3595=_0xfc3595||0xc8;return function(_0x2e0249){if(_0x2e0249){return _0x21ac54[_0xbb10('0x2f')](_0xfc3595)[_0xbb10('0x30')](_0x2e0249);}};}function respondWithFilteredResult(_0x5d5c80,_0x221624){return function(_0x4ee02e){if(_0x4ee02e){var _0x448d5c=_0x4ee02e[_0xbb10('0x31')],_0x56f2da=_0x221624['offset'],_0x16ad2a=_0x221624['offset']+_0x221624[_0xbb10('0x32')],_0x1dcc9c;if(_0x16ad2a>=_0x448d5c){_0x16ad2a=_0x448d5c;_0x1dcc9c=0xc8;}else{_0x1dcc9c=0xce;}_0x5d5c80[_0xbb10('0x2f')](_0x1dcc9c);return _0x5d5c80['set'](_0xbb10('0x33'),_0x56f2da+'-'+_0x16ad2a+'/'+_0x448d5c)[_0xbb10('0x30')](_0x4ee02e);}return null;};}function patchUpdates(_0x2f653f){return function(_0x1c0b57){try{jsonpatch[_0xbb10('0x34')](_0x1c0b57,_0x2f653f,!![]);}catch(_0x138bc6){return BPromise[_0xbb10('0x35')](_0x138bc6);}return _0x1c0b57['save']();};}function saveUpdates(_0x25acb3,_0x1da9c9){return function(_0x441d15){if(_0x441d15){return _0x441d15[_0xbb10('0x36')](_0x25acb3)[_0xbb10('0x23')](function(_0x9de708){return _0x9de708;});}return null;};}function removeEntity(_0x188cbd,_0x10202c){return function(_0x3c8d7d){if(_0x3c8d7d){return _0x3c8d7d['destroy']()[_0xbb10('0x23')](function(){_0x188cbd[_0xbb10('0x2f')](0xcc)[_0xbb10('0x2e')]();});}};}function handleEntityNotFound(_0x3c3c45,_0x570f5a){return function(_0x111762){if(!_0x111762){_0x3c3c45['sendStatus'](0x194);}return _0x111762;};}function handleError(_0x4e2754,_0x3eb3cc){_0x3eb3cc=_0x3eb3cc||0x1f4;return function(_0x40c164){logger[_0xbb10('0x2a')](_0x40c164[_0xbb10('0x37')]);if(_0x40c164[_0xbb10('0x38')]){delete _0x40c164[_0xbb10('0x38')];}_0x4e2754['status'](_0x3eb3cc)[_0xbb10('0x39')](_0x40c164);};}exports[_0xbb10('0x3a')]=function(_0x52de31,_0x5e3fbd){var _0x5cd55f={},_0x31bee3={},_0x2b0b45={'count':0x0,'rows':[]};var _0x2b658a=_['map'](db[_0xbb10('0x3b')][_0xbb10('0x3c')],function(_0x4345f3){return{'name':_0x4345f3['fieldName'],'type':_0x4345f3[_0xbb10('0x3d')][_0xbb10('0x3e')]};});_0x31bee3[_0xbb10('0x3f')]=_[_0xbb10('0x40')](_0x2b658a,'name');_0x31bee3[_0xbb10('0x41')]=_[_0xbb10('0x42')](_0x52de31['query']);_0x31bee3[_0xbb10('0x43')]=_[_0xbb10('0x44')](_0x31bee3[_0xbb10('0x3f')],_0x31bee3[_0xbb10('0x41')]);_0x5cd55f[_0xbb10('0x45')]=_[_0xbb10('0x44')](_0x31bee3['model'],qs[_0xbb10('0x46')](_0x52de31[_0xbb10('0x41')][_0xbb10('0x46')]));_0x5cd55f[_0xbb10('0x45')]=_0x5cd55f['attributes'][_0xbb10('0x47')]?_0x5cd55f[_0xbb10('0x45')]:_0x31bee3[_0xbb10('0x3f')];if(!_0x52de31[_0xbb10('0x41')]['hasOwnProperty'](_0xbb10('0x48'))){_0x5cd55f[_0xbb10('0x32')]=qs['limit'](_0x52de31['query'][_0xbb10('0x32')]);_0x5cd55f['offset']=qs[_0xbb10('0x49')](_0x52de31[_0xbb10('0x41')]['offset']);}_0x5cd55f[_0xbb10('0x4a')]=qs[_0xbb10('0x4b')](_0x52de31[_0xbb10('0x41')]['sort']);_0x5cd55f[_0xbb10('0x4c')]=qs[_0xbb10('0x43')](_[_0xbb10('0x4d')](_0x52de31[_0xbb10('0x41')],_0x31bee3[_0xbb10('0x43')]));if(_0x52de31[_0xbb10('0x41')][_0xbb10('0x4e')]){_0x5cd55f[_0xbb10('0x4c')]=_[_0xbb10('0x4f')](_0x5cd55f[_0xbb10('0x4c')],{'$or':_[_0xbb10('0x40')](_0x2b658a,function(_0x1eadd2){if(_0x1eadd2['type']!==_0xbb10('0x50')){var _0x41bbf8={};_0x41bbf8[_0x1eadd2['name']]={'$like':'%'+_0x52de31[_0xbb10('0x41')][_0xbb10('0x4e')]+'%'};return _0x41bbf8;}})});}_0x5cd55f=_[_0xbb10('0x4f')]({},_0x5cd55f,_0x52de31[_0xbb10('0x51')]);var _0x41ea91={'where':_0x5cd55f[_0xbb10('0x4c')]};return db[_0xbb10('0x3b')]['count'](_0x41ea91)['then'](function(_0xcb3354){_0x2b0b45[_0xbb10('0x31')]=_0xcb3354;if(_0x52de31[_0xbb10('0x41')]['includeAll']){_0x5cd55f['include']=[{'all':!![]}];}return db[_0xbb10('0x3b')][_0xbb10('0x52')](_0x5cd55f);})[_0xbb10('0x23')](function(_0xf820fe){_0x2b0b45[_0xbb10('0x53')]=_0xf820fe;return _0x2b0b45;})[_0xbb10('0x23')](respondWithFilteredResult(_0x5e3fbd,_0x5cd55f))[_0xbb10('0x54')](handleError(_0x5e3fbd,null));};exports[_0xbb10('0x55')]=function(_0x2626d8,_0x3d7e7e){var _0x550111={'raw':!![],'where':{'id':_0x2626d8[_0xbb10('0x56')]['id']}},_0x5eafac={};_0x5eafac[_0xbb10('0x3f')]=_[_0xbb10('0x42')](db[_0xbb10('0x3b')][_0xbb10('0x3c')]);_0x5eafac[_0xbb10('0x41')]=_[_0xbb10('0x42')](_0x2626d8[_0xbb10('0x41')]);_0x5eafac[_0xbb10('0x43')]=_[_0xbb10('0x44')](_0x5eafac[_0xbb10('0x3f')],_0x5eafac[_0xbb10('0x41')]);_0x550111[_0xbb10('0x45')]=_[_0xbb10('0x44')](_0x5eafac[_0xbb10('0x3f')],qs['fields'](_0x2626d8[_0xbb10('0x41')]['fields']));_0x550111[_0xbb10('0x45')]=_0x550111[_0xbb10('0x45')][_0xbb10('0x47')]?_0x550111[_0xbb10('0x45')]:_0x5eafac[_0xbb10('0x3f')];if(_0x2626d8[_0xbb10('0x41')][_0xbb10('0x57')]){_0x550111[_0xbb10('0x58')]=[{'all':!![]}];}_0x550111=_[_0xbb10('0x4f')]({},_0x550111,_0x2626d8[_0xbb10('0x51')]);return db[_0xbb10('0x3b')][_0xbb10('0x59')](_0x550111)[_0xbb10('0x23')](handleEntityNotFound(_0x3d7e7e,null))[_0xbb10('0x23')](respondWithResult(_0x3d7e7e,null))[_0xbb10('0x54')](handleError(_0x3d7e7e,null));};exports['update']=function(_0x4571b6,_0x466eb7){if(_0x4571b6[_0xbb10('0x5a')]['id']){delete _0x4571b6[_0xbb10('0x5a')]['id'];}return db[_0xbb10('0x3b')][_0xbb10('0x59')]({'where':{'id':_0x4571b6['params']['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x466eb7,null))[_0xbb10('0x23')](saveUpdates(_0x4571b6[_0xbb10('0x5a')],null))[_0xbb10('0x23')](respondWithResult(_0x466eb7,null))[_0xbb10('0x54')](handleError(_0x466eb7,null));};exports[_0xbb10('0x5b')]=function(_0x175872,_0x12ec18){return db[_0xbb10('0x3b')][_0xbb10('0x59')]({'where':{'id':_0x175872[_0xbb10('0x56')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x12ec18,null))[_0xbb10('0x23')](removeEntity(_0x12ec18,null))['catch'](handleError(_0x12ec18,null));};exports['describe']=function(_0x16272d,_0x3e6338){return db[_0xbb10('0x3b')][_0xbb10('0x5c')]()['then'](respondWithResult(_0x3e6338,null))['catch'](handleError(_0x3e6338,null));};var interaction_log=require(_0xbb10('0x15'))(_0xbb10('0x5d'));exports[_0xbb10('0x5e')]=function(_0x2dd150,_0x412f13,_0x3e9753){var _0x45c0dc={'channel':'fax'};if(_0x2dd150[_0xbb10('0x5a')]['id']){delete _0x2dd150[_0xbb10('0x5a')]['id'];}_0x2dd150['body']['read']=!![];_0x2dd150['body'][_0xbb10('0x5f')]=moment()[_0xbb10('0x60')](_0xbb10('0x61'));_0x2dd150['body']['UserId']=_0x2dd150['body'][_0xbb10('0x62')]||_0x2dd150[_0xbb10('0x63')]['id'];return db[_0xbb10('0x3b')]['find']({'where':{'id':_0x2dd150[_0xbb10('0x56')]['id'],'UserId':null},'include':[{'model':db[_0xbb10('0x64')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x412f13,null))[_0xbb10('0x23')](saveUpdates(_0x2dd150[_0xbb10('0x5a')],null))[_0xbb10('0x23')](function(_0x237246){if(_0x237246){_0x45c0dc['message']=_0x237246[_0xbb10('0x65')]({'plain':!![]});return db[_0xbb10('0x66')][_0xbb10('0x59')]({'where':{'id':_0x237246['FaxInteractionId']}});}return null;})[_0xbb10('0x23')](handleEntityNotFound(_0x412f13,null))[_0xbb10('0x23')](function(_0x3e3617){if(_0x3e3617){return _0x3e3617['update']({'UserId':_0x2dd150[_0xbb10('0x5a')][_0xbb10('0x62')],'read1stAt':_[_0xbb10('0x67')](_0x3e3617[_0xbb10('0x68')])?moment()['format'](_0xbb10('0x61')):undefined});}return null;})[_0xbb10('0x23')](function(_0x108e5b){if(_0x108e5b){_0x45c0dc[_0xbb10('0x69')]=_0x108e5b['get']({'plain':!![]});interaction_log[_0xbb10('0x24')](_0xbb10('0x6a'),_0x2dd150[_0xbb10('0x63')]['id'],_0x2dd150[_0xbb10('0x63')][_0xbb10('0x38')],_0x2dd150[_0xbb10('0x63')][_0xbb10('0x6b')],_0x45c0dc['interaction']['id'],_0x2dd150['body']?JSON['stringify'](_0x2dd150[_0xbb10('0x5a')]):_0xbb10('0x6c'));return respondWithRpcPromise(_0xbb10('0x6d'),'acceptMessage',_0x45c0dc);}return null;})['then'](function(_0x46f462){if(_0x46f462){if(_0x2dd150[_0xbb10('0x5a')][_0xbb10('0x6e')]){_0x45c0dc[_0xbb10('0x2b')][_0xbb10('0x6f')]=util[_0xbb10('0x60')]('SIP/%s',_0x2dd150[_0xbb10('0x63')][_0xbb10('0x38')]);_0x45c0dc[_0xbb10('0x2b')][_0xbb10('0x70')]=_0x45c0dc[_0xbb10('0x70')];_0x45c0dc['message']['event']='accept';return respondWithRpcPromise(_0xbb10('0x71'),_0xbb10('0x71'),{'event':_0xbb10('0x72'),'message':_0x45c0dc[_0xbb10('0x2b')]},client9002)[_0xbb10('0x23')](function(){return _0x45c0dc;});}return _0x45c0dc;}return null;})[_0xbb10('0x23')](respondWithResult(_0x412f13,null))['catch'](handleError(_0x412f13,null));};var interaction_log=require(_0xbb10('0x15'))('fax-interactions');exports['reject']=function(_0x519a54,_0xdf634f,_0x13040d){var _0x23b1d5={'agent':{},'channel':_0xbb10('0x73')};if(_0x519a54['body']['id']){delete _0x519a54[_0xbb10('0x5a')]['id'];}_0x519a54['body']['UserId']=_0x519a54[_0xbb10('0x5a')][_0xbb10('0x62')]||_0x519a54[_0xbb10('0x63')]['id'];_0x23b1d5[_0xbb10('0x74')]['id']=_0x519a54[_0xbb10('0x5a')]['UserId'];return db[_0xbb10('0x3b')][_0xbb10('0x59')]({'where':{'id':_0x519a54[_0xbb10('0x56')]['id'],'UserId':null}})[_0xbb10('0x23')](handleEntityNotFound(_0xdf634f,null))[_0xbb10('0x23')](function(_0x27f42f){if(_0x27f42f){_0x23b1d5[_0xbb10('0x2b')]=_0x27f42f['get']({'plain':!![]});return db[_0xbb10('0x66')][_0xbb10('0x59')]({'where':{'id':_0x27f42f[_0xbb10('0x75')]}});}return null;})[_0xbb10('0x23')](handleEntityNotFound(_0xdf634f,null))[_0xbb10('0x23')](function(_0x172be3){if(_0x172be3){_0x23b1d5[_0xbb10('0x69')]=_0x172be3[_0xbb10('0x65')]({'plain':!![]});interaction_log['info'](_0xbb10('0x76'),_0x519a54[_0xbb10('0x63')]['id'],_0x519a54[_0xbb10('0x63')]['name'],_0x519a54['user']['role'],_0x23b1d5[_0xbb10('0x69')]['id'],_0x519a54['body']?JSON['stringify'](_0x519a54[_0xbb10('0x5a')]):_0xbb10('0x6c'));return respondWithRpcPromise(_0xbb10('0x77'),_0xbb10('0x78'),_0x23b1d5);}return null;})[_0xbb10('0x23')](function(_0x24dca6){if(_0x24dca6){_0x24dca6[_0xbb10('0x2b')][_0xbb10('0x6f')]=util[_0xbb10('0x60')]('SIP/%s',_0x519a54[_0xbb10('0x63')][_0xbb10('0x38')]);_0x24dca6[_0xbb10('0x2b')][_0xbb10('0x70')]=_0x23b1d5['channel'];_0x24dca6['message'][_0xbb10('0x79')]=_0xbb10('0x35');respondWithRpcPromise(_0xbb10('0x71'),_0xbb10('0x71'),{'event':'rejectmessage','message':_0x24dca6[_0xbb10('0x2b')]},client9002);return _0x23b1d5;}return null;})[_0xbb10('0x23')](respondWithResult(_0xdf634f,null))[_0xbb10('0x54')](handleError(_0xdf634f,null));};exports[_0xbb10('0x7a')]=function(_0x35c1e8,_0x517185){var _0x5f0691;return db[_0xbb10('0x3b')][_0xbb10('0x7a')](_0x35c1e8[_0xbb10('0x5a')],{})['then'](function(_0x256b35){_0x5f0691=_0x256b35;return db[_0xbb10('0x64')]['findOne']({'where':{'id':_0x5f0691['ContactId']}});})[_0xbb10('0x23')](function(_0x26d0dd){if(_[_0xbb10('0x67')](_0x26d0dd)){return;}else{_0x5f0691['fax']=_0x26d0dd[_0xbb10('0x73')];return db[_0xbb10('0x7b')][_0xbb10('0x7c')]({'where':{'id':_0x5f0691[_0xbb10('0x7d')]}});}})[_0xbb10('0x23')](function(_0x5de006){return respondWithRpcPromise(_0xbb10('0x7e'),_0xbb10('0x7e'),{'FaxAccountId':_[_0xbb10('0x67')](_0x35c1e8['body'])?undefined:_0x35c1e8[_0xbb10('0x5a')][_0xbb10('0x7f')],'path':_[_0xbb10('0x67')](_0x5de006)?undefined:util[_0xbb10('0x60')](_0xbb10('0x80'),_0x5de006[_0xbb10('0x81')]),'fax':_[_0xbb10('0x67')](_0x5f0691[_0xbb10('0x73')])?undefined:_0x5f0691[_0xbb10('0x73')],'AttachmentId':_0x5f0691[_0xbb10('0x7d')]},client9002);})[_0xbb10('0x23')](respondWithResult(_0x517185,0xc9))[_0xbb10('0x54')](handleError(_0x517185,null));};exports['download']=function(_0x51f106,_0xe1fc51){var _0x3fa344=path[_0xbb10('0x82')](config[_0xbb10('0x83')],_0xbb10('0x84'),'files',_0xbb10('0x85'));return db[_0xbb10('0x3b')][_0xbb10('0x59')]({'where':{'id':_0x51f106[_0xbb10('0x56')]['id']},'include':[{'model':db[_0xbb10('0x7b')],'as':_0xbb10('0x7b')}]})['then'](handleEntityNotFound(_0xe1fc51,null))[_0xbb10('0x23')](function(_0x742e10){if(_0x742e10){return _0xe1fc51['download'](path[_0xbb10('0x82')](_0x3fa344,_0x742e10['Attachment'][_0xbb10('0x81')]));}})[_0xbb10('0x54')](handleError(_0xe1fc51,null));}; \ No newline at end of file +var _0xb10b=['read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','manual','interface','channel','EventManager','acceptmessage','fax','agent','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','event','create','Attachment','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','join','root','server','attachments','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','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','sendStatus','end','status','json','count','limit','Content-Range','apply','reject','update','stack','name','send','index','FaxMessage','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','find','body','destroy','describe','fax-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','get','FaxInteraction','isNil'];(function(_0x59bfca,_0x9a39d){var _0x137740=function(_0x52d9e9){while(--_0x52d9e9){_0x59bfca['push'](_0x59bfca['shift']());}};_0x137740(++_0x9a39d);}(_0xb10b,0x12a));var _0xbb10=function(_0x20d237,_0x6a4566){_0x20d237=_0x20d237-0x0;var _0x37b1f4=_0xb10b[_0x20d237];return _0x37b1f4;};'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'];config[_0xbb10('0x18')]=_[_0xbb10('0x19')](config[_0xbb10('0x18')],{'host':_0xbb10('0x1a'),'port':0x18eb});var socket=require(_0xbb10('0x1b'))(new Redis(config[_0xbb10('0x18')]));require('./faxMessage.socket')[_0xbb10('0x1c')](socket);var jayson=require(_0xbb10('0x1d'));var client=jayson[_0xbb10('0x1e')][_0xbb10('0x1f')]({'port':0x232c});var client9002=jayson[_0xbb10('0x1e')][_0xbb10('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x24a57b,_0x36b5e8,_0x3e26f4){if(_0x3e26f4){var _0x2b184e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2b184e['test'](_0x36b5e8)){return _0x24a57b;}else{throw new db[(_0xbb10('0x20'))][(_0xbb10('0x21'))](_0xbb10('0x22'));}}else{return _0x24a57b;}}function respondWithRpcPromise(_0x42db98,_0x378da8,_0x1682a4,_0x575cca){return new BPromise(function(_0x30efc6,_0xbf2906){var _0xe1c665=_0x575cca||client;return _0xe1c665['request'](_0x42db98,_0x1682a4)[_0xbb10('0x23')](function(_0x19f48d){logger[_0xbb10('0x24')](_0xbb10('0x25'),_0x378da8,_0xbb10('0x26'));logger[_0xbb10('0x27')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x378da8,_0xbb10('0x26'),JSON[_0xbb10('0x28')](_0x19f48d));if(_0x19f48d['error']){if(_0x19f48d['error'][_0xbb10('0x29')]===0x1f4){logger[_0xbb10('0x2a')](_0xbb10('0x25'),_0x378da8,_0x19f48d[_0xbb10('0x2a')][_0xbb10('0x2b')]);return _0xbf2906(_0x19f48d[_0xbb10('0x2a')][_0xbb10('0x2b')]);}logger[_0xbb10('0x2a')](_0xbb10('0x25'),_0x378da8,_0x19f48d[_0xbb10('0x2a')][_0xbb10('0x2b')]);return _0x30efc6(_0x19f48d[_0xbb10('0x2a')]['message']);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x378da8,_0xbb10('0x26'));_0x30efc6(_0x19f48d[_0xbb10('0x2c')][_0xbb10('0x2b')]);}})['catch'](function(_0x2fdde9){logger[_0xbb10('0x2a')](_0xbb10('0x25'),_0x378da8,_0x2fdde9);_0xbf2906(_0x2fdde9);});});}function respondWithStatusCode(_0x1d5e95,_0x1acce9){_0x1acce9=_0x1acce9||0xcc;return function(_0x20d946){if(_0x20d946){return _0x1d5e95[_0xbb10('0x2d')](_0x1acce9);}return _0x1d5e95['status'](_0x1acce9)[_0xbb10('0x2e')]();};}function respondWithResult(_0x21ac54,_0xfc3595){_0xfc3595=_0xfc3595||0xc8;return function(_0x2e0249){if(_0x2e0249){return _0x21ac54[_0xbb10('0x2f')](_0xfc3595)[_0xbb10('0x30')](_0x2e0249);}};}function respondWithFilteredResult(_0x5d5c80,_0x221624){return function(_0x4ee02e){if(_0x4ee02e){var _0x448d5c=_0x4ee02e[_0xbb10('0x31')],_0x56f2da=_0x221624['offset'],_0x16ad2a=_0x221624['offset']+_0x221624[_0xbb10('0x32')],_0x1dcc9c;if(_0x16ad2a>=_0x448d5c){_0x16ad2a=_0x448d5c;_0x1dcc9c=0xc8;}else{_0x1dcc9c=0xce;}_0x5d5c80[_0xbb10('0x2f')](_0x1dcc9c);return _0x5d5c80['set'](_0xbb10('0x33'),_0x56f2da+'-'+_0x16ad2a+'/'+_0x448d5c)[_0xbb10('0x30')](_0x4ee02e);}return null;};}function patchUpdates(_0x2f653f){return function(_0x1c0b57){try{jsonpatch[_0xbb10('0x34')](_0x1c0b57,_0x2f653f,!![]);}catch(_0x138bc6){return BPromise[_0xbb10('0x35')](_0x138bc6);}return _0x1c0b57['save']();};}function saveUpdates(_0x25acb3,_0x1da9c9){return function(_0x441d15){if(_0x441d15){return _0x441d15[_0xbb10('0x36')](_0x25acb3)[_0xbb10('0x23')](function(_0x9de708){return _0x9de708;});}return null;};}function removeEntity(_0x188cbd,_0x10202c){return function(_0x3c8d7d){if(_0x3c8d7d){return _0x3c8d7d['destroy']()[_0xbb10('0x23')](function(){_0x188cbd[_0xbb10('0x2f')](0xcc)[_0xbb10('0x2e')]();});}};}function handleEntityNotFound(_0x3c3c45,_0x570f5a){return function(_0x111762){if(!_0x111762){_0x3c3c45['sendStatus'](0x194);}return _0x111762;};}function handleError(_0x4e2754,_0x3eb3cc){_0x3eb3cc=_0x3eb3cc||0x1f4;return function(_0x40c164){logger[_0xbb10('0x2a')](_0x40c164[_0xbb10('0x37')]);if(_0x40c164[_0xbb10('0x38')]){delete _0x40c164[_0xbb10('0x38')];}_0x4e2754['status'](_0x3eb3cc)[_0xbb10('0x39')](_0x40c164);};}exports[_0xbb10('0x3a')]=function(_0x52de31,_0x5e3fbd){var _0x5cd55f={},_0x31bee3={},_0x2b0b45={'count':0x0,'rows':[]};var _0x2b658a=_['map'](db[_0xbb10('0x3b')][_0xbb10('0x3c')],function(_0x4345f3){return{'name':_0x4345f3['fieldName'],'type':_0x4345f3[_0xbb10('0x3d')][_0xbb10('0x3e')]};});_0x31bee3[_0xbb10('0x3f')]=_[_0xbb10('0x40')](_0x2b658a,'name');_0x31bee3[_0xbb10('0x41')]=_[_0xbb10('0x42')](_0x52de31['query']);_0x31bee3[_0xbb10('0x43')]=_[_0xbb10('0x44')](_0x31bee3[_0xbb10('0x3f')],_0x31bee3[_0xbb10('0x41')]);_0x5cd55f[_0xbb10('0x45')]=_[_0xbb10('0x44')](_0x31bee3['model'],qs[_0xbb10('0x46')](_0x52de31[_0xbb10('0x41')][_0xbb10('0x46')]));_0x5cd55f[_0xbb10('0x45')]=_0x5cd55f['attributes'][_0xbb10('0x47')]?_0x5cd55f[_0xbb10('0x45')]:_0x31bee3[_0xbb10('0x3f')];if(!_0x52de31[_0xbb10('0x41')]['hasOwnProperty'](_0xbb10('0x48'))){_0x5cd55f[_0xbb10('0x32')]=qs['limit'](_0x52de31['query'][_0xbb10('0x32')]);_0x5cd55f['offset']=qs[_0xbb10('0x49')](_0x52de31[_0xbb10('0x41')]['offset']);}_0x5cd55f[_0xbb10('0x4a')]=qs[_0xbb10('0x4b')](_0x52de31[_0xbb10('0x41')]['sort']);_0x5cd55f[_0xbb10('0x4c')]=qs[_0xbb10('0x43')](_[_0xbb10('0x4d')](_0x52de31[_0xbb10('0x41')],_0x31bee3[_0xbb10('0x43')]));if(_0x52de31[_0xbb10('0x41')][_0xbb10('0x4e')]){_0x5cd55f[_0xbb10('0x4c')]=_[_0xbb10('0x4f')](_0x5cd55f[_0xbb10('0x4c')],{'$or':_[_0xbb10('0x40')](_0x2b658a,function(_0x1eadd2){if(_0x1eadd2['type']!==_0xbb10('0x50')){var _0x41bbf8={};_0x41bbf8[_0x1eadd2['name']]={'$like':'%'+_0x52de31[_0xbb10('0x41')][_0xbb10('0x4e')]+'%'};return _0x41bbf8;}})});}_0x5cd55f=_[_0xbb10('0x4f')]({},_0x5cd55f,_0x52de31[_0xbb10('0x51')]);var _0x41ea91={'where':_0x5cd55f[_0xbb10('0x4c')]};return db[_0xbb10('0x3b')]['count'](_0x41ea91)['then'](function(_0xcb3354){_0x2b0b45[_0xbb10('0x31')]=_0xcb3354;if(_0x52de31[_0xbb10('0x41')]['includeAll']){_0x5cd55f['include']=[{'all':!![]}];}return db[_0xbb10('0x3b')][_0xbb10('0x52')](_0x5cd55f);})[_0xbb10('0x23')](function(_0xf820fe){_0x2b0b45[_0xbb10('0x53')]=_0xf820fe;return _0x2b0b45;})[_0xbb10('0x23')](respondWithFilteredResult(_0x5e3fbd,_0x5cd55f))[_0xbb10('0x54')](handleError(_0x5e3fbd,null));};exports[_0xbb10('0x55')]=function(_0x2626d8,_0x3d7e7e){var _0x550111={'raw':!![],'where':{'id':_0x2626d8[_0xbb10('0x56')]['id']}},_0x5eafac={};_0x5eafac[_0xbb10('0x3f')]=_[_0xbb10('0x42')](db[_0xbb10('0x3b')][_0xbb10('0x3c')]);_0x5eafac[_0xbb10('0x41')]=_[_0xbb10('0x42')](_0x2626d8[_0xbb10('0x41')]);_0x5eafac[_0xbb10('0x43')]=_[_0xbb10('0x44')](_0x5eafac[_0xbb10('0x3f')],_0x5eafac[_0xbb10('0x41')]);_0x550111[_0xbb10('0x45')]=_[_0xbb10('0x44')](_0x5eafac[_0xbb10('0x3f')],qs['fields'](_0x2626d8[_0xbb10('0x41')]['fields']));_0x550111[_0xbb10('0x45')]=_0x550111[_0xbb10('0x45')][_0xbb10('0x47')]?_0x550111[_0xbb10('0x45')]:_0x5eafac[_0xbb10('0x3f')];if(_0x2626d8[_0xbb10('0x41')][_0xbb10('0x57')]){_0x550111[_0xbb10('0x58')]=[{'all':!![]}];}_0x550111=_[_0xbb10('0x4f')]({},_0x550111,_0x2626d8[_0xbb10('0x51')]);return db[_0xbb10('0x3b')][_0xbb10('0x59')](_0x550111)[_0xbb10('0x23')](handleEntityNotFound(_0x3d7e7e,null))[_0xbb10('0x23')](respondWithResult(_0x3d7e7e,null))[_0xbb10('0x54')](handleError(_0x3d7e7e,null));};exports['update']=function(_0x4571b6,_0x466eb7){if(_0x4571b6[_0xbb10('0x5a')]['id']){delete _0x4571b6[_0xbb10('0x5a')]['id'];}return db[_0xbb10('0x3b')][_0xbb10('0x59')]({'where':{'id':_0x4571b6['params']['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x466eb7,null))[_0xbb10('0x23')](saveUpdates(_0x4571b6[_0xbb10('0x5a')],null))[_0xbb10('0x23')](respondWithResult(_0x466eb7,null))[_0xbb10('0x54')](handleError(_0x466eb7,null));};exports[_0xbb10('0x5b')]=function(_0x175872,_0x12ec18){return db[_0xbb10('0x3b')][_0xbb10('0x59')]({'where':{'id':_0x175872[_0xbb10('0x56')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x12ec18,null))[_0xbb10('0x23')](removeEntity(_0x12ec18,null))['catch'](handleError(_0x12ec18,null));};exports['describe']=function(_0x16272d,_0x3e6338){return db[_0xbb10('0x3b')][_0xbb10('0x5c')]()['then'](respondWithResult(_0x3e6338,null))['catch'](handleError(_0x3e6338,null));};var interaction_log=require(_0xbb10('0x15'))(_0xbb10('0x5d'));exports[_0xbb10('0x5e')]=function(_0x2dd150,_0x412f13,_0x3e9753){var _0x45c0dc={'channel':'fax'};if(_0x2dd150[_0xbb10('0x5a')]['id']){delete _0x2dd150[_0xbb10('0x5a')]['id'];}_0x2dd150['body']['read']=!![];_0x2dd150['body'][_0xbb10('0x5f')]=moment()[_0xbb10('0x60')](_0xbb10('0x61'));_0x2dd150['body']['UserId']=_0x2dd150['body'][_0xbb10('0x62')]||_0x2dd150[_0xbb10('0x63')]['id'];return db[_0xbb10('0x3b')]['find']({'where':{'id':_0x2dd150[_0xbb10('0x56')]['id'],'UserId':null},'include':[{'model':db[_0xbb10('0x64')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x412f13,null))[_0xbb10('0x23')](saveUpdates(_0x2dd150[_0xbb10('0x5a')],null))[_0xbb10('0x23')](function(_0x237246){if(_0x237246){_0x45c0dc['message']=_0x237246[_0xbb10('0x65')]({'plain':!![]});return db[_0xbb10('0x66')][_0xbb10('0x59')]({'where':{'id':_0x237246['FaxInteractionId']}});}return null;})[_0xbb10('0x23')](handleEntityNotFound(_0x412f13,null))[_0xbb10('0x23')](function(_0x3e3617){if(_0x3e3617){return _0x3e3617['update']({'UserId':_0x2dd150[_0xbb10('0x5a')][_0xbb10('0x62')],'read1stAt':_[_0xbb10('0x67')](_0x3e3617[_0xbb10('0x68')])?moment()['format'](_0xbb10('0x61')):undefined});}return null;})[_0xbb10('0x23')](function(_0x108e5b){if(_0x108e5b){_0x45c0dc[_0xbb10('0x69')]=_0x108e5b['get']({'plain':!![]});interaction_log[_0xbb10('0x24')](_0xbb10('0x6a'),_0x2dd150[_0xbb10('0x63')]['id'],_0x2dd150[_0xbb10('0x63')][_0xbb10('0x38')],_0x2dd150[_0xbb10('0x63')][_0xbb10('0x6b')],_0x45c0dc['interaction']['id'],_0x2dd150['body']?JSON['stringify'](_0x2dd150[_0xbb10('0x5a')]):_0xbb10('0x6c'));return respondWithRpcPromise(_0xbb10('0x6d'),'acceptMessage',_0x45c0dc);}return null;})['then'](function(_0x46f462){if(_0x46f462){if(_0x2dd150[_0xbb10('0x5a')][_0xbb10('0x6e')]){_0x45c0dc[_0xbb10('0x2b')][_0xbb10('0x6f')]=util[_0xbb10('0x60')]('SIP/%s',_0x2dd150[_0xbb10('0x63')][_0xbb10('0x38')]);_0x45c0dc[_0xbb10('0x2b')][_0xbb10('0x70')]=_0x45c0dc[_0xbb10('0x70')];_0x45c0dc['message']['event']='accept';return respondWithRpcPromise(_0xbb10('0x71'),_0xbb10('0x71'),{'event':_0xbb10('0x72'),'message':_0x45c0dc[_0xbb10('0x2b')]},client9002)[_0xbb10('0x23')](function(){return _0x45c0dc;});}return _0x45c0dc;}return null;})[_0xbb10('0x23')](respondWithResult(_0x412f13,null))['catch'](handleError(_0x412f13,null));};var interaction_log=require(_0xbb10('0x15'))('fax-interactions');exports['reject']=function(_0x519a54,_0xdf634f,_0x13040d){var _0x23b1d5={'agent':{},'channel':_0xbb10('0x73')};if(_0x519a54['body']['id']){delete _0x519a54[_0xbb10('0x5a')]['id'];}_0x519a54['body']['UserId']=_0x519a54[_0xbb10('0x5a')][_0xbb10('0x62')]||_0x519a54[_0xbb10('0x63')]['id'];_0x23b1d5[_0xbb10('0x74')]['id']=_0x519a54[_0xbb10('0x5a')]['UserId'];return db[_0xbb10('0x3b')][_0xbb10('0x59')]({'where':{'id':_0x519a54[_0xbb10('0x56')]['id'],'UserId':null}})[_0xbb10('0x23')](handleEntityNotFound(_0xdf634f,null))[_0xbb10('0x23')](function(_0x27f42f){if(_0x27f42f){_0x23b1d5[_0xbb10('0x2b')]=_0x27f42f['get']({'plain':!![]});return db[_0xbb10('0x66')][_0xbb10('0x59')]({'where':{'id':_0x27f42f[_0xbb10('0x75')]}});}return null;})[_0xbb10('0x23')](handleEntityNotFound(_0xdf634f,null))[_0xbb10('0x23')](function(_0x172be3){if(_0x172be3){_0x23b1d5[_0xbb10('0x69')]=_0x172be3[_0xbb10('0x65')]({'plain':!![]});interaction_log['info'](_0xbb10('0x76'),_0x519a54[_0xbb10('0x63')]['id'],_0x519a54[_0xbb10('0x63')]['name'],_0x519a54['user']['role'],_0x23b1d5[_0xbb10('0x69')]['id'],_0x519a54['body']?JSON['stringify'](_0x519a54[_0xbb10('0x5a')]):_0xbb10('0x6c'));return respondWithRpcPromise(_0xbb10('0x77'),_0xbb10('0x78'),_0x23b1d5);}return null;})[_0xbb10('0x23')](function(_0x24dca6){if(_0x24dca6){_0x24dca6[_0xbb10('0x2b')][_0xbb10('0x6f')]=util[_0xbb10('0x60')]('SIP/%s',_0x519a54[_0xbb10('0x63')][_0xbb10('0x38')]);_0x24dca6[_0xbb10('0x2b')][_0xbb10('0x70')]=_0x23b1d5['channel'];_0x24dca6['message'][_0xbb10('0x79')]=_0xbb10('0x35');respondWithRpcPromise(_0xbb10('0x71'),_0xbb10('0x71'),{'event':'rejectmessage','message':_0x24dca6[_0xbb10('0x2b')]},client9002);return _0x23b1d5;}return null;})[_0xbb10('0x23')](respondWithResult(_0xdf634f,null))[_0xbb10('0x54')](handleError(_0xdf634f,null));};exports[_0xbb10('0x7a')]=function(_0x35c1e8,_0x517185){var _0x5f0691;return db[_0xbb10('0x3b')][_0xbb10('0x7a')](_0x35c1e8[_0xbb10('0x5a')],{})['then'](function(_0x256b35){_0x5f0691=_0x256b35;return db[_0xbb10('0x64')]['findOne']({'where':{'id':_0x5f0691['ContactId']}});})[_0xbb10('0x23')](function(_0x26d0dd){if(_[_0xbb10('0x67')](_0x26d0dd)){return;}else{_0x5f0691['fax']=_0x26d0dd[_0xbb10('0x73')];return db[_0xbb10('0x7b')][_0xbb10('0x7c')]({'where':{'id':_0x5f0691[_0xbb10('0x7d')]}});}})[_0xbb10('0x23')](function(_0x5de006){return respondWithRpcPromise(_0xbb10('0x7e'),_0xbb10('0x7e'),{'FaxAccountId':_[_0xbb10('0x67')](_0x35c1e8['body'])?undefined:_0x35c1e8[_0xbb10('0x5a')][_0xbb10('0x7f')],'path':_[_0xbb10('0x67')](_0x5de006)?undefined:util[_0xbb10('0x60')](_0xbb10('0x80'),_0x5de006[_0xbb10('0x81')]),'fax':_[_0xbb10('0x67')](_0x5f0691[_0xbb10('0x73')])?undefined:_0x5f0691[_0xbb10('0x73')],'AttachmentId':_0x5f0691[_0xbb10('0x7d')]},client9002);})[_0xbb10('0x23')](respondWithResult(_0x517185,0xc9))[_0xbb10('0x54')](handleError(_0x517185,null));};exports['download']=function(_0x51f106,_0xe1fc51){var _0x3fa344=path[_0xbb10('0x82')](config[_0xbb10('0x83')],_0xbb10('0x84'),'files',_0xbb10('0x85'));return db[_0xbb10('0x3b')][_0xbb10('0x59')]({'where':{'id':_0x51f106[_0xbb10('0x56')]['id']},'include':[{'model':db[_0xbb10('0x7b')],'as':_0xbb10('0x7b')}]})['then'](handleEntityNotFound(_0xe1fc51,null))[_0xbb10('0x23')](function(_0x742e10){if(_0x742e10){return _0xe1fc51['download'](path[_0xbb10('0x82')](_0x3fa344,_0x742e10['Attachment'][_0xbb10('0x81')]));}})[_0xbb10('0x54')](handleError(_0xe1fc51,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index e278fb6..d547d4d 100644 --- a/server/api/faxMessage/faxMessage.events.js +++ b/server/api/faxMessage/faxMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['hasOwnProperty','exports','events','FaxMessage','setMaxListeners','save','emit'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3e74,0x175));var _0x43e7=function(_0x56f764,_0x4acb5a){_0x56f764=_0x56f764-0x0;var _0x5779ee=_0x3e74[_0x56f764];return _0x5779ee;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x43e7('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){FaxMessageEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);FaxMessageEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=FaxMessageEvents; \ No newline at end of file +var _0x7217=['emit','hasOwnProperty','hook','exports','events','FaxMessage','setMaxListeners','save','update','remove'];(function(_0xacb1e2,_0x55e0ab){var _0x463815=function(_0x413c3b){while(--_0x413c3b){_0xacb1e2['push'](_0xacb1e2['shift']());}};_0x463815(++_0x55e0ab);}(_0x7217,0x19e));var _0x7721=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0x7217[_0x5b78e8];return _0xf2c321;};'use strict';var EventEmitter=require(_0x7721('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x7721('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){FaxMessageEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);FaxMessageEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];FaxMessage[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 73b7bf8..583b5b2 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 _0x7766=['models','get','direction','toLowerCase','out','secret','isNil','FaxInteractionId','then','update','createdAt','error','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','FaxMessage','fti_fax_messages','body','FULLTEXT'];(function(_0x5224b9,_0x195fcb){var _0x363bcc=function(_0x3d219a){while(--_0x3d219a){_0x5224b9['push'](_0x5224b9['shift']());}};_0x363bcc(++_0x195fcb);}(_0x7766,0xd1));var _0x6776=function(_0x29ad0e,_0x4d7e03){_0x29ad0e=_0x29ad0e-0x0;var _0x3199fd=_0x7766[_0x29ad0e];return _0x3199fd;};'use strict';var _=require(_0x6776('0x0'));var util=require(_0x6776('0x1'));var logger=require('../../config/logger')(_0x6776('0x2'));var moment=require(_0x6776('0x3'));var BPromise=require(_0x6776('0x4'));var rp=require(_0x6776('0x5'));var fs=require('fs');var path=require(_0x6776('0x6'));var rimraf=require(_0x6776('0x7'));var config=require(_0x6776('0x8'));var attributes=require(_0x6776('0x9'));module[_0x6776('0xa')]=function(_0x973766,_0x197bc0){return _0x973766['define'](_0x6776('0xb'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x6776('0xc'),'fields':[_0x6776('0xd')],'type':_0x6776('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2890bb,_0x2a3094,_0x30bfcb){var _0x33269d=_0x973766[_0x6776('0xf')];var _0x38686d=_0x2890bb[_0x6776('0x10')]({'plain':!![]});if(_0x38686d['direction']['toLowerCase']()==='in'||_0x38686d[_0x6776('0x11')][_0x6776('0x12')]()===_0x6776('0x13')&&!_0x38686d[_0x6776('0x14')]&&!_[_0x6776('0x15')](_0x38686d['UserId'])){_0x33269d['FaxInteraction']['findOne']({'where':{'id':_0x38686d[_0x6776('0x16')]}})[_0x6776('0x17')](function(_0xe3099c){if(_0xe3099c){_0xe3099c[_0x6776('0x18')]({'lastMsgAt':_0x38686d[_0x6776('0x19')],'lastMsgDirection':_0x38686d[_0x6776('0x11')][_0x6776('0x12')]()});}})['catch'](function(_0x17efc5){console[_0x6776('0x1a')](_0x17efc5);});}_0x30bfcb();}},'charset':'utf8mb4','collate':_0x6776('0x1b')});}; \ No newline at end of file +var _0x9d37=['rimraf','../../config/environment','./faxMessage.attributes','define','fax_messages','fti_fax_messages','body','FULLTEXT','get','direction','toLowerCase','out','isNil','UserId','findOne','FaxInteractionId','then','catch','utf8mb4_unicode_ci','api','moment','bluebird','path'];(function(_0x319080,_0x36dc97){var _0x1be7a5=function(_0x393666){while(--_0x393666){_0x319080['push'](_0x319080['shift']());}};_0x1be7a5(++_0x36dc97);}(_0x9d37,0xf9));var _0x79d3=function(_0x392439,_0x2acb12){_0x392439=_0x392439-0x0;var _0x160001=_0x9d37[_0x392439];return _0x160001;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x79d3('0x0'));var moment=require(_0x79d3('0x1'));var BPromise=require(_0x79d3('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x79d3('0x3'));var rimraf=require(_0x79d3('0x4'));var config=require(_0x79d3('0x5'));var attributes=require(_0x79d3('0x6'));module['exports']=function(_0x1168fa,_0x408dc0){return _0x1168fa[_0x79d3('0x7')]('FaxMessage',attributes,{'tableName':_0x79d3('0x8'),'paranoid':![],'indexes':[{'name':_0x79d3('0x9'),'fields':[_0x79d3('0xa')],'type':_0x79d3('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xf6bbcd,_0x4f3e5f,_0x2ed539){var _0x5d2ffe=_0x1168fa['models'];var _0x2c5adb=_0xf6bbcd[_0x79d3('0xc')]({'plain':!![]});if(_0x2c5adb[_0x79d3('0xd')][_0x79d3('0xe')]()==='in'||_0x2c5adb['direction']['toLowerCase']()===_0x79d3('0xf')&&!_0x2c5adb['secret']&&!_[_0x79d3('0x10')](_0x2c5adb[_0x79d3('0x11')])){_0x5d2ffe['FaxInteraction'][_0x79d3('0x12')]({'where':{'id':_0x2c5adb[_0x79d3('0x13')]}})[_0x79d3('0x14')](function(_0x1f2d41){if(_0x1f2d41){_0x1f2d41['update']({'lastMsgAt':_0x2c5adb['createdAt'],'lastMsgDirection':_0x2c5adb[_0x79d3('0xd')]['toLowerCase']()});}})[_0x79d3('0x15')](function(_0x31f044){console['error'](_0x31f044);});}_0x2ed539();}},'charset':'utf8mb4','collate':_0x79d3('0x16')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index b118572..948187c 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 _0x7602=['FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','info','result','options','raw','CreateFaxMessage','UpdateFaxMessage','FaxMessage','body','where','attributes','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','register','then','request\x20sent','debug'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7602,0x15e));var _0x2760=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x7602[_0x220f3f];return _0x1f170e;};'use strict';var _=require(_0x2760('0x0'));var util=require(_0x2760('0x1'));var moment=require(_0x2760('0x2'));var BPromise=require(_0x2760('0x3'));var rs=require(_0x2760('0x4'));var fs=require('fs');var Redis=require(_0x2760('0x5'));var db=require(_0x2760('0x6'))['db'];var utils=require(_0x2760('0x7'));var logger=require(_0x2760('0x8'))(_0x2760('0x9'));var config=require(_0x2760('0xa'));var jayson=require(_0x2760('0xb'));var client=jayson[_0x2760('0xc')][_0x2760('0xd')]({'port':0x232a});config[_0x2760('0xe')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2760('0xf'))(new Redis(config['redis']));require('./faxMessage.socket')[_0x2760('0x10')](socket);function respondWithRpcPromise(_0x3bc032,_0x361453,_0x2536ad){return new BPromise(function(_0x3f0911,_0x1473cc){return client['request'](_0x3bc032,_0x2536ad)[_0x2760('0x11')](function(_0x444c35){logger['info']('FaxMessage,\x20%s,\x20%s',_0x361453,_0x2760('0x12'));logger[_0x2760('0x13')](_0x2760('0x14'),_0x361453,_0x2760('0x12'),JSON[_0x2760('0x15')](_0x444c35));if(_0x444c35['error']){if(_0x444c35[_0x2760('0x16')][_0x2760('0x17')]===0x1f4){logger[_0x2760('0x16')](_0x2760('0x18'),_0x361453,_0x444c35[_0x2760('0x16')][_0x2760('0x19')]);return _0x1473cc(_0x444c35['error']['message']);}logger[_0x2760('0x16')]('FaxMessage,\x20%s,\x20%s',_0x361453,_0x444c35['error']['message']);return _0x3f0911(_0x444c35[_0x2760('0x16')][_0x2760('0x19')]);}else{logger[_0x2760('0x1a')](_0x2760('0x18'),_0x361453,_0x2760('0x12'));_0x3f0911(_0x444c35[_0x2760('0x1b')][_0x2760('0x19')]);}})['catch'](function(_0x13811c){logger[_0x2760('0x16')](_0x2760('0x18'),_0x361453,_0x13811c);_0x1473cc(_0x13811c);});});}exports['CreateFaxMessage']=function(_0x1a6ff3){var _0x593e9f=this;return new Promise(function(_0x4b1b90,_0xd54f5a){return db['FaxMessage']['create'](_0x1a6ff3['body'],{'raw':_0x1a6ff3[_0x2760('0x1c')]?_0x1a6ff3[_0x2760('0x1c')][_0x2760('0x1d')]===undefined?!![]:![]:!![]})[_0x2760('0x11')](function(_0x452dde){logger[_0x2760('0x1a')]('CreateFaxMessage',_0x1a6ff3);logger[_0x2760('0x13')](_0x2760('0x1e'),_0x1a6ff3,JSON['stringify'](_0x452dde));_0x4b1b90(_0x452dde);})['catch'](function(_0x194b27){logger['error']('CreateFaxMessage',_0x194b27[_0x2760('0x19')],_0x1a6ff3);_0xd54f5a(_0x593e9f[_0x2760('0x16')](0x1f4,_0x194b27['message']));});});};exports[_0x2760('0x1f')]=function(_0x407c69){var _0x36e378=this;return new Promise(function(_0x37bc5b,_0x4569dd){return db[_0x2760('0x20')]['update'](_0x407c69[_0x2760('0x21')],{'raw':_0x407c69[_0x2760('0x1c')]?_0x407c69['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x407c69[_0x2760('0x1c')]?_0x407c69['options'][_0x2760('0x22')]||null:null,'attributes':_0x407c69[_0x2760('0x1c')]?_0x407c69[_0x2760('0x1c')][_0x2760('0x23')]||null:null,'limit':_0x407c69[_0x2760('0x1c')]?_0x407c69[_0x2760('0x1c')]['limit']||null:null})[_0x2760('0x11')](function(_0x4fe68a){logger[_0x2760('0x1a')](_0x2760('0x1f'),_0x407c69);logger[_0x2760('0x13')](_0x2760('0x1f'),_0x407c69,JSON[_0x2760('0x15')](_0x4fe68a));_0x37bc5b(_0x4fe68a);})[_0x2760('0x24')](function(_0xcd99d){logger[_0x2760('0x16')](_0x2760('0x1f'),_0xcd99d[_0x2760('0x19')],_0x407c69);_0x4569dd(_0x36e378['error'](0x1f4,_0xcd99d[_0x2760('0x19')]));});});}; \ No newline at end of file +var _0x0bc1=['catch','create','body','options','raw','info','CreateFaxMessage','UpdateFaxMessage','FaxMessage','update','attributes','limit','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x48367c,_0x407ebb){var _0x24d3a0=function(_0x12eb6b){while(--_0x12eb6b){_0x48367c['push'](_0x48367c['shift']());}};_0x24d3a0(++_0x407ebb);}(_0x0bc1,0x1ae));var _0x10bc=function(_0x34aa72,_0x4bb48f){_0x34aa72=_0x34aa72-0x0;var _0x4aa635=_0x0bc1[_0x34aa72];return _0x4aa635;};'use strict';var _=require(_0x10bc('0x0'));var util=require(_0x10bc('0x1'));var moment=require(_0x10bc('0x2'));var BPromise=require(_0x10bc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x10bc('0x4'))['db'];var utils=require(_0x10bc('0x5'));var logger=require(_0x10bc('0x6'))(_0x10bc('0x7'));var config=require(_0x10bc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x10bc('0x9')][_0x10bc('0xa')]({'port':0x232a});config[_0x10bc('0xb')]=_[_0x10bc('0xc')](config[_0x10bc('0xb')],{'host':_0x10bc('0xd'),'port':0x18eb});var socket=require(_0x10bc('0xe'))(new Redis(config[_0x10bc('0xb')]));require('./faxMessage.socket')[_0x10bc('0xf')](socket);function respondWithRpcPromise(_0x4eba3f,_0x53e222,_0x17b19e){return new BPromise(function(_0x3e0414,_0x4e8d28){return client[_0x10bc('0x10')](_0x4eba3f,_0x17b19e)[_0x10bc('0x11')](function(_0x13462d){logger['info'](_0x10bc('0x12'),_0x53e222,_0x10bc('0x13'));logger[_0x10bc('0x14')](_0x10bc('0x15'),_0x53e222,_0x10bc('0x13'),JSON[_0x10bc('0x16')](_0x13462d));if(_0x13462d[_0x10bc('0x17')]){if(_0x13462d[_0x10bc('0x17')][_0x10bc('0x18')]===0x1f4){logger[_0x10bc('0x17')](_0x10bc('0x12'),_0x53e222,_0x13462d[_0x10bc('0x17')][_0x10bc('0x19')]);return _0x4e8d28(_0x13462d[_0x10bc('0x17')][_0x10bc('0x19')]);}logger[_0x10bc('0x17')](_0x10bc('0x12'),_0x53e222,_0x13462d[_0x10bc('0x17')][_0x10bc('0x19')]);return _0x3e0414(_0x13462d['error'][_0x10bc('0x19')]);}else{logger['info'](_0x10bc('0x12'),_0x53e222,'request\x20sent');_0x3e0414(_0x13462d['result'][_0x10bc('0x19')]);}})[_0x10bc('0x1a')](function(_0x8ea902){logger['error'](_0x10bc('0x12'),_0x53e222,_0x8ea902);_0x4e8d28(_0x8ea902);});});}exports['CreateFaxMessage']=function(_0x178915){var _0x5ad529=this;return new Promise(function(_0x1eab1e,_0x106233){return db['FaxMessage'][_0x10bc('0x1b')](_0x178915[_0x10bc('0x1c')],{'raw':_0x178915['options']?_0x178915[_0x10bc('0x1d')][_0x10bc('0x1e')]===undefined?!![]:![]:!![]})[_0x10bc('0x11')](function(_0x279cf8){logger[_0x10bc('0x1f')](_0x10bc('0x20'),_0x178915);logger['debug']('CreateFaxMessage',_0x178915,JSON[_0x10bc('0x16')](_0x279cf8));_0x1eab1e(_0x279cf8);})[_0x10bc('0x1a')](function(_0x586727){logger[_0x10bc('0x17')](_0x10bc('0x20'),_0x586727[_0x10bc('0x19')],_0x178915);_0x106233(_0x5ad529[_0x10bc('0x17')](0x1f4,_0x586727[_0x10bc('0x19')]));});});};exports[_0x10bc('0x21')]=function(_0xabc911){var _0x1e9b11=this;return new Promise(function(_0x1d4ff9,_0x1dca59){return db[_0x10bc('0x22')][_0x10bc('0x23')](_0xabc911[_0x10bc('0x1c')],{'raw':_0xabc911['options']?_0xabc911[_0x10bc('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xabc911[_0x10bc('0x1d')]?_0xabc911[_0x10bc('0x1d')]['where']||null:null,'attributes':_0xabc911[_0x10bc('0x1d')]?_0xabc911[_0x10bc('0x1d')][_0x10bc('0x24')]||null:null,'limit':_0xabc911[_0x10bc('0x1d')]?_0xabc911[_0x10bc('0x1d')][_0x10bc('0x25')]||null:null})[_0x10bc('0x11')](function(_0x72e124){logger[_0x10bc('0x1f')]('UpdateFaxMessage',_0xabc911);logger[_0x10bc('0x14')](_0x10bc('0x21'),_0xabc911,JSON[_0x10bc('0x16')](_0x72e124));_0x1d4ff9(_0x72e124);})[_0x10bc('0x1a')](function(_0x2a6baf){logger[_0x10bc('0x17')]('UpdateFaxMessage',_0x2a6baf['message'],_0xabc911);_0x1dca59(_0x1e9b11['error'](0x1f4,_0x2a6baf[_0x10bc('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index c979098..4823390 100644 --- a/server/api/faxMessage/faxMessage.socket.js +++ b/server/api/faxMessage/faxMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x33bc64,_0x4d1e92){var _0x3fdd34=function(_0x4b40a4){while(--_0x4b40a4){_0x33bc64['push'](_0x33bc64['shift']());}};_0x3fdd34(++_0x4d1e92);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var FaxMessageEvents=require(_0x7995('0x0'));var events=[_0x7995('0x1'),_0x7995('0x2'),_0x7995('0x3')];function createListener(_0x5b96eb,_0x86c128){return function(_0x3c58eb){_0x86c128[_0x7995('0x4')](_0x5b96eb,_0x3c58eb);};}function removeListener(_0x462a03,_0x576d89){return function(){FaxMessageEvents[_0x7995('0x5')](_0x462a03,_0x576d89);};}exports[_0x7995('0x6')]=function(_0x137b6b){for(var _0x219534=0x0,_0xbda126=events[_0x7995('0x7')];_0x219534<_0xbda126;_0x219534++){var _0x4996ca=events[_0x219534];var _0x465276=createListener(_0x7995('0x8')+_0x4996ca,_0x137b6b);FaxMessageEvents['on'](_0x4996ca,_0x465276);}}; \ No newline at end of file +var _0x9957=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var FaxMessageEvents=require(_0x7995('0x0'));var events=[_0x7995('0x1'),_0x7995('0x2'),_0x7995('0x3')];function createListener(_0x5b96eb,_0x86c128){return function(_0x3c58eb){_0x86c128[_0x7995('0x4')](_0x5b96eb,_0x3c58eb);};}function removeListener(_0x462a03,_0x576d89){return function(){FaxMessageEvents[_0x7995('0x5')](_0x462a03,_0x576d89);};}exports[_0x7995('0x6')]=function(_0x137b6b){for(var _0x219534=0x0,_0xbda126=events[_0x7995('0x7')];_0x219534<_0xbda126;_0x219534++){var _0x4996ca=events[_0x219534];var _0x465276=createListener(_0x7995('0x8')+_0x4996ca,_0x137b6b);FaxMessageEvents['on'](_0x4996ca,_0x465276);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index f755cb5..888d9e7 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 _0xaeaa=['path','connect-timeout','Router','../../components/auth/service','get','isAuthenticated','describe','/:id','show','/:id/download','download','post','tracked','fax','create','put','update','/:id/accept','accept','delete','destroy','multer'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xaeaa,0x11d));var _0xaaea=function(_0x264bb1,_0x492de4){_0x264bb1=_0x264bb1-0x0;var _0x53b584=_0xaeaa[_0x264bb1];return _0x53b584;};'use strict';var multer=require(_0xaaea('0x0'));var util=require('util');var path=require(_0xaaea('0x1'));var timeout=require(_0xaaea('0x2'));var express=require('express');var router=express[_0xaaea('0x3')]();var auth=require(_0xaaea('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxMessage.controller');router[_0xaaea('0x5')]('/',auth[_0xaaea('0x6')](),controller['index']);router[_0xaaea('0x5')]('/describe',auth[_0xaaea('0x6')](),controller[_0xaaea('0x7')]);router['get'](_0xaaea('0x8'),auth['isAuthenticated'](),controller[_0xaaea('0x9')]);router[_0xaaea('0x5')](_0xaaea('0xa'),auth[_0xaaea('0x6')](),controller[_0xaaea('0xb')]);router[_0xaaea('0xc')]('/',auth[_0xaaea('0x6')](),interaction[_0xaaea('0xd')](_0xaaea('0xe'),'faxmessage:create'),controller[_0xaaea('0xf')]);router[_0xaaea('0x10')](_0xaaea('0x8'),auth['isAuthenticated'](),controller[_0xaaea('0x11')]);router[_0xaaea('0x10')](_0xaaea('0x12'),auth['isAuthenticated'](),controller[_0xaaea('0x13')]);router[_0xaaea('0x10')]('/:id/reject',auth[_0xaaea('0x6')](),controller['reject']);router[_0xaaea('0x14')](_0xaaea('0x8'),auth[_0xaaea('0x6')](),controller[_0xaaea('0x15')]);module['exports']=router; \ No newline at end of file +var _0x0df9=['accept','/:id/reject','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/download','download','post','faxmessage:create','create','put','update','/:id/accept'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0df9,0x170));var _0x90df=function(_0x371396,_0x1692aa){_0x371396=_0x371396-0x0;var _0x57c9a4=_0x0df9[_0x371396];return _0x57c9a4;};'use strict';var multer=require(_0x90df('0x0'));var util=require('util');var path=require(_0x90df('0x1'));var timeout=require(_0x90df('0x2'));var express=require('express');var router=express[_0x90df('0x3')]();var auth=require(_0x90df('0x4'));var interaction=require(_0x90df('0x5'));var config=require(_0x90df('0x6'));var controller=require(_0x90df('0x7'));router[_0x90df('0x8')]('/',auth[_0x90df('0x9')](),controller[_0x90df('0xa')]);router[_0x90df('0x8')](_0x90df('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x90df('0x8')](_0x90df('0xc'),auth['isAuthenticated'](),controller[_0x90df('0xd')]);router[_0x90df('0x8')](_0x90df('0xe'),auth[_0x90df('0x9')](),controller[_0x90df('0xf')]);router[_0x90df('0x10')]('/',auth[_0x90df('0x9')](),interaction['tracked']('fax',_0x90df('0x11')),controller[_0x90df('0x12')]);router[_0x90df('0x13')](_0x90df('0xc'),auth['isAuthenticated'](),controller[_0x90df('0x14')]);router[_0x90df('0x13')](_0x90df('0x15'),auth[_0x90df('0x9')](),controller[_0x90df('0x16')]);router['put'](_0x90df('0x17'),auth[_0x90df('0x9')](),controller['reject']);router['delete'](_0x90df('0xc'),auth[_0x90df('0x9')](),controller[_0x90df('0x18')]);module[_0x90df('0x19')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index ebfe272..a218ede 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 _0xc389=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x246bf5,_0x3c8f49){var _0x5e0313=function(_0x897b96){while(--_0x897b96){_0x246bf5['push'](_0x246bf5['shift']());}};_0x5e0313(++_0x3c8f49);}(_0xc389,0x180));var _0x9c38=function(_0x2b2bb0,_0x31c452){_0x2b2bb0=_0x2b2bb0-0x0;var _0x5823ad=_0xc389[_0x2b2bb0];return _0x5823ad;};'use strict';var Sequelize=require(_0x9c38('0x0'));module[_0x9c38('0x1')]={'name':{'type':Sequelize[_0x9c38('0x2')],'unique':_0x9c38('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9c38('0x2')]},'timeout':{'type':Sequelize[_0x9c38('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9c38('0x5')](_0x9c38('0x6'),_0x9c38('0x7'),_0x9c38('0x8')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x9c38('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5909=['ENUM','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x71c597,_0x3d7109){var _0xae9ab5=function(_0x5b3a8d){while(--_0x5b3a8d){_0x71c597['push'](_0x71c597['shift']());}};_0xae9ab5(++_0x3d7109);}(_0x5909,0x73));var _0x9590=function(_0xa1e3ca,_0x559022){_0xa1e3ca=_0xa1e3ca-0x0;var _0x5005ab=_0x5909[_0xa1e3ca];return _0x5005ab;};'use strict';var Sequelize=require(_0x9590('0x0'));module[_0x9590('0x1')]={'name':{'type':Sequelize[_0x9590('0x2')],'unique':_0x9590('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9590('0x2')]},'timeout':{'type':Sequelize[_0x9590('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9590('0x5')]('rrmemory',_0x9590('0x6'),_0x9590('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x9590('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 9b65c5c..755c32f 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 _0xcaef=['updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','interface','flatMap','sequelize','each','findOrCreate','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','QueryTypes','SELECT','every','includes','all','union','compact','value','transaction','isEmpty','removeAgents','forEach','emit','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','lodash','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','FaxQueue','rawAttributes','key','map','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','type','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','FaxQueues','UserProfileSection','userProfileId','update','describe','getMembers','findOne','UserFaxQueue','order','User','findAndCountAll','UserId','faxPause'];(function(_0x3e8f4d,_0x2973ed){var _0x590a2e=function(_0x5ebea8){while(--_0x5ebea8){_0x3e8f4d['push'](_0x3e8f4d['shift']());}};_0x590a2e(++_0x2973ed);}(_0xcaef,0x1c9));var _0xfcae=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0xcaef[_0x1b4b23];return _0x2a325b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfcae('0x0'));var rimraf=require(_0xfcae('0x1'));var zipdir=require(_0xfcae('0x2'));var jsonpatch=require(_0xfcae('0x3'));var rp=require('request-promise');var moment=require(_0xfcae('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xfcae('0x5'));var util=require(_0xfcae('0x6'));var path=require('path');var sox=require(_0xfcae('0x7'));var csv=require(_0xfcae('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfcae('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfcae('0xa'));var deskjs=require(_0xfcae('0xb'));var toCsv=require(_0xfcae('0x8'));var querystring=require('querystring');var Papa=require(_0xfcae('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfcae('0xd'));var as=require(_0xfcae('0xe'));var hardwareService=require(_0xfcae('0xf'));var logger=require(_0xfcae('0x10'))(_0xfcae('0x11'));var utils=require(_0xfcae('0x12'));var config=require(_0xfcae('0x13'));var db=require(_0xfcae('0x14'))['db'];config[_0xfcae('0x15')]=_['defaults'](config[_0xfcae('0x15')],{'host':_0xfcae('0x16'),'port':0x18eb});var socket=require(_0xfcae('0x17'))(new Redis(config[_0xfcae('0x15')]));require(_0xfcae('0x18'))[_0xfcae('0x19')](socket);function respondWithStatusCode(_0x19cf42,_0x386379){_0x386379=_0x386379||0xcc;return function(_0x5a8717){if(_0x5a8717){return _0x19cf42[_0xfcae('0x1a')](_0x386379);}return _0x19cf42['status'](_0x386379)[_0xfcae('0x1b')]();};}function respondWithResult(_0x12a15e,_0x1ab8f3){_0x1ab8f3=_0x1ab8f3||0xc8;return function(_0x3e8a36){if(_0x3e8a36){return _0x12a15e[_0xfcae('0x1c')](_0x1ab8f3)[_0xfcae('0x1d')](_0x3e8a36);}};}function respondWithFilteredResult(_0x1d49cd,_0x199b03){return function(_0x3d8c62){if(_0x3d8c62){var _0x4d2a5e=_0x3d8c62[_0xfcae('0x1e')],_0x24f607=_0x199b03[_0xfcae('0x1f')],_0x5f4a8b=_0x199b03[_0xfcae('0x1f')]+_0x199b03[_0xfcae('0x20')],_0x3176d6;if(_0x5f4a8b>=_0x4d2a5e){_0x5f4a8b=_0x4d2a5e;_0x3176d6=0xc8;}else{_0x3176d6=0xce;}_0x1d49cd[_0xfcae('0x1c')](_0x3176d6);return _0x1d49cd[_0xfcae('0x21')]('Content-Range',_0x24f607+'-'+_0x5f4a8b+'/'+_0x4d2a5e)['json'](_0x3d8c62);}return null;};}function patchUpdates(_0x1f79cb){return function(_0x35fa50){try{jsonpatch[_0xfcae('0x22')](_0x35fa50,_0x1f79cb,!![]);}catch(_0x17daf9){return BPromise[_0xfcae('0x23')](_0x17daf9);}return _0x35fa50[_0xfcae('0x24')]();};}function saveUpdates(_0xc2d0ed,_0x7f50dd){return function(_0x26a5aa){if(_0x26a5aa){return _0x26a5aa['update'](_0xc2d0ed)[_0xfcae('0x25')](function(_0x4571a9){return _0x4571a9;});}return null;};}function removeEntity(_0x57687e,_0x49e534){return function(_0x51776e){if(_0x51776e){return _0x51776e[_0xfcae('0x26')]()['then'](function(){var _0x229e86=_0x51776e[_0xfcae('0x27')]({'plain':!![]});var _0x232695='FaxQueues';return db[_0xfcae('0x28')][_0xfcae('0x26')]({'where':{'type':_0x232695,'resourceId':_0x229e86['id']}})[_0xfcae('0x25')](function(){return _0x51776e;});})[_0xfcae('0x25')](function(){_0x57687e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x48f6bb,_0x47b7ed){return function(_0x4b874b){if(!_0x4b874b){_0x48f6bb[_0xfcae('0x1a')](0x194);}return _0x4b874b;};}function handleError(_0x5527cf,_0x5b9341){_0x5b9341=_0x5b9341||0x1f4;return function(_0x409dd6){logger[_0xfcae('0x29')](_0x409dd6[_0xfcae('0x2a')]);if(_0x409dd6['name']){delete _0x409dd6[_0xfcae('0x2b')];}_0x5527cf['status'](_0x5b9341)['send'](_0x409dd6);};}exports['index']=function(_0x29a7d7,_0x2859d2){var _0x3931b0={},_0x31e0ce={},_0x47cfde={'count':0x0,'rows':[]};var _0x502626=_['map'](db[_0xfcae('0x2c')][_0xfcae('0x2d')],function(_0x3faa9b){return{'name':_0x3faa9b['fieldName'],'type':_0x3faa9b['type'][_0xfcae('0x2e')]};});_0x31e0ce['model']=_[_0xfcae('0x2f')](_0x502626,_0xfcae('0x2b'));_0x31e0ce[_0xfcae('0x30')]=_[_0xfcae('0x31')](_0x29a7d7[_0xfcae('0x30')]);_0x31e0ce['filters']=_[_0xfcae('0x32')](_0x31e0ce[_0xfcae('0x33')],_0x31e0ce[_0xfcae('0x30')]);_0x3931b0['attributes']=_[_0xfcae('0x32')](_0x31e0ce[_0xfcae('0x33')],qs[_0xfcae('0x34')](_0x29a7d7[_0xfcae('0x30')]['fields']));_0x3931b0[_0xfcae('0x35')]=_0x3931b0[_0xfcae('0x35')][_0xfcae('0x36')]?_0x3931b0['attributes']:_0x31e0ce[_0xfcae('0x33')];if(!_0x29a7d7[_0xfcae('0x30')][_0xfcae('0x37')](_0xfcae('0x38'))){_0x3931b0['limit']=qs['limit'](_0x29a7d7['query'][_0xfcae('0x20')]);_0x3931b0[_0xfcae('0x1f')]=qs['offset'](_0x29a7d7[_0xfcae('0x30')]['offset']);}_0x3931b0['order']=qs[_0xfcae('0x39')](_0x29a7d7[_0xfcae('0x30')][_0xfcae('0x39')]);_0x3931b0[_0xfcae('0x3a')]=qs[_0xfcae('0x3b')](_[_0xfcae('0x3c')](_0x29a7d7[_0xfcae('0x30')],_0x31e0ce[_0xfcae('0x3b')]));if(_0x29a7d7['query']['filter']){_0x3931b0['where']=_['merge'](_0x3931b0[_0xfcae('0x3a')],{'$or':_[_0xfcae('0x2f')](_0x502626,function(_0x59cdcb){if(_0x59cdcb[_0xfcae('0x3d')]!==_0xfcae('0x3e')){var _0x1582c8={};_0x1582c8[_0x59cdcb[_0xfcae('0x2b')]]={'$like':'%'+_0x29a7d7[_0xfcae('0x30')][_0xfcae('0x3f')]+'%'};return _0x1582c8;}})});}_0x3931b0=_[_0xfcae('0x40')]({},_0x3931b0,_0x29a7d7[_0xfcae('0x41')]);var _0x337d45={'where':_0x3931b0[_0xfcae('0x3a')]};return db[_0xfcae('0x2c')][_0xfcae('0x1e')](_0x337d45)[_0xfcae('0x25')](function(_0x4211fc){_0x47cfde[_0xfcae('0x1e')]=_0x4211fc;if(_0x29a7d7[_0xfcae('0x30')][_0xfcae('0x42')]){_0x3931b0['include']=[{'all':!![]}];}return db[_0xfcae('0x2c')][_0xfcae('0x43')](_0x3931b0);})['then'](function(_0x86235f){_0x47cfde[_0xfcae('0x44')]=_0x86235f;return _0x47cfde;})[_0xfcae('0x25')](respondWithFilteredResult(_0x2859d2,_0x3931b0))[_0xfcae('0x45')](handleError(_0x2859d2,null));};exports[_0xfcae('0x46')]=function(_0x13b59c,_0x1fe8f2){var _0x4ff103={'raw':!![],'where':{'id':_0x13b59c[_0xfcae('0x47')]['id']}},_0x3c94f1={};_0x3c94f1['model']=_[_0xfcae('0x31')](db[_0xfcae('0x2c')][_0xfcae('0x2d')]);_0x3c94f1[_0xfcae('0x30')]=_['keys'](_0x13b59c['query']);_0x3c94f1['filters']=_[_0xfcae('0x32')](_0x3c94f1['model'],_0x3c94f1[_0xfcae('0x30')]);_0x4ff103['attributes']=_[_0xfcae('0x32')](_0x3c94f1['model'],qs[_0xfcae('0x34')](_0x13b59c[_0xfcae('0x30')][_0xfcae('0x34')]));_0x4ff103['attributes']=_0x4ff103['attributes']['length']?_0x4ff103['attributes']:_0x3c94f1[_0xfcae('0x33')];if(_0x13b59c['query'][_0xfcae('0x42')]){_0x4ff103[_0xfcae('0x48')]=[{'all':!![]}];}_0x4ff103=_[_0xfcae('0x40')]({},_0x4ff103,_0x13b59c[_0xfcae('0x41')]);return db['FaxQueue'][_0xfcae('0x49')](_0x4ff103)[_0xfcae('0x25')](handleEntityNotFound(_0x1fe8f2,null))['then'](respondWithResult(_0x1fe8f2,null))[_0xfcae('0x45')](handleError(_0x1fe8f2,null));};exports[_0xfcae('0x4a')]=function(_0x543370,_0x562f6c){return db[_0xfcae('0x2c')]['create'](_0x543370[_0xfcae('0x4b')],{})[_0xfcae('0x25')](function(_0x41b0fe){var _0x524cee=_0x543370[_0xfcae('0x4c')][_0xfcae('0x27')]({'plain':!![]});if(!_0x524cee)throw new Error(_0xfcae('0x4d'));if(_0x524cee['role']===_0xfcae('0x4c')){var _0x1682db=_0x41b0fe[_0xfcae('0x27')]({'plain':!![]});var _0x14d98a=_0xfcae('0x4e');return db[_0xfcae('0x4f')]['find']({'where':{'name':_0x14d98a,'userProfileId':_0x524cee[_0xfcae('0x50')]},'raw':!![]})[_0xfcae('0x25')](function(_0x56eee7){if(_0x56eee7&&_0x56eee7['autoAssociation']===0x0){return db[_0xfcae('0x28')][_0xfcae('0x4a')]({'name':_0x1682db[_0xfcae('0x2b')],'resourceId':_0x1682db['id'],'type':_0x56eee7[_0xfcae('0x2b')],'sectionId':_0x56eee7['id']},{})[_0xfcae('0x25')](function(){return _0x41b0fe;});}else{return _0x41b0fe;}})[_0xfcae('0x45')](function(_0xbb2c2f){logger[_0xfcae('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xbb2c2f);throw _0xbb2c2f;});}return _0x41b0fe;})['then'](respondWithResult(_0x562f6c,0xc9))[_0xfcae('0x45')](handleError(_0x562f6c,null));};exports[_0xfcae('0x51')]=function(_0x30ed96,_0x875b6d){if(_0x30ed96[_0xfcae('0x4b')]['id']){delete _0x30ed96['body']['id'];}return db[_0xfcae('0x2c')][_0xfcae('0x49')]({'where':{'id':_0x30ed96[_0xfcae('0x47')]['id']}})['then'](handleEntityNotFound(_0x875b6d,null))['then'](saveUpdates(_0x30ed96[_0xfcae('0x4b')],null))[_0xfcae('0x25')](respondWithResult(_0x875b6d,null))[_0xfcae('0x45')](handleError(_0x875b6d,null));};exports[_0xfcae('0x26')]=function(_0x393624,_0x181d40){return db[_0xfcae('0x2c')][_0xfcae('0x49')]({'where':{'id':_0x393624[_0xfcae('0x47')]['id']}})['then'](handleEntityNotFound(_0x181d40,null))[_0xfcae('0x25')](removeEntity(_0x181d40,null))[_0xfcae('0x45')](handleError(_0x181d40,null));};exports[_0xfcae('0x52')]=function(_0x4b64a4,_0x3f8e7b){return db[_0xfcae('0x2c')][_0xfcae('0x52')]()[_0xfcae('0x25')](respondWithResult(_0x3f8e7b,null))['catch'](handleError(_0x3f8e7b,null));};exports[_0xfcae('0x53')]=function(_0x1a5e0f,_0x1df11f,_0x35bf42){var _0x5ddac0={'raw':!![],'where':{}},_0x61fda0={},_0x2c2d6a;return db[_0xfcae('0x2c')][_0xfcae('0x54')]({'where':{'id':_0x1a5e0f[_0xfcae('0x47')]['id']}})[_0xfcae('0x25')](handleEntityNotFound(_0x1df11f,null))['then'](function(_0x2cc2d4){if(_0x2cc2d4){_0x2c2d6a=_0x2cc2d4[_0xfcae('0x27')]({'plain':!![]});_0x61fda0[_0xfcae('0x33')]=_[_0xfcae('0x31')](db[_0xfcae('0x55')]['rawAttributes']);_0x61fda0[_0xfcae('0x30')]=_['keys'](_0x1a5e0f['query']);_0x61fda0['filters']=_[_0xfcae('0x32')](_0x61fda0[_0xfcae('0x33')],_0x61fda0[_0xfcae('0x30')]);_0x5ddac0[_0xfcae('0x35')]=_[_0xfcae('0x32')](_0x61fda0['model'],qs[_0xfcae('0x34')](_0x1a5e0f[_0xfcae('0x30')]['fields']));_0x5ddac0[_0xfcae('0x35')]=_0x5ddac0[_0xfcae('0x35')][_0xfcae('0x36')]?_0x5ddac0[_0xfcae('0x35')]:_0x61fda0[_0xfcae('0x33')];if(!_0x1a5e0f[_0xfcae('0x30')]['hasOwnProperty'](_0xfcae('0x38'))){_0x5ddac0[_0xfcae('0x20')]=qs[_0xfcae('0x20')](_0x1a5e0f[_0xfcae('0x30')][_0xfcae('0x20')]);_0x5ddac0[_0xfcae('0x1f')]=qs[_0xfcae('0x1f')](_0x1a5e0f[_0xfcae('0x30')][_0xfcae('0x1f')]);}_0x5ddac0[_0xfcae('0x56')]=qs[_0xfcae('0x39')](_0x1a5e0f[_0xfcae('0x30')][_0xfcae('0x39')]);_0x5ddac0[_0xfcae('0x3a')]=qs[_0xfcae('0x3b')](_[_0xfcae('0x3c')](_0x1a5e0f[_0xfcae('0x30')],_0x61fda0[_0xfcae('0x3b')]));_0x5ddac0[_0xfcae('0x3a')]['FaxQueueId']=_0x2cc2d4['id'];if(_0x1a5e0f[_0xfcae('0x30')][_0xfcae('0x3f')]){_0x5ddac0[_0xfcae('0x3a')]=_['merge'](_0x5ddac0['where'],{'$or':_[_0xfcae('0x2f')](_0x5ddac0['attributes'],function(_0x4dbbba){var _0x4aa346={};_0x4aa346[_0x4dbbba]={'$like':'%'+_0x1a5e0f[_0xfcae('0x30')][_0xfcae('0x3f')]+'%'};return _0x4aa346;})});}_0x5ddac0=_[_0xfcae('0x40')]({},_0x5ddac0,_0x1a5e0f[_0xfcae('0x41')]);return db[_0xfcae('0x55')]['findAll'](_0x5ddac0);}})[_0xfcae('0x25')](function(_0x2ea348){if(_0x2ea348){return db[_0xfcae('0x57')][_0xfcae('0x58')]({'where':{'id':_[_0xfcae('0x2f')](_0x2ea348,_0xfcae('0x59')),'role':'agent'},'attributes':['id',_0xfcae('0x2b'),_0xfcae('0x5a'),_0xfcae('0x5b'),_0xfcae('0x5c')]});}})['then'](function(_0xd42e84){if(_0xd42e84){return{'count':_0xd42e84[_0xfcae('0x1e')],'rows':_['map'](_0xd42e84[_0xfcae('0x44')],function(_0x51d789){return{'membername':_0x51d789[_0xfcae('0x2b')],'UserId':_0x51d789['id'],'queue_name':_0x2c2d6a[_0xfcae('0x2b')],'FaxQueueId':_0x2c2d6a['id'],'interface':util[_0xfcae('0x5d')](_0xfcae('0x5e'),_0xfcae('0x5f'),_0x51d789['name']),'penalty':0x0,'paused':_0x51d789[_0xfcae('0x5a')],'createdAt':_0x51d789[_0xfcae('0x5c')],'updatedAt':_0x51d789['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xfcae('0x25')](respondWithFilteredResult(_0x1df11f,_0x5ddac0))['catch'](handleError(_0x1df11f,null));};exports[_0xfcae('0x60')]=function(_0x40b967,_0x163306,_0x3cfcad){var _0x1ead11={};var _0x39bf87={};var _0x7ee008;var _0x1ce9d6;return db[_0xfcae('0x2c')]['findOne']({'where':{'id':_0x40b967[_0xfcae('0x47')]['id']}})[_0xfcae('0x25')](handleEntityNotFound(_0x163306,null))[_0xfcae('0x25')](function(_0x1f4b43){if(_0x1f4b43){_0x7ee008=_0x1f4b43;_0x39bf87['model']=_[_0xfcae('0x31')](db[_0xfcae('0x61')][_0xfcae('0x2d')]);_0x39bf87['query']=_['keys'](_0x40b967['query']);_0x39bf87['filters']=_[_0xfcae('0x32')](_0x39bf87[_0xfcae('0x33')],_0x39bf87['query']);_0x1ead11[_0xfcae('0x35')]=_['intersection'](_0x39bf87['model'],qs[_0xfcae('0x34')](_0x40b967['query'][_0xfcae('0x34')]));_0x1ead11[_0xfcae('0x35')]=_0x1ead11[_0xfcae('0x35')][_0xfcae('0x36')]?_0x1ead11[_0xfcae('0x35')]:_0x39bf87[_0xfcae('0x33')];_0x1ead11[_0xfcae('0x56')]=qs[_0xfcae('0x39')](_0x40b967[_0xfcae('0x30')][_0xfcae('0x39')]);_0x1ead11['where']=qs[_0xfcae('0x3b')](_[_0xfcae('0x3c')](_0x40b967[_0xfcae('0x30')],_0x39bf87[_0xfcae('0x3b')]));if(_0x40b967[_0xfcae('0x30')][_0xfcae('0x3f')]){_0x1ead11[_0xfcae('0x3a')]=_[_0xfcae('0x40')](_0x1ead11[_0xfcae('0x3a')],{'$or':_['map'](_0x1ead11[_0xfcae('0x35')],function(_0x2caee8){var _0x48140d={};_0x48140d[_0x2caee8]={'$like':'%'+_0x40b967['query']['filter']+'%'};return _0x48140d;})});}_0x1ead11=_[_0xfcae('0x40')]({},_0x1ead11,_0x40b967[_0xfcae('0x41')]);return _0x7ee008[_0xfcae('0x60')](_0x1ead11);}})['then'](function(_0x476307){if(_0x476307){_0x1ce9d6=_0x476307['length'];if(!_0x40b967[_0xfcae('0x30')][_0xfcae('0x37')](_0xfcae('0x38'))){_0x1ead11[_0xfcae('0x20')]=qs[_0xfcae('0x20')](_0x40b967['query']['limit']);_0x1ead11[_0xfcae('0x1f')]=qs[_0xfcae('0x1f')](_0x40b967[_0xfcae('0x30')]['offset']);}return _0x7ee008[_0xfcae('0x60')](_0x1ead11);}})[_0xfcae('0x25')](function(_0x5124fc){if(_0x5124fc){return _0x5124fc?{'count':_0x1ce9d6,'rows':_0x5124fc}:null;}})['then'](respondWithResult(_0x163306,null))[_0xfcae('0x45')](handleError(_0x163306,null));};exports[_0xfcae('0x62')]=function(_0x470924,_0x5b8d6f,_0x5521b4){var _0x573359=_0x470924[_0xfcae('0x4b')][_0xfcae('0x63')];return db[_0xfcae('0x61')][_0xfcae('0x43')]({'where':{'id':_0x573359},'attributes':['id'],'include':[{'model':db[_0xfcae('0x57')],'as':_0xfcae('0x64'),'attributes':['id',_0xfcae('0x2b'),'online','voicePause',_0xfcae('0x65')],'raw':!![]}]})[_0xfcae('0x25')](function(_0x49d569){if(_0x49d569){var _0x37c97f=_[_0xfcae('0x66')](_0x49d569,function(_0x470891){var _0x2adfd9=_0x470891['get']({'plain':!![]});return _0x2adfd9['Agents'];});return db[_0xfcae('0x2c')][_0xfcae('0x49')]({'where':{'id':_0x470924[_0xfcae('0x47')]['id']}})[_0xfcae('0x25')](function(_0x4520d2){return db[_0xfcae('0x67')]['transaction'](function(_0x14a44f){return _0x4520d2[_0xfcae('0x62')](_0x573359,{'transaction':_0x14a44f})[_0xfcae('0x25')](function(){return BPromise[_0xfcae('0x68')](_0x37c97f,function(_0xb858b6){return db[_0xfcae('0x55')][_0xfcae('0x69')]({'where':{'UserId':_0xb858b6['id'],'FaxQueueId':_0x470924[_0xfcae('0x47')]['id']},'transaction':_0x14a44f});});})[_0xfcae('0x25')](function(){_0x37c97f['forEach'](function(_0x1138bc){socket['emit'](_0xfcae('0x6a'),{'UserId':_0x1138bc['id'],'FaxQueueId':_0x4520d2['id']});});});});});}})[_0xfcae('0x25')](respondWithStatusCode(_0x5b8d6f,null))['catch'](handleError(_0x5b8d6f,null));};exports[_0xfcae('0x6b')]=function(_0xc89937,_0x3b9fb3,_0x532c64){return db['Team'][_0xfcae('0x43')]({'where':{'id':_0xc89937['query'][_0xfcae('0x63')]},'attributes':['id'],'include':[{'model':db[_0xfcae('0x57')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xfcae('0x25')](handleEntityNotFound(_0x3b9fb3,null))[_0xfcae('0x25')](function(_0x4d2659){var _0x23a5fe=_[_0xfcae('0x2f')](_0x4d2659,'id');var _0x3e4b76=[];var _0x2b358a=[];var _0x590f10=squel[_0xfcae('0x6c')]();_0x590f10[_0xfcae('0x6d')](_0xfcae('0x6e'))[_0xfcae('0x6f')](_0xfcae('0x70'),'tq')[_0xfcae('0x71')](_0xfcae('0x72'),'ut',_0xfcae('0x73'))[_0xfcae('0x3a')](_0xfcae('0x74'),_0xc89937['params']['id']);for(var _0xcebbeb=0x0;_0xcebbeb<_0x4d2659[_0xfcae('0x36')];_0xcebbeb+=0x1){let _0x1ed0be=_0x4d2659[_0xcebbeb];for(var _0x14a63f=0x0;_0x14a63f<_0x1ed0be[_0xfcae('0x64')][_0xfcae('0x36')];_0x14a63f+=0x1){let _0x45b3b1=_0x1ed0be['Agents'][_0x14a63f];var _0x193978=_0x590f10[_0xfcae('0x75')]();_0x193978['where']('ut.UserId\x20=\x20?',_0x45b3b1['id']);_0x2b358a['push'](db[_0xfcae('0x67')]['query'](_0x193978['toString'](),{'type':db['sequelize'][_0xfcae('0x76')][_0xfcae('0x77')]})[_0xfcae('0x25')](function(_0x5023f5){if(_0x5023f5[_0xfcae('0x36')]===0x1){return _0x45b3b1['id'];}else{var _0x1c1110=_[_0xfcae('0x78')](_[_0xfcae('0x2f')](_0x5023f5,'TeamId'),function(_0x1ca38c){return _[_0xfcae('0x79')](_0x23a5fe,_0x1ca38c);});if(_0x1c1110){return _0x45b3b1['id'];}}}));}}return BPromise[_0xfcae('0x7a')](_0x2b358a)[_0xfcae('0x25')](function(_0x1894a7){_0x3e4b76=_(_0x3e4b76)[_0xfcae('0x7b')](_0x1894a7)[_0xfcae('0x7c')]()[_0xfcae('0x7d')]();return db['FaxQueue'][_0xfcae('0x49')]({'where':{'id':_0xc89937[_0xfcae('0x47')]['id']}})[_0xfcae('0x25')](function(_0x149e6d){return db['sequelize'][_0xfcae('0x7e')](function(_0x58acab){return _0x149e6d[_0xfcae('0x6b')](_0xc89937[_0xfcae('0x30')][_0xfcae('0x63')],{'transaction':_0x58acab})[_0xfcae('0x25')](function(){if(!_[_0xfcae('0x7f')](_0x3e4b76)){return _0x149e6d[_0xfcae('0x80')](_0x3e4b76,{'transaction':_0x58acab});}})['then'](function(){_0x3e4b76[_0xfcae('0x81')](function(_0x58b410){socket[_0xfcae('0x82')](_0xfcae('0x83'),{'UserId':_0x58b410,'FaxQueueId':_0x149e6d['id']});});});});});});})[_0xfcae('0x25')](respondWithStatusCode(_0x3b9fb3,null))[_0xfcae('0x45')](handleError(_0x3b9fb3,null));};exports[_0xfcae('0x84')]=function(_0x5c30e3,_0x3b6b73,_0xd15842){return db[_0xfcae('0x2c')][_0xfcae('0x49')]({'where':{'id':_0x5c30e3[_0xfcae('0x47')]['id']}})[_0xfcae('0x25')](handleEntityNotFound(_0x3b6b73,null))[_0xfcae('0x25')](function(_0x5c88e4){if(_0x5c88e4){return _0x5c88e4[_0xfcae('0x84')](_0x5c30e3[_0xfcae('0x4b')][_0xfcae('0x63')],_[_0xfcae('0x85')](_0x5c30e3['body'],[_0xfcae('0x63'),'id'])||{})[_0xfcae('0x86')](function(_0xbc268f){for(var _0x26670f=0x0;_0x26670f<_0x5c30e3[_0xfcae('0x4b')][_0xfcae('0x63')]['length'];_0x26670f+=0x1){socket[_0xfcae('0x82')](_0xfcae('0x6a'),{'UserId':_0x5c30e3['body'][_0xfcae('0x63')][_0x26670f],'FaxQueueId':_0x5c30e3[_0xfcae('0x47')]['id']});}return _0xbc268f;});}})[_0xfcae('0x25')](respondWithResult(_0x3b6b73,null))[_0xfcae('0x45')](handleError(_0x3b6b73,null));};exports['removeAgents']=function(_0x30c064,_0x151d70,_0x231855){return db[_0xfcae('0x2c')][_0xfcae('0x49')]({'where':{'id':_0x30c064['params']['id']}})[_0xfcae('0x25')](handleEntityNotFound(_0x151d70,null))[_0xfcae('0x25')](function(_0x204bd3){if(_0x204bd3){return _0x204bd3[_0xfcae('0x80')](_0x30c064['query'][_0xfcae('0x63')])[_0xfcae('0x25')](function(){if(_[_0xfcae('0x87')](_0x30c064['query'][_0xfcae('0x63')])){for(var _0x465ac6=0x0;_0x465ac6<_0x30c064[_0xfcae('0x30')][_0xfcae('0x63')]['length'];_0x465ac6+=0x1){socket[_0xfcae('0x82')](_0xfcae('0x83'),{'UserId':Number(_0x30c064[_0xfcae('0x30')][_0xfcae('0x63')][_0x465ac6]),'FaxQueueId':Number(_0x30c064[_0xfcae('0x47')]['id'])});}}else{socket['emit'](_0xfcae('0x83'),{'UserId':Number(_0x30c064[_0xfcae('0x30')][_0xfcae('0x63')]),'FaxQueueId':Number(_0x30c064[_0xfcae('0x47')]['id'])});}});}})[_0xfcae('0x25')](respondWithStatusCode(_0x151d70,null))[_0xfcae('0x45')](handleError(_0x151d70,null));};exports['getAgents']=function(_0x293fa2,_0x2d530b,_0xfc88c9){var _0x423bd5={};var _0x5668d9={};var _0xce0604;var _0x3afa3e;return db[_0xfcae('0x2c')]['findOne']({'where':{'id':_0x293fa2[_0xfcae('0x47')]['id']}})[_0xfcae('0x25')](handleEntityNotFound(_0x2d530b,null))[_0xfcae('0x25')](function(_0x28dc4c){if(_0x28dc4c){_0xce0604=_0x28dc4c;_0x5668d9[_0xfcae('0x33')]=_[_0xfcae('0x31')](db[_0xfcae('0x57')]['rawAttributes']);_0x5668d9['query']=_[_0xfcae('0x31')](_0x293fa2[_0xfcae('0x30')]);_0x5668d9['filters']=_['intersection'](_0x5668d9['model'],_0x5668d9[_0xfcae('0x30')]);_0x423bd5['attributes']=_['intersection'](_0x5668d9[_0xfcae('0x33')],qs[_0xfcae('0x34')](_0x293fa2['query'][_0xfcae('0x34')]));_0x423bd5[_0xfcae('0x35')]=_0x423bd5[_0xfcae('0x35')][_0xfcae('0x36')]?_0x423bd5[_0xfcae('0x35')]:_0x5668d9[_0xfcae('0x33')];_0x423bd5['order']=qs[_0xfcae('0x39')](_0x293fa2['query'][_0xfcae('0x39')]);_0x423bd5['where']=qs[_0xfcae('0x3b')](_[_0xfcae('0x3c')](_0x293fa2[_0xfcae('0x30')],_0x5668d9[_0xfcae('0x3b')]));if(_0x293fa2[_0xfcae('0x30')][_0xfcae('0x3f')]){_0x423bd5['where']=_[_0xfcae('0x40')](_0x423bd5['where'],{'$or':_[_0xfcae('0x2f')](_0x423bd5[_0xfcae('0x35')],function(_0x3dd971){var _0x48e441={};_0x48e441[_0x3dd971]={'$like':'%'+_0x293fa2[_0xfcae('0x30')][_0xfcae('0x3f')]+'%'};return _0x48e441;})});}_0x423bd5=_[_0xfcae('0x40')]({},_0x423bd5,_0x293fa2[_0xfcae('0x41')]);return _0xce0604[_0xfcae('0x88')](_0x423bd5);}})['then'](function(_0x329d43){if(_0x329d43){_0x3afa3e=_0x329d43['length'];if(!_0x293fa2[_0xfcae('0x30')][_0xfcae('0x37')](_0xfcae('0x38'))){_0x423bd5[_0xfcae('0x20')]=qs[_0xfcae('0x20')](_0x293fa2[_0xfcae('0x30')]['limit']);_0x423bd5['offset']=qs[_0xfcae('0x1f')](_0x293fa2[_0xfcae('0x30')][_0xfcae('0x1f')]);}return _0xce0604[_0xfcae('0x88')](_0x423bd5);}})[_0xfcae('0x25')](function(_0x38fd19){if(_0x38fd19){return _0x38fd19?{'count':_0x3afa3e,'rows':_0x38fd19}:null;}})['then'](respondWithResult(_0x2d530b,null))[_0xfcae('0x45')](handleError(_0x2d530b,null));}; \ No newline at end of file +var _0xad07=['rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','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','params','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','sort','FaxQueueId','User','UserId','agent','faxPause','updatedAt','createdAt','rows','format','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','transaction','each','forEach','emit','removeTeams','field','tq.TeamId','from','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','every','TeamId','includes','all','union','compact','value','removeAgents','userFaxQueue:remove','addAgents','omit','spread','userFaxQueue:save','isArray','getAgents','pick','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','sox','lodash','squel','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','count','offset','Content-Range','json','save','then','get','FaxQueues','UserProfileResource','error','stack','name','index','map','FaxQueue'];(function(_0x36cd25,_0x1eec5b){var _0x3077c3=function(_0xfbf50){while(--_0xfbf50){_0x36cd25['push'](_0x36cd25['shift']());}};_0x3077c3(++_0x1eec5b);}(_0xad07,0xe3));var _0x7ad0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xad07[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x7ad0('0x0'));var emlformat=require(_0x7ad0('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7ad0('0x2'));var jsonpatch=require(_0x7ad0('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7ad0('0x4'));var Mustache=require(_0x7ad0('0x5'));var util=require(_0x7ad0('0x6'));var path=require('path');var sox=require(_0x7ad0('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x7ad0('0x8'));var squel=require(_0x7ad0('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7ad0('0xa'));var toCsv=require(_0x7ad0('0xb'));var querystring=require('querystring');var Papa=require(_0x7ad0('0xc'));var Redis=require(_0x7ad0('0xd'));var authService=require(_0x7ad0('0xe'));var qs=require(_0x7ad0('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7ad0('0x10'));var logger=require(_0x7ad0('0x11'))(_0x7ad0('0x12'));var utils=require(_0x7ad0('0x13'));var config=require(_0x7ad0('0x14'));var db=require(_0x7ad0('0x15'))['db'];config[_0x7ad0('0x16')]=_[_0x7ad0('0x17')](config[_0x7ad0('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x7ad0('0x18'))(new Redis(config[_0x7ad0('0x16')]));require(_0x7ad0('0x19'))[_0x7ad0('0x1a')](socket);function respondWithStatusCode(_0x51fed3,_0x53cdff){_0x53cdff=_0x53cdff||0xcc;return function(_0x13bbb0){if(_0x13bbb0){return _0x51fed3[_0x7ad0('0x1b')](_0x53cdff);}return _0x51fed3[_0x7ad0('0x1c')](_0x53cdff)[_0x7ad0('0x1d')]();};}function respondWithResult(_0xebb4da,_0x901908){_0x901908=_0x901908||0xc8;return function(_0x11268b){if(_0x11268b){return _0xebb4da[_0x7ad0('0x1c')](_0x901908)['json'](_0x11268b);}};}function respondWithFilteredResult(_0x2286fa,_0x40fa9c){return function(_0x4bf612){if(_0x4bf612){var _0x4f45e4=_0x4bf612[_0x7ad0('0x1e')],_0x412578=_0x40fa9c['offset'],_0x4f9d6b=_0x40fa9c[_0x7ad0('0x1f')]+_0x40fa9c['limit'],_0x2dae00;if(_0x4f9d6b>=_0x4f45e4){_0x4f9d6b=_0x4f45e4;_0x2dae00=0xc8;}else{_0x2dae00=0xce;}_0x2286fa[_0x7ad0('0x1c')](_0x2dae00);return _0x2286fa['set'](_0x7ad0('0x20'),_0x412578+'-'+_0x4f9d6b+'/'+_0x4f45e4)[_0x7ad0('0x21')](_0x4bf612);}return null;};}function patchUpdates(_0x1c5c7c){return function(_0x1e163a){try{jsonpatch['apply'](_0x1e163a,_0x1c5c7c,!![]);}catch(_0xfbe5c5){return BPromise['reject'](_0xfbe5c5);}return _0x1e163a[_0x7ad0('0x22')]();};}function saveUpdates(_0x304054,_0x5df5c8){return function(_0x382505){if(_0x382505){return _0x382505['update'](_0x304054)['then'](function(_0x4be2a0){return _0x4be2a0;});}return null;};}function removeEntity(_0x1d9a26,_0x4fbe51){return function(_0x35c035){if(_0x35c035){return _0x35c035['destroy']()[_0x7ad0('0x23')](function(){var _0x41a16a=_0x35c035[_0x7ad0('0x24')]({'plain':!![]});var _0x319644=_0x7ad0('0x25');return db[_0x7ad0('0x26')]['destroy']({'where':{'type':_0x319644,'resourceId':_0x41a16a['id']}})[_0x7ad0('0x23')](function(){return _0x35c035;});})[_0x7ad0('0x23')](function(){_0x1d9a26[_0x7ad0('0x1c')](0xcc)[_0x7ad0('0x1d')]();});}};}function handleEntityNotFound(_0x368931,_0x116e11){return function(_0x1f9a7f){if(!_0x1f9a7f){_0x368931[_0x7ad0('0x1b')](0x194);}return _0x1f9a7f;};}function handleError(_0x50cb16,_0x5196df){_0x5196df=_0x5196df||0x1f4;return function(_0x2b2e49){logger[_0x7ad0('0x27')](_0x2b2e49[_0x7ad0('0x28')]);if(_0x2b2e49[_0x7ad0('0x29')]){delete _0x2b2e49[_0x7ad0('0x29')];}_0x50cb16['status'](_0x5196df)['send'](_0x2b2e49);};}exports[_0x7ad0('0x2a')]=function(_0x1b4028,_0x2b497b){var _0x30bf59={},_0x14b021={},_0x3b471a={'count':0x0,'rows':[]};var _0x11592c=_[_0x7ad0('0x2b')](db[_0x7ad0('0x2c')][_0x7ad0('0x2d')],function(_0x5d52f1){return{'name':_0x5d52f1['fieldName'],'type':_0x5d52f1[_0x7ad0('0x2e')][_0x7ad0('0x2f')]};});_0x14b021[_0x7ad0('0x30')]=_[_0x7ad0('0x2b')](_0x11592c,_0x7ad0('0x29'));_0x14b021[_0x7ad0('0x31')]=_[_0x7ad0('0x32')](_0x1b4028[_0x7ad0('0x31')]);_0x14b021[_0x7ad0('0x33')]=_[_0x7ad0('0x34')](_0x14b021[_0x7ad0('0x30')],_0x14b021[_0x7ad0('0x31')]);_0x30bf59[_0x7ad0('0x35')]=_['intersection'](_0x14b021[_0x7ad0('0x30')],qs[_0x7ad0('0x36')](_0x1b4028[_0x7ad0('0x31')][_0x7ad0('0x36')]));_0x30bf59[_0x7ad0('0x35')]=_0x30bf59[_0x7ad0('0x35')][_0x7ad0('0x37')]?_0x30bf59[_0x7ad0('0x35')]:_0x14b021[_0x7ad0('0x30')];if(!_0x1b4028[_0x7ad0('0x31')]['hasOwnProperty'](_0x7ad0('0x38'))){_0x30bf59['limit']=qs[_0x7ad0('0x39')](_0x1b4028[_0x7ad0('0x31')][_0x7ad0('0x39')]);_0x30bf59['offset']=qs[_0x7ad0('0x1f')](_0x1b4028[_0x7ad0('0x31')][_0x7ad0('0x1f')]);}_0x30bf59[_0x7ad0('0x3a')]=qs['sort'](_0x1b4028[_0x7ad0('0x31')]['sort']);_0x30bf59['where']=qs[_0x7ad0('0x33')](_['pick'](_0x1b4028['query'],_0x14b021[_0x7ad0('0x33')]));if(_0x1b4028[_0x7ad0('0x31')][_0x7ad0('0x3b')]){_0x30bf59[_0x7ad0('0x3c')]=_[_0x7ad0('0x3d')](_0x30bf59[_0x7ad0('0x3c')],{'$or':_['map'](_0x11592c,function(_0x448962){if(_0x448962[_0x7ad0('0x2e')]!==_0x7ad0('0x3e')){var _0x589ca7={};_0x589ca7[_0x448962[_0x7ad0('0x29')]]={'$like':'%'+_0x1b4028[_0x7ad0('0x31')][_0x7ad0('0x3b')]+'%'};return _0x589ca7;}})});}_0x30bf59=_['merge']({},_0x30bf59,_0x1b4028[_0x7ad0('0x3f')]);var _0x443109={'where':_0x30bf59[_0x7ad0('0x3c')]};return db['FaxQueue']['count'](_0x443109)[_0x7ad0('0x23')](function(_0x2290e3){_0x3b471a['count']=_0x2290e3;if(_0x1b4028['query'][_0x7ad0('0x40')]){_0x30bf59[_0x7ad0('0x41')]=[{'all':!![]}];}return db[_0x7ad0('0x2c')][_0x7ad0('0x42')](_0x30bf59);})['then'](function(_0x52e773){_0x3b471a['rows']=_0x52e773;return _0x3b471a;})[_0x7ad0('0x23')](respondWithFilteredResult(_0x2b497b,_0x30bf59))[_0x7ad0('0x43')](handleError(_0x2b497b,null));};exports[_0x7ad0('0x44')]=function(_0xceeda9,_0x4f81d7){var _0xeb3c3={'raw':!![],'where':{'id':_0xceeda9['params']['id']}},_0x2f6a95={};_0x2f6a95['model']=_[_0x7ad0('0x32')](db['FaxQueue']['rawAttributes']);_0x2f6a95[_0x7ad0('0x31')]=_[_0x7ad0('0x32')](_0xceeda9[_0x7ad0('0x31')]);_0x2f6a95[_0x7ad0('0x33')]=_[_0x7ad0('0x34')](_0x2f6a95[_0x7ad0('0x30')],_0x2f6a95[_0x7ad0('0x31')]);_0xeb3c3['attributes']=_[_0x7ad0('0x34')](_0x2f6a95['model'],qs['fields'](_0xceeda9[_0x7ad0('0x31')][_0x7ad0('0x36')]));_0xeb3c3[_0x7ad0('0x35')]=_0xeb3c3[_0x7ad0('0x35')][_0x7ad0('0x37')]?_0xeb3c3[_0x7ad0('0x35')]:_0x2f6a95[_0x7ad0('0x30')];if(_0xceeda9[_0x7ad0('0x31')]['includeAll']){_0xeb3c3[_0x7ad0('0x41')]=[{'all':!![]}];}_0xeb3c3=_[_0x7ad0('0x3d')]({},_0xeb3c3,_0xceeda9[_0x7ad0('0x3f')]);return db[_0x7ad0('0x2c')][_0x7ad0('0x45')](_0xeb3c3)[_0x7ad0('0x23')](handleEntityNotFound(_0x4f81d7,null))[_0x7ad0('0x23')](respondWithResult(_0x4f81d7,null))[_0x7ad0('0x43')](handleError(_0x4f81d7,null));};exports[_0x7ad0('0x46')]=function(_0x23b613,_0x4e4139){return db['FaxQueue'][_0x7ad0('0x46')](_0x23b613[_0x7ad0('0x47')],{})[_0x7ad0('0x23')](function(_0x3a99b0){var _0x3018ca=_0x23b613[_0x7ad0('0x48')][_0x7ad0('0x24')]({'plain':!![]});if(!_0x3018ca)throw new Error(_0x7ad0('0x49'));if(_0x3018ca[_0x7ad0('0x4a')]===_0x7ad0('0x48')){var _0x4ea6d6=_0x3a99b0[_0x7ad0('0x24')]({'plain':!![]});var _0x21b05b=_0x7ad0('0x25');return db['UserProfileSection'][_0x7ad0('0x45')]({'where':{'name':_0x21b05b,'userProfileId':_0x3018ca[_0x7ad0('0x4b')]},'raw':!![]})[_0x7ad0('0x23')](function(_0x32933a){if(_0x32933a&&_0x32933a[_0x7ad0('0x4c')]===0x0){return db[_0x7ad0('0x26')][_0x7ad0('0x46')]({'name':_0x4ea6d6['name'],'resourceId':_0x4ea6d6['id'],'type':_0x32933a[_0x7ad0('0x29')],'sectionId':_0x32933a['id']},{})[_0x7ad0('0x23')](function(){return _0x3a99b0;});}else{return _0x3a99b0;}})[_0x7ad0('0x43')](function(_0x5be54c){logger['error'](_0x7ad0('0x4d'),_0x5be54c);throw _0x5be54c;});}return _0x3a99b0;})[_0x7ad0('0x23')](respondWithResult(_0x4e4139,0xc9))[_0x7ad0('0x43')](handleError(_0x4e4139,null));};exports[_0x7ad0('0x4e')]=function(_0x234708,_0x36418a){if(_0x234708[_0x7ad0('0x47')]['id']){delete _0x234708[_0x7ad0('0x47')]['id'];}return db[_0x7ad0('0x2c')][_0x7ad0('0x45')]({'where':{'id':_0x234708['params']['id']}})[_0x7ad0('0x23')](handleEntityNotFound(_0x36418a,null))[_0x7ad0('0x23')](saveUpdates(_0x234708[_0x7ad0('0x47')],null))['then'](respondWithResult(_0x36418a,null))[_0x7ad0('0x43')](handleError(_0x36418a,null));};exports['destroy']=function(_0x4caad5,_0x9729f5){return db['FaxQueue']['find']({'where':{'id':_0x4caad5[_0x7ad0('0x4f')]['id']}})[_0x7ad0('0x23')](handleEntityNotFound(_0x9729f5,null))[_0x7ad0('0x23')](removeEntity(_0x9729f5,null))[_0x7ad0('0x43')](handleError(_0x9729f5,null));};exports['describe']=function(_0x36b3d1,_0x2b10df){return db[_0x7ad0('0x2c')][_0x7ad0('0x50')]()[_0x7ad0('0x23')](respondWithResult(_0x2b10df,null))[_0x7ad0('0x43')](handleError(_0x2b10df,null));};exports[_0x7ad0('0x51')]=function(_0x527bb2,_0x507f09,_0x268f85){var _0xb45252={'raw':!![],'where':{}},_0x3516d9={},_0x51329d;return db['FaxQueue'][_0x7ad0('0x52')]({'where':{'id':_0x527bb2[_0x7ad0('0x4f')]['id']}})[_0x7ad0('0x23')](handleEntityNotFound(_0x507f09,null))['then'](function(_0x54afe3){if(_0x54afe3){_0x51329d=_0x54afe3[_0x7ad0('0x24')]({'plain':!![]});_0x3516d9[_0x7ad0('0x30')]=_[_0x7ad0('0x32')](db[_0x7ad0('0x53')][_0x7ad0('0x2d')]);_0x3516d9['query']=_[_0x7ad0('0x32')](_0x527bb2[_0x7ad0('0x31')]);_0x3516d9[_0x7ad0('0x33')]=_[_0x7ad0('0x34')](_0x3516d9['model'],_0x3516d9[_0x7ad0('0x31')]);_0xb45252[_0x7ad0('0x35')]=_[_0x7ad0('0x34')](_0x3516d9[_0x7ad0('0x30')],qs[_0x7ad0('0x36')](_0x527bb2['query']['fields']));_0xb45252[_0x7ad0('0x35')]=_0xb45252[_0x7ad0('0x35')]['length']?_0xb45252[_0x7ad0('0x35')]:_0x3516d9[_0x7ad0('0x30')];if(!_0x527bb2[_0x7ad0('0x31')][_0x7ad0('0x54')](_0x7ad0('0x38'))){_0xb45252['limit']=qs[_0x7ad0('0x39')](_0x527bb2['query'][_0x7ad0('0x39')]);_0xb45252[_0x7ad0('0x1f')]=qs[_0x7ad0('0x1f')](_0x527bb2[_0x7ad0('0x31')][_0x7ad0('0x1f')]);}_0xb45252[_0x7ad0('0x3a')]=qs[_0x7ad0('0x55')](_0x527bb2[_0x7ad0('0x31')]['sort']);_0xb45252[_0x7ad0('0x3c')]=qs[_0x7ad0('0x33')](_['pick'](_0x527bb2[_0x7ad0('0x31')],_0x3516d9[_0x7ad0('0x33')]));_0xb45252['where'][_0x7ad0('0x56')]=_0x54afe3['id'];if(_0x527bb2['query']['filter']){_0xb45252['where']=_[_0x7ad0('0x3d')](_0xb45252[_0x7ad0('0x3c')],{'$or':_['map'](_0xb45252[_0x7ad0('0x35')],function(_0x41a837){var _0x4fc932={};_0x4fc932[_0x41a837]={'$like':'%'+_0x527bb2[_0x7ad0('0x31')]['filter']+'%'};return _0x4fc932;})});}_0xb45252=_[_0x7ad0('0x3d')]({},_0xb45252,_0x527bb2['options']);return db[_0x7ad0('0x53')]['findAll'](_0xb45252);}})[_0x7ad0('0x23')](function(_0x5d1451){if(_0x5d1451){return db[_0x7ad0('0x57')]['findAndCountAll']({'where':{'id':_[_0x7ad0('0x2b')](_0x5d1451,_0x7ad0('0x58')),'role':_0x7ad0('0x59')},'attributes':['id',_0x7ad0('0x29'),_0x7ad0('0x5a'),_0x7ad0('0x5b'),_0x7ad0('0x5c')]});}})[_0x7ad0('0x23')](function(_0x264a99){if(_0x264a99){return{'count':_0x264a99[_0x7ad0('0x1e')],'rows':_[_0x7ad0('0x2b')](_0x264a99[_0x7ad0('0x5d')],function(_0x268162){return{'membername':_0x268162[_0x7ad0('0x29')],'UserId':_0x268162['id'],'queue_name':_0x51329d[_0x7ad0('0x29')],'FaxQueueId':_0x51329d['id'],'interface':util[_0x7ad0('0x5e')]('%s/%s',_0x7ad0('0x5f'),_0x268162['name']),'penalty':0x0,'paused':_0x268162[_0x7ad0('0x5a')],'createdAt':_0x268162[_0x7ad0('0x5c')],'updatedAt':_0x268162[_0x7ad0('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7ad0('0x23')](respondWithFilteredResult(_0x507f09,_0xb45252))[_0x7ad0('0x43')](handleError(_0x507f09,null));};exports[_0x7ad0('0x60')]=function(_0x5cd870,_0x5d4f16,_0x2f80e6){var _0x3231a8={};var _0x3084c7={};var _0x36744c;var _0x13fa09;return db[_0x7ad0('0x2c')]['findOne']({'where':{'id':_0x5cd870[_0x7ad0('0x4f')]['id']}})[_0x7ad0('0x23')](handleEntityNotFound(_0x5d4f16,null))[_0x7ad0('0x23')](function(_0x275700){if(_0x275700){_0x36744c=_0x275700;_0x3084c7[_0x7ad0('0x30')]=_[_0x7ad0('0x32')](db[_0x7ad0('0x61')]['rawAttributes']);_0x3084c7[_0x7ad0('0x31')]=_[_0x7ad0('0x32')](_0x5cd870[_0x7ad0('0x31')]);_0x3084c7['filters']=_[_0x7ad0('0x34')](_0x3084c7['model'],_0x3084c7[_0x7ad0('0x31')]);_0x3231a8[_0x7ad0('0x35')]=_['intersection'](_0x3084c7[_0x7ad0('0x30')],qs[_0x7ad0('0x36')](_0x5cd870[_0x7ad0('0x31')]['fields']));_0x3231a8[_0x7ad0('0x35')]=_0x3231a8['attributes']['length']?_0x3231a8[_0x7ad0('0x35')]:_0x3084c7['model'];_0x3231a8[_0x7ad0('0x3a')]=qs['sort'](_0x5cd870['query'][_0x7ad0('0x55')]);_0x3231a8[_0x7ad0('0x3c')]=qs[_0x7ad0('0x33')](_['pick'](_0x5cd870['query'],_0x3084c7[_0x7ad0('0x33')]));if(_0x5cd870[_0x7ad0('0x31')][_0x7ad0('0x3b')]){_0x3231a8['where']=_['merge'](_0x3231a8['where'],{'$or':_['map'](_0x3231a8[_0x7ad0('0x35')],function(_0x5c3bfc){var _0x3ff980={};_0x3ff980[_0x5c3bfc]={'$like':'%'+_0x5cd870[_0x7ad0('0x31')][_0x7ad0('0x3b')]+'%'};return _0x3ff980;})});}_0x3231a8=_[_0x7ad0('0x3d')]({},_0x3231a8,_0x5cd870[_0x7ad0('0x3f')]);return _0x36744c[_0x7ad0('0x60')](_0x3231a8);}})[_0x7ad0('0x23')](function(_0x278da8){if(_0x278da8){_0x13fa09=_0x278da8[_0x7ad0('0x37')];if(!_0x5cd870[_0x7ad0('0x31')]['hasOwnProperty']('nolimit')){_0x3231a8[_0x7ad0('0x39')]=qs[_0x7ad0('0x39')](_0x5cd870['query'][_0x7ad0('0x39')]);_0x3231a8[_0x7ad0('0x1f')]=qs[_0x7ad0('0x1f')](_0x5cd870[_0x7ad0('0x31')][_0x7ad0('0x1f')]);}return _0x36744c[_0x7ad0('0x60')](_0x3231a8);}})[_0x7ad0('0x23')](function(_0x1993b2){if(_0x1993b2){return _0x1993b2?{'count':_0x13fa09,'rows':_0x1993b2}:null;}})['then'](respondWithResult(_0x5d4f16,null))[_0x7ad0('0x43')](handleError(_0x5d4f16,null));};exports[_0x7ad0('0x62')]=function(_0x323753,_0x435368,_0x772a){var _0x3379fd=_0x323753[_0x7ad0('0x47')][_0x7ad0('0x63')];return db[_0x7ad0('0x61')]['findAll']({'where':{'id':_0x3379fd},'attributes':['id'],'include':[{'model':db[_0x7ad0('0x57')],'as':_0x7ad0('0x64'),'attributes':['id','name',_0x7ad0('0x65'),_0x7ad0('0x66'),_0x7ad0('0x67')],'raw':!![]}]})[_0x7ad0('0x23')](function(_0x8c78cb){if(_0x8c78cb){var _0x1d7ff9=_[_0x7ad0('0x68')](_0x8c78cb,function(_0xe4aa31){var _0x2a2d09=_0xe4aa31['get']({'plain':!![]});return _0x2a2d09[_0x7ad0('0x64')];});return db[_0x7ad0('0x2c')][_0x7ad0('0x45')]({'where':{'id':_0x323753[_0x7ad0('0x4f')]['id']}})[_0x7ad0('0x23')](function(_0x51dd38){return db['sequelize'][_0x7ad0('0x69')](function(_0xabeb23){return _0x51dd38[_0x7ad0('0x62')](_0x3379fd,{'transaction':_0xabeb23})[_0x7ad0('0x23')](function(){return BPromise[_0x7ad0('0x6a')](_0x1d7ff9,function(_0x17e2b2){return db[_0x7ad0('0x53')]['findOrCreate']({'where':{'UserId':_0x17e2b2['id'],'FaxQueueId':_0x323753[_0x7ad0('0x4f')]['id']},'transaction':_0xabeb23});});})[_0x7ad0('0x23')](function(){_0x1d7ff9[_0x7ad0('0x6b')](function(_0x42b625){socket[_0x7ad0('0x6c')]('userFaxQueue:save',{'UserId':_0x42b625['id'],'FaxQueueId':_0x51dd38['id']});});});});});}})[_0x7ad0('0x23')](respondWithStatusCode(_0x435368,null))[_0x7ad0('0x43')](handleError(_0x435368,null));};exports[_0x7ad0('0x6d')]=function(_0x341964,_0xfb56d4,_0x574a8e){return db[_0x7ad0('0x61')][_0x7ad0('0x42')]({'where':{'id':_0x341964[_0x7ad0('0x31')][_0x7ad0('0x63')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7ad0('0x64'),'attributes':['id'],'raw':!![]}]})[_0x7ad0('0x23')](handleEntityNotFound(_0xfb56d4,null))[_0x7ad0('0x23')](function(_0x49df54){var _0x3df1a7=_['map'](_0x49df54,'id');var _0x5ac2a6=[];var _0x50ae71=[];var _0x49c8dd=squel['select']();_0x49c8dd[_0x7ad0('0x6e')](_0x7ad0('0x6f'))[_0x7ad0('0x70')](_0x7ad0('0x71'),'tq')[_0x7ad0('0x72')]('user_has_teams','ut',_0x7ad0('0x73'))[_0x7ad0('0x3c')]('FaxQueueId\x20=\x20?',_0x341964[_0x7ad0('0x4f')]['id']);for(var _0x27d10b=0x0;_0x27d10b<_0x49df54['length'];_0x27d10b+=0x1){let _0x5b14b5=_0x49df54[_0x27d10b];for(var _0x14226f=0x0;_0x14226f<_0x5b14b5[_0x7ad0('0x64')][_0x7ad0('0x37')];_0x14226f+=0x1){let _0x50e83a=_0x5b14b5[_0x7ad0('0x64')][_0x14226f];var _0x5423d0=_0x49c8dd['clone']();_0x5423d0[_0x7ad0('0x3c')](_0x7ad0('0x74'),_0x50e83a['id']);_0x50ae71[_0x7ad0('0x75')](db[_0x7ad0('0x76')][_0x7ad0('0x31')](_0x5423d0['toString'](),{'type':db[_0x7ad0('0x76')][_0x7ad0('0x77')]['SELECT']})[_0x7ad0('0x23')](function(_0x1fc7db){if(_0x1fc7db[_0x7ad0('0x37')]===0x1){return _0x50e83a['id'];}else{var _0x2ab9a0=_[_0x7ad0('0x78')](_[_0x7ad0('0x2b')](_0x1fc7db,_0x7ad0('0x79')),function(_0x293305){return _[_0x7ad0('0x7a')](_0x3df1a7,_0x293305);});if(_0x2ab9a0){return _0x50e83a['id'];}}}));}}return BPromise[_0x7ad0('0x7b')](_0x50ae71)['then'](function(_0x373359){_0x5ac2a6=_(_0x5ac2a6)[_0x7ad0('0x7c')](_0x373359)[_0x7ad0('0x7d')]()[_0x7ad0('0x7e')]();return db['FaxQueue']['find']({'where':{'id':_0x341964[_0x7ad0('0x4f')]['id']}})[_0x7ad0('0x23')](function(_0x4bef73){return db[_0x7ad0('0x76')][_0x7ad0('0x69')](function(_0x33979e){return _0x4bef73[_0x7ad0('0x6d')](_0x341964[_0x7ad0('0x31')][_0x7ad0('0x63')],{'transaction':_0x33979e})[_0x7ad0('0x23')](function(){if(!_['isEmpty'](_0x5ac2a6)){return _0x4bef73[_0x7ad0('0x7f')](_0x5ac2a6,{'transaction':_0x33979e});}})[_0x7ad0('0x23')](function(){_0x5ac2a6[_0x7ad0('0x6b')](function(_0x52b192){socket[_0x7ad0('0x6c')](_0x7ad0('0x80'),{'UserId':_0x52b192,'FaxQueueId':_0x4bef73['id']});});});});});});})[_0x7ad0('0x23')](respondWithStatusCode(_0xfb56d4,null))[_0x7ad0('0x43')](handleError(_0xfb56d4,null));};exports[_0x7ad0('0x81')]=function(_0x554895,_0x328f98,_0x3fecdc){return db[_0x7ad0('0x2c')]['find']({'where':{'id':_0x554895['params']['id']}})[_0x7ad0('0x23')](handleEntityNotFound(_0x328f98,null))[_0x7ad0('0x23')](function(_0x2efc0a){if(_0x2efc0a){return _0x2efc0a[_0x7ad0('0x81')](_0x554895['body'][_0x7ad0('0x63')],_[_0x7ad0('0x82')](_0x554895[_0x7ad0('0x47')],[_0x7ad0('0x63'),'id'])||{})[_0x7ad0('0x83')](function(_0x151c6){for(var _0x15b373=0x0;_0x15b373<_0x554895[_0x7ad0('0x47')][_0x7ad0('0x63')][_0x7ad0('0x37')];_0x15b373+=0x1){socket[_0x7ad0('0x6c')](_0x7ad0('0x84'),{'UserId':_0x554895[_0x7ad0('0x47')][_0x7ad0('0x63')][_0x15b373],'FaxQueueId':_0x554895[_0x7ad0('0x4f')]['id']});}return _0x151c6;});}})[_0x7ad0('0x23')](respondWithResult(_0x328f98,null))[_0x7ad0('0x43')](handleError(_0x328f98,null));};exports[_0x7ad0('0x7f')]=function(_0x380cb8,_0x29ca17,_0xb6ed44){return db[_0x7ad0('0x2c')][_0x7ad0('0x45')]({'where':{'id':_0x380cb8[_0x7ad0('0x4f')]['id']}})[_0x7ad0('0x23')](handleEntityNotFound(_0x29ca17,null))[_0x7ad0('0x23')](function(_0x410d19){if(_0x410d19){return _0x410d19[_0x7ad0('0x7f')](_0x380cb8[_0x7ad0('0x31')][_0x7ad0('0x63')])['then'](function(){if(_[_0x7ad0('0x85')](_0x380cb8[_0x7ad0('0x31')][_0x7ad0('0x63')])){for(var _0x5a4164=0x0;_0x5a4164<_0x380cb8[_0x7ad0('0x31')][_0x7ad0('0x63')][_0x7ad0('0x37')];_0x5a4164+=0x1){socket[_0x7ad0('0x6c')](_0x7ad0('0x80'),{'UserId':Number(_0x380cb8[_0x7ad0('0x31')][_0x7ad0('0x63')][_0x5a4164]),'FaxQueueId':Number(_0x380cb8[_0x7ad0('0x4f')]['id'])});}}else{socket[_0x7ad0('0x6c')](_0x7ad0('0x80'),{'UserId':Number(_0x380cb8[_0x7ad0('0x31')]['ids']),'FaxQueueId':Number(_0x380cb8[_0x7ad0('0x4f')]['id'])});}});}})[_0x7ad0('0x23')](respondWithStatusCode(_0x29ca17,null))['catch'](handleError(_0x29ca17,null));};exports[_0x7ad0('0x86')]=function(_0x11be8b,_0x53176c,_0xf2fcc0){var _0x51b1e8={};var _0x4e140f={};var _0x5be54f;var _0x3e669b;return db[_0x7ad0('0x2c')][_0x7ad0('0x52')]({'where':{'id':_0x11be8b[_0x7ad0('0x4f')]['id']}})[_0x7ad0('0x23')](handleEntityNotFound(_0x53176c,null))['then'](function(_0x51eb97){if(_0x51eb97){_0x5be54f=_0x51eb97;_0x4e140f[_0x7ad0('0x30')]=_['keys'](db[_0x7ad0('0x57')][_0x7ad0('0x2d')]);_0x4e140f[_0x7ad0('0x31')]=_['keys'](_0x11be8b['query']);_0x4e140f[_0x7ad0('0x33')]=_[_0x7ad0('0x34')](_0x4e140f[_0x7ad0('0x30')],_0x4e140f[_0x7ad0('0x31')]);_0x51b1e8['attributes']=_['intersection'](_0x4e140f[_0x7ad0('0x30')],qs[_0x7ad0('0x36')](_0x11be8b[_0x7ad0('0x31')][_0x7ad0('0x36')]));_0x51b1e8['attributes']=_0x51b1e8[_0x7ad0('0x35')]['length']?_0x51b1e8[_0x7ad0('0x35')]:_0x4e140f[_0x7ad0('0x30')];_0x51b1e8[_0x7ad0('0x3a')]=qs[_0x7ad0('0x55')](_0x11be8b['query'][_0x7ad0('0x55')]);_0x51b1e8['where']=qs[_0x7ad0('0x33')](_[_0x7ad0('0x87')](_0x11be8b[_0x7ad0('0x31')],_0x4e140f[_0x7ad0('0x33')]));if(_0x11be8b[_0x7ad0('0x31')][_0x7ad0('0x3b')]){_0x51b1e8[_0x7ad0('0x3c')]=_[_0x7ad0('0x3d')](_0x51b1e8[_0x7ad0('0x3c')],{'$or':_[_0x7ad0('0x2b')](_0x51b1e8[_0x7ad0('0x35')],function(_0x1128e4){var _0x1cb20={};_0x1cb20[_0x1128e4]={'$like':'%'+_0x11be8b['query'][_0x7ad0('0x3b')]+'%'};return _0x1cb20;})});}_0x51b1e8=_[_0x7ad0('0x3d')]({},_0x51b1e8,_0x11be8b[_0x7ad0('0x3f')]);return _0x5be54f[_0x7ad0('0x86')](_0x51b1e8);}})[_0x7ad0('0x23')](function(_0x478c42){if(_0x478c42){_0x3e669b=_0x478c42[_0x7ad0('0x37')];if(!_0x11be8b[_0x7ad0('0x31')][_0x7ad0('0x54')](_0x7ad0('0x38'))){_0x51b1e8['limit']=qs['limit'](_0x11be8b[_0x7ad0('0x31')][_0x7ad0('0x39')]);_0x51b1e8[_0x7ad0('0x1f')]=qs[_0x7ad0('0x1f')](_0x11be8b[_0x7ad0('0x31')][_0x7ad0('0x1f')]);}return _0x5be54f[_0x7ad0('0x86')](_0x51b1e8);}})[_0x7ad0('0x23')](function(_0xbad8b){if(_0xbad8b){return _0xbad8b?{'count':_0x3e669b,'rows':_0xbad8b}:null;}})[_0x7ad0('0x23')](respondWithResult(_0x53176c,null))[_0x7ad0('0x43')](handleError(_0x53176c,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 90a5219..fe0a458 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 _0x5f7b=['emit','hasOwnProperty','hook','exports','events','FaxQueue','setMaxListeners','save','update','remove'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x5f7b,0xcc));var _0xb5f7=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x5f7b[_0x4b7895];return _0x264180;};'use strict';var EventEmitter=require(_0xb5f7('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0xb5f7('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xb5f7('0x2')](0x0);var events={'afterCreate':_0xb5f7('0x3'),'afterUpdate':_0xb5f7('0x4'),'afterDestroy':_0xb5f7('0x5')};function emitEvent(_0x487d91){return function(_0x3e9393,_0x53e44f,_0x4d49d7){FaxQueueEvents[_0xb5f7('0x6')](_0x487d91+':'+_0x3e9393['id'],_0x3e9393);FaxQueueEvents['emit'](_0x487d91,_0x3e9393);_0x4d49d7(null);};}for(var e in events){if(events[_0xb5f7('0x7')](e)){var event=events[e];FaxQueue[_0xb5f7('0x8')](e,emitEvent(event));}}module[_0xb5f7('0x9')]=FaxQueueEvents; \ No newline at end of file +var _0x9866=['exports','../../mysqldb','FaxQueue','setMaxListeners','save','update','remove','emit','hook'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9866,0x1f0));var _0x6986=function(_0x354d06,_0x2e89a0){_0x354d06=_0x354d06-0x0;var _0x44af05=_0x9866[_0x354d06];return _0x44af05;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x6986('0x0'))['db'][_0x6986('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x6986('0x2')](0x0);var events={'afterCreate':_0x6986('0x3'),'afterUpdate':_0x6986('0x4'),'afterDestroy':_0x6986('0x5')};function emitEvent(_0x520ac4){return function(_0x115981,_0x258d66,_0x15bb2e){FaxQueueEvents[_0x6986('0x6')](_0x520ac4+':'+_0x115981['id'],_0x115981);FaxQueueEvents[_0x6986('0x6')](_0x520ac4,_0x115981);_0x15bb2e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x6986('0x7')](e,emitEvent(event));}}module[_0x6986('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 8cf5b6b..477f85a 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 _0x4b9d=['moment','bluebird','path','rimraf','../../config/environment','./faxQueue.attributes','define','fax_queues','lodash','util','../../config/logger'];(function(_0x5a0630,_0x84bcd8){var _0x346ba9=function(_0x423a99){while(--_0x423a99){_0x5a0630['push'](_0x5a0630['shift']());}};_0x346ba9(++_0x84bcd8);}(_0x4b9d,0xd9));var _0xd4b9=function(_0x4c73ac,_0x46b73c){_0x4c73ac=_0x4c73ac-0x0;var _0x9839ee=_0x4b9d[_0x4c73ac];return _0x9839ee;};'use strict';var _=require(_0xd4b9('0x0'));var util=require(_0xd4b9('0x1'));var logger=require(_0xd4b9('0x2'))('api');var moment=require(_0xd4b9('0x3'));var BPromise=require(_0xd4b9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd4b9('0x5'));var rimraf=require(_0xd4b9('0x6'));var config=require(_0xd4b9('0x7'));var attributes=require(_0xd4b9('0x8'));module['exports']=function(_0x250d72,_0x17539e){return _0x250d72[_0xd4b9('0x9')]('FaxQueue',attributes,{'tableName':_0xd4b9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2bf8=['define','fax_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./faxQueue.attributes','exports'];(function(_0x212a37,_0xf35b2e){var _0x5d0bf9=function(_0x51850f){while(--_0x51850f){_0x212a37['push'](_0x212a37['shift']());}};_0x5d0bf9(++_0xf35b2e);}(_0x2bf8,0x15e));var _0x82bf=function(_0x303a5e,_0x4c071a){_0x303a5e=_0x303a5e-0x0;var _0x4fc3dd=_0x2bf8[_0x303a5e];return _0x4fc3dd;};'use strict';var _=require(_0x82bf('0x0'));var util=require(_0x82bf('0x1'));var logger=require('../../config/logger')(_0x82bf('0x2'));var moment=require(_0x82bf('0x3'));var BPromise=require(_0x82bf('0x4'));var rp=require(_0x82bf('0x5'));var fs=require('fs');var path=require(_0x82bf('0x6'));var rimraf=require(_0x82bf('0x7'));var config=require('../../config/environment');var attributes=require(_0x82bf('0x8'));module[_0x82bf('0x9')]=function(_0x4d31ca,_0x7b76c2){return _0x4d31ca[_0x82bf('0xa')]('FaxQueue',attributes,{'tableName':_0x82bf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index e41e020..476a19c 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 _0x4e4d=['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','attributes','limit','include','map','model','ShowFaxQueue','find','where','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','request','then','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4e4d,0xbb));var _0xd4e4=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x4e4d[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0xd4e4('0x0'));var util=require(_0xd4e4('0x1'));var moment=require(_0xd4e4('0x2'));var BPromise=require('bluebird');var rs=require(_0xd4e4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd4e4('0x4'));var logger=require(_0xd4e4('0x5'))(_0xd4e4('0x6'));var config=require(_0xd4e4('0x7'));var jayson=require(_0xd4e4('0x8'));var client=jayson[_0xd4e4('0x9')][_0xd4e4('0xa')]({'port':0x232a});config['redis']=_[_0xd4e4('0xb')](config[_0xd4e4('0xc')],{'host':_0xd4e4('0xd'),'port':0x18eb});var socket=require(_0xd4e4('0xe'))(new Redis(config[_0xd4e4('0xc')]));require('./faxQueue.socket')['register'](socket);function respondWithRpcPromise(_0x206b88,_0x23971,_0x569db8){return new BPromise(function(_0x24c36f,_0x6f085d){return client[_0xd4e4('0xf')](_0x206b88,_0x569db8)[_0xd4e4('0x10')](function(_0x244135){logger[_0xd4e4('0x11')](_0xd4e4('0x12'),_0x23971,_0xd4e4('0x13'));logger[_0xd4e4('0x14')](_0xd4e4('0x15'),_0x23971,_0xd4e4('0x13'),JSON[_0xd4e4('0x16')](_0x244135));if(_0x244135[_0xd4e4('0x17')]){if(_0x244135[_0xd4e4('0x17')][_0xd4e4('0x18')]===0x1f4){logger[_0xd4e4('0x17')](_0xd4e4('0x12'),_0x23971,_0x244135['error'][_0xd4e4('0x19')]);return _0x6f085d(_0x244135[_0xd4e4('0x17')][_0xd4e4('0x19')]);}logger[_0xd4e4('0x17')](_0xd4e4('0x12'),_0x23971,_0x244135['error'][_0xd4e4('0x19')]);return _0x24c36f(_0x244135[_0xd4e4('0x17')][_0xd4e4('0x19')]);}else{logger[_0xd4e4('0x11')]('FaxQueue,\x20%s,\x20%s',_0x23971,_0xd4e4('0x13'));_0x24c36f(_0x244135[_0xd4e4('0x1a')][_0xd4e4('0x19')]);}})[_0xd4e4('0x1b')](function(_0x544736){logger[_0xd4e4('0x17')]('FaxQueue,\x20%s,\x20%s',_0x23971,_0x544736);_0x6f085d(_0x544736);});});}exports[_0xd4e4('0x1c')]=function(_0x1612a7){var _0x121b2a=this;return new Promise(function(_0x597e97,_0x53184c){return db[_0xd4e4('0x1d')][_0xd4e4('0x1e')]({'raw':_0x1612a7[_0xd4e4('0x1f')]?_0x1612a7[_0xd4e4('0x1f')][_0xd4e4('0x20')]===undefined?!![]:![]:!![],'where':_0x1612a7['options']?_0x1612a7[_0xd4e4('0x1f')]['where']||null:null,'attributes':_0x1612a7[_0xd4e4('0x1f')]?_0x1612a7[_0xd4e4('0x1f')][_0xd4e4('0x21')]||null:null,'limit':_0x1612a7['options']?_0x1612a7[_0xd4e4('0x1f')][_0xd4e4('0x22')]||null:null,'include':_0x1612a7[_0xd4e4('0x1f')]?_0x1612a7[_0xd4e4('0x1f')][_0xd4e4('0x23')]?_[_0xd4e4('0x24')](_0x1612a7[_0xd4e4('0x1f')][_0xd4e4('0x23')],function(_0x57e888){return{'model':db[_0x57e888[_0xd4e4('0x25')]],'as':_0x57e888['as'],'attributes':_0x57e888[_0xd4e4('0x21')],'include':_0x57e888[_0xd4e4('0x23')]?_[_0xd4e4('0x24')](_0x57e888[_0xd4e4('0x23')],function(_0x15b3f1){return{'model':db[_0x15b3f1[_0xd4e4('0x25')]],'as':_0x15b3f1['as'],'attributes':_0x15b3f1[_0xd4e4('0x21')],'include':_0x15b3f1[_0xd4e4('0x23')]?_[_0xd4e4('0x24')](_0x15b3f1[_0xd4e4('0x23')],function(_0x201ab3){return{'model':db[_0x201ab3['model']],'as':_0x201ab3['as'],'attributes':_0x201ab3[_0xd4e4('0x21')]};}):[]};}):[]};}):[]:[]})[_0xd4e4('0x10')](function(_0x26e4a3){logger[_0xd4e4('0x11')](_0xd4e4('0x1c'),_0x1612a7);logger[_0xd4e4('0x14')](_0xd4e4('0x1c'),_0x1612a7,JSON[_0xd4e4('0x16')](_0x26e4a3));_0x597e97(_0x26e4a3);})[_0xd4e4('0x1b')](function(_0x3a8e56){logger[_0xd4e4('0x17')](_0xd4e4('0x1c'),_0x3a8e56[_0xd4e4('0x19')],_0x1612a7);_0x53184c(_0x121b2a[_0xd4e4('0x17')](0x1f4,_0x3a8e56['message']));});});};exports[_0xd4e4('0x26')]=function(_0x5ba68c){var _0x213f50=this;return new Promise(function(_0x57f671,_0x543919){return db[_0xd4e4('0x1d')][_0xd4e4('0x27')]({'raw':_0x5ba68c[_0xd4e4('0x1f')]?_0x5ba68c[_0xd4e4('0x1f')][_0xd4e4('0x20')]===undefined?!![]:![]:!![],'where':_0x5ba68c['options']?_0x5ba68c['options'][_0xd4e4('0x28')]||null:null,'attributes':_0x5ba68c['options']?_0x5ba68c[_0xd4e4('0x1f')][_0xd4e4('0x21')]||null:null,'include':_0x5ba68c['options']?_0x5ba68c[_0xd4e4('0x1f')][_0xd4e4('0x23')]?_[_0xd4e4('0x24')](_0x5ba68c[_0xd4e4('0x1f')][_0xd4e4('0x23')],function(_0x2a1609){return{'model':db[_0x2a1609[_0xd4e4('0x25')]],'as':_0x2a1609['as'],'attributes':_0x2a1609[_0xd4e4('0x21')],'include':_0x2a1609[_0xd4e4('0x23')]?_[_0xd4e4('0x24')](_0x2a1609[_0xd4e4('0x23')],function(_0x3931fc){return{'model':db[_0x3931fc[_0xd4e4('0x25')]],'as':_0x3931fc['as'],'attributes':_0x3931fc['attributes'],'include':_0x3931fc[_0xd4e4('0x23')]?_[_0xd4e4('0x24')](_0x3931fc[_0xd4e4('0x23')],function(_0x1a8c43){return{'model':db[_0x1a8c43['model']],'as':_0x1a8c43['as'],'attributes':_0x1a8c43[_0xd4e4('0x21')]};}):[]};}):[]};}):[]:[]})[_0xd4e4('0x10')](function(_0x209e65){logger[_0xd4e4('0x11')]('ShowFaxQueue',_0x5ba68c);logger[_0xd4e4('0x14')](_0xd4e4('0x26'),_0x5ba68c,JSON[_0xd4e4('0x16')](_0x209e65));_0x57f671(_0x209e65);})[_0xd4e4('0x1b')](function(_0x4cb970){logger[_0xd4e4('0x17')](_0xd4e4('0x26'),_0x4cb970[_0xd4e4('0x19')],_0x5ba68c);_0x543919(_0x213f50[_0xd4e4('0x17')](0x1f4,_0x4cb970[_0xd4e4('0x19')]));});});}; \ No newline at end of file +var _0xf768=['error','code','message','result','catch','options','raw','include','map','attributes','GetFaxQueue','ShowFaxQueue','FaxQueue','find','where','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','defaults','redis','localhost','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x491cf8,_0x8b5453){var _0x48a17d=function(_0x2f9eec){while(--_0x2f9eec){_0x491cf8['push'](_0x491cf8['shift']());}};_0x48a17d(++_0x8b5453);}(_0xf768,0x1f1));var _0x8f76=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xf768[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0x8f76('0x0'));var util=require(_0x8f76('0x1'));var moment=require(_0x8f76('0x2'));var BPromise=require(_0x8f76('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8f76('0x4'));var db=require(_0x8f76('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8f76('0x6'))('rpc');var config=require(_0x8f76('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x8f76('0x8')](config[_0x8f76('0x9')],{'host':_0x8f76('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8f76('0x9')]));require(_0x8f76('0xb'))[_0x8f76('0xc')](socket);function respondWithRpcPromise(_0x5e1595,_0x38f5e9,_0xe830e7){return new BPromise(function(_0x1024c2,_0xfad120){return client[_0x8f76('0xd')](_0x5e1595,_0xe830e7)[_0x8f76('0xe')](function(_0x422022){logger[_0x8f76('0xf')](_0x8f76('0x10'),_0x38f5e9,'request\x20sent');logger[_0x8f76('0x11')](_0x8f76('0x12'),_0x38f5e9,_0x8f76('0x13'),JSON[_0x8f76('0x14')](_0x422022));if(_0x422022[_0x8f76('0x15')]){if(_0x422022[_0x8f76('0x15')][_0x8f76('0x16')]===0x1f4){logger[_0x8f76('0x15')](_0x8f76('0x10'),_0x38f5e9,_0x422022[_0x8f76('0x15')]['message']);return _0xfad120(_0x422022[_0x8f76('0x15')][_0x8f76('0x17')]);}logger[_0x8f76('0x15')](_0x8f76('0x10'),_0x38f5e9,_0x422022[_0x8f76('0x15')][_0x8f76('0x17')]);return _0x1024c2(_0x422022[_0x8f76('0x15')]['message']);}else{logger[_0x8f76('0xf')](_0x8f76('0x10'),_0x38f5e9,'request\x20sent');_0x1024c2(_0x422022[_0x8f76('0x18')][_0x8f76('0x17')]);}})[_0x8f76('0x19')](function(_0x7279c9){logger['error'](_0x8f76('0x10'),_0x38f5e9,_0x7279c9);_0xfad120(_0x7279c9);});});}exports['GetFaxQueue']=function(_0x12d531){var _0x519eb1=this;return new Promise(function(_0x568c2c,_0xb4de28){return db['FaxQueue']['findAll']({'raw':_0x12d531['options']?_0x12d531[_0x8f76('0x1a')][_0x8f76('0x1b')]===undefined?!![]:![]:!![],'where':_0x12d531[_0x8f76('0x1a')]?_0x12d531[_0x8f76('0x1a')]['where']||null:null,'attributes':_0x12d531[_0x8f76('0x1a')]?_0x12d531[_0x8f76('0x1a')]['attributes']||null:null,'limit':_0x12d531['options']?_0x12d531[_0x8f76('0x1a')]['limit']||null:null,'include':_0x12d531['options']?_0x12d531[_0x8f76('0x1a')][_0x8f76('0x1c')]?_[_0x8f76('0x1d')](_0x12d531[_0x8f76('0x1a')][_0x8f76('0x1c')],function(_0x2cd638){return{'model':db[_0x2cd638['model']],'as':_0x2cd638['as'],'attributes':_0x2cd638[_0x8f76('0x1e')],'include':_0x2cd638[_0x8f76('0x1c')]?_[_0x8f76('0x1d')](_0x2cd638[_0x8f76('0x1c')],function(_0x2bef6d){return{'model':db[_0x2bef6d['model']],'as':_0x2bef6d['as'],'attributes':_0x2bef6d[_0x8f76('0x1e')],'include':_0x2bef6d['include']?_[_0x8f76('0x1d')](_0x2bef6d['include'],function(_0x2c650b){return{'model':db[_0x2c650b['model']],'as':_0x2c650b['as'],'attributes':_0x2c650b[_0x8f76('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ac7e2){logger[_0x8f76('0xf')](_0x8f76('0x1f'),_0x12d531);logger[_0x8f76('0x11')](_0x8f76('0x1f'),_0x12d531,JSON['stringify'](_0x1ac7e2));_0x568c2c(_0x1ac7e2);})['catch'](function(_0x1492b2){logger[_0x8f76('0x15')](_0x8f76('0x1f'),_0x1492b2[_0x8f76('0x17')],_0x12d531);_0xb4de28(_0x519eb1['error'](0x1f4,_0x1492b2[_0x8f76('0x17')]));});});};exports[_0x8f76('0x20')]=function(_0x8b2d84){var _0xe2f421=this;return new Promise(function(_0x59e605,_0x383c50){return db[_0x8f76('0x21')][_0x8f76('0x22')]({'raw':_0x8b2d84[_0x8f76('0x1a')]?_0x8b2d84['options'][_0x8f76('0x1b')]===undefined?!![]:![]:!![],'where':_0x8b2d84['options']?_0x8b2d84[_0x8f76('0x1a')][_0x8f76('0x23')]||null:null,'attributes':_0x8b2d84[_0x8f76('0x1a')]?_0x8b2d84[_0x8f76('0x1a')][_0x8f76('0x1e')]||null:null,'include':_0x8b2d84['options']?_0x8b2d84['options']['include']?_[_0x8f76('0x1d')](_0x8b2d84['options']['include'],function(_0x2e1131){return{'model':db[_0x2e1131[_0x8f76('0x24')]],'as':_0x2e1131['as'],'attributes':_0x2e1131[_0x8f76('0x1e')],'include':_0x2e1131[_0x8f76('0x1c')]?_['map'](_0x2e1131[_0x8f76('0x1c')],function(_0x181d24){return{'model':db[_0x181d24[_0x8f76('0x24')]],'as':_0x181d24['as'],'attributes':_0x181d24['attributes'],'include':_0x181d24[_0x8f76('0x1c')]?_[_0x8f76('0x1d')](_0x181d24[_0x8f76('0x1c')],function(_0x2d8a41){return{'model':db[_0x2d8a41[_0x8f76('0x24')]],'as':_0x2d8a41['as'],'attributes':_0x2d8a41[_0x8f76('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8f76('0xe')](function(_0x414143){logger[_0x8f76('0xf')](_0x8f76('0x20'),_0x8b2d84);logger[_0x8f76('0x11')](_0x8f76('0x20'),_0x8b2d84,JSON[_0x8f76('0x14')](_0x414143));_0x59e605(_0x414143);})[_0x8f76('0x19')](function(_0x330459){logger[_0x8f76('0x15')](_0x8f76('0x20'),_0x330459[_0x8f76('0x17')],_0x8b2d84);_0x383c50(_0xe2f421[_0x8f76('0x15')](0x1f4,_0x330459[_0x8f76('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 2e9189e..345904d 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 _0x789f=['save','remove','emit','removeListener','register','faxQueue:'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x789f,0x132));var _0xf789=function(_0x498334,_0x27b6fe){_0x498334=_0x498334-0x0;var _0x13bb70=_0x789f[_0x498334];return _0x13bb70;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0xf789('0x0'),_0xf789('0x1'),'update'];function createListener(_0x3d93c2,_0x44a8f0){return function(_0x570a42){_0x44a8f0[_0xf789('0x2')](_0x3d93c2,_0x570a42);};}function removeListener(_0x3b42f2,_0xca769a){return function(){FaxQueueEvents[_0xf789('0x3')](_0x3b42f2,_0xca769a);};}exports[_0xf789('0x4')]=function(_0x27f29e){for(var _0x4701d6=0x0,_0x8def63=events['length'];_0x4701d6<_0x8def63;_0x4701d6++){var _0x27737e=events[_0x4701d6];var _0x1fa1b2=createListener(_0xf789('0x5')+_0x27737e,_0x27f29e);FaxQueueEvents['on'](_0x27737e,_0x1fa1b2);}}; \ No newline at end of file +var _0x7176=['update','emit','removeListener','register','length','faxQueue:','./faxQueue.events','save'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7176,0x17e));var _0x6717=function(_0x1ce042,_0x55d438){_0x1ce042=_0x1ce042-0x0;var _0x3f1155=_0x7176[_0x1ce042];return _0x3f1155;};'use strict';var FaxQueueEvents=require(_0x6717('0x0'));var events=[_0x6717('0x1'),'remove',_0x6717('0x2')];function createListener(_0x142035,_0x1e7db6){return function(_0x198d8c){_0x1e7db6[_0x6717('0x3')](_0x142035,_0x198d8c);};}function removeListener(_0x319681,_0x5341b7){return function(){FaxQueueEvents[_0x6717('0x4')](_0x319681,_0x5341b7);};}exports[_0x6717('0x5')]=function(_0xe8f70b){for(var _0x51f5d5=0x0,_0x1061f2=events[_0x6717('0x6')];_0x51f5d5<_0x1061f2;_0x51f5d5++){var _0x481a04=events[_0x51f5d5];var _0xff530=createListener(_0x6717('0x7')+_0x481a04,_0xe8f70b);FaxQueueEvents['on'](_0x481a04,_0xff530);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index ba007d4..fbcbec6 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(_0x2ef44b,_0x553359){var _0x2405b9=function(_0x278290){while(--_0x278290){_0x2ef44b['push'](_0x2ef44b['shift']());}};_0x2405b9(++_0x553359);}(_0xb10b,0x12a));var _0xbb10=function(_0x81e39d,_0x4c3934){_0x81e39d=_0x81e39d-0x0;var _0x548fbb=_0xb10b[_0x81e39d];return _0x548fbb;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getMembers']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['get'](_0xbb10('0x11'),auth['isAuthenticated'](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x13')](_0xbb10('0xf'),auth['isAuthenticated'](),controller[_0xbb10('0x15')]);router[_0xbb10('0x13')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x16')]);router[_0xbb10('0x17')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x18')]);router[_0xbb10('0x19')]('/:id',auth[_0xbb10('0x9')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x19')](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1b')]);router[_0xbb10('0x19')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xbaf0=['create','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post'];(function(_0x1cd095,_0x43af58){var _0x2b1bcb=function(_0x1e4256){while(--_0x1e4256){_0x1cd095['push'](_0x1cd095['shift']());}};_0x2b1bcb(++_0x43af58);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbaf0[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var auth=require(_0x0baf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0baf('0x6'));var controller=require(_0x0baf('0x7'));router[_0x0baf('0x8')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0xa')]);router[_0x0baf('0x8')](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0xc')]);router['get'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0x8')](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x8')](_0x0baf('0x11'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x8')](_0x0baf('0x13'),auth['isAuthenticated'](),controller['getAgents']);router[_0x0baf('0x14')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0x15')]);router[_0x0baf('0x14')]('/:id/teams',auth[_0x0baf('0x9')](),controller['addTeams']);router[_0x0baf('0x14')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x16')]);router[_0x0baf('0x17')](_0x0baf('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x0baf('0x18')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x19')]);router[_0x0baf('0x18')](_0x0baf('0x11'),auth['isAuthenticated'](),controller[_0x0baf('0x1a')]);router[_0x0baf('0x18')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x1b')]);module[_0x0baf('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 3854cef..a955a22 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 _0x1a63=['DATE','moment','sequelize','exports','STRING'];(function(_0x4733d3,_0x454290){var _0x1b9a44=function(_0x1a93bb){while(--_0x1a93bb){_0x4733d3['push'](_0x4733d3['shift']());}};_0x1b9a44(++_0x454290);}(_0x1a63,0x83));var _0x31a6=function(_0x5d3d39,_0x5ed8a1){_0x5d3d39=_0x5d3d39-0x0;var _0x2de363=_0x1a63[_0x5d3d39];return _0x2de363;};'use strict';var moment=require(_0x31a6('0x0'));var Sequelize=require(_0x31a6('0x1'));module[_0x31a6('0x2')]={'uniqueid':{'type':Sequelize[_0x31a6('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x31a6('0x3')]},'joinAt':{'type':Sequelize[_0x31a6('0x4')]},'leaveAt':{'type':Sequelize[_0x31a6('0x4')]},'acceptAt':{'type':Sequelize[_0x31a6('0x4')]},'exitAt':{'type':Sequelize[_0x31a6('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x988c=['STRING','DATE','moment','sequelize','exports'];(function(_0x37c8c4,_0x192fbe){var _0x3f570f=function(_0x10fcb6){while(--_0x10fcb6){_0x37c8c4['push'](_0x37c8c4['shift']());}};_0x3f570f(++_0x192fbe);}(_0x988c,0xfc));var _0xc988=function(_0x417d68,_0x295f4f){_0x417d68=_0x417d68-0x0;var _0x59f88e=_0x988c[_0x417d68];return _0x59f88e;};'use strict';var moment=require(_0xc988('0x0'));var Sequelize=require(_0xc988('0x1'));module[_0xc988('0x2')]={'uniqueid':{'type':Sequelize[_0xc988('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xc988('0x4')]},'leaveAt':{'type':Sequelize[_0xc988('0x4')]},'acceptAt':{'type':Sequelize[_0xc988('0x4')]},'exitAt':{'type':Sequelize[_0xc988('0x4')]},'reason':{'type':Sequelize[_0xc988('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 0d93452..072d96c 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 _0x244b=['count','includeAll','include','findAll','catch','params','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','FaxQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0xad40f5,_0x245f13){var _0x236292=function(_0x8a6086){while(--_0x8a6086){_0xad40f5['push'](_0xad40f5['shift']());}};_0x236292(++_0x245f13);}(_0x244b,0x1b5));var _0xb244=function(_0x58203c,_0x4a7d09){_0x58203c=_0x58203c-0x0;var _0x5f1013=_0x244b[_0x58203c];return _0x5f1013;};'use strict';var pdf=require(_0xb244('0x0'));var emlformat=require(_0xb244('0x1'));var rimraf=require(_0xb244('0x2'));var zipdir=require(_0xb244('0x3'));var jsonpatch=require(_0xb244('0x4'));var rp=require(_0xb244('0x5'));var moment=require(_0xb244('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xb244('0x7'));var util=require(_0xb244('0x8'));var path=require(_0xb244('0x9'));var sox=require('sox');var csv=require(_0xb244('0xa'));var ejs=require(_0xb244('0xb'));var fs=require('fs');var _=require(_0xb244('0xc'));var squel=require('squel');var crypto=require(_0xb244('0xd'));var jsforce=require(_0xb244('0xe'));var deskjs=require(_0xb244('0xf'));var toCsv=require(_0xb244('0xa'));var querystring=require(_0xb244('0x10'));var Papa=require(_0xb244('0x11'));var Redis=require('ioredis');var authService=require(_0xb244('0x12'));var qs=require(_0xb244('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb244('0x14'));var utils=require(_0xb244('0x15'));var config=require(_0xb244('0x16'));var db=require(_0xb244('0x17'))['db'];function respondWithStatusCode(_0x35fde7,_0x32dc9b){_0x32dc9b=_0x32dc9b||0xcc;return function(_0xa827eb){if(_0xa827eb){return _0x35fde7[_0xb244('0x18')](_0x32dc9b);}return _0x35fde7[_0xb244('0x19')](_0x32dc9b)[_0xb244('0x1a')]();};}function respondWithResult(_0x22bc55,_0x2ff56a){_0x2ff56a=_0x2ff56a||0xc8;return function(_0x125dae){if(_0x125dae){return _0x22bc55['status'](_0x2ff56a)[_0xb244('0x1b')](_0x125dae);}};}function respondWithFilteredResult(_0x4d2f2a,_0x2fff21){return function(_0x30c4e2){if(_0x30c4e2){var _0x259fb5=_0x30c4e2['count'],_0x26888b=_0x2fff21[_0xb244('0x1c')],_0x4e9d5f=_0x2fff21['offset']+_0x2fff21[_0xb244('0x1d')],_0x500b37;if(_0x4e9d5f>=_0x259fb5){_0x4e9d5f=_0x259fb5;_0x500b37=0xc8;}else{_0x500b37=0xce;}_0x4d2f2a[_0xb244('0x19')](_0x500b37);return _0x4d2f2a['set'](_0xb244('0x1e'),_0x26888b+'-'+_0x4e9d5f+'/'+_0x259fb5)[_0xb244('0x1b')](_0x30c4e2);}return null;};}function patchUpdates(_0x5b8cda){return function(_0x480552){try{jsonpatch[_0xb244('0x1f')](_0x480552,_0x5b8cda,!![]);}catch(_0x4cd786){return BPromise[_0xb244('0x20')](_0x4cd786);}return _0x480552[_0xb244('0x21')]();};}function saveUpdates(_0x721ced,_0x26e48a){return function(_0x45d68d){if(_0x45d68d){return _0x45d68d[_0xb244('0x22')](_0x721ced)[_0xb244('0x23')](function(_0x1c909d){return _0x1c909d;});}return null;};}function removeEntity(_0x3da3a0,_0x38a289){return function(_0x308b6e){if(_0x308b6e){return _0x308b6e['destroy']()[_0xb244('0x23')](function(){_0x3da3a0[_0xb244('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d89a1,_0xfe8794){return function(_0x3a93bc){if(!_0x3a93bc){_0x3d89a1[_0xb244('0x18')](0x194);}return _0x3a93bc;};}function handleError(_0xcbe2e7,_0x493452){_0x493452=_0x493452||0x1f4;return function(_0x43e0d1){logger[_0xb244('0x24')](_0x43e0d1[_0xb244('0x25')]);if(_0x43e0d1[_0xb244('0x26')]){delete _0x43e0d1['name'];}_0xcbe2e7[_0xb244('0x19')](_0x493452)['send'](_0x43e0d1);};}exports[_0xb244('0x27')]=function(_0x8c3101,_0x203146){var _0x353c28={},_0x2a0270={},_0x41322a={'count':0x0,'rows':[]};var _0x3da086=_[_0xb244('0x28')](db[_0xb244('0x29')][_0xb244('0x2a')],function(_0x169ce5){return{'name':_0x169ce5[_0xb244('0x2b')],'type':_0x169ce5[_0xb244('0x2c')]['key']};});_0x2a0270[_0xb244('0x2d')]=_[_0xb244('0x28')](_0x3da086,_0xb244('0x26'));_0x2a0270[_0xb244('0x2e')]=_[_0xb244('0x2f')](_0x8c3101['query']);_0x2a0270[_0xb244('0x30')]=_['intersection'](_0x2a0270[_0xb244('0x2d')],_0x2a0270[_0xb244('0x2e')]);_0x353c28[_0xb244('0x31')]=_['intersection'](_0x2a0270[_0xb244('0x2d')],qs['fields'](_0x8c3101['query'][_0xb244('0x32')]));_0x353c28[_0xb244('0x31')]=_0x353c28[_0xb244('0x31')][_0xb244('0x33')]?_0x353c28[_0xb244('0x31')]:_0x2a0270[_0xb244('0x2d')];if(!_0x8c3101[_0xb244('0x2e')]['hasOwnProperty'](_0xb244('0x34'))){_0x353c28[_0xb244('0x1d')]=qs['limit'](_0x8c3101[_0xb244('0x2e')]['limit']);_0x353c28[_0xb244('0x1c')]=qs[_0xb244('0x1c')](_0x8c3101['query']['offset']);}_0x353c28['order']=qs[_0xb244('0x35')](_0x8c3101[_0xb244('0x2e')][_0xb244('0x35')]);_0x353c28[_0xb244('0x36')]=qs[_0xb244('0x30')](_[_0xb244('0x37')](_0x8c3101[_0xb244('0x2e')],_0x2a0270[_0xb244('0x30')]));if(_0x8c3101[_0xb244('0x2e')][_0xb244('0x38')]){_0x353c28['where']=_[_0xb244('0x39')](_0x353c28[_0xb244('0x36')],{'$or':_[_0xb244('0x28')](_0x3da086,function(_0x1379b8){if(_0x1379b8[_0xb244('0x2c')]!==_0xb244('0x3a')){var _0xc8c431={};_0xc8c431[_0x1379b8[_0xb244('0x26')]]={'$like':'%'+_0x8c3101[_0xb244('0x2e')][_0xb244('0x38')]+'%'};return _0xc8c431;}})});}_0x353c28=_[_0xb244('0x39')]({},_0x353c28,_0x8c3101[_0xb244('0x3b')]);var _0x2a458c={'where':_0x353c28[_0xb244('0x36')]};return db['FaxQueueReport'][_0xb244('0x3c')](_0x2a458c)[_0xb244('0x23')](function(_0x481526){_0x41322a[_0xb244('0x3c')]=_0x481526;if(_0x8c3101[_0xb244('0x2e')][_0xb244('0x3d')]){_0x353c28[_0xb244('0x3e')]=[{'all':!![]}];}return db['FaxQueueReport'][_0xb244('0x3f')](_0x353c28);})[_0xb244('0x23')](function(_0x29d83a){_0x41322a['rows']=_0x29d83a;return _0x41322a;})[_0xb244('0x23')](respondWithFilteredResult(_0x203146,_0x353c28))[_0xb244('0x40')](handleError(_0x203146,null));};exports['show']=function(_0x2d2619,_0x3193d6){var _0x49a046={'raw':!![],'where':{'id':_0x2d2619[_0xb244('0x41')]['id']}},_0x28b2d2={};_0x28b2d2['model']=_[_0xb244('0x2f')](db[_0xb244('0x29')][_0xb244('0x2a')]);_0x28b2d2[_0xb244('0x2e')]=_[_0xb244('0x2f')](_0x2d2619[_0xb244('0x2e')]);_0x28b2d2[_0xb244('0x30')]=_['intersection'](_0x28b2d2[_0xb244('0x2d')],_0x28b2d2[_0xb244('0x2e')]);_0x49a046[_0xb244('0x31')]=_['intersection'](_0x28b2d2[_0xb244('0x2d')],qs[_0xb244('0x32')](_0x2d2619[_0xb244('0x2e')][_0xb244('0x32')]));_0x49a046[_0xb244('0x31')]=_0x49a046[_0xb244('0x31')][_0xb244('0x33')]?_0x49a046[_0xb244('0x31')]:_0x28b2d2['model'];if(_0x2d2619['query'][_0xb244('0x3d')]){_0x49a046[_0xb244('0x3e')]=[{'all':!![]}];}_0x49a046=_[_0xb244('0x39')]({},_0x49a046,_0x2d2619['options']);return db[_0xb244('0x29')][_0xb244('0x42')](_0x49a046)[_0xb244('0x23')](handleEntityNotFound(_0x3193d6,null))[_0xb244('0x23')](respondWithResult(_0x3193d6,null))[_0xb244('0x40')](handleError(_0x3193d6,null));};exports[_0xb244('0x43')]=function(_0x46cd8a,_0xdc7753){return db[_0xb244('0x29')]['create'](_0x46cd8a[_0xb244('0x44')],{})[_0xb244('0x23')](respondWithResult(_0xdc7753,0xc9))[_0xb244('0x40')](handleError(_0xdc7753,null));};exports['update']=function(_0xbf713f,_0x4557c7){if(_0xbf713f['body']['id']){delete _0xbf713f[_0xb244('0x44')]['id'];}return db['FaxQueueReport'][_0xb244('0x42')]({'where':{'id':_0xbf713f[_0xb244('0x41')]['id']}})[_0xb244('0x23')](handleEntityNotFound(_0x4557c7,null))['then'](saveUpdates(_0xbf713f[_0xb244('0x44')],null))['then'](respondWithResult(_0x4557c7,null))['catch'](handleError(_0x4557c7,null));};exports[_0xb244('0x45')]=function(_0x6e86ff,_0x24c048){return db[_0xb244('0x29')][_0xb244('0x42')]({'where':{'id':_0x6e86ff['params']['id']}})['then'](handleEntityNotFound(_0x24c048,null))['then'](removeEntity(_0x24c048,null))[_0xb244('0x40')](handleError(_0x24c048,null));};exports[_0xb244('0x46')]=function(_0x57410f,_0x509305){return db[_0xb244('0x29')][_0xb244('0x46')]()[_0xb244('0x23')](respondWithResult(_0x509305,null))[_0xb244('0x40')](handleError(_0x509305,null));}; \ No newline at end of file +var _0x36bd=['destroy','error','stack','name','map','FaxQueueReport','rawAttributes','fieldName','query','filters','model','intersection','fields','attributes','length','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then'];(function(_0x210753,_0x2523da){var _0x553a0d=function(_0x3a3942){while(--_0x3a3942){_0x210753['push'](_0x210753['shift']());}};_0x553a0d(++_0x2523da);}(_0x36bd,0x1c1));var _0xd36b=function(_0x2a4d62,_0x4846e8){_0x2a4d62=_0x2a4d62-0x0;var _0x560fb8=_0x36bd[_0x2a4d62];return _0x560fb8;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xd36b('0x0'));var zipdir=require(_0xd36b('0x1'));var jsonpatch=require(_0xd36b('0x2'));var rp=require(_0xd36b('0x3'));var moment=require(_0xd36b('0x4'));var BPromise=require(_0xd36b('0x5'));var Mustache=require(_0xd36b('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd36b('0x7'));var fs=require('fs');var _=require(_0xd36b('0x8'));var squel=require(_0xd36b('0x9'));var crypto=require('crypto');var jsforce=require(_0xd36b('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xd36b('0xb'));var querystring=require(_0xd36b('0xc'));var Papa=require('papaparse');var Redis=require(_0xd36b('0xd'));var authService=require(_0xd36b('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xd36b('0xf'));var hardwareService=require(_0xd36b('0x10'));var logger=require(_0xd36b('0x11'))(_0xd36b('0x12'));var utils=require(_0xd36b('0x13'));var config=require(_0xd36b('0x14'));var db=require(_0xd36b('0x15'))['db'];function respondWithStatusCode(_0x3edaee,_0x52e646){_0x52e646=_0x52e646||0xcc;return function(_0x3cad54){if(_0x3cad54){return _0x3edaee[_0xd36b('0x16')](_0x52e646);}return _0x3edaee[_0xd36b('0x17')](_0x52e646)[_0xd36b('0x18')]();};}function respondWithResult(_0x4896ea,_0x5195fa){_0x5195fa=_0x5195fa||0xc8;return function(_0x90af1a){if(_0x90af1a){return _0x4896ea[_0xd36b('0x17')](_0x5195fa)[_0xd36b('0x19')](_0x90af1a);}};}function respondWithFilteredResult(_0x5b6645,_0x77cb9e){return function(_0x4e17b9){if(_0x4e17b9){var _0x25e145=_0x4e17b9[_0xd36b('0x1a')],_0x3dba78=_0x77cb9e[_0xd36b('0x1b')],_0x56a513=_0x77cb9e[_0xd36b('0x1b')]+_0x77cb9e['limit'],_0x370c89;if(_0x56a513>=_0x25e145){_0x56a513=_0x25e145;_0x370c89=0xc8;}else{_0x370c89=0xce;}_0x5b6645['status'](_0x370c89);return _0x5b6645[_0xd36b('0x1c')](_0xd36b('0x1d'),_0x3dba78+'-'+_0x56a513+'/'+_0x25e145)[_0xd36b('0x19')](_0x4e17b9);}return null;};}function patchUpdates(_0x2f88d7){return function(_0x174609){try{jsonpatch[_0xd36b('0x1e')](_0x174609,_0x2f88d7,!![]);}catch(_0x305399){return BPromise['reject'](_0x305399);}return _0x174609[_0xd36b('0x1f')]();};}function saveUpdates(_0x30414a,_0x39a3cb){return function(_0x270a10){if(_0x270a10){return _0x270a10[_0xd36b('0x20')](_0x30414a)[_0xd36b('0x21')](function(_0x5775b2){return _0x5775b2;});}return null;};}function removeEntity(_0x3dcdeb,_0x3feb17){return function(_0x553d0d){if(_0x553d0d){return _0x553d0d[_0xd36b('0x22')]()[_0xd36b('0x21')](function(){_0x3dcdeb[_0xd36b('0x17')](0xcc)[_0xd36b('0x18')]();});}};}function handleEntityNotFound(_0x525e1a,_0x201c4f){return function(_0x533b33){if(!_0x533b33){_0x525e1a[_0xd36b('0x16')](0x194);}return _0x533b33;};}function handleError(_0x38a834,_0x29bfb2){_0x29bfb2=_0x29bfb2||0x1f4;return function(_0x138338){logger[_0xd36b('0x23')](_0x138338[_0xd36b('0x24')]);if(_0x138338[_0xd36b('0x25')]){delete _0x138338['name'];}_0x38a834[_0xd36b('0x17')](_0x29bfb2)['send'](_0x138338);};}exports['index']=function(_0x4467ac,_0x39b68e){var _0x578834={},_0x55ed21={},_0xd0ad14={'count':0x0,'rows':[]};var _0x7a3d4d=_[_0xd36b('0x26')](db[_0xd36b('0x27')][_0xd36b('0x28')],function(_0x19fa68){return{'name':_0x19fa68[_0xd36b('0x29')],'type':_0x19fa68['type']['key']};});_0x55ed21['model']=_[_0xd36b('0x26')](_0x7a3d4d,_0xd36b('0x25'));_0x55ed21[_0xd36b('0x2a')]=_['keys'](_0x4467ac[_0xd36b('0x2a')]);_0x55ed21[_0xd36b('0x2b')]=_['intersection'](_0x55ed21[_0xd36b('0x2c')],_0x55ed21['query']);_0x578834['attributes']=_[_0xd36b('0x2d')](_0x55ed21[_0xd36b('0x2c')],qs['fields'](_0x4467ac['query'][_0xd36b('0x2e')]));_0x578834[_0xd36b('0x2f')]=_0x578834[_0xd36b('0x2f')][_0xd36b('0x30')]?_0x578834[_0xd36b('0x2f')]:_0x55ed21[_0xd36b('0x2c')];if(!_0x4467ac['query']['hasOwnProperty']('nolimit')){_0x578834['limit']=qs[_0xd36b('0x31')](_0x4467ac[_0xd36b('0x2a')][_0xd36b('0x31')]);_0x578834[_0xd36b('0x1b')]=qs['offset'](_0x4467ac[_0xd36b('0x2a')][_0xd36b('0x1b')]);}_0x578834[_0xd36b('0x32')]=qs[_0xd36b('0x33')](_0x4467ac[_0xd36b('0x2a')]['sort']);_0x578834[_0xd36b('0x34')]=qs[_0xd36b('0x2b')](_[_0xd36b('0x35')](_0x4467ac['query'],_0x55ed21[_0xd36b('0x2b')]));if(_0x4467ac[_0xd36b('0x2a')][_0xd36b('0x36')]){_0x578834['where']=_[_0xd36b('0x37')](_0x578834[_0xd36b('0x34')],{'$or':_[_0xd36b('0x26')](_0x7a3d4d,function(_0x52e58a){if(_0x52e58a['type']!==_0xd36b('0x38')){var _0x4d3255={};_0x4d3255[_0x52e58a[_0xd36b('0x25')]]={'$like':'%'+_0x4467ac[_0xd36b('0x2a')]['filter']+'%'};return _0x4d3255;}})});}_0x578834=_[_0xd36b('0x37')]({},_0x578834,_0x4467ac[_0xd36b('0x39')]);var _0x3cf440={'where':_0x578834['where']};return db[_0xd36b('0x27')][_0xd36b('0x1a')](_0x3cf440)[_0xd36b('0x21')](function(_0x35f58f){_0xd0ad14['count']=_0x35f58f;if(_0x4467ac['query'][_0xd36b('0x3a')]){_0x578834['include']=[{'all':!![]}];}return db['FaxQueueReport'][_0xd36b('0x3b')](_0x578834);})['then'](function(_0x4944e6){_0xd0ad14[_0xd36b('0x3c')]=_0x4944e6;return _0xd0ad14;})[_0xd36b('0x21')](respondWithFilteredResult(_0x39b68e,_0x578834))[_0xd36b('0x3d')](handleError(_0x39b68e,null));};exports[_0xd36b('0x3e')]=function(_0x4b67fa,_0x86fa44){var _0x4ab927={'raw':!![],'where':{'id':_0x4b67fa[_0xd36b('0x3f')]['id']}},_0x55aa3c={};_0x55aa3c['model']=_['keys'](db['FaxQueueReport'][_0xd36b('0x28')]);_0x55aa3c[_0xd36b('0x2a')]=_['keys'](_0x4b67fa[_0xd36b('0x2a')]);_0x55aa3c[_0xd36b('0x2b')]=_['intersection'](_0x55aa3c[_0xd36b('0x2c')],_0x55aa3c[_0xd36b('0x2a')]);_0x4ab927[_0xd36b('0x2f')]=_[_0xd36b('0x2d')](_0x55aa3c[_0xd36b('0x2c')],qs['fields'](_0x4b67fa[_0xd36b('0x2a')][_0xd36b('0x2e')]));_0x4ab927['attributes']=_0x4ab927[_0xd36b('0x2f')][_0xd36b('0x30')]?_0x4ab927['attributes']:_0x55aa3c['model'];if(_0x4b67fa[_0xd36b('0x2a')][_0xd36b('0x3a')]){_0x4ab927[_0xd36b('0x40')]=[{'all':!![]}];}_0x4ab927=_['merge']({},_0x4ab927,_0x4b67fa[_0xd36b('0x39')]);return db[_0xd36b('0x27')]['find'](_0x4ab927)['then'](handleEntityNotFound(_0x86fa44,null))[_0xd36b('0x21')](respondWithResult(_0x86fa44,null))[_0xd36b('0x3d')](handleError(_0x86fa44,null));};exports['create']=function(_0x15f765,_0x1e4778){return db['FaxQueueReport'][_0xd36b('0x41')](_0x15f765[_0xd36b('0x42')],{})[_0xd36b('0x21')](respondWithResult(_0x1e4778,0xc9))['catch'](handleError(_0x1e4778,null));};exports[_0xd36b('0x20')]=function(_0x226124,_0x2b1189){if(_0x226124[_0xd36b('0x42')]['id']){delete _0x226124['body']['id'];}return db['FaxQueueReport'][_0xd36b('0x43')]({'where':{'id':_0x226124[_0xd36b('0x3f')]['id']}})[_0xd36b('0x21')](handleEntityNotFound(_0x2b1189,null))[_0xd36b('0x21')](saveUpdates(_0x226124[_0xd36b('0x42')],null))[_0xd36b('0x21')](respondWithResult(_0x2b1189,null))[_0xd36b('0x3d')](handleError(_0x2b1189,null));};exports[_0xd36b('0x22')]=function(_0x1c2d9,_0x58b795){return db[_0xd36b('0x27')][_0xd36b('0x43')]({'where':{'id':_0x1c2d9[_0xd36b('0x3f')]['id']}})[_0xd36b('0x21')](handleEntityNotFound(_0x58b795,null))[_0xd36b('0x21')](removeEntity(_0x58b795,null))[_0xd36b('0x3d')](handleError(_0x58b795,null));};exports[_0xd36b('0x44')]=function(_0x4bdcd1,_0x36b99b){return db['FaxQueueReport'][_0xd36b('0x44')]()[_0xd36b('0x21')](respondWithResult(_0x36b99b,null))[_0xd36b('0x3d')](handleError(_0x36b99b,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index f9d5317..c3b7765 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 _0x4686=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','util'];(function(_0x1ef2c9,_0x472b87){var _0x3c4257=function(_0x2320e5){while(--_0x2320e5){_0x1ef2c9['push'](_0x1ef2c9['shift']());}};_0x3c4257(++_0x472b87);}(_0x4686,0x1e8));var _0x6468=function(_0x2c9e15,_0x3ff2f2){_0x2c9e15=_0x2c9e15-0x0;var _0x90e2d4=_0x4686[_0x2c9e15];return _0x90e2d4;};'use strict';var _=require(_0x6468('0x0'));var util=require(_0x6468('0x1'));var logger=require(_0x6468('0x2'))('api');var moment=require(_0x6468('0x3'));var BPromise=require(_0x6468('0x4'));var rp=require(_0x6468('0x5'));var fs=require('fs');var path=require(_0x6468('0x6'));var rimraf=require(_0x6468('0x7'));var config=require(_0x6468('0x8'));var attributes=require(_0x6468('0x9'));module[_0x6468('0xa')]=function(_0x33ca1e,_0x4e9dd2){return _0x33ca1e['define'](_0x6468('0xb'),attributes,{'tableName':_0x6468('0xc'),'paranoid':![],'indexes':[{'name':_0x6468('0xd'),'fields':[_0x6468('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xae18=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','report_fax_queue','uniqueid','util'];(function(_0x25081f,_0x223347){var _0x5da204=function(_0x4c3cb4){while(--_0x4c3cb4){_0x25081f['push'](_0x25081f['shift']());}};_0x5da204(++_0x223347);}(_0xae18,0x74));var _0x8ae1=function(_0x582e23,_0x370658){_0x582e23=_0x582e23-0x0;var _0x515092=_0xae18[_0x582e23];return _0x515092;};'use strict';var _=require('lodash');var util=require(_0x8ae1('0x0'));var logger=require(_0x8ae1('0x1'))(_0x8ae1('0x2'));var moment=require(_0x8ae1('0x3'));var BPromise=require(_0x8ae1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8ae1('0x5'));var rimraf=require(_0x8ae1('0x6'));var config=require(_0x8ae1('0x7'));var attributes=require(_0x8ae1('0x8'));module[_0x8ae1('0x9')]=function(_0x36788a,_0x4687df){return _0x36788a[_0x8ae1('0xa')]('FaxQueueReport',attributes,{'tableName':_0x8ae1('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8ae1('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index d832b8f..cc2e84c 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 _0x0d42=['request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','CreateFaxQueueReport','create','body','options','raw','debug','stringify','catch','UpdateFaxQueueReport','FaxQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x4c97d8,_0x3baab4){var _0xf4e6e=function(_0x12ac40){while(--_0x12ac40){_0x4c97d8['push'](_0x4c97d8['shift']());}};_0xf4e6e(++_0x3baab4);}(_0x0d42,0x198));var _0x20d4=function(_0x229532,_0x1c0e67){_0x229532=_0x229532-0x0;var _0x598c8a=_0x0d42[_0x229532];return _0x598c8a;};'use strict';var _=require(_0x20d4('0x0'));var util=require(_0x20d4('0x1'));var moment=require(_0x20d4('0x2'));var BPromise=require(_0x20d4('0x3'));var rs=require(_0x20d4('0x4'));var fs=require('fs');var Redis=require(_0x20d4('0x5'));var db=require(_0x20d4('0x6'))['db'];var utils=require(_0x20d4('0x7'));var logger=require(_0x20d4('0x8'))('rpc');var config=require(_0x20d4('0x9'));var jayson=require(_0x20d4('0xa'));var client=jayson[_0x20d4('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4137c2,_0x2263ed,_0x182b06){return new BPromise(function(_0x1c7f16,_0xcd648e){return client[_0x20d4('0xc')](_0x4137c2,_0x182b06)[_0x20d4('0xd')](function(_0x4f82dd){logger[_0x20d4('0xe')](_0x20d4('0xf'),_0x2263ed,_0x20d4('0x10'));logger['debug'](_0x20d4('0x11'),_0x2263ed,_0x20d4('0x10'),JSON['stringify'](_0x4f82dd));if(_0x4f82dd[_0x20d4('0x12')]){if(_0x4f82dd[_0x20d4('0x12')][_0x20d4('0x13')]===0x1f4){logger[_0x20d4('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x2263ed,_0x4f82dd[_0x20d4('0x12')][_0x20d4('0x14')]);return _0xcd648e(_0x4f82dd[_0x20d4('0x12')]['message']);}logger[_0x20d4('0x12')](_0x20d4('0xf'),_0x2263ed,_0x4f82dd[_0x20d4('0x12')][_0x20d4('0x14')]);return _0x1c7f16(_0x4f82dd[_0x20d4('0x12')][_0x20d4('0x14')]);}else{logger[_0x20d4('0xe')](_0x20d4('0xf'),_0x2263ed,_0x20d4('0x10'));_0x1c7f16(_0x4f82dd['result']['message']);}})['catch'](function(_0x5ced83){logger[_0x20d4('0x12')](_0x20d4('0xf'),_0x2263ed,_0x5ced83);_0xcd648e(_0x5ced83);});});}exports[_0x20d4('0x15')]=function(_0x32fd5a){var _0x3165ba=this;return new Promise(function(_0x524275,_0x2a8492){return db['FaxQueueReport'][_0x20d4('0x16')](_0x32fd5a[_0x20d4('0x17')],{'raw':_0x32fd5a[_0x20d4('0x18')]?_0x32fd5a[_0x20d4('0x18')][_0x20d4('0x19')]===undefined?!![]:![]:!![]})[_0x20d4('0xd')](function(_0x3dc6db){logger['info'](_0x20d4('0x15'),_0x32fd5a);logger[_0x20d4('0x1a')](_0x20d4('0x15'),_0x32fd5a,JSON[_0x20d4('0x1b')](_0x3dc6db));_0x524275(_0x3dc6db);})[_0x20d4('0x1c')](function(_0xf8b6aa){logger[_0x20d4('0x12')](_0x20d4('0x15'),_0xf8b6aa[_0x20d4('0x14')],_0x32fd5a);_0x2a8492(_0x3165ba['error'](0x1f4,_0xf8b6aa[_0x20d4('0x14')]));});});};exports[_0x20d4('0x1d')]=function(_0xce5a7a){var _0x412e9e=this;return new Promise(function(_0x51cb45,_0x5a6bf0){return db[_0x20d4('0x1e')][_0x20d4('0x1f')](_0xce5a7a[_0x20d4('0x17')],{'raw':_0xce5a7a[_0x20d4('0x18')]?_0xce5a7a[_0x20d4('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xce5a7a[_0x20d4('0x18')]?_0xce5a7a['options'][_0x20d4('0x20')]||null:null,'attributes':_0xce5a7a[_0x20d4('0x18')]?_0xce5a7a[_0x20d4('0x18')][_0x20d4('0x21')]||null:null,'limit':_0xce5a7a[_0x20d4('0x18')]?_0xce5a7a[_0x20d4('0x18')][_0x20d4('0x22')]||null:null})[_0x20d4('0xd')](function(_0x5d12eb){logger[_0x20d4('0xe')](_0x20d4('0x1d'),_0xce5a7a);logger[_0x20d4('0x1a')]('UpdateFaxQueueReport',_0xce5a7a,JSON['stringify'](_0x5d12eb));_0x51cb45(_0x5d12eb);})[_0x20d4('0x1c')](function(_0x302231){logger[_0x20d4('0x12')](_0x20d4('0x1d'),_0x302231['message'],_0xce5a7a);_0x5a6bf0(_0x412e9e[_0x20d4('0x12')](0x1f4,_0x302231[_0x20d4('0x14')]));});});}; \ No newline at end of file +var _0x264e=['debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','UpdateFaxQueueReport','update','where','limit','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x14e5c0,_0x2c8436){var _0x5332fd=function(_0x4536e7){while(--_0x4536e7){_0x14e5c0['push'](_0x14e5c0['shift']());}};_0x5332fd(++_0x2c8436);}(_0x264e,0x1b1));var _0xe264=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x264e[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xe264('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe264('0x1'));var rs=require(_0xe264('0x2'));var fs=require('fs');var Redis=require(_0xe264('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe264('0x4'));var logger=require(_0xe264('0x5'))(_0xe264('0x6'));var config=require(_0xe264('0x7'));var jayson=require(_0xe264('0x8'));var client=jayson[_0xe264('0x9')][_0xe264('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3574d9,_0x5c37cb,_0x744844){return new BPromise(function(_0x4e7bc3,_0x4755f5){return client['request'](_0x3574d9,_0x744844)[_0xe264('0xb')](function(_0x239846){logger[_0xe264('0xc')](_0xe264('0xd'),_0x5c37cb,_0xe264('0xe'));logger[_0xe264('0xf')](_0xe264('0x10'),_0x5c37cb,_0xe264('0xe'),JSON[_0xe264('0x11')](_0x239846));if(_0x239846[_0xe264('0x12')]){if(_0x239846[_0xe264('0x12')]['code']===0x1f4){logger['error'](_0xe264('0xd'),_0x5c37cb,_0x239846[_0xe264('0x12')]['message']);return _0x4755f5(_0x239846['error']['message']);}logger['error'](_0xe264('0xd'),_0x5c37cb,_0x239846[_0xe264('0x12')][_0xe264('0x13')]);return _0x4e7bc3(_0x239846[_0xe264('0x12')][_0xe264('0x13')]);}else{logger[_0xe264('0xc')](_0xe264('0xd'),_0x5c37cb,_0xe264('0xe'));_0x4e7bc3(_0x239846[_0xe264('0x14')]['message']);}})[_0xe264('0x15')](function(_0x3ad01f){logger[_0xe264('0x12')](_0xe264('0xd'),_0x5c37cb,_0x3ad01f);_0x4755f5(_0x3ad01f);});});}exports[_0xe264('0x16')]=function(_0x377aeb){var _0x294e4d=this;return new Promise(function(_0x9b7f49,_0x719056){return db[_0xe264('0x17')][_0xe264('0x18')](_0x377aeb[_0xe264('0x19')],{'raw':_0x377aeb['options']?_0x377aeb[_0xe264('0x1a')][_0xe264('0x1b')]===undefined?!![]:![]:!![]})[_0xe264('0xb')](function(_0x570cb7){logger['info']('CreateFaxQueueReport',_0x377aeb);logger[_0xe264('0xf')](_0xe264('0x16'),_0x377aeb,JSON[_0xe264('0x11')](_0x570cb7));_0x9b7f49(_0x570cb7);})[_0xe264('0x15')](function(_0x548369){logger[_0xe264('0x12')](_0xe264('0x16'),_0x548369[_0xe264('0x13')],_0x377aeb);_0x719056(_0x294e4d[_0xe264('0x12')](0x1f4,_0x548369[_0xe264('0x13')]));});});};exports[_0xe264('0x1c')]=function(_0x3c7efb){var _0x2c9cad=this;return new Promise(function(_0xd9a84e,_0x44bdf8){return db[_0xe264('0x17')][_0xe264('0x1d')](_0x3c7efb['body'],{'raw':_0x3c7efb[_0xe264('0x1a')]?_0x3c7efb[_0xe264('0x1a')][_0xe264('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c7efb[_0xe264('0x1a')]?_0x3c7efb[_0xe264('0x1a')][_0xe264('0x1e')]||null:null,'attributes':_0x3c7efb[_0xe264('0x1a')]?_0x3c7efb[_0xe264('0x1a')]['attributes']||null:null,'limit':_0x3c7efb[_0xe264('0x1a')]?_0x3c7efb[_0xe264('0x1a')][_0xe264('0x1f')]||null:null})['then'](function(_0x4eebf9){logger['info'](_0xe264('0x1c'),_0x3c7efb);logger[_0xe264('0xf')](_0xe264('0x1c'),_0x3c7efb,JSON[_0xe264('0x11')](_0x4eebf9));_0xd9a84e(_0x4eebf9);})[_0xe264('0x15')](function(_0x1ee92a){logger['error'](_0xe264('0x1c'),_0x1ee92a[_0xe264('0x13')],_0x3c7efb);_0x44bdf8(_0x2c9cad[_0xe264('0x12')](0x1f4,_0x1ee92a[_0xe264('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 8635d1c..00639ab 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 _0x02bf=['show','post','create','put','update','/:id','destroy','exports','multer','path','express','Router','../../components/auth/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','/describe'];(function(_0x5d00ff,_0x42e04b){var _0x5700bf=function(_0x24930e){while(--_0x24930e){_0x5d00ff['push'](_0x5d00ff['shift']());}};_0x5700bf(++_0x42e04b);}(_0x02bf,0x1ca));var _0xf02b=function(_0x5bd4f6,_0xf4e45c){_0x5bd4f6=_0x5bd4f6-0x0;var _0x33a165=_0x02bf[_0x5bd4f6];return _0x33a165;};'use strict';var multer=require(_0xf02b('0x0'));var util=require('util');var path=require(_0xf02b('0x1'));var timeout=require('connect-timeout');var express=require(_0xf02b('0x2'));var router=express[_0xf02b('0x3')]();var auth=require(_0xf02b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf02b('0x5'));var controller=require(_0xf02b('0x6'));router[_0xf02b('0x7')]('/',auth[_0xf02b('0x8')](),controller['index']);router['get'](_0xf02b('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xf02b('0x7')]('/:id',auth[_0xf02b('0x8')](),controller[_0xf02b('0xa')]);router[_0xf02b('0xb')]('/',auth['isAuthenticated'](),controller[_0xf02b('0xc')]);router[_0xf02b('0xd')]('/:id',auth[_0xf02b('0x8')](),controller[_0xf02b('0xe')]);router['delete'](_0xf02b('0xf'),auth[_0xf02b('0x8')](),controller[_0xf02b('0x10')]);module[_0xf02b('0x11')]=router; \ No newline at end of file +var _0xf334=['destroy','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','isAuthenticated','describe','show','post','put','update','delete'];(function(_0x69a451,_0x49fd37){var _0x3d6ef5=function(_0x27ebf4){while(--_0x27ebf4){_0x69a451['push'](_0x69a451['shift']());}};_0x3d6ef5(++_0x49fd37);}(_0xf334,0x178));var _0x4f33=function(_0x451dee,_0x1b4320){_0x451dee=_0x451dee-0x0;var _0x4ad728=_0xf334[_0x451dee];return _0x4ad728;};'use strict';var multer=require(_0x4f33('0x0'));var util=require(_0x4f33('0x1'));var path=require('path');var timeout=require(_0x4f33('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x4f33('0x3'));var interaction=require(_0x4f33('0x4'));var config=require(_0x4f33('0x5'));var controller=require('./faxQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x4f33('0x6')]);router[_0x4f33('0x7')]('/describe',auth[_0x4f33('0x8')](),controller[_0x4f33('0x9')]);router[_0x4f33('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x4f33('0xa')]);router[_0x4f33('0xb')]('/',auth[_0x4f33('0x8')](),controller['create']);router[_0x4f33('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x4f33('0xd')]);router[_0x4f33('0xe')]('/:id',auth[_0x4f33('0x8')](),controller[_0x4f33('0xf')]);module[_0x4f33('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index f45c065..ee30985 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 _0x6b04=['queue','moment','exports','STRING','ENUM','account','agent'];(function(_0x3474bb,_0x216281){var _0x5db28e=function(_0x36db70){while(--_0x36db70){_0x3474bb['push'](_0x3474bb['shift']());}};_0x5db28e(++_0x216281);}(_0x6b04,0xcc));var _0x46b0=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x6b04[_0x3947c9];return _0x2e7871;};'use strict';var moment=require(_0x46b0('0x0'));var Sequelize=require('sequelize');module[_0x46b0('0x1')]={'uniqueid':{'type':Sequelize[_0x46b0('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x46b0('0x3')](_0x46b0('0x4'),_0x46b0('0x5'),_0x46b0('0x6')),'allowNull':![],'defaultValue':_0x46b0('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x0b05=['sequelize','exports','STRING','ENUM','account','agent','DATE','NOW','moment'];(function(_0x2b3468,_0x2c3e5d){var _0x276fc4=function(_0x93e9ea){while(--_0x93e9ea){_0x2b3468['push'](_0x2b3468['shift']());}};_0x276fc4(++_0x2c3e5d);}(_0x0b05,0xd7));var _0x50b0=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0x0b05[_0x18cd5b];return _0x5eaa52;};'use strict';var moment=require(_0x50b0('0x0'));var Sequelize=require(_0x50b0('0x1'));module[_0x50b0('0x2')]={'uniqueid':{'type':Sequelize[_0x50b0('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x50b0('0x4')](_0x50b0('0x5'),_0x50b0('0x6'),'queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x50b0('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x50b0('0x8')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 83968f5..9781870 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 _0x09aa=['status','count','offset','limit','Content-Range','apply','reject','update','then','end','error','stack','name','send','index','FaxTransferReport','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x5a41b8,_0xfb31e9){var _0x37069f=function(_0xdff7a3){while(--_0xdff7a3){_0x5a41b8['push'](_0x5a41b8['shift']());}};_0x37069f(++_0xfb31e9);}(_0x09aa,0x161));var _0xa09a=function(_0x425b2d,_0x28f8d2){_0x425b2d=_0x425b2d-0x0;var _0x356017=_0x09aa[_0x425b2d];return _0x356017;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa09a('0x0'));var rimraf=require(_0xa09a('0x1'));var zipdir=require(_0xa09a('0x2'));var jsonpatch=require(_0xa09a('0x3'));var rp=require(_0xa09a('0x4'));var moment=require('moment');var BPromise=require(_0xa09a('0x5'));var Mustache=require(_0xa09a('0x6'));var util=require(_0xa09a('0x7'));var path=require(_0xa09a('0x8'));var sox=require(_0xa09a('0x9'));var csv=require(_0xa09a('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa09a('0xb'));var squel=require(_0xa09a('0xc'));var crypto=require(_0xa09a('0xd'));var jsforce=require(_0xa09a('0xe'));var deskjs=require(_0xa09a('0xf'));var toCsv=require(_0xa09a('0xa'));var querystring=require(_0xa09a('0x10'));var Papa=require(_0xa09a('0x11'));var Redis=require(_0xa09a('0x12'));var authService=require(_0xa09a('0x13'));var qs=require(_0xa09a('0x14'));var as=require(_0xa09a('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa09a('0x16'));var utils=require(_0xa09a('0x17'));var config=require(_0xa09a('0x18'));var db=require(_0xa09a('0x19'))['db'];function respondWithStatusCode(_0x1ffe8d,_0x5b7df2){_0x5b7df2=_0x5b7df2||0xcc;return function(_0xc549fa){if(_0xc549fa){return _0x1ffe8d[_0xa09a('0x1a')](_0x5b7df2);}return _0x1ffe8d[_0xa09a('0x1b')](_0x5b7df2)['end']();};}function respondWithResult(_0x3250dd,_0x1e9ef8){_0x1e9ef8=_0x1e9ef8||0xc8;return function(_0xb6088e){if(_0xb6088e){return _0x3250dd[_0xa09a('0x1b')](_0x1e9ef8)['json'](_0xb6088e);}};}function respondWithFilteredResult(_0x272488,_0x9aa825){return function(_0x46dabb){if(_0x46dabb){var _0x1b7478=_0x46dabb[_0xa09a('0x1c')],_0x46f6b5=_0x9aa825['offset'],_0x3789f5=_0x9aa825[_0xa09a('0x1d')]+_0x9aa825[_0xa09a('0x1e')],_0x3d2db4;if(_0x3789f5>=_0x1b7478){_0x3789f5=_0x1b7478;_0x3d2db4=0xc8;}else{_0x3d2db4=0xce;}_0x272488[_0xa09a('0x1b')](_0x3d2db4);return _0x272488['set'](_0xa09a('0x1f'),_0x46f6b5+'-'+_0x3789f5+'/'+_0x1b7478)['json'](_0x46dabb);}return null;};}function patchUpdates(_0x3948ac){return function(_0x424e2a){try{jsonpatch[_0xa09a('0x20')](_0x424e2a,_0x3948ac,!![]);}catch(_0x4c9253){return BPromise[_0xa09a('0x21')](_0x4c9253);}return _0x424e2a['save']();};}function saveUpdates(_0xaa4d75,_0x8e49e6){return function(_0x1ec475){if(_0x1ec475){return _0x1ec475[_0xa09a('0x22')](_0xaa4d75)['then'](function(_0xe10e5b){return _0xe10e5b;});}return null;};}function removeEntity(_0x36e665,_0x5d3d2){return function(_0x12f609){if(_0x12f609){return _0x12f609['destroy']()[_0xa09a('0x23')](function(){_0x36e665[_0xa09a('0x1b')](0xcc)[_0xa09a('0x24')]();});}};}function handleEntityNotFound(_0xbe9e84,_0x27b507){return function(_0x88d3f9){if(!_0x88d3f9){_0xbe9e84['sendStatus'](0x194);}return _0x88d3f9;};}function handleError(_0x27d177,_0x30393d){_0x30393d=_0x30393d||0x1f4;return function(_0x3c194f){logger[_0xa09a('0x25')](_0x3c194f[_0xa09a('0x26')]);if(_0x3c194f[_0xa09a('0x27')]){delete _0x3c194f['name'];}_0x27d177[_0xa09a('0x1b')](_0x30393d)[_0xa09a('0x28')](_0x3c194f);};}exports[_0xa09a('0x29')]=function(_0x42fccc,_0x2a2834){var _0x331f06={},_0x2db76a={},_0x5e0a69={'count':0x0,'rows':[]};var _0x4f2c14=_['map'](db[_0xa09a('0x2a')]['rawAttributes'],function(_0x2f79ab){return{'name':_0x2f79ab[_0xa09a('0x2b')],'type':_0x2f79ab[_0xa09a('0x2c')]['key']};});_0x2db76a[_0xa09a('0x2d')]=_[_0xa09a('0x2e')](_0x4f2c14,'name');_0x2db76a[_0xa09a('0x2f')]=_[_0xa09a('0x30')](_0x42fccc[_0xa09a('0x2f')]);_0x2db76a['filters']=_[_0xa09a('0x31')](_0x2db76a[_0xa09a('0x2d')],_0x2db76a[_0xa09a('0x2f')]);_0x331f06[_0xa09a('0x32')]=_['intersection'](_0x2db76a[_0xa09a('0x2d')],qs['fields'](_0x42fccc[_0xa09a('0x2f')][_0xa09a('0x33')]));_0x331f06[_0xa09a('0x32')]=_0x331f06['attributes'][_0xa09a('0x34')]?_0x331f06[_0xa09a('0x32')]:_0x2db76a[_0xa09a('0x2d')];if(!_0x42fccc['query'][_0xa09a('0x35')](_0xa09a('0x36'))){_0x331f06[_0xa09a('0x1e')]=qs[_0xa09a('0x1e')](_0x42fccc[_0xa09a('0x2f')]['limit']);_0x331f06['offset']=qs['offset'](_0x42fccc[_0xa09a('0x2f')]['offset']);}_0x331f06[_0xa09a('0x37')]=qs['sort'](_0x42fccc[_0xa09a('0x2f')][_0xa09a('0x38')]);_0x331f06[_0xa09a('0x39')]=qs[_0xa09a('0x3a')](_[_0xa09a('0x3b')](_0x42fccc[_0xa09a('0x2f')],_0x2db76a['filters']));if(_0x42fccc[_0xa09a('0x2f')][_0xa09a('0x3c')]){_0x331f06['where']=_[_0xa09a('0x3d')](_0x331f06[_0xa09a('0x39')],{'$or':_[_0xa09a('0x2e')](_0x4f2c14,function(_0xcd8586){if(_0xcd8586[_0xa09a('0x2c')]!==_0xa09a('0x3e')){var _0xe380e3={};_0xe380e3[_0xcd8586[_0xa09a('0x27')]]={'$like':'%'+_0x42fccc[_0xa09a('0x2f')][_0xa09a('0x3c')]+'%'};return _0xe380e3;}})});}_0x331f06=_[_0xa09a('0x3d')]({},_0x331f06,_0x42fccc[_0xa09a('0x3f')]);var _0x366e01={'where':_0x331f06[_0xa09a('0x39')]};return db[_0xa09a('0x2a')][_0xa09a('0x1c')](_0x366e01)['then'](function(_0x5bec4e){_0x5e0a69[_0xa09a('0x1c')]=_0x5bec4e;if(_0x42fccc[_0xa09a('0x2f')][_0xa09a('0x40')]){_0x331f06[_0xa09a('0x41')]=[{'all':!![]}];}return db[_0xa09a('0x2a')][_0xa09a('0x42')](_0x331f06);})[_0xa09a('0x23')](function(_0x168eac){_0x5e0a69[_0xa09a('0x43')]=_0x168eac;return _0x5e0a69;})['then'](respondWithFilteredResult(_0x2a2834,_0x331f06))[_0xa09a('0x44')](handleError(_0x2a2834,null));};exports[_0xa09a('0x45')]=function(_0x2c37fd,_0xcc7b24){var _0xa8710c={'raw':!![],'where':{'id':_0x2c37fd['params']['id']}},_0x557065={};_0x557065[_0xa09a('0x2d')]=_['keys'](db[_0xa09a('0x2a')]['rawAttributes']);_0x557065[_0xa09a('0x2f')]=_[_0xa09a('0x30')](_0x2c37fd[_0xa09a('0x2f')]);_0x557065['filters']=_[_0xa09a('0x31')](_0x557065[_0xa09a('0x2d')],_0x557065[_0xa09a('0x2f')]);_0xa8710c[_0xa09a('0x32')]=_[_0xa09a('0x31')](_0x557065[_0xa09a('0x2d')],qs[_0xa09a('0x33')](_0x2c37fd[_0xa09a('0x2f')][_0xa09a('0x33')]));_0xa8710c[_0xa09a('0x32')]=_0xa8710c['attributes'][_0xa09a('0x34')]?_0xa8710c['attributes']:_0x557065[_0xa09a('0x2d')];if(_0x2c37fd[_0xa09a('0x2f')][_0xa09a('0x40')]){_0xa8710c['include']=[{'all':!![]}];}_0xa8710c=_['merge']({},_0xa8710c,_0x2c37fd[_0xa09a('0x3f')]);return db['FaxTransferReport'][_0xa09a('0x46')](_0xa8710c)[_0xa09a('0x23')](handleEntityNotFound(_0xcc7b24,null))[_0xa09a('0x23')](respondWithResult(_0xcc7b24,null))[_0xa09a('0x44')](handleError(_0xcc7b24,null));};exports[_0xa09a('0x47')]=function(_0x26146a,_0x16c840){return db[_0xa09a('0x2a')][_0xa09a('0x47')](_0x26146a['body'],{})[_0xa09a('0x23')](respondWithResult(_0x16c840,0xc9))[_0xa09a('0x44')](handleError(_0x16c840,null));};exports[_0xa09a('0x22')]=function(_0x3c2873,_0x5eb5f2){if(_0x3c2873[_0xa09a('0x48')]['id']){delete _0x3c2873['body']['id'];}return db[_0xa09a('0x2a')][_0xa09a('0x46')]({'where':{'id':_0x3c2873[_0xa09a('0x49')]['id']}})['then'](handleEntityNotFound(_0x5eb5f2,null))[_0xa09a('0x23')](saveUpdates(_0x3c2873['body'],null))[_0xa09a('0x23')](respondWithResult(_0x5eb5f2,null))[_0xa09a('0x44')](handleError(_0x5eb5f2,null));};exports[_0xa09a('0x4a')]=function(_0x519f03,_0x570e34){return db[_0xa09a('0x2a')][_0xa09a('0x46')]({'where':{'id':_0x519f03[_0xa09a('0x49')]['id']}})[_0xa09a('0x23')](handleEntityNotFound(_0x570e34,null))[_0xa09a('0x23')](removeEntity(_0x570e34,null))[_0xa09a('0x44')](handleError(_0x570e34,null));};exports[_0xa09a('0x4b')]=function(_0x242fc1,_0x1cd56f){return db['FaxTransferReport'][_0xa09a('0x4b')]()[_0xa09a('0x23')](respondWithResult(_0x1cd56f,null))[_0xa09a('0x44')](handleError(_0x1cd56f,null));}; \ No newline at end of file +var _0x0626=['sort','pick','filter','where','type','VIRTUAL','merge','options','FaxTransferReport','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','html-pdf','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit'];(function(_0xc0a4ed,_0x38de4e){var _0x3fddc9=function(_0x247e57){while(--_0x247e57){_0xc0a4ed['push'](_0xc0a4ed['shift']());}};_0x3fddc9(++_0x38de4e);}(_0x0626,0xa8));var _0x6062=function(_0x51c720,_0x3f38b4){_0x51c720=_0x51c720-0x0;var _0x47e95e=_0x0626[_0x51c720];return _0x47e95e;};'use strict';var pdf=require(_0x6062('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6062('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6062('0x2'));var moment=require('moment');var BPromise=require(_0x6062('0x3'));var Mustache=require(_0x6062('0x4'));var util=require(_0x6062('0x5'));var path=require(_0x6062('0x6'));var sox=require(_0x6062('0x7'));var csv=require(_0x6062('0x8'));var ejs=require(_0x6062('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6062('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6062('0xb'));var toCsv=require(_0x6062('0x8'));var querystring=require(_0x6062('0xc'));var Papa=require(_0x6062('0xd'));var Redis=require(_0x6062('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x6062('0xf'));var as=require(_0x6062('0x10'));var hardwareService=require(_0x6062('0x11'));var logger=require(_0x6062('0x12'))(_0x6062('0x13'));var utils=require(_0x6062('0x14'));var config=require(_0x6062('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e6274,_0x5676bc){_0x5676bc=_0x5676bc||0xcc;return function(_0x29ecdc){if(_0x29ecdc){return _0x2e6274[_0x6062('0x16')](_0x5676bc);}return _0x2e6274[_0x6062('0x17')](_0x5676bc)[_0x6062('0x18')]();};}function respondWithResult(_0x12ce34,_0x1e7d63){_0x1e7d63=_0x1e7d63||0xc8;return function(_0x2eb822){if(_0x2eb822){return _0x12ce34['status'](_0x1e7d63)[_0x6062('0x19')](_0x2eb822);}};}function respondWithFilteredResult(_0xc5ed2b,_0x106310){return function(_0x76f166){if(_0x76f166){var _0xc470d4=_0x76f166[_0x6062('0x1a')],_0x412d62=_0x106310[_0x6062('0x1b')],_0x44de2e=_0x106310[_0x6062('0x1b')]+_0x106310['limit'],_0x3b1624;if(_0x44de2e>=_0xc470d4){_0x44de2e=_0xc470d4;_0x3b1624=0xc8;}else{_0x3b1624=0xce;}_0xc5ed2b[_0x6062('0x17')](_0x3b1624);return _0xc5ed2b[_0x6062('0x1c')](_0x6062('0x1d'),_0x412d62+'-'+_0x44de2e+'/'+_0xc470d4)[_0x6062('0x19')](_0x76f166);}return null;};}function patchUpdates(_0x313243){return function(_0x40f7b9){try{jsonpatch[_0x6062('0x1e')](_0x40f7b9,_0x313243,!![]);}catch(_0x41e324){return BPromise[_0x6062('0x1f')](_0x41e324);}return _0x40f7b9[_0x6062('0x20')]();};}function saveUpdates(_0x5e6fac,_0x483cee){return function(_0x5cc4ea){if(_0x5cc4ea){return _0x5cc4ea[_0x6062('0x21')](_0x5e6fac)[_0x6062('0x22')](function(_0x35aad4){return _0x35aad4;});}return null;};}function removeEntity(_0x204586,_0x5d5f21){return function(_0x4fa9e8){if(_0x4fa9e8){return _0x4fa9e8[_0x6062('0x23')]()[_0x6062('0x22')](function(){_0x204586[_0x6062('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e2d4b,_0xc5a0bd){return function(_0x3ac911){if(!_0x3ac911){_0x3e2d4b[_0x6062('0x16')](0x194);}return _0x3ac911;};}function handleError(_0x2d5801,_0x42dcd8){_0x42dcd8=_0x42dcd8||0x1f4;return function(_0x4e6f7a){logger[_0x6062('0x24')](_0x4e6f7a['stack']);if(_0x4e6f7a[_0x6062('0x25')]){delete _0x4e6f7a[_0x6062('0x25')];}_0x2d5801[_0x6062('0x17')](_0x42dcd8)[_0x6062('0x26')](_0x4e6f7a);};}exports[_0x6062('0x27')]=function(_0xf4983,_0x432d7f){var _0x51d7ea={},_0x54e0e7={},_0x5f8a9d={'count':0x0,'rows':[]};var _0xcb5d4f=_[_0x6062('0x28')](db['FaxTransferReport'][_0x6062('0x29')],function(_0x189ada){return{'name':_0x189ada[_0x6062('0x2a')],'type':_0x189ada['type'][_0x6062('0x2b')]};});_0x54e0e7[_0x6062('0x2c')]=_[_0x6062('0x28')](_0xcb5d4f,'name');_0x54e0e7[_0x6062('0x2d')]=_['keys'](_0xf4983['query']);_0x54e0e7[_0x6062('0x2e')]=_[_0x6062('0x2f')](_0x54e0e7[_0x6062('0x2c')],_0x54e0e7[_0x6062('0x2d')]);_0x51d7ea[_0x6062('0x30')]=_[_0x6062('0x2f')](_0x54e0e7[_0x6062('0x2c')],qs[_0x6062('0x31')](_0xf4983[_0x6062('0x2d')][_0x6062('0x31')]));_0x51d7ea[_0x6062('0x30')]=_0x51d7ea[_0x6062('0x30')][_0x6062('0x32')]?_0x51d7ea[_0x6062('0x30')]:_0x54e0e7[_0x6062('0x2c')];if(!_0xf4983[_0x6062('0x2d')][_0x6062('0x33')](_0x6062('0x34'))){_0x51d7ea[_0x6062('0x35')]=qs[_0x6062('0x35')](_0xf4983[_0x6062('0x2d')][_0x6062('0x35')]);_0x51d7ea[_0x6062('0x1b')]=qs['offset'](_0xf4983['query']['offset']);}_0x51d7ea['order']=qs['sort'](_0xf4983['query'][_0x6062('0x36')]);_0x51d7ea['where']=qs[_0x6062('0x2e')](_[_0x6062('0x37')](_0xf4983[_0x6062('0x2d')],_0x54e0e7[_0x6062('0x2e')]));if(_0xf4983[_0x6062('0x2d')][_0x6062('0x38')]){_0x51d7ea[_0x6062('0x39')]=_['merge'](_0x51d7ea[_0x6062('0x39')],{'$or':_[_0x6062('0x28')](_0xcb5d4f,function(_0x15dd52){if(_0x15dd52[_0x6062('0x3a')]!==_0x6062('0x3b')){var _0x359b45={};_0x359b45[_0x15dd52[_0x6062('0x25')]]={'$like':'%'+_0xf4983[_0x6062('0x2d')][_0x6062('0x38')]+'%'};return _0x359b45;}})});}_0x51d7ea=_[_0x6062('0x3c')]({},_0x51d7ea,_0xf4983[_0x6062('0x3d')]);var _0x18ecc4={'where':_0x51d7ea[_0x6062('0x39')]};return db[_0x6062('0x3e')][_0x6062('0x1a')](_0x18ecc4)[_0x6062('0x22')](function(_0x17f93a){_0x5f8a9d[_0x6062('0x1a')]=_0x17f93a;if(_0xf4983[_0x6062('0x2d')][_0x6062('0x3f')]){_0x51d7ea[_0x6062('0x40')]=[{'all':!![]}];}return db[_0x6062('0x3e')][_0x6062('0x41')](_0x51d7ea);})[_0x6062('0x22')](function(_0x15fda2){_0x5f8a9d[_0x6062('0x42')]=_0x15fda2;return _0x5f8a9d;})['then'](respondWithFilteredResult(_0x432d7f,_0x51d7ea))[_0x6062('0x43')](handleError(_0x432d7f,null));};exports[_0x6062('0x44')]=function(_0x52d5c6,_0x16ed5d){var _0x4c318c={'raw':!![],'where':{'id':_0x52d5c6[_0x6062('0x45')]['id']}},_0x5b61b1={};_0x5b61b1['model']=_['keys'](db[_0x6062('0x3e')][_0x6062('0x29')]);_0x5b61b1[_0x6062('0x2d')]=_['keys'](_0x52d5c6[_0x6062('0x2d')]);_0x5b61b1[_0x6062('0x2e')]=_[_0x6062('0x2f')](_0x5b61b1['model'],_0x5b61b1[_0x6062('0x2d')]);_0x4c318c[_0x6062('0x30')]=_['intersection'](_0x5b61b1[_0x6062('0x2c')],qs[_0x6062('0x31')](_0x52d5c6[_0x6062('0x2d')][_0x6062('0x31')]));_0x4c318c[_0x6062('0x30')]=_0x4c318c[_0x6062('0x30')]['length']?_0x4c318c[_0x6062('0x30')]:_0x5b61b1[_0x6062('0x2c')];if(_0x52d5c6[_0x6062('0x2d')]['includeAll']){_0x4c318c[_0x6062('0x40')]=[{'all':!![]}];}_0x4c318c=_[_0x6062('0x3c')]({},_0x4c318c,_0x52d5c6[_0x6062('0x3d')]);return db[_0x6062('0x3e')]['find'](_0x4c318c)['then'](handleEntityNotFound(_0x16ed5d,null))[_0x6062('0x22')](respondWithResult(_0x16ed5d,null))[_0x6062('0x43')](handleError(_0x16ed5d,null));};exports[_0x6062('0x46')]=function(_0x200a05,_0x3391e7){return db[_0x6062('0x3e')][_0x6062('0x46')](_0x200a05[_0x6062('0x47')],{})[_0x6062('0x22')](respondWithResult(_0x3391e7,0xc9))[_0x6062('0x43')](handleError(_0x3391e7,null));};exports['update']=function(_0x2f217a,_0x17c1f8){if(_0x2f217a[_0x6062('0x47')]['id']){delete _0x2f217a['body']['id'];}return db['FaxTransferReport']['find']({'where':{'id':_0x2f217a['params']['id']}})[_0x6062('0x22')](handleEntityNotFound(_0x17c1f8,null))['then'](saveUpdates(_0x2f217a[_0x6062('0x47')],null))[_0x6062('0x22')](respondWithResult(_0x17c1f8,null))[_0x6062('0x43')](handleError(_0x17c1f8,null));};exports['destroy']=function(_0xb7b34f,_0x1ad8ba){return db['FaxTransferReport'][_0x6062('0x48')]({'where':{'id':_0xb7b34f['params']['id']}})[_0x6062('0x22')](handleEntityNotFound(_0x1ad8ba,null))['then'](removeEntity(_0x1ad8ba,null))[_0x6062('0x43')](handleError(_0x1ad8ba,null));};exports[_0x6062('0x49')]=function(_0x4f465c,_0x3bc55c){return db[_0x6062('0x3e')][_0x6062('0x49')]()[_0x6062('0x22')](respondWithResult(_0x3bc55c,null))[_0x6062('0x43')](handleError(_0x3bc55c,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 45bb235..77b4f43 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 _0x729a=['./faxTransferReport.attributes','exports','define','FaxTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0xd2d133,_0x3ffcc0){var _0x45b4e9=function(_0x478390){while(--_0x478390){_0xd2d133['push'](_0xd2d133['shift']());}};_0x45b4e9(++_0x3ffcc0);}(_0x729a,0xf3));var _0xa729=function(_0x33732f,_0x537323){_0x33732f=_0x33732f-0x0;var _0x248736=_0x729a[_0x33732f];return _0x248736;};'use strict';var _=require(_0xa729('0x0'));var util=require(_0xa729('0x1'));var logger=require(_0xa729('0x2'))(_0xa729('0x3'));var moment=require(_0xa729('0x4'));var BPromise=require(_0xa729('0x5'));var rp=require(_0xa729('0x6'));var fs=require('fs');var path=require(_0xa729('0x7'));var rimraf=require('rimraf');var config=require(_0xa729('0x8'));var attributes=require(_0xa729('0x9'));module[_0xa729('0xa')]=function(_0x39917a,_0xd17050){return _0x39917a[_0xa729('0xb')](_0xa729('0xc'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xa729('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x16a6=['define','report_fax_transfer','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','./faxTransferReport.attributes','exports'];(function(_0x593ce4,_0x44a5a2){var _0x111454=function(_0x2b4a2a){while(--_0x2b4a2a){_0x593ce4['push'](_0x593ce4['shift']());}};_0x111454(++_0x44a5a2);}(_0x16a6,0x120));var _0x616a=function(_0x484cac,_0x30ad3a){_0x484cac=_0x484cac-0x0;var _0x1d6e77=_0x16a6[_0x484cac];return _0x1d6e77;};'use strict';var _=require(_0x616a('0x0'));var util=require(_0x616a('0x1'));var logger=require(_0x616a('0x2'))('api');var moment=require(_0x616a('0x3'));var BPromise=require(_0x616a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x616a('0x5'));var rimraf=require('rimraf');var config=require(_0x616a('0x6'));var attributes=require(_0x616a('0x7'));module[_0x616a('0x8')]=function(_0x5d04cb,_0x1f0947){return _0x5d04cb[_0x616a('0x9')]('FaxTransferReport',attributes,{'tableName':_0x616a('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 247ebf5..0a9b83b 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 _0x8185=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x8185,0xec));var _0x5818=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x8185[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x5818('0x0'));var util=require(_0x5818('0x1'));var moment=require(_0x5818('0x2'));var BPromise=require(_0x5818('0x3'));var rs=require(_0x5818('0x4'));var fs=require('fs');var Redis=require(_0x5818('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5818('0x6'));var logger=require(_0x5818('0x7'))(_0x5818('0x8'));var config=require('../../config/environment');var jayson=require(_0x5818('0x9'));var client=jayson[_0x5818('0xa')][_0x5818('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f2530,_0x26c7aa,_0x1ae5c6){return new BPromise(function(_0x504a58,_0x24e8fc){return client[_0x5818('0xc')](_0x2f2530,_0x1ae5c6)[_0x5818('0xd')](function(_0x1de557){logger[_0x5818('0xe')](_0x5818('0xf'),_0x26c7aa,_0x5818('0x10'));logger['debug'](_0x5818('0x11'),_0x26c7aa,_0x5818('0x10'),JSON[_0x5818('0x12')](_0x1de557));if(_0x1de557[_0x5818('0x13')]){if(_0x1de557[_0x5818('0x13')][_0x5818('0x14')]===0x1f4){logger[_0x5818('0x13')]('FaxTransferReport,\x20%s,\x20%s',_0x26c7aa,_0x1de557[_0x5818('0x13')][_0x5818('0x15')]);return _0x24e8fc(_0x1de557[_0x5818('0x13')]['message']);}logger[_0x5818('0x13')]('FaxTransferReport,\x20%s,\x20%s',_0x26c7aa,_0x1de557[_0x5818('0x13')][_0x5818('0x15')]);return _0x504a58(_0x1de557[_0x5818('0x13')][_0x5818('0x15')]);}else{logger[_0x5818('0xe')](_0x5818('0xf'),_0x26c7aa,_0x5818('0x10'));_0x504a58(_0x1de557['result'][_0x5818('0x15')]);}})['catch'](function(_0x1da518){logger['error'](_0x5818('0xf'),_0x26c7aa,_0x1da518);_0x24e8fc(_0x1da518);});});} \ No newline at end of file +var _0x6419=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','util'];(function(_0x17c18c,_0x37dc0b){var _0xd9acc5=function(_0x3e17aa){while(--_0x3e17aa){_0x17c18c['push'](_0x17c18c['shift']());}};_0xd9acc5(++_0x37dc0b);}(_0x6419,0x82));var _0x9641=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6419[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x9641('0x0'));var util=require(_0x9641('0x1'));var moment=require(_0x9641('0x2'));var BPromise=require(_0x9641('0x3'));var rs=require(_0x9641('0x4'));var fs=require('fs');var Redis=require(_0x9641('0x5'));var db=require(_0x9641('0x6'))['db'];var utils=require(_0x9641('0x7'));var logger=require(_0x9641('0x8'))(_0x9641('0x9'));var config=require('../../config/environment');var jayson=require(_0x9641('0xa'));var client=jayson[_0x9641('0xb')][_0x9641('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x584c0f,_0x2677ce,_0x4d0031){return new BPromise(function(_0x3ecd1b,_0x5c661b){return client[_0x9641('0xd')](_0x584c0f,_0x4d0031)['then'](function(_0x1647af){logger[_0x9641('0xe')](_0x9641('0xf'),_0x2677ce,_0x9641('0x10'));logger[_0x9641('0x11')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x2677ce,_0x9641('0x10'),JSON['stringify'](_0x1647af));if(_0x1647af[_0x9641('0x12')]){if(_0x1647af[_0x9641('0x12')][_0x9641('0x13')]===0x1f4){logger['error'](_0x9641('0xf'),_0x2677ce,_0x1647af[_0x9641('0x12')][_0x9641('0x14')]);return _0x5c661b(_0x1647af[_0x9641('0x12')][_0x9641('0x14')]);}logger[_0x9641('0x12')](_0x9641('0xf'),_0x2677ce,_0x1647af[_0x9641('0x12')][_0x9641('0x14')]);return _0x3ecd1b(_0x1647af[_0x9641('0x12')][_0x9641('0x14')]);}else{logger[_0x9641('0xe')](_0x9641('0xf'),_0x2677ce,_0x9641('0x10'));_0x3ecd1b(_0x1647af['result'][_0x9641('0x14')]);}})[_0x9641('0x15')](function(_0x4e62be){logger[_0x9641('0x12')](_0x9641('0xf'),_0x2677ce,_0x4e62be);_0x5c661b(_0x4e62be);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 008ae29..02a9737 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 _0x1121=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','multer','util','path','express'];(function(_0x15fb0b,_0x44b92d){var _0x423f50=function(_0x32b8c5){while(--_0x32b8c5){_0x15fb0b['push'](_0x15fb0b['shift']());}};_0x423f50(++_0x44b92d);}(_0x1121,0xcd));var _0x1112=function(_0x4ef221,_0x16827c){_0x4ef221=_0x4ef221-0x0;var _0x403f5a=_0x1121[_0x4ef221];return _0x403f5a;};'use strict';var multer=require(_0x1112('0x0'));var util=require(_0x1112('0x1'));var path=require(_0x1112('0x2'));var timeout=require('connect-timeout');var express=require(_0x1112('0x3'));var router=express[_0x1112('0x4')]();var auth=require(_0x1112('0x5'));var interaction=require(_0x1112('0x6'));var config=require(_0x1112('0x7'));var controller=require(_0x1112('0x8'));router[_0x1112('0x9')]('/',auth[_0x1112('0xa')](),controller[_0x1112('0xb')]);router[_0x1112('0x9')]('/describe',auth[_0x1112('0xa')](),controller['describe']);router[_0x1112('0x9')](_0x1112('0xc'),auth['isAuthenticated'](),controller[_0x1112('0xd')]);router[_0x1112('0xe')]('/',auth[_0x1112('0xa')](),controller['create']);router[_0x1112('0xf')]('/:id',auth[_0x1112('0xa')](),controller[_0x1112('0x10')]);router[_0x1112('0x11')]('/:id',auth[_0x1112('0xa')](),controller[_0x1112('0x12')]);module['exports']=router; \ No newline at end of file +var _0x4a1a=['destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x4a1a,0x11f));var _0xa4a1=function(_0x41f28b,_0x4f9279){_0x41f28b=_0x41f28b-0x0;var _0x4e60af=_0x4a1a[_0x41f28b];return _0x4e60af;};'use strict';var multer=require('multer');var util=require(_0xa4a1('0x0'));var path=require(_0xa4a1('0x1'));var timeout=require(_0xa4a1('0x2'));var express=require('express');var router=express[_0xa4a1('0x3')]();var auth=require(_0xa4a1('0x4'));var interaction=require(_0xa4a1('0x5'));var config=require(_0xa4a1('0x6'));var controller=require(_0xa4a1('0x7'));router[_0xa4a1('0x8')]('/',auth[_0xa4a1('0x9')](),controller[_0xa4a1('0xa')]);router['get']('/describe',auth[_0xa4a1('0x9')](),controller[_0xa4a1('0xb')]);router[_0xa4a1('0x8')](_0xa4a1('0xc'),auth['isAuthenticated'](),controller[_0xa4a1('0xd')]);router[_0xa4a1('0xe')]('/',auth[_0xa4a1('0x9')](),controller[_0xa4a1('0xf')]);router[_0xa4a1('0x10')](_0xa4a1('0xc'),auth[_0xa4a1('0x9')](),controller['update']);router['delete'](_0xa4a1('0xc'),auth[_0xa4a1('0x9')](),controller[_0xa4a1('0x11')]);module[_0xa4a1('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 71be8c8..448e6f4 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 _0x6b8f=['destroy','exports','util','connect-timeout','../../components/auth/service','../../components/interaction/service','./intDeskAccount.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','post','addConfiguration','put','delete'];(function(_0x2e249d,_0x41b7e7){var _0x1faa37=function(_0x1422b4){while(--_0x1422b4){_0x2e249d['push'](_0x2e249d['shift']());}};_0x1faa37(++_0x41b7e7);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x25ab79,_0x1e5d72){_0x25ab79=_0x25ab79-0x0;var _0x2b3469=_0x6b8f[_0x25ab79];return _0x2b3469;};'use strict';var multer=require('multer');var util=require(_0xf6b8('0x0'));var path=require('path');var timeout=require(_0xf6b8('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0xf6b8('0x2'));var interaction=require(_0xf6b8('0x3'));var config=require('../../config/environment');var controller=require(_0xf6b8('0x4'));router[_0xf6b8('0x5')]('/',auth[_0xf6b8('0x6')](),controller['index']);router[_0xf6b8('0x5')](_0xf6b8('0x7'),auth[_0xf6b8('0x6')](),controller[_0xf6b8('0x8')]);router['get']('/:id/configurations',auth[_0xf6b8('0x6')](),controller['getConfigurations']);router[_0xf6b8('0x5')](_0xf6b8('0x9'),auth[_0xf6b8('0x6')](),controller[_0xf6b8('0xa')]);router[_0xf6b8('0xb')]('/',auth[_0xf6b8('0x6')](),controller['create']);router['post']('/:id/configurations',auth[_0xf6b8('0x6')](),controller[_0xf6b8('0xc')]);router[_0xf6b8('0xd')](_0xf6b8('0x7'),auth['isAuthenticated'](),controller['update']);router[_0xf6b8('0xe')](_0xf6b8('0x7'),auth['isAuthenticated'](),controller[_0xf6b8('0xf')]);module[_0xf6b8('0x10')]=router; \ No newline at end of file +var _0xa1f6=['index','get','/:id','show','getConfigurations','/:id/fields','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','isAuthenticated'];(function(_0x51b031,_0x217229){var _0x222c01=function(_0x3eb751){while(--_0x3eb751){_0x51b031['push'](_0x51b031['shift']());}};_0x222c01(++_0x217229);}(_0xa1f6,0x19d));var _0x6a1f=function(_0x33554b,_0x48162b){_0x33554b=_0x33554b-0x0;var _0x256954=_0xa1f6[_0x33554b];return _0x256954;};'use strict';var multer=require(_0x6a1f('0x0'));var util=require(_0x6a1f('0x1'));var path=require(_0x6a1f('0x2'));var timeout=require(_0x6a1f('0x3'));var express=require(_0x6a1f('0x4'));var router=express[_0x6a1f('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intDeskAccount.controller');router['get']('/',auth[_0x6a1f('0x6')](),controller[_0x6a1f('0x7')]);router[_0x6a1f('0x8')](_0x6a1f('0x9'),auth[_0x6a1f('0x6')](),controller[_0x6a1f('0xa')]);router[_0x6a1f('0x8')]('/:id/configurations',auth[_0x6a1f('0x6')](),controller[_0x6a1f('0xb')]);router[_0x6a1f('0x8')](_0x6a1f('0xc'),auth[_0x6a1f('0x6')](),controller['getFields']);router[_0x6a1f('0xd')]('/',auth[_0x6a1f('0x6')](),controller[_0x6a1f('0xe')]);router[_0x6a1f('0xd')]('/:id/configurations',auth[_0x6a1f('0x6')](),controller['addConfiguration']);router[_0x6a1f('0xf')](_0x6a1f('0x9'),auth[_0x6a1f('0x6')](),controller[_0x6a1f('0x10')]);router[_0x6a1f('0x11')](_0x6a1f('0x9'),auth[_0x6a1f('0x6')](),controller[_0x6a1f('0x12')]);module[_0x6a1f('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 13bea17..dd8793c 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 _0xed67=['integrationTab','newTab','exports','STRING','ENUM','basic'];(function(_0x334d1e,_0x28a488){var _0x3b33ba=function(_0x25afca){while(--_0x25afca){_0x334d1e['push'](_0x334d1e['shift']());}};_0x3b33ba(++_0x28a488);}(_0xed67,0x1e8));var _0x7ed6=function(_0x1a4a06,_0x36a5c2){_0x1a4a06=_0x1a4a06-0x0;var _0x49ec08=_0xed67[_0x1a4a06];return _0x49ec08;};'use strict';var Sequelize=require('sequelize');module[_0x7ed6('0x0')]={'name':{'type':Sequelize[_0x7ed6('0x1')]},'description':{'type':Sequelize[_0x7ed6('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x7ed6('0x1')]},'authType':{'type':Sequelize[_0x7ed6('0x2')]('basic'),'defaultValue':_0x7ed6('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x7ed6('0x1')]},'token':{'type':Sequelize[_0x7ed6('0x1')]},'tokenSecret':{'type':Sequelize[_0x7ed6('0x1')]},'serverUrl':{'type':Sequelize[_0x7ed6('0x1')]},'type':{'type':Sequelize[_0x7ed6('0x2')](_0x7ed6('0x4'),_0x7ed6('0x5')),'defaultValue':_0x7ed6('0x4')}}; \ No newline at end of file +var _0x30aa=['exports','STRING','ENUM','basic','integrationTab','sequelize'];(function(_0x70d01a,_0xaa3e0c){var _0x499ab2=function(_0x124a69){while(--_0x124a69){_0x70d01a['push'](_0x70d01a['shift']());}};_0x499ab2(++_0xaa3e0c);}(_0x30aa,0x161));var _0xa30a=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x30aa[_0x134c2e];return _0x2825db;};'use strict';var Sequelize=require(_0xa30a('0x0'));module[_0xa30a('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xa30a('0x2')]},'remoteUri':{'type':Sequelize[_0xa30a('0x2')]},'authType':{'type':Sequelize[_0xa30a('0x3')](_0xa30a('0x4')),'defaultValue':_0xa30a('0x4')},'password':{'type':Sequelize[_0xa30a('0x2')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0xa30a('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0xa30a('0x2')]},'serverUrl':{'type':Sequelize[_0xa30a('0x2')]},'type':{'type':Sequelize[_0xa30a('0x3')](_0xa30a('0x5'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index f9726b9..817959e 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 _0x3ad8=['then','info','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','status','end','offset','set','json','apply','save','update','destroy','stack','name','send','index','map','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','limit','sort','filters','pick','filter','where','VIRTUAL','options','count','includeAll','include','findAll','show','params','DeskAccount','rawAttributes','find','create','body','getConfigurations','findOne','DeskConfiguration','order','merge','AccountId','getSubjects','getDescriptions','channel','DeskField','Subjects','Descriptions','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','substring','%s/custom_fields','application/json','basic','headers','format','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','entries','active','label','getFields,\x20%s,\x20%s,\x20%s','getFields','test','statusCode','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','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'];(function(_0x479c1b,_0x5a460b){var _0x200e67=function(_0x7b11e7){while(--_0x7b11e7){_0x479c1b['push'](_0x479c1b['shift']());}};_0x200e67(++_0x5a460b);}(_0x3ad8,0x1cb));var _0x83ad=function(_0x49e238,_0x3bf994){_0x49e238=_0x49e238-0x0;var _0x5df396=_0x3ad8[_0x49e238];return _0x5df396;};'use strict';var pdf=require(_0x83ad('0x0'));var emlformat=require(_0x83ad('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x83ad('0x2'));var rp=require(_0x83ad('0x3'));var moment=require(_0x83ad('0x4'));var BPromise=require(_0x83ad('0x5'));var Mustache=require(_0x83ad('0x6'));var util=require(_0x83ad('0x7'));var path=require(_0x83ad('0x8'));var sox=require(_0x83ad('0x9'));var csv=require('to-csv');var ejs=require(_0x83ad('0xa'));var fs=require('fs');var _=require(_0x83ad('0xb'));var squel=require(_0x83ad('0xc'));var crypto=require(_0x83ad('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x83ad('0xe'));var toCsv=require(_0x83ad('0xf'));var querystring=require(_0x83ad('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x83ad('0x11'));var hardwareService=require(_0x83ad('0x12'));var logger=require('../../config/logger')(_0x83ad('0x13'));var utils=require(_0x83ad('0x14'));var config=require('../../config/environment');var db=require(_0x83ad('0x15'))['db'];var integrations=require(_0x83ad('0x16'));var jayson=require(_0x83ad('0x17'));var client=jayson['client'][_0x83ad('0x18')]({'port':0x232a});function checkPasswordPattern(_0x56bb29,_0x1c7712,_0x570aff){if(_0x570aff){var _0x4d645d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4d645d['test'](_0x1c7712)){return _0x56bb29;}else{throw new db[(_0x83ad('0x19'))][(_0x83ad('0x1a'))](_0x83ad('0x1b'));}}else{return _0x56bb29;}}function respondWithRpcPromise(_0x23f03e,_0x4149e3,_0x423a73,_0x1b9361){return new BPromise(function(_0x4fe262,_0x5deaf7){var _0x1420dd=_0x1b9361||client;return _0x1420dd[_0x83ad('0x1c')](_0x23f03e,_0x423a73)[_0x83ad('0x1d')](function(_0x3ab229){logger[_0x83ad('0x1e')](_0x83ad('0x1f'),_0x4149e3,'request\x20sent');logger[_0x83ad('0x20')](_0x83ad('0x21'),_0x4149e3,_0x83ad('0x22'),JSON[_0x83ad('0x23')](_0x3ab229));if(_0x3ab229[_0x83ad('0x24')]){if(_0x3ab229[_0x83ad('0x24')]['code']===0x1f4){logger['error'](_0x83ad('0x1f'),_0x4149e3,_0x3ab229[_0x83ad('0x24')][_0x83ad('0x25')]);return _0x5deaf7(_0x3ab229['error'][_0x83ad('0x25')]);}logger[_0x83ad('0x24')]('DeskAccount,\x20%s,\x20%s',_0x4149e3,_0x3ab229['error']['message']);return _0x4fe262(_0x3ab229[_0x83ad('0x24')][_0x83ad('0x25')]);}else{logger[_0x83ad('0x1e')](_0x83ad('0x1f'),_0x4149e3,_0x83ad('0x22'));_0x4fe262(_0x3ab229['result'][_0x83ad('0x25')]);}})[_0x83ad('0x26')](function(_0x348cad){logger[_0x83ad('0x24')](_0x83ad('0x1f'),_0x4149e3,_0x348cad);_0x5deaf7(_0x348cad);});});}function respondWithStatusCode(_0xf938ab,_0x49e1b0){_0x49e1b0=_0x49e1b0||0xcc;return function(_0x3c3278){if(_0x3c3278){return _0xf938ab['sendStatus'](_0x49e1b0);}return _0xf938ab[_0x83ad('0x27')](_0x49e1b0)[_0x83ad('0x28')]();};}function respondWithResult(_0x4d7102,_0xe54712){_0xe54712=_0xe54712||0xc8;return function(_0xc66ebe){if(_0xc66ebe){return _0x4d7102[_0x83ad('0x27')](_0xe54712)['json'](_0xc66ebe);}};}function respondWithFilteredResult(_0x2826a6,_0x563da2){return function(_0x5d1014){if(_0x5d1014){var _0x9fcbcb=_0x5d1014['count'],_0x30fb28=_0x563da2[_0x83ad('0x29')],_0x5749f1=_0x563da2[_0x83ad('0x29')]+_0x563da2['limit'],_0x43bca3;if(_0x5749f1>=_0x9fcbcb){_0x5749f1=_0x9fcbcb;_0x43bca3=0xc8;}else{_0x43bca3=0xce;}_0x2826a6[_0x83ad('0x27')](_0x43bca3);return _0x2826a6[_0x83ad('0x2a')]('Content-Range',_0x30fb28+'-'+_0x5749f1+'/'+_0x9fcbcb)[_0x83ad('0x2b')](_0x5d1014);}return null;};}function patchUpdates(_0x335d3b){return function(_0x1c86e4){try{jsonpatch[_0x83ad('0x2c')](_0x1c86e4,_0x335d3b,!![]);}catch(_0x15a6d1){return BPromise['reject'](_0x15a6d1);}return _0x1c86e4[_0x83ad('0x2d')]();};}function saveUpdates(_0x34a8de,_0x290dfe){return function(_0x1e47fd){if(_0x1e47fd){return _0x1e47fd[_0x83ad('0x2e')](_0x34a8de)[_0x83ad('0x1d')](function(_0x4f1803){return _0x4f1803;});}return null;};}function removeEntity(_0x3925e0,_0x5ce649){return function(_0x23b43b){if(_0x23b43b){return _0x23b43b[_0x83ad('0x2f')]()['then'](function(){_0x3925e0[_0x83ad('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x498c01,_0x1aad62){return function(_0x52ec2b){if(!_0x52ec2b){_0x498c01['sendStatus'](0x194);}return _0x52ec2b;};}function handleError(_0x503988,_0x2b3af0){_0x2b3af0=_0x2b3af0||0x1f4;return function(_0x24ec27){logger[_0x83ad('0x24')](_0x24ec27[_0x83ad('0x30')]);if(_0x24ec27['name']){delete _0x24ec27[_0x83ad('0x31')];}_0x503988[_0x83ad('0x27')](_0x2b3af0)[_0x83ad('0x32')](_0x24ec27);};}exports[_0x83ad('0x33')]=function(_0xce8021,_0x8d995f){var _0x580a6a={},_0x268ff2={},_0x26a325={'count':0x0,'rows':[]};var _0x15263a=_[_0x83ad('0x34')](db['DeskAccount']['rawAttributes'],function(_0x2f7a10){return{'name':_0x2f7a10[_0x83ad('0x35')],'type':_0x2f7a10[_0x83ad('0x36')][_0x83ad('0x37')]};});_0x268ff2[_0x83ad('0x38')]=_['map'](_0x15263a,'name');_0x268ff2[_0x83ad('0x39')]=_[_0x83ad('0x3a')](_0xce8021[_0x83ad('0x39')]);_0x268ff2['filters']=_['intersection'](_0x268ff2[_0x83ad('0x38')],_0x268ff2['query']);_0x580a6a[_0x83ad('0x3b')]=_[_0x83ad('0x3c')](_0x268ff2[_0x83ad('0x38')],qs[_0x83ad('0x3d')](_0xce8021[_0x83ad('0x39')][_0x83ad('0x3d')]));_0x580a6a[_0x83ad('0x3b')]=_0x580a6a[_0x83ad('0x3b')][_0x83ad('0x3e')]?_0x580a6a[_0x83ad('0x3b')]:_0x268ff2[_0x83ad('0x38')];if(!_0xce8021[_0x83ad('0x39')][_0x83ad('0x3f')]('nolimit')){_0x580a6a[_0x83ad('0x40')]=qs[_0x83ad('0x40')](_0xce8021[_0x83ad('0x39')]['limit']);_0x580a6a[_0x83ad('0x29')]=qs[_0x83ad('0x29')](_0xce8021[_0x83ad('0x39')]['offset']);}_0x580a6a['order']=qs['sort'](_0xce8021[_0x83ad('0x39')][_0x83ad('0x41')]);_0x580a6a['where']=qs[_0x83ad('0x42')](_[_0x83ad('0x43')](_0xce8021[_0x83ad('0x39')],_0x268ff2[_0x83ad('0x42')]));if(_0xce8021['query'][_0x83ad('0x44')]){_0x580a6a[_0x83ad('0x45')]=_['merge'](_0x580a6a['where'],{'$or':_[_0x83ad('0x34')](_0x15263a,function(_0x526bef){if(_0x526bef[_0x83ad('0x36')]!==_0x83ad('0x46')){var _0x3e6a82={};_0x3e6a82[_0x526bef[_0x83ad('0x31')]]={'$like':'%'+_0xce8021[_0x83ad('0x39')][_0x83ad('0x44')]+'%'};return _0x3e6a82;}})});}_0x580a6a=_['merge']({},_0x580a6a,_0xce8021[_0x83ad('0x47')]);var _0x25b69e={'where':_0x580a6a[_0x83ad('0x45')]};return db['DeskAccount'][_0x83ad('0x48')](_0x25b69e)[_0x83ad('0x1d')](function(_0x4fdc87){_0x26a325[_0x83ad('0x48')]=_0x4fdc87;if(_0xce8021[_0x83ad('0x39')][_0x83ad('0x49')]){_0x580a6a[_0x83ad('0x4a')]=[{'all':!![]}];}return db['DeskAccount'][_0x83ad('0x4b')](_0x580a6a);})[_0x83ad('0x1d')](function(_0x58c08e){_0x26a325['rows']=_0x58c08e;return _0x26a325;})[_0x83ad('0x1d')](respondWithFilteredResult(_0x8d995f,_0x580a6a))[_0x83ad('0x26')](handleError(_0x8d995f,null));};exports[_0x83ad('0x4c')]=function(_0x2686d8,_0x1b48da){var _0x21b970={'raw':![],'where':{'id':_0x2686d8[_0x83ad('0x4d')]['id']}},_0x386823={};_0x386823[_0x83ad('0x38')]=_[_0x83ad('0x3a')](db[_0x83ad('0x4e')][_0x83ad('0x4f')]);_0x386823[_0x83ad('0x39')]=_[_0x83ad('0x3a')](_0x2686d8['query']);_0x386823[_0x83ad('0x42')]=_[_0x83ad('0x3c')](_0x386823[_0x83ad('0x38')],_0x386823[_0x83ad('0x39')]);_0x21b970[_0x83ad('0x3b')]=_[_0x83ad('0x3c')](_0x386823[_0x83ad('0x38')],qs[_0x83ad('0x3d')](_0x2686d8['query'][_0x83ad('0x3d')]));_0x21b970['attributes']=_0x21b970[_0x83ad('0x3b')][_0x83ad('0x3e')]?_0x21b970[_0x83ad('0x3b')]:_0x386823[_0x83ad('0x38')];if(_0x2686d8[_0x83ad('0x39')]['includeAll']){_0x21b970[_0x83ad('0x4a')]=[{'all':!![]}];}_0x21b970=_['merge']({},_0x21b970,_0x2686d8[_0x83ad('0x47')]);return db[_0x83ad('0x4e')][_0x83ad('0x50')](_0x21b970)[_0x83ad('0x1d')](handleEntityNotFound(_0x1b48da,null))[_0x83ad('0x1d')](respondWithResult(_0x1b48da,null))[_0x83ad('0x26')](handleError(_0x1b48da,null));};exports['create']=function(_0x582c10,_0x2616be){return db['DeskAccount'][_0x83ad('0x51')](_0x582c10['body'],{})[_0x83ad('0x1d')](respondWithResult(_0x2616be,0xc9))[_0x83ad('0x26')](handleError(_0x2616be,null));};exports[_0x83ad('0x2e')]=function(_0x53f7ee,_0x3bc714){if(_0x53f7ee[_0x83ad('0x52')]['id']){delete _0x53f7ee[_0x83ad('0x52')]['id'];}return db[_0x83ad('0x4e')][_0x83ad('0x50')]({'where':{'id':_0x53f7ee[_0x83ad('0x4d')]['id']}})[_0x83ad('0x1d')](handleEntityNotFound(_0x3bc714,null))[_0x83ad('0x1d')](saveUpdates(_0x53f7ee['body'],null))[_0x83ad('0x1d')](respondWithResult(_0x3bc714,null))[_0x83ad('0x26')](handleError(_0x3bc714,null));};exports[_0x83ad('0x2f')]=function(_0x1e4559,_0x29ba33){return db['DeskAccount'][_0x83ad('0x50')]({'where':{'id':_0x1e4559[_0x83ad('0x4d')]['id']}})[_0x83ad('0x1d')](handleEntityNotFound(_0x29ba33,null))[_0x83ad('0x1d')](removeEntity(_0x29ba33,null))['catch'](handleError(_0x29ba33,null));};exports[_0x83ad('0x53')]=function(_0x597f38,_0x23b97,_0x1ccc2b){var _0x38a8e3={};var _0x1d3af3={};var _0x142a6c;var _0x325812;return db[_0x83ad('0x4e')][_0x83ad('0x54')]({'where':{'id':_0x597f38[_0x83ad('0x4d')]['id']}})[_0x83ad('0x1d')](handleEntityNotFound(_0x23b97,null))[_0x83ad('0x1d')](function(_0x36bbdc){if(_0x36bbdc){_0x142a6c=_0x36bbdc;_0x1d3af3[_0x83ad('0x38')]=_[_0x83ad('0x3a')](db[_0x83ad('0x55')][_0x83ad('0x4f')]);_0x1d3af3[_0x83ad('0x39')]=_['keys'](_0x597f38[_0x83ad('0x39')]);_0x1d3af3[_0x83ad('0x42')]=_[_0x83ad('0x3c')](_0x1d3af3[_0x83ad('0x38')],_0x1d3af3[_0x83ad('0x39')]);_0x38a8e3['attributes']=_[_0x83ad('0x3c')](_0x1d3af3['model'],qs[_0x83ad('0x3d')](_0x597f38[_0x83ad('0x39')][_0x83ad('0x3d')]));_0x38a8e3['attributes']=_0x38a8e3['attributes']['length']?_0x38a8e3[_0x83ad('0x3b')]:_0x1d3af3[_0x83ad('0x38')];_0x38a8e3[_0x83ad('0x56')]=qs[_0x83ad('0x41')](_0x597f38[_0x83ad('0x39')]['sort']);_0x38a8e3[_0x83ad('0x45')]=qs[_0x83ad('0x42')](_[_0x83ad('0x43')](_0x597f38['query'],_0x1d3af3[_0x83ad('0x42')]));if(_0x597f38[_0x83ad('0x39')][_0x83ad('0x44')]){_0x38a8e3['where']=_['merge'](_0x38a8e3[_0x83ad('0x45')],{'$or':_['map'](_0x38a8e3[_0x83ad('0x3b')],function(_0xcbc20b){var _0x16e792={};_0x16e792[_0xcbc20b]={'$like':'%'+_0x597f38[_0x83ad('0x39')]['filter']+'%'};return _0x16e792;})});}_0x38a8e3=_[_0x83ad('0x57')]({},_0x38a8e3,_0x597f38['options']);return _0x142a6c['getConfigurations'](_0x38a8e3);}})['then'](function(_0x17dbca){if(_0x17dbca){_0x325812=_0x17dbca['length'];if(!_0x597f38[_0x83ad('0x39')][_0x83ad('0x3f')]('nolimit')){_0x38a8e3[_0x83ad('0x40')]=qs[_0x83ad('0x40')](_0x597f38[_0x83ad('0x39')][_0x83ad('0x40')]);_0x38a8e3[_0x83ad('0x29')]=qs[_0x83ad('0x29')](_0x597f38[_0x83ad('0x39')][_0x83ad('0x29')]);}return _0x142a6c[_0x83ad('0x53')](_0x38a8e3);}})[_0x83ad('0x1d')](function(_0xdc6294){if(_0xdc6294){return _0xdc6294?{'count':_0x325812,'rows':_0xdc6294}:null;}})[_0x83ad('0x1d')](respondWithResult(_0x23b97,null))[_0x83ad('0x26')](handleError(_0x23b97,null));};exports['addConfiguration']=function(_0x1e967b,_0xe771f3,_0x5ea047){if(_0x1e967b[_0x83ad('0x52')]['id']){delete _0x1e967b['body']['id'];}return db[_0x83ad('0x4e')][_0x83ad('0x54')]({'where':{'id':_0x1e967b[_0x83ad('0x4d')]['id']}})['then'](handleEntityNotFound(_0xe771f3,null))[_0x83ad('0x1d')](function(_0x480739){if(_0x480739){_0x1e967b['body'][_0x83ad('0x58')]=_0x480739['id'];_0x1e967b[_0x83ad('0x52')]['Subjects']=integrations[_0x83ad('0x59')](_0x1e967b[_0x83ad('0x52')]['channel'],_0x1e967b[_0x83ad('0x52')]['type']);_0x1e967b[_0x83ad('0x52')]['Descriptions']=integrations[_0x83ad('0x5a')](_0x1e967b['body'][_0x83ad('0x5b')],_0x1e967b[_0x83ad('0x52')][_0x83ad('0x36')]);return db[_0x83ad('0x55')][_0x83ad('0x51')](_0x1e967b['body'],{'include':[{'model':db[_0x83ad('0x5c')],'as':_0x83ad('0x5d')},{'model':db[_0x83ad('0x5c')],'as':_0x83ad('0x5e')}]});}return null;})[_0x83ad('0x1d')](respondWithResult(_0xe771f3,null))[_0x83ad('0x26')](handleError(_0xe771f3,null));};exports['getFields']=function(_0x3b1a3f,_0xd98ee4,_0x1c96a9){var _0x53932c=[{'name':_0x83ad('0x5f'),'label':_0x83ad('0x5f'),'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 _0x59bdad='';return db[_0x83ad('0x4e')][_0x83ad('0x54')]({'where':{'id':_0x3b1a3f['params']['id']},'attributes':['id',_0x83ad('0x60'),_0x83ad('0x61'),_0x83ad('0x62'),_0x83ad('0x63'),_0x83ad('0x64'),_0x83ad('0x65'),_0x83ad('0x66'),'tokenSecret']})['then'](handleEntityNotFound(_0xd98ee4,null))[_0x83ad('0x1d')](function(_0xb8c650){if(_0xb8c650){_0x59bdad=_0xb8c650['remoteUri'];var _0x38f295=_0x59bdad['slice'](-0x1);if(_0x38f295==='/'){_0x59bdad=_0x59bdad[_0x83ad('0x67')](0x0,_0x59bdad['lastIndexOf'](_0x38f295));}var _0x35a1da={'method':'GET','uri':util['format'](_0x83ad('0x68'),_0x59bdad),'headers':{'Content-Type':_0x83ad('0x69'),'Accept':_0x83ad('0x69')},'json':!![]};if(_0xb8c650['authType']===_0x83ad('0x6a')){_0x35a1da[_0x83ad('0x6b')]['Authorization']=util[_0x83ad('0x6c')](_0x83ad('0x6d'),new Buffer(util[_0x83ad('0x6c')](_0x83ad('0x6e'),_0xb8c650[_0x83ad('0x62')],_0xb8c650['password']))[_0x83ad('0x6f')](_0x83ad('0x70')));}return rp(_0x35a1da)['then'](function(_0x3b0dfa){return _0x53932c[_0x83ad('0x71')](_[_0x83ad('0x34')](_0x3b0dfa[_0x83ad('0x72')][_0x83ad('0x73')],function(_0x376664){return{'id':_0x376664[_0x83ad('0x31')],'name':_0x376664[_0x83ad('0x31')],'type':_0x376664[_0x83ad('0x36')],'active':_0x376664[_0x83ad('0x74')],'label':_0x376664[_0x83ad('0x75')],'custom':!![]};}));});}})['then'](function(_0x5e491b){return{'count':_0x5e491b[_0x83ad('0x3e')],'rows':_0x5e491b};})['then'](respondWithResult(_0xd98ee4,null))[_0x83ad('0x26')](function(_0x54cf86){var _0x1fa538=_0x3b1a3f[_0x83ad('0x39')]['test']?0x1f4:_0x54cf86['statusCode']||0x1f4;logger[_0x83ad('0x24')](_0x83ad('0x76'),_0x83ad('0x77'),_0x1fa538,JSON[_0x83ad('0x23')](_0x54cf86));delete _0x54cf86[_0x83ad('0x31')];if(_0x1fa538===0x191){_0x1fa538=0x190;}_0xd98ee4[_0x83ad('0x27')](_0x1fa538)['send'](_0x3b1a3f['query'][_0x83ad('0x78')]?{'message':'Wrong\x20credentials','statusCode':_0x54cf86[_0x83ad('0x79')]}:_0x54cf86);});}; \ No newline at end of file +var _0x5770=['path','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','../../components/integrations/configuration','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','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','destroy','stack','name','index','map','DeskAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','find','create','body','params','getConfigurations','findOne','DeskConfiguration','addConfiguration','Subjects','getSubjects','channel','DeskField','priority','authType','username','password','consumerSecret','remoteUri','slice','lastIndexOf','GET','format','%s/custom_fields','application/json','headers','Authorization','%s:%s','toString','base64','concat','_embedded','entries','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','send','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird'];(function(_0x45c574,_0x497848){var _0x2fa16a=function(_0x1e903a){while(--_0x1e903a){_0x45c574['push'](_0x45c574['shift']());}};_0x2fa16a(++_0x497848);}(_0x5770,0x15f));var _0x0577=function(_0xdd2348,_0x5d3232){_0xdd2348=_0xdd2348-0x0;var _0x2e0a02=_0x5770[_0xdd2348];return _0x2e0a02;};'use strict';var pdf=require(_0x0577('0x0'));var emlformat=require(_0x0577('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0577('0x2'));var rp=require(_0x0577('0x3'));var moment=require(_0x0577('0x4'));var BPromise=require(_0x0577('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0577('0x6'));var sox=require(_0x0577('0x7'));var csv=require(_0x0577('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0577('0x9'));var jsforce=require(_0x0577('0xa'));var deskjs=require(_0x0577('0xb'));var toCsv=require(_0x0577('0x8'));var querystring=require(_0x0577('0xc'));var Papa=require(_0x0577('0xd'));var Redis=require(_0x0577('0xe'));var authService=require(_0x0577('0xf'));var qs=require(_0x0577('0x10'));var as=require(_0x0577('0x11'));var hardwareService=require(_0x0577('0x12'));var logger=require(_0x0577('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0577('0x14'))['db'];var integrations=require(_0x0577('0x15'));var jayson=require(_0x0577('0x16'));var client=jayson[_0x0577('0x17')][_0x0577('0x18')]({'port':0x232a});function checkPasswordPattern(_0x57477d,_0x3325f8,_0x262050){if(_0x262050){var _0x555ec1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x555ec1[_0x0577('0x19')](_0x3325f8)){return _0x57477d;}else{throw new db['Sequelize']['ValidationError'](_0x0577('0x1a'));}}else{return _0x57477d;}}function respondWithRpcPromise(_0x58aec5,_0x2f7ce0,_0x4ee28e,_0x2aee08){return new BPromise(function(_0x40bdfd,_0x2cc500){var _0x283eca=_0x2aee08||client;return _0x283eca[_0x0577('0x1b')](_0x58aec5,_0x4ee28e)[_0x0577('0x1c')](function(_0x184e56){logger[_0x0577('0x1d')](_0x0577('0x1e'),_0x2f7ce0,_0x0577('0x1f'));logger[_0x0577('0x20')](_0x0577('0x21'),_0x2f7ce0,_0x0577('0x1f'),JSON[_0x0577('0x22')](_0x184e56));if(_0x184e56['error']){if(_0x184e56[_0x0577('0x23')][_0x0577('0x24')]===0x1f4){logger['error']('DeskAccount,\x20%s,\x20%s',_0x2f7ce0,_0x184e56[_0x0577('0x23')]['message']);return _0x2cc500(_0x184e56[_0x0577('0x23')][_0x0577('0x25')]);}logger[_0x0577('0x23')](_0x0577('0x1e'),_0x2f7ce0,_0x184e56[_0x0577('0x23')][_0x0577('0x25')]);return _0x40bdfd(_0x184e56[_0x0577('0x23')]['message']);}else{logger[_0x0577('0x1d')]('DeskAccount,\x20%s,\x20%s',_0x2f7ce0,_0x0577('0x1f'));_0x40bdfd(_0x184e56[_0x0577('0x26')][_0x0577('0x25')]);}})['catch'](function(_0x41eb3b){logger[_0x0577('0x23')](_0x0577('0x1e'),_0x2f7ce0,_0x41eb3b);_0x2cc500(_0x41eb3b);});});}function respondWithStatusCode(_0x22cc44,_0x2755cf){_0x2755cf=_0x2755cf||0xcc;return function(_0x461dc2){if(_0x461dc2){return _0x22cc44[_0x0577('0x27')](_0x2755cf);}return _0x22cc44[_0x0577('0x28')](_0x2755cf)[_0x0577('0x29')]();};}function respondWithResult(_0x30db82,_0x17f813){_0x17f813=_0x17f813||0xc8;return function(_0x35beec){if(_0x35beec){return _0x30db82['status'](_0x17f813)[_0x0577('0x2a')](_0x35beec);}};}function respondWithFilteredResult(_0xc8b5f1,_0x4c1c4e){return function(_0x5c4f4c){if(_0x5c4f4c){var _0x206eb7=_0x5c4f4c[_0x0577('0x2b')],_0x2f2e51=_0x4c1c4e[_0x0577('0x2c')],_0xa049ed=_0x4c1c4e[_0x0577('0x2c')]+_0x4c1c4e[_0x0577('0x2d')],_0x3d816c;if(_0xa049ed>=_0x206eb7){_0xa049ed=_0x206eb7;_0x3d816c=0xc8;}else{_0x3d816c=0xce;}_0xc8b5f1[_0x0577('0x28')](_0x3d816c);return _0xc8b5f1[_0x0577('0x2e')]('Content-Range',_0x2f2e51+'-'+_0xa049ed+'/'+_0x206eb7)[_0x0577('0x2a')](_0x5c4f4c);}return null;};}function patchUpdates(_0x22922d){return function(_0x1d4334){try{jsonpatch['apply'](_0x1d4334,_0x22922d,!![]);}catch(_0x58abfc){return BPromise[_0x0577('0x2f')](_0x58abfc);}return _0x1d4334[_0x0577('0x30')]();};}function saveUpdates(_0x18682c,_0x5bbf9e){return function(_0x58b8d9){if(_0x58b8d9){return _0x58b8d9[_0x0577('0x31')](_0x18682c)[_0x0577('0x1c')](function(_0x1d5e91){return _0x1d5e91;});}return null;};}function removeEntity(_0x4890b0,_0x4bd657){return function(_0x5cbd8a){if(_0x5cbd8a){return _0x5cbd8a[_0x0577('0x32')]()['then'](function(){_0x4890b0['status'](0xcc)[_0x0577('0x29')]();});}};}function handleEntityNotFound(_0x1c6970,_0x418f7e){return function(_0x4c227b){if(!_0x4c227b){_0x1c6970[_0x0577('0x27')](0x194);}return _0x4c227b;};}function handleError(_0x50e1c6,_0x347037){_0x347037=_0x347037||0x1f4;return function(_0x3bc554){logger[_0x0577('0x23')](_0x3bc554[_0x0577('0x33')]);if(_0x3bc554['name']){delete _0x3bc554[_0x0577('0x34')];}_0x50e1c6[_0x0577('0x28')](_0x347037)['send'](_0x3bc554);};}exports[_0x0577('0x35')]=function(_0x9e5229,_0x1bd16b){var _0x29a2ce={},_0x3c1e3e={},_0x310a1f={'count':0x0,'rows':[]};var _0x9d7f12=_[_0x0577('0x36')](db[_0x0577('0x37')][_0x0577('0x38')],function(_0x2e07e6){return{'name':_0x2e07e6[_0x0577('0x39')],'type':_0x2e07e6[_0x0577('0x3a')]['key']};});_0x3c1e3e[_0x0577('0x3b')]=_[_0x0577('0x36')](_0x9d7f12,_0x0577('0x34'));_0x3c1e3e[_0x0577('0x3c')]=_[_0x0577('0x3d')](_0x9e5229[_0x0577('0x3c')]);_0x3c1e3e[_0x0577('0x3e')]=_[_0x0577('0x3f')](_0x3c1e3e[_0x0577('0x3b')],_0x3c1e3e[_0x0577('0x3c')]);_0x29a2ce[_0x0577('0x40')]=_[_0x0577('0x3f')](_0x3c1e3e[_0x0577('0x3b')],qs[_0x0577('0x41')](_0x9e5229[_0x0577('0x3c')][_0x0577('0x41')]));_0x29a2ce[_0x0577('0x40')]=_0x29a2ce[_0x0577('0x40')][_0x0577('0x42')]?_0x29a2ce[_0x0577('0x40')]:_0x3c1e3e['model'];if(!_0x9e5229['query'][_0x0577('0x43')](_0x0577('0x44'))){_0x29a2ce[_0x0577('0x2d')]=qs[_0x0577('0x2d')](_0x9e5229[_0x0577('0x3c')][_0x0577('0x2d')]);_0x29a2ce[_0x0577('0x2c')]=qs[_0x0577('0x2c')](_0x9e5229[_0x0577('0x3c')][_0x0577('0x2c')]);}_0x29a2ce[_0x0577('0x45')]=qs['sort'](_0x9e5229[_0x0577('0x3c')][_0x0577('0x46')]);_0x29a2ce[_0x0577('0x47')]=qs[_0x0577('0x3e')](_[_0x0577('0x48')](_0x9e5229['query'],_0x3c1e3e['filters']));if(_0x9e5229[_0x0577('0x3c')][_0x0577('0x49')]){_0x29a2ce[_0x0577('0x47')]=_[_0x0577('0x4a')](_0x29a2ce[_0x0577('0x47')],{'$or':_[_0x0577('0x36')](_0x9d7f12,function(_0x1f2c78){if(_0x1f2c78[_0x0577('0x3a')]!==_0x0577('0x4b')){var _0x3e7359={};_0x3e7359[_0x1f2c78[_0x0577('0x34')]]={'$like':'%'+_0x9e5229[_0x0577('0x3c')][_0x0577('0x49')]+'%'};return _0x3e7359;}})});}_0x29a2ce=_['merge']({},_0x29a2ce,_0x9e5229[_0x0577('0x4c')]);var _0x54fd02={'where':_0x29a2ce['where']};return db[_0x0577('0x37')]['count'](_0x54fd02)[_0x0577('0x1c')](function(_0x40d9d7){_0x310a1f[_0x0577('0x2b')]=_0x40d9d7;if(_0x9e5229[_0x0577('0x3c')][_0x0577('0x4d')]){_0x29a2ce[_0x0577('0x4e')]=[{'all':!![]}];}return db[_0x0577('0x37')][_0x0577('0x4f')](_0x29a2ce);})[_0x0577('0x1c')](function(_0x540bb0){_0x310a1f['rows']=_0x540bb0;return _0x310a1f;})[_0x0577('0x1c')](respondWithFilteredResult(_0x1bd16b,_0x29a2ce))[_0x0577('0x50')](handleError(_0x1bd16b,null));};exports[_0x0577('0x51')]=function(_0x1fdd9e,_0x2b1ea5){var _0x564ed4={'raw':![],'where':{'id':_0x1fdd9e['params']['id']}},_0x1c0d30={};_0x1c0d30[_0x0577('0x3b')]=_['keys'](db[_0x0577('0x37')][_0x0577('0x38')]);_0x1c0d30[_0x0577('0x3c')]=_['keys'](_0x1fdd9e[_0x0577('0x3c')]);_0x1c0d30[_0x0577('0x3e')]=_[_0x0577('0x3f')](_0x1c0d30['model'],_0x1c0d30[_0x0577('0x3c')]);_0x564ed4[_0x0577('0x40')]=_[_0x0577('0x3f')](_0x1c0d30[_0x0577('0x3b')],qs['fields'](_0x1fdd9e[_0x0577('0x3c')][_0x0577('0x41')]));_0x564ed4[_0x0577('0x40')]=_0x564ed4['attributes'][_0x0577('0x42')]?_0x564ed4[_0x0577('0x40')]:_0x1c0d30[_0x0577('0x3b')];if(_0x1fdd9e[_0x0577('0x3c')][_0x0577('0x4d')]){_0x564ed4['include']=[{'all':!![]}];}_0x564ed4=_[_0x0577('0x4a')]({},_0x564ed4,_0x1fdd9e[_0x0577('0x4c')]);return db[_0x0577('0x37')][_0x0577('0x52')](_0x564ed4)[_0x0577('0x1c')](handleEntityNotFound(_0x2b1ea5,null))['then'](respondWithResult(_0x2b1ea5,null))['catch'](handleError(_0x2b1ea5,null));};exports[_0x0577('0x53')]=function(_0x1f7306,_0x498839){return db[_0x0577('0x37')][_0x0577('0x53')](_0x1f7306[_0x0577('0x54')],{})[_0x0577('0x1c')](respondWithResult(_0x498839,0xc9))[_0x0577('0x50')](handleError(_0x498839,null));};exports[_0x0577('0x31')]=function(_0x38d714,_0x30edfb){if(_0x38d714['body']['id']){delete _0x38d714['body']['id'];}return db[_0x0577('0x37')][_0x0577('0x52')]({'where':{'id':_0x38d714['params']['id']}})['then'](handleEntityNotFound(_0x30edfb,null))[_0x0577('0x1c')](saveUpdates(_0x38d714[_0x0577('0x54')],null))['then'](respondWithResult(_0x30edfb,null))[_0x0577('0x50')](handleError(_0x30edfb,null));};exports[_0x0577('0x32')]=function(_0x241bfe,_0x1510cb){return db[_0x0577('0x37')][_0x0577('0x52')]({'where':{'id':_0x241bfe[_0x0577('0x55')]['id']}})['then'](handleEntityNotFound(_0x1510cb,null))[_0x0577('0x1c')](removeEntity(_0x1510cb,null))[_0x0577('0x50')](handleError(_0x1510cb,null));};exports[_0x0577('0x56')]=function(_0x29c9aa,_0x1d3c0a,_0x5d62d8){var _0x550f0b={};var _0x47f314={};var _0x43bf36;var _0x2855e1;return db[_0x0577('0x37')][_0x0577('0x57')]({'where':{'id':_0x29c9aa['params']['id']}})[_0x0577('0x1c')](handleEntityNotFound(_0x1d3c0a,null))[_0x0577('0x1c')](function(_0x3b84ac){if(_0x3b84ac){_0x43bf36=_0x3b84ac;_0x47f314['model']=_[_0x0577('0x3d')](db[_0x0577('0x58')][_0x0577('0x38')]);_0x47f314[_0x0577('0x3c')]=_[_0x0577('0x3d')](_0x29c9aa['query']);_0x47f314['filters']=_['intersection'](_0x47f314[_0x0577('0x3b')],_0x47f314[_0x0577('0x3c')]);_0x550f0b[_0x0577('0x40')]=_[_0x0577('0x3f')](_0x47f314[_0x0577('0x3b')],qs[_0x0577('0x41')](_0x29c9aa['query']['fields']));_0x550f0b[_0x0577('0x40')]=_0x550f0b[_0x0577('0x40')][_0x0577('0x42')]?_0x550f0b[_0x0577('0x40')]:_0x47f314[_0x0577('0x3b')];_0x550f0b[_0x0577('0x45')]=qs[_0x0577('0x46')](_0x29c9aa[_0x0577('0x3c')][_0x0577('0x46')]);_0x550f0b['where']=qs[_0x0577('0x3e')](_[_0x0577('0x48')](_0x29c9aa['query'],_0x47f314[_0x0577('0x3e')]));if(_0x29c9aa[_0x0577('0x3c')]['filter']){_0x550f0b['where']=_['merge'](_0x550f0b['where'],{'$or':_[_0x0577('0x36')](_0x550f0b[_0x0577('0x40')],function(_0x18e7e8){var _0x1abcd7={};_0x1abcd7[_0x18e7e8]={'$like':'%'+_0x29c9aa[_0x0577('0x3c')][_0x0577('0x49')]+'%'};return _0x1abcd7;})});}_0x550f0b=_['merge']({},_0x550f0b,_0x29c9aa['options']);return _0x43bf36[_0x0577('0x56')](_0x550f0b);}})[_0x0577('0x1c')](function(_0x1ca38e){if(_0x1ca38e){_0x2855e1=_0x1ca38e[_0x0577('0x42')];if(!_0x29c9aa[_0x0577('0x3c')][_0x0577('0x43')](_0x0577('0x44'))){_0x550f0b[_0x0577('0x2d')]=qs[_0x0577('0x2d')](_0x29c9aa[_0x0577('0x3c')][_0x0577('0x2d')]);_0x550f0b[_0x0577('0x2c')]=qs[_0x0577('0x2c')](_0x29c9aa[_0x0577('0x3c')]['offset']);}return _0x43bf36['getConfigurations'](_0x550f0b);}})[_0x0577('0x1c')](function(_0x2a11d5){if(_0x2a11d5){return _0x2a11d5?{'count':_0x2855e1,'rows':_0x2a11d5}:null;}})[_0x0577('0x1c')](respondWithResult(_0x1d3c0a,null))[_0x0577('0x50')](handleError(_0x1d3c0a,null));};exports[_0x0577('0x59')]=function(_0x5dfb1e,_0x15ea39,_0x1bde4a){if(_0x5dfb1e[_0x0577('0x54')]['id']){delete _0x5dfb1e[_0x0577('0x54')]['id'];}return db['DeskAccount'][_0x0577('0x57')]({'where':{'id':_0x5dfb1e[_0x0577('0x55')]['id']}})[_0x0577('0x1c')](handleEntityNotFound(_0x15ea39,null))[_0x0577('0x1c')](function(_0x24fc46){if(_0x24fc46){_0x5dfb1e[_0x0577('0x54')]['AccountId']=_0x24fc46['id'];_0x5dfb1e[_0x0577('0x54')][_0x0577('0x5a')]=integrations[_0x0577('0x5b')](_0x5dfb1e['body'][_0x0577('0x5c')],_0x5dfb1e[_0x0577('0x54')][_0x0577('0x3a')]);_0x5dfb1e[_0x0577('0x54')]['Descriptions']=integrations['getDescriptions'](_0x5dfb1e['body'][_0x0577('0x5c')],_0x5dfb1e[_0x0577('0x54')]['type']);return db[_0x0577('0x58')][_0x0577('0x53')](_0x5dfb1e[_0x0577('0x54')],{'include':[{'model':db[_0x0577('0x5d')],'as':_0x0577('0x5a')},{'model':db[_0x0577('0x5d')],'as':'Descriptions'}]});}return null;})[_0x0577('0x1c')](respondWithResult(_0x15ea39,null))[_0x0577('0x50')](handleError(_0x15ea39,null));};exports['getFields']=function(_0x27035e,_0x4a9325,_0x212481){var _0xbba027=[{'name':_0x0577('0x5e'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x58eda5='';return db[_0x0577('0x37')][_0x0577('0x57')]({'where':{'id':_0x27035e[_0x0577('0x55')]['id']},'attributes':['id','remoteUri',_0x0577('0x5f'),_0x0577('0x60'),_0x0577('0x61'),'consumerKey',_0x0577('0x62'),'token','tokenSecret']})[_0x0577('0x1c')](handleEntityNotFound(_0x4a9325,null))['then'](function(_0x462eed){if(_0x462eed){_0x58eda5=_0x462eed[_0x0577('0x63')];var _0x1a210e=_0x58eda5[_0x0577('0x64')](-0x1);if(_0x1a210e==='/'){_0x58eda5=_0x58eda5['substring'](0x0,_0x58eda5[_0x0577('0x65')](_0x1a210e));}var _0x4d6001={'method':_0x0577('0x66'),'uri':util[_0x0577('0x67')](_0x0577('0x68'),_0x58eda5),'headers':{'Content-Type':_0x0577('0x69'),'Accept':_0x0577('0x69')},'json':!![]};if(_0x462eed[_0x0577('0x5f')]==='basic'){_0x4d6001[_0x0577('0x6a')][_0x0577('0x6b')]=util[_0x0577('0x67')]('Basic\x20%s',new Buffer(util[_0x0577('0x67')](_0x0577('0x6c'),_0x462eed[_0x0577('0x60')],_0x462eed[_0x0577('0x61')]))[_0x0577('0x6d')](_0x0577('0x6e')));}return rp(_0x4d6001)[_0x0577('0x1c')](function(_0x261bad){return _0xbba027[_0x0577('0x6f')](_['map'](_0x261bad[_0x0577('0x70')][_0x0577('0x71')],function(_0x4df4a6){return{'id':_0x4df4a6[_0x0577('0x34')],'name':_0x4df4a6[_0x0577('0x34')],'type':_0x4df4a6['type'],'active':_0x4df4a6['active'],'label':_0x4df4a6[_0x0577('0x72')],'custom':!![]};}));});}})[_0x0577('0x1c')](function(_0xc238d3){return{'count':_0xc238d3[_0x0577('0x42')],'rows':_0xc238d3};})[_0x0577('0x1c')](respondWithResult(_0x4a9325,null))[_0x0577('0x50')](function(_0x14bcb3){var _0x2a467b=_0x27035e[_0x0577('0x3c')][_0x0577('0x19')]?0x1f4:_0x14bcb3[_0x0577('0x73')]||0x1f4;logger[_0x0577('0x23')](_0x0577('0x74'),_0x0577('0x75'),_0x2a467b,JSON[_0x0577('0x22')](_0x14bcb3));delete _0x14bcb3[_0x0577('0x34')];if(_0x2a467b===0x191){_0x2a467b=0x190;}_0x4a9325[_0x0577('0x28')](_0x2a467b)[_0x0577('0x76')](_0x27035e[_0x0577('0x3c')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x14bcb3[_0x0577('0x73')]}:_0x14bcb3);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 8828571..2c2823d 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 _0x7f36=['define','DeskAccount','lodash','api','moment','request-promise','path','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7f36,0x14c));var _0x67f3=function(_0x2f2614,_0x402b20){_0x2f2614=_0x2f2614-0x0;var _0x42d5da=_0x7f36[_0x2f2614];return _0x42d5da;};'use strict';var _=require(_0x67f3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x67f3('0x1'));var moment=require(_0x67f3('0x2'));var BPromise=require('bluebird');var rp=require(_0x67f3('0x3'));var fs=require('fs');var path=require(_0x67f3('0x4'));var rimraf=require('rimraf');var config=require(_0x67f3('0x5'));var attributes=require(_0x67f3('0x6'));var integrations=require(_0x67f3('0x7'));module[_0x67f3('0x8')]=function(_0x301d77,_0x1752bc){return _0x301d77[_0x67f3('0x9')](_0x67f3('0xa'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5818=['path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','define','int_desk_accounts','util','../../config/logger','api','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5818,0xac));var _0x8581=function(_0x258f27,_0x17d611){_0x258f27=_0x258f27-0x0;var _0x39df18=_0x5818[_0x258f27];return _0x39df18;};'use strict';var _=require('lodash');var util=require(_0x8581('0x0'));var logger=require(_0x8581('0x1'))(_0x8581('0x2'));var moment=require(_0x8581('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8581('0x4'));var rimraf=require(_0x8581('0x5'));var config=require(_0x8581('0x6'));var attributes=require(_0x8581('0x7'));var integrations=require(_0x8581('0x8'));module['exports']=function(_0x211cf2,_0x329bf1){return _0x211cf2[_0x8581('0x9')]('DeskAccount',attributes,{'tableName':_0x8581('0xa'),'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 f9eaf81..7e5684e 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 _0x0153=['../../config/environment','jayson/promise','client','http','request','info','DeskAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','limit','include','map','model','attributes','then','ShowDeskAccount','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x131e57,_0x2cf3a1){var _0x362902=function(_0x2d57d7){while(--_0x2d57d7){_0x131e57['push'](_0x131e57['shift']());}};_0x362902(++_0x2cf3a1);}(_0x0153,0x9e));var _0x3015=function(_0x5ee4cc,_0x486993){_0x5ee4cc=_0x5ee4cc-0x0;var _0x56df10=_0x0153[_0x5ee4cc];return _0x56df10;};'use strict';var _=require(_0x3015('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3015('0x1'));var rs=require(_0x3015('0x2'));var fs=require('fs');var Redis=require(_0x3015('0x3'));var db=require(_0x3015('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3015('0x5'))(_0x3015('0x6'));var config=require(_0x3015('0x7'));var jayson=require(_0x3015('0x8'));var client=jayson[_0x3015('0x9')][_0x3015('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b590d,_0x3c6efb,_0x1b5427){return new BPromise(function(_0x5a8694,_0x3e246e){return client[_0x3015('0xb')](_0x4b590d,_0x1b5427)['then'](function(_0x146189){logger[_0x3015('0xc')](_0x3015('0xd'),_0x3c6efb,'request\x20sent');logger[_0x3015('0xe')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x3c6efb,_0x3015('0xf'),JSON['stringify'](_0x146189));if(_0x146189[_0x3015('0x10')]){if(_0x146189[_0x3015('0x10')][_0x3015('0x11')]===0x1f4){logger[_0x3015('0x10')]('DeskAccount,\x20%s,\x20%s',_0x3c6efb,_0x146189[_0x3015('0x10')][_0x3015('0x12')]);return _0x3e246e(_0x146189[_0x3015('0x10')][_0x3015('0x12')]);}logger[_0x3015('0x10')]('DeskAccount,\x20%s,\x20%s',_0x3c6efb,_0x146189[_0x3015('0x10')][_0x3015('0x12')]);return _0x5a8694(_0x146189[_0x3015('0x10')][_0x3015('0x12')]);}else{logger['info']('DeskAccount,\x20%s,\x20%s',_0x3c6efb,_0x3015('0xf'));_0x5a8694(_0x146189['result'][_0x3015('0x12')]);}})[_0x3015('0x13')](function(_0xc83d27){logger['error'](_0x3015('0xd'),_0x3c6efb,_0xc83d27);_0x3e246e(_0xc83d27);});});}exports[_0x3015('0x14')]=function(_0xca9515){var _0x22a434=this;return new Promise(function(_0x3e7049,_0x54503f){return db[_0x3015('0x15')][_0x3015('0x16')]({'raw':_0xca9515[_0x3015('0x17')]?_0xca9515['options'][_0x3015('0x18')]===undefined?!![]:![]:!![],'where':_0xca9515[_0x3015('0x17')]?_0xca9515[_0x3015('0x17')][_0x3015('0x19')]||null:null,'attributes':_0xca9515[_0x3015('0x17')]?_0xca9515['options']['attributes']||null:null,'limit':_0xca9515['options']?_0xca9515[_0x3015('0x17')][_0x3015('0x1a')]||null:null,'include':_0xca9515[_0x3015('0x17')]?_0xca9515[_0x3015('0x17')][_0x3015('0x1b')]?_[_0x3015('0x1c')](_0xca9515[_0x3015('0x17')][_0x3015('0x1b')],function(_0x4a5d8d){return{'model':db[_0x4a5d8d[_0x3015('0x1d')]],'as':_0x4a5d8d['as'],'attributes':_0x4a5d8d['attributes'],'include':_0x4a5d8d[_0x3015('0x1b')]?_[_0x3015('0x1c')](_0x4a5d8d['include'],function(_0x16eedb){return{'model':db[_0x16eedb[_0x3015('0x1d')]],'as':_0x16eedb['as'],'attributes':_0x16eedb[_0x3015('0x1e')],'include':_0x16eedb[_0x3015('0x1b')]?_['map'](_0x16eedb[_0x3015('0x1b')],function(_0x1a47d6){return{'model':db[_0x1a47d6[_0x3015('0x1d')]],'as':_0x1a47d6['as'],'attributes':_0x1a47d6[_0x3015('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3015('0x1f')](function(_0x5672a5){logger[_0x3015('0xc')](_0x3015('0x14'),_0xca9515);logger['debug'](_0x3015('0x14'),_0xca9515,JSON['stringify'](_0x5672a5));_0x3e7049(_0x5672a5);})[_0x3015('0x13')](function(_0x2ccc82){logger[_0x3015('0x10')](_0x3015('0x14'),_0x2ccc82[_0x3015('0x12')],_0xca9515);_0x54503f(_0x22a434[_0x3015('0x10')](0x1f4,_0x2ccc82[_0x3015('0x12')]));});});};exports[_0x3015('0x20')]=function(_0x2d6479){var _0x4335b6=this;return new Promise(function(_0x5b1b87,_0x4776c2){return db[_0x3015('0x15')]['find']({'raw':_0x2d6479[_0x3015('0x17')]?_0x2d6479[_0x3015('0x17')][_0x3015('0x18')]===undefined?!![]:![]:!![],'where':_0x2d6479[_0x3015('0x17')]?_0x2d6479[_0x3015('0x17')][_0x3015('0x19')]||null:null,'attributes':_0x2d6479[_0x3015('0x17')]?_0x2d6479[_0x3015('0x17')][_0x3015('0x1e')]||null:null,'include':_0x2d6479[_0x3015('0x17')]?_0x2d6479['options']['include']?_[_0x3015('0x1c')](_0x2d6479[_0x3015('0x17')][_0x3015('0x1b')],function(_0x2e6eda){return{'model':db[_0x2e6eda[_0x3015('0x1d')]],'as':_0x2e6eda['as'],'attributes':_0x2e6eda[_0x3015('0x1e')],'include':_0x2e6eda[_0x3015('0x1b')]?_[_0x3015('0x1c')](_0x2e6eda['include'],function(_0x51e636){return{'model':db[_0x51e636[_0x3015('0x1d')]],'as':_0x51e636['as'],'attributes':_0x51e636['attributes'],'include':_0x51e636[_0x3015('0x1b')]?_[_0x3015('0x1c')](_0x51e636[_0x3015('0x1b')],function(_0xe004ba){return{'model':db[_0xe004ba['model']],'as':_0xe004ba['as'],'attributes':_0xe004ba[_0x3015('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3015('0x1f')](function(_0x53ceea){logger[_0x3015('0xc')](_0x3015('0x20'),_0x2d6479);logger[_0x3015('0xe')](_0x3015('0x20'),_0x2d6479,JSON['stringify'](_0x53ceea));_0x5b1b87(_0x53ceea);})['catch'](function(_0x3c8449){logger['error'](_0x3015('0x20'),_0x3c8449[_0x3015('0x12')],_0x2d6479);_0x4776c2(_0x4335b6[_0x3015('0x10')](0x1f4,_0x3c8449['message']));});});}; \ No newline at end of file +var _0xa196=['then','GetDeskAccount','catch','ShowDeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','DeskAccount','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x3dd8dd,_0x369f8e){var _0x33e300=function(_0xf1a7db){while(--_0xf1a7db){_0x3dd8dd['push'](_0x3dd8dd['shift']());}};_0x33e300(++_0x369f8e);}(_0xa196,0xa1));var _0x6a19=function(_0x1b89d0,_0x5ea66a){_0x1b89d0=_0x1b89d0-0x0;var _0x245a3d=_0xa196[_0x1b89d0];return _0x245a3d;};'use strict';var _=require(_0x6a19('0x0'));var util=require(_0x6a19('0x1'));var moment=require(_0x6a19('0x2'));var BPromise=require(_0x6a19('0x3'));var rs=require(_0x6a19('0x4'));var fs=require('fs');var Redis=require(_0x6a19('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6a19('0x6'));var logger=require(_0x6a19('0x7'))(_0x6a19('0x8'));var config=require(_0x6a19('0x9'));var jayson=require(_0x6a19('0xa'));var client=jayson[_0x6a19('0xb')][_0x6a19('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x39d112,_0x10f753,_0x34d2e4){return new BPromise(function(_0x51872e,_0x105961){return client[_0x6a19('0xd')](_0x39d112,_0x34d2e4)['then'](function(_0x1c5250){logger[_0x6a19('0xe')](_0x6a19('0xf'),_0x10f753,'request\x20sent');logger[_0x6a19('0x10')](_0x6a19('0x11'),_0x10f753,'request\x20sent',JSON[_0x6a19('0x12')](_0x1c5250));if(_0x1c5250[_0x6a19('0x13')]){if(_0x1c5250[_0x6a19('0x13')][_0x6a19('0x14')]===0x1f4){logger[_0x6a19('0x13')](_0x6a19('0xf'),_0x10f753,_0x1c5250[_0x6a19('0x13')][_0x6a19('0x15')]);return _0x105961(_0x1c5250[_0x6a19('0x13')][_0x6a19('0x15')]);}logger[_0x6a19('0x13')](_0x6a19('0xf'),_0x10f753,_0x1c5250[_0x6a19('0x13')][_0x6a19('0x15')]);return _0x51872e(_0x1c5250[_0x6a19('0x13')]['message']);}else{logger[_0x6a19('0xe')](_0x6a19('0xf'),_0x10f753,_0x6a19('0x16'));_0x51872e(_0x1c5250[_0x6a19('0x17')][_0x6a19('0x15')]);}})['catch'](function(_0x2aeec0){logger['error'](_0x6a19('0xf'),_0x10f753,_0x2aeec0);_0x105961(_0x2aeec0);});});}exports['GetDeskAccount']=function(_0x1c74b6){var _0x4376ab=this;return new Promise(function(_0x31ef94,_0x2259a1){return db[_0x6a19('0x18')][_0x6a19('0x19')]({'raw':_0x1c74b6[_0x6a19('0x1a')]?_0x1c74b6[_0x6a19('0x1a')][_0x6a19('0x1b')]===undefined?!![]:![]:!![],'where':_0x1c74b6[_0x6a19('0x1a')]?_0x1c74b6[_0x6a19('0x1a')][_0x6a19('0x1c')]||null:null,'attributes':_0x1c74b6[_0x6a19('0x1a')]?_0x1c74b6[_0x6a19('0x1a')][_0x6a19('0x1d')]||null:null,'limit':_0x1c74b6[_0x6a19('0x1a')]?_0x1c74b6[_0x6a19('0x1a')][_0x6a19('0x1e')]||null:null,'include':_0x1c74b6['options']?_0x1c74b6[_0x6a19('0x1a')][_0x6a19('0x1f')]?_[_0x6a19('0x20')](_0x1c74b6[_0x6a19('0x1a')][_0x6a19('0x1f')],function(_0x1fd270){return{'model':db[_0x1fd270[_0x6a19('0x21')]],'as':_0x1fd270['as'],'attributes':_0x1fd270['attributes'],'include':_0x1fd270['include']?_[_0x6a19('0x20')](_0x1fd270['include'],function(_0xdffb15){return{'model':db[_0xdffb15[_0x6a19('0x21')]],'as':_0xdffb15['as'],'attributes':_0xdffb15[_0x6a19('0x1d')],'include':_0xdffb15[_0x6a19('0x1f')]?_[_0x6a19('0x20')](_0xdffb15[_0x6a19('0x1f')],function(_0x3d2e22){return{'model':db[_0x3d2e22['model']],'as':_0x3d2e22['as'],'attributes':_0x3d2e22[_0x6a19('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6a19('0x22')](function(_0x47d3b5){logger[_0x6a19('0xe')](_0x6a19('0x23'),_0x1c74b6);logger[_0x6a19('0x10')](_0x6a19('0x23'),_0x1c74b6,JSON['stringify'](_0x47d3b5));_0x31ef94(_0x47d3b5);})[_0x6a19('0x24')](function(_0x509665){logger[_0x6a19('0x13')]('GetDeskAccount',_0x509665['message'],_0x1c74b6);_0x2259a1(_0x4376ab[_0x6a19('0x13')](0x1f4,_0x509665[_0x6a19('0x15')]));});});};exports[_0x6a19('0x25')]=function(_0x31bc94){var _0x368e15=this;return new Promise(function(_0x4392c2,_0x45c55c){return db[_0x6a19('0x18')][_0x6a19('0x26')]({'raw':_0x31bc94[_0x6a19('0x1a')]?_0x31bc94['options'][_0x6a19('0x1b')]===undefined?!![]:![]:!![],'where':_0x31bc94[_0x6a19('0x1a')]?_0x31bc94[_0x6a19('0x1a')][_0x6a19('0x1c')]||null:null,'attributes':_0x31bc94[_0x6a19('0x1a')]?_0x31bc94[_0x6a19('0x1a')][_0x6a19('0x1d')]||null:null,'include':_0x31bc94[_0x6a19('0x1a')]?_0x31bc94[_0x6a19('0x1a')][_0x6a19('0x1f')]?_[_0x6a19('0x20')](_0x31bc94['options'][_0x6a19('0x1f')],function(_0x683e06){return{'model':db[_0x683e06['model']],'as':_0x683e06['as'],'attributes':_0x683e06['attributes'],'include':_0x683e06[_0x6a19('0x1f')]?_[_0x6a19('0x20')](_0x683e06[_0x6a19('0x1f')],function(_0x10f5f8){return{'model':db[_0x10f5f8['model']],'as':_0x10f5f8['as'],'attributes':_0x10f5f8[_0x6a19('0x1d')],'include':_0x10f5f8[_0x6a19('0x1f')]?_[_0x6a19('0x20')](_0x10f5f8[_0x6a19('0x1f')],function(_0x10a978){return{'model':db[_0x10a978[_0x6a19('0x21')]],'as':_0x10a978['as'],'attributes':_0x10a978[_0x6a19('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3982ab){logger[_0x6a19('0xe')](_0x6a19('0x25'),_0x31bc94);logger[_0x6a19('0x10')](_0x6a19('0x25'),_0x31bc94,JSON[_0x6a19('0x12')](_0x3982ab));_0x4392c2(_0x3982ab);})[_0x6a19('0x24')](function(_0x2ccfc0){logger[_0x6a19('0x13')](_0x6a19('0x25'),_0x2ccfc0[_0x6a19('0x15')],_0x31bc94);_0x45c55c(_0x368e15['error'](0x1f4,_0x2ccfc0[_0x6a19('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index a6e9e29..fd342b4 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 _0x94d4=['index','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','create','post','setTags','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x94d4,0xa5));var _0x494d=function(_0x3907c2,_0x18043a){_0x3907c2=_0x3907c2-0x0;var _0x5df1ed=_0x94d4[_0x3907c2];return _0x5df1ed;};'use strict';var multer=require(_0x494d('0x0'));var util=require(_0x494d('0x1'));var path=require('path');var timeout=require(_0x494d('0x2'));var express=require(_0x494d('0x3'));var router=express[_0x494d('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x494d('0x5'));var config=require(_0x494d('0x6'));var controller=require(_0x494d('0x7'));router[_0x494d('0x8')]('/',auth[_0x494d('0x9')](),controller[_0x494d('0xa')]);router[_0x494d('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x494d('0x8')](_0x494d('0xb'),auth['isAuthenticated'](),controller['getFields']);router[_0x494d('0x8')](_0x494d('0xc'),auth['isAuthenticated'](),controller[_0x494d('0xd')]);router[_0x494d('0x8')](_0x494d('0xe'),auth[_0x494d('0x9')](),controller['getDescriptions']);router[_0x494d('0x8')](_0x494d('0xf'),auth['isAuthenticated'](),controller['getTags']);router['post']('/',auth[_0x494d('0x9')](),controller[_0x494d('0x10')]);router[_0x494d('0x11')](_0x494d('0xf'),auth[_0x494d('0x9')](),controller[_0x494d('0x12')]);router[_0x494d('0x13')](_0x494d('0x14'),auth[_0x494d('0x9')](),controller[_0x494d('0x15')]);router[_0x494d('0x16')]('/:id',auth[_0x494d('0x9')](),controller[_0x494d('0x17')]);module[_0x494d('0x18')]=router; \ No newline at end of file +var _0x9e54=['isAuthenticated','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','/:id','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','index'];(function(_0xaa44d9,_0x2d4402){var _0x26a6fc=function(_0x3375ea){while(--_0x3375ea){_0xaa44d9['push'](_0xaa44d9['shift']());}};_0x26a6fc(++_0x2d4402);}(_0x9e54,0x88));var _0x49e5=function(_0x1e699f,_0x3174f2){_0x1e699f=_0x1e699f-0x0;var _0x2719d6=_0x9e54[_0x1e699f];return _0x2719d6;};'use strict';var multer=require(_0x49e5('0x0'));var util=require(_0x49e5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x49e5('0x2')]();var auth=require(_0x49e5('0x3'));var interaction=require(_0x49e5('0x4'));var config=require('../../config/environment');var controller=require(_0x49e5('0x5'));router[_0x49e5('0x6')]('/',auth['isAuthenticated'](),controller[_0x49e5('0x7')]);router['get']('/:id',auth[_0x49e5('0x8')](),controller['show']);router[_0x49e5('0x6')](_0x49e5('0x9'),auth[_0x49e5('0x8')](),controller['getFields']);router['get'](_0x49e5('0xa'),auth['isAuthenticated'](),controller[_0x49e5('0xb')]);router[_0x49e5('0x6')](_0x49e5('0xc'),auth[_0x49e5('0x8')](),controller[_0x49e5('0xd')]);router['get'](_0x49e5('0xe'),auth['isAuthenticated'](),controller[_0x49e5('0xf')]);router[_0x49e5('0x10')]('/',auth[_0x49e5('0x8')](),controller[_0x49e5('0x11')]);router[_0x49e5('0x10')]('/:id/tags',auth['isAuthenticated'](),controller[_0x49e5('0x12')]);router[_0x49e5('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x49e5('0x14')]);router['delete'](_0x49e5('0x15'),auth['isAuthenticated'](),controller[_0x49e5('0x16')]);module[_0x49e5('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index cff8e7a..e068787 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 _0x4def=['sequelize','exports','STRING'];(function(_0x552865,_0x4e5d35){var _0x534117=function(_0x7d7fa7){while(--_0x7d7fa7){_0x552865['push'](_0x552865['shift']());}};_0x534117(++_0x4e5d35);}(_0x4def,0x90));var _0xf4de=function(_0x16d3c7,_0x82a2c4){_0x16d3c7=_0x16d3c7-0x0;var _0x1f6edc=_0x4def[_0x16d3c7];return _0x1f6edc;};'use strict';var Sequelize=require(_0xf4de('0x0'));module[_0xf4de('0x1')]={'name':{'type':Sequelize[_0xf4de('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdc50=['exports','STRING','sequelize'];(function(_0x15ad3f,_0x1d6280){var _0xfb1d10=function(_0x2730f7){while(--_0x2730f7){_0x15ad3f['push'](_0x15ad3f['shift']());}};_0xfb1d10(++_0x1d6280);}(_0xdc50,0x80));var _0x0dc5=function(_0x16f18f,_0x533934){_0x16f18f=_0x16f18f-0x0;var _0xafa041=_0xdc50[_0x16f18f];return _0xafa041;};'use strict';var Sequelize=require(_0x0dc5('0x0'));module[_0x0dc5('0x1')]={'name':{'type':Sequelize[_0x0dc5('0x2')]},'description':{'type':Sequelize[_0x0dc5('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index b0f3313..f08a352 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 _0xe32d=['DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','update','destroy','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','include','findAll','show','params','DeskConfiguration','rawAttributes','includeAll','options','find','create','body','getFields','findOne','getSubjects','DeskField','getDescriptions','getTags','setTags','ids','html-pdf','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info'];(function(_0x2a2966,_0x4a3091){var _0x2b2e70=function(_0x5b2331){while(--_0x5b2331){_0x2a2966['push'](_0x2a2966['shift']());}};_0x2b2e70(++_0x4a3091);}(_0xe32d,0xff));var _0xde32=function(_0xe39134,_0x120db7){_0xe39134=_0xe39134-0x0;var _0x28118a=_0xe32d[_0xe39134];return _0x28118a;};'use strict';var pdf=require(_0xde32('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xde32('0x1'));var zipdir=require(_0xde32('0x2'));var jsonpatch=require(_0xde32('0x3'));var rp=require('request-promise');var moment=require(_0xde32('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xde32('0x5'));var util=require('util');var path=require(_0xde32('0x6'));var sox=require(_0xde32('0x7'));var csv=require(_0xde32('0x8'));var ejs=require(_0xde32('0x9'));var fs=require('fs');var _=require(_0xde32('0xa'));var squel=require(_0xde32('0xb'));var crypto=require(_0xde32('0xc'));var jsforce=require(_0xde32('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xde32('0x8'));var querystring=require('querystring');var Papa=require(_0xde32('0xe'));var Redis=require('ioredis');var authService=require(_0xde32('0xf'));var qs=require(_0xde32('0x10'));var as=require(_0xde32('0x11'));var hardwareService=require(_0xde32('0x12'));var logger=require(_0xde32('0x13'))(_0xde32('0x14'));var utils=require(_0xde32('0x15'));var config=require(_0xde32('0x16'));var db=require(_0xde32('0x17'))['db'];var jayson=require(_0xde32('0x18'));var client=jayson[_0xde32('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x1f0c89,_0x3bbfd5,_0x7ab0ab){if(_0x7ab0ab){var _0x1acd89=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1acd89[_0xde32('0x1a')](_0x3bbfd5)){return _0x1f0c89;}else{throw new db[(_0xde32('0x1b'))][(_0xde32('0x1c'))](_0xde32('0x1d'));}}else{return _0x1f0c89;}}function respondWithRpcPromise(_0x23ba9e,_0x14d156,_0xaed16c,_0x21fa42){return new BPromise(function(_0x247e13,_0x5ae995){var _0x273172=_0x21fa42||client;return _0x273172[_0xde32('0x1e')](_0x23ba9e,_0xaed16c)[_0xde32('0x1f')](function(_0x11062a){logger[_0xde32('0x20')](_0xde32('0x21'),_0x14d156,_0xde32('0x22'));logger[_0xde32('0x23')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x14d156,'request\x20sent',JSON[_0xde32('0x24')](_0x11062a));if(_0x11062a[_0xde32('0x25')]){if(_0x11062a['error'][_0xde32('0x26')]===0x1f4){logger[_0xde32('0x25')](_0xde32('0x21'),_0x14d156,_0x11062a[_0xde32('0x25')][_0xde32('0x27')]);return _0x5ae995(_0x11062a[_0xde32('0x25')][_0xde32('0x27')]);}logger[_0xde32('0x25')](_0xde32('0x21'),_0x14d156,_0x11062a[_0xde32('0x25')][_0xde32('0x27')]);return _0x247e13(_0x11062a['error'][_0xde32('0x27')]);}else{logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x14d156,_0xde32('0x22'));_0x247e13(_0x11062a[_0xde32('0x28')]['message']);}})[_0xde32('0x29')](function(_0x2c90e6){logger[_0xde32('0x25')](_0xde32('0x21'),_0x14d156,_0x2c90e6);_0x5ae995(_0x2c90e6);});});}function respondWithStatusCode(_0x2d4ce0,_0x2c45e2){_0x2c45e2=_0x2c45e2||0xcc;return function(_0x232cdc){if(_0x232cdc){return _0x2d4ce0[_0xde32('0x2a')](_0x2c45e2);}return _0x2d4ce0[_0xde32('0x2b')](_0x2c45e2)['end']();};}function respondWithResult(_0xc13e0a,_0x27b2ef){_0x27b2ef=_0x27b2ef||0xc8;return function(_0x293834){if(_0x293834){return _0xc13e0a['status'](_0x27b2ef)[_0xde32('0x2c')](_0x293834);}};}function respondWithFilteredResult(_0x1c6103,_0x1204db){return function(_0x1a55d8){if(_0x1a55d8){var _0x51606e=_0x1a55d8[_0xde32('0x2d')],_0x31c4cd=_0x1204db[_0xde32('0x2e')],_0x5da5e5=_0x1204db[_0xde32('0x2e')]+_0x1204db[_0xde32('0x2f')],_0x2671fd;if(_0x5da5e5>=_0x51606e){_0x5da5e5=_0x51606e;_0x2671fd=0xc8;}else{_0x2671fd=0xce;}_0x1c6103['status'](_0x2671fd);return _0x1c6103[_0xde32('0x30')](_0xde32('0x31'),_0x31c4cd+'-'+_0x5da5e5+'/'+_0x51606e)['json'](_0x1a55d8);}return null;};}function patchUpdates(_0x3d24ba){return function(_0x271c9b){try{jsonpatch[_0xde32('0x32')](_0x271c9b,_0x3d24ba,!![]);}catch(_0x3325b6){return BPromise['reject'](_0x3325b6);}return _0x271c9b['save']();};}function saveUpdates(_0x4f2b30,_0x2f31f5){return function(_0x12ccde){if(_0x12ccde){return _0x12ccde[_0xde32('0x33')](_0x4f2b30)[_0xde32('0x1f')](function(_0x12a019){return _0x12a019;});}return null;};}function removeEntity(_0x30fac1,_0x162682){return function(_0x1aee37){if(_0x1aee37){return _0x1aee37[_0xde32('0x34')]()[_0xde32('0x1f')](function(){_0x30fac1[_0xde32('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e434c,_0x5bdf41){return function(_0x28fe88){if(!_0x28fe88){_0x2e434c['sendStatus'](0x194);}return _0x28fe88;};}function handleError(_0x564754,_0x31d82b){_0x31d82b=_0x31d82b||0x1f4;return function(_0x43a689){logger[_0xde32('0x25')](_0x43a689['stack']);if(_0x43a689[_0xde32('0x35')]){delete _0x43a689[_0xde32('0x35')];}_0x564754[_0xde32('0x2b')](_0x31d82b)[_0xde32('0x36')](_0x43a689);};}exports[_0xde32('0x37')]=function(_0x1c9c72,_0x254a50){var _0x3eaf2e={},_0x2738ef={},_0x13f63a={'count':0x0,'rows':[]};var _0x5362df=_['map'](db['DeskConfiguration']['rawAttributes'],function(_0x4dc9ec){return{'name':_0x4dc9ec[_0xde32('0x38')],'type':_0x4dc9ec[_0xde32('0x39')][_0xde32('0x3a')]};});_0x2738ef[_0xde32('0x3b')]=_[_0xde32('0x3c')](_0x5362df,_0xde32('0x35'));_0x2738ef[_0xde32('0x3d')]=_[_0xde32('0x3e')](_0x1c9c72[_0xde32('0x3d')]);_0x2738ef[_0xde32('0x3f')]=_[_0xde32('0x40')](_0x2738ef['model'],_0x2738ef[_0xde32('0x3d')]);_0x3eaf2e[_0xde32('0x41')]=_['intersection'](_0x2738ef[_0xde32('0x3b')],qs['fields'](_0x1c9c72['query'][_0xde32('0x42')]));_0x3eaf2e['attributes']=_0x3eaf2e[_0xde32('0x41')][_0xde32('0x43')]?_0x3eaf2e[_0xde32('0x41')]:_0x2738ef[_0xde32('0x3b')];if(!_0x1c9c72[_0xde32('0x3d')][_0xde32('0x44')](_0xde32('0x45'))){_0x3eaf2e[_0xde32('0x2f')]=qs['limit'](_0x1c9c72['query'][_0xde32('0x2f')]);_0x3eaf2e[_0xde32('0x2e')]=qs['offset'](_0x1c9c72['query']['offset']);}_0x3eaf2e[_0xde32('0x46')]=qs[_0xde32('0x47')](_0x1c9c72[_0xde32('0x3d')][_0xde32('0x47')]);_0x3eaf2e[_0xde32('0x48')]=qs['filters'](_[_0xde32('0x49')](_0x1c9c72[_0xde32('0x3d')],_0x2738ef[_0xde32('0x3f')]));if(_0x1c9c72[_0xde32('0x3d')][_0xde32('0x4a')]){_0x3eaf2e[_0xde32('0x48')]=_['merge'](_0x3eaf2e[_0xde32('0x48')],{'$or':_[_0xde32('0x3c')](_0x5362df,function(_0x399149){if(_0x399149[_0xde32('0x39')]!==_0xde32('0x4b')){var _0x2c7f5c={};_0x2c7f5c[_0x399149[_0xde32('0x35')]]={'$like':'%'+_0x1c9c72[_0xde32('0x3d')][_0xde32('0x4a')]+'%'};return _0x2c7f5c;}})});}_0x3eaf2e=_[_0xde32('0x4c')]({},_0x3eaf2e,_0x1c9c72['options']);var _0x52d467={'where':_0x3eaf2e[_0xde32('0x48')]};return db['DeskConfiguration']['count'](_0x52d467)['then'](function(_0x24572d){_0x13f63a[_0xde32('0x2d')]=_0x24572d;if(_0x1c9c72[_0xde32('0x3d')]['includeAll']){_0x3eaf2e[_0xde32('0x4d')]=[{'all':!![]}];}return db['DeskConfiguration'][_0xde32('0x4e')](_0x3eaf2e);})[_0xde32('0x1f')](function(_0x388444){_0x13f63a['rows']=_0x388444;return _0x13f63a;})[_0xde32('0x1f')](respondWithFilteredResult(_0x254a50,_0x3eaf2e))[_0xde32('0x29')](handleError(_0x254a50,null));};exports[_0xde32('0x4f')]=function(_0x465741,_0x413b31){var _0x39d1af={'raw':![],'where':{'id':_0x465741[_0xde32('0x50')]['id']}},_0x1e7f91={};_0x1e7f91[_0xde32('0x3b')]=_[_0xde32('0x3e')](db[_0xde32('0x51')][_0xde32('0x52')]);_0x1e7f91[_0xde32('0x3d')]=_[_0xde32('0x3e')](_0x465741[_0xde32('0x3d')]);_0x1e7f91[_0xde32('0x3f')]=_[_0xde32('0x40')](_0x1e7f91[_0xde32('0x3b')],_0x1e7f91[_0xde32('0x3d')]);_0x39d1af[_0xde32('0x41')]=_[_0xde32('0x40')](_0x1e7f91[_0xde32('0x3b')],qs['fields'](_0x465741['query'][_0xde32('0x42')]));_0x39d1af[_0xde32('0x41')]=_0x39d1af['attributes'][_0xde32('0x43')]?_0x39d1af['attributes']:_0x1e7f91[_0xde32('0x3b')];if(_0x465741[_0xde32('0x3d')][_0xde32('0x53')]){_0x39d1af[_0xde32('0x4d')]=[{'all':!![]}];}_0x39d1af=_[_0xde32('0x4c')]({},_0x39d1af,_0x465741[_0xde32('0x54')]);return db[_0xde32('0x51')][_0xde32('0x55')](_0x39d1af)['then'](handleEntityNotFound(_0x413b31,null))[_0xde32('0x1f')](respondWithResult(_0x413b31,null))[_0xde32('0x29')](handleError(_0x413b31,null));};exports[_0xde32('0x56')]=function(_0x51c4ef,_0x4d3c5f){return db[_0xde32('0x51')][_0xde32('0x56')](_0x51c4ef[_0xde32('0x57')],{})[_0xde32('0x1f')](respondWithResult(_0x4d3c5f,0xc9))[_0xde32('0x29')](handleError(_0x4d3c5f,null));};exports[_0xde32('0x33')]=function(_0x404062,_0x2a80e3){if(_0x404062[_0xde32('0x57')]['id']){delete _0x404062['body']['id'];}return db[_0xde32('0x51')][_0xde32('0x55')]({'where':{'id':_0x404062['params']['id']}})[_0xde32('0x1f')](handleEntityNotFound(_0x2a80e3,null))[_0xde32('0x1f')](saveUpdates(_0x404062[_0xde32('0x57')],null))[_0xde32('0x1f')](respondWithResult(_0x2a80e3,null))[_0xde32('0x29')](handleError(_0x2a80e3,null));};exports[_0xde32('0x34')]=function(_0x48db4d,_0x48dfb6){return db[_0xde32('0x51')][_0xde32('0x55')]({'where':{'id':_0x48db4d[_0xde32('0x50')]['id']}})[_0xde32('0x1f')](handleEntityNotFound(_0x48dfb6,null))[_0xde32('0x1f')](removeEntity(_0x48dfb6,null))['catch'](handleError(_0x48dfb6,null));};exports[_0xde32('0x58')]=function(_0x4e172c,_0x36c262,_0x399e02){var _0x51ea00={};var _0x3b5055={};var _0x25b2e8;var _0x16e056;return db[_0xde32('0x51')][_0xde32('0x59')]({'where':{'id':_0x4e172c[_0xde32('0x50')]['id']}})[_0xde32('0x1f')](handleEntityNotFound(_0x36c262,null))[_0xde32('0x1f')](function(_0x2e6353){if(_0x2e6353){_0x25b2e8=_0x2e6353;_0x3b5055['model']=_['keys'](db['DeskField']['rawAttributes']);_0x3b5055[_0xde32('0x3d')]=_[_0xde32('0x3e')](_0x4e172c[_0xde32('0x3d')]);_0x3b5055[_0xde32('0x3f')]=_[_0xde32('0x40')](_0x3b5055[_0xde32('0x3b')],_0x3b5055[_0xde32('0x3d')]);_0x51ea00[_0xde32('0x41')]=_[_0xde32('0x40')](_0x3b5055[_0xde32('0x3b')],qs[_0xde32('0x42')](_0x4e172c[_0xde32('0x3d')][_0xde32('0x42')]));_0x51ea00[_0xde32('0x41')]=_0x51ea00[_0xde32('0x41')][_0xde32('0x43')]?_0x51ea00[_0xde32('0x41')]:_0x3b5055[_0xde32('0x3b')];_0x51ea00[_0xde32('0x46')]=qs[_0xde32('0x47')](_0x4e172c['query']['sort']);_0x51ea00[_0xde32('0x48')]=qs[_0xde32('0x3f')](_[_0xde32('0x49')](_0x4e172c['query'],_0x3b5055[_0xde32('0x3f')]));if(_0x4e172c[_0xde32('0x3d')]['filter']){_0x51ea00['where']=_['merge'](_0x51ea00[_0xde32('0x48')],{'$or':_[_0xde32('0x3c')](_0x51ea00[_0xde32('0x41')],function(_0x3bba01){var _0x168a08={};_0x168a08[_0x3bba01]={'$like':'%'+_0x4e172c[_0xde32('0x3d')][_0xde32('0x4a')]+'%'};return _0x168a08;})});}_0x51ea00=_[_0xde32('0x4c')]({},_0x51ea00,_0x4e172c[_0xde32('0x54')]);return _0x25b2e8['getFields'](_0x51ea00);}})[_0xde32('0x1f')](function(_0x114080){if(_0x114080){_0x16e056=_0x114080[_0xde32('0x43')];if(!_0x4e172c[_0xde32('0x3d')][_0xde32('0x44')](_0xde32('0x45'))){_0x51ea00[_0xde32('0x2f')]=qs[_0xde32('0x2f')](_0x4e172c[_0xde32('0x3d')][_0xde32('0x2f')]);_0x51ea00[_0xde32('0x2e')]=qs['offset'](_0x4e172c[_0xde32('0x3d')][_0xde32('0x2e')]);}return _0x25b2e8[_0xde32('0x58')](_0x51ea00);}})[_0xde32('0x1f')](function(_0x2a9ac5){if(_0x2a9ac5){return _0x2a9ac5?{'count':_0x16e056,'rows':_0x2a9ac5}:null;}})['then'](respondWithResult(_0x36c262,null))['catch'](handleError(_0x36c262,null));};exports[_0xde32('0x5a')]=function(_0x2a6ffe,_0x24bf07,_0x433796){var _0xe1c788={};var _0x3df1d4={};var _0x4a5658;var _0x35763c;return db[_0xde32('0x51')][_0xde32('0x59')]({'where':{'id':_0x2a6ffe['params']['id']}})[_0xde32('0x1f')](handleEntityNotFound(_0x24bf07,null))['then'](function(_0x2a71f1){if(_0x2a71f1){_0x4a5658=_0x2a71f1;_0x3df1d4[_0xde32('0x3b')]=_['keys'](db[_0xde32('0x5b')][_0xde32('0x52')]);_0x3df1d4[_0xde32('0x3d')]=_[_0xde32('0x3e')](_0x2a6ffe[_0xde32('0x3d')]);_0x3df1d4['filters']=_[_0xde32('0x40')](_0x3df1d4['model'],_0x3df1d4['query']);_0xe1c788[_0xde32('0x41')]=_[_0xde32('0x40')](_0x3df1d4['model'],qs[_0xde32('0x42')](_0x2a6ffe[_0xde32('0x3d')][_0xde32('0x42')]));_0xe1c788['attributes']=_0xe1c788['attributes'][_0xde32('0x43')]?_0xe1c788['attributes']:_0x3df1d4[_0xde32('0x3b')];_0xe1c788[_0xde32('0x46')]=qs['sort'](_0x2a6ffe[_0xde32('0x3d')][_0xde32('0x47')]);_0xe1c788[_0xde32('0x48')]=qs[_0xde32('0x3f')](_[_0xde32('0x49')](_0x2a6ffe[_0xde32('0x3d')],_0x3df1d4[_0xde32('0x3f')]));if(_0x2a6ffe[_0xde32('0x3d')]['filter']){_0xe1c788['where']=_[_0xde32('0x4c')](_0xe1c788[_0xde32('0x48')],{'$or':_['map'](_0xe1c788[_0xde32('0x41')],function(_0x5a8df9){var _0x54154a={};_0x54154a[_0x5a8df9]={'$like':'%'+_0x2a6ffe[_0xde32('0x3d')][_0xde32('0x4a')]+'%'};return _0x54154a;})});}_0xe1c788=_[_0xde32('0x4c')]({},_0xe1c788,_0x2a6ffe[_0xde32('0x54')]);return _0x4a5658[_0xde32('0x5a')](_0xe1c788);}})[_0xde32('0x1f')](function(_0x18a4c4){if(_0x18a4c4){_0x35763c=_0x18a4c4[_0xde32('0x43')];if(!_0x2a6ffe[_0xde32('0x3d')][_0xde32('0x44')](_0xde32('0x45'))){_0xe1c788['limit']=qs[_0xde32('0x2f')](_0x2a6ffe[_0xde32('0x3d')][_0xde32('0x2f')]);_0xe1c788[_0xde32('0x2e')]=qs[_0xde32('0x2e')](_0x2a6ffe['query'][_0xde32('0x2e')]);}return _0x4a5658[_0xde32('0x5a')](_0xe1c788);}})[_0xde32('0x1f')](function(_0x3a6741){if(_0x3a6741){return _0x3a6741?{'count':_0x35763c,'rows':_0x3a6741}:null;}})[_0xde32('0x1f')](respondWithResult(_0x24bf07,null))['catch'](handleError(_0x24bf07,null));};exports['getDescriptions']=function(_0x3ab142,_0xa9a08f,_0x3052f6){var _0x55b8b0={};var _0x2b1b22={};var _0x371eee;var _0x2c3d8f;return db[_0xde32('0x51')]['findOne']({'where':{'id':_0x3ab142[_0xde32('0x50')]['id']}})[_0xde32('0x1f')](handleEntityNotFound(_0xa9a08f,null))[_0xde32('0x1f')](function(_0x5e02f8){if(_0x5e02f8){_0x371eee=_0x5e02f8;_0x2b1b22[_0xde32('0x3b')]=_[_0xde32('0x3e')](db[_0xde32('0x5b')]['rawAttributes']);_0x2b1b22[_0xde32('0x3d')]=_[_0xde32('0x3e')](_0x3ab142[_0xde32('0x3d')]);_0x2b1b22['filters']=_[_0xde32('0x40')](_0x2b1b22['model'],_0x2b1b22[_0xde32('0x3d')]);_0x55b8b0[_0xde32('0x41')]=_[_0xde32('0x40')](_0x2b1b22[_0xde32('0x3b')],qs[_0xde32('0x42')](_0x3ab142[_0xde32('0x3d')][_0xde32('0x42')]));_0x55b8b0[_0xde32('0x41')]=_0x55b8b0[_0xde32('0x41')][_0xde32('0x43')]?_0x55b8b0[_0xde32('0x41')]:_0x2b1b22[_0xde32('0x3b')];_0x55b8b0['order']=qs[_0xde32('0x47')](_0x3ab142[_0xde32('0x3d')]['sort']);_0x55b8b0[_0xde32('0x48')]=qs[_0xde32('0x3f')](_[_0xde32('0x49')](_0x3ab142['query'],_0x2b1b22['filters']));if(_0x3ab142['query'][_0xde32('0x4a')]){_0x55b8b0[_0xde32('0x48')]=_[_0xde32('0x4c')](_0x55b8b0[_0xde32('0x48')],{'$or':_[_0xde32('0x3c')](_0x55b8b0['attributes'],function(_0x16f05f){var _0xa70aa4={};_0xa70aa4[_0x16f05f]={'$like':'%'+_0x3ab142['query'][_0xde32('0x4a')]+'%'};return _0xa70aa4;})});}_0x55b8b0=_[_0xde32('0x4c')]({},_0x55b8b0,_0x3ab142[_0xde32('0x54')]);return _0x371eee['getDescriptions'](_0x55b8b0);}})[_0xde32('0x1f')](function(_0x3bd38a){if(_0x3bd38a){_0x2c3d8f=_0x3bd38a[_0xde32('0x43')];if(!_0x3ab142[_0xde32('0x3d')][_0xde32('0x44')](_0xde32('0x45'))){_0x55b8b0[_0xde32('0x2f')]=qs[_0xde32('0x2f')](_0x3ab142[_0xde32('0x3d')][_0xde32('0x2f')]);_0x55b8b0[_0xde32('0x2e')]=qs[_0xde32('0x2e')](_0x3ab142[_0xde32('0x3d')][_0xde32('0x2e')]);}return _0x371eee[_0xde32('0x5c')](_0x55b8b0);}})[_0xde32('0x1f')](function(_0x42398a){if(_0x42398a){return _0x42398a?{'count':_0x2c3d8f,'rows':_0x42398a}:null;}})[_0xde32('0x1f')](respondWithResult(_0xa9a08f,null))['catch'](handleError(_0xa9a08f,null));};exports[_0xde32('0x5d')]=function(_0x56fdd5,_0x583080,_0x552509){var _0x518c5c={};var _0x19b404={};var _0x629c3e;var _0x1151af;return db[_0xde32('0x51')][_0xde32('0x59')]({'where':{'id':_0x56fdd5[_0xde32('0x50')]['id']}})['then'](handleEntityNotFound(_0x583080,null))[_0xde32('0x1f')](function(_0x37ac06){if(_0x37ac06){_0x629c3e=_0x37ac06;_0x19b404['model']=_[_0xde32('0x3e')](db['Tag'][_0xde32('0x52')]);_0x19b404[_0xde32('0x3d')]=_[_0xde32('0x3e')](_0x56fdd5[_0xde32('0x3d')]);_0x19b404[_0xde32('0x3f')]=_['intersection'](_0x19b404[_0xde32('0x3b')],_0x19b404[_0xde32('0x3d')]);_0x518c5c[_0xde32('0x41')]=_[_0xde32('0x40')](_0x19b404[_0xde32('0x3b')],qs[_0xde32('0x42')](_0x56fdd5[_0xde32('0x3d')][_0xde32('0x42')]));_0x518c5c[_0xde32('0x41')]=_0x518c5c[_0xde32('0x41')][_0xde32('0x43')]?_0x518c5c[_0xde32('0x41')]:_0x19b404[_0xde32('0x3b')];_0x518c5c[_0xde32('0x46')]=qs['sort'](_0x56fdd5[_0xde32('0x3d')][_0xde32('0x47')]);_0x518c5c[_0xde32('0x48')]=qs['filters'](_[_0xde32('0x49')](_0x56fdd5[_0xde32('0x3d')],_0x19b404[_0xde32('0x3f')]));if(_0x56fdd5[_0xde32('0x3d')][_0xde32('0x4a')]){_0x518c5c[_0xde32('0x48')]=_[_0xde32('0x4c')](_0x518c5c[_0xde32('0x48')],{'$or':_[_0xde32('0x3c')](_0x518c5c[_0xde32('0x41')],function(_0x6e6d42){var _0x3c1e31={};_0x3c1e31[_0x6e6d42]={'$like':'%'+_0x56fdd5[_0xde32('0x3d')][_0xde32('0x4a')]+'%'};return _0x3c1e31;})});}_0x518c5c=_['merge']({},_0x518c5c,_0x56fdd5[_0xde32('0x54')]);return _0x629c3e[_0xde32('0x5d')](_0x518c5c);}})[_0xde32('0x1f')](function(_0x434253){if(_0x434253){_0x1151af=_0x434253['length'];if(!_0x56fdd5[_0xde32('0x3d')][_0xde32('0x44')](_0xde32('0x45'))){_0x518c5c[_0xde32('0x2f')]=qs[_0xde32('0x2f')](_0x56fdd5[_0xde32('0x3d')][_0xde32('0x2f')]);_0x518c5c[_0xde32('0x2e')]=qs[_0xde32('0x2e')](_0x56fdd5[_0xde32('0x3d')]['offset']);}return _0x629c3e[_0xde32('0x5d')](_0x518c5c);}})[_0xde32('0x1f')](function(_0x3cd971){if(_0x3cd971){return _0x3cd971?{'count':_0x1151af,'rows':_0x3cd971}:null;}})[_0xde32('0x1f')](respondWithResult(_0x583080,null))[_0xde32('0x29')](handleError(_0x583080,null));};exports[_0xde32('0x5e')]=function(_0x2bda6e,_0x4ac74f,_0x13793c){if(_0x2bda6e[_0xde32('0x57')]['id']){delete _0x2bda6e['body']['id'];}return db[_0xde32('0x51')]['findOne']({'where':{'id':_0x2bda6e['params']['id']}})['then'](handleEntityNotFound(_0x4ac74f,null))['then'](function(_0x36f893){if(_0x36f893){return _0x36f893[_0xde32('0x5e')](_0x2bda6e[_0xde32('0x57')][_0xde32('0x5f')]||[]);}return null;})[_0xde32('0x1f')](respondWithResult(_0x4ac74f,null))[_0xde32('0x29')](handleError(_0x4ac74f,null));}; \ No newline at end of file +var _0x2007=['error','code','message','info','result','status','end','json','offset','limit','set','Content-Range','reject','save','update','destroy','sendStatus','stack','name','send','index','DeskConfiguration','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','getFields','findOne','length','getSubjects','DeskField','getDescriptions','getTags','ids','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1b1c65,_0x23ca6d){var _0x1b86d9=function(_0x1e8559){while(--_0x1e8559){_0x1b1c65['push'](_0x1b1c65['shift']());}};_0x1b86d9(++_0x23ca6d);}(_0x2007,0x16a));var _0x7200=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2007[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x7200('0x0'));var emlformat=require(_0x7200('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7200('0x2'));var jsonpatch=require(_0x7200('0x3'));var rp=require(_0x7200('0x4'));var moment=require(_0x7200('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7200('0x6'));var util=require(_0x7200('0x7'));var path=require(_0x7200('0x8'));var sox=require(_0x7200('0x9'));var csv=require('to-csv');var ejs=require(_0x7200('0xa'));var fs=require('fs');var _=require(_0x7200('0xb'));var squel=require(_0x7200('0xc'));var crypto=require(_0x7200('0xd'));var jsforce=require(_0x7200('0xe'));var deskjs=require(_0x7200('0xf'));var toCsv=require(_0x7200('0x10'));var querystring=require(_0x7200('0x11'));var Papa=require(_0x7200('0x12'));var Redis=require(_0x7200('0x13'));var authService=require(_0x7200('0x14'));var qs=require(_0x7200('0x15'));var as=require(_0x7200('0x16'));var hardwareService=require(_0x7200('0x17'));var logger=require('../../config/logger')(_0x7200('0x18'));var utils=require(_0x7200('0x19'));var config=require(_0x7200('0x1a'));var db=require(_0x7200('0x1b'))['db'];var jayson=require(_0x7200('0x1c'));var client=jayson[_0x7200('0x1d')][_0x7200('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x1e4ecd,_0x1db014,_0x34ac06){if(_0x34ac06){var _0x597667=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x597667[_0x7200('0x1f')](_0x1db014)){return _0x1e4ecd;}else{throw new db['Sequelize']['ValidationError'](_0x7200('0x20'));}}else{return _0x1e4ecd;}}function respondWithRpcPromise(_0x266fda,_0x591e01,_0x5830c0,_0x3ff589){return new BPromise(function(_0x16b645,_0x2ccfa4){var _0x3a33b3=_0x3ff589||client;return _0x3a33b3['request'](_0x266fda,_0x5830c0)[_0x7200('0x21')](function(_0x142d4e){logger['info'](_0x7200('0x22'),_0x591e01,_0x7200('0x23'));logger['debug'](_0x7200('0x24'),_0x591e01,_0x7200('0x23'),JSON[_0x7200('0x25')](_0x142d4e));if(_0x142d4e[_0x7200('0x26')]){if(_0x142d4e[_0x7200('0x26')][_0x7200('0x27')]===0x1f4){logger[_0x7200('0x26')]('DeskConfiguration,\x20%s,\x20%s',_0x591e01,_0x142d4e[_0x7200('0x26')]['message']);return _0x2ccfa4(_0x142d4e['error']['message']);}logger[_0x7200('0x26')]('DeskConfiguration,\x20%s,\x20%s',_0x591e01,_0x142d4e[_0x7200('0x26')][_0x7200('0x28')]);return _0x16b645(_0x142d4e[_0x7200('0x26')]['message']);}else{logger[_0x7200('0x29')]('DeskConfiguration,\x20%s,\x20%s',_0x591e01,_0x7200('0x23'));_0x16b645(_0x142d4e[_0x7200('0x2a')]['message']);}})['catch'](function(_0x135742){logger[_0x7200('0x26')](_0x7200('0x22'),_0x591e01,_0x135742);_0x2ccfa4(_0x135742);});});}function respondWithStatusCode(_0x30b1f4,_0xdceb5b){_0xdceb5b=_0xdceb5b||0xcc;return function(_0x5895dd){if(_0x5895dd){return _0x30b1f4['sendStatus'](_0xdceb5b);}return _0x30b1f4[_0x7200('0x2b')](_0xdceb5b)[_0x7200('0x2c')]();};}function respondWithResult(_0x430cca,_0x98d3e){_0x98d3e=_0x98d3e||0xc8;return function(_0x1065f6){if(_0x1065f6){return _0x430cca[_0x7200('0x2b')](_0x98d3e)[_0x7200('0x2d')](_0x1065f6);}};}function respondWithFilteredResult(_0x5060d5,_0x365fec){return function(_0x383023){if(_0x383023){var _0x2e5f90=_0x383023['count'],_0x307790=_0x365fec[_0x7200('0x2e')],_0x18d553=_0x365fec[_0x7200('0x2e')]+_0x365fec[_0x7200('0x2f')],_0x312d79;if(_0x18d553>=_0x2e5f90){_0x18d553=_0x2e5f90;_0x312d79=0xc8;}else{_0x312d79=0xce;}_0x5060d5[_0x7200('0x2b')](_0x312d79);return _0x5060d5[_0x7200('0x30')](_0x7200('0x31'),_0x307790+'-'+_0x18d553+'/'+_0x2e5f90)[_0x7200('0x2d')](_0x383023);}return null;};}function patchUpdates(_0x1b26e0){return function(_0x2b97ce){try{jsonpatch['apply'](_0x2b97ce,_0x1b26e0,!![]);}catch(_0x108895){return BPromise[_0x7200('0x32')](_0x108895);}return _0x2b97ce[_0x7200('0x33')]();};}function saveUpdates(_0x55ad3a,_0x536f54){return function(_0x14f3a5){if(_0x14f3a5){return _0x14f3a5[_0x7200('0x34')](_0x55ad3a)['then'](function(_0x109f76){return _0x109f76;});}return null;};}function removeEntity(_0x9cd6e6,_0x2de97d){return function(_0x549dab){if(_0x549dab){return _0x549dab[_0x7200('0x35')]()[_0x7200('0x21')](function(){_0x9cd6e6['status'](0xcc)[_0x7200('0x2c')]();});}};}function handleEntityNotFound(_0x175b8e,_0x2cf404){return function(_0x1451d7){if(!_0x1451d7){_0x175b8e[_0x7200('0x36')](0x194);}return _0x1451d7;};}function handleError(_0x33e7de,_0x5bc4db){_0x5bc4db=_0x5bc4db||0x1f4;return function(_0x323f0f){logger[_0x7200('0x26')](_0x323f0f[_0x7200('0x37')]);if(_0x323f0f['name']){delete _0x323f0f[_0x7200('0x38')];}_0x33e7de[_0x7200('0x2b')](_0x5bc4db)[_0x7200('0x39')](_0x323f0f);};}exports[_0x7200('0x3a')]=function(_0x478686,_0x49a8f7){var _0x36c346={},_0x23749e={},_0xe60c1d={'count':0x0,'rows':[]};var _0x28055b=_['map'](db[_0x7200('0x3b')]['rawAttributes'],function(_0x2baa5a){return{'name':_0x2baa5a['fieldName'],'type':_0x2baa5a[_0x7200('0x3c')][_0x7200('0x3d')]};});_0x23749e[_0x7200('0x3e')]=_[_0x7200('0x3f')](_0x28055b,_0x7200('0x38'));_0x23749e[_0x7200('0x40')]=_[_0x7200('0x41')](_0x478686[_0x7200('0x40')]);_0x23749e[_0x7200('0x42')]=_[_0x7200('0x43')](_0x23749e[_0x7200('0x3e')],_0x23749e['query']);_0x36c346[_0x7200('0x44')]=_[_0x7200('0x43')](_0x23749e['model'],qs[_0x7200('0x45')](_0x478686[_0x7200('0x40')]['fields']));_0x36c346[_0x7200('0x44')]=_0x36c346[_0x7200('0x44')]['length']?_0x36c346[_0x7200('0x44')]:_0x23749e['model'];if(!_0x478686[_0x7200('0x40')][_0x7200('0x46')](_0x7200('0x47'))){_0x36c346['limit']=qs['limit'](_0x478686[_0x7200('0x40')][_0x7200('0x2f')]);_0x36c346[_0x7200('0x2e')]=qs['offset'](_0x478686['query'][_0x7200('0x2e')]);}_0x36c346[_0x7200('0x48')]=qs[_0x7200('0x49')](_0x478686[_0x7200('0x40')][_0x7200('0x49')]);_0x36c346[_0x7200('0x4a')]=qs[_0x7200('0x42')](_[_0x7200('0x4b')](_0x478686['query'],_0x23749e[_0x7200('0x42')]));if(_0x478686[_0x7200('0x40')][_0x7200('0x4c')]){_0x36c346[_0x7200('0x4a')]=_['merge'](_0x36c346[_0x7200('0x4a')],{'$or':_['map'](_0x28055b,function(_0x3b5818){if(_0x3b5818[_0x7200('0x3c')]!==_0x7200('0x4d')){var _0x3a53bd={};_0x3a53bd[_0x3b5818[_0x7200('0x38')]]={'$like':'%'+_0x478686[_0x7200('0x40')][_0x7200('0x4c')]+'%'};return _0x3a53bd;}})});}_0x36c346=_[_0x7200('0x4e')]({},_0x36c346,_0x478686[_0x7200('0x4f')]);var _0x4c646c={'where':_0x36c346['where']};return db[_0x7200('0x3b')][_0x7200('0x50')](_0x4c646c)[_0x7200('0x21')](function(_0x5284fe){_0xe60c1d['count']=_0x5284fe;if(_0x478686[_0x7200('0x40')][_0x7200('0x51')]){_0x36c346[_0x7200('0x52')]=[{'all':!![]}];}return db[_0x7200('0x3b')][_0x7200('0x53')](_0x36c346);})[_0x7200('0x21')](function(_0x11446f){_0xe60c1d[_0x7200('0x54')]=_0x11446f;return _0xe60c1d;})[_0x7200('0x21')](respondWithFilteredResult(_0x49a8f7,_0x36c346))[_0x7200('0x55')](handleError(_0x49a8f7,null));};exports[_0x7200('0x56')]=function(_0x53a9f4,_0x3da843){var _0x5510a9={'raw':![],'where':{'id':_0x53a9f4[_0x7200('0x57')]['id']}},_0x16eda8={};_0x16eda8[_0x7200('0x3e')]=_[_0x7200('0x41')](db[_0x7200('0x3b')][_0x7200('0x58')]);_0x16eda8[_0x7200('0x40')]=_['keys'](_0x53a9f4[_0x7200('0x40')]);_0x16eda8[_0x7200('0x42')]=_['intersection'](_0x16eda8['model'],_0x16eda8[_0x7200('0x40')]);_0x5510a9['attributes']=_[_0x7200('0x43')](_0x16eda8['model'],qs['fields'](_0x53a9f4[_0x7200('0x40')][_0x7200('0x45')]));_0x5510a9['attributes']=_0x5510a9[_0x7200('0x44')]['length']?_0x5510a9['attributes']:_0x16eda8[_0x7200('0x3e')];if(_0x53a9f4[_0x7200('0x40')]['includeAll']){_0x5510a9[_0x7200('0x52')]=[{'all':!![]}];}_0x5510a9=_[_0x7200('0x4e')]({},_0x5510a9,_0x53a9f4[_0x7200('0x4f')]);return db[_0x7200('0x3b')][_0x7200('0x59')](_0x5510a9)[_0x7200('0x21')](handleEntityNotFound(_0x3da843,null))[_0x7200('0x21')](respondWithResult(_0x3da843,null))[_0x7200('0x55')](handleError(_0x3da843,null));};exports[_0x7200('0x5a')]=function(_0x823455,_0x16450d){return db['DeskConfiguration'][_0x7200('0x5a')](_0x823455['body'],{})[_0x7200('0x21')](respondWithResult(_0x16450d,0xc9))[_0x7200('0x55')](handleError(_0x16450d,null));};exports[_0x7200('0x34')]=function(_0x209d7a,_0xdc42f4){if(_0x209d7a[_0x7200('0x5b')]['id']){delete _0x209d7a[_0x7200('0x5b')]['id'];}return db['DeskConfiguration']['find']({'where':{'id':_0x209d7a['params']['id']}})[_0x7200('0x21')](handleEntityNotFound(_0xdc42f4,null))[_0x7200('0x21')](saveUpdates(_0x209d7a[_0x7200('0x5b')],null))[_0x7200('0x21')](respondWithResult(_0xdc42f4,null))[_0x7200('0x55')](handleError(_0xdc42f4,null));};exports[_0x7200('0x35')]=function(_0x56daa0,_0x30d191){return db[_0x7200('0x3b')][_0x7200('0x59')]({'where':{'id':_0x56daa0['params']['id']}})['then'](handleEntityNotFound(_0x30d191,null))[_0x7200('0x21')](removeEntity(_0x30d191,null))['catch'](handleError(_0x30d191,null));};exports[_0x7200('0x5c')]=function(_0xae5d1,_0x4ea43f,_0x4eb8c7){var _0x5ce7be={};var _0x42b1b7={};var _0x29c43f;var _0x2eadae;return db['DeskConfiguration'][_0x7200('0x5d')]({'where':{'id':_0xae5d1[_0x7200('0x57')]['id']}})['then'](handleEntityNotFound(_0x4ea43f,null))['then'](function(_0x4ccf27){if(_0x4ccf27){_0x29c43f=_0x4ccf27;_0x42b1b7[_0x7200('0x3e')]=_[_0x7200('0x41')](db['DeskField'][_0x7200('0x58')]);_0x42b1b7[_0x7200('0x40')]=_['keys'](_0xae5d1[_0x7200('0x40')]);_0x42b1b7[_0x7200('0x42')]=_[_0x7200('0x43')](_0x42b1b7[_0x7200('0x3e')],_0x42b1b7[_0x7200('0x40')]);_0x5ce7be[_0x7200('0x44')]=_[_0x7200('0x43')](_0x42b1b7[_0x7200('0x3e')],qs[_0x7200('0x45')](_0xae5d1[_0x7200('0x40')]['fields']));_0x5ce7be[_0x7200('0x44')]=_0x5ce7be['attributes'][_0x7200('0x5e')]?_0x5ce7be[_0x7200('0x44')]:_0x42b1b7[_0x7200('0x3e')];_0x5ce7be['order']=qs[_0x7200('0x49')](_0xae5d1[_0x7200('0x40')]['sort']);_0x5ce7be[_0x7200('0x4a')]=qs['filters'](_['pick'](_0xae5d1[_0x7200('0x40')],_0x42b1b7[_0x7200('0x42')]));if(_0xae5d1[_0x7200('0x40')][_0x7200('0x4c')]){_0x5ce7be[_0x7200('0x4a')]=_[_0x7200('0x4e')](_0x5ce7be['where'],{'$or':_[_0x7200('0x3f')](_0x5ce7be['attributes'],function(_0x4015bb){var _0x4629f8={};_0x4629f8[_0x4015bb]={'$like':'%'+_0xae5d1['query'][_0x7200('0x4c')]+'%'};return _0x4629f8;})});}_0x5ce7be=_[_0x7200('0x4e')]({},_0x5ce7be,_0xae5d1[_0x7200('0x4f')]);return _0x29c43f['getFields'](_0x5ce7be);}})['then'](function(_0x1befed){if(_0x1befed){_0x2eadae=_0x1befed[_0x7200('0x5e')];if(!_0xae5d1[_0x7200('0x40')][_0x7200('0x46')](_0x7200('0x47'))){_0x5ce7be['limit']=qs[_0x7200('0x2f')](_0xae5d1[_0x7200('0x40')][_0x7200('0x2f')]);_0x5ce7be['offset']=qs['offset'](_0xae5d1[_0x7200('0x40')][_0x7200('0x2e')]);}return _0x29c43f[_0x7200('0x5c')](_0x5ce7be);}})[_0x7200('0x21')](function(_0x54902c){if(_0x54902c){return _0x54902c?{'count':_0x2eadae,'rows':_0x54902c}:null;}})[_0x7200('0x21')](respondWithResult(_0x4ea43f,null))['catch'](handleError(_0x4ea43f,null));};exports[_0x7200('0x5f')]=function(_0x45fc85,_0x58d952,_0x58dc3e){var _0x4f9f09={};var _0x2810ee={};var _0x3a0ae0;var _0x5ece29;return db[_0x7200('0x3b')][_0x7200('0x5d')]({'where':{'id':_0x45fc85[_0x7200('0x57')]['id']}})[_0x7200('0x21')](handleEntityNotFound(_0x58d952,null))[_0x7200('0x21')](function(_0x3aaac7){if(_0x3aaac7){_0x3a0ae0=_0x3aaac7;_0x2810ee[_0x7200('0x3e')]=_['keys'](db[_0x7200('0x60')][_0x7200('0x58')]);_0x2810ee['query']=_['keys'](_0x45fc85[_0x7200('0x40')]);_0x2810ee[_0x7200('0x42')]=_[_0x7200('0x43')](_0x2810ee[_0x7200('0x3e')],_0x2810ee[_0x7200('0x40')]);_0x4f9f09[_0x7200('0x44')]=_[_0x7200('0x43')](_0x2810ee[_0x7200('0x3e')],qs[_0x7200('0x45')](_0x45fc85[_0x7200('0x40')][_0x7200('0x45')]));_0x4f9f09[_0x7200('0x44')]=_0x4f9f09[_0x7200('0x44')][_0x7200('0x5e')]?_0x4f9f09['attributes']:_0x2810ee[_0x7200('0x3e')];_0x4f9f09[_0x7200('0x48')]=qs['sort'](_0x45fc85[_0x7200('0x40')][_0x7200('0x49')]);_0x4f9f09['where']=qs['filters'](_[_0x7200('0x4b')](_0x45fc85[_0x7200('0x40')],_0x2810ee[_0x7200('0x42')]));if(_0x45fc85['query'][_0x7200('0x4c')]){_0x4f9f09[_0x7200('0x4a')]=_['merge'](_0x4f9f09[_0x7200('0x4a')],{'$or':_[_0x7200('0x3f')](_0x4f9f09[_0x7200('0x44')],function(_0xa7ee0a){var _0x45d4c6={};_0x45d4c6[_0xa7ee0a]={'$like':'%'+_0x45fc85[_0x7200('0x40')][_0x7200('0x4c')]+'%'};return _0x45d4c6;})});}_0x4f9f09=_[_0x7200('0x4e')]({},_0x4f9f09,_0x45fc85[_0x7200('0x4f')]);return _0x3a0ae0['getSubjects'](_0x4f9f09);}})[_0x7200('0x21')](function(_0x764b0d){if(_0x764b0d){_0x5ece29=_0x764b0d[_0x7200('0x5e')];if(!_0x45fc85['query'][_0x7200('0x46')](_0x7200('0x47'))){_0x4f9f09[_0x7200('0x2f')]=qs[_0x7200('0x2f')](_0x45fc85[_0x7200('0x40')][_0x7200('0x2f')]);_0x4f9f09[_0x7200('0x2e')]=qs[_0x7200('0x2e')](_0x45fc85[_0x7200('0x40')]['offset']);}return _0x3a0ae0[_0x7200('0x5f')](_0x4f9f09);}})['then'](function(_0x5749af){if(_0x5749af){return _0x5749af?{'count':_0x5ece29,'rows':_0x5749af}:null;}})[_0x7200('0x21')](respondWithResult(_0x58d952,null))[_0x7200('0x55')](handleError(_0x58d952,null));};exports[_0x7200('0x61')]=function(_0x27222d,_0x325cb8,_0x3300eb){var _0x24fca7={};var _0x2c3cde={};var _0x3e9e41;var _0x226445;return db[_0x7200('0x3b')]['findOne']({'where':{'id':_0x27222d[_0x7200('0x57')]['id']}})[_0x7200('0x21')](handleEntityNotFound(_0x325cb8,null))[_0x7200('0x21')](function(_0x29ab17){if(_0x29ab17){_0x3e9e41=_0x29ab17;_0x2c3cde[_0x7200('0x3e')]=_[_0x7200('0x41')](db[_0x7200('0x60')][_0x7200('0x58')]);_0x2c3cde[_0x7200('0x40')]=_['keys'](_0x27222d[_0x7200('0x40')]);_0x2c3cde[_0x7200('0x42')]=_[_0x7200('0x43')](_0x2c3cde[_0x7200('0x3e')],_0x2c3cde[_0x7200('0x40')]);_0x24fca7[_0x7200('0x44')]=_[_0x7200('0x43')](_0x2c3cde['model'],qs['fields'](_0x27222d[_0x7200('0x40')][_0x7200('0x45')]));_0x24fca7[_0x7200('0x44')]=_0x24fca7[_0x7200('0x44')][_0x7200('0x5e')]?_0x24fca7[_0x7200('0x44')]:_0x2c3cde[_0x7200('0x3e')];_0x24fca7[_0x7200('0x48')]=qs[_0x7200('0x49')](_0x27222d['query'][_0x7200('0x49')]);_0x24fca7[_0x7200('0x4a')]=qs[_0x7200('0x42')](_['pick'](_0x27222d[_0x7200('0x40')],_0x2c3cde[_0x7200('0x42')]));if(_0x27222d[_0x7200('0x40')][_0x7200('0x4c')]){_0x24fca7[_0x7200('0x4a')]=_[_0x7200('0x4e')](_0x24fca7[_0x7200('0x4a')],{'$or':_[_0x7200('0x3f')](_0x24fca7[_0x7200('0x44')],function(_0x3cab6d){var _0x111fc0={};_0x111fc0[_0x3cab6d]={'$like':'%'+_0x27222d[_0x7200('0x40')][_0x7200('0x4c')]+'%'};return _0x111fc0;})});}_0x24fca7=_[_0x7200('0x4e')]({},_0x24fca7,_0x27222d[_0x7200('0x4f')]);return _0x3e9e41[_0x7200('0x61')](_0x24fca7);}})[_0x7200('0x21')](function(_0x359827){if(_0x359827){_0x226445=_0x359827[_0x7200('0x5e')];if(!_0x27222d[_0x7200('0x40')][_0x7200('0x46')](_0x7200('0x47'))){_0x24fca7[_0x7200('0x2f')]=qs[_0x7200('0x2f')](_0x27222d[_0x7200('0x40')]['limit']);_0x24fca7[_0x7200('0x2e')]=qs[_0x7200('0x2e')](_0x27222d[_0x7200('0x40')]['offset']);}return _0x3e9e41[_0x7200('0x61')](_0x24fca7);}})['then'](function(_0x429d65){if(_0x429d65){return _0x429d65?{'count':_0x226445,'rows':_0x429d65}:null;}})['then'](respondWithResult(_0x325cb8,null))['catch'](handleError(_0x325cb8,null));};exports[_0x7200('0x62')]=function(_0x3b03db,_0x47fe06,_0x434307){var _0x29c553={};var _0x16ca00={};var _0x4ef21f;var _0x26a6e6;return db[_0x7200('0x3b')][_0x7200('0x5d')]({'where':{'id':_0x3b03db[_0x7200('0x57')]['id']}})[_0x7200('0x21')](handleEntityNotFound(_0x47fe06,null))[_0x7200('0x21')](function(_0xff36f8){if(_0xff36f8){_0x4ef21f=_0xff36f8;_0x16ca00[_0x7200('0x3e')]=_[_0x7200('0x41')](db['Tag']['rawAttributes']);_0x16ca00['query']=_[_0x7200('0x41')](_0x3b03db[_0x7200('0x40')]);_0x16ca00[_0x7200('0x42')]=_[_0x7200('0x43')](_0x16ca00['model'],_0x16ca00[_0x7200('0x40')]);_0x29c553['attributes']=_[_0x7200('0x43')](_0x16ca00['model'],qs[_0x7200('0x45')](_0x3b03db[_0x7200('0x40')][_0x7200('0x45')]));_0x29c553[_0x7200('0x44')]=_0x29c553[_0x7200('0x44')][_0x7200('0x5e')]?_0x29c553['attributes']:_0x16ca00[_0x7200('0x3e')];_0x29c553[_0x7200('0x48')]=qs[_0x7200('0x49')](_0x3b03db[_0x7200('0x40')]['sort']);_0x29c553['where']=qs['filters'](_[_0x7200('0x4b')](_0x3b03db['query'],_0x16ca00[_0x7200('0x42')]));if(_0x3b03db[_0x7200('0x40')]['filter']){_0x29c553['where']=_[_0x7200('0x4e')](_0x29c553['where'],{'$or':_[_0x7200('0x3f')](_0x29c553[_0x7200('0x44')],function(_0x13a5e7){var _0x5205c2={};_0x5205c2[_0x13a5e7]={'$like':'%'+_0x3b03db[_0x7200('0x40')][_0x7200('0x4c')]+'%'};return _0x5205c2;})});}_0x29c553=_[_0x7200('0x4e')]({},_0x29c553,_0x3b03db[_0x7200('0x4f')]);return _0x4ef21f[_0x7200('0x62')](_0x29c553);}})[_0x7200('0x21')](function(_0x28b2e2){if(_0x28b2e2){_0x26a6e6=_0x28b2e2[_0x7200('0x5e')];if(!_0x3b03db[_0x7200('0x40')][_0x7200('0x46')](_0x7200('0x47'))){_0x29c553[_0x7200('0x2f')]=qs['limit'](_0x3b03db['query']['limit']);_0x29c553['offset']=qs['offset'](_0x3b03db[_0x7200('0x40')][_0x7200('0x2e')]);}return _0x4ef21f[_0x7200('0x62')](_0x29c553);}})[_0x7200('0x21')](function(_0x406917){if(_0x406917){return _0x406917?{'count':_0x26a6e6,'rows':_0x406917}:null;}})[_0x7200('0x21')](respondWithResult(_0x47fe06,null))[_0x7200('0x55')](handleError(_0x47fe06,null));};exports['setTags']=function(_0x3e59e8,_0x555718,_0x19460a){if(_0x3e59e8[_0x7200('0x5b')]['id']){delete _0x3e59e8[_0x7200('0x5b')]['id'];}return db[_0x7200('0x3b')][_0x7200('0x5d')]({'where':{'id':_0x3e59e8[_0x7200('0x57')]['id']}})['then'](handleEntityNotFound(_0x555718,null))[_0x7200('0x21')](function(_0x118825){if(_0x118825){return _0x118825['setTags'](_0x3e59e8[_0x7200('0x5b')][_0x7200('0x63')]||[]);}return null;})[_0x7200('0x21')](respondWithResult(_0x555718,null))[_0x7200('0x55')](handleError(_0x555718,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index c0b82ab..b64e6e1 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 _0xece8=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger'];(function(_0x5de713,_0x1c1ba1){var _0x1742a4=function(_0x329915){while(--_0x329915){_0x5de713['push'](_0x5de713['shift']());}};_0x1742a4(++_0x1c1ba1);}(_0xece8,0x129));var _0x8ece=function(_0x3399a0,_0x2c3489){_0x3399a0=_0x3399a0-0x0;var _0x1f6d58=_0xece8[_0x3399a0];return _0x1f6d58;};'use strict';var _=require(_0x8ece('0x0'));var util=require(_0x8ece('0x1'));var logger=require(_0x8ece('0x2'))('api');var moment=require(_0x8ece('0x3'));var BPromise=require(_0x8ece('0x4'));var rp=require(_0x8ece('0x5'));var fs=require('fs');var path=require(_0x8ece('0x6'));var rimraf=require(_0x8ece('0x7'));var config=require(_0x8ece('0x8'));var attributes=require(_0x8ece('0x9'));module['exports']=function(_0x14f532,_0x5aca55){return _0x14f532['define'](_0x8ece('0xa'),attributes,{'tableName':_0x8ece('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3710=['request-promise','path','../../config/environment','exports','int_desk_configurations','lodash','util','../../config/logger','api'];(function(_0x549f40,_0x20c9dc){var _0x43e44f=function(_0xac3d71){while(--_0xac3d71){_0x549f40['push'](_0x549f40['shift']());}};_0x43e44f(++_0x20c9dc);}(_0x3710,0x1a3));var _0x0371=function(_0x1466a3,_0x4d3c05){_0x1466a3=_0x1466a3-0x0;var _0x4e19a7=_0x3710[_0x1466a3];return _0x4e19a7;};'use strict';var _=require(_0x0371('0x0'));var util=require(_0x0371('0x1'));var logger=require(_0x0371('0x2'))(_0x0371('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0371('0x4'));var fs=require('fs');var path=require(_0x0371('0x5'));var rimraf=require('rimraf');var config=require(_0x0371('0x6'));var attributes=require('./intDeskConfiguration.attributes');module[_0x0371('0x7')]=function(_0x2e271f,_0x3f52ae){return _0x2e271f['define']('DeskConfiguration',attributes,{'tableName':_0x0371('0x8'),'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 7029a10..cf01b55 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 _0x6b19=['error','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b19,0xe8));var _0x96b1=function(_0x2af652,_0x42c24f){_0x2af652=_0x2af652-0x0;var _0xcce294=_0x6b19[_0x2af652];return _0xcce294;};'use strict';var _=require(_0x96b1('0x0'));var util=require(_0x96b1('0x1'));var moment=require('moment');var BPromise=require(_0x96b1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x96b1('0x3'))['db'];var utils=require(_0x96b1('0x4'));var logger=require(_0x96b1('0x5'))(_0x96b1('0x6'));var config=require(_0x96b1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x96b1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e3e1a,_0x572fde,_0x57a23a){return new BPromise(function(_0x307e65,_0x535cc9){return client[_0x96b1('0x9')](_0x3e3e1a,_0x57a23a)['then'](function(_0x36ea50){logger[_0x96b1('0xa')](_0x96b1('0xb'),_0x572fde,_0x96b1('0xc'));logger[_0x96b1('0xd')](_0x96b1('0xe'),_0x572fde,_0x96b1('0xc'),JSON['stringify'](_0x36ea50));if(_0x36ea50['error']){if(_0x36ea50[_0x96b1('0xf')]['code']===0x1f4){logger['error'](_0x96b1('0xb'),_0x572fde,_0x36ea50[_0x96b1('0xf')][_0x96b1('0x10')]);return _0x535cc9(_0x36ea50['error'][_0x96b1('0x10')]);}logger[_0x96b1('0xf')](_0x96b1('0xb'),_0x572fde,_0x36ea50[_0x96b1('0xf')][_0x96b1('0x10')]);return _0x307e65(_0x36ea50['error'][_0x96b1('0x10')]);}else{logger[_0x96b1('0xa')](_0x96b1('0xb'),_0x572fde,_0x96b1('0xc'));_0x307e65(_0x36ea50[_0x96b1('0x11')][_0x96b1('0x10')]);}})[_0x96b1('0x12')](function(_0x2d5a32){logger[_0x96b1('0xf')](_0x96b1('0xb'),_0x572fde,_0x2d5a32);_0x535cc9(_0x2d5a32);});});} \ No newline at end of file +var _0xffe1=['util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x57e1b7,_0x5d0871){var _0x52ff18=function(_0x4e740f){while(--_0x4e740f){_0x57e1b7['push'](_0x57e1b7['shift']());}};_0x52ff18(++_0x5d0871);}(_0xffe1,0x175));var _0x1ffe=function(_0x211d75,_0x1cbe20){_0x211d75=_0x211d75-0x0;var _0x3ec331=_0xffe1[_0x211d75];return _0x3ec331;};'use strict';var _=require(_0x1ffe('0x0'));var util=require(_0x1ffe('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1ffe('0x2'));var fs=require('fs');var Redis=require(_0x1ffe('0x3'));var db=require(_0x1ffe('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ffe('0x5'))(_0x1ffe('0x6'));var config=require(_0x1ffe('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1ffe('0x8')][_0x1ffe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6bc1ed,_0x26e370,_0xb34112){return new BPromise(function(_0x8eee2b,_0x4d2a28){return client['request'](_0x6bc1ed,_0xb34112)[_0x1ffe('0xa')](function(_0x13556e){logger[_0x1ffe('0xb')](_0x1ffe('0xc'),_0x26e370,'request\x20sent');logger[_0x1ffe('0xd')](_0x1ffe('0xe'),_0x26e370,_0x1ffe('0xf'),JSON[_0x1ffe('0x10')](_0x13556e));if(_0x13556e[_0x1ffe('0x11')]){if(_0x13556e[_0x1ffe('0x11')][_0x1ffe('0x12')]===0x1f4){logger[_0x1ffe('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0x26e370,_0x13556e[_0x1ffe('0x11')][_0x1ffe('0x13')]);return _0x4d2a28(_0x13556e['error'][_0x1ffe('0x13')]);}logger[_0x1ffe('0x11')](_0x1ffe('0xc'),_0x26e370,_0x13556e[_0x1ffe('0x11')][_0x1ffe('0x13')]);return _0x8eee2b(_0x13556e['error'][_0x1ffe('0x13')]);}else{logger[_0x1ffe('0xb')](_0x1ffe('0xc'),_0x26e370,'request\x20sent');_0x8eee2b(_0x13556e[_0x1ffe('0x14')]['message']);}})[_0x1ffe('0x15')](function(_0x565922){logger[_0x1ffe('0x11')](_0x1ffe('0xc'),_0x26e370,_0x565922);_0x4d2a28(_0x565922);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index bfdfd3c..adc38cd 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 _0x2b2d=['update','delete','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','create','put'];(function(_0x102c8f,_0x2199e0){var _0x494c4c=function(_0x26bc4e){while(--_0x26bc4e){_0x102c8f['push'](_0x102c8f['shift']());}};_0x494c4c(++_0x2199e0);}(_0x2b2d,0x7b));var _0xd2b2=function(_0x5dff0c,_0x2bdeb4){_0x5dff0c=_0x5dff0c-0x0;var _0x15615f=_0x2b2d[_0x5dff0c];return _0x15615f;};'use strict';var multer=require(_0xd2b2('0x0'));var util=require('util');var path=require(_0xd2b2('0x1'));var timeout=require('connect-timeout');var express=require(_0xd2b2('0x2'));var router=express['Router']();var auth=require(_0xd2b2('0x3'));var interaction=require(_0xd2b2('0x4'));var config=require(_0xd2b2('0x5'));var controller=require('./intDeskField.controller');router['get']('/',auth[_0xd2b2('0x6')](),controller[_0xd2b2('0x7')]);router[_0xd2b2('0x8')](_0xd2b2('0x9'),auth[_0xd2b2('0x6')](),controller['show']);router['post']('/',auth[_0xd2b2('0x6')](),controller[_0xd2b2('0xa')]);router[_0xd2b2('0xb')](_0xd2b2('0x9'),auth['isAuthenticated'](),controller[_0xd2b2('0xc')]);router[_0xd2b2('0xd')]('/:id',auth[_0xd2b2('0x6')](),controller['destroy']);module[_0xd2b2('0xe')]=router; \ No newline at end of file +var _0x796b=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports'];(function(_0x14a944,_0x44e3d0){var _0x52323a=function(_0x5ca764){while(--_0x5ca764){_0x14a944['push'](_0x14a944['shift']());}};_0x52323a(++_0x44e3d0);}(_0x796b,0x144));var _0xb796=function(_0x12bcf7,_0xc11103){_0x12bcf7=_0x12bcf7-0x0;var _0x2825a=_0x796b[_0x12bcf7];return _0x2825a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb796('0x0'));var timeout=require(_0xb796('0x1'));var express=require(_0xb796('0x2'));var router=express[_0xb796('0x3')]();var auth=require(_0xb796('0x4'));var interaction=require(_0xb796('0x5'));var config=require(_0xb796('0x6'));var controller=require('./intDeskField.controller');router[_0xb796('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb796('0x7')](_0xb796('0x8'),auth[_0xb796('0x9')](),controller[_0xb796('0xa')]);router[_0xb796('0xb')]('/',auth[_0xb796('0x9')](),controller[_0xb796('0xc')]);router[_0xb796('0xd')](_0xb796('0x8'),auth[_0xb796('0x9')](),controller[_0xb796('0xe')]);router[_0xb796('0xf')](_0xb796('0x8'),auth['isAuthenticated'](),controller[_0xb796('0x10')]);module[_0xb796('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 8a14ff9..27bff59 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 _0x70f4=['string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','ENUM'];(function(_0x1d5d3f,_0x3a9d08){var _0x6f9221=function(_0x1e9b5d){while(--_0x1e9b5d){_0x1d5d3f['push'](_0x1d5d3f['shift']());}};_0x6f9221(++_0x3a9d08);}(_0x70f4,0x176));var _0x470f=function(_0x18307e,_0x1898e8){_0x18307e=_0x18307e-0x0;var _0x24186b=_0x70f4[_0x18307e];return _0x24186b;};'use strict';var Sequelize=require(_0x470f('0x0'));module['exports']={'type':{'type':Sequelize[_0x470f('0x1')](_0x470f('0x2'),_0x470f('0x3'),_0x470f('0x4'),_0x470f('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x470f('0x6')]},'key':{'type':Sequelize[_0x470f('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x470f('0x2'),_0x470f('0x3'),_0x470f('0x4'))},'keyContent':{'type':Sequelize[_0x470f('0x6')]},'idField':{'type':Sequelize[_0x470f('0x6')]},'nameField':{'type':Sequelize[_0x470f('0x6')]},'customField':{'type':Sequelize[_0x470f('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x470f('0x6')]}}; \ No newline at end of file +var _0x1f5e=['keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string','customVariable'];(function(_0x3ea544,_0x26a5e5){var _0x2f02a0=function(_0xea157d){while(--_0xea157d){_0x3ea544['push'](_0x3ea544['shift']());}};_0x2f02a0(++_0x26a5e5);}(_0x1f5e,0x73));var _0xe1f5=function(_0x19bac7,_0x7e97dd){_0x19bac7=_0x19bac7-0x0;var _0x251192=_0x1f5e[_0x19bac7];return _0x251192;};'use strict';var Sequelize=require(_0xe1f5('0x0'));module[_0xe1f5('0x1')]={'type':{'type':Sequelize[_0xe1f5('0x2')](_0xe1f5('0x3'),'variable',_0xe1f5('0x4'),_0xe1f5('0x5')),'defaultValue':_0xe1f5('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xe1f5('0x6')]},'keyType':{'type':Sequelize[_0xe1f5('0x2')]('string','variable',_0xe1f5('0x4'))},'keyContent':{'type':Sequelize[_0xe1f5('0x6')]},'idField':{'type':Sequelize[_0xe1f5('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xe1f5('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe1f5('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 8dcf5f8..745b6a2 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 _0xa990=['html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','set','apply','then','destroy','name','send','index','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','nolimit','where','pick','filter','merge','options','DeskField','count','includeAll','findAll','params','include','find','catch','create','body','update'];(function(_0x74c1ee,_0x533e4f){var _0x43f6dc=function(_0x16a0b2){while(--_0x16a0b2){_0x74c1ee['push'](_0x74c1ee['shift']());}};_0x43f6dc(++_0x533e4f);}(_0xa990,0xc9));var _0x0a99=function(_0x295ec2,_0x565c58){_0x295ec2=_0x295ec2-0x0;var _0x547e27=_0xa990[_0x295ec2];return _0x547e27;};'use strict';var pdf=require(_0x0a99('0x0'));var emlformat=require(_0x0a99('0x1'));var rimraf=require(_0x0a99('0x2'));var zipdir=require(_0x0a99('0x3'));var jsonpatch=require(_0x0a99('0x4'));var rp=require(_0x0a99('0x5'));var moment=require(_0x0a99('0x6'));var BPromise=require(_0x0a99('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0a99('0x8'));var sox=require(_0x0a99('0x9'));var csv=require(_0x0a99('0xa'));var ejs=require(_0x0a99('0xb'));var fs=require('fs');var _=require(_0x0a99('0xc'));var squel=require(_0x0a99('0xd'));var crypto=require(_0x0a99('0xe'));var jsforce=require(_0x0a99('0xf'));var deskjs=require(_0x0a99('0x10'));var toCsv=require(_0x0a99('0xa'));var querystring=require(_0x0a99('0x11'));var Papa=require('papaparse');var Redis=require(_0x0a99('0x12'));var authService=require(_0x0a99('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0a99('0x14'));var logger=require(_0x0a99('0x15'))(_0x0a99('0x16'));var utils=require(_0x0a99('0x17'));var config=require(_0x0a99('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xbb3980,_0x3aaaad){_0x3aaaad=_0x3aaaad||0xcc;return function(_0x57ab88){if(_0x57ab88){return _0xbb3980[_0x0a99('0x19')](_0x3aaaad);}return _0xbb3980[_0x0a99('0x1a')](_0x3aaaad)[_0x0a99('0x1b')]();};}function respondWithResult(_0x2bbf1a,_0x346061){_0x346061=_0x346061||0xc8;return function(_0x23d018){if(_0x23d018){return _0x2bbf1a[_0x0a99('0x1a')](_0x346061)[_0x0a99('0x1c')](_0x23d018);}};}function respondWithFilteredResult(_0x4b6946,_0x5a17e1){return function(_0x2c40db){if(_0x2c40db){var _0x3ac17e=_0x2c40db['count'],_0xb7356c=_0x5a17e1['offset'],_0x49653c=_0x5a17e1[_0x0a99('0x1d')]+_0x5a17e1[_0x0a99('0x1e')],_0x3483a7;if(_0x49653c>=_0x3ac17e){_0x49653c=_0x3ac17e;_0x3483a7=0xc8;}else{_0x3483a7=0xce;}_0x4b6946[_0x0a99('0x1a')](_0x3483a7);return _0x4b6946[_0x0a99('0x1f')]('Content-Range',_0xb7356c+'-'+_0x49653c+'/'+_0x3ac17e)['json'](_0x2c40db);}return null;};}function patchUpdates(_0x27a14f){return function(_0x13df0b){try{jsonpatch[_0x0a99('0x20')](_0x13df0b,_0x27a14f,!![]);}catch(_0x416d32){return BPromise['reject'](_0x416d32);}return _0x13df0b['save']();};}function saveUpdates(_0x1b0279,_0x4d0c78){return function(_0x1e8d30){if(_0x1e8d30){return _0x1e8d30['update'](_0x1b0279)[_0x0a99('0x21')](function(_0x59da66){return _0x59da66;});}return null;};}function removeEntity(_0x1b8324,_0x356681){return function(_0x3b1d60){if(_0x3b1d60){return _0x3b1d60[_0x0a99('0x22')]()[_0x0a99('0x21')](function(){_0x1b8324[_0x0a99('0x1a')](0xcc)[_0x0a99('0x1b')]();});}};}function handleEntityNotFound(_0x1d803c,_0x398dd2){return function(_0x5745ca){if(!_0x5745ca){_0x1d803c['sendStatus'](0x194);}return _0x5745ca;};}function handleError(_0x463e02,_0xcd088){_0xcd088=_0xcd088||0x1f4;return function(_0x5cbf1f){logger['error'](_0x5cbf1f['stack']);if(_0x5cbf1f[_0x0a99('0x23')]){delete _0x5cbf1f[_0x0a99('0x23')];}_0x463e02[_0x0a99('0x1a')](_0xcd088)[_0x0a99('0x24')](_0x5cbf1f);};}exports[_0x0a99('0x25')]=function(_0x3fd406,_0x25b4c0){var _0x2f104a={},_0x163031={},_0x5722f9={'count':0x0,'rows':[]};var _0x411233=_['map'](db['DeskField']['rawAttributes'],function(_0x223bdb){return{'name':_0x223bdb[_0x0a99('0x26')],'type':_0x223bdb[_0x0a99('0x27')][_0x0a99('0x28')]};});_0x163031[_0x0a99('0x29')]=_[_0x0a99('0x2a')](_0x411233,_0x0a99('0x23'));_0x163031['query']=_[_0x0a99('0x2b')](_0x3fd406[_0x0a99('0x2c')]);_0x163031[_0x0a99('0x2d')]=_[_0x0a99('0x2e')](_0x163031['model'],_0x163031['query']);_0x2f104a['attributes']=_[_0x0a99('0x2e')](_0x163031[_0x0a99('0x29')],qs[_0x0a99('0x2f')](_0x3fd406['query'][_0x0a99('0x2f')]));_0x2f104a[_0x0a99('0x30')]=_0x2f104a[_0x0a99('0x30')][_0x0a99('0x31')]?_0x2f104a[_0x0a99('0x30')]:_0x163031[_0x0a99('0x29')];if(!_0x3fd406[_0x0a99('0x2c')]['hasOwnProperty'](_0x0a99('0x32'))){_0x2f104a[_0x0a99('0x1e')]=qs[_0x0a99('0x1e')](_0x3fd406[_0x0a99('0x2c')][_0x0a99('0x1e')]);_0x2f104a['offset']=qs[_0x0a99('0x1d')](_0x3fd406['query']['offset']);}_0x2f104a['order']=qs['sort'](_0x3fd406[_0x0a99('0x2c')]['sort']);_0x2f104a[_0x0a99('0x33')]=qs[_0x0a99('0x2d')](_[_0x0a99('0x34')](_0x3fd406[_0x0a99('0x2c')],_0x163031[_0x0a99('0x2d')]));if(_0x3fd406[_0x0a99('0x2c')][_0x0a99('0x35')]){_0x2f104a[_0x0a99('0x33')]=_[_0x0a99('0x36')](_0x2f104a[_0x0a99('0x33')],{'$or':_[_0x0a99('0x2a')](_0x411233,function(_0x3a2a78){if(_0x3a2a78[_0x0a99('0x27')]!=='VIRTUAL'){var _0x34f122={};_0x34f122[_0x3a2a78[_0x0a99('0x23')]]={'$like':'%'+_0x3fd406['query'][_0x0a99('0x35')]+'%'};return _0x34f122;}})});}_0x2f104a=_['merge']({},_0x2f104a,_0x3fd406[_0x0a99('0x37')]);var _0x563fbc={'where':_0x2f104a[_0x0a99('0x33')]};return db[_0x0a99('0x38')][_0x0a99('0x39')](_0x563fbc)[_0x0a99('0x21')](function(_0x4a5c58){_0x5722f9[_0x0a99('0x39')]=_0x4a5c58;if(_0x3fd406[_0x0a99('0x2c')][_0x0a99('0x3a')]){_0x2f104a['include']=[{'all':!![]}];}return db[_0x0a99('0x38')][_0x0a99('0x3b')](_0x2f104a);})[_0x0a99('0x21')](function(_0x1abeb0){_0x5722f9['rows']=_0x1abeb0;return _0x5722f9;})[_0x0a99('0x21')](respondWithFilteredResult(_0x25b4c0,_0x2f104a))['catch'](handleError(_0x25b4c0,null));};exports['show']=function(_0x12b942,_0x4b0be6){var _0x185495={'raw':!![],'where':{'id':_0x12b942[_0x0a99('0x3c')]['id']}},_0x583dca={};_0x583dca[_0x0a99('0x29')]=_[_0x0a99('0x2b')](db[_0x0a99('0x38')]['rawAttributes']);_0x583dca[_0x0a99('0x2c')]=_[_0x0a99('0x2b')](_0x12b942[_0x0a99('0x2c')]);_0x583dca[_0x0a99('0x2d')]=_['intersection'](_0x583dca['model'],_0x583dca['query']);_0x185495[_0x0a99('0x30')]=_['intersection'](_0x583dca[_0x0a99('0x29')],qs['fields'](_0x12b942['query']['fields']));_0x185495['attributes']=_0x185495[_0x0a99('0x30')]['length']?_0x185495[_0x0a99('0x30')]:_0x583dca[_0x0a99('0x29')];if(_0x12b942['query'][_0x0a99('0x3a')]){_0x185495[_0x0a99('0x3d')]=[{'all':!![]}];}_0x185495=_['merge']({},_0x185495,_0x12b942[_0x0a99('0x37')]);return db['DeskField'][_0x0a99('0x3e')](_0x185495)[_0x0a99('0x21')](handleEntityNotFound(_0x4b0be6,null))['then'](respondWithResult(_0x4b0be6,null))[_0x0a99('0x3f')](handleError(_0x4b0be6,null));};exports['create']=function(_0x5f1980,_0x2ae47c){return db[_0x0a99('0x38')][_0x0a99('0x40')](_0x5f1980[_0x0a99('0x41')],{})[_0x0a99('0x21')](respondWithResult(_0x2ae47c,0xc9))['catch'](handleError(_0x2ae47c,null));};exports[_0x0a99('0x42')]=function(_0x174298,_0x4525d1){if(_0x174298[_0x0a99('0x41')]['id']){delete _0x174298[_0x0a99('0x41')]['id'];}return db[_0x0a99('0x38')][_0x0a99('0x3e')]({'where':{'id':_0x174298[_0x0a99('0x3c')]['id']}})[_0x0a99('0x21')](handleEntityNotFound(_0x4525d1,null))[_0x0a99('0x21')](saveUpdates(_0x174298['body'],null))['then'](respondWithResult(_0x4525d1,null))[_0x0a99('0x3f')](handleError(_0x4525d1,null));};exports[_0x0a99('0x22')]=function(_0x74d2f3,_0x14fdd2){return db[_0x0a99('0x38')][_0x0a99('0x3e')]({'where':{'id':_0x74d2f3['params']['id']}})[_0x0a99('0x21')](handleEntityNotFound(_0x14fdd2,null))[_0x0a99('0x21')](removeEntity(_0x14fdd2,null))['catch'](handleError(_0x14fdd2,null));}; \ No newline at end of file +var _0x8664=['to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','end','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','options','where','findAll','rows','show','include','merge','catch','body','find','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path'];(function(_0x44dd72,_0x3c707c){var _0x2234d1=function(_0x11371e){while(--_0x11371e){_0x44dd72['push'](_0x44dd72['shift']());}};_0x2234d1(++_0x3c707c);}(_0x8664,0x11a));var _0x4866=function(_0x3cd335,_0x128c0c){_0x3cd335=_0x3cd335-0x0;var _0x4130ce=_0x8664[_0x3cd335];return _0x4130ce;};'use strict';var pdf=require(_0x4866('0x0'));var emlformat=require(_0x4866('0x1'));var rimraf=require(_0x4866('0x2'));var zipdir=require(_0x4866('0x3'));var jsonpatch=require(_0x4866('0x4'));var rp=require(_0x4866('0x5'));var moment=require(_0x4866('0x6'));var BPromise=require(_0x4866('0x7'));var Mustache=require(_0x4866('0x8'));var util=require('util');var path=require(_0x4866('0x9'));var sox=require('sox');var csv=require(_0x4866('0xa'));var ejs=require(_0x4866('0xb'));var fs=require('fs');var _=require(_0x4866('0xc'));var squel=require(_0x4866('0xd'));var crypto=require(_0x4866('0xe'));var jsforce=require(_0x4866('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x4866('0xa'));var querystring=require(_0x4866('0x10'));var Papa=require(_0x4866('0x11'));var Redis=require(_0x4866('0x12'));var authService=require(_0x4866('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x4866('0x14'));var hardwareService=require(_0x4866('0x15'));var logger=require('../../config/logger')(_0x4866('0x16'));var utils=require(_0x4866('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47a50e,_0x73fdc6){_0x73fdc6=_0x73fdc6||0xcc;return function(_0x10f64d){if(_0x10f64d){return _0x47a50e[_0x4866('0x18')](_0x73fdc6);}return _0x47a50e[_0x4866('0x19')](_0x73fdc6)[_0x4866('0x1a')]();};}function respondWithResult(_0x36aa92,_0x4ec00d){_0x4ec00d=_0x4ec00d||0xc8;return function(_0x92e62e){if(_0x92e62e){return _0x36aa92[_0x4866('0x19')](_0x4ec00d)['json'](_0x92e62e);}};}function respondWithFilteredResult(_0x3d7bda,_0x348996){return function(_0x3f8f56){if(_0x3f8f56){var _0x108950=_0x3f8f56[_0x4866('0x1b')],_0x16b7ff=_0x348996[_0x4866('0x1c')],_0x3bd260=_0x348996['offset']+_0x348996['limit'],_0x373888;if(_0x3bd260>=_0x108950){_0x3bd260=_0x108950;_0x373888=0xc8;}else{_0x373888=0xce;}_0x3d7bda[_0x4866('0x19')](_0x373888);return _0x3d7bda[_0x4866('0x1d')](_0x4866('0x1e'),_0x16b7ff+'-'+_0x3bd260+'/'+_0x108950)['json'](_0x3f8f56);}return null;};}function patchUpdates(_0x49f816){return function(_0x2a95b4){try{jsonpatch[_0x4866('0x1f')](_0x2a95b4,_0x49f816,!![]);}catch(_0x4b0126){return BPromise[_0x4866('0x20')](_0x4b0126);}return _0x2a95b4['save']();};}function saveUpdates(_0x33cbf3,_0x579621){return function(_0x76e72d){if(_0x76e72d){return _0x76e72d[_0x4866('0x21')](_0x33cbf3)[_0x4866('0x22')](function(_0x364ef8){return _0x364ef8;});}return null;};}function removeEntity(_0x382b14,_0x5a8e01){return function(_0x5d1401){if(_0x5d1401){return _0x5d1401[_0x4866('0x23')]()[_0x4866('0x22')](function(){_0x382b14[_0x4866('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43f3a6,_0x4d3da4){return function(_0x4a16d1){if(!_0x4a16d1){_0x43f3a6[_0x4866('0x18')](0x194);}return _0x4a16d1;};}function handleError(_0x33cae1,_0x5f0811){_0x5f0811=_0x5f0811||0x1f4;return function(_0x16c1ca){logger[_0x4866('0x24')](_0x16c1ca[_0x4866('0x25')]);if(_0x16c1ca[_0x4866('0x26')]){delete _0x16c1ca[_0x4866('0x26')];}_0x33cae1[_0x4866('0x19')](_0x5f0811)[_0x4866('0x27')](_0x16c1ca);};}exports[_0x4866('0x28')]=function(_0x43c4e2,_0x2a6389){var _0x278471={},_0x58f5f4={},_0xaedc67={'count':0x0,'rows':[]};var _0x3f8632=_[_0x4866('0x29')](db[_0x4866('0x2a')][_0x4866('0x2b')],function(_0xd32f19){return{'name':_0xd32f19[_0x4866('0x2c')],'type':_0xd32f19[_0x4866('0x2d')][_0x4866('0x2e')]};});_0x58f5f4[_0x4866('0x2f')]=_[_0x4866('0x29')](_0x3f8632,_0x4866('0x26'));_0x58f5f4[_0x4866('0x30')]=_[_0x4866('0x31')](_0x43c4e2[_0x4866('0x30')]);_0x58f5f4[_0x4866('0x32')]=_[_0x4866('0x33')](_0x58f5f4[_0x4866('0x2f')],_0x58f5f4[_0x4866('0x30')]);_0x278471[_0x4866('0x34')]=_[_0x4866('0x33')](_0x58f5f4[_0x4866('0x2f')],qs['fields'](_0x43c4e2['query'][_0x4866('0x35')]));_0x278471[_0x4866('0x34')]=_0x278471[_0x4866('0x34')][_0x4866('0x36')]?_0x278471[_0x4866('0x34')]:_0x58f5f4['model'];if(!_0x43c4e2[_0x4866('0x30')][_0x4866('0x37')](_0x4866('0x38'))){_0x278471[_0x4866('0x39')]=qs[_0x4866('0x39')](_0x43c4e2['query'][_0x4866('0x39')]);_0x278471[_0x4866('0x1c')]=qs[_0x4866('0x1c')](_0x43c4e2[_0x4866('0x30')][_0x4866('0x1c')]);}_0x278471[_0x4866('0x3a')]=qs[_0x4866('0x3b')](_0x43c4e2[_0x4866('0x30')][_0x4866('0x3b')]);_0x278471['where']=qs[_0x4866('0x32')](_[_0x4866('0x3c')](_0x43c4e2['query'],_0x58f5f4[_0x4866('0x32')]));if(_0x43c4e2[_0x4866('0x30')]['filter']){_0x278471['where']=_['merge'](_0x278471['where'],{'$or':_[_0x4866('0x29')](_0x3f8632,function(_0x46d1bf){if(_0x46d1bf['type']!=='VIRTUAL'){var _0x4fbe06={};_0x4fbe06[_0x46d1bf[_0x4866('0x26')]]={'$like':'%'+_0x43c4e2['query'][_0x4866('0x3d')]+'%'};return _0x4fbe06;}})});}_0x278471=_['merge']({},_0x278471,_0x43c4e2[_0x4866('0x3e')]);var _0x5e3de6={'where':_0x278471[_0x4866('0x3f')]};return db[_0x4866('0x2a')][_0x4866('0x1b')](_0x5e3de6)[_0x4866('0x22')](function(_0x441348){_0xaedc67[_0x4866('0x1b')]=_0x441348;if(_0x43c4e2[_0x4866('0x30')]['includeAll']){_0x278471['include']=[{'all':!![]}];}return db[_0x4866('0x2a')][_0x4866('0x40')](_0x278471);})[_0x4866('0x22')](function(_0x2ae265){_0xaedc67[_0x4866('0x41')]=_0x2ae265;return _0xaedc67;})[_0x4866('0x22')](respondWithFilteredResult(_0x2a6389,_0x278471))['catch'](handleError(_0x2a6389,null));};exports[_0x4866('0x42')]=function(_0x372804,_0x559cda){var _0x513276={'raw':!![],'where':{'id':_0x372804['params']['id']}},_0x4a8f1a={};_0x4a8f1a[_0x4866('0x2f')]=_[_0x4866('0x31')](db[_0x4866('0x2a')][_0x4866('0x2b')]);_0x4a8f1a['query']=_[_0x4866('0x31')](_0x372804[_0x4866('0x30')]);_0x4a8f1a[_0x4866('0x32')]=_[_0x4866('0x33')](_0x4a8f1a[_0x4866('0x2f')],_0x4a8f1a[_0x4866('0x30')]);_0x513276['attributes']=_[_0x4866('0x33')](_0x4a8f1a[_0x4866('0x2f')],qs[_0x4866('0x35')](_0x372804[_0x4866('0x30')][_0x4866('0x35')]));_0x513276[_0x4866('0x34')]=_0x513276[_0x4866('0x34')]['length']?_0x513276[_0x4866('0x34')]:_0x4a8f1a['model'];if(_0x372804[_0x4866('0x30')]['includeAll']){_0x513276[_0x4866('0x43')]=[{'all':!![]}];}_0x513276=_[_0x4866('0x44')]({},_0x513276,_0x372804[_0x4866('0x3e')]);return db[_0x4866('0x2a')]['find'](_0x513276)[_0x4866('0x22')](handleEntityNotFound(_0x559cda,null))[_0x4866('0x22')](respondWithResult(_0x559cda,null))[_0x4866('0x45')](handleError(_0x559cda,null));};exports['create']=function(_0xc735e0,_0x1114e7){return db[_0x4866('0x2a')]['create'](_0xc735e0[_0x4866('0x46')],{})[_0x4866('0x22')](respondWithResult(_0x1114e7,0xc9))[_0x4866('0x45')](handleError(_0x1114e7,null));};exports['update']=function(_0xef8fe0,_0x29c1a1){if(_0xef8fe0[_0x4866('0x46')]['id']){delete _0xef8fe0[_0x4866('0x46')]['id'];}return db[_0x4866('0x2a')][_0x4866('0x47')]({'where':{'id':_0xef8fe0[_0x4866('0x48')]['id']}})[_0x4866('0x22')](handleEntityNotFound(_0x29c1a1,null))['then'](saveUpdates(_0xef8fe0[_0x4866('0x46')],null))['then'](respondWithResult(_0x29c1a1,null))['catch'](handleError(_0x29c1a1,null));};exports[_0x4866('0x23')]=function(_0x2ffb10,_0x4608d8){return db['DeskField'][_0x4866('0x47')]({'where':{'id':_0x2ffb10[_0x4866('0x48')]['id']}})[_0x4866('0x22')](handleEntityNotFound(_0x4608d8,null))['then'](removeEntity(_0x4608d8,null))[_0x4866('0x45')](handleError(_0x4608d8,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 6f407f4..59e5f49 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 _0xf427=['../../config/environment','./intDeskField.attributes','exports','DeskField','int_desk_fields','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x2c091e,_0x332206){var _0x29c0e5=function(_0x369398){while(--_0x369398){_0x2c091e['push'](_0x2c091e['shift']());}};_0x29c0e5(++_0x332206);}(_0xf427,0x115));var _0x7f42=function(_0x5f6780,_0xee810b){_0x5f6780=_0x5f6780-0x0;var _0xff129c=_0xf427[_0x5f6780];return _0xff129c;};'use strict';var _=require(_0x7f42('0x0'));var util=require(_0x7f42('0x1'));var logger=require(_0x7f42('0x2'))('api');var moment=require(_0x7f42('0x3'));var BPromise=require(_0x7f42('0x4'));var rp=require(_0x7f42('0x5'));var fs=require('fs');var path=require(_0x7f42('0x6'));var rimraf=require(_0x7f42('0x7'));var config=require(_0x7f42('0x8'));var attributes=require(_0x7f42('0x9'));module[_0x7f42('0xa')]=function(_0x20d026,_0x3995a6){return _0x20d026['define'](_0x7f42('0xb'),attributes,{'tableName':_0x7f42('0xc'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x7f42('0xd'),_0x7f42('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x74ea=['lodash','../../config/logger','bluebird','request-promise','path','../../config/environment','./intDeskField.attributes','int_desk_fields','desk_unique_index','idField'];(function(_0x33d4a2,_0x2baaf4){var _0x2c793f=function(_0x414303){while(--_0x414303){_0x33d4a2['push'](_0x33d4a2['shift']());}};_0x2c793f(++_0x2baaf4);}(_0x74ea,0x96));var _0xa74e=function(_0x572094,_0x3b41c3){_0x572094=_0x572094-0x0;var _0x175b43=_0x74ea[_0x572094];return _0x175b43;};'use strict';var _=require(_0xa74e('0x0'));var util=require('util');var logger=require(_0xa74e('0x1'))('api');var moment=require('moment');var BPromise=require(_0xa74e('0x2'));var rp=require(_0xa74e('0x3'));var fs=require('fs');var path=require(_0xa74e('0x4'));var rimraf=require('rimraf');var config=require(_0xa74e('0x5'));var attributes=require(_0xa74e('0x6'));module['exports']=function(_0x1f4c49,_0x1e5557){return _0x1f4c49['define']('DeskField',attributes,{'tableName':_0xa74e('0x7'),'paranoid':![],'indexes':[{'name':_0xa74e('0x8'),'fields':[_0xa74e('0x9'),'FieldId'],'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 bcef513..75556c0 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 _0xc6a6=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5b07ab,_0x157042){var _0x8c0d25=function(_0x378e64){while(--_0x378e64){_0x5b07ab['push'](_0x5b07ab['shift']());}};_0x8c0d25(++_0x157042);}(_0xc6a6,0xab));var _0x6c6a=function(_0x12abd3,_0x45c120){_0x12abd3=_0x12abd3-0x0;var _0x210643=_0xc6a6[_0x12abd3];return _0x210643;};'use strict';var _=require(_0x6c6a('0x0'));var util=require(_0x6c6a('0x1'));var moment=require(_0x6c6a('0x2'));var BPromise=require(_0x6c6a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6c6a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6c6a('0x5'));var logger=require(_0x6c6a('0x6'))('rpc');var config=require(_0x6c6a('0x7'));var jayson=require(_0x6c6a('0x8'));var client=jayson[_0x6c6a('0x9')][_0x6c6a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11ab06,_0x495a75,_0x2f66a9){return new BPromise(function(_0x4a36a7,_0x38fa2b){return client[_0x6c6a('0xb')](_0x11ab06,_0x2f66a9)[_0x6c6a('0xc')](function(_0x3d86e2){logger[_0x6c6a('0xd')](_0x6c6a('0xe'),_0x495a75,_0x6c6a('0xf'));logger[_0x6c6a('0x10')](_0x6c6a('0x11'),_0x495a75,_0x6c6a('0xf'),JSON[_0x6c6a('0x12')](_0x3d86e2));if(_0x3d86e2[_0x6c6a('0x13')]){if(_0x3d86e2[_0x6c6a('0x13')][_0x6c6a('0x14')]===0x1f4){logger[_0x6c6a('0x13')](_0x6c6a('0xe'),_0x495a75,_0x3d86e2[_0x6c6a('0x13')][_0x6c6a('0x15')]);return _0x38fa2b(_0x3d86e2[_0x6c6a('0x13')][_0x6c6a('0x15')]);}logger['error'](_0x6c6a('0xe'),_0x495a75,_0x3d86e2[_0x6c6a('0x13')]['message']);return _0x4a36a7(_0x3d86e2[_0x6c6a('0x13')][_0x6c6a('0x15')]);}else{logger['info']('DeskField,\x20%s,\x20%s',_0x495a75,_0x6c6a('0xf'));_0x4a36a7(_0x3d86e2[_0x6c6a('0x16')]['message']);}})[_0x6c6a('0x17')](function(_0x4c7087){logger[_0x6c6a('0x13')]('DeskField,\x20%s,\x20%s',_0x495a75,_0x4c7087);_0x38fa2b(_0x4c7087);});});} \ No newline at end of file +var _0xa723=['debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent'];(function(_0x3c6b7d,_0x5f0d90){var _0x1d3ed2=function(_0x1a8f35){while(--_0x1a8f35){_0x3c6b7d['push'](_0x3c6b7d['shift']());}};_0x1d3ed2(++_0x5f0d90);}(_0xa723,0x1a6));var _0x3a72=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xa723[_0x2ec461];return _0x28603d;};'use strict';var _=require(_0x3a72('0x0'));var util=require(_0x3a72('0x1'));var moment=require(_0x3a72('0x2'));var BPromise=require(_0x3a72('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3a72('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3a72('0x5'));var logger=require('../../config/logger')(_0x3a72('0x6'));var config=require(_0x3a72('0x7'));var jayson=require(_0x3a72('0x8'));var client=jayson['client'][_0x3a72('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a7392,_0x1f6581,_0x7e4048){return new BPromise(function(_0x207bd7,_0x343e1c){return client[_0x3a72('0xa')](_0x2a7392,_0x7e4048)[_0x3a72('0xb')](function(_0x38342b){logger[_0x3a72('0xc')](_0x3a72('0xd'),_0x1f6581,_0x3a72('0xe'));logger[_0x3a72('0xf')](_0x3a72('0x10'),_0x1f6581,_0x3a72('0xe'),JSON[_0x3a72('0x11')](_0x38342b));if(_0x38342b[_0x3a72('0x12')]){if(_0x38342b[_0x3a72('0x12')][_0x3a72('0x13')]===0x1f4){logger[_0x3a72('0x12')](_0x3a72('0xd'),_0x1f6581,_0x38342b['error'][_0x3a72('0x14')]);return _0x343e1c(_0x38342b['error'][_0x3a72('0x14')]);}logger[_0x3a72('0x12')]('DeskField,\x20%s,\x20%s',_0x1f6581,_0x38342b[_0x3a72('0x12')][_0x3a72('0x14')]);return _0x207bd7(_0x38342b[_0x3a72('0x12')][_0x3a72('0x14')]);}else{logger[_0x3a72('0xc')]('DeskField,\x20%s,\x20%s',_0x1f6581,_0x3a72('0xe'));_0x207bd7(_0x38342b[_0x3a72('0x15')][_0x3a72('0x14')]);}})[_0x3a72('0x16')](function(_0x14706f){logger[_0x3a72('0x12')]('DeskField,\x20%s,\x20%s',_0x1f6581,_0x14706f);_0x343e1c(_0x14706f);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 0cb0b51..6057207 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 _0x3f31=['/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','show'];(function(_0x5ca8df,_0x3abfd5){var _0x9ae030=function(_0x37c940){while(--_0x37c940){_0x5ca8df['push'](_0x5ca8df['shift']());}};_0x9ae030(++_0x3abfd5);}(_0x3f31,0x154));var _0x13f3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3f31[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x13f3('0x0'));var util=require(_0x13f3('0x1'));var path=require('path');var timeout=require(_0x13f3('0x2'));var express=require(_0x13f3('0x3'));var router=express['Router']();var auth=require(_0x13f3('0x4'));var interaction=require(_0x13f3('0x5'));var config=require(_0x13f3('0x6'));var controller=require(_0x13f3('0x7'));router[_0x13f3('0x8')]('/',auth[_0x13f3('0x9')](),controller[_0x13f3('0xa')]);router[_0x13f3('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x13f3('0xb')]);router[_0x13f3('0x8')](_0x13f3('0xc'),auth[_0x13f3('0x9')](),controller['getConfigurations']);router[_0x13f3('0x8')](_0x13f3('0xd'),auth['isAuthenticated'](),controller[_0x13f3('0xe')]);router[_0x13f3('0xf')]('/',auth[_0x13f3('0x9')](),controller[_0x13f3('0x10')]);router[_0x13f3('0xf')](_0x13f3('0xc'),auth[_0x13f3('0x9')](),controller[_0x13f3('0x11')]);router[_0x13f3('0x12')](_0x13f3('0x13'),auth['isAuthenticated'](),controller[_0x13f3('0x14')]);router['delete']('/:id',auth[_0x13f3('0x9')](),controller['destroy']);module[_0x13f3('0x15')]=router; \ No newline at end of file +var _0x603c=['/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show'];(function(_0x1a7e45,_0x7f2bdd){var _0x145834=function(_0x41771b){while(--_0x41771b){_0x1a7e45['push'](_0x1a7e45['shift']());}};_0x145834(++_0x7f2bdd);}(_0x603c,0x182));var _0xc603=function(_0x1ea6eb,_0x33d3d4){_0x1ea6eb=_0x1ea6eb-0x0;var _0x127200=_0x603c[_0x1ea6eb];return _0x127200;};'use strict';var multer=require(_0xc603('0x0'));var util=require(_0xc603('0x1'));var path=require(_0xc603('0x2'));var timeout=require('connect-timeout');var express=require(_0xc603('0x3'));var router=express[_0xc603('0x4')]();var auth=require(_0xc603('0x5'));var interaction=require(_0xc603('0x6'));var config=require(_0xc603('0x7'));var controller=require(_0xc603('0x8'));router[_0xc603('0x9')]('/',auth[_0xc603('0xa')](),controller[_0xc603('0xb')]);router[_0xc603('0x9')](_0xc603('0xc'),auth[_0xc603('0xa')](),controller[_0xc603('0xd')]);router[_0xc603('0x9')](_0xc603('0xe'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xc603('0x9')](_0xc603('0xf'),auth[_0xc603('0xa')](),controller[_0xc603('0x10')]);router[_0xc603('0x11')]('/',auth['isAuthenticated'](),controller[_0xc603('0x12')]);router[_0xc603('0x11')](_0xc603('0xe'),auth[_0xc603('0xa')](),controller[_0xc603('0x13')]);router[_0xc603('0x14')](_0xc603('0xc'),auth[_0xc603('0xa')](),controller[_0xc603('0x15')]);router[_0xc603('0x16')](_0xc603('0xc'),auth[_0xc603('0xa')](),controller[_0xc603('0x17')]);module[_0xc603('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index cf1f14b..0423b07 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 _0x839d=['sequelize','exports','STRING'];(function(_0x331c17,_0x5ceeb4){var _0xd58915=function(_0x1def85){while(--_0x1def85){_0x331c17['push'](_0x331c17['shift']());}};_0xd58915(++_0x5ceeb4);}(_0x839d,0xb7));var _0xd839=function(_0xea9eaf,_0x15f682){_0xea9eaf=_0xea9eaf-0x0;var _0x5f2e12=_0x839d[_0xea9eaf];return _0x5f2e12;};'use strict';var Sequelize=require(_0xd839('0x0'));module[_0xd839('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xd839('0x2')]},'password':{'type':Sequelize[_0xd839('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0xd839('0x2')]},'clientId':{'type':Sequelize[_0xd839('0x2')]},'clientSecret':{'type':Sequelize[_0xd839('0x2')]},'serverUrl':{'type':Sequelize[_0xd839('0x2')]},'description':{'type':Sequelize[_0xd839('0x2')]}}; \ No newline at end of file +var _0xfc30=['STRING','sequelize','exports'];(function(_0x1ddabb,_0x5a2cd4){var _0xf76d8d=function(_0x57b970){while(--_0x57b970){_0x1ddabb['push'](_0x1ddabb['shift']());}};_0xf76d8d(++_0x5a2cd4);}(_0xfc30,0x94));var _0x0fc3=function(_0x434ab9,_0x2c3eef){_0x434ab9=_0x434ab9-0x0;var _0x2ca0d9=_0xfc30[_0x434ab9];return _0x2ca0d9;};'use strict';var Sequelize=require(_0x0fc3('0x0'));module[_0x0fc3('0x1')]={'name':{'type':Sequelize[_0x0fc3('0x2')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x0fc3('0x2')]},'remoteUri':{'type':Sequelize[_0x0fc3('0x2')]},'tenantId':{'type':Sequelize[_0x0fc3('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x0fc3('0x2')]},'serverUrl':{'type':Sequelize[_0x0fc3('0x2')]},'description':{'type':Sequelize[_0x0fc3('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 40a1f1d..12cb2af 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 _0xb770=['customeridname','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','escalatedon','exchangerate','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyyominame','modifiedon','msdyn_incidenttypename','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','primarycontactidname','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','slaname','socialprofileidname','statecode','subjectidname','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','concat','username','password','tenantId','clientId','clientSecret','remoteUri','substring','lastIndexOf','format','%s/api/data/v9.0/','https://login.microsoftonline.com/','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','MetadataId','EntityDefinitions(','4.0','Attributes','includes','forEach','@odata.type','PicklistAttributeMetadata','isNil','BooleanAttributeMetadata','push','all','StringAttributeMetadata','DoubleAttributeMetadata','MemoAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','UserLocalizedLabel','Value','LogicalName','DisplayName','Label',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','true','FalseOption',')/Microsoft.Dynamics.CRM.','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../components/integrations/configuration','jayson/promise','client','http','test','request','then','info','request\x20sent','debug','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','destroy','stack','name','send','map','key','query','intersection','model','attributes','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','Dynamics365Account','findAll','rows','show','rawAttributes','keys','fields','include','find','create','catch','body','params','getConfigurations','findOne','Dynamics365Configuration','filter','length','nolimit','Subjects','getSubjects','Descriptions','getDescriptions','type','Dynamics365Field','getFields','ticketType','incident','Incident','PhoneCall','title','description','caseorigincode','subject','regardingobjectid','phonecall_activity_parties','accountidyominame','actualserviceunits','billedserviceunits','contactidyominame','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame'];(function(_0x24fff3,_0x5af505){var _0xe1d410=function(_0x1722af){while(--_0x1722af){_0x24fff3['push'](_0x24fff3['shift']());}};_0xe1d410(++_0x5af505);}(_0xb770,0x1e2));var _0x0b77=function(_0x2a02d6,_0x3c10d){_0x2a02d6=_0x2a02d6-0x0;var _0x1a6a2f=_0xb770[_0x2a02d6];return _0x1a6a2f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0b77('0x0'));var rimraf=require(_0x0b77('0x1'));var zipdir=require(_0x0b77('0x2'));var jsonpatch=require(_0x0b77('0x3'));var rp=require(_0x0b77('0x4'));var moment=require(_0x0b77('0x5'));var BPromise=require(_0x0b77('0x6'));var Mustache=require(_0x0b77('0x7'));var util=require(_0x0b77('0x8'));var path=require(_0x0b77('0x9'));var sox=require(_0x0b77('0xa'));var csv=require(_0x0b77('0xb'));var ejs=require(_0x0b77('0xc'));var fs=require('fs');var _=require(_0x0b77('0xd'));var squel=require(_0x0b77('0xe'));var crypto=require('crypto');var jsforce=require(_0x0b77('0xf'));var deskjs=require(_0x0b77('0x10'));var toCsv=require(_0x0b77('0xb'));var querystring=require(_0x0b77('0x11'));var Papa=require(_0x0b77('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0b77('0x13'));var as=require(_0x0b77('0x14'));var hardwareService=require(_0x0b77('0x15'));var logger=require(_0x0b77('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x0b77('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x0b77('0x18'));var jayson=require(_0x0b77('0x19'));var client=jayson[_0x0b77('0x1a')][_0x0b77('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x5c9055,_0x319664,_0x183ea8){if(_0x183ea8){var _0x140a6b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x140a6b[_0x0b77('0x1c')](_0x319664)){return _0x5c9055;}else{throw new db['Sequelize']['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x5c9055;}}function respondWithRpcPromise(_0x2314b9,_0x4d909c,_0x19242b,_0x319b04){return new BPromise(function(_0x29699b,_0x51c4d8){var _0x4265e9=_0x319b04||client;return _0x4265e9[_0x0b77('0x1d')](_0x2314b9,_0x19242b)[_0x0b77('0x1e')](function(_0x2a920b){logger[_0x0b77('0x1f')]('Dynamics365Account,\x20%s,\x20%s',_0x4d909c,_0x0b77('0x20'));logger[_0x0b77('0x21')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x4d909c,'request\x20sent',JSON[_0x0b77('0x22')](_0x2a920b));if(_0x2a920b[_0x0b77('0x23')]){if(_0x2a920b[_0x0b77('0x23')][_0x0b77('0x24')]===0x1f4){logger[_0x0b77('0x23')]('Dynamics365Account,\x20%s,\x20%s',_0x4d909c,_0x2a920b[_0x0b77('0x23')]['message']);return _0x51c4d8(_0x2a920b[_0x0b77('0x23')]['message']);}logger[_0x0b77('0x23')](_0x0b77('0x25'),_0x4d909c,_0x2a920b[_0x0b77('0x23')][_0x0b77('0x26')]);return _0x29699b(_0x2a920b[_0x0b77('0x23')][_0x0b77('0x26')]);}else{logger[_0x0b77('0x1f')](_0x0b77('0x25'),_0x4d909c,_0x0b77('0x20'));_0x29699b(_0x2a920b[_0x0b77('0x27')][_0x0b77('0x26')]);}})['catch'](function(_0x338816){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x4d909c,_0x338816);_0x51c4d8(_0x338816);});});}function respondWithStatusCode(_0x5d1450,_0x2f9084){_0x2f9084=_0x2f9084||0xcc;return function(_0xeca5d7){if(_0xeca5d7){return _0x5d1450[_0x0b77('0x28')](_0x2f9084);}return _0x5d1450[_0x0b77('0x29')](_0x2f9084)[_0x0b77('0x2a')]();};}function respondWithResult(_0x2ec8d7,_0x4af416){_0x4af416=_0x4af416||0xc8;return function(_0x857461){if(_0x857461){return _0x2ec8d7[_0x0b77('0x29')](_0x4af416)[_0x0b77('0x2b')](_0x857461);}};}function respondWithFilteredResult(_0x4f8ddb,_0x1c8408){return function(_0x31ae45){if(_0x31ae45){var _0x578aaa=_0x31ae45[_0x0b77('0x2c')],_0x4d08a1=_0x1c8408['offset'],_0x58215d=_0x1c8408[_0x0b77('0x2d')]+_0x1c8408[_0x0b77('0x2e')],_0x28af40;if(_0x58215d>=_0x578aaa){_0x58215d=_0x578aaa;_0x28af40=0xc8;}else{_0x28af40=0xce;}_0x4f8ddb[_0x0b77('0x29')](_0x28af40);return _0x4f8ddb[_0x0b77('0x2f')](_0x0b77('0x30'),_0x4d08a1+'-'+_0x58215d+'/'+_0x578aaa)[_0x0b77('0x2b')](_0x31ae45);}return null;};}function patchUpdates(_0x4547cd){return function(_0x4b0b5e){try{jsonpatch['apply'](_0x4b0b5e,_0x4547cd,!![]);}catch(_0x2402d1){return BPromise['reject'](_0x2402d1);}return _0x4b0b5e[_0x0b77('0x31')]();};}function saveUpdates(_0x371b9f,_0x3a6058){return function(_0x4e31ee){if(_0x4e31ee){return _0x4e31ee[_0x0b77('0x32')](_0x371b9f)[_0x0b77('0x1e')](function(_0x3280bd){return _0x3280bd;});}return null;};}function removeEntity(_0x422014,_0x1a9f63){return function(_0x387d6e){if(_0x387d6e){return _0x387d6e[_0x0b77('0x33')]()[_0x0b77('0x1e')](function(){_0x422014['status'](0xcc)[_0x0b77('0x2a')]();});}};}function handleEntityNotFound(_0x10e5c5,_0x3fcb3d){return function(_0x5b06c1){if(!_0x5b06c1){_0x10e5c5[_0x0b77('0x28')](0x194);}return _0x5b06c1;};}function handleError(_0x308917,_0x54988f){_0x54988f=_0x54988f||0x1f4;return function(_0xc07407){logger[_0x0b77('0x23')](_0xc07407[_0x0b77('0x34')]);if(_0xc07407[_0x0b77('0x35')]){delete _0xc07407[_0x0b77('0x35')];}_0x308917[_0x0b77('0x29')](_0x54988f)[_0x0b77('0x36')](_0xc07407);};}exports['index']=function(_0x59555a,_0x17b6e1){var _0x2479e4={},_0x454fa2={},_0x1a053e={'count':0x0,'rows':[]};var _0x4c8f9b=_[_0x0b77('0x37')](db['Dynamics365Account']['rawAttributes'],function(_0x490cec){return{'name':_0x490cec['fieldName'],'type':_0x490cec['type'][_0x0b77('0x38')]};});_0x454fa2['model']=_['map'](_0x4c8f9b,_0x0b77('0x35'));_0x454fa2[_0x0b77('0x39')]=_['keys'](_0x59555a[_0x0b77('0x39')]);_0x454fa2['filters']=_[_0x0b77('0x3a')](_0x454fa2[_0x0b77('0x3b')],_0x454fa2[_0x0b77('0x39')]);_0x2479e4[_0x0b77('0x3c')]=_[_0x0b77('0x3a')](_0x454fa2[_0x0b77('0x3b')],qs['fields'](_0x59555a[_0x0b77('0x39')]['fields']));_0x2479e4[_0x0b77('0x3c')]=_0x2479e4[_0x0b77('0x3c')]['length']?_0x2479e4[_0x0b77('0x3c')]:_0x454fa2['model'];if(!_0x59555a[_0x0b77('0x39')][_0x0b77('0x3d')]('nolimit')){_0x2479e4['limit']=qs[_0x0b77('0x2e')](_0x59555a['query'][_0x0b77('0x2e')]);_0x2479e4[_0x0b77('0x2d')]=qs[_0x0b77('0x2d')](_0x59555a['query'][_0x0b77('0x2d')]);}_0x2479e4[_0x0b77('0x3e')]=qs[_0x0b77('0x3f')](_0x59555a[_0x0b77('0x39')][_0x0b77('0x3f')]);_0x2479e4[_0x0b77('0x40')]=qs[_0x0b77('0x41')](_[_0x0b77('0x42')](_0x59555a[_0x0b77('0x39')],_0x454fa2[_0x0b77('0x41')]));if(_0x59555a[_0x0b77('0x39')]['filter']){_0x2479e4[_0x0b77('0x40')]=_[_0x0b77('0x43')](_0x2479e4[_0x0b77('0x40')],{'$or':_[_0x0b77('0x37')](_0x4c8f9b,function(_0x2ee915){if(_0x2ee915['type']!==_0x0b77('0x44')){var _0x35a870={};_0x35a870[_0x2ee915[_0x0b77('0x35')]]={'$like':'%'+_0x59555a[_0x0b77('0x39')]['filter']+'%'};return _0x35a870;}})});}_0x2479e4=_[_0x0b77('0x43')]({},_0x2479e4,_0x59555a[_0x0b77('0x45')]);var _0x3d877f={'where':_0x2479e4[_0x0b77('0x40')]};return db['Dynamics365Account']['count'](_0x3d877f)[_0x0b77('0x1e')](function(_0x4753bb){_0x1a053e[_0x0b77('0x2c')]=_0x4753bb;if(_0x59555a[_0x0b77('0x39')][_0x0b77('0x46')]){_0x2479e4['include']=[{'all':!![]}];}return db[_0x0b77('0x47')][_0x0b77('0x48')](_0x2479e4);})[_0x0b77('0x1e')](function(_0x186656){_0x1a053e[_0x0b77('0x49')]=_0x186656;return _0x1a053e;})['then'](respondWithFilteredResult(_0x17b6e1,_0x2479e4))['catch'](handleError(_0x17b6e1,null));};exports[_0x0b77('0x4a')]=function(_0x416443,_0x3df436){var _0x512fa6={'raw':![],'where':{'id':_0x416443['params']['id']}},_0x45e3f5={};_0x45e3f5[_0x0b77('0x3b')]=_['keys'](db[_0x0b77('0x47')][_0x0b77('0x4b')]);_0x45e3f5['query']=_[_0x0b77('0x4c')](_0x416443[_0x0b77('0x39')]);_0x45e3f5[_0x0b77('0x41')]=_[_0x0b77('0x3a')](_0x45e3f5[_0x0b77('0x3b')],_0x45e3f5[_0x0b77('0x39')]);_0x512fa6[_0x0b77('0x3c')]=_[_0x0b77('0x3a')](_0x45e3f5[_0x0b77('0x3b')],qs['fields'](_0x416443[_0x0b77('0x39')][_0x0b77('0x4d')]));_0x512fa6[_0x0b77('0x3c')]=_0x512fa6[_0x0b77('0x3c')]['length']?_0x512fa6[_0x0b77('0x3c')]:_0x45e3f5[_0x0b77('0x3b')];if(_0x416443[_0x0b77('0x39')][_0x0b77('0x46')]){_0x512fa6[_0x0b77('0x4e')]=[{'all':!![]}];}_0x512fa6=_[_0x0b77('0x43')]({},_0x512fa6,_0x416443[_0x0b77('0x45')]);return db['Dynamics365Account'][_0x0b77('0x4f')](_0x512fa6)[_0x0b77('0x1e')](handleEntityNotFound(_0x3df436,null))[_0x0b77('0x1e')](respondWithResult(_0x3df436,null))['catch'](handleError(_0x3df436,null));};exports[_0x0b77('0x50')]=function(_0x5be369,_0x20fbce){return db['Dynamics365Account']['create'](_0x5be369['body'],{})[_0x0b77('0x1e')](respondWithResult(_0x20fbce,0xc9))[_0x0b77('0x51')](handleError(_0x20fbce,null));};exports[_0x0b77('0x32')]=function(_0x5c4fa9,_0x928b2b){if(_0x5c4fa9[_0x0b77('0x52')]['id']){delete _0x5c4fa9[_0x0b77('0x52')]['id'];}return db['Dynamics365Account']['find']({'where':{'id':_0x5c4fa9[_0x0b77('0x53')]['id']}})[_0x0b77('0x1e')](handleEntityNotFound(_0x928b2b,null))[_0x0b77('0x1e')](saveUpdates(_0x5c4fa9[_0x0b77('0x52')],null))[_0x0b77('0x1e')](respondWithResult(_0x928b2b,null))['catch'](handleError(_0x928b2b,null));};exports[_0x0b77('0x33')]=function(_0x4eb2e7,_0x443438){return db[_0x0b77('0x47')][_0x0b77('0x4f')]({'where':{'id':_0x4eb2e7[_0x0b77('0x53')]['id']}})['then'](handleEntityNotFound(_0x443438,null))[_0x0b77('0x1e')](removeEntity(_0x443438,null))[_0x0b77('0x51')](handleError(_0x443438,null));};exports[_0x0b77('0x54')]=function(_0x1aba7b,_0x1571fd,_0x4e4f0c){var _0x554580={};var _0x5a6c43={};var _0x1530df;var _0x4f7475;return db[_0x0b77('0x47')][_0x0b77('0x55')]({'where':{'id':_0x1aba7b[_0x0b77('0x53')]['id']}})['then'](handleEntityNotFound(_0x1571fd,null))['then'](function(_0x569b12){if(_0x569b12){_0x1530df=_0x569b12;_0x5a6c43[_0x0b77('0x3b')]=_['keys'](db[_0x0b77('0x56')][_0x0b77('0x4b')]);_0x5a6c43[_0x0b77('0x39')]=_['keys'](_0x1aba7b[_0x0b77('0x39')]);_0x5a6c43['filters']=_['intersection'](_0x5a6c43['model'],_0x5a6c43[_0x0b77('0x39')]);_0x554580[_0x0b77('0x3c')]=_[_0x0b77('0x3a')](_0x5a6c43[_0x0b77('0x3b')],qs['fields'](_0x1aba7b['query'][_0x0b77('0x4d')]));_0x554580['attributes']=_0x554580['attributes']['length']?_0x554580[_0x0b77('0x3c')]:_0x5a6c43[_0x0b77('0x3b')];_0x554580[_0x0b77('0x3e')]=qs[_0x0b77('0x3f')](_0x1aba7b[_0x0b77('0x39')][_0x0b77('0x3f')]);_0x554580[_0x0b77('0x40')]=qs[_0x0b77('0x41')](_[_0x0b77('0x42')](_0x1aba7b[_0x0b77('0x39')],_0x5a6c43['filters']));if(_0x1aba7b[_0x0b77('0x39')][_0x0b77('0x57')]){_0x554580['where']=_[_0x0b77('0x43')](_0x554580[_0x0b77('0x40')],{'$or':_[_0x0b77('0x37')](_0x554580[_0x0b77('0x3c')],function(_0x2890a5){var _0x4fe705={};_0x4fe705[_0x2890a5]={'$like':'%'+_0x1aba7b[_0x0b77('0x39')][_0x0b77('0x57')]+'%'};return _0x4fe705;})});}_0x554580=_[_0x0b77('0x43')]({},_0x554580,_0x1aba7b[_0x0b77('0x45')]);return _0x1530df[_0x0b77('0x54')](_0x554580);}})[_0x0b77('0x1e')](function(_0x1fe581){if(_0x1fe581){_0x4f7475=_0x1fe581[_0x0b77('0x58')];if(!_0x1aba7b[_0x0b77('0x39')][_0x0b77('0x3d')](_0x0b77('0x59'))){_0x554580[_0x0b77('0x2e')]=qs[_0x0b77('0x2e')](_0x1aba7b['query'][_0x0b77('0x2e')]);_0x554580[_0x0b77('0x2d')]=qs[_0x0b77('0x2d')](_0x1aba7b[_0x0b77('0x39')][_0x0b77('0x2d')]);}return _0x1530df['getConfigurations'](_0x554580);}})[_0x0b77('0x1e')](function(_0x253cf5){if(_0x253cf5){return _0x253cf5?{'count':_0x4f7475,'rows':_0x253cf5}:null;}})[_0x0b77('0x1e')](respondWithResult(_0x1571fd,null))['catch'](handleError(_0x1571fd,null));};exports['addConfiguration']=function(_0xd9ae17,_0x5339ac,_0x518009){if(_0xd9ae17['body']['id']){delete _0xd9ae17[_0x0b77('0x52')]['id'];}return db[_0x0b77('0x47')][_0x0b77('0x55')]({'where':{'id':_0xd9ae17[_0x0b77('0x53')]['id']}})[_0x0b77('0x1e')](handleEntityNotFound(_0x5339ac,null))[_0x0b77('0x1e')](function(_0x173c20){if(_0x173c20){_0xd9ae17[_0x0b77('0x52')]['AccountId']=_0x173c20['id'];_0xd9ae17[_0x0b77('0x52')][_0x0b77('0x5a')]=integrations[_0x0b77('0x5b')](_0xd9ae17[_0x0b77('0x52')]['channel'],_0xd9ae17[_0x0b77('0x52')]['type']);_0xd9ae17['body'][_0x0b77('0x5c')]=integrations[_0x0b77('0x5d')](_0xd9ae17[_0x0b77('0x52')]['channel'],_0xd9ae17['body'][_0x0b77('0x5e')]);return db[_0x0b77('0x56')][_0x0b77('0x50')](_0xd9ae17[_0x0b77('0x52')],{'include':[{'model':db[_0x0b77('0x5f')],'as':_0x0b77('0x5a')},{'model':db['Dynamics365Field'],'as':'Descriptions'}]});}return null;})[_0x0b77('0x1e')](respondWithResult(_0x5339ac,null))[_0x0b77('0x51')](handleError(_0x5339ac,null));};exports[_0x0b77('0x60')]=function(_0x358ed4,_0x3a1b37,_0x322c42){var _0x3fd162=_0x358ed4[_0x0b77('0x39')][_0x0b77('0x61')];var _0x156c69=_0x3fd162===_0x0b77('0x62')?_0x0b77('0x63'):_0x0b77('0x64');var _0x301f54='';var _0x22cbec='';var _0x5a2baa='';var _0x59210a='';var _0x4a9875='';var _0x385913='';var _0x433b8d='';var _0x132af5='';var _0x4417e6=[_0x0b77('0x65'),_0x0b77('0x66'),'customerid','ownerid',_0x0b77('0x67'),_0x0b77('0x68'),'phonenumber',_0x0b77('0x69'),'directioncode',_0x0b77('0x6a')];var _0x3c3667=['accountidname',_0x0b77('0x6b'),_0x0b77('0x6c'),_0x0b77('0x6d'),'contactidname',_0x0b77('0x6e'),'contractdetailidname','contractidname',_0x0b77('0x6f'),_0x0b77('0x70'),_0x0b77('0x71'),_0x0b77('0x72'),_0x0b77('0x73'),_0x0b77('0x74'),_0x0b77('0x75'),_0x0b77('0x76'),'customeridtype',_0x0b77('0x77'),_0x0b77('0x78'),_0x0b77('0x79'),_0x0b77('0x7a'),'entityimage_url',_0x0b77('0x7b'),_0x0b77('0x7c'),'firstresponsebykpiidname','followupby','importsequencenumber','influencescore',_0x0b77('0x7d'),'lastonholdtime',_0x0b77('0x7e'),_0x0b77('0x7f'),'modifiedbyexternalpartyyominame','modifiedbyname',_0x0b77('0x80'),_0x0b77('0x81'),'modifiedonbehalfbyname','modifiedonbehalfbyyominame',_0x0b77('0x82'),'msdyn_iotalertname','numberofchildincidents',_0x0b77('0x83'),_0x0b77('0x84'),_0x0b77('0x85'),_0x0b77('0x86'),_0x0b77('0x87'),'parentcaseidname',_0x0b77('0x88'),'primarycontactidyominame','prioritycodename',_0x0b77('0x89'),_0x0b77('0x8a'),_0x0b77('0x8b'),_0x0b77('0x8c'),'responseby',_0x0b77('0x8d'),_0x0b77('0x8e'),'sentimentvalue',_0x0b77('0x8f'),_0x0b77('0x90'),_0x0b77('0x91'),_0x0b77('0x92'),'statuscode',_0x0b77('0x93'),'ticketnumber',_0x0b77('0x94'),_0x0b77('0x95'),'traversedpath',_0x0b77('0x96'),'versionnumber'];var _0x363f17=_0x4417e6[_0x0b77('0x97')](_0x3c3667);return db[_0x0b77('0x47')][_0x0b77('0x55')]({'where':{'id':_0x358ed4[_0x0b77('0x53')]['id']},'attributes':['id',_0x0b77('0x98'),_0x0b77('0x99'),'remoteUri',_0x0b77('0x9a'),_0x0b77('0x9b'),_0x0b77('0x9c')]})[_0x0b77('0x1e')](handleEntityNotFound(_0x3a1b37,null))[_0x0b77('0x1e')](function(_0x1ddeb9){if(_0x1ddeb9){_0x132af5=_0x1ddeb9[_0x0b77('0x9d')];var _0x13eb19=_0x132af5['slice'](-0x1);if(_0x13eb19==='/'){_0x132af5=_0x132af5[_0x0b77('0x9e')](0x0,_0x132af5[_0x0b77('0x9f')](_0x13eb19));}_0x433b8d=util[_0x0b77('0xa0')](_0x0b77('0xa1'),_0x132af5);var _0x21350a={'method':'POST','uri':_0x0b77('0xa2')+_0x1ddeb9[_0x0b77('0x9a')]+'/oauth2/token','form':{'client_id':_0x1ddeb9[_0x0b77('0x9b')],'resource':_0x132af5,'username':_0x1ddeb9[_0x0b77('0x98')],'password':_0x1ddeb9[_0x0b77('0x99')],'grant_type':_0x0b77('0x99'),'client_secret':_0x1ddeb9[_0x0b77('0x9c')]},'json':!![]};return rp(_0x21350a);}})[_0x0b77('0x1e')](function(_0x48a132){_0x385913=_0x48a132['access_token'];var _0x24e2c6={'method':_0x0b77('0xa3'),'uri':encodeURI(_0x433b8d+_0x0b77('0xa4')+_0x156c69+'\x27'),'headers':{'Authorization':_0x0b77('0xa5')+_0x385913,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x24e2c6);})[_0x0b77('0x1e')](function(_0x46d43d){var _0x1ef094=_0x46d43d['value'][0x0];var _0x305b8d=_0x1ef094[_0x0b77('0xa6')];var _0x15b74f={'method':'GET','uri':_0x433b8d+_0x0b77('0xa7')+_0x305b8d+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x0b77('0xa5')+_0x385913,'If-None-Match':null,'OData-Version':_0x0b77('0xa8')},'json':!![]};return rp(_0x15b74f);})['then'](function(_0x303ebf){_0x301f54=_0x303ebf;_0x22cbec=_0x301f54[_0x0b77('0xa9')];_0x22cbec=_['remove'](_0x22cbec,function(_0x5e5642){return!_0x363f17[_0x0b77('0xaa')](_0x5e5642['LogicalName']);});var _0x229ffd=[];var _0x44974a=[];_0x22cbec[_0x0b77('0xab')](function(_0x3f6122){if(_0x3f6122[_0x0b77('0xac')]){var _0x32fc4e=_0x3f6122['@odata.type']['substring'](_0x3f6122['@odata.type']['lastIndexOf']('.')+0x1);if(_0x32fc4e===_0x0b77('0xad')){_0x229ffd['push'](getSelectList(_0x433b8d,_0x3fd162,_0x44974a,_0x301f54[_0x0b77('0xa6')],_0x3f6122[_0x0b77('0xa6')],_0x385913));}}});return Promise['all'](_0x229ffd);})[_0x0b77('0x1e')](function(_0x31e837){_0x5a2baa=_0x31e837[0x0];var _0x29b45a=[];var _0x31f3a8=[];_0x22cbec[_0x0b77('0xab')](function(_0x4d9b43){if(!_[_0x0b77('0xae')](_0x4d9b43[_0x0b77('0xac')])){var _0x3d5c01=_0x4d9b43[_0x0b77('0xac')]['substring'](_0x4d9b43[_0x0b77('0xac')][_0x0b77('0x9f')]('.')+0x1);if(_0x3d5c01===_0x0b77('0xaf')){_0x29b45a[_0x0b77('0xb0')](getBooleanList(_0x433b8d,_0x3fd162,_0x31f3a8,_0x301f54['MetadataId'],_0x4d9b43[_0x0b77('0xa6')],_0x385913));}}});return Promise[_0x0b77('0xb1')](_0x29b45a);})[_0x0b77('0x1e')](function(_0x1b6b04){_0x59210a=_0x1b6b04[0x0];var _0x1b72e7=[];var _0x5054df=[];_0x22cbec['forEach'](function(_0x4f67fc){if(_0x4f67fc[_0x0b77('0xac')]){var _0x356390=_0x4f67fc['@odata.type'][_0x0b77('0x9e')](_0x4f67fc[_0x0b77('0xac')][_0x0b77('0x9f')]('.')+0x1);if(_0x356390===_0x0b77('0xb2')||_0x356390===_0x0b77('0xb3')||_0x356390==='BigIntAttributeMetadata'||_0x356390==='IntegerAttributeMetadata'||_0x356390===_0x0b77('0xb4')||_0x356390==='DateTimeAttributeMetadata'||_0x356390==='StatusAttributeMetadata'||_0x356390===_0x0b77('0xb5')||_0x356390===_0x0b77('0xb6')||_0x356390===_0x0b77('0xb7')){_0x1b72e7[_0x0b77('0xb0')](getInputList(_0x433b8d,_0x3fd162,_0x356390,_0x5054df,_0x301f54['MetadataId'],_0x4f67fc[_0x0b77('0xa6')],_0x385913));}}});return Promise['all'](_0x1b72e7);})[_0x0b77('0x1e')](function(_0x34ecbf){_0x4a9875=_0x34ecbf[0x0];var _0x40443c=_0x5a2baa['concat'](_0x59210a)[_0x0b77('0x97')](_0x4a9875);var _0x24c15c={'count':_0x40443c[_0x0b77('0x58')],'rows':_0x40443c};return _0x24c15c;})['then'](respondWithResult(_0x3a1b37,null))[_0x0b77('0x51')](function(_0x4f8aaa){var _0x335986=_0x358ed4[_0x0b77('0x39')][_0x0b77('0x1c')]?0x1f4:_0x4f8aaa[_0x0b77('0xb8')]||0x1f4;logger[_0x0b77('0x23')](_0x4f8aaa[_0x0b77('0x34')]);delete _0x4f8aaa['name'];if(_0x335986===0x191){_0x335986=0x190;}_0x3a1b37[_0x0b77('0x29')](_0x335986)[_0x0b77('0x36')](_0x358ed4['query']['test']?{'message':_0x0b77('0xb9'),'statusCode':_0x4f8aaa[_0x0b77('0xb8')]}:_0x4f8aaa);});};function getSelectList(_0x2c52b6,_0x5194bf,_0x1f8bc3,_0x38d37b,_0x332ca3,_0x43d0e1){var _0xb3c376={'method':_0x0b77('0xa3'),'uri':_0x2c52b6+_0x0b77('0xa7')+_0x38d37b+_0x0b77('0xba')+_0x332ca3+_0x0b77('0xbb')+_0x0b77('0xbc'),'headers':{'Authorization':_0x0b77('0xa5')+_0x43d0e1,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xb3c376)[_0x0b77('0x1e')](function(_0x504973){var _0x14a3fe=[];var _0x55fd88=_0x504973[_0x0b77('0xbd')][_0x0b77('0xbe')];_0x55fd88[_0x0b77('0xab')](function(_0x3510a4){_0x14a3fe['push']({'name':_0x3510a4['Label'][_0x0b77('0xbf')]['Label'],'value':String(_0x3510a4[_0x0b77('0xc0')])});});var _0x4a6ddf={'id':_0x5194bf+'_'+_0x504973[_0x0b77('0xc1')],'name':_0x504973[_0x0b77('0xc2')][_0x0b77('0xbf')][_0x0b77('0xc3')],'custom':![],'options':_0x14a3fe};_0x1f8bc3[_0x0b77('0xb0')](_0x4a6ddf);return _0x1f8bc3;});}function getBooleanList(_0x21c840,_0x3f5ed2,_0xb3da86,_0x1c6c0a,_0x190da8,_0x265d8e){var _0x471766={'method':'GET','uri':_0x21c840+_0x0b77('0xa7')+_0x1c6c0a+_0x0b77('0xba')+_0x190da8+_0x0b77('0xc4'),'headers':{'Authorization':_0x0b77('0xa5')+_0x265d8e,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x471766)[_0x0b77('0x1e')](function(_0x42b9c5){var _0x1d9810=[];_0x1d9810[_0x0b77('0xb0')]({'name':_0x42b9c5[_0x0b77('0xbd')]['TrueOption']['Label'][_0x0b77('0xbf')]['Label'],'value':_0x0b77('0xc5')},{'name':_0x42b9c5[_0x0b77('0xbd')][_0x0b77('0xc6')][_0x0b77('0xc3')]['UserLocalizedLabel'][_0x0b77('0xc3')],'value':'false'});var _0x3b622d={'id':_0x3f5ed2+'_'+_0x42b9c5[_0x0b77('0xc1')],'name':_0x42b9c5[_0x0b77('0xc2')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x1d9810};_0xb3da86[_0x0b77('0xb0')](_0x3b622d);return _0xb3da86;});}function getInputList(_0x50b3ce,_0x523896,_0x3e59ad,_0x24922c,_0x5eceed,_0x44609f,_0x12c4f6){var _0x5e9fc9={'method':_0x0b77('0xa3'),'uri':_0x50b3ce+_0x0b77('0xa7')+_0x5eceed+_0x0b77('0xba')+_0x44609f+_0x0b77('0xc7')+_0x3e59ad+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x0b77('0xa5')+_0x12c4f6,'If-None-Match':null,'OData-Version':_0x0b77('0xa8')},'json':!![]};return rp(_0x5e9fc9)[_0x0b77('0x1e')](function(_0xd9c3fb){var _0x3e2667={'id':_0x523896+'_'+_0xd9c3fb[_0x0b77('0xc1')],'name':_0xd9c3fb[_0x0b77('0xc2')][_0x0b77('0xbf')]?_0xd9c3fb[_0x0b77('0xc2')][_0x0b77('0xbf')][_0x0b77('0xc3')]:_0xd9c3fb[_0x0b77('0xc1')],'custom':![],'options':[]};_0x24922c[_0x0b77('0xb0')](_0x3e2667);return _0x24922c;});} \ No newline at end of file +var _0x5d31=['LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','MetadataId','all','isNil','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','4.0','OptionSet','Options','Label','DisplayName','true','UserLocalizedLabel','false',')/Attributes(','?$select=DisplayName,LogicalName','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','stack','name','send','Dynamics365Account','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','filter','merge','type','VIRTUAL','where','includeAll','include','findAll','rows','length','find','create','body','params','getConfigurations','findOne','rawAttributes','pick','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Configuration','Dynamics365Field','getFields','ticketType','Incident','PhoneCall','title','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','username','remoteUri','clientId','clientSecret','slice','substring','lastIndexOf','POST','https://login.microsoftonline.com/','tenantId','password','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x5d31,0xf7));var _0x15d3=function(_0x3382f4,_0x32b70b){_0x3382f4=_0x3382f4-0x0;var _0x3a3368=_0x5d31[_0x3382f4];return _0x3a3368;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x15d3('0x0'));var rimraf=require(_0x15d3('0x1'));var zipdir=require(_0x15d3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x15d3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x15d3('0x4'));var util=require(_0x15d3('0x5'));var path=require(_0x15d3('0x6'));var sox=require(_0x15d3('0x7'));var csv=require('to-csv');var ejs=require(_0x15d3('0x8'));var fs=require('fs');var _=require(_0x15d3('0x9'));var squel=require(_0x15d3('0xa'));var crypto=require(_0x15d3('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x15d3('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x15d3('0xd'));var Redis=require('ioredis');var authService=require(_0x15d3('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x15d3('0xf'));var logger=require(_0x15d3('0x10'))(_0x15d3('0x11'));var utils=require(_0x15d3('0x12'));var config=require(_0x15d3('0x13'));var db=require(_0x15d3('0x14'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x15d3('0x15'));var client=jayson[_0x15d3('0x16')][_0x15d3('0x17')]({'port':0x232a});function checkPasswordPattern(_0x209104,_0x36ab99,_0x1360dd){if(_0x1360dd){var _0x24eb07=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x24eb07[_0x15d3('0x18')](_0x36ab99)){return _0x209104;}else{throw new db[(_0x15d3('0x19'))][(_0x15d3('0x1a'))](_0x15d3('0x1b'));}}else{return _0x209104;}}function respondWithRpcPromise(_0x4af3a7,_0x304a13,_0x17401b,_0x5bbfef){return new BPromise(function(_0xf93348,_0x1b07ba){var _0x407da5=_0x5bbfef||client;return _0x407da5[_0x15d3('0x1c')](_0x4af3a7,_0x17401b)[_0x15d3('0x1d')](function(_0x2c25ba){logger[_0x15d3('0x1e')](_0x15d3('0x1f'),_0x304a13,_0x15d3('0x20'));logger[_0x15d3('0x21')](_0x15d3('0x22'),_0x304a13,'request\x20sent',JSON[_0x15d3('0x23')](_0x2c25ba));if(_0x2c25ba[_0x15d3('0x24')]){if(_0x2c25ba['error']['code']===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x304a13,_0x2c25ba[_0x15d3('0x24')][_0x15d3('0x25')]);return _0x1b07ba(_0x2c25ba[_0x15d3('0x24')][_0x15d3('0x25')]);}logger[_0x15d3('0x24')](_0x15d3('0x1f'),_0x304a13,_0x2c25ba['error']['message']);return _0xf93348(_0x2c25ba[_0x15d3('0x24')][_0x15d3('0x25')]);}else{logger[_0x15d3('0x1e')](_0x15d3('0x1f'),_0x304a13,'request\x20sent');_0xf93348(_0x2c25ba[_0x15d3('0x26')][_0x15d3('0x25')]);}})[_0x15d3('0x27')](function(_0x539626){logger[_0x15d3('0x24')](_0x15d3('0x1f'),_0x304a13,_0x539626);_0x1b07ba(_0x539626);});});}function respondWithStatusCode(_0x4a499a,_0x514380){_0x514380=_0x514380||0xcc;return function(_0x50f171){if(_0x50f171){return _0x4a499a[_0x15d3('0x28')](_0x514380);}return _0x4a499a[_0x15d3('0x29')](_0x514380)[_0x15d3('0x2a')]();};}function respondWithResult(_0x374fa4,_0x26ec4b){_0x26ec4b=_0x26ec4b||0xc8;return function(_0x24bf3c){if(_0x24bf3c){return _0x374fa4[_0x15d3('0x29')](_0x26ec4b)[_0x15d3('0x2b')](_0x24bf3c);}};}function respondWithFilteredResult(_0x3b1ba4,_0x49b865){return function(_0x5f445a){if(_0x5f445a){var _0x164aa1=_0x5f445a[_0x15d3('0x2c')],_0x4e5840=_0x49b865[_0x15d3('0x2d')],_0x6a9c0c=_0x49b865['offset']+_0x49b865[_0x15d3('0x2e')],_0x5a2ccf;if(_0x6a9c0c>=_0x164aa1){_0x6a9c0c=_0x164aa1;_0x5a2ccf=0xc8;}else{_0x5a2ccf=0xce;}_0x3b1ba4[_0x15d3('0x29')](_0x5a2ccf);return _0x3b1ba4[_0x15d3('0x2f')](_0x15d3('0x30'),_0x4e5840+'-'+_0x6a9c0c+'/'+_0x164aa1)[_0x15d3('0x2b')](_0x5f445a);}return null;};}function patchUpdates(_0x14491b){return function(_0x1c9aea){try{jsonpatch[_0x15d3('0x31')](_0x1c9aea,_0x14491b,!![]);}catch(_0x9133e5){return BPromise[_0x15d3('0x32')](_0x9133e5);}return _0x1c9aea['save']();};}function saveUpdates(_0x42d444,_0x398e19){return function(_0x40f778){if(_0x40f778){return _0x40f778[_0x15d3('0x33')](_0x42d444)[_0x15d3('0x1d')](function(_0xb82aa6){return _0xb82aa6;});}return null;};}function removeEntity(_0xcc0489,_0x2c6bdd){return function(_0x4d4485){if(_0x4d4485){return _0x4d4485[_0x15d3('0x34')]()['then'](function(){_0xcc0489[_0x15d3('0x29')](0xcc)[_0x15d3('0x2a')]();});}};}function handleEntityNotFound(_0x17d460,_0x467a0e){return function(_0x145fa3){if(!_0x145fa3){_0x17d460[_0x15d3('0x28')](0x194);}return _0x145fa3;};}function handleError(_0x186fa1,_0xa9bc2c){_0xa9bc2c=_0xa9bc2c||0x1f4;return function(_0x340d03){logger[_0x15d3('0x24')](_0x340d03[_0x15d3('0x35')]);if(_0x340d03[_0x15d3('0x36')]){delete _0x340d03[_0x15d3('0x36')];}_0x186fa1[_0x15d3('0x29')](_0xa9bc2c)[_0x15d3('0x37')](_0x340d03);};}exports['index']=function(_0x205bbd,_0x30f7e8){var _0x4d3b71={},_0xe3e4ba={},_0x7e460a={'count':0x0,'rows':[]};var _0xd2708=_['map'](db[_0x15d3('0x38')]['rawAttributes'],function(_0x2f511b){return{'name':_0x2f511b[_0x15d3('0x39')],'type':_0x2f511b['type'][_0x15d3('0x3a')]};});_0xe3e4ba[_0x15d3('0x3b')]=_[_0x15d3('0x3c')](_0xd2708,_0x15d3('0x36'));_0xe3e4ba[_0x15d3('0x3d')]=_[_0x15d3('0x3e')](_0x205bbd['query']);_0xe3e4ba[_0x15d3('0x3f')]=_['intersection'](_0xe3e4ba[_0x15d3('0x3b')],_0xe3e4ba[_0x15d3('0x3d')]);_0x4d3b71[_0x15d3('0x40')]=_[_0x15d3('0x41')](_0xe3e4ba[_0x15d3('0x3b')],qs[_0x15d3('0x42')](_0x205bbd[_0x15d3('0x3d')][_0x15d3('0x42')]));_0x4d3b71[_0x15d3('0x40')]=_0x4d3b71[_0x15d3('0x40')]['length']?_0x4d3b71[_0x15d3('0x40')]:_0xe3e4ba[_0x15d3('0x3b')];if(!_0x205bbd['query']['hasOwnProperty'](_0x15d3('0x43'))){_0x4d3b71[_0x15d3('0x2e')]=qs[_0x15d3('0x2e')](_0x205bbd[_0x15d3('0x3d')][_0x15d3('0x2e')]);_0x4d3b71[_0x15d3('0x2d')]=qs[_0x15d3('0x2d')](_0x205bbd[_0x15d3('0x3d')][_0x15d3('0x2d')]);}_0x4d3b71[_0x15d3('0x44')]=qs['sort'](_0x205bbd[_0x15d3('0x3d')][_0x15d3('0x45')]);_0x4d3b71['where']=qs[_0x15d3('0x3f')](_['pick'](_0x205bbd['query'],_0xe3e4ba[_0x15d3('0x3f')]));if(_0x205bbd[_0x15d3('0x3d')][_0x15d3('0x46')]){_0x4d3b71['where']=_[_0x15d3('0x47')](_0x4d3b71['where'],{'$or':_[_0x15d3('0x3c')](_0xd2708,function(_0x100ea4){if(_0x100ea4[_0x15d3('0x48')]!==_0x15d3('0x49')){var _0x361154={};_0x361154[_0x100ea4['name']]={'$like':'%'+_0x205bbd['query']['filter']+'%'};return _0x361154;}})});}_0x4d3b71=_[_0x15d3('0x47')]({},_0x4d3b71,_0x205bbd['options']);var _0x327cc8={'where':_0x4d3b71[_0x15d3('0x4a')]};return db[_0x15d3('0x38')]['count'](_0x327cc8)[_0x15d3('0x1d')](function(_0x2d896a){_0x7e460a[_0x15d3('0x2c')]=_0x2d896a;if(_0x205bbd[_0x15d3('0x3d')][_0x15d3('0x4b')]){_0x4d3b71[_0x15d3('0x4c')]=[{'all':!![]}];}return db[_0x15d3('0x38')][_0x15d3('0x4d')](_0x4d3b71);})[_0x15d3('0x1d')](function(_0x43ba84){_0x7e460a[_0x15d3('0x4e')]=_0x43ba84;return _0x7e460a;})[_0x15d3('0x1d')](respondWithFilteredResult(_0x30f7e8,_0x4d3b71))['catch'](handleError(_0x30f7e8,null));};exports['show']=function(_0x264487,_0x446929){var _0x13faa2={'raw':![],'where':{'id':_0x264487['params']['id']}},_0x4ff662={};_0x4ff662[_0x15d3('0x3b')]=_['keys'](db[_0x15d3('0x38')]['rawAttributes']);_0x4ff662[_0x15d3('0x3d')]=_[_0x15d3('0x3e')](_0x264487['query']);_0x4ff662['filters']=_['intersection'](_0x4ff662['model'],_0x4ff662['query']);_0x13faa2[_0x15d3('0x40')]=_[_0x15d3('0x41')](_0x4ff662['model'],qs[_0x15d3('0x42')](_0x264487[_0x15d3('0x3d')][_0x15d3('0x42')]));_0x13faa2['attributes']=_0x13faa2[_0x15d3('0x40')][_0x15d3('0x4f')]?_0x13faa2[_0x15d3('0x40')]:_0x4ff662[_0x15d3('0x3b')];if(_0x264487[_0x15d3('0x3d')][_0x15d3('0x4b')]){_0x13faa2['include']=[{'all':!![]}];}_0x13faa2=_[_0x15d3('0x47')]({},_0x13faa2,_0x264487['options']);return db['Dynamics365Account'][_0x15d3('0x50')](_0x13faa2)['then'](handleEntityNotFound(_0x446929,null))[_0x15d3('0x1d')](respondWithResult(_0x446929,null))['catch'](handleError(_0x446929,null));};exports[_0x15d3('0x51')]=function(_0x205230,_0x18429c){return db[_0x15d3('0x38')][_0x15d3('0x51')](_0x205230['body'],{})['then'](respondWithResult(_0x18429c,0xc9))[_0x15d3('0x27')](handleError(_0x18429c,null));};exports['update']=function(_0x29b4a5,_0x300c4f){if(_0x29b4a5[_0x15d3('0x52')]['id']){delete _0x29b4a5[_0x15d3('0x52')]['id'];}return db[_0x15d3('0x38')][_0x15d3('0x50')]({'where':{'id':_0x29b4a5[_0x15d3('0x53')]['id']}})['then'](handleEntityNotFound(_0x300c4f,null))[_0x15d3('0x1d')](saveUpdates(_0x29b4a5[_0x15d3('0x52')],null))[_0x15d3('0x1d')](respondWithResult(_0x300c4f,null))[_0x15d3('0x27')](handleError(_0x300c4f,null));};exports[_0x15d3('0x34')]=function(_0x540f04,_0x45ea28){return db['Dynamics365Account']['find']({'where':{'id':_0x540f04[_0x15d3('0x53')]['id']}})[_0x15d3('0x1d')](handleEntityNotFound(_0x45ea28,null))[_0x15d3('0x1d')](removeEntity(_0x45ea28,null))[_0x15d3('0x27')](handleError(_0x45ea28,null));};exports[_0x15d3('0x54')]=function(_0x48c04f,_0x17bd0e,_0x939112){var _0x341565={};var _0x4783a6={};var _0x4b0cec;var _0x4242d4;return db[_0x15d3('0x38')][_0x15d3('0x55')]({'where':{'id':_0x48c04f[_0x15d3('0x53')]['id']}})[_0x15d3('0x1d')](handleEntityNotFound(_0x17bd0e,null))[_0x15d3('0x1d')](function(_0x92d46e){if(_0x92d46e){_0x4b0cec=_0x92d46e;_0x4783a6['model']=_[_0x15d3('0x3e')](db['Dynamics365Configuration'][_0x15d3('0x56')]);_0x4783a6[_0x15d3('0x3d')]=_[_0x15d3('0x3e')](_0x48c04f['query']);_0x4783a6[_0x15d3('0x3f')]=_['intersection'](_0x4783a6[_0x15d3('0x3b')],_0x4783a6[_0x15d3('0x3d')]);_0x341565['attributes']=_[_0x15d3('0x41')](_0x4783a6['model'],qs['fields'](_0x48c04f['query']['fields']));_0x341565[_0x15d3('0x40')]=_0x341565[_0x15d3('0x40')][_0x15d3('0x4f')]?_0x341565[_0x15d3('0x40')]:_0x4783a6['model'];_0x341565[_0x15d3('0x44')]=qs[_0x15d3('0x45')](_0x48c04f[_0x15d3('0x3d')][_0x15d3('0x45')]);_0x341565['where']=qs['filters'](_[_0x15d3('0x57')](_0x48c04f['query'],_0x4783a6[_0x15d3('0x3f')]));if(_0x48c04f[_0x15d3('0x3d')][_0x15d3('0x46')]){_0x341565[_0x15d3('0x4a')]=_['merge'](_0x341565[_0x15d3('0x4a')],{'$or':_[_0x15d3('0x3c')](_0x341565[_0x15d3('0x40')],function(_0xcd37cd){var _0x3ca30d={};_0x3ca30d[_0xcd37cd]={'$like':'%'+_0x48c04f[_0x15d3('0x3d')]['filter']+'%'};return _0x3ca30d;})});}_0x341565=_[_0x15d3('0x47')]({},_0x341565,_0x48c04f['options']);return _0x4b0cec[_0x15d3('0x54')](_0x341565);}})[_0x15d3('0x1d')](function(_0x4465d0){if(_0x4465d0){_0x4242d4=_0x4465d0['length'];if(!_0x48c04f[_0x15d3('0x3d')][_0x15d3('0x58')](_0x15d3('0x43'))){_0x341565[_0x15d3('0x2e')]=qs['limit'](_0x48c04f[_0x15d3('0x3d')][_0x15d3('0x2e')]);_0x341565['offset']=qs['offset'](_0x48c04f[_0x15d3('0x3d')][_0x15d3('0x2d')]);}return _0x4b0cec[_0x15d3('0x54')](_0x341565);}})[_0x15d3('0x1d')](function(_0x48b608){if(_0x48b608){return _0x48b608?{'count':_0x4242d4,'rows':_0x48b608}:null;}})[_0x15d3('0x1d')](respondWithResult(_0x17bd0e,null))[_0x15d3('0x27')](handleError(_0x17bd0e,null));};exports[_0x15d3('0x59')]=function(_0x4e23ba,_0x250d52,_0x21d086){if(_0x4e23ba[_0x15d3('0x52')]['id']){delete _0x4e23ba[_0x15d3('0x52')]['id'];}return db['Dynamics365Account'][_0x15d3('0x55')]({'where':{'id':_0x4e23ba[_0x15d3('0x53')]['id']}})[_0x15d3('0x1d')](handleEntityNotFound(_0x250d52,null))['then'](function(_0x368374){if(_0x368374){_0x4e23ba[_0x15d3('0x52')]['AccountId']=_0x368374['id'];_0x4e23ba[_0x15d3('0x52')][_0x15d3('0x5a')]=integrations[_0x15d3('0x5b')](_0x4e23ba['body'][_0x15d3('0x5c')],_0x4e23ba[_0x15d3('0x52')]['type']);_0x4e23ba[_0x15d3('0x52')][_0x15d3('0x5d')]=integrations[_0x15d3('0x5e')](_0x4e23ba[_0x15d3('0x52')][_0x15d3('0x5c')],_0x4e23ba[_0x15d3('0x52')][_0x15d3('0x48')]);return db[_0x15d3('0x5f')][_0x15d3('0x51')](_0x4e23ba[_0x15d3('0x52')],{'include':[{'model':db['Dynamics365Field'],'as':_0x15d3('0x5a')},{'model':db[_0x15d3('0x60')],'as':_0x15d3('0x5d')}]});}return null;})[_0x15d3('0x1d')](respondWithResult(_0x250d52,null))[_0x15d3('0x27')](handleError(_0x250d52,null));};exports[_0x15d3('0x61')]=function(_0x5b8f73,_0x4f58df,_0x5f147e){var _0x3b03d7=_0x5b8f73[_0x15d3('0x3d')][_0x15d3('0x62')];var _0x35869e=_0x3b03d7==='incident'?_0x15d3('0x63'):_0x15d3('0x64');var _0x4c2f51='';var _0x26fd5f='';var _0x38d19a='';var _0xe26daf='';var _0x2e4a53='';var _0x473456='';var _0x5a0262='';var _0x2b75b3='';var _0x58de62=[_0x15d3('0x65'),'description','customerid',_0x15d3('0x66'),_0x15d3('0x67'),_0x15d3('0x68'),_0x15d3('0x69'),_0x15d3('0x6a'),_0x15d3('0x6b'),_0x15d3('0x6c')];var _0x1b8520=[_0x15d3('0x6d'),'accountidyominame',_0x15d3('0x6e'),_0x15d3('0x6f'),_0x15d3('0x70'),_0x15d3('0x71'),_0x15d3('0x72'),_0x15d3('0x73'),_0x15d3('0x74'),_0x15d3('0x75'),'createdbyname','createdbyyominame',_0x15d3('0x76'),_0x15d3('0x77'),_0x15d3('0x78'),_0x15d3('0x79'),'customeridtype','customeridyominame',_0x15d3('0x7a'),_0x15d3('0x7b'),_0x15d3('0x7c'),_0x15d3('0x7d'),_0x15d3('0x7e'),_0x15d3('0x7f'),'firstresponsebykpiidname',_0x15d3('0x80'),_0x15d3('0x81'),_0x15d3('0x82'),_0x15d3('0x83'),_0x15d3('0x84'),_0x15d3('0x85'),_0x15d3('0x86'),'modifiedbyexternalpartyyominame',_0x15d3('0x87'),'modifiedbyyominame',_0x15d3('0x88'),_0x15d3('0x89'),_0x15d3('0x8a'),_0x15d3('0x8b'),_0x15d3('0x8c'),_0x15d3('0x8d'),_0x15d3('0x8e'),_0x15d3('0x8f'),_0x15d3('0x90'),_0x15d3('0x91'),_0x15d3('0x92'),_0x15d3('0x93'),_0x15d3('0x94'),_0x15d3('0x95'),'prioritycodename',_0x15d3('0x96'),_0x15d3('0x97'),_0x15d3('0x98'),_0x15d3('0x99'),_0x15d3('0x9a'),_0x15d3('0x9b'),_0x15d3('0x9c'),_0x15d3('0x9d'),_0x15d3('0x9e'),_0x15d3('0x9f'),_0x15d3('0xa0'),_0x15d3('0xa1'),_0x15d3('0xa2'),'subjectidname',_0x15d3('0xa3'),_0x15d3('0xa4'),_0x15d3('0xa5'),_0x15d3('0xa6'),'utcconversiontimezonecode','versionnumber'];var _0x4c4bef=_0x58de62['concat'](_0x1b8520);return db[_0x15d3('0x38')][_0x15d3('0x55')]({'where':{'id':_0x5b8f73[_0x15d3('0x53')]['id']},'attributes':['id',_0x15d3('0xa7'),'password',_0x15d3('0xa8'),'tenantId',_0x15d3('0xa9'),_0x15d3('0xaa')]})[_0x15d3('0x1d')](handleEntityNotFound(_0x4f58df,null))['then'](function(_0x1a92b3){if(_0x1a92b3){_0x2b75b3=_0x1a92b3[_0x15d3('0xa8')];var _0x2e4000=_0x2b75b3[_0x15d3('0xab')](-0x1);if(_0x2e4000==='/'){_0x2b75b3=_0x2b75b3[_0x15d3('0xac')](0x0,_0x2b75b3[_0x15d3('0xad')](_0x2e4000));}_0x5a0262=util['format']('%s/api/data/v9.0/',_0x2b75b3);var _0x4b49dd={'method':_0x15d3('0xae'),'uri':_0x15d3('0xaf')+_0x1a92b3[_0x15d3('0xb0')]+'/oauth2/token','form':{'client_id':_0x1a92b3['clientId'],'resource':_0x2b75b3,'username':_0x1a92b3[_0x15d3('0xa7')],'password':_0x1a92b3[_0x15d3('0xb1')],'grant_type':_0x15d3('0xb1'),'client_secret':_0x1a92b3[_0x15d3('0xaa')]},'json':!![]};return rp(_0x4b49dd);}})[_0x15d3('0x1d')](function(_0x111b13){_0x473456=_0x111b13[_0x15d3('0xb2')];var _0x1ced35={'method':'GET','uri':encodeURI(_0x5a0262+_0x15d3('0xb3')+_0x35869e+'\x27'),'headers':{'Authorization':_0x15d3('0xb4')+_0x473456,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1ced35);})['then'](function(_0x5e071b){var _0xbea92f=_0x5e071b['value'][0x0];var _0x14a3d1=_0xbea92f['MetadataId'];var _0x56aec8={'method':_0x15d3('0xb5'),'uri':_0x5a0262+_0x15d3('0xb6')+_0x14a3d1+_0x15d3('0xb7'),'headers':{'Authorization':'Bearer\x20'+_0x473456,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x56aec8);})[_0x15d3('0x1d')](function(_0x1b051a){_0x4c2f51=_0x1b051a;_0x26fd5f=_0x4c2f51[_0x15d3('0xb8')];_0x26fd5f=_[_0x15d3('0xb9')](_0x26fd5f,function(_0x3274e8){return!_0x4c4bef[_0x15d3('0xba')](_0x3274e8[_0x15d3('0xbb')]);});var _0x4927a7=[];var _0xc3842=[];_0x26fd5f[_0x15d3('0xbc')](function(_0x201699){if(_0x201699[_0x15d3('0xbd')]){var _0x4f0787=_0x201699[_0x15d3('0xbd')][_0x15d3('0xac')](_0x201699[_0x15d3('0xbd')]['lastIndexOf']('.')+0x1);if(_0x4f0787===_0x15d3('0xbe')){_0x4927a7[_0x15d3('0xbf')](getSelectList(_0x5a0262,_0x3b03d7,_0xc3842,_0x4c2f51[_0x15d3('0xc0')],_0x201699[_0x15d3('0xc0')],_0x473456));}}});return Promise[_0x15d3('0xc1')](_0x4927a7);})[_0x15d3('0x1d')](function(_0x322c90){_0x38d19a=_0x322c90[0x0];var _0x556663=[];var _0x539c74=[];_0x26fd5f[_0x15d3('0xbc')](function(_0x328186){if(!_[_0x15d3('0xc2')](_0x328186[_0x15d3('0xbd')])){var _0x731621=_0x328186[_0x15d3('0xbd')]['substring'](_0x328186[_0x15d3('0xbd')][_0x15d3('0xad')]('.')+0x1);if(_0x731621==='BooleanAttributeMetadata'){_0x556663[_0x15d3('0xbf')](getBooleanList(_0x5a0262,_0x3b03d7,_0x539c74,_0x4c2f51[_0x15d3('0xc0')],_0x328186[_0x15d3('0xc0')],_0x473456));}}});return Promise[_0x15d3('0xc1')](_0x556663);})['then'](function(_0x5cd063){_0xe26daf=_0x5cd063[0x0];var _0x2354dd=[];var _0x3136e4=[];_0x26fd5f[_0x15d3('0xbc')](function(_0x5d2167){if(_0x5d2167[_0x15d3('0xbd')]){var _0x25dd0e=_0x5d2167[_0x15d3('0xbd')][_0x15d3('0xac')](_0x5d2167[_0x15d3('0xbd')]['lastIndexOf']('.')+0x1);if(_0x25dd0e==='StringAttributeMetadata'||_0x25dd0e===_0x15d3('0xc3')||_0x25dd0e===_0x15d3('0xc4')||_0x25dd0e==='IntegerAttributeMetadata'||_0x25dd0e===_0x15d3('0xc5')||_0x25dd0e===_0x15d3('0xc6')||_0x25dd0e===_0x15d3('0xc7')||_0x25dd0e===_0x15d3('0xc8')||_0x25dd0e===_0x15d3('0xc9')||_0x25dd0e===_0x15d3('0xca')){_0x2354dd[_0x15d3('0xbf')](getInputList(_0x5a0262,_0x3b03d7,_0x25dd0e,_0x3136e4,_0x4c2f51[_0x15d3('0xc0')],_0x5d2167[_0x15d3('0xc0')],_0x473456));}}});return Promise['all'](_0x2354dd);})['then'](function(_0xd5c75b){_0x2e4a53=_0xd5c75b[0x0];var _0x5d8483=_0x38d19a[_0x15d3('0xcb')](_0xe26daf)[_0x15d3('0xcb')](_0x2e4a53);var _0x3572b3={'count':_0x5d8483[_0x15d3('0x4f')],'rows':_0x5d8483};return _0x3572b3;})[_0x15d3('0x1d')](respondWithResult(_0x4f58df,null))[_0x15d3('0x27')](function(_0x52e43b){var _0x45f967=_0x5b8f73[_0x15d3('0x3d')][_0x15d3('0x18')]?0x1f4:_0x52e43b['statusCode']||0x1f4;logger[_0x15d3('0x24')](_0x52e43b['stack']);delete _0x52e43b['name'];if(_0x45f967===0x191){_0x45f967=0x190;}_0x4f58df[_0x15d3('0x29')](_0x45f967)[_0x15d3('0x37')](_0x5b8f73['query']['test']?{'message':_0x15d3('0xcc'),'statusCode':_0x52e43b['statusCode']}:_0x52e43b);});};function getSelectList(_0x492672,_0x27f28b,_0x164625,_0x3efede,_0x27cea5,_0x3f040a){var _0x3730b5={'method':_0x15d3('0xb5'),'uri':_0x492672+_0x15d3('0xb6')+_0x3efede+')/Attributes('+_0x27cea5+_0x15d3('0xcd')+_0x15d3('0xce'),'headers':{'Authorization':_0x15d3('0xb4')+_0x3f040a,'If-None-Match':null,'OData-Version':_0x15d3('0xcf')},'json':!![]};return rp(_0x3730b5)['then'](function(_0x65b811){var _0x75972b=[];var _0x30efb6=_0x65b811[_0x15d3('0xd0')][_0x15d3('0xd1')];_0x30efb6[_0x15d3('0xbc')](function(_0x2d5472){_0x75972b[_0x15d3('0xbf')]({'name':_0x2d5472[_0x15d3('0xd2')]['UserLocalizedLabel']['Label'],'value':String(_0x2d5472['Value'])});});var _0x51c0ad={'id':_0x27f28b+'_'+_0x65b811[_0x15d3('0xbb')],'name':_0x65b811[_0x15d3('0xd3')]['UserLocalizedLabel'][_0x15d3('0xd2')],'custom':![],'options':_0x75972b};_0x164625[_0x15d3('0xbf')](_0x51c0ad);return _0x164625;});}function getBooleanList(_0x1266c8,_0x4b9f49,_0x2e462c,_0x573b43,_0x39b1f0,_0x1a0899){var _0x1c44bc={'method':_0x15d3('0xb5'),'uri':_0x1266c8+_0x15d3('0xb6')+_0x573b43+')/Attributes('+_0x39b1f0+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x15d3('0xb4')+_0x1a0899,'If-None-Match':null,'OData-Version':_0x15d3('0xcf')},'json':!![]};return rp(_0x1c44bc)[_0x15d3('0x1d')](function(_0x5851f7){var _0x245ea6=[];_0x245ea6[_0x15d3('0xbf')]({'name':_0x5851f7[_0x15d3('0xd0')]['TrueOption'][_0x15d3('0xd2')]['UserLocalizedLabel']['Label'],'value':_0x15d3('0xd4')},{'name':_0x5851f7[_0x15d3('0xd0')]['FalseOption'][_0x15d3('0xd2')][_0x15d3('0xd5')][_0x15d3('0xd2')],'value':_0x15d3('0xd6')});var _0x3c6c73={'id':_0x4b9f49+'_'+_0x5851f7[_0x15d3('0xbb')],'name':_0x5851f7[_0x15d3('0xd3')][_0x15d3('0xd5')][_0x15d3('0xd2')],'custom':![],'options':_0x245ea6};_0x2e462c[_0x15d3('0xbf')](_0x3c6c73);return _0x2e462c;});}function getInputList(_0x2b434a,_0x550671,_0x3d9a3a,_0x16976d,_0x33e5f8,_0x3d9c70,_0x92dd3f){var _0x55c032={'method':_0x15d3('0xb5'),'uri':_0x2b434a+_0x15d3('0xb6')+_0x33e5f8+_0x15d3('0xd7')+_0x3d9c70+')/Microsoft.Dynamics.CRM.'+_0x3d9a3a+_0x15d3('0xd8'),'headers':{'Authorization':'Bearer\x20'+_0x92dd3f,'If-None-Match':null,'OData-Version':_0x15d3('0xcf')},'json':!![]};return rp(_0x55c032)[_0x15d3('0x1d')](function(_0x169d49){var _0x42bdd3={'id':_0x550671+'_'+_0x169d49['LogicalName'],'name':_0x169d49[_0x15d3('0xd3')][_0x15d3('0xd5')]?_0x169d49[_0x15d3('0xd3')][_0x15d3('0xd5')][_0x15d3('0xd2')]:_0x169d49[_0x15d3('0xbb')],'custom':![],'options':[]};_0x16976d[_0x15d3('0xbf')](_0x42bdd3);return _0x16976d;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 6940594..4e8c8f7 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 _0x4fd5=['request-promise','../../config/environment','./intDynamics365Account.attributes','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util','api','moment','bluebird'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x4fd5,0x1ab));var _0x54fd=function(_0x2ac128,_0x2350d2){_0x2ac128=_0x2ac128-0x0;var _0x14ccfc=_0x4fd5[_0x2ac128];return _0x14ccfc;};'use strict';var _=require(_0x54fd('0x0'));var util=require(_0x54fd('0x1'));var logger=require('../../config/logger')(_0x54fd('0x2'));var moment=require(_0x54fd('0x3'));var BPromise=require(_0x54fd('0x4'));var rp=require(_0x54fd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x54fd('0x6'));var attributes=require(_0x54fd('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x54fd('0x8')]=function(_0x5a2cd4,_0x13fc74){return _0x5a2cd4[_0x54fd('0x9')](_0x54fd('0xa'),attributes,{'tableName':_0x54fd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5dc1=['bluebird','request-promise','path','../../config/environment','./intDynamics365Account.attributes','exports','define','lodash','api'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x5dc1,0x1c0));var _0x15dc=function(_0x22a02a,_0x1f365a){_0x22a02a=_0x22a02a-0x0;var _0x5bf4d5=_0x5dc1[_0x22a02a];return _0x5bf4d5;};'use strict';var _=require(_0x15dc('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x15dc('0x1'));var moment=require('moment');var BPromise=require(_0x15dc('0x2'));var rp=require(_0x15dc('0x3'));var fs=require('fs');var path=require(_0x15dc('0x4'));var rimraf=require('rimraf');var config=require(_0x15dc('0x5'));var attributes=require(_0x15dc('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x15dc('0x7')]=function(_0x5e6e09,_0x2b2b9f){return _0x5e6e09[_0x15dc('0x8')]('Dynamics365Account',attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index d597f2a..6d3d267 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 _0xd9fb=['limit','include','map','model','then','GetDynamics365Account','stringify','ShowDynamics365Account','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','message','result','catch','Dynamics365Account','findAll','options','raw','where','attributes'];(function(_0x3f5dca,_0x59472b){var _0x5b833a=function(_0x1cb84b){while(--_0x1cb84b){_0x3f5dca['push'](_0x3f5dca['shift']());}};_0x5b833a(++_0x59472b);}(_0xd9fb,0x189));var _0xbd9f=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xd9fb[_0xaa0309];return _0x5de7ce;};'use strict';var _=require(_0xbd9f('0x0'));var util=require(_0xbd9f('0x1'));var moment=require(_0xbd9f('0x2'));var BPromise=require(_0xbd9f('0x3'));var rs=require(_0xbd9f('0x4'));var fs=require('fs');var Redis=require(_0xbd9f('0x5'));var db=require(_0xbd9f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xbd9f('0x7'))(_0xbd9f('0x8'));var config=require('../../config/environment');var jayson=require(_0xbd9f('0x9'));var client=jayson['client'][_0xbd9f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43a5a2,_0x5e2143,_0x30f0ae){return new BPromise(function(_0x16f086,_0x3dbc8e){return client[_0xbd9f('0xb')](_0x43a5a2,_0x30f0ae)['then'](function(_0x37163c){logger[_0xbd9f('0xc')](_0xbd9f('0xd'),_0x5e2143,_0xbd9f('0xe'));logger[_0xbd9f('0xf')](_0xbd9f('0x10'),_0x5e2143,_0xbd9f('0xe'),JSON['stringify'](_0x37163c));if(_0x37163c['error']){if(_0x37163c['error']['code']===0x1f4){logger[_0xbd9f('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x5e2143,_0x37163c[_0xbd9f('0x11')][_0xbd9f('0x12')]);return _0x3dbc8e(_0x37163c[_0xbd9f('0x11')]['message']);}logger[_0xbd9f('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x5e2143,_0x37163c[_0xbd9f('0x11')][_0xbd9f('0x12')]);return _0x16f086(_0x37163c[_0xbd9f('0x11')][_0xbd9f('0x12')]);}else{logger['info'](_0xbd9f('0xd'),_0x5e2143,_0xbd9f('0xe'));_0x16f086(_0x37163c[_0xbd9f('0x13')][_0xbd9f('0x12')]);}})[_0xbd9f('0x14')](function(_0x985bc1){logger[_0xbd9f('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x5e2143,_0x985bc1);_0x3dbc8e(_0x985bc1);});});}exports['GetDynamics365Account']=function(_0x35be6d){var _0x5ebaf6=this;return new Promise(function(_0x2f52dd,_0x3cc2ce){return db[_0xbd9f('0x15')][_0xbd9f('0x16')]({'raw':_0x35be6d[_0xbd9f('0x17')]?_0x35be6d[_0xbd9f('0x17')][_0xbd9f('0x18')]===undefined?!![]:![]:!![],'where':_0x35be6d[_0xbd9f('0x17')]?_0x35be6d['options'][_0xbd9f('0x19')]||null:null,'attributes':_0x35be6d[_0xbd9f('0x17')]?_0x35be6d[_0xbd9f('0x17')][_0xbd9f('0x1a')]||null:null,'limit':_0x35be6d[_0xbd9f('0x17')]?_0x35be6d[_0xbd9f('0x17')][_0xbd9f('0x1b')]||null:null,'include':_0x35be6d[_0xbd9f('0x17')]?_0x35be6d[_0xbd9f('0x17')][_0xbd9f('0x1c')]?_[_0xbd9f('0x1d')](_0x35be6d['options'][_0xbd9f('0x1c')],function(_0x10697a){return{'model':db[_0x10697a[_0xbd9f('0x1e')]],'as':_0x10697a['as'],'attributes':_0x10697a[_0xbd9f('0x1a')],'include':_0x10697a['include']?_[_0xbd9f('0x1d')](_0x10697a[_0xbd9f('0x1c')],function(_0x278a10){return{'model':db[_0x278a10[_0xbd9f('0x1e')]],'as':_0x278a10['as'],'attributes':_0x278a10[_0xbd9f('0x1a')],'include':_0x278a10[_0xbd9f('0x1c')]?_[_0xbd9f('0x1d')](_0x278a10['include'],function(_0xd89fc2){return{'model':db[_0xd89fc2[_0xbd9f('0x1e')]],'as':_0xd89fc2['as'],'attributes':_0xd89fc2[_0xbd9f('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xbd9f('0x1f')](function(_0x25a5c8){logger['info']('GetDynamics365Account',_0x35be6d);logger[_0xbd9f('0xf')](_0xbd9f('0x20'),_0x35be6d,JSON[_0xbd9f('0x21')](_0x25a5c8));_0x2f52dd(_0x25a5c8);})['catch'](function(_0xe884e8){logger[_0xbd9f('0x11')](_0xbd9f('0x20'),_0xe884e8['message'],_0x35be6d);_0x3cc2ce(_0x5ebaf6[_0xbd9f('0x11')](0x1f4,_0xe884e8[_0xbd9f('0x12')]));});});};exports[_0xbd9f('0x22')]=function(_0x25c219){var _0x2a733e=this;return new Promise(function(_0x28dd61,_0x22c16c){return db['Dynamics365Account']['find']({'raw':_0x25c219[_0xbd9f('0x17')]?_0x25c219[_0xbd9f('0x17')][_0xbd9f('0x18')]===undefined?!![]:![]:!![],'where':_0x25c219[_0xbd9f('0x17')]?_0x25c219[_0xbd9f('0x17')][_0xbd9f('0x19')]||null:null,'attributes':_0x25c219[_0xbd9f('0x17')]?_0x25c219[_0xbd9f('0x17')][_0xbd9f('0x1a')]||null:null,'include':_0x25c219['options']?_0x25c219['options'][_0xbd9f('0x1c')]?_['map'](_0x25c219['options'][_0xbd9f('0x1c')],function(_0x422089){return{'model':db[_0x422089[_0xbd9f('0x1e')]],'as':_0x422089['as'],'attributes':_0x422089[_0xbd9f('0x1a')],'include':_0x422089[_0xbd9f('0x1c')]?_[_0xbd9f('0x1d')](_0x422089[_0xbd9f('0x1c')],function(_0x43aef6){return{'model':db[_0x43aef6['model']],'as':_0x43aef6['as'],'attributes':_0x43aef6[_0xbd9f('0x1a')],'include':_0x43aef6[_0xbd9f('0x1c')]?_[_0xbd9f('0x1d')](_0x43aef6['include'],function(_0x5553d9){return{'model':db[_0x5553d9[_0xbd9f('0x1e')]],'as':_0x5553d9['as'],'attributes':_0x5553d9[_0xbd9f('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x149777){logger['info'](_0xbd9f('0x22'),_0x25c219);logger[_0xbd9f('0xf')](_0xbd9f('0x22'),_0x25c219,JSON[_0xbd9f('0x21')](_0x149777));_0x28dd61(_0x149777);})[_0xbd9f('0x14')](function(_0x5f0cb2){logger[_0xbd9f('0x11')](_0xbd9f('0x22'),_0x5f0cb2['message'],_0x25c219);_0x22c16c(_0x2a733e[_0xbd9f('0x11')](0x1f4,_0x5f0cb2[_0xbd9f('0x12')]));});});}; \ No newline at end of file +var _0x9505=['message','result','catch','GetDynamics365Account','options','raw','where','limit','map','include','model','attributes','debug','stringify','ShowDynamics365Account','Dynamics365Account','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x1914cf,_0xc4957b){var _0x157847=function(_0x39eef0){while(--_0x39eef0){_0x1914cf['push'](_0x1914cf['shift']());}};_0x157847(++_0xc4957b);}(_0x9505,0x1e5));var _0x5950=function(_0x3b557a,_0x3a97cf){_0x3b557a=_0x3b557a-0x0;var _0x359f22=_0x9505[_0x3b557a];return _0x359f22;};'use strict';var _=require(_0x5950('0x0'));var util=require(_0x5950('0x1'));var moment=require('moment');var BPromise=require(_0x5950('0x2'));var rs=require(_0x5950('0x3'));var fs=require('fs');var Redis=require(_0x5950('0x4'));var db=require(_0x5950('0x5'))['db'];var utils=require(_0x5950('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x5950('0x7'));var jayson=require(_0x5950('0x8'));var client=jayson[_0x5950('0x9')][_0x5950('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4aa518,_0x4b9478,_0x425d17){return new BPromise(function(_0x362f04,_0x3986aa){return client[_0x5950('0xb')](_0x4aa518,_0x425d17)[_0x5950('0xc')](function(_0x1df039){logger[_0x5950('0xd')](_0x5950('0xe'),_0x4b9478,_0x5950('0xf'));logger['debug'](_0x5950('0x10'),_0x4b9478,_0x5950('0xf'),JSON['stringify'](_0x1df039));if(_0x1df039['error']){if(_0x1df039[_0x5950('0x11')][_0x5950('0x12')]===0x1f4){logger[_0x5950('0x11')](_0x5950('0xe'),_0x4b9478,_0x1df039[_0x5950('0x11')][_0x5950('0x13')]);return _0x3986aa(_0x1df039[_0x5950('0x11')][_0x5950('0x13')]);}logger[_0x5950('0x11')](_0x5950('0xe'),_0x4b9478,_0x1df039[_0x5950('0x11')][_0x5950('0x13')]);return _0x362f04(_0x1df039[_0x5950('0x11')][_0x5950('0x13')]);}else{logger[_0x5950('0xd')](_0x5950('0xe'),_0x4b9478,_0x5950('0xf'));_0x362f04(_0x1df039[_0x5950('0x14')][_0x5950('0x13')]);}})[_0x5950('0x15')](function(_0xface83){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x4b9478,_0xface83);_0x3986aa(_0xface83);});});}exports[_0x5950('0x16')]=function(_0x40f50c){var _0x3a7821=this;return new Promise(function(_0x5a9530,_0x3e0032){return db['Dynamics365Account']['findAll']({'raw':_0x40f50c[_0x5950('0x17')]?_0x40f50c[_0x5950('0x17')][_0x5950('0x18')]===undefined?!![]:![]:!![],'where':_0x40f50c['options']?_0x40f50c[_0x5950('0x17')][_0x5950('0x19')]||null:null,'attributes':_0x40f50c['options']?_0x40f50c['options']['attributes']||null:null,'limit':_0x40f50c['options']?_0x40f50c[_0x5950('0x17')][_0x5950('0x1a')]||null:null,'include':_0x40f50c[_0x5950('0x17')]?_0x40f50c[_0x5950('0x17')]['include']?_[_0x5950('0x1b')](_0x40f50c[_0x5950('0x17')][_0x5950('0x1c')],function(_0x1bd0ad){return{'model':db[_0x1bd0ad[_0x5950('0x1d')]],'as':_0x1bd0ad['as'],'attributes':_0x1bd0ad[_0x5950('0x1e')],'include':_0x1bd0ad[_0x5950('0x1c')]?_['map'](_0x1bd0ad['include'],function(_0x1b2265){return{'model':db[_0x1b2265[_0x5950('0x1d')]],'as':_0x1b2265['as'],'attributes':_0x1b2265[_0x5950('0x1e')],'include':_0x1b2265[_0x5950('0x1c')]?_[_0x5950('0x1b')](_0x1b2265['include'],function(_0x4a7b22){return{'model':db[_0x4a7b22['model']],'as':_0x4a7b22['as'],'attributes':_0x4a7b22[_0x5950('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5950('0xc')](function(_0xfc543b){logger[_0x5950('0xd')](_0x5950('0x16'),_0x40f50c);logger[_0x5950('0x1f')](_0x5950('0x16'),_0x40f50c,JSON[_0x5950('0x20')](_0xfc543b));_0x5a9530(_0xfc543b);})[_0x5950('0x15')](function(_0x3a3cc0){logger[_0x5950('0x11')](_0x5950('0x16'),_0x3a3cc0[_0x5950('0x13')],_0x40f50c);_0x3e0032(_0x3a7821[_0x5950('0x11')](0x1f4,_0x3a3cc0[_0x5950('0x13')]));});});};exports[_0x5950('0x21')]=function(_0x10f4d4){var _0x18a8ca=this;return new Promise(function(_0x33aa23,_0x625135){return db[_0x5950('0x22')][_0x5950('0x23')]({'raw':_0x10f4d4[_0x5950('0x17')]?_0x10f4d4[_0x5950('0x17')][_0x5950('0x18')]===undefined?!![]:![]:!![],'where':_0x10f4d4[_0x5950('0x17')]?_0x10f4d4[_0x5950('0x17')][_0x5950('0x19')]||null:null,'attributes':_0x10f4d4['options']?_0x10f4d4[_0x5950('0x17')][_0x5950('0x1e')]||null:null,'include':_0x10f4d4[_0x5950('0x17')]?_0x10f4d4[_0x5950('0x17')][_0x5950('0x1c')]?_['map'](_0x10f4d4['options'][_0x5950('0x1c')],function(_0x3c44fa){return{'model':db[_0x3c44fa['model']],'as':_0x3c44fa['as'],'attributes':_0x3c44fa[_0x5950('0x1e')],'include':_0x3c44fa['include']?_[_0x5950('0x1b')](_0x3c44fa[_0x5950('0x1c')],function(_0x376d9f){return{'model':db[_0x376d9f['model']],'as':_0x376d9f['as'],'attributes':_0x376d9f[_0x5950('0x1e')],'include':_0x376d9f['include']?_[_0x5950('0x1b')](_0x376d9f[_0x5950('0x1c')],function(_0x858e48){return{'model':db[_0x858e48[_0x5950('0x1d')]],'as':_0x858e48['as'],'attributes':_0x858e48['attributes']};}):[]};}):[]};}):[]:[]})[_0x5950('0xc')](function(_0x2d8766){logger[_0x5950('0xd')]('ShowDynamics365Account',_0x10f4d4);logger[_0x5950('0x1f')](_0x5950('0x21'),_0x10f4d4,JSON['stringify'](_0x2d8766));_0x33aa23(_0x2d8766);})['catch'](function(_0x57c990){logger[_0x5950('0x11')](_0x5950('0x21'),_0x57c990[_0x5950('0x13')],_0x10f4d4);_0x625135(_0x18a8ca[_0x5950('0x11')](0x1f4,_0x57c990[_0x5950('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index aae8647..75f4579 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 _0xa8a6=['get','isAuthenticated','index','/:id/fields','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','multer','connect-timeout','express','Router','../../components/interaction/service','./intDynamics365Configuration.controller'];(function(_0x4db23b,_0x57d095){var _0x117614=function(_0x1c5130){while(--_0x1c5130){_0x4db23b['push'](_0x4db23b['shift']());}};_0x117614(++_0x57d095);}(_0xa8a6,0x11a));var _0x6a8a=function(_0x2f1133,_0x9554f9){_0x2f1133=_0x2f1133-0x0;var _0x15b963=_0xa8a6[_0x2f1133];return _0x15b963;};'use strict';var multer=require(_0x6a8a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6a8a('0x1'));var express=require(_0x6a8a('0x2'));var router=express[_0x6a8a('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x6a8a('0x4'));var config=require('../../config/environment');var controller=require(_0x6a8a('0x5'));router[_0x6a8a('0x6')]('/',auth[_0x6a8a('0x7')](),controller[_0x6a8a('0x8')]);router[_0x6a8a('0x6')]('/:id',auth[_0x6a8a('0x7')](),controller['show']);router[_0x6a8a('0x6')](_0x6a8a('0x9'),auth[_0x6a8a('0x7')](),controller['getFields']);router[_0x6a8a('0x6')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router['get'](_0x6a8a('0xa'),auth[_0x6a8a('0x7')](),controller[_0x6a8a('0xb')]);router[_0x6a8a('0xc')]('/',auth['isAuthenticated'](),controller[_0x6a8a('0xd')]);router[_0x6a8a('0xe')]('/:id',auth[_0x6a8a('0x7')](),controller[_0x6a8a('0xf')]);router[_0x6a8a('0x10')]('/:id',auth[_0x6a8a('0x7')](),controller[_0x6a8a('0x11')]);module['exports']=router; \ No newline at end of file +var _0xfcbc=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/interaction/service','./intDynamics365Configuration.controller','index','get','/:id','show','/:id/fields','isAuthenticated'];(function(_0xec75c9,_0x360c29){var _0x44ed83=function(_0x1ac323){while(--_0x1ac323){_0xec75c9['push'](_0xec75c9['shift']());}};_0x44ed83(++_0x360c29);}(_0xfcbc,0x154));var _0xcfcb=function(_0x291f8b,_0x3b5591){_0x291f8b=_0x291f8b-0x0;var _0x275171=_0xfcbc[_0x291f8b];return _0x275171;};'use strict';var multer=require('multer');var util=require(_0xcfcb('0x0'));var path=require(_0xcfcb('0x1'));var timeout=require(_0xcfcb('0x2'));var express=require('express');var router=express[_0xcfcb('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xcfcb('0x4'));var config=require('../../config/environment');var controller=require(_0xcfcb('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xcfcb('0x6')]);router[_0xcfcb('0x7')](_0xcfcb('0x8'),auth['isAuthenticated'](),controller[_0xcfcb('0x9')]);router[_0xcfcb('0x7')](_0xcfcb('0xa'),auth[_0xcfcb('0xb')](),controller['getFields']);router[_0xcfcb('0x7')](_0xcfcb('0xc'),auth[_0xcfcb('0xb')](),controller[_0xcfcb('0xd')]);router[_0xcfcb('0x7')](_0xcfcb('0xe'),auth['isAuthenticated'](),controller[_0xcfcb('0xf')]);router['post']('/',auth[_0xcfcb('0xb')](),controller[_0xcfcb('0x10')]);router[_0xcfcb('0x11')](_0xcfcb('0x8'),auth[_0xcfcb('0xb')](),controller[_0xcfcb('0x12')]);router[_0xcfcb('0x13')](_0xcfcb('0x8'),auth[_0xcfcb('0xb')](),controller[_0xcfcb('0x14')]);module[_0xcfcb('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index a2428bc..5fee704 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 _0x685b=['exports','STRING','ENUM','incident','phonecall','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x685b,0x1a3));var _0xb685=function(_0x35d2d6,_0x14e944){_0x35d2d6=_0x35d2d6-0x0;var _0x1637d5=_0x685b[_0x35d2d6];return _0x1637d5;};'use strict';var Sequelize=require(_0xb685('0x0'));module[_0xb685('0x1')]={'name':{'type':Sequelize[_0xb685('0x2')]},'description':{'type':Sequelize[_0xb685('0x2')]},'ticketType':{'type':Sequelize[_0xb685('0x3')](_0xb685('0x4'),_0xb685('0x5')),'defaultValue':_0xb685('0x4')}}; \ No newline at end of file +var _0x40b1=['incident','exports','STRING'];(function(_0x18ec2c,_0x177ac5){var _0x484b18=function(_0x492549){while(--_0x492549){_0x18ec2c['push'](_0x18ec2c['shift']());}};_0x484b18(++_0x177ac5);}(_0x40b1,0x1db));var _0x140b=function(_0x27f9be,_0x2ff20b){_0x27f9be=_0x27f9be-0x0;var _0x3e830f=_0x40b1[_0x27f9be];return _0x3e830f;};'use strict';var Sequelize=require('sequelize');module[_0x140b('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x140b('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0x140b('0x2'),'phonecall'),'defaultValue':_0x140b('0x2')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index cb36a68..f5174f0 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 _0xdc2f=['Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','json','offset','set','apply','reject','save','update','then','destroy','end','index','map','rawAttributes','fieldName','type','key','model','name','keys','filters','intersection','attributes','query','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','options','Dynamics365Configuration','count','includeAll','include','findAll','rows','show','params','find','create','body','catch','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','html-pdf','rimraf','request-promise','bluebird','mustache','util','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0xdc2f,0x1a8));var _0xfdc2=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xdc2f[_0x6cf19c];return _0xce14f3;};'use strict';var pdf=require(_0xfdc2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfdc2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfdc2('0x2'));var moment=require('moment');var BPromise=require(_0xfdc2('0x3'));var Mustache=require(_0xfdc2('0x4'));var util=require(_0xfdc2('0x5'));var path=require('path');var sox=require(_0xfdc2('0x6'));var csv=require(_0xfdc2('0x7'));var ejs=require(_0xfdc2('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xfdc2('0x9'));var jsforce=require(_0xfdc2('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xfdc2('0x7'));var querystring=require(_0xfdc2('0xb'));var Papa=require(_0xfdc2('0xc'));var Redis=require(_0xfdc2('0xd'));var authService=require(_0xfdc2('0xe'));var qs=require(_0xfdc2('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfdc2('0x10'));var logger=require(_0xfdc2('0x11'))('api');var utils=require(_0xfdc2('0x12'));var config=require(_0xfdc2('0x13'));var db=require(_0xfdc2('0x14'))['db'];var jayson=require(_0xfdc2('0x15'));var client=jayson[_0xfdc2('0x16')][_0xfdc2('0x17')]({'port':0x232a});function checkPasswordPattern(_0x1933f9,_0xab3380,_0x9227f8){if(_0x9227f8){var _0x16c5f3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x16c5f3['test'](_0xab3380)){return _0x1933f9;}else{throw new db['Sequelize'][(_0xfdc2('0x18'))](_0xfdc2('0x19'));}}else{return _0x1933f9;}}function respondWithRpcPromise(_0x35f553,_0x34de10,_0x47c33a,_0x2179ea){return new BPromise(function(_0x7e00c0,_0x5b7032){var _0x2f9dd8=_0x2179ea||client;return _0x2f9dd8[_0xfdc2('0x1a')](_0x35f553,_0x47c33a)['then'](function(_0x772588){logger[_0xfdc2('0x1b')](_0xfdc2('0x1c'),_0x34de10,_0xfdc2('0x1d'));logger[_0xfdc2('0x1e')](_0xfdc2('0x1f'),_0x34de10,_0xfdc2('0x1d'),JSON[_0xfdc2('0x20')](_0x772588));if(_0x772588[_0xfdc2('0x21')]){if(_0x772588[_0xfdc2('0x21')][_0xfdc2('0x22')]===0x1f4){logger[_0xfdc2('0x21')](_0xfdc2('0x1c'),_0x34de10,_0x772588[_0xfdc2('0x21')][_0xfdc2('0x23')]);return _0x5b7032(_0x772588[_0xfdc2('0x21')][_0xfdc2('0x23')]);}logger[_0xfdc2('0x21')](_0xfdc2('0x1c'),_0x34de10,_0x772588[_0xfdc2('0x21')]['message']);return _0x7e00c0(_0x772588[_0xfdc2('0x21')][_0xfdc2('0x23')]);}else{logger[_0xfdc2('0x1b')](_0xfdc2('0x1c'),_0x34de10,_0xfdc2('0x1d'));_0x7e00c0(_0x772588[_0xfdc2('0x24')][_0xfdc2('0x23')]);}})['catch'](function(_0x405074){logger[_0xfdc2('0x21')](_0xfdc2('0x1c'),_0x34de10,_0x405074);_0x5b7032(_0x405074);});});}function respondWithStatusCode(_0xa9ea70,_0x255e61){_0x255e61=_0x255e61||0xcc;return function(_0x59398e){if(_0x59398e){return _0xa9ea70[_0xfdc2('0x25')](_0x255e61);}return _0xa9ea70[_0xfdc2('0x26')](_0x255e61)['end']();};}function respondWithResult(_0x4d471a,_0x4092a6){_0x4092a6=_0x4092a6||0xc8;return function(_0x4345d7){if(_0x4345d7){return _0x4d471a[_0xfdc2('0x26')](_0x4092a6)[_0xfdc2('0x27')](_0x4345d7);}};}function respondWithFilteredResult(_0x5367d5,_0x166bf4){return function(_0x600fd8){if(_0x600fd8){var _0x1beb80=_0x600fd8['count'],_0x16080c=_0x166bf4[_0xfdc2('0x28')],_0x175727=_0x166bf4['offset']+_0x166bf4['limit'],_0x53968e;if(_0x175727>=_0x1beb80){_0x175727=_0x1beb80;_0x53968e=0xc8;}else{_0x53968e=0xce;}_0x5367d5[_0xfdc2('0x26')](_0x53968e);return _0x5367d5[_0xfdc2('0x29')]('Content-Range',_0x16080c+'-'+_0x175727+'/'+_0x1beb80)[_0xfdc2('0x27')](_0x600fd8);}return null;};}function patchUpdates(_0x2f2f14){return function(_0x4df3cd){try{jsonpatch[_0xfdc2('0x2a')](_0x4df3cd,_0x2f2f14,!![]);}catch(_0x56fc1b){return BPromise[_0xfdc2('0x2b')](_0x56fc1b);}return _0x4df3cd[_0xfdc2('0x2c')]();};}function saveUpdates(_0x475ecc,_0x17c663){return function(_0x427177){if(_0x427177){return _0x427177[_0xfdc2('0x2d')](_0x475ecc)[_0xfdc2('0x2e')](function(_0x406b30){return _0x406b30;});}return null;};}function removeEntity(_0x452b0a,_0x39a026){return function(_0x43f8d6){if(_0x43f8d6){return _0x43f8d6[_0xfdc2('0x2f')]()[_0xfdc2('0x2e')](function(){_0x452b0a[_0xfdc2('0x26')](0xcc)[_0xfdc2('0x30')]();});}};}function handleEntityNotFound(_0x49c605,_0x3a7691){return function(_0x1ed32c){if(!_0x1ed32c){_0x49c605[_0xfdc2('0x25')](0x194);}return _0x1ed32c;};}function handleError(_0x4cbd82,_0x8dc280){_0x8dc280=_0x8dc280||0x1f4;return function(_0x296873){logger[_0xfdc2('0x21')](_0x296873['stack']);if(_0x296873['name']){delete _0x296873['name'];}_0x4cbd82[_0xfdc2('0x26')](_0x8dc280)['send'](_0x296873);};}exports[_0xfdc2('0x31')]=function(_0x42b44a,_0x55874e){var _0x1b1605={},_0x4daf55={},_0x3748c6={'count':0x0,'rows':[]};var _0x435d53=_[_0xfdc2('0x32')](db['Dynamics365Configuration'][_0xfdc2('0x33')],function(_0x1091ce){return{'name':_0x1091ce[_0xfdc2('0x34')],'type':_0x1091ce[_0xfdc2('0x35')][_0xfdc2('0x36')]};});_0x4daf55[_0xfdc2('0x37')]=_[_0xfdc2('0x32')](_0x435d53,_0xfdc2('0x38'));_0x4daf55['query']=_[_0xfdc2('0x39')](_0x42b44a['query']);_0x4daf55[_0xfdc2('0x3a')]=_[_0xfdc2('0x3b')](_0x4daf55[_0xfdc2('0x37')],_0x4daf55['query']);_0x1b1605[_0xfdc2('0x3c')]=_[_0xfdc2('0x3b')](_0x4daf55['model'],qs['fields'](_0x42b44a[_0xfdc2('0x3d')][_0xfdc2('0x3e')]));_0x1b1605[_0xfdc2('0x3c')]=_0x1b1605[_0xfdc2('0x3c')][_0xfdc2('0x3f')]?_0x1b1605[_0xfdc2('0x3c')]:_0x4daf55[_0xfdc2('0x37')];if(!_0x42b44a['query'][_0xfdc2('0x40')](_0xfdc2('0x41'))){_0x1b1605[_0xfdc2('0x42')]=qs[_0xfdc2('0x42')](_0x42b44a[_0xfdc2('0x3d')][_0xfdc2('0x42')]);_0x1b1605[_0xfdc2('0x28')]=qs[_0xfdc2('0x28')](_0x42b44a['query'][_0xfdc2('0x28')]);}_0x1b1605[_0xfdc2('0x43')]=qs['sort'](_0x42b44a['query'][_0xfdc2('0x44')]);_0x1b1605['where']=qs[_0xfdc2('0x3a')](_[_0xfdc2('0x45')](_0x42b44a[_0xfdc2('0x3d')],_0x4daf55[_0xfdc2('0x3a')]));if(_0x42b44a[_0xfdc2('0x3d')][_0xfdc2('0x46')]){_0x1b1605[_0xfdc2('0x47')]=_[_0xfdc2('0x48')](_0x1b1605[_0xfdc2('0x47')],{'$or':_[_0xfdc2('0x32')](_0x435d53,function(_0x8529a0){if(_0x8529a0[_0xfdc2('0x35')]!=='VIRTUAL'){var _0x9a75f3={};_0x9a75f3[_0x8529a0['name']]={'$like':'%'+_0x42b44a['query'][_0xfdc2('0x46')]+'%'};return _0x9a75f3;}})});}_0x1b1605=_[_0xfdc2('0x48')]({},_0x1b1605,_0x42b44a[_0xfdc2('0x49')]);var _0x27111a={'where':_0x1b1605[_0xfdc2('0x47')]};return db[_0xfdc2('0x4a')]['count'](_0x27111a)[_0xfdc2('0x2e')](function(_0x34e9b7){_0x3748c6[_0xfdc2('0x4b')]=_0x34e9b7;if(_0x42b44a[_0xfdc2('0x3d')][_0xfdc2('0x4c')]){_0x1b1605[_0xfdc2('0x4d')]=[{'all':!![]}];}return db[_0xfdc2('0x4a')][_0xfdc2('0x4e')](_0x1b1605);})[_0xfdc2('0x2e')](function(_0xb5ecf0){_0x3748c6[_0xfdc2('0x4f')]=_0xb5ecf0;return _0x3748c6;})[_0xfdc2('0x2e')](respondWithFilteredResult(_0x55874e,_0x1b1605))['catch'](handleError(_0x55874e,null));};exports[_0xfdc2('0x50')]=function(_0x5a23c8,_0x77187d){var _0x3f2c24={'raw':![],'where':{'id':_0x5a23c8[_0xfdc2('0x51')]['id']}},_0x53ae09={};_0x53ae09[_0xfdc2('0x37')]=_[_0xfdc2('0x39')](db['Dynamics365Configuration']['rawAttributes']);_0x53ae09[_0xfdc2('0x3d')]=_[_0xfdc2('0x39')](_0x5a23c8[_0xfdc2('0x3d')]);_0x53ae09[_0xfdc2('0x3a')]=_['intersection'](_0x53ae09[_0xfdc2('0x37')],_0x53ae09[_0xfdc2('0x3d')]);_0x3f2c24[_0xfdc2('0x3c')]=_[_0xfdc2('0x3b')](_0x53ae09[_0xfdc2('0x37')],qs['fields'](_0x5a23c8[_0xfdc2('0x3d')][_0xfdc2('0x3e')]));_0x3f2c24[_0xfdc2('0x3c')]=_0x3f2c24['attributes'][_0xfdc2('0x3f')]?_0x3f2c24['attributes']:_0x53ae09[_0xfdc2('0x37')];if(_0x5a23c8[_0xfdc2('0x3d')][_0xfdc2('0x4c')]){_0x3f2c24['include']=[{'all':!![]}];}_0x3f2c24=_[_0xfdc2('0x48')]({},_0x3f2c24,_0x5a23c8[_0xfdc2('0x49')]);return db['Dynamics365Configuration'][_0xfdc2('0x52')](_0x3f2c24)[_0xfdc2('0x2e')](handleEntityNotFound(_0x77187d,null))[_0xfdc2('0x2e')](respondWithResult(_0x77187d,null))['catch'](handleError(_0x77187d,null));};exports[_0xfdc2('0x53')]=function(_0x5e8a61,_0x4ae04a){return db[_0xfdc2('0x4a')][_0xfdc2('0x53')](_0x5e8a61[_0xfdc2('0x54')],{})[_0xfdc2('0x2e')](respondWithResult(_0x4ae04a,0xc9))[_0xfdc2('0x55')](handleError(_0x4ae04a,null));};exports[_0xfdc2('0x2d')]=function(_0x55af23,_0x5b81d7){if(_0x55af23[_0xfdc2('0x54')]['id']){delete _0x55af23[_0xfdc2('0x54')]['id'];}return db[_0xfdc2('0x4a')][_0xfdc2('0x52')]({'where':{'id':_0x55af23[_0xfdc2('0x51')]['id']}})[_0xfdc2('0x2e')](handleEntityNotFound(_0x5b81d7,null))[_0xfdc2('0x2e')](saveUpdates(_0x55af23[_0xfdc2('0x54')],null))[_0xfdc2('0x2e')](respondWithResult(_0x5b81d7,null))['catch'](handleError(_0x5b81d7,null));};exports[_0xfdc2('0x2f')]=function(_0x52128e,_0x22f477){return db[_0xfdc2('0x4a')][_0xfdc2('0x52')]({'where':{'id':_0x52128e[_0xfdc2('0x51')]['id']}})[_0xfdc2('0x2e')](handleEntityNotFound(_0x22f477,null))[_0xfdc2('0x2e')](removeEntity(_0x22f477,null))[_0xfdc2('0x55')](handleError(_0x22f477,null));};exports[_0xfdc2('0x56')]=function(_0x4d30f1,_0x5cf41a,_0x2d9fab){var _0x760ee7={};var _0x97d1d9={};var _0x1d24df;var _0x1e9dc0;return db[_0xfdc2('0x4a')][_0xfdc2('0x57')]({'where':{'id':_0x4d30f1[_0xfdc2('0x51')]['id']}})[_0xfdc2('0x2e')](handleEntityNotFound(_0x5cf41a,null))['then'](function(_0xa5b3b4){if(_0xa5b3b4){_0x1d24df=_0xa5b3b4;_0x97d1d9[_0xfdc2('0x37')]=_[_0xfdc2('0x39')](db[_0xfdc2('0x58')][_0xfdc2('0x33')]);_0x97d1d9['query']=_['keys'](_0x4d30f1[_0xfdc2('0x3d')]);_0x97d1d9[_0xfdc2('0x3a')]=_[_0xfdc2('0x3b')](_0x97d1d9['model'],_0x97d1d9[_0xfdc2('0x3d')]);_0x760ee7[_0xfdc2('0x3c')]=_[_0xfdc2('0x3b')](_0x97d1d9[_0xfdc2('0x37')],qs[_0xfdc2('0x3e')](_0x4d30f1['query']['fields']));_0x760ee7[_0xfdc2('0x3c')]=_0x760ee7[_0xfdc2('0x3c')][_0xfdc2('0x3f')]?_0x760ee7[_0xfdc2('0x3c')]:_0x97d1d9['model'];_0x760ee7[_0xfdc2('0x43')]=qs[_0xfdc2('0x44')](_0x4d30f1[_0xfdc2('0x3d')][_0xfdc2('0x44')]);_0x760ee7[_0xfdc2('0x47')]=qs['filters'](_[_0xfdc2('0x45')](_0x4d30f1[_0xfdc2('0x3d')],_0x97d1d9[_0xfdc2('0x3a')]));if(_0x4d30f1[_0xfdc2('0x3d')][_0xfdc2('0x46')]){_0x760ee7[_0xfdc2('0x47')]=_[_0xfdc2('0x48')](_0x760ee7[_0xfdc2('0x47')],{'$or':_[_0xfdc2('0x32')](_0x760ee7[_0xfdc2('0x3c')],function(_0x1d0f1e){var _0x2147ad={};_0x2147ad[_0x1d0f1e]={'$like':'%'+_0x4d30f1[_0xfdc2('0x3d')]['filter']+'%'};return _0x2147ad;})});}_0x760ee7=_[_0xfdc2('0x48')]({},_0x760ee7,_0x4d30f1[_0xfdc2('0x49')]);return _0x1d24df[_0xfdc2('0x56')](_0x760ee7);}})[_0xfdc2('0x2e')](function(_0x5c7a00){if(_0x5c7a00){_0x1e9dc0=_0x5c7a00[_0xfdc2('0x3f')];if(!_0x4d30f1[_0xfdc2('0x3d')][_0xfdc2('0x40')]('nolimit')){_0x760ee7['limit']=qs[_0xfdc2('0x42')](_0x4d30f1[_0xfdc2('0x3d')]['limit']);_0x760ee7[_0xfdc2('0x28')]=qs['offset'](_0x4d30f1['query'][_0xfdc2('0x28')]);}return _0x1d24df['getFields'](_0x760ee7);}})[_0xfdc2('0x2e')](function(_0x37c985){if(_0x37c985){return _0x37c985?{'count':_0x1e9dc0,'rows':_0x37c985}:null;}})[_0xfdc2('0x2e')](respondWithResult(_0x5cf41a,null))['catch'](handleError(_0x5cf41a,null));};exports[_0xfdc2('0x59')]=function(_0x2df6b1,_0x5d1e18,_0x8bb969){var _0x13ec8b={};var _0x152926={};var _0x5db479;var _0x27163b;return db[_0xfdc2('0x4a')][_0xfdc2('0x57')]({'where':{'id':_0x2df6b1[_0xfdc2('0x51')]['id']}})[_0xfdc2('0x2e')](handleEntityNotFound(_0x5d1e18,null))['then'](function(_0x570023){if(_0x570023){_0x5db479=_0x570023;_0x152926['model']=_['keys'](db[_0xfdc2('0x58')][_0xfdc2('0x33')]);_0x152926[_0xfdc2('0x3d')]=_[_0xfdc2('0x39')](_0x2df6b1['query']);_0x152926[_0xfdc2('0x3a')]=_[_0xfdc2('0x3b')](_0x152926['model'],_0x152926[_0xfdc2('0x3d')]);_0x13ec8b[_0xfdc2('0x3c')]=_[_0xfdc2('0x3b')](_0x152926[_0xfdc2('0x37')],qs[_0xfdc2('0x3e')](_0x2df6b1[_0xfdc2('0x3d')][_0xfdc2('0x3e')]));_0x13ec8b[_0xfdc2('0x3c')]=_0x13ec8b[_0xfdc2('0x3c')][_0xfdc2('0x3f')]?_0x13ec8b[_0xfdc2('0x3c')]:_0x152926[_0xfdc2('0x37')];_0x13ec8b[_0xfdc2('0x43')]=qs[_0xfdc2('0x44')](_0x2df6b1[_0xfdc2('0x3d')][_0xfdc2('0x44')]);_0x13ec8b[_0xfdc2('0x47')]=qs[_0xfdc2('0x3a')](_[_0xfdc2('0x45')](_0x2df6b1[_0xfdc2('0x3d')],_0x152926[_0xfdc2('0x3a')]));if(_0x2df6b1[_0xfdc2('0x3d')][_0xfdc2('0x46')]){_0x13ec8b[_0xfdc2('0x47')]=_[_0xfdc2('0x48')](_0x13ec8b[_0xfdc2('0x47')],{'$or':_[_0xfdc2('0x32')](_0x13ec8b[_0xfdc2('0x3c')],function(_0x3d8022){var _0x1a4f0d={};_0x1a4f0d[_0x3d8022]={'$like':'%'+_0x2df6b1[_0xfdc2('0x3d')]['filter']+'%'};return _0x1a4f0d;})});}_0x13ec8b=_[_0xfdc2('0x48')]({},_0x13ec8b,_0x2df6b1[_0xfdc2('0x49')]);return _0x5db479[_0xfdc2('0x59')](_0x13ec8b);}})[_0xfdc2('0x2e')](function(_0x189bf1){if(_0x189bf1){_0x27163b=_0x189bf1[_0xfdc2('0x3f')];if(!_0x2df6b1[_0xfdc2('0x3d')][_0xfdc2('0x40')](_0xfdc2('0x41'))){_0x13ec8b['limit']=qs[_0xfdc2('0x42')](_0x2df6b1[_0xfdc2('0x3d')][_0xfdc2('0x42')]);_0x13ec8b['offset']=qs['offset'](_0x2df6b1[_0xfdc2('0x3d')][_0xfdc2('0x28')]);}return _0x5db479[_0xfdc2('0x59')](_0x13ec8b);}})[_0xfdc2('0x2e')](function(_0x100dad){if(_0x100dad){return _0x100dad?{'count':_0x27163b,'rows':_0x100dad}:null;}})['then'](respondWithResult(_0x5d1e18,null))[_0xfdc2('0x55')](handleError(_0x5d1e18,null));};exports[_0xfdc2('0x5a')]=function(_0x1a5906,_0x5727d6,_0x32579b){var _0x138f91={};var _0x3e1deb={};var _0x2b6d91;var _0x50d3de;return db[_0xfdc2('0x4a')][_0xfdc2('0x57')]({'where':{'id':_0x1a5906['params']['id']}})[_0xfdc2('0x2e')](handleEntityNotFound(_0x5727d6,null))[_0xfdc2('0x2e')](function(_0x49a8ea){if(_0x49a8ea){_0x2b6d91=_0x49a8ea;_0x3e1deb[_0xfdc2('0x37')]=_[_0xfdc2('0x39')](db['Dynamics365Field']['rawAttributes']);_0x3e1deb[_0xfdc2('0x3d')]=_[_0xfdc2('0x39')](_0x1a5906[_0xfdc2('0x3d')]);_0x3e1deb[_0xfdc2('0x3a')]=_[_0xfdc2('0x3b')](_0x3e1deb[_0xfdc2('0x37')],_0x3e1deb['query']);_0x138f91[_0xfdc2('0x3c')]=_[_0xfdc2('0x3b')](_0x3e1deb[_0xfdc2('0x37')],qs[_0xfdc2('0x3e')](_0x1a5906[_0xfdc2('0x3d')][_0xfdc2('0x3e')]));_0x138f91[_0xfdc2('0x3c')]=_0x138f91[_0xfdc2('0x3c')][_0xfdc2('0x3f')]?_0x138f91['attributes']:_0x3e1deb['model'];_0x138f91['order']=qs['sort'](_0x1a5906[_0xfdc2('0x3d')]['sort']);_0x138f91[_0xfdc2('0x47')]=qs['filters'](_['pick'](_0x1a5906[_0xfdc2('0x3d')],_0x3e1deb[_0xfdc2('0x3a')]));if(_0x1a5906[_0xfdc2('0x3d')]['filter']){_0x138f91[_0xfdc2('0x47')]=_[_0xfdc2('0x48')](_0x138f91[_0xfdc2('0x47')],{'$or':_[_0xfdc2('0x32')](_0x138f91[_0xfdc2('0x3c')],function(_0x50efd2){var _0x175f88={};_0x175f88[_0x50efd2]={'$like':'%'+_0x1a5906[_0xfdc2('0x3d')][_0xfdc2('0x46')]+'%'};return _0x175f88;})});}_0x138f91=_[_0xfdc2('0x48')]({},_0x138f91,_0x1a5906[_0xfdc2('0x49')]);return _0x2b6d91[_0xfdc2('0x5a')](_0x138f91);}})['then'](function(_0x387a4e){if(_0x387a4e){_0x50d3de=_0x387a4e['length'];if(!_0x1a5906['query']['hasOwnProperty']('nolimit')){_0x138f91['limit']=qs[_0xfdc2('0x42')](_0x1a5906[_0xfdc2('0x3d')][_0xfdc2('0x42')]);_0x138f91[_0xfdc2('0x28')]=qs[_0xfdc2('0x28')](_0x1a5906[_0xfdc2('0x3d')]['offset']);}return _0x2b6d91[_0xfdc2('0x5a')](_0x138f91);}})['then'](function(_0x4fee0d){if(_0x4fee0d){return _0x4fee0d?{'count':_0x50d3de,'rows':_0x4fee0d}:null;}})['then'](respondWithResult(_0x5727d6,null))[_0xfdc2('0x55')](handleError(_0x5727d6,null));}; \ No newline at end of file +var _0xa713=['offset','limit','set','Content-Range','apply','reject','save','destroy','sendStatus','name','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','map','merge','options','Dynamics365Configuration','rows','show','includeAll','include','find','body','update','params','getFields','Dynamics365Field','getSubjects','findOne','nolimit','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','request\x20sent','debug','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','info','result','catch','end','status','json','count'];(function(_0x37db9f,_0x4c93ed){var _0x48fb29=function(_0x5d27a4){while(--_0x5d27a4){_0x37db9f['push'](_0x37db9f['shift']());}};_0x48fb29(++_0x4c93ed);}(_0xa713,0x89));var _0x3a71=function(_0xf3bf1d,_0x442cb7){_0xf3bf1d=_0xf3bf1d-0x0;var _0x2472a6=_0xa713[_0xf3bf1d];return _0x2472a6;};'use strict';var pdf=require(_0x3a71('0x0'));var emlformat=require(_0x3a71('0x1'));var rimraf=require(_0x3a71('0x2'));var zipdir=require(_0x3a71('0x3'));var jsonpatch=require(_0x3a71('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3a71('0x5'));var Mustache=require(_0x3a71('0x6'));var util=require(_0x3a71('0x7'));var path=require('path');var sox=require(_0x3a71('0x8'));var csv=require(_0x3a71('0x9'));var ejs=require(_0x3a71('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3a71('0xb'));var crypto=require(_0x3a71('0xc'));var jsforce=require(_0x3a71('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3a71('0x9'));var querystring=require(_0x3a71('0xe'));var Papa=require('papaparse');var Redis=require(_0x3a71('0xf'));var authService=require(_0x3a71('0x10'));var qs=require(_0x3a71('0x11'));var as=require(_0x3a71('0x12'));var hardwareService=require(_0x3a71('0x13'));var logger=require(_0x3a71('0x14'))(_0x3a71('0x15'));var utils=require(_0x3a71('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0x3a71('0x17'));var client=jayson[_0x3a71('0x18')][_0x3a71('0x19')]({'port':0x232a});function checkPasswordPattern(_0x45e090,_0x51785f,_0x25af3d){if(_0x25af3d){var _0x3c1aa5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3c1aa5[_0x3a71('0x1a')](_0x51785f)){return _0x45e090;}else{throw new db[(_0x3a71('0x1b'))][(_0x3a71('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 _0x45e090;}}function respondWithRpcPromise(_0x36c5c3,_0x12ec76,_0x1fa3f6,_0xfe4e74){return new BPromise(function(_0x438280,_0x5e03ea){var _0x403a5f=_0xfe4e74||client;return _0x403a5f[_0x3a71('0x1d')](_0x36c5c3,_0x1fa3f6)[_0x3a71('0x1e')](function(_0x2e3d55){logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x12ec76,_0x3a71('0x1f'));logger[_0x3a71('0x20')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x12ec76,_0x3a71('0x1f'),JSON[_0x3a71('0x21')](_0x2e3d55));if(_0x2e3d55[_0x3a71('0x22')]){if(_0x2e3d55[_0x3a71('0x22')][_0x3a71('0x23')]===0x1f4){logger[_0x3a71('0x22')](_0x3a71('0x24'),_0x12ec76,_0x2e3d55['error'][_0x3a71('0x25')]);return _0x5e03ea(_0x2e3d55[_0x3a71('0x22')][_0x3a71('0x25')]);}logger[_0x3a71('0x22')](_0x3a71('0x24'),_0x12ec76,_0x2e3d55[_0x3a71('0x22')][_0x3a71('0x25')]);return _0x438280(_0x2e3d55[_0x3a71('0x22')]['message']);}else{logger[_0x3a71('0x26')](_0x3a71('0x24'),_0x12ec76,_0x3a71('0x1f'));_0x438280(_0x2e3d55[_0x3a71('0x27')][_0x3a71('0x25')]);}})[_0x3a71('0x28')](function(_0x336d3e){logger[_0x3a71('0x22')](_0x3a71('0x24'),_0x12ec76,_0x336d3e);_0x5e03ea(_0x336d3e);});});}function respondWithStatusCode(_0x37da40,_0x282846){_0x282846=_0x282846||0xcc;return function(_0xd9ac73){if(_0xd9ac73){return _0x37da40['sendStatus'](_0x282846);}return _0x37da40['status'](_0x282846)[_0x3a71('0x29')]();};}function respondWithResult(_0x76d241,_0x3b2e7f){_0x3b2e7f=_0x3b2e7f||0xc8;return function(_0x497a17){if(_0x497a17){return _0x76d241[_0x3a71('0x2a')](_0x3b2e7f)[_0x3a71('0x2b')](_0x497a17);}};}function respondWithFilteredResult(_0x143c8f,_0x238b43){return function(_0x32ef40){if(_0x32ef40){var _0x43565d=_0x32ef40[_0x3a71('0x2c')],_0x339073=_0x238b43[_0x3a71('0x2d')],_0x2a533d=_0x238b43[_0x3a71('0x2d')]+_0x238b43[_0x3a71('0x2e')],_0x494ecc;if(_0x2a533d>=_0x43565d){_0x2a533d=_0x43565d;_0x494ecc=0xc8;}else{_0x494ecc=0xce;}_0x143c8f[_0x3a71('0x2a')](_0x494ecc);return _0x143c8f[_0x3a71('0x2f')](_0x3a71('0x30'),_0x339073+'-'+_0x2a533d+'/'+_0x43565d)[_0x3a71('0x2b')](_0x32ef40);}return null;};}function patchUpdates(_0x439267){return function(_0x35ba99){try{jsonpatch[_0x3a71('0x31')](_0x35ba99,_0x439267,!![]);}catch(_0x330e38){return BPromise[_0x3a71('0x32')](_0x330e38);}return _0x35ba99[_0x3a71('0x33')]();};}function saveUpdates(_0x1bea3,_0x459805){return function(_0x2440ed){if(_0x2440ed){return _0x2440ed['update'](_0x1bea3)[_0x3a71('0x1e')](function(_0xe83b59){return _0xe83b59;});}return null;};}function removeEntity(_0x8e4370,_0x334123){return function(_0x86cf4e){if(_0x86cf4e){return _0x86cf4e[_0x3a71('0x34')]()[_0x3a71('0x1e')](function(){_0x8e4370['status'](0xcc)[_0x3a71('0x29')]();});}};}function handleEntityNotFound(_0x419939,_0xa570dd){return function(_0x253f9a){if(!_0x253f9a){_0x419939[_0x3a71('0x35')](0x194);}return _0x253f9a;};}function handleError(_0x1eac89,_0x13f5a1){_0x13f5a1=_0x13f5a1||0x1f4;return function(_0x1e7456){logger['error'](_0x1e7456['stack']);if(_0x1e7456[_0x3a71('0x36')]){delete _0x1e7456[_0x3a71('0x36')];}_0x1eac89[_0x3a71('0x2a')](_0x13f5a1)['send'](_0x1e7456);};}exports['index']=function(_0x33b3ea,_0x30e72a){var _0x1cef9c={},_0x2b1dd1={},_0x5143a1={'count':0x0,'rows':[]};var _0x4a37ec=_['map'](db['Dynamics365Configuration'][_0x3a71('0x37')],function(_0x2982b8){return{'name':_0x2982b8[_0x3a71('0x38')],'type':_0x2982b8[_0x3a71('0x39')][_0x3a71('0x3a')]};});_0x2b1dd1[_0x3a71('0x3b')]=_['map'](_0x4a37ec,_0x3a71('0x36'));_0x2b1dd1['query']=_[_0x3a71('0x3c')](_0x33b3ea[_0x3a71('0x3d')]);_0x2b1dd1[_0x3a71('0x3e')]=_[_0x3a71('0x3f')](_0x2b1dd1['model'],_0x2b1dd1[_0x3a71('0x3d')]);_0x1cef9c[_0x3a71('0x40')]=_[_0x3a71('0x3f')](_0x2b1dd1[_0x3a71('0x3b')],qs[_0x3a71('0x41')](_0x33b3ea[_0x3a71('0x3d')][_0x3a71('0x41')]));_0x1cef9c['attributes']=_0x1cef9c['attributes'][_0x3a71('0x42')]?_0x1cef9c[_0x3a71('0x40')]:_0x2b1dd1[_0x3a71('0x3b')];if(!_0x33b3ea['query'][_0x3a71('0x43')]('nolimit')){_0x1cef9c['limit']=qs[_0x3a71('0x2e')](_0x33b3ea['query']['limit']);_0x1cef9c[_0x3a71('0x2d')]=qs['offset'](_0x33b3ea['query'][_0x3a71('0x2d')]);}_0x1cef9c[_0x3a71('0x44')]=qs['sort'](_0x33b3ea[_0x3a71('0x3d')][_0x3a71('0x45')]);_0x1cef9c[_0x3a71('0x46')]=qs['filters'](_[_0x3a71('0x47')](_0x33b3ea[_0x3a71('0x3d')],_0x2b1dd1[_0x3a71('0x3e')]));if(_0x33b3ea['query'][_0x3a71('0x48')]){_0x1cef9c['where']=_['merge'](_0x1cef9c[_0x3a71('0x46')],{'$or':_[_0x3a71('0x49')](_0x4a37ec,function(_0x49fc19){if(_0x49fc19[_0x3a71('0x39')]!=='VIRTUAL'){var _0x3f49b5={};_0x3f49b5[_0x49fc19[_0x3a71('0x36')]]={'$like':'%'+_0x33b3ea[_0x3a71('0x3d')][_0x3a71('0x48')]+'%'};return _0x3f49b5;}})});}_0x1cef9c=_[_0x3a71('0x4a')]({},_0x1cef9c,_0x33b3ea[_0x3a71('0x4b')]);var _0x1f3908={'where':_0x1cef9c[_0x3a71('0x46')]};return db[_0x3a71('0x4c')][_0x3a71('0x2c')](_0x1f3908)[_0x3a71('0x1e')](function(_0x5c078b){_0x5143a1[_0x3a71('0x2c')]=_0x5c078b;if(_0x33b3ea[_0x3a71('0x3d')]['includeAll']){_0x1cef9c['include']=[{'all':!![]}];}return db[_0x3a71('0x4c')]['findAll'](_0x1cef9c);})[_0x3a71('0x1e')](function(_0x1e8f84){_0x5143a1[_0x3a71('0x4d')]=_0x1e8f84;return _0x5143a1;})[_0x3a71('0x1e')](respondWithFilteredResult(_0x30e72a,_0x1cef9c))[_0x3a71('0x28')](handleError(_0x30e72a,null));};exports[_0x3a71('0x4e')]=function(_0x41ebfb,_0x554407){var _0x4e83c7={'raw':![],'where':{'id':_0x41ebfb['params']['id']}},_0x38ff82={};_0x38ff82[_0x3a71('0x3b')]=_[_0x3a71('0x3c')](db[_0x3a71('0x4c')][_0x3a71('0x37')]);_0x38ff82[_0x3a71('0x3d')]=_[_0x3a71('0x3c')](_0x41ebfb[_0x3a71('0x3d')]);_0x38ff82[_0x3a71('0x3e')]=_[_0x3a71('0x3f')](_0x38ff82[_0x3a71('0x3b')],_0x38ff82[_0x3a71('0x3d')]);_0x4e83c7[_0x3a71('0x40')]=_[_0x3a71('0x3f')](_0x38ff82[_0x3a71('0x3b')],qs[_0x3a71('0x41')](_0x41ebfb[_0x3a71('0x3d')][_0x3a71('0x41')]));_0x4e83c7[_0x3a71('0x40')]=_0x4e83c7['attributes'][_0x3a71('0x42')]?_0x4e83c7[_0x3a71('0x40')]:_0x38ff82[_0x3a71('0x3b')];if(_0x41ebfb[_0x3a71('0x3d')][_0x3a71('0x4f')]){_0x4e83c7[_0x3a71('0x50')]=[{'all':!![]}];}_0x4e83c7=_[_0x3a71('0x4a')]({},_0x4e83c7,_0x41ebfb[_0x3a71('0x4b')]);return db[_0x3a71('0x4c')][_0x3a71('0x51')](_0x4e83c7)[_0x3a71('0x1e')](handleEntityNotFound(_0x554407,null))[_0x3a71('0x1e')](respondWithResult(_0x554407,null))[_0x3a71('0x28')](handleError(_0x554407,null));};exports['create']=function(_0x8822be,_0x6b7614){return db[_0x3a71('0x4c')]['create'](_0x8822be[_0x3a71('0x52')],{})[_0x3a71('0x1e')](respondWithResult(_0x6b7614,0xc9))[_0x3a71('0x28')](handleError(_0x6b7614,null));};exports[_0x3a71('0x53')]=function(_0xe57801,_0x60a807){if(_0xe57801[_0x3a71('0x52')]['id']){delete _0xe57801['body']['id'];}return db[_0x3a71('0x4c')][_0x3a71('0x51')]({'where':{'id':_0xe57801['params']['id']}})['then'](handleEntityNotFound(_0x60a807,null))[_0x3a71('0x1e')](saveUpdates(_0xe57801[_0x3a71('0x52')],null))[_0x3a71('0x1e')](respondWithResult(_0x60a807,null))[_0x3a71('0x28')](handleError(_0x60a807,null));};exports[_0x3a71('0x34')]=function(_0x146b8b,_0x26e9d3){return db[_0x3a71('0x4c')][_0x3a71('0x51')]({'where':{'id':_0x146b8b[_0x3a71('0x54')]['id']}})[_0x3a71('0x1e')](handleEntityNotFound(_0x26e9d3,null))[_0x3a71('0x1e')](removeEntity(_0x26e9d3,null))[_0x3a71('0x28')](handleError(_0x26e9d3,null));};exports[_0x3a71('0x55')]=function(_0x160dcc,_0x3e605c,_0x1e4e84){var _0x5795e2={};var _0x7888c3={};var _0x3bb167;var _0x55ed58;return db[_0x3a71('0x4c')]['findOne']({'where':{'id':_0x160dcc[_0x3a71('0x54')]['id']}})[_0x3a71('0x1e')](handleEntityNotFound(_0x3e605c,null))['then'](function(_0x38d3a6){if(_0x38d3a6){_0x3bb167=_0x38d3a6;_0x7888c3[_0x3a71('0x3b')]=_[_0x3a71('0x3c')](db[_0x3a71('0x56')][_0x3a71('0x37')]);_0x7888c3[_0x3a71('0x3d')]=_[_0x3a71('0x3c')](_0x160dcc['query']);_0x7888c3[_0x3a71('0x3e')]=_['intersection'](_0x7888c3[_0x3a71('0x3b')],_0x7888c3[_0x3a71('0x3d')]);_0x5795e2['attributes']=_[_0x3a71('0x3f')](_0x7888c3[_0x3a71('0x3b')],qs['fields'](_0x160dcc[_0x3a71('0x3d')][_0x3a71('0x41')]));_0x5795e2[_0x3a71('0x40')]=_0x5795e2['attributes']['length']?_0x5795e2[_0x3a71('0x40')]:_0x7888c3['model'];_0x5795e2[_0x3a71('0x44')]=qs[_0x3a71('0x45')](_0x160dcc['query'][_0x3a71('0x45')]);_0x5795e2[_0x3a71('0x46')]=qs['filters'](_[_0x3a71('0x47')](_0x160dcc[_0x3a71('0x3d')],_0x7888c3[_0x3a71('0x3e')]));if(_0x160dcc[_0x3a71('0x3d')]['filter']){_0x5795e2[_0x3a71('0x46')]=_[_0x3a71('0x4a')](_0x5795e2[_0x3a71('0x46')],{'$or':_[_0x3a71('0x49')](_0x5795e2[_0x3a71('0x40')],function(_0x3c5c99){var _0xb575f8={};_0xb575f8[_0x3c5c99]={'$like':'%'+_0x160dcc[_0x3a71('0x3d')][_0x3a71('0x48')]+'%'};return _0xb575f8;})});}_0x5795e2=_[_0x3a71('0x4a')]({},_0x5795e2,_0x160dcc[_0x3a71('0x4b')]);return _0x3bb167[_0x3a71('0x55')](_0x5795e2);}})[_0x3a71('0x1e')](function(_0x54341d){if(_0x54341d){_0x55ed58=_0x54341d[_0x3a71('0x42')];if(!_0x160dcc[_0x3a71('0x3d')][_0x3a71('0x43')]('nolimit')){_0x5795e2[_0x3a71('0x2e')]=qs[_0x3a71('0x2e')](_0x160dcc[_0x3a71('0x3d')]['limit']);_0x5795e2['offset']=qs[_0x3a71('0x2d')](_0x160dcc[_0x3a71('0x3d')][_0x3a71('0x2d')]);}return _0x3bb167['getFields'](_0x5795e2);}})[_0x3a71('0x1e')](function(_0xcb7935){if(_0xcb7935){return _0xcb7935?{'count':_0x55ed58,'rows':_0xcb7935}:null;}})[_0x3a71('0x1e')](respondWithResult(_0x3e605c,null))[_0x3a71('0x28')](handleError(_0x3e605c,null));};exports[_0x3a71('0x57')]=function(_0x4fd038,_0x3c9101,_0x277861){var _0x64c5e2={};var _0x337e3c={};var _0x1ada2;var _0x4f4e5e;return db[_0x3a71('0x4c')][_0x3a71('0x58')]({'where':{'id':_0x4fd038[_0x3a71('0x54')]['id']}})[_0x3a71('0x1e')](handleEntityNotFound(_0x3c9101,null))[_0x3a71('0x1e')](function(_0x20183a){if(_0x20183a){_0x1ada2=_0x20183a;_0x337e3c['model']=_[_0x3a71('0x3c')](db['Dynamics365Field']['rawAttributes']);_0x337e3c[_0x3a71('0x3d')]=_['keys'](_0x4fd038[_0x3a71('0x3d')]);_0x337e3c[_0x3a71('0x3e')]=_[_0x3a71('0x3f')](_0x337e3c[_0x3a71('0x3b')],_0x337e3c[_0x3a71('0x3d')]);_0x64c5e2[_0x3a71('0x40')]=_['intersection'](_0x337e3c[_0x3a71('0x3b')],qs['fields'](_0x4fd038[_0x3a71('0x3d')][_0x3a71('0x41')]));_0x64c5e2['attributes']=_0x64c5e2[_0x3a71('0x40')][_0x3a71('0x42')]?_0x64c5e2[_0x3a71('0x40')]:_0x337e3c[_0x3a71('0x3b')];_0x64c5e2[_0x3a71('0x44')]=qs['sort'](_0x4fd038[_0x3a71('0x3d')][_0x3a71('0x45')]);_0x64c5e2[_0x3a71('0x46')]=qs[_0x3a71('0x3e')](_[_0x3a71('0x47')](_0x4fd038[_0x3a71('0x3d')],_0x337e3c[_0x3a71('0x3e')]));if(_0x4fd038[_0x3a71('0x3d')][_0x3a71('0x48')]){_0x64c5e2[_0x3a71('0x46')]=_[_0x3a71('0x4a')](_0x64c5e2['where'],{'$or':_['map'](_0x64c5e2[_0x3a71('0x40')],function(_0x49d057){var _0x51e8e8={};_0x51e8e8[_0x49d057]={'$like':'%'+_0x4fd038[_0x3a71('0x3d')][_0x3a71('0x48')]+'%'};return _0x51e8e8;})});}_0x64c5e2=_['merge']({},_0x64c5e2,_0x4fd038['options']);return _0x1ada2[_0x3a71('0x57')](_0x64c5e2);}})[_0x3a71('0x1e')](function(_0x4f68a4){if(_0x4f68a4){_0x4f4e5e=_0x4f68a4[_0x3a71('0x42')];if(!_0x4fd038['query'][_0x3a71('0x43')](_0x3a71('0x59'))){_0x64c5e2[_0x3a71('0x2e')]=qs[_0x3a71('0x2e')](_0x4fd038[_0x3a71('0x3d')][_0x3a71('0x2e')]);_0x64c5e2[_0x3a71('0x2d')]=qs[_0x3a71('0x2d')](_0x4fd038[_0x3a71('0x3d')][_0x3a71('0x2d')]);}return _0x1ada2[_0x3a71('0x57')](_0x64c5e2);}})[_0x3a71('0x1e')](function(_0x34989d){if(_0x34989d){return _0x34989d?{'count':_0x4f4e5e,'rows':_0x34989d}:null;}})['then'](respondWithResult(_0x3c9101,null))['catch'](handleError(_0x3c9101,null));};exports[_0x3a71('0x5a')]=function(_0x2779f,_0x26668a,_0x32bc58){var _0x36e717={};var _0x4b3362={};var _0x56e1e4;var _0x429823;return db[_0x3a71('0x4c')][_0x3a71('0x58')]({'where':{'id':_0x2779f['params']['id']}})[_0x3a71('0x1e')](handleEntityNotFound(_0x26668a,null))['then'](function(_0x1efe89){if(_0x1efe89){_0x56e1e4=_0x1efe89;_0x4b3362['model']=_['keys'](db[_0x3a71('0x56')][_0x3a71('0x37')]);_0x4b3362[_0x3a71('0x3d')]=_[_0x3a71('0x3c')](_0x2779f['query']);_0x4b3362['filters']=_[_0x3a71('0x3f')](_0x4b3362['model'],_0x4b3362['query']);_0x36e717[_0x3a71('0x40')]=_[_0x3a71('0x3f')](_0x4b3362['model'],qs[_0x3a71('0x41')](_0x2779f[_0x3a71('0x3d')][_0x3a71('0x41')]));_0x36e717[_0x3a71('0x40')]=_0x36e717[_0x3a71('0x40')]['length']?_0x36e717[_0x3a71('0x40')]:_0x4b3362[_0x3a71('0x3b')];_0x36e717[_0x3a71('0x44')]=qs['sort'](_0x2779f['query']['sort']);_0x36e717[_0x3a71('0x46')]=qs[_0x3a71('0x3e')](_[_0x3a71('0x47')](_0x2779f[_0x3a71('0x3d')],_0x4b3362['filters']));if(_0x2779f['query'][_0x3a71('0x48')]){_0x36e717[_0x3a71('0x46')]=_[_0x3a71('0x4a')](_0x36e717[_0x3a71('0x46')],{'$or':_[_0x3a71('0x49')](_0x36e717[_0x3a71('0x40')],function(_0x1f0906){var _0x480d9c={};_0x480d9c[_0x1f0906]={'$like':'%'+_0x2779f[_0x3a71('0x3d')][_0x3a71('0x48')]+'%'};return _0x480d9c;})});}_0x36e717=_['merge']({},_0x36e717,_0x2779f[_0x3a71('0x4b')]);return _0x56e1e4['getDescriptions'](_0x36e717);}})[_0x3a71('0x1e')](function(_0x6dcd5b){if(_0x6dcd5b){_0x429823=_0x6dcd5b[_0x3a71('0x42')];if(!_0x2779f['query'][_0x3a71('0x43')](_0x3a71('0x59'))){_0x36e717[_0x3a71('0x2e')]=qs['limit'](_0x2779f['query'][_0x3a71('0x2e')]);_0x36e717[_0x3a71('0x2d')]=qs[_0x3a71('0x2d')](_0x2779f[_0x3a71('0x3d')][_0x3a71('0x2d')]);}return _0x56e1e4['getDescriptions'](_0x36e717);}})[_0x3a71('0x1e')](function(_0x3f5853){if(_0x3f5853){return _0x3f5853?{'count':_0x429823,'rows':_0x3f5853}:null;}})[_0x3a71('0x1e')](respondWithResult(_0x26668a,null))[_0x3a71('0x28')](handleError(_0x26668a,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 9623f6f..47a3807 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 _0xcb90=['lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','int_dynamics365_configurations'];(function(_0x428a10,_0x3d945c){var _0x2c1cb7=function(_0x386102){while(--_0x386102){_0x428a10['push'](_0x428a10['shift']());}};_0x2c1cb7(++_0x3d945c);}(_0xcb90,0x18c));var _0x0cb9=function(_0x563ca8,_0x13a872){_0x563ca8=_0x563ca8-0x0;var _0x59f451=_0xcb90[_0x563ca8];return _0x59f451;};'use strict';var _=require(_0x0cb9('0x0'));var util=require(_0x0cb9('0x1'));var logger=require(_0x0cb9('0x2'))(_0x0cb9('0x3'));var moment=require(_0x0cb9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0cb9('0x5'));var rimraf=require(_0x0cb9('0x6'));var config=require(_0x0cb9('0x7'));var attributes=require(_0x0cb9('0x8'));module[_0x0cb9('0x9')]=function(_0x10d9a6,_0x12fdb7){return _0x10d9a6[_0x0cb9('0xa')]('Dynamics365Configuration',attributes,{'tableName':_0x0cb9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0f3c=['define','int_dynamics365_configurations','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports'];(function(_0x454918,_0x1dbc64){var _0x3a814b=function(_0x3d1c39){while(--_0x3d1c39){_0x454918['push'](_0x454918['shift']());}};_0x3a814b(++_0x1dbc64);}(_0x0f3c,0x19a));var _0xc0f3=function(_0x21fe35,_0x28764b){_0x21fe35=_0x21fe35-0x0;var _0x38de04=_0x0f3c[_0x21fe35];return _0x38de04;};'use strict';var _=require(_0xc0f3('0x0'));var util=require('util');var logger=require(_0xc0f3('0x1'))(_0xc0f3('0x2'));var moment=require(_0xc0f3('0x3'));var BPromise=require('bluebird');var rp=require(_0xc0f3('0x4'));var fs=require('fs');var path=require(_0xc0f3('0x5'));var rimraf=require(_0xc0f3('0x6'));var config=require(_0xc0f3('0x7'));var attributes=require(_0xc0f3('0x8'));module[_0xc0f3('0x9')]=function(_0x5296bb,_0x5c8c70){return _0x5296bb[_0xc0f3('0xa')]('Dynamics365Configuration',attributes,{'tableName':_0xc0f3('0xb'),'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 3175940..8540a23 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 _0xa285=['jayson/promise','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4b6d8b,_0x3925c8){var _0x178c28=function(_0x307192){while(--_0x307192){_0x4b6d8b['push'](_0x4b6d8b['shift']());}};_0x178c28(++_0x3925c8);}(_0xa285,0x1af));var _0x5a28=function(_0x19bb4c,_0x1380c5){_0x19bb4c=_0x19bb4c-0x0;var _0x6bc86b=_0xa285[_0x19bb4c];return _0x6bc86b;};'use strict';var _=require(_0x5a28('0x0'));var util=require(_0x5a28('0x1'));var moment=require(_0x5a28('0x2'));var BPromise=require(_0x5a28('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5a28('0x4'));var db=require(_0x5a28('0x5'))['db'];var utils=require(_0x5a28('0x6'));var logger=require(_0x5a28('0x7'))(_0x5a28('0x8'));var config=require('../../config/environment');var jayson=require(_0x5a28('0x9'));var client=jayson['client'][_0x5a28('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27e17b,_0x2b95fe,_0x33672c){return new BPromise(function(_0x256b2f,_0x2192d3){return client[_0x5a28('0xb')](_0x27e17b,_0x33672c)['then'](function(_0x2e6590){logger[_0x5a28('0xc')](_0x5a28('0xd'),_0x2b95fe,_0x5a28('0xe'));logger[_0x5a28('0xf')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x2b95fe,'request\x20sent',JSON[_0x5a28('0x10')](_0x2e6590));if(_0x2e6590['error']){if(_0x2e6590[_0x5a28('0x11')][_0x5a28('0x12')]===0x1f4){logger[_0x5a28('0x11')](_0x5a28('0xd'),_0x2b95fe,_0x2e6590[_0x5a28('0x11')]['message']);return _0x2192d3(_0x2e6590[_0x5a28('0x11')][_0x5a28('0x13')]);}logger[_0x5a28('0x11')](_0x5a28('0xd'),_0x2b95fe,_0x2e6590[_0x5a28('0x11')][_0x5a28('0x13')]);return _0x256b2f(_0x2e6590['error'][_0x5a28('0x13')]);}else{logger[_0x5a28('0xc')](_0x5a28('0xd'),_0x2b95fe,_0x5a28('0xe'));_0x256b2f(_0x2e6590[_0x5a28('0x14')][_0x5a28('0x13')]);}})[_0x5a28('0x15')](function(_0xf4f2a6){logger[_0x5a28('0x11')](_0x5a28('0xd'),_0x2b95fe,_0xf4f2a6);_0x2192d3(_0xf4f2a6);});});} \ No newline at end of file +var _0x8413=['Dynamics365Configuration,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info'];(function(_0x25f0ef,_0x503a06){var _0x1e8f17=function(_0x2a46c6){while(--_0x2a46c6){_0x25f0ef['push'](_0x25f0ef['shift']());}};_0x1e8f17(++_0x503a06);}(_0x8413,0x110));var _0x3841=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x8413[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x3841('0x0'));var util=require('util');var moment=require(_0x3841('0x1'));var BPromise=require(_0x3841('0x2'));var rs=require(_0x3841('0x3'));var fs=require('fs');var Redis=require(_0x3841('0x4'));var db=require(_0x3841('0x5'))['db'];var utils=require(_0x3841('0x6'));var logger=require(_0x3841('0x7'))(_0x3841('0x8'));var config=require(_0x3841('0x9'));var jayson=require(_0x3841('0xa'));var client=jayson[_0x3841('0xb')][_0x3841('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x43bb43,_0x58ae16,_0x1eb390){return new BPromise(function(_0x17d037,_0x1e65e9){return client['request'](_0x43bb43,_0x1eb390)['then'](function(_0x1660be){logger[_0x3841('0xd')](_0x3841('0xe'),_0x58ae16,'request\x20sent');logger[_0x3841('0xf')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x58ae16,_0x3841('0x10'),JSON[_0x3841('0x11')](_0x1660be));if(_0x1660be['error']){if(_0x1660be['error'][_0x3841('0x12')]===0x1f4){logger[_0x3841('0x13')](_0x3841('0xe'),_0x58ae16,_0x1660be[_0x3841('0x13')][_0x3841('0x14')]);return _0x1e65e9(_0x1660be[_0x3841('0x13')][_0x3841('0x14')]);}logger[_0x3841('0x13')](_0x3841('0xe'),_0x58ae16,_0x1660be[_0x3841('0x13')]['message']);return _0x17d037(_0x1660be[_0x3841('0x13')][_0x3841('0x14')]);}else{logger['info'](_0x3841('0xe'),_0x58ae16,_0x3841('0x10'));_0x17d037(_0x1660be[_0x3841('0x15')][_0x3841('0x14')]);}})['catch'](function(_0x441dd1){logger['error'](_0x3841('0xe'),_0x58ae16,_0x441dd1);_0x1e65e9(_0x441dd1);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 0341fc0..7668217 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 _0xf4eb=['../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','exports','multer','Router'];(function(_0x542427,_0x329647){var _0x2ad09f=function(_0x465a0d){while(--_0x465a0d){_0x542427['push'](_0x542427['shift']());}};_0x2ad09f(++_0x329647);}(_0xf4eb,0xec));var _0xbf4e=function(_0x19e9d1,_0x4a4ba1){_0x19e9d1=_0x19e9d1-0x0;var _0x453300=_0xf4eb[_0x19e9d1];return _0x453300;};'use strict';var multer=require(_0xbf4e('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbf4e('0x1')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbf4e('0x2'));var controller=require(_0xbf4e('0x3'));router[_0xbf4e('0x4')]('/',auth[_0xbf4e('0x5')](),controller[_0xbf4e('0x6')]);router[_0xbf4e('0x4')](_0xbf4e('0x7'),auth['isAuthenticated'](),controller[_0xbf4e('0x8')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbf4e('0x9')]);router[_0xbf4e('0xa')](_0xbf4e('0x7'),auth[_0xbf4e('0x5')](),controller[_0xbf4e('0xb')]);router[_0xbf4e('0xc')](_0xbf4e('0x7'),auth['isAuthenticated'](),controller['destroy']);module[_0xbf4e('0xd')]=router; \ No newline at end of file +var _0x39cb=['../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','/:id','show','create','put','destroy','exports','util','path','express','Router','../../components/interaction/service'];(function(_0x1ce018,_0x45f915){var _0x17b309=function(_0x34fbdb){while(--_0x34fbdb){_0x1ce018['push'](_0x1ce018['shift']());}};_0x17b309(++_0x45f915);}(_0x39cb,0x1bd));var _0xb39c=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x39cb[_0xfae23b];return _0x200640;};'use strict';var multer=require('multer');var util=require(_0xb39c('0x0'));var path=require(_0xb39c('0x1'));var timeout=require('connect-timeout');var express=require(_0xb39c('0x2'));var router=express[_0xb39c('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xb39c('0x4'));var config=require(_0xb39c('0x5'));var controller=require(_0xb39c('0x6'));router[_0xb39c('0x7')]('/',auth[_0xb39c('0x8')](),controller['index']);router[_0xb39c('0x7')](_0xb39c('0x9'),auth[_0xb39c('0x8')](),controller[_0xb39c('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb39c('0xb')]);router[_0xb39c('0xc')](_0xb39c('0x9'),auth[_0xb39c('0x8')](),controller['update']);router['delete']('/:id',auth[_0xb39c('0x8')](),controller[_0xb39c('0xd')]);module[_0xb39c('0xe')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 2c0dce4..8bfed0a 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 _0x25aa=['ENUM','sequelize','string','variable','customVariable','keyValue','STRING'];(function(_0x6f19cb,_0xc6fcdd){var _0x39ded3=function(_0x3456c4){while(--_0x3456c4){_0x6f19cb['push'](_0x6f19cb['shift']());}};_0x39ded3(++_0xc6fcdd);}(_0x25aa,0x151));var _0xa25a=function(_0x4991d6,_0x348deb){_0x4991d6=_0x4991d6-0x0;var _0x50faf7=_0x25aa[_0x4991d6];return _0x50faf7;};'use strict';var Sequelize=require(_0xa25a('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xa25a('0x1'),_0xa25a('0x2'),_0xa25a('0x3'),_0xa25a('0x4')),'defaultValue':_0xa25a('0x1')},'content':{'type':Sequelize[_0xa25a('0x5')]},'key':{'type':Sequelize[_0xa25a('0x5')]},'keyType':{'type':Sequelize[_0xa25a('0x6')](_0xa25a('0x1'),_0xa25a('0x2'),_0xa25a('0x3'))},'keyContent':{'type':Sequelize[_0xa25a('0x5')]},'idField':{'type':Sequelize[_0xa25a('0x5')]},'nameField':{'type':Sequelize[_0xa25a('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x83f1=['exports','string','variable','STRING','ENUM','customVariable','BOOLEAN'];(function(_0x21cc4e,_0x24a7ac){var _0x3b7125=function(_0x1f37db){while(--_0x1f37db){_0x21cc4e['push'](_0x21cc4e['shift']());}};_0x3b7125(++_0x24a7ac);}(_0x83f1,0xa8));var _0x183f=function(_0xea96be,_0x19c5b8){_0xea96be=_0xea96be-0x0;var _0x14e76a=_0x83f1[_0xea96be];return _0x14e76a;};'use strict';var Sequelize=require('sequelize');module[_0x183f('0x0')]={'type':{'type':Sequelize['ENUM'](_0x183f('0x1'),_0x183f('0x2'),'customVariable','keyValue'),'defaultValue':_0x183f('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x183f('0x3')]},'keyType':{'type':Sequelize[_0x183f('0x4')](_0x183f('0x1'),_0x183f('0x2'),_0x183f('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x183f('0x3')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x183f('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 97693fb..0229606 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 _0xf777=['api','../../config/environment','../../mysqldb','end','status','json','count','offset','set','apply','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','Dynamics365Field','includeAll','include','findAll','rows','catch','params','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x216a1b,_0x3d8947){var _0x40a5dd=function(_0x2ddbf4){while(--_0x2ddbf4){_0x216a1b['push'](_0x216a1b['shift']());}};_0x40a5dd(++_0x3d8947);}(_0xf777,0x1e9));var _0x7f77=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf777[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x7f77('0x0'));var emlformat=require(_0x7f77('0x1'));var rimraf=require(_0x7f77('0x2'));var zipdir=require(_0x7f77('0x3'));var jsonpatch=require(_0x7f77('0x4'));var rp=require(_0x7f77('0x5'));var moment=require(_0x7f77('0x6'));var BPromise=require(_0x7f77('0x7'));var Mustache=require(_0x7f77('0x8'));var util=require('util');var path=require(_0x7f77('0x9'));var sox=require(_0x7f77('0xa'));var csv=require('to-csv');var ejs=require(_0x7f77('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7f77('0xc'));var crypto=require('crypto');var jsforce=require(_0x7f77('0xd'));var deskjs=require(_0x7f77('0xe'));var toCsv=require(_0x7f77('0xf'));var querystring=require(_0x7f77('0x10'));var Papa=require(_0x7f77('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7f77('0x12'));var as=require(_0x7f77('0x13'));var hardwareService=require(_0x7f77('0x14'));var logger=require(_0x7f77('0x15'))(_0x7f77('0x16'));var utils=require('../../config/utils');var config=require(_0x7f77('0x17'));var db=require(_0x7f77('0x18'))['db'];function respondWithStatusCode(_0x1640e9,_0x2ab82d){_0x2ab82d=_0x2ab82d||0xcc;return function(_0xd625fb){if(_0xd625fb){return _0x1640e9['sendStatus'](_0x2ab82d);}return _0x1640e9['status'](_0x2ab82d)[_0x7f77('0x19')]();};}function respondWithResult(_0x18f698,_0x3f7a60){_0x3f7a60=_0x3f7a60||0xc8;return function(_0x3f99e2){if(_0x3f99e2){return _0x18f698[_0x7f77('0x1a')](_0x3f7a60)[_0x7f77('0x1b')](_0x3f99e2);}};}function respondWithFilteredResult(_0x1f0729,_0x2efdd1){return function(_0x13e9a1){if(_0x13e9a1){var _0x3d8a45=_0x13e9a1[_0x7f77('0x1c')],_0x2c104a=_0x2efdd1[_0x7f77('0x1d')],_0x29d2cb=_0x2efdd1[_0x7f77('0x1d')]+_0x2efdd1['limit'],_0x186f7a;if(_0x29d2cb>=_0x3d8a45){_0x29d2cb=_0x3d8a45;_0x186f7a=0xc8;}else{_0x186f7a=0xce;}_0x1f0729['status'](_0x186f7a);return _0x1f0729[_0x7f77('0x1e')]('Content-Range',_0x2c104a+'-'+_0x29d2cb+'/'+_0x3d8a45)[_0x7f77('0x1b')](_0x13e9a1);}return null;};}function patchUpdates(_0x50eb96){return function(_0x23b8b0){try{jsonpatch[_0x7f77('0x1f')](_0x23b8b0,_0x50eb96,!![]);}catch(_0x359f63){return BPromise['reject'](_0x359f63);}return _0x23b8b0[_0x7f77('0x20')]();};}function saveUpdates(_0x3d91f8,_0x4d7283){return function(_0x175e9c){if(_0x175e9c){return _0x175e9c[_0x7f77('0x21')](_0x3d91f8)[_0x7f77('0x22')](function(_0x48647f){return _0x48647f;});}return null;};}function removeEntity(_0x24fac0,_0x5b869c){return function(_0x5c4049){if(_0x5c4049){return _0x5c4049[_0x7f77('0x23')]()[_0x7f77('0x22')](function(){_0x24fac0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2493a0,_0x87e6b6){return function(_0x1d8fe3){if(!_0x1d8fe3){_0x2493a0['sendStatus'](0x194);}return _0x1d8fe3;};}function handleError(_0x5e03a3,_0x13662c){_0x13662c=_0x13662c||0x1f4;return function(_0x8cf65b){logger[_0x7f77('0x24')](_0x8cf65b[_0x7f77('0x25')]);if(_0x8cf65b[_0x7f77('0x26')]){delete _0x8cf65b[_0x7f77('0x26')];}_0x5e03a3['status'](_0x13662c)[_0x7f77('0x27')](_0x8cf65b);};}exports['index']=function(_0x3c2ece,_0x29f31b){var _0x5e119f={},_0x2bd7e0={},_0x386842={'count':0x0,'rows':[]};var _0x51437e=_[_0x7f77('0x28')](db['Dynamics365Field'][_0x7f77('0x29')],function(_0x25fcae){return{'name':_0x25fcae[_0x7f77('0x2a')],'type':_0x25fcae[_0x7f77('0x2b')][_0x7f77('0x2c')]};});_0x2bd7e0[_0x7f77('0x2d')]=_[_0x7f77('0x28')](_0x51437e,'name');_0x2bd7e0[_0x7f77('0x2e')]=_[_0x7f77('0x2f')](_0x3c2ece[_0x7f77('0x2e')]);_0x2bd7e0[_0x7f77('0x30')]=_[_0x7f77('0x31')](_0x2bd7e0[_0x7f77('0x2d')],_0x2bd7e0[_0x7f77('0x2e')]);_0x5e119f['attributes']=_['intersection'](_0x2bd7e0['model'],qs[_0x7f77('0x32')](_0x3c2ece[_0x7f77('0x2e')][_0x7f77('0x32')]));_0x5e119f[_0x7f77('0x33')]=_0x5e119f[_0x7f77('0x33')][_0x7f77('0x34')]?_0x5e119f[_0x7f77('0x33')]:_0x2bd7e0[_0x7f77('0x2d')];if(!_0x3c2ece[_0x7f77('0x2e')][_0x7f77('0x35')](_0x7f77('0x36'))){_0x5e119f['limit']=qs[_0x7f77('0x37')](_0x3c2ece[_0x7f77('0x2e')][_0x7f77('0x37')]);_0x5e119f[_0x7f77('0x1d')]=qs[_0x7f77('0x1d')](_0x3c2ece[_0x7f77('0x2e')][_0x7f77('0x1d')]);}_0x5e119f[_0x7f77('0x38')]=qs[_0x7f77('0x39')](_0x3c2ece[_0x7f77('0x2e')]['sort']);_0x5e119f[_0x7f77('0x3a')]=qs['filters'](_[_0x7f77('0x3b')](_0x3c2ece[_0x7f77('0x2e')],_0x2bd7e0['filters']));if(_0x3c2ece['query'][_0x7f77('0x3c')]){_0x5e119f[_0x7f77('0x3a')]=_['merge'](_0x5e119f[_0x7f77('0x3a')],{'$or':_['map'](_0x51437e,function(_0x30521b){if(_0x30521b[_0x7f77('0x2b')]!=='VIRTUAL'){var _0x43a0a4={};_0x43a0a4[_0x30521b[_0x7f77('0x26')]]={'$like':'%'+_0x3c2ece[_0x7f77('0x2e')][_0x7f77('0x3c')]+'%'};return _0x43a0a4;}})});}_0x5e119f=_[_0x7f77('0x3d')]({},_0x5e119f,_0x3c2ece[_0x7f77('0x3e')]);var _0x397991={'where':_0x5e119f[_0x7f77('0x3a')]};return db[_0x7f77('0x3f')]['count'](_0x397991)[_0x7f77('0x22')](function(_0x333e2d){_0x386842[_0x7f77('0x1c')]=_0x333e2d;if(_0x3c2ece[_0x7f77('0x2e')][_0x7f77('0x40')]){_0x5e119f[_0x7f77('0x41')]=[{'all':!![]}];}return db['Dynamics365Field'][_0x7f77('0x42')](_0x5e119f);})['then'](function(_0x2fc747){_0x386842[_0x7f77('0x43')]=_0x2fc747;return _0x386842;})['then'](respondWithFilteredResult(_0x29f31b,_0x5e119f))[_0x7f77('0x44')](handleError(_0x29f31b,null));};exports['show']=function(_0x1e1ca3,_0xbe7578){var _0x2078bf={'raw':!![],'where':{'id':_0x1e1ca3[_0x7f77('0x45')]['id']}},_0x3cbd7b={};_0x3cbd7b['model']=_[_0x7f77('0x2f')](db[_0x7f77('0x3f')][_0x7f77('0x29')]);_0x3cbd7b[_0x7f77('0x2e')]=_['keys'](_0x1e1ca3[_0x7f77('0x2e')]);_0x3cbd7b[_0x7f77('0x30')]=_[_0x7f77('0x31')](_0x3cbd7b['model'],_0x3cbd7b[_0x7f77('0x2e')]);_0x2078bf[_0x7f77('0x33')]=_['intersection'](_0x3cbd7b[_0x7f77('0x2d')],qs['fields'](_0x1e1ca3['query'][_0x7f77('0x32')]));_0x2078bf[_0x7f77('0x33')]=_0x2078bf['attributes'][_0x7f77('0x34')]?_0x2078bf[_0x7f77('0x33')]:_0x3cbd7b[_0x7f77('0x2d')];if(_0x1e1ca3[_0x7f77('0x2e')]['includeAll']){_0x2078bf[_0x7f77('0x41')]=[{'all':!![]}];}_0x2078bf=_[_0x7f77('0x3d')]({},_0x2078bf,_0x1e1ca3[_0x7f77('0x3e')]);return db[_0x7f77('0x3f')]['find'](_0x2078bf)[_0x7f77('0x22')](handleEntityNotFound(_0xbe7578,null))[_0x7f77('0x22')](respondWithResult(_0xbe7578,null))[_0x7f77('0x44')](handleError(_0xbe7578,null));};exports['create']=function(_0x5ce8e,_0x5299a4){return db[_0x7f77('0x3f')][_0x7f77('0x46')](_0x5ce8e[_0x7f77('0x47')],{})['then'](respondWithResult(_0x5299a4,0xc9))['catch'](handleError(_0x5299a4,null));};exports[_0x7f77('0x21')]=function(_0x296152,_0x390c64){if(_0x296152[_0x7f77('0x47')]['id']){delete _0x296152[_0x7f77('0x47')]['id'];}return db[_0x7f77('0x3f')][_0x7f77('0x48')]({'where':{'id':_0x296152[_0x7f77('0x45')]['id']}})[_0x7f77('0x22')](handleEntityNotFound(_0x390c64,null))[_0x7f77('0x22')](saveUpdates(_0x296152[_0x7f77('0x47')],null))[_0x7f77('0x22')](respondWithResult(_0x390c64,null))['catch'](handleError(_0x390c64,null));};exports[_0x7f77('0x23')]=function(_0x44bd1d,_0x4675ed){return db[_0x7f77('0x3f')][_0x7f77('0x48')]({'where':{'id':_0x44bd1d[_0x7f77('0x45')]['id']}})[_0x7f77('0x22')](handleEntityNotFound(_0x4675ed,null))[_0x7f77('0x22')](removeEntity(_0x4675ed,null))[_0x7f77('0x44')](handleError(_0x4675ed,null));}; \ No newline at end of file +var _0x2cd0=['path','sox','to-csv','lodash','squel','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','end','error','stack','name','send','map','Dynamics365Field','rawAttributes','key','model','query','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','include','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util'];(function(_0x1b650a,_0x41a453){var _0x3ac6b1=function(_0x4eb6f5){while(--_0x4eb6f5){_0x1b650a['push'](_0x1b650a['shift']());}};_0x3ac6b1(++_0x41a453);}(_0x2cd0,0x10f));var _0x02cd=function(_0x3516eb,_0x3aed49){_0x3516eb=_0x3516eb-0x0;var _0xdd93e2=_0x2cd0[_0x3516eb];return _0xdd93e2;};'use strict';var pdf=require(_0x02cd('0x0'));var emlformat=require(_0x02cd('0x1'));var rimraf=require(_0x02cd('0x2'));var zipdir=require(_0x02cd('0x3'));var jsonpatch=require(_0x02cd('0x4'));var rp=require(_0x02cd('0x5'));var moment=require(_0x02cd('0x6'));var BPromise=require(_0x02cd('0x7'));var Mustache=require('mustache');var util=require(_0x02cd('0x8'));var path=require(_0x02cd('0x9'));var sox=require(_0x02cd('0xa'));var csv=require(_0x02cd('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x02cd('0xc'));var squel=require(_0x02cd('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x02cd('0xb'));var querystring=require(_0x02cd('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x02cd('0xf'));var qs=require(_0x02cd('0x10'));var as=require(_0x02cd('0x11'));var hardwareService=require(_0x02cd('0x12'));var logger=require(_0x02cd('0x13'))(_0x02cd('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x02cd('0x15'))['db'];function respondWithStatusCode(_0x21238,_0x1bce6c){_0x1bce6c=_0x1bce6c||0xcc;return function(_0x1c5e82){if(_0x1c5e82){return _0x21238[_0x02cd('0x16')](_0x1bce6c);}return _0x21238[_0x02cd('0x17')](_0x1bce6c)['end']();};}function respondWithResult(_0x251568,_0x52bbe6){_0x52bbe6=_0x52bbe6||0xc8;return function(_0x203e9d){if(_0x203e9d){return _0x251568['status'](_0x52bbe6)['json'](_0x203e9d);}};}function respondWithFilteredResult(_0x51f190,_0x24043b){return function(_0x2cda2c){if(_0x2cda2c){var _0x308ee3=_0x2cda2c[_0x02cd('0x18')],_0x15b6fe=_0x24043b[_0x02cd('0x19')],_0x14ba5c=_0x24043b[_0x02cd('0x19')]+_0x24043b[_0x02cd('0x1a')],_0x177720;if(_0x14ba5c>=_0x308ee3){_0x14ba5c=_0x308ee3;_0x177720=0xc8;}else{_0x177720=0xce;}_0x51f190[_0x02cd('0x17')](_0x177720);return _0x51f190[_0x02cd('0x1b')](_0x02cd('0x1c'),_0x15b6fe+'-'+_0x14ba5c+'/'+_0x308ee3)[_0x02cd('0x1d')](_0x2cda2c);}return null;};}function patchUpdates(_0x6bbe36){return function(_0x216967){try{jsonpatch['apply'](_0x216967,_0x6bbe36,!![]);}catch(_0xb1ecb6){return BPromise[_0x02cd('0x1e')](_0xb1ecb6);}return _0x216967[_0x02cd('0x1f')]();};}function saveUpdates(_0x17c764,_0x822204){return function(_0x33fb48){if(_0x33fb48){return _0x33fb48[_0x02cd('0x20')](_0x17c764)[_0x02cd('0x21')](function(_0x354385){return _0x354385;});}return null;};}function removeEntity(_0x40d43,_0x1736be){return function(_0x54453c){if(_0x54453c){return _0x54453c[_0x02cd('0x22')]()[_0x02cd('0x21')](function(){_0x40d43[_0x02cd('0x17')](0xcc)[_0x02cd('0x23')]();});}};}function handleEntityNotFound(_0x47dc25,_0x28f678){return function(_0x4e127f){if(!_0x4e127f){_0x47dc25[_0x02cd('0x16')](0x194);}return _0x4e127f;};}function handleError(_0x397aba,_0x238696){_0x238696=_0x238696||0x1f4;return function(_0x68b34a){logger[_0x02cd('0x24')](_0x68b34a[_0x02cd('0x25')]);if(_0x68b34a[_0x02cd('0x26')]){delete _0x68b34a['name'];}_0x397aba[_0x02cd('0x17')](_0x238696)[_0x02cd('0x27')](_0x68b34a);};}exports['index']=function(_0x2853e1,_0x560027){var _0x35f785={},_0x490389={},_0x2aa680={'count':0x0,'rows':[]};var _0x3651d4=_[_0x02cd('0x28')](db[_0x02cd('0x29')][_0x02cd('0x2a')],function(_0x256cb5){return{'name':_0x256cb5['fieldName'],'type':_0x256cb5['type'][_0x02cd('0x2b')]};});_0x490389[_0x02cd('0x2c')]=_[_0x02cd('0x28')](_0x3651d4,_0x02cd('0x26'));_0x490389['query']=_['keys'](_0x2853e1[_0x02cd('0x2d')]);_0x490389[_0x02cd('0x2e')]=_[_0x02cd('0x2f')](_0x490389['model'],_0x490389[_0x02cd('0x2d')]);_0x35f785['attributes']=_[_0x02cd('0x2f')](_0x490389['model'],qs[_0x02cd('0x30')](_0x2853e1['query'][_0x02cd('0x30')]));_0x35f785[_0x02cd('0x31')]=_0x35f785[_0x02cd('0x31')][_0x02cd('0x32')]?_0x35f785[_0x02cd('0x31')]:_0x490389['model'];if(!_0x2853e1[_0x02cd('0x2d')]['hasOwnProperty']('nolimit')){_0x35f785[_0x02cd('0x1a')]=qs[_0x02cd('0x1a')](_0x2853e1[_0x02cd('0x2d')][_0x02cd('0x1a')]);_0x35f785['offset']=qs['offset'](_0x2853e1[_0x02cd('0x2d')][_0x02cd('0x19')]);}_0x35f785[_0x02cd('0x33')]=qs[_0x02cd('0x34')](_0x2853e1[_0x02cd('0x2d')][_0x02cd('0x34')]);_0x35f785[_0x02cd('0x35')]=qs['filters'](_[_0x02cd('0x36')](_0x2853e1[_0x02cd('0x2d')],_0x490389[_0x02cd('0x2e')]));if(_0x2853e1[_0x02cd('0x2d')][_0x02cd('0x37')]){_0x35f785[_0x02cd('0x35')]=_[_0x02cd('0x38')](_0x35f785[_0x02cd('0x35')],{'$or':_[_0x02cd('0x28')](_0x3651d4,function(_0x557ded){if(_0x557ded[_0x02cd('0x39')]!==_0x02cd('0x3a')){var _0x20b319={};_0x20b319[_0x557ded[_0x02cd('0x26')]]={'$like':'%'+_0x2853e1[_0x02cd('0x2d')][_0x02cd('0x37')]+'%'};return _0x20b319;}})});}_0x35f785=_[_0x02cd('0x38')]({},_0x35f785,_0x2853e1[_0x02cd('0x3b')]);var _0x3907f9={'where':_0x35f785[_0x02cd('0x35')]};return db[_0x02cd('0x29')][_0x02cd('0x18')](_0x3907f9)['then'](function(_0x368eee){_0x2aa680[_0x02cd('0x18')]=_0x368eee;if(_0x2853e1['query'][_0x02cd('0x3c')]){_0x35f785['include']=[{'all':!![]}];}return db[_0x02cd('0x29')][_0x02cd('0x3d')](_0x35f785);})[_0x02cd('0x21')](function(_0xcd323){_0x2aa680[_0x02cd('0x3e')]=_0xcd323;return _0x2aa680;})[_0x02cd('0x21')](respondWithFilteredResult(_0x560027,_0x35f785))[_0x02cd('0x3f')](handleError(_0x560027,null));};exports['show']=function(_0x2582b6,_0x256644){var _0x248f84={'raw':!![],'where':{'id':_0x2582b6[_0x02cd('0x40')]['id']}},_0x7b44e4={};_0x7b44e4['model']=_[_0x02cd('0x41')](db[_0x02cd('0x29')]['rawAttributes']);_0x7b44e4[_0x02cd('0x2d')]=_[_0x02cd('0x41')](_0x2582b6[_0x02cd('0x2d')]);_0x7b44e4[_0x02cd('0x2e')]=_[_0x02cd('0x2f')](_0x7b44e4['model'],_0x7b44e4[_0x02cd('0x2d')]);_0x248f84['attributes']=_[_0x02cd('0x2f')](_0x7b44e4[_0x02cd('0x2c')],qs[_0x02cd('0x30')](_0x2582b6[_0x02cd('0x2d')]['fields']));_0x248f84[_0x02cd('0x31')]=_0x248f84[_0x02cd('0x31')][_0x02cd('0x32')]?_0x248f84[_0x02cd('0x31')]:_0x7b44e4[_0x02cd('0x2c')];if(_0x2582b6[_0x02cd('0x2d')]['includeAll']){_0x248f84[_0x02cd('0x42')]=[{'all':!![]}];}_0x248f84=_[_0x02cd('0x38')]({},_0x248f84,_0x2582b6[_0x02cd('0x3b')]);return db['Dynamics365Field'][_0x02cd('0x43')](_0x248f84)[_0x02cd('0x21')](handleEntityNotFound(_0x256644,null))['then'](respondWithResult(_0x256644,null))['catch'](handleError(_0x256644,null));};exports[_0x02cd('0x44')]=function(_0x20adc0,_0x439375){return db[_0x02cd('0x29')][_0x02cd('0x44')](_0x20adc0['body'],{})[_0x02cd('0x21')](respondWithResult(_0x439375,0xc9))['catch'](handleError(_0x439375,null));};exports[_0x02cd('0x20')]=function(_0x1d91ca,_0x454be5){if(_0x1d91ca['body']['id']){delete _0x1d91ca[_0x02cd('0x45')]['id'];}return db[_0x02cd('0x29')][_0x02cd('0x43')]({'where':{'id':_0x1d91ca[_0x02cd('0x40')]['id']}})[_0x02cd('0x21')](handleEntityNotFound(_0x454be5,null))[_0x02cd('0x21')](saveUpdates(_0x1d91ca[_0x02cd('0x45')],null))[_0x02cd('0x21')](respondWithResult(_0x454be5,null))[_0x02cd('0x3f')](handleError(_0x454be5,null));};exports[_0x02cd('0x22')]=function(_0x4f0d50,_0x39d0e0){return db[_0x02cd('0x29')][_0x02cd('0x43')]({'where':{'id':_0x4f0d50[_0x02cd('0x40')]['id']}})[_0x02cd('0x21')](handleEntityNotFound(_0x39d0e0,null))['then'](removeEntity(_0x39d0e0,null))['catch'](handleError(_0x39d0e0,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 7d2b6f3..953d5c8 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 _0x6857=['rimraf','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1416c1,_0x1998f9){var _0x73ec0e=function(_0x4b9a80){while(--_0x4b9a80){_0x1416c1['push'](_0x1416c1['shift']());}};_0x73ec0e(++_0x1998f9);}(_0x6857,0xa3));var _0x7685=function(_0x5910c5,_0x274f1f){_0x5910c5=_0x5910c5-0x0;var _0x587619=_0x6857[_0x5910c5];return _0x587619;};'use strict';var _=require(_0x7685('0x0'));var util=require(_0x7685('0x1'));var logger=require(_0x7685('0x2'))(_0x7685('0x3'));var moment=require(_0x7685('0x4'));var BPromise=require(_0x7685('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7685('0x6'));var config=require('../../config/environment');var attributes=require(_0x7685('0x7'));module[_0x7685('0x8')]=function(_0x43c29c,_0x4ad34b){return _0x43c29c[_0x7685('0x9')](_0x7685('0xa'),attributes,{'tableName':_0x7685('0xb'),'paranoid':![],'indexes':[{'name':_0x7685('0xc'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb49c=['idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index'];(function(_0x43c456,_0xa105b3){var _0x76a242=function(_0x9ae128){while(--_0x9ae128){_0x43c456['push'](_0x43c456['shift']());}};_0x76a242(++_0xa105b3);}(_0xb49c,0x68));var _0xcb49=function(_0x24745f,_0x575a71){_0x24745f=_0x24745f-0x0;var _0x10c726=_0xb49c[_0x24745f];return _0x10c726;};'use strict';var _=require(_0xcb49('0x0'));var util=require(_0xcb49('0x1'));var logger=require(_0xcb49('0x2'))(_0xcb49('0x3'));var moment=require('moment');var BPromise=require(_0xcb49('0x4'));var rp=require(_0xcb49('0x5'));var fs=require('fs');var path=require(_0xcb49('0x6'));var rimraf=require(_0xcb49('0x7'));var config=require(_0xcb49('0x8'));var attributes=require(_0xcb49('0x9'));module[_0xcb49('0xa')]=function(_0x46db0b,_0x570e02){return _0x46db0b[_0xcb49('0xb')](_0xcb49('0xc'),attributes,{'tableName':_0xcb49('0xd'),'paranoid':![],'indexes':[{'name':_0xcb49('0xe'),'fields':[_0xcb49('0xf'),_0xcb49('0x10')],'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 7948265..516acc7 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 _0x6dc0=['rpc','../../config/environment','client','info','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2398b1,_0x24aff3){var _0x21d136=function(_0x533c5d){while(--_0x533c5d){_0x2398b1['push'](_0x2398b1['shift']());}};_0x21d136(++_0x24aff3);}(_0x6dc0,0xb6));var _0x06dc=function(_0x393868,_0x491e3c){_0x393868=_0x393868-0x0;var _0x42bc61=_0x6dc0[_0x393868];return _0x42bc61;};'use strict';var _=require(_0x06dc('0x0'));var util=require(_0x06dc('0x1'));var moment=require(_0x06dc('0x2'));var BPromise=require('bluebird');var rs=require(_0x06dc('0x3'));var fs=require('fs');var Redis=require(_0x06dc('0x4'));var db=require(_0x06dc('0x5'))['db'];var utils=require(_0x06dc('0x6'));var logger=require('../../config/logger')(_0x06dc('0x7'));var config=require(_0x06dc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x06dc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x419534,_0x3212ca,_0x14c15b){return new BPromise(function(_0x10e23b,_0x140eef){return client['request'](_0x419534,_0x14c15b)['then'](function(_0x480f30){logger[_0x06dc('0xa')](_0x06dc('0xb'),_0x3212ca,'request\x20sent');logger[_0x06dc('0xc')](_0x06dc('0xd'),_0x3212ca,_0x06dc('0xe'),JSON[_0x06dc('0xf')](_0x480f30));if(_0x480f30['error']){if(_0x480f30[_0x06dc('0x10')][_0x06dc('0x11')]===0x1f4){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x3212ca,_0x480f30['error']['message']);return _0x140eef(_0x480f30[_0x06dc('0x10')]['message']);}logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x3212ca,_0x480f30[_0x06dc('0x10')][_0x06dc('0x12')]);return _0x10e23b(_0x480f30[_0x06dc('0x10')]['message']);}else{logger[_0x06dc('0xa')](_0x06dc('0xb'),_0x3212ca,_0x06dc('0xe'));_0x10e23b(_0x480f30[_0x06dc('0x13')]['message']);}})[_0x06dc('0x14')](function(_0x30c1c5){logger[_0x06dc('0x10')](_0x06dc('0xb'),_0x3212ca,_0x30c1c5);_0x140eef(_0x30c1c5);});});} \ No newline at end of file +var _0x6d11=['message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x443c00,_0x5eb470){var _0x3d25cf=function(_0xc33180){while(--_0xc33180){_0x443c00['push'](_0x443c00['shift']());}};_0x3d25cf(++_0x5eb470);}(_0x6d11,0xbf));var _0x16d1=function(_0x1454e1,_0x3b2847){_0x1454e1=_0x1454e1-0x0;var _0x3739e5=_0x6d11[_0x1454e1];return _0x3739e5;};'use strict';var _=require(_0x16d1('0x0'));var util=require(_0x16d1('0x1'));var moment=require(_0x16d1('0x2'));var BPromise=require('bluebird');var rs=require(_0x16d1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x16d1('0x4'))['db'];var utils=require(_0x16d1('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x16d1('0x6'));var jayson=require(_0x16d1('0x7'));var client=jayson[_0x16d1('0x8')][_0x16d1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1009dc,_0x150217,_0x19390d){return new BPromise(function(_0x5d0e3f,_0x58a7a2){return client['request'](_0x1009dc,_0x19390d)[_0x16d1('0xa')](function(_0xcfbb15){logger[_0x16d1('0xb')](_0x16d1('0xc'),_0x150217,'request\x20sent');logger[_0x16d1('0xd')](_0x16d1('0xe'),_0x150217,_0x16d1('0xf'),JSON[_0x16d1('0x10')](_0xcfbb15));if(_0xcfbb15[_0x16d1('0x11')]){if(_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x12')]===0x1f4){logger[_0x16d1('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x150217,_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x13')]);return _0x58a7a2(_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x13')]);}logger[_0x16d1('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x150217,_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x13')]);return _0x5d0e3f(_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x13')]);}else{logger[_0x16d1('0xb')](_0x16d1('0xc'),_0x150217,_0x16d1('0xf'));_0x5d0e3f(_0xcfbb15['result'][_0x16d1('0x13')]);}})[_0x16d1('0x14')](function(_0x555b2d){logger['error'](_0x16d1('0xc'),_0x150217,_0x555b2d);_0x58a7a2(_0x555b2d);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 8f083f4..d92948e 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 _0x7ef6=['../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','/:id/fields','getFields','post','put','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x1acbef,_0x1c1bfc){var _0x14d1e0=function(_0x4c0165){while(--_0x4c0165){_0x1acbef['push'](_0x1acbef['shift']());}};_0x14d1e0(++_0x1c1bfc);}(_0x7ef6,0x159));var _0x67ef=function(_0x46ac7d,_0x42ebc3){_0x46ac7d=_0x46ac7d-0x0;var _0x41e45e=_0x7ef6[_0x46ac7d];return _0x41e45e;};'use strict';var multer=require(_0x67ef('0x0'));var util=require(_0x67ef('0x1'));var path=require(_0x67ef('0x2'));var timeout=require(_0x67ef('0x3'));var express=require(_0x67ef('0x4'));var router=express[_0x67ef('0x5')]();var auth=require(_0x67ef('0x6'));var interaction=require(_0x67ef('0x7'));var config=require(_0x67ef('0x8'));var controller=require(_0x67ef('0x9'));router['get']('/',auth[_0x67ef('0xa')](),controller[_0x67ef('0xb')]);router[_0x67ef('0xc')](_0x67ef('0xd'),auth[_0x67ef('0xa')](),controller[_0x67ef('0xe')]);router['get'](_0x67ef('0xf'),auth[_0x67ef('0xa')](),controller['getConfigurations']);router[_0x67ef('0xc')](_0x67ef('0x10'),auth[_0x67ef('0xa')](),controller[_0x67ef('0x11')]);router['post']('/',auth[_0x67ef('0xa')](),controller['create']);router[_0x67ef('0x12')]('/:id/configurations',auth[_0x67ef('0xa')](),controller['addConfiguration']);router[_0x67ef('0x13')](_0x67ef('0xd'),auth[_0x67ef('0xa')](),controller['update']);router[_0x67ef('0x14')](_0x67ef('0xd'),auth[_0x67ef('0xa')](),controller[_0x67ef('0x15')]);module['exports']=router; \ No newline at end of file +var _0xbe62=['/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','util','connect-timeout','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','get','isAuthenticated'];(function(_0x1f0b74,_0x2cc0da){var _0x14fda5=function(_0x479fbe){while(--_0x479fbe){_0x1f0b74['push'](_0x1f0b74['shift']());}};_0x14fda5(++_0x2cc0da);}(_0xbe62,0x103));var _0x2be6=function(_0x24e94d,_0x261a8b){_0x24e94d=_0x24e94d-0x0;var _0xee1443=_0xbe62[_0x24e94d];return _0xee1443;};'use strict';var multer=require('multer');var util=require(_0x2be6('0x0'));var path=require('path');var timeout=require(_0x2be6('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x2be6('0x2'));var interaction=require(_0x2be6('0x3'));var config=require('../../config/environment');var controller=require(_0x2be6('0x4'));router[_0x2be6('0x5')]('/',auth[_0x2be6('0x6')](),controller['index']);router['get'](_0x2be6('0x7'),auth[_0x2be6('0x6')](),controller['show']);router[_0x2be6('0x5')](_0x2be6('0x8'),auth[_0x2be6('0x6')](),controller[_0x2be6('0x9')]);router[_0x2be6('0x5')](_0x2be6('0xa'),auth['isAuthenticated'](),controller[_0x2be6('0xb')]);router[_0x2be6('0xc')]('/',auth[_0x2be6('0x6')](),controller[_0x2be6('0xd')]);router[_0x2be6('0xc')]('/:id/configurations',auth[_0x2be6('0x6')](),controller[_0x2be6('0xe')]);router[_0x2be6('0xf')](_0x2be6('0x7'),auth[_0x2be6('0x6')](),controller[_0x2be6('0x10')]);router[_0x2be6('0x11')](_0x2be6('0x7'),auth[_0x2be6('0x6')](),controller[_0x2be6('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index ea90cbb..ff0763d 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 _0x5713=['sequelize','exports','STRING','username','remoteUri'];(function(_0x178ba3,_0x1b10cd){var _0x4a2bb3=function(_0x389d8c){while(--_0x389d8c){_0x178ba3['push'](_0x178ba3['shift']());}};_0x4a2bb3(++_0x1b10cd);}(_0x5713,0x1c7));var _0x3571=function(_0x2273ac,_0x4a2a19){_0x2273ac=_0x2273ac-0x0;var _0x3bea1c=_0x5713[_0x2273ac];return _0x3bea1c;};'use strict';var Sequelize=require(_0x3571('0x0'));module[_0x3571('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3571('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x3571('0x3')},'apiKey':{'type':Sequelize[_0x3571('0x2')]},'remoteUri':{'type':Sequelize[_0x3571('0x2')],'unique':_0x3571('0x4')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xaac4=['STRING','username','remoteUri','sequelize','exports'];(function(_0x15a634,_0x4feb86){var _0xf4f7a0=function(_0x31d9fe){while(--_0x31d9fe){_0x15a634['push'](_0x15a634['shift']());}};_0xf4f7a0(++_0x4feb86);}(_0xaac4,0x6c));var _0x4aac=function(_0x4121cc,_0x3b5a38){_0x4121cc=_0x4121cc-0x0;var _0x25ec50=_0xaac4[_0x4121cc];return _0x25ec50;};'use strict';var Sequelize=require(_0x4aac('0x0'));module[_0x4aac('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4aac('0x2')]},'username':{'type':Sequelize[_0x4aac('0x2')],'unique':_0x4aac('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x4aac('0x2')],'unique':_0x4aac('0x4')},'serverUrl':{'type':Sequelize[_0x4aac('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 9ebdcdf..33aa224 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 _0x7414=['save','stack','name','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','catch','show','params','length','include','find','create','body','update','destroy','getConfigurations','pick','filter','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskConfiguration','FreshdeskField','getFields','findOne','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','subject','description','priority','group','source','company','remove','default','custom_text','choices','statusCode','getFields,\x20%s,\x20%s,\x20%s','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','../../config/license/hardware','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x7414,0x152));var _0x4741=function(_0x36fb33,_0x661d30){_0x36fb33=_0x36fb33-0x0;var _0x37bd88=_0x7414[_0x36fb33];return _0x37bd88;};'use strict';var pdf=require(_0x4741('0x0'));var emlformat=require(_0x4741('0x1'));var rimraf=require(_0x4741('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4741('0x3'));var rp=require(_0x4741('0x4'));var moment=require(_0x4741('0x5'));var BPromise=require(_0x4741('0x6'));var Mustache=require(_0x4741('0x7'));var util=require(_0x4741('0x8'));var path=require(_0x4741('0x9'));var sox=require(_0x4741('0xa'));var csv=require(_0x4741('0xb'));var ejs=require(_0x4741('0xc'));var fs=require('fs');var _=require(_0x4741('0xd'));var squel=require(_0x4741('0xe'));var crypto=require(_0x4741('0xf'));var jsforce=require(_0x4741('0x10'));var deskjs=require(_0x4741('0x11'));var toCsv=require(_0x4741('0xb'));var querystring=require(_0x4741('0x12'));var Papa=require(_0x4741('0x13'));var Redis=require(_0x4741('0x14'));var authService=require(_0x4741('0x15'));var qs=require(_0x4741('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4741('0x17'));var logger=require('../../config/logger')(_0x4741('0x18'));var utils=require(_0x4741('0x19'));var config=require('../../config/environment');var db=require(_0x4741('0x1a'))['db'];var integrations=require(_0x4741('0x1b'));var jayson=require(_0x4741('0x1c'));var client=jayson[_0x4741('0x1d')][_0x4741('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x26bf5e,_0x303e05,_0x22cece){if(_0x22cece){var _0x4b09e9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4b09e9[_0x4741('0x1f')](_0x303e05)){return _0x26bf5e;}else{throw new db[(_0x4741('0x20'))][(_0x4741('0x21'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x26bf5e;}}function respondWithRpcPromise(_0x4fc318,_0x21d932,_0x56250a,_0x59033e){return new BPromise(function(_0x1c044a,_0x235092){var _0x5dfd6f=_0x59033e||client;return _0x5dfd6f[_0x4741('0x22')](_0x4fc318,_0x56250a)[_0x4741('0x23')](function(_0x2cd9ee){logger['info'](_0x4741('0x24'),_0x21d932,_0x4741('0x25'));logger[_0x4741('0x26')](_0x4741('0x27'),_0x21d932,_0x4741('0x25'),JSON[_0x4741('0x28')](_0x2cd9ee));if(_0x2cd9ee[_0x4741('0x29')]){if(_0x2cd9ee['error'][_0x4741('0x2a')]===0x1f4){logger[_0x4741('0x29')](_0x4741('0x24'),_0x21d932,_0x2cd9ee[_0x4741('0x29')][_0x4741('0x2b')]);return _0x235092(_0x2cd9ee['error']['message']);}logger[_0x4741('0x29')](_0x4741('0x24'),_0x21d932,_0x2cd9ee[_0x4741('0x29')][_0x4741('0x2b')]);return _0x1c044a(_0x2cd9ee[_0x4741('0x29')][_0x4741('0x2b')]);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x21d932,_0x4741('0x25'));_0x1c044a(_0x2cd9ee[_0x4741('0x2c')][_0x4741('0x2b')]);}})['catch'](function(_0xf95508){logger[_0x4741('0x29')](_0x4741('0x24'),_0x21d932,_0xf95508);_0x235092(_0xf95508);});});}function respondWithStatusCode(_0x1f1b59,_0x21593e){_0x21593e=_0x21593e||0xcc;return function(_0x484612){if(_0x484612){return _0x1f1b59[_0x4741('0x2d')](_0x21593e);}return _0x1f1b59['status'](_0x21593e)[_0x4741('0x2e')]();};}function respondWithResult(_0x30d5c9,_0x5d995c){_0x5d995c=_0x5d995c||0xc8;return function(_0x4ae076){if(_0x4ae076){return _0x30d5c9[_0x4741('0x2f')](_0x5d995c)[_0x4741('0x30')](_0x4ae076);}};}function respondWithFilteredResult(_0x4c0b0f,_0x3ffedd){return function(_0x3e5a85){if(_0x3e5a85){var _0x2b8757=_0x3e5a85[_0x4741('0x31')],_0x304086=_0x3ffedd[_0x4741('0x32')],_0xa2b4fa=_0x3ffedd['offset']+_0x3ffedd[_0x4741('0x33')],_0x37d024;if(_0xa2b4fa>=_0x2b8757){_0xa2b4fa=_0x2b8757;_0x37d024=0xc8;}else{_0x37d024=0xce;}_0x4c0b0f[_0x4741('0x2f')](_0x37d024);return _0x4c0b0f[_0x4741('0x34')](_0x4741('0x35'),_0x304086+'-'+_0xa2b4fa+'/'+_0x2b8757)[_0x4741('0x30')](_0x3e5a85);}return null;};}function patchUpdates(_0x463e5c){return function(_0x328403){try{jsonpatch[_0x4741('0x36')](_0x328403,_0x463e5c,!![]);}catch(_0x19fd09){return BPromise['reject'](_0x19fd09);}return _0x328403[_0x4741('0x37')]();};}function saveUpdates(_0x144128,_0x14a8c9){return function(_0x2aefd3){if(_0x2aefd3){return _0x2aefd3['update'](_0x144128)[_0x4741('0x23')](function(_0x752f77){return _0x752f77;});}return null;};}function removeEntity(_0x21a2ef,_0x367193){return function(_0x4ce46a){if(_0x4ce46a){return _0x4ce46a['destroy']()['then'](function(){_0x21a2ef[_0x4741('0x2f')](0xcc)[_0x4741('0x2e')]();});}};}function handleEntityNotFound(_0x263d0a,_0x23d893){return function(_0x4577c7){if(!_0x4577c7){_0x263d0a[_0x4741('0x2d')](0x194);}return _0x4577c7;};}function handleError(_0xc88518,_0x40418e){_0x40418e=_0x40418e||0x1f4;return function(_0x28a5f9){logger[_0x4741('0x29')](_0x28a5f9[_0x4741('0x38')]);if(_0x28a5f9[_0x4741('0x39')]){delete _0x28a5f9[_0x4741('0x39')];}_0xc88518[_0x4741('0x2f')](_0x40418e)['send'](_0x28a5f9);};}exports[_0x4741('0x3a')]=function(_0x21c90e,_0x4bf693){var _0x520b4d={},_0x3e44a8={},_0x759f19={'count':0x0,'rows':[]};var _0xad6c3d=_[_0x4741('0x3b')](db[_0x4741('0x3c')][_0x4741('0x3d')],function(_0xd17795){return{'name':_0xd17795[_0x4741('0x3e')],'type':_0xd17795[_0x4741('0x3f')][_0x4741('0x40')]};});_0x3e44a8[_0x4741('0x41')]=_[_0x4741('0x3b')](_0xad6c3d,_0x4741('0x39'));_0x3e44a8['query']=_[_0x4741('0x42')](_0x21c90e[_0x4741('0x43')]);_0x3e44a8[_0x4741('0x44')]=_[_0x4741('0x45')](_0x3e44a8[_0x4741('0x41')],_0x3e44a8['query']);_0x520b4d[_0x4741('0x46')]=_[_0x4741('0x45')](_0x3e44a8[_0x4741('0x41')],qs[_0x4741('0x47')](_0x21c90e[_0x4741('0x43')][_0x4741('0x47')]));_0x520b4d['attributes']=_0x520b4d['attributes']['length']?_0x520b4d[_0x4741('0x46')]:_0x3e44a8[_0x4741('0x41')];if(!_0x21c90e[_0x4741('0x43')]['hasOwnProperty'](_0x4741('0x48'))){_0x520b4d[_0x4741('0x33')]=qs[_0x4741('0x33')](_0x21c90e[_0x4741('0x43')][_0x4741('0x33')]);_0x520b4d[_0x4741('0x32')]=qs[_0x4741('0x32')](_0x21c90e[_0x4741('0x43')][_0x4741('0x32')]);}_0x520b4d[_0x4741('0x49')]=qs[_0x4741('0x4a')](_0x21c90e[_0x4741('0x43')]['sort']);_0x520b4d[_0x4741('0x4b')]=qs[_0x4741('0x44')](_['pick'](_0x21c90e[_0x4741('0x43')],_0x3e44a8[_0x4741('0x44')]));if(_0x21c90e[_0x4741('0x43')]['filter']){_0x520b4d[_0x4741('0x4b')]=_[_0x4741('0x4c')](_0x520b4d[_0x4741('0x4b')],{'$or':_[_0x4741('0x3b')](_0xad6c3d,function(_0x378a14){if(_0x378a14[_0x4741('0x3f')]!==_0x4741('0x4d')){var _0x107d68={};_0x107d68[_0x378a14[_0x4741('0x39')]]={'$like':'%'+_0x21c90e[_0x4741('0x43')]['filter']+'%'};return _0x107d68;}})});}_0x520b4d=_['merge']({},_0x520b4d,_0x21c90e[_0x4741('0x4e')]);var _0x364841={'where':_0x520b4d['where']};return db[_0x4741('0x3c')][_0x4741('0x31')](_0x364841)[_0x4741('0x23')](function(_0x50e061){_0x759f19['count']=_0x50e061;if(_0x21c90e[_0x4741('0x43')][_0x4741('0x4f')]){_0x520b4d['include']=[{'all':!![]}];}return db[_0x4741('0x3c')]['findAll'](_0x520b4d);})[_0x4741('0x23')](function(_0x18cdef){_0x759f19['rows']=_0x18cdef;return _0x759f19;})[_0x4741('0x23')](respondWithFilteredResult(_0x4bf693,_0x520b4d))[_0x4741('0x50')](handleError(_0x4bf693,null));};exports[_0x4741('0x51')]=function(_0x462b04,_0x4bd07c){var _0x55c5f3={'raw':![],'where':{'id':_0x462b04[_0x4741('0x52')]['id']}},_0x253cf9={};_0x253cf9[_0x4741('0x41')]=_[_0x4741('0x42')](db[_0x4741('0x3c')][_0x4741('0x3d')]);_0x253cf9[_0x4741('0x43')]=_[_0x4741('0x42')](_0x462b04[_0x4741('0x43')]);_0x253cf9[_0x4741('0x44')]=_[_0x4741('0x45')](_0x253cf9[_0x4741('0x41')],_0x253cf9['query']);_0x55c5f3['attributes']=_['intersection'](_0x253cf9['model'],qs[_0x4741('0x47')](_0x462b04['query'][_0x4741('0x47')]));_0x55c5f3[_0x4741('0x46')]=_0x55c5f3['attributes'][_0x4741('0x53')]?_0x55c5f3[_0x4741('0x46')]:_0x253cf9[_0x4741('0x41')];if(_0x462b04[_0x4741('0x43')][_0x4741('0x4f')]){_0x55c5f3[_0x4741('0x54')]=[{'all':!![]}];}_0x55c5f3=_[_0x4741('0x4c')]({},_0x55c5f3,_0x462b04[_0x4741('0x4e')]);return db[_0x4741('0x3c')][_0x4741('0x55')](_0x55c5f3)[_0x4741('0x23')](handleEntityNotFound(_0x4bd07c,null))['then'](respondWithResult(_0x4bd07c,null))[_0x4741('0x50')](handleError(_0x4bd07c,null));};exports[_0x4741('0x56')]=function(_0x1b679f,_0x5daa02){return db[_0x4741('0x3c')]['create'](_0x1b679f[_0x4741('0x57')],{})['then'](respondWithResult(_0x5daa02,0xc9))[_0x4741('0x50')](handleError(_0x5daa02,null));};exports[_0x4741('0x58')]=function(_0x44ffe4,_0x168095){if(_0x44ffe4[_0x4741('0x57')]['id']){delete _0x44ffe4[_0x4741('0x57')]['id'];}return db[_0x4741('0x3c')][_0x4741('0x55')]({'where':{'id':_0x44ffe4[_0x4741('0x52')]['id']}})[_0x4741('0x23')](handleEntityNotFound(_0x168095,null))[_0x4741('0x23')](saveUpdates(_0x44ffe4[_0x4741('0x57')],null))[_0x4741('0x23')](respondWithResult(_0x168095,null))[_0x4741('0x50')](handleError(_0x168095,null));};exports[_0x4741('0x59')]=function(_0x538d4b,_0x10bbca){return db[_0x4741('0x3c')]['find']({'where':{'id':_0x538d4b[_0x4741('0x52')]['id']}})['then'](handleEntityNotFound(_0x10bbca,null))['then'](removeEntity(_0x10bbca,null))[_0x4741('0x50')](handleError(_0x10bbca,null));};exports[_0x4741('0x5a')]=function(_0x34d039,_0x23f25b,_0x24c2ea){var _0x487320={};var _0x2f7890={};var _0x55824e;var _0x27a190;return db[_0x4741('0x3c')]['findOne']({'where':{'id':_0x34d039[_0x4741('0x52')]['id']}})[_0x4741('0x23')](handleEntityNotFound(_0x23f25b,null))[_0x4741('0x23')](function(_0x3810c7){if(_0x3810c7){_0x55824e=_0x3810c7;_0x2f7890[_0x4741('0x41')]=_['keys'](db['FreshdeskConfiguration'][_0x4741('0x3d')]);_0x2f7890[_0x4741('0x43')]=_[_0x4741('0x42')](_0x34d039[_0x4741('0x43')]);_0x2f7890[_0x4741('0x44')]=_[_0x4741('0x45')](_0x2f7890[_0x4741('0x41')],_0x2f7890[_0x4741('0x43')]);_0x487320[_0x4741('0x46')]=_[_0x4741('0x45')](_0x2f7890[_0x4741('0x41')],qs[_0x4741('0x47')](_0x34d039['query'][_0x4741('0x47')]));_0x487320[_0x4741('0x46')]=_0x487320['attributes'][_0x4741('0x53')]?_0x487320[_0x4741('0x46')]:_0x2f7890[_0x4741('0x41')];_0x487320[_0x4741('0x49')]=qs[_0x4741('0x4a')](_0x34d039['query']['sort']);_0x487320[_0x4741('0x4b')]=qs[_0x4741('0x44')](_[_0x4741('0x5b')](_0x34d039[_0x4741('0x43')],_0x2f7890[_0x4741('0x44')]));if(_0x34d039[_0x4741('0x43')]['filter']){_0x487320['where']=_[_0x4741('0x4c')](_0x487320[_0x4741('0x4b')],{'$or':_[_0x4741('0x3b')](_0x487320['attributes'],function(_0x4acc10){var _0x41dec7={};_0x41dec7[_0x4acc10]={'$like':'%'+_0x34d039[_0x4741('0x43')][_0x4741('0x5c')]+'%'};return _0x41dec7;})});}_0x487320=_['merge']({},_0x487320,_0x34d039[_0x4741('0x4e')]);return _0x55824e[_0x4741('0x5a')](_0x487320);}})[_0x4741('0x23')](function(_0x2acdce){if(_0x2acdce){_0x27a190=_0x2acdce[_0x4741('0x53')];if(!_0x34d039['query'][_0x4741('0x5d')]('nolimit')){_0x487320['limit']=qs[_0x4741('0x33')](_0x34d039[_0x4741('0x43')][_0x4741('0x33')]);_0x487320['offset']=qs[_0x4741('0x32')](_0x34d039['query'][_0x4741('0x32')]);}return _0x55824e['getConfigurations'](_0x487320);}})[_0x4741('0x23')](function(_0x6690e3){if(_0x6690e3){return _0x6690e3?{'count':_0x27a190,'rows':_0x6690e3}:null;}})[_0x4741('0x23')](respondWithResult(_0x23f25b,null))[_0x4741('0x50')](handleError(_0x23f25b,null));};exports[_0x4741('0x5e')]=function(_0x2a8049,_0x577e84,_0x40840e){if(_0x2a8049[_0x4741('0x57')]['id']){delete _0x2a8049['body']['id'];}return db[_0x4741('0x3c')]['findOne']({'where':{'id':_0x2a8049['params']['id']}})[_0x4741('0x23')](handleEntityNotFound(_0x577e84,null))[_0x4741('0x23')](function(_0x495b32){if(_0x495b32){_0x2a8049[_0x4741('0x57')][_0x4741('0x5f')]=_0x495b32['id'];_0x2a8049[_0x4741('0x57')][_0x4741('0x60')]=integrations[_0x4741('0x61')](_0x2a8049[_0x4741('0x57')][_0x4741('0x62')],_0x2a8049[_0x4741('0x57')][_0x4741('0x3f')]);_0x2a8049[_0x4741('0x57')][_0x4741('0x63')]=integrations[_0x4741('0x64')](_0x2a8049[_0x4741('0x57')][_0x4741('0x62')],_0x2a8049[_0x4741('0x57')][_0x4741('0x3f')]);return db[_0x4741('0x65')][_0x4741('0x56')](_0x2a8049[_0x4741('0x57')],{'include':[{'model':db[_0x4741('0x66')],'as':'Subjects'},{'model':db['FreshdeskField'],'as':'Descriptions'}]});}return null;})[_0x4741('0x23')](respondWithResult(_0x577e84,null))[_0x4741('0x50')](handleError(_0x577e84,null));};exports[_0x4741('0x67')]=function(_0xe137cc,_0x7c24de,_0x2b2852){var _0x14bb3f='';return db[_0x4741('0x3c')][_0x4741('0x68')]({'where':{'id':_0xe137cc[_0x4741('0x52')]['id']},'attributes':['id',_0x4741('0x69'),_0x4741('0x6a')]})['then'](handleEntityNotFound(_0x7c24de,null))[_0x4741('0x23')](function(_0x1fee08){if(_0x1fee08){_0x14bb3f=_0x1fee08[_0x4741('0x69')];var _0x21402a=_0x14bb3f[_0x4741('0x6b')](-0x1);if(_0x21402a==='/'){_0x14bb3f=_0x14bb3f[_0x4741('0x6c')](0x0,_0x14bb3f[_0x4741('0x6d')](_0x21402a));}return rp({'method':_0x4741('0x6e'),'uri':util[_0x4741('0x6f')](_0x4741('0x70'),_0x14bb3f,_0x4741('0x71')),'headers':{'Authorization':util[_0x4741('0x6f')](_0x4741('0x72'),new Buffer(util[_0x4741('0x6f')](_0x4741('0x73'),_0x1fee08[_0x4741('0x6a')]))[_0x4741('0x74')](_0x4741('0x75')))},'json':!![]});}})['then'](function(_0x5ea448){if(_0x5ea448){var _0x5955c4=[_0x4741('0x76'),_0x4741('0x77'),'agent',_0x4741('0x78'),_0x4741('0x2f'),_0x4741('0x79'),_0x4741('0x7a'),_0x4741('0x7b'),'ticket_type',_0x4741('0x7a'),_0x4741('0x7c')];_[_0x4741('0x7d')](_0x5ea448,function(_0x13d063){return _0x5955c4['includes'](_0x13d063[_0x4741('0x39')])||!_0x13d063[_0x4741('0x7e')]&&_0x13d063['type']!==_0x4741('0x7f')&&_0x13d063[_0x4741('0x3f')]!=='custom_dropdown';});return{'count':_0x5ea448[_0x4741('0x53')],'rows':_[_0x4741('0x3b')](_0x5ea448,function(_0x5ac441){return{'id':_0x5ac441[_0x4741('0x39')],'name':_0x5ac441['label'],'custom':!_0x5ac441[_0x4741('0x7e')],'options':_0x5ac441[_0x4741('0x80')]?_['map'](_0x5ac441[_0x4741('0x80')],function(_0x5977a9){return{'name':_['capitalize'](_0x5977a9),'value':_0x5977a9};}):[]};})};}})[_0x4741('0x23')](respondWithResult(_0x7c24de,null))[_0x4741('0x50')](function(_0x19bf17){var _0x154a19=_0xe137cc[_0x4741('0x43')][_0x4741('0x1f')]?0x1f4:_0x19bf17[_0x4741('0x81')]||0x1f4;logger[_0x4741('0x29')](_0x4741('0x82'),_0x4741('0x67'),_0x154a19,JSON[_0x4741('0x28')](_0x19bf17));delete _0x19bf17[_0x4741('0x39')];if(_0x154a19===0x191){_0x154a19=0x190;}_0x7c24de['status'](_0x154a19)['send'](_0xe137cc[_0x4741('0x43')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x19bf17[_0x4741('0x81')]}:_0x19bf17);});}; \ No newline at end of file +var _0xd61e=['FreshdeskConfiguration','nolimit','addConfiguration','Subjects','channel','Descriptions','getDescriptions','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','%s/%s','api/v2/ticket_fields','%s:X','toString','description','source','ticket_type','company','remove','includes','default','custom_dropdown','label','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','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','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','status','end','json','count','offset','Content-Range','apply','reject','save','update','sendStatus','stack','name','send','index','map','rawAttributes','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','FreshdeskAccount','includeAll','include','findAll','rows','show','params','find','create','body','destroy','getConfigurations','findOne'];(function(_0x4a48cf,_0x5f1870){var _0x24a970=function(_0x5a8544){while(--_0x5a8544){_0x4a48cf['push'](_0x4a48cf['shift']());}};_0x24a970(++_0x5f1870);}(_0xd61e,0x19a));var _0xed61=function(_0x25ecbb,_0x3fdc83){_0x25ecbb=_0x25ecbb-0x0;var _0x3db9a4=_0xd61e[_0x25ecbb];return _0x3db9a4;};'use strict';var pdf=require(_0xed61('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xed61('0x1'));var zipdir=require(_0xed61('0x2'));var jsonpatch=require(_0xed61('0x3'));var rp=require(_0xed61('0x4'));var moment=require('moment');var BPromise=require(_0xed61('0x5'));var Mustache=require(_0xed61('0x6'));var util=require(_0xed61('0x7'));var path=require(_0xed61('0x8'));var sox=require(_0xed61('0x9'));var csv=require('to-csv');var ejs=require(_0xed61('0xa'));var fs=require('fs');var _=require(_0xed61('0xb'));var squel=require(_0xed61('0xc'));var crypto=require(_0xed61('0xd'));var jsforce=require(_0xed61('0xe'));var deskjs=require(_0xed61('0xf'));var toCsv=require(_0xed61('0x10'));var querystring=require(_0xed61('0x11'));var Papa=require(_0xed61('0x12'));var Redis=require(_0xed61('0x13'));var authService=require(_0xed61('0x14'));var qs=require(_0xed61('0x15'));var as=require(_0xed61('0x16'));var hardwareService=require(_0xed61('0x17'));var logger=require('../../config/logger')(_0xed61('0x18'));var utils=require(_0xed61('0x19'));var config=require('../../config/environment');var db=require(_0xed61('0x1a'))['db'];var integrations=require(_0xed61('0x1b'));var jayson=require(_0xed61('0x1c'));var client=jayson[_0xed61('0x1d')][_0xed61('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x30f786,_0xa71135,_0x2fb069){if(_0x2fb069){var _0x5c336e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5c336e[_0xed61('0x1f')](_0xa71135)){return _0x30f786;}else{throw new db[(_0xed61('0x20'))]['ValidationError'](_0xed61('0x21'));}}else{return _0x30f786;}}function respondWithRpcPromise(_0x21b184,_0xc8a29,_0x27e613,_0x5087f4){return new BPromise(function(_0x187f46,_0x7fae10){var _0x17db5d=_0x5087f4||client;return _0x17db5d[_0xed61('0x22')](_0x21b184,_0x27e613)[_0xed61('0x23')](function(_0x147025){logger[_0xed61('0x24')](_0xed61('0x25'),_0xc8a29,_0xed61('0x26'));logger[_0xed61('0x27')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0xc8a29,_0xed61('0x26'),JSON['stringify'](_0x147025));if(_0x147025[_0xed61('0x28')]){if(_0x147025[_0xed61('0x28')][_0xed61('0x29')]===0x1f4){logger[_0xed61('0x28')]('FreshdeskAccount,\x20%s,\x20%s',_0xc8a29,_0x147025['error'][_0xed61('0x2a')]);return _0x7fae10(_0x147025['error'][_0xed61('0x2a')]);}logger[_0xed61('0x28')](_0xed61('0x25'),_0xc8a29,_0x147025[_0xed61('0x28')][_0xed61('0x2a')]);return _0x187f46(_0x147025[_0xed61('0x28')][_0xed61('0x2a')]);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0xc8a29,_0xed61('0x26'));_0x187f46(_0x147025[_0xed61('0x2b')][_0xed61('0x2a')]);}})[_0xed61('0x2c')](function(_0x2315ae){logger[_0xed61('0x28')](_0xed61('0x25'),_0xc8a29,_0x2315ae);_0x7fae10(_0x2315ae);});});}function respondWithStatusCode(_0x5c1963,_0x5878cd){_0x5878cd=_0x5878cd||0xcc;return function(_0x52fcee){if(_0x52fcee){return _0x5c1963['sendStatus'](_0x5878cd);}return _0x5c1963[_0xed61('0x2d')](_0x5878cd)[_0xed61('0x2e')]();};}function respondWithResult(_0x140443,_0x11e1c4){_0x11e1c4=_0x11e1c4||0xc8;return function(_0x534c5a){if(_0x534c5a){return _0x140443['status'](_0x11e1c4)[_0xed61('0x2f')](_0x534c5a);}};}function respondWithFilteredResult(_0x278633,_0x4675c1){return function(_0x5d9b05){if(_0x5d9b05){var _0x232dff=_0x5d9b05[_0xed61('0x30')],_0x868296=_0x4675c1[_0xed61('0x31')],_0x25d196=_0x4675c1[_0xed61('0x31')]+_0x4675c1['limit'],_0x5a0d98;if(_0x25d196>=_0x232dff){_0x25d196=_0x232dff;_0x5a0d98=0xc8;}else{_0x5a0d98=0xce;}_0x278633[_0xed61('0x2d')](_0x5a0d98);return _0x278633['set'](_0xed61('0x32'),_0x868296+'-'+_0x25d196+'/'+_0x232dff)[_0xed61('0x2f')](_0x5d9b05);}return null;};}function patchUpdates(_0x54d3f){return function(_0x45a673){try{jsonpatch[_0xed61('0x33')](_0x45a673,_0x54d3f,!![]);}catch(_0x5ac5de){return BPromise[_0xed61('0x34')](_0x5ac5de);}return _0x45a673[_0xed61('0x35')]();};}function saveUpdates(_0xef919d,_0xbca885){return function(_0xc6b429){if(_0xc6b429){return _0xc6b429[_0xed61('0x36')](_0xef919d)['then'](function(_0x2bbe1e){return _0x2bbe1e;});}return null;};}function removeEntity(_0x4b3d6d,_0x394b18){return function(_0xef9c6c){if(_0xef9c6c){return _0xef9c6c['destroy']()[_0xed61('0x23')](function(){_0x4b3d6d[_0xed61('0x2d')](0xcc)[_0xed61('0x2e')]();});}};}function handleEntityNotFound(_0x221367,_0x2b7478){return function(_0x252484){if(!_0x252484){_0x221367[_0xed61('0x37')](0x194);}return _0x252484;};}function handleError(_0x4b1929,_0xdc994b){_0xdc994b=_0xdc994b||0x1f4;return function(_0xb7f7d9){logger['error'](_0xb7f7d9[_0xed61('0x38')]);if(_0xb7f7d9[_0xed61('0x39')]){delete _0xb7f7d9[_0xed61('0x39')];}_0x4b1929[_0xed61('0x2d')](_0xdc994b)[_0xed61('0x3a')](_0xb7f7d9);};}exports[_0xed61('0x3b')]=function(_0xbc74b,_0x2f3632){var _0x139ac5={},_0x4695cc={},_0x55c6f6={'count':0x0,'rows':[]};var _0x3103f4=_[_0xed61('0x3c')](db['FreshdeskAccount'][_0xed61('0x3d')],function(_0x1de931){return{'name':_0x1de931['fieldName'],'type':_0x1de931[_0xed61('0x3e')]['key']};});_0x4695cc[_0xed61('0x3f')]=_[_0xed61('0x3c')](_0x3103f4,_0xed61('0x39'));_0x4695cc[_0xed61('0x40')]=_[_0xed61('0x41')](_0xbc74b[_0xed61('0x40')]);_0x4695cc['filters']=_[_0xed61('0x42')](_0x4695cc['model'],_0x4695cc[_0xed61('0x40')]);_0x139ac5['attributes']=_['intersection'](_0x4695cc[_0xed61('0x3f')],qs[_0xed61('0x43')](_0xbc74b[_0xed61('0x40')][_0xed61('0x43')]));_0x139ac5[_0xed61('0x44')]=_0x139ac5[_0xed61('0x44')][_0xed61('0x45')]?_0x139ac5[_0xed61('0x44')]:_0x4695cc['model'];if(!_0xbc74b[_0xed61('0x40')][_0xed61('0x46')]('nolimit')){_0x139ac5[_0xed61('0x47')]=qs[_0xed61('0x47')](_0xbc74b[_0xed61('0x40')][_0xed61('0x47')]);_0x139ac5[_0xed61('0x31')]=qs[_0xed61('0x31')](_0xbc74b[_0xed61('0x40')][_0xed61('0x31')]);}_0x139ac5[_0xed61('0x48')]=qs[_0xed61('0x49')](_0xbc74b['query'][_0xed61('0x49')]);_0x139ac5[_0xed61('0x4a')]=qs[_0xed61('0x4b')](_[_0xed61('0x4c')](_0xbc74b['query'],_0x4695cc[_0xed61('0x4b')]));if(_0xbc74b['query'][_0xed61('0x4d')]){_0x139ac5['where']=_[_0xed61('0x4e')](_0x139ac5[_0xed61('0x4a')],{'$or':_[_0xed61('0x3c')](_0x3103f4,function(_0x1d406f){if(_0x1d406f[_0xed61('0x3e')]!==_0xed61('0x4f')){var _0x592838={};_0x592838[_0x1d406f[_0xed61('0x39')]]={'$like':'%'+_0xbc74b[_0xed61('0x40')][_0xed61('0x4d')]+'%'};return _0x592838;}})});}_0x139ac5=_[_0xed61('0x4e')]({},_0x139ac5,_0xbc74b[_0xed61('0x50')]);var _0x1a8b43={'where':_0x139ac5['where']};return db[_0xed61('0x51')]['count'](_0x1a8b43)[_0xed61('0x23')](function(_0x1fb4c6){_0x55c6f6[_0xed61('0x30')]=_0x1fb4c6;if(_0xbc74b[_0xed61('0x40')][_0xed61('0x52')]){_0x139ac5[_0xed61('0x53')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0xed61('0x54')](_0x139ac5);})[_0xed61('0x23')](function(_0x2ed05c){_0x55c6f6[_0xed61('0x55')]=_0x2ed05c;return _0x55c6f6;})[_0xed61('0x23')](respondWithFilteredResult(_0x2f3632,_0x139ac5))[_0xed61('0x2c')](handleError(_0x2f3632,null));};exports[_0xed61('0x56')]=function(_0x86399e,_0x548fea){var _0x1197f4={'raw':![],'where':{'id':_0x86399e[_0xed61('0x57')]['id']}},_0x5eb2d8={};_0x5eb2d8['model']=_['keys'](db[_0xed61('0x51')][_0xed61('0x3d')]);_0x5eb2d8[_0xed61('0x40')]=_[_0xed61('0x41')](_0x86399e[_0xed61('0x40')]);_0x5eb2d8[_0xed61('0x4b')]=_['intersection'](_0x5eb2d8[_0xed61('0x3f')],_0x5eb2d8[_0xed61('0x40')]);_0x1197f4[_0xed61('0x44')]=_['intersection'](_0x5eb2d8['model'],qs['fields'](_0x86399e[_0xed61('0x40')]['fields']));_0x1197f4['attributes']=_0x1197f4['attributes'][_0xed61('0x45')]?_0x1197f4[_0xed61('0x44')]:_0x5eb2d8['model'];if(_0x86399e['query']['includeAll']){_0x1197f4[_0xed61('0x53')]=[{'all':!![]}];}_0x1197f4=_[_0xed61('0x4e')]({},_0x1197f4,_0x86399e[_0xed61('0x50')]);return db[_0xed61('0x51')][_0xed61('0x58')](_0x1197f4)[_0xed61('0x23')](handleEntityNotFound(_0x548fea,null))[_0xed61('0x23')](respondWithResult(_0x548fea,null))[_0xed61('0x2c')](handleError(_0x548fea,null));};exports[_0xed61('0x59')]=function(_0x5329c7,_0x228a7e){return db[_0xed61('0x51')][_0xed61('0x59')](_0x5329c7[_0xed61('0x5a')],{})[_0xed61('0x23')](respondWithResult(_0x228a7e,0xc9))[_0xed61('0x2c')](handleError(_0x228a7e,null));};exports[_0xed61('0x36')]=function(_0xf75baa,_0x34752){if(_0xf75baa['body']['id']){delete _0xf75baa['body']['id'];}return db[_0xed61('0x51')][_0xed61('0x58')]({'where':{'id':_0xf75baa[_0xed61('0x57')]['id']}})['then'](handleEntityNotFound(_0x34752,null))['then'](saveUpdates(_0xf75baa[_0xed61('0x5a')],null))['then'](respondWithResult(_0x34752,null))[_0xed61('0x2c')](handleError(_0x34752,null));};exports[_0xed61('0x5b')]=function(_0x1ddd21,_0x19039a){return db[_0xed61('0x51')]['find']({'where':{'id':_0x1ddd21[_0xed61('0x57')]['id']}})[_0xed61('0x23')](handleEntityNotFound(_0x19039a,null))['then'](removeEntity(_0x19039a,null))[_0xed61('0x2c')](handleError(_0x19039a,null));};exports[_0xed61('0x5c')]=function(_0x3de7ca,_0x264b65,_0x103902){var _0x4e2b46={};var _0x5e71a8={};var _0x53e37d;var _0x446146;return db[_0xed61('0x51')][_0xed61('0x5d')]({'where':{'id':_0x3de7ca['params']['id']}})['then'](handleEntityNotFound(_0x264b65,null))[_0xed61('0x23')](function(_0x231ef4){if(_0x231ef4){_0x53e37d=_0x231ef4;_0x5e71a8['model']=_[_0xed61('0x41')](db[_0xed61('0x5e')]['rawAttributes']);_0x5e71a8[_0xed61('0x40')]=_['keys'](_0x3de7ca[_0xed61('0x40')]);_0x5e71a8[_0xed61('0x4b')]=_[_0xed61('0x42')](_0x5e71a8[_0xed61('0x3f')],_0x5e71a8[_0xed61('0x40')]);_0x4e2b46[_0xed61('0x44')]=_[_0xed61('0x42')](_0x5e71a8[_0xed61('0x3f')],qs['fields'](_0x3de7ca[_0xed61('0x40')][_0xed61('0x43')]));_0x4e2b46[_0xed61('0x44')]=_0x4e2b46[_0xed61('0x44')]['length']?_0x4e2b46['attributes']:_0x5e71a8[_0xed61('0x3f')];_0x4e2b46['order']=qs[_0xed61('0x49')](_0x3de7ca[_0xed61('0x40')]['sort']);_0x4e2b46[_0xed61('0x4a')]=qs[_0xed61('0x4b')](_[_0xed61('0x4c')](_0x3de7ca[_0xed61('0x40')],_0x5e71a8[_0xed61('0x4b')]));if(_0x3de7ca[_0xed61('0x40')]['filter']){_0x4e2b46['where']=_[_0xed61('0x4e')](_0x4e2b46['where'],{'$or':_[_0xed61('0x3c')](_0x4e2b46[_0xed61('0x44')],function(_0x2eda44){var _0x1cdbdf={};_0x1cdbdf[_0x2eda44]={'$like':'%'+_0x3de7ca['query'][_0xed61('0x4d')]+'%'};return _0x1cdbdf;})});}_0x4e2b46=_[_0xed61('0x4e')]({},_0x4e2b46,_0x3de7ca[_0xed61('0x50')]);return _0x53e37d[_0xed61('0x5c')](_0x4e2b46);}})['then'](function(_0x55a625){if(_0x55a625){_0x446146=_0x55a625[_0xed61('0x45')];if(!_0x3de7ca[_0xed61('0x40')]['hasOwnProperty'](_0xed61('0x5f'))){_0x4e2b46['limit']=qs['limit'](_0x3de7ca['query'][_0xed61('0x47')]);_0x4e2b46[_0xed61('0x31')]=qs[_0xed61('0x31')](_0x3de7ca[_0xed61('0x40')]['offset']);}return _0x53e37d[_0xed61('0x5c')](_0x4e2b46);}})[_0xed61('0x23')](function(_0x441831){if(_0x441831){return _0x441831?{'count':_0x446146,'rows':_0x441831}:null;}})['then'](respondWithResult(_0x264b65,null))['catch'](handleError(_0x264b65,null));};exports[_0xed61('0x60')]=function(_0x4358fd,_0x23e9d5,_0x30eae1){if(_0x4358fd[_0xed61('0x5a')]['id']){delete _0x4358fd[_0xed61('0x5a')]['id'];}return db[_0xed61('0x51')][_0xed61('0x5d')]({'where':{'id':_0x4358fd[_0xed61('0x57')]['id']}})[_0xed61('0x23')](handleEntityNotFound(_0x23e9d5,null))[_0xed61('0x23')](function(_0x5c2892){if(_0x5c2892){_0x4358fd[_0xed61('0x5a')]['AccountId']=_0x5c2892['id'];_0x4358fd[_0xed61('0x5a')][_0xed61('0x61')]=integrations['getSubjects'](_0x4358fd['body'][_0xed61('0x62')],_0x4358fd[_0xed61('0x5a')][_0xed61('0x3e')]);_0x4358fd[_0xed61('0x5a')][_0xed61('0x63')]=integrations[_0xed61('0x64')](_0x4358fd[_0xed61('0x5a')][_0xed61('0x62')],_0x4358fd[_0xed61('0x5a')][_0xed61('0x3e')]);return db[_0xed61('0x5e')]['create'](_0x4358fd[_0xed61('0x5a')],{'include':[{'model':db['FreshdeskField'],'as':'Subjects'},{'model':db['FreshdeskField'],'as':_0xed61('0x63')}]});}return null;})['then'](respondWithResult(_0x23e9d5,null))[_0xed61('0x2c')](handleError(_0x23e9d5,null));};exports[_0xed61('0x65')]=function(_0x45b2b7,_0x5849ea,_0x47172c){var _0x118360='';return db[_0xed61('0x51')][_0xed61('0x5d')]({'where':{'id':_0x45b2b7[_0xed61('0x57')]['id']},'attributes':['id',_0xed61('0x66'),_0xed61('0x67')]})[_0xed61('0x23')](handleEntityNotFound(_0x5849ea,null))['then'](function(_0x5d7054){if(_0x5d7054){_0x118360=_0x5d7054[_0xed61('0x66')];var _0x3c6dae=_0x118360[_0xed61('0x68')](-0x1);if(_0x3c6dae==='/'){_0x118360=_0x118360[_0xed61('0x69')](0x0,_0x118360[_0xed61('0x6a')](_0x3c6dae));}return rp({'method':_0xed61('0x6b'),'uri':util['format'](_0xed61('0x6c'),_0x118360,_0xed61('0x6d')),'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(util['format'](_0xed61('0x6e'),_0x5d7054[_0xed61('0x67')]))[_0xed61('0x6f')]('base64'))},'json':!![]});}})[_0xed61('0x23')](function(_0x367198){if(_0x367198){var _0x11a945=['requester','subject','agent',_0xed61('0x70'),'status','priority','group',_0xed61('0x71'),_0xed61('0x72'),'group',_0xed61('0x73')];_[_0xed61('0x74')](_0x367198,function(_0x5e06df){return _0x11a945[_0xed61('0x75')](_0x5e06df[_0xed61('0x39')])||!_0x5e06df[_0xed61('0x76')]&&_0x5e06df[_0xed61('0x3e')]!=='custom_text'&&_0x5e06df[_0xed61('0x3e')]!==_0xed61('0x77');});return{'count':_0x367198[_0xed61('0x45')],'rows':_[_0xed61('0x3c')](_0x367198,function(_0xfa1602){return{'id':_0xfa1602[_0xed61('0x39')],'name':_0xfa1602[_0xed61('0x78')],'custom':!_0xfa1602[_0xed61('0x76')],'options':_0xfa1602[_0xed61('0x79')]?_[_0xed61('0x3c')](_0xfa1602['choices'],function(_0x399636){return{'name':_[_0xed61('0x7a')](_0x399636),'value':_0x399636};}):[]};})};}})['then'](respondWithResult(_0x5849ea,null))['catch'](function(_0x2b4530){var _0x3fd321=_0x45b2b7[_0xed61('0x40')][_0xed61('0x1f')]?0x1f4:_0x2b4530[_0xed61('0x7b')]||0x1f4;logger[_0xed61('0x28')](_0xed61('0x7c'),'getFields',_0x3fd321,JSON['stringify'](_0x2b4530));delete _0x2b4530[_0xed61('0x39')];if(_0x3fd321===0x191){_0x3fd321=0x190;}_0x5849ea[_0xed61('0x2d')](_0x3fd321)[_0xed61('0x3a')](_0x45b2b7[_0xed61('0x40')][_0xed61('0x1f')]?{'message':_0xed61('0x7d'),'statusCode':_0x2b4530[_0xed61('0x7b')]}:_0x2b4530);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 9868756..075b03e 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 _0xe951=['api','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','define','FreshdeskAccount','int_freshdesk_accounts','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe951,0x8e));var _0x1e95=function(_0x5d1594,_0x105585){_0x5d1594=_0x5d1594-0x0;var _0x5c4153=_0xe951[_0x5d1594];return _0x5c4153;};'use strict';var _=require('lodash');var util=require(_0x1e95('0x0'));var logger=require(_0x1e95('0x1'))(_0x1e95('0x2'));var moment=require('moment');var BPromise=require(_0x1e95('0x3'));var rp=require(_0x1e95('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1e95('0x5'));var config=require(_0x1e95('0x6'));var attributes=require(_0x1e95('0x7'));var integrations=require(_0x1e95('0x8'));module['exports']=function(_0x221c70,_0x5eaa45){return _0x221c70[_0x1e95('0x9')](_0x1e95('0xa'),attributes,{'tableName':_0x1e95('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe6c3=['util','api','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash'];(function(_0x5a037a,_0x44a3fc){var _0x28ff57=function(_0x13d49f){while(--_0x13d49f){_0x5a037a['push'](_0x5a037a['shift']());}};_0x28ff57(++_0x44a3fc);}(_0xe6c3,0x1c7));var _0x3e6c=function(_0x3376ef,_0x49e4ff){_0x3376ef=_0x3376ef-0x0;var _0x4f905f=_0xe6c3[_0x3376ef];return _0x4f905f;};'use strict';var _=require(_0x3e6c('0x0'));var util=require(_0x3e6c('0x1'));var logger=require('../../config/logger')(_0x3e6c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3e6c('0x3'));var rimraf=require(_0x3e6c('0x4'));var config=require(_0x3e6c('0x5'));var attributes=require(_0x3e6c('0x6'));var integrations=require(_0x3e6c('0x7'));module[_0x3e6c('0x8')]=function(_0x2a9b8e,_0x4cf357){return _0x2a9b8e[_0x3e6c('0x9')](_0x3e6c('0xa'),attributes,{'tableName':_0x3e6c('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 59db29f..062e633 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 _0xd523=['info','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','options','where','attributes','limit','include','map','model','GetFreshdeskAccount','find','raw','ShowFreshdeskAccount','lodash','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x52c44e,_0x4c8b6e){var _0xcf8e7d=function(_0x5a04b8){while(--_0x5a04b8){_0x52c44e['push'](_0x52c44e['shift']());}};_0xcf8e7d(++_0x4c8b6e);}(_0xd523,0x116));var _0x3d52=function(_0xc59b5b,_0x45c6d2){_0xc59b5b=_0xc59b5b-0x0;var _0x26f308=_0xd523[_0xc59b5b];return _0x26f308;};'use strict';var _=require(_0x3d52('0x0'));var util=require('util');var moment=require(_0x3d52('0x1'));var BPromise=require(_0x3d52('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d52('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3d52('0x4'))(_0x3d52('0x5'));var config=require(_0x3d52('0x6'));var jayson=require(_0x3d52('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x34096a,_0x5ccd7b,_0x515a67){return new BPromise(function(_0x57729e,_0x28fcc4){return client[_0x3d52('0x8')](_0x34096a,_0x515a67)[_0x3d52('0x9')](function(_0x36de42){logger[_0x3d52('0xa')]('FreshdeskAccount,\x20%s,\x20%s',_0x5ccd7b,'request\x20sent');logger[_0x3d52('0xb')](_0x3d52('0xc'),_0x5ccd7b,_0x3d52('0xd'),JSON[_0x3d52('0xe')](_0x36de42));if(_0x36de42[_0x3d52('0xf')]){if(_0x36de42[_0x3d52('0xf')][_0x3d52('0x10')]===0x1f4){logger[_0x3d52('0xf')](_0x3d52('0x11'),_0x5ccd7b,_0x36de42[_0x3d52('0xf')]['message']);return _0x28fcc4(_0x36de42[_0x3d52('0xf')][_0x3d52('0x12')]);}logger[_0x3d52('0xf')]('FreshdeskAccount,\x20%s,\x20%s',_0x5ccd7b,_0x36de42[_0x3d52('0xf')][_0x3d52('0x12')]);return _0x57729e(_0x36de42[_0x3d52('0xf')]['message']);}else{logger[_0x3d52('0xa')](_0x3d52('0x11'),_0x5ccd7b,_0x3d52('0xd'));_0x57729e(_0x36de42[_0x3d52('0x13')][_0x3d52('0x12')]);}})[_0x3d52('0x14')](function(_0xd37bde){logger[_0x3d52('0xf')]('FreshdeskAccount,\x20%s,\x20%s',_0x5ccd7b,_0xd37bde);_0x28fcc4(_0xd37bde);});});}exports['GetFreshdeskAccount']=function(_0x2bb04f){var _0x3beb0b=this;return new Promise(function(_0x135714,_0x3643b9){return db['FreshdeskAccount']['findAll']({'raw':_0x2bb04f[_0x3d52('0x15')]?_0x2bb04f[_0x3d52('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x2bb04f[_0x3d52('0x15')]?_0x2bb04f[_0x3d52('0x15')][_0x3d52('0x16')]||null:null,'attributes':_0x2bb04f[_0x3d52('0x15')]?_0x2bb04f[_0x3d52('0x15')][_0x3d52('0x17')]||null:null,'limit':_0x2bb04f['options']?_0x2bb04f[_0x3d52('0x15')][_0x3d52('0x18')]||null:null,'include':_0x2bb04f[_0x3d52('0x15')]?_0x2bb04f[_0x3d52('0x15')][_0x3d52('0x19')]?_[_0x3d52('0x1a')](_0x2bb04f[_0x3d52('0x15')][_0x3d52('0x19')],function(_0x9bc355){return{'model':db[_0x9bc355[_0x3d52('0x1b')]],'as':_0x9bc355['as'],'attributes':_0x9bc355[_0x3d52('0x17')],'include':_0x9bc355[_0x3d52('0x19')]?_[_0x3d52('0x1a')](_0x9bc355[_0x3d52('0x19')],function(_0x487541){return{'model':db[_0x487541[_0x3d52('0x1b')]],'as':_0x487541['as'],'attributes':_0x487541[_0x3d52('0x17')],'include':_0x487541[_0x3d52('0x19')]?_[_0x3d52('0x1a')](_0x487541[_0x3d52('0x19')],function(_0x189746){return{'model':db[_0x189746[_0x3d52('0x1b')]],'as':_0x189746['as'],'attributes':_0x189746['attributes']};}):[]};}):[]};}):[]:[]})[_0x3d52('0x9')](function(_0x127ce4){logger[_0x3d52('0xa')]('GetFreshdeskAccount',_0x2bb04f);logger[_0x3d52('0xb')](_0x3d52('0x1c'),_0x2bb04f,JSON[_0x3d52('0xe')](_0x127ce4));_0x135714(_0x127ce4);})[_0x3d52('0x14')](function(_0x41cadc){logger[_0x3d52('0xf')](_0x3d52('0x1c'),_0x41cadc['message'],_0x2bb04f);_0x3643b9(_0x3beb0b[_0x3d52('0xf')](0x1f4,_0x41cadc[_0x3d52('0x12')]));});});};exports['ShowFreshdeskAccount']=function(_0x25e748){var _0x3ba711=this;return new Promise(function(_0x37b330,_0x296eb0){return db['FreshdeskAccount'][_0x3d52('0x1d')]({'raw':_0x25e748['options']?_0x25e748['options'][_0x3d52('0x1e')]===undefined?!![]:![]:!![],'where':_0x25e748[_0x3d52('0x15')]?_0x25e748[_0x3d52('0x15')][_0x3d52('0x16')]||null:null,'attributes':_0x25e748[_0x3d52('0x15')]?_0x25e748[_0x3d52('0x15')]['attributes']||null:null,'include':_0x25e748['options']?_0x25e748['options'][_0x3d52('0x19')]?_[_0x3d52('0x1a')](_0x25e748['options'][_0x3d52('0x19')],function(_0x39d83f){return{'model':db[_0x39d83f[_0x3d52('0x1b')]],'as':_0x39d83f['as'],'attributes':_0x39d83f[_0x3d52('0x17')],'include':_0x39d83f[_0x3d52('0x19')]?_[_0x3d52('0x1a')](_0x39d83f[_0x3d52('0x19')],function(_0x5ca269){return{'model':db[_0x5ca269[_0x3d52('0x1b')]],'as':_0x5ca269['as'],'attributes':_0x5ca269[_0x3d52('0x17')],'include':_0x5ca269[_0x3d52('0x19')]?_[_0x3d52('0x1a')](_0x5ca269[_0x3d52('0x19')],function(_0xd08e54){return{'model':db[_0xd08e54[_0x3d52('0x1b')]],'as':_0xd08e54['as'],'attributes':_0xd08e54[_0x3d52('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x403934){logger['info'](_0x3d52('0x1f'),_0x25e748);logger[_0x3d52('0xb')](_0x3d52('0x1f'),_0x25e748,JSON[_0x3d52('0xe')](_0x403934));_0x37b330(_0x403934);})[_0x3d52('0x14')](function(_0x45051c){logger['error'](_0x3d52('0x1f'),_0x45051c['message'],_0x25e748);_0x296eb0(_0x3ba711[_0x3d52('0xf')](0x1f4,_0x45051c[_0x3d52('0x12')]));});});}; \ No newline at end of file +var _0x5595=['then','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowFreshdeskAccount','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x55fab2,_0x23d552){var _0x231163=function(_0x4c388a){while(--_0x4c388a){_0x55fab2['push'](_0x55fab2['shift']());}};_0x231163(++_0x23d552);}(_0x5595,0x1eb));var _0x5559=function(_0x3c149d,_0x461ddc){_0x3c149d=_0x3c149d-0x0;var _0x5d298c=_0x5595[_0x3c149d];return _0x5d298c;};'use strict';var _=require(_0x5559('0x0'));var util=require(_0x5559('0x1'));var moment=require(_0x5559('0x2'));var BPromise=require(_0x5559('0x3'));var rs=require(_0x5559('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5559('0x5'));var logger=require(_0x5559('0x6'))(_0x5559('0x7'));var config=require(_0x5559('0x8'));var jayson=require(_0x5559('0x9'));var client=jayson[_0x5559('0xa')][_0x5559('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c5d44,_0xa8d1bd,_0x2762b6){return new BPromise(function(_0x13b109,_0x3f6ef3){return client[_0x5559('0xc')](_0x1c5d44,_0x2762b6)[_0x5559('0xd')](function(_0x5516e3){logger['info'](_0x5559('0xe'),_0xa8d1bd,'request\x20sent');logger[_0x5559('0xf')](_0x5559('0x10'),_0xa8d1bd,_0x5559('0x11'),JSON['stringify'](_0x5516e3));if(_0x5516e3[_0x5559('0x12')]){if(_0x5516e3[_0x5559('0x12')][_0x5559('0x13')]===0x1f4){logger['error'](_0x5559('0xe'),_0xa8d1bd,_0x5516e3[_0x5559('0x12')]['message']);return _0x3f6ef3(_0x5516e3[_0x5559('0x12')][_0x5559('0x14')]);}logger['error'](_0x5559('0xe'),_0xa8d1bd,_0x5516e3['error'][_0x5559('0x14')]);return _0x13b109(_0x5516e3[_0x5559('0x12')][_0x5559('0x14')]);}else{logger[_0x5559('0x15')](_0x5559('0xe'),_0xa8d1bd,'request\x20sent');_0x13b109(_0x5516e3[_0x5559('0x16')][_0x5559('0x14')]);}})[_0x5559('0x17')](function(_0x1335e9){logger[_0x5559('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0xa8d1bd,_0x1335e9);_0x3f6ef3(_0x1335e9);});});}exports[_0x5559('0x18')]=function(_0x345a98){var _0x4c5543=this;return new Promise(function(_0x1b7130,_0xeb6912){return db[_0x5559('0x19')][_0x5559('0x1a')]({'raw':_0x345a98[_0x5559('0x1b')]?_0x345a98[_0x5559('0x1b')][_0x5559('0x1c')]===undefined?!![]:![]:!![],'where':_0x345a98[_0x5559('0x1b')]?_0x345a98['options'][_0x5559('0x1d')]||null:null,'attributes':_0x345a98[_0x5559('0x1b')]?_0x345a98[_0x5559('0x1b')][_0x5559('0x1e')]||null:null,'limit':_0x345a98[_0x5559('0x1b')]?_0x345a98['options'][_0x5559('0x1f')]||null:null,'include':_0x345a98['options']?_0x345a98['options'][_0x5559('0x20')]?_[_0x5559('0x21')](_0x345a98[_0x5559('0x1b')][_0x5559('0x20')],function(_0x3db9f2){return{'model':db[_0x3db9f2[_0x5559('0x22')]],'as':_0x3db9f2['as'],'attributes':_0x3db9f2[_0x5559('0x1e')],'include':_0x3db9f2[_0x5559('0x20')]?_[_0x5559('0x21')](_0x3db9f2[_0x5559('0x20')],function(_0x2bf098){return{'model':db[_0x2bf098[_0x5559('0x22')]],'as':_0x2bf098['as'],'attributes':_0x2bf098[_0x5559('0x1e')],'include':_0x2bf098[_0x5559('0x20')]?_[_0x5559('0x21')](_0x2bf098[_0x5559('0x20')],function(_0x5215b8){return{'model':db[_0x5215b8[_0x5559('0x22')]],'as':_0x5215b8['as'],'attributes':_0x5215b8[_0x5559('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5559('0xd')](function(_0x312a4a){logger[_0x5559('0x15')](_0x5559('0x18'),_0x345a98);logger['debug']('GetFreshdeskAccount',_0x345a98,JSON['stringify'](_0x312a4a));_0x1b7130(_0x312a4a);})['catch'](function(_0x22a783){logger[_0x5559('0x12')](_0x5559('0x18'),_0x22a783['message'],_0x345a98);_0xeb6912(_0x4c5543['error'](0x1f4,_0x22a783[_0x5559('0x14')]));});});};exports[_0x5559('0x23')]=function(_0x23d2b6){var _0x4603be=this;return new Promise(function(_0x4ba891,_0x4e737c){return db['FreshdeskAccount']['find']({'raw':_0x23d2b6[_0x5559('0x1b')]?_0x23d2b6['options'][_0x5559('0x1c')]===undefined?!![]:![]:!![],'where':_0x23d2b6['options']?_0x23d2b6[_0x5559('0x1b')][_0x5559('0x1d')]||null:null,'attributes':_0x23d2b6['options']?_0x23d2b6[_0x5559('0x1b')][_0x5559('0x1e')]||null:null,'include':_0x23d2b6[_0x5559('0x1b')]?_0x23d2b6['options']['include']?_[_0x5559('0x21')](_0x23d2b6[_0x5559('0x1b')][_0x5559('0x20')],function(_0xe61b6f){return{'model':db[_0xe61b6f[_0x5559('0x22')]],'as':_0xe61b6f['as'],'attributes':_0xe61b6f[_0x5559('0x1e')],'include':_0xe61b6f[_0x5559('0x20')]?_[_0x5559('0x21')](_0xe61b6f[_0x5559('0x20')],function(_0x8ef972){return{'model':db[_0x8ef972[_0x5559('0x22')]],'as':_0x8ef972['as'],'attributes':_0x8ef972[_0x5559('0x1e')],'include':_0x8ef972[_0x5559('0x20')]?_[_0x5559('0x21')](_0x8ef972['include'],function(_0x1de5bd){return{'model':db[_0x1de5bd[_0x5559('0x22')]],'as':_0x1de5bd['as'],'attributes':_0x1de5bd[_0x5559('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5559('0xd')](function(_0x4ad0a6){logger[_0x5559('0x15')]('ShowFreshdeskAccount',_0x23d2b6);logger[_0x5559('0xf')]('ShowFreshdeskAccount',_0x23d2b6,JSON['stringify'](_0x4ad0a6));_0x4ba891(_0x4ad0a6);})[_0x5559('0x17')](function(_0x491eb9){logger[_0x5559('0x12')](_0x5559('0x23'),_0x491eb9[_0x5559('0x14')],_0x23d2b6);_0x4e737c(_0x4603be[_0x5559('0x12')](0x1f4,_0x491eb9[_0x5559('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 203c42a..8618039 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 _0x04d1=['/:id/tags','getTags','setTags','put','delete','exports','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions'];(function(_0x16c5f0,_0x329e87){var _0x4df7eb=function(_0x25b976){while(--_0x25b976){_0x16c5f0['push'](_0x16c5f0['shift']());}};_0x4df7eb(++_0x329e87);}(_0x04d1,0x12c));var _0x104d=function(_0x2fdba1,_0x1246f7){_0x2fdba1=_0x2fdba1-0x0;var _0x1a3cf3=_0x04d1[_0x2fdba1];return _0x1a3cf3;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x104d('0x0'));var express=require('express');var router=express[_0x104d('0x1')]();var auth=require(_0x104d('0x2'));var interaction=require(_0x104d('0x3'));var config=require(_0x104d('0x4'));var controller=require(_0x104d('0x5'));router[_0x104d('0x6')]('/',auth[_0x104d('0x7')](),controller[_0x104d('0x8')]);router[_0x104d('0x6')](_0x104d('0x9'),auth[_0x104d('0x7')](),controller[_0x104d('0xa')]);router[_0x104d('0x6')](_0x104d('0xb'),auth[_0x104d('0x7')](),controller['getFields']);router['get'](_0x104d('0xc'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x104d('0x6')](_0x104d('0xd'),auth['isAuthenticated'](),controller[_0x104d('0xe')]);router[_0x104d('0x6')](_0x104d('0xf'),auth[_0x104d('0x7')](),controller[_0x104d('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x104d('0xf'),auth[_0x104d('0x7')](),controller[_0x104d('0x11')]);router[_0x104d('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x104d('0x13')]('/:id',auth[_0x104d('0x7')](),controller['destroy']);module[_0x104d('0x14')]=router; \ No newline at end of file +var _0xe2b3=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','destroy','exports'];(function(_0x11ca63,_0xea9f9c){var _0x41f1f6=function(_0xb80b69){while(--_0xb80b69){_0x11ca63['push'](_0x11ca63['shift']());}};_0x41f1f6(++_0xea9f9c);}(_0xe2b3,0x1ba));var _0x3e2b=function(_0x38854e,_0x23cbc9){_0x38854e=_0x38854e-0x0;var _0x3f8415=_0xe2b3[_0x38854e];return _0x3f8415;};'use strict';var multer=require(_0x3e2b('0x0'));var util=require(_0x3e2b('0x1'));var path=require(_0x3e2b('0x2'));var timeout=require(_0x3e2b('0x3'));var express=require(_0x3e2b('0x4'));var router=express[_0x3e2b('0x5')]();var auth=require(_0x3e2b('0x6'));var interaction=require(_0x3e2b('0x7'));var config=require(_0x3e2b('0x8'));var controller=require(_0x3e2b('0x9'));router[_0x3e2b('0xa')]('/',auth[_0x3e2b('0xb')](),controller[_0x3e2b('0xc')]);router['get'](_0x3e2b('0xd'),auth[_0x3e2b('0xb')](),controller[_0x3e2b('0xe')]);router[_0x3e2b('0xa')](_0x3e2b('0xf'),auth[_0x3e2b('0xb')](),controller['getFields']);router[_0x3e2b('0xa')]('/:id/subjects',auth[_0x3e2b('0xb')](),controller[_0x3e2b('0x10')]);router['get'](_0x3e2b('0x11'),auth[_0x3e2b('0xb')](),controller[_0x3e2b('0x12')]);router['get'](_0x3e2b('0x13'),auth[_0x3e2b('0xb')](),controller[_0x3e2b('0x14')]);router['post']('/',auth[_0x3e2b('0xb')](),controller['create']);router[_0x3e2b('0x15')](_0x3e2b('0x13'),auth[_0x3e2b('0xb')](),controller[_0x3e2b('0x16')]);router[_0x3e2b('0x17')](_0x3e2b('0xd'),auth[_0x3e2b('0xb')](),controller['update']);router['delete'](_0x3e2b('0xd'),auth[_0x3e2b('0xb')](),controller[_0x3e2b('0x18')]);module[_0x3e2b('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 4c1a83e..a688135 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 _0x464b=['sequelize','exports','STRING'];(function(_0x104112,_0x342eb6){var _0x394ab4=function(_0x48db18){while(--_0x48db18){_0x104112['push'](_0x104112['shift']());}};_0x394ab4(++_0x342eb6);}(_0x464b,0xc3));var _0xb464=function(_0x385226,_0x156d51){_0x385226=_0x385226-0x0;var _0x3ae91c=_0x464b[_0x385226];return _0x3ae91c;};'use strict';var Sequelize=require(_0xb464('0x0'));module[_0xb464('0x1')]={'name':{'type':Sequelize[_0xb464('0x2')]},'description':{'type':Sequelize[_0xb464('0x2')]}}; \ No newline at end of file +'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index ef83685..d67be1f 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 _0x0060=['getSubjects','getDescriptions','getTags','ids','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','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~!@#$%^&-_=+[{]}.','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','status','json','offset','limit','Content-Range','apply','reject','save','update','then','name','send','index','map','FreshdeskConfiguration','rawAttributes','key','model','query','keys','intersection','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','count','include','findAll','rows','show','params','fields','includeAll','find','create','body','destroy','getFields','nolimit','findOne','FreshdeskField'];(function(_0x1db29a,_0x5263e6){var _0x53525b=function(_0x469d7d){while(--_0x469d7d){_0x1db29a['push'](_0x1db29a['shift']());}};_0x53525b(++_0x5263e6);}(_0x0060,0x11e));var _0x0006=function(_0x33ba78,_0xbcaa2d){_0x33ba78=_0x33ba78-0x0;var _0x24a8a8=_0x0060[_0x33ba78];return _0x24a8a8;};'use strict';var pdf=require(_0x0006('0x0'));var emlformat=require(_0x0006('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0006('0x2'));var jsonpatch=require(_0x0006('0x3'));var rp=require('request-promise');var moment=require(_0x0006('0x4'));var BPromise=require(_0x0006('0x5'));var Mustache=require(_0x0006('0x6'));var util=require('util');var path=require(_0x0006('0x7'));var sox=require(_0x0006('0x8'));var csv=require(_0x0006('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0006('0xa'));var squel=require('squel');var crypto=require(_0x0006('0xb'));var jsforce=require(_0x0006('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0006('0x9'));var querystring=require(_0x0006('0xd'));var Papa=require(_0x0006('0xe'));var Redis=require(_0x0006('0xf'));var authService=require(_0x0006('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0006('0x11'));var hardwareService=require(_0x0006('0x12'));var logger=require('../../config/logger')(_0x0006('0x13'));var utils=require(_0x0006('0x14'));var config=require('../../config/environment');var db=require(_0x0006('0x15'))['db'];var jayson=require(_0x0006('0x16'));var client=jayson[_0x0006('0x17')][_0x0006('0x18')]({'port':0x232a});function checkPasswordPattern(_0x5eb74a,_0xca69ad,_0x5e2ef6){if(_0x5e2ef6){var _0x4edfdc=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4edfdc[_0x0006('0x19')](_0xca69ad)){return _0x5eb74a;}else{throw new db[(_0x0006('0x1a'))][(_0x0006('0x1b'))](_0x0006('0x1c'));}}else{return _0x5eb74a;}}function respondWithRpcPromise(_0x1dcc0b,_0x397d5a,_0x3bba76,_0x24d922){return new BPromise(function(_0x13efec,_0xf41460){var _0x355c11=_0x24d922||client;return _0x355c11['request'](_0x1dcc0b,_0x3bba76)['then'](function(_0x56db0f){logger['info'](_0x0006('0x1d'),_0x397d5a,_0x0006('0x1e'));logger[_0x0006('0x1f')](_0x0006('0x20'),_0x397d5a,_0x0006('0x1e'),JSON[_0x0006('0x21')](_0x56db0f));if(_0x56db0f[_0x0006('0x22')]){if(_0x56db0f['error'][_0x0006('0x23')]===0x1f4){logger['error'](_0x0006('0x1d'),_0x397d5a,_0x56db0f['error'][_0x0006('0x24')]);return _0xf41460(_0x56db0f[_0x0006('0x22')][_0x0006('0x24')]);}logger[_0x0006('0x22')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x397d5a,_0x56db0f[_0x0006('0x22')]['message']);return _0x13efec(_0x56db0f['error'][_0x0006('0x24')]);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x397d5a,'request\x20sent');_0x13efec(_0x56db0f['result']['message']);}})[_0x0006('0x25')](function(_0x233e1e){logger[_0x0006('0x22')](_0x0006('0x1d'),_0x397d5a,_0x233e1e);_0xf41460(_0x233e1e);});});}function respondWithStatusCode(_0x9a33e5,_0x3a8a8e){_0x3a8a8e=_0x3a8a8e||0xcc;return function(_0x4295b7){if(_0x4295b7){return _0x9a33e5[_0x0006('0x26')](_0x3a8a8e);}return _0x9a33e5['status'](_0x3a8a8e)[_0x0006('0x27')]();};}function respondWithResult(_0x51d8d2,_0x1d1633){_0x1d1633=_0x1d1633||0xc8;return function(_0x388199){if(_0x388199){return _0x51d8d2[_0x0006('0x28')](_0x1d1633)[_0x0006('0x29')](_0x388199);}};}function respondWithFilteredResult(_0x3fa769,_0x3633e7){return function(_0x56687c){if(_0x56687c){var _0x18fb47=_0x56687c['count'],_0x374a4e=_0x3633e7['offset'],_0x11ed6f=_0x3633e7[_0x0006('0x2a')]+_0x3633e7[_0x0006('0x2b')],_0xe3aa24;if(_0x11ed6f>=_0x18fb47){_0x11ed6f=_0x18fb47;_0xe3aa24=0xc8;}else{_0xe3aa24=0xce;}_0x3fa769[_0x0006('0x28')](_0xe3aa24);return _0x3fa769['set'](_0x0006('0x2c'),_0x374a4e+'-'+_0x11ed6f+'/'+_0x18fb47)[_0x0006('0x29')](_0x56687c);}return null;};}function patchUpdates(_0xd7faf){return function(_0x25f901){try{jsonpatch[_0x0006('0x2d')](_0x25f901,_0xd7faf,!![]);}catch(_0x52a172){return BPromise[_0x0006('0x2e')](_0x52a172);}return _0x25f901[_0x0006('0x2f')]();};}function saveUpdates(_0x396f0e,_0x3f5122){return function(_0x14711d){if(_0x14711d){return _0x14711d[_0x0006('0x30')](_0x396f0e)[_0x0006('0x31')](function(_0x2155e5){return _0x2155e5;});}return null;};}function removeEntity(_0x531af0,_0x297097){return function(_0x4dbc55){if(_0x4dbc55){return _0x4dbc55['destroy']()[_0x0006('0x31')](function(){_0x531af0[_0x0006('0x28')](0xcc)[_0x0006('0x27')]();});}};}function handleEntityNotFound(_0x236f59,_0x408b21){return function(_0x20e140){if(!_0x20e140){_0x236f59['sendStatus'](0x194);}return _0x20e140;};}function handleError(_0x193a1d,_0x420ce7){_0x420ce7=_0x420ce7||0x1f4;return function(_0x1332d9){logger[_0x0006('0x22')](_0x1332d9['stack']);if(_0x1332d9[_0x0006('0x32')]){delete _0x1332d9[_0x0006('0x32')];}_0x193a1d[_0x0006('0x28')](_0x420ce7)[_0x0006('0x33')](_0x1332d9);};}exports[_0x0006('0x34')]=function(_0x2538c8,_0x13e6e3){var _0x34600c={},_0x1108b1={},_0x2f81c7={'count':0x0,'rows':[]};var _0x2098b5=_[_0x0006('0x35')](db[_0x0006('0x36')][_0x0006('0x37')],function(_0x4c9400){return{'name':_0x4c9400['fieldName'],'type':_0x4c9400['type'][_0x0006('0x38')]};});_0x1108b1[_0x0006('0x39')]=_['map'](_0x2098b5,_0x0006('0x32'));_0x1108b1[_0x0006('0x3a')]=_[_0x0006('0x3b')](_0x2538c8['query']);_0x1108b1['filters']=_[_0x0006('0x3c')](_0x1108b1['model'],_0x1108b1[_0x0006('0x3a')]);_0x34600c[_0x0006('0x3d')]=_['intersection'](_0x1108b1[_0x0006('0x39')],qs['fields'](_0x2538c8[_0x0006('0x3a')]['fields']));_0x34600c[_0x0006('0x3d')]=_0x34600c[_0x0006('0x3d')][_0x0006('0x3e')]?_0x34600c[_0x0006('0x3d')]:_0x1108b1[_0x0006('0x39')];if(!_0x2538c8[_0x0006('0x3a')][_0x0006('0x3f')]('nolimit')){_0x34600c[_0x0006('0x2b')]=qs[_0x0006('0x2b')](_0x2538c8[_0x0006('0x3a')][_0x0006('0x2b')]);_0x34600c[_0x0006('0x2a')]=qs['offset'](_0x2538c8['query'][_0x0006('0x2a')]);}_0x34600c[_0x0006('0x40')]=qs[_0x0006('0x41')](_0x2538c8[_0x0006('0x3a')][_0x0006('0x41')]);_0x34600c[_0x0006('0x42')]=qs[_0x0006('0x43')](_[_0x0006('0x44')](_0x2538c8['query'],_0x1108b1['filters']));if(_0x2538c8['query'][_0x0006('0x45')]){_0x34600c[_0x0006('0x42')]=_[_0x0006('0x46')](_0x34600c['where'],{'$or':_[_0x0006('0x35')](_0x2098b5,function(_0x2274f2){if(_0x2274f2[_0x0006('0x47')]!==_0x0006('0x48')){var _0x4b288b={};_0x4b288b[_0x2274f2[_0x0006('0x32')]]={'$like':'%'+_0x2538c8[_0x0006('0x3a')][_0x0006('0x45')]+'%'};return _0x4b288b;}})});}_0x34600c=_[_0x0006('0x46')]({},_0x34600c,_0x2538c8[_0x0006('0x49')]);var _0x24093b={'where':_0x34600c['where']};return db['FreshdeskConfiguration']['count'](_0x24093b)['then'](function(_0x2ed2be){_0x2f81c7[_0x0006('0x4a')]=_0x2ed2be;if(_0x2538c8[_0x0006('0x3a')]['includeAll']){_0x34600c[_0x0006('0x4b')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x0006('0x4c')](_0x34600c);})['then'](function(_0x38d6f8){_0x2f81c7[_0x0006('0x4d')]=_0x38d6f8;return _0x2f81c7;})[_0x0006('0x31')](respondWithFilteredResult(_0x13e6e3,_0x34600c))[_0x0006('0x25')](handleError(_0x13e6e3,null));};exports[_0x0006('0x4e')]=function(_0x3b26ba,_0xd34bbf){var _0x48ad8e={'raw':![],'where':{'id':_0x3b26ba[_0x0006('0x4f')]['id']}},_0x1537ed={};_0x1537ed['model']=_[_0x0006('0x3b')](db[_0x0006('0x36')]['rawAttributes']);_0x1537ed[_0x0006('0x3a')]=_[_0x0006('0x3b')](_0x3b26ba['query']);_0x1537ed[_0x0006('0x43')]=_[_0x0006('0x3c')](_0x1537ed[_0x0006('0x39')],_0x1537ed[_0x0006('0x3a')]);_0x48ad8e[_0x0006('0x3d')]=_[_0x0006('0x3c')](_0x1537ed[_0x0006('0x39')],qs[_0x0006('0x50')](_0x3b26ba[_0x0006('0x3a')][_0x0006('0x50')]));_0x48ad8e[_0x0006('0x3d')]=_0x48ad8e[_0x0006('0x3d')][_0x0006('0x3e')]?_0x48ad8e[_0x0006('0x3d')]:_0x1537ed[_0x0006('0x39')];if(_0x3b26ba['query'][_0x0006('0x51')]){_0x48ad8e[_0x0006('0x4b')]=[{'all':!![]}];}_0x48ad8e=_['merge']({},_0x48ad8e,_0x3b26ba[_0x0006('0x49')]);return db[_0x0006('0x36')][_0x0006('0x52')](_0x48ad8e)[_0x0006('0x31')](handleEntityNotFound(_0xd34bbf,null))[_0x0006('0x31')](respondWithResult(_0xd34bbf,null))[_0x0006('0x25')](handleError(_0xd34bbf,null));};exports[_0x0006('0x53')]=function(_0x57bef8,_0x30ec9d){return db['FreshdeskConfiguration'][_0x0006('0x53')](_0x57bef8[_0x0006('0x54')],{})[_0x0006('0x31')](respondWithResult(_0x30ec9d,0xc9))[_0x0006('0x25')](handleError(_0x30ec9d,null));};exports[_0x0006('0x30')]=function(_0xfbd2a6,_0x538114){if(_0xfbd2a6['body']['id']){delete _0xfbd2a6[_0x0006('0x54')]['id'];}return db[_0x0006('0x36')]['find']({'where':{'id':_0xfbd2a6[_0x0006('0x4f')]['id']}})[_0x0006('0x31')](handleEntityNotFound(_0x538114,null))['then'](saveUpdates(_0xfbd2a6[_0x0006('0x54')],null))[_0x0006('0x31')](respondWithResult(_0x538114,null))[_0x0006('0x25')](handleError(_0x538114,null));};exports[_0x0006('0x55')]=function(_0xfa03ab,_0x58805c){return db[_0x0006('0x36')][_0x0006('0x52')]({'where':{'id':_0xfa03ab[_0x0006('0x4f')]['id']}})[_0x0006('0x31')](handleEntityNotFound(_0x58805c,null))['then'](removeEntity(_0x58805c,null))[_0x0006('0x25')](handleError(_0x58805c,null));};exports[_0x0006('0x56')]=function(_0x309971,_0x4ddf79,_0x295751){var _0x223556={};var _0x3489db={};var _0xd2b810;var _0xc54368;return db[_0x0006('0x36')]['findOne']({'where':{'id':_0x309971[_0x0006('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4ddf79,null))[_0x0006('0x31')](function(_0x140a0f){if(_0x140a0f){_0xd2b810=_0x140a0f;_0x3489db[_0x0006('0x39')]=_['keys'](db['FreshdeskField']['rawAttributes']);_0x3489db[_0x0006('0x3a')]=_[_0x0006('0x3b')](_0x309971['query']);_0x3489db[_0x0006('0x43')]=_[_0x0006('0x3c')](_0x3489db[_0x0006('0x39')],_0x3489db['query']);_0x223556[_0x0006('0x3d')]=_[_0x0006('0x3c')](_0x3489db[_0x0006('0x39')],qs[_0x0006('0x50')](_0x309971['query']['fields']));_0x223556[_0x0006('0x3d')]=_0x223556['attributes'][_0x0006('0x3e')]?_0x223556['attributes']:_0x3489db[_0x0006('0x39')];_0x223556[_0x0006('0x40')]=qs[_0x0006('0x41')](_0x309971[_0x0006('0x3a')]['sort']);_0x223556[_0x0006('0x42')]=qs[_0x0006('0x43')](_[_0x0006('0x44')](_0x309971[_0x0006('0x3a')],_0x3489db[_0x0006('0x43')]));if(_0x309971[_0x0006('0x3a')][_0x0006('0x45')]){_0x223556[_0x0006('0x42')]=_['merge'](_0x223556[_0x0006('0x42')],{'$or':_[_0x0006('0x35')](_0x223556[_0x0006('0x3d')],function(_0x4c9182){var _0x1d7459={};_0x1d7459[_0x4c9182]={'$like':'%'+_0x309971[_0x0006('0x3a')][_0x0006('0x45')]+'%'};return _0x1d7459;})});}_0x223556=_['merge']({},_0x223556,_0x309971[_0x0006('0x49')]);return _0xd2b810[_0x0006('0x56')](_0x223556);}})['then'](function(_0x1aaee7){if(_0x1aaee7){_0xc54368=_0x1aaee7['length'];if(!_0x309971['query'][_0x0006('0x3f')](_0x0006('0x57'))){_0x223556['limit']=qs[_0x0006('0x2b')](_0x309971[_0x0006('0x3a')][_0x0006('0x2b')]);_0x223556[_0x0006('0x2a')]=qs[_0x0006('0x2a')](_0x309971[_0x0006('0x3a')][_0x0006('0x2a')]);}return _0xd2b810[_0x0006('0x56')](_0x223556);}})[_0x0006('0x31')](function(_0x23d690){if(_0x23d690){return _0x23d690?{'count':_0xc54368,'rows':_0x23d690}:null;}})[_0x0006('0x31')](respondWithResult(_0x4ddf79,null))[_0x0006('0x25')](handleError(_0x4ddf79,null));};exports['getSubjects']=function(_0xd74be2,_0x4a4b24,_0xc28fc5){var _0x579875={};var _0x4e80b0={};var _0x319673;var _0x12054;return db[_0x0006('0x36')][_0x0006('0x58')]({'where':{'id':_0xd74be2[_0x0006('0x4f')]['id']}})[_0x0006('0x31')](handleEntityNotFound(_0x4a4b24,null))[_0x0006('0x31')](function(_0x538801){if(_0x538801){_0x319673=_0x538801;_0x4e80b0[_0x0006('0x39')]=_['keys'](db[_0x0006('0x59')]['rawAttributes']);_0x4e80b0['query']=_[_0x0006('0x3b')](_0xd74be2[_0x0006('0x3a')]);_0x4e80b0[_0x0006('0x43')]=_[_0x0006('0x3c')](_0x4e80b0[_0x0006('0x39')],_0x4e80b0[_0x0006('0x3a')]);_0x579875[_0x0006('0x3d')]=_['intersection'](_0x4e80b0[_0x0006('0x39')],qs[_0x0006('0x50')](_0xd74be2[_0x0006('0x3a')][_0x0006('0x50')]));_0x579875[_0x0006('0x3d')]=_0x579875[_0x0006('0x3d')][_0x0006('0x3e')]?_0x579875[_0x0006('0x3d')]:_0x4e80b0['model'];_0x579875[_0x0006('0x40')]=qs[_0x0006('0x41')](_0xd74be2['query'][_0x0006('0x41')]);_0x579875['where']=qs[_0x0006('0x43')](_[_0x0006('0x44')](_0xd74be2[_0x0006('0x3a')],_0x4e80b0['filters']));if(_0xd74be2[_0x0006('0x3a')][_0x0006('0x45')]){_0x579875['where']=_[_0x0006('0x46')](_0x579875[_0x0006('0x42')],{'$or':_['map'](_0x579875['attributes'],function(_0x24f391){var _0x40fa9d={};_0x40fa9d[_0x24f391]={'$like':'%'+_0xd74be2[_0x0006('0x3a')][_0x0006('0x45')]+'%'};return _0x40fa9d;})});}_0x579875=_[_0x0006('0x46')]({},_0x579875,_0xd74be2[_0x0006('0x49')]);return _0x319673[_0x0006('0x5a')](_0x579875);}})[_0x0006('0x31')](function(_0x1e3ab3){if(_0x1e3ab3){_0x12054=_0x1e3ab3[_0x0006('0x3e')];if(!_0xd74be2['query']['hasOwnProperty']('nolimit')){_0x579875['limit']=qs[_0x0006('0x2b')](_0xd74be2[_0x0006('0x3a')][_0x0006('0x2b')]);_0x579875['offset']=qs[_0x0006('0x2a')](_0xd74be2[_0x0006('0x3a')][_0x0006('0x2a')]);}return _0x319673[_0x0006('0x5a')](_0x579875);}})[_0x0006('0x31')](function(_0x447e1e){if(_0x447e1e){return _0x447e1e?{'count':_0x12054,'rows':_0x447e1e}:null;}})['then'](respondWithResult(_0x4a4b24,null))[_0x0006('0x25')](handleError(_0x4a4b24,null));};exports[_0x0006('0x5b')]=function(_0x4106aa,_0x478ffc,_0x4b7550){var _0x31d9f6={};var _0x2f9f3f={};var _0x2e0067;var _0x536492;return db[_0x0006('0x36')]['findOne']({'where':{'id':_0x4106aa['params']['id']}})[_0x0006('0x31')](handleEntityNotFound(_0x478ffc,null))[_0x0006('0x31')](function(_0x18ebd9){if(_0x18ebd9){_0x2e0067=_0x18ebd9;_0x2f9f3f[_0x0006('0x39')]=_[_0x0006('0x3b')](db[_0x0006('0x59')][_0x0006('0x37')]);_0x2f9f3f[_0x0006('0x3a')]=_[_0x0006('0x3b')](_0x4106aa[_0x0006('0x3a')]);_0x2f9f3f['filters']=_[_0x0006('0x3c')](_0x2f9f3f[_0x0006('0x39')],_0x2f9f3f[_0x0006('0x3a')]);_0x31d9f6[_0x0006('0x3d')]=_[_0x0006('0x3c')](_0x2f9f3f[_0x0006('0x39')],qs[_0x0006('0x50')](_0x4106aa[_0x0006('0x3a')][_0x0006('0x50')]));_0x31d9f6[_0x0006('0x3d')]=_0x31d9f6[_0x0006('0x3d')]['length']?_0x31d9f6[_0x0006('0x3d')]:_0x2f9f3f['model'];_0x31d9f6[_0x0006('0x40')]=qs[_0x0006('0x41')](_0x4106aa['query'][_0x0006('0x41')]);_0x31d9f6['where']=qs['filters'](_['pick'](_0x4106aa['query'],_0x2f9f3f[_0x0006('0x43')]));if(_0x4106aa[_0x0006('0x3a')][_0x0006('0x45')]){_0x31d9f6['where']=_[_0x0006('0x46')](_0x31d9f6['where'],{'$or':_['map'](_0x31d9f6[_0x0006('0x3d')],function(_0x43cdbd){var _0x28040f={};_0x28040f[_0x43cdbd]={'$like':'%'+_0x4106aa[_0x0006('0x3a')][_0x0006('0x45')]+'%'};return _0x28040f;})});}_0x31d9f6=_[_0x0006('0x46')]({},_0x31d9f6,_0x4106aa[_0x0006('0x49')]);return _0x2e0067['getDescriptions'](_0x31d9f6);}})[_0x0006('0x31')](function(_0x5d13b7){if(_0x5d13b7){_0x536492=_0x5d13b7[_0x0006('0x3e')];if(!_0x4106aa[_0x0006('0x3a')]['hasOwnProperty'](_0x0006('0x57'))){_0x31d9f6[_0x0006('0x2b')]=qs[_0x0006('0x2b')](_0x4106aa[_0x0006('0x3a')]['limit']);_0x31d9f6['offset']=qs[_0x0006('0x2a')](_0x4106aa[_0x0006('0x3a')]['offset']);}return _0x2e0067['getDescriptions'](_0x31d9f6);}})[_0x0006('0x31')](function(_0x3a6dec){if(_0x3a6dec){return _0x3a6dec?{'count':_0x536492,'rows':_0x3a6dec}:null;}})['then'](respondWithResult(_0x478ffc,null))[_0x0006('0x25')](handleError(_0x478ffc,null));};exports[_0x0006('0x5c')]=function(_0x14d65b,_0x3051f3,_0x5bdf44){var _0x4dff68={};var _0x7553d9={};var _0x27e635;var _0x23751f;return db[_0x0006('0x36')][_0x0006('0x58')]({'where':{'id':_0x14d65b[_0x0006('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3051f3,null))[_0x0006('0x31')](function(_0x341510){if(_0x341510){_0x27e635=_0x341510;_0x7553d9[_0x0006('0x39')]=_['keys'](db['Tag'][_0x0006('0x37')]);_0x7553d9['query']=_['keys'](_0x14d65b[_0x0006('0x3a')]);_0x7553d9[_0x0006('0x43')]=_['intersection'](_0x7553d9[_0x0006('0x39')],_0x7553d9['query']);_0x4dff68[_0x0006('0x3d')]=_[_0x0006('0x3c')](_0x7553d9[_0x0006('0x39')],qs[_0x0006('0x50')](_0x14d65b[_0x0006('0x3a')]['fields']));_0x4dff68['attributes']=_0x4dff68[_0x0006('0x3d')]['length']?_0x4dff68[_0x0006('0x3d')]:_0x7553d9[_0x0006('0x39')];_0x4dff68['order']=qs[_0x0006('0x41')](_0x14d65b[_0x0006('0x3a')][_0x0006('0x41')]);_0x4dff68[_0x0006('0x42')]=qs[_0x0006('0x43')](_[_0x0006('0x44')](_0x14d65b[_0x0006('0x3a')],_0x7553d9[_0x0006('0x43')]));if(_0x14d65b[_0x0006('0x3a')][_0x0006('0x45')]){_0x4dff68[_0x0006('0x42')]=_[_0x0006('0x46')](_0x4dff68[_0x0006('0x42')],{'$or':_[_0x0006('0x35')](_0x4dff68[_0x0006('0x3d')],function(_0x3c7643){var _0x282c5a={};_0x282c5a[_0x3c7643]={'$like':'%'+_0x14d65b['query'][_0x0006('0x45')]+'%'};return _0x282c5a;})});}_0x4dff68=_['merge']({},_0x4dff68,_0x14d65b[_0x0006('0x49')]);return _0x27e635['getTags'](_0x4dff68);}})['then'](function(_0x26f61b){if(_0x26f61b){_0x23751f=_0x26f61b['length'];if(!_0x14d65b[_0x0006('0x3a')][_0x0006('0x3f')](_0x0006('0x57'))){_0x4dff68[_0x0006('0x2b')]=qs['limit'](_0x14d65b[_0x0006('0x3a')]['limit']);_0x4dff68['offset']=qs[_0x0006('0x2a')](_0x14d65b[_0x0006('0x3a')]['offset']);}return _0x27e635[_0x0006('0x5c')](_0x4dff68);}})[_0x0006('0x31')](function(_0x42e048){if(_0x42e048){return _0x42e048?{'count':_0x23751f,'rows':_0x42e048}:null;}})['then'](respondWithResult(_0x3051f3,null))[_0x0006('0x25')](handleError(_0x3051f3,null));};exports['setTags']=function(_0x502dba,_0x429659,_0xb9b975){if(_0x502dba[_0x0006('0x54')]['id']){delete _0x502dba[_0x0006('0x54')]['id'];}return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x502dba[_0x0006('0x4f')]['id']}})[_0x0006('0x31')](handleEntityNotFound(_0x429659,null))[_0x0006('0x31')](function(_0xcc5edc){if(_0xcc5edc){return _0xcc5edc['setTags'](_0x502dba['body'][_0x0006('0x5d')]||[]);}return null;})[_0x0006('0x31')](respondWithResult(_0x429659,null))[_0x0006('0x25')](handleError(_0x429659,null));}; \ No newline at end of file +var _0x3b57=['../../config/logger','api','../../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','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','show','params','keys','length','find','create','body','getFields','findOne','FreshdeskField','order','getDescriptions','getTags','setTags','ids','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x10add6,_0xef4429){var _0x3bbb02=function(_0x305d6d){while(--_0x305d6d){_0x10add6['push'](_0x10add6['shift']());}};_0x3bbb02(++_0xef4429);}(_0x3b57,0x103));var _0x73b5=function(_0x2bd4e3,_0x4d9b53){_0x2bd4e3=_0x2bd4e3-0x0;var _0x259f7c=_0x3b57[_0x2bd4e3];return _0x259f7c;};'use strict';var pdf=require(_0x73b5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x73b5('0x1'));var zipdir=require(_0x73b5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x73b5('0x3'));var moment=require(_0x73b5('0x4'));var BPromise=require(_0x73b5('0x5'));var Mustache=require('mustache');var util=require(_0x73b5('0x6'));var path=require('path');var sox=require(_0x73b5('0x7'));var csv=require(_0x73b5('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x73b5('0x9'));var crypto=require(_0x73b5('0xa'));var jsforce=require(_0x73b5('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x73b5('0x8'));var querystring=require(_0x73b5('0xc'));var Papa=require(_0x73b5('0xd'));var Redis=require(_0x73b5('0xe'));var authService=require(_0x73b5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x73b5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x73b5('0x11'))(_0x73b5('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x73b5('0x13'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x73b5('0x14')][_0x73b5('0x15')]({'port':0x232a});function checkPasswordPattern(_0x164f3b,_0x482d37,_0x7bb21e){if(_0x7bb21e){var _0x5387c9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5387c9[_0x73b5('0x16')](_0x482d37)){return _0x164f3b;}else{throw new db[(_0x73b5('0x17'))][(_0x73b5('0x18'))](_0x73b5('0x19'));}}else{return _0x164f3b;}}function respondWithRpcPromise(_0x6c5ce1,_0x363488,_0x2af26b,_0x20b1e0){return new BPromise(function(_0x2427d0,_0x3e1633){var _0x4a19f6=_0x20b1e0||client;return _0x4a19f6[_0x73b5('0x1a')](_0x6c5ce1,_0x2af26b)[_0x73b5('0x1b')](function(_0x196e22){logger[_0x73b5('0x1c')](_0x73b5('0x1d'),_0x363488,_0x73b5('0x1e'));logger[_0x73b5('0x1f')](_0x73b5('0x20'),_0x363488,_0x73b5('0x1e'),JSON[_0x73b5('0x21')](_0x196e22));if(_0x196e22[_0x73b5('0x22')]){if(_0x196e22[_0x73b5('0x22')]['code']===0x1f4){logger['error'](_0x73b5('0x1d'),_0x363488,_0x196e22[_0x73b5('0x22')][_0x73b5('0x23')]);return _0x3e1633(_0x196e22['error']['message']);}logger[_0x73b5('0x22')](_0x73b5('0x1d'),_0x363488,_0x196e22['error'][_0x73b5('0x23')]);return _0x2427d0(_0x196e22['error'][_0x73b5('0x23')]);}else{logger[_0x73b5('0x1c')](_0x73b5('0x1d'),_0x363488,_0x73b5('0x1e'));_0x2427d0(_0x196e22[_0x73b5('0x24')]['message']);}})[_0x73b5('0x25')](function(_0x2795fc){logger[_0x73b5('0x22')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x363488,_0x2795fc);_0x3e1633(_0x2795fc);});});}function respondWithStatusCode(_0x15ce9b,_0x2bd338){_0x2bd338=_0x2bd338||0xcc;return function(_0x378d37){if(_0x378d37){return _0x15ce9b[_0x73b5('0x26')](_0x2bd338);}return _0x15ce9b[_0x73b5('0x27')](_0x2bd338)[_0x73b5('0x28')]();};}function respondWithResult(_0x33f9ea,_0x32bb89){_0x32bb89=_0x32bb89||0xc8;return function(_0x2d3040){if(_0x2d3040){return _0x33f9ea[_0x73b5('0x27')](_0x32bb89)['json'](_0x2d3040);}};}function respondWithFilteredResult(_0x25b42a,_0x3eaa65){return function(_0x26340a){if(_0x26340a){var _0x59a69c=_0x26340a[_0x73b5('0x29')],_0x3715f2=_0x3eaa65[_0x73b5('0x2a')],_0xfc51ff=_0x3eaa65[_0x73b5('0x2a')]+_0x3eaa65[_0x73b5('0x2b')],_0x19f861;if(_0xfc51ff>=_0x59a69c){_0xfc51ff=_0x59a69c;_0x19f861=0xc8;}else{_0x19f861=0xce;}_0x25b42a[_0x73b5('0x27')](_0x19f861);return _0x25b42a['set'](_0x73b5('0x2c'),_0x3715f2+'-'+_0xfc51ff+'/'+_0x59a69c)[_0x73b5('0x2d')](_0x26340a);}return null;};}function patchUpdates(_0x8249ac){return function(_0x1f7574){try{jsonpatch[_0x73b5('0x2e')](_0x1f7574,_0x8249ac,!![]);}catch(_0x328607){return BPromise[_0x73b5('0x2f')](_0x328607);}return _0x1f7574[_0x73b5('0x30')]();};}function saveUpdates(_0x4ec788,_0x5cfb58){return function(_0x3b92fe){if(_0x3b92fe){return _0x3b92fe[_0x73b5('0x31')](_0x4ec788)[_0x73b5('0x1b')](function(_0x17e503){return _0x17e503;});}return null;};}function removeEntity(_0x344b1f,_0x21d4c9){return function(_0x8a35bb){if(_0x8a35bb){return _0x8a35bb[_0x73b5('0x32')]()['then'](function(){_0x344b1f[_0x73b5('0x27')](0xcc)[_0x73b5('0x28')]();});}};}function handleEntityNotFound(_0x191429,_0xcfcd00){return function(_0x44502a){if(!_0x44502a){_0x191429['sendStatus'](0x194);}return _0x44502a;};}function handleError(_0x45ea6c,_0x4ceaeb){_0x4ceaeb=_0x4ceaeb||0x1f4;return function(_0x419ca0){logger[_0x73b5('0x22')](_0x419ca0[_0x73b5('0x33')]);if(_0x419ca0['name']){delete _0x419ca0[_0x73b5('0x34')];}_0x45ea6c[_0x73b5('0x27')](_0x4ceaeb)[_0x73b5('0x35')](_0x419ca0);};}exports['index']=function(_0x429172,_0x22ff02){var _0x4d0aac={},_0xd998cb={},_0x190db6={'count':0x0,'rows':[]};var _0x24e5a3=_[_0x73b5('0x36')](db[_0x73b5('0x37')][_0x73b5('0x38')],function(_0xf657b7){return{'name':_0xf657b7[_0x73b5('0x39')],'type':_0xf657b7[_0x73b5('0x3a')][_0x73b5('0x3b')]};});_0xd998cb['model']=_['map'](_0x24e5a3,_0x73b5('0x34'));_0xd998cb[_0x73b5('0x3c')]=_['keys'](_0x429172[_0x73b5('0x3c')]);_0xd998cb['filters']=_[_0x73b5('0x3d')](_0xd998cb[_0x73b5('0x3e')],_0xd998cb[_0x73b5('0x3c')]);_0x4d0aac[_0x73b5('0x3f')]=_['intersection'](_0xd998cb[_0x73b5('0x3e')],qs[_0x73b5('0x40')](_0x429172[_0x73b5('0x3c')][_0x73b5('0x40')]));_0x4d0aac[_0x73b5('0x3f')]=_0x4d0aac['attributes']['length']?_0x4d0aac[_0x73b5('0x3f')]:_0xd998cb['model'];if(!_0x429172[_0x73b5('0x3c')][_0x73b5('0x41')](_0x73b5('0x42'))){_0x4d0aac[_0x73b5('0x2b')]=qs[_0x73b5('0x2b')](_0x429172[_0x73b5('0x3c')][_0x73b5('0x2b')]);_0x4d0aac[_0x73b5('0x2a')]=qs['offset'](_0x429172[_0x73b5('0x3c')]['offset']);}_0x4d0aac['order']=qs[_0x73b5('0x43')](_0x429172[_0x73b5('0x3c')][_0x73b5('0x43')]);_0x4d0aac[_0x73b5('0x44')]=qs['filters'](_[_0x73b5('0x45')](_0x429172['query'],_0xd998cb[_0x73b5('0x46')]));if(_0x429172[_0x73b5('0x3c')][_0x73b5('0x47')]){_0x4d0aac['where']=_[_0x73b5('0x48')](_0x4d0aac[_0x73b5('0x44')],{'$or':_[_0x73b5('0x36')](_0x24e5a3,function(_0x5aaf4c){if(_0x5aaf4c['type']!==_0x73b5('0x49')){var _0x1e9b5e={};_0x1e9b5e[_0x5aaf4c[_0x73b5('0x34')]]={'$like':'%'+_0x429172['query'][_0x73b5('0x47')]+'%'};return _0x1e9b5e;}})});}_0x4d0aac=_[_0x73b5('0x48')]({},_0x4d0aac,_0x429172[_0x73b5('0x4a')]);var _0x392e95={'where':_0x4d0aac[_0x73b5('0x44')]};return db[_0x73b5('0x37')]['count'](_0x392e95)[_0x73b5('0x1b')](function(_0x205527){_0x190db6['count']=_0x205527;if(_0x429172['query'][_0x73b5('0x4b')]){_0x4d0aac[_0x73b5('0x4c')]=[{'all':!![]}];}return db['FreshdeskConfiguration']['findAll'](_0x4d0aac);})[_0x73b5('0x1b')](function(_0x4a7db6){_0x190db6['rows']=_0x4a7db6;return _0x190db6;})[_0x73b5('0x1b')](respondWithFilteredResult(_0x22ff02,_0x4d0aac))['catch'](handleError(_0x22ff02,null));};exports[_0x73b5('0x4d')]=function(_0x318981,_0x1c1ac0){var _0x53c902={'raw':![],'where':{'id':_0x318981[_0x73b5('0x4e')]['id']}},_0x1f23f3={};_0x1f23f3[_0x73b5('0x3e')]=_['keys'](db['FreshdeskConfiguration'][_0x73b5('0x38')]);_0x1f23f3['query']=_[_0x73b5('0x4f')](_0x318981[_0x73b5('0x3c')]);_0x1f23f3[_0x73b5('0x46')]=_[_0x73b5('0x3d')](_0x1f23f3[_0x73b5('0x3e')],_0x1f23f3['query']);_0x53c902[_0x73b5('0x3f')]=_[_0x73b5('0x3d')](_0x1f23f3['model'],qs[_0x73b5('0x40')](_0x318981[_0x73b5('0x3c')][_0x73b5('0x40')]));_0x53c902[_0x73b5('0x3f')]=_0x53c902[_0x73b5('0x3f')][_0x73b5('0x50')]?_0x53c902[_0x73b5('0x3f')]:_0x1f23f3[_0x73b5('0x3e')];if(_0x318981[_0x73b5('0x3c')][_0x73b5('0x4b')]){_0x53c902[_0x73b5('0x4c')]=[{'all':!![]}];}_0x53c902=_[_0x73b5('0x48')]({},_0x53c902,_0x318981[_0x73b5('0x4a')]);return db['FreshdeskConfiguration'][_0x73b5('0x51')](_0x53c902)[_0x73b5('0x1b')](handleEntityNotFound(_0x1c1ac0,null))[_0x73b5('0x1b')](respondWithResult(_0x1c1ac0,null))[_0x73b5('0x25')](handleError(_0x1c1ac0,null));};exports[_0x73b5('0x52')]=function(_0x22b56d,_0x13a011){return db[_0x73b5('0x37')][_0x73b5('0x52')](_0x22b56d[_0x73b5('0x53')],{})[_0x73b5('0x1b')](respondWithResult(_0x13a011,0xc9))[_0x73b5('0x25')](handleError(_0x13a011,null));};exports[_0x73b5('0x31')]=function(_0x112407,_0x5df8e7){if(_0x112407['body']['id']){delete _0x112407['body']['id'];}return db[_0x73b5('0x37')][_0x73b5('0x51')]({'where':{'id':_0x112407['params']['id']}})[_0x73b5('0x1b')](handleEntityNotFound(_0x5df8e7,null))[_0x73b5('0x1b')](saveUpdates(_0x112407['body'],null))[_0x73b5('0x1b')](respondWithResult(_0x5df8e7,null))['catch'](handleError(_0x5df8e7,null));};exports[_0x73b5('0x32')]=function(_0x355deb,_0x48e15e){return db[_0x73b5('0x37')]['find']({'where':{'id':_0x355deb[_0x73b5('0x4e')]['id']}})[_0x73b5('0x1b')](handleEntityNotFound(_0x48e15e,null))[_0x73b5('0x1b')](removeEntity(_0x48e15e,null))['catch'](handleError(_0x48e15e,null));};exports[_0x73b5('0x54')]=function(_0x590319,_0x97f30a,_0x1a1c99){var _0x349053={};var _0x2f585={};var _0x4fc55f;var _0x176095;return db[_0x73b5('0x37')][_0x73b5('0x55')]({'where':{'id':_0x590319[_0x73b5('0x4e')]['id']}})['then'](handleEntityNotFound(_0x97f30a,null))[_0x73b5('0x1b')](function(_0x1c7082){if(_0x1c7082){_0x4fc55f=_0x1c7082;_0x2f585['model']=_[_0x73b5('0x4f')](db['FreshdeskField']['rawAttributes']);_0x2f585[_0x73b5('0x3c')]=_[_0x73b5('0x4f')](_0x590319[_0x73b5('0x3c')]);_0x2f585[_0x73b5('0x46')]=_[_0x73b5('0x3d')](_0x2f585[_0x73b5('0x3e')],_0x2f585[_0x73b5('0x3c')]);_0x349053['attributes']=_['intersection'](_0x2f585[_0x73b5('0x3e')],qs[_0x73b5('0x40')](_0x590319[_0x73b5('0x3c')]['fields']));_0x349053[_0x73b5('0x3f')]=_0x349053[_0x73b5('0x3f')][_0x73b5('0x50')]?_0x349053[_0x73b5('0x3f')]:_0x2f585[_0x73b5('0x3e')];_0x349053['order']=qs[_0x73b5('0x43')](_0x590319['query']['sort']);_0x349053[_0x73b5('0x44')]=qs[_0x73b5('0x46')](_['pick'](_0x590319[_0x73b5('0x3c')],_0x2f585[_0x73b5('0x46')]));if(_0x590319['query'][_0x73b5('0x47')]){_0x349053[_0x73b5('0x44')]=_['merge'](_0x349053['where'],{'$or':_['map'](_0x349053[_0x73b5('0x3f')],function(_0x9f55ab){var _0x5a2a1b={};_0x5a2a1b[_0x9f55ab]={'$like':'%'+_0x590319[_0x73b5('0x3c')]['filter']+'%'};return _0x5a2a1b;})});}_0x349053=_['merge']({},_0x349053,_0x590319[_0x73b5('0x4a')]);return _0x4fc55f['getFields'](_0x349053);}})[_0x73b5('0x1b')](function(_0x32633e){if(_0x32633e){_0x176095=_0x32633e[_0x73b5('0x50')];if(!_0x590319['query']['hasOwnProperty']('nolimit')){_0x349053[_0x73b5('0x2b')]=qs[_0x73b5('0x2b')](_0x590319[_0x73b5('0x3c')][_0x73b5('0x2b')]);_0x349053[_0x73b5('0x2a')]=qs[_0x73b5('0x2a')](_0x590319[_0x73b5('0x3c')]['offset']);}return _0x4fc55f['getFields'](_0x349053);}})['then'](function(_0x4438fd){if(_0x4438fd){return _0x4438fd?{'count':_0x176095,'rows':_0x4438fd}:null;}})[_0x73b5('0x1b')](respondWithResult(_0x97f30a,null))[_0x73b5('0x25')](handleError(_0x97f30a,null));};exports['getSubjects']=function(_0x4916ae,_0x173266,_0x280414){var _0x20d132={};var _0x1a2432={};var _0x4ae13d;var _0x3510dc;return db[_0x73b5('0x37')][_0x73b5('0x55')]({'where':{'id':_0x4916ae[_0x73b5('0x4e')]['id']}})[_0x73b5('0x1b')](handleEntityNotFound(_0x173266,null))[_0x73b5('0x1b')](function(_0x1c2bae){if(_0x1c2bae){_0x4ae13d=_0x1c2bae;_0x1a2432[_0x73b5('0x3e')]=_[_0x73b5('0x4f')](db[_0x73b5('0x56')][_0x73b5('0x38')]);_0x1a2432['query']=_[_0x73b5('0x4f')](_0x4916ae[_0x73b5('0x3c')]);_0x1a2432[_0x73b5('0x46')]=_[_0x73b5('0x3d')](_0x1a2432[_0x73b5('0x3e')],_0x1a2432[_0x73b5('0x3c')]);_0x20d132[_0x73b5('0x3f')]=_[_0x73b5('0x3d')](_0x1a2432['model'],qs['fields'](_0x4916ae['query'][_0x73b5('0x40')]));_0x20d132['attributes']=_0x20d132[_0x73b5('0x3f')][_0x73b5('0x50')]?_0x20d132[_0x73b5('0x3f')]:_0x1a2432[_0x73b5('0x3e')];_0x20d132[_0x73b5('0x57')]=qs[_0x73b5('0x43')](_0x4916ae[_0x73b5('0x3c')]['sort']);_0x20d132[_0x73b5('0x44')]=qs[_0x73b5('0x46')](_[_0x73b5('0x45')](_0x4916ae[_0x73b5('0x3c')],_0x1a2432[_0x73b5('0x46')]));if(_0x4916ae[_0x73b5('0x3c')]['filter']){_0x20d132['where']=_[_0x73b5('0x48')](_0x20d132[_0x73b5('0x44')],{'$or':_[_0x73b5('0x36')](_0x20d132['attributes'],function(_0x36d206){var _0x174f1d={};_0x174f1d[_0x36d206]={'$like':'%'+_0x4916ae['query']['filter']+'%'};return _0x174f1d;})});}_0x20d132=_[_0x73b5('0x48')]({},_0x20d132,_0x4916ae[_0x73b5('0x4a')]);return _0x4ae13d['getSubjects'](_0x20d132);}})[_0x73b5('0x1b')](function(_0x40f735){if(_0x40f735){_0x3510dc=_0x40f735['length'];if(!_0x4916ae[_0x73b5('0x3c')][_0x73b5('0x41')](_0x73b5('0x42'))){_0x20d132['limit']=qs['limit'](_0x4916ae[_0x73b5('0x3c')]['limit']);_0x20d132[_0x73b5('0x2a')]=qs[_0x73b5('0x2a')](_0x4916ae[_0x73b5('0x3c')][_0x73b5('0x2a')]);}return _0x4ae13d['getSubjects'](_0x20d132);}})[_0x73b5('0x1b')](function(_0x1bc148){if(_0x1bc148){return _0x1bc148?{'count':_0x3510dc,'rows':_0x1bc148}:null;}})[_0x73b5('0x1b')](respondWithResult(_0x173266,null))[_0x73b5('0x25')](handleError(_0x173266,null));};exports[_0x73b5('0x58')]=function(_0x3b62c2,_0x4b81df,_0x98203e){var _0x5b3a8c={};var _0x5ee48e={};var _0x1df354;var _0x14d6ac;return db[_0x73b5('0x37')]['findOne']({'where':{'id':_0x3b62c2[_0x73b5('0x4e')]['id']}})[_0x73b5('0x1b')](handleEntityNotFound(_0x4b81df,null))['then'](function(_0x22d1ff){if(_0x22d1ff){_0x1df354=_0x22d1ff;_0x5ee48e['model']=_[_0x73b5('0x4f')](db[_0x73b5('0x56')][_0x73b5('0x38')]);_0x5ee48e['query']=_[_0x73b5('0x4f')](_0x3b62c2[_0x73b5('0x3c')]);_0x5ee48e[_0x73b5('0x46')]=_[_0x73b5('0x3d')](_0x5ee48e[_0x73b5('0x3e')],_0x5ee48e['query']);_0x5b3a8c['attributes']=_[_0x73b5('0x3d')](_0x5ee48e[_0x73b5('0x3e')],qs[_0x73b5('0x40')](_0x3b62c2[_0x73b5('0x3c')][_0x73b5('0x40')]));_0x5b3a8c['attributes']=_0x5b3a8c['attributes'][_0x73b5('0x50')]?_0x5b3a8c[_0x73b5('0x3f')]:_0x5ee48e[_0x73b5('0x3e')];_0x5b3a8c['order']=qs[_0x73b5('0x43')](_0x3b62c2['query'][_0x73b5('0x43')]);_0x5b3a8c[_0x73b5('0x44')]=qs[_0x73b5('0x46')](_[_0x73b5('0x45')](_0x3b62c2[_0x73b5('0x3c')],_0x5ee48e[_0x73b5('0x46')]));if(_0x3b62c2['query'][_0x73b5('0x47')]){_0x5b3a8c[_0x73b5('0x44')]=_['merge'](_0x5b3a8c['where'],{'$or':_[_0x73b5('0x36')](_0x5b3a8c[_0x73b5('0x3f')],function(_0x151ef3){var _0x28f6fe={};_0x28f6fe[_0x151ef3]={'$like':'%'+_0x3b62c2['query'][_0x73b5('0x47')]+'%'};return _0x28f6fe;})});}_0x5b3a8c=_[_0x73b5('0x48')]({},_0x5b3a8c,_0x3b62c2[_0x73b5('0x4a')]);return _0x1df354[_0x73b5('0x58')](_0x5b3a8c);}})[_0x73b5('0x1b')](function(_0x30de47){if(_0x30de47){_0x14d6ac=_0x30de47[_0x73b5('0x50')];if(!_0x3b62c2[_0x73b5('0x3c')][_0x73b5('0x41')](_0x73b5('0x42'))){_0x5b3a8c[_0x73b5('0x2b')]=qs[_0x73b5('0x2b')](_0x3b62c2['query'][_0x73b5('0x2b')]);_0x5b3a8c[_0x73b5('0x2a')]=qs[_0x73b5('0x2a')](_0x3b62c2[_0x73b5('0x3c')][_0x73b5('0x2a')]);}return _0x1df354[_0x73b5('0x58')](_0x5b3a8c);}})[_0x73b5('0x1b')](function(_0x21783b){if(_0x21783b){return _0x21783b?{'count':_0x14d6ac,'rows':_0x21783b}:null;}})[_0x73b5('0x1b')](respondWithResult(_0x4b81df,null))[_0x73b5('0x25')](handleError(_0x4b81df,null));};exports[_0x73b5('0x59')]=function(_0x30d2a9,_0x156d3a,_0xf32624){var _0x3ca8ac={};var _0x424c39={};var _0x1fe3df;var _0x2ae813;return db[_0x73b5('0x37')][_0x73b5('0x55')]({'where':{'id':_0x30d2a9[_0x73b5('0x4e')]['id']}})[_0x73b5('0x1b')](handleEntityNotFound(_0x156d3a,null))[_0x73b5('0x1b')](function(_0x38ecb3){if(_0x38ecb3){_0x1fe3df=_0x38ecb3;_0x424c39['model']=_[_0x73b5('0x4f')](db['Tag'][_0x73b5('0x38')]);_0x424c39[_0x73b5('0x3c')]=_[_0x73b5('0x4f')](_0x30d2a9[_0x73b5('0x3c')]);_0x424c39['filters']=_[_0x73b5('0x3d')](_0x424c39['model'],_0x424c39[_0x73b5('0x3c')]);_0x3ca8ac[_0x73b5('0x3f')]=_[_0x73b5('0x3d')](_0x424c39['model'],qs['fields'](_0x30d2a9[_0x73b5('0x3c')][_0x73b5('0x40')]));_0x3ca8ac[_0x73b5('0x3f')]=_0x3ca8ac[_0x73b5('0x3f')]['length']?_0x3ca8ac[_0x73b5('0x3f')]:_0x424c39['model'];_0x3ca8ac[_0x73b5('0x57')]=qs[_0x73b5('0x43')](_0x30d2a9['query'][_0x73b5('0x43')]);_0x3ca8ac[_0x73b5('0x44')]=qs[_0x73b5('0x46')](_['pick'](_0x30d2a9['query'],_0x424c39[_0x73b5('0x46')]));if(_0x30d2a9[_0x73b5('0x3c')][_0x73b5('0x47')]){_0x3ca8ac[_0x73b5('0x44')]=_['merge'](_0x3ca8ac[_0x73b5('0x44')],{'$or':_[_0x73b5('0x36')](_0x3ca8ac[_0x73b5('0x3f')],function(_0x25a0be){var _0x534bcd={};_0x534bcd[_0x25a0be]={'$like':'%'+_0x30d2a9['query'][_0x73b5('0x47')]+'%'};return _0x534bcd;})});}_0x3ca8ac=_['merge']({},_0x3ca8ac,_0x30d2a9[_0x73b5('0x4a')]);return _0x1fe3df[_0x73b5('0x59')](_0x3ca8ac);}})[_0x73b5('0x1b')](function(_0x30358f){if(_0x30358f){_0x2ae813=_0x30358f[_0x73b5('0x50')];if(!_0x30d2a9[_0x73b5('0x3c')][_0x73b5('0x41')](_0x73b5('0x42'))){_0x3ca8ac[_0x73b5('0x2b')]=qs[_0x73b5('0x2b')](_0x30d2a9[_0x73b5('0x3c')]['limit']);_0x3ca8ac['offset']=qs[_0x73b5('0x2a')](_0x30d2a9[_0x73b5('0x3c')][_0x73b5('0x2a')]);}return _0x1fe3df[_0x73b5('0x59')](_0x3ca8ac);}})[_0x73b5('0x1b')](function(_0xcf5473){if(_0xcf5473){return _0xcf5473?{'count':_0x2ae813,'rows':_0xcf5473}:null;}})[_0x73b5('0x1b')](respondWithResult(_0x156d3a,null))['catch'](handleError(_0x156d3a,null));};exports[_0x73b5('0x5a')]=function(_0x424c3f,_0x37f301,_0x25f721){if(_0x424c3f[_0x73b5('0x53')]['id']){delete _0x424c3f[_0x73b5('0x53')]['id'];}return db[_0x73b5('0x37')]['findOne']({'where':{'id':_0x424c3f[_0x73b5('0x4e')]['id']}})[_0x73b5('0x1b')](handleEntityNotFound(_0x37f301,null))['then'](function(_0xfdf61e){if(_0xfdf61e){return _0xfdf61e[_0x73b5('0x5a')](_0x424c3f[_0x73b5('0x53')][_0x73b5('0x5b')]||[]);}return null;})[_0x73b5('0x1b')](respondWithResult(_0x37f301,null))[_0x73b5('0x25')](handleError(_0x37f301,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 7515aa5..8dcde9f 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 _0x55f3=['exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./intFreshdeskConfiguration.attributes'];(function(_0x20737a,_0x1f107d){var _0x30cb7c=function(_0x2c9185){while(--_0x2c9185){_0x20737a['push'](_0x20737a['shift']());}};_0x30cb7c(++_0x1f107d);}(_0x55f3,0x1b4));var _0x355f=function(_0xfc1b31,_0x49d99e){_0xfc1b31=_0xfc1b31-0x0;var _0x4e74d7=_0x55f3[_0xfc1b31];return _0x4e74d7;};'use strict';var _=require(_0x355f('0x0'));var util=require('util');var logger=require(_0x355f('0x1'))(_0x355f('0x2'));var moment=require('moment');var BPromise=require(_0x355f('0x3'));var rp=require(_0x355f('0x4'));var fs=require('fs');var path=require(_0x355f('0x5'));var rimraf=require(_0x355f('0x6'));var config=require('../../config/environment');var attributes=require(_0x355f('0x7'));module[_0x355f('0x8')]=function(_0x27249a,_0x23daca){return _0x27249a[_0x355f('0x9')](_0x355f('0xa'),attributes,{'tableName':_0x355f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3175=['int_freshdesk_configurations','lodash','util','api','bluebird','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','FreshdeskConfiguration'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x3175,0x8d));var _0x5317=function(_0x586fa2,_0x1a45bc){_0x586fa2=_0x586fa2-0x0;var _0x515be9=_0x3175[_0x586fa2];return _0x515be9;};'use strict';var _=require(_0x5317('0x0'));var util=require(_0x5317('0x1'));var logger=require('../../config/logger')(_0x5317('0x2'));var moment=require('moment');var BPromise=require(_0x5317('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5317('0x4'));var config=require(_0x5317('0x5'));var attributes=require(_0x5317('0x6'));module[_0x5317('0x7')]=function(_0x1ec322,_0x4589c3){return _0x1ec322['define'](_0x5317('0x8'),attributes,{'tableName':_0x5317('0x9'),'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 0e31fb1..501b6e2 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 _0x0376=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird'];(function(_0x244977,_0x248794){var _0x43bc02=function(_0x598f6d){while(--_0x598f6d){_0x244977['push'](_0x244977['shift']());}};_0x43bc02(++_0x248794);}(_0x0376,0x18b));var _0x6037=function(_0x1a040e,_0x102e6e){_0x1a040e=_0x1a040e-0x0;var _0x309059=_0x0376[_0x1a040e];return _0x309059;};'use strict';var _=require(_0x6037('0x0'));var util=require(_0x6037('0x1'));var moment=require(_0x6037('0x2'));var BPromise=require(_0x6037('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6037('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6037('0x5'));var logger=require(_0x6037('0x6'))(_0x6037('0x7'));var config=require(_0x6037('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6037('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x370bf9,_0x354515,_0x3f4b8b){return new BPromise(function(_0x46b708,_0x374a8f){return client['request'](_0x370bf9,_0x3f4b8b)[_0x6037('0xa')](function(_0x3cd448){logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x354515,_0x6037('0xb'));logger['debug'](_0x6037('0xc'),_0x354515,_0x6037('0xb'),JSON[_0x6037('0xd')](_0x3cd448));if(_0x3cd448[_0x6037('0xe')]){if(_0x3cd448[_0x6037('0xe')][_0x6037('0xf')]===0x1f4){logger[_0x6037('0xe')](_0x6037('0x10'),_0x354515,_0x3cd448[_0x6037('0xe')][_0x6037('0x11')]);return _0x374a8f(_0x3cd448[_0x6037('0xe')][_0x6037('0x11')]);}logger[_0x6037('0xe')](_0x6037('0x10'),_0x354515,_0x3cd448[_0x6037('0xe')][_0x6037('0x11')]);return _0x46b708(_0x3cd448['error'][_0x6037('0x11')]);}else{logger[_0x6037('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x354515,_0x6037('0xb'));_0x46b708(_0x3cd448[_0x6037('0x13')]['message']);}})[_0x6037('0x14')](function(_0x20d929){logger[_0x6037('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x354515,_0x20d929);_0x374a8f(_0x20d929);});});} \ No newline at end of file +var _0x08b9=['client','http','request','then','info','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshdeskConfiguration,\x20%s,\x20%s','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0xd82812,_0x2fe0a2){var _0x592bc5=function(_0x298c95){while(--_0x298c95){_0xd82812['push'](_0xd82812['shift']());}};_0x592bc5(++_0x2fe0a2);}(_0x08b9,0x1c6));var _0x908b=function(_0x122d9f,_0x2c9e5b){_0x122d9f=_0x122d9f-0x0;var _0x41a09e=_0x08b9[_0x122d9f];return _0x41a09e;};'use strict';var _=require(_0x908b('0x0'));var util=require('util');var moment=require(_0x908b('0x1'));var BPromise=require(_0x908b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x908b('0x3'));var db=require(_0x908b('0x4'))['db'];var utils=require(_0x908b('0x5'));var logger=require(_0x908b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x908b('0x7'));var client=jayson[_0x908b('0x8')][_0x908b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1533b9,_0x53668e,_0xec8a87){return new BPromise(function(_0x50a586,_0x2abc26){return client[_0x908b('0xa')](_0x1533b9,_0xec8a87)[_0x908b('0xb')](function(_0x4d5010){logger[_0x908b('0xc')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x53668e,_0x908b('0xd'));logger[_0x908b('0xe')](_0x908b('0xf'),_0x53668e,_0x908b('0xd'),JSON[_0x908b('0x10')](_0x4d5010));if(_0x4d5010[_0x908b('0x11')]){if(_0x4d5010[_0x908b('0x11')][_0x908b('0x12')]===0x1f4){logger[_0x908b('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x53668e,_0x4d5010['error']['message']);return _0x2abc26(_0x4d5010[_0x908b('0x11')][_0x908b('0x13')]);}logger[_0x908b('0x11')](_0x908b('0x14'),_0x53668e,_0x4d5010[_0x908b('0x11')][_0x908b('0x13')]);return _0x50a586(_0x4d5010[_0x908b('0x11')][_0x908b('0x13')]);}else{logger[_0x908b('0xc')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x53668e,'request\x20sent');_0x50a586(_0x4d5010['result']['message']);}})[_0x908b('0x15')](function(_0x591f37){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x53668e,_0x591f37);_0x2abc26(_0x591f37);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index d5cdc31..61b1bd3 100644 --- a/server/api/intFreshdeskField/index.js +++ b/server/api/intFreshdeskField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['/:id','isAuthenticated','show','create','put','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x949ea5,_0x47be0d){var _0xc8993e=function(_0xdb1384){while(--_0xdb1384){_0x949ea5['push'](_0x949ea5['shift']());}};_0xc8993e(++_0x47be0d);}(_0x9c44,0x178));var _0x49c4=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x9c44[_0x209941];return _0x1e8729;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var auth=require(_0x49c4('0x4'));var interaction=require(_0x49c4('0x5'));var config=require('../../config/environment');var controller=require('./intFreshdeskField.controller');router[_0x49c4('0x6')]('/',auth['isAuthenticated'](),controller[_0x49c4('0x7')]);router[_0x49c4('0x6')](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xa')]);router['post']('/',auth[_0x49c4('0x9')](),controller[_0x49c4('0xb')]);router[_0x49c4('0xc')](_0x49c4('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x49c4('0xd')](_0x49c4('0x8'),auth['isAuthenticated'](),controller[_0x49c4('0xe')]);module[_0x49c4('0xf')]=router; \ No newline at end of file +var _0x9c44=['/:id','isAuthenticated','show','create','put','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x423eba,_0xb6826c){var _0x138f29=function(_0x22e9e3){while(--_0x22e9e3){_0x423eba['push'](_0x423eba['shift']());}};_0x138f29(++_0xb6826c);}(_0x9c44,0x178));var _0x49c4=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x9c44[_0x2d7f0e];return _0x110b07;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var auth=require(_0x49c4('0x4'));var interaction=require(_0x49c4('0x5'));var config=require('../../config/environment');var controller=require('./intFreshdeskField.controller');router[_0x49c4('0x6')]('/',auth['isAuthenticated'](),controller[_0x49c4('0x7')]);router[_0x49c4('0x6')](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xa')]);router['post']('/',auth[_0x49c4('0x9')](),controller[_0x49c4('0xb')]);router[_0x49c4('0xc')](_0x49c4('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x49c4('0xd')](_0x49c4('0x8'),auth['isAuthenticated'](),controller[_0x49c4('0xe')]);module[_0x49c4('0xf')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 138a74c..1481733 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 _0x4ddd=['string','STRING','variable','customVariable','BOOLEAN','sequelize'];(function(_0x31c6d5,_0x40555d){var _0x61495b=function(_0x49427d){while(--_0x49427d){_0x31c6d5['push'](_0x31c6d5['shift']());}};_0x61495b(++_0x40555d);}(_0x4ddd,0x18b));var _0xd4dd=function(_0x11a55c,_0x4eced9){_0x11a55c=_0x11a55c-0x0;var _0x26c390=_0x4ddd[_0x11a55c];return _0x26c390;};'use strict';var Sequelize=require(_0xd4dd('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string','variable','customVariable','keyValue'),'defaultValue':_0xd4dd('0x1')},'content':{'type':Sequelize[_0xd4dd('0x2')]},'key':{'type':Sequelize[_0xd4dd('0x2')]},'keyType':{'type':Sequelize['ENUM'](_0xd4dd('0x1'),_0xd4dd('0x3'),_0xd4dd('0x4'))},'keyContent':{'type':Sequelize[_0xd4dd('0x2')]},'idField':{'type':Sequelize[_0xd4dd('0x2')]},'nameField':{'type':Sequelize[_0xd4dd('0x2')]},'customField':{'type':Sequelize[_0xd4dd('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x851e=['variable','BOOLEAN','sequelize','exports','ENUM','customVariable','keyValue','string','STRING'];(function(_0x330414,_0x4f3207){var _0x99dbff=function(_0x166f85){while(--_0x166f85){_0x330414['push'](_0x330414['shift']());}};_0x99dbff(++_0x4f3207);}(_0x851e,0x1e8));var _0xe851=function(_0x4da493,_0x15e45a){_0x4da493=_0x4da493-0x0;var _0x33e403=_0x851e[_0x4da493];return _0x33e403;};'use strict';var Sequelize=require(_0xe851('0x0'));module[_0xe851('0x1')]={'type':{'type':Sequelize[_0xe851('0x2')]('string','variable',_0xe851('0x3'),_0xe851('0x4')),'defaultValue':_0xe851('0x5')},'content':{'type':Sequelize[_0xe851('0x6')]},'key':{'type':Sequelize[_0xe851('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xe851('0x5'),_0xe851('0x7'),_0xe851('0x3'))},'keyContent':{'type':Sequelize[_0xe851('0x6')]},'idField':{'type':Sequelize[_0xe851('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xe851('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 66df685..64a79ed 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 _0x9511=['map','options','count','includeAll','include','findAll','rows','show','params','filters','length','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','FreshdeskField','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x9511,0x13b));var _0x1951=function(_0x58fa7f,_0x4ed6e3){_0x58fa7f=_0x58fa7f-0x0;var _0x526007=_0x9511[_0x58fa7f];return _0x526007;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1951('0x0'));var rimraf=require(_0x1951('0x1'));var zipdir=require(_0x1951('0x2'));var jsonpatch=require(_0x1951('0x3'));var rp=require(_0x1951('0x4'));var moment=require(_0x1951('0x5'));var BPromise=require(_0x1951('0x6'));var Mustache=require('mustache');var util=require(_0x1951('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1951('0x8'));var fs=require('fs');var _=require(_0x1951('0x9'));var squel=require(_0x1951('0xa'));var crypto=require('crypto');var jsforce=require(_0x1951('0xb'));var deskjs=require(_0x1951('0xc'));var toCsv=require(_0x1951('0xd'));var querystring=require(_0x1951('0xe'));var Papa=require('papaparse');var Redis=require(_0x1951('0xf'));var authService=require(_0x1951('0x10'));var qs=require(_0x1951('0x11'));var as=require(_0x1951('0x12'));var hardwareService=require(_0x1951('0x13'));var logger=require(_0x1951('0x14'))(_0x1951('0x15'));var utils=require(_0x1951('0x16'));var config=require(_0x1951('0x17'));var db=require(_0x1951('0x18'))['db'];function respondWithStatusCode(_0x47312d,_0x18b684){_0x18b684=_0x18b684||0xcc;return function(_0x1e1aea){if(_0x1e1aea){return _0x47312d[_0x1951('0x19')](_0x18b684);}return _0x47312d[_0x1951('0x1a')](_0x18b684)[_0x1951('0x1b')]();};}function respondWithResult(_0x22b374,_0x592dad){_0x592dad=_0x592dad||0xc8;return function(_0x790b44){if(_0x790b44){return _0x22b374['status'](_0x592dad)['json'](_0x790b44);}};}function respondWithFilteredResult(_0xa4548,_0x248e93){return function(_0x54b013){if(_0x54b013){var _0x180c84=_0x54b013['count'],_0x1866d2=_0x248e93[_0x1951('0x1c')],_0x4b1754=_0x248e93[_0x1951('0x1c')]+_0x248e93[_0x1951('0x1d')],_0x2c0c5b;if(_0x4b1754>=_0x180c84){_0x4b1754=_0x180c84;_0x2c0c5b=0xc8;}else{_0x2c0c5b=0xce;}_0xa4548[_0x1951('0x1a')](_0x2c0c5b);return _0xa4548[_0x1951('0x1e')](_0x1951('0x1f'),_0x1866d2+'-'+_0x4b1754+'/'+_0x180c84)['json'](_0x54b013);}return null;};}function patchUpdates(_0x262b5a){return function(_0x5403d4){try{jsonpatch[_0x1951('0x20')](_0x5403d4,_0x262b5a,!![]);}catch(_0x16df13){return BPromise[_0x1951('0x21')](_0x16df13);}return _0x5403d4[_0x1951('0x22')]();};}function saveUpdates(_0x5329cd,_0x28ddf6){return function(_0x216e77){if(_0x216e77){return _0x216e77[_0x1951('0x23')](_0x5329cd)[_0x1951('0x24')](function(_0x250b19){return _0x250b19;});}return null;};}function removeEntity(_0xe41547,_0x5d4740){return function(_0xadbd79){if(_0xadbd79){return _0xadbd79[_0x1951('0x25')]()[_0x1951('0x24')](function(){_0xe41547[_0x1951('0x1a')](0xcc)[_0x1951('0x1b')]();});}};}function handleEntityNotFound(_0x32da19,_0xfba3d9){return function(_0xf8f67b){if(!_0xf8f67b){_0x32da19[_0x1951('0x19')](0x194);}return _0xf8f67b;};}function handleError(_0x5cf40b,_0x1a879e){_0x1a879e=_0x1a879e||0x1f4;return function(_0x2b7983){logger['error'](_0x2b7983[_0x1951('0x26')]);if(_0x2b7983[_0x1951('0x27')]){delete _0x2b7983[_0x1951('0x27')];}_0x5cf40b[_0x1951('0x1a')](_0x1a879e)[_0x1951('0x28')](_0x2b7983);};}exports[_0x1951('0x29')]=function(_0x454730,_0x55021f){var _0x3d7baf={},_0x38cca5={},_0x4328f1={'count':0x0,'rows':[]};var _0x17576c=_['map'](db[_0x1951('0x2a')][_0x1951('0x2b')],function(_0x240f89){return{'name':_0x240f89[_0x1951('0x2c')],'type':_0x240f89[_0x1951('0x2d')][_0x1951('0x2e')]};});_0x38cca5[_0x1951('0x2f')]=_['map'](_0x17576c,'name');_0x38cca5[_0x1951('0x30')]=_[_0x1951('0x31')](_0x454730[_0x1951('0x30')]);_0x38cca5['filters']=_[_0x1951('0x32')](_0x38cca5['model'],_0x38cca5['query']);_0x3d7baf[_0x1951('0x33')]=_[_0x1951('0x32')](_0x38cca5[_0x1951('0x2f')],qs['fields'](_0x454730[_0x1951('0x30')][_0x1951('0x34')]));_0x3d7baf[_0x1951('0x33')]=_0x3d7baf['attributes']['length']?_0x3d7baf[_0x1951('0x33')]:_0x38cca5[_0x1951('0x2f')];if(!_0x454730[_0x1951('0x30')][_0x1951('0x35')](_0x1951('0x36'))){_0x3d7baf[_0x1951('0x1d')]=qs[_0x1951('0x1d')](_0x454730[_0x1951('0x30')][_0x1951('0x1d')]);_0x3d7baf[_0x1951('0x1c')]=qs['offset'](_0x454730[_0x1951('0x30')][_0x1951('0x1c')]);}_0x3d7baf['order']=qs[_0x1951('0x37')](_0x454730[_0x1951('0x30')][_0x1951('0x37')]);_0x3d7baf[_0x1951('0x38')]=qs['filters'](_[_0x1951('0x39')](_0x454730[_0x1951('0x30')],_0x38cca5['filters']));if(_0x454730[_0x1951('0x30')][_0x1951('0x3a')]){_0x3d7baf['where']=_[_0x1951('0x3b')](_0x3d7baf[_0x1951('0x38')],{'$or':_[_0x1951('0x3c')](_0x17576c,function(_0x2af8b8){if(_0x2af8b8['type']!=='VIRTUAL'){var _0xbf718={};_0xbf718[_0x2af8b8['name']]={'$like':'%'+_0x454730[_0x1951('0x30')][_0x1951('0x3a')]+'%'};return _0xbf718;}})});}_0x3d7baf=_['merge']({},_0x3d7baf,_0x454730[_0x1951('0x3d')]);var _0x4cab0c={'where':_0x3d7baf[_0x1951('0x38')]};return db[_0x1951('0x2a')][_0x1951('0x3e')](_0x4cab0c)[_0x1951('0x24')](function(_0xc35fbd){_0x4328f1[_0x1951('0x3e')]=_0xc35fbd;if(_0x454730[_0x1951('0x30')][_0x1951('0x3f')]){_0x3d7baf[_0x1951('0x40')]=[{'all':!![]}];}return db[_0x1951('0x2a')][_0x1951('0x41')](_0x3d7baf);})['then'](function(_0x22c3e6){_0x4328f1[_0x1951('0x42')]=_0x22c3e6;return _0x4328f1;})[_0x1951('0x24')](respondWithFilteredResult(_0x55021f,_0x3d7baf))['catch'](handleError(_0x55021f,null));};exports[_0x1951('0x43')]=function(_0x5cb441,_0x30fd0e){var _0x38e9dd={'raw':!![],'where':{'id':_0x5cb441[_0x1951('0x44')]['id']}},_0x44606e={};_0x44606e[_0x1951('0x2f')]=_['keys'](db['FreshdeskField'][_0x1951('0x2b')]);_0x44606e['query']=_[_0x1951('0x31')](_0x5cb441[_0x1951('0x30')]);_0x44606e[_0x1951('0x45')]=_[_0x1951('0x32')](_0x44606e['model'],_0x44606e['query']);_0x38e9dd['attributes']=_[_0x1951('0x32')](_0x44606e[_0x1951('0x2f')],qs['fields'](_0x5cb441[_0x1951('0x30')][_0x1951('0x34')]));_0x38e9dd[_0x1951('0x33')]=_0x38e9dd[_0x1951('0x33')][_0x1951('0x46')]?_0x38e9dd[_0x1951('0x33')]:_0x44606e[_0x1951('0x2f')];if(_0x5cb441[_0x1951('0x30')][_0x1951('0x3f')]){_0x38e9dd[_0x1951('0x40')]=[{'all':!![]}];}_0x38e9dd=_[_0x1951('0x3b')]({},_0x38e9dd,_0x5cb441[_0x1951('0x3d')]);return db[_0x1951('0x2a')]['find'](_0x38e9dd)[_0x1951('0x24')](handleEntityNotFound(_0x30fd0e,null))[_0x1951('0x24')](respondWithResult(_0x30fd0e,null))[_0x1951('0x47')](handleError(_0x30fd0e,null));};exports[_0x1951('0x48')]=function(_0x2512ca,_0x313d41){return db['FreshdeskField'][_0x1951('0x48')](_0x2512ca[_0x1951('0x49')],{})['then'](respondWithResult(_0x313d41,0xc9))[_0x1951('0x47')](handleError(_0x313d41,null));};exports['update']=function(_0x4194a5,_0x5cff58){if(_0x4194a5[_0x1951('0x49')]['id']){delete _0x4194a5[_0x1951('0x49')]['id'];}return db[_0x1951('0x2a')][_0x1951('0x4a')]({'where':{'id':_0x4194a5[_0x1951('0x44')]['id']}})[_0x1951('0x24')](handleEntityNotFound(_0x5cff58,null))[_0x1951('0x24')](saveUpdates(_0x4194a5[_0x1951('0x49')],null))[_0x1951('0x24')](respondWithResult(_0x5cff58,null))[_0x1951('0x47')](handleError(_0x5cff58,null));};exports[_0x1951('0x25')]=function(_0x2cc943,_0x50294f){return db[_0x1951('0x2a')][_0x1951('0x4a')]({'where':{'id':_0x2cc943[_0x1951('0x44')]['id']}})[_0x1951('0x24')](handleEntityNotFound(_0x50294f,null))['then'](removeEntity(_0x50294f,null))['catch'](handleError(_0x50294f,null));}; \ No newline at end of file +var _0x5787=['filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','rawAttributes','intersection','find','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','sendStatus','stack','name','send','index','map','FreshdeskField','fieldName','type','key','query','filters','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x5b9f60,_0x392049){var _0x2ccf26=function(_0xebaee7){while(--_0xebaee7){_0x5b9f60['push'](_0x5b9f60['shift']());}};_0x2ccf26(++_0x392049);}(_0x5787,0x9c));var _0x7578=function(_0x4b1515,_0x3503a9){_0x4b1515=_0x4b1515-0x0;var _0x162c64=_0x5787[_0x4b1515];return _0x162c64;};'use strict';var pdf=require(_0x7578('0x0'));var emlformat=require(_0x7578('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7578('0x2'));var jsonpatch=require(_0x7578('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7578('0x4'));var Mustache=require(_0x7578('0x5'));var util=require('util');var path=require(_0x7578('0x6'));var sox=require(_0x7578('0x7'));var csv=require(_0x7578('0x8'));var ejs=require(_0x7578('0x9'));var fs=require('fs');var _=require(_0x7578('0xa'));var squel=require('squel');var crypto=require(_0x7578('0xb'));var jsforce=require(_0x7578('0xc'));var deskjs=require(_0x7578('0xd'));var toCsv=require(_0x7578('0x8'));var querystring=require('querystring');var Papa=require(_0x7578('0xe'));var Redis=require(_0x7578('0xf'));var authService=require(_0x7578('0x10'));var qs=require(_0x7578('0x11'));var as=require(_0x7578('0x12'));var hardwareService=require(_0x7578('0x13'));var logger=require(_0x7578('0x14'))('api');var utils=require(_0x7578('0x15'));var config=require('../../config/environment');var db=require(_0x7578('0x16'))['db'];function respondWithStatusCode(_0x56e052,_0x556983){_0x556983=_0x556983||0xcc;return function(_0xc3d0be){if(_0xc3d0be){return _0x56e052['sendStatus'](_0x556983);}return _0x56e052[_0x7578('0x17')](_0x556983)[_0x7578('0x18')]();};}function respondWithResult(_0x3c4879,_0x3b39a8){_0x3b39a8=_0x3b39a8||0xc8;return function(_0x23ecd4){if(_0x23ecd4){return _0x3c4879[_0x7578('0x17')](_0x3b39a8)[_0x7578('0x19')](_0x23ecd4);}};}function respondWithFilteredResult(_0x5b76c2,_0x544261){return function(_0x3c3b2c){if(_0x3c3b2c){var _0x2c89ed=_0x3c3b2c[_0x7578('0x1a')],_0x5d8481=_0x544261[_0x7578('0x1b')],_0x2fc5d7=_0x544261['offset']+_0x544261[_0x7578('0x1c')],_0x3617e8;if(_0x2fc5d7>=_0x2c89ed){_0x2fc5d7=_0x2c89ed;_0x3617e8=0xc8;}else{_0x3617e8=0xce;}_0x5b76c2[_0x7578('0x17')](_0x3617e8);return _0x5b76c2[_0x7578('0x1d')](_0x7578('0x1e'),_0x5d8481+'-'+_0x2fc5d7+'/'+_0x2c89ed)['json'](_0x3c3b2c);}return null;};}function patchUpdates(_0x35f520){return function(_0x54acde){try{jsonpatch[_0x7578('0x1f')](_0x54acde,_0x35f520,!![]);}catch(_0x71b4b4){return BPromise['reject'](_0x71b4b4);}return _0x54acde['save']();};}function saveUpdates(_0xf8abd8,_0x4f70d0){return function(_0x43e6b2){if(_0x43e6b2){return _0x43e6b2[_0x7578('0x20')](_0xf8abd8)[_0x7578('0x21')](function(_0x581c19){return _0x581c19;});}return null;};}function removeEntity(_0x6caaf5,_0x394361){return function(_0x447c74){if(_0x447c74){return _0x447c74[_0x7578('0x22')]()[_0x7578('0x21')](function(){_0x6caaf5[_0x7578('0x17')](0xcc)[_0x7578('0x18')]();});}};}function handleEntityNotFound(_0x7adb59,_0x3c2dd2){return function(_0x509c78){if(!_0x509c78){_0x7adb59[_0x7578('0x23')](0x194);}return _0x509c78;};}function handleError(_0x97e971,_0x5767b5){_0x5767b5=_0x5767b5||0x1f4;return function(_0x32ac8a){logger['error'](_0x32ac8a[_0x7578('0x24')]);if(_0x32ac8a[_0x7578('0x25')]){delete _0x32ac8a['name'];}_0x97e971[_0x7578('0x17')](_0x5767b5)[_0x7578('0x26')](_0x32ac8a);};}exports[_0x7578('0x27')]=function(_0x1a8497,_0x1c5d7a){var _0x64161c={},_0x2d611c={},_0x39f498={'count':0x0,'rows':[]};var _0x5a275c=_[_0x7578('0x28')](db[_0x7578('0x29')]['rawAttributes'],function(_0xcd248c){return{'name':_0xcd248c[_0x7578('0x2a')],'type':_0xcd248c[_0x7578('0x2b')][_0x7578('0x2c')]};});_0x2d611c['model']=_[_0x7578('0x28')](_0x5a275c,_0x7578('0x25'));_0x2d611c[_0x7578('0x2d')]=_['keys'](_0x1a8497[_0x7578('0x2d')]);_0x2d611c[_0x7578('0x2e')]=_['intersection'](_0x2d611c[_0x7578('0x2f')],_0x2d611c[_0x7578('0x2d')]);_0x64161c['attributes']=_['intersection'](_0x2d611c[_0x7578('0x2f')],qs[_0x7578('0x30')](_0x1a8497[_0x7578('0x2d')]['fields']));_0x64161c[_0x7578('0x31')]=_0x64161c[_0x7578('0x31')][_0x7578('0x32')]?_0x64161c[_0x7578('0x31')]:_0x2d611c['model'];if(!_0x1a8497[_0x7578('0x2d')][_0x7578('0x33')](_0x7578('0x34'))){_0x64161c[_0x7578('0x1c')]=qs[_0x7578('0x1c')](_0x1a8497[_0x7578('0x2d')]['limit']);_0x64161c['offset']=qs[_0x7578('0x1b')](_0x1a8497['query']['offset']);}_0x64161c[_0x7578('0x35')]=qs['sort'](_0x1a8497[_0x7578('0x2d')][_0x7578('0x36')]);_0x64161c[_0x7578('0x37')]=qs[_0x7578('0x2e')](_[_0x7578('0x38')](_0x1a8497[_0x7578('0x2d')],_0x2d611c[_0x7578('0x2e')]));if(_0x1a8497[_0x7578('0x2d')][_0x7578('0x39')]){_0x64161c['where']=_[_0x7578('0x3a')](_0x64161c[_0x7578('0x37')],{'$or':_[_0x7578('0x28')](_0x5a275c,function(_0x11906b){if(_0x11906b[_0x7578('0x2b')]!==_0x7578('0x3b')){var _0xe87904={};_0xe87904[_0x11906b[_0x7578('0x25')]]={'$like':'%'+_0x1a8497['query'][_0x7578('0x39')]+'%'};return _0xe87904;}})});}_0x64161c=_[_0x7578('0x3a')]({},_0x64161c,_0x1a8497[_0x7578('0x3c')]);var _0x2c0889={'where':_0x64161c[_0x7578('0x37')]};return db[_0x7578('0x29')][_0x7578('0x1a')](_0x2c0889)['then'](function(_0x49f990){_0x39f498['count']=_0x49f990;if(_0x1a8497[_0x7578('0x2d')][_0x7578('0x3d')]){_0x64161c[_0x7578('0x3e')]=[{'all':!![]}];}return db['FreshdeskField'][_0x7578('0x3f')](_0x64161c);})[_0x7578('0x21')](function(_0x4af821){_0x39f498['rows']=_0x4af821;return _0x39f498;})[_0x7578('0x21')](respondWithFilteredResult(_0x1c5d7a,_0x64161c))[_0x7578('0x40')](handleError(_0x1c5d7a,null));};exports['show']=function(_0x19ce90,_0x2317fe){var _0x5551f2={'raw':!![],'where':{'id':_0x19ce90[_0x7578('0x41')]['id']}},_0x308600={};_0x308600[_0x7578('0x2f')]=_['keys'](db[_0x7578('0x29')][_0x7578('0x42')]);_0x308600[_0x7578('0x2d')]=_['keys'](_0x19ce90[_0x7578('0x2d')]);_0x308600[_0x7578('0x2e')]=_['intersection'](_0x308600[_0x7578('0x2f')],_0x308600['query']);_0x5551f2[_0x7578('0x31')]=_[_0x7578('0x43')](_0x308600['model'],qs[_0x7578('0x30')](_0x19ce90[_0x7578('0x2d')][_0x7578('0x30')]));_0x5551f2[_0x7578('0x31')]=_0x5551f2[_0x7578('0x31')][_0x7578('0x32')]?_0x5551f2['attributes']:_0x308600[_0x7578('0x2f')];if(_0x19ce90['query'][_0x7578('0x3d')]){_0x5551f2[_0x7578('0x3e')]=[{'all':!![]}];}_0x5551f2=_[_0x7578('0x3a')]({},_0x5551f2,_0x19ce90['options']);return db['FreshdeskField'][_0x7578('0x44')](_0x5551f2)[_0x7578('0x21')](handleEntityNotFound(_0x2317fe,null))['then'](respondWithResult(_0x2317fe,null))['catch'](handleError(_0x2317fe,null));};exports[_0x7578('0x45')]=function(_0x5ea120,_0x24c9fb){return db['FreshdeskField']['create'](_0x5ea120[_0x7578('0x46')],{})[_0x7578('0x21')](respondWithResult(_0x24c9fb,0xc9))['catch'](handleError(_0x24c9fb,null));};exports[_0x7578('0x20')]=function(_0x3dd9b9,_0x3af2dc){if(_0x3dd9b9[_0x7578('0x46')]['id']){delete _0x3dd9b9[_0x7578('0x46')]['id'];}return db[_0x7578('0x29')][_0x7578('0x44')]({'where':{'id':_0x3dd9b9['params']['id']}})[_0x7578('0x21')](handleEntityNotFound(_0x3af2dc,null))['then'](saveUpdates(_0x3dd9b9['body'],null))[_0x7578('0x21')](respondWithResult(_0x3af2dc,null))['catch'](handleError(_0x3af2dc,null));};exports[_0x7578('0x22')]=function(_0xbf2a6b,_0x315106){return db[_0x7578('0x29')][_0x7578('0x44')]({'where':{'id':_0xbf2a6b['params']['id']}})[_0x7578('0x21')](handleEntityNotFound(_0x315106,null))['then'](removeEntity(_0x315106,null))[_0x7578('0x40')](handleError(_0x315106,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index e9e3ca4..93fe903 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 _0xa7fb=['bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x549b29,_0x2e2b00){var _0x2b813f=function(_0x43234f){while(--_0x43234f){_0x549b29['push'](_0x549b29['shift']());}};_0x2b813f(++_0x2e2b00);}(_0xa7fb,0xab));var _0xba7f=function(_0x3ebbcd,_0x1afc61){_0x3ebbcd=_0x3ebbcd-0x0;var _0x210c43=_0xa7fb[_0x3ebbcd];return _0x210c43;};'use strict';var _=require(_0xba7f('0x0'));var util=require(_0xba7f('0x1'));var logger=require(_0xba7f('0x2'))(_0xba7f('0x3'));var moment=require(_0xba7f('0x4'));var BPromise=require(_0xba7f('0x5'));var rp=require(_0xba7f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xba7f('0x7'));var config=require(_0xba7f('0x8'));var attributes=require(_0xba7f('0x9'));module[_0xba7f('0xa')]=function(_0xa6240b,_0x197617){return _0xa6240b[_0xba7f('0xb')](_0xba7f('0xc'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0xba7f('0xd'),'fields':[_0xba7f('0xe'),_0xba7f('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6f03=['define','FreshdeskField','freshdesk_unique_index','idField','FieldId','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x427da5,_0x170eea){var _0x2b782e=function(_0x3c376b){while(--_0x3c376b){_0x427da5['push'](_0x427da5['shift']());}};_0x2b782e(++_0x170eea);}(_0x6f03,0xe2));var _0x36f0=function(_0x174964,_0x20b5ff){_0x174964=_0x174964-0x0;var _0x213389=_0x6f03[_0x174964];return _0x213389;};'use strict';var _=require('lodash');var util=require(_0x36f0('0x0'));var logger=require(_0x36f0('0x1'))('api');var moment=require(_0x36f0('0x2'));var BPromise=require('bluebird');var rp=require(_0x36f0('0x3'));var fs=require('fs');var path=require(_0x36f0('0x4'));var rimraf=require(_0x36f0('0x5'));var config=require(_0x36f0('0x6'));var attributes=require('./intFreshdeskField.attributes');module[_0x36f0('0x7')]=function(_0x4aacb4,_0x42284e){return _0x4aacb4[_0x36f0('0x8')](_0x36f0('0x9'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x36f0('0xa'),'fields':[_0x36f0('0xb'),_0x36f0('0xc')],'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 dd62920..5fec618 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.rpc.js +++ b/server/api/intFreshdeskField/intFreshdeskField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x132595,_0x52e349){var _0x56bf22=function(_0x57a49e){while(--_0x57a49e){_0x132595['push'](_0x132595['shift']());}};_0x56bf22(++_0x52e349);}(_0xb10b,0x12a));var _0xbb10=function(_0x326aa7,_0x12dceb){_0x326aa7=_0x326aa7-0x0;var _0x3955b2=_0xb10b[_0x326aa7];return _0x3955b2;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});} \ No newline at end of file +var _0x7a54=['info','FreshdeskField,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7a54,0x106));var _0x47a5=function(_0xcbd350,_0x53a60a){_0xcbd350=_0xcbd350-0x0;var _0xaf1fb=_0x7a54[_0xcbd350];return _0xaf1fb;};'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 e82b1fe..0e60653 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 _0xc7f7=['index','get','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','./intFreshsalesAccount.controller','isAuthenticated'];(function(_0xce3222,_0x2902c1){var _0x17f778=function(_0x31d409){while(--_0x31d409){_0xce3222['push'](_0xce3222['shift']());}};_0x17f778(++_0x2902c1);}(_0xc7f7,0x11f));var _0x7c7f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc7f7[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7c7f('0x0'));var util=require(_0x7c7f('0x1'));var path=require(_0x7c7f('0x2'));var timeout=require(_0x7c7f('0x3'));var express=require(_0x7c7f('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(_0x7c7f('0x5'));router['get']('/',auth[_0x7c7f('0x6')](),controller[_0x7c7f('0x7')]);router[_0x7c7f('0x8')]('/:id',auth[_0x7c7f('0x6')](),controller[_0x7c7f('0x9')]);router[_0x7c7f('0x8')]('/:id/configurations',auth[_0x7c7f('0x6')](),controller[_0x7c7f('0xa')]);router[_0x7c7f('0x8')](_0x7c7f('0xb'),auth['isAuthenticated'](),controller[_0x7c7f('0xc')]);router[_0x7c7f('0xd')]('/',auth[_0x7c7f('0x6')](),controller[_0x7c7f('0xe')]);router['post'](_0x7c7f('0xf'),auth[_0x7c7f('0x6')](),controller[_0x7c7f('0x10')]);router['put'](_0x7c7f('0x11'),auth[_0x7c7f('0x6')](),controller[_0x7c7f('0x12')]);router[_0x7c7f('0x13')](_0x7c7f('0x11'),auth['isAuthenticated'](),controller[_0x7c7f('0x14')]);module['exports']=router; \ No newline at end of file +var _0x7d9d=['multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','/:id','isAuthenticated','show','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy'];(function(_0x3cadbd,_0x12bc43){var _0x296da9=function(_0x3b15fc){while(--_0x3b15fc){_0x3cadbd['push'](_0x3cadbd['shift']());}};_0x296da9(++_0x12bc43);}(_0x7d9d,0x84));var _0xd7d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7d9d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd7d9('0x0'));var util=require(_0xd7d9('0x1'));var path=require(_0xd7d9('0x2'));var timeout=require(_0xd7d9('0x3'));var express=require(_0xd7d9('0x4'));var router=express[_0xd7d9('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xd7d9('0x6'));var config=require(_0xd7d9('0x7'));var controller=require(_0xd7d9('0x8'));router[_0xd7d9('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xd7d9('0xa'),auth[_0xd7d9('0xb')](),controller[_0xd7d9('0xc')]);router[_0xd7d9('0x9')](_0xd7d9('0xd'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xd7d9('0x9')](_0xd7d9('0xe'),auth['isAuthenticated'](),controller[_0xd7d9('0xf')]);router['post']('/',auth[_0xd7d9('0xb')](),controller['create']);router[_0xd7d9('0x10')](_0xd7d9('0xd'),auth['isAuthenticated'](),controller[_0xd7d9('0x11')]);router[_0xd7d9('0x12')](_0xd7d9('0xa'),auth['isAuthenticated'](),controller[_0xd7d9('0x13')]);router[_0xd7d9('0x14')](_0xd7d9('0xa'),auth[_0xd7d9('0xb')](),controller[_0xd7d9('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index d4f1c06..154adbc 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 _0x2525=['remoteUri','sequelize','exports','STRING','username'];(function(_0x35af25,_0x3d815e){var _0x1c3a65=function(_0x35eebf){while(--_0x35eebf){_0x35af25['push'](_0x35af25['shift']());}};_0x1c3a65(++_0x3d815e);}(_0x2525,0x1f0));var _0x5252=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x2525[_0x2f3848];return _0x102668;};'use strict';var Sequelize=require(_0x5252('0x0'));module[_0x5252('0x1')]={'name':{'type':Sequelize[_0x5252('0x2')]},'description':{'type':Sequelize[_0x5252('0x2')]},'username':{'type':Sequelize[_0x5252('0x2')],'unique':_0x5252('0x3')},'apiKey':{'type':Sequelize[_0x5252('0x2')]},'remoteUri':{'type':Sequelize[_0x5252('0x2')],'unique':_0x5252('0x4')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfc4f=['exports','STRING','username'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xfc4f,0x192));var _0xffc4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xfc4f[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0xffc4('0x0')]={'name':{'type':Sequelize[_0xffc4('0x1')]},'description':{'type':Sequelize[_0xffc4('0x1')]},'username':{'type':Sequelize[_0xffc4('0x1')],'unique':_0xffc4('0x2')},'apiKey':{'type':Sequelize[_0xffc4('0x1')]},'remoteUri':{'type':Sequelize[_0xffc4('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xffc4('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index cff4a7d..b32bf2b 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 _0xa699=['request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','Content-Range','apply','reject','save','then','destroy','sendStatus','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','limit','order','sort','where','filter','merge','options','rows','show','params','includeAll','include','find','body','update','getConfigurations','findOne','FreshsalesConfiguration','pick','hasOwnProperty','AccountId','Subjects','channel','FreshsalesField','Descriptions','username','remoteUri','apiKey','lastIndexOf','GET','format','%s%s','/api/selector/owners','users','email','Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','FreshsalesAccount,\x20%s,\x20%s'];(function(_0x269113,_0x44f083){var _0x163482=function(_0x550b8a){while(--_0x550b8a){_0x269113['push'](_0x269113['shift']());}};_0x163482(++_0x44f083);}(_0xa699,0x132));var _0x9a69=function(_0x40ddc0,_0x41c082){_0x40ddc0=_0x40ddc0-0x0;var _0x1aebf1=_0xa699[_0x40ddc0];return _0x1aebf1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9a69('0x0'));var rimraf=require(_0x9a69('0x1'));var zipdir=require(_0x9a69('0x2'));var jsonpatch=require(_0x9a69('0x3'));var rp=require(_0x9a69('0x4'));var moment=require(_0x9a69('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9a69('0x6'));var util=require(_0x9a69('0x7'));var path=require(_0x9a69('0x8'));var sox=require(_0x9a69('0x9'));var csv=require(_0x9a69('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9a69('0xb'));var jsforce=require(_0x9a69('0xc'));var deskjs=require(_0x9a69('0xd'));var toCsv=require(_0x9a69('0xa'));var querystring=require(_0x9a69('0xe'));var Papa=require('papaparse');var Redis=require(_0x9a69('0xf'));var authService=require(_0x9a69('0x10'));var qs=require(_0x9a69('0x11'));var as=require(_0x9a69('0x12'));var hardwareService=require(_0x9a69('0x13'));var logger=require('../../config/logger')(_0x9a69('0x14'));var utils=require(_0x9a69('0x15'));var config=require('../../config/environment');var db=require(_0x9a69('0x16'))['db'];var integrations=require(_0x9a69('0x17'));var jayson=require('jayson/promise');var client=jayson[_0x9a69('0x18')][_0x9a69('0x19')]({'port':0x232a});function checkPasswordPattern(_0x1313ec,_0x1ca02e,_0x791ea7){if(_0x791ea7){var _0x479c85=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x479c85[_0x9a69('0x1a')](_0x1ca02e)){return _0x1313ec;}else{throw new db[(_0x9a69('0x1b'))][(_0x9a69('0x1c'))](_0x9a69('0x1d'));}}else{return _0x1313ec;}}function respondWithRpcPromise(_0x428710,_0xf43f3,_0x41f952,_0x4796c7){return new BPromise(function(_0xb5326c,_0x1c22e5){var _0x194d77=_0x4796c7||client;return _0x194d77[_0x9a69('0x1e')](_0x428710,_0x41f952)['then'](function(_0x559802){logger[_0x9a69('0x1f')](_0x9a69('0x20'),_0xf43f3,_0x9a69('0x21'));logger[_0x9a69('0x22')](_0x9a69('0x23'),_0xf43f3,'request\x20sent',JSON[_0x9a69('0x24')](_0x559802));if(_0x559802['error']){if(_0x559802[_0x9a69('0x25')][_0x9a69('0x26')]===0x1f4){logger[_0x9a69('0x25')](_0x9a69('0x20'),_0xf43f3,_0x559802[_0x9a69('0x25')][_0x9a69('0x27')]);return _0x1c22e5(_0x559802['error']['message']);}logger[_0x9a69('0x25')]('FreshsalesAccount,\x20%s,\x20%s',_0xf43f3,_0x559802[_0x9a69('0x25')][_0x9a69('0x27')]);return _0xb5326c(_0x559802[_0x9a69('0x25')][_0x9a69('0x27')]);}else{logger[_0x9a69('0x1f')]('FreshsalesAccount,\x20%s,\x20%s',_0xf43f3,_0x9a69('0x21'));_0xb5326c(_0x559802[_0x9a69('0x28')][_0x9a69('0x27')]);}})[_0x9a69('0x29')](function(_0x4929dc){logger[_0x9a69('0x25')]('FreshsalesAccount,\x20%s,\x20%s',_0xf43f3,_0x4929dc);_0x1c22e5(_0x4929dc);});});}function respondWithStatusCode(_0xa32f7a,_0x295a25){_0x295a25=_0x295a25||0xcc;return function(_0x14ec2f){if(_0x14ec2f){return _0xa32f7a['sendStatus'](_0x295a25);}return _0xa32f7a[_0x9a69('0x2a')](_0x295a25)[_0x9a69('0x2b')]();};}function respondWithResult(_0x37793a,_0x50f239){_0x50f239=_0x50f239||0xc8;return function(_0x1b2193){if(_0x1b2193){return _0x37793a[_0x9a69('0x2a')](_0x50f239)[_0x9a69('0x2c')](_0x1b2193);}};}function respondWithFilteredResult(_0x3997e9,_0x2a7137){return function(_0x2cd35f){if(_0x2cd35f){var _0x5a65b4=_0x2cd35f[_0x9a69('0x2d')],_0x1c470b=_0x2a7137[_0x9a69('0x2e')],_0x3a4eac=_0x2a7137['offset']+_0x2a7137['limit'],_0xe24224;if(_0x3a4eac>=_0x5a65b4){_0x3a4eac=_0x5a65b4;_0xe24224=0xc8;}else{_0xe24224=0xce;}_0x3997e9[_0x9a69('0x2a')](_0xe24224);return _0x3997e9['set'](_0x9a69('0x2f'),_0x1c470b+'-'+_0x3a4eac+'/'+_0x5a65b4)[_0x9a69('0x2c')](_0x2cd35f);}return null;};}function patchUpdates(_0x39c7a6){return function(_0x5de6d3){try{jsonpatch[_0x9a69('0x30')](_0x5de6d3,_0x39c7a6,!![]);}catch(_0x3fb577){return BPromise[_0x9a69('0x31')](_0x3fb577);}return _0x5de6d3[_0x9a69('0x32')]();};}function saveUpdates(_0xd57e53,_0x2bd304){return function(_0x216709){if(_0x216709){return _0x216709['update'](_0xd57e53)[_0x9a69('0x33')](function(_0x1b0e09){return _0x1b0e09;});}return null;};}function removeEntity(_0x2b1d3f,_0x41fb8f){return function(_0x51c366){if(_0x51c366){return _0x51c366[_0x9a69('0x34')]()[_0x9a69('0x33')](function(){_0x2b1d3f[_0x9a69('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b72d1,_0x205616){return function(_0x30fb60){if(!_0x30fb60){_0x2b72d1[_0x9a69('0x35')](0x194);}return _0x30fb60;};}function handleError(_0xe3e511,_0x5a7c3b){_0x5a7c3b=_0x5a7c3b||0x1f4;return function(_0x5c799d){logger['error'](_0x5c799d[_0x9a69('0x36')]);if(_0x5c799d['name']){delete _0x5c799d[_0x9a69('0x37')];}_0xe3e511[_0x9a69('0x2a')](_0x5a7c3b)[_0x9a69('0x38')](_0x5c799d);};}exports[_0x9a69('0x39')]=function(_0x5f0ecd,_0x1abbe9){var _0x3b95cc={},_0x5c4af0={},_0x29f5ec={'count':0x0,'rows':[]};var _0x1e906d=_[_0x9a69('0x3a')](db[_0x9a69('0x3b')][_0x9a69('0x3c')],function(_0x83b300){return{'name':_0x83b300[_0x9a69('0x3d')],'type':_0x83b300[_0x9a69('0x3e')][_0x9a69('0x3f')]};});_0x5c4af0['model']=_['map'](_0x1e906d,_0x9a69('0x37'));_0x5c4af0[_0x9a69('0x40')]=_[_0x9a69('0x41')](_0x5f0ecd[_0x9a69('0x40')]);_0x5c4af0[_0x9a69('0x42')]=_[_0x9a69('0x43')](_0x5c4af0[_0x9a69('0x44')],_0x5c4af0[_0x9a69('0x40')]);_0x3b95cc[_0x9a69('0x45')]=_[_0x9a69('0x43')](_0x5c4af0['model'],qs[_0x9a69('0x46')](_0x5f0ecd[_0x9a69('0x40')]['fields']));_0x3b95cc[_0x9a69('0x45')]=_0x3b95cc['attributes'][_0x9a69('0x47')]?_0x3b95cc[_0x9a69('0x45')]:_0x5c4af0[_0x9a69('0x44')];if(!_0x5f0ecd['query']['hasOwnProperty'](_0x9a69('0x48'))){_0x3b95cc[_0x9a69('0x49')]=qs[_0x9a69('0x49')](_0x5f0ecd[_0x9a69('0x40')][_0x9a69('0x49')]);_0x3b95cc['offset']=qs[_0x9a69('0x2e')](_0x5f0ecd[_0x9a69('0x40')][_0x9a69('0x2e')]);}_0x3b95cc[_0x9a69('0x4a')]=qs[_0x9a69('0x4b')](_0x5f0ecd[_0x9a69('0x40')][_0x9a69('0x4b')]);_0x3b95cc[_0x9a69('0x4c')]=qs[_0x9a69('0x42')](_['pick'](_0x5f0ecd['query'],_0x5c4af0[_0x9a69('0x42')]));if(_0x5f0ecd[_0x9a69('0x40')][_0x9a69('0x4d')]){_0x3b95cc['where']=_[_0x9a69('0x4e')](_0x3b95cc[_0x9a69('0x4c')],{'$or':_[_0x9a69('0x3a')](_0x1e906d,function(_0x1a216b){if(_0x1a216b[_0x9a69('0x3e')]!=='VIRTUAL'){var _0x2255f5={};_0x2255f5[_0x1a216b[_0x9a69('0x37')]]={'$like':'%'+_0x5f0ecd[_0x9a69('0x40')][_0x9a69('0x4d')]+'%'};return _0x2255f5;}})});}_0x3b95cc=_[_0x9a69('0x4e')]({},_0x3b95cc,_0x5f0ecd[_0x9a69('0x4f')]);var _0x1b698b={'where':_0x3b95cc[_0x9a69('0x4c')]};return db['FreshsalesAccount'][_0x9a69('0x2d')](_0x1b698b)['then'](function(_0x54c125){_0x29f5ec[_0x9a69('0x2d')]=_0x54c125;if(_0x5f0ecd[_0x9a69('0x40')]['includeAll']){_0x3b95cc['include']=[{'all':!![]}];}return db['FreshsalesAccount']['findAll'](_0x3b95cc);})[_0x9a69('0x33')](function(_0x2de8c0){_0x29f5ec[_0x9a69('0x50')]=_0x2de8c0;return _0x29f5ec;})[_0x9a69('0x33')](respondWithFilteredResult(_0x1abbe9,_0x3b95cc))[_0x9a69('0x29')](handleError(_0x1abbe9,null));};exports[_0x9a69('0x51')]=function(_0x3757d6,_0x2fe962){var _0x254daf={'raw':![],'where':{'id':_0x3757d6[_0x9a69('0x52')]['id']}},_0x761324={};_0x761324['model']=_['keys'](db[_0x9a69('0x3b')][_0x9a69('0x3c')]);_0x761324[_0x9a69('0x40')]=_[_0x9a69('0x41')](_0x3757d6['query']);_0x761324[_0x9a69('0x42')]=_['intersection'](_0x761324[_0x9a69('0x44')],_0x761324[_0x9a69('0x40')]);_0x254daf['attributes']=_[_0x9a69('0x43')](_0x761324[_0x9a69('0x44')],qs[_0x9a69('0x46')](_0x3757d6[_0x9a69('0x40')][_0x9a69('0x46')]));_0x254daf['attributes']=_0x254daf[_0x9a69('0x45')][_0x9a69('0x47')]?_0x254daf['attributes']:_0x761324[_0x9a69('0x44')];if(_0x3757d6[_0x9a69('0x40')][_0x9a69('0x53')]){_0x254daf[_0x9a69('0x54')]=[{'all':!![]}];}_0x254daf=_[_0x9a69('0x4e')]({},_0x254daf,_0x3757d6['options']);return db['FreshsalesAccount'][_0x9a69('0x55')](_0x254daf)[_0x9a69('0x33')](handleEntityNotFound(_0x2fe962,null))[_0x9a69('0x33')](respondWithResult(_0x2fe962,null))[_0x9a69('0x29')](handleError(_0x2fe962,null));};exports['create']=function(_0x1707d6,_0x44af7d){return db[_0x9a69('0x3b')]['create'](_0x1707d6[_0x9a69('0x56')],{})['then'](respondWithResult(_0x44af7d,0xc9))[_0x9a69('0x29')](handleError(_0x44af7d,null));};exports[_0x9a69('0x57')]=function(_0x547a5b,_0x1ba9bc){if(_0x547a5b[_0x9a69('0x56')]['id']){delete _0x547a5b['body']['id'];}return db[_0x9a69('0x3b')][_0x9a69('0x55')]({'where':{'id':_0x547a5b[_0x9a69('0x52')]['id']}})[_0x9a69('0x33')](handleEntityNotFound(_0x1ba9bc,null))['then'](saveUpdates(_0x547a5b['body'],null))[_0x9a69('0x33')](respondWithResult(_0x1ba9bc,null))[_0x9a69('0x29')](handleError(_0x1ba9bc,null));};exports[_0x9a69('0x34')]=function(_0x5b0e3a,_0x18782a){return db[_0x9a69('0x3b')][_0x9a69('0x55')]({'where':{'id':_0x5b0e3a[_0x9a69('0x52')]['id']}})[_0x9a69('0x33')](handleEntityNotFound(_0x18782a,null))['then'](removeEntity(_0x18782a,null))[_0x9a69('0x29')](handleError(_0x18782a,null));};exports[_0x9a69('0x58')]=function(_0x2bbc94,_0x44f783,_0x2f34b4){var _0x34fbae={};var _0x57ab46={};var _0x240218;var _0x314011;return db[_0x9a69('0x3b')][_0x9a69('0x59')]({'where':{'id':_0x2bbc94[_0x9a69('0x52')]['id']}})[_0x9a69('0x33')](handleEntityNotFound(_0x44f783,null))[_0x9a69('0x33')](function(_0x4d0075){if(_0x4d0075){_0x240218=_0x4d0075;_0x57ab46['model']=_[_0x9a69('0x41')](db[_0x9a69('0x5a')][_0x9a69('0x3c')]);_0x57ab46['query']=_[_0x9a69('0x41')](_0x2bbc94[_0x9a69('0x40')]);_0x57ab46['filters']=_[_0x9a69('0x43')](_0x57ab46[_0x9a69('0x44')],_0x57ab46['query']);_0x34fbae[_0x9a69('0x45')]=_[_0x9a69('0x43')](_0x57ab46['model'],qs['fields'](_0x2bbc94['query'][_0x9a69('0x46')]));_0x34fbae[_0x9a69('0x45')]=_0x34fbae[_0x9a69('0x45')]['length']?_0x34fbae['attributes']:_0x57ab46['model'];_0x34fbae[_0x9a69('0x4a')]=qs[_0x9a69('0x4b')](_0x2bbc94[_0x9a69('0x40')]['sort']);_0x34fbae[_0x9a69('0x4c')]=qs['filters'](_[_0x9a69('0x5b')](_0x2bbc94[_0x9a69('0x40')],_0x57ab46[_0x9a69('0x42')]));if(_0x2bbc94['query'][_0x9a69('0x4d')]){_0x34fbae[_0x9a69('0x4c')]=_['merge'](_0x34fbae['where'],{'$or':_[_0x9a69('0x3a')](_0x34fbae[_0x9a69('0x45')],function(_0x423d3d){var _0x54b6c7={};_0x54b6c7[_0x423d3d]={'$like':'%'+_0x2bbc94['query'][_0x9a69('0x4d')]+'%'};return _0x54b6c7;})});}_0x34fbae=_['merge']({},_0x34fbae,_0x2bbc94['options']);return _0x240218[_0x9a69('0x58')](_0x34fbae);}})[_0x9a69('0x33')](function(_0x46b4f1){if(_0x46b4f1){_0x314011=_0x46b4f1[_0x9a69('0x47')];if(!_0x2bbc94[_0x9a69('0x40')][_0x9a69('0x5c')](_0x9a69('0x48'))){_0x34fbae[_0x9a69('0x49')]=qs[_0x9a69('0x49')](_0x2bbc94[_0x9a69('0x40')][_0x9a69('0x49')]);_0x34fbae['offset']=qs['offset'](_0x2bbc94[_0x9a69('0x40')]['offset']);}return _0x240218[_0x9a69('0x58')](_0x34fbae);}})[_0x9a69('0x33')](function(_0x18c080){if(_0x18c080){return _0x18c080?{'count':_0x314011,'rows':_0x18c080}:null;}})[_0x9a69('0x33')](respondWithResult(_0x44f783,null))[_0x9a69('0x29')](handleError(_0x44f783,null));};exports['addConfiguration']=function(_0xbe0690,_0x5aa008,_0x14f072){if(_0xbe0690[_0x9a69('0x56')]['id']){delete _0xbe0690[_0x9a69('0x56')]['id'];}return db[_0x9a69('0x3b')][_0x9a69('0x59')]({'where':{'id':_0xbe0690[_0x9a69('0x52')]['id']}})[_0x9a69('0x33')](handleEntityNotFound(_0x5aa008,null))['then'](function(_0x5f4e20){if(_0x5f4e20){_0xbe0690[_0x9a69('0x56')][_0x9a69('0x5d')]=_0x5f4e20['id'];_0xbe0690[_0x9a69('0x56')][_0x9a69('0x5e')]=integrations['getSubjects'](_0xbe0690[_0x9a69('0x56')]['channel'],_0xbe0690[_0x9a69('0x56')][_0x9a69('0x3e')]);_0xbe0690['body']['Descriptions']=integrations['getDescriptions'](_0xbe0690['body'][_0x9a69('0x5f')],_0xbe0690[_0x9a69('0x56')][_0x9a69('0x3e')]);return db['FreshsalesConfiguration']['create'](_0xbe0690[_0x9a69('0x56')],{'include':[{'model':db['FreshsalesField'],'as':_0x9a69('0x5e')},{'model':db[_0x9a69('0x60')],'as':_0x9a69('0x61')}]});}return null;})[_0x9a69('0x33')](respondWithResult(_0x5aa008,null))[_0x9a69('0x29')](handleError(_0x5aa008,null));};exports['getFields']=function(_0x4dbcc0,_0x240d91,_0x2c1f81){var _0x5e48d0='';var _0x3e69ce='';return db['FreshsalesAccount'][_0x9a69('0x59')]({'where':{'id':_0x4dbcc0[_0x9a69('0x52')]['id']},'attributes':['id',_0x9a69('0x62'),_0x9a69('0x63'),_0x9a69('0x64')]})[_0x9a69('0x33')](handleEntityNotFound(_0x240d91,null))['then'](function(_0x5c0202){if(_0x5c0202){_0x3e69ce=_0x5c0202['username'];_0x5e48d0=_0x5c0202[_0x9a69('0x63')];var _0x4b8b77=_0x5c0202['remoteUri']['slice'](-0x1);if(_0x4b8b77==='/'){_0x5e48d0=_0x5e48d0['substring'](0x0,_0x5e48d0[_0x9a69('0x65')](_0x4b8b77));}return rp({'method':_0x9a69('0x66'),'uri':util[_0x9a69('0x67')](_0x9a69('0x68'),_0x5e48d0,_0x9a69('0x69')),'headers':{'Authorization':'Token\x20token='+_0x5c0202[_0x9a69('0x64')]},'json':!![]});}})['then'](function(_0x54b9e1){if(_0x54b9e1){var _0x3223b5=_0x54b9e1[_0x9a69('0x6a')];var _0x421204=![];var _0x419257=null;for(_0x419257=0x0;_0x419257<_0x3223b5[_0x9a69('0x47')];_0x419257++){if(_0x3223b5[_0x419257][_0x9a69('0x6b')]===_0x3e69ce){_0x421204=!![];}}if(_0x421204){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x9a69('0x6c')});}}})[_0x9a69('0x33')](respondWithResult(_0x240d91,null))[_0x9a69('0x29')](function(_0x29ea28){var _0x403444=_0x4dbcc0[_0x9a69('0x40')][_0x9a69('0x1a')]?0x1f4:_0x29ea28[_0x9a69('0x6d')]||0x1f4;logger[_0x9a69('0x25')](_0x9a69('0x6e'),_0x9a69('0x6f'),_0x403444,JSON[_0x9a69('0x24')](_0x29ea28));delete _0x29ea28[_0x9a69('0x37')];if(_0x403444===0x191){_0x403444=0x190;}_0x240d91['status'](_0x403444)[_0x9a69('0x38')](_0x4dbcc0[_0x9a69('0x40')][_0x9a69('0x1a')]?{'message':_0x9a69('0x70'),'statusCode':_0x29ea28[_0x9a69('0x6d')]}:_0x29ea28);});}; \ No newline at end of file +var _0x4053=['../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','FreshsalesAccount','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','options','count','includeAll','include','rows','show','params','keys','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','getSubjects','Descriptions','channel','Subjects','FreshsalesField','getFields','username','remoteUri','substring','lastIndexOf','GET','format','/api/selector/owners','Token\x20token=','apiKey','email','Requested\x20Resource\x20not\x20Found','test','statusCode','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x1be8ae,_0x44b574){var _0x5f48a2=function(_0x3494e1){while(--_0x3494e1){_0x1be8ae['push'](_0x1be8ae['shift']());}};_0x5f48a2(++_0x44b574);}(_0x4053,0xd7));var _0x3405=function(_0x50ede0,_0x7e6410){_0x50ede0=_0x50ede0-0x0;var _0x5cbe32=_0x4053[_0x50ede0];return _0x5cbe32;};'use strict';var pdf=require(_0x3405('0x0'));var emlformat=require(_0x3405('0x1'));var rimraf=require(_0x3405('0x2'));var zipdir=require(_0x3405('0x3'));var jsonpatch=require(_0x3405('0x4'));var rp=require(_0x3405('0x5'));var moment=require('moment');var BPromise=require(_0x3405('0x6'));var Mustache=require(_0x3405('0x7'));var util=require(_0x3405('0x8'));var path=require(_0x3405('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3405('0xa'));var fs=require('fs');var _=require(_0x3405('0xb'));var squel=require(_0x3405('0xc'));var crypto=require(_0x3405('0xd'));var jsforce=require(_0x3405('0xe'));var deskjs=require(_0x3405('0xf'));var toCsv=require(_0x3405('0x10'));var querystring=require('querystring');var Papa=require(_0x3405('0x11'));var Redis=require(_0x3405('0x12'));var authService=require(_0x3405('0x13'));var qs=require(_0x3405('0x14'));var as=require(_0x3405('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3405('0x16'))('api');var utils=require(_0x3405('0x17'));var config=require(_0x3405('0x18'));var db=require(_0x3405('0x19'))['db'];var integrations=require(_0x3405('0x1a'));var jayson=require(_0x3405('0x1b'));var client=jayson[_0x3405('0x1c')][_0x3405('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x1f69ab,_0x1dfe4e,_0x1385dc){if(_0x1385dc){var _0x96afc1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x96afc1['test'](_0x1dfe4e)){return _0x1f69ab;}else{throw new db[(_0x3405('0x1e'))][(_0x3405('0x1f'))](_0x3405('0x20'));}}else{return _0x1f69ab;}}function respondWithRpcPromise(_0x5741c7,_0x4c3144,_0x464673,_0x39582e){return new BPromise(function(_0x3641f3,_0x33bbf1){var _0x28a854=_0x39582e||client;return _0x28a854[_0x3405('0x21')](_0x5741c7,_0x464673)[_0x3405('0x22')](function(_0x1e2128){logger['info'](_0x3405('0x23'),_0x4c3144,_0x3405('0x24'));logger[_0x3405('0x25')](_0x3405('0x26'),_0x4c3144,_0x3405('0x24'),JSON[_0x3405('0x27')](_0x1e2128));if(_0x1e2128[_0x3405('0x28')]){if(_0x1e2128[_0x3405('0x28')][_0x3405('0x29')]===0x1f4){logger[_0x3405('0x28')](_0x3405('0x23'),_0x4c3144,_0x1e2128[_0x3405('0x28')][_0x3405('0x2a')]);return _0x33bbf1(_0x1e2128[_0x3405('0x28')][_0x3405('0x2a')]);}logger[_0x3405('0x28')]('FreshsalesAccount,\x20%s,\x20%s',_0x4c3144,_0x1e2128[_0x3405('0x28')][_0x3405('0x2a')]);return _0x3641f3(_0x1e2128[_0x3405('0x28')]['message']);}else{logger['info'](_0x3405('0x23'),_0x4c3144,_0x3405('0x24'));_0x3641f3(_0x1e2128[_0x3405('0x2b')][_0x3405('0x2a')]);}})[_0x3405('0x2c')](function(_0x4664e3){logger['error'](_0x3405('0x23'),_0x4c3144,_0x4664e3);_0x33bbf1(_0x4664e3);});});}function respondWithStatusCode(_0x444596,_0x433708){_0x433708=_0x433708||0xcc;return function(_0x3ddffb){if(_0x3ddffb){return _0x444596[_0x3405('0x2d')](_0x433708);}return _0x444596[_0x3405('0x2e')](_0x433708)[_0x3405('0x2f')]();};}function respondWithResult(_0x196b80,_0x501434){_0x501434=_0x501434||0xc8;return function(_0x18cb87){if(_0x18cb87){return _0x196b80[_0x3405('0x2e')](_0x501434)[_0x3405('0x30')](_0x18cb87);}};}function respondWithFilteredResult(_0x34bca1,_0x1afda3){return function(_0x247bf7){if(_0x247bf7){var _0x164324=_0x247bf7['count'],_0x4b3310=_0x1afda3[_0x3405('0x31')],_0x13902e=_0x1afda3[_0x3405('0x31')]+_0x1afda3[_0x3405('0x32')],_0xecba45;if(_0x13902e>=_0x164324){_0x13902e=_0x164324;_0xecba45=0xc8;}else{_0xecba45=0xce;}_0x34bca1['status'](_0xecba45);return _0x34bca1[_0x3405('0x33')](_0x3405('0x34'),_0x4b3310+'-'+_0x13902e+'/'+_0x164324)[_0x3405('0x30')](_0x247bf7);}return null;};}function patchUpdates(_0xee09d3){return function(_0x4ae54c){try{jsonpatch[_0x3405('0x35')](_0x4ae54c,_0xee09d3,!![]);}catch(_0x33643e){return BPromise[_0x3405('0x36')](_0x33643e);}return _0x4ae54c[_0x3405('0x37')]();};}function saveUpdates(_0x47be19,_0x29eaee){return function(_0x448cac){if(_0x448cac){return _0x448cac[_0x3405('0x38')](_0x47be19)[_0x3405('0x22')](function(_0x5c9e3d){return _0x5c9e3d;});}return null;};}function removeEntity(_0x55e90c,_0xca2fcd){return function(_0x4de837){if(_0x4de837){return _0x4de837[_0x3405('0x39')]()[_0x3405('0x22')](function(){_0x55e90c[_0x3405('0x2e')](0xcc)[_0x3405('0x2f')]();});}};}function handleEntityNotFound(_0x20c987,_0x491c49){return function(_0x2ec075){if(!_0x2ec075){_0x20c987[_0x3405('0x2d')](0x194);}return _0x2ec075;};}function handleError(_0x3ef8af,_0x4dc129){_0x4dc129=_0x4dc129||0x1f4;return function(_0x469f88){logger[_0x3405('0x28')](_0x469f88[_0x3405('0x3a')]);if(_0x469f88[_0x3405('0x3b')]){delete _0x469f88[_0x3405('0x3b')];}_0x3ef8af[_0x3405('0x2e')](_0x4dc129)[_0x3405('0x3c')](_0x469f88);};}exports['index']=function(_0x1b3e51,_0x4e5795){var _0x3c7ee1={},_0x41cecd={},_0xde6a8a={'count':0x0,'rows':[]};var _0x488997=_[_0x3405('0x3d')](db[_0x3405('0x3e')][_0x3405('0x3f')],function(_0x3a0318){return{'name':_0x3a0318[_0x3405('0x40')],'type':_0x3a0318['type'][_0x3405('0x41')]};});_0x41cecd['model']=_['map'](_0x488997,_0x3405('0x3b'));_0x41cecd['query']=_['keys'](_0x1b3e51[_0x3405('0x42')]);_0x41cecd[_0x3405('0x43')]=_[_0x3405('0x44')](_0x41cecd[_0x3405('0x45')],_0x41cecd[_0x3405('0x42')]);_0x3c7ee1[_0x3405('0x46')]=_[_0x3405('0x44')](_0x41cecd[_0x3405('0x45')],qs[_0x3405('0x47')](_0x1b3e51['query'][_0x3405('0x47')]));_0x3c7ee1[_0x3405('0x46')]=_0x3c7ee1[_0x3405('0x46')][_0x3405('0x48')]?_0x3c7ee1[_0x3405('0x46')]:_0x41cecd[_0x3405('0x45')];if(!_0x1b3e51[_0x3405('0x42')][_0x3405('0x49')](_0x3405('0x4a'))){_0x3c7ee1[_0x3405('0x32')]=qs['limit'](_0x1b3e51[_0x3405('0x42')][_0x3405('0x32')]);_0x3c7ee1[_0x3405('0x31')]=qs[_0x3405('0x31')](_0x1b3e51[_0x3405('0x42')][_0x3405('0x31')]);}_0x3c7ee1[_0x3405('0x4b')]=qs[_0x3405('0x4c')](_0x1b3e51[_0x3405('0x42')]['sort']);_0x3c7ee1[_0x3405('0x4d')]=qs[_0x3405('0x43')](_[_0x3405('0x4e')](_0x1b3e51[_0x3405('0x42')],_0x41cecd[_0x3405('0x43')]));if(_0x1b3e51[_0x3405('0x42')]['filter']){_0x3c7ee1['where']=_['merge'](_0x3c7ee1[_0x3405('0x4d')],{'$or':_['map'](_0x488997,function(_0x3e4434){if(_0x3e4434[_0x3405('0x4f')]!==_0x3405('0x50')){var _0x124dd1={};_0x124dd1[_0x3e4434[_0x3405('0x3b')]]={'$like':'%'+_0x1b3e51[_0x3405('0x42')][_0x3405('0x51')]+'%'};return _0x124dd1;}})});}_0x3c7ee1=_[_0x3405('0x52')]({},_0x3c7ee1,_0x1b3e51[_0x3405('0x53')]);var _0x44507b={'where':_0x3c7ee1[_0x3405('0x4d')]};return db['FreshsalesAccount'][_0x3405('0x54')](_0x44507b)[_0x3405('0x22')](function(_0x592314){_0xde6a8a[_0x3405('0x54')]=_0x592314;if(_0x1b3e51[_0x3405('0x42')][_0x3405('0x55')]){_0x3c7ee1[_0x3405('0x56')]=[{'all':!![]}];}return db[_0x3405('0x3e')]['findAll'](_0x3c7ee1);})[_0x3405('0x22')](function(_0x4de82f){_0xde6a8a[_0x3405('0x57')]=_0x4de82f;return _0xde6a8a;})[_0x3405('0x22')](respondWithFilteredResult(_0x4e5795,_0x3c7ee1))[_0x3405('0x2c')](handleError(_0x4e5795,null));};exports[_0x3405('0x58')]=function(_0x1cb587,_0x24cdec){var _0x1b7098={'raw':![],'where':{'id':_0x1cb587[_0x3405('0x59')]['id']}},_0x167652={};_0x167652[_0x3405('0x45')]=_[_0x3405('0x5a')](db[_0x3405('0x3e')][_0x3405('0x3f')]);_0x167652[_0x3405('0x42')]=_[_0x3405('0x5a')](_0x1cb587[_0x3405('0x42')]);_0x167652[_0x3405('0x43')]=_['intersection'](_0x167652[_0x3405('0x45')],_0x167652[_0x3405('0x42')]);_0x1b7098[_0x3405('0x46')]=_[_0x3405('0x44')](_0x167652[_0x3405('0x45')],qs[_0x3405('0x47')](_0x1cb587[_0x3405('0x42')][_0x3405('0x47')]));_0x1b7098[_0x3405('0x46')]=_0x1b7098[_0x3405('0x46')][_0x3405('0x48')]?_0x1b7098[_0x3405('0x46')]:_0x167652[_0x3405('0x45')];if(_0x1cb587[_0x3405('0x42')][_0x3405('0x55')]){_0x1b7098[_0x3405('0x56')]=[{'all':!![]}];}_0x1b7098=_[_0x3405('0x52')]({},_0x1b7098,_0x1cb587[_0x3405('0x53')]);return db[_0x3405('0x3e')][_0x3405('0x5b')](_0x1b7098)[_0x3405('0x22')](handleEntityNotFound(_0x24cdec,null))[_0x3405('0x22')](respondWithResult(_0x24cdec,null))['catch'](handleError(_0x24cdec,null));};exports[_0x3405('0x5c')]=function(_0x5de546,_0x136c15){return db[_0x3405('0x3e')][_0x3405('0x5c')](_0x5de546[_0x3405('0x5d')],{})[_0x3405('0x22')](respondWithResult(_0x136c15,0xc9))['catch'](handleError(_0x136c15,null));};exports[_0x3405('0x38')]=function(_0x5633a8,_0x28ae3f){if(_0x5633a8[_0x3405('0x5d')]['id']){delete _0x5633a8[_0x3405('0x5d')]['id'];}return db[_0x3405('0x3e')][_0x3405('0x5b')]({'where':{'id':_0x5633a8[_0x3405('0x59')]['id']}})[_0x3405('0x22')](handleEntityNotFound(_0x28ae3f,null))['then'](saveUpdates(_0x5633a8[_0x3405('0x5d')],null))[_0x3405('0x22')](respondWithResult(_0x28ae3f,null))[_0x3405('0x2c')](handleError(_0x28ae3f,null));};exports[_0x3405('0x39')]=function(_0x15f24f,_0x1d7017){return db[_0x3405('0x3e')]['find']({'where':{'id':_0x15f24f[_0x3405('0x59')]['id']}})[_0x3405('0x22')](handleEntityNotFound(_0x1d7017,null))[_0x3405('0x22')](removeEntity(_0x1d7017,null))[_0x3405('0x2c')](handleError(_0x1d7017,null));};exports[_0x3405('0x5e')]=function(_0x41d587,_0x343bf1,_0x515df5){var _0x4c45cb={};var _0xa0af29={};var _0x2483f1;var _0x2d201d;return db[_0x3405('0x3e')][_0x3405('0x5f')]({'where':{'id':_0x41d587[_0x3405('0x59')]['id']}})[_0x3405('0x22')](handleEntityNotFound(_0x343bf1,null))[_0x3405('0x22')](function(_0x40ba1c){if(_0x40ba1c){_0x2483f1=_0x40ba1c;_0xa0af29[_0x3405('0x45')]=_[_0x3405('0x5a')](db[_0x3405('0x60')][_0x3405('0x3f')]);_0xa0af29['query']=_[_0x3405('0x5a')](_0x41d587[_0x3405('0x42')]);_0xa0af29['filters']=_['intersection'](_0xa0af29[_0x3405('0x45')],_0xa0af29[_0x3405('0x42')]);_0x4c45cb[_0x3405('0x46')]=_['intersection'](_0xa0af29[_0x3405('0x45')],qs[_0x3405('0x47')](_0x41d587['query'][_0x3405('0x47')]));_0x4c45cb[_0x3405('0x46')]=_0x4c45cb[_0x3405('0x46')][_0x3405('0x48')]?_0x4c45cb[_0x3405('0x46')]:_0xa0af29[_0x3405('0x45')];_0x4c45cb[_0x3405('0x4b')]=qs['sort'](_0x41d587[_0x3405('0x42')]['sort']);_0x4c45cb[_0x3405('0x4d')]=qs[_0x3405('0x43')](_[_0x3405('0x4e')](_0x41d587['query'],_0xa0af29[_0x3405('0x43')]));if(_0x41d587[_0x3405('0x42')][_0x3405('0x51')]){_0x4c45cb[_0x3405('0x4d')]=_[_0x3405('0x52')](_0x4c45cb[_0x3405('0x4d')],{'$or':_[_0x3405('0x3d')](_0x4c45cb['attributes'],function(_0x20d9a7){var _0x320662={};_0x320662[_0x20d9a7]={'$like':'%'+_0x41d587[_0x3405('0x42')][_0x3405('0x51')]+'%'};return _0x320662;})});}_0x4c45cb=_[_0x3405('0x52')]({},_0x4c45cb,_0x41d587[_0x3405('0x53')]);return _0x2483f1[_0x3405('0x5e')](_0x4c45cb);}})[_0x3405('0x22')](function(_0x346649){if(_0x346649){_0x2d201d=_0x346649[_0x3405('0x48')];if(!_0x41d587[_0x3405('0x42')][_0x3405('0x49')]('nolimit')){_0x4c45cb[_0x3405('0x32')]=qs[_0x3405('0x32')](_0x41d587[_0x3405('0x42')][_0x3405('0x32')]);_0x4c45cb['offset']=qs[_0x3405('0x31')](_0x41d587[_0x3405('0x42')][_0x3405('0x31')]);}return _0x2483f1[_0x3405('0x5e')](_0x4c45cb);}})[_0x3405('0x22')](function(_0x5a6382){if(_0x5a6382){return _0x5a6382?{'count':_0x2d201d,'rows':_0x5a6382}:null;}})[_0x3405('0x22')](respondWithResult(_0x343bf1,null))[_0x3405('0x2c')](handleError(_0x343bf1,null));};exports[_0x3405('0x61')]=function(_0x13f11b,_0x29e590,_0x52ea10){if(_0x13f11b[_0x3405('0x5d')]['id']){delete _0x13f11b[_0x3405('0x5d')]['id'];}return db[_0x3405('0x3e')][_0x3405('0x5f')]({'where':{'id':_0x13f11b[_0x3405('0x59')]['id']}})[_0x3405('0x22')](handleEntityNotFound(_0x29e590,null))[_0x3405('0x22')](function(_0x4989d5){if(_0x4989d5){_0x13f11b[_0x3405('0x5d')][_0x3405('0x62')]=_0x4989d5['id'];_0x13f11b[_0x3405('0x5d')]['Subjects']=integrations[_0x3405('0x63')](_0x13f11b['body']['channel'],_0x13f11b[_0x3405('0x5d')]['type']);_0x13f11b[_0x3405('0x5d')][_0x3405('0x64')]=integrations['getDescriptions'](_0x13f11b[_0x3405('0x5d')][_0x3405('0x65')],_0x13f11b['body']['type']);return db[_0x3405('0x60')]['create'](_0x13f11b[_0x3405('0x5d')],{'include':[{'model':db['FreshsalesField'],'as':_0x3405('0x66')},{'model':db[_0x3405('0x67')],'as':_0x3405('0x64')}]});}return null;})[_0x3405('0x22')](respondWithResult(_0x29e590,null))[_0x3405('0x2c')](handleError(_0x29e590,null));};exports[_0x3405('0x68')]=function(_0x35df84,_0x106494,_0x419233){var _0x33df81='';var _0x4562bd='';return db[_0x3405('0x3e')][_0x3405('0x5f')]({'where':{'id':_0x35df84[_0x3405('0x59')]['id']},'attributes':['id',_0x3405('0x69'),_0x3405('0x6a'),'apiKey']})[_0x3405('0x22')](handleEntityNotFound(_0x106494,null))[_0x3405('0x22')](function(_0x263ef9){if(_0x263ef9){_0x4562bd=_0x263ef9['username'];_0x33df81=_0x263ef9[_0x3405('0x6a')];var _0x2727d8=_0x263ef9[_0x3405('0x6a')]['slice'](-0x1);if(_0x2727d8==='/'){_0x33df81=_0x33df81[_0x3405('0x6b')](0x0,_0x33df81[_0x3405('0x6c')](_0x2727d8));}return rp({'method':_0x3405('0x6d'),'uri':util[_0x3405('0x6e')]('%s%s',_0x33df81,_0x3405('0x6f')),'headers':{'Authorization':_0x3405('0x70')+_0x263ef9[_0x3405('0x71')]},'json':!![]});}})['then'](function(_0x245567){if(_0x245567){var _0x1e9149=_0x245567['users'];var _0x1ebbbb=![];var _0x1dda0e=null;for(_0x1dda0e=0x0;_0x1dda0e<_0x1e9149[_0x3405('0x48')];_0x1dda0e++){if(_0x1e9149[_0x1dda0e][_0x3405('0x72')]===_0x4562bd){_0x1ebbbb=!![];}}if(_0x1ebbbb){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x3405('0x73')});}}})['then'](respondWithResult(_0x106494,null))['catch'](function(_0x464040){var _0x178c3a=_0x35df84[_0x3405('0x42')][_0x3405('0x74')]?0x1f4:_0x464040[_0x3405('0x75')]||0x1f4;logger[_0x3405('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0x3405('0x68'),_0x178c3a,JSON[_0x3405('0x27')](_0x464040));delete _0x464040[_0x3405('0x3b')];if(_0x178c3a===0x191){_0x178c3a=0x190;}_0x106494[_0x3405('0x2e')](_0x178c3a)[_0x3405('0x3c')](_0x35df84[_0x3405('0x42')][_0x3405('0x74')]?{'message':_0x3405('0x76'),'statusCode':_0x464040[_0x3405('0x75')]}:_0x464040);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 3ced1ca..872b21a 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 _0x7d8a=['request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3b4626,_0x14d17b){var _0x404a2e=function(_0x1d0e4f){while(--_0x1d0e4f){_0x3b4626['push'](_0x3b4626['shift']());}};_0x404a2e(++_0x14d17b);}(_0x7d8a,0x1ca));var _0xa7d8=function(_0x454018,_0x46e33a){_0x454018=_0x454018-0x0;var _0x24697d=_0x7d8a[_0x454018];return _0x24697d;};'use strict';var _=require(_0xa7d8('0x0'));var util=require(_0xa7d8('0x1'));var logger=require(_0xa7d8('0x2'))(_0xa7d8('0x3'));var moment=require(_0xa7d8('0x4'));var BPromise=require(_0xa7d8('0x5'));var rp=require(_0xa7d8('0x6'));var fs=require('fs');var path=require(_0xa7d8('0x7'));var rimraf=require(_0xa7d8('0x8'));var config=require(_0xa7d8('0x9'));var attributes=require(_0xa7d8('0xa'));var integrations=require(_0xa7d8('0xb'));module[_0xa7d8('0xc')]=function(_0x44660b,_0x55bb66){return _0x44660b[_0xa7d8('0xd')](_0xa7d8('0xe'),attributes,{'tableName':_0xa7d8('0xf'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2fcb=['FreshsalesAccount','int_freshsales_accounts','../../config/logger','bluebird','request-promise','rimraf','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x26e8c5,_0x59b90c){var _0x362920=function(_0x47bb28){while(--_0x47bb28){_0x26e8c5['push'](_0x26e8c5['shift']());}};_0x362920(++_0x59b90c);}(_0x2fcb,0x98));var _0xb2fc=function(_0x21b69f,_0x1c4d58){_0x21b69f=_0x21b69f-0x0;var _0x4dbe13=_0x2fcb[_0x21b69f];return _0x4dbe13;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb2fc('0x0'))('api');var moment=require('moment');var BPromise=require(_0xb2fc('0x1'));var rp=require(_0xb2fc('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb2fc('0x3'));var config=require('../../config/environment');var attributes=require(_0xb2fc('0x4'));var integrations=require(_0xb2fc('0x5'));module[_0xb2fc('0x6')]=function(_0x26db8a,_0x36e952){return _0x26db8a[_0xb2fc('0x7')](_0xb2fc('0x8'),attributes,{'tableName':_0xb2fc('0x9'),'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 80b1ad8..83faa55 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 _0x8374=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','where','limit','include','model','map','stringify','ShowFreshsalesAccount','raw','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1331d7,_0x3c62ab){var _0x219d12=function(_0x32a923){while(--_0x32a923){_0x1331d7['push'](_0x1331d7['shift']());}};_0x219d12(++_0x3c62ab);}(_0x8374,0x174));var _0x4837=function(_0x2d0a84,_0x44d08c){_0x2d0a84=_0x2d0a84-0x0;var _0x5cfdff=_0x8374[_0x2d0a84];return _0x5cfdff;};'use strict';var _=require(_0x4837('0x0'));var util=require(_0x4837('0x1'));var moment=require(_0x4837('0x2'));var BPromise=require(_0x4837('0x3'));var rs=require(_0x4837('0x4'));var fs=require('fs');var Redis=require(_0x4837('0x5'));var db=require(_0x4837('0x6'))['db'];var utils=require(_0x4837('0x7'));var logger=require(_0x4837('0x8'))(_0x4837('0x9'));var config=require(_0x4837('0xa'));var jayson=require(_0x4837('0xb'));var client=jayson[_0x4837('0xc')][_0x4837('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4e0e60,_0x2036a4,_0x560c37){return new BPromise(function(_0x408c14,_0x476a1d){return client[_0x4837('0xe')](_0x4e0e60,_0x560c37)[_0x4837('0xf')](function(_0x2f0ca6){logger[_0x4837('0x10')](_0x4837('0x11'),_0x2036a4,_0x4837('0x12'));logger[_0x4837('0x13')](_0x4837('0x14'),_0x2036a4,'request\x20sent',JSON['stringify'](_0x2f0ca6));if(_0x2f0ca6[_0x4837('0x15')]){if(_0x2f0ca6['error'][_0x4837('0x16')]===0x1f4){logger[_0x4837('0x15')]('FreshsalesAccount,\x20%s,\x20%s',_0x2036a4,_0x2f0ca6['error']['message']);return _0x476a1d(_0x2f0ca6[_0x4837('0x15')][_0x4837('0x17')]);}logger[_0x4837('0x15')](_0x4837('0x11'),_0x2036a4,_0x2f0ca6['error'][_0x4837('0x17')]);return _0x408c14(_0x2f0ca6[_0x4837('0x15')][_0x4837('0x17')]);}else{logger['info'](_0x4837('0x11'),_0x2036a4,_0x4837('0x12'));_0x408c14(_0x2f0ca6['result'][_0x4837('0x17')]);}})[_0x4837('0x18')](function(_0xb95296){logger[_0x4837('0x15')](_0x4837('0x11'),_0x2036a4,_0xb95296);_0x476a1d(_0xb95296);});});}exports[_0x4837('0x19')]=function(_0x48b61b){var _0xf21681=this;return new Promise(function(_0x1cb24a,_0x427171){return db[_0x4837('0x1a')][_0x4837('0x1b')]({'raw':_0x48b61b[_0x4837('0x1c')]?_0x48b61b[_0x4837('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x48b61b['options']?_0x48b61b[_0x4837('0x1c')][_0x4837('0x1d')]||null:null,'attributes':_0x48b61b[_0x4837('0x1c')]?_0x48b61b[_0x4837('0x1c')]['attributes']||null:null,'limit':_0x48b61b[_0x4837('0x1c')]?_0x48b61b['options'][_0x4837('0x1e')]||null:null,'include':_0x48b61b['options']?_0x48b61b['options'][_0x4837('0x1f')]?_['map'](_0x48b61b['options']['include'],function(_0x40bebd){return{'model':db[_0x40bebd[_0x4837('0x20')]],'as':_0x40bebd['as'],'attributes':_0x40bebd['attributes'],'include':_0x40bebd[_0x4837('0x1f')]?_[_0x4837('0x21')](_0x40bebd['include'],function(_0x3fa5ad){return{'model':db[_0x3fa5ad[_0x4837('0x20')]],'as':_0x3fa5ad['as'],'attributes':_0x3fa5ad['attributes'],'include':_0x3fa5ad[_0x4837('0x1f')]?_[_0x4837('0x21')](_0x3fa5ad[_0x4837('0x1f')],function(_0x22ca2b){return{'model':db[_0x22ca2b[_0x4837('0x20')]],'as':_0x22ca2b['as'],'attributes':_0x22ca2b['attributes']};}):[]};}):[]};}):[]:[]})[_0x4837('0xf')](function(_0x153bc7){logger[_0x4837('0x10')](_0x4837('0x19'),_0x48b61b);logger[_0x4837('0x13')](_0x4837('0x19'),_0x48b61b,JSON[_0x4837('0x22')](_0x153bc7));_0x1cb24a(_0x153bc7);})[_0x4837('0x18')](function(_0x55f82b){logger[_0x4837('0x15')](_0x4837('0x19'),_0x55f82b[_0x4837('0x17')],_0x48b61b);_0x427171(_0xf21681[_0x4837('0x15')](0x1f4,_0x55f82b[_0x4837('0x17')]));});});};exports[_0x4837('0x23')]=function(_0xf3e0d7){var _0x139e3c=this;return new Promise(function(_0xccb861,_0x569ae1){return db[_0x4837('0x1a')]['find']({'raw':_0xf3e0d7[_0x4837('0x1c')]?_0xf3e0d7['options'][_0x4837('0x24')]===undefined?!![]:![]:!![],'where':_0xf3e0d7[_0x4837('0x1c')]?_0xf3e0d7[_0x4837('0x1c')]['where']||null:null,'attributes':_0xf3e0d7['options']?_0xf3e0d7[_0x4837('0x1c')][_0x4837('0x25')]||null:null,'include':_0xf3e0d7[_0x4837('0x1c')]?_0xf3e0d7[_0x4837('0x1c')][_0x4837('0x1f')]?_['map'](_0xf3e0d7[_0x4837('0x1c')][_0x4837('0x1f')],function(_0x5695a1){return{'model':db[_0x5695a1[_0x4837('0x20')]],'as':_0x5695a1['as'],'attributes':_0x5695a1['attributes'],'include':_0x5695a1[_0x4837('0x1f')]?_['map'](_0x5695a1['include'],function(_0x449e7b){return{'model':db[_0x449e7b[_0x4837('0x20')]],'as':_0x449e7b['as'],'attributes':_0x449e7b[_0x4837('0x25')],'include':_0x449e7b['include']?_[_0x4837('0x21')](_0x449e7b[_0x4837('0x1f')],function(_0x59d704){return{'model':db[_0x59d704[_0x4837('0x20')]],'as':_0x59d704['as'],'attributes':_0x59d704['attributes']};}):[]};}):[]};}):[]:[]})[_0x4837('0xf')](function(_0x349bec){logger[_0x4837('0x10')](_0x4837('0x23'),_0xf3e0d7);logger['debug'](_0x4837('0x23'),_0xf3e0d7,JSON[_0x4837('0x22')](_0x349bec));_0xccb861(_0x349bec);})[_0x4837('0x18')](function(_0x285b48){logger[_0x4837('0x15')](_0x4837('0x23'),_0x285b48['message'],_0xf3e0d7);_0x569ae1(_0x139e3c[_0x4837('0x15')](0x1f4,_0x285b48['message']));});});}; \ No newline at end of file +var _0xc7da=['http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','map','model','include','ShowFreshsalesAccount','find','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x2950ba,_0x4a92b8){var _0xa7baac=function(_0x27eab9){while(--_0x27eab9){_0x2950ba['push'](_0x2950ba['shift']());}};_0xa7baac(++_0x4a92b8);}(_0xc7da,0xf2));var _0xac7d=function(_0x150841,_0x364f68){_0x150841=_0x150841-0x0;var _0x4291b5=_0xc7da[_0x150841];return _0x4291b5;};'use strict';var _=require(_0xac7d('0x0'));var util=require(_0xac7d('0x1'));var moment=require(_0xac7d('0x2'));var BPromise=require('bluebird');var rs=require(_0xac7d('0x3'));var fs=require('fs');var Redis=require(_0xac7d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xac7d('0x5'));var logger=require(_0xac7d('0x6'))('rpc');var config=require(_0xac7d('0x7'));var jayson=require(_0xac7d('0x8'));var client=jayson[_0xac7d('0x9')][_0xac7d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x268265,_0x153ce5,_0x48ca59){return new BPromise(function(_0x44eb2b,_0x457e2d){return client[_0xac7d('0xb')](_0x268265,_0x48ca59)[_0xac7d('0xc')](function(_0x217811){logger[_0xac7d('0xd')](_0xac7d('0xe'),_0x153ce5,'request\x20sent');logger[_0xac7d('0xf')](_0xac7d('0x10'),_0x153ce5,_0xac7d('0x11'),JSON['stringify'](_0x217811));if(_0x217811[_0xac7d('0x12')]){if(_0x217811[_0xac7d('0x12')][_0xac7d('0x13')]===0x1f4){logger[_0xac7d('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x153ce5,_0x217811[_0xac7d('0x12')][_0xac7d('0x14')]);return _0x457e2d(_0x217811[_0xac7d('0x12')][_0xac7d('0x14')]);}logger[_0xac7d('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x153ce5,_0x217811[_0xac7d('0x12')]['message']);return _0x44eb2b(_0x217811[_0xac7d('0x12')][_0xac7d('0x14')]);}else{logger[_0xac7d('0xd')](_0xac7d('0xe'),_0x153ce5,'request\x20sent');_0x44eb2b(_0x217811[_0xac7d('0x15')][_0xac7d('0x14')]);}})[_0xac7d('0x16')](function(_0x12813a){logger[_0xac7d('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x153ce5,_0x12813a);_0x457e2d(_0x12813a);});});}exports[_0xac7d('0x17')]=function(_0x3cb12d){var _0x563634=this;return new Promise(function(_0x2e4790,_0x2d2494){return db[_0xac7d('0x18')][_0xac7d('0x19')]({'raw':_0x3cb12d['options']?_0x3cb12d[_0xac7d('0x1a')][_0xac7d('0x1b')]===undefined?!![]:![]:!![],'where':_0x3cb12d[_0xac7d('0x1a')]?_0x3cb12d['options'][_0xac7d('0x1c')]||null:null,'attributes':_0x3cb12d['options']?_0x3cb12d[_0xac7d('0x1a')][_0xac7d('0x1d')]||null:null,'limit':_0x3cb12d[_0xac7d('0x1a')]?_0x3cb12d[_0xac7d('0x1a')][_0xac7d('0x1e')]||null:null,'include':_0x3cb12d[_0xac7d('0x1a')]?_0x3cb12d['options']['include']?_[_0xac7d('0x1f')](_0x3cb12d[_0xac7d('0x1a')]['include'],function(_0x4282d7){return{'model':db[_0x4282d7[_0xac7d('0x20')]],'as':_0x4282d7['as'],'attributes':_0x4282d7[_0xac7d('0x1d')],'include':_0x4282d7[_0xac7d('0x21')]?_[_0xac7d('0x1f')](_0x4282d7[_0xac7d('0x21')],function(_0x200562){return{'model':db[_0x200562[_0xac7d('0x20')]],'as':_0x200562['as'],'attributes':_0x200562[_0xac7d('0x1d')],'include':_0x200562[_0xac7d('0x21')]?_['map'](_0x200562[_0xac7d('0x21')],function(_0x3216cb){return{'model':db[_0x3216cb[_0xac7d('0x20')]],'as':_0x3216cb['as'],'attributes':_0x3216cb[_0xac7d('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x579b99){logger['info'](_0xac7d('0x17'),_0x3cb12d);logger[_0xac7d('0xf')](_0xac7d('0x17'),_0x3cb12d,JSON['stringify'](_0x579b99));_0x2e4790(_0x579b99);})[_0xac7d('0x16')](function(_0x506b88){logger['error']('GetFreshsalesAccount',_0x506b88['message'],_0x3cb12d);_0x2d2494(_0x563634['error'](0x1f4,_0x506b88[_0xac7d('0x14')]));});});};exports[_0xac7d('0x22')]=function(_0x35be2f){var _0x31a082=this;return new Promise(function(_0x15a950,_0x5c3c15){return db['FreshsalesAccount'][_0xac7d('0x23')]({'raw':_0x35be2f[_0xac7d('0x1a')]?_0x35be2f[_0xac7d('0x1a')][_0xac7d('0x1b')]===undefined?!![]:![]:!![],'where':_0x35be2f[_0xac7d('0x1a')]?_0x35be2f[_0xac7d('0x1a')][_0xac7d('0x1c')]||null:null,'attributes':_0x35be2f[_0xac7d('0x1a')]?_0x35be2f[_0xac7d('0x1a')][_0xac7d('0x1d')]||null:null,'include':_0x35be2f[_0xac7d('0x1a')]?_0x35be2f[_0xac7d('0x1a')][_0xac7d('0x21')]?_[_0xac7d('0x1f')](_0x35be2f[_0xac7d('0x1a')][_0xac7d('0x21')],function(_0x4ee968){return{'model':db[_0x4ee968[_0xac7d('0x20')]],'as':_0x4ee968['as'],'attributes':_0x4ee968[_0xac7d('0x1d')],'include':_0x4ee968[_0xac7d('0x21')]?_[_0xac7d('0x1f')](_0x4ee968[_0xac7d('0x21')],function(_0x5690e4){return{'model':db[_0x5690e4[_0xac7d('0x20')]],'as':_0x5690e4['as'],'attributes':_0x5690e4['attributes'],'include':_0x5690e4['include']?_[_0xac7d('0x1f')](_0x5690e4[_0xac7d('0x21')],function(_0x2adca1){return{'model':db[_0x2adca1[_0xac7d('0x20')]],'as':_0x2adca1['as'],'attributes':_0x2adca1[_0xac7d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xac7d('0xc')](function(_0x330fb0){logger[_0xac7d('0xd')](_0xac7d('0x22'),_0x35be2f);logger[_0xac7d('0xf')](_0xac7d('0x22'),_0x35be2f,JSON['stringify'](_0x330fb0));_0x15a950(_0x330fb0);})['catch'](function(_0x382c19){logger['error'](_0xac7d('0x22'),_0x382c19[_0xac7d('0x14')],_0x35be2f);_0x5c3c15(_0x31a082[_0xac7d('0x12')](0x1f4,_0x382c19[_0xac7d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 2820e2b..7dfa4b4 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 _0x3afc=['isAuthenticated','/:id/fields','getFields','post','create','put','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','get','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0xc983c1,_0x4a4332){var _0x213b06=function(_0x5bd589){while(--_0x5bd589){_0xc983c1['push'](_0xc983c1['shift']());}};_0x213b06(++_0x4a4332);}(_0x3afc,0x99));var _0xc3af=function(_0x3d97d1,_0x33faff){_0x3d97d1=_0x3d97d1-0x0;var _0x39df0e=_0x3afc[_0x3d97d1];return _0x39df0e;};'use strict';var multer=require(_0xc3af('0x0'));var util=require(_0xc3af('0x1'));var path=require(_0xc3af('0x2'));var timeout=require('connect-timeout');var express=require(_0xc3af('0x3'));var router=express[_0xc3af('0x4')]();var auth=require(_0xc3af('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc3af('0x6'));var controller=require(_0xc3af('0x7'));router[_0xc3af('0x8')]('/',auth['isAuthenticated'](),controller[_0xc3af('0x9')]);router[_0xc3af('0x8')](_0xc3af('0xa'),auth['isAuthenticated'](),controller[_0xc3af('0xb')]);router[_0xc3af('0x8')](_0xc3af('0xc'),auth['isAuthenticated'](),controller[_0xc3af('0xd')]);router['get'](_0xc3af('0xe'),auth[_0xc3af('0xf')](),controller['getDescriptions']);router['get'](_0xc3af('0x10'),auth[_0xc3af('0xf')](),controller[_0xc3af('0x11')]);router[_0xc3af('0x12')]('/',auth[_0xc3af('0xf')](),controller[_0xc3af('0x13')]);router[_0xc3af('0x14')](_0xc3af('0xa'),auth[_0xc3af('0xf')](),controller['update']);router[_0xc3af('0x15')](_0xc3af('0xa'),auth[_0xc3af('0xf')](),controller[_0xc3af('0x16')]);module[_0xc3af('0x17')]=router; \ No newline at end of file +var _0xd44d=['isAuthenticated','/:id','show','/:id/subjects','getSubjects','getFields','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get'];(function(_0x1c0f41,_0x26d95d){var _0x369a9f=function(_0x251234){while(--_0x251234){_0x1c0f41['push'](_0x1c0f41['shift']());}};_0x369a9f(++_0x26d95d);}(_0xd44d,0x166));var _0xdd44=function(_0x5b905e,_0x51964c){_0x5b905e=_0x5b905e-0x0;var _0x529093=_0xd44d[_0x5b905e];return _0x529093;};'use strict';var multer=require(_0xdd44('0x0'));var util=require(_0xdd44('0x1'));var path=require('path');var timeout=require(_0xdd44('0x2'));var express=require(_0xdd44('0x3'));var router=express[_0xdd44('0x4')]();var auth=require(_0xdd44('0x5'));var interaction=require(_0xdd44('0x6'));var config=require(_0xdd44('0x7'));var controller=require(_0xdd44('0x8'));router[_0xdd44('0x9')]('/',auth[_0xdd44('0xa')](),controller['index']);router['get'](_0xdd44('0xb'),auth[_0xdd44('0xa')](),controller[_0xdd44('0xc')]);router[_0xdd44('0x9')](_0xdd44('0xd'),auth[_0xdd44('0xa')](),controller[_0xdd44('0xe')]);router[_0xdd44('0x9')]('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0xdd44('0x9')]('/:id/fields',auth[_0xdd44('0xa')](),controller[_0xdd44('0xf')]);router[_0xdd44('0x10')]('/',auth[_0xdd44('0xa')](),controller[_0xdd44('0x11')]);router[_0xdd44('0x12')](_0xdd44('0xb'),auth['isAuthenticated'](),controller[_0xdd44('0x13')]);router[_0xdd44('0x14')](_0xdd44('0xb'),auth['isAuthenticated'](),controller[_0xdd44('0x15')]);module[_0xdd44('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 4c043d2..a49b76f 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 _0x6ede=['exports','STRING','sequelize'];(function(_0x49c271,_0x4d514f){var _0x48c8af=function(_0x2d4ccb){while(--_0x2d4ccb){_0x49c271['push'](_0x49c271['shift']());}};_0x48c8af(++_0x4d514f);}(_0x6ede,0x9b));var _0xe6ed=function(_0x3be2e2,_0x5c166d){_0x3be2e2=_0x3be2e2-0x0;var _0x53b9c5=_0x6ede[_0x3be2e2];return _0x53b9c5;};'use strict';var Sequelize=require(_0xe6ed('0x0'));module[_0xe6ed('0x1')]={'name':{'type':Sequelize[_0xe6ed('0x2')]},'description':{'type':Sequelize[_0xe6ed('0x2')]}}; \ No newline at end of file +var _0x1a6e=['exports','STRING'];(function(_0x33a519,_0x37e121){var _0x489e8c=function(_0x4f419d){while(--_0x4f419d){_0x33a519['push'](_0x33a519['shift']());}};_0x489e8c(++_0x37e121);}(_0x1a6e,0x19c));var _0xe1a6=function(_0x180cd0,_0x386c6e){_0x180cd0=_0x180cd0-0x0;var _0x49fc32=_0x1a6e[_0x180cd0];return _0x49fc32;};'use strict';var Sequelize=require('sequelize');module[_0xe1a6('0x0')]={'name':{'type':Sequelize[_0xe1a6('0x1')]},'description':{'type':Sequelize[_0xe1a6('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 9a48fcd..90381f1 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 _0x56e7=['rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','options','find','create','body','getSubjects','findOne','params','FreshsalesField','getDescriptions','getFields','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','client','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','status','end','count','offset','limit','set','Content-Range','json','reject','update','destroy','sendStatus','send','index','map','FreshsalesConfiguration'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x56e7,0x7b));var _0x756e=function(_0x5bc4e1,_0x39d898){_0x5bc4e1=_0x5bc4e1-0x0;var _0x2fccc3=_0x56e7[_0x5bc4e1];return _0x2fccc3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x756e('0x0'));var rimraf=require(_0x756e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x756e('0x2'));var rp=require(_0x756e('0x3'));var moment=require(_0x756e('0x4'));var BPromise=require(_0x756e('0x5'));var Mustache=require(_0x756e('0x6'));var util=require(_0x756e('0x7'));var path=require(_0x756e('0x8'));var sox=require('sox');var csv=require(_0x756e('0x9'));var ejs=require(_0x756e('0xa'));var fs=require('fs');var _=require(_0x756e('0xb'));var squel=require(_0x756e('0xc'));var crypto=require('crypto');var jsforce=require(_0x756e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x756e('0x9'));var querystring=require(_0x756e('0xe'));var Papa=require(_0x756e('0xf'));var Redis=require(_0x756e('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x756e('0x11'));var hardwareService=require(_0x756e('0x12'));var logger=require(_0x756e('0x13'))('api');var utils=require(_0x756e('0x14'));var config=require(_0x756e('0x15'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x756e('0x16')]['http']({'port':0x232a});function checkPasswordPattern(_0x459237,_0x21701a,_0x38d5e9){if(_0x38d5e9){var _0x136052=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x136052[_0x756e('0x17')](_0x21701a)){return _0x459237;}else{throw new db['Sequelize']['ValidationError'](_0x756e('0x18'));}}else{return _0x459237;}}function respondWithRpcPromise(_0x11f37b,_0xccccd4,_0x59956f,_0x530e36){return new BPromise(function(_0x1f7161,_0x33dd9c){var _0x1cf73d=_0x530e36||client;return _0x1cf73d[_0x756e('0x19')](_0x11f37b,_0x59956f)[_0x756e('0x1a')](function(_0x285290){logger[_0x756e('0x1b')](_0x756e('0x1c'),_0xccccd4,_0x756e('0x1d'));logger['debug'](_0x756e('0x1e'),_0xccccd4,'request\x20sent',JSON['stringify'](_0x285290));if(_0x285290[_0x756e('0x1f')]){if(_0x285290[_0x756e('0x1f')][_0x756e('0x20')]===0x1f4){logger[_0x756e('0x1f')](_0x756e('0x1c'),_0xccccd4,_0x285290[_0x756e('0x1f')][_0x756e('0x21')]);return _0x33dd9c(_0x285290[_0x756e('0x1f')][_0x756e('0x21')]);}logger[_0x756e('0x1f')](_0x756e('0x1c'),_0xccccd4,_0x285290[_0x756e('0x1f')][_0x756e('0x21')]);return _0x1f7161(_0x285290[_0x756e('0x1f')][_0x756e('0x21')]);}else{logger[_0x756e('0x1b')]('FreshsalesConfiguration,\x20%s,\x20%s',_0xccccd4,_0x756e('0x1d'));_0x1f7161(_0x285290['result'][_0x756e('0x21')]);}})[_0x756e('0x22')](function(_0x43cc04){logger[_0x756e('0x1f')]('FreshsalesConfiguration,\x20%s,\x20%s',_0xccccd4,_0x43cc04);_0x33dd9c(_0x43cc04);});});}function respondWithStatusCode(_0x3ef5ef,_0x4cbd7){_0x4cbd7=_0x4cbd7||0xcc;return function(_0x2f4db8){if(_0x2f4db8){return _0x3ef5ef['sendStatus'](_0x4cbd7);}return _0x3ef5ef[_0x756e('0x23')](_0x4cbd7)[_0x756e('0x24')]();};}function respondWithResult(_0x29dffb,_0x555912){_0x555912=_0x555912||0xc8;return function(_0xf09ae3){if(_0xf09ae3){return _0x29dffb[_0x756e('0x23')](_0x555912)['json'](_0xf09ae3);}};}function respondWithFilteredResult(_0x39befb,_0x43df79){return function(_0x345162){if(_0x345162){var _0x5a1cf0=_0x345162[_0x756e('0x25')],_0x3c332e=_0x43df79[_0x756e('0x26')],_0x308153=_0x43df79['offset']+_0x43df79[_0x756e('0x27')],_0x5c6949;if(_0x308153>=_0x5a1cf0){_0x308153=_0x5a1cf0;_0x5c6949=0xc8;}else{_0x5c6949=0xce;}_0x39befb[_0x756e('0x23')](_0x5c6949);return _0x39befb[_0x756e('0x28')](_0x756e('0x29'),_0x3c332e+'-'+_0x308153+'/'+_0x5a1cf0)[_0x756e('0x2a')](_0x345162);}return null;};}function patchUpdates(_0x4fdb97){return function(_0x2e2558){try{jsonpatch['apply'](_0x2e2558,_0x4fdb97,!![]);}catch(_0x47b17c){return BPromise[_0x756e('0x2b')](_0x47b17c);}return _0x2e2558['save']();};}function saveUpdates(_0x2e00ec,_0x6a3661){return function(_0x6aaf10){if(_0x6aaf10){return _0x6aaf10[_0x756e('0x2c')](_0x2e00ec)[_0x756e('0x1a')](function(_0x17d9d1){return _0x17d9d1;});}return null;};}function removeEntity(_0x39ad1c,_0xd3903){return function(_0x25457a){if(_0x25457a){return _0x25457a[_0x756e('0x2d')]()[_0x756e('0x1a')](function(){_0x39ad1c[_0x756e('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x523f09,_0x1d116){return function(_0x3204b9){if(!_0x3204b9){_0x523f09[_0x756e('0x2e')](0x194);}return _0x3204b9;};}function handleError(_0x8c29ea,_0x254efe){_0x254efe=_0x254efe||0x1f4;return function(_0x31a507){logger[_0x756e('0x1f')](_0x31a507['stack']);if(_0x31a507['name']){delete _0x31a507['name'];}_0x8c29ea[_0x756e('0x23')](_0x254efe)[_0x756e('0x2f')](_0x31a507);};}exports[_0x756e('0x30')]=function(_0x4fadda,_0x32958b){var _0x2d8a29={},_0x5d1575={},_0x3ece0f={'count':0x0,'rows':[]};var _0x341e35=_[_0x756e('0x31')](db[_0x756e('0x32')][_0x756e('0x33')],function(_0x26965c){return{'name':_0x26965c[_0x756e('0x34')],'type':_0x26965c[_0x756e('0x35')]['key']};});_0x5d1575[_0x756e('0x36')]=_[_0x756e('0x31')](_0x341e35,_0x756e('0x37'));_0x5d1575[_0x756e('0x38')]=_[_0x756e('0x39')](_0x4fadda[_0x756e('0x38')]);_0x5d1575[_0x756e('0x3a')]=_[_0x756e('0x3b')](_0x5d1575[_0x756e('0x36')],_0x5d1575[_0x756e('0x38')]);_0x2d8a29['attributes']=_[_0x756e('0x3b')](_0x5d1575[_0x756e('0x36')],qs['fields'](_0x4fadda[_0x756e('0x38')][_0x756e('0x3c')]));_0x2d8a29[_0x756e('0x3d')]=_0x2d8a29['attributes'][_0x756e('0x3e')]?_0x2d8a29[_0x756e('0x3d')]:_0x5d1575[_0x756e('0x36')];if(!_0x4fadda['query'][_0x756e('0x3f')](_0x756e('0x40'))){_0x2d8a29[_0x756e('0x27')]=qs[_0x756e('0x27')](_0x4fadda[_0x756e('0x38')][_0x756e('0x27')]);_0x2d8a29['offset']=qs[_0x756e('0x26')](_0x4fadda[_0x756e('0x38')]['offset']);}_0x2d8a29[_0x756e('0x41')]=qs[_0x756e('0x42')](_0x4fadda[_0x756e('0x38')][_0x756e('0x42')]);_0x2d8a29[_0x756e('0x43')]=qs[_0x756e('0x3a')](_[_0x756e('0x44')](_0x4fadda[_0x756e('0x38')],_0x5d1575[_0x756e('0x3a')]));if(_0x4fadda['query'][_0x756e('0x45')]){_0x2d8a29['where']=_[_0x756e('0x46')](_0x2d8a29[_0x756e('0x43')],{'$or':_[_0x756e('0x31')](_0x341e35,function(_0x54248c){if(_0x54248c[_0x756e('0x35')]!==_0x756e('0x47')){var _0xf68a24={};_0xf68a24[_0x54248c['name']]={'$like':'%'+_0x4fadda['query'][_0x756e('0x45')]+'%'};return _0xf68a24;}})});}_0x2d8a29=_[_0x756e('0x46')]({},_0x2d8a29,_0x4fadda['options']);var _0x499da2={'where':_0x2d8a29[_0x756e('0x43')]};return db[_0x756e('0x32')][_0x756e('0x25')](_0x499da2)['then'](function(_0x3c70a1){_0x3ece0f['count']=_0x3c70a1;if(_0x4fadda[_0x756e('0x38')][_0x756e('0x48')]){_0x2d8a29[_0x756e('0x49')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x756e('0x4a')](_0x2d8a29);})['then'](function(_0x5064a3){_0x3ece0f[_0x756e('0x4b')]=_0x5064a3;return _0x3ece0f;})['then'](respondWithFilteredResult(_0x32958b,_0x2d8a29))[_0x756e('0x22')](handleError(_0x32958b,null));};exports[_0x756e('0x4c')]=function(_0xd6ee1b,_0x2512d3){var _0x95061c={'raw':![],'where':{'id':_0xd6ee1b['params']['id']}},_0x2fb384={};_0x2fb384[_0x756e('0x36')]=_['keys'](db[_0x756e('0x32')]['rawAttributes']);_0x2fb384[_0x756e('0x38')]=_['keys'](_0xd6ee1b[_0x756e('0x38')]);_0x2fb384['filters']=_[_0x756e('0x3b')](_0x2fb384[_0x756e('0x36')],_0x2fb384[_0x756e('0x38')]);_0x95061c['attributes']=_[_0x756e('0x3b')](_0x2fb384[_0x756e('0x36')],qs['fields'](_0xd6ee1b['query'][_0x756e('0x3c')]));_0x95061c[_0x756e('0x3d')]=_0x95061c[_0x756e('0x3d')][_0x756e('0x3e')]?_0x95061c[_0x756e('0x3d')]:_0x2fb384[_0x756e('0x36')];if(_0xd6ee1b[_0x756e('0x38')][_0x756e('0x48')]){_0x95061c[_0x756e('0x49')]=[{'all':!![]}];}_0x95061c=_['merge']({},_0x95061c,_0xd6ee1b[_0x756e('0x4d')]);return db[_0x756e('0x32')][_0x756e('0x4e')](_0x95061c)[_0x756e('0x1a')](handleEntityNotFound(_0x2512d3,null))[_0x756e('0x1a')](respondWithResult(_0x2512d3,null))[_0x756e('0x22')](handleError(_0x2512d3,null));};exports[_0x756e('0x4f')]=function(_0x15c159,_0x4da157){return db[_0x756e('0x32')][_0x756e('0x4f')](_0x15c159['body'],{})[_0x756e('0x1a')](respondWithResult(_0x4da157,0xc9))['catch'](handleError(_0x4da157,null));};exports[_0x756e('0x2c')]=function(_0xa5d6a3,_0x1d0b60){if(_0xa5d6a3['body']['id']){delete _0xa5d6a3[_0x756e('0x50')]['id'];}return db[_0x756e('0x32')][_0x756e('0x4e')]({'where':{'id':_0xa5d6a3['params']['id']}})[_0x756e('0x1a')](handleEntityNotFound(_0x1d0b60,null))['then'](saveUpdates(_0xa5d6a3[_0x756e('0x50')],null))[_0x756e('0x1a')](respondWithResult(_0x1d0b60,null))[_0x756e('0x22')](handleError(_0x1d0b60,null));};exports[_0x756e('0x2d')]=function(_0x3c9248,_0x413061){return db[_0x756e('0x32')][_0x756e('0x4e')]({'where':{'id':_0x3c9248['params']['id']}})[_0x756e('0x1a')](handleEntityNotFound(_0x413061,null))[_0x756e('0x1a')](removeEntity(_0x413061,null))[_0x756e('0x22')](handleError(_0x413061,null));};exports[_0x756e('0x51')]=function(_0x3c3cc3,_0x7c1c21,_0x14d02b){var _0x2a280a={};var _0x2ed6dd={};var _0xa78775;var _0x237a29;return db[_0x756e('0x32')][_0x756e('0x52')]({'where':{'id':_0x3c3cc3[_0x756e('0x53')]['id']}})['then'](handleEntityNotFound(_0x7c1c21,null))[_0x756e('0x1a')](function(_0x9b1c8a){if(_0x9b1c8a){_0xa78775=_0x9b1c8a;_0x2ed6dd[_0x756e('0x36')]=_[_0x756e('0x39')](db[_0x756e('0x54')][_0x756e('0x33')]);_0x2ed6dd['query']=_[_0x756e('0x39')](_0x3c3cc3[_0x756e('0x38')]);_0x2ed6dd[_0x756e('0x3a')]=_[_0x756e('0x3b')](_0x2ed6dd['model'],_0x2ed6dd['query']);_0x2a280a[_0x756e('0x3d')]=_[_0x756e('0x3b')](_0x2ed6dd[_0x756e('0x36')],qs[_0x756e('0x3c')](_0x3c3cc3['query'][_0x756e('0x3c')]));_0x2a280a[_0x756e('0x3d')]=_0x2a280a[_0x756e('0x3d')][_0x756e('0x3e')]?_0x2a280a['attributes']:_0x2ed6dd['model'];_0x2a280a[_0x756e('0x41')]=qs[_0x756e('0x42')](_0x3c3cc3[_0x756e('0x38')][_0x756e('0x42')]);_0x2a280a[_0x756e('0x43')]=qs[_0x756e('0x3a')](_[_0x756e('0x44')](_0x3c3cc3[_0x756e('0x38')],_0x2ed6dd['filters']));if(_0x3c3cc3['query'][_0x756e('0x45')]){_0x2a280a[_0x756e('0x43')]=_[_0x756e('0x46')](_0x2a280a[_0x756e('0x43')],{'$or':_[_0x756e('0x31')](_0x2a280a[_0x756e('0x3d')],function(_0x1ce418){var _0x580b66={};_0x580b66[_0x1ce418]={'$like':'%'+_0x3c3cc3[_0x756e('0x38')]['filter']+'%'};return _0x580b66;})});}_0x2a280a=_[_0x756e('0x46')]({},_0x2a280a,_0x3c3cc3['options']);return _0xa78775[_0x756e('0x51')](_0x2a280a);}})[_0x756e('0x1a')](function(_0x1e4ee4){if(_0x1e4ee4){_0x237a29=_0x1e4ee4['length'];if(!_0x3c3cc3[_0x756e('0x38')][_0x756e('0x3f')](_0x756e('0x40'))){_0x2a280a[_0x756e('0x27')]=qs[_0x756e('0x27')](_0x3c3cc3[_0x756e('0x38')][_0x756e('0x27')]);_0x2a280a['offset']=qs['offset'](_0x3c3cc3[_0x756e('0x38')][_0x756e('0x26')]);}return _0xa78775[_0x756e('0x51')](_0x2a280a);}})[_0x756e('0x1a')](function(_0x2c4dc5){if(_0x2c4dc5){return _0x2c4dc5?{'count':_0x237a29,'rows':_0x2c4dc5}:null;}})[_0x756e('0x1a')](respondWithResult(_0x7c1c21,null))['catch'](handleError(_0x7c1c21,null));};exports[_0x756e('0x55')]=function(_0x228182,_0x190752,_0x2fa04b){var _0x338f50={};var _0x2b564a={};var _0x4c20c4;var _0x3041da;return db['FreshsalesConfiguration'][_0x756e('0x52')]({'where':{'id':_0x228182[_0x756e('0x53')]['id']}})[_0x756e('0x1a')](handleEntityNotFound(_0x190752,null))[_0x756e('0x1a')](function(_0x975c7b){if(_0x975c7b){_0x4c20c4=_0x975c7b;_0x2b564a['model']=_['keys'](db[_0x756e('0x54')]['rawAttributes']);_0x2b564a[_0x756e('0x38')]=_['keys'](_0x228182[_0x756e('0x38')]);_0x2b564a['filters']=_[_0x756e('0x3b')](_0x2b564a[_0x756e('0x36')],_0x2b564a[_0x756e('0x38')]);_0x338f50['attributes']=_[_0x756e('0x3b')](_0x2b564a['model'],qs[_0x756e('0x3c')](_0x228182[_0x756e('0x38')][_0x756e('0x3c')]));_0x338f50[_0x756e('0x3d')]=_0x338f50[_0x756e('0x3d')][_0x756e('0x3e')]?_0x338f50[_0x756e('0x3d')]:_0x2b564a['model'];_0x338f50[_0x756e('0x41')]=qs[_0x756e('0x42')](_0x228182['query'][_0x756e('0x42')]);_0x338f50['where']=qs['filters'](_[_0x756e('0x44')](_0x228182['query'],_0x2b564a[_0x756e('0x3a')]));if(_0x228182['query'][_0x756e('0x45')]){_0x338f50['where']=_[_0x756e('0x46')](_0x338f50[_0x756e('0x43')],{'$or':_[_0x756e('0x31')](_0x338f50[_0x756e('0x3d')],function(_0xf9cb3a){var _0x247725={};_0x247725[_0xf9cb3a]={'$like':'%'+_0x228182[_0x756e('0x38')][_0x756e('0x45')]+'%'};return _0x247725;})});}_0x338f50=_[_0x756e('0x46')]({},_0x338f50,_0x228182[_0x756e('0x4d')]);return _0x4c20c4[_0x756e('0x55')](_0x338f50);}})[_0x756e('0x1a')](function(_0x9cdab6){if(_0x9cdab6){_0x3041da=_0x9cdab6['length'];if(!_0x228182['query'][_0x756e('0x3f')](_0x756e('0x40'))){_0x338f50[_0x756e('0x27')]=qs[_0x756e('0x27')](_0x228182[_0x756e('0x38')][_0x756e('0x27')]);_0x338f50[_0x756e('0x26')]=qs['offset'](_0x228182[_0x756e('0x38')][_0x756e('0x26')]);}return _0x4c20c4[_0x756e('0x55')](_0x338f50);}})[_0x756e('0x1a')](function(_0xcfaaba){if(_0xcfaaba){return _0xcfaaba?{'count':_0x3041da,'rows':_0xcfaaba}:null;}})['then'](respondWithResult(_0x190752,null))[_0x756e('0x22')](handleError(_0x190752,null));};exports['getFields']=function(_0x5a95ee,_0x45dfd2,_0x48b8e8){var _0x863f9={};var _0x1d5cc3={};var _0x502719;var _0x4130e3;return db[_0x756e('0x32')][_0x756e('0x52')]({'where':{'id':_0x5a95ee[_0x756e('0x53')]['id']}})[_0x756e('0x1a')](handleEntityNotFound(_0x45dfd2,null))['then'](function(_0x3498dd){if(_0x3498dd){_0x502719=_0x3498dd;_0x1d5cc3[_0x756e('0x36')]=_[_0x756e('0x39')](db[_0x756e('0x54')][_0x756e('0x33')]);_0x1d5cc3['query']=_['keys'](_0x5a95ee['query']);_0x1d5cc3[_0x756e('0x3a')]=_['intersection'](_0x1d5cc3[_0x756e('0x36')],_0x1d5cc3[_0x756e('0x38')]);_0x863f9[_0x756e('0x3d')]=_['intersection'](_0x1d5cc3[_0x756e('0x36')],qs['fields'](_0x5a95ee[_0x756e('0x38')]['fields']));_0x863f9[_0x756e('0x3d')]=_0x863f9[_0x756e('0x3d')][_0x756e('0x3e')]?_0x863f9[_0x756e('0x3d')]:_0x1d5cc3[_0x756e('0x36')];_0x863f9[_0x756e('0x41')]=qs[_0x756e('0x42')](_0x5a95ee[_0x756e('0x38')][_0x756e('0x42')]);_0x863f9['where']=qs[_0x756e('0x3a')](_[_0x756e('0x44')](_0x5a95ee[_0x756e('0x38')],_0x1d5cc3[_0x756e('0x3a')]));if(_0x5a95ee[_0x756e('0x38')][_0x756e('0x45')]){_0x863f9[_0x756e('0x43')]=_[_0x756e('0x46')](_0x863f9[_0x756e('0x43')],{'$or':_[_0x756e('0x31')](_0x863f9[_0x756e('0x3d')],function(_0x44a587){var _0x586579={};_0x586579[_0x44a587]={'$like':'%'+_0x5a95ee[_0x756e('0x38')][_0x756e('0x45')]+'%'};return _0x586579;})});}_0x863f9=_[_0x756e('0x46')]({},_0x863f9,_0x5a95ee[_0x756e('0x4d')]);return _0x502719[_0x756e('0x56')](_0x863f9);}})[_0x756e('0x1a')](function(_0x2287b1){if(_0x2287b1){_0x4130e3=_0x2287b1[_0x756e('0x3e')];if(!_0x5a95ee[_0x756e('0x38')][_0x756e('0x3f')](_0x756e('0x40'))){_0x863f9[_0x756e('0x27')]=qs[_0x756e('0x27')](_0x5a95ee[_0x756e('0x38')]['limit']);_0x863f9[_0x756e('0x26')]=qs[_0x756e('0x26')](_0x5a95ee[_0x756e('0x38')][_0x756e('0x26')]);}return _0x502719[_0x756e('0x56')](_0x863f9);}})[_0x756e('0x1a')](function(_0x251584){if(_0x251584){return _0x251584?{'count':_0x4130e3,'rows':_0x251584}:null;}})[_0x756e('0x1a')](respondWithResult(_0x45dfd2,null))[_0x756e('0x22')](handleError(_0x45dfd2,null));}; \ No newline at end of file +var _0x33c5=['fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','nolimit','sort','filter','merge','VIRTUAL','options','where','includeAll','findAll','rows','show','rawAttributes','length','include','find','create','body','params','getSubjects','findOne','FreshsalesField','order','pick','hasOwnProperty','getDescriptions','getFields','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','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','test','Sequelize','ValidationError','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','json','count','offset','limit','set','apply','reject','save','update','destroy','status','index','map','FreshsalesConfiguration'];(function(_0x561546,_0x434772){var _0x140c30=function(_0x46482e){while(--_0x46482e){_0x561546['push'](_0x561546['shift']());}};_0x140c30(++_0x434772);}(_0x33c5,0xe6));var _0x533c=function(_0x29631f,_0xdb767){_0x29631f=_0x29631f-0x0;var _0x486d87=_0x33c5[_0x29631f];return _0x486d87;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x533c('0x0'));var rimraf=require(_0x533c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x533c('0x2'));var rp=require(_0x533c('0x3'));var moment=require(_0x533c('0x4'));var BPromise=require(_0x533c('0x5'));var Mustache=require(_0x533c('0x6'));var util=require('util');var path=require(_0x533c('0x7'));var sox=require(_0x533c('0x8'));var csv=require(_0x533c('0x9'));var ejs=require(_0x533c('0xa'));var fs=require('fs');var _=require(_0x533c('0xb'));var squel=require(_0x533c('0xc'));var crypto=require(_0x533c('0xd'));var jsforce=require(_0x533c('0xe'));var deskjs=require(_0x533c('0xf'));var toCsv=require(_0x533c('0x9'));var querystring=require(_0x533c('0x10'));var Papa=require(_0x533c('0x11'));var Redis=require(_0x533c('0x12'));var authService=require(_0x533c('0x13'));var qs=require(_0x533c('0x14'));var as=require(_0x533c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x533c('0x16'))(_0x533c('0x17'));var utils=require(_0x533c('0x18'));var config=require(_0x533c('0x19'));var db=require(_0x533c('0x1a'))['db'];var jayson=require(_0x533c('0x1b'));var client=jayson['client'][_0x533c('0x1c')]({'port':0x232a});function checkPasswordPattern(_0xf93007,_0x300a63,_0x12ecae){if(_0x12ecae){var _0x2d5bc8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2d5bc8[_0x533c('0x1d')](_0x300a63)){return _0xf93007;}else{throw new db[(_0x533c('0x1e'))][(_0x533c('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 _0xf93007;}}function respondWithRpcPromise(_0x335f73,_0x7c1d33,_0x3f4a5c,_0x3e544f){return new BPromise(function(_0x56dfb7,_0x1031e7){var _0x1ed6ba=_0x3e544f||client;return _0x1ed6ba[_0x533c('0x20')](_0x335f73,_0x3f4a5c)[_0x533c('0x21')](function(_0x2854ab){logger[_0x533c('0x22')](_0x533c('0x23'),_0x7c1d33,_0x533c('0x24'));logger[_0x533c('0x25')](_0x533c('0x26'),_0x7c1d33,_0x533c('0x24'),JSON[_0x533c('0x27')](_0x2854ab));if(_0x2854ab[_0x533c('0x28')]){if(_0x2854ab[_0x533c('0x28')][_0x533c('0x29')]===0x1f4){logger[_0x533c('0x28')](_0x533c('0x23'),_0x7c1d33,_0x2854ab[_0x533c('0x28')]['message']);return _0x1031e7(_0x2854ab[_0x533c('0x28')]['message']);}logger['error'](_0x533c('0x23'),_0x7c1d33,_0x2854ab[_0x533c('0x28')]['message']);return _0x56dfb7(_0x2854ab[_0x533c('0x28')][_0x533c('0x2a')]);}else{logger[_0x533c('0x22')](_0x533c('0x23'),_0x7c1d33,'request\x20sent');_0x56dfb7(_0x2854ab[_0x533c('0x2b')][_0x533c('0x2a')]);}})[_0x533c('0x2c')](function(_0x107a97){logger[_0x533c('0x28')](_0x533c('0x23'),_0x7c1d33,_0x107a97);_0x1031e7(_0x107a97);});});}function respondWithStatusCode(_0xb51a5,_0x43f669){_0x43f669=_0x43f669||0xcc;return function(_0xb1c937){if(_0xb1c937){return _0xb51a5[_0x533c('0x2d')](_0x43f669);}return _0xb51a5['status'](_0x43f669)[_0x533c('0x2e')]();};}function respondWithResult(_0xfab4da,_0x503c2e){_0x503c2e=_0x503c2e||0xc8;return function(_0x3caaa5){if(_0x3caaa5){return _0xfab4da['status'](_0x503c2e)[_0x533c('0x2f')](_0x3caaa5);}};}function respondWithFilteredResult(_0x14d783,_0x4a0e86){return function(_0x8dd7f1){if(_0x8dd7f1){var _0x425f60=_0x8dd7f1[_0x533c('0x30')],_0x146a8e=_0x4a0e86[_0x533c('0x31')],_0x212d1b=_0x4a0e86[_0x533c('0x31')]+_0x4a0e86[_0x533c('0x32')],_0x38d886;if(_0x212d1b>=_0x425f60){_0x212d1b=_0x425f60;_0x38d886=0xc8;}else{_0x38d886=0xce;}_0x14d783['status'](_0x38d886);return _0x14d783[_0x533c('0x33')]('Content-Range',_0x146a8e+'-'+_0x212d1b+'/'+_0x425f60)[_0x533c('0x2f')](_0x8dd7f1);}return null;};}function patchUpdates(_0x11c5e7){return function(_0x39eda3){try{jsonpatch[_0x533c('0x34')](_0x39eda3,_0x11c5e7,!![]);}catch(_0x16006a){return BPromise[_0x533c('0x35')](_0x16006a);}return _0x39eda3[_0x533c('0x36')]();};}function saveUpdates(_0x624d84,_0x287ee5){return function(_0x47831f){if(_0x47831f){return _0x47831f[_0x533c('0x37')](_0x624d84)[_0x533c('0x21')](function(_0x3f7ffc){return _0x3f7ffc;});}return null;};}function removeEntity(_0x14dd9d,_0x3803d0){return function(_0x5ac6b4){if(_0x5ac6b4){return _0x5ac6b4[_0x533c('0x38')]()[_0x533c('0x21')](function(){_0x14dd9d[_0x533c('0x39')](0xcc)[_0x533c('0x2e')]();});}};}function handleEntityNotFound(_0x56694f,_0x3f1db9){return function(_0x31b4e4){if(!_0x31b4e4){_0x56694f[_0x533c('0x2d')](0x194);}return _0x31b4e4;};}function handleError(_0x40f077,_0x1255b1){_0x1255b1=_0x1255b1||0x1f4;return function(_0x56e0f0){logger['error'](_0x56e0f0['stack']);if(_0x56e0f0['name']){delete _0x56e0f0['name'];}_0x40f077[_0x533c('0x39')](_0x1255b1)['send'](_0x56e0f0);};}exports[_0x533c('0x3a')]=function(_0x55726a,_0x34243d){var _0x3cd1e6={},_0x14c121={},_0x56adcc={'count':0x0,'rows':[]};var _0x44a18d=_[_0x533c('0x3b')](db[_0x533c('0x3c')]['rawAttributes'],function(_0x160d4b){return{'name':_0x160d4b[_0x533c('0x3d')],'type':_0x160d4b[_0x533c('0x3e')]['key']};});_0x14c121[_0x533c('0x3f')]=_[_0x533c('0x3b')](_0x44a18d,_0x533c('0x40'));_0x14c121[_0x533c('0x41')]=_[_0x533c('0x42')](_0x55726a[_0x533c('0x41')]);_0x14c121[_0x533c('0x43')]=_[_0x533c('0x44')](_0x14c121[_0x533c('0x3f')],_0x14c121[_0x533c('0x41')]);_0x3cd1e6[_0x533c('0x45')]=_['intersection'](_0x14c121[_0x533c('0x3f')],qs[_0x533c('0x46')](_0x55726a[_0x533c('0x41')][_0x533c('0x46')]));_0x3cd1e6[_0x533c('0x45')]=_0x3cd1e6[_0x533c('0x45')]['length']?_0x3cd1e6[_0x533c('0x45')]:_0x14c121[_0x533c('0x3f')];if(!_0x55726a[_0x533c('0x41')]['hasOwnProperty'](_0x533c('0x47'))){_0x3cd1e6[_0x533c('0x32')]=qs[_0x533c('0x32')](_0x55726a[_0x533c('0x41')]['limit']);_0x3cd1e6[_0x533c('0x31')]=qs['offset'](_0x55726a[_0x533c('0x41')][_0x533c('0x31')]);}_0x3cd1e6['order']=qs[_0x533c('0x48')](_0x55726a[_0x533c('0x41')][_0x533c('0x48')]);_0x3cd1e6['where']=qs['filters'](_['pick'](_0x55726a['query'],_0x14c121[_0x533c('0x43')]));if(_0x55726a['query'][_0x533c('0x49')]){_0x3cd1e6['where']=_[_0x533c('0x4a')](_0x3cd1e6['where'],{'$or':_[_0x533c('0x3b')](_0x44a18d,function(_0x4a946b){if(_0x4a946b['type']!==_0x533c('0x4b')){var _0x1bd868={};_0x1bd868[_0x4a946b[_0x533c('0x40')]]={'$like':'%'+_0x55726a[_0x533c('0x41')][_0x533c('0x49')]+'%'};return _0x1bd868;}})});}_0x3cd1e6=_['merge']({},_0x3cd1e6,_0x55726a[_0x533c('0x4c')]);var _0x22dc87={'where':_0x3cd1e6[_0x533c('0x4d')]};return db[_0x533c('0x3c')]['count'](_0x22dc87)[_0x533c('0x21')](function(_0x5080a6){_0x56adcc['count']=_0x5080a6;if(_0x55726a['query'][_0x533c('0x4e')]){_0x3cd1e6['include']=[{'all':!![]}];}return db[_0x533c('0x3c')][_0x533c('0x4f')](_0x3cd1e6);})[_0x533c('0x21')](function(_0x471c59){_0x56adcc[_0x533c('0x50')]=_0x471c59;return _0x56adcc;})[_0x533c('0x21')](respondWithFilteredResult(_0x34243d,_0x3cd1e6))[_0x533c('0x2c')](handleError(_0x34243d,null));};exports[_0x533c('0x51')]=function(_0x52411e,_0x19ccc0){var _0x6b16e1={'raw':![],'where':{'id':_0x52411e['params']['id']}},_0xaaf682={};_0xaaf682[_0x533c('0x3f')]=_[_0x533c('0x42')](db['FreshsalesConfiguration'][_0x533c('0x52')]);_0xaaf682['query']=_[_0x533c('0x42')](_0x52411e[_0x533c('0x41')]);_0xaaf682[_0x533c('0x43')]=_[_0x533c('0x44')](_0xaaf682[_0x533c('0x3f')],_0xaaf682[_0x533c('0x41')]);_0x6b16e1[_0x533c('0x45')]=_['intersection'](_0xaaf682[_0x533c('0x3f')],qs[_0x533c('0x46')](_0x52411e[_0x533c('0x41')][_0x533c('0x46')]));_0x6b16e1[_0x533c('0x45')]=_0x6b16e1[_0x533c('0x45')][_0x533c('0x53')]?_0x6b16e1['attributes']:_0xaaf682['model'];if(_0x52411e['query']['includeAll']){_0x6b16e1[_0x533c('0x54')]=[{'all':!![]}];}_0x6b16e1=_[_0x533c('0x4a')]({},_0x6b16e1,_0x52411e['options']);return db[_0x533c('0x3c')][_0x533c('0x55')](_0x6b16e1)[_0x533c('0x21')](handleEntityNotFound(_0x19ccc0,null))['then'](respondWithResult(_0x19ccc0,null))[_0x533c('0x2c')](handleError(_0x19ccc0,null));};exports['create']=function(_0x50cfbc,_0x209b9f){return db[_0x533c('0x3c')][_0x533c('0x56')](_0x50cfbc[_0x533c('0x57')],{})[_0x533c('0x21')](respondWithResult(_0x209b9f,0xc9))[_0x533c('0x2c')](handleError(_0x209b9f,null));};exports[_0x533c('0x37')]=function(_0x51190c,_0x1ec3d0){if(_0x51190c['body']['id']){delete _0x51190c[_0x533c('0x57')]['id'];}return db[_0x533c('0x3c')][_0x533c('0x55')]({'where':{'id':_0x51190c[_0x533c('0x58')]['id']}})[_0x533c('0x21')](handleEntityNotFound(_0x1ec3d0,null))[_0x533c('0x21')](saveUpdates(_0x51190c[_0x533c('0x57')],null))[_0x533c('0x21')](respondWithResult(_0x1ec3d0,null))['catch'](handleError(_0x1ec3d0,null));};exports[_0x533c('0x38')]=function(_0x43a333,_0x163563){return db[_0x533c('0x3c')][_0x533c('0x55')]({'where':{'id':_0x43a333[_0x533c('0x58')]['id']}})['then'](handleEntityNotFound(_0x163563,null))[_0x533c('0x21')](removeEntity(_0x163563,null))['catch'](handleError(_0x163563,null));};exports[_0x533c('0x59')]=function(_0x451737,_0x15f70,_0x9b28b8){var _0x302b66={};var _0xc683d5={};var _0x5cc8bc;var _0x591985;return db[_0x533c('0x3c')][_0x533c('0x5a')]({'where':{'id':_0x451737[_0x533c('0x58')]['id']}})[_0x533c('0x21')](handleEntityNotFound(_0x15f70,null))['then'](function(_0x29c95c){if(_0x29c95c){_0x5cc8bc=_0x29c95c;_0xc683d5[_0x533c('0x3f')]=_[_0x533c('0x42')](db[_0x533c('0x5b')][_0x533c('0x52')]);_0xc683d5[_0x533c('0x41')]=_[_0x533c('0x42')](_0x451737[_0x533c('0x41')]);_0xc683d5[_0x533c('0x43')]=_[_0x533c('0x44')](_0xc683d5[_0x533c('0x3f')],_0xc683d5[_0x533c('0x41')]);_0x302b66[_0x533c('0x45')]=_[_0x533c('0x44')](_0xc683d5[_0x533c('0x3f')],qs[_0x533c('0x46')](_0x451737[_0x533c('0x41')]['fields']));_0x302b66[_0x533c('0x45')]=_0x302b66['attributes']['length']?_0x302b66[_0x533c('0x45')]:_0xc683d5[_0x533c('0x3f')];_0x302b66[_0x533c('0x5c')]=qs[_0x533c('0x48')](_0x451737[_0x533c('0x41')][_0x533c('0x48')]);_0x302b66[_0x533c('0x4d')]=qs['filters'](_[_0x533c('0x5d')](_0x451737[_0x533c('0x41')],_0xc683d5['filters']));if(_0x451737[_0x533c('0x41')][_0x533c('0x49')]){_0x302b66[_0x533c('0x4d')]=_[_0x533c('0x4a')](_0x302b66['where'],{'$or':_[_0x533c('0x3b')](_0x302b66[_0x533c('0x45')],function(_0x50223e){var _0x1589b0={};_0x1589b0[_0x50223e]={'$like':'%'+_0x451737[_0x533c('0x41')]['filter']+'%'};return _0x1589b0;})});}_0x302b66=_[_0x533c('0x4a')]({},_0x302b66,_0x451737[_0x533c('0x4c')]);return _0x5cc8bc['getSubjects'](_0x302b66);}})[_0x533c('0x21')](function(_0x5183e2){if(_0x5183e2){_0x591985=_0x5183e2['length'];if(!_0x451737[_0x533c('0x41')][_0x533c('0x5e')](_0x533c('0x47'))){_0x302b66[_0x533c('0x32')]=qs['limit'](_0x451737[_0x533c('0x41')][_0x533c('0x32')]);_0x302b66[_0x533c('0x31')]=qs[_0x533c('0x31')](_0x451737[_0x533c('0x41')]['offset']);}return _0x5cc8bc[_0x533c('0x59')](_0x302b66);}})['then'](function(_0x45b589){if(_0x45b589){return _0x45b589?{'count':_0x591985,'rows':_0x45b589}:null;}})['then'](respondWithResult(_0x15f70,null))[_0x533c('0x2c')](handleError(_0x15f70,null));};exports['getDescriptions']=function(_0x4bd014,_0x511f74,_0x3283bb){var _0x3f3981={};var _0x191a3b={};var _0x52c812;var _0x2e202e;return db[_0x533c('0x3c')][_0x533c('0x5a')]({'where':{'id':_0x4bd014[_0x533c('0x58')]['id']}})[_0x533c('0x21')](handleEntityNotFound(_0x511f74,null))['then'](function(_0x596cb0){if(_0x596cb0){_0x52c812=_0x596cb0;_0x191a3b[_0x533c('0x3f')]=_[_0x533c('0x42')](db[_0x533c('0x5b')][_0x533c('0x52')]);_0x191a3b[_0x533c('0x41')]=_[_0x533c('0x42')](_0x4bd014[_0x533c('0x41')]);_0x191a3b[_0x533c('0x43')]=_[_0x533c('0x44')](_0x191a3b['model'],_0x191a3b[_0x533c('0x41')]);_0x3f3981[_0x533c('0x45')]=_[_0x533c('0x44')](_0x191a3b[_0x533c('0x3f')],qs[_0x533c('0x46')](_0x4bd014[_0x533c('0x41')][_0x533c('0x46')]));_0x3f3981[_0x533c('0x45')]=_0x3f3981[_0x533c('0x45')][_0x533c('0x53')]?_0x3f3981[_0x533c('0x45')]:_0x191a3b[_0x533c('0x3f')];_0x3f3981[_0x533c('0x5c')]=qs[_0x533c('0x48')](_0x4bd014[_0x533c('0x41')][_0x533c('0x48')]);_0x3f3981[_0x533c('0x4d')]=qs['filters'](_[_0x533c('0x5d')](_0x4bd014[_0x533c('0x41')],_0x191a3b['filters']));if(_0x4bd014['query'][_0x533c('0x49')]){_0x3f3981['where']=_[_0x533c('0x4a')](_0x3f3981[_0x533c('0x4d')],{'$or':_[_0x533c('0x3b')](_0x3f3981[_0x533c('0x45')],function(_0x3f8098){var _0x54eedf={};_0x54eedf[_0x3f8098]={'$like':'%'+_0x4bd014[_0x533c('0x41')][_0x533c('0x49')]+'%'};return _0x54eedf;})});}_0x3f3981=_[_0x533c('0x4a')]({},_0x3f3981,_0x4bd014[_0x533c('0x4c')]);return _0x52c812[_0x533c('0x5f')](_0x3f3981);}})[_0x533c('0x21')](function(_0x1aa938){if(_0x1aa938){_0x2e202e=_0x1aa938[_0x533c('0x53')];if(!_0x4bd014[_0x533c('0x41')][_0x533c('0x5e')](_0x533c('0x47'))){_0x3f3981[_0x533c('0x32')]=qs[_0x533c('0x32')](_0x4bd014[_0x533c('0x41')][_0x533c('0x32')]);_0x3f3981[_0x533c('0x31')]=qs[_0x533c('0x31')](_0x4bd014[_0x533c('0x41')]['offset']);}return _0x52c812[_0x533c('0x5f')](_0x3f3981);}})[_0x533c('0x21')](function(_0x247915){if(_0x247915){return _0x247915?{'count':_0x2e202e,'rows':_0x247915}:null;}})[_0x533c('0x21')](respondWithResult(_0x511f74,null))['catch'](handleError(_0x511f74,null));};exports[_0x533c('0x60')]=function(_0xc0cf5d,_0x4d1b98,_0x411f86){var _0x5b8ead={};var _0x291be3={};var _0x4be94e;var _0x11654c;return db[_0x533c('0x3c')][_0x533c('0x5a')]({'where':{'id':_0xc0cf5d['params']['id']}})['then'](handleEntityNotFound(_0x4d1b98,null))['then'](function(_0x1088f9){if(_0x1088f9){_0x4be94e=_0x1088f9;_0x291be3['model']=_[_0x533c('0x42')](db[_0x533c('0x5b')][_0x533c('0x52')]);_0x291be3[_0x533c('0x41')]=_['keys'](_0xc0cf5d['query']);_0x291be3[_0x533c('0x43')]=_['intersection'](_0x291be3[_0x533c('0x3f')],_0x291be3[_0x533c('0x41')]);_0x5b8ead[_0x533c('0x45')]=_['intersection'](_0x291be3[_0x533c('0x3f')],qs['fields'](_0xc0cf5d[_0x533c('0x41')][_0x533c('0x46')]));_0x5b8ead['attributes']=_0x5b8ead[_0x533c('0x45')][_0x533c('0x53')]?_0x5b8ead[_0x533c('0x45')]:_0x291be3[_0x533c('0x3f')];_0x5b8ead[_0x533c('0x5c')]=qs[_0x533c('0x48')](_0xc0cf5d['query'][_0x533c('0x48')]);_0x5b8ead[_0x533c('0x4d')]=qs[_0x533c('0x43')](_['pick'](_0xc0cf5d[_0x533c('0x41')],_0x291be3['filters']));if(_0xc0cf5d['query'][_0x533c('0x49')]){_0x5b8ead[_0x533c('0x4d')]=_['merge'](_0x5b8ead[_0x533c('0x4d')],{'$or':_[_0x533c('0x3b')](_0x5b8ead[_0x533c('0x45')],function(_0x32ec4f){var _0x1dd861={};_0x1dd861[_0x32ec4f]={'$like':'%'+_0xc0cf5d[_0x533c('0x41')][_0x533c('0x49')]+'%'};return _0x1dd861;})});}_0x5b8ead=_[_0x533c('0x4a')]({},_0x5b8ead,_0xc0cf5d[_0x533c('0x4c')]);return _0x4be94e[_0x533c('0x60')](_0x5b8ead);}})[_0x533c('0x21')](function(_0x243d1a){if(_0x243d1a){_0x11654c=_0x243d1a[_0x533c('0x53')];if(!_0xc0cf5d['query'][_0x533c('0x5e')](_0x533c('0x47'))){_0x5b8ead[_0x533c('0x32')]=qs['limit'](_0xc0cf5d[_0x533c('0x41')]['limit']);_0x5b8ead[_0x533c('0x31')]=qs[_0x533c('0x31')](_0xc0cf5d[_0x533c('0x41')]['offset']);}return _0x4be94e[_0x533c('0x60')](_0x5b8ead);}})[_0x533c('0x21')](function(_0x206029){if(_0x206029){return _0x206029?{'count':_0x11654c,'rows':_0x206029}:null;}})['then'](respondWithResult(_0x4d1b98,null))['catch'](handleError(_0x4d1b98,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 56d42cc..f3f5cef 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 _0xca56=['./intFreshsalesConfiguration.attributes','exports','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x47ffe6,_0x592f40){var _0x3c1724=function(_0x3e20a2){while(--_0x3e20a2){_0x47ffe6['push'](_0x47ffe6['shift']());}};_0x3c1724(++_0x592f40);}(_0xca56,0xee));var _0x6ca5=function(_0x5ae926,_0x43b832){_0x5ae926=_0x5ae926-0x0;var _0x4bde2d=_0xca56[_0x5ae926];return _0x4bde2d;};'use strict';var _=require(_0x6ca5('0x0'));var util=require(_0x6ca5('0x1'));var logger=require(_0x6ca5('0x2'))(_0x6ca5('0x3'));var moment=require(_0x6ca5('0x4'));var BPromise=require(_0x6ca5('0x5'));var rp=require(_0x6ca5('0x6'));var fs=require('fs');var path=require(_0x6ca5('0x7'));var rimraf=require(_0x6ca5('0x8'));var config=require('../../config/environment');var attributes=require(_0x6ca5('0x9'));module[_0x6ca5('0xa')]=function(_0x4440bd,_0x2c078a){return _0x4440bd['define'](_0x6ca5('0xb'),attributes,{'tableName':_0x6ca5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ae2=['define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intFreshsalesConfiguration.attributes','exports'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x6ae2,0x1ed));var _0x26ae=function(_0xc6d32b,_0x608367){_0xc6d32b=_0xc6d32b-0x0;var _0x5d773a=_0x6ae2[_0xc6d32b];return _0x5d773a;};'use strict';var _=require(_0x26ae('0x0'));var util=require(_0x26ae('0x1'));var logger=require(_0x26ae('0x2'))(_0x26ae('0x3'));var moment=require(_0x26ae('0x4'));var BPromise=require(_0x26ae('0x5'));var rp=require(_0x26ae('0x6'));var fs=require('fs');var path=require(_0x26ae('0x7'));var rimraf=require(_0x26ae('0x8'));var config=require('../../config/environment');var attributes=require(_0x26ae('0x9'));module[_0x26ae('0xa')]=function(_0x595da8,_0x5609b0){return _0x595da8[_0x26ae('0xb')](_0x26ae('0xc'),attributes,{'tableName':_0x26ae('0xd'),'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 417b50f..e4c9d3b 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 _0x8c11=['rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','stringify','error','code','message','FreshsalesConfiguration,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x5d7738,_0x3f8cfa){var _0x14b96f=function(_0x214f13){while(--_0x214f13){_0x5d7738['push'](_0x5d7738['shift']());}};_0x14b96f(++_0x3f8cfa);}(_0x8c11,0xf5));var _0x18c1=function(_0x4ee79c,_0x44d6ca){_0x4ee79c=_0x4ee79c-0x0;var _0x484362=_0x8c11[_0x4ee79c];return _0x484362;};'use strict';var _=require(_0x18c1('0x0'));var util=require(_0x18c1('0x1'));var moment=require(_0x18c1('0x2'));var BPromise=require(_0x18c1('0x3'));var rs=require(_0x18c1('0x4'));var fs=require('fs');var Redis=require(_0x18c1('0x5'));var db=require(_0x18c1('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x18c1('0x7'))(_0x18c1('0x8'));var config=require(_0x18c1('0x9'));var jayson=require(_0x18c1('0xa'));var client=jayson[_0x18c1('0xb')][_0x18c1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x40bc72,_0x276eb7,_0x54519f){return new BPromise(function(_0x28fc68,_0x1477ca){return client['request'](_0x40bc72,_0x54519f)[_0x18c1('0xd')](function(_0x343480){logger[_0x18c1('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x276eb7,_0x18c1('0xf'));logger['debug']('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x276eb7,_0x18c1('0xf'),JSON[_0x18c1('0x10')](_0x343480));if(_0x343480[_0x18c1('0x11')]){if(_0x343480[_0x18c1('0x11')][_0x18c1('0x12')]===0x1f4){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x276eb7,_0x343480[_0x18c1('0x11')][_0x18c1('0x13')]);return _0x1477ca(_0x343480['error']['message']);}logger[_0x18c1('0x11')](_0x18c1('0x14'),_0x276eb7,_0x343480[_0x18c1('0x11')]['message']);return _0x28fc68(_0x343480['error']['message']);}else{logger[_0x18c1('0xe')](_0x18c1('0x14'),_0x276eb7,_0x18c1('0xf'));_0x28fc68(_0x343480[_0x18c1('0x15')]['message']);}})[_0x18c1('0x16')](function(_0x6306f1){logger[_0x18c1('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x276eb7,_0x6306f1);_0x1477ca(_0x6306f1);});});} \ No newline at end of file +var _0x195e=['info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1e8cc8,_0x4b21c1){var _0x4c339a=function(_0x53e8e0){while(--_0x53e8e0){_0x1e8cc8['push'](_0x1e8cc8['shift']());}};_0x4c339a(++_0x4b21c1);}(_0x195e,0xfb));var _0xe195=function(_0x31b7c4,_0x37d242){_0x31b7c4=_0x31b7c4-0x0;var _0x114598=_0x195e[_0x31b7c4];return _0x114598;};'use strict';var _=require(_0xe195('0x0'));var util=require(_0xe195('0x1'));var moment=require(_0xe195('0x2'));var BPromise=require(_0xe195('0x3'));var rs=require(_0xe195('0x4'));var fs=require('fs');var Redis=require(_0xe195('0x5'));var db=require(_0xe195('0x6'))['db'];var utils=require(_0xe195('0x7'));var logger=require(_0xe195('0x8'))(_0xe195('0x9'));var config=require(_0xe195('0xa'));var jayson=require(_0xe195('0xb'));var client=jayson[_0xe195('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a1acc,_0x663106,_0x2ead59){return new BPromise(function(_0x28c1a9,_0x3164c3){return client['request'](_0x2a1acc,_0x2ead59)['then'](function(_0x5f333b){logger[_0xe195('0xd')](_0xe195('0xe'),_0x663106,_0xe195('0xf'));logger[_0xe195('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x663106,_0xe195('0xf'),JSON[_0xe195('0x11')](_0x5f333b));if(_0x5f333b[_0xe195('0x12')]){if(_0x5f333b['error'][_0xe195('0x13')]===0x1f4){logger[_0xe195('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x663106,_0x5f333b[_0xe195('0x12')][_0xe195('0x14')]);return _0x3164c3(_0x5f333b[_0xe195('0x12')][_0xe195('0x14')]);}logger['error'](_0xe195('0xe'),_0x663106,_0x5f333b[_0xe195('0x12')]['message']);return _0x28c1a9(_0x5f333b['error'][_0xe195('0x14')]);}else{logger['info'](_0xe195('0xe'),_0x663106,'request\x20sent');_0x28c1a9(_0x5f333b['result'][_0xe195('0x14')]);}})[_0xe195('0x15')](function(_0x277362){logger[_0xe195('0x12')](_0xe195('0xe'),_0x663106,_0x277362);_0x3164c3(_0x277362);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 4f56b46..7182c13 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 _0xda02=['put','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x5bc369,_0x59fa6d){var _0x58dbb0=function(_0x27b280){while(--_0x27b280){_0x5bc369['push'](_0x5bc369['shift']());}};_0x58dbb0(++_0x59fa6d);}(_0xda02,0xc9));var _0x2da0=function(_0x146837,_0x2aa6a2){_0x146837=_0x146837-0x0;var _0x3d7e60=_0xda02[_0x146837];return _0x3d7e60;};'use strict';var multer=require(_0x2da0('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2da0('0x1'));var express=require(_0x2da0('0x2'));var router=express[_0x2da0('0x3')]();var auth=require(_0x2da0('0x4'));var interaction=require(_0x2da0('0x5'));var config=require(_0x2da0('0x6'));var controller=require(_0x2da0('0x7'));router[_0x2da0('0x8')]('/',auth[_0x2da0('0x9')](),controller[_0x2da0('0xa')]);router[_0x2da0('0x8')](_0x2da0('0xb'),auth['isAuthenticated'](),controller[_0x2da0('0xc')]);router[_0x2da0('0xd')]('/',auth[_0x2da0('0x9')](),controller[_0x2da0('0xe')]);router[_0x2da0('0xf')](_0x2da0('0xb'),auth[_0x2da0('0x9')](),controller['update']);router[_0x2da0('0x10')](_0x2da0('0xb'),auth[_0x2da0('0x9')](),controller[_0x2da0('0x11')]);module['exports']=router; \ No newline at end of file +var _0x5fc3=['isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller'];(function(_0x57fa33,_0x2b8222){var _0x12e724=function(_0x481a33){while(--_0x481a33){_0x57fa33['push'](_0x57fa33['shift']());}};_0x12e724(++_0x2b8222);}(_0x5fc3,0x147));var _0x35fc=function(_0x1b1e76,_0x31695b){_0x1b1e76=_0x1b1e76-0x0;var _0x3d743a=_0x5fc3[_0x1b1e76];return _0x3d743a;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require(_0x35fc('0x2'));var timeout=require('connect-timeout');var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var auth=require(_0x35fc('0x5'));var interaction=require(_0x35fc('0x6'));var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router['get']('/',auth[_0x35fc('0x9')](),controller[_0x35fc('0xa')]);router[_0x35fc('0xb')](_0x35fc('0xc'),auth[_0x35fc('0x9')](),controller[_0x35fc('0xd')]);router[_0x35fc('0xe')]('/',auth[_0x35fc('0x9')](),controller[_0x35fc('0xf')]);router[_0x35fc('0x10')]('/:id',auth[_0x35fc('0x9')](),controller[_0x35fc('0x11')]);router[_0x35fc('0x12')](_0x35fc('0xc'),auth[_0x35fc('0x9')](),controller[_0x35fc('0x13')]);module[_0x35fc('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index ddd886e..a0ff102 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 _0xd601=['variable','customVariable','STRING','BOOLEAN','exports','ENUM','string'];(function(_0x43b5a7,_0xf5e3d6){var _0x5461fe=function(_0x5d9d5a){while(--_0x5d9d5a){_0x43b5a7['push'](_0x43b5a7['shift']());}};_0x5461fe(++_0xf5e3d6);}(_0xd601,0x17e));var _0x1d60=function(_0x180f82,_0xa7bbd5){_0x180f82=_0x180f82-0x0;var _0x36407e=_0xd601[_0x180f82];return _0x36407e;};'use strict';var Sequelize=require('sequelize');module[_0x1d60('0x0')]={'type':{'type':Sequelize[_0x1d60('0x1')](_0x1d60('0x2'),_0x1d60('0x3'),_0x1d60('0x4'),'keyValue'),'defaultValue':_0x1d60('0x2')},'content':{'type':Sequelize[_0x1d60('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x1d60('0x1')](_0x1d60('0x2'),'variable',_0x1d60('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1d60('0x5')]},'nameField':{'type':Sequelize[_0x1d60('0x5')]},'customField':{'type':Sequelize[_0x1d60('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1d60('0x5')]}}; \ No newline at end of file +var _0x498a=['STRING','customVariable','BOOLEAN','sequelize','exports','string','keyValue'];(function(_0x4947d4,_0x118065){var _0x5e53ea=function(_0x3851e1){while(--_0x3851e1){_0x4947d4['push'](_0x4947d4['shift']());}};_0x5e53ea(++_0x118065);}(_0x498a,0x1bc));var _0xa498=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x498a[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0xa498('0x0'));module[_0xa498('0x1')]={'type':{'type':Sequelize['ENUM'](_0xa498('0x2'),'variable','customVariable',_0xa498('0x3')),'defaultValue':_0xa498('0x2')},'content':{'type':Sequelize[_0xa498('0x4')]},'key':{'type':Sequelize[_0xa498('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0xa498('0x2'),'variable',_0xa498('0x5'))},'keyContent':{'type':Sequelize[_0xa498('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xa498('0x4')]},'customField':{'type':Sequelize[_0xa498('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 76552ef..462111c 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 _0xd3d1=['bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','count','limit','status','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','index','map','FreshsalesField','fieldName','type','key','keys','filters','intersection','query','attributes','model','fields','hasOwnProperty','offset','where','pick','filter','includeAll','include','findAll','catch','show','params','rawAttributes','length','merge','options','find','create','body','html-pdf','eml-format','fast-json-patch','request-promise','moment'];(function(_0x481f9d,_0x5e14d9){var _0x31156d=function(_0x12cb0d){while(--_0x12cb0d){_0x481f9d['push'](_0x481f9d['shift']());}};_0x31156d(++_0x5e14d9);}(_0xd3d1,0x172));var _0x1d3d=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xd3d1[_0x36ed48];return _0x51c63a;};'use strict';var pdf=require(_0x1d3d('0x0'));var emlformat=require(_0x1d3d('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1d3d('0x2'));var rp=require(_0x1d3d('0x3'));var moment=require(_0x1d3d('0x4'));var BPromise=require(_0x1d3d('0x5'));var Mustache=require(_0x1d3d('0x6'));var util=require(_0x1d3d('0x7'));var path=require(_0x1d3d('0x8'));var sox=require(_0x1d3d('0x9'));var csv=require(_0x1d3d('0xa'));var ejs=require(_0x1d3d('0xb'));var fs=require('fs');var _=require(_0x1d3d('0xc'));var squel=require(_0x1d3d('0xd'));var crypto=require(_0x1d3d('0xe'));var jsforce=require(_0x1d3d('0xf'));var deskjs=require(_0x1d3d('0x10'));var toCsv=require(_0x1d3d('0xa'));var querystring=require(_0x1d3d('0x11'));var Papa=require('papaparse');var Redis=require(_0x1d3d('0x12'));var authService=require(_0x1d3d('0x13'));var qs=require(_0x1d3d('0x14'));var as=require(_0x1d3d('0x15'));var hardwareService=require(_0x1d3d('0x16'));var logger=require(_0x1d3d('0x17'))(_0x1d3d('0x18'));var utils=require(_0x1d3d('0x19'));var config=require(_0x1d3d('0x1a'));var db=require(_0x1d3d('0x1b'))['db'];function respondWithStatusCode(_0x29e17e,_0x479216){_0x479216=_0x479216||0xcc;return function(_0xb587d){if(_0xb587d){return _0x29e17e[_0x1d3d('0x1c')](_0x479216);}return _0x29e17e['status'](_0x479216)['end']();};}function respondWithResult(_0x12bd00,_0x2f5b7f){_0x2f5b7f=_0x2f5b7f||0xc8;return function(_0x1a8035){if(_0x1a8035){return _0x12bd00['status'](_0x2f5b7f)[_0x1d3d('0x1d')](_0x1a8035);}};}function respondWithFilteredResult(_0x4dcc22,_0x1d54f3){return function(_0x33e7d9){if(_0x33e7d9){var _0x3491e4=_0x33e7d9[_0x1d3d('0x1e')],_0x24bb8c=_0x1d54f3['offset'],_0x21c2e4=_0x1d54f3['offset']+_0x1d54f3[_0x1d3d('0x1f')],_0x1bdbdc;if(_0x21c2e4>=_0x3491e4){_0x21c2e4=_0x3491e4;_0x1bdbdc=0xc8;}else{_0x1bdbdc=0xce;}_0x4dcc22[_0x1d3d('0x20')](_0x1bdbdc);return _0x4dcc22['set'](_0x1d3d('0x21'),_0x24bb8c+'-'+_0x21c2e4+'/'+_0x3491e4)['json'](_0x33e7d9);}return null;};}function patchUpdates(_0x1eade8){return function(_0x392e92){try{jsonpatch[_0x1d3d('0x22')](_0x392e92,_0x1eade8,!![]);}catch(_0x2d6dfb){return BPromise['reject'](_0x2d6dfb);}return _0x392e92[_0x1d3d('0x23')]();};}function saveUpdates(_0x56db7a,_0x56c424){return function(_0x108005){if(_0x108005){return _0x108005[_0x1d3d('0x24')](_0x56db7a)[_0x1d3d('0x25')](function(_0x344a03){return _0x344a03;});}return null;};}function removeEntity(_0xa6f180,_0xe4afa2){return function(_0x471df5){if(_0x471df5){return _0x471df5[_0x1d3d('0x26')]()[_0x1d3d('0x25')](function(){_0xa6f180[_0x1d3d('0x20')](0xcc)[_0x1d3d('0x27')]();});}};}function handleEntityNotFound(_0x502921,_0xfc3606){return function(_0x72868d){if(!_0x72868d){_0x502921['sendStatus'](0x194);}return _0x72868d;};}function handleError(_0x3639f1,_0x5c52da){_0x5c52da=_0x5c52da||0x1f4;return function(_0x467ea7){logger[_0x1d3d('0x28')](_0x467ea7[_0x1d3d('0x29')]);if(_0x467ea7[_0x1d3d('0x2a')]){delete _0x467ea7[_0x1d3d('0x2a')];}_0x3639f1[_0x1d3d('0x20')](_0x5c52da)[_0x1d3d('0x2b')](_0x467ea7);};}exports[_0x1d3d('0x2c')]=function(_0x2294ee,_0x2df7b7){var _0x172dbd={},_0x4f0aa7={},_0x3f5681={'count':0x0,'rows':[]};var _0x5b2986=_[_0x1d3d('0x2d')](db[_0x1d3d('0x2e')]['rawAttributes'],function(_0x185913){return{'name':_0x185913[_0x1d3d('0x2f')],'type':_0x185913[_0x1d3d('0x30')][_0x1d3d('0x31')]};});_0x4f0aa7['model']=_[_0x1d3d('0x2d')](_0x5b2986,_0x1d3d('0x2a'));_0x4f0aa7['query']=_[_0x1d3d('0x32')](_0x2294ee['query']);_0x4f0aa7[_0x1d3d('0x33')]=_[_0x1d3d('0x34')](_0x4f0aa7['model'],_0x4f0aa7[_0x1d3d('0x35')]);_0x172dbd[_0x1d3d('0x36')]=_[_0x1d3d('0x34')](_0x4f0aa7[_0x1d3d('0x37')],qs[_0x1d3d('0x38')](_0x2294ee[_0x1d3d('0x35')][_0x1d3d('0x38')]));_0x172dbd[_0x1d3d('0x36')]=_0x172dbd[_0x1d3d('0x36')]['length']?_0x172dbd[_0x1d3d('0x36')]:_0x4f0aa7[_0x1d3d('0x37')];if(!_0x2294ee[_0x1d3d('0x35')][_0x1d3d('0x39')]('nolimit')){_0x172dbd['limit']=qs[_0x1d3d('0x1f')](_0x2294ee[_0x1d3d('0x35')]['limit']);_0x172dbd[_0x1d3d('0x3a')]=qs[_0x1d3d('0x3a')](_0x2294ee[_0x1d3d('0x35')][_0x1d3d('0x3a')]);}_0x172dbd['order']=qs['sort'](_0x2294ee[_0x1d3d('0x35')]['sort']);_0x172dbd[_0x1d3d('0x3b')]=qs[_0x1d3d('0x33')](_[_0x1d3d('0x3c')](_0x2294ee[_0x1d3d('0x35')],_0x4f0aa7[_0x1d3d('0x33')]));if(_0x2294ee[_0x1d3d('0x35')][_0x1d3d('0x3d')]){_0x172dbd[_0x1d3d('0x3b')]=_['merge'](_0x172dbd[_0x1d3d('0x3b')],{'$or':_['map'](_0x5b2986,function(_0x58ae8e){if(_0x58ae8e[_0x1d3d('0x30')]!=='VIRTUAL'){var _0x175e8a={};_0x175e8a[_0x58ae8e[_0x1d3d('0x2a')]]={'$like':'%'+_0x2294ee[_0x1d3d('0x35')][_0x1d3d('0x3d')]+'%'};return _0x175e8a;}})});}_0x172dbd=_['merge']({},_0x172dbd,_0x2294ee['options']);var _0x434dad={'where':_0x172dbd['where']};return db[_0x1d3d('0x2e')][_0x1d3d('0x1e')](_0x434dad)['then'](function(_0x1ad7a6){_0x3f5681[_0x1d3d('0x1e')]=_0x1ad7a6;if(_0x2294ee['query'][_0x1d3d('0x3e')]){_0x172dbd[_0x1d3d('0x3f')]=[{'all':!![]}];}return db[_0x1d3d('0x2e')][_0x1d3d('0x40')](_0x172dbd);})[_0x1d3d('0x25')](function(_0x36c713){_0x3f5681['rows']=_0x36c713;return _0x3f5681;})[_0x1d3d('0x25')](respondWithFilteredResult(_0x2df7b7,_0x172dbd))[_0x1d3d('0x41')](handleError(_0x2df7b7,null));};exports[_0x1d3d('0x42')]=function(_0x3941bd,_0x232b62){var _0x5f007e={'raw':!![],'where':{'id':_0x3941bd[_0x1d3d('0x43')]['id']}},_0x327e73={};_0x327e73[_0x1d3d('0x37')]=_[_0x1d3d('0x32')](db['FreshsalesField'][_0x1d3d('0x44')]);_0x327e73[_0x1d3d('0x35')]=_[_0x1d3d('0x32')](_0x3941bd[_0x1d3d('0x35')]);_0x327e73[_0x1d3d('0x33')]=_['intersection'](_0x327e73['model'],_0x327e73[_0x1d3d('0x35')]);_0x5f007e[_0x1d3d('0x36')]=_[_0x1d3d('0x34')](_0x327e73[_0x1d3d('0x37')],qs[_0x1d3d('0x38')](_0x3941bd['query'][_0x1d3d('0x38')]));_0x5f007e['attributes']=_0x5f007e[_0x1d3d('0x36')][_0x1d3d('0x45')]?_0x5f007e[_0x1d3d('0x36')]:_0x327e73[_0x1d3d('0x37')];if(_0x3941bd['query'][_0x1d3d('0x3e')]){_0x5f007e[_0x1d3d('0x3f')]=[{'all':!![]}];}_0x5f007e=_[_0x1d3d('0x46')]({},_0x5f007e,_0x3941bd[_0x1d3d('0x47')]);return db[_0x1d3d('0x2e')][_0x1d3d('0x48')](_0x5f007e)[_0x1d3d('0x25')](handleEntityNotFound(_0x232b62,null))['then'](respondWithResult(_0x232b62,null))[_0x1d3d('0x41')](handleError(_0x232b62,null));};exports['create']=function(_0x160f88,_0x256ecc){return db['FreshsalesField'][_0x1d3d('0x49')](_0x160f88['body'],{})[_0x1d3d('0x25')](respondWithResult(_0x256ecc,0xc9))['catch'](handleError(_0x256ecc,null));};exports[_0x1d3d('0x24')]=function(_0xebd1f4,_0x1dafe8){if(_0xebd1f4[_0x1d3d('0x4a')]['id']){delete _0xebd1f4[_0x1d3d('0x4a')]['id'];}return db[_0x1d3d('0x2e')][_0x1d3d('0x48')]({'where':{'id':_0xebd1f4[_0x1d3d('0x43')]['id']}})['then'](handleEntityNotFound(_0x1dafe8,null))['then'](saveUpdates(_0xebd1f4['body'],null))[_0x1d3d('0x25')](respondWithResult(_0x1dafe8,null))[_0x1d3d('0x41')](handleError(_0x1dafe8,null));};exports[_0x1d3d('0x26')]=function(_0x3856d5,_0x438c61){return db[_0x1d3d('0x2e')]['find']({'where':{'id':_0x3856d5['params']['id']}})['then'](handleEntityNotFound(_0x438c61,null))['then'](removeEntity(_0x438c61,null))[_0x1d3d('0x41')](handleError(_0x438c61,null));}; \ No newline at end of file +var _0xd139=['sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','update','body','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x134d5e,_0x2a47d8){var _0x1e166a=function(_0x53f10d){while(--_0x53f10d){_0x134d5e['push'](_0x134d5e['shift']());}};_0x1e166a(++_0x2a47d8);}(_0xd139,0x14e));var _0x9d13=function(_0x1672b9,_0x39381c){_0x1672b9=_0x1672b9-0x0;var _0x40d185=_0xd139[_0x1672b9];return _0x40d185;};'use strict';var pdf=require(_0x9d13('0x0'));var emlformat=require(_0x9d13('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9d13('0x2'));var rp=require(_0x9d13('0x3'));var moment=require(_0x9d13('0x4'));var BPromise=require(_0x9d13('0x5'));var Mustache=require(_0x9d13('0x6'));var util=require(_0x9d13('0x7'));var path=require(_0x9d13('0x8'));var sox=require('sox');var csv=require(_0x9d13('0x9'));var ejs=require(_0x9d13('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9d13('0xb'));var crypto=require('crypto');var jsforce=require(_0x9d13('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9d13('0xd'));var Redis=require(_0x9d13('0xe'));var authService=require(_0x9d13('0xf'));var qs=require(_0x9d13('0x10'));var as=require(_0x9d13('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9d13('0x12'))(_0x9d13('0x13'));var utils=require(_0x9d13('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22b2f7,_0x3933d1){_0x3933d1=_0x3933d1||0xcc;return function(_0x39020){if(_0x39020){return _0x22b2f7[_0x9d13('0x15')](_0x3933d1);}return _0x22b2f7[_0x9d13('0x16')](_0x3933d1)['end']();};}function respondWithResult(_0x5de53f,_0x37607a){_0x37607a=_0x37607a||0xc8;return function(_0x43bf27){if(_0x43bf27){return _0x5de53f[_0x9d13('0x16')](_0x37607a)[_0x9d13('0x17')](_0x43bf27);}};}function respondWithFilteredResult(_0x235c7f,_0x1a2b65){return function(_0x38f368){if(_0x38f368){var _0x47bcd3=_0x38f368[_0x9d13('0x18')],_0x3acfc1=_0x1a2b65[_0x9d13('0x19')],_0x1b473e=_0x1a2b65[_0x9d13('0x19')]+_0x1a2b65[_0x9d13('0x1a')],_0x16a77b;if(_0x1b473e>=_0x47bcd3){_0x1b473e=_0x47bcd3;_0x16a77b=0xc8;}else{_0x16a77b=0xce;}_0x235c7f[_0x9d13('0x16')](_0x16a77b);return _0x235c7f[_0x9d13('0x1b')](_0x9d13('0x1c'),_0x3acfc1+'-'+_0x1b473e+'/'+_0x47bcd3)[_0x9d13('0x17')](_0x38f368);}return null;};}function patchUpdates(_0x38acaf){return function(_0x46a53d){try{jsonpatch['apply'](_0x46a53d,_0x38acaf,!![]);}catch(_0x42b9c1){return BPromise[_0x9d13('0x1d')](_0x42b9c1);}return _0x46a53d[_0x9d13('0x1e')]();};}function saveUpdates(_0x649908,_0x4e1425){return function(_0x48ce3d){if(_0x48ce3d){return _0x48ce3d['update'](_0x649908)[_0x9d13('0x1f')](function(_0x3706e7){return _0x3706e7;});}return null;};}function removeEntity(_0x204f8a,_0x1fefe4){return function(_0x3971e0){if(_0x3971e0){return _0x3971e0[_0x9d13('0x20')]()[_0x9d13('0x1f')](function(){_0x204f8a[_0x9d13('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb34817,_0xd5a981){return function(_0x22963f){if(!_0x22963f){_0xb34817[_0x9d13('0x15')](0x194);}return _0x22963f;};}function handleError(_0x517003,_0xe02b36){_0xe02b36=_0xe02b36||0x1f4;return function(_0x5203e3){logger[_0x9d13('0x21')](_0x5203e3[_0x9d13('0x22')]);if(_0x5203e3[_0x9d13('0x23')]){delete _0x5203e3[_0x9d13('0x23')];}_0x517003[_0x9d13('0x16')](_0xe02b36)[_0x9d13('0x24')](_0x5203e3);};}exports[_0x9d13('0x25')]=function(_0xb2a42d,_0x5d854e){var _0x2e7fa1={},_0x4edc05={},_0x3600ab={'count':0x0,'rows':[]};var _0x420926=_[_0x9d13('0x26')](db[_0x9d13('0x27')][_0x9d13('0x28')],function(_0x23c91f){return{'name':_0x23c91f[_0x9d13('0x29')],'type':_0x23c91f[_0x9d13('0x2a')][_0x9d13('0x2b')]};});_0x4edc05[_0x9d13('0x2c')]=_[_0x9d13('0x26')](_0x420926,_0x9d13('0x23'));_0x4edc05['query']=_[_0x9d13('0x2d')](_0xb2a42d['query']);_0x4edc05[_0x9d13('0x2e')]=_[_0x9d13('0x2f')](_0x4edc05['model'],_0x4edc05[_0x9d13('0x30')]);_0x2e7fa1[_0x9d13('0x31')]=_['intersection'](_0x4edc05['model'],qs['fields'](_0xb2a42d[_0x9d13('0x30')]['fields']));_0x2e7fa1[_0x9d13('0x31')]=_0x2e7fa1[_0x9d13('0x31')][_0x9d13('0x32')]?_0x2e7fa1['attributes']:_0x4edc05[_0x9d13('0x2c')];if(!_0xb2a42d[_0x9d13('0x30')][_0x9d13('0x33')](_0x9d13('0x34'))){_0x2e7fa1['limit']=qs['limit'](_0xb2a42d[_0x9d13('0x30')][_0x9d13('0x1a')]);_0x2e7fa1['offset']=qs[_0x9d13('0x19')](_0xb2a42d[_0x9d13('0x30')][_0x9d13('0x19')]);}_0x2e7fa1[_0x9d13('0x35')]=qs[_0x9d13('0x36')](_0xb2a42d[_0x9d13('0x30')][_0x9d13('0x36')]);_0x2e7fa1['where']=qs[_0x9d13('0x2e')](_['pick'](_0xb2a42d['query'],_0x4edc05['filters']));if(_0xb2a42d[_0x9d13('0x30')][_0x9d13('0x37')]){_0x2e7fa1[_0x9d13('0x38')]=_[_0x9d13('0x39')](_0x2e7fa1[_0x9d13('0x38')],{'$or':_['map'](_0x420926,function(_0x1a00ba){if(_0x1a00ba[_0x9d13('0x2a')]!==_0x9d13('0x3a')){var _0x2bad38={};_0x2bad38[_0x1a00ba[_0x9d13('0x23')]]={'$like':'%'+_0xb2a42d[_0x9d13('0x30')]['filter']+'%'};return _0x2bad38;}})});}_0x2e7fa1=_[_0x9d13('0x39')]({},_0x2e7fa1,_0xb2a42d[_0x9d13('0x3b')]);var _0x287d0b={'where':_0x2e7fa1['where']};return db['FreshsalesField'][_0x9d13('0x18')](_0x287d0b)[_0x9d13('0x1f')](function(_0x2f96cf){_0x3600ab['count']=_0x2f96cf;if(_0xb2a42d[_0x9d13('0x30')][_0x9d13('0x3c')]){_0x2e7fa1['include']=[{'all':!![]}];}return db[_0x9d13('0x27')][_0x9d13('0x3d')](_0x2e7fa1);})[_0x9d13('0x1f')](function(_0x46ea19){_0x3600ab[_0x9d13('0x3e')]=_0x46ea19;return _0x3600ab;})[_0x9d13('0x1f')](respondWithFilteredResult(_0x5d854e,_0x2e7fa1))[_0x9d13('0x3f')](handleError(_0x5d854e,null));};exports[_0x9d13('0x40')]=function(_0x2a2132,_0x5033b3){var _0x56943={'raw':!![],'where':{'id':_0x2a2132[_0x9d13('0x41')]['id']}},_0x1d2ee6={};_0x1d2ee6[_0x9d13('0x2c')]=_[_0x9d13('0x2d')](db[_0x9d13('0x27')][_0x9d13('0x28')]);_0x1d2ee6['query']=_[_0x9d13('0x2d')](_0x2a2132[_0x9d13('0x30')]);_0x1d2ee6[_0x9d13('0x2e')]=_[_0x9d13('0x2f')](_0x1d2ee6[_0x9d13('0x2c')],_0x1d2ee6[_0x9d13('0x30')]);_0x56943['attributes']=_['intersection'](_0x1d2ee6[_0x9d13('0x2c')],qs['fields'](_0x2a2132[_0x9d13('0x30')]['fields']));_0x56943[_0x9d13('0x31')]=_0x56943[_0x9d13('0x31')][_0x9d13('0x32')]?_0x56943[_0x9d13('0x31')]:_0x1d2ee6[_0x9d13('0x2c')];if(_0x2a2132['query'][_0x9d13('0x3c')]){_0x56943[_0x9d13('0x42')]=[{'all':!![]}];}_0x56943=_[_0x9d13('0x39')]({},_0x56943,_0x2a2132[_0x9d13('0x3b')]);return db[_0x9d13('0x27')][_0x9d13('0x43')](_0x56943)[_0x9d13('0x1f')](handleEntityNotFound(_0x5033b3,null))[_0x9d13('0x1f')](respondWithResult(_0x5033b3,null))[_0x9d13('0x3f')](handleError(_0x5033b3,null));};exports[_0x9d13('0x44')]=function(_0x56ef0f,_0x54446e){return db[_0x9d13('0x27')][_0x9d13('0x44')](_0x56ef0f['body'],{})[_0x9d13('0x1f')](respondWithResult(_0x54446e,0xc9))['catch'](handleError(_0x54446e,null));};exports[_0x9d13('0x45')]=function(_0x20b834,_0x503850){if(_0x20b834['body']['id']){delete _0x20b834[_0x9d13('0x46')]['id'];}return db[_0x9d13('0x27')][_0x9d13('0x43')]({'where':{'id':_0x20b834[_0x9d13('0x41')]['id']}})[_0x9d13('0x1f')](handleEntityNotFound(_0x503850,null))[_0x9d13('0x1f')](saveUpdates(_0x20b834[_0x9d13('0x46')],null))[_0x9d13('0x1f')](respondWithResult(_0x503850,null))[_0x9d13('0x3f')](handleError(_0x503850,null));};exports['destroy']=function(_0x3a2177,_0x5b0c6e){return db['FreshsalesField'][_0x9d13('0x43')]({'where':{'id':_0x3a2177['params']['id']}})[_0x9d13('0x1f')](handleEntityNotFound(_0x5b0c6e,null))[_0x9d13('0x1f')](removeEntity(_0x5b0c6e,null))[_0x9d13('0x3f')](handleError(_0x5b0c6e,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 3a40879..9637479 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 _0x5cd1=['bluebird','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','FreshsalesField','int_freshsales_fields','freshsales_unique_index','FieldId','lodash','util','../../config/logger'];(function(_0x3e9b64,_0x240cf1){var _0x3ee1fe=function(_0x3d81ff){while(--_0x3d81ff){_0x3e9b64['push'](_0x3e9b64['shift']());}};_0x3ee1fe(++_0x240cf1);}(_0x5cd1,0x72));var _0x15cd=function(_0x4c22fc,_0x14342d){_0x4c22fc=_0x4c22fc-0x0;var _0x44196a=_0x5cd1[_0x4c22fc];return _0x44196a;};'use strict';var _=require(_0x15cd('0x0'));var util=require(_0x15cd('0x1'));var logger=require(_0x15cd('0x2'))('api');var moment=require('moment');var BPromise=require(_0x15cd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x15cd('0x4'));var rimraf=require(_0x15cd('0x5'));var config=require(_0x15cd('0x6'));var attributes=require(_0x15cd('0x7'));module[_0x15cd('0x8')]=function(_0x36bf51,_0x5e0348){return _0x36bf51['define'](_0x15cd('0x9'),attributes,{'tableName':_0x15cd('0xa'),'paranoid':![],'indexes':[{'name':_0x15cd('0xb'),'fields':['idField',_0x15cd('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x70d2=['bluebird','request-promise','path','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','util','moment'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x70d2,0x93));var _0x270d=function(_0x3585e5,_0x1033c2){_0x3585e5=_0x3585e5-0x0;var _0x32ae8e=_0x70d2[_0x3585e5];return _0x32ae8e;};'use strict';var _=require(_0x270d('0x0'));var util=require(_0x270d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x270d('0x2'));var BPromise=require(_0x270d('0x3'));var rp=require(_0x270d('0x4'));var fs=require('fs');var path=require(_0x270d('0x5'));var rimraf=require('rimraf');var config=require(_0x270d('0x6'));var attributes=require(_0x270d('0x7'));module[_0x270d('0x8')]=function(_0x478dd3,_0x1e10ea){return _0x478dd3[_0x270d('0x9')](_0x270d('0xa'),attributes,{'tableName':_0x270d('0xb'),'paranoid':![],'indexes':[{'name':_0x270d('0xc'),'fields':[_0x270d('0xd'),_0x270d('0xe')],'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 51381ad..274945d 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 _0x19a2=['code','message','info','request\x20sent','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','FreshsalesField,\x20%s,\x20%s','debug','stringify','error'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x19a2,0x124));var _0x219a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x19a2[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x219a('0x0'));var util=require('util');var moment=require(_0x219a('0x1'));var BPromise=require(_0x219a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x219a('0x3'));var db=require(_0x219a('0x4'))['db'];var utils=require(_0x219a('0x5'));var logger=require(_0x219a('0x6'))(_0x219a('0x7'));var config=require(_0x219a('0x8'));var jayson=require(_0x219a('0x9'));var client=jayson['client'][_0x219a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8d395f,_0x405a27,_0x295039){return new BPromise(function(_0x5c80e8,_0x65cb38){return client['request'](_0x8d395f,_0x295039)[_0x219a('0xb')](function(_0x21dd1c){logger['info'](_0x219a('0xc'),_0x405a27,'request\x20sent');logger[_0x219a('0xd')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x405a27,'request\x20sent',JSON[_0x219a('0xe')](_0x21dd1c));if(_0x21dd1c[_0x219a('0xf')]){if(_0x21dd1c[_0x219a('0xf')][_0x219a('0x10')]===0x1f4){logger['error']('FreshsalesField,\x20%s,\x20%s',_0x405a27,_0x21dd1c[_0x219a('0xf')][_0x219a('0x11')]);return _0x65cb38(_0x21dd1c[_0x219a('0xf')][_0x219a('0x11')]);}logger['error'](_0x219a('0xc'),_0x405a27,_0x21dd1c[_0x219a('0xf')][_0x219a('0x11')]);return _0x5c80e8(_0x21dd1c[_0x219a('0xf')][_0x219a('0x11')]);}else{logger[_0x219a('0x12')]('FreshsalesField,\x20%s,\x20%s',_0x405a27,_0x219a('0x13'));_0x5c80e8(_0x21dd1c[_0x219a('0x14')]['message']);}})[_0x219a('0x15')](function(_0x3d2c41){logger[_0x219a('0xf')](_0x219a('0xc'),_0x405a27,_0x3d2c41);_0x65cb38(_0x3d2c41);});});} \ No newline at end of file +var _0x555f=['error','code','message','result','catch','lodash','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s'];(function(_0xe1a3a5,_0xd3e341){var _0x362646=function(_0xdcef03){while(--_0xdcef03){_0xe1a3a5['push'](_0xe1a3a5['shift']());}};_0x362646(++_0xd3e341);}(_0x555f,0x1e0));var _0xf555=function(_0x5d6270,_0x83b57a){_0x5d6270=_0x5d6270-0x0;var _0x168f26=_0x555f[_0x5d6270];return _0x168f26;};'use strict';var _=require(_0xf555('0x0'));var util=require('util');var moment=require(_0xf555('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf555('0x2'));var db=require(_0xf555('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf555('0x4'));var config=require(_0xf555('0x5'));var jayson=require(_0xf555('0x6'));var client=jayson['client'][_0xf555('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xc5080c,_0x3d4795,_0x3f9c15){return new BPromise(function(_0x8685b9,_0x31ea83){return client[_0xf555('0x8')](_0xc5080c,_0x3f9c15)['then'](function(_0x52c540){logger[_0xf555('0x9')](_0xf555('0xa'),_0x3d4795,_0xf555('0xb'));logger[_0xf555('0xc')](_0xf555('0xd'),_0x3d4795,_0xf555('0xb'),JSON['stringify'](_0x52c540));if(_0x52c540[_0xf555('0xe')]){if(_0x52c540[_0xf555('0xe')][_0xf555('0xf')]===0x1f4){logger['error']('FreshsalesField,\x20%s,\x20%s',_0x3d4795,_0x52c540[_0xf555('0xe')]['message']);return _0x31ea83(_0x52c540[_0xf555('0xe')][_0xf555('0x10')]);}logger['error'](_0xf555('0xa'),_0x3d4795,_0x52c540['error']['message']);return _0x8685b9(_0x52c540['error'][_0xf555('0x10')]);}else{logger[_0xf555('0x9')]('FreshsalesField,\x20%s,\x20%s',_0x3d4795,_0xf555('0xb'));_0x8685b9(_0x52c540[_0xf555('0x11')][_0xf555('0x10')]);}})[_0xf555('0x12')](function(_0x446361){logger[_0xf555('0xe')](_0xf555('0xa'),_0x3d4795,_0x446361);_0x31ea83(_0x446361);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 93a9cc1..a2e8555 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 _0x1974=['addConfiguration','update','delete','destroy','exports','path','express','Router','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x1974,0x1d3));var _0x4197=function(_0x3c8df7,_0x7418e8){_0x3c8df7=_0x3c8df7-0x0;var _0x2d88c8=_0x1974[_0x3c8df7];return _0x2d88c8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4197('0x0'));var timeout=require('connect-timeout');var express=require(_0x4197('0x1'));var router=express[_0x4197('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x4197('0x3'));var config=require(_0x4197('0x4'));var controller=require(_0x4197('0x5'));router[_0x4197('0x6')]('/',auth[_0x4197('0x7')](),controller[_0x4197('0x8')]);router[_0x4197('0x6')](_0x4197('0x9'),auth[_0x4197('0x7')](),controller[_0x4197('0xa')]);router['get']('/:id/configurations',auth[_0x4197('0x7')](),controller[_0x4197('0xb')]);router[_0x4197('0x6')](_0x4197('0xc'),auth[_0x4197('0x7')](),controller[_0x4197('0xd')]);router[_0x4197('0xe')]('/',auth['isAuthenticated'](),controller[_0x4197('0xf')]);router[_0x4197('0xe')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x4197('0x10')]);router['put'](_0x4197('0x9'),auth[_0x4197('0x7')](),controller[_0x4197('0x11')]);router[_0x4197('0x12')](_0x4197('0x9'),auth[_0x4197('0x7')](),controller[_0x4197('0x13')]);module[_0x4197('0x14')]=router; \ No newline at end of file +var _0x1b8c=['addConfiguration','put','update','exports','multer','path','Router','../../components/auth/service','../../config/environment','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x1b8c,0x130));var _0xc1b8=function(_0x4ba77a,_0x26a598){_0x4ba77a=_0x4ba77a-0x0;var _0x2c2410=_0x1b8c[_0x4ba77a];return _0x2c2410;};'use strict';var multer=require(_0xc1b8('0x0'));var util=require('util');var path=require(_0xc1b8('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc1b8('0x2')]();var auth=require(_0xc1b8('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xc1b8('0x4'));var controller=require(_0xc1b8('0x5'));router[_0xc1b8('0x6')]('/',auth[_0xc1b8('0x7')](),controller[_0xc1b8('0x8')]);router[_0xc1b8('0x6')](_0xc1b8('0x9'),auth['isAuthenticated'](),controller[_0xc1b8('0xa')]);router[_0xc1b8('0x6')](_0xc1b8('0xb'),auth['isAuthenticated'](),controller[_0xc1b8('0xc')]);router[_0xc1b8('0x6')](_0xc1b8('0xd'),auth[_0xc1b8('0x7')](),controller['getFields']);router[_0xc1b8('0xe')]('/',auth[_0xc1b8('0x7')](),controller[_0xc1b8('0xf')]);router[_0xc1b8('0xe')](_0xc1b8('0xb'),auth['isAuthenticated'](),controller[_0xc1b8('0x10')]);router[_0xc1b8('0x11')](_0xc1b8('0x9'),auth['isAuthenticated'](),controller[_0xc1b8('0x12')]);router['delete'](_0xc1b8('0x9'),auth[_0xc1b8('0x7')](),controller['destroy']);module[_0xc1b8('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 27eb3bf..24a77ab 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 _0x53ec=['ENUM','newTab','integrationTab','sequelize','exports','STRING','username'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x53ec,0x192));var _0xc53e=function(_0x2d7c67,_0x358a79){_0x2d7c67=_0x2d7c67-0x0;var _0x523bd4=_0x53ec[_0x2d7c67];return _0x523bd4;};'use strict';var Sequelize=require(_0xc53e('0x0'));module[_0xc53e('0x1')]={'name':{'type':Sequelize[_0xc53e('0x2')]},'description':{'type':Sequelize[_0xc53e('0x2')]},'username':{'type':Sequelize[_0xc53e('0x2')],'unique':_0xc53e('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xc53e('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xc53e('0x2')]},'securityToken':{'type':Sequelize[_0xc53e('0x2')]},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xc53e('0x4')]('integrationTab',_0xc53e('0x5')),'defaultValue':_0xc53e('0x6')}}; \ No newline at end of file +var _0x53ec=['ENUM','newTab','integrationTab','sequelize','exports','STRING','username'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x53ec,0x192));var _0xc53e=function(_0x72c194,_0x1a953a){_0x72c194=_0x72c194-0x0;var _0x1f4f68=_0x53ec[_0x72c194];return _0x1f4f68;};'use strict';var Sequelize=require(_0xc53e('0x0'));module[_0xc53e('0x1')]={'name':{'type':Sequelize[_0xc53e('0x2')]},'description':{'type':Sequelize[_0xc53e('0x2')]},'username':{'type':Sequelize[_0xc53e('0x2')],'unique':_0xc53e('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xc53e('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xc53e('0x2')]},'securityToken':{'type':Sequelize[_0xc53e('0x2')]},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xc53e('0x4')]('integrationTab',_0xc53e('0x5')),'defaultValue':_0xc53e('0x6')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 87c25cb..b8d61ad 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 _0xc4aa=['concat','isNil','ticketType','sobject','describe','CallDurationInSeconds','CallObject','CallType','IsArchived','Status','Case','Type','Reason','Priority','IsEscalated','SuppliedName','SuppliedCompany','remove','custom','includes','picklistValues','label','value','True','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','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','../../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','SalesforceAccount,\x20%s,\x20%s','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','set','Content-Range','json','save','update','destroy','name','send','index','map','rawAttributes','fieldName','key','model','query','attributes','intersection','fields','length','nolimit','limit','order','sort','where','filters','pick','type','VIRTUAL','filter','merge','options','SalesforceAccount','include','findAll','params','keys','includeAll','find','create','body','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','getSubjects','getDescriptions','SalesforceField','Descriptions','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','Connection','login'];(function(_0x2206a9,_0x3a8674){var _0x5d14d2=function(_0x4480d2){while(--_0x4480d2){_0x2206a9['push'](_0x2206a9['shift']());}};_0x5d14d2(++_0x3a8674);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xc4aa[_0x17b6e3];return _0x3906f3;};'use strict';var pdf=require(_0xac4a('0x0'));var emlformat=require(_0xac4a('0x1'));var rimraf=require(_0xac4a('0x2'));var zipdir=require(_0xac4a('0x3'));var jsonpatch=require(_0xac4a('0x4'));var rp=require(_0xac4a('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xac4a('0x6'));var path=require(_0xac4a('0x7'));var sox=require(_0xac4a('0x8'));var csv=require(_0xac4a('0x9'));var ejs=require(_0xac4a('0xa'));var fs=require('fs');var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x9'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var db=require(_0xac4a('0x15'))['db'];var integrations=require(_0xac4a('0x16'));var jayson=require(_0xac4a('0x17'));var client=jayson['client'][_0xac4a('0x18')]({'port':0x232a});function checkPasswordPattern(_0x68424a,_0x247b78,_0x6e00d4){if(_0x6e00d4){var _0x1b4313=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1b4313[_0xac4a('0x19')](_0x247b78)){return _0x68424a;}else{throw new db[(_0xac4a('0x1a'))][(_0xac4a('0x1b'))](_0xac4a('0x1c'));}}else{return _0x68424a;}}function respondWithRpcPromise(_0x42c7fc,_0x11e101,_0x26dbb8,_0x4a2119){return new BPromise(function(_0x402fff,_0x34d797){var _0x23eb66=_0x4a2119||client;return _0x23eb66[_0xac4a('0x1d')](_0x42c7fc,_0x26dbb8)[_0xac4a('0x1e')](function(_0x387a54){logger[_0xac4a('0x1f')](_0xac4a('0x20'),_0x11e101,'request\x20sent');logger['debug'](_0xac4a('0x21'),_0x11e101,_0xac4a('0x22'),JSON[_0xac4a('0x23')](_0x387a54));if(_0x387a54['error']){if(_0x387a54[_0xac4a('0x24')][_0xac4a('0x25')]===0x1f4){logger[_0xac4a('0x24')](_0xac4a('0x20'),_0x11e101,_0x387a54[_0xac4a('0x24')][_0xac4a('0x26')]);return _0x34d797(_0x387a54[_0xac4a('0x24')][_0xac4a('0x26')]);}logger['error'](_0xac4a('0x20'),_0x11e101,_0x387a54[_0xac4a('0x24')]['message']);return _0x402fff(_0x387a54[_0xac4a('0x24')][_0xac4a('0x26')]);}else{logger[_0xac4a('0x1f')](_0xac4a('0x20'),_0x11e101,'request\x20sent');_0x402fff(_0x387a54[_0xac4a('0x27')][_0xac4a('0x26')]);}})[_0xac4a('0x28')](function(_0x412494){logger[_0xac4a('0x24')](_0xac4a('0x20'),_0x11e101,_0x412494);_0x34d797(_0x412494);});});}function respondWithStatusCode(_0x222507,_0x36054a){_0x36054a=_0x36054a||0xcc;return function(_0x3e2c69){if(_0x3e2c69){return _0x222507[_0xac4a('0x29')](_0x36054a);}return _0x222507[_0xac4a('0x2a')](_0x36054a)[_0xac4a('0x2b')]();};}function respondWithResult(_0x14832b,_0x472c57){_0x472c57=_0x472c57||0xc8;return function(_0x1c13dc){if(_0x1c13dc){return _0x14832b[_0xac4a('0x2a')](_0x472c57)['json'](_0x1c13dc);}};}function respondWithFilteredResult(_0x23b061,_0x267a22){return function(_0x42a33c){if(_0x42a33c){var _0x2772fe=_0x42a33c[_0xac4a('0x2c')],_0x116700=_0x267a22[_0xac4a('0x2d')],_0x4a5a9e=_0x267a22[_0xac4a('0x2d')]+_0x267a22['limit'],_0x47f49c;if(_0x4a5a9e>=_0x2772fe){_0x4a5a9e=_0x2772fe;_0x47f49c=0xc8;}else{_0x47f49c=0xce;}_0x23b061['status'](_0x47f49c);return _0x23b061[_0xac4a('0x2e')](_0xac4a('0x2f'),_0x116700+'-'+_0x4a5a9e+'/'+_0x2772fe)[_0xac4a('0x30')](_0x42a33c);}return null;};}function patchUpdates(_0x432066){return function(_0x17118e){try{jsonpatch['apply'](_0x17118e,_0x432066,!![]);}catch(_0x6dcc7f){return BPromise['reject'](_0x6dcc7f);}return _0x17118e[_0xac4a('0x31')]();};}function saveUpdates(_0x57adcf,_0x17e6de){return function(_0xfbe355){if(_0xfbe355){return _0xfbe355[_0xac4a('0x32')](_0x57adcf)[_0xac4a('0x1e')](function(_0x34577f){return _0x34577f;});}return null;};}function removeEntity(_0x61e552,_0xbd4591){return function(_0x1f13f3){if(_0x1f13f3){return _0x1f13f3[_0xac4a('0x33')]()[_0xac4a('0x1e')](function(){_0x61e552[_0xac4a('0x2a')](0xcc)[_0xac4a('0x2b')]();});}};}function handleEntityNotFound(_0x1a9be2,_0x1a9d4e){return function(_0x5634e2){if(!_0x5634e2){_0x1a9be2[_0xac4a('0x29')](0x194);}return _0x5634e2;};}function handleError(_0x1c41fb,_0x5a4e2b){_0x5a4e2b=_0x5a4e2b||0x1f4;return function(_0x2a5419){logger[_0xac4a('0x24')](_0x2a5419['stack']);if(_0x2a5419['name']){delete _0x2a5419[_0xac4a('0x34')];}_0x1c41fb[_0xac4a('0x2a')](_0x5a4e2b)[_0xac4a('0x35')](_0x2a5419);};}exports[_0xac4a('0x36')]=function(_0x4f5986,_0x453d02){var _0x2e56c6={},_0x4e7630={},_0x37f2ee={'count':0x0,'rows':[]};var _0x34f55c=_[_0xac4a('0x37')](db['SalesforceAccount'][_0xac4a('0x38')],function(_0x357f06){return{'name':_0x357f06[_0xac4a('0x39')],'type':_0x357f06['type'][_0xac4a('0x3a')]};});_0x4e7630[_0xac4a('0x3b')]=_['map'](_0x34f55c,'name');_0x4e7630[_0xac4a('0x3c')]=_['keys'](_0x4f5986['query']);_0x4e7630['filters']=_['intersection'](_0x4e7630[_0xac4a('0x3b')],_0x4e7630[_0xac4a('0x3c')]);_0x2e56c6[_0xac4a('0x3d')]=_[_0xac4a('0x3e')](_0x4e7630[_0xac4a('0x3b')],qs[_0xac4a('0x3f')](_0x4f5986[_0xac4a('0x3c')][_0xac4a('0x3f')]));_0x2e56c6[_0xac4a('0x3d')]=_0x2e56c6[_0xac4a('0x3d')][_0xac4a('0x40')]?_0x2e56c6[_0xac4a('0x3d')]:_0x4e7630['model'];if(!_0x4f5986['query']['hasOwnProperty'](_0xac4a('0x41'))){_0x2e56c6[_0xac4a('0x42')]=qs[_0xac4a('0x42')](_0x4f5986[_0xac4a('0x3c')][_0xac4a('0x42')]);_0x2e56c6[_0xac4a('0x2d')]=qs[_0xac4a('0x2d')](_0x4f5986[_0xac4a('0x3c')][_0xac4a('0x2d')]);}_0x2e56c6[_0xac4a('0x43')]=qs['sort'](_0x4f5986[_0xac4a('0x3c')][_0xac4a('0x44')]);_0x2e56c6[_0xac4a('0x45')]=qs[_0xac4a('0x46')](_[_0xac4a('0x47')](_0x4f5986['query'],_0x4e7630[_0xac4a('0x46')]));if(_0x4f5986[_0xac4a('0x3c')]['filter']){_0x2e56c6[_0xac4a('0x45')]=_['merge'](_0x2e56c6[_0xac4a('0x45')],{'$or':_[_0xac4a('0x37')](_0x34f55c,function(_0xe5ee0f){if(_0xe5ee0f[_0xac4a('0x48')]!==_0xac4a('0x49')){var _0x463f01={};_0x463f01[_0xe5ee0f[_0xac4a('0x34')]]={'$like':'%'+_0x4f5986[_0xac4a('0x3c')][_0xac4a('0x4a')]+'%'};return _0x463f01;}})});}_0x2e56c6=_[_0xac4a('0x4b')]({},_0x2e56c6,_0x4f5986[_0xac4a('0x4c')]);var _0x3b68b3={'where':_0x2e56c6['where']};return db[_0xac4a('0x4d')][_0xac4a('0x2c')](_0x3b68b3)[_0xac4a('0x1e')](function(_0x58759a){_0x37f2ee[_0xac4a('0x2c')]=_0x58759a;if(_0x4f5986[_0xac4a('0x3c')]['includeAll']){_0x2e56c6[_0xac4a('0x4e')]=[{'all':!![]}];}return db['SalesforceAccount'][_0xac4a('0x4f')](_0x2e56c6);})[_0xac4a('0x1e')](function(_0x136a65){_0x37f2ee['rows']=_0x136a65;return _0x37f2ee;})['then'](respondWithFilteredResult(_0x453d02,_0x2e56c6))[_0xac4a('0x28')](handleError(_0x453d02,null));};exports['show']=function(_0x18ae96,_0x566258){var _0x3d2aaf={'raw':![],'where':{'id':_0x18ae96[_0xac4a('0x50')]['id']}},_0x530bbb={};_0x530bbb[_0xac4a('0x3b')]=_[_0xac4a('0x51')](db[_0xac4a('0x4d')]['rawAttributes']);_0x530bbb[_0xac4a('0x3c')]=_[_0xac4a('0x51')](_0x18ae96[_0xac4a('0x3c')]);_0x530bbb[_0xac4a('0x46')]=_[_0xac4a('0x3e')](_0x530bbb[_0xac4a('0x3b')],_0x530bbb[_0xac4a('0x3c')]);_0x3d2aaf['attributes']=_[_0xac4a('0x3e')](_0x530bbb[_0xac4a('0x3b')],qs['fields'](_0x18ae96[_0xac4a('0x3c')][_0xac4a('0x3f')]));_0x3d2aaf[_0xac4a('0x3d')]=_0x3d2aaf[_0xac4a('0x3d')]['length']?_0x3d2aaf[_0xac4a('0x3d')]:_0x530bbb[_0xac4a('0x3b')];if(_0x18ae96[_0xac4a('0x3c')][_0xac4a('0x52')]){_0x3d2aaf[_0xac4a('0x4e')]=[{'all':!![]}];}_0x3d2aaf=_['merge']({},_0x3d2aaf,_0x18ae96[_0xac4a('0x4c')]);return db['SalesforceAccount'][_0xac4a('0x53')](_0x3d2aaf)[_0xac4a('0x1e')](handleEntityNotFound(_0x566258,null))['then'](respondWithResult(_0x566258,null))['catch'](handleError(_0x566258,null));};exports[_0xac4a('0x54')]=function(_0x70fdc3,_0x4d448f){return db[_0xac4a('0x4d')][_0xac4a('0x54')](_0x70fdc3[_0xac4a('0x55')],{})[_0xac4a('0x1e')](respondWithResult(_0x4d448f,0xc9))['catch'](handleError(_0x4d448f,null));};exports[_0xac4a('0x32')]=function(_0x108f7c,_0xb43fdb){if(_0x108f7c[_0xac4a('0x55')]['id']){delete _0x108f7c[_0xac4a('0x55')]['id'];}return db[_0xac4a('0x4d')][_0xac4a('0x53')]({'where':{'id':_0x108f7c['params']['id']}})[_0xac4a('0x1e')](handleEntityNotFound(_0xb43fdb,null))[_0xac4a('0x1e')](saveUpdates(_0x108f7c[_0xac4a('0x55')],null))[_0xac4a('0x1e')](respondWithResult(_0xb43fdb,null))[_0xac4a('0x28')](handleError(_0xb43fdb,null));};exports[_0xac4a('0x33')]=function(_0x213df2,_0x236f57){return db[_0xac4a('0x4d')][_0xac4a('0x53')]({'where':{'id':_0x213df2[_0xac4a('0x50')]['id']}})[_0xac4a('0x1e')](handleEntityNotFound(_0x236f57,null))[_0xac4a('0x1e')](removeEntity(_0x236f57,null))[_0xac4a('0x28')](handleError(_0x236f57,null));};exports[_0xac4a('0x56')]=function(_0x11c753,_0x492aae,_0x13a577){var _0x479ebc={};var _0x2d598e={};var _0x4b7f79;var _0x2a30e8;return db['SalesforceAccount'][_0xac4a('0x57')]({'where':{'id':_0x11c753['params']['id']}})['then'](handleEntityNotFound(_0x492aae,null))[_0xac4a('0x1e')](function(_0x568ffb){if(_0x568ffb){_0x4b7f79=_0x568ffb;_0x2d598e[_0xac4a('0x3b')]=_[_0xac4a('0x51')](db[_0xac4a('0x58')][_0xac4a('0x38')]);_0x2d598e['query']=_[_0xac4a('0x51')](_0x11c753['query']);_0x2d598e[_0xac4a('0x46')]=_['intersection'](_0x2d598e[_0xac4a('0x3b')],_0x2d598e[_0xac4a('0x3c')]);_0x479ebc[_0xac4a('0x3d')]=_[_0xac4a('0x3e')](_0x2d598e[_0xac4a('0x3b')],qs[_0xac4a('0x3f')](_0x11c753[_0xac4a('0x3c')][_0xac4a('0x3f')]));_0x479ebc[_0xac4a('0x3d')]=_0x479ebc[_0xac4a('0x3d')][_0xac4a('0x40')]?_0x479ebc[_0xac4a('0x3d')]:_0x2d598e[_0xac4a('0x3b')];_0x479ebc[_0xac4a('0x43')]=qs[_0xac4a('0x44')](_0x11c753[_0xac4a('0x3c')][_0xac4a('0x44')]);_0x479ebc['where']=qs[_0xac4a('0x46')](_[_0xac4a('0x47')](_0x11c753['query'],_0x2d598e[_0xac4a('0x46')]));if(_0x11c753[_0xac4a('0x3c')][_0xac4a('0x4a')]){_0x479ebc[_0xac4a('0x45')]=_[_0xac4a('0x4b')](_0x479ebc['where'],{'$or':_['map'](_0x479ebc[_0xac4a('0x3d')],function(_0x11bb54){var _0x158223={};_0x158223[_0x11bb54]={'$like':'%'+_0x11c753[_0xac4a('0x3c')][_0xac4a('0x4a')]+'%'};return _0x158223;})});}_0x479ebc=_[_0xac4a('0x4b')]({},_0x479ebc,_0x11c753[_0xac4a('0x4c')]);return _0x4b7f79[_0xac4a('0x56')](_0x479ebc);}})[_0xac4a('0x1e')](function(_0x295f21){if(_0x295f21){_0x2a30e8=_0x295f21[_0xac4a('0x40')];if(!_0x11c753['query']['hasOwnProperty'](_0xac4a('0x41'))){_0x479ebc[_0xac4a('0x42')]=qs[_0xac4a('0x42')](_0x11c753[_0xac4a('0x3c')][_0xac4a('0x42')]);_0x479ebc[_0xac4a('0x2d')]=qs[_0xac4a('0x2d')](_0x11c753[_0xac4a('0x3c')][_0xac4a('0x2d')]);}return _0x4b7f79[_0xac4a('0x56')](_0x479ebc);}})[_0xac4a('0x1e')](function(_0xb12cc5){if(_0xb12cc5){return _0xb12cc5?{'count':_0x2a30e8,'rows':_0xb12cc5}:null;}})['then'](respondWithResult(_0x492aae,null))[_0xac4a('0x28')](handleError(_0x492aae,null));};exports[_0xac4a('0x59')]=function(_0x26bd31,_0x231932,_0x513976){if(_0x26bd31[_0xac4a('0x55')]['id']){delete _0x26bd31['body']['id'];}return db[_0xac4a('0x4d')][_0xac4a('0x57')]({'where':{'id':_0x26bd31['params']['id']}})['then'](handleEntityNotFound(_0x231932,null))[_0xac4a('0x1e')](function(_0x3b8974){if(_0x3b8974){_0x26bd31[_0xac4a('0x55')]['AccountId']=_0x3b8974['id'];_0x26bd31[_0xac4a('0x55')]['Subjects']=integrations[_0xac4a('0x5a')](_0x26bd31['body']['channel'],_0x26bd31[_0xac4a('0x55')]['type']);_0x26bd31[_0xac4a('0x55')]['Descriptions']=integrations[_0xac4a('0x5b')](_0x26bd31[_0xac4a('0x55')]['channel'],_0x26bd31[_0xac4a('0x55')]['type']);return db[_0xac4a('0x58')][_0xac4a('0x54')](_0x26bd31['body'],{'include':[{'model':db[_0xac4a('0x5c')],'as':'Subjects'},{'model':db['SalesforceField'],'as':_0xac4a('0x5d')}]});}return null;})['then'](respondWithResult(_0x231932,null))[_0xac4a('0x28')](handleError(_0x231932,null));};exports['getFields']=function(_0x4ccd67,_0x1588e2,_0x4065c0){var _0x3bec8a;var _0x54c063='';var _0x504256=_0xac4a('0x5e');return db[_0xac4a('0x4d')]['findOne']({'where':{'id':_0x4ccd67['params']['id']},'attributes':['id',_0xac4a('0x5f'),_0xac4a('0x60'),_0xac4a('0x61'),_0xac4a('0x62'),_0xac4a('0x63'),_0xac4a('0x64')]})[_0xac4a('0x1e')](handleEntityNotFound(_0x1588e2,null))[_0xac4a('0x1e')](function(_0x26bf73){if(_0x26bf73){_0x54c063=_0x26bf73['remoteUri'];var _0x1201e8=_0x54c063[_0xac4a('0x65')](-0x1);if(_0x1201e8==='/'){_0x54c063=_0x54c063[_0xac4a('0x66')](0x0,_0x54c063['lastIndexOf'](_0x1201e8));}_0x3bec8a=new jsforce[(_0xac4a('0x67'))]({'oauth2':{'loginUrl':_0x54c063,'clientId':_0x26bf73[_0xac4a('0x60')],'clientSecret':_0x26bf73[_0xac4a('0x61')]}});return _0x3bec8a[_0xac4a('0x68')](_0x26bf73[_0xac4a('0x62')],_0x26bf73['password'][_0xac4a('0x69')](_0x26bf73[_0xac4a('0x64')]));}})[_0xac4a('0x1e')](function(_0x37e519){if(_0x37e519){if(!_[_0xac4a('0x6a')](_0x4ccd67[_0xac4a('0x3c')][_0xac4a('0x6b')])){_0x504256=_0x4ccd67['query'][_0xac4a('0x6b')];}return _0x3bec8a[_0xac4a('0x6c')](_0x504256)[_0xac4a('0x6d')]();}})[_0xac4a('0x1e')](function(_0x1bb24d){var _0x171c47=['CallDisposition',_0xac4a('0x6e'),_0xac4a('0x6f'),_0xac4a('0x70'),_0xac4a('0x71'),'Priority',_0xac4a('0x72'),'Type'];if(!_[_0xac4a('0x6a')](_0x4ccd67[_0xac4a('0x3c')]['ticketType'])&&_0x4ccd67['query'][_0xac4a('0x6b')]===_0xac4a('0x73')){_0x171c47=[_0xac4a('0x74'),'Origin',_0xac4a('0x75'),'Status',_0xac4a('0x76'),_0xac4a('0x77'),_0xac4a('0x78'),_0xac4a('0x79')];}if(_0x1bb24d){_[_0xac4a('0x7a')](_0x1bb24d['fields'],function(_0x50f471){return _0x50f471[_0xac4a('0x7b')]===![]&&!_0x171c47[_0xac4a('0x7c')](_0x50f471[_0xac4a('0x34')]);});return{'count':_0x1bb24d[_0xac4a('0x3f')][_0xac4a('0x40')],'rows':_[_0xac4a('0x37')](_0x1bb24d[_0xac4a('0x3f')],function(_0x186410){return{'id':_0x186410['name'],'name':_0x186410['label'],'custom':_0x186410[_0xac4a('0x7b')],'options':_0x186410[_0xac4a('0x7d')][_0xac4a('0x40')]>0x0?_[_0xac4a('0x37')](_0x186410[_0xac4a('0x7d')],function(_0x2ea4a4){return{'name':_0x2ea4a4[_0xac4a('0x7e')],'value':_0x2ea4a4[_0xac4a('0x7f')]};}):_0x186410['type']=='boolean'?[{'name':_0xac4a('0x80'),'value':_0xac4a('0x81')},{'name':_0xac4a('0x82'),'value':_0xac4a('0x83')}]:[]};})};}})[_0xac4a('0x1e')](respondWithResult(_0x1588e2,null))[_0xac4a('0x28')](function(_0x338af3){var _0x51c3ef=_0x4ccd67[_0xac4a('0x3c')][_0xac4a('0x19')]?0x1f4:_0x338af3[_0xac4a('0x84')]||0x1f4;logger['error'](_0xac4a('0x85'),_0xac4a('0x86'),_0x51c3ef,JSON[_0xac4a('0x23')](_0x338af3));delete _0x338af3[_0xac4a('0x34')];if(_0x51c3ef===0x191){_0x51c3ef=0x190;}_0x1588e2[_0xac4a('0x2a')](_0x51c3ef)[_0xac4a('0x35')](_0x4ccd67[_0xac4a('0x3c')][_0xac4a('0x19')]?{'message':_0xac4a('0x87'),'statusCode':_0x338af3['statusCode']}:_0x338af3);});}; \ No newline at end of file +var _0x7a54=['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','../../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~!@#$%^&-_=+[{]}.','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','json','count','offset','set','Content-Range','apply','destroy','sendStatus','name','index','map','SalesforceAccount','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','rawAttributes','include','find','create','body','update','SalesforceConfiguration','getConfigurations','addConfiguration','findOne','AccountId','channel','type','Descriptions','getDescriptions','SalesforceField','Subjects','getFields','Task','remoteUri','clientId','clientSecret','username','slice','substring','lastIndexOf','Connection','login','password','concat','securityToken','isNil','ticketType','sobject','CallDisposition','CallDurationInSeconds','CallObject','CallType','IsArchived','Priority','Case','Origin','IsEscalated','SuppliedCompany','remove','custom','picklistValues','label','value','boolean','True','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','html-pdf','eml-format'];(function(_0x46085b,_0x4833f9){var _0x1a4a91=function(_0x5b7638){while(--_0x5b7638){_0x46085b['push'](_0x46085b['shift']());}};_0x1a4a91(++_0x4833f9);}(_0x7a54,0x106));var _0x47a5=function(_0x5b5b18,_0x42667b){_0x5b5b18=_0x5b5b18-0x0;var _0x2c9298=_0x7a54[_0x5b5b18];return _0x2c9298;};'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'];var integrations=require(_0x47a5('0x15'));var jayson=require(_0x47a5('0x16'));var client=jayson[_0x47a5('0x17')]['http']({'port':0x232a});function checkPasswordPattern(_0x44bd3e,_0x221b54,_0x1cf309){if(_0x1cf309){var _0x711793=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x711793[_0x47a5('0x18')](_0x221b54)){return _0x44bd3e;}else{throw new db[(_0x47a5('0x19'))][(_0x47a5('0x1a'))](_0x47a5('0x1b'));}}else{return _0x44bd3e;}}function respondWithRpcPromise(_0x4e99a8,_0x362359,_0x11faf5,_0x3b001e){return new BPromise(function(_0x2a2cbb,_0x1ef44c){var _0x574af6=_0x3b001e||client;return _0x574af6['request'](_0x4e99a8,_0x11faf5)[_0x47a5('0x1c')](function(_0x4b966e){logger['info'](_0x47a5('0x1d'),_0x362359,_0x47a5('0x1e'));logger[_0x47a5('0x1f')](_0x47a5('0x20'),_0x362359,_0x47a5('0x1e'),JSON[_0x47a5('0x21')](_0x4b966e));if(_0x4b966e[_0x47a5('0x22')]){if(_0x4b966e[_0x47a5('0x22')][_0x47a5('0x23')]===0x1f4){logger['error'](_0x47a5('0x1d'),_0x362359,_0x4b966e[_0x47a5('0x22')]['message']);return _0x1ef44c(_0x4b966e[_0x47a5('0x22')][_0x47a5('0x24')]);}logger[_0x47a5('0x22')]('SalesforceAccount,\x20%s,\x20%s',_0x362359,_0x4b966e[_0x47a5('0x22')][_0x47a5('0x24')]);return _0x2a2cbb(_0x4b966e[_0x47a5('0x22')][_0x47a5('0x24')]);}else{logger['info'](_0x47a5('0x1d'),_0x362359,_0x47a5('0x1e'));_0x2a2cbb(_0x4b966e['result'][_0x47a5('0x24')]);}})[_0x47a5('0x25')](function(_0x4437f1){logger[_0x47a5('0x22')](_0x47a5('0x1d'),_0x362359,_0x4437f1);_0x1ef44c(_0x4437f1);});});}function respondWithStatusCode(_0x50bf17,_0x53078a){_0x53078a=_0x53078a||0xcc;return function(_0x136745){if(_0x136745){return _0x50bf17['sendStatus'](_0x53078a);}return _0x50bf17[_0x47a5('0x26')](_0x53078a)['end']();};}function respondWithResult(_0x23cb77,_0x378208){_0x378208=_0x378208||0xc8;return function(_0x36ad34){if(_0x36ad34){return _0x23cb77[_0x47a5('0x26')](_0x378208)[_0x47a5('0x27')](_0x36ad34);}};}function respondWithFilteredResult(_0x3ba0b7,_0x24b162){return function(_0x136b14){if(_0x136b14){var _0x16631f=_0x136b14[_0x47a5('0x28')],_0x361bfa=_0x24b162['offset'],_0x1127f8=_0x24b162[_0x47a5('0x29')]+_0x24b162['limit'],_0x11a4fa;if(_0x1127f8>=_0x16631f){_0x1127f8=_0x16631f;_0x11a4fa=0xc8;}else{_0x11a4fa=0xce;}_0x3ba0b7[_0x47a5('0x26')](_0x11a4fa);return _0x3ba0b7[_0x47a5('0x2a')](_0x47a5('0x2b'),_0x361bfa+'-'+_0x1127f8+'/'+_0x16631f)['json'](_0x136b14);}return null;};}function patchUpdates(_0x256650){return function(_0x625952){try{jsonpatch[_0x47a5('0x2c')](_0x625952,_0x256650,!![]);}catch(_0x1f1c68){return BPromise['reject'](_0x1f1c68);}return _0x625952['save']();};}function saveUpdates(_0x6f9a12,_0xfb5ddb){return function(_0x5bd7eb){if(_0x5bd7eb){return _0x5bd7eb['update'](_0x6f9a12)[_0x47a5('0x1c')](function(_0x51544e){return _0x51544e;});}return null;};}function removeEntity(_0x57bff6,_0x42f70c){return function(_0x53119b){if(_0x53119b){return _0x53119b[_0x47a5('0x2d')]()[_0x47a5('0x1c')](function(){_0x57bff6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x274e34,_0x5910bb){return function(_0x403028){if(!_0x403028){_0x274e34[_0x47a5('0x2e')](0x194);}return _0x403028;};}function handleError(_0xf269a8,_0x52749b){_0x52749b=_0x52749b||0x1f4;return function(_0x18f7e9){logger['error'](_0x18f7e9['stack']);if(_0x18f7e9[_0x47a5('0x2f')]){delete _0x18f7e9['name'];}_0xf269a8[_0x47a5('0x26')](_0x52749b)['send'](_0x18f7e9);};}exports[_0x47a5('0x30')]=function(_0x3534cb,_0x38c8d4){var _0x199698={},_0x36add5={},_0xed6320={'count':0x0,'rows':[]};var _0xee582c=_[_0x47a5('0x31')](db[_0x47a5('0x32')]['rawAttributes'],function(_0x396a9a){return{'name':_0x396a9a[_0x47a5('0x33')],'type':_0x396a9a['type'][_0x47a5('0x34')]};});_0x36add5[_0x47a5('0x35')]=_[_0x47a5('0x31')](_0xee582c,'name');_0x36add5[_0x47a5('0x36')]=_[_0x47a5('0x37')](_0x3534cb['query']);_0x36add5[_0x47a5('0x38')]=_[_0x47a5('0x39')](_0x36add5['model'],_0x36add5['query']);_0x199698['attributes']=_[_0x47a5('0x39')](_0x36add5['model'],qs[_0x47a5('0x3a')](_0x3534cb[_0x47a5('0x36')][_0x47a5('0x3a')]));_0x199698[_0x47a5('0x3b')]=_0x199698[_0x47a5('0x3b')][_0x47a5('0x3c')]?_0x199698[_0x47a5('0x3b')]:_0x36add5[_0x47a5('0x35')];if(!_0x3534cb[_0x47a5('0x36')][_0x47a5('0x3d')](_0x47a5('0x3e'))){_0x199698[_0x47a5('0x3f')]=qs[_0x47a5('0x3f')](_0x3534cb['query'][_0x47a5('0x3f')]);_0x199698[_0x47a5('0x29')]=qs[_0x47a5('0x29')](_0x3534cb[_0x47a5('0x36')]['offset']);}_0x199698[_0x47a5('0x40')]=qs['sort'](_0x3534cb['query']['sort']);_0x199698['where']=qs[_0x47a5('0x38')](_['pick'](_0x3534cb[_0x47a5('0x36')],_0x36add5[_0x47a5('0x38')]));if(_0x3534cb[_0x47a5('0x36')]['filter']){_0x199698[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x199698['where'],{'$or':_['map'](_0xee582c,function(_0xbe21d9){if(_0xbe21d9['type']!==_0x47a5('0x43')){var _0x4703b2={};_0x4703b2[_0xbe21d9[_0x47a5('0x2f')]]={'$like':'%'+_0x3534cb[_0x47a5('0x36')][_0x47a5('0x44')]+'%'};return _0x4703b2;}})});}_0x199698=_[_0x47a5('0x42')]({},_0x199698,_0x3534cb[_0x47a5('0x45')]);var _0x17cc42={'where':_0x199698[_0x47a5('0x41')]};return db[_0x47a5('0x32')][_0x47a5('0x28')](_0x17cc42)[_0x47a5('0x1c')](function(_0xe28d76){_0xed6320[_0x47a5('0x28')]=_0xe28d76;if(_0x3534cb[_0x47a5('0x36')][_0x47a5('0x46')]){_0x199698['include']=[{'all':!![]}];}return db[_0x47a5('0x32')][_0x47a5('0x47')](_0x199698);})['then'](function(_0x52b3a8){_0xed6320[_0x47a5('0x48')]=_0x52b3a8;return _0xed6320;})['then'](respondWithFilteredResult(_0x38c8d4,_0x199698))[_0x47a5('0x25')](handleError(_0x38c8d4,null));};exports[_0x47a5('0x49')]=function(_0x54c35f,_0x4f62d3){var _0x3d85cc={'raw':![],'where':{'id':_0x54c35f[_0x47a5('0x4a')]['id']}},_0x52d409={};_0x52d409[_0x47a5('0x35')]=_[_0x47a5('0x37')](db[_0x47a5('0x32')][_0x47a5('0x4b')]);_0x52d409[_0x47a5('0x36')]=_[_0x47a5('0x37')](_0x54c35f['query']);_0x52d409['filters']=_[_0x47a5('0x39')](_0x52d409[_0x47a5('0x35')],_0x52d409[_0x47a5('0x36')]);_0x3d85cc[_0x47a5('0x3b')]=_[_0x47a5('0x39')](_0x52d409[_0x47a5('0x35')],qs[_0x47a5('0x3a')](_0x54c35f['query'][_0x47a5('0x3a')]));_0x3d85cc[_0x47a5('0x3b')]=_0x3d85cc[_0x47a5('0x3b')]['length']?_0x3d85cc[_0x47a5('0x3b')]:_0x52d409['model'];if(_0x54c35f[_0x47a5('0x36')][_0x47a5('0x46')]){_0x3d85cc[_0x47a5('0x4c')]=[{'all':!![]}];}_0x3d85cc=_[_0x47a5('0x42')]({},_0x3d85cc,_0x54c35f['options']);return db[_0x47a5('0x32')][_0x47a5('0x4d')](_0x3d85cc)[_0x47a5('0x1c')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x1c')](respondWithResult(_0x4f62d3,null))[_0x47a5('0x25')](handleError(_0x4f62d3,null));};exports[_0x47a5('0x4e')]=function(_0x24e9f4,_0x481089){return db[_0x47a5('0x32')][_0x47a5('0x4e')](_0x24e9f4[_0x47a5('0x4f')],{})[_0x47a5('0x1c')](respondWithResult(_0x481089,0xc9))[_0x47a5('0x25')](handleError(_0x481089,null));};exports[_0x47a5('0x50')]=function(_0x572233,_0x1ad6a9){if(_0x572233[_0x47a5('0x4f')]['id']){delete _0x572233[_0x47a5('0x4f')]['id'];}return db['SalesforceAccount'][_0x47a5('0x4d')]({'where':{'id':_0x572233[_0x47a5('0x4a')]['id']}})[_0x47a5('0x1c')](handleEntityNotFound(_0x1ad6a9,null))['then'](saveUpdates(_0x572233['body'],null))[_0x47a5('0x1c')](respondWithResult(_0x1ad6a9,null))[_0x47a5('0x25')](handleError(_0x1ad6a9,null));};exports['destroy']=function(_0x4cf792,_0x6d6b2b){return db['SalesforceAccount'][_0x47a5('0x4d')]({'where':{'id':_0x4cf792['params']['id']}})['then'](handleEntityNotFound(_0x6d6b2b,null))[_0x47a5('0x1c')](removeEntity(_0x6d6b2b,null))[_0x47a5('0x25')](handleError(_0x6d6b2b,null));};exports['getConfigurations']=function(_0x1b958b,_0x72fe,_0x4b706a){var _0x5b6127={};var _0x16b4fd={};var _0x30d482;var _0x867da0;return db[_0x47a5('0x32')]['findOne']({'where':{'id':_0x1b958b[_0x47a5('0x4a')]['id']}})[_0x47a5('0x1c')](handleEntityNotFound(_0x72fe,null))[_0x47a5('0x1c')](function(_0x5a33b8){if(_0x5a33b8){_0x30d482=_0x5a33b8;_0x16b4fd[_0x47a5('0x35')]=_['keys'](db[_0x47a5('0x51')][_0x47a5('0x4b')]);_0x16b4fd[_0x47a5('0x36')]=_[_0x47a5('0x37')](_0x1b958b[_0x47a5('0x36')]);_0x16b4fd['filters']=_[_0x47a5('0x39')](_0x16b4fd['model'],_0x16b4fd['query']);_0x5b6127['attributes']=_['intersection'](_0x16b4fd[_0x47a5('0x35')],qs[_0x47a5('0x3a')](_0x1b958b[_0x47a5('0x36')]['fields']));_0x5b6127['attributes']=_0x5b6127[_0x47a5('0x3b')][_0x47a5('0x3c')]?_0x5b6127[_0x47a5('0x3b')]:_0x16b4fd[_0x47a5('0x35')];_0x5b6127[_0x47a5('0x40')]=qs['sort'](_0x1b958b[_0x47a5('0x36')]['sort']);_0x5b6127[_0x47a5('0x41')]=qs[_0x47a5('0x38')](_['pick'](_0x1b958b[_0x47a5('0x36')],_0x16b4fd[_0x47a5('0x38')]));if(_0x1b958b[_0x47a5('0x36')][_0x47a5('0x44')]){_0x5b6127[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x5b6127[_0x47a5('0x41')],{'$or':_[_0x47a5('0x31')](_0x5b6127['attributes'],function(_0x2dcc3b){var _0x2a3a57={};_0x2a3a57[_0x2dcc3b]={'$like':'%'+_0x1b958b[_0x47a5('0x36')][_0x47a5('0x44')]+'%'};return _0x2a3a57;})});}_0x5b6127=_[_0x47a5('0x42')]({},_0x5b6127,_0x1b958b['options']);return _0x30d482[_0x47a5('0x52')](_0x5b6127);}})[_0x47a5('0x1c')](function(_0x1224bc){if(_0x1224bc){_0x867da0=_0x1224bc[_0x47a5('0x3c')];if(!_0x1b958b[_0x47a5('0x36')][_0x47a5('0x3d')](_0x47a5('0x3e'))){_0x5b6127[_0x47a5('0x3f')]=qs[_0x47a5('0x3f')](_0x1b958b[_0x47a5('0x36')][_0x47a5('0x3f')]);_0x5b6127[_0x47a5('0x29')]=qs[_0x47a5('0x29')](_0x1b958b[_0x47a5('0x36')][_0x47a5('0x29')]);}return _0x30d482['getConfigurations'](_0x5b6127);}})[_0x47a5('0x1c')](function(_0x284fb8){if(_0x284fb8){return _0x284fb8?{'count':_0x867da0,'rows':_0x284fb8}:null;}})[_0x47a5('0x1c')](respondWithResult(_0x72fe,null))['catch'](handleError(_0x72fe,null));};exports[_0x47a5('0x53')]=function(_0x2e46af,_0x36c67,_0x26f1ac){if(_0x2e46af['body']['id']){delete _0x2e46af[_0x47a5('0x4f')]['id'];}return db['SalesforceAccount'][_0x47a5('0x54')]({'where':{'id':_0x2e46af['params']['id']}})[_0x47a5('0x1c')](handleEntityNotFound(_0x36c67,null))['then'](function(_0x7c1190){if(_0x7c1190){_0x2e46af[_0x47a5('0x4f')][_0x47a5('0x55')]=_0x7c1190['id'];_0x2e46af['body']['Subjects']=integrations['getSubjects'](_0x2e46af[_0x47a5('0x4f')][_0x47a5('0x56')],_0x2e46af[_0x47a5('0x4f')][_0x47a5('0x57')]);_0x2e46af['body'][_0x47a5('0x58')]=integrations[_0x47a5('0x59')](_0x2e46af[_0x47a5('0x4f')][_0x47a5('0x56')],_0x2e46af[_0x47a5('0x4f')][_0x47a5('0x57')]);return db[_0x47a5('0x51')][_0x47a5('0x4e')](_0x2e46af[_0x47a5('0x4f')],{'include':[{'model':db[_0x47a5('0x5a')],'as':_0x47a5('0x5b')},{'model':db[_0x47a5('0x5a')],'as':'Descriptions'}]});}return null;})[_0x47a5('0x1c')](respondWithResult(_0x36c67,null))['catch'](handleError(_0x36c67,null));};exports[_0x47a5('0x5c')]=function(_0x2ac30f,_0x281e5f,_0x12fec9){var _0x40e584;var _0xa9c853='';var _0x12025a=_0x47a5('0x5d');return db[_0x47a5('0x32')][_0x47a5('0x54')]({'where':{'id':_0x2ac30f[_0x47a5('0x4a')]['id']},'attributes':['id',_0x47a5('0x5e'),_0x47a5('0x5f'),_0x47a5('0x60'),_0x47a5('0x61'),'password','securityToken']})['then'](handleEntityNotFound(_0x281e5f,null))['then'](function(_0x490e28){if(_0x490e28){_0xa9c853=_0x490e28[_0x47a5('0x5e')];var _0x5d6916=_0xa9c853[_0x47a5('0x62')](-0x1);if(_0x5d6916==='/'){_0xa9c853=_0xa9c853[_0x47a5('0x63')](0x0,_0xa9c853[_0x47a5('0x64')](_0x5d6916));}_0x40e584=new jsforce[(_0x47a5('0x65'))]({'oauth2':{'loginUrl':_0xa9c853,'clientId':_0x490e28[_0x47a5('0x5f')],'clientSecret':_0x490e28[_0x47a5('0x60')]}});return _0x40e584[_0x47a5('0x66')](_0x490e28[_0x47a5('0x61')],_0x490e28[_0x47a5('0x67')][_0x47a5('0x68')](_0x490e28[_0x47a5('0x69')]));}})['then'](function(_0x18fa31){if(_0x18fa31){if(!_[_0x47a5('0x6a')](_0x2ac30f[_0x47a5('0x36')]['ticketType'])){_0x12025a=_0x2ac30f[_0x47a5('0x36')][_0x47a5('0x6b')];}return _0x40e584[_0x47a5('0x6c')](_0x12025a)['describe']();}})[_0x47a5('0x1c')](function(_0x5205ba){var _0x49d93d=[_0x47a5('0x6d'),_0x47a5('0x6e'),_0x47a5('0x6f'),_0x47a5('0x70'),_0x47a5('0x71'),_0x47a5('0x72'),'Status','Type'];if(!_[_0x47a5('0x6a')](_0x2ac30f['query'][_0x47a5('0x6b')])&&_0x2ac30f[_0x47a5('0x36')][_0x47a5('0x6b')]===_0x47a5('0x73')){_0x49d93d=['Type',_0x47a5('0x74'),'Reason','Status',_0x47a5('0x72'),_0x47a5('0x75'),'SuppliedName',_0x47a5('0x76')];}if(_0x5205ba){_[_0x47a5('0x77')](_0x5205ba[_0x47a5('0x3a')],function(_0x4c25ec){return _0x4c25ec[_0x47a5('0x78')]===![]&&!_0x49d93d['includes'](_0x4c25ec[_0x47a5('0x2f')]);});return{'count':_0x5205ba[_0x47a5('0x3a')][_0x47a5('0x3c')],'rows':_['map'](_0x5205ba[_0x47a5('0x3a')],function(_0x196600){return{'id':_0x196600[_0x47a5('0x2f')],'name':_0x196600['label'],'custom':_0x196600[_0x47a5('0x78')],'options':_0x196600['picklistValues'][_0x47a5('0x3c')]>0x0?_['map'](_0x196600[_0x47a5('0x79')],function(_0x20d8bd){return{'name':_0x20d8bd[_0x47a5('0x7a')],'value':_0x20d8bd[_0x47a5('0x7b')]};}):_0x196600['type']==_0x47a5('0x7c')?[{'name':_0x47a5('0x7d'),'value':_0x47a5('0x7e')},{'name':_0x47a5('0x7f'),'value':_0x47a5('0x80')}]:[]};})};}})['then'](respondWithResult(_0x281e5f,null))['catch'](function(_0x569550){var _0x4ab01f=_0x2ac30f[_0x47a5('0x36')][_0x47a5('0x18')]?0x1f4:_0x569550[_0x47a5('0x81')]||0x1f4;logger['error'](_0x47a5('0x82'),_0x47a5('0x5c'),_0x4ab01f,JSON['stringify'](_0x569550));delete _0x569550[_0x47a5('0x2f')];if(_0x4ab01f===0x191){_0x4ab01f=0x190;}_0x281e5f[_0x47a5('0x26')](_0x4ab01f)[_0x47a5('0x83')](_0x2ac30f[_0x47a5('0x36')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x569550[_0x47a5('0x81')]}:_0x569550);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index a2c7bd7..66849c0 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 _0x615d=['moment','bluebird','path','rimraf','../../components/integrations/configuration','define','SalesforceAccount','int_salesforce_accounts','lodash','../../config/logger'];(function(_0x20e754,_0x3cbd96){var _0x1a4b3c=function(_0x53a00d){while(--_0x53a00d){_0x20e754['push'](_0x20e754['shift']());}};_0x1a4b3c(++_0x3cbd96);}(_0x615d,0x1ac));var _0xd615=function(_0x46ee6b,_0x7f3e6c){_0x46ee6b=_0x46ee6b-0x0;var _0x97d54b=_0x615d[_0x46ee6b];return _0x97d54b;};'use strict';var _=require(_0xd615('0x0'));var util=require('util');var logger=require(_0xd615('0x1'))('api');var moment=require(_0xd615('0x2'));var BPromise=require(_0xd615('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd615('0x4'));var rimraf=require(_0xd615('0x5'));var config=require('../../config/environment');var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0xd615('0x6'));module['exports']=function(_0x587b5f,_0x1ee77a){return _0x587b5f[_0xd615('0x7')](_0xd615('0x8'),attributes,{'tableName':_0xd615('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a54=['api','bluebird','request-promise','rimraf','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','lodash'];(function(_0x2fd8e2,_0x8cbd99){var _0x35bdb4=function(_0x5248af){while(--_0x5248af){_0x2fd8e2['push'](_0x2fd8e2['shift']());}};_0x35bdb4(++_0x8cbd99);}(_0x2a54,0x15d));var _0x42a5=function(_0x19a66b,_0x14eb7b){_0x19a66b=_0x19a66b-0x0;var _0x10e265=_0x2a54[_0x19a66b];return _0x10e265;};'use strict';var _=require(_0x42a5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x42a5('0x1'));var moment=require('moment');var BPromise=require(_0x42a5('0x2'));var rp=require(_0x42a5('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x42a5('0x4'));var config=require('../../config/environment');var attributes=require(_0x42a5('0x5'));var integrations=require(_0x42a5('0x6'));module[_0x42a5('0x7')]=function(_0x36ee2b,_0x330764){return _0x36ee2b[_0x42a5('0x8')](_0x42a5('0x9'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index e526872..70d59c2 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 _0x2750=['../../config/environment','jayson/promise','http','request','then','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','SalesforceAccount','options','raw','where','attributes','include','model','map','GetSalesforceAccount','ShowSalesforceAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4555c2,_0x138d83){var _0x492d1d=function(_0x55a0c5){while(--_0x55a0c5){_0x4555c2['push'](_0x4555c2['shift']());}};_0x492d1d(++_0x138d83);}(_0x2750,0x13b));var _0x0275=function(_0x1bd464,_0x516e58){_0x1bd464=_0x1bd464-0x0;var _0x414341=_0x2750[_0x1bd464];return _0x414341;};'use strict';var _=require(_0x0275('0x0'));var util=require('util');var moment=require(_0x0275('0x1'));var BPromise=require(_0x0275('0x2'));var rs=require(_0x0275('0x3'));var fs=require('fs');var Redis=require(_0x0275('0x4'));var db=require(_0x0275('0x5'))['db'];var utils=require(_0x0275('0x6'));var logger=require(_0x0275('0x7'))(_0x0275('0x8'));var config=require(_0x0275('0x9'));var jayson=require(_0x0275('0xa'));var client=jayson['client'][_0x0275('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2421fd,_0x2fa0eb,_0x2e4b5c){return new BPromise(function(_0x4dffd1,_0x1f7c4a){return client[_0x0275('0xc')](_0x2421fd,_0x2e4b5c)[_0x0275('0xd')](function(_0x5e0e4a){logger['info'](_0x0275('0xe'),_0x2fa0eb,'request\x20sent');logger[_0x0275('0xf')](_0x0275('0x10'),_0x2fa0eb,_0x0275('0x11'),JSON[_0x0275('0x12')](_0x5e0e4a));if(_0x5e0e4a[_0x0275('0x13')]){if(_0x5e0e4a['error'][_0x0275('0x14')]===0x1f4){logger[_0x0275('0x13')](_0x0275('0xe'),_0x2fa0eb,_0x5e0e4a['error']['message']);return _0x1f7c4a(_0x5e0e4a[_0x0275('0x13')][_0x0275('0x15')]);}logger[_0x0275('0x13')](_0x0275('0xe'),_0x2fa0eb,_0x5e0e4a[_0x0275('0x13')][_0x0275('0x15')]);return _0x4dffd1(_0x5e0e4a['error'][_0x0275('0x15')]);}else{logger[_0x0275('0x16')]('SalesforceAccount,\x20%s,\x20%s',_0x2fa0eb,_0x0275('0x11'));_0x4dffd1(_0x5e0e4a[_0x0275('0x17')]['message']);}})[_0x0275('0x18')](function(_0x31c76b){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x2fa0eb,_0x31c76b);_0x1f7c4a(_0x31c76b);});});}exports['GetSalesforceAccount']=function(_0x591d27){var _0x5b8746=this;return new Promise(function(_0x566ad6,_0x44f7b0){return db[_0x0275('0x19')]['findAll']({'raw':_0x591d27[_0x0275('0x1a')]?_0x591d27[_0x0275('0x1a')][_0x0275('0x1b')]===undefined?!![]:![]:!![],'where':_0x591d27['options']?_0x591d27[_0x0275('0x1a')][_0x0275('0x1c')]||null:null,'attributes':_0x591d27['options']?_0x591d27['options'][_0x0275('0x1d')]||null:null,'limit':_0x591d27[_0x0275('0x1a')]?_0x591d27[_0x0275('0x1a')]['limit']||null:null,'include':_0x591d27[_0x0275('0x1a')]?_0x591d27['options'][_0x0275('0x1e')]?_['map'](_0x591d27[_0x0275('0x1a')][_0x0275('0x1e')],function(_0x594321){return{'model':db[_0x594321[_0x0275('0x1f')]],'as':_0x594321['as'],'attributes':_0x594321[_0x0275('0x1d')],'include':_0x594321[_0x0275('0x1e')]?_['map'](_0x594321[_0x0275('0x1e')],function(_0x44bbf8){return{'model':db[_0x44bbf8[_0x0275('0x1f')]],'as':_0x44bbf8['as'],'attributes':_0x44bbf8[_0x0275('0x1d')],'include':_0x44bbf8[_0x0275('0x1e')]?_[_0x0275('0x20')](_0x44bbf8['include'],function(_0x35343c){return{'model':db[_0x35343c[_0x0275('0x1f')]],'as':_0x35343c['as'],'attributes':_0x35343c[_0x0275('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0275('0xd')](function(_0x4689a3){logger['info'](_0x0275('0x21'),_0x591d27);logger[_0x0275('0xf')](_0x0275('0x21'),_0x591d27,JSON[_0x0275('0x12')](_0x4689a3));_0x566ad6(_0x4689a3);})[_0x0275('0x18')](function(_0x49e645){logger[_0x0275('0x13')](_0x0275('0x21'),_0x49e645[_0x0275('0x15')],_0x591d27);_0x44f7b0(_0x5b8746['error'](0x1f4,_0x49e645['message']));});});};exports[_0x0275('0x22')]=function(_0x299190){var _0x5dc2bc=this;return new Promise(function(_0x7eff96,_0x155a50){return db[_0x0275('0x19')][_0x0275('0x23')]({'raw':_0x299190['options']?_0x299190[_0x0275('0x1a')][_0x0275('0x1b')]===undefined?!![]:![]:!![],'where':_0x299190[_0x0275('0x1a')]?_0x299190[_0x0275('0x1a')]['where']||null:null,'attributes':_0x299190[_0x0275('0x1a')]?_0x299190['options'][_0x0275('0x1d')]||null:null,'include':_0x299190['options']?_0x299190[_0x0275('0x1a')][_0x0275('0x1e')]?_['map'](_0x299190[_0x0275('0x1a')][_0x0275('0x1e')],function(_0x1575be){return{'model':db[_0x1575be[_0x0275('0x1f')]],'as':_0x1575be['as'],'attributes':_0x1575be['attributes'],'include':_0x1575be[_0x0275('0x1e')]?_[_0x0275('0x20')](_0x1575be[_0x0275('0x1e')],function(_0x1d872a){return{'model':db[_0x1d872a[_0x0275('0x1f')]],'as':_0x1d872a['as'],'attributes':_0x1d872a['attributes'],'include':_0x1d872a[_0x0275('0x1e')]?_[_0x0275('0x20')](_0x1d872a[_0x0275('0x1e')],function(_0x364773){return{'model':db[_0x364773[_0x0275('0x1f')]],'as':_0x364773['as'],'attributes':_0x364773[_0x0275('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0275('0xd')](function(_0x471fc7){logger[_0x0275('0x16')](_0x0275('0x22'),_0x299190);logger[_0x0275('0xf')]('ShowSalesforceAccount',_0x299190,JSON[_0x0275('0x12')](_0x471fc7));_0x7eff96(_0x471fc7);})[_0x0275('0x18')](function(_0xc7d2fe){logger[_0x0275('0x13')](_0x0275('0x22'),_0xc7d2fe[_0x0275('0x15')],_0x299190);_0x155a50(_0x5dc2bc[_0x0275('0x13')](0x1f4,_0xc7d2fe[_0x0275('0x15')]));});});}; \ No newline at end of file +var _0xedd9=['attributes','limit','map','include','model','ShowSalesforceAccount','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','catch','GetSalesforceAccount','SalesforceAccount','findAll','raw','options'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xedd9,0xfc));var _0x9edd=function(_0x8f1d38,_0x2149ef){_0x8f1d38=_0x8f1d38-0x0;var _0x4b7efb=_0xedd9[_0x8f1d38];return _0x4b7efb;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('SalesforceAccount,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});}exports[_0x9edd('0x17')]=function(_0x40ba32){var _0x4d8f33=this;return new Promise(function(_0x43dc70,_0x5d879c){return db[_0x9edd('0x18')][_0x9edd('0x19')]({'raw':_0x40ba32['options']?_0x40ba32['options'][_0x9edd('0x1a')]===undefined?!![]:![]:!![],'where':_0x40ba32['options']?_0x40ba32[_0x9edd('0x1b')]['where']||null:null,'attributes':_0x40ba32['options']?_0x40ba32[_0x9edd('0x1b')][_0x9edd('0x1c')]||null:null,'limit':_0x40ba32['options']?_0x40ba32['options'][_0x9edd('0x1d')]||null:null,'include':_0x40ba32[_0x9edd('0x1b')]?_0x40ba32[_0x9edd('0x1b')]['include']?_[_0x9edd('0x1e')](_0x40ba32[_0x9edd('0x1b')][_0x9edd('0x1f')],function(_0x2ca65f){return{'model':db[_0x2ca65f[_0x9edd('0x20')]],'as':_0x2ca65f['as'],'attributes':_0x2ca65f['attributes'],'include':_0x2ca65f[_0x9edd('0x1f')]?_[_0x9edd('0x1e')](_0x2ca65f[_0x9edd('0x1f')],function(_0x2f9f86){return{'model':db[_0x2f9f86[_0x9edd('0x20')]],'as':_0x2f9f86['as'],'attributes':_0x2f9f86['attributes'],'include':_0x2f9f86['include']?_[_0x9edd('0x1e')](_0x2f9f86[_0x9edd('0x1f')],function(_0x8d67aa){return{'model':db[_0x8d67aa[_0x9edd('0x20')]],'as':_0x8d67aa['as'],'attributes':_0x8d67aa[_0x9edd('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x57a2cc){logger[_0x9edd('0xe')](_0x9edd('0x17'),_0x40ba32);logger[_0x9edd('0x10')]('GetSalesforceAccount',_0x40ba32,JSON[_0x9edd('0x11')](_0x57a2cc));_0x43dc70(_0x57a2cc);})[_0x9edd('0x16')](function(_0x2ae8dd){logger[_0x9edd('0x12')]('GetSalesforceAccount',_0x2ae8dd[_0x9edd('0x15')],_0x40ba32);_0x5d879c(_0x4d8f33[_0x9edd('0x12')](0x1f4,_0x2ae8dd[_0x9edd('0x15')]));});});};exports[_0x9edd('0x21')]=function(_0xbbf08f){var _0x42e664=this;return new Promise(function(_0x209aba,_0x1fba7b){return db[_0x9edd('0x18')][_0x9edd('0x22')]({'raw':_0xbbf08f[_0x9edd('0x1b')]?_0xbbf08f[_0x9edd('0x1b')][_0x9edd('0x1a')]===undefined?!![]:![]:!![],'where':_0xbbf08f[_0x9edd('0x1b')]?_0xbbf08f[_0x9edd('0x1b')]['where']||null:null,'attributes':_0xbbf08f[_0x9edd('0x1b')]?_0xbbf08f[_0x9edd('0x1b')][_0x9edd('0x1c')]||null:null,'include':_0xbbf08f['options']?_0xbbf08f[_0x9edd('0x1b')][_0x9edd('0x1f')]?_[_0x9edd('0x1e')](_0xbbf08f[_0x9edd('0x1b')][_0x9edd('0x1f')],function(_0x2bc4ed){return{'model':db[_0x2bc4ed[_0x9edd('0x20')]],'as':_0x2bc4ed['as'],'attributes':_0x2bc4ed[_0x9edd('0x1c')],'include':_0x2bc4ed[_0x9edd('0x1f')]?_[_0x9edd('0x1e')](_0x2bc4ed[_0x9edd('0x1f')],function(_0x42c1d9){return{'model':db[_0x42c1d9[_0x9edd('0x20')]],'as':_0x42c1d9['as'],'attributes':_0x42c1d9[_0x9edd('0x1c')],'include':_0x42c1d9['include']?_[_0x9edd('0x1e')](_0x42c1d9['include'],function(_0x968303){return{'model':db[_0x968303[_0x9edd('0x20')]],'as':_0x968303['as'],'attributes':_0x968303[_0x9edd('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9edd('0xd')](function(_0x16770e){logger['info'](_0x9edd('0x21'),_0xbbf08f);logger[_0x9edd('0x10')](_0x9edd('0x21'),_0xbbf08f,JSON[_0x9edd('0x11')](_0x16770e));_0x209aba(_0x16770e);})[_0x9edd('0x16')](function(_0x337e6c){logger[_0x9edd('0x12')](_0x9edd('0x21'),_0x337e6c[_0x9edd('0x15')],_0xbbf08f);_0x1fba7b(_0x42e664[_0x9edd('0x12')](0x1f4,_0x337e6c['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index ef0ebc2..62429fc 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 _0xf6f8=['show','getFields','getSubjects','/:id/descriptions','getDescriptions','post','put','/:id','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated'];(function(_0xd0e268,_0x18863c){var _0x272c9f=function(_0x536f88){while(--_0x536f88){_0xd0e268['push'](_0xd0e268['shift']());}};_0x272c9f(++_0x18863c);}(_0xf6f8,0xba));var _0x8f6f=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0xf6f8[_0x31ced5];return _0x10d9e5;};'use strict';var multer=require(_0x8f6f('0x0'));var util=require(_0x8f6f('0x1'));var path=require(_0x8f6f('0x2'));var timeout=require(_0x8f6f('0x3'));var express=require(_0x8f6f('0x4'));var router=express[_0x8f6f('0x5')]();var auth=require(_0x8f6f('0x6'));var interaction=require(_0x8f6f('0x7'));var config=require(_0x8f6f('0x8'));var controller=require(_0x8f6f('0x9'));router[_0x8f6f('0xa')]('/',auth[_0x8f6f('0xb')](),controller['index']);router[_0x8f6f('0xa')]('/:id',auth[_0x8f6f('0xb')](),controller[_0x8f6f('0xc')]);router[_0x8f6f('0xa')]('/:id/fields',auth[_0x8f6f('0xb')](),controller[_0x8f6f('0xd')]);router[_0x8f6f('0xa')]('/:id/subjects',auth[_0x8f6f('0xb')](),controller[_0x8f6f('0xe')]);router[_0x8f6f('0xa')](_0x8f6f('0xf'),auth['isAuthenticated'](),controller[_0x8f6f('0x10')]);router[_0x8f6f('0x11')]('/',auth[_0x8f6f('0xb')](),controller['create']);router[_0x8f6f('0x12')](_0x8f6f('0x13'),auth['isAuthenticated'](),controller[_0x8f6f('0x14')]);router[_0x8f6f('0x15')](_0x8f6f('0x13'),auth[_0x8f6f('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x405e=['destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','/:id','delete'];(function(_0x39040e,_0xfaacfa){var _0x576fe5=function(_0x5449c5){while(--_0x5449c5){_0x39040e['push'](_0x39040e['shift']());}};_0x576fe5(++_0xfaacfa);}(_0x405e,0x70));var _0xe405=function(_0x5e44a5,_0x22cd28){_0x5e44a5=_0x5e44a5-0x0;var _0x5276b0=_0x405e[_0x5e44a5];return _0x5276b0;};'use strict';var multer=require(_0xe405('0x0'));var util=require(_0xe405('0x1'));var path=require(_0xe405('0x2'));var timeout=require(_0xe405('0x3'));var express=require(_0xe405('0x4'));var router=express['Router']();var auth=require(_0xe405('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe405('0x6'));var controller=require(_0xe405('0x7'));router[_0xe405('0x8')]('/',auth[_0xe405('0x9')](),controller['index']);router[_0xe405('0x8')]('/:id',auth[_0xe405('0x9')](),controller['show']);router['get'](_0xe405('0xa'),auth[_0xe405('0x9')](),controller[_0xe405('0xb')]);router[_0xe405('0x8')](_0xe405('0xc'),auth[_0xe405('0x9')](),controller[_0xe405('0xd')]);router[_0xe405('0x8')](_0xe405('0xe'),auth['isAuthenticated'](),controller[_0xe405('0xf')]);router[_0xe405('0x10')]('/',auth[_0xe405('0x9')](),controller['create']);router[_0xe405('0x11')](_0xe405('0x12'),auth[_0xe405('0x9')](),controller['update']);router[_0xe405('0x13')](_0xe405('0x12'),auth[_0xe405('0x9')](),controller[_0xe405('0x14')]);module[_0xe405('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 97cf453..2ea3b42 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 _0x693e=['contact_lead','contact','lead','STRING','ENUM','Task','Case'];(function(_0x40a474,_0x5074af){var _0x59ebb0=function(_0x1a52b5){while(--_0x1a52b5){_0x40a474['push'](_0x40a474['shift']());}};_0x59ebb0(++_0x5074af);}(_0x693e,0xdc));var _0xe693=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x693e[_0x46698a];return _0x356db0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe693('0x0')]},'description':{'type':Sequelize[_0xe693('0x0')]},'ticketType':{'type':Sequelize[_0xe693('0x1')](_0xe693('0x2'),_0xe693('0x3')),'defaultValue':_0xe693('0x2')},'moduleSearch':{'type':Sequelize[_0xe693('0x1')](_0xe693('0x4'),_0xe693('0x5'),_0xe693('0x6')),'defaultValue':_0xe693('0x4')},'moduleCreate':{'type':Sequelize[_0xe693('0x1')]('nothing',_0xe693('0x5'),_0xe693('0x6')),'defaultValue':_0xe693('0x6')}}; \ No newline at end of file +var _0x2081=['exports','STRING','ENUM','Case','Task','contact_lead','contact','lead'];(function(_0x4c4f48,_0x35110e){var _0x488c58=function(_0x89f768){while(--_0x89f768){_0x4c4f48['push'](_0x4c4f48['shift']());}};_0x488c58(++_0x35110e);}(_0x2081,0x178));var _0x1208=function(_0x442f02,_0x47d845){_0x442f02=_0x442f02-0x0;var _0xab6ef1=_0x2081[_0x442f02];return _0xab6ef1;};'use strict';var Sequelize=require('sequelize');module[_0x1208('0x0')]={'name':{'type':Sequelize[_0x1208('0x1')]},'description':{'type':Sequelize[_0x1208('0x1')]},'ticketType':{'type':Sequelize[_0x1208('0x2')]('Task',_0x1208('0x3')),'defaultValue':_0x1208('0x4')},'moduleSearch':{'type':Sequelize[_0x1208('0x2')](_0x1208('0x5'),_0x1208('0x6'),_0x1208('0x7')),'defaultValue':_0x1208('0x5')},'moduleCreate':{'type':Sequelize[_0x1208('0x2')]('nothing',_0x1208('0x6'),_0x1208('0x7')),'defaultValue':_0x1208('0x7')}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 9a80467..690b9ff 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 _0x7166=['keys','query','filters','intersection','attributes','model','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','options','SalesforceConfiguration','includeAll','include','findAll','rows','show','params','create','body','find','findOne','SalesforceField','getFields','hasOwnProperty','getSubjects','nolimit','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key'];(function(_0xad57ee,_0x2823a6){var _0x3eaea9=function(_0x185650){while(--_0x185650){_0xad57ee['push'](_0xad57ee['shift']());}};_0x3eaea9(++_0x2823a6);}(_0x7166,0x141));var _0x6716=function(_0x3cf5a3,_0x5a4492){_0x3cf5a3=_0x3cf5a3-0x0;var _0x39ba2d=_0x7166[_0x3cf5a3];return _0x39ba2d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6716('0x0'));var rimraf=require(_0x6716('0x1'));var zipdir=require(_0x6716('0x2'));var jsonpatch=require(_0x6716('0x3'));var rp=require('request-promise');var moment=require(_0x6716('0x4'));var BPromise=require(_0x6716('0x5'));var Mustache=require(_0x6716('0x6'));var util=require(_0x6716('0x7'));var path=require(_0x6716('0x8'));var sox=require(_0x6716('0x9'));var csv=require(_0x6716('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6716('0xb'));var squel=require(_0x6716('0xc'));var crypto=require('crypto');var jsforce=require(_0x6716('0xd'));var deskjs=require(_0x6716('0xe'));var toCsv=require(_0x6716('0xa'));var querystring=require('querystring');var Papa=require(_0x6716('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6716('0x10'));var as=require(_0x6716('0x11'));var hardwareService=require(_0x6716('0x12'));var logger=require(_0x6716('0x13'))(_0x6716('0x14'));var utils=require(_0x6716('0x15'));var config=require('../../config/environment');var db=require(_0x6716('0x16'))['db'];var jayson=require(_0x6716('0x17'));var client=jayson['client'][_0x6716('0x18')]({'port':0x232a});function checkPasswordPattern(_0xabc9eb,_0x366c80,_0x24b591){if(_0x24b591){var _0x5093f7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5093f7[_0x6716('0x19')](_0x366c80)){return _0xabc9eb;}else{throw new db['Sequelize'][(_0x6716('0x1a'))](_0x6716('0x1b'));}}else{return _0xabc9eb;}}function respondWithRpcPromise(_0x2b7c05,_0x4297b8,_0x2c31c2,_0x30fc7b){return new BPromise(function(_0x3b4c19,_0xed1901){var _0x2cc702=_0x30fc7b||client;return _0x2cc702[_0x6716('0x1c')](_0x2b7c05,_0x2c31c2)[_0x6716('0x1d')](function(_0x4f4f3d){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x4297b8,_0x6716('0x1e'));logger[_0x6716('0x1f')](_0x6716('0x20'),_0x4297b8,_0x6716('0x1e'),JSON[_0x6716('0x21')](_0x4f4f3d));if(_0x4f4f3d[_0x6716('0x22')]){if(_0x4f4f3d[_0x6716('0x22')][_0x6716('0x23')]===0x1f4){logger[_0x6716('0x22')](_0x6716('0x24'),_0x4297b8,_0x4f4f3d[_0x6716('0x22')][_0x6716('0x25')]);return _0xed1901(_0x4f4f3d['error'][_0x6716('0x25')]);}logger[_0x6716('0x22')](_0x6716('0x24'),_0x4297b8,_0x4f4f3d['error']['message']);return _0x3b4c19(_0x4f4f3d[_0x6716('0x22')][_0x6716('0x25')]);}else{logger[_0x6716('0x26')](_0x6716('0x24'),_0x4297b8,'request\x20sent');_0x3b4c19(_0x4f4f3d[_0x6716('0x27')][_0x6716('0x25')]);}})[_0x6716('0x28')](function(_0x395eb2){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x4297b8,_0x395eb2);_0xed1901(_0x395eb2);});});}function respondWithStatusCode(_0x392123,_0x1c574a){_0x1c574a=_0x1c574a||0xcc;return function(_0x3ac138){if(_0x3ac138){return _0x392123[_0x6716('0x29')](_0x1c574a);}return _0x392123[_0x6716('0x2a')](_0x1c574a)[_0x6716('0x2b')]();};}function respondWithResult(_0x1e346f,_0x2c8de4){_0x2c8de4=_0x2c8de4||0xc8;return function(_0x3aea71){if(_0x3aea71){return _0x1e346f[_0x6716('0x2a')](_0x2c8de4)['json'](_0x3aea71);}};}function respondWithFilteredResult(_0x363275,_0x25d370){return function(_0x1c6cfd){if(_0x1c6cfd){var _0x226cce=_0x1c6cfd[_0x6716('0x2c')],_0x324349=_0x25d370[_0x6716('0x2d')],_0x334901=_0x25d370[_0x6716('0x2d')]+_0x25d370[_0x6716('0x2e')],_0x952386;if(_0x334901>=_0x226cce){_0x334901=_0x226cce;_0x952386=0xc8;}else{_0x952386=0xce;}_0x363275[_0x6716('0x2a')](_0x952386);return _0x363275['set'](_0x6716('0x2f'),_0x324349+'-'+_0x334901+'/'+_0x226cce)[_0x6716('0x30')](_0x1c6cfd);}return null;};}function patchUpdates(_0x593939){return function(_0x4fb5fe){try{jsonpatch[_0x6716('0x31')](_0x4fb5fe,_0x593939,!![]);}catch(_0x27355a){return BPromise[_0x6716('0x32')](_0x27355a);}return _0x4fb5fe[_0x6716('0x33')]();};}function saveUpdates(_0x402eb4,_0x37bfd5){return function(_0x3e96fd){if(_0x3e96fd){return _0x3e96fd[_0x6716('0x34')](_0x402eb4)[_0x6716('0x1d')](function(_0x9dce3d){return _0x9dce3d;});}return null;};}function removeEntity(_0xc7e676,_0x431d06){return function(_0x2983db){if(_0x2983db){return _0x2983db[_0x6716('0x35')]()[_0x6716('0x1d')](function(){_0xc7e676[_0x6716('0x2a')](0xcc)[_0x6716('0x2b')]();});}};}function handleEntityNotFound(_0x43da9e,_0x263d95){return function(_0x51ffdd){if(!_0x51ffdd){_0x43da9e[_0x6716('0x29')](0x194);}return _0x51ffdd;};}function handleError(_0x729b09,_0x2422d6){_0x2422d6=_0x2422d6||0x1f4;return function(_0x4f28ed){logger[_0x6716('0x22')](_0x4f28ed[_0x6716('0x36')]);if(_0x4f28ed['name']){delete _0x4f28ed[_0x6716('0x37')];}_0x729b09[_0x6716('0x2a')](_0x2422d6)[_0x6716('0x38')](_0x4f28ed);};}exports[_0x6716('0x39')]=function(_0x15ed4a,_0xc15aa4){var _0x358770={},_0x4a74e1={},_0x39738c={'count':0x0,'rows':[]};var _0x1d0ba9=_[_0x6716('0x3a')](db['SalesforceConfiguration'][_0x6716('0x3b')],function(_0xa1994a){return{'name':_0xa1994a[_0x6716('0x3c')],'type':_0xa1994a[_0x6716('0x3d')][_0x6716('0x3e')]};});_0x4a74e1['model']=_[_0x6716('0x3a')](_0x1d0ba9,_0x6716('0x37'));_0x4a74e1['query']=_[_0x6716('0x3f')](_0x15ed4a[_0x6716('0x40')]);_0x4a74e1[_0x6716('0x41')]=_[_0x6716('0x42')](_0x4a74e1['model'],_0x4a74e1['query']);_0x358770[_0x6716('0x43')]=_['intersection'](_0x4a74e1[_0x6716('0x44')],qs[_0x6716('0x45')](_0x15ed4a[_0x6716('0x40')][_0x6716('0x45')]));_0x358770['attributes']=_0x358770[_0x6716('0x43')][_0x6716('0x46')]?_0x358770['attributes']:_0x4a74e1[_0x6716('0x44')];if(!_0x15ed4a[_0x6716('0x40')]['hasOwnProperty']('nolimit')){_0x358770['limit']=qs[_0x6716('0x2e')](_0x15ed4a[_0x6716('0x40')]['limit']);_0x358770[_0x6716('0x2d')]=qs['offset'](_0x15ed4a[_0x6716('0x40')][_0x6716('0x2d')]);}_0x358770[_0x6716('0x47')]=qs[_0x6716('0x48')](_0x15ed4a['query']['sort']);_0x358770[_0x6716('0x49')]=qs[_0x6716('0x41')](_[_0x6716('0x4a')](_0x15ed4a[_0x6716('0x40')],_0x4a74e1[_0x6716('0x41')]));if(_0x15ed4a['query']['filter']){_0x358770[_0x6716('0x49')]=_[_0x6716('0x4b')](_0x358770[_0x6716('0x49')],{'$or':_[_0x6716('0x3a')](_0x1d0ba9,function(_0x182478){if(_0x182478['type']!==_0x6716('0x4c')){var _0x46c4ca={};_0x46c4ca[_0x182478[_0x6716('0x37')]]={'$like':'%'+_0x15ed4a['query'][_0x6716('0x4d')]+'%'};return _0x46c4ca;}})});}_0x358770=_['merge']({},_0x358770,_0x15ed4a[_0x6716('0x4e')]);var _0x58bea3={'where':_0x358770[_0x6716('0x49')]};return db[_0x6716('0x4f')][_0x6716('0x2c')](_0x58bea3)['then'](function(_0x50542e){_0x39738c[_0x6716('0x2c')]=_0x50542e;if(_0x15ed4a[_0x6716('0x40')][_0x6716('0x50')]){_0x358770[_0x6716('0x51')]=[{'all':!![]}];}return db[_0x6716('0x4f')][_0x6716('0x52')](_0x358770);})['then'](function(_0x3b4b42){_0x39738c[_0x6716('0x53')]=_0x3b4b42;return _0x39738c;})[_0x6716('0x1d')](respondWithFilteredResult(_0xc15aa4,_0x358770))[_0x6716('0x28')](handleError(_0xc15aa4,null));};exports[_0x6716('0x54')]=function(_0xab2617,_0x5c5f7d){var _0xb501d2={'raw':![],'where':{'id':_0xab2617[_0x6716('0x55')]['id']}},_0x14e642={};_0x14e642[_0x6716('0x44')]=_[_0x6716('0x3f')](db['SalesforceConfiguration'][_0x6716('0x3b')]);_0x14e642[_0x6716('0x40')]=_[_0x6716('0x3f')](_0xab2617[_0x6716('0x40')]);_0x14e642[_0x6716('0x41')]=_[_0x6716('0x42')](_0x14e642[_0x6716('0x44')],_0x14e642[_0x6716('0x40')]);_0xb501d2[_0x6716('0x43')]=_['intersection'](_0x14e642['model'],qs['fields'](_0xab2617[_0x6716('0x40')][_0x6716('0x45')]));_0xb501d2[_0x6716('0x43')]=_0xb501d2[_0x6716('0x43')][_0x6716('0x46')]?_0xb501d2[_0x6716('0x43')]:_0x14e642['model'];if(_0xab2617['query'][_0x6716('0x50')]){_0xb501d2['include']=[{'all':!![]}];}_0xb501d2=_[_0x6716('0x4b')]({},_0xb501d2,_0xab2617['options']);return db[_0x6716('0x4f')]['find'](_0xb501d2)[_0x6716('0x1d')](handleEntityNotFound(_0x5c5f7d,null))[_0x6716('0x1d')](respondWithResult(_0x5c5f7d,null))[_0x6716('0x28')](handleError(_0x5c5f7d,null));};exports[_0x6716('0x56')]=function(_0x1ef02d,_0x305b6c){return db[_0x6716('0x4f')][_0x6716('0x56')](_0x1ef02d[_0x6716('0x57')],{})[_0x6716('0x1d')](respondWithResult(_0x305b6c,0xc9))[_0x6716('0x28')](handleError(_0x305b6c,null));};exports[_0x6716('0x34')]=function(_0xe6e97a,_0x136112){if(_0xe6e97a['body']['id']){delete _0xe6e97a[_0x6716('0x57')]['id'];}return db['SalesforceConfiguration'][_0x6716('0x58')]({'where':{'id':_0xe6e97a[_0x6716('0x55')]['id']}})['then'](handleEntityNotFound(_0x136112,null))['then'](saveUpdates(_0xe6e97a[_0x6716('0x57')],null))[_0x6716('0x1d')](respondWithResult(_0x136112,null))['catch'](handleError(_0x136112,null));};exports[_0x6716('0x35')]=function(_0x5b9e31,_0xf715a0){return db['SalesforceConfiguration'][_0x6716('0x58')]({'where':{'id':_0x5b9e31[_0x6716('0x55')]['id']}})[_0x6716('0x1d')](handleEntityNotFound(_0xf715a0,null))[_0x6716('0x1d')](removeEntity(_0xf715a0,null))[_0x6716('0x28')](handleError(_0xf715a0,null));};exports['getFields']=function(_0x3b524b,_0x2d6172,_0x56292d){var _0x40f014={};var _0x14bdc0={};var _0x23757c;var _0x394b5d;return db[_0x6716('0x4f')][_0x6716('0x59')]({'where':{'id':_0x3b524b['params']['id']}})['then'](handleEntityNotFound(_0x2d6172,null))['then'](function(_0x2bb21f){if(_0x2bb21f){_0x23757c=_0x2bb21f;_0x14bdc0[_0x6716('0x44')]=_[_0x6716('0x3f')](db[_0x6716('0x5a')][_0x6716('0x3b')]);_0x14bdc0[_0x6716('0x40')]=_['keys'](_0x3b524b['query']);_0x14bdc0[_0x6716('0x41')]=_[_0x6716('0x42')](_0x14bdc0['model'],_0x14bdc0[_0x6716('0x40')]);_0x40f014['attributes']=_[_0x6716('0x42')](_0x14bdc0[_0x6716('0x44')],qs[_0x6716('0x45')](_0x3b524b[_0x6716('0x40')][_0x6716('0x45')]));_0x40f014[_0x6716('0x43')]=_0x40f014['attributes'][_0x6716('0x46')]?_0x40f014[_0x6716('0x43')]:_0x14bdc0[_0x6716('0x44')];_0x40f014[_0x6716('0x47')]=qs[_0x6716('0x48')](_0x3b524b[_0x6716('0x40')][_0x6716('0x48')]);_0x40f014[_0x6716('0x49')]=qs[_0x6716('0x41')](_[_0x6716('0x4a')](_0x3b524b[_0x6716('0x40')],_0x14bdc0[_0x6716('0x41')]));if(_0x3b524b[_0x6716('0x40')][_0x6716('0x4d')]){_0x40f014[_0x6716('0x49')]=_['merge'](_0x40f014[_0x6716('0x49')],{'$or':_[_0x6716('0x3a')](_0x40f014[_0x6716('0x43')],function(_0x418639){var _0x256180={};_0x256180[_0x418639]={'$like':'%'+_0x3b524b[_0x6716('0x40')]['filter']+'%'};return _0x256180;})});}_0x40f014=_[_0x6716('0x4b')]({},_0x40f014,_0x3b524b[_0x6716('0x4e')]);return _0x23757c[_0x6716('0x5b')](_0x40f014);}})[_0x6716('0x1d')](function(_0x30abb4){if(_0x30abb4){_0x394b5d=_0x30abb4[_0x6716('0x46')];if(!_0x3b524b['query'][_0x6716('0x5c')]('nolimit')){_0x40f014['limit']=qs[_0x6716('0x2e')](_0x3b524b['query'][_0x6716('0x2e')]);_0x40f014[_0x6716('0x2d')]=qs[_0x6716('0x2d')](_0x3b524b[_0x6716('0x40')][_0x6716('0x2d')]);}return _0x23757c[_0x6716('0x5b')](_0x40f014);}})[_0x6716('0x1d')](function(_0x56de1a){if(_0x56de1a){return _0x56de1a?{'count':_0x394b5d,'rows':_0x56de1a}:null;}})[_0x6716('0x1d')](respondWithResult(_0x2d6172,null))[_0x6716('0x28')](handleError(_0x2d6172,null));};exports[_0x6716('0x5d')]=function(_0x57158e,_0x431886,_0x156834){var _0x476356={};var _0x5e8b85={};var _0x151c1d;var _0x1b8532;return db['SalesforceConfiguration'][_0x6716('0x59')]({'where':{'id':_0x57158e['params']['id']}})[_0x6716('0x1d')](handleEntityNotFound(_0x431886,null))[_0x6716('0x1d')](function(_0x57d9fd){if(_0x57d9fd){_0x151c1d=_0x57d9fd;_0x5e8b85['model']=_[_0x6716('0x3f')](db[_0x6716('0x5a')]['rawAttributes']);_0x5e8b85[_0x6716('0x40')]=_['keys'](_0x57158e[_0x6716('0x40')]);_0x5e8b85['filters']=_['intersection'](_0x5e8b85[_0x6716('0x44')],_0x5e8b85[_0x6716('0x40')]);_0x476356['attributes']=_['intersection'](_0x5e8b85[_0x6716('0x44')],qs[_0x6716('0x45')](_0x57158e[_0x6716('0x40')]['fields']));_0x476356[_0x6716('0x43')]=_0x476356['attributes'][_0x6716('0x46')]?_0x476356[_0x6716('0x43')]:_0x5e8b85[_0x6716('0x44')];_0x476356[_0x6716('0x47')]=qs['sort'](_0x57158e[_0x6716('0x40')][_0x6716('0x48')]);_0x476356[_0x6716('0x49')]=qs[_0x6716('0x41')](_[_0x6716('0x4a')](_0x57158e[_0x6716('0x40')],_0x5e8b85['filters']));if(_0x57158e[_0x6716('0x40')]['filter']){_0x476356[_0x6716('0x49')]=_[_0x6716('0x4b')](_0x476356['where'],{'$or':_[_0x6716('0x3a')](_0x476356[_0x6716('0x43')],function(_0x2cf543){var _0x4178fa={};_0x4178fa[_0x2cf543]={'$like':'%'+_0x57158e[_0x6716('0x40')][_0x6716('0x4d')]+'%'};return _0x4178fa;})});}_0x476356=_[_0x6716('0x4b')]({},_0x476356,_0x57158e[_0x6716('0x4e')]);return _0x151c1d['getSubjects'](_0x476356);}})[_0x6716('0x1d')](function(_0x477bf2){if(_0x477bf2){_0x1b8532=_0x477bf2[_0x6716('0x46')];if(!_0x57158e['query'][_0x6716('0x5c')](_0x6716('0x5e'))){_0x476356[_0x6716('0x2e')]=qs[_0x6716('0x2e')](_0x57158e[_0x6716('0x40')]['limit']);_0x476356[_0x6716('0x2d')]=qs[_0x6716('0x2d')](_0x57158e[_0x6716('0x40')][_0x6716('0x2d')]);}return _0x151c1d[_0x6716('0x5d')](_0x476356);}})[_0x6716('0x1d')](function(_0x28b1dc){if(_0x28b1dc){return _0x28b1dc?{'count':_0x1b8532,'rows':_0x28b1dc}:null;}})[_0x6716('0x1d')](respondWithResult(_0x431886,null))[_0x6716('0x28')](handleError(_0x431886,null));};exports[_0x6716('0x5f')]=function(_0x3d9176,_0x369c84,_0x49d5e0){var _0x3c812f={};var _0x5f41da={};var _0x590a78;var _0x292830;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x3d9176[_0x6716('0x55')]['id']}})[_0x6716('0x1d')](handleEntityNotFound(_0x369c84,null))['then'](function(_0x29e5f6){if(_0x29e5f6){_0x590a78=_0x29e5f6;_0x5f41da[_0x6716('0x44')]=_[_0x6716('0x3f')](db[_0x6716('0x5a')][_0x6716('0x3b')]);_0x5f41da[_0x6716('0x40')]=_[_0x6716('0x3f')](_0x3d9176[_0x6716('0x40')]);_0x5f41da[_0x6716('0x41')]=_[_0x6716('0x42')](_0x5f41da[_0x6716('0x44')],_0x5f41da[_0x6716('0x40')]);_0x3c812f[_0x6716('0x43')]=_[_0x6716('0x42')](_0x5f41da[_0x6716('0x44')],qs[_0x6716('0x45')](_0x3d9176[_0x6716('0x40')][_0x6716('0x45')]));_0x3c812f[_0x6716('0x43')]=_0x3c812f['attributes'][_0x6716('0x46')]?_0x3c812f[_0x6716('0x43')]:_0x5f41da[_0x6716('0x44')];_0x3c812f[_0x6716('0x47')]=qs[_0x6716('0x48')](_0x3d9176[_0x6716('0x40')][_0x6716('0x48')]);_0x3c812f[_0x6716('0x49')]=qs[_0x6716('0x41')](_[_0x6716('0x4a')](_0x3d9176[_0x6716('0x40')],_0x5f41da[_0x6716('0x41')]));if(_0x3d9176[_0x6716('0x40')][_0x6716('0x4d')]){_0x3c812f['where']=_[_0x6716('0x4b')](_0x3c812f[_0x6716('0x49')],{'$or':_[_0x6716('0x3a')](_0x3c812f[_0x6716('0x43')],function(_0x29b54e){var _0x57bd08={};_0x57bd08[_0x29b54e]={'$like':'%'+_0x3d9176[_0x6716('0x40')]['filter']+'%'};return _0x57bd08;})});}_0x3c812f=_[_0x6716('0x4b')]({},_0x3c812f,_0x3d9176['options']);return _0x590a78[_0x6716('0x5f')](_0x3c812f);}})[_0x6716('0x1d')](function(_0x1e958d){if(_0x1e958d){_0x292830=_0x1e958d['length'];if(!_0x3d9176[_0x6716('0x40')]['hasOwnProperty'](_0x6716('0x5e'))){_0x3c812f[_0x6716('0x2e')]=qs[_0x6716('0x2e')](_0x3d9176['query']['limit']);_0x3c812f[_0x6716('0x2d')]=qs[_0x6716('0x2d')](_0x3d9176['query'][_0x6716('0x2d')]);}return _0x590a78[_0x6716('0x5f')](_0x3c812f);}})[_0x6716('0x1d')](function(_0x411e55){if(_0x411e55){return _0x411e55?{'count':_0x292830,'rows':_0x411e55}:null;}})['then'](respondWithResult(_0x369c84,null))[_0x6716('0x28')](handleError(_0x369c84,null));}; \ No newline at end of file +var _0xd26a=['name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','params','keys','options','create','body','find','getFields','findOne','SalesforceField','length','hasOwnProperty','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','update','destroy','stack'];(function(_0x587fb5,_0x59cb3b){var _0x551105=function(_0x5bbef4){while(--_0x5bbef4){_0x587fb5['push'](_0x587fb5['shift']());}};_0x551105(++_0x59cb3b);}(_0xd26a,0xed));var _0xad26=function(_0x3b8d4d,_0x272530){_0x3b8d4d=_0x3b8d4d-0x0;var _0x3f04c4=_0xd26a[_0x3b8d4d];return _0x3f04c4;};'use strict';var pdf=require(_0xad26('0x0'));var emlformat=require(_0xad26('0x1'));var rimraf=require(_0xad26('0x2'));var zipdir=require(_0xad26('0x3'));var jsonpatch=require(_0xad26('0x4'));var rp=require(_0xad26('0x5'));var moment=require(_0xad26('0x6'));var BPromise=require(_0xad26('0x7'));var Mustache=require(_0xad26('0x8'));var util=require(_0xad26('0x9'));var path=require(_0xad26('0xa'));var sox=require(_0xad26('0xb'));var csv=require('to-csv');var ejs=require(_0xad26('0xc'));var fs=require('fs');var _=require(_0xad26('0xd'));var squel=require('squel');var crypto=require(_0xad26('0xe'));var jsforce=require(_0xad26('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xad26('0x10'));var querystring=require('querystring');var Papa=require(_0xad26('0x11'));var Redis=require(_0xad26('0x12'));var authService=require(_0xad26('0x13'));var qs=require(_0xad26('0x14'));var as=require(_0xad26('0x15'));var hardwareService=require(_0xad26('0x16'));var logger=require(_0xad26('0x17'))('api');var utils=require(_0xad26('0x18'));var config=require(_0xad26('0x19'));var db=require(_0xad26('0x1a'))['db'];var jayson=require(_0xad26('0x1b'));var client=jayson[_0xad26('0x1c')]['http']({'port':0x232a});function checkPasswordPattern(_0x598446,_0x5e43cf,_0x225319){if(_0x225319){var _0x1e5ea7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1e5ea7[_0xad26('0x1d')](_0x5e43cf)){return _0x598446;}else{throw new db[(_0xad26('0x1e'))][(_0xad26('0x1f'))](_0xad26('0x20'));}}else{return _0x598446;}}function respondWithRpcPromise(_0x5e753d,_0x485091,_0x323182,_0x18c846){return new BPromise(function(_0x4bfb07,_0x40a4be){var _0x25a975=_0x18c846||client;return _0x25a975['request'](_0x5e753d,_0x323182)[_0xad26('0x21')](function(_0x1170b3){logger[_0xad26('0x22')](_0xad26('0x23'),_0x485091,'request\x20sent');logger[_0xad26('0x24')](_0xad26('0x25'),_0x485091,_0xad26('0x26'),JSON[_0xad26('0x27')](_0x1170b3));if(_0x1170b3[_0xad26('0x28')]){if(_0x1170b3['error'][_0xad26('0x29')]===0x1f4){logger[_0xad26('0x28')](_0xad26('0x23'),_0x485091,_0x1170b3[_0xad26('0x28')][_0xad26('0x2a')]);return _0x40a4be(_0x1170b3[_0xad26('0x28')]['message']);}logger[_0xad26('0x28')](_0xad26('0x23'),_0x485091,_0x1170b3[_0xad26('0x28')][_0xad26('0x2a')]);return _0x4bfb07(_0x1170b3['error'][_0xad26('0x2a')]);}else{logger[_0xad26('0x22')](_0xad26('0x23'),_0x485091,_0xad26('0x26'));_0x4bfb07(_0x1170b3[_0xad26('0x2b')][_0xad26('0x2a')]);}})[_0xad26('0x2c')](function(_0x4b1436){logger['error'](_0xad26('0x23'),_0x485091,_0x4b1436);_0x40a4be(_0x4b1436);});});}function respondWithStatusCode(_0x1ad9be,_0x5c9bb3){_0x5c9bb3=_0x5c9bb3||0xcc;return function(_0x383d64){if(_0x383d64){return _0x1ad9be[_0xad26('0x2d')](_0x5c9bb3);}return _0x1ad9be[_0xad26('0x2e')](_0x5c9bb3)[_0xad26('0x2f')]();};}function respondWithResult(_0x5cf8ad,_0x1f109f){_0x1f109f=_0x1f109f||0xc8;return function(_0x2699ae){if(_0x2699ae){return _0x5cf8ad['status'](_0x1f109f)[_0xad26('0x30')](_0x2699ae);}};}function respondWithFilteredResult(_0x23a211,_0x34d30b){return function(_0xace7b9){if(_0xace7b9){var _0x2b6876=_0xace7b9[_0xad26('0x31')],_0xa2bbc9=_0x34d30b[_0xad26('0x32')],_0x1ba879=_0x34d30b[_0xad26('0x32')]+_0x34d30b['limit'],_0x5047f3;if(_0x1ba879>=_0x2b6876){_0x1ba879=_0x2b6876;_0x5047f3=0xc8;}else{_0x5047f3=0xce;}_0x23a211[_0xad26('0x2e')](_0x5047f3);return _0x23a211['set'](_0xad26('0x33'),_0xa2bbc9+'-'+_0x1ba879+'/'+_0x2b6876)[_0xad26('0x30')](_0xace7b9);}return null;};}function patchUpdates(_0x14a18a){return function(_0x50276a){try{jsonpatch[_0xad26('0x34')](_0x50276a,_0x14a18a,!![]);}catch(_0xa1368b){return BPromise[_0xad26('0x35')](_0xa1368b);}return _0x50276a['save']();};}function saveUpdates(_0x4df59a,_0x58af94){return function(_0x2b6a54){if(_0x2b6a54){return _0x2b6a54[_0xad26('0x36')](_0x4df59a)['then'](function(_0x25efd5){return _0x25efd5;});}return null;};}function removeEntity(_0x5f017b,_0x49e5d1){return function(_0x2f3e97){if(_0x2f3e97){return _0x2f3e97[_0xad26('0x37')]()[_0xad26('0x21')](function(){_0x5f017b['status'](0xcc)[_0xad26('0x2f')]();});}};}function handleEntityNotFound(_0x4a6e66,_0x102db4){return function(_0x3db34e){if(!_0x3db34e){_0x4a6e66[_0xad26('0x2d')](0x194);}return _0x3db34e;};}function handleError(_0x2e9d9b,_0x382043){_0x382043=_0x382043||0x1f4;return function(_0x342d4a){logger[_0xad26('0x28')](_0x342d4a[_0xad26('0x38')]);if(_0x342d4a[_0xad26('0x39')]){delete _0x342d4a[_0xad26('0x39')];}_0x2e9d9b['status'](_0x382043)[_0xad26('0x3a')](_0x342d4a);};}exports[_0xad26('0x3b')]=function(_0x1516d8,_0x7bfdd){var _0x104924={},_0x7a55f3={},_0x2f8292={'count':0x0,'rows':[]};var _0x25e9e1=_[_0xad26('0x3c')](db[_0xad26('0x3d')][_0xad26('0x3e')],function(_0x25bd42){return{'name':_0x25bd42[_0xad26('0x3f')],'type':_0x25bd42[_0xad26('0x40')][_0xad26('0x41')]};});_0x7a55f3[_0xad26('0x42')]=_['map'](_0x25e9e1,_0xad26('0x39'));_0x7a55f3[_0xad26('0x43')]=_['keys'](_0x1516d8['query']);_0x7a55f3[_0xad26('0x44')]=_['intersection'](_0x7a55f3[_0xad26('0x42')],_0x7a55f3[_0xad26('0x43')]);_0x104924[_0xad26('0x45')]=_[_0xad26('0x46')](_0x7a55f3['model'],qs[_0xad26('0x47')](_0x1516d8[_0xad26('0x43')]['fields']));_0x104924[_0xad26('0x45')]=_0x104924[_0xad26('0x45')]['length']?_0x104924[_0xad26('0x45')]:_0x7a55f3[_0xad26('0x42')];if(!_0x1516d8[_0xad26('0x43')]['hasOwnProperty'](_0xad26('0x48'))){_0x104924['limit']=qs[_0xad26('0x49')](_0x1516d8[_0xad26('0x43')][_0xad26('0x49')]);_0x104924[_0xad26('0x32')]=qs[_0xad26('0x32')](_0x1516d8[_0xad26('0x43')][_0xad26('0x32')]);}_0x104924[_0xad26('0x4a')]=qs[_0xad26('0x4b')](_0x1516d8[_0xad26('0x43')][_0xad26('0x4b')]);_0x104924[_0xad26('0x4c')]=qs[_0xad26('0x44')](_[_0xad26('0x4d')](_0x1516d8[_0xad26('0x43')],_0x7a55f3['filters']));if(_0x1516d8['query'][_0xad26('0x4e')]){_0x104924[_0xad26('0x4c')]=_['merge'](_0x104924[_0xad26('0x4c')],{'$or':_[_0xad26('0x3c')](_0x25e9e1,function(_0x58c114){if(_0x58c114[_0xad26('0x40')]!==_0xad26('0x4f')){var _0xb5f18a={};_0xb5f18a[_0x58c114[_0xad26('0x39')]]={'$like':'%'+_0x1516d8['query']['filter']+'%'};return _0xb5f18a;}})});}_0x104924=_[_0xad26('0x50')]({},_0x104924,_0x1516d8['options']);var _0x2b57fd={'where':_0x104924[_0xad26('0x4c')]};return db[_0xad26('0x3d')][_0xad26('0x31')](_0x2b57fd)[_0xad26('0x21')](function(_0x24eaec){_0x2f8292[_0xad26('0x31')]=_0x24eaec;if(_0x1516d8['query'][_0xad26('0x51')]){_0x104924[_0xad26('0x52')]=[{'all':!![]}];}return db[_0xad26('0x3d')][_0xad26('0x53')](_0x104924);})[_0xad26('0x21')](function(_0x12b4a1){_0x2f8292[_0xad26('0x54')]=_0x12b4a1;return _0x2f8292;})[_0xad26('0x21')](respondWithFilteredResult(_0x7bfdd,_0x104924))['catch'](handleError(_0x7bfdd,null));};exports['show']=function(_0x16878e,_0x3df9f6){var _0x474c2e={'raw':![],'where':{'id':_0x16878e[_0xad26('0x55')]['id']}},_0xf2229={};_0xf2229['model']=_[_0xad26('0x56')](db[_0xad26('0x3d')][_0xad26('0x3e')]);_0xf2229[_0xad26('0x43')]=_[_0xad26('0x56')](_0x16878e['query']);_0xf2229['filters']=_[_0xad26('0x46')](_0xf2229[_0xad26('0x42')],_0xf2229[_0xad26('0x43')]);_0x474c2e[_0xad26('0x45')]=_[_0xad26('0x46')](_0xf2229['model'],qs[_0xad26('0x47')](_0x16878e[_0xad26('0x43')][_0xad26('0x47')]));_0x474c2e[_0xad26('0x45')]=_0x474c2e[_0xad26('0x45')]['length']?_0x474c2e[_0xad26('0x45')]:_0xf2229[_0xad26('0x42')];if(_0x16878e['query'][_0xad26('0x51')]){_0x474c2e[_0xad26('0x52')]=[{'all':!![]}];}_0x474c2e=_[_0xad26('0x50')]({},_0x474c2e,_0x16878e[_0xad26('0x57')]);return db['SalesforceConfiguration']['find'](_0x474c2e)['then'](handleEntityNotFound(_0x3df9f6,null))['then'](respondWithResult(_0x3df9f6,null))[_0xad26('0x2c')](handleError(_0x3df9f6,null));};exports[_0xad26('0x58')]=function(_0x22884e,_0x167730){return db[_0xad26('0x3d')][_0xad26('0x58')](_0x22884e['body'],{})[_0xad26('0x21')](respondWithResult(_0x167730,0xc9))[_0xad26('0x2c')](handleError(_0x167730,null));};exports['update']=function(_0x44db15,_0x4c1507){if(_0x44db15[_0xad26('0x59')]['id']){delete _0x44db15[_0xad26('0x59')]['id'];}return db[_0xad26('0x3d')][_0xad26('0x5a')]({'where':{'id':_0x44db15[_0xad26('0x55')]['id']}})[_0xad26('0x21')](handleEntityNotFound(_0x4c1507,null))['then'](saveUpdates(_0x44db15['body'],null))[_0xad26('0x21')](respondWithResult(_0x4c1507,null))[_0xad26('0x2c')](handleError(_0x4c1507,null));};exports[_0xad26('0x37')]=function(_0x515c52,_0x2b5cc0){return db['SalesforceConfiguration'][_0xad26('0x5a')]({'where':{'id':_0x515c52[_0xad26('0x55')]['id']}})[_0xad26('0x21')](handleEntityNotFound(_0x2b5cc0,null))['then'](removeEntity(_0x2b5cc0,null))['catch'](handleError(_0x2b5cc0,null));};exports[_0xad26('0x5b')]=function(_0x1ae972,_0x1b4faa,_0x5a1bb8){var _0x1f64a0={};var _0x454bdb={};var _0x3dbf68;var _0x2a1d7c;return db[_0xad26('0x3d')][_0xad26('0x5c')]({'where':{'id':_0x1ae972[_0xad26('0x55')]['id']}})['then'](handleEntityNotFound(_0x1b4faa,null))['then'](function(_0x5df938){if(_0x5df938){_0x3dbf68=_0x5df938;_0x454bdb['model']=_['keys'](db[_0xad26('0x5d')][_0xad26('0x3e')]);_0x454bdb['query']=_[_0xad26('0x56')](_0x1ae972[_0xad26('0x43')]);_0x454bdb['filters']=_[_0xad26('0x46')](_0x454bdb[_0xad26('0x42')],_0x454bdb[_0xad26('0x43')]);_0x1f64a0[_0xad26('0x45')]=_[_0xad26('0x46')](_0x454bdb[_0xad26('0x42')],qs[_0xad26('0x47')](_0x1ae972[_0xad26('0x43')]['fields']));_0x1f64a0['attributes']=_0x1f64a0['attributes']['length']?_0x1f64a0[_0xad26('0x45')]:_0x454bdb[_0xad26('0x42')];_0x1f64a0[_0xad26('0x4a')]=qs[_0xad26('0x4b')](_0x1ae972[_0xad26('0x43')][_0xad26('0x4b')]);_0x1f64a0[_0xad26('0x4c')]=qs['filters'](_['pick'](_0x1ae972[_0xad26('0x43')],_0x454bdb[_0xad26('0x44')]));if(_0x1ae972[_0xad26('0x43')][_0xad26('0x4e')]){_0x1f64a0[_0xad26('0x4c')]=_['merge'](_0x1f64a0[_0xad26('0x4c')],{'$or':_[_0xad26('0x3c')](_0x1f64a0[_0xad26('0x45')],function(_0x882e81){var _0x56f2d6={};_0x56f2d6[_0x882e81]={'$like':'%'+_0x1ae972['query']['filter']+'%'};return _0x56f2d6;})});}_0x1f64a0=_[_0xad26('0x50')]({},_0x1f64a0,_0x1ae972[_0xad26('0x57')]);return _0x3dbf68[_0xad26('0x5b')](_0x1f64a0);}})['then'](function(_0x1d9bd3){if(_0x1d9bd3){_0x2a1d7c=_0x1d9bd3[_0xad26('0x5e')];if(!_0x1ae972[_0xad26('0x43')][_0xad26('0x5f')](_0xad26('0x48'))){_0x1f64a0[_0xad26('0x49')]=qs[_0xad26('0x49')](_0x1ae972[_0xad26('0x43')][_0xad26('0x49')]);_0x1f64a0[_0xad26('0x32')]=qs[_0xad26('0x32')](_0x1ae972[_0xad26('0x43')]['offset']);}return _0x3dbf68[_0xad26('0x5b')](_0x1f64a0);}})[_0xad26('0x21')](function(_0x10e294){if(_0x10e294){return _0x10e294?{'count':_0x2a1d7c,'rows':_0x10e294}:null;}})[_0xad26('0x21')](respondWithResult(_0x1b4faa,null))['catch'](handleError(_0x1b4faa,null));};exports[_0xad26('0x60')]=function(_0x572ee9,_0x1a4136,_0x2c512c){var _0x2939a7={};var _0xbc8252={};var _0x5b9194;var _0x1fc36f;return db[_0xad26('0x3d')][_0xad26('0x5c')]({'where':{'id':_0x572ee9[_0xad26('0x55')]['id']}})[_0xad26('0x21')](handleEntityNotFound(_0x1a4136,null))['then'](function(_0x5543c0){if(_0x5543c0){_0x5b9194=_0x5543c0;_0xbc8252[_0xad26('0x42')]=_['keys'](db[_0xad26('0x5d')][_0xad26('0x3e')]);_0xbc8252[_0xad26('0x43')]=_[_0xad26('0x56')](_0x572ee9[_0xad26('0x43')]);_0xbc8252['filters']=_[_0xad26('0x46')](_0xbc8252[_0xad26('0x42')],_0xbc8252[_0xad26('0x43')]);_0x2939a7[_0xad26('0x45')]=_[_0xad26('0x46')](_0xbc8252[_0xad26('0x42')],qs['fields'](_0x572ee9[_0xad26('0x43')]['fields']));_0x2939a7[_0xad26('0x45')]=_0x2939a7[_0xad26('0x45')]['length']?_0x2939a7[_0xad26('0x45')]:_0xbc8252[_0xad26('0x42')];_0x2939a7[_0xad26('0x4a')]=qs[_0xad26('0x4b')](_0x572ee9['query']['sort']);_0x2939a7[_0xad26('0x4c')]=qs[_0xad26('0x44')](_[_0xad26('0x4d')](_0x572ee9['query'],_0xbc8252[_0xad26('0x44')]));if(_0x572ee9[_0xad26('0x43')][_0xad26('0x4e')]){_0x2939a7[_0xad26('0x4c')]=_[_0xad26('0x50')](_0x2939a7[_0xad26('0x4c')],{'$or':_[_0xad26('0x3c')](_0x2939a7[_0xad26('0x45')],function(_0x1b5c29){var _0x1a6416={};_0x1a6416[_0x1b5c29]={'$like':'%'+_0x572ee9[_0xad26('0x43')][_0xad26('0x4e')]+'%'};return _0x1a6416;})});}_0x2939a7=_[_0xad26('0x50')]({},_0x2939a7,_0x572ee9['options']);return _0x5b9194[_0xad26('0x60')](_0x2939a7);}})[_0xad26('0x21')](function(_0x5b9087){if(_0x5b9087){_0x1fc36f=_0x5b9087['length'];if(!_0x572ee9[_0xad26('0x43')][_0xad26('0x5f')](_0xad26('0x48'))){_0x2939a7[_0xad26('0x49')]=qs[_0xad26('0x49')](_0x572ee9[_0xad26('0x43')][_0xad26('0x49')]);_0x2939a7[_0xad26('0x32')]=qs[_0xad26('0x32')](_0x572ee9[_0xad26('0x43')][_0xad26('0x32')]);}return _0x5b9194['getSubjects'](_0x2939a7);}})[_0xad26('0x21')](function(_0x553c80){if(_0x553c80){return _0x553c80?{'count':_0x1fc36f,'rows':_0x553c80}:null;}})[_0xad26('0x21')](respondWithResult(_0x1a4136,null))['catch'](handleError(_0x1a4136,null));};exports['getDescriptions']=function(_0x126568,_0x4926ad,_0x2bc39c){var _0x5b982f={};var _0x2f4e95={};var _0x279fda;var _0x43610a;return db['SalesforceConfiguration'][_0xad26('0x5c')]({'where':{'id':_0x126568[_0xad26('0x55')]['id']}})['then'](handleEntityNotFound(_0x4926ad,null))[_0xad26('0x21')](function(_0x4d0e4e){if(_0x4d0e4e){_0x279fda=_0x4d0e4e;_0x2f4e95['model']=_[_0xad26('0x56')](db[_0xad26('0x5d')]['rawAttributes']);_0x2f4e95[_0xad26('0x43')]=_['keys'](_0x126568[_0xad26('0x43')]);_0x2f4e95[_0xad26('0x44')]=_[_0xad26('0x46')](_0x2f4e95[_0xad26('0x42')],_0x2f4e95[_0xad26('0x43')]);_0x5b982f[_0xad26('0x45')]=_[_0xad26('0x46')](_0x2f4e95[_0xad26('0x42')],qs[_0xad26('0x47')](_0x126568[_0xad26('0x43')][_0xad26('0x47')]));_0x5b982f[_0xad26('0x45')]=_0x5b982f['attributes']['length']?_0x5b982f[_0xad26('0x45')]:_0x2f4e95[_0xad26('0x42')];_0x5b982f[_0xad26('0x4a')]=qs[_0xad26('0x4b')](_0x126568['query'][_0xad26('0x4b')]);_0x5b982f[_0xad26('0x4c')]=qs[_0xad26('0x44')](_[_0xad26('0x4d')](_0x126568[_0xad26('0x43')],_0x2f4e95[_0xad26('0x44')]));if(_0x126568[_0xad26('0x43')][_0xad26('0x4e')]){_0x5b982f['where']=_[_0xad26('0x50')](_0x5b982f[_0xad26('0x4c')],{'$or':_[_0xad26('0x3c')](_0x5b982f['attributes'],function(_0x3b9d4d){var _0x3190ae={};_0x3190ae[_0x3b9d4d]={'$like':'%'+_0x126568[_0xad26('0x43')][_0xad26('0x4e')]+'%'};return _0x3190ae;})});}_0x5b982f=_['merge']({},_0x5b982f,_0x126568[_0xad26('0x57')]);return _0x279fda[_0xad26('0x61')](_0x5b982f);}})[_0xad26('0x21')](function(_0x247bcb){if(_0x247bcb){_0x43610a=_0x247bcb[_0xad26('0x5e')];if(!_0x126568[_0xad26('0x43')][_0xad26('0x5f')](_0xad26('0x48'))){_0x5b982f['limit']=qs[_0xad26('0x49')](_0x126568[_0xad26('0x43')][_0xad26('0x49')]);_0x5b982f[_0xad26('0x32')]=qs[_0xad26('0x32')](_0x126568[_0xad26('0x43')][_0xad26('0x32')]);}return _0x279fda[_0xad26('0x61')](_0x5b982f);}})[_0xad26('0x21')](function(_0xe963f2){if(_0xe963f2){return _0xe963f2?{'count':_0x43610a,'rows':_0xe963f2}:null;}})[_0xad26('0x21')](respondWithResult(_0x4926ad,null))[_0xad26('0x2c')](handleError(_0x4926ad,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 0f3cf9a..9a69c67 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 _0xbc8b=['exports','define','SalesforceConfiguration','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceConfiguration.attributes'];(function(_0x1fcbcd,_0x4a5cd4){var _0x516f9c=function(_0x213e3b){while(--_0x213e3b){_0x1fcbcd['push'](_0x1fcbcd['shift']());}};_0x516f9c(++_0x4a5cd4);}(_0xbc8b,0x10b));var _0xbbc8=function(_0x3f3f06,_0x581e5b){_0x3f3f06=_0x3f3f06-0x0;var _0x140feb=_0xbc8b[_0x3f3f06];return _0x140feb;};'use strict';var _=require(_0xbbc8('0x0'));var util=require(_0xbbc8('0x1'));var logger=require('../../config/logger')(_0xbbc8('0x2'));var moment=require(_0xbbc8('0x3'));var BPromise=require(_0xbbc8('0x4'));var rp=require(_0xbbc8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbbc8('0x6'));var config=require(_0xbbc8('0x7'));var attributes=require(_0xbbc8('0x8'));module[_0xbbc8('0x9')]=function(_0x25ca87,_0x335eba){return _0x25ca87[_0xbbc8('0xa')](_0xbbc8('0xb'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ed0=['request-promise','path','rimraf','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','../../config/logger','api','moment'];(function(_0x3a2f38,_0x4b2d68){var _0x7b20da=function(_0x59fe05){while(--_0x59fe05){_0x3a2f38['push'](_0x3a2f38['shift']());}};_0x7b20da(++_0x4b2d68);}(_0x2ed0,0x68));var _0x02ed=function(_0x4a02c7,_0x1d8f6d){_0x4a02c7=_0x4a02c7-0x0;var _0x400dd1=_0x2ed0[_0x4a02c7];return _0x400dd1;};'use strict';var _=require(_0x02ed('0x0'));var util=require('util');var logger=require(_0x02ed('0x1'))(_0x02ed('0x2'));var moment=require(_0x02ed('0x3'));var BPromise=require('bluebird');var rp=require(_0x02ed('0x4'));var fs=require('fs');var path=require(_0x02ed('0x5'));var rimraf=require(_0x02ed('0x6'));var config=require('../../config/environment');var attributes=require(_0x02ed('0x7'));module[_0x02ed('0x8')]=function(_0x116501,_0x3ca575){return _0x116501[_0x02ed('0x9')](_0x02ed('0xa'),attributes,{'tableName':_0x02ed('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 87be077..8468fd7 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 _0xcd1a=['SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x511bd1,_0x223e5b){var _0x4c48ec=function(_0x31814e){while(--_0x31814e){_0x511bd1['push'](_0x511bd1['shift']());}};_0x4c48ec(++_0x223e5b);}(_0xcd1a,0x7d));var _0xacd1=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xcd1a[_0x4b055c];return _0x4b62bb;};'use strict';var _=require('lodash');var util=require(_0xacd1('0x0'));var moment=require(_0xacd1('0x1'));var BPromise=require(_0xacd1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xacd1('0x3'));var db=require(_0xacd1('0x4'))['db'];var utils=require(_0xacd1('0x5'));var logger=require(_0xacd1('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xacd1('0x7'));var client=jayson[_0xacd1('0x8')][_0xacd1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x87a7c0,_0x20e08a,_0x5d16be){return new BPromise(function(_0x53b62f,_0x2309e6){return client[_0xacd1('0xa')](_0x87a7c0,_0x5d16be)['then'](function(_0x4453bf){logger[_0xacd1('0xb')](_0xacd1('0xc'),_0x20e08a,_0xacd1('0xd'));logger[_0xacd1('0xe')](_0xacd1('0xf'),_0x20e08a,'request\x20sent',JSON['stringify'](_0x4453bf));if(_0x4453bf[_0xacd1('0x10')]){if(_0x4453bf[_0xacd1('0x10')][_0xacd1('0x11')]===0x1f4){logger[_0xacd1('0x10')](_0xacd1('0xc'),_0x20e08a,_0x4453bf[_0xacd1('0x10')][_0xacd1('0x12')]);return _0x2309e6(_0x4453bf['error'][_0xacd1('0x12')]);}logger[_0xacd1('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x20e08a,_0x4453bf[_0xacd1('0x10')]['message']);return _0x53b62f(_0x4453bf[_0xacd1('0x10')][_0xacd1('0x12')]);}else{logger[_0xacd1('0xb')](_0xacd1('0xc'),_0x20e08a,_0xacd1('0xd'));_0x53b62f(_0x4453bf['result'][_0xacd1('0x12')]);}})[_0xacd1('0x13')](function(_0x2c9b98){logger[_0xacd1('0x10')](_0xacd1('0xc'),_0x20e08a,_0x2c9b98);_0x2309e6(_0x2c9b98);});});} \ No newline at end of file +var _0xd871=['debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','request\x20sent'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xd871,0xfc));var _0x1d87=function(_0x376e10,_0x17d4c2){_0x376e10=_0x376e10-0x0;var _0x8bd73f=_0xd871[_0x376e10];return _0x8bd73f;};'use strict';var _=require(_0x1d87('0x0'));var util=require('util');var moment=require(_0x1d87('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1d87('0x2'));var db=require(_0x1d87('0x3'))['db'];var utils=require(_0x1d87('0x4'));var logger=require(_0x1d87('0x5'))('rpc');var config=require(_0x1d87('0x6'));var jayson=require(_0x1d87('0x7'));var client=jayson[_0x1d87('0x8')][_0x1d87('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26ccd3,_0xcde517,_0x5b3680){return new BPromise(function(_0x3ffbb0,_0x4a83ae){return client['request'](_0x26ccd3,_0x5b3680)[_0x1d87('0xa')](function(_0x4639a7){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0xcde517,_0x1d87('0xb'));logger[_0x1d87('0xc')](_0x1d87('0xd'),_0xcde517,_0x1d87('0xb'),JSON[_0x1d87('0xe')](_0x4639a7));if(_0x4639a7[_0x1d87('0xf')]){if(_0x4639a7[_0x1d87('0xf')][_0x1d87('0x10')]===0x1f4){logger[_0x1d87('0xf')](_0x1d87('0x11'),_0xcde517,_0x4639a7['error'][_0x1d87('0x12')]);return _0x4a83ae(_0x4639a7[_0x1d87('0xf')]['message']);}logger['error'](_0x1d87('0x11'),_0xcde517,_0x4639a7[_0x1d87('0xf')][_0x1d87('0x12')]);return _0x3ffbb0(_0x4639a7['error']['message']);}else{logger[_0x1d87('0x13')](_0x1d87('0x11'),_0xcde517,_0x1d87('0xb'));_0x3ffbb0(_0x4639a7[_0x1d87('0x14')]['message']);}})[_0x1d87('0x15')](function(_0x32a62b){logger[_0x1d87('0xf')](_0x1d87('0x11'),_0xcde517,_0x32a62b);_0x4a83ae(_0x32a62b);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 4e5a3b8..6f44bd7 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 _0x6d38=['path','connect-timeout','../../components/auth/service','../../config/environment','./intSalesforceField.controller','get','index','/:id','isAuthenticated','create','put','update','delete','destroy','exports','util'];(function(_0x3b07a5,_0x4ebe01){var _0x5d845a=function(_0x39e0ec){while(--_0x39e0ec){_0x3b07a5['push'](_0x3b07a5['shift']());}};_0x5d845a(++_0x4ebe01);}(_0x6d38,0x1ef));var _0x86d3=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x6d38[_0x465028];return _0xb783d4;};'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 +var _0x0f4d=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','post','put','update','delete','exports'];(function(_0x171f96,_0x427313){var _0x13dff1=function(_0x4273fc){while(--_0x4273fc){_0x171f96['push'](_0x171f96['shift']());}};_0x13dff1(++_0x427313);}(_0x0f4d,0x12c));var _0xd0f4=function(_0x52019c,_0x3a9887){_0x52019c=_0x52019c-0x0;var _0x24d95e=_0x0f4d[_0x52019c];return _0x24d95e;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xd0f4('0x0'));var express=require('express');var router=express[_0xd0f4('0x1')]();var auth=require(_0xd0f4('0x2'));var interaction=require(_0xd0f4('0x3'));var config=require(_0xd0f4('0x4'));var controller=require(_0xd0f4('0x5'));router[_0xd0f4('0x6')]('/',auth[_0xd0f4('0x7')](),controller[_0xd0f4('0x8')]);router['get'](_0xd0f4('0x9'),auth[_0xd0f4('0x7')](),controller['show']);router[_0xd0f4('0xa')]('/',auth[_0xd0f4('0x7')](),controller['create']);router[_0xd0f4('0xb')](_0xd0f4('0x9'),auth['isAuthenticated'](),controller[_0xd0f4('0xc')]);router[_0xd0f4('0xd')](_0xd0f4('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xd0f4('0xe')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index fdbcf81..cc8c742 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 _0x77b4=['variable','customVariable','keyValue','STRING','sequelize','ENUM','string'];(function(_0x29c823,_0xc71af8){var _0x4870ff=function(_0x56e217){while(--_0x56e217){_0x29c823['push'](_0x29c823['shift']());}};_0x4870ff(++_0xc71af8);}(_0x77b4,0xf9));var _0x477b=function(_0x34158b,_0x6e54c0){_0x34158b=_0x34158b-0x0;var _0xf70991=_0x77b4[_0x34158b];return _0xf70991;};'use strict';var Sequelize=require(_0x477b('0x0'));module['exports']={'type':{'type':Sequelize[_0x477b('0x1')](_0x477b('0x2'),_0x477b('0x3'),_0x477b('0x4'),_0x477b('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x477b('0x6')]},'key':{'type':Sequelize[_0x477b('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x477b('0x2'),_0x477b('0x3'),_0x477b('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x477b('0x6')]}}; \ No newline at end of file +var _0x0485=['string','variable','customVariable','keyValue','STRING','exports','ENUM'];(function(_0x225252,_0x1241f2){var _0x1c1836=function(_0x5c9a03){while(--_0x5c9a03){_0x225252['push'](_0x225252['shift']());}};_0x1c1836(++_0x1241f2);}(_0x0485,0x1a2));var _0x5048=function(_0x334651,_0x6e99f6){_0x334651=_0x334651-0x0;var _0x29657c=_0x0485[_0x334651];return _0x29657c;};'use strict';var Sequelize=require('sequelize');module[_0x5048('0x0')]={'type':{'type':Sequelize[_0x5048('0x1')](_0x5048('0x2'),_0x5048('0x3'),_0x5048('0x4'),_0x5048('0x5')),'defaultValue':_0x5048('0x2')},'content':{'type':Sequelize[_0x5048('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x5048('0x1')](_0x5048('0x2'),_0x5048('0x3'),_0x5048('0x4'))},'keyContent':{'type':Sequelize[_0x5048('0x6')]},'idField':{'type':Sequelize[_0x5048('0x6')]},'variableName':{'type':Sequelize[_0x5048('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 1cdcb3f..e550ed5 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 _0x2ef3=['then','stack','name','send','index','SalesforceField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','offset','sort','pick','where','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','limit','set','apply','reject','save','update','destroy'];(function(_0xa28b1a,_0x384f4b){var _0x4c9b78=function(_0x3cf640){while(--_0x3cf640){_0xa28b1a['push'](_0xa28b1a['shift']());}};_0x4c9b78(++_0x384f4b);}(_0x2ef3,0xba));var _0x32ef=function(_0x336533,_0x420ded){_0x336533=_0x336533-0x0;var _0x2f7356=_0x2ef3[_0x336533];return _0x2f7356;};'use strict';var pdf=require(_0x32ef('0x0'));var emlformat=require(_0x32ef('0x1'));var rimraf=require(_0x32ef('0x2'));var zipdir=require(_0x32ef('0x3'));var jsonpatch=require(_0x32ef('0x4'));var rp=require(_0x32ef('0x5'));var moment=require('moment');var BPromise=require(_0x32ef('0x6'));var Mustache=require(_0x32ef('0x7'));var util=require('util');var path=require(_0x32ef('0x8'));var sox=require(_0x32ef('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0xf'));var querystring=require(_0x32ef('0x10'));var Papa=require(_0x32ef('0x11'));var Redis=require(_0x32ef('0x12'));var authService=require(_0x32ef('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x14'));var logger=require(_0x32ef('0x15'))(_0x32ef('0x16'));var utils=require(_0x32ef('0x17'));var config=require('../../config/environment');var db=require(_0x32ef('0x18'))['db'];function respondWithStatusCode(_0x5afcc2,_0x1a5106){_0x1a5106=_0x1a5106||0xcc;return function(_0x49d590){if(_0x49d590){return _0x5afcc2[_0x32ef('0x19')](_0x1a5106);}return _0x5afcc2[_0x32ef('0x1a')](_0x1a5106)['end']();};}function respondWithResult(_0x539d18,_0x19ce1){_0x19ce1=_0x19ce1||0xc8;return function(_0x4d8009){if(_0x4d8009){return _0x539d18[_0x32ef('0x1a')](_0x19ce1)[_0x32ef('0x1b')](_0x4d8009);}};}function respondWithFilteredResult(_0x93d492,_0x54c7f5){return function(_0x57aff1){if(_0x57aff1){var _0x55bf0b=_0x57aff1[_0x32ef('0x1c')],_0x531e30=_0x54c7f5['offset'],_0x13db1a=_0x54c7f5['offset']+_0x54c7f5[_0x32ef('0x1d')],_0x3950e6;if(_0x13db1a>=_0x55bf0b){_0x13db1a=_0x55bf0b;_0x3950e6=0xc8;}else{_0x3950e6=0xce;}_0x93d492[_0x32ef('0x1a')](_0x3950e6);return _0x93d492[_0x32ef('0x1e')]('Content-Range',_0x531e30+'-'+_0x13db1a+'/'+_0x55bf0b)[_0x32ef('0x1b')](_0x57aff1);}return null;};}function patchUpdates(_0x33e230){return function(_0x4f4c98){try{jsonpatch[_0x32ef('0x1f')](_0x4f4c98,_0x33e230,!![]);}catch(_0x314ef1){return BPromise[_0x32ef('0x20')](_0x314ef1);}return _0x4f4c98[_0x32ef('0x21')]();};}function saveUpdates(_0x445cda,_0x3aec05){return function(_0x4de441){if(_0x4de441){return _0x4de441[_0x32ef('0x22')](_0x445cda)['then'](function(_0x309866){return _0x309866;});}return null;};}function removeEntity(_0x3a20ca,_0x49f2d8){return function(_0x1af371){if(_0x1af371){return _0x1af371[_0x32ef('0x23')]()[_0x32ef('0x24')](function(){_0x3a20ca['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(!_0x225feb){_0x22f2d7['sendStatus'](0x194);}return _0x225feb;};}function handleError(_0x59585f,_0x19ea6){_0x19ea6=_0x19ea6||0x1f4;return function(_0x4d584b){logger['error'](_0x4d584b[_0x32ef('0x25')]);if(_0x4d584b[_0x32ef('0x26')]){delete _0x4d584b[_0x32ef('0x26')];}_0x59585f[_0x32ef('0x1a')](_0x19ea6)[_0x32ef('0x27')](_0x4d584b);};}exports[_0x32ef('0x28')]=function(_0x1874ea,_0x38aed5){var _0x338f19={},_0x2f52d7={},_0x1335e2={'count':0x0,'rows':[]};var _0xba4b3f=_['map'](db[_0x32ef('0x29')][_0x32ef('0x2a')],function(_0x5a04cd){return{'name':_0x5a04cd[_0x32ef('0x2b')],'type':_0x5a04cd[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x2f52d7[_0x32ef('0x2e')]=_['map'](_0xba4b3f,_0x32ef('0x26'));_0x2f52d7[_0x32ef('0x2f')]=_[_0x32ef('0x30')](_0x1874ea[_0x32ef('0x2f')]);_0x2f52d7[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x2f52d7[_0x32ef('0x2e')],_0x2f52d7['query']);_0x338f19[_0x32ef('0x33')]=_['intersection'](_0x2f52d7[_0x32ef('0x2e')],qs[_0x32ef('0x34')](_0x1874ea['query'][_0x32ef('0x34')]));_0x338f19[_0x32ef('0x33')]=_0x338f19[_0x32ef('0x33')][_0x32ef('0x35')]?_0x338f19[_0x32ef('0x33')]:_0x2f52d7['model'];if(!_0x1874ea['query'][_0x32ef('0x36')]('nolimit')){_0x338f19[_0x32ef('0x1d')]=qs[_0x32ef('0x1d')](_0x1874ea[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x338f19[_0x32ef('0x37')]=qs[_0x32ef('0x37')](_0x1874ea['query']['offset']);}_0x338f19['order']=qs[_0x32ef('0x38')](_0x1874ea[_0x32ef('0x2f')][_0x32ef('0x38')]);_0x338f19['where']=qs['filters'](_[_0x32ef('0x39')](_0x1874ea[_0x32ef('0x2f')],_0x2f52d7[_0x32ef('0x31')]));if(_0x1874ea['query']['filter']){_0x338f19[_0x32ef('0x3a')]=_[_0x32ef('0x3b')](_0x338f19[_0x32ef('0x3a')],{'$or':_[_0x32ef('0x3c')](_0xba4b3f,function(_0x3a7c49){if(_0x3a7c49[_0x32ef('0x2c')]!==_0x32ef('0x3d')){var _0x21da90={};_0x21da90[_0x3a7c49[_0x32ef('0x26')]]={'$like':'%'+_0x1874ea['query'][_0x32ef('0x3e')]+'%'};return _0x21da90;}})});}_0x338f19=_[_0x32ef('0x3b')]({},_0x338f19,_0x1874ea[_0x32ef('0x3f')]);var _0x4b97dc={'where':_0x338f19[_0x32ef('0x3a')]};return db[_0x32ef('0x29')][_0x32ef('0x1c')](_0x4b97dc)[_0x32ef('0x24')](function(_0x1faf72){_0x1335e2[_0x32ef('0x1c')]=_0x1faf72;if(_0x1874ea[_0x32ef('0x2f')][_0x32ef('0x40')]){_0x338f19[_0x32ef('0x41')]=[{'all':!![]}];}return db[_0x32ef('0x29')][_0x32ef('0x42')](_0x338f19);})[_0x32ef('0x24')](function(_0x48e071){_0x1335e2[_0x32ef('0x43')]=_0x48e071;return _0x1335e2;})[_0x32ef('0x24')](respondWithFilteredResult(_0x38aed5,_0x338f19))[_0x32ef('0x44')](handleError(_0x38aed5,null));};exports[_0x32ef('0x45')]=function(_0x2f92f5,_0x2ca66b){var _0x3c0e44={'raw':!![],'where':{'id':_0x2f92f5['params']['id']}},_0x596d5a={};_0x596d5a[_0x32ef('0x2e')]=_[_0x32ef('0x30')](db[_0x32ef('0x29')][_0x32ef('0x2a')]);_0x596d5a['query']=_[_0x32ef('0x30')](_0x2f92f5[_0x32ef('0x2f')]);_0x596d5a['filters']=_[_0x32ef('0x32')](_0x596d5a['model'],_0x596d5a[_0x32ef('0x2f')]);_0x3c0e44[_0x32ef('0x33')]=_[_0x32ef('0x32')](_0x596d5a[_0x32ef('0x2e')],qs[_0x32ef('0x34')](_0x2f92f5[_0x32ef('0x2f')][_0x32ef('0x34')]));_0x3c0e44[_0x32ef('0x33')]=_0x3c0e44[_0x32ef('0x33')][_0x32ef('0x35')]?_0x3c0e44['attributes']:_0x596d5a[_0x32ef('0x2e')];if(_0x2f92f5['query'][_0x32ef('0x40')]){_0x3c0e44[_0x32ef('0x41')]=[{'all':!![]}];}_0x3c0e44=_[_0x32ef('0x3b')]({},_0x3c0e44,_0x2f92f5['options']);return db[_0x32ef('0x29')][_0x32ef('0x46')](_0x3c0e44)[_0x32ef('0x24')](handleEntityNotFound(_0x2ca66b,null))[_0x32ef('0x24')](respondWithResult(_0x2ca66b,null))[_0x32ef('0x44')](handleError(_0x2ca66b,null));};exports[_0x32ef('0x47')]=function(_0x12c9e6,_0x47dbe1){return db['SalesforceField'][_0x32ef('0x47')](_0x12c9e6[_0x32ef('0x48')],{})[_0x32ef('0x24')](respondWithResult(_0x47dbe1,0xc9))[_0x32ef('0x44')](handleError(_0x47dbe1,null));};exports[_0x32ef('0x22')]=function(_0xd67dc9,_0x44ad11){if(_0xd67dc9[_0x32ef('0x48')]['id']){delete _0xd67dc9[_0x32ef('0x48')]['id'];}return db[_0x32ef('0x29')][_0x32ef('0x46')]({'where':{'id':_0xd67dc9[_0x32ef('0x49')]['id']}})[_0x32ef('0x24')](handleEntityNotFound(_0x44ad11,null))['then'](saveUpdates(_0xd67dc9[_0x32ef('0x48')],null))[_0x32ef('0x24')](respondWithResult(_0x44ad11,null))[_0x32ef('0x44')](handleError(_0x44ad11,null));};exports[_0x32ef('0x23')]=function(_0x1cc9f3,_0x4353f0){return db[_0x32ef('0x29')][_0x32ef('0x46')]({'where':{'id':_0x1cc9f3[_0x32ef('0x49')]['id']}})[_0x32ef('0x24')](handleEntityNotFound(_0x4353f0,null))[_0x32ef('0x24')](removeEntity(_0x4353f0,null))[_0x32ef('0x44')](handleError(_0x4353f0,null));}; \ No newline at end of file +var _0x5f2f=['set','Content-Range','apply','reject','save','update','destroy','end','error','stack','name','send','index','map','fieldName','type','query','keys','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','SalesforceField','then','include','rows','catch','show','params','intersection','options','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit'];(function(_0x3a41a1,_0x1d954b){var _0x33455f=function(_0x418406){while(--_0x418406){_0x3a41a1['push'](_0x3a41a1['shift']());}};_0x33455f(++_0x1d954b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x24d22f,_0xfa6241){_0x24d22f=_0x24d22f-0x0;var _0x33b153=_0x5f2f[_0x24d22f];return _0x33b153;};'use strict';var pdf=require(_0xf5f2('0x0'));var emlformat=require(_0xf5f2('0x1'));var rimraf=require(_0xf5f2('0x2'));var zipdir=require(_0xf5f2('0x3'));var jsonpatch=require(_0xf5f2('0x4'));var rp=require(_0xf5f2('0x5'));var moment=require(_0xf5f2('0x6'));var BPromise=require(_0xf5f2('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf5f2('0x8'));var sox=require(_0xf5f2('0x9'));var csv=require(_0xf5f2('0xa'));var ejs=require(_0xf5f2('0xb'));var fs=require('fs');var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0xa'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var db=require(_0xf5f2('0x16'))['db'];function respondWithStatusCode(_0x14b51f,_0x331482){_0x331482=_0x331482||0xcc;return function(_0x3f2997){if(_0x3f2997){return _0x14b51f[_0xf5f2('0x17')](_0x331482);}return _0x14b51f[_0xf5f2('0x18')](_0x331482)['end']();};}function respondWithResult(_0x5850f4,_0xea612c){_0xea612c=_0xea612c||0xc8;return function(_0x269909){if(_0x269909){return _0x5850f4[_0xf5f2('0x18')](_0xea612c)[_0xf5f2('0x19')](_0x269909);}};}function respondWithFilteredResult(_0x4d97fc,_0xafe430){return function(_0x286197){if(_0x286197){var _0x17d656=_0x286197[_0xf5f2('0x1a')],_0x1b6dd2=_0xafe430[_0xf5f2('0x1b')],_0x23e23a=_0xafe430[_0xf5f2('0x1b')]+_0xafe430[_0xf5f2('0x1c')],_0x3a9dbb;if(_0x23e23a>=_0x17d656){_0x23e23a=_0x17d656;_0x3a9dbb=0xc8;}else{_0x3a9dbb=0xce;}_0x4d97fc[_0xf5f2('0x18')](_0x3a9dbb);return _0x4d97fc[_0xf5f2('0x1d')](_0xf5f2('0x1e'),_0x1b6dd2+'-'+_0x23e23a+'/'+_0x17d656)[_0xf5f2('0x19')](_0x286197);}return null;};}function patchUpdates(_0x3cf5ea){return function(_0x626999){try{jsonpatch[_0xf5f2('0x1f')](_0x626999,_0x3cf5ea,!![]);}catch(_0x56acc5){return BPromise[_0xf5f2('0x20')](_0x56acc5);}return _0x626999[_0xf5f2('0x21')]();};}function saveUpdates(_0x49dac2,_0x47acfc){return function(_0x2d2805){if(_0x2d2805){return _0x2d2805[_0xf5f2('0x22')](_0x49dac2)['then'](function(_0x45b74f){return _0x45b74f;});}return null;};}function removeEntity(_0x170042,_0x39e44a){return function(_0x39c024){if(_0x39c024){return _0x39c024[_0xf5f2('0x23')]()['then'](function(){_0x170042[_0xf5f2('0x18')](0xcc)[_0xf5f2('0x24')]();});}};}function handleEntityNotFound(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(!_0x287ad5){_0x4e8bda['sendStatus'](0x194);}return _0x287ad5;};}function handleError(_0x529f07,_0x5f1124){_0x5f1124=_0x5f1124||0x1f4;return function(_0x3f79d5){logger[_0xf5f2('0x25')](_0x3f79d5[_0xf5f2('0x26')]);if(_0x3f79d5[_0xf5f2('0x27')]){delete _0x3f79d5[_0xf5f2('0x27')];}_0x529f07[_0xf5f2('0x18')](_0x5f1124)[_0xf5f2('0x28')](_0x3f79d5);};}exports[_0xf5f2('0x29')]=function(_0x4ab014,_0xaa2602){var _0x102449={},_0x375ca8={},_0x31bfcb={'count':0x0,'rows':[]};var _0x198c73=_[_0xf5f2('0x2a')](db['SalesforceField']['rawAttributes'],function(_0x22c826){return{'name':_0x22c826[_0xf5f2('0x2b')],'type':_0x22c826[_0xf5f2('0x2c')]['key']};});_0x375ca8['model']=_[_0xf5f2('0x2a')](_0x198c73,_0xf5f2('0x27'));_0x375ca8[_0xf5f2('0x2d')]=_[_0xf5f2('0x2e')](_0x4ab014[_0xf5f2('0x2d')]);_0x375ca8['filters']=_['intersection'](_0x375ca8[_0xf5f2('0x2f')],_0x375ca8['query']);_0x102449[_0xf5f2('0x30')]=_['intersection'](_0x375ca8[_0xf5f2('0x2f')],qs[_0xf5f2('0x31')](_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x31')]));_0x102449[_0xf5f2('0x30')]=_0x102449[_0xf5f2('0x30')][_0xf5f2('0x32')]?_0x102449[_0xf5f2('0x30')]:_0x375ca8['model'];if(!_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x33')](_0xf5f2('0x34'))){_0x102449[_0xf5f2('0x1c')]=qs[_0xf5f2('0x1c')](_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x1c')]);_0x102449['offset']=qs[_0xf5f2('0x1b')](_0x4ab014[_0xf5f2('0x2d')]['offset']);}_0x102449[_0xf5f2('0x35')]=qs['sort'](_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x36')]);_0x102449[_0xf5f2('0x37')]=qs[_0xf5f2('0x38')](_['pick'](_0x4ab014['query'],_0x375ca8[_0xf5f2('0x38')]));if(_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x39')]){_0x102449['where']=_[_0xf5f2('0x3a')](_0x102449['where'],{'$or':_[_0xf5f2('0x2a')](_0x198c73,function(_0x566c47){if(_0x566c47[_0xf5f2('0x2c')]!==_0xf5f2('0x3b')){var _0x5337a6={};_0x5337a6[_0x566c47[_0xf5f2('0x27')]]={'$like':'%'+_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x39')]+'%'};return _0x5337a6;}})});}_0x102449=_[_0xf5f2('0x3a')]({},_0x102449,_0x4ab014['options']);var _0x5d2d82={'where':_0x102449[_0xf5f2('0x37')]};return db[_0xf5f2('0x3c')][_0xf5f2('0x1a')](_0x5d2d82)[_0xf5f2('0x3d')](function(_0x2c7f65){_0x31bfcb[_0xf5f2('0x1a')]=_0x2c7f65;if(_0x4ab014[_0xf5f2('0x2d')]['includeAll']){_0x102449[_0xf5f2('0x3e')]=[{'all':!![]}];}return db[_0xf5f2('0x3c')]['findAll'](_0x102449);})[_0xf5f2('0x3d')](function(_0x3f3895){_0x31bfcb[_0xf5f2('0x3f')]=_0x3f3895;return _0x31bfcb;})[_0xf5f2('0x3d')](respondWithFilteredResult(_0xaa2602,_0x102449))[_0xf5f2('0x40')](handleError(_0xaa2602,null));};exports[_0xf5f2('0x41')]=function(_0x462ea3,_0x2083b3){var _0x574f24={'raw':!![],'where':{'id':_0x462ea3[_0xf5f2('0x42')]['id']}},_0x31c3c={};_0x31c3c[_0xf5f2('0x2f')]=_['keys'](db['SalesforceField']['rawAttributes']);_0x31c3c[_0xf5f2('0x2d')]=_[_0xf5f2('0x2e')](_0x462ea3['query']);_0x31c3c[_0xf5f2('0x38')]=_[_0xf5f2('0x43')](_0x31c3c[_0xf5f2('0x2f')],_0x31c3c[_0xf5f2('0x2d')]);_0x574f24[_0xf5f2('0x30')]=_[_0xf5f2('0x43')](_0x31c3c[_0xf5f2('0x2f')],qs[_0xf5f2('0x31')](_0x462ea3[_0xf5f2('0x2d')][_0xf5f2('0x31')]));_0x574f24[_0xf5f2('0x30')]=_0x574f24[_0xf5f2('0x30')][_0xf5f2('0x32')]?_0x574f24[_0xf5f2('0x30')]:_0x31c3c['model'];if(_0x462ea3[_0xf5f2('0x2d')]['includeAll']){_0x574f24[_0xf5f2('0x3e')]=[{'all':!![]}];}_0x574f24=_[_0xf5f2('0x3a')]({},_0x574f24,_0x462ea3[_0xf5f2('0x44')]);return db[_0xf5f2('0x3c')][_0xf5f2('0x45')](_0x574f24)[_0xf5f2('0x3d')](handleEntityNotFound(_0x2083b3,null))['then'](respondWithResult(_0x2083b3,null))[_0xf5f2('0x40')](handleError(_0x2083b3,null));};exports[_0xf5f2('0x46')]=function(_0x1c1497,_0x29b108){return db[_0xf5f2('0x3c')][_0xf5f2('0x46')](_0x1c1497[_0xf5f2('0x47')],{})[_0xf5f2('0x3d')](respondWithResult(_0x29b108,0xc9))['catch'](handleError(_0x29b108,null));};exports[_0xf5f2('0x22')]=function(_0x33ec29,_0x45db9a){if(_0x33ec29['body']['id']){delete _0x33ec29[_0xf5f2('0x47')]['id'];}return db[_0xf5f2('0x3c')][_0xf5f2('0x45')]({'where':{'id':_0x33ec29['params']['id']}})['then'](handleEntityNotFound(_0x45db9a,null))[_0xf5f2('0x3d')](saveUpdates(_0x33ec29[_0xf5f2('0x47')],null))['then'](respondWithResult(_0x45db9a,null))[_0xf5f2('0x40')](handleError(_0x45db9a,null));};exports['destroy']=function(_0x740321,_0x497eb8){return db[_0xf5f2('0x3c')]['find']({'where':{'id':_0x740321[_0xf5f2('0x42')]['id']}})[_0xf5f2('0x3d')](handleEntityNotFound(_0x497eb8,null))[_0xf5f2('0x3d')](removeEntity(_0x497eb8,null))[_0xf5f2('0x40')](handleError(_0x497eb8,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index e14e9b1..5d8dd5b 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 _0x14d8=['../../config/environment','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x2fc2ca,_0x5a2b12){var _0x39b5ea=function(_0x40b734){while(--_0x40b734){_0x2fc2ca['push'](_0x2fc2ca['shift']());}};_0x39b5ea(++_0x5a2b12);}(_0x14d8,0x19d));var _0x814d=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x14d8[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x814d('0x0'));var util=require(_0x814d('0x1'));var logger=require('../../config/logger')(_0x814d('0x2'));var moment=require('moment');var BPromise=require(_0x814d('0x3'));var rp=require(_0x814d('0x4'));var fs=require('fs');var path=require(_0x814d('0x5'));var rimraf=require(_0x814d('0x6'));var config=require(_0x814d('0x7'));var attributes=require('./intSalesforceField.attributes');module[_0x814d('0x8')]=function(_0x2e1be8,_0x1268c9){return _0x2e1be8[_0x814d('0x9')](_0x814d('0xa'),attributes,{'tableName':_0x814d('0xb'),'paranoid':![],'indexes':[{'name':_0x814d('0xc'),'fields':[_0x814d('0xd'),_0x814d('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1ed0=['SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intSalesforceField.attributes','exports','define'];(function(_0x2139c6,_0x2c3051){var _0x391039=function(_0xc86177){while(--_0xc86177){_0x2139c6['push'](_0x2139c6['shift']());}};_0x391039(++_0x2c3051);}(_0x1ed0,0x103));var _0x01ed=function(_0x1b33ec,_0x4c5bb3){_0x1b33ec=_0x1b33ec-0x0;var _0x36c0a4=_0x1ed0[_0x1b33ec];return _0x36c0a4;};'use strict';var _=require(_0x01ed('0x0'));var util=require(_0x01ed('0x1'));var logger=require(_0x01ed('0x2'))('api');var moment=require(_0x01ed('0x3'));var BPromise=require(_0x01ed('0x4'));var rp=require(_0x01ed('0x5'));var fs=require('fs');var path=require(_0x01ed('0x6'));var rimraf=require('rimraf');var config=require(_0x01ed('0x7'));var attributes=require(_0x01ed('0x8'));module[_0x01ed('0x9')]=function(_0x5c27ec,_0xf2ca2c){return _0x5c27ec[_0x01ed('0xa')](_0x01ed('0xb'),attributes,{'tableName':_0x01ed('0xc'),'paranoid':![],'indexes':[{'name':_0x01ed('0xd'),'fields':['idField',_0x01ed('0xe')],'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 5a6a4fa..5c0d8e5 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 _0x9bde=['code','message','SalesforceField,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x5f0487,_0x371396){var _0x222aa8=function(_0xf81a39){while(--_0xf81a39){_0x5f0487['push'](_0x5f0487['shift']());}};_0x222aa8(++_0x371396);}(_0x9bde,0xe1));var _0xe9bd=function(_0x19a10a,_0x3511f1){_0x19a10a=_0x19a10a-0x0;var _0x578af2=_0x9bde[_0x19a10a];return _0x578af2;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var moment=require('moment');var BPromise=require(_0xe9bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9bd('0x2'));var db=require(_0xe9bd('0x3'))['db'];var utils=require(_0xe9bd('0x4'));var logger=require(_0xe9bd('0x5'))(_0xe9bd('0x6'));var config=require(_0xe9bd('0x7'));var jayson=require(_0xe9bd('0x8'));var client=jayson['client'][_0xe9bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f18fe,_0x22a438,_0xa66ae2){return new BPromise(function(_0x2d5c75,_0x3ef9e3){return client[_0xe9bd('0xa')](_0x5f18fe,_0xa66ae2)[_0xe9bd('0xb')](function(_0x439abc){logger[_0xe9bd('0xc')]('SalesforceField,\x20%s,\x20%s',_0x22a438,'request\x20sent');logger[_0xe9bd('0xd')](_0xe9bd('0xe'),_0x22a438,_0xe9bd('0xf'),JSON['stringify'](_0x439abc));if(_0x439abc[_0xe9bd('0x10')]){if(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x11')]===0x1f4){logger[_0xe9bd('0x10')]('SalesforceField,\x20%s,\x20%s',_0x22a438,_0x439abc[_0xe9bd('0x10')]['message']);return _0x3ef9e3(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}logger[_0xe9bd('0x10')]('SalesforceField,\x20%s,\x20%s',_0x22a438,_0x439abc['error'][_0xe9bd('0x12')]);return _0x2d5c75(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}else{logger[_0xe9bd('0xc')](_0xe9bd('0x13'),_0x22a438,_0xe9bd('0xf'));_0x2d5c75(_0x439abc[_0xe9bd('0x14')]['message']);}})[_0xe9bd('0x15')](function(_0x464a1b){logger[_0xe9bd('0x10')]('SalesforceField,\x20%s,\x20%s',_0x22a438,_0x464a1b);_0x3ef9e3(_0x464a1b);});});} \ No newline at end of file +var _0x9ffd=['SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SalesforceField,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug'];(function(_0x354d65,_0x55aff4){var _0x423c6b=function(_0x1c108b){while(--_0x1c108b){_0x354d65['push'](_0x354d65['shift']());}};_0x423c6b(++_0x55aff4);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x375404,_0x58bdc0){_0x375404=_0x375404-0x0;var _0x37db22=_0x9ffd[_0x375404];return _0x37db22;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var moment=require(_0xd9ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9ff('0x3'));var fs=require('fs');var Redis=require(_0xd9ff('0x4'));var db=require(_0xd9ff('0x5'))['db'];var utils=require(_0xd9ff('0x6'));var logger=require('../../config/logger')(_0xd9ff('0x7'));var config=require(_0xd9ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd9ff('0x9')][_0xd9ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13ea8c,_0x270eb2,_0x45c60a){return new BPromise(function(_0x66282d,_0x13954e){return client[_0xd9ff('0xb')](_0x13ea8c,_0x45c60a)[_0xd9ff('0xc')](function(_0x58e728){logger['info']('SalesforceField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');logger[_0xd9ff('0xd')](_0xd9ff('0xe'),_0x270eb2,_0xd9ff('0xf'),JSON[_0xd9ff('0x10')](_0x58e728));if(_0x58e728[_0xd9ff('0x11')]){if(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x12')]===0x1f4){logger[_0xd9ff('0x11')]('SalesforceField,\x20%s,\x20%s',_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x13954e(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x13')]);}logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x66282d(_0x58e728[_0xd9ff('0x11')]['message']);}else{logger[_0xd9ff('0x15')]('SalesforceField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');_0x66282d(_0x58e728['result']['message']);}})[_0xd9ff('0x16')](function(_0x4f9d6d){logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x4f9d6d);_0x13954e(_0x4f9d6d);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 7c1628c..e0cc21d 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 _0xfa12=['update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','./intServicenowAccount.controller','get','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','/:id'];(function(_0x47c5bf,_0x45977e){var _0x11b779=function(_0x1bd585){while(--_0x1bd585){_0x47c5bf['push'](_0x47c5bf['shift']());}};_0x11b779(++_0x45977e);}(_0xfa12,0x1bd));var _0x2fa1=function(_0x11d88c,_0x305978){_0x11d88c=_0x11d88c-0x0;var _0xd5e234=_0xfa12[_0x11d88c];return _0xd5e234;};'use strict';var multer=require(_0x2fa1('0x0'));var util=require(_0x2fa1('0x1'));var path=require(_0x2fa1('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2fa1('0x3')]();var auth=require(_0x2fa1('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2fa1('0x5'));router[_0x2fa1('0x6')]('/',auth[_0x2fa1('0x7')](),controller['index']);router[_0x2fa1('0x6')]('/:id',auth[_0x2fa1('0x7')](),controller[_0x2fa1('0x8')]);router[_0x2fa1('0x6')](_0x2fa1('0x9'),auth[_0x2fa1('0x7')](),controller[_0x2fa1('0xa')]);router['get'](_0x2fa1('0xb'),auth[_0x2fa1('0x7')](),controller[_0x2fa1('0xc')]);router[_0x2fa1('0xd')]('/',auth[_0x2fa1('0x7')](),controller[_0x2fa1('0xe')]);router[_0x2fa1('0xd')](_0x2fa1('0x9'),auth['isAuthenticated'](),controller[_0x2fa1('0xf')]);router['put'](_0x2fa1('0x10'),auth['isAuthenticated'](),controller[_0x2fa1('0x11')]);router[_0x2fa1('0x12')](_0x2fa1('0x10'),auth[_0x2fa1('0x7')](),controller[_0x2fa1('0x13')]);module[_0x2fa1('0x14')]=router; \ No newline at end of file +var _0xc2b2=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update'];(function(_0x1f1fd3,_0x41397a){var _0x4c7acd=function(_0x104230){while(--_0x104230){_0x1f1fd3['push'](_0x1f1fd3['shift']());}};_0x4c7acd(++_0x41397a);}(_0xc2b2,0xd3));var _0x2c2b=function(_0x7db8b9,_0xb18ace){_0x7db8b9=_0x7db8b9-0x0;var _0x3e19a8=_0xc2b2[_0x7db8b9];return _0x3e19a8;};'use strict';var multer=require(_0x2c2b('0x0'));var util=require(_0x2c2b('0x1'));var path=require(_0x2c2b('0x2'));var timeout=require(_0x2c2b('0x3'));var express=require(_0x2c2b('0x4'));var router=express[_0x2c2b('0x5')]();var auth=require(_0x2c2b('0x6'));var interaction=require(_0x2c2b('0x7'));var config=require(_0x2c2b('0x8'));var controller=require('./intServicenowAccount.controller');router[_0x2c2b('0x9')]('/',auth[_0x2c2b('0xa')](),controller[_0x2c2b('0xb')]);router[_0x2c2b('0x9')](_0x2c2b('0xc'),auth['isAuthenticated'](),controller[_0x2c2b('0xd')]);router[_0x2c2b('0x9')]('/:id/configurations',auth[_0x2c2b('0xa')](),controller[_0x2c2b('0xe')]);router[_0x2c2b('0x9')](_0x2c2b('0xf'),auth[_0x2c2b('0xa')](),controller[_0x2c2b('0x10')]);router[_0x2c2b('0x11')]('/',auth['isAuthenticated'](),controller[_0x2c2b('0x12')]);router[_0x2c2b('0x11')](_0x2c2b('0x13'),auth[_0x2c2b('0xa')](),controller[_0x2c2b('0x14')]);router[_0x2c2b('0x15')](_0x2c2b('0xc'),auth['isAuthenticated'](),controller[_0x2c2b('0x16')]);router[_0x2c2b('0x17')](_0x2c2b('0xc'),auth['isAuthenticated'](),controller[_0x2c2b('0x18')]);module[_0x2c2b('0x19')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index cf67a21..ec44047 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 _0xab33=['username','sequelize','exports','STRING'];(function(_0x2d14f5,_0x1cb1c1){var _0x5bbfa4=function(_0x3e3af4){while(--_0x3e3af4){_0x2d14f5['push'](_0x2d14f5['shift']());}};_0x5bbfa4(++_0x1cb1c1);}(_0xab33,0x189));var _0x3ab3=function(_0x21d3a3,_0x4241b3){_0x21d3a3=_0x21d3a3-0x0;var _0x3bce93=_0xab33[_0x21d3a3];return _0x3bce93;};'use strict';var Sequelize=require(_0x3ab3('0x0'));module[_0x3ab3('0x1')]={'name':{'type':Sequelize[_0x3ab3('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x3ab3('0x2')],'unique':_0x3ab3('0x3')},'password':{'type':Sequelize[_0x3ab3('0x2')]},'email':{'type':Sequelize[_0x3ab3('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x3ab3('0x2')]}}; \ No newline at end of file +var _0x9a59=['username','remoteUri','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9a59,0x164));var _0x99a5=function(_0x2e457c,_0x367736){_0x2e457c=_0x2e457c-0x0;var _0x5c2298=_0x9a59[_0x2e457c];return _0x5c2298;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x99a5('0x0')],'unique':_0x99a5('0x1')},'password':{'type':Sequelize[_0x99a5('0x0')]},'email':{'type':Sequelize[_0x99a5('0x0')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x99a5('0x2')},'serverUrl':{'type':Sequelize[_0x99a5('0x0')]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 7addcf4..7bc47d2 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 _0x5807=['then','info','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','ServicenowAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','count','offset','set','reject','update','stack','name','send','index','ServicenowAccount','rawAttributes','key','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','create','body','find','ServicenowConfiguration','options','getConfigurations','addConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','caused_by','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','business_service','rfc','time_worked','expected_start','opened_at','business_duration','group_list','reopened_time','resolved_at','approval_set','work_notes','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','urgency','company','reassignment_count','activity_due','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','remoteUri','serverUrl','slice','lastIndexOf','format','%s/api/now/doc/table/schema/','username','GET','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','statusCode','boolean','True','true','False','sys_choice?sysparm_query=name=incident^element=','result','false','value','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','test','ValidationError','request'];(function(_0xb08125,_0x561acb){var _0x2ace23=function(_0x50dbbf){while(--_0x50dbbf){_0xb08125['push'](_0xb08125['shift']());}};_0x2ace23(++_0x561acb);}(_0x5807,0x165));var _0x7580=function(_0x2c0be1,_0x1e88f2){_0x2c0be1=_0x2c0be1-0x0;var _0x3d4bd2=_0x5807[_0x2c0be1];return _0x3d4bd2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7580('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7580('0x1'));var jsonpatch=require(_0x7580('0x2'));var rp=require(_0x7580('0x3'));var moment=require(_0x7580('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7580('0x5'));var util=require(_0x7580('0x6'));var path=require('path');var sox=require(_0x7580('0x7'));var csv=require('to-csv');var ejs=require(_0x7580('0x8'));var fs=require('fs');var _=require(_0x7580('0x9'));var squel=require(_0x7580('0xa'));var crypto=require(_0x7580('0xb'));var jsforce=require(_0x7580('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7580('0xd'));var Papa=require(_0x7580('0xe'));var Redis=require(_0x7580('0xf'));var authService=require(_0x7580('0x10'));var qs=require(_0x7580('0x11'));var as=require(_0x7580('0x12'));var hardwareService=require(_0x7580('0x13'));var logger=require(_0x7580('0x14'))(_0x7580('0x15'));var utils=require(_0x7580('0x16'));var config=require(_0x7580('0x17'));var db=require(_0x7580('0x18'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x7580('0x19'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x33d510,_0x3c5b1f,_0x26732b){if(_0x26732b){var _0x57aa16=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x57aa16[_0x7580('0x1a')](_0x3c5b1f)){return _0x33d510;}else{throw new db['Sequelize'][(_0x7580('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 _0x33d510;}}function respondWithRpcPromise(_0x382303,_0x234c13,_0x3742d2,_0x358be5){return new BPromise(function(_0xc177dc,_0x3afa28){var _0x32bf6f=_0x358be5||client;return _0x32bf6f[_0x7580('0x1c')](_0x382303,_0x3742d2)[_0x7580('0x1d')](function(_0x328244){logger[_0x7580('0x1e')]('ServicenowAccount,\x20%s,\x20%s',_0x234c13,'request\x20sent');logger[_0x7580('0x1f')](_0x7580('0x20'),_0x234c13,_0x7580('0x21'),JSON['stringify'](_0x328244));if(_0x328244['error']){if(_0x328244[_0x7580('0x22')]['code']===0x1f4){logger[_0x7580('0x22')](_0x7580('0x23'),_0x234c13,_0x328244[_0x7580('0x22')]['message']);return _0x3afa28(_0x328244[_0x7580('0x22')][_0x7580('0x24')]);}logger[_0x7580('0x22')](_0x7580('0x23'),_0x234c13,_0x328244[_0x7580('0x22')]['message']);return _0xc177dc(_0x328244['error'][_0x7580('0x24')]);}else{logger[_0x7580('0x1e')]('ServicenowAccount,\x20%s,\x20%s',_0x234c13,_0x7580('0x21'));_0xc177dc(_0x328244['result'][_0x7580('0x24')]);}})[_0x7580('0x25')](function(_0x464c50){logger['error'](_0x7580('0x23'),_0x234c13,_0x464c50);_0x3afa28(_0x464c50);});});}function respondWithStatusCode(_0x82dd49,_0x2c5df4){_0x2c5df4=_0x2c5df4||0xcc;return function(_0x5ce615){if(_0x5ce615){return _0x82dd49[_0x7580('0x26')](_0x2c5df4);}return _0x82dd49[_0x7580('0x27')](_0x2c5df4)[_0x7580('0x28')]();};}function respondWithResult(_0x3ed100,_0xa64d02){_0xa64d02=_0xa64d02||0xc8;return function(_0x1b28e4){if(_0x1b28e4){return _0x3ed100[_0x7580('0x27')](_0xa64d02)[_0x7580('0x29')](_0x1b28e4);}};}function respondWithFilteredResult(_0x507c40,_0x3dd559){return function(_0x541de8){if(_0x541de8){var _0x377e4a=_0x541de8[_0x7580('0x2a')],_0x255bdf=_0x3dd559[_0x7580('0x2b')],_0x492829=_0x3dd559[_0x7580('0x2b')]+_0x3dd559['limit'],_0x3696d9;if(_0x492829>=_0x377e4a){_0x492829=_0x377e4a;_0x3696d9=0xc8;}else{_0x3696d9=0xce;}_0x507c40[_0x7580('0x27')](_0x3696d9);return _0x507c40[_0x7580('0x2c')]('Content-Range',_0x255bdf+'-'+_0x492829+'/'+_0x377e4a)['json'](_0x541de8);}return null;};}function patchUpdates(_0x3f4036){return function(_0xb191f5){try{jsonpatch['apply'](_0xb191f5,_0x3f4036,!![]);}catch(_0x1e881f){return BPromise[_0x7580('0x2d')](_0x1e881f);}return _0xb191f5['save']();};}function saveUpdates(_0x432540,_0x1fb665){return function(_0x2c0092){if(_0x2c0092){return _0x2c0092[_0x7580('0x2e')](_0x432540)[_0x7580('0x1d')](function(_0x2ab3dc){return _0x2ab3dc;});}return null;};}function removeEntity(_0xfa71ae,_0x18a543){return function(_0x6e5cea){if(_0x6e5cea){return _0x6e5cea['destroy']()[_0x7580('0x1d')](function(){_0xfa71ae[_0x7580('0x27')](0xcc)[_0x7580('0x28')]();});}};}function handleEntityNotFound(_0x29be2,_0x5b1add){return function(_0x45777f){if(!_0x45777f){_0x29be2['sendStatus'](0x194);}return _0x45777f;};}function handleError(_0x289c8a,_0x5c5356){_0x5c5356=_0x5c5356||0x1f4;return function(_0x3184a2){logger[_0x7580('0x22')](_0x3184a2[_0x7580('0x2f')]);if(_0x3184a2[_0x7580('0x30')]){delete _0x3184a2['name'];}_0x289c8a['status'](_0x5c5356)[_0x7580('0x31')](_0x3184a2);};}exports[_0x7580('0x32')]=function(_0x351e49,_0x295f22){var _0x5c8d98={},_0x4562fe={},_0x2a81dd={'count':0x0,'rows':[]};var _0x5c3954=_['map'](db[_0x7580('0x33')][_0x7580('0x34')],function(_0x499c75){return{'name':_0x499c75['fieldName'],'type':_0x499c75['type'][_0x7580('0x35')]};});_0x4562fe[_0x7580('0x36')]=_[_0x7580('0x37')](_0x5c3954,_0x7580('0x30'));_0x4562fe['query']=_[_0x7580('0x38')](_0x351e49[_0x7580('0x39')]);_0x4562fe[_0x7580('0x3a')]=_['intersection'](_0x4562fe[_0x7580('0x36')],_0x4562fe[_0x7580('0x39')]);_0x5c8d98[_0x7580('0x3b')]=_[_0x7580('0x3c')](_0x4562fe['model'],qs[_0x7580('0x3d')](_0x351e49['query'][_0x7580('0x3d')]));_0x5c8d98[_0x7580('0x3b')]=_0x5c8d98['attributes'][_0x7580('0x3e')]?_0x5c8d98['attributes']:_0x4562fe[_0x7580('0x36')];if(!_0x351e49[_0x7580('0x39')][_0x7580('0x3f')](_0x7580('0x40'))){_0x5c8d98['limit']=qs[_0x7580('0x41')](_0x351e49[_0x7580('0x39')][_0x7580('0x41')]);_0x5c8d98[_0x7580('0x2b')]=qs[_0x7580('0x2b')](_0x351e49['query'][_0x7580('0x2b')]);}_0x5c8d98[_0x7580('0x42')]=qs[_0x7580('0x43')](_0x351e49[_0x7580('0x39')][_0x7580('0x43')]);_0x5c8d98[_0x7580('0x44')]=qs[_0x7580('0x3a')](_[_0x7580('0x45')](_0x351e49['query'],_0x4562fe[_0x7580('0x3a')]));if(_0x351e49[_0x7580('0x39')][_0x7580('0x46')]){_0x5c8d98['where']=_[_0x7580('0x47')](_0x5c8d98['where'],{'$or':_[_0x7580('0x37')](_0x5c3954,function(_0x261bdf){if(_0x261bdf[_0x7580('0x48')]!==_0x7580('0x49')){var _0x2512ec={};_0x2512ec[_0x261bdf['name']]={'$like':'%'+_0x351e49[_0x7580('0x39')][_0x7580('0x46')]+'%'};return _0x2512ec;}})});}_0x5c8d98=_['merge']({},_0x5c8d98,_0x351e49['options']);var _0x5f053a={'where':_0x5c8d98[_0x7580('0x44')]};return db[_0x7580('0x33')][_0x7580('0x2a')](_0x5f053a)[_0x7580('0x1d')](function(_0x45f0ff){_0x2a81dd[_0x7580('0x2a')]=_0x45f0ff;if(_0x351e49[_0x7580('0x39')][_0x7580('0x4a')]){_0x5c8d98[_0x7580('0x4b')]=[{'all':!![]}];}return db[_0x7580('0x33')][_0x7580('0x4c')](_0x5c8d98);})[_0x7580('0x1d')](function(_0x40dff3){_0x2a81dd[_0x7580('0x4d')]=_0x40dff3;return _0x2a81dd;})[_0x7580('0x1d')](respondWithFilteredResult(_0x295f22,_0x5c8d98))[_0x7580('0x25')](handleError(_0x295f22,null));};exports[_0x7580('0x4e')]=function(_0x109fd8,_0x1fe4b2){var _0x2acdb0={'raw':![],'where':{'id':_0x109fd8[_0x7580('0x4f')]['id']}},_0x20e4dd={};_0x20e4dd[_0x7580('0x36')]=_[_0x7580('0x38')](db['ServicenowAccount'][_0x7580('0x34')]);_0x20e4dd[_0x7580('0x39')]=_[_0x7580('0x38')](_0x109fd8[_0x7580('0x39')]);_0x20e4dd[_0x7580('0x3a')]=_['intersection'](_0x20e4dd['model'],_0x20e4dd[_0x7580('0x39')]);_0x2acdb0[_0x7580('0x3b')]=_[_0x7580('0x3c')](_0x20e4dd[_0x7580('0x36')],qs[_0x7580('0x3d')](_0x109fd8[_0x7580('0x39')]['fields']));_0x2acdb0[_0x7580('0x3b')]=_0x2acdb0[_0x7580('0x3b')]['length']?_0x2acdb0['attributes']:_0x20e4dd[_0x7580('0x36')];if(_0x109fd8['query'][_0x7580('0x4a')]){_0x2acdb0[_0x7580('0x4b')]=[{'all':!![]}];}_0x2acdb0=_['merge']({},_0x2acdb0,_0x109fd8['options']);return db[_0x7580('0x33')]['find'](_0x2acdb0)['then'](handleEntityNotFound(_0x1fe4b2,null))['then'](respondWithResult(_0x1fe4b2,null))[_0x7580('0x25')](handleError(_0x1fe4b2,null));};exports[_0x7580('0x50')]=function(_0x3dae8b,_0x2956c2){return db[_0x7580('0x33')][_0x7580('0x50')](_0x3dae8b['body'],{})[_0x7580('0x1d')](respondWithResult(_0x2956c2,0xc9))[_0x7580('0x25')](handleError(_0x2956c2,null));};exports[_0x7580('0x2e')]=function(_0x2b6113,_0x47b902){if(_0x2b6113['body']['id']){delete _0x2b6113[_0x7580('0x51')]['id'];}return db[_0x7580('0x33')]['find']({'where':{'id':_0x2b6113[_0x7580('0x4f')]['id']}})[_0x7580('0x1d')](handleEntityNotFound(_0x47b902,null))[_0x7580('0x1d')](saveUpdates(_0x2b6113[_0x7580('0x51')],null))[_0x7580('0x1d')](respondWithResult(_0x47b902,null))[_0x7580('0x25')](handleError(_0x47b902,null));};exports['destroy']=function(_0x1da7b8,_0x204acd){return db['ServicenowAccount'][_0x7580('0x52')]({'where':{'id':_0x1da7b8[_0x7580('0x4f')]['id']}})['then'](handleEntityNotFound(_0x204acd,null))[_0x7580('0x1d')](removeEntity(_0x204acd,null))[_0x7580('0x25')](handleError(_0x204acd,null));};exports['getConfigurations']=function(_0x3ac39b,_0x536e61,_0x36abda){var _0x52a0d5={};var _0x2dc008={};var _0x34d25f;var _0xf9de19;return db[_0x7580('0x33')]['findOne']({'where':{'id':_0x3ac39b[_0x7580('0x4f')]['id']}})[_0x7580('0x1d')](handleEntityNotFound(_0x536e61,null))[_0x7580('0x1d')](function(_0x67194a){if(_0x67194a){_0x34d25f=_0x67194a;_0x2dc008['model']=_[_0x7580('0x38')](db[_0x7580('0x53')]['rawAttributes']);_0x2dc008[_0x7580('0x39')]=_[_0x7580('0x38')](_0x3ac39b[_0x7580('0x39')]);_0x2dc008['filters']=_[_0x7580('0x3c')](_0x2dc008[_0x7580('0x36')],_0x2dc008['query']);_0x52a0d5['attributes']=_[_0x7580('0x3c')](_0x2dc008[_0x7580('0x36')],qs[_0x7580('0x3d')](_0x3ac39b['query']['fields']));_0x52a0d5[_0x7580('0x3b')]=_0x52a0d5[_0x7580('0x3b')][_0x7580('0x3e')]?_0x52a0d5['attributes']:_0x2dc008[_0x7580('0x36')];_0x52a0d5[_0x7580('0x42')]=qs['sort'](_0x3ac39b[_0x7580('0x39')][_0x7580('0x43')]);_0x52a0d5[_0x7580('0x44')]=qs[_0x7580('0x3a')](_[_0x7580('0x45')](_0x3ac39b[_0x7580('0x39')],_0x2dc008[_0x7580('0x3a')]));if(_0x3ac39b[_0x7580('0x39')][_0x7580('0x46')]){_0x52a0d5['where']=_[_0x7580('0x47')](_0x52a0d5[_0x7580('0x44')],{'$or':_[_0x7580('0x37')](_0x52a0d5[_0x7580('0x3b')],function(_0xc2620b){var _0x519486={};_0x519486[_0xc2620b]={'$like':'%'+_0x3ac39b['query'][_0x7580('0x46')]+'%'};return _0x519486;})});}_0x52a0d5=_['merge']({},_0x52a0d5,_0x3ac39b[_0x7580('0x54')]);return _0x34d25f['getConfigurations'](_0x52a0d5);}})[_0x7580('0x1d')](function(_0x10121c){if(_0x10121c){_0xf9de19=_0x10121c[_0x7580('0x3e')];if(!_0x3ac39b[_0x7580('0x39')][_0x7580('0x3f')](_0x7580('0x40'))){_0x52a0d5[_0x7580('0x41')]=qs['limit'](_0x3ac39b[_0x7580('0x39')][_0x7580('0x41')]);_0x52a0d5['offset']=qs['offset'](_0x3ac39b['query'][_0x7580('0x2b')]);}return _0x34d25f[_0x7580('0x55')](_0x52a0d5);}})[_0x7580('0x1d')](function(_0x58dc3a){if(_0x58dc3a){return _0x58dc3a?{'count':_0xf9de19,'rows':_0x58dc3a}:null;}})[_0x7580('0x1d')](respondWithResult(_0x536e61,null))[_0x7580('0x25')](handleError(_0x536e61,null));};exports[_0x7580('0x56')]=function(_0x324cc6,_0x408078,_0x57334b){if(_0x324cc6[_0x7580('0x51')]['id']){delete _0x324cc6['body']['id'];}return db['ServicenowAccount'][_0x7580('0x57')]({'where':{'id':_0x324cc6[_0x7580('0x4f')]['id']}})[_0x7580('0x1d')](handleEntityNotFound(_0x408078,null))[_0x7580('0x1d')](function(_0x5a93d1){if(_0x5a93d1){_0x324cc6[_0x7580('0x51')][_0x7580('0x58')]=_0x5a93d1['id'];_0x324cc6[_0x7580('0x51')]['Subjects']=integrations[_0x7580('0x59')](_0x324cc6[_0x7580('0x51')][_0x7580('0x5a')],_0x324cc6[_0x7580('0x51')][_0x7580('0x48')]);_0x324cc6['body'][_0x7580('0x5b')]=integrations[_0x7580('0x5c')](_0x324cc6['body']['channel'],_0x324cc6[_0x7580('0x51')][_0x7580('0x48')]);return db[_0x7580('0x53')][_0x7580('0x50')](_0x324cc6['body'],{'include':[{'model':db[_0x7580('0x5d')],'as':'Subjects'},{'model':db[_0x7580('0x5d')],'as':_0x7580('0x5b')}]});}return null;})['then'](respondWithResult(_0x408078,null))[_0x7580('0x25')](handleError(_0x408078,null));};exports[_0x7580('0x5e')]=function(_0xfcd9c8,_0x3dd095,_0x4ed83c){var _0x123861=[_0x7580('0x5f'),_0x7580('0x60'),_0x7580('0x61'),_0x7580('0x62'),_0x7580('0x63'),_0x7580('0x64'),_0x7580('0x65'),_0x7580('0x66'),_0x7580('0x67')];var _0x1a6550=[_0x7580('0x68'),_0x7580('0x5f'),_0x7580('0x69'),'watch_list',_0x7580('0x6a'),_0x7580('0x6b'),_0x7580('0x6c'),_0x7580('0x60'),_0x7580('0x6d'),_0x7580('0x6e'),_0x7580('0x6f'),_0x7580('0x70'),_0x7580('0x71'),_0x7580('0x72'),_0x7580('0x73'),_0x7580('0x74'),'state',_0x7580('0x75'),'knowledge',_0x7580('0x42'),_0x7580('0x76'),_0x7580('0x77'),_0x7580('0x78'),_0x7580('0x79'),_0x7580('0x7a'),_0x7580('0x7b'),'work_notes_list',_0x7580('0x7c'),'priority','sys_domain_path',_0x7580('0x7d'),_0x7580('0x7e'),_0x7580('0x7f'),_0x7580('0x80'),_0x7580('0x81'),_0x7580('0x82'),'work_end',_0x7580('0x83'),_0x7580('0x84'),'caller_id',_0x7580('0x85'),_0x7580('0x62'),_0x7580('0x86'),'short_description','close_code','correlation_display','delivery_task',_0x7580('0x87'),_0x7580('0x88'),_0x7580('0x89'),_0x7580('0x8a'),_0x7580('0x8b'),_0x7580('0x8c'),_0x7580('0x64'),'sys_class_name',_0x7580('0x8d'),_0x7580('0x8e'),_0x7580('0x8f'),_0x7580('0x90'),_0x7580('0x91'),_0x7580('0x92'),'reopened_by',_0x7580('0x65'),_0x7580('0x93'),'problem_id',_0x7580('0x94'),_0x7580('0x95'),_0x7580('0x96'),'assigned_to',_0x7580('0x66'),'comments',_0x7580('0x97'),_0x7580('0x98'),_0x7580('0x99'),_0x7580('0x9a'),_0x7580('0x9b'),_0x7580('0x9c'),_0x7580('0x9d'),_0x7580('0x9e'),_0x7580('0x9f'),_0x7580('0xa0'),_0x7580('0xa1'),'category'];var _0x2f68fd='';var _0x52e1a8='';var _0x53b21b=[];var _0x40b178='';var _0x111068='';var _0x21f1a4=[];var _0x1e4600='';var _0x3f8edb='';var _0x2977fc={};var _0x4c03f7='';return db[_0x7580('0x33')][_0x7580('0x57')]({'where':{'id':_0xfcd9c8[_0x7580('0x4f')]['id']},'attributes':['id','username','password','email',_0x7580('0xa2'),_0x7580('0xa3')]})[_0x7580('0x1d')](handleEntityNotFound(_0x3dd095,null))['then'](function(_0x3389ae){if(_0x3389ae){_0x4c03f7=_0x3389ae[_0x7580('0xa2')];var _0x4fb10f=_0x4c03f7[_0x7580('0xa4')](-0x1);if(_0x4fb10f==='/'){_0x4c03f7=_0x4c03f7['substring'](0x0,_0x4c03f7[_0x7580('0xa5')](_0x4fb10f));}_0x3f8edb=util[_0x7580('0xa6')](_0x7580('0xa7'),_0x4c03f7);_0x1e4600=util[_0x7580('0xa6')]('%s/api/now/table/',_0x4c03f7);_0x2977fc={'user':_0x3389ae[_0x7580('0xa8')],'pass':_0x3389ae['password']};var _0x168c9d={'method':_0x7580('0xa9'),'uri':_0x3f8edb+'incident?sysparm_display_value=all','auth':_0x2977fc,'json':!![]};return rp(_0x168c9d);}})[_0x7580('0x1d')](function(_0xc5329f){if(_0xc5329f['result']['length']>0x0){_0x2f68fd=_0xc5329f['result'];}console[_0x7580('0xaa')](_0x7580('0xab'),_0x2f68fd);_0x21f1a4=[];_0x52e1a8=Object[_0x7580('0xac')]([],_0x2f68fd);_[_0x7580('0xad')](_0x52e1a8,function(_0x41296a){return!_0x123861[_0x7580('0xae')](_0x41296a[_0x7580('0x30')]);});_0x52e1a8[_0x7580('0xaf')](function(_0x205e57){var _0x4aff26=createFieldObject(_0x1e4600,_0x2977fc,_0x205e57[_0x7580('0xb0')],_0x205e57['name'],_0x205e57[_0x7580('0xb1')],![]);_0x21f1a4[_0x7580('0xb2')](_0x4aff26);});return Promise[_0x7580('0xb3')](_0x21f1a4);})[_0x7580('0x1d')](function(_0xf941bc){_0x53b21b=_0xf941bc;_0x40b178=Object[_0x7580('0xac')]([],_0x2f68fd);console['log'](_0x7580('0xb4'),_0x2f68fd);_[_0x7580('0xad')](_0x40b178,function(_0x2fa9d4){return _0x1a6550[_0x7580('0xae')](_0x2fa9d4[_0x7580('0x30')]);});console[_0x7580('0xaa')](_0x7580('0xb5'),_0x40b178);_0x21f1a4=[];_0x40b178[_0x7580('0xaf')](function(_0x52e3a7){var _0xaca533=createFieldObject(_0x1e4600,_0x2977fc,_0x52e3a7[_0x7580('0xb0')],_0x52e3a7['name'],_0x52e3a7[_0x7580('0xb1')],!![]);_0x21f1a4[_0x7580('0xb2')](_0xaca533);});return Promise[_0x7580('0xb3')](_0x21f1a4);})[_0x7580('0x1d')](function(_0x2a3b50){_0x111068=_0x2a3b50;var _0x3fd54b=_0x53b21b[_0x7580('0xb6')](_0x111068);return{'count':_0x3fd54b[_0x7580('0x3e')],'rows':_0x3fd54b};})['then'](respondWithResult(_0x3dd095,null))[_0x7580('0x25')](function(_0xd4cf48){console['log'](_0x7580('0xb7')+_0xd4cf48);var _0x2acea0=_0xfcd9c8[_0x7580('0x39')][_0x7580('0x1a')]?0x1f4:_0xd4cf48[_0x7580('0xb8')]||0x1f4;logger['error'](_0xd4cf48[_0x7580('0x2f')]);delete _0xd4cf48['name'];if(_0x2acea0===0x191){_0x2acea0=0x190;}_0x3dd095[_0x7580('0x27')](_0x2acea0)[_0x7580('0x31')](_0xfcd9c8['query'][_0x7580('0x1a')]?{'message':'Wrong\x20credentials','statusCode':_0xd4cf48['statusCode']}:_0xd4cf48);});};function createFieldObject(_0x1c3bd6,_0x500073,_0x47cef8,_0x1f8f5c,_0x143d2f,_0x385c93){return new Promise(function(_0x1326ad,_0x9247d6){var _0x476dad={'id':_0x1f8f5c,'name':_0x143d2f,'custom':_0x385c93};if(_0x47cef8===_0x7580('0xb9')){_0x476dad[_0x7580('0x54')]=[{'name':_0x7580('0xba'),'value':_0x7580('0xbb')},{'name':_0x7580('0xbc'),'value':'false'}];_0x1326ad(_0x476dad);}else{var _0x40a621={'method':_0x7580('0xa9'),'uri':_0x1c3bd6+_0x7580('0xbd')+_0x1f8f5c,'auth':_0x500073,'json':!![]};return rp(_0x40a621)[_0x7580('0x1d')](function(_0x5d2f19){var _0x372606=[];if(_0x5d2f19['result'][_0x7580('0x3e')]>0x0){_0x5d2f19[_0x7580('0xbe')][_0x7580('0xaf')](function(_0x5f0d9b){if(_0x5f0d9b['inactive']===_0x7580('0xbf')){var _0x2073e7={'name':_0x5f0d9b[_0x7580('0xb1')],'value':_0x5f0d9b[_0x7580('0xc0')]};_0x372606[_0x7580('0xb2')](_0x2073e7);}});}_0x476dad[_0x7580('0x54')]=_0x372606;if(_0x476dad[_0x7580('0x54')][_0x7580('0x3e')]>0x0){_0x1326ad(_0x476dad);}else{if(_0x385c93==![]){_0x1326ad();}else{_0x1326ad(_0x476dad);}}});}});} \ No newline at end of file +var _0xea17=['sendStatus','status','end','json','count','offset','set','Content-Range','apply','update','then','destroy','stack','name','index','map','ServicenowAccount','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ServicenowConfiguration','ServicenowField','Descriptions','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','caused_by','watch_list','resolved_by','sys_updated_by','user_input','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','sys_domain_path','group_list','work_end','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','additional_assignee_list','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','reopened_by','urgency','problem_id','company','assigned_to','comments','sla_due','comments_and_work_notes','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','result','log','incident\x20table\x20objects','assign','includes','forEach','internalType','all','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','True','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','push','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','ServicenowAccount,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','catch'];(function(_0x10f1d0,_0x33dc6a){var _0x59b930=function(_0x4ae164){while(--_0x4ae164){_0x10f1d0['push'](_0x10f1d0['shift']());}};_0x59b930(++_0x33dc6a);}(_0xea17,0x99));var _0x7ea1=function(_0x291772,_0x27123b){_0x291772=_0x291772-0x0;var _0x359d17=_0xea17[_0x291772];return _0x359d17;};'use strict';var pdf=require(_0x7ea1('0x0'));var emlformat=require(_0x7ea1('0x1'));var rimraf=require(_0x7ea1('0x2'));var zipdir=require(_0x7ea1('0x3'));var jsonpatch=require(_0x7ea1('0x4'));var rp=require('request-promise');var moment=require(_0x7ea1('0x5'));var BPromise=require(_0x7ea1('0x6'));var Mustache=require('mustache');var util=require(_0x7ea1('0x7'));var path=require(_0x7ea1('0x8'));var sox=require('sox');var csv=require(_0x7ea1('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x7ea1('0xa'));var crypto=require(_0x7ea1('0xb'));var jsforce=require(_0x7ea1('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7ea1('0x9'));var querystring=require('querystring');var Papa=require(_0x7ea1('0xd'));var Redis=require(_0x7ea1('0xe'));var authService=require(_0x7ea1('0xf'));var qs=require(_0x7ea1('0x10'));var as=require(_0x7ea1('0x11'));var hardwareService=require(_0x7ea1('0x12'));var logger=require(_0x7ea1('0x13'))('api');var utils=require(_0x7ea1('0x14'));var config=require('../../config/environment');var db=require(_0x7ea1('0x15'))['db'];var integrations=require(_0x7ea1('0x16'));var jayson=require(_0x7ea1('0x17'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x56057d,_0x17e833,_0x2ddb7c){if(_0x2ddb7c){var _0x4dc7d3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4dc7d3['test'](_0x17e833)){return _0x56057d;}else{throw new db['Sequelize'][(_0x7ea1('0x18'))](_0x7ea1('0x19'));}}else{return _0x56057d;}}function respondWithRpcPromise(_0x3cf31e,_0x2a848b,_0x4cd9dc,_0x17f794){return new BPromise(function(_0xcd9f42,_0x3b41ea){var _0x4da284=_0x17f794||client;return _0x4da284[_0x7ea1('0x1a')](_0x3cf31e,_0x4cd9dc)['then'](function(_0x1e2983){logger[_0x7ea1('0x1b')](_0x7ea1('0x1c'),_0x2a848b,'request\x20sent');logger[_0x7ea1('0x1d')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x2a848b,'request\x20sent',JSON[_0x7ea1('0x1e')](_0x1e2983));if(_0x1e2983[_0x7ea1('0x1f')]){if(_0x1e2983[_0x7ea1('0x1f')][_0x7ea1('0x20')]===0x1f4){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x2a848b,_0x1e2983[_0x7ea1('0x1f')][_0x7ea1('0x21')]);return _0x3b41ea(_0x1e2983[_0x7ea1('0x1f')][_0x7ea1('0x21')]);}logger[_0x7ea1('0x1f')](_0x7ea1('0x1c'),_0x2a848b,_0x1e2983[_0x7ea1('0x1f')][_0x7ea1('0x21')]);return _0xcd9f42(_0x1e2983[_0x7ea1('0x1f')][_0x7ea1('0x21')]);}else{logger[_0x7ea1('0x1b')](_0x7ea1('0x1c'),_0x2a848b,_0x7ea1('0x22'));_0xcd9f42(_0x1e2983['result'][_0x7ea1('0x21')]);}})[_0x7ea1('0x23')](function(_0x5a8e46){logger['error'](_0x7ea1('0x1c'),_0x2a848b,_0x5a8e46);_0x3b41ea(_0x5a8e46);});});}function respondWithStatusCode(_0x309378,_0x4ecd91){_0x4ecd91=_0x4ecd91||0xcc;return function(_0x78d1c){if(_0x78d1c){return _0x309378[_0x7ea1('0x24')](_0x4ecd91);}return _0x309378[_0x7ea1('0x25')](_0x4ecd91)[_0x7ea1('0x26')]();};}function respondWithResult(_0x4b17e8,_0x3557bd){_0x3557bd=_0x3557bd||0xc8;return function(_0x47ce66){if(_0x47ce66){return _0x4b17e8[_0x7ea1('0x25')](_0x3557bd)[_0x7ea1('0x27')](_0x47ce66);}};}function respondWithFilteredResult(_0x5ec560,_0x5ced80){return function(_0x27972f){if(_0x27972f){var _0x410d2e=_0x27972f[_0x7ea1('0x28')],_0x3db68d=_0x5ced80[_0x7ea1('0x29')],_0x5b83dc=_0x5ced80['offset']+_0x5ced80['limit'],_0x3f4a11;if(_0x5b83dc>=_0x410d2e){_0x5b83dc=_0x410d2e;_0x3f4a11=0xc8;}else{_0x3f4a11=0xce;}_0x5ec560[_0x7ea1('0x25')](_0x3f4a11);return _0x5ec560[_0x7ea1('0x2a')](_0x7ea1('0x2b'),_0x3db68d+'-'+_0x5b83dc+'/'+_0x410d2e)[_0x7ea1('0x27')](_0x27972f);}return null;};}function patchUpdates(_0x5ec3e0){return function(_0x17b6d2){try{jsonpatch[_0x7ea1('0x2c')](_0x17b6d2,_0x5ec3e0,!![]);}catch(_0x54f13c){return BPromise['reject'](_0x54f13c);}return _0x17b6d2['save']();};}function saveUpdates(_0x566446,_0x2e6d06){return function(_0x49622c){if(_0x49622c){return _0x49622c[_0x7ea1('0x2d')](_0x566446)[_0x7ea1('0x2e')](function(_0xef9e18){return _0xef9e18;});}return null;};}function removeEntity(_0x33aaa0,_0x4873fa){return function(_0x2abac0){if(_0x2abac0){return _0x2abac0[_0x7ea1('0x2f')]()[_0x7ea1('0x2e')](function(){_0x33aaa0[_0x7ea1('0x25')](0xcc)[_0x7ea1('0x26')]();});}};}function handleEntityNotFound(_0x4a6750,_0x2d6b89){return function(_0x33fb42){if(!_0x33fb42){_0x4a6750[_0x7ea1('0x24')](0x194);}return _0x33fb42;};}function handleError(_0x19b8ab,_0x22efcf){_0x22efcf=_0x22efcf||0x1f4;return function(_0xfd0c27){logger[_0x7ea1('0x1f')](_0xfd0c27[_0x7ea1('0x30')]);if(_0xfd0c27[_0x7ea1('0x31')]){delete _0xfd0c27[_0x7ea1('0x31')];}_0x19b8ab[_0x7ea1('0x25')](_0x22efcf)['send'](_0xfd0c27);};}exports[_0x7ea1('0x32')]=function(_0xd8583,_0x402076){var _0xf9579e={},_0x25a801={},_0x177dd5={'count':0x0,'rows':[]};var _0x1473cd=_[_0x7ea1('0x33')](db[_0x7ea1('0x34')]['rawAttributes'],function(_0x53621e){return{'name':_0x53621e[_0x7ea1('0x35')],'type':_0x53621e[_0x7ea1('0x36')][_0x7ea1('0x37')]};});_0x25a801['model']=_['map'](_0x1473cd,_0x7ea1('0x31'));_0x25a801['query']=_[_0x7ea1('0x38')](_0xd8583['query']);_0x25a801[_0x7ea1('0x39')]=_[_0x7ea1('0x3a')](_0x25a801[_0x7ea1('0x3b')],_0x25a801[_0x7ea1('0x3c')]);_0xf9579e[_0x7ea1('0x3d')]=_[_0x7ea1('0x3a')](_0x25a801[_0x7ea1('0x3b')],qs[_0x7ea1('0x3e')](_0xd8583[_0x7ea1('0x3c')][_0x7ea1('0x3e')]));_0xf9579e['attributes']=_0xf9579e[_0x7ea1('0x3d')][_0x7ea1('0x3f')]?_0xf9579e[_0x7ea1('0x3d')]:_0x25a801[_0x7ea1('0x3b')];if(!_0xd8583[_0x7ea1('0x3c')][_0x7ea1('0x40')](_0x7ea1('0x41'))){_0xf9579e['limit']=qs['limit'](_0xd8583['query'][_0x7ea1('0x42')]);_0xf9579e[_0x7ea1('0x29')]=qs[_0x7ea1('0x29')](_0xd8583[_0x7ea1('0x3c')][_0x7ea1('0x29')]);}_0xf9579e[_0x7ea1('0x43')]=qs[_0x7ea1('0x44')](_0xd8583[_0x7ea1('0x3c')][_0x7ea1('0x44')]);_0xf9579e['where']=qs[_0x7ea1('0x39')](_[_0x7ea1('0x45')](_0xd8583[_0x7ea1('0x3c')],_0x25a801[_0x7ea1('0x39')]));if(_0xd8583['query'][_0x7ea1('0x46')]){_0xf9579e[_0x7ea1('0x47')]=_[_0x7ea1('0x48')](_0xf9579e['where'],{'$or':_[_0x7ea1('0x33')](_0x1473cd,function(_0x5103a4){if(_0x5103a4['type']!==_0x7ea1('0x49')){var _0x1d1921={};_0x1d1921[_0x5103a4[_0x7ea1('0x31')]]={'$like':'%'+_0xd8583[_0x7ea1('0x3c')][_0x7ea1('0x46')]+'%'};return _0x1d1921;}})});}_0xf9579e=_['merge']({},_0xf9579e,_0xd8583[_0x7ea1('0x4a')]);var _0x4c32b6={'where':_0xf9579e[_0x7ea1('0x47')]};return db['ServicenowAccount'][_0x7ea1('0x28')](_0x4c32b6)[_0x7ea1('0x2e')](function(_0x1f648c){_0x177dd5[_0x7ea1('0x28')]=_0x1f648c;if(_0xd8583[_0x7ea1('0x3c')][_0x7ea1('0x4b')]){_0xf9579e[_0x7ea1('0x4c')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x7ea1('0x4d')](_0xf9579e);})[_0x7ea1('0x2e')](function(_0x12492c){_0x177dd5[_0x7ea1('0x4e')]=_0x12492c;return _0x177dd5;})['then'](respondWithFilteredResult(_0x402076,_0xf9579e))[_0x7ea1('0x23')](handleError(_0x402076,null));};exports[_0x7ea1('0x4f')]=function(_0x4b68e1,_0x53a5c6){var _0xf546d2={'raw':![],'where':{'id':_0x4b68e1[_0x7ea1('0x50')]['id']}},_0x9848b2={};_0x9848b2[_0x7ea1('0x3b')]=_[_0x7ea1('0x38')](db['ServicenowAccount'][_0x7ea1('0x51')]);_0x9848b2[_0x7ea1('0x3c')]=_[_0x7ea1('0x38')](_0x4b68e1['query']);_0x9848b2['filters']=_[_0x7ea1('0x3a')](_0x9848b2[_0x7ea1('0x3b')],_0x9848b2[_0x7ea1('0x3c')]);_0xf546d2[_0x7ea1('0x3d')]=_[_0x7ea1('0x3a')](_0x9848b2[_0x7ea1('0x3b')],qs[_0x7ea1('0x3e')](_0x4b68e1['query'][_0x7ea1('0x3e')]));_0xf546d2[_0x7ea1('0x3d')]=_0xf546d2[_0x7ea1('0x3d')][_0x7ea1('0x3f')]?_0xf546d2[_0x7ea1('0x3d')]:_0x9848b2['model'];if(_0x4b68e1[_0x7ea1('0x3c')]['includeAll']){_0xf546d2[_0x7ea1('0x4c')]=[{'all':!![]}];}_0xf546d2=_[_0x7ea1('0x48')]({},_0xf546d2,_0x4b68e1['options']);return db[_0x7ea1('0x34')][_0x7ea1('0x52')](_0xf546d2)[_0x7ea1('0x2e')](handleEntityNotFound(_0x53a5c6,null))[_0x7ea1('0x2e')](respondWithResult(_0x53a5c6,null))[_0x7ea1('0x23')](handleError(_0x53a5c6,null));};exports[_0x7ea1('0x53')]=function(_0x510d3e,_0x225f0d){return db['ServicenowAccount'][_0x7ea1('0x53')](_0x510d3e['body'],{})[_0x7ea1('0x2e')](respondWithResult(_0x225f0d,0xc9))[_0x7ea1('0x23')](handleError(_0x225f0d,null));};exports['update']=function(_0x581e62,_0xeeab7f){if(_0x581e62['body']['id']){delete _0x581e62[_0x7ea1('0x54')]['id'];}return db['ServicenowAccount'][_0x7ea1('0x52')]({'where':{'id':_0x581e62[_0x7ea1('0x50')]['id']}})[_0x7ea1('0x2e')](handleEntityNotFound(_0xeeab7f,null))[_0x7ea1('0x2e')](saveUpdates(_0x581e62['body'],null))[_0x7ea1('0x2e')](respondWithResult(_0xeeab7f,null))[_0x7ea1('0x23')](handleError(_0xeeab7f,null));};exports['destroy']=function(_0x1074c4,_0x901a20){return db[_0x7ea1('0x34')][_0x7ea1('0x52')]({'where':{'id':_0x1074c4[_0x7ea1('0x50')]['id']}})[_0x7ea1('0x2e')](handleEntityNotFound(_0x901a20,null))['then'](removeEntity(_0x901a20,null))[_0x7ea1('0x23')](handleError(_0x901a20,null));};exports[_0x7ea1('0x55')]=function(_0x450921,_0x48b6dc,_0x27807a){var _0x51e332={};var _0x879fc6={};var _0x4f6fd7;var _0xbc39a0;return db[_0x7ea1('0x34')][_0x7ea1('0x56')]({'where':{'id':_0x450921[_0x7ea1('0x50')]['id']}})[_0x7ea1('0x2e')](handleEntityNotFound(_0x48b6dc,null))[_0x7ea1('0x2e')](function(_0x135282){if(_0x135282){_0x4f6fd7=_0x135282;_0x879fc6[_0x7ea1('0x3b')]=_[_0x7ea1('0x38')](db['ServicenowConfiguration'][_0x7ea1('0x51')]);_0x879fc6['query']=_[_0x7ea1('0x38')](_0x450921[_0x7ea1('0x3c')]);_0x879fc6[_0x7ea1('0x39')]=_[_0x7ea1('0x3a')](_0x879fc6[_0x7ea1('0x3b')],_0x879fc6['query']);_0x51e332['attributes']=_[_0x7ea1('0x3a')](_0x879fc6[_0x7ea1('0x3b')],qs[_0x7ea1('0x3e')](_0x450921['query'][_0x7ea1('0x3e')]));_0x51e332[_0x7ea1('0x3d')]=_0x51e332[_0x7ea1('0x3d')]['length']?_0x51e332[_0x7ea1('0x3d')]:_0x879fc6[_0x7ea1('0x3b')];_0x51e332[_0x7ea1('0x43')]=qs['sort'](_0x450921['query']['sort']);_0x51e332[_0x7ea1('0x47')]=qs['filters'](_[_0x7ea1('0x45')](_0x450921[_0x7ea1('0x3c')],_0x879fc6[_0x7ea1('0x39')]));if(_0x450921[_0x7ea1('0x3c')][_0x7ea1('0x46')]){_0x51e332[_0x7ea1('0x47')]=_[_0x7ea1('0x48')](_0x51e332[_0x7ea1('0x47')],{'$or':_[_0x7ea1('0x33')](_0x51e332['attributes'],function(_0x35a9bc){var _0x505b47={};_0x505b47[_0x35a9bc]={'$like':'%'+_0x450921[_0x7ea1('0x3c')]['filter']+'%'};return _0x505b47;})});}_0x51e332=_[_0x7ea1('0x48')]({},_0x51e332,_0x450921[_0x7ea1('0x4a')]);return _0x4f6fd7[_0x7ea1('0x55')](_0x51e332);}})[_0x7ea1('0x2e')](function(_0x635a1f){if(_0x635a1f){_0xbc39a0=_0x635a1f[_0x7ea1('0x3f')];if(!_0x450921['query'][_0x7ea1('0x40')](_0x7ea1('0x41'))){_0x51e332[_0x7ea1('0x42')]=qs[_0x7ea1('0x42')](_0x450921[_0x7ea1('0x3c')][_0x7ea1('0x42')]);_0x51e332[_0x7ea1('0x29')]=qs[_0x7ea1('0x29')](_0x450921[_0x7ea1('0x3c')][_0x7ea1('0x29')]);}return _0x4f6fd7[_0x7ea1('0x55')](_0x51e332);}})[_0x7ea1('0x2e')](function(_0x17c5a6){if(_0x17c5a6){return _0x17c5a6?{'count':_0xbc39a0,'rows':_0x17c5a6}:null;}})['then'](respondWithResult(_0x48b6dc,null))['catch'](handleError(_0x48b6dc,null));};exports[_0x7ea1('0x57')]=function(_0x35c122,_0x50cb,_0x4ba65c){if(_0x35c122[_0x7ea1('0x54')]['id']){delete _0x35c122[_0x7ea1('0x54')]['id'];}return db['ServicenowAccount'][_0x7ea1('0x56')]({'where':{'id':_0x35c122[_0x7ea1('0x50')]['id']}})[_0x7ea1('0x2e')](handleEntityNotFound(_0x50cb,null))[_0x7ea1('0x2e')](function(_0x6eacb5){if(_0x6eacb5){_0x35c122[_0x7ea1('0x54')][_0x7ea1('0x58')]=_0x6eacb5['id'];_0x35c122[_0x7ea1('0x54')][_0x7ea1('0x59')]=integrations[_0x7ea1('0x5a')](_0x35c122[_0x7ea1('0x54')][_0x7ea1('0x5b')],_0x35c122[_0x7ea1('0x54')][_0x7ea1('0x36')]);_0x35c122[_0x7ea1('0x54')]['Descriptions']=integrations[_0x7ea1('0x5c')](_0x35c122[_0x7ea1('0x54')][_0x7ea1('0x5b')],_0x35c122[_0x7ea1('0x54')][_0x7ea1('0x36')]);return db[_0x7ea1('0x5d')][_0x7ea1('0x53')](_0x35c122[_0x7ea1('0x54')],{'include':[{'model':db[_0x7ea1('0x5e')],'as':'Subjects'},{'model':db['ServicenowField'],'as':_0x7ea1('0x5f')}]});}return null;})[_0x7ea1('0x2e')](respondWithResult(_0x50cb,null))[_0x7ea1('0x23')](handleError(_0x50cb,null));};exports[_0x7ea1('0x60')]=function(_0x413f14,_0xfe8893,_0x4c60ae){var _0x4934e1=[_0x7ea1('0x61'),_0x7ea1('0x62'),_0x7ea1('0x63'),_0x7ea1('0x64'),_0x7ea1('0x65'),_0x7ea1('0x66'),_0x7ea1('0x67'),_0x7ea1('0x68'),_0x7ea1('0x69')];var _0x49c1c0=[_0x7ea1('0x6a'),'made_sla',_0x7ea1('0x6b'),_0x7ea1('0x6c'),'upon_reject','sys_updated_on','child_incidents',_0x7ea1('0x62'),'approval_history','number',_0x7ea1('0x6d'),_0x7ea1('0x6e'),'opened_by',_0x7ea1('0x6f'),'sys_created_on','sys_domain',_0x7ea1('0x70'),_0x7ea1('0x71'),_0x7ea1('0x63'),_0x7ea1('0x43'),_0x7ea1('0x72'),_0x7ea1('0x73'),_0x7ea1('0x74'),_0x7ea1('0x75'),_0x7ea1('0x76'),_0x7ea1('0x77'),_0x7ea1('0x78'),_0x7ea1('0x79'),'priority',_0x7ea1('0x7a'),'rfc','time_worked','expected_start','opened_at','business_duration',_0x7ea1('0x7b'),_0x7ea1('0x7c'),'reopened_time',_0x7ea1('0x7d'),_0x7ea1('0x7e'),_0x7ea1('0x7f'),'subcategory',_0x7ea1('0x80'),_0x7ea1('0x81'),'close_code',_0x7ea1('0x82'),_0x7ea1('0x83'),_0x7ea1('0x84'),'assignment_group','business_stc',_0x7ea1('0x85'),'description',_0x7ea1('0x86'),'notify',_0x7ea1('0x87'),_0x7ea1('0x88'),_0x7ea1('0x89'),_0x7ea1('0x8a'),_0x7ea1('0x8b'),_0x7ea1('0x8c'),'contact_type',_0x7ea1('0x8d'),'incident_state',_0x7ea1('0x8e'),_0x7ea1('0x8f'),_0x7ea1('0x90'),'reassignment_count','activity_due',_0x7ea1('0x91'),_0x7ea1('0x68'),_0x7ea1('0x92'),_0x7ea1('0x93'),'approval',_0x7ea1('0x94'),'due_date',_0x7ea1('0x95'),_0x7ea1('0x96'),_0x7ea1('0x97'),_0x7ea1('0x98'),_0x7ea1('0x99'),_0x7ea1('0x9a'),_0x7ea1('0x9b'),'category'];var _0x4f991d='';var _0x131a0a='';var _0x4ddf62=[];var _0x55f1b3='';var _0xa2402e='';var _0x36c1ce=[];var _0x45d4d6='';var _0x4cf354='';var _0xda5b5f={};var _0x2598a3='';return db['ServicenowAccount']['findOne']({'where':{'id':_0x413f14[_0x7ea1('0x50')]['id']},'attributes':['id',_0x7ea1('0x9c'),_0x7ea1('0x9d'),_0x7ea1('0x9e'),_0x7ea1('0x9f'),_0x7ea1('0xa0')]})[_0x7ea1('0x2e')](handleEntityNotFound(_0xfe8893,null))['then'](function(_0xd64bb4){if(_0xd64bb4){_0x2598a3=_0xd64bb4[_0x7ea1('0x9f')];var _0xc47163=_0x2598a3[_0x7ea1('0xa1')](-0x1);if(_0xc47163==='/'){_0x2598a3=_0x2598a3[_0x7ea1('0xa2')](0x0,_0x2598a3[_0x7ea1('0xa3')](_0xc47163));}_0x4cf354=util['format'](_0x7ea1('0xa4'),_0x2598a3);_0x45d4d6=util['format'](_0x7ea1('0xa5'),_0x2598a3);_0xda5b5f={'user':_0xd64bb4['username'],'pass':_0xd64bb4[_0x7ea1('0x9d')]};var _0x87f5cf={'method':_0x7ea1('0xa6'),'uri':_0x4cf354+'incident?sysparm_display_value=all','auth':_0xda5b5f,'json':!![]};return rp(_0x87f5cf);}})[_0x7ea1('0x2e')](function(_0x150439){if(_0x150439[_0x7ea1('0xa7')][_0x7ea1('0x3f')]>0x0){_0x4f991d=_0x150439['result'];}console[_0x7ea1('0xa8')](_0x7ea1('0xa9'),_0x4f991d);_0x36c1ce=[];_0x131a0a=Object[_0x7ea1('0xaa')]([],_0x4f991d);_['remove'](_0x131a0a,function(_0x2148fe){return!_0x4934e1[_0x7ea1('0xab')](_0x2148fe[_0x7ea1('0x31')]);});_0x131a0a[_0x7ea1('0xac')](function(_0x4e4d74){var _0xe71c2=createFieldObject(_0x45d4d6,_0xda5b5f,_0x4e4d74[_0x7ea1('0xad')],_0x4e4d74[_0x7ea1('0x31')],_0x4e4d74['label'],![]);_0x36c1ce['push'](_0xe71c2);});return Promise[_0x7ea1('0xae')](_0x36c1ce);})[_0x7ea1('0x2e')](function(_0x27e1ff){_0x4ddf62=_0x27e1ff;_0x55f1b3=Object['assign']([],_0x4f991d);console['log']('TCL:\x20_object',_0x4f991d);_[_0x7ea1('0xaf')](_0x55f1b3,function(_0x1a3964){return _0x49c1c0[_0x7ea1('0xab')](_0x1a3964[_0x7ea1('0x31')]);});console[_0x7ea1('0xa8')](_0x7ea1('0xb0'),_0x55f1b3);_0x36c1ce=[];_0x55f1b3[_0x7ea1('0xac')](function(_0x5e7ca7){var _0x486b71=createFieldObject(_0x45d4d6,_0xda5b5f,_0x5e7ca7[_0x7ea1('0xad')],_0x5e7ca7[_0x7ea1('0x31')],_0x5e7ca7['label'],!![]);_0x36c1ce['push'](_0x486b71);});return Promise['all'](_0x36c1ce);})['then'](function(_0x5cbe7d){_0xa2402e=_0x5cbe7d;var _0x4a8665=_0x4ddf62[_0x7ea1('0xb1')](_0xa2402e);return{'count':_0x4a8665[_0x7ea1('0x3f')],'rows':_0x4a8665};})[_0x7ea1('0x2e')](respondWithResult(_0xfe8893,null))['catch'](function(_0x3fa7fa){console['log'](_0x7ea1('0xb2')+_0x3fa7fa);var _0x144cb6=_0x413f14[_0x7ea1('0x3c')][_0x7ea1('0xb3')]?0x1f4:_0x3fa7fa[_0x7ea1('0xb4')]||0x1f4;logger[_0x7ea1('0x1f')](_0x3fa7fa[_0x7ea1('0x30')]);delete _0x3fa7fa[_0x7ea1('0x31')];if(_0x144cb6===0x191){_0x144cb6=0x190;}_0xfe8893[_0x7ea1('0x25')](_0x144cb6)['send'](_0x413f14[_0x7ea1('0x3c')][_0x7ea1('0xb3')]?{'message':_0x7ea1('0xb5'),'statusCode':_0x3fa7fa[_0x7ea1('0xb4')]}:_0x3fa7fa);});};function createFieldObject(_0x1f0103,_0x5e72ff,_0x26dc9e,_0x3c8a7b,_0x53caaa,_0x235f2a){return new Promise(function(_0x77c6c0,_0x16d534){var _0x8ea39d={'id':_0x3c8a7b,'name':_0x53caaa,'custom':_0x235f2a};if(_0x26dc9e==='boolean'){_0x8ea39d['options']=[{'name':_0x7ea1('0xb6'),'value':'true'},{'name':_0x7ea1('0xb7'),'value':_0x7ea1('0xb8')}];_0x77c6c0(_0x8ea39d);}else{var _0x4a2db7={'method':'GET','uri':_0x1f0103+_0x7ea1('0xb9')+_0x3c8a7b,'auth':_0x5e72ff,'json':!![]};return rp(_0x4a2db7)['then'](function(_0x3c0bb7){var _0x2fccd3=[];if(_0x3c0bb7[_0x7ea1('0xa7')][_0x7ea1('0x3f')]>0x0){_0x3c0bb7[_0x7ea1('0xa7')][_0x7ea1('0xac')](function(_0x4ab1a5){if(_0x4ab1a5[_0x7ea1('0xba')]===_0x7ea1('0xb8')){var _0xbe3bcd={'name':_0x4ab1a5['label'],'value':_0x4ab1a5[_0x7ea1('0xbb')]};_0x2fccd3[_0x7ea1('0xbc')](_0xbe3bcd);}});}_0x8ea39d[_0x7ea1('0x4a')]=_0x2fccd3;if(_0x8ea39d[_0x7ea1('0x4a')]['length']>0x0){_0x77c6c0(_0x8ea39d);}else{if(_0x235f2a==![]){_0x77c6c0();}else{_0x77c6c0(_0x8ea39d);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 5ac1571..7e569d1 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 _0x5178=['rimraf','../../config/environment','../../components/integrations/configuration','define','ServicenowAccount','int_servicenow_accounts','util','../../config/logger','api','moment','bluebird'];(function(_0x201d56,_0x5a6902){var _0x15ab25=function(_0x52d6dd){while(--_0x52d6dd){_0x201d56['push'](_0x201d56['shift']());}};_0x15ab25(++_0x5a6902);}(_0x5178,0x171));var _0x8517=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x5178[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0x8517('0x0'));var logger=require(_0x8517('0x1'))(_0x8517('0x2'));var moment=require(_0x8517('0x3'));var BPromise=require(_0x8517('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8517('0x5'));var config=require(_0x8517('0x6'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0x8517('0x7'));module['exports']=function(_0x13ba05,_0x45498e){return _0x13ba05[_0x8517('0x8')](_0x8517('0x9'),attributes,{'tableName':_0x8517('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x81bd=['../../config/environment','./intServicenowAccount.attributes','exports','int_servicenow_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x53b594,_0x559767){var _0x1e616f=function(_0x333eda){while(--_0x333eda){_0x53b594['push'](_0x53b594['shift']());}};_0x1e616f(++_0x559767);}(_0x81bd,0x7c));var _0xd81b=function(_0xf0ec6e,_0xa183d3){_0xf0ec6e=_0xf0ec6e-0x0;var _0x8bbc27=_0x81bd[_0xf0ec6e];return _0x8bbc27;};'use strict';var _=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var logger=require(_0xd81b('0x2'))(_0xd81b('0x3'));var moment=require(_0xd81b('0x4'));var BPromise=require(_0xd81b('0x5'));var rp=require(_0xd81b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd81b('0x7'));var config=require(_0xd81b('0x8'));var attributes=require(_0xd81b('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xd81b('0xa')]=function(_0x34eb73,_0x1f3f2c){return _0x34eb73['define']('ServicenowAccount',attributes,{'tableName':_0xd81b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 0335cad..6d16260 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 _0xb0ff=['randomstring','../../config/utils','rpc','../../config/environment','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','findAll','options','raw','where','attributes','include','map','model','GetServicenowAccount','stringify','catch','ShowServicenowAccount','find','lodash','moment','bluebird'];(function(_0x1dda84,_0x3ae4cb){var _0x3cb62d=function(_0x42f525){while(--_0x42f525){_0x1dda84['push'](_0x1dda84['shift']());}};_0x3cb62d(++_0x3ae4cb);}(_0xb0ff,0xd6));var _0xfb0f=function(_0x2682fe,_0x4fe106){_0x2682fe=_0x2682fe-0x0;var _0x2dc372=_0xb0ff[_0x2682fe];return _0x2dc372;};'use strict';var _=require(_0xfb0f('0x0'));var util=require('util');var moment=require(_0xfb0f('0x1'));var BPromise=require(_0xfb0f('0x2'));var rs=require(_0xfb0f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfb0f('0x4'));var logger=require('../../config/logger')(_0xfb0f('0x5'));var config=require(_0xfb0f('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfb0f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x471c68,_0x8c0254,_0x44eea3){return new BPromise(function(_0x1c9425,_0x206aed){return client[_0xfb0f('0x8')](_0x471c68,_0x44eea3)[_0xfb0f('0x9')](function(_0x1b5d5e){logger[_0xfb0f('0xa')](_0xfb0f('0xb'),_0x8c0254,_0xfb0f('0xc'));logger[_0xfb0f('0xd')](_0xfb0f('0xe'),_0x8c0254,_0xfb0f('0xc'),JSON['stringify'](_0x1b5d5e));if(_0x1b5d5e[_0xfb0f('0xf')]){if(_0x1b5d5e[_0xfb0f('0xf')][_0xfb0f('0x10')]===0x1f4){logger['error'](_0xfb0f('0xb'),_0x8c0254,_0x1b5d5e[_0xfb0f('0xf')][_0xfb0f('0x11')]);return _0x206aed(_0x1b5d5e[_0xfb0f('0xf')][_0xfb0f('0x11')]);}logger[_0xfb0f('0xf')]('ServicenowAccount,\x20%s,\x20%s',_0x8c0254,_0x1b5d5e[_0xfb0f('0xf')][_0xfb0f('0x11')]);return _0x1c9425(_0x1b5d5e['error'][_0xfb0f('0x11')]);}else{logger[_0xfb0f('0xa')]('ServicenowAccount,\x20%s,\x20%s',_0x8c0254,_0xfb0f('0xc'));_0x1c9425(_0x1b5d5e['result'][_0xfb0f('0x11')]);}})['catch'](function(_0x37c412){logger[_0xfb0f('0xf')](_0xfb0f('0xb'),_0x8c0254,_0x37c412);_0x206aed(_0x37c412);});});}exports['GetServicenowAccount']=function(_0x170c0d){var _0x125a82=this;return new Promise(function(_0x16672e,_0x217647){return db['ServicenowAccount'][_0xfb0f('0x12')]({'raw':_0x170c0d[_0xfb0f('0x13')]?_0x170c0d[_0xfb0f('0x13')][_0xfb0f('0x14')]===undefined?!![]:![]:!![],'where':_0x170c0d[_0xfb0f('0x13')]?_0x170c0d[_0xfb0f('0x13')][_0xfb0f('0x15')]||null:null,'attributes':_0x170c0d[_0xfb0f('0x13')]?_0x170c0d[_0xfb0f('0x13')][_0xfb0f('0x16')]||null:null,'limit':_0x170c0d[_0xfb0f('0x13')]?_0x170c0d['options']['limit']||null:null,'include':_0x170c0d['options']?_0x170c0d[_0xfb0f('0x13')][_0xfb0f('0x17')]?_[_0xfb0f('0x18')](_0x170c0d['options']['include'],function(_0x3f7008){return{'model':db[_0x3f7008[_0xfb0f('0x19')]],'as':_0x3f7008['as'],'attributes':_0x3f7008['attributes'],'include':_0x3f7008[_0xfb0f('0x17')]?_[_0xfb0f('0x18')](_0x3f7008[_0xfb0f('0x17')],function(_0x3a8fc5){return{'model':db[_0x3a8fc5['model']],'as':_0x3a8fc5['as'],'attributes':_0x3a8fc5[_0xfb0f('0x16')],'include':_0x3a8fc5['include']?_[_0xfb0f('0x18')](_0x3a8fc5[_0xfb0f('0x17')],function(_0x396937){return{'model':db[_0x396937[_0xfb0f('0x19')]],'as':_0x396937['as'],'attributes':_0x396937[_0xfb0f('0x16')]};}):[]};}):[]};}):[]:[]})[_0xfb0f('0x9')](function(_0x1813e2){logger[_0xfb0f('0xa')]('GetServicenowAccount',_0x170c0d);logger['debug'](_0xfb0f('0x1a'),_0x170c0d,JSON[_0xfb0f('0x1b')](_0x1813e2));_0x16672e(_0x1813e2);})[_0xfb0f('0x1c')](function(_0x31b7fe){logger['error'](_0xfb0f('0x1a'),_0x31b7fe[_0xfb0f('0x11')],_0x170c0d);_0x217647(_0x125a82[_0xfb0f('0xf')](0x1f4,_0x31b7fe[_0xfb0f('0x11')]));});});};exports[_0xfb0f('0x1d')]=function(_0xbcc5cc){var _0x2cc57e=this;return new Promise(function(_0x360143,_0x293916){return db['ServicenowAccount'][_0xfb0f('0x1e')]({'raw':_0xbcc5cc[_0xfb0f('0x13')]?_0xbcc5cc['options']['raw']===undefined?!![]:![]:!![],'where':_0xbcc5cc['options']?_0xbcc5cc[_0xfb0f('0x13')]['where']||null:null,'attributes':_0xbcc5cc[_0xfb0f('0x13')]?_0xbcc5cc[_0xfb0f('0x13')]['attributes']||null:null,'include':_0xbcc5cc['options']?_0xbcc5cc[_0xfb0f('0x13')]['include']?_[_0xfb0f('0x18')](_0xbcc5cc[_0xfb0f('0x13')][_0xfb0f('0x17')],function(_0x2fb21c){return{'model':db[_0x2fb21c[_0xfb0f('0x19')]],'as':_0x2fb21c['as'],'attributes':_0x2fb21c['attributes'],'include':_0x2fb21c[_0xfb0f('0x17')]?_['map'](_0x2fb21c['include'],function(_0x253eac){return{'model':db[_0x253eac['model']],'as':_0x253eac['as'],'attributes':_0x253eac[_0xfb0f('0x16')],'include':_0x253eac['include']?_[_0xfb0f('0x18')](_0x253eac[_0xfb0f('0x17')],function(_0x1fb000){return{'model':db[_0x1fb000[_0xfb0f('0x19')]],'as':_0x1fb000['as'],'attributes':_0x1fb000[_0xfb0f('0x16')]};}):[]};}):[]};}):[]:[]})[_0xfb0f('0x9')](function(_0x456648){logger['info']('ShowServicenowAccount',_0xbcc5cc);logger[_0xfb0f('0xd')](_0xfb0f('0x1d'),_0xbcc5cc,JSON[_0xfb0f('0x1b')](_0x456648));_0x360143(_0x456648);})[_0xfb0f('0x1c')](function(_0xa87fe9){logger[_0xfb0f('0xf')](_0xfb0f('0x1d'),_0xa87fe9[_0xfb0f('0x11')],_0xbcc5cc);_0x293916(_0x2cc57e[_0xfb0f('0xf')](0x1f4,_0xa87fe9['message']));});});}; \ No newline at end of file +var _0x2a49=['then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetServicenowAccount','findAll','options','attributes','limit','map','include','model','debug','catch','ServicenowAccount','find','raw','where','ShowServicenowAccount','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0x2a49,0xcd));var _0x92a4=function(_0x89207c,_0x97abd){_0x89207c=_0x89207c-0x0;var _0x4fc9b2=_0x2a49[_0x89207c];return _0x4fc9b2;};'use strict';var _=require('lodash');var util=require(_0x92a4('0x0'));var moment=require('moment');var BPromise=require(_0x92a4('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x92a4('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x92a4('0x3'));var logger=require(_0x92a4('0x4'))(_0x92a4('0x5'));var config=require(_0x92a4('0x6'));var jayson=require(_0x92a4('0x7'));var client=jayson[_0x92a4('0x8')][_0x92a4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55f8bb,_0x4c7096,_0x1b2899){return new BPromise(function(_0x529edd,_0x435de9){return client[_0x92a4('0xa')](_0x55f8bb,_0x1b2899)[_0x92a4('0xb')](function(_0xa1c235){logger[_0x92a4('0xc')](_0x92a4('0xd'),_0x4c7096,_0x92a4('0xe'));logger['debug'](_0x92a4('0xf'),_0x4c7096,'request\x20sent',JSON[_0x92a4('0x10')](_0xa1c235));if(_0xa1c235[_0x92a4('0x11')]){if(_0xa1c235[_0x92a4('0x11')][_0x92a4('0x12')]===0x1f4){logger['error'](_0x92a4('0xd'),_0x4c7096,_0xa1c235[_0x92a4('0x11')][_0x92a4('0x13')]);return _0x435de9(_0xa1c235[_0x92a4('0x11')]['message']);}logger['error'](_0x92a4('0xd'),_0x4c7096,_0xa1c235[_0x92a4('0x11')][_0x92a4('0x13')]);return _0x529edd(_0xa1c235[_0x92a4('0x11')][_0x92a4('0x13')]);}else{logger[_0x92a4('0xc')]('ServicenowAccount,\x20%s,\x20%s',_0x4c7096,'request\x20sent');_0x529edd(_0xa1c235[_0x92a4('0x14')][_0x92a4('0x13')]);}})['catch'](function(_0x31d1c4){logger[_0x92a4('0x11')](_0x92a4('0xd'),_0x4c7096,_0x31d1c4);_0x435de9(_0x31d1c4);});});}exports[_0x92a4('0x15')]=function(_0x416def){var _0x2e196e=this;return new Promise(function(_0x2d4b7d,_0x51a5a0){return db['ServicenowAccount'][_0x92a4('0x16')]({'raw':_0x416def['options']?_0x416def['options']['raw']===undefined?!![]:![]:!![],'where':_0x416def[_0x92a4('0x17')]?_0x416def[_0x92a4('0x17')]['where']||null:null,'attributes':_0x416def[_0x92a4('0x17')]?_0x416def['options'][_0x92a4('0x18')]||null:null,'limit':_0x416def['options']?_0x416def[_0x92a4('0x17')][_0x92a4('0x19')]||null:null,'include':_0x416def[_0x92a4('0x17')]?_0x416def[_0x92a4('0x17')]['include']?_[_0x92a4('0x1a')](_0x416def[_0x92a4('0x17')][_0x92a4('0x1b')],function(_0x29b828){return{'model':db[_0x29b828['model']],'as':_0x29b828['as'],'attributes':_0x29b828['attributes'],'include':_0x29b828[_0x92a4('0x1b')]?_[_0x92a4('0x1a')](_0x29b828[_0x92a4('0x1b')],function(_0x1a4ee5){return{'model':db[_0x1a4ee5[_0x92a4('0x1c')]],'as':_0x1a4ee5['as'],'attributes':_0x1a4ee5[_0x92a4('0x18')],'include':_0x1a4ee5[_0x92a4('0x1b')]?_[_0x92a4('0x1a')](_0x1a4ee5['include'],function(_0x1cbd9e){return{'model':db[_0x1cbd9e[_0x92a4('0x1c')]],'as':_0x1cbd9e['as'],'attributes':_0x1cbd9e['attributes']};}):[]};}):[]};}):[]:[]})[_0x92a4('0xb')](function(_0x40b421){logger[_0x92a4('0xc')](_0x92a4('0x15'),_0x416def);logger[_0x92a4('0x1d')](_0x92a4('0x15'),_0x416def,JSON['stringify'](_0x40b421));_0x2d4b7d(_0x40b421);})[_0x92a4('0x1e')](function(_0x38c028){logger['error']('GetServicenowAccount',_0x38c028[_0x92a4('0x13')],_0x416def);_0x51a5a0(_0x2e196e[_0x92a4('0x11')](0x1f4,_0x38c028[_0x92a4('0x13')]));});});};exports['ShowServicenowAccount']=function(_0x3f1f22){var _0x5f0fe9=this;return new Promise(function(_0x54e595,_0x47bc02){return db[_0x92a4('0x1f')][_0x92a4('0x20')]({'raw':_0x3f1f22[_0x92a4('0x17')]?_0x3f1f22[_0x92a4('0x17')][_0x92a4('0x21')]===undefined?!![]:![]:!![],'where':_0x3f1f22[_0x92a4('0x17')]?_0x3f1f22[_0x92a4('0x17')][_0x92a4('0x22')]||null:null,'attributes':_0x3f1f22[_0x92a4('0x17')]?_0x3f1f22['options'][_0x92a4('0x18')]||null:null,'include':_0x3f1f22['options']?_0x3f1f22[_0x92a4('0x17')]['include']?_[_0x92a4('0x1a')](_0x3f1f22['options'][_0x92a4('0x1b')],function(_0x304327){return{'model':db[_0x304327['model']],'as':_0x304327['as'],'attributes':_0x304327[_0x92a4('0x18')],'include':_0x304327['include']?_[_0x92a4('0x1a')](_0x304327[_0x92a4('0x1b')],function(_0x5c4cf3){return{'model':db[_0x5c4cf3['model']],'as':_0x5c4cf3['as'],'attributes':_0x5c4cf3[_0x92a4('0x18')],'include':_0x5c4cf3[_0x92a4('0x1b')]?_[_0x92a4('0x1a')](_0x5c4cf3['include'],function(_0x4e654d){return{'model':db[_0x4e654d[_0x92a4('0x1c')]],'as':_0x4e654d['as'],'attributes':_0x4e654d['attributes']};}):[]};}):[]};}):[]:[]})[_0x92a4('0xb')](function(_0x162b29){logger['info']('ShowServicenowAccount',_0x3f1f22);logger[_0x92a4('0x1d')](_0x92a4('0x23'),_0x3f1f22,JSON[_0x92a4('0x10')](_0x162b29));_0x54e595(_0x162b29);})[_0x92a4('0x1e')](function(_0x35cfe1){logger[_0x92a4('0x11')](_0x92a4('0x23'),_0x35cfe1['message'],_0x3f1f22);_0x47bc02(_0x5f0fe9[_0x92a4('0x11')](0x1f4,_0x35cfe1[_0x92a4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 2906929..7ee4a6a 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 _0x520f=['/:id','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','update','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index'];(function(_0x43be03,_0x3f4dc3){var _0x6aabf9=function(_0xb24702){while(--_0xb24702){_0x43be03['push'](_0x43be03['shift']());}};_0x6aabf9(++_0x3f4dc3);}(_0x520f,0xf9));var _0xf520=function(_0x30505b,_0x3b6c06){_0x30505b=_0x30505b-0x0;var _0x4f7466=_0x520f[_0x30505b];return _0x4f7466;};'use strict';var multer=require(_0xf520('0x0'));var util=require(_0xf520('0x1'));var path=require('path');var timeout=require(_0xf520('0x2'));var express=require('express');var router=express[_0xf520('0x3')]();var auth=require(_0xf520('0x4'));var interaction=require(_0xf520('0x5'));var config=require(_0xf520('0x6'));var controller=require(_0xf520('0x7'));router[_0xf520('0x8')]('/',auth[_0xf520('0x9')](),controller[_0xf520('0xa')]);router['get'](_0xf520('0xb'),auth[_0xf520('0x9')](),controller['show']);router[_0xf520('0x8')](_0xf520('0xc'),auth[_0xf520('0x9')](),controller[_0xf520('0xd')]);router[_0xf520('0x8')](_0xf520('0xe'),auth[_0xf520('0x9')](),controller['getSubjects']);router[_0xf520('0x8')](_0xf520('0xf'),auth[_0xf520('0x9')](),controller[_0xf520('0x10')]);router[_0xf520('0x11')]('/',auth[_0xf520('0x9')](),controller[_0xf520('0x12')]);router['put'](_0xf520('0xb'),auth[_0xf520('0x9')](),controller[_0xf520('0x13')]);router['delete']('/:id',auth[_0xf520('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2d5f=['../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0xeadf5f,_0xc8e4ff){var _0x5530c3=function(_0x321a20){while(--_0x321a20){_0xeadf5f['push'](_0xeadf5f['shift']());}};_0x5530c3(++_0xc8e4ff);}(_0x2d5f,0x10d));var _0xf2d5=function(_0x40ddc0,_0x41c082){_0x40ddc0=_0x40ddc0-0x0;var _0x1aebf1=_0x2d5f[_0x40ddc0];return _0x1aebf1;};'use strict';var multer=require(_0xf2d5('0x0'));var util=require(_0xf2d5('0x1'));var path=require(_0xf2d5('0x2'));var timeout=require(_0xf2d5('0x3'));var express=require(_0xf2d5('0x4'));var router=express[_0xf2d5('0x5')]();var auth=require(_0xf2d5('0x6'));var interaction=require(_0xf2d5('0x7'));var config=require(_0xf2d5('0x8'));var controller=require(_0xf2d5('0x9'));router[_0xf2d5('0xa')]('/',auth[_0xf2d5('0xb')](),controller[_0xf2d5('0xc')]);router[_0xf2d5('0xa')](_0xf2d5('0xd'),auth[_0xf2d5('0xb')](),controller[_0xf2d5('0xe')]);router[_0xf2d5('0xa')]('/:id/fields',auth[_0xf2d5('0xb')](),controller[_0xf2d5('0xf')]);router['get'](_0xf2d5('0x10'),auth[_0xf2d5('0xb')](),controller['getSubjects']);router[_0xf2d5('0xa')](_0xf2d5('0x11'),auth[_0xf2d5('0xb')](),controller[_0xf2d5('0x12')]);router[_0xf2d5('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf2d5('0x14')](_0xf2d5('0xd'),auth[_0xf2d5('0xb')](),controller[_0xf2d5('0x15')]);router['delete'](_0xf2d5('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xf2d5('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index f544869..7f74c00 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 _0xec0c=['exports'];(function(_0x3f14ed,_0x51b3c4){var _0x37d329=function(_0xdbeed){while(--_0xdbeed){_0x3f14ed['push'](_0x3f14ed['shift']());}};_0x37d329(++_0x51b3c4);}(_0xec0c,0x9c));var _0xcec0=function(_0x2657e0,_0x391a4c){_0x2657e0=_0x2657e0-0x0;var _0x2d1f0e=_0xec0c[_0x2657e0];return _0x2d1f0e;};'use strict';var Sequelize=require('sequelize');module[_0xcec0('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4c88=['STRING','exports'];(function(_0x49011b,_0x4ff958){var _0x33ce53=function(_0xd010cb){while(--_0xd010cb){_0x49011b['push'](_0x49011b['shift']());}};_0x33ce53(++_0x4ff958);}(_0x4c88,0x1b9));var _0x84c8=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x4c88[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require('sequelize');module[_0x84c8('0x0')]={'name':{'type':Sequelize[_0x84c8('0x1')]},'description':{'type':Sequelize[_0x84c8('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index a7e9717..3a98341 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 _0x62f0=['create','body','findOne','keys','ServicenowField','getFields','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','moment','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','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','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ServicenowConfiguration','includeAll','include','findAll','rows','show','params','length','find'];(function(_0x216428,_0x5d20ea){var _0x313dd4=function(_0x447e0d){while(--_0x447e0d){_0x216428['push'](_0x216428['shift']());}};_0x313dd4(++_0x5d20ea);}(_0x62f0,0x67));var _0x062f=function(_0x56085e,_0x5c69e9){_0x56085e=_0x56085e-0x0;var _0x4de130=_0x62f0[_0x56085e];return _0x4de130;};'use strict';var pdf=require(_0x062f('0x0'));var emlformat=require(_0x062f('0x1'));var rimraf=require(_0x062f('0x2'));var zipdir=require(_0x062f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x062f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x062f('0x5'));var sox=require(_0x062f('0x6'));var csv=require('to-csv');var ejs=require(_0x062f('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x062f('0x8'));var crypto=require(_0x062f('0x9'));var jsforce=require(_0x062f('0xa'));var deskjs=require(_0x062f('0xb'));var toCsv=require(_0x062f('0xc'));var querystring=require(_0x062f('0xd'));var Papa=require(_0x062f('0xe'));var Redis=require(_0x062f('0xf'));var authService=require(_0x062f('0x10'));var qs=require(_0x062f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x062f('0x12'));var logger=require(_0x062f('0x13'))(_0x062f('0x14'));var utils=require(_0x062f('0x15'));var config=require(_0x062f('0x16'));var db=require(_0x062f('0x17'))['db'];var jayson=require(_0x062f('0x18'));var client=jayson[_0x062f('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x32bae9,_0x1bd148,_0x25a933){if(_0x25a933){var _0x3a89a0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3a89a0[_0x062f('0x1a')](_0x1bd148)){return _0x32bae9;}else{throw new db['Sequelize'][(_0x062f('0x1b'))](_0x062f('0x1c'));}}else{return _0x32bae9;}}function respondWithRpcPromise(_0x291d70,_0x5ec273,_0x3b7c96,_0x2ddb74){return new BPromise(function(_0x5dd6bc,_0x50399a){var _0x335b24=_0x2ddb74||client;return _0x335b24[_0x062f('0x1d')](_0x291d70,_0x3b7c96)[_0x062f('0x1e')](function(_0x57c190){logger['info'](_0x062f('0x1f'),_0x5ec273,_0x062f('0x20'));logger[_0x062f('0x21')](_0x062f('0x22'),_0x5ec273,_0x062f('0x20'),JSON[_0x062f('0x23')](_0x57c190));if(_0x57c190[_0x062f('0x24')]){if(_0x57c190['error'][_0x062f('0x25')]===0x1f4){logger['error'](_0x062f('0x1f'),_0x5ec273,_0x57c190[_0x062f('0x24')][_0x062f('0x26')]);return _0x50399a(_0x57c190['error'][_0x062f('0x26')]);}logger[_0x062f('0x24')](_0x062f('0x1f'),_0x5ec273,_0x57c190[_0x062f('0x24')][_0x062f('0x26')]);return _0x5dd6bc(_0x57c190[_0x062f('0x24')][_0x062f('0x26')]);}else{logger[_0x062f('0x27')](_0x062f('0x1f'),_0x5ec273,_0x062f('0x20'));_0x5dd6bc(_0x57c190[_0x062f('0x28')][_0x062f('0x26')]);}})[_0x062f('0x29')](function(_0x5733c9){logger['error'](_0x062f('0x1f'),_0x5ec273,_0x5733c9);_0x50399a(_0x5733c9);});});}function respondWithStatusCode(_0xf61c11,_0x406234){_0x406234=_0x406234||0xcc;return function(_0x14f1f1){if(_0x14f1f1){return _0xf61c11[_0x062f('0x2a')](_0x406234);}return _0xf61c11[_0x062f('0x2b')](_0x406234)[_0x062f('0x2c')]();};}function respondWithResult(_0x52daba,_0x446a32){_0x446a32=_0x446a32||0xc8;return function(_0x3a4747){if(_0x3a4747){return _0x52daba[_0x062f('0x2b')](_0x446a32)[_0x062f('0x2d')](_0x3a4747);}};}function respondWithFilteredResult(_0x27c0c7,_0x4d1504){return function(_0x42fa9d){if(_0x42fa9d){var _0x36bf18=_0x42fa9d[_0x062f('0x2e')],_0x22ce8e=_0x4d1504['offset'],_0x35e4e2=_0x4d1504[_0x062f('0x2f')]+_0x4d1504[_0x062f('0x30')],_0x1c562d;if(_0x35e4e2>=_0x36bf18){_0x35e4e2=_0x36bf18;_0x1c562d=0xc8;}else{_0x1c562d=0xce;}_0x27c0c7[_0x062f('0x2b')](_0x1c562d);return _0x27c0c7[_0x062f('0x31')]('Content-Range',_0x22ce8e+'-'+_0x35e4e2+'/'+_0x36bf18)[_0x062f('0x2d')](_0x42fa9d);}return null;};}function patchUpdates(_0x4feb0f){return function(_0x421d04){try{jsonpatch[_0x062f('0x32')](_0x421d04,_0x4feb0f,!![]);}catch(_0x4c63a6){return BPromise[_0x062f('0x33')](_0x4c63a6);}return _0x421d04[_0x062f('0x34')]();};}function saveUpdates(_0x56d148,_0x42e565){return function(_0x15bbef){if(_0x15bbef){return _0x15bbef[_0x062f('0x35')](_0x56d148)['then'](function(_0xdd8a36){return _0xdd8a36;});}return null;};}function removeEntity(_0x5c907e,_0x2a9a9f){return function(_0x1e40f9){if(_0x1e40f9){return _0x1e40f9[_0x062f('0x36')]()['then'](function(){_0x5c907e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xb966d0,_0x531bb6){return function(_0x6f04f5){if(!_0x6f04f5){_0xb966d0[_0x062f('0x2a')](0x194);}return _0x6f04f5;};}function handleError(_0x345566,_0x10d489){_0x10d489=_0x10d489||0x1f4;return function(_0x2e15ee){logger['error'](_0x2e15ee[_0x062f('0x37')]);if(_0x2e15ee[_0x062f('0x38')]){delete _0x2e15ee[_0x062f('0x38')];}_0x345566[_0x062f('0x2b')](_0x10d489)[_0x062f('0x39')](_0x2e15ee);};}exports[_0x062f('0x3a')]=function(_0x59179a,_0x56d388){var _0x501965={},_0x49768b={},_0x27f055={'count':0x0,'rows':[]};var _0x1fc0a9=_[_0x062f('0x3b')](db['ServicenowConfiguration'][_0x062f('0x3c')],function(_0x53a496){return{'name':_0x53a496[_0x062f('0x3d')],'type':_0x53a496['type']['key']};});_0x49768b['model']=_[_0x062f('0x3b')](_0x1fc0a9,_0x062f('0x38'));_0x49768b['query']=_['keys'](_0x59179a[_0x062f('0x3e')]);_0x49768b[_0x062f('0x3f')]=_[_0x062f('0x40')](_0x49768b[_0x062f('0x41')],_0x49768b['query']);_0x501965[_0x062f('0x42')]=_[_0x062f('0x40')](_0x49768b[_0x062f('0x41')],qs[_0x062f('0x43')](_0x59179a[_0x062f('0x3e')][_0x062f('0x43')]));_0x501965['attributes']=_0x501965[_0x062f('0x42')]['length']?_0x501965[_0x062f('0x42')]:_0x49768b['model'];if(!_0x59179a[_0x062f('0x3e')][_0x062f('0x44')](_0x062f('0x45'))){_0x501965['limit']=qs['limit'](_0x59179a['query'][_0x062f('0x30')]);_0x501965[_0x062f('0x2f')]=qs['offset'](_0x59179a[_0x062f('0x3e')][_0x062f('0x2f')]);}_0x501965[_0x062f('0x46')]=qs[_0x062f('0x47')](_0x59179a[_0x062f('0x3e')][_0x062f('0x47')]);_0x501965[_0x062f('0x48')]=qs[_0x062f('0x3f')](_[_0x062f('0x49')](_0x59179a[_0x062f('0x3e')],_0x49768b[_0x062f('0x3f')]));if(_0x59179a[_0x062f('0x3e')][_0x062f('0x4a')]){_0x501965[_0x062f('0x48')]=_[_0x062f('0x4b')](_0x501965[_0x062f('0x48')],{'$or':_[_0x062f('0x3b')](_0x1fc0a9,function(_0x54dccf){if(_0x54dccf['type']!==_0x062f('0x4c')){var _0x230d11={};_0x230d11[_0x54dccf[_0x062f('0x38')]]={'$like':'%'+_0x59179a[_0x062f('0x3e')][_0x062f('0x4a')]+'%'};return _0x230d11;}})});}_0x501965=_[_0x062f('0x4b')]({},_0x501965,_0x59179a[_0x062f('0x4d')]);var _0x1a6365={'where':_0x501965['where']};return db[_0x062f('0x4e')][_0x062f('0x2e')](_0x1a6365)['then'](function(_0x23f682){_0x27f055[_0x062f('0x2e')]=_0x23f682;if(_0x59179a[_0x062f('0x3e')][_0x062f('0x4f')]){_0x501965[_0x062f('0x50')]=[{'all':!![]}];}return db[_0x062f('0x4e')][_0x062f('0x51')](_0x501965);})[_0x062f('0x1e')](function(_0x23ee7a){_0x27f055[_0x062f('0x52')]=_0x23ee7a;return _0x27f055;})['then'](respondWithFilteredResult(_0x56d388,_0x501965))['catch'](handleError(_0x56d388,null));};exports[_0x062f('0x53')]=function(_0x2ee74c,_0x4fffad){var _0x56ecac={'raw':![],'where':{'id':_0x2ee74c[_0x062f('0x54')]['id']}},_0x1cc499={};_0x1cc499[_0x062f('0x41')]=_['keys'](db[_0x062f('0x4e')][_0x062f('0x3c')]);_0x1cc499[_0x062f('0x3e')]=_['keys'](_0x2ee74c[_0x062f('0x3e')]);_0x1cc499[_0x062f('0x3f')]=_['intersection'](_0x1cc499[_0x062f('0x41')],_0x1cc499['query']);_0x56ecac['attributes']=_[_0x062f('0x40')](_0x1cc499['model'],qs[_0x062f('0x43')](_0x2ee74c[_0x062f('0x3e')][_0x062f('0x43')]));_0x56ecac[_0x062f('0x42')]=_0x56ecac[_0x062f('0x42')][_0x062f('0x55')]?_0x56ecac[_0x062f('0x42')]:_0x1cc499[_0x062f('0x41')];if(_0x2ee74c[_0x062f('0x3e')]['includeAll']){_0x56ecac['include']=[{'all':!![]}];}_0x56ecac=_[_0x062f('0x4b')]({},_0x56ecac,_0x2ee74c[_0x062f('0x4d')]);return db['ServicenowConfiguration'][_0x062f('0x56')](_0x56ecac)[_0x062f('0x1e')](handleEntityNotFound(_0x4fffad,null))[_0x062f('0x1e')](respondWithResult(_0x4fffad,null))['catch'](handleError(_0x4fffad,null));};exports['create']=function(_0x2ef330,_0x22b348){return db[_0x062f('0x4e')][_0x062f('0x57')](_0x2ef330['body'],{})[_0x062f('0x1e')](respondWithResult(_0x22b348,0xc9))[_0x062f('0x29')](handleError(_0x22b348,null));};exports[_0x062f('0x35')]=function(_0x1f5872,_0x39b85c){if(_0x1f5872[_0x062f('0x58')]['id']){delete _0x1f5872['body']['id'];}return db[_0x062f('0x4e')][_0x062f('0x56')]({'where':{'id':_0x1f5872[_0x062f('0x54')]['id']}})['then'](handleEntityNotFound(_0x39b85c,null))[_0x062f('0x1e')](saveUpdates(_0x1f5872['body'],null))[_0x062f('0x1e')](respondWithResult(_0x39b85c,null))[_0x062f('0x29')](handleError(_0x39b85c,null));};exports[_0x062f('0x36')]=function(_0x84a977,_0x3bcd88){return db['ServicenowConfiguration'][_0x062f('0x56')]({'where':{'id':_0x84a977[_0x062f('0x54')]['id']}})[_0x062f('0x1e')](handleEntityNotFound(_0x3bcd88,null))['then'](removeEntity(_0x3bcd88,null))[_0x062f('0x29')](handleError(_0x3bcd88,null));};exports['getFields']=function(_0x454543,_0x37e89c,_0x334ae8){var _0x44ea81={};var _0x4a20da={};var _0x2dc9b3;var _0x252486;return db[_0x062f('0x4e')][_0x062f('0x59')]({'where':{'id':_0x454543['params']['id']}})[_0x062f('0x1e')](handleEntityNotFound(_0x37e89c,null))['then'](function(_0x346d46){if(_0x346d46){_0x2dc9b3=_0x346d46;_0x4a20da[_0x062f('0x41')]=_[_0x062f('0x5a')](db[_0x062f('0x5b')][_0x062f('0x3c')]);_0x4a20da[_0x062f('0x3e')]=_[_0x062f('0x5a')](_0x454543[_0x062f('0x3e')]);_0x4a20da[_0x062f('0x3f')]=_[_0x062f('0x40')](_0x4a20da[_0x062f('0x41')],_0x4a20da[_0x062f('0x3e')]);_0x44ea81[_0x062f('0x42')]=_[_0x062f('0x40')](_0x4a20da['model'],qs['fields'](_0x454543[_0x062f('0x3e')][_0x062f('0x43')]));_0x44ea81[_0x062f('0x42')]=_0x44ea81[_0x062f('0x42')][_0x062f('0x55')]?_0x44ea81[_0x062f('0x42')]:_0x4a20da[_0x062f('0x41')];_0x44ea81[_0x062f('0x46')]=qs[_0x062f('0x47')](_0x454543[_0x062f('0x3e')][_0x062f('0x47')]);_0x44ea81[_0x062f('0x48')]=qs['filters'](_[_0x062f('0x49')](_0x454543[_0x062f('0x3e')],_0x4a20da[_0x062f('0x3f')]));if(_0x454543[_0x062f('0x3e')][_0x062f('0x4a')]){_0x44ea81[_0x062f('0x48')]=_[_0x062f('0x4b')](_0x44ea81['where'],{'$or':_[_0x062f('0x3b')](_0x44ea81[_0x062f('0x42')],function(_0x1b280e){var _0x1b5911={};_0x1b5911[_0x1b280e]={'$like':'%'+_0x454543[_0x062f('0x3e')]['filter']+'%'};return _0x1b5911;})});}_0x44ea81=_[_0x062f('0x4b')]({},_0x44ea81,_0x454543[_0x062f('0x4d')]);return _0x2dc9b3[_0x062f('0x5c')](_0x44ea81);}})['then'](function(_0x17076c){if(_0x17076c){_0x252486=_0x17076c[_0x062f('0x55')];if(!_0x454543[_0x062f('0x3e')][_0x062f('0x44')](_0x062f('0x45'))){_0x44ea81[_0x062f('0x30')]=qs[_0x062f('0x30')](_0x454543['query'][_0x062f('0x30')]);_0x44ea81[_0x062f('0x2f')]=qs['offset'](_0x454543['query'][_0x062f('0x2f')]);}return _0x2dc9b3[_0x062f('0x5c')](_0x44ea81);}})[_0x062f('0x1e')](function(_0x56edae){if(_0x56edae){return _0x56edae?{'count':_0x252486,'rows':_0x56edae}:null;}})[_0x062f('0x1e')](respondWithResult(_0x37e89c,null))[_0x062f('0x29')](handleError(_0x37e89c,null));};exports[_0x062f('0x5d')]=function(_0x3d1aee,_0x31f45d,_0x156720){var _0x41379d={};var _0x4e9116={};var _0x57b478;var _0x5e764a;return db[_0x062f('0x4e')]['findOne']({'where':{'id':_0x3d1aee[_0x062f('0x54')]['id']}})[_0x062f('0x1e')](handleEntityNotFound(_0x31f45d,null))[_0x062f('0x1e')](function(_0x51ca8b){if(_0x51ca8b){_0x57b478=_0x51ca8b;_0x4e9116[_0x062f('0x41')]=_['keys'](db[_0x062f('0x5b')][_0x062f('0x3c')]);_0x4e9116['query']=_[_0x062f('0x5a')](_0x3d1aee[_0x062f('0x3e')]);_0x4e9116['filters']=_[_0x062f('0x40')](_0x4e9116[_0x062f('0x41')],_0x4e9116[_0x062f('0x3e')]);_0x41379d[_0x062f('0x42')]=_[_0x062f('0x40')](_0x4e9116[_0x062f('0x41')],qs['fields'](_0x3d1aee[_0x062f('0x3e')]['fields']));_0x41379d['attributes']=_0x41379d[_0x062f('0x42')][_0x062f('0x55')]?_0x41379d[_0x062f('0x42')]:_0x4e9116[_0x062f('0x41')];_0x41379d[_0x062f('0x46')]=qs[_0x062f('0x47')](_0x3d1aee['query'][_0x062f('0x47')]);_0x41379d['where']=qs['filters'](_[_0x062f('0x49')](_0x3d1aee[_0x062f('0x3e')],_0x4e9116[_0x062f('0x3f')]));if(_0x3d1aee['query'][_0x062f('0x4a')]){_0x41379d[_0x062f('0x48')]=_[_0x062f('0x4b')](_0x41379d[_0x062f('0x48')],{'$or':_[_0x062f('0x3b')](_0x41379d[_0x062f('0x42')],function(_0x4f6aaf){var _0x16693e={};_0x16693e[_0x4f6aaf]={'$like':'%'+_0x3d1aee[_0x062f('0x3e')][_0x062f('0x4a')]+'%'};return _0x16693e;})});}_0x41379d=_['merge']({},_0x41379d,_0x3d1aee[_0x062f('0x4d')]);return _0x57b478[_0x062f('0x5d')](_0x41379d);}})[_0x062f('0x1e')](function(_0x3e8777){if(_0x3e8777){_0x5e764a=_0x3e8777['length'];if(!_0x3d1aee[_0x062f('0x3e')][_0x062f('0x44')](_0x062f('0x45'))){_0x41379d[_0x062f('0x30')]=qs['limit'](_0x3d1aee['query'][_0x062f('0x30')]);_0x41379d[_0x062f('0x2f')]=qs[_0x062f('0x2f')](_0x3d1aee[_0x062f('0x3e')][_0x062f('0x2f')]);}return _0x57b478['getSubjects'](_0x41379d);}})['then'](function(_0x529d8f){if(_0x529d8f){return _0x529d8f?{'count':_0x5e764a,'rows':_0x529d8f}:null;}})[_0x062f('0x1e')](respondWithResult(_0x31f45d,null))[_0x062f('0x29')](handleError(_0x31f45d,null));};exports[_0x062f('0x5e')]=function(_0x2da0e5,_0x18a72c,_0x300989){var _0x41d626={};var _0x43d3ad={};var _0x18cc52;var _0x556ab5;return db[_0x062f('0x4e')][_0x062f('0x59')]({'where':{'id':_0x2da0e5['params']['id']}})['then'](handleEntityNotFound(_0x18a72c,null))[_0x062f('0x1e')](function(_0x1c98d8){if(_0x1c98d8){_0x18cc52=_0x1c98d8;_0x43d3ad[_0x062f('0x41')]=_['keys'](db[_0x062f('0x5b')][_0x062f('0x3c')]);_0x43d3ad[_0x062f('0x3e')]=_['keys'](_0x2da0e5[_0x062f('0x3e')]);_0x43d3ad[_0x062f('0x3f')]=_[_0x062f('0x40')](_0x43d3ad[_0x062f('0x41')],_0x43d3ad[_0x062f('0x3e')]);_0x41d626['attributes']=_[_0x062f('0x40')](_0x43d3ad[_0x062f('0x41')],qs['fields'](_0x2da0e5['query'][_0x062f('0x43')]));_0x41d626['attributes']=_0x41d626['attributes'][_0x062f('0x55')]?_0x41d626[_0x062f('0x42')]:_0x43d3ad['model'];_0x41d626[_0x062f('0x46')]=qs[_0x062f('0x47')](_0x2da0e5[_0x062f('0x3e')][_0x062f('0x47')]);_0x41d626[_0x062f('0x48')]=qs['filters'](_['pick'](_0x2da0e5[_0x062f('0x3e')],_0x43d3ad['filters']));if(_0x2da0e5[_0x062f('0x3e')][_0x062f('0x4a')]){_0x41d626[_0x062f('0x48')]=_[_0x062f('0x4b')](_0x41d626['where'],{'$or':_[_0x062f('0x3b')](_0x41d626['attributes'],function(_0x189789){var _0x3cf090={};_0x3cf090[_0x189789]={'$like':'%'+_0x2da0e5[_0x062f('0x3e')][_0x062f('0x4a')]+'%'};return _0x3cf090;})});}_0x41d626=_[_0x062f('0x4b')]({},_0x41d626,_0x2da0e5['options']);return _0x18cc52['getDescriptions'](_0x41d626);}})[_0x062f('0x1e')](function(_0xd02f36){if(_0xd02f36){_0x556ab5=_0xd02f36[_0x062f('0x55')];if(!_0x2da0e5['query'][_0x062f('0x44')](_0x062f('0x45'))){_0x41d626[_0x062f('0x30')]=qs[_0x062f('0x30')](_0x2da0e5[_0x062f('0x3e')][_0x062f('0x30')]);_0x41d626[_0x062f('0x2f')]=qs[_0x062f('0x2f')](_0x2da0e5[_0x062f('0x3e')]['offset']);}return _0x18cc52[_0x062f('0x5e')](_0x41d626);}})['then'](function(_0x1a787f){if(_0x1a787f){return _0x1a787f?{'count':_0x556ab5,'rows':_0x1a787f}:null;}})['then'](respondWithResult(_0x18a72c,null))['catch'](handleError(_0x18a72c,null));}; \ No newline at end of file +var _0x7de8=['includeAll','findAll','rows','show','find','create','body','params','getFields','findOne','nolimit','getSubjects','ServicenowField','getDescriptions','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/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','jayson/promise','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','save','update','destroy','sendStatus','stack','name','send','index','ServicenowConfiguration','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x21b48b,_0x3cc09a){var _0x24d2f3=function(_0x4212a5){while(--_0x4212a5){_0x21b48b['push'](_0x21b48b['shift']());}};_0x24d2f3(++_0x3cc09a);}(_0x7de8,0x6b));var _0x87de=function(_0x1cb55d,_0xd9537){_0x1cb55d=_0x1cb55d-0x0;var _0xa553ca=_0x7de8[_0x1cb55d];return _0xa553ca;};'use strict';var pdf=require(_0x87de('0x0'));var emlformat=require(_0x87de('0x1'));var rimraf=require(_0x87de('0x2'));var zipdir=require(_0x87de('0x3'));var jsonpatch=require(_0x87de('0x4'));var rp=require('request-promise');var moment=require(_0x87de('0x5'));var BPromise=require(_0x87de('0x6'));var Mustache=require(_0x87de('0x7'));var util=require(_0x87de('0x8'));var path=require(_0x87de('0x9'));var sox=require(_0x87de('0xa'));var csv=require(_0x87de('0xb'));var ejs=require(_0x87de('0xc'));var fs=require('fs');var _=require(_0x87de('0xd'));var squel=require(_0x87de('0xe'));var crypto=require(_0x87de('0xf'));var jsforce=require(_0x87de('0x10'));var deskjs=require(_0x87de('0x11'));var toCsv=require(_0x87de('0xb'));var querystring=require(_0x87de('0x12'));var Papa=require(_0x87de('0x13'));var Redis=require(_0x87de('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x87de('0x15'));var as=require(_0x87de('0x16'));var hardwareService=require(_0x87de('0x17'));var logger=require(_0x87de('0x18'))(_0x87de('0x19'));var utils=require('../../config/utils');var config=require(_0x87de('0x1a'));var db=require('../../mysqldb')['db'];var jayson=require(_0x87de('0x1b'));var client=jayson['client'][_0x87de('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x524d9a,_0x43a33e,_0x4108b4){if(_0x4108b4){var _0x42a3a7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x42a3a7['test'](_0x43a33e)){return _0x524d9a;}else{throw new db['Sequelize']['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x524d9a;}}function respondWithRpcPromise(_0x579a7a,_0x28e75a,_0x556549,_0x2485b2){return new BPromise(function(_0x294480,_0x1ccb7f){var _0x206961=_0x2485b2||client;return _0x206961[_0x87de('0x1d')](_0x579a7a,_0x556549)[_0x87de('0x1e')](function(_0x732b23){logger[_0x87de('0x1f')](_0x87de('0x20'),_0x28e75a,_0x87de('0x21'));logger[_0x87de('0x22')](_0x87de('0x23'),_0x28e75a,_0x87de('0x21'),JSON[_0x87de('0x24')](_0x732b23));if(_0x732b23[_0x87de('0x25')]){if(_0x732b23[_0x87de('0x25')][_0x87de('0x26')]===0x1f4){logger['error'](_0x87de('0x20'),_0x28e75a,_0x732b23['error'][_0x87de('0x27')]);return _0x1ccb7f(_0x732b23['error'][_0x87de('0x27')]);}logger[_0x87de('0x25')]('ServicenowConfiguration,\x20%s,\x20%s',_0x28e75a,_0x732b23[_0x87de('0x25')][_0x87de('0x27')]);return _0x294480(_0x732b23[_0x87de('0x25')][_0x87de('0x27')]);}else{logger[_0x87de('0x1f')](_0x87de('0x20'),_0x28e75a,_0x87de('0x21'));_0x294480(_0x732b23[_0x87de('0x28')][_0x87de('0x27')]);}})[_0x87de('0x29')](function(_0x4d4e1d){logger[_0x87de('0x25')](_0x87de('0x20'),_0x28e75a,_0x4d4e1d);_0x1ccb7f(_0x4d4e1d);});});}function respondWithStatusCode(_0x1fd401,_0x40ab48){_0x40ab48=_0x40ab48||0xcc;return function(_0x5f2535){if(_0x5f2535){return _0x1fd401['sendStatus'](_0x40ab48);}return _0x1fd401[_0x87de('0x2a')](_0x40ab48)[_0x87de('0x2b')]();};}function respondWithResult(_0x270180,_0x137773){_0x137773=_0x137773||0xc8;return function(_0x13f019){if(_0x13f019){return _0x270180[_0x87de('0x2a')](_0x137773)[_0x87de('0x2c')](_0x13f019);}};}function respondWithFilteredResult(_0x17c25b,_0x51472b){return function(_0x3496a9){if(_0x3496a9){var _0x3b5913=_0x3496a9[_0x87de('0x2d')],_0x32d62b=_0x51472b['offset'],_0x4ebe7f=_0x51472b[_0x87de('0x2e')]+_0x51472b['limit'],_0x4bd1ae;if(_0x4ebe7f>=_0x3b5913){_0x4ebe7f=_0x3b5913;_0x4bd1ae=0xc8;}else{_0x4bd1ae=0xce;}_0x17c25b[_0x87de('0x2a')](_0x4bd1ae);return _0x17c25b['set']('Content-Range',_0x32d62b+'-'+_0x4ebe7f+'/'+_0x3b5913)[_0x87de('0x2c')](_0x3496a9);}return null;};}function patchUpdates(_0x4d4b6a){return function(_0x466302){try{jsonpatch['apply'](_0x466302,_0x4d4b6a,!![]);}catch(_0x5316ba){return BPromise['reject'](_0x5316ba);}return _0x466302[_0x87de('0x2f')]();};}function saveUpdates(_0x280f5d,_0x414aea){return function(_0x40c8b8){if(_0x40c8b8){return _0x40c8b8[_0x87de('0x30')](_0x280f5d)[_0x87de('0x1e')](function(_0x2d1c54){return _0x2d1c54;});}return null;};}function removeEntity(_0x675f01,_0x2f825a){return function(_0x27641c){if(_0x27641c){return _0x27641c[_0x87de('0x31')]()[_0x87de('0x1e')](function(){_0x675f01['status'](0xcc)[_0x87de('0x2b')]();});}};}function handleEntityNotFound(_0x428c04,_0x58d708){return function(_0x2deb30){if(!_0x2deb30){_0x428c04[_0x87de('0x32')](0x194);}return _0x2deb30;};}function handleError(_0x355944,_0x2d7809){_0x2d7809=_0x2d7809||0x1f4;return function(_0x174921){logger['error'](_0x174921[_0x87de('0x33')]);if(_0x174921[_0x87de('0x34')]){delete _0x174921[_0x87de('0x34')];}_0x355944[_0x87de('0x2a')](_0x2d7809)[_0x87de('0x35')](_0x174921);};}exports[_0x87de('0x36')]=function(_0x5dd8ec,_0x4605a5){var _0x154bb9={},_0x1ac1f8={},_0x281894={'count':0x0,'rows':[]};var _0x5e543a=_['map'](db[_0x87de('0x37')][_0x87de('0x38')],function(_0x4c07ea){return{'name':_0x4c07ea[_0x87de('0x39')],'type':_0x4c07ea[_0x87de('0x3a')][_0x87de('0x3b')]};});_0x1ac1f8['model']=_[_0x87de('0x3c')](_0x5e543a,_0x87de('0x34'));_0x1ac1f8[_0x87de('0x3d')]=_[_0x87de('0x3e')](_0x5dd8ec['query']);_0x1ac1f8[_0x87de('0x3f')]=_[_0x87de('0x40')](_0x1ac1f8[_0x87de('0x41')],_0x1ac1f8[_0x87de('0x3d')]);_0x154bb9[_0x87de('0x42')]=_[_0x87de('0x40')](_0x1ac1f8[_0x87de('0x41')],qs[_0x87de('0x43')](_0x5dd8ec[_0x87de('0x3d')][_0x87de('0x43')]));_0x154bb9['attributes']=_0x154bb9['attributes'][_0x87de('0x44')]?_0x154bb9[_0x87de('0x42')]:_0x1ac1f8[_0x87de('0x41')];if(!_0x5dd8ec[_0x87de('0x3d')][_0x87de('0x45')]('nolimit')){_0x154bb9[_0x87de('0x46')]=qs['limit'](_0x5dd8ec[_0x87de('0x3d')][_0x87de('0x46')]);_0x154bb9[_0x87de('0x2e')]=qs['offset'](_0x5dd8ec[_0x87de('0x3d')][_0x87de('0x2e')]);}_0x154bb9[_0x87de('0x47')]=qs[_0x87de('0x48')](_0x5dd8ec['query'][_0x87de('0x48')]);_0x154bb9[_0x87de('0x49')]=qs[_0x87de('0x3f')](_[_0x87de('0x4a')](_0x5dd8ec[_0x87de('0x3d')],_0x1ac1f8['filters']));if(_0x5dd8ec[_0x87de('0x3d')][_0x87de('0x4b')]){_0x154bb9['where']=_[_0x87de('0x4c')](_0x154bb9[_0x87de('0x49')],{'$or':_[_0x87de('0x3c')](_0x5e543a,function(_0x19d047){if(_0x19d047[_0x87de('0x3a')]!==_0x87de('0x4d')){var _0x3f38f7={};_0x3f38f7[_0x19d047[_0x87de('0x34')]]={'$like':'%'+_0x5dd8ec['query'][_0x87de('0x4b')]+'%'};return _0x3f38f7;}})});}_0x154bb9=_[_0x87de('0x4c')]({},_0x154bb9,_0x5dd8ec[_0x87de('0x4e')]);var _0x4f1725={'where':_0x154bb9[_0x87de('0x49')]};return db[_0x87de('0x37')][_0x87de('0x2d')](_0x4f1725)[_0x87de('0x1e')](function(_0x3e090c){_0x281894[_0x87de('0x2d')]=_0x3e090c;if(_0x5dd8ec[_0x87de('0x3d')][_0x87de('0x4f')]){_0x154bb9['include']=[{'all':!![]}];}return db[_0x87de('0x37')][_0x87de('0x50')](_0x154bb9);})[_0x87de('0x1e')](function(_0x506b7b){_0x281894[_0x87de('0x51')]=_0x506b7b;return _0x281894;})[_0x87de('0x1e')](respondWithFilteredResult(_0x4605a5,_0x154bb9))[_0x87de('0x29')](handleError(_0x4605a5,null));};exports[_0x87de('0x52')]=function(_0x10a22a,_0x54df69){var _0x828d69={'raw':![],'where':{'id':_0x10a22a['params']['id']}},_0x54378e={};_0x54378e[_0x87de('0x41')]=_[_0x87de('0x3e')](db[_0x87de('0x37')][_0x87de('0x38')]);_0x54378e[_0x87de('0x3d')]=_['keys'](_0x10a22a['query']);_0x54378e['filters']=_[_0x87de('0x40')](_0x54378e[_0x87de('0x41')],_0x54378e[_0x87de('0x3d')]);_0x828d69[_0x87de('0x42')]=_['intersection'](_0x54378e[_0x87de('0x41')],qs[_0x87de('0x43')](_0x10a22a['query'][_0x87de('0x43')]));_0x828d69['attributes']=_0x828d69[_0x87de('0x42')][_0x87de('0x44')]?_0x828d69[_0x87de('0x42')]:_0x54378e[_0x87de('0x41')];if(_0x10a22a[_0x87de('0x3d')]['includeAll']){_0x828d69['include']=[{'all':!![]}];}_0x828d69=_[_0x87de('0x4c')]({},_0x828d69,_0x10a22a[_0x87de('0x4e')]);return db[_0x87de('0x37')][_0x87de('0x53')](_0x828d69)[_0x87de('0x1e')](handleEntityNotFound(_0x54df69,null))[_0x87de('0x1e')](respondWithResult(_0x54df69,null))['catch'](handleError(_0x54df69,null));};exports[_0x87de('0x54')]=function(_0x58291b,_0x444023){return db[_0x87de('0x37')]['create'](_0x58291b[_0x87de('0x55')],{})[_0x87de('0x1e')](respondWithResult(_0x444023,0xc9))[_0x87de('0x29')](handleError(_0x444023,null));};exports['update']=function(_0x5cdf52,_0x18ccf4){if(_0x5cdf52[_0x87de('0x55')]['id']){delete _0x5cdf52[_0x87de('0x55')]['id'];}return db[_0x87de('0x37')][_0x87de('0x53')]({'where':{'id':_0x5cdf52[_0x87de('0x56')]['id']}})[_0x87de('0x1e')](handleEntityNotFound(_0x18ccf4,null))[_0x87de('0x1e')](saveUpdates(_0x5cdf52['body'],null))[_0x87de('0x1e')](respondWithResult(_0x18ccf4,null))[_0x87de('0x29')](handleError(_0x18ccf4,null));};exports[_0x87de('0x31')]=function(_0xada699,_0x9621b6){return db['ServicenowConfiguration'][_0x87de('0x53')]({'where':{'id':_0xada699[_0x87de('0x56')]['id']}})['then'](handleEntityNotFound(_0x9621b6,null))['then'](removeEntity(_0x9621b6,null))[_0x87de('0x29')](handleError(_0x9621b6,null));};exports[_0x87de('0x57')]=function(_0x510735,_0x232a7b,_0x2f37f5){var _0x26352d={};var _0x3dbbbe={};var _0x1e5380;var _0x396b17;return db[_0x87de('0x37')][_0x87de('0x58')]({'where':{'id':_0x510735[_0x87de('0x56')]['id']}})['then'](handleEntityNotFound(_0x232a7b,null))['then'](function(_0x1c2582){if(_0x1c2582){_0x1e5380=_0x1c2582;_0x3dbbbe['model']=_[_0x87de('0x3e')](db['ServicenowField'][_0x87de('0x38')]);_0x3dbbbe[_0x87de('0x3d')]=_[_0x87de('0x3e')](_0x510735[_0x87de('0x3d')]);_0x3dbbbe[_0x87de('0x3f')]=_[_0x87de('0x40')](_0x3dbbbe[_0x87de('0x41')],_0x3dbbbe['query']);_0x26352d[_0x87de('0x42')]=_[_0x87de('0x40')](_0x3dbbbe[_0x87de('0x41')],qs[_0x87de('0x43')](_0x510735['query']['fields']));_0x26352d[_0x87de('0x42')]=_0x26352d[_0x87de('0x42')][_0x87de('0x44')]?_0x26352d['attributes']:_0x3dbbbe[_0x87de('0x41')];_0x26352d['order']=qs[_0x87de('0x48')](_0x510735[_0x87de('0x3d')][_0x87de('0x48')]);_0x26352d[_0x87de('0x49')]=qs['filters'](_[_0x87de('0x4a')](_0x510735[_0x87de('0x3d')],_0x3dbbbe['filters']));if(_0x510735[_0x87de('0x3d')][_0x87de('0x4b')]){_0x26352d['where']=_[_0x87de('0x4c')](_0x26352d[_0x87de('0x49')],{'$or':_[_0x87de('0x3c')](_0x26352d[_0x87de('0x42')],function(_0x11ebf8){var _0x4ac519={};_0x4ac519[_0x11ebf8]={'$like':'%'+_0x510735[_0x87de('0x3d')]['filter']+'%'};return _0x4ac519;})});}_0x26352d=_[_0x87de('0x4c')]({},_0x26352d,_0x510735[_0x87de('0x4e')]);return _0x1e5380['getFields'](_0x26352d);}})['then'](function(_0x33c676){if(_0x33c676){_0x396b17=_0x33c676[_0x87de('0x44')];if(!_0x510735[_0x87de('0x3d')][_0x87de('0x45')](_0x87de('0x59'))){_0x26352d[_0x87de('0x46')]=qs[_0x87de('0x46')](_0x510735[_0x87de('0x3d')][_0x87de('0x46')]);_0x26352d['offset']=qs[_0x87de('0x2e')](_0x510735['query'][_0x87de('0x2e')]);}return _0x1e5380[_0x87de('0x57')](_0x26352d);}})[_0x87de('0x1e')](function(_0x575ff6){if(_0x575ff6){return _0x575ff6?{'count':_0x396b17,'rows':_0x575ff6}:null;}})['then'](respondWithResult(_0x232a7b,null))[_0x87de('0x29')](handleError(_0x232a7b,null));};exports[_0x87de('0x5a')]=function(_0x50c23f,_0x288196,_0x2aab5e){var _0x2a6f3f={};var _0x1b53ac={};var _0x3e21f6;var _0x158dea;return db['ServicenowConfiguration'][_0x87de('0x58')]({'where':{'id':_0x50c23f['params']['id']}})['then'](handleEntityNotFound(_0x288196,null))[_0x87de('0x1e')](function(_0x1561c6){if(_0x1561c6){_0x3e21f6=_0x1561c6;_0x1b53ac['model']=_[_0x87de('0x3e')](db[_0x87de('0x5b')][_0x87de('0x38')]);_0x1b53ac[_0x87de('0x3d')]=_[_0x87de('0x3e')](_0x50c23f[_0x87de('0x3d')]);_0x1b53ac[_0x87de('0x3f')]=_[_0x87de('0x40')](_0x1b53ac[_0x87de('0x41')],_0x1b53ac[_0x87de('0x3d')]);_0x2a6f3f[_0x87de('0x42')]=_['intersection'](_0x1b53ac[_0x87de('0x41')],qs[_0x87de('0x43')](_0x50c23f[_0x87de('0x3d')][_0x87de('0x43')]));_0x2a6f3f[_0x87de('0x42')]=_0x2a6f3f[_0x87de('0x42')][_0x87de('0x44')]?_0x2a6f3f['attributes']:_0x1b53ac[_0x87de('0x41')];_0x2a6f3f[_0x87de('0x47')]=qs[_0x87de('0x48')](_0x50c23f[_0x87de('0x3d')][_0x87de('0x48')]);_0x2a6f3f[_0x87de('0x49')]=qs[_0x87de('0x3f')](_[_0x87de('0x4a')](_0x50c23f[_0x87de('0x3d')],_0x1b53ac[_0x87de('0x3f')]));if(_0x50c23f[_0x87de('0x3d')][_0x87de('0x4b')]){_0x2a6f3f['where']=_['merge'](_0x2a6f3f['where'],{'$or':_[_0x87de('0x3c')](_0x2a6f3f['attributes'],function(_0x284f4c){var _0x47816f={};_0x47816f[_0x284f4c]={'$like':'%'+_0x50c23f[_0x87de('0x3d')][_0x87de('0x4b')]+'%'};return _0x47816f;})});}_0x2a6f3f=_['merge']({},_0x2a6f3f,_0x50c23f['options']);return _0x3e21f6['getSubjects'](_0x2a6f3f);}})['then'](function(_0x453ad1){if(_0x453ad1){_0x158dea=_0x453ad1[_0x87de('0x44')];if(!_0x50c23f['query'][_0x87de('0x45')](_0x87de('0x59'))){_0x2a6f3f[_0x87de('0x46')]=qs['limit'](_0x50c23f[_0x87de('0x3d')][_0x87de('0x46')]);_0x2a6f3f['offset']=qs[_0x87de('0x2e')](_0x50c23f['query'][_0x87de('0x2e')]);}return _0x3e21f6[_0x87de('0x5a')](_0x2a6f3f);}})['then'](function(_0x2baa80){if(_0x2baa80){return _0x2baa80?{'count':_0x158dea,'rows':_0x2baa80}:null;}})['then'](respondWithResult(_0x288196,null))['catch'](handleError(_0x288196,null));};exports[_0x87de('0x5c')]=function(_0x3ab173,_0x4f9d89,_0x5e9b71){var _0x4dfda5={};var _0x6775ed={};var _0x5bc7ff;var _0x15c843;return db[_0x87de('0x37')][_0x87de('0x58')]({'where':{'id':_0x3ab173[_0x87de('0x56')]['id']}})[_0x87de('0x1e')](handleEntityNotFound(_0x4f9d89,null))[_0x87de('0x1e')](function(_0x484806){if(_0x484806){_0x5bc7ff=_0x484806;_0x6775ed[_0x87de('0x41')]=_[_0x87de('0x3e')](db[_0x87de('0x5b')][_0x87de('0x38')]);_0x6775ed['query']=_[_0x87de('0x3e')](_0x3ab173[_0x87de('0x3d')]);_0x6775ed[_0x87de('0x3f')]=_[_0x87de('0x40')](_0x6775ed[_0x87de('0x41')],_0x6775ed[_0x87de('0x3d')]);_0x4dfda5[_0x87de('0x42')]=_[_0x87de('0x40')](_0x6775ed[_0x87de('0x41')],qs[_0x87de('0x43')](_0x3ab173['query'][_0x87de('0x43')]));_0x4dfda5[_0x87de('0x42')]=_0x4dfda5[_0x87de('0x42')]['length']?_0x4dfda5['attributes']:_0x6775ed['model'];_0x4dfda5[_0x87de('0x47')]=qs['sort'](_0x3ab173['query'][_0x87de('0x48')]);_0x4dfda5[_0x87de('0x49')]=qs[_0x87de('0x3f')](_[_0x87de('0x4a')](_0x3ab173[_0x87de('0x3d')],_0x6775ed['filters']));if(_0x3ab173['query'][_0x87de('0x4b')]){_0x4dfda5[_0x87de('0x49')]=_[_0x87de('0x4c')](_0x4dfda5[_0x87de('0x49')],{'$or':_[_0x87de('0x3c')](_0x4dfda5['attributes'],function(_0x55f10c){var _0x511a24={};_0x511a24[_0x55f10c]={'$like':'%'+_0x3ab173['query']['filter']+'%'};return _0x511a24;})});}_0x4dfda5=_[_0x87de('0x4c')]({},_0x4dfda5,_0x3ab173[_0x87de('0x4e')]);return _0x5bc7ff['getDescriptions'](_0x4dfda5);}})[_0x87de('0x1e')](function(_0x27e025){if(_0x27e025){_0x15c843=_0x27e025[_0x87de('0x44')];if(!_0x3ab173['query'][_0x87de('0x45')](_0x87de('0x59'))){_0x4dfda5[_0x87de('0x46')]=qs['limit'](_0x3ab173[_0x87de('0x3d')][_0x87de('0x46')]);_0x4dfda5[_0x87de('0x2e')]=qs[_0x87de('0x2e')](_0x3ab173[_0x87de('0x3d')]['offset']);}return _0x5bc7ff[_0x87de('0x5c')](_0x4dfda5);}})[_0x87de('0x1e')](function(_0x1906d6){if(_0x1906d6){return _0x1906d6?{'count':_0x15c843,'rows':_0x1906d6}:null;}})[_0x87de('0x1e')](respondWithResult(_0x4f9d89,null))[_0x87de('0x29')](handleError(_0x4f9d89,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 4244b4d..1b2665e 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 _0xc9be=['int_servicenow_configurations','lodash','api','request-promise','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration'];(function(_0xf05891,_0x5327e6){var _0x190faa=function(_0x2c3608){while(--_0x2c3608){_0xf05891['push'](_0xf05891['shift']());}};_0x190faa(++_0x5327e6);}(_0xc9be,0x79));var _0xec9b=function(_0x5c7f18,_0x26b7b9){_0x5c7f18=_0x5c7f18-0x0;var _0x1eea0e=_0xc9be[_0x5c7f18];return _0x1eea0e;};'use strict';var _=require(_0xec9b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xec9b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xec9b('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xec9b('0x3'));var config=require(_0xec9b('0x4'));var attributes=require(_0xec9b('0x5'));module[_0xec9b('0x6')]=function(_0x2e8c54,_0x182f97){return _0x2e8c54[_0xec9b('0x7')](_0xec9b('0x8'),attributes,{'tableName':_0xec9b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4bf=['exports','ServicenowConfiguration','lodash','util','api','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes'];(function(_0x1547fb,_0x26c693){var _0x502071=function(_0x24dcd6){while(--_0x24dcd6){_0x1547fb['push'](_0x1547fb['shift']());}};_0x502071(++_0x26c693);}(_0xc4bf,0xb6));var _0xfc4b=function(_0x2b12f7,_0x4033ac){_0x2b12f7=_0x2b12f7-0x0;var _0x8cb277=_0xc4bf[_0x2b12f7];return _0x8cb277;};'use strict';var _=require(_0xfc4b('0x0'));var util=require(_0xfc4b('0x1'));var logger=require('../../config/logger')(_0xfc4b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfc4b('0x3'));var fs=require('fs');var path=require(_0xfc4b('0x4'));var rimraf=require(_0xfc4b('0x5'));var config=require(_0xfc4b('0x6'));var attributes=require(_0xfc4b('0x7'));module[_0xfc4b('0x8')]=function(_0x5dd48b,_0x3f3c5d){return _0x5dd48b['define'](_0xfc4b('0x9'),attributes,{'tableName':'int_servicenow_configurations','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 03375e7..917d3cd 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 _0x8a52=['result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x12da7a,_0xbee425){var _0x3d35c0=function(_0x18df47){while(--_0x18df47){_0x12da7a['push'](_0x12da7a['shift']());}};_0x3d35c0(++_0xbee425);}(_0x8a52,0x1ba));var _0x28a5=function(_0x10176a,_0x4f643f){_0x10176a=_0x10176a-0x0;var _0x414dd0=_0x8a52[_0x10176a];return _0x414dd0;};'use strict';var _=require(_0x28a5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x28a5('0x1'));var rs=require(_0x28a5('0x2'));var fs=require('fs');var Redis=require(_0x28a5('0x3'));var db=require(_0x28a5('0x4'))['db'];var utils=require(_0x28a5('0x5'));var logger=require(_0x28a5('0x6'))(_0x28a5('0x7'));var config=require('../../config/environment');var jayson=require(_0x28a5('0x8'));var client=jayson[_0x28a5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3fe2ce,_0x49ee2e,_0x3f9a35){return new BPromise(function(_0x2457aa,_0x58368a){return client[_0x28a5('0xa')](_0x3fe2ce,_0x3f9a35)[_0x28a5('0xb')](function(_0x39c282){logger[_0x28a5('0xc')](_0x28a5('0xd'),_0x49ee2e,'request\x20sent');logger['debug'](_0x28a5('0xe'),_0x49ee2e,_0x28a5('0xf'),JSON[_0x28a5('0x10')](_0x39c282));if(_0x39c282['error']){if(_0x39c282[_0x28a5('0x11')][_0x28a5('0x12')]===0x1f4){logger[_0x28a5('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x49ee2e,_0x39c282[_0x28a5('0x11')][_0x28a5('0x13')]);return _0x58368a(_0x39c282[_0x28a5('0x11')][_0x28a5('0x13')]);}logger['error'](_0x28a5('0xd'),_0x49ee2e,_0x39c282['error'][_0x28a5('0x13')]);return _0x2457aa(_0x39c282['error'][_0x28a5('0x13')]);}else{logger[_0x28a5('0xc')](_0x28a5('0xd'),_0x49ee2e,_0x28a5('0xf'));_0x2457aa(_0x39c282[_0x28a5('0x14')][_0x28a5('0x13')]);}})['catch'](function(_0x53dbdd){logger[_0x28a5('0x11')](_0x28a5('0xd'),_0x49ee2e,_0x53dbdd);_0x58368a(_0x53dbdd);});});} \ No newline at end of file +var _0xb4f5=['../../config/environment','jayson/promise','client','http','info','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','ServicenowConfiguration,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x3a0100,_0x212268){var _0x548171=function(_0x2a490d){while(--_0x2a490d){_0x3a0100['push'](_0x3a0100['shift']());}};_0x548171(++_0x212268);}(_0xb4f5,0x1b2));var _0x5b4f=function(_0x5e7e1a,_0x38a7c6){_0x5e7e1a=_0x5e7e1a-0x0;var _0x46b94f=_0xb4f5[_0x5e7e1a];return _0x46b94f;};'use strict';var _=require(_0x5b4f('0x0'));var util=require(_0x5b4f('0x1'));var moment=require(_0x5b4f('0x2'));var BPromise=require('bluebird');var rs=require(_0x5b4f('0x3'));var fs=require('fs');var Redis=require(_0x5b4f('0x4'));var db=require(_0x5b4f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5b4f('0x6'));var config=require(_0x5b4f('0x7'));var jayson=require(_0x5b4f('0x8'));var client=jayson[_0x5b4f('0x9')][_0x5b4f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x156399,_0x17935f,_0x5870d3){return new BPromise(function(_0x46a51a,_0x429cb8){return client['request'](_0x156399,_0x5870d3)['then'](function(_0x5b58de){logger[_0x5b4f('0xb')]('ServicenowConfiguration,\x20%s,\x20%s',_0x17935f,'request\x20sent');logger[_0x5b4f('0xc')](_0x5b4f('0xd'),_0x17935f,_0x5b4f('0xe'),JSON[_0x5b4f('0xf')](_0x5b58de));if(_0x5b58de[_0x5b4f('0x10')]){if(_0x5b58de[_0x5b4f('0x10')]['code']===0x1f4){logger[_0x5b4f('0x10')]('ServicenowConfiguration,\x20%s,\x20%s',_0x17935f,_0x5b58de['error'][_0x5b4f('0x11')]);return _0x429cb8(_0x5b58de['error'][_0x5b4f('0x11')]);}logger[_0x5b4f('0x10')](_0x5b4f('0x12'),_0x17935f,_0x5b58de[_0x5b4f('0x10')][_0x5b4f('0x11')]);return _0x46a51a(_0x5b58de[_0x5b4f('0x10')]['message']);}else{logger[_0x5b4f('0xb')]('ServicenowConfiguration,\x20%s,\x20%s',_0x17935f,_0x5b4f('0xe'));_0x46a51a(_0x5b58de[_0x5b4f('0x13')][_0x5b4f('0x11')]);}})[_0x5b4f('0x14')](function(_0x1af19f){logger[_0x5b4f('0x10')](_0x5b4f('0x12'),_0x17935f,_0x1af19f);_0x429cb8(_0x1af19f);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index bfcd334..95b5514 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 _0x55d4=['update','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intServicenowField.controller','index','get','/:id','show','post','isAuthenticated','create','put'];(function(_0x4dd12c,_0x1f544c){var _0x1d73c7=function(_0x242808){while(--_0x242808){_0x4dd12c['push'](_0x4dd12c['shift']());}};_0x1d73c7(++_0x1f544c);}(_0x55d4,0x15a));var _0x455d=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x55d4[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require('multer');var util=require(_0x455d('0x0'));var path=require(_0x455d('0x1'));var timeout=require(_0x455d('0x2'));var express=require(_0x455d('0x3'));var router=express['Router']();var auth=require(_0x455d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x455d('0x5'));var controller=require(_0x455d('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x455d('0x7')]);router[_0x455d('0x8')](_0x455d('0x9'),auth['isAuthenticated'](),controller[_0x455d('0xa')]);router[_0x455d('0xb')]('/',auth[_0x455d('0xc')](),controller[_0x455d('0xd')]);router[_0x455d('0xe')](_0x455d('0x9'),auth[_0x455d('0xc')](),controller[_0x455d('0xf')]);router[_0x455d('0x10')](_0x455d('0x9'),auth[_0x455d('0xc')](),controller[_0x455d('0x11')]);module[_0x455d('0x12')]=router; \ No newline at end of file +var _0xd286=['multer','connect-timeout','../../components/auth/service','../../config/environment','isAuthenticated','get','/:id','show','create','put','update','destroy','exports'];(function(_0x25afa9,_0x28840b){var _0xe03c4c=function(_0xff0a21){while(--_0xff0a21){_0x25afa9['push'](_0x25afa9['shift']());}};_0xe03c4c(++_0x28840b);}(_0xd286,0x179));var _0x6d28=function(_0x2732cc,_0x3704f2){_0x2732cc=_0x2732cc-0x0;var _0xaf082f=_0xd286[_0x2732cc];return _0xaf082f;};'use strict';var multer=require(_0x6d28('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6d28('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x6d28('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x6d28('0x3'));var controller=require('./intServicenowField.controller');router['get']('/',auth[_0x6d28('0x4')](),controller['index']);router[_0x6d28('0x5')](_0x6d28('0x6'),auth[_0x6d28('0x4')](),controller[_0x6d28('0x7')]);router['post']('/',auth[_0x6d28('0x4')](),controller[_0x6d28('0x8')]);router[_0x6d28('0x9')](_0x6d28('0x6'),auth[_0x6d28('0x4')](),controller[_0x6d28('0xa')]);router['delete']('/:id',auth[_0x6d28('0x4')](),controller[_0x6d28('0xb')]);module[_0x6d28('0xc')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index db33612..11664fa 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 _0xb810=['customVariable','sequelize','exports','string','variable','keyValue','STRING','ENUM'];(function(_0x5b746b,_0xacfd8b){var _0x2e7fa3=function(_0x2e5c08){while(--_0x2e5c08){_0x5b746b['push'](_0x5b746b['shift']());}};_0x2e7fa3(++_0xacfd8b);}(_0xb810,0x1e9));var _0x0b81=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xb810[_0x4a53d];return _0x27410e;};'use strict';var Sequelize=require(_0x0b81('0x0'));module[_0x0b81('0x1')]={'type':{'type':Sequelize['ENUM'](_0x0b81('0x2'),_0x0b81('0x3'),'customVariable',_0x0b81('0x4')),'defaultValue':_0x0b81('0x2')},'content':{'type':Sequelize[_0x0b81('0x5')]},'key':{'type':Sequelize[_0x0b81('0x5')]},'keyType':{'type':Sequelize[_0x0b81('0x6')]('string','variable',_0x0b81('0x7'))},'keyContent':{'type':Sequelize[_0x0b81('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x0b81('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0b81('0x5')]}}; \ No newline at end of file +var _0x4d7e=['keyValue','string','STRING','ENUM','exports','variable','customVariable'];(function(_0x1b93f6,_0x5c8aec){var _0x23f1c=function(_0x560baf){while(--_0x560baf){_0x1b93f6['push'](_0x1b93f6['shift']());}};_0x23f1c(++_0x5c8aec);}(_0x4d7e,0xba));var _0xe4d7=function(_0x3b4b79,_0x395e10){_0x3b4b79=_0x3b4b79-0x0;var _0x5d48b9=_0x4d7e[_0x3b4b79];return _0x5d48b9;};'use strict';var Sequelize=require('sequelize');module[_0xe4d7('0x0')]={'type':{'type':Sequelize['ENUM']('string',_0xe4d7('0x1'),_0xe4d7('0x2'),_0xe4d7('0x3')),'defaultValue':_0xe4d7('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xe4d7('0x5')]},'keyType':{'type':Sequelize[_0xe4d7('0x6')](_0xe4d7('0x4'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xe4d7('0x5')]},'idField':{'type':Sequelize[_0xe4d7('0x5')]},'nameField':{'type':Sequelize[_0xe4d7('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe4d7('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index ac2efd6..a288d76 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 _0xbc0d=['desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ServicenowField','fieldName','type','key','model','query','filters','intersection','fields','length','attributes','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','options','count','includeAll','include','findAll','rows','show','rawAttributes','keys','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce'];(function(_0x1f1511,_0x4ea911){var _0x1d9ab8=function(_0x53276a){while(--_0x53276a){_0x1f1511['push'](_0x1f1511['shift']());}};_0x1d9ab8(++_0x4ea911);}(_0xbc0d,0x129));var _0xdbc0=function(_0xdbe2de,_0x3bdc5a){_0xdbe2de=_0xdbe2de-0x0;var _0x2facd7=_0xbc0d[_0xdbe2de];return _0x2facd7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdbc0('0x0'));var rimraf=require(_0xdbc0('0x1'));var zipdir=require(_0xdbc0('0x2'));var jsonpatch=require(_0xdbc0('0x3'));var rp=require(_0xdbc0('0x4'));var moment=require(_0xdbc0('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdbc0('0x6'));var util=require(_0xdbc0('0x7'));var path=require(_0xdbc0('0x8'));var sox=require(_0xdbc0('0x9'));var csv=require('to-csv');var ejs=require(_0xdbc0('0xa'));var fs=require('fs');var _=require(_0xdbc0('0xb'));var squel=require(_0xdbc0('0xc'));var crypto=require(_0xdbc0('0xd'));var jsforce=require(_0xdbc0('0xe'));var deskjs=require(_0xdbc0('0xf'));var toCsv=require(_0xdbc0('0x10'));var querystring=require('querystring');var Papa=require(_0xdbc0('0x11'));var Redis=require(_0xdbc0('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xdbc0('0x13'));var as=require(_0xdbc0('0x14'));var hardwareService=require(_0xdbc0('0x15'));var logger=require(_0xdbc0('0x16'))('api');var utils=require(_0xdbc0('0x17'));var config=require(_0xdbc0('0x18'));var db=require(_0xdbc0('0x19'))['db'];function respondWithStatusCode(_0x10bf19,_0x44caab){_0x44caab=_0x44caab||0xcc;return function(_0x11c690){if(_0x11c690){return _0x10bf19[_0xdbc0('0x1a')](_0x44caab);}return _0x10bf19[_0xdbc0('0x1b')](_0x44caab)[_0xdbc0('0x1c')]();};}function respondWithResult(_0x345871,_0xe0b7b8){_0xe0b7b8=_0xe0b7b8||0xc8;return function(_0x38ed76){if(_0x38ed76){return _0x345871['status'](_0xe0b7b8)[_0xdbc0('0x1d')](_0x38ed76);}};}function respondWithFilteredResult(_0x49e147,_0xb7ac2){return function(_0x47e58f){if(_0x47e58f){var _0x551920=_0x47e58f['count'],_0x320fd9=_0xb7ac2[_0xdbc0('0x1e')],_0x2010a0=_0xb7ac2['offset']+_0xb7ac2[_0xdbc0('0x1f')],_0x5e801d;if(_0x2010a0>=_0x551920){_0x2010a0=_0x551920;_0x5e801d=0xc8;}else{_0x5e801d=0xce;}_0x49e147[_0xdbc0('0x1b')](_0x5e801d);return _0x49e147[_0xdbc0('0x20')]('Content-Range',_0x320fd9+'-'+_0x2010a0+'/'+_0x551920)[_0xdbc0('0x1d')](_0x47e58f);}return null;};}function patchUpdates(_0xe1070){return function(_0x5aea1d){try{jsonpatch[_0xdbc0('0x21')](_0x5aea1d,_0xe1070,!![]);}catch(_0x315d8a){return BPromise[_0xdbc0('0x22')](_0x315d8a);}return _0x5aea1d[_0xdbc0('0x23')]();};}function saveUpdates(_0x2554e3,_0x124b07){return function(_0x57ef7a){if(_0x57ef7a){return _0x57ef7a[_0xdbc0('0x24')](_0x2554e3)[_0xdbc0('0x25')](function(_0x5ab988){return _0x5ab988;});}return null;};}function removeEntity(_0x5c4342,_0x332160){return function(_0x5cc267){if(_0x5cc267){return _0x5cc267[_0xdbc0('0x26')]()[_0xdbc0('0x25')](function(){_0x5c4342[_0xdbc0('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48caf9,_0xb03554){return function(_0x338aad){if(!_0x338aad){_0x48caf9[_0xdbc0('0x1a')](0x194);}return _0x338aad;};}function handleError(_0x4b98a7,_0x1c245d){_0x1c245d=_0x1c245d||0x1f4;return function(_0x1af678){logger[_0xdbc0('0x27')](_0x1af678[_0xdbc0('0x28')]);if(_0x1af678[_0xdbc0('0x29')]){delete _0x1af678[_0xdbc0('0x29')];}_0x4b98a7[_0xdbc0('0x1b')](_0x1c245d)[_0xdbc0('0x2a')](_0x1af678);};}exports[_0xdbc0('0x2b')]=function(_0x54a5a5,_0x404768){var _0x2aa04a={},_0x563e4c={},_0x330ba7={'count':0x0,'rows':[]};var _0x59b955=_[_0xdbc0('0x2c')](db[_0xdbc0('0x2d')]['rawAttributes'],function(_0x2c601f){return{'name':_0x2c601f[_0xdbc0('0x2e')],'type':_0x2c601f[_0xdbc0('0x2f')][_0xdbc0('0x30')]};});_0x563e4c[_0xdbc0('0x31')]=_[_0xdbc0('0x2c')](_0x59b955,_0xdbc0('0x29'));_0x563e4c[_0xdbc0('0x32')]=_['keys'](_0x54a5a5[_0xdbc0('0x32')]);_0x563e4c[_0xdbc0('0x33')]=_['intersection'](_0x563e4c[_0xdbc0('0x31')],_0x563e4c[_0xdbc0('0x32')]);_0x2aa04a['attributes']=_[_0xdbc0('0x34')](_0x563e4c['model'],qs[_0xdbc0('0x35')](_0x54a5a5[_0xdbc0('0x32')]['fields']));_0x2aa04a['attributes']=_0x2aa04a['attributes'][_0xdbc0('0x36')]?_0x2aa04a[_0xdbc0('0x37')]:_0x563e4c['model'];if(!_0x54a5a5[_0xdbc0('0x32')][_0xdbc0('0x38')]('nolimit')){_0x2aa04a['limit']=qs[_0xdbc0('0x1f')](_0x54a5a5[_0xdbc0('0x32')][_0xdbc0('0x1f')]);_0x2aa04a[_0xdbc0('0x1e')]=qs[_0xdbc0('0x1e')](_0x54a5a5[_0xdbc0('0x32')][_0xdbc0('0x1e')]);}_0x2aa04a[_0xdbc0('0x39')]=qs[_0xdbc0('0x3a')](_0x54a5a5[_0xdbc0('0x32')][_0xdbc0('0x3a')]);_0x2aa04a['where']=qs[_0xdbc0('0x33')](_[_0xdbc0('0x3b')](_0x54a5a5[_0xdbc0('0x32')],_0x563e4c[_0xdbc0('0x33')]));if(_0x54a5a5[_0xdbc0('0x32')][_0xdbc0('0x3c')]){_0x2aa04a['where']=_[_0xdbc0('0x3d')](_0x2aa04a[_0xdbc0('0x3e')],{'$or':_['map'](_0x59b955,function(_0x3cffae){if(_0x3cffae['type']!==_0xdbc0('0x3f')){var _0xfeb214={};_0xfeb214[_0x3cffae[_0xdbc0('0x29')]]={'$like':'%'+_0x54a5a5['query'][_0xdbc0('0x3c')]+'%'};return _0xfeb214;}})});}_0x2aa04a=_[_0xdbc0('0x3d')]({},_0x2aa04a,_0x54a5a5[_0xdbc0('0x40')]);var _0x6230dd={'where':_0x2aa04a['where']};return db[_0xdbc0('0x2d')][_0xdbc0('0x41')](_0x6230dd)[_0xdbc0('0x25')](function(_0x274996){_0x330ba7[_0xdbc0('0x41')]=_0x274996;if(_0x54a5a5[_0xdbc0('0x32')][_0xdbc0('0x42')]){_0x2aa04a[_0xdbc0('0x43')]=[{'all':!![]}];}return db['ServicenowField'][_0xdbc0('0x44')](_0x2aa04a);})[_0xdbc0('0x25')](function(_0x3f31bb){_0x330ba7[_0xdbc0('0x45')]=_0x3f31bb;return _0x330ba7;})[_0xdbc0('0x25')](respondWithFilteredResult(_0x404768,_0x2aa04a))['catch'](handleError(_0x404768,null));};exports[_0xdbc0('0x46')]=function(_0x35506d,_0x555df4){var _0x244d88={'raw':!![],'where':{'id':_0x35506d['params']['id']}},_0x39ce95={};_0x39ce95['model']=_['keys'](db[_0xdbc0('0x2d')][_0xdbc0('0x47')]);_0x39ce95[_0xdbc0('0x32')]=_[_0xdbc0('0x48')](_0x35506d[_0xdbc0('0x32')]);_0x39ce95['filters']=_[_0xdbc0('0x34')](_0x39ce95[_0xdbc0('0x31')],_0x39ce95[_0xdbc0('0x32')]);_0x244d88[_0xdbc0('0x37')]=_['intersection'](_0x39ce95['model'],qs[_0xdbc0('0x35')](_0x35506d[_0xdbc0('0x32')][_0xdbc0('0x35')]));_0x244d88[_0xdbc0('0x37')]=_0x244d88[_0xdbc0('0x37')]['length']?_0x244d88[_0xdbc0('0x37')]:_0x39ce95['model'];if(_0x35506d['query']['includeAll']){_0x244d88[_0xdbc0('0x43')]=[{'all':!![]}];}_0x244d88=_[_0xdbc0('0x3d')]({},_0x244d88,_0x35506d[_0xdbc0('0x40')]);return db[_0xdbc0('0x2d')][_0xdbc0('0x49')](_0x244d88)[_0xdbc0('0x25')](handleEntityNotFound(_0x555df4,null))['then'](respondWithResult(_0x555df4,null))[_0xdbc0('0x4a')](handleError(_0x555df4,null));};exports[_0xdbc0('0x4b')]=function(_0x2ebc56,_0x131851){return db[_0xdbc0('0x2d')][_0xdbc0('0x4b')](_0x2ebc56['body'],{})['then'](respondWithResult(_0x131851,0xc9))[_0xdbc0('0x4a')](handleError(_0x131851,null));};exports[_0xdbc0('0x24')]=function(_0x4b3be2,_0x1876e5){if(_0x4b3be2[_0xdbc0('0x4c')]['id']){delete _0x4b3be2['body']['id'];}return db[_0xdbc0('0x2d')]['find']({'where':{'id':_0x4b3be2[_0xdbc0('0x4d')]['id']}})[_0xdbc0('0x25')](handleEntityNotFound(_0x1876e5,null))[_0xdbc0('0x25')](saveUpdates(_0x4b3be2['body'],null))[_0xdbc0('0x25')](respondWithResult(_0x1876e5,null))[_0xdbc0('0x4a')](handleError(_0x1876e5,null));};exports['destroy']=function(_0x29e07a,_0x2a94e9){return db['ServicenowField']['find']({'where':{'id':_0x29e07a[_0xdbc0('0x4d')]['id']}})[_0xdbc0('0x25')](handleEntityNotFound(_0x2a94e9,null))[_0xdbc0('0x25')](removeEntity(_0x2a94e9,null))[_0xdbc0('0x4a')](handleError(_0x2a94e9,null));}; \ No newline at end of file +var _0x97e4=['moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','set','apply','update','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','length','attributes','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','ServicenowField','includeAll','include','findAll','rows','catch','params','fields','find','body','html-pdf','eml-format','zip-dir','fast-json-patch'];(function(_0x26e127,_0x354e00){var _0x3503a9=function(_0x4484c9){while(--_0x4484c9){_0x26e127['push'](_0x26e127['shift']());}};_0x3503a9(++_0x354e00);}(_0x97e4,0x155));var _0x497e=function(_0x3f5522,_0x28e324){_0x3f5522=_0x3f5522-0x0;var _0x4731f1=_0x97e4[_0x3f5522];return _0x4731f1;};'use strict';var pdf=require(_0x497e('0x0'));var emlformat=require(_0x497e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x497e('0x2'));var jsonpatch=require(_0x497e('0x3'));var rp=require('request-promise');var moment=require(_0x497e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x497e('0x5'));var util=require(_0x497e('0x6'));var path=require(_0x497e('0x7'));var sox=require(_0x497e('0x8'));var csv=require(_0x497e('0x9'));var ejs=require(_0x497e('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x497e('0xb'));var crypto=require(_0x497e('0xc'));var jsforce=require(_0x497e('0xd'));var deskjs=require(_0x497e('0xe'));var toCsv=require(_0x497e('0x9'));var querystring=require(_0x497e('0xf'));var Papa=require(_0x497e('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x497e('0x11'));var as=require(_0x497e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x497e('0x13'))('api');var utils=require(_0x497e('0x14'));var config=require('../../config/environment');var db=require(_0x497e('0x15'))['db'];function respondWithStatusCode(_0x53f755,_0xf0cef5){_0xf0cef5=_0xf0cef5||0xcc;return function(_0x216ba1){if(_0x216ba1){return _0x53f755['sendStatus'](_0xf0cef5);}return _0x53f755[_0x497e('0x16')](_0xf0cef5)[_0x497e('0x17')]();};}function respondWithResult(_0x3d310,_0x43502b){_0x43502b=_0x43502b||0xc8;return function(_0x22aa26){if(_0x22aa26){return _0x3d310['status'](_0x43502b)[_0x497e('0x18')](_0x22aa26);}};}function respondWithFilteredResult(_0xe72277,_0x4a3442){return function(_0x2bd5d5){if(_0x2bd5d5){var _0x919e66=_0x2bd5d5[_0x497e('0x19')],_0x530fa8=_0x4a3442[_0x497e('0x1a')],_0x401846=_0x4a3442['offset']+_0x4a3442[_0x497e('0x1b')],_0x591091;if(_0x401846>=_0x919e66){_0x401846=_0x919e66;_0x591091=0xc8;}else{_0x591091=0xce;}_0xe72277[_0x497e('0x16')](_0x591091);return _0xe72277[_0x497e('0x1c')]('Content-Range',_0x530fa8+'-'+_0x401846+'/'+_0x919e66)[_0x497e('0x18')](_0x2bd5d5);}return null;};}function patchUpdates(_0x3d0ff3){return function(_0x220b0e){try{jsonpatch[_0x497e('0x1d')](_0x220b0e,_0x3d0ff3,!![]);}catch(_0x58cd0d){return BPromise['reject'](_0x58cd0d);}return _0x220b0e['save']();};}function saveUpdates(_0x1829a3,_0x2a3799){return function(_0x463817){if(_0x463817){return _0x463817[_0x497e('0x1e')](_0x1829a3)[_0x497e('0x1f')](function(_0x41ce7b){return _0x41ce7b;});}return null;};}function removeEntity(_0x29f7e8,_0x2134a1){return function(_0x5418a2){if(_0x5418a2){return _0x5418a2['destroy']()[_0x497e('0x1f')](function(){_0x29f7e8[_0x497e('0x16')](0xcc)[_0x497e('0x17')]();});}};}function handleEntityNotFound(_0x29d06c,_0x495e31){return function(_0x5ca479){if(!_0x5ca479){_0x29d06c[_0x497e('0x20')](0x194);}return _0x5ca479;};}function handleError(_0xa90d47,_0x50f1e2){_0x50f1e2=_0x50f1e2||0x1f4;return function(_0x391290){logger[_0x497e('0x21')](_0x391290[_0x497e('0x22')]);if(_0x391290[_0x497e('0x23')]){delete _0x391290['name'];}_0xa90d47[_0x497e('0x16')](_0x50f1e2)[_0x497e('0x24')](_0x391290);};}exports[_0x497e('0x25')]=function(_0x419462,_0x447a9f){var _0x7d5ca1={},_0x309c54={},_0x4ec387={'count':0x0,'rows':[]};var _0x11c0c7=_[_0x497e('0x26')](db['ServicenowField'][_0x497e('0x27')],function(_0x58985b){return{'name':_0x58985b[_0x497e('0x28')],'type':_0x58985b[_0x497e('0x29')][_0x497e('0x2a')]};});_0x309c54[_0x497e('0x2b')]=_[_0x497e('0x26')](_0x11c0c7,_0x497e('0x23'));_0x309c54['query']=_[_0x497e('0x2c')](_0x419462[_0x497e('0x2d')]);_0x309c54['filters']=_[_0x497e('0x2e')](_0x309c54['model'],_0x309c54[_0x497e('0x2d')]);_0x7d5ca1['attributes']=_[_0x497e('0x2e')](_0x309c54[_0x497e('0x2b')],qs['fields'](_0x419462[_0x497e('0x2d')]['fields']));_0x7d5ca1['attributes']=_0x7d5ca1['attributes'][_0x497e('0x2f')]?_0x7d5ca1[_0x497e('0x30')]:_0x309c54[_0x497e('0x2b')];if(!_0x419462[_0x497e('0x2d')][_0x497e('0x31')]('nolimit')){_0x7d5ca1[_0x497e('0x1b')]=qs[_0x497e('0x1b')](_0x419462[_0x497e('0x2d')][_0x497e('0x1b')]);_0x7d5ca1['offset']=qs[_0x497e('0x1a')](_0x419462[_0x497e('0x2d')][_0x497e('0x1a')]);}_0x7d5ca1[_0x497e('0x32')]=qs['sort'](_0x419462[_0x497e('0x2d')][_0x497e('0x33')]);_0x7d5ca1[_0x497e('0x34')]=qs[_0x497e('0x35')](_[_0x497e('0x36')](_0x419462[_0x497e('0x2d')],_0x309c54[_0x497e('0x35')]));if(_0x419462[_0x497e('0x2d')][_0x497e('0x37')]){_0x7d5ca1[_0x497e('0x34')]=_['merge'](_0x7d5ca1['where'],{'$or':_[_0x497e('0x26')](_0x11c0c7,function(_0xc3c29c){if(_0xc3c29c[_0x497e('0x29')]!==_0x497e('0x38')){var _0x2c80f5={};_0x2c80f5[_0xc3c29c[_0x497e('0x23')]]={'$like':'%'+_0x419462[_0x497e('0x2d')]['filter']+'%'};return _0x2c80f5;}})});}_0x7d5ca1=_[_0x497e('0x39')]({},_0x7d5ca1,_0x419462[_0x497e('0x3a')]);var _0x56e189={'where':_0x7d5ca1[_0x497e('0x34')]};return db[_0x497e('0x3b')][_0x497e('0x19')](_0x56e189)[_0x497e('0x1f')](function(_0x251fef){_0x4ec387[_0x497e('0x19')]=_0x251fef;if(_0x419462[_0x497e('0x2d')][_0x497e('0x3c')]){_0x7d5ca1[_0x497e('0x3d')]=[{'all':!![]}];}return db[_0x497e('0x3b')][_0x497e('0x3e')](_0x7d5ca1);})['then'](function(_0x467ca5){_0x4ec387[_0x497e('0x3f')]=_0x467ca5;return _0x4ec387;})['then'](respondWithFilteredResult(_0x447a9f,_0x7d5ca1))[_0x497e('0x40')](handleError(_0x447a9f,null));};exports['show']=function(_0x2dc3ac,_0x121215){var _0x5c86f6={'raw':!![],'where':{'id':_0x2dc3ac[_0x497e('0x41')]['id']}},_0x5e7a98={};_0x5e7a98[_0x497e('0x2b')]=_['keys'](db['ServicenowField'][_0x497e('0x27')]);_0x5e7a98[_0x497e('0x2d')]=_['keys'](_0x2dc3ac[_0x497e('0x2d')]);_0x5e7a98['filters']=_[_0x497e('0x2e')](_0x5e7a98[_0x497e('0x2b')],_0x5e7a98[_0x497e('0x2d')]);_0x5c86f6['attributes']=_[_0x497e('0x2e')](_0x5e7a98[_0x497e('0x2b')],qs[_0x497e('0x42')](_0x2dc3ac[_0x497e('0x2d')][_0x497e('0x42')]));_0x5c86f6[_0x497e('0x30')]=_0x5c86f6[_0x497e('0x30')][_0x497e('0x2f')]?_0x5c86f6[_0x497e('0x30')]:_0x5e7a98['model'];if(_0x2dc3ac[_0x497e('0x2d')][_0x497e('0x3c')]){_0x5c86f6[_0x497e('0x3d')]=[{'all':!![]}];}_0x5c86f6=_[_0x497e('0x39')]({},_0x5c86f6,_0x2dc3ac[_0x497e('0x3a')]);return db[_0x497e('0x3b')][_0x497e('0x43')](_0x5c86f6)['then'](handleEntityNotFound(_0x121215,null))[_0x497e('0x1f')](respondWithResult(_0x121215,null))['catch'](handleError(_0x121215,null));};exports['create']=function(_0x9110d9,_0x322e5a){return db[_0x497e('0x3b')]['create'](_0x9110d9['body'],{})[_0x497e('0x1f')](respondWithResult(_0x322e5a,0xc9))['catch'](handleError(_0x322e5a,null));};exports[_0x497e('0x1e')]=function(_0x3d9449,_0x23ff7b){if(_0x3d9449[_0x497e('0x44')]['id']){delete _0x3d9449[_0x497e('0x44')]['id'];}return db[_0x497e('0x3b')]['find']({'where':{'id':_0x3d9449[_0x497e('0x41')]['id']}})[_0x497e('0x1f')](handleEntityNotFound(_0x23ff7b,null))['then'](saveUpdates(_0x3d9449[_0x497e('0x44')],null))[_0x497e('0x1f')](respondWithResult(_0x23ff7b,null))[_0x497e('0x40')](handleError(_0x23ff7b,null));};exports['destroy']=function(_0x53b503,_0x15f612){return db['ServicenowField'][_0x497e('0x43')]({'where':{'id':_0x53b503[_0x497e('0x41')]['id']}})[_0x497e('0x1f')](handleEntityNotFound(_0x15f612,null))['then'](removeEntity(_0x15f612,null))[_0x497e('0x40')](handleError(_0x15f612,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 390d456..72833b8 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 _0x6865=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','ServicenowField','servicenow_unique_index','idField','../../config/logger'];(function(_0x3a39ea,_0x44e465){var _0x41cfe5=function(_0x17c509){while(--_0x17c509){_0x3a39ea['push'](_0x3a39ea['shift']());}};_0x41cfe5(++_0x44e465);}(_0x6865,0x1af));var _0x5686=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6865[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5686('0x0'))(_0x5686('0x1'));var moment=require(_0x5686('0x2'));var BPromise=require(_0x5686('0x3'));var rp=require(_0x5686('0x4'));var fs=require('fs');var path=require(_0x5686('0x5'));var rimraf=require(_0x5686('0x6'));var config=require(_0x5686('0x7'));var attributes=require('./intServicenowField.attributes');module[_0x5686('0x8')]=function(_0x3a1924,_0x31d664){return _0x3a1924['define'](_0x5686('0x9'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x5686('0xa'),'fields':[_0x5686('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa98d=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','int_servicenow_fields','servicenow_unique_index','idField','lodash'];(function(_0x38441d,_0x12e5f5){var _0x23c0a0=function(_0xa360c8){while(--_0xa360c8){_0x38441d['push'](_0x38441d['shift']());}};_0x23c0a0(++_0x12e5f5);}(_0xa98d,0x1c1));var _0xda98=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa98d[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xda98('0x0'));var util=require(_0xda98('0x1'));var logger=require(_0xda98('0x2'))(_0xda98('0x3'));var moment=require('moment');var BPromise=require(_0xda98('0x4'));var rp=require(_0xda98('0x5'));var fs=require('fs');var path=require(_0xda98('0x6'));var rimraf=require(_0xda98('0x7'));var config=require(_0xda98('0x8'));var attributes=require(_0xda98('0x9'));module[_0xda98('0xa')]=function(_0x256046,_0x5b6f8d){return _0x256046[_0xda98('0xb')]('ServicenowField',attributes,{'tableName':_0xda98('0xc'),'paranoid':![],'indexes':[{'name':_0xda98('0xd'),'fields':[_0xda98('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 9cc4fc5..852336d 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 _0x09fd=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','ServicenowField,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','randomstring','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x09fd,0x6e));var _0xd09f=function(_0x4dab66,_0x272458){_0x4dab66=_0x4dab66-0x0;var _0x3c658a=_0x09fd[_0x4dab66];return _0x3c658a;};'use strict';var _=require(_0xd09f('0x0'));var util=require(_0xd09f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd09f('0x2'));var fs=require('fs');var Redis=require(_0xd09f('0x3'));var db=require(_0xd09f('0x4'))['db'];var utils=require(_0xd09f('0x5'));var logger=require('../../config/logger')(_0xd09f('0x6'));var config=require(_0xd09f('0x7'));var jayson=require(_0xd09f('0x8'));var client=jayson['client'][_0xd09f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x571069,_0x180fcd,_0x3a57f8){return new BPromise(function(_0xe7442a,_0x4f48e0){return client['request'](_0x571069,_0x3a57f8)[_0xd09f('0xa')](function(_0x1bf82c){logger[_0xd09f('0xb')](_0xd09f('0xc'),_0x180fcd,_0xd09f('0xd'));logger['debug'](_0xd09f('0xe'),_0x180fcd,_0xd09f('0xd'),JSON['stringify'](_0x1bf82c));if(_0x1bf82c[_0xd09f('0xf')]){if(_0x1bf82c[_0xd09f('0xf')]['code']===0x1f4){logger[_0xd09f('0xf')](_0xd09f('0xc'),_0x180fcd,_0x1bf82c['error'][_0xd09f('0x10')]);return _0x4f48e0(_0x1bf82c[_0xd09f('0xf')][_0xd09f('0x10')]);}logger['error'](_0xd09f('0xc'),_0x180fcd,_0x1bf82c[_0xd09f('0xf')][_0xd09f('0x10')]);return _0xe7442a(_0x1bf82c[_0xd09f('0xf')][_0xd09f('0x10')]);}else{logger['info'](_0xd09f('0xc'),_0x180fcd,_0xd09f('0xd'));_0xe7442a(_0x1bf82c[_0xd09f('0x11')][_0xd09f('0x10')]);}})[_0xd09f('0x12')](function(_0xa1af1f){logger['error']('ServicenowField,\x20%s,\x20%s',_0x180fcd,_0xa1af1f);_0x4f48e0(_0xa1af1f);});});} \ No newline at end of file +var _0xef40=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util'];(function(_0x92ef22,_0x87c808){var _0x419f67=function(_0x12e531){while(--_0x12e531){_0x92ef22['push'](_0x92ef22['shift']());}};_0x419f67(++_0x87c808);}(_0xef40,0xa6));var _0x0ef4=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xef40[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x0ef4('0x0'));var util=require(_0x0ef4('0x1'));var moment=require(_0x0ef4('0x2'));var BPromise=require('bluebird');var rs=require(_0x0ef4('0x3'));var fs=require('fs');var Redis=require(_0x0ef4('0x4'));var db=require(_0x0ef4('0x5'))['db'];var utils=require(_0x0ef4('0x6'));var logger=require(_0x0ef4('0x7'))(_0x0ef4('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0ef4('0x9')][_0x0ef4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xfab128,_0xff0b2e,_0x293a2a){return new BPromise(function(_0x26e683,_0x3b70c6){return client[_0x0ef4('0xb')](_0xfab128,_0x293a2a)[_0x0ef4('0xc')](function(_0x29da28){logger[_0x0ef4('0xd')](_0x0ef4('0xe'),_0xff0b2e,_0x0ef4('0xf'));logger[_0x0ef4('0x10')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0xff0b2e,'request\x20sent',JSON[_0x0ef4('0x11')](_0x29da28));if(_0x29da28['error']){if(_0x29da28[_0x0ef4('0x12')]['code']===0x1f4){logger[_0x0ef4('0x12')](_0x0ef4('0xe'),_0xff0b2e,_0x29da28[_0x0ef4('0x12')][_0x0ef4('0x13')]);return _0x3b70c6(_0x29da28['error'][_0x0ef4('0x13')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0xff0b2e,_0x29da28[_0x0ef4('0x12')][_0x0ef4('0x13')]);return _0x26e683(_0x29da28[_0x0ef4('0x12')][_0x0ef4('0x13')]);}else{logger[_0x0ef4('0xd')](_0x0ef4('0xe'),_0xff0b2e,_0x0ef4('0xf'));_0x26e683(_0x29da28[_0x0ef4('0x14')]['message']);}})['catch'](function(_0x585c6f){logger['error'](_0x0ef4('0xe'),_0xff0b2e,_0x585c6f);_0x3b70c6(_0x585c6f);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 661b7f8..ab6533d 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 _0x8eac=['create','addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','post'];(function(_0xca4c88,_0xcef50){var _0x21083d=function(_0x405668){while(--_0x405668){_0xca4c88['push'](_0xca4c88['shift']());}};_0x21083d(++_0xcef50);}(_0x8eac,0x1d4));var _0xc8ea=function(_0x515099,_0x46bdbd){_0x515099=_0x515099-0x0;var _0x26e0a7=_0x8eac[_0x515099];return _0x26e0a7;};'use strict';var multer=require(_0xc8ea('0x0'));var util=require(_0xc8ea('0x1'));var path=require(_0xc8ea('0x2'));var timeout=require('connect-timeout');var express=require(_0xc8ea('0x3'));var router=express[_0xc8ea('0x4')]();var auth=require(_0xc8ea('0x5'));var interaction=require(_0xc8ea('0x6'));var config=require('../../config/environment');var controller=require(_0xc8ea('0x7'));router[_0xc8ea('0x8')]('/',auth[_0xc8ea('0x9')](),controller[_0xc8ea('0xa')]);router['get']('/:id',auth[_0xc8ea('0x9')](),controller[_0xc8ea('0xb')]);router[_0xc8ea('0x8')](_0xc8ea('0xc'),auth[_0xc8ea('0x9')](),controller[_0xc8ea('0xd')]);router['get']('/:id/fields',auth[_0xc8ea('0x9')](),controller['getFields']);router[_0xc8ea('0xe')]('/',auth[_0xc8ea('0x9')](),controller[_0xc8ea('0xf')]);router['post'](_0xc8ea('0xc'),auth[_0xc8ea('0x9')](),controller[_0xc8ea('0x10')]);router[_0xc8ea('0x11')](_0xc8ea('0x12'),auth[_0xc8ea('0x9')](),controller[_0xc8ea('0x13')]);router[_0xc8ea('0x14')](_0xc8ea('0x12'),auth['isAuthenticated'](),controller[_0xc8ea('0x15')]);module[_0xc8ea('0x16')]=router; \ No newline at end of file +var _0x4e21=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','create','post','addConfiguration','delete','destroy','exports','util'];(function(_0x505f73,_0x1f95d8){var _0x227e7f=function(_0x112ae8){while(--_0x112ae8){_0x505f73['push'](_0x505f73['shift']());}};_0x227e7f(++_0x1f95d8);}(_0x4e21,0x92));var _0x14e2=function(_0x1abe50,_0x23e270){_0x1abe50=_0x1abe50-0x0;var _0x220a64=_0x4e21[_0x1abe50];return _0x220a64;};'use strict';var multer=require('multer');var util=require(_0x14e2('0x0'));var path=require(_0x14e2('0x1'));var timeout=require('connect-timeout');var express=require(_0x14e2('0x2'));var router=express[_0x14e2('0x3')]();var auth=require(_0x14e2('0x4'));var interaction=require(_0x14e2('0x5'));var config=require(_0x14e2('0x6'));var controller=require('./intSugarcrmAccount.controller');router[_0x14e2('0x7')]('/',auth[_0x14e2('0x8')](),controller[_0x14e2('0x9')]);router[_0x14e2('0x7')](_0x14e2('0xa'),auth[_0x14e2('0x8')](),controller[_0x14e2('0xb')]);router['get'](_0x14e2('0xc'),auth['isAuthenticated'](),controller[_0x14e2('0xd')]);router['get'](_0x14e2('0xe'),auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0x14e2('0xf')]);router[_0x14e2('0x10')](_0x14e2('0xc'),auth['isAuthenticated'](),controller[_0x14e2('0x11')]);router['put'](_0x14e2('0xa'),auth[_0x14e2('0x8')](),controller['update']);router[_0x14e2('0x12')](_0x14e2('0xa'),auth[_0x14e2('0x8')](),controller[_0x14e2('0x13')]);module[_0x14e2('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index c9ed28c..cb99249 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 _0x7df2=['remoteUri','sequelize','exports','STRING','username'];(function(_0x587693,_0x27fe90){var _0x510a1a=function(_0x290f71){while(--_0x290f71){_0x587693['push'](_0x587693['shift']());}};_0x510a1a(++_0x27fe90);}(_0x7df2,0x119));var _0x27df=function(_0x7217ea,_0x3016f6){_0x7217ea=_0x7217ea-0x0;var _0x15b307=_0x7df2[_0x7217ea];return _0x15b307;};'use strict';var Sequelize=require(_0x27df('0x0'));module[_0x27df('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x27df('0x2')]},'username':{'type':Sequelize[_0x27df('0x2')],'unique':_0x27df('0x3')},'password':{'type':Sequelize[_0x27df('0x2')]},'remoteUri':{'type':Sequelize[_0x27df('0x2')],'unique':_0x27df('0x4')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbb91=['remoteUri','sequelize','exports','STRING','username'];(function(_0x348d2e,_0x2b7b9b){var _0x143ca5=function(_0x287ae4){while(--_0x287ae4){_0x348d2e['push'](_0x348d2e['shift']());}};_0x143ca5(++_0x2b7b9b);}(_0xbb91,0xce));var _0x1bb9=function(_0x3e8930,_0x154364){_0x3e8930=_0x3e8930-0x0;var _0x15b38f=_0xbb91[_0x3e8930];return _0x15b38f;};'use strict';var Sequelize=require(_0x1bb9('0x0'));module[_0x1bb9('0x1')]={'name':{'type':Sequelize[_0x1bb9('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x1bb9('0x2')],'unique':_0x1bb9('0x3')},'password':{'type':Sequelize[_0x1bb9('0x2')]},'remoteUri':{'type':Sequelize[_0x1bb9('0x2')],'unique':_0x1bb9('0x4')},'serverUrl':{'type':Sequelize[_0x1bb9('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index a2559e4..9042a90 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 _0x38f8=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../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~!@#$%^&-_=+[{]}.','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','sendStatus','status','end','count','offset','apply','reject','save','update','then','destroy','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','pick','filter','where','merge','VIRTUAL','SugarcrmAccount','includeAll','include','findAll','rows','catch','params','keys','length','options','find','create','body','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','SugarcrmConfiguration','SugarcrmField','created_by','description','duration_minutes','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','/service/v4_1/rest.php','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','format','%s%s','values','module_fields','label','endsWith','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','send','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs'];(function(_0x189581,_0x3e568f){var _0x489bc2=function(_0x1f5a69){while(--_0x1f5a69){_0x189581['push'](_0x189581['shift']());}};_0x489bc2(++_0x3e568f);}(_0x38f8,0xf6));var _0x838f=function(_0x712d01,_0x53ed96){_0x712d01=_0x712d01-0x0;var _0x49550d=_0x38f8[_0x712d01];return _0x49550d;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x838f('0x0'));var jsonpatch=require(_0x838f('0x1'));var rp=require(_0x838f('0x2'));var moment=require(_0x838f('0x3'));var BPromise=require(_0x838f('0x4'));var Mustache=require(_0x838f('0x5'));var util=require(_0x838f('0x6'));var path=require(_0x838f('0x7'));var sox=require('sox');var csv=require(_0x838f('0x8'));var ejs=require(_0x838f('0x9'));var fs=require('fs');var _=require(_0x838f('0xa'));var squel=require(_0x838f('0xb'));var crypto=require(_0x838f('0xc'));var jsforce=require(_0x838f('0xd'));var deskjs=require(_0x838f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x838f('0xf'));var Papa=require(_0x838f('0x10'));var Redis=require(_0x838f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x838f('0x12'));var as=require(_0x838f('0x13'));var hardwareService=require(_0x838f('0x14'));var logger=require(_0x838f('0x15'))(_0x838f('0x16'));var utils=require('../../config/utils');var config=require(_0x838f('0x17'));var db=require(_0x838f('0x18'))['db'];var integrations=require(_0x838f('0x19'));var jayson=require(_0x838f('0x1a'));var client=jayson[_0x838f('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x2c3ae4,_0x2b7c80,_0x40e3b5){if(_0x40e3b5){var _0xe67280=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xe67280[_0x838f('0x1c')](_0x2b7c80)){return _0x2c3ae4;}else{throw new db[(_0x838f('0x1d'))][(_0x838f('0x1e'))](_0x838f('0x1f'));}}else{return _0x2c3ae4;}}function respondWithRpcPromise(_0x2f5fb6,_0x5934d2,_0x211653,_0x4b4597){return new BPromise(function(_0x3ad676,_0x3f56f6){var _0xe5c112=_0x4b4597||client;return _0xe5c112['request'](_0x2f5fb6,_0x211653)['then'](function(_0x369ef1){logger[_0x838f('0x20')](_0x838f('0x21'),_0x5934d2,_0x838f('0x22'));logger[_0x838f('0x23')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x5934d2,_0x838f('0x22'),JSON[_0x838f('0x24')](_0x369ef1));if(_0x369ef1['error']){if(_0x369ef1['error'][_0x838f('0x25')]===0x1f4){logger[_0x838f('0x26')](_0x838f('0x21'),_0x5934d2,_0x369ef1[_0x838f('0x26')][_0x838f('0x27')]);return _0x3f56f6(_0x369ef1[_0x838f('0x26')][_0x838f('0x27')]);}logger['error'](_0x838f('0x21'),_0x5934d2,_0x369ef1[_0x838f('0x26')][_0x838f('0x27')]);return _0x3ad676(_0x369ef1[_0x838f('0x26')]['message']);}else{logger[_0x838f('0x20')](_0x838f('0x21'),_0x5934d2,_0x838f('0x22'));_0x3ad676(_0x369ef1['result'][_0x838f('0x27')]);}})['catch'](function(_0x8a10cd){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x5934d2,_0x8a10cd);_0x3f56f6(_0x8a10cd);});});}function respondWithStatusCode(_0x7afe49,_0x286332){_0x286332=_0x286332||0xcc;return function(_0x78c9ed){if(_0x78c9ed){return _0x7afe49[_0x838f('0x28')](_0x286332);}return _0x7afe49[_0x838f('0x29')](_0x286332)[_0x838f('0x2a')]();};}function respondWithResult(_0x2f669b,_0xe2c5c1){_0xe2c5c1=_0xe2c5c1||0xc8;return function(_0x526c81){if(_0x526c81){return _0x2f669b['status'](_0xe2c5c1)['json'](_0x526c81);}};}function respondWithFilteredResult(_0x2e4450,_0x4bf027){return function(_0x42a564){if(_0x42a564){var _0x1c8bf9=_0x42a564[_0x838f('0x2b')],_0x5c56bd=_0x4bf027[_0x838f('0x2c')],_0x4401be=_0x4bf027[_0x838f('0x2c')]+_0x4bf027['limit'],_0x14c16c;if(_0x4401be>=_0x1c8bf9){_0x4401be=_0x1c8bf9;_0x14c16c=0xc8;}else{_0x14c16c=0xce;}_0x2e4450[_0x838f('0x29')](_0x14c16c);return _0x2e4450['set']('Content-Range',_0x5c56bd+'-'+_0x4401be+'/'+_0x1c8bf9)['json'](_0x42a564);}return null;};}function patchUpdates(_0x26cd02){return function(_0x1a1e50){try{jsonpatch[_0x838f('0x2d')](_0x1a1e50,_0x26cd02,!![]);}catch(_0x119f35){return BPromise[_0x838f('0x2e')](_0x119f35);}return _0x1a1e50[_0x838f('0x2f')]();};}function saveUpdates(_0x539a9b,_0x4bb76b){return function(_0x32ba08){if(_0x32ba08){return _0x32ba08[_0x838f('0x30')](_0x539a9b)[_0x838f('0x31')](function(_0x5b7e41){return _0x5b7e41;});}return null;};}function removeEntity(_0x505322,_0x335480){return function(_0x303f1c){if(_0x303f1c){return _0x303f1c[_0x838f('0x32')]()[_0x838f('0x31')](function(){_0x505322[_0x838f('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x530878,_0x5d4609){return function(_0x3359bc){if(!_0x3359bc){_0x530878[_0x838f('0x28')](0x194);}return _0x3359bc;};}function handleError(_0x11ff33,_0x504942){_0x504942=_0x504942||0x1f4;return function(_0x14f558){logger['error'](_0x14f558[_0x838f('0x33')]);if(_0x14f558[_0x838f('0x34')]){delete _0x14f558[_0x838f('0x34')];}_0x11ff33[_0x838f('0x29')](_0x504942)['send'](_0x14f558);};}exports[_0x838f('0x35')]=function(_0x745939,_0x1b4c7d){var _0x39ec2e={},_0x4c78df={},_0x4edd2f={'count':0x0,'rows':[]};var _0x202a93=_['map'](db['SugarcrmAccount'][_0x838f('0x36')],function(_0x452edc){return{'name':_0x452edc[_0x838f('0x37')],'type':_0x452edc[_0x838f('0x38')][_0x838f('0x39')]};});_0x4c78df[_0x838f('0x3a')]=_[_0x838f('0x3b')](_0x202a93,_0x838f('0x34'));_0x4c78df[_0x838f('0x3c')]=_['keys'](_0x745939['query']);_0x4c78df[_0x838f('0x3d')]=_[_0x838f('0x3e')](_0x4c78df['model'],_0x4c78df[_0x838f('0x3c')]);_0x39ec2e[_0x838f('0x3f')]=_[_0x838f('0x3e')](_0x4c78df[_0x838f('0x3a')],qs[_0x838f('0x40')](_0x745939[_0x838f('0x3c')]['fields']));_0x39ec2e[_0x838f('0x3f')]=_0x39ec2e[_0x838f('0x3f')]['length']?_0x39ec2e['attributes']:_0x4c78df[_0x838f('0x3a')];if(!_0x745939['query'][_0x838f('0x41')]('nolimit')){_0x39ec2e[_0x838f('0x42')]=qs['limit'](_0x745939[_0x838f('0x3c')][_0x838f('0x42')]);_0x39ec2e[_0x838f('0x2c')]=qs['offset'](_0x745939[_0x838f('0x3c')][_0x838f('0x2c')]);}_0x39ec2e[_0x838f('0x43')]=qs[_0x838f('0x44')](_0x745939[_0x838f('0x3c')]['sort']);_0x39ec2e['where']=qs[_0x838f('0x3d')](_[_0x838f('0x45')](_0x745939[_0x838f('0x3c')],_0x4c78df['filters']));if(_0x745939[_0x838f('0x3c')][_0x838f('0x46')]){_0x39ec2e[_0x838f('0x47')]=_[_0x838f('0x48')](_0x39ec2e['where'],{'$or':_['map'](_0x202a93,function(_0x166caf){if(_0x166caf[_0x838f('0x38')]!==_0x838f('0x49')){var _0x21e8a6={};_0x21e8a6[_0x166caf[_0x838f('0x34')]]={'$like':'%'+_0x745939[_0x838f('0x3c')][_0x838f('0x46')]+'%'};return _0x21e8a6;}})});}_0x39ec2e=_[_0x838f('0x48')]({},_0x39ec2e,_0x745939['options']);var _0x34469d={'where':_0x39ec2e[_0x838f('0x47')]};return db[_0x838f('0x4a')][_0x838f('0x2b')](_0x34469d)[_0x838f('0x31')](function(_0x66f47e){_0x4edd2f[_0x838f('0x2b')]=_0x66f47e;if(_0x745939[_0x838f('0x3c')][_0x838f('0x4b')]){_0x39ec2e[_0x838f('0x4c')]=[{'all':!![]}];}return db[_0x838f('0x4a')][_0x838f('0x4d')](_0x39ec2e);})[_0x838f('0x31')](function(_0x5e02c2){_0x4edd2f[_0x838f('0x4e')]=_0x5e02c2;return _0x4edd2f;})[_0x838f('0x31')](respondWithFilteredResult(_0x1b4c7d,_0x39ec2e))[_0x838f('0x4f')](handleError(_0x1b4c7d,null));};exports['show']=function(_0x462361,_0x5e6f67){var _0x4f063b={'raw':![],'where':{'id':_0x462361[_0x838f('0x50')]['id']}},_0x320be6={};_0x320be6[_0x838f('0x3a')]=_[_0x838f('0x51')](db[_0x838f('0x4a')][_0x838f('0x36')]);_0x320be6[_0x838f('0x3c')]=_[_0x838f('0x51')](_0x462361['query']);_0x320be6[_0x838f('0x3d')]=_[_0x838f('0x3e')](_0x320be6['model'],_0x320be6[_0x838f('0x3c')]);_0x4f063b[_0x838f('0x3f')]=_[_0x838f('0x3e')](_0x320be6[_0x838f('0x3a')],qs[_0x838f('0x40')](_0x462361[_0x838f('0x3c')][_0x838f('0x40')]));_0x4f063b['attributes']=_0x4f063b[_0x838f('0x3f')][_0x838f('0x52')]?_0x4f063b['attributes']:_0x320be6[_0x838f('0x3a')];if(_0x462361[_0x838f('0x3c')][_0x838f('0x4b')]){_0x4f063b[_0x838f('0x4c')]=[{'all':!![]}];}_0x4f063b=_[_0x838f('0x48')]({},_0x4f063b,_0x462361[_0x838f('0x53')]);return db['SugarcrmAccount'][_0x838f('0x54')](_0x4f063b)[_0x838f('0x31')](handleEntityNotFound(_0x5e6f67,null))[_0x838f('0x31')](respondWithResult(_0x5e6f67,null))['catch'](handleError(_0x5e6f67,null));};exports[_0x838f('0x55')]=function(_0x3169c4,_0x536784){return db['SugarcrmAccount']['create'](_0x3169c4[_0x838f('0x56')],{})[_0x838f('0x31')](respondWithResult(_0x536784,0xc9))[_0x838f('0x4f')](handleError(_0x536784,null));};exports[_0x838f('0x30')]=function(_0x6a37a7,_0x4658f6){if(_0x6a37a7[_0x838f('0x56')]['id']){delete _0x6a37a7[_0x838f('0x56')]['id'];}return db[_0x838f('0x4a')][_0x838f('0x54')]({'where':{'id':_0x6a37a7[_0x838f('0x50')]['id']}})[_0x838f('0x31')](handleEntityNotFound(_0x4658f6,null))[_0x838f('0x31')](saveUpdates(_0x6a37a7[_0x838f('0x56')],null))[_0x838f('0x31')](respondWithResult(_0x4658f6,null))[_0x838f('0x4f')](handleError(_0x4658f6,null));};exports[_0x838f('0x32')]=function(_0x183a5a,_0x26fc53){return db[_0x838f('0x4a')][_0x838f('0x54')]({'where':{'id':_0x183a5a[_0x838f('0x50')]['id']}})['then'](handleEntityNotFound(_0x26fc53,null))[_0x838f('0x31')](removeEntity(_0x26fc53,null))['catch'](handleError(_0x26fc53,null));};exports[_0x838f('0x57')]=function(_0x7ea7d0,_0x2eb3d8,_0x45d2b3){var _0x4aabb9={};var _0x2c9e69={};var _0x12f9ce;var _0x44e9ad;return db[_0x838f('0x4a')]['findOne']({'where':{'id':_0x7ea7d0[_0x838f('0x50')]['id']}})[_0x838f('0x31')](handleEntityNotFound(_0x2eb3d8,null))['then'](function(_0x5affaa){if(_0x5affaa){_0x12f9ce=_0x5affaa;_0x2c9e69['model']=_[_0x838f('0x51')](db['SugarcrmConfiguration'][_0x838f('0x36')]);_0x2c9e69[_0x838f('0x3c')]=_[_0x838f('0x51')](_0x7ea7d0[_0x838f('0x3c')]);_0x2c9e69['filters']=_[_0x838f('0x3e')](_0x2c9e69[_0x838f('0x3a')],_0x2c9e69[_0x838f('0x3c')]);_0x4aabb9['attributes']=_[_0x838f('0x3e')](_0x2c9e69[_0x838f('0x3a')],qs[_0x838f('0x40')](_0x7ea7d0[_0x838f('0x3c')][_0x838f('0x40')]));_0x4aabb9[_0x838f('0x3f')]=_0x4aabb9[_0x838f('0x3f')][_0x838f('0x52')]?_0x4aabb9[_0x838f('0x3f')]:_0x2c9e69[_0x838f('0x3a')];_0x4aabb9[_0x838f('0x43')]=qs[_0x838f('0x44')](_0x7ea7d0[_0x838f('0x3c')][_0x838f('0x44')]);_0x4aabb9['where']=qs[_0x838f('0x3d')](_[_0x838f('0x45')](_0x7ea7d0[_0x838f('0x3c')],_0x2c9e69[_0x838f('0x3d')]));if(_0x7ea7d0[_0x838f('0x3c')][_0x838f('0x46')]){_0x4aabb9[_0x838f('0x47')]=_['merge'](_0x4aabb9[_0x838f('0x47')],{'$or':_[_0x838f('0x3b')](_0x4aabb9[_0x838f('0x3f')],function(_0x3def7a){var _0x2b43d8={};_0x2b43d8[_0x3def7a]={'$like':'%'+_0x7ea7d0[_0x838f('0x3c')][_0x838f('0x46')]+'%'};return _0x2b43d8;})});}_0x4aabb9=_[_0x838f('0x48')]({},_0x4aabb9,_0x7ea7d0[_0x838f('0x53')]);return _0x12f9ce[_0x838f('0x57')](_0x4aabb9);}})[_0x838f('0x31')](function(_0x55df41){if(_0x55df41){_0x44e9ad=_0x55df41[_0x838f('0x52')];if(!_0x7ea7d0[_0x838f('0x3c')][_0x838f('0x41')]('nolimit')){_0x4aabb9['limit']=qs['limit'](_0x7ea7d0[_0x838f('0x3c')]['limit']);_0x4aabb9['offset']=qs['offset'](_0x7ea7d0[_0x838f('0x3c')]['offset']);}return _0x12f9ce['getConfigurations'](_0x4aabb9);}})['then'](function(_0x5bd3f9){if(_0x5bd3f9){return _0x5bd3f9?{'count':_0x44e9ad,'rows':_0x5bd3f9}:null;}})[_0x838f('0x31')](respondWithResult(_0x2eb3d8,null))[_0x838f('0x4f')](handleError(_0x2eb3d8,null));};exports[_0x838f('0x58')]=function(_0x1042ac,_0x3d463e,_0x57020b){if(_0x1042ac['body']['id']){delete _0x1042ac[_0x838f('0x56')]['id'];}return db['SugarcrmAccount'][_0x838f('0x59')]({'where':{'id':_0x1042ac['params']['id']}})[_0x838f('0x31')](handleEntityNotFound(_0x3d463e,null))['then'](function(_0x1f6ed0){if(_0x1f6ed0){_0x1042ac[_0x838f('0x56')][_0x838f('0x5a')]=_0x1f6ed0['id'];_0x1042ac[_0x838f('0x56')][_0x838f('0x5b')]=integrations[_0x838f('0x5c')](_0x1042ac[_0x838f('0x56')][_0x838f('0x5d')],_0x1042ac[_0x838f('0x56')][_0x838f('0x38')]);_0x1042ac['body'][_0x838f('0x5e')]=integrations['getDescriptions'](_0x1042ac[_0x838f('0x56')]['channel'],_0x1042ac[_0x838f('0x56')][_0x838f('0x38')]);return db[_0x838f('0x5f')][_0x838f('0x55')](_0x1042ac[_0x838f('0x56')],{'include':[{'model':db['SugarcrmField'],'as':_0x838f('0x5b')},{'model':db[_0x838f('0x60')],'as':_0x838f('0x5e')}]});}return null;})[_0x838f('0x31')](respondWithResult(_0x3d463e,null))[_0x838f('0x4f')](handleError(_0x3d463e,null));};exports['getFields']=function(_0x3696a7,_0x2e5d2f,_0x4bfdec){var _0x5cc4ab='';var _0x3630fc=['id',_0x838f('0x34'),'assigned_user_id',_0x838f('0x61'),_0x838f('0x62'),'date_start','duration_hours',_0x838f('0x63'),'parent_id',_0x838f('0x64'),_0x838f('0x65'),_0x838f('0x66')];return db[_0x838f('0x4a')][_0x838f('0x59')]({'where':{'id':_0x3696a7[_0x838f('0x50')]['id']},'attributes':['id',_0x838f('0x67'),_0x838f('0x68'),'remoteUri']})[_0x838f('0x31')](handleEntityNotFound(_0x2e5d2f,null))['then'](function(_0x186c93){if(_0x186c93){_0x5cc4ab=_0x186c93[_0x838f('0x69')];var _0x58b039=_0x5cc4ab[_0x838f('0x6a')](-0x1);if(_0x58b039==='/'){_0x5cc4ab=_0x5cc4ab[_0x838f('0x6b')](0x0,_0x5cc4ab[_0x838f('0x6c')](_0x58b039));}return rp({'method':_0x838f('0x6d'),'uri':util['format']('%s%s',_0x5cc4ab,_0x838f('0x6e')),'json':!![],'form':{'method':_0x838f('0x6f'),'input_type':_0x838f('0x70'),'response_type':_0x838f('0x70'),'rest_data':JSON[_0x838f('0x24')]({'user_auth':{'user_name':_0x186c93[_0x838f('0x67')],'password':_0x186c93['password'],'encryption':_0x838f('0x71')},'application':_0x838f('0x72')})}});}})['then'](function(_0x572f88){if(_0x572f88&&_0x572f88[_0x838f('0x34')]!==_0x838f('0x73')&&_0x572f88[_0x838f('0x34')]!==_0x838f('0x74')){return rp({'method':_0x838f('0x6d'),'uri':util[_0x838f('0x75')](_0x838f('0x76'),_0x5cc4ab,_0x838f('0x6e')),'json':!![],'form':{'method':'get_module_fields','input_type':_0x838f('0x70'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x572f88['id'],'module_name':'Calls'})}})[_0x838f('0x31')](function(_0xfccc99){if(_0xfccc99){var _0x10b465=_[_0x838f('0x77')](_0xfccc99[_0x838f('0x78')]);_['remove'](_0x10b465,function(_0x42159b){return _0x3630fc['includes'](_0x42159b[_0x838f('0x34')]);});return{'count':_0x10b465[_0x838f('0x52')],'rows':_[_0x838f('0x3b')](_0x10b465,function(_0x3fe621){return{'id':_0x3fe621[_0x838f('0x34')],'name':_0x3fe621[_0x838f('0x79')],'custom':_[_0x838f('0x7a')](_0x3fe621[_0x838f('0x34')],'_c')?!![]:![],'options':_0x3fe621[_0x838f('0x53')]?_['map'](_['values'](_0x3fe621[_0x838f('0x53')]),function(_0x1f6455){return{'name':_0x1f6455['value'],'value':_0x1f6455[_0x838f('0x34')]};}):[]};})};}})['then'](respondWithResult(_0x2e5d2f,null))[_0x838f('0x4f')](function(_0x2aaa6f){var _0x478381=_0x3696a7[_0x838f('0x3c')]['test']?0x1f4:_0x2aaa6f[_0x838f('0x7b')]||0x1f4;logger['error'](_0x838f('0x7c'),_0x838f('0x7d'),_0x478381,JSON[_0x838f('0x24')](_0x2aaa6f));delete _0x2aaa6f[_0x838f('0x34')];if(_0x478381===0x191){_0x478381=0x190;}_0x2e5d2f['status'](_0x478381)[_0x838f('0x7e')](_0x3696a7[_0x838f('0x3c')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x2aaa6f[_0x838f('0x7b')]}:_0x2aaa6f);});}else{var _0x40c096=0x1f4;_0x2e5d2f[_0x838f('0x29')](_0x40c096)[_0x838f('0x7e')]({'message':_0x838f('0x7f'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x5727=['merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','create','body','find','destroy','findOne','getConfigurations','Subjects','channel','getDescriptions','SugarcrmConfiguration','SugarcrmField','Descriptions','getFields','created_by','date_start','duration_hours','parent_id','parent_name','direction','password','remoteUri','slice','substring','lastIndexOf','format','%s%s','login','JSON','stringify','username','PLAIN','xCALLY\x20Motion\x20Integration','POST','get_module_fields','Calls','values','remove','includes','label','value','statusCode','Wrong\x20credentials','html-pdf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','../../components/integrations/configuration','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','result','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','stack','name','send','index','map','SugarcrmAccount','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','filter','where'];(function(_0x823d62,_0x4747fc){var _0xde067c=function(_0x430efd){while(--_0x430efd){_0x823d62['push'](_0x823d62['shift']());}};_0xde067c(++_0x4747fc);}(_0x5727,0x12c));var _0x7572=function(_0x1c4a44,_0x15abd4){_0x1c4a44=_0x1c4a44-0x0;var _0x2009f5=_0x5727[_0x1c4a44];return _0x2009f5;};'use strict';var pdf=require(_0x7572('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7572('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7572('0x2'));var moment=require(_0x7572('0x3'));var BPromise=require(_0x7572('0x4'));var Mustache=require(_0x7572('0x5'));var util=require('util');var path=require('path');var sox=require(_0x7572('0x6'));var csv=require(_0x7572('0x7'));var ejs=require(_0x7572('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x7572('0x9'));var jsforce=require(_0x7572('0xa'));var deskjs=require(_0x7572('0xb'));var toCsv=require(_0x7572('0x7'));var querystring=require(_0x7572('0xc'));var Papa=require('papaparse');var Redis=require(_0x7572('0xd'));var authService=require(_0x7572('0xe'));var qs=require(_0x7572('0xf'));var as=require(_0x7572('0x10'));var hardwareService=require(_0x7572('0x11'));var logger=require(_0x7572('0x12'))('api');var utils=require(_0x7572('0x13'));var config=require('../../config/environment');var db=require(_0x7572('0x14'))['db'];var integrations=require(_0x7572('0x15'));var jayson=require('jayson/promise');var client=jayson[_0x7572('0x16')]['http']({'port':0x232a});function checkPasswordPattern(_0x4fa880,_0x94ad5f,_0x3e26df){if(_0x3e26df){var _0x4d406e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4d406e[_0x7572('0x17')](_0x94ad5f)){return _0x4fa880;}else{throw new db[(_0x7572('0x18'))][(_0x7572('0x19'))](_0x7572('0x1a'));}}else{return _0x4fa880;}}function respondWithRpcPromise(_0x3072ac,_0x231f2a,_0x36f93b,_0xbae54e){return new BPromise(function(_0x1cbb14,_0x44cc5b){var _0x38e6a0=_0xbae54e||client;return _0x38e6a0[_0x7572('0x1b')](_0x3072ac,_0x36f93b)[_0x7572('0x1c')](function(_0x299cb4){logger['info'](_0x7572('0x1d'),_0x231f2a,_0x7572('0x1e'));logger[_0x7572('0x1f')](_0x7572('0x20'),_0x231f2a,'request\x20sent',JSON['stringify'](_0x299cb4));if(_0x299cb4[_0x7572('0x21')]){if(_0x299cb4[_0x7572('0x21')][_0x7572('0x22')]===0x1f4){logger[_0x7572('0x21')](_0x7572('0x1d'),_0x231f2a,_0x299cb4[_0x7572('0x21')]['message']);return _0x44cc5b(_0x299cb4[_0x7572('0x21')]['message']);}logger['error'](_0x7572('0x1d'),_0x231f2a,_0x299cb4['error']['message']);return _0x1cbb14(_0x299cb4[_0x7572('0x21')]['message']);}else{logger['info'](_0x7572('0x1d'),_0x231f2a,_0x7572('0x1e'));_0x1cbb14(_0x299cb4[_0x7572('0x23')][_0x7572('0x24')]);}})[_0x7572('0x25')](function(_0x30aae1){logger[_0x7572('0x21')](_0x7572('0x1d'),_0x231f2a,_0x30aae1);_0x44cc5b(_0x30aae1);});});}function respondWithStatusCode(_0x38142d,_0x3dcd21){_0x3dcd21=_0x3dcd21||0xcc;return function(_0x50f71f){if(_0x50f71f){return _0x38142d[_0x7572('0x26')](_0x3dcd21);}return _0x38142d[_0x7572('0x27')](_0x3dcd21)[_0x7572('0x28')]();};}function respondWithResult(_0x132de6,_0x21450d){_0x21450d=_0x21450d||0xc8;return function(_0x12d060){if(_0x12d060){return _0x132de6[_0x7572('0x27')](_0x21450d)[_0x7572('0x29')](_0x12d060);}};}function respondWithFilteredResult(_0x16e54d,_0x3a0ccb){return function(_0x5e264a){if(_0x5e264a){var _0x2fd540=_0x5e264a[_0x7572('0x2a')],_0x25c9d5=_0x3a0ccb['offset'],_0x3df5ea=_0x3a0ccb[_0x7572('0x2b')]+_0x3a0ccb[_0x7572('0x2c')],_0x38af8b;if(_0x3df5ea>=_0x2fd540){_0x3df5ea=_0x2fd540;_0x38af8b=0xc8;}else{_0x38af8b=0xce;}_0x16e54d[_0x7572('0x27')](_0x38af8b);return _0x16e54d[_0x7572('0x2d')](_0x7572('0x2e'),_0x25c9d5+'-'+_0x3df5ea+'/'+_0x2fd540)[_0x7572('0x29')](_0x5e264a);}return null;};}function patchUpdates(_0x215b45){return function(_0x48252b){try{jsonpatch['apply'](_0x48252b,_0x215b45,!![]);}catch(_0x208cd9){return BPromise[_0x7572('0x2f')](_0x208cd9);}return _0x48252b[_0x7572('0x30')]();};}function saveUpdates(_0xe4dcf,_0x5619fe){return function(_0x1e9c58){if(_0x1e9c58){return _0x1e9c58[_0x7572('0x31')](_0xe4dcf)[_0x7572('0x1c')](function(_0x3a0529){return _0x3a0529;});}return null;};}function removeEntity(_0x1bcebd,_0x5edc73){return function(_0x3ac1a5){if(_0x3ac1a5){return _0x3ac1a5['destroy']()[_0x7572('0x1c')](function(){_0x1bcebd['status'](0xcc)[_0x7572('0x28')]();});}};}function handleEntityNotFound(_0x3a2188,_0x296d67){return function(_0x273b70){if(!_0x273b70){_0x3a2188['sendStatus'](0x194);}return _0x273b70;};}function handleError(_0xfdc11a,_0x17f805){_0x17f805=_0x17f805||0x1f4;return function(_0x1f7172){logger['error'](_0x1f7172[_0x7572('0x32')]);if(_0x1f7172[_0x7572('0x33')]){delete _0x1f7172[_0x7572('0x33')];}_0xfdc11a[_0x7572('0x27')](_0x17f805)[_0x7572('0x34')](_0x1f7172);};}exports[_0x7572('0x35')]=function(_0x3e06b7,_0x840c){var _0x19e111={},_0x2863ca={},_0x2cdd4d={'count':0x0,'rows':[]};var _0x1d5044=_[_0x7572('0x36')](db[_0x7572('0x37')]['rawAttributes'],function(_0x32ea80){return{'name':_0x32ea80['fieldName'],'type':_0x32ea80[_0x7572('0x38')][_0x7572('0x39')]};});_0x2863ca[_0x7572('0x3a')]=_[_0x7572('0x36')](_0x1d5044,_0x7572('0x33'));_0x2863ca[_0x7572('0x3b')]=_[_0x7572('0x3c')](_0x3e06b7[_0x7572('0x3b')]);_0x2863ca['filters']=_[_0x7572('0x3d')](_0x2863ca[_0x7572('0x3a')],_0x2863ca[_0x7572('0x3b')]);_0x19e111['attributes']=_[_0x7572('0x3d')](_0x2863ca[_0x7572('0x3a')],qs[_0x7572('0x3e')](_0x3e06b7[_0x7572('0x3b')][_0x7572('0x3e')]));_0x19e111[_0x7572('0x3f')]=_0x19e111[_0x7572('0x3f')][_0x7572('0x40')]?_0x19e111[_0x7572('0x3f')]:_0x2863ca[_0x7572('0x3a')];if(!_0x3e06b7['query'][_0x7572('0x41')](_0x7572('0x42'))){_0x19e111[_0x7572('0x2c')]=qs['limit'](_0x3e06b7[_0x7572('0x3b')][_0x7572('0x2c')]);_0x19e111[_0x7572('0x2b')]=qs[_0x7572('0x2b')](_0x3e06b7['query'][_0x7572('0x2b')]);}_0x19e111[_0x7572('0x43')]=qs[_0x7572('0x44')](_0x3e06b7[_0x7572('0x3b')]['sort']);_0x19e111['where']=qs[_0x7572('0x45')](_['pick'](_0x3e06b7[_0x7572('0x3b')],_0x2863ca[_0x7572('0x45')]));if(_0x3e06b7[_0x7572('0x3b')][_0x7572('0x46')]){_0x19e111[_0x7572('0x47')]=_[_0x7572('0x48')](_0x19e111[_0x7572('0x47')],{'$or':_[_0x7572('0x36')](_0x1d5044,function(_0x45f009){if(_0x45f009[_0x7572('0x38')]!==_0x7572('0x49')){var _0x49a074={};_0x49a074[_0x45f009[_0x7572('0x33')]]={'$like':'%'+_0x3e06b7[_0x7572('0x3b')][_0x7572('0x46')]+'%'};return _0x49a074;}})});}_0x19e111=_[_0x7572('0x48')]({},_0x19e111,_0x3e06b7[_0x7572('0x4a')]);var _0x2bfe7a={'where':_0x19e111[_0x7572('0x47')]};return db[_0x7572('0x37')][_0x7572('0x2a')](_0x2bfe7a)[_0x7572('0x1c')](function(_0x39f94d){_0x2cdd4d[_0x7572('0x2a')]=_0x39f94d;if(_0x3e06b7[_0x7572('0x3b')][_0x7572('0x4b')]){_0x19e111[_0x7572('0x4c')]=[{'all':!![]}];}return db[_0x7572('0x37')][_0x7572('0x4d')](_0x19e111);})['then'](function(_0x327daa){_0x2cdd4d[_0x7572('0x4e')]=_0x327daa;return _0x2cdd4d;})[_0x7572('0x1c')](respondWithFilteredResult(_0x840c,_0x19e111))[_0x7572('0x25')](handleError(_0x840c,null));};exports[_0x7572('0x4f')]=function(_0xe86117,_0x4bf782){var _0x755e4a={'raw':![],'where':{'id':_0xe86117[_0x7572('0x50')]['id']}},_0x415ed2={};_0x415ed2[_0x7572('0x3a')]=_[_0x7572('0x3c')](db['SugarcrmAccount'][_0x7572('0x51')]);_0x415ed2['query']=_[_0x7572('0x3c')](_0xe86117[_0x7572('0x3b')]);_0x415ed2[_0x7572('0x45')]=_[_0x7572('0x3d')](_0x415ed2[_0x7572('0x3a')],_0x415ed2[_0x7572('0x3b')]);_0x755e4a[_0x7572('0x3f')]=_[_0x7572('0x3d')](_0x415ed2['model'],qs['fields'](_0xe86117[_0x7572('0x3b')]['fields']));_0x755e4a[_0x7572('0x3f')]=_0x755e4a['attributes'][_0x7572('0x40')]?_0x755e4a[_0x7572('0x3f')]:_0x415ed2['model'];if(_0xe86117[_0x7572('0x3b')][_0x7572('0x4b')]){_0x755e4a[_0x7572('0x4c')]=[{'all':!![]}];}_0x755e4a=_[_0x7572('0x48')]({},_0x755e4a,_0xe86117[_0x7572('0x4a')]);return db[_0x7572('0x37')]['find'](_0x755e4a)[_0x7572('0x1c')](handleEntityNotFound(_0x4bf782,null))[_0x7572('0x1c')](respondWithResult(_0x4bf782,null))[_0x7572('0x25')](handleError(_0x4bf782,null));};exports[_0x7572('0x52')]=function(_0x292308,_0x545968){return db['SugarcrmAccount'][_0x7572('0x52')](_0x292308[_0x7572('0x53')],{})[_0x7572('0x1c')](respondWithResult(_0x545968,0xc9))[_0x7572('0x25')](handleError(_0x545968,null));};exports['update']=function(_0x10b5e0,_0x45505f){if(_0x10b5e0[_0x7572('0x53')]['id']){delete _0x10b5e0[_0x7572('0x53')]['id'];}return db['SugarcrmAccount'][_0x7572('0x54')]({'where':{'id':_0x10b5e0[_0x7572('0x50')]['id']}})[_0x7572('0x1c')](handleEntityNotFound(_0x45505f,null))['then'](saveUpdates(_0x10b5e0[_0x7572('0x53')],null))['then'](respondWithResult(_0x45505f,null))[_0x7572('0x25')](handleError(_0x45505f,null));};exports[_0x7572('0x55')]=function(_0x2d2f26,_0x4ae117){return db[_0x7572('0x37')][_0x7572('0x54')]({'where':{'id':_0x2d2f26[_0x7572('0x50')]['id']}})['then'](handleEntityNotFound(_0x4ae117,null))[_0x7572('0x1c')](removeEntity(_0x4ae117,null))[_0x7572('0x25')](handleError(_0x4ae117,null));};exports['getConfigurations']=function(_0x2375a8,_0x32ff7a,_0x4aa47d){var _0x493d2f={};var _0x4b0200={};var _0x38d99f;var _0x64726b;return db[_0x7572('0x37')][_0x7572('0x56')]({'where':{'id':_0x2375a8[_0x7572('0x50')]['id']}})[_0x7572('0x1c')](handleEntityNotFound(_0x32ff7a,null))[_0x7572('0x1c')](function(_0x59fb63){if(_0x59fb63){_0x38d99f=_0x59fb63;_0x4b0200[_0x7572('0x3a')]=_[_0x7572('0x3c')](db['SugarcrmConfiguration'][_0x7572('0x51')]);_0x4b0200[_0x7572('0x3b')]=_[_0x7572('0x3c')](_0x2375a8[_0x7572('0x3b')]);_0x4b0200[_0x7572('0x45')]=_['intersection'](_0x4b0200[_0x7572('0x3a')],_0x4b0200[_0x7572('0x3b')]);_0x493d2f['attributes']=_[_0x7572('0x3d')](_0x4b0200[_0x7572('0x3a')],qs[_0x7572('0x3e')](_0x2375a8['query']['fields']));_0x493d2f[_0x7572('0x3f')]=_0x493d2f['attributes'][_0x7572('0x40')]?_0x493d2f[_0x7572('0x3f')]:_0x4b0200[_0x7572('0x3a')];_0x493d2f[_0x7572('0x43')]=qs['sort'](_0x2375a8[_0x7572('0x3b')][_0x7572('0x44')]);_0x493d2f[_0x7572('0x47')]=qs[_0x7572('0x45')](_['pick'](_0x2375a8['query'],_0x4b0200[_0x7572('0x45')]));if(_0x2375a8['query'][_0x7572('0x46')]){_0x493d2f[_0x7572('0x47')]=_['merge'](_0x493d2f[_0x7572('0x47')],{'$or':_[_0x7572('0x36')](_0x493d2f[_0x7572('0x3f')],function(_0x3f0341){var _0x18d9a6={};_0x18d9a6[_0x3f0341]={'$like':'%'+_0x2375a8[_0x7572('0x3b')][_0x7572('0x46')]+'%'};return _0x18d9a6;})});}_0x493d2f=_[_0x7572('0x48')]({},_0x493d2f,_0x2375a8[_0x7572('0x4a')]);return _0x38d99f[_0x7572('0x57')](_0x493d2f);}})['then'](function(_0x425e05){if(_0x425e05){_0x64726b=_0x425e05[_0x7572('0x40')];if(!_0x2375a8['query'][_0x7572('0x41')](_0x7572('0x42'))){_0x493d2f['limit']=qs[_0x7572('0x2c')](_0x2375a8[_0x7572('0x3b')][_0x7572('0x2c')]);_0x493d2f[_0x7572('0x2b')]=qs['offset'](_0x2375a8[_0x7572('0x3b')]['offset']);}return _0x38d99f['getConfigurations'](_0x493d2f);}})['then'](function(_0x3015e0){if(_0x3015e0){return _0x3015e0?{'count':_0x64726b,'rows':_0x3015e0}:null;}})['then'](respondWithResult(_0x32ff7a,null))[_0x7572('0x25')](handleError(_0x32ff7a,null));};exports['addConfiguration']=function(_0x2692df,_0x2feb57,_0xadc488){if(_0x2692df[_0x7572('0x53')]['id']){delete _0x2692df[_0x7572('0x53')]['id'];}return db['SugarcrmAccount'][_0x7572('0x56')]({'where':{'id':_0x2692df['params']['id']}})[_0x7572('0x1c')](handleEntityNotFound(_0x2feb57,null))[_0x7572('0x1c')](function(_0x40c5fb){if(_0x40c5fb){_0x2692df[_0x7572('0x53')]['AccountId']=_0x40c5fb['id'];_0x2692df[_0x7572('0x53')][_0x7572('0x58')]=integrations['getSubjects'](_0x2692df['body'][_0x7572('0x59')],_0x2692df['body']['type']);_0x2692df[_0x7572('0x53')]['Descriptions']=integrations[_0x7572('0x5a')](_0x2692df[_0x7572('0x53')][_0x7572('0x59')],_0x2692df[_0x7572('0x53')][_0x7572('0x38')]);return db[_0x7572('0x5b')][_0x7572('0x52')](_0x2692df[_0x7572('0x53')],{'include':[{'model':db['SugarcrmField'],'as':'Subjects'},{'model':db[_0x7572('0x5c')],'as':_0x7572('0x5d')}]});}return null;})['then'](respondWithResult(_0x2feb57,null))[_0x7572('0x25')](handleError(_0x2feb57,null));};exports[_0x7572('0x5e')]=function(_0x2baff9,_0x2aae81,_0x455f6d){var _0xeef6ae='';var _0x3174d9=['id',_0x7572('0x33'),'assigned_user_id',_0x7572('0x5f'),'description',_0x7572('0x60'),_0x7572('0x61'),'duration_minutes',_0x7572('0x62'),'parent_type',_0x7572('0x63'),_0x7572('0x64')];return db[_0x7572('0x37')][_0x7572('0x56')]({'where':{'id':_0x2baff9[_0x7572('0x50')]['id']},'attributes':['id','username',_0x7572('0x65'),_0x7572('0x66')]})[_0x7572('0x1c')](handleEntityNotFound(_0x2aae81,null))[_0x7572('0x1c')](function(_0xeddaa2){if(_0xeddaa2){_0xeef6ae=_0xeddaa2['remoteUri'];var _0x5e8207=_0xeef6ae[_0x7572('0x67')](-0x1);if(_0x5e8207==='/'){_0xeef6ae=_0xeef6ae[_0x7572('0x68')](0x0,_0xeef6ae[_0x7572('0x69')](_0x5e8207));}return rp({'method':'POST','uri':util[_0x7572('0x6a')](_0x7572('0x6b'),_0xeef6ae,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x7572('0x6c'),'input_type':_0x7572('0x6d'),'response_type':_0x7572('0x6d'),'rest_data':JSON[_0x7572('0x6e')]({'user_auth':{'user_name':_0xeddaa2[_0x7572('0x6f')],'password':_0xeddaa2[_0x7572('0x65')],'encryption':_0x7572('0x70')},'application':_0x7572('0x71')})}});}})[_0x7572('0x1c')](function(_0x3224f3){if(_0x3224f3&&_0x3224f3[_0x7572('0x33')]!=='Invalid\x20Login'&&_0x3224f3['name']!=='Password\x20Expired'){return rp({'method':_0x7572('0x72'),'uri':util[_0x7572('0x6a')](_0x7572('0x6b'),_0xeef6ae,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x7572('0x73'),'input_type':'JSON','response_type':_0x7572('0x6d'),'rest_data':JSON[_0x7572('0x6e')]({'session':_0x3224f3['id'],'module_name':_0x7572('0x74')})}})[_0x7572('0x1c')](function(_0x41e07f){if(_0x41e07f){var _0x3758b1=_[_0x7572('0x75')](_0x41e07f['module_fields']);_[_0x7572('0x76')](_0x3758b1,function(_0x424643){return _0x3174d9[_0x7572('0x77')](_0x424643[_0x7572('0x33')]);});return{'count':_0x3758b1[_0x7572('0x40')],'rows':_[_0x7572('0x36')](_0x3758b1,function(_0x5a6242){return{'id':_0x5a6242['name'],'name':_0x5a6242[_0x7572('0x78')],'custom':_['endsWith'](_0x5a6242['name'],'_c')?!![]:![],'options':_0x5a6242[_0x7572('0x4a')]?_[_0x7572('0x36')](_[_0x7572('0x75')](_0x5a6242[_0x7572('0x4a')]),function(_0x1e2e03){return{'name':_0x1e2e03[_0x7572('0x79')],'value':_0x1e2e03[_0x7572('0x33')]};}):[]};})};}})[_0x7572('0x1c')](respondWithResult(_0x2aae81,null))[_0x7572('0x25')](function(_0x4421e4){var _0x2d6e06=_0x2baff9[_0x7572('0x3b')][_0x7572('0x17')]?0x1f4:_0x4421e4[_0x7572('0x7a')]||0x1f4;logger[_0x7572('0x21')]('getFields,\x20%s,\x20%s,\x20%s',_0x7572('0x5e'),_0x2d6e06,JSON[_0x7572('0x6e')](_0x4421e4));delete _0x4421e4[_0x7572('0x33')];if(_0x2d6e06===0x191){_0x2d6e06=0x190;}_0x2aae81[_0x7572('0x27')](_0x2d6e06)[_0x7572('0x34')](_0x2baff9[_0x7572('0x3b')][_0x7572('0x17')]?{'message':_0x7572('0x7b'),'statusCode':_0x4421e4[_0x7572('0x7a')]}:_0x4421e4);});}else{var _0x519642=0x1f4;_0x2aae81[_0x7572('0x27')](_0x519642)['send']({'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 273930d..a92d6f8 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 _0x2083=['path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4078c8,_0x1d7bba){var _0x1e7acb=function(_0xf13efe){while(--_0xf13efe){_0x4078c8['push'](_0x4078c8['shift']());}};_0x1e7acb(++_0x1d7bba);}(_0x2083,0x153));var _0x3208=function(_0x2d6d7b,_0x183ff8){_0x2d6d7b=_0x2d6d7b-0x0;var _0x4372c5=_0x2083[_0x2d6d7b];return _0x4372c5;};'use strict';var _=require(_0x3208('0x0'));var util=require(_0x3208('0x1'));var logger=require(_0x3208('0x2'))(_0x3208('0x3'));var moment=require(_0x3208('0x4'));var BPromise=require(_0x3208('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3208('0x6'));var rimraf=require(_0x3208('0x7'));var config=require(_0x3208('0x8'));var attributes=require(_0x3208('0x9'));var integrations=require(_0x3208('0xa'));module[_0x3208('0xb')]=function(_0x244933,_0x5a1924){return _0x244933[_0x3208('0xc')](_0x3208('0xd'),attributes,{'tableName':_0x3208('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb17f=['rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x7c4037,_0x4e7dbc){var _0x3e9366=function(_0x13587a){while(--_0x13587a){_0x7c4037['push'](_0x7c4037['shift']());}};_0x3e9366(++_0x4e7dbc);}(_0xb17f,0xcc));var _0xfb17=function(_0x89e678,_0x3c8809){_0x89e678=_0x89e678-0x0;var _0x42e4a5=_0xb17f[_0x89e678];return _0x42e4a5;};'use strict';var _=require(_0xfb17('0x0'));var util=require(_0xfb17('0x1'));var logger=require(_0xfb17('0x2'))(_0xfb17('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfb17('0x4'));var fs=require('fs');var path=require(_0xfb17('0x5'));var rimraf=require(_0xfb17('0x6'));var config=require(_0xfb17('0x7'));var attributes=require(_0xfb17('0x8'));var integrations=require(_0xfb17('0x9'));module[_0xfb17('0xa')]=function(_0x3fba35,_0x4c8b1f){return _0x3fba35[_0xfb17('0xb')](_0xfb17('0xc'),attributes,{'tableName':_0xfb17('0xd'),'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 ce75f59..e724bc3 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 _0xf15f=['rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','SugarcrmAccount,\x20%s,\x20%s','message','result','catch','options','where','attributes','limit','include','model','then','GetSugarcrmAccount','ShowSugarcrmAccount','SugarcrmAccount','find','map','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1c9cfb,_0x4efc3b){var _0x32436a=function(_0x6836da){while(--_0x6836da){_0x1c9cfb['push'](_0x1c9cfb['shift']());}};_0x32436a(++_0x4efc3b);}(_0xf15f,0x160));var _0xff15=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xf15f[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xff15('0x0'));var util=require(_0xff15('0x1'));var moment=require('moment');var BPromise=require(_0xff15('0x2'));var rs=require(_0xff15('0x3'));var fs=require('fs');var Redis=require(_0xff15('0x4'));var db=require(_0xff15('0x5'))['db'];var utils=require(_0xff15('0x6'));var logger=require(_0xff15('0x7'))(_0xff15('0x8'));var config=require(_0xff15('0x9'));var jayson=require(_0xff15('0xa'));var client=jayson[_0xff15('0xb')][_0xff15('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xfd2c09,_0x17b9af,_0x733af3){return new BPromise(function(_0x46a491,_0x4db6eb){return client[_0xff15('0xd')](_0xfd2c09,_0x733af3)['then'](function(_0x333ef8){logger[_0xff15('0xe')]('SugarcrmAccount,\x20%s,\x20%s',_0x17b9af,_0xff15('0xf'));logger[_0xff15('0x10')](_0xff15('0x11'),_0x17b9af,'request\x20sent',JSON[_0xff15('0x12')](_0x333ef8));if(_0x333ef8['error']){if(_0x333ef8[_0xff15('0x13')]['code']===0x1f4){logger['error'](_0xff15('0x14'),_0x17b9af,_0x333ef8[_0xff15('0x13')][_0xff15('0x15')]);return _0x4db6eb(_0x333ef8[_0xff15('0x13')][_0xff15('0x15')]);}logger[_0xff15('0x13')](_0xff15('0x14'),_0x17b9af,_0x333ef8[_0xff15('0x13')][_0xff15('0x15')]);return _0x46a491(_0x333ef8[_0xff15('0x13')][_0xff15('0x15')]);}else{logger['info'](_0xff15('0x14'),_0x17b9af,_0xff15('0xf'));_0x46a491(_0x333ef8[_0xff15('0x16')][_0xff15('0x15')]);}})[_0xff15('0x17')](function(_0x384114){logger[_0xff15('0x13')](_0xff15('0x14'),_0x17b9af,_0x384114);_0x4db6eb(_0x384114);});});}exports['GetSugarcrmAccount']=function(_0x5e9996){var _0xd5bbe3=this;return new Promise(function(_0x1c15e0,_0x287b22){return db['SugarcrmAccount']['findAll']({'raw':_0x5e9996[_0xff15('0x18')]?_0x5e9996['options']['raw']===undefined?!![]:![]:!![],'where':_0x5e9996[_0xff15('0x18')]?_0x5e9996[_0xff15('0x18')][_0xff15('0x19')]||null:null,'attributes':_0x5e9996['options']?_0x5e9996[_0xff15('0x18')][_0xff15('0x1a')]||null:null,'limit':_0x5e9996[_0xff15('0x18')]?_0x5e9996[_0xff15('0x18')][_0xff15('0x1b')]||null:null,'include':_0x5e9996[_0xff15('0x18')]?_0x5e9996[_0xff15('0x18')]['include']?_['map'](_0x5e9996[_0xff15('0x18')][_0xff15('0x1c')],function(_0xdb0817){return{'model':db[_0xdb0817[_0xff15('0x1d')]],'as':_0xdb0817['as'],'attributes':_0xdb0817[_0xff15('0x1a')],'include':_0xdb0817[_0xff15('0x1c')]?_['map'](_0xdb0817[_0xff15('0x1c')],function(_0x4b4aa6){return{'model':db[_0x4b4aa6[_0xff15('0x1d')]],'as':_0x4b4aa6['as'],'attributes':_0x4b4aa6[_0xff15('0x1a')],'include':_0x4b4aa6['include']?_['map'](_0x4b4aa6[_0xff15('0x1c')],function(_0x164976){return{'model':db[_0x164976[_0xff15('0x1d')]],'as':_0x164976['as'],'attributes':_0x164976['attributes']};}):[]};}):[]};}):[]:[]})[_0xff15('0x1e')](function(_0x5880ff){logger[_0xff15('0xe')](_0xff15('0x1f'),_0x5e9996);logger['debug'](_0xff15('0x1f'),_0x5e9996,JSON[_0xff15('0x12')](_0x5880ff));_0x1c15e0(_0x5880ff);})['catch'](function(_0x4ea52e){logger[_0xff15('0x13')](_0xff15('0x1f'),_0x4ea52e[_0xff15('0x15')],_0x5e9996);_0x287b22(_0xd5bbe3[_0xff15('0x13')](0x1f4,_0x4ea52e['message']));});});};exports[_0xff15('0x20')]=function(_0x2225e5){var _0x10f58a=this;return new Promise(function(_0x26b3bd,_0x52e08f){return db[_0xff15('0x21')][_0xff15('0x22')]({'raw':_0x2225e5[_0xff15('0x18')]?_0x2225e5[_0xff15('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2225e5['options']?_0x2225e5[_0xff15('0x18')][_0xff15('0x19')]||null:null,'attributes':_0x2225e5[_0xff15('0x18')]?_0x2225e5[_0xff15('0x18')][_0xff15('0x1a')]||null:null,'include':_0x2225e5[_0xff15('0x18')]?_0x2225e5['options']['include']?_[_0xff15('0x23')](_0x2225e5[_0xff15('0x18')][_0xff15('0x1c')],function(_0x74585){return{'model':db[_0x74585[_0xff15('0x1d')]],'as':_0x74585['as'],'attributes':_0x74585[_0xff15('0x1a')],'include':_0x74585['include']?_['map'](_0x74585[_0xff15('0x1c')],function(_0x1fd752){return{'model':db[_0x1fd752['model']],'as':_0x1fd752['as'],'attributes':_0x1fd752[_0xff15('0x1a')],'include':_0x1fd752[_0xff15('0x1c')]?_[_0xff15('0x23')](_0x1fd752['include'],function(_0x3fcf4b){return{'model':db[_0x3fcf4b[_0xff15('0x1d')]],'as':_0x3fcf4b['as'],'attributes':_0x3fcf4b[_0xff15('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xff15('0x1e')](function(_0x4c8f59){logger['info'](_0xff15('0x20'),_0x2225e5);logger[_0xff15('0x10')](_0xff15('0x20'),_0x2225e5,JSON[_0xff15('0x12')](_0x4c8f59));_0x26b3bd(_0x4c8f59);})[_0xff15('0x17')](function(_0x3fca8d){logger[_0xff15('0x13')](_0xff15('0x20'),_0x3fca8d[_0xff15('0x15')],_0x2225e5);_0x52e08f(_0x10f58a[_0xff15('0x13')](0x1f4,_0x3fca8d[_0xff15('0x15')]));});});}; \ No newline at end of file +var _0xdf60=['limit','include','model','map','then','GetSugarcrmAccount','catch','ShowSugarcrmAccount','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http','request','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','findAll','options','raw','where','attributes'];(function(_0x9cfe28,_0x1a335c){var _0x54a1d0=function(_0x46bc02){while(--_0x46bc02){_0x9cfe28['push'](_0x9cfe28['shift']());}};_0x54a1d0(++_0x1a335c);}(_0xdf60,0x15d));var _0x0df6=function(_0x3a345f,_0x493626){_0x3a345f=_0x3a345f-0x0;var _0x13d69f=_0xdf60[_0x3a345f];return _0x13d69f;};'use strict';var _=require('lodash');var util=require(_0x0df6('0x0'));var moment=require(_0x0df6('0x1'));var BPromise=require(_0x0df6('0x2'));var rs=require(_0x0df6('0x3'));var fs=require('fs');var Redis=require(_0x0df6('0x4'));var db=require(_0x0df6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0df6('0x6'))(_0x0df6('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0df6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x9d2cfd,_0x499de5,_0x105fd5){return new BPromise(function(_0x51c3f2,_0x55d5cf){return client[_0x0df6('0x9')](_0x9d2cfd,_0x105fd5)['then'](function(_0xef6d83){logger['info'](_0x0df6('0xa'),_0x499de5,_0x0df6('0xb'));logger[_0x0df6('0xc')](_0x0df6('0xd'),_0x499de5,_0x0df6('0xb'),JSON[_0x0df6('0xe')](_0xef6d83));if(_0xef6d83[_0x0df6('0xf')]){if(_0xef6d83[_0x0df6('0xf')][_0x0df6('0x10')]===0x1f4){logger['error'](_0x0df6('0xa'),_0x499de5,_0xef6d83['error'][_0x0df6('0x11')]);return _0x55d5cf(_0xef6d83[_0x0df6('0xf')][_0x0df6('0x11')]);}logger[_0x0df6('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x499de5,_0xef6d83[_0x0df6('0xf')][_0x0df6('0x11')]);return _0x51c3f2(_0xef6d83[_0x0df6('0xf')]['message']);}else{logger[_0x0df6('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x499de5,_0x0df6('0xb'));_0x51c3f2(_0xef6d83[_0x0df6('0x13')][_0x0df6('0x11')]);}})['catch'](function(_0x4f217d){logger[_0x0df6('0xf')](_0x0df6('0xa'),_0x499de5,_0x4f217d);_0x55d5cf(_0x4f217d);});});}exports['GetSugarcrmAccount']=function(_0x1a96f6){var _0x4a67ef=this;return new Promise(function(_0x22efbc,_0x456815){return db['SugarcrmAccount'][_0x0df6('0x14')]({'raw':_0x1a96f6[_0x0df6('0x15')]?_0x1a96f6[_0x0df6('0x15')][_0x0df6('0x16')]===undefined?!![]:![]:!![],'where':_0x1a96f6[_0x0df6('0x15')]?_0x1a96f6[_0x0df6('0x15')][_0x0df6('0x17')]||null:null,'attributes':_0x1a96f6[_0x0df6('0x15')]?_0x1a96f6[_0x0df6('0x15')][_0x0df6('0x18')]||null:null,'limit':_0x1a96f6[_0x0df6('0x15')]?_0x1a96f6[_0x0df6('0x15')][_0x0df6('0x19')]||null:null,'include':_0x1a96f6[_0x0df6('0x15')]?_0x1a96f6[_0x0df6('0x15')][_0x0df6('0x1a')]?_['map'](_0x1a96f6[_0x0df6('0x15')][_0x0df6('0x1a')],function(_0x5823a8){return{'model':db[_0x5823a8[_0x0df6('0x1b')]],'as':_0x5823a8['as'],'attributes':_0x5823a8[_0x0df6('0x18')],'include':_0x5823a8[_0x0df6('0x1a')]?_[_0x0df6('0x1c')](_0x5823a8[_0x0df6('0x1a')],function(_0x580593){return{'model':db[_0x580593[_0x0df6('0x1b')]],'as':_0x580593['as'],'attributes':_0x580593[_0x0df6('0x18')],'include':_0x580593[_0x0df6('0x1a')]?_[_0x0df6('0x1c')](_0x580593[_0x0df6('0x1a')],function(_0x573445){return{'model':db[_0x573445['model']],'as':_0x573445['as'],'attributes':_0x573445[_0x0df6('0x18')]};}):[]};}):[]};}):[]:[]})[_0x0df6('0x1d')](function(_0x2fe800){logger[_0x0df6('0x12')](_0x0df6('0x1e'),_0x1a96f6);logger[_0x0df6('0xc')](_0x0df6('0x1e'),_0x1a96f6,JSON[_0x0df6('0xe')](_0x2fe800));_0x22efbc(_0x2fe800);})[_0x0df6('0x1f')](function(_0x10baac){logger['error'](_0x0df6('0x1e'),_0x10baac[_0x0df6('0x11')],_0x1a96f6);_0x456815(_0x4a67ef[_0x0df6('0xf')](0x1f4,_0x10baac[_0x0df6('0x11')]));});});};exports[_0x0df6('0x20')]=function(_0x4bfa9e){var _0x46778b=this;return new Promise(function(_0x165597,_0x56e559){return db['SugarcrmAccount'][_0x0df6('0x21')]({'raw':_0x4bfa9e[_0x0df6('0x15')]?_0x4bfa9e[_0x0df6('0x15')][_0x0df6('0x16')]===undefined?!![]:![]:!![],'where':_0x4bfa9e[_0x0df6('0x15')]?_0x4bfa9e[_0x0df6('0x15')][_0x0df6('0x17')]||null:null,'attributes':_0x4bfa9e['options']?_0x4bfa9e['options']['attributes']||null:null,'include':_0x4bfa9e[_0x0df6('0x15')]?_0x4bfa9e['options'][_0x0df6('0x1a')]?_['map'](_0x4bfa9e[_0x0df6('0x15')]['include'],function(_0xce9be4){return{'model':db[_0xce9be4['model']],'as':_0xce9be4['as'],'attributes':_0xce9be4[_0x0df6('0x18')],'include':_0xce9be4[_0x0df6('0x1a')]?_[_0x0df6('0x1c')](_0xce9be4['include'],function(_0x43672b){return{'model':db[_0x43672b[_0x0df6('0x1b')]],'as':_0x43672b['as'],'attributes':_0x43672b[_0x0df6('0x18')],'include':_0x43672b[_0x0df6('0x1a')]?_[_0x0df6('0x1c')](_0x43672b[_0x0df6('0x1a')],function(_0x57ee20){return{'model':db[_0x57ee20[_0x0df6('0x1b')]],'as':_0x57ee20['as'],'attributes':_0x57ee20[_0x0df6('0x18')]};}):[]};}):[]};}):[]:[]})[_0x0df6('0x1d')](function(_0x4879bb){logger[_0x0df6('0x12')]('ShowSugarcrmAccount',_0x4bfa9e);logger[_0x0df6('0xc')]('ShowSugarcrmAccount',_0x4bfa9e,JSON[_0x0df6('0xe')](_0x4879bb));_0x165597(_0x4879bb);})[_0x0df6('0x1f')](function(_0x40dfde){logger[_0x0df6('0xf')](_0x0df6('0x20'),_0x40dfde[_0x0df6('0x11')],_0x4bfa9e);_0x56e559(_0x46778b[_0x0df6('0xf')](0x1f4,_0x40dfde[_0x0df6('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 961c08a..bd78cea 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 _0x480b=['/:id/fields','getFields','getDescriptions','put','delete','destroy','exports','path','Router','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','isAuthenticated','index','get','/:id'];(function(_0x49d21f,_0x6e7f5){var _0x1b93f2=function(_0x1cd8e7){while(--_0x1cd8e7){_0x49d21f['push'](_0x49d21f['shift']());}};_0x1b93f2(++_0x6e7f5);}(_0x480b,0x177));var _0xb480=function(_0x5aeaa2,_0x431b8b){_0x5aeaa2=_0x5aeaa2-0x0;var _0x224ec2=_0x480b[_0x5aeaa2];return _0x224ec2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb480('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb480('0x1')]();var auth=require(_0xb480('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xb480('0x3'));var controller=require(_0xb480('0x4'));router['get']('/',auth[_0xb480('0x5')](),controller[_0xb480('0x6')]);router[_0xb480('0x7')](_0xb480('0x8'),auth['isAuthenticated'](),controller['show']);router[_0xb480('0x7')](_0xb480('0x9'),auth[_0xb480('0x5')](),controller[_0xb480('0xa')]);router[_0xb480('0x7')]('/:id/subjects',auth[_0xb480('0x5')](),controller['getSubjects']);router[_0xb480('0x7')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xb480('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xb480('0xc')](_0xb480('0x8'),auth['isAuthenticated'](),controller['update']);router[_0xb480('0xd')](_0xb480('0x8'),auth[_0xb480('0x5')](),controller[_0xb480('0xe')]);module[_0xb480('0xf')]=router; \ No newline at end of file +var _0xa153=['/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','path','express','../../components/interaction/service','get','index','/:id','isAuthenticated','show','getFields','/:id/subjects','getSubjects'];(function(_0x2706da,_0x3856f5){var _0x3ba87e=function(_0x479a79){while(--_0x479a79){_0x2706da['push'](_0x2706da['shift']());}};_0x3ba87e(++_0x3856f5);}(_0xa153,0xb3));var _0x3a15=function(_0x54cf5e,_0xaa57c5){_0x54cf5e=_0x54cf5e-0x0;var _0x179169=_0xa153[_0x54cf5e];return _0x179169;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3a15('0x0'));var timeout=require('connect-timeout');var express=require(_0x3a15('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x3a15('0x2'));var config=require('../../config/environment');var controller=require('./intSugarcrmConfiguration.controller');router[_0x3a15('0x3')]('/',auth['isAuthenticated'](),controller[_0x3a15('0x4')]);router[_0x3a15('0x3')](_0x3a15('0x5'),auth[_0x3a15('0x6')](),controller[_0x3a15('0x7')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x3a15('0x8')]);router['get'](_0x3a15('0x9'),auth[_0x3a15('0x6')](),controller[_0x3a15('0xa')]);router[_0x3a15('0x3')](_0x3a15('0xb'),auth[_0x3a15('0x6')](),controller[_0x3a15('0xc')]);router[_0x3a15('0xd')]('/',auth[_0x3a15('0x6')](),controller[_0x3a15('0xe')]);router['put']('/:id',auth[_0x3a15('0x6')](),controller[_0x3a15('0xf')]);router[_0x3a15('0x10')](_0x3a15('0x5'),auth[_0x3a15('0x6')](),controller[_0x3a15('0x11')]);module[_0x3a15('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index fc2e911..cde039f 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 _0x443c=['STRING','sequelize','exports'];(function(_0x30b367,_0x2cd6c3){var _0x7f99ef=function(_0x1d53bc){while(--_0x1d53bc){_0x30b367['push'](_0x30b367['shift']());}};_0x7f99ef(++_0x2cd6c3);}(_0x443c,0x199));var _0xc443=function(_0xc56c3,_0x3f6ba2){_0xc56c3=_0xc56c3-0x0;var _0x6fabbb=_0x443c[_0xc56c3];return _0x6fabbb;};'use strict';var Sequelize=require(_0xc443('0x0'));module[_0xc443('0x1')]={'name':{'type':Sequelize[_0xc443('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x17d9=['sequelize','exports','STRING'];(function(_0x173f10,_0x35db61){var _0x53142d=function(_0x37bbef){while(--_0x37bbef){_0x173f10['push'](_0x173f10['shift']());}};_0x53142d(++_0x35db61);}(_0x17d9,0xb1));var _0x917d=function(_0x50f392,_0x1d8441){_0x50f392=_0x50f392-0x0;var _0x5926f2=_0x17d9[_0x50f392];return _0x5926f2;};'use strict';var Sequelize=require(_0x917d('0x0'));module[_0x917d('0x1')]={'name':{'type':Sequelize[_0x917d('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index cf4aa15..80a93e2 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 _0x8962=['http','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','count','limit','set','Content-Range','reject','update','destroy','end','name','send','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','query','model','intersection','fields','attributes','hasOwnProperty','nolimit','offset','order','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','keys','length','includeAll','find','create','body','getFields','findOne','SugarcrmField','sort','pick','getSubjects','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client'];(function(_0x17f62a,_0x278b44){var _0xf10db0=function(_0x3b9423){while(--_0x3b9423){_0x17f62a['push'](_0x17f62a['shift']());}};_0xf10db0(++_0x278b44);}(_0x8962,0xfe));var _0x2896=function(_0x564570,_0x3a5122){_0x564570=_0x564570-0x0;var _0x4c0155=_0x8962[_0x564570];return _0x4c0155;};'use strict';var pdf=require(_0x2896('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2896('0x1'));var zipdir=require(_0x2896('0x2'));var jsonpatch=require(_0x2896('0x3'));var rp=require(_0x2896('0x4'));var moment=require(_0x2896('0x5'));var BPromise=require(_0x2896('0x6'));var Mustache=require(_0x2896('0x7'));var util=require('util');var path=require(_0x2896('0x8'));var sox=require(_0x2896('0x9'));var csv=require('to-csv');var ejs=require(_0x2896('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2896('0xb'));var crypto=require(_0x2896('0xc'));var jsforce=require(_0x2896('0xd'));var deskjs=require(_0x2896('0xe'));var toCsv=require(_0x2896('0xf'));var querystring=require(_0x2896('0x10'));var Papa=require(_0x2896('0x11'));var Redis=require(_0x2896('0x12'));var authService=require(_0x2896('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2896('0x14'));var hardwareService=require(_0x2896('0x15'));var logger=require('../../config/logger')(_0x2896('0x16'));var utils=require(_0x2896('0x17'));var config=require(_0x2896('0x18'));var db=require(_0x2896('0x19'))['db'];var jayson=require(_0x2896('0x1a'));var client=jayson[_0x2896('0x1b')][_0x2896('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x53379c,_0x4e1e86,_0x1c7a6f){if(_0x1c7a6f){var _0x50a89a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x50a89a['test'](_0x4e1e86)){return _0x53379c;}else{throw new db[(_0x2896('0x1d'))]['ValidationError'](_0x2896('0x1e'));}}else{return _0x53379c;}}function respondWithRpcPromise(_0xcfe48c,_0xeb677c,_0x214f9d,_0x3e7f03){return new BPromise(function(_0xb117bc,_0x205961){var _0x284fc3=_0x3e7f03||client;return _0x284fc3[_0x2896('0x1f')](_0xcfe48c,_0x214f9d)[_0x2896('0x20')](function(_0x412727){logger['info'](_0x2896('0x21'),_0xeb677c,_0x2896('0x22'));logger['debug'](_0x2896('0x23'),_0xeb677c,_0x2896('0x22'),JSON[_0x2896('0x24')](_0x412727));if(_0x412727[_0x2896('0x25')]){if(_0x412727[_0x2896('0x25')][_0x2896('0x26')]===0x1f4){logger[_0x2896('0x25')](_0x2896('0x21'),_0xeb677c,_0x412727[_0x2896('0x25')][_0x2896('0x27')]);return _0x205961(_0x412727[_0x2896('0x25')][_0x2896('0x27')]);}logger[_0x2896('0x25')](_0x2896('0x21'),_0xeb677c,_0x412727[_0x2896('0x25')][_0x2896('0x27')]);return _0xb117bc(_0x412727[_0x2896('0x25')][_0x2896('0x27')]);}else{logger[_0x2896('0x28')](_0x2896('0x21'),_0xeb677c,_0x2896('0x22'));_0xb117bc(_0x412727[_0x2896('0x29')][_0x2896('0x27')]);}})[_0x2896('0x2a')](function(_0x9bb69c){logger[_0x2896('0x25')](_0x2896('0x21'),_0xeb677c,_0x9bb69c);_0x205961(_0x9bb69c);});});}function respondWithStatusCode(_0x44cb33,_0xb055a){_0xb055a=_0xb055a||0xcc;return function(_0x1ccd0d){if(_0x1ccd0d){return _0x44cb33[_0x2896('0x2b')](_0xb055a);}return _0x44cb33[_0x2896('0x2c')](_0xb055a)['end']();};}function respondWithResult(_0x560302,_0xba82){_0xba82=_0xba82||0xc8;return function(_0x4ca252){if(_0x4ca252){return _0x560302[_0x2896('0x2c')](_0xba82)['json'](_0x4ca252);}};}function respondWithFilteredResult(_0x3d4e12,_0x1838ce){return function(_0x37d1bf){if(_0x37d1bf){var _0x1ec15e=_0x37d1bf[_0x2896('0x2d')],_0x25574b=_0x1838ce['offset'],_0x5007c7=_0x1838ce['offset']+_0x1838ce[_0x2896('0x2e')],_0x17dc3b;if(_0x5007c7>=_0x1ec15e){_0x5007c7=_0x1ec15e;_0x17dc3b=0xc8;}else{_0x17dc3b=0xce;}_0x3d4e12[_0x2896('0x2c')](_0x17dc3b);return _0x3d4e12[_0x2896('0x2f')](_0x2896('0x30'),_0x25574b+'-'+_0x5007c7+'/'+_0x1ec15e)['json'](_0x37d1bf);}return null;};}function patchUpdates(_0x4b9723){return function(_0x5a324a){try{jsonpatch['apply'](_0x5a324a,_0x4b9723,!![]);}catch(_0x2086b4){return BPromise[_0x2896('0x31')](_0x2086b4);}return _0x5a324a['save']();};}function saveUpdates(_0x1a702c,_0xccd0ba){return function(_0x2bb354){if(_0x2bb354){return _0x2bb354[_0x2896('0x32')](_0x1a702c)['then'](function(_0xc89de7){return _0xc89de7;});}return null;};}function removeEntity(_0x587349,_0x3e6210){return function(_0x381d2b){if(_0x381d2b){return _0x381d2b[_0x2896('0x33')]()['then'](function(){_0x587349['status'](0xcc)[_0x2896('0x34')]();});}};}function handleEntityNotFound(_0x1d1272,_0x41fc06){return function(_0x1303af){if(!_0x1303af){_0x1d1272[_0x2896('0x2b')](0x194);}return _0x1303af;};}function handleError(_0xe68f20,_0x40f263){_0x40f263=_0x40f263||0x1f4;return function(_0x36406d){logger[_0x2896('0x25')](_0x36406d['stack']);if(_0x36406d[_0x2896('0x35')]){delete _0x36406d[_0x2896('0x35')];}_0xe68f20[_0x2896('0x2c')](_0x40f263)[_0x2896('0x36')](_0x36406d);};}exports['index']=function(_0x2d8ab8,_0x5acf62){var _0x1f511d={},_0x2b35b9={},_0x186bf4={'count':0x0,'rows':[]};var _0x198614=_[_0x2896('0x37')](db[_0x2896('0x38')][_0x2896('0x39')],function(_0x31ee72){return{'name':_0x31ee72[_0x2896('0x3a')],'type':_0x31ee72[_0x2896('0x3b')][_0x2896('0x3c')]};});_0x2b35b9['model']=_[_0x2896('0x37')](_0x198614,_0x2896('0x35'));_0x2b35b9[_0x2896('0x3d')]=_['keys'](_0x2d8ab8[_0x2896('0x3d')]);_0x2b35b9['filters']=_['intersection'](_0x2b35b9[_0x2896('0x3e')],_0x2b35b9[_0x2896('0x3d')]);_0x1f511d['attributes']=_[_0x2896('0x3f')](_0x2b35b9[_0x2896('0x3e')],qs[_0x2896('0x40')](_0x2d8ab8[_0x2896('0x3d')][_0x2896('0x40')]));_0x1f511d[_0x2896('0x41')]=_0x1f511d[_0x2896('0x41')]['length']?_0x1f511d[_0x2896('0x41')]:_0x2b35b9[_0x2896('0x3e')];if(!_0x2d8ab8[_0x2896('0x3d')][_0x2896('0x42')](_0x2896('0x43'))){_0x1f511d[_0x2896('0x2e')]=qs[_0x2896('0x2e')](_0x2d8ab8['query'][_0x2896('0x2e')]);_0x1f511d[_0x2896('0x44')]=qs[_0x2896('0x44')](_0x2d8ab8['query']['offset']);}_0x1f511d[_0x2896('0x45')]=qs['sort'](_0x2d8ab8[_0x2896('0x3d')]['sort']);_0x1f511d[_0x2896('0x46')]=qs['filters'](_['pick'](_0x2d8ab8['query'],_0x2b35b9[_0x2896('0x47')]));if(_0x2d8ab8[_0x2896('0x3d')][_0x2896('0x48')]){_0x1f511d[_0x2896('0x46')]=_[_0x2896('0x49')](_0x1f511d[_0x2896('0x46')],{'$or':_['map'](_0x198614,function(_0x5467e4){if(_0x5467e4[_0x2896('0x3b')]!==_0x2896('0x4a')){var _0x21a4ac={};_0x21a4ac[_0x5467e4[_0x2896('0x35')]]={'$like':'%'+_0x2d8ab8['query'][_0x2896('0x48')]+'%'};return _0x21a4ac;}})});}_0x1f511d=_[_0x2896('0x49')]({},_0x1f511d,_0x2d8ab8[_0x2896('0x4b')]);var _0x54a2b9={'where':_0x1f511d['where']};return db['SugarcrmConfiguration'][_0x2896('0x2d')](_0x54a2b9)[_0x2896('0x20')](function(_0x24f3e2){_0x186bf4[_0x2896('0x2d')]=_0x24f3e2;if(_0x2d8ab8['query']['includeAll']){_0x1f511d[_0x2896('0x4c')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x2896('0x4d')](_0x1f511d);})[_0x2896('0x20')](function(_0x421121){_0x186bf4[_0x2896('0x4e')]=_0x421121;return _0x186bf4;})[_0x2896('0x20')](respondWithFilteredResult(_0x5acf62,_0x1f511d))[_0x2896('0x2a')](handleError(_0x5acf62,null));};exports[_0x2896('0x4f')]=function(_0xd19fde,_0x2bdb43){var _0x2ebd0e={'raw':![],'where':{'id':_0xd19fde[_0x2896('0x50')]['id']}},_0x10099d={};_0x10099d['model']=_['keys'](db[_0x2896('0x38')][_0x2896('0x39')]);_0x10099d[_0x2896('0x3d')]=_[_0x2896('0x51')](_0xd19fde['query']);_0x10099d[_0x2896('0x47')]=_[_0x2896('0x3f')](_0x10099d[_0x2896('0x3e')],_0x10099d[_0x2896('0x3d')]);_0x2ebd0e[_0x2896('0x41')]=_['intersection'](_0x10099d[_0x2896('0x3e')],qs[_0x2896('0x40')](_0xd19fde['query']['fields']));_0x2ebd0e[_0x2896('0x41')]=_0x2ebd0e[_0x2896('0x41')][_0x2896('0x52')]?_0x2ebd0e[_0x2896('0x41')]:_0x10099d['model'];if(_0xd19fde['query'][_0x2896('0x53')]){_0x2ebd0e[_0x2896('0x4c')]=[{'all':!![]}];}_0x2ebd0e=_[_0x2896('0x49')]({},_0x2ebd0e,_0xd19fde[_0x2896('0x4b')]);return db[_0x2896('0x38')][_0x2896('0x54')](_0x2ebd0e)[_0x2896('0x20')](handleEntityNotFound(_0x2bdb43,null))[_0x2896('0x20')](respondWithResult(_0x2bdb43,null))[_0x2896('0x2a')](handleError(_0x2bdb43,null));};exports[_0x2896('0x55')]=function(_0x31e300,_0x2f0542){return db[_0x2896('0x38')][_0x2896('0x55')](_0x31e300[_0x2896('0x56')],{})[_0x2896('0x20')](respondWithResult(_0x2f0542,0xc9))[_0x2896('0x2a')](handleError(_0x2f0542,null));};exports[_0x2896('0x32')]=function(_0x1dbeb4,_0x46f04b){if(_0x1dbeb4[_0x2896('0x56')]['id']){delete _0x1dbeb4[_0x2896('0x56')]['id'];}return db['SugarcrmConfiguration']['find']({'where':{'id':_0x1dbeb4[_0x2896('0x50')]['id']}})[_0x2896('0x20')](handleEntityNotFound(_0x46f04b,null))[_0x2896('0x20')](saveUpdates(_0x1dbeb4[_0x2896('0x56')],null))['then'](respondWithResult(_0x46f04b,null))['catch'](handleError(_0x46f04b,null));};exports[_0x2896('0x33')]=function(_0x4d2387,_0x22fdec){return db[_0x2896('0x38')][_0x2896('0x54')]({'where':{'id':_0x4d2387[_0x2896('0x50')]['id']}})[_0x2896('0x20')](handleEntityNotFound(_0x22fdec,null))[_0x2896('0x20')](removeEntity(_0x22fdec,null))[_0x2896('0x2a')](handleError(_0x22fdec,null));};exports[_0x2896('0x57')]=function(_0x29eb58,_0x455463,_0xfb2937){var _0x2c9a8c={};var _0x386f43={};var _0xc263a7;var _0x2e3402;return db[_0x2896('0x38')][_0x2896('0x58')]({'where':{'id':_0x29eb58[_0x2896('0x50')]['id']}})[_0x2896('0x20')](handleEntityNotFound(_0x455463,null))['then'](function(_0x17ce0f){if(_0x17ce0f){_0xc263a7=_0x17ce0f;_0x386f43['model']=_['keys'](db[_0x2896('0x59')]['rawAttributes']);_0x386f43[_0x2896('0x3d')]=_[_0x2896('0x51')](_0x29eb58['query']);_0x386f43['filters']=_[_0x2896('0x3f')](_0x386f43[_0x2896('0x3e')],_0x386f43['query']);_0x2c9a8c[_0x2896('0x41')]=_['intersection'](_0x386f43[_0x2896('0x3e')],qs[_0x2896('0x40')](_0x29eb58[_0x2896('0x3d')][_0x2896('0x40')]));_0x2c9a8c[_0x2896('0x41')]=_0x2c9a8c[_0x2896('0x41')][_0x2896('0x52')]?_0x2c9a8c[_0x2896('0x41')]:_0x386f43[_0x2896('0x3e')];_0x2c9a8c[_0x2896('0x45')]=qs[_0x2896('0x5a')](_0x29eb58[_0x2896('0x3d')][_0x2896('0x5a')]);_0x2c9a8c[_0x2896('0x46')]=qs['filters'](_[_0x2896('0x5b')](_0x29eb58['query'],_0x386f43[_0x2896('0x47')]));if(_0x29eb58[_0x2896('0x3d')][_0x2896('0x48')]){_0x2c9a8c[_0x2896('0x46')]=_[_0x2896('0x49')](_0x2c9a8c[_0x2896('0x46')],{'$or':_[_0x2896('0x37')](_0x2c9a8c[_0x2896('0x41')],function(_0x4657b8){var _0x49c37c={};_0x49c37c[_0x4657b8]={'$like':'%'+_0x29eb58[_0x2896('0x3d')]['filter']+'%'};return _0x49c37c;})});}_0x2c9a8c=_[_0x2896('0x49')]({},_0x2c9a8c,_0x29eb58[_0x2896('0x4b')]);return _0xc263a7[_0x2896('0x57')](_0x2c9a8c);}})[_0x2896('0x20')](function(_0x1ab49c){if(_0x1ab49c){_0x2e3402=_0x1ab49c[_0x2896('0x52')];if(!_0x29eb58['query']['hasOwnProperty'](_0x2896('0x43'))){_0x2c9a8c[_0x2896('0x2e')]=qs[_0x2896('0x2e')](_0x29eb58[_0x2896('0x3d')][_0x2896('0x2e')]);_0x2c9a8c[_0x2896('0x44')]=qs[_0x2896('0x44')](_0x29eb58[_0x2896('0x3d')]['offset']);}return _0xc263a7[_0x2896('0x57')](_0x2c9a8c);}})[_0x2896('0x20')](function(_0x54ac37){if(_0x54ac37){return _0x54ac37?{'count':_0x2e3402,'rows':_0x54ac37}:null;}})[_0x2896('0x20')](respondWithResult(_0x455463,null))[_0x2896('0x2a')](handleError(_0x455463,null));};exports[_0x2896('0x5c')]=function(_0x594573,_0x4645fa,_0x2575d9){var _0x4f5b55={};var _0x233a3c={};var _0x370430;var _0x5a1198;return db['SugarcrmConfiguration'][_0x2896('0x58')]({'where':{'id':_0x594573[_0x2896('0x50')]['id']}})[_0x2896('0x20')](handleEntityNotFound(_0x4645fa,null))[_0x2896('0x20')](function(_0xdbb8fb){if(_0xdbb8fb){_0x370430=_0xdbb8fb;_0x233a3c[_0x2896('0x3e')]=_['keys'](db[_0x2896('0x59')][_0x2896('0x39')]);_0x233a3c['query']=_[_0x2896('0x51')](_0x594573[_0x2896('0x3d')]);_0x233a3c[_0x2896('0x47')]=_[_0x2896('0x3f')](_0x233a3c[_0x2896('0x3e')],_0x233a3c[_0x2896('0x3d')]);_0x4f5b55[_0x2896('0x41')]=_[_0x2896('0x3f')](_0x233a3c[_0x2896('0x3e')],qs[_0x2896('0x40')](_0x594573[_0x2896('0x3d')]['fields']));_0x4f5b55['attributes']=_0x4f5b55['attributes'][_0x2896('0x52')]?_0x4f5b55[_0x2896('0x41')]:_0x233a3c[_0x2896('0x3e')];_0x4f5b55[_0x2896('0x45')]=qs[_0x2896('0x5a')](_0x594573[_0x2896('0x3d')][_0x2896('0x5a')]);_0x4f5b55['where']=qs[_0x2896('0x47')](_[_0x2896('0x5b')](_0x594573[_0x2896('0x3d')],_0x233a3c[_0x2896('0x47')]));if(_0x594573[_0x2896('0x3d')][_0x2896('0x48')]){_0x4f5b55[_0x2896('0x46')]=_[_0x2896('0x49')](_0x4f5b55['where'],{'$or':_[_0x2896('0x37')](_0x4f5b55[_0x2896('0x41')],function(_0x3c9f96){var _0x1351e6={};_0x1351e6[_0x3c9f96]={'$like':'%'+_0x594573[_0x2896('0x3d')][_0x2896('0x48')]+'%'};return _0x1351e6;})});}_0x4f5b55=_[_0x2896('0x49')]({},_0x4f5b55,_0x594573[_0x2896('0x4b')]);return _0x370430['getSubjects'](_0x4f5b55);}})['then'](function(_0x19ce27){if(_0x19ce27){_0x5a1198=_0x19ce27[_0x2896('0x52')];if(!_0x594573[_0x2896('0x3d')][_0x2896('0x42')](_0x2896('0x43'))){_0x4f5b55[_0x2896('0x2e')]=qs['limit'](_0x594573[_0x2896('0x3d')][_0x2896('0x2e')]);_0x4f5b55[_0x2896('0x44')]=qs['offset'](_0x594573[_0x2896('0x3d')]['offset']);}return _0x370430['getSubjects'](_0x4f5b55);}})[_0x2896('0x20')](function(_0x36e863){if(_0x36e863){return _0x36e863?{'count':_0x5a1198,'rows':_0x36e863}:null;}})[_0x2896('0x20')](respondWithResult(_0x4645fa,null))[_0x2896('0x2a')](handleError(_0x4645fa,null));};exports[_0x2896('0x5d')]=function(_0xa2433b,_0x292236,_0x1501b6){var _0x2a7da7={};var _0x8bd084={};var _0x56d0fb;var _0x21519d;return db[_0x2896('0x38')]['findOne']({'where':{'id':_0xa2433b['params']['id']}})[_0x2896('0x20')](handleEntityNotFound(_0x292236,null))['then'](function(_0x4bb3d2){if(_0x4bb3d2){_0x56d0fb=_0x4bb3d2;_0x8bd084['model']=_[_0x2896('0x51')](db[_0x2896('0x59')][_0x2896('0x39')]);_0x8bd084['query']=_['keys'](_0xa2433b['query']);_0x8bd084[_0x2896('0x47')]=_[_0x2896('0x3f')](_0x8bd084[_0x2896('0x3e')],_0x8bd084[_0x2896('0x3d')]);_0x2a7da7[_0x2896('0x41')]=_[_0x2896('0x3f')](_0x8bd084[_0x2896('0x3e')],qs[_0x2896('0x40')](_0xa2433b[_0x2896('0x3d')][_0x2896('0x40')]));_0x2a7da7[_0x2896('0x41')]=_0x2a7da7[_0x2896('0x41')][_0x2896('0x52')]?_0x2a7da7[_0x2896('0x41')]:_0x8bd084[_0x2896('0x3e')];_0x2a7da7[_0x2896('0x45')]=qs[_0x2896('0x5a')](_0xa2433b['query'][_0x2896('0x5a')]);_0x2a7da7['where']=qs[_0x2896('0x47')](_[_0x2896('0x5b')](_0xa2433b[_0x2896('0x3d')],_0x8bd084[_0x2896('0x47')]));if(_0xa2433b[_0x2896('0x3d')]['filter']){_0x2a7da7[_0x2896('0x46')]=_['merge'](_0x2a7da7[_0x2896('0x46')],{'$or':_['map'](_0x2a7da7[_0x2896('0x41')],function(_0xf980c1){var _0x147e0b={};_0x147e0b[_0xf980c1]={'$like':'%'+_0xa2433b[_0x2896('0x3d')][_0x2896('0x48')]+'%'};return _0x147e0b;})});}_0x2a7da7=_[_0x2896('0x49')]({},_0x2a7da7,_0xa2433b[_0x2896('0x4b')]);return _0x56d0fb['getDescriptions'](_0x2a7da7);}})['then'](function(_0x3e4fbf){if(_0x3e4fbf){_0x21519d=_0x3e4fbf[_0x2896('0x52')];if(!_0xa2433b[_0x2896('0x3d')]['hasOwnProperty'](_0x2896('0x43'))){_0x2a7da7['limit']=qs['limit'](_0xa2433b['query'][_0x2896('0x2e')]);_0x2a7da7[_0x2896('0x44')]=qs[_0x2896('0x44')](_0xa2433b[_0x2896('0x3d')][_0x2896('0x44')]);}return _0x56d0fb[_0x2896('0x5d')](_0x2a7da7);}})[_0x2896('0x20')](function(_0x875e38){if(_0x875e38){return _0x875e38?{'count':_0x21519d,'rows':_0x875e38}:null;}})[_0x2896('0x20')](respondWithResult(_0x292236,null))[_0x2896('0x2a')](handleError(_0x292236,null));}; \ No newline at end of file +var _0x532a=['stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','set','reject','save','destroy','stack','name','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','rows','create','body','find','params','getFields','findOne','getSubjects','SugarcrmField','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','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','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x3d87bd,_0x108926){var _0x99337c=function(_0x298eb0){while(--_0x298eb0){_0x3d87bd['push'](_0x3d87bd['shift']());}};_0x99337c(++_0x108926);}(_0x532a,0x8f));var _0xa532=function(_0xdaab62,_0x2728ab){_0xdaab62=_0xdaab62-0x0;var _0x13d767=_0x532a[_0xdaab62];return _0x13d767;};'use strict';var pdf=require(_0xa532('0x0'));var emlformat=require(_0xa532('0x1'));var rimraf=require(_0xa532('0x2'));var zipdir=require(_0xa532('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa532('0x4'));var moment=require(_0xa532('0x5'));var BPromise=require(_0xa532('0x6'));var Mustache=require(_0xa532('0x7'));var util=require(_0xa532('0x8'));var path=require(_0xa532('0x9'));var sox=require(_0xa532('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xa532('0xb'));var squel=require(_0xa532('0xc'));var crypto=require(_0xa532('0xd'));var jsforce=require(_0xa532('0xe'));var deskjs=require(_0xa532('0xf'));var toCsv=require(_0xa532('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa532('0x11'));var authService=require(_0xa532('0x12'));var qs=require(_0xa532('0x13'));var as=require(_0xa532('0x14'));var hardwareService=require(_0xa532('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xa532('0x16'));var db=require(_0xa532('0x17'))['db'];var jayson=require(_0xa532('0x18'));var client=jayson[_0xa532('0x19')][_0xa532('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x15f53a,_0x2d68bc,_0x3883cc){if(_0x3883cc){var _0x187b49=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x187b49[_0xa532('0x1b')](_0x2d68bc)){return _0x15f53a;}else{throw new db[(_0xa532('0x1c'))][(_0xa532('0x1d'))](_0xa532('0x1e'));}}else{return _0x15f53a;}}function respondWithRpcPromise(_0x1e1787,_0x42790a,_0xe4fe26,_0x148cb3){return new BPromise(function(_0xb8a34f,_0x1197c5){var _0x14240b=_0x148cb3||client;return _0x14240b['request'](_0x1e1787,_0xe4fe26)[_0xa532('0x1f')](function(_0x45ae8f){logger[_0xa532('0x20')](_0xa532('0x21'),_0x42790a,_0xa532('0x22'));logger[_0xa532('0x23')](_0xa532('0x24'),_0x42790a,'request\x20sent',JSON[_0xa532('0x25')](_0x45ae8f));if(_0x45ae8f[_0xa532('0x26')]){if(_0x45ae8f['error']['code']===0x1f4){logger[_0xa532('0x26')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x42790a,_0x45ae8f[_0xa532('0x26')][_0xa532('0x27')]);return _0x1197c5(_0x45ae8f['error'][_0xa532('0x27')]);}logger[_0xa532('0x26')](_0xa532('0x21'),_0x42790a,_0x45ae8f[_0xa532('0x26')]['message']);return _0xb8a34f(_0x45ae8f[_0xa532('0x26')][_0xa532('0x27')]);}else{logger[_0xa532('0x20')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x42790a,_0xa532('0x22'));_0xb8a34f(_0x45ae8f[_0xa532('0x28')][_0xa532('0x27')]);}})[_0xa532('0x29')](function(_0x3b5670){logger[_0xa532('0x26')](_0xa532('0x21'),_0x42790a,_0x3b5670);_0x1197c5(_0x3b5670);});});}function respondWithStatusCode(_0x54424a,_0x1a15b4){_0x1a15b4=_0x1a15b4||0xcc;return function(_0x4a1890){if(_0x4a1890){return _0x54424a[_0xa532('0x2a')](_0x1a15b4);}return _0x54424a[_0xa532('0x2b')](_0x1a15b4)[_0xa532('0x2c')]();};}function respondWithResult(_0x565359,_0x43e17e){_0x43e17e=_0x43e17e||0xc8;return function(_0x11500a){if(_0x11500a){return _0x565359[_0xa532('0x2b')](_0x43e17e)[_0xa532('0x2d')](_0x11500a);}};}function respondWithFilteredResult(_0x449773,_0x8546fe){return function(_0x37066c){if(_0x37066c){var _0xf11b9f=_0x37066c[_0xa532('0x2e')],_0x4ee90c=_0x8546fe[_0xa532('0x2f')],_0x1f02ce=_0x8546fe['offset']+_0x8546fe['limit'],_0x4ec9df;if(_0x1f02ce>=_0xf11b9f){_0x1f02ce=_0xf11b9f;_0x4ec9df=0xc8;}else{_0x4ec9df=0xce;}_0x449773[_0xa532('0x2b')](_0x4ec9df);return _0x449773[_0xa532('0x30')]('Content-Range',_0x4ee90c+'-'+_0x1f02ce+'/'+_0xf11b9f)['json'](_0x37066c);}return null;};}function patchUpdates(_0xa53d8f){return function(_0x598e35){try{jsonpatch['apply'](_0x598e35,_0xa53d8f,!![]);}catch(_0xca9e09){return BPromise[_0xa532('0x31')](_0xca9e09);}return _0x598e35[_0xa532('0x32')]();};}function saveUpdates(_0x169420,_0x676ecf){return function(_0x1795b1){if(_0x1795b1){return _0x1795b1['update'](_0x169420)[_0xa532('0x1f')](function(_0x653aa0){return _0x653aa0;});}return null;};}function removeEntity(_0x2dc71d,_0x53a94b){return function(_0xf7c92d){if(_0xf7c92d){return _0xf7c92d[_0xa532('0x33')]()[_0xa532('0x1f')](function(){_0x2dc71d[_0xa532('0x2b')](0xcc)[_0xa532('0x2c')]();});}};}function handleEntityNotFound(_0x4651ea,_0x58164b){return function(_0x5e228d){if(!_0x5e228d){_0x4651ea[_0xa532('0x2a')](0x194);}return _0x5e228d;};}function handleError(_0x59e9cb,_0x24ea3d){_0x24ea3d=_0x24ea3d||0x1f4;return function(_0x5405e8){logger[_0xa532('0x26')](_0x5405e8[_0xa532('0x34')]);if(_0x5405e8['name']){delete _0x5405e8[_0xa532('0x35')];}_0x59e9cb[_0xa532('0x2b')](_0x24ea3d)['send'](_0x5405e8);};}exports['index']=function(_0x352fc8,_0x4744c5){var _0x743771={},_0x5b45dc={},_0x41be8b={'count':0x0,'rows':[]};var _0x3b2919=_[_0xa532('0x36')](db[_0xa532('0x37')][_0xa532('0x38')],function(_0x3a7e0e){return{'name':_0x3a7e0e[_0xa532('0x39')],'type':_0x3a7e0e[_0xa532('0x3a')][_0xa532('0x3b')]};});_0x5b45dc[_0xa532('0x3c')]=_[_0xa532('0x36')](_0x3b2919,_0xa532('0x35'));_0x5b45dc[_0xa532('0x3d')]=_[_0xa532('0x3e')](_0x352fc8[_0xa532('0x3d')]);_0x5b45dc[_0xa532('0x3f')]=_['intersection'](_0x5b45dc[_0xa532('0x3c')],_0x5b45dc[_0xa532('0x3d')]);_0x743771['attributes']=_[_0xa532('0x40')](_0x5b45dc[_0xa532('0x3c')],qs[_0xa532('0x41')](_0x352fc8['query'][_0xa532('0x41')]));_0x743771['attributes']=_0x743771[_0xa532('0x42')][_0xa532('0x43')]?_0x743771[_0xa532('0x42')]:_0x5b45dc[_0xa532('0x3c')];if(!_0x352fc8[_0xa532('0x3d')][_0xa532('0x44')](_0xa532('0x45'))){_0x743771[_0xa532('0x46')]=qs[_0xa532('0x46')](_0x352fc8[_0xa532('0x3d')]['limit']);_0x743771[_0xa532('0x2f')]=qs[_0xa532('0x2f')](_0x352fc8[_0xa532('0x3d')][_0xa532('0x2f')]);}_0x743771[_0xa532('0x47')]=qs['sort'](_0x352fc8[_0xa532('0x3d')][_0xa532('0x48')]);_0x743771['where']=qs[_0xa532('0x3f')](_[_0xa532('0x49')](_0x352fc8[_0xa532('0x3d')],_0x5b45dc[_0xa532('0x3f')]));if(_0x352fc8[_0xa532('0x3d')]['filter']){_0x743771[_0xa532('0x4a')]=_[_0xa532('0x4b')](_0x743771[_0xa532('0x4a')],{'$or':_[_0xa532('0x36')](_0x3b2919,function(_0x3556c0){if(_0x3556c0[_0xa532('0x3a')]!==_0xa532('0x4c')){var _0x2d891c={};_0x2d891c[_0x3556c0[_0xa532('0x35')]]={'$like':'%'+_0x352fc8[_0xa532('0x3d')][_0xa532('0x4d')]+'%'};return _0x2d891c;}})});}_0x743771=_[_0xa532('0x4b')]({},_0x743771,_0x352fc8[_0xa532('0x4e')]);var _0x2d8019={'where':_0x743771['where']};return db[_0xa532('0x37')]['count'](_0x2d8019)[_0xa532('0x1f')](function(_0x48a4b5){_0x41be8b[_0xa532('0x2e')]=_0x48a4b5;if(_0x352fc8[_0xa532('0x3d')][_0xa532('0x4f')]){_0x743771['include']=[{'all':!![]}];}return db['SugarcrmConfiguration']['findAll'](_0x743771);})[_0xa532('0x1f')](function(_0x5a8fd9){_0x41be8b[_0xa532('0x50')]=_0x5a8fd9;return _0x41be8b;})[_0xa532('0x1f')](respondWithFilteredResult(_0x4744c5,_0x743771))[_0xa532('0x29')](handleError(_0x4744c5,null));};exports['show']=function(_0x3f7339,_0x46df12){var _0x420a69={'raw':![],'where':{'id':_0x3f7339['params']['id']}},_0x26036a={};_0x26036a[_0xa532('0x3c')]=_[_0xa532('0x3e')](db['SugarcrmConfiguration'][_0xa532('0x38')]);_0x26036a['query']=_['keys'](_0x3f7339[_0xa532('0x3d')]);_0x26036a['filters']=_[_0xa532('0x40')](_0x26036a[_0xa532('0x3c')],_0x26036a['query']);_0x420a69['attributes']=_[_0xa532('0x40')](_0x26036a[_0xa532('0x3c')],qs['fields'](_0x3f7339[_0xa532('0x3d')][_0xa532('0x41')]));_0x420a69['attributes']=_0x420a69[_0xa532('0x42')]['length']?_0x420a69[_0xa532('0x42')]:_0x26036a[_0xa532('0x3c')];if(_0x3f7339[_0xa532('0x3d')][_0xa532('0x4f')]){_0x420a69['include']=[{'all':!![]}];}_0x420a69=_[_0xa532('0x4b')]({},_0x420a69,_0x3f7339['options']);return db[_0xa532('0x37')]['find'](_0x420a69)[_0xa532('0x1f')](handleEntityNotFound(_0x46df12,null))[_0xa532('0x1f')](respondWithResult(_0x46df12,null))[_0xa532('0x29')](handleError(_0x46df12,null));};exports[_0xa532('0x51')]=function(_0x127796,_0x3a2049){return db[_0xa532('0x37')][_0xa532('0x51')](_0x127796[_0xa532('0x52')],{})[_0xa532('0x1f')](respondWithResult(_0x3a2049,0xc9))[_0xa532('0x29')](handleError(_0x3a2049,null));};exports['update']=function(_0x2a0670,_0x1a8d23){if(_0x2a0670[_0xa532('0x52')]['id']){delete _0x2a0670[_0xa532('0x52')]['id'];}return db['SugarcrmConfiguration'][_0xa532('0x53')]({'where':{'id':_0x2a0670[_0xa532('0x54')]['id']}})[_0xa532('0x1f')](handleEntityNotFound(_0x1a8d23,null))[_0xa532('0x1f')](saveUpdates(_0x2a0670[_0xa532('0x52')],null))['then'](respondWithResult(_0x1a8d23,null))[_0xa532('0x29')](handleError(_0x1a8d23,null));};exports[_0xa532('0x33')]=function(_0x4b32de,_0x4ae0c4){return db[_0xa532('0x37')][_0xa532('0x53')]({'where':{'id':_0x4b32de[_0xa532('0x54')]['id']}})[_0xa532('0x1f')](handleEntityNotFound(_0x4ae0c4,null))[_0xa532('0x1f')](removeEntity(_0x4ae0c4,null))[_0xa532('0x29')](handleError(_0x4ae0c4,null));};exports[_0xa532('0x55')]=function(_0x45a731,_0xa4c905,_0x4def9e){var _0x3253c5={};var _0x2a7936={};var _0x20e639;var _0x48f0c2;return db[_0xa532('0x37')][_0xa532('0x56')]({'where':{'id':_0x45a731['params']['id']}})['then'](handleEntityNotFound(_0xa4c905,null))['then'](function(_0x4d31bc){if(_0x4d31bc){_0x20e639=_0x4d31bc;_0x2a7936['model']=_[_0xa532('0x3e')](db['SugarcrmField'][_0xa532('0x38')]);_0x2a7936[_0xa532('0x3d')]=_[_0xa532('0x3e')](_0x45a731[_0xa532('0x3d')]);_0x2a7936[_0xa532('0x3f')]=_[_0xa532('0x40')](_0x2a7936[_0xa532('0x3c')],_0x2a7936[_0xa532('0x3d')]);_0x3253c5[_0xa532('0x42')]=_[_0xa532('0x40')](_0x2a7936['model'],qs[_0xa532('0x41')](_0x45a731[_0xa532('0x3d')][_0xa532('0x41')]));_0x3253c5[_0xa532('0x42')]=_0x3253c5['attributes'][_0xa532('0x43')]?_0x3253c5['attributes']:_0x2a7936['model'];_0x3253c5[_0xa532('0x47')]=qs[_0xa532('0x48')](_0x45a731[_0xa532('0x3d')][_0xa532('0x48')]);_0x3253c5[_0xa532('0x4a')]=qs[_0xa532('0x3f')](_[_0xa532('0x49')](_0x45a731[_0xa532('0x3d')],_0x2a7936[_0xa532('0x3f')]));if(_0x45a731[_0xa532('0x3d')]['filter']){_0x3253c5[_0xa532('0x4a')]=_['merge'](_0x3253c5[_0xa532('0x4a')],{'$or':_[_0xa532('0x36')](_0x3253c5[_0xa532('0x42')],function(_0x1c0b76){var _0x4c2335={};_0x4c2335[_0x1c0b76]={'$like':'%'+_0x45a731[_0xa532('0x3d')]['filter']+'%'};return _0x4c2335;})});}_0x3253c5=_[_0xa532('0x4b')]({},_0x3253c5,_0x45a731[_0xa532('0x4e')]);return _0x20e639[_0xa532('0x55')](_0x3253c5);}})[_0xa532('0x1f')](function(_0x1d4c88){if(_0x1d4c88){_0x48f0c2=_0x1d4c88[_0xa532('0x43')];if(!_0x45a731[_0xa532('0x3d')][_0xa532('0x44')](_0xa532('0x45'))){_0x3253c5['limit']=qs[_0xa532('0x46')](_0x45a731[_0xa532('0x3d')]['limit']);_0x3253c5[_0xa532('0x2f')]=qs['offset'](_0x45a731['query'][_0xa532('0x2f')]);}return _0x20e639['getFields'](_0x3253c5);}})[_0xa532('0x1f')](function(_0x271d54){if(_0x271d54){return _0x271d54?{'count':_0x48f0c2,'rows':_0x271d54}:null;}})[_0xa532('0x1f')](respondWithResult(_0xa4c905,null))[_0xa532('0x29')](handleError(_0xa4c905,null));};exports[_0xa532('0x57')]=function(_0x323d27,_0x3639f0,_0x304450){var _0x3805e3={};var _0x180c4c={};var _0x3b7ea9;var _0x1298b2;return db[_0xa532('0x37')][_0xa532('0x56')]({'where':{'id':_0x323d27[_0xa532('0x54')]['id']}})[_0xa532('0x1f')](handleEntityNotFound(_0x3639f0,null))[_0xa532('0x1f')](function(_0x367994){if(_0x367994){_0x3b7ea9=_0x367994;_0x180c4c[_0xa532('0x3c')]=_[_0xa532('0x3e')](db[_0xa532('0x58')][_0xa532('0x38')]);_0x180c4c[_0xa532('0x3d')]=_['keys'](_0x323d27['query']);_0x180c4c[_0xa532('0x3f')]=_[_0xa532('0x40')](_0x180c4c[_0xa532('0x3c')],_0x180c4c['query']);_0x3805e3[_0xa532('0x42')]=_[_0xa532('0x40')](_0x180c4c[_0xa532('0x3c')],qs[_0xa532('0x41')](_0x323d27[_0xa532('0x3d')][_0xa532('0x41')]));_0x3805e3[_0xa532('0x42')]=_0x3805e3[_0xa532('0x42')][_0xa532('0x43')]?_0x3805e3['attributes']:_0x180c4c['model'];_0x3805e3[_0xa532('0x47')]=qs['sort'](_0x323d27['query']['sort']);_0x3805e3[_0xa532('0x4a')]=qs[_0xa532('0x3f')](_['pick'](_0x323d27[_0xa532('0x3d')],_0x180c4c[_0xa532('0x3f')]));if(_0x323d27['query'][_0xa532('0x4d')]){_0x3805e3[_0xa532('0x4a')]=_[_0xa532('0x4b')](_0x3805e3[_0xa532('0x4a')],{'$or':_[_0xa532('0x36')](_0x3805e3[_0xa532('0x42')],function(_0x4273e4){var _0x14904c={};_0x14904c[_0x4273e4]={'$like':'%'+_0x323d27['query']['filter']+'%'};return _0x14904c;})});}_0x3805e3=_[_0xa532('0x4b')]({},_0x3805e3,_0x323d27['options']);return _0x3b7ea9[_0xa532('0x57')](_0x3805e3);}})[_0xa532('0x1f')](function(_0x456bee){if(_0x456bee){_0x1298b2=_0x456bee[_0xa532('0x43')];if(!_0x323d27[_0xa532('0x3d')][_0xa532('0x44')](_0xa532('0x45'))){_0x3805e3['limit']=qs[_0xa532('0x46')](_0x323d27[_0xa532('0x3d')]['limit']);_0x3805e3[_0xa532('0x2f')]=qs[_0xa532('0x2f')](_0x323d27[_0xa532('0x3d')][_0xa532('0x2f')]);}return _0x3b7ea9[_0xa532('0x57')](_0x3805e3);}})['then'](function(_0x216853){if(_0x216853){return _0x216853?{'count':_0x1298b2,'rows':_0x216853}:null;}})[_0xa532('0x1f')](respondWithResult(_0x3639f0,null))[_0xa532('0x29')](handleError(_0x3639f0,null));};exports[_0xa532('0x59')]=function(_0x313d5c,_0x32ff4d,_0x2b32aa){var _0x17a333={};var _0x211b67={};var _0x338aa9;var _0x192952;return db[_0xa532('0x37')][_0xa532('0x56')]({'where':{'id':_0x313d5c['params']['id']}})[_0xa532('0x1f')](handleEntityNotFound(_0x32ff4d,null))[_0xa532('0x1f')](function(_0x1382c6){if(_0x1382c6){_0x338aa9=_0x1382c6;_0x211b67[_0xa532('0x3c')]=_[_0xa532('0x3e')](db['SugarcrmField'][_0xa532('0x38')]);_0x211b67[_0xa532('0x3d')]=_[_0xa532('0x3e')](_0x313d5c['query']);_0x211b67[_0xa532('0x3f')]=_['intersection'](_0x211b67['model'],_0x211b67[_0xa532('0x3d')]);_0x17a333[_0xa532('0x42')]=_[_0xa532('0x40')](_0x211b67[_0xa532('0x3c')],qs['fields'](_0x313d5c[_0xa532('0x3d')][_0xa532('0x41')]));_0x17a333[_0xa532('0x42')]=_0x17a333[_0xa532('0x42')][_0xa532('0x43')]?_0x17a333[_0xa532('0x42')]:_0x211b67[_0xa532('0x3c')];_0x17a333[_0xa532('0x47')]=qs['sort'](_0x313d5c[_0xa532('0x3d')][_0xa532('0x48')]);_0x17a333[_0xa532('0x4a')]=qs[_0xa532('0x3f')](_[_0xa532('0x49')](_0x313d5c[_0xa532('0x3d')],_0x211b67[_0xa532('0x3f')]));if(_0x313d5c[_0xa532('0x3d')][_0xa532('0x4d')]){_0x17a333[_0xa532('0x4a')]=_[_0xa532('0x4b')](_0x17a333[_0xa532('0x4a')],{'$or':_['map'](_0x17a333[_0xa532('0x42')],function(_0x55a66f){var _0x16cd6a={};_0x16cd6a[_0x55a66f]={'$like':'%'+_0x313d5c[_0xa532('0x3d')][_0xa532('0x4d')]+'%'};return _0x16cd6a;})});}_0x17a333=_[_0xa532('0x4b')]({},_0x17a333,_0x313d5c[_0xa532('0x4e')]);return _0x338aa9[_0xa532('0x59')](_0x17a333);}})[_0xa532('0x1f')](function(_0x419182){if(_0x419182){_0x192952=_0x419182[_0xa532('0x43')];if(!_0x313d5c[_0xa532('0x3d')][_0xa532('0x44')](_0xa532('0x45'))){_0x17a333[_0xa532('0x46')]=qs[_0xa532('0x46')](_0x313d5c[_0xa532('0x3d')][_0xa532('0x46')]);_0x17a333['offset']=qs[_0xa532('0x2f')](_0x313d5c[_0xa532('0x3d')][_0xa532('0x2f')]);}return _0x338aa9['getDescriptions'](_0x17a333);}})['then'](function(_0x2bad58){if(_0x2bad58){return _0x2bad58?{'count':_0x192952,'rows':_0x2bad58}:null;}})[_0xa532('0x1f')](respondWithResult(_0x32ff4d,null))['catch'](handleError(_0x32ff4d,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index b338b50..0be8760 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 _0xadd0=['request-promise','path','rimraf','./intSugarcrmConfiguration.attributes','define','SugarcrmConfiguration','int_sugarcrm_configurations','util','../../config/logger','bluebird'];(function(_0x67d919,_0x5490f1){var _0x48ce10=function(_0x138a4d){while(--_0x138a4d){_0x67d919['push'](_0x67d919['shift']());}};_0x48ce10(++_0x5490f1);}(_0xadd0,0x1b5));var _0x0add=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xadd0[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x0add('0x0'));var logger=require(_0x0add('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0add('0x2'));var rp=require(_0x0add('0x3'));var fs=require('fs');var path=require(_0x0add('0x4'));var rimraf=require(_0x0add('0x5'));var config=require('../../config/environment');var attributes=require(_0x0add('0x6'));module['exports']=function(_0x5b5260,_0x347293){return _0x5b5260[_0x0add('0x7')](_0x0add('0x8'),attributes,{'tableName':_0x0add('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a87=['int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SugarcrmConfiguration'];(function(_0x5af459,_0x45d683){var _0x5ac0ae=function(_0x5dfbed){while(--_0x5dfbed){_0x5af459['push'](_0x5af459['shift']());}};_0x5ac0ae(++_0x45d683);}(_0x1a87,0x189));var _0x71a8=function(_0x29adb2,_0x48616f){_0x29adb2=_0x29adb2-0x0;var _0x250229=_0x1a87[_0x29adb2];return _0x250229;};'use strict';var _=require(_0x71a8('0x0'));var util=require(_0x71a8('0x1'));var logger=require(_0x71a8('0x2'))(_0x71a8('0x3'));var moment=require(_0x71a8('0x4'));var BPromise=require(_0x71a8('0x5'));var rp=require(_0x71a8('0x6'));var fs=require('fs');var path=require(_0x71a8('0x7'));var rimraf=require(_0x71a8('0x8'));var config=require(_0x71a8('0x9'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x71a8('0xa')]=function(_0x351440,_0x1f93d0){return _0x351440[_0x71a8('0xb')](_0x71a8('0xc'),attributes,{'tableName':_0x71a8('0xd'),'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 d6ec3bf..9f474f0 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 _0xa96b=['request','info','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa96b,0x1ac));var _0xba96=function(_0x86cb6f,_0x4a78fc){_0x86cb6f=_0x86cb6f-0x0;var _0x56b665=_0xa96b[_0x86cb6f];return _0x56b665;};'use strict';var _=require(_0xba96('0x0'));var util=require('util');var moment=require(_0xba96('0x1'));var BPromise=require(_0xba96('0x2'));var rs=require(_0xba96('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba96('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xba96('0x5'))('rpc');var config=require(_0xba96('0x6'));var jayson=require(_0xba96('0x7'));var client=jayson[_0xba96('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30391d,_0x4a317c,_0x56615c){return new BPromise(function(_0x59f424,_0x552143){return client[_0xba96('0x9')](_0x30391d,_0x56615c)['then'](function(_0x173c58){logger[_0xba96('0xa')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4a317c,'request\x20sent');logger['debug'](_0xba96('0xb'),_0x4a317c,_0xba96('0xc'),JSON[_0xba96('0xd')](_0x173c58));if(_0x173c58['error']){if(_0x173c58[_0xba96('0xe')][_0xba96('0xf')]===0x1f4){logger[_0xba96('0xe')](_0xba96('0x10'),_0x4a317c,_0x173c58['error'][_0xba96('0x11')]);return _0x552143(_0x173c58[_0xba96('0xe')][_0xba96('0x11')]);}logger[_0xba96('0xe')](_0xba96('0x10'),_0x4a317c,_0x173c58[_0xba96('0xe')][_0xba96('0x11')]);return _0x59f424(_0x173c58['error'][_0xba96('0x11')]);}else{logger[_0xba96('0xa')](_0xba96('0x10'),_0x4a317c,_0xba96('0xc'));_0x59f424(_0x173c58[_0xba96('0x12')][_0xba96('0x11')]);}})['catch'](function(_0x1f7bf7){logger[_0xba96('0xe')](_0xba96('0x10'),_0x4a317c,_0x1f7bf7);_0x552143(_0x1f7bf7);});});} \ No newline at end of file +var _0xc5b5=['request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','info','SugarcrmConfiguration,\x20%s,\x20%s'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xc5b5,0x85));var _0x5c5b=function(_0x314350,_0x4433a0){_0x314350=_0x314350-0x0;var _0x2d9c1d=_0xc5b5[_0x314350];return _0x2d9c1d;};'use strict';var _=require(_0x5c5b('0x0'));var util=require(_0x5c5b('0x1'));var moment=require(_0x5c5b('0x2'));var BPromise=require(_0x5c5b('0x3'));var rs=require(_0x5c5b('0x4'));var fs=require('fs');var Redis=require(_0x5c5b('0x5'));var db=require(_0x5c5b('0x6'))['db'];var utils=require(_0x5c5b('0x7'));var logger=require(_0x5c5b('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5c5b('0x9'));var client=jayson[_0x5c5b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ecc55,_0x36c789,_0x1e6520){return new BPromise(function(_0x285851,_0x5478c5){return client[_0x5c5b('0xb')](_0x4ecc55,_0x1e6520)['then'](function(_0x1615fe){logger[_0x5c5b('0xc')](_0x5c5b('0xd'),_0x36c789,_0x5c5b('0xe'));logger['debug'](_0x5c5b('0xf'),_0x36c789,_0x5c5b('0xe'),JSON[_0x5c5b('0x10')](_0x1615fe));if(_0x1615fe[_0x5c5b('0x11')]){if(_0x1615fe[_0x5c5b('0x11')][_0x5c5b('0x12')]===0x1f4){logger[_0x5c5b('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x36c789,_0x1615fe[_0x5c5b('0x11')][_0x5c5b('0x13')]);return _0x5478c5(_0x1615fe[_0x5c5b('0x11')][_0x5c5b('0x13')]);}logger[_0x5c5b('0x11')](_0x5c5b('0xd'),_0x36c789,_0x1615fe['error']['message']);return _0x285851(_0x1615fe[_0x5c5b('0x11')]['message']);}else{logger[_0x5c5b('0xc')](_0x5c5b('0xd'),_0x36c789,_0x5c5b('0xe'));_0x285851(_0x1615fe[_0x5c5b('0x14')][_0x5c5b('0x13')]);}})['catch'](function(_0x45fab6){logger['error'](_0x5c5b('0xd'),_0x36c789,_0x45fab6);_0x5478c5(_0x45fab6);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 49b9d58..222dc1b 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 _0xdb1b=['isAuthenticated','show','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','/:id'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0xdb1b,0x85));var _0xbdb1=function(_0x629def,_0x23f88b){_0x629def=_0x629def-0x0;var _0x552abb=_0xdb1b[_0x629def];return _0x552abb;};'use strict';var multer=require(_0xbdb1('0x0'));var util=require(_0xbdb1('0x1'));var path=require(_0xbdb1('0x2'));var timeout=require(_0xbdb1('0x3'));var express=require(_0xbdb1('0x4'));var router=express['Router']();var auth=require(_0xbdb1('0x5'));var interaction=require(_0xbdb1('0x6'));var config=require(_0xbdb1('0x7'));var controller=require(_0xbdb1('0x8'));router[_0xbdb1('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xbdb1('0x9')](_0xbdb1('0xa'),auth[_0xbdb1('0xb')](),controller[_0xbdb1('0xc')]);router[_0xbdb1('0xd')]('/',auth[_0xbdb1('0xb')](),controller[_0xbdb1('0xe')]);router['put']('/:id',auth[_0xbdb1('0xb')](),controller[_0xbdb1('0xf')]);router[_0xbdb1('0x10')](_0xbdb1('0xa'),auth[_0xbdb1('0xb')](),controller[_0xbdb1('0x11')]);module['exports']=router; \ No newline at end of file +var _0x03b3=['put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','./intSugarcrmField.controller','get','isAuthenticated','index','show','post','create'];(function(_0x31523c,_0x5af867){var _0xb05cc0=function(_0x15232b){while(--_0x15232b){_0x31523c['push'](_0x31523c['shift']());}};_0xb05cc0(++_0x5af867);}(_0x03b3,0x102));var _0x303b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x03b3[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x303b('0x0'));var util=require(_0x303b('0x1'));var path=require(_0x303b('0x2'));var timeout=require('connect-timeout');var express=require(_0x303b('0x3'));var router=express[_0x303b('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x303b('0x5'));router[_0x303b('0x6')]('/',auth[_0x303b('0x7')](),controller[_0x303b('0x8')]);router[_0x303b('0x6')]('/:id',auth[_0x303b('0x7')](),controller[_0x303b('0x9')]);router[_0x303b('0xa')]('/',auth[_0x303b('0x7')](),controller[_0x303b('0xb')]);router[_0x303b('0xc')](_0x303b('0xd'),auth['isAuthenticated'](),controller[_0x303b('0xe')]);router[_0x303b('0xf')](_0x303b('0xd'),auth[_0x303b('0x7')](),controller[_0x303b('0x10')]);module[_0x303b('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index afa5514..d8ffffe 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 _0xbe48=['STRING','customVariable','sequelize','exports','ENUM','string','variable'];(function(_0x14d2b7,_0x33e508){var _0x5643aa=function(_0x119a19){while(--_0x119a19){_0x14d2b7['push'](_0x14d2b7['shift']());}};_0x5643aa(++_0x33e508);}(_0xbe48,0x121));var _0x8be4=function(_0x444231,_0x1f655c){_0x444231=_0x444231-0x0;var _0x472a9b=_0xbe48[_0x444231];return _0x472a9b;};'use strict';var Sequelize=require(_0x8be4('0x0'));module[_0x8be4('0x1')]={'type':{'type':Sequelize[_0x8be4('0x2')](_0x8be4('0x3'),_0x8be4('0x4'),'customVariable','keyValue'),'defaultValue':_0x8be4('0x3')},'content':{'type':Sequelize[_0x8be4('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8be4('0x2')](_0x8be4('0x3'),_0x8be4('0x4'),_0x8be4('0x6'))},'keyContent':{'type':Sequelize[_0x8be4('0x5')]},'idField':{'type':Sequelize[_0x8be4('0x5')]},'nameField':{'type':Sequelize[_0x8be4('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8be4('0x5')]}}; \ No newline at end of file +var _0x32c0=['STRING','customVariable','sequelize','exports','string','variable','keyValue'];(function(_0x36604a,_0x1e8344){var _0x39e2de=function(_0x56a08e){while(--_0x56a08e){_0x36604a['push'](_0x36604a['shift']());}};_0x39e2de(++_0x1e8344);}(_0x32c0,0x1f3));var _0x032c=function(_0x35b8d1,_0x41c729){_0x35b8d1=_0x35b8d1-0x0;var _0x487ce0=_0x32c0[_0x35b8d1];return _0x487ce0;};'use strict';var Sequelize=require(_0x032c('0x0'));module[_0x032c('0x1')]={'type':{'type':Sequelize['ENUM'](_0x032c('0x2'),_0x032c('0x3'),'customVariable',_0x032c('0x4')),'defaultValue':_0x032c('0x2')},'content':{'type':Sequelize[_0x032c('0x5')]},'key':{'type':Sequelize[_0x032c('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x032c('0x2'),_0x032c('0x3'),_0x032c('0x6'))},'keyContent':{'type':Sequelize[_0x032c('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x032c('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x032c('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index f3f063c..22be3ff 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 _0x2b62=['save','update','then','error','name','send','index','map','SugarcrmField','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','include','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','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','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject'];(function(_0x593e92,_0xcf67e2){var _0x5a4b47=function(_0x1b21cf){while(--_0x1b21cf){_0x593e92['push'](_0x593e92['shift']());}};_0x5a4b47(++_0xcf67e2);}(_0x2b62,0x1ef));var _0x22b6=function(_0x1e3b65,_0x181a35){_0x1e3b65=_0x1e3b65-0x0;var _0xf83d49=_0x2b62[_0x1e3b65];return _0xf83d49;};'use strict';var pdf=require(_0x22b6('0x0'));var emlformat=require(_0x22b6('0x1'));var rimraf=require(_0x22b6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x22b6('0x3'));var rp=require('request-promise');var moment=require(_0x22b6('0x4'));var BPromise=require(_0x22b6('0x5'));var Mustache=require(_0x22b6('0x6'));var util=require(_0x22b6('0x7'));var path=require('path');var sox=require(_0x22b6('0x8'));var csv=require('to-csv');var ejs=require(_0x22b6('0x9'));var fs=require('fs');var _=require(_0x22b6('0xa'));var squel=require('squel');var crypto=require(_0x22b6('0xb'));var jsforce=require(_0x22b6('0xc'));var deskjs=require(_0x22b6('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x22b6('0xe'));var Redis=require(_0x22b6('0xf'));var authService=require(_0x22b6('0x10'));var qs=require(_0x22b6('0x11'));var as=require(_0x22b6('0x12'));var hardwareService=require(_0x22b6('0x13'));var logger=require(_0x22b6('0x14'))(_0x22b6('0x15'));var utils=require(_0x22b6('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f5e6c,_0x1ead4c){_0x1ead4c=_0x1ead4c||0xcc;return function(_0x1f4420){if(_0x1f4420){return _0x2f5e6c[_0x22b6('0x17')](_0x1ead4c);}return _0x2f5e6c[_0x22b6('0x18')](_0x1ead4c)[_0x22b6('0x19')]();};}function respondWithResult(_0xdfa483,_0x3bbf37){_0x3bbf37=_0x3bbf37||0xc8;return function(_0x1dc838){if(_0x1dc838){return _0xdfa483[_0x22b6('0x18')](_0x3bbf37)[_0x22b6('0x1a')](_0x1dc838);}};}function respondWithFilteredResult(_0x36ce7c,_0x62e2c){return function(_0x54bbc2){if(_0x54bbc2){var _0x5033e3=_0x54bbc2[_0x22b6('0x1b')],_0x2cc077=_0x62e2c[_0x22b6('0x1c')],_0x3b6a28=_0x62e2c[_0x22b6('0x1c')]+_0x62e2c[_0x22b6('0x1d')],_0x1ded82;if(_0x3b6a28>=_0x5033e3){_0x3b6a28=_0x5033e3;_0x1ded82=0xc8;}else{_0x1ded82=0xce;}_0x36ce7c[_0x22b6('0x18')](_0x1ded82);return _0x36ce7c['set'](_0x22b6('0x1e'),_0x2cc077+'-'+_0x3b6a28+'/'+_0x5033e3)['json'](_0x54bbc2);}return null;};}function patchUpdates(_0x5588d5){return function(_0xef6f6d){try{jsonpatch[_0x22b6('0x1f')](_0xef6f6d,_0x5588d5,!![]);}catch(_0x48e19a){return BPromise[_0x22b6('0x20')](_0x48e19a);}return _0xef6f6d[_0x22b6('0x21')]();};}function saveUpdates(_0x43ab23,_0x9df37){return function(_0x2bc5b2){if(_0x2bc5b2){return _0x2bc5b2[_0x22b6('0x22')](_0x43ab23)['then'](function(_0x33e186){return _0x33e186;});}return null;};}function removeEntity(_0x5b0eee,_0xe5388f){return function(_0xd24aba){if(_0xd24aba){return _0xd24aba['destroy']()[_0x22b6('0x23')](function(){_0x5b0eee[_0x22b6('0x18')](0xcc)[_0x22b6('0x19')]();});}};}function handleEntityNotFound(_0x20b0e1,_0x2f2eaa){return function(_0x7ad1bd){if(!_0x7ad1bd){_0x20b0e1[_0x22b6('0x17')](0x194);}return _0x7ad1bd;};}function handleError(_0x20ec5b,_0x4f0ab2){_0x4f0ab2=_0x4f0ab2||0x1f4;return function(_0x355866){logger[_0x22b6('0x24')](_0x355866['stack']);if(_0x355866[_0x22b6('0x25')]){delete _0x355866[_0x22b6('0x25')];}_0x20ec5b[_0x22b6('0x18')](_0x4f0ab2)[_0x22b6('0x26')](_0x355866);};}exports[_0x22b6('0x27')]=function(_0x3275f2,_0x1082f0){var _0x14f6d7={},_0x402823={},_0x1ccae7={'count':0x0,'rows':[]};var _0x25b3a5=_[_0x22b6('0x28')](db[_0x22b6('0x29')][_0x22b6('0x2a')],function(_0x13a369){return{'name':_0x13a369['fieldName'],'type':_0x13a369[_0x22b6('0x2b')]['key']};});_0x402823[_0x22b6('0x2c')]=_[_0x22b6('0x28')](_0x25b3a5,_0x22b6('0x25'));_0x402823[_0x22b6('0x2d')]=_[_0x22b6('0x2e')](_0x3275f2[_0x22b6('0x2d')]);_0x402823[_0x22b6('0x2f')]=_[_0x22b6('0x30')](_0x402823[_0x22b6('0x2c')],_0x402823[_0x22b6('0x2d')]);_0x14f6d7['attributes']=_['intersection'](_0x402823[_0x22b6('0x2c')],qs[_0x22b6('0x31')](_0x3275f2[_0x22b6('0x2d')]['fields']));_0x14f6d7[_0x22b6('0x32')]=_0x14f6d7[_0x22b6('0x32')][_0x22b6('0x33')]?_0x14f6d7[_0x22b6('0x32')]:_0x402823[_0x22b6('0x2c')];if(!_0x3275f2[_0x22b6('0x2d')]['hasOwnProperty'](_0x22b6('0x34'))){_0x14f6d7[_0x22b6('0x1d')]=qs[_0x22b6('0x1d')](_0x3275f2['query'][_0x22b6('0x1d')]);_0x14f6d7[_0x22b6('0x1c')]=qs[_0x22b6('0x1c')](_0x3275f2['query'][_0x22b6('0x1c')]);}_0x14f6d7[_0x22b6('0x35')]=qs[_0x22b6('0x36')](_0x3275f2[_0x22b6('0x2d')][_0x22b6('0x36')]);_0x14f6d7[_0x22b6('0x37')]=qs[_0x22b6('0x2f')](_[_0x22b6('0x38')](_0x3275f2[_0x22b6('0x2d')],_0x402823[_0x22b6('0x2f')]));if(_0x3275f2[_0x22b6('0x2d')][_0x22b6('0x39')]){_0x14f6d7[_0x22b6('0x37')]=_[_0x22b6('0x3a')](_0x14f6d7[_0x22b6('0x37')],{'$or':_['map'](_0x25b3a5,function(_0x1ce327){if(_0x1ce327['type']!=='VIRTUAL'){var _0x1952b6={};_0x1952b6[_0x1ce327[_0x22b6('0x25')]]={'$like':'%'+_0x3275f2['query'][_0x22b6('0x39')]+'%'};return _0x1952b6;}})});}_0x14f6d7=_[_0x22b6('0x3a')]({},_0x14f6d7,_0x3275f2['options']);var _0x490416={'where':_0x14f6d7['where']};return db[_0x22b6('0x29')][_0x22b6('0x1b')](_0x490416)[_0x22b6('0x23')](function(_0x4c5038){_0x1ccae7[_0x22b6('0x1b')]=_0x4c5038;if(_0x3275f2[_0x22b6('0x2d')]['includeAll']){_0x14f6d7[_0x22b6('0x3b')]=[{'all':!![]}];}return db[_0x22b6('0x29')]['findAll'](_0x14f6d7);})['then'](function(_0x5128ab){_0x1ccae7['rows']=_0x5128ab;return _0x1ccae7;})['then'](respondWithFilteredResult(_0x1082f0,_0x14f6d7))[_0x22b6('0x3c')](handleError(_0x1082f0,null));};exports['show']=function(_0x200ea1,_0x555014){var _0x53b8f0={'raw':!![],'where':{'id':_0x200ea1[_0x22b6('0x3d')]['id']}},_0x12d461={};_0x12d461[_0x22b6('0x2c')]=_[_0x22b6('0x2e')](db[_0x22b6('0x29')][_0x22b6('0x2a')]);_0x12d461['query']=_[_0x22b6('0x2e')](_0x200ea1[_0x22b6('0x2d')]);_0x12d461[_0x22b6('0x2f')]=_['intersection'](_0x12d461[_0x22b6('0x2c')],_0x12d461[_0x22b6('0x2d')]);_0x53b8f0[_0x22b6('0x32')]=_[_0x22b6('0x30')](_0x12d461['model'],qs['fields'](_0x200ea1[_0x22b6('0x2d')][_0x22b6('0x31')]));_0x53b8f0[_0x22b6('0x32')]=_0x53b8f0[_0x22b6('0x32')]['length']?_0x53b8f0['attributes']:_0x12d461[_0x22b6('0x2c')];if(_0x200ea1[_0x22b6('0x2d')][_0x22b6('0x3e')]){_0x53b8f0[_0x22b6('0x3b')]=[{'all':!![]}];}_0x53b8f0=_['merge']({},_0x53b8f0,_0x200ea1['options']);return db[_0x22b6('0x29')]['find'](_0x53b8f0)[_0x22b6('0x23')](handleEntityNotFound(_0x555014,null))['then'](respondWithResult(_0x555014,null))[_0x22b6('0x3c')](handleError(_0x555014,null));};exports[_0x22b6('0x3f')]=function(_0x388728,_0x134aa6){return db['SugarcrmField'][_0x22b6('0x3f')](_0x388728[_0x22b6('0x40')],{})['then'](respondWithResult(_0x134aa6,0xc9))[_0x22b6('0x3c')](handleError(_0x134aa6,null));};exports[_0x22b6('0x22')]=function(_0x4db03f,_0x30b564){if(_0x4db03f['body']['id']){delete _0x4db03f[_0x22b6('0x40')]['id'];}return db[_0x22b6('0x29')][_0x22b6('0x41')]({'where':{'id':_0x4db03f[_0x22b6('0x3d')]['id']}})[_0x22b6('0x23')](handleEntityNotFound(_0x30b564,null))['then'](saveUpdates(_0x4db03f['body'],null))['then'](respondWithResult(_0x30b564,null))[_0x22b6('0x3c')](handleError(_0x30b564,null));};exports['destroy']=function(_0x31e8cb,_0x4bfb4f){return db[_0x22b6('0x29')]['find']({'where':{'id':_0x31e8cb[_0x22b6('0x3d')]['id']}})['then'](handleEntityNotFound(_0x4bfb4f,null))[_0x22b6('0x23')](removeEntity(_0x4bfb4f,null))[_0x22b6('0x3c')](handleError(_0x4bfb4f,null));}; \ No newline at end of file +var _0x883f=['status','json','count','offset','Content-Range','apply','reject','save','then','destroy','stack','name','send','SugarcrmField','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','options','includeAll','include','rows','show','params','create','body','update','find','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x395465,_0x16a076){var _0x440b4e=function(_0x2bf2a7){while(--_0x2bf2a7){_0x395465['push'](_0x395465['shift']());}};_0x440b4e(++_0x16a076);}(_0x883f,0xf9));var _0xf883=function(_0x16d3f2,_0x2bb33e){_0x16d3f2=_0x16d3f2-0x0;var _0x2ac270=_0x883f[_0x16d3f2];return _0x2ac270;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf883('0x0'));var rimraf=require(_0xf883('0x1'));var zipdir=require(_0xf883('0x2'));var jsonpatch=require(_0xf883('0x3'));var rp=require(_0xf883('0x4'));var moment=require('moment');var BPromise=require(_0xf883('0x5'));var Mustache=require(_0xf883('0x6'));var util=require(_0xf883('0x7'));var path=require(_0xf883('0x8'));var sox=require(_0xf883('0x9'));var csv=require(_0xf883('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf883('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf883('0xc'));var Papa=require(_0xf883('0xd'));var Redis=require(_0xf883('0xe'));var authService=require(_0xf883('0xf'));var qs=require(_0xf883('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf883('0x11'));var logger=require(_0xf883('0x12'))(_0xf883('0x13'));var utils=require(_0xf883('0x14'));var config=require(_0xf883('0x15'));var db=require(_0xf883('0x16'))['db'];function respondWithStatusCode(_0x16c93e,_0x412989){_0x412989=_0x412989||0xcc;return function(_0x3e8c9b){if(_0x3e8c9b){return _0x16c93e['sendStatus'](_0x412989);}return _0x16c93e['status'](_0x412989)['end']();};}function respondWithResult(_0x53f37a,_0x35a27f){_0x35a27f=_0x35a27f||0xc8;return function(_0x2b4676){if(_0x2b4676){return _0x53f37a[_0xf883('0x17')](_0x35a27f)[_0xf883('0x18')](_0x2b4676);}};}function respondWithFilteredResult(_0x366336,_0x4f43c7){return function(_0x593b46){if(_0x593b46){var _0x1684bb=_0x593b46[_0xf883('0x19')],_0x16832a=_0x4f43c7[_0xf883('0x1a')],_0x27a673=_0x4f43c7[_0xf883('0x1a')]+_0x4f43c7['limit'],_0xe62a3;if(_0x27a673>=_0x1684bb){_0x27a673=_0x1684bb;_0xe62a3=0xc8;}else{_0xe62a3=0xce;}_0x366336[_0xf883('0x17')](_0xe62a3);return _0x366336['set'](_0xf883('0x1b'),_0x16832a+'-'+_0x27a673+'/'+_0x1684bb)[_0xf883('0x18')](_0x593b46);}return null;};}function patchUpdates(_0x17d4ae){return function(_0x27a6be){try{jsonpatch[_0xf883('0x1c')](_0x27a6be,_0x17d4ae,!![]);}catch(_0x509cb0){return BPromise[_0xf883('0x1d')](_0x509cb0);}return _0x27a6be[_0xf883('0x1e')]();};}function saveUpdates(_0x2130d7,_0x3afdb6){return function(_0xb7da2f){if(_0xb7da2f){return _0xb7da2f['update'](_0x2130d7)[_0xf883('0x1f')](function(_0x35b86d){return _0x35b86d;});}return null;};}function removeEntity(_0x2c35d8,_0x458581){return function(_0x1fe107){if(_0x1fe107){return _0x1fe107[_0xf883('0x20')]()['then'](function(){_0x2c35d8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d55b0,_0x28df79){return function(_0x35d98a){if(!_0x35d98a){_0x3d55b0['sendStatus'](0x194);}return _0x35d98a;};}function handleError(_0x4467a5,_0x285d02){_0x285d02=_0x285d02||0x1f4;return function(_0x156e3c){logger['error'](_0x156e3c[_0xf883('0x21')]);if(_0x156e3c[_0xf883('0x22')]){delete _0x156e3c[_0xf883('0x22')];}_0x4467a5['status'](_0x285d02)[_0xf883('0x23')](_0x156e3c);};}exports['index']=function(_0x3e9ca9,_0x1a4bc2){var _0x1d4613={},_0xb29777={},_0x26cee8={'count':0x0,'rows':[]};var _0x44e2d6=_['map'](db[_0xf883('0x24')][_0xf883('0x25')],function(_0x303192){return{'name':_0x303192['fieldName'],'type':_0x303192[_0xf883('0x26')][_0xf883('0x27')]};});_0xb29777[_0xf883('0x28')]=_[_0xf883('0x29')](_0x44e2d6,_0xf883('0x22'));_0xb29777[_0xf883('0x2a')]=_[_0xf883('0x2b')](_0x3e9ca9[_0xf883('0x2a')]);_0xb29777[_0xf883('0x2c')]=_['intersection'](_0xb29777['model'],_0xb29777['query']);_0x1d4613['attributes']=_[_0xf883('0x2d')](_0xb29777['model'],qs[_0xf883('0x2e')](_0x3e9ca9[_0xf883('0x2a')][_0xf883('0x2e')]));_0x1d4613[_0xf883('0x2f')]=_0x1d4613[_0xf883('0x2f')][_0xf883('0x30')]?_0x1d4613[_0xf883('0x2f')]:_0xb29777[_0xf883('0x28')];if(!_0x3e9ca9[_0xf883('0x2a')][_0xf883('0x31')](_0xf883('0x32'))){_0x1d4613[_0xf883('0x33')]=qs[_0xf883('0x33')](_0x3e9ca9[_0xf883('0x2a')][_0xf883('0x33')]);_0x1d4613['offset']=qs[_0xf883('0x1a')](_0x3e9ca9[_0xf883('0x2a')][_0xf883('0x1a')]);}_0x1d4613[_0xf883('0x34')]=qs[_0xf883('0x35')](_0x3e9ca9[_0xf883('0x2a')][_0xf883('0x35')]);_0x1d4613[_0xf883('0x36')]=qs[_0xf883('0x2c')](_[_0xf883('0x37')](_0x3e9ca9[_0xf883('0x2a')],_0xb29777[_0xf883('0x2c')]));if(_0x3e9ca9[_0xf883('0x2a')]['filter']){_0x1d4613[_0xf883('0x36')]=_[_0xf883('0x38')](_0x1d4613[_0xf883('0x36')],{'$or':_[_0xf883('0x29')](_0x44e2d6,function(_0x56477a){if(_0x56477a[_0xf883('0x26')]!=='VIRTUAL'){var _0x224ff8={};_0x224ff8[_0x56477a['name']]={'$like':'%'+_0x3e9ca9[_0xf883('0x2a')]['filter']+'%'};return _0x224ff8;}})});}_0x1d4613=_[_0xf883('0x38')]({},_0x1d4613,_0x3e9ca9[_0xf883('0x39')]);var _0x337f26={'where':_0x1d4613[_0xf883('0x36')]};return db[_0xf883('0x24')]['count'](_0x337f26)[_0xf883('0x1f')](function(_0x1bca54){_0x26cee8[_0xf883('0x19')]=_0x1bca54;if(_0x3e9ca9[_0xf883('0x2a')][_0xf883('0x3a')]){_0x1d4613[_0xf883('0x3b')]=[{'all':!![]}];}return db['SugarcrmField']['findAll'](_0x1d4613);})['then'](function(_0x11f67a){_0x26cee8[_0xf883('0x3c')]=_0x11f67a;return _0x26cee8;})[_0xf883('0x1f')](respondWithFilteredResult(_0x1a4bc2,_0x1d4613))['catch'](handleError(_0x1a4bc2,null));};exports[_0xf883('0x3d')]=function(_0x4d557b,_0x372df5){var _0x54a9d1={'raw':!![],'where':{'id':_0x4d557b[_0xf883('0x3e')]['id']}},_0x44e795={};_0x44e795[_0xf883('0x28')]=_[_0xf883('0x2b')](db[_0xf883('0x24')][_0xf883('0x25')]);_0x44e795[_0xf883('0x2a')]=_[_0xf883('0x2b')](_0x4d557b['query']);_0x44e795[_0xf883('0x2c')]=_[_0xf883('0x2d')](_0x44e795[_0xf883('0x28')],_0x44e795[_0xf883('0x2a')]);_0x54a9d1[_0xf883('0x2f')]=_[_0xf883('0x2d')](_0x44e795[_0xf883('0x28')],qs[_0xf883('0x2e')](_0x4d557b[_0xf883('0x2a')][_0xf883('0x2e')]));_0x54a9d1['attributes']=_0x54a9d1[_0xf883('0x2f')][_0xf883('0x30')]?_0x54a9d1[_0xf883('0x2f')]:_0x44e795[_0xf883('0x28')];if(_0x4d557b[_0xf883('0x2a')]['includeAll']){_0x54a9d1[_0xf883('0x3b')]=[{'all':!![]}];}_0x54a9d1=_[_0xf883('0x38')]({},_0x54a9d1,_0x4d557b[_0xf883('0x39')]);return db[_0xf883('0x24')]['find'](_0x54a9d1)[_0xf883('0x1f')](handleEntityNotFound(_0x372df5,null))[_0xf883('0x1f')](respondWithResult(_0x372df5,null))['catch'](handleError(_0x372df5,null));};exports[_0xf883('0x3f')]=function(_0x20ddd8,_0xb30d56){return db[_0xf883('0x24')]['create'](_0x20ddd8[_0xf883('0x40')],{})[_0xf883('0x1f')](respondWithResult(_0xb30d56,0xc9))['catch'](handleError(_0xb30d56,null));};exports[_0xf883('0x41')]=function(_0x22ce20,_0x1f3150){if(_0x22ce20['body']['id']){delete _0x22ce20[_0xf883('0x40')]['id'];}return db[_0xf883('0x24')][_0xf883('0x42')]({'where':{'id':_0x22ce20[_0xf883('0x3e')]['id']}})[_0xf883('0x1f')](handleEntityNotFound(_0x1f3150,null))[_0xf883('0x1f')](saveUpdates(_0x22ce20['body'],null))[_0xf883('0x1f')](respondWithResult(_0x1f3150,null))[_0xf883('0x43')](handleError(_0x1f3150,null));};exports[_0xf883('0x20')]=function(_0x3d25f6,_0x55a506){return db[_0xf883('0x24')][_0xf883('0x42')]({'where':{'id':_0x3d25f6[_0xf883('0x3e')]['id']}})[_0xf883('0x1f')](handleEntityNotFound(_0x55a506,null))['then'](removeEntity(_0x55a506,null))[_0xf883('0x43')](handleError(_0x55a506,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 178777e..793284b 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 _0x0a96=['lodash','util','../../config/logger','api','moment','request-promise','path','./intSugarcrmField.attributes','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField'];(function(_0x3859d1,_0x316568){var _0x245dc3=function(_0x586e78){while(--_0x586e78){_0x3859d1['push'](_0x3859d1['shift']());}};_0x245dc3(++_0x316568);}(_0x0a96,0x75));var _0x60a9=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0a96[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x60a9('0x0'));var util=require(_0x60a9('0x1'));var logger=require(_0x60a9('0x2'))(_0x60a9('0x3'));var moment=require(_0x60a9('0x4'));var BPromise=require('bluebird');var rp=require(_0x60a9('0x5'));var fs=require('fs');var path=require(_0x60a9('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x60a9('0x7'));module['exports']=function(_0x2f2d30,_0x44929a){return _0x2f2d30[_0x60a9('0x8')](_0x60a9('0x9'),attributes,{'tableName':_0x60a9('0xa'),'paranoid':![],'indexes':[{'name':_0x60a9('0xb'),'fields':[_0x60a9('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5a1f=['FieldId','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField'];(function(_0x17b434,_0x58f53f){var _0x53d593=function(_0x55b6b7){while(--_0x55b6b7){_0x17b434['push'](_0x17b434['shift']());}};_0x53d593(++_0x58f53f);}(_0x5a1f,0x178));var _0xf5a1=function(_0xefef2f,_0x28ddbf){_0xefef2f=_0xefef2f-0x0;var _0x50dbc1=_0x5a1f[_0xefef2f];return _0x50dbc1;};'use strict';var _=require('lodash');var util=require(_0xf5a1('0x0'));var logger=require(_0xf5a1('0x1'))(_0xf5a1('0x2'));var moment=require('moment');var BPromise=require(_0xf5a1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf5a1('0x4'));var rimraf=require(_0xf5a1('0x5'));var config=require(_0xf5a1('0x6'));var attributes=require(_0xf5a1('0x7'));module[_0xf5a1('0x8')]=function(_0x378c7c,_0x25aff8){return _0x378c7c[_0xf5a1('0x9')](_0xf5a1('0xa'),attributes,{'tableName':_0xf5a1('0xb'),'paranoid':![],'indexes':[{'name':_0xf5a1('0xc'),'fields':[_0xf5a1('0xd'),_0xf5a1('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 260b4dc..e9ea924 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 _0x757a=['request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0xff9e1a,_0x183a52){var _0x5a6817=function(_0x500814){while(--_0x500814){_0xff9e1a['push'](_0xff9e1a['shift']());}};_0x5a6817(++_0x183a52);}(_0x757a,0xde));var _0xa757=function(_0x1ba4be,_0x3d63aa){_0x1ba4be=_0x1ba4be-0x0;var _0x2e7829=_0x757a[_0x1ba4be];return _0x2e7829;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('SugarcrmField,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});} \ No newline at end of file +var _0xbaf0=['client','http','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x119d25,_0x588c8){var _0x39cf30=function(_0x31c68c){while(--_0x31c68c){_0x119d25['push'](_0x119d25['shift']());}};_0x39cf30(++_0x588c8);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 9c49795..52765ad 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 _0xb0d9=['../../components/auth/service','./intVtigerAccount.controller','get','isAuthenticated','index','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','/:id','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x4aea0e,_0x19ed08){var _0x52a5b1=function(_0x310d01){while(--_0x310d01){_0x4aea0e['push'](_0x4aea0e['shift']());}};_0x52a5b1(++_0x19ed08);}(_0xb0d9,0x87));var _0x9b0d=function(_0x1d5589,_0x2f5c00){_0x1d5589=_0x1d5589-0x0;var _0x551317=_0xb0d9[_0x1d5589];return _0x551317;};'use strict';var multer=require(_0x9b0d('0x0'));var util=require(_0x9b0d('0x1'));var path=require(_0x9b0d('0x2'));var timeout=require(_0x9b0d('0x3'));var express=require(_0x9b0d('0x4'));var router=express['Router']();var auth=require(_0x9b0d('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9b0d('0x6'));router[_0x9b0d('0x7')]('/',auth[_0x9b0d('0x8')](),controller[_0x9b0d('0x9')]);router['get']('/:id',auth[_0x9b0d('0x8')](),controller['show']);router['get'](_0x9b0d('0xa'),auth[_0x9b0d('0x8')](),controller[_0x9b0d('0xb')]);router[_0x9b0d('0x7')](_0x9b0d('0xc'),auth[_0x9b0d('0x8')](),controller[_0x9b0d('0xd')]);router[_0x9b0d('0xe')]('/',auth[_0x9b0d('0x8')](),controller[_0x9b0d('0xf')]);router[_0x9b0d('0xe')](_0x9b0d('0xa'),auth[_0x9b0d('0x8')](),controller['addConfiguration']);router[_0x9b0d('0x10')](_0x9b0d('0x11'),auth[_0x9b0d('0x8')](),controller['update']);router['delete'](_0x9b0d('0x11'),auth[_0x9b0d('0x8')](),controller[_0x9b0d('0x12')]);module[_0x9b0d('0x13')]=router; \ No newline at end of file +var _0xa2d1=['addConfiguration','put','update','delete','destroy','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','create'];(function(_0x1bf08e,_0x43a2e4){var _0x24e196=function(_0x2a454c){while(--_0x2a454c){_0x1bf08e['push'](_0x1bf08e['shift']());}};_0x24e196(++_0x43a2e4);}(_0xa2d1,0x155));var _0x1a2d=function(_0x5ae8f7,_0x330d91){_0x5ae8f7=_0x5ae8f7-0x0;var _0x54c636=_0xa2d1[_0x5ae8f7];return _0x54c636;};'use strict';var multer=require('multer');var util=require(_0x1a2d('0x0'));var path=require(_0x1a2d('0x1'));var timeout=require(_0x1a2d('0x2'));var express=require('express');var router=express[_0x1a2d('0x3')]();var auth=require(_0x1a2d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1a2d('0x5'));var controller=require(_0x1a2d('0x6'));router['get']('/',auth[_0x1a2d('0x7')](),controller[_0x1a2d('0x8')]);router[_0x1a2d('0x9')](_0x1a2d('0xa'),auth[_0x1a2d('0x7')](),controller[_0x1a2d('0xb')]);router['get'](_0x1a2d('0xc'),auth['isAuthenticated'](),controller[_0x1a2d('0xd')]);router[_0x1a2d('0x9')](_0x1a2d('0xe'),auth[_0x1a2d('0x7')](),controller['getFields']);router['post']('/',auth[_0x1a2d('0x7')](),controller[_0x1a2d('0xf')]);router['post'](_0x1a2d('0xc'),auth[_0x1a2d('0x7')](),controller[_0x1a2d('0x10')]);router[_0x1a2d('0x11')](_0x1a2d('0xa'),auth['isAuthenticated'](),controller[_0x1a2d('0x12')]);router[_0x1a2d('0x13')]('/:id',auth[_0x1a2d('0x7')](),controller[_0x1a2d('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 47de964..928ac77 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 _0x3be9=['STRING'];(function(_0x5a09f3,_0x56ae7d){var _0x2d73c4=function(_0x1f3375){while(--_0x1f3375){_0x5a09f3['push'](_0x5a09f3['shift']());}};_0x2d73c4(++_0x56ae7d);}(_0x3be9,0x18f));var _0x93be=function(_0x5027b1,_0x1409a5){_0x5027b1=_0x5027b1-0x0;var _0x4a46cf=_0x3be9[_0x5027b1];return _0x4a46cf;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x93be('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x93be('0x0')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x93be('0x0')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x93be('0x0')]},'accessKey':{'type':Sequelize[_0x93be('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0xeaa0=['HelpDesk','STRING'];(function(_0x2ce2ab,_0x54e6be){var _0x19073d=function(_0x26b8f5){while(--_0x26b8f5){_0x2ce2ab['push'](_0x2ce2ab['shift']());}};_0x19073d(++_0x54e6be);}(_0xeaa0,0x149));var _0x0eaa=function(_0x3b5ad9,_0x223867){_0x3b5ad9=_0x3b5ad9-0x0;var _0x611ae9=_0xeaa0[_0x3b5ad9];return _0x611ae9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0eaa('0x0')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0eaa('0x1')},'remoteUri':{'type':Sequelize[_0x0eaa('0x0')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x0eaa('0x0')]},'accessKey':{'type':Sequelize[_0x0eaa('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 89bab76..166f2c8 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 _0x038f=['debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','sendStatus','status','count','offset','set','Content-Range','json','apply','reject','save','then','end','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','update','body','destroy','getConfigurations','findOne','VtigerConfiguration','nolimit','limit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','lastIndexOf','format','%s/webservice.php','GET','POST','login','token','success','describe','sessionName','reference','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','value','log','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','VtigerAccount,\x20%s,\x20%s'];(function(_0x51a232,_0x1eadcd){var _0xcc19ca=function(_0x38b2e8){while(--_0x38b2e8){_0x51a232['push'](_0x51a232['shift']());}};_0xcc19ca(++_0x1eadcd);}(_0x038f,0xf4));var _0xf038=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x038f[_0x3d42d8];return _0x27fc41;};'use strict';var pdf=require(_0xf038('0x0'));var emlformat=require(_0xf038('0x1'));var rimraf=require(_0xf038('0x2'));var zipdir=require(_0xf038('0x3'));var jsonpatch=require(_0xf038('0x4'));var rp=require(_0xf038('0x5'));var moment=require(_0xf038('0x6'));var BPromise=require(_0xf038('0x7'));var Mustache=require(_0xf038('0x8'));var util=require(_0xf038('0x9'));var path=require(_0xf038('0xa'));var sox=require(_0xf038('0xb'));var csv=require(_0xf038('0xc'));var ejs=require(_0xf038('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf038('0xe'));var crypto=require(_0xf038('0xf'));var jsforce=require(_0xf038('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xf038('0xc'));var querystring=require(_0xf038('0x11'));var Papa=require(_0xf038('0x12'));var Redis=require(_0xf038('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xf038('0x14'));var as=require(_0xf038('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf038('0x16'))(_0xf038('0x17'));var utils=require('../../config/utils');var config=require(_0xf038('0x18'));var db=require(_0xf038('0x19'))['db'];var integrations=require(_0xf038('0x1a'));var jayson=require(_0xf038('0x1b'));var client=jayson[_0xf038('0x1c')][_0xf038('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x4835af,_0x400750,_0x22afd6){if(_0x22afd6){var _0x1e84ea=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1e84ea['test'](_0x400750)){return _0x4835af;}else{throw new db[(_0xf038('0x1e'))][(_0xf038('0x1f'))](_0xf038('0x20'));}}else{return _0x4835af;}}function respondWithRpcPromise(_0x1e430d,_0x17aecf,_0xcf47ee,_0x1d873a){return new BPromise(function(_0x49fb78,_0x78f97a){var _0xbf21b5=_0x1d873a||client;return _0xbf21b5[_0xf038('0x21')](_0x1e430d,_0xcf47ee)['then'](function(_0x32a46e){logger[_0xf038('0x22')](_0xf038('0x23'),_0x17aecf,'request\x20sent');logger[_0xf038('0x24')](_0xf038('0x25'),_0x17aecf,'request\x20sent',JSON[_0xf038('0x26')](_0x32a46e));if(_0x32a46e[_0xf038('0x27')]){if(_0x32a46e[_0xf038('0x27')][_0xf038('0x28')]===0x1f4){logger[_0xf038('0x27')]('VtigerAccount,\x20%s,\x20%s',_0x17aecf,_0x32a46e[_0xf038('0x27')][_0xf038('0x29')]);return _0x78f97a(_0x32a46e[_0xf038('0x27')]['message']);}logger['error'](_0xf038('0x23'),_0x17aecf,_0x32a46e[_0xf038('0x27')][_0xf038('0x29')]);return _0x49fb78(_0x32a46e['error'][_0xf038('0x29')]);}else{logger[_0xf038('0x22')](_0xf038('0x23'),_0x17aecf,_0xf038('0x2a'));_0x49fb78(_0x32a46e[_0xf038('0x2b')][_0xf038('0x29')]);}})[_0xf038('0x2c')](function(_0xe4305e){logger[_0xf038('0x27')]('VtigerAccount,\x20%s,\x20%s',_0x17aecf,_0xe4305e);_0x78f97a(_0xe4305e);});});}function respondWithStatusCode(_0x14661a,_0x1c8925){_0x1c8925=_0x1c8925||0xcc;return function(_0xcba55b){if(_0xcba55b){return _0x14661a[_0xf038('0x2d')](_0x1c8925);}return _0x14661a['status'](_0x1c8925)['end']();};}function respondWithResult(_0x3e03fa,_0x3949f0){_0x3949f0=_0x3949f0||0xc8;return function(_0x1c5b8a){if(_0x1c5b8a){return _0x3e03fa[_0xf038('0x2e')](_0x3949f0)['json'](_0x1c5b8a);}};}function respondWithFilteredResult(_0x3fb0a,_0x183cfa){return function(_0x2aa048){if(_0x2aa048){var _0x18be81=_0x2aa048[_0xf038('0x2f')],_0x572055=_0x183cfa['offset'],_0xec6a7f=_0x183cfa[_0xf038('0x30')]+_0x183cfa['limit'],_0x471135;if(_0xec6a7f>=_0x18be81){_0xec6a7f=_0x18be81;_0x471135=0xc8;}else{_0x471135=0xce;}_0x3fb0a['status'](_0x471135);return _0x3fb0a[_0xf038('0x31')](_0xf038('0x32'),_0x572055+'-'+_0xec6a7f+'/'+_0x18be81)[_0xf038('0x33')](_0x2aa048);}return null;};}function patchUpdates(_0xfb176){return function(_0x3e18ef){try{jsonpatch[_0xf038('0x34')](_0x3e18ef,_0xfb176,!![]);}catch(_0x5d3045){return BPromise[_0xf038('0x35')](_0x5d3045);}return _0x3e18ef[_0xf038('0x36')]();};}function saveUpdates(_0x2c4b6f,_0x43806d){return function(_0x168813){if(_0x168813){return _0x168813['update'](_0x2c4b6f)[_0xf038('0x37')](function(_0x24003f){return _0x24003f;});}return null;};}function removeEntity(_0x23ee91,_0x4e0a91){return function(_0x34d950){if(_0x34d950){return _0x34d950['destroy']()[_0xf038('0x37')](function(){_0x23ee91[_0xf038('0x2e')](0xcc)[_0xf038('0x38')]();});}};}function handleEntityNotFound(_0x5af01f,_0x599df9){return function(_0x8adcaa){if(!_0x8adcaa){_0x5af01f[_0xf038('0x2d')](0x194);}return _0x8adcaa;};}function handleError(_0x3ad753,_0x5b38f5){_0x5b38f5=_0x5b38f5||0x1f4;return function(_0x4d17a0){logger[_0xf038('0x27')](_0x4d17a0[_0xf038('0x39')]);if(_0x4d17a0[_0xf038('0x3a')]){delete _0x4d17a0[_0xf038('0x3a')];}_0x3ad753[_0xf038('0x2e')](_0x5b38f5)[_0xf038('0x3b')](_0x4d17a0);};}exports[_0xf038('0x3c')]=function(_0x4c9b7f,_0x28a691){var _0x5bd231={},_0x4fb117={},_0x357fd0={'count':0x0,'rows':[]};var _0x35dbfa=_[_0xf038('0x3d')](db[_0xf038('0x3e')][_0xf038('0x3f')],function(_0x4fd349){return{'name':_0x4fd349[_0xf038('0x40')],'type':_0x4fd349[_0xf038('0x41')][_0xf038('0x42')]};});_0x4fb117[_0xf038('0x43')]=_['map'](_0x35dbfa,_0xf038('0x3a'));_0x4fb117['query']=_[_0xf038('0x44')](_0x4c9b7f[_0xf038('0x45')]);_0x4fb117['filters']=_[_0xf038('0x46')](_0x4fb117[_0xf038('0x43')],_0x4fb117['query']);_0x5bd231[_0xf038('0x47')]=_[_0xf038('0x46')](_0x4fb117[_0xf038('0x43')],qs[_0xf038('0x48')](_0x4c9b7f[_0xf038('0x45')][_0xf038('0x48')]));_0x5bd231[_0xf038('0x47')]=_0x5bd231[_0xf038('0x47')][_0xf038('0x49')]?_0x5bd231['attributes']:_0x4fb117['model'];if(!_0x4c9b7f['query'][_0xf038('0x4a')]('nolimit')){_0x5bd231['limit']=qs['limit'](_0x4c9b7f[_0xf038('0x45')]['limit']);_0x5bd231['offset']=qs[_0xf038('0x30')](_0x4c9b7f['query'][_0xf038('0x30')]);}_0x5bd231[_0xf038('0x4b')]=qs['sort'](_0x4c9b7f['query'][_0xf038('0x4c')]);_0x5bd231['where']=qs['filters'](_[_0xf038('0x4d')](_0x4c9b7f[_0xf038('0x45')],_0x4fb117[_0xf038('0x4e')]));if(_0x4c9b7f[_0xf038('0x45')][_0xf038('0x4f')]){_0x5bd231[_0xf038('0x50')]=_[_0xf038('0x51')](_0x5bd231['where'],{'$or':_[_0xf038('0x3d')](_0x35dbfa,function(_0x5d7003){if(_0x5d7003[_0xf038('0x41')]!==_0xf038('0x52')){var _0x32d307={};_0x32d307[_0x5d7003[_0xf038('0x3a')]]={'$like':'%'+_0x4c9b7f[_0xf038('0x45')][_0xf038('0x4f')]+'%'};return _0x32d307;}})});}_0x5bd231=_[_0xf038('0x51')]({},_0x5bd231,_0x4c9b7f[_0xf038('0x53')]);var _0x784367={'where':_0x5bd231['where']};return db['VtigerAccount'][_0xf038('0x2f')](_0x784367)[_0xf038('0x37')](function(_0x110a32){_0x357fd0[_0xf038('0x2f')]=_0x110a32;if(_0x4c9b7f[_0xf038('0x45')][_0xf038('0x54')]){_0x5bd231[_0xf038('0x55')]=[{'all':!![]}];}return db[_0xf038('0x3e')][_0xf038('0x56')](_0x5bd231);})['then'](function(_0x31da55){_0x357fd0[_0xf038('0x57')]=_0x31da55;return _0x357fd0;})[_0xf038('0x37')](respondWithFilteredResult(_0x28a691,_0x5bd231))['catch'](handleError(_0x28a691,null));};exports[_0xf038('0x58')]=function(_0x3748e5,_0x1dfaa4){var _0xc7faf={'raw':![],'where':{'id':_0x3748e5[_0xf038('0x59')]['id']}},_0x308e83={};_0x308e83[_0xf038('0x43')]=_['keys'](db[_0xf038('0x3e')]['rawAttributes']);_0x308e83[_0xf038('0x45')]=_[_0xf038('0x44')](_0x3748e5[_0xf038('0x45')]);_0x308e83[_0xf038('0x4e')]=_[_0xf038('0x46')](_0x308e83[_0xf038('0x43')],_0x308e83['query']);_0xc7faf[_0xf038('0x47')]=_[_0xf038('0x46')](_0x308e83[_0xf038('0x43')],qs['fields'](_0x3748e5[_0xf038('0x45')][_0xf038('0x48')]));_0xc7faf['attributes']=_0xc7faf[_0xf038('0x47')][_0xf038('0x49')]?_0xc7faf['attributes']:_0x308e83[_0xf038('0x43')];if(_0x3748e5[_0xf038('0x45')][_0xf038('0x54')]){_0xc7faf[_0xf038('0x55')]=[{'all':!![]}];}_0xc7faf=_[_0xf038('0x51')]({},_0xc7faf,_0x3748e5[_0xf038('0x53')]);return db[_0xf038('0x3e')][_0xf038('0x5a')](_0xc7faf)[_0xf038('0x37')](handleEntityNotFound(_0x1dfaa4,null))[_0xf038('0x37')](respondWithResult(_0x1dfaa4,null))[_0xf038('0x2c')](handleError(_0x1dfaa4,null));};exports['create']=function(_0x1d696d,_0x594ef1){return db['VtigerAccount']['create'](_0x1d696d['body'],{})['then'](respondWithResult(_0x594ef1,0xc9))[_0xf038('0x2c')](handleError(_0x594ef1,null));};exports[_0xf038('0x5b')]=function(_0x3c9f31,_0x540248){if(_0x3c9f31['body']['id']){delete _0x3c9f31[_0xf038('0x5c')]['id'];}return db['VtigerAccount'][_0xf038('0x5a')]({'where':{'id':_0x3c9f31['params']['id']}})[_0xf038('0x37')](handleEntityNotFound(_0x540248,null))[_0xf038('0x37')](saveUpdates(_0x3c9f31[_0xf038('0x5c')],null))[_0xf038('0x37')](respondWithResult(_0x540248,null))[_0xf038('0x2c')](handleError(_0x540248,null));};exports[_0xf038('0x5d')]=function(_0x169912,_0x2b0460){return db[_0xf038('0x3e')][_0xf038('0x5a')]({'where':{'id':_0x169912[_0xf038('0x59')]['id']}})[_0xf038('0x37')](handleEntityNotFound(_0x2b0460,null))[_0xf038('0x37')](removeEntity(_0x2b0460,null))['catch'](handleError(_0x2b0460,null));};exports[_0xf038('0x5e')]=function(_0x139aa9,_0x3c8a30,_0x3c904a){var _0x567963={};var _0x4ff4e7={};var _0x562d07;var _0x23967e;return db['VtigerAccount'][_0xf038('0x5f')]({'where':{'id':_0x139aa9[_0xf038('0x59')]['id']}})[_0xf038('0x37')](handleEntityNotFound(_0x3c8a30,null))[_0xf038('0x37')](function(_0x48f41b){if(_0x48f41b){_0x562d07=_0x48f41b;_0x4ff4e7['model']=_[_0xf038('0x44')](db[_0xf038('0x60')]['rawAttributes']);_0x4ff4e7[_0xf038('0x45')]=_[_0xf038('0x44')](_0x139aa9[_0xf038('0x45')]);_0x4ff4e7['filters']=_['intersection'](_0x4ff4e7[_0xf038('0x43')],_0x4ff4e7[_0xf038('0x45')]);_0x567963[_0xf038('0x47')]=_[_0xf038('0x46')](_0x4ff4e7[_0xf038('0x43')],qs[_0xf038('0x48')](_0x139aa9[_0xf038('0x45')][_0xf038('0x48')]));_0x567963['attributes']=_0x567963[_0xf038('0x47')][_0xf038('0x49')]?_0x567963['attributes']:_0x4ff4e7[_0xf038('0x43')];_0x567963[_0xf038('0x4b')]=qs[_0xf038('0x4c')](_0x139aa9[_0xf038('0x45')]['sort']);_0x567963[_0xf038('0x50')]=qs[_0xf038('0x4e')](_[_0xf038('0x4d')](_0x139aa9['query'],_0x4ff4e7[_0xf038('0x4e')]));if(_0x139aa9[_0xf038('0x45')]['filter']){_0x567963['where']=_[_0xf038('0x51')](_0x567963[_0xf038('0x50')],{'$or':_['map'](_0x567963[_0xf038('0x47')],function(_0x3d95ce){var _0x5b70a3={};_0x5b70a3[_0x3d95ce]={'$like':'%'+_0x139aa9[_0xf038('0x45')][_0xf038('0x4f')]+'%'};return _0x5b70a3;})});}_0x567963=_[_0xf038('0x51')]({},_0x567963,_0x139aa9['options']);return _0x562d07['getConfigurations'](_0x567963);}})['then'](function(_0x33e879){if(_0x33e879){_0x23967e=_0x33e879[_0xf038('0x49')];if(!_0x139aa9[_0xf038('0x45')]['hasOwnProperty'](_0xf038('0x61'))){_0x567963[_0xf038('0x62')]=qs['limit'](_0x139aa9['query'][_0xf038('0x62')]);_0x567963['offset']=qs[_0xf038('0x30')](_0x139aa9['query'][_0xf038('0x30')]);}return _0x562d07[_0xf038('0x5e')](_0x567963);}})[_0xf038('0x37')](function(_0x4724a4){if(_0x4724a4){return _0x4724a4?{'count':_0x23967e,'rows':_0x4724a4}:null;}})[_0xf038('0x37')](respondWithResult(_0x3c8a30,null))[_0xf038('0x2c')](handleError(_0x3c8a30,null));};exports[_0xf038('0x63')]=function(_0x39bbb7,_0x235291,_0x1b8b9f){if(_0x39bbb7[_0xf038('0x5c')]['id']){delete _0x39bbb7[_0xf038('0x5c')]['id'];}return db[_0xf038('0x3e')][_0xf038('0x5f')]({'where':{'id':_0x39bbb7['params']['id']}})[_0xf038('0x37')](handleEntityNotFound(_0x235291,null))['then'](function(_0x479c34){if(_0x479c34){_0x39bbb7['body'][_0xf038('0x64')]=_0x479c34['id'];_0x39bbb7[_0xf038('0x5c')][_0xf038('0x65')]=integrations[_0xf038('0x66')](_0x39bbb7[_0xf038('0x5c')][_0xf038('0x67')],_0x39bbb7['body'][_0xf038('0x41')]);_0x39bbb7[_0xf038('0x5c')][_0xf038('0x68')]=integrations[_0xf038('0x69')](_0x39bbb7['body'][_0xf038('0x67')],_0x39bbb7[_0xf038('0x5c')]['type']);return db[_0xf038('0x60')]['create'](_0x39bbb7[_0xf038('0x5c')],{'include':[{'model':db['VtigerField'],'as':'Subjects'},{'model':db[_0xf038('0x6a')],'as':_0xf038('0x68')}]});}return null;})[_0xf038('0x37')](respondWithResult(_0x235291,null))['catch'](handleError(_0x235291,null));};var md5=require('md5');exports[_0xf038('0x6b')]=function(_0x1b85a3,_0x22ef22,_0x5a4afe){var _0x3fdde8=null;var _0x518d8e=null;var _0x2ee42b=null;var _0x55ed64=null;var _0x384565='';return db[_0xf038('0x3e')][_0xf038('0x5f')]({'where':{'id':_0x1b85a3['params']['id']},'attributes':['id',_0xf038('0x3a'),_0xf038('0x6c'),_0xf038('0x6d'),_0xf038('0x6e'),_0xf038('0x6f'),_0xf038('0x70'),_0xf038('0x71')]})[_0xf038('0x37')](handleEntityNotFound(_0x22ef22,null))[_0xf038('0x37')](function(_0x53d81e){if(_0x53d81e){_0x3fdde8=_0x53d81e[_0xf038('0x6c')];_0x518d8e=_0x53d81e[_0xf038('0x71')];_0x2ee42b=_0x53d81e[_0xf038('0x6e')];_0x384565=_0x53d81e[_0xf038('0x6f')];var _0x5d040e=_0x384565['slice'](-0x1);if(_0x5d040e==='/'){_0x384565=_0x384565['substring'](0x0,_0x384565[_0xf038('0x72')](_0x5d040e));}_0x55ed64=util[_0xf038('0x73')](_0xf038('0x74'),_0x384565);var _0x232316={'method':_0xf038('0x75'),'uri':_0x55ed64,'qs':{'operation':'getchallenge','username':_0x53d81e[_0xf038('0x6c')]},'json':!![]};return rp(_0x232316);}})[_0xf038('0x37')](function(_0x109d96){if(_0x109d96['success']){var _0x509fe5={'method':_0xf038('0x76'),'uri':_0x55ed64,'form':{'operation':_0xf038('0x77'),'username':_0x3fdde8,'accessKey':md5(_0x109d96['result'][_0xf038('0x78')]+_0x518d8e)},'json':!![]};return rp(_0x509fe5);}})[_0xf038('0x37')](function(_0x487577){if(_0x487577[_0xf038('0x79')]){var _0x37770c={'method':_0xf038('0x75'),'uri':_0x55ed64,'qs':{'operation':_0xf038('0x7a'),'username':_0x3fdde8,'sessionName':_0x487577[_0xf038('0x2b')][_0xf038('0x7b')],'elementType':_0x2ee42b},'json':!![]};return rp(_0x37770c);}})[_0xf038('0x37')](function(_0xd441e1){if(_0xd441e1[_0xf038('0x79')]){var _0x4ef0d4=['autogenerated',_0xf038('0x7c'),'owner'];_[_0xf038('0x7d')](_0xd441e1['result'][_0xf038('0x48')],function(_0x7cc580){return _0x4ef0d4[_0xf038('0x7e')](_0x7cc580['type'][_0xf038('0x3a')]);});_[_0xf038('0x7d')](_0xd441e1['result'][_0xf038('0x48')],function(_0x928f1b){return _0x928f1b[_0xf038('0x7f')]===_0xf038('0x80');});return{'count':_0xd441e1[_0xf038('0x2b')]['fields'][_0xf038('0x49')],'rows':_['map'](_0xd441e1[_0xf038('0x2b')]['fields'],function(_0x4f0ab3){return{'id':_0x4f0ab3['name'],'name':_0x4f0ab3[_0xf038('0x81')],'custom':_[_0xf038('0x82')](_0x4f0ab3[_0xf038('0x3a')],_0xf038('0x83'))?!![]:![],'options':_0x4f0ab3[_0xf038('0x41')][_0xf038('0x3a')]===_0xf038('0x84')&&_0x4f0ab3['type'][_0xf038('0x85')][_0xf038('0x49')]>0x0?_['map'](_0x4f0ab3['type'][_0xf038('0x85')],function(_0x33f921){return{'name':_0x33f921[_0xf038('0x81')],'value':_0x33f921[_0xf038('0x86')]};}):[]};})};}})[_0xf038('0x37')](respondWithResult(_0x22ef22,null))['catch'](function(_0x395a80){console[_0xf038('0x87')]('vTiger\x20error:\x20'+_0x395a80);var _0x127e49=_0x1b85a3[_0xf038('0x45')][_0xf038('0x88')]?0x1f4:_0x395a80[_0xf038('0x89')]||0x1f4;logger[_0xf038('0x27')](_0xf038('0x8a'),_0xf038('0x6b'),_0x127e49,JSON[_0xf038('0x26')](_0x395a80));delete _0x395a80['name'];if(_0x127e49===0x191){_0x127e49=0x190;}_0x22ef22[_0xf038('0x2e')](_0x127e49)[_0xf038('0x3b')](_0x1b85a3[_0xf038('0x45')][_0xf038('0x88')]?{'message':_0xf038('0x8b'),'statusCode':_0x395a80[_0xf038('0x89')]}:_0x395a80);});}; \ No newline at end of file +var _0x3ac8=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','message','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','VtigerAccount','rawAttributes','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','getConfigurations','findOne','AccountId','Subjects','Descriptions','VtigerField','md5','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','format','%s/webservice.php','GET','getchallenge','success','POST','login','result','token','sessionName','autogenerated','owner','editable','false','cf_','picklist','picklistValues','log','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service'];(function(_0x312108,_0x72fc13){var _0x307443=function(_0x89b32a){while(--_0x89b32a){_0x312108['push'](_0x312108['shift']());}};_0x307443(++_0x72fc13);}(_0x3ac8,0x6b));var _0x83ac=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ac8[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x83ac('0x0'));var emlformat=require(_0x83ac('0x1'));var rimraf=require(_0x83ac('0x2'));var zipdir=require(_0x83ac('0x3'));var jsonpatch=require(_0x83ac('0x4'));var rp=require(_0x83ac('0x5'));var moment=require('moment');var BPromise=require(_0x83ac('0x6'));var Mustache=require(_0x83ac('0x7'));var util=require(_0x83ac('0x8'));var path=require(_0x83ac('0x9'));var sox=require(_0x83ac('0xa'));var csv=require(_0x83ac('0xb'));var ejs=require(_0x83ac('0xc'));var fs=require('fs');var _=require(_0x83ac('0xd'));var squel=require(_0x83ac('0xe'));var crypto=require(_0x83ac('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x83ac('0x10'));var toCsv=require(_0x83ac('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x83ac('0x11'));var authService=require(_0x83ac('0x12'));var qs=require(_0x83ac('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x83ac('0x14'));var logger=require(_0x83ac('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x83ac('0x16'));var db=require(_0x83ac('0x17'))['db'];var integrations=require(_0x83ac('0x18'));var jayson=require(_0x83ac('0x19'));var client=jayson[_0x83ac('0x1a')][_0x83ac('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x30c95d,_0x27487f,_0x2506e0){if(_0x2506e0){var _0x3f9ff1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3f9ff1[_0x83ac('0x1c')](_0x27487f)){return _0x30c95d;}else{throw new db[(_0x83ac('0x1d'))][(_0x83ac('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 _0x30c95d;}}function respondWithRpcPromise(_0x2616df,_0x164cd5,_0x2ca4ea,_0x110137){return new BPromise(function(_0x39b266,_0x3983db){var _0x4744f8=_0x110137||client;return _0x4744f8[_0x83ac('0x1f')](_0x2616df,_0x2ca4ea)[_0x83ac('0x20')](function(_0x14a0cf){logger['info'](_0x83ac('0x21'),_0x164cd5,_0x83ac('0x22'));logger[_0x83ac('0x23')](_0x83ac('0x24'),_0x164cd5,_0x83ac('0x22'),JSON['stringify'](_0x14a0cf));if(_0x14a0cf[_0x83ac('0x25')]){if(_0x14a0cf['error'][_0x83ac('0x26')]===0x1f4){logger[_0x83ac('0x25')](_0x83ac('0x21'),_0x164cd5,_0x14a0cf[_0x83ac('0x25')][_0x83ac('0x27')]);return _0x3983db(_0x14a0cf[_0x83ac('0x25')][_0x83ac('0x27')]);}logger[_0x83ac('0x25')](_0x83ac('0x21'),_0x164cd5,_0x14a0cf['error'][_0x83ac('0x27')]);return _0x39b266(_0x14a0cf[_0x83ac('0x25')][_0x83ac('0x27')]);}else{logger['info'](_0x83ac('0x21'),_0x164cd5,'request\x20sent');_0x39b266(_0x14a0cf['result'][_0x83ac('0x27')]);}})['catch'](function(_0x4a312f){logger[_0x83ac('0x25')](_0x83ac('0x21'),_0x164cd5,_0x4a312f);_0x3983db(_0x4a312f);});});}function respondWithStatusCode(_0x542900,_0x40eb5b){_0x40eb5b=_0x40eb5b||0xcc;return function(_0x5072d5){if(_0x5072d5){return _0x542900[_0x83ac('0x28')](_0x40eb5b);}return _0x542900['status'](_0x40eb5b)[_0x83ac('0x29')]();};}function respondWithResult(_0x5eb62b,_0x2ea07a){_0x2ea07a=_0x2ea07a||0xc8;return function(_0x1a88cf){if(_0x1a88cf){return _0x5eb62b[_0x83ac('0x2a')](_0x2ea07a)[_0x83ac('0x2b')](_0x1a88cf);}};}function respondWithFilteredResult(_0x30d8ec,_0x4704cb){return function(_0x1ce56f){if(_0x1ce56f){var _0x271379=_0x1ce56f[_0x83ac('0x2c')],_0x315c03=_0x4704cb[_0x83ac('0x2d')],_0x3d30c9=_0x4704cb[_0x83ac('0x2d')]+_0x4704cb['limit'],_0x18aa9c;if(_0x3d30c9>=_0x271379){_0x3d30c9=_0x271379;_0x18aa9c=0xc8;}else{_0x18aa9c=0xce;}_0x30d8ec[_0x83ac('0x2a')](_0x18aa9c);return _0x30d8ec[_0x83ac('0x2e')](_0x83ac('0x2f'),_0x315c03+'-'+_0x3d30c9+'/'+_0x271379)[_0x83ac('0x2b')](_0x1ce56f);}return null;};}function patchUpdates(_0x414e76){return function(_0x538a71){try{jsonpatch[_0x83ac('0x30')](_0x538a71,_0x414e76,!![]);}catch(_0xa022a0){return BPromise[_0x83ac('0x31')](_0xa022a0);}return _0x538a71[_0x83ac('0x32')]();};}function saveUpdates(_0x24439b,_0x4acd5e){return function(_0x48c563){if(_0x48c563){return _0x48c563[_0x83ac('0x33')](_0x24439b)[_0x83ac('0x20')](function(_0x212f04){return _0x212f04;});}return null;};}function removeEntity(_0x1de48f,_0x10377e){return function(_0x380816){if(_0x380816){return _0x380816[_0x83ac('0x34')]()['then'](function(){_0x1de48f['status'](0xcc)[_0x83ac('0x29')]();});}};}function handleEntityNotFound(_0xd1e419,_0x2d137c){return function(_0x2499d3){if(!_0x2499d3){_0xd1e419['sendStatus'](0x194);}return _0x2499d3;};}function handleError(_0x1a2b74,_0x3c8bae){_0x3c8bae=_0x3c8bae||0x1f4;return function(_0x552315){logger['error'](_0x552315[_0x83ac('0x35')]);if(_0x552315['name']){delete _0x552315[_0x83ac('0x36')];}_0x1a2b74['status'](_0x3c8bae)[_0x83ac('0x37')](_0x552315);};}exports[_0x83ac('0x38')]=function(_0x936ff1,_0xac5076){var _0x1d66b9={},_0x10c378={},_0x51b54f={'count':0x0,'rows':[]};var _0x4408bb=_[_0x83ac('0x39')](db[_0x83ac('0x3a')][_0x83ac('0x3b')],function(_0x3997bd){return{'name':_0x3997bd['fieldName'],'type':_0x3997bd[_0x83ac('0x3c')]['key']};});_0x10c378[_0x83ac('0x3d')]=_[_0x83ac('0x39')](_0x4408bb,_0x83ac('0x36'));_0x10c378[_0x83ac('0x3e')]=_[_0x83ac('0x3f')](_0x936ff1[_0x83ac('0x3e')]);_0x10c378['filters']=_[_0x83ac('0x40')](_0x10c378['model'],_0x10c378[_0x83ac('0x3e')]);_0x1d66b9['attributes']=_[_0x83ac('0x40')](_0x10c378[_0x83ac('0x3d')],qs[_0x83ac('0x41')](_0x936ff1[_0x83ac('0x3e')]['fields']));_0x1d66b9[_0x83ac('0x42')]=_0x1d66b9[_0x83ac('0x42')][_0x83ac('0x43')]?_0x1d66b9[_0x83ac('0x42')]:_0x10c378[_0x83ac('0x3d')];if(!_0x936ff1[_0x83ac('0x3e')][_0x83ac('0x44')](_0x83ac('0x45'))){_0x1d66b9[_0x83ac('0x46')]=qs[_0x83ac('0x46')](_0x936ff1[_0x83ac('0x3e')][_0x83ac('0x46')]);_0x1d66b9['offset']=qs[_0x83ac('0x2d')](_0x936ff1[_0x83ac('0x3e')]['offset']);}_0x1d66b9[_0x83ac('0x47')]=qs[_0x83ac('0x48')](_0x936ff1[_0x83ac('0x3e')]['sort']);_0x1d66b9[_0x83ac('0x49')]=qs[_0x83ac('0x4a')](_[_0x83ac('0x4b')](_0x936ff1[_0x83ac('0x3e')],_0x10c378[_0x83ac('0x4a')]));if(_0x936ff1[_0x83ac('0x3e')][_0x83ac('0x4c')]){_0x1d66b9[_0x83ac('0x49')]=_['merge'](_0x1d66b9[_0x83ac('0x49')],{'$or':_[_0x83ac('0x39')](_0x4408bb,function(_0x5b695b){if(_0x5b695b[_0x83ac('0x3c')]!==_0x83ac('0x4d')){var _0x378080={};_0x378080[_0x5b695b[_0x83ac('0x36')]]={'$like':'%'+_0x936ff1['query'][_0x83ac('0x4c')]+'%'};return _0x378080;}})});}_0x1d66b9=_[_0x83ac('0x4e')]({},_0x1d66b9,_0x936ff1[_0x83ac('0x4f')]);var _0x2e2d17={'where':_0x1d66b9[_0x83ac('0x49')]};return db[_0x83ac('0x3a')][_0x83ac('0x2c')](_0x2e2d17)[_0x83ac('0x20')](function(_0x76bd45){_0x51b54f[_0x83ac('0x2c')]=_0x76bd45;if(_0x936ff1[_0x83ac('0x3e')][_0x83ac('0x50')]){_0x1d66b9['include']=[{'all':!![]}];}return db[_0x83ac('0x3a')][_0x83ac('0x51')](_0x1d66b9);})[_0x83ac('0x20')](function(_0x3dc218){_0x51b54f[_0x83ac('0x52')]=_0x3dc218;return _0x51b54f;})['then'](respondWithFilteredResult(_0xac5076,_0x1d66b9))[_0x83ac('0x53')](handleError(_0xac5076,null));};exports[_0x83ac('0x54')]=function(_0x45d5e7,_0x15d3ab){var _0x1b67b2={'raw':![],'where':{'id':_0x45d5e7[_0x83ac('0x55')]['id']}},_0xf30e51={};_0xf30e51[_0x83ac('0x3d')]=_[_0x83ac('0x3f')](db[_0x83ac('0x3a')][_0x83ac('0x3b')]);_0xf30e51[_0x83ac('0x3e')]=_[_0x83ac('0x3f')](_0x45d5e7[_0x83ac('0x3e')]);_0xf30e51[_0x83ac('0x4a')]=_['intersection'](_0xf30e51[_0x83ac('0x3d')],_0xf30e51[_0x83ac('0x3e')]);_0x1b67b2[_0x83ac('0x42')]=_[_0x83ac('0x40')](_0xf30e51[_0x83ac('0x3d')],qs[_0x83ac('0x41')](_0x45d5e7[_0x83ac('0x3e')][_0x83ac('0x41')]));_0x1b67b2[_0x83ac('0x42')]=_0x1b67b2[_0x83ac('0x42')]['length']?_0x1b67b2[_0x83ac('0x42')]:_0xf30e51[_0x83ac('0x3d')];if(_0x45d5e7['query'][_0x83ac('0x50')]){_0x1b67b2[_0x83ac('0x56')]=[{'all':!![]}];}_0x1b67b2=_[_0x83ac('0x4e')]({},_0x1b67b2,_0x45d5e7[_0x83ac('0x4f')]);return db[_0x83ac('0x3a')][_0x83ac('0x57')](_0x1b67b2)[_0x83ac('0x20')](handleEntityNotFound(_0x15d3ab,null))['then'](respondWithResult(_0x15d3ab,null))[_0x83ac('0x53')](handleError(_0x15d3ab,null));};exports['create']=function(_0x3dc61a,_0x1fe7d0){return db[_0x83ac('0x3a')][_0x83ac('0x58')](_0x3dc61a[_0x83ac('0x59')],{})['then'](respondWithResult(_0x1fe7d0,0xc9))[_0x83ac('0x53')](handleError(_0x1fe7d0,null));};exports[_0x83ac('0x33')]=function(_0x258285,_0x70fd87){if(_0x258285['body']['id']){delete _0x258285['body']['id'];}return db[_0x83ac('0x3a')]['find']({'where':{'id':_0x258285[_0x83ac('0x55')]['id']}})[_0x83ac('0x20')](handleEntityNotFound(_0x70fd87,null))[_0x83ac('0x20')](saveUpdates(_0x258285[_0x83ac('0x59')],null))[_0x83ac('0x20')](respondWithResult(_0x70fd87,null))[_0x83ac('0x53')](handleError(_0x70fd87,null));};exports[_0x83ac('0x34')]=function(_0x44e7c7,_0x4186e7){return db[_0x83ac('0x3a')][_0x83ac('0x57')]({'where':{'id':_0x44e7c7[_0x83ac('0x55')]['id']}})['then'](handleEntityNotFound(_0x4186e7,null))[_0x83ac('0x20')](removeEntity(_0x4186e7,null))[_0x83ac('0x53')](handleError(_0x4186e7,null));};exports[_0x83ac('0x5a')]=function(_0x12053d,_0x44e15c,_0x192cb7){var _0x57a71b={};var _0x1de662={};var _0x4ace0f;var _0x56ecf2;return db[_0x83ac('0x3a')][_0x83ac('0x5b')]({'where':{'id':_0x12053d[_0x83ac('0x55')]['id']}})[_0x83ac('0x20')](handleEntityNotFound(_0x44e15c,null))[_0x83ac('0x20')](function(_0x191b89){if(_0x191b89){_0x4ace0f=_0x191b89;_0x1de662[_0x83ac('0x3d')]=_[_0x83ac('0x3f')](db['VtigerConfiguration']['rawAttributes']);_0x1de662[_0x83ac('0x3e')]=_[_0x83ac('0x3f')](_0x12053d[_0x83ac('0x3e')]);_0x1de662['filters']=_[_0x83ac('0x40')](_0x1de662[_0x83ac('0x3d')],_0x1de662[_0x83ac('0x3e')]);_0x57a71b[_0x83ac('0x42')]=_[_0x83ac('0x40')](_0x1de662[_0x83ac('0x3d')],qs[_0x83ac('0x41')](_0x12053d[_0x83ac('0x3e')][_0x83ac('0x41')]));_0x57a71b[_0x83ac('0x42')]=_0x57a71b[_0x83ac('0x42')][_0x83ac('0x43')]?_0x57a71b[_0x83ac('0x42')]:_0x1de662[_0x83ac('0x3d')];_0x57a71b[_0x83ac('0x47')]=qs['sort'](_0x12053d['query'][_0x83ac('0x48')]);_0x57a71b['where']=qs[_0x83ac('0x4a')](_[_0x83ac('0x4b')](_0x12053d[_0x83ac('0x3e')],_0x1de662[_0x83ac('0x4a')]));if(_0x12053d[_0x83ac('0x3e')]['filter']){_0x57a71b['where']=_[_0x83ac('0x4e')](_0x57a71b[_0x83ac('0x49')],{'$or':_['map'](_0x57a71b[_0x83ac('0x42')],function(_0x1f04c8){var _0x1df72e={};_0x1df72e[_0x1f04c8]={'$like':'%'+_0x12053d[_0x83ac('0x3e')][_0x83ac('0x4c')]+'%'};return _0x1df72e;})});}_0x57a71b=_[_0x83ac('0x4e')]({},_0x57a71b,_0x12053d[_0x83ac('0x4f')]);return _0x4ace0f[_0x83ac('0x5a')](_0x57a71b);}})['then'](function(_0x233204){if(_0x233204){_0x56ecf2=_0x233204[_0x83ac('0x43')];if(!_0x12053d[_0x83ac('0x3e')][_0x83ac('0x44')]('nolimit')){_0x57a71b[_0x83ac('0x46')]=qs[_0x83ac('0x46')](_0x12053d[_0x83ac('0x3e')][_0x83ac('0x46')]);_0x57a71b[_0x83ac('0x2d')]=qs[_0x83ac('0x2d')](_0x12053d[_0x83ac('0x3e')]['offset']);}return _0x4ace0f[_0x83ac('0x5a')](_0x57a71b);}})[_0x83ac('0x20')](function(_0x56dee8){if(_0x56dee8){return _0x56dee8?{'count':_0x56ecf2,'rows':_0x56dee8}:null;}})['then'](respondWithResult(_0x44e15c,null))[_0x83ac('0x53')](handleError(_0x44e15c,null));};exports['addConfiguration']=function(_0x419cad,_0x40d76c,_0x1923be){if(_0x419cad[_0x83ac('0x59')]['id']){delete _0x419cad[_0x83ac('0x59')]['id'];}return db[_0x83ac('0x3a')][_0x83ac('0x5b')]({'where':{'id':_0x419cad[_0x83ac('0x55')]['id']}})[_0x83ac('0x20')](handleEntityNotFound(_0x40d76c,null))['then'](function(_0x14a148){if(_0x14a148){_0x419cad[_0x83ac('0x59')][_0x83ac('0x5c')]=_0x14a148['id'];_0x419cad['body'][_0x83ac('0x5d')]=integrations['getSubjects'](_0x419cad[_0x83ac('0x59')]['channel'],_0x419cad[_0x83ac('0x59')][_0x83ac('0x3c')]);_0x419cad[_0x83ac('0x59')][_0x83ac('0x5e')]=integrations['getDescriptions'](_0x419cad[_0x83ac('0x59')]['channel'],_0x419cad[_0x83ac('0x59')]['type']);return db['VtigerConfiguration']['create'](_0x419cad[_0x83ac('0x59')],{'include':[{'model':db[_0x83ac('0x5f')],'as':_0x83ac('0x5d')},{'model':db['VtigerField'],'as':'Descriptions'}]});}return null;})[_0x83ac('0x20')](respondWithResult(_0x40d76c,null))[_0x83ac('0x53')](handleError(_0x40d76c,null));};var md5=require(_0x83ac('0x60'));exports['getFields']=function(_0x5a00ac,_0x1f1645,_0x393576){var _0x30e7e9=null;var _0x5a53fa=null;var _0x11c35d=null;var _0x52c4af=null;var _0x49a0e8='';return db[_0x83ac('0x3a')][_0x83ac('0x5b')]({'where':{'id':_0x5a00ac[_0x83ac('0x55')]['id']},'attributes':['id',_0x83ac('0x36'),_0x83ac('0x61'),_0x83ac('0x62'),_0x83ac('0x63'),_0x83ac('0x64'),_0x83ac('0x65'),_0x83ac('0x66')]})[_0x83ac('0x20')](handleEntityNotFound(_0x1f1645,null))[_0x83ac('0x20')](function(_0x312cd3){if(_0x312cd3){_0x30e7e9=_0x312cd3['username'];_0x5a53fa=_0x312cd3[_0x83ac('0x66')];_0x11c35d=_0x312cd3[_0x83ac('0x63')];_0x49a0e8=_0x312cd3[_0x83ac('0x64')];var _0x3e4843=_0x49a0e8[_0x83ac('0x67')](-0x1);if(_0x3e4843==='/'){_0x49a0e8=_0x49a0e8['substring'](0x0,_0x49a0e8['lastIndexOf'](_0x3e4843));}_0x52c4af=util[_0x83ac('0x68')](_0x83ac('0x69'),_0x49a0e8);var _0x571a0f={'method':_0x83ac('0x6a'),'uri':_0x52c4af,'qs':{'operation':_0x83ac('0x6b'),'username':_0x312cd3[_0x83ac('0x61')]},'json':!![]};return rp(_0x571a0f);}})[_0x83ac('0x20')](function(_0x1e351){if(_0x1e351[_0x83ac('0x6c')]){var _0x4cd05a={'method':_0x83ac('0x6d'),'uri':_0x52c4af,'form':{'operation':_0x83ac('0x6e'),'username':_0x30e7e9,'accessKey':md5(_0x1e351[_0x83ac('0x6f')][_0x83ac('0x70')]+_0x5a53fa)},'json':!![]};return rp(_0x4cd05a);}})[_0x83ac('0x20')](function(_0x5efa9c){if(_0x5efa9c[_0x83ac('0x6c')]){var _0x37e015={'method':_0x83ac('0x6a'),'uri':_0x52c4af,'qs':{'operation':'describe','username':_0x30e7e9,'sessionName':_0x5efa9c['result'][_0x83ac('0x71')],'elementType':_0x11c35d},'json':!![]};return rp(_0x37e015);}})[_0x83ac('0x20')](function(_0x22f3db){if(_0x22f3db['success']){var _0x396752=[_0x83ac('0x72'),'reference',_0x83ac('0x73')];_['remove'](_0x22f3db[_0x83ac('0x6f')][_0x83ac('0x41')],function(_0x1b9b05){return _0x396752['includes'](_0x1b9b05[_0x83ac('0x3c')]['name']);});_['remove'](_0x22f3db[_0x83ac('0x6f')][_0x83ac('0x41')],function(_0xb22955){return _0xb22955[_0x83ac('0x74')]===_0x83ac('0x75');});return{'count':_0x22f3db[_0x83ac('0x6f')][_0x83ac('0x41')][_0x83ac('0x43')],'rows':_[_0x83ac('0x39')](_0x22f3db['result']['fields'],function(_0x475a0b){return{'id':_0x475a0b[_0x83ac('0x36')],'name':_0x475a0b['label'],'custom':_['startsWith'](_0x475a0b[_0x83ac('0x36')],_0x83ac('0x76'))?!![]:![],'options':_0x475a0b[_0x83ac('0x3c')][_0x83ac('0x36')]===_0x83ac('0x77')&&_0x475a0b[_0x83ac('0x3c')][_0x83ac('0x78')][_0x83ac('0x43')]>0x0?_[_0x83ac('0x39')](_0x475a0b[_0x83ac('0x3c')][_0x83ac('0x78')],function(_0x19e4c6){return{'name':_0x19e4c6['label'],'value':_0x19e4c6['value']};}):[]};})};}})[_0x83ac('0x20')](respondWithResult(_0x1f1645,null))[_0x83ac('0x53')](function(_0x1023ce){console[_0x83ac('0x79')]('vTiger\x20error:\x20'+_0x1023ce);var _0x41c4ae=_0x5a00ac['query'][_0x83ac('0x1c')]?0x1f4:_0x1023ce['statusCode']||0x1f4;logger['error'](_0x83ac('0x7a'),_0x83ac('0x7b'),_0x41c4ae,JSON[_0x83ac('0x7c')](_0x1023ce));delete _0x1023ce[_0x83ac('0x36')];if(_0x41c4ae===0x191){_0x41c4ae=0x190;}_0x1f1645['status'](_0x41c4ae)[_0x83ac('0x37')](_0x5a00ac[_0x83ac('0x3e')]['test']?{'message':_0x83ac('0x7d'),'statusCode':_0x1023ce['statusCode']}:_0x1023ce);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index f4cbab4..f078ea5 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 _0x2c6e=['../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','int_vtiger_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4d282d,_0x4ec060){var _0x31fd1f=function(_0x1404a6){while(--_0x1404a6){_0x4d282d['push'](_0x4d282d['shift']());}};_0x31fd1f(++_0x4ec060);}(_0x2c6e,0xac));var _0xe2c6=function(_0x112773,_0x3d7a4d){_0x112773=_0x112773-0x0;var _0x289f3f=_0x2c6e[_0x112773];return _0x289f3f;};'use strict';var _=require('lodash');var util=require(_0xe2c6('0x0'));var logger=require(_0xe2c6('0x1'))(_0xe2c6('0x2'));var moment=require(_0xe2c6('0x3'));var BPromise=require(_0xe2c6('0x4'));var rp=require(_0xe2c6('0x5'));var fs=require('fs');var path=require(_0xe2c6('0x6'));var rimraf=require(_0xe2c6('0x7'));var config=require(_0xe2c6('0x8'));var attributes=require(_0xe2c6('0x9'));var integrations=require(_0xe2c6('0xa'));module['exports']=function(_0x25fc98,_0x5f02f2){return _0x25fc98['define']('VtigerAccount',attributes,{'tableName':_0xe2c6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53c3=['../../components/integrations/configuration','exports','define','int_vtiger_accounts','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x52cd3c,_0x158868){var _0x31bfe3=function(_0x20c1bc){while(--_0x20c1bc){_0x52cd3c['push'](_0x52cd3c['shift']());}};_0x31bfe3(++_0x158868);}(_0x53c3,0xea));var _0x353c=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x53c3[_0x32f7d7];return _0x133d09;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x353c('0x0'));var BPromise=require(_0x353c('0x1'));var rp=require(_0x353c('0x2'));var fs=require('fs');var path=require(_0x353c('0x3'));var rimraf=require(_0x353c('0x4'));var config=require(_0x353c('0x5'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x353c('0x6'));module[_0x353c('0x7')]=function(_0x2148fb,_0x2613c7){return _0x2148fb[_0x353c('0x8')]('VtigerAccount',attributes,{'tableName':_0x353c('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 f65016e..5bf6b5c 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 _0x153a=['VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetVtigerAccount','VtigerAccount','findAll','options','attributes','limit','include','map','model','then','stringify','ShowVtigerAccount','where','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x14b516,_0x25a727){var _0x450e4a=function(_0x18488f){while(--_0x18488f){_0x14b516['push'](_0x14b516['shift']());}};_0x450e4a(++_0x25a727);}(_0x153a,0x122));var _0xa153=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0x153a[_0x1a7846];return _0x48049;};'use strict';var _=require(_0xa153('0x0'));var util=require('util');var moment=require(_0xa153('0x1'));var BPromise=require(_0xa153('0x2'));var rs=require(_0xa153('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa153('0x4'))['db'];var utils=require(_0xa153('0x5'));var logger=require(_0xa153('0x6'))(_0xa153('0x7'));var config=require('../../config/environment');var jayson=require(_0xa153('0x8'));var client=jayson[_0xa153('0x9')][_0xa153('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xcde29f,_0x114743,_0x1efe8c){return new BPromise(function(_0x366415,_0x1699bd){return client[_0xa153('0xb')](_0xcde29f,_0x1efe8c)['then'](function(_0x541077){logger[_0xa153('0xc')](_0xa153('0xd'),_0x114743,_0xa153('0xe'));logger[_0xa153('0xf')](_0xa153('0x10'),_0x114743,_0xa153('0xe'),JSON['stringify'](_0x541077));if(_0x541077[_0xa153('0x11')]){if(_0x541077['error'][_0xa153('0x12')]===0x1f4){logger[_0xa153('0x11')](_0xa153('0xd'),_0x114743,_0x541077[_0xa153('0x11')][_0xa153('0x13')]);return _0x1699bd(_0x541077[_0xa153('0x11')][_0xa153('0x13')]);}logger[_0xa153('0x11')](_0xa153('0xd'),_0x114743,_0x541077[_0xa153('0x11')][_0xa153('0x13')]);return _0x366415(_0x541077['error'][_0xa153('0x13')]);}else{logger['info'](_0xa153('0xd'),_0x114743,_0xa153('0xe'));_0x366415(_0x541077['result'][_0xa153('0x13')]);}})[_0xa153('0x14')](function(_0x522f7b){logger[_0xa153('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x114743,_0x522f7b);_0x1699bd(_0x522f7b);});});}exports[_0xa153('0x15')]=function(_0x4ad23f){var _0x22f497=this;return new Promise(function(_0x43a12e,_0x3afe6e){return db[_0xa153('0x16')][_0xa153('0x17')]({'raw':_0x4ad23f['options']?_0x4ad23f['options']['raw']===undefined?!![]:![]:!![],'where':_0x4ad23f[_0xa153('0x18')]?_0x4ad23f['options']['where']||null:null,'attributes':_0x4ad23f[_0xa153('0x18')]?_0x4ad23f[_0xa153('0x18')][_0xa153('0x19')]||null:null,'limit':_0x4ad23f[_0xa153('0x18')]?_0x4ad23f['options'][_0xa153('0x1a')]||null:null,'include':_0x4ad23f[_0xa153('0x18')]?_0x4ad23f[_0xa153('0x18')][_0xa153('0x1b')]?_[_0xa153('0x1c')](_0x4ad23f[_0xa153('0x18')][_0xa153('0x1b')],function(_0x460be8){return{'model':db[_0x460be8['model']],'as':_0x460be8['as'],'attributes':_0x460be8[_0xa153('0x19')],'include':_0x460be8[_0xa153('0x1b')]?_[_0xa153('0x1c')](_0x460be8[_0xa153('0x1b')],function(_0x47724a){return{'model':db[_0x47724a['model']],'as':_0x47724a['as'],'attributes':_0x47724a[_0xa153('0x19')],'include':_0x47724a[_0xa153('0x1b')]?_[_0xa153('0x1c')](_0x47724a[_0xa153('0x1b')],function(_0x418a32){return{'model':db[_0x418a32[_0xa153('0x1d')]],'as':_0x418a32['as'],'attributes':_0x418a32[_0xa153('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa153('0x1e')](function(_0x91c806){logger[_0xa153('0xc')](_0xa153('0x15'),_0x4ad23f);logger['debug'](_0xa153('0x15'),_0x4ad23f,JSON[_0xa153('0x1f')](_0x91c806));_0x43a12e(_0x91c806);})[_0xa153('0x14')](function(_0x3924f3){logger['error'](_0xa153('0x15'),_0x3924f3[_0xa153('0x13')],_0x4ad23f);_0x3afe6e(_0x22f497[_0xa153('0x11')](0x1f4,_0x3924f3[_0xa153('0x13')]));});});};exports[_0xa153('0x20')]=function(_0x3acefa){var _0x2fa311=this;return new Promise(function(_0x123c3b,_0x3d03a5){return db[_0xa153('0x16')]['find']({'raw':_0x3acefa['options']?_0x3acefa[_0xa153('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3acefa['options']?_0x3acefa[_0xa153('0x18')][_0xa153('0x21')]||null:null,'attributes':_0x3acefa[_0xa153('0x18')]?_0x3acefa[_0xa153('0x18')]['attributes']||null:null,'include':_0x3acefa[_0xa153('0x18')]?_0x3acefa[_0xa153('0x18')][_0xa153('0x1b')]?_['map'](_0x3acefa[_0xa153('0x18')][_0xa153('0x1b')],function(_0x222e0b){return{'model':db[_0x222e0b[_0xa153('0x1d')]],'as':_0x222e0b['as'],'attributes':_0x222e0b[_0xa153('0x19')],'include':_0x222e0b[_0xa153('0x1b')]?_[_0xa153('0x1c')](_0x222e0b[_0xa153('0x1b')],function(_0x5211aa){return{'model':db[_0x5211aa[_0xa153('0x1d')]],'as':_0x5211aa['as'],'attributes':_0x5211aa[_0xa153('0x19')],'include':_0x5211aa['include']?_[_0xa153('0x1c')](_0x5211aa['include'],function(_0xd67d44){return{'model':db[_0xd67d44['model']],'as':_0xd67d44['as'],'attributes':_0xd67d44['attributes']};}):[]};}):[]};}):[]:[]})[_0xa153('0x1e')](function(_0x1aa66a){logger[_0xa153('0xc')](_0xa153('0x20'),_0x3acefa);logger['debug'](_0xa153('0x20'),_0x3acefa,JSON[_0xa153('0x1f')](_0x1aa66a));_0x123c3b(_0x1aa66a);})[_0xa153('0x14')](function(_0x1cd30b){logger[_0xa153('0x11')](_0xa153('0x20'),_0x1cd30b[_0xa153('0x13')],_0x3acefa);_0x3d03a5(_0x2fa311[_0xa153('0x11')](0x1f4,_0x1cd30b[_0xa153('0x13')]));});});}; \ No newline at end of file +var _0xc416=['model','attributes','map','stringify','catch','ShowVtigerAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','limit','include'];(function(_0x3f3f40,_0x4e745f){var _0x32c366=function(_0x343f6a){while(--_0x343f6a){_0x3f3f40['push'](_0x3f3f40['shift']());}};_0x32c366(++_0x4e745f);}(_0xc416,0xe4));var _0x6c41=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc416[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6c41('0x0'));var util=require(_0x6c41('0x1'));var moment=require(_0x6c41('0x2'));var BPromise=require(_0x6c41('0x3'));var rs=require(_0x6c41('0x4'));var fs=require('fs');var Redis=require(_0x6c41('0x5'));var db=require(_0x6c41('0x6'))['db'];var utils=require(_0x6c41('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x6c41('0x8'));var jayson=require(_0x6c41('0x9'));var client=jayson[_0x6c41('0xa')][_0x6c41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2df852,_0x568102,_0x43837a){return new BPromise(function(_0x5461d9,_0x36a781){return client[_0x6c41('0xc')](_0x2df852,_0x43837a)[_0x6c41('0xd')](function(_0x2d611d){logger[_0x6c41('0xe')](_0x6c41('0xf'),_0x568102,_0x6c41('0x10'));logger[_0x6c41('0x11')](_0x6c41('0x12'),_0x568102,_0x6c41('0x10'),JSON['stringify'](_0x2d611d));if(_0x2d611d[_0x6c41('0x13')]){if(_0x2d611d['error'][_0x6c41('0x14')]===0x1f4){logger[_0x6c41('0x13')](_0x6c41('0xf'),_0x568102,_0x2d611d[_0x6c41('0x13')][_0x6c41('0x15')]);return _0x36a781(_0x2d611d['error'][_0x6c41('0x15')]);}logger[_0x6c41('0x13')](_0x6c41('0xf'),_0x568102,_0x2d611d[_0x6c41('0x13')][_0x6c41('0x15')]);return _0x5461d9(_0x2d611d['error'][_0x6c41('0x15')]);}else{logger[_0x6c41('0xe')](_0x6c41('0xf'),_0x568102,_0x6c41('0x10'));_0x5461d9(_0x2d611d[_0x6c41('0x16')][_0x6c41('0x15')]);}})['catch'](function(_0x8f3d06){logger[_0x6c41('0x13')](_0x6c41('0xf'),_0x568102,_0x8f3d06);_0x36a781(_0x8f3d06);});});}exports[_0x6c41('0x17')]=function(_0x1d05ab){var _0x3cd489=this;return new Promise(function(_0x2567ad,_0x5a5681){return db[_0x6c41('0x18')][_0x6c41('0x19')]({'raw':_0x1d05ab[_0x6c41('0x1a')]?_0x1d05ab[_0x6c41('0x1a')][_0x6c41('0x1b')]===undefined?!![]:![]:!![],'where':_0x1d05ab['options']?_0x1d05ab[_0x6c41('0x1a')][_0x6c41('0x1c')]||null:null,'attributes':_0x1d05ab[_0x6c41('0x1a')]?_0x1d05ab[_0x6c41('0x1a')]['attributes']||null:null,'limit':_0x1d05ab[_0x6c41('0x1a')]?_0x1d05ab[_0x6c41('0x1a')][_0x6c41('0x1d')]||null:null,'include':_0x1d05ab['options']?_0x1d05ab[_0x6c41('0x1a')][_0x6c41('0x1e')]?_['map'](_0x1d05ab['options'][_0x6c41('0x1e')],function(_0x50d200){return{'model':db[_0x50d200[_0x6c41('0x1f')]],'as':_0x50d200['as'],'attributes':_0x50d200[_0x6c41('0x20')],'include':_0x50d200[_0x6c41('0x1e')]?_[_0x6c41('0x21')](_0x50d200['include'],function(_0x5a8cf0){return{'model':db[_0x5a8cf0[_0x6c41('0x1f')]],'as':_0x5a8cf0['as'],'attributes':_0x5a8cf0[_0x6c41('0x20')],'include':_0x5a8cf0['include']?_[_0x6c41('0x21')](_0x5a8cf0[_0x6c41('0x1e')],function(_0x270e3d){return{'model':db[_0x270e3d[_0x6c41('0x1f')]],'as':_0x270e3d['as'],'attributes':_0x270e3d[_0x6c41('0x20')]};}):[]};}):[]};}):[]:[]})[_0x6c41('0xd')](function(_0x32f00c){logger[_0x6c41('0xe')]('GetVtigerAccount',_0x1d05ab);logger[_0x6c41('0x11')](_0x6c41('0x17'),_0x1d05ab,JSON[_0x6c41('0x22')](_0x32f00c));_0x2567ad(_0x32f00c);})[_0x6c41('0x23')](function(_0x47dd4a){logger['error'](_0x6c41('0x17'),_0x47dd4a[_0x6c41('0x15')],_0x1d05ab);_0x5a5681(_0x3cd489[_0x6c41('0x13')](0x1f4,_0x47dd4a[_0x6c41('0x15')]));});});};exports['ShowVtigerAccount']=function(_0x46d251){var _0x6bfec0=this;return new Promise(function(_0x5b396f,_0x5222d6){return db[_0x6c41('0x18')]['find']({'raw':_0x46d251[_0x6c41('0x1a')]?_0x46d251['options']['raw']===undefined?!![]:![]:!![],'where':_0x46d251[_0x6c41('0x1a')]?_0x46d251[_0x6c41('0x1a')][_0x6c41('0x1c')]||null:null,'attributes':_0x46d251['options']?_0x46d251['options'][_0x6c41('0x20')]||null:null,'include':_0x46d251[_0x6c41('0x1a')]?_0x46d251[_0x6c41('0x1a')][_0x6c41('0x1e')]?_['map'](_0x46d251[_0x6c41('0x1a')][_0x6c41('0x1e')],function(_0x1c894a){return{'model':db[_0x1c894a['model']],'as':_0x1c894a['as'],'attributes':_0x1c894a[_0x6c41('0x20')],'include':_0x1c894a[_0x6c41('0x1e')]?_[_0x6c41('0x21')](_0x1c894a[_0x6c41('0x1e')],function(_0xf3fbe5){return{'model':db[_0xf3fbe5[_0x6c41('0x1f')]],'as':_0xf3fbe5['as'],'attributes':_0xf3fbe5[_0x6c41('0x20')],'include':_0xf3fbe5[_0x6c41('0x1e')]?_[_0x6c41('0x21')](_0xf3fbe5['include'],function(_0x4f1294){return{'model':db[_0x4f1294[_0x6c41('0x1f')]],'as':_0x4f1294['as'],'attributes':_0x4f1294['attributes']};}):[]};}):[]};}):[]:[]})[_0x6c41('0xd')](function(_0x1944da){logger[_0x6c41('0xe')](_0x6c41('0x24'),_0x46d251);logger['debug'](_0x6c41('0x24'),_0x46d251,JSON[_0x6c41('0x22')](_0x1944da));_0x5b396f(_0x1944da);})['catch'](function(_0x5df66e){logger[_0x6c41('0x13')](_0x6c41('0x24'),_0x5df66e['message'],_0x46d251);_0x5222d6(_0x6bfec0[_0x6c41('0x13')](0x1f4,_0x5df66e[_0x6c41('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 43fe53a..7d35f98 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(_0x312ff8,_0x5d7167){var _0x4e144b=function(_0x8c0bd5){while(--_0x8c0bd5){_0x312ff8['push'](_0x312ff8['shift']());}};_0x4e144b(++_0x5d7167);}(_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(_0xf6aa94,_0x5cd52c){var _0x523f4c=function(_0x5b7ae9){while(--_0x5b7ae9){_0xf6aa94['push'](_0xf6aa94['shift']());}};_0x523f4c(++_0x5cd52c);}(_0xb10b,0x12a));var _0xbb10=function(_0x3cb9bc,_0x1c95f5){_0x3cb9bc=_0x3cb9bc-0x0;var _0x5d13ec=_0xb10b[_0x3cb9bc];return _0x5d13ec;};'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 38adb0c..bf3dbfe 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 _0x4be2=['STRING','sequelize','exports'];(function(_0xa87d32,_0x17d3d8){var _0xaa140c=function(_0x33fe34){while(--_0x33fe34){_0xa87d32['push'](_0xa87d32['shift']());}};_0xaa140c(++_0x17d3d8);}(_0x4be2,0x145));var _0x24be=function(_0x267be3,_0x18ef5f){_0x267be3=_0x267be3-0x0;var _0x57fe29=_0x4be2[_0x267be3];return _0x57fe29;};'use strict';var Sequelize=require(_0x24be('0x0'));module[_0x24be('0x1')]={'name':{'type':Sequelize[_0x24be('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc6e3=['STRING','sequelize'];(function(_0x25d4e5,_0x30b67f){var _0x44d116=function(_0x3011c2){while(--_0x3011c2){_0x25d4e5['push'](_0x25d4e5['shift']());}};_0x44d116(++_0x30b67f);}(_0xc6e3,0x1d7));var _0x3c6e=function(_0x4e3e3c,_0x44fc4b){_0x4e3e3c=_0x4e3e3c-0x0;var _0x5b3c6b=_0xc6e3[_0x4e3e3c];return _0x5b3c6b;};'use strict';var Sequelize=require(_0x3c6e('0x0'));module['exports']={'name':{'type':Sequelize[_0x3c6e('0x1')]},'description':{'type':Sequelize[_0x3c6e('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index e768e32..5342d49 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 _0xc620=['key','model','query','keys','filters','attributes','intersection','fields','nolimit','limit','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','destroy','VtigerField','getFields','hasOwnProperty','getSubjects','order','options','getDescriptions','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','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','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','message','sendStatus','status','end','count','offset','Content-Range','json','reject','save','update','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type'];(function(_0x46224b,_0x10ea5b){var _0x3f7876=function(_0x12cad0){while(--_0x12cad0){_0x46224b['push'](_0x46224b['shift']());}};_0x3f7876(++_0x10ea5b);}(_0xc620,0x138));var _0x0c62=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc620[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x0c62('0x0'));var emlformat=require(_0x0c62('0x1'));var rimraf=require(_0x0c62('0x2'));var zipdir=require(_0x0c62('0x3'));var jsonpatch=require(_0x0c62('0x4'));var rp=require(_0x0c62('0x5'));var moment=require(_0x0c62('0x6'));var BPromise=require(_0x0c62('0x7'));var Mustache=require(_0x0c62('0x8'));var util=require(_0x0c62('0x9'));var path=require(_0x0c62('0xa'));var sox=require(_0x0c62('0xb'));var csv=require(_0x0c62('0xc'));var ejs=require(_0x0c62('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0c62('0xe'));var crypto=require(_0x0c62('0xf'));var jsforce=require(_0x0c62('0x10'));var deskjs=require(_0x0c62('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0c62('0x12'));var Redis=require(_0x0c62('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0c62('0x14'));var hardwareService=require(_0x0c62('0x15'));var logger=require(_0x0c62('0x16'))('api');var utils=require(_0x0c62('0x17'));var config=require(_0x0c62('0x18'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x0c62('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x39a1a8,_0x58321c,_0x42999b){if(_0x42999b){var _0x1cb33c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1cb33c['test'](_0x58321c)){return _0x39a1a8;}else{throw new db[(_0x0c62('0x1a'))][(_0x0c62('0x1b'))](_0x0c62('0x1c'));}}else{return _0x39a1a8;}}function respondWithRpcPromise(_0x53b30b,_0x28b9ff,_0x205a8c,_0xfef5a1){return new BPromise(function(_0x55cc1e,_0x517c06){var _0x456b6f=_0xfef5a1||client;return _0x456b6f[_0x0c62('0x1d')](_0x53b30b,_0x205a8c)[_0x0c62('0x1e')](function(_0x113171){logger[_0x0c62('0x1f')](_0x0c62('0x20'),_0x28b9ff,_0x0c62('0x21'));logger[_0x0c62('0x22')](_0x0c62('0x23'),_0x28b9ff,'request\x20sent',JSON['stringify'](_0x113171));if(_0x113171[_0x0c62('0x24')]){if(_0x113171[_0x0c62('0x24')]['code']===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x28b9ff,_0x113171[_0x0c62('0x24')][_0x0c62('0x25')]);return _0x517c06(_0x113171[_0x0c62('0x24')]['message']);}logger[_0x0c62('0x24')](_0x0c62('0x20'),_0x28b9ff,_0x113171[_0x0c62('0x24')]['message']);return _0x55cc1e(_0x113171['error'][_0x0c62('0x25')]);}else{logger[_0x0c62('0x1f')]('VtigerConfiguration,\x20%s,\x20%s',_0x28b9ff,'request\x20sent');_0x55cc1e(_0x113171['result']['message']);}})['catch'](function(_0x1db1eb){logger[_0x0c62('0x24')](_0x0c62('0x20'),_0x28b9ff,_0x1db1eb);_0x517c06(_0x1db1eb);});});}function respondWithStatusCode(_0x169342,_0x2049fa){_0x2049fa=_0x2049fa||0xcc;return function(_0x2f36f9){if(_0x2f36f9){return _0x169342[_0x0c62('0x26')](_0x2049fa);}return _0x169342[_0x0c62('0x27')](_0x2049fa)[_0x0c62('0x28')]();};}function respondWithResult(_0x32d783,_0x504364){_0x504364=_0x504364||0xc8;return function(_0x45f310){if(_0x45f310){return _0x32d783[_0x0c62('0x27')](_0x504364)['json'](_0x45f310);}};}function respondWithFilteredResult(_0x1b1b92,_0x48e873){return function(_0x7d53ae){if(_0x7d53ae){var _0x407be0=_0x7d53ae[_0x0c62('0x29')],_0x246034=_0x48e873[_0x0c62('0x2a')],_0x6d0319=_0x48e873[_0x0c62('0x2a')]+_0x48e873['limit'],_0x45fcfd;if(_0x6d0319>=_0x407be0){_0x6d0319=_0x407be0;_0x45fcfd=0xc8;}else{_0x45fcfd=0xce;}_0x1b1b92['status'](_0x45fcfd);return _0x1b1b92['set'](_0x0c62('0x2b'),_0x246034+'-'+_0x6d0319+'/'+_0x407be0)[_0x0c62('0x2c')](_0x7d53ae);}return null;};}function patchUpdates(_0x757c4f){return function(_0x336eb4){try{jsonpatch['apply'](_0x336eb4,_0x757c4f,!![]);}catch(_0x40901e){return BPromise[_0x0c62('0x2d')](_0x40901e);}return _0x336eb4[_0x0c62('0x2e')]();};}function saveUpdates(_0x47278f,_0x5ad9cf){return function(_0x347ed4){if(_0x347ed4){return _0x347ed4[_0x0c62('0x2f')](_0x47278f)['then'](function(_0x134f63){return _0x134f63;});}return null;};}function removeEntity(_0x3dd146,_0x4d9ab1){return function(_0x5a072c){if(_0x5a072c){return _0x5a072c['destroy']()[_0x0c62('0x1e')](function(){_0x3dd146[_0x0c62('0x27')](0xcc)[_0x0c62('0x28')]();});}};}function handleEntityNotFound(_0x5e3111,_0x42da31){return function(_0x2de9c2){if(!_0x2de9c2){_0x5e3111['sendStatus'](0x194);}return _0x2de9c2;};}function handleError(_0x5740f4,_0x22844d){_0x22844d=_0x22844d||0x1f4;return function(_0x5580b4){logger[_0x0c62('0x24')](_0x5580b4['stack']);if(_0x5580b4['name']){delete _0x5580b4[_0x0c62('0x30')];}_0x5740f4[_0x0c62('0x27')](_0x22844d)[_0x0c62('0x31')](_0x5580b4);};}exports[_0x0c62('0x32')]=function(_0x68f47,_0xe7fbec){var _0xecae0f={},_0x10f1b5={},_0xa1f24b={'count':0x0,'rows':[]};var _0x18017f=_[_0x0c62('0x33')](db[_0x0c62('0x34')][_0x0c62('0x35')],function(_0x4e1e36){return{'name':_0x4e1e36[_0x0c62('0x36')],'type':_0x4e1e36[_0x0c62('0x37')][_0x0c62('0x38')]};});_0x10f1b5[_0x0c62('0x39')]=_[_0x0c62('0x33')](_0x18017f,_0x0c62('0x30'));_0x10f1b5[_0x0c62('0x3a')]=_[_0x0c62('0x3b')](_0x68f47[_0x0c62('0x3a')]);_0x10f1b5[_0x0c62('0x3c')]=_['intersection'](_0x10f1b5['model'],_0x10f1b5[_0x0c62('0x3a')]);_0xecae0f[_0x0c62('0x3d')]=_[_0x0c62('0x3e')](_0x10f1b5[_0x0c62('0x39')],qs['fields'](_0x68f47[_0x0c62('0x3a')][_0x0c62('0x3f')]));_0xecae0f[_0x0c62('0x3d')]=_0xecae0f[_0x0c62('0x3d')]['length']?_0xecae0f[_0x0c62('0x3d')]:_0x10f1b5[_0x0c62('0x39')];if(!_0x68f47[_0x0c62('0x3a')]['hasOwnProperty'](_0x0c62('0x40'))){_0xecae0f[_0x0c62('0x41')]=qs[_0x0c62('0x41')](_0x68f47['query']['limit']);_0xecae0f[_0x0c62('0x2a')]=qs[_0x0c62('0x2a')](_0x68f47[_0x0c62('0x3a')][_0x0c62('0x2a')]);}_0xecae0f['order']=qs[_0x0c62('0x42')](_0x68f47[_0x0c62('0x3a')][_0x0c62('0x42')]);_0xecae0f[_0x0c62('0x43')]=qs[_0x0c62('0x3c')](_[_0x0c62('0x44')](_0x68f47[_0x0c62('0x3a')],_0x10f1b5['filters']));if(_0x68f47[_0x0c62('0x3a')][_0x0c62('0x45')]){_0xecae0f['where']=_['merge'](_0xecae0f[_0x0c62('0x43')],{'$or':_[_0x0c62('0x33')](_0x18017f,function(_0x324cf6){if(_0x324cf6[_0x0c62('0x37')]!==_0x0c62('0x46')){var _0x3fd932={};_0x3fd932[_0x324cf6[_0x0c62('0x30')]]={'$like':'%'+_0x68f47[_0x0c62('0x3a')][_0x0c62('0x45')]+'%'};return _0x3fd932;}})});}_0xecae0f=_[_0x0c62('0x47')]({},_0xecae0f,_0x68f47['options']);var _0x15d989={'where':_0xecae0f[_0x0c62('0x43')]};return db[_0x0c62('0x34')][_0x0c62('0x29')](_0x15d989)['then'](function(_0x27594e){_0xa1f24b[_0x0c62('0x29')]=_0x27594e;if(_0x68f47['query'][_0x0c62('0x48')]){_0xecae0f[_0x0c62('0x49')]=[{'all':!![]}];}return db[_0x0c62('0x34')][_0x0c62('0x4a')](_0xecae0f);})['then'](function(_0x3d786a){_0xa1f24b[_0x0c62('0x4b')]=_0x3d786a;return _0xa1f24b;})[_0x0c62('0x1e')](respondWithFilteredResult(_0xe7fbec,_0xecae0f))[_0x0c62('0x4c')](handleError(_0xe7fbec,null));};exports[_0x0c62('0x4d')]=function(_0x1748c2,_0x2f07ff){var _0x5c2d3b={'raw':![],'where':{'id':_0x1748c2['params']['id']}},_0x59d360={};_0x59d360[_0x0c62('0x39')]=_[_0x0c62('0x3b')](db[_0x0c62('0x34')][_0x0c62('0x35')]);_0x59d360[_0x0c62('0x3a')]=_[_0x0c62('0x3b')](_0x1748c2[_0x0c62('0x3a')]);_0x59d360['filters']=_[_0x0c62('0x3e')](_0x59d360['model'],_0x59d360['query']);_0x5c2d3b[_0x0c62('0x3d')]=_['intersection'](_0x59d360['model'],qs[_0x0c62('0x3f')](_0x1748c2[_0x0c62('0x3a')][_0x0c62('0x3f')]));_0x5c2d3b[_0x0c62('0x3d')]=_0x5c2d3b[_0x0c62('0x3d')][_0x0c62('0x4e')]?_0x5c2d3b[_0x0c62('0x3d')]:_0x59d360[_0x0c62('0x39')];if(_0x1748c2[_0x0c62('0x3a')][_0x0c62('0x48')]){_0x5c2d3b[_0x0c62('0x49')]=[{'all':!![]}];}_0x5c2d3b=_[_0x0c62('0x47')]({},_0x5c2d3b,_0x1748c2['options']);return db['VtigerConfiguration'][_0x0c62('0x4f')](_0x5c2d3b)[_0x0c62('0x1e')](handleEntityNotFound(_0x2f07ff,null))['then'](respondWithResult(_0x2f07ff,null))[_0x0c62('0x4c')](handleError(_0x2f07ff,null));};exports[_0x0c62('0x50')]=function(_0x238f43,_0x26c107){return db['VtigerConfiguration'][_0x0c62('0x50')](_0x238f43[_0x0c62('0x51')],{})[_0x0c62('0x1e')](respondWithResult(_0x26c107,0xc9))['catch'](handleError(_0x26c107,null));};exports[_0x0c62('0x2f')]=function(_0x160bf4,_0x297202){if(_0x160bf4[_0x0c62('0x51')]['id']){delete _0x160bf4[_0x0c62('0x51')]['id'];}return db[_0x0c62('0x34')][_0x0c62('0x4f')]({'where':{'id':_0x160bf4[_0x0c62('0x52')]['id']}})[_0x0c62('0x1e')](handleEntityNotFound(_0x297202,null))['then'](saveUpdates(_0x160bf4[_0x0c62('0x51')],null))[_0x0c62('0x1e')](respondWithResult(_0x297202,null))[_0x0c62('0x4c')](handleError(_0x297202,null));};exports[_0x0c62('0x53')]=function(_0x23a97a,_0x59b8b1){return db['VtigerConfiguration'][_0x0c62('0x4f')]({'where':{'id':_0x23a97a[_0x0c62('0x52')]['id']}})[_0x0c62('0x1e')](handleEntityNotFound(_0x59b8b1,null))[_0x0c62('0x1e')](removeEntity(_0x59b8b1,null))[_0x0c62('0x4c')](handleError(_0x59b8b1,null));};exports['getFields']=function(_0x5668f8,_0x226ad2,_0x2bcd51){var _0x3a5066={};var _0x33ed3e={};var _0x471b3a;var _0x29a57f;return db[_0x0c62('0x34')]['findOne']({'where':{'id':_0x5668f8['params']['id']}})['then'](handleEntityNotFound(_0x226ad2,null))['then'](function(_0x5d00ff){if(_0x5d00ff){_0x471b3a=_0x5d00ff;_0x33ed3e[_0x0c62('0x39')]=_[_0x0c62('0x3b')](db[_0x0c62('0x54')][_0x0c62('0x35')]);_0x33ed3e[_0x0c62('0x3a')]=_[_0x0c62('0x3b')](_0x5668f8[_0x0c62('0x3a')]);_0x33ed3e[_0x0c62('0x3c')]=_['intersection'](_0x33ed3e['model'],_0x33ed3e['query']);_0x3a5066[_0x0c62('0x3d')]=_[_0x0c62('0x3e')](_0x33ed3e[_0x0c62('0x39')],qs[_0x0c62('0x3f')](_0x5668f8[_0x0c62('0x3a')][_0x0c62('0x3f')]));_0x3a5066[_0x0c62('0x3d')]=_0x3a5066[_0x0c62('0x3d')][_0x0c62('0x4e')]?_0x3a5066[_0x0c62('0x3d')]:_0x33ed3e['model'];_0x3a5066['order']=qs[_0x0c62('0x42')](_0x5668f8[_0x0c62('0x3a')][_0x0c62('0x42')]);_0x3a5066[_0x0c62('0x43')]=qs[_0x0c62('0x3c')](_[_0x0c62('0x44')](_0x5668f8[_0x0c62('0x3a')],_0x33ed3e[_0x0c62('0x3c')]));if(_0x5668f8[_0x0c62('0x3a')][_0x0c62('0x45')]){_0x3a5066[_0x0c62('0x43')]=_[_0x0c62('0x47')](_0x3a5066[_0x0c62('0x43')],{'$or':_[_0x0c62('0x33')](_0x3a5066['attributes'],function(_0x55850a){var _0x595615={};_0x595615[_0x55850a]={'$like':'%'+_0x5668f8[_0x0c62('0x3a')][_0x0c62('0x45')]+'%'};return _0x595615;})});}_0x3a5066=_[_0x0c62('0x47')]({},_0x3a5066,_0x5668f8['options']);return _0x471b3a[_0x0c62('0x55')](_0x3a5066);}})[_0x0c62('0x1e')](function(_0x1a19c0){if(_0x1a19c0){_0x29a57f=_0x1a19c0[_0x0c62('0x4e')];if(!_0x5668f8[_0x0c62('0x3a')][_0x0c62('0x56')](_0x0c62('0x40'))){_0x3a5066[_0x0c62('0x41')]=qs[_0x0c62('0x41')](_0x5668f8[_0x0c62('0x3a')][_0x0c62('0x41')]);_0x3a5066[_0x0c62('0x2a')]=qs[_0x0c62('0x2a')](_0x5668f8[_0x0c62('0x3a')][_0x0c62('0x2a')]);}return _0x471b3a['getFields'](_0x3a5066);}})[_0x0c62('0x1e')](function(_0x226216){if(_0x226216){return _0x226216?{'count':_0x29a57f,'rows':_0x226216}:null;}})['then'](respondWithResult(_0x226ad2,null))['catch'](handleError(_0x226ad2,null));};exports[_0x0c62('0x57')]=function(_0x328d6a,_0x42d236,_0x290ddb){var _0x28534b={};var _0x4627e2={};var _0x5c5c99;var _0x3cf656;return db[_0x0c62('0x34')]['findOne']({'where':{'id':_0x328d6a[_0x0c62('0x52')]['id']}})['then'](handleEntityNotFound(_0x42d236,null))[_0x0c62('0x1e')](function(_0x58a96b){if(_0x58a96b){_0x5c5c99=_0x58a96b;_0x4627e2[_0x0c62('0x39')]=_[_0x0c62('0x3b')](db[_0x0c62('0x54')]['rawAttributes']);_0x4627e2['query']=_[_0x0c62('0x3b')](_0x328d6a[_0x0c62('0x3a')]);_0x4627e2[_0x0c62('0x3c')]=_[_0x0c62('0x3e')](_0x4627e2[_0x0c62('0x39')],_0x4627e2[_0x0c62('0x3a')]);_0x28534b[_0x0c62('0x3d')]=_['intersection'](_0x4627e2[_0x0c62('0x39')],qs[_0x0c62('0x3f')](_0x328d6a['query']['fields']));_0x28534b[_0x0c62('0x3d')]=_0x28534b[_0x0c62('0x3d')][_0x0c62('0x4e')]?_0x28534b[_0x0c62('0x3d')]:_0x4627e2[_0x0c62('0x39')];_0x28534b[_0x0c62('0x58')]=qs['sort'](_0x328d6a[_0x0c62('0x3a')][_0x0c62('0x42')]);_0x28534b[_0x0c62('0x43')]=qs[_0x0c62('0x3c')](_[_0x0c62('0x44')](_0x328d6a['query'],_0x4627e2[_0x0c62('0x3c')]));if(_0x328d6a[_0x0c62('0x3a')][_0x0c62('0x45')]){_0x28534b['where']=_[_0x0c62('0x47')](_0x28534b[_0x0c62('0x43')],{'$or':_[_0x0c62('0x33')](_0x28534b['attributes'],function(_0xc35617){var _0xb35b17={};_0xb35b17[_0xc35617]={'$like':'%'+_0x328d6a[_0x0c62('0x3a')]['filter']+'%'};return _0xb35b17;})});}_0x28534b=_[_0x0c62('0x47')]({},_0x28534b,_0x328d6a[_0x0c62('0x59')]);return _0x5c5c99['getSubjects'](_0x28534b);}})[_0x0c62('0x1e')](function(_0x107ba5){if(_0x107ba5){_0x3cf656=_0x107ba5['length'];if(!_0x328d6a[_0x0c62('0x3a')]['hasOwnProperty'](_0x0c62('0x40'))){_0x28534b[_0x0c62('0x41')]=qs[_0x0c62('0x41')](_0x328d6a[_0x0c62('0x3a')][_0x0c62('0x41')]);_0x28534b[_0x0c62('0x2a')]=qs[_0x0c62('0x2a')](_0x328d6a[_0x0c62('0x3a')]['offset']);}return _0x5c5c99['getSubjects'](_0x28534b);}})['then'](function(_0x4ab3da){if(_0x4ab3da){return _0x4ab3da?{'count':_0x3cf656,'rows':_0x4ab3da}:null;}})[_0x0c62('0x1e')](respondWithResult(_0x42d236,null))['catch'](handleError(_0x42d236,null));};exports[_0x0c62('0x5a')]=function(_0x5c1958,_0x2c3dd4,_0x509006){var _0x237a5e={};var _0x3e711f={};var _0x331ccb;var _0x128ab3;return db[_0x0c62('0x34')][_0x0c62('0x5b')]({'where':{'id':_0x5c1958['params']['id']}})[_0x0c62('0x1e')](handleEntityNotFound(_0x2c3dd4,null))['then'](function(_0x1a9b03){if(_0x1a9b03){_0x331ccb=_0x1a9b03;_0x3e711f[_0x0c62('0x39')]=_[_0x0c62('0x3b')](db[_0x0c62('0x54')][_0x0c62('0x35')]);_0x3e711f[_0x0c62('0x3a')]=_[_0x0c62('0x3b')](_0x5c1958[_0x0c62('0x3a')]);_0x3e711f[_0x0c62('0x3c')]=_[_0x0c62('0x3e')](_0x3e711f[_0x0c62('0x39')],_0x3e711f[_0x0c62('0x3a')]);_0x237a5e[_0x0c62('0x3d')]=_[_0x0c62('0x3e')](_0x3e711f[_0x0c62('0x39')],qs[_0x0c62('0x3f')](_0x5c1958[_0x0c62('0x3a')]['fields']));_0x237a5e[_0x0c62('0x3d')]=_0x237a5e[_0x0c62('0x3d')]['length']?_0x237a5e[_0x0c62('0x3d')]:_0x3e711f['model'];_0x237a5e['order']=qs[_0x0c62('0x42')](_0x5c1958['query'][_0x0c62('0x42')]);_0x237a5e['where']=qs[_0x0c62('0x3c')](_[_0x0c62('0x44')](_0x5c1958[_0x0c62('0x3a')],_0x3e711f[_0x0c62('0x3c')]));if(_0x5c1958[_0x0c62('0x3a')][_0x0c62('0x45')]){_0x237a5e[_0x0c62('0x43')]=_[_0x0c62('0x47')](_0x237a5e[_0x0c62('0x43')],{'$or':_[_0x0c62('0x33')](_0x237a5e[_0x0c62('0x3d')],function(_0x4eab8c){var _0x5c8d1d={};_0x5c8d1d[_0x4eab8c]={'$like':'%'+_0x5c1958[_0x0c62('0x3a')][_0x0c62('0x45')]+'%'};return _0x5c8d1d;})});}_0x237a5e=_[_0x0c62('0x47')]({},_0x237a5e,_0x5c1958[_0x0c62('0x59')]);return _0x331ccb[_0x0c62('0x5a')](_0x237a5e);}})[_0x0c62('0x1e')](function(_0x2b56e2){if(_0x2b56e2){_0x128ab3=_0x2b56e2[_0x0c62('0x4e')];if(!_0x5c1958['query'][_0x0c62('0x56')](_0x0c62('0x40'))){_0x237a5e[_0x0c62('0x41')]=qs[_0x0c62('0x41')](_0x5c1958[_0x0c62('0x3a')][_0x0c62('0x41')]);_0x237a5e[_0x0c62('0x2a')]=qs[_0x0c62('0x2a')](_0x5c1958[_0x0c62('0x3a')][_0x0c62('0x2a')]);}return _0x331ccb[_0x0c62('0x5a')](_0x237a5e);}})[_0x0c62('0x1e')](function(_0x40076f){if(_0x40076f){return _0x40076f?{'count':_0x128ab3,'rows':_0x40076f}:null;}})[_0x0c62('0x1e')](respondWithResult(_0x2c3dd4,null))['catch'](handleError(_0x2c3dd4,null));}; \ No newline at end of file +var _0xbe60=['../../config/utils','../../config/environment','../../mysqldb','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~!@#$%^&-_=+[{]}.','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','VtigerConfiguration','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','rawAttributes','filters','find','create','body','getFields','findOne','VtigerField','order','hasOwnProperty','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x22e47a,_0x4ea10c){var _0x15a12a=function(_0x4a097f){while(--_0x4a097f){_0x22e47a['push'](_0x22e47a['shift']());}};_0x15a12a(++_0x4ea10c);}(_0xbe60,0x1bc));var _0x0be6=function(_0x4e9a48,_0x4d468c){_0x4e9a48=_0x4e9a48-0x0;var _0x365d55=_0xbe60[_0x4e9a48];return _0x365d55;};'use strict';var pdf=require(_0x0be6('0x0'));var emlformat=require(_0x0be6('0x1'));var rimraf=require(_0x0be6('0x2'));var zipdir=require(_0x0be6('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0be6('0x4'));var moment=require(_0x0be6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0be6('0x6'));var util=require('util');var path=require(_0x0be6('0x7'));var sox=require(_0x0be6('0x8'));var csv=require('to-csv');var ejs=require(_0x0be6('0x9'));var fs=require('fs');var _=require(_0x0be6('0xa'));var squel=require(_0x0be6('0xb'));var crypto=require(_0x0be6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0be6('0xd'));var toCsv=require(_0x0be6('0xe'));var querystring=require(_0x0be6('0xf'));var Papa=require(_0x0be6('0x10'));var Redis=require('ioredis');var authService=require(_0x0be6('0x11'));var qs=require(_0x0be6('0x12'));var as=require(_0x0be6('0x13'));var hardwareService=require(_0x0be6('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x0be6('0x15'));var config=require(_0x0be6('0x16'));var db=require(_0x0be6('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x0be6('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x3ca9d9,_0x3a18b8,_0x447789){if(_0x447789){var _0xaf0b3a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xaf0b3a[_0x0be6('0x19')](_0x3a18b8)){return _0x3ca9d9;}else{throw new db['Sequelize'][(_0x0be6('0x1a'))](_0x0be6('0x1b'));}}else{return _0x3ca9d9;}}function respondWithRpcPromise(_0x4c50dd,_0x3b83ee,_0x2efef2,_0x1d43d1){return new BPromise(function(_0x4aa4a7,_0x319564){var _0x1d1ed3=_0x1d43d1||client;return _0x1d1ed3['request'](_0x4c50dd,_0x2efef2)['then'](function(_0x4d881a){logger[_0x0be6('0x1c')](_0x0be6('0x1d'),_0x3b83ee,_0x0be6('0x1e'));logger[_0x0be6('0x1f')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x3b83ee,_0x0be6('0x1e'),JSON[_0x0be6('0x20')](_0x4d881a));if(_0x4d881a[_0x0be6('0x21')]){if(_0x4d881a['error'][_0x0be6('0x22')]===0x1f4){logger[_0x0be6('0x21')](_0x0be6('0x1d'),_0x3b83ee,_0x4d881a[_0x0be6('0x21')][_0x0be6('0x23')]);return _0x319564(_0x4d881a[_0x0be6('0x21')][_0x0be6('0x23')]);}logger[_0x0be6('0x21')]('VtigerConfiguration,\x20%s,\x20%s',_0x3b83ee,_0x4d881a[_0x0be6('0x21')][_0x0be6('0x23')]);return _0x4aa4a7(_0x4d881a[_0x0be6('0x21')][_0x0be6('0x23')]);}else{logger[_0x0be6('0x1c')]('VtigerConfiguration,\x20%s,\x20%s',_0x3b83ee,'request\x20sent');_0x4aa4a7(_0x4d881a[_0x0be6('0x24')][_0x0be6('0x23')]);}})[_0x0be6('0x25')](function(_0x289f2f){logger[_0x0be6('0x21')](_0x0be6('0x1d'),_0x3b83ee,_0x289f2f);_0x319564(_0x289f2f);});});}function respondWithStatusCode(_0x3bd834,_0x40770b){_0x40770b=_0x40770b||0xcc;return function(_0x15bb33){if(_0x15bb33){return _0x3bd834[_0x0be6('0x26')](_0x40770b);}return _0x3bd834[_0x0be6('0x27')](_0x40770b)[_0x0be6('0x28')]();};}function respondWithResult(_0x1fac41,_0x4a409a){_0x4a409a=_0x4a409a||0xc8;return function(_0x3f07de){if(_0x3f07de){return _0x1fac41[_0x0be6('0x27')](_0x4a409a)[_0x0be6('0x29')](_0x3f07de);}};}function respondWithFilteredResult(_0x2904c2,_0x295fdf){return function(_0x1ebc40){if(_0x1ebc40){var _0x3cac17=_0x1ebc40[_0x0be6('0x2a')],_0x49784a=_0x295fdf[_0x0be6('0x2b')],_0x2ecdb3=_0x295fdf[_0x0be6('0x2b')]+_0x295fdf['limit'],_0x72d877;if(_0x2ecdb3>=_0x3cac17){_0x2ecdb3=_0x3cac17;_0x72d877=0xc8;}else{_0x72d877=0xce;}_0x2904c2['status'](_0x72d877);return _0x2904c2[_0x0be6('0x2c')](_0x0be6('0x2d'),_0x49784a+'-'+_0x2ecdb3+'/'+_0x3cac17)[_0x0be6('0x29')](_0x1ebc40);}return null;};}function patchUpdates(_0x129dae){return function(_0x241223){try{jsonpatch['apply'](_0x241223,_0x129dae,!![]);}catch(_0x360dfc){return BPromise[_0x0be6('0x2e')](_0x360dfc);}return _0x241223[_0x0be6('0x2f')]();};}function saveUpdates(_0x1ba935,_0x2ebc39){return function(_0x3e97aa){if(_0x3e97aa){return _0x3e97aa[_0x0be6('0x30')](_0x1ba935)[_0x0be6('0x31')](function(_0x469bee){return _0x469bee;});}return null;};}function removeEntity(_0x2487ab,_0x118630){return function(_0x89eb2f){if(_0x89eb2f){return _0x89eb2f[_0x0be6('0x32')]()[_0x0be6('0x31')](function(){_0x2487ab[_0x0be6('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe0a582,_0x48df24){return function(_0x1fb36c){if(!_0x1fb36c){_0xe0a582[_0x0be6('0x26')](0x194);}return _0x1fb36c;};}function handleError(_0x5846ae,_0x38ca41){_0x38ca41=_0x38ca41||0x1f4;return function(_0x18f2a1){logger['error'](_0x18f2a1[_0x0be6('0x33')]);if(_0x18f2a1[_0x0be6('0x34')]){delete _0x18f2a1[_0x0be6('0x34')];}_0x5846ae[_0x0be6('0x27')](_0x38ca41)[_0x0be6('0x35')](_0x18f2a1);};}exports[_0x0be6('0x36')]=function(_0x335df5,_0x912f1a){var _0xa2a95e={},_0x3f4546={},_0x2a83aa={'count':0x0,'rows':[]};var _0x11e74e=_['map'](db[_0x0be6('0x37')]['rawAttributes'],function(_0x4ec0ce){return{'name':_0x4ec0ce[_0x0be6('0x38')],'type':_0x4ec0ce[_0x0be6('0x39')][_0x0be6('0x3a')]};});_0x3f4546[_0x0be6('0x3b')]=_[_0x0be6('0x3c')](_0x11e74e,'name');_0x3f4546[_0x0be6('0x3d')]=_[_0x0be6('0x3e')](_0x335df5[_0x0be6('0x3d')]);_0x3f4546['filters']=_[_0x0be6('0x3f')](_0x3f4546['model'],_0x3f4546[_0x0be6('0x3d')]);_0xa2a95e[_0x0be6('0x40')]=_[_0x0be6('0x3f')](_0x3f4546[_0x0be6('0x3b')],qs['fields'](_0x335df5[_0x0be6('0x3d')][_0x0be6('0x41')]));_0xa2a95e['attributes']=_0xa2a95e[_0x0be6('0x40')][_0x0be6('0x42')]?_0xa2a95e['attributes']:_0x3f4546[_0x0be6('0x3b')];if(!_0x335df5[_0x0be6('0x3d')]['hasOwnProperty'](_0x0be6('0x43'))){_0xa2a95e[_0x0be6('0x44')]=qs[_0x0be6('0x44')](_0x335df5[_0x0be6('0x3d')]['limit']);_0xa2a95e[_0x0be6('0x2b')]=qs['offset'](_0x335df5[_0x0be6('0x3d')][_0x0be6('0x2b')]);}_0xa2a95e['order']=qs[_0x0be6('0x45')](_0x335df5[_0x0be6('0x3d')][_0x0be6('0x45')]);_0xa2a95e[_0x0be6('0x46')]=qs['filters'](_[_0x0be6('0x47')](_0x335df5[_0x0be6('0x3d')],_0x3f4546['filters']));if(_0x335df5['query'][_0x0be6('0x48')]){_0xa2a95e[_0x0be6('0x46')]=_[_0x0be6('0x49')](_0xa2a95e[_0x0be6('0x46')],{'$or':_[_0x0be6('0x3c')](_0x11e74e,function(_0x174d5c){if(_0x174d5c['type']!==_0x0be6('0x4a')){var _0x4b4455={};_0x4b4455[_0x174d5c[_0x0be6('0x34')]]={'$like':'%'+_0x335df5[_0x0be6('0x3d')]['filter']+'%'};return _0x4b4455;}})});}_0xa2a95e=_[_0x0be6('0x49')]({},_0xa2a95e,_0x335df5[_0x0be6('0x4b')]);var _0x5a610f={'where':_0xa2a95e[_0x0be6('0x46')]};return db[_0x0be6('0x37')][_0x0be6('0x2a')](_0x5a610f)[_0x0be6('0x31')](function(_0x328833){_0x2a83aa[_0x0be6('0x2a')]=_0x328833;if(_0x335df5['query'][_0x0be6('0x4c')]){_0xa2a95e['include']=[{'all':!![]}];}return db[_0x0be6('0x37')][_0x0be6('0x4d')](_0xa2a95e);})[_0x0be6('0x31')](function(_0x5607c1){_0x2a83aa[_0x0be6('0x4e')]=_0x5607c1;return _0x2a83aa;})[_0x0be6('0x31')](respondWithFilteredResult(_0x912f1a,_0xa2a95e))[_0x0be6('0x25')](handleError(_0x912f1a,null));};exports[_0x0be6('0x4f')]=function(_0x50bc21,_0x411744){var _0x1fd279={'raw':![],'where':{'id':_0x50bc21[_0x0be6('0x50')]['id']}},_0xa3ed37={};_0xa3ed37[_0x0be6('0x3b')]=_[_0x0be6('0x3e')](db[_0x0be6('0x37')][_0x0be6('0x51')]);_0xa3ed37['query']=_[_0x0be6('0x3e')](_0x50bc21['query']);_0xa3ed37[_0x0be6('0x52')]=_[_0x0be6('0x3f')](_0xa3ed37[_0x0be6('0x3b')],_0xa3ed37[_0x0be6('0x3d')]);_0x1fd279[_0x0be6('0x40')]=_[_0x0be6('0x3f')](_0xa3ed37[_0x0be6('0x3b')],qs[_0x0be6('0x41')](_0x50bc21[_0x0be6('0x3d')][_0x0be6('0x41')]));_0x1fd279['attributes']=_0x1fd279[_0x0be6('0x40')][_0x0be6('0x42')]?_0x1fd279[_0x0be6('0x40')]:_0xa3ed37['model'];if(_0x50bc21['query']['includeAll']){_0x1fd279['include']=[{'all':!![]}];}_0x1fd279=_['merge']({},_0x1fd279,_0x50bc21['options']);return db[_0x0be6('0x37')][_0x0be6('0x53')](_0x1fd279)[_0x0be6('0x31')](handleEntityNotFound(_0x411744,null))[_0x0be6('0x31')](respondWithResult(_0x411744,null))[_0x0be6('0x25')](handleError(_0x411744,null));};exports['create']=function(_0x1ebb7e,_0x2f05b0){return db[_0x0be6('0x37')][_0x0be6('0x54')](_0x1ebb7e[_0x0be6('0x55')],{})[_0x0be6('0x31')](respondWithResult(_0x2f05b0,0xc9))[_0x0be6('0x25')](handleError(_0x2f05b0,null));};exports['update']=function(_0x49f3be,_0x5119bb){if(_0x49f3be[_0x0be6('0x55')]['id']){delete _0x49f3be[_0x0be6('0x55')]['id'];}return db['VtigerConfiguration'][_0x0be6('0x53')]({'where':{'id':_0x49f3be[_0x0be6('0x50')]['id']}})[_0x0be6('0x31')](handleEntityNotFound(_0x5119bb,null))[_0x0be6('0x31')](saveUpdates(_0x49f3be[_0x0be6('0x55')],null))['then'](respondWithResult(_0x5119bb,null))[_0x0be6('0x25')](handleError(_0x5119bb,null));};exports[_0x0be6('0x32')]=function(_0x51e029,_0x3a255c){return db[_0x0be6('0x37')][_0x0be6('0x53')]({'where':{'id':_0x51e029[_0x0be6('0x50')]['id']}})[_0x0be6('0x31')](handleEntityNotFound(_0x3a255c,null))['then'](removeEntity(_0x3a255c,null))[_0x0be6('0x25')](handleError(_0x3a255c,null));};exports[_0x0be6('0x56')]=function(_0x281d6a,_0x3f9f34,_0x3b5c40){var _0x2c68d3={};var _0x2619eb={};var _0x571050;var _0x2a7c38;return db[_0x0be6('0x37')][_0x0be6('0x57')]({'where':{'id':_0x281d6a['params']['id']}})['then'](handleEntityNotFound(_0x3f9f34,null))['then'](function(_0x21aa77){if(_0x21aa77){_0x571050=_0x21aa77;_0x2619eb['model']=_[_0x0be6('0x3e')](db[_0x0be6('0x58')]['rawAttributes']);_0x2619eb['query']=_[_0x0be6('0x3e')](_0x281d6a[_0x0be6('0x3d')]);_0x2619eb['filters']=_['intersection'](_0x2619eb[_0x0be6('0x3b')],_0x2619eb['query']);_0x2c68d3[_0x0be6('0x40')]=_['intersection'](_0x2619eb[_0x0be6('0x3b')],qs[_0x0be6('0x41')](_0x281d6a['query'][_0x0be6('0x41')]));_0x2c68d3[_0x0be6('0x40')]=_0x2c68d3['attributes'][_0x0be6('0x42')]?_0x2c68d3['attributes']:_0x2619eb[_0x0be6('0x3b')];_0x2c68d3[_0x0be6('0x59')]=qs[_0x0be6('0x45')](_0x281d6a[_0x0be6('0x3d')][_0x0be6('0x45')]);_0x2c68d3[_0x0be6('0x46')]=qs[_0x0be6('0x52')](_[_0x0be6('0x47')](_0x281d6a['query'],_0x2619eb[_0x0be6('0x52')]));if(_0x281d6a['query'][_0x0be6('0x48')]){_0x2c68d3[_0x0be6('0x46')]=_['merge'](_0x2c68d3[_0x0be6('0x46')],{'$or':_[_0x0be6('0x3c')](_0x2c68d3[_0x0be6('0x40')],function(_0x165dd9){var _0x829293={};_0x829293[_0x165dd9]={'$like':'%'+_0x281d6a[_0x0be6('0x3d')]['filter']+'%'};return _0x829293;})});}_0x2c68d3=_['merge']({},_0x2c68d3,_0x281d6a[_0x0be6('0x4b')]);return _0x571050[_0x0be6('0x56')](_0x2c68d3);}})[_0x0be6('0x31')](function(_0x1c097a){if(_0x1c097a){_0x2a7c38=_0x1c097a['length'];if(!_0x281d6a[_0x0be6('0x3d')][_0x0be6('0x5a')](_0x0be6('0x43'))){_0x2c68d3[_0x0be6('0x44')]=qs[_0x0be6('0x44')](_0x281d6a['query'][_0x0be6('0x44')]);_0x2c68d3[_0x0be6('0x2b')]=qs[_0x0be6('0x2b')](_0x281d6a[_0x0be6('0x3d')][_0x0be6('0x2b')]);}return _0x571050['getFields'](_0x2c68d3);}})[_0x0be6('0x31')](function(_0x483a26){if(_0x483a26){return _0x483a26?{'count':_0x2a7c38,'rows':_0x483a26}:null;}})[_0x0be6('0x31')](respondWithResult(_0x3f9f34,null))[_0x0be6('0x25')](handleError(_0x3f9f34,null));};exports[_0x0be6('0x5b')]=function(_0x3866e7,_0x568286,_0x364a29){var _0x26b1fc={};var _0x1a7b33={};var _0x45b9ef;var _0x3c585a;return db['VtigerConfiguration'][_0x0be6('0x57')]({'where':{'id':_0x3866e7[_0x0be6('0x50')]['id']}})[_0x0be6('0x31')](handleEntityNotFound(_0x568286,null))[_0x0be6('0x31')](function(_0x52c814){if(_0x52c814){_0x45b9ef=_0x52c814;_0x1a7b33['model']=_[_0x0be6('0x3e')](db[_0x0be6('0x58')][_0x0be6('0x51')]);_0x1a7b33[_0x0be6('0x3d')]=_[_0x0be6('0x3e')](_0x3866e7[_0x0be6('0x3d')]);_0x1a7b33[_0x0be6('0x52')]=_[_0x0be6('0x3f')](_0x1a7b33[_0x0be6('0x3b')],_0x1a7b33[_0x0be6('0x3d')]);_0x26b1fc['attributes']=_[_0x0be6('0x3f')](_0x1a7b33['model'],qs[_0x0be6('0x41')](_0x3866e7[_0x0be6('0x3d')][_0x0be6('0x41')]));_0x26b1fc[_0x0be6('0x40')]=_0x26b1fc[_0x0be6('0x40')][_0x0be6('0x42')]?_0x26b1fc['attributes']:_0x1a7b33['model'];_0x26b1fc[_0x0be6('0x59')]=qs[_0x0be6('0x45')](_0x3866e7['query'][_0x0be6('0x45')]);_0x26b1fc['where']=qs[_0x0be6('0x52')](_[_0x0be6('0x47')](_0x3866e7[_0x0be6('0x3d')],_0x1a7b33[_0x0be6('0x52')]));if(_0x3866e7['query']['filter']){_0x26b1fc[_0x0be6('0x46')]=_['merge'](_0x26b1fc[_0x0be6('0x46')],{'$or':_[_0x0be6('0x3c')](_0x26b1fc['attributes'],function(_0x285a61){var _0x103e31={};_0x103e31[_0x285a61]={'$like':'%'+_0x3866e7[_0x0be6('0x3d')][_0x0be6('0x48')]+'%'};return _0x103e31;})});}_0x26b1fc=_['merge']({},_0x26b1fc,_0x3866e7[_0x0be6('0x4b')]);return _0x45b9ef[_0x0be6('0x5b')](_0x26b1fc);}})[_0x0be6('0x31')](function(_0x48420f){if(_0x48420f){_0x3c585a=_0x48420f[_0x0be6('0x42')];if(!_0x3866e7[_0x0be6('0x3d')]['hasOwnProperty'](_0x0be6('0x43'))){_0x26b1fc[_0x0be6('0x44')]=qs[_0x0be6('0x44')](_0x3866e7[_0x0be6('0x3d')][_0x0be6('0x44')]);_0x26b1fc[_0x0be6('0x2b')]=qs[_0x0be6('0x2b')](_0x3866e7[_0x0be6('0x3d')][_0x0be6('0x2b')]);}return _0x45b9ef[_0x0be6('0x5b')](_0x26b1fc);}})['then'](function(_0x36da06){if(_0x36da06){return _0x36da06?{'count':_0x3c585a,'rows':_0x36da06}:null;}})[_0x0be6('0x31')](respondWithResult(_0x568286,null))['catch'](handleError(_0x568286,null));};exports[_0x0be6('0x5c')]=function(_0x48e1f7,_0x10e4f5,_0x9d48f0){var _0x18a554={};var _0x3392c0={};var _0x3cdbbc;var _0x5defa1;return db[_0x0be6('0x37')][_0x0be6('0x57')]({'where':{'id':_0x48e1f7['params']['id']}})['then'](handleEntityNotFound(_0x10e4f5,null))[_0x0be6('0x31')](function(_0x4f45d8){if(_0x4f45d8){_0x3cdbbc=_0x4f45d8;_0x3392c0[_0x0be6('0x3b')]=_['keys'](db[_0x0be6('0x58')][_0x0be6('0x51')]);_0x3392c0['query']=_[_0x0be6('0x3e')](_0x48e1f7['query']);_0x3392c0[_0x0be6('0x52')]=_[_0x0be6('0x3f')](_0x3392c0['model'],_0x3392c0['query']);_0x18a554[_0x0be6('0x40')]=_['intersection'](_0x3392c0['model'],qs[_0x0be6('0x41')](_0x48e1f7['query'][_0x0be6('0x41')]));_0x18a554[_0x0be6('0x40')]=_0x18a554[_0x0be6('0x40')][_0x0be6('0x42')]?_0x18a554[_0x0be6('0x40')]:_0x3392c0[_0x0be6('0x3b')];_0x18a554[_0x0be6('0x59')]=qs[_0x0be6('0x45')](_0x48e1f7['query'][_0x0be6('0x45')]);_0x18a554['where']=qs['filters'](_[_0x0be6('0x47')](_0x48e1f7[_0x0be6('0x3d')],_0x3392c0['filters']));if(_0x48e1f7[_0x0be6('0x3d')]['filter']){_0x18a554[_0x0be6('0x46')]=_[_0x0be6('0x49')](_0x18a554[_0x0be6('0x46')],{'$or':_[_0x0be6('0x3c')](_0x18a554[_0x0be6('0x40')],function(_0x4e524f){var _0x48516a={};_0x48516a[_0x4e524f]={'$like':'%'+_0x48e1f7[_0x0be6('0x3d')][_0x0be6('0x48')]+'%'};return _0x48516a;})});}_0x18a554=_[_0x0be6('0x49')]({},_0x18a554,_0x48e1f7[_0x0be6('0x4b')]);return _0x3cdbbc[_0x0be6('0x5c')](_0x18a554);}})[_0x0be6('0x31')](function(_0x27a265){if(_0x27a265){_0x5defa1=_0x27a265['length'];if(!_0x48e1f7['query'][_0x0be6('0x5a')](_0x0be6('0x43'))){_0x18a554['limit']=qs[_0x0be6('0x44')](_0x48e1f7[_0x0be6('0x3d')][_0x0be6('0x44')]);_0x18a554['offset']=qs[_0x0be6('0x2b')](_0x48e1f7[_0x0be6('0x3d')][_0x0be6('0x2b')]);}return _0x3cdbbc[_0x0be6('0x5c')](_0x18a554);}})['then'](function(_0x2eb3fe){if(_0x2eb3fe){return _0x2eb3fe?{'count':_0x5defa1,'rows':_0x2eb3fe}:null;}})[_0x0be6('0x31')](respondWithResult(_0x10e4f5,null))[_0x0be6('0x25')](handleError(_0x10e4f5,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index a63eb95..115ec09 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 _0xd2b7=['define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','exports'];(function(_0x500106,_0xe35499){var _0x2344a0=function(_0x31f106){while(--_0x31f106){_0x500106['push'](_0x500106['shift']());}};_0x2344a0(++_0xe35499);}(_0xd2b7,0x121));var _0x7d2b=function(_0x40822a,_0x582b60){_0x40822a=_0x40822a-0x0;var _0x357420=_0xd2b7[_0x40822a];return _0x357420;};'use strict';var _=require(_0x7d2b('0x0'));var util=require(_0x7d2b('0x1'));var logger=require(_0x7d2b('0x2'))(_0x7d2b('0x3'));var moment=require(_0x7d2b('0x4'));var BPromise=require(_0x7d2b('0x5'));var rp=require(_0x7d2b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intVtigerConfiguration.attributes');module[_0x7d2b('0x7')]=function(_0x7bd511,_0x37ed96){return _0x7bd511[_0x7d2b('0x8')](_0x7d2b('0x9'),attributes,{'tableName':_0x7d2b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb67=['int_vtiger_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intVtigerConfiguration.attributes','exports','VtigerConfiguration'];(function(_0x4ac5c1,_0x12f4bc){var _0x17c632=function(_0x5a586c){while(--_0x5a586c){_0x4ac5c1['push'](_0x4ac5c1['shift']());}};_0x17c632(++_0x12f4bc);}(_0xfb67,0x91));var _0x7fb6=function(_0x26a093,_0x18faae){_0x26a093=_0x26a093-0x0;var _0x266f9b=_0xfb67[_0x26a093];return _0x266f9b;};'use strict';var _=require(_0x7fb6('0x0'));var util=require('util');var logger=require(_0x7fb6('0x1'))(_0x7fb6('0x2'));var moment=require(_0x7fb6('0x3'));var BPromise=require(_0x7fb6('0x4'));var rp=require(_0x7fb6('0x5'));var fs=require('fs');var path=require(_0x7fb6('0x6'));var rimraf=require('rimraf');var config=require(_0x7fb6('0x7'));var attributes=require(_0x7fb6('0x8'));module[_0x7fb6('0x9')]=function(_0x151632,_0x30bc46){return _0x151632['define'](_0x7fb6('0xa'),attributes,{'tableName':_0x7fb6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 160b7e2..6d9973d 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 _0x0f70=['result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x32d414,_0x4d23da){var _0x4e0bca=function(_0x15d397){while(--_0x15d397){_0x32d414['push'](_0x32d414['shift']());}};_0x4e0bca(++_0x4d23da);}(_0x0f70,0x95));var _0x00f7=function(_0x2f8bc5,_0x12e3d1){_0x2f8bc5=_0x2f8bc5-0x0;var _0x2e4207=_0x0f70[_0x2f8bc5];return _0x2e4207;};'use strict';var _=require(_0x00f7('0x0'));var util=require(_0x00f7('0x1'));var moment=require(_0x00f7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x00f7('0x3'));var db=require(_0x00f7('0x4'))['db'];var utils=require(_0x00f7('0x5'));var logger=require('../../config/logger')(_0x00f7('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x00f7('0x7')][_0x00f7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x58fd50,_0x43528f,_0x53007b){return new BPromise(function(_0x5186ae,_0x4333d3){return client[_0x00f7('0x9')](_0x58fd50,_0x53007b)['then'](function(_0x32cbee){logger['info'](_0x00f7('0xa'),_0x43528f,_0x00f7('0xb'));logger[_0x00f7('0xc')](_0x00f7('0xd'),_0x43528f,_0x00f7('0xb'),JSON[_0x00f7('0xe')](_0x32cbee));if(_0x32cbee[_0x00f7('0xf')]){if(_0x32cbee[_0x00f7('0xf')][_0x00f7('0x10')]===0x1f4){logger[_0x00f7('0xf')](_0x00f7('0xa'),_0x43528f,_0x32cbee[_0x00f7('0xf')][_0x00f7('0x11')]);return _0x4333d3(_0x32cbee[_0x00f7('0xf')][_0x00f7('0x11')]);}logger[_0x00f7('0xf')](_0x00f7('0xa'),_0x43528f,_0x32cbee['error']['message']);return _0x5186ae(_0x32cbee[_0x00f7('0xf')][_0x00f7('0x11')]);}else{logger[_0x00f7('0x12')](_0x00f7('0xa'),_0x43528f,_0x00f7('0xb'));_0x5186ae(_0x32cbee[_0x00f7('0x13')][_0x00f7('0x11')]);}})[_0x00f7('0x14')](function(_0xe0cd67){logger[_0x00f7('0xf')](_0x00f7('0xa'),_0x43528f,_0xe0cd67);_0x4333d3(_0xe0cd67);});});} \ No newline at end of file +var _0x5e4f=['stringify','error','code','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x18839c,_0x48453b){var _0x16e30b=function(_0x5094a4){while(--_0x5094a4){_0x18839c['push'](_0x18839c['shift']());}};_0x16e30b(++_0x48453b);}(_0x5e4f,0x166));var _0xf5e4=function(_0x315c6e,_0x51d5ad){_0x315c6e=_0x315c6e-0x0;var _0x2169f4=_0x5e4f[_0x315c6e];return _0x2169f4;};'use strict';var _=require(_0xf5e4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf5e4('0x1'));var rs=require(_0xf5e4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf5e4('0x3'))['db'];var utils=require(_0xf5e4('0x4'));var logger=require(_0xf5e4('0x5'))(_0xf5e4('0x6'));var config=require(_0xf5e4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf5e4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc5c120,_0xaaf171,_0x6360c8){return new BPromise(function(_0x36476b,_0x368c1a){return client[_0xf5e4('0x9')](_0xc5c120,_0x6360c8)[_0xf5e4('0xa')](function(_0x4f3554){logger[_0xf5e4('0xb')](_0xf5e4('0xc'),_0xaaf171,_0xf5e4('0xd'));logger[_0xf5e4('0xe')](_0xf5e4('0xf'),_0xaaf171,_0xf5e4('0xd'),JSON[_0xf5e4('0x10')](_0x4f3554));if(_0x4f3554['error']){if(_0x4f3554[_0xf5e4('0x11')][_0xf5e4('0x12')]===0x1f4){logger['error'](_0xf5e4('0xc'),_0xaaf171,_0x4f3554['error'][_0xf5e4('0x13')]);return _0x368c1a(_0x4f3554[_0xf5e4('0x11')][_0xf5e4('0x13')]);}logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0xaaf171,_0x4f3554[_0xf5e4('0x11')][_0xf5e4('0x13')]);return _0x36476b(_0x4f3554[_0xf5e4('0x11')][_0xf5e4('0x13')]);}else{logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0xaaf171,_0xf5e4('0xd'));_0x36476b(_0x4f3554[_0xf5e4('0x14')][_0xf5e4('0x13')]);}})[_0xf5e4('0x15')](function(_0x45a4aa){logger['error'](_0xf5e4('0xc'),_0xaaf171,_0x45a4aa);_0x368c1a(_0x45a4aa);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 64d745c..0fcd4db 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 _0x83d4=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','multer','util','path'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x83d4,0x1cb));var _0x483d=function(_0x398947,_0x3f0dfb){_0x398947=_0x398947-0x0;var _0x2b1a00=_0x83d4[_0x398947];return _0x2b1a00;};'use strict';var multer=require(_0x483d('0x0'));var util=require(_0x483d('0x1'));var path=require(_0x483d('0x2'));var timeout=require(_0x483d('0x3'));var express=require(_0x483d('0x4'));var router=express[_0x483d('0x5')]();var auth=require(_0x483d('0x6'));var interaction=require(_0x483d('0x7'));var config=require(_0x483d('0x8'));var controller=require(_0x483d('0x9'));router['get']('/',auth[_0x483d('0xa')](),controller[_0x483d('0xb')]);router[_0x483d('0xc')](_0x483d('0xd'),auth['isAuthenticated'](),controller[_0x483d('0xe')]);router[_0x483d('0xf')]('/',auth[_0x483d('0xa')](),controller[_0x483d('0x10')]);router[_0x483d('0x11')](_0x483d('0xd'),auth[_0x483d('0xa')](),controller[_0x483d('0x12')]);router[_0x483d('0x13')](_0x483d('0xd'),auth[_0x483d('0xa')](),controller[_0x483d('0x14')]);module['exports']=router; \ No newline at end of file +var _0x8a1c=['delete','destroy','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0x8a1c,0x1de));var _0xc8a1=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x8a1c[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0xc8a1('0x0'));var util=require(_0xc8a1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc8a1('0x2'));var router=express[_0xc8a1('0x3')]();var auth=require(_0xc8a1('0x4'));var interaction=require(_0xc8a1('0x5'));var config=require(_0xc8a1('0x6'));var controller=require('./intVtigerField.controller');router[_0xc8a1('0x7')]('/',auth[_0xc8a1('0x8')](),controller[_0xc8a1('0x9')]);router[_0xc8a1('0x7')](_0xc8a1('0xa'),auth[_0xc8a1('0x8')](),controller['show']);router[_0xc8a1('0xb')]('/',auth[_0xc8a1('0x8')](),controller[_0xc8a1('0xc')]);router[_0xc8a1('0xd')](_0xc8a1('0xa'),auth[_0xc8a1('0x8')](),controller[_0xc8a1('0xe')]);router[_0xc8a1('0xf')](_0xc8a1('0xa'),auth[_0xc8a1('0x8')](),controller[_0xc8a1('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index aaf874e..f5f7425 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 _0x4508=['ENUM','string','customVariable','keyValue','STRING','variable','BOOLEAN','exports'];(function(_0x553c2a,_0x592c23){var _0x37988b=function(_0x5ccdf1){while(--_0x5ccdf1){_0x553c2a['push'](_0x553c2a['shift']());}};_0x37988b(++_0x592c23);}(_0x4508,0x1ef));var _0x8450=function(_0x5a41ae,_0x51ddc8){_0x5a41ae=_0x5a41ae-0x0;var _0x78f90c=_0x4508[_0x5a41ae];return _0x78f90c;};'use strict';var Sequelize=require('sequelize');module[_0x8450('0x0')]={'type':{'type':Sequelize[_0x8450('0x1')](_0x8450('0x2'),'variable',_0x8450('0x3'),_0x8450('0x4')),'defaultValue':_0x8450('0x2')},'content':{'type':Sequelize[_0x8450('0x5')]},'key':{'type':Sequelize[_0x8450('0x5')]},'keyType':{'type':Sequelize[_0x8450('0x1')](_0x8450('0x2'),_0x8450('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0x8450('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x8450('0x5')]},'customField':{'type':Sequelize[_0x8450('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x089f=['exports','ENUM','string','variable','customVariable','STRING','BOOLEAN'];(function(_0x55677b,_0x3e5655){var _0x104b88=function(_0x78d34f){while(--_0x78d34f){_0x55677b['push'](_0x55677b['shift']());}};_0x104b88(++_0x3e5655);}(_0x089f,0x1c7));var _0xf089=function(_0x510bd3,_0x459b63){_0x510bd3=_0x510bd3-0x0;var _0x23bc1c=_0x089f[_0x510bd3];return _0x23bc1c;};'use strict';var Sequelize=require('sequelize');module[_0xf089('0x0')]={'type':{'type':Sequelize[_0xf089('0x1')](_0xf089('0x2'),_0xf089('0x3'),_0xf089('0x4'),'keyValue'),'defaultValue':_0xf089('0x2')},'content':{'type':Sequelize[_0xf089('0x5')]},'key':{'type':Sequelize[_0xf089('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xf089('0x2'),_0xf089('0x3'),_0xf089('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xf089('0x5')]},'nameField':{'type':Sequelize[_0xf089('0x5')]},'customField':{'type':Sequelize[_0xf089('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 30d8bd0..fb33aad 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 _0x96ce=['VtigerField','count','includeAll','findAll','rows','catch','show','params','find','create','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','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','status','offset','set','Content-Range','json','save','update','then','destroy','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options'];(function(_0x2b4d01,_0x4c6044){var _0x4195d7=function(_0x59935){while(--_0x59935){_0x2b4d01['push'](_0x2b4d01['shift']());}};_0x4195d7(++_0x4c6044);}(_0x96ce,0xec));var _0xe96c=function(_0x4013da,_0xeaf6dc){_0x4013da=_0x4013da-0x0;var _0x434e19=_0x96ce[_0x4013da];return _0x434e19;};'use strict';var pdf=require(_0xe96c('0x0'));var emlformat=require(_0xe96c('0x1'));var rimraf=require(_0xe96c('0x2'));var zipdir=require(_0xe96c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe96c('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe96c('0x5'));var util=require(_0xe96c('0x6'));var path=require(_0xe96c('0x7'));var sox=require(_0xe96c('0x8'));var csv=require(_0xe96c('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe96c('0xa'));var squel=require(_0xe96c('0xb'));var crypto=require(_0xe96c('0xc'));var jsforce=require(_0xe96c('0xd'));var deskjs=require(_0xe96c('0xe'));var toCsv=require(_0xe96c('0x9'));var querystring=require('querystring');var Papa=require(_0xe96c('0xf'));var Redis=require(_0xe96c('0x10'));var authService=require(_0xe96c('0x11'));var qs=require(_0xe96c('0x12'));var as=require(_0xe96c('0x13'));var hardwareService=require(_0xe96c('0x14'));var logger=require('../../config/logger')(_0xe96c('0x15'));var utils=require(_0xe96c('0x16'));var config=require(_0xe96c('0x17'));var db=require(_0xe96c('0x18'))['db'];function respondWithStatusCode(_0x5d9a0b,_0x22d973){_0x22d973=_0x22d973||0xcc;return function(_0x4c63c4){if(_0x4c63c4){return _0x5d9a0b['sendStatus'](_0x22d973);}return _0x5d9a0b[_0xe96c('0x19')](_0x22d973)['end']();};}function respondWithResult(_0x4af589,_0x225515){_0x225515=_0x225515||0xc8;return function(_0x173d43){if(_0x173d43){return _0x4af589['status'](_0x225515)['json'](_0x173d43);}};}function respondWithFilteredResult(_0x1e8178,_0x2a8db7){return function(_0x53cda3){if(_0x53cda3){var _0x54698e=_0x53cda3['count'],_0x387b64=_0x2a8db7[_0xe96c('0x1a')],_0x32fdff=_0x2a8db7[_0xe96c('0x1a')]+_0x2a8db7['limit'],_0x4f8e8c;if(_0x32fdff>=_0x54698e){_0x32fdff=_0x54698e;_0x4f8e8c=0xc8;}else{_0x4f8e8c=0xce;}_0x1e8178[_0xe96c('0x19')](_0x4f8e8c);return _0x1e8178[_0xe96c('0x1b')](_0xe96c('0x1c'),_0x387b64+'-'+_0x32fdff+'/'+_0x54698e)[_0xe96c('0x1d')](_0x53cda3);}return null;};}function patchUpdates(_0x2ca386){return function(_0x1de7e8){try{jsonpatch['apply'](_0x1de7e8,_0x2ca386,!![]);}catch(_0x13ce42){return BPromise['reject'](_0x13ce42);}return _0x1de7e8[_0xe96c('0x1e')]();};}function saveUpdates(_0x473b76,_0x2408e2){return function(_0xfb8d87){if(_0xfb8d87){return _0xfb8d87[_0xe96c('0x1f')](_0x473b76)[_0xe96c('0x20')](function(_0x2f4aff){return _0x2f4aff;});}return null;};}function removeEntity(_0x2311b2,_0x4f7f9b){return function(_0x5d30a5){if(_0x5d30a5){return _0x5d30a5[_0xe96c('0x21')]()['then'](function(){_0x2311b2[_0xe96c('0x19')](0xcc)[_0xe96c('0x22')]();});}};}function handleEntityNotFound(_0x5d3775,_0x593107){return function(_0x5a591f){if(!_0x5a591f){_0x5d3775[_0xe96c('0x23')](0x194);}return _0x5a591f;};}function handleError(_0xcb15cd,_0x2e14ff){_0x2e14ff=_0x2e14ff||0x1f4;return function(_0x3e8029){logger['error'](_0x3e8029[_0xe96c('0x24')]);if(_0x3e8029['name']){delete _0x3e8029[_0xe96c('0x25')];}_0xcb15cd['status'](_0x2e14ff)[_0xe96c('0x26')](_0x3e8029);};}exports[_0xe96c('0x27')]=function(_0x5a0bcc,_0x409557){var _0xca5e65={},_0x52e46e={},_0x18b44b={'count':0x0,'rows':[]};var _0x574eed=_[_0xe96c('0x28')](db['VtigerField'][_0xe96c('0x29')],function(_0x4457f1){return{'name':_0x4457f1[_0xe96c('0x2a')],'type':_0x4457f1[_0xe96c('0x2b')][_0xe96c('0x2c')]};});_0x52e46e[_0xe96c('0x2d')]=_[_0xe96c('0x28')](_0x574eed,_0xe96c('0x25'));_0x52e46e['query']=_[_0xe96c('0x2e')](_0x5a0bcc[_0xe96c('0x2f')]);_0x52e46e['filters']=_[_0xe96c('0x30')](_0x52e46e['model'],_0x52e46e[_0xe96c('0x2f')]);_0xca5e65['attributes']=_[_0xe96c('0x30')](_0x52e46e['model'],qs['fields'](_0x5a0bcc['query'][_0xe96c('0x31')]));_0xca5e65[_0xe96c('0x32')]=_0xca5e65['attributes'][_0xe96c('0x33')]?_0xca5e65[_0xe96c('0x32')]:_0x52e46e[_0xe96c('0x2d')];if(!_0x5a0bcc[_0xe96c('0x2f')][_0xe96c('0x34')](_0xe96c('0x35'))){_0xca5e65['limit']=qs[_0xe96c('0x36')](_0x5a0bcc[_0xe96c('0x2f')][_0xe96c('0x36')]);_0xca5e65[_0xe96c('0x1a')]=qs[_0xe96c('0x1a')](_0x5a0bcc[_0xe96c('0x2f')][_0xe96c('0x1a')]);}_0xca5e65[_0xe96c('0x37')]=qs[_0xe96c('0x38')](_0x5a0bcc[_0xe96c('0x2f')][_0xe96c('0x38')]);_0xca5e65[_0xe96c('0x39')]=qs[_0xe96c('0x3a')](_[_0xe96c('0x3b')](_0x5a0bcc[_0xe96c('0x2f')],_0x52e46e['filters']));if(_0x5a0bcc['query'][_0xe96c('0x3c')]){_0xca5e65[_0xe96c('0x39')]=_['merge'](_0xca5e65[_0xe96c('0x39')],{'$or':_['map'](_0x574eed,function(_0x384c98){if(_0x384c98[_0xe96c('0x2b')]!==_0xe96c('0x3d')){var _0x463bc1={};_0x463bc1[_0x384c98[_0xe96c('0x25')]]={'$like':'%'+_0x5a0bcc[_0xe96c('0x2f')]['filter']+'%'};return _0x463bc1;}})});}_0xca5e65=_[_0xe96c('0x3e')]({},_0xca5e65,_0x5a0bcc[_0xe96c('0x3f')]);var _0x431e14={'where':_0xca5e65['where']};return db[_0xe96c('0x40')][_0xe96c('0x41')](_0x431e14)[_0xe96c('0x20')](function(_0x33987f){_0x18b44b[_0xe96c('0x41')]=_0x33987f;if(_0x5a0bcc[_0xe96c('0x2f')][_0xe96c('0x42')]){_0xca5e65['include']=[{'all':!![]}];}return db[_0xe96c('0x40')][_0xe96c('0x43')](_0xca5e65);})[_0xe96c('0x20')](function(_0x254d77){_0x18b44b[_0xe96c('0x44')]=_0x254d77;return _0x18b44b;})[_0xe96c('0x20')](respondWithFilteredResult(_0x409557,_0xca5e65))[_0xe96c('0x45')](handleError(_0x409557,null));};exports[_0xe96c('0x46')]=function(_0x530f72,_0x4bba3f){var _0x1f56bd={'raw':!![],'where':{'id':_0x530f72[_0xe96c('0x47')]['id']}},_0x4f4e38={};_0x4f4e38[_0xe96c('0x2d')]=_[_0xe96c('0x2e')](db[_0xe96c('0x40')][_0xe96c('0x29')]);_0x4f4e38[_0xe96c('0x2f')]=_[_0xe96c('0x2e')](_0x530f72[_0xe96c('0x2f')]);_0x4f4e38[_0xe96c('0x3a')]=_[_0xe96c('0x30')](_0x4f4e38['model'],_0x4f4e38[_0xe96c('0x2f')]);_0x1f56bd[_0xe96c('0x32')]=_[_0xe96c('0x30')](_0x4f4e38[_0xe96c('0x2d')],qs[_0xe96c('0x31')](_0x530f72[_0xe96c('0x2f')][_0xe96c('0x31')]));_0x1f56bd[_0xe96c('0x32')]=_0x1f56bd[_0xe96c('0x32')][_0xe96c('0x33')]?_0x1f56bd['attributes']:_0x4f4e38[_0xe96c('0x2d')];if(_0x530f72['query'][_0xe96c('0x42')]){_0x1f56bd['include']=[{'all':!![]}];}_0x1f56bd=_['merge']({},_0x1f56bd,_0x530f72['options']);return db[_0xe96c('0x40')][_0xe96c('0x48')](_0x1f56bd)[_0xe96c('0x20')](handleEntityNotFound(_0x4bba3f,null))[_0xe96c('0x20')](respondWithResult(_0x4bba3f,null))['catch'](handleError(_0x4bba3f,null));};exports[_0xe96c('0x49')]=function(_0x259488,_0x106701){return db[_0xe96c('0x40')][_0xe96c('0x49')](_0x259488[_0xe96c('0x4a')],{})[_0xe96c('0x20')](respondWithResult(_0x106701,0xc9))[_0xe96c('0x45')](handleError(_0x106701,null));};exports[_0xe96c('0x1f')]=function(_0x622c20,_0x1c7169){if(_0x622c20[_0xe96c('0x4a')]['id']){delete _0x622c20['body']['id'];}return db[_0xe96c('0x40')]['find']({'where':{'id':_0x622c20['params']['id']}})[_0xe96c('0x20')](handleEntityNotFound(_0x1c7169,null))[_0xe96c('0x20')](saveUpdates(_0x622c20[_0xe96c('0x4a')],null))[_0xe96c('0x20')](respondWithResult(_0x1c7169,null))[_0xe96c('0x45')](handleError(_0x1c7169,null));};exports[_0xe96c('0x21')]=function(_0x18b28d,_0x1a494a){return db[_0xe96c('0x40')]['find']({'where':{'id':_0x18b28d[_0xe96c('0x47')]['id']}})[_0xe96c('0x20')](handleEntityNotFound(_0x1a494a,null))[_0xe96c('0x20')](removeEntity(_0x1a494a,null))['catch'](handleError(_0x1a494a,null));}; \ No newline at end of file +var _0x9499=['model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','VtigerField','rawAttributes','fieldName','type','key','query','keys','intersection'];(function(_0x1da06b,_0x274c4b){var _0x370e3b=function(_0x423bd5){while(--_0x423bd5){_0x1da06b['push'](_0x1da06b['shift']());}};_0x370e3b(++_0x274c4b);}(_0x9499,0x1e7));var _0x9949=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9499[_0x122ef9];return _0x42fba0;};'use strict';var pdf=require(_0x9949('0x0'));var emlformat=require(_0x9949('0x1'));var rimraf=require(_0x9949('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9949('0x3'));var rp=require('request-promise');var moment=require(_0x9949('0x4'));var BPromise=require(_0x9949('0x5'));var Mustache=require(_0x9949('0x6'));var util=require(_0x9949('0x7'));var path=require('path');var sox=require(_0x9949('0x8'));var csv=require(_0x9949('0x9'));var ejs=require(_0x9949('0xa'));var fs=require('fs');var _=require(_0x9949('0xb'));var squel=require(_0x9949('0xc'));var crypto=require(_0x9949('0xd'));var jsforce=require(_0x9949('0xe'));var deskjs=require(_0x9949('0xf'));var toCsv=require(_0x9949('0x9'));var querystring=require(_0x9949('0x10'));var Papa=require('papaparse');var Redis=require(_0x9949('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9949('0x12'));var as=require(_0x9949('0x13'));var hardwareService=require(_0x9949('0x14'));var logger=require('../../config/logger')(_0x9949('0x15'));var utils=require(_0x9949('0x16'));var config=require(_0x9949('0x17'));var db=require(_0x9949('0x18'))['db'];function respondWithStatusCode(_0x29b9bc,_0x26f496){_0x26f496=_0x26f496||0xcc;return function(_0x5a4098){if(_0x5a4098){return _0x29b9bc['sendStatus'](_0x26f496);}return _0x29b9bc[_0x9949('0x19')](_0x26f496)[_0x9949('0x1a')]();};}function respondWithResult(_0x3156f6,_0xed6a0f){_0xed6a0f=_0xed6a0f||0xc8;return function(_0x53f263){if(_0x53f263){return _0x3156f6[_0x9949('0x19')](_0xed6a0f)[_0x9949('0x1b')](_0x53f263);}};}function respondWithFilteredResult(_0x13cac6,_0x14c617){return function(_0x387f26){if(_0x387f26){var _0x11a6fb=_0x387f26[_0x9949('0x1c')],_0x3e304a=_0x14c617[_0x9949('0x1d')],_0xa3f67e=_0x14c617[_0x9949('0x1d')]+_0x14c617['limit'],_0x573b29;if(_0xa3f67e>=_0x11a6fb){_0xa3f67e=_0x11a6fb;_0x573b29=0xc8;}else{_0x573b29=0xce;}_0x13cac6[_0x9949('0x19')](_0x573b29);return _0x13cac6[_0x9949('0x1e')](_0x9949('0x1f'),_0x3e304a+'-'+_0xa3f67e+'/'+_0x11a6fb)[_0x9949('0x1b')](_0x387f26);}return null;};}function patchUpdates(_0x1b6208){return function(_0x1e94bd){try{jsonpatch[_0x9949('0x20')](_0x1e94bd,_0x1b6208,!![]);}catch(_0x1fadf8){return BPromise[_0x9949('0x21')](_0x1fadf8);}return _0x1e94bd[_0x9949('0x22')]();};}function saveUpdates(_0x3b53fc,_0x385bd0){return function(_0x258ae9){if(_0x258ae9){return _0x258ae9[_0x9949('0x23')](_0x3b53fc)[_0x9949('0x24')](function(_0x16a98f){return _0x16a98f;});}return null;};}function removeEntity(_0x40e95f,_0x8c3ce3){return function(_0x55145c){if(_0x55145c){return _0x55145c[_0x9949('0x25')]()[_0x9949('0x24')](function(){_0x40e95f[_0x9949('0x19')](0xcc)[_0x9949('0x1a')]();});}};}function handleEntityNotFound(_0x5ebde0,_0x343e83){return function(_0x4fa840){if(!_0x4fa840){_0x5ebde0[_0x9949('0x26')](0x194);}return _0x4fa840;};}function handleError(_0x4852fb,_0x8ee2b0){_0x8ee2b0=_0x8ee2b0||0x1f4;return function(_0x1d2f66){logger[_0x9949('0x27')](_0x1d2f66['stack']);if(_0x1d2f66[_0x9949('0x28')]){delete _0x1d2f66[_0x9949('0x28')];}_0x4852fb[_0x9949('0x19')](_0x8ee2b0)[_0x9949('0x29')](_0x1d2f66);};}exports[_0x9949('0x2a')]=function(_0x588d87,_0xd3c324){var _0xbc68fc={},_0x18a41a={},_0x5a610d={'count':0x0,'rows':[]};var _0x5a57c2=_[_0x9949('0x2b')](db[_0x9949('0x2c')][_0x9949('0x2d')],function(_0x194adf){return{'name':_0x194adf[_0x9949('0x2e')],'type':_0x194adf[_0x9949('0x2f')][_0x9949('0x30')]};});_0x18a41a['model']=_[_0x9949('0x2b')](_0x5a57c2,'name');_0x18a41a[_0x9949('0x31')]=_[_0x9949('0x32')](_0x588d87['query']);_0x18a41a['filters']=_[_0x9949('0x33')](_0x18a41a[_0x9949('0x34')],_0x18a41a['query']);_0xbc68fc[_0x9949('0x35')]=_[_0x9949('0x33')](_0x18a41a[_0x9949('0x34')],qs[_0x9949('0x36')](_0x588d87[_0x9949('0x31')]['fields']));_0xbc68fc['attributes']=_0xbc68fc['attributes'][_0x9949('0x37')]?_0xbc68fc[_0x9949('0x35')]:_0x18a41a[_0x9949('0x34')];if(!_0x588d87[_0x9949('0x31')][_0x9949('0x38')](_0x9949('0x39'))){_0xbc68fc['limit']=qs[_0x9949('0x3a')](_0x588d87[_0x9949('0x31')]['limit']);_0xbc68fc[_0x9949('0x1d')]=qs[_0x9949('0x1d')](_0x588d87[_0x9949('0x31')][_0x9949('0x1d')]);}_0xbc68fc[_0x9949('0x3b')]=qs[_0x9949('0x3c')](_0x588d87['query'][_0x9949('0x3c')]);_0xbc68fc[_0x9949('0x3d')]=qs['filters'](_[_0x9949('0x3e')](_0x588d87[_0x9949('0x31')],_0x18a41a[_0x9949('0x3f')]));if(_0x588d87['query'][_0x9949('0x40')]){_0xbc68fc[_0x9949('0x3d')]=_[_0x9949('0x41')](_0xbc68fc['where'],{'$or':_[_0x9949('0x2b')](_0x5a57c2,function(_0x150948){if(_0x150948[_0x9949('0x2f')]!==_0x9949('0x42')){var _0x1f94d6={};_0x1f94d6[_0x150948[_0x9949('0x28')]]={'$like':'%'+_0x588d87[_0x9949('0x31')][_0x9949('0x40')]+'%'};return _0x1f94d6;}})});}_0xbc68fc=_[_0x9949('0x41')]({},_0xbc68fc,_0x588d87['options']);var _0x10cc7f={'where':_0xbc68fc[_0x9949('0x3d')]};return db[_0x9949('0x2c')][_0x9949('0x1c')](_0x10cc7f)[_0x9949('0x24')](function(_0x27d199){_0x5a610d[_0x9949('0x1c')]=_0x27d199;if(_0x588d87[_0x9949('0x31')][_0x9949('0x43')]){_0xbc68fc[_0x9949('0x44')]=[{'all':!![]}];}return db[_0x9949('0x2c')][_0x9949('0x45')](_0xbc68fc);})[_0x9949('0x24')](function(_0x3b8dfb){_0x5a610d[_0x9949('0x46')]=_0x3b8dfb;return _0x5a610d;})[_0x9949('0x24')](respondWithFilteredResult(_0xd3c324,_0xbc68fc))[_0x9949('0x47')](handleError(_0xd3c324,null));};exports[_0x9949('0x48')]=function(_0x1f1fc0,_0x3c6aad){var _0x63fd4e={'raw':!![],'where':{'id':_0x1f1fc0[_0x9949('0x49')]['id']}},_0x4fbd82={};_0x4fbd82['model']=_[_0x9949('0x32')](db[_0x9949('0x2c')][_0x9949('0x2d')]);_0x4fbd82[_0x9949('0x31')]=_[_0x9949('0x32')](_0x1f1fc0[_0x9949('0x31')]);_0x4fbd82['filters']=_[_0x9949('0x33')](_0x4fbd82['model'],_0x4fbd82[_0x9949('0x31')]);_0x63fd4e[_0x9949('0x35')]=_[_0x9949('0x33')](_0x4fbd82[_0x9949('0x34')],qs[_0x9949('0x36')](_0x1f1fc0[_0x9949('0x31')]['fields']));_0x63fd4e[_0x9949('0x35')]=_0x63fd4e['attributes']['length']?_0x63fd4e[_0x9949('0x35')]:_0x4fbd82['model'];if(_0x1f1fc0[_0x9949('0x31')][_0x9949('0x43')]){_0x63fd4e[_0x9949('0x44')]=[{'all':!![]}];}_0x63fd4e=_[_0x9949('0x41')]({},_0x63fd4e,_0x1f1fc0['options']);return db[_0x9949('0x2c')][_0x9949('0x4a')](_0x63fd4e)['then'](handleEntityNotFound(_0x3c6aad,null))[_0x9949('0x24')](respondWithResult(_0x3c6aad,null))[_0x9949('0x47')](handleError(_0x3c6aad,null));};exports[_0x9949('0x4b')]=function(_0x293709,_0x1a2ae2){return db['VtigerField'][_0x9949('0x4b')](_0x293709[_0x9949('0x4c')],{})['then'](respondWithResult(_0x1a2ae2,0xc9))[_0x9949('0x47')](handleError(_0x1a2ae2,null));};exports['update']=function(_0x560016,_0x4979a2){if(_0x560016['body']['id']){delete _0x560016['body']['id'];}return db['VtigerField'][_0x9949('0x4a')]({'where':{'id':_0x560016[_0x9949('0x49')]['id']}})[_0x9949('0x24')](handleEntityNotFound(_0x4979a2,null))[_0x9949('0x24')](saveUpdates(_0x560016[_0x9949('0x4c')],null))[_0x9949('0x24')](respondWithResult(_0x4979a2,null))[_0x9949('0x47')](handleError(_0x4979a2,null));};exports[_0x9949('0x25')]=function(_0x97ce83,_0x57361e){return db[_0x9949('0x2c')][_0x9949('0x4a')]({'where':{'id':_0x97ce83[_0x9949('0x49')]['id']}})[_0x9949('0x24')](handleEntityNotFound(_0x57361e,null))['then'](removeEntity(_0x57361e,null))['catch'](handleError(_0x57361e,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 0f47526..b4c4e34 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 _0x9957=['rimraf','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['int_vtiger_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0x373742,_0x56adb9){var _0x5c8fb2=function(_0x5f10db){while(--_0x5f10db){_0x373742['push'](_0x373742['shift']());}};_0x5c8fb2(++_0x56adb9);}(_0x7a54,0x106));var _0x47a5=function(_0x1fcdce,_0x30e47a){_0x1fcdce=_0x1fcdce-0x0;var _0xb564d8=_0x7a54[_0x1fcdce];return _0xb564d8;};'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':[{'name':'vtiger_unique_index','fields':[_0x47a5('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 e31c53e..a9857e5 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 _0xbc4a=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x257126,_0xd0458b){var _0x2a2aa8=function(_0x1be180){while(--_0x1be180){_0x257126['push'](_0x257126['shift']());}};_0x2a2aa8(++_0xd0458b);}(_0xbc4a,0x1dd));var _0xabc4=function(_0xf05c4d,_0x140378){_0xf05c4d=_0xf05c4d-0x0;var _0x14030b=_0xbc4a[_0xf05c4d];return _0x14030b;};'use strict';var _=require(_0xabc4('0x0'));var util=require(_0xabc4('0x1'));var moment=require(_0xabc4('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('../../config/utils');var logger=require(_0xabc4('0x3'))('rpc');var config=require(_0xabc4('0x4'));var jayson=require(_0xabc4('0x5'));var client=jayson[_0xabc4('0x6')][_0xabc4('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x244d3a,_0x1a33c4,_0x244a46){return new BPromise(function(_0x28ea0b,_0x159741){return client[_0xabc4('0x8')](_0x244d3a,_0x244a46)[_0xabc4('0x9')](function(_0x7ca67d){logger[_0xabc4('0xa')](_0xabc4('0xb'),_0x1a33c4,_0xabc4('0xc'));logger[_0xabc4('0xd')](_0xabc4('0xe'),_0x1a33c4,_0xabc4('0xc'),JSON[_0xabc4('0xf')](_0x7ca67d));if(_0x7ca67d[_0xabc4('0x10')]){if(_0x7ca67d[_0xabc4('0x10')][_0xabc4('0x11')]===0x1f4){logger[_0xabc4('0x10')](_0xabc4('0xb'),_0x1a33c4,_0x7ca67d[_0xabc4('0x10')][_0xabc4('0x12')]);return _0x159741(_0x7ca67d[_0xabc4('0x10')]['message']);}logger[_0xabc4('0x10')](_0xabc4('0xb'),_0x1a33c4,_0x7ca67d['error']['message']);return _0x28ea0b(_0x7ca67d[_0xabc4('0x10')][_0xabc4('0x12')]);}else{logger[_0xabc4('0xa')]('VtigerField,\x20%s,\x20%s',_0x1a33c4,'request\x20sent');_0x28ea0b(_0x7ca67d['result'][_0xabc4('0x12')]);}})[_0xabc4('0x13')](function(_0xa4ea8){logger[_0xabc4('0x10')](_0xabc4('0xb'),_0x1a33c4,_0xa4ea8);_0x159741(_0xa4ea8);});});} \ No newline at end of file +var _0x2f68=['code','message','request\x20sent','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','VtigerField,\x20%s,\x20%s','debug','stringify','error'];(function(_0x18afca,_0x4219d9){var _0x11603f=function(_0x21d5d1){while(--_0x21d5d1){_0x18afca['push'](_0x18afca['shift']());}};_0x11603f(++_0x4219d9);}(_0x2f68,0x12b));var _0x82f6=function(_0x1a6f1e,_0x5f1de1){_0x1a6f1e=_0x1a6f1e-0x0;var _0x2d7143=_0x2f68[_0x1a6f1e];return _0x2d7143;};'use strict';var _=require('lodash');var util=require(_0x82f6('0x0'));var moment=require(_0x82f6('0x1'));var BPromise=require(_0x82f6('0x2'));var rs=require(_0x82f6('0x3'));var fs=require('fs');var Redis=require(_0x82f6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x82f6('0x5'));var logger=require(_0x82f6('0x6'))(_0x82f6('0x7'));var config=require(_0x82f6('0x8'));var jayson=require(_0x82f6('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x9ad1f,_0x4fa10f,_0x282bc8){return new BPromise(function(_0x3fd6ef,_0x159ea8){return client['request'](_0x9ad1f,_0x282bc8)[_0x82f6('0xa')](function(_0x415226){logger[_0x82f6('0xb')](_0x82f6('0xc'),_0x4fa10f,'request\x20sent');logger[_0x82f6('0xd')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x4fa10f,'request\x20sent',JSON[_0x82f6('0xe')](_0x415226));if(_0x415226['error']){if(_0x415226[_0x82f6('0xf')][_0x82f6('0x10')]===0x1f4){logger['error'](_0x82f6('0xc'),_0x4fa10f,_0x415226['error'][_0x82f6('0x11')]);return _0x159ea8(_0x415226['error']['message']);}logger[_0x82f6('0xf')](_0x82f6('0xc'),_0x4fa10f,_0x415226[_0x82f6('0xf')][_0x82f6('0x11')]);return _0x3fd6ef(_0x415226[_0x82f6('0xf')][_0x82f6('0x11')]);}else{logger[_0x82f6('0xb')](_0x82f6('0xc'),_0x4fa10f,_0x82f6('0x12'));_0x3fd6ef(_0x415226[_0x82f6('0x13')][_0x82f6('0x11')]);}})[_0x82f6('0x14')](function(_0x412d1f){logger[_0x82f6('0xf')](_0x82f6('0xc'),_0x4fa10f,_0x412d1f);_0x159ea8(_0x412d1f);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 410c6ef..025693e 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 _0xa5d8=['getConfigurations','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','path','express','../../components/interaction/service','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations'];(function(_0x10852d,_0x4cdcc6){var _0x13a8d6=function(_0x2ece16){while(--_0x2ece16){_0x10852d['push'](_0x10852d['shift']());}};_0x13a8d6(++_0x4cdcc6);}(_0xa5d8,0x10d));var _0x8a5d=function(_0x299808,_0x5321e5){_0x299808=_0x299808-0x0;var _0x10c145=_0xa5d8[_0x299808];return _0x10c145;};'use strict';var multer=require(_0x8a5d('0x0'));var util=require('util');var path=require(_0x8a5d('0x1'));var timeout=require('connect-timeout');var express=require(_0x8a5d('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x8a5d('0x3'));var config=require('../../config/environment');var controller=require(_0x8a5d('0x4'));router[_0x8a5d('0x5')]('/',auth[_0x8a5d('0x6')](),controller[_0x8a5d('0x7')]);router['get'](_0x8a5d('0x8'),auth['isAuthenticated'](),controller[_0x8a5d('0x9')]);router['get'](_0x8a5d('0xa'),auth[_0x8a5d('0x6')](),controller[_0x8a5d('0xb')]);router[_0x8a5d('0x5')]('/:id/fields',auth['isAuthenticated'](),controller[_0x8a5d('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x8a5d('0xd')](_0x8a5d('0xa'),auth[_0x8a5d('0x6')](),controller[_0x8a5d('0xe')]);router[_0x8a5d('0xf')](_0x8a5d('0x8'),auth[_0x8a5d('0x6')](),controller[_0x8a5d('0x10')]);router[_0x8a5d('0x11')](_0x8a5d('0x8'),auth[_0x8a5d('0x6')](),controller[_0x8a5d('0x12')]);module[_0x8a5d('0x13')]=router; \ No newline at end of file +var _0xb8c7=['util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','create','addConfiguration','put','update','delete','destroy','exports'];(function(_0x4e3e61,_0x5a49b8){var _0xbdf1b5=function(_0x1ec386){while(--_0x1ec386){_0x4e3e61['push'](_0x4e3e61['shift']());}};_0xbdf1b5(++_0x5a49b8);}(_0xb8c7,0xb0));var _0x7b8c=function(_0x2d00ef,_0x4211bc){_0x2d00ef=_0x2d00ef-0x0;var _0x2cbe73=_0xb8c7[_0x2d00ef];return _0x2cbe73;};'use strict';var multer=require('multer');var util=require(_0x7b8c('0x0'));var path=require(_0x7b8c('0x1'));var timeout=require(_0x7b8c('0x2'));var express=require(_0x7b8c('0x3'));var router=express['Router']();var auth=require(_0x7b8c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7b8c('0x5'));var controller=require(_0x7b8c('0x6'));router[_0x7b8c('0x7')]('/',auth[_0x7b8c('0x8')](),controller[_0x7b8c('0x9')]);router[_0x7b8c('0x7')](_0x7b8c('0xa'),auth[_0x7b8c('0x8')](),controller['show']);router['get'](_0x7b8c('0xb'),auth[_0x7b8c('0x8')](),controller[_0x7b8c('0xc')]);router[_0x7b8c('0x7')](_0x7b8c('0xd'),auth[_0x7b8c('0x8')](),controller[_0x7b8c('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7b8c('0xf')]);router['post'](_0x7b8c('0xb'),auth[_0x7b8c('0x8')](),controller[_0x7b8c('0x10')]);router[_0x7b8c('0x11')]('/:id',auth[_0x7b8c('0x8')](),controller[_0x7b8c('0x12')]);router[_0x7b8c('0x13')](_0x7b8c('0xa'),auth['isAuthenticated'](),controller[_0x7b8c('0x14')]);module[_0x7b8c('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index f792f1c..a681106 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 _0xdc98=['integrationTab','newTab','exports','STRING','ENUM','token'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xdc98,0x14c));var _0x8dc9=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xdc98[_0x2763f2];return _0x3ef471;};'use strict';var Sequelize=require('sequelize');module[_0x8dc9('0x0')]={'name':{'type':Sequelize[_0x8dc9('0x1')]},'description':{'type':Sequelize[_0x8dc9('0x1')]},'username':{'type':Sequelize[_0x8dc9('0x1')],'unique':'username'},'password':{'type':Sequelize[_0x8dc9('0x1')]},'token':{'type':Sequelize[_0x8dc9('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x8dc9('0x2')]('password',_0x8dc9('0x3')),'defaultValue':'password'},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0x8dc9('0x4'),_0x8dc9('0x5')),'defaultValue':_0x8dc9('0x4')}}; \ No newline at end of file +var _0x45d6=['password','token','integrationTab','newTab','sequelize','exports','STRING','username','remoteUri','ENUM'];(function(_0xfcb2a4,_0xcfcfaf){var _0x5ee714=function(_0x290ee4){while(--_0x290ee4){_0xfcb2a4['push'](_0xfcb2a4['shift']());}};_0x5ee714(++_0xcfcfaf);}(_0x45d6,0x176));var _0x645d=function(_0x3c5cba,_0x386723){_0x3c5cba=_0x3c5cba-0x0;var _0x5860a2=_0x45d6[_0x3c5cba];return _0x5860a2;};'use strict';var Sequelize=require(_0x645d('0x0'));module[_0x645d('0x1')]={'name':{'type':Sequelize[_0x645d('0x2')]},'description':{'type':Sequelize[_0x645d('0x2')]},'username':{'type':Sequelize[_0x645d('0x2')],'unique':_0x645d('0x3')},'password':{'type':Sequelize[_0x645d('0x2')]},'token':{'type':Sequelize[_0x645d('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x645d('0x4')},'authType':{'type':Sequelize[_0x645d('0x5')](_0x645d('0x6'),_0x645d('0x7')),'defaultValue':_0x645d('0x6')},'serverUrl':{'type':Sequelize[_0x645d('0x2')]},'type':{'type':Sequelize[_0x645d('0x5')](_0x645d('0x8'),_0x645d('0x9')),'defaultValue':_0x645d('0x8')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 898e081..2402bf2 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 _0x6fcf=['getConfigurations','findOne','ZendeskConfiguration','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','Subjects','password','token','authType','remoteUri','slice','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','username','base64','%s/token:%s','Unknown\x20authentication\x20type','description','group','assignee','remove','includes','title','position','system_field_options','custom_field_options','test','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','statusCode','html-pdf','eml-format','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','Sequelize','ValidationError','request','then','info','ZendeskAccount,\x20%s,\x20%s','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','sendStatus','end','status','count','offset','limit','set','json','apply','reject','save','update','destroy','index','map','ZendeskAccount','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','name','merge','options','includeAll','include','show','params','rawAttributes','find','create','body'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x6fcf,0x11e));var _0xf6fc=function(_0x47b017,_0x52942d){_0x47b017=_0x47b017-0x0;var _0x485638=_0x6fcf[_0x47b017];return _0x485638;};'use strict';var pdf=require(_0xf6fc('0x0'));var emlformat=require(_0xf6fc('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf6fc('0x2'));var rp=require('request-promise');var moment=require(_0xf6fc('0x3'));var BPromise=require(_0xf6fc('0x4'));var Mustache=require(_0xf6fc('0x5'));var util=require(_0xf6fc('0x6'));var path=require('path');var sox=require(_0xf6fc('0x7'));var csv=require(_0xf6fc('0x8'));var ejs=require(_0xf6fc('0x9'));var fs=require('fs');var _=require(_0xf6fc('0xa'));var squel=require(_0xf6fc('0xb'));var crypto=require('crypto');var jsforce=require(_0xf6fc('0xc'));var deskjs=require(_0xf6fc('0xd'));var toCsv=require(_0xf6fc('0x8'));var querystring=require(_0xf6fc('0xe'));var Papa=require(_0xf6fc('0xf'));var Redis=require(_0xf6fc('0x10'));var authService=require(_0xf6fc('0x11'));var qs=require(_0xf6fc('0x12'));var as=require(_0xf6fc('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xf6fc('0x14'));var config=require(_0xf6fc('0x15'));var db=require(_0xf6fc('0x16'))['db'];var integrations=require(_0xf6fc('0x17'));var jayson=require(_0xf6fc('0x18'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x3665c5,_0x91733f,_0x2d253f){if(_0x2d253f){var _0x3e19c2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3e19c2['test'](_0x91733f)){return _0x3665c5;}else{throw new db[(_0xf6fc('0x19'))][(_0xf6fc('0x1a'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x3665c5;}}function respondWithRpcPromise(_0x41e06b,_0x408bdb,_0x59ade8,_0x3f3d42){return new BPromise(function(_0x2d3d66,_0x58fe61){var _0x19c9d1=_0x3f3d42||client;return _0x19c9d1[_0xf6fc('0x1b')](_0x41e06b,_0x59ade8)[_0xf6fc('0x1c')](function(_0x374243){logger[_0xf6fc('0x1d')](_0xf6fc('0x1e'),_0x408bdb,'request\x20sent');logger['debug'](_0xf6fc('0x1f'),_0x408bdb,'request\x20sent',JSON[_0xf6fc('0x20')](_0x374243));if(_0x374243['error']){if(_0x374243[_0xf6fc('0x21')]['code']===0x1f4){logger[_0xf6fc('0x21')](_0xf6fc('0x1e'),_0x408bdb,_0x374243[_0xf6fc('0x21')][_0xf6fc('0x22')]);return _0x58fe61(_0x374243[_0xf6fc('0x21')][_0xf6fc('0x22')]);}logger[_0xf6fc('0x21')](_0xf6fc('0x1e'),_0x408bdb,_0x374243[_0xf6fc('0x21')]['message']);return _0x2d3d66(_0x374243[_0xf6fc('0x21')][_0xf6fc('0x22')]);}else{logger['info'](_0xf6fc('0x1e'),_0x408bdb,_0xf6fc('0x23'));_0x2d3d66(_0x374243[_0xf6fc('0x24')][_0xf6fc('0x22')]);}})[_0xf6fc('0x25')](function(_0x3b5fae){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x408bdb,_0x3b5fae);_0x58fe61(_0x3b5fae);});});}function respondWithStatusCode(_0x4d6a3b,_0x3dbdd5){_0x3dbdd5=_0x3dbdd5||0xcc;return function(_0x5aa8c9){if(_0x5aa8c9){return _0x4d6a3b[_0xf6fc('0x26')](_0x3dbdd5);}return _0x4d6a3b['status'](_0x3dbdd5)[_0xf6fc('0x27')]();};}function respondWithResult(_0x2cf521,_0x136d0a){_0x136d0a=_0x136d0a||0xc8;return function(_0x11b7de){if(_0x11b7de){return _0x2cf521[_0xf6fc('0x28')](_0x136d0a)['json'](_0x11b7de);}};}function respondWithFilteredResult(_0x530d1f,_0x32918c){return function(_0x5a28e5){if(_0x5a28e5){var _0x2ae78b=_0x5a28e5[_0xf6fc('0x29')],_0x5f484f=_0x32918c[_0xf6fc('0x2a')],_0x4c7e88=_0x32918c[_0xf6fc('0x2a')]+_0x32918c[_0xf6fc('0x2b')],_0x1aae32;if(_0x4c7e88>=_0x2ae78b){_0x4c7e88=_0x2ae78b;_0x1aae32=0xc8;}else{_0x1aae32=0xce;}_0x530d1f[_0xf6fc('0x28')](_0x1aae32);return _0x530d1f[_0xf6fc('0x2c')]('Content-Range',_0x5f484f+'-'+_0x4c7e88+'/'+_0x2ae78b)[_0xf6fc('0x2d')](_0x5a28e5);}return null;};}function patchUpdates(_0x25acde){return function(_0x27ee1c){try{jsonpatch[_0xf6fc('0x2e')](_0x27ee1c,_0x25acde,!![]);}catch(_0x35adbc){return BPromise[_0xf6fc('0x2f')](_0x35adbc);}return _0x27ee1c[_0xf6fc('0x30')]();};}function saveUpdates(_0x49e4c0,_0x41f63f){return function(_0x452239){if(_0x452239){return _0x452239[_0xf6fc('0x31')](_0x49e4c0)[_0xf6fc('0x1c')](function(_0x4b9433){return _0x4b9433;});}return null;};}function removeEntity(_0x303de1,_0x491f78){return function(_0xca8098){if(_0xca8098){return _0xca8098[_0xf6fc('0x32')]()[_0xf6fc('0x1c')](function(){_0x303de1[_0xf6fc('0x28')](0xcc)[_0xf6fc('0x27')]();});}};}function handleEntityNotFound(_0x41ca8a,_0x11e322){return function(_0x233221){if(!_0x233221){_0x41ca8a[_0xf6fc('0x26')](0x194);}return _0x233221;};}function handleError(_0x3970f5,_0x45f299){_0x45f299=_0x45f299||0x1f4;return function(_0x4dff29){logger[_0xf6fc('0x21')](_0x4dff29['stack']);if(_0x4dff29['name']){delete _0x4dff29['name'];}_0x3970f5['status'](_0x45f299)['send'](_0x4dff29);};}exports[_0xf6fc('0x33')]=function(_0x1c133a,_0x4abc84){var _0x178940={},_0x405b08={},_0x230cae={'count':0x0,'rows':[]};var _0x11416e=_[_0xf6fc('0x34')](db[_0xf6fc('0x35')]['rawAttributes'],function(_0xdf2315){return{'name':_0xdf2315[_0xf6fc('0x36')],'type':_0xdf2315[_0xf6fc('0x37')]['key']};});_0x405b08[_0xf6fc('0x38')]=_[_0xf6fc('0x34')](_0x11416e,'name');_0x405b08['query']=_[_0xf6fc('0x39')](_0x1c133a['query']);_0x405b08[_0xf6fc('0x3a')]=_[_0xf6fc('0x3b')](_0x405b08['model'],_0x405b08[_0xf6fc('0x3c')]);_0x178940[_0xf6fc('0x3d')]=_['intersection'](_0x405b08[_0xf6fc('0x38')],qs[_0xf6fc('0x3e')](_0x1c133a['query']['fields']));_0x178940[_0xf6fc('0x3d')]=_0x178940[_0xf6fc('0x3d')][_0xf6fc('0x3f')]?_0x178940['attributes']:_0x405b08[_0xf6fc('0x38')];if(!_0x1c133a['query'][_0xf6fc('0x40')](_0xf6fc('0x41'))){_0x178940[_0xf6fc('0x2b')]=qs[_0xf6fc('0x2b')](_0x1c133a['query']['limit']);_0x178940[_0xf6fc('0x2a')]=qs[_0xf6fc('0x2a')](_0x1c133a['query'][_0xf6fc('0x2a')]);}_0x178940[_0xf6fc('0x42')]=qs[_0xf6fc('0x43')](_0x1c133a[_0xf6fc('0x3c')]['sort']);_0x178940[_0xf6fc('0x44')]=qs[_0xf6fc('0x3a')](_[_0xf6fc('0x45')](_0x1c133a['query'],_0x405b08[_0xf6fc('0x3a')]));if(_0x1c133a[_0xf6fc('0x3c')][_0xf6fc('0x46')]){_0x178940['where']=_['merge'](_0x178940[_0xf6fc('0x44')],{'$or':_[_0xf6fc('0x34')](_0x11416e,function(_0xcfea57){if(_0xcfea57[_0xf6fc('0x37')]!==_0xf6fc('0x47')){var _0x506af1={};_0x506af1[_0xcfea57[_0xf6fc('0x48')]]={'$like':'%'+_0x1c133a[_0xf6fc('0x3c')]['filter']+'%'};return _0x506af1;}})});}_0x178940=_[_0xf6fc('0x49')]({},_0x178940,_0x1c133a[_0xf6fc('0x4a')]);var _0x1c318e={'where':_0x178940[_0xf6fc('0x44')]};return db[_0xf6fc('0x35')]['count'](_0x1c318e)[_0xf6fc('0x1c')](function(_0x26b726){_0x230cae[_0xf6fc('0x29')]=_0x26b726;if(_0x1c133a[_0xf6fc('0x3c')][_0xf6fc('0x4b')]){_0x178940[_0xf6fc('0x4c')]=[{'all':!![]}];}return db[_0xf6fc('0x35')]['findAll'](_0x178940);})['then'](function(_0x49424a){_0x230cae['rows']=_0x49424a;return _0x230cae;})[_0xf6fc('0x1c')](respondWithFilteredResult(_0x4abc84,_0x178940))[_0xf6fc('0x25')](handleError(_0x4abc84,null));};exports[_0xf6fc('0x4d')]=function(_0x24bc79,_0x447c96){var _0x53cae3={'raw':![],'where':{'id':_0x24bc79[_0xf6fc('0x4e')]['id']}},_0x453d57={};_0x453d57[_0xf6fc('0x38')]=_[_0xf6fc('0x39')](db['ZendeskAccount'][_0xf6fc('0x4f')]);_0x453d57['query']=_[_0xf6fc('0x39')](_0x24bc79[_0xf6fc('0x3c')]);_0x453d57[_0xf6fc('0x3a')]=_['intersection'](_0x453d57[_0xf6fc('0x38')],_0x453d57['query']);_0x53cae3[_0xf6fc('0x3d')]=_['intersection'](_0x453d57['model'],qs[_0xf6fc('0x3e')](_0x24bc79[_0xf6fc('0x3c')]['fields']));_0x53cae3[_0xf6fc('0x3d')]=_0x53cae3['attributes']['length']?_0x53cae3[_0xf6fc('0x3d')]:_0x453d57[_0xf6fc('0x38')];if(_0x24bc79['query']['includeAll']){_0x53cae3[_0xf6fc('0x4c')]=[{'all':!![]}];}_0x53cae3=_[_0xf6fc('0x49')]({},_0x53cae3,_0x24bc79[_0xf6fc('0x4a')]);return db[_0xf6fc('0x35')][_0xf6fc('0x50')](_0x53cae3)[_0xf6fc('0x1c')](handleEntityNotFound(_0x447c96,null))[_0xf6fc('0x1c')](respondWithResult(_0x447c96,null))[_0xf6fc('0x25')](handleError(_0x447c96,null));};exports[_0xf6fc('0x51')]=function(_0x775328,_0x2c5418){return db['ZendeskAccount'][_0xf6fc('0x51')](_0x775328[_0xf6fc('0x52')],{})[_0xf6fc('0x1c')](respondWithResult(_0x2c5418,0xc9))[_0xf6fc('0x25')](handleError(_0x2c5418,null));};exports[_0xf6fc('0x31')]=function(_0x4707fe,_0x12dbd2){if(_0x4707fe[_0xf6fc('0x52')]['id']){delete _0x4707fe['body']['id'];}return db[_0xf6fc('0x35')][_0xf6fc('0x50')]({'where':{'id':_0x4707fe[_0xf6fc('0x4e')]['id']}})[_0xf6fc('0x1c')](handleEntityNotFound(_0x12dbd2,null))[_0xf6fc('0x1c')](saveUpdates(_0x4707fe['body'],null))['then'](respondWithResult(_0x12dbd2,null))[_0xf6fc('0x25')](handleError(_0x12dbd2,null));};exports[_0xf6fc('0x32')]=function(_0x1874f9,_0x517a61){return db['ZendeskAccount']['find']({'where':{'id':_0x1874f9[_0xf6fc('0x4e')]['id']}})[_0xf6fc('0x1c')](handleEntityNotFound(_0x517a61,null))['then'](removeEntity(_0x517a61,null))[_0xf6fc('0x25')](handleError(_0x517a61,null));};exports[_0xf6fc('0x53')]=function(_0x2865ec,_0x4b9d92,_0xc5933c){var _0x2ca691={};var _0xa66a66={};var _0x50cd08;var _0x9969f1;return db[_0xf6fc('0x35')][_0xf6fc('0x54')]({'where':{'id':_0x2865ec['params']['id']}})[_0xf6fc('0x1c')](handleEntityNotFound(_0x4b9d92,null))['then'](function(_0x39bb45){if(_0x39bb45){_0x50cd08=_0x39bb45;_0xa66a66[_0xf6fc('0x38')]=_[_0xf6fc('0x39')](db[_0xf6fc('0x55')][_0xf6fc('0x4f')]);_0xa66a66[_0xf6fc('0x3c')]=_['keys'](_0x2865ec[_0xf6fc('0x3c')]);_0xa66a66['filters']=_[_0xf6fc('0x3b')](_0xa66a66['model'],_0xa66a66[_0xf6fc('0x3c')]);_0x2ca691[_0xf6fc('0x3d')]=_[_0xf6fc('0x3b')](_0xa66a66[_0xf6fc('0x38')],qs[_0xf6fc('0x3e')](_0x2865ec[_0xf6fc('0x3c')]['fields']));_0x2ca691[_0xf6fc('0x3d')]=_0x2ca691[_0xf6fc('0x3d')][_0xf6fc('0x3f')]?_0x2ca691['attributes']:_0xa66a66['model'];_0x2ca691[_0xf6fc('0x42')]=qs[_0xf6fc('0x43')](_0x2865ec['query'][_0xf6fc('0x43')]);_0x2ca691['where']=qs[_0xf6fc('0x3a')](_[_0xf6fc('0x45')](_0x2865ec[_0xf6fc('0x3c')],_0xa66a66[_0xf6fc('0x3a')]));if(_0x2865ec['query'][_0xf6fc('0x46')]){_0x2ca691['where']=_[_0xf6fc('0x49')](_0x2ca691[_0xf6fc('0x44')],{'$or':_[_0xf6fc('0x34')](_0x2ca691[_0xf6fc('0x3d')],function(_0xd60fd9){var _0x2e9c0e={};_0x2e9c0e[_0xd60fd9]={'$like':'%'+_0x2865ec['query'][_0xf6fc('0x46')]+'%'};return _0x2e9c0e;})});}_0x2ca691=_['merge']({},_0x2ca691,_0x2865ec['options']);return _0x50cd08[_0xf6fc('0x53')](_0x2ca691);}})[_0xf6fc('0x1c')](function(_0x543b19){if(_0x543b19){_0x9969f1=_0x543b19['length'];if(!_0x2865ec[_0xf6fc('0x3c')][_0xf6fc('0x40')]('nolimit')){_0x2ca691[_0xf6fc('0x2b')]=qs[_0xf6fc('0x2b')](_0x2865ec[_0xf6fc('0x3c')][_0xf6fc('0x2b')]);_0x2ca691[_0xf6fc('0x2a')]=qs['offset'](_0x2865ec['query'][_0xf6fc('0x2a')]);}return _0x50cd08['getConfigurations'](_0x2ca691);}})[_0xf6fc('0x1c')](function(_0x1390b4){if(_0x1390b4){return _0x1390b4?{'count':_0x9969f1,'rows':_0x1390b4}:null;}})[_0xf6fc('0x1c')](respondWithResult(_0x4b9d92,null))[_0xf6fc('0x25')](handleError(_0x4b9d92,null));};exports[_0xf6fc('0x56')]=function(_0x210e63,_0x51a73a,_0x413679){if(_0x210e63[_0xf6fc('0x52')]['id']){delete _0x210e63[_0xf6fc('0x52')]['id'];}return db[_0xf6fc('0x35')][_0xf6fc('0x54')]({'where':{'id':_0x210e63[_0xf6fc('0x4e')]['id']}})[_0xf6fc('0x1c')](handleEntityNotFound(_0x51a73a,null))[_0xf6fc('0x1c')](function(_0x35770f){if(_0x35770f){_0x210e63[_0xf6fc('0x52')]['AccountId']=_0x35770f['id'];_0x210e63[_0xf6fc('0x52')]['Subjects']=integrations[_0xf6fc('0x57')](_0x210e63[_0xf6fc('0x52')][_0xf6fc('0x58')],_0x210e63[_0xf6fc('0x52')][_0xf6fc('0x37')]);_0x210e63[_0xf6fc('0x52')][_0xf6fc('0x59')]=integrations[_0xf6fc('0x5a')](_0x210e63[_0xf6fc('0x52')]['channel'],_0x210e63['body']['type']);return db[_0xf6fc('0x55')][_0xf6fc('0x51')](_0x210e63[_0xf6fc('0x52')],{'include':[{'model':db[_0xf6fc('0x5b')],'as':_0xf6fc('0x5c')},{'model':db['ZendeskField'],'as':_0xf6fc('0x59')}]});}return null;})['then'](respondWithResult(_0x51a73a,null))[_0xf6fc('0x25')](handleError(_0x51a73a,null));};exports['getFields']=function(_0x166f83,_0x2b5095,_0x916676){var _0x391ae1='';return db[_0xf6fc('0x35')][_0xf6fc('0x54')]({'where':{'id':_0x166f83[_0xf6fc('0x4e')]['id']},'attributes':['id','username',_0xf6fc('0x5d'),_0xf6fc('0x5e'),_0xf6fc('0x5f'),_0xf6fc('0x60')]})[_0xf6fc('0x1c')](handleEntityNotFound(_0x2b5095,null))['then'](function(_0x4e3e93){if(_0x4e3e93){_0x391ae1=_0x4e3e93[_0xf6fc('0x60')];var _0x33803c=_0x391ae1[_0xf6fc('0x61')](-0x1);if(_0x33803c==='/'){_0x391ae1=_0x391ae1['substring'](0x0,_0x391ae1['lastIndexOf'](_0x33803c));}var _0x2b5c7a={'method':_0xf6fc('0x62'),'uri':util[_0xf6fc('0x63')](_0xf6fc('0x64'),_0x391ae1,_0xf6fc('0x65')),'json':!![]};switch(_0x4e3e93[_0xf6fc('0x5f')]){case _0xf6fc('0x5d'):_0x2b5c7a[_0xf6fc('0x66')]={'Authorization':util['format'](_0xf6fc('0x67'),new Buffer(util[_0xf6fc('0x63')](_0xf6fc('0x68'),_0x4e3e93[_0xf6fc('0x69')],_0x4e3e93['password']))['toString'](_0xf6fc('0x6a')))};break;case _0xf6fc('0x5e'):_0x2b5c7a[_0xf6fc('0x66')]={'Authorization':util['format'](_0xf6fc('0x67'),new Buffer(util['format'](_0xf6fc('0x6b'),_0x4e3e93['username'],_0x4e3e93[_0xf6fc('0x5e')]))['toString']('base64'))};break;default:throw new db[(_0xf6fc('0x19'))]['ValidationError'](_0xf6fc('0x6c'));}return rp(_0x2b5c7a);}})[_0xf6fc('0x1c')](function(_0x5b1750){if(_0x5b1750){var _0x498b19=['subject',_0xf6fc('0x6d'),_0xf6fc('0x6e'),_0xf6fc('0x6f')];_[_0xf6fc('0x70')](_0x5b1750[_0xf6fc('0x65')],function(_0x155abb){return _0x498b19[_0xf6fc('0x71')](_0x155abb[_0xf6fc('0x37')]);});return{'count':_0x5b1750[_0xf6fc('0x65')][_0xf6fc('0x3f')],'rows':_['map'](_0x5b1750['ticket_fields'],function(_0x47ed62){return{'id':_0x47ed62['id'],'name':_0x47ed62['position']>0x7?_0x47ed62[_0xf6fc('0x72')]:_0x47ed62[_0xf6fc('0x37')],'custom':_0x47ed62[_0xf6fc('0x73')]>0x7?!![]:![],'options':_0x47ed62['system_field_options']?_0x47ed62[_0xf6fc('0x74')]:_0x47ed62[_0xf6fc('0x75')]?_0x47ed62[_0xf6fc('0x75')]:[]};})};}})[_0xf6fc('0x1c')](respondWithResult(_0x2b5095,null))['catch'](function(_0x27ffdf){var _0x3f2822=_0x166f83['query'][_0xf6fc('0x76')]?0x1f4:_0x27ffdf['statusCode']||0x1f4;logger['error'](_0xf6fc('0x77'),_0xf6fc('0x78'),_0x3f2822,JSON[_0xf6fc('0x20')](_0x27ffdf));delete _0x27ffdf[_0xf6fc('0x48')];if(_0x3f2822===0x191){_0x3f2822=0x190;}_0x2b5095[_0xf6fc('0x28')](_0x3f2822)['send'](_0x166f83[_0xf6fc('0x3c')][_0xf6fc('0x76')]?{'message':_0xf6fc('0x79'),'statusCode':_0x27ffdf[_0xf6fc('0x7a')]}:_0x27ffdf);});}; \ No newline at end of file +var _0xd7fc=['format','%s/%s','headers','%s:%s','toString','Basic\x20%s','%s/token:%s','base64','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','ticket_fields','includes','position','system_field_options','custom_field_options','statusCode','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../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','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','Content-Range','apply','save','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','ZendeskAccount','includeAll','include','rows','show','create','body','update','find','params','getConfigurations','findOne','addConfiguration','Subjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','token','authType','remoteUri','slice','substring','lastIndexOf','GET'];(function(_0x26649c,_0x9122d0){var _0x23aef7=function(_0x2d6ce8){while(--_0x2d6ce8){_0x26649c['push'](_0x26649c['shift']());}};_0x23aef7(++_0x9122d0);}(_0xd7fc,0x91));var _0xcd7f=function(_0x5bb4e8,_0x44b756){_0x5bb4e8=_0x5bb4e8-0x0;var _0x2a86f2=_0xd7fc[_0x5bb4e8];return _0x2a86f2;};'use strict';var pdf=require(_0xcd7f('0x0'));var emlformat=require(_0xcd7f('0x1'));var rimraf=require(_0xcd7f('0x2'));var zipdir=require(_0xcd7f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xcd7f('0x4'));var BPromise=require(_0xcd7f('0x5'));var Mustache=require(_0xcd7f('0x6'));var util=require(_0xcd7f('0x7'));var path=require(_0xcd7f('0x8'));var sox=require('sox');var csv=require(_0xcd7f('0x9'));var ejs=require(_0xcd7f('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xcd7f('0xb'));var deskjs=require(_0xcd7f('0xc'));var toCsv=require(_0xcd7f('0x9'));var querystring=require('querystring');var Papa=require(_0xcd7f('0xd'));var Redis=require(_0xcd7f('0xe'));var authService=require(_0xcd7f('0xf'));var qs=require(_0xcd7f('0x10'));var as=require(_0xcd7f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcd7f('0x12'))(_0xcd7f('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xcd7f('0x14'))['db'];var integrations=require(_0xcd7f('0x15'));var jayson=require(_0xcd7f('0x16'));var client=jayson[_0xcd7f('0x17')]['http']({'port':0x232a});function checkPasswordPattern(_0x4edc96,_0x32e303,_0x2dfad2){if(_0x2dfad2){var _0x50280c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x50280c[_0xcd7f('0x18')](_0x32e303)){return _0x4edc96;}else{throw new db[(_0xcd7f('0x19'))][(_0xcd7f('0x1a'))](_0xcd7f('0x1b'));}}else{return _0x4edc96;}}function respondWithRpcPromise(_0x5d551a,_0x745a1c,_0x14e7e9,_0xa8943f){return new BPromise(function(_0x2270cf,_0x31bcb1){var _0x2bf90d=_0xa8943f||client;return _0x2bf90d[_0xcd7f('0x1c')](_0x5d551a,_0x14e7e9)[_0xcd7f('0x1d')](function(_0x244d3){logger[_0xcd7f('0x1e')](_0xcd7f('0x1f'),_0x745a1c,'request\x20sent');logger[_0xcd7f('0x20')](_0xcd7f('0x21'),_0x745a1c,_0xcd7f('0x22'),JSON[_0xcd7f('0x23')](_0x244d3));if(_0x244d3[_0xcd7f('0x24')]){if(_0x244d3[_0xcd7f('0x24')][_0xcd7f('0x25')]===0x1f4){logger['error'](_0xcd7f('0x1f'),_0x745a1c,_0x244d3[_0xcd7f('0x24')][_0xcd7f('0x26')]);return _0x31bcb1(_0x244d3[_0xcd7f('0x24')][_0xcd7f('0x26')]);}logger[_0xcd7f('0x24')](_0xcd7f('0x1f'),_0x745a1c,_0x244d3['error'][_0xcd7f('0x26')]);return _0x2270cf(_0x244d3[_0xcd7f('0x24')][_0xcd7f('0x26')]);}else{logger[_0xcd7f('0x1e')](_0xcd7f('0x1f'),_0x745a1c,'request\x20sent');_0x2270cf(_0x244d3[_0xcd7f('0x27')][_0xcd7f('0x26')]);}})[_0xcd7f('0x28')](function(_0x1b032c){logger[_0xcd7f('0x24')]('ZendeskAccount,\x20%s,\x20%s',_0x745a1c,_0x1b032c);_0x31bcb1(_0x1b032c);});});}function respondWithStatusCode(_0x342078,_0x441b97){_0x441b97=_0x441b97||0xcc;return function(_0x5b58e3){if(_0x5b58e3){return _0x342078['sendStatus'](_0x441b97);}return _0x342078[_0xcd7f('0x29')](_0x441b97)[_0xcd7f('0x2a')]();};}function respondWithResult(_0xee0f3f,_0x24396e){_0x24396e=_0x24396e||0xc8;return function(_0x10f243){if(_0x10f243){return _0xee0f3f[_0xcd7f('0x29')](_0x24396e)[_0xcd7f('0x2b')](_0x10f243);}};}function respondWithFilteredResult(_0x15584e,_0x28089f){return function(_0x189a94){if(_0x189a94){var _0x476a3c=_0x189a94[_0xcd7f('0x2c')],_0x1a4581=_0x28089f[_0xcd7f('0x2d')],_0x19cefb=_0x28089f[_0xcd7f('0x2d')]+_0x28089f[_0xcd7f('0x2e')],_0x4dc3c5;if(_0x19cefb>=_0x476a3c){_0x19cefb=_0x476a3c;_0x4dc3c5=0xc8;}else{_0x4dc3c5=0xce;}_0x15584e['status'](_0x4dc3c5);return _0x15584e['set'](_0xcd7f('0x2f'),_0x1a4581+'-'+_0x19cefb+'/'+_0x476a3c)['json'](_0x189a94);}return null;};}function patchUpdates(_0x2839c4){return function(_0x5576c0){try{jsonpatch[_0xcd7f('0x30')](_0x5576c0,_0x2839c4,!![]);}catch(_0x457d67){return BPromise['reject'](_0x457d67);}return _0x5576c0[_0xcd7f('0x31')]();};}function saveUpdates(_0x359f87,_0x3fb72d){return function(_0x28d872){if(_0x28d872){return _0x28d872['update'](_0x359f87)[_0xcd7f('0x1d')](function(_0x368611){return _0x368611;});}return null;};}function removeEntity(_0x48ce6d,_0x5e7086){return function(_0x98f652){if(_0x98f652){return _0x98f652[_0xcd7f('0x32')]()[_0xcd7f('0x1d')](function(){_0x48ce6d[_0xcd7f('0x29')](0xcc)[_0xcd7f('0x2a')]();});}};}function handleEntityNotFound(_0x5549f1,_0x3187ff){return function(_0x37d6d9){if(!_0x37d6d9){_0x5549f1['sendStatus'](0x194);}return _0x37d6d9;};}function handleError(_0x496ccb,_0x4245ea){_0x4245ea=_0x4245ea||0x1f4;return function(_0x5d7a0c){logger[_0xcd7f('0x24')](_0x5d7a0c[_0xcd7f('0x33')]);if(_0x5d7a0c[_0xcd7f('0x34')]){delete _0x5d7a0c[_0xcd7f('0x34')];}_0x496ccb[_0xcd7f('0x29')](_0x4245ea)[_0xcd7f('0x35')](_0x5d7a0c);};}exports[_0xcd7f('0x36')]=function(_0x5a6709,_0x58e55e){var _0x132ccd={},_0x4892d2={},_0x7547fe={'count':0x0,'rows':[]};var _0x458c35=_[_0xcd7f('0x37')](db['ZendeskAccount'][_0xcd7f('0x38')],function(_0x4eae03){return{'name':_0x4eae03[_0xcd7f('0x39')],'type':_0x4eae03[_0xcd7f('0x3a')][_0xcd7f('0x3b')]};});_0x4892d2[_0xcd7f('0x3c')]=_[_0xcd7f('0x37')](_0x458c35,_0xcd7f('0x34'));_0x4892d2[_0xcd7f('0x3d')]=_[_0xcd7f('0x3e')](_0x5a6709[_0xcd7f('0x3d')]);_0x4892d2['filters']=_[_0xcd7f('0x3f')](_0x4892d2[_0xcd7f('0x3c')],_0x4892d2['query']);_0x132ccd[_0xcd7f('0x40')]=_[_0xcd7f('0x3f')](_0x4892d2[_0xcd7f('0x3c')],qs[_0xcd7f('0x41')](_0x5a6709[_0xcd7f('0x3d')][_0xcd7f('0x41')]));_0x132ccd[_0xcd7f('0x40')]=_0x132ccd[_0xcd7f('0x40')][_0xcd7f('0x42')]?_0x132ccd[_0xcd7f('0x40')]:_0x4892d2[_0xcd7f('0x3c')];if(!_0x5a6709[_0xcd7f('0x3d')][_0xcd7f('0x43')](_0xcd7f('0x44'))){_0x132ccd[_0xcd7f('0x2e')]=qs[_0xcd7f('0x2e')](_0x5a6709[_0xcd7f('0x3d')][_0xcd7f('0x2e')]);_0x132ccd[_0xcd7f('0x2d')]=qs[_0xcd7f('0x2d')](_0x5a6709[_0xcd7f('0x3d')]['offset']);}_0x132ccd[_0xcd7f('0x45')]=qs[_0xcd7f('0x46')](_0x5a6709['query'][_0xcd7f('0x46')]);_0x132ccd[_0xcd7f('0x47')]=qs[_0xcd7f('0x48')](_[_0xcd7f('0x49')](_0x5a6709[_0xcd7f('0x3d')],_0x4892d2['filters']));if(_0x5a6709[_0xcd7f('0x3d')][_0xcd7f('0x4a')]){_0x132ccd['where']=_[_0xcd7f('0x4b')](_0x132ccd[_0xcd7f('0x47')],{'$or':_[_0xcd7f('0x37')](_0x458c35,function(_0x5e02c2){if(_0x5e02c2['type']!==_0xcd7f('0x4c')){var _0x5968af={};_0x5968af[_0x5e02c2[_0xcd7f('0x34')]]={'$like':'%'+_0x5a6709[_0xcd7f('0x3d')][_0xcd7f('0x4a')]+'%'};return _0x5968af;}})});}_0x132ccd=_[_0xcd7f('0x4b')]({},_0x132ccd,_0x5a6709[_0xcd7f('0x4d')]);var _0x296138={'where':_0x132ccd[_0xcd7f('0x47')]};return db[_0xcd7f('0x4e')][_0xcd7f('0x2c')](_0x296138)[_0xcd7f('0x1d')](function(_0x1917ae){_0x7547fe[_0xcd7f('0x2c')]=_0x1917ae;if(_0x5a6709['query'][_0xcd7f('0x4f')]){_0x132ccd[_0xcd7f('0x50')]=[{'all':!![]}];}return db['ZendeskAccount']['findAll'](_0x132ccd);})[_0xcd7f('0x1d')](function(_0x9d3e2c){_0x7547fe[_0xcd7f('0x51')]=_0x9d3e2c;return _0x7547fe;})['then'](respondWithFilteredResult(_0x58e55e,_0x132ccd))['catch'](handleError(_0x58e55e,null));};exports[_0xcd7f('0x52')]=function(_0x3d239d,_0xaff57f){var _0x8b4381={'raw':![],'where':{'id':_0x3d239d['params']['id']}},_0x25202e={};_0x25202e[_0xcd7f('0x3c')]=_[_0xcd7f('0x3e')](db[_0xcd7f('0x4e')]['rawAttributes']);_0x25202e[_0xcd7f('0x3d')]=_[_0xcd7f('0x3e')](_0x3d239d['query']);_0x25202e[_0xcd7f('0x48')]=_[_0xcd7f('0x3f')](_0x25202e['model'],_0x25202e[_0xcd7f('0x3d')]);_0x8b4381[_0xcd7f('0x40')]=_[_0xcd7f('0x3f')](_0x25202e[_0xcd7f('0x3c')],qs[_0xcd7f('0x41')](_0x3d239d[_0xcd7f('0x3d')][_0xcd7f('0x41')]));_0x8b4381[_0xcd7f('0x40')]=_0x8b4381['attributes'][_0xcd7f('0x42')]?_0x8b4381[_0xcd7f('0x40')]:_0x25202e[_0xcd7f('0x3c')];if(_0x3d239d[_0xcd7f('0x3d')][_0xcd7f('0x4f')]){_0x8b4381[_0xcd7f('0x50')]=[{'all':!![]}];}_0x8b4381=_[_0xcd7f('0x4b')]({},_0x8b4381,_0x3d239d[_0xcd7f('0x4d')]);return db[_0xcd7f('0x4e')]['find'](_0x8b4381)['then'](handleEntityNotFound(_0xaff57f,null))['then'](respondWithResult(_0xaff57f,null))[_0xcd7f('0x28')](handleError(_0xaff57f,null));};exports[_0xcd7f('0x53')]=function(_0x36393f,_0x462116){return db['ZendeskAccount'][_0xcd7f('0x53')](_0x36393f[_0xcd7f('0x54')],{})['then'](respondWithResult(_0x462116,0xc9))[_0xcd7f('0x28')](handleError(_0x462116,null));};exports[_0xcd7f('0x55')]=function(_0x1fe32c,_0x55fce3){if(_0x1fe32c['body']['id']){delete _0x1fe32c[_0xcd7f('0x54')]['id'];}return db[_0xcd7f('0x4e')][_0xcd7f('0x56')]({'where':{'id':_0x1fe32c[_0xcd7f('0x57')]['id']}})[_0xcd7f('0x1d')](handleEntityNotFound(_0x55fce3,null))[_0xcd7f('0x1d')](saveUpdates(_0x1fe32c[_0xcd7f('0x54')],null))['then'](respondWithResult(_0x55fce3,null))[_0xcd7f('0x28')](handleError(_0x55fce3,null));};exports[_0xcd7f('0x32')]=function(_0x10a9c6,_0x4b9930){return db[_0xcd7f('0x4e')][_0xcd7f('0x56')]({'where':{'id':_0x10a9c6[_0xcd7f('0x57')]['id']}})['then'](handleEntityNotFound(_0x4b9930,null))[_0xcd7f('0x1d')](removeEntity(_0x4b9930,null))[_0xcd7f('0x28')](handleError(_0x4b9930,null));};exports[_0xcd7f('0x58')]=function(_0x3b8bda,_0x2a7966,_0x14dbf8){var _0x50e54c={};var _0x4cb5c3={};var _0x485c8b;var _0x27c37e;return db['ZendeskAccount'][_0xcd7f('0x59')]({'where':{'id':_0x3b8bda['params']['id']}})[_0xcd7f('0x1d')](handleEntityNotFound(_0x2a7966,null))['then'](function(_0x5dd1a5){if(_0x5dd1a5){_0x485c8b=_0x5dd1a5;_0x4cb5c3[_0xcd7f('0x3c')]=_[_0xcd7f('0x3e')](db['ZendeskConfiguration']['rawAttributes']);_0x4cb5c3['query']=_[_0xcd7f('0x3e')](_0x3b8bda[_0xcd7f('0x3d')]);_0x4cb5c3[_0xcd7f('0x48')]=_['intersection'](_0x4cb5c3[_0xcd7f('0x3c')],_0x4cb5c3[_0xcd7f('0x3d')]);_0x50e54c[_0xcd7f('0x40')]=_[_0xcd7f('0x3f')](_0x4cb5c3[_0xcd7f('0x3c')],qs['fields'](_0x3b8bda[_0xcd7f('0x3d')]['fields']));_0x50e54c[_0xcd7f('0x40')]=_0x50e54c['attributes'][_0xcd7f('0x42')]?_0x50e54c[_0xcd7f('0x40')]:_0x4cb5c3[_0xcd7f('0x3c')];_0x50e54c[_0xcd7f('0x45')]=qs[_0xcd7f('0x46')](_0x3b8bda[_0xcd7f('0x3d')][_0xcd7f('0x46')]);_0x50e54c[_0xcd7f('0x47')]=qs[_0xcd7f('0x48')](_['pick'](_0x3b8bda[_0xcd7f('0x3d')],_0x4cb5c3[_0xcd7f('0x48')]));if(_0x3b8bda[_0xcd7f('0x3d')][_0xcd7f('0x4a')]){_0x50e54c['where']=_['merge'](_0x50e54c[_0xcd7f('0x47')],{'$or':_[_0xcd7f('0x37')](_0x50e54c['attributes'],function(_0x1c938d){var _0x51e92a={};_0x51e92a[_0x1c938d]={'$like':'%'+_0x3b8bda['query']['filter']+'%'};return _0x51e92a;})});}_0x50e54c=_[_0xcd7f('0x4b')]({},_0x50e54c,_0x3b8bda[_0xcd7f('0x4d')]);return _0x485c8b[_0xcd7f('0x58')](_0x50e54c);}})[_0xcd7f('0x1d')](function(_0x4474e4){if(_0x4474e4){_0x27c37e=_0x4474e4['length'];if(!_0x3b8bda[_0xcd7f('0x3d')]['hasOwnProperty'](_0xcd7f('0x44'))){_0x50e54c[_0xcd7f('0x2e')]=qs[_0xcd7f('0x2e')](_0x3b8bda['query'][_0xcd7f('0x2e')]);_0x50e54c[_0xcd7f('0x2d')]=qs[_0xcd7f('0x2d')](_0x3b8bda[_0xcd7f('0x3d')][_0xcd7f('0x2d')]);}return _0x485c8b[_0xcd7f('0x58')](_0x50e54c);}})[_0xcd7f('0x1d')](function(_0x1963f0){if(_0x1963f0){return _0x1963f0?{'count':_0x27c37e,'rows':_0x1963f0}:null;}})['then'](respondWithResult(_0x2a7966,null))[_0xcd7f('0x28')](handleError(_0x2a7966,null));};exports[_0xcd7f('0x5a')]=function(_0x4c5d61,_0x2dd7cc,_0x127fe0){if(_0x4c5d61['body']['id']){delete _0x4c5d61[_0xcd7f('0x54')]['id'];}return db[_0xcd7f('0x4e')][_0xcd7f('0x59')]({'where':{'id':_0x4c5d61['params']['id']}})[_0xcd7f('0x1d')](handleEntityNotFound(_0x2dd7cc,null))[_0xcd7f('0x1d')](function(_0x5c77c7){if(_0x5c77c7){_0x4c5d61['body']['AccountId']=_0x5c77c7['id'];_0x4c5d61[_0xcd7f('0x54')][_0xcd7f('0x5b')]=integrations['getSubjects'](_0x4c5d61['body'][_0xcd7f('0x5c')],_0x4c5d61['body']['type']);_0x4c5d61[_0xcd7f('0x54')][_0xcd7f('0x5d')]=integrations[_0xcd7f('0x5e')](_0x4c5d61[_0xcd7f('0x54')][_0xcd7f('0x5c')],_0x4c5d61[_0xcd7f('0x54')][_0xcd7f('0x3a')]);return db['ZendeskConfiguration'][_0xcd7f('0x53')](_0x4c5d61[_0xcd7f('0x54')],{'include':[{'model':db[_0xcd7f('0x5f')],'as':'Subjects'},{'model':db[_0xcd7f('0x5f')],'as':_0xcd7f('0x5d')}]});}return null;})[_0xcd7f('0x1d')](respondWithResult(_0x2dd7cc,null))['catch'](handleError(_0x2dd7cc,null));};exports[_0xcd7f('0x60')]=function(_0x150980,_0x5e12f5,_0x4d6f43){var _0xbce27c='';return db[_0xcd7f('0x4e')][_0xcd7f('0x59')]({'where':{'id':_0x150980[_0xcd7f('0x57')]['id']},'attributes':['id',_0xcd7f('0x61'),'password',_0xcd7f('0x62'),_0xcd7f('0x63'),'remoteUri']})[_0xcd7f('0x1d')](handleEntityNotFound(_0x5e12f5,null))[_0xcd7f('0x1d')](function(_0x460ac3){if(_0x460ac3){_0xbce27c=_0x460ac3[_0xcd7f('0x64')];var _0x20f1e4=_0xbce27c[_0xcd7f('0x65')](-0x1);if(_0x20f1e4==='/'){_0xbce27c=_0xbce27c[_0xcd7f('0x66')](0x0,_0xbce27c[_0xcd7f('0x67')](_0x20f1e4));}var _0x5e0367={'method':_0xcd7f('0x68'),'uri':util[_0xcd7f('0x69')](_0xcd7f('0x6a'),_0xbce27c,'ticket_fields'),'json':!![]};switch(_0x460ac3['authType']){case'password':_0x5e0367[_0xcd7f('0x6b')]={'Authorization':util[_0xcd7f('0x69')]('Basic\x20%s',new Buffer(util[_0xcd7f('0x69')](_0xcd7f('0x6c'),_0x460ac3[_0xcd7f('0x61')],_0x460ac3['password']))[_0xcd7f('0x6d')]('base64'))};break;case _0xcd7f('0x62'):_0x5e0367[_0xcd7f('0x6b')]={'Authorization':util[_0xcd7f('0x69')](_0xcd7f('0x6e'),new Buffer(util['format'](_0xcd7f('0x6f'),_0x460ac3[_0xcd7f('0x61')],_0x460ac3[_0xcd7f('0x62')]))[_0xcd7f('0x6d')](_0xcd7f('0x70')))};break;default:throw new db[(_0xcd7f('0x19'))][(_0xcd7f('0x1a'))](_0xcd7f('0x71'));}return rp(_0x5e0367);}})[_0xcd7f('0x1d')](function(_0xfaba57){if(_0xfaba57){var _0x313586=[_0xcd7f('0x72'),_0xcd7f('0x73'),_0xcd7f('0x74'),_0xcd7f('0x75')];_[_0xcd7f('0x76')](_0xfaba57[_0xcd7f('0x77')],function(_0x12cd17){return _0x313586[_0xcd7f('0x78')](_0x12cd17[_0xcd7f('0x3a')]);});return{'count':_0xfaba57[_0xcd7f('0x77')][_0xcd7f('0x42')],'rows':_[_0xcd7f('0x37')](_0xfaba57[_0xcd7f('0x77')],function(_0x49e630){return{'id':_0x49e630['id'],'name':_0x49e630[_0xcd7f('0x79')]>0x7?_0x49e630['title']:_0x49e630['type'],'custom':_0x49e630[_0xcd7f('0x79')]>0x7?!![]:![],'options':_0x49e630[_0xcd7f('0x7a')]?_0x49e630[_0xcd7f('0x7a')]:_0x49e630[_0xcd7f('0x7b')]?_0x49e630[_0xcd7f('0x7b')]:[]};})};}})[_0xcd7f('0x1d')](respondWithResult(_0x5e12f5,null))[_0xcd7f('0x28')](function(_0x5a73bd){var _0x5289a0=_0x150980[_0xcd7f('0x3d')]['test']?0x1f4:_0x5a73bd['statusCode']||0x1f4;logger[_0xcd7f('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0xcd7f('0x60'),_0x5289a0,JSON['stringify'](_0x5a73bd));delete _0x5a73bd[_0xcd7f('0x34')];if(_0x5289a0===0x191){_0x5289a0=0x190;}_0x5e12f5[_0xcd7f('0x29')](_0x5289a0)[_0xcd7f('0x35')](_0x150980[_0xcd7f('0x3d')][_0xcd7f('0x18')]?{'message':'Wrong\x20credentials','statusCode':_0x5a73bd[_0xcd7f('0x7c')]}:_0x5a73bd);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 9e0eac2..4e6650b 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 _0x13d5=['lodash','moment','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define'];(function(_0x24f251,_0x570117){var _0x532cb0=function(_0x372e2f){while(--_0x372e2f){_0x24f251['push'](_0x24f251['shift']());}};_0x532cb0(++_0x570117);}(_0x13d5,0x70));var _0x513d=function(_0x3abd24,_0x554343){_0x3abd24=_0x3abd24-0x0;var _0x392bda=_0x13d5[_0x3abd24];return _0x392bda;};'use strict';var _=require(_0x513d('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x513d('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x513d('0x2'));var rimraf=require(_0x513d('0x3'));var config=require(_0x513d('0x4'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x513d('0x5'));module[_0x513d('0x6')]=function(_0x446bae,_0x468540){return _0x446bae[_0x513d('0x7')]('ZendeskAccount',attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7620=['../../components/integrations/configuration','define','ZendeskAccount','int_zendesk_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes'];(function(_0x1c6b9c,_0x4a312c){var _0x247491=function(_0x2e0dc0){while(--_0x2e0dc0){_0x1c6b9c['push'](_0x1c6b9c['shift']());}};_0x247491(++_0x4a312c);}(_0x7620,0x1ee));var _0x0762=function(_0x3e8bf8,_0x4e76d6){_0x3e8bf8=_0x3e8bf8-0x0;var _0x3391ce=_0x7620[_0x3e8bf8];return _0x3391ce;};'use strict';var _=require(_0x0762('0x0'));var util=require(_0x0762('0x1'));var logger=require('../../config/logger')(_0x0762('0x2'));var moment=require(_0x0762('0x3'));var BPromise=require(_0x0762('0x4'));var rp=require(_0x0762('0x5'));var fs=require('fs');var path=require(_0x0762('0x6'));var rimraf=require(_0x0762('0x7'));var config=require(_0x0762('0x8'));var attributes=require(_0x0762('0x9'));var integrations=require(_0x0762('0xa'));module['exports']=function(_0x2b100e,_0x3bf916){return _0x2b100e[_0x0762('0xb')](_0x0762('0xc'),attributes,{'tableName':_0x0762('0xd'),'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 6d44c79..f61f2f9 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.rpc.js +++ b/server/api/intZendeskAccount/intZendeskAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['stringify','error','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','where','attributes','limit','include','map','model','ShowZendeskAccount','find','raw','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x2f22d7,_0x2e677d){var _0x498b74=function(_0x17c6a3){while(--_0x17c6a3){_0x2f22d7['push'](_0x2f22d7['shift']());}};_0x498b74(++_0x2e677d);}(_0x757a,0xde));var _0xa757=function(_0x3fd6ca,_0x302d90){_0x3fd6ca=_0x3fd6ca-0x0;var _0x2f1e2c=_0x757a[_0x3fd6ca];return _0x2f1e2c;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});}exports[_0xa757('0x15')]=function(_0x4d9f58){var _0x54b305=this;return new Promise(function(_0x151c04,_0x468d45){return db[_0xa757('0x16')][_0xa757('0x17')]({'raw':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58['options'][_0xa757('0x19')]||null:null,'attributes':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'limit':_0x4d9f58['options']?_0x4d9f58['options'][_0xa757('0x1b')]||null:null,'include':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')],function(_0x21f1af){return{'model':db[_0x21f1af[_0xa757('0x1e')]],'as':_0x21f1af['as'],'attributes':_0x21f1af['attributes'],'include':_0x21f1af[_0xa757('0x1c')]?_['map'](_0x21f1af[_0xa757('0x1c')],function(_0x47903b){return{'model':db[_0x47903b[_0xa757('0x1e')]],'as':_0x47903b['as'],'attributes':_0x47903b[_0xa757('0x1a')],'include':_0x47903b[_0xa757('0x1c')]?_['map'](_0x47903b[_0xa757('0x1c')],function(_0xcd98bd){return{'model':db[_0xcd98bd[_0xa757('0x1e')]],'as':_0xcd98bd['as'],'attributes':_0xcd98bd[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x449a7d){logger['info']('GetZendeskAccount',_0x4d9f58);logger['debug']('GetZendeskAccount',_0x4d9f58,JSON[_0xa757('0x10')](_0x449a7d));_0x151c04(_0x449a7d);})['catch'](function(_0x2208f9){logger[_0xa757('0x11')]('GetZendeskAccount',_0x2208f9[_0xa757('0x12')],_0x4d9f58);_0x468d45(_0x54b305['error'](0x1f4,_0x2208f9[_0xa757('0x12')]));});});};exports[_0xa757('0x1f')]=function(_0x5307c3){var _0x235e54=this;return new Promise(function(_0x5ade7b,_0x3a4a66){return db[_0xa757('0x16')][_0xa757('0x20')]({'raw':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x21')]===undefined?!![]:![]:!![],'where':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x19')]||null:null,'attributes':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'include':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')],function(_0x1eacde){return{'model':db[_0x1eacde[_0xa757('0x1e')]],'as':_0x1eacde['as'],'attributes':_0x1eacde[_0xa757('0x1a')],'include':_0x1eacde[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x1eacde[_0xa757('0x1c')],function(_0x59700d){return{'model':db[_0x59700d[_0xa757('0x1e')]],'as':_0x59700d['as'],'attributes':_0x59700d[_0xa757('0x1a')],'include':_0x59700d[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x59700d[_0xa757('0x1c')],function(_0x51e2aa){return{'model':db[_0x51e2aa[_0xa757('0x1e')]],'as':_0x51e2aa['as'],'attributes':_0x51e2aa[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa757('0xa')](function(_0x2c34b1){logger[_0xa757('0xb')](_0xa757('0x1f'),_0x5307c3);logger['debug'](_0xa757('0x1f'),_0x5307c3,JSON[_0xa757('0x10')](_0x2c34b1));_0x5ade7b(_0x2c34b1);})[_0xa757('0x14')](function(_0xc34409){logger[_0xa757('0x11')](_0xa757('0x1f'),_0xc34409[_0xa757('0x12')],_0x5307c3);_0x3a4a66(_0x235e54[_0xa757('0x11')](0x1f4,_0xc34409[_0xa757('0x12')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','ZendeskAccount','findAll','options','raw','where','attributes','include','map','model','GetZendeskAccount','stringify','ShowZendeskAccount','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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['GetZendeskAccount']=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')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowZendeskAccount',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index d90f04f..9590a53 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 _0xd6ef=['express','Router','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','setTags','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x198d9c,_0x2b6cfa){var _0x1daf34=function(_0x593921){while(--_0x593921){_0x198d9c['push'](_0x198d9c['shift']());}};_0x1daf34(++_0x2b6cfa);}(_0xd6ef,0xc4));var _0xfd6e=function(_0x206835,_0x1c574f){_0x206835=_0x206835-0x0;var _0x499cc7=_0xd6ef[_0x206835];return _0x499cc7;};'use strict';var multer=require(_0xfd6e('0x0'));var util=require(_0xfd6e('0x1'));var path=require(_0xfd6e('0x2'));var timeout=require(_0xfd6e('0x3'));var express=require(_0xfd6e('0x4'));var router=express[_0xfd6e('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xfd6e('0x6'));var config=require(_0xfd6e('0x7'));var controller=require(_0xfd6e('0x8'));router[_0xfd6e('0x9')]('/',auth[_0xfd6e('0xa')](),controller[_0xfd6e('0xb')]);router[_0xfd6e('0x9')](_0xfd6e('0xc'),auth[_0xfd6e('0xa')](),controller[_0xfd6e('0xd')]);router[_0xfd6e('0x9')]('/:id/fields',auth[_0xfd6e('0xa')](),controller[_0xfd6e('0xe')]);router['get']('/:id/subjects',auth[_0xfd6e('0xa')](),controller[_0xfd6e('0xf')]);router[_0xfd6e('0x9')](_0xfd6e('0x10'),auth[_0xfd6e('0xa')](),controller[_0xfd6e('0x11')]);router['get'](_0xfd6e('0x12'),auth[_0xfd6e('0xa')](),controller['getTags']);router[_0xfd6e('0x13')]('/',auth[_0xfd6e('0xa')](),controller[_0xfd6e('0x14')]);router[_0xfd6e('0x13')](_0xfd6e('0x12'),auth[_0xfd6e('0xa')](),controller[_0xfd6e('0x15')]);router['put'](_0xfd6e('0xc'),auth[_0xfd6e('0xa')](),controller[_0xfd6e('0x16')]);router[_0xfd6e('0x17')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xfd6e('0x18')]=router; \ No newline at end of file +var _0x6bf2=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','destroy','exports','multer','util','path'];(function(_0x554e9e,_0xcb21e5){var _0x1ba47c=function(_0x535af9){while(--_0x535af9){_0x554e9e['push'](_0x554e9e['shift']());}};_0x1ba47c(++_0xcb21e5);}(_0x6bf2,0x1ea));var _0x26bf=function(_0x201038,_0x5921df){_0x201038=_0x201038-0x0;var _0x5dc9b0=_0x6bf2[_0x201038];return _0x5dc9b0;};'use strict';var multer=require(_0x26bf('0x0'));var util=require(_0x26bf('0x1'));var path=require(_0x26bf('0x2'));var timeout=require(_0x26bf('0x3'));var express=require(_0x26bf('0x4'));var router=express['Router']();var auth=require(_0x26bf('0x5'));var interaction=require(_0x26bf('0x6'));var config=require(_0x26bf('0x7'));var controller=require(_0x26bf('0x8'));router[_0x26bf('0x9')]('/',auth[_0x26bf('0xa')](),controller[_0x26bf('0xb')]);router[_0x26bf('0x9')](_0x26bf('0xc'),auth[_0x26bf('0xa')](),controller['show']);router[_0x26bf('0x9')](_0x26bf('0xd'),auth[_0x26bf('0xa')](),controller[_0x26bf('0xe')]);router[_0x26bf('0x9')](_0x26bf('0xf'),auth[_0x26bf('0xa')](),controller[_0x26bf('0x10')]);router[_0x26bf('0x9')](_0x26bf('0x11'),auth['isAuthenticated'](),controller[_0x26bf('0x12')]);router['get'](_0x26bf('0x13'),auth[_0x26bf('0xa')](),controller[_0x26bf('0x14')]);router[_0x26bf('0x15')]('/',auth[_0x26bf('0xa')](),controller[_0x26bf('0x16')]);router[_0x26bf('0x15')](_0x26bf('0x13'),auth['isAuthenticated'](),controller[_0x26bf('0x17')]);router[_0x26bf('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x26bf('0x19')]);router[_0x26bf('0x1a')](_0x26bf('0xc'),auth[_0x26bf('0xa')](),controller[_0x26bf('0x1b')]);module[_0x26bf('0x1c')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 483a64f..5ced57e 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 _0x5159=['sequelize','exports'];(function(_0xc4791d,_0x3b5bee){var _0x5386e1=function(_0x215ef8){while(--_0x215ef8){_0xc4791d['push'](_0xc4791d['shift']());}};_0x5386e1(++_0x3b5bee);}(_0x5159,0x76));var _0x9515=function(_0x13f8d3,_0x4471c2){_0x13f8d3=_0x13f8d3-0x0;var _0x1793c9=_0x5159[_0x13f8d3];return _0x1793c9;};'use strict';var Sequelize=require(_0x9515('0x0'));module[_0x9515('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2c16=['sequelize'];(function(_0x410e45,_0x5837f3){var _0x3d24aa=function(_0x108359){while(--_0x108359){_0x410e45['push'](_0x410e45['shift']());}};_0x3d24aa(++_0x5837f3);}(_0x2c16,0x9a));var _0x62c1=function(_0x24d70d,_0x2b6516){_0x24d70d=_0x24d70d-0x0;var _0x29d887=_0x2c16[_0x24d70d];return _0x29d887;};'use strict';var Sequelize=require(_0x62c1('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index bb066f1..b9c4a46 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 _0x1261=['update','then','destroy','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','count','includeAll','findAll','rows','catch','show','include','create','body','find','params','getFields','findOne','where','options','getSubjects','ZendeskField','getDescriptions','Tag','getTags','setTags','ids','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','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','request\x20sent','sendStatus','status','offset','limit','set','apply','save'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x1261,0x144));var _0x1126=function(_0x1193ea,_0xc04ef0){_0x1193ea=_0x1193ea-0x0;var _0x5e4000=_0x1261[_0x1193ea];return _0x5e4000;};'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'];var jayson=require(_0x1126('0x17'));var client=jayson[_0x1126('0x18')][_0x1126('0x19')]({'port':0x232a});function checkPasswordPattern(_0xca0355,_0x3f10e9,_0xd8ca42){if(_0xd8ca42){var _0x2048ad=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2048ad[_0x1126('0x1a')](_0x3f10e9)){return _0xca0355;}else{throw new db['Sequelize']['ValidationError'](_0x1126('0x1b'));}}else{return _0xca0355;}}function respondWithRpcPromise(_0x154e20,_0x279455,_0x4be0c6,_0x45149c){return new BPromise(function(_0x4794a7,_0x35fe9f){var _0x42f379=_0x45149c||client;return _0x42f379[_0x1126('0x1c')](_0x154e20,_0x4be0c6)['then'](function(_0x245cd7){logger[_0x1126('0x1d')]('ZendeskConfiguration,\x20%s,\x20%s',_0x279455,'request\x20sent');logger[_0x1126('0x1e')](_0x1126('0x1f'),_0x279455,'request\x20sent',JSON['stringify'](_0x245cd7));if(_0x245cd7[_0x1126('0x20')]){if(_0x245cd7['error'][_0x1126('0x21')]===0x1f4){logger[_0x1126('0x20')](_0x1126('0x22'),_0x279455,_0x245cd7['error'][_0x1126('0x23')]);return _0x35fe9f(_0x245cd7['error']['message']);}logger[_0x1126('0x20')](_0x1126('0x22'),_0x279455,_0x245cd7[_0x1126('0x20')][_0x1126('0x23')]);return _0x4794a7(_0x245cd7['error'][_0x1126('0x23')]);}else{logger[_0x1126('0x1d')]('ZendeskConfiguration,\x20%s,\x20%s',_0x279455,_0x1126('0x24'));_0x4794a7(_0x245cd7['result']['message']);}})['catch'](function(_0x2199d9){logger[_0x1126('0x20')](_0x1126('0x22'),_0x279455,_0x2199d9);_0x35fe9f(_0x2199d9);});});}function respondWithStatusCode(_0x34bcf1,_0x566c09){_0x566c09=_0x566c09||0xcc;return function(_0x1b07a7){if(_0x1b07a7){return _0x34bcf1[_0x1126('0x25')](_0x566c09);}return _0x34bcf1[_0x1126('0x26')](_0x566c09)['end']();};}function respondWithResult(_0x35eec3,_0x375e59){_0x375e59=_0x375e59||0xc8;return function(_0xa293f4){if(_0xa293f4){return _0x35eec3['status'](_0x375e59)['json'](_0xa293f4);}};}function respondWithFilteredResult(_0xeb7d89,_0x39bf0e){return function(_0x55e195){if(_0x55e195){var _0x2fb797=_0x55e195['count'],_0x23d2bc=_0x39bf0e[_0x1126('0x27')],_0x4a334a=_0x39bf0e['offset']+_0x39bf0e[_0x1126('0x28')],_0x3fa694;if(_0x4a334a>=_0x2fb797){_0x4a334a=_0x2fb797;_0x3fa694=0xc8;}else{_0x3fa694=0xce;}_0xeb7d89['status'](_0x3fa694);return _0xeb7d89[_0x1126('0x29')]('Content-Range',_0x23d2bc+'-'+_0x4a334a+'/'+_0x2fb797)['json'](_0x55e195);}return null;};}function patchUpdates(_0x4a53ab){return function(_0x17646e){try{jsonpatch[_0x1126('0x2a')](_0x17646e,_0x4a53ab,!![]);}catch(_0x1cef48){return BPromise['reject'](_0x1cef48);}return _0x17646e[_0x1126('0x2b')]();};}function saveUpdates(_0x226afb,_0x56f7f8){return function(_0x3dd50e){if(_0x3dd50e){return _0x3dd50e[_0x1126('0x2c')](_0x226afb)[_0x1126('0x2d')](function(_0x29fbfa){return _0x29fbfa;});}return null;};}function removeEntity(_0x5836a2,_0x5ecbc3){return function(_0x2a7edc){if(_0x2a7edc){return _0x2a7edc[_0x1126('0x2e')]()[_0x1126('0x2d')](function(){_0x5836a2[_0x1126('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x145314,_0x6f4312){return function(_0x313ebe){if(!_0x313ebe){_0x145314[_0x1126('0x25')](0x194);}return _0x313ebe;};}function handleError(_0x3b0f79,_0x5df232){_0x5df232=_0x5df232||0x1f4;return function(_0x2a0dfe){logger[_0x1126('0x20')](_0x2a0dfe[_0x1126('0x2f')]);if(_0x2a0dfe[_0x1126('0x30')]){delete _0x2a0dfe['name'];}_0x3b0f79['status'](_0x5df232)[_0x1126('0x31')](_0x2a0dfe);};}exports[_0x1126('0x32')]=function(_0x511e6b,_0xde37cf){var _0xf3c21b={},_0x11b0f6={},_0x5c08b9={'count':0x0,'rows':[]};var _0x4b3859=_[_0x1126('0x33')](db[_0x1126('0x34')][_0x1126('0x35')],function(_0x156554){return{'name':_0x156554['fieldName'],'type':_0x156554[_0x1126('0x36')]['key']};});_0x11b0f6[_0x1126('0x37')]=_[_0x1126('0x33')](_0x4b3859,_0x1126('0x30'));_0x11b0f6[_0x1126('0x38')]=_[_0x1126('0x39')](_0x511e6b['query']);_0x11b0f6[_0x1126('0x3a')]=_[_0x1126('0x3b')](_0x11b0f6[_0x1126('0x37')],_0x11b0f6[_0x1126('0x38')]);_0xf3c21b[_0x1126('0x3c')]=_[_0x1126('0x3b')](_0x11b0f6[_0x1126('0x37')],qs['fields'](_0x511e6b[_0x1126('0x38')][_0x1126('0x3d')]));_0xf3c21b[_0x1126('0x3c')]=_0xf3c21b[_0x1126('0x3c')][_0x1126('0x3e')]?_0xf3c21b['attributes']:_0x11b0f6['model'];if(!_0x511e6b[_0x1126('0x38')][_0x1126('0x3f')](_0x1126('0x40'))){_0xf3c21b[_0x1126('0x28')]=qs[_0x1126('0x28')](_0x511e6b[_0x1126('0x38')]['limit']);_0xf3c21b['offset']=qs['offset'](_0x511e6b[_0x1126('0x38')]['offset']);}_0xf3c21b[_0x1126('0x41')]=qs[_0x1126('0x42')](_0x511e6b[_0x1126('0x38')][_0x1126('0x42')]);_0xf3c21b['where']=qs['filters'](_[_0x1126('0x43')](_0x511e6b[_0x1126('0x38')],_0x11b0f6[_0x1126('0x3a')]));if(_0x511e6b['query'][_0x1126('0x44')]){_0xf3c21b['where']=_[_0x1126('0x45')](_0xf3c21b['where'],{'$or':_[_0x1126('0x33')](_0x4b3859,function(_0xe178b4){if(_0xe178b4[_0x1126('0x36')]!=='VIRTUAL'){var _0xfaa3d8={};_0xfaa3d8[_0xe178b4[_0x1126('0x30')]]={'$like':'%'+_0x511e6b[_0x1126('0x38')]['filter']+'%'};return _0xfaa3d8;}})});}_0xf3c21b=_['merge']({},_0xf3c21b,_0x511e6b['options']);var _0x6e78cf={'where':_0xf3c21b['where']};return db[_0x1126('0x34')]['count'](_0x6e78cf)[_0x1126('0x2d')](function(_0x323499){_0x5c08b9[_0x1126('0x46')]=_0x323499;if(_0x511e6b[_0x1126('0x38')][_0x1126('0x47')]){_0xf3c21b['include']=[{'all':!![]}];}return db[_0x1126('0x34')][_0x1126('0x48')](_0xf3c21b);})['then'](function(_0x1a15f8){_0x5c08b9[_0x1126('0x49')]=_0x1a15f8;return _0x5c08b9;})['then'](respondWithFilteredResult(_0xde37cf,_0xf3c21b))[_0x1126('0x4a')](handleError(_0xde37cf,null));};exports[_0x1126('0x4b')]=function(_0x518e0a,_0x3e4eeb){var _0xbdde58={'raw':![],'where':{'id':_0x518e0a['params']['id']}},_0x213a76={};_0x213a76[_0x1126('0x37')]=_[_0x1126('0x39')](db[_0x1126('0x34')][_0x1126('0x35')]);_0x213a76[_0x1126('0x38')]=_[_0x1126('0x39')](_0x518e0a[_0x1126('0x38')]);_0x213a76[_0x1126('0x3a')]=_['intersection'](_0x213a76[_0x1126('0x37')],_0x213a76['query']);_0xbdde58[_0x1126('0x3c')]=_[_0x1126('0x3b')](_0x213a76['model'],qs['fields'](_0x518e0a[_0x1126('0x38')][_0x1126('0x3d')]));_0xbdde58[_0x1126('0x3c')]=_0xbdde58['attributes'][_0x1126('0x3e')]?_0xbdde58[_0x1126('0x3c')]:_0x213a76[_0x1126('0x37')];if(_0x518e0a[_0x1126('0x38')]['includeAll']){_0xbdde58[_0x1126('0x4c')]=[{'all':!![]}];}_0xbdde58=_[_0x1126('0x45')]({},_0xbdde58,_0x518e0a['options']);return db['ZendeskConfiguration']['find'](_0xbdde58)['then'](handleEntityNotFound(_0x3e4eeb,null))[_0x1126('0x2d')](respondWithResult(_0x3e4eeb,null))[_0x1126('0x4a')](handleError(_0x3e4eeb,null));};exports['create']=function(_0x16552b,_0x1c7a2b){return db[_0x1126('0x34')][_0x1126('0x4d')](_0x16552b[_0x1126('0x4e')],{})['then'](respondWithResult(_0x1c7a2b,0xc9))[_0x1126('0x4a')](handleError(_0x1c7a2b,null));};exports[_0x1126('0x2c')]=function(_0x5d6414,_0x322016){if(_0x5d6414[_0x1126('0x4e')]['id']){delete _0x5d6414[_0x1126('0x4e')]['id'];}return db[_0x1126('0x34')][_0x1126('0x4f')]({'where':{'id':_0x5d6414['params']['id']}})[_0x1126('0x2d')](handleEntityNotFound(_0x322016,null))['then'](saveUpdates(_0x5d6414[_0x1126('0x4e')],null))[_0x1126('0x2d')](respondWithResult(_0x322016,null))[_0x1126('0x4a')](handleError(_0x322016,null));};exports['destroy']=function(_0x427add,_0x2340f8){return db['ZendeskConfiguration'][_0x1126('0x4f')]({'where':{'id':_0x427add[_0x1126('0x50')]['id']}})[_0x1126('0x2d')](handleEntityNotFound(_0x2340f8,null))['then'](removeEntity(_0x2340f8,null))[_0x1126('0x4a')](handleError(_0x2340f8,null));};exports[_0x1126('0x51')]=function(_0x22ab18,_0x308ee4,_0x128c94){var _0x26949c={};var _0x30c848={};var _0x114be2;var _0x47e53d;return db[_0x1126('0x34')][_0x1126('0x52')]({'where':{'id':_0x22ab18[_0x1126('0x50')]['id']}})[_0x1126('0x2d')](handleEntityNotFound(_0x308ee4,null))[_0x1126('0x2d')](function(_0x4f5772){if(_0x4f5772){_0x114be2=_0x4f5772;_0x30c848[_0x1126('0x37')]=_[_0x1126('0x39')](db['ZendeskField'][_0x1126('0x35')]);_0x30c848['query']=_[_0x1126('0x39')](_0x22ab18[_0x1126('0x38')]);_0x30c848['filters']=_[_0x1126('0x3b')](_0x30c848[_0x1126('0x37')],_0x30c848[_0x1126('0x38')]);_0x26949c['attributes']=_[_0x1126('0x3b')](_0x30c848['model'],qs['fields'](_0x22ab18[_0x1126('0x38')][_0x1126('0x3d')]));_0x26949c[_0x1126('0x3c')]=_0x26949c[_0x1126('0x3c')][_0x1126('0x3e')]?_0x26949c[_0x1126('0x3c')]:_0x30c848[_0x1126('0x37')];_0x26949c['order']=qs[_0x1126('0x42')](_0x22ab18[_0x1126('0x38')][_0x1126('0x42')]);_0x26949c[_0x1126('0x53')]=qs[_0x1126('0x3a')](_[_0x1126('0x43')](_0x22ab18['query'],_0x30c848['filters']));if(_0x22ab18[_0x1126('0x38')][_0x1126('0x44')]){_0x26949c['where']=_['merge'](_0x26949c['where'],{'$or':_['map'](_0x26949c[_0x1126('0x3c')],function(_0x37b1ab){var _0x3440c5={};_0x3440c5[_0x37b1ab]={'$like':'%'+_0x22ab18['query'][_0x1126('0x44')]+'%'};return _0x3440c5;})});}_0x26949c=_[_0x1126('0x45')]({},_0x26949c,_0x22ab18[_0x1126('0x54')]);return _0x114be2[_0x1126('0x51')](_0x26949c);}})[_0x1126('0x2d')](function(_0x3f007b){if(_0x3f007b){_0x47e53d=_0x3f007b[_0x1126('0x3e')];if(!_0x22ab18['query'][_0x1126('0x3f')](_0x1126('0x40'))){_0x26949c[_0x1126('0x28')]=qs[_0x1126('0x28')](_0x22ab18[_0x1126('0x38')]['limit']);_0x26949c['offset']=qs[_0x1126('0x27')](_0x22ab18[_0x1126('0x38')]['offset']);}return _0x114be2[_0x1126('0x51')](_0x26949c);}})[_0x1126('0x2d')](function(_0x366675){if(_0x366675){return _0x366675?{'count':_0x47e53d,'rows':_0x366675}:null;}})[_0x1126('0x2d')](respondWithResult(_0x308ee4,null))[_0x1126('0x4a')](handleError(_0x308ee4,null));};exports[_0x1126('0x55')]=function(_0x41ce78,_0x247f12,_0xd20fbe){var _0x3d5e15={};var _0x16e48a={};var _0x1228cf;var _0x3dad39;return db['ZendeskConfiguration'][_0x1126('0x52')]({'where':{'id':_0x41ce78[_0x1126('0x50')]['id']}})[_0x1126('0x2d')](handleEntityNotFound(_0x247f12,null))['then'](function(_0x484881){if(_0x484881){_0x1228cf=_0x484881;_0x16e48a[_0x1126('0x37')]=_[_0x1126('0x39')](db[_0x1126('0x56')][_0x1126('0x35')]);_0x16e48a['query']=_['keys'](_0x41ce78['query']);_0x16e48a[_0x1126('0x3a')]=_[_0x1126('0x3b')](_0x16e48a[_0x1126('0x37')],_0x16e48a[_0x1126('0x38')]);_0x3d5e15['attributes']=_[_0x1126('0x3b')](_0x16e48a['model'],qs[_0x1126('0x3d')](_0x41ce78[_0x1126('0x38')][_0x1126('0x3d')]));_0x3d5e15[_0x1126('0x3c')]=_0x3d5e15[_0x1126('0x3c')][_0x1126('0x3e')]?_0x3d5e15[_0x1126('0x3c')]:_0x16e48a['model'];_0x3d5e15[_0x1126('0x41')]=qs['sort'](_0x41ce78[_0x1126('0x38')][_0x1126('0x42')]);_0x3d5e15['where']=qs[_0x1126('0x3a')](_[_0x1126('0x43')](_0x41ce78['query'],_0x16e48a[_0x1126('0x3a')]));if(_0x41ce78[_0x1126('0x38')]['filter']){_0x3d5e15['where']=_[_0x1126('0x45')](_0x3d5e15[_0x1126('0x53')],{'$or':_[_0x1126('0x33')](_0x3d5e15['attributes'],function(_0x4d007b){var _0x4b0fab={};_0x4b0fab[_0x4d007b]={'$like':'%'+_0x41ce78[_0x1126('0x38')]['filter']+'%'};return _0x4b0fab;})});}_0x3d5e15=_['merge']({},_0x3d5e15,_0x41ce78[_0x1126('0x54')]);return _0x1228cf['getSubjects'](_0x3d5e15);}})[_0x1126('0x2d')](function(_0x288a0c){if(_0x288a0c){_0x3dad39=_0x288a0c['length'];if(!_0x41ce78[_0x1126('0x38')][_0x1126('0x3f')](_0x1126('0x40'))){_0x3d5e15[_0x1126('0x28')]=qs[_0x1126('0x28')](_0x41ce78['query'][_0x1126('0x28')]);_0x3d5e15[_0x1126('0x27')]=qs['offset'](_0x41ce78[_0x1126('0x38')][_0x1126('0x27')]);}return _0x1228cf[_0x1126('0x55')](_0x3d5e15);}})[_0x1126('0x2d')](function(_0x2598a7){if(_0x2598a7){return _0x2598a7?{'count':_0x3dad39,'rows':_0x2598a7}:null;}})[_0x1126('0x2d')](respondWithResult(_0x247f12,null))[_0x1126('0x4a')](handleError(_0x247f12,null));};exports[_0x1126('0x57')]=function(_0xeaf964,_0x9a2af0,_0xbe2a8f){var _0x3af321={};var _0x2010a9={};var _0x3b5384;var _0x8bfa0;return db[_0x1126('0x34')]['findOne']({'where':{'id':_0xeaf964[_0x1126('0x50')]['id']}})[_0x1126('0x2d')](handleEntityNotFound(_0x9a2af0,null))[_0x1126('0x2d')](function(_0x1483f4){if(_0x1483f4){_0x3b5384=_0x1483f4;_0x2010a9[_0x1126('0x37')]=_['keys'](db[_0x1126('0x56')]['rawAttributes']);_0x2010a9['query']=_[_0x1126('0x39')](_0xeaf964[_0x1126('0x38')]);_0x2010a9['filters']=_['intersection'](_0x2010a9[_0x1126('0x37')],_0x2010a9[_0x1126('0x38')]);_0x3af321[_0x1126('0x3c')]=_[_0x1126('0x3b')](_0x2010a9[_0x1126('0x37')],qs[_0x1126('0x3d')](_0xeaf964[_0x1126('0x38')][_0x1126('0x3d')]));_0x3af321[_0x1126('0x3c')]=_0x3af321['attributes'][_0x1126('0x3e')]?_0x3af321[_0x1126('0x3c')]:_0x2010a9[_0x1126('0x37')];_0x3af321[_0x1126('0x41')]=qs[_0x1126('0x42')](_0xeaf964[_0x1126('0x38')]['sort']);_0x3af321[_0x1126('0x53')]=qs[_0x1126('0x3a')](_[_0x1126('0x43')](_0xeaf964[_0x1126('0x38')],_0x2010a9[_0x1126('0x3a')]));if(_0xeaf964[_0x1126('0x38')][_0x1126('0x44')]){_0x3af321[_0x1126('0x53')]=_[_0x1126('0x45')](_0x3af321[_0x1126('0x53')],{'$or':_['map'](_0x3af321['attributes'],function(_0x271d7c){var _0x55496f={};_0x55496f[_0x271d7c]={'$like':'%'+_0xeaf964[_0x1126('0x38')]['filter']+'%'};return _0x55496f;})});}_0x3af321=_[_0x1126('0x45')]({},_0x3af321,_0xeaf964['options']);return _0x3b5384[_0x1126('0x57')](_0x3af321);}})['then'](function(_0x5c5044){if(_0x5c5044){_0x8bfa0=_0x5c5044['length'];if(!_0xeaf964[_0x1126('0x38')][_0x1126('0x3f')]('nolimit')){_0x3af321['limit']=qs[_0x1126('0x28')](_0xeaf964[_0x1126('0x38')][_0x1126('0x28')]);_0x3af321['offset']=qs['offset'](_0xeaf964[_0x1126('0x38')]['offset']);}return _0x3b5384[_0x1126('0x57')](_0x3af321);}})[_0x1126('0x2d')](function(_0x41c7f8){if(_0x41c7f8){return _0x41c7f8?{'count':_0x8bfa0,'rows':_0x41c7f8}:null;}})[_0x1126('0x2d')](respondWithResult(_0x9a2af0,null))[_0x1126('0x4a')](handleError(_0x9a2af0,null));};exports['getTags']=function(_0x591c75,_0x5ae7ac,_0xd808db){var _0xfc9fb4={};var _0x3758fa={};var _0x1b8218;var _0x23bd79;return db[_0x1126('0x34')][_0x1126('0x52')]({'where':{'id':_0x591c75[_0x1126('0x50')]['id']}})[_0x1126('0x2d')](handleEntityNotFound(_0x5ae7ac,null))[_0x1126('0x2d')](function(_0x5119a1){if(_0x5119a1){_0x1b8218=_0x5119a1;_0x3758fa[_0x1126('0x37')]=_['keys'](db[_0x1126('0x58')]['rawAttributes']);_0x3758fa[_0x1126('0x38')]=_[_0x1126('0x39')](_0x591c75[_0x1126('0x38')]);_0x3758fa[_0x1126('0x3a')]=_['intersection'](_0x3758fa[_0x1126('0x37')],_0x3758fa[_0x1126('0x38')]);_0xfc9fb4['attributes']=_['intersection'](_0x3758fa[_0x1126('0x37')],qs[_0x1126('0x3d')](_0x591c75[_0x1126('0x38')]['fields']));_0xfc9fb4[_0x1126('0x3c')]=_0xfc9fb4['attributes'][_0x1126('0x3e')]?_0xfc9fb4[_0x1126('0x3c')]:_0x3758fa['model'];_0xfc9fb4[_0x1126('0x41')]=qs[_0x1126('0x42')](_0x591c75[_0x1126('0x38')][_0x1126('0x42')]);_0xfc9fb4[_0x1126('0x53')]=qs['filters'](_[_0x1126('0x43')](_0x591c75[_0x1126('0x38')],_0x3758fa[_0x1126('0x3a')]));if(_0x591c75['query']['filter']){_0xfc9fb4['where']=_[_0x1126('0x45')](_0xfc9fb4[_0x1126('0x53')],{'$or':_[_0x1126('0x33')](_0xfc9fb4[_0x1126('0x3c')],function(_0x4fcca3){var _0x101553={};_0x101553[_0x4fcca3]={'$like':'%'+_0x591c75[_0x1126('0x38')][_0x1126('0x44')]+'%'};return _0x101553;})});}_0xfc9fb4=_[_0x1126('0x45')]({},_0xfc9fb4,_0x591c75[_0x1126('0x54')]);return _0x1b8218['getTags'](_0xfc9fb4);}})[_0x1126('0x2d')](function(_0x21c487){if(_0x21c487){_0x23bd79=_0x21c487['length'];if(!_0x591c75[_0x1126('0x38')]['hasOwnProperty']('nolimit')){_0xfc9fb4[_0x1126('0x28')]=qs['limit'](_0x591c75[_0x1126('0x38')][_0x1126('0x28')]);_0xfc9fb4[_0x1126('0x27')]=qs[_0x1126('0x27')](_0x591c75[_0x1126('0x38')][_0x1126('0x27')]);}return _0x1b8218[_0x1126('0x59')](_0xfc9fb4);}})[_0x1126('0x2d')](function(_0x3762e0){if(_0x3762e0){return _0x3762e0?{'count':_0x23bd79,'rows':_0x3762e0}:null;}})['then'](respondWithResult(_0x5ae7ac,null))[_0x1126('0x4a')](handleError(_0x5ae7ac,null));};exports[_0x1126('0x5a')]=function(_0x1cda9d,_0x369447,_0x5a96ee){if(_0x1cda9d[_0x1126('0x4e')]['id']){delete _0x1cda9d[_0x1126('0x4e')]['id'];}return db[_0x1126('0x34')][_0x1126('0x52')]({'where':{'id':_0x1cda9d['params']['id']}})['then'](handleEntityNotFound(_0x369447,null))['then'](function(_0x3229ee){if(_0x3229ee){return _0x3229ee['setTags'](_0x1cda9d[_0x1126('0x4e')][_0x1126('0x5b')]||[]);}return null;})['then'](respondWithResult(_0x369447,null))['catch'](handleError(_0x369447,null));}; \ No newline at end of file +var _0x9957=['count','offset','set','Content-Range','apply','save','update','name','send','index','ZendeskConfiguration','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','pick','filter','where','merge','type','options','includeAll','findAll','rows','show','params','find','create','body','getFields','findOne','ZendeskField','sort','nolimit','getSubjects','getDescriptions','getTags','setTags','ids','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','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','sendStatus','status','end','json'];(function(_0xb42ec7,_0x4a0132){var _0x5824d5=function(_0x3dfd6f){while(--_0x3dfd6f){_0xb42ec7['push'](_0xb42ec7['shift']());}};_0x5824d5(++_0x4a0132);}(_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')]('ZendeskConfiguration,\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')]('ZendeskConfiguration,\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')]('ZendeskConfiguration,\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(){_0x510841['status'](0xcc)[_0x7995('0x2d')]();});}};}function handleEntityNotFound(_0x3acfc3,_0x4a176f){return function(_0x3e7020){if(!_0x3e7020){_0x3acfc3['sendStatus'](0x194);}return _0x3e7020;};}function handleError(_0x37917b,_0x1cb058){_0x1cb058=_0x1cb058||0x1f4;return function(_0x177cb4){logger['error'](_0x177cb4['stack']);if(_0x177cb4[_0x7995('0x36')]){delete _0x177cb4['name'];}_0x37917b['status'](_0x1cb058)[_0x7995('0x37')](_0x177cb4);};}exports[_0x7995('0x38')]=function(_0x5212ff,_0x1baa15){var _0x1922b4={},_0x2b772f={},_0x18667c={'count':0x0,'rows':[]};var _0x1e3dbf=_['map'](db[_0x7995('0x39')][_0x7995('0x3a')],function(_0xf612e6){return{'name':_0xf612e6[_0x7995('0x3b')],'type':_0xf612e6['type'][_0x7995('0x3c')]};});_0x2b772f[_0x7995('0x3d')]=_[_0x7995('0x3e')](_0x1e3dbf,_0x7995('0x36'));_0x2b772f[_0x7995('0x3f')]=_[_0x7995('0x40')](_0x5212ff['query']);_0x2b772f[_0x7995('0x41')]=_[_0x7995('0x42')](_0x2b772f[_0x7995('0x3d')],_0x2b772f[_0x7995('0x3f')]);_0x1922b4[_0x7995('0x43')]=_[_0x7995('0x42')](_0x2b772f[_0x7995('0x3d')],qs[_0x7995('0x44')](_0x5212ff[_0x7995('0x3f')][_0x7995('0x44')]));_0x1922b4[_0x7995('0x43')]=_0x1922b4[_0x7995('0x43')][_0x7995('0x45')]?_0x1922b4['attributes']:_0x2b772f['model'];if(!_0x5212ff[_0x7995('0x3f')][_0x7995('0x46')]('nolimit')){_0x1922b4['limit']=qs[_0x7995('0x47')](_0x5212ff['query']['limit']);_0x1922b4[_0x7995('0x30')]=qs[_0x7995('0x30')](_0x5212ff[_0x7995('0x3f')]['offset']);}_0x1922b4[_0x7995('0x48')]=qs['sort'](_0x5212ff[_0x7995('0x3f')]['sort']);_0x1922b4['where']=qs[_0x7995('0x41')](_[_0x7995('0x49')](_0x5212ff[_0x7995('0x3f')],_0x2b772f[_0x7995('0x41')]));if(_0x5212ff['query'][_0x7995('0x4a')]){_0x1922b4[_0x7995('0x4b')]=_[_0x7995('0x4c')](_0x1922b4[_0x7995('0x4b')],{'$or':_['map'](_0x1e3dbf,function(_0x5f28e7){if(_0x5f28e7[_0x7995('0x4d')]!=='VIRTUAL'){var _0x23c41d={};_0x23c41d[_0x5f28e7['name']]={'$like':'%'+_0x5212ff[_0x7995('0x3f')]['filter']+'%'};return _0x23c41d;}})});}_0x1922b4=_[_0x7995('0x4c')]({},_0x1922b4,_0x5212ff[_0x7995('0x4e')]);var _0x4d9245={'where':_0x1922b4[_0x7995('0x4b')]};return db[_0x7995('0x39')][_0x7995('0x2f')](_0x4d9245)[_0x7995('0x20')](function(_0x4c6837){_0x18667c[_0x7995('0x2f')]=_0x4c6837;if(_0x5212ff[_0x7995('0x3f')][_0x7995('0x4f')]){_0x1922b4['include']=[{'all':!![]}];}return db[_0x7995('0x39')][_0x7995('0x50')](_0x1922b4);})[_0x7995('0x20')](function(_0x3d8ae3){_0x18667c[_0x7995('0x51')]=_0x3d8ae3;return _0x18667c;})['then'](respondWithFilteredResult(_0x1baa15,_0x1922b4))[_0x7995('0x2a')](handleError(_0x1baa15,null));};exports[_0x7995('0x52')]=function(_0x5921b9,_0x3d1dbb){var _0x5843ba={'raw':![],'where':{'id':_0x5921b9[_0x7995('0x53')]['id']}},_0x1d87f9={};_0x1d87f9[_0x7995('0x3d')]=_[_0x7995('0x40')](db[_0x7995('0x39')][_0x7995('0x3a')]);_0x1d87f9[_0x7995('0x3f')]=_['keys'](_0x5921b9[_0x7995('0x3f')]);_0x1d87f9[_0x7995('0x41')]=_[_0x7995('0x42')](_0x1d87f9['model'],_0x1d87f9[_0x7995('0x3f')]);_0x5843ba[_0x7995('0x43')]=_[_0x7995('0x42')](_0x1d87f9['model'],qs['fields'](_0x5921b9['query'][_0x7995('0x44')]));_0x5843ba[_0x7995('0x43')]=_0x5843ba['attributes'][_0x7995('0x45')]?_0x5843ba[_0x7995('0x43')]:_0x1d87f9[_0x7995('0x3d')];if(_0x5921b9[_0x7995('0x3f')][_0x7995('0x4f')]){_0x5843ba['include']=[{'all':!![]}];}_0x5843ba=_[_0x7995('0x4c')]({},_0x5843ba,_0x5921b9['options']);return db[_0x7995('0x39')][_0x7995('0x54')](_0x5843ba)[_0x7995('0x20')](handleEntityNotFound(_0x3d1dbb,null))['then'](respondWithResult(_0x3d1dbb,null))['catch'](handleError(_0x3d1dbb,null));};exports['create']=function(_0x563f8e,_0x2e13b0){return db[_0x7995('0x39')][_0x7995('0x55')](_0x563f8e[_0x7995('0x56')],{})[_0x7995('0x20')](respondWithResult(_0x2e13b0,0xc9))[_0x7995('0x2a')](handleError(_0x2e13b0,null));};exports[_0x7995('0x35')]=function(_0xda6ce8,_0x328671){if(_0xda6ce8[_0x7995('0x56')]['id']){delete _0xda6ce8[_0x7995('0x56')]['id'];}return db[_0x7995('0x39')][_0x7995('0x54')]({'where':{'id':_0xda6ce8[_0x7995('0x53')]['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x328671,null))[_0x7995('0x20')](saveUpdates(_0xda6ce8[_0x7995('0x56')],null))[_0x7995('0x20')](respondWithResult(_0x328671,null))[_0x7995('0x2a')](handleError(_0x328671,null));};exports['destroy']=function(_0x56a374,_0x630737){return db[_0x7995('0x39')][_0x7995('0x54')]({'where':{'id':_0x56a374['params']['id']}})['then'](handleEntityNotFound(_0x630737,null))[_0x7995('0x20')](removeEntity(_0x630737,null))[_0x7995('0x2a')](handleError(_0x630737,null));};exports[_0x7995('0x57')]=function(_0x332a85,_0x51c50b,_0x13cd7b){var _0x74ff38={};var _0xef5044={};var _0x33c49c;var _0x502d43;return db['ZendeskConfiguration'][_0x7995('0x58')]({'where':{'id':_0x332a85[_0x7995('0x53')]['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x51c50b,null))[_0x7995('0x20')](function(_0x37072){if(_0x37072){_0x33c49c=_0x37072;_0xef5044[_0x7995('0x3d')]=_[_0x7995('0x40')](db[_0x7995('0x59')][_0x7995('0x3a')]);_0xef5044['query']=_[_0x7995('0x40')](_0x332a85[_0x7995('0x3f')]);_0xef5044[_0x7995('0x41')]=_[_0x7995('0x42')](_0xef5044['model'],_0xef5044['query']);_0x74ff38[_0x7995('0x43')]=_[_0x7995('0x42')](_0xef5044['model'],qs[_0x7995('0x44')](_0x332a85[_0x7995('0x3f')][_0x7995('0x44')]));_0x74ff38[_0x7995('0x43')]=_0x74ff38[_0x7995('0x43')]['length']?_0x74ff38[_0x7995('0x43')]:_0xef5044['model'];_0x74ff38[_0x7995('0x48')]=qs[_0x7995('0x5a')](_0x332a85[_0x7995('0x3f')][_0x7995('0x5a')]);_0x74ff38[_0x7995('0x4b')]=qs[_0x7995('0x41')](_[_0x7995('0x49')](_0x332a85[_0x7995('0x3f')],_0xef5044[_0x7995('0x41')]));if(_0x332a85[_0x7995('0x3f')][_0x7995('0x4a')]){_0x74ff38[_0x7995('0x4b')]=_['merge'](_0x74ff38[_0x7995('0x4b')],{'$or':_[_0x7995('0x3e')](_0x74ff38[_0x7995('0x43')],function(_0xc2b660){var _0x2c6548={};_0x2c6548[_0xc2b660]={'$like':'%'+_0x332a85['query']['filter']+'%'};return _0x2c6548;})});}_0x74ff38=_[_0x7995('0x4c')]({},_0x74ff38,_0x332a85[_0x7995('0x4e')]);return _0x33c49c[_0x7995('0x57')](_0x74ff38);}})[_0x7995('0x20')](function(_0x5aa2ec){if(_0x5aa2ec){_0x502d43=_0x5aa2ec[_0x7995('0x45')];if(!_0x332a85['query']['hasOwnProperty'](_0x7995('0x5b'))){_0x74ff38[_0x7995('0x47')]=qs[_0x7995('0x47')](_0x332a85[_0x7995('0x3f')][_0x7995('0x47')]);_0x74ff38[_0x7995('0x30')]=qs[_0x7995('0x30')](_0x332a85[_0x7995('0x3f')][_0x7995('0x30')]);}return _0x33c49c[_0x7995('0x57')](_0x74ff38);}})['then'](function(_0x2dc1f7){if(_0x2dc1f7){return _0x2dc1f7?{'count':_0x502d43,'rows':_0x2dc1f7}:null;}})[_0x7995('0x20')](respondWithResult(_0x51c50b,null))[_0x7995('0x2a')](handleError(_0x51c50b,null));};exports['getSubjects']=function(_0x1fe1cb,_0x1d2f9d,_0x705f0){var _0x3a7d9d={};var _0x3b0d30={};var _0x51ab1e;var _0x550a10;return db[_0x7995('0x39')][_0x7995('0x58')]({'where':{'id':_0x1fe1cb[_0x7995('0x53')]['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x1d2f9d,null))['then'](function(_0x5e8b4c){if(_0x5e8b4c){_0x51ab1e=_0x5e8b4c;_0x3b0d30[_0x7995('0x3d')]=_[_0x7995('0x40')](db[_0x7995('0x59')][_0x7995('0x3a')]);_0x3b0d30['query']=_[_0x7995('0x40')](_0x1fe1cb[_0x7995('0x3f')]);_0x3b0d30['filters']=_['intersection'](_0x3b0d30[_0x7995('0x3d')],_0x3b0d30[_0x7995('0x3f')]);_0x3a7d9d['attributes']=_[_0x7995('0x42')](_0x3b0d30['model'],qs[_0x7995('0x44')](_0x1fe1cb[_0x7995('0x3f')]['fields']));_0x3a7d9d['attributes']=_0x3a7d9d[_0x7995('0x43')]['length']?_0x3a7d9d[_0x7995('0x43')]:_0x3b0d30[_0x7995('0x3d')];_0x3a7d9d[_0x7995('0x48')]=qs[_0x7995('0x5a')](_0x1fe1cb[_0x7995('0x3f')][_0x7995('0x5a')]);_0x3a7d9d[_0x7995('0x4b')]=qs[_0x7995('0x41')](_[_0x7995('0x49')](_0x1fe1cb[_0x7995('0x3f')],_0x3b0d30[_0x7995('0x41')]));if(_0x1fe1cb[_0x7995('0x3f')][_0x7995('0x4a')]){_0x3a7d9d[_0x7995('0x4b')]=_[_0x7995('0x4c')](_0x3a7d9d[_0x7995('0x4b')],{'$or':_[_0x7995('0x3e')](_0x3a7d9d[_0x7995('0x43')],function(_0x2ff7ba){var _0xa2fc8e={};_0xa2fc8e[_0x2ff7ba]={'$like':'%'+_0x1fe1cb[_0x7995('0x3f')][_0x7995('0x4a')]+'%'};return _0xa2fc8e;})});}_0x3a7d9d=_[_0x7995('0x4c')]({},_0x3a7d9d,_0x1fe1cb[_0x7995('0x4e')]);return _0x51ab1e[_0x7995('0x5c')](_0x3a7d9d);}})[_0x7995('0x20')](function(_0x2f7f51){if(_0x2f7f51){_0x550a10=_0x2f7f51[_0x7995('0x45')];if(!_0x1fe1cb['query'][_0x7995('0x46')](_0x7995('0x5b'))){_0x3a7d9d['limit']=qs['limit'](_0x1fe1cb[_0x7995('0x3f')][_0x7995('0x47')]);_0x3a7d9d[_0x7995('0x30')]=qs[_0x7995('0x30')](_0x1fe1cb[_0x7995('0x3f')][_0x7995('0x30')]);}return _0x51ab1e['getSubjects'](_0x3a7d9d);}})[_0x7995('0x20')](function(_0xb68962){if(_0xb68962){return _0xb68962?{'count':_0x550a10,'rows':_0xb68962}:null;}})[_0x7995('0x20')](respondWithResult(_0x1d2f9d,null))[_0x7995('0x2a')](handleError(_0x1d2f9d,null));};exports[_0x7995('0x5d')]=function(_0x3f0bff,_0x151d99,_0xc93dcb){var _0x560095={};var _0x1c8e7d={};var _0x2b8217;var _0x5c04c9;return db['ZendeskConfiguration'][_0x7995('0x58')]({'where':{'id':_0x3f0bff[_0x7995('0x53')]['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x151d99,null))[_0x7995('0x20')](function(_0xe42797){if(_0xe42797){_0x2b8217=_0xe42797;_0x1c8e7d['model']=_[_0x7995('0x40')](db[_0x7995('0x59')]['rawAttributes']);_0x1c8e7d[_0x7995('0x3f')]=_[_0x7995('0x40')](_0x3f0bff['query']);_0x1c8e7d[_0x7995('0x41')]=_['intersection'](_0x1c8e7d[_0x7995('0x3d')],_0x1c8e7d[_0x7995('0x3f')]);_0x560095[_0x7995('0x43')]=_[_0x7995('0x42')](_0x1c8e7d[_0x7995('0x3d')],qs['fields'](_0x3f0bff[_0x7995('0x3f')][_0x7995('0x44')]));_0x560095[_0x7995('0x43')]=_0x560095['attributes'][_0x7995('0x45')]?_0x560095[_0x7995('0x43')]:_0x1c8e7d[_0x7995('0x3d')];_0x560095[_0x7995('0x48')]=qs['sort'](_0x3f0bff[_0x7995('0x3f')][_0x7995('0x5a')]);_0x560095[_0x7995('0x4b')]=qs['filters'](_['pick'](_0x3f0bff[_0x7995('0x3f')],_0x1c8e7d[_0x7995('0x41')]));if(_0x3f0bff['query']['filter']){_0x560095[_0x7995('0x4b')]=_[_0x7995('0x4c')](_0x560095[_0x7995('0x4b')],{'$or':_[_0x7995('0x3e')](_0x560095[_0x7995('0x43')],function(_0x551b5e){var _0x56003d={};_0x56003d[_0x551b5e]={'$like':'%'+_0x3f0bff[_0x7995('0x3f')]['filter']+'%'};return _0x56003d;})});}_0x560095=_['merge']({},_0x560095,_0x3f0bff[_0x7995('0x4e')]);return _0x2b8217[_0x7995('0x5d')](_0x560095);}})[_0x7995('0x20')](function(_0x5eb360){if(_0x5eb360){_0x5c04c9=_0x5eb360[_0x7995('0x45')];if(!_0x3f0bff[_0x7995('0x3f')][_0x7995('0x46')](_0x7995('0x5b'))){_0x560095[_0x7995('0x47')]=qs['limit'](_0x3f0bff[_0x7995('0x3f')][_0x7995('0x47')]);_0x560095[_0x7995('0x30')]=qs[_0x7995('0x30')](_0x3f0bff['query'][_0x7995('0x30')]);}return _0x2b8217[_0x7995('0x5d')](_0x560095);}})['then'](function(_0x310272){if(_0x310272){return _0x310272?{'count':_0x5c04c9,'rows':_0x310272}:null;}})[_0x7995('0x20')](respondWithResult(_0x151d99,null))['catch'](handleError(_0x151d99,null));};exports[_0x7995('0x5e')]=function(_0x50efab,_0x1b4b34,_0x51e7d7){var _0x21f496={};var _0x4d12fd={};var _0xa97c08;var _0x20f48c;return db['ZendeskConfiguration'][_0x7995('0x58')]({'where':{'id':_0x50efab['params']['id']}})['then'](handleEntityNotFound(_0x1b4b34,null))[_0x7995('0x20')](function(_0x14812d){if(_0x14812d){_0xa97c08=_0x14812d;_0x4d12fd[_0x7995('0x3d')]=_[_0x7995('0x40')](db['Tag'][_0x7995('0x3a')]);_0x4d12fd[_0x7995('0x3f')]=_['keys'](_0x50efab['query']);_0x4d12fd[_0x7995('0x41')]=_['intersection'](_0x4d12fd[_0x7995('0x3d')],_0x4d12fd[_0x7995('0x3f')]);_0x21f496[_0x7995('0x43')]=_['intersection'](_0x4d12fd['model'],qs[_0x7995('0x44')](_0x50efab['query'][_0x7995('0x44')]));_0x21f496[_0x7995('0x43')]=_0x21f496[_0x7995('0x43')][_0x7995('0x45')]?_0x21f496['attributes']:_0x4d12fd['model'];_0x21f496['order']=qs[_0x7995('0x5a')](_0x50efab[_0x7995('0x3f')][_0x7995('0x5a')]);_0x21f496[_0x7995('0x4b')]=qs[_0x7995('0x41')](_[_0x7995('0x49')](_0x50efab['query'],_0x4d12fd['filters']));if(_0x50efab[_0x7995('0x3f')]['filter']){_0x21f496['where']=_[_0x7995('0x4c')](_0x21f496['where'],{'$or':_['map'](_0x21f496[_0x7995('0x43')],function(_0x3541d7){var _0x3873f3={};_0x3873f3[_0x3541d7]={'$like':'%'+_0x50efab['query'][_0x7995('0x4a')]+'%'};return _0x3873f3;})});}_0x21f496=_[_0x7995('0x4c')]({},_0x21f496,_0x50efab[_0x7995('0x4e')]);return _0xa97c08[_0x7995('0x5e')](_0x21f496);}})[_0x7995('0x20')](function(_0x178746){if(_0x178746){_0x20f48c=_0x178746[_0x7995('0x45')];if(!_0x50efab[_0x7995('0x3f')][_0x7995('0x46')]('nolimit')){_0x21f496[_0x7995('0x47')]=qs[_0x7995('0x47')](_0x50efab[_0x7995('0x3f')][_0x7995('0x47')]);_0x21f496[_0x7995('0x30')]=qs['offset'](_0x50efab[_0x7995('0x3f')][_0x7995('0x30')]);}return _0xa97c08[_0x7995('0x5e')](_0x21f496);}})['then'](function(_0x4c554d){if(_0x4c554d){return _0x4c554d?{'count':_0x20f48c,'rows':_0x4c554d}:null;}})['then'](respondWithResult(_0x1b4b34,null))[_0x7995('0x2a')](handleError(_0x1b4b34,null));};exports[_0x7995('0x5f')]=function(_0x9daa49,_0x1d52cf,_0x16a94d){if(_0x9daa49[_0x7995('0x56')]['id']){delete _0x9daa49['body']['id'];}return db[_0x7995('0x39')]['findOne']({'where':{'id':_0x9daa49[_0x7995('0x53')]['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x1d52cf,null))[_0x7995('0x20')](function(_0x2cc9a4){if(_0x2cc9a4){return _0x2cc9a4[_0x7995('0x5f')](_0x9daa49[_0x7995('0x56')][_0x7995('0x60')]||[]);}return null;})[_0x7995('0x20')](respondWithResult(_0x1d52cf,null))[_0x7995('0x2a')](handleError(_0x1d52cf,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 49e5731..9400df5 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 _0xe8e2=['util','api','bluebird','request-promise','rimraf','./intZendeskConfiguration.attributes','exports','define','int_zendesk_configurations','lodash'];(function(_0x563194,_0x461e6c){var _0x277d3a=function(_0x5baac1){while(--_0x5baac1){_0x563194['push'](_0x563194['shift']());}};_0x277d3a(++_0x461e6c);}(_0xe8e2,0xbd));var _0x2e8e=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0xe8e2[_0x2642cb];return _0xe6e41;};'use strict';var _=require(_0x2e8e('0x0'));var util=require(_0x2e8e('0x1'));var logger=require('../../config/logger')(_0x2e8e('0x2'));var moment=require('moment');var BPromise=require(_0x2e8e('0x3'));var rp=require(_0x2e8e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2e8e('0x5'));var config=require('../../config/environment');var attributes=require(_0x2e8e('0x6'));module[_0x2e8e('0x7')]=function(_0x4e2dca,_0x4c29f1){return _0x4e2dca[_0x2e8e('0x8')]('ZendeskConfiguration',attributes,{'tableName':_0x2e8e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3314=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','ZendeskConfiguration','int_zendesk_configurations','util'];(function(_0x402aa5,_0x198873){var _0x5bdaa7=function(_0x497148){while(--_0x497148){_0x402aa5['push'](_0x402aa5['shift']());}};_0x5bdaa7(++_0x198873);}(_0x3314,0x17f));var _0x4331=function(_0x2041d3,_0x13f844){_0x2041d3=_0x2041d3-0x0;var _0x25a5c3=_0x3314[_0x2041d3];return _0x25a5c3;};'use strict';var _=require('lodash');var util=require(_0x4331('0x0'));var logger=require(_0x4331('0x1'))(_0x4331('0x2'));var moment=require(_0x4331('0x3'));var BPromise=require(_0x4331('0x4'));var rp=require(_0x4331('0x5'));var fs=require('fs');var path=require(_0x4331('0x6'));var rimraf=require('rimraf');var config=require(_0x4331('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x4331('0x8')]=function(_0x3ddb87,_0x14602d){return _0x3ddb87[_0x4331('0x9')](_0x4331('0xa'),attributes,{'tableName':_0x4331('0xb'),'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 df36f11..01210bf 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 _0x69d6=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','moment','randomstring','../../mysqldb'];(function(_0x6c6d75,_0xef7deb){var _0x48a161=function(_0xf0fba0){while(--_0xf0fba0){_0x6c6d75['push'](_0x6c6d75['shift']());}};_0x48a161(++_0xef7deb);}(_0x69d6,0x75));var _0x669d=function(_0x12ef39,_0x18d320){_0x12ef39=_0x12ef39-0x0;var _0x47a734=_0x69d6[_0x12ef39];return _0x47a734;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x669d('0x0'));var BPromise=require('bluebird');var rs=require(_0x669d('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x669d('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x669d('0x3'))(_0x669d('0x4'));var config=require(_0x669d('0x5'));var jayson=require(_0x669d('0x6'));var client=jayson[_0x669d('0x7')][_0x669d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1e5ea7,_0x29afae,_0x4d1852){return new BPromise(function(_0x30d0f2,_0x464034){return client[_0x669d('0x9')](_0x1e5ea7,_0x4d1852)['then'](function(_0x511b7d){logger['info'](_0x669d('0xa'),_0x29afae,_0x669d('0xb'));logger[_0x669d('0xc')](_0x669d('0xd'),_0x29afae,_0x669d('0xb'),JSON[_0x669d('0xe')](_0x511b7d));if(_0x511b7d[_0x669d('0xf')]){if(_0x511b7d[_0x669d('0xf')]['code']===0x1f4){logger['error'](_0x669d('0xa'),_0x29afae,_0x511b7d[_0x669d('0xf')][_0x669d('0x10')]);return _0x464034(_0x511b7d[_0x669d('0xf')][_0x669d('0x10')]);}logger[_0x669d('0xf')](_0x669d('0xa'),_0x29afae,_0x511b7d['error'][_0x669d('0x10')]);return _0x30d0f2(_0x511b7d[_0x669d('0xf')][_0x669d('0x10')]);}else{logger[_0x669d('0x11')](_0x669d('0xa'),_0x29afae,_0x669d('0xb'));_0x30d0f2(_0x511b7d[_0x669d('0x12')][_0x669d('0x10')]);}})[_0x669d('0x13')](function(_0x3cd9a7){logger[_0x669d('0xf')]('ZendeskConfiguration,\x20%s,\x20%s',_0x29afae,_0x3cd9a7);_0x464034(_0x3cd9a7);});});} \ No newline at end of file +var _0x09dd=['bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment'];(function(_0x5833ad,_0x300b0b){var _0x1ad585=function(_0x587452){while(--_0x587452){_0x5833ad['push'](_0x5833ad['shift']());}};_0x1ad585(++_0x300b0b);}(_0x09dd,0x13f));var _0xd09d=function(_0x49fa98,_0x11accf){_0x49fa98=_0x49fa98-0x0;var _0x1698f1=_0x09dd[_0x49fa98];return _0x1698f1;};'use strict';var _=require(_0xd09d('0x0'));var util=require(_0xd09d('0x1'));var moment=require(_0xd09d('0x2'));var BPromise=require(_0xd09d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd09d('0x4'))['db'];var utils=require(_0xd09d('0x5'));var logger=require(_0xd09d('0x6'))(_0xd09d('0x7'));var config=require(_0xd09d('0x8'));var jayson=require(_0xd09d('0x9'));var client=jayson[_0xd09d('0xa')][_0xd09d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x22d78f,_0x5e42f0,_0x4a905a){return new BPromise(function(_0x4a31bc,_0x5828c3){return client[_0xd09d('0xc')](_0x22d78f,_0x4a905a)[_0xd09d('0xd')](function(_0x2cebbe){logger['info'](_0xd09d('0xe'),_0x5e42f0,_0xd09d('0xf'));logger['debug'](_0xd09d('0x10'),_0x5e42f0,_0xd09d('0xf'),JSON['stringify'](_0x2cebbe));if(_0x2cebbe['error']){if(_0x2cebbe[_0xd09d('0x11')][_0xd09d('0x12')]===0x1f4){logger['error'](_0xd09d('0xe'),_0x5e42f0,_0x2cebbe['error'][_0xd09d('0x13')]);return _0x5828c3(_0x2cebbe[_0xd09d('0x11')][_0xd09d('0x13')]);}logger[_0xd09d('0x11')](_0xd09d('0xe'),_0x5e42f0,_0x2cebbe[_0xd09d('0x11')][_0xd09d('0x13')]);return _0x4a31bc(_0x2cebbe['error'][_0xd09d('0x13')]);}else{logger[_0xd09d('0x14')](_0xd09d('0xe'),_0x5e42f0,'request\x20sent');_0x4a31bc(_0x2cebbe[_0xd09d('0x15')][_0xd09d('0x13')]);}})[_0xd09d('0x16')](function(_0x206286){logger[_0xd09d('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5e42f0,_0x206286);_0x5828c3(_0x206286);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 32f5c3c..468a7f7 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 _0x10c4=['update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','create','put'];(function(_0x29c081,_0x4b190f){var _0x264f8b=function(_0x1eae03){while(--_0x1eae03){_0x29c081['push'](_0x29c081['shift']());}};_0x264f8b(++_0x4b190f);}(_0x10c4,0x16b));var _0x410c=function(_0x54b7e6,_0x436ba5){_0x54b7e6=_0x54b7e6-0x0;var _0x1ea107=_0x10c4[_0x54b7e6];return _0x1ea107;};'use strict';var multer=require(_0x410c('0x0'));var util=require('util');var path=require(_0x410c('0x1'));var timeout=require(_0x410c('0x2'));var express=require(_0x410c('0x3'));var router=express[_0x410c('0x4')]();var auth=require(_0x410c('0x5'));var interaction=require(_0x410c('0x6'));var config=require('../../config/environment');var controller=require(_0x410c('0x7'));router[_0x410c('0x8')]('/',auth[_0x410c('0x9')](),controller[_0x410c('0xa')]);router[_0x410c('0x8')](_0x410c('0xb'),auth[_0x410c('0x9')](),controller[_0x410c('0xc')]);router['post']('/',auth[_0x410c('0x9')](),controller[_0x410c('0xd')]);router[_0x410c('0xe')](_0x410c('0xb'),auth[_0x410c('0x9')](),controller[_0x410c('0xf')]);router[_0x410c('0x10')](_0x410c('0xb'),auth[_0x410c('0x9')](),controller[_0x410c('0x11')]);module['exports']=router; \ No newline at end of file +var _0xe563=['../../components/interaction/service','../../config/environment','./intZendeskField.controller','isAuthenticated','get','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x23a673,_0x31e4bc){var _0x2213b7=function(_0x3c5dcc){while(--_0x3c5dcc){_0x23a673['push'](_0x23a673['shift']());}};_0x2213b7(++_0x31e4bc);}(_0xe563,0x125));var _0x3e56=function(_0x597797,_0x20976c){_0x597797=_0x597797-0x0;var _0x198e5f=_0xe563[_0x597797];return _0x198e5f;};'use strict';var multer=require(_0x3e56('0x0'));var util=require(_0x3e56('0x1'));var path=require(_0x3e56('0x2'));var timeout=require(_0x3e56('0x3'));var express=require(_0x3e56('0x4'));var router=express[_0x3e56('0x5')]();var auth=require(_0x3e56('0x6'));var interaction=require(_0x3e56('0x7'));var config=require(_0x3e56('0x8'));var controller=require(_0x3e56('0x9'));router['get']('/',auth[_0x3e56('0xa')](),controller['index']);router[_0x3e56('0xb')](_0x3e56('0xc'),auth[_0x3e56('0xa')](),controller[_0x3e56('0xd')]);router[_0x3e56('0xe')]('/',auth[_0x3e56('0xa')](),controller[_0x3e56('0xf')]);router[_0x3e56('0x10')](_0x3e56('0xc'),auth[_0x3e56('0xa')](),controller[_0x3e56('0x11')]);router['delete'](_0x3e56('0xc'),auth[_0x3e56('0xa')](),controller[_0x3e56('0x12')]);module[_0x3e56('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 050dbc0..75c7ac5 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 _0x8ce1=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x530bba,_0x5cd025){var _0x29c6db=function(_0x101796){while(--_0x101796){_0x530bba['push'](_0x530bba['shift']());}};_0x29c6db(++_0x5cd025);}(_0x8ce1,0x183));var _0x18ce=function(_0x38fcb5,_0x55b868){_0x38fcb5=_0x38fcb5-0x0;var _0x1e478c=_0x8ce1[_0x38fcb5];return _0x1e478c;};'use strict';var Sequelize=require(_0x18ce('0x0'));module[_0x18ce('0x1')]={'type':{'type':Sequelize[_0x18ce('0x2')](_0x18ce('0x3'),_0x18ce('0x4'),_0x18ce('0x5'),_0x18ce('0x6')),'defaultValue':_0x18ce('0x3')},'content':{'type':Sequelize[_0x18ce('0x7')]},'key':{'type':Sequelize[_0x18ce('0x7')]},'keyType':{'type':Sequelize[_0x18ce('0x2')](_0x18ce('0x3'),_0x18ce('0x4'),_0x18ce('0x5'))},'keyContent':{'type':Sequelize[_0x18ce('0x7')]},'idField':{'type':Sequelize[_0x18ce('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x18ce('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x18ce('0x7')]}}; \ No newline at end of file +var _0xe105=['BOOLEAN','sequelize','customVariable','keyValue','string','STRING','ENUM'];(function(_0x319e2e,_0x2f727f){var _0x302524=function(_0x5cad9d){while(--_0x5cad9d){_0x319e2e['push'](_0x319e2e['shift']());}};_0x302524(++_0x2f727f);}(_0xe105,0xef));var _0x5e10=function(_0x411cc2,_0xc8156f){_0x411cc2=_0x411cc2-0x0;var _0x5a0d59=_0xe105[_0x411cc2];return _0x5a0d59;};'use strict';var Sequelize=require(_0x5e10('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string','variable',_0x5e10('0x1'),_0x5e10('0x2')),'defaultValue':_0x5e10('0x3')},'content':{'type':Sequelize[_0x5e10('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x5e10('0x5')](_0x5e10('0x3'),'variable',_0x5e10('0x1'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x5e10('0x4')]},'customField':{'type':Sequelize[_0x5e10('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 7b19e2c..0bdd69f 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 _0x9ad0=['length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','update','body','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','stack','name','send','map','ZendeskField','rawAttributes','model','query','keys','filters','intersection','attributes','fields'];(function(_0x42508b,_0x693bd2){var _0x4739b6=function(_0x4cca9a){while(--_0x4cca9a){_0x42508b['push'](_0x42508b['shift']());}};_0x4739b6(++_0x693bd2);}(_0x9ad0,0xa8));var _0x09ad=function(_0x4bd9a9,_0x2fd838){_0x4bd9a9=_0x4bd9a9-0x0;var _0x2ee105=_0x9ad0[_0x4bd9a9];return _0x2ee105;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x09ad('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x09ad('0x1'));var rp=require(_0x09ad('0x2'));var moment=require('moment');var BPromise=require(_0x09ad('0x3'));var Mustache=require(_0x09ad('0x4'));var util=require(_0x09ad('0x5'));var path=require(_0x09ad('0x6'));var sox=require(_0x09ad('0x7'));var csv=require(_0x09ad('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x09ad('0x9'));var crypto=require(_0x09ad('0xa'));var jsforce=require(_0x09ad('0xb'));var deskjs=require(_0x09ad('0xc'));var toCsv=require('to-csv');var querystring=require(_0x09ad('0xd'));var Papa=require(_0x09ad('0xe'));var Redis=require(_0x09ad('0xf'));var authService=require(_0x09ad('0x10'));var qs=require(_0x09ad('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x09ad('0x12'));var logger=require(_0x09ad('0x13'))(_0x09ad('0x14'));var utils=require(_0x09ad('0x15'));var config=require(_0x09ad('0x16'));var db=require(_0x09ad('0x17'))['db'];function respondWithStatusCode(_0x5c7b27,_0x1b6df6){_0x1b6df6=_0x1b6df6||0xcc;return function(_0x5b377d){if(_0x5b377d){return _0x5c7b27[_0x09ad('0x18')](_0x1b6df6);}return _0x5c7b27[_0x09ad('0x19')](_0x1b6df6)[_0x09ad('0x1a')]();};}function respondWithResult(_0x3c7397,_0x5be2ca){_0x5be2ca=_0x5be2ca||0xc8;return function(_0x1608e5){if(_0x1608e5){return _0x3c7397[_0x09ad('0x19')](_0x5be2ca)['json'](_0x1608e5);}};}function respondWithFilteredResult(_0x535c1a,_0xb9b0e6){return function(_0x20cc6c){if(_0x20cc6c){var _0x4d17c5=_0x20cc6c[_0x09ad('0x1b')],_0x296395=_0xb9b0e6[_0x09ad('0x1c')],_0x18d551=_0xb9b0e6[_0x09ad('0x1c')]+_0xb9b0e6[_0x09ad('0x1d')],_0x1c405c;if(_0x18d551>=_0x4d17c5){_0x18d551=_0x4d17c5;_0x1c405c=0xc8;}else{_0x1c405c=0xce;}_0x535c1a[_0x09ad('0x19')](_0x1c405c);return _0x535c1a[_0x09ad('0x1e')](_0x09ad('0x1f'),_0x296395+'-'+_0x18d551+'/'+_0x4d17c5)[_0x09ad('0x20')](_0x20cc6c);}return null;};}function patchUpdates(_0x494098){return function(_0x5395d9){try{jsonpatch[_0x09ad('0x21')](_0x5395d9,_0x494098,!![]);}catch(_0xacb9b9){return BPromise[_0x09ad('0x22')](_0xacb9b9);}return _0x5395d9[_0x09ad('0x23')]();};}function saveUpdates(_0x47d403,_0xe380bf){return function(_0x2ca746){if(_0x2ca746){return _0x2ca746['update'](_0x47d403)[_0x09ad('0x24')](function(_0xcd774c){return _0xcd774c;});}return null;};}function removeEntity(_0x3f35d9,_0x3acaa5){return function(_0x353397){if(_0x353397){return _0x353397[_0x09ad('0x25')]()[_0x09ad('0x24')](function(){_0x3f35d9[_0x09ad('0x19')](0xcc)[_0x09ad('0x1a')]();});}};}function handleEntityNotFound(_0x1dcf20,_0x39f33d){return function(_0x2bb1f9){if(!_0x2bb1f9){_0x1dcf20[_0x09ad('0x18')](0x194);}return _0x2bb1f9;};}function handleError(_0x5e5098,_0x9323e){_0x9323e=_0x9323e||0x1f4;return function(_0x100455){logger['error'](_0x100455[_0x09ad('0x26')]);if(_0x100455['name']){delete _0x100455[_0x09ad('0x27')];}_0x5e5098[_0x09ad('0x19')](_0x9323e)[_0x09ad('0x28')](_0x100455);};}exports['index']=function(_0x28a32f,_0x4000b5){var _0x3968bf={},_0x51921b={},_0x359643={'count':0x0,'rows':[]};var _0x2a6aa4=_[_0x09ad('0x29')](db[_0x09ad('0x2a')][_0x09ad('0x2b')],function(_0x507708){return{'name':_0x507708['fieldName'],'type':_0x507708['type']['key']};});_0x51921b[_0x09ad('0x2c')]=_['map'](_0x2a6aa4,_0x09ad('0x27'));_0x51921b[_0x09ad('0x2d')]=_[_0x09ad('0x2e')](_0x28a32f[_0x09ad('0x2d')]);_0x51921b[_0x09ad('0x2f')]=_[_0x09ad('0x30')](_0x51921b[_0x09ad('0x2c')],_0x51921b[_0x09ad('0x2d')]);_0x3968bf[_0x09ad('0x31')]=_['intersection'](_0x51921b[_0x09ad('0x2c')],qs[_0x09ad('0x32')](_0x28a32f['query'][_0x09ad('0x32')]));_0x3968bf[_0x09ad('0x31')]=_0x3968bf[_0x09ad('0x31')][_0x09ad('0x33')]?_0x3968bf['attributes']:_0x51921b['model'];if(!_0x28a32f[_0x09ad('0x2d')][_0x09ad('0x34')](_0x09ad('0x35'))){_0x3968bf['limit']=qs['limit'](_0x28a32f[_0x09ad('0x2d')][_0x09ad('0x1d')]);_0x3968bf[_0x09ad('0x1c')]=qs['offset'](_0x28a32f[_0x09ad('0x2d')][_0x09ad('0x1c')]);}_0x3968bf[_0x09ad('0x36')]=qs[_0x09ad('0x37')](_0x28a32f[_0x09ad('0x2d')][_0x09ad('0x37')]);_0x3968bf['where']=qs[_0x09ad('0x2f')](_[_0x09ad('0x38')](_0x28a32f['query'],_0x51921b[_0x09ad('0x2f')]));if(_0x28a32f[_0x09ad('0x2d')][_0x09ad('0x39')]){_0x3968bf[_0x09ad('0x3a')]=_[_0x09ad('0x3b')](_0x3968bf[_0x09ad('0x3a')],{'$or':_['map'](_0x2a6aa4,function(_0x4cc4f6){if(_0x4cc4f6[_0x09ad('0x3c')]!==_0x09ad('0x3d')){var _0xc1c16f={};_0xc1c16f[_0x4cc4f6[_0x09ad('0x27')]]={'$like':'%'+_0x28a32f[_0x09ad('0x2d')]['filter']+'%'};return _0xc1c16f;}})});}_0x3968bf=_['merge']({},_0x3968bf,_0x28a32f[_0x09ad('0x3e')]);var _0x195e63={'where':_0x3968bf[_0x09ad('0x3a')]};return db['ZendeskField']['count'](_0x195e63)['then'](function(_0x41a199){_0x359643[_0x09ad('0x1b')]=_0x41a199;if(_0x28a32f['query'][_0x09ad('0x3f')]){_0x3968bf[_0x09ad('0x40')]=[{'all':!![]}];}return db['ZendeskField'][_0x09ad('0x41')](_0x3968bf);})[_0x09ad('0x24')](function(_0x237b46){_0x359643[_0x09ad('0x42')]=_0x237b46;return _0x359643;})[_0x09ad('0x24')](respondWithFilteredResult(_0x4000b5,_0x3968bf))[_0x09ad('0x43')](handleError(_0x4000b5,null));};exports[_0x09ad('0x44')]=function(_0x124897,_0x42977d){var _0x2c61b9={'raw':!![],'where':{'id':_0x124897[_0x09ad('0x45')]['id']}},_0xe7c6e={};_0xe7c6e[_0x09ad('0x2c')]=_[_0x09ad('0x2e')](db[_0x09ad('0x2a')][_0x09ad('0x2b')]);_0xe7c6e['query']=_[_0x09ad('0x2e')](_0x124897[_0x09ad('0x2d')]);_0xe7c6e[_0x09ad('0x2f')]=_[_0x09ad('0x30')](_0xe7c6e[_0x09ad('0x2c')],_0xe7c6e['query']);_0x2c61b9[_0x09ad('0x31')]=_['intersection'](_0xe7c6e[_0x09ad('0x2c')],qs['fields'](_0x124897[_0x09ad('0x2d')]['fields']));_0x2c61b9[_0x09ad('0x31')]=_0x2c61b9[_0x09ad('0x31')]['length']?_0x2c61b9['attributes']:_0xe7c6e[_0x09ad('0x2c')];if(_0x124897[_0x09ad('0x2d')][_0x09ad('0x3f')]){_0x2c61b9['include']=[{'all':!![]}];}_0x2c61b9=_[_0x09ad('0x3b')]({},_0x2c61b9,_0x124897[_0x09ad('0x3e')]);return db[_0x09ad('0x2a')][_0x09ad('0x46')](_0x2c61b9)[_0x09ad('0x24')](handleEntityNotFound(_0x42977d,null))[_0x09ad('0x24')](respondWithResult(_0x42977d,null))[_0x09ad('0x43')](handleError(_0x42977d,null));};exports['create']=function(_0x571d83,_0x34490a){return db[_0x09ad('0x2a')]['create'](_0x571d83['body'],{})[_0x09ad('0x24')](respondWithResult(_0x34490a,0xc9))['catch'](handleError(_0x34490a,null));};exports[_0x09ad('0x47')]=function(_0x372f08,_0x48706f){if(_0x372f08[_0x09ad('0x48')]['id']){delete _0x372f08[_0x09ad('0x48')]['id'];}return db[_0x09ad('0x2a')][_0x09ad('0x46')]({'where':{'id':_0x372f08['params']['id']}})[_0x09ad('0x24')](handleEntityNotFound(_0x48706f,null))['then'](saveUpdates(_0x372f08[_0x09ad('0x48')],null))[_0x09ad('0x24')](respondWithResult(_0x48706f,null))[_0x09ad('0x43')](handleError(_0x48706f,null));};exports[_0x09ad('0x25')]=function(_0x5b5840,_0x77f689){return db[_0x09ad('0x2a')][_0x09ad('0x46')]({'where':{'id':_0x5b5840[_0x09ad('0x45')]['id']}})[_0x09ad('0x24')](handleEntityNotFound(_0x77f689,null))[_0x09ad('0x24')](removeEntity(_0x77f689,null))[_0x09ad('0x43')](handleError(_0x77f689,null));}; \ No newline at end of file +var _0x49b2=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','then','destroy','stack','name','send','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','count','includeAll','include','ZendeskField','findAll','rows','catch','params','fields','create','body','update','find','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x49b2,0x110));var _0x249b=function(_0x2533c9,_0x4450c9){_0x2533c9=_0x2533c9-0x0;var _0x3dcff4=_0x49b2[_0x2533c9];return _0x3dcff4;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x249b('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x249b('0x1'));var moment=require(_0x249b('0x2'));var BPromise=require(_0x249b('0x3'));var Mustache=require(_0x249b('0x4'));var util=require(_0x249b('0x5'));var path=require(_0x249b('0x6'));var sox=require(_0x249b('0x7'));var csv=require(_0x249b('0x8'));var ejs=require(_0x249b('0x9'));var fs=require('fs');var _=require(_0x249b('0xa'));var squel=require('squel');var crypto=require(_0x249b('0xb'));var jsforce=require(_0x249b('0xc'));var deskjs=require(_0x249b('0xd'));var toCsv=require(_0x249b('0x8'));var querystring=require(_0x249b('0xe'));var Papa=require(_0x249b('0xf'));var Redis=require(_0x249b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x249b('0x11'));var as=require(_0x249b('0x12'));var hardwareService=require(_0x249b('0x13'));var logger=require(_0x249b('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x249b('0x15'));var db=require(_0x249b('0x16'))['db'];function respondWithStatusCode(_0xe808b0,_0x424d6a){_0x424d6a=_0x424d6a||0xcc;return function(_0x4c03fc){if(_0x4c03fc){return _0xe808b0[_0x249b('0x17')](_0x424d6a);}return _0xe808b0[_0x249b('0x18')](_0x424d6a)[_0x249b('0x19')]();};}function respondWithResult(_0x596fdc,_0x52567b){_0x52567b=_0x52567b||0xc8;return function(_0x1079a0){if(_0x1079a0){return _0x596fdc['status'](_0x52567b)[_0x249b('0x1a')](_0x1079a0);}};}function respondWithFilteredResult(_0x2f3221,_0x4b0a4c){return function(_0x5c9837){if(_0x5c9837){var _0x58f232=_0x5c9837['count'],_0x57ad3d=_0x4b0a4c[_0x249b('0x1b')],_0x3e1682=_0x4b0a4c[_0x249b('0x1b')]+_0x4b0a4c[_0x249b('0x1c')],_0x1354d8;if(_0x3e1682>=_0x58f232){_0x3e1682=_0x58f232;_0x1354d8=0xc8;}else{_0x1354d8=0xce;}_0x2f3221[_0x249b('0x18')](_0x1354d8);return _0x2f3221[_0x249b('0x1d')](_0x249b('0x1e'),_0x57ad3d+'-'+_0x3e1682+'/'+_0x58f232)[_0x249b('0x1a')](_0x5c9837);}return null;};}function patchUpdates(_0x45738d){return function(_0x5934f1){try{jsonpatch[_0x249b('0x1f')](_0x5934f1,_0x45738d,!![]);}catch(_0x1c4838){return BPromise[_0x249b('0x20')](_0x1c4838);}return _0x5934f1['save']();};}function saveUpdates(_0x2005e0,_0x1e3696){return function(_0x650a01){if(_0x650a01){return _0x650a01['update'](_0x2005e0)[_0x249b('0x21')](function(_0x561ace){return _0x561ace;});}return null;};}function removeEntity(_0x237113,_0x1f4a90){return function(_0x475b25){if(_0x475b25){return _0x475b25[_0x249b('0x22')]()['then'](function(){_0x237113[_0x249b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18b9de,_0x384a5d){return function(_0x58c649){if(!_0x58c649){_0x18b9de[_0x249b('0x17')](0x194);}return _0x58c649;};}function handleError(_0x9f17fe,_0x5261e8){_0x5261e8=_0x5261e8||0x1f4;return function(_0xfbf10d){logger['error'](_0xfbf10d[_0x249b('0x23')]);if(_0xfbf10d[_0x249b('0x24')]){delete _0xfbf10d[_0x249b('0x24')];}_0x9f17fe[_0x249b('0x18')](_0x5261e8)[_0x249b('0x25')](_0xfbf10d);};}exports['index']=function(_0x226545,_0x487001){var _0x34b21c={},_0x49a1ab={},_0x478f01={'count':0x0,'rows':[]};var _0x2176f6=_['map'](db['ZendeskField'][_0x249b('0x26')],function(_0x4a8204){return{'name':_0x4a8204[_0x249b('0x27')],'type':_0x4a8204[_0x249b('0x28')]['key']};});_0x49a1ab[_0x249b('0x29')]=_['map'](_0x2176f6,_0x249b('0x24'));_0x49a1ab[_0x249b('0x2a')]=_[_0x249b('0x2b')](_0x226545[_0x249b('0x2a')]);_0x49a1ab['filters']=_[_0x249b('0x2c')](_0x49a1ab[_0x249b('0x29')],_0x49a1ab['query']);_0x34b21c['attributes']=_[_0x249b('0x2c')](_0x49a1ab['model'],qs['fields'](_0x226545[_0x249b('0x2a')]['fields']));_0x34b21c[_0x249b('0x2d')]=_0x34b21c['attributes'][_0x249b('0x2e')]?_0x34b21c[_0x249b('0x2d')]:_0x49a1ab[_0x249b('0x29')];if(!_0x226545[_0x249b('0x2a')]['hasOwnProperty'](_0x249b('0x2f'))){_0x34b21c[_0x249b('0x1c')]=qs[_0x249b('0x1c')](_0x226545[_0x249b('0x2a')][_0x249b('0x1c')]);_0x34b21c[_0x249b('0x1b')]=qs[_0x249b('0x1b')](_0x226545[_0x249b('0x2a')]['offset']);}_0x34b21c[_0x249b('0x30')]=qs[_0x249b('0x31')](_0x226545[_0x249b('0x2a')][_0x249b('0x31')]);_0x34b21c[_0x249b('0x32')]=qs[_0x249b('0x33')](_[_0x249b('0x34')](_0x226545['query'],_0x49a1ab[_0x249b('0x33')]));if(_0x226545[_0x249b('0x2a')][_0x249b('0x35')]){_0x34b21c[_0x249b('0x32')]=_[_0x249b('0x36')](_0x34b21c['where'],{'$or':_[_0x249b('0x37')](_0x2176f6,function(_0x205e73){if(_0x205e73[_0x249b('0x28')]!==_0x249b('0x38')){var _0xe5c136={};_0xe5c136[_0x205e73[_0x249b('0x24')]]={'$like':'%'+_0x226545[_0x249b('0x2a')][_0x249b('0x35')]+'%'};return _0xe5c136;}})});}_0x34b21c=_[_0x249b('0x36')]({},_0x34b21c,_0x226545[_0x249b('0x39')]);var _0x41f348={'where':_0x34b21c[_0x249b('0x32')]};return db['ZendeskField'][_0x249b('0x3a')](_0x41f348)['then'](function(_0x2c4e64){_0x478f01[_0x249b('0x3a')]=_0x2c4e64;if(_0x226545[_0x249b('0x2a')][_0x249b('0x3b')]){_0x34b21c[_0x249b('0x3c')]=[{'all':!![]}];}return db[_0x249b('0x3d')][_0x249b('0x3e')](_0x34b21c);})[_0x249b('0x21')](function(_0x1609ca){_0x478f01[_0x249b('0x3f')]=_0x1609ca;return _0x478f01;})['then'](respondWithFilteredResult(_0x487001,_0x34b21c))[_0x249b('0x40')](handleError(_0x487001,null));};exports['show']=function(_0x2ba103,_0x598d04){var _0x1e4b7e={'raw':!![],'where':{'id':_0x2ba103[_0x249b('0x41')]['id']}},_0x23d393={};_0x23d393[_0x249b('0x29')]=_[_0x249b('0x2b')](db[_0x249b('0x3d')][_0x249b('0x26')]);_0x23d393[_0x249b('0x2a')]=_[_0x249b('0x2b')](_0x2ba103['query']);_0x23d393[_0x249b('0x33')]=_[_0x249b('0x2c')](_0x23d393[_0x249b('0x29')],_0x23d393[_0x249b('0x2a')]);_0x1e4b7e['attributes']=_[_0x249b('0x2c')](_0x23d393[_0x249b('0x29')],qs[_0x249b('0x42')](_0x2ba103[_0x249b('0x2a')]['fields']));_0x1e4b7e[_0x249b('0x2d')]=_0x1e4b7e[_0x249b('0x2d')][_0x249b('0x2e')]?_0x1e4b7e['attributes']:_0x23d393['model'];if(_0x2ba103[_0x249b('0x2a')][_0x249b('0x3b')]){_0x1e4b7e[_0x249b('0x3c')]=[{'all':!![]}];}_0x1e4b7e=_[_0x249b('0x36')]({},_0x1e4b7e,_0x2ba103[_0x249b('0x39')]);return db[_0x249b('0x3d')]['find'](_0x1e4b7e)[_0x249b('0x21')](handleEntityNotFound(_0x598d04,null))[_0x249b('0x21')](respondWithResult(_0x598d04,null))['catch'](handleError(_0x598d04,null));};exports[_0x249b('0x43')]=function(_0x33c702,_0x4f0569){return db['ZendeskField'][_0x249b('0x43')](_0x33c702[_0x249b('0x44')],{})['then'](respondWithResult(_0x4f0569,0xc9))[_0x249b('0x40')](handleError(_0x4f0569,null));};exports[_0x249b('0x45')]=function(_0x4e7d58,_0x70658f){if(_0x4e7d58[_0x249b('0x44')]['id']){delete _0x4e7d58[_0x249b('0x44')]['id'];}return db[_0x249b('0x3d')][_0x249b('0x46')]({'where':{'id':_0x4e7d58[_0x249b('0x41')]['id']}})[_0x249b('0x21')](handleEntityNotFound(_0x70658f,null))[_0x249b('0x21')](saveUpdates(_0x4e7d58[_0x249b('0x44')],null))[_0x249b('0x21')](respondWithResult(_0x70658f,null))[_0x249b('0x40')](handleError(_0x70658f,null));};exports[_0x249b('0x22')]=function(_0x6c057d,_0x1c8cec){return db[_0x249b('0x3d')][_0x249b('0x46')]({'where':{'id':_0x6c057d[_0x249b('0x41')]['id']}})[_0x249b('0x21')](handleEntityNotFound(_0x1c8cec,null))[_0x249b('0x21')](removeEntity(_0x1c8cec,null))['catch'](handleError(_0x1c8cec,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index d57740c..af3d2db 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 _0xdfe9=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','zendesk_unique_index','idField','FieldId','lodash'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xdfe9,0xc3));var _0x9dfe=function(_0xe79381,_0x1619c3){_0xe79381=_0xe79381-0x0;var _0x59e28d=_0xdfe9[_0xe79381];return _0x59e28d;};'use strict';var _=require(_0x9dfe('0x0'));var util=require('util');var logger=require(_0x9dfe('0x1'))('api');var moment=require('moment');var BPromise=require(_0x9dfe('0x2'));var rp=require(_0x9dfe('0x3'));var fs=require('fs');var path=require(_0x9dfe('0x4'));var rimraf=require(_0x9dfe('0x5'));var config=require(_0x9dfe('0x6'));var attributes=require(_0x9dfe('0x7'));module[_0x9dfe('0x8')]=function(_0x3678b1,_0x2b0d0b){return _0x3678b1[_0x9dfe('0x9')](_0x9dfe('0xa'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x9dfe('0xb'),'fields':[_0x9dfe('0xc'),_0x9dfe('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9861=['api','moment','bluebird','request-promise','path','rimraf','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash'];(function(_0x1fa9fd,_0x38fff0){var _0x22f0ef=function(_0x33719e){while(--_0x33719e){_0x1fa9fd['push'](_0x1fa9fd['shift']());}};_0x22f0ef(++_0x38fff0);}(_0x9861,0x176));var _0x1986=function(_0x127933,_0x4e880f){_0x127933=_0x127933-0x0;var _0x1d6f84=_0x9861[_0x127933];return _0x1d6f84;};'use strict';var _=require(_0x1986('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1986('0x1'));var moment=require(_0x1986('0x2'));var BPromise=require(_0x1986('0x3'));var rp=require(_0x1986('0x4'));var fs=require('fs');var path=require(_0x1986('0x5'));var rimraf=require(_0x1986('0x6'));var config=require('../../config/environment');var attributes=require(_0x1986('0x7'));module[_0x1986('0x8')]=function(_0x1b56d6,_0x17ccbf){return _0x1b56d6[_0x1986('0x9')](_0x1986('0xa'),attributes,{'tableName':_0x1986('0xb'),'paranoid':![],'indexes':[{'name':_0x1986('0xc'),'fields':[_0x1986('0xd'),_0x1986('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 93e2f97..c8edd07 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 _0xb257=['../../config/environment','jayson/promise','client','http','request','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','../../config/utils','../../config/logger','rpc'];(function(_0x50e593,_0x3ae998){var _0x3821d0=function(_0x53c295){while(--_0x53c295){_0x50e593['push'](_0x50e593['shift']());}};_0x3821d0(++_0x3ae998);}(_0xb257,0x14f));var _0x7b25=function(_0x39921b,_0x2f1321){_0x39921b=_0x39921b-0x0;var _0x2b7f18=_0xb257[_0x39921b];return _0x2b7f18;};'use strict';var _=require(_0x7b25('0x0'));var util=require(_0x7b25('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7b25('0x2'));var logger=require(_0x7b25('0x3'))(_0x7b25('0x4'));var config=require(_0x7b25('0x5'));var jayson=require(_0x7b25('0x6'));var client=jayson[_0x7b25('0x7')][_0x7b25('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1f758e,_0x45587e,_0x59e116){return new BPromise(function(_0x39fc29,_0xde8faa){return client[_0x7b25('0x9')](_0x1f758e,_0x59e116)['then'](function(_0x283f83){logger[_0x7b25('0xa')](_0x7b25('0xb'),_0x45587e,_0x7b25('0xc'));logger[_0x7b25('0xd')](_0x7b25('0xe'),_0x45587e,'request\x20sent',JSON['stringify'](_0x283f83));if(_0x283f83[_0x7b25('0xf')]){if(_0x283f83['error'][_0x7b25('0x10')]===0x1f4){logger['error'](_0x7b25('0xb'),_0x45587e,_0x283f83[_0x7b25('0xf')][_0x7b25('0x11')]);return _0xde8faa(_0x283f83[_0x7b25('0xf')]['message']);}logger[_0x7b25('0xf')](_0x7b25('0xb'),_0x45587e,_0x283f83['error'][_0x7b25('0x11')]);return _0x39fc29(_0x283f83[_0x7b25('0xf')][_0x7b25('0x11')]);}else{logger[_0x7b25('0xa')](_0x7b25('0xb'),_0x45587e,_0x7b25('0xc'));_0x39fc29(_0x283f83[_0x7b25('0x12')]['message']);}})[_0x7b25('0x13')](function(_0x3145a4){logger[_0x7b25('0xf')](_0x7b25('0xb'),_0x45587e,_0x3145a4);_0xde8faa(_0x3145a4);});});} \ No newline at end of file +var _0x81b5=['request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','message','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s'];(function(_0x300dd7,_0xb6ac19){var _0x6e18f1=function(_0x172c76){while(--_0x172c76){_0x300dd7['push'](_0x300dd7['shift']());}};_0x6e18f1(++_0xb6ac19);}(_0x81b5,0x17c));var _0x581b=function(_0xd4ea39,_0x267244){_0xd4ea39=_0xd4ea39-0x0;var _0x281e37=_0x81b5[_0xd4ea39];return _0x281e37;};'use strict';var _=require('lodash');var util=require(_0x581b('0x0'));var moment=require('moment');var BPromise=require(_0x581b('0x1'));var rs=require(_0x581b('0x2'));var fs=require('fs');var Redis=require(_0x581b('0x3'));var db=require(_0x581b('0x4'))['db'];var utils=require(_0x581b('0x5'));var logger=require(_0x581b('0x6'))(_0x581b('0x7'));var config=require(_0x581b('0x8'));var jayson=require(_0x581b('0x9'));var client=jayson[_0x581b('0xa')][_0x581b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x85d8da,_0x3e0b67,_0x53c532){return new BPromise(function(_0x3c9dbc,_0x14cd4b){return client[_0x581b('0xc')](_0x85d8da,_0x53c532)[_0x581b('0xd')](function(_0x10e821){logger[_0x581b('0xe')](_0x581b('0xf'),_0x3e0b67,_0x581b('0x10'));logger[_0x581b('0x11')](_0x581b('0x12'),_0x3e0b67,_0x581b('0x10'),JSON['stringify'](_0x10e821));if(_0x10e821[_0x581b('0x13')]){if(_0x10e821[_0x581b('0x13')]['code']===0x1f4){logger['error'](_0x581b('0xf'),_0x3e0b67,_0x10e821[_0x581b('0x13')]['message']);return _0x14cd4b(_0x10e821[_0x581b('0x13')][_0x581b('0x14')]);}logger['error']('ZendeskField,\x20%s,\x20%s',_0x3e0b67,_0x10e821[_0x581b('0x13')][_0x581b('0x14')]);return _0x3c9dbc(_0x10e821[_0x581b('0x13')][_0x581b('0x14')]);}else{logger[_0x581b('0xe')](_0x581b('0xf'),_0x3e0b67,_0x581b('0x10'));_0x3c9dbc(_0x10e821[_0x581b('0x15')][_0x581b('0x14')]);}})['catch'](function(_0x95d68f){logger[_0x581b('0x13')](_0x581b('0xf'),_0x3e0b67,_0x95d68f);_0x14cd4b(_0x95d68f);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index c96712a..a780722 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 _0x27c9=['./intZohoAccount.controller','index','get','/:id','isAuthenticated','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer','connect-timeout','express','../../components/interaction/service','../../config/environment'];(function(_0x409deb,_0x2b731){var _0x15a4f7=function(_0x556510){while(--_0x556510){_0x409deb['push'](_0x409deb['shift']());}};_0x15a4f7(++_0x2b731);}(_0x27c9,0xcd));var _0x927c=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x27c9[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x927c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x927c('0x1'));var express=require(_0x927c('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x927c('0x3'));var config=require(_0x927c('0x4'));var controller=require(_0x927c('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x927c('0x6')]);router[_0x927c('0x7')](_0x927c('0x8'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/configurations',auth[_0x927c('0x9')](),controller['getConfigurations']);router[_0x927c('0x7')](_0x927c('0xa'),auth[_0x927c('0x9')](),controller[_0x927c('0xb')]);router[_0x927c('0xc')]('/',auth[_0x927c('0x9')](),controller[_0x927c('0xd')]);router['post'](_0x927c('0xe'),auth[_0x927c('0x9')](),controller[_0x927c('0xf')]);router[_0x927c('0x10')](_0x927c('0x8'),auth[_0x927c('0x9')](),controller[_0x927c('0x11')]);router[_0x927c('0x12')](_0x927c('0x8'),auth[_0x927c('0x9')](),controller[_0x927c('0x13')]);module[_0x927c('0x14')]=router; \ No newline at end of file +var _0x6ece=['getFields','create','post','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./intZohoAccount.controller','index','get','/:id','isAuthenticated','/:id/fields'];(function(_0xd01157,_0x5bb2da){var _0x54974b=function(_0x584ff0){while(--_0x584ff0){_0xd01157['push'](_0xd01157['shift']());}};_0x54974b(++_0x5bb2da);}(_0x6ece,0x94));var _0xe6ec=function(_0x38d5ad,_0x6523f0){_0x38d5ad=_0x38d5ad-0x0;var _0x1826eb=_0x6ece[_0x38d5ad];return _0x1826eb;};'use strict';var multer=require(_0xe6ec('0x0'));var util=require(_0xe6ec('0x1'));var path=require(_0xe6ec('0x2'));var timeout=require(_0xe6ec('0x3'));var express=require(_0xe6ec('0x4'));var router=express[_0xe6ec('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xe6ec('0x6'));var config=require('../../config/environment');var controller=require(_0xe6ec('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xe6ec('0x8')]);router[_0xe6ec('0x9')](_0xe6ec('0xa'),auth[_0xe6ec('0xb')](),controller['show']);router[_0xe6ec('0x9')]('/:id/configurations',auth[_0xe6ec('0xb')](),controller['getConfigurations']);router[_0xe6ec('0x9')](_0xe6ec('0xc'),auth[_0xe6ec('0xb')](),controller[_0xe6ec('0xd')]);router['post']('/',auth[_0xe6ec('0xb')](),controller[_0xe6ec('0xe')]);router[_0xe6ec('0xf')](_0xe6ec('0x10'),auth[_0xe6ec('0xb')](),controller[_0xe6ec('0x11')]);router[_0xe6ec('0x12')](_0xe6ec('0xa'),auth[_0xe6ec('0xb')](),controller[_0xe6ec('0x13')]);router[_0xe6ec('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xe6ec('0x15')]);module[_0xe6ec('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index d7f0794..6fc0ed6 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 _0xe3bd=['exports','STRING','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe3bd,0xaa));var _0xde3b=function(_0x562f3b,_0x4c65ae){_0x562f3b=_0x562f3b-0x0;var _0x1edd55=_0xe3bd[_0x562f3b];return _0x1edd55;};'use strict';var Sequelize=require(_0xde3b('0x0'));module[_0xde3b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xde3b('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0xde3b('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xde3b('0x2')]},'serverUrl':{'type':Sequelize[_0xde3b('0x2')]},'code':{'type':Sequelize[_0xde3b('0x2')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5669=['exports','STRING'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x5669,0xc6));var _0x9566=function(_0x3c2576,_0x10994b){_0x3c2576=_0x3c2576-0x0;var _0x3435d0=_0x5669[_0x3c2576];return _0x3435d0;};'use strict';var Sequelize=require('sequelize');module[_0x9566('0x0')]={'name':{'type':Sequelize[_0x9566('0x1')]},'description':{'type':Sequelize[_0x9566('0x1')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x9566('0x1')]},'clientId':{'type':Sequelize[_0x9566('0x1')]},'clientSecret':{'type':Sequelize[_0x9566('0x1')]},'serverUrl':{'type':Sequelize['STRING']},'code':{'type':Sequelize[_0x9566('0x1')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index c296ab8..55159df 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 _0x82e0=['getConfigurations','nolimit','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoConfiguration','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','host','serverUrl','com','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','Subject','WhoId','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','getFields','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','sendStatus','end','json','count','offset','status','Content-Range','apply','save','update','destroy','stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','limit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','findOne','length','order'];(function(_0x250c9b,_0x4b8cc8){var _0xc09774=function(_0x5117d2){while(--_0x5117d2){_0x250c9b['push'](_0x250c9b['shift']());}};_0xc09774(++_0x4b8cc8);}(_0x82e0,0xb5));var _0x082e=function(_0x43304b,_0x5ec697){_0x43304b=_0x43304b-0x0;var _0xe2f997=_0x82e0[_0x43304b];return _0xe2f997;};'use strict';var pdf=require(_0x082e('0x0'));var emlformat=require(_0x082e('0x1'));var rimraf=require(_0x082e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x082e('0x3'));var rp=require(_0x082e('0x4'));var moment=require(_0x082e('0x5'));var BPromise=require(_0x082e('0x6'));var Mustache=require(_0x082e('0x7'));var util=require('util');var path=require(_0x082e('0x8'));var sox=require(_0x082e('0x9'));var csv=require(_0x082e('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x082e('0xb'));var squel=require(_0x082e('0xc'));var crypto=require('crypto');var jsforce=require(_0x082e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x082e('0xa'));var querystring=require(_0x082e('0xe'));var Papa=require(_0x082e('0xf'));var Redis=require(_0x082e('0x10'));var authService=require(_0x082e('0x11'));var qs=require(_0x082e('0x12'));var as=require(_0x082e('0x13'));var hardwareService=require(_0x082e('0x14'));var logger=require('../../config/logger')(_0x082e('0x15'));var utils=require('../../config/utils');var config=require(_0x082e('0x16'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x082e('0x17'));var client=jayson[_0x082e('0x18')][_0x082e('0x19')]({'port':0x232a});function checkPasswordPattern(_0x11c16e,_0x53bf8c,_0x185917){if(_0x185917){var _0x34c525=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x34c525[_0x082e('0x1a')](_0x53bf8c)){return _0x11c16e;}else{throw new db[(_0x082e('0x1b'))][(_0x082e('0x1c'))](_0x082e('0x1d'));}}else{return _0x11c16e;}}function respondWithRpcPromise(_0x395c10,_0x2ee940,_0x492389,_0xa365c){return new BPromise(function(_0xc54410,_0x3f31e0){var _0x1f6f61=_0xa365c||client;return _0x1f6f61[_0x082e('0x1e')](_0x395c10,_0x492389)[_0x082e('0x1f')](function(_0x5a4a91){logger[_0x082e('0x20')]('ZohoAccount,\x20%s,\x20%s',_0x2ee940,_0x082e('0x21'));logger[_0x082e('0x22')](_0x082e('0x23'),_0x2ee940,_0x082e('0x21'),JSON[_0x082e('0x24')](_0x5a4a91));if(_0x5a4a91[_0x082e('0x25')]){if(_0x5a4a91[_0x082e('0x25')][_0x082e('0x26')]===0x1f4){logger[_0x082e('0x25')](_0x082e('0x27'),_0x2ee940,_0x5a4a91['error'][_0x082e('0x28')]);return _0x3f31e0(_0x5a4a91['error'][_0x082e('0x28')]);}logger[_0x082e('0x25')](_0x082e('0x27'),_0x2ee940,_0x5a4a91[_0x082e('0x25')][_0x082e('0x28')]);return _0xc54410(_0x5a4a91['error'][_0x082e('0x28')]);}else{logger[_0x082e('0x20')](_0x082e('0x27'),_0x2ee940,_0x082e('0x21'));_0xc54410(_0x5a4a91['result'][_0x082e('0x28')]);}})['catch'](function(_0xd95936){logger[_0x082e('0x25')]('ZohoAccount,\x20%s,\x20%s',_0x2ee940,_0xd95936);_0x3f31e0(_0xd95936);});});}function respondWithStatusCode(_0x55735f,_0x252478){_0x252478=_0x252478||0xcc;return function(_0x4b878e){if(_0x4b878e){return _0x55735f[_0x082e('0x29')](_0x252478);}return _0x55735f['status'](_0x252478)[_0x082e('0x2a')]();};}function respondWithResult(_0x1e80aa,_0x44b9f5){_0x44b9f5=_0x44b9f5||0xc8;return function(_0x10cdd6){if(_0x10cdd6){return _0x1e80aa['status'](_0x44b9f5)[_0x082e('0x2b')](_0x10cdd6);}};}function respondWithFilteredResult(_0x7e292a,_0x5d12f0){return function(_0x4b091b){if(_0x4b091b){var _0x2d4b72=_0x4b091b[_0x082e('0x2c')],_0xf841b2=_0x5d12f0[_0x082e('0x2d')],_0x4bc707=_0x5d12f0[_0x082e('0x2d')]+_0x5d12f0['limit'],_0x189878;if(_0x4bc707>=_0x2d4b72){_0x4bc707=_0x2d4b72;_0x189878=0xc8;}else{_0x189878=0xce;}_0x7e292a[_0x082e('0x2e')](_0x189878);return _0x7e292a['set'](_0x082e('0x2f'),_0xf841b2+'-'+_0x4bc707+'/'+_0x2d4b72)[_0x082e('0x2b')](_0x4b091b);}return null;};}function patchUpdates(_0x5773a3){return function(_0x29bbc1){try{jsonpatch[_0x082e('0x30')](_0x29bbc1,_0x5773a3,!![]);}catch(_0x5a144e){return BPromise['reject'](_0x5a144e);}return _0x29bbc1[_0x082e('0x31')]();};}function saveUpdates(_0x356f41,_0x169bc2){return function(_0x4d0e26){if(_0x4d0e26){return _0x4d0e26[_0x082e('0x32')](_0x356f41)[_0x082e('0x1f')](function(_0x59a194){return _0x59a194;});}return null;};}function removeEntity(_0x1888c8,_0x4b6e1c){return function(_0x4d2014){if(_0x4d2014){return _0x4d2014[_0x082e('0x33')]()[_0x082e('0x1f')](function(){_0x1888c8[_0x082e('0x2e')](0xcc)[_0x082e('0x2a')]();});}};}function handleEntityNotFound(_0x22544f,_0x223c02){return function(_0x15ea0f){if(!_0x15ea0f){_0x22544f[_0x082e('0x29')](0x194);}return _0x15ea0f;};}function handleError(_0x591872,_0x2f9be1){_0x2f9be1=_0x2f9be1||0x1f4;return function(_0x733e2){logger[_0x082e('0x25')](_0x733e2[_0x082e('0x34')]);if(_0x733e2[_0x082e('0x35')]){delete _0x733e2[_0x082e('0x35')];}_0x591872[_0x082e('0x2e')](_0x2f9be1)[_0x082e('0x36')](_0x733e2);};}exports[_0x082e('0x37')]=function(_0x10b4ec,_0x31d3d5){var _0x4b2cc1={},_0x351697={},_0x51db15={'count':0x0,'rows':[]};var _0x3d73ac=_[_0x082e('0x38')](db[_0x082e('0x39')][_0x082e('0x3a')],function(_0x4c25fd){return{'name':_0x4c25fd[_0x082e('0x3b')],'type':_0x4c25fd[_0x082e('0x3c')][_0x082e('0x3d')]};});_0x351697[_0x082e('0x3e')]=_[_0x082e('0x38')](_0x3d73ac,_0x082e('0x35'));_0x351697[_0x082e('0x3f')]=_[_0x082e('0x40')](_0x10b4ec[_0x082e('0x3f')]);_0x351697[_0x082e('0x41')]=_[_0x082e('0x42')](_0x351697['model'],_0x351697['query']);_0x4b2cc1['attributes']=_['intersection'](_0x351697[_0x082e('0x3e')],qs[_0x082e('0x43')](_0x10b4ec[_0x082e('0x3f')][_0x082e('0x43')]));_0x4b2cc1[_0x082e('0x44')]=_0x4b2cc1[_0x082e('0x44')]['length']?_0x4b2cc1[_0x082e('0x44')]:_0x351697['model'];if(!_0x10b4ec[_0x082e('0x3f')][_0x082e('0x45')]('nolimit')){_0x4b2cc1[_0x082e('0x46')]=qs[_0x082e('0x46')](_0x10b4ec['query'][_0x082e('0x46')]);_0x4b2cc1[_0x082e('0x2d')]=qs[_0x082e('0x2d')](_0x10b4ec[_0x082e('0x3f')][_0x082e('0x2d')]);}_0x4b2cc1['order']=qs[_0x082e('0x47')](_0x10b4ec['query'][_0x082e('0x47')]);_0x4b2cc1['where']=qs['filters'](_[_0x082e('0x48')](_0x10b4ec[_0x082e('0x3f')],_0x351697['filters']));if(_0x10b4ec[_0x082e('0x3f')][_0x082e('0x49')]){_0x4b2cc1[_0x082e('0x4a')]=_[_0x082e('0x4b')](_0x4b2cc1['where'],{'$or':_[_0x082e('0x38')](_0x3d73ac,function(_0x14529f){if(_0x14529f[_0x082e('0x3c')]!==_0x082e('0x4c')){var _0x58aee0={};_0x58aee0[_0x14529f[_0x082e('0x35')]]={'$like':'%'+_0x10b4ec[_0x082e('0x3f')][_0x082e('0x49')]+'%'};return _0x58aee0;}})});}_0x4b2cc1=_[_0x082e('0x4b')]({},_0x4b2cc1,_0x10b4ec[_0x082e('0x4d')]);var _0x124d99={'where':_0x4b2cc1[_0x082e('0x4a')]};return db[_0x082e('0x39')][_0x082e('0x2c')](_0x124d99)['then'](function(_0x42c686){_0x51db15[_0x082e('0x2c')]=_0x42c686;if(_0x10b4ec[_0x082e('0x3f')][_0x082e('0x4e')]){_0x4b2cc1['include']=[{'all':!![]}];}return db['ZohoAccount'][_0x082e('0x4f')](_0x4b2cc1);})[_0x082e('0x1f')](function(_0xf92299){_0x51db15[_0x082e('0x50')]=_0xf92299;return _0x51db15;})[_0x082e('0x1f')](respondWithFilteredResult(_0x31d3d5,_0x4b2cc1))[_0x082e('0x51')](handleError(_0x31d3d5,null));};exports[_0x082e('0x52')]=function(_0x18830e,_0xc87af){var _0x4bbb3f={'raw':![],'where':{'id':_0x18830e[_0x082e('0x53')]['id']}},_0x131b83={};_0x131b83[_0x082e('0x3e')]=_[_0x082e('0x40')](db[_0x082e('0x39')]['rawAttributes']);_0x131b83[_0x082e('0x3f')]=_[_0x082e('0x40')](_0x18830e[_0x082e('0x3f')]);_0x131b83['filters']=_[_0x082e('0x42')](_0x131b83[_0x082e('0x3e')],_0x131b83['query']);_0x4bbb3f[_0x082e('0x44')]=_['intersection'](_0x131b83[_0x082e('0x3e')],qs[_0x082e('0x43')](_0x18830e[_0x082e('0x3f')][_0x082e('0x43')]));_0x4bbb3f['attributes']=_0x4bbb3f[_0x082e('0x44')]['length']?_0x4bbb3f[_0x082e('0x44')]:_0x131b83['model'];if(_0x18830e[_0x082e('0x3f')][_0x082e('0x4e')]){_0x4bbb3f[_0x082e('0x54')]=[{'all':!![]}];}_0x4bbb3f=_[_0x082e('0x4b')]({},_0x4bbb3f,_0x18830e['options']);return db[_0x082e('0x39')][_0x082e('0x55')](_0x4bbb3f)[_0x082e('0x1f')](handleEntityNotFound(_0xc87af,null))[_0x082e('0x1f')](respondWithResult(_0xc87af,null))[_0x082e('0x51')](handleError(_0xc87af,null));};exports[_0x082e('0x56')]=function(_0x307e43,_0x15f733){return db[_0x082e('0x39')][_0x082e('0x56')](_0x307e43[_0x082e('0x57')],{})[_0x082e('0x1f')](respondWithResult(_0x15f733,0xc9))['catch'](handleError(_0x15f733,null));};exports['update']=function(_0x1cb813,_0x2455d1){if(_0x1cb813[_0x082e('0x57')]['id']){delete _0x1cb813[_0x082e('0x57')]['id'];}return db['ZohoAccount']['find']({'where':{'id':_0x1cb813[_0x082e('0x53')]['id']}})[_0x082e('0x1f')](handleEntityNotFound(_0x2455d1,null))['then'](saveUpdates(_0x1cb813[_0x082e('0x57')],null))[_0x082e('0x1f')](respondWithResult(_0x2455d1,null))[_0x082e('0x51')](handleError(_0x2455d1,null));};exports[_0x082e('0x33')]=function(_0x1e9563,_0x27cb56){return db[_0x082e('0x39')]['find']({'where':{'id':_0x1e9563[_0x082e('0x53')]['id']}})[_0x082e('0x1f')](handleEntityNotFound(_0x27cb56,null))['then'](removeEntity(_0x27cb56,null))['catch'](handleError(_0x27cb56,null));};exports['getConfigurations']=function(_0x51a3b5,_0x2602c4,_0x5ef1f2){var _0x5c30d4={};var _0x182610={};var _0x216e3b;var _0xfd82e0;return db[_0x082e('0x39')][_0x082e('0x58')]({'where':{'id':_0x51a3b5['params']['id']}})[_0x082e('0x1f')](handleEntityNotFound(_0x2602c4,null))[_0x082e('0x1f')](function(_0x5ab6b5){if(_0x5ab6b5){_0x216e3b=_0x5ab6b5;_0x182610[_0x082e('0x3e')]=_[_0x082e('0x40')](db['ZohoConfiguration'][_0x082e('0x3a')]);_0x182610[_0x082e('0x3f')]=_['keys'](_0x51a3b5[_0x082e('0x3f')]);_0x182610[_0x082e('0x41')]=_[_0x082e('0x42')](_0x182610['model'],_0x182610[_0x082e('0x3f')]);_0x5c30d4[_0x082e('0x44')]=_[_0x082e('0x42')](_0x182610[_0x082e('0x3e')],qs[_0x082e('0x43')](_0x51a3b5['query'][_0x082e('0x43')]));_0x5c30d4[_0x082e('0x44')]=_0x5c30d4[_0x082e('0x44')][_0x082e('0x59')]?_0x5c30d4[_0x082e('0x44')]:_0x182610[_0x082e('0x3e')];_0x5c30d4[_0x082e('0x5a')]=qs[_0x082e('0x47')](_0x51a3b5[_0x082e('0x3f')][_0x082e('0x47')]);_0x5c30d4['where']=qs[_0x082e('0x41')](_['pick'](_0x51a3b5['query'],_0x182610['filters']));if(_0x51a3b5[_0x082e('0x3f')][_0x082e('0x49')]){_0x5c30d4[_0x082e('0x4a')]=_['merge'](_0x5c30d4['where'],{'$or':_[_0x082e('0x38')](_0x5c30d4['attributes'],function(_0x31f70d){var _0x129376={};_0x129376[_0x31f70d]={'$like':'%'+_0x51a3b5[_0x082e('0x3f')][_0x082e('0x49')]+'%'};return _0x129376;})});}_0x5c30d4=_[_0x082e('0x4b')]({},_0x5c30d4,_0x51a3b5[_0x082e('0x4d')]);return _0x216e3b[_0x082e('0x5b')](_0x5c30d4);}})[_0x082e('0x1f')](function(_0x6da46e){if(_0x6da46e){_0xfd82e0=_0x6da46e[_0x082e('0x59')];if(!_0x51a3b5[_0x082e('0x3f')][_0x082e('0x45')](_0x082e('0x5c'))){_0x5c30d4[_0x082e('0x46')]=qs[_0x082e('0x46')](_0x51a3b5['query'][_0x082e('0x46')]);_0x5c30d4[_0x082e('0x2d')]=qs[_0x082e('0x2d')](_0x51a3b5['query']['offset']);}return _0x216e3b[_0x082e('0x5b')](_0x5c30d4);}})[_0x082e('0x1f')](function(_0x39950f){if(_0x39950f){return _0x39950f?{'count':_0xfd82e0,'rows':_0x39950f}:null;}})[_0x082e('0x1f')](respondWithResult(_0x2602c4,null))['catch'](handleError(_0x2602c4,null));};exports['addConfiguration']=function(_0x187859,_0x41f816,_0x369143){if(_0x187859[_0x082e('0x57')]['id']){delete _0x187859[_0x082e('0x57')]['id'];}return db[_0x082e('0x39')]['findOne']({'where':{'id':_0x187859[_0x082e('0x53')]['id']}})['then'](handleEntityNotFound(_0x41f816,null))['then'](function(_0xe554dc){if(_0xe554dc){_0x187859[_0x082e('0x57')]['AccountId']=_0xe554dc['id'];_0x187859[_0x082e('0x57')][_0x082e('0x5d')]=integrations[_0x082e('0x5e')](_0x187859[_0x082e('0x57')][_0x082e('0x5f')],_0x187859['body'][_0x082e('0x3c')]);_0x187859['body'][_0x082e('0x60')]=integrations[_0x082e('0x61')](_0x187859['body'][_0x082e('0x5f')],_0x187859[_0x082e('0x57')][_0x082e('0x3c')]);return db[_0x082e('0x62')][_0x082e('0x56')](_0x187859[_0x082e('0x57')],{'include':[{'model':db[_0x082e('0x63')],'as':_0x082e('0x5d')},{'model':db['ZohoField'],'as':_0x082e('0x60')}]});}return null;})[_0x082e('0x1f')](respondWithResult(_0x41f816,null))[_0x082e('0x51')](handleError(_0x41f816,null));};function getAccessToken(_0x2b22cc){return new Promise(function(_0x55978b,_0x1f575a){var _0x580d9b;switch(_0x2b22cc[_0x082e('0x64')]){case'US':_0x580d9b=_0x082e('0x65');break;case'AU':_0x580d9b='https://accounts.zoho.com.au';break;case'EU':_0x580d9b=_0x082e('0x66');break;case'IN':_0x580d9b=_0x082e('0x67');break;case'CN':_0x580d9b='https://accounts.zoho.com.cn';break;default:_0x580d9b=_0x082e('0x66');break;}var _0x5d555a={'method':_0x082e('0x68'),'uri':_0x580d9b+_0x082e('0x69'),'qs':{'refresh_token':_0x2b22cc[_0x082e('0x6a')],'client_id':_0x2b22cc[_0x082e('0x6b')],'client_secret':_0x2b22cc[_0x082e('0x6c')],'grant_type':_0x082e('0x6d')},'json':!![]};return rp(_0x5d555a)[_0x082e('0x1f')](function(_0x2c6412){if(_0x2c6412[_0x082e('0x6e')]){_0x55978b(_0x2c6412[_0x082e('0x6e')]);}else{_0x1f575a('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})['catch'](function(_0x1bbc7b){_0x1f575a(_0x1bbc7b);});});}exports['getFields']=function(_0x412ce3,_0x15fc44,_0x4c3c3d){var _0x3a065b,_0x3dbb9e,_0x431c45,_0x1fb2bf,_0x4c01c9;return db[_0x082e('0x39')]['findOne']({'where':{'id':_0x412ce3[_0x082e('0x53')]['id']},'attributes':['id',_0x082e('0x6f'),_0x082e('0x64'),_0x082e('0x6b'),_0x082e('0x6c'),_0x082e('0x70'),_0x082e('0x26'),_0x082e('0x6a')]})['then'](handleEntityNotFound(_0x15fc44,null))[_0x082e('0x1f')](function(_0x11f80d){_0x4c01c9=_0x11f80d;_0x3a065b=_0x4c01c9[_0x082e('0x6f')];_0x3dbb9e=_0x3a065b==='zoho.eu'?'eu':_0x082e('0x71');_0x431c45=_0x4c01c9[_0x082e('0x70')];var _0x483a43=_0x431c45['slice'](-0x1);if(_0x483a43==='/'||_0x483a43==='\x5c'||_0x483a43===':'){_0x431c45=_0x431c45['substring'](0x0,_0x431c45[_0x082e('0x72')](_0x483a43));}if(!_0x4c01c9['refreshToken']){throw new Error(_0x082e('0x73'));}return getAccessToken(_0x4c01c9);})[_0x082e('0x1f')](function(_0xe71493){if(_0xe71493){return rp({'method':_0x082e('0x74'),'uri':util['format'](_0x082e('0x75'),_0x3dbb9e),'qs':{'module':'Calls'},'headers':{'Authorization':_0x082e('0x76')+_0xe71493},'json':!![]});}})[_0x082e('0x1f')](function(_0x85d77){if(_0x85d77){if(_0x85d77[_0x082e('0x77')]&&_0x85d77[_0x082e('0x77')]['error']){throw new Error(_0x85d77[_0x082e('0x77')][_0x082e('0x25')][_0x082e('0x28')]);}var _0x3bb222=[];var _0x18012c=[];var _0x2f3166=['Owner',_0x082e('0x78'),'Description',_0x082e('0x79'),'Call_Duration',_0x082e('0x7a'),_0x082e('0x7b'),'Call_Type'];_0x18012c=_[_0x082e('0x7c')](_0x85d77[_0x082e('0x43')],function(_0x3f5db9){return _0x2f3166[_0x082e('0x7d')](_0x3f5db9['api_name']);});for(var _0x155bd=0x0;_0x155bd<_0x18012c['length'];_0x155bd++){if(_0x18012c[_0x155bd][_0x082e('0x7e')]===![]){_0x3bb222[_0x082e('0x7f')]({'id':_0x18012c[_0x155bd]['id'],'name':_0x18012c[_0x155bd][_0x082e('0x80')],'custom':_0x18012c[_0x155bd][_0x082e('0x81')],'options':_0x18012c[_0x155bd]['data_type']===_0x082e('0x82')&&_0x18012c[_0x155bd][_0x082e('0x83')][_0x082e('0x59')]>-0x1?_[_0x082e('0x38')](_0x18012c[_0x155bd][_0x082e('0x83')],function(_0x16cd37){return{'name':_0x16cd37,'value':_0x16cd37};}):[]});}}return{'count':_0x3bb222[_0x082e('0x59')],'rows':_0x3bb222};}else{return{'count':0x0,'rows':[]};}})[_0x082e('0x1f')](respondWithResult(_0x15fc44,null))[_0x082e('0x51')](function(_0x19443b){var _0x3bb645=_0x412ce3[_0x082e('0x3f')]['test']?0x1f4:_0x19443b['statusCode']||0x1f4;logger[_0x082e('0x25')](_0x082e('0x84'),_0x082e('0x85'),_0x3bb645,JSON[_0x082e('0x24')](_0x19443b));delete _0x19443b['name'];if(_0x3bb645===0x191){_0x3bb645=0x190;}_0x15fc44['status'](_0x3bb645)['send'](_0x412ce3[_0x082e('0x3f')][_0x082e('0x1a')]?{'message':_0x082e('0x86'),'statusCode':_0x19443b[_0x082e('0x87')]}:_0x19443b);});}; \ No newline at end of file +var _0x5084=['index','ZohoAccount','rawAttributes','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','include','rows','catch','show','params','includeAll','find','body','update','getConfigurations','findOne','ZohoConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','create','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','zoho.eu','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Owner','Description','WhoId','Call_Duration','Call_Result','remove','api_name','push','display_label','custom_field','data_type','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','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','ZohoAccount,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','save','then','destroy','stack','name','send'];(function(_0x2882da,_0x467427){var _0x351813=function(_0x195616){while(--_0x195616){_0x2882da['push'](_0x2882da['shift']());}};_0x351813(++_0x467427);}(_0x5084,0xde));var _0x4508=function(_0x55235c,_0x7afbe8){_0x55235c=_0x55235c-0x0;var _0x49ed97=_0x5084[_0x55235c];return _0x49ed97;};'use strict';var pdf=require(_0x4508('0x0'));var emlformat=require(_0x4508('0x1'));var rimraf=require(_0x4508('0x2'));var zipdir=require(_0x4508('0x3'));var jsonpatch=require(_0x4508('0x4'));var rp=require(_0x4508('0x5'));var moment=require(_0x4508('0x6'));var BPromise=require(_0x4508('0x7'));var Mustache=require(_0x4508('0x8'));var util=require(_0x4508('0x9'));var path=require(_0x4508('0xa'));var sox=require(_0x4508('0xb'));var csv=require(_0x4508('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4508('0xd'));var squel=require(_0x4508('0xe'));var crypto=require(_0x4508('0xf'));var jsforce=require(_0x4508('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x4508('0xc'));var querystring=require('querystring');var Papa=require(_0x4508('0x11'));var Redis=require(_0x4508('0x12'));var authService=require(_0x4508('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x4508('0x14'));var hardwareService=require(_0x4508('0x15'));var logger=require('../../config/logger')(_0x4508('0x16'));var utils=require(_0x4508('0x17'));var config=require(_0x4508('0x18'));var db=require(_0x4508('0x19'))['db'];var integrations=require(_0x4508('0x1a'));var jayson=require(_0x4508('0x1b'));var client=jayson[_0x4508('0x1c')][_0x4508('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x566946,_0x319637,_0x2a002a){if(_0x2a002a){var _0x5980df=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5980df[_0x4508('0x1e')](_0x319637)){return _0x566946;}else{throw new db[(_0x4508('0x1f'))][(_0x4508('0x20'))](_0x4508('0x21'));}}else{return _0x566946;}}function respondWithRpcPromise(_0x11aa25,_0x4c8c5e,_0x483b21,_0x7561ce){return new BPromise(function(_0x1c5854,_0x353501){var _0x5e41b2=_0x7561ce||client;return _0x5e41b2['request'](_0x11aa25,_0x483b21)['then'](function(_0x4b1a56){logger[_0x4508('0x22')](_0x4508('0x23'),_0x4c8c5e,'request\x20sent');logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x4c8c5e,'request\x20sent',JSON[_0x4508('0x24')](_0x4b1a56));if(_0x4b1a56[_0x4508('0x25')]){if(_0x4b1a56[_0x4508('0x25')][_0x4508('0x26')]===0x1f4){logger[_0x4508('0x25')](_0x4508('0x23'),_0x4c8c5e,_0x4b1a56[_0x4508('0x25')][_0x4508('0x27')]);return _0x353501(_0x4b1a56[_0x4508('0x25')][_0x4508('0x27')]);}logger['error'](_0x4508('0x23'),_0x4c8c5e,_0x4b1a56['error']['message']);return _0x1c5854(_0x4b1a56[_0x4508('0x25')][_0x4508('0x27')]);}else{logger[_0x4508('0x22')](_0x4508('0x23'),_0x4c8c5e,'request\x20sent');_0x1c5854(_0x4b1a56[_0x4508('0x28')][_0x4508('0x27')]);}})['catch'](function(_0x3aaa6f){logger[_0x4508('0x25')](_0x4508('0x23'),_0x4c8c5e,_0x3aaa6f);_0x353501(_0x3aaa6f);});});}function respondWithStatusCode(_0x187b0c,_0x43ca07){_0x43ca07=_0x43ca07||0xcc;return function(_0x597c66){if(_0x597c66){return _0x187b0c[_0x4508('0x29')](_0x43ca07);}return _0x187b0c['status'](_0x43ca07)[_0x4508('0x2a')]();};}function respondWithResult(_0x6d4b23,_0x59d050){_0x59d050=_0x59d050||0xc8;return function(_0x14c2b5){if(_0x14c2b5){return _0x6d4b23[_0x4508('0x2b')](_0x59d050)[_0x4508('0x2c')](_0x14c2b5);}};}function respondWithFilteredResult(_0x190d02,_0x407a8a){return function(_0x384648){if(_0x384648){var _0x4c944a=_0x384648[_0x4508('0x2d')],_0x3b604d=_0x407a8a['offset'],_0x1a5b77=_0x407a8a[_0x4508('0x2e')]+_0x407a8a[_0x4508('0x2f')],_0x3b5fe9;if(_0x1a5b77>=_0x4c944a){_0x1a5b77=_0x4c944a;_0x3b5fe9=0xc8;}else{_0x3b5fe9=0xce;}_0x190d02[_0x4508('0x2b')](_0x3b5fe9);return _0x190d02['set'](_0x4508('0x30'),_0x3b604d+'-'+_0x1a5b77+'/'+_0x4c944a)[_0x4508('0x2c')](_0x384648);}return null;};}function patchUpdates(_0x1fdf01){return function(_0x1b6c4e){try{jsonpatch[_0x4508('0x31')](_0x1b6c4e,_0x1fdf01,!![]);}catch(_0x1c498f){return BPromise['reject'](_0x1c498f);}return _0x1b6c4e[_0x4508('0x32')]();};}function saveUpdates(_0x3f3aee,_0x585c30){return function(_0x2935ea){if(_0x2935ea){return _0x2935ea['update'](_0x3f3aee)[_0x4508('0x33')](function(_0x5cf065){return _0x5cf065;});}return null;};}function removeEntity(_0x4bb6b9,_0x10fd1b){return function(_0x346214){if(_0x346214){return _0x346214[_0x4508('0x34')]()['then'](function(){_0x4bb6b9[_0x4508('0x2b')](0xcc)[_0x4508('0x2a')]();});}};}function handleEntityNotFound(_0x224512,_0x4aed55){return function(_0x5f4c5e){if(!_0x5f4c5e){_0x224512['sendStatus'](0x194);}return _0x5f4c5e;};}function handleError(_0x33f6dc,_0x51d9b0){_0x51d9b0=_0x51d9b0||0x1f4;return function(_0x1c1373){logger['error'](_0x1c1373[_0x4508('0x35')]);if(_0x1c1373[_0x4508('0x36')]){delete _0x1c1373[_0x4508('0x36')];}_0x33f6dc[_0x4508('0x2b')](_0x51d9b0)[_0x4508('0x37')](_0x1c1373);};}exports[_0x4508('0x38')]=function(_0x27c44f,_0x7ee3bf){var _0x3499e6={},_0x373122={},_0x72c60f={'count':0x0,'rows':[]};var _0x3d6772=_['map'](db[_0x4508('0x39')][_0x4508('0x3a')],function(_0x53df85){return{'name':_0x53df85['fieldName'],'type':_0x53df85[_0x4508('0x3b')][_0x4508('0x3c')]};});_0x373122[_0x4508('0x3d')]=_['map'](_0x3d6772,_0x4508('0x36'));_0x373122['query']=_[_0x4508('0x3e')](_0x27c44f['query']);_0x373122['filters']=_['intersection'](_0x373122[_0x4508('0x3d')],_0x373122[_0x4508('0x3f')]);_0x3499e6['attributes']=_[_0x4508('0x40')](_0x373122[_0x4508('0x3d')],qs[_0x4508('0x41')](_0x27c44f[_0x4508('0x3f')][_0x4508('0x41')]));_0x3499e6[_0x4508('0x42')]=_0x3499e6[_0x4508('0x42')][_0x4508('0x43')]?_0x3499e6[_0x4508('0x42')]:_0x373122[_0x4508('0x3d')];if(!_0x27c44f[_0x4508('0x3f')][_0x4508('0x44')](_0x4508('0x45'))){_0x3499e6[_0x4508('0x2f')]=qs[_0x4508('0x2f')](_0x27c44f[_0x4508('0x3f')][_0x4508('0x2f')]);_0x3499e6['offset']=qs['offset'](_0x27c44f[_0x4508('0x3f')][_0x4508('0x2e')]);}_0x3499e6[_0x4508('0x46')]=qs[_0x4508('0x47')](_0x27c44f[_0x4508('0x3f')][_0x4508('0x47')]);_0x3499e6[_0x4508('0x48')]=qs[_0x4508('0x49')](_[_0x4508('0x4a')](_0x27c44f['query'],_0x373122['filters']));if(_0x27c44f[_0x4508('0x3f')][_0x4508('0x4b')]){_0x3499e6[_0x4508('0x48')]=_[_0x4508('0x4c')](_0x3499e6[_0x4508('0x48')],{'$or':_[_0x4508('0x4d')](_0x3d6772,function(_0x37d963){if(_0x37d963[_0x4508('0x3b')]!==_0x4508('0x4e')){var _0x14cf41={};_0x14cf41[_0x37d963['name']]={'$like':'%'+_0x27c44f[_0x4508('0x3f')][_0x4508('0x4b')]+'%'};return _0x14cf41;}})});}_0x3499e6=_[_0x4508('0x4c')]({},_0x3499e6,_0x27c44f[_0x4508('0x4f')]);var _0x101544={'where':_0x3499e6['where']};return db['ZohoAccount'][_0x4508('0x2d')](_0x101544)[_0x4508('0x33')](function(_0x2b9302){_0x72c60f['count']=_0x2b9302;if(_0x27c44f['query']['includeAll']){_0x3499e6[_0x4508('0x50')]=[{'all':!![]}];}return db[_0x4508('0x39')]['findAll'](_0x3499e6);})[_0x4508('0x33')](function(_0x51199f){_0x72c60f[_0x4508('0x51')]=_0x51199f;return _0x72c60f;})['then'](respondWithFilteredResult(_0x7ee3bf,_0x3499e6))[_0x4508('0x52')](handleError(_0x7ee3bf,null));};exports[_0x4508('0x53')]=function(_0x95f7dd,_0x280dc6){var _0x575e19={'raw':![],'where':{'id':_0x95f7dd[_0x4508('0x54')]['id']}},_0x24dc60={};_0x24dc60[_0x4508('0x3d')]=_[_0x4508('0x3e')](db[_0x4508('0x39')][_0x4508('0x3a')]);_0x24dc60['query']=_[_0x4508('0x3e')](_0x95f7dd[_0x4508('0x3f')]);_0x24dc60['filters']=_[_0x4508('0x40')](_0x24dc60[_0x4508('0x3d')],_0x24dc60[_0x4508('0x3f')]);_0x575e19[_0x4508('0x42')]=_[_0x4508('0x40')](_0x24dc60[_0x4508('0x3d')],qs['fields'](_0x95f7dd[_0x4508('0x3f')][_0x4508('0x41')]));_0x575e19[_0x4508('0x42')]=_0x575e19[_0x4508('0x42')]['length']?_0x575e19[_0x4508('0x42')]:_0x24dc60['model'];if(_0x95f7dd[_0x4508('0x3f')][_0x4508('0x55')]){_0x575e19['include']=[{'all':!![]}];}_0x575e19=_['merge']({},_0x575e19,_0x95f7dd['options']);return db[_0x4508('0x39')][_0x4508('0x56')](_0x575e19)[_0x4508('0x33')](handleEntityNotFound(_0x280dc6,null))['then'](respondWithResult(_0x280dc6,null))[_0x4508('0x52')](handleError(_0x280dc6,null));};exports['create']=function(_0x5a8181,_0x30899d){return db[_0x4508('0x39')]['create'](_0x5a8181[_0x4508('0x57')],{})[_0x4508('0x33')](respondWithResult(_0x30899d,0xc9))[_0x4508('0x52')](handleError(_0x30899d,null));};exports[_0x4508('0x58')]=function(_0x448a05,_0x19d124){if(_0x448a05['body']['id']){delete _0x448a05[_0x4508('0x57')]['id'];}return db[_0x4508('0x39')][_0x4508('0x56')]({'where':{'id':_0x448a05['params']['id']}})[_0x4508('0x33')](handleEntityNotFound(_0x19d124,null))[_0x4508('0x33')](saveUpdates(_0x448a05[_0x4508('0x57')],null))[_0x4508('0x33')](respondWithResult(_0x19d124,null))[_0x4508('0x52')](handleError(_0x19d124,null));};exports[_0x4508('0x34')]=function(_0x13de1a,_0x184092){return db[_0x4508('0x39')]['find']({'where':{'id':_0x13de1a['params']['id']}})[_0x4508('0x33')](handleEntityNotFound(_0x184092,null))[_0x4508('0x33')](removeEntity(_0x184092,null))[_0x4508('0x52')](handleError(_0x184092,null));};exports[_0x4508('0x59')]=function(_0x4d3eaa,_0x2ee8e0,_0x101bb4){var _0x1b56d7={};var _0x1e7622={};var _0x3b2c6c;var _0x5adbb6;return db[_0x4508('0x39')][_0x4508('0x5a')]({'where':{'id':_0x4d3eaa['params']['id']}})[_0x4508('0x33')](handleEntityNotFound(_0x2ee8e0,null))[_0x4508('0x33')](function(_0x538ffd){if(_0x538ffd){_0x3b2c6c=_0x538ffd;_0x1e7622[_0x4508('0x3d')]=_[_0x4508('0x3e')](db[_0x4508('0x5b')]['rawAttributes']);_0x1e7622['query']=_[_0x4508('0x3e')](_0x4d3eaa['query']);_0x1e7622[_0x4508('0x49')]=_['intersection'](_0x1e7622[_0x4508('0x3d')],_0x1e7622[_0x4508('0x3f')]);_0x1b56d7['attributes']=_[_0x4508('0x40')](_0x1e7622[_0x4508('0x3d')],qs[_0x4508('0x41')](_0x4d3eaa['query']['fields']));_0x1b56d7['attributes']=_0x1b56d7['attributes']['length']?_0x1b56d7[_0x4508('0x42')]:_0x1e7622['model'];_0x1b56d7[_0x4508('0x46')]=qs['sort'](_0x4d3eaa[_0x4508('0x3f')][_0x4508('0x47')]);_0x1b56d7[_0x4508('0x48')]=qs[_0x4508('0x49')](_[_0x4508('0x4a')](_0x4d3eaa[_0x4508('0x3f')],_0x1e7622[_0x4508('0x49')]));if(_0x4d3eaa[_0x4508('0x3f')][_0x4508('0x4b')]){_0x1b56d7[_0x4508('0x48')]=_[_0x4508('0x4c')](_0x1b56d7[_0x4508('0x48')],{'$or':_[_0x4508('0x4d')](_0x1b56d7[_0x4508('0x42')],function(_0x5694b1){var _0x2a30ab={};_0x2a30ab[_0x5694b1]={'$like':'%'+_0x4d3eaa[_0x4508('0x3f')][_0x4508('0x4b')]+'%'};return _0x2a30ab;})});}_0x1b56d7=_[_0x4508('0x4c')]({},_0x1b56d7,_0x4d3eaa['options']);return _0x3b2c6c['getConfigurations'](_0x1b56d7);}})[_0x4508('0x33')](function(_0x52201b){if(_0x52201b){_0x5adbb6=_0x52201b[_0x4508('0x43')];if(!_0x4d3eaa[_0x4508('0x3f')]['hasOwnProperty']('nolimit')){_0x1b56d7['limit']=qs[_0x4508('0x2f')](_0x4d3eaa['query'][_0x4508('0x2f')]);_0x1b56d7[_0x4508('0x2e')]=qs[_0x4508('0x2e')](_0x4d3eaa[_0x4508('0x3f')][_0x4508('0x2e')]);}return _0x3b2c6c[_0x4508('0x59')](_0x1b56d7);}})[_0x4508('0x33')](function(_0x208599){if(_0x208599){return _0x208599?{'count':_0x5adbb6,'rows':_0x208599}:null;}})[_0x4508('0x33')](respondWithResult(_0x2ee8e0,null))['catch'](handleError(_0x2ee8e0,null));};exports[_0x4508('0x5c')]=function(_0x4c6387,_0x49d8cf,_0x23a800){if(_0x4c6387['body']['id']){delete _0x4c6387[_0x4508('0x57')]['id'];}return db[_0x4508('0x39')][_0x4508('0x5a')]({'where':{'id':_0x4c6387[_0x4508('0x54')]['id']}})[_0x4508('0x33')](handleEntityNotFound(_0x49d8cf,null))[_0x4508('0x33')](function(_0x51fbc8){if(_0x51fbc8){_0x4c6387[_0x4508('0x57')][_0x4508('0x5d')]=_0x51fbc8['id'];_0x4c6387[_0x4508('0x57')][_0x4508('0x5e')]=integrations[_0x4508('0x5f')](_0x4c6387['body'][_0x4508('0x60')],_0x4c6387[_0x4508('0x57')][_0x4508('0x3b')]);_0x4c6387[_0x4508('0x57')][_0x4508('0x61')]=integrations[_0x4508('0x62')](_0x4c6387['body'][_0x4508('0x60')],_0x4c6387[_0x4508('0x57')][_0x4508('0x3b')]);return db[_0x4508('0x5b')][_0x4508('0x63')](_0x4c6387[_0x4508('0x57')],{'include':[{'model':db['ZohoField'],'as':_0x4508('0x5e')},{'model':db['ZohoField'],'as':'Descriptions'}]});}return null;})[_0x4508('0x33')](respondWithResult(_0x49d8cf,null))[_0x4508('0x52')](handleError(_0x49d8cf,null));};function getAccessToken(_0x2f48b8){return new Promise(function(_0x2731ff,_0x2f4c66){var _0x48b301;switch(_0x2f48b8[_0x4508('0x64')]){case'US':_0x48b301=_0x4508('0x65');break;case'AU':_0x48b301=_0x4508('0x66');break;case'EU':_0x48b301='https://accounts.zoho.eu';break;case'IN':_0x48b301='https://accounts.zoho.in';break;case'CN':_0x48b301=_0x4508('0x67');break;default:_0x48b301=_0x4508('0x68');break;}var _0x231ce1={'method':_0x4508('0x69'),'uri':_0x48b301+_0x4508('0x6a'),'qs':{'refresh_token':_0x2f48b8[_0x4508('0x6b')],'client_id':_0x2f48b8[_0x4508('0x6c')],'client_secret':_0x2f48b8[_0x4508('0x6d')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x231ce1)[_0x4508('0x33')](function(_0x201cfb){if(_0x201cfb['access_token']){_0x2731ff(_0x201cfb[_0x4508('0x6e')]);}else{_0x2f4c66(_0x4508('0x6f'));}})[_0x4508('0x52')](function(_0x5527f6){_0x2f4c66(_0x5527f6);});});}exports[_0x4508('0x70')]=function(_0x2e46ec,_0x4e39a0,_0x2b4600){var _0x456e37,_0x1ccc30,_0x385844,_0x2d2cb9,_0x153d56;return db[_0x4508('0x39')]['findOne']({'where':{'id':_0x2e46ec[_0x4508('0x54')]['id']},'attributes':['id',_0x4508('0x71'),_0x4508('0x64'),'clientId',_0x4508('0x6d'),_0x4508('0x72'),_0x4508('0x26'),'refreshToken']})[_0x4508('0x33')](handleEntityNotFound(_0x4e39a0,null))[_0x4508('0x33')](function(_0x3deedc){_0x153d56=_0x3deedc;_0x456e37=_0x153d56[_0x4508('0x71')];_0x1ccc30=_0x456e37===_0x4508('0x73')?'eu':'com';_0x385844=_0x153d56[_0x4508('0x72')];var _0x61ade7=_0x385844[_0x4508('0x74')](-0x1);if(_0x61ade7==='/'||_0x61ade7==='\x5c'||_0x61ade7===':'){_0x385844=_0x385844[_0x4508('0x75')](0x0,_0x385844[_0x4508('0x76')](_0x61ade7));}if(!_0x153d56['refreshToken']){throw new Error(_0x4508('0x77'));}return getAccessToken(_0x153d56);})['then'](function(_0x377237){if(_0x377237){return rp({'method':_0x4508('0x78'),'uri':util['format'](_0x4508('0x79'),_0x1ccc30),'qs':{'module':_0x4508('0x7a')},'headers':{'Authorization':_0x4508('0x7b')+_0x377237},'json':!![]});}})[_0x4508('0x33')](function(_0x732d96){if(_0x732d96){if(_0x732d96[_0x4508('0x7c')]&&_0x732d96[_0x4508('0x7c')][_0x4508('0x25')]){throw new Error(_0x732d96[_0x4508('0x7c')][_0x4508('0x25')][_0x4508('0x27')]);}var _0x4be744=[];var _0x1b3d69=[];var _0x178e6c=[_0x4508('0x7d'),'Subject',_0x4508('0x7e'),_0x4508('0x7f'),_0x4508('0x80'),_0x4508('0x81'),'Call_Start_Time','Call_Type'];_0x1b3d69=_[_0x4508('0x82')](_0x732d96[_0x4508('0x41')],function(_0x1e4767){return _0x178e6c['includes'](_0x1e4767[_0x4508('0x83')]);});for(var _0x3b022b=0x0;_0x3b022b<_0x1b3d69[_0x4508('0x43')];_0x3b022b++){if(_0x1b3d69[_0x3b022b]['system_mandatory']===![]){_0x4be744[_0x4508('0x84')]({'id':_0x1b3d69[_0x3b022b]['id'],'name':_0x1b3d69[_0x3b022b][_0x4508('0x85')],'custom':_0x1b3d69[_0x3b022b][_0x4508('0x86')],'options':_0x1b3d69[_0x3b022b][_0x4508('0x87')]==='picklist'&&_0x1b3d69[_0x3b022b][_0x4508('0x88')][_0x4508('0x43')]>-0x1?_[_0x4508('0x4d')](_0x1b3d69[_0x3b022b][_0x4508('0x88')],function(_0xacc3d4){return{'name':_0xacc3d4,'value':_0xacc3d4};}):[]});}}return{'count':_0x4be744[_0x4508('0x43')],'rows':_0x4be744};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x4e39a0,null))[_0x4508('0x52')](function(_0x210d61){var _0x2412dd=_0x2e46ec[_0x4508('0x3f')][_0x4508('0x1e')]?0x1f4:_0x210d61[_0x4508('0x89')]||0x1f4;logger[_0x4508('0x25')](_0x4508('0x8a'),'getFields',_0x2412dd,JSON[_0x4508('0x24')](_0x210d61));delete _0x210d61[_0x4508('0x36')];if(_0x2412dd===0x191){_0x2412dd=0x190;}_0x4e39a0[_0x4508('0x2b')](_0x2412dd)[_0x4508('0x37')](_0x2e46ec[_0x4508('0x3f')][_0x4508('0x1e')]?{'message':'Wrong\x20credentials','statusCode':_0x210d61['statusCode']}:_0x210d61);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index c6f56b6..0f8ee1a 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 _0xfdb4=['inspect','catch','name','slice','substring','https://accounts.zoho.eu','then','lodash','util','../../config/logger','moment','path','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','serverUrl','clientId','clientSecret','code','host','lastIndexOf','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','parse','refreshToken','refresh_token','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'];(function(_0x422faf,_0x6967d5){var _0x341573=function(_0x5d2f0e){while(--_0x5d2f0e){_0x422faf['push'](_0x422faf['shift']());}};_0x341573(++_0x6967d5);}(_0xfdb4,0x88));var _0x4fdb=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0xfdb4[_0x403c20];return _0x2b271a;};'use strict';var _=require(_0x4fdb('0x0'));var util=require(_0x4fdb('0x1'));var logger=require(_0x4fdb('0x2'))('api');var moment=require(_0x4fdb('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4fdb('0x4'));var rimraf=require('rimraf');var config=require(_0x4fdb('0x5'));var attributes=require(_0x4fdb('0x6'));var integrations=require(_0x4fdb('0x7'));module[_0x4fdb('0x8')]=function(_0x386b96,_0x1c6c11){return _0x386b96[_0x4fdb('0x9')](_0x4fdb('0xa'),attributes,{'tableName':_0x4fdb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x268d53,_0x38b8e1,_0x31cc6d){if(_0x268d53[_0x4fdb('0xc')]('zone')||_0x268d53[_0x4fdb('0xc')](_0x4fdb('0xd'))||_0x268d53[_0x4fdb('0xc')](_0x4fdb('0xe'))||_0x268d53[_0x4fdb('0xc')](_0x4fdb('0xf'))||_0x268d53[_0x4fdb('0xc')](_0x4fdb('0x10'))||_0x268d53[_0x4fdb('0xc')](_0x4fdb('0x11'))){var _0x20c8d2,_0x3fe01d;_0x20c8d2=_0x268d53[_0x4fdb('0xd')];var _0x2bad87=_0x20c8d2['slice'](-0x1);if(_0x2bad87==='/'||_0x2bad87==='\x5c'||_0x2bad87===':'){_0x20c8d2=_0x20c8d2['substring'](0x0,_0x20c8d2[_0x4fdb('0x12')](_0x2bad87));}switch(_0x268d53[_0x4fdb('0x13')]){case'US':_0x3fe01d=_0x4fdb('0x14');break;case'AU':_0x3fe01d=_0x4fdb('0x15');break;case'IN':_0x3fe01d=_0x4fdb('0x16');break;case'CN':_0x3fe01d=_0x4fdb('0x17');break;default:_0x3fe01d='https://accounts.zoho.eu';break;}var _0x62c131={'method':_0x4fdb('0x18'),'uri':_0x3fe01d+_0x4fdb('0x19'),'form':{'grant_type':_0x4fdb('0x1a'),'client_id':_0x268d53['clientId'],'client_secret':_0x268d53[_0x4fdb('0xf')],'redirect_uri':_0x268d53[_0x4fdb('0xd')],'code':_0x268d53['code']},'headers':{'Content-Type':_0x4fdb('0x1b')}};return rp(_0x62c131)['then'](function(_0x571721){var _0x4351c6=JSON[_0x4fdb('0x1c')](_0x571721);if(_0x4351c6['refresh_token']){_0x268d53[_0x4fdb('0x1d')]=_0x4351c6[_0x4fdb('0x1e')];logger[_0x4fdb('0x1f')](util[_0x4fdb('0x20')](_0x4fdb('0x21'),_0x268d53['name'],_0x268d53['id']));}else{logger[_0x4fdb('0x22')](util[_0x4fdb('0x20')](_0x4fdb('0x23'),_0x268d53['name'],_0x268d53['id']),util[_0x4fdb('0x24')](_0x4351c6,{'showHidden':![],'depth':null}));}return _0x31cc6d(null,_0x38b8e1);})[_0x4fdb('0x25')](function(_0x27c8a4){logger[_0x4fdb('0x22')](util[_0x4fdb('0x20')](_0x4fdb('0x23'),_0x268d53[_0x4fdb('0x26')],_0x268d53['id']),util[_0x4fdb('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x31cc6d(_0x27c8a4);});}else{return _0x31cc6d(null,_0x38b8e1);}},'beforeUpdate':function(_0x4b7e1b,_0x349249,_0x2cc089){if(_0x4b7e1b[_0x4fdb('0xc')](_0x4fdb('0x13'))||_0x4b7e1b['changed'](_0x4fdb('0xd'))||_0x4b7e1b[_0x4fdb('0xc')]('clientId')||_0x4b7e1b[_0x4fdb('0xc')]('clientSecret')||_0x4b7e1b['changed'](_0x4fdb('0x10'))||_0x4b7e1b[_0x4fdb('0xc')](_0x4fdb('0x11'))){var _0x1dc67e,_0x119b38;_0x1dc67e=_0x4b7e1b[_0x4fdb('0xd')];var _0x1cab50=_0x1dc67e[_0x4fdb('0x27')](-0x1);if(_0x1cab50==='/'||_0x1cab50==='\x5c'||_0x1cab50===':'){_0x1dc67e=_0x1dc67e[_0x4fdb('0x28')](0x0,_0x1dc67e[_0x4fdb('0x12')](_0x1cab50));}switch(_0x4b7e1b[_0x4fdb('0x13')]){case'US':_0x119b38=_0x4fdb('0x14');break;case'AU':_0x119b38=_0x4fdb('0x15');break;case'IN':_0x119b38=_0x4fdb('0x16');break;case'CN':_0x119b38=_0x4fdb('0x17');break;default:_0x119b38=_0x4fdb('0x29');break;}var _0x59a960={'method':'POST','uri':_0x119b38+_0x4fdb('0x19'),'form':{'grant_type':'authorization_code','client_id':_0x4b7e1b[_0x4fdb('0xe')],'client_secret':_0x4b7e1b[_0x4fdb('0xf')],'redirect_uri':_0x4b7e1b[_0x4fdb('0xd')],'code':_0x4b7e1b[_0x4fdb('0x10')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x59a960)[_0x4fdb('0x2a')](function(_0x516086){var _0x5b87a9=JSON['parse'](_0x516086);if(_0x5b87a9['refresh_token']){_0x4b7e1b[_0x4fdb('0x1d')]=_0x5b87a9[_0x4fdb('0x1e')];logger[_0x4fdb('0x1f')](util[_0x4fdb('0x20')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4b7e1b[_0x4fdb('0x26')],_0x4b7e1b['id']));}else{logger['error'](util['format'](_0x4fdb('0x23'),_0x4b7e1b['name'],_0x4b7e1b['id']),util[_0x4fdb('0x24')](_0x5b87a9,{'showHidden':![],'depth':null}));}return _0x2cc089(null,_0x349249);})[_0x4fdb('0x25')](function(_0x405243){logger[_0x4fdb('0x22')](util[_0x4fdb('0x20')](_0x4fdb('0x23'),_0x4b7e1b[_0x4fdb('0x26')],_0x4b7e1b['id']),util[_0x4fdb('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x2cc089(_0x405243);});}else{return _0x2cc089(null,_0x349249);}}}});}; \ No newline at end of file +var _0xbde8=['code','serverUrl','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','clientSecret','application/x-www-form-urlencoded','then','refresh_token','refreshToken','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','host','slice','substring','POST','error','inspect','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intZohoAccount.attributes','exports','ZohoAccount','int_zoho_accounts','changed','zone','clientId'];(function(_0x5674fc,_0x2b623b){var _0x2444a5=function(_0x19774c){while(--_0x19774c){_0x5674fc['push'](_0x5674fc['shift']());}};_0x2444a5(++_0x2b623b);}(_0xbde8,0x1a9));var _0x8bde=function(_0x5aa992,_0x559ebb){_0x5aa992=_0x5aa992-0x0;var _0x2e2d59=_0xbde8[_0x5aa992];return _0x2e2d59;};'use strict';var _=require(_0x8bde('0x0'));var util=require(_0x8bde('0x1'));var logger=require(_0x8bde('0x2'))(_0x8bde('0x3'));var moment=require(_0x8bde('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8bde('0x5'));var rimraf=require(_0x8bde('0x6'));var config=require(_0x8bde('0x7'));var attributes=require(_0x8bde('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x8bde('0x9')]=function(_0x4fc867,_0x5b9c4f){return _0x4fc867['define'](_0x8bde('0xa'),attributes,{'tableName':_0x8bde('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1270f9,_0x2a590e,_0x2035ed){if(_0x1270f9[_0x8bde('0xc')](_0x8bde('0xd'))||_0x1270f9[_0x8bde('0xc')]('serverUrl')||_0x1270f9[_0x8bde('0xc')](_0x8bde('0xe'))||_0x1270f9[_0x8bde('0xc')]('clientSecret')||_0x1270f9[_0x8bde('0xc')](_0x8bde('0xf'))||_0x1270f9[_0x8bde('0xc')]('host')){var _0x3ab1fb,_0x18bcad;_0x3ab1fb=_0x1270f9[_0x8bde('0x10')];var _0x5ce686=_0x3ab1fb['slice'](-0x1);if(_0x5ce686==='/'||_0x5ce686==='\x5c'||_0x5ce686===':'){_0x3ab1fb=_0x3ab1fb['substring'](0x0,_0x3ab1fb[_0x8bde('0x11')](_0x5ce686));}switch(_0x1270f9['zone']){case'US':_0x18bcad=_0x8bde('0x12');break;case'AU':_0x18bcad=_0x8bde('0x13');break;case'IN':_0x18bcad=_0x8bde('0x14');break;case'CN':_0x18bcad=_0x8bde('0x15');break;default:_0x18bcad=_0x8bde('0x16');break;}var _0x39f72c={'method':'POST','uri':_0x18bcad+_0x8bde('0x17'),'form':{'grant_type':'authorization_code','client_id':_0x1270f9['clientId'],'client_secret':_0x1270f9[_0x8bde('0x18')],'redirect_uri':_0x1270f9[_0x8bde('0x10')],'code':_0x1270f9[_0x8bde('0xf')]},'headers':{'Content-Type':_0x8bde('0x19')}};return rp(_0x39f72c)[_0x8bde('0x1a')](function(_0x44643f){var _0xb67960=JSON['parse'](_0x44643f);if(_0xb67960[_0x8bde('0x1b')]){_0x1270f9[_0x8bde('0x1c')]=_0xb67960['refresh_token'];logger['info'](util[_0x8bde('0x1d')](_0x8bde('0x1e'),_0x1270f9[_0x8bde('0x1f')],_0x1270f9['id']));}else{logger['error'](util['format'](_0x8bde('0x20'),_0x1270f9[_0x8bde('0x1f')],_0x1270f9['id']),util['inspect'](_0xb67960,{'showHidden':![],'depth':null}));}return _0x2035ed(null,_0x2a590e);})[_0x8bde('0x21')](function(_0x1767ea){logger['error'](util[_0x8bde('0x1d')](_0x8bde('0x20'),_0x1270f9[_0x8bde('0x1f')],_0x1270f9['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x2035ed(_0x1767ea);});}else{return _0x2035ed(null,_0x2a590e);}},'beforeUpdate':function(_0x166637,_0x3db4ae,_0x32a01c){if(_0x166637[_0x8bde('0xc')]('zone')||_0x166637[_0x8bde('0xc')](_0x8bde('0x10'))||_0x166637['changed'](_0x8bde('0xe'))||_0x166637[_0x8bde('0xc')]('clientSecret')||_0x166637[_0x8bde('0xc')](_0x8bde('0xf'))||_0x166637[_0x8bde('0xc')](_0x8bde('0x22'))){var _0x53fcfc,_0x18811d;_0x53fcfc=_0x166637[_0x8bde('0x10')];var _0x220368=_0x53fcfc[_0x8bde('0x23')](-0x1);if(_0x220368==='/'||_0x220368==='\x5c'||_0x220368===':'){_0x53fcfc=_0x53fcfc[_0x8bde('0x24')](0x0,_0x53fcfc[_0x8bde('0x11')](_0x220368));}switch(_0x166637[_0x8bde('0xd')]){case'US':_0x18811d='https://accounts.zoho.com';break;case'AU':_0x18811d=_0x8bde('0x13');break;case'IN':_0x18811d='https://accounts.zoho.in';break;case'CN':_0x18811d=_0x8bde('0x15');break;default:_0x18811d=_0x8bde('0x16');break;}var _0x48bd80={'method':_0x8bde('0x25'),'uri':_0x18811d+_0x8bde('0x17'),'form':{'grant_type':'authorization_code','client_id':_0x166637[_0x8bde('0xe')],'client_secret':_0x166637['clientSecret'],'redirect_uri':_0x166637[_0x8bde('0x10')],'code':_0x166637['code']},'headers':{'Content-Type':_0x8bde('0x19')}};return rp(_0x48bd80)[_0x8bde('0x1a')](function(_0x4cfbba){var _0x3e7a95=JSON['parse'](_0x4cfbba);if(_0x3e7a95['refresh_token']){_0x166637[_0x8bde('0x1c')]=_0x3e7a95['refresh_token'];logger['info'](util['format'](_0x8bde('0x1e'),_0x166637['name'],_0x166637['id']));}else{logger[_0x8bde('0x26')](util[_0x8bde('0x1d')](_0x8bde('0x20'),_0x166637[_0x8bde('0x1f')],_0x166637['id']),util['inspect'](_0x3e7a95,{'showHidden':![],'depth':null}));}return _0x32a01c(null,_0x3db4ae);})[_0x8bde('0x21')](function(_0x17de62){logger[_0x8bde('0x26')](util[_0x8bde('0x1d')](_0x8bde('0x20'),_0x166637[_0x8bde('0x1f')],_0x166637['id']),util[_0x8bde('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0x32a01c(_0x17de62);});}else{return _0x32a01c(null,_0x3db4ae);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index a54681d..ea97c07 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 _0x7aad=['attributes','GetZohoAccount','ShowZohoAccount','find','map','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','ZohoAccount,\x20%s,\x20%s','result','catch','ZohoAccount','findAll','options','raw','where','include','model'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x7aad,0x1e1));var _0xd7aa=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x7aad[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0xd7aa('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd7aa('0x1'));var rs=require(_0xd7aa('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd7aa('0x3'))['db'];var utils=require(_0xd7aa('0x4'));var logger=require('../../config/logger')(_0xd7aa('0x5'));var config=require(_0xd7aa('0x6'));var jayson=require(_0xd7aa('0x7'));var client=jayson[_0xd7aa('0x8')][_0xd7aa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21bbca,_0x47e208,_0x352d93){return new BPromise(function(_0x36efec,_0x282498){return client[_0xd7aa('0xa')](_0x21bbca,_0x352d93)[_0xd7aa('0xb')](function(_0x42f83c){logger[_0xd7aa('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x47e208,_0xd7aa('0xd'));logger[_0xd7aa('0xe')](_0xd7aa('0xf'),_0x47e208,'request\x20sent',JSON[_0xd7aa('0x10')](_0x42f83c));if(_0x42f83c[_0xd7aa('0x11')]){if(_0x42f83c[_0xd7aa('0x11')]['code']===0x1f4){logger[_0xd7aa('0x11')]('ZohoAccount,\x20%s,\x20%s',_0x47e208,_0x42f83c[_0xd7aa('0x11')][_0xd7aa('0x12')]);return _0x282498(_0x42f83c[_0xd7aa('0x11')][_0xd7aa('0x12')]);}logger['error'](_0xd7aa('0x13'),_0x47e208,_0x42f83c[_0xd7aa('0x11')][_0xd7aa('0x12')]);return _0x36efec(_0x42f83c['error'][_0xd7aa('0x12')]);}else{logger[_0xd7aa('0xc')](_0xd7aa('0x13'),_0x47e208,_0xd7aa('0xd'));_0x36efec(_0x42f83c[_0xd7aa('0x14')][_0xd7aa('0x12')]);}})[_0xd7aa('0x15')](function(_0x5f4eb3){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x47e208,_0x5f4eb3);_0x282498(_0x5f4eb3);});});}exports['GetZohoAccount']=function(_0x3d0266){var _0x1c1d55=this;return new Promise(function(_0x59313a,_0x1d9a81){return db[_0xd7aa('0x16')][_0xd7aa('0x17')]({'raw':_0x3d0266[_0xd7aa('0x18')]?_0x3d0266[_0xd7aa('0x18')][_0xd7aa('0x19')]===undefined?!![]:![]:!![],'where':_0x3d0266[_0xd7aa('0x18')]?_0x3d0266[_0xd7aa('0x18')][_0xd7aa('0x1a')]||null:null,'attributes':_0x3d0266[_0xd7aa('0x18')]?_0x3d0266[_0xd7aa('0x18')]['attributes']||null:null,'limit':_0x3d0266['options']?_0x3d0266[_0xd7aa('0x18')]['limit']||null:null,'include':_0x3d0266[_0xd7aa('0x18')]?_0x3d0266[_0xd7aa('0x18')][_0xd7aa('0x1b')]?_['map'](_0x3d0266[_0xd7aa('0x18')][_0xd7aa('0x1b')],function(_0x6cebe0){return{'model':db[_0x6cebe0[_0xd7aa('0x1c')]],'as':_0x6cebe0['as'],'attributes':_0x6cebe0[_0xd7aa('0x1d')],'include':_0x6cebe0[_0xd7aa('0x1b')]?_['map'](_0x6cebe0[_0xd7aa('0x1b')],function(_0x285952){return{'model':db[_0x285952[_0xd7aa('0x1c')]],'as':_0x285952['as'],'attributes':_0x285952[_0xd7aa('0x1d')],'include':_0x285952[_0xd7aa('0x1b')]?_['map'](_0x285952[_0xd7aa('0x1b')],function(_0x542a9e){return{'model':db[_0x542a9e['model']],'as':_0x542a9e['as'],'attributes':_0x542a9e['attributes']};}):[]};}):[]};}):[]:[]})[_0xd7aa('0xb')](function(_0x542793){logger['info'](_0xd7aa('0x1e'),_0x3d0266);logger['debug'](_0xd7aa('0x1e'),_0x3d0266,JSON[_0xd7aa('0x10')](_0x542793));_0x59313a(_0x542793);})[_0xd7aa('0x15')](function(_0x192b40){logger[_0xd7aa('0x11')](_0xd7aa('0x1e'),_0x192b40[_0xd7aa('0x12')],_0x3d0266);_0x1d9a81(_0x1c1d55[_0xd7aa('0x11')](0x1f4,_0x192b40[_0xd7aa('0x12')]));});});};exports[_0xd7aa('0x1f')]=function(_0x5dca3d){var _0x190438=this;return new Promise(function(_0x30be9c,_0x2f7fd6){return db[_0xd7aa('0x16')][_0xd7aa('0x20')]({'raw':_0x5dca3d['options']?_0x5dca3d[_0xd7aa('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5dca3d['options']?_0x5dca3d[_0xd7aa('0x18')][_0xd7aa('0x1a')]||null:null,'attributes':_0x5dca3d[_0xd7aa('0x18')]?_0x5dca3d[_0xd7aa('0x18')][_0xd7aa('0x1d')]||null:null,'include':_0x5dca3d['options']?_0x5dca3d[_0xd7aa('0x18')][_0xd7aa('0x1b')]?_['map'](_0x5dca3d[_0xd7aa('0x18')][_0xd7aa('0x1b')],function(_0x2653c3){return{'model':db[_0x2653c3[_0xd7aa('0x1c')]],'as':_0x2653c3['as'],'attributes':_0x2653c3['attributes'],'include':_0x2653c3[_0xd7aa('0x1b')]?_[_0xd7aa('0x21')](_0x2653c3[_0xd7aa('0x1b')],function(_0x47adea){return{'model':db[_0x47adea[_0xd7aa('0x1c')]],'as':_0x47adea['as'],'attributes':_0x47adea[_0xd7aa('0x1d')],'include':_0x47adea[_0xd7aa('0x1b')]?_[_0xd7aa('0x21')](_0x47adea[_0xd7aa('0x1b')],function(_0x2bdd2d){return{'model':db[_0x2bdd2d['model']],'as':_0x2bdd2d['as'],'attributes':_0x2bdd2d[_0xd7aa('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd7aa('0xb')](function(_0x4612ea){logger[_0xd7aa('0xc')](_0xd7aa('0x1f'),_0x5dca3d);logger['debug']('ShowZohoAccount',_0x5dca3d,JSON[_0xd7aa('0x10')](_0x4612ea));_0x30be9c(_0x4612ea);})[_0xd7aa('0x15')](function(_0xad91dc){logger[_0xd7aa('0x11')](_0xd7aa('0x1f'),_0xad91dc[_0xd7aa('0x12')],_0x5dca3d);_0x2f7fd6(_0x190438[_0xd7aa('0x11')](0x1f4,_0xad91dc[_0xd7aa('0x12')]));});});}; \ No newline at end of file +var _0xce6b=['message','GetZohoAccount','ZohoAccount','options','raw','where','attributes','limit','map','include','model','catch','ShowZohoAccount','find','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x34ab65,_0x356d84){var _0x31532c=function(_0x23761b){while(--_0x23761b){_0x34ab65['push'](_0x34ab65['shift']());}};_0x31532c(++_0x356d84);}(_0xce6b,0x8e));var _0xbce6=function(_0x4eb3de,_0x14d1dc){_0x4eb3de=_0x4eb3de-0x0;var _0x21bf07=_0xce6b[_0x4eb3de];return _0x21bf07;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbce6('0x0'));var BPromise=require(_0xbce6('0x1'));var rs=require(_0xbce6('0x2'));var fs=require('fs');var Redis=require(_0xbce6('0x3'));var db=require(_0xbce6('0x4'))['db'];var utils=require(_0xbce6('0x5'));var logger=require(_0xbce6('0x6'))(_0xbce6('0x7'));var config=require(_0xbce6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbce6('0x9')][_0xbce6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x126425,_0x355f14,_0x12d0d1){return new BPromise(function(_0x13abd5,_0x47d8d7){return client['request'](_0x126425,_0x12d0d1)[_0xbce6('0xb')](function(_0x4a03b5){logger[_0xbce6('0xc')](_0xbce6('0xd'),_0x355f14,_0xbce6('0xe'));logger[_0xbce6('0xf')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x355f14,_0xbce6('0xe'),JSON[_0xbce6('0x10')](_0x4a03b5));if(_0x4a03b5[_0xbce6('0x11')]){if(_0x4a03b5['error']['code']===0x1f4){logger['error'](_0xbce6('0xd'),_0x355f14,_0x4a03b5['error'][_0xbce6('0x12')]);return _0x47d8d7(_0x4a03b5['error'][_0xbce6('0x12')]);}logger['error'](_0xbce6('0xd'),_0x355f14,_0x4a03b5[_0xbce6('0x11')][_0xbce6('0x12')]);return _0x13abd5(_0x4a03b5[_0xbce6('0x11')][_0xbce6('0x12')]);}else{logger[_0xbce6('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x355f14,_0xbce6('0xe'));_0x13abd5(_0x4a03b5['result']['message']);}})['catch'](function(_0x5839ed){logger[_0xbce6('0x11')]('ZohoAccount,\x20%s,\x20%s',_0x355f14,_0x5839ed);_0x47d8d7(_0x5839ed);});});}exports[_0xbce6('0x13')]=function(_0x2bf9ea){var _0x4b94e0=this;return new Promise(function(_0x2c69c9,_0x7dccdb){return db[_0xbce6('0x14')]['findAll']({'raw':_0x2bf9ea[_0xbce6('0x15')]?_0x2bf9ea[_0xbce6('0x15')][_0xbce6('0x16')]===undefined?!![]:![]:!![],'where':_0x2bf9ea[_0xbce6('0x15')]?_0x2bf9ea[_0xbce6('0x15')][_0xbce6('0x17')]||null:null,'attributes':_0x2bf9ea[_0xbce6('0x15')]?_0x2bf9ea['options'][_0xbce6('0x18')]||null:null,'limit':_0x2bf9ea[_0xbce6('0x15')]?_0x2bf9ea[_0xbce6('0x15')][_0xbce6('0x19')]||null:null,'include':_0x2bf9ea[_0xbce6('0x15')]?_0x2bf9ea[_0xbce6('0x15')]['include']?_[_0xbce6('0x1a')](_0x2bf9ea['options'][_0xbce6('0x1b')],function(_0x5ceff9){return{'model':db[_0x5ceff9[_0xbce6('0x1c')]],'as':_0x5ceff9['as'],'attributes':_0x5ceff9[_0xbce6('0x18')],'include':_0x5ceff9[_0xbce6('0x1b')]?_['map'](_0x5ceff9[_0xbce6('0x1b')],function(_0x4a6c11){return{'model':db[_0x4a6c11[_0xbce6('0x1c')]],'as':_0x4a6c11['as'],'attributes':_0x4a6c11[_0xbce6('0x18')],'include':_0x4a6c11['include']?_[_0xbce6('0x1a')](_0x4a6c11[_0xbce6('0x1b')],function(_0x48ae24){return{'model':db[_0x48ae24[_0xbce6('0x1c')]],'as':_0x48ae24['as'],'attributes':_0x48ae24[_0xbce6('0x18')]};}):[]};}):[]};}):[]:[]})[_0xbce6('0xb')](function(_0xf34ff6){logger[_0xbce6('0xc')]('GetZohoAccount',_0x2bf9ea);logger[_0xbce6('0xf')](_0xbce6('0x13'),_0x2bf9ea,JSON['stringify'](_0xf34ff6));_0x2c69c9(_0xf34ff6);})[_0xbce6('0x1d')](function(_0x4a0010){logger[_0xbce6('0x11')](_0xbce6('0x13'),_0x4a0010['message'],_0x2bf9ea);_0x7dccdb(_0x4b94e0[_0xbce6('0x11')](0x1f4,_0x4a0010[_0xbce6('0x12')]));});});};exports[_0xbce6('0x1e')]=function(_0x200407){var _0x1a17be=this;return new Promise(function(_0x2e7271,_0x1b5413){return db[_0xbce6('0x14')][_0xbce6('0x1f')]({'raw':_0x200407[_0xbce6('0x15')]?_0x200407[_0xbce6('0x15')][_0xbce6('0x16')]===undefined?!![]:![]:!![],'where':_0x200407['options']?_0x200407[_0xbce6('0x15')][_0xbce6('0x17')]||null:null,'attributes':_0x200407[_0xbce6('0x15')]?_0x200407[_0xbce6('0x15')][_0xbce6('0x18')]||null:null,'include':_0x200407[_0xbce6('0x15')]?_0x200407[_0xbce6('0x15')][_0xbce6('0x1b')]?_['map'](_0x200407['options'][_0xbce6('0x1b')],function(_0x528b9b){return{'model':db[_0x528b9b[_0xbce6('0x1c')]],'as':_0x528b9b['as'],'attributes':_0x528b9b[_0xbce6('0x18')],'include':_0x528b9b[_0xbce6('0x1b')]?_[_0xbce6('0x1a')](_0x528b9b['include'],function(_0x5ecc5b){return{'model':db[_0x5ecc5b[_0xbce6('0x1c')]],'as':_0x5ecc5b['as'],'attributes':_0x5ecc5b[_0xbce6('0x18')],'include':_0x5ecc5b[_0xbce6('0x1b')]?_[_0xbce6('0x1a')](_0x5ecc5b['include'],function(_0x211c46){return{'model':db[_0x211c46['model']],'as':_0x211c46['as'],'attributes':_0x211c46[_0xbce6('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x56b5bd){logger[_0xbce6('0xc')]('ShowZohoAccount',_0x200407);logger[_0xbce6('0xf')]('ShowZohoAccount',_0x200407,JSON[_0xbce6('0x10')](_0x56b5bd));_0x2e7271(_0x56b5bd);})['catch'](function(_0x2afa65){logger['error']('ShowZohoAccount',_0x2afa65[_0xbce6('0x12')],_0x200407);_0x1b5413(_0x1a17be[_0xbce6('0x11')](0x1f4,_0x2afa65[_0xbce6('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index dc7b2e7..14398f0 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 _0x6d2d=['/:id','delete','destroy','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put'];(function(_0x2130f2,_0x1df01f){var _0x358d2f=function(_0x3744e2){while(--_0x3744e2){_0x2130f2['push'](_0x2130f2['shift']());}};_0x358d2f(++_0x1df01f);}(_0x6d2d,0xbc));var _0xd6d2=function(_0x53c8cb,_0x73348b){_0x53c8cb=_0x53c8cb-0x0;var _0x2ebc37=_0x6d2d[_0x53c8cb];return _0x2ebc37;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd6d2('0x0'));var timeout=require(_0xd6d2('0x1'));var express=require(_0xd6d2('0x2'));var router=express['Router']();var auth=require(_0xd6d2('0x3'));var interaction=require(_0xd6d2('0x4'));var config=require(_0xd6d2('0x5'));var controller=require(_0xd6d2('0x6'));router[_0xd6d2('0x7')]('/',auth[_0xd6d2('0x8')](),controller[_0xd6d2('0x9')]);router[_0xd6d2('0x7')]('/:id',auth[_0xd6d2('0x8')](),controller[_0xd6d2('0xa')]);router[_0xd6d2('0x7')]('/:id/fields',auth[_0xd6d2('0x8')](),controller[_0xd6d2('0xb')]);router[_0xd6d2('0x7')](_0xd6d2('0xc'),auth[_0xd6d2('0x8')](),controller[_0xd6d2('0xd')]);router[_0xd6d2('0x7')](_0xd6d2('0xe'),auth['isAuthenticated'](),controller[_0xd6d2('0xf')]);router[_0xd6d2('0x10')]('/',auth[_0xd6d2('0x8')](),controller[_0xd6d2('0x11')]);router[_0xd6d2('0x12')](_0xd6d2('0x13'),auth[_0xd6d2('0x8')](),controller['update']);router[_0xd6d2('0x14')](_0xd6d2('0x13'),auth[_0xd6d2('0x8')](),controller[_0xd6d2('0x15')]);module[_0xd6d2('0x16')]=router; \ No newline at end of file +var _0xad13=['/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index'];(function(_0xf16f5f,_0x97e376){var _0x15bdfa=function(_0x52efb9){while(--_0x52efb9){_0xf16f5f['push'](_0xf16f5f['shift']());}};_0x15bdfa(++_0x97e376);}(_0xad13,0x79));var _0x3ad1=function(_0x576ab3,_0x173592){_0x576ab3=_0x576ab3-0x0;var _0x3f025c=_0xad13[_0x576ab3];return _0x3f025c;};'use strict';var multer=require(_0x3ad1('0x0'));var util=require('util');var path=require(_0x3ad1('0x1'));var timeout=require(_0x3ad1('0x2'));var express=require(_0x3ad1('0x3'));var router=express[_0x3ad1('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x3ad1('0x5'));var config=require(_0x3ad1('0x6'));var controller=require(_0x3ad1('0x7'));router[_0x3ad1('0x8')]('/',auth[_0x3ad1('0x9')](),controller[_0x3ad1('0xa')]);router[_0x3ad1('0x8')](_0x3ad1('0xb'),auth[_0x3ad1('0x9')](),controller[_0x3ad1('0xc')]);router['get'](_0x3ad1('0xd'),auth[_0x3ad1('0x9')](),controller[_0x3ad1('0xe')]);router['get'](_0x3ad1('0xf'),auth[_0x3ad1('0x9')](),controller['getSubjects']);router[_0x3ad1('0x8')](_0x3ad1('0x10'),auth[_0x3ad1('0x9')](),controller[_0x3ad1('0x11')]);router[_0x3ad1('0x12')]('/',auth[_0x3ad1('0x9')](),controller['create']);router['put'](_0x3ad1('0xb'),auth[_0x3ad1('0x9')](),controller[_0x3ad1('0x13')]);router[_0x3ad1('0x14')]('/:id',auth[_0x3ad1('0x9')](),controller['destroy']);module[_0x3ad1('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 4256857..ae96fd4 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 _0x36de=['exports','ENUM','lead','nothing','contact_lead','contact','STRING','sequelize'];(function(_0x1b38ec,_0x13ec29){var _0x523f01=function(_0x17424a){while(--_0x17424a){_0x1b38ec['push'](_0x1b38ec['shift']());}};_0x523f01(++_0x13ec29);}(_0x36de,0xe7));var _0xe36d=function(_0x2bf521,_0x3e6103){_0x2bf521=_0x2bf521-0x0;var _0x1ca2e4=_0x36de[_0x2bf521];return _0x1ca2e4;};'use strict';var Sequelize=require(_0xe36d('0x0'));module[_0xe36d('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0xe36d('0x2')](_0xe36d('0x3'),'contact',_0xe36d('0x4')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0xe36d('0x2')](_0xe36d('0x5'),_0xe36d('0x6'),_0xe36d('0x3')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0xe36d('0x7')]}}; \ No newline at end of file +var _0xc6d9=['contact_lead','contact','sequelize','exports','STRING','ENUM','lead','nothing'];(function(_0x7dbd65,_0x18da49){var _0x33d551=function(_0x7ce789){while(--_0x7ce789){_0x7dbd65['push'](_0x7dbd65['shift']());}};_0x33d551(++_0x18da49);}(_0xc6d9,0x15a));var _0x9c6d=function(_0xf5e4b0,_0x337348){_0xf5e4b0=_0xf5e4b0-0x0;var _0x24783b=_0xc6d9[_0xf5e4b0];return _0x24783b;};'use strict';var Sequelize=require(_0x9c6d('0x0'));module[_0x9c6d('0x1')]={'name':{'type':Sequelize[_0x9c6d('0x2')]},'moduleCreate':{'type':Sequelize[_0x9c6d('0x3')](_0x9c6d('0x4'),'contact',_0x9c6d('0x5')),'defaultValue':_0x9c6d('0x4')},'moduleSearch':{'type':Sequelize[_0x9c6d('0x3')](_0x9c6d('0x6'),_0x9c6d('0x7'),_0x9c6d('0x4')),'defaultValue':_0x9c6d('0x6')},'description':{'type':Sequelize[_0x9c6d('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 1dc0714..c098070 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 _0x3e74=['keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','filter','merge','options','ZohoConfiguration','include','findAll','rawAttributes','length','create','body','find','destroy','getFields','findOne','params','ZohoField','getSubjects','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','jayson/promise','client','http','test','Sequelize','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','send','map','fieldName','type','key','model','name','query'];(function(_0x4abfef,_0x2adf4a){var _0x302c24=function(_0x27cc35){while(--_0x27cc35){_0x4abfef['push'](_0x4abfef['shift']());}};_0x302c24(++_0x2adf4a);}(_0x3e74,0x175));var _0x43e7=function(_0x2a70b1,_0x14ba14){_0x2a70b1=_0x2a70b1-0x0;var _0x24cdb4=_0x3e74[_0x2a70b1];return _0x24cdb4;};'use strict';var pdf=require(_0x43e7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x43e7('0x1'));var zipdir=require(_0x43e7('0x2'));var jsonpatch=require(_0x43e7('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x43e7('0x4'));var Mustache=require('mustache');var util=require(_0x43e7('0x5'));var path=require(_0x43e7('0x6'));var sox=require(_0x43e7('0x7'));var csv=require(_0x43e7('0x8'));var ejs=require(_0x43e7('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x8'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var db=require('../../mysqldb')['db'];var jayson=require(_0x43e7('0x14'));var client=jayson[_0x43e7('0x15')][_0x43e7('0x16')]({'port':0x232a});function checkPasswordPattern(_0x3bb83f,_0x4e008c,_0x583d85){if(_0x583d85){var _0x2fcb36=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2fcb36[_0x43e7('0x17')](_0x4e008c)){return _0x3bb83f;}else{throw new db[(_0x43e7('0x18'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x3bb83f;}}function respondWithRpcPromise(_0x16849c,_0x14c146,_0x203378,_0x328445){return new BPromise(function(_0x4de324,_0x5c4eaa){var _0xdf16c=_0x328445||client;return _0xdf16c[_0x43e7('0x19')](_0x16849c,_0x203378)[_0x43e7('0x1a')](function(_0x5d346f){logger['info'](_0x43e7('0x1b'),_0x14c146,_0x43e7('0x1c'));logger[_0x43e7('0x1d')](_0x43e7('0x1e'),_0x14c146,_0x43e7('0x1c'),JSON[_0x43e7('0x1f')](_0x5d346f));if(_0x5d346f[_0x43e7('0x20')]){if(_0x5d346f[_0x43e7('0x20')][_0x43e7('0x21')]===0x1f4){logger[_0x43e7('0x20')](_0x43e7('0x1b'),_0x14c146,_0x5d346f[_0x43e7('0x20')]['message']);return _0x5c4eaa(_0x5d346f[_0x43e7('0x20')][_0x43e7('0x22')]);}logger['error'](_0x43e7('0x1b'),_0x14c146,_0x5d346f[_0x43e7('0x20')][_0x43e7('0x22')]);return _0x4de324(_0x5d346f[_0x43e7('0x20')][_0x43e7('0x22')]);}else{logger[_0x43e7('0x23')]('ZohoConfiguration,\x20%s,\x20%s',_0x14c146,_0x43e7('0x1c'));_0x4de324(_0x5d346f['result']['message']);}})[_0x43e7('0x24')](function(_0x43f4ff){logger['error'](_0x43e7('0x1b'),_0x14c146,_0x43f4ff);_0x5c4eaa(_0x43f4ff);});});}function respondWithStatusCode(_0x4ca5cf,_0x326dab){_0x326dab=_0x326dab||0xcc;return function(_0x5c5e67){if(_0x5c5e67){return _0x4ca5cf[_0x43e7('0x25')](_0x326dab);}return _0x4ca5cf[_0x43e7('0x26')](_0x326dab)[_0x43e7('0x27')]();};}function respondWithResult(_0x405f85,_0x51f4d7){_0x51f4d7=_0x51f4d7||0xc8;return function(_0x52b7b3){if(_0x52b7b3){return _0x405f85[_0x43e7('0x26')](_0x51f4d7)['json'](_0x52b7b3);}};}function respondWithFilteredResult(_0x2dd5f,_0x40dc8f){return function(_0x3565cf){if(_0x3565cf){var _0xb1fc63=_0x3565cf[_0x43e7('0x28')],_0x5087d7=_0x40dc8f[_0x43e7('0x29')],_0x33a1a5=_0x40dc8f[_0x43e7('0x29')]+_0x40dc8f[_0x43e7('0x2a')],_0x4690a6;if(_0x33a1a5>=_0xb1fc63){_0x33a1a5=_0xb1fc63;_0x4690a6=0xc8;}else{_0x4690a6=0xce;}_0x2dd5f[_0x43e7('0x26')](_0x4690a6);return _0x2dd5f[_0x43e7('0x2b')](_0x43e7('0x2c'),_0x5087d7+'-'+_0x33a1a5+'/'+_0xb1fc63)[_0x43e7('0x2d')](_0x3565cf);}return null;};}function patchUpdates(_0x17df44){return function(_0x19725a){try{jsonpatch[_0x43e7('0x2e')](_0x19725a,_0x17df44,!![]);}catch(_0x208706){return BPromise['reject'](_0x208706);}return _0x19725a[_0x43e7('0x2f')]();};}function saveUpdates(_0x44f6b0,_0x3b8f78){return function(_0x183c81){if(_0x183c81){return _0x183c81[_0x43e7('0x30')](_0x44f6b0)['then'](function(_0x1eba65){return _0x1eba65;});}return null;};}function removeEntity(_0x49b83d,_0x30d47e){return function(_0x3f280d){if(_0x3f280d){return _0x3f280d['destroy']()['then'](function(){_0x49b83d['status'](0xcc)[_0x43e7('0x27')]();});}};}function handleEntityNotFound(_0xbe6e28,_0x117c07){return function(_0x234fe6){if(!_0x234fe6){_0xbe6e28[_0x43e7('0x25')](0x194);}return _0x234fe6;};}function handleError(_0xde7ed,_0x485c6c){_0x485c6c=_0x485c6c||0x1f4;return function(_0x47baee){logger['error'](_0x47baee['stack']);if(_0x47baee['name']){delete _0x47baee['name'];}_0xde7ed['status'](_0x485c6c)[_0x43e7('0x31')](_0x47baee);};}exports['index']=function(_0x2b4bfd,_0x8e9f40){var _0x31bc78={},_0x50a2d0={},_0x40f72f={'count':0x0,'rows':[]};var _0x449803=_[_0x43e7('0x32')](db['ZohoConfiguration']['rawAttributes'],function(_0x5d84f4){return{'name':_0x5d84f4[_0x43e7('0x33')],'type':_0x5d84f4[_0x43e7('0x34')][_0x43e7('0x35')]};});_0x50a2d0[_0x43e7('0x36')]=_[_0x43e7('0x32')](_0x449803,_0x43e7('0x37'));_0x50a2d0[_0x43e7('0x38')]=_[_0x43e7('0x39')](_0x2b4bfd['query']);_0x50a2d0[_0x43e7('0x3a')]=_[_0x43e7('0x3b')](_0x50a2d0['model'],_0x50a2d0[_0x43e7('0x38')]);_0x31bc78['attributes']=_[_0x43e7('0x3b')](_0x50a2d0[_0x43e7('0x36')],qs[_0x43e7('0x3c')](_0x2b4bfd[_0x43e7('0x38')][_0x43e7('0x3c')]));_0x31bc78[_0x43e7('0x3d')]=_0x31bc78['attributes']['length']?_0x31bc78[_0x43e7('0x3d')]:_0x50a2d0[_0x43e7('0x36')];if(!_0x2b4bfd[_0x43e7('0x38')][_0x43e7('0x3e')](_0x43e7('0x3f'))){_0x31bc78['limit']=qs[_0x43e7('0x2a')](_0x2b4bfd[_0x43e7('0x38')]['limit']);_0x31bc78[_0x43e7('0x29')]=qs['offset'](_0x2b4bfd[_0x43e7('0x38')]['offset']);}_0x31bc78[_0x43e7('0x40')]=qs[_0x43e7('0x41')](_0x2b4bfd[_0x43e7('0x38')][_0x43e7('0x41')]);_0x31bc78['where']=qs['filters'](_[_0x43e7('0x42')](_0x2b4bfd[_0x43e7('0x38')],_0x50a2d0[_0x43e7('0x3a')]));if(_0x2b4bfd[_0x43e7('0x38')]['filter']){_0x31bc78['where']=_['merge'](_0x31bc78[_0x43e7('0x43')],{'$or':_['map'](_0x449803,function(_0x2ab022){if(_0x2ab022['type']!=='VIRTUAL'){var _0x46b2e6={};_0x46b2e6[_0x2ab022['name']]={'$like':'%'+_0x2b4bfd[_0x43e7('0x38')][_0x43e7('0x44')]+'%'};return _0x46b2e6;}})});}_0x31bc78=_[_0x43e7('0x45')]({},_0x31bc78,_0x2b4bfd[_0x43e7('0x46')]);var _0x4fc5e8={'where':_0x31bc78[_0x43e7('0x43')]};return db[_0x43e7('0x47')][_0x43e7('0x28')](_0x4fc5e8)[_0x43e7('0x1a')](function(_0x296dc8){_0x40f72f[_0x43e7('0x28')]=_0x296dc8;if(_0x2b4bfd['query']['includeAll']){_0x31bc78[_0x43e7('0x48')]=[{'all':!![]}];}return db[_0x43e7('0x47')][_0x43e7('0x49')](_0x31bc78);})['then'](function(_0x5c1c18){_0x40f72f['rows']=_0x5c1c18;return _0x40f72f;})[_0x43e7('0x1a')](respondWithFilteredResult(_0x8e9f40,_0x31bc78))[_0x43e7('0x24')](handleError(_0x8e9f40,null));};exports['show']=function(_0x351ca2,_0x47686e){var _0x3c96fe={'raw':![],'where':{'id':_0x351ca2['params']['id']}},_0x560329={};_0x560329['model']=_['keys'](db[_0x43e7('0x47')][_0x43e7('0x4a')]);_0x560329['query']=_[_0x43e7('0x39')](_0x351ca2[_0x43e7('0x38')]);_0x560329[_0x43e7('0x3a')]=_[_0x43e7('0x3b')](_0x560329['model'],_0x560329[_0x43e7('0x38')]);_0x3c96fe['attributes']=_['intersection'](_0x560329[_0x43e7('0x36')],qs[_0x43e7('0x3c')](_0x351ca2[_0x43e7('0x38')][_0x43e7('0x3c')]));_0x3c96fe[_0x43e7('0x3d')]=_0x3c96fe[_0x43e7('0x3d')][_0x43e7('0x4b')]?_0x3c96fe[_0x43e7('0x3d')]:_0x560329[_0x43e7('0x36')];if(_0x351ca2[_0x43e7('0x38')]['includeAll']){_0x3c96fe[_0x43e7('0x48')]=[{'all':!![]}];}_0x3c96fe=_[_0x43e7('0x45')]({},_0x3c96fe,_0x351ca2['options']);return db[_0x43e7('0x47')]['find'](_0x3c96fe)[_0x43e7('0x1a')](handleEntityNotFound(_0x47686e,null))[_0x43e7('0x1a')](respondWithResult(_0x47686e,null))[_0x43e7('0x24')](handleError(_0x47686e,null));};exports[_0x43e7('0x4c')]=function(_0xfe13fa,_0x5e5556){return db['ZohoConfiguration'][_0x43e7('0x4c')](_0xfe13fa[_0x43e7('0x4d')],{})[_0x43e7('0x1a')](respondWithResult(_0x5e5556,0xc9))[_0x43e7('0x24')](handleError(_0x5e5556,null));};exports[_0x43e7('0x30')]=function(_0x25bb44,_0xa47464){if(_0x25bb44[_0x43e7('0x4d')]['id']){delete _0x25bb44[_0x43e7('0x4d')]['id'];}return db[_0x43e7('0x47')][_0x43e7('0x4e')]({'where':{'id':_0x25bb44['params']['id']}})[_0x43e7('0x1a')](handleEntityNotFound(_0xa47464,null))[_0x43e7('0x1a')](saveUpdates(_0x25bb44['body'],null))[_0x43e7('0x1a')](respondWithResult(_0xa47464,null))[_0x43e7('0x24')](handleError(_0xa47464,null));};exports[_0x43e7('0x4f')]=function(_0x558d54,_0x5d63c6){return db[_0x43e7('0x47')][_0x43e7('0x4e')]({'where':{'id':_0x558d54['params']['id']}})[_0x43e7('0x1a')](handleEntityNotFound(_0x5d63c6,null))['then'](removeEntity(_0x5d63c6,null))['catch'](handleError(_0x5d63c6,null));};exports[_0x43e7('0x50')]=function(_0x4b6b7f,_0x1f7c02,_0x40155c){var _0x68697={};var _0x4dfdb0={};var _0xc3976;var _0xdb9fbe;return db['ZohoConfiguration'][_0x43e7('0x51')]({'where':{'id':_0x4b6b7f[_0x43e7('0x52')]['id']}})[_0x43e7('0x1a')](handleEntityNotFound(_0x1f7c02,null))['then'](function(_0x5a4c95){if(_0x5a4c95){_0xc3976=_0x5a4c95;_0x4dfdb0['model']=_[_0x43e7('0x39')](db[_0x43e7('0x53')][_0x43e7('0x4a')]);_0x4dfdb0[_0x43e7('0x38')]=_['keys'](_0x4b6b7f['query']);_0x4dfdb0[_0x43e7('0x3a')]=_[_0x43e7('0x3b')](_0x4dfdb0[_0x43e7('0x36')],_0x4dfdb0[_0x43e7('0x38')]);_0x68697['attributes']=_[_0x43e7('0x3b')](_0x4dfdb0[_0x43e7('0x36')],qs[_0x43e7('0x3c')](_0x4b6b7f[_0x43e7('0x38')][_0x43e7('0x3c')]));_0x68697[_0x43e7('0x3d')]=_0x68697[_0x43e7('0x3d')][_0x43e7('0x4b')]?_0x68697[_0x43e7('0x3d')]:_0x4dfdb0[_0x43e7('0x36')];_0x68697[_0x43e7('0x40')]=qs['sort'](_0x4b6b7f['query'][_0x43e7('0x41')]);_0x68697['where']=qs['filters'](_['pick'](_0x4b6b7f[_0x43e7('0x38')],_0x4dfdb0[_0x43e7('0x3a')]));if(_0x4b6b7f['query'][_0x43e7('0x44')]){_0x68697[_0x43e7('0x43')]=_[_0x43e7('0x45')](_0x68697['where'],{'$or':_[_0x43e7('0x32')](_0x68697[_0x43e7('0x3d')],function(_0x289f86){var _0xc9723={};_0xc9723[_0x289f86]={'$like':'%'+_0x4b6b7f[_0x43e7('0x38')][_0x43e7('0x44')]+'%'};return _0xc9723;})});}_0x68697=_[_0x43e7('0x45')]({},_0x68697,_0x4b6b7f['options']);return _0xc3976[_0x43e7('0x50')](_0x68697);}})[_0x43e7('0x1a')](function(_0x415f26){if(_0x415f26){_0xdb9fbe=_0x415f26['length'];if(!_0x4b6b7f['query'][_0x43e7('0x3e')]('nolimit')){_0x68697['limit']=qs[_0x43e7('0x2a')](_0x4b6b7f[_0x43e7('0x38')]['limit']);_0x68697[_0x43e7('0x29')]=qs[_0x43e7('0x29')](_0x4b6b7f[_0x43e7('0x38')][_0x43e7('0x29')]);}return _0xc3976[_0x43e7('0x50')](_0x68697);}})[_0x43e7('0x1a')](function(_0x398a78){if(_0x398a78){return _0x398a78?{'count':_0xdb9fbe,'rows':_0x398a78}:null;}})['then'](respondWithResult(_0x1f7c02,null))[_0x43e7('0x24')](handleError(_0x1f7c02,null));};exports[_0x43e7('0x54')]=function(_0x4e5956,_0x418213,_0x5c2c5f){var _0x26ee52={};var _0x248936={};var _0x37301b;var _0x1ca24b;return db['ZohoConfiguration'][_0x43e7('0x51')]({'where':{'id':_0x4e5956[_0x43e7('0x52')]['id']}})[_0x43e7('0x1a')](handleEntityNotFound(_0x418213,null))['then'](function(_0x17889c){if(_0x17889c){_0x37301b=_0x17889c;_0x248936[_0x43e7('0x36')]=_[_0x43e7('0x39')](db[_0x43e7('0x53')][_0x43e7('0x4a')]);_0x248936['query']=_[_0x43e7('0x39')](_0x4e5956[_0x43e7('0x38')]);_0x248936[_0x43e7('0x3a')]=_[_0x43e7('0x3b')](_0x248936[_0x43e7('0x36')],_0x248936[_0x43e7('0x38')]);_0x26ee52[_0x43e7('0x3d')]=_['intersection'](_0x248936['model'],qs[_0x43e7('0x3c')](_0x4e5956['query']['fields']));_0x26ee52['attributes']=_0x26ee52[_0x43e7('0x3d')][_0x43e7('0x4b')]?_0x26ee52[_0x43e7('0x3d')]:_0x248936[_0x43e7('0x36')];_0x26ee52[_0x43e7('0x40')]=qs[_0x43e7('0x41')](_0x4e5956['query'][_0x43e7('0x41')]);_0x26ee52[_0x43e7('0x43')]=qs[_0x43e7('0x3a')](_['pick'](_0x4e5956[_0x43e7('0x38')],_0x248936[_0x43e7('0x3a')]));if(_0x4e5956[_0x43e7('0x38')][_0x43e7('0x44')]){_0x26ee52[_0x43e7('0x43')]=_[_0x43e7('0x45')](_0x26ee52[_0x43e7('0x43')],{'$or':_[_0x43e7('0x32')](_0x26ee52['attributes'],function(_0x52c757){var _0x55990c={};_0x55990c[_0x52c757]={'$like':'%'+_0x4e5956[_0x43e7('0x38')][_0x43e7('0x44')]+'%'};return _0x55990c;})});}_0x26ee52=_['merge']({},_0x26ee52,_0x4e5956[_0x43e7('0x46')]);return _0x37301b[_0x43e7('0x54')](_0x26ee52);}})[_0x43e7('0x1a')](function(_0x8e60f1){if(_0x8e60f1){_0x1ca24b=_0x8e60f1['length'];if(!_0x4e5956['query']['hasOwnProperty'](_0x43e7('0x3f'))){_0x26ee52[_0x43e7('0x2a')]=qs['limit'](_0x4e5956['query'][_0x43e7('0x2a')]);_0x26ee52[_0x43e7('0x29')]=qs[_0x43e7('0x29')](_0x4e5956['query'][_0x43e7('0x29')]);}return _0x37301b[_0x43e7('0x54')](_0x26ee52);}})[_0x43e7('0x1a')](function(_0xb04082){if(_0xb04082){return _0xb04082?{'count':_0x1ca24b,'rows':_0xb04082}:null;}})['then'](respondWithResult(_0x418213,null))[_0x43e7('0x24')](handleError(_0x418213,null));};exports['getDescriptions']=function(_0xa66309,_0x3ab790,_0x24a168){var _0x90667c={};var _0xa7cb2c={};var _0x45adef;var _0x126133;return db['ZohoConfiguration'][_0x43e7('0x51')]({'where':{'id':_0xa66309[_0x43e7('0x52')]['id']}})[_0x43e7('0x1a')](handleEntityNotFound(_0x3ab790,null))[_0x43e7('0x1a')](function(_0x550960){if(_0x550960){_0x45adef=_0x550960;_0xa7cb2c['model']=_['keys'](db[_0x43e7('0x53')]['rawAttributes']);_0xa7cb2c[_0x43e7('0x38')]=_[_0x43e7('0x39')](_0xa66309[_0x43e7('0x38')]);_0xa7cb2c[_0x43e7('0x3a')]=_[_0x43e7('0x3b')](_0xa7cb2c[_0x43e7('0x36')],_0xa7cb2c[_0x43e7('0x38')]);_0x90667c[_0x43e7('0x3d')]=_[_0x43e7('0x3b')](_0xa7cb2c[_0x43e7('0x36')],qs[_0x43e7('0x3c')](_0xa66309['query'][_0x43e7('0x3c')]));_0x90667c[_0x43e7('0x3d')]=_0x90667c[_0x43e7('0x3d')][_0x43e7('0x4b')]?_0x90667c[_0x43e7('0x3d')]:_0xa7cb2c['model'];_0x90667c['order']=qs[_0x43e7('0x41')](_0xa66309[_0x43e7('0x38')]['sort']);_0x90667c[_0x43e7('0x43')]=qs[_0x43e7('0x3a')](_['pick'](_0xa66309['query'],_0xa7cb2c[_0x43e7('0x3a')]));if(_0xa66309[_0x43e7('0x38')][_0x43e7('0x44')]){_0x90667c[_0x43e7('0x43')]=_[_0x43e7('0x45')](_0x90667c['where'],{'$or':_['map'](_0x90667c[_0x43e7('0x3d')],function(_0x18c438){var _0x3ce34b={};_0x3ce34b[_0x18c438]={'$like':'%'+_0xa66309[_0x43e7('0x38')]['filter']+'%'};return _0x3ce34b;})});}_0x90667c=_[_0x43e7('0x45')]({},_0x90667c,_0xa66309[_0x43e7('0x46')]);return _0x45adef[_0x43e7('0x55')](_0x90667c);}})[_0x43e7('0x1a')](function(_0x5bc060){if(_0x5bc060){_0x126133=_0x5bc060[_0x43e7('0x4b')];if(!_0xa66309[_0x43e7('0x38')][_0x43e7('0x3e')](_0x43e7('0x3f'))){_0x90667c[_0x43e7('0x2a')]=qs['limit'](_0xa66309[_0x43e7('0x38')][_0x43e7('0x2a')]);_0x90667c['offset']=qs[_0x43e7('0x29')](_0xa66309[_0x43e7('0x38')][_0x43e7('0x29')]);}return _0x45adef[_0x43e7('0x55')](_0x90667c);}})['then'](function(_0x3da183){if(_0x3da183){return _0x3da183?{'count':_0x126133,'rows':_0x3da183}:null;}})['then'](respondWithResult(_0x3ab790,null))[_0x43e7('0x24')](handleError(_0x3ab790,null));}; \ No newline at end of file +var _0xe14b=['info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','name','map','ZohoConfiguration','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch','body','getFields','findOne','ZohoField','order','getSubjects','getDescriptions','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','request','then'];(function(_0xf7c72a,_0x4bb071){var _0x483324=function(_0x36b75e){while(--_0x36b75e){_0xf7c72a['push'](_0xf7c72a['shift']());}};_0x483324(++_0x4bb071);}(_0xe14b,0x93));var _0xbe14=function(_0xbc46f9,_0x426f4f){_0xbc46f9=_0xbc46f9-0x0;var _0x1c7669=_0xe14b[_0xbc46f9];return _0x1c7669;};'use strict';var pdf=require(_0xbe14('0x0'));var emlformat=require(_0xbe14('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbe14('0x2'));var rp=require(_0xbe14('0x3'));var moment=require('moment');var BPromise=require(_0xbe14('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbe14('0x5'));var sox=require(_0xbe14('0x6'));var csv=require(_0xbe14('0x7'));var ejs=require(_0xbe14('0x8'));var fs=require('fs');var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var db=require(_0xbe14('0x14'))['db'];var jayson=require(_0xbe14('0x15'));var client=jayson[_0xbe14('0x16')][_0xbe14('0x17')]({'port':0x232a});function checkPasswordPattern(_0x23a730,_0x2850cb,_0x16893f){if(_0x16893f){var _0xa2cf72=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xa2cf72[_0xbe14('0x18')](_0x2850cb)){return _0x23a730;}else{throw new db[(_0xbe14('0x19'))][(_0xbe14('0x1a'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x23a730;}}function respondWithRpcPromise(_0x55b3a7,_0x3f58f5,_0x3dc4a9,_0xf4ac9){return new BPromise(function(_0x37ce4e,_0x4e8f34){var _0x21c789=_0xf4ac9||client;return _0x21c789[_0xbe14('0x1b')](_0x55b3a7,_0x3dc4a9)[_0xbe14('0x1c')](function(_0x123ede){logger[_0xbe14('0x1d')](_0xbe14('0x1e'),_0x3f58f5,_0xbe14('0x1f'));logger['debug'](_0xbe14('0x20'),_0x3f58f5,_0xbe14('0x1f'),JSON[_0xbe14('0x21')](_0x123ede));if(_0x123ede[_0xbe14('0x22')]){if(_0x123ede[_0xbe14('0x22')][_0xbe14('0x23')]===0x1f4){logger['error'](_0xbe14('0x1e'),_0x3f58f5,_0x123ede[_0xbe14('0x22')][_0xbe14('0x24')]);return _0x4e8f34(_0x123ede[_0xbe14('0x22')][_0xbe14('0x24')]);}logger['error'](_0xbe14('0x1e'),_0x3f58f5,_0x123ede['error'][_0xbe14('0x24')]);return _0x37ce4e(_0x123ede['error'][_0xbe14('0x24')]);}else{logger['info'](_0xbe14('0x1e'),_0x3f58f5,_0xbe14('0x1f'));_0x37ce4e(_0x123ede['result'][_0xbe14('0x24')]);}})['catch'](function(_0x4587a8){logger['error'](_0xbe14('0x1e'),_0x3f58f5,_0x4587a8);_0x4e8f34(_0x4587a8);});});}function respondWithStatusCode(_0x5fa043,_0x1ee9c1){_0x1ee9c1=_0x1ee9c1||0xcc;return function(_0x39cc81){if(_0x39cc81){return _0x5fa043[_0xbe14('0x25')](_0x1ee9c1);}return _0x5fa043[_0xbe14('0x26')](_0x1ee9c1)['end']();};}function respondWithResult(_0x1822e0,_0x1ba46a){_0x1ba46a=_0x1ba46a||0xc8;return function(_0x391556){if(_0x391556){return _0x1822e0[_0xbe14('0x26')](_0x1ba46a)['json'](_0x391556);}};}function respondWithFilteredResult(_0x16f884,_0x29fc64){return function(_0x59bf34){if(_0x59bf34){var _0x3c3613=_0x59bf34[_0xbe14('0x27')],_0x3b3e84=_0x29fc64[_0xbe14('0x28')],_0x1c7cc7=_0x29fc64[_0xbe14('0x28')]+_0x29fc64[_0xbe14('0x29')],_0x19252f;if(_0x1c7cc7>=_0x3c3613){_0x1c7cc7=_0x3c3613;_0x19252f=0xc8;}else{_0x19252f=0xce;}_0x16f884[_0xbe14('0x26')](_0x19252f);return _0x16f884[_0xbe14('0x2a')](_0xbe14('0x2b'),_0x3b3e84+'-'+_0x1c7cc7+'/'+_0x3c3613)[_0xbe14('0x2c')](_0x59bf34);}return null;};}function patchUpdates(_0x39dc0a){return function(_0x10ae36){try{jsonpatch[_0xbe14('0x2d')](_0x10ae36,_0x39dc0a,!![]);}catch(_0xe6feb2){return BPromise[_0xbe14('0x2e')](_0xe6feb2);}return _0x10ae36[_0xbe14('0x2f')]();};}function saveUpdates(_0x29e76a,_0x14e7c4){return function(_0x581e86){if(_0x581e86){return _0x581e86[_0xbe14('0x30')](_0x29e76a)['then'](function(_0x58f8de){return _0x58f8de;});}return null;};}function removeEntity(_0x46c2d1,_0x4c1e7e){return function(_0x243524){if(_0x243524){return _0x243524[_0xbe14('0x31')]()['then'](function(){_0x46c2d1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x412ad5,_0xa3d24){return function(_0x5f27b6){if(!_0x5f27b6){_0x412ad5[_0xbe14('0x25')](0x194);}return _0x5f27b6;};}function handleError(_0x1faf3e,_0x452635){_0x452635=_0x452635||0x1f4;return function(_0x1aa849){logger[_0xbe14('0x22')](_0x1aa849['stack']);if(_0x1aa849['name']){delete _0x1aa849[_0xbe14('0x32')];}_0x1faf3e['status'](_0x452635)['send'](_0x1aa849);};}exports['index']=function(_0x163ef7,_0x393f6b){var _0x2bb45={},_0x3dbacb={},_0x172e79={'count':0x0,'rows':[]};var _0x29356f=_[_0xbe14('0x33')](db[_0xbe14('0x34')][_0xbe14('0x35')],function(_0x2dfd5a){return{'name':_0x2dfd5a[_0xbe14('0x36')],'type':_0x2dfd5a[_0xbe14('0x37')]['key']};});_0x3dbacb['model']=_[_0xbe14('0x33')](_0x29356f,_0xbe14('0x32'));_0x3dbacb[_0xbe14('0x38')]=_['keys'](_0x163ef7[_0xbe14('0x38')]);_0x3dbacb[_0xbe14('0x39')]=_[_0xbe14('0x3a')](_0x3dbacb[_0xbe14('0x3b')],_0x3dbacb[_0xbe14('0x38')]);_0x2bb45[_0xbe14('0x3c')]=_[_0xbe14('0x3a')](_0x3dbacb[_0xbe14('0x3b')],qs[_0xbe14('0x3d')](_0x163ef7['query'][_0xbe14('0x3d')]));_0x2bb45[_0xbe14('0x3c')]=_0x2bb45[_0xbe14('0x3c')][_0xbe14('0x3e')]?_0x2bb45[_0xbe14('0x3c')]:_0x3dbacb[_0xbe14('0x3b')];if(!_0x163ef7['query'][_0xbe14('0x3f')](_0xbe14('0x40'))){_0x2bb45[_0xbe14('0x29')]=qs[_0xbe14('0x29')](_0x163ef7['query']['limit']);_0x2bb45[_0xbe14('0x28')]=qs[_0xbe14('0x28')](_0x163ef7[_0xbe14('0x38')]['offset']);}_0x2bb45['order']=qs[_0xbe14('0x41')](_0x163ef7['query']['sort']);_0x2bb45[_0xbe14('0x42')]=qs[_0xbe14('0x39')](_[_0xbe14('0x43')](_0x163ef7['query'],_0x3dbacb['filters']));if(_0x163ef7['query'][_0xbe14('0x44')]){_0x2bb45[_0xbe14('0x42')]=_[_0xbe14('0x45')](_0x2bb45['where'],{'$or':_[_0xbe14('0x33')](_0x29356f,function(_0xcb0680){if(_0xcb0680[_0xbe14('0x37')]!==_0xbe14('0x46')){var _0x58351f={};_0x58351f[_0xcb0680['name']]={'$like':'%'+_0x163ef7[_0xbe14('0x38')][_0xbe14('0x44')]+'%'};return _0x58351f;}})});}_0x2bb45=_[_0xbe14('0x45')]({},_0x2bb45,_0x163ef7[_0xbe14('0x47')]);var _0x2550dc={'where':_0x2bb45['where']};return db['ZohoConfiguration'][_0xbe14('0x27')](_0x2550dc)[_0xbe14('0x1c')](function(_0x238c60){_0x172e79[_0xbe14('0x27')]=_0x238c60;if(_0x163ef7['query'][_0xbe14('0x48')]){_0x2bb45[_0xbe14('0x49')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0xbe14('0x4a')](_0x2bb45);})[_0xbe14('0x1c')](function(_0x2d6ee8){_0x172e79[_0xbe14('0x4b')]=_0x2d6ee8;return _0x172e79;})['then'](respondWithFilteredResult(_0x393f6b,_0x2bb45))['catch'](handleError(_0x393f6b,null));};exports[_0xbe14('0x4c')]=function(_0x29564b,_0x4a1a37){var _0x5acf90={'raw':![],'where':{'id':_0x29564b[_0xbe14('0x4d')]['id']}},_0xca8cdb={};_0xca8cdb[_0xbe14('0x3b')]=_[_0xbe14('0x4e')](db[_0xbe14('0x34')][_0xbe14('0x35')]);_0xca8cdb[_0xbe14('0x38')]=_['keys'](_0x29564b[_0xbe14('0x38')]);_0xca8cdb[_0xbe14('0x39')]=_[_0xbe14('0x3a')](_0xca8cdb[_0xbe14('0x3b')],_0xca8cdb[_0xbe14('0x38')]);_0x5acf90['attributes']=_[_0xbe14('0x3a')](_0xca8cdb[_0xbe14('0x3b')],qs[_0xbe14('0x3d')](_0x29564b[_0xbe14('0x38')][_0xbe14('0x3d')]));_0x5acf90[_0xbe14('0x3c')]=_0x5acf90['attributes']['length']?_0x5acf90[_0xbe14('0x3c')]:_0xca8cdb[_0xbe14('0x3b')];if(_0x29564b[_0xbe14('0x38')]['includeAll']){_0x5acf90['include']=[{'all':!![]}];}_0x5acf90=_[_0xbe14('0x45')]({},_0x5acf90,_0x29564b[_0xbe14('0x47')]);return db['ZohoConfiguration'][_0xbe14('0x4f')](_0x5acf90)[_0xbe14('0x1c')](handleEntityNotFound(_0x4a1a37,null))['then'](respondWithResult(_0x4a1a37,null))[_0xbe14('0x50')](handleError(_0x4a1a37,null));};exports['create']=function(_0x41ba58,_0x410c59){return db[_0xbe14('0x34')]['create'](_0x41ba58[_0xbe14('0x51')],{})[_0xbe14('0x1c')](respondWithResult(_0x410c59,0xc9))['catch'](handleError(_0x410c59,null));};exports[_0xbe14('0x30')]=function(_0x42ca15,_0x2210cc){if(_0x42ca15[_0xbe14('0x51')]['id']){delete _0x42ca15[_0xbe14('0x51')]['id'];}return db['ZohoConfiguration'][_0xbe14('0x4f')]({'where':{'id':_0x42ca15[_0xbe14('0x4d')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x2210cc,null))[_0xbe14('0x1c')](saveUpdates(_0x42ca15[_0xbe14('0x51')],null))[_0xbe14('0x1c')](respondWithResult(_0x2210cc,null))[_0xbe14('0x50')](handleError(_0x2210cc,null));};exports['destroy']=function(_0x72c875,_0x1b47a4){return db[_0xbe14('0x34')][_0xbe14('0x4f')]({'where':{'id':_0x72c875[_0xbe14('0x4d')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x1b47a4,null))[_0xbe14('0x1c')](removeEntity(_0x1b47a4,null))[_0xbe14('0x50')](handleError(_0x1b47a4,null));};exports[_0xbe14('0x52')]=function(_0xc61103,_0x358950,_0x4bccfc){var _0x56bcd3={};var _0x58dd79={};var _0x10c0bc;var _0x1bfcbf;return db[_0xbe14('0x34')][_0xbe14('0x53')]({'where':{'id':_0xc61103[_0xbe14('0x4d')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x358950,null))[_0xbe14('0x1c')](function(_0x22bf69){if(_0x22bf69){_0x10c0bc=_0x22bf69;_0x58dd79[_0xbe14('0x3b')]=_[_0xbe14('0x4e')](db[_0xbe14('0x54')][_0xbe14('0x35')]);_0x58dd79[_0xbe14('0x38')]=_[_0xbe14('0x4e')](_0xc61103[_0xbe14('0x38')]);_0x58dd79[_0xbe14('0x39')]=_[_0xbe14('0x3a')](_0x58dd79[_0xbe14('0x3b')],_0x58dd79[_0xbe14('0x38')]);_0x56bcd3[_0xbe14('0x3c')]=_['intersection'](_0x58dd79[_0xbe14('0x3b')],qs[_0xbe14('0x3d')](_0xc61103[_0xbe14('0x38')][_0xbe14('0x3d')]));_0x56bcd3[_0xbe14('0x3c')]=_0x56bcd3[_0xbe14('0x3c')][_0xbe14('0x3e')]?_0x56bcd3[_0xbe14('0x3c')]:_0x58dd79[_0xbe14('0x3b')];_0x56bcd3[_0xbe14('0x55')]=qs['sort'](_0xc61103[_0xbe14('0x38')][_0xbe14('0x41')]);_0x56bcd3[_0xbe14('0x42')]=qs[_0xbe14('0x39')](_[_0xbe14('0x43')](_0xc61103['query'],_0x58dd79[_0xbe14('0x39')]));if(_0xc61103[_0xbe14('0x38')][_0xbe14('0x44')]){_0x56bcd3[_0xbe14('0x42')]=_[_0xbe14('0x45')](_0x56bcd3['where'],{'$or':_[_0xbe14('0x33')](_0x56bcd3[_0xbe14('0x3c')],function(_0x7ea146){var _0x29bb26={};_0x29bb26[_0x7ea146]={'$like':'%'+_0xc61103[_0xbe14('0x38')][_0xbe14('0x44')]+'%'};return _0x29bb26;})});}_0x56bcd3=_[_0xbe14('0x45')]({},_0x56bcd3,_0xc61103[_0xbe14('0x47')]);return _0x10c0bc['getFields'](_0x56bcd3);}})[_0xbe14('0x1c')](function(_0x33c309){if(_0x33c309){_0x1bfcbf=_0x33c309[_0xbe14('0x3e')];if(!_0xc61103[_0xbe14('0x38')][_0xbe14('0x3f')](_0xbe14('0x40'))){_0x56bcd3[_0xbe14('0x29')]=qs['limit'](_0xc61103['query'][_0xbe14('0x29')]);_0x56bcd3[_0xbe14('0x28')]=qs[_0xbe14('0x28')](_0xc61103[_0xbe14('0x38')][_0xbe14('0x28')]);}return _0x10c0bc[_0xbe14('0x52')](_0x56bcd3);}})[_0xbe14('0x1c')](function(_0x43511e){if(_0x43511e){return _0x43511e?{'count':_0x1bfcbf,'rows':_0x43511e}:null;}})['then'](respondWithResult(_0x358950,null))['catch'](handleError(_0x358950,null));};exports[_0xbe14('0x56')]=function(_0x1c18b6,_0x29aa52,_0x57729f){var _0x76e91e={};var _0x16bca1={};var _0x105be0;var _0x1797dd;return db[_0xbe14('0x34')][_0xbe14('0x53')]({'where':{'id':_0x1c18b6[_0xbe14('0x4d')]['id']}})['then'](handleEntityNotFound(_0x29aa52,null))[_0xbe14('0x1c')](function(_0x3b6ef5){if(_0x3b6ef5){_0x105be0=_0x3b6ef5;_0x16bca1[_0xbe14('0x3b')]=_[_0xbe14('0x4e')](db[_0xbe14('0x54')][_0xbe14('0x35')]);_0x16bca1[_0xbe14('0x38')]=_['keys'](_0x1c18b6[_0xbe14('0x38')]);_0x16bca1[_0xbe14('0x39')]=_[_0xbe14('0x3a')](_0x16bca1[_0xbe14('0x3b')],_0x16bca1[_0xbe14('0x38')]);_0x76e91e[_0xbe14('0x3c')]=_[_0xbe14('0x3a')](_0x16bca1[_0xbe14('0x3b')],qs['fields'](_0x1c18b6[_0xbe14('0x38')][_0xbe14('0x3d')]));_0x76e91e[_0xbe14('0x3c')]=_0x76e91e[_0xbe14('0x3c')][_0xbe14('0x3e')]?_0x76e91e[_0xbe14('0x3c')]:_0x16bca1['model'];_0x76e91e[_0xbe14('0x55')]=qs[_0xbe14('0x41')](_0x1c18b6[_0xbe14('0x38')][_0xbe14('0x41')]);_0x76e91e['where']=qs[_0xbe14('0x39')](_[_0xbe14('0x43')](_0x1c18b6[_0xbe14('0x38')],_0x16bca1[_0xbe14('0x39')]));if(_0x1c18b6[_0xbe14('0x38')][_0xbe14('0x44')]){_0x76e91e[_0xbe14('0x42')]=_['merge'](_0x76e91e[_0xbe14('0x42')],{'$or':_['map'](_0x76e91e[_0xbe14('0x3c')],function(_0x5d85d3){var _0x389822={};_0x389822[_0x5d85d3]={'$like':'%'+_0x1c18b6[_0xbe14('0x38')][_0xbe14('0x44')]+'%'};return _0x389822;})});}_0x76e91e=_['merge']({},_0x76e91e,_0x1c18b6[_0xbe14('0x47')]);return _0x105be0[_0xbe14('0x56')](_0x76e91e);}})[_0xbe14('0x1c')](function(_0x546f22){if(_0x546f22){_0x1797dd=_0x546f22[_0xbe14('0x3e')];if(!_0x1c18b6[_0xbe14('0x38')][_0xbe14('0x3f')](_0xbe14('0x40'))){_0x76e91e['limit']=qs[_0xbe14('0x29')](_0x1c18b6[_0xbe14('0x38')][_0xbe14('0x29')]);_0x76e91e[_0xbe14('0x28')]=qs[_0xbe14('0x28')](_0x1c18b6[_0xbe14('0x38')][_0xbe14('0x28')]);}return _0x105be0['getSubjects'](_0x76e91e);}})[_0xbe14('0x1c')](function(_0x123f4f){if(_0x123f4f){return _0x123f4f?{'count':_0x1797dd,'rows':_0x123f4f}:null;}})[_0xbe14('0x1c')](respondWithResult(_0x29aa52,null))['catch'](handleError(_0x29aa52,null));};exports[_0xbe14('0x57')]=function(_0x420467,_0x1ea305,_0x5bc52b){var _0xa53262={};var _0x1205d1={};var _0x47d7bb;var _0x2be969;return db['ZohoConfiguration'][_0xbe14('0x53')]({'where':{'id':_0x420467[_0xbe14('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1ea305,null))['then'](function(_0x54045e){if(_0x54045e){_0x47d7bb=_0x54045e;_0x1205d1[_0xbe14('0x3b')]=_[_0xbe14('0x4e')](db['ZohoField'][_0xbe14('0x35')]);_0x1205d1[_0xbe14('0x38')]=_[_0xbe14('0x4e')](_0x420467[_0xbe14('0x38')]);_0x1205d1['filters']=_['intersection'](_0x1205d1[_0xbe14('0x3b')],_0x1205d1[_0xbe14('0x38')]);_0xa53262[_0xbe14('0x3c')]=_[_0xbe14('0x3a')](_0x1205d1[_0xbe14('0x3b')],qs[_0xbe14('0x3d')](_0x420467[_0xbe14('0x38')]['fields']));_0xa53262[_0xbe14('0x3c')]=_0xa53262['attributes'][_0xbe14('0x3e')]?_0xa53262[_0xbe14('0x3c')]:_0x1205d1[_0xbe14('0x3b')];_0xa53262[_0xbe14('0x55')]=qs['sort'](_0x420467[_0xbe14('0x38')][_0xbe14('0x41')]);_0xa53262[_0xbe14('0x42')]=qs['filters'](_[_0xbe14('0x43')](_0x420467[_0xbe14('0x38')],_0x1205d1[_0xbe14('0x39')]));if(_0x420467[_0xbe14('0x38')][_0xbe14('0x44')]){_0xa53262[_0xbe14('0x42')]=_[_0xbe14('0x45')](_0xa53262[_0xbe14('0x42')],{'$or':_[_0xbe14('0x33')](_0xa53262[_0xbe14('0x3c')],function(_0x2bf94c){var _0x49497e={};_0x49497e[_0x2bf94c]={'$like':'%'+_0x420467[_0xbe14('0x38')][_0xbe14('0x44')]+'%'};return _0x49497e;})});}_0xa53262=_[_0xbe14('0x45')]({},_0xa53262,_0x420467[_0xbe14('0x47')]);return _0x47d7bb[_0xbe14('0x57')](_0xa53262);}})[_0xbe14('0x1c')](function(_0x1679bd){if(_0x1679bd){_0x2be969=_0x1679bd[_0xbe14('0x3e')];if(!_0x420467['query'][_0xbe14('0x3f')]('nolimit')){_0xa53262[_0xbe14('0x29')]=qs[_0xbe14('0x29')](_0x420467[_0xbe14('0x38')][_0xbe14('0x29')]);_0xa53262[_0xbe14('0x28')]=qs['offset'](_0x420467['query'][_0xbe14('0x28')]);}return _0x47d7bb[_0xbe14('0x57')](_0xa53262);}})[_0xbe14('0x1c')](function(_0x42b849){if(_0x42b849){return _0x42b849?{'count':_0x2be969,'rows':_0x42b849}:null;}})['then'](respondWithResult(_0x1ea305,null))[_0xbe14('0x50')](handleError(_0x1ea305,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 2019078..f3e1f5d 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 _0x231e=['rimraf','../../config/environment','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','bluebird'];(function(_0x52acad,_0x482afd){var _0x378976=function(_0x55b53a){while(--_0x55b53a){_0x52acad['push'](_0x52acad['shift']());}};_0x378976(++_0x482afd);}(_0x231e,0xba));var _0xe231=function(_0x21f3c3,_0x42e32c){_0x21f3c3=_0x21f3c3-0x0;var _0x15957=_0x231e[_0x21f3c3];return _0x15957;};'use strict';var _=require(_0xe231('0x0'));var util=require(_0xe231('0x1'));var logger=require(_0xe231('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe231('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe231('0x4'));var config=require(_0xe231('0x5'));var attributes=require('./intZohoConfiguration.attributes');module[_0xe231('0x6')]=function(_0x2a1013,_0x11e567){return _0x2a1013[_0xe231('0x7')](_0xe231('0x8'),attributes,{'tableName':_0xe231('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x593b=['bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','lodash','../../config/logger','api','moment'];(function(_0x2ca09e,_0x2c0b52){var _0x25d84b=function(_0x3615ba){while(--_0x3615ba){_0x2ca09e['push'](_0x2ca09e['shift']());}};_0x25d84b(++_0x2c0b52);}(_0x593b,0xb2));var _0xb593=function(_0xebe29e,_0x1b8208){_0xebe29e=_0xebe29e-0x0;var _0x3bbb8f=_0x593b[_0xebe29e];return _0x3bbb8f;};'use strict';var _=require(_0xb593('0x0'));var util=require('util');var logger=require(_0xb593('0x1'))(_0xb593('0x2'));var moment=require(_0xb593('0x3'));var BPromise=require(_0xb593('0x4'));var rp=require(_0xb593('0x5'));var fs=require('fs');var path=require(_0xb593('0x6'));var rimraf=require(_0xb593('0x7'));var config=require(_0xb593('0x8'));var attributes=require(_0xb593('0x9'));module[_0xb593('0xa')]=function(_0x5e826f,_0x454b29){return _0x5e826f[_0xb593('0xb')](_0xb593('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 053e75d..2971f93 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 _0x9aba=['message','catch','lodash','util','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x101a61,_0xa9da5f){var _0x3a2788=function(_0x5e9a71){while(--_0x5e9a71){_0x101a61['push'](_0x101a61['shift']());}};_0x3a2788(++_0xa9da5f);}(_0x9aba,0x87));var _0xa9ab=function(_0x3f9c9c,_0x50640e){_0x3f9c9c=_0x3f9c9c-0x0;var _0x442353=_0x9aba[_0x3f9c9c];return _0x442353;};'use strict';var _=require(_0xa9ab('0x0'));var util=require(_0xa9ab('0x1'));var moment=require(_0xa9ab('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa9ab('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa9ab('0x4'))(_0xa9ab('0x5'));var config=require(_0xa9ab('0x6'));var jayson=require(_0xa9ab('0x7'));var client=jayson['client'][_0xa9ab('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x349985,_0x6c0951,_0x104363){return new BPromise(function(_0x55a6c0,_0x15ca55){return client[_0xa9ab('0x9')](_0x349985,_0x104363)['then'](function(_0x474687){logger[_0xa9ab('0xa')](_0xa9ab('0xb'),_0x6c0951,_0xa9ab('0xc'));logger[_0xa9ab('0xd')](_0xa9ab('0xe'),_0x6c0951,_0xa9ab('0xc'),JSON[_0xa9ab('0xf')](_0x474687));if(_0x474687['error']){if(_0x474687['error']['code']===0x1f4){logger[_0xa9ab('0x10')](_0xa9ab('0xb'),_0x6c0951,_0x474687[_0xa9ab('0x10')][_0xa9ab('0x11')]);return _0x15ca55(_0x474687['error'][_0xa9ab('0x11')]);}logger[_0xa9ab('0x10')](_0xa9ab('0xb'),_0x6c0951,_0x474687[_0xa9ab('0x10')][_0xa9ab('0x11')]);return _0x55a6c0(_0x474687[_0xa9ab('0x10')][_0xa9ab('0x11')]);}else{logger[_0xa9ab('0xa')](_0xa9ab('0xb'),_0x6c0951,_0xa9ab('0xc'));_0x55a6c0(_0x474687['result'][_0xa9ab('0x11')]);}})[_0xa9ab('0x12')](function(_0x9c3b5e){logger[_0xa9ab('0x10')](_0xa9ab('0xb'),_0x6c0951,_0x9c3b5e);_0x15ca55(_0x9c3b5e);});});} \ No newline at end of file +var _0xf0da=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash'];(function(_0x934754,_0x15bd40){var _0x5cf1fc=function(_0x2c1de6){while(--_0x2c1de6){_0x934754['push'](_0x934754['shift']());}};_0x5cf1fc(++_0x15bd40);}(_0xf0da,0x164));var _0xaf0d=function(_0x2af850,_0x3dd810){_0x2af850=_0x2af850-0x0;var _0x16486f=_0xf0da[_0x2af850];return _0x16486f;};'use strict';var _=require(_0xaf0d('0x0'));var util=require('util');var moment=require(_0xaf0d('0x1'));var BPromise=require(_0xaf0d('0x2'));var rs=require(_0xaf0d('0x3'));var fs=require('fs');var Redis=require(_0xaf0d('0x4'));var db=require(_0xaf0d('0x5'))['db'];var utils=require(_0xaf0d('0x6'));var logger=require('../../config/logger')(_0xaf0d('0x7'));var config=require(_0xaf0d('0x8'));var jayson=require(_0xaf0d('0x9'));var client=jayson['client'][_0xaf0d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c078b,_0x2c7a61,_0x1c8a54){return new BPromise(function(_0x4bfa5e,_0x24346a){return client[_0xaf0d('0xb')](_0x3c078b,_0x1c8a54)[_0xaf0d('0xc')](function(_0x29b59c){logger[_0xaf0d('0xd')](_0xaf0d('0xe'),_0x2c7a61,_0xaf0d('0xf'));logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x2c7a61,_0xaf0d('0xf'),JSON['stringify'](_0x29b59c));if(_0x29b59c['error']){if(_0x29b59c[_0xaf0d('0x10')][_0xaf0d('0x11')]===0x1f4){logger[_0xaf0d('0x10')](_0xaf0d('0xe'),_0x2c7a61,_0x29b59c[_0xaf0d('0x10')][_0xaf0d('0x12')]);return _0x24346a(_0x29b59c[_0xaf0d('0x10')][_0xaf0d('0x12')]);}logger[_0xaf0d('0x10')](_0xaf0d('0xe'),_0x2c7a61,_0x29b59c['error'][_0xaf0d('0x12')]);return _0x4bfa5e(_0x29b59c['error']['message']);}else{logger[_0xaf0d('0xd')](_0xaf0d('0xe'),_0x2c7a61,_0xaf0d('0xf'));_0x4bfa5e(_0x29b59c[_0xaf0d('0x13')][_0xaf0d('0x12')]);}})[_0xaf0d('0x14')](function(_0x4148e6){logger[_0xaf0d('0x10')](_0xaf0d('0xe'),_0x2c7a61,_0x4148e6);_0x24346a(_0x4148e6);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 69d268d..cc18654 100644 --- a/server/api/intZohoField/index.js +++ b/server/api/intZohoField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x32b6=['exports','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','create','put','destroy'];(function(_0x39f101,_0x59d2e4){var _0x28d6de=function(_0x1d2741){while(--_0x1d2741){_0x39f101['push'](_0x39f101['shift']());}};_0x28d6de(++_0x59d2e4);}(_0x32b6,0x1d1));var _0x632b=function(_0x1a3e48,_0x3a5c97){_0x1a3e48=_0x1a3e48-0x0;var _0x12b4e3=_0x32b6[_0x1a3e48];return _0x12b4e3;};'use strict';var multer=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var path=require('path');var timeout=require(_0x632b('0x2'));var express=require(_0x632b('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x632b('0x4'));var config=require(_0x632b('0x5'));var controller=require(_0x632b('0x6'));router[_0x632b('0x7')]('/',auth[_0x632b('0x8')](),controller[_0x632b('0x9')]);router[_0x632b('0x7')](_0x632b('0xa'),auth[_0x632b('0x8')](),controller[_0x632b('0xb')]);router['post']('/',auth[_0x632b('0x8')](),controller[_0x632b('0xc')]);router[_0x632b('0xd')](_0x632b('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x632b('0xa'),auth['isAuthenticated'](),controller[_0x632b('0xe')]);module[_0x632b('0xf')]=router; \ No newline at end of file +var _0x781d=['../../config/environment','./intZohoField.controller','get','isAuthenticated','index','show','post','put','update','/:id','multer','util','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2ff669,_0x50b926){var _0x1522d6=function(_0x759f6f){while(--_0x759f6f){_0x2ff669['push'](_0x2ff669['shift']());}};_0x1522d6(++_0x50b926);}(_0x781d,0x14a));var _0xd781=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x781d[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0xd781('0x0'));var util=require(_0xd781('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd781('0x2'));var router=express[_0xd781('0x3')]();var auth=require(_0xd781('0x4'));var interaction=require(_0xd781('0x5'));var config=require(_0xd781('0x6'));var controller=require(_0xd781('0x7'));router[_0xd781('0x8')]('/',auth[_0xd781('0x9')](),controller[_0xd781('0xa')]);router[_0xd781('0x8')]('/:id',auth[_0xd781('0x9')](),controller[_0xd781('0xb')]);router[_0xd781('0xc')]('/',auth[_0xd781('0x9')](),controller['create']);router[_0xd781('0xd')]('/:id',auth[_0xd781('0x9')](),controller[_0xd781('0xe')]);router['delete'](_0xd781('0xf'),auth[_0xd781('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index acb3c85..27d60da 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 _0xc57c=['sequelize','variable','string','STRING','ENUM','customVariable','BOOLEAN'];(function(_0x29183b,_0x8296f3){var _0x3cdbbf=function(_0x5d3909){while(--_0x5d3909){_0x29183b['push'](_0x29183b['shift']());}};_0x3cdbbf(++_0x8296f3);}(_0xc57c,0x149));var _0xcc57=function(_0x194ce2,_0x3c6d23){_0x194ce2=_0x194ce2-0x0;var _0x4281df=_0xc57c[_0x194ce2];return _0x4281df;};'use strict';var Sequelize=require(_0xcc57('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string',_0xcc57('0x1'),'customVariable','keyValue'),'defaultValue':_0xcc57('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xcc57('0x3')]},'keyType':{'type':Sequelize[_0xcc57('0x4')](_0xcc57('0x2'),_0xcc57('0x1'),_0xcc57('0x5'))},'keyContent':{'type':Sequelize[_0xcc57('0x3')]},'idField':{'type':Sequelize[_0xcc57('0x3')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xcc57('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcc57('0x3')]}}; \ No newline at end of file +var _0x925e=['STRING','customVariable','BOOLEAN','ENUM','string','variable','keyValue'];(function(_0x165ada,_0x4be17c){var _0x22517e=function(_0x49afa8){while(--_0x49afa8){_0x165ada['push'](_0x165ada['shift']());}};_0x22517e(++_0x4be17c);}(_0x925e,0x199));var _0xe925=function(_0x36bb51,_0x338f02){_0x36bb51=_0x36bb51-0x0;var _0x3aeada=_0x925e[_0x36bb51];return _0x3aeada;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xe925('0x0')](_0xe925('0x1'),_0xe925('0x2'),'customVariable',_0xe925('0x3')),'defaultValue':_0xe925('0x1')},'content':{'type':Sequelize[_0xe925('0x4')]},'key':{'type':Sequelize[_0xe925('0x4')]},'keyType':{'type':Sequelize[_0xe925('0x0')](_0xe925('0x1'),_0xe925('0x2'),_0xe925('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xe925('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index f1137a5..b980859 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 _0x8854=['lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','ZohoField','rawAttributes','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','map','VIRTUAL','filter','includeAll','include','findAll','rows','catch','options','create','body','find','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs'];(function(_0x554ed8,_0x1aa9bd){var _0x21e355=function(_0x318ce5){while(--_0x318ce5){_0x554ed8['push'](_0x554ed8['shift']());}};_0x21e355(++_0x1aa9bd);}(_0x8854,0x15c));var _0x4885=function(_0x1bcd32,_0x397911){_0x1bcd32=_0x1bcd32-0x0;var _0x9a4241=_0x8854[_0x1bcd32];return _0x9a4241;};'use strict';var pdf=require(_0x4885('0x0'));var emlformat=require(_0x4885('0x1'));var rimraf=require(_0x4885('0x2'));var zipdir=require(_0x4885('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4885('0x4'));var moment=require(_0x4885('0x5'));var BPromise=require(_0x4885('0x6'));var Mustache=require(_0x4885('0x7'));var util=require('util');var path=require(_0x4885('0x8'));var sox=require(_0x4885('0x9'));var csv=require(_0x4885('0xa'));var ejs=require(_0x4885('0xb'));var fs=require('fs');var _=require(_0x4885('0xc'));var squel=require(_0x4885('0xd'));var crypto=require('crypto');var jsforce=require(_0x4885('0xe'));var deskjs=require(_0x4885('0xf'));var toCsv=require(_0x4885('0xa'));var querystring=require(_0x4885('0x10'));var Papa=require(_0x4885('0x11'));var Redis=require(_0x4885('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4885('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4885('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x4885('0x15'))['db'];function respondWithStatusCode(_0x1a56e7,_0x1adf7c){_0x1adf7c=_0x1adf7c||0xcc;return function(_0x3be9c2){if(_0x3be9c2){return _0x1a56e7[_0x4885('0x16')](_0x1adf7c);}return _0x1a56e7[_0x4885('0x17')](_0x1adf7c)[_0x4885('0x18')]();};}function respondWithResult(_0x29016f,_0x328235){_0x328235=_0x328235||0xc8;return function(_0x1bc341){if(_0x1bc341){return _0x29016f[_0x4885('0x17')](_0x328235)[_0x4885('0x19')](_0x1bc341);}};}function respondWithFilteredResult(_0x43eaa5,_0x39cd50){return function(_0x6b73c0){if(_0x6b73c0){var _0x4a9d51=_0x6b73c0[_0x4885('0x1a')],_0x2ce022=_0x39cd50[_0x4885('0x1b')],_0xa48317=_0x39cd50[_0x4885('0x1b')]+_0x39cd50['limit'],_0x57e3c2;if(_0xa48317>=_0x4a9d51){_0xa48317=_0x4a9d51;_0x57e3c2=0xc8;}else{_0x57e3c2=0xce;}_0x43eaa5[_0x4885('0x17')](_0x57e3c2);return _0x43eaa5[_0x4885('0x1c')](_0x4885('0x1d'),_0x2ce022+'-'+_0xa48317+'/'+_0x4a9d51)[_0x4885('0x19')](_0x6b73c0);}return null;};}function patchUpdates(_0x61e37a){return function(_0x4ab3a5){try{jsonpatch[_0x4885('0x1e')](_0x4ab3a5,_0x61e37a,!![]);}catch(_0x4ba41e){return BPromise[_0x4885('0x1f')](_0x4ba41e);}return _0x4ab3a5[_0x4885('0x20')]();};}function saveUpdates(_0xbf8f8c,_0x5d4296){return function(_0x1372f3){if(_0x1372f3){return _0x1372f3[_0x4885('0x21')](_0xbf8f8c)[_0x4885('0x22')](function(_0x5d1fef){return _0x5d1fef;});}return null;};}function removeEntity(_0x2b11d7,_0x1c6aca){return function(_0x5281ed){if(_0x5281ed){return _0x5281ed[_0x4885('0x23')]()['then'](function(){_0x2b11d7[_0x4885('0x17')](0xcc)[_0x4885('0x18')]();});}};}function handleEntityNotFound(_0x1915a3,_0x470c24){return function(_0x4b540e){if(!_0x4b540e){_0x1915a3['sendStatus'](0x194);}return _0x4b540e;};}function handleError(_0x16f68d,_0x497ea3){_0x497ea3=_0x497ea3||0x1f4;return function(_0x13d912){logger[_0x4885('0x24')](_0x13d912['stack']);if(_0x13d912[_0x4885('0x25')]){delete _0x13d912[_0x4885('0x25')];}_0x16f68d[_0x4885('0x17')](_0x497ea3)[_0x4885('0x26')](_0x13d912);};}exports[_0x4885('0x27')]=function(_0xe9482c,_0x26b168){var _0x2ea7fc={},_0x4d6276={},_0x4ed700={'count':0x0,'rows':[]};var _0x3b0cfe=_['map'](db[_0x4885('0x28')][_0x4885('0x29')],function(_0x8cac78){return{'name':_0x8cac78['fieldName'],'type':_0x8cac78[_0x4885('0x2a')][_0x4885('0x2b')]};});_0x4d6276[_0x4885('0x2c')]=_['map'](_0x3b0cfe,'name');_0x4d6276[_0x4885('0x2d')]=_[_0x4885('0x2e')](_0xe9482c[_0x4885('0x2d')]);_0x4d6276[_0x4885('0x2f')]=_['intersection'](_0x4d6276[_0x4885('0x2c')],_0x4d6276[_0x4885('0x2d')]);_0x2ea7fc['attributes']=_[_0x4885('0x30')](_0x4d6276[_0x4885('0x2c')],qs[_0x4885('0x31')](_0xe9482c[_0x4885('0x2d')]['fields']));_0x2ea7fc['attributes']=_0x2ea7fc['attributes'][_0x4885('0x32')]?_0x2ea7fc[_0x4885('0x33')]:_0x4d6276[_0x4885('0x2c')];if(!_0xe9482c['query'][_0x4885('0x34')](_0x4885('0x35'))){_0x2ea7fc[_0x4885('0x36')]=qs['limit'](_0xe9482c[_0x4885('0x2d')][_0x4885('0x36')]);_0x2ea7fc['offset']=qs[_0x4885('0x1b')](_0xe9482c[_0x4885('0x2d')][_0x4885('0x1b')]);}_0x2ea7fc[_0x4885('0x37')]=qs[_0x4885('0x38')](_0xe9482c[_0x4885('0x2d')][_0x4885('0x38')]);_0x2ea7fc[_0x4885('0x39')]=qs[_0x4885('0x2f')](_[_0x4885('0x3a')](_0xe9482c[_0x4885('0x2d')],_0x4d6276[_0x4885('0x2f')]));if(_0xe9482c[_0x4885('0x2d')]['filter']){_0x2ea7fc[_0x4885('0x39')]=_[_0x4885('0x3b')](_0x2ea7fc[_0x4885('0x39')],{'$or':_[_0x4885('0x3c')](_0x3b0cfe,function(_0x59fd03){if(_0x59fd03[_0x4885('0x2a')]!==_0x4885('0x3d')){var _0x3b3c38={};_0x3b3c38[_0x59fd03[_0x4885('0x25')]]={'$like':'%'+_0xe9482c['query'][_0x4885('0x3e')]+'%'};return _0x3b3c38;}})});}_0x2ea7fc=_[_0x4885('0x3b')]({},_0x2ea7fc,_0xe9482c['options']);var _0x256103={'where':_0x2ea7fc['where']};return db['ZohoField'][_0x4885('0x1a')](_0x256103)['then'](function(_0x58da65){_0x4ed700[_0x4885('0x1a')]=_0x58da65;if(_0xe9482c[_0x4885('0x2d')][_0x4885('0x3f')]){_0x2ea7fc[_0x4885('0x40')]=[{'all':!![]}];}return db[_0x4885('0x28')][_0x4885('0x41')](_0x2ea7fc);})[_0x4885('0x22')](function(_0x1d08c4){_0x4ed700[_0x4885('0x42')]=_0x1d08c4;return _0x4ed700;})[_0x4885('0x22')](respondWithFilteredResult(_0x26b168,_0x2ea7fc))[_0x4885('0x43')](handleError(_0x26b168,null));};exports['show']=function(_0x1bbdfe,_0x135187){var _0x4db7c7={'raw':!![],'where':{'id':_0x1bbdfe['params']['id']}},_0x53ed29={};_0x53ed29['model']=_[_0x4885('0x2e')](db[_0x4885('0x28')][_0x4885('0x29')]);_0x53ed29[_0x4885('0x2d')]=_['keys'](_0x1bbdfe[_0x4885('0x2d')]);_0x53ed29['filters']=_[_0x4885('0x30')](_0x53ed29[_0x4885('0x2c')],_0x53ed29['query']);_0x4db7c7['attributes']=_[_0x4885('0x30')](_0x53ed29[_0x4885('0x2c')],qs[_0x4885('0x31')](_0x1bbdfe[_0x4885('0x2d')]['fields']));_0x4db7c7[_0x4885('0x33')]=_0x4db7c7[_0x4885('0x33')]['length']?_0x4db7c7[_0x4885('0x33')]:_0x53ed29[_0x4885('0x2c')];if(_0x1bbdfe[_0x4885('0x2d')][_0x4885('0x3f')]){_0x4db7c7[_0x4885('0x40')]=[{'all':!![]}];}_0x4db7c7=_[_0x4885('0x3b')]({},_0x4db7c7,_0x1bbdfe[_0x4885('0x44')]);return db[_0x4885('0x28')]['find'](_0x4db7c7)[_0x4885('0x22')](handleEntityNotFound(_0x135187,null))['then'](respondWithResult(_0x135187,null))['catch'](handleError(_0x135187,null));};exports['create']=function(_0x4e8595,_0x42243e){return db[_0x4885('0x28')][_0x4885('0x45')](_0x4e8595[_0x4885('0x46')],{})[_0x4885('0x22')](respondWithResult(_0x42243e,0xc9))[_0x4885('0x43')](handleError(_0x42243e,null));};exports[_0x4885('0x21')]=function(_0x3c6337,_0x343322){if(_0x3c6337[_0x4885('0x46')]['id']){delete _0x3c6337['body']['id'];}return db[_0x4885('0x28')][_0x4885('0x47')]({'where':{'id':_0x3c6337['params']['id']}})[_0x4885('0x22')](handleEntityNotFound(_0x343322,null))[_0x4885('0x22')](saveUpdates(_0x3c6337[_0x4885('0x46')],null))['then'](respondWithResult(_0x343322,null))[_0x4885('0x43')](handleError(_0x343322,null));};exports['destroy']=function(_0x120209,_0x43f702){return db[_0x4885('0x28')]['find']({'where':{'id':_0x120209['params']['id']}})[_0x4885('0x22')](handleEntityNotFound(_0x43f702,null))[_0x4885('0x22')](removeEntity(_0x43f702,null))[_0x4885('0x43')](handleError(_0x43f702,null));}; \ No newline at end of file +var _0x05d6=['fieldName','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','create','body','update','find','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','index','map','ZohoField','rawAttributes'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x05d6,0xf9));var _0x605d=function(_0x471e28,_0x49c23e){_0x471e28=_0x471e28-0x0;var _0x53bba0=_0x05d6[_0x471e28];return _0x53bba0;};'use strict';var pdf=require(_0x605d('0x0'));var emlformat=require(_0x605d('0x1'));var rimraf=require(_0x605d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x605d('0x3'));var rp=require(_0x605d('0x4'));var moment=require('moment');var BPromise=require(_0x605d('0x5'));var Mustache=require(_0x605d('0x6'));var util=require(_0x605d('0x7'));var path=require(_0x605d('0x8'));var sox=require(_0x605d('0x9'));var csv=require(_0x605d('0xa'));var ejs=require(_0x605d('0xb'));var fs=require('fs');var _=require(_0x605d('0xc'));var squel=require(_0x605d('0xd'));var crypto=require('crypto');var jsforce=require(_0x605d('0xe'));var deskjs=require(_0x605d('0xf'));var toCsv=require(_0x605d('0xa'));var querystring=require('querystring');var Papa=require(_0x605d('0x10'));var Redis=require(_0x605d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x605d('0x12'));var as=require(_0x605d('0x13'));var hardwareService=require(_0x605d('0x14'));var logger=require(_0x605d('0x15'))('api');var utils=require(_0x605d('0x16'));var config=require('../../config/environment');var db=require(_0x605d('0x17'))['db'];function respondWithStatusCode(_0xd64e21,_0x22e320){_0x22e320=_0x22e320||0xcc;return function(_0x36e76d){if(_0x36e76d){return _0xd64e21[_0x605d('0x18')](_0x22e320);}return _0xd64e21['status'](_0x22e320)[_0x605d('0x19')]();};}function respondWithResult(_0x152bda,_0x4fd468){_0x4fd468=_0x4fd468||0xc8;return function(_0x249faf){if(_0x249faf){return _0x152bda[_0x605d('0x1a')](_0x4fd468)[_0x605d('0x1b')](_0x249faf);}};}function respondWithFilteredResult(_0x515881,_0x47ba22){return function(_0x2b5e0c){if(_0x2b5e0c){var _0x54be34=_0x2b5e0c['count'],_0xa9854=_0x47ba22[_0x605d('0x1c')],_0x1b9ffa=_0x47ba22['offset']+_0x47ba22[_0x605d('0x1d')],_0xeed26a;if(_0x1b9ffa>=_0x54be34){_0x1b9ffa=_0x54be34;_0xeed26a=0xc8;}else{_0xeed26a=0xce;}_0x515881[_0x605d('0x1a')](_0xeed26a);return _0x515881[_0x605d('0x1e')](_0x605d('0x1f'),_0xa9854+'-'+_0x1b9ffa+'/'+_0x54be34)[_0x605d('0x1b')](_0x2b5e0c);}return null;};}function patchUpdates(_0x424330){return function(_0x1e6c5b){try{jsonpatch[_0x605d('0x20')](_0x1e6c5b,_0x424330,!![]);}catch(_0xdb9731){return BPromise[_0x605d('0x21')](_0xdb9731);}return _0x1e6c5b[_0x605d('0x22')]();};}function saveUpdates(_0x489fd1,_0x17d31d){return function(_0x56a11f){if(_0x56a11f){return _0x56a11f['update'](_0x489fd1)[_0x605d('0x23')](function(_0x4f1dfb){return _0x4f1dfb;});}return null;};}function removeEntity(_0x2c6e7b,_0x1d7617){return function(_0x40cfd3){if(_0x40cfd3){return _0x40cfd3[_0x605d('0x24')]()[_0x605d('0x23')](function(){_0x2c6e7b['status'](0xcc)[_0x605d('0x19')]();});}};}function handleEntityNotFound(_0x170ba3,_0x5c5722){return function(_0x2f7791){if(!_0x2f7791){_0x170ba3[_0x605d('0x18')](0x194);}return _0x2f7791;};}function handleError(_0x4b8e4d,_0x4847d6){_0x4847d6=_0x4847d6||0x1f4;return function(_0x28fc54){logger[_0x605d('0x25')](_0x28fc54['stack']);if(_0x28fc54[_0x605d('0x26')]){delete _0x28fc54['name'];}_0x4b8e4d[_0x605d('0x1a')](_0x4847d6)['send'](_0x28fc54);};}exports[_0x605d('0x27')]=function(_0xf05ba6,_0x41d2f5){var _0x1c2afd={},_0x417313={},_0x1ea6bd={'count':0x0,'rows':[]};var _0x44a8f3=_[_0x605d('0x28')](db[_0x605d('0x29')][_0x605d('0x2a')],function(_0x18876a){return{'name':_0x18876a[_0x605d('0x2b')],'type':_0x18876a['type'][_0x605d('0x2c')]};});_0x417313[_0x605d('0x2d')]=_[_0x605d('0x28')](_0x44a8f3,_0x605d('0x26'));_0x417313[_0x605d('0x2e')]=_[_0x605d('0x2f')](_0xf05ba6['query']);_0x417313['filters']=_['intersection'](_0x417313[_0x605d('0x2d')],_0x417313[_0x605d('0x2e')]);_0x1c2afd[_0x605d('0x30')]=_[_0x605d('0x31')](_0x417313['model'],qs[_0x605d('0x32')](_0xf05ba6[_0x605d('0x2e')][_0x605d('0x32')]));_0x1c2afd[_0x605d('0x30')]=_0x1c2afd[_0x605d('0x30')]['length']?_0x1c2afd[_0x605d('0x30')]:_0x417313[_0x605d('0x2d')];if(!_0xf05ba6[_0x605d('0x2e')][_0x605d('0x33')](_0x605d('0x34'))){_0x1c2afd['limit']=qs[_0x605d('0x1d')](_0xf05ba6[_0x605d('0x2e')]['limit']);_0x1c2afd[_0x605d('0x1c')]=qs[_0x605d('0x1c')](_0xf05ba6[_0x605d('0x2e')]['offset']);}_0x1c2afd[_0x605d('0x35')]=qs[_0x605d('0x36')](_0xf05ba6[_0x605d('0x2e')][_0x605d('0x36')]);_0x1c2afd[_0x605d('0x37')]=qs[_0x605d('0x38')](_[_0x605d('0x39')](_0xf05ba6['query'],_0x417313['filters']));if(_0xf05ba6[_0x605d('0x2e')][_0x605d('0x3a')]){_0x1c2afd[_0x605d('0x37')]=_[_0x605d('0x3b')](_0x1c2afd[_0x605d('0x37')],{'$or':_[_0x605d('0x28')](_0x44a8f3,function(_0x49bfe5){if(_0x49bfe5['type']!==_0x605d('0x3c')){var _0x22d7f1={};_0x22d7f1[_0x49bfe5[_0x605d('0x26')]]={'$like':'%'+_0xf05ba6[_0x605d('0x2e')]['filter']+'%'};return _0x22d7f1;}})});}_0x1c2afd=_[_0x605d('0x3b')]({},_0x1c2afd,_0xf05ba6[_0x605d('0x3d')]);var _0x3fe803={'where':_0x1c2afd[_0x605d('0x37')]};return db[_0x605d('0x29')][_0x605d('0x3e')](_0x3fe803)['then'](function(_0x4ae53d){_0x1ea6bd[_0x605d('0x3e')]=_0x4ae53d;if(_0xf05ba6[_0x605d('0x2e')][_0x605d('0x3f')]){_0x1c2afd[_0x605d('0x40')]=[{'all':!![]}];}return db['ZohoField'][_0x605d('0x41')](_0x1c2afd);})[_0x605d('0x23')](function(_0x4fb01f){_0x1ea6bd['rows']=_0x4fb01f;return _0x1ea6bd;})[_0x605d('0x23')](respondWithFilteredResult(_0x41d2f5,_0x1c2afd))[_0x605d('0x42')](handleError(_0x41d2f5,null));};exports[_0x605d('0x43')]=function(_0x523ec4,_0x500d32){var _0x3f8614={'raw':!![],'where':{'id':_0x523ec4[_0x605d('0x44')]['id']}},_0x47ca8d={};_0x47ca8d[_0x605d('0x2d')]=_[_0x605d('0x2f')](db['ZohoField'][_0x605d('0x2a')]);_0x47ca8d['query']=_['keys'](_0x523ec4[_0x605d('0x2e')]);_0x47ca8d['filters']=_[_0x605d('0x31')](_0x47ca8d[_0x605d('0x2d')],_0x47ca8d[_0x605d('0x2e')]);_0x3f8614[_0x605d('0x30')]=_[_0x605d('0x31')](_0x47ca8d[_0x605d('0x2d')],qs[_0x605d('0x32')](_0x523ec4[_0x605d('0x2e')][_0x605d('0x32')]));_0x3f8614[_0x605d('0x30')]=_0x3f8614['attributes']['length']?_0x3f8614['attributes']:_0x47ca8d[_0x605d('0x2d')];if(_0x523ec4[_0x605d('0x2e')][_0x605d('0x3f')]){_0x3f8614[_0x605d('0x40')]=[{'all':!![]}];}_0x3f8614=_[_0x605d('0x3b')]({},_0x3f8614,_0x523ec4['options']);return db[_0x605d('0x29')]['find'](_0x3f8614)[_0x605d('0x23')](handleEntityNotFound(_0x500d32,null))[_0x605d('0x23')](respondWithResult(_0x500d32,null))['catch'](handleError(_0x500d32,null));};exports[_0x605d('0x45')]=function(_0x1e0b4d,_0x1274ee){return db['ZohoField'][_0x605d('0x45')](_0x1e0b4d[_0x605d('0x46')],{})[_0x605d('0x23')](respondWithResult(_0x1274ee,0xc9))['catch'](handleError(_0x1274ee,null));};exports[_0x605d('0x47')]=function(_0x4a32c5,_0x55b57e){if(_0x4a32c5[_0x605d('0x46')]['id']){delete _0x4a32c5['body']['id'];}return db[_0x605d('0x29')][_0x605d('0x48')]({'where':{'id':_0x4a32c5[_0x605d('0x44')]['id']}})[_0x605d('0x23')](handleEntityNotFound(_0x55b57e,null))[_0x605d('0x23')](saveUpdates(_0x4a32c5[_0x605d('0x46')],null))[_0x605d('0x23')](respondWithResult(_0x55b57e,null))[_0x605d('0x42')](handleError(_0x55b57e,null));};exports[_0x605d('0x24')]=function(_0x355c92,_0x4dc6d1){return db[_0x605d('0x29')][_0x605d('0x48')]({'where':{'id':_0x355c92['params']['id']}})[_0x605d('0x23')](handleEntityNotFound(_0x4dc6d1,null))['then'](removeEntity(_0x4dc6d1,null))[_0x605d('0x42')](handleError(_0x4dc6d1,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index de8828f..f477ace 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 _0x8b6d=['int_zoho_fields','zoho_unique_index','idField','FieldId','util','api','moment','bluebird','request-promise','exports','define'];(function(_0x5042ba,_0x3a5306){var _0x2dbb26=function(_0x13e950){while(--_0x13e950){_0x5042ba['push'](_0x5042ba['shift']());}};_0x2dbb26(++_0x3a5306);}(_0x8b6d,0x1e8));var _0xd8b6=function(_0x523024,_0x496cc5){_0x523024=_0x523024-0x0;var _0x346b21=_0x8b6d[_0x523024];return _0x346b21;};'use strict';var _=require('lodash');var util=require(_0xd8b6('0x0'));var logger=require('../../config/logger')(_0xd8b6('0x1'));var moment=require(_0xd8b6('0x2'));var BPromise=require(_0xd8b6('0x3'));var rp=require(_0xd8b6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZohoField.attributes');module[_0xd8b6('0x5')]=function(_0x13cbe9,_0x1f81a6){return _0x13cbe9[_0xd8b6('0x6')]('ZohoField',attributes,{'tableName':_0xd8b6('0x7'),'paranoid':![],'indexes':[{'name':_0xd8b6('0x8'),'fields':[_0xd8b6('0x9'),_0xd8b6('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7553=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ZohoField','int_zoho_fields','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x419253,_0x199221){var _0x256fdb=function(_0x272f4c){while(--_0x272f4c){_0x419253['push'](_0x419253['shift']());}};_0x256fdb(++_0x199221);}(_0x7553,0x164));var _0x3755=function(_0x3de7e0,_0x28cbff){_0x3de7e0=_0x3de7e0-0x0;var _0x11d0b3=_0x7553[_0x3de7e0];return _0x11d0b3;};'use strict';var _=require(_0x3755('0x0'));var util=require(_0x3755('0x1'));var logger=require(_0x3755('0x2'))(_0x3755('0x3'));var moment=require('moment');var BPromise=require(_0x3755('0x4'));var rp=require(_0x3755('0x5'));var fs=require('fs');var path=require(_0x3755('0x6'));var rimraf=require(_0x3755('0x7'));var config=require(_0x3755('0x8'));var attributes=require('./intZohoField.attributes');module[_0x3755('0x9')]=function(_0xa9d2e9,_0x95913b){return _0xa9d2e9[_0x3755('0xa')](_0x3755('0xb'),attributes,{'tableName':_0x3755('0xc'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x3755('0xd'),_0x3755('0xe')],'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 b0422fd..7e47878 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 _0x6aa7=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x54dff2,_0x3b8fad){var _0x23ba54=function(_0x431263){while(--_0x431263){_0x54dff2['push'](_0x54dff2['shift']());}};_0x23ba54(++_0x3b8fad);}(_0x6aa7,0x178));var _0x76aa=function(_0x5bae4a,_0x45cf61){_0x5bae4a=_0x5bae4a-0x0;var _0x5169b8=_0x6aa7[_0x5bae4a];return _0x5169b8;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});} \ No newline at end of file +var _0x98a8=['request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x34bce6,_0x168b02){var _0x431230=function(_0x45056c){while(--_0x45056c){_0x34bce6['push'](_0x34bce6['shift']());}};_0x431230(++_0x168b02);}(_0x98a8,0x12c));var _0x898a=function(_0x14ad20,_0x5a0a88){_0x14ad20=_0x14ad20-0x0;var _0x58f5b8=_0x98a8[_0x14ad20];return _0x58f5b8;};'use strict';var _=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var moment=require(_0x898a('0x2'));var BPromise=require(_0x898a('0x3'));var rs=require(_0x898a('0x4'));var fs=require('fs');var Redis=require(_0x898a('0x5'));var db=require(_0x898a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x898a('0x7'))(_0x898a('0x8'));var config=require(_0x898a('0x9'));var jayson=require(_0x898a('0xa'));var client=jayson[_0x898a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3aadc2,_0x564583,_0xfa8c50){return new BPromise(function(_0x4fbce5,_0x42021d){return client[_0x898a('0xc')](_0x3aadc2,_0xfa8c50)[_0x898a('0xd')](function(_0x96b636){logger[_0x898a('0xe')](_0x898a('0xf'),_0x564583,_0x898a('0x10'));logger[_0x898a('0x11')](_0x898a('0x12'),_0x564583,'request\x20sent',JSON[_0x898a('0x13')](_0x96b636));if(_0x96b636['error']){if(_0x96b636[_0x898a('0x14')]['code']===0x1f4){logger[_0x898a('0x14')](_0x898a('0xf'),_0x564583,_0x96b636[_0x898a('0x14')]['message']);return _0x42021d(_0x96b636['error']['message']);}logger[_0x898a('0x14')](_0x898a('0xf'),_0x564583,_0x96b636[_0x898a('0x14')][_0x898a('0x15')]);return _0x4fbce5(_0x96b636[_0x898a('0x14')][_0x898a('0x15')]);}else{logger['info'](_0x898a('0xf'),_0x564583,'request\x20sent');_0x4fbce5(_0x96b636[_0x898a('0x16')]['message']);}})[_0x898a('0x17')](function(_0x4fb05b){logger[_0x898a('0x14')]('ZohoField,\x20%s,\x20%s',_0x564583,_0x4fb05b);_0x42021d(_0x4fb05b);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 12c0ac9..aa9aa26 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 _0x9156=['../../components/interaction/service','../../config/environment','exports','path','connect-timeout','express'];(function(_0x91b1f6,_0x1c8397){var _0x4abaa9=function(_0x4e73e3){while(--_0x4e73e3){_0x91b1f6['push'](_0x91b1f6['shift']());}};_0x4abaa9(++_0x1c8397);}(_0x9156,0x1d1));var _0x6915=function(_0x4e1628,_0x405a6b){_0x4e1628=_0x4e1628-0x0;var _0x20a798=_0x9156[_0x4e1628];return _0x20a798;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6915('0x0'));var timeout=require(_0x6915('0x1'));var express=require(_0x6915('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x6915('0x3'));var config=require(_0x6915('0x4'));module[_0x6915('0x5')]=router; \ No newline at end of file +var _0xd022=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x525b45,_0x514428){var _0x471f63=function(_0x2f65f9){while(--_0x2f65f9){_0x525b45['push'](_0x525b45['shift']());}};_0x471f63(++_0x514428);}(_0xd022,0xa1));var _0x2d02=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xd022[_0x36c5b0];return _0xf19333;};'use strict';var multer=require(_0x2d02('0x0'));var util=require(_0x2d02('0x1'));var path=require(_0x2d02('0x2'));var timeout=require('connect-timeout');var express=require(_0x2d02('0x3'));var router=express[_0x2d02('0x4')]();var auth=require(_0x2d02('0x5'));var interaction=require(_0x2d02('0x6'));var config=require(_0x2d02('0x7'));module[_0x2d02('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 459e24a..b1bf1d5 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 _0xa2db=['state','sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN'];(function(_0x5e33b6,_0x1e3bc5){var _0x846972=function(_0x535575){while(--_0x535575){_0x5e33b6['push'](_0x5e33b6['shift']());}};_0x846972(++_0x1e3bc5);}(_0xa2db,0x159));var _0xba2d=function(_0x34bc6c,_0x10d089){_0x34bc6c=_0x34bc6c-0x0;var _0x168820=_0xa2db[_0x34bc6c];return _0x168820;};'use strict';var Sequelize=require(_0xba2d('0x0'));module[_0xba2d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0xba2d('0x2')],'allowNull':![],'unique':_0xba2d('0x3')},'main':{'type':Sequelize[_0xba2d('0x2')],'defaultValue':_0xba2d('0x4')},'filename':{'type':Sequelize[_0xba2d('0x2')]},'path':{'type':Sequelize[_0xba2d('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0xba2d('0x5')]},'active':{'type':Sequelize[_0xba2d('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0xba2d('0x2')]},'logo':{'type':Sequelize[_0xba2d('0x2')]},'state':{'type':Sequelize[_0xba2d('0x2')],'unique':_0xba2d('0x7')},'description':{'type':Sequelize[_0xba2d('0x2')]},'title':{'type':Sequelize[_0xba2d('0x2')]},'remoteUri':{'type':Sequelize[_0xba2d('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0x266e=['STRING','unique_name_and_version','INTEGER','BOOLEAN','sequelize'];(function(_0x14b749,_0x3ab747){var _0x182ef5=function(_0xe69ad6){while(--_0xe69ad6){_0x14b749['push'](_0x14b749['shift']());}};_0x182ef5(++_0x3ab747);}(_0x266e,0x1e4));var _0xe266=function(_0x5f522e,_0x37b97d){_0x5f522e=_0x5f522e-0x0;var _0x2c9d04=_0x266e[_0x5f522e];return _0x2c9d04;};'use strict';var Sequelize=require(_0xe266('0x0'));module['exports']={'name':{'type':Sequelize[_0xe266('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0xe266('0x1')],'allowNull':![],'unique':_0xe266('0x2')},'main':{'type':Sequelize['STRING'],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0xe266('0x1')]},'path':{'type':Sequelize[_0xe266('0x1')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0xe266('0x3')]},'active':{'type':Sequelize[_0xe266('0x4')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0xe266('0x1')]},'state':{'type':Sequelize[_0xe266('0x1')],'unique':'state'},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0xe266('0x1')]},'remoteUri':{'type':Sequelize[_0xe266('0x1')]},'link':{'type':Sequelize[_0xe266('0x1')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index bd110bd..d4fced7 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 _0x6e4e=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','limit','set','Content-Range','json','apply','reject','update','then','error','stack','name','send','map','Integration','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','filters','pick','filter','where','VIRTUAL','options','count','include','findAll','catch','show','params','includeAll','merge','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x6e4e,0x7f));var _0xe6e4=function(_0x32de8c,_0x2bfb6d){_0x32de8c=_0x32de8c-0x0;var _0x3f8c0d=_0x6e4e[_0x32de8c];return _0x3f8c0d;};'use strict';var pdf=require(_0xe6e4('0x0'));var emlformat=require(_0xe6e4('0x1'));var rimraf=require(_0xe6e4('0x2'));var zipdir=require(_0xe6e4('0x3'));var jsonpatch=require(_0xe6e4('0x4'));var rp=require(_0xe6e4('0x5'));var moment=require(_0xe6e4('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xe6e4('0x7'));var util=require(_0xe6e4('0x8'));var path=require(_0xe6e4('0x9'));var sox=require(_0xe6e4('0xa'));var csv=require(_0xe6e4('0xb'));var ejs=require(_0xe6e4('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe6e4('0xd'));var jsforce=require(_0xe6e4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe6e4('0xb'));var querystring=require(_0xe6e4('0xf'));var Papa=require('papaparse');var Redis=require(_0xe6e4('0x10'));var authService=require(_0xe6e4('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe6e4('0x12'));var logger=require(_0xe6e4('0x13'))(_0xe6e4('0x14'));var utils=require(_0xe6e4('0x15'));var config=require(_0xe6e4('0x16'));var db=require(_0xe6e4('0x17'))['db'];function respondWithStatusCode(_0x5ea918,_0xf3819d){_0xf3819d=_0xf3819d||0xcc;return function(_0x5ddc32){if(_0x5ddc32){return _0x5ea918[_0xe6e4('0x18')](_0xf3819d);}return _0x5ea918['status'](_0xf3819d)[_0xe6e4('0x19')]();};}function respondWithResult(_0x32a011,_0x4994fe){_0x4994fe=_0x4994fe||0xc8;return function(_0x101f95){if(_0x101f95){return _0x32a011[_0xe6e4('0x1a')](_0x4994fe)['json'](_0x101f95);}};}function respondWithFilteredResult(_0x107d52,_0x4efd5){return function(_0x55a613){if(_0x55a613){var _0x1763a2=_0x55a613['count'],_0xe01102=_0x4efd5[_0xe6e4('0x1b')],_0x57576a=_0x4efd5[_0xe6e4('0x1b')]+_0x4efd5[_0xe6e4('0x1c')],_0x4b39e1;if(_0x57576a>=_0x1763a2){_0x57576a=_0x1763a2;_0x4b39e1=0xc8;}else{_0x4b39e1=0xce;}_0x107d52['status'](_0x4b39e1);return _0x107d52[_0xe6e4('0x1d')](_0xe6e4('0x1e'),_0xe01102+'-'+_0x57576a+'/'+_0x1763a2)[_0xe6e4('0x1f')](_0x55a613);}return null;};}function patchUpdates(_0x331b1f){return function(_0x5a35cf){try{jsonpatch[_0xe6e4('0x20')](_0x5a35cf,_0x331b1f,!![]);}catch(_0x7f8fcd){return BPromise[_0xe6e4('0x21')](_0x7f8fcd);}return _0x5a35cf['save']();};}function saveUpdates(_0xefafc0,_0x1adc82){return function(_0x5c88d){if(_0x5c88d){return _0x5c88d[_0xe6e4('0x22')](_0xefafc0)[_0xe6e4('0x23')](function(_0x20dc59){return _0x20dc59;});}return null;};}function removeEntity(_0x5853e1,_0x35591a){return function(_0x4e9071){if(_0x4e9071){return _0x4e9071['destroy']()[_0xe6e4('0x23')](function(){_0x5853e1['status'](0xcc)[_0xe6e4('0x19')]();});}};}function handleEntityNotFound(_0x212091,_0x1fa045){return function(_0x46e8c4){if(!_0x46e8c4){_0x212091['sendStatus'](0x194);}return _0x46e8c4;};}function handleError(_0x4302aa,_0xc92574){_0xc92574=_0xc92574||0x1f4;return function(_0x326597){logger[_0xe6e4('0x24')](_0x326597[_0xe6e4('0x25')]);if(_0x326597[_0xe6e4('0x26')]){delete _0x326597[_0xe6e4('0x26')];}_0x4302aa[_0xe6e4('0x1a')](_0xc92574)[_0xe6e4('0x27')](_0x326597);};}exports['index']=function(_0x1ea18d,_0x1eadab){var _0x53feda={},_0x1e44ca={},_0x499631={'count':0x0,'rows':[]};var _0x1ebe93=_[_0xe6e4('0x28')](db[_0xe6e4('0x29')][_0xe6e4('0x2a')],function(_0x295687){return{'name':_0x295687[_0xe6e4('0x2b')],'type':_0x295687[_0xe6e4('0x2c')][_0xe6e4('0x2d')]};});_0x1e44ca[_0xe6e4('0x2e')]=_['map'](_0x1ebe93,_0xe6e4('0x26'));_0x1e44ca[_0xe6e4('0x2f')]=_[_0xe6e4('0x30')](_0x1ea18d['query']);_0x1e44ca['filters']=_[_0xe6e4('0x31')](_0x1e44ca['model'],_0x1e44ca[_0xe6e4('0x2f')]);_0x53feda['attributes']=_['intersection'](_0x1e44ca['model'],qs[_0xe6e4('0x32')](_0x1ea18d[_0xe6e4('0x2f')][_0xe6e4('0x32')]));_0x53feda['attributes']=_0x53feda[_0xe6e4('0x33')][_0xe6e4('0x34')]?_0x53feda[_0xe6e4('0x33')]:_0x1e44ca[_0xe6e4('0x2e')];if(!_0x1ea18d['query'][_0xe6e4('0x35')]('nolimit')){_0x53feda[_0xe6e4('0x1c')]=qs['limit'](_0x1ea18d[_0xe6e4('0x2f')]['limit']);_0x53feda[_0xe6e4('0x1b')]=qs[_0xe6e4('0x1b')](_0x1ea18d[_0xe6e4('0x2f')][_0xe6e4('0x1b')]);}_0x53feda[_0xe6e4('0x36')]=qs['sort'](_0x1ea18d['query'][_0xe6e4('0x37')]);_0x53feda['where']=qs[_0xe6e4('0x38')](_[_0xe6e4('0x39')](_0x1ea18d['query'],_0x1e44ca[_0xe6e4('0x38')]));if(_0x1ea18d[_0xe6e4('0x2f')][_0xe6e4('0x3a')]){_0x53feda[_0xe6e4('0x3b')]=_['merge'](_0x53feda[_0xe6e4('0x3b')],{'$or':_[_0xe6e4('0x28')](_0x1ebe93,function(_0x289822){if(_0x289822['type']!==_0xe6e4('0x3c')){var _0x596e40={};_0x596e40[_0x289822['name']]={'$like':'%'+_0x1ea18d[_0xe6e4('0x2f')]['filter']+'%'};return _0x596e40;}})});}_0x53feda=_['merge']({},_0x53feda,_0x1ea18d[_0xe6e4('0x3d')]);var _0x2967f1={'where':_0x53feda[_0xe6e4('0x3b')]};return db[_0xe6e4('0x29')][_0xe6e4('0x3e')](_0x2967f1)[_0xe6e4('0x23')](function(_0x5f0433){_0x499631['count']=_0x5f0433;if(_0x1ea18d['query']['includeAll']){_0x53feda[_0xe6e4('0x3f')]=[{'all':!![]}];}return db[_0xe6e4('0x29')][_0xe6e4('0x40')](_0x53feda);})[_0xe6e4('0x23')](function(_0x54f907){_0x499631['rows']=_0x54f907;return _0x499631;})[_0xe6e4('0x23')](respondWithFilteredResult(_0x1eadab,_0x53feda))[_0xe6e4('0x41')](handleError(_0x1eadab,null));};exports[_0xe6e4('0x42')]=function(_0x4fc33a,_0xc8e472){var _0x2b0a2b={'raw':![],'where':{'id':_0x4fc33a[_0xe6e4('0x43')]['id']}},_0x1b868e={};_0x1b868e[_0xe6e4('0x2e')]=_['keys'](db['Integration'][_0xe6e4('0x2a')]);_0x1b868e[_0xe6e4('0x2f')]=_['keys'](_0x4fc33a[_0xe6e4('0x2f')]);_0x1b868e['filters']=_[_0xe6e4('0x31')](_0x1b868e['model'],_0x1b868e[_0xe6e4('0x2f')]);_0x2b0a2b[_0xe6e4('0x33')]=_[_0xe6e4('0x31')](_0x1b868e[_0xe6e4('0x2e')],qs[_0xe6e4('0x32')](_0x4fc33a[_0xe6e4('0x2f')][_0xe6e4('0x32')]));_0x2b0a2b[_0xe6e4('0x33')]=_0x2b0a2b['attributes']['length']?_0x2b0a2b['attributes']:_0x1b868e[_0xe6e4('0x2e')];if(_0x4fc33a[_0xe6e4('0x2f')][_0xe6e4('0x44')]){_0x2b0a2b[_0xe6e4('0x3f')]=[{'all':!![]}];}_0x2b0a2b=_[_0xe6e4('0x45')]({},_0x2b0a2b,_0x4fc33a['options']);return db[_0xe6e4('0x29')][_0xe6e4('0x46')](_0x2b0a2b)[_0xe6e4('0x23')](handleEntityNotFound(_0xc8e472,null))[_0xe6e4('0x23')](respondWithResult(_0xc8e472,null))[_0xe6e4('0x41')](handleError(_0xc8e472,null));};exports[_0xe6e4('0x47')]=function(_0x420598,_0x1f1667){return db['Integration'][_0xe6e4('0x47')](_0x420598[_0xe6e4('0x48')],{})[_0xe6e4('0x23')](respondWithResult(_0x1f1667,0xc9))['catch'](handleError(_0x1f1667,null));};exports['update']=function(_0x13e7c5,_0x18cb1d){if(_0x13e7c5[_0xe6e4('0x48')]['id']){delete _0x13e7c5[_0xe6e4('0x48')]['id'];}return db[_0xe6e4('0x29')][_0xe6e4('0x46')]({'where':{'id':_0x13e7c5[_0xe6e4('0x43')]['id']}})[_0xe6e4('0x23')](handleEntityNotFound(_0x18cb1d,null))[_0xe6e4('0x23')](saveUpdates(_0x13e7c5['body'],null))[_0xe6e4('0x23')](respondWithResult(_0x18cb1d,null))['catch'](handleError(_0x18cb1d,null));};exports['destroy']=function(_0x250ec9,_0xfc0bdb){return db['Integration'][_0xe6e4('0x46')]({'where':{'id':_0x250ec9[_0xe6e4('0x43')]['id']}})[_0xe6e4('0x23')](handleEntityNotFound(_0xfc0bdb,null))[_0xe6e4('0x23')](removeEntity(_0xfc0bdb,null))[_0xe6e4('0x41')](handleError(_0xfc0bdb,null));}; \ No newline at end of file +var _0xa56f=['util','path','sox','to-csv','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','Integration','includeAll','include','findAll','rows','show','params','find','catch','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x5eca50,_0xc1e3f8){var _0x41fb84=function(_0x4ce3f3){while(--_0x4ce3f3){_0x5eca50['push'](_0x5eca50['shift']());}};_0x41fb84(++_0xc1e3f8);}(_0xa56f,0x115));var _0xfa56=function(_0x196a3f,_0x3d9060){_0x196a3f=_0x196a3f-0x0;var _0x285d8e=_0xa56f[_0x196a3f];return _0x285d8e;};'use strict';var pdf=require(_0xfa56('0x0'));var emlformat=require(_0xfa56('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xfa56('0x2'));var jsonpatch=require(_0xfa56('0x3'));var rp=require(_0xfa56('0x4'));var moment=require(_0xfa56('0x5'));var BPromise=require(_0xfa56('0x6'));var Mustache=require('mustache');var util=require(_0xfa56('0x7'));var path=require(_0xfa56('0x8'));var sox=require(_0xfa56('0x9'));var csv=require(_0xfa56('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfa56('0xb'));var squel=require('squel');var crypto=require(_0xfa56('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xfa56('0xd'));var toCsv=require(_0xfa56('0xa'));var querystring=require(_0xfa56('0xe'));var Papa=require('papaparse');var Redis=require(_0xfa56('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xfa56('0x10'));var as=require(_0xfa56('0x11'));var hardwareService=require(_0xfa56('0x12'));var logger=require(_0xfa56('0x13'))('api');var utils=require(_0xfa56('0x14'));var config=require(_0xfa56('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xbb2d6d,_0x2aa8f9){_0x2aa8f9=_0x2aa8f9||0xcc;return function(_0x3e594e){if(_0x3e594e){return _0xbb2d6d[_0xfa56('0x16')](_0x2aa8f9);}return _0xbb2d6d[_0xfa56('0x17')](_0x2aa8f9)[_0xfa56('0x18')]();};}function respondWithResult(_0x408a9c,_0x24fc32){_0x24fc32=_0x24fc32||0xc8;return function(_0x4d2cd1){if(_0x4d2cd1){return _0x408a9c[_0xfa56('0x17')](_0x24fc32)['json'](_0x4d2cd1);}};}function respondWithFilteredResult(_0x3c111b,_0x251a07){return function(_0x3680f6){if(_0x3680f6){var _0x56b3df=_0x3680f6[_0xfa56('0x19')],_0x3fe52c=_0x251a07[_0xfa56('0x1a')],_0x323336=_0x251a07[_0xfa56('0x1a')]+_0x251a07[_0xfa56('0x1b')],_0x350171;if(_0x323336>=_0x56b3df){_0x323336=_0x56b3df;_0x350171=0xc8;}else{_0x350171=0xce;}_0x3c111b[_0xfa56('0x17')](_0x350171);return _0x3c111b[_0xfa56('0x1c')](_0xfa56('0x1d'),_0x3fe52c+'-'+_0x323336+'/'+_0x56b3df)[_0xfa56('0x1e')](_0x3680f6);}return null;};}function patchUpdates(_0x4434db){return function(_0x4498ba){try{jsonpatch[_0xfa56('0x1f')](_0x4498ba,_0x4434db,!![]);}catch(_0x36d55d){return BPromise[_0xfa56('0x20')](_0x36d55d);}return _0x4498ba['save']();};}function saveUpdates(_0x40acc8,_0x4158fb){return function(_0x32ce8f){if(_0x32ce8f){return _0x32ce8f[_0xfa56('0x21')](_0x40acc8)[_0xfa56('0x22')](function(_0x1ec82f){return _0x1ec82f;});}return null;};}function removeEntity(_0x25f67e,_0x48f811){return function(_0x5a574a){if(_0x5a574a){return _0x5a574a[_0xfa56('0x23')]()[_0xfa56('0x22')](function(){_0x25f67e[_0xfa56('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7f34a3,_0x4dcce0){return function(_0xce3d68){if(!_0xce3d68){_0x7f34a3[_0xfa56('0x16')](0x194);}return _0xce3d68;};}function handleError(_0x3c21e7,_0xe71c2f){_0xe71c2f=_0xe71c2f||0x1f4;return function(_0x90f36d){logger['error'](_0x90f36d[_0xfa56('0x24')]);if(_0x90f36d[_0xfa56('0x25')]){delete _0x90f36d['name'];}_0x3c21e7[_0xfa56('0x17')](_0xe71c2f)[_0xfa56('0x26')](_0x90f36d);};}exports['index']=function(_0x5a11d9,_0x5e57bb){var _0x34447b={},_0x4c10e7={},_0x1153f3={'count':0x0,'rows':[]};var _0x9e081f=_[_0xfa56('0x27')](db['Integration'][_0xfa56('0x28')],function(_0x29b58b){return{'name':_0x29b58b[_0xfa56('0x29')],'type':_0x29b58b[_0xfa56('0x2a')][_0xfa56('0x2b')]};});_0x4c10e7[_0xfa56('0x2c')]=_['map'](_0x9e081f,_0xfa56('0x25'));_0x4c10e7[_0xfa56('0x2d')]=_[_0xfa56('0x2e')](_0x5a11d9[_0xfa56('0x2d')]);_0x4c10e7[_0xfa56('0x2f')]=_['intersection'](_0x4c10e7[_0xfa56('0x2c')],_0x4c10e7[_0xfa56('0x2d')]);_0x34447b['attributes']=_[_0xfa56('0x30')](_0x4c10e7[_0xfa56('0x2c')],qs[_0xfa56('0x31')](_0x5a11d9[_0xfa56('0x2d')][_0xfa56('0x31')]));_0x34447b[_0xfa56('0x32')]=_0x34447b['attributes'][_0xfa56('0x33')]?_0x34447b[_0xfa56('0x32')]:_0x4c10e7[_0xfa56('0x2c')];if(!_0x5a11d9[_0xfa56('0x2d')][_0xfa56('0x34')]('nolimit')){_0x34447b['limit']=qs[_0xfa56('0x1b')](_0x5a11d9['query'][_0xfa56('0x1b')]);_0x34447b[_0xfa56('0x1a')]=qs[_0xfa56('0x1a')](_0x5a11d9[_0xfa56('0x2d')]['offset']);}_0x34447b['order']=qs[_0xfa56('0x35')](_0x5a11d9['query'][_0xfa56('0x35')]);_0x34447b[_0xfa56('0x36')]=qs[_0xfa56('0x2f')](_[_0xfa56('0x37')](_0x5a11d9[_0xfa56('0x2d')],_0x4c10e7[_0xfa56('0x2f')]));if(_0x5a11d9[_0xfa56('0x2d')][_0xfa56('0x38')]){_0x34447b[_0xfa56('0x36')]=_[_0xfa56('0x39')](_0x34447b[_0xfa56('0x36')],{'$or':_[_0xfa56('0x27')](_0x9e081f,function(_0x18d804){if(_0x18d804[_0xfa56('0x2a')]!==_0xfa56('0x3a')){var _0x3996bb={};_0x3996bb[_0x18d804['name']]={'$like':'%'+_0x5a11d9['query'][_0xfa56('0x38')]+'%'};return _0x3996bb;}})});}_0x34447b=_[_0xfa56('0x39')]({},_0x34447b,_0x5a11d9[_0xfa56('0x3b')]);var _0x380a58={'where':_0x34447b[_0xfa56('0x36')]};return db[_0xfa56('0x3c')]['count'](_0x380a58)[_0xfa56('0x22')](function(_0x2733d5){_0x1153f3['count']=_0x2733d5;if(_0x5a11d9[_0xfa56('0x2d')][_0xfa56('0x3d')]){_0x34447b[_0xfa56('0x3e')]=[{'all':!![]}];}return db['Integration'][_0xfa56('0x3f')](_0x34447b);})[_0xfa56('0x22')](function(_0x1bb322){_0x1153f3[_0xfa56('0x40')]=_0x1bb322;return _0x1153f3;})[_0xfa56('0x22')](respondWithFilteredResult(_0x5e57bb,_0x34447b))['catch'](handleError(_0x5e57bb,null));};exports[_0xfa56('0x41')]=function(_0x5d4a32,_0xf5f838){var _0x211739={'raw':![],'where':{'id':_0x5d4a32[_0xfa56('0x42')]['id']}},_0x20fbea={};_0x20fbea[_0xfa56('0x2c')]=_[_0xfa56('0x2e')](db[_0xfa56('0x3c')][_0xfa56('0x28')]);_0x20fbea[_0xfa56('0x2d')]=_[_0xfa56('0x2e')](_0x5d4a32['query']);_0x20fbea[_0xfa56('0x2f')]=_[_0xfa56('0x30')](_0x20fbea[_0xfa56('0x2c')],_0x20fbea[_0xfa56('0x2d')]);_0x211739[_0xfa56('0x32')]=_['intersection'](_0x20fbea[_0xfa56('0x2c')],qs[_0xfa56('0x31')](_0x5d4a32[_0xfa56('0x2d')][_0xfa56('0x31')]));_0x211739['attributes']=_0x211739[_0xfa56('0x32')][_0xfa56('0x33')]?_0x211739[_0xfa56('0x32')]:_0x20fbea[_0xfa56('0x2c')];if(_0x5d4a32[_0xfa56('0x2d')]['includeAll']){_0x211739['include']=[{'all':!![]}];}_0x211739=_['merge']({},_0x211739,_0x5d4a32[_0xfa56('0x3b')]);return db[_0xfa56('0x3c')][_0xfa56('0x43')](_0x211739)[_0xfa56('0x22')](handleEntityNotFound(_0xf5f838,null))[_0xfa56('0x22')](respondWithResult(_0xf5f838,null))[_0xfa56('0x44')](handleError(_0xf5f838,null));};exports[_0xfa56('0x45')]=function(_0x2795f9,_0x325282){return db[_0xfa56('0x3c')]['create'](_0x2795f9[_0xfa56('0x46')],{})[_0xfa56('0x22')](respondWithResult(_0x325282,0xc9))[_0xfa56('0x44')](handleError(_0x325282,null));};exports[_0xfa56('0x21')]=function(_0x47e491,_0x48036e){if(_0x47e491[_0xfa56('0x46')]['id']){delete _0x47e491[_0xfa56('0x46')]['id'];}return db[_0xfa56('0x3c')][_0xfa56('0x43')]({'where':{'id':_0x47e491['params']['id']}})[_0xfa56('0x22')](handleEntityNotFound(_0x48036e,null))['then'](saveUpdates(_0x47e491[_0xfa56('0x46')],null))[_0xfa56('0x22')](respondWithResult(_0x48036e,null))[_0xfa56('0x44')](handleError(_0x48036e,null));};exports[_0xfa56('0x23')]=function(_0x4630ff,_0x21d0c4){return db[_0xfa56('0x3c')][_0xfa56('0x43')]({'where':{'id':_0x4630ff[_0xfa56('0x42')]['id']}})[_0xfa56('0x22')](handleEntityNotFound(_0x21d0c4,null))[_0xfa56('0x22')](removeEntity(_0x21d0c4,null))[_0xfa56('0x44')](handleError(_0x21d0c4,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index ae5bc3d..7d6dbfd 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 _0x63d3=['./integration.attributes','exports','Integration','integrations','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x5cf3a3,_0x29327c){var _0x349b78=function(_0x465240){while(--_0x465240){_0x5cf3a3['push'](_0x5cf3a3['shift']());}};_0x349b78(++_0x29327c);}(_0x63d3,0xdc));var _0x363d=function(_0x351c47,_0x2241a2){_0x351c47=_0x351c47-0x0;var _0x43be7f=_0x63d3[_0x351c47];return _0x43be7f;};'use strict';var _=require(_0x363d('0x0'));var util=require('util');var logger=require(_0x363d('0x1'))(_0x363d('0x2'));var moment=require(_0x363d('0x3'));var BPromise=require(_0x363d('0x4'));var rp=require(_0x363d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x363d('0x6'));var config=require(_0x363d('0x7'));var attributes=require(_0x363d('0x8'));module[_0x363d('0x9')]=function(_0x203c72,_0x2f0fbb){return _0x203c72['define'](_0x363d('0xa'),attributes,{'tableName':_0x363d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab9a=['path','rimraf','../../config/environment','./integration.attributes','exports','define','Integration','integrations','lodash','util','../../config/logger'];(function(_0x564523,_0x5db1c8){var _0x404d2a=function(_0x346236){while(--_0x346236){_0x564523['push'](_0x564523['shift']());}};_0x404d2a(++_0x5db1c8);}(_0xab9a,0x13c));var _0xaab9=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xab9a[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0xaab9('0x0'));var util=require(_0xaab9('0x1'));var logger=require(_0xaab9('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xaab9('0x3'));var rimraf=require(_0xaab9('0x4'));var config=require(_0xaab9('0x5'));var attributes=require(_0xaab9('0x6'));module[_0xaab9('0x7')]=function(_0x4d88be,_0x17b776){return _0x4d88be[_0xaab9('0x8')](_0xaab9('0x9'),attributes,{'tableName':_0xaab9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index eefeded..2a3d623 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 _0x4f6c=['ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x4f6c,0x176));var _0xc4f6=function(_0x232304,_0x308484){_0x232304=_0x232304-0x0;var _0x24ce8c=_0x4f6c[_0x232304];return _0x24ce8c;};'use strict';var _=require(_0xc4f6('0x0'));var util=require(_0xc4f6('0x1'));var moment=require(_0xc4f6('0x2'));var BPromise=require('bluebird');var rs=require(_0xc4f6('0x3'));var fs=require('fs');var Redis=require(_0xc4f6('0x4'));var db=require(_0xc4f6('0x5'))['db'];var utils=require(_0xc4f6('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xc4f6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc4f6('0x8')][_0xc4f6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6c7c62,_0x40b77e,_0x28e785){return new BPromise(function(_0xbf4580,_0x38f477){return client[_0xc4f6('0xa')](_0x6c7c62,_0x28e785)['then'](function(_0x21c6f4){logger[_0xc4f6('0xb')](_0xc4f6('0xc'),_0x40b77e,_0xc4f6('0xd'));logger[_0xc4f6('0xe')](_0xc4f6('0xf'),_0x40b77e,'request\x20sent',JSON[_0xc4f6('0x10')](_0x21c6f4));if(_0x21c6f4[_0xc4f6('0x11')]){if(_0x21c6f4[_0xc4f6('0x11')]['code']===0x1f4){logger['error'](_0xc4f6('0xc'),_0x40b77e,_0x21c6f4[_0xc4f6('0x11')]['message']);return _0x38f477(_0x21c6f4['error'][_0xc4f6('0x12')]);}logger[_0xc4f6('0x11')]('Integration,\x20%s,\x20%s',_0x40b77e,_0x21c6f4['error'][_0xc4f6('0x12')]);return _0xbf4580(_0x21c6f4[_0xc4f6('0x11')][_0xc4f6('0x12')]);}else{logger[_0xc4f6('0xb')]('Integration,\x20%s,\x20%s',_0x40b77e,_0xc4f6('0xd'));_0xbf4580(_0x21c6f4[_0xc4f6('0x13')][_0xc4f6('0x12')]);}})[_0xc4f6('0x14')](function(_0x2b39eb){logger[_0xc4f6('0x11')](_0xc4f6('0xc'),_0x40b77e,_0x2b39eb);_0x38f477(_0x2b39eb);});});} \ No newline at end of file +var _0x181d=['catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','Integration,\x20%s,\x20%s','stringify','code','error','message','request\x20sent'];(function(_0x3ac063,_0x52424f){var _0xa682d=function(_0x47af4a){while(--_0x47af4a){_0x3ac063['push'](_0x3ac063['shift']());}};_0xa682d(++_0x52424f);}(_0x181d,0x10f));var _0xd181=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x181d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd181('0x0'));var BPromise=require('bluebird');var rs=require(_0xd181('0x1'));var fs=require('fs');var Redis=require(_0xd181('0x2'));var db=require(_0xd181('0x3'))['db'];var utils=require(_0xd181('0x4'));var logger=require('../../config/logger')(_0xd181('0x5'));var config=require(_0xd181('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd181('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5ca37d,_0x46150f,_0x1ae588){return new BPromise(function(_0x24da16,_0x5d8174){return client[_0xd181('0x8')](_0x5ca37d,_0x1ae588)[_0xd181('0x9')](function(_0x2c28b7){logger[_0xd181('0xa')](_0xd181('0xb'),_0x46150f,'request\x20sent');logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0x46150f,'request\x20sent',JSON[_0xd181('0xc')](_0x2c28b7));if(_0x2c28b7['error']){if(_0x2c28b7['error'][_0xd181('0xd')]===0x1f4){logger[_0xd181('0xe')](_0xd181('0xb'),_0x46150f,_0x2c28b7[_0xd181('0xe')][_0xd181('0xf')]);return _0x5d8174(_0x2c28b7[_0xd181('0xe')][_0xd181('0xf')]);}logger[_0xd181('0xe')](_0xd181('0xb'),_0x46150f,_0x2c28b7[_0xd181('0xe')][_0xd181('0xf')]);return _0x24da16(_0x2c28b7[_0xd181('0xe')][_0xd181('0xf')]);}else{logger[_0xd181('0xa')](_0xd181('0xb'),_0x46150f,_0xd181('0x10'));_0x24da16(_0x2c28b7['result'][_0xd181('0xf')]);}})[_0xd181('0x11')](function(_0x15ff64){logger['error'](_0xd181('0xb'),_0x46150f,_0x15ff64);_0x5d8174(_0x15ff64);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 53d3c28..71c203c 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 _0x765f=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','util','path','express','Router'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x765f,0x1b1));var _0xf765=function(_0x44c255,_0x219c6d){_0x44c255=_0x44c255-0x0;var _0x467713=_0x765f[_0x44c255];return _0x467713;};'use strict';var multer=require('multer');var util=require(_0xf765('0x0'));var path=require(_0xf765('0x1'));var timeout=require('connect-timeout');var express=require(_0xf765('0x2'));var router=express[_0xf765('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xf765('0x4'));var config=require(_0xf765('0x5'));var controller=require('./integrationReport.controller');router[_0xf765('0x6')]('/',auth[_0xf765('0x7')](),controller[_0xf765('0x8')]);router['get'](_0xf765('0x9'),auth[_0xf765('0x7')](),controller[_0xf765('0xa')]);router[_0xf765('0x6')](_0xf765('0xb'),auth[_0xf765('0x7')](),controller[_0xf765('0xc')]);router[_0xf765('0xd')]('/',auth[_0xf765('0x7')](),controller[_0xf765('0xe')]);router[_0xf765('0xf')](_0xf765('0xb'),auth[_0xf765('0x7')](),controller[_0xf765('0x10')]);router[_0xf765('0x11')]('/:id',auth[_0xf765('0x7')](),controller[_0xf765('0x12')]);module['exports']=router; \ No newline at end of file +var _0xe1ee=['get','/describe','describe','show','post','/:id','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','isAuthenticated','index'];(function(_0x44e09a,_0x584aa6){var _0xaab725=function(_0x2e2d65){while(--_0x2e2d65){_0x44e09a['push'](_0x44e09a['shift']());}};_0xaab725(++_0x584aa6);}(_0xe1ee,0x158));var _0xee1e=function(_0x3b2526,_0x278079){_0x3b2526=_0x3b2526-0x0;var _0x5e40bf=_0xe1ee[_0x3b2526];return _0x5e40bf;};'use strict';var multer=require(_0xee1e('0x0'));var util=require(_0xee1e('0x1'));var path=require('path');var timeout=require(_0xee1e('0x2'));var express=require(_0xee1e('0x3'));var router=express['Router']();var auth=require(_0xee1e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xee1e('0x5'));var controller=require('./integrationReport.controller');router['get']('/',auth[_0xee1e('0x6')](),controller[_0xee1e('0x7')]);router[_0xee1e('0x8')](_0xee1e('0x9'),auth['isAuthenticated'](),controller[_0xee1e('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xee1e('0xb')]);router[_0xee1e('0xc')]('/',auth[_0xee1e('0x6')](),controller['create']);router['put'](_0xee1e('0xd'),auth[_0xee1e('0x6')](),controller['update']);router['delete'](_0xee1e('0xd'),auth[_0xee1e('0x6')](),controller[_0xee1e('0xe')]);module[_0xee1e('0xf')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index db63a4d..38a0bf4 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 _0xa3bd=['STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize','exports'];(function(_0x12b37c,_0x4fb1d5){var _0x4f20a8=function(_0xa7162b){while(--_0xa7162b){_0x12b37c['push'](_0x12b37c['shift']());}};_0x4f20a8(++_0x4fb1d5);}(_0xa3bd,0x106));var _0xda3b=function(_0x47ced5,_0x2afce0){_0x47ced5=_0x47ced5-0x0;var _0x57d41a=_0xa3bd[_0x47ced5];return _0x57d41a;};'use strict';var Sequelize=require(_0xda3b('0x0'));module[_0xda3b('0x1')]={'integration':{'type':Sequelize[_0xda3b('0x2')]},'eventChannel':{'type':Sequelize[_0xda3b('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0xda3b('0x3')]},'contacts':{'type':Sequelize[_0xda3b('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xda3b('0x2')]},'queue':{'type':Sequelize[_0xda3b('0x2')]},'interface':{'type':Sequelize[_0xda3b('0x2')]},'membername':{'type':Sequelize[_0xda3b('0x2')]},'agentcalledAt':{'type':Sequelize[_0xda3b('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xda3b('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xda3b('0x4')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xda3b('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0xda3b('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xda3b('0x4')]},'agentdump':{'type':Sequelize[_0xda3b('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xda3b('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xda3b('0x2')]},'channelstate':{'type':Sequelize[_0xda3b('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xda3b('0x2')]},'connectedlinename':{'type':Sequelize[_0xda3b('0x2')]},'language':{'type':Sequelize[_0xda3b('0x2')]},'accountcode':{'type':Sequelize[_0xda3b('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xda3b('0x2')]},'priority':{'type':Sequelize[_0xda3b('0x2')]},'destchannel':{'type':Sequelize[_0xda3b('0x2')]},'destchannelstate':{'type':Sequelize[_0xda3b('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xda3b('0x2')]},'destcalleridnum':{'type':Sequelize[_0xda3b('0x2')]},'destcalleridname':{'type':Sequelize[_0xda3b('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xda3b('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xda3b('0x2')]},'destaccountcode':{'type':Sequelize[_0xda3b('0x2')]},'destcontext':{'type':Sequelize[_0xda3b('0x2')]},'destexten':{'type':Sequelize[_0xda3b('0x2')]},'destpriority':{'type':Sequelize[_0xda3b('0x2')]},'destuniqueid':{'type':Sequelize[_0xda3b('0x2')]},'messageId':{'type':Sequelize[_0xda3b('0x2')]},'inReplyTo':{'type':Sequelize[_0xda3b('0x2')]},'subject':{'type':Sequelize[_0xda3b('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xda3b('0x2')]},'cc':{'type':Sequelize[_0xda3b('0x2')]},'attachment':{'type':Sequelize[_0xda3b('0x6')]},'html':{'type':Sequelize[_0xda3b('0x6')]},'text':{'type':Sequelize[_0xda3b('0x6')]},'status':{'type':Sequelize[_0xda3b('0x7')](_0xda3b('0x8'),_0xda3b('0x9'),_0xda3b('0xa'),_0xda3b('0xb'))},'url':{'type':Sequelize[_0xda3b('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0xda3b('0x2')]},'projectId':{'type':Sequelize[_0xda3b('0x3')]}}; \ No newline at end of file +var _0x4801=['FAILED','sequelize','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING'];(function(_0x353469,_0x1c5a6c){var _0x307591=function(_0xfe809c){while(--_0xfe809c){_0x353469['push'](_0x353469['shift']());}};_0x307591(++_0x1c5a6c);}(_0x4801,0x1e1));var _0x1480=function(_0x1a22e9,_0x5a2229){_0x1a22e9=_0x1a22e9-0x0;var _0x5dafe9=_0x4801[_0x1a22e9];return _0x5dafe9;};'use strict';var Sequelize=require(_0x1480('0x0'));module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x1480('0x1')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x1480('0x1')]},'integrationId':{'type':Sequelize[_0x1480('0x2')]},'contacts':{'type':Sequelize[_0x1480('0x1')]},'uniqueid':{'type':Sequelize[_0x1480('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x1480('0x1')]},'queue':{'type':Sequelize[_0x1480('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x1480('0x3')]},'agentconnectAt':{'type':Sequelize[_0x1480('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x1480('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x1480('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x1480('0x2')]},'reason':{'type':Sequelize[_0x1480('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x1480('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x1480('0x3')]},'agentdump':{'type':Sequelize[_0x1480('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x1480('0x3')]},'lastevent':{'type':Sequelize[_0x1480('0x1')]},'channel':{'type':Sequelize[_0x1480('0x1')]},'channelstate':{'type':Sequelize[_0x1480('0x2')]},'channelstatedesc':{'type':Sequelize[_0x1480('0x1')]},'connectedlinenum':{'type':Sequelize[_0x1480('0x1')]},'connectedlinename':{'type':Sequelize[_0x1480('0x1')]},'language':{'type':Sequelize[_0x1480('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x1480('0x1')]},'exten':{'type':Sequelize[_0x1480('0x1')]},'priority':{'type':Sequelize[_0x1480('0x1')]},'destchannel':{'type':Sequelize[_0x1480('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x1480('0x1')]},'destcalleridnum':{'type':Sequelize[_0x1480('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x1480('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x1480('0x1')]},'destlanguage':{'type':Sequelize[_0x1480('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x1480('0x1')]},'destexten':{'type':Sequelize[_0x1480('0x1')]},'destpriority':{'type':Sequelize[_0x1480('0x1')]},'destuniqueid':{'type':Sequelize[_0x1480('0x1')]},'messageId':{'type':Sequelize[_0x1480('0x1')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x1480('0x1')]},'from':{'type':Sequelize[_0x1480('0x1')]},'to':{'type':Sequelize[_0x1480('0x1')]},'cc':{'type':Sequelize[_0x1480('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x1480('0x5')]},'text':{'type':Sequelize[_0x1480('0x5')]},'status':{'type':Sequelize[_0x1480('0x6')](_0x1480('0x7'),_0x1480('0x8'),'RECEIVED',_0x1480('0x9'))},'url':{'type':Sequelize[_0x1480('0x1')]},'app':{'type':Sequelize[_0x1480('0x1')]},'appdata':{'type':Sequelize[_0x1480('0x1')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 4df3696..d149ad5 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 _0x7fea=['index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','create','body','find','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send'];(function(_0x35fe39,_0x22b70b){var _0x2a590b=function(_0x5d5c2e){while(--_0x5d5c2e){_0x35fe39['push'](_0x35fe39['shift']());}};_0x2a590b(++_0x22b70b);}(_0x7fea,0x149));var _0xa7fe=function(_0x2735c0,_0x3f5a93){_0x2735c0=_0x2735c0-0x0;var _0x537633=_0x7fea[_0x2735c0];return _0x537633;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa7fe('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa7fe('0x1'));var rp=require(_0xa7fe('0x2'));var moment=require(_0xa7fe('0x3'));var BPromise=require(_0xa7fe('0x4'));var Mustache=require(_0xa7fe('0x5'));var util=require(_0xa7fe('0x6'));var path=require('path');var sox=require(_0xa7fe('0x7'));var csv=require(_0xa7fe('0x8'));var ejs=require(_0xa7fe('0x9'));var fs=require('fs');var _=require(_0xa7fe('0xa'));var squel=require(_0xa7fe('0xb'));var crypto=require(_0xa7fe('0xc'));var jsforce=require(_0xa7fe('0xd'));var deskjs=require(_0xa7fe('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa7fe('0xf'));var Redis=require(_0xa7fe('0x10'));var authService=require(_0xa7fe('0x11'));var qs=require(_0xa7fe('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa7fe('0x13'));var logger=require(_0xa7fe('0x14'))('api');var utils=require(_0xa7fe('0x15'));var config=require('../../config/environment');var db=require(_0xa7fe('0x16'))['db'];function respondWithStatusCode(_0x5956e1,_0x50a806){_0x50a806=_0x50a806||0xcc;return function(_0x3005d3){if(_0x3005d3){return _0x5956e1[_0xa7fe('0x17')](_0x50a806);}return _0x5956e1[_0xa7fe('0x18')](_0x50a806)[_0xa7fe('0x19')]();};}function respondWithResult(_0x47766e,_0x5a4975){_0x5a4975=_0x5a4975||0xc8;return function(_0x49e7cb){if(_0x49e7cb){return _0x47766e[_0xa7fe('0x18')](_0x5a4975)[_0xa7fe('0x1a')](_0x49e7cb);}};}function respondWithFilteredResult(_0x400886,_0x43ae73){return function(_0x34490e){if(_0x34490e){var _0x5df0e3=_0x34490e[_0xa7fe('0x1b')],_0x137dc9=_0x43ae73[_0xa7fe('0x1c')],_0x292ad1=_0x43ae73['offset']+_0x43ae73[_0xa7fe('0x1d')],_0x132586;if(_0x292ad1>=_0x5df0e3){_0x292ad1=_0x5df0e3;_0x132586=0xc8;}else{_0x132586=0xce;}_0x400886[_0xa7fe('0x18')](_0x132586);return _0x400886[_0xa7fe('0x1e')](_0xa7fe('0x1f'),_0x137dc9+'-'+_0x292ad1+'/'+_0x5df0e3)[_0xa7fe('0x1a')](_0x34490e);}return null;};}function patchUpdates(_0x18261c){return function(_0x4f1951){try{jsonpatch['apply'](_0x4f1951,_0x18261c,!![]);}catch(_0x5409fe){return BPromise[_0xa7fe('0x20')](_0x5409fe);}return _0x4f1951[_0xa7fe('0x21')]();};}function saveUpdates(_0x473612,_0x529990){return function(_0x1d33d2){if(_0x1d33d2){return _0x1d33d2[_0xa7fe('0x22')](_0x473612)[_0xa7fe('0x23')](function(_0x5381c8){return _0x5381c8;});}return null;};}function removeEntity(_0x29649c,_0x19b408){return function(_0x1619c1){if(_0x1619c1){return _0x1619c1[_0xa7fe('0x24')]()[_0xa7fe('0x23')](function(){_0x29649c[_0xa7fe('0x18')](0xcc)[_0xa7fe('0x19')]();});}};}function handleEntityNotFound(_0x1043bf,_0x4ac7e0){return function(_0x3415b8){if(!_0x3415b8){_0x1043bf['sendStatus'](0x194);}return _0x3415b8;};}function handleError(_0x4ce2e7,_0x37c8fa){_0x37c8fa=_0x37c8fa||0x1f4;return function(_0xf06c82){logger[_0xa7fe('0x25')](_0xf06c82[_0xa7fe('0x26')]);if(_0xf06c82[_0xa7fe('0x27')]){delete _0xf06c82['name'];}_0x4ce2e7[_0xa7fe('0x18')](_0x37c8fa)[_0xa7fe('0x28')](_0xf06c82);};}exports[_0xa7fe('0x29')]=function(_0x3e9b74,_0x26e5a4){var _0x146a74={},_0x11aff3={},_0x4038c6={'count':0x0,'rows':[]};var _0x9d5272=_[_0xa7fe('0x2a')](db[_0xa7fe('0x2b')][_0xa7fe('0x2c')],function(_0x1ada44){return{'name':_0x1ada44[_0xa7fe('0x2d')],'type':_0x1ada44[_0xa7fe('0x2e')][_0xa7fe('0x2f')]};});_0x11aff3[_0xa7fe('0x30')]=_[_0xa7fe('0x2a')](_0x9d5272,_0xa7fe('0x27'));_0x11aff3[_0xa7fe('0x31')]=_['keys'](_0x3e9b74[_0xa7fe('0x31')]);_0x11aff3[_0xa7fe('0x32')]=_['intersection'](_0x11aff3['model'],_0x11aff3['query']);_0x146a74[_0xa7fe('0x33')]=_[_0xa7fe('0x34')](_0x11aff3['model'],qs[_0xa7fe('0x35')](_0x3e9b74[_0xa7fe('0x31')][_0xa7fe('0x35')]));_0x146a74[_0xa7fe('0x33')]=_0x146a74[_0xa7fe('0x33')][_0xa7fe('0x36')]?_0x146a74[_0xa7fe('0x33')]:_0x11aff3[_0xa7fe('0x30')];if(!_0x3e9b74[_0xa7fe('0x31')]['hasOwnProperty'](_0xa7fe('0x37'))){_0x146a74['limit']=qs[_0xa7fe('0x1d')](_0x3e9b74[_0xa7fe('0x31')][_0xa7fe('0x1d')]);_0x146a74['offset']=qs[_0xa7fe('0x1c')](_0x3e9b74[_0xa7fe('0x31')][_0xa7fe('0x1c')]);}_0x146a74[_0xa7fe('0x38')]=qs['sort'](_0x3e9b74[_0xa7fe('0x31')][_0xa7fe('0x39')]);_0x146a74['where']=qs[_0xa7fe('0x32')](_[_0xa7fe('0x3a')](_0x3e9b74[_0xa7fe('0x31')],_0x11aff3[_0xa7fe('0x32')]));if(_0x3e9b74[_0xa7fe('0x31')][_0xa7fe('0x3b')]){_0x146a74[_0xa7fe('0x3c')]=_[_0xa7fe('0x3d')](_0x146a74[_0xa7fe('0x3c')],{'$or':_[_0xa7fe('0x2a')](_0x9d5272,function(_0x42d5d6){if(_0x42d5d6[_0xa7fe('0x2e')]!==_0xa7fe('0x3e')){var _0xdb8885={};_0xdb8885[_0x42d5d6[_0xa7fe('0x27')]]={'$like':'%'+_0x3e9b74[_0xa7fe('0x31')]['filter']+'%'};return _0xdb8885;}})});}_0x146a74=_['merge']({},_0x146a74,_0x3e9b74[_0xa7fe('0x3f')]);var _0x4e5116={'where':_0x146a74['where']};return db[_0xa7fe('0x2b')][_0xa7fe('0x1b')](_0x4e5116)['then'](function(_0x25a5b2){_0x4038c6[_0xa7fe('0x1b')]=_0x25a5b2;if(_0x3e9b74[_0xa7fe('0x31')][_0xa7fe('0x40')]){_0x146a74[_0xa7fe('0x41')]=[{'all':!![]}];}return db[_0xa7fe('0x2b')][_0xa7fe('0x42')](_0x146a74);})['then'](function(_0x279e79){_0x4038c6[_0xa7fe('0x43')]=_0x279e79;return _0x4038c6;})[_0xa7fe('0x23')](respondWithFilteredResult(_0x26e5a4,_0x146a74))[_0xa7fe('0x44')](handleError(_0x26e5a4,null));};exports['show']=function(_0x207e1d,_0x2ae075){var _0x66671={'raw':![],'where':{'id':_0x207e1d[_0xa7fe('0x45')]['id']}},_0x309404={};_0x309404[_0xa7fe('0x30')]=_[_0xa7fe('0x46')](db[_0xa7fe('0x2b')][_0xa7fe('0x2c')]);_0x309404[_0xa7fe('0x31')]=_[_0xa7fe('0x46')](_0x207e1d[_0xa7fe('0x31')]);_0x309404[_0xa7fe('0x32')]=_[_0xa7fe('0x34')](_0x309404['model'],_0x309404['query']);_0x66671['attributes']=_['intersection'](_0x309404[_0xa7fe('0x30')],qs[_0xa7fe('0x35')](_0x207e1d[_0xa7fe('0x31')][_0xa7fe('0x35')]));_0x66671[_0xa7fe('0x33')]=_0x66671[_0xa7fe('0x33')][_0xa7fe('0x36')]?_0x66671[_0xa7fe('0x33')]:_0x309404['model'];if(_0x207e1d[_0xa7fe('0x31')][_0xa7fe('0x40')]){_0x66671[_0xa7fe('0x41')]=[{'all':!![]}];}_0x66671=_['merge']({},_0x66671,_0x207e1d[_0xa7fe('0x3f')]);return db[_0xa7fe('0x2b')]['find'](_0x66671)[_0xa7fe('0x23')](handleEntityNotFound(_0x2ae075,null))[_0xa7fe('0x23')](respondWithResult(_0x2ae075,null))[_0xa7fe('0x44')](handleError(_0x2ae075,null));};exports[_0xa7fe('0x47')]=function(_0x5f272a,_0x4508e5){return db[_0xa7fe('0x2b')]['create'](_0x5f272a[_0xa7fe('0x48')],{})['then'](respondWithResult(_0x4508e5,0xc9))[_0xa7fe('0x44')](handleError(_0x4508e5,null));};exports[_0xa7fe('0x22')]=function(_0x45e237,_0x5f2a0e){if(_0x45e237[_0xa7fe('0x48')]['id']){delete _0x45e237[_0xa7fe('0x48')]['id'];}return db['IntegrationReport'][_0xa7fe('0x49')]({'where':{'id':_0x45e237['params']['id']}})[_0xa7fe('0x23')](handleEntityNotFound(_0x5f2a0e,null))['then'](saveUpdates(_0x45e237[_0xa7fe('0x48')],null))[_0xa7fe('0x23')](respondWithResult(_0x5f2a0e,null))[_0xa7fe('0x44')](handleError(_0x5f2a0e,null));};exports[_0xa7fe('0x24')]=function(_0x41124a,_0x5ecc9a){return db['IntegrationReport'][_0xa7fe('0x49')]({'where':{'id':_0x41124a[_0xa7fe('0x45')]['id']}})[_0xa7fe('0x23')](handleEntityNotFound(_0x5ecc9a,null))[_0xa7fe('0x23')](removeEntity(_0x5ecc9a,null))[_0xa7fe('0x44')](handleError(_0x5ecc9a,null));};exports['describe']=function(_0x4e2918,_0xa46f64){return db[_0xa7fe('0x2b')]['describe']()[_0xa7fe('0x23')](respondWithResult(_0xa46f64,null))['catch'](handleError(_0xa46f64,null));}; \ No newline at end of file +var _0xac35=['VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','IntegrationReport','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge'];(function(_0x3236d9,_0x4cc1ba){var _0x28ae45=function(_0x1ec1b1){while(--_0x1ec1b1){_0x3236d9['push'](_0x3236d9['shift']());}};_0x28ae45(++_0x4cc1ba);}(_0xac35,0x141));var _0x5ac3=function(_0x3d5719,_0x2fea03){_0x3d5719=_0x3d5719-0x0;var _0x2c17da=_0xac35[_0x3d5719];return _0x2c17da;};'use strict';var pdf=require(_0x5ac3('0x0'));var emlformat=require(_0x5ac3('0x1'));var rimraf=require(_0x5ac3('0x2'));var zipdir=require(_0x5ac3('0x3'));var jsonpatch=require(_0x5ac3('0x4'));var rp=require(_0x5ac3('0x5'));var moment=require(_0x5ac3('0x6'));var BPromise=require(_0x5ac3('0x7'));var Mustache=require(_0x5ac3('0x8'));var util=require(_0x5ac3('0x9'));var path=require(_0x5ac3('0xa'));var sox=require(_0x5ac3('0xb'));var csv=require(_0x5ac3('0xc'));var ejs=require(_0x5ac3('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5ac3('0xe'));var crypto=require('crypto');var jsforce=require(_0x5ac3('0xf'));var deskjs=require(_0x5ac3('0x10'));var toCsv=require(_0x5ac3('0xc'));var querystring=require(_0x5ac3('0x11'));var Papa=require(_0x5ac3('0x12'));var Redis=require(_0x5ac3('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x5ac3('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5ac3('0x15'));var logger=require(_0x5ac3('0x16'))(_0x5ac3('0x17'));var utils=require(_0x5ac3('0x18'));var config=require(_0x5ac3('0x19'));var db=require(_0x5ac3('0x1a'))['db'];function respondWithStatusCode(_0x963aa5,_0x5921c6){_0x5921c6=_0x5921c6||0xcc;return function(_0x19ed64){if(_0x19ed64){return _0x963aa5[_0x5ac3('0x1b')](_0x5921c6);}return _0x963aa5[_0x5ac3('0x1c')](_0x5921c6)[_0x5ac3('0x1d')]();};}function respondWithResult(_0x297c33,_0x24ed02){_0x24ed02=_0x24ed02||0xc8;return function(_0x1961f3){if(_0x1961f3){return _0x297c33[_0x5ac3('0x1c')](_0x24ed02)['json'](_0x1961f3);}};}function respondWithFilteredResult(_0x585770,_0x3926d0){return function(_0x388da8){if(_0x388da8){var _0x516c97=_0x388da8[_0x5ac3('0x1e')],_0x2eec4a=_0x3926d0[_0x5ac3('0x1f')],_0x4b718a=_0x3926d0['offset']+_0x3926d0[_0x5ac3('0x20')],_0x45c7ed;if(_0x4b718a>=_0x516c97){_0x4b718a=_0x516c97;_0x45c7ed=0xc8;}else{_0x45c7ed=0xce;}_0x585770[_0x5ac3('0x1c')](_0x45c7ed);return _0x585770[_0x5ac3('0x21')](_0x5ac3('0x22'),_0x2eec4a+'-'+_0x4b718a+'/'+_0x516c97)['json'](_0x388da8);}return null;};}function patchUpdates(_0x22907d){return function(_0x9fb253){try{jsonpatch[_0x5ac3('0x23')](_0x9fb253,_0x22907d,!![]);}catch(_0x2ec013){return BPromise[_0x5ac3('0x24')](_0x2ec013);}return _0x9fb253[_0x5ac3('0x25')]();};}function saveUpdates(_0x2039b1,_0x2fcc26){return function(_0x26f446){if(_0x26f446){return _0x26f446[_0x5ac3('0x26')](_0x2039b1)[_0x5ac3('0x27')](function(_0x38486d){return _0x38486d;});}return null;};}function removeEntity(_0x579d76,_0x462b1d){return function(_0x3cbb52){if(_0x3cbb52){return _0x3cbb52[_0x5ac3('0x28')]()[_0x5ac3('0x27')](function(){_0x579d76['status'](0xcc)[_0x5ac3('0x1d')]();});}};}function handleEntityNotFound(_0x1e28f6,_0x2aa7c9){return function(_0x3cce67){if(!_0x3cce67){_0x1e28f6['sendStatus'](0x194);}return _0x3cce67;};}function handleError(_0x1eb39c,_0x567807){_0x567807=_0x567807||0x1f4;return function(_0x34394f){logger['error'](_0x34394f['stack']);if(_0x34394f[_0x5ac3('0x29')]){delete _0x34394f[_0x5ac3('0x29')];}_0x1eb39c['status'](_0x567807)[_0x5ac3('0x2a')](_0x34394f);};}exports[_0x5ac3('0x2b')]=function(_0x2fd301,_0x1f563e){var _0x4af783={},_0x452519={},_0x228deb={'count':0x0,'rows':[]};var _0x1bd43a=_[_0x5ac3('0x2c')](db[_0x5ac3('0x2d')][_0x5ac3('0x2e')],function(_0x136862){return{'name':_0x136862['fieldName'],'type':_0x136862[_0x5ac3('0x2f')][_0x5ac3('0x30')]};});_0x452519[_0x5ac3('0x31')]=_['map'](_0x1bd43a,_0x5ac3('0x29'));_0x452519[_0x5ac3('0x32')]=_[_0x5ac3('0x33')](_0x2fd301['query']);_0x452519[_0x5ac3('0x34')]=_['intersection'](_0x452519[_0x5ac3('0x31')],_0x452519['query']);_0x4af783[_0x5ac3('0x35')]=_[_0x5ac3('0x36')](_0x452519['model'],qs['fields'](_0x2fd301['query'][_0x5ac3('0x37')]));_0x4af783[_0x5ac3('0x35')]=_0x4af783['attributes'][_0x5ac3('0x38')]?_0x4af783[_0x5ac3('0x35')]:_0x452519[_0x5ac3('0x31')];if(!_0x2fd301[_0x5ac3('0x32')][_0x5ac3('0x39')](_0x5ac3('0x3a'))){_0x4af783['limit']=qs[_0x5ac3('0x20')](_0x2fd301[_0x5ac3('0x32')][_0x5ac3('0x20')]);_0x4af783[_0x5ac3('0x1f')]=qs['offset'](_0x2fd301['query'][_0x5ac3('0x1f')]);}_0x4af783['order']=qs[_0x5ac3('0x3b')](_0x2fd301[_0x5ac3('0x32')]['sort']);_0x4af783[_0x5ac3('0x3c')]=qs['filters'](_[_0x5ac3('0x3d')](_0x2fd301['query'],_0x452519['filters']));if(_0x2fd301[_0x5ac3('0x32')][_0x5ac3('0x3e')]){_0x4af783[_0x5ac3('0x3c')]=_[_0x5ac3('0x3f')](_0x4af783['where'],{'$or':_[_0x5ac3('0x2c')](_0x1bd43a,function(_0x50e749){if(_0x50e749[_0x5ac3('0x2f')]!==_0x5ac3('0x40')){var _0x264c12={};_0x264c12[_0x50e749[_0x5ac3('0x29')]]={'$like':'%'+_0x2fd301[_0x5ac3('0x32')]['filter']+'%'};return _0x264c12;}})});}_0x4af783=_[_0x5ac3('0x3f')]({},_0x4af783,_0x2fd301[_0x5ac3('0x41')]);var _0x5e83a4={'where':_0x4af783[_0x5ac3('0x3c')]};return db[_0x5ac3('0x2d')][_0x5ac3('0x1e')](_0x5e83a4)[_0x5ac3('0x27')](function(_0x271f3d){_0x228deb[_0x5ac3('0x1e')]=_0x271f3d;if(_0x2fd301[_0x5ac3('0x32')][_0x5ac3('0x42')]){_0x4af783[_0x5ac3('0x43')]=[{'all':!![]}];}return db[_0x5ac3('0x2d')][_0x5ac3('0x44')](_0x4af783);})[_0x5ac3('0x27')](function(_0x20c16c){_0x228deb[_0x5ac3('0x45')]=_0x20c16c;return _0x228deb;})['then'](respondWithFilteredResult(_0x1f563e,_0x4af783))['catch'](handleError(_0x1f563e,null));};exports[_0x5ac3('0x46')]=function(_0x40f749,_0x359379){var _0x4f8984={'raw':![],'where':{'id':_0x40f749[_0x5ac3('0x47')]['id']}},_0x17e2bf={};_0x17e2bf[_0x5ac3('0x31')]=_[_0x5ac3('0x33')](db[_0x5ac3('0x2d')][_0x5ac3('0x2e')]);_0x17e2bf[_0x5ac3('0x32')]=_[_0x5ac3('0x33')](_0x40f749[_0x5ac3('0x32')]);_0x17e2bf[_0x5ac3('0x34')]=_[_0x5ac3('0x36')](_0x17e2bf[_0x5ac3('0x31')],_0x17e2bf[_0x5ac3('0x32')]);_0x4f8984['attributes']=_['intersection'](_0x17e2bf['model'],qs['fields'](_0x40f749['query']['fields']));_0x4f8984[_0x5ac3('0x35')]=_0x4f8984[_0x5ac3('0x35')][_0x5ac3('0x38')]?_0x4f8984['attributes']:_0x17e2bf[_0x5ac3('0x31')];if(_0x40f749[_0x5ac3('0x32')][_0x5ac3('0x42')]){_0x4f8984[_0x5ac3('0x43')]=[{'all':!![]}];}_0x4f8984=_[_0x5ac3('0x3f')]({},_0x4f8984,_0x40f749['options']);return db[_0x5ac3('0x2d')][_0x5ac3('0x48')](_0x4f8984)[_0x5ac3('0x27')](handleEntityNotFound(_0x359379,null))[_0x5ac3('0x27')](respondWithResult(_0x359379,null))[_0x5ac3('0x49')](handleError(_0x359379,null));};exports['create']=function(_0x30fa49,_0x121b53){return db[_0x5ac3('0x2d')][_0x5ac3('0x4a')](_0x30fa49['body'],{})[_0x5ac3('0x27')](respondWithResult(_0x121b53,0xc9))[_0x5ac3('0x49')](handleError(_0x121b53,null));};exports[_0x5ac3('0x26')]=function(_0x47332a,_0x59e097){if(_0x47332a[_0x5ac3('0x4b')]['id']){delete _0x47332a[_0x5ac3('0x4b')]['id'];}return db[_0x5ac3('0x2d')][_0x5ac3('0x48')]({'where':{'id':_0x47332a[_0x5ac3('0x47')]['id']}})[_0x5ac3('0x27')](handleEntityNotFound(_0x59e097,null))[_0x5ac3('0x27')](saveUpdates(_0x47332a['body'],null))['then'](respondWithResult(_0x59e097,null))[_0x5ac3('0x49')](handleError(_0x59e097,null));};exports[_0x5ac3('0x28')]=function(_0x3844b6,_0x2d507d){return db[_0x5ac3('0x2d')]['find']({'where':{'id':_0x3844b6['params']['id']}})[_0x5ac3('0x27')](handleEntityNotFound(_0x2d507d,null))[_0x5ac3('0x27')](removeEntity(_0x2d507d,null))[_0x5ac3('0x49')](handleError(_0x2d507d,null));};exports[_0x5ac3('0x4c')]=function(_0x68538a,_0x1a47de){return db['IntegrationReport'][_0x5ac3('0x4c')]()[_0x5ac3('0x27')](respondWithResult(_0x1a47de,null))[_0x5ac3('0x49')](handleError(_0x1a47de,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 5be66d8..a6f468b 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 _0xa850=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports','IntegrationReport','report_integration'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0xa850,0x193));var _0x0a85=function(_0x8eef0a,_0x36e04e){_0x8eef0a=_0x8eef0a-0x0;var _0x5b4758=_0xa850[_0x8eef0a];return _0x5b4758;};'use strict';var _=require(_0x0a85('0x0'));var util=require(_0x0a85('0x1'));var logger=require(_0x0a85('0x2'))(_0x0a85('0x3'));var moment=require('moment');var BPromise=require(_0x0a85('0x4'));var rp=require(_0x0a85('0x5'));var fs=require('fs');var path=require(_0x0a85('0x6'));var rimraf=require(_0x0a85('0x7'));var config=require(_0x0a85('0x8'));var attributes=require(_0x0a85('0x9'));module[_0x0a85('0xa')]=function(_0x3cdb77,_0x1421a1){return _0x3cdb77['define'](_0x0a85('0xb'),attributes,{'tableName':_0x0a85('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4fbf=['util','api','moment','request-promise','rimraf','../../config/environment','./integrationReport.attributes','exports','IntegrationReport','report_integration','lodash'];(function(_0x229f5e,_0x225dba){var _0x565061=function(_0x2ba587){while(--_0x2ba587){_0x229f5e['push'](_0x229f5e['shift']());}};_0x565061(++_0x225dba);}(_0x4fbf,0xaf));var _0xf4fb=function(_0xd358ab,_0xfcdbde){_0xd358ab=_0xd358ab-0x0;var _0x2796b6=_0x4fbf[_0xd358ab];return _0x2796b6;};'use strict';var _=require(_0xf4fb('0x0'));var util=require(_0xf4fb('0x1'));var logger=require('../../config/logger')(_0xf4fb('0x2'));var moment=require(_0xf4fb('0x3'));var BPromise=require('bluebird');var rp=require(_0xf4fb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf4fb('0x5'));var config=require(_0xf4fb('0x6'));var attributes=require(_0xf4fb('0x7'));module[_0xf4fb('0x8')]=function(_0x3ff876,_0x33b1e5){return _0x3ff876['define'](_0xf4fb('0x9'),attributes,{'tableName':_0xf4fb('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 8612a51..313967b 100644 --- a/server/api/integrationReport/integrationReport.rpc.js +++ b/server/api/integrationReport/integrationReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x5c2691,_0x2a0375){var _0x34a425=function(_0x216b58){while(--_0x216b58){_0x5c2691['push'](_0x5c2691['shift']());}};_0x34a425(++_0x2a0375);}(_0x757a,0xde));var _0xa757=function(_0x1b05ad,_0x43844a){_0x1b05ad=_0x1b05ad-0x0;var _0xd42441=_0x757a[_0x1b05ad];return _0xd42441;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('IntegrationReport,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('IntegrationReport,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});} \ No newline at end of file +var _0xac4a=['IntegrationReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xac4a,0x13f));var _0xaac4=function(_0x162026,_0x5471b1){_0x162026=_0x162026-0x0;var _0x497400=_0xac4a[_0x162026];return _0x497400;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('IntegrationReport,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('IntegrationReport,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 8ebf6d9..566ba14 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 _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(_0x1fbcc2,_0x5b0f9a){var _0x4630d0=function(_0x4465d7){while(--_0x4465d7){_0x1fbcc2['push'](_0x1fbcc2['shift']());}};_0x4630d0(++_0x5b0f9a);}(_0x3e74,0x175));var _0x43e7=function(_0x2e2449,_0x55ff53){_0x2e2449=_0x2e2449-0x0;var _0x4007ce=_0x3e74[_0x2e2449];return _0x4007ce;};'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 +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(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x55ca,0x126));var _0xa55c=function(_0xd6a568,_0x4d39e9){_0xd6a568=_0xd6a568-0x0;var _0x56e5ab=_0x55ca[_0xd6a568];return _0x56e5ab;};'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 diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index eeb4702..ded9df8 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 _0xea9d=['STRING','sequelize'];(function(_0x57e78f,_0x1c6d5b){var _0x2bb803=function(_0x3fa5c1){while(--_0x3fa5c1){_0x57e78f['push'](_0x57e78f['shift']());}};_0x2bb803(++_0x1c6d5b);}(_0xea9d,0x99));var _0xdea9=function(_0x1ac65a,_0x2b9de2){_0x1ac65a=_0x1ac65a-0x0;var _0x1ec67d=_0xea9d[_0x1ac65a];return _0x1ec67d;};'use strict';var Sequelize=require(_0xdea9('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xdea9('0x1')]},'interval':{'type':Sequelize[_0xdea9('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x5e01=['sequelize'];(function(_0x2842bc,_0x2c6854){var _0x3fbdfe=function(_0x23b569){while(--_0x23b569){_0x2842bc['push'](_0x2842bc['shift']());}};_0x3fbdfe(++_0x2c6854);}(_0x5e01,0xd1));var _0x15e0=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0x5e01[_0xc0a3d3];return _0x3386e8;};'use strict';var Sequelize=require(_0x15e0('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index cd43541..8c99b58 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 _0xedd9=['sequelize','IntervalId','bulkCreate','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','../../components/extensions/rewrite','sendStatus','status','json','offset','limit','set','save','update','then','get','Intervals','destroy','end','name','index','map','Interval','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','params','find','create','body','user','role','userProfileId','UserProfileResource','error','getIntervals','addIntervals'];(function(_0x141590,_0x55c281){var _0xb8a437=function(_0x17fed6){while(--_0x17fed6){_0x141590['push'](_0x141590['shift']());}};_0xb8a437(++_0x55c281);}(_0xedd9,0xfc));var _0x9edd=function(_0x1792f5,_0x2da822){_0x1792f5=_0x1792f5-0x0;var _0x3266a7=_0xedd9[_0x1792f5];return _0x3266a7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9edd('0x0'));var rimraf=require(_0x9edd('0x1'));var zipdir=require(_0x9edd('0x2'));var jsonpatch=require(_0x9edd('0x3'));var rp=require(_0x9edd('0x4'));var moment=require(_0x9edd('0x5'));var BPromise=require(_0x9edd('0x6'));var Mustache=require(_0x9edd('0x7'));var util=require('util');var path=require(_0x9edd('0x8'));var sox=require(_0x9edd('0x9'));var csv=require(_0x9edd('0xa'));var ejs=require(_0x9edd('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0xa'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var db=require(_0x9edd('0x16'))['db'];var extensions=require(_0x9edd('0x17'));function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=_0x75a4ab['count'],_0x5f5bf4=_0x1042aa[_0x9edd('0x1b')],_0x448996=_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1c')],_0x449cee;if(_0x448996>=_0x4ea60f){_0x448996=_0x4ea60f;_0x449cee=0xc8;}else{_0x449cee=0xce;}_0x338f3c['status'](_0x449cee);return _0x338f3c[_0x9edd('0x1d')]('Content-Range',_0x5f5bf4+'-'+_0x448996+'/'+_0x4ea60f)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x1083e4){return function(_0x4bdb88){try{jsonpatch['apply'](_0x4bdb88,_0x1083e4,!![]);}catch(_0x45c3ab){return BPromise['reject'](_0x45c3ab);}return _0x4bdb88[_0x9edd('0x1e')]();};}function saveUpdates(_0x54a03f,_0x535f37){return function(_0x356751){if(_0x356751){return _0x356751[_0x9edd('0x1f')](_0x54a03f)['then'](function(_0x5823bc){return _0x5823bc;});}return null;};}function removeEntity(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['destroy']()[_0x9edd('0x20')](function(){var _0x1dca43=_0x477878[_0x9edd('0x21')]({'plain':!![]});var _0x2ca65f=_0x9edd('0x22');return db['UserProfileResource'][_0x9edd('0x23')]({'where':{'type':_0x2ca65f,'resourceId':_0x1dca43['id']}})[_0x9edd('0x20')](function(){return _0x477878;});})[_0x9edd('0x20')](function(){_0x341d67[_0x9edd('0x19')](0xcc)[_0x9edd('0x24')]();});}};}function handleEntityNotFound(_0x4d507f,_0x4b3d1b){return function(_0x3276ee){if(!_0x3276ee){_0x4d507f[_0x9edd('0x18')](0x194);}return _0x3276ee;};}function handleError(_0x8d67aa,_0x25e135){_0x25e135=_0x25e135||0x1f4;return function(_0x3c2227){logger['error'](_0x3c2227['stack']);if(_0x3c2227[_0x9edd('0x25')]){delete _0x3c2227[_0x9edd('0x25')];}_0x8d67aa[_0x9edd('0x19')](_0x25e135)['send'](_0x3c2227);};}exports[_0x9edd('0x26')]=function(_0x28cfae,_0x2ae8dd){var _0x41af53={},_0x5eccfb={},_0x2155a1={'count':0x0,'rows':[]};var _0x3fb556=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x42e664){return{'name':_0x42e664[_0x9edd('0x2a')],'type':_0x42e664[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x5eccfb[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x3fb556,_0x9edd('0x25'));_0x5eccfb[_0x9edd('0x2e')]=_[_0x9edd('0x2f')](_0x28cfae[_0x9edd('0x2e')]);_0x5eccfb['filters']=_[_0x9edd('0x30')](_0x5eccfb[_0x9edd('0x2d')],_0x5eccfb[_0x9edd('0x2e')]);_0x41af53['attributes']=_[_0x9edd('0x30')](_0x5eccfb[_0x9edd('0x2d')],qs[_0x9edd('0x31')](_0x28cfae[_0x9edd('0x2e')][_0x9edd('0x31')]));_0x41af53[_0x9edd('0x32')]=_0x41af53[_0x9edd('0x32')][_0x9edd('0x33')]?_0x41af53[_0x9edd('0x32')]:_0x5eccfb[_0x9edd('0x2d')];if(!_0x28cfae[_0x9edd('0x2e')][_0x9edd('0x34')](_0x9edd('0x35'))){_0x41af53[_0x9edd('0x1c')]=qs['limit'](_0x28cfae[_0x9edd('0x2e')]['limit']);_0x41af53[_0x9edd('0x1b')]=qs[_0x9edd('0x1b')](_0x28cfae[_0x9edd('0x2e')][_0x9edd('0x1b')]);}_0x41af53[_0x9edd('0x36')]=qs['sort'](_0x28cfae[_0x9edd('0x2e')][_0x9edd('0x37')]);_0x41af53[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_[_0x9edd('0x3a')](_0x28cfae[_0x9edd('0x2e')],_0x5eccfb[_0x9edd('0x39')]));if(_0x28cfae[_0x9edd('0x2e')][_0x9edd('0x3b')]){_0x41af53[_0x9edd('0x38')]=_['merge'](_0x41af53[_0x9edd('0x38')],{'$or':_['map'](_0x3fb556,function(_0x3ef1d5){if(_0x3ef1d5['type']!==_0x9edd('0x3c')){var _0x2858b5={};_0x2858b5[_0x3ef1d5[_0x9edd('0x25')]]={'$like':'%'+_0x28cfae['query'][_0x9edd('0x3b')]+'%'};return _0x2858b5;}})});}_0x41af53=_[_0x9edd('0x3d')]({},_0x41af53,_0x28cfae[_0x9edd('0x3e')]);var _0x48958a={'where':_0x41af53[_0x9edd('0x38')]};return db['Interval'][_0x9edd('0x3f')](_0x48958a)[_0x9edd('0x20')](function(_0x50be2c){_0x2155a1[_0x9edd('0x3f')]=_0x50be2c;if(_0x28cfae[_0x9edd('0x2e')][_0x9edd('0x40')]){_0x41af53[_0x9edd('0x41')]=[{'all':!![]}];}return db['Interval'][_0x9edd('0x42')](_0x41af53);})['then'](function(_0x2bdb3f){_0x2155a1[_0x9edd('0x43')]=_0x2bdb3f;return _0x2155a1;})['then'](respondWithFilteredResult(_0x2ae8dd,_0x41af53))[_0x9edd('0x44')](handleError(_0x2ae8dd,null));};exports['show']=function(_0x548299,_0x369b69){var _0x9cab86={'raw':!![],'where':{'id':_0x548299[_0x9edd('0x45')]['id']}},_0x1f276b={};_0x1f276b[_0x9edd('0x2d')]=_[_0x9edd('0x2f')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x1f276b[_0x9edd('0x2e')]=_[_0x9edd('0x2f')](_0x548299[_0x9edd('0x2e')]);_0x1f276b[_0x9edd('0x39')]=_[_0x9edd('0x30')](_0x1f276b[_0x9edd('0x2d')],_0x1f276b[_0x9edd('0x2e')]);_0x9cab86['attributes']=_[_0x9edd('0x30')](_0x1f276b[_0x9edd('0x2d')],qs[_0x9edd('0x31')](_0x548299[_0x9edd('0x2e')][_0x9edd('0x31')]));_0x9cab86[_0x9edd('0x32')]=_0x9cab86[_0x9edd('0x32')]['length']?_0x9cab86['attributes']:_0x1f276b['model'];if(_0x548299[_0x9edd('0x2e')]['includeAll']){_0x9cab86[_0x9edd('0x41')]=[{'all':!![]}];}_0x9cab86=_[_0x9edd('0x3d')]({},_0x9cab86,_0x548299[_0x9edd('0x3e')]);return db[_0x9edd('0x28')][_0x9edd('0x46')](_0x9cab86)['then'](handleEntityNotFound(_0x369b69,null))[_0x9edd('0x20')](respondWithResult(_0x369b69,null))[_0x9edd('0x44')](handleError(_0x369b69,null));};exports[_0x9edd('0x47')]=function(_0x4a89ae,_0x3626bc){return db[_0x9edd('0x28')][_0x9edd('0x47')](_0x4a89ae[_0x9edd('0x48')],{})[_0x9edd('0x20')](function(_0x35bdec){var _0x4d4f33=_0x4a89ae[_0x9edd('0x49')][_0x9edd('0x21')]({'plain':!![]});if(!_0x4d4f33)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4d4f33[_0x9edd('0x4a')]===_0x9edd('0x49')){var _0x4bb324=_0x35bdec[_0x9edd('0x21')]({'plain':!![]});var _0x8134cd=_0x9edd('0x22');return db['UserProfileSection'][_0x9edd('0x46')]({'where':{'name':_0x8134cd,'userProfileId':_0x4d4f33[_0x9edd('0x4b')]},'raw':!![]})[_0x9edd('0x20')](function(_0x28c7bd){if(_0x28c7bd&&_0x28c7bd['autoAssociation']===0x0){return db[_0x9edd('0x4c')][_0x9edd('0x47')]({'name':_0x4bb324[_0x9edd('0x25')],'resourceId':_0x4bb324['id'],'type':_0x28c7bd['name'],'sectionId':_0x28c7bd['id']},{})[_0x9edd('0x20')](function(){return _0x35bdec;});}else{return _0x35bdec;}})[_0x9edd('0x44')](function(_0x57db43){logger[_0x9edd('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x57db43);throw _0x57db43;});}return _0x35bdec;})[_0x9edd('0x20')](respondWithResult(_0x3626bc,0xc9))[_0x9edd('0x44')](handleError(_0x3626bc,null));};exports[_0x9edd('0x1f')]=function(_0x3fcdf5,_0x1e3c19){if(_0x3fcdf5[_0x9edd('0x48')]['id']){delete _0x3fcdf5[_0x9edd('0x48')]['id'];}return db[_0x9edd('0x28')][_0x9edd('0x46')]({'where':{'id':_0x3fcdf5[_0x9edd('0x45')]['id']}})[_0x9edd('0x20')](handleEntityNotFound(_0x1e3c19,null))['then'](saveUpdates(_0x3fcdf5[_0x9edd('0x48')],null))[_0x9edd('0x20')](respondWithResult(_0x1e3c19,null))[_0x9edd('0x44')](handleError(_0x1e3c19,null));};exports['destroy']=function(_0xe96d6a,_0x54a704){return db['Interval']['find']({'where':{'id':_0xe96d6a[_0x9edd('0x45')]['id']}})[_0x9edd('0x20')](handleEntityNotFound(_0x54a704,null))[_0x9edd('0x20')](removeEntity(_0x54a704,null))[_0x9edd('0x44')](handleError(_0x54a704,null));};exports['addInterval']=function(_0x56b38b,_0x4e3c3e,_0x71820f){if(_0x56b38b[_0x9edd('0x48')]['id']){delete _0x56b38b[_0x9edd('0x48')]['id'];}return db[_0x9edd('0x28')][_0x9edd('0x46')]({'where':{'id':_0x56b38b[_0x9edd('0x45')]['id']}})[_0x9edd('0x20')](handleEntityNotFound(_0x4e3c3e,null))[_0x9edd('0x20')](function(_0x4eb780){if(_0x4eb780){_0x56b38b[_0x9edd('0x48')]['IntervalId']=_0x4eb780['id'];return db[_0x9edd('0x28')][_0x9edd('0x47')](_0x56b38b['body']);}})[_0x9edd('0x20')](respondWithResult(_0x4e3c3e,null))[_0x9edd('0x44')](handleError(_0x4e3c3e,null));};exports[_0x9edd('0x4e')]=function(_0x5ec9af,_0xc648c4,_0x2e1ce3){var _0x430eb4={};var _0x15ebfa={};var _0x1720b1;var _0x2c3173;return db['Interval']['findOne']({'where':{'id':_0x5ec9af[_0x9edd('0x45')]['id']}})['then'](handleEntityNotFound(_0xc648c4,null))[_0x9edd('0x20')](function(_0x3e9a3e){if(_0x3e9a3e){_0x1720b1=_0x3e9a3e;_0x15ebfa[_0x9edd('0x2d')]=_[_0x9edd('0x2f')](db['Interval'][_0x9edd('0x29')]);_0x15ebfa['query']=_[_0x9edd('0x2f')](_0x5ec9af[_0x9edd('0x2e')]);_0x15ebfa[_0x9edd('0x39')]=_['intersection'](_0x15ebfa[_0x9edd('0x2d')],_0x15ebfa['query']);_0x430eb4[_0x9edd('0x32')]=_[_0x9edd('0x30')](_0x15ebfa['model'],qs[_0x9edd('0x31')](_0x5ec9af['query'][_0x9edd('0x31')]));_0x430eb4[_0x9edd('0x32')]=_0x430eb4[_0x9edd('0x32')]['length']?_0x430eb4[_0x9edd('0x32')]:_0x15ebfa[_0x9edd('0x2d')];_0x430eb4[_0x9edd('0x36')]=qs[_0x9edd('0x37')](_0x5ec9af[_0x9edd('0x2e')]['sort']);_0x430eb4['where']=qs[_0x9edd('0x39')](_[_0x9edd('0x3a')](_0x5ec9af['query'],_0x15ebfa['filters']));if(_0x5ec9af['query'][_0x9edd('0x3b')]){_0x430eb4['where']=_['merge'](_0x430eb4[_0x9edd('0x38')],{'$or':_[_0x9edd('0x27')](_0x430eb4['attributes'],function(_0xb9ebeb){var _0x11e082={};_0x11e082[_0xb9ebeb]={'$like':'%'+_0x5ec9af[_0x9edd('0x2e')]['filter']+'%'};return _0x11e082;})});}_0x430eb4=_[_0x9edd('0x3d')]({},_0x430eb4,_0x5ec9af['options']);return _0x1720b1[_0x9edd('0x4e')](_0x430eb4);}})[_0x9edd('0x20')](function(_0x4c8d06){if(_0x4c8d06){_0x2c3173=_0x4c8d06[_0x9edd('0x33')];if(!_0x5ec9af[_0x9edd('0x2e')]['hasOwnProperty'](_0x9edd('0x35'))){_0x430eb4[_0x9edd('0x1c')]=qs[_0x9edd('0x1c')](_0x5ec9af[_0x9edd('0x2e')]['limit']);_0x430eb4[_0x9edd('0x1b')]=qs['offset'](_0x5ec9af[_0x9edd('0x2e')][_0x9edd('0x1b')]);}return _0x1720b1[_0x9edd('0x4e')](_0x430eb4);}})['then'](function(_0x106a67){if(_0x106a67){return _0x106a67?{'count':_0x2c3173,'rows':_0x106a67}:null;}})[_0x9edd('0x20')](respondWithResult(_0xc648c4,null))[_0x9edd('0x44')](handleError(_0xc648c4,null));};exports[_0x9edd('0x4f')]=function(_0x25626a,_0x14e2e5,_0x3fa4a9){return db['Interval']['findOne']({'where':{'id':_0x25626a[_0x9edd('0x45')]['id']}})[_0x9edd('0x20')](handleEntityNotFound(_0x14e2e5,null))[_0x9edd('0x20')](function(_0x171403){if(_0x171403){return db[_0x9edd('0x50')]['transaction'](function(_0x2e40c8){return db[_0x9edd('0x28')][_0x9edd('0x23')]({'where':{'IntervalId':_0x25626a['params']['id']},'transaction':_0x2e40c8})[_0x9edd('0x20')](function(_0x29d70d){var _0x4b1c12=_[_0x9edd('0x27')](_0x25626a[_0x9edd('0x48')],function(_0x58c839){delete _0x58c839['id'];_0x58c839[_0x9edd('0x51')]=_0x25626a[_0x9edd('0x45')]['id'];return _0x58c839;});return db['Interval'][_0x9edd('0x52')](_0x4b1c12,{'transaction':_0x2e40c8});});})['then'](function(){return db['Interval'][_0x9edd('0x42')]({'where':{'IntervalId':_0x25626a[_0x9edd('0x45')]['id']}});});}})[_0x9edd('0x20')](respondWithResult(_0x14e2e5,null))['catch'](handleError(_0x14e2e5,null));}; \ No newline at end of file +var _0x008c=['query','keys','filters','intersection','attributes','fields','length','nolimit','limit','offset','order','sort','pick','where','VIRTUAL','filter','merge','options','Interval','include','findAll','catch','show','params','rawAttributes','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Intervals','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','addInterval','getIntervals','findOne','hasOwnProperty','sequelize','IntervalId','bulkCreate','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','end','status','json','count','set','Content-Range','save','destroy','then','get','UserProfileResource','sendStatus','name','send','map','fieldName','type','key','model'];(function(_0x5a3d49,_0x24b21a){var _0x4d5c23=function(_0x4f62b0){while(--_0x4f62b0){_0x5a3d49['push'](_0x5a3d49['shift']());}};_0x4d5c23(++_0x24b21a);}(_0x008c,0x188));var _0xc008=function(_0x3aa779,_0x4a18c5){_0x3aa779=_0x3aa779-0x0;var _0x2fd150=_0x008c[_0x3aa779];return _0x2fd150;};'use strict';var pdf=require(_0xc008('0x0'));var emlformat=require(_0xc008('0x1'));var rimraf=require(_0xc008('0x2'));var zipdir=require(_0xc008('0x3'));var jsonpatch=require(_0xc008('0x4'));var rp=require('request-promise');var moment=require(_0xc008('0x5'));var BPromise=require(_0xc008('0x6'));var Mustache=require(_0xc008('0x7'));var util=require(_0xc008('0x8'));var path=require(_0xc008('0x9'));var sox=require(_0xc008('0xa'));var csv=require(_0xc008('0xb'));var ejs=require(_0xc008('0xc'));var fs=require('fs');var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var db=require(_0xc008('0x16'))['db'];var extensions=require(_0xc008('0x17'));function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=_0x5e894e[_0xc008('0x1b')],_0x11ef38=_0x5ee00b['offset'],_0x15a6ad=_0x5ee00b['offset']+_0x5ee00b['limit'],_0x3cafe3;if(_0x15a6ad>=_0x4bd0f4){_0x15a6ad=_0x4bd0f4;_0x3cafe3=0xc8;}else{_0x3cafe3=0xce;}_0x3f0ecf['status'](_0x3cafe3);return _0x3f0ecf[_0xc008('0x1c')](_0xc008('0x1d'),_0x11ef38+'-'+_0x15a6ad+'/'+_0x4bd0f4)['json'](_0x5e894e);}return null;};}function patchUpdates(_0x813397){return function(_0x5906e6){try{jsonpatch['apply'](_0x5906e6,_0x813397,!![]);}catch(_0x543e5d){return BPromise['reject'](_0x543e5d);}return _0x5906e6[_0xc008('0x1e')]();};}function saveUpdates(_0x4b9726,_0x5560b1){return function(_0x590a71){if(_0x590a71){return _0x590a71['update'](_0x4b9726)['then'](function(_0x13a263){return _0x13a263;});}return null;};}function removeEntity(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x1f')]()[_0xc008('0x20')](function(){var _0x4f43e2=_0x415af3[_0xc008('0x21')]({'plain':!![]});var _0x5c85f2='Intervals';return db[_0xc008('0x22')][_0xc008('0x1f')]({'where':{'type':_0x5c85f2,'resourceId':_0x4f43e2['id']}})[_0xc008('0x20')](function(){return _0x415af3;});})[_0xc008('0x20')](function(){_0x4777a6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5de1e9,_0x3f7b07){return function(_0x15dade){if(!_0x15dade){_0x5de1e9[_0xc008('0x23')](0x194);}return _0x15dade;};}function handleError(_0x2e31c2,_0x5bebd9){_0x5bebd9=_0x5bebd9||0x1f4;return function(_0x5e2aca){logger['error'](_0x5e2aca['stack']);if(_0x5e2aca['name']){delete _0x5e2aca[_0xc008('0x24')];}_0x2e31c2[_0xc008('0x19')](_0x5bebd9)[_0xc008('0x25')](_0x5e2aca);};}exports['index']=function(_0x24c14c,_0x32390d){var _0x209591={},_0x2a7d4f={},_0x4c5dec={'count':0x0,'rows':[]};var _0xcdb32b=_[_0xc008('0x26')](db['Interval']['rawAttributes'],function(_0x539766){return{'name':_0x539766[_0xc008('0x27')],'type':_0x539766[_0xc008('0x28')][_0xc008('0x29')]};});_0x2a7d4f[_0xc008('0x2a')]=_[_0xc008('0x26')](_0xcdb32b,_0xc008('0x24'));_0x2a7d4f[_0xc008('0x2b')]=_[_0xc008('0x2c')](_0x24c14c[_0xc008('0x2b')]);_0x2a7d4f[_0xc008('0x2d')]=_[_0xc008('0x2e')](_0x2a7d4f[_0xc008('0x2a')],_0x2a7d4f['query']);_0x209591[_0xc008('0x2f')]=_[_0xc008('0x2e')](_0x2a7d4f['model'],qs[_0xc008('0x30')](_0x24c14c[_0xc008('0x2b')][_0xc008('0x30')]));_0x209591[_0xc008('0x2f')]=_0x209591[_0xc008('0x2f')][_0xc008('0x31')]?_0x209591[_0xc008('0x2f')]:_0x2a7d4f[_0xc008('0x2a')];if(!_0x24c14c[_0xc008('0x2b')]['hasOwnProperty'](_0xc008('0x32'))){_0x209591[_0xc008('0x33')]=qs[_0xc008('0x33')](_0x24c14c[_0xc008('0x2b')][_0xc008('0x33')]);_0x209591[_0xc008('0x34')]=qs[_0xc008('0x34')](_0x24c14c['query'][_0xc008('0x34')]);}_0x209591[_0xc008('0x35')]=qs['sort'](_0x24c14c[_0xc008('0x2b')][_0xc008('0x36')]);_0x209591['where']=qs[_0xc008('0x2d')](_[_0xc008('0x37')](_0x24c14c[_0xc008('0x2b')],_0x2a7d4f['filters']));if(_0x24c14c['query']['filter']){_0x209591[_0xc008('0x38')]=_['merge'](_0x209591[_0xc008('0x38')],{'$or':_[_0xc008('0x26')](_0xcdb32b,function(_0x6a4ccb){if(_0x6a4ccb[_0xc008('0x28')]!==_0xc008('0x39')){var _0xa381d1={};_0xa381d1[_0x6a4ccb[_0xc008('0x24')]]={'$like':'%'+_0x24c14c[_0xc008('0x2b')][_0xc008('0x3a')]+'%'};return _0xa381d1;}})});}_0x209591=_[_0xc008('0x3b')]({},_0x209591,_0x24c14c[_0xc008('0x3c')]);var _0xdfca2e={'where':_0x209591[_0xc008('0x38')]};return db[_0xc008('0x3d')]['count'](_0xdfca2e)[_0xc008('0x20')](function(_0x23c4db){_0x4c5dec[_0xc008('0x1b')]=_0x23c4db;if(_0x24c14c[_0xc008('0x2b')]['includeAll']){_0x209591[_0xc008('0x3e')]=[{'all':!![]}];}return db[_0xc008('0x3d')][_0xc008('0x3f')](_0x209591);})[_0xc008('0x20')](function(_0x2d142d){_0x4c5dec['rows']=_0x2d142d;return _0x4c5dec;})[_0xc008('0x20')](respondWithFilteredResult(_0x32390d,_0x209591))[_0xc008('0x40')](handleError(_0x32390d,null));};exports[_0xc008('0x41')]=function(_0x3e9a99,_0x7279e8){var _0x4f93a4={'raw':!![],'where':{'id':_0x3e9a99[_0xc008('0x42')]['id']}},_0xf4cc4b={};_0xf4cc4b[_0xc008('0x2a')]=_[_0xc008('0x2c')](db['Interval'][_0xc008('0x43')]);_0xf4cc4b[_0xc008('0x2b')]=_[_0xc008('0x2c')](_0x3e9a99['query']);_0xf4cc4b[_0xc008('0x2d')]=_['intersection'](_0xf4cc4b[_0xc008('0x2a')],_0xf4cc4b['query']);_0x4f93a4[_0xc008('0x2f')]=_[_0xc008('0x2e')](_0xf4cc4b['model'],qs[_0xc008('0x30')](_0x3e9a99[_0xc008('0x2b')][_0xc008('0x30')]));_0x4f93a4['attributes']=_0x4f93a4[_0xc008('0x2f')][_0xc008('0x31')]?_0x4f93a4[_0xc008('0x2f')]:_0xf4cc4b[_0xc008('0x2a')];if(_0x3e9a99[_0xc008('0x2b')][_0xc008('0x44')]){_0x4f93a4['include']=[{'all':!![]}];}_0x4f93a4=_['merge']({},_0x4f93a4,_0x3e9a99['options']);return db[_0xc008('0x3d')][_0xc008('0x45')](_0x4f93a4)[_0xc008('0x20')](handleEntityNotFound(_0x7279e8,null))[_0xc008('0x20')](respondWithResult(_0x7279e8,null))[_0xc008('0x40')](handleError(_0x7279e8,null));};exports[_0xc008('0x46')]=function(_0x2cf641,_0x33be4f){return db['Interval']['create'](_0x2cf641['body'],{})[_0xc008('0x20')](function(_0x2651cf){var _0x158eae=_0x2cf641['user'][_0xc008('0x21')]({'plain':!![]});if(!_0x158eae)throw new Error(_0xc008('0x47'));if(_0x158eae[_0xc008('0x48')]===_0xc008('0x49')){var _0x4981b4=_0x2651cf[_0xc008('0x21')]({'plain':!![]});var _0x17ec90=_0xc008('0x4a');return db[_0xc008('0x4b')][_0xc008('0x45')]({'where':{'name':_0x17ec90,'userProfileId':_0x158eae['userProfileId']},'raw':!![]})['then'](function(_0x223056){if(_0x223056&&_0x223056['autoAssociation']===0x0){return db[_0xc008('0x22')][_0xc008('0x46')]({'name':_0x4981b4[_0xc008('0x24')],'resourceId':_0x4981b4['id'],'type':_0x223056['name'],'sectionId':_0x223056['id']},{})[_0xc008('0x20')](function(){return _0x2651cf;});}else{return _0x2651cf;}})[_0xc008('0x40')](function(_0xee64){logger[_0xc008('0x4c')](_0xc008('0x4d'),_0xee64);throw _0xee64;});}return _0x2651cf;})['then'](respondWithResult(_0x33be4f,0xc9))[_0xc008('0x40')](handleError(_0x33be4f,null));};exports[_0xc008('0x4e')]=function(_0x4b4c6d,_0x24f775){if(_0x4b4c6d[_0xc008('0x4f')]['id']){delete _0x4b4c6d['body']['id'];}return db['Interval'][_0xc008('0x45')]({'where':{'id':_0x4b4c6d[_0xc008('0x42')]['id']}})[_0xc008('0x20')](handleEntityNotFound(_0x24f775,null))[_0xc008('0x20')](saveUpdates(_0x4b4c6d[_0xc008('0x4f')],null))['then'](respondWithResult(_0x24f775,null))['catch'](handleError(_0x24f775,null));};exports[_0xc008('0x1f')]=function(_0x5d815d,_0x3d7cce){return db[_0xc008('0x3d')][_0xc008('0x45')]({'where':{'id':_0x5d815d[_0xc008('0x42')]['id']}})[_0xc008('0x20')](handleEntityNotFound(_0x3d7cce,null))[_0xc008('0x20')](removeEntity(_0x3d7cce,null))['catch'](handleError(_0x3d7cce,null));};exports[_0xc008('0x50')]=function(_0xbd7422,_0x9a7abc,_0x2b350c){if(_0xbd7422[_0xc008('0x4f')]['id']){delete _0xbd7422['body']['id'];}return db[_0xc008('0x3d')]['find']({'where':{'id':_0xbd7422['params']['id']}})['then'](handleEntityNotFound(_0x9a7abc,null))[_0xc008('0x20')](function(_0x1bcbb1){if(_0x1bcbb1){_0xbd7422[_0xc008('0x4f')]['IntervalId']=_0x1bcbb1['id'];return db[_0xc008('0x3d')][_0xc008('0x46')](_0xbd7422[_0xc008('0x4f')]);}})['then'](respondWithResult(_0x9a7abc,null))[_0xc008('0x40')](handleError(_0x9a7abc,null));};exports[_0xc008('0x51')]=function(_0x12ba3f,_0x1b5a22,_0x5baff1){var _0x4022dd={};var _0x4eaa6d={};var _0x23ef33;var _0x422e1f;return db[_0xc008('0x3d')][_0xc008('0x52')]({'where':{'id':_0x12ba3f[_0xc008('0x42')]['id']}})[_0xc008('0x20')](handleEntityNotFound(_0x1b5a22,null))['then'](function(_0x375e71){if(_0x375e71){_0x23ef33=_0x375e71;_0x4eaa6d['model']=_['keys'](db[_0xc008('0x3d')][_0xc008('0x43')]);_0x4eaa6d['query']=_[_0xc008('0x2c')](_0x12ba3f[_0xc008('0x2b')]);_0x4eaa6d[_0xc008('0x2d')]=_[_0xc008('0x2e')](_0x4eaa6d[_0xc008('0x2a')],_0x4eaa6d[_0xc008('0x2b')]);_0x4022dd[_0xc008('0x2f')]=_['intersection'](_0x4eaa6d[_0xc008('0x2a')],qs[_0xc008('0x30')](_0x12ba3f[_0xc008('0x2b')][_0xc008('0x30')]));_0x4022dd[_0xc008('0x2f')]=_0x4022dd[_0xc008('0x2f')][_0xc008('0x31')]?_0x4022dd[_0xc008('0x2f')]:_0x4eaa6d[_0xc008('0x2a')];_0x4022dd[_0xc008('0x35')]=qs[_0xc008('0x36')](_0x12ba3f[_0xc008('0x2b')][_0xc008('0x36')]);_0x4022dd[_0xc008('0x38')]=qs['filters'](_[_0xc008('0x37')](_0x12ba3f[_0xc008('0x2b')],_0x4eaa6d[_0xc008('0x2d')]));if(_0x12ba3f['query'][_0xc008('0x3a')]){_0x4022dd[_0xc008('0x38')]=_['merge'](_0x4022dd['where'],{'$or':_[_0xc008('0x26')](_0x4022dd[_0xc008('0x2f')],function(_0x7bad14){var _0x39083c={};_0x39083c[_0x7bad14]={'$like':'%'+_0x12ba3f[_0xc008('0x2b')][_0xc008('0x3a')]+'%'};return _0x39083c;})});}_0x4022dd=_[_0xc008('0x3b')]({},_0x4022dd,_0x12ba3f[_0xc008('0x3c')]);return _0x23ef33[_0xc008('0x51')](_0x4022dd);}})[_0xc008('0x20')](function(_0x383325){if(_0x383325){_0x422e1f=_0x383325['length'];if(!_0x12ba3f[_0xc008('0x2b')][_0xc008('0x53')](_0xc008('0x32'))){_0x4022dd[_0xc008('0x33')]=qs['limit'](_0x12ba3f[_0xc008('0x2b')]['limit']);_0x4022dd[_0xc008('0x34')]=qs[_0xc008('0x34')](_0x12ba3f[_0xc008('0x2b')]['offset']);}return _0x23ef33[_0xc008('0x51')](_0x4022dd);}})[_0xc008('0x20')](function(_0xa80000){if(_0xa80000){return _0xa80000?{'count':_0x422e1f,'rows':_0xa80000}:null;}})['then'](respondWithResult(_0x1b5a22,null))[_0xc008('0x40')](handleError(_0x1b5a22,null));};exports['addIntervals']=function(_0x50ee03,_0xee7a85,_0x23012c){return db[_0xc008('0x3d')][_0xc008('0x52')]({'where':{'id':_0x50ee03['params']['id']}})[_0xc008('0x20')](handleEntityNotFound(_0xee7a85,null))[_0xc008('0x20')](function(_0x49493b){if(_0x49493b){return db[_0xc008('0x54')]['transaction'](function(_0x278cbe){return db['Interval'][_0xc008('0x1f')]({'where':{'IntervalId':_0x50ee03['params']['id']},'transaction':_0x278cbe})[_0xc008('0x20')](function(_0x103d75){var _0x33d8e4=_[_0xc008('0x26')](_0x50ee03['body'],function(_0x57752c){delete _0x57752c['id'];_0x57752c[_0xc008('0x55')]=_0x50ee03[_0xc008('0x42')]['id'];return _0x57752c;});return db[_0xc008('0x3d')][_0xc008('0x56')](_0x33d8e4,{'transaction':_0x278cbe});});})[_0xc008('0x20')](function(){return db[_0xc008('0x3d')][_0xc008('0x3f')]({'where':{'IntervalId':_0x50ee03['params']['id']}});});}})[_0xc008('0x20')](respondWithResult(_0xee7a85,null))['catch'](handleError(_0xee7a85,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 2e3a9a0..6b029c9 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 _0xd228=['define','tools_intervals','rewrite','lodash','util','../../config/logger','api','bluebird','rimraf','./interval.attributes','exports'];(function(_0x57a5e5,_0x18b0d6){var _0x354012=function(_0x34d87b){while(--_0x34d87b){_0x57a5e5['push'](_0x57a5e5['shift']());}};_0x354012(++_0x18b0d6);}(_0xd228,0x1bb));var _0x8d22=function(_0x5c0dcb,_0x16cd83){_0x5c0dcb=_0x5c0dcb-0x0;var _0x183a0e=_0xd228[_0x5c0dcb];return _0x183a0e;};'use strict';var _=require(_0x8d22('0x0'));var util=require(_0x8d22('0x1'));var logger=require(_0x8d22('0x2'))(_0x8d22('0x3'));var moment=require('moment');var BPromise=require(_0x8d22('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8d22('0x5'));var config=require('../../config/environment');var attributes=require(_0x8d22('0x6'));var extensions=require('../../components/extensions/rewrite');module[_0x8d22('0x7')]=function(_0x7978f,_0x3ecce2){return _0x7978f[_0x8d22('0x8')]('Interval',attributes,{'tableName':_0x8d22('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x393941,_0xcf67b3){extensions[_0x8d22('0xa')](_0x7978f,_0x393941);},'afterBulkCreate':function(_0x2ea077,_0x2fb32a,_0x47767d){_0x47767d();extensions[_0x8d22('0xa')](_0x7978f,_0x2ea077[0x0]);},'afterUpdate':function(_0x2cf38e,_0x3b7d3a){extensions[_0x8d22('0xa')](_0x7978f,_0x2cf38e);},'afterDestroy':function(_0x9d233b,_0xf6ab5){extensions[_0x8d22('0xa')](_0x7978f,_0x9d233b);}}});}; \ No newline at end of file +var _0xe1bf=['rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','define','tools_intervals','rewrite','util','api','moment','bluebird','request-promise'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xe1bf,0x67));var _0xfe1b=function(_0x50f876,_0x4953af){_0x50f876=_0x50f876-0x0;var _0x5bf693=_0xe1bf[_0x50f876];return _0x5bf693;};'use strict';var _=require('lodash');var util=require(_0xfe1b('0x0'));var logger=require('../../config/logger')(_0xfe1b('0x1'));var moment=require(_0xfe1b('0x2'));var BPromise=require(_0xfe1b('0x3'));var rp=require(_0xfe1b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfe1b('0x5'));var config=require(_0xfe1b('0x6'));var attributes=require(_0xfe1b('0x7'));var extensions=require(_0xfe1b('0x8'));module['exports']=function(_0x41d69f,_0x25a3ae){return _0x41d69f[_0xfe1b('0x9')]('Interval',attributes,{'tableName':_0xfe1b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3fe148,_0x411299){extensions[_0xfe1b('0xb')](_0x41d69f,_0x3fe148);},'afterBulkCreate':function(_0x446abc,_0x493180,_0xc0301e){_0xc0301e();extensions[_0xfe1b('0xb')](_0x41d69f,_0x446abc[0x0]);},'afterUpdate':function(_0x2a2e2d,_0xa28356){extensions[_0xfe1b('0xb')](_0x41d69f,_0x2a2e2d);},'afterDestroy':function(_0x4693ce,_0x2bb8c0){extensions[_0xfe1b('0xb')](_0x41d69f,_0x4693ce);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 779aabc..2514e0a 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 _0x648a=['include','model','map','then','debug','ShowInterval','find','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Interval,\x20%s,\x20%s','request\x20sent','Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetInterval','Interval','findAll','options','raw','where','attributes','limit'];(function(_0x3a81f9,_0xa6a0e6){var _0x220e23=function(_0x22f720){while(--_0x22f720){_0x3a81f9['push'](_0x3a81f9['shift']());}};_0x220e23(++_0xa6a0e6);}(_0x648a,0xc0));var _0xa648=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x648a[_0x2070da];return _0x4f9fe1;};'use strict';var _=require(_0xa648('0x0'));var util=require(_0xa648('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa648('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa648('0x3'))['db'];var utils=require(_0xa648('0x4'));var logger=require(_0xa648('0x5'))(_0xa648('0x6'));var config=require(_0xa648('0x7'));var jayson=require(_0xa648('0x8'));var client=jayson[_0xa648('0x9')][_0xa648('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46ca43,_0x2fe411,_0xcf694b){return new BPromise(function(_0x4c3e9f,_0x2e214c){return client[_0xa648('0xb')](_0x46ca43,_0xcf694b)['then'](function(_0x353714){logger[_0xa648('0xc')](_0xa648('0xd'),_0x2fe411,_0xa648('0xe'));logger['debug'](_0xa648('0xf'),_0x2fe411,'request\x20sent',JSON[_0xa648('0x10')](_0x353714));if(_0x353714[_0xa648('0x11')]){if(_0x353714[_0xa648('0x11')][_0xa648('0x12')]===0x1f4){logger[_0xa648('0x11')](_0xa648('0xd'),_0x2fe411,_0x353714[_0xa648('0x11')][_0xa648('0x13')]);return _0x2e214c(_0x353714[_0xa648('0x11')][_0xa648('0x13')]);}logger[_0xa648('0x11')](_0xa648('0xd'),_0x2fe411,_0x353714[_0xa648('0x11')][_0xa648('0x13')]);return _0x4c3e9f(_0x353714[_0xa648('0x11')]['message']);}else{logger[_0xa648('0xc')](_0xa648('0xd'),_0x2fe411,_0xa648('0xe'));_0x4c3e9f(_0x353714[_0xa648('0x14')][_0xa648('0x13')]);}})[_0xa648('0x15')](function(_0x395825){logger[_0xa648('0x11')](_0xa648('0xd'),_0x2fe411,_0x395825);_0x2e214c(_0x395825);});});}exports[_0xa648('0x16')]=function(_0x4ae268){var _0x2d523e=this;return new Promise(function(_0x349ec1,_0x38fa50){return db[_0xa648('0x17')][_0xa648('0x18')]({'raw':_0x4ae268[_0xa648('0x19')]?_0x4ae268[_0xa648('0x19')][_0xa648('0x1a')]===undefined?!![]:![]:!![],'where':_0x4ae268['options']?_0x4ae268['options'][_0xa648('0x1b')]||null:null,'attributes':_0x4ae268[_0xa648('0x19')]?_0x4ae268[_0xa648('0x19')][_0xa648('0x1c')]||null:null,'limit':_0x4ae268[_0xa648('0x19')]?_0x4ae268[_0xa648('0x19')][_0xa648('0x1d')]||null:null,'include':_0x4ae268[_0xa648('0x19')]?_0x4ae268[_0xa648('0x19')]['include']?_['map'](_0x4ae268[_0xa648('0x19')][_0xa648('0x1e')],function(_0x2889cf){return{'model':db[_0x2889cf[_0xa648('0x1f')]],'as':_0x2889cf['as'],'attributes':_0x2889cf[_0xa648('0x1c')],'include':_0x2889cf[_0xa648('0x1e')]?_[_0xa648('0x20')](_0x2889cf['include'],function(_0x27776b){return{'model':db[_0x27776b['model']],'as':_0x27776b['as'],'attributes':_0x27776b[_0xa648('0x1c')],'include':_0x27776b['include']?_[_0xa648('0x20')](_0x27776b[_0xa648('0x1e')],function(_0x549d97){return{'model':db[_0x549d97['model']],'as':_0x549d97['as'],'attributes':_0x549d97['attributes']};}):[]};}):[]};}):[]:[]})[_0xa648('0x21')](function(_0x2d2e8c){logger[_0xa648('0xc')](_0xa648('0x16'),_0x4ae268);logger[_0xa648('0x22')]('GetInterval',_0x4ae268,JSON[_0xa648('0x10')](_0x2d2e8c));_0x349ec1(_0x2d2e8c);})[_0xa648('0x15')](function(_0x47bb9c){logger[_0xa648('0x11')](_0xa648('0x16'),_0x47bb9c[_0xa648('0x13')],_0x4ae268);_0x38fa50(_0x2d523e[_0xa648('0x11')](0x1f4,_0x47bb9c['message']));});});};exports[_0xa648('0x23')]=function(_0x2b9a62){var _0x10b210=this;return new Promise(function(_0x15debf,_0x1276c5){return db[_0xa648('0x17')][_0xa648('0x24')]({'raw':_0x2b9a62[_0xa648('0x19')]?_0x2b9a62[_0xa648('0x19')][_0xa648('0x1a')]===undefined?!![]:![]:!![],'where':_0x2b9a62[_0xa648('0x19')]?_0x2b9a62[_0xa648('0x19')][_0xa648('0x1b')]||null:null,'attributes':_0x2b9a62['options']?_0x2b9a62[_0xa648('0x19')][_0xa648('0x1c')]||null:null,'include':_0x2b9a62[_0xa648('0x19')]?_0x2b9a62[_0xa648('0x19')]['include']?_[_0xa648('0x20')](_0x2b9a62[_0xa648('0x19')][_0xa648('0x1e')],function(_0x31d2a1){return{'model':db[_0x31d2a1[_0xa648('0x1f')]],'as':_0x31d2a1['as'],'attributes':_0x31d2a1[_0xa648('0x1c')],'include':_0x31d2a1[_0xa648('0x1e')]?_[_0xa648('0x20')](_0x31d2a1[_0xa648('0x1e')],function(_0x35ddaf){return{'model':db[_0x35ddaf['model']],'as':_0x35ddaf['as'],'attributes':_0x35ddaf[_0xa648('0x1c')],'include':_0x35ddaf[_0xa648('0x1e')]?_['map'](_0x35ddaf[_0xa648('0x1e')],function(_0x55b1ac){return{'model':db[_0x55b1ac[_0xa648('0x1f')]],'as':_0x55b1ac['as'],'attributes':_0x55b1ac['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e896a){logger[_0xa648('0xc')]('ShowInterval',_0x2b9a62);logger['debug'](_0xa648('0x23'),_0x2b9a62,JSON[_0xa648('0x10')](_0x5e896a));_0x15debf(_0x5e896a);})[_0xa648('0x15')](function(_0xf55d4f){logger[_0xa648('0x11')](_0xa648('0x23'),_0xf55d4f[_0xa648('0x13')],_0x2b9a62);_0x1276c5(_0x10b210['error'](0x1f4,_0xf55d4f['message']));});});}; \ No newline at end of file +var _0x648c=['util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetInterval','Interval','findAll','options','raw','limit','include','model','map','attributes','ShowInterval','find','where','lodash'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x648c,0xd1));var _0xc648=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x648c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc648('0x0'));var util=require(_0xc648('0x1'));var moment=require('moment');var BPromise=require(_0xc648('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc648('0x3'));var db=require(_0xc648('0x4'))['db'];var utils=require(_0xc648('0x5'));var logger=require(_0xc648('0x6'))(_0xc648('0x7'));var config=require(_0xc648('0x8'));var jayson=require(_0xc648('0x9'));var client=jayson[_0xc648('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x143b5f,_0x1fd744,_0x4bab66){return new BPromise(function(_0x52259d,_0x44a9e8){return client[_0xc648('0xb')](_0x143b5f,_0x4bab66)[_0xc648('0xc')](function(_0x52b243){logger[_0xc648('0xd')](_0xc648('0xe'),_0x1fd744,_0xc648('0xf'));logger[_0xc648('0x10')](_0xc648('0x11'),_0x1fd744,_0xc648('0xf'),JSON[_0xc648('0x12')](_0x52b243));if(_0x52b243[_0xc648('0x13')]){if(_0x52b243[_0xc648('0x13')]['code']===0x1f4){logger[_0xc648('0x13')]('Interval,\x20%s,\x20%s',_0x1fd744,_0x52b243[_0xc648('0x13')][_0xc648('0x14')]);return _0x44a9e8(_0x52b243[_0xc648('0x13')][_0xc648('0x14')]);}logger[_0xc648('0x13')](_0xc648('0xe'),_0x1fd744,_0x52b243[_0xc648('0x13')][_0xc648('0x14')]);return _0x52259d(_0x52b243['error'][_0xc648('0x14')]);}else{logger['info'](_0xc648('0xe'),_0x1fd744,_0xc648('0xf'));_0x52259d(_0x52b243[_0xc648('0x15')][_0xc648('0x14')]);}})['catch'](function(_0x29599c){logger[_0xc648('0x13')](_0xc648('0xe'),_0x1fd744,_0x29599c);_0x44a9e8(_0x29599c);});});}exports[_0xc648('0x16')]=function(_0x25429e){var _0x547d94=this;return new Promise(function(_0x30c923,_0x533341){return db[_0xc648('0x17')][_0xc648('0x18')]({'raw':_0x25429e['options']?_0x25429e[_0xc648('0x19')][_0xc648('0x1a')]===undefined?!![]:![]:!![],'where':_0x25429e[_0xc648('0x19')]?_0x25429e[_0xc648('0x19')]['where']||null:null,'attributes':_0x25429e[_0xc648('0x19')]?_0x25429e[_0xc648('0x19')]['attributes']||null:null,'limit':_0x25429e[_0xc648('0x19')]?_0x25429e[_0xc648('0x19')][_0xc648('0x1b')]||null:null,'include':_0x25429e[_0xc648('0x19')]?_0x25429e[_0xc648('0x19')][_0xc648('0x1c')]?_['map'](_0x25429e[_0xc648('0x19')]['include'],function(_0x4d218b){return{'model':db[_0x4d218b[_0xc648('0x1d')]],'as':_0x4d218b['as'],'attributes':_0x4d218b['attributes'],'include':_0x4d218b[_0xc648('0x1c')]?_[_0xc648('0x1e')](_0x4d218b[_0xc648('0x1c')],function(_0x3d32e0){return{'model':db[_0x3d32e0['model']],'as':_0x3d32e0['as'],'attributes':_0x3d32e0[_0xc648('0x1f')],'include':_0x3d32e0['include']?_[_0xc648('0x1e')](_0x3d32e0[_0xc648('0x1c')],function(_0x34fa9d){return{'model':db[_0x34fa9d[_0xc648('0x1d')]],'as':_0x34fa9d['as'],'attributes':_0x34fa9d[_0xc648('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc648('0xc')](function(_0x3a38f6){logger[_0xc648('0xd')](_0xc648('0x16'),_0x25429e);logger['debug'](_0xc648('0x16'),_0x25429e,JSON['stringify'](_0x3a38f6));_0x30c923(_0x3a38f6);})['catch'](function(_0x579a3b){logger[_0xc648('0x13')](_0xc648('0x16'),_0x579a3b['message'],_0x25429e);_0x533341(_0x547d94['error'](0x1f4,_0x579a3b[_0xc648('0x14')]));});});};exports[_0xc648('0x20')]=function(_0x5ed5d0){var _0x3fd70a=this;return new Promise(function(_0x417b87,_0x420877){return db[_0xc648('0x17')][_0xc648('0x21')]({'raw':_0x5ed5d0['options']?_0x5ed5d0[_0xc648('0x19')][_0xc648('0x1a')]===undefined?!![]:![]:!![],'where':_0x5ed5d0['options']?_0x5ed5d0[_0xc648('0x19')][_0xc648('0x22')]||null:null,'attributes':_0x5ed5d0['options']?_0x5ed5d0[_0xc648('0x19')][_0xc648('0x1f')]||null:null,'include':_0x5ed5d0['options']?_0x5ed5d0[_0xc648('0x19')][_0xc648('0x1c')]?_[_0xc648('0x1e')](_0x5ed5d0[_0xc648('0x19')][_0xc648('0x1c')],function(_0x573a67){return{'model':db[_0x573a67['model']],'as':_0x573a67['as'],'attributes':_0x573a67[_0xc648('0x1f')],'include':_0x573a67[_0xc648('0x1c')]?_['map'](_0x573a67[_0xc648('0x1c')],function(_0x425371){return{'model':db[_0x425371[_0xc648('0x1d')]],'as':_0x425371['as'],'attributes':_0x425371['attributes'],'include':_0x425371[_0xc648('0x1c')]?_[_0xc648('0x1e')](_0x425371[_0xc648('0x1c')],function(_0x20375f){return{'model':db[_0x20375f['model']],'as':_0x20375f['as'],'attributes':_0x20375f[_0xc648('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc648('0xc')](function(_0x5b86df){logger[_0xc648('0xd')](_0xc648('0x20'),_0x5ed5d0);logger[_0xc648('0x10')]('ShowInterval',_0x5ed5d0,JSON['stringify'](_0x5b86df));_0x417b87(_0x5b86df);})['catch'](function(_0x5574d6){logger[_0xc648('0x13')]('ShowInterval',_0x5574d6[_0xc648('0x14')],_0x5ed5d0);_0x420877(_0x3fd70a[_0xc648('0x13')](0x1f4,_0x5574d6['message']));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 03099b7..2f56ead 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 _0x1b63=['post','isAuthenticated','send','exports','Router','../../components/auth/service','./jira.controller'];(function(_0x237f4b,_0x485ba4){var _0x42bcf3=function(_0x3fcc37){while(--_0x3fcc37){_0x237f4b['push'](_0x237f4b['shift']());}};_0x42bcf3(++_0x485ba4);}(_0x1b63,0x90));var _0x31b6=function(_0x284a61,_0x231686){_0x284a61=_0x284a61-0x0;var _0x220e3c=_0x1b63[_0x284a61];return _0x220e3c;};'use strict';var express=require('express');var router=express[_0x31b6('0x0')]();var auth=require(_0x31b6('0x1'));var controller=require(_0x31b6('0x2'));router[_0x31b6('0x3')]('/',auth[_0x31b6('0x4')](),controller[_0x31b6('0x5')]);module[_0x31b6('0x6')]=router; \ No newline at end of file +var _0x1a94=['Router','../../components/auth/service','./jira.controller','post','isAuthenticated','exports'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x1a94,0x11a));var _0x41a9=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x1a94[_0x1a36a5];return _0x746243;};'use strict';var express=require('express');var router=express[_0x41a9('0x0')]();var auth=require(_0x41a9('0x1'));var controller=require(_0x41a9('0x2'));router[_0x41a9('0x3')]('/',auth[_0x41a9('0x4')](),controller['send']);module[_0x41a9('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 367b108..4fb1908 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 _0x5899=['description','issuetype','Bug','fields','customfield_11502','customfield_11503','name','customfield_11504','reason','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','base64','stringify','request','setEncoding','utf8','data','end','status','statusCode','json','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','Report','\x20from\x20'];(function(_0x2263d6,_0x23ef72){var _0x392795=function(_0x555ceb){while(--_0x555ceb){_0x2263d6['push'](_0x2263d6['shift']());}};_0x392795(++_0x23ef72);}(_0x5899,0x15e));var _0x9589=function(_0x3e7a57,_0x4e8178){_0x3e7a57=_0x3e7a57-0x0;var _0x206acc=_0x5899[_0x3e7a57];return _0x206acc;};'use strict';var BPromise=require(_0x9589('0x0'));var https=require(_0x9589('0x1'));var logger=require(_0x9589('0x2'))(_0x9589('0x3'));var USERNAME=_0x9589('0x4');var PASSWORD=_0x9589('0x5');function openIssue(_0x111e6e,_0x5528e){var _0x23df1e={'fields':{'project':{'key':_0x111e6e[_0x9589('0x6')]||_0x9589('0x7')},'summary':(_0x111e6e['summary']||_0x9589('0x8'))+_0x9589('0x9')+_0x111e6e['ip'],'description':_0x111e6e[_0x9589('0xa')]||JSON['stringify'](_0x111e6e),'issuetype':{'name':_0x111e6e[_0x9589('0xb')]||_0x9589('0xc')}}};_0x23df1e['fields']['customfield_11500']=_0x111e6e['email'];_0x23df1e[_0x9589('0xd')]['customfield_11501']=_0x111e6e['oldToken'];_0x23df1e[_0x9589('0xd')][_0x9589('0xe')]=_0x111e6e['newToken'];_0x23df1e[_0x9589('0xd')][_0x9589('0xf')]=_0x111e6e[_0x9589('0x10')];_0x23df1e[_0x9589('0xd')][_0x9589('0x11')]=_0x111e6e[_0x9589('0x12')];_0x23df1e[_0x9589('0xd')]['customfield_10102']=_0x111e6e['ip'];var _0x2786b5={'host':_0x9589('0x13'),'port':0x1bb,'path':_0x9589('0x14'),'method':_0x9589('0x15'),'timeout':0x4e20,'headers':{'Content-Type':_0x9589('0x16'),'Authorization':_0x9589('0x17')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x9589('0x18'))}};var _0x269282=JSON[_0x9589('0x19')](_0x23df1e);var _0x2ee9ff=https[_0x9589('0x1a')](_0x2786b5,function(_0xf0b3b1){_0xf0b3b1[_0x9589('0x1b')](_0x9589('0x1c'));var _0x1a943f='';_0xf0b3b1['on'](_0x9589('0x1d'),function(_0x170a0d){_0x1a943f+=_0x170a0d;});_0xf0b3b1['on'](_0x9589('0x1e'),function(){if(_0x5528e){return _0x5528e[_0x9589('0x1f')](_0xf0b3b1[_0x9589('0x20')])[_0x9589('0x21')](JSON['parse'](_0x1a943f));}});});_0x2ee9ff['on'](_0x9589('0x22'),function(_0x75411f){if(_0x5528e){return _0x5528e['status'](0x1f4)[_0x9589('0x21')]({'errors':[{'message':_0x9589('0x23'),'type':_0x9589('0x24')}]});}});_0x2ee9ff[_0x9589('0x25')](_0x269282);_0x2ee9ff[_0x9589('0x1e')]();}exports['openIssue']=openIssue;exports[_0x9589('0x26')]=function(_0x33ab53,_0x3b75c2){_0x33ab53[_0x9589('0x27')]['ip']=_0x33ab53[_0x9589('0x28')][_0x9589('0x29')]||_0x33ab53[_0x9589('0x2a')][_0x9589('0x2b')]||_0x33ab53[_0x9589('0x2c')][_0x9589('0x2b')]||_0x33ab53[_0x9589('0x2a')][_0x9589('0x2c')][_0x9589('0x2b')];return openIssue(_0x33ab53[_0x9589('0x27')],_0x3b75c2);}; \ No newline at end of file +var _0x008d=['customfield_11503','name','customfield_11504','track.xcallymotion.com','/rest/api/2/issue','application/json','Basic\x20','toString','setEncoding','utf8','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','end','body','x-forwarded-for','connection','remoteAddress','socket','https','api','support','MOTGUI','summary','Report','\x20from\x20','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501'];(function(_0x139d5d,_0x169b61){var _0x29a654=function(_0x42cb9f){while(--_0x42cb9f){_0x139d5d['push'](_0x139d5d['shift']());}};_0x29a654(++_0x169b61);}(_0x008d,0xfc));var _0xd008=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x008d[_0x321bb2];return _0x9c12ed;};'use strict';var BPromise=require('bluebird');var https=require(_0xd008('0x0'));var logger=require('../../config/logger')(_0xd008('0x1'));var USERNAME=_0xd008('0x2');var PASSWORD='3eAmWpBVP0';function openIssue(_0x1a72e9,_0x4f7d88){var _0x1ad93e={'fields':{'project':{'key':_0x1a72e9['key']||_0xd008('0x3')},'summary':(_0x1a72e9[_0xd008('0x4')]||_0xd008('0x5'))+_0xd008('0x6')+_0x1a72e9['ip'],'description':_0x1a72e9['description']||JSON[_0xd008('0x7')](_0x1a72e9),'issuetype':{'name':_0x1a72e9[_0xd008('0x8')]||_0xd008('0x9')}}};_0x1ad93e[_0xd008('0xa')][_0xd008('0xb')]=_0x1a72e9[_0xd008('0xc')];_0x1ad93e[_0xd008('0xa')][_0xd008('0xd')]=_0x1a72e9['oldToken'];_0x1ad93e[_0xd008('0xa')]['customfield_11502']=_0x1a72e9['newToken'];_0x1ad93e[_0xd008('0xa')][_0xd008('0xe')]=_0x1a72e9[_0xd008('0xf')];_0x1ad93e[_0xd008('0xa')][_0xd008('0x10')]=_0x1a72e9['reason'];_0x1ad93e[_0xd008('0xa')]['customfield_10102']=_0x1a72e9['ip'];var _0x44ebcb={'host':_0xd008('0x11'),'port':0x1bb,'path':_0xd008('0x12'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0xd008('0x13'),'Authorization':_0xd008('0x14')+new Buffer(USERNAME+':'+PASSWORD)[_0xd008('0x15')]('base64')}};var _0x22fe35=JSON[_0xd008('0x7')](_0x1ad93e);var _0x1ac84c=https['request'](_0x44ebcb,function(_0x2dfc83){_0x2dfc83[_0xd008('0x16')](_0xd008('0x17'));var _0x2e1fed='';_0x2dfc83['on']('data',function(_0x4b8e1d){_0x2e1fed+=_0x4b8e1d;});_0x2dfc83['on']('end',function(){if(_0x4f7d88){return _0x4f7d88[_0xd008('0x18')](_0x2dfc83[_0xd008('0x19')])[_0xd008('0x1a')](JSON[_0xd008('0x1b')](_0x2e1fed));}});});_0x1ac84c['on'](_0xd008('0x1c'),function(_0x326dc7){if(_0x4f7d88){return _0x4f7d88[_0xd008('0x18')](0x1f4)[_0xd008('0x1a')]({'errors':[{'message':_0xd008('0x1d'),'type':_0xd008('0x1e')}]});}});_0x1ac84c[_0xd008('0x1f')](_0x22fe35);_0x1ac84c[_0xd008('0x20')]();}exports['openIssue']=openIssue;exports['send']=function(_0x19c25b,_0x60a8ca){_0x19c25b[_0xd008('0x21')]['ip']=_0x19c25b['headers'][_0xd008('0x22')]||_0x19c25b[_0xd008('0x23')][_0xd008('0x24')]||_0x19c25b[_0xd008('0x25')]['remoteAddress']||_0x19c25b[_0xd008('0x23')][_0xd008('0x25')]['remoteAddress'];return openIssue(_0x19c25b[_0xd008('0x21')],_0x60a8ca);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 09915c6..ff6a993 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 _0xa9bf=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','show','create','delete','/:id','destroy','multer','util','path','connect-timeout'];(function(_0x5c1899,_0x36f667){var _0x1bfaf8=function(_0x2a6711){while(--_0x2a6711){_0x5c1899['push'](_0x5c1899['shift']());}};_0x1bfaf8(++_0x36f667);}(_0xa9bf,0x94));var _0xfa9b=function(_0x387987,_0xd3c5a1){_0x387987=_0x387987-0x0;var _0x523042=_0xa9bf[_0x387987];return _0x523042;};'use strict';var multer=require(_0xfa9b('0x0'));var util=require(_0xfa9b('0x1'));var path=require(_0xfa9b('0x2'));var timeout=require(_0xfa9b('0x3'));var express=require('express');var router=express[_0xfa9b('0x4')]();var auth=require(_0xfa9b('0x5'));var interaction=require(_0xfa9b('0x6'));var config=require(_0xfa9b('0x7'));var controller=require(_0xfa9b('0x8'));router[_0xfa9b('0x9')]('/',auth[_0xfa9b('0xa')](),controller[_0xfa9b('0xb')]);router[_0xfa9b('0x9')](_0xfa9b('0xc'),auth['isAuthenticated'](),controller[_0xfa9b('0xd')]);router[_0xfa9b('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xfa9b('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xfa9b('0xf')]);router['put']('/:id',auth[_0xfa9b('0xa')](),controller['update']);router[_0xfa9b('0x10')](_0xfa9b('0x11'),auth[_0xfa9b('0xa')](),controller[_0xfa9b('0x12')]);module['exports']=router; \ No newline at end of file +var _0x84cb=['/describe','describe','/:id','show','post','create','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x84cb,0xb4));var _0xb84c=function(_0x1df1e4,_0xdd6942){_0x1df1e4=_0x1df1e4-0x0;var _0x4728db=_0x84cb[_0x1df1e4];return _0x4728db;};'use strict';var multer=require(_0xb84c('0x0'));var util=require(_0xb84c('0x1'));var path=require(_0xb84c('0x2'));var timeout=require(_0xb84c('0x3'));var express=require('express');var router=express[_0xb84c('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xb84c('0x5'));var config=require(_0xb84c('0x6'));var controller=require('./jscriptyAnswerReport.controller');router[_0xb84c('0x7')]('/',auth[_0xb84c('0x8')](),controller[_0xb84c('0x9')]);router['get'](_0xb84c('0xa'),auth['isAuthenticated'](),controller[_0xb84c('0xb')]);router['get'](_0xb84c('0xc'),auth[_0xb84c('0x8')](),controller[_0xb84c('0xd')]);router[_0xb84c('0xe')]('/',auth[_0xb84c('0x8')](),controller[_0xb84c('0xf')]);router['put'](_0xb84c('0xc'),auth[_0xb84c('0x8')](),controller['update']);router[_0xb84c('0x10')](_0xb84c('0xc'),auth[_0xb84c('0x8')](),controller[_0xb84c('0x11')]);module[_0xb84c('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index f716728..bdd68c9 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 _0xa209=['sequelize','exports','STRING','TEXT','long'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xa209,0xaf));var _0x9a20=function(_0x564cec,_0x242a2b){_0x564cec=_0x564cec-0x0;var _0x4ef7e6=_0xa209[_0x564cec];return _0x4ef7e6;};'use strict';var Sequelize=require(_0x9a20('0x0'));module[_0x9a20('0x1')]={'question':{'type':Sequelize[_0x9a20('0x2')]},'answer':{'type':Sequelize[_0x9a20('0x3')](_0x9a20('0x4'))},'membername':{'type':Sequelize[_0x9a20('0x2')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x9a20('0x2')]},'uniqueid':{'type':Sequelize[_0x9a20('0x2')]},'calleridname':{'type':Sequelize[_0x9a20('0x2')]},'calleridnum':{'type':Sequelize[_0x9a20('0x2')]},'questionId':{'type':Sequelize[_0x9a20('0x2')]}}; \ No newline at end of file +var _0x9512=['TEXT','long','sequelize','exports','STRING'];(function(_0x11b647,_0x3a75d2){var _0x579a97=function(_0x13de0a){while(--_0x13de0a){_0x11b647['push'](_0x11b647['shift']());}};_0x579a97(++_0x3a75d2);}(_0x9512,0xca));var _0x2951=function(_0x18f0bd,_0x2675c3){_0x18f0bd=_0x18f0bd-0x0;var _0x314678=_0x9512[_0x18f0bd];return _0x314678;};'use strict';var Sequelize=require(_0x2951('0x0'));module[_0x2951('0x1')]={'question':{'type':Sequelize[_0x2951('0x2')]},'answer':{'type':Sequelize[_0x2951('0x3')](_0x2951('0x4'))},'membername':{'type':Sequelize[_0x2951('0x2')]},'projectname':{'type':Sequelize[_0x2951('0x2')]},'queue':{'type':Sequelize[_0x2951('0x2')]},'uniqueid':{'type':Sequelize[_0x2951('0x2')]},'calleridname':{'type':Sequelize[_0x2951('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize[_0x2951('0x2')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 4158bf4..3a48387 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 _0xc24e=['end','json','count','offset','limit','status','set','apply','save','update','destroy','then','error','stack','name','send','map','JscriptyAnswerReport','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','includeAll','include','rows','catch','show','options','create','body','find','params','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','sendStatus'];(function(_0x18d631,_0x4376d2){var _0x50d708=function(_0x3b6ab5){while(--_0x3b6ab5){_0x18d631['push'](_0x18d631['shift']());}};_0x50d708(++_0x4376d2);}(_0xc24e,0x1d9));var _0xec24=function(_0x37a83b,_0x2a7cda){_0x37a83b=_0x37a83b-0x0;var _0x3a14d5=_0xc24e[_0x37a83b];return _0x3a14d5;};'use strict';var pdf=require(_0xec24('0x0'));var emlformat=require(_0xec24('0x1'));var rimraf=require(_0xec24('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xec24('0x3'));var rp=require(_0xec24('0x4'));var moment=require(_0xec24('0x5'));var BPromise=require(_0xec24('0x6'));var Mustache=require(_0xec24('0x7'));var util=require(_0xec24('0x8'));var path=require(_0xec24('0x9'));var sox=require(_0xec24('0xa'));var csv=require(_0xec24('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xec24('0xc'));var squel=require(_0xec24('0xd'));var crypto=require(_0xec24('0xe'));var jsforce=require(_0xec24('0xf'));var deskjs=require(_0xec24('0x10'));var toCsv=require(_0xec24('0xb'));var querystring=require(_0xec24('0x11'));var Papa=require(_0xec24('0x12'));var Redis=require(_0xec24('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xec24('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xec24('0x15'));var utils=require(_0xec24('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x450d63,_0x528eb2){_0x528eb2=_0x528eb2||0xcc;return function(_0x565537){if(_0x565537){return _0x450d63[_0xec24('0x17')](_0x528eb2);}return _0x450d63['status'](_0x528eb2)[_0xec24('0x18')]();};}function respondWithResult(_0x4ba418,_0x165ff9){_0x165ff9=_0x165ff9||0xc8;return function(_0x4ba4b2){if(_0x4ba4b2){return _0x4ba418['status'](_0x165ff9)[_0xec24('0x19')](_0x4ba4b2);}};}function respondWithFilteredResult(_0x196a2a,_0x522451){return function(_0x4e426c){if(_0x4e426c){var _0x5768fa=_0x4e426c[_0xec24('0x1a')],_0x3ef9d0=_0x522451[_0xec24('0x1b')],_0x108e10=_0x522451['offset']+_0x522451[_0xec24('0x1c')],_0x2c0ffc;if(_0x108e10>=_0x5768fa){_0x108e10=_0x5768fa;_0x2c0ffc=0xc8;}else{_0x2c0ffc=0xce;}_0x196a2a[_0xec24('0x1d')](_0x2c0ffc);return _0x196a2a[_0xec24('0x1e')]('Content-Range',_0x3ef9d0+'-'+_0x108e10+'/'+_0x5768fa)[_0xec24('0x19')](_0x4e426c);}return null;};}function patchUpdates(_0x194f43){return function(_0xf61d9b){try{jsonpatch[_0xec24('0x1f')](_0xf61d9b,_0x194f43,!![]);}catch(_0x195fc3){return BPromise['reject'](_0x195fc3);}return _0xf61d9b[_0xec24('0x20')]();};}function saveUpdates(_0xe3481e,_0x3ff84c){return function(_0xb7eb20){if(_0xb7eb20){return _0xb7eb20[_0xec24('0x21')](_0xe3481e)['then'](function(_0x3afe94){return _0x3afe94;});}return null;};}function removeEntity(_0x18c744,_0x27969e){return function(_0x43bbd3){if(_0x43bbd3){return _0x43bbd3[_0xec24('0x22')]()[_0xec24('0x23')](function(){_0x18c744[_0xec24('0x1d')](0xcc)[_0xec24('0x18')]();});}};}function handleEntityNotFound(_0x5728f8,_0x51dccb){return function(_0x58c001){if(!_0x58c001){_0x5728f8[_0xec24('0x17')](0x194);}return _0x58c001;};}function handleError(_0x397021,_0x2fe3d1){_0x2fe3d1=_0x2fe3d1||0x1f4;return function(_0x22b1a6){logger[_0xec24('0x24')](_0x22b1a6[_0xec24('0x25')]);if(_0x22b1a6[_0xec24('0x26')]){delete _0x22b1a6[_0xec24('0x26')];}_0x397021[_0xec24('0x1d')](_0x2fe3d1)[_0xec24('0x27')](_0x22b1a6);};}exports['index']=function(_0x1c2a77,_0x41093e){var _0x376687={},_0x39709a={},_0x539031={'count':0x0,'rows':[]};var _0x228be9=_[_0xec24('0x28')](db[_0xec24('0x29')][_0xec24('0x2a')],function(_0x4096cb){return{'name':_0x4096cb[_0xec24('0x2b')],'type':_0x4096cb['type'][_0xec24('0x2c')]};});_0x39709a[_0xec24('0x2d')]=_['map'](_0x228be9,'name');_0x39709a[_0xec24('0x2e')]=_[_0xec24('0x2f')](_0x1c2a77['query']);_0x39709a['filters']=_[_0xec24('0x30')](_0x39709a[_0xec24('0x2d')],_0x39709a[_0xec24('0x2e')]);_0x376687['attributes']=_[_0xec24('0x30')](_0x39709a[_0xec24('0x2d')],qs['fields'](_0x1c2a77[_0xec24('0x2e')][_0xec24('0x31')]));_0x376687[_0xec24('0x32')]=_0x376687[_0xec24('0x32')]['length']?_0x376687['attributes']:_0x39709a[_0xec24('0x2d')];if(!_0x1c2a77[_0xec24('0x2e')][_0xec24('0x33')](_0xec24('0x34'))){_0x376687[_0xec24('0x1c')]=qs[_0xec24('0x1c')](_0x1c2a77[_0xec24('0x2e')][_0xec24('0x1c')]);_0x376687[_0xec24('0x1b')]=qs[_0xec24('0x1b')](_0x1c2a77['query'][_0xec24('0x1b')]);}_0x376687['order']=qs['sort'](_0x1c2a77[_0xec24('0x2e')][_0xec24('0x35')]);_0x376687[_0xec24('0x36')]=qs[_0xec24('0x37')](_[_0xec24('0x38')](_0x1c2a77[_0xec24('0x2e')],_0x39709a[_0xec24('0x37')]));if(_0x1c2a77[_0xec24('0x2e')][_0xec24('0x39')]){_0x376687['where']=_[_0xec24('0x3a')](_0x376687[_0xec24('0x36')],{'$or':_['map'](_0x228be9,function(_0x3f10e1){if(_0x3f10e1[_0xec24('0x3b')]!=='VIRTUAL'){var _0x4891dc={};_0x4891dc[_0x3f10e1[_0xec24('0x26')]]={'$like':'%'+_0x1c2a77[_0xec24('0x2e')][_0xec24('0x39')]+'%'};return _0x4891dc;}})});}_0x376687=_[_0xec24('0x3a')]({},_0x376687,_0x1c2a77['options']);var _0x52a4e2={'where':_0x376687[_0xec24('0x36')]};return db[_0xec24('0x29')]['count'](_0x52a4e2)[_0xec24('0x23')](function(_0x14682e){_0x539031[_0xec24('0x1a')]=_0x14682e;if(_0x1c2a77[_0xec24('0x2e')][_0xec24('0x3c')]){_0x376687[_0xec24('0x3d')]=[{'all':!![]}];}return db[_0xec24('0x29')]['findAll'](_0x376687);})[_0xec24('0x23')](function(_0x2374c7){_0x539031[_0xec24('0x3e')]=_0x2374c7;return _0x539031;})[_0xec24('0x23')](respondWithFilteredResult(_0x41093e,_0x376687))[_0xec24('0x3f')](handleError(_0x41093e,null));};exports[_0xec24('0x40')]=function(_0x3d5e03,_0x1cfe29){var _0xdb3e1b={'raw':!![],'where':{'id':_0x3d5e03['params']['id']}},_0x237e19={};_0x237e19['model']=_[_0xec24('0x2f')](db[_0xec24('0x29')][_0xec24('0x2a')]);_0x237e19['query']=_[_0xec24('0x2f')](_0x3d5e03[_0xec24('0x2e')]);_0x237e19[_0xec24('0x37')]=_[_0xec24('0x30')](_0x237e19[_0xec24('0x2d')],_0x237e19[_0xec24('0x2e')]);_0xdb3e1b[_0xec24('0x32')]=_[_0xec24('0x30')](_0x237e19[_0xec24('0x2d')],qs[_0xec24('0x31')](_0x3d5e03[_0xec24('0x2e')][_0xec24('0x31')]));_0xdb3e1b[_0xec24('0x32')]=_0xdb3e1b[_0xec24('0x32')]['length']?_0xdb3e1b['attributes']:_0x237e19[_0xec24('0x2d')];if(_0x3d5e03[_0xec24('0x2e')][_0xec24('0x3c')]){_0xdb3e1b['include']=[{'all':!![]}];}_0xdb3e1b=_[_0xec24('0x3a')]({},_0xdb3e1b,_0x3d5e03[_0xec24('0x41')]);return db[_0xec24('0x29')]['find'](_0xdb3e1b)[_0xec24('0x23')](handleEntityNotFound(_0x1cfe29,null))[_0xec24('0x23')](respondWithResult(_0x1cfe29,null))[_0xec24('0x3f')](handleError(_0x1cfe29,null));};exports[_0xec24('0x42')]=function(_0x145fa4,_0x56969c){return db['JscriptyAnswerReport'][_0xec24('0x42')](_0x145fa4[_0xec24('0x43')],{})['then'](respondWithResult(_0x56969c,0xc9))[_0xec24('0x3f')](handleError(_0x56969c,null));};exports['update']=function(_0x17626c,_0x3e016f){if(_0x17626c[_0xec24('0x43')]['id']){delete _0x17626c[_0xec24('0x43')]['id'];}return db[_0xec24('0x29')][_0xec24('0x44')]({'where':{'id':_0x17626c[_0xec24('0x45')]['id']}})[_0xec24('0x23')](handleEntityNotFound(_0x3e016f,null))[_0xec24('0x23')](saveUpdates(_0x17626c[_0xec24('0x43')],null))[_0xec24('0x23')](respondWithResult(_0x3e016f,null))['catch'](handleError(_0x3e016f,null));};exports[_0xec24('0x22')]=function(_0x3c96c5,_0x59e8b3){return db['JscriptyAnswerReport'][_0xec24('0x44')]({'where':{'id':_0x3c96c5[_0xec24('0x45')]['id']}})[_0xec24('0x23')](handleEntityNotFound(_0x59e8b3,null))[_0xec24('0x23')](removeEntity(_0x59e8b3,null))[_0xec24('0x3f')](handleError(_0x59e8b3,null));};exports[_0xec24('0x46')]=function(_0x114faa,_0x4f3861){return db[_0xec24('0x29')]['describe']()['then'](respondWithResult(_0x4f3861,null))[_0xec24('0x3f')](handleError(_0x4f3861,null));}; \ No newline at end of file +var _0xf7a1=['set','apply','save','update','destroy','then','error','stack','name','map','JscriptyAnswerReport','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','offset','sort','filter','where','merge','type','VIRTUAL','options','count','include','findAll','catch','params','includeAll','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit'];(function(_0xa71c0c,_0x1d2876){var _0x15d5c1=function(_0x2e7e99){while(--_0x2e7e99){_0xa71c0c['push'](_0xa71c0c['shift']());}};_0x15d5c1(++_0x1d2876);}(_0xf7a1,0xed));var _0x1f7a=function(_0x3b9576,_0x3fcdbc){_0x3b9576=_0x3b9576-0x0;var _0x167d93=_0xf7a1[_0x3b9576];return _0x167d93;};'use strict';var pdf=require(_0x1f7a('0x0'));var emlformat=require(_0x1f7a('0x1'));var rimraf=require(_0x1f7a('0x2'));var zipdir=require(_0x1f7a('0x3'));var jsonpatch=require(_0x1f7a('0x4'));var rp=require(_0x1f7a('0x5'));var moment=require(_0x1f7a('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x1f7a('0x7'));var util=require('util');var path=require(_0x1f7a('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1f7a('0x9'));var fs=require('fs');var _=require(_0x1f7a('0xa'));var squel=require(_0x1f7a('0xb'));var crypto=require(_0x1f7a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1f7a('0xd'));var toCsv=require(_0x1f7a('0xe'));var querystring=require(_0x1f7a('0xf'));var Papa=require(_0x1f7a('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1f7a('0x11'));var hardwareService=require(_0x1f7a('0x12'));var logger=require('../../config/logger')(_0x1f7a('0x13'));var utils=require('../../config/utils');var config=require(_0x1f7a('0x14'));var db=require(_0x1f7a('0x15'))['db'];function respondWithStatusCode(_0x335590,_0x36eb29){_0x36eb29=_0x36eb29||0xcc;return function(_0x3b25e0){if(_0x3b25e0){return _0x335590[_0x1f7a('0x16')](_0x36eb29);}return _0x335590[_0x1f7a('0x17')](_0x36eb29)[_0x1f7a('0x18')]();};}function respondWithResult(_0x19b500,_0x3abda2){_0x3abda2=_0x3abda2||0xc8;return function(_0x38cb22){if(_0x38cb22){return _0x19b500[_0x1f7a('0x17')](_0x3abda2)[_0x1f7a('0x19')](_0x38cb22);}};}function respondWithFilteredResult(_0x43c89b,_0x2de9bf){return function(_0x44762b){if(_0x44762b){var _0x4d3601=_0x44762b['count'],_0x44a419=_0x2de9bf['offset'],_0x29dff4=_0x2de9bf['offset']+_0x2de9bf[_0x1f7a('0x1a')],_0x2ef907;if(_0x29dff4>=_0x4d3601){_0x29dff4=_0x4d3601;_0x2ef907=0xc8;}else{_0x2ef907=0xce;}_0x43c89b[_0x1f7a('0x17')](_0x2ef907);return _0x43c89b[_0x1f7a('0x1b')]('Content-Range',_0x44a419+'-'+_0x29dff4+'/'+_0x4d3601)['json'](_0x44762b);}return null;};}function patchUpdates(_0x2998ab){return function(_0x1b00fe){try{jsonpatch[_0x1f7a('0x1c')](_0x1b00fe,_0x2998ab,!![]);}catch(_0x269c47){return BPromise['reject'](_0x269c47);}return _0x1b00fe[_0x1f7a('0x1d')]();};}function saveUpdates(_0x92fcc0,_0x68bd8e){return function(_0x1cdf43){if(_0x1cdf43){return _0x1cdf43[_0x1f7a('0x1e')](_0x92fcc0)['then'](function(_0x4ea0fb){return _0x4ea0fb;});}return null;};}function removeEntity(_0x34c590,_0x39d5e9){return function(_0x3c868a){if(_0x3c868a){return _0x3c868a[_0x1f7a('0x1f')]()[_0x1f7a('0x20')](function(){_0x34c590['status'](0xcc)[_0x1f7a('0x18')]();});}};}function handleEntityNotFound(_0x2ca312,_0x2f0a31){return function(_0x226803){if(!_0x226803){_0x2ca312[_0x1f7a('0x16')](0x194);}return _0x226803;};}function handleError(_0x1c7b54,_0xc1859b){_0xc1859b=_0xc1859b||0x1f4;return function(_0x300eea){logger[_0x1f7a('0x21')](_0x300eea[_0x1f7a('0x22')]);if(_0x300eea[_0x1f7a('0x23')]){delete _0x300eea['name'];}_0x1c7b54[_0x1f7a('0x17')](_0xc1859b)['send'](_0x300eea);};}exports['index']=function(_0x3fc5c5,_0x4060ed){var _0x450d1f={},_0x527139={},_0x5bbd6f={'count':0x0,'rows':[]};var _0x102065=_[_0x1f7a('0x24')](db[_0x1f7a('0x25')][_0x1f7a('0x26')],function(_0x40bd54){return{'name':_0x40bd54['fieldName'],'type':_0x40bd54['type']['key']};});_0x527139[_0x1f7a('0x27')]=_[_0x1f7a('0x24')](_0x102065,_0x1f7a('0x23'));_0x527139['query']=_[_0x1f7a('0x28')](_0x3fc5c5[_0x1f7a('0x29')]);_0x527139[_0x1f7a('0x2a')]=_[_0x1f7a('0x2b')](_0x527139[_0x1f7a('0x27')],_0x527139[_0x1f7a('0x29')]);_0x450d1f[_0x1f7a('0x2c')]=_[_0x1f7a('0x2b')](_0x527139[_0x1f7a('0x27')],qs[_0x1f7a('0x2d')](_0x3fc5c5['query'][_0x1f7a('0x2d')]));_0x450d1f[_0x1f7a('0x2c')]=_0x450d1f[_0x1f7a('0x2c')][_0x1f7a('0x2e')]?_0x450d1f[_0x1f7a('0x2c')]:_0x527139[_0x1f7a('0x27')];if(!_0x3fc5c5[_0x1f7a('0x29')][_0x1f7a('0x2f')]('nolimit')){_0x450d1f[_0x1f7a('0x1a')]=qs[_0x1f7a('0x1a')](_0x3fc5c5[_0x1f7a('0x29')][_0x1f7a('0x1a')]);_0x450d1f[_0x1f7a('0x30')]=qs[_0x1f7a('0x30')](_0x3fc5c5[_0x1f7a('0x29')]['offset']);}_0x450d1f['order']=qs[_0x1f7a('0x31')](_0x3fc5c5[_0x1f7a('0x29')][_0x1f7a('0x31')]);_0x450d1f['where']=qs[_0x1f7a('0x2a')](_['pick'](_0x3fc5c5[_0x1f7a('0x29')],_0x527139['filters']));if(_0x3fc5c5[_0x1f7a('0x29')][_0x1f7a('0x32')]){_0x450d1f[_0x1f7a('0x33')]=_[_0x1f7a('0x34')](_0x450d1f[_0x1f7a('0x33')],{'$or':_[_0x1f7a('0x24')](_0x102065,function(_0x102db7){if(_0x102db7[_0x1f7a('0x35')]!==_0x1f7a('0x36')){var _0x1bb5bb={};_0x1bb5bb[_0x102db7[_0x1f7a('0x23')]]={'$like':'%'+_0x3fc5c5[_0x1f7a('0x29')][_0x1f7a('0x32')]+'%'};return _0x1bb5bb;}})});}_0x450d1f=_['merge']({},_0x450d1f,_0x3fc5c5[_0x1f7a('0x37')]);var _0x21de85={'where':_0x450d1f[_0x1f7a('0x33')]};return db[_0x1f7a('0x25')][_0x1f7a('0x38')](_0x21de85)['then'](function(_0x338010){_0x5bbd6f[_0x1f7a('0x38')]=_0x338010;if(_0x3fc5c5[_0x1f7a('0x29')]['includeAll']){_0x450d1f[_0x1f7a('0x39')]=[{'all':!![]}];}return db[_0x1f7a('0x25')][_0x1f7a('0x3a')](_0x450d1f);})['then'](function(_0x175718){_0x5bbd6f['rows']=_0x175718;return _0x5bbd6f;})[_0x1f7a('0x20')](respondWithFilteredResult(_0x4060ed,_0x450d1f))[_0x1f7a('0x3b')](handleError(_0x4060ed,null));};exports['show']=function(_0x3605de,_0x591149){var _0x2fa917={'raw':!![],'where':{'id':_0x3605de[_0x1f7a('0x3c')]['id']}},_0x1f18a9={};_0x1f18a9['model']=_[_0x1f7a('0x28')](db['JscriptyAnswerReport'][_0x1f7a('0x26')]);_0x1f18a9[_0x1f7a('0x29')]=_[_0x1f7a('0x28')](_0x3605de[_0x1f7a('0x29')]);_0x1f18a9[_0x1f7a('0x2a')]=_[_0x1f7a('0x2b')](_0x1f18a9[_0x1f7a('0x27')],_0x1f18a9[_0x1f7a('0x29')]);_0x2fa917['attributes']=_['intersection'](_0x1f18a9[_0x1f7a('0x27')],qs[_0x1f7a('0x2d')](_0x3605de[_0x1f7a('0x29')][_0x1f7a('0x2d')]));_0x2fa917[_0x1f7a('0x2c')]=_0x2fa917[_0x1f7a('0x2c')]['length']?_0x2fa917[_0x1f7a('0x2c')]:_0x1f18a9['model'];if(_0x3605de[_0x1f7a('0x29')][_0x1f7a('0x3d')]){_0x2fa917[_0x1f7a('0x39')]=[{'all':!![]}];}_0x2fa917=_[_0x1f7a('0x34')]({},_0x2fa917,_0x3605de[_0x1f7a('0x37')]);return db['JscriptyAnswerReport'][_0x1f7a('0x3e')](_0x2fa917)['then'](handleEntityNotFound(_0x591149,null))[_0x1f7a('0x20')](respondWithResult(_0x591149,null))['catch'](handleError(_0x591149,null));};exports[_0x1f7a('0x3f')]=function(_0x30de1a,_0x19e5be){return db['JscriptyAnswerReport']['create'](_0x30de1a[_0x1f7a('0x40')],{})[_0x1f7a('0x20')](respondWithResult(_0x19e5be,0xc9))[_0x1f7a('0x3b')](handleError(_0x19e5be,null));};exports['update']=function(_0x2e38e,_0x2b8c2d){if(_0x2e38e[_0x1f7a('0x40')]['id']){delete _0x2e38e[_0x1f7a('0x40')]['id'];}return db[_0x1f7a('0x25')][_0x1f7a('0x3e')]({'where':{'id':_0x2e38e[_0x1f7a('0x3c')]['id']}})[_0x1f7a('0x20')](handleEntityNotFound(_0x2b8c2d,null))[_0x1f7a('0x20')](saveUpdates(_0x2e38e[_0x1f7a('0x40')],null))[_0x1f7a('0x20')](respondWithResult(_0x2b8c2d,null))[_0x1f7a('0x3b')](handleError(_0x2b8c2d,null));};exports['destroy']=function(_0x2ee587,_0x3dbabb){return db[_0x1f7a('0x25')][_0x1f7a('0x3e')]({'where':{'id':_0x2ee587[_0x1f7a('0x3c')]['id']}})[_0x1f7a('0x20')](handleEntityNotFound(_0x3dbabb,null))['then'](removeEntity(_0x3dbabb,null))[_0x1f7a('0x3b')](handleError(_0x3dbabb,null));};exports[_0x1f7a('0x41')]=function(_0x55e053,_0x35578e){return db[_0x1f7a('0x25')][_0x1f7a('0x41')]()['then'](respondWithResult(_0x35578e,null))[_0x1f7a('0x3b')](handleError(_0x35578e,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index cfcfe46..a296cf2 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 _0x481c=['request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1ae0b9,_0x1d8321){var _0x5002bf=function(_0x222153){while(--_0x222153){_0x1ae0b9['push'](_0x1ae0b9['shift']());}};_0x5002bf(++_0x1d8321);}(_0x481c,0x1ac));var _0xc481=function(_0x9ca34a,_0x38e6c1){_0x9ca34a=_0x9ca34a-0x0;var _0x53a640=_0x481c[_0x9ca34a];return _0x53a640;};'use strict';var _=require(_0xc481('0x0'));var util=require(_0xc481('0x1'));var logger=require(_0xc481('0x2'))(_0xc481('0x3'));var moment=require(_0xc481('0x4'));var BPromise=require(_0xc481('0x5'));var rp=require(_0xc481('0x6'));var fs=require('fs');var path=require(_0xc481('0x7'));var rimraf=require(_0xc481('0x8'));var config=require(_0xc481('0x9'));var attributes=require(_0xc481('0xa'));module['exports']=function(_0x5e2c13,_0x2b62a5){return _0x5e2c13[_0xc481('0xb')](_0xc481('0xc'),attributes,{'tableName':_0xc481('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4997=['util','../../config/logger','api','moment','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash'];(function(_0x5bd98b,_0x22bf1c){var _0x49efe7=function(_0x2223e8){while(--_0x2223e8){_0x5bd98b['push'](_0x5bd98b['shift']());}};_0x49efe7(++_0x22bf1c);}(_0x4997,0x1af));var _0x7499=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4997[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7499('0x0'));var util=require(_0x7499('0x1'));var logger=require(_0x7499('0x2'))(_0x7499('0x3'));var moment=require(_0x7499('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7499('0x5'));var config=require(_0x7499('0x6'));var attributes=require(_0x7499('0x7'));module[_0x7499('0x8')]=function(_0x52c6f9,_0x21f163){return _0x52c6f9[_0x7499('0x9')](_0x7499('0xa'),attributes,{'tableName':_0x7499('0xb'),'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 8008373..4b8ad3b 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 _0xb54c=['../../config/utils','jayson/promise','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x45e74d,_0x27e18b){var _0x12b298=function(_0x21f720){while(--_0x21f720){_0x45e74d['push'](_0x45e74d['shift']());}};_0x12b298(++_0x27e18b);}(_0xb54c,0x118));var _0xcb54=function(_0x4e94d6,_0x42991a){_0x4e94d6=_0x4e94d6-0x0;var _0x48235e=_0xb54c[_0x4e94d6];return _0x48235e;};'use strict';var _=require(_0xcb54('0x0'));var util=require(_0xcb54('0x1'));var moment=require('moment');var BPromise=require(_0xcb54('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcb54('0x3'));var db=require(_0xcb54('0x4'))['db'];var utils=require(_0xcb54('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xcb54('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4da02f,_0x5dbeb0,_0x432056){return new BPromise(function(_0x64080d,_0x27e2fa){return client[_0xcb54('0x7')](_0x4da02f,_0x432056)[_0xcb54('0x8')](function(_0x1f0415){logger[_0xcb54('0x9')](_0xcb54('0xa'),_0x5dbeb0,'request\x20sent');logger[_0xcb54('0xb')](_0xcb54('0xc'),_0x5dbeb0,_0xcb54('0xd'),JSON[_0xcb54('0xe')](_0x1f0415));if(_0x1f0415['error']){if(_0x1f0415[_0xcb54('0xf')][_0xcb54('0x10')]===0x1f4){logger[_0xcb54('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x5dbeb0,_0x1f0415['error']['message']);return _0x27e2fa(_0x1f0415[_0xcb54('0xf')][_0xcb54('0x11')]);}logger[_0xcb54('0xf')](_0xcb54('0xa'),_0x5dbeb0,_0x1f0415[_0xcb54('0xf')]['message']);return _0x64080d(_0x1f0415[_0xcb54('0xf')][_0xcb54('0x11')]);}else{logger[_0xcb54('0x9')](_0xcb54('0xa'),_0x5dbeb0,_0xcb54('0xd'));_0x64080d(_0x1f0415['result'][_0xcb54('0x11')]);}})[_0xcb54('0x12')](function(_0x418f80){logger[_0xcb54('0xf')](_0xcb54('0xa'),_0x5dbeb0,_0x418f80);_0x27e2fa(_0x418f80);});});} \ No newline at end of file +var _0x0154=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x0154,0x100));var _0x4015=function(_0x201576,_0x31071f){_0x201576=_0x201576-0x0;var _0x21e089=_0x0154[_0x201576];return _0x21e089;};'use strict';var _=require(_0x4015('0x0'));var util=require(_0x4015('0x1'));var moment=require(_0x4015('0x2'));var BPromise=require(_0x4015('0x3'));var rs=require(_0x4015('0x4'));var fs=require('fs');var Redis=require(_0x4015('0x5'));var db=require(_0x4015('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4015('0x7'))(_0x4015('0x8'));var config=require(_0x4015('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4015('0xa')][_0x4015('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5541e1,_0x107754,_0x344bf8){return new BPromise(function(_0x3c0e33,_0x837045){return client[_0x4015('0xc')](_0x5541e1,_0x344bf8)[_0x4015('0xd')](function(_0x43ed1c){logger[_0x4015('0xe')](_0x4015('0xf'),_0x107754,'request\x20sent');logger[_0x4015('0x10')](_0x4015('0x11'),_0x107754,_0x4015('0x12'),JSON[_0x4015('0x13')](_0x43ed1c));if(_0x43ed1c[_0x4015('0x14')]){if(_0x43ed1c['error'][_0x4015('0x15')]===0x1f4){logger['error'](_0x4015('0xf'),_0x107754,_0x43ed1c[_0x4015('0x14')][_0x4015('0x16')]);return _0x837045(_0x43ed1c['error']['message']);}logger[_0x4015('0x14')](_0x4015('0xf'),_0x107754,_0x43ed1c['error'][_0x4015('0x16')]);return _0x3c0e33(_0x43ed1c[_0x4015('0x14')]['message']);}else{logger['info'](_0x4015('0xf'),_0x107754,_0x4015('0x12'));_0x3c0e33(_0x43ed1c[_0x4015('0x17')]['message']);}})[_0x4015('0x18')](function(_0x13e10a){logger['error'](_0x4015('0xf'),_0x107754,_0x13e10a);_0x837045(_0x13e10a);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 4f54a3d..81d5cb0 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 _0x9d7a=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','isAuthenticated','index','show','/:id/sessions','getSessions','/:id/answers','getAnswers','get','/:id/summary','30s','getSummary','post','create','clone','put','/:id','delete','multer'];(function(_0x29f9af,_0x4f3d10){var _0x56e4a8=function(_0x2e2554){while(--_0x2e2554){_0x29f9af['push'](_0x29f9af['shift']());}};_0x56e4a8(++_0x4f3d10);}(_0x9d7a,0xd7));var _0xa9d7=function(_0x1d67bf,_0x2ff8f1){_0x1d67bf=_0x1d67bf-0x0;var _0x7ce418=_0x9d7a[_0x1d67bf];return _0x7ce418;};'use strict';var multer=require(_0xa9d7('0x0'));var util=require(_0xa9d7('0x1'));var path=require(_0xa9d7('0x2'));var timeout=require(_0xa9d7('0x3'));var express=require(_0xa9d7('0x4'));var router=express[_0xa9d7('0x5')]();var auth=require(_0xa9d7('0x6'));var interaction=require(_0xa9d7('0x7'));var config=require(_0xa9d7('0x8'));var controller=require(_0xa9d7('0x9'));router['get']('/',auth[_0xa9d7('0xa')](),controller[_0xa9d7('0xb')]);router['get']('/:id',auth[_0xa9d7('0xa')](),controller[_0xa9d7('0xc')]);router['get'](_0xa9d7('0xd'),auth['isAuthenticated'](),controller[_0xa9d7('0xe')]);router['get'](_0xa9d7('0xf'),auth[_0xa9d7('0xa')](),controller[_0xa9d7('0x10')]);router[_0xa9d7('0x11')](_0xa9d7('0x12'),auth[_0xa9d7('0xa')](),timeout(_0xa9d7('0x13')),controller[_0xa9d7('0x14')]);router[_0xa9d7('0x15')]('/',auth[_0xa9d7('0xa')](),controller[_0xa9d7('0x16')]);router['post']('/:id/clone',auth[_0xa9d7('0xa')](),controller[_0xa9d7('0x17')]);router[_0xa9d7('0x18')](_0xa9d7('0x19'),auth[_0xa9d7('0xa')](),controller['update']);router[_0xa9d7('0x1a')](_0xa9d7('0x19'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9aa2=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','index','/:id','isAuthenticated','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','create','/:id/clone','clone','put','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x172133,_0x10246b){var _0x2460e5=function(_0x3c4918){while(--_0x3c4918){_0x172133['push'](_0x172133['shift']());}};_0x2460e5(++_0x10246b);}(_0x9aa2,0x191));var _0x29aa=function(_0x1beb45,_0x21b30c){_0x1beb45=_0x1beb45-0x0;var _0x436d87=_0x9aa2[_0x1beb45];return _0x436d87;};'use strict';var multer=require(_0x29aa('0x0'));var util=require(_0x29aa('0x1'));var path=require(_0x29aa('0x2'));var timeout=require(_0x29aa('0x3'));var express=require(_0x29aa('0x4'));var router=express[_0x29aa('0x5')]();var auth=require(_0x29aa('0x6'));var interaction=require(_0x29aa('0x7'));var config=require(_0x29aa('0x8'));var controller=require(_0x29aa('0x9'));router[_0x29aa('0xa')]('/',auth['isAuthenticated'](),controller[_0x29aa('0xb')]);router[_0x29aa('0xa')](_0x29aa('0xc'),auth[_0x29aa('0xd')](),controller['show']);router[_0x29aa('0xa')](_0x29aa('0xe'),auth['isAuthenticated'](),controller[_0x29aa('0xf')]);router[_0x29aa('0xa')](_0x29aa('0x10'),auth['isAuthenticated'](),controller[_0x29aa('0x11')]);router[_0x29aa('0xa')](_0x29aa('0x12'),auth[_0x29aa('0xd')](),timeout(_0x29aa('0x13')),controller[_0x29aa('0x14')]);router[_0x29aa('0x15')]('/',auth[_0x29aa('0xd')](),controller[_0x29aa('0x16')]);router[_0x29aa('0x15')](_0x29aa('0x17'),auth['isAuthenticated'](),controller[_0x29aa('0x18')]);router[_0x29aa('0x19')](_0x29aa('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x29aa('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0x29aa('0x1b')]);module[_0x29aa('0x1c')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 4679f3c..5df3b58 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 _0x40f6=['exports','STRING','name','TEXT','long','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','sequelize','lodash','util'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x40f6,0xfd));var _0x640f=function(_0x31e2e0,_0x3238b2){_0x31e2e0=_0x31e2e0-0x0;var _0x4addef=_0x40f6[_0x31e2e0];return _0x4addef;};'use strict';var Sequelize=require(_0x640f('0x0'));var _=require(_0x640f('0x1'));var util=require(_0x640f('0x2'));module[_0x640f('0x3')]={'name':{'type':Sequelize[_0x640f('0x4')],'unique':_0x640f('0x5')},'description':{'type':Sequelize[_0x640f('0x4')]},'formData':{'type':Sequelize[_0x640f('0x6')](_0x640f('0x7')),'set':function(_0x3a83c0){if(_['isObjectLike'](_0x3a83c0)){this[_0x640f('0x8')](_0x640f('0x9'),JSON[_0x640f('0xa')](_0x3a83c0));}else if(_[_0x640f('0xb')](_0x3a83c0)){this[_0x640f('0x8')]('formData',_0x3a83c0);}else{this['setDataValue'](_0x640f('0x9'),util[_0x640f('0xc')](_0x640f('0xd'),this['getDataValue']('name')||'',this[_0x640f('0xe')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x640f('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x640f('0xf')],'defaultValue':![]}}; \ No newline at end of file +var _0x521d=['STRING','TEXT','long','setDataValue','formData','stringify','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util','exports'];(function(_0x1168a1,_0xa0d8c9){var _0xcc5ad8=function(_0x217dc3){while(--_0x217dc3){_0x1168a1['push'](_0x1168a1['shift']());}};_0xcc5ad8(++_0xa0d8c9);}(_0x521d,0x137));var _0xd521=function(_0x3ee9d8,_0x5026e2){_0x3ee9d8=_0x3ee9d8-0x0;var _0x455359=_0x521d[_0x3ee9d8];return _0x455359;};'use strict';var Sequelize=require(_0xd521('0x0'));var _=require(_0xd521('0x1'));var util=require(_0xd521('0x2'));module[_0xd521('0x3')]={'name':{'type':Sequelize[_0xd521('0x4')],'unique':'name'},'description':{'type':Sequelize[_0xd521('0x4')]},'formData':{'type':Sequelize[_0xd521('0x5')](_0xd521('0x6')),'set':function(_0x335be6){if(_['isObjectLike'](_0x335be6)){this[_0xd521('0x7')](_0xd521('0x8'),JSON[_0xd521('0x9')](_0x335be6));}else if(_['isString'](_0x335be6)){this[_0xd521('0x7')](_0xd521('0x8'),_0x335be6);}else{this[_0xd521('0x7')]('formData',util[_0xd521('0xa')](_0xd521('0xb'),this[_0xd521('0xc')]('name')||'',this[_0xd521('0xc')](_0xd521('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xd521('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xd521('0xe')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index f931b3c..0a353b0 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 _0x0f59=['map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','filter','merge','where','VIRTUAL','JscriptyProject','findAll','rows','catch','show','params','includeAll','include','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','clone','omit','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','findOne','JscriptySessionReport','hasOwnProperty','sort','pick','getAnswers','JscriptyAnswerReport','number','toString','indexOf','getSummary','startTime','starttime','parse','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','push','isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','sendStatus','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','Projects','UserProfileResource','error','stack','name','index'];(function(_0x51b0c8,_0x3cbf0d){var _0x50908c=function(_0x33a4df){while(--_0x33a4df){_0x51b0c8['push'](_0x51b0c8['shift']());}};_0x50908c(++_0x3cbf0d);}(_0x0f59,0x131));var _0x90f5=function(_0x95411e,_0x38b4c3){_0x95411e=_0x95411e-0x0;var _0x2c8718=_0x0f59[_0x95411e];return _0x2c8718;};'use strict';var pdf=require(_0x90f5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x90f5('0x1'));var zipdir=require(_0x90f5('0x2'));var jsonpatch=require(_0x90f5('0x3'));var rp=require(_0x90f5('0x4'));var moment=require(_0x90f5('0x5'));var BPromise=require(_0x90f5('0x6'));var Mustache=require(_0x90f5('0x7'));var util=require(_0x90f5('0x8'));var path=require(_0x90f5('0x9'));var sox=require(_0x90f5('0xa'));var csv=require(_0x90f5('0xb'));var ejs=require(_0x90f5('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x90f5('0xd'));var crypto=require('crypto');var jsforce=require(_0x90f5('0xe'));var deskjs=require(_0x90f5('0xf'));var toCsv=require(_0x90f5('0xb'));var querystring=require(_0x90f5('0x10'));var Papa=require(_0x90f5('0x11'));var Redis=require(_0x90f5('0x12'));var authService=require(_0x90f5('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x90f5('0x14'));var logger=require(_0x90f5('0x15'))('api');var utils=require(_0x90f5('0x16'));var config=require(_0x90f5('0x17'));var db=require(_0x90f5('0x18'))['db'];function respondWithStatusCode(_0x4e46f4,_0x202aaf){_0x202aaf=_0x202aaf||0xcc;return function(_0x5588c2){if(_0x5588c2){return _0x4e46f4['sendStatus'](_0x202aaf);}return _0x4e46f4[_0x90f5('0x19')](_0x202aaf)[_0x90f5('0x1a')]();};}function respondWithResult(_0x6271a0,_0x180984){_0x180984=_0x180984||0xc8;return function(_0x1756d7){if(_0x1756d7){return _0x6271a0[_0x90f5('0x19')](_0x180984)[_0x90f5('0x1b')](_0x1756d7);}};}function respondWithFilteredResult(_0x3e459c,_0x552516){return function(_0x285d48){if(_0x285d48){var _0x36f7a0=_0x285d48[_0x90f5('0x1c')],_0x1ad3ce=_0x552516[_0x90f5('0x1d')],_0x103b72=_0x552516[_0x90f5('0x1d')]+_0x552516[_0x90f5('0x1e')],_0x5957e9;if(_0x103b72>=_0x36f7a0){_0x103b72=_0x36f7a0;_0x5957e9=0xc8;}else{_0x5957e9=0xce;}_0x3e459c[_0x90f5('0x19')](_0x5957e9);return _0x3e459c['set'](_0x90f5('0x1f'),_0x1ad3ce+'-'+_0x103b72+'/'+_0x36f7a0)[_0x90f5('0x1b')](_0x285d48);}return null;};}function patchUpdates(_0xbe3cdb){return function(_0x282359){try{jsonpatch[_0x90f5('0x20')](_0x282359,_0xbe3cdb,!![]);}catch(_0x1ac4dd){return BPromise[_0x90f5('0x21')](_0x1ac4dd);}return _0x282359['save']();};}function saveUpdates(_0x11d30f,_0x178e3a){return function(_0x32dc01){if(_0x32dc01){return _0x32dc01[_0x90f5('0x22')](_0x11d30f)[_0x90f5('0x23')](function(_0x1cb935){return _0x1cb935;});}return null;};}function removeEntity(_0x5cbabb,_0x42ed59){return function(_0x5e0165){if(_0x5e0165){return _0x5e0165[_0x90f5('0x24')]()[_0x90f5('0x23')](function(){var _0x570494=_0x5e0165['get']({'plain':!![]});var _0x3fa336=_0x90f5('0x25');return db[_0x90f5('0x26')][_0x90f5('0x24')]({'where':{'type':_0x3fa336,'resourceId':_0x570494['id']}})[_0x90f5('0x23')](function(){return _0x5e0165;});})[_0x90f5('0x23')](function(){_0x5cbabb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x307816,_0x169ffb){return function(_0x36bd0e){if(!_0x36bd0e){_0x307816['sendStatus'](0x194);}return _0x36bd0e;};}function handleError(_0x583b7f,_0x7dab61){_0x7dab61=_0x7dab61||0x1f4;return function(_0x546430){logger[_0x90f5('0x27')](_0x546430[_0x90f5('0x28')]);if(_0x546430[_0x90f5('0x29')]){delete _0x546430[_0x90f5('0x29')];}_0x583b7f[_0x90f5('0x19')](_0x7dab61)['send'](_0x546430);};}exports[_0x90f5('0x2a')]=function(_0x452e4a,_0x13c9b1){var _0x335496={},_0x957dc3={},_0x3b6ca8={'count':0x0,'rows':[]};var _0xb7497b=_[_0x90f5('0x2b')](db['JscriptyProject'][_0x90f5('0x2c')],function(_0x48b45b){return{'name':_0x48b45b[_0x90f5('0x2d')],'type':_0x48b45b[_0x90f5('0x2e')][_0x90f5('0x2f')]};});_0x957dc3['model']=_['map'](_0xb7497b,_0x90f5('0x29'));_0x957dc3['query']=_[_0x90f5('0x30')](_0x452e4a[_0x90f5('0x31')]);_0x957dc3[_0x90f5('0x32')]=_[_0x90f5('0x33')](_0x957dc3[_0x90f5('0x34')],_0x957dc3['query']);_0x335496[_0x90f5('0x35')]=_[_0x90f5('0x33')](_0x957dc3[_0x90f5('0x34')],qs[_0x90f5('0x36')](_0x452e4a[_0x90f5('0x31')][_0x90f5('0x36')]));_0x335496[_0x90f5('0x35')]=_0x335496[_0x90f5('0x35')][_0x90f5('0x37')]?_0x335496[_0x90f5('0x35')]:_0x957dc3['model'];if(!_0x452e4a[_0x90f5('0x31')]['hasOwnProperty'](_0x90f5('0x38'))){_0x335496[_0x90f5('0x1e')]=qs[_0x90f5('0x1e')](_0x452e4a[_0x90f5('0x31')][_0x90f5('0x1e')]);_0x335496[_0x90f5('0x1d')]=qs[_0x90f5('0x1d')](_0x452e4a[_0x90f5('0x31')]['offset']);}_0x335496[_0x90f5('0x39')]=qs['sort'](_0x452e4a[_0x90f5('0x31')]['sort']);_0x335496['where']=qs['filters'](_['pick'](_0x452e4a['query'],_0x957dc3[_0x90f5('0x32')]));if(_0x452e4a['query'][_0x90f5('0x3a')]){_0x335496['where']=_[_0x90f5('0x3b')](_0x335496[_0x90f5('0x3c')],{'$or':_['map'](_0xb7497b,function(_0x4e9c32){if(_0x4e9c32[_0x90f5('0x2e')]!==_0x90f5('0x3d')){var _0x298380={};_0x298380[_0x4e9c32[_0x90f5('0x29')]]={'$like':'%'+_0x452e4a['query'][_0x90f5('0x3a')]+'%'};return _0x298380;}})});}_0x335496=_[_0x90f5('0x3b')]({},_0x335496,_0x452e4a['options']);var _0x138aff={'where':_0x335496[_0x90f5('0x3c')]};return db[_0x90f5('0x3e')][_0x90f5('0x1c')](_0x138aff)[_0x90f5('0x23')](function(_0x2226a6){_0x3b6ca8['count']=_0x2226a6;if(_0x452e4a[_0x90f5('0x31')]['includeAll']){_0x335496['include']=[{'all':!![]}];}return db[_0x90f5('0x3e')][_0x90f5('0x3f')](_0x335496);})[_0x90f5('0x23')](function(_0x521f24){_0x3b6ca8[_0x90f5('0x40')]=_0x521f24;return _0x3b6ca8;})[_0x90f5('0x23')](respondWithFilteredResult(_0x13c9b1,_0x335496))[_0x90f5('0x41')](handleError(_0x13c9b1,null));};exports[_0x90f5('0x42')]=function(_0x5325d0,_0x38dffb){var _0x1b6032={'raw':![],'where':{'id':_0x5325d0[_0x90f5('0x43')]['id']}},_0x413d40={};_0x413d40[_0x90f5('0x34')]=_[_0x90f5('0x30')](db[_0x90f5('0x3e')][_0x90f5('0x2c')]);_0x413d40[_0x90f5('0x31')]=_[_0x90f5('0x30')](_0x5325d0[_0x90f5('0x31')]);_0x413d40['filters']=_['intersection'](_0x413d40['model'],_0x413d40[_0x90f5('0x31')]);_0x1b6032[_0x90f5('0x35')]=_[_0x90f5('0x33')](_0x413d40[_0x90f5('0x34')],qs[_0x90f5('0x36')](_0x5325d0[_0x90f5('0x31')][_0x90f5('0x36')]));_0x1b6032[_0x90f5('0x35')]=_0x1b6032[_0x90f5('0x35')]['length']?_0x1b6032[_0x90f5('0x35')]:_0x413d40[_0x90f5('0x34')];if(_0x5325d0[_0x90f5('0x31')][_0x90f5('0x44')]){_0x1b6032[_0x90f5('0x45')]=[{'all':!![]}];}_0x1b6032=_['merge']({},_0x1b6032,_0x5325d0[_0x90f5('0x46')]);return db[_0x90f5('0x3e')]['find'](_0x1b6032)[_0x90f5('0x23')](handleEntityNotFound(_0x38dffb,null))[_0x90f5('0x23')](respondWithResult(_0x38dffb,null))[_0x90f5('0x41')](handleError(_0x38dffb,null));};exports[_0x90f5('0x47')]=function(_0x72099f,_0x299533){return db[_0x90f5('0x3e')][_0x90f5('0x47')](_0x72099f[_0x90f5('0x48')],{})[_0x90f5('0x23')](function(_0x5417e9){var _0x1e3362=_0x72099f[_0x90f5('0x49')][_0x90f5('0x4a')]({'plain':!![]});if(!_0x1e3362)throw new Error(_0x90f5('0x4b'));if(_0x1e3362[_0x90f5('0x4c')]===_0x90f5('0x49')){var _0x11f71e=_0x5417e9[_0x90f5('0x4a')]({'plain':!![]});var _0x142a62='Projects';return db[_0x90f5('0x4d')][_0x90f5('0x4e')]({'where':{'name':_0x142a62,'userProfileId':_0x1e3362[_0x90f5('0x4f')]},'raw':!![]})[_0x90f5('0x23')](function(_0x29daa3){if(_0x29daa3&&_0x29daa3[_0x90f5('0x50')]===0x0){return db[_0x90f5('0x26')][_0x90f5('0x47')]({'name':_0x11f71e[_0x90f5('0x29')],'resourceId':_0x11f71e['id'],'type':_0x29daa3[_0x90f5('0x29')],'sectionId':_0x29daa3['id']},{})['then'](function(){return _0x5417e9;});}else{return _0x5417e9;}})['catch'](function(_0xe4ddc9){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xe4ddc9);throw _0xe4ddc9;});}return _0x5417e9;})[_0x90f5('0x23')](respondWithResult(_0x299533,0xc9))['catch'](handleError(_0x299533,null));};exports[_0x90f5('0x51')]=function(_0x2d1484,_0x82fe1d){var _0x39fa3c={'where':{'id':_0x2d1484[_0x90f5('0x43')]['id']}},_0x15f38b={};_0x15f38b[_0x90f5('0x34')]=_[_0x90f5('0x30')](db[_0x90f5('0x3e')][_0x90f5('0x2c')]);_0x39fa3c[_0x90f5('0x35')]=_[_0x90f5('0x33')](_0x15f38b[_0x90f5('0x34')],qs[_0x90f5('0x36')](_0x2d1484[_0x90f5('0x31')][_0x90f5('0x36')]));_0x39fa3c['attributes']=_0x39fa3c['attributes'][_0x90f5('0x37')]?_0x39fa3c['attributes']:_0x15f38b['model'];if(_0x2d1484[_0x90f5('0x31')][_0x90f5('0x44')]){_0x39fa3c[_0x90f5('0x45')]=[{'all':!![]}];}_0x39fa3c=_[_0x90f5('0x3b')]({},_0x39fa3c,_0x2d1484[_0x90f5('0x46')]);return db[_0x90f5('0x3e')]['find'](_0x39fa3c)[_0x90f5('0x23')](handleEntityNotFound(_0x82fe1d,null))[_0x90f5('0x23')](function(_0x35d2e0){if(_0x35d2e0){var _0x49f95c=_0x35d2e0['get']({'plain':!![]});_0x49f95c=qs[_0x90f5('0x52')](_0x49f95c,['id',_0x90f5('0x53'),_0x90f5('0x54')]);_0x2d1484[_0x90f5('0x48')]=_[_0x90f5('0x52')](_0x2d1484['body'],['id',_0x90f5('0x53'),_0x90f5('0x54')]);return db[_0x90f5('0x3e')][_0x90f5('0x47')](_[_0x90f5('0x3b')](_0x49f95c,_0x2d1484[_0x90f5('0x48')]),{'include':_0x2d1484[_0x90f5('0x31')][_0x90f5('0x44')]?[{'all':!![]}]:undefined})[_0x90f5('0x23')](function(_0x644df5){var _0x503d8d=_0x2d1484[_0x90f5('0x49')]['get']({'plain':!![]});if(!_0x503d8d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x503d8d[_0x90f5('0x4c')]==='user'){var _0x531d93=_0x644df5[_0x90f5('0x4a')]({'plain':!![]});var _0x2f2fff=_0x90f5('0x25');return db['UserProfileSection'][_0x90f5('0x4e')]({'where':{'name':_0x2f2fff,'userProfileId':_0x503d8d[_0x90f5('0x4f')]},'raw':!![]})[_0x90f5('0x23')](function(_0x35786a){if(_0x35786a&&_0x35786a['autoAssociation']===0x0){return db['UserProfileResource'][_0x90f5('0x47')]({'name':_0x531d93['name'],'resourceId':_0x531d93['id'],'type':_0x35786a[_0x90f5('0x29')],'sectionId':_0x35786a['id']},{})[_0x90f5('0x23')](function(){return _0x644df5;});}else{return _0x644df5;}})[_0x90f5('0x41')](function(_0x1729b4){logger[_0x90f5('0x27')](_0x90f5('0x55'),_0x1729b4);throw _0x1729b4;});}return _0x644df5;});}})[_0x90f5('0x23')](respondWithResult(_0x82fe1d,0xc9))[_0x90f5('0x41')](handleError(_0x82fe1d,null));};exports['update']=function(_0x1fa0a4,_0x3a3ef9){if(_0x1fa0a4[_0x90f5('0x48')]['id']){delete _0x1fa0a4[_0x90f5('0x48')]['id'];}return db['JscriptyProject'][_0x90f5('0x4e')]({'where':{'id':_0x1fa0a4[_0x90f5('0x43')]['id']}})[_0x90f5('0x23')](handleEntityNotFound(_0x3a3ef9,null))[_0x90f5('0x23')](saveUpdates(_0x1fa0a4['body'],null))[_0x90f5('0x23')](respondWithResult(_0x3a3ef9,null))[_0x90f5('0x41')](handleError(_0x3a3ef9,null));};exports['destroy']=function(_0x1ef9f2,_0x230088){return db[_0x90f5('0x3e')][_0x90f5('0x4e')]({'where':{'id':_0x1ef9f2['params']['id']}})['then'](handleEntityNotFound(_0x230088,null))['then'](removeEntity(_0x230088,null))['catch'](handleError(_0x230088,null));};exports[_0x90f5('0x56')]=function(_0x299304,_0x6c47ea,_0x3ac859){var _0x11fb76={'raw':!![],'where':{}};var _0x1b7176={};var _0x37d906={'count':0x0,'rows':[]};return db[_0x90f5('0x3e')][_0x90f5('0x57')]({'where':{'id':_0x299304[_0x90f5('0x43')]['id']}})[_0x90f5('0x23')](handleEntityNotFound(_0x6c47ea,null))[_0x90f5('0x23')](function(_0x40589a){if(_0x40589a){_0x1b7176['model']=_[_0x90f5('0x30')](db[_0x90f5('0x58')][_0x90f5('0x2c')]);_0x1b7176[_0x90f5('0x31')]=_[_0x90f5('0x30')](_0x299304['query']);_0x1b7176[_0x90f5('0x32')]=_['intersection'](_0x1b7176[_0x90f5('0x34')],_0x1b7176['query']);_0x11fb76[_0x90f5('0x35')]=_[_0x90f5('0x33')](_0x1b7176['model'],qs[_0x90f5('0x36')](_0x299304[_0x90f5('0x31')][_0x90f5('0x36')]));_0x11fb76['attributes']=_0x11fb76[_0x90f5('0x35')]['length']?_0x11fb76[_0x90f5('0x35')]:_0x1b7176[_0x90f5('0x34')];if(!_0x299304[_0x90f5('0x31')][_0x90f5('0x59')](_0x90f5('0x38'))){_0x11fb76[_0x90f5('0x1e')]=qs['limit'](_0x299304[_0x90f5('0x31')]['limit']);_0x11fb76['offset']=qs[_0x90f5('0x1d')](_0x299304[_0x90f5('0x31')][_0x90f5('0x1d')]);}_0x11fb76[_0x90f5('0x39')]=qs[_0x90f5('0x5a')](_0x299304[_0x90f5('0x31')][_0x90f5('0x5a')]);_0x11fb76['where']=qs[_0x90f5('0x32')](_[_0x90f5('0x5b')](_0x299304[_0x90f5('0x31')],_0x1b7176[_0x90f5('0x32')]));_0x11fb76['where']['ProjectId']=_0x40589a['id'];if(_0x299304[_0x90f5('0x31')][_0x90f5('0x3a')]){_0x11fb76[_0x90f5('0x3c')]=_[_0x90f5('0x3b')](_0x11fb76['where'],{'$or':_['map'](_0x11fb76[_0x90f5('0x35')],function(_0x9714c4){var _0x260afd={};_0x260afd[_0x9714c4]={'$like':'%'+_0x299304[_0x90f5('0x31')][_0x90f5('0x3a')]+'%'};return _0x260afd;})});}_0x11fb76=_[_0x90f5('0x3b')]({},_0x11fb76,_0x299304['options']);return db['JscriptySessionReport'][_0x90f5('0x1c')]({'where':_0x11fb76[_0x90f5('0x3c')]})[_0x90f5('0x23')](function(_0x4b04a1){_0x37d906['count']=_0x4b04a1;if(_0x299304[_0x90f5('0x31')]['includeAll']){_0x11fb76[_0x90f5('0x45')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x90f5('0x3f')](_0x11fb76);})[_0x90f5('0x23')](function(_0x597bb9){_0x37d906[_0x90f5('0x40')]=_0x597bb9;return _0x37d906;});}})[_0x90f5('0x23')](respondWithFilteredResult(_0x6c47ea,_0x11fb76))[_0x90f5('0x41')](handleError(_0x6c47ea,null));};exports[_0x90f5('0x5c')]=function(_0x5b0fef,_0x16b966,_0x5d72f3){var _0x12e37c={'raw':!![],'where':{}};var _0x2d00be={};var _0x2f1119={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x90f5('0x57')]({'where':{'id':_0x5b0fef[_0x90f5('0x43')]['id']}})[_0x90f5('0x23')](handleEntityNotFound(_0x16b966,null))[_0x90f5('0x23')](function(_0x2a1492){if(_0x2a1492){_0x2d00be[_0x90f5('0x34')]=_[_0x90f5('0x30')](db['JscriptyAnswerReport'][_0x90f5('0x2c')]);_0x2d00be[_0x90f5('0x31')]=_[_0x90f5('0x30')](_0x5b0fef['query']);_0x2d00be[_0x90f5('0x32')]=_[_0x90f5('0x33')](_0x2d00be[_0x90f5('0x34')],_0x2d00be[_0x90f5('0x31')]);_0x12e37c[_0x90f5('0x35')]=_[_0x90f5('0x33')](_0x2d00be[_0x90f5('0x34')],qs[_0x90f5('0x36')](_0x5b0fef[_0x90f5('0x31')][_0x90f5('0x36')]));_0x12e37c['attributes']=_0x12e37c[_0x90f5('0x35')][_0x90f5('0x37')]?_0x12e37c[_0x90f5('0x35')]:_0x2d00be[_0x90f5('0x34')];if(!_0x5b0fef[_0x90f5('0x31')][_0x90f5('0x59')](_0x90f5('0x38'))){_0x12e37c[_0x90f5('0x1e')]=qs[_0x90f5('0x1e')](_0x5b0fef[_0x90f5('0x31')][_0x90f5('0x1e')]);_0x12e37c[_0x90f5('0x1d')]=qs[_0x90f5('0x1d')](_0x5b0fef[_0x90f5('0x31')][_0x90f5('0x1d')]);}_0x12e37c[_0x90f5('0x39')]=qs[_0x90f5('0x5a')](_0x5b0fef[_0x90f5('0x31')][_0x90f5('0x5a')]);_0x12e37c[_0x90f5('0x3c')]=qs[_0x90f5('0x32')](_[_0x90f5('0x5b')](_0x5b0fef[_0x90f5('0x31')],_0x2d00be['filters']));_0x12e37c[_0x90f5('0x3c')]['ProjectId']=_0x2a1492['id'];if(_0x5b0fef[_0x90f5('0x31')][_0x90f5('0x3a')]){_0x12e37c['where']=_[_0x90f5('0x3b')](_0x12e37c[_0x90f5('0x3c')],{'$or':_[_0x90f5('0x2b')](_0x12e37c['attributes'],function(_0x3ea600){var _0x5a6017={};_0x5a6017[_0x3ea600]={'$like':'%'+_0x5b0fef[_0x90f5('0x31')][_0x90f5('0x3a')]+'%'};return _0x5a6017;})});}_0x12e37c=_[_0x90f5('0x3b')]({},_0x12e37c,_0x5b0fef[_0x90f5('0x46')]);return db[_0x90f5('0x5d')]['count']({'where':_0x12e37c['where']})[_0x90f5('0x23')](function(_0x260037){_0x2f1119[_0x90f5('0x1c')]=_0x260037;if(_0x5b0fef[_0x90f5('0x31')][_0x90f5('0x44')]){_0x12e37c[_0x90f5('0x45')]=[{'all':!![]}];}return db[_0x90f5('0x5d')][_0x90f5('0x3f')](_0x12e37c);})[_0x90f5('0x23')](function(_0x20184d){_0x2f1119[_0x90f5('0x40')]=_0x20184d;return _0x2f1119;});}})[_0x90f5('0x23')](respondWithFilteredResult(_0x16b966,_0x12e37c))[_0x90f5('0x41')](handleError(_0x16b966,null));};function char(_0x2d49b9){return _0x90f5('0x5e')===typeof _0x2d49b9?String['fromCharCode'][_0x90f5('0x20')](null,arguments):_0x2d49b9;}function needsEncapsulation(_0x19f633){return!!_0x19f633&&(_0x19f633[_0x90f5('0x5f')]()[_0x90f5('0x60')](char(0xd))>=0x0||_0x19f633['toString']()[_0x90f5('0x60')](char(0xa))>=0x0||_0x19f633[_0x90f5('0x5f')]()[_0x90f5('0x60')](char(0x2c))>=0x0||_0x19f633['toString']()[_0x90f5('0x60')](char(0x22))>=0x0);}function encapsulate(_0x34497e){var _0x24c9d8=char(0x22),_0x3dd947='\x5c'+char(0x22),_0x14c2f3=_0x34497e[_0x90f5('0x5f')]()['replace'](new RegExp(_0x24c9d8,'g'),_0x3dd947);return _0x24c9d8+_0x14c2f3+_0x24c9d8;}exports[_0x90f5('0x61')]=function(_0x5c47c5,_0x6eeea4,_0x3df13f){var _0x12a4e,_0x1ee8ee;var _0x1a6659={'where':{'ProjectId':_0x5c47c5[_0x90f5('0x43')]['id']}};if(_0x5c47c5[_0x90f5('0x31')][_0x90f5('0x62')]){_0x1a6659[_0x90f5('0x3c')][_0x90f5('0x63')]=JSON[_0x90f5('0x64')](_0x5c47c5[_0x90f5('0x31')][_0x90f5('0x62')]);}return db[_0x90f5('0x58')][_0x90f5('0x3f')](_0x1a6659)[_0x90f5('0x23')](handleEntityNotFound(_0x6eeea4,null))[_0x90f5('0x23')](function(_0x1f1721){if(_0x1f1721){_0x12a4e=_0x1f1721;return db['JscriptyQuestionReport'][_0x90f5('0x3f')]({'where':{'SessionId':{'$in':_['map'](_0x12a4e,'id')},'ProjectId':_0x5c47c5['params']['id']},'order':'-createdAt'});}})[_0x90f5('0x23')](handleEntityNotFound(_0x6eeea4,null))[_0x90f5('0x23')](function(_0xd87b66){if(_0xd87b66){_0x1ee8ee=_0xd87b66;var _0x4d95ac={};for(var _0x1bd2ae=0x0,_0x54f43b=_0x1ee8ee['length'];_0x1bd2ae<_0x54f43b;_0x1bd2ae++){if(!_0x4d95ac[_0x90f5('0x59')](_0x1ee8ee[_0x1bd2ae][_0x90f5('0x65')])){_0x4d95ac[_0x1ee8ee[_0x1bd2ae]['questionId']]=needsEncapsulation(_0x1ee8ee[_0x1bd2ae][_0x90f5('0x66')])?encapsulate(_0x1ee8ee[_0x1bd2ae][_0x90f5('0x66')]):_0x1ee8ee[_0x1bd2ae][_0x90f5('0x66')];}}var _0x23bfbc=[],_0x125bb7={};for(var _0x4b4331=0x0,_0x2fd380=_0x12a4e[_0x90f5('0x37')];_0x4b4331<_0x2fd380;_0x4b4331++){_0x125bb7={'ProjectId':_0x5c47c5[_0x90f5('0x43')]['id'],'SessionId':_0x12a4e[_0x4b4331]['id'],'StartTime':moment(_0x12a4e[_0x4b4331][_0x90f5('0x63')])[_0x90f5('0x67')](_0x90f5('0x68'))};for(var _0x3f554e=0x0,_0x5eb593=_0x1ee8ee[_0x90f5('0x37')];_0x3f554e<_0x5eb593;_0x3f554e++){if(_0x1ee8ee[_0x3f554e]['SessionId']==_0x12a4e[_0x4b4331]['id']&&_0x4d95ac[_0x90f5('0x59')](_0x1ee8ee[_0x3f554e][_0x90f5('0x65')])){_0x125bb7[_0x4d95ac[_0x1ee8ee[_0x3f554e][_0x90f5('0x65')]]]=_0x1ee8ee[_0x3f554e]['answer'];}}for(var _0x22af19 in _0x4d95ac){if(!_0x125bb7[_0x90f5('0x59')](_0x4d95ac[_0x22af19])){_0x125bb7[_0x4d95ac[_0x22af19]]=null;}}_0x23bfbc[_0x90f5('0x69')](_0x125bb7);}return _0x23bfbc;}})[_0x90f5('0x23')](function(_0x23a048){if(!_[_0x90f5('0x6a')](_0x23a048)){var _0x28c4cd=toCsv(_0x23a048);var _0x5b1c66=Date[_0x90f5('0x6b')]();fs['writeFileSync'](util[_0x90f5('0x67')](_0x90f5('0x6c'),_0x5c47c5['params']['id'],_0x5b1c66),_0x28c4cd);_0x6eeea4[_0x90f5('0x6d')](_0x90f5('0x6e'),'attachment;\x20filename='+util['format'](_0x90f5('0x6f'),_0x5c47c5[_0x90f5('0x43')]['id'],_0x5b1c66));_0x6eeea4['setHeader'](_0x90f5('0x70'),_0x90f5('0x71'));return _0x6eeea4[_0x90f5('0x72')](util[_0x90f5('0x67')](_0x90f5('0x6c'),_0x5c47c5['params']['id'],_0x5b1c66));}else{return _0x6eeea4[_0x90f5('0x73')](0xcc);}})[_0x90f5('0x41')](handleError(_0x6eeea4,null));}; \ No newline at end of file +var _0x93ab=['indexOf','replace','getSummary','startTime','JscriptyQuestionReport','-createdAt','questionId','question','SessionId','answer','isEmpty','now','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','download','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','sendStatus','status','json','count','offset','set','Content-Range','reject','save','then','destroy','Projects','error','name','send','index','map','JscriptyProject','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','getSessions','length','hasOwnProperty','ProjectId','JscriptySessionReport','getAnswers','findOne','JscriptyAnswerReport','nolimit','number','apply','toString'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x93ab,0x1e0));var _0xb93a=function(_0x187718,_0x427383){_0x187718=_0x187718-0x0;var _0x29ddf4=_0x93ab[_0x187718];return _0x29ddf4;};'use strict';var pdf=require(_0xb93a('0x0'));var emlformat=require(_0xb93a('0x1'));var rimraf=require(_0xb93a('0x2'));var zipdir=require(_0xb93a('0x3'));var jsonpatch=require(_0xb93a('0x4'));var rp=require(_0xb93a('0x5'));var moment=require(_0xb93a('0x6'));var BPromise=require(_0xb93a('0x7'));var Mustache=require(_0xb93a('0x8'));var util=require(_0xb93a('0x9'));var path=require(_0xb93a('0xa'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb93a('0xb'));var fs=require('fs');var _=require(_0xb93a('0xc'));var squel=require(_0xb93a('0xd'));var crypto=require(_0xb93a('0xe'));var jsforce=require(_0xb93a('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xb93a('0x10'));var querystring=require(_0xb93a('0x11'));var Papa=require(_0xb93a('0x12'));var Redis=require(_0xb93a('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb93a('0x14'));var hardwareService=require(_0xb93a('0x15'));var logger=require('../../config/logger')(_0xb93a('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23b09d,_0x4fbaae){_0x4fbaae=_0x4fbaae||0xcc;return function(_0x58c958){if(_0x58c958){return _0x23b09d[_0xb93a('0x17')](_0x4fbaae);}return _0x23b09d[_0xb93a('0x18')](_0x4fbaae)['end']();};}function respondWithResult(_0x51f7cc,_0x4346cf){_0x4346cf=_0x4346cf||0xc8;return function(_0x141598){if(_0x141598){return _0x51f7cc['status'](_0x4346cf)[_0xb93a('0x19')](_0x141598);}};}function respondWithFilteredResult(_0x65de63,_0x31579f){return function(_0x23abe9){if(_0x23abe9){var _0x282df5=_0x23abe9[_0xb93a('0x1a')],_0x450ae1=_0x31579f['offset'],_0x20237f=_0x31579f[_0xb93a('0x1b')]+_0x31579f['limit'],_0x507a00;if(_0x20237f>=_0x282df5){_0x20237f=_0x282df5;_0x507a00=0xc8;}else{_0x507a00=0xce;}_0x65de63[_0xb93a('0x18')](_0x507a00);return _0x65de63[_0xb93a('0x1c')](_0xb93a('0x1d'),_0x450ae1+'-'+_0x20237f+'/'+_0x282df5)[_0xb93a('0x19')](_0x23abe9);}return null;};}function patchUpdates(_0x32b7e6){return function(_0x147db7){try{jsonpatch['apply'](_0x147db7,_0x32b7e6,!![]);}catch(_0x24028a){return BPromise[_0xb93a('0x1e')](_0x24028a);}return _0x147db7[_0xb93a('0x1f')]();};}function saveUpdates(_0x2370da,_0x5e10ed){return function(_0x348efc){if(_0x348efc){return _0x348efc['update'](_0x2370da)[_0xb93a('0x20')](function(_0x19280f){return _0x19280f;});}return null;};}function removeEntity(_0x2fba62,_0x49541a){return function(_0x2e554e){if(_0x2e554e){return _0x2e554e[_0xb93a('0x21')]()[_0xb93a('0x20')](function(){var _0xe9cece=_0x2e554e['get']({'plain':!![]});var _0x36d035=_0xb93a('0x22');return db['UserProfileResource']['destroy']({'where':{'type':_0x36d035,'resourceId':_0xe9cece['id']}})[_0xb93a('0x20')](function(){return _0x2e554e;});})[_0xb93a('0x20')](function(){_0x2fba62[_0xb93a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf02cb7,_0x24604c){return function(_0x5a3cb6){if(!_0x5a3cb6){_0xf02cb7['sendStatus'](0x194);}return _0x5a3cb6;};}function handleError(_0x13873f,_0xf990d5){_0xf990d5=_0xf990d5||0x1f4;return function(_0x5bbfad){logger[_0xb93a('0x23')](_0x5bbfad['stack']);if(_0x5bbfad[_0xb93a('0x24')]){delete _0x5bbfad[_0xb93a('0x24')];}_0x13873f[_0xb93a('0x18')](_0xf990d5)[_0xb93a('0x25')](_0x5bbfad);};}exports[_0xb93a('0x26')]=function(_0x226bde,_0x3410ee){var _0x310b17={},_0xbb977d={},_0x133874={'count':0x0,'rows':[]};var _0x5275ae=_[_0xb93a('0x27')](db[_0xb93a('0x28')][_0xb93a('0x29')],function(_0x4fd571){return{'name':_0x4fd571[_0xb93a('0x2a')],'type':_0x4fd571['type'][_0xb93a('0x2b')]};});_0xbb977d[_0xb93a('0x2c')]=_[_0xb93a('0x27')](_0x5275ae,_0xb93a('0x24'));_0xbb977d[_0xb93a('0x2d')]=_[_0xb93a('0x2e')](_0x226bde[_0xb93a('0x2d')]);_0xbb977d[_0xb93a('0x2f')]=_['intersection'](_0xbb977d['model'],_0xbb977d[_0xb93a('0x2d')]);_0x310b17[_0xb93a('0x30')]=_[_0xb93a('0x31')](_0xbb977d[_0xb93a('0x2c')],qs['fields'](_0x226bde['query'][_0xb93a('0x32')]));_0x310b17[_0xb93a('0x30')]=_0x310b17[_0xb93a('0x30')]['length']?_0x310b17[_0xb93a('0x30')]:_0xbb977d[_0xb93a('0x2c')];if(!_0x226bde[_0xb93a('0x2d')]['hasOwnProperty']('nolimit')){_0x310b17[_0xb93a('0x33')]=qs['limit'](_0x226bde['query']['limit']);_0x310b17[_0xb93a('0x1b')]=qs[_0xb93a('0x1b')](_0x226bde[_0xb93a('0x2d')]['offset']);}_0x310b17[_0xb93a('0x34')]=qs[_0xb93a('0x35')](_0x226bde[_0xb93a('0x2d')]['sort']);_0x310b17['where']=qs[_0xb93a('0x2f')](_[_0xb93a('0x36')](_0x226bde['query'],_0xbb977d['filters']));if(_0x226bde[_0xb93a('0x2d')][_0xb93a('0x37')]){_0x310b17[_0xb93a('0x38')]=_[_0xb93a('0x39')](_0x310b17[_0xb93a('0x38')],{'$or':_[_0xb93a('0x27')](_0x5275ae,function(_0x33716e){if(_0x33716e['type']!==_0xb93a('0x3a')){var _0x39190d={};_0x39190d[_0x33716e[_0xb93a('0x24')]]={'$like':'%'+_0x226bde[_0xb93a('0x2d')]['filter']+'%'};return _0x39190d;}})});}_0x310b17=_[_0xb93a('0x39')]({},_0x310b17,_0x226bde[_0xb93a('0x3b')]);var _0x1f4488={'where':_0x310b17['where']};return db[_0xb93a('0x28')]['count'](_0x1f4488)[_0xb93a('0x20')](function(_0x565f8b){_0x133874['count']=_0x565f8b;if(_0x226bde[_0xb93a('0x2d')]['includeAll']){_0x310b17['include']=[{'all':!![]}];}return db[_0xb93a('0x28')][_0xb93a('0x3c')](_0x310b17);})[_0xb93a('0x20')](function(_0x32fdeb){_0x133874[_0xb93a('0x3d')]=_0x32fdeb;return _0x133874;})[_0xb93a('0x20')](respondWithFilteredResult(_0x3410ee,_0x310b17))[_0xb93a('0x3e')](handleError(_0x3410ee,null));};exports[_0xb93a('0x3f')]=function(_0x562041,_0xa011db){var _0x922c68={'raw':![],'where':{'id':_0x562041[_0xb93a('0x40')]['id']}},_0x252f88={};_0x252f88['model']=_[_0xb93a('0x2e')](db[_0xb93a('0x28')][_0xb93a('0x29')]);_0x252f88[_0xb93a('0x2d')]=_[_0xb93a('0x2e')](_0x562041['query']);_0x252f88[_0xb93a('0x2f')]=_[_0xb93a('0x31')](_0x252f88[_0xb93a('0x2c')],_0x252f88[_0xb93a('0x2d')]);_0x922c68[_0xb93a('0x30')]=_[_0xb93a('0x31')](_0x252f88[_0xb93a('0x2c')],qs[_0xb93a('0x32')](_0x562041[_0xb93a('0x2d')][_0xb93a('0x32')]));_0x922c68[_0xb93a('0x30')]=_0x922c68[_0xb93a('0x30')]['length']?_0x922c68['attributes']:_0x252f88['model'];if(_0x562041[_0xb93a('0x2d')][_0xb93a('0x41')]){_0x922c68[_0xb93a('0x42')]=[{'all':!![]}];}_0x922c68=_[_0xb93a('0x39')]({},_0x922c68,_0x562041[_0xb93a('0x3b')]);return db[_0xb93a('0x28')][_0xb93a('0x43')](_0x922c68)[_0xb93a('0x20')](handleEntityNotFound(_0xa011db,null))[_0xb93a('0x20')](respondWithResult(_0xa011db,null))['catch'](handleError(_0xa011db,null));};exports[_0xb93a('0x44')]=function(_0xcd5ca3,_0x3eedfb){return db['JscriptyProject']['create'](_0xcd5ca3[_0xb93a('0x45')],{})[_0xb93a('0x20')](function(_0x47a06b){var _0x1b8290=_0xcd5ca3[_0xb93a('0x46')][_0xb93a('0x47')]({'plain':!![]});if(!_0x1b8290)throw new Error(_0xb93a('0x48'));if(_0x1b8290[_0xb93a('0x49')]===_0xb93a('0x46')){var _0xed8709=_0x47a06b[_0xb93a('0x47')]({'plain':!![]});var _0x425cc6=_0xb93a('0x22');return db[_0xb93a('0x4a')][_0xb93a('0x43')]({'where':{'name':_0x425cc6,'userProfileId':_0x1b8290[_0xb93a('0x4b')]},'raw':!![]})['then'](function(_0x3275c3){if(_0x3275c3&&_0x3275c3[_0xb93a('0x4c')]===0x0){return db[_0xb93a('0x4d')][_0xb93a('0x44')]({'name':_0xed8709[_0xb93a('0x24')],'resourceId':_0xed8709['id'],'type':_0x3275c3[_0xb93a('0x24')],'sectionId':_0x3275c3['id']},{})[_0xb93a('0x20')](function(){return _0x47a06b;});}else{return _0x47a06b;}})['catch'](function(_0x4f09aa){logger[_0xb93a('0x23')](_0xb93a('0x4e'),_0x4f09aa);throw _0x4f09aa;});}return _0x47a06b;})[_0xb93a('0x20')](respondWithResult(_0x3eedfb,0xc9))[_0xb93a('0x3e')](handleError(_0x3eedfb,null));};exports[_0xb93a('0x4f')]=function(_0x18086c,_0x32308d){var _0x3e21a2={'where':{'id':_0x18086c[_0xb93a('0x40')]['id']}},_0x172a5c={};_0x172a5c['model']=_[_0xb93a('0x2e')](db[_0xb93a('0x28')][_0xb93a('0x29')]);_0x3e21a2[_0xb93a('0x30')]=_[_0xb93a('0x31')](_0x172a5c[_0xb93a('0x2c')],qs[_0xb93a('0x32')](_0x18086c['query'][_0xb93a('0x32')]));_0x3e21a2['attributes']=_0x3e21a2[_0xb93a('0x30')]['length']?_0x3e21a2[_0xb93a('0x30')]:_0x172a5c[_0xb93a('0x2c')];if(_0x18086c[_0xb93a('0x2d')]['includeAll']){_0x3e21a2[_0xb93a('0x42')]=[{'all':!![]}];}_0x3e21a2=_[_0xb93a('0x39')]({},_0x3e21a2,_0x18086c['options']);return db[_0xb93a('0x28')][_0xb93a('0x43')](_0x3e21a2)[_0xb93a('0x20')](handleEntityNotFound(_0x32308d,null))[_0xb93a('0x20')](function(_0x2679bb){if(_0x2679bb){var _0x4f07e9=_0x2679bb['get']({'plain':!![]});_0x4f07e9=qs[_0xb93a('0x50')](_0x4f07e9,['id','createdAt',_0xb93a('0x51')]);_0x18086c[_0xb93a('0x45')]=_[_0xb93a('0x50')](_0x18086c[_0xb93a('0x45')],['id',_0xb93a('0x52'),_0xb93a('0x51')]);return db[_0xb93a('0x28')][_0xb93a('0x44')](_['merge'](_0x4f07e9,_0x18086c['body']),{'include':_0x18086c[_0xb93a('0x2d')][_0xb93a('0x41')]?[{'all':!![]}]:undefined})[_0xb93a('0x20')](function(_0x3174ed){var _0x153e7c=_0x18086c[_0xb93a('0x46')][_0xb93a('0x47')]({'plain':!![]});if(!_0x153e7c)throw new Error(_0xb93a('0x48'));if(_0x153e7c[_0xb93a('0x49')]===_0xb93a('0x46')){var _0x4c5758=_0x3174ed[_0xb93a('0x47')]({'plain':!![]});var _0xdb60ed=_0xb93a('0x22');return db['UserProfileSection']['find']({'where':{'name':_0xdb60ed,'userProfileId':_0x153e7c[_0xb93a('0x4b')]},'raw':!![]})[_0xb93a('0x20')](function(_0x18dff2){if(_0x18dff2&&_0x18dff2['autoAssociation']===0x0){return db['UserProfileResource'][_0xb93a('0x44')]({'name':_0x4c5758[_0xb93a('0x24')],'resourceId':_0x4c5758['id'],'type':_0x18dff2[_0xb93a('0x24')],'sectionId':_0x18dff2['id']},{})[_0xb93a('0x20')](function(){return _0x3174ed;});}else{return _0x3174ed;}})[_0xb93a('0x3e')](function(_0xebedf8){logger[_0xb93a('0x23')](_0xb93a('0x4e'),_0xebedf8);throw _0xebedf8;});}return _0x3174ed;});}})['then'](respondWithResult(_0x32308d,0xc9))[_0xb93a('0x3e')](handleError(_0x32308d,null));};exports['update']=function(_0x4b72ad,_0x5d19f6){if(_0x4b72ad['body']['id']){delete _0x4b72ad[_0xb93a('0x45')]['id'];}return db[_0xb93a('0x28')][_0xb93a('0x43')]({'where':{'id':_0x4b72ad['params']['id']}})[_0xb93a('0x20')](handleEntityNotFound(_0x5d19f6,null))[_0xb93a('0x20')](saveUpdates(_0x4b72ad[_0xb93a('0x45')],null))['then'](respondWithResult(_0x5d19f6,null))[_0xb93a('0x3e')](handleError(_0x5d19f6,null));};exports['destroy']=function(_0x1b540d,_0x51032e){return db[_0xb93a('0x28')][_0xb93a('0x43')]({'where':{'id':_0x1b540d[_0xb93a('0x40')]['id']}})['then'](handleEntityNotFound(_0x51032e,null))[_0xb93a('0x20')](removeEntity(_0x51032e,null))[_0xb93a('0x3e')](handleError(_0x51032e,null));};exports[_0xb93a('0x53')]=function(_0x42bf72,_0x172c83,_0x1c5bf0){var _0x106443={'raw':!![],'where':{}};var _0xd0250b={};var _0x175ea6={'count':0x0,'rows':[]};return db[_0xb93a('0x28')]['findOne']({'where':{'id':_0x42bf72[_0xb93a('0x40')]['id']}})['then'](handleEntityNotFound(_0x172c83,null))['then'](function(_0x2d8e2a){if(_0x2d8e2a){_0xd0250b[_0xb93a('0x2c')]=_[_0xb93a('0x2e')](db['JscriptySessionReport']['rawAttributes']);_0xd0250b[_0xb93a('0x2d')]=_[_0xb93a('0x2e')](_0x42bf72['query']);_0xd0250b[_0xb93a('0x2f')]=_[_0xb93a('0x31')](_0xd0250b['model'],_0xd0250b['query']);_0x106443[_0xb93a('0x30')]=_[_0xb93a('0x31')](_0xd0250b[_0xb93a('0x2c')],qs[_0xb93a('0x32')](_0x42bf72[_0xb93a('0x2d')]['fields']));_0x106443['attributes']=_0x106443[_0xb93a('0x30')][_0xb93a('0x54')]?_0x106443[_0xb93a('0x30')]:_0xd0250b['model'];if(!_0x42bf72[_0xb93a('0x2d')][_0xb93a('0x55')]('nolimit')){_0x106443[_0xb93a('0x33')]=qs[_0xb93a('0x33')](_0x42bf72[_0xb93a('0x2d')][_0xb93a('0x33')]);_0x106443[_0xb93a('0x1b')]=qs['offset'](_0x42bf72[_0xb93a('0x2d')][_0xb93a('0x1b')]);}_0x106443[_0xb93a('0x34')]=qs['sort'](_0x42bf72[_0xb93a('0x2d')]['sort']);_0x106443[_0xb93a('0x38')]=qs['filters'](_[_0xb93a('0x36')](_0x42bf72[_0xb93a('0x2d')],_0xd0250b[_0xb93a('0x2f')]));_0x106443[_0xb93a('0x38')][_0xb93a('0x56')]=_0x2d8e2a['id'];if(_0x42bf72[_0xb93a('0x2d')][_0xb93a('0x37')]){_0x106443[_0xb93a('0x38')]=_[_0xb93a('0x39')](_0x106443[_0xb93a('0x38')],{'$or':_[_0xb93a('0x27')](_0x106443['attributes'],function(_0x26c019){var _0x21e50a={};_0x21e50a[_0x26c019]={'$like':'%'+_0x42bf72['query']['filter']+'%'};return _0x21e50a;})});}_0x106443=_['merge']({},_0x106443,_0x42bf72[_0xb93a('0x3b')]);return db[_0xb93a('0x57')][_0xb93a('0x1a')]({'where':_0x106443[_0xb93a('0x38')]})[_0xb93a('0x20')](function(_0x59b28e){_0x175ea6['count']=_0x59b28e;if(_0x42bf72[_0xb93a('0x2d')][_0xb93a('0x41')]){_0x106443[_0xb93a('0x42')]=[{'all':!![]}];}return db[_0xb93a('0x57')][_0xb93a('0x3c')](_0x106443);})[_0xb93a('0x20')](function(_0x1e2a14){_0x175ea6[_0xb93a('0x3d')]=_0x1e2a14;return _0x175ea6;});}})[_0xb93a('0x20')](respondWithFilteredResult(_0x172c83,_0x106443))[_0xb93a('0x3e')](handleError(_0x172c83,null));};exports[_0xb93a('0x58')]=function(_0x42e305,_0x42e443,_0x56b1fe){var _0xfc85be={'raw':!![],'where':{}};var _0xcf6875={};var _0x4f4148={'count':0x0,'rows':[]};return db[_0xb93a('0x28')][_0xb93a('0x59')]({'where':{'id':_0x42e305[_0xb93a('0x40')]['id']}})['then'](handleEntityNotFound(_0x42e443,null))[_0xb93a('0x20')](function(_0x5ce2a1){if(_0x5ce2a1){_0xcf6875['model']=_[_0xb93a('0x2e')](db[_0xb93a('0x5a')]['rawAttributes']);_0xcf6875[_0xb93a('0x2d')]=_[_0xb93a('0x2e')](_0x42e305[_0xb93a('0x2d')]);_0xcf6875[_0xb93a('0x2f')]=_[_0xb93a('0x31')](_0xcf6875[_0xb93a('0x2c')],_0xcf6875['query']);_0xfc85be['attributes']=_['intersection'](_0xcf6875[_0xb93a('0x2c')],qs[_0xb93a('0x32')](_0x42e305['query'][_0xb93a('0x32')]));_0xfc85be['attributes']=_0xfc85be[_0xb93a('0x30')][_0xb93a('0x54')]?_0xfc85be[_0xb93a('0x30')]:_0xcf6875[_0xb93a('0x2c')];if(!_0x42e305[_0xb93a('0x2d')][_0xb93a('0x55')](_0xb93a('0x5b'))){_0xfc85be[_0xb93a('0x33')]=qs[_0xb93a('0x33')](_0x42e305['query'][_0xb93a('0x33')]);_0xfc85be[_0xb93a('0x1b')]=qs[_0xb93a('0x1b')](_0x42e305['query'][_0xb93a('0x1b')]);}_0xfc85be[_0xb93a('0x34')]=qs['sort'](_0x42e305[_0xb93a('0x2d')][_0xb93a('0x35')]);_0xfc85be[_0xb93a('0x38')]=qs[_0xb93a('0x2f')](_[_0xb93a('0x36')](_0x42e305[_0xb93a('0x2d')],_0xcf6875[_0xb93a('0x2f')]));_0xfc85be[_0xb93a('0x38')][_0xb93a('0x56')]=_0x5ce2a1['id'];if(_0x42e305['query'][_0xb93a('0x37')]){_0xfc85be[_0xb93a('0x38')]=_[_0xb93a('0x39')](_0xfc85be[_0xb93a('0x38')],{'$or':_[_0xb93a('0x27')](_0xfc85be[_0xb93a('0x30')],function(_0x84cd88){var _0x456cdc={};_0x456cdc[_0x84cd88]={'$like':'%'+_0x42e305['query'][_0xb93a('0x37')]+'%'};return _0x456cdc;})});}_0xfc85be=_[_0xb93a('0x39')]({},_0xfc85be,_0x42e305['options']);return db['JscriptyAnswerReport'][_0xb93a('0x1a')]({'where':_0xfc85be[_0xb93a('0x38')]})['then'](function(_0xfdaf38){_0x4f4148[_0xb93a('0x1a')]=_0xfdaf38;if(_0x42e305[_0xb93a('0x2d')][_0xb93a('0x41')]){_0xfc85be[_0xb93a('0x42')]=[{'all':!![]}];}return db[_0xb93a('0x5a')][_0xb93a('0x3c')](_0xfc85be);})[_0xb93a('0x20')](function(_0x592f03){_0x4f4148[_0xb93a('0x3d')]=_0x592f03;return _0x4f4148;});}})[_0xb93a('0x20')](respondWithFilteredResult(_0x42e443,_0xfc85be))[_0xb93a('0x3e')](handleError(_0x42e443,null));};function char(_0x37a2a2){return _0xb93a('0x5c')===typeof _0x37a2a2?String['fromCharCode'][_0xb93a('0x5d')](null,arguments):_0x37a2a2;}function needsEncapsulation(_0x763c3e){return!!_0x763c3e&&(_0x763c3e[_0xb93a('0x5e')]()['indexOf'](char(0xd))>=0x0||_0x763c3e[_0xb93a('0x5e')]()[_0xb93a('0x5f')](char(0xa))>=0x0||_0x763c3e[_0xb93a('0x5e')]()[_0xb93a('0x5f')](char(0x2c))>=0x0||_0x763c3e['toString']()[_0xb93a('0x5f')](char(0x22))>=0x0);}function encapsulate(_0x270c04){var _0x3217eb=char(0x22),_0x4af10a='\x5c'+char(0x22),_0x12239f=_0x270c04[_0xb93a('0x5e')]()[_0xb93a('0x60')](new RegExp(_0x3217eb,'g'),_0x4af10a);return _0x3217eb+_0x12239f+_0x3217eb;}exports[_0xb93a('0x61')]=function(_0x3a1202,_0x2c46b5,_0x252278){var _0x5097ca,_0x79796;var _0x106689={'where':{'ProjectId':_0x3a1202[_0xb93a('0x40')]['id']}};if(_0x3a1202['query'][_0xb93a('0x62')]){_0x106689[_0xb93a('0x38')]['starttime']=JSON['parse'](_0x3a1202[_0xb93a('0x2d')]['startTime']);}return db[_0xb93a('0x57')][_0xb93a('0x3c')](_0x106689)[_0xb93a('0x20')](handleEntityNotFound(_0x2c46b5,null))['then'](function(_0x683372){if(_0x683372){_0x5097ca=_0x683372;return db[_0xb93a('0x63')][_0xb93a('0x3c')]({'where':{'SessionId':{'$in':_[_0xb93a('0x27')](_0x5097ca,'id')},'ProjectId':_0x3a1202[_0xb93a('0x40')]['id']},'order':_0xb93a('0x64')});}})[_0xb93a('0x20')](handleEntityNotFound(_0x2c46b5,null))[_0xb93a('0x20')](function(_0x1969e7){if(_0x1969e7){_0x79796=_0x1969e7;var _0x408af6={};for(var _0x58a0d7=0x0,_0x1d0842=_0x79796['length'];_0x58a0d7<_0x1d0842;_0x58a0d7++){if(!_0x408af6[_0xb93a('0x55')](_0x79796[_0x58a0d7][_0xb93a('0x65')])){_0x408af6[_0x79796[_0x58a0d7][_0xb93a('0x65')]]=needsEncapsulation(_0x79796[_0x58a0d7][_0xb93a('0x66')])?encapsulate(_0x79796[_0x58a0d7]['question']):_0x79796[_0x58a0d7]['question'];}}var _0x5e473e=[],_0x239ca0={};for(var _0x12bb32=0x0,_0x349809=_0x5097ca[_0xb93a('0x54')];_0x12bb32<_0x349809;_0x12bb32++){_0x239ca0={'ProjectId':_0x3a1202['params']['id'],'SessionId':_0x5097ca[_0x12bb32]['id'],'StartTime':moment(_0x5097ca[_0x12bb32]['starttime'])['format']('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x3a86ee=0x0,_0x4d2cc6=_0x79796['length'];_0x3a86ee<_0x4d2cc6;_0x3a86ee++){if(_0x79796[_0x3a86ee][_0xb93a('0x67')]==_0x5097ca[_0x12bb32]['id']&&_0x408af6[_0xb93a('0x55')](_0x79796[_0x3a86ee][_0xb93a('0x65')])){_0x239ca0[_0x408af6[_0x79796[_0x3a86ee][_0xb93a('0x65')]]]=_0x79796[_0x3a86ee][_0xb93a('0x68')];}}for(var _0x468557 in _0x408af6){if(!_0x239ca0[_0xb93a('0x55')](_0x408af6[_0x468557])){_0x239ca0[_0x408af6[_0x468557]]=null;}}_0x5e473e['push'](_0x239ca0);}return _0x5e473e;}})[_0xb93a('0x20')](function(_0x170cd9){if(!_[_0xb93a('0x69')](_0x170cd9)){var _0x53971e=toCsv(_0x170cd9);var _0x4b657c=Date[_0xb93a('0x6a')]();fs[_0xb93a('0x6b')](util[_0xb93a('0x6c')](_0xb93a('0x6d'),_0x3a1202[_0xb93a('0x40')]['id'],_0x4b657c),_0x53971e);_0x2c46b5[_0xb93a('0x6e')](_0xb93a('0x6f'),_0xb93a('0x70')+util[_0xb93a('0x6c')]('Jscripty_Project_%d_Summary_%s.csv',_0x3a1202[_0xb93a('0x40')]['id'],_0x4b657c));_0x2c46b5['setHeader'](_0xb93a('0x71'),'text/csv');return _0x2c46b5[_0xb93a('0x72')](util[_0xb93a('0x6c')](_0xb93a('0x6d'),_0x3a1202[_0xb93a('0x40')]['id'],_0x4b657c));}else{return _0x2c46b5[_0xb93a('0x17')](0xcc);}})[_0xb93a('0x3e')](handleError(_0x2c46b5,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index f6f5f92..993e19c 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 _0xc81a=['exports','define','JscriptyProject','lodash','util','../../config/logger','moment','request-promise','path','./jscriptyProject.attributes'];(function(_0x4d7f64,_0x53bf11){var _0x408104=function(_0x5b2041){while(--_0x5b2041){_0x4d7f64['push'](_0x4d7f64['shift']());}};_0x408104(++_0x53bf11);}(_0xc81a,0x16b));var _0xac81=function(_0x453b59,_0x317051){_0x453b59=_0x453b59-0x0;var _0x1407a8=_0xc81a[_0x453b59];return _0x1407a8;};'use strict';var _=require(_0xac81('0x0'));var util=require(_0xac81('0x1'));var logger=require(_0xac81('0x2'))('api');var moment=require(_0xac81('0x3'));var BPromise=require('bluebird');var rp=require(_0xac81('0x4'));var fs=require('fs');var path=require(_0xac81('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xac81('0x6'));module[_0xac81('0x7')]=function(_0x228469,_0x21bb17){return _0x228469[_0xac81('0x8')](_0xac81('0x9'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x52b8=['rimraf','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','moment','bluebird'];(function(_0x547ea1,_0x2b5245){var _0x483330=function(_0x21b796){while(--_0x21b796){_0x547ea1['push'](_0x547ea1['shift']());}};_0x483330(++_0x2b5245);}(_0x52b8,0xd7));var _0x852b=function(_0x380ca9,_0x27db03){_0x380ca9=_0x380ca9-0x0;var _0xfc8089=_0x52b8[_0x380ca9];return _0xfc8089;};'use strict';var _=require(_0x852b('0x0'));var util=require(_0x852b('0x1'));var logger=require(_0x852b('0x2'))('api');var moment=require(_0x852b('0x3'));var BPromise=require(_0x852b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x852b('0x5'));var config=require('../../config/environment');var attributes=require(_0x852b('0x6'));module[_0x852b('0x7')]=function(_0x39ee07,_0x1ebf77){return _0x39ee07[_0x852b('0x8')](_0x852b('0x9'),attributes,{'tableName':_0x852b('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 1cfaef1..245f5be 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 _0xd629=['request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','JscriptyProject,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x950bab,_0x16680b){var _0x54414c=function(_0x4ab089){while(--_0x4ab089){_0x950bab['push'](_0x950bab['shift']());}};_0x54414c(++_0x16680b);}(_0xd629,0x1d9));var _0x9d62=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xd629[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x9d62('0x0'));var util=require(_0x9d62('0x1'));var moment=require(_0x9d62('0x2'));var BPromise=require(_0x9d62('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9d62('0x4'))['db'];var utils=require(_0x9d62('0x5'));var logger=require(_0x9d62('0x6'))('rpc');var config=require(_0x9d62('0x7'));var jayson=require(_0x9d62('0x8'));var client=jayson['client'][_0x9d62('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c2f36,_0x548443,_0x585b22){return new BPromise(function(_0x3fe60b,_0x46be63){return client[_0x9d62('0xa')](_0x1c2f36,_0x585b22)[_0x9d62('0xb')](function(_0x26df29){logger[_0x9d62('0xc')](_0x9d62('0xd'),_0x548443,_0x9d62('0xe'));logger['debug'](_0x9d62('0xf'),_0x548443,_0x9d62('0xe'),JSON['stringify'](_0x26df29));if(_0x26df29['error']){if(_0x26df29[_0x9d62('0x10')][_0x9d62('0x11')]===0x1f4){logger['error'](_0x9d62('0xd'),_0x548443,_0x26df29['error'][_0x9d62('0x12')]);return _0x46be63(_0x26df29[_0x9d62('0x10')][_0x9d62('0x12')]);}logger[_0x9d62('0x10')](_0x9d62('0xd'),_0x548443,_0x26df29[_0x9d62('0x10')][_0x9d62('0x12')]);return _0x3fe60b(_0x26df29[_0x9d62('0x10')]['message']);}else{logger[_0x9d62('0xc')](_0x9d62('0xd'),_0x548443,_0x9d62('0xe'));_0x3fe60b(_0x26df29[_0x9d62('0x13')][_0x9d62('0x12')]);}})[_0x9d62('0x14')](function(_0x2d0820){logger['error'](_0x9d62('0xd'),_0x548443,_0x2d0820);_0x46be63(_0x2d0820);});});} \ No newline at end of file +var _0x229d=['then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request'];(function(_0xf73c09,_0x4e424e){var _0xa8923c=function(_0x4831c1){while(--_0x4831c1){_0xf73c09['push'](_0xf73c09['shift']());}};_0xa8923c(++_0x4e424e);}(_0x229d,0x1ca));var _0xd229=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x229d[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0xd229('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd229('0x1'));var rs=require(_0xd229('0x2'));var fs=require('fs');var Redis=require(_0xd229('0x3'));var db=require(_0xd229('0x4'))['db'];var utils=require(_0xd229('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xd229('0x6'));var jayson=require(_0xd229('0x7'));var client=jayson[_0xd229('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x155c11,_0x3de536,_0x42fd7e){return new BPromise(function(_0x4be1da,_0x15efa8){return client[_0xd229('0x9')](_0x155c11,_0x42fd7e)[_0xd229('0xa')](function(_0x2b721a){logger[_0xd229('0xb')](_0xd229('0xc'),_0x3de536,_0xd229('0xd'));logger[_0xd229('0xe')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x3de536,_0xd229('0xd'),JSON['stringify'](_0x2b721a));if(_0x2b721a[_0xd229('0xf')]){if(_0x2b721a['error']['code']===0x1f4){logger['error'](_0xd229('0xc'),_0x3de536,_0x2b721a[_0xd229('0xf')]['message']);return _0x15efa8(_0x2b721a[_0xd229('0xf')][_0xd229('0x10')]);}logger[_0xd229('0xf')](_0xd229('0xc'),_0x3de536,_0x2b721a[_0xd229('0xf')][_0xd229('0x10')]);return _0x4be1da(_0x2b721a[_0xd229('0xf')][_0xd229('0x10')]);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x3de536,_0xd229('0xd'));_0x4be1da(_0x2b721a['result'][_0xd229('0x10')]);}})[_0xd229('0x11')](function(_0x2daf62){logger[_0xd229('0xf')](_0xd229('0xc'),_0x3de536,_0x2daf62);_0x15efa8(_0x2daf62);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index bd03da5..2efdbf0 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 _0x0826=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','create'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0826,0x1a1));var _0x6082=function(_0x5a17b1,_0x1aa5ca){_0x5a17b1=_0x5a17b1-0x0;var _0x555f48=_0x0826[_0x5a17b1];return _0x555f48;};'use strict';var multer=require(_0x6082('0x0'));var util=require(_0x6082('0x1'));var path=require(_0x6082('0x2'));var timeout=require(_0x6082('0x3'));var express=require(_0x6082('0x4'));var router=express[_0x6082('0x5')]();var auth=require(_0x6082('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6082('0x7'));var controller=require('./jscriptyQuestionReport.controller');router[_0x6082('0x8')]('/',auth[_0x6082('0x9')](),controller['index']);router[_0x6082('0x8')](_0x6082('0xa'),auth[_0x6082('0x9')](),controller[_0x6082('0xb')]);router[_0x6082('0x8')](_0x6082('0xc'),auth[_0x6082('0x9')](),controller[_0x6082('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6082('0xe')]);router['put'](_0x6082('0xc'),auth[_0x6082('0x9')](),controller[_0x6082('0xf')]);router['delete'](_0x6082('0xc'),auth['isAuthenticated'](),controller[_0x6082('0x10')]);module[_0x6082('0x11')]=router; \ No newline at end of file +var _0x57df=['exports','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','update','delete','destroy'];(function(_0xce2001,_0x53564f){var _0x439820=function(_0x22cfef){while(--_0x22cfef){_0xce2001['push'](_0xce2001['shift']());}};_0x439820(++_0x53564f);}(_0x57df,0x99));var _0xf57d=function(_0x35a11e,_0xb2f21c){_0x35a11e=_0x35a11e-0x0;var _0x175f9b=_0x57df[_0x35a11e];return _0x175f9b;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xf57d('0x0'));var express=require(_0xf57d('0x1'));var router=express['Router']();var auth=require(_0xf57d('0x2'));var interaction=require(_0xf57d('0x3'));var config=require(_0xf57d('0x4'));var controller=require(_0xf57d('0x5'));router[_0xf57d('0x6')]('/',auth[_0xf57d('0x7')](),controller[_0xf57d('0x8')]);router['get'](_0xf57d('0x9'),auth['isAuthenticated'](),controller[_0xf57d('0xa')]);router[_0xf57d('0x6')]('/:id',auth[_0xf57d('0x7')](),controller[_0xf57d('0xb')]);router[_0xf57d('0xc')]('/',auth['isAuthenticated'](),controller[_0xf57d('0xd')]);router[_0xf57d('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xf57d('0xf')]);router[_0xf57d('0x10')]('/:id',auth[_0xf57d('0x7')](),controller[_0xf57d('0x11')]);module[_0xf57d('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 7010340..917698d 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 _0xa0e5=['TEXT','long','exports','STRING'];(function(_0xd6ce50,_0xb01a32){var _0x58c2e7=function(_0x13f266){while(--_0x13f266){_0xd6ce50['push'](_0xd6ce50['shift']());}};_0x58c2e7(++_0xb01a32);}(_0xa0e5,0x1b6));var _0x5a0e=function(_0x2072b2,_0x2e2b37){_0x2072b2=_0x2072b2-0x0;var _0x5ab501=_0xa0e5[_0x2072b2];return _0x5ab501;};'use strict';var Sequelize=require('sequelize');module[_0x5a0e('0x0')]={'question':{'type':Sequelize[_0x5a0e('0x1')]},'answer':{'type':Sequelize[_0x5a0e('0x2')](_0x5a0e('0x3'))},'membername':{'type':Sequelize[_0x5a0e('0x1')]},'projectname':{'type':Sequelize[_0x5a0e('0x1')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x5a0e('0x1')]},'calleridname':{'type':Sequelize[_0x5a0e('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize[_0x5a0e('0x1')]}}; \ No newline at end of file +var _0xe986=['exports','TEXT','long','STRING'];(function(_0x282483,_0x59ee19){var _0x5d1b1f=function(_0x52bf16){while(--_0x52bf16){_0x282483['push'](_0x282483['shift']());}};_0x5d1b1f(++_0x59ee19);}(_0xe986,0x9c));var _0x6e98=function(_0x319209,_0x4907a3){_0x319209=_0x319209-0x0;var _0x2000c7=_0xe986[_0x319209];return _0x2000c7;};'use strict';var Sequelize=require('sequelize');module[_0x6e98('0x0')]={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize[_0x6e98('0x1')](_0x6e98('0x2'))},'membername':{'type':Sequelize[_0x6e98('0x3')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x6e98('0x3')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x6e98('0x3')]},'questionId':{'type':Sequelize[_0x6e98('0x3')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 32cf14e..6d90f7d 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 _0x221b=['error','stack','name','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','include','rows','catch','show','params','options','create','update','body','find','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','path','sox','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy'];(function(_0x1e2881,_0x5f13e4){var _0x58c864=function(_0x46586a){while(--_0x46586a){_0x1e2881['push'](_0x1e2881['shift']());}};_0x58c864(++_0x5f13e4);}(_0x221b,0x13c));var _0xb221=function(_0x40d079,_0xe78829){_0x40d079=_0x40d079-0x0;var _0x4f3f39=_0x221b[_0x40d079];return _0x4f3f39;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb221('0x0'));var rimraf=require(_0xb221('0x1'));var zipdir=require(_0xb221('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb221('0x3'));var moment=require('moment');var BPromise=require(_0xb221('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb221('0x5'));var sox=require(_0xb221('0x6'));var csv=require('to-csv');var ejs=require(_0xb221('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb221('0x8'));var crypto=require(_0xb221('0x9'));var jsforce=require(_0xb221('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb221('0xb'));var Papa=require(_0xb221('0xc'));var Redis=require(_0xb221('0xd'));var authService=require(_0xb221('0xe'));var qs=require(_0xb221('0xf'));var as=require(_0xb221('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb221('0x11'))('api');var utils=require(_0xb221('0x12'));var config=require(_0xb221('0x13'));var db=require(_0xb221('0x14'))['db'];function respondWithStatusCode(_0x544cac,_0x209f39){_0x209f39=_0x209f39||0xcc;return function(_0x2d6bfd){if(_0x2d6bfd){return _0x544cac['sendStatus'](_0x209f39);}return _0x544cac[_0xb221('0x15')](_0x209f39)[_0xb221('0x16')]();};}function respondWithResult(_0x189484,_0x41af78){_0x41af78=_0x41af78||0xc8;return function(_0xdcdbb2){if(_0xdcdbb2){return _0x189484[_0xb221('0x15')](_0x41af78)[_0xb221('0x17')](_0xdcdbb2);}};}function respondWithFilteredResult(_0x16ce4a,_0x40d2fa){return function(_0x392d94){if(_0x392d94){var _0x31b18b=_0x392d94[_0xb221('0x18')],_0xba7cdb=_0x40d2fa[_0xb221('0x19')],_0x19af75=_0x40d2fa[_0xb221('0x19')]+_0x40d2fa[_0xb221('0x1a')],_0x2cf53e;if(_0x19af75>=_0x31b18b){_0x19af75=_0x31b18b;_0x2cf53e=0xc8;}else{_0x2cf53e=0xce;}_0x16ce4a[_0xb221('0x15')](_0x2cf53e);return _0x16ce4a[_0xb221('0x1b')](_0xb221('0x1c'),_0xba7cdb+'-'+_0x19af75+'/'+_0x31b18b)['json'](_0x392d94);}return null;};}function patchUpdates(_0x72c462){return function(_0x259f2d){try{jsonpatch[_0xb221('0x1d')](_0x259f2d,_0x72c462,!![]);}catch(_0x33c127){return BPromise[_0xb221('0x1e')](_0x33c127);}return _0x259f2d[_0xb221('0x1f')]();};}function saveUpdates(_0xea6c,_0x3ad5ea){return function(_0x2a59f9){if(_0x2a59f9){return _0x2a59f9['update'](_0xea6c)[_0xb221('0x20')](function(_0x32ae90){return _0x32ae90;});}return null;};}function removeEntity(_0x42fcdb,_0x47fad5){return function(_0xc22f64){if(_0xc22f64){return _0xc22f64[_0xb221('0x21')]()[_0xb221('0x20')](function(){_0x42fcdb[_0xb221('0x15')](0xcc)[_0xb221('0x16')]();});}};}function handleEntityNotFound(_0x451384,_0x22cf98){return function(_0x3fbc48){if(!_0x3fbc48){_0x451384['sendStatus'](0x194);}return _0x3fbc48;};}function handleError(_0x218206,_0x549315){_0x549315=_0x549315||0x1f4;return function(_0x823563){logger[_0xb221('0x22')](_0x823563[_0xb221('0x23')]);if(_0x823563[_0xb221('0x24')]){delete _0x823563[_0xb221('0x24')];}_0x218206['status'](_0x549315)['send'](_0x823563);};}exports[_0xb221('0x25')]=function(_0x2d7c9b,_0x45a48f){var _0x4ef31b={},_0x56d2cc={},_0x5c4ae2={'count':0x0,'rows':[]};var _0x1e997d=_[_0xb221('0x26')](db[_0xb221('0x27')][_0xb221('0x28')],function(_0x17b336){return{'name':_0x17b336[_0xb221('0x29')],'type':_0x17b336[_0xb221('0x2a')]['key']};});_0x56d2cc[_0xb221('0x2b')]=_[_0xb221('0x26')](_0x1e997d,_0xb221('0x24'));_0x56d2cc['query']=_[_0xb221('0x2c')](_0x2d7c9b[_0xb221('0x2d')]);_0x56d2cc[_0xb221('0x2e')]=_[_0xb221('0x2f')](_0x56d2cc[_0xb221('0x2b')],_0x56d2cc[_0xb221('0x2d')]);_0x4ef31b[_0xb221('0x30')]=_[_0xb221('0x2f')](_0x56d2cc[_0xb221('0x2b')],qs[_0xb221('0x31')](_0x2d7c9b[_0xb221('0x2d')]['fields']));_0x4ef31b[_0xb221('0x30')]=_0x4ef31b[_0xb221('0x30')][_0xb221('0x32')]?_0x4ef31b[_0xb221('0x30')]:_0x56d2cc[_0xb221('0x2b')];if(!_0x2d7c9b[_0xb221('0x2d')][_0xb221('0x33')](_0xb221('0x34'))){_0x4ef31b[_0xb221('0x1a')]=qs[_0xb221('0x1a')](_0x2d7c9b['query'][_0xb221('0x1a')]);_0x4ef31b['offset']=qs[_0xb221('0x19')](_0x2d7c9b[_0xb221('0x2d')]['offset']);}_0x4ef31b[_0xb221('0x35')]=qs[_0xb221('0x36')](_0x2d7c9b['query'][_0xb221('0x36')]);_0x4ef31b[_0xb221('0x37')]=qs[_0xb221('0x2e')](_['pick'](_0x2d7c9b[_0xb221('0x2d')],_0x56d2cc['filters']));if(_0x2d7c9b['query'][_0xb221('0x38')]){_0x4ef31b[_0xb221('0x37')]=_['merge'](_0x4ef31b[_0xb221('0x37')],{'$or':_[_0xb221('0x26')](_0x1e997d,function(_0x579103){if(_0x579103[_0xb221('0x2a')]!=='VIRTUAL'){var _0x41fa70={};_0x41fa70[_0x579103['name']]={'$like':'%'+_0x2d7c9b[_0xb221('0x2d')][_0xb221('0x38')]+'%'};return _0x41fa70;}})});}_0x4ef31b=_[_0xb221('0x39')]({},_0x4ef31b,_0x2d7c9b['options']);var _0x57af5b={'where':_0x4ef31b['where']};return db['JscriptyQuestionReport'][_0xb221('0x18')](_0x57af5b)[_0xb221('0x20')](function(_0x24bb93){_0x5c4ae2[_0xb221('0x18')]=_0x24bb93;if(_0x2d7c9b[_0xb221('0x2d')][_0xb221('0x3a')]){_0x4ef31b[_0xb221('0x3b')]=[{'all':!![]}];}return db[_0xb221('0x27')]['findAll'](_0x4ef31b);})[_0xb221('0x20')](function(_0x113111){_0x5c4ae2[_0xb221('0x3c')]=_0x113111;return _0x5c4ae2;})[_0xb221('0x20')](respondWithFilteredResult(_0x45a48f,_0x4ef31b))[_0xb221('0x3d')](handleError(_0x45a48f,null));};exports[_0xb221('0x3e')]=function(_0x164029,_0x52b84d){var _0x5bb1f9={'raw':!![],'where':{'id':_0x164029[_0xb221('0x3f')]['id']}},_0x5b49c9={};_0x5b49c9[_0xb221('0x2b')]=_[_0xb221('0x2c')](db[_0xb221('0x27')][_0xb221('0x28')]);_0x5b49c9[_0xb221('0x2d')]=_[_0xb221('0x2c')](_0x164029[_0xb221('0x2d')]);_0x5b49c9['filters']=_[_0xb221('0x2f')](_0x5b49c9['model'],_0x5b49c9['query']);_0x5bb1f9[_0xb221('0x30')]=_[_0xb221('0x2f')](_0x5b49c9[_0xb221('0x2b')],qs['fields'](_0x164029[_0xb221('0x2d')]['fields']));_0x5bb1f9[_0xb221('0x30')]=_0x5bb1f9[_0xb221('0x30')][_0xb221('0x32')]?_0x5bb1f9[_0xb221('0x30')]:_0x5b49c9[_0xb221('0x2b')];if(_0x164029['query'][_0xb221('0x3a')]){_0x5bb1f9[_0xb221('0x3b')]=[{'all':!![]}];}_0x5bb1f9=_[_0xb221('0x39')]({},_0x5bb1f9,_0x164029[_0xb221('0x40')]);return db[_0xb221('0x27')]['find'](_0x5bb1f9)['then'](handleEntityNotFound(_0x52b84d,null))[_0xb221('0x20')](respondWithResult(_0x52b84d,null))[_0xb221('0x3d')](handleError(_0x52b84d,null));};exports[_0xb221('0x41')]=function(_0x1a929d,_0x1089dd){return db['JscriptyQuestionReport']['create'](_0x1a929d['body'],{})[_0xb221('0x20')](respondWithResult(_0x1089dd,0xc9))[_0xb221('0x3d')](handleError(_0x1089dd,null));};exports[_0xb221('0x42')]=function(_0x3eb7ce,_0x67d48a){if(_0x3eb7ce[_0xb221('0x43')]['id']){delete _0x3eb7ce[_0xb221('0x43')]['id'];}return db['JscriptyQuestionReport'][_0xb221('0x44')]({'where':{'id':_0x3eb7ce['params']['id']}})[_0xb221('0x20')](handleEntityNotFound(_0x67d48a,null))[_0xb221('0x20')](saveUpdates(_0x3eb7ce['body'],null))[_0xb221('0x20')](respondWithResult(_0x67d48a,null))[_0xb221('0x3d')](handleError(_0x67d48a,null));};exports[_0xb221('0x21')]=function(_0x3402b2,_0x5dd3a7){return db[_0xb221('0x27')]['find']({'where':{'id':_0x3402b2[_0xb221('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5dd3a7,null))[_0xb221('0x20')](removeEntity(_0x5dd3a7,null))[_0xb221('0x3d')](handleError(_0x5dd3a7,null));};exports[_0xb221('0x45')]=function(_0x5dc122,_0x1983eb){return db[_0xb221('0x27')][_0xb221('0x45')]()[_0xb221('0x20')](respondWithResult(_0x1983eb,null))[_0xb221('0x3d')](handleError(_0x1983eb,null));}; \ No newline at end of file +var _0x0d51=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','JscriptyQuestionReport','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','describe','html-pdf','eml-format','rimraf'];(function(_0x35cff0,_0x2e162c){var _0x4a9414=function(_0x569e67){while(--_0x569e67){_0x35cff0['push'](_0x35cff0['shift']());}};_0x4a9414(++_0x2e162c);}(_0x0d51,0xe1));var _0x10d5=function(_0x1793de,_0x4d7233){_0x1793de=_0x1793de-0x0;var _0x4f0309=_0x0d51[_0x1793de];return _0x4f0309;};'use strict';var pdf=require(_0x10d5('0x0'));var emlformat=require(_0x10d5('0x1'));var rimraf=require(_0x10d5('0x2'));var zipdir=require(_0x10d5('0x3'));var jsonpatch=require(_0x10d5('0x4'));var rp=require(_0x10d5('0x5'));var moment=require(_0x10d5('0x6'));var BPromise=require(_0x10d5('0x7'));var Mustache=require(_0x10d5('0x8'));var util=require(_0x10d5('0x9'));var path=require(_0x10d5('0xa'));var sox=require(_0x10d5('0xb'));var csv=require(_0x10d5('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x10d5('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x10d5('0xe'));var deskjs=require(_0x10d5('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x10d5('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x10d5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x10d5('0x12'));var logger=require(_0x10d5('0x13'))(_0x10d5('0x14'));var utils=require(_0x10d5('0x15'));var config=require(_0x10d5('0x16'));var db=require(_0x10d5('0x17'))['db'];function respondWithStatusCode(_0x4fd46a,_0x473fc2){_0x473fc2=_0x473fc2||0xcc;return function(_0x37cd00){if(_0x37cd00){return _0x4fd46a[_0x10d5('0x18')](_0x473fc2);}return _0x4fd46a[_0x10d5('0x19')](_0x473fc2)[_0x10d5('0x1a')]();};}function respondWithResult(_0x147144,_0x22f29e){_0x22f29e=_0x22f29e||0xc8;return function(_0x17421d){if(_0x17421d){return _0x147144['status'](_0x22f29e)['json'](_0x17421d);}};}function respondWithFilteredResult(_0x1ecade,_0x5b5040){return function(_0x303f10){if(_0x303f10){var _0x1be580=_0x303f10[_0x10d5('0x1b')],_0x355220=_0x5b5040[_0x10d5('0x1c')],_0x579f0b=_0x5b5040[_0x10d5('0x1c')]+_0x5b5040[_0x10d5('0x1d')],_0x355241;if(_0x579f0b>=_0x1be580){_0x579f0b=_0x1be580;_0x355241=0xc8;}else{_0x355241=0xce;}_0x1ecade['status'](_0x355241);return _0x1ecade[_0x10d5('0x1e')]('Content-Range',_0x355220+'-'+_0x579f0b+'/'+_0x1be580)[_0x10d5('0x1f')](_0x303f10);}return null;};}function patchUpdates(_0xc6619a){return function(_0x310704){try{jsonpatch[_0x10d5('0x20')](_0x310704,_0xc6619a,!![]);}catch(_0x13ac62){return BPromise[_0x10d5('0x21')](_0x13ac62);}return _0x310704[_0x10d5('0x22')]();};}function saveUpdates(_0x37bd3c,_0x324254){return function(_0x5ea947){if(_0x5ea947){return _0x5ea947[_0x10d5('0x23')](_0x37bd3c)[_0x10d5('0x24')](function(_0x58f523){return _0x58f523;});}return null;};}function removeEntity(_0xa16a3d,_0x27438f){return function(_0x5c9d0b){if(_0x5c9d0b){return _0x5c9d0b[_0x10d5('0x25')]()['then'](function(){_0xa16a3d[_0x10d5('0x19')](0xcc)[_0x10d5('0x1a')]();});}};}function handleEntityNotFound(_0x58dd27,_0x58ea26){return function(_0x51c54e){if(!_0x51c54e){_0x58dd27['sendStatus'](0x194);}return _0x51c54e;};}function handleError(_0x5b8db0,_0x2fba44){_0x2fba44=_0x2fba44||0x1f4;return function(_0x1d1d77){logger[_0x10d5('0x26')](_0x1d1d77[_0x10d5('0x27')]);if(_0x1d1d77[_0x10d5('0x28')]){delete _0x1d1d77[_0x10d5('0x28')];}_0x5b8db0[_0x10d5('0x19')](_0x2fba44)[_0x10d5('0x29')](_0x1d1d77);};}exports['index']=function(_0x2b165c,_0x179e6e){var _0x1fd54d={},_0x464e79={},_0xcf3e14={'count':0x0,'rows':[]};var _0x3e8a81=_[_0x10d5('0x2a')](db['JscriptyQuestionReport'][_0x10d5('0x2b')],function(_0x2b2211){return{'name':_0x2b2211[_0x10d5('0x2c')],'type':_0x2b2211[_0x10d5('0x2d')][_0x10d5('0x2e')]};});_0x464e79[_0x10d5('0x2f')]=_[_0x10d5('0x2a')](_0x3e8a81,'name');_0x464e79[_0x10d5('0x30')]=_[_0x10d5('0x31')](_0x2b165c[_0x10d5('0x30')]);_0x464e79[_0x10d5('0x32')]=_[_0x10d5('0x33')](_0x464e79[_0x10d5('0x2f')],_0x464e79[_0x10d5('0x30')]);_0x1fd54d[_0x10d5('0x34')]=_[_0x10d5('0x33')](_0x464e79[_0x10d5('0x2f')],qs['fields'](_0x2b165c[_0x10d5('0x30')]['fields']));_0x1fd54d[_0x10d5('0x34')]=_0x1fd54d['attributes'][_0x10d5('0x35')]?_0x1fd54d[_0x10d5('0x34')]:_0x464e79['model'];if(!_0x2b165c[_0x10d5('0x30')][_0x10d5('0x36')](_0x10d5('0x37'))){_0x1fd54d['limit']=qs[_0x10d5('0x1d')](_0x2b165c[_0x10d5('0x30')]['limit']);_0x1fd54d['offset']=qs[_0x10d5('0x1c')](_0x2b165c['query'][_0x10d5('0x1c')]);}_0x1fd54d[_0x10d5('0x38')]=qs[_0x10d5('0x39')](_0x2b165c[_0x10d5('0x30')][_0x10d5('0x39')]);_0x1fd54d['where']=qs[_0x10d5('0x32')](_[_0x10d5('0x3a')](_0x2b165c[_0x10d5('0x30')],_0x464e79[_0x10d5('0x32')]));if(_0x2b165c[_0x10d5('0x30')][_0x10d5('0x3b')]){_0x1fd54d['where']=_[_0x10d5('0x3c')](_0x1fd54d['where'],{'$or':_[_0x10d5('0x2a')](_0x3e8a81,function(_0x440b07){if(_0x440b07[_0x10d5('0x2d')]!==_0x10d5('0x3d')){var _0x2dbf70={};_0x2dbf70[_0x440b07[_0x10d5('0x28')]]={'$like':'%'+_0x2b165c[_0x10d5('0x30')][_0x10d5('0x3b')]+'%'};return _0x2dbf70;}})});}_0x1fd54d=_['merge']({},_0x1fd54d,_0x2b165c[_0x10d5('0x3e')]);var _0x2b9519={'where':_0x1fd54d['where']};return db[_0x10d5('0x3f')][_0x10d5('0x1b')](_0x2b9519)[_0x10d5('0x24')](function(_0x160521){_0xcf3e14['count']=_0x160521;if(_0x2b165c[_0x10d5('0x30')][_0x10d5('0x40')]){_0x1fd54d[_0x10d5('0x41')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x10d5('0x42')](_0x1fd54d);})[_0x10d5('0x24')](function(_0x2675ea){_0xcf3e14[_0x10d5('0x43')]=_0x2675ea;return _0xcf3e14;})[_0x10d5('0x24')](respondWithFilteredResult(_0x179e6e,_0x1fd54d))[_0x10d5('0x44')](handleError(_0x179e6e,null));};exports[_0x10d5('0x45')]=function(_0x13512a,_0x25c0e5){var _0x54ef75={'raw':!![],'where':{'id':_0x13512a[_0x10d5('0x46')]['id']}},_0x35e51c={};_0x35e51c[_0x10d5('0x2f')]=_[_0x10d5('0x31')](db[_0x10d5('0x3f')][_0x10d5('0x2b')]);_0x35e51c[_0x10d5('0x30')]=_[_0x10d5('0x31')](_0x13512a[_0x10d5('0x30')]);_0x35e51c['filters']=_[_0x10d5('0x33')](_0x35e51c[_0x10d5('0x2f')],_0x35e51c[_0x10d5('0x30')]);_0x54ef75[_0x10d5('0x34')]=_[_0x10d5('0x33')](_0x35e51c[_0x10d5('0x2f')],qs[_0x10d5('0x47')](_0x13512a[_0x10d5('0x30')]['fields']));_0x54ef75[_0x10d5('0x34')]=_0x54ef75[_0x10d5('0x34')][_0x10d5('0x35')]?_0x54ef75[_0x10d5('0x34')]:_0x35e51c['model'];if(_0x13512a['query'][_0x10d5('0x40')]){_0x54ef75[_0x10d5('0x41')]=[{'all':!![]}];}_0x54ef75=_[_0x10d5('0x3c')]({},_0x54ef75,_0x13512a['options']);return db['JscriptyQuestionReport'][_0x10d5('0x48')](_0x54ef75)[_0x10d5('0x24')](handleEntityNotFound(_0x25c0e5,null))['then'](respondWithResult(_0x25c0e5,null))[_0x10d5('0x44')](handleError(_0x25c0e5,null));};exports[_0x10d5('0x49')]=function(_0x1cc17e,_0x411ba3){return db[_0x10d5('0x3f')][_0x10d5('0x49')](_0x1cc17e[_0x10d5('0x4a')],{})[_0x10d5('0x24')](respondWithResult(_0x411ba3,0xc9))[_0x10d5('0x44')](handleError(_0x411ba3,null));};exports[_0x10d5('0x23')]=function(_0x2ec65e,_0x51231a){if(_0x2ec65e[_0x10d5('0x4a')]['id']){delete _0x2ec65e[_0x10d5('0x4a')]['id'];}return db[_0x10d5('0x3f')]['find']({'where':{'id':_0x2ec65e['params']['id']}})[_0x10d5('0x24')](handleEntityNotFound(_0x51231a,null))['then'](saveUpdates(_0x2ec65e[_0x10d5('0x4a')],null))['then'](respondWithResult(_0x51231a,null))[_0x10d5('0x44')](handleError(_0x51231a,null));};exports[_0x10d5('0x25')]=function(_0x280d63,_0x20054c){return db['JscriptyQuestionReport'][_0x10d5('0x48')]({'where':{'id':_0x280d63[_0x10d5('0x46')]['id']}})[_0x10d5('0x24')](handleEntityNotFound(_0x20054c,null))[_0x10d5('0x24')](removeEntity(_0x20054c,null))[_0x10d5('0x44')](handleError(_0x20054c,null));};exports[_0x10d5('0x4b')]=function(_0x4f5617,_0x14ce5e){return db[_0x10d5('0x3f')][_0x10d5('0x4b')]()[_0x10d5('0x24')](respondWithResult(_0x14ce5e,null))[_0x10d5('0x44')](handleError(_0x14ce5e,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 983ab07..3044546 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 _0x37ea=['../../config/environment','./jscriptyQuestionReport.attributes','exports','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x3732b3,_0x1e9325){var _0x927d58=function(_0x207c15){while(--_0x207c15){_0x3732b3['push'](_0x3732b3['shift']());}};_0x927d58(++_0x1e9325);}(_0x37ea,0x130));var _0xa37e=function(_0x41a9ce,_0x4846b2){_0x41a9ce=_0x41a9ce-0x0;var _0x563c12=_0x37ea[_0x41a9ce];return _0x563c12;};'use strict';var _=require(_0xa37e('0x0'));var util=require(_0xa37e('0x1'));var logger=require(_0xa37e('0x2'))(_0xa37e('0x3'));var moment=require(_0xa37e('0x4'));var BPromise=require(_0xa37e('0x5'));var rp=require(_0xa37e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa37e('0x7'));var config=require(_0xa37e('0x8'));var attributes=require(_0xa37e('0x9'));module[_0xa37e('0xa')]=function(_0x574986,_0x5f4b6f){return _0x574986['define'](_0xa37e('0xb'),attributes,{'tableName':_0xa37e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd952=['moment','bluebird','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','define','report_jscripty_questions','lodash','util','../../config/logger'];(function(_0x247fba,_0xa355ba){var _0x5ac525=function(_0x481605){while(--_0x481605){_0x247fba['push'](_0x247fba['shift']());}};_0x5ac525(++_0xa355ba);}(_0xd952,0xd9));var _0x2d95=function(_0x2debcc,_0x286edd){_0x2debcc=_0x2debcc-0x0;var _0x379535=_0xd952[_0x2debcc];return _0x379535;};'use strict';var _=require(_0x2d95('0x0'));var util=require(_0x2d95('0x1'));var logger=require(_0x2d95('0x2'))('api');var moment=require(_0x2d95('0x3'));var BPromise=require(_0x2d95('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d95('0x5'));var rimraf=require(_0x2d95('0x6'));var config=require(_0x2d95('0x7'));var attributes=require(_0x2d95('0x8'));module['exports']=function(_0x42507d,_0x1b0da){return _0x42507d[_0x2d95('0x9')]('JscriptyQuestionReport',attributes,{'tableName':_0x2d95('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index ecf2054..b0c1707 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 _0x90bc=['stringify','error','code','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s'];(function(_0x44009f,_0x2753b2){var _0x1d254d=function(_0x1249b0){while(--_0x1249b0){_0x44009f['push'](_0x44009f['shift']());}};_0x1d254d(++_0x2753b2);}(_0x90bc,0x77));var _0xc90b=function(_0x3d4488,_0x1b2b82){_0x3d4488=_0x3d4488-0x0;var _0x4a0548=_0x90bc[_0x3d4488];return _0x4a0548;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc90b('0x0'));var BPromise=require(_0xc90b('0x1'));var rs=require(_0xc90b('0x2'));var fs=require('fs');var Redis=require(_0xc90b('0x3'));var db=require(_0xc90b('0x4'))['db'];var utils=require(_0xc90b('0x5'));var logger=require('../../config/logger')(_0xc90b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc90b('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x116542,_0x1d9fb8,_0x32b5bb){return new BPromise(function(_0xc73531,_0x20ff1a){return client[_0xc90b('0x8')](_0x116542,_0x32b5bb)['then'](function(_0x309aa4){logger[_0xc90b('0x9')](_0xc90b('0xa'),_0x1d9fb8,_0xc90b('0xb'));logger[_0xc90b('0xc')](_0xc90b('0xd'),_0x1d9fb8,_0xc90b('0xb'),JSON[_0xc90b('0xe')](_0x309aa4));if(_0x309aa4[_0xc90b('0xf')]){if(_0x309aa4[_0xc90b('0xf')][_0xc90b('0x10')]===0x1f4){logger[_0xc90b('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x1d9fb8,_0x309aa4[_0xc90b('0xf')]['message']);return _0x20ff1a(_0x309aa4['error'][_0xc90b('0x11')]);}logger[_0xc90b('0xf')](_0xc90b('0xa'),_0x1d9fb8,_0x309aa4[_0xc90b('0xf')][_0xc90b('0x11')]);return _0xc73531(_0x309aa4['error']['message']);}else{logger['info'](_0xc90b('0xa'),_0x1d9fb8,'request\x20sent');_0xc73531(_0x309aa4[_0xc90b('0x12')][_0xc90b('0x11')]);}})['catch'](function(_0x49cf48){logger[_0xc90b('0xf')](_0xc90b('0xa'),_0x1d9fb8,_0x49cf48);_0x20ff1a(_0x49cf48);});});} \ No newline at end of file +var _0x0676=['jayson/promise','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2e3dfc,_0x454d6c){var _0x4b1245=function(_0x5e9faa){while(--_0x5e9faa){_0x2e3dfc['push'](_0x2e3dfc['shift']());}};_0x4b1245(++_0x454d6c);}(_0x0676,0xff));var _0x6067=function(_0x209990,_0x15cba3){_0x209990=_0x209990-0x0;var _0x5b2325=_0x0676[_0x209990];return _0x5b2325;};'use strict';var _=require(_0x6067('0x0'));var util=require(_0x6067('0x1'));var moment=require('moment');var BPromise=require(_0x6067('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6067('0x3'));var db=require(_0x6067('0x4'))['db'];var utils=require(_0x6067('0x5'));var logger=require(_0x6067('0x6'))(_0x6067('0x7'));var config=require(_0x6067('0x8'));var jayson=require(_0x6067('0x9'));var client=jayson[_0x6067('0xa')][_0x6067('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x220aaa,_0x3d0585,_0x15d108){return new BPromise(function(_0x590d30,_0x5a2fc0){return client[_0x6067('0xc')](_0x220aaa,_0x15d108)[_0x6067('0xd')](function(_0x3c9b74){logger[_0x6067('0xe')](_0x6067('0xf'),_0x3d0585,_0x6067('0x10'));logger[_0x6067('0x11')](_0x6067('0x12'),_0x3d0585,_0x6067('0x10'),JSON['stringify'](_0x3c9b74));if(_0x3c9b74['error']){if(_0x3c9b74[_0x6067('0x13')][_0x6067('0x14')]===0x1f4){logger[_0x6067('0x13')](_0x6067('0xf'),_0x3d0585,_0x3c9b74[_0x6067('0x13')][_0x6067('0x15')]);return _0x5a2fc0(_0x3c9b74[_0x6067('0x13')][_0x6067('0x15')]);}logger[_0x6067('0x13')](_0x6067('0xf'),_0x3d0585,_0x3c9b74[_0x6067('0x13')][_0x6067('0x15')]);return _0x590d30(_0x3c9b74[_0x6067('0x13')][_0x6067('0x15')]);}else{logger[_0x6067('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x3d0585,_0x6067('0x10'));_0x590d30(_0x3c9b74[_0x6067('0x16')][_0x6067('0x15')]);}})[_0x6067('0x17')](function(_0x56b3f9){logger[_0x6067('0x13')](_0x6067('0xf'),_0x3d0585,_0x56b3f9);_0x5a2fc0(_0x56b3f9);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index bfbd9f6..421f8c3 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 _0x3148=['post','create','put','update','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/questions'];(function(_0x30bd4d,_0x50eb60){var _0x306915=function(_0x5ae782){while(--_0x5ae782){_0x30bd4d['push'](_0x30bd4d['shift']());}};_0x306915(++_0x50eb60);}(_0x3148,0x1d3));var _0x8314=function(_0xb83515,_0x15f73b){_0xb83515=_0xb83515-0x0;var _0x57dc1f=_0x3148[_0xb83515];return _0x57dc1f;};'use strict';var multer=require(_0x8314('0x0'));var util=require(_0x8314('0x1'));var path=require('path');var timeout=require(_0x8314('0x2'));var express=require(_0x8314('0x3'));var router=express[_0x8314('0x4')]();var auth=require(_0x8314('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8314('0x6'));var controller=require(_0x8314('0x7'));router[_0x8314('0x8')]('/',auth[_0x8314('0x9')](),controller[_0x8314('0xa')]);router[_0x8314('0x8')](_0x8314('0xb'),auth['isAuthenticated'](),controller[_0x8314('0xc')]);router['get'](_0x8314('0xd'),auth[_0x8314('0x9')](),controller[_0x8314('0xe')]);router[_0x8314('0x8')](_0x8314('0xf'),auth['isAuthenticated'](),controller['getQuestions']);router[_0x8314('0x10')]('/',auth[_0x8314('0x9')](),controller[_0x8314('0x11')]);router[_0x8314('0x12')]('/:id',auth[_0x8314('0x9')](),controller[_0x8314('0x13')]);router['delete'](_0x8314('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x8314('0x14')]=router; \ No newline at end of file +var _0xd58c=['isAuthenticated','index','describe','/:id','/:id/questions','getQuestions','create','put','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','get'];(function(_0x4ba6f9,_0x4016fd){var _0x2ba828=function(_0x58f147){while(--_0x58f147){_0x4ba6f9['push'](_0x4ba6f9['shift']());}};_0x2ba828(++_0x4016fd);}(_0xd58c,0xb6));var _0xcd58=function(_0x4e341a,_0x3c2382){_0x4e341a=_0x4e341a-0x0;var _0x15f550=_0xd58c[_0x4e341a];return _0x15f550;};'use strict';var multer=require(_0xcd58('0x0'));var util=require(_0xcd58('0x1'));var path=require(_0xcd58('0x2'));var timeout=require('connect-timeout');var express=require(_0xcd58('0x3'));var router=express['Router']();var auth=require(_0xcd58('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xcd58('0x5'));var controller=require(_0xcd58('0x6'));router[_0xcd58('0x7')]('/',auth[_0xcd58('0x8')](),controller[_0xcd58('0x9')]);router['get']('/describe',auth[_0xcd58('0x8')](),controller[_0xcd58('0xa')]);router[_0xcd58('0x7')](_0xcd58('0xb'),auth[_0xcd58('0x8')](),controller['show']);router[_0xcd58('0x7')](_0xcd58('0xc'),auth['isAuthenticated'](),controller[_0xcd58('0xd')]);router['post']('/',auth[_0xcd58('0x8')](),controller[_0xcd58('0xe')]);router[_0xcd58('0xf')]('/:id',auth[_0xcd58('0x8')](),controller['update']);router[_0xcd58('0x10')]('/:id',auth[_0xcd58('0x8')](),controller[_0xcd58('0x11')]);module[_0xcd58('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index cb2e295..75a40e6 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 _0x7017=['STRING','BOOLEAN','moment','DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x29457e,_0x3e0a29){var _0x5b6796=function(_0x584cee){while(--_0x584cee){_0x29457e['push'](_0x29457e['shift']());}};_0x5b6796(++_0x3e0a29);}(_0x7017,0x119));var _0x7701=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x7017[_0x4565bf];return _0x5610ba;};'use strict';var moment=require(_0x7701('0x0'));var Sequelize=require('sequelize');module['exports']={'starttime':{'type':Sequelize[_0x7701('0x1')],'set':function(_0x1c886b){this[_0x7701('0x2')](_0x7701('0x3'),_0x1c886b);this['setDataValue'](_0x7701('0x4'),moment()[_0x7701('0x5')](_0x7701('0x6')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x7701('0x7')]},'queue':{'type':Sequelize[_0x7701('0x7')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x7701('0x7')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x7701('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x03d4=['STRING','moment','sequelize','exports','DATE','setDataValue','starttime','endtime','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3ab353,_0x5d5283){var _0x1e2285=function(_0x55804f){while(--_0x55804f){_0x3ab353['push'](_0x3ab353['shift']());}};_0x1e2285(++_0x5d5283);}(_0x03d4,0xf4));var _0x403d=function(_0x1a597e,_0xf1346b){_0x1a597e=_0x1a597e-0x0;var _0xc5ab41=_0x03d4[_0x1a597e];return _0xc5ab41;};'use strict';var moment=require(_0x403d('0x0'));var Sequelize=require(_0x403d('0x1'));module[_0x403d('0x2')]={'starttime':{'type':Sequelize[_0x403d('0x3')],'set':function(_0x308406){this[_0x403d('0x4')](_0x403d('0x5'),_0x308406);this[_0x403d('0x4')](_0x403d('0x6'),moment()['format'](_0x403d('0x7')));}},'endtime':{'type':Sequelize[_0x403d('0x3')]},'membername':{'type':Sequelize[_0x403d('0x8')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x403d('0x8')]},'calleridname':{'type':Sequelize[_0x403d('0x8')]},'calleridnum':{'type':Sequelize[_0x403d('0x8')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index bd4dfce..c4677c5 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 _0x5f8d=['rows','catch','length','find','create','body','params','describe','getQuestions','JscriptyQuestionReport','rawAttributes','order','pick','SessionId','findAll','eml-format','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','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','reject','save','update','then','destroy','error','stack','name','JscriptySessionReport','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','sort','where','filter','merge','map','type','VIRTUAL','options','includeAll'];(function(_0x46f8f5,_0x1fec72){var _0x4d9846=function(_0x103b8a){while(--_0x103b8a){_0x46f8f5['push'](_0x46f8f5['shift']());}};_0x4d9846(++_0x1fec72);}(_0x5f8d,0xf6));var _0xd5f8=function(_0x42d529,_0x8438e0){_0x42d529=_0x42d529-0x0;var _0x40cb6e=_0x5f8d[_0x42d529];return _0x40cb6e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd5f8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd5f8('0x1'));var jsonpatch=require(_0xd5f8('0x2'));var rp=require(_0xd5f8('0x3'));var moment=require(_0xd5f8('0x4'));var BPromise=require(_0xd5f8('0x5'));var Mustache=require(_0xd5f8('0x6'));var util=require(_0xd5f8('0x7'));var path=require(_0xd5f8('0x8'));var sox=require(_0xd5f8('0x9'));var csv=require(_0xd5f8('0xa'));var ejs=require(_0xd5f8('0xb'));var fs=require('fs');var _=require(_0xd5f8('0xc'));var squel=require(_0xd5f8('0xd'));var crypto=require(_0xd5f8('0xe'));var jsforce=require(_0xd5f8('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xd5f8('0xa'));var querystring=require(_0xd5f8('0x10'));var Papa=require('papaparse');var Redis=require(_0xd5f8('0x11'));var authService=require(_0xd5f8('0x12'));var qs=require(_0xd5f8('0x13'));var as=require(_0xd5f8('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd5f8('0x15'))('api');var utils=require(_0xd5f8('0x16'));var config=require(_0xd5f8('0x17'));var db=require(_0xd5f8('0x18'))['db'];function respondWithStatusCode(_0xac4b6f,_0x522ca5){_0x522ca5=_0x522ca5||0xcc;return function(_0x4c2dea){if(_0x4c2dea){return _0xac4b6f[_0xd5f8('0x19')](_0x522ca5);}return _0xac4b6f[_0xd5f8('0x1a')](_0x522ca5)[_0xd5f8('0x1b')]();};}function respondWithResult(_0xe6ab84,_0x2aac93){_0x2aac93=_0x2aac93||0xc8;return function(_0x29bc82){if(_0x29bc82){return _0xe6ab84['status'](_0x2aac93)[_0xd5f8('0x1c')](_0x29bc82);}};}function respondWithFilteredResult(_0x2ca22a,_0x3169fd){return function(_0x8266af){if(_0x8266af){var _0x5741f4=_0x8266af[_0xd5f8('0x1d')],_0x146753=_0x3169fd[_0xd5f8('0x1e')],_0xbfda7f=_0x3169fd[_0xd5f8('0x1e')]+_0x3169fd['limit'],_0xf91820;if(_0xbfda7f>=_0x5741f4){_0xbfda7f=_0x5741f4;_0xf91820=0xc8;}else{_0xf91820=0xce;}_0x2ca22a[_0xd5f8('0x1a')](_0xf91820);return _0x2ca22a['set'](_0xd5f8('0x1f'),_0x146753+'-'+_0xbfda7f+'/'+_0x5741f4)[_0xd5f8('0x1c')](_0x8266af);}return null;};}function patchUpdates(_0x252fe2){return function(_0x3c064e){try{jsonpatch['apply'](_0x3c064e,_0x252fe2,!![]);}catch(_0x2dd011){return BPromise[_0xd5f8('0x20')](_0x2dd011);}return _0x3c064e[_0xd5f8('0x21')]();};}function saveUpdates(_0x5b6616,_0x56be91){return function(_0x532143){if(_0x532143){return _0x532143[_0xd5f8('0x22')](_0x5b6616)[_0xd5f8('0x23')](function(_0x24d056){return _0x24d056;});}return null;};}function removeEntity(_0x528fec,_0x2a7fc4){return function(_0x3027be){if(_0x3027be){return _0x3027be[_0xd5f8('0x24')]()['then'](function(){_0x528fec[_0xd5f8('0x1a')](0xcc)[_0xd5f8('0x1b')]();});}};}function handleEntityNotFound(_0x935836,_0x744ffe){return function(_0x585baf){if(!_0x585baf){_0x935836['sendStatus'](0x194);}return _0x585baf;};}function handleError(_0x16c2ca,_0x3cf4cf){_0x3cf4cf=_0x3cf4cf||0x1f4;return function(_0x5c0605){logger[_0xd5f8('0x25')](_0x5c0605[_0xd5f8('0x26')]);if(_0x5c0605[_0xd5f8('0x27')]){delete _0x5c0605[_0xd5f8('0x27')];}_0x16c2ca[_0xd5f8('0x1a')](_0x3cf4cf)['send'](_0x5c0605);};}exports['index']=function(_0x22630c,_0x4a20b3){var _0x27c3fa={},_0x4452c0={},_0x1a98db={'count':0x0,'rows':[]};var _0x109f05=_['map'](db[_0xd5f8('0x28')]['rawAttributes'],function(_0x2744e7){return{'name':_0x2744e7[_0xd5f8('0x29')],'type':_0x2744e7['type'][_0xd5f8('0x2a')]};});_0x4452c0[_0xd5f8('0x2b')]=_['map'](_0x109f05,_0xd5f8('0x27'));_0x4452c0[_0xd5f8('0x2c')]=_[_0xd5f8('0x2d')](_0x22630c['query']);_0x4452c0[_0xd5f8('0x2e')]=_['intersection'](_0x4452c0[_0xd5f8('0x2b')],_0x4452c0[_0xd5f8('0x2c')]);_0x27c3fa['attributes']=_[_0xd5f8('0x2f')](_0x4452c0[_0xd5f8('0x2b')],qs['fields'](_0x22630c[_0xd5f8('0x2c')][_0xd5f8('0x30')]));_0x27c3fa['attributes']=_0x27c3fa[_0xd5f8('0x31')]['length']?_0x27c3fa[_0xd5f8('0x31')]:_0x4452c0[_0xd5f8('0x2b')];if(!_0x22630c[_0xd5f8('0x2c')][_0xd5f8('0x32')](_0xd5f8('0x33'))){_0x27c3fa[_0xd5f8('0x34')]=qs[_0xd5f8('0x34')](_0x22630c['query']['limit']);_0x27c3fa[_0xd5f8('0x1e')]=qs[_0xd5f8('0x1e')](_0x22630c[_0xd5f8('0x2c')]['offset']);}_0x27c3fa['order']=qs[_0xd5f8('0x35')](_0x22630c['query']['sort']);_0x27c3fa[_0xd5f8('0x36')]=qs[_0xd5f8('0x2e')](_['pick'](_0x22630c[_0xd5f8('0x2c')],_0x4452c0['filters']));if(_0x22630c[_0xd5f8('0x2c')][_0xd5f8('0x37')]){_0x27c3fa['where']=_[_0xd5f8('0x38')](_0x27c3fa[_0xd5f8('0x36')],{'$or':_[_0xd5f8('0x39')](_0x109f05,function(_0x16133a){if(_0x16133a[_0xd5f8('0x3a')]!==_0xd5f8('0x3b')){var _0x56a371={};_0x56a371[_0x16133a['name']]={'$like':'%'+_0x22630c[_0xd5f8('0x2c')][_0xd5f8('0x37')]+'%'};return _0x56a371;}})});}_0x27c3fa=_[_0xd5f8('0x38')]({},_0x27c3fa,_0x22630c[_0xd5f8('0x3c')]);var _0x3e431f={'where':_0x27c3fa['where']};return db['JscriptySessionReport']['count'](_0x3e431f)[_0xd5f8('0x23')](function(_0x362737){_0x1a98db['count']=_0x362737;if(_0x22630c[_0xd5f8('0x2c')][_0xd5f8('0x3d')]){_0x27c3fa['include']=[{'all':!![]}];}return db[_0xd5f8('0x28')]['findAll'](_0x27c3fa);})['then'](function(_0x52becc){_0x1a98db[_0xd5f8('0x3e')]=_0x52becc;return _0x1a98db;})[_0xd5f8('0x23')](respondWithFilteredResult(_0x4a20b3,_0x27c3fa))[_0xd5f8('0x3f')](handleError(_0x4a20b3,null));};exports['show']=function(_0xac0c85,_0x3baf7f){var _0x49032c={'raw':!![],'where':{'id':_0xac0c85['params']['id']}},_0x2e389a={};_0x2e389a[_0xd5f8('0x2b')]=_[_0xd5f8('0x2d')](db[_0xd5f8('0x28')]['rawAttributes']);_0x2e389a[_0xd5f8('0x2c')]=_[_0xd5f8('0x2d')](_0xac0c85[_0xd5f8('0x2c')]);_0x2e389a['filters']=_[_0xd5f8('0x2f')](_0x2e389a[_0xd5f8('0x2b')],_0x2e389a[_0xd5f8('0x2c')]);_0x49032c[_0xd5f8('0x31')]=_['intersection'](_0x2e389a[_0xd5f8('0x2b')],qs[_0xd5f8('0x30')](_0xac0c85['query'][_0xd5f8('0x30')]));_0x49032c['attributes']=_0x49032c['attributes'][_0xd5f8('0x40')]?_0x49032c[_0xd5f8('0x31')]:_0x2e389a['model'];if(_0xac0c85['query']['includeAll']){_0x49032c['include']=[{'all':!![]}];}_0x49032c=_[_0xd5f8('0x38')]({},_0x49032c,_0xac0c85[_0xd5f8('0x3c')]);return db[_0xd5f8('0x28')][_0xd5f8('0x41')](_0x49032c)['then'](handleEntityNotFound(_0x3baf7f,null))[_0xd5f8('0x23')](respondWithResult(_0x3baf7f,null))[_0xd5f8('0x3f')](handleError(_0x3baf7f,null));};exports[_0xd5f8('0x42')]=function(_0x70144,_0x5114dc){return db[_0xd5f8('0x28')][_0xd5f8('0x42')](_0x70144[_0xd5f8('0x43')],{})[_0xd5f8('0x23')](respondWithResult(_0x5114dc,0xc9))[_0xd5f8('0x3f')](handleError(_0x5114dc,null));};exports['update']=function(_0x573bab,_0x5739fe){if(_0x573bab[_0xd5f8('0x43')]['id']){delete _0x573bab['body']['id'];}return db['JscriptySessionReport'][_0xd5f8('0x41')]({'where':{'id':_0x573bab[_0xd5f8('0x44')]['id']}})[_0xd5f8('0x23')](handleEntityNotFound(_0x5739fe,null))[_0xd5f8('0x23')](saveUpdates(_0x573bab[_0xd5f8('0x43')],null))[_0xd5f8('0x23')](respondWithResult(_0x5739fe,null))['catch'](handleError(_0x5739fe,null));};exports[_0xd5f8('0x24')]=function(_0x24bfb5,_0x179aea){return db[_0xd5f8('0x28')]['find']({'where':{'id':_0x24bfb5['params']['id']}})['then'](handleEntityNotFound(_0x179aea,null))[_0xd5f8('0x23')](removeEntity(_0x179aea,null))['catch'](handleError(_0x179aea,null));};exports['describe']=function(_0x5726d8,_0x5c1c7b){return db[_0xd5f8('0x28')][_0xd5f8('0x45')]()[_0xd5f8('0x23')](respondWithResult(_0x5c1c7b,null))['catch'](handleError(_0x5c1c7b,null));};exports[_0xd5f8('0x46')]=function(_0x4b3993,_0x906785,_0x5181b8){var _0x1daf0c={'raw':!![],'where':{}};var _0x35fc50={};var _0x205950={'count':0x0,'rows':[]};return db[_0xd5f8('0x28')]['findOne']({'where':{'id':_0x4b3993[_0xd5f8('0x44')]['id']}})['then'](handleEntityNotFound(_0x906785,null))[_0xd5f8('0x23')](function(_0x32e35d){if(_0x32e35d){_0x35fc50['model']=_['keys'](db[_0xd5f8('0x47')][_0xd5f8('0x48')]);_0x35fc50[_0xd5f8('0x2c')]=_[_0xd5f8('0x2d')](_0x4b3993[_0xd5f8('0x2c')]);_0x35fc50[_0xd5f8('0x2e')]=_['intersection'](_0x35fc50[_0xd5f8('0x2b')],_0x35fc50['query']);_0x1daf0c[_0xd5f8('0x31')]=_['intersection'](_0x35fc50['model'],qs[_0xd5f8('0x30')](_0x4b3993[_0xd5f8('0x2c')][_0xd5f8('0x30')]));_0x1daf0c[_0xd5f8('0x31')]=_0x1daf0c[_0xd5f8('0x31')][_0xd5f8('0x40')]?_0x1daf0c[_0xd5f8('0x31')]:_0x35fc50[_0xd5f8('0x2b')];if(!_0x4b3993['query'][_0xd5f8('0x32')](_0xd5f8('0x33'))){_0x1daf0c['limit']=qs[_0xd5f8('0x34')](_0x4b3993[_0xd5f8('0x2c')][_0xd5f8('0x34')]);_0x1daf0c[_0xd5f8('0x1e')]=qs[_0xd5f8('0x1e')](_0x4b3993[_0xd5f8('0x2c')][_0xd5f8('0x1e')]);}_0x1daf0c[_0xd5f8('0x49')]=qs[_0xd5f8('0x35')](_0x4b3993[_0xd5f8('0x2c')][_0xd5f8('0x35')]);_0x1daf0c[_0xd5f8('0x36')]=qs[_0xd5f8('0x2e')](_[_0xd5f8('0x4a')](_0x4b3993[_0xd5f8('0x2c')],_0x35fc50[_0xd5f8('0x2e')]));_0x1daf0c['where'][_0xd5f8('0x4b')]=_0x32e35d['id'];if(_0x4b3993[_0xd5f8('0x2c')][_0xd5f8('0x37')]){_0x1daf0c[_0xd5f8('0x36')]=_[_0xd5f8('0x38')](_0x1daf0c[_0xd5f8('0x36')],{'$or':_[_0xd5f8('0x39')](_0x1daf0c[_0xd5f8('0x31')],function(_0x2e26bc){var _0x5897c6={};_0x5897c6[_0x2e26bc]={'$like':'%'+_0x4b3993[_0xd5f8('0x2c')][_0xd5f8('0x37')]+'%'};return _0x5897c6;})});}_0x1daf0c=_[_0xd5f8('0x38')]({},_0x1daf0c,_0x4b3993[_0xd5f8('0x3c')]);return db[_0xd5f8('0x47')]['count']({'where':_0x1daf0c[_0xd5f8('0x36')]})[_0xd5f8('0x23')](function(_0x560329){_0x205950[_0xd5f8('0x1d')]=_0x560329;if(_0x4b3993[_0xd5f8('0x2c')][_0xd5f8('0x3d')]){_0x1daf0c['include']=[{'all':!![]}];}return db[_0xd5f8('0x47')][_0xd5f8('0x4c')](_0x1daf0c);})[_0xd5f8('0x23')](function(_0x37f217){_0x205950['rows']=_0x37f217;return _0x205950;});}})[_0xd5f8('0x23')](respondWithFilteredResult(_0x906785,_0x1daf0c))[_0xd5f8('0x3f')](handleError(_0x906785,null));}; \ No newline at end of file +var _0x252b=['fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','merge','create','body','find','describe','getQuestions','findOne','JscriptyQuestionReport','length','SessionId','options','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','JscriptySessionReport'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x252b,0x119));var _0xb252=function(_0x5df25b,_0x1bc928){_0x5df25b=_0x5df25b-0x0;var _0x19f252=_0x252b[_0x5df25b];return _0x19f252;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb252('0x0'));var rimraf=require(_0xb252('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb252('0x2'));var rp=require(_0xb252('0x3'));var moment=require('moment');var BPromise=require(_0xb252('0x4'));var Mustache=require(_0xb252('0x5'));var util=require(_0xb252('0x6'));var path=require('path');var sox=require(_0xb252('0x7'));var csv=require(_0xb252('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb252('0x9'));var squel=require('squel');var crypto=require(_0xb252('0xa'));var jsforce=require(_0xb252('0xb'));var deskjs=require(_0xb252('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb252('0xd'));var Papa=require(_0xb252('0xe'));var Redis=require(_0xb252('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb252('0x10'));var as=require(_0xb252('0x11'));var hardwareService=require(_0xb252('0x12'));var logger=require(_0xb252('0x13'))(_0xb252('0x14'));var utils=require(_0xb252('0x15'));var config=require(_0xb252('0x16'));var db=require(_0xb252('0x17'))['db'];function respondWithStatusCode(_0x1ebb5f,_0x4fbb92){_0x4fbb92=_0x4fbb92||0xcc;return function(_0x1df046){if(_0x1df046){return _0x1ebb5f[_0xb252('0x18')](_0x4fbb92);}return _0x1ebb5f[_0xb252('0x19')](_0x4fbb92)[_0xb252('0x1a')]();};}function respondWithResult(_0x2deb27,_0x44142a){_0x44142a=_0x44142a||0xc8;return function(_0x348e33){if(_0x348e33){return _0x2deb27[_0xb252('0x19')](_0x44142a)[_0xb252('0x1b')](_0x348e33);}};}function respondWithFilteredResult(_0x437156,_0x1d47fb){return function(_0xf06028){if(_0xf06028){var _0x3da747=_0xf06028['count'],_0x55319b=_0x1d47fb[_0xb252('0x1c')],_0x31b105=_0x1d47fb[_0xb252('0x1c')]+_0x1d47fb['limit'],_0x2c37bd;if(_0x31b105>=_0x3da747){_0x31b105=_0x3da747;_0x2c37bd=0xc8;}else{_0x2c37bd=0xce;}_0x437156[_0xb252('0x19')](_0x2c37bd);return _0x437156[_0xb252('0x1d')](_0xb252('0x1e'),_0x55319b+'-'+_0x31b105+'/'+_0x3da747)[_0xb252('0x1b')](_0xf06028);}return null;};}function patchUpdates(_0xcb36b5){return function(_0xa66884){try{jsonpatch[_0xb252('0x1f')](_0xa66884,_0xcb36b5,!![]);}catch(_0x3677f9){return BPromise[_0xb252('0x20')](_0x3677f9);}return _0xa66884[_0xb252('0x21')]();};}function saveUpdates(_0x2be149,_0x15f497){return function(_0x14494b){if(_0x14494b){return _0x14494b[_0xb252('0x22')](_0x2be149)[_0xb252('0x23')](function(_0x4e66e5){return _0x4e66e5;});}return null;};}function removeEntity(_0x19f17b,_0x4bb978){return function(_0x509cb5){if(_0x509cb5){return _0x509cb5[_0xb252('0x24')]()[_0xb252('0x23')](function(){_0x19f17b[_0xb252('0x19')](0xcc)[_0xb252('0x1a')]();});}};}function handleEntityNotFound(_0x6288ca,_0x349076){return function(_0x224d7e){if(!_0x224d7e){_0x6288ca['sendStatus'](0x194);}return _0x224d7e;};}function handleError(_0x520d5c,_0x58340a){_0x58340a=_0x58340a||0x1f4;return function(_0x596d7d){logger[_0xb252('0x25')](_0x596d7d['stack']);if(_0x596d7d[_0xb252('0x26')]){delete _0x596d7d[_0xb252('0x26')];}_0x520d5c[_0xb252('0x19')](_0x58340a)[_0xb252('0x27')](_0x596d7d);};}exports[_0xb252('0x28')]=function(_0xad39af,_0x4176d2){var _0x1a4f13={},_0x55f5ae={},_0x14501b={'count':0x0,'rows':[]};var _0x223f9d=_[_0xb252('0x29')](db[_0xb252('0x2a')]['rawAttributes'],function(_0x18dc38){return{'name':_0x18dc38[_0xb252('0x2b')],'type':_0x18dc38[_0xb252('0x2c')][_0xb252('0x2d')]};});_0x55f5ae[_0xb252('0x2e')]=_[_0xb252('0x29')](_0x223f9d,_0xb252('0x26'));_0x55f5ae[_0xb252('0x2f')]=_[_0xb252('0x30')](_0xad39af[_0xb252('0x2f')]);_0x55f5ae[_0xb252('0x31')]=_[_0xb252('0x32')](_0x55f5ae[_0xb252('0x2e')],_0x55f5ae[_0xb252('0x2f')]);_0x1a4f13[_0xb252('0x33')]=_['intersection'](_0x55f5ae[_0xb252('0x2e')],qs[_0xb252('0x34')](_0xad39af['query']['fields']));_0x1a4f13[_0xb252('0x33')]=_0x1a4f13[_0xb252('0x33')]['length']?_0x1a4f13['attributes']:_0x55f5ae[_0xb252('0x2e')];if(!_0xad39af[_0xb252('0x2f')][_0xb252('0x35')](_0xb252('0x36'))){_0x1a4f13[_0xb252('0x37')]=qs[_0xb252('0x37')](_0xad39af[_0xb252('0x2f')][_0xb252('0x37')]);_0x1a4f13[_0xb252('0x1c')]=qs[_0xb252('0x1c')](_0xad39af[_0xb252('0x2f')]['offset']);}_0x1a4f13[_0xb252('0x38')]=qs[_0xb252('0x39')](_0xad39af[_0xb252('0x2f')][_0xb252('0x39')]);_0x1a4f13['where']=qs[_0xb252('0x31')](_[_0xb252('0x3a')](_0xad39af[_0xb252('0x2f')],_0x55f5ae[_0xb252('0x31')]));if(_0xad39af[_0xb252('0x2f')][_0xb252('0x3b')]){_0x1a4f13[_0xb252('0x3c')]=_['merge'](_0x1a4f13[_0xb252('0x3c')],{'$or':_['map'](_0x223f9d,function(_0x35a740){if(_0x35a740[_0xb252('0x2c')]!==_0xb252('0x3d')){var _0x1da354={};_0x1da354[_0x35a740[_0xb252('0x26')]]={'$like':'%'+_0xad39af[_0xb252('0x2f')][_0xb252('0x3b')]+'%'};return _0x1da354;}})});}_0x1a4f13=_['merge']({},_0x1a4f13,_0xad39af['options']);var _0x3b91be={'where':_0x1a4f13[_0xb252('0x3c')]};return db[_0xb252('0x2a')][_0xb252('0x3e')](_0x3b91be)[_0xb252('0x23')](function(_0x723a3c){_0x14501b[_0xb252('0x3e')]=_0x723a3c;if(_0xad39af[_0xb252('0x2f')][_0xb252('0x3f')]){_0x1a4f13[_0xb252('0x40')]=[{'all':!![]}];}return db[_0xb252('0x2a')][_0xb252('0x41')](_0x1a4f13);})[_0xb252('0x23')](function(_0x548d92){_0x14501b[_0xb252('0x42')]=_0x548d92;return _0x14501b;})['then'](respondWithFilteredResult(_0x4176d2,_0x1a4f13))[_0xb252('0x43')](handleError(_0x4176d2,null));};exports[_0xb252('0x44')]=function(_0x5765bf,_0x45c0b5){var _0x1ec083={'raw':!![],'where':{'id':_0x5765bf[_0xb252('0x45')]['id']}},_0x528e36={};_0x528e36[_0xb252('0x2e')]=_['keys'](db[_0xb252('0x2a')]['rawAttributes']);_0x528e36[_0xb252('0x2f')]=_[_0xb252('0x30')](_0x5765bf[_0xb252('0x2f')]);_0x528e36[_0xb252('0x31')]=_[_0xb252('0x32')](_0x528e36[_0xb252('0x2e')],_0x528e36['query']);_0x1ec083[_0xb252('0x33')]=_[_0xb252('0x32')](_0x528e36[_0xb252('0x2e')],qs[_0xb252('0x34')](_0x5765bf[_0xb252('0x2f')]['fields']));_0x1ec083[_0xb252('0x33')]=_0x1ec083[_0xb252('0x33')]['length']?_0x1ec083[_0xb252('0x33')]:_0x528e36[_0xb252('0x2e')];if(_0x5765bf['query']['includeAll']){_0x1ec083[_0xb252('0x40')]=[{'all':!![]}];}_0x1ec083=_[_0xb252('0x46')]({},_0x1ec083,_0x5765bf['options']);return db[_0xb252('0x2a')]['find'](_0x1ec083)[_0xb252('0x23')](handleEntityNotFound(_0x45c0b5,null))[_0xb252('0x23')](respondWithResult(_0x45c0b5,null))['catch'](handleError(_0x45c0b5,null));};exports[_0xb252('0x47')]=function(_0x4e7dae,_0xf57d42){return db[_0xb252('0x2a')]['create'](_0x4e7dae[_0xb252('0x48')],{})[_0xb252('0x23')](respondWithResult(_0xf57d42,0xc9))[_0xb252('0x43')](handleError(_0xf57d42,null));};exports[_0xb252('0x22')]=function(_0x484495,_0x149874){if(_0x484495[_0xb252('0x48')]['id']){delete _0x484495['body']['id'];}return db['JscriptySessionReport']['find']({'where':{'id':_0x484495[_0xb252('0x45')]['id']}})[_0xb252('0x23')](handleEntityNotFound(_0x149874,null))['then'](saveUpdates(_0x484495['body'],null))[_0xb252('0x23')](respondWithResult(_0x149874,null))[_0xb252('0x43')](handleError(_0x149874,null));};exports[_0xb252('0x24')]=function(_0x48f601,_0x3f1d7a){return db[_0xb252('0x2a')][_0xb252('0x49')]({'where':{'id':_0x48f601[_0xb252('0x45')]['id']}})[_0xb252('0x23')](handleEntityNotFound(_0x3f1d7a,null))[_0xb252('0x23')](removeEntity(_0x3f1d7a,null))['catch'](handleError(_0x3f1d7a,null));};exports[_0xb252('0x4a')]=function(_0x598d38,_0x111337){return db[_0xb252('0x2a')][_0xb252('0x4a')]()[_0xb252('0x23')](respondWithResult(_0x111337,null))[_0xb252('0x43')](handleError(_0x111337,null));};exports[_0xb252('0x4b')]=function(_0x54ed30,_0x14ba93,_0x9ffa4c){var _0xae8c3a={'raw':!![],'where':{}};var _0x6c5cf9={};var _0x391982={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0xb252('0x4c')]({'where':{'id':_0x54ed30[_0xb252('0x45')]['id']}})[_0xb252('0x23')](handleEntityNotFound(_0x14ba93,null))[_0xb252('0x23')](function(_0x56a502){if(_0x56a502){_0x6c5cf9[_0xb252('0x2e')]=_['keys'](db[_0xb252('0x4d')]['rawAttributes']);_0x6c5cf9[_0xb252('0x2f')]=_[_0xb252('0x30')](_0x54ed30[_0xb252('0x2f')]);_0x6c5cf9[_0xb252('0x31')]=_[_0xb252('0x32')](_0x6c5cf9['model'],_0x6c5cf9[_0xb252('0x2f')]);_0xae8c3a[_0xb252('0x33')]=_[_0xb252('0x32')](_0x6c5cf9[_0xb252('0x2e')],qs[_0xb252('0x34')](_0x54ed30[_0xb252('0x2f')][_0xb252('0x34')]));_0xae8c3a[_0xb252('0x33')]=_0xae8c3a[_0xb252('0x33')][_0xb252('0x4e')]?_0xae8c3a[_0xb252('0x33')]:_0x6c5cf9['model'];if(!_0x54ed30[_0xb252('0x2f')][_0xb252('0x35')]('nolimit')){_0xae8c3a['limit']=qs[_0xb252('0x37')](_0x54ed30[_0xb252('0x2f')][_0xb252('0x37')]);_0xae8c3a[_0xb252('0x1c')]=qs[_0xb252('0x1c')](_0x54ed30[_0xb252('0x2f')]['offset']);}_0xae8c3a[_0xb252('0x38')]=qs['sort'](_0x54ed30[_0xb252('0x2f')][_0xb252('0x39')]);_0xae8c3a[_0xb252('0x3c')]=qs[_0xb252('0x31')](_[_0xb252('0x3a')](_0x54ed30['query'],_0x6c5cf9[_0xb252('0x31')]));_0xae8c3a[_0xb252('0x3c')][_0xb252('0x4f')]=_0x56a502['id'];if(_0x54ed30[_0xb252('0x2f')]['filter']){_0xae8c3a[_0xb252('0x3c')]=_[_0xb252('0x46')](_0xae8c3a[_0xb252('0x3c')],{'$or':_[_0xb252('0x29')](_0xae8c3a['attributes'],function(_0x16dc09){var _0x43c227={};_0x43c227[_0x16dc09]={'$like':'%'+_0x54ed30[_0xb252('0x2f')][_0xb252('0x3b')]+'%'};return _0x43c227;})});}_0xae8c3a=_[_0xb252('0x46')]({},_0xae8c3a,_0x54ed30[_0xb252('0x50')]);return db[_0xb252('0x4d')][_0xb252('0x3e')]({'where':_0xae8c3a['where']})[_0xb252('0x23')](function(_0x2d772b){_0x391982[_0xb252('0x3e')]=_0x2d772b;if(_0x54ed30[_0xb252('0x2f')]['includeAll']){_0xae8c3a[_0xb252('0x40')]=[{'all':!![]}];}return db[_0xb252('0x4d')]['findAll'](_0xae8c3a);})[_0xb252('0x23')](function(_0x500874){_0x391982[_0xb252('0x42')]=_0x500874;return _0x391982;});}})[_0xb252('0x23')](respondWithFilteredResult(_0x14ba93,_0xae8c3a))[_0xb252('0x43')](handleError(_0x14ba93,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 3af899d..ceee8bc 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 _0x06b3=['api','moment','bluebird','../../config/environment','./jscriptySessionReport.attributes','define','report_jscripty_sessions','util','../../config/logger'];(function(_0x23f00c,_0x36b416){var _0x26754f=function(_0x356e66){while(--_0x356e66){_0x23f00c['push'](_0x23f00c['shift']());}};_0x26754f(++_0x36b416);}(_0x06b3,0xcd));var _0x306b=function(_0x21b93f,_0x13044f){_0x21b93f=_0x21b93f-0x0;var _0x56d5c4=_0x06b3[_0x21b93f];return _0x56d5c4;};'use strict';var _=require('lodash');var util=require(_0x306b('0x0'));var logger=require(_0x306b('0x1'))(_0x306b('0x2'));var moment=require(_0x306b('0x3'));var BPromise=require(_0x306b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x306b('0x5'));var attributes=require(_0x306b('0x6'));module['exports']=function(_0x4adae4,_0x5177e5){return _0x4adae4[_0x306b('0x7')]('JscriptySessionReport',attributes,{'tableName':_0x306b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c74=['report_jscripty_sessions','lodash','util','api','moment','bluebird','request-promise','path','./jscriptySessionReport.attributes','exports','define'];(function(_0x5959c9,_0x2ed153){var _0x4ffcbc=function(_0x459b7a){while(--_0x459b7a){_0x5959c9['push'](_0x5959c9['shift']());}};_0x4ffcbc(++_0x2ed153);}(_0x7c74,0x11f));var _0x47c7=function(_0x39f34f,_0x298f45){_0x39f34f=_0x39f34f-0x0;var _0x59fee1=_0x7c74[_0x39f34f];return _0x59fee1;};'use strict';var _=require(_0x47c7('0x0'));var util=require(_0x47c7('0x1'));var logger=require('../../config/logger')(_0x47c7('0x2'));var moment=require(_0x47c7('0x3'));var BPromise=require(_0x47c7('0x4'));var rp=require(_0x47c7('0x5'));var fs=require('fs');var path=require(_0x47c7('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x47c7('0x7'));module[_0x47c7('0x8')]=function(_0x3a20fb,_0x48351a){return _0x3a20fb[_0x47c7('0x9')]('JscriptySessionReport',attributes,{'tableName':_0x47c7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 3877b2c..1f512b9 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 _0x0be1=['then','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','http'];(function(_0x19dab2,_0x3432ff){var _0x456066=function(_0x2766a9){while(--_0x2766a9){_0x19dab2['push'](_0x19dab2['shift']());}};_0x456066(++_0x3432ff);}(_0x0be1,0x156));var _0x10be=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0x0be1[_0x1a72f3];return _0x57ef47;};'use strict';var _=require(_0x10be('0x0'));var util=require(_0x10be('0x1'));var moment=require(_0x10be('0x2'));var BPromise=require(_0x10be('0x3'));var rs=require(_0x10be('0x4'));var fs=require('fs');var Redis=require(_0x10be('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x10be('0x6'));var logger=require('../../config/logger')(_0x10be('0x7'));var config=require('../../config/environment');var jayson=require(_0x10be('0x8'));var client=jayson['client'][_0x10be('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe85996,_0x58ba04,_0x493ba2){return new BPromise(function(_0x5cbe05,_0x1b743e){return client['request'](_0xe85996,_0x493ba2)[_0x10be('0xa')](function(_0x3507c1){logger['info'](_0x10be('0xb'),_0x58ba04,_0x10be('0xc'));logger[_0x10be('0xd')](_0x10be('0xe'),_0x58ba04,_0x10be('0xc'),JSON[_0x10be('0xf')](_0x3507c1));if(_0x3507c1['error']){if(_0x3507c1[_0x10be('0x10')][_0x10be('0x11')]===0x1f4){logger[_0x10be('0x10')](_0x10be('0xb'),_0x58ba04,_0x3507c1['error'][_0x10be('0x12')]);return _0x1b743e(_0x3507c1[_0x10be('0x10')][_0x10be('0x12')]);}logger['error'](_0x10be('0xb'),_0x58ba04,_0x3507c1[_0x10be('0x10')][_0x10be('0x12')]);return _0x5cbe05(_0x3507c1[_0x10be('0x10')]['message']);}else{logger[_0x10be('0x13')](_0x10be('0xb'),_0x58ba04,'request\x20sent');_0x5cbe05(_0x3507c1[_0x10be('0x14')]['message']);}})[_0x10be('0x15')](function(_0x3f0dfb){logger[_0x10be('0x10')](_0x10be('0xb'),_0x58ba04,_0x3f0dfb);_0x1b743e(_0x3f0dfb);});});} \ No newline at end of file +var _0xc16f=['http','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x473f60,_0x6ff2ba){var _0x2ceacc=function(_0x19ec7){while(--_0x19ec7){_0x473f60['push'](_0x473f60['shift']());}};_0x2ceacc(++_0x6ff2ba);}(_0xc16f,0x15c));var _0xfc16=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc16f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfc16('0x0'));var util=require(_0xfc16('0x1'));var moment=require(_0xfc16('0x2'));var BPromise=require(_0xfc16('0x3'));var rs=require(_0xfc16('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfc16('0x5'))(_0xfc16('0x6'));var config=require(_0xfc16('0x7'));var jayson=require(_0xfc16('0x8'));var client=jayson['client'][_0xfc16('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55d786,_0x1f8f56,_0xcff08){return new BPromise(function(_0x47f386,_0x24d01e){return client['request'](_0x55d786,_0xcff08)[_0xfc16('0xa')](function(_0x3be31d){logger[_0xfc16('0xb')](_0xfc16('0xc'),_0x1f8f56,_0xfc16('0xd'));logger['debug'](_0xfc16('0xe'),_0x1f8f56,'request\x20sent',JSON[_0xfc16('0xf')](_0x3be31d));if(_0x3be31d['error']){if(_0x3be31d[_0xfc16('0x10')][_0xfc16('0x11')]===0x1f4){logger[_0xfc16('0x10')](_0xfc16('0xc'),_0x1f8f56,_0x3be31d['error']['message']);return _0x24d01e(_0x3be31d[_0xfc16('0x10')][_0xfc16('0x12')]);}logger[_0xfc16('0x10')](_0xfc16('0xc'),_0x1f8f56,_0x3be31d[_0xfc16('0x10')][_0xfc16('0x12')]);return _0x47f386(_0x3be31d[_0xfc16('0x10')]['message']);}else{logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x1f8f56,_0xfc16('0xd'));_0x47f386(_0x3be31d[_0xfc16('0x13')][_0xfc16('0x12')]);}})[_0xfc16('0x14')](function(_0x15ada7){logger['error'](_0xfc16('0xc'),_0x1f8f56,_0x15ada7);_0x24d01e(_0x15ada7);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index aec33f1..5474939 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 _0x9850=['../../config/environment','./license.controller','index','put','isAuthenticated','update','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x9850,0x157));var _0x0985=function(_0x8268d4,_0x5e608c){_0x8268d4=_0x8268d4-0x0;var _0x28b12f=_0x9850[_0x8268d4];return _0x28b12f;};'use strict';var multer=require(_0x0985('0x0'));var util=require(_0x0985('0x1'));var path=require(_0x0985('0x2'));var timeout=require(_0x0985('0x3'));var express=require(_0x0985('0x4'));var router=express[_0x0985('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x0985('0x6'));var config=require(_0x0985('0x7'));var controller=require(_0x0985('0x8'));router['get']('/',controller[_0x0985('0x9')]);router[_0x0985('0xa')]('/:id',auth[_0x0985('0xb')](),controller[_0x0985('0xc')]);module[_0x0985('0xd')]=router; \ No newline at end of file +var _0x481a=['get','put','/:id','isAuthenticated','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller'];(function(_0x17823f,_0xffd807){var _0x51fc21=function(_0x5e4921){while(--_0x5e4921){_0x17823f['push'](_0x17823f['shift']());}};_0x51fc21(++_0xffd807);}(_0x481a,0xf5));var _0xa481=function(_0x224ad0,_0x2482bd){_0x224ad0=_0x224ad0-0x0;var _0x2e04fc=_0x481a[_0x224ad0];return _0x2e04fc;};'use strict';var multer=require(_0xa481('0x0'));var util=require('util');var path=require(_0xa481('0x1'));var timeout=require(_0xa481('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xa481('0x3'));var interaction=require(_0xa481('0x4'));var config=require(_0xa481('0x5'));var controller=require(_0xa481('0x6'));router[_0xa481('0x7')]('/',controller['index']);router[_0xa481('0x8')](_0xa481('0x9'),auth[_0xa481('0xa')](),controller['update']);module[_0xa481('0xb')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 55d62a7..a1e37e7 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(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x326f,0xd1));var _0xf326=function(_0x5cdc39,_0x5a69e7){_0x5cdc39=_0x5cdc39-0x0;var _0x37be04=_0x326f[_0x5cdc39];return _0x37be04;};'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 _0xe2fe=['STRING','INTEGER','sequelize'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xee2f('0x0'));module['exports']={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xee2f('0x1')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0xee2f('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index a884b05..81fd079 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 _0x1e8c=['update','then','destroy','error','name','index','model','keys','License','rawAttributes','query','filters','intersection','attributes','fields','length','merge','getLicense','catch','body','find','params','get','checkLicense','key','demo','html-pdf','eml-format','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','set','Content-Range','apply','reject','save'];(function(_0x599b73,_0x12cb1d){var _0x416aa4=function(_0x261003){while(--_0x261003){_0x599b73['push'](_0x599b73['shift']());}};_0x416aa4(++_0x12cb1d);}(_0x1e8c,0xc5));var _0xc1e8=function(_0x21f3c3,_0x42e32c){_0x21f3c3=_0x21f3c3-0x0;var _0x15957=_0x1e8c[_0x21f3c3];return _0x15957;};'use strict';var pdf=require(_0xc1e8('0x0'));var emlformat=require(_0xc1e8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc1e8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc1e8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc1e8('0x4'));var util=require(_0xc1e8('0x5'));var path=require(_0xc1e8('0x6'));var sox=require(_0xc1e8('0x7'));var csv=require(_0xc1e8('0x8'));var ejs=require(_0xc1e8('0x9'));var fs=require('fs');var _=require(_0xc1e8('0xa'));var squel=require('squel');var crypto=require(_0xc1e8('0xb'));var jsforce=require(_0xc1e8('0xc'));var deskjs=require(_0xc1e8('0xd'));var toCsv=require(_0xc1e8('0x8'));var querystring=require(_0xc1e8('0xe'));var Papa=require(_0xc1e8('0xf'));var Redis=require('ioredis');var authService=require(_0xc1e8('0x10'));var qs=require(_0xc1e8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc1e8('0x12'))('api');var utils=require(_0xc1e8('0x13'));var config=require(_0xc1e8('0x14'));var db=require(_0xc1e8('0x15'))['db'];function respondWithStatusCode(_0x19d7ff,_0x2eadb3){_0x2eadb3=_0x2eadb3||0xcc;return function(_0x59e876){if(_0x59e876){return _0x19d7ff[_0xc1e8('0x16')](_0x2eadb3);}return _0x19d7ff[_0xc1e8('0x17')](_0x2eadb3)[_0xc1e8('0x18')]();};}function respondWithResult(_0x2f1c8d,_0x474129){_0x474129=_0x474129||0xc8;return function(_0x407cee){if(_0x407cee){return _0x2f1c8d[_0xc1e8('0x17')](_0x474129)[_0xc1e8('0x19')](_0x407cee);}};}function respondWithFilteredResult(_0x5db2f5,_0x5692c6){return function(_0x3e1abf){if(_0x3e1abf){var _0x46f9a5=_0x3e1abf['count'],_0x58f1b6=_0x5692c6['offset'],_0x17ea23=_0x5692c6['offset']+_0x5692c6['limit'],_0x2962f1;if(_0x17ea23>=_0x46f9a5){_0x17ea23=_0x46f9a5;_0x2962f1=0xc8;}else{_0x2962f1=0xce;}_0x5db2f5['status'](_0x2962f1);return _0x5db2f5[_0xc1e8('0x1a')](_0xc1e8('0x1b'),_0x58f1b6+'-'+_0x17ea23+'/'+_0x46f9a5)[_0xc1e8('0x19')](_0x3e1abf);}return null;};}function patchUpdates(_0x4b27a0){return function(_0xaec8ac){try{jsonpatch[_0xc1e8('0x1c')](_0xaec8ac,_0x4b27a0,!![]);}catch(_0x2e27f1){return BPromise[_0xc1e8('0x1d')](_0x2e27f1);}return _0xaec8ac[_0xc1e8('0x1e')]();};}function saveUpdates(_0x46a4b6,_0x3c3ca8){return function(_0x1d6dc6){if(_0x1d6dc6){return _0x1d6dc6[_0xc1e8('0x1f')](_0x46a4b6)[_0xc1e8('0x20')](function(_0x443ad8){return _0x443ad8;});}return null;};}function removeEntity(_0x40b57c,_0x29e6ee){return function(_0x409a13){if(_0x409a13){return _0x409a13[_0xc1e8('0x21')]()['then'](function(){_0x40b57c['status'](0xcc)[_0xc1e8('0x18')]();});}};}function handleEntityNotFound(_0x38f683,_0x54af19){return function(_0x4eaeb8){if(!_0x4eaeb8){_0x38f683['sendStatus'](0x194);}return _0x4eaeb8;};}function handleError(_0x363d2a,_0x5440ce){_0x5440ce=_0x5440ce||0x1f4;return function(_0x9ee291){logger[_0xc1e8('0x22')](_0x9ee291['stack']);if(_0x9ee291[_0xc1e8('0x23')]){delete _0x9ee291[_0xc1e8('0x23')];}_0x363d2a[_0xc1e8('0x17')](_0x5440ce)['send'](_0x9ee291);};}var utilLicense=require('../../config/license/util');exports[_0xc1e8('0x24')]=function(_0x5f2601,_0x4ca011){var _0x2985bf={'raw':!![],'where':{'id':0x1}},_0x558232={};_0x558232[_0xc1e8('0x25')]=_[_0xc1e8('0x26')](db[_0xc1e8('0x27')][_0xc1e8('0x28')]);_0x558232['query']=_['keys'](_0x5f2601[_0xc1e8('0x29')]);_0x558232[_0xc1e8('0x2a')]=_[_0xc1e8('0x2b')](_0x558232[_0xc1e8('0x25')],_0x558232[_0xc1e8('0x29')]);_0x2985bf[_0xc1e8('0x2c')]=_[_0xc1e8('0x2b')](_0x558232[_0xc1e8('0x25')],qs[_0xc1e8('0x2d')](_0x5f2601[_0xc1e8('0x29')][_0xc1e8('0x2d')]));_0x2985bf[_0xc1e8('0x2c')]=_0x2985bf[_0xc1e8('0x2c')][_0xc1e8('0x2e')]?_0x2985bf[_0xc1e8('0x2c')]:_0x558232[_0xc1e8('0x25')];_0x2985bf=_[_0xc1e8('0x2f')]({},_0x2985bf,_0x5f2601['options']);return utilLicense[_0xc1e8('0x30')](_0x2985bf)[_0xc1e8('0x20')](respondWithResult(_0x4ca011,null))[_0xc1e8('0x31')](handleError(_0x4ca011,null));};exports[_0xc1e8('0x1f')]=function(_0x44af79,_0x29caf0){if(_0x44af79[_0xc1e8('0x32')]['id']){delete _0x44af79[_0xc1e8('0x32')]['id'];}return db[_0xc1e8('0x27')][_0xc1e8('0x33')]({'where':{'id':_0x44af79[_0xc1e8('0x34')]['id']}})[_0xc1e8('0x20')](handleEntityNotFound(_0x29caf0,null))[_0xc1e8('0x20')](function(_0x24750d){var _0x232d2d=_0x24750d[_0xc1e8('0x35')]({'plain':!![]});return utilLicense[_0xc1e8('0x36')](_0x232d2d,_0x44af79[_0xc1e8('0x32')][_0xc1e8('0x37')]);})[_0xc1e8('0x20')](function(_0x3196bb){if(!_0x3196bb[_0xc1e8('0x38')]){return saveUpdates(_0x44af79['body'],null);}return _0x3196bb;})['then'](respondWithResult(_0x29caf0,null))[_0xc1e8('0x31')](handleError(_0x29caf0,null));}; \ No newline at end of file +var _0x9aad=['filters','intersection','attributes','fields','length','merge','options','getLicense','catch','update','body','find','get','checkLicense','key','demo','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','reject','then','destroy','error','stack','name','../../config/license/util','index','model','License','query'];(function(_0x34d114,_0x4e1883){var _0x12caca=function(_0x5dda50){while(--_0x5dda50){_0x34d114['push'](_0x34d114['shift']());}};_0x12caca(++_0x4e1883);}(_0x9aad,0xc1));var _0xd9aa=function(_0x180beb,_0xd4e423){_0x180beb=_0x180beb-0x0;var _0x2deb1c=_0x9aad[_0x180beb];return _0x2deb1c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd9aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd9aa('0x1'));var jsonpatch=require(_0xd9aa('0x2'));var rp=require(_0xd9aa('0x3'));var moment=require(_0xd9aa('0x4'));var BPromise=require(_0xd9aa('0x5'));var Mustache=require(_0xd9aa('0x6'));var util=require(_0xd9aa('0x7'));var path=require(_0xd9aa('0x8'));var sox=require(_0xd9aa('0x9'));var csv=require(_0xd9aa('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd9aa('0xb'));var squel=require('squel');var crypto=require(_0xd9aa('0xc'));var jsforce=require(_0xd9aa('0xd'));var deskjs=require(_0xd9aa('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd9aa('0xf'));var authService=require(_0xd9aa('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd9aa('0x11'));var hardwareService=require(_0xd9aa('0x12'));var logger=require(_0xd9aa('0x13'))(_0xd9aa('0x14'));var utils=require(_0xd9aa('0x15'));var config=require(_0xd9aa('0x16'));var db=require(_0xd9aa('0x17'))['db'];function respondWithStatusCode(_0x4957e8,_0x5348d5){_0x5348d5=_0x5348d5||0xcc;return function(_0x43d642){if(_0x43d642){return _0x4957e8[_0xd9aa('0x18')](_0x5348d5);}return _0x4957e8[_0xd9aa('0x19')](_0x5348d5)[_0xd9aa('0x1a')]();};}function respondWithResult(_0x1101f3,_0x1ee638){_0x1ee638=_0x1ee638||0xc8;return function(_0x1226a8){if(_0x1226a8){return _0x1101f3['status'](_0x1ee638)['json'](_0x1226a8);}};}function respondWithFilteredResult(_0x22f8bf,_0x58803f){return function(_0x21d8c5){if(_0x21d8c5){var _0x45dd59=_0x21d8c5[_0xd9aa('0x1b')],_0x37f499=_0x58803f[_0xd9aa('0x1c')],_0x41fe75=_0x58803f[_0xd9aa('0x1c')]+_0x58803f['limit'],_0x1919a9;if(_0x41fe75>=_0x45dd59){_0x41fe75=_0x45dd59;_0x1919a9=0xc8;}else{_0x1919a9=0xce;}_0x22f8bf['status'](_0x1919a9);return _0x22f8bf[_0xd9aa('0x1d')](_0xd9aa('0x1e'),_0x37f499+'-'+_0x41fe75+'/'+_0x45dd59)[_0xd9aa('0x1f')](_0x21d8c5);}return null;};}function patchUpdates(_0x316e37){return function(_0x3519af){try{jsonpatch['apply'](_0x3519af,_0x316e37,!![]);}catch(_0x29759d){return BPromise[_0xd9aa('0x20')](_0x29759d);}return _0x3519af['save']();};}function saveUpdates(_0x4d6c93,_0x3dbe84){return function(_0x108035){if(_0x108035){return _0x108035['update'](_0x4d6c93)[_0xd9aa('0x21')](function(_0x3213a4){return _0x3213a4;});}return null;};}function removeEntity(_0x118c05,_0x44b723){return function(_0xbb614d){if(_0xbb614d){return _0xbb614d[_0xd9aa('0x22')]()[_0xd9aa('0x21')](function(){_0x118c05[_0xd9aa('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15ef84,_0x330503){return function(_0x3d605e){if(!_0x3d605e){_0x15ef84[_0xd9aa('0x18')](0x194);}return _0x3d605e;};}function handleError(_0xb57060,_0x315a8d){_0x315a8d=_0x315a8d||0x1f4;return function(_0x452371){logger[_0xd9aa('0x23')](_0x452371[_0xd9aa('0x24')]);if(_0x452371['name']){delete _0x452371[_0xd9aa('0x25')];}_0xb57060['status'](_0x315a8d)['send'](_0x452371);};}var utilLicense=require(_0xd9aa('0x26'));exports[_0xd9aa('0x27')]=function(_0x36870c,_0x30a115){var _0xd117ec={'raw':!![],'where':{'id':0x1}},_0x61b28e={};_0x61b28e[_0xd9aa('0x28')]=_['keys'](db[_0xd9aa('0x29')]['rawAttributes']);_0x61b28e['query']=_['keys'](_0x36870c[_0xd9aa('0x2a')]);_0x61b28e[_0xd9aa('0x2b')]=_[_0xd9aa('0x2c')](_0x61b28e[_0xd9aa('0x28')],_0x61b28e['query']);_0xd117ec[_0xd9aa('0x2d')]=_['intersection'](_0x61b28e[_0xd9aa('0x28')],qs[_0xd9aa('0x2e')](_0x36870c[_0xd9aa('0x2a')]['fields']));_0xd117ec[_0xd9aa('0x2d')]=_0xd117ec[_0xd9aa('0x2d')][_0xd9aa('0x2f')]?_0xd117ec[_0xd9aa('0x2d')]:_0x61b28e['model'];_0xd117ec=_[_0xd9aa('0x30')]({},_0xd117ec,_0x36870c[_0xd9aa('0x31')]);return utilLicense[_0xd9aa('0x32')](_0xd117ec)[_0xd9aa('0x21')](respondWithResult(_0x30a115,null))[_0xd9aa('0x33')](handleError(_0x30a115,null));};exports[_0xd9aa('0x34')]=function(_0xf4a471,_0x88fdd4){if(_0xf4a471['body']['id']){delete _0xf4a471[_0xd9aa('0x35')]['id'];}return db[_0xd9aa('0x29')][_0xd9aa('0x36')]({'where':{'id':_0xf4a471['params']['id']}})[_0xd9aa('0x21')](handleEntityNotFound(_0x88fdd4,null))['then'](function(_0x2dbb57){var _0x5b8b65=_0x2dbb57[_0xd9aa('0x37')]({'plain':!![]});return utilLicense[_0xd9aa('0x38')](_0x5b8b65,_0xf4a471[_0xd9aa('0x35')][_0xd9aa('0x39')]);})['then'](function(_0x108d52){if(!_0x108d52[_0xd9aa('0x3a')]){return saveUpdates(_0xf4a471[_0xd9aa('0x35')],null);}return _0x108d52;})[_0xd9aa('0x21')](respondWithResult(_0x88fdd4,null))[_0xd9aa('0x33')](handleError(_0x88fdd4,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 59be0e3..7449d42 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 _0xbafd=['../../config/environment','exports','define','license','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0xe4aed0,_0x34e4c2){var _0x25d87f=function(_0x59433c){while(--_0x59433c){_0xe4aed0['push'](_0xe4aed0['shift']());}};_0x25d87f(++_0x34e4c2);}(_0xbafd,0xac));var _0xdbaf=function(_0x276aa3,_0x4ca868){_0x276aa3=_0x276aa3-0x0;var _0x139ae5=_0xbafd[_0x276aa3];return _0x139ae5;};'use strict';var _=require(_0xdbaf('0x0'));var util=require(_0xdbaf('0x1'));var logger=require(_0xdbaf('0x2'))(_0xdbaf('0x3'));var moment=require(_0xdbaf('0x4'));var BPromise=require(_0xdbaf('0x5'));var rp=require(_0xdbaf('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdbaf('0x7'));var config=require(_0xdbaf('0x8'));var attributes=require('./license.attributes');module[_0xdbaf('0x9')]=function(_0x593cfc,_0xbc59f5){return _0x593cfc[_0xdbaf('0xa')]('License',attributes,{'tableName':_0xdbaf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8cb5=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./license.attributes','exports','define','License','lodash'];(function(_0x1e8c7e,_0x5dce55){var _0xf8fb10=function(_0x3e18d4){while(--_0x3e18d4){_0x1e8c7e['push'](_0x1e8c7e['shift']());}};_0xf8fb10(++_0x5dce55);}(_0x8cb5,0x19f));var _0x58cb=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x8cb5[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x58cb('0x0'));var util=require(_0x58cb('0x1'));var logger=require(_0x58cb('0x2'))(_0x58cb('0x3'));var moment=require(_0x58cb('0x4'));var BPromise=require(_0x58cb('0x5'));var rp=require(_0x58cb('0x6'));var fs=require('fs');var path=require(_0x58cb('0x7'));var rimraf=require('rimraf');var config=require(_0x58cb('0x8'));var attributes=require(_0x58cb('0x9'));module[_0x58cb('0xa')]=function(_0x369626,_0x2798de){return _0x369626[_0x58cb('0xb')](_0x58cb('0xc'),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 d6b919d..c20d4ce 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 _0x38c9=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x4ffff8,_0x10bbdb){var _0x3915f6=function(_0x863c0b){while(--_0x863c0b){_0x4ffff8['push'](_0x4ffff8['shift']());}};_0x3915f6(++_0x10bbdb);}(_0x38c9,0x199));var _0x938c=function(_0x4cd21c,_0x35fa45){_0x4cd21c=_0x4cd21c-0x0;var _0x5d8e5e=_0x38c9[_0x4cd21c];return _0x5d8e5e;};'use strict';var _=require(_0x938c('0x0'));var util=require(_0x938c('0x1'));var moment=require(_0x938c('0x2'));var BPromise=require('bluebird');var rs=require(_0x938c('0x3'));var fs=require('fs');var Redis=require(_0x938c('0x4'));var db=require(_0x938c('0x5'))['db'];var utils=require(_0x938c('0x6'));var logger=require('../../config/logger')(_0x938c('0x7'));var config=require(_0x938c('0x8'));var jayson=require(_0x938c('0x9'));var client=jayson[_0x938c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x283d42,_0x332b40,_0x412b77){return new BPromise(function(_0x2dd9f4,_0x4aa9a5){return client['request'](_0x283d42,_0x412b77)[_0x938c('0xb')](function(_0x706ab){logger[_0x938c('0xc')](_0x938c('0xd'),_0x332b40,_0x938c('0xe'));logger[_0x938c('0xf')](_0x938c('0x10'),_0x332b40,_0x938c('0xe'),JSON[_0x938c('0x11')](_0x706ab));if(_0x706ab[_0x938c('0x12')]){if(_0x706ab[_0x938c('0x12')][_0x938c('0x13')]===0x1f4){logger[_0x938c('0x12')](_0x938c('0xd'),_0x332b40,_0x706ab[_0x938c('0x12')]['message']);return _0x4aa9a5(_0x706ab[_0x938c('0x12')]['message']);}logger[_0x938c('0x12')](_0x938c('0xd'),_0x332b40,_0x706ab[_0x938c('0x12')]['message']);return _0x2dd9f4(_0x706ab[_0x938c('0x12')][_0x938c('0x14')]);}else{logger['info'](_0x938c('0xd'),_0x332b40,_0x938c('0xe'));_0x2dd9f4(_0x706ab[_0x938c('0x15')][_0x938c('0x14')]);}})[_0x938c('0x16')](function(_0x5b5858){logger[_0x938c('0x12')](_0x938c('0xd'),_0x332b40,_0x5b5858);_0x4aa9a5(_0x5b5858);});});} \ No newline at end of file +var _0xe148=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','License,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','catch','lodash','util'];(function(_0x358fd3,_0x4a9c44){var _0x1ad0f3=function(_0x3c098d){while(--_0x3c098d){_0x358fd3['push'](_0x358fd3['shift']());}};_0x1ad0f3(++_0x4a9c44);}(_0xe148,0x9e));var _0x8e14=function(_0x1e9ae1,_0x10dc5d){_0x1e9ae1=_0x1e9ae1-0x0;var _0xc6bc15=_0xe148[_0x1e9ae1];return _0xc6bc15;};'use strict';var _=require(_0x8e14('0x0'));var util=require(_0x8e14('0x1'));var moment=require('moment');var BPromise=require(_0x8e14('0x2'));var rs=require(_0x8e14('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8e14('0x4'))['db'];var utils=require(_0x8e14('0x5'));var logger=require(_0x8e14('0x6'))(_0x8e14('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8e14('0x8')][_0x8e14('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d5232,_0x1a8608,_0x231d97){return new BPromise(function(_0x1e5825,_0x4149b8){return client['request'](_0x5d5232,_0x231d97)[_0x8e14('0xa')](function(_0x52bf23){logger[_0x8e14('0xb')](_0x8e14('0xc'),_0x1a8608,'request\x20sent');logger[_0x8e14('0xd')]('License,\x20%s,\x20%s,\x20%s',_0x1a8608,'request\x20sent',JSON[_0x8e14('0xe')](_0x52bf23));if(_0x52bf23[_0x8e14('0xf')]){if(_0x52bf23[_0x8e14('0xf')][_0x8e14('0x10')]===0x1f4){logger['error'](_0x8e14('0xc'),_0x1a8608,_0x52bf23['error']['message']);return _0x4149b8(_0x52bf23[_0x8e14('0xf')]['message']);}logger[_0x8e14('0xf')](_0x8e14('0xc'),_0x1a8608,_0x52bf23['error']['message']);return _0x1e5825(_0x52bf23[_0x8e14('0xf')][_0x8e14('0x11')]);}else{logger[_0x8e14('0xb')](_0x8e14('0xc'),_0x1a8608,_0x8e14('0x12'));_0x1e5825(_0x52bf23['result'][_0x8e14('0x11')]);}})[_0x8e14('0x13')](function(_0x56cbdc){logger[_0x8e14('0xf')](_0x8e14('0xc'),_0x1a8608,_0x56cbdc);_0x4149b8(_0x56cbdc);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 9bd9570..76561aa 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 _0x464f=['describe','/:id','isAuthenticated','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','/:id/verify','verifySmtp','/:id/users','getAgents','addDisposition','post','addAnswer','create','/:id/in_servers','addSmtp','addInteraction','addApplications','/:id/send','send','put','delete','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailAccount.controller','get'];(function(_0x28db27,_0x298a47){var _0x4555a0=function(_0x216112){while(--_0x216112){_0x28db27['push'](_0x28db27['shift']());}};_0x4555a0(++_0x298a47);}(_0x464f,0xc8));var _0xf464=function(_0x551fbe,_0x3a78b3){_0x551fbe=_0x551fbe-0x0;var _0x5b02ac=_0x464f[_0x551fbe];return _0x5b02ac;};'use strict';var multer=require(_0xf464('0x0'));var util=require(_0xf464('0x1'));var path=require(_0xf464('0x2'));var timeout=require(_0xf464('0x3'));var express=require(_0xf464('0x4'));var router=express[_0xf464('0x5')]();var auth=require(_0xf464('0x6'));var interaction=require(_0xf464('0x7'));var config=require('../../config/environment');var controller=require(_0xf464('0x8'));router[_0xf464('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf464('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xf464('0xa')]);router[_0xf464('0x9')](_0xf464('0xb'),auth[_0xf464('0xc')](),controller['show']);router['get'](_0xf464('0xd'),auth[_0xf464('0xc')](),controller[_0xf464('0xe')]);router['get'](_0xf464('0xf'),auth['isAuthenticated'](),controller['getAnswers']);router[_0xf464('0x9')]('/:id/in_servers',auth['isAuthenticated'](),controller['getImap']);router[_0xf464('0x9')](_0xf464('0x10'),auth[_0xf464('0xc')](),controller[_0xf464('0x11')]);router[_0xf464('0x9')](_0xf464('0x12'),auth['isAuthenticated'](),controller[_0xf464('0x13')]);router[_0xf464('0x9')](_0xf464('0x14'),auth[_0xf464('0xc')](),controller[_0xf464('0x15')]);router['get'](_0xf464('0x16'),auth[_0xf464('0xc')](),controller['getMessages']);router[_0xf464('0x9')](_0xf464('0x17'),auth[_0xf464('0xc')](),controller[_0xf464('0x18')]);router['get'](_0xf464('0x19'),auth[_0xf464('0xc')](),controller[_0xf464('0x1a')]);router['post'](_0xf464('0xd'),auth['isAuthenticated'](),controller[_0xf464('0x1b')]);router[_0xf464('0x1c')](_0xf464('0xf'),auth[_0xf464('0xc')](),controller[_0xf464('0x1d')]);router['post']('/',auth[_0xf464('0xc')](),controller[_0xf464('0x1e')]);router[_0xf464('0x1c')](_0xf464('0x1f'),auth['isAuthenticated'](),controller['addImap']);router[_0xf464('0x1c')](_0xf464('0x10'),auth['isAuthenticated'](),controller[_0xf464('0x20')]);router[_0xf464('0x1c')](_0xf464('0x12'),auth[_0xf464('0xc')](),controller[_0xf464('0x21')]);router[_0xf464('0x1c')](_0xf464('0x14'),auth['isAuthenticated'](),controller[_0xf464('0x22')]);router[_0xf464('0x1c')](_0xf464('0x23'),auth['isAuthenticated'](),controller[_0xf464('0x24')]);router['post'](_0xf464('0x19'),auth['isAuthenticated'](),controller['addAgents']);router[_0xf464('0x25')](_0xf464('0xb'),auth[_0xf464('0xc')](),controller['update']);router[_0xf464('0x26')]('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router[_0xf464('0x26')](_0xf464('0xf'),auth[_0xf464('0xc')](),controller[_0xf464('0x27')]);router[_0xf464('0x26')](_0xf464('0x1f'),auth[_0xf464('0xc')](),controller['removeImap']);router[_0xf464('0x26')]('/:id/out_servers',auth[_0xf464('0xc')](),controller['removeSmtp']);router[_0xf464('0x26')](_0xf464('0xb'),auth[_0xf464('0xc')](),controller['destroy']);router[_0xf464('0x26')](_0xf464('0x19'),auth[_0xf464('0xc')](),controller[_0xf464('0x28')]);module[_0xf464('0x29')]=router; \ No newline at end of file +var _0xd78c=['getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','addDisposition','post','create','addImap','addInteraction','/:id/applications','addApplications','/:id/send','send','put','delete','removeDispositions','removeImap','destroy','removeAgents','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions'];(function(_0x20f292,_0x4c8b90){var _0x355c92=function(_0x59386d){while(--_0x59386d){_0x20f292['push'](_0x20f292['shift']());}};_0x355c92(++_0x4c8b90);}(_0xd78c,0xd3));var _0xcd78=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xd78c[_0x1d1779];return _0x2377e9;};'use strict';var multer=require(_0xcd78('0x0'));var util=require(_0xcd78('0x1'));var path=require(_0xcd78('0x2'));var timeout=require(_0xcd78('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xcd78('0x4'));var interaction=require(_0xcd78('0x5'));var config=require(_0xcd78('0x6'));var controller=require('./mailAccount.controller');router[_0xcd78('0x7')]('/',auth[_0xcd78('0x8')](),controller[_0xcd78('0x9')]);router['get'](_0xcd78('0xa'),auth[_0xcd78('0x8')](),controller[_0xcd78('0xb')]);router[_0xcd78('0x7')](_0xcd78('0xc'),auth['isAuthenticated'](),controller[_0xcd78('0xd')]);router[_0xcd78('0x7')](_0xcd78('0xe'),auth[_0xcd78('0x8')](),controller[_0xcd78('0xf')]);router[_0xcd78('0x7')](_0xcd78('0x10'),auth[_0xcd78('0x8')](),controller[_0xcd78('0x11')]);router[_0xcd78('0x7')](_0xcd78('0x12'),auth['isAuthenticated'](),controller[_0xcd78('0x13')]);router[_0xcd78('0x7')](_0xcd78('0x14'),auth[_0xcd78('0x8')](),controller[_0xcd78('0x15')]);router['get'](_0xcd78('0x16'),auth[_0xcd78('0x8')](),controller[_0xcd78('0x17')]);router[_0xcd78('0x7')]('/:id/applications',auth[_0xcd78('0x8')](),controller[_0xcd78('0x18')]);router[_0xcd78('0x7')](_0xcd78('0x19'),auth[_0xcd78('0x8')](),controller[_0xcd78('0x1a')]);router[_0xcd78('0x7')](_0xcd78('0x1b'),auth[_0xcd78('0x8')](),controller[_0xcd78('0x1c')]);router[_0xcd78('0x7')](_0xcd78('0x1d'),auth['isAuthenticated'](),controller[_0xcd78('0x1e')]);router['post'](_0xcd78('0xe'),auth['isAuthenticated'](),controller[_0xcd78('0x1f')]);router['post'](_0xcd78('0x10'),auth[_0xcd78('0x8')](),controller['addAnswer']);router[_0xcd78('0x20')]('/',auth[_0xcd78('0x8')](),controller[_0xcd78('0x21')]);router['post'](_0xcd78('0x12'),auth[_0xcd78('0x8')](),controller[_0xcd78('0x22')]);router[_0xcd78('0x20')](_0xcd78('0x14'),auth[_0xcd78('0x8')](),controller['addSmtp']);router['post'](_0xcd78('0x16'),auth['isAuthenticated'](),controller[_0xcd78('0x23')]);router['post'](_0xcd78('0x24'),auth['isAuthenticated'](),controller[_0xcd78('0x25')]);router['post'](_0xcd78('0x26'),auth['isAuthenticated'](),controller[_0xcd78('0x27')]);router[_0xcd78('0x20')](_0xcd78('0x1d'),auth[_0xcd78('0x8')](),controller['addAgents']);router[_0xcd78('0x28')](_0xcd78('0xc'),auth[_0xcd78('0x8')](),controller['update']);router[_0xcd78('0x29')](_0xcd78('0xe'),auth[_0xcd78('0x8')](),controller[_0xcd78('0x2a')]);router[_0xcd78('0x29')](_0xcd78('0x10'),auth[_0xcd78('0x8')](),controller['removeAnswers']);router['delete'](_0xcd78('0x12'),auth[_0xcd78('0x8')](),controller[_0xcd78('0x2b')]);router[_0xcd78('0x29')](_0xcd78('0x14'),auth['isAuthenticated'](),controller['removeSmtp']);router[_0xcd78('0x29')]('/:id',auth[_0xcd78('0x8')](),controller[_0xcd78('0x2c')]);router[_0xcd78('0x29')](_0xcd78('0x1d'),auth['isAuthenticated'](),controller[_0xcd78('0x2d')]);module[_0xcd78('0x2e')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index a4966ce..7733cab 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 _0xee9a=['STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0xee9a,0x98));var _0xaee9=function(_0x4c648f,_0x3977dd){_0x4c648f=_0x4c648f-0x0;var _0x1dc3e5=_0xee9a[_0x4c648f];return _0x1dc3e5;};'use strict';var Sequelize=require(_0xaee9('0x0'));module[_0xaee9('0x1')]={'description':{'type':Sequelize[_0xaee9('0x2')]},'name':{'type':Sequelize[_0xaee9('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xaee9('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xaee9('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xaee9('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xaee9('0x2')],'allowNull':![],'defaultValue':_0xaee9('0x4')},'fontSize':{'type':Sequelize[_0xaee9('0x5')](0x2)[_0xaee9('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xaee9('0x7')],'defaultValue':function(){return _0xaee9('0x8');}},'notificationSound':{'type':Sequelize[_0xaee9('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xaee9('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xaee9('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xaee9('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xaee9('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xaee9('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xaee9('0x3')],'defaultValue':![],'comment':_0xaee9('0xa'),'set':function(_0x14710d){if(!_0x14710d)this[_0xaee9('0xb')](_0xaee9('0xc'),null);this[_0xaee9('0xb')](_0xaee9('0xd'),_0x14710d);}}}; \ No newline at end of file +var _0xa6fc=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED'];(function(_0x57645b,_0x25f73a){var _0xe82f00=function(_0x526b4){while(--_0x526b4){_0x57645b['push'](_0x57645b['shift']());}};_0xe82f00(++_0x25f73a);}(_0xa6fc,0xc9));var _0xca6f=function(_0x8d348f,_0xf4ff71){_0x8d348f=_0x8d348f-0x0;var _0x5c679a=_0xa6fc[_0x8d348f];return _0x5c679a;};'use strict';var Sequelize=require(_0xca6f('0x0'));module['exports']={'description':{'type':Sequelize[_0xca6f('0x1')]},'name':{'type':Sequelize[_0xca6f('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0xca6f('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xca6f('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xca6f('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0xca6f('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0xca6f('0x3')]},'markAsUnread':{'type':Sequelize[_0xca6f('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xca6f('0x1')],'allowNull':![],'defaultValue':_0xca6f('0x4')},'fontSize':{'type':Sequelize[_0xca6f('0x5')](0x2)[_0xca6f('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xca6f('0x3')],'defaultValue':function(){return _0xca6f('0x7');}},'notificationSound':{'type':Sequelize[_0xca6f('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xca6f('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xca6f('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xca6f('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xca6f('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xca6f('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xca6f('0x2')],'defaultValue':![],'comment':_0xca6f('0x9'),'set':function(_0x545ae5){if(!_0x545ae5)this['setDataValue'](_0xca6f('0xa'),null);this[_0xca6f('0xb')](_0xca6f('0xc'),_0x545ae5);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 67c98c9..6c9d08e 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 _0x6cf6=['filter','where','merge','options','includeAll','findAll','rows','show','params','Pause','include','find','update','body','MailServerIn','mandatoryDispositionPause','describe','addDisposition','MailAccountId','Disposition','create','removeDispositions','CannedAnswer','getAnswers','findOne','removeAnswers','ids','ListId','isNil','active','description','cservice','cauthentication','user','cuser','password','pass','authentication','port','host','service','cpassword','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','getImap','removeImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','getInteractions','MailInteraction','Contact','User','Owner','fullname','internal','Tag','Tags','tag','addApplications','sequelize','transaction','MailApplication','getApplications','MailMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','from','format','%s\x20<%s>','email','attachments','root','server/files/attachments','basename','secure','auth','SendMail','sendMail','List\x20not\x20found','messageId','subject','attach','out','Interaction','verifySmtp','VerifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','util','to-csv','ejs','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../mysqldb','defaults','redis','socket.io-emitter','register','client','http','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','destroy','MailAccounts','UserProfileResource','stack','name','send','index','Imap','MailServerOut','Smtp','map','MailAccount','rawAttributes','type','key','model','keys','filters','attributes','intersection','fields','query','length','hasOwnProperty','nolimit','order','sort','pick'];(function(_0x550629,_0x30f09b){var _0x586fa8=function(_0x2bac31){while(--_0x2bac31){_0x550629['push'](_0x550629['shift']());}};_0x586fa8(++_0x30f09b);}(_0x6cf6,0x120));var _0x66cf=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x6cf6[_0x1ac595];return _0x455fff;};'use strict';var pdf=require(_0x66cf('0x0'));var emlformat=require(_0x66cf('0x1'));var rimraf=require(_0x66cf('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x66cf('0x3'));var moment=require(_0x66cf('0x4'));var BPromise=require(_0x66cf('0x5'));var Mustache=require('mustache');var util=require(_0x66cf('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x66cf('0x7'));var ejs=require(_0x66cf('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x66cf('0x9'));var crypto=require(_0x66cf('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x66cf('0x7'));var querystring=require(_0x66cf('0xb'));var Papa=require(_0x66cf('0xc'));var Redis=require('ioredis');var authService=require(_0x66cf('0xd'));var qs=require(_0x66cf('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x66cf('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0x66cf('0x10'));var config=require('../../config/environment');var db=require(_0x66cf('0x11'))['db'];config['redis']=_[_0x66cf('0x12')](config[_0x66cf('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0x66cf('0x14'))(new Redis(config[_0x66cf('0x13')]));require('./mailAccount.socket')[_0x66cf('0x15')](socket);var jayson=require('jayson/promise');var client=jayson[_0x66cf('0x16')][_0x66cf('0x17')]({'port':0x232b});function checkPasswordPattern(_0x5ccdba,_0x554bc4,_0x2e6667){if(_0x2e6667){var _0x55a77b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x55a77b['test'](_0x554bc4)){return _0x5ccdba;}else{throw new db[(_0x66cf('0x18'))]['ValidationError'](_0x66cf('0x19'));}}else{return _0x5ccdba;}}function respondWithRpcPromise(_0x5d7d2b,_0x3c13f1,_0x15ba0f,_0x4abae2){return new BPromise(function(_0xdd25bd,_0x250740){var _0x3dfcb0=_0x4abae2||client;return _0x3dfcb0[_0x66cf('0x1a')](_0x5d7d2b,_0x15ba0f)[_0x66cf('0x1b')](function(_0x2c5a88){logger[_0x66cf('0x1c')](_0x66cf('0x1d'),_0x3c13f1,_0x66cf('0x1e'));logger[_0x66cf('0x1f')](_0x66cf('0x20'),_0x3c13f1,_0x66cf('0x1e'),JSON[_0x66cf('0x21')](_0x2c5a88));if(_0x2c5a88[_0x66cf('0x22')]){if(_0x2c5a88[_0x66cf('0x22')]['code']===0x1f4){logger[_0x66cf('0x22')](_0x66cf('0x1d'),_0x3c13f1,_0x2c5a88[_0x66cf('0x22')]['message']);return _0x250740(_0x2c5a88[_0x66cf('0x22')][_0x66cf('0x23')]);}logger[_0x66cf('0x22')](_0x66cf('0x1d'),_0x3c13f1,_0x2c5a88[_0x66cf('0x22')][_0x66cf('0x23')]);return _0xdd25bd(_0x2c5a88['error']['message']);}else{logger['info'](_0x66cf('0x1d'),_0x3c13f1,_0x66cf('0x1e'));_0xdd25bd(_0x2c5a88['result'][_0x66cf('0x23')]);}})[_0x66cf('0x24')](function(_0x9ecb45){logger[_0x66cf('0x22')](_0x66cf('0x1d'),_0x3c13f1,_0x9ecb45);_0x250740(_0x9ecb45);});});}function respondWithStatusCode(_0x46a10b,_0x473a4a){_0x473a4a=_0x473a4a||0xcc;return function(_0x5d44ab){if(_0x5d44ab){return _0x46a10b[_0x66cf('0x25')](_0x473a4a);}return _0x46a10b['status'](_0x473a4a)[_0x66cf('0x26')]();};}function respondWithResult(_0x9a6820,_0x3159f6){_0x3159f6=_0x3159f6||0xc8;return function(_0x3569e6){if(_0x3569e6){return _0x9a6820[_0x66cf('0x27')](_0x3159f6)[_0x66cf('0x28')](_0x3569e6);}};}function respondWithFilteredResult(_0x327096,_0x4d41d1){return function(_0x301c3a){if(_0x301c3a){var _0x5d8efb=_0x301c3a[_0x66cf('0x29')],_0x54f2ab=_0x4d41d1['offset'],_0x235f88=_0x4d41d1[_0x66cf('0x2a')]+_0x4d41d1[_0x66cf('0x2b')],_0x326299;if(_0x235f88>=_0x5d8efb){_0x235f88=_0x5d8efb;_0x326299=0xc8;}else{_0x326299=0xce;}_0x327096['status'](_0x326299);return _0x327096[_0x66cf('0x2c')](_0x66cf('0x2d'),_0x54f2ab+'-'+_0x235f88+'/'+_0x5d8efb)[_0x66cf('0x28')](_0x301c3a);}return null;};}function patchUpdates(_0x4dd713){return function(_0x7abea7){try{jsonpatch['apply'](_0x7abea7,_0x4dd713,!![]);}catch(_0xa0f3e9){return BPromise['reject'](_0xa0f3e9);}return _0x7abea7['save']();};}function saveUpdates(_0x20cacf,_0x4d6f2c){return function(_0x1302ef){if(_0x1302ef){return _0x1302ef['update'](_0x20cacf)[_0x66cf('0x1b')](function(_0x5c54a9){return _0x5c54a9;});}return null;};}function removeEntity(_0x55bee2,_0xafe10){return function(_0x1e787c){if(_0x1e787c){return _0x1e787c[_0x66cf('0x2e')]()[_0x66cf('0x1b')](function(){var _0xb77b8a=_0x1e787c['get']({'plain':!![]});var _0x32f054=_0x66cf('0x2f');return db[_0x66cf('0x30')][_0x66cf('0x2e')]({'where':{'type':_0x32f054,'resourceId':_0xb77b8a['id']}})['then'](function(){return _0x1e787c;});})[_0x66cf('0x1b')](function(){_0x55bee2[_0x66cf('0x27')](0xcc)[_0x66cf('0x26')]();});}};}function handleEntityNotFound(_0x15e057,_0x3c53bb){return function(_0x9d85a9){if(!_0x9d85a9){_0x15e057[_0x66cf('0x25')](0x194);}return _0x9d85a9;};}function handleError(_0x4dc799,_0x8ba000){_0x8ba000=_0x8ba000||0x1f4;return function(_0x2ebc6f){logger[_0x66cf('0x22')](_0x2ebc6f[_0x66cf('0x31')]);if(_0x2ebc6f[_0x66cf('0x32')]){delete _0x2ebc6f[_0x66cf('0x32')];}_0x4dc799['status'](_0x8ba000)[_0x66cf('0x33')](_0x2ebc6f);};}exports[_0x66cf('0x34')]=function(_0x2e330a,_0x352c66){var _0x28cd50={'include':[{'model':db['MailServerIn'],'as':_0x66cf('0x35')},{'model':db[_0x66cf('0x36')],'as':_0x66cf('0x37')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x2bd72c={},_0x7b7140={'count':0x0,'rows':[]};var _0x273e6a=_[_0x66cf('0x38')](db[_0x66cf('0x39')][_0x66cf('0x3a')],function(_0x1e25bb){return{'name':_0x1e25bb['fieldName'],'type':_0x1e25bb[_0x66cf('0x3b')][_0x66cf('0x3c')]};});_0x2bd72c[_0x66cf('0x3d')]=_[_0x66cf('0x38')](_0x273e6a,'name');_0x2bd72c['query']=_[_0x66cf('0x3e')](_0x2e330a['query']);_0x2bd72c[_0x66cf('0x3f')]=_['intersection'](_0x2bd72c[_0x66cf('0x3d')],_0x2bd72c['query']);_0x28cd50[_0x66cf('0x40')]=_[_0x66cf('0x41')](_0x2bd72c[_0x66cf('0x3d')],qs[_0x66cf('0x42')](_0x2e330a[_0x66cf('0x43')][_0x66cf('0x42')]));_0x28cd50[_0x66cf('0x40')]=_0x28cd50[_0x66cf('0x40')][_0x66cf('0x44')]?_0x28cd50['attributes']:_0x2bd72c[_0x66cf('0x3d')];if(!_0x2e330a[_0x66cf('0x43')][_0x66cf('0x45')](_0x66cf('0x46'))){_0x28cd50[_0x66cf('0x2b')]=qs[_0x66cf('0x2b')](_0x2e330a['query'][_0x66cf('0x2b')]);_0x28cd50[_0x66cf('0x2a')]=qs['offset'](_0x2e330a[_0x66cf('0x43')][_0x66cf('0x2a')]);}_0x28cd50[_0x66cf('0x47')]=qs['sort'](_0x2e330a[_0x66cf('0x43')][_0x66cf('0x48')]);_0x28cd50['where']=qs['filters'](_[_0x66cf('0x49')](_0x2e330a[_0x66cf('0x43')],_0x2bd72c[_0x66cf('0x3f')]));if(_0x2e330a[_0x66cf('0x43')][_0x66cf('0x4a')]){_0x28cd50[_0x66cf('0x4b')]=_[_0x66cf('0x4c')](_0x28cd50[_0x66cf('0x4b')],{'$or':_[_0x66cf('0x38')](_0x273e6a,function(_0x305f6a){if(_0x305f6a['type']!=='VIRTUAL'){var _0x25f63a={};_0x25f63a[_0x305f6a[_0x66cf('0x32')]]={'$like':'%'+_0x2e330a[_0x66cf('0x43')][_0x66cf('0x4a')]+'%'};return _0x25f63a;}})});}_0x28cd50=_['merge']({},_0x28cd50,_0x2e330a[_0x66cf('0x4d')]);var _0x440251={'where':_0x28cd50['where']};return db[_0x66cf('0x39')][_0x66cf('0x29')](_0x440251)['then'](function(_0x8f2aef){_0x7b7140[_0x66cf('0x29')]=_0x8f2aef;if(_0x2e330a[_0x66cf('0x43')][_0x66cf('0x4e')]){_0x28cd50['include']=[{'all':!![]}];}return db[_0x66cf('0x39')][_0x66cf('0x4f')](_0x28cd50);})['then'](function(_0x11ca55){_0x7b7140[_0x66cf('0x50')]=_0x11ca55;return _0x7b7140;})[_0x66cf('0x1b')](respondWithFilteredResult(_0x352c66,_0x28cd50))[_0x66cf('0x24')](handleError(_0x352c66,null));};exports[_0x66cf('0x51')]=function(_0x5c8049,_0x247443){var _0x20df93={'raw':![],'where':{'id':_0x5c8049[_0x66cf('0x52')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x66cf('0x35')},{'model':db[_0x66cf('0x36')],'as':_0x66cf('0x37')},{'model':db[_0x66cf('0x53')],'as':'mandatoryDispositionPause'}]},_0x283b3d={};_0x283b3d[_0x66cf('0x3d')]=_[_0x66cf('0x3e')](db['MailAccount'][_0x66cf('0x3a')]);_0x283b3d[_0x66cf('0x43')]=_[_0x66cf('0x3e')](_0x5c8049[_0x66cf('0x43')]);_0x283b3d[_0x66cf('0x3f')]=_['intersection'](_0x283b3d['model'],_0x283b3d[_0x66cf('0x43')]);_0x20df93[_0x66cf('0x40')]=_['intersection'](_0x283b3d[_0x66cf('0x3d')],qs[_0x66cf('0x42')](_0x5c8049['query'][_0x66cf('0x42')]));_0x20df93[_0x66cf('0x40')]=_0x20df93[_0x66cf('0x40')][_0x66cf('0x44')]?_0x20df93['attributes']:_0x283b3d['model'];if(_0x5c8049[_0x66cf('0x43')][_0x66cf('0x4e')]){_0x20df93[_0x66cf('0x54')]=[{'all':!![]}];}_0x20df93=_[_0x66cf('0x4c')]({},_0x20df93,_0x5c8049['options']);return db[_0x66cf('0x39')][_0x66cf('0x55')](_0x20df93)[_0x66cf('0x1b')](handleEntityNotFound(_0x247443,null))[_0x66cf('0x1b')](respondWithResult(_0x247443,null))[_0x66cf('0x24')](handleError(_0x247443,null));};exports[_0x66cf('0x56')]=function(_0x509d48,_0x439f3d){if(_0x509d48['body']['id']){delete _0x509d48[_0x66cf('0x57')]['id'];}return db['MailAccount'][_0x66cf('0x55')]({'where':{'id':_0x509d48[_0x66cf('0x52')]['id']},'include':[{'model':db[_0x66cf('0x58')],'as':_0x66cf('0x35')},{'model':db[_0x66cf('0x36')],'as':_0x66cf('0x37')},{'model':db[_0x66cf('0x53')],'as':_0x66cf('0x59')}]})['then'](handleEntityNotFound(_0x439f3d,null))[_0x66cf('0x1b')](saveUpdates(_0x509d48[_0x66cf('0x57')],null))['then'](function(_0x43ce55){if(_0x43ce55&&_0x509d48['body'][_0x66cf('0x35')]){return db['MailServerIn'][_0x66cf('0x56')](_0x509d48[_0x66cf('0x57')][_0x66cf('0x35')],{'where':{'MailAccountId':_0x43ce55['id']}})['then'](function(){return _0x43ce55;});}return _0x43ce55;})['then'](function(_0x29f494){if(_0x29f494&&_0x509d48['body'][_0x66cf('0x37')]){return db[_0x66cf('0x36')][_0x66cf('0x56')](_0x509d48['body']['Smtp'],{'where':{'MailAccountId':_0x29f494['id']}})[_0x66cf('0x1b')](function(){return _0x29f494;});}return _0x29f494;})[_0x66cf('0x1b')](respondWithResult(_0x439f3d,null))[_0x66cf('0x24')](handleError(_0x439f3d,null));};exports['describe']=function(_0x8ba77f,_0x2ed161){return db[_0x66cf('0x39')][_0x66cf('0x5a')]()[_0x66cf('0x1b')](respondWithResult(_0x2ed161,null))[_0x66cf('0x24')](handleError(_0x2ed161,null));};exports[_0x66cf('0x5b')]=function(_0x462c92,_0x32145a,_0xbca524){if(_0x462c92[_0x66cf('0x57')]['id']){delete _0x462c92['body']['id'];}return db[_0x66cf('0x39')][_0x66cf('0x55')]({'where':{'id':_0x462c92[_0x66cf('0x52')]['id']}})[_0x66cf('0x1b')](handleEntityNotFound(_0x32145a,null))['then'](function(_0x2ac048){if(_0x2ac048){_0x462c92[_0x66cf('0x57')][_0x66cf('0x5c')]=_0x2ac048['id'];return db[_0x66cf('0x5d')][_0x66cf('0x5e')](_0x462c92[_0x66cf('0x57')]);}})['then'](respondWithResult(_0x32145a,null))['catch'](handleError(_0x32145a,null));};exports['getDispositions']=function(_0x22bfbb,_0x2b6a2c,_0x4fa62e){var _0x3518b4={'raw':![],'where':{}};var _0x24766c={};var _0x2c8897={'count':0x0,'rows':[]};return db[_0x66cf('0x39')]['findOne']({'where':{'id':_0x22bfbb['params']['id']}})['then'](handleEntityNotFound(_0x2b6a2c,null))[_0x66cf('0x1b')](function(_0x12693b){if(_0x12693b){_0x24766c[_0x66cf('0x3d')]=_[_0x66cf('0x3e')](db[_0x66cf('0x5d')][_0x66cf('0x3a')]);_0x24766c[_0x66cf('0x43')]=_[_0x66cf('0x3e')](_0x22bfbb[_0x66cf('0x43')]);_0x24766c[_0x66cf('0x3f')]=_[_0x66cf('0x41')](_0x24766c[_0x66cf('0x3d')],_0x24766c[_0x66cf('0x43')]);_0x3518b4[_0x66cf('0x40')]=_['intersection'](_0x24766c['model'],qs[_0x66cf('0x42')](_0x22bfbb[_0x66cf('0x43')]['fields']));_0x3518b4['attributes']=_0x3518b4[_0x66cf('0x40')][_0x66cf('0x44')]?_0x3518b4[_0x66cf('0x40')]:_0x24766c[_0x66cf('0x3d')];if(!_0x22bfbb[_0x66cf('0x43')][_0x66cf('0x45')](_0x66cf('0x46'))){_0x3518b4[_0x66cf('0x2b')]=qs[_0x66cf('0x2b')](_0x22bfbb[_0x66cf('0x43')]['limit']);_0x3518b4[_0x66cf('0x2a')]=qs[_0x66cf('0x2a')](_0x22bfbb[_0x66cf('0x43')][_0x66cf('0x2a')]);}_0x3518b4['order']=qs[_0x66cf('0x48')](_0x22bfbb[_0x66cf('0x43')][_0x66cf('0x48')]);_0x3518b4[_0x66cf('0x4b')]=qs[_0x66cf('0x3f')](_['pick'](_0x22bfbb[_0x66cf('0x43')],_0x24766c[_0x66cf('0x3f')]));_0x3518b4[_0x66cf('0x4b')][_0x66cf('0x5c')]=_0x12693b['id'];if(_0x22bfbb[_0x66cf('0x43')][_0x66cf('0x4a')]){_0x3518b4['where']=_[_0x66cf('0x4c')](_0x3518b4[_0x66cf('0x4b')],{'$or':_[_0x66cf('0x38')](_0x3518b4[_0x66cf('0x40')],function(_0x32f68f){var _0x1ebbec={};_0x1ebbec[_0x32f68f]={'$like':'%'+_0x22bfbb[_0x66cf('0x43')]['filter']+'%'};return _0x1ebbec;})});}_0x3518b4=_[_0x66cf('0x4c')]({},_0x3518b4,_0x22bfbb[_0x66cf('0x4d')]);return db[_0x66cf('0x5d')][_0x66cf('0x29')]({'where':_0x3518b4[_0x66cf('0x4b')]})[_0x66cf('0x1b')](function(_0x1f4fa5){_0x2c8897[_0x66cf('0x29')]=_0x1f4fa5;if(_0x22bfbb['query'][_0x66cf('0x4e')]){_0x3518b4[_0x66cf('0x54')]=[{'all':!![]}];}return db['Disposition'][_0x66cf('0x4f')](_0x3518b4);})['then'](function(_0x26692f){_0x2c8897['rows']=_0x26692f;return _0x2c8897;});}})[_0x66cf('0x1b')](respondWithFilteredResult(_0x2b6a2c,_0x3518b4))['catch'](handleError(_0x2b6a2c,null));};exports[_0x66cf('0x5f')]=function(_0x2b57,_0x447694,_0x385ace){return db[_0x66cf('0x39')][_0x66cf('0x55')]({'where':{'id':_0x2b57[_0x66cf('0x52')]['id']}})['then'](handleEntityNotFound(_0x447694,null))[_0x66cf('0x1b')](function(_0x19b926){if(_0x19b926){return _0x19b926[_0x66cf('0x5f')](_0x2b57[_0x66cf('0x43')]['ids']);}})[_0x66cf('0x1b')](respondWithStatusCode(_0x447694,null))[_0x66cf('0x24')](handleError(_0x447694,null));};exports['addAnswer']=function(_0x8b35f0,_0x39fc27,_0x3f7d1a){if(_0x8b35f0[_0x66cf('0x57')]['id']){delete _0x8b35f0[_0x66cf('0x57')]['id'];}return db[_0x66cf('0x39')]['find']({'where':{'id':_0x8b35f0[_0x66cf('0x52')]['id']}})[_0x66cf('0x1b')](handleEntityNotFound(_0x39fc27,null))['then'](function(_0x167a92){if(_0x167a92){_0x8b35f0[_0x66cf('0x57')]['MailAccountId']=_0x167a92['id'];return db[_0x66cf('0x60')]['create'](_0x8b35f0[_0x66cf('0x57')]);}})[_0x66cf('0x1b')](respondWithResult(_0x39fc27,null))[_0x66cf('0x24')](handleError(_0x39fc27,null));};exports[_0x66cf('0x61')]=function(_0x2cf23a,_0xd00682,_0x1f796e){var _0xae42ae={'raw':![],'where':{}};var _0x36f3db={};var _0x47b6ba={'count':0x0,'rows':[]};return db[_0x66cf('0x39')][_0x66cf('0x62')]({'where':{'id':_0x2cf23a['params']['id']}})[_0x66cf('0x1b')](handleEntityNotFound(_0xd00682,null))[_0x66cf('0x1b')](function(_0x364102){if(_0x364102){_0x36f3db['model']=_[_0x66cf('0x3e')](db[_0x66cf('0x60')][_0x66cf('0x3a')]);_0x36f3db['query']=_[_0x66cf('0x3e')](_0x2cf23a['query']);_0x36f3db['filters']=_[_0x66cf('0x41')](_0x36f3db[_0x66cf('0x3d')],_0x36f3db[_0x66cf('0x43')]);_0xae42ae[_0x66cf('0x40')]=_[_0x66cf('0x41')](_0x36f3db[_0x66cf('0x3d')],qs['fields'](_0x2cf23a[_0x66cf('0x43')]['fields']));_0xae42ae[_0x66cf('0x40')]=_0xae42ae[_0x66cf('0x40')]['length']?_0xae42ae[_0x66cf('0x40')]:_0x36f3db[_0x66cf('0x3d')];if(!_0x2cf23a[_0x66cf('0x43')][_0x66cf('0x45')](_0x66cf('0x46'))){_0xae42ae[_0x66cf('0x2b')]=qs[_0x66cf('0x2b')](_0x2cf23a[_0x66cf('0x43')][_0x66cf('0x2b')]);_0xae42ae['offset']=qs[_0x66cf('0x2a')](_0x2cf23a[_0x66cf('0x43')][_0x66cf('0x2a')]);}_0xae42ae[_0x66cf('0x47')]=qs[_0x66cf('0x48')](_0x2cf23a[_0x66cf('0x43')][_0x66cf('0x48')]);_0xae42ae[_0x66cf('0x4b')]=qs[_0x66cf('0x3f')](_[_0x66cf('0x49')](_0x2cf23a[_0x66cf('0x43')],_0x36f3db[_0x66cf('0x3f')]));_0xae42ae[_0x66cf('0x4b')][_0x66cf('0x5c')]=_0x364102['id'];if(_0x2cf23a[_0x66cf('0x43')]['filter']){_0xae42ae[_0x66cf('0x4b')]=_[_0x66cf('0x4c')](_0xae42ae[_0x66cf('0x4b')],{'$or':_[_0x66cf('0x38')](_0xae42ae['attributes'],function(_0x17b9db){var _0x5a093e={};_0x5a093e[_0x17b9db]={'$like':'%'+_0x2cf23a[_0x66cf('0x43')][_0x66cf('0x4a')]+'%'};return _0x5a093e;})});}_0xae42ae=_[_0x66cf('0x4c')]({},_0xae42ae,_0x2cf23a[_0x66cf('0x4d')]);return db['CannedAnswer'][_0x66cf('0x29')]({'where':_0xae42ae[_0x66cf('0x4b')]})[_0x66cf('0x1b')](function(_0x4fa253){_0x47b6ba['count']=_0x4fa253;if(_0x2cf23a['query'][_0x66cf('0x4e')]){_0xae42ae[_0x66cf('0x54')]=[{'all':!![]}];}return db[_0x66cf('0x60')]['findAll'](_0xae42ae);})[_0x66cf('0x1b')](function(_0x339fcf){_0x47b6ba[_0x66cf('0x50')]=_0x339fcf;return _0x47b6ba;});}})['then'](respondWithFilteredResult(_0xd00682,_0xae42ae))['catch'](handleError(_0xd00682,null));};exports[_0x66cf('0x63')]=function(_0x366f07,_0x27e572,_0x55b2fa){return db[_0x66cf('0x39')]['find']({'where':{'id':_0x366f07[_0x66cf('0x52')]['id']}})['then'](handleEntityNotFound(_0x27e572,null))[_0x66cf('0x1b')](function(_0x509878){if(_0x509878){return _0x509878[_0x66cf('0x63')](_0x366f07[_0x66cf('0x43')][_0x66cf('0x64')]);}})[_0x66cf('0x1b')](respondWithStatusCode(_0x27e572,null))[_0x66cf('0x24')](handleError(_0x27e572,null));};exports[_0x66cf('0x5e')]=function(_0x59f5d7,_0x821872){var _0x22e16b={'name':_0x59f5d7[_0x66cf('0x57')]['name'],'key':_0x59f5d7[_0x66cf('0x57')]['key'],'email':_0x59f5d7['body']['email'],'ListId':_0x59f5d7['body'][_0x66cf('0x65')],'active':!_[_0x66cf('0x66')](_0x59f5d7['body']['active'])?_0x59f5d7[_0x66cf('0x57')][_0x66cf('0x67')]:!![],'description':_0x59f5d7['body'][_0x66cf('0x68')]||null,'Imap':{},'Smtp':{}};if(_[_0x66cf('0x66')](_0x59f5d7[_0x66cf('0x57')][_0x66cf('0x69')])){if(_0x59f5d7[_0x66cf('0x57')][_0x66cf('0x6a')]){_0x22e16b[_0x66cf('0x35')][_0x66cf('0x6b')]=_0x22e16b[_0x66cf('0x37')][_0x66cf('0x6b')]=_0x59f5d7[_0x66cf('0x57')][_0x66cf('0x6c')];_0x22e16b['Imap'][_0x66cf('0x6d')]=_0x22e16b[_0x66cf('0x37')][_0x66cf('0x6e')]=_0x59f5d7['body']['cpassword'];}else{_0x22e16b[_0x66cf('0x35')][_0x66cf('0x6f')]=_0x22e16b['Smtp'][_0x66cf('0x6f')]=![];}_0x22e16b[_0x66cf('0x35')]['host']=_0x59f5d7[_0x66cf('0x57')]['Imap']['host'];_0x22e16b[_0x66cf('0x35')][_0x66cf('0x70')]=_0x59f5d7[_0x66cf('0x57')][_0x66cf('0x35')]['port'];_0x22e16b[_0x66cf('0x37')][_0x66cf('0x71')]=_0x59f5d7['body']['Smtp'][_0x66cf('0x71')];_0x22e16b[_0x66cf('0x37')]['port']=_0x59f5d7[_0x66cf('0x57')][_0x66cf('0x37')][_0x66cf('0x70')];}else{_0x22e16b[_0x66cf('0x35')][_0x66cf('0x72')]=_0x22e16b[_0x66cf('0x37')][_0x66cf('0x72')]=_0x59f5d7['body'][_0x66cf('0x69')];_0x22e16b[_0x66cf('0x35')][_0x66cf('0x6b')]=_0x22e16b[_0x66cf('0x37')][_0x66cf('0x6b')]=_0x59f5d7[_0x66cf('0x57')][_0x66cf('0x6c')];_0x22e16b['Imap'][_0x66cf('0x6d')]=_0x22e16b['Smtp']['pass']=_0x59f5d7[_0x66cf('0x57')][_0x66cf('0x73')];}return db[_0x66cf('0x39')][_0x66cf('0x5e')](_0x22e16b,{'include':[{'model':db[_0x66cf('0x36')],'as':_0x66cf('0x37')},{'model':db[_0x66cf('0x58')],'as':'Imap'}]})['then'](function(_0x24500b){var _0x4c04ac=_0x59f5d7[_0x66cf('0x6b')][_0x66cf('0x74')]({'plain':!![]});if(!_0x4c04ac)throw new Error(_0x66cf('0x75'));if(_0x4c04ac['role']===_0x66cf('0x6b')){var _0x406d9b=_0x24500b[_0x66cf('0x74')]({'plain':!![]});return db[_0x66cf('0x76')]['find']({'where':{'name':_0x66cf('0x2f'),'userProfileId':_0x4c04ac[_0x66cf('0x77')]},'raw':!![]})[_0x66cf('0x1b')](function(_0x465a49){if(_0x465a49&&_0x465a49[_0x66cf('0x78')]===0x0){return db[_0x66cf('0x30')][_0x66cf('0x5e')]({'name':_0x406d9b[_0x66cf('0x32')],'resourceId':_0x406d9b['id'],'type':_0x465a49[_0x66cf('0x32')],'sectionId':_0x465a49['id']},{})['then'](function(){return _0x24500b;});}else{return _0x24500b;}})[_0x66cf('0x24')](function(_0xfb84aa){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xfb84aa);throw _0xfb84aa;});}return _0x24500b;})[_0x66cf('0x1b')](respondWithResult(_0x821872,0xc9))[_0x66cf('0x24')](handleError(_0x821872,null));};exports[_0x66cf('0x79')]=function(_0x32ee54,_0x76590a,_0x337785){return db['MailAccount'][_0x66cf('0x62')]({'where':{'id':_0x32ee54[_0x66cf('0x52')]['id']}})[_0x66cf('0x1b')](handleEntityNotFound(_0x76590a,null))[_0x66cf('0x1b')](function(_0x522d5e){if(_0x522d5e){return _0x522d5e['getImap']();}return null;})[_0x66cf('0x1b')](respondWithResult(_0x76590a,null))[_0x66cf('0x24')](handleError(_0x76590a,null));};exports['addImap']=function(_0x1a187c,_0x4c23bd,_0x6e792c){if(_0x1a187c[_0x66cf('0x57')]['id']){delete _0x1a187c[_0x66cf('0x57')]['id'];}return db[_0x66cf('0x39')][_0x66cf('0x55')]({'where':{'id':_0x1a187c[_0x66cf('0x52')]['id']}})[_0x66cf('0x1b')](handleEntityNotFound(_0x4c23bd,null))['then'](function(_0x4ffb0d){if(_0x4ffb0d){_0x1a187c[_0x66cf('0x57')][_0x66cf('0x5c')]=_0x4ffb0d['id'];return db[_0x66cf('0x58')][_0x66cf('0x5e')](_0x1a187c[_0x66cf('0x57')]);}})[_0x66cf('0x1b')](respondWithResult(_0x4c23bd,null))[_0x66cf('0x24')](handleError(_0x4c23bd,null));};exports[_0x66cf('0x7a')]=function(_0x368a52,_0x708b15,_0x24e205){return db[_0x66cf('0x39')][_0x66cf('0x62')]({'where':{'id':_0x368a52[_0x66cf('0x52')]['id']}})[_0x66cf('0x1b')](handleEntityNotFound(_0x708b15,null))[_0x66cf('0x1b')](function(_0x2f724d){if(_0x2f724d){return _0x2f724d['setImap'](null);}return null;})[_0x66cf('0x1b')](respondWithStatusCode(_0x708b15,null))['catch'](handleError(_0x708b15,null));};exports[_0x66cf('0x7b')]=function(_0x35fcb4,_0x27e101,_0x41fdf5){return db[_0x66cf('0x39')][_0x66cf('0x62')]({'where':{'id':_0x35fcb4[_0x66cf('0x52')]['id']}})[_0x66cf('0x1b')](handleEntityNotFound(_0x27e101,null))[_0x66cf('0x1b')](function(_0x14e50d){if(_0x14e50d){return _0x14e50d['getSmtp']();}return null;})['then'](respondWithResult(_0x27e101,null))[_0x66cf('0x24')](handleError(_0x27e101,null));};exports[_0x66cf('0x7c')]=function(_0x236449,_0x18084d,_0x5efa46){if(_0x236449['body']['id']){delete _0x236449[_0x66cf('0x57')]['id'];}return db[_0x66cf('0x39')][_0x66cf('0x55')]({'where':{'id':_0x236449['params']['id']}})[_0x66cf('0x1b')](handleEntityNotFound(_0x18084d,null))[_0x66cf('0x1b')](function(_0x5c2c70){if(_0x5c2c70){_0x236449['body'][_0x66cf('0x5c')]=_0x5c2c70['id'];return db[_0x66cf('0x36')][_0x66cf('0x5e')](_0x236449[_0x66cf('0x57')]);}})[_0x66cf('0x1b')](respondWithResult(_0x18084d,null))[_0x66cf('0x24')](handleError(_0x18084d,null));};exports[_0x66cf('0x7d')]=function(_0x463b70,_0xa8a4ec,_0x36ba98){return db[_0x66cf('0x39')][_0x66cf('0x62')]({'where':{'id':_0x463b70[_0x66cf('0x52')]['id']}})[_0x66cf('0x1b')](handleEntityNotFound(_0xa8a4ec,null))[_0x66cf('0x1b')](function(_0xba4323){if(_0xba4323){return _0xba4323[_0x66cf('0x7e')](null);}return null;})['then'](respondWithStatusCode(_0xa8a4ec,null))[_0x66cf('0x24')](handleError(_0xa8a4ec,null));};exports['addInteraction']=function(_0x31f38d,_0x57af66,_0x25cbb2){return db['MailInteraction']['find']({'where':{'id':_0x31f38d[_0x66cf('0x52')]['id']}})['then'](handleEntityNotFound(_0x57af66,null))[_0x66cf('0x1b')](function(_0xdac608){if(_0xdac608){return _0xdac608[_0x66cf('0x7f')](_0x31f38d[_0x66cf('0x57')][_0x66cf('0x64')],_['omit'](_0x31f38d[_0x66cf('0x57')],[_0x66cf('0x64'),'id'])||{});}})[_0x66cf('0x1b')](respondWithResult(_0x57af66,null))[_0x66cf('0x24')](handleError(_0x57af66,null));};exports[_0x66cf('0x80')]=function(_0x163ffc,_0x3b8529,_0x560960){var _0x24bcab={'raw':![],'where':{}};var _0x4e81c8={};var _0x7663={'count':0x0,'rows':[]};return db[_0x66cf('0x39')][_0x66cf('0x62')]({'where':{'id':_0x163ffc[_0x66cf('0x52')]['id']}})[_0x66cf('0x1b')](handleEntityNotFound(_0x3b8529,null))[_0x66cf('0x1b')](function(_0x227f93){if(_0x227f93){_0x4e81c8[_0x66cf('0x3d')]=_[_0x66cf('0x3e')](db[_0x66cf('0x81')]['rawAttributes']);_0x4e81c8[_0x66cf('0x43')]=_[_0x66cf('0x3e')](_0x163ffc['query']);_0x4e81c8['filters']=_[_0x66cf('0x41')](_0x4e81c8[_0x66cf('0x3d')],_0x4e81c8[_0x66cf('0x43')]);_0x24bcab[_0x66cf('0x40')]=_['intersection'](_0x4e81c8[_0x66cf('0x3d')],qs[_0x66cf('0x42')](_0x163ffc[_0x66cf('0x43')]['fields']));_0x24bcab[_0x66cf('0x40')]=_0x24bcab[_0x66cf('0x40')]['length']?_0x24bcab[_0x66cf('0x40')]:_0x4e81c8[_0x66cf('0x3d')];if(!_0x163ffc[_0x66cf('0x43')]['hasOwnProperty'](_0x66cf('0x46'))){_0x24bcab[_0x66cf('0x2b')]=qs[_0x66cf('0x2b')](_0x163ffc[_0x66cf('0x43')][_0x66cf('0x2b')]);_0x24bcab[_0x66cf('0x2a')]=qs[_0x66cf('0x2a')](_0x163ffc[_0x66cf('0x43')][_0x66cf('0x2a')]);}_0x24bcab['order']=qs[_0x66cf('0x48')](_0x163ffc[_0x66cf('0x43')]['sort']);_0x24bcab[_0x66cf('0x4b')]=qs[_0x66cf('0x3f')](_[_0x66cf('0x49')](_0x163ffc[_0x66cf('0x43')],_0x4e81c8[_0x66cf('0x3f')]));_0x24bcab['where'][_0x66cf('0x5c')]=_0x227f93['id'];if(_0x163ffc[_0x66cf('0x43')][_0x66cf('0x4a')]){_0x24bcab[_0x66cf('0x4b')]=_['merge'](_0x24bcab['where'],{'$or':_['map'](_0x24bcab['attributes'],function(_0x4e7f0f){var _0x27aa11={};_0x27aa11[_0x4e7f0f]={'$like':'%'+_0x163ffc[_0x66cf('0x43')][_0x66cf('0x4a')]+'%'};return _0x27aa11;})});}_0x24bcab=_[_0x66cf('0x4c')]({},_0x24bcab,_0x163ffc[_0x66cf('0x4d')]);return db[_0x66cf('0x81')][_0x66cf('0x29')]({'where':_0x24bcab[_0x66cf('0x4b')]})[_0x66cf('0x1b')](function(_0x4c1473){_0x7663[_0x66cf('0x29')]=_0x4c1473;if(_0x163ffc['query']['includeAll']){_0x24bcab[_0x66cf('0x54')]=[{'model':db['CmContact'],'as':_0x66cf('0x82'),'required':![]},{'model':db[_0x66cf('0x83')],'as':_0x66cf('0x84'),'attributes':[_0x66cf('0x32'),_0x66cf('0x85'),_0x66cf('0x86')],'required':![]},{'model':db[_0x66cf('0x87')],'as':_0x66cf('0x88'),'attributes':['id',_0x66cf('0x32'),'color'],'where':_0x163ffc[_0x66cf('0x43')]['tag']?{'id':_0x163ffc[_0x66cf('0x43')][_0x66cf('0x89')]}:undefined,'required':_0x163ffc['query'][_0x66cf('0x89')]?!![]:![]}];}return db[_0x66cf('0x81')][_0x66cf('0x4f')](_0x24bcab);})['then'](function(_0x56559c){_0x7663[_0x66cf('0x50')]=_0x56559c;return _0x7663;});}})[_0x66cf('0x1b')](respondWithFilteredResult(_0x3b8529,_0x24bcab))[_0x66cf('0x24')](handleError(_0x3b8529,null));};exports[_0x66cf('0x8a')]=function(_0x53eee1,_0x1090e4,_0x2ddaf3){return db[_0x66cf('0x39')]['findOne']({'where':{'id':_0x53eee1[_0x66cf('0x52')]['id']}})['then'](handleEntityNotFound(_0x1090e4,null))[_0x66cf('0x1b')](function(_0x582bf5){if(_0x582bf5){return db[_0x66cf('0x8b')][_0x66cf('0x8c')](function(_0x355809){return db[_0x66cf('0x8d')]['destroy']({'where':{'MailAccountId':_0x53eee1['params']['id']},'transaction':_0x355809})[_0x66cf('0x1b')](function(_0x3b893d){var _0x36f042=_['map'](_0x53eee1['body'],function(_0x3fb5d4){_0x3fb5d4['MailAccountId']=_0x53eee1['params']['id'];return _0x3fb5d4;});return db['MailApplication']['bulkCreate'](_0x36f042,{'transaction':_0x355809});});})[_0x66cf('0x1b')](function(){return db[_0x66cf('0x8d')]['findAndCountAll']({'where':{'MailAccountId':_0x53eee1[_0x66cf('0x52')]['id']},'order':'priority'});});}})[_0x66cf('0x1b')](respondWithResult(_0x1090e4,null))[_0x66cf('0x24')](handleError(_0x1090e4,null));};exports['getApplications']=function(_0x41092a,_0x7fc064,_0x3b2872){var _0x457434={};var _0x49f4c7={};var _0x1a08c3;var _0x24c97a;return db['MailAccount'][_0x66cf('0x62')]({'where':{'id':_0x41092a[_0x66cf('0x52')]['id']}})[_0x66cf('0x1b')](handleEntityNotFound(_0x7fc064,null))['then'](function(_0x21e309){if(_0x21e309){_0x1a08c3=_0x21e309;_0x49f4c7[_0x66cf('0x3d')]=_[_0x66cf('0x3e')](db[_0x66cf('0x8d')]['rawAttributes']);_0x49f4c7[_0x66cf('0x43')]=_[_0x66cf('0x3e')](_0x41092a[_0x66cf('0x43')]);_0x49f4c7[_0x66cf('0x3f')]=_[_0x66cf('0x41')](_0x49f4c7[_0x66cf('0x3d')],_0x49f4c7[_0x66cf('0x43')]);_0x457434['attributes']=_[_0x66cf('0x41')](_0x49f4c7[_0x66cf('0x3d')],qs[_0x66cf('0x42')](_0x41092a['query']['fields']));_0x457434['attributes']=_0x457434['attributes']['length']?_0x457434[_0x66cf('0x40')]:_0x49f4c7[_0x66cf('0x3d')];_0x457434[_0x66cf('0x47')]=qs[_0x66cf('0x48')](_0x41092a['query'][_0x66cf('0x48')]);_0x457434[_0x66cf('0x4b')]=qs['filters'](_['pick'](_0x41092a[_0x66cf('0x43')],_0x49f4c7['filters']));if(_0x41092a['query']['filter']){_0x457434[_0x66cf('0x4b')]=_['merge'](_0x457434[_0x66cf('0x4b')],{'$or':_[_0x66cf('0x38')](_0x457434[_0x66cf('0x40')],function(_0x4abb41){var _0x27b5c0={};_0x27b5c0[_0x4abb41]={'$like':'%'+_0x41092a[_0x66cf('0x43')]['filter']+'%'};return _0x27b5c0;})});}_0x457434=_[_0x66cf('0x4c')]({},_0x457434,_0x41092a['options']);return _0x1a08c3[_0x66cf('0x8e')](_0x457434);}})[_0x66cf('0x1b')](function(_0x55b7ef){if(_0x55b7ef){_0x24c97a=_0x55b7ef['length'];if(!_0x41092a[_0x66cf('0x43')][_0x66cf('0x45')](_0x66cf('0x46'))){_0x457434[_0x66cf('0x2b')]=qs['limit'](_0x41092a['query']['limit']);_0x457434[_0x66cf('0x2a')]=qs[_0x66cf('0x2a')](_0x41092a[_0x66cf('0x43')][_0x66cf('0x2a')]);}return _0x1a08c3[_0x66cf('0x8e')](_0x457434);}})[_0x66cf('0x1b')](function(_0x474982){if(_0x474982){return _0x474982?{'count':_0x24c97a,'rows':_0x474982}:null;}})[_0x66cf('0x1b')](respondWithResult(_0x7fc064,null))[_0x66cf('0x24')](handleError(_0x7fc064,null));};exports['getMessages']=function(_0x39823c,_0x49a684,_0x54f416){var _0x480355={'raw':!![],'where':{}};var _0x2a7f00={};var _0x1d8456={'count':0x0,'rows':[]};return db[_0x66cf('0x39')][_0x66cf('0x62')]({'where':{'id':_0x39823c['params']['id']}})['then'](handleEntityNotFound(_0x49a684,null))['then'](function(_0x2a4237){if(_0x2a4237){_0x2a7f00[_0x66cf('0x3d')]=_['keys'](db[_0x66cf('0x8f')]['rawAttributes']);_0x2a7f00[_0x66cf('0x43')]=_[_0x66cf('0x3e')](_0x39823c['query']);_0x2a7f00[_0x66cf('0x3f')]=_['intersection'](_0x2a7f00[_0x66cf('0x3d')],_0x2a7f00[_0x66cf('0x43')]);_0x480355[_0x66cf('0x40')]=_[_0x66cf('0x41')](_0x2a7f00[_0x66cf('0x3d')],qs[_0x66cf('0x42')](_0x39823c[_0x66cf('0x43')][_0x66cf('0x42')]));_0x480355[_0x66cf('0x40')]=_0x480355['attributes'][_0x66cf('0x44')]?_0x480355[_0x66cf('0x40')]:_0x2a7f00['model'];if(!_0x39823c[_0x66cf('0x43')]['hasOwnProperty'](_0x66cf('0x46'))){_0x480355[_0x66cf('0x2b')]=qs[_0x66cf('0x2b')](_0x39823c['query'][_0x66cf('0x2b')]);_0x480355[_0x66cf('0x2a')]=qs['offset'](_0x39823c[_0x66cf('0x43')][_0x66cf('0x2a')]);}_0x480355['order']=qs['sort'](_0x39823c['query'][_0x66cf('0x48')]);_0x480355[_0x66cf('0x4b')]=qs['filters'](_[_0x66cf('0x49')](_0x39823c[_0x66cf('0x43')],_0x2a7f00[_0x66cf('0x3f')]));_0x480355[_0x66cf('0x4b')][_0x66cf('0x5c')]=_0x2a4237['id'];if(_0x39823c[_0x66cf('0x43')][_0x66cf('0x4a')]){_0x480355[_0x66cf('0x4b')]=_[_0x66cf('0x4c')](_0x480355[_0x66cf('0x4b')],{'$or':_[_0x66cf('0x38')](_0x480355['attributes'],function(_0x4101cd){var _0x2386f8={};_0x2386f8[_0x4101cd]={'$like':'%'+_0x39823c['query'][_0x66cf('0x4a')]+'%'};return _0x2386f8;})});}if(_0x39823c[_0x66cf('0x43')]['$gte']){var _0x54f851=_0x39823c[_0x66cf('0x43')][_0x66cf('0x90')][_0x66cf('0x91')](',');var _0x26cdef={};_0x26cdef[_0x54f851[0x0]]={'$gte':moment(_0x54f851[0x1])['format'](_0x66cf('0x92'))};_0x480355[_0x66cf('0x4b')]=_[_0x66cf('0x4c')](_0x480355[_0x66cf('0x4b')],_0x26cdef);}_0x480355=_[_0x66cf('0x4c')]({},_0x480355,_0x39823c[_0x66cf('0x4d')]);return db[_0x66cf('0x8f')][_0x66cf('0x29')]({'where':_0x480355[_0x66cf('0x4b')]})[_0x66cf('0x1b')](function(_0x1f13ae){_0x1d8456['count']=_0x1f13ae;if(_0x39823c[_0x66cf('0x43')][_0x66cf('0x4e')]){_0x480355[_0x66cf('0x54')]=[{'all':!![]}];}return db[_0x66cf('0x8f')][_0x66cf('0x4f')](_0x480355);})[_0x66cf('0x1b')](function(_0x84ea8){_0x1d8456[_0x66cf('0x50')]=_0x84ea8;return _0x1d8456;});}})['then'](respondWithFilteredResult(_0x49a684,_0x480355))[_0x66cf('0x24')](handleError(_0x49a684,null));};exports[_0x66cf('0x33')]=function(_0x1b2e87,_0x5980bf,_0x39c88b){var _0xe24134,_0x163732={},_0x253f09;if(_0x1b2e87[_0x66cf('0x57')]['to']){_0x253f09=_0x1b2e87[_0x66cf('0x57')]['to'][_0x66cf('0x91')](',')[0x0];}return db[_0x66cf('0x39')]['find']({'where':{'id':_0x1b2e87[_0x66cf('0x52')]['id']},'include':[{'model':db[_0x66cf('0x93')],'as':_0x66cf('0x94'),'include':[{'model':db['CmContact'],'as':_0x66cf('0x95'),'where':{'email':_0x253f09},'limit':0x1,'order':[['updatedAt',_0x66cf('0x96')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})['then'](handleEntityNotFound(_0x5980bf,null))[_0x66cf('0x1b')](function(_0x43c427){if(_0x43c427){_0xe24134=_0x43c427;if(_0x43c427['Smtp']){if(_[_0x66cf('0x66')](_0x1b2e87[_0x66cf('0x57')][_0x66cf('0x97')])){_0x1b2e87[_0x66cf('0x57')][_0x66cf('0x97')]=util[_0x66cf('0x98')](_0x66cf('0x99'),_0x43c427['name'],_0x43c427[_0x66cf('0x9a')]||_0x43c427[_0x66cf('0x37')][_0x66cf('0x6b')]);}if(_0x1b2e87[_0x66cf('0x57')][_0x66cf('0x9b')]&&_0x1b2e87[_0x66cf('0x57')]['attachments'][_0x66cf('0x44')]){for(var _0x4a85d1=0x0;_0x4a85d1<_0x1b2e87[_0x66cf('0x57')][_0x66cf('0x9b')][_0x66cf('0x44')];_0x4a85d1+=0x1){_0x1b2e87[_0x66cf('0x57')]['attachments'][_0x4a85d1]={'filename':_0x1b2e87[_0x66cf('0x57')]['attachments'][_0x4a85d1][_0x66cf('0x32')],'path':path['join'](config[_0x66cf('0x9c')],_0x66cf('0x9d'),_0x1b2e87[_0x66cf('0x57')][_0x66cf('0x9b')][_0x4a85d1][_0x66cf('0x9e')])};}}var _0x3bdb51={'tls':{'rejectUnauthorized':![]}};if(_[_0x66cf('0x66')](_0x43c427['Smtp']['service'])){if(_0x43c427[_0x66cf('0x37')][_0x66cf('0x6f')]){_0x3bdb51['auth']={'user':_0x43c427['Smtp'][_0x66cf('0x6b')],'pass':_0x43c427['Smtp'][_0x66cf('0x6e')]};}_0x3bdb51['host']=_0x43c427[_0x66cf('0x37')][_0x66cf('0x71')];_0x3bdb51[_0x66cf('0x70')]=_0x43c427[_0x66cf('0x37')][_0x66cf('0x70')];_0x3bdb51[_0x66cf('0x9f')]=_0x43c427[_0x66cf('0x37')][_0x66cf('0x9f')];}else{_0x3bdb51[_0x66cf('0x72')]=_0x43c427[_0x66cf('0x37')][_0x66cf('0x72')];_0x3bdb51[_0x66cf('0xa0')]={'user':_0x43c427[_0x66cf('0x37')][_0x66cf('0x6b')],'pass':_0x43c427['Smtp'][_0x66cf('0x6e')]};}return respondWithRpcPromise(_0x66cf('0xa1'),_0x66cf('0xa2'),{'account':_0x3bdb51,'message':_0x1b2e87['body']});}else{throw new Error(_0x66cf('0xa3'));}}})['then'](function(_0x3d7e96){if(_0x3d7e96){_0x163732=_0x3d7e96;if(_0xe24134['List']){if(_0xe24134[_0x66cf('0x94')][_0x66cf('0x95')][_0x66cf('0x44')]){return _0xe24134[_0x66cf('0x94')]['Contacts'][0x0];}else{return db['CmContact'][_0x66cf('0x5e')](_[_0x66cf('0x12')](_0x1b2e87[_0x66cf('0x57')],{'firstName':_0x1b2e87[_0x66cf('0x57')]['to'],'email':_0x1b2e87[_0x66cf('0x57')]['to'],'phone':_0x1b2e87[_0x66cf('0x57')]['to'],'ListId':_0xe24134[_0x66cf('0x65')]}));}}else{throw new Error(_0x66cf('0xa3'));}}})[_0x66cf('0x1b')](function(_0x3bc18c){if(_0x3bc18c){var _0x49b250={'UserId':_0x1b2e87[_0x66cf('0x6b')]['id'],'ContactId':_0x3bc18c['id'],'MailAccountId':_0xe24134['id'],'inReplyTo':_0x163732[_0x66cf('0xa4')],'to':_0x1b2e87[_0x66cf('0x57')][_0x66cf('0x97')],'cc':_0x1b2e87[_0x66cf('0x57')]['cc'],'subject':_0x1b2e87[_0x66cf('0x57')][_0x66cf('0xa5')],'attach':_0x1b2e87[_0x66cf('0x57')][_0x66cf('0xa6')],'firstMsgDirection':_0x66cf('0xa7'),'lastMsgAt':moment()[_0x66cf('0x98')](_0x66cf('0x92')),'lastMsgDirection':_0x66cf('0xa7'),'lastMsgBody':_0x1b2e87[_0x66cf('0x57')][_0x66cf('0x57')],'Messages':[_[_0x66cf('0x4c')](_0x1b2e87[_0x66cf('0x57')],{'messageId':_0x163732[_0x66cf('0xa4')],'sentAt':moment()[_0x66cf('0x98')](_0x66cf('0x92')),'read':!![],'MailAccountId':_0xe24134['id'],'UserId':_0x1b2e87[_0x66cf('0x6b')]['id'],'ContactId':_0x3bc18c['id']})]};if(_0x1b2e87[_0x66cf('0x57')]['Interaction']){_0x49b250=_[_0x66cf('0x4c')](_0x49b250,_0x1b2e87['body'][_0x66cf('0xa8')]);}return db['MailInteraction'][_0x66cf('0x5e')](_0x49b250,{'include':[{'model':db[_0x66cf('0x8f')],'as':'Messages'}]});}})[_0x66cf('0x1b')](respondWithResult(_0x5980bf,null))[_0x66cf('0x24')](handleError(_0x5980bf,null));};exports[_0x66cf('0xa9')]=function(_0x15bbd0,_0x33cc5c,_0x47ae85){return db[_0x66cf('0x39')][_0x66cf('0x55')]({'where':{'id':_0x15bbd0[_0x66cf('0x52')]['id']},'include':[{'model':db[_0x66cf('0x36')],'as':_0x66cf('0x37'),'raw':!![]}]})[_0x66cf('0x1b')](handleEntityNotFound(_0x33cc5c,null))[_0x66cf('0x1b')](function(_0x45df07){if(_0x45df07&&_0x45df07[_0x66cf('0x37')]){var _0xd1e3da={'id':_0x45df07['id'],'tls':{'rejectUnauthorized':![]}};if(_0x45df07['Smtp']['service']){_0xd1e3da[_0x66cf('0x72')]=_0x45df07[_0x66cf('0x37')][_0x66cf('0x72')];}else{_0xd1e3da[_0x66cf('0x71')]=_0x45df07['Smtp']['host'];_0xd1e3da[_0x66cf('0x70')]=_0x45df07[_0x66cf('0x37')][_0x66cf('0x70')];_0xd1e3da[_0x66cf('0x9f')]=_0x45df07[_0x66cf('0x37')][_0x66cf('0x9f')];}if(_0x45df07[_0x66cf('0x37')][_0x66cf('0x6f')]){_0xd1e3da[_0x66cf('0xa0')]={'user':_0x45df07['Smtp'][_0x66cf('0x6b')],'pass':_0x45df07[_0x66cf('0x37')][_0x66cf('0x6e')]};}return respondWithRpcPromise(_0x66cf('0xaa'),'verifySmtp',{'account':_0xd1e3da});}})[_0x66cf('0x1b')](respondWithResult(_0x33cc5c,null))[_0x66cf('0x24')](handleError(_0x33cc5c,null));};exports[_0x66cf('0x2e')]=function(_0x515b89,_0x3b96b9){return db[_0x66cf('0x39')][_0x66cf('0x55')]({'where':{'id':_0x515b89['params']['id']}})[_0x66cf('0x1b')](handleEntityNotFound(_0x3b96b9,null))[_0x66cf('0x1b')](function(_0x4c89a4){if(_0x4c89a4&&_0x4c89a4[_0x66cf('0x72')]){throw new db[(_0x66cf('0x18'))][(_0x66cf('0xab'))](_0x66cf('0xac'));}return _0x4c89a4;})['then'](removeEntity(_0x3b96b9,null))[_0x66cf('0x24')](handleError(_0x3b96b9,null));};exports['addAgents']=function(_0x314834,_0x11d12c,_0x44c851){return db['MailAccount']['find']({'where':{'id':_0x314834['params']['id']}})[_0x66cf('0x1b')](handleEntityNotFound(_0x11d12c,null))[_0x66cf('0x1b')](function(_0x50bce0){if(_0x50bce0){return _0x50bce0[_0x66cf('0xad')](_0x314834[_0x66cf('0x57')][_0x66cf('0x64')],_['omit'](_0x314834[_0x66cf('0x57')],['ids','id'])||{})[_0x66cf('0xae')](function(_0xf1a731){for(var _0x2e6824=0x0;_0x2e6824<_0x314834[_0x66cf('0x57')][_0x66cf('0x64')][_0x66cf('0x44')];_0x2e6824+=0x1){socket[_0x66cf('0xaf')](_0x66cf('0xb0'),{'UserId':_0x314834['body']['ids'][_0x2e6824],'MailAccountId':_0x314834[_0x66cf('0x52')]['id']});}return _0xf1a731;});}})[_0x66cf('0x1b')](respondWithResult(_0x11d12c,null))[_0x66cf('0x24')](handleError(_0x11d12c,null));};exports[_0x66cf('0xb1')]=function(_0x3da832,_0x424e81,_0x1a0e59){return db[_0x66cf('0x39')][_0x66cf('0x55')]({'where':{'id':_0x3da832['params']['id']}})[_0x66cf('0x1b')](handleEntityNotFound(_0x424e81,null))[_0x66cf('0x1b')](function(_0x445f3b){if(_0x445f3b){return _0x445f3b[_0x66cf('0xb1')](_0x3da832[_0x66cf('0x43')]['ids'])[_0x66cf('0x1b')](function(){if(_[_0x66cf('0xb2')](_0x3da832[_0x66cf('0x43')][_0x66cf('0x64')])){for(var _0x5e4403=0x0;_0x5e4403<_0x3da832['query']['ids'][_0x66cf('0x44')];_0x5e4403+=0x1){socket[_0x66cf('0xaf')]('userMailAccount:remove',{'UserId':Number(_0x3da832[_0x66cf('0x43')][_0x66cf('0x64')][_0x5e4403]),'MailAccountId':Number(_0x3da832[_0x66cf('0x52')]['id'])});}}else{socket['emit'](_0x66cf('0xb3'),{'UserId':Number(_0x3da832[_0x66cf('0x43')][_0x66cf('0x64')]),'MailAccountId':Number(_0x3da832[_0x66cf('0x52')]['id'])});}});}})[_0x66cf('0x1b')](respondWithStatusCode(_0x424e81,null))[_0x66cf('0x24')](handleError(_0x424e81,null));};exports[_0x66cf('0xb4')]=function(_0x4845fa,_0x56342c,_0x183499){var _0x178acc={};var _0x548a4a={};var _0x33b4cf;var _0x405007;return db['MailAccount']['findOne']({'where':{'id':_0x4845fa['params']['id']}})[_0x66cf('0x1b')](handleEntityNotFound(_0x56342c,null))[_0x66cf('0x1b')](function(_0x414dcb){if(_0x414dcb){_0x33b4cf=_0x414dcb;_0x548a4a[_0x66cf('0x3d')]=_['keys'](db[_0x66cf('0x83')]['rawAttributes']);_0x548a4a[_0x66cf('0x43')]=_['keys'](_0x4845fa['query']);_0x548a4a['filters']=_[_0x66cf('0x41')](_0x548a4a[_0x66cf('0x3d')],_0x548a4a['query']);_0x178acc[_0x66cf('0x40')]=_[_0x66cf('0x41')](_0x548a4a[_0x66cf('0x3d')],qs[_0x66cf('0x42')](_0x4845fa['query']['fields']));_0x178acc[_0x66cf('0x40')]=_0x178acc[_0x66cf('0x40')][_0x66cf('0x44')]?_0x178acc['attributes']:_0x548a4a[_0x66cf('0x3d')];_0x178acc[_0x66cf('0x47')]=qs[_0x66cf('0x48')](_0x4845fa[_0x66cf('0x43')][_0x66cf('0x48')]);_0x178acc['where']=qs[_0x66cf('0x3f')](_['pick'](_0x4845fa[_0x66cf('0x43')],_0x548a4a[_0x66cf('0x3f')]));if(_0x4845fa['query']['filter']){_0x178acc[_0x66cf('0x4b')]=_['merge'](_0x178acc[_0x66cf('0x4b')],{'$or':_[_0x66cf('0x38')](_0x178acc['attributes'],function(_0x1c336b){var _0x3c8552={};_0x3c8552[_0x1c336b]={'$like':'%'+_0x4845fa['query']['filter']+'%'};return _0x3c8552;})});}_0x178acc=_[_0x66cf('0x4c')]({},_0x178acc,_0x4845fa['options']);return _0x33b4cf['getAgents'](_0x178acc);}})[_0x66cf('0x1b')](function(_0x298254){if(_0x298254){_0x405007=_0x298254[_0x66cf('0x44')];if(!_0x4845fa[_0x66cf('0x43')][_0x66cf('0x45')](_0x66cf('0x46'))){_0x178acc['limit']=qs[_0x66cf('0x2b')](_0x4845fa[_0x66cf('0x43')][_0x66cf('0x2b')]);_0x178acc[_0x66cf('0x2a')]=qs[_0x66cf('0x2a')](_0x4845fa[_0x66cf('0x43')]['offset']);}return _0x33b4cf['getAgents'](_0x178acc);}})[_0x66cf('0x1b')](function(_0x55684e){if(_0x55684e){return _0x55684e?{'count':_0x405007,'rows':_0x55684e}:null;}})['then'](respondWithResult(_0x56342c,null))[_0x66cf('0x24')](handleError(_0x56342c,null));}; \ No newline at end of file +var _0x5adc=['List','Contacts','updatedAt','from','%s\x20<%s>','attachments','join','server/files/attachments','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','messageId','subject','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./mailAccount.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','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','sendStatus','status','end','offset','limit','set','Content-Range','json','reject','save','MailAccounts','UserProfileResource','destroy','name','send','index','Imap','MailServerOut','mandatoryDispositionPause','map','MailAccount','rawAttributes','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','params','Smtp','Pause','keys','find','update','body','MailServerIn','describe','addDisposition','MailAccountId','Disposition','removeDispositions','addAnswer','create','getAnswers','findOne','CannedAnswer','hasOwnProperty','nolimit','removeAnswers','ids','key','email','ListId','isNil','active','description','user','cuser','password','pass','authentication','host','port','service','cservice','cpassword','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','getSmtp','addSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','User','Owner','fullname','internal','Tag','Tags','tag','addApplications','transaction','MailApplication','bulkCreate','findAndCountAll','getApplications','$gte','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','split'];(function(_0x31c6ca,_0x5b37b3){var _0x1b5088=function(_0x3c840b){while(--_0x3c840b){_0x31c6ca['push'](_0x31c6ca['shift']());}};_0x1b5088(++_0x5b37b3);}(_0x5adc,0xe2));var _0xc5ad=function(_0x503a5d,_0x59e4f6){_0x503a5d=_0x503a5d-0x0;var _0x3448b0=_0x5adc[_0x503a5d];return _0x3448b0;};'use strict';var pdf=require(_0xc5ad('0x0'));var emlformat=require(_0xc5ad('0x1'));var rimraf=require(_0xc5ad('0x2'));var zipdir=require(_0xc5ad('0x3'));var jsonpatch=require(_0xc5ad('0x4'));var rp=require(_0xc5ad('0x5'));var moment=require(_0xc5ad('0x6'));var BPromise=require(_0xc5ad('0x7'));var Mustache=require(_0xc5ad('0x8'));var util=require('util');var path=require(_0xc5ad('0x9'));var sox=require(_0xc5ad('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xc5ad('0xb'));var squel=require(_0xc5ad('0xc'));var crypto=require(_0xc5ad('0xd'));var jsforce=require(_0xc5ad('0xe'));var deskjs=require(_0xc5ad('0xf'));var toCsv=require(_0xc5ad('0x10'));var querystring=require(_0xc5ad('0x11'));var Papa=require(_0xc5ad('0x12'));var Redis=require('ioredis');var authService=require(_0xc5ad('0x13'));var qs=require(_0xc5ad('0x14'));var as=require(_0xc5ad('0x15'));var hardwareService=require(_0xc5ad('0x16'));var logger=require(_0xc5ad('0x17'))(_0xc5ad('0x18'));var utils=require(_0xc5ad('0x19'));var config=require(_0xc5ad('0x1a'));var db=require('../../mysqldb')['db'];config[_0xc5ad('0x1b')]=_[_0xc5ad('0x1c')](config[_0xc5ad('0x1b')],{'host':_0xc5ad('0x1d'),'port':0x18eb});var socket=require(_0xc5ad('0x1e'))(new Redis(config['redis']));require(_0xc5ad('0x1f'))['register'](socket);var jayson=require(_0xc5ad('0x20'));var client=jayson[_0xc5ad('0x21')][_0xc5ad('0x22')]({'port':0x232b});function checkPasswordPattern(_0x1bd988,_0x85908b,_0x5068f5){if(_0x5068f5){var _0x5dab14=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5dab14[_0xc5ad('0x23')](_0x85908b)){return _0x1bd988;}else{throw new db[(_0xc5ad('0x24'))][(_0xc5ad('0x25'))](_0xc5ad('0x26'));}}else{return _0x1bd988;}}function respondWithRpcPromise(_0x527459,_0x172b40,_0x277639,_0x3fc7ea){return new BPromise(function(_0x492778,_0x116bda){var _0x383c7f=_0x3fc7ea||client;return _0x383c7f[_0xc5ad('0x27')](_0x527459,_0x277639)[_0xc5ad('0x28')](function(_0x4bc5f1){logger[_0xc5ad('0x29')](_0xc5ad('0x2a'),_0x172b40,_0xc5ad('0x2b'));logger[_0xc5ad('0x2c')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x172b40,'request\x20sent',JSON[_0xc5ad('0x2d')](_0x4bc5f1));if(_0x4bc5f1[_0xc5ad('0x2e')]){if(_0x4bc5f1['error']['code']===0x1f4){logger[_0xc5ad('0x2e')]('MailAccount,\x20%s,\x20%s',_0x172b40,_0x4bc5f1[_0xc5ad('0x2e')]['message']);return _0x116bda(_0x4bc5f1['error']['message']);}logger[_0xc5ad('0x2e')](_0xc5ad('0x2a'),_0x172b40,_0x4bc5f1[_0xc5ad('0x2e')][_0xc5ad('0x2f')]);return _0x492778(_0x4bc5f1['error'][_0xc5ad('0x2f')]);}else{logger[_0xc5ad('0x29')](_0xc5ad('0x2a'),_0x172b40,_0xc5ad('0x2b'));_0x492778(_0x4bc5f1['result']['message']);}})[_0xc5ad('0x30')](function(_0x5647b1){logger[_0xc5ad('0x2e')](_0xc5ad('0x2a'),_0x172b40,_0x5647b1);_0x116bda(_0x5647b1);});});}function respondWithStatusCode(_0x2b0bfc,_0x154e3a){_0x154e3a=_0x154e3a||0xcc;return function(_0x5ca176){if(_0x5ca176){return _0x2b0bfc[_0xc5ad('0x31')](_0x154e3a);}return _0x2b0bfc[_0xc5ad('0x32')](_0x154e3a)[_0xc5ad('0x33')]();};}function respondWithResult(_0xb733b7,_0x5e9b98){_0x5e9b98=_0x5e9b98||0xc8;return function(_0x526972){if(_0x526972){return _0xb733b7['status'](_0x5e9b98)['json'](_0x526972);}};}function respondWithFilteredResult(_0x188d02,_0xf509f9){return function(_0x42dd1f){if(_0x42dd1f){var _0x326468=_0x42dd1f['count'],_0x105afa=_0xf509f9[_0xc5ad('0x34')],_0x392469=_0xf509f9[_0xc5ad('0x34')]+_0xf509f9[_0xc5ad('0x35')],_0x453423;if(_0x392469>=_0x326468){_0x392469=_0x326468;_0x453423=0xc8;}else{_0x453423=0xce;}_0x188d02[_0xc5ad('0x32')](_0x453423);return _0x188d02[_0xc5ad('0x36')](_0xc5ad('0x37'),_0x105afa+'-'+_0x392469+'/'+_0x326468)[_0xc5ad('0x38')](_0x42dd1f);}return null;};}function patchUpdates(_0x4c603a){return function(_0x6417a7){try{jsonpatch['apply'](_0x6417a7,_0x4c603a,!![]);}catch(_0x486aa2){return BPromise[_0xc5ad('0x39')](_0x486aa2);}return _0x6417a7[_0xc5ad('0x3a')]();};}function saveUpdates(_0x26dba7,_0x5c1120){return function(_0x2e67fe){if(_0x2e67fe){return _0x2e67fe['update'](_0x26dba7)[_0xc5ad('0x28')](function(_0x2b1c29){return _0x2b1c29;});}return null;};}function removeEntity(_0x1bf8fe,_0x316a08){return function(_0x2108ab){if(_0x2108ab){return _0x2108ab['destroy']()[_0xc5ad('0x28')](function(){var _0x22c929=_0x2108ab['get']({'plain':!![]});var _0x34063f=_0xc5ad('0x3b');return db[_0xc5ad('0x3c')][_0xc5ad('0x3d')]({'where':{'type':_0x34063f,'resourceId':_0x22c929['id']}})[_0xc5ad('0x28')](function(){return _0x2108ab;});})[_0xc5ad('0x28')](function(){_0x1bf8fe[_0xc5ad('0x32')](0xcc)[_0xc5ad('0x33')]();});}};}function handleEntityNotFound(_0x547a09,_0x569c18){return function(_0x231397){if(!_0x231397){_0x547a09['sendStatus'](0x194);}return _0x231397;};}function handleError(_0x49bb56,_0x5da57d){_0x5da57d=_0x5da57d||0x1f4;return function(_0x487cef){logger[_0xc5ad('0x2e')](_0x487cef['stack']);if(_0x487cef[_0xc5ad('0x3e')]){delete _0x487cef[_0xc5ad('0x3e')];}_0x49bb56[_0xc5ad('0x32')](_0x5da57d)[_0xc5ad('0x3f')](_0x487cef);};}exports[_0xc5ad('0x40')]=function(_0x126d25,_0x5be217){var _0x5d21ba={'include':[{'model':db['MailServerIn'],'as':_0xc5ad('0x41')},{'model':db[_0xc5ad('0x42')],'as':'Smtp'},{'model':db['Pause'],'as':_0xc5ad('0x43')}]},_0x19e118={},_0x1a5fe7={'count':0x0,'rows':[]};var _0x5c5310=_[_0xc5ad('0x44')](db[_0xc5ad('0x45')][_0xc5ad('0x46')],function(_0x133171){return{'name':_0x133171['fieldName'],'type':_0x133171['type']['key']};});_0x19e118[_0xc5ad('0x47')]=_[_0xc5ad('0x44')](_0x5c5310,_0xc5ad('0x3e'));_0x19e118[_0xc5ad('0x48')]=_['keys'](_0x126d25[_0xc5ad('0x48')]);_0x19e118[_0xc5ad('0x49')]=_[_0xc5ad('0x4a')](_0x19e118[_0xc5ad('0x47')],_0x19e118[_0xc5ad('0x48')]);_0x5d21ba[_0xc5ad('0x4b')]=_[_0xc5ad('0x4a')](_0x19e118[_0xc5ad('0x47')],qs['fields'](_0x126d25[_0xc5ad('0x48')][_0xc5ad('0x4c')]));_0x5d21ba['attributes']=_0x5d21ba[_0xc5ad('0x4b')][_0xc5ad('0x4d')]?_0x5d21ba[_0xc5ad('0x4b')]:_0x19e118[_0xc5ad('0x47')];if(!_0x126d25[_0xc5ad('0x48')]['hasOwnProperty']('nolimit')){_0x5d21ba[_0xc5ad('0x35')]=qs[_0xc5ad('0x35')](_0x126d25[_0xc5ad('0x48')][_0xc5ad('0x35')]);_0x5d21ba['offset']=qs[_0xc5ad('0x34')](_0x126d25['query']['offset']);}_0x5d21ba[_0xc5ad('0x4e')]=qs[_0xc5ad('0x4f')](_0x126d25['query'][_0xc5ad('0x4f')]);_0x5d21ba[_0xc5ad('0x50')]=qs[_0xc5ad('0x49')](_[_0xc5ad('0x51')](_0x126d25[_0xc5ad('0x48')],_0x19e118[_0xc5ad('0x49')]));if(_0x126d25[_0xc5ad('0x48')]['filter']){_0x5d21ba[_0xc5ad('0x50')]=_[_0xc5ad('0x52')](_0x5d21ba['where'],{'$or':_[_0xc5ad('0x44')](_0x5c5310,function(_0xf471ff){if(_0xf471ff['type']!==_0xc5ad('0x53')){var _0x464d3e={};_0x464d3e[_0xf471ff[_0xc5ad('0x3e')]]={'$like':'%'+_0x126d25[_0xc5ad('0x48')][_0xc5ad('0x54')]+'%'};return _0x464d3e;}})});}_0x5d21ba=_[_0xc5ad('0x52')]({},_0x5d21ba,_0x126d25[_0xc5ad('0x55')]);var _0x1bb1d5={'where':_0x5d21ba[_0xc5ad('0x50')]};return db[_0xc5ad('0x45')][_0xc5ad('0x56')](_0x1bb1d5)[_0xc5ad('0x28')](function(_0x41b5e3){_0x1a5fe7[_0xc5ad('0x56')]=_0x41b5e3;if(_0x126d25[_0xc5ad('0x48')][_0xc5ad('0x57')]){_0x5d21ba[_0xc5ad('0x58')]=[{'all':!![]}];}return db[_0xc5ad('0x45')][_0xc5ad('0x59')](_0x5d21ba);})['then'](function(_0xa7f356){_0x1a5fe7[_0xc5ad('0x5a')]=_0xa7f356;return _0x1a5fe7;})[_0xc5ad('0x28')](respondWithFilteredResult(_0x5be217,_0x5d21ba))[_0xc5ad('0x30')](handleError(_0x5be217,null));};exports['show']=function(_0x6cd31c,_0x527abf){var _0x1585c2={'raw':![],'where':{'id':_0x6cd31c[_0xc5ad('0x5b')]['id']},'include':[{'model':db['MailServerIn'],'as':_0xc5ad('0x41')},{'model':db['MailServerOut'],'as':_0xc5ad('0x5c')},{'model':db[_0xc5ad('0x5d')],'as':_0xc5ad('0x43')}]},_0x2ef143={};_0x2ef143['model']=_[_0xc5ad('0x5e')](db[_0xc5ad('0x45')][_0xc5ad('0x46')]);_0x2ef143['query']=_['keys'](_0x6cd31c[_0xc5ad('0x48')]);_0x2ef143[_0xc5ad('0x49')]=_[_0xc5ad('0x4a')](_0x2ef143[_0xc5ad('0x47')],_0x2ef143[_0xc5ad('0x48')]);_0x1585c2[_0xc5ad('0x4b')]=_[_0xc5ad('0x4a')](_0x2ef143[_0xc5ad('0x47')],qs[_0xc5ad('0x4c')](_0x6cd31c[_0xc5ad('0x48')]['fields']));_0x1585c2['attributes']=_0x1585c2[_0xc5ad('0x4b')][_0xc5ad('0x4d')]?_0x1585c2['attributes']:_0x2ef143[_0xc5ad('0x47')];if(_0x6cd31c[_0xc5ad('0x48')][_0xc5ad('0x57')]){_0x1585c2['include']=[{'all':!![]}];}_0x1585c2=_[_0xc5ad('0x52')]({},_0x1585c2,_0x6cd31c[_0xc5ad('0x55')]);return db[_0xc5ad('0x45')][_0xc5ad('0x5f')](_0x1585c2)[_0xc5ad('0x28')](handleEntityNotFound(_0x527abf,null))[_0xc5ad('0x28')](respondWithResult(_0x527abf,null))[_0xc5ad('0x30')](handleError(_0x527abf,null));};exports[_0xc5ad('0x60')]=function(_0x501fa2,_0x5e6f34){if(_0x501fa2[_0xc5ad('0x61')]['id']){delete _0x501fa2[_0xc5ad('0x61')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x501fa2[_0xc5ad('0x5b')]['id']},'include':[{'model':db[_0xc5ad('0x62')],'as':'Imap'},{'model':db[_0xc5ad('0x42')],'as':_0xc5ad('0x5c')},{'model':db[_0xc5ad('0x5d')],'as':_0xc5ad('0x43')}]})[_0xc5ad('0x28')](handleEntityNotFound(_0x5e6f34,null))[_0xc5ad('0x28')](saveUpdates(_0x501fa2[_0xc5ad('0x61')],null))[_0xc5ad('0x28')](function(_0x4b236f){if(_0x4b236f&&_0x501fa2['body'][_0xc5ad('0x41')]){return db[_0xc5ad('0x62')][_0xc5ad('0x60')](_0x501fa2[_0xc5ad('0x61')]['Imap'],{'where':{'MailAccountId':_0x4b236f['id']}})['then'](function(){return _0x4b236f;});}return _0x4b236f;})[_0xc5ad('0x28')](function(_0x50c839){if(_0x50c839&&_0x501fa2[_0xc5ad('0x61')][_0xc5ad('0x5c')]){return db['MailServerOut'][_0xc5ad('0x60')](_0x501fa2[_0xc5ad('0x61')][_0xc5ad('0x5c')],{'where':{'MailAccountId':_0x50c839['id']}})['then'](function(){return _0x50c839;});}return _0x50c839;})[_0xc5ad('0x28')](respondWithResult(_0x5e6f34,null))['catch'](handleError(_0x5e6f34,null));};exports[_0xc5ad('0x63')]=function(_0x403536,_0x5b8b9f){return db[_0xc5ad('0x45')]['describe']()[_0xc5ad('0x28')](respondWithResult(_0x5b8b9f,null))['catch'](handleError(_0x5b8b9f,null));};exports[_0xc5ad('0x64')]=function(_0x440c2a,_0x2bf1c2,_0x5680f6){if(_0x440c2a['body']['id']){delete _0x440c2a[_0xc5ad('0x61')]['id'];}return db[_0xc5ad('0x45')][_0xc5ad('0x5f')]({'where':{'id':_0x440c2a[_0xc5ad('0x5b')]['id']}})[_0xc5ad('0x28')](handleEntityNotFound(_0x2bf1c2,null))['then'](function(_0x1c8ef9){if(_0x1c8ef9){_0x440c2a['body'][_0xc5ad('0x65')]=_0x1c8ef9['id'];return db[_0xc5ad('0x66')]['create'](_0x440c2a['body']);}})['then'](respondWithResult(_0x2bf1c2,null))['catch'](handleError(_0x2bf1c2,null));};exports['getDispositions']=function(_0x271069,_0x1279b3,_0x34611b){var _0x5e5030={'raw':![],'where':{}};var _0x3dfa78={};var _0x52f2c8={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x271069['params']['id']}})['then'](handleEntityNotFound(_0x1279b3,null))[_0xc5ad('0x28')](function(_0x257adc){if(_0x257adc){_0x3dfa78['model']=_[_0xc5ad('0x5e')](db[_0xc5ad('0x66')]['rawAttributes']);_0x3dfa78['query']=_[_0xc5ad('0x5e')](_0x271069[_0xc5ad('0x48')]);_0x3dfa78[_0xc5ad('0x49')]=_[_0xc5ad('0x4a')](_0x3dfa78[_0xc5ad('0x47')],_0x3dfa78[_0xc5ad('0x48')]);_0x5e5030[_0xc5ad('0x4b')]=_['intersection'](_0x3dfa78['model'],qs['fields'](_0x271069[_0xc5ad('0x48')][_0xc5ad('0x4c')]));_0x5e5030[_0xc5ad('0x4b')]=_0x5e5030[_0xc5ad('0x4b')][_0xc5ad('0x4d')]?_0x5e5030[_0xc5ad('0x4b')]:_0x3dfa78[_0xc5ad('0x47')];if(!_0x271069[_0xc5ad('0x48')]['hasOwnProperty']('nolimit')){_0x5e5030['limit']=qs[_0xc5ad('0x35')](_0x271069[_0xc5ad('0x48')][_0xc5ad('0x35')]);_0x5e5030[_0xc5ad('0x34')]=qs[_0xc5ad('0x34')](_0x271069[_0xc5ad('0x48')][_0xc5ad('0x34')]);}_0x5e5030[_0xc5ad('0x4e')]=qs[_0xc5ad('0x4f')](_0x271069['query'][_0xc5ad('0x4f')]);_0x5e5030[_0xc5ad('0x50')]=qs['filters'](_[_0xc5ad('0x51')](_0x271069[_0xc5ad('0x48')],_0x3dfa78[_0xc5ad('0x49')]));_0x5e5030[_0xc5ad('0x50')][_0xc5ad('0x65')]=_0x257adc['id'];if(_0x271069[_0xc5ad('0x48')][_0xc5ad('0x54')]){_0x5e5030[_0xc5ad('0x50')]=_['merge'](_0x5e5030[_0xc5ad('0x50')],{'$or':_[_0xc5ad('0x44')](_0x5e5030[_0xc5ad('0x4b')],function(_0x521e63){var _0x628fdd={};_0x628fdd[_0x521e63]={'$like':'%'+_0x271069[_0xc5ad('0x48')][_0xc5ad('0x54')]+'%'};return _0x628fdd;})});}_0x5e5030=_[_0xc5ad('0x52')]({},_0x5e5030,_0x271069['options']);return db['Disposition'][_0xc5ad('0x56')]({'where':_0x5e5030['where']})[_0xc5ad('0x28')](function(_0x27b6f3){_0x52f2c8['count']=_0x27b6f3;if(_0x271069[_0xc5ad('0x48')][_0xc5ad('0x57')]){_0x5e5030[_0xc5ad('0x58')]=[{'all':!![]}];}return db[_0xc5ad('0x66')][_0xc5ad('0x59')](_0x5e5030);})[_0xc5ad('0x28')](function(_0x1c1509){_0x52f2c8[_0xc5ad('0x5a')]=_0x1c1509;return _0x52f2c8;});}})[_0xc5ad('0x28')](respondWithFilteredResult(_0x1279b3,_0x5e5030))[_0xc5ad('0x30')](handleError(_0x1279b3,null));};exports[_0xc5ad('0x67')]=function(_0x111f86,_0x5cf0b9,_0x520a76){return db[_0xc5ad('0x45')]['find']({'where':{'id':_0x111f86['params']['id']}})['then'](handleEntityNotFound(_0x5cf0b9,null))[_0xc5ad('0x28')](function(_0x121b09){if(_0x121b09){return _0x121b09['removeDispositions'](_0x111f86[_0xc5ad('0x48')]['ids']);}})['then'](respondWithStatusCode(_0x5cf0b9,null))['catch'](handleError(_0x5cf0b9,null));};exports[_0xc5ad('0x68')]=function(_0x344b15,_0x32a5c9,_0xb0f278){if(_0x344b15[_0xc5ad('0x61')]['id']){delete _0x344b15[_0xc5ad('0x61')]['id'];}return db[_0xc5ad('0x45')][_0xc5ad('0x5f')]({'where':{'id':_0x344b15['params']['id']}})[_0xc5ad('0x28')](handleEntityNotFound(_0x32a5c9,null))[_0xc5ad('0x28')](function(_0xa9cdb4){if(_0xa9cdb4){_0x344b15['body'][_0xc5ad('0x65')]=_0xa9cdb4['id'];return db['CannedAnswer'][_0xc5ad('0x69')](_0x344b15['body']);}})['then'](respondWithResult(_0x32a5c9,null))[_0xc5ad('0x30')](handleError(_0x32a5c9,null));};exports[_0xc5ad('0x6a')]=function(_0x546061,_0x2379be,_0x1c7e1){var _0x1f8da6={'raw':![],'where':{}};var _0x3ba9b1={};var _0x3ffb3a={'count':0x0,'rows':[]};return db[_0xc5ad('0x45')][_0xc5ad('0x6b')]({'where':{'id':_0x546061[_0xc5ad('0x5b')]['id']}})[_0xc5ad('0x28')](handleEntityNotFound(_0x2379be,null))[_0xc5ad('0x28')](function(_0xfa9b0d){if(_0xfa9b0d){_0x3ba9b1[_0xc5ad('0x47')]=_[_0xc5ad('0x5e')](db[_0xc5ad('0x6c')][_0xc5ad('0x46')]);_0x3ba9b1[_0xc5ad('0x48')]=_[_0xc5ad('0x5e')](_0x546061[_0xc5ad('0x48')]);_0x3ba9b1[_0xc5ad('0x49')]=_[_0xc5ad('0x4a')](_0x3ba9b1[_0xc5ad('0x47')],_0x3ba9b1[_0xc5ad('0x48')]);_0x1f8da6[_0xc5ad('0x4b')]=_[_0xc5ad('0x4a')](_0x3ba9b1[_0xc5ad('0x47')],qs[_0xc5ad('0x4c')](_0x546061[_0xc5ad('0x48')][_0xc5ad('0x4c')]));_0x1f8da6[_0xc5ad('0x4b')]=_0x1f8da6[_0xc5ad('0x4b')][_0xc5ad('0x4d')]?_0x1f8da6[_0xc5ad('0x4b')]:_0x3ba9b1[_0xc5ad('0x47')];if(!_0x546061['query'][_0xc5ad('0x6d')](_0xc5ad('0x6e'))){_0x1f8da6[_0xc5ad('0x35')]=qs[_0xc5ad('0x35')](_0x546061[_0xc5ad('0x48')]['limit']);_0x1f8da6[_0xc5ad('0x34')]=qs[_0xc5ad('0x34')](_0x546061['query']['offset']);}_0x1f8da6[_0xc5ad('0x4e')]=qs[_0xc5ad('0x4f')](_0x546061[_0xc5ad('0x48')][_0xc5ad('0x4f')]);_0x1f8da6['where']=qs[_0xc5ad('0x49')](_[_0xc5ad('0x51')](_0x546061[_0xc5ad('0x48')],_0x3ba9b1['filters']));_0x1f8da6[_0xc5ad('0x50')][_0xc5ad('0x65')]=_0xfa9b0d['id'];if(_0x546061[_0xc5ad('0x48')][_0xc5ad('0x54')]){_0x1f8da6[_0xc5ad('0x50')]=_[_0xc5ad('0x52')](_0x1f8da6[_0xc5ad('0x50')],{'$or':_['map'](_0x1f8da6['attributes'],function(_0x149623){var _0x30611b={};_0x30611b[_0x149623]={'$like':'%'+_0x546061['query'][_0xc5ad('0x54')]+'%'};return _0x30611b;})});}_0x1f8da6=_['merge']({},_0x1f8da6,_0x546061[_0xc5ad('0x55')]);return db['CannedAnswer'][_0xc5ad('0x56')]({'where':_0x1f8da6[_0xc5ad('0x50')]})['then'](function(_0x3b81a2){_0x3ffb3a[_0xc5ad('0x56')]=_0x3b81a2;if(_0x546061[_0xc5ad('0x48')][_0xc5ad('0x57')]){_0x1f8da6[_0xc5ad('0x58')]=[{'all':!![]}];}return db[_0xc5ad('0x6c')][_0xc5ad('0x59')](_0x1f8da6);})[_0xc5ad('0x28')](function(_0x2ccb14){_0x3ffb3a[_0xc5ad('0x5a')]=_0x2ccb14;return _0x3ffb3a;});}})[_0xc5ad('0x28')](respondWithFilteredResult(_0x2379be,_0x1f8da6))[_0xc5ad('0x30')](handleError(_0x2379be,null));};exports[_0xc5ad('0x6f')]=function(_0x45a0de,_0x49d7b7,_0x16c44b){return db[_0xc5ad('0x45')][_0xc5ad('0x5f')]({'where':{'id':_0x45a0de[_0xc5ad('0x5b')]['id']}})[_0xc5ad('0x28')](handleEntityNotFound(_0x49d7b7,null))['then'](function(_0x588902){if(_0x588902){return _0x588902[_0xc5ad('0x6f')](_0x45a0de[_0xc5ad('0x48')][_0xc5ad('0x70')]);}})[_0xc5ad('0x28')](respondWithStatusCode(_0x49d7b7,null))[_0xc5ad('0x30')](handleError(_0x49d7b7,null));};exports['create']=function(_0x1b133c,_0x362449){var _0x2eb860={'name':_0x1b133c[_0xc5ad('0x61')][_0xc5ad('0x3e')],'key':_0x1b133c[_0xc5ad('0x61')][_0xc5ad('0x71')],'email':_0x1b133c['body'][_0xc5ad('0x72')],'ListId':_0x1b133c[_0xc5ad('0x61')][_0xc5ad('0x73')],'active':!_[_0xc5ad('0x74')](_0x1b133c[_0xc5ad('0x61')][_0xc5ad('0x75')])?_0x1b133c[_0xc5ad('0x61')][_0xc5ad('0x75')]:!![],'description':_0x1b133c['body'][_0xc5ad('0x76')]||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x1b133c['body']['cservice'])){if(_0x1b133c['body']['cauthentication']){_0x2eb860[_0xc5ad('0x41')][_0xc5ad('0x77')]=_0x2eb860[_0xc5ad('0x5c')]['user']=_0x1b133c[_0xc5ad('0x61')][_0xc5ad('0x78')];_0x2eb860[_0xc5ad('0x41')][_0xc5ad('0x79')]=_0x2eb860['Smtp'][_0xc5ad('0x7a')]=_0x1b133c[_0xc5ad('0x61')]['cpassword'];}else{_0x2eb860['Imap']['authentication']=_0x2eb860[_0xc5ad('0x5c')][_0xc5ad('0x7b')]=![];}_0x2eb860['Imap'][_0xc5ad('0x7c')]=_0x1b133c[_0xc5ad('0x61')]['Imap']['host'];_0x2eb860[_0xc5ad('0x41')]['port']=_0x1b133c['body'][_0xc5ad('0x41')][_0xc5ad('0x7d')];_0x2eb860[_0xc5ad('0x5c')][_0xc5ad('0x7c')]=_0x1b133c[_0xc5ad('0x61')]['Smtp'][_0xc5ad('0x7c')];_0x2eb860[_0xc5ad('0x5c')]['port']=_0x1b133c['body'][_0xc5ad('0x5c')][_0xc5ad('0x7d')];}else{_0x2eb860[_0xc5ad('0x41')][_0xc5ad('0x7e')]=_0x2eb860[_0xc5ad('0x5c')]['service']=_0x1b133c[_0xc5ad('0x61')][_0xc5ad('0x7f')];_0x2eb860['Imap'][_0xc5ad('0x77')]=_0x2eb860[_0xc5ad('0x5c')][_0xc5ad('0x77')]=_0x1b133c[_0xc5ad('0x61')][_0xc5ad('0x78')];_0x2eb860[_0xc5ad('0x41')][_0xc5ad('0x79')]=_0x2eb860[_0xc5ad('0x5c')][_0xc5ad('0x7a')]=_0x1b133c[_0xc5ad('0x61')][_0xc5ad('0x80')];}return db[_0xc5ad('0x45')][_0xc5ad('0x69')](_0x2eb860,{'include':[{'model':db[_0xc5ad('0x42')],'as':'Smtp'},{'model':db[_0xc5ad('0x62')],'as':_0xc5ad('0x41')}]})[_0xc5ad('0x28')](function(_0xfbddb4){var _0x5a80d1=_0x1b133c['user'][_0xc5ad('0x81')]({'plain':!![]});if(!_0x5a80d1)throw new Error(_0xc5ad('0x82'));if(_0x5a80d1[_0xc5ad('0x83')]===_0xc5ad('0x77')){var _0x2f6d66=_0xfbddb4[_0xc5ad('0x81')]({'plain':!![]});return db[_0xc5ad('0x84')][_0xc5ad('0x5f')]({'where':{'name':_0xc5ad('0x3b'),'userProfileId':_0x5a80d1[_0xc5ad('0x85')]},'raw':!![]})[_0xc5ad('0x28')](function(_0xb7c5c3){if(_0xb7c5c3&&_0xb7c5c3[_0xc5ad('0x86')]===0x0){return db[_0xc5ad('0x3c')][_0xc5ad('0x69')]({'name':_0x2f6d66[_0xc5ad('0x3e')],'resourceId':_0x2f6d66['id'],'type':_0xb7c5c3['name'],'sectionId':_0xb7c5c3['id']},{})['then'](function(){return _0xfbddb4;});}else{return _0xfbddb4;}})[_0xc5ad('0x30')](function(_0x476b27){logger['error'](_0xc5ad('0x87'),_0x476b27);throw _0x476b27;});}return _0xfbddb4;})[_0xc5ad('0x28')](respondWithResult(_0x362449,0xc9))[_0xc5ad('0x30')](handleError(_0x362449,null));};exports[_0xc5ad('0x88')]=function(_0x5810c2,_0x24f8e4,_0x1b3e2d){return db[_0xc5ad('0x45')][_0xc5ad('0x6b')]({'where':{'id':_0x5810c2[_0xc5ad('0x5b')]['id']}})[_0xc5ad('0x28')](handleEntityNotFound(_0x24f8e4,null))[_0xc5ad('0x28')](function(_0x15a142){if(_0x15a142){return _0x15a142['getImap']();}return null;})[_0xc5ad('0x28')](respondWithResult(_0x24f8e4,null))[_0xc5ad('0x30')](handleError(_0x24f8e4,null));};exports[_0xc5ad('0x89')]=function(_0x5eb01f,_0x5e3285,_0x35f485){if(_0x5eb01f[_0xc5ad('0x61')]['id']){delete _0x5eb01f['body']['id'];}return db['MailAccount'][_0xc5ad('0x5f')]({'where':{'id':_0x5eb01f['params']['id']}})[_0xc5ad('0x28')](handleEntityNotFound(_0x5e3285,null))[_0xc5ad('0x28')](function(_0x4cbd21){if(_0x4cbd21){_0x5eb01f[_0xc5ad('0x61')]['MailAccountId']=_0x4cbd21['id'];return db[_0xc5ad('0x62')][_0xc5ad('0x69')](_0x5eb01f[_0xc5ad('0x61')]);}})[_0xc5ad('0x28')](respondWithResult(_0x5e3285,null))[_0xc5ad('0x30')](handleError(_0x5e3285,null));};exports[_0xc5ad('0x8a')]=function(_0x277a3e,_0x4f9666,_0x2dedda){return db['MailAccount'][_0xc5ad('0x6b')]({'where':{'id':_0x277a3e[_0xc5ad('0x5b')]['id']}})[_0xc5ad('0x28')](handleEntityNotFound(_0x4f9666,null))[_0xc5ad('0x28')](function(_0x5d44a2){if(_0x5d44a2){return _0x5d44a2['setImap'](null);}return null;})[_0xc5ad('0x28')](respondWithStatusCode(_0x4f9666,null))[_0xc5ad('0x30')](handleError(_0x4f9666,null));};exports[_0xc5ad('0x8b')]=function(_0x3af0e5,_0xbc86f9,_0xd91c8a){return db[_0xc5ad('0x45')][_0xc5ad('0x6b')]({'where':{'id':_0x3af0e5[_0xc5ad('0x5b')]['id']}})['then'](handleEntityNotFound(_0xbc86f9,null))[_0xc5ad('0x28')](function(_0x2a93a8){if(_0x2a93a8){return _0x2a93a8[_0xc5ad('0x8b')]();}return null;})[_0xc5ad('0x28')](respondWithResult(_0xbc86f9,null))[_0xc5ad('0x30')](handleError(_0xbc86f9,null));};exports[_0xc5ad('0x8c')]=function(_0x544649,_0xdb11ca,_0x468a41){if(_0x544649['body']['id']){delete _0x544649['body']['id'];}return db[_0xc5ad('0x45')][_0xc5ad('0x5f')]({'where':{'id':_0x544649[_0xc5ad('0x5b')]['id']}})[_0xc5ad('0x28')](handleEntityNotFound(_0xdb11ca,null))[_0xc5ad('0x28')](function(_0x444c4c){if(_0x444c4c){_0x544649[_0xc5ad('0x61')][_0xc5ad('0x65')]=_0x444c4c['id'];return db[_0xc5ad('0x42')]['create'](_0x544649['body']);}})['then'](respondWithResult(_0xdb11ca,null))[_0xc5ad('0x30')](handleError(_0xdb11ca,null));};exports['removeSmtp']=function(_0x148940,_0x266a81,_0x428fde){return db[_0xc5ad('0x45')][_0xc5ad('0x6b')]({'where':{'id':_0x148940['params']['id']}})[_0xc5ad('0x28')](handleEntityNotFound(_0x266a81,null))[_0xc5ad('0x28')](function(_0x2a6b2f){if(_0x2a6b2f){return _0x2a6b2f['setSmtp'](null);}return null;})[_0xc5ad('0x28')](respondWithStatusCode(_0x266a81,null))[_0xc5ad('0x30')](handleError(_0x266a81,null));};exports[_0xc5ad('0x8d')]=function(_0x211882,_0x2a635c,_0x46704e){return db[_0xc5ad('0x8e')]['find']({'where':{'id':_0x211882[_0xc5ad('0x5b')]['id']}})['then'](handleEntityNotFound(_0x2a635c,null))[_0xc5ad('0x28')](function(_0x827527){if(_0x827527){return _0x827527[_0xc5ad('0x8d')](_0x211882[_0xc5ad('0x61')][_0xc5ad('0x70')],_[_0xc5ad('0x8f')](_0x211882['body'],[_0xc5ad('0x70'),'id'])||{});}})['then'](respondWithResult(_0x2a635c,null))[_0xc5ad('0x30')](handleError(_0x2a635c,null));};exports[_0xc5ad('0x90')]=function(_0x3dc42f,_0x59d39a,_0x6dae80){var _0x5c161f={'raw':![],'where':{}};var _0x5abcd6={};var _0x22e8ee={'count':0x0,'rows':[]};return db[_0xc5ad('0x45')][_0xc5ad('0x6b')]({'where':{'id':_0x3dc42f[_0xc5ad('0x5b')]['id']}})[_0xc5ad('0x28')](handleEntityNotFound(_0x59d39a,null))['then'](function(_0x3d9cdc){if(_0x3d9cdc){_0x5abcd6[_0xc5ad('0x47')]=_[_0xc5ad('0x5e')](db[_0xc5ad('0x8e')]['rawAttributes']);_0x5abcd6[_0xc5ad('0x48')]=_[_0xc5ad('0x5e')](_0x3dc42f[_0xc5ad('0x48')]);_0x5abcd6['filters']=_[_0xc5ad('0x4a')](_0x5abcd6[_0xc5ad('0x47')],_0x5abcd6[_0xc5ad('0x48')]);_0x5c161f['attributes']=_[_0xc5ad('0x4a')](_0x5abcd6[_0xc5ad('0x47')],qs[_0xc5ad('0x4c')](_0x3dc42f[_0xc5ad('0x48')][_0xc5ad('0x4c')]));_0x5c161f[_0xc5ad('0x4b')]=_0x5c161f[_0xc5ad('0x4b')][_0xc5ad('0x4d')]?_0x5c161f[_0xc5ad('0x4b')]:_0x5abcd6[_0xc5ad('0x47')];if(!_0x3dc42f[_0xc5ad('0x48')][_0xc5ad('0x6d')](_0xc5ad('0x6e'))){_0x5c161f[_0xc5ad('0x35')]=qs[_0xc5ad('0x35')](_0x3dc42f[_0xc5ad('0x48')][_0xc5ad('0x35')]);_0x5c161f['offset']=qs['offset'](_0x3dc42f['query'][_0xc5ad('0x34')]);}_0x5c161f[_0xc5ad('0x4e')]=qs['sort'](_0x3dc42f[_0xc5ad('0x48')][_0xc5ad('0x4f')]);_0x5c161f['where']=qs[_0xc5ad('0x49')](_[_0xc5ad('0x51')](_0x3dc42f[_0xc5ad('0x48')],_0x5abcd6['filters']));_0x5c161f['where'][_0xc5ad('0x65')]=_0x3d9cdc['id'];if(_0x3dc42f[_0xc5ad('0x48')][_0xc5ad('0x54')]){_0x5c161f[_0xc5ad('0x50')]=_[_0xc5ad('0x52')](_0x5c161f['where'],{'$or':_[_0xc5ad('0x44')](_0x5c161f[_0xc5ad('0x4b')],function(_0x6b0b8b){var _0x542a57={};_0x542a57[_0x6b0b8b]={'$like':'%'+_0x3dc42f[_0xc5ad('0x48')]['filter']+'%'};return _0x542a57;})});}_0x5c161f=_[_0xc5ad('0x52')]({},_0x5c161f,_0x3dc42f['options']);return db[_0xc5ad('0x8e')]['count']({'where':_0x5c161f[_0xc5ad('0x50')]})['then'](function(_0x16395c){_0x22e8ee[_0xc5ad('0x56')]=_0x16395c;if(_0x3dc42f[_0xc5ad('0x48')]['includeAll']){_0x5c161f[_0xc5ad('0x58')]=[{'model':db[_0xc5ad('0x91')],'as':'Contact','required':![]},{'model':db[_0xc5ad('0x92')],'as':_0xc5ad('0x93'),'attributes':['name',_0xc5ad('0x94'),_0xc5ad('0x95')],'required':![]},{'model':db[_0xc5ad('0x96')],'as':_0xc5ad('0x97'),'attributes':['id','name','color'],'where':_0x3dc42f[_0xc5ad('0x48')][_0xc5ad('0x98')]?{'id':_0x3dc42f[_0xc5ad('0x48')][_0xc5ad('0x98')]}:undefined,'required':_0x3dc42f[_0xc5ad('0x48')][_0xc5ad('0x98')]?!![]:![]}];}return db[_0xc5ad('0x8e')][_0xc5ad('0x59')](_0x5c161f);})[_0xc5ad('0x28')](function(_0x21383a){_0x22e8ee[_0xc5ad('0x5a')]=_0x21383a;return _0x22e8ee;});}})[_0xc5ad('0x28')](respondWithFilteredResult(_0x59d39a,_0x5c161f))[_0xc5ad('0x30')](handleError(_0x59d39a,null));};exports[_0xc5ad('0x99')]=function(_0x4c35a9,_0x38071c,_0x724b83){return db['MailAccount'][_0xc5ad('0x6b')]({'where':{'id':_0x4c35a9[_0xc5ad('0x5b')]['id']}})[_0xc5ad('0x28')](handleEntityNotFound(_0x38071c,null))[_0xc5ad('0x28')](function(_0x4a1c67){if(_0x4a1c67){return db['sequelize'][_0xc5ad('0x9a')](function(_0x53601e){return db[_0xc5ad('0x9b')][_0xc5ad('0x3d')]({'where':{'MailAccountId':_0x4c35a9[_0xc5ad('0x5b')]['id']},'transaction':_0x53601e})[_0xc5ad('0x28')](function(_0x344966){var _0x5df821=_['map'](_0x4c35a9[_0xc5ad('0x61')],function(_0xa75fcd){_0xa75fcd[_0xc5ad('0x65')]=_0x4c35a9[_0xc5ad('0x5b')]['id'];return _0xa75fcd;});return db[_0xc5ad('0x9b')][_0xc5ad('0x9c')](_0x5df821,{'transaction':_0x53601e});});})[_0xc5ad('0x28')](function(){return db[_0xc5ad('0x9b')][_0xc5ad('0x9d')]({'where':{'MailAccountId':_0x4c35a9[_0xc5ad('0x5b')]['id']},'order':'priority'});});}})[_0xc5ad('0x28')](respondWithResult(_0x38071c,null))['catch'](handleError(_0x38071c,null));};exports[_0xc5ad('0x9e')]=function(_0x57594b,_0x200c37,_0x2afe5e){var _0x42fb38={};var _0x2f4680={};var _0x523b02;var _0x1f4398;return db[_0xc5ad('0x45')][_0xc5ad('0x6b')]({'where':{'id':_0x57594b[_0xc5ad('0x5b')]['id']}})[_0xc5ad('0x28')](handleEntityNotFound(_0x200c37,null))['then'](function(_0x252f62){if(_0x252f62){_0x523b02=_0x252f62;_0x2f4680[_0xc5ad('0x47')]=_[_0xc5ad('0x5e')](db[_0xc5ad('0x9b')][_0xc5ad('0x46')]);_0x2f4680['query']=_['keys'](_0x57594b['query']);_0x2f4680[_0xc5ad('0x49')]=_[_0xc5ad('0x4a')](_0x2f4680['model'],_0x2f4680[_0xc5ad('0x48')]);_0x42fb38[_0xc5ad('0x4b')]=_[_0xc5ad('0x4a')](_0x2f4680['model'],qs[_0xc5ad('0x4c')](_0x57594b[_0xc5ad('0x48')]['fields']));_0x42fb38[_0xc5ad('0x4b')]=_0x42fb38['attributes'][_0xc5ad('0x4d')]?_0x42fb38[_0xc5ad('0x4b')]:_0x2f4680[_0xc5ad('0x47')];_0x42fb38['order']=qs[_0xc5ad('0x4f')](_0x57594b[_0xc5ad('0x48')][_0xc5ad('0x4f')]);_0x42fb38['where']=qs[_0xc5ad('0x49')](_[_0xc5ad('0x51')](_0x57594b['query'],_0x2f4680[_0xc5ad('0x49')]));if(_0x57594b[_0xc5ad('0x48')][_0xc5ad('0x54')]){_0x42fb38['where']=_[_0xc5ad('0x52')](_0x42fb38[_0xc5ad('0x50')],{'$or':_[_0xc5ad('0x44')](_0x42fb38[_0xc5ad('0x4b')],function(_0x53103c){var _0xf5f7be={};_0xf5f7be[_0x53103c]={'$like':'%'+_0x57594b[_0xc5ad('0x48')][_0xc5ad('0x54')]+'%'};return _0xf5f7be;})});}_0x42fb38=_[_0xc5ad('0x52')]({},_0x42fb38,_0x57594b[_0xc5ad('0x55')]);return _0x523b02[_0xc5ad('0x9e')](_0x42fb38);}})[_0xc5ad('0x28')](function(_0x51c0e8){if(_0x51c0e8){_0x1f4398=_0x51c0e8[_0xc5ad('0x4d')];if(!_0x57594b['query'][_0xc5ad('0x6d')]('nolimit')){_0x42fb38[_0xc5ad('0x35')]=qs[_0xc5ad('0x35')](_0x57594b[_0xc5ad('0x48')][_0xc5ad('0x35')]);_0x42fb38[_0xc5ad('0x34')]=qs[_0xc5ad('0x34')](_0x57594b[_0xc5ad('0x48')]['offset']);}return _0x523b02[_0xc5ad('0x9e')](_0x42fb38);}})[_0xc5ad('0x28')](function(_0x598b38){if(_0x598b38){return _0x598b38?{'count':_0x1f4398,'rows':_0x598b38}:null;}})[_0xc5ad('0x28')](respondWithResult(_0x200c37,null))[_0xc5ad('0x30')](handleError(_0x200c37,null));};exports['getMessages']=function(_0x59363d,_0x5194a9,_0x4dec08){var _0x2a833d={'raw':!![],'where':{}};var _0x8b6753={};var _0x286af6={'count':0x0,'rows':[]};return db[_0xc5ad('0x45')][_0xc5ad('0x6b')]({'where':{'id':_0x59363d[_0xc5ad('0x5b')]['id']}})[_0xc5ad('0x28')](handleEntityNotFound(_0x5194a9,null))[_0xc5ad('0x28')](function(_0x28e6c9){if(_0x28e6c9){_0x8b6753['model']=_[_0xc5ad('0x5e')](db['MailMessage']['rawAttributes']);_0x8b6753[_0xc5ad('0x48')]=_[_0xc5ad('0x5e')](_0x59363d[_0xc5ad('0x48')]);_0x8b6753['filters']=_[_0xc5ad('0x4a')](_0x8b6753[_0xc5ad('0x47')],_0x8b6753[_0xc5ad('0x48')]);_0x2a833d[_0xc5ad('0x4b')]=_[_0xc5ad('0x4a')](_0x8b6753[_0xc5ad('0x47')],qs['fields'](_0x59363d['query']['fields']));_0x2a833d[_0xc5ad('0x4b')]=_0x2a833d[_0xc5ad('0x4b')][_0xc5ad('0x4d')]?_0x2a833d[_0xc5ad('0x4b')]:_0x8b6753['model'];if(!_0x59363d[_0xc5ad('0x48')][_0xc5ad('0x6d')](_0xc5ad('0x6e'))){_0x2a833d[_0xc5ad('0x35')]=qs['limit'](_0x59363d[_0xc5ad('0x48')][_0xc5ad('0x35')]);_0x2a833d['offset']=qs[_0xc5ad('0x34')](_0x59363d[_0xc5ad('0x48')]['offset']);}_0x2a833d['order']=qs[_0xc5ad('0x4f')](_0x59363d['query'][_0xc5ad('0x4f')]);_0x2a833d['where']=qs['filters'](_['pick'](_0x59363d['query'],_0x8b6753['filters']));_0x2a833d[_0xc5ad('0x50')]['MailAccountId']=_0x28e6c9['id'];if(_0x59363d['query']['filter']){_0x2a833d[_0xc5ad('0x50')]=_['merge'](_0x2a833d['where'],{'$or':_['map'](_0x2a833d[_0xc5ad('0x4b')],function(_0x9df5d6){var _0x101b46={};_0x101b46[_0x9df5d6]={'$like':'%'+_0x59363d['query'][_0xc5ad('0x54')]+'%'};return _0x101b46;})});}if(_0x59363d[_0xc5ad('0x48')][_0xc5ad('0x9f')]){var _0x2da1dc=_0x59363d[_0xc5ad('0x48')][_0xc5ad('0x9f')]['split'](',');var _0x4bd609={};_0x4bd609[_0x2da1dc[0x0]]={'$gte':moment(_0x2da1dc[0x1])[_0xc5ad('0xa0')](_0xc5ad('0xa1'))};_0x2a833d[_0xc5ad('0x50')]=_[_0xc5ad('0x52')](_0x2a833d[_0xc5ad('0x50')],_0x4bd609);}_0x2a833d=_[_0xc5ad('0x52')]({},_0x2a833d,_0x59363d[_0xc5ad('0x55')]);return db[_0xc5ad('0xa2')][_0xc5ad('0x56')]({'where':_0x2a833d[_0xc5ad('0x50')]})[_0xc5ad('0x28')](function(_0x465160){_0x286af6[_0xc5ad('0x56')]=_0x465160;if(_0x59363d[_0xc5ad('0x48')][_0xc5ad('0x57')]){_0x2a833d[_0xc5ad('0x58')]=[{'all':!![]}];}return db['MailMessage'][_0xc5ad('0x59')](_0x2a833d);})[_0xc5ad('0x28')](function(_0xa46dd3){_0x286af6[_0xc5ad('0x5a')]=_0xa46dd3;return _0x286af6;});}})[_0xc5ad('0x28')](respondWithFilteredResult(_0x5194a9,_0x2a833d))[_0xc5ad('0x30')](handleError(_0x5194a9,null));};exports[_0xc5ad('0x3f')]=function(_0x36c43b,_0x499ffd,_0x1865ea){var _0x147975,_0x4c18d4={},_0x3946dc;if(_0x36c43b[_0xc5ad('0x61')]['to']){_0x3946dc=_0x36c43b[_0xc5ad('0x61')]['to'][_0xc5ad('0xa3')](',')[0x0];}return db[_0xc5ad('0x45')]['find']({'where':{'id':_0x36c43b[_0xc5ad('0x5b')]['id']},'include':[{'model':db['CmList'],'as':_0xc5ad('0xa4'),'include':[{'model':db[_0xc5ad('0x91')],'as':_0xc5ad('0xa5'),'where':{'email':_0x3946dc},'limit':0x1,'order':[[_0xc5ad('0xa6'),'DESC']]}]},{'model':db[_0xc5ad('0x42')],'as':'Smtp','raw':!![]}]})['then'](handleEntityNotFound(_0x499ffd,null))[_0xc5ad('0x28')](function(_0xc48219){if(_0xc48219){_0x147975=_0xc48219;if(_0xc48219['Smtp']){if(_[_0xc5ad('0x74')](_0x36c43b[_0xc5ad('0x61')][_0xc5ad('0xa7')])){_0x36c43b[_0xc5ad('0x61')]['from']=util[_0xc5ad('0xa0')](_0xc5ad('0xa8'),_0xc48219['name'],_0xc48219[_0xc5ad('0x72')]||_0xc48219[_0xc5ad('0x5c')][_0xc5ad('0x77')]);}if(_0x36c43b[_0xc5ad('0x61')][_0xc5ad('0xa9')]&&_0x36c43b[_0xc5ad('0x61')][_0xc5ad('0xa9')][_0xc5ad('0x4d')]){for(var _0x107571=0x0;_0x107571<_0x36c43b['body']['attachments'][_0xc5ad('0x4d')];_0x107571+=0x1){_0x36c43b[_0xc5ad('0x61')][_0xc5ad('0xa9')][_0x107571]={'filename':_0x36c43b[_0xc5ad('0x61')][_0xc5ad('0xa9')][_0x107571]['name'],'path':path[_0xc5ad('0xaa')](config['root'],_0xc5ad('0xab'),_0x36c43b[_0xc5ad('0x61')][_0xc5ad('0xa9')][_0x107571][_0xc5ad('0xac')])};}}var _0x4d0dab={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0xc48219[_0xc5ad('0x5c')][_0xc5ad('0x7e')])){if(_0xc48219['Smtp'][_0xc5ad('0x7b')]){_0x4d0dab[_0xc5ad('0xad')]={'user':_0xc48219['Smtp'][_0xc5ad('0x77')],'pass':_0xc48219[_0xc5ad('0x5c')][_0xc5ad('0x7a')]};}_0x4d0dab['host']=_0xc48219[_0xc5ad('0x5c')][_0xc5ad('0x7c')];_0x4d0dab['port']=_0xc48219[_0xc5ad('0x5c')][_0xc5ad('0x7d')];_0x4d0dab[_0xc5ad('0xae')]=_0xc48219[_0xc5ad('0x5c')][_0xc5ad('0xae')];}else{_0x4d0dab['service']=_0xc48219[_0xc5ad('0x5c')][_0xc5ad('0x7e')];_0x4d0dab[_0xc5ad('0xad')]={'user':_0xc48219[_0xc5ad('0x5c')][_0xc5ad('0x77')],'pass':_0xc48219[_0xc5ad('0x5c')][_0xc5ad('0x7a')]};}return respondWithRpcPromise(_0xc5ad('0xaf'),_0xc5ad('0xb0'),{'account':_0x4d0dab,'message':_0x36c43b['body']});}else{throw new Error(_0xc5ad('0xb1'));}}})[_0xc5ad('0x28')](function(_0x3bac6d){if(_0x3bac6d){_0x4c18d4=_0x3bac6d;if(_0x147975[_0xc5ad('0xa4')]){if(_0x147975[_0xc5ad('0xa4')][_0xc5ad('0xa5')][_0xc5ad('0x4d')]){return _0x147975['List'][_0xc5ad('0xa5')][0x0];}else{return db[_0xc5ad('0x91')][_0xc5ad('0x69')](_[_0xc5ad('0x1c')](_0x36c43b[_0xc5ad('0x61')],{'firstName':_0x36c43b[_0xc5ad('0x61')]['to'],'email':_0x36c43b[_0xc5ad('0x61')]['to'],'phone':_0x36c43b[_0xc5ad('0x61')]['to'],'ListId':_0x147975[_0xc5ad('0x73')]}));}}else{throw new Error(_0xc5ad('0xb1'));}}})[_0xc5ad('0x28')](function(_0x204c03){if(_0x204c03){var _0x464457={'UserId':_0x36c43b[_0xc5ad('0x77')]['id'],'ContactId':_0x204c03['id'],'MailAccountId':_0x147975['id'],'inReplyTo':_0x4c18d4[_0xc5ad('0xb2')],'to':_0x36c43b[_0xc5ad('0x61')][_0xc5ad('0xa7')],'cc':_0x36c43b[_0xc5ad('0x61')]['cc'],'subject':_0x36c43b[_0xc5ad('0x61')][_0xc5ad('0xb3')],'attach':_0x36c43b['body'][_0xc5ad('0xb4')],'firstMsgDirection':'out','lastMsgAt':moment()[_0xc5ad('0xa0')](_0xc5ad('0xa1')),'lastMsgDirection':_0xc5ad('0xb5'),'lastMsgBody':_0x36c43b['body']['body'],'Messages':[_[_0xc5ad('0x52')](_0x36c43b[_0xc5ad('0x61')],{'messageId':_0x4c18d4[_0xc5ad('0xb2')],'sentAt':moment()[_0xc5ad('0xa0')](_0xc5ad('0xa1')),'read':!![],'MailAccountId':_0x147975['id'],'UserId':_0x36c43b[_0xc5ad('0x77')]['id'],'ContactId':_0x204c03['id']})]};if(_0x36c43b['body']['Interaction']){_0x464457=_[_0xc5ad('0x52')](_0x464457,_0x36c43b[_0xc5ad('0x61')][_0xc5ad('0xb6')]);}return db['MailInteraction'][_0xc5ad('0x69')](_0x464457,{'include':[{'model':db[_0xc5ad('0xa2')],'as':_0xc5ad('0xb7')}]});}})['then'](respondWithResult(_0x499ffd,null))[_0xc5ad('0x30')](handleError(_0x499ffd,null));};exports[_0xc5ad('0xb8')]=function(_0x39db2a,_0x2c8ed3,_0x126aac){return db[_0xc5ad('0x45')]['find']({'where':{'id':_0x39db2a[_0xc5ad('0x5b')]['id']},'include':[{'model':db[_0xc5ad('0x42')],'as':_0xc5ad('0x5c'),'raw':!![]}]})['then'](handleEntityNotFound(_0x2c8ed3,null))['then'](function(_0xce786a){if(_0xce786a&&_0xce786a['Smtp']){var _0x6c7e41={'id':_0xce786a['id'],'tls':{'rejectUnauthorized':![]}};if(_0xce786a[_0xc5ad('0x5c')][_0xc5ad('0x7e')]){_0x6c7e41[_0xc5ad('0x7e')]=_0xce786a[_0xc5ad('0x5c')][_0xc5ad('0x7e')];}else{_0x6c7e41[_0xc5ad('0x7c')]=_0xce786a[_0xc5ad('0x5c')]['host'];_0x6c7e41[_0xc5ad('0x7d')]=_0xce786a[_0xc5ad('0x5c')][_0xc5ad('0x7d')];_0x6c7e41[_0xc5ad('0xae')]=_0xce786a[_0xc5ad('0x5c')][_0xc5ad('0xae')];}if(_0xce786a[_0xc5ad('0x5c')][_0xc5ad('0x7b')]){_0x6c7e41[_0xc5ad('0xad')]={'user':_0xce786a['Smtp'][_0xc5ad('0x77')],'pass':_0xce786a[_0xc5ad('0x5c')][_0xc5ad('0x7a')]};}return respondWithRpcPromise(_0xc5ad('0xb9'),_0xc5ad('0xb8'),{'account':_0x6c7e41});}})[_0xc5ad('0x28')](respondWithResult(_0x2c8ed3,null))[_0xc5ad('0x30')](handleError(_0x2c8ed3,null));};exports[_0xc5ad('0x3d')]=function(_0x4d36ca,_0x72b6ca){return db[_0xc5ad('0x45')][_0xc5ad('0x5f')]({'where':{'id':_0x4d36ca['params']['id']}})[_0xc5ad('0x28')](handleEntityNotFound(_0x72b6ca,null))[_0xc5ad('0x28')](function(_0x32d191){if(_0x32d191&&_0x32d191[_0xc5ad('0x7e')]){throw new db[(_0xc5ad('0x24'))][(_0xc5ad('0x25'))](_0xc5ad('0xba'));}return _0x32d191;})[_0xc5ad('0x28')](removeEntity(_0x72b6ca,null))['catch'](handleError(_0x72b6ca,null));};exports[_0xc5ad('0xbb')]=function(_0x4dc517,_0x34ed5d,_0xccb7b9){return db[_0xc5ad('0x45')][_0xc5ad('0x5f')]({'where':{'id':_0x4dc517[_0xc5ad('0x5b')]['id']}})[_0xc5ad('0x28')](handleEntityNotFound(_0x34ed5d,null))[_0xc5ad('0x28')](function(_0x2b27d2){if(_0x2b27d2){return _0x2b27d2[_0xc5ad('0xbb')](_0x4dc517[_0xc5ad('0x61')]['ids'],_[_0xc5ad('0x8f')](_0x4dc517['body'],[_0xc5ad('0x70'),'id'])||{})[_0xc5ad('0xbc')](function(_0x15513b){for(var _0x5b712f=0x0;_0x5b712f<_0x4dc517[_0xc5ad('0x61')]['ids'][_0xc5ad('0x4d')];_0x5b712f+=0x1){socket[_0xc5ad('0xbd')](_0xc5ad('0xbe'),{'UserId':_0x4dc517[_0xc5ad('0x61')][_0xc5ad('0x70')][_0x5b712f],'MailAccountId':_0x4dc517[_0xc5ad('0x5b')]['id']});}return _0x15513b;});}})[_0xc5ad('0x28')](respondWithResult(_0x34ed5d,null))[_0xc5ad('0x30')](handleError(_0x34ed5d,null));};exports[_0xc5ad('0xbf')]=function(_0x5b8cd5,_0x3173f3,_0x2d7400){return db['MailAccount'][_0xc5ad('0x5f')]({'where':{'id':_0x5b8cd5[_0xc5ad('0x5b')]['id']}})[_0xc5ad('0x28')](handleEntityNotFound(_0x3173f3,null))[_0xc5ad('0x28')](function(_0x3295e8){if(_0x3295e8){return _0x3295e8[_0xc5ad('0xbf')](_0x5b8cd5[_0xc5ad('0x48')][_0xc5ad('0x70')])[_0xc5ad('0x28')](function(){if(_[_0xc5ad('0xc0')](_0x5b8cd5[_0xc5ad('0x48')][_0xc5ad('0x70')])){for(var _0x4aae3f=0x0;_0x4aae3f<_0x5b8cd5[_0xc5ad('0x48')]['ids'][_0xc5ad('0x4d')];_0x4aae3f+=0x1){socket[_0xc5ad('0xbd')](_0xc5ad('0xc1'),{'UserId':Number(_0x5b8cd5[_0xc5ad('0x48')][_0xc5ad('0x70')][_0x4aae3f]),'MailAccountId':Number(_0x5b8cd5[_0xc5ad('0x5b')]['id'])});}}else{socket[_0xc5ad('0xbd')](_0xc5ad('0xc1'),{'UserId':Number(_0x5b8cd5[_0xc5ad('0x48')]['ids']),'MailAccountId':Number(_0x5b8cd5['params']['id'])});}});}})['then'](respondWithStatusCode(_0x3173f3,null))['catch'](handleError(_0x3173f3,null));};exports[_0xc5ad('0xc2')]=function(_0x342e56,_0xcf9d31,_0x26f670){var _0x400d97={};var _0x582c0c={};var _0x6e1a18;var _0x2e9f18;return db[_0xc5ad('0x45')][_0xc5ad('0x6b')]({'where':{'id':_0x342e56['params']['id']}})[_0xc5ad('0x28')](handleEntityNotFound(_0xcf9d31,null))[_0xc5ad('0x28')](function(_0x3455c1){if(_0x3455c1){_0x6e1a18=_0x3455c1;_0x582c0c[_0xc5ad('0x47')]=_[_0xc5ad('0x5e')](db[_0xc5ad('0x92')][_0xc5ad('0x46')]);_0x582c0c['query']=_[_0xc5ad('0x5e')](_0x342e56['query']);_0x582c0c[_0xc5ad('0x49')]=_[_0xc5ad('0x4a')](_0x582c0c[_0xc5ad('0x47')],_0x582c0c[_0xc5ad('0x48')]);_0x400d97[_0xc5ad('0x4b')]=_[_0xc5ad('0x4a')](_0x582c0c[_0xc5ad('0x47')],qs[_0xc5ad('0x4c')](_0x342e56['query'][_0xc5ad('0x4c')]));_0x400d97[_0xc5ad('0x4b')]=_0x400d97['attributes'][_0xc5ad('0x4d')]?_0x400d97[_0xc5ad('0x4b')]:_0x582c0c[_0xc5ad('0x47')];_0x400d97[_0xc5ad('0x4e')]=qs['sort'](_0x342e56[_0xc5ad('0x48')][_0xc5ad('0x4f')]);_0x400d97[_0xc5ad('0x50')]=qs['filters'](_[_0xc5ad('0x51')](_0x342e56[_0xc5ad('0x48')],_0x582c0c['filters']));if(_0x342e56[_0xc5ad('0x48')][_0xc5ad('0x54')]){_0x400d97[_0xc5ad('0x50')]=_['merge'](_0x400d97['where'],{'$or':_['map'](_0x400d97['attributes'],function(_0x1a00da){var _0x31383b={};_0x31383b[_0x1a00da]={'$like':'%'+_0x342e56[_0xc5ad('0x48')][_0xc5ad('0x54')]+'%'};return _0x31383b;})});}_0x400d97=_[_0xc5ad('0x52')]({},_0x400d97,_0x342e56[_0xc5ad('0x55')]);return _0x6e1a18['getAgents'](_0x400d97);}})[_0xc5ad('0x28')](function(_0x19d13c){if(_0x19d13c){_0x2e9f18=_0x19d13c[_0xc5ad('0x4d')];if(!_0x342e56[_0xc5ad('0x48')][_0xc5ad('0x6d')](_0xc5ad('0x6e'))){_0x400d97[_0xc5ad('0x35')]=qs[_0xc5ad('0x35')](_0x342e56['query'][_0xc5ad('0x35')]);_0x400d97[_0xc5ad('0x34')]=qs[_0xc5ad('0x34')](_0x342e56['query'][_0xc5ad('0x34')]);}return _0x6e1a18['getAgents'](_0x400d97);}})['then'](function(_0x1f61fb){if(_0x1f61fb){return _0x1f61fb?{'count':_0x2e9f18,'rows':_0x1f61fb}:null;}})[_0xc5ad('0x28')](respondWithResult(_0xcf9d31,null))[_0xc5ad('0x30')](handleError(_0xcf9d31,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 63615b4..e880cec 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 _0xcb74=['hook','events','../../mysqldb','MailAccount','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x14b8aa,_0x21ffd0){var _0x16c10d=function(_0x3fa3e7){while(--_0x3fa3e7){_0x14b8aa['push'](_0x14b8aa['shift']());}};_0x16c10d(++_0x21ffd0);}(_0xcb74,0x7f));var _0x4cb7=function(_0x5ce43e,_0xc1c027){_0x5ce43e=_0x5ce43e-0x0;var _0x56daee=_0xcb74[_0x5ce43e];return _0x56daee;};'use strict';var EventEmitter=require(_0x4cb7('0x0'));var MailAccount=require(_0x4cb7('0x1'))['db'][_0x4cb7('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x4cb7('0x3')](0x0);var events={'afterCreate':_0x4cb7('0x4'),'afterUpdate':'update','afterDestroy':_0x4cb7('0x5')};function emitEvent(_0x12f01c){return function(_0x67f20a,_0x1d62fe,_0x582eeb){MailAccountEvents[_0x4cb7('0x6')](_0x12f01c+':'+_0x67f20a['id'],_0x67f20a);MailAccountEvents[_0x4cb7('0x6')](_0x12f01c,_0x67f20a);_0x582eeb(null);};}for(var e in events){if(events[_0x4cb7('0x7')](e)){var event=events[e];MailAccount[_0x4cb7('0x8')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0x9127=['setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount'];(function(_0x2064f4,_0x4f6a5b){var _0x428481=function(_0x3f7434){while(--_0x3f7434){_0x2064f4['push'](_0x2064f4['shift']());}};_0x428481(++_0x4f6a5b);}(_0x9127,0x180));var _0x7912=function(_0x297eea,_0x5060be){_0x297eea=_0x297eea-0x0;var _0x1c42d2=_0x9127[_0x297eea];return _0x1c42d2;};'use strict';var EventEmitter=require(_0x7912('0x0'));var MailAccount=require(_0x7912('0x1'))['db'][_0x7912('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x7912('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x7912('0x4')};function emitEvent(_0x4c87ba){return function(_0x30df4d,_0x3792fc,_0x39baab){MailAccountEvents[_0x7912('0x5')](_0x4c87ba+':'+_0x30df4d['id'],_0x30df4d);MailAccountEvents[_0x7912('0x5')](_0x4c87ba,_0x30df4d);_0x39baab(null);};}for(var e in events){if(events[_0x7912('0x6')](e)){var event=events[e];MailAccount[_0x7912('0x7')](e,emitEvent(event));}}module[_0x7912('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 85168c7..8401e28 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 _0x4343=['./mailAccount.attributes','exports','mail_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x12065d,_0x105cec){var _0xf49d52=function(_0x54f322){while(--_0x54f322){_0x12065d['push'](_0x12065d['shift']());}};_0xf49d52(++_0x105cec);}(_0x4343,0x158));var _0x3434=function(_0x3444d5,_0x7de214){_0x3444d5=_0x3444d5-0x0;var _0x55e9d8=_0x4343[_0x3444d5];return _0x55e9d8;};'use strict';var _=require(_0x3434('0x0'));var util=require('util');var logger=require(_0x3434('0x1'))(_0x3434('0x2'));var moment=require(_0x3434('0x3'));var BPromise=require(_0x3434('0x4'));var rp=require(_0x3434('0x5'));var fs=require('fs');var path=require(_0x3434('0x6'));var rimraf=require(_0x3434('0x7'));var config=require('../../config/environment');var attributes=require(_0x3434('0x8'));module[_0x3434('0x9')]=function(_0x438e70,_0x367ffb){return _0x438e70['define']('MailAccount',attributes,{'tableName':_0x3434('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9cc0=['api','moment','bluebird','request-promise','path','rimraf','./mailAccount.attributes','exports','mail_accounts','lodash','util','../../config/logger'];(function(_0xcfe8cc,_0xb83aeb){var _0x55ac53=function(_0x4067d4){while(--_0x4067d4){_0xcfe8cc['push'](_0xcfe8cc['shift']());}};_0x55ac53(++_0xb83aeb);}(_0x9cc0,0x81));var _0x09cc=function(_0x22e101,_0x412840){_0x22e101=_0x22e101-0x0;var _0xa51f61=_0x9cc0[_0x22e101];return _0xa51f61;};'use strict';var _=require(_0x09cc('0x0'));var util=require(_0x09cc('0x1'));var logger=require(_0x09cc('0x2'))(_0x09cc('0x3'));var moment=require(_0x09cc('0x4'));var BPromise=require(_0x09cc('0x5'));var rp=require(_0x09cc('0x6'));var fs=require('fs');var path=require(_0x09cc('0x7'));var rimraf=require(_0x09cc('0x8'));var config=require('../../config/environment');var attributes=require(_0x09cc('0x9'));module[_0x09cc('0xa')]=function(_0x16d6b9,_0xc7fbd1){return _0x16d6b9['define']('MailAccount',attributes,{'tableName':_0x09cc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index b20b115..408165c 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 _0x0b40=['result','catch','GetMailAccount','options','raw','limit','include','map','model','attributes','stringify','MailAccount','find','where','ShowMailAccount','NotifyMailAccount','body','mail','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','account','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','get','omit','applications','list','priority','asc','autoclose','length','close','*,*,*,*','defaults','create','List\x20not\x20found','contact','messageId','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','spread','subject','interaction','created','attachments','originTo','originCc','bcc','Attachment','Attachments','UserId','User','name','unshift','agent','Start','startRouting','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0xa3ed10,_0xfcb86){var _0x4205c7=function(_0x4e0f73){while(--_0x4e0f73){_0xa3ed10['push'](_0xa3ed10['shift']());}};_0x4205c7(++_0xfcb86);}(_0x0b40,0xba));var _0x00b4=function(_0x425716,_0x3e9d1c){_0x425716=_0x425716-0x0;var _0x2d39af=_0x0b40[_0x425716];return _0x2d39af;};'use strict';var _=require('lodash');var util=require(_0x00b4('0x0'));var moment=require(_0x00b4('0x1'));var BPromise=require('bluebird');var rs=require(_0x00b4('0x2'));var fs=require('fs');var Redis=require(_0x00b4('0x3'));var db=require(_0x00b4('0x4'))['db'];var utils=require(_0x00b4('0x5'));var logger=require(_0x00b4('0x6'))(_0x00b4('0x7'));var config=require('../../config/environment');var jayson=require(_0x00b4('0x8'));var client=jayson[_0x00b4('0x9')][_0x00b4('0xa')]({'port':0x232c});config[_0x00b4('0xb')]=_['defaults'](config[_0x00b4('0xb')],{'host':_0x00b4('0xc'),'port':0x18eb});var socket=require(_0x00b4('0xd'))(new Redis(config['redis']));require(_0x00b4('0xe'))[_0x00b4('0xf')](socket);function respondWithRpcPromise(_0x4eec0b,_0x55430e,_0x470e42){return new BPromise(function(_0x77fb86,_0x216426){return client[_0x00b4('0x10')](_0x4eec0b,_0x470e42)[_0x00b4('0x11')](function(_0x1c3892){logger[_0x00b4('0x12')](_0x00b4('0x13'),_0x55430e,_0x00b4('0x14'));logger[_0x00b4('0x15')](_0x00b4('0x16'),_0x55430e,_0x00b4('0x14'),JSON['stringify'](_0x1c3892));if(_0x1c3892['error']){if(_0x1c3892[_0x00b4('0x17')][_0x00b4('0x18')]===0x1f4){logger[_0x00b4('0x17')](_0x00b4('0x13'),_0x55430e,_0x1c3892['error'][_0x00b4('0x19')]);return _0x216426(_0x1c3892[_0x00b4('0x17')][_0x00b4('0x19')]);}logger[_0x00b4('0x17')](_0x00b4('0x13'),_0x55430e,_0x1c3892[_0x00b4('0x17')][_0x00b4('0x19')]);return _0x77fb86(_0x1c3892['error'][_0x00b4('0x19')]);}else{logger[_0x00b4('0x12')](_0x00b4('0x13'),_0x55430e,_0x00b4('0x14'));_0x77fb86(_0x1c3892[_0x00b4('0x1a')]['message']);}})[_0x00b4('0x1b')](function(_0x317bac){logger[_0x00b4('0x17')]('MailAccount,\x20%s,\x20%s',_0x55430e,_0x317bac);_0x216426(_0x317bac);});});}exports[_0x00b4('0x1c')]=function(_0x277e32){var _0xc50e86=this;return new Promise(function(_0x28b93e,_0xa7462a){return db['MailAccount']['findAll']({'raw':_0x277e32[_0x00b4('0x1d')]?_0x277e32[_0x00b4('0x1d')][_0x00b4('0x1e')]===undefined?!![]:![]:!![],'where':_0x277e32[_0x00b4('0x1d')]?_0x277e32[_0x00b4('0x1d')]['where']||null:null,'attributes':_0x277e32[_0x00b4('0x1d')]?_0x277e32[_0x00b4('0x1d')]['attributes']||null:null,'limit':_0x277e32[_0x00b4('0x1d')]?_0x277e32[_0x00b4('0x1d')][_0x00b4('0x1f')]||null:null,'include':_0x277e32['options']?_0x277e32[_0x00b4('0x1d')][_0x00b4('0x20')]?_[_0x00b4('0x21')](_0x277e32['options']['include'],function(_0xc695ca){return{'model':db[_0xc695ca[_0x00b4('0x22')]],'as':_0xc695ca['as'],'attributes':_0xc695ca[_0x00b4('0x23')],'include':_0xc695ca[_0x00b4('0x20')]?_[_0x00b4('0x21')](_0xc695ca[_0x00b4('0x20')],function(_0x591363){return{'model':db[_0x591363[_0x00b4('0x22')]],'as':_0x591363['as'],'attributes':_0x591363[_0x00b4('0x23')],'include':_0x591363[_0x00b4('0x20')]?_[_0x00b4('0x21')](_0x591363[_0x00b4('0x20')],function(_0x21cc39){return{'model':db[_0x21cc39[_0x00b4('0x22')]],'as':_0x21cc39['as'],'attributes':_0x21cc39[_0x00b4('0x23')]};}):[]};}):[]};}):[]:[]})[_0x00b4('0x11')](function(_0x35103e){logger[_0x00b4('0x12')]('GetMailAccount',_0x277e32);logger[_0x00b4('0x15')](_0x00b4('0x1c'),_0x277e32,JSON[_0x00b4('0x24')](_0x35103e));_0x28b93e(_0x35103e);})[_0x00b4('0x1b')](function(_0x24b8fb){logger['error'](_0x00b4('0x1c'),_0x24b8fb['message'],_0x277e32);_0xa7462a(_0xc50e86[_0x00b4('0x17')](0x1f4,_0x24b8fb[_0x00b4('0x19')]));});});};exports['ShowMailAccount']=function(_0x2d62d1){var _0x4d65df=this;return new Promise(function(_0x4d26c0,_0x4a5ad7){return db[_0x00b4('0x25')][_0x00b4('0x26')]({'raw':_0x2d62d1[_0x00b4('0x1d')]?_0x2d62d1[_0x00b4('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x2d62d1['options']?_0x2d62d1[_0x00b4('0x1d')][_0x00b4('0x27')]||null:null,'attributes':_0x2d62d1[_0x00b4('0x1d')]?_0x2d62d1[_0x00b4('0x1d')][_0x00b4('0x23')]||null:null,'include':_0x2d62d1[_0x00b4('0x1d')]?_0x2d62d1['options'][_0x00b4('0x20')]?_[_0x00b4('0x21')](_0x2d62d1['options']['include'],function(_0x36be57){return{'model':db[_0x36be57['model']],'as':_0x36be57['as'],'attributes':_0x36be57['attributes'],'include':_0x36be57[_0x00b4('0x20')]?_[_0x00b4('0x21')](_0x36be57[_0x00b4('0x20')],function(_0x4b77fc){return{'model':db[_0x4b77fc[_0x00b4('0x22')]],'as':_0x4b77fc['as'],'attributes':_0x4b77fc[_0x00b4('0x23')],'include':_0x4b77fc[_0x00b4('0x20')]?_[_0x00b4('0x21')](_0x4b77fc['include'],function(_0x3f35cd){return{'model':db[_0x3f35cd[_0x00b4('0x22')]],'as':_0x3f35cd['as'],'attributes':_0x3f35cd['attributes']};}):[]};}):[]};}):[]:[]})[_0x00b4('0x11')](function(_0x2aed9a){logger['info'](_0x00b4('0x28'),_0x2d62d1);logger['debug'](_0x00b4('0x28'),_0x2d62d1,JSON[_0x00b4('0x24')](_0x2aed9a));_0x4d26c0(_0x2aed9a);})[_0x00b4('0x1b')](function(_0x5287df){logger['error'](_0x00b4('0x28'),_0x5287df['message'],_0x2d62d1);_0x4a5ad7(_0x4d65df[_0x00b4('0x17')](0x1f4,_0x5287df[_0x00b4('0x19')]));});});};exports[_0x00b4('0x29')]=function(_0x329718){var _0x4b1f9f=this;return new Promise(function(_0x3a8ac1,_0xf2af5f){var _0x3db465={'body':_0x329718[_0x00b4('0x2a')],'channel':_0x00b4('0x2b')};var _0x4bbd37=_['difference'](_[_0x00b4('0x2c')](db[_0x00b4('0x2d')][_0x00b4('0x2e')]),[_0x00b4('0x2f'),_0x00b4('0x30'),_0x00b4('0x31'),_0x00b4('0x32')]);var _0x120739=![];if(_0x329718['body']['id']){delete _0x329718[_0x00b4('0x2a')]['id'];}if(_[_0x00b4('0x33')](_0x329718[_0x00b4('0x2a')]['from'])){return _0xf2af5f(_0x4b1f9f[_0x00b4('0x17')](0x1f4,_0x00b4('0x34')));}if(_[_0x00b4('0x33')](_0x329718[_0x00b4('0x2a')][_0x00b4('0x2a')])||_0x329718['body'][_0x00b4('0x2a')]===''){return _0xf2af5f(_0x4b1f9f[_0x00b4('0x17')](0x1f4,_0x00b4('0x35')));}if(_[_0x00b4('0x33')](_0x329718[_0x00b4('0x2a')][_0x00b4('0x36')])){return _0xf2af5f(_0x4b1f9f[_0x00b4('0x17')](0x1f4,_0x00b4('0x37')+_0x4bbd37));}if(!_[_0x00b4('0x38')](_0x4bbd37,_0x329718[_0x00b4('0x2a')][_0x00b4('0x36')])){return _0xf2af5f(_0x4b1f9f[_0x00b4('0x17')](0x1f4,_0x00b4('0x39')+_0x4bbd37));}var _0xcc7033={};_0xcc7033[_0x329718[_0x00b4('0x2a')][_0x00b4('0x36')]]=_0x329718[_0x00b4('0x2a')][_0x00b4('0x3a')];return db[_0x00b4('0x25')]['find']({'where':{'id':_0x329718[_0x00b4('0x3b')]['id']},'include':[{'model':db['CmList'],'as':_0x00b4('0x3c'),'include':[{'model':db[_0x00b4('0x2d')],'as':_0x00b4('0x3d'),'where':_0xcc7033,'limit':0x1,'order':[[_0x00b4('0x30'),_0x00b4('0x3e')]]}]},{'model':db[_0x00b4('0x3f')],'as':_0x00b4('0x40')},{'model':db[_0x00b4('0x41')],'as':_0x00b4('0x42')}]})[_0x00b4('0x11')](function(_0xdbc365){if(_0xdbc365&&_0xdbc365['List']){var _0x4994e0=_0xdbc365[_0x00b4('0x43')]({'plain':!![]});_0x3db465['account']=_[_0x00b4('0x44')](_0x4994e0,[_0x00b4('0x40'),'List']);_0x3db465[_0x00b4('0x45')]=_0x4994e0[_0x00b4('0x40')];_0x3db465[_0x00b4('0x46')]=_0x4994e0[_0x00b4('0x3c')];_0x3db465[_0x00b4('0x45')]=_['orderBy'](_0x3db465[_0x00b4('0x45')],[_0x00b4('0x47')],[_0x00b4('0x48')]);if(_0x3db465[_0x00b4('0x3b')]&&_0x3db465[_0x00b4('0x3b')][_0x00b4('0x49')]){_0x3db465[_0x00b4('0x45')]['push']({'id':0x0,'priority':_0x3db465[_0x00b4('0x45')][_0x00b4('0x4a')]+0x1,'app':_0x00b4('0x4b'),'appdata':_0x00b4('0x49'),'interval':_0x00b4('0x4c')});}if(_0x3db465[_0x00b4('0x3b')][_0x00b4('0x40')]){delete _0x3db465['account'][_0x00b4('0x40')];}if(_0x3db465[_0x00b4('0x3b')][_0x00b4('0x3c')]){delete _0x3db465[_0x00b4('0x3b')][_0x00b4('0x3c')];}if(_0x4994e0[_0x00b4('0x3c')][_0x00b4('0x3d')][_0x00b4('0x4a')]){return _0x4994e0[_0x00b4('0x3c')][_0x00b4('0x3d')][0x0];}var _0x1922d=_[_0x00b4('0x4d')](_0x329718[_0x00b4('0x2a')],{'firstName':_0x329718[_0x00b4('0x2a')][_0x00b4('0x3a')],'ListId':_0x4994e0['ListId']});_0x1922d[_0x329718[_0x00b4('0x2a')][_0x00b4('0x36')]]=_0x329718[_0x00b4('0x2a')]['from'];return db[_0x00b4('0x2d')][_0x00b4('0x4e')](_0x1922d);}else{throw new Error(_0x00b4('0x4f'));}})['then'](function(_0x469caa){_0x3db465[_0x00b4('0x50')]=_0x469caa;if(_0x469caa){if(!_0x329718['body'][_0x00b4('0x19')][_0x00b4('0x51')]){_0x329718[_0x00b4('0x2a')][_0x00b4('0x19')]['messageId']=rs['generate']()+'\x20'+_0x329718[_0x00b4('0x2a')]['message'][_0x00b4('0x3a')];}var _0x3439ed={'ContactId':_0x469caa['id'],'MailAccountId':_0x329718[_0x00b4('0x3b')]['id'],'inReplyTo':_0x329718[_0x00b4('0x2a')][_0x00b4('0x19')][_0x00b4('0x51')],'to':_0x329718[_0x00b4('0x2a')][_0x00b4('0x19')][_0x00b4('0x3a')],'cc':_0x329718['body']['message']['cc'],'subject':_0x329718[_0x00b4('0x2a')][_0x00b4('0x19')]['subject'],'attach':_0x329718[_0x00b4('0x2a')][_0x00b4('0x19')][_0x00b4('0x52')],'lastMsgAt':moment()[_0x00b4('0x53')](_0x00b4('0x54')),'lastMsgDirection':'in','lastMsgBody':_0x329718['body'][_0x00b4('0x2a')]};return db[_0x00b4('0x55')]['find']({'where':{'closed':![],'MailAccountId':_0x329718[_0x00b4('0x3b')]['id']},'include':[{'model':db[_0x00b4('0x56')],'as':_0x00b4('0x57'),'attributes':['messageId'],'where':{'messageId':_0x329718['body'][_0x00b4('0x19')][_0x00b4('0x58')]}}]})[_0x00b4('0x11')](function(_0x36ccf8){if(_0x36ccf8){return[_0x36ccf8,![]];}return db[_0x00b4('0x55')][_0x00b4('0x4e')](_0x3439ed)[_0x00b4('0x11')](function(_0x280e66){return[_0x280e66,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x00b4('0x59')](function(_0x257fc8,_0x435050){if(_0x257fc8){_0x120739=_0x435050;if(!_0x435050){return _0x257fc8['update']({'inReplyTo':_0x329718[_0x00b4('0x2a')]['message'][_0x00b4('0x51')],'to':_0x329718[_0x00b4('0x2a')][_0x00b4('0x19')][_0x00b4('0x3a')],'cc':_0x329718[_0x00b4('0x2a')][_0x00b4('0x19')]['cc'],'subject':_0x329718[_0x00b4('0x2a')][_0x00b4('0x19')][_0x00b4('0x5a')],'attach':_0x257fc8[_0x00b4('0x52')]?_0x257fc8[_0x00b4('0x52')]:_0x329718['body'][_0x00b4('0x19')][_0x00b4('0x52')],'substatus':null,'substatusAt':moment()[_0x00b4('0x53')](_0x00b4('0x54')),'lastMsgAt':moment()['format'](_0x00b4('0x54')),'lastMsgDirection':'in','lastMsgBody':_0x329718[_0x00b4('0x2a')][_0x00b4('0x2a')]});}else{return _0x257fc8;}}})[_0x00b4('0x11')](function(_0x5496b9){_0x3db465[_0x00b4('0x5b')]=_0x5496b9[_0x00b4('0x43')]({'plain':!![]});_0x3db465[_0x00b4('0x5b')][_0x00b4('0x5c')]=_0x120739;return db[_0x00b4('0x56')][_0x00b4('0x4e')]({'body':_0x329718[_0x00b4('0x2a')][_0x00b4('0x2a')],'MailAccountId':_0x329718[_0x00b4('0x3b')]['id'],'MailInteractionId':_0x5496b9['id'],'direction':'in','ContactId':_0x3db465[_0x00b4('0x50')]['id'],'messageId':_0x329718[_0x00b4('0x2a')]['message']['messageId'],'from':_0x329718[_0x00b4('0x2a')][_0x00b4('0x19')][_0x00b4('0x3a')],'to':_0x329718[_0x00b4('0x2a')][_0x00b4('0x19')]['to'],'cc':_0x329718[_0x00b4('0x2a')][_0x00b4('0x19')]['cc'],'subject':_0x329718[_0x00b4('0x2a')][_0x00b4('0x19')][_0x00b4('0x5a')],'attach':_0x329718[_0x00b4('0x2a')][_0x00b4('0x19')]['attach'],'Attachments':_0x329718['body'][_0x00b4('0x19')][_0x00b4('0x5d')],'originTo':_0x329718[_0x00b4('0x2a')]['message'][_0x00b4('0x5e')],'originCc':_0x329718[_0x00b4('0x2a')][_0x00b4('0x19')][_0x00b4('0x5f')],'bcc':_0x329718['body'][_0x00b4('0x19')][_0x00b4('0x60')]},{'include':[{'model':db[_0x00b4('0x61')],'as':_0x00b4('0x62')}]});})['then'](function(_0x1c3b21){_0x3db465['message']=_0x1c3b21;if(_0x3db465[_0x00b4('0x5b')][_0x00b4('0x63')]){return db[_0x00b4('0x64')][_0x00b4('0x26')]({'attributes':['id',_0x00b4('0x65')],'where':{'id':_0x3db465[_0x00b4('0x5b')][_0x00b4('0x63')]}})[_0x00b4('0x11')](function(_0x43bd38){if(_0x43bd38){_0x3db465['applications'][_0x00b4('0x66')]({'id':0x0,'priority':0x0,'app':_0x00b4('0x67'),'appdata':_0x43bd38[_0x00b4('0x65')]+','+(_0x3db465['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x00b4('0x68'),_0x00b4('0x69'),_0x3db465);});}return respondWithRpcPromise(_0x00b4('0x68'),_0x00b4('0x69'),_0x3db465);})['then'](function(_0x5f003f){_0x3a8ac1(_0x5f003f);})['catch'](function(_0x475e3d){_0xf2af5f(_0x4b1f9f[_0x00b4('0x17')](0x1f4,_0x475e3d['message']));});});}; \ No newline at end of file +var _0x2557=['request','then','info','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','MailAccount,\x20%s,\x20%s','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','map','include','model','debug','ShowMailAccount','body','mail','difference','keys','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','DESC','Smtp','omit','applications','Applications','priority','asc','length','close','autoclose','*,*,*,*','Contacts','CmContact','create','List\x20not\x20found','contact','messageId','generate','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','inReplyTo','Contact\x20not\x20found','spread','subject','attach','interaction','created','MailMessage','originTo','bcc','Attachment','Attachments','User','UserId','unshift','name','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailAccount.socket'];(function(_0x539e89,_0x2b67c6){var _0x3d557b=function(_0x5c49e8){while(--_0x5c49e8){_0x539e89['push'](_0x539e89['shift']());}};_0x3d557b(++_0x2b67c6);}(_0x2557,0x11e));var _0x7255=function(_0x2f8860,_0x3ff6aa){_0x2f8860=_0x2f8860-0x0;var _0x21761f=_0x2557[_0x2f8860];return _0x21761f;};'use strict';var _=require(_0x7255('0x0'));var util=require('util');var moment=require(_0x7255('0x1'));var BPromise=require(_0x7255('0x2'));var rs=require(_0x7255('0x3'));var fs=require('fs');var Redis=require(_0x7255('0x4'));var db=require(_0x7255('0x5'))['db'];var utils=require(_0x7255('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x7255('0x7'));var client=jayson[_0x7255('0x8')][_0x7255('0x9')]({'port':0x232c});config[_0x7255('0xa')]=_[_0x7255('0xb')](config[_0x7255('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x7255('0xc'))(new Redis(config[_0x7255('0xa')]));require(_0x7255('0xd'))['register'](socket);function respondWithRpcPromise(_0x426b05,_0x18f985,_0x17a5c7){return new BPromise(function(_0xdf5bc3,_0x34f9ef){return client[_0x7255('0xe')](_0x426b05,_0x17a5c7)[_0x7255('0xf')](function(_0x532392){logger[_0x7255('0x10')]('MailAccount,\x20%s,\x20%s',_0x18f985,'request\x20sent');logger['debug'](_0x7255('0x11'),_0x18f985,_0x7255('0x12'),JSON[_0x7255('0x13')](_0x532392));if(_0x532392[_0x7255('0x14')]){if(_0x532392[_0x7255('0x14')][_0x7255('0x15')]===0x1f4){logger[_0x7255('0x14')]('MailAccount,\x20%s,\x20%s',_0x18f985,_0x532392[_0x7255('0x14')][_0x7255('0x16')]);return _0x34f9ef(_0x532392[_0x7255('0x14')][_0x7255('0x16')]);}logger[_0x7255('0x14')](_0x7255('0x17'),_0x18f985,_0x532392[_0x7255('0x14')][_0x7255('0x16')]);return _0xdf5bc3(_0x532392[_0x7255('0x14')][_0x7255('0x16')]);}else{logger[_0x7255('0x10')](_0x7255('0x17'),_0x18f985,_0x7255('0x12'));_0xdf5bc3(_0x532392[_0x7255('0x18')][_0x7255('0x16')]);}})[_0x7255('0x19')](function(_0x461f7f){logger['error']('MailAccount,\x20%s,\x20%s',_0x18f985,_0x461f7f);_0x34f9ef(_0x461f7f);});});}exports[_0x7255('0x1a')]=function(_0xb9653){var _0x1d47d8=this;return new Promise(function(_0xf8fb0,_0x4bff12){return db[_0x7255('0x1b')][_0x7255('0x1c')]({'raw':_0xb9653[_0x7255('0x1d')]?_0xb9653[_0x7255('0x1d')][_0x7255('0x1e')]===undefined?!![]:![]:!![],'where':_0xb9653[_0x7255('0x1d')]?_0xb9653[_0x7255('0x1d')][_0x7255('0x1f')]||null:null,'attributes':_0xb9653['options']?_0xb9653[_0x7255('0x1d')][_0x7255('0x20')]||null:null,'limit':_0xb9653[_0x7255('0x1d')]?_0xb9653[_0x7255('0x1d')][_0x7255('0x21')]||null:null,'include':_0xb9653[_0x7255('0x1d')]?_0xb9653[_0x7255('0x1d')]['include']?_[_0x7255('0x22')](_0xb9653[_0x7255('0x1d')][_0x7255('0x23')],function(_0x568068){return{'model':db[_0x568068[_0x7255('0x24')]],'as':_0x568068['as'],'attributes':_0x568068['attributes'],'include':_0x568068[_0x7255('0x23')]?_[_0x7255('0x22')](_0x568068['include'],function(_0xe0b108){return{'model':db[_0xe0b108[_0x7255('0x24')]],'as':_0xe0b108['as'],'attributes':_0xe0b108[_0x7255('0x20')],'include':_0xe0b108[_0x7255('0x23')]?_[_0x7255('0x22')](_0xe0b108[_0x7255('0x23')],function(_0x54e53a){return{'model':db[_0x54e53a[_0x7255('0x24')]],'as':_0x54e53a['as'],'attributes':_0x54e53a[_0x7255('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x56dee8){logger[_0x7255('0x10')](_0x7255('0x1a'),_0xb9653);logger[_0x7255('0x25')](_0x7255('0x1a'),_0xb9653,JSON[_0x7255('0x13')](_0x56dee8));_0xf8fb0(_0x56dee8);})[_0x7255('0x19')](function(_0x9436cc){logger[_0x7255('0x14')]('GetMailAccount',_0x9436cc[_0x7255('0x16')],_0xb9653);_0x4bff12(_0x1d47d8['error'](0x1f4,_0x9436cc[_0x7255('0x16')]));});});};exports['ShowMailAccount']=function(_0x11635f){var _0x28b698=this;return new Promise(function(_0xb7d092,_0x576583){return db['MailAccount']['find']({'raw':_0x11635f[_0x7255('0x1d')]?_0x11635f[_0x7255('0x1d')][_0x7255('0x1e')]===undefined?!![]:![]:!![],'where':_0x11635f[_0x7255('0x1d')]?_0x11635f[_0x7255('0x1d')][_0x7255('0x1f')]||null:null,'attributes':_0x11635f[_0x7255('0x1d')]?_0x11635f[_0x7255('0x1d')]['attributes']||null:null,'include':_0x11635f[_0x7255('0x1d')]?_0x11635f[_0x7255('0x1d')]['include']?_[_0x7255('0x22')](_0x11635f[_0x7255('0x1d')][_0x7255('0x23')],function(_0x44dc3a){return{'model':db[_0x44dc3a[_0x7255('0x24')]],'as':_0x44dc3a['as'],'attributes':_0x44dc3a[_0x7255('0x20')],'include':_0x44dc3a['include']?_[_0x7255('0x22')](_0x44dc3a[_0x7255('0x23')],function(_0xa62226){return{'model':db[_0xa62226['model']],'as':_0xa62226['as'],'attributes':_0xa62226[_0x7255('0x20')],'include':_0xa62226['include']?_[_0x7255('0x22')](_0xa62226[_0x7255('0x23')],function(_0x148dd1){return{'model':db[_0x148dd1[_0x7255('0x24')]],'as':_0x148dd1['as'],'attributes':_0x148dd1[_0x7255('0x20')]};}):[]};}):[]};}):[]:[]})[_0x7255('0xf')](function(_0x30776b){logger['info'](_0x7255('0x26'),_0x11635f);logger[_0x7255('0x25')](_0x7255('0x26'),_0x11635f,JSON[_0x7255('0x13')](_0x30776b));_0xb7d092(_0x30776b);})[_0x7255('0x19')](function(_0x12cae9){logger['error'](_0x7255('0x26'),_0x12cae9[_0x7255('0x16')],_0x11635f);_0x576583(_0x28b698[_0x7255('0x14')](0x1f4,_0x12cae9[_0x7255('0x16')]));});});};exports['NotifyMailAccount']=function(_0x449396){var _0x4e1c47=this;return new Promise(function(_0x4d5147,_0x4837de){var _0x512928={'body':_0x449396[_0x7255('0x27')],'channel':_0x7255('0x28')};var _0x505c50=_[_0x7255('0x29')](_[_0x7255('0x2a')](db['CmContact'][_0x7255('0x2b')]),[_0x7255('0x2c'),_0x7255('0x2d'),_0x7255('0x2e'),_0x7255('0x2f')]);var _0x3713cc=![];if(_0x449396['body']['id']){delete _0x449396[_0x7255('0x27')]['id'];}if(_[_0x7255('0x30')](_0x449396[_0x7255('0x27')][_0x7255('0x31')])){return _0x4837de(_0x4e1c47[_0x7255('0x14')](0x1f4,_0x7255('0x32')));}if(_[_0x7255('0x30')](_0x449396[_0x7255('0x27')][_0x7255('0x27')])||_0x449396[_0x7255('0x27')]['body']===''){return _0x4837de(_0x4e1c47[_0x7255('0x14')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x7255('0x30')](_0x449396[_0x7255('0x27')][_0x7255('0x33')])){return _0x4837de(_0x4e1c47['error'](0x1f4,_0x7255('0x34')+_0x505c50));}if(!_[_0x7255('0x35')](_0x505c50,_0x449396[_0x7255('0x27')][_0x7255('0x33')])){return _0x4837de(_0x4e1c47[_0x7255('0x14')](0x1f4,_0x7255('0x36')+_0x505c50));}var _0x25f1c6={};_0x25f1c6[_0x449396[_0x7255('0x27')][_0x7255('0x33')]]=_0x449396['body'][_0x7255('0x31')];return db[_0x7255('0x1b')][_0x7255('0x37')]({'where':{'id':_0x449396[_0x7255('0x38')]['id']},'include':[{'model':db[_0x7255('0x39')],'as':_0x7255('0x3a'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x25f1c6,'limit':0x1,'order':[[_0x7255('0x2d'),_0x7255('0x3b')]]}]},{'model':db['MailApplication'],'as':'Applications'},{'model':db['MailServerOut'],'as':_0x7255('0x3c')}]})[_0x7255('0xf')](function(_0x2d12d2){if(_0x2d12d2&&_0x2d12d2[_0x7255('0x3a')]){var _0x5d7c86=_0x2d12d2['get']({'plain':!![]});_0x512928['account']=_[_0x7255('0x3d')](_0x5d7c86,['Applications',_0x7255('0x3a')]);_0x512928[_0x7255('0x3e')]=_0x5d7c86[_0x7255('0x3f')];_0x512928['list']=_0x5d7c86[_0x7255('0x3a')];_0x512928[_0x7255('0x3e')]=_['orderBy'](_0x512928['applications'],[_0x7255('0x40')],[_0x7255('0x41')]);if(_0x512928['account']&&_0x512928[_0x7255('0x38')]['autoclose']){_0x512928[_0x7255('0x3e')]['push']({'id':0x0,'priority':_0x512928[_0x7255('0x3e')][_0x7255('0x42')]+0x1,'app':_0x7255('0x43'),'appdata':_0x7255('0x44'),'interval':_0x7255('0x45')});}if(_0x512928['account']['Applications']){delete _0x512928[_0x7255('0x38')]['Applications'];}if(_0x512928[_0x7255('0x38')][_0x7255('0x3a')]){delete _0x512928[_0x7255('0x38')][_0x7255('0x3a')];}if(_0x5d7c86[_0x7255('0x3a')][_0x7255('0x46')]['length']){return _0x5d7c86[_0x7255('0x3a')][_0x7255('0x46')][0x0];}var _0x53371c=_['defaults'](_0x449396[_0x7255('0x27')],{'firstName':_0x449396[_0x7255('0x27')][_0x7255('0x31')],'ListId':_0x5d7c86['ListId']});_0x53371c[_0x449396['body'][_0x7255('0x33')]]=_0x449396['body'][_0x7255('0x31')];return db[_0x7255('0x47')][_0x7255('0x48')](_0x53371c);}else{throw new Error(_0x7255('0x49'));}})[_0x7255('0xf')](function(_0x424d93){_0x512928[_0x7255('0x4a')]=_0x424d93;if(_0x424d93){if(!_0x449396[_0x7255('0x27')][_0x7255('0x16')][_0x7255('0x4b')]){_0x449396[_0x7255('0x27')][_0x7255('0x16')][_0x7255('0x4b')]=rs[_0x7255('0x4c')]()+'\x20'+_0x449396[_0x7255('0x27')]['message']['from'];}var _0x114aa4={'ContactId':_0x424d93['id'],'MailAccountId':_0x449396[_0x7255('0x38')]['id'],'inReplyTo':_0x449396[_0x7255('0x27')][_0x7255('0x16')][_0x7255('0x4b')],'to':_0x449396['body'][_0x7255('0x16')][_0x7255('0x31')],'cc':_0x449396[_0x7255('0x27')][_0x7255('0x16')]['cc'],'subject':_0x449396[_0x7255('0x27')]['message']['subject'],'attach':_0x449396[_0x7255('0x27')][_0x7255('0x16')]['attach'],'lastMsgAt':moment()[_0x7255('0x4d')](_0x7255('0x4e')),'lastMsgDirection':'in','lastMsgBody':_0x449396[_0x7255('0x27')]['body']};return db[_0x7255('0x4f')]['find']({'where':{'closed':![],'MailAccountId':_0x449396[_0x7255('0x38')]['id']},'include':[{'model':db['MailMessage'],'as':_0x7255('0x50'),'attributes':[_0x7255('0x4b')],'where':{'messageId':_0x449396['body'][_0x7255('0x16')][_0x7255('0x51')]}}]})[_0x7255('0xf')](function(_0xff168f){if(_0xff168f){return[_0xff168f,![]];}return db[_0x7255('0x4f')][_0x7255('0x48')](_0x114aa4)['then'](function(_0x3ac8f3){return[_0x3ac8f3,!![]];});});}else{throw new Error(_0x7255('0x52'));}})[_0x7255('0x53')](function(_0x223754,_0x5e3389){if(_0x223754){_0x3713cc=_0x5e3389;if(!_0x5e3389){return _0x223754['update']({'inReplyTo':_0x449396[_0x7255('0x27')][_0x7255('0x16')][_0x7255('0x4b')],'to':_0x449396['body'][_0x7255('0x16')][_0x7255('0x31')],'cc':_0x449396[_0x7255('0x27')][_0x7255('0x16')]['cc'],'subject':_0x449396['body']['message'][_0x7255('0x54')],'attach':_0x223754['attach']?_0x223754[_0x7255('0x55')]:_0x449396[_0x7255('0x27')][_0x7255('0x16')][_0x7255('0x55')],'substatus':null,'substatusAt':moment()['format'](_0x7255('0x4e')),'lastMsgAt':moment()['format'](_0x7255('0x4e')),'lastMsgDirection':'in','lastMsgBody':_0x449396[_0x7255('0x27')][_0x7255('0x27')]});}else{return _0x223754;}}})[_0x7255('0xf')](function(_0xdc5cf){_0x512928[_0x7255('0x56')]=_0xdc5cf['get']({'plain':!![]});_0x512928[_0x7255('0x56')][_0x7255('0x57')]=_0x3713cc;return db[_0x7255('0x58')]['create']({'body':_0x449396[_0x7255('0x27')][_0x7255('0x27')],'MailAccountId':_0x449396['account']['id'],'MailInteractionId':_0xdc5cf['id'],'direction':'in','ContactId':_0x512928[_0x7255('0x4a')]['id'],'messageId':_0x449396[_0x7255('0x27')]['message'][_0x7255('0x4b')],'from':_0x449396['body'][_0x7255('0x16')]['from'],'to':_0x449396['body'][_0x7255('0x16')]['to'],'cc':_0x449396[_0x7255('0x27')][_0x7255('0x16')]['cc'],'subject':_0x449396[_0x7255('0x27')][_0x7255('0x16')]['subject'],'attach':_0x449396[_0x7255('0x27')]['message']['attach'],'Attachments':_0x449396[_0x7255('0x27')][_0x7255('0x16')]['attachments'],'originTo':_0x449396['body'][_0x7255('0x16')][_0x7255('0x59')],'originCc':_0x449396[_0x7255('0x27')][_0x7255('0x16')]['originCc'],'bcc':_0x449396[_0x7255('0x27')][_0x7255('0x16')][_0x7255('0x5a')]},{'include':[{'model':db[_0x7255('0x5b')],'as':_0x7255('0x5c')}]});})[_0x7255('0xf')](function(_0x4d15cc){_0x512928['message']=_0x4d15cc;if(_0x512928[_0x7255('0x56')]['UserId']){return db[_0x7255('0x5d')]['find']({'attributes':['id','name'],'where':{'id':_0x512928['interaction'][_0x7255('0x5e')]}})[_0x7255('0xf')](function(_0x38c8c6){if(_0x38c8c6){_0x512928[_0x7255('0x3e')][_0x7255('0x5f')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x38c8c6[_0x7255('0x60')]+','+(_0x512928[_0x7255('0x38')][_0x7255('0x61')]||0xa),'interval':_0x7255('0x45')});}return respondWithRpcPromise('Start','startRouting',_0x512928);});}return respondWithRpcPromise(_0x7255('0x62'),_0x7255('0x63'),_0x512928);})[_0x7255('0xf')](function(_0xb095fa){_0x4d5147(_0xb095fa);})[_0x7255('0x19')](function(_0xb80358){_0x4837de(_0x4e1c47[_0x7255('0x14')](0x1f4,_0xb80358[_0x7255('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index fc01a55..919400f 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 _0xdcf6=['update','emit','removeListener','save','remove'];(function(_0x390fac,_0x3f2e0b){var _0x4ef0d9=function(_0x7dd36b){while(--_0x7dd36b){_0x390fac['push'](_0x390fac['shift']());}};_0x4ef0d9(++_0x3f2e0b);}(_0xdcf6,0x1b6));var _0x6dcf=function(_0x2df84d,_0x56d874){_0x2df84d=_0x2df84d-0x0;var _0x2634ce=_0xdcf6[_0x2df84d];return _0x2634ce;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x6dcf('0x0'),_0x6dcf('0x1'),_0x6dcf('0x2')];function createListener(_0x4402e7,_0x34db3b){return function(_0x17056c){_0x34db3b[_0x6dcf('0x3')](_0x4402e7,_0x17056c);};}function removeListener(_0x513bcb,_0x69f442){return function(){MailAccountEvents[_0x6dcf('0x4')](_0x513bcb,_0x69f442);};}exports['register']=function(_0x1ff8b6){for(var _0x3364bd=0x0,_0x5abd79=events['length'];_0x3364bd<_0x5abd79;_0x3364bd++){var _0x5766db=events[_0x3364bd];var _0x34517a=createListener('mailAccount:'+_0x5766db,_0x1ff8b6);MailAccountEvents['on'](_0x5766db,_0x34517a);}}; \ No newline at end of file +var _0x7c22=['removeListener','length','mailAccount:','./mailAccount.events','save','update','emit'];(function(_0x531666,_0x40f09a){var _0x1e3a05=function(_0x5e74d1){while(--_0x5e74d1){_0x531666['push'](_0x531666['shift']());}};_0x1e3a05(++_0x40f09a);}(_0x7c22,0x6c));var _0x27c2=function(_0x13140e,_0x414f44){_0x13140e=_0x13140e-0x0;var _0x4da2b0=_0x7c22[_0x13140e];return _0x4da2b0;};'use strict';var MailAccountEvents=require(_0x27c2('0x0'));var events=[_0x27c2('0x1'),'remove',_0x27c2('0x2')];function createListener(_0x117d29,_0x4d6d12){return function(_0x10f765){_0x4d6d12[_0x27c2('0x3')](_0x117d29,_0x10f765);};}function removeListener(_0x59004d,_0x4ce950){return function(){MailAccountEvents[_0x27c2('0x4')](_0x59004d,_0x4ce950);};}exports['register']=function(_0x28548d){for(var _0x5006bd=0x0,_0x32ec44=events[_0x27c2('0x5')];_0x5006bd<_0x32ec44;_0x5006bd++){var _0x56736f=events[_0x5006bd];var _0xb57ae1=createListener(_0x27c2('0x6')+_0x56736f,_0x28548d);MailAccountEvents['on'](_0x56736f,_0xb57ae1);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 8b10e7b..79d8d84 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 _0xeffd=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','exports','multer'];(function(_0x440604,_0x1f87c1){var _0x472ee1=function(_0x3fc59c){while(--_0x3fc59c){_0x440604['push'](_0x440604['shift']());}};_0x472ee1(++_0x1f87c1);}(_0xeffd,0x6b));var _0xdeff=function(_0x2ae4dd,_0x26f711){_0x2ae4dd=_0x2ae4dd-0x0;var _0x36b729=_0xeffd[_0x2ae4dd];return _0x36b729;};'use strict';var multer=require(_0xdeff('0x0'));var util=require('util');var path=require(_0xdeff('0x1'));var timeout=require(_0xdeff('0x2'));var express=require(_0xdeff('0x3'));var router=express[_0xdeff('0x4')]();var auth=require(_0xdeff('0x5'));var interaction=require(_0xdeff('0x6'));var config=require(_0xdeff('0x7'));var controller=require(_0xdeff('0x8'));router[_0xdeff('0x9')](_0xdeff('0xa'),auth[_0xdeff('0xb')](),controller[_0xdeff('0xc')]);router[_0xdeff('0xd')](_0xdeff('0xa'),auth[_0xdeff('0xb')](),controller[_0xdeff('0xe')]);router[_0xdeff('0xf')]('/:id',auth[_0xdeff('0xb')](),controller[_0xdeff('0x10')]);module[_0xdeff('0x11')]=router; \ No newline at end of file +var _0x0102=['isAuthenticated','show','update','delete','destroy','exports','util','path','connect-timeout','express','get','/:id'];(function(_0x30f307,_0x4ba377){var _0x3fe792=function(_0x565000){while(--_0x565000){_0x30f307['push'](_0x30f307['shift']());}};_0x3fe792(++_0x4ba377);}(_0x0102,0x186));var _0x2010=function(_0x92670d,_0x57644c){_0x92670d=_0x92670d-0x0;var _0x1ba423=_0x0102[_0x92670d];return _0x1ba423;};'use strict';var multer=require('multer');var util=require(_0x2010('0x0'));var path=require(_0x2010('0x1'));var timeout=require(_0x2010('0x2'));var express=require(_0x2010('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailApplication.controller');router[_0x2010('0x4')](_0x2010('0x5'),auth[_0x2010('0x6')](),controller[_0x2010('0x7')]);router['put'](_0x2010('0x5'),auth['isAuthenticated'](),controller[_0x2010('0x8')]);router[_0x2010('0x9')]('/:id',auth[_0x2010('0x6')](),controller[_0x2010('0xa')]);module[_0x2010('0xb')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index e793dff..f4cb681 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 _0x70a5=['STRING','noop','*,*,*,*','exports','INTEGER'];(function(_0x4011b4,_0x5dee64){var _0x502430=function(_0x32bae6){while(--_0x32bae6){_0x4011b4['push'](_0x4011b4['shift']());}};_0x502430(++_0x5dee64);}(_0x70a5,0x7b));var _0x570a=function(_0x54f8b0,_0x2ed2d2){_0x54f8b0=_0x54f8b0-0x0;var _0x2e1d5c=_0x70a5[_0x54f8b0];return _0x2e1d5c;};'use strict';var Sequelize=require('sequelize');module[_0x570a('0x0')]={'priority':{'type':Sequelize[_0x570a('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x570a('0x2')],'allowNull':![],'defaultValue':_0x570a('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x570a('0x2')]},'interval':{'type':Sequelize[_0x570a('0x2')],'defaultValue':_0x570a('0x4')}}; \ No newline at end of file +var _0xc31d=['INTEGER','TEXT','STRING','*,*,*,*','sequelize','exports'];(function(_0x58ceb9,_0x5601df){var _0x3d0ff5=function(_0x3a79d0){while(--_0x3a79d0){_0x58ceb9['push'](_0x58ceb9['shift']());}};_0x3d0ff5(++_0x5601df);}(_0xc31d,0x18a));var _0xdc31=function(_0x424357,_0x9ebe3e){_0x424357=_0x424357-0x0;var _0x29c68e=_0xc31d[_0x424357];return _0x29c68e;};'use strict';var Sequelize=require(_0xdc31('0x0'));module[_0xdc31('0x1')]={'priority':{'type':Sequelize[_0xdc31('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xdc31('0x3')]()},'description':{'type':Sequelize[_0xdc31('0x4')]},'interval':{'type':Sequelize[_0xdc31('0x4')],'defaultValue':_0xdc31('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 33f6c5a..b0e6fab 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 _0x374c=['apply','save','then','destroy','end','error','stack','name','params','keys','MailApplication','rawAttributes','query','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','find','update','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x374c,0x1e3));var _0xc374=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0x374c[_0x3ea913];return _0x2b4f28;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc374('0x0'));var rimraf=require(_0xc374('0x1'));var zipdir=require(_0xc374('0x2'));var jsonpatch=require(_0xc374('0x3'));var rp=require(_0xc374('0x4'));var moment=require('moment');var BPromise=require(_0xc374('0x5'));var Mustache=require('mustache');var util=require(_0xc374('0x6'));var path=require(_0xc374('0x7'));var sox=require('sox');var csv=require(_0xc374('0x8'));var ejs=require(_0xc374('0x9'));var fs=require('fs');var _=require(_0xc374('0xa'));var squel=require(_0xc374('0xb'));var crypto=require(_0xc374('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc374('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc374('0xe'));var Redis=require(_0xc374('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xc374('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc374('0x11'));var logger=require(_0xc374('0x12'))(_0xc374('0x13'));var utils=require('../../config/utils');var config=require(_0xc374('0x14'));var db=require(_0xc374('0x15'))['db'];function respondWithStatusCode(_0xa4ab31,_0x5e0f82){_0x5e0f82=_0x5e0f82||0xcc;return function(_0x44eba3){if(_0x44eba3){return _0xa4ab31[_0xc374('0x16')](_0x5e0f82);}return _0xa4ab31[_0xc374('0x17')](_0x5e0f82)['end']();};}function respondWithResult(_0x166a78,_0x47a7bf){_0x47a7bf=_0x47a7bf||0xc8;return function(_0xae92ab){if(_0xae92ab){return _0x166a78[_0xc374('0x17')](_0x47a7bf)['json'](_0xae92ab);}};}function respondWithFilteredResult(_0x1e44f9,_0x3f868a){return function(_0x4109ec){if(_0x4109ec){var _0x198919=_0x4109ec[_0xc374('0x18')],_0x1178a1=_0x3f868a[_0xc374('0x19')],_0x115e8a=_0x3f868a[_0xc374('0x19')]+_0x3f868a[_0xc374('0x1a')],_0x132aff;if(_0x115e8a>=_0x198919){_0x115e8a=_0x198919;_0x132aff=0xc8;}else{_0x132aff=0xce;}_0x1e44f9['status'](_0x132aff);return _0x1e44f9[_0xc374('0x1b')](_0xc374('0x1c'),_0x1178a1+'-'+_0x115e8a+'/'+_0x198919)[_0xc374('0x1d')](_0x4109ec);}return null;};}function patchUpdates(_0x50e525){return function(_0x22d3be){try{jsonpatch[_0xc374('0x1e')](_0x22d3be,_0x50e525,!![]);}catch(_0x54b516){return BPromise['reject'](_0x54b516);}return _0x22d3be[_0xc374('0x1f')]();};}function saveUpdates(_0x3bf099,_0x4110bf){return function(_0x2beb98){if(_0x2beb98){return _0x2beb98['update'](_0x3bf099)[_0xc374('0x20')](function(_0x3d60d4){return _0x3d60d4;});}return null;};}function removeEntity(_0x21f741,_0x16959d){return function(_0x3cbbad){if(_0x3cbbad){return _0x3cbbad[_0xc374('0x21')]()[_0xc374('0x20')](function(){_0x21f741[_0xc374('0x17')](0xcc)[_0xc374('0x22')]();});}};}function handleEntityNotFound(_0x18699e,_0x4110a5){return function(_0x5b92c6){if(!_0x5b92c6){_0x18699e[_0xc374('0x16')](0x194);}return _0x5b92c6;};}function handleError(_0x6931d1,_0x2b31ad){_0x2b31ad=_0x2b31ad||0x1f4;return function(_0x5dd1e9){logger[_0xc374('0x23')](_0x5dd1e9[_0xc374('0x24')]);if(_0x5dd1e9[_0xc374('0x25')]){delete _0x5dd1e9[_0xc374('0x25')];}_0x6931d1['status'](_0x2b31ad)['send'](_0x5dd1e9);};}exports['show']=function(_0x17d02e,_0x2e7fad){var _0x187007={'raw':!![],'where':{'id':_0x17d02e[_0xc374('0x26')]['id']}},_0x5530a3={};_0x5530a3['model']=_[_0xc374('0x27')](db[_0xc374('0x28')][_0xc374('0x29')]);_0x5530a3[_0xc374('0x2a')]=_[_0xc374('0x27')](_0x17d02e[_0xc374('0x2a')]);_0x5530a3[_0xc374('0x2b')]=_[_0xc374('0x2c')](_0x5530a3['model'],_0x5530a3[_0xc374('0x2a')]);_0x187007['attributes']=_[_0xc374('0x2c')](_0x5530a3[_0xc374('0x2d')],qs[_0xc374('0x2e')](_0x17d02e[_0xc374('0x2a')]['fields']));_0x187007[_0xc374('0x2f')]=_0x187007['attributes'][_0xc374('0x30')]?_0x187007[_0xc374('0x2f')]:_0x5530a3[_0xc374('0x2d')];if(_0x17d02e[_0xc374('0x2a')][_0xc374('0x31')]){_0x187007[_0xc374('0x32')]=[{'all':!![]}];}_0x187007=_[_0xc374('0x33')]({},_0x187007,_0x17d02e[_0xc374('0x34')]);return db[_0xc374('0x28')][_0xc374('0x35')](_0x187007)[_0xc374('0x20')](handleEntityNotFound(_0x2e7fad,null))[_0xc374('0x20')](respondWithResult(_0x2e7fad,null))['catch'](handleError(_0x2e7fad,null));};exports[_0xc374('0x36')]=function(_0x5ab560,_0x2cd7fd){if(_0x5ab560[_0xc374('0x37')]['id']){delete _0x5ab560[_0xc374('0x37')]['id'];}return db['MailApplication'][_0xc374('0x35')]({'where':{'id':_0x5ab560[_0xc374('0x26')]['id']}})['then'](handleEntityNotFound(_0x2cd7fd,null))[_0xc374('0x20')](saveUpdates(_0x5ab560[_0xc374('0x37')],null))[_0xc374('0x20')](respondWithResult(_0x2cd7fd,null))[_0xc374('0x38')](handleError(_0x2cd7fd,null));};exports[_0xc374('0x21')]=function(_0x41dfac,_0x756eb7){return db['MailApplication']['find']({'where':{'id':_0x41dfac['params']['id']}})[_0xc374('0x20')](handleEntityNotFound(_0x756eb7,null))[_0xc374('0x20')](removeEntity(_0x756eb7,null))[_0xc374('0x38')](handleError(_0x756eb7,null));}; \ No newline at end of file +var _0x683c=['includeAll','find','body','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','name','send','show','params','model','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','fields','length'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x683c,0xac));var _0xc683=function(_0x53eb93,_0x2ef2c2){_0x53eb93=_0x53eb93-0x0;var _0x79e083=_0x683c[_0x53eb93];return _0x79e083;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xc683('0x0'));var zipdir=require(_0xc683('0x1'));var jsonpatch=require(_0xc683('0x2'));var rp=require(_0xc683('0x3'));var moment=require(_0xc683('0x4'));var BPromise=require(_0xc683('0x5'));var Mustache=require('mustache');var util=require(_0xc683('0x6'));var path=require(_0xc683('0x7'));var sox=require(_0xc683('0x8'));var csv=require(_0xc683('0x9'));var ejs=require(_0xc683('0xa'));var fs=require('fs');var _=require(_0xc683('0xb'));var squel=require('squel');var crypto=require(_0xc683('0xc'));var jsforce=require(_0xc683('0xd'));var deskjs=require(_0xc683('0xe'));var toCsv=require(_0xc683('0x9'));var querystring=require(_0xc683('0xf'));var Papa=require(_0xc683('0x10'));var Redis=require(_0xc683('0x11'));var authService=require(_0xc683('0x12'));var qs=require(_0xc683('0x13'));var as=require(_0xc683('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc683('0x15'))(_0xc683('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10d6a0,_0x40dec7){_0x40dec7=_0x40dec7||0xcc;return function(_0x287430){if(_0x287430){return _0x10d6a0['sendStatus'](_0x40dec7);}return _0x10d6a0['status'](_0x40dec7)[_0xc683('0x17')]();};}function respondWithResult(_0x575a6a,_0x5aab62){_0x5aab62=_0x5aab62||0xc8;return function(_0x272938){if(_0x272938){return _0x575a6a[_0xc683('0x18')](_0x5aab62)[_0xc683('0x19')](_0x272938);}};}function respondWithFilteredResult(_0x551af4,_0x475a58){return function(_0x1fb8bf){if(_0x1fb8bf){var _0x3c6f25=_0x1fb8bf[_0xc683('0x1a')],_0x40f088=_0x475a58['offset'],_0x53c208=_0x475a58[_0xc683('0x1b')]+_0x475a58[_0xc683('0x1c')],_0x378bcb;if(_0x53c208>=_0x3c6f25){_0x53c208=_0x3c6f25;_0x378bcb=0xc8;}else{_0x378bcb=0xce;}_0x551af4[_0xc683('0x18')](_0x378bcb);return _0x551af4[_0xc683('0x1d')](_0xc683('0x1e'),_0x40f088+'-'+_0x53c208+'/'+_0x3c6f25)[_0xc683('0x19')](_0x1fb8bf);}return null;};}function patchUpdates(_0x3c3195){return function(_0x226be5){try{jsonpatch[_0xc683('0x1f')](_0x226be5,_0x3c3195,!![]);}catch(_0x41188c){return BPromise['reject'](_0x41188c);}return _0x226be5[_0xc683('0x20')]();};}function saveUpdates(_0x186a12,_0x1d1853){return function(_0x18601c){if(_0x18601c){return _0x18601c[_0xc683('0x21')](_0x186a12)[_0xc683('0x22')](function(_0x53252d){return _0x53252d;});}return null;};}function removeEntity(_0x183e1a,_0x59b4a1){return function(_0x51f84a){if(_0x51f84a){return _0x51f84a[_0xc683('0x23')]()[_0xc683('0x22')](function(){_0x183e1a[_0xc683('0x18')](0xcc)[_0xc683('0x17')]();});}};}function handleEntityNotFound(_0x2e4eba,_0x3c7c6e){return function(_0x16420b){if(!_0x16420b){_0x2e4eba[_0xc683('0x24')](0x194);}return _0x16420b;};}function handleError(_0x4f99f2,_0x4254e3){_0x4254e3=_0x4254e3||0x1f4;return function(_0x4b1f74){logger[_0xc683('0x25')](_0x4b1f74['stack']);if(_0x4b1f74[_0xc683('0x26')]){delete _0x4b1f74['name'];}_0x4f99f2['status'](_0x4254e3)[_0xc683('0x27')](_0x4b1f74);};}exports[_0xc683('0x28')]=function(_0x5a98d1,_0x5ad7c7){var _0x586537={'raw':!![],'where':{'id':_0x5a98d1[_0xc683('0x29')]['id']}},_0x33792a={};_0x33792a[_0xc683('0x2a')]=_[_0xc683('0x2b')](db[_0xc683('0x2c')][_0xc683('0x2d')]);_0x33792a[_0xc683('0x2e')]=_[_0xc683('0x2b')](_0x5a98d1[_0xc683('0x2e')]);_0x33792a[_0xc683('0x2f')]=_[_0xc683('0x30')](_0x33792a[_0xc683('0x2a')],_0x33792a[_0xc683('0x2e')]);_0x586537[_0xc683('0x31')]=_[_0xc683('0x30')](_0x33792a[_0xc683('0x2a')],qs[_0xc683('0x32')](_0x5a98d1['query'][_0xc683('0x32')]));_0x586537[_0xc683('0x31')]=_0x586537['attributes'][_0xc683('0x33')]?_0x586537[_0xc683('0x31')]:_0x33792a[_0xc683('0x2a')];if(_0x5a98d1['query'][_0xc683('0x34')]){_0x586537['include']=[{'all':!![]}];}_0x586537=_['merge']({},_0x586537,_0x5a98d1['options']);return db['MailApplication'][_0xc683('0x35')](_0x586537)[_0xc683('0x22')](handleEntityNotFound(_0x5ad7c7,null))['then'](respondWithResult(_0x5ad7c7,null))['catch'](handleError(_0x5ad7c7,null));};exports[_0xc683('0x21')]=function(_0x47f705,_0x4c3ed5){if(_0x47f705[_0xc683('0x36')]['id']){delete _0x47f705[_0xc683('0x36')]['id'];}return db[_0xc683('0x2c')][_0xc683('0x35')]({'where':{'id':_0x47f705['params']['id']}})['then'](handleEntityNotFound(_0x4c3ed5,null))['then'](saveUpdates(_0x47f705[_0xc683('0x36')],null))[_0xc683('0x22')](respondWithResult(_0x4c3ed5,null))['catch'](handleError(_0x4c3ed5,null));};exports[_0xc683('0x23')]=function(_0x28ac34,_0xf8b91e){return db[_0xc683('0x2c')][_0xc683('0x35')]({'where':{'id':_0x28ac34[_0xc683('0x29')]['id']}})[_0xc683('0x22')](handleEntityNotFound(_0xf8b91e,null))[_0xc683('0x22')](removeEntity(_0xf8b91e,null))[_0xc683('0x37')](handleError(_0xf8b91e,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index f33069f..5aa7c9b 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 _0xdec3=['rimraf','../../config/environment','exports','define','MailApplication','mail_applications','utf8mb4','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x5df3bc,_0x5bc6d3){var _0x24e4e1=function(_0x47c7a4){while(--_0x47c7a4){_0x5df3bc['push'](_0x5df3bc['shift']());}};_0x24e4e1(++_0x5bc6d3);}(_0xdec3,0x89));var _0x3dec=function(_0x4de3ff,_0x4cb1d0){_0x4de3ff=_0x4de3ff-0x0;var _0x3b08fd=_0xdec3[_0x4de3ff];return _0x3b08fd;};'use strict';var _=require(_0x3dec('0x0'));var util=require('util');var logger=require(_0x3dec('0x1'))(_0x3dec('0x2'));var moment=require(_0x3dec('0x3'));var BPromise=require('bluebird');var rp=require(_0x3dec('0x4'));var fs=require('fs');var path=require(_0x3dec('0x5'));var rimraf=require(_0x3dec('0x6'));var config=require(_0x3dec('0x7'));var attributes=require('./mailApplication.attributes');module[_0x3dec('0x8')]=function(_0x2894eb,_0x347c06){return _0x2894eb[_0x3dec('0x9')](_0x3dec('0xa'),attributes,{'tableName':_0x3dec('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3dec('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x2ff5=['utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','MailApplication','mail_applications','utf8mb4'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x2ff5,0x1d5));var _0x52ff=function(_0x35b699,_0x4508f4){_0x35b699=_0x35b699-0x0;var _0x38243d=_0x2ff5[_0x35b699];return _0x38243d;};'use strict';var _=require('lodash');var util=require(_0x52ff('0x0'));var logger=require(_0x52ff('0x1'))('api');var moment=require(_0x52ff('0x2'));var BPromise=require(_0x52ff('0x3'));var rp=require(_0x52ff('0x4'));var fs=require('fs');var path=require(_0x52ff('0x5'));var rimraf=require(_0x52ff('0x6'));var config=require(_0x52ff('0x7'));var attributes=require('./mailApplication.attributes');module[_0x52ff('0x8')]=function(_0x285f60,_0x26906c){return _0x285f60['define'](_0x52ff('0x9'),attributes,{'tableName':_0x52ff('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x52ff('0xb'),'collate':_0x52ff('0xc')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index f16d8df..ca004f6 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 _0x4de8=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','MailApplication,\x20%s,\x20%s','message','result','catch','MailApplication','update','body','options','where','attributes','limit','then','UpdateMailApplication','util','moment'];(function(_0x12ec65,_0x5bd7c9){var _0x28502f=function(_0x3958de){while(--_0x3958de){_0x12ec65['push'](_0x12ec65['shift']());}};_0x28502f(++_0x5bd7c9);}(_0x4de8,0x7a));var _0x84de=function(_0x3c7195,_0x589382){_0x3c7195=_0x3c7195-0x0;var _0x38d8cd=_0x4de8[_0x3c7195];return _0x38d8cd;};'use strict';var _=require('lodash');var util=require(_0x84de('0x0'));var moment=require(_0x84de('0x1'));var BPromise=require('bluebird');var rs=require(_0x84de('0x2'));var fs=require('fs');var Redis=require(_0x84de('0x3'));var db=require(_0x84de('0x4'))['db'];var utils=require(_0x84de('0x5'));var logger=require(_0x84de('0x6'))(_0x84de('0x7'));var config=require(_0x84de('0x8'));var jayson=require(_0x84de('0x9'));var client=jayson[_0x84de('0xa')][_0x84de('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x148db1,_0x1bbf5b,_0x306c34){return new BPromise(function(_0x20686a,_0x121775){return client[_0x84de('0xc')](_0x148db1,_0x306c34)['then'](function(_0x301e34){logger[_0x84de('0xd')]('MailApplication,\x20%s,\x20%s',_0x1bbf5b,_0x84de('0xe'));logger[_0x84de('0xf')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x1bbf5b,_0x84de('0xe'),JSON[_0x84de('0x10')](_0x301e34));if(_0x301e34[_0x84de('0x11')]){if(_0x301e34[_0x84de('0x11')]['code']===0x1f4){logger[_0x84de('0x11')](_0x84de('0x12'),_0x1bbf5b,_0x301e34[_0x84de('0x11')][_0x84de('0x13')]);return _0x121775(_0x301e34[_0x84de('0x11')][_0x84de('0x13')]);}logger['error'](_0x84de('0x12'),_0x1bbf5b,_0x301e34[_0x84de('0x11')]['message']);return _0x20686a(_0x301e34[_0x84de('0x11')][_0x84de('0x13')]);}else{logger[_0x84de('0xd')](_0x84de('0x12'),_0x1bbf5b,'request\x20sent');_0x20686a(_0x301e34[_0x84de('0x14')][_0x84de('0x13')]);}})[_0x84de('0x15')](function(_0x45d25f){logger[_0x84de('0x11')](_0x84de('0x12'),_0x1bbf5b,_0x45d25f);_0x121775(_0x45d25f);});});}exports['UpdateMailApplication']=function(_0x2a5def){var _0x278043=this;return new Promise(function(_0x51cfef,_0x2fcfd4){return db[_0x84de('0x16')][_0x84de('0x17')](_0x2a5def[_0x84de('0x18')],{'raw':_0x2a5def[_0x84de('0x19')]?_0x2a5def[_0x84de('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a5def[_0x84de('0x19')]?_0x2a5def['options'][_0x84de('0x1a')]||null:null,'attributes':_0x2a5def[_0x84de('0x19')]?_0x2a5def[_0x84de('0x19')][_0x84de('0x1b')]||null:null,'limit':_0x2a5def['options']?_0x2a5def[_0x84de('0x19')][_0x84de('0x1c')]||null:null})[_0x84de('0x1d')](function(_0x4d4617){logger[_0x84de('0xd')]('UpdateMailApplication',_0x2a5def);logger[_0x84de('0xf')](_0x84de('0x1e'),_0x2a5def,JSON[_0x84de('0x10')](_0x4d4617));_0x51cfef(_0x4d4617);})[_0x84de('0x15')](function(_0x5a212f){logger['error'](_0x84de('0x1e'),_0x5a212f[_0x84de('0x13')],_0x2a5def);_0x2fcfd4(_0x278043[_0x84de('0x11')](0x1f4,_0x5a212f[_0x84de('0x13')]));});});}; \ No newline at end of file +var _0x8098=['error','code','message','result','catch','UpdateMailApplication','MailApplication','update','body','options','raw','where','attributes','limit','info','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','request','then','MailApplication,\x20%s,\x20%s','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2bda14,_0x4fab1b){var _0xb5dd49=function(_0x1da71e){while(--_0x1da71e){_0x2bda14['push'](_0x2bda14['shift']());}};_0xb5dd49(++_0x4fab1b);}(_0x8098,0x70));var _0x8809=function(_0x3be468,_0x20280a){_0x3be468=_0x3be468-0x0;var _0x467807=_0x8098[_0x3be468];return _0x467807;};'use strict';var _=require(_0x8809('0x0'));var util=require(_0x8809('0x1'));var moment=require(_0x8809('0x2'));var BPromise=require(_0x8809('0x3'));var rs=require(_0x8809('0x4'));var fs=require('fs');var Redis=require(_0x8809('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8809('0x6'));var logger=require(_0x8809('0x7'))('rpc');var config=require(_0x8809('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8809('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x97ef81,_0x17809b,_0x10eea4){return new BPromise(function(_0x672d08,_0x2a7ad6){return client[_0x8809('0xa')](_0x97ef81,_0x10eea4)[_0x8809('0xb')](function(_0x1b3604){logger['info'](_0x8809('0xc'),_0x17809b,'request\x20sent');logger['debug'](_0x8809('0xd'),_0x17809b,_0x8809('0xe'),JSON[_0x8809('0xf')](_0x1b3604));if(_0x1b3604[_0x8809('0x10')]){if(_0x1b3604[_0x8809('0x10')][_0x8809('0x11')]===0x1f4){logger[_0x8809('0x10')](_0x8809('0xc'),_0x17809b,_0x1b3604['error'][_0x8809('0x12')]);return _0x2a7ad6(_0x1b3604['error'][_0x8809('0x12')]);}logger[_0x8809('0x10')]('MailApplication,\x20%s,\x20%s',_0x17809b,_0x1b3604[_0x8809('0x10')][_0x8809('0x12')]);return _0x672d08(_0x1b3604[_0x8809('0x10')]['message']);}else{logger['info'](_0x8809('0xc'),_0x17809b,_0x8809('0xe'));_0x672d08(_0x1b3604[_0x8809('0x13')][_0x8809('0x12')]);}})[_0x8809('0x14')](function(_0x2fd70a){logger[_0x8809('0x10')](_0x8809('0xc'),_0x17809b,_0x2fd70a);_0x2a7ad6(_0x2fd70a);});});}exports[_0x8809('0x15')]=function(_0x58e68a){var _0x50bc8e=this;return new Promise(function(_0x91d09,_0x64491){return db[_0x8809('0x16')][_0x8809('0x17')](_0x58e68a[_0x8809('0x18')],{'raw':_0x58e68a[_0x8809('0x19')]?_0x58e68a['options'][_0x8809('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58e68a['options']?_0x58e68a['options'][_0x8809('0x1b')]||null:null,'attributes':_0x58e68a[_0x8809('0x19')]?_0x58e68a[_0x8809('0x19')][_0x8809('0x1c')]||null:null,'limit':_0x58e68a[_0x8809('0x19')]?_0x58e68a[_0x8809('0x19')][_0x8809('0x1d')]||null:null})[_0x8809('0xb')](function(_0x13b72a){logger[_0x8809('0x1e')](_0x8809('0x15'),_0x58e68a);logger[_0x8809('0x1f')](_0x8809('0x15'),_0x58e68a,JSON['stringify'](_0x13b72a));_0x91d09(_0x13b72a);})[_0x8809('0x14')](function(_0x12a6d3){logger[_0x8809('0x10')](_0x8809('0x15'),_0x12a6d3[_0x8809('0x12')],_0x58e68a);_0x64491(_0x50bc8e[_0x8809('0x10')](0x1f4,_0x12a6d3['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 0cea5b7..aff2647 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 _0x7f36=['util','path','connect-timeout','express','../../components/auth/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','post','create','addMessage','tracked','mail','mailinteraction:addtags','mailinteraction:update','update','delete','/:id','destroy','/:id/tags','exports','multer'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x7f36,0x1bf));var _0x67f3=function(_0x5c5abc,_0x284219){_0x5c5abc=_0x5c5abc-0x0;var _0x1c16d7=_0x7f36[_0x5c5abc];return _0x1c16d7;};'use strict';var multer=require(_0x67f3('0x0'));var util=require(_0x67f3('0x1'));var path=require(_0x67f3('0x2'));var timeout=require(_0x67f3('0x3'));var express=require(_0x67f3('0x4'));var router=express['Router']();var auth=require(_0x67f3('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x67f3('0x6'));router[_0x67f3('0x7')]('/',auth[_0x67f3('0x8')](),controller[_0x67f3('0x9')]);router[_0x67f3('0x7')](_0x67f3('0xa'),auth[_0x67f3('0x8')](),controller[_0x67f3('0xb')]);router['get']('/:id',auth[_0x67f3('0x8')](),controller[_0x67f3('0xc')]);router[_0x67f3('0x7')](_0x67f3('0xd'),auth['isAuthenticated'](),controller[_0x67f3('0xe')]);router[_0x67f3('0x7')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x67f3('0xf')]('/',auth[_0x67f3('0x8')](),controller[_0x67f3('0x10')]);router[_0x67f3('0xf')](_0x67f3('0xd'),auth[_0x67f3('0x8')](),controller[_0x67f3('0x11')]);router[_0x67f3('0xf')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x67f3('0x12')](_0x67f3('0x13'),_0x67f3('0x14')),controller['addTags']);router['put']('/:id',auth[_0x67f3('0x8')](),interaction['tracked'](_0x67f3('0x13'),_0x67f3('0x15')),controller[_0x67f3('0x16')]);router[_0x67f3('0x17')](_0x67f3('0x18'),auth['isAuthenticated'](),interaction['tracked'](_0x67f3('0x13'),'mailinteraction:destroy'),controller[_0x67f3('0x19')]);router['delete'](_0x67f3('0x1a'),auth[_0x67f3('0x8')](),controller['removeTags']);module[_0x67f3('0x1b')]=router; \ No newline at end of file +var _0x24ca=['/:id/tags','tracked','mail','addTags','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','exports','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','download','post','create'];(function(_0x42c750,_0x41dcdc){var _0x319429=function(_0x43a70a){while(--_0x43a70a){_0x42c750['push'](_0x42c750['shift']());}};_0x319429(++_0x41dcdc);}(_0x24ca,0x8c));var _0xa24c=function(_0x5b3950,_0x4e5556){_0x5b3950=_0x5b3950-0x0;var _0x41e436=_0x24ca[_0x5b3950];return _0x41e436;};'use strict';var multer=require(_0xa24c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa24c('0x1'));var express=require('express');var router=express[_0xa24c('0x2')]();var auth=require(_0xa24c('0x3'));var interaction=require(_0xa24c('0x4'));var config=require('../../config/environment');var controller=require(_0xa24c('0x5'));router[_0xa24c('0x6')]('/',auth[_0xa24c('0x7')](),controller['index']);router['get']('/describe',auth[_0xa24c('0x7')](),controller[_0xa24c('0x8')]);router[_0xa24c('0x6')](_0xa24c('0x9'),auth[_0xa24c('0x7')](),controller[_0xa24c('0xa')]);router['get'](_0xa24c('0xb'),auth[_0xa24c('0x7')](),controller[_0xa24c('0xc')]);router['get']('/:id/download',auth[_0xa24c('0x7')](),controller[_0xa24c('0xd')]);router[_0xa24c('0xe')]('/',auth[_0xa24c('0x7')](),controller[_0xa24c('0xf')]);router[_0xa24c('0xe')]('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router[_0xa24c('0xe')](_0xa24c('0x10'),auth[_0xa24c('0x7')](),interaction[_0xa24c('0x11')](_0xa24c('0x12'),'mailinteraction:addtags'),controller[_0xa24c('0x13')]);router['put']('/:id',auth['isAuthenticated'](),interaction[_0xa24c('0x11')](_0xa24c('0x12'),_0xa24c('0x14')),controller[_0xa24c('0x15')]);router[_0xa24c('0x16')](_0xa24c('0x9'),auth[_0xa24c('0x7')](),interaction[_0xa24c('0x11')](_0xa24c('0x12'),_0xa24c('0x17')),controller[_0xa24c('0x18')]);router[_0xa24c('0x16')](_0xa24c('0x10'),auth[_0xa24c('0x7')](),controller['removeTags']);module[_0xa24c('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 542a02f..6cb5d80 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 _0x1d21=['sequelize','iconv','DATE','STRING','TEXT','long','ENUM','out'];(function(_0x40008d,_0x923962){var _0x5ccba8=function(_0x2a1841){while(--_0x2a1841){_0x40008d['push'](_0x40008d['shift']());}};_0x5ccba8(++_0x923962);}(_0x1d21,0x1b0));var _0x11d2=function(_0x1e91eb,_0x5829a3){_0x1e91eb=_0x1e91eb-0x0;var _0x2af75a=_0x1d21[_0x1e91eb];return _0x2af75a;};'use strict';var Sequelize=require(_0x11d2('0x0'));var iconv=require(_0x11d2('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x11d2('0x2')]},'disposition':{'type':Sequelize[_0x11d2('0x3')]},'note':{'type':Sequelize[_0x11d2('0x3')]},'inReplyTo':{'type':Sequelize[_0x11d2('0x3')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x11d2('0x4')](_0x11d2('0x5'))},'subject':{'type':Sequelize[_0x11d2('0x4')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x11d2('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0x11d2('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x11d2('0x6')]('in',_0x11d2('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x11d2('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x11d2('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x11d2('0x4')](_0x11d2('0x5'))},'lastMsgText':{'type':Sequelize['TEXT'](_0x11d2('0x5'))}}; \ No newline at end of file +var _0x7c78=['BOOLEAN','DATE','STRING','TEXT','long','out','sequelize','exports'];(function(_0xe97c99,_0x138258){var _0x18fbb3=function(_0x4e98e0){while(--_0x4e98e0){_0xe97c99['push'](_0xe97c99['shift']());}};_0x18fbb3(++_0x138258);}(_0x7c78,0x13e));var _0x87c7=function(_0x2ceb96,_0x16d3ff){_0x2ceb96=_0x2ceb96-0x0;var _0x3582ca=_0x7c78[_0x2ceb96];return _0x3582ca;};'use strict';var Sequelize=require(_0x87c7('0x0'));var iconv=require('iconv');module[_0x87c7('0x1')]={'closed':{'type':Sequelize[_0x87c7('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x87c7('0x3')]},'disposition':{'type':Sequelize[_0x87c7('0x4')]},'note':{'type':Sequelize[_0x87c7('0x4')]},'inReplyTo':{'type':Sequelize[_0x87c7('0x4')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x87c7('0x5')](_0x87c7('0x6'))},'subject':{'type':Sequelize[_0x87c7('0x5')]()},'attach':{'type':Sequelize[_0x87c7('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x87c7('0x3')]},'substatus':{'type':Sequelize[_0x87c7('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x87c7('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x87c7('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x87c7('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize['TEXT'](_0x87c7('0x6'))},'lastMsgText':{'type':Sequelize[_0x87c7('0x5')]('long')}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index ebec08f..b8b695b 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 _0xf489=['include','options','create','body','params','describe','addMessage','MailMessage','omit','ids','getMessages','format','findAll','addTags','spread','removeTags','download','unix','join','root','server','files','attachments','Attachment','Attachments','Messages','subject','get','mkdirSync','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','readFileSync','build','message%d.eml','log','err','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./mailInteraction.socket','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','Users','map','TagIds','Tags','forEach','push','findOne','lastMsgBody','lastMsgText','fromString','catch','index','MailInteraction','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','tools_tags','u.fullname','ui.MailInteractionId','from','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','operator','UserId','buildExpression','some','MailAccountId','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','read','`unreadMessages`\x20>\x200','tag','filter','replace','\x27\x27\x27\x27','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','isEmpty','t.id\x20IN\x20?','resolve','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','a.key','Account.key','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','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','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','enableEmailPreview','all','rows','show','includeAll'];(function(_0x2bd4de,_0x1dde2b){var _0x5a37e9=function(_0x3ddc7c){while(--_0x3ddc7c){_0x2bd4de['push'](_0x2bd4de['shift']());}};_0x5a37e9(++_0x1dde2b);}(_0xf489,0x114));var _0x9f48=function(_0x35cda2,_0x5f20f9){_0x35cda2=_0x35cda2-0x0;var _0x89f083=_0xf489[_0x35cda2];return _0x89f083;};'use strict';var pdf=require(_0x9f48('0x0'));var emlformat=require(_0x9f48('0x1'));var rimraf=require(_0x9f48('0x2'));var zipdir=require(_0x9f48('0x3'));var jsonpatch=require(_0x9f48('0x4'));var rp=require(_0x9f48('0x5'));var moment=require('moment');var BPromise=require(_0x9f48('0x6'));var Mustache=require(_0x9f48('0x7'));var util=require(_0x9f48('0x8'));var path=require(_0x9f48('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9f48('0xa'));var fs=require('fs');var _=require(_0x9f48('0xb'));var squel=require(_0x9f48('0xc'));var crypto=require(_0x9f48('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9f48('0xe'));var querystring=require(_0x9f48('0xf'));var Papa=require(_0x9f48('0x10'));var htmlToText=require(_0x9f48('0x11'));var Redis=require(_0x9f48('0x12'));var authService=require(_0x9f48('0x13'));var qs=require(_0x9f48('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9f48('0x15'))(_0x9f48('0x16'));var utils=require(_0x9f48('0x17'));var config=require(_0x9f48('0x18'));var db=require(_0x9f48('0x19'))['db'];config[_0x9f48('0x1a')]=_['defaults'](config[_0x9f48('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x9f48('0x1b'))(new Redis(config[_0x9f48('0x1a')]));require(_0x9f48('0x1c'))['register'](socket);function respondWithStatusCode(_0x348a0b,_0x3b8c6){_0x3b8c6=_0x3b8c6||0xcc;return function(_0xab2b50){if(_0xab2b50){return _0x348a0b['sendStatus'](_0x3b8c6);}return _0x348a0b['status'](_0x3b8c6)[_0x9f48('0x1d')]();};}function respondWithResult(_0x57332d,_0x220595){_0x220595=_0x220595||0xc8;return function(_0x313ed4){if(_0x313ed4){return _0x57332d[_0x9f48('0x1e')](_0x220595)[_0x9f48('0x1f')](_0x313ed4);}};}function respondWithFilteredResult(_0x439156,_0x28a7ee){return function(_0x3bcc07){if(_0x3bcc07){var _0x2aee43=_0x3bcc07[_0x9f48('0x20')],_0x822089=_0x28a7ee[_0x9f48('0x21')],_0x2b7b27=_0x28a7ee['offset']+_0x28a7ee[_0x9f48('0x22')],_0x107094;if(_0x2b7b27>=_0x2aee43){_0x2b7b27=_0x2aee43;_0x107094=0xc8;}else{_0x107094=0xce;}_0x439156[_0x9f48('0x1e')](_0x107094);return _0x439156[_0x9f48('0x23')](_0x9f48('0x24'),_0x822089+'-'+_0x2b7b27+'/'+_0x2aee43)[_0x9f48('0x1f')](_0x3bcc07);}return null;};}function patchUpdates(_0x3df6a1){return function(_0x3cb1ef){try{jsonpatch[_0x9f48('0x25')](_0x3cb1ef,_0x3df6a1,!![]);}catch(_0x5edf09){return BPromise[_0x9f48('0x26')](_0x5edf09);}return _0x3cb1ef[_0x9f48('0x27')]();};}function saveUpdates(_0x263293,_0x5d7bfd){return function(_0x3dfa13){if(_0x3dfa13){return _0x3dfa13[_0x9f48('0x28')](_0x263293)[_0x9f48('0x29')](function(_0x31a243){return _0x31a243;});}return null;};}function removeEntity(_0x5e4d15,_0x5a8d7e){return function(_0x22bf96){if(_0x22bf96){return _0x22bf96['destroy']()[_0x9f48('0x29')](function(){_0x5e4d15[_0x9f48('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbe4068,_0x74c339){return function(_0xfa60b){if(!_0xfa60b){_0xbe4068[_0x9f48('0x2a')](0x194);}return _0xfa60b;};}function handleError(_0x178275,_0x2eba3b){_0x2eba3b=_0x2eba3b||0x1f4;return function(_0x2e7c1c){logger['error'](_0x2e7c1c[_0x9f48('0x2b')]);if(_0x2e7c1c['name']){delete _0x2e7c1c[_0x9f48('0x2c')];}_0x178275[_0x9f48('0x1e')](_0x2eba3b)['send'](_0x2e7c1c);};}function getInteractionUsers(_0x1f5893,_0x41d48f){return new BPromise(function(_0x372617,_0x23aed0){try{if(_0x41d48f[_0x1f5893['id']]){_0x1f5893[_0x9f48('0x2d')]=_[_0x9f48('0x2e')](_0x41d48f[_0x1f5893['id']],function(_0x34a8cb){return{'id':_0x34a8cb['id'],'fullname':_0x34a8cb['fullname']};});}}catch(_0x3d7e1f){_0x23aed0(_0x3d7e1f);}_0x372617(_0x1f5893);});}function getInteractionTags(_0x5b3a0f,_0x46200){return new BPromise(function(_0x5c6828,_0x31e9e8){try{if(_0x5b3a0f[_0x9f48('0x2f')]){_0x5b3a0f[_0x9f48('0x30')]=[];_0x5b3a0f[_0x9f48('0x2f')]['split'](',')[_0x9f48('0x31')](function(_0x72db04){_0x5b3a0f[_0x9f48('0x30')][_0x9f48('0x32')](_0x46200[_0x72db04]);});}delete _0x5b3a0f[_0x9f48('0x2f')];}catch(_0x551fbe){_0x31e9e8(_0x551fbe);}_0x5c6828(_0x5b3a0f);});}function getLastMessageText(_0x38ba32){return new BPromise(function(_0xd37c2b,_0x14e5e4){return db['MailInteraction'][_0x9f48('0x33')]({'where':{'id':_0x38ba32['id']},'attributes':[_0x9f48('0x34'),_0x9f48('0x35')],'raw':!![]})[_0x9f48('0x29')](function(_0x2784f6){if(!_0x2784f6['lastMsgText']){_0x38ba32[_0x9f48('0x35')]=_['trimStart'](htmlToText[_0x9f48('0x36')](_0x2784f6[_0x9f48('0x34')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x38ba32[_0x9f48('0x35')]=_0x2784f6[_0x9f48('0x35')];}_0xd37c2b(_0x38ba32);})[_0x9f48('0x37')](function(_0x3eec5c){_0x14e5e4(_0x3eec5c);});});}function updateMailInteraction(_0x49d250,_0x4a16c2,_0x347040,_0x29192d){return new BPromise(function(_0x32d2f5,_0x3b076a){return getInteractionUsers(_0x49d250,_0x347040)['then'](function(_0x100d51){return getInteractionTags(_0x100d51,_0x4a16c2);})[_0x9f48('0x29')](function(_0x4fb886){if(_0x29192d){_0x32d2f5(getLastMessageText(_0x4fb886));}else{_0x32d2f5(_0x4fb886);}})[_0x9f48('0x37')](function(_0xcdf984){_0x3b076a(_0xcdf984);});});}exports[_0x9f48('0x38')]=function(_0x3c4d16,_0x3c76b8){var _0x33f3c4={},_0x21d46f={},_0x133169={'count':0x0,'rows':[]};var _0x3dabda=_[_0x9f48('0x2e')](db[_0x9f48('0x39')][_0x9f48('0x3a')],function(_0xeb8434){return{'name':_0xeb8434[_0x9f48('0x3b')],'type':_0xeb8434['type'][_0x9f48('0x3c')]};});_0x21d46f[_0x9f48('0x3d')]=_[_0x9f48('0x2e')](_0x3dabda,_0x9f48('0x2c'));_0x21d46f[_0x9f48('0x3e')]=_[_0x9f48('0x3f')](_0x3c4d16[_0x9f48('0x3e')]);_0x21d46f[_0x9f48('0x40')]=_[_0x9f48('0x41')](_0x21d46f[_0x9f48('0x3d')],_0x21d46f[_0x9f48('0x3e')]);_0x33f3c4[_0x9f48('0x42')]=_[_0x9f48('0x41')](_0x21d46f[_0x9f48('0x3d')],qs[_0x9f48('0x43')](_0x3c4d16[_0x9f48('0x3e')]['fields']));_0x33f3c4[_0x9f48('0x42')]=_0x33f3c4[_0x9f48('0x42')][_0x9f48('0x44')]?_0x33f3c4['attributes']:_0x21d46f[_0x9f48('0x3d')];if(!_0x3c4d16[_0x9f48('0x3e')][_0x9f48('0x45')](_0x9f48('0x46'))){_0x33f3c4[_0x9f48('0x22')]=qs[_0x9f48('0x22')](_0x3c4d16['query'][_0x9f48('0x22')]);_0x33f3c4['offset']=qs['offset'](_0x3c4d16[_0x9f48('0x3e')][_0x9f48('0x21')]);}_0x33f3c4[_0x9f48('0x47')]=qs[_0x9f48('0x48')](_0x3c4d16[_0x9f48('0x3e')][_0x9f48('0x48')]);_0x33f3c4[_0x9f48('0x49')]=qs[_0x9f48('0x40')](_[_0x9f48('0x4a')](_0x3c4d16[_0x9f48('0x3e')],_0x21d46f['filters']));var _0x7f1c17=[];var _0xa6351e=squel[_0x9f48('0x4b')]()[_0x9f48('0x4c')]('id')['field']('name')[_0x9f48('0x4c')](_0x9f48('0x4d'))['from'](_0x9f48('0x4e'));var _0x564128=squel['select']()[_0x9f48('0x4c')]('u.id')['field'](_0x9f48('0x4f'))['field'](_0x9f48('0x50'))[_0x9f48('0x51')]('user_has_mail_interactions','ui')[_0x9f48('0x52')]('users','u','u.id\x20=\x20ui.UserId');var _0xdb38d4=squel['select']()['from']('mail_interactions','i')[_0x9f48('0x52')](_0x9f48('0x53'),'c',_0x9f48('0x54'))[_0x9f48('0x52')](_0x9f48('0x55'),'o','o.id\x20=\x20i.UserId')[_0x9f48('0x52')](_0x9f48('0x56'),'a',_0x9f48('0x57'))['left_join'](_0x9f48('0x58'),'me',_0x9f48('0x59'))['left_join'](_0x9f48('0x5a'),'it',_0x9f48('0x5b'))[_0x9f48('0x52')](_0x9f48('0x4e'),'t','t.id\x20=\x20it.TagId');var _0x542113=squel[_0x9f48('0x5c')]();var _0x235830=[];var _0x28f965=squel['expr']();var _0x145c17;if(_0x3c4d16[_0x9f48('0x3e')][_0x9f48('0x5d')]){_0x145c17=as[_0x9f48('0x5e')](_0x3c4d16['query'][_0x9f48('0x5d')]);var _0x17d030=_0x145c17[_0x9f48('0x5f')];for(var _0x16bf15=0x0;_0x16bf15<_0x145c17[_0x9f48('0x60')][_0x9f48('0x44')];_0x16bf15++){var _0x5d2f06=_0x145c17[_0x9f48('0x60')][_0x16bf15];var _0xaa708e='i';var _0x155515=_[_0x9f48('0x61')](_0x3dabda,[_0x9f48('0x2c'),_0x5d2f06[_0x9f48('0x4c')]]);if(!_0x155515){switch(_0x5d2f06['field']){case _0x9f48('0x62'):if(_0x5d2f06[_0x9f48('0x63')]==0x1){_0xdb38d4['having']('`'+_0x5d2f06[_0x9f48('0x4c')]+'`\x20=\x200');}else{_0xdb38d4[_0x9f48('0x64')]('`'+_0x5d2f06[_0x9f48('0x4c')]+_0x9f48('0x65'));}break;case _0x9f48('0x66'):if(_0x5d2f06['operator']===_0x9f48('0x67')){if(_0x5d2f06[_0x9f48('0x63')][_0x9f48('0x68')]('\x20')[_0x9f48('0x44')]>0x1){_0x542113[_0x17d030](_0x9f48('0x69'),qs[_0x9f48('0x6a')](_0x5d2f06[_0x9f48('0x63')]),null);}else{var _0x4b237d='%'+_0x5d2f06[_0x9f48('0x63')]+'%';_0x542113[_0x17d030](_0x9f48('0x6b'),_0x4b237d,_0x4b237d,_0x4b237d);}}else{_0x155515=_[_0x9f48('0x61')](_0x3dabda,['name',_0x9f48('0x6c')]);_0x5d2f06[_0x9f48('0x4c')]=_0x9f48('0x6c');_0x39c7bc=as['buildExpression'](_0xaa708e,_0x155515[_0x9f48('0x6d')],_0x5d2f06);_0x542113[_0x17d030](_0x39c7bc[_0x9f48('0x6e')],_0x39c7bc[_0x9f48('0x63')][_0x9f48('0x6f')],_0x39c7bc['value'][_0x9f48('0x1d')]);}break;case _0x9f48('0x70'):var _0x3a60cc=_0x5d2f06[_0x9f48('0x63')][_0x9f48('0x68')](',')[_0x9f48('0x2e')](function(_0x4c65d7){return Number(_0x4c65d7);});_0x3a60cc[_0x9f48('0x31')](function(_0x7ed951){_0x28f965['or'](_0x9f48('0x71'),'%,'+_0x7ed951+',%');});_0x235830=_[_0x9f48('0x72')](_0x235830,_0x3a60cc);break;case'User':if(_0x5d2f06[_0x9f48('0x73')]===_0x9f48('0x67')){_0x542113[_0x17d030]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x5d2f06[_0x9f48('0x63')]+'%',null);}else{_0x155515=_[_0x9f48('0x61')](_0x3dabda,['name',_0x9f48('0x74')]);_0x5d2f06[_0x9f48('0x4c')]=_0x9f48('0x74');_0x39c7bc=as[_0x9f48('0x75')](_0xaa708e,_0x155515['type'],_0x5d2f06);_0x542113[_0x17d030](_0x39c7bc[_0x9f48('0x6e')],_0x39c7bc[_0x9f48('0x63')][_0x9f48('0x6f')],_0x39c7bc[_0x9f48('0x63')]['end']);}break;case'plainBody':_0x39c7bc=as['buildExpression']('me',null,_0x5d2f06);_0x542113[_0x17d030](_0x39c7bc['text'],_0x39c7bc[_0x9f48('0x63')][_0x9f48('0x6f')],_0x39c7bc[_0x9f48('0x63')]['end']);break;}}else{var _0x39c7bc=as['buildExpression'](_0xaa708e,_0x155515['type'],_0x5d2f06);_0x542113[_0x17d030](_0x39c7bc[_0x9f48('0x6e')],_0x39c7bc[_0x9f48('0x63')]['start'],_0x39c7bc['value'][_0x9f48('0x1d')]);}}}else{var _0x1a7a16=_(_0x3c4d16['query'])[_0x9f48('0x3f')]()[_0x9f48('0x2e')](function(_0xd0482e){return _[_0x9f48('0x76')](_0x3dabda,[_0x9f48('0x2c'),_0xd0482e])?_0xd0482e:undefined;})['compact']()[_0x9f48('0x63')]();if(!_['isEmpty'](_0x1a7a16)){_0x1a7a16[_0x9f48('0x31')](function(_0x409ace){if(_0x409ace===_0x9f48('0x77')){_0xdb38d4[_0x9f48('0x49')]('i.MailAccountId\x20IN\x20?',[][_0x9f48('0x78')](_0x3c4d16['query'][_0x409ace]));}else if(_0x409ace===_0x9f48('0x79')){var _0x558fc9=JSON[_0x9f48('0x7a')](_0x3c4d16[_0x9f48('0x3e')][_0x409ace])[_0x9f48('0x7b')];var _0x51f7bc=JSON[_0x9f48('0x7a')](_0x3c4d16['query'][_0x409ace])[_0x9f48('0x7c')];_0xdb38d4['where'](_0x9f48('0x7d'),_0x558fc9,_0x51f7bc);}else{if(_0x3c4d16[_0x9f48('0x3e')][_0x409ace]==='null'){_0xdb38d4[_0x9f48('0x49')]('i.'+_0x409ace+_0x9f48('0x7e'));}else{_0xdb38d4[_0x9f48('0x49')]('i.'+_0x409ace+'\x20=\x20?',_0x3c4d16[_0x9f48('0x3e')][_0x409ace]);}}});}if(_0x3c4d16[_0x9f48('0x3e')][_0x9f48('0x7f')]){if(_0x3c4d16[_0x9f48('0x3e')][_0x9f48('0x7f')]==0x1){_0xdb38d4[_0x9f48('0x64')]('`unreadMessages`\x20=\x200');}else{_0xdb38d4[_0x9f48('0x64')](_0x9f48('0x80'));}}if(_0x3c4d16[_0x9f48('0x3e')]['tag']){_0x235830=_['isArray'](_0x3c4d16['query'][_0x9f48('0x81')])?_0x3c4d16[_0x9f48('0x3e')][_0x9f48('0x81')]:new Array(_0x3c4d16['query'][_0x9f48('0x81')]);_0x235830[_0x9f48('0x31')](function(_0x29fd48){_0x28f965['or'](_0x9f48('0x71'),'%,'+_0x29fd48+',%');});}if(_0x3c4d16['query'][_0x9f48('0x82')]){var _0x10b5e3=_0x3c4d16['query']['filter']['replace']('\x5c','\x5c\x5c')[_0x9f48('0x83')]('\x27\x27',_0x9f48('0x84'));if(qs['isNumeric'](_0x10b5e3)){_0x542113['or']('i.id\x20LIKE\x20?',_0x10b5e3+'%');}else if(qs[_0x9f48('0x85')](_0x10b5e3)){_0x542113['or'](_0x9f48('0x86'),_0x10b5e3+'%');}else{_0x542113['or'](_0x9f48('0x87'),qs[_0x9f48('0x6a')](_0x10b5e3))['or'](_0x9f48('0x88'),qs[_0x9f48('0x6a')](_0x10b5e3));}}}_0xdb38d4[_0x9f48('0x49')](_0x542113);_0xdb38d4[_0x9f48('0x89')]('i.id');var _0x3e10ba={'type':db[_0x9f48('0x8a')][_0x9f48('0x8b')][_0x9f48('0x8c')],'raw':!![]};var _0x4b275b=_0xdb38d4[_0x9f48('0x8d')]();_0x4b275b[_0x9f48('0x4c')](_0x9f48('0x8e'));_0x4b275b[_0x9f48('0x4c')](_0x9f48('0x8f'),'unreadMessages');if(_0x33f3c4['order']){_0x33f3c4[_0x9f48('0x47')][_0x9f48('0x31')](function(_0x1e1f00){_0xdb38d4[_0x9f48('0x47')]('i.'+_0x1e1f00[0x0],_0x1e1f00[0x1]===_0x9f48('0x90')?![]:!![]);});}if(!_[_0x9f48('0x91')](_0x235830)){_0xdb38d4[_0x9f48('0x64')](_0x28f965);_0x4b275b[_0x9f48('0x49')](_0x9f48('0x92'),_0x235830);}BPromise[_0x9f48('0x93')]()[_0x9f48('0x29')](function(){if(!_0x145c17){if(_0x3c4d16[_0x9f48('0x3e')][_0x9f48('0x77')]||_0x3c4d16[_0x9f48('0x3e')][_0x9f48('0x94')])return;_0x4b275b[_0x9f48('0x49')](_0x9f48('0x95'));_0xdb38d4['where'](_0x9f48('0x95'));return;}return _0x3c4d16[_0x9f48('0x96')][_0x9f48('0x97')]({'attributes':['id'],'raw':!![]})[_0x9f48('0x29')](function(_0x4105de){if(_['isEmpty'](_0x4105de)){_0x4b275b[_0x9f48('0x49')]('i.MailAccountId\x20IS\x20NULL');_0xdb38d4[_0x9f48('0x49')](_0x9f48('0x98'));}else{_0x4b275b[_0x9f48('0x49')](_0x9f48('0x99'),_[_0x9f48('0x2e')](_0x4105de,'id'));_0xdb38d4[_0x9f48('0x49')](_0x9f48('0x99'),_[_0x9f48('0x2e')](_0x4105de,'id'));}});})[_0x9f48('0x29')](function(){db[_0x9f48('0x9a')][_0x9f48('0x3e')](_0x4b275b[_0x9f48('0x9b')](),_0x3e10ba)['then'](function(_0x4f9f20){_0x133169[_0x9f48('0x20')]=_0x4f9f20[_0x9f48('0x44')];if(_0x133169[_0x9f48('0x20')]===0x0)return[];return db[_0x9f48('0x9a')][_0x9f48('0x3e')](_0xa6351e[_0x9f48('0x9b')](),_0x3e10ba)[_0x9f48('0x29')](function(_0x4cda62){_0x7f1c17=_[_0x9f48('0x9c')](_0x4cda62,'id');_0x3e10ba=_[_0x9f48('0x9d')](_0x3e10ba,{'model':db[_0x9f48('0x39')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3c4d16[_0x9f48('0x3e')][_0x9f48('0x43')]){_0x33f3c4[_0x9f48('0x42')]['forEach'](function(_0x5d547e){_0xdb38d4[_0x9f48('0x4c')]('i.'+_0x5d547e);});}else{_0xdb38d4['field'](_0x9f48('0x8f'),_0x9f48('0x62'));_0xdb38d4[_0x9f48('0x4c')](_0x9f48('0x9e'),_0x9f48('0x9f'));_0xdb38d4[_0x9f48('0x4c')]('a.mandatoryDisposition',_0x9f48('0xa0'));_0xdb38d4[_0x9f48('0x4c')](_0x9f48('0x8e'));_0xdb38d4[_0x9f48('0x4c')](_0x9f48('0xa1'));_0xdb38d4['field'](_0x9f48('0xa2'));_0xdb38d4[_0x9f48('0x4c')](_0x9f48('0xa3'));_0xdb38d4[_0x9f48('0x4c')]('i.closedAt');_0xdb38d4[_0x9f48('0x4c')](_0x9f48('0xa4'));_0xdb38d4[_0x9f48('0x4c')](_0x9f48('0xa5'));_0xdb38d4[_0x9f48('0x4c')](_0x9f48('0xa6'));_0xdb38d4[_0x9f48('0x4c')](_0x9f48('0xa7'));_0xdb38d4[_0x9f48('0x4c')]('i.disposition');_0xdb38d4['field'](_0x9f48('0xa8'));_0xdb38d4[_0x9f48('0x4c')](_0x9f48('0xa9'));_0xdb38d4[_0x9f48('0x4c')](_0x9f48('0xaa'));_0xdb38d4[_0x9f48('0x4c')](_0x9f48('0xab'));_0xdb38d4[_0x9f48('0x4c')](_0x9f48('0xac'));_0xdb38d4['field'](_0x9f48('0xad'),_0x9f48('0xae'));_0xdb38d4['field'](_0x9f48('0xaf'),_0x9f48('0xb0'));_0xdb38d4[_0x9f48('0x4c')](_0x9f48('0xb1'),_0x9f48('0xb2'));_0xdb38d4[_0x9f48('0x4c')](_0x9f48('0xb3'),_0x9f48('0xb4'));_0xdb38d4[_0x9f48('0x4c')](_0x9f48('0xb5'),_0x9f48('0xb6'));_0xdb38d4[_0x9f48('0x4c')](_0x9f48('0xb7'),_0x9f48('0xb8'));_0xdb38d4[_0x9f48('0x4c')]('o.fullname',_0x9f48('0xb9'));_0xdb38d4[_0x9f48('0x4c')](_0x9f48('0xba'),_0x9f48('0xbb'));_0xdb38d4['field'](_0x9f48('0xbc'),_0x9f48('0x2f'));}_0xdb38d4[_0x9f48('0x22')](_0x33f3c4['limit']);_0xdb38d4[_0x9f48('0x21')](_0x33f3c4[_0x9f48('0x21')]);return db[_0x9f48('0x9a')][_0x9f48('0x3e')](_0xdb38d4['toString'](),_0x3e10ba);})[_0x9f48('0x29')](function(_0x488f8a){_0x564128[_0x9f48('0x49')](_0x9f48('0xbd'),_[_0x9f48('0x2e')](_0x488f8a,'id'));return db[_0x9f48('0x9a')][_0x9f48('0x3e')](_0x564128[_0x9f48('0x9b')](),_0x3e10ba)[_0x9f48('0x29')](function(_0x1a0c86){var _0x58a3c6=_[_0x9f48('0xbe')](_0x1a0c86,_0x9f48('0xbf'));var _0x60c7f2=[];return db[_0x9f48('0xc0')][_0x9f48('0x33')]({'attributes':[_0x9f48('0xc1')],'raw':!![]})[_0x9f48('0x29')](function(_0x5db1af){var _0x43e692=_0x5db1af[_0x9f48('0xc1')];_0x488f8a[_0x9f48('0x31')](function(_0x2d8e64){_0x60c7f2[_0x9f48('0x32')](updateMailInteraction(_0x2d8e64,_0x7f1c17,_0x58a3c6,_0x43e692));});return BPromise[_0x9f48('0xc2')](_0x60c7f2);});});});})[_0x9f48('0x29')](function(_0x272847){_0x133169[_0x9f48('0xc3')]=_0x272847;return _0x133169;})[_0x9f48('0x29')](respondWithFilteredResult(_0x3c76b8,_0x33f3c4));})['catch'](handleError(_0x3c76b8,null));};exports[_0x9f48('0xc4')]=function(_0x391275,_0x24eb39){var _0x12398d={'raw':![],'where':{'id':_0x391275['params']['id']}},_0x1276f0={};_0x1276f0['model']=_['keys'](db[_0x9f48('0x39')][_0x9f48('0x3a')]);_0x1276f0[_0x9f48('0x3e')]=_[_0x9f48('0x3f')](_0x391275[_0x9f48('0x3e')]);_0x1276f0[_0x9f48('0x40')]=_[_0x9f48('0x41')](_0x1276f0[_0x9f48('0x3d')],_0x1276f0[_0x9f48('0x3e')]);_0x12398d[_0x9f48('0x42')]=_[_0x9f48('0x41')](_0x1276f0[_0x9f48('0x3d')],qs[_0x9f48('0x43')](_0x391275['query'][_0x9f48('0x43')]));_0x12398d['attributes']=_0x12398d[_0x9f48('0x42')][_0x9f48('0x44')]?_0x12398d[_0x9f48('0x42')]:_0x1276f0[_0x9f48('0x3d')];if(_0x391275[_0x9f48('0x3e')][_0x9f48('0xc5')]){_0x12398d[_0x9f48('0xc6')]=[{'all':!![]}];}_0x12398d=_['merge']({},_0x12398d,_0x391275[_0x9f48('0xc7')]);return db[_0x9f48('0x39')][_0x9f48('0x61')](_0x12398d)[_0x9f48('0x29')](handleEntityNotFound(_0x24eb39,null))[_0x9f48('0x29')](respondWithResult(_0x24eb39,null))[_0x9f48('0x37')](handleError(_0x24eb39,null));};exports[_0x9f48('0xc8')]=function(_0x970c11,_0x399ae8){return db[_0x9f48('0x39')]['create'](_0x970c11['body'],{})[_0x9f48('0x29')](respondWithResult(_0x399ae8,0xc9))[_0x9f48('0x37')](handleError(_0x399ae8,null));};exports['update']=function(_0x2780af,_0xa3a082){if(_0x2780af['body']['id']){delete _0x2780af[_0x9f48('0xc9')]['id'];}return db[_0x9f48('0x39')][_0x9f48('0x61')]({'where':{'id':_0x2780af[_0x9f48('0xca')]['id']}})[_0x9f48('0x29')](handleEntityNotFound(_0xa3a082,null))[_0x9f48('0x29')](saveUpdates(_0x2780af['body'],null))['then'](respondWithResult(_0xa3a082,null))[_0x9f48('0x37')](handleError(_0xa3a082,null));};exports['destroy']=function(_0x5247f2,_0x329fd1){return db[_0x9f48('0x39')]['find']({'where':{'id':_0x5247f2['params']['id']}})[_0x9f48('0x29')](handleEntityNotFound(_0x329fd1,null))['then'](removeEntity(_0x329fd1,null))[_0x9f48('0x37')](handleError(_0x329fd1,null));};exports['describe']=function(_0x5a096c,_0x2512c){return db['MailInteraction'][_0x9f48('0xcb')]()[_0x9f48('0x29')](respondWithResult(_0x2512c,null))[_0x9f48('0x37')](handleError(_0x2512c,null));};exports[_0x9f48('0xcc')]=function(_0x3e69a0,_0x4b35c3,_0x441c71){return db[_0x9f48('0xcd')][_0x9f48('0x61')]({'where':{'id':_0x3e69a0['params']['id']}})[_0x9f48('0x29')](handleEntityNotFound(_0x4b35c3,null))[_0x9f48('0x29')](function(_0x3ae44a){if(_0x3ae44a){return _0x3ae44a['addMessage'](_0x3e69a0[_0x9f48('0xc9')]['ids'],_[_0x9f48('0xce')](_0x3e69a0['body'],[_0x9f48('0xcf'),'id'])||{});}})['then'](respondWithResult(_0x4b35c3,null))[_0x9f48('0x37')](handleError(_0x4b35c3,null));};exports[_0x9f48('0xd0')]=function(_0x4aa5ca,_0x14e7fd,_0xf7029b){var _0x55160b={'raw':![],'where':{}};var _0x27d036={};var _0x16acbe={'count':0x0,'rows':[]};return db[_0x9f48('0x39')][_0x9f48('0x33')]({'where':{'id':_0x4aa5ca[_0x9f48('0xca')]['id']}})['then'](handleEntityNotFound(_0x14e7fd,null))[_0x9f48('0x29')](function(_0x2691e1){if(_0x2691e1){_0x27d036[_0x9f48('0x3d')]=_[_0x9f48('0x3f')](db[_0x9f48('0xcd')][_0x9f48('0x3a')]);_0x27d036['query']=_[_0x9f48('0x3f')](_0x4aa5ca[_0x9f48('0x3e')]);_0x27d036[_0x9f48('0x40')]=_[_0x9f48('0x41')](_0x27d036[_0x9f48('0x3d')],_0x27d036[_0x9f48('0x3e')]);_0x55160b[_0x9f48('0x42')]=_[_0x9f48('0x41')](_0x27d036[_0x9f48('0x3d')],qs['fields'](_0x4aa5ca[_0x9f48('0x3e')][_0x9f48('0x43')]));_0x55160b['attributes']=_0x55160b['attributes'][_0x9f48('0x44')]?_0x55160b[_0x9f48('0x42')]:_0x27d036['model'];if(!_0x4aa5ca[_0x9f48('0x3e')]['hasOwnProperty'](_0x9f48('0x46'))){_0x55160b[_0x9f48('0x22')]=qs['limit'](_0x4aa5ca[_0x9f48('0x3e')][_0x9f48('0x22')]);_0x55160b[_0x9f48('0x21')]=qs[_0x9f48('0x21')](_0x4aa5ca[_0x9f48('0x3e')][_0x9f48('0x21')]);}_0x55160b[_0x9f48('0x47')]=qs['sort'](_0x4aa5ca[_0x9f48('0x3e')]['sort']);_0x55160b[_0x9f48('0x49')]=qs[_0x9f48('0x40')](_[_0x9f48('0x4a')](_0x4aa5ca['query'],_0x27d036[_0x9f48('0x40')]));_0x55160b[_0x9f48('0x49')][_0x9f48('0xbf')]=_0x2691e1['id'];if(_0x4aa5ca[_0x9f48('0x3e')][_0x9f48('0x82')]){_0x55160b[_0x9f48('0x49')]=_[_0x9f48('0x9d')](_0x55160b['where'],{'$or':_[_0x9f48('0x2e')](_0x55160b[_0x9f48('0x42')],function(_0x4898d3){var _0x8e20c5={};_0x8e20c5[_0x4898d3]={'$like':'%'+_0x4aa5ca['query'][_0x9f48('0x82')]+'%'};return _0x8e20c5;})});}if(_0x4aa5ca['query']['$gte']){var _0x3233fb=_0x4aa5ca[_0x9f48('0x3e')]['$gte']['split'](',');var _0x18703a={};_0x18703a[_0x3233fb[0x0]]={'$gte':moment(_0x3233fb[0x1])[_0x9f48('0xd1')]('YYYY-MM-DD\x20HH:mm:ss')};_0x55160b[_0x9f48('0x49')]=_[_0x9f48('0x9d')](_0x55160b['where'],_0x18703a);}_0x55160b=_[_0x9f48('0x9d')]({},_0x55160b,_0x4aa5ca[_0x9f48('0xc7')]);return db[_0x9f48('0xcd')][_0x9f48('0x20')]({'where':_0x55160b[_0x9f48('0x49')]})[_0x9f48('0x29')](function(_0x285719){_0x16acbe['count']=_0x285719;if(_0x4aa5ca[_0x9f48('0x3e')][_0x9f48('0xc5')]){_0x55160b[_0x9f48('0xc6')]=[{'all':!![]}];}return db[_0x9f48('0xcd')][_0x9f48('0xd2')](_0x55160b);})[_0x9f48('0x29')](function(_0x46c001){_0x16acbe['rows']=_0x46c001;return _0x16acbe;});}})['then'](respondWithFilteredResult(_0x14e7fd,_0x55160b))[_0x9f48('0x37')](handleError(_0x14e7fd,null));};exports[_0x9f48('0xd3')]=function(_0x519a88,_0x271f6a,_0x2963f9){return db[_0x9f48('0x39')][_0x9f48('0x61')]({'where':{'id':_0x519a88[_0x9f48('0xca')]['id']}})[_0x9f48('0x29')](handleEntityNotFound(_0x271f6a,null))[_0x9f48('0x29')](function(_0xdfefe8){if(_0xdfefe8){return _0xdfefe8['setTags'](_0x519a88[_0x9f48('0xc9')][_0x9f48('0xcf')],_[_0x9f48('0xce')](_0x519a88[_0x9f48('0xc9')],['ids','id'])||{})[_0x9f48('0xd4')](function(){return db[_0x9f48('0x70')][_0x9f48('0xd2')]({'attributes':['id','name',_0x9f48('0x4d')],'where':{'id':_0x519a88[_0x9f48('0xc9')][_0x9f48('0xcf')]}});})[_0x9f48('0x29')](function(_0x3ce9c1){socket['emit']('mailInteractionTags:save',{'id':Number(_0x519a88[_0x9f48('0xca')]['id']),'tags':_0x3ce9c1||[]});return{'id':Number(_0x519a88[_0x9f48('0xca')]['id']),'tags':_0x3ce9c1||[]};});}})[_0x9f48('0x29')](respondWithResult(_0x271f6a,null))['catch'](handleError(_0x271f6a,null));};exports[_0x9f48('0xd5')]=function(_0xfae03,_0x1b511c,_0x102f6e){return db[_0x9f48('0x39')]['find']({'where':{'id':_0xfae03['params']['id']}})[_0x9f48('0x29')](handleEntityNotFound(_0x1b511c,null))[_0x9f48('0x29')](function(_0x4dace4){if(_0x4dace4){return _0x4dace4[_0x9f48('0xd5')](_0xfae03[_0x9f48('0x3e')][_0x9f48('0xcf')]);}})['then'](respondWithStatusCode(_0x1b511c,null))['catch'](handleError(_0x1b511c,null));};exports[_0x9f48('0xd6')]=function(_0x4617d5,_0x466475){var _0x88fca5=moment()[_0x9f48('0xd7')]()[_0x9f48('0x9b')]();var _0x545e6c=path[_0x9f48('0xd8')](config[_0x9f48('0xd9')],_0x9f48('0xda'),_0x9f48('0xdb'),'tmp');var _0x3f6893=path[_0x9f48('0xd8')](config[_0x9f48('0xd9')],_0x9f48('0xda'),'files',_0x9f48('0xdc'));var _0x412ee4=path[_0x9f48('0xd8')](_0x545e6c,_0x88fca5);var _0x2699bc=util[_0x9f48('0xd1')]('transcript-%d-%s.zip',_0x4617d5['params']['id'],_0x88fca5);var _0x42ecb9=path[_0x9f48('0xd8')](_0x545e6c,_0x2699bc);var _0x5a690f=[];if(_0x4617d5[_0x9f48('0x3e')]['attachments']){_0x5a690f[_0x9f48('0x32')]({'model':db[_0x9f48('0xdd')],'as':_0x9f48('0xde'),'raw':!![]});}var _0x38e67c=[{'model':db['MailMessage'],'as':_0x9f48('0xdf'),'attributes':['id',_0x9f48('0xc9'),'from','to','cc','bcc',_0x9f48('0xe0'),_0x9f48('0x79')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x5a690f}];return db[_0x9f48('0x39')]['find']({'where':{'id':_0x4617d5[_0x9f48('0xca')]['id']},'include':_0x38e67c})[_0x9f48('0x29')](handleEntityNotFound(_0x466475,null))[_0x9f48('0x29')](function(_0x600cd2){if(_0x600cd2&&_0x600cd2[_0x9f48('0xdf')]){var _0x26bec1=_0x600cd2[_0x9f48('0xe1')]({'plain':!![]});fs[_0x9f48('0xe2')](_0x412ee4);return BPromise['each'](_0x26bec1['Messages'],function(_0x370729,_0x1e3957){var _0x351858={'from':_0x370729[_0x9f48('0x51')],'to':_0x370729['to'],'subject':_0x370729[_0x9f48('0xe0')],'html':_0x370729[_0x9f48('0xc9')],'headers':{'Date':moment(_0x370729[_0x9f48('0x79')])['format'](_0x9f48('0xe3'))},'attachments':[]};if(_0x370729['cc']){_0x351858[_0x9f48('0xe4')]['Cc']=_0x370729['cc'];}if(_0x370729[_0x9f48('0xe5')]){_0x351858[_0x9f48('0xe4')][_0x9f48('0xe6')]=_0x370729[_0x9f48('0xe5')];}return new BPromise(function(_0x3c7365,_0x173846){if(_0x370729[_0x9f48('0xde')]){for(var _0xf801da=0x0;_0xf801da<_0x370729['Attachments'][_0x9f48('0x44')];_0xf801da++){var _0x225b17=_0x370729[_0x9f48('0xde')][_0xf801da];var _0x4b3550=path['join'](_0x3f6893,_0x225b17[_0x9f48('0xe7')]);if(fs['existsSync'](_0x4b3550)){_0x351858[_0x9f48('0xdc')]['push']({'name':_0x225b17[_0x9f48('0x2c')],'contentType':_0x225b17[_0x9f48('0x6d')],'data':fs[_0x9f48('0xe8')](_0x4b3550)});}}}emlformat[_0x9f48('0xe9')](_0x351858,function(_0x1d2970,_0x2d8ee2){if(_0x1d2970)return _0x173846(_0x1d2970);fs['writeFileSync'](path[_0x9f48('0xd8')](_0x412ee4,util['format'](_0x9f48('0xea'),_0x1e3957)),_0x2d8ee2);return _0x3c7365(_0x2d8ee2);});});})[_0x9f48('0x29')](function(){return new BPromise(function(_0x5e9c26,_0x2845e1){zipdir(_0x412ee4,{'saveTo':_0x42ecb9},function(_0xc02a87,_0x1d755e){if(_0xc02a87)return _0x2845e1(_0xc02a87);return _0x5e9c26(_0x1d755e);});})[_0x9f48('0x29')](function(){return new BPromise(function(_0x487c99,_0x39a442){rimraf(_0x412ee4,function(_0x13e934){if(_0x13e934)_0x39a442(_0x13e934);return _0x487c99();});});})[_0x9f48('0x29')](function(){return _0x466475[_0x9f48('0xd6')](_0x42ecb9,_0x2699bc,function(_0x24e784){if(_0x24e784){console[_0x9f48('0xeb')](_0x9f48('0xec'),_0x24e784);}else{fs['unlinkSync'](_0x42ecb9);}});});});}else{return _0x466475[_0x9f48('0x2a')](0xc8);}})[_0x9f48('0x37')](handleError(_0x466475,null));}; \ No newline at end of file +var _0x4024=['model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','ui.MailInteractionId','user_has_mail_interactions','left_join','u.id\x20=\x20ui.UserId','mail_interactions','a.id\x20=\x20i.MailAccountId','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','unreadMessages','having','`\x20=\x200','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','find','ContactId','buildExpression','text','start','Tag','split','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','plainBody','keys','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','\x27\x27\x27\x27','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','i.MailAccountId\x20IS\x20NOT\x20NULL','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.lastMsgAt','i.subject','i.disposition','i.to','i.ContactId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.MailInteractionId\x20IN\x20?','groupBy','Setting','enableEmailPreview','show','params','includeAll','include','options','body','destroy','describe','addMessage','MailMessage','ids','omit','getMessages','hasOwnProperty','MailInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','spread','mailInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','transcript-%d-%s.zip','attachments','Attachment','Attachments','Messages','bcc','subject','get','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','existsSync','writeFileSync','log','err','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','redis','defaults','localhost','./mailInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','error','stack','name','send','Users','map','fullname','TagIds','forEach','Tags','push','MailInteraction','findOne','lastMsgBody','lastMsgText','trimStart','fromString','catch','index','rawAttributes','fieldName','type','key'];(function(_0x3ff92d,_0x288286){var _0x2b7fd8=function(_0x349b4c){while(--_0x349b4c){_0x3ff92d['push'](_0x3ff92d['shift']());}};_0x2b7fd8(++_0x288286);}(_0x4024,0xa9));var _0x4402=function(_0x2119bf,_0x1580c8){_0x2119bf=_0x2119bf-0x0;var _0x3f049b=_0x4024[_0x2119bf];return _0x3f049b;};'use strict';var pdf=require(_0x4402('0x0'));var emlformat=require(_0x4402('0x1'));var rimraf=require(_0x4402('0x2'));var zipdir=require(_0x4402('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4402('0x4'));var Mustache=require(_0x4402('0x5'));var util=require(_0x4402('0x6'));var path=require(_0x4402('0x7'));var sox=require(_0x4402('0x8'));var csv=require(_0x4402('0x9'));var ejs=require(_0x4402('0xa'));var fs=require('fs');var _=require(_0x4402('0xb'));var squel=require(_0x4402('0xc'));var crypto=require(_0x4402('0xd'));var jsforce=require(_0x4402('0xe'));var deskjs=require(_0x4402('0xf'));var toCsv=require(_0x4402('0x9'));var querystring=require(_0x4402('0x10'));var Papa=require(_0x4402('0x11'));var htmlToText=require('html-to-text');var Redis=require('ioredis');var authService=require(_0x4402('0x12'));var qs=require(_0x4402('0x13'));var as=require(_0x4402('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4402('0x15'))(_0x4402('0x16'));var utils=require('../../config/utils');var config=require(_0x4402('0x17'));var db=require('../../mysqldb')['db'];config[_0x4402('0x18')]=_[_0x4402('0x19')](config['redis'],{'host':_0x4402('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4402('0x1b'))[_0x4402('0x1c')](socket);function respondWithStatusCode(_0x216fd3,_0x4f247f){_0x4f247f=_0x4f247f||0xcc;return function(_0x153506){if(_0x153506){return _0x216fd3[_0x4402('0x1d')](_0x4f247f);}return _0x216fd3[_0x4402('0x1e')](_0x4f247f)[_0x4402('0x1f')]();};}function respondWithResult(_0x2b58df,_0x1f6209){_0x1f6209=_0x1f6209||0xc8;return function(_0x36f425){if(_0x36f425){return _0x2b58df[_0x4402('0x1e')](_0x1f6209)[_0x4402('0x20')](_0x36f425);}};}function respondWithFilteredResult(_0x1e950f,_0x4c75fd){return function(_0x571f6c){if(_0x571f6c){var _0x18856f=_0x571f6c[_0x4402('0x21')],_0x34e38f=_0x4c75fd[_0x4402('0x22')],_0x106a2e=_0x4c75fd[_0x4402('0x22')]+_0x4c75fd[_0x4402('0x23')],_0xf0a307;if(_0x106a2e>=_0x18856f){_0x106a2e=_0x18856f;_0xf0a307=0xc8;}else{_0xf0a307=0xce;}_0x1e950f[_0x4402('0x1e')](_0xf0a307);return _0x1e950f[_0x4402('0x24')](_0x4402('0x25'),_0x34e38f+'-'+_0x106a2e+'/'+_0x18856f)[_0x4402('0x20')](_0x571f6c);}return null;};}function patchUpdates(_0x9a86bd){return function(_0xfe37d9){try{jsonpatch['apply'](_0xfe37d9,_0x9a86bd,!![]);}catch(_0x5b77af){return BPromise[_0x4402('0x26')](_0x5b77af);}return _0xfe37d9[_0x4402('0x27')]();};}function saveUpdates(_0x43a433,_0x300bf5){return function(_0x33819b){if(_0x33819b){return _0x33819b[_0x4402('0x28')](_0x43a433)[_0x4402('0x29')](function(_0x532a66){return _0x532a66;});}return null;};}function removeEntity(_0x52cde9,_0x15b74f){return function(_0x591bd8){if(_0x591bd8){return _0x591bd8['destroy']()[_0x4402('0x29')](function(){_0x52cde9[_0x4402('0x1e')](0xcc)[_0x4402('0x1f')]();});}};}function handleEntityNotFound(_0x3dde6a,_0x283c9b){return function(_0xef452d){if(!_0xef452d){_0x3dde6a[_0x4402('0x1d')](0x194);}return _0xef452d;};}function handleError(_0x3c87f8,_0x31c688){_0x31c688=_0x31c688||0x1f4;return function(_0x44b1){logger[_0x4402('0x2a')](_0x44b1[_0x4402('0x2b')]);if(_0x44b1[_0x4402('0x2c')]){delete _0x44b1[_0x4402('0x2c')];}_0x3c87f8[_0x4402('0x1e')](_0x31c688)[_0x4402('0x2d')](_0x44b1);};}function getInteractionUsers(_0x2930a4,_0x381ae6){return new BPromise(function(_0x18bda0,_0x4467f7){try{if(_0x381ae6[_0x2930a4['id']]){_0x2930a4[_0x4402('0x2e')]=_[_0x4402('0x2f')](_0x381ae6[_0x2930a4['id']],function(_0x75141e){return{'id':_0x75141e['id'],'fullname':_0x75141e[_0x4402('0x30')]};});}}catch(_0x50d3d4){_0x4467f7(_0x50d3d4);}_0x18bda0(_0x2930a4);});}function getInteractionTags(_0xca9ca7,_0x2abb31){return new BPromise(function(_0x4d3eef,_0x2fcdaa){try{if(_0xca9ca7[_0x4402('0x31')]){_0xca9ca7['Tags']=[];_0xca9ca7['TagIds']['split'](',')[_0x4402('0x32')](function(_0xd42df0){_0xca9ca7[_0x4402('0x33')][_0x4402('0x34')](_0x2abb31[_0xd42df0]);});}delete _0xca9ca7[_0x4402('0x31')];}catch(_0x6ea8ef){_0x2fcdaa(_0x6ea8ef);}_0x4d3eef(_0xca9ca7);});}function getLastMessageText(_0x3e476c){return new BPromise(function(_0x397172,_0x437d3e){return db[_0x4402('0x35')][_0x4402('0x36')]({'where':{'id':_0x3e476c['id']},'attributes':[_0x4402('0x37'),_0x4402('0x38')],'raw':!![]})[_0x4402('0x29')](function(_0x53892a){if(!_0x53892a[_0x4402('0x38')]){_0x3e476c[_0x4402('0x38')]=_[_0x4402('0x39')](htmlToText[_0x4402('0x3a')](_0x53892a[_0x4402('0x37')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x3e476c[_0x4402('0x38')]=_0x53892a[_0x4402('0x38')];}_0x397172(_0x3e476c);})[_0x4402('0x3b')](function(_0x30c16c){_0x437d3e(_0x30c16c);});});}function updateMailInteraction(_0x4a5a37,_0x2499b2,_0x12167f,_0x1f47ee){return new BPromise(function(_0x4f2a5b,_0x35d4b4){return getInteractionUsers(_0x4a5a37,_0x12167f)[_0x4402('0x29')](function(_0x181403){return getInteractionTags(_0x181403,_0x2499b2);})[_0x4402('0x29')](function(_0x1d8b8b){if(_0x1f47ee){_0x4f2a5b(getLastMessageText(_0x1d8b8b));}else{_0x4f2a5b(_0x1d8b8b);}})[_0x4402('0x3b')](function(_0x53eb66){_0x35d4b4(_0x53eb66);});});}exports[_0x4402('0x3c')]=function(_0x133b77,_0x1fbfbf){var _0x431875={},_0x5b25b1={},_0x3c8c42={'count':0x0,'rows':[]};var _0x282cff=_['map'](db['MailInteraction'][_0x4402('0x3d')],function(_0x389b21){return{'name':_0x389b21[_0x4402('0x3e')],'type':_0x389b21[_0x4402('0x3f')][_0x4402('0x40')]};});_0x5b25b1[_0x4402('0x41')]=_[_0x4402('0x2f')](_0x282cff,'name');_0x5b25b1[_0x4402('0x42')]=_['keys'](_0x133b77[_0x4402('0x42')]);_0x5b25b1[_0x4402('0x43')]=_[_0x4402('0x44')](_0x5b25b1[_0x4402('0x41')],_0x5b25b1['query']);_0x431875[_0x4402('0x45')]=_['intersection'](_0x5b25b1[_0x4402('0x41')],qs[_0x4402('0x46')](_0x133b77[_0x4402('0x42')][_0x4402('0x46')]));_0x431875['attributes']=_0x431875['attributes'][_0x4402('0x47')]?_0x431875['attributes']:_0x5b25b1[_0x4402('0x41')];if(!_0x133b77[_0x4402('0x42')]['hasOwnProperty'](_0x4402('0x48'))){_0x431875['limit']=qs['limit'](_0x133b77[_0x4402('0x42')][_0x4402('0x23')]);_0x431875[_0x4402('0x22')]=qs[_0x4402('0x22')](_0x133b77['query'][_0x4402('0x22')]);}_0x431875[_0x4402('0x49')]=qs[_0x4402('0x4a')](_0x133b77[_0x4402('0x42')]['sort']);_0x431875[_0x4402('0x4b')]=qs[_0x4402('0x43')](_[_0x4402('0x4c')](_0x133b77['query'],_0x5b25b1[_0x4402('0x43')]));var _0x31871b=[];var _0x365880=squel[_0x4402('0x4d')]()[_0x4402('0x4e')]('id')[_0x4402('0x4e')](_0x4402('0x2c'))[_0x4402('0x4e')](_0x4402('0x4f'))[_0x4402('0x50')](_0x4402('0x51'));var _0x499e12=squel[_0x4402('0x4d')]()['field'](_0x4402('0x52'))[_0x4402('0x4e')]('u.fullname')[_0x4402('0x4e')](_0x4402('0x53'))['from'](_0x4402('0x54'),'ui')[_0x4402('0x55')]('users','u',_0x4402('0x56'));var _0x2b6795=squel['select']()[_0x4402('0x50')](_0x4402('0x57'),'i')[_0x4402('0x55')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x4402('0x55')]('users','o','o.id\x20=\x20i.UserId')['left_join']('mail_accounts','a',_0x4402('0x58'))[_0x4402('0x55')]('mail_messages','me',_0x4402('0x59'))[_0x4402('0x55')]('mail_interaction_has_tags','it',_0x4402('0x5a'))[_0x4402('0x55')](_0x4402('0x51'),'t',_0x4402('0x5b'));var _0x4b53de=squel[_0x4402('0x5c')]();var _0x18b3b1=[];var _0x20cb22=squel['expr']();var _0x1439ec;if(_0x133b77[_0x4402('0x42')][_0x4402('0x5d')]){_0x1439ec=as[_0x4402('0x5e')](_0x133b77[_0x4402('0x42')][_0x4402('0x5d')]);var _0x39246d=_0x1439ec[_0x4402('0x5f')];for(var _0x3c12c6=0x0;_0x3c12c6<_0x1439ec['conditions'][_0x4402('0x47')];_0x3c12c6++){var _0xa29fca=_0x1439ec['conditions'][_0x3c12c6];var _0x1dbb9a='i';var _0x4a09b5=_['find'](_0x282cff,['name',_0xa29fca[_0x4402('0x4e')]]);if(!_0x4a09b5){switch(_0xa29fca[_0x4402('0x4e')]){case _0x4402('0x60'):if(_0xa29fca['value']==0x1){_0x2b6795[_0x4402('0x61')]('`'+_0xa29fca[_0x4402('0x4e')]+_0x4402('0x62'));}else{_0x2b6795[_0x4402('0x61')]('`'+_0xa29fca[_0x4402('0x4e')]+'`\x20>\x200');}break;case _0x4402('0x63'):if(_0xa29fca[_0x4402('0x64')]===_0x4402('0x65')){if(_0xa29fca[_0x4402('0x66')]['split']('\x20')['length']>0x1){_0x4b53de[_0x39246d](_0x4402('0x67'),qs['getFullTextValue'](_0xa29fca[_0x4402('0x66')]),null);}else{var _0x3b57fd='%'+_0xa29fca['value']+'%';_0x4b53de[_0x39246d]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3b57fd,_0x3b57fd,_0x3b57fd);}}else{_0x4a09b5=_[_0x4402('0x68')](_0x282cff,[_0x4402('0x2c'),_0x4402('0x69')]);_0xa29fca[_0x4402('0x4e')]=_0x4402('0x69');_0x1b6ccb=as[_0x4402('0x6a')](_0x1dbb9a,_0x4a09b5['type'],_0xa29fca);_0x4b53de[_0x39246d](_0x1b6ccb[_0x4402('0x6b')],_0x1b6ccb['value'][_0x4402('0x6c')],_0x1b6ccb[_0x4402('0x66')]['end']);}break;case _0x4402('0x6d'):var _0x1da957=_0xa29fca[_0x4402('0x66')][_0x4402('0x6e')](',')[_0x4402('0x2f')](function(_0x2cbdc3){return Number(_0x2cbdc3);});_0x1da957[_0x4402('0x32')](function(_0x39f2f0){_0x20cb22['or'](_0x4402('0x6f'),'%,'+_0x39f2f0+',%');});_0x18b3b1=_[_0x4402('0x70')](_0x18b3b1,_0x1da957);break;case'User':if(_0xa29fca['operator']===_0x4402('0x65')){_0x4b53de[_0x39246d](_0x4402('0x71'),'%'+_0xa29fca[_0x4402('0x66')]+'%',null);}else{_0x4a09b5=_['find'](_0x282cff,[_0x4402('0x2c'),'UserId']);_0xa29fca['field']=_0x4402('0x72');_0x1b6ccb=as['buildExpression'](_0x1dbb9a,_0x4a09b5['type'],_0xa29fca);_0x4b53de[_0x39246d](_0x1b6ccb[_0x4402('0x6b')],_0x1b6ccb[_0x4402('0x66')][_0x4402('0x6c')],_0x1b6ccb[_0x4402('0x66')][_0x4402('0x1f')]);}break;case _0x4402('0x73'):_0x1b6ccb=as[_0x4402('0x6a')]('me',null,_0xa29fca);_0x4b53de[_0x39246d](_0x1b6ccb['text'],_0x1b6ccb[_0x4402('0x66')][_0x4402('0x6c')],_0x1b6ccb['value'][_0x4402('0x1f')]);break;}}else{var _0x1b6ccb=as[_0x4402('0x6a')](_0x1dbb9a,_0x4a09b5['type'],_0xa29fca);_0x4b53de[_0x39246d](_0x1b6ccb[_0x4402('0x6b')],_0x1b6ccb[_0x4402('0x66')][_0x4402('0x6c')],_0x1b6ccb['value']['end']);}}}else{var _0x494be2=_(_0x133b77['query'])[_0x4402('0x74')]()[_0x4402('0x2f')](function(_0x16dc83){return _['some'](_0x282cff,[_0x4402('0x2c'),_0x16dc83])?_0x16dc83:undefined;})['compact']()[_0x4402('0x66')]();if(!_[_0x4402('0x75')](_0x494be2)){_0x494be2[_0x4402('0x32')](function(_0x19c282){if(_0x19c282===_0x4402('0x76')){_0x2b6795['where'](_0x4402('0x77'),[][_0x4402('0x78')](_0x133b77['query'][_0x19c282]));}else if(_0x19c282===_0x4402('0x79')){var _0x4b4eb4=JSON[_0x4402('0x7a')](_0x133b77[_0x4402('0x42')][_0x19c282])[_0x4402('0x7b')];var _0x516fd6=JSON[_0x4402('0x7a')](_0x133b77[_0x4402('0x42')][_0x19c282])[_0x4402('0x7c')];_0x2b6795[_0x4402('0x4b')](_0x4402('0x7d'),_0x4b4eb4,_0x516fd6);}else{if(_0x133b77[_0x4402('0x42')][_0x19c282]===_0x4402('0x7e')){_0x2b6795[_0x4402('0x4b')]('i.'+_0x19c282+_0x4402('0x7f'));}else{_0x2b6795[_0x4402('0x4b')]('i.'+_0x19c282+'\x20=\x20?',_0x133b77['query'][_0x19c282]);}}});}if(_0x133b77[_0x4402('0x42')][_0x4402('0x80')]){if(_0x133b77[_0x4402('0x42')][_0x4402('0x80')]==0x1){_0x2b6795[_0x4402('0x61')](_0x4402('0x81'));}else{_0x2b6795['having'](_0x4402('0x82'));}}if(_0x133b77[_0x4402('0x42')]['tag']){_0x18b3b1=_[_0x4402('0x83')](_0x133b77[_0x4402('0x42')][_0x4402('0x84')])?_0x133b77['query'][_0x4402('0x84')]:new Array(_0x133b77[_0x4402('0x42')]['tag']);_0x18b3b1[_0x4402('0x32')](function(_0x21383a){_0x20cb22['or'](_0x4402('0x6f'),'%,'+_0x21383a+',%');});}if(_0x133b77[_0x4402('0x42')][_0x4402('0x85')]){var _0x4bb26a=_0x133b77[_0x4402('0x42')][_0x4402('0x85')][_0x4402('0x86')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x4402('0x87'));if(qs['isNumeric'](_0x4bb26a)){_0x4b53de['or']('i.id\x20LIKE\x20?',_0x4bb26a+'%');}else if(qs[_0x4402('0x88')](_0x4bb26a)){_0x4b53de['or'](_0x4402('0x89'),_0x4bb26a+'%');}else{_0x4b53de['or'](_0x4402('0x8a'),qs['getFullTextValue'](_0x4bb26a))['or'](_0x4402('0x8b'),qs[_0x4402('0x8c')](_0x4bb26a));}}}_0x2b6795['where'](_0x4b53de);_0x2b6795[_0x4402('0x8d')](_0x4402('0x8e'));var _0x5b8cf1={'type':db[_0x4402('0x8f')][_0x4402('0x90')][_0x4402('0x91')],'raw':!![]};var _0x5c7795=_0x2b6795[_0x4402('0x92')]();_0x5c7795[_0x4402('0x4e')]('i.id');_0x5c7795[_0x4402('0x4e')](_0x4402('0x93'),'unreadMessages');if(_0x431875['order']){_0x431875['order'][_0x4402('0x32')](function(_0x47b44a){_0x2b6795['order']('i.'+_0x47b44a[0x0],_0x47b44a[0x1]===_0x4402('0x94')?![]:!![]);});}if(!_[_0x4402('0x75')](_0x18b3b1)){_0x2b6795[_0x4402('0x61')](_0x20cb22);_0x5c7795[_0x4402('0x4b')](_0x4402('0x95'),_0x18b3b1);}BPromise['resolve']()[_0x4402('0x29')](function(){if(!_0x1439ec){if(_0x133b77['query'][_0x4402('0x76')]||_0x133b77[_0x4402('0x42')]['journey'])return;_0x5c7795[_0x4402('0x4b')](_0x4402('0x96'));_0x2b6795[_0x4402('0x4b')](_0x4402('0x96'));return;}return _0x133b77[_0x4402('0x97')][_0x4402('0x98')]({'attributes':['id'],'raw':!![]})[_0x4402('0x29')](function(_0x49a0e6){if(_[_0x4402('0x75')](_0x49a0e6)){_0x5c7795[_0x4402('0x4b')]('i.MailAccountId\x20IS\x20NULL');_0x2b6795['where'](_0x4402('0x99'));}else{_0x5c7795['where'](_0x4402('0x77'),_[_0x4402('0x2f')](_0x49a0e6,'id'));_0x2b6795[_0x4402('0x4b')]('i.MailAccountId\x20IN\x20?',_[_0x4402('0x2f')](_0x49a0e6,'id'));}});})[_0x4402('0x29')](function(){db[_0x4402('0x9a')][_0x4402('0x42')](_0x5c7795[_0x4402('0x9b')](),_0x5b8cf1)[_0x4402('0x29')](function(_0x131a34){_0x3c8c42[_0x4402('0x21')]=_0x131a34[_0x4402('0x47')];if(_0x3c8c42[_0x4402('0x21')]===0x0)return[];return db[_0x4402('0x9a')][_0x4402('0x42')](_0x365880[_0x4402('0x9b')](),_0x5b8cf1)[_0x4402('0x29')](function(_0x27c77f){_0x31871b=_[_0x4402('0x9c')](_0x27c77f,'id');_0x5b8cf1=_[_0x4402('0x9d')](_0x5b8cf1,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x133b77[_0x4402('0x42')]['fields']){_0x431875['attributes'][_0x4402('0x32')](function(_0x581773){_0x2b6795[_0x4402('0x4e')]('i.'+_0x581773);});}else{_0x2b6795['field'](_0x4402('0x93'),'unreadMessages');_0x2b6795[_0x4402('0x4e')]('a.key',_0x4402('0x9e'));_0x2b6795[_0x4402('0x4e')](_0x4402('0x9f'),_0x4402('0xa0'));_0x2b6795[_0x4402('0x4e')](_0x4402('0x8e'));_0x2b6795[_0x4402('0x4e')](_0x4402('0xa1'));_0x2b6795[_0x4402('0x4e')](_0x4402('0xa2'));_0x2b6795[_0x4402('0x4e')](_0x4402('0xa3'));_0x2b6795[_0x4402('0x4e')](_0x4402('0xa4'));_0x2b6795['field']('i.attach');_0x2b6795[_0x4402('0x4e')](_0x4402('0xa5'));_0x2b6795[_0x4402('0x4e')]('i.lastMsgDirection');_0x2b6795[_0x4402('0x4e')](_0x4402('0xa6'));_0x2b6795[_0x4402('0x4e')](_0x4402('0xa7'));_0x2b6795[_0x4402('0x4e')]('i.substatus');_0x2b6795['field'](_0x4402('0xa8'));_0x2b6795[_0x4402('0x4e')](_0x4402('0xa9'));_0x2b6795[_0x4402('0x4e')]('i.MailAccountId');_0x2b6795[_0x4402('0x4e')](_0x4402('0xaa'));_0x2b6795[_0x4402('0x4e')](_0x4402('0xab'),_0x4402('0xac'));_0x2b6795['field'](_0x4402('0xad'),_0x4402('0xae'));_0x2b6795[_0x4402('0x4e')](_0x4402('0xaf'),_0x4402('0xb0'));_0x2b6795[_0x4402('0x4e')](_0x4402('0xb1'),_0x4402('0xb2'));_0x2b6795[_0x4402('0x4e')](_0x4402('0xb3'),'Contact.mobile');_0x2b6795[_0x4402('0x4e')]('c.fax',_0x4402('0xb4'));_0x2b6795['field'](_0x4402('0xb5'),_0x4402('0xb6'));_0x2b6795[_0x4402('0x4e')](_0x4402('0xb7'),_0x4402('0xb8'));_0x2b6795[_0x4402('0x4e')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x4402('0x31'));}_0x2b6795[_0x4402('0x23')](_0x431875['limit']);_0x2b6795[_0x4402('0x22')](_0x431875[_0x4402('0x22')]);return db['sequelize'][_0x4402('0x42')](_0x2b6795[_0x4402('0x9b')](),_0x5b8cf1);})[_0x4402('0x29')](function(_0x341c18){_0x499e12[_0x4402('0x4b')](_0x4402('0xb9'),_[_0x4402('0x2f')](_0x341c18,'id'));return db[_0x4402('0x9a')][_0x4402('0x42')](_0x499e12[_0x4402('0x9b')](),_0x5b8cf1)[_0x4402('0x29')](function(_0x28e417){var _0x1a5b04=_[_0x4402('0xba')](_0x28e417,'MailInteractionId');var _0x3fa338=[];return db[_0x4402('0xbb')][_0x4402('0x36')]({'attributes':[_0x4402('0xbc')],'raw':!![]})[_0x4402('0x29')](function(_0x4fc3c2){var _0x2ec3de=_0x4fc3c2[_0x4402('0xbc')];_0x341c18[_0x4402('0x32')](function(_0x5d6887){_0x3fa338[_0x4402('0x34')](updateMailInteraction(_0x5d6887,_0x31871b,_0x1a5b04,_0x2ec3de));});return BPromise['all'](_0x3fa338);});});});})[_0x4402('0x29')](function(_0x5a8139){_0x3c8c42['rows']=_0x5a8139;return _0x3c8c42;})['then'](respondWithFilteredResult(_0x1fbfbf,_0x431875));})[_0x4402('0x3b')](handleError(_0x1fbfbf,null));};exports[_0x4402('0xbd')]=function(_0x442f20,_0xda6bed){var _0xd1fa37={'raw':![],'where':{'id':_0x442f20[_0x4402('0xbe')]['id']}},_0x433c7d={};_0x433c7d[_0x4402('0x41')]=_[_0x4402('0x74')](db[_0x4402('0x35')][_0x4402('0x3d')]);_0x433c7d[_0x4402('0x42')]=_[_0x4402('0x74')](_0x442f20['query']);_0x433c7d[_0x4402('0x43')]=_[_0x4402('0x44')](_0x433c7d['model'],_0x433c7d[_0x4402('0x42')]);_0xd1fa37[_0x4402('0x45')]=_[_0x4402('0x44')](_0x433c7d['model'],qs[_0x4402('0x46')](_0x442f20[_0x4402('0x42')][_0x4402('0x46')]));_0xd1fa37[_0x4402('0x45')]=_0xd1fa37[_0x4402('0x45')][_0x4402('0x47')]?_0xd1fa37[_0x4402('0x45')]:_0x433c7d[_0x4402('0x41')];if(_0x442f20[_0x4402('0x42')][_0x4402('0xbf')]){_0xd1fa37[_0x4402('0xc0')]=[{'all':!![]}];}_0xd1fa37=_[_0x4402('0x9d')]({},_0xd1fa37,_0x442f20[_0x4402('0xc1')]);return db[_0x4402('0x35')][_0x4402('0x68')](_0xd1fa37)[_0x4402('0x29')](handleEntityNotFound(_0xda6bed,null))[_0x4402('0x29')](respondWithResult(_0xda6bed,null))['catch'](handleError(_0xda6bed,null));};exports['create']=function(_0x4224b4,_0x49e6b4){return db[_0x4402('0x35')]['create'](_0x4224b4[_0x4402('0xc2')],{})['then'](respondWithResult(_0x49e6b4,0xc9))[_0x4402('0x3b')](handleError(_0x49e6b4,null));};exports[_0x4402('0x28')]=function(_0x5ba8f7,_0x20efbd){if(_0x5ba8f7[_0x4402('0xc2')]['id']){delete _0x5ba8f7[_0x4402('0xc2')]['id'];}return db[_0x4402('0x35')][_0x4402('0x68')]({'where':{'id':_0x5ba8f7['params']['id']}})[_0x4402('0x29')](handleEntityNotFound(_0x20efbd,null))['then'](saveUpdates(_0x5ba8f7['body'],null))[_0x4402('0x29')](respondWithResult(_0x20efbd,null))[_0x4402('0x3b')](handleError(_0x20efbd,null));};exports[_0x4402('0xc3')]=function(_0x54b781,_0x2322f9){return db[_0x4402('0x35')][_0x4402('0x68')]({'where':{'id':_0x54b781[_0x4402('0xbe')]['id']}})[_0x4402('0x29')](handleEntityNotFound(_0x2322f9,null))[_0x4402('0x29')](removeEntity(_0x2322f9,null))[_0x4402('0x3b')](handleError(_0x2322f9,null));};exports['describe']=function(_0x2e66ad,_0x3d7f09){return db[_0x4402('0x35')][_0x4402('0xc4')]()[_0x4402('0x29')](respondWithResult(_0x3d7f09,null))[_0x4402('0x3b')](handleError(_0x3d7f09,null));};exports[_0x4402('0xc5')]=function(_0x238c60,_0x2701a2,_0x562e33){return db[_0x4402('0xc6')][_0x4402('0x68')]({'where':{'id':_0x238c60['params']['id']}})[_0x4402('0x29')](handleEntityNotFound(_0x2701a2,null))[_0x4402('0x29')](function(_0x4db23e){if(_0x4db23e){return _0x4db23e[_0x4402('0xc5')](_0x238c60[_0x4402('0xc2')][_0x4402('0xc7')],_[_0x4402('0xc8')](_0x238c60[_0x4402('0xc2')],[_0x4402('0xc7'),'id'])||{});}})[_0x4402('0x29')](respondWithResult(_0x2701a2,null))[_0x4402('0x3b')](handleError(_0x2701a2,null));};exports[_0x4402('0xc9')]=function(_0x1db876,_0x165e5f,_0x49f8cc){var _0x6219bd={'raw':![],'where':{}};var _0x5f05b0={};var _0x589a7c={'count':0x0,'rows':[]};return db[_0x4402('0x35')][_0x4402('0x36')]({'where':{'id':_0x1db876[_0x4402('0xbe')]['id']}})['then'](handleEntityNotFound(_0x165e5f,null))['then'](function(_0x148106){if(_0x148106){_0x5f05b0[_0x4402('0x41')]=_[_0x4402('0x74')](db['MailMessage'][_0x4402('0x3d')]);_0x5f05b0[_0x4402('0x42')]=_['keys'](_0x1db876[_0x4402('0x42')]);_0x5f05b0[_0x4402('0x43')]=_[_0x4402('0x44')](_0x5f05b0['model'],_0x5f05b0[_0x4402('0x42')]);_0x6219bd[_0x4402('0x45')]=_[_0x4402('0x44')](_0x5f05b0['model'],qs['fields'](_0x1db876[_0x4402('0x42')][_0x4402('0x46')]));_0x6219bd['attributes']=_0x6219bd[_0x4402('0x45')][_0x4402('0x47')]?_0x6219bd[_0x4402('0x45')]:_0x5f05b0[_0x4402('0x41')];if(!_0x1db876[_0x4402('0x42')][_0x4402('0xca')](_0x4402('0x48'))){_0x6219bd[_0x4402('0x23')]=qs[_0x4402('0x23')](_0x1db876[_0x4402('0x42')]['limit']);_0x6219bd[_0x4402('0x22')]=qs[_0x4402('0x22')](_0x1db876[_0x4402('0x42')]['offset']);}_0x6219bd[_0x4402('0x49')]=qs['sort'](_0x1db876[_0x4402('0x42')][_0x4402('0x4a')]);_0x6219bd[_0x4402('0x4b')]=qs['filters'](_['pick'](_0x1db876[_0x4402('0x42')],_0x5f05b0['filters']));_0x6219bd[_0x4402('0x4b')][_0x4402('0xcb')]=_0x148106['id'];if(_0x1db876[_0x4402('0x42')][_0x4402('0x85')]){_0x6219bd[_0x4402('0x4b')]=_[_0x4402('0x9d')](_0x6219bd['where'],{'$or':_[_0x4402('0x2f')](_0x6219bd[_0x4402('0x45')],function(_0x5a482f){var _0x3b6fda={};_0x3b6fda[_0x5a482f]={'$like':'%'+_0x1db876[_0x4402('0x42')][_0x4402('0x85')]+'%'};return _0x3b6fda;})});}if(_0x1db876['query'][_0x4402('0x7b')]){var _0x25615c=_0x1db876['query'][_0x4402('0x7b')][_0x4402('0x6e')](',');var _0x2f7d68={};_0x2f7d68[_0x25615c[0x0]]={'$gte':moment(_0x25615c[0x1])[_0x4402('0xcc')](_0x4402('0xcd'))};_0x6219bd[_0x4402('0x4b')]=_[_0x4402('0x9d')](_0x6219bd[_0x4402('0x4b')],_0x2f7d68);}_0x6219bd=_[_0x4402('0x9d')]({},_0x6219bd,_0x1db876[_0x4402('0xc1')]);return db[_0x4402('0xc6')][_0x4402('0x21')]({'where':_0x6219bd[_0x4402('0x4b')]})['then'](function(_0x45f652){_0x589a7c['count']=_0x45f652;if(_0x1db876[_0x4402('0x42')][_0x4402('0xbf')]){_0x6219bd[_0x4402('0xc0')]=[{'all':!![]}];}return db[_0x4402('0xc6')][_0x4402('0xce')](_0x6219bd);})[_0x4402('0x29')](function(_0x2b5560){_0x589a7c[_0x4402('0xcf')]=_0x2b5560;return _0x589a7c;});}})['then'](respondWithFilteredResult(_0x165e5f,_0x6219bd))[_0x4402('0x3b')](handleError(_0x165e5f,null));};exports[_0x4402('0xd0')]=function(_0x43c064,_0x292a3e,_0x31cc97){return db[_0x4402('0x35')][_0x4402('0x68')]({'where':{'id':_0x43c064[_0x4402('0xbe')]['id']}})[_0x4402('0x29')](handleEntityNotFound(_0x292a3e,null))[_0x4402('0x29')](function(_0x45215a){if(_0x45215a){return _0x45215a[_0x4402('0xd1')](_0x43c064[_0x4402('0xc2')][_0x4402('0xc7')],_[_0x4402('0xc8')](_0x43c064[_0x4402('0xc2')],[_0x4402('0xc7'),'id'])||{})[_0x4402('0xd2')](function(){return db[_0x4402('0x6d')][_0x4402('0xce')]({'attributes':['id',_0x4402('0x2c'),'color'],'where':{'id':_0x43c064['body'][_0x4402('0xc7')]}});})['then'](function(_0x3de6af){socket['emit'](_0x4402('0xd3'),{'id':Number(_0x43c064[_0x4402('0xbe')]['id']),'tags':_0x3de6af||[]});return{'id':Number(_0x43c064[_0x4402('0xbe')]['id']),'tags':_0x3de6af||[]};});}})[_0x4402('0x29')](respondWithResult(_0x292a3e,null))['catch'](handleError(_0x292a3e,null));};exports[_0x4402('0xd4')]=function(_0x5b9588,_0x40807c,_0x5af8e6){return db[_0x4402('0x35')][_0x4402('0x68')]({'where':{'id':_0x5b9588[_0x4402('0xbe')]['id']}})[_0x4402('0x29')](handleEntityNotFound(_0x40807c,null))[_0x4402('0x29')](function(_0x4eda66){if(_0x4eda66){return _0x4eda66[_0x4402('0xd4')](_0x5b9588['query'][_0x4402('0xc7')]);}})[_0x4402('0x29')](respondWithStatusCode(_0x40807c,null))[_0x4402('0x3b')](handleError(_0x40807c,null));};exports[_0x4402('0xd5')]=function(_0x3516cf,_0xf1d416){var _0x53efd8=moment()[_0x4402('0xd6')]()[_0x4402('0x9b')]();var _0x530d2e=path[_0x4402('0xd7')](config[_0x4402('0xd8')],_0x4402('0xd9'),_0x4402('0xda'),_0x4402('0xdb'));var _0x541207=path[_0x4402('0xd7')](config[_0x4402('0xd8')],_0x4402('0xd9'),_0x4402('0xda'),'attachments');var _0x1f9559=path[_0x4402('0xd7')](_0x530d2e,_0x53efd8);var _0x50a49a=util[_0x4402('0xcc')](_0x4402('0xdc'),_0x3516cf[_0x4402('0xbe')]['id'],_0x53efd8);var _0x55e474=path[_0x4402('0xd7')](_0x530d2e,_0x50a49a);var _0x5cd106=[];if(_0x3516cf[_0x4402('0x42')][_0x4402('0xdd')]){_0x5cd106['push']({'model':db[_0x4402('0xde')],'as':_0x4402('0xdf'),'raw':!![]});}var _0x397665=[{'model':db[_0x4402('0xc6')],'as':_0x4402('0xe0'),'attributes':['id',_0x4402('0xc2'),_0x4402('0x50'),'to','cc',_0x4402('0xe1'),_0x4402('0xe2'),_0x4402('0x79')],'where':{'secret':![]},'order':qs[_0x4402('0x4a')]('id'),'include':_0x5cd106}];return db[_0x4402('0x35')]['find']({'where':{'id':_0x3516cf[_0x4402('0xbe')]['id']},'include':_0x397665})[_0x4402('0x29')](handleEntityNotFound(_0xf1d416,null))[_0x4402('0x29')](function(_0x2ae275){if(_0x2ae275&&_0x2ae275[_0x4402('0xe0')]){var _0x1e1de0=_0x2ae275[_0x4402('0xe3')]({'plain':!![]});fs['mkdirSync'](_0x1f9559);return BPromise['each'](_0x1e1de0[_0x4402('0xe0')],function(_0x382d06,_0x2bda31){var _0x29d7a0={'from':_0x382d06[_0x4402('0x50')],'to':_0x382d06['to'],'subject':_0x382d06['subject'],'html':_0x382d06[_0x4402('0xc2')],'headers':{'Date':moment(_0x382d06[_0x4402('0x79')])[_0x4402('0xcc')](_0x4402('0xe4'))},'attachments':[]};if(_0x382d06['cc']){_0x29d7a0[_0x4402('0xe5')]['Cc']=_0x382d06['cc'];}if(_0x382d06['bcc']){_0x29d7a0[_0x4402('0xe5')]['Bcc']=_0x382d06[_0x4402('0xe1')];}return new BPromise(function(_0x10a0f9,_0x3a3a4c){if(_0x382d06['Attachments']){for(var _0x180c5d=0x0;_0x180c5d<_0x382d06[_0x4402('0xdf')][_0x4402('0x47')];_0x180c5d++){var _0xe868ff=_0x382d06[_0x4402('0xdf')][_0x180c5d];var _0x44cb21=path[_0x4402('0xd7')](_0x541207,_0xe868ff['basename']);if(fs[_0x4402('0xe6')](_0x44cb21)){_0x29d7a0['attachments'][_0x4402('0x34')]({'name':_0xe868ff[_0x4402('0x2c')],'contentType':_0xe868ff[_0x4402('0x3f')],'data':fs['readFileSync'](_0x44cb21)});}}}emlformat['build'](_0x29d7a0,function(_0x2d26a5,_0x31cfbc){if(_0x2d26a5)return _0x3a3a4c(_0x2d26a5);fs[_0x4402('0xe7')](path[_0x4402('0xd7')](_0x1f9559,util[_0x4402('0xcc')]('message%d.eml',_0x2bda31)),_0x31cfbc);return _0x10a0f9(_0x31cfbc);});});})[_0x4402('0x29')](function(){return new BPromise(function(_0x562aff,_0x49377b){zipdir(_0x1f9559,{'saveTo':_0x55e474},function(_0x152365,_0x56361c){if(_0x152365)return _0x49377b(_0x152365);return _0x562aff(_0x56361c);});})['then'](function(){return new BPromise(function(_0x4470d2,_0x520114){rimraf(_0x1f9559,function(_0x3cf892){if(_0x3cf892)_0x520114(_0x3cf892);return _0x4470d2();});});})[_0x4402('0x29')](function(){return _0xf1d416['download'](_0x55e474,_0x50a49a,function(_0x30b06a){if(_0x30b06a){console[_0x4402('0xe8')](_0x4402('0xe9'),_0x30b06a);}else{fs['unlinkSync'](_0x55e474);}});});});}else{return _0xf1d416[_0x4402('0x1d')](0xc8);}})[_0x4402('0x3b')](handleError(_0xf1d416,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index be23661..08edca6 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 _0x0a86=['MailMessage','setMaxListeners','save','update','getUsers','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction'];(function(_0xfe3e58,_0x2b9ed6){var _0x1b27b7=function(_0x16cec0){while(--_0x16cec0){_0xfe3e58['push'](_0xfe3e58['shift']());}};_0x1b27b7(++_0x2b9ed6);}(_0x0a86,0x19b));var _0x60a8=function(_0x1c12bd,_0x348360){_0x1c12bd=_0x1c12bd-0x0;var _0x1de620=_0x0a86[_0x1c12bd];return _0x1de620;};'use strict';var EventEmitter=require(_0x60a8('0x0'));var MailInteraction=require(_0x60a8('0x1'))['db'][_0x60a8('0x2')];var MailMessage=require('../../mysqldb')['db'][_0x60a8('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x60a8('0x4')](0x0);var events={'afterCreate':_0x60a8('0x5'),'afterUpdate':_0x60a8('0x6'),'afterDestroy':'remove'};function emitEvent(_0x107c63){return function(_0xd82d2a,_0x17ab16,_0x4d4257){_0xd82d2a[_0x60a8('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2a305c){_0xd82d2a[_0x60a8('0x8')](_0x60a8('0x9'),_0x2a305c[_0x60a8('0xa')](function(_0x556a7b){return{'id':_0x556a7b['id']};}));return MailMessage[_0x60a8('0xb')]({'where':{'MailInteractionId':_0xd82d2a['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3f60ad){_0xd82d2a[_0x60a8('0x8')](_0x60a8('0xc'),_0x3f60ad['length']);MailInteractionEvents[_0x60a8('0xd')](_0x107c63+':'+_0xd82d2a['id'],_0xd82d2a);MailInteractionEvents[_0x60a8('0xd')](_0x107c63,_0xd82d2a);_0x4d4257(null);})[_0x60a8('0xe')](_0x4d4257(null));};}for(var e in events){if(events[_0x60a8('0xf')](e)){var event=events[e];MailInteraction[_0x60a8('0x10')](e,emitEvent(event));}}module[_0x60a8('0x11')]=MailInteractionEvents; \ No newline at end of file +var _0x6d4a=['../../mysqldb','MailInteraction','MailMessage','setMaxListeners','update','getUsers','setDataValue','Users','map','findAll','then','length','emit','catch','hasOwnProperty','hook','exports'];(function(_0x5ce280,_0x227dc1){var _0x1afbb5=function(_0xf60fbf){while(--_0xf60fbf){_0x5ce280['push'](_0x5ce280['shift']());}};_0x1afbb5(++_0x227dc1);}(_0x6d4a,0x187));var _0xa6d4=function(_0x42152b,_0xd2b7f9){_0x42152b=_0x42152b-0x0;var _0x4d732c=_0x6d4a[_0x42152b];return _0x4d732c;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0xa6d4('0x0'))['db'][_0xa6d4('0x1')];var MailMessage=require(_0xa6d4('0x0'))['db'][_0xa6d4('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xa6d4('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa6d4('0x4'),'afterDestroy':'remove'};function emitEvent(_0x337369){return function(_0x31eb16,_0x459760,_0x592280){_0x31eb16[_0xa6d4('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2bb178){_0x31eb16[_0xa6d4('0x6')](_0xa6d4('0x7'),_0x2bb178[_0xa6d4('0x8')](function(_0x32b8c4){return{'id':_0x32b8c4['id']};}));return MailMessage[_0xa6d4('0x9')]({'where':{'MailInteractionId':_0x31eb16['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa6d4('0xa')](function(_0x25ff28){_0x31eb16[_0xa6d4('0x6')]('unreadMessages',_0x25ff28[_0xa6d4('0xb')]);MailInteractionEvents[_0xa6d4('0xc')](_0x337369+':'+_0x31eb16['id'],_0x31eb16);MailInteractionEvents[_0xa6d4('0xc')](_0x337369,_0x31eb16);_0x592280(null);})[_0xa6d4('0xd')](_0x592280(null));};}for(var e in events){if(events[_0xa6d4('0xe')](e)){var event=events[e];MailInteraction[_0xa6d4('0xf')](e,emitEvent(event));}}module[_0xa6d4('0x10')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 8d37709..a238875 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 _0xd634=['then','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closedAt','changed','closed','models','get','MailMessage','update'];(function(_0x5086b1,_0x380c9b){var _0x28c0b0=function(_0x24da7a){while(--_0x24da7a){_0x5086b1['push'](_0x5086b1['shift']());}};_0x28c0b0(++_0x380c9b);}(_0xd634,0x151));var _0x4d63=function(_0x496333,_0x1c47d6){_0x496333=_0x496333-0x0;var _0x44256e=_0xd634[_0x496333];return _0x44256e;};'use strict';var _=require(_0x4d63('0x0'));var util=require(_0x4d63('0x1'));var logger=require(_0x4d63('0x2'))(_0x4d63('0x3'));var moment=require(_0x4d63('0x4'));var BPromise=require(_0x4d63('0x5'));var rp=require(_0x4d63('0x6'));var fs=require('fs');var path=require(_0x4d63('0x7'));var rimraf=require(_0x4d63('0x8'));var config=require(_0x4d63('0x9'));var attributes=require('./mailInteraction.attributes');module[_0x4d63('0xa')]=function(_0x2c5bc6,_0x389e92){return _0x2c5bc6[_0x4d63('0xb')](_0x4d63('0xc'),attributes,{'tableName':_0x4d63('0xd'),'paranoid':![],'indexes':[{'name':_0x4d63('0xe'),'fields':[_0x4d63('0xf'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4fa60b,_0x16c4dc,_0x5b6421){if(_0x4fa60b[_0x4d63('0x10')]){_0x4fa60b[_0x4d63('0x11')]=moment()[_0x4d63('0x12')](_0x4d63('0x13'));}if(_0x4fa60b['closed']){_0x4fa60b[_0x4d63('0x14')]=moment()['format'](_0x4d63('0x13'));}_0x5b6421(null,_0x16c4dc);},'beforeUpdate':function(_0x305e60,_0x5a90fe,_0x4722e9){if(_0x305e60[_0x4d63('0x15')](_0x4d63('0x10'))){_0x305e60[_0x4d63('0x11')]=_0x305e60[_0x4d63('0x10')]?moment()[_0x4d63('0x12')](_0x4d63('0x13')):null;}if(_0x305e60[_0x4d63('0x15')](_0x4d63('0x16'))){_0x305e60[_0x4d63('0x14')]=moment()[_0x4d63('0x12')](_0x4d63('0x13'));_0x305e60[_0x4d63('0x10')]=null;_0x305e60['substatusAt']=null;}_0x4722e9(null,_0x305e60);},'afterUpdate':function(_0x38804a,_0x3ab719,_0x6c70){var _0x3ed512=_0x2c5bc6[_0x4d63('0x17')];var _0x3af0d7=_0x38804a[_0x4d63('0x18')]({'plain':!![]});if(_0x3af0d7[_0x4d63('0x16')]){return _0x3ed512[_0x4d63('0x19')][_0x4d63('0x1a')]({'read':!![]},{'where':{'MailInteractionId':_0x3af0d7['id']}})[_0x4d63('0x1b')](function(){_0x6c70();})['catch'](function(_0x3b2695){_0x6c70(_0x3b2695);});}else{_0x6c70();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x05e2=['utf8mb4','utf8mb4_unicode_ci','lodash','util','api','request-promise','rimraf','./mailInteraction.attributes','define','mail_interactions','fti_mail_interactions','subject','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','update','then'];(function(_0x7d66d8,_0x29eb9c){var _0x2ad963=function(_0x8bce47){while(--_0x8bce47){_0x7d66d8['push'](_0x7d66d8['shift']());}};_0x2ad963(++_0x29eb9c);}(_0x05e2,0x116));var _0x205e=function(_0x4283c0,_0xc694d5){_0x4283c0=_0x4283c0-0x0;var _0x6b47ab=_0x05e2[_0x4283c0];return _0x6b47ab;};'use strict';var _=require(_0x205e('0x0'));var util=require(_0x205e('0x1'));var logger=require('../../config/logger')(_0x205e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x205e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x205e('0x4'));var config=require('../../config/environment');var attributes=require(_0x205e('0x5'));module['exports']=function(_0x4f5e78,_0x118391){return _0x4f5e78[_0x205e('0x6')]('MailInteraction',attributes,{'tableName':_0x205e('0x7'),'paranoid':![],'indexes':[{'name':_0x205e('0x8'),'fields':[_0x205e('0x9'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5721ec,_0x4182e9,_0x4b88fd){if(_0x5721ec[_0x205e('0xa')]){_0x5721ec[_0x205e('0xb')]=moment()[_0x205e('0xc')](_0x205e('0xd'));}if(_0x5721ec[_0x205e('0xe')]){_0x5721ec[_0x205e('0xf')]=moment()[_0x205e('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4b88fd(null,_0x4182e9);},'beforeUpdate':function(_0x14fb28,_0x105795,_0x109ca0){if(_0x14fb28[_0x205e('0x10')](_0x205e('0xa'))){_0x14fb28[_0x205e('0xb')]=_0x14fb28['substatus']?moment()[_0x205e('0xc')](_0x205e('0xd')):null;}if(_0x14fb28[_0x205e('0x10')](_0x205e('0xe'))){_0x14fb28[_0x205e('0xf')]=moment()['format'](_0x205e('0xd'));_0x14fb28['substatus']=null;_0x14fb28[_0x205e('0xb')]=null;}_0x109ca0(null,_0x14fb28);},'afterUpdate':function(_0x1b779f,_0x55e2ae,_0x2f3a4b){var _0x42a3f2=_0x4f5e78[_0x205e('0x11')];var _0x508a3b=_0x1b779f[_0x205e('0x12')]({'plain':!![]});if(_0x508a3b[_0x205e('0xe')]){return _0x42a3f2['MailMessage'][_0x205e('0x13')]({'read':!![]},{'where':{'MailInteractionId':_0x508a3b['id']}})[_0x205e('0x14')](function(){_0x2f3a4b();})['catch'](function(_0x41d4f5){_0x2f3a4b(_0x41d4f5);});}else{_0x2f3a4b();}}},'charset':_0x205e('0x15'),'collate':_0x205e('0x16')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 158ba6c..95f57d3 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 _0xab3a=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','then','info','MailInteraction,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','update','options','where','attributes','limit','stringify','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x1c76fa,_0x1a88c3){var _0x13ae6d=function(_0x3a2956){while(--_0x3a2956){_0x1c76fa['push'](_0x1c76fa['shift']());}};_0x13ae6d(++_0x1a88c3);}(_0xab3a,0x1d3));var _0xaab3=function(_0xbec8e6,_0x2841b5){_0xbec8e6=_0xbec8e6-0x0;var _0x4aa6f2=_0xab3a[_0xbec8e6];return _0x4aa6f2;};'use strict';var _=require(_0xaab3('0x0'));var util=require(_0xaab3('0x1'));var moment=require(_0xaab3('0x2'));var BPromise=require(_0xaab3('0x3'));var rs=require(_0xaab3('0x4'));var fs=require('fs');var Redis=require(_0xaab3('0x5'));var db=require(_0xaab3('0x6'))['db'];var utils=require(_0xaab3('0x7'));var logger=require(_0xaab3('0x8'))(_0xaab3('0x9'));var config=require(_0xaab3('0xa'));var jayson=require(_0xaab3('0xb'));var client=jayson[_0xaab3('0xc')]['http']({'port':0x232a});config['redis']=_[_0xaab3('0xd')](config[_0xaab3('0xe')],{'host':_0xaab3('0xf'),'port':0x18eb});var socket=require(_0xaab3('0x10'))(new Redis(config[_0xaab3('0xe')]));require(_0xaab3('0x11'))[_0xaab3('0x12')](socket);function respondWithRpcPromise(_0x2ee82a,_0x3595c0,_0x151330){return new BPromise(function(_0x404054,_0x54c60d){return client['request'](_0x2ee82a,_0x151330)[_0xaab3('0x13')](function(_0x45363f){logger[_0xaab3('0x14')](_0xaab3('0x15'),_0x3595c0,'request\x20sent');logger[_0xaab3('0x16')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x3595c0,_0xaab3('0x17'),JSON['stringify'](_0x45363f));if(_0x45363f[_0xaab3('0x18')]){if(_0x45363f[_0xaab3('0x18')][_0xaab3('0x19')]===0x1f4){logger['error'](_0xaab3('0x15'),_0x3595c0,_0x45363f[_0xaab3('0x18')]['message']);return _0x54c60d(_0x45363f[_0xaab3('0x18')][_0xaab3('0x1a')]);}logger[_0xaab3('0x18')]('MailInteraction,\x20%s,\x20%s',_0x3595c0,_0x45363f['error']['message']);return _0x404054(_0x45363f['error'][_0xaab3('0x1a')]);}else{logger[_0xaab3('0x14')](_0xaab3('0x15'),_0x3595c0,'request\x20sent');_0x404054(_0x45363f[_0xaab3('0x1b')][_0xaab3('0x1a')]);}})[_0xaab3('0x1c')](function(_0x13048f){logger[_0xaab3('0x18')](_0xaab3('0x15'),_0x3595c0,_0x13048f);_0x54c60d(_0x13048f);});});}exports[_0xaab3('0x1d')]=function(_0x5a865b){var _0x1b72a5=this;return new Promise(function(_0x3bcc3b,_0x43a8d4){return db[_0xaab3('0x1e')][_0xaab3('0x1f')](_0x5a865b['body'],{'raw':_0x5a865b['options']?_0x5a865b['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a865b['options']?_0x5a865b[_0xaab3('0x20')][_0xaab3('0x21')]||null:null,'attributes':_0x5a865b[_0xaab3('0x20')]?_0x5a865b[_0xaab3('0x20')][_0xaab3('0x22')]||null:null,'limit':_0x5a865b[_0xaab3('0x20')]?_0x5a865b[_0xaab3('0x20')][_0xaab3('0x23')]||null:null})[_0xaab3('0x13')](function(_0x46e004){logger[_0xaab3('0x14')](_0xaab3('0x1d'),_0x5a865b);logger[_0xaab3('0x16')]('UpdateMailInteraction',_0x5a865b,JSON[_0xaab3('0x24')](_0x46e004));_0x3bcc3b(_0x46e004);})['catch'](function(_0x28eaff){logger[_0xaab3('0x18')]('UpdateMailInteraction',_0x28eaff[_0xaab3('0x1a')],_0x5a865b);_0x43a8d4(_0x1b72a5[_0xaab3('0x18')](0x1f4,_0x28eaff[_0xaab3('0x1a')]));});});};exports['AddTagsToMailInteraction']=function(_0x4f5eec){return new Promise(function(_0x2f9833,_0x205996){return db[_0xaab3('0x1e')]['find']({'where':_0x4f5eec[_0xaab3('0x20')]?_0x4f5eec[_0xaab3('0x20')][_0xaab3('0x21')]||null:null})[_0xaab3('0x13')](function(_0x35a13d){if(_0x35a13d){return _0x35a13d[_0xaab3('0x25')](_0x4f5eec[_0xaab3('0x26')][_0xaab3('0x27')],_[_0xaab3('0x28')](_0x4f5eec[_0xaab3('0x26')],[_0xaab3('0x27'),'id'])||{});}})[_0xaab3('0x29')](function(_0xc33cb4){logger[_0xaab3('0x14')]('AddTags',_0x4f5eec);logger[_0xaab3('0x16')](_0xaab3('0x2a'),_0x4f5eec,JSON[_0xaab3('0x24')](_0xc33cb4));_0x2f9833(_0xc33cb4);})[_0xaab3('0x1c')](function(_0xc7cead){logger[_0xaab3('0x18')]('AddTags',_0xc7cead[_0xaab3('0x1a')],_0x4f5eec);_0x205996(_this['error'](0x1f4,_0xc7cead['message']));});});}; \ No newline at end of file +var _0x3b59=['defaults','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateMailInteraction','MailInteraction','options','where','attributes','limit','AddTagsToMailInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis'];(function(_0x52f1e6,_0xf70489){var _0x21f104=function(_0xb89f9e){while(--_0xb89f9e){_0x52f1e6['push'](_0x52f1e6['shift']());}};_0x21f104(++_0xf70489);}(_0x3b59,0x9c));var _0x93b5=function(_0x27cbf1,_0x14613c){_0x27cbf1=_0x27cbf1-0x0;var _0x1cfb81=_0x3b59[_0x27cbf1];return _0x1cfb81;};'use strict';var _=require(_0x93b5('0x0'));var util=require(_0x93b5('0x1'));var moment=require(_0x93b5('0x2'));var BPromise=require(_0x93b5('0x3'));var rs=require(_0x93b5('0x4'));var fs=require('fs');var Redis=require(_0x93b5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x93b5('0x6'));var logger=require('../../config/logger')(_0x93b5('0x7'));var config=require(_0x93b5('0x8'));var jayson=require(_0x93b5('0x9'));var client=jayson[_0x93b5('0xa')]['http']({'port':0x232a});config[_0x93b5('0xb')]=_[_0x93b5('0xc')](config[_0x93b5('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x93b5('0xd'))(new Redis(config[_0x93b5('0xb')]));require(_0x93b5('0xe'))[_0x93b5('0xf')](socket);function respondWithRpcPromise(_0x2a49bb,_0x490b0d,_0x576916){return new BPromise(function(_0x13ebc9,_0x7787e5){return client[_0x93b5('0x10')](_0x2a49bb,_0x576916)[_0x93b5('0x11')](function(_0x47c236){logger[_0x93b5('0x12')](_0x93b5('0x13'),_0x490b0d,'request\x20sent');logger[_0x93b5('0x14')](_0x93b5('0x15'),_0x490b0d,_0x93b5('0x16'),JSON[_0x93b5('0x17')](_0x47c236));if(_0x47c236[_0x93b5('0x18')]){if(_0x47c236['error'][_0x93b5('0x19')]===0x1f4){logger[_0x93b5('0x18')]('MailInteraction,\x20%s,\x20%s',_0x490b0d,_0x47c236[_0x93b5('0x18')][_0x93b5('0x1a')]);return _0x7787e5(_0x47c236[_0x93b5('0x18')]['message']);}logger[_0x93b5('0x18')]('MailInteraction,\x20%s,\x20%s',_0x490b0d,_0x47c236['error'][_0x93b5('0x1a')]);return _0x13ebc9(_0x47c236['error'][_0x93b5('0x1a')]);}else{logger[_0x93b5('0x12')](_0x93b5('0x13'),_0x490b0d,'request\x20sent');_0x13ebc9(_0x47c236['result']['message']);}})[_0x93b5('0x1b')](function(_0x28f5cc){logger[_0x93b5('0x18')](_0x93b5('0x13'),_0x490b0d,_0x28f5cc);_0x7787e5(_0x28f5cc);});});}exports[_0x93b5('0x1c')]=function(_0x1f0196){var _0x2dd622=this;return new Promise(function(_0x2bd21b,_0x352cbe){return db[_0x93b5('0x1d')]['update'](_0x1f0196['body'],{'raw':_0x1f0196[_0x93b5('0x1e')]?_0x1f0196[_0x93b5('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f0196[_0x93b5('0x1e')]?_0x1f0196[_0x93b5('0x1e')][_0x93b5('0x1f')]||null:null,'attributes':_0x1f0196[_0x93b5('0x1e')]?_0x1f0196[_0x93b5('0x1e')][_0x93b5('0x20')]||null:null,'limit':_0x1f0196[_0x93b5('0x1e')]?_0x1f0196[_0x93b5('0x1e')][_0x93b5('0x21')]||null:null})[_0x93b5('0x11')](function(_0xf7b6fc){logger[_0x93b5('0x12')](_0x93b5('0x1c'),_0x1f0196);logger[_0x93b5('0x14')](_0x93b5('0x1c'),_0x1f0196,JSON[_0x93b5('0x17')](_0xf7b6fc));_0x2bd21b(_0xf7b6fc);})[_0x93b5('0x1b')](function(_0x11add6){logger['error'](_0x93b5('0x1c'),_0x11add6[_0x93b5('0x1a')],_0x1f0196);_0x352cbe(_0x2dd622[_0x93b5('0x18')](0x1f4,_0x11add6[_0x93b5('0x1a')]));});});};exports[_0x93b5('0x22')]=function(_0x3d3ace){return new Promise(function(_0x2dad64,_0x2905a8){return db['MailInteraction'][_0x93b5('0x23')]({'where':_0x3d3ace[_0x93b5('0x1e')]?_0x3d3ace['options'][_0x93b5('0x1f')]||null:null})['then'](function(_0x393b6b){if(_0x393b6b){return _0x393b6b[_0x93b5('0x24')](_0x3d3ace[_0x93b5('0x25')][_0x93b5('0x26')],_[_0x93b5('0x27')](_0x3d3ace[_0x93b5('0x25')],[_0x93b5('0x26'),'id'])||{});}})[_0x93b5('0x28')](function(_0x8504b8){logger[_0x93b5('0x12')]('AddTags',_0x3d3ace);logger[_0x93b5('0x14')]('AddTags',_0x3d3ace,JSON['stringify'](_0x8504b8));_0x2dad64(_0x8504b8);})['catch'](function(_0x5af234){logger[_0x93b5('0x18')](_0x93b5('0x29'),_0x5af234[_0x93b5('0x1a')],_0x3d3ace);_0x2905a8(_this[_0x93b5('0x18')](0x1f4,_0x5af234[_0x93b5('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 16b6764..b1fccfe 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 _0xb75e=['update','emit','removeListener','register','length','mailInteraction:','./mailInteraction.events','save'];(function(_0x487131,_0x2c86e8){var _0xf320ff=function(_0x2a9a17){while(--_0x2a9a17){_0x487131['push'](_0x487131['shift']());}};_0xf320ff(++_0x2c86e8);}(_0xb75e,0x1de));var _0xeb75=function(_0x2687c5,_0x1fc9b){_0x2687c5=_0x2687c5-0x0;var _0x5aa160=_0xb75e[_0x2687c5];return _0x5aa160;};'use strict';var MailInteractionEvents=require(_0xeb75('0x0'));var events=[_0xeb75('0x1'),'remove',_0xeb75('0x2')];function createListener(_0x9ed34c,_0x2087c6){return function(_0x588569){_0x2087c6[_0xeb75('0x3')](_0x9ed34c,_0x588569);};}function removeListener(_0x3f558a,_0x267cbc){return function(){MailInteractionEvents[_0xeb75('0x4')](_0x3f558a,_0x267cbc);};}exports[_0xeb75('0x5')]=function(_0x19ac2f){for(var _0x56c177=0x0,_0x92d029=events[_0xeb75('0x6')];_0x56c177<_0x92d029;_0x56c177++){var _0x49ed4e=events[_0x56c177];var _0x1af864=createListener(_0xeb75('0x7')+_0x49ed4e,_0x19ac2f);MailInteractionEvents['on'](_0x49ed4e,_0x1af864);}}; \ No newline at end of file +var _0x9391=['update','emit','removeListener','register','./mailInteraction.events','save'];(function(_0x35f7b3,_0x14ca65){var _0x5bcdef=function(_0x2796fb){while(--_0x2796fb){_0x35f7b3['push'](_0x35f7b3['shift']());}};_0x5bcdef(++_0x14ca65);}(_0x9391,0x1e4));var _0x1939=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x9391[_0x4a9fb1];return _0x348672;};'use strict';var MailInteractionEvents=require(_0x1939('0x0'));var events=[_0x1939('0x1'),'remove',_0x1939('0x2')];function createListener(_0x5c28e8,_0x3b1b2f){return function(_0xb78beb){_0x3b1b2f[_0x1939('0x3')](_0x5c28e8,_0xb78beb);};}function removeListener(_0x28c64b,_0x350261){return function(){MailInteractionEvents[_0x1939('0x4')](_0x28c64b,_0x350261);};}exports[_0x1939('0x5')]=function(_0x56f3a0){for(var _0x20530d=0x0,_0x184868=events['length'];_0x20530d<_0x184868;_0x20530d++){var _0x21193e=events[_0x20530d];var _0x6164f9=createListener('mailInteraction:'+_0x21193e,_0x56f3a0);MailInteractionEvents['on'](_0x21193e,_0x6164f9);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 85fcb71..ae6dac2 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 _0xa41a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','index','describe','isAuthenticated','show','/:id/download','download','post','tracked','mailmessage:create','create','put','/:id/accept','accept','reject','delete','/:id','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x42a0ab,_0x517517){var _0x2fa683=function(_0x5e811a){while(--_0x5e811a){_0x42a0ab['push'](_0x42a0ab['shift']());}};_0x2fa683(++_0x517517);}(_0xa41a,0x6b));var _0xaa41=function(_0x2621ea,_0x2162ae){_0x2621ea=_0x2621ea-0x0;var _0x3587dd=_0xa41a[_0x2621ea];return _0x3587dd;};'use strict';var multer=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var path=require('path');var timeout=require(_0xaa41('0x2'));var express=require(_0xaa41('0x3'));var router=express[_0xaa41('0x4')]();var auth=require(_0xaa41('0x5'));var interaction=require(_0xaa41('0x6'));var config=require(_0xaa41('0x7'));var controller=require(_0xaa41('0x8'));router[_0xaa41('0x9')]('/',auth['isAuthenticated'](),controller[_0xaa41('0xa')]);router[_0xaa41('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xaa41('0xb')]);router[_0xaa41('0x9')]('/:id',auth[_0xaa41('0xc')](),controller[_0xaa41('0xd')]);router[_0xaa41('0x9')](_0xaa41('0xe'),auth[_0xaa41('0xc')](),controller[_0xaa41('0xf')]);router[_0xaa41('0x10')]('/',auth[_0xaa41('0xc')](),interaction[_0xaa41('0x11')]('mail',_0xaa41('0x12')),controller[_0xaa41('0x13')]);router['put']('/:id',auth[_0xaa41('0xc')](),controller['update']);router[_0xaa41('0x14')](_0xaa41('0x15'),auth[_0xaa41('0xc')](),controller[_0xaa41('0x16')]);router[_0xaa41('0x14')]('/:id/reject',auth[_0xaa41('0xc')](),controller[_0xaa41('0x17')]);router[_0xaa41('0x18')](_0xaa41('0x19'),auth[_0xaa41('0xc')](),controller[_0xaa41('0x1a')]);module[_0xaa41('0x1b')]=router; \ No newline at end of file +var _0x3e74=['path','connect-timeout','express','../../components/interaction/service','./mailMessage.controller','get','isAuthenticated','index','describe','/:id','download','post','tracked','mailmessage:create','create','update','put','accept','/:id/reject','delete','destroy','multer'];(function(_0x5ecc4d,_0x192051){var _0x5412f3=function(_0xd38f1b){while(--_0xd38f1b){_0x5ecc4d['push'](_0x5ecc4d['shift']());}};_0x5412f3(++_0x192051);}(_0x3e74,0x175));var _0x43e7=function(_0x2cf987,_0x33206c){_0x2cf987=_0x2cf987-0x0;var _0x20159b=_0x3e74[_0x2cf987];return _0x20159b;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x43e7('0x4'));var config=require('../../config/environment');var controller=require(_0x43e7('0x5'));router[_0x43e7('0x6')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0x8')]);router[_0x43e7('0x6')]('/describe',auth[_0x43e7('0x7')](),controller[_0x43e7('0x9')]);router[_0x43e7('0x6')](_0x43e7('0xa'),auth[_0x43e7('0x7')](),controller['show']);router[_0x43e7('0x6')]('/:id/download',auth['isAuthenticated'](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth['isAuthenticated'](),interaction[_0x43e7('0xd')]('mail',_0x43e7('0xe')),controller[_0x43e7('0xf')]);router['put'](_0x43e7('0xa'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x10')]);router[_0x43e7('0x11')]('/:id/accept',auth['isAuthenticated'](),controller[_0x43e7('0x12')]);router[_0x43e7('0x11')](_0x43e7('0x13'),auth['isAuthenticated'](),controller['reject']);router[_0x43e7('0x14')](_0x43e7('0xa'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 8b482bf..d5f95e3 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 _0xd448=['medium','BOOLEAN','ENUM','out','STRING','DATE','INTEGER','lodash','exports','TEXT','long'];(function(_0x1cf5f4,_0x1c8185){var _0x340b7f=function(_0x249687){while(--_0x249687){_0x1cf5f4['push'](_0x1cf5f4['shift']());}};_0x340b7f(++_0x1c8185);}(_0xd448,0x172));var _0x8d44=function(_0x3266a6,_0x129966){_0x3266a6=_0x3266a6-0x0;var _0x10ee38=_0xd448[_0x3266a6];return _0x10ee38;};'use strict';var Sequelize=require('sequelize');var _=require(_0x8d44('0x0'));module[_0x8d44('0x1')]={'body':{'type':Sequelize[_0x8d44('0x2')](_0x8d44('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x8d44('0x2')](_0x8d44('0x4'))},'read':{'type':Sequelize[_0x8d44('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8d44('0x6')]('in',_0x8d44('0x7')),'defaultValue':_0x8d44('0x7'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x8d44('0x8')]},'to':{'type':Sequelize['TEXT']('long')},'cc':{'type':Sequelize[_0x8d44('0x2')](_0x8d44('0x3'))},'bcc':{'type':Sequelize[_0x8d44('0x2')](_0x8d44('0x3'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x8d44('0x9')]},'attach':{'type':Sequelize[_0x8d44('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x8d44('0x2')](_0x8d44('0x3'))},'originCc':{'type':Sequelize[_0x8d44('0x2')]('long')}}; \ No newline at end of file +var _0xe5af=['medium','ENUM','STRING','DATE','lodash','exports','long','TEXT'];(function(_0x5b5ae3,_0xff9830){var _0x242c57=function(_0x1f63ab){while(--_0x1f63ab){_0x5b5ae3['push'](_0x5b5ae3['shift']());}};_0x242c57(++_0xff9830);}(_0xe5af,0x9c));var _0xfe5a=function(_0x3d145d,_0x3aa561){_0x3d145d=_0x3d145d-0x0;var _0x200285=_0xe5af[_0x3d145d];return _0x200285;};'use strict';var Sequelize=require('sequelize');var _=require(_0xfe5a('0x0'));module[_0xfe5a('0x1')]={'body':{'type':Sequelize['TEXT'](_0xfe5a('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xfe5a('0x3')](_0xfe5a('0x4'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xfe5a('0x5')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xfe5a('0x6')](0x1fe)},'from':{'type':Sequelize[_0xfe5a('0x6')]},'to':{'type':Sequelize['TEXT']('long')},'cc':{'type':Sequelize[_0xfe5a('0x3')](_0xfe5a('0x2'))},'bcc':{'type':Sequelize[_0xfe5a('0x3')](_0xfe5a('0x2'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0xfe5a('0x7')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0xfe5a('0x7')]},'originTo':{'type':Sequelize[_0xfe5a('0x3')]('long')},'originCc':{'type':Sequelize[_0xfe5a('0x3')](_0xfe5a('0x2'))}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index af11cb6..1012e0f 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 _0xdca4=['describe','create','direction','out','secret','split','findOne','CmList','List','CmContact','updatedAt','DESC','MailServerOut','Smtp','isNil','service','host','secure','authentication','auth','user','pass','attachments','root','server/files/attachments','basename','Contacts','defaults','List\x20not\x20found','SendMail','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','mail-interactions','mail','read','format','UserId','Contact','get','MailInteraction','MailInteractionId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','manual','interface','SIP/%s','channel','event','accept','EventManager','reject','RejectMessage','rejectMessage','rejectmessage','join','server','files','message-%s.eml','from','createdAt','Attachment','Attachments','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','existsSync','push','build','writeFileSync','download','log','unlinkSync','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','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','MailMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','MailMessage','includeAll','include','findAll','rows','show','params','keys','length','options','body','find'];(function(_0x34ba28,_0x4d8b09){var _0x419217=function(_0x372a22){while(--_0x372a22){_0x34ba28['push'](_0x34ba28['shift']());}};_0x419217(++_0x4d8b09);}(_0xdca4,0x19e));var _0x4dca=function(_0x5ec274,_0x579cea){_0x5ec274=_0x5ec274-0x0;var _0x234dff=_0xdca4[_0x5ec274];return _0x234dff;};'use strict';var pdf=require(_0x4dca('0x0'));var emlformat=require(_0x4dca('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4dca('0x2'));var rp=require(_0x4dca('0x3'));var moment=require('moment');var BPromise=require(_0x4dca('0x4'));var Mustache=require(_0x4dca('0x5'));var util=require(_0x4dca('0x6'));var path=require(_0x4dca('0x7'));var sox=require(_0x4dca('0x8'));var csv=require(_0x4dca('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4dca('0xa'));var squel=require(_0x4dca('0xb'));var crypto=require('crypto');var jsforce=require(_0x4dca('0xc'));var deskjs=require(_0x4dca('0xd'));var toCsv=require(_0x4dca('0x9'));var querystring=require(_0x4dca('0xe'));var Papa=require(_0x4dca('0xf'));var Redis=require(_0x4dca('0x10'));var authService=require(_0x4dca('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4dca('0x12'));var hardwareService=require(_0x4dca('0x13'));var logger=require(_0x4dca('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x4dca('0x15'));var db=require(_0x4dca('0x16'))['db'];config[_0x4dca('0x17')]=_['defaults'](config[_0x4dca('0x17')],{'host':_0x4dca('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4dca('0x17')]));require('./mailMessage.socket')['register'](socket);var jayson=require(_0x4dca('0x19'));var client=jayson['client']['http']({'port':0x232c});var client9003=jayson['client'][_0x4dca('0x1a')]({'port':0x232b});var client9002=jayson[_0x4dca('0x1b')][_0x4dca('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x4931c7,_0x407325,_0x418413){if(_0x418413){var _0xf16b88=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xf16b88[_0x4dca('0x1c')](_0x407325)){return _0x4931c7;}else{throw new db[(_0x4dca('0x1d'))][(_0x4dca('0x1e'))](_0x4dca('0x1f'));}}else{return _0x4931c7;}}function respondWithRpcPromise(_0x5de22e,_0x43bf97,_0x2c737f,_0x2cf47e){return new BPromise(function(_0x3fdd31,_0x58389a){var _0x5a932a=_0x2cf47e||client;return _0x5a932a[_0x4dca('0x20')](_0x5de22e,_0x2c737f)[_0x4dca('0x21')](function(_0x244061){logger[_0x4dca('0x22')](_0x4dca('0x23'),_0x43bf97,'request\x20sent');logger[_0x4dca('0x24')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x43bf97,_0x4dca('0x25'),JSON[_0x4dca('0x26')](_0x244061));if(_0x244061[_0x4dca('0x27')]){if(_0x244061['error'][_0x4dca('0x28')]===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x43bf97,_0x244061['error']['message']);return _0x58389a(_0x244061['error'][_0x4dca('0x29')]);}logger[_0x4dca('0x27')]('MailMessage,\x20%s,\x20%s',_0x43bf97,_0x244061[_0x4dca('0x27')]['message']);return _0x3fdd31(_0x244061[_0x4dca('0x27')][_0x4dca('0x29')]);}else{logger['info'](_0x4dca('0x23'),_0x43bf97,_0x4dca('0x25'));_0x3fdd31(_0x244061[_0x4dca('0x2a')]['message']);}})[_0x4dca('0x2b')](function(_0x32ba7d){logger[_0x4dca('0x27')](_0x4dca('0x23'),_0x43bf97,_0x32ba7d);_0x58389a(_0x32ba7d);});});}function respondWithStatusCode(_0x3644c2,_0x459a63){_0x459a63=_0x459a63||0xcc;return function(_0x24b650){if(_0x24b650){return _0x3644c2[_0x4dca('0x2c')](_0x459a63);}return _0x3644c2[_0x4dca('0x2d')](_0x459a63)[_0x4dca('0x2e')]();};}function respondWithResult(_0x5a48c7,_0x244ae1){_0x244ae1=_0x244ae1||0xc8;return function(_0x13c762){if(_0x13c762){return _0x5a48c7['status'](_0x244ae1)[_0x4dca('0x2f')](_0x13c762);}};}function respondWithFilteredResult(_0xaa9663,_0x49985b){return function(_0x187ee1){if(_0x187ee1){var _0xae1b5f=_0x187ee1[_0x4dca('0x30')],_0x22057c=_0x49985b['offset'],_0x26cd46=_0x49985b[_0x4dca('0x31')]+_0x49985b[_0x4dca('0x32')],_0x4f0c84;if(_0x26cd46>=_0xae1b5f){_0x26cd46=_0xae1b5f;_0x4f0c84=0xc8;}else{_0x4f0c84=0xce;}_0xaa9663[_0x4dca('0x2d')](_0x4f0c84);return _0xaa9663[_0x4dca('0x33')](_0x4dca('0x34'),_0x22057c+'-'+_0x26cd46+'/'+_0xae1b5f)[_0x4dca('0x2f')](_0x187ee1);}return null;};}function patchUpdates(_0x4e8e30){return function(_0x52d8ae){try{jsonpatch[_0x4dca('0x35')](_0x52d8ae,_0x4e8e30,!![]);}catch(_0x4ffa73){return BPromise['reject'](_0x4ffa73);}return _0x52d8ae[_0x4dca('0x36')]();};}function saveUpdates(_0x17559e,_0x4f5b3a){return function(_0x84b1f6){if(_0x84b1f6){return _0x84b1f6[_0x4dca('0x37')](_0x17559e)[_0x4dca('0x21')](function(_0x25076a){return _0x25076a;});}return null;};}function removeEntity(_0x1280c0,_0x512b68){return function(_0x2a07d8){if(_0x2a07d8){return _0x2a07d8[_0x4dca('0x38')]()[_0x4dca('0x21')](function(){_0x1280c0[_0x4dca('0x2d')](0xcc)[_0x4dca('0x2e')]();});}};}function handleEntityNotFound(_0x488d8c,_0x24d670){return function(_0x176c70){if(!_0x176c70){_0x488d8c[_0x4dca('0x2c')](0x194);}return _0x176c70;};}function handleError(_0x56b8cb,_0x31a419){_0x31a419=_0x31a419||0x1f4;return function(_0xebd6d0){logger['error'](_0xebd6d0[_0x4dca('0x39')]);if(_0xebd6d0['name']){delete _0xebd6d0[_0x4dca('0x3a')];}_0x56b8cb[_0x4dca('0x2d')](_0x31a419)['send'](_0xebd6d0);};}exports[_0x4dca('0x3b')]=function(_0x5f2a7b,_0x2bf868){var _0x5ab66c={},_0x30b63d={},_0xf913d={'count':0x0,'rows':[]};var _0x147c5c=_[_0x4dca('0x3c')](db['MailMessage'][_0x4dca('0x3d')],function(_0x931a90){return{'name':_0x931a90[_0x4dca('0x3e')],'type':_0x931a90['type'][_0x4dca('0x3f')]};});_0x30b63d[_0x4dca('0x40')]=_[_0x4dca('0x3c')](_0x147c5c,'name');_0x30b63d[_0x4dca('0x41')]=_['keys'](_0x5f2a7b['query']);_0x30b63d[_0x4dca('0x42')]=_[_0x4dca('0x43')](_0x30b63d[_0x4dca('0x40')],_0x30b63d[_0x4dca('0x41')]);_0x5ab66c[_0x4dca('0x44')]=_[_0x4dca('0x43')](_0x30b63d[_0x4dca('0x40')],qs[_0x4dca('0x45')](_0x5f2a7b[_0x4dca('0x41')][_0x4dca('0x45')]));_0x5ab66c[_0x4dca('0x44')]=_0x5ab66c[_0x4dca('0x44')]['length']?_0x5ab66c[_0x4dca('0x44')]:_0x30b63d[_0x4dca('0x40')];if(!_0x5f2a7b[_0x4dca('0x41')][_0x4dca('0x46')](_0x4dca('0x47'))){_0x5ab66c[_0x4dca('0x32')]=qs[_0x4dca('0x32')](_0x5f2a7b[_0x4dca('0x41')][_0x4dca('0x32')]);_0x5ab66c[_0x4dca('0x31')]=qs[_0x4dca('0x31')](_0x5f2a7b['query'][_0x4dca('0x31')]);}_0x5ab66c['order']=qs[_0x4dca('0x48')](_0x5f2a7b[_0x4dca('0x41')][_0x4dca('0x48')]);_0x5ab66c[_0x4dca('0x49')]=qs[_0x4dca('0x42')](_[_0x4dca('0x4a')](_0x5f2a7b[_0x4dca('0x41')],_0x30b63d['filters']));if(_0x5f2a7b['query'][_0x4dca('0x4b')]){_0x5ab66c['where']=_[_0x4dca('0x4c')](_0x5ab66c['where'],{'$or':_['map'](_0x147c5c,function(_0xae4be2){if(_0xae4be2[_0x4dca('0x4d')]!=='VIRTUAL'){var _0x1b75ed={};_0x1b75ed[_0xae4be2[_0x4dca('0x3a')]]={'$like':'%'+_0x5f2a7b[_0x4dca('0x41')][_0x4dca('0x4b')]+'%'};return _0x1b75ed;}})});}_0x5ab66c=_[_0x4dca('0x4c')]({},_0x5ab66c,_0x5f2a7b['options']);var _0x12fb78={'where':_0x5ab66c[_0x4dca('0x49')]};return db[_0x4dca('0x4e')][_0x4dca('0x30')](_0x12fb78)['then'](function(_0x54bb5a){_0xf913d[_0x4dca('0x30')]=_0x54bb5a;if(_0x5f2a7b['query'][_0x4dca('0x4f')]){_0x5ab66c[_0x4dca('0x50')]=[{'all':!![]}];}return db[_0x4dca('0x4e')][_0x4dca('0x51')](_0x5ab66c);})[_0x4dca('0x21')](function(_0x17a25a){_0xf913d[_0x4dca('0x52')]=_0x17a25a;return _0xf913d;})[_0x4dca('0x21')](respondWithFilteredResult(_0x2bf868,_0x5ab66c))[_0x4dca('0x2b')](handleError(_0x2bf868,null));};exports[_0x4dca('0x53')]=function(_0x194361,_0x25c95a){var _0x34b220={'raw':!![],'where':{'id':_0x194361[_0x4dca('0x54')]['id']}},_0x44be8d={};_0x44be8d['model']=_[_0x4dca('0x55')](db[_0x4dca('0x4e')]['rawAttributes']);_0x44be8d[_0x4dca('0x41')]=_[_0x4dca('0x55')](_0x194361[_0x4dca('0x41')]);_0x44be8d[_0x4dca('0x42')]=_['intersection'](_0x44be8d[_0x4dca('0x40')],_0x44be8d[_0x4dca('0x41')]);_0x34b220['attributes']=_[_0x4dca('0x43')](_0x44be8d['model'],qs[_0x4dca('0x45')](_0x194361[_0x4dca('0x41')]['fields']));_0x34b220['attributes']=_0x34b220['attributes'][_0x4dca('0x56')]?_0x34b220[_0x4dca('0x44')]:_0x44be8d['model'];if(_0x194361['query'][_0x4dca('0x4f')]){_0x34b220[_0x4dca('0x50')]=[{'all':!![]}];}_0x34b220=_[_0x4dca('0x4c')]({},_0x34b220,_0x194361[_0x4dca('0x57')]);return db[_0x4dca('0x4e')]['find'](_0x34b220)[_0x4dca('0x21')](handleEntityNotFound(_0x25c95a,null))[_0x4dca('0x21')](respondWithResult(_0x25c95a,null))[_0x4dca('0x2b')](handleError(_0x25c95a,null));};exports['update']=function(_0x27ce7f,_0x36a46b){if(_0x27ce7f[_0x4dca('0x58')]['id']){delete _0x27ce7f[_0x4dca('0x58')]['id'];}return db[_0x4dca('0x4e')][_0x4dca('0x59')]({'where':{'id':_0x27ce7f['params']['id']}})[_0x4dca('0x21')](handleEntityNotFound(_0x36a46b,null))[_0x4dca('0x21')](saveUpdates(_0x27ce7f['body'],null))[_0x4dca('0x21')](respondWithResult(_0x36a46b,null))[_0x4dca('0x2b')](handleError(_0x36a46b,null));};exports[_0x4dca('0x38')]=function(_0x5b7c7b,_0x4ae6cd){return db[_0x4dca('0x4e')][_0x4dca('0x59')]({'where':{'id':_0x5b7c7b['params']['id']}})[_0x4dca('0x21')](handleEntityNotFound(_0x4ae6cd,null))[_0x4dca('0x21')](removeEntity(_0x4ae6cd,null))[_0x4dca('0x2b')](handleError(_0x4ae6cd,null));};exports[_0x4dca('0x5a')]=function(_0x43f374,_0x3415a0){return db[_0x4dca('0x4e')][_0x4dca('0x5a')]()['then'](respondWithResult(_0x3415a0,null))[_0x4dca('0x2b')](handleError(_0x3415a0,null));};exports[_0x4dca('0x5b')]=function(_0x4e88e8,_0x315833){return db[_0x4dca('0x4e')]['create'](_0x4e88e8[_0x4dca('0x58')])['then'](function(_0x475a6e){if(_0x475a6e){if(_0x475a6e[_0x4dca('0x5c')]===_0x4dca('0x5d')&&!_0x475a6e[_0x4dca('0x5e')]){var _0x51ad92,_0x150172,_0x5a7c36;if(_0x4e88e8[_0x4dca('0x58')]['to']){_0x150172=_0x4e88e8[_0x4dca('0x58')]['to'][_0x4dca('0x5f')](',')[0x0];}return db['MailAccount'][_0x4dca('0x60')]({'where':{'id':_0x475a6e['MailAccountId']},'include':[{'model':db[_0x4dca('0x61')],'as':_0x4dca('0x62'),'include':[{'model':db[_0x4dca('0x63')],'as':'Contacts','where':{'email':_0x150172},'limit':0x1,'order':[[_0x4dca('0x64'),_0x4dca('0x65')]]}]},{'model':db[_0x4dca('0x66')],'as':'Smtp','raw':!![]}]})['then'](function(_0x46be52){_0x51ad92=_0x46be52;if(_0x51ad92&&_0x51ad92[_0x4dca('0x67')]){var _0x404097={'tls':{'rejectUnauthorized':![]}};if(_[_0x4dca('0x68')](_0x51ad92[_0x4dca('0x67')][_0x4dca('0x69')])){_0x404097[_0x4dca('0x6a')]=_0x51ad92[_0x4dca('0x67')][_0x4dca('0x6a')];_0x404097['port']=_0x51ad92['Smtp']['port'];_0x404097[_0x4dca('0x6b')]=_0x51ad92[_0x4dca('0x67')][_0x4dca('0x6b')];if(_0x51ad92[_0x4dca('0x67')][_0x4dca('0x6c')]){_0x404097[_0x4dca('0x6d')]={'user':_0x51ad92[_0x4dca('0x67')][_0x4dca('0x6e')],'pass':_0x51ad92[_0x4dca('0x67')]['pass']};}}else{_0x404097[_0x4dca('0x69')]=_0x51ad92[_0x4dca('0x67')]['service'];_0x404097['auth']={'user':_0x51ad92[_0x4dca('0x67')][_0x4dca('0x6e')],'pass':_0x51ad92[_0x4dca('0x67')][_0x4dca('0x6f')]};_0x404097['secure']=_0x51ad92['Smtp'][_0x4dca('0x6b')];}if(_0x4e88e8[_0x4dca('0x58')][_0x4dca('0x70')]&&_0x4e88e8[_0x4dca('0x58')][_0x4dca('0x70')]['length']){for(var _0xe22e96=0x0;_0xe22e96<_0x4e88e8[_0x4dca('0x58')]['attachments'][_0x4dca('0x56')];_0xe22e96+=0x1){_0x4e88e8[_0x4dca('0x58')][_0x4dca('0x70')][_0xe22e96]={'filename':_0x4e88e8[_0x4dca('0x58')]['attachments'][_0xe22e96][_0x4dca('0x3a')],'path':path['join'](config[_0x4dca('0x71')],_0x4dca('0x72'),_0x4e88e8[_0x4dca('0x58')][_0x4dca('0x70')][_0xe22e96][_0x4dca('0x73')])};}}_0x5a7c36={'account':_0x404097,'message':_0x4e88e8[_0x4dca('0x58')]};return;}})[_0x4dca('0x21')](function(){if(_0x51ad92[_0x4dca('0x62')]){if(_0x51ad92[_0x4dca('0x62')][_0x4dca('0x74')][_0x4dca('0x56')]){return _0x51ad92[_0x4dca('0x62')][_0x4dca('0x74')][0x0];}else{return db['CmContact'][_0x4dca('0x5b')](_[_0x4dca('0x75')](_0x4e88e8[_0x4dca('0x58')],{'firstName':_0x4e88e8['body']['to'],'email':_0x4e88e8[_0x4dca('0x58')]['to'],'phone':_0x4e88e8[_0x4dca('0x58')]['to'],'ListId':_0x51ad92['ListId']}));}}else{throw new Error(_0x4dca('0x76'));}})['then'](function(){if(_0x5a7c36){return respondWithRpcPromise(_0x4dca('0x77'),_0x4dca('0x78'),_0x5a7c36,client9003)[_0x4dca('0x21')](function(_0x4508b2){return _0x475a6e[_0x4dca('0x37')]({'read':!![],'messageId':_0x4508b2[_0x4dca('0x79')],'sentAt':moment()['format'](_0x4dca('0x7a'))});})[_0x4dca('0x2b')](function(_0x1f3d5f){logger[_0x4dca('0x27')]('%s',JSON[_0x4dca('0x26')](_0x1f3d5f));return _0x475a6e;});}return _0x475a6e;});}return _0x475a6e;}})[_0x4dca('0x21')](respondWithResult(_0x315833,0xc9))[_0x4dca('0x2b')](handleError(_0x315833,null));};var interaction_log=require(_0x4dca('0x14'))(_0x4dca('0x7b'));exports['accept']=function(_0x28ad9e,_0x2215d2,_0xef3952){var _0x1ce7da={'channel':_0x4dca('0x7c')};if(_0x28ad9e[_0x4dca('0x58')]['id']){delete _0x28ad9e['body']['id'];}_0x28ad9e[_0x4dca('0x58')][_0x4dca('0x7d')]=!![];_0x28ad9e['body']['readAt']=moment()[_0x4dca('0x7e')](_0x4dca('0x7a'));_0x28ad9e[_0x4dca('0x58')]['UserId']=_0x28ad9e[_0x4dca('0x58')][_0x4dca('0x7f')]||_0x28ad9e[_0x4dca('0x6e')]['id'];return db['MailMessage'][_0x4dca('0x59')]({'where':{'id':_0x28ad9e['params']['id'],'UserId':null},'include':[{'model':db[_0x4dca('0x63')],'as':_0x4dca('0x80')}]})[_0x4dca('0x21')](handleEntityNotFound(_0x2215d2,null))[_0x4dca('0x21')](saveUpdates(_0x28ad9e[_0x4dca('0x58')],null))[_0x4dca('0x21')](function(_0x5344ee){if(_0x5344ee){_0x1ce7da[_0x4dca('0x29')]=_0x5344ee[_0x4dca('0x81')]({'plain':!![]});return db[_0x4dca('0x82')]['find']({'where':{'id':_0x5344ee[_0x4dca('0x83')]}});}return null;})['then'](handleEntityNotFound(_0x2215d2,null))['then'](function(_0x5bd4d8){if(_0x5bd4d8){return _0x5bd4d8[_0x4dca('0x37')]({'UserId':_0x28ad9e['body']['UserId'],'read1stAt':_[_0x4dca('0x68')](_0x5bd4d8[_0x4dca('0x84')])?moment()[_0x4dca('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x4dca('0x21')](function(_0x16402c){if(_0x16402c){_0x1ce7da[_0x4dca('0x85')]=_0x16402c['get']({'plain':!![]});interaction_log[_0x4dca('0x22')](_0x4dca('0x86'),_0x28ad9e[_0x4dca('0x6e')]['id'],_0x28ad9e[_0x4dca('0x6e')][_0x4dca('0x3a')],_0x28ad9e[_0x4dca('0x6e')][_0x4dca('0x87')],_0x1ce7da[_0x4dca('0x85')]['id'],_0x28ad9e[_0x4dca('0x58')]?JSON[_0x4dca('0x26')](_0x28ad9e[_0x4dca('0x58')]):_0x4dca('0x88'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x1ce7da);}return null;})['then'](function(_0x57ff89){if(_0x57ff89){if(_0x28ad9e['body'][_0x4dca('0x89')]){_0x1ce7da['message'][_0x4dca('0x8a')]=util[_0x4dca('0x7e')](_0x4dca('0x8b'),_0x28ad9e[_0x4dca('0x6e')][_0x4dca('0x3a')]);_0x1ce7da[_0x4dca('0x29')]['channel']=_0x1ce7da[_0x4dca('0x8c')];_0x1ce7da[_0x4dca('0x29')][_0x4dca('0x8d')]=_0x4dca('0x8e');return respondWithRpcPromise('EventManager',_0x4dca('0x8f'),{'event':'acceptmessage','message':_0x1ce7da[_0x4dca('0x29')]},client9002)[_0x4dca('0x21')](function(){return _0x1ce7da;});}return _0x1ce7da;}return null;})[_0x4dca('0x21')](respondWithResult(_0x2215d2,null))['catch'](handleError(_0x2215d2,null));};var interaction_log=require('../../config/logger')(_0x4dca('0x7b'));exports[_0x4dca('0x90')]=function(_0x4b190d,_0x46ac34,_0x2452e0){var _0x45ebb2={'agent':{},'channel':'mail'};if(_0x4b190d[_0x4dca('0x58')]['id']){delete _0x4b190d[_0x4dca('0x58')]['id'];}_0x4b190d[_0x4dca('0x58')][_0x4dca('0x7f')]=_0x4b190d[_0x4dca('0x58')][_0x4dca('0x7f')]||_0x4b190d[_0x4dca('0x6e')]['id'];_0x45ebb2['agent']['id']=_0x4b190d[_0x4dca('0x58')][_0x4dca('0x7f')];return db['MailMessage'][_0x4dca('0x59')]({'where':{'id':_0x4b190d[_0x4dca('0x54')]['id'],'UserId':null}})[_0x4dca('0x21')](handleEntityNotFound(_0x46ac34,null))[_0x4dca('0x21')](function(_0x12d27c){if(_0x12d27c){_0x45ebb2[_0x4dca('0x29')]=_0x12d27c['get']({'plain':!![]});return db[_0x4dca('0x82')][_0x4dca('0x59')]({'where':{'id':_0x12d27c[_0x4dca('0x83')]}});}return null;})[_0x4dca('0x21')](handleEntityNotFound(_0x46ac34,null))[_0x4dca('0x21')](function(_0x57be3d){if(_0x57be3d){_0x45ebb2[_0x4dca('0x85')]=_0x57be3d[_0x4dca('0x81')]({'plain':!![]});interaction_log[_0x4dca('0x22')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4b190d['user']['id'],_0x4b190d['user'][_0x4dca('0x3a')],_0x4b190d['user'][_0x4dca('0x87')],_0x45ebb2[_0x4dca('0x85')]['id'],_0x4b190d[_0x4dca('0x58')]?JSON[_0x4dca('0x26')](_0x4b190d[_0x4dca('0x58')]):_0x4dca('0x88'));return respondWithRpcPromise(_0x4dca('0x91'),_0x4dca('0x92'),_0x45ebb2);}return null;})[_0x4dca('0x21')](function(_0x44cab3){if(_0x44cab3){_0x44cab3[_0x4dca('0x29')][_0x4dca('0x8a')]=util[_0x4dca('0x7e')](_0x4dca('0x8b'),_0x4b190d[_0x4dca('0x6e')][_0x4dca('0x3a')]);_0x44cab3[_0x4dca('0x29')]['channel']=_0x45ebb2[_0x4dca('0x8c')];_0x44cab3['message']['event']=_0x4dca('0x90');respondWithRpcPromise(_0x4dca('0x8f'),_0x4dca('0x8f'),{'event':_0x4dca('0x93'),'message':_0x44cab3[_0x4dca('0x29')]},client9002);return _0x45ebb2;}return null;})[_0x4dca('0x21')](respondWithResult(_0x46ac34,null))[_0x4dca('0x2b')](handleError(_0x46ac34,null));};exports['download']=function(_0x4921dc,_0x10a8ab){var _0x3379e6=moment()['unix']()['toString']();var _0x586c25=path[_0x4dca('0x94')](config[_0x4dca('0x71')],_0x4dca('0x95'),_0x4dca('0x96'),'tmp');var _0x102081=path['join'](config['root'],_0x4dca('0x95'),_0x4dca('0x96'),_0x4dca('0x70'));var _0xfc3334=util[_0x4dca('0x7e')](_0x4dca('0x97'),_0x3379e6);return db[_0x4dca('0x4e')][_0x4dca('0x59')]({'where':{'id':_0x4921dc['params']['id']},'attributes':['id',_0x4dca('0x58'),_0x4dca('0x98'),'to','cc','bcc','subject',_0x4dca('0x99')],'include':_0x4921dc[_0x4dca('0x41')][_0x4dca('0x70')]?[{'model':db[_0x4dca('0x9a')],'as':_0x4dca('0x9b')}]:undefined})[_0x4dca('0x21')](handleEntityNotFound(_0x10a8ab,null))['then'](function(_0x849a30){if(_0x849a30){var _0x7c645e=_0x849a30;var _0x45384d={'from':_0x7c645e[_0x4dca('0x98')],'to':_0x7c645e['to'],'subject':_0x7c645e[_0x4dca('0x9c')],'html':_0x7c645e[_0x4dca('0x58')],'headers':{'Date':moment(_0x7c645e[_0x4dca('0x99')])['format'](_0x4dca('0x9d'))},'attachments':[]};if(_0x849a30['cc']){_0x45384d[_0x4dca('0x9e')]['Cc']=_0x849a30['cc'];}if(_0x849a30[_0x4dca('0x9f')]){_0x45384d[_0x4dca('0x9e')][_0x4dca('0xa0')]=_0x849a30['bcc'];}return new BPromise(function(_0x30781b,_0x222a81){if(_0x849a30[_0x4dca('0x9b')]){for(var _0x48d1e5=0x0;_0x48d1e5<_0x849a30['Attachments'][_0x4dca('0x56')];_0x48d1e5++){var _0x8e62c3=_0x849a30['Attachments'][_0x48d1e5];var _0x1de4a3=path[_0x4dca('0x94')](_0x102081,_0x8e62c3[_0x4dca('0x73')]);if(fs[_0x4dca('0xa1')](_0x1de4a3)){_0x45384d['attachments'][_0x4dca('0xa2')]({'name':_0x8e62c3['name'],'contentType':_0x8e62c3[_0x4dca('0x4d')],'data':fs['readFileSync'](_0x1de4a3)});}}}emlformat[_0x4dca('0xa3')](_0x45384d,function(_0x53d925,_0x45c379){if(_0x53d925)return _0x222a81(_0x53d925);fs[_0x4dca('0xa4')](path['join'](_0x586c25,_0xfc3334),_0x45c379);return _0x30781b(_0x45c379);});});}})['then'](function(_0x3ad342){if(_0x3ad342){return _0x10a8ab[_0x4dca('0xa5')](path[_0x4dca('0x94')](_0x586c25,_0xfc3334),_0xfc3334,function(_0x381bc){if(_0x381bc){console[_0x4dca('0xa6')]('err',_0x381bc);}else{fs[_0x4dca('0xa7')](path[_0x4dca('0x94')](_0x586c25,_0xfc3334));}});}})[_0x4dca('0x2b')](handleError(_0x10a8ab,null));}; \ No newline at end of file +var _0x9f0e=['sendStatus','stack','name','send','index','fieldName','type','key','model','map','keys','filters','query','attributes','fields','length','hasOwnProperty','offset','order','sort','pick','filter','merge','where','VIRTUAL','options','MailMessage','includeAll','rows','params','rawAttributes','intersection','include','find','body','describe','create','direction','out','split','MailAccount','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','auth','user','pass','attachments','join','server/files/attachments','basename','defaults','ListId','List\x20not\x20found','YYYY-MM-DD\x20HH:mm:ss','mail-interactions','accept','read','UserId','Contact','get','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','interface','SIP/%s','channel','event','EventManager','acceptmessage','mail','agent','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectmessage','download','unix','toString','root','server','files','format','from','bcc','subject','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','push','readFileSync','writeFileSync','err','unlinkSync','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','socket.io-emitter','./mailMessage.socket','jayson/promise','client','http','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','status','end','count','limit','set','json','apply','reject','save','update','destroy'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x9f0e,0x111));var _0xe9f0=function(_0xee9611,_0x59e13c){_0xee9611=_0xee9611-0x0;var _0x1d2c94=_0x9f0e[_0xee9611];return _0x1d2c94;};'use strict';var pdf=require(_0xe9f0('0x0'));var emlformat=require(_0xe9f0('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe9f0('0x2'));var jsonpatch=require(_0xe9f0('0x3'));var rp=require(_0xe9f0('0x4'));var moment=require(_0xe9f0('0x5'));var BPromise=require(_0xe9f0('0x6'));var Mustache=require(_0xe9f0('0x7'));var util=require(_0xe9f0('0x8'));var path=require(_0xe9f0('0x9'));var sox=require(_0xe9f0('0xa'));var csv=require(_0xe9f0('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe9f0('0xc'));var squel=require(_0xe9f0('0xd'));var crypto=require('crypto');var jsforce=require(_0xe9f0('0xe'));var deskjs=require(_0xe9f0('0xf'));var toCsv=require(_0xe9f0('0xb'));var querystring=require(_0xe9f0('0x10'));var Papa=require(_0xe9f0('0x11'));var Redis=require(_0xe9f0('0x12'));var authService=require(_0xe9f0('0x13'));var qs=require(_0xe9f0('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe9f0('0x15'));var logger=require(_0xe9f0('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xe9f0('0x17'));var db=require(_0xe9f0('0x18'))['db'];config[_0xe9f0('0x19')]=_['defaults'](config[_0xe9f0('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xe9f0('0x1a'))(new Redis(config['redis']));require(_0xe9f0('0x1b'))['register'](socket);var jayson=require(_0xe9f0('0x1c'));var client=jayson[_0xe9f0('0x1d')][_0xe9f0('0x1e')]({'port':0x232c});var client9003=jayson[_0xe9f0('0x1d')][_0xe9f0('0x1e')]({'port':0x232b});var client9002=jayson['client'][_0xe9f0('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x5a2549,_0x5efc61,_0x369287){if(_0x369287){var _0x470a8c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x470a8c['test'](_0x5efc61)){return _0x5a2549;}else{throw new db['Sequelize']['ValidationError'](_0xe9f0('0x1f'));}}else{return _0x5a2549;}}function respondWithRpcPromise(_0x501089,_0x5096d3,_0x5752d8,_0x22404b){return new BPromise(function(_0x2f1c01,_0x36dee6){var _0x1f1780=_0x22404b||client;return _0x1f1780[_0xe9f0('0x20')](_0x501089,_0x5752d8)[_0xe9f0('0x21')](function(_0x65bcdb){logger[_0xe9f0('0x22')]('MailMessage,\x20%s,\x20%s',_0x5096d3,_0xe9f0('0x23'));logger['debug'](_0xe9f0('0x24'),_0x5096d3,'request\x20sent',JSON[_0xe9f0('0x25')](_0x65bcdb));if(_0x65bcdb[_0xe9f0('0x26')]){if(_0x65bcdb[_0xe9f0('0x26')][_0xe9f0('0x27')]===0x1f4){logger[_0xe9f0('0x26')](_0xe9f0('0x28'),_0x5096d3,_0x65bcdb[_0xe9f0('0x26')]['message']);return _0x36dee6(_0x65bcdb['error'][_0xe9f0('0x29')]);}logger['error'](_0xe9f0('0x28'),_0x5096d3,_0x65bcdb[_0xe9f0('0x26')]['message']);return _0x2f1c01(_0x65bcdb[_0xe9f0('0x26')][_0xe9f0('0x29')]);}else{logger[_0xe9f0('0x22')]('MailMessage,\x20%s,\x20%s',_0x5096d3,'request\x20sent');_0x2f1c01(_0x65bcdb[_0xe9f0('0x2a')][_0xe9f0('0x29')]);}})[_0xe9f0('0x2b')](function(_0x1f4b8b){logger[_0xe9f0('0x26')](_0xe9f0('0x28'),_0x5096d3,_0x1f4b8b);_0x36dee6(_0x1f4b8b);});});}function respondWithStatusCode(_0x40d5dd,_0x2cd187){_0x2cd187=_0x2cd187||0xcc;return function(_0x7ff662){if(_0x7ff662){return _0x40d5dd['sendStatus'](_0x2cd187);}return _0x40d5dd[_0xe9f0('0x2c')](_0x2cd187)[_0xe9f0('0x2d')]();};}function respondWithResult(_0x3db536,_0x299524){_0x299524=_0x299524||0xc8;return function(_0x95eb06){if(_0x95eb06){return _0x3db536['status'](_0x299524)['json'](_0x95eb06);}};}function respondWithFilteredResult(_0x316eb1,_0x16784d){return function(_0x21ad89){if(_0x21ad89){var _0x3247ea=_0x21ad89[_0xe9f0('0x2e')],_0x15586a=_0x16784d['offset'],_0x38b2c5=_0x16784d['offset']+_0x16784d[_0xe9f0('0x2f')],_0x1f002e;if(_0x38b2c5>=_0x3247ea){_0x38b2c5=_0x3247ea;_0x1f002e=0xc8;}else{_0x1f002e=0xce;}_0x316eb1[_0xe9f0('0x2c')](_0x1f002e);return _0x316eb1[_0xe9f0('0x30')]('Content-Range',_0x15586a+'-'+_0x38b2c5+'/'+_0x3247ea)[_0xe9f0('0x31')](_0x21ad89);}return null;};}function patchUpdates(_0x3a9861){return function(_0x27c2da){try{jsonpatch[_0xe9f0('0x32')](_0x27c2da,_0x3a9861,!![]);}catch(_0x478385){return BPromise[_0xe9f0('0x33')](_0x478385);}return _0x27c2da[_0xe9f0('0x34')]();};}function saveUpdates(_0x40e530,_0x1bdbb4){return function(_0x1cdf0d){if(_0x1cdf0d){return _0x1cdf0d[_0xe9f0('0x35')](_0x40e530)[_0xe9f0('0x21')](function(_0x57302d){return _0x57302d;});}return null;};}function removeEntity(_0x5334aa,_0x1e9d3f){return function(_0x41cf8f){if(_0x41cf8f){return _0x41cf8f[_0xe9f0('0x36')]()[_0xe9f0('0x21')](function(){_0x5334aa[_0xe9f0('0x2c')](0xcc)[_0xe9f0('0x2d')]();});}};}function handleEntityNotFound(_0x5bcc7d,_0x44f852){return function(_0x17cfed){if(!_0x17cfed){_0x5bcc7d[_0xe9f0('0x37')](0x194);}return _0x17cfed;};}function handleError(_0x2f8845,_0x4e151f){_0x4e151f=_0x4e151f||0x1f4;return function(_0x24bf8d){logger['error'](_0x24bf8d[_0xe9f0('0x38')]);if(_0x24bf8d[_0xe9f0('0x39')]){delete _0x24bf8d[_0xe9f0('0x39')];}_0x2f8845[_0xe9f0('0x2c')](_0x4e151f)[_0xe9f0('0x3a')](_0x24bf8d);};}exports[_0xe9f0('0x3b')]=function(_0x1061c9,_0x20a819){var _0x2243fe={},_0x52e614={},_0x3f4195={'count':0x0,'rows':[]};var _0x44c1a5=_['map'](db['MailMessage']['rawAttributes'],function(_0x611d3e){return{'name':_0x611d3e[_0xe9f0('0x3c')],'type':_0x611d3e[_0xe9f0('0x3d')][_0xe9f0('0x3e')]};});_0x52e614[_0xe9f0('0x3f')]=_[_0xe9f0('0x40')](_0x44c1a5,_0xe9f0('0x39'));_0x52e614['query']=_[_0xe9f0('0x41')](_0x1061c9['query']);_0x52e614[_0xe9f0('0x42')]=_['intersection'](_0x52e614[_0xe9f0('0x3f')],_0x52e614[_0xe9f0('0x43')]);_0x2243fe[_0xe9f0('0x44')]=_['intersection'](_0x52e614[_0xe9f0('0x3f')],qs['fields'](_0x1061c9[_0xe9f0('0x43')][_0xe9f0('0x45')]));_0x2243fe[_0xe9f0('0x44')]=_0x2243fe[_0xe9f0('0x44')][_0xe9f0('0x46')]?_0x2243fe[_0xe9f0('0x44')]:_0x52e614[_0xe9f0('0x3f')];if(!_0x1061c9[_0xe9f0('0x43')][_0xe9f0('0x47')]('nolimit')){_0x2243fe[_0xe9f0('0x2f')]=qs[_0xe9f0('0x2f')](_0x1061c9[_0xe9f0('0x43')][_0xe9f0('0x2f')]);_0x2243fe[_0xe9f0('0x48')]=qs[_0xe9f0('0x48')](_0x1061c9[_0xe9f0('0x43')][_0xe9f0('0x48')]);}_0x2243fe[_0xe9f0('0x49')]=qs[_0xe9f0('0x4a')](_0x1061c9[_0xe9f0('0x43')]['sort']);_0x2243fe['where']=qs[_0xe9f0('0x42')](_[_0xe9f0('0x4b')](_0x1061c9[_0xe9f0('0x43')],_0x52e614[_0xe9f0('0x42')]));if(_0x1061c9['query'][_0xe9f0('0x4c')]){_0x2243fe['where']=_[_0xe9f0('0x4d')](_0x2243fe[_0xe9f0('0x4e')],{'$or':_['map'](_0x44c1a5,function(_0x44764c){if(_0x44764c[_0xe9f0('0x3d')]!==_0xe9f0('0x4f')){var _0x10a139={};_0x10a139[_0x44764c[_0xe9f0('0x39')]]={'$like':'%'+_0x1061c9['query']['filter']+'%'};return _0x10a139;}})});}_0x2243fe=_[_0xe9f0('0x4d')]({},_0x2243fe,_0x1061c9[_0xe9f0('0x50')]);var _0x57a45d={'where':_0x2243fe[_0xe9f0('0x4e')]};return db[_0xe9f0('0x51')][_0xe9f0('0x2e')](_0x57a45d)['then'](function(_0x2e6c2e){_0x3f4195[_0xe9f0('0x2e')]=_0x2e6c2e;if(_0x1061c9['query'][_0xe9f0('0x52')]){_0x2243fe['include']=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x2243fe);})[_0xe9f0('0x21')](function(_0x547ba2){_0x3f4195[_0xe9f0('0x53')]=_0x547ba2;return _0x3f4195;})[_0xe9f0('0x21')](respondWithFilteredResult(_0x20a819,_0x2243fe))['catch'](handleError(_0x20a819,null));};exports['show']=function(_0x149dac,_0x2bbbc2){var _0x53453b={'raw':!![],'where':{'id':_0x149dac[_0xe9f0('0x54')]['id']}},_0x3fd7c6={};_0x3fd7c6['model']=_[_0xe9f0('0x41')](db[_0xe9f0('0x51')][_0xe9f0('0x55')]);_0x3fd7c6[_0xe9f0('0x43')]=_[_0xe9f0('0x41')](_0x149dac[_0xe9f0('0x43')]);_0x3fd7c6[_0xe9f0('0x42')]=_[_0xe9f0('0x56')](_0x3fd7c6[_0xe9f0('0x3f')],_0x3fd7c6[_0xe9f0('0x43')]);_0x53453b[_0xe9f0('0x44')]=_[_0xe9f0('0x56')](_0x3fd7c6[_0xe9f0('0x3f')],qs[_0xe9f0('0x45')](_0x149dac[_0xe9f0('0x43')][_0xe9f0('0x45')]));_0x53453b[_0xe9f0('0x44')]=_0x53453b[_0xe9f0('0x44')][_0xe9f0('0x46')]?_0x53453b[_0xe9f0('0x44')]:_0x3fd7c6['model'];if(_0x149dac[_0xe9f0('0x43')][_0xe9f0('0x52')]){_0x53453b[_0xe9f0('0x57')]=[{'all':!![]}];}_0x53453b=_[_0xe9f0('0x4d')]({},_0x53453b,_0x149dac[_0xe9f0('0x50')]);return db['MailMessage'][_0xe9f0('0x58')](_0x53453b)['then'](handleEntityNotFound(_0x2bbbc2,null))[_0xe9f0('0x21')](respondWithResult(_0x2bbbc2,null))['catch'](handleError(_0x2bbbc2,null));};exports[_0xe9f0('0x35')]=function(_0x367f51,_0x547409){if(_0x367f51[_0xe9f0('0x59')]['id']){delete _0x367f51['body']['id'];}return db[_0xe9f0('0x51')][_0xe9f0('0x58')]({'where':{'id':_0x367f51[_0xe9f0('0x54')]['id']}})[_0xe9f0('0x21')](handleEntityNotFound(_0x547409,null))['then'](saveUpdates(_0x367f51['body'],null))['then'](respondWithResult(_0x547409,null))[_0xe9f0('0x2b')](handleError(_0x547409,null));};exports['destroy']=function(_0x3281a0,_0xb69a9){return db[_0xe9f0('0x51')]['find']({'where':{'id':_0x3281a0[_0xe9f0('0x54')]['id']}})['then'](handleEntityNotFound(_0xb69a9,null))[_0xe9f0('0x21')](removeEntity(_0xb69a9,null))[_0xe9f0('0x2b')](handleError(_0xb69a9,null));};exports[_0xe9f0('0x5a')]=function(_0x47ffbe,_0x570d88){return db[_0xe9f0('0x51')][_0xe9f0('0x5a')]()[_0xe9f0('0x21')](respondWithResult(_0x570d88,null))[_0xe9f0('0x2b')](handleError(_0x570d88,null));};exports[_0xe9f0('0x5b')]=function(_0x26a987,_0x9be278){return db[_0xe9f0('0x51')][_0xe9f0('0x5b')](_0x26a987[_0xe9f0('0x59')])['then'](function(_0x1bbf2f){if(_0x1bbf2f){if(_0x1bbf2f[_0xe9f0('0x5c')]===_0xe9f0('0x5d')&&!_0x1bbf2f['secret']){var _0x3fa1fa,_0x2e036b,_0x4bec9f;if(_0x26a987[_0xe9f0('0x59')]['to']){_0x2e036b=_0x26a987[_0xe9f0('0x59')]['to'][_0xe9f0('0x5e')](',')[0x0];}return db[_0xe9f0('0x5f')]['findOne']({'where':{'id':_0x1bbf2f['MailAccountId']},'include':[{'model':db['CmList'],'as':_0xe9f0('0x60'),'include':[{'model':db[_0xe9f0('0x61')],'as':_0xe9f0('0x62'),'where':{'email':_0x2e036b},'limit':0x1,'order':[[_0xe9f0('0x63'),_0xe9f0('0x64')]]}]},{'model':db[_0xe9f0('0x65')],'as':_0xe9f0('0x66'),'raw':!![]}]})[_0xe9f0('0x21')](function(_0x82d200){_0x3fa1fa=_0x82d200;if(_0x3fa1fa&&_0x3fa1fa[_0xe9f0('0x66')]){var _0x1a3a7e={'tls':{'rejectUnauthorized':![]}};if(_[_0xe9f0('0x67')](_0x3fa1fa[_0xe9f0('0x66')][_0xe9f0('0x68')])){_0x1a3a7e[_0xe9f0('0x69')]=_0x3fa1fa[_0xe9f0('0x66')][_0xe9f0('0x69')];_0x1a3a7e[_0xe9f0('0x6a')]=_0x3fa1fa[_0xe9f0('0x66')][_0xe9f0('0x6a')];_0x1a3a7e[_0xe9f0('0x6b')]=_0x3fa1fa['Smtp'][_0xe9f0('0x6b')];if(_0x3fa1fa['Smtp']['authentication']){_0x1a3a7e[_0xe9f0('0x6c')]={'user':_0x3fa1fa['Smtp'][_0xe9f0('0x6d')],'pass':_0x3fa1fa[_0xe9f0('0x66')][_0xe9f0('0x6e')]};}}else{_0x1a3a7e['service']=_0x3fa1fa[_0xe9f0('0x66')][_0xe9f0('0x68')];_0x1a3a7e[_0xe9f0('0x6c')]={'user':_0x3fa1fa[_0xe9f0('0x66')][_0xe9f0('0x6d')],'pass':_0x3fa1fa[_0xe9f0('0x66')][_0xe9f0('0x6e')]};_0x1a3a7e[_0xe9f0('0x6b')]=_0x3fa1fa[_0xe9f0('0x66')]['secure'];}if(_0x26a987[_0xe9f0('0x59')][_0xe9f0('0x6f')]&&_0x26a987[_0xe9f0('0x59')][_0xe9f0('0x6f')]['length']){for(var _0x155312=0x0;_0x155312<_0x26a987['body'][_0xe9f0('0x6f')][_0xe9f0('0x46')];_0x155312+=0x1){_0x26a987[_0xe9f0('0x59')][_0xe9f0('0x6f')][_0x155312]={'filename':_0x26a987[_0xe9f0('0x59')]['attachments'][_0x155312][_0xe9f0('0x39')],'path':path[_0xe9f0('0x70')](config['root'],_0xe9f0('0x71'),_0x26a987[_0xe9f0('0x59')][_0xe9f0('0x6f')][_0x155312][_0xe9f0('0x72')])};}}_0x4bec9f={'account':_0x1a3a7e,'message':_0x26a987[_0xe9f0('0x59')]};return;}})[_0xe9f0('0x21')](function(){if(_0x3fa1fa[_0xe9f0('0x60')]){if(_0x3fa1fa[_0xe9f0('0x60')][_0xe9f0('0x62')][_0xe9f0('0x46')]){return _0x3fa1fa[_0xe9f0('0x60')]['Contacts'][0x0];}else{return db['CmContact'][_0xe9f0('0x5b')](_[_0xe9f0('0x73')](_0x26a987[_0xe9f0('0x59')],{'firstName':_0x26a987[_0xe9f0('0x59')]['to'],'email':_0x26a987['body']['to'],'phone':_0x26a987[_0xe9f0('0x59')]['to'],'ListId':_0x3fa1fa[_0xe9f0('0x74')]}));}}else{throw new Error(_0xe9f0('0x75'));}})[_0xe9f0('0x21')](function(){if(_0x4bec9f){return respondWithRpcPromise('SendMail','sendMail',_0x4bec9f,client9003)[_0xe9f0('0x21')](function(_0x519a24){return _0x1bbf2f['update']({'read':!![],'messageId':_0x519a24['messageId'],'sentAt':moment()['format'](_0xe9f0('0x76'))});})[_0xe9f0('0x2b')](function(_0x22924e){logger['error']('%s',JSON[_0xe9f0('0x25')](_0x22924e));return _0x1bbf2f;});}return _0x1bbf2f;});}return _0x1bbf2f;}})[_0xe9f0('0x21')](respondWithResult(_0x9be278,0xc9))[_0xe9f0('0x2b')](handleError(_0x9be278,null));};var interaction_log=require('../../config/logger')(_0xe9f0('0x77'));exports[_0xe9f0('0x78')]=function(_0x17376b,_0x40c955,_0x1c8a9a){var _0x2ee4c0={'channel':'mail'};if(_0x17376b[_0xe9f0('0x59')]['id']){delete _0x17376b[_0xe9f0('0x59')]['id'];}_0x17376b[_0xe9f0('0x59')][_0xe9f0('0x79')]=!![];_0x17376b[_0xe9f0('0x59')]['readAt']=moment()['format'](_0xe9f0('0x76'));_0x17376b[_0xe9f0('0x59')]['UserId']=_0x17376b[_0xe9f0('0x59')][_0xe9f0('0x7a')]||_0x17376b[_0xe9f0('0x6d')]['id'];return db[_0xe9f0('0x51')][_0xe9f0('0x58')]({'where':{'id':_0x17376b['params']['id'],'UserId':null},'include':[{'model':db[_0xe9f0('0x61')],'as':_0xe9f0('0x7b')}]})[_0xe9f0('0x21')](handleEntityNotFound(_0x40c955,null))[_0xe9f0('0x21')](saveUpdates(_0x17376b[_0xe9f0('0x59')],null))[_0xe9f0('0x21')](function(_0x129e10){if(_0x129e10){_0x2ee4c0[_0xe9f0('0x29')]=_0x129e10[_0xe9f0('0x7c')]({'plain':!![]});return db['MailInteraction'][_0xe9f0('0x58')]({'where':{'id':_0x129e10['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x40c955,null))[_0xe9f0('0x21')](function(_0x3c5f53){if(_0x3c5f53){return _0x3c5f53[_0xe9f0('0x35')]({'UserId':_0x17376b['body']['UserId'],'read1stAt':_[_0xe9f0('0x67')](_0x3c5f53[_0xe9f0('0x7d')])?moment()['format'](_0xe9f0('0x76')):undefined});}return null;})['then'](function(_0x52d3c2){if(_0x52d3c2){_0x2ee4c0[_0xe9f0('0x7e')]=_0x52d3c2[_0xe9f0('0x7c')]({'plain':!![]});interaction_log[_0xe9f0('0x22')](_0xe9f0('0x7f'),_0x17376b[_0xe9f0('0x6d')]['id'],_0x17376b[_0xe9f0('0x6d')][_0xe9f0('0x39')],_0x17376b[_0xe9f0('0x6d')][_0xe9f0('0x80')],_0x2ee4c0[_0xe9f0('0x7e')]['id'],_0x17376b[_0xe9f0('0x59')]?JSON[_0xe9f0('0x25')](_0x17376b[_0xe9f0('0x59')]):_0xe9f0('0x81'));return respondWithRpcPromise(_0xe9f0('0x82'),_0xe9f0('0x83'),_0x2ee4c0);}return null;})[_0xe9f0('0x21')](function(_0xbe1eb9){if(_0xbe1eb9){if(_0x17376b[_0xe9f0('0x59')]['manual']){_0x2ee4c0[_0xe9f0('0x29')][_0xe9f0('0x84')]=util['format'](_0xe9f0('0x85'),_0x17376b[_0xe9f0('0x6d')]['name']);_0x2ee4c0['message'][_0xe9f0('0x86')]=_0x2ee4c0[_0xe9f0('0x86')];_0x2ee4c0[_0xe9f0('0x29')][_0xe9f0('0x87')]=_0xe9f0('0x78');return respondWithRpcPromise('EventManager',_0xe9f0('0x88'),{'event':_0xe9f0('0x89'),'message':_0x2ee4c0[_0xe9f0('0x29')]},client9002)[_0xe9f0('0x21')](function(){return _0x2ee4c0;});}return _0x2ee4c0;}return null;})[_0xe9f0('0x21')](respondWithResult(_0x40c955,null))[_0xe9f0('0x2b')](handleError(_0x40c955,null));};var interaction_log=require('../../config/logger')(_0xe9f0('0x77'));exports[_0xe9f0('0x33')]=function(_0x4de113,_0x40dc5a,_0x20a817){var _0x25e121={'agent':{},'channel':_0xe9f0('0x8a')};if(_0x4de113[_0xe9f0('0x59')]['id']){delete _0x4de113[_0xe9f0('0x59')]['id'];}_0x4de113['body']['UserId']=_0x4de113['body'][_0xe9f0('0x7a')]||_0x4de113[_0xe9f0('0x6d')]['id'];_0x25e121[_0xe9f0('0x8b')]['id']=_0x4de113[_0xe9f0('0x59')]['UserId'];return db[_0xe9f0('0x51')][_0xe9f0('0x58')]({'where':{'id':_0x4de113[_0xe9f0('0x54')]['id'],'UserId':null}})[_0xe9f0('0x21')](handleEntityNotFound(_0x40dc5a,null))[_0xe9f0('0x21')](function(_0x5c7269){if(_0x5c7269){_0x25e121['message']=_0x5c7269[_0xe9f0('0x7c')]({'plain':!![]});return db[_0xe9f0('0x8c')][_0xe9f0('0x58')]({'where':{'id':_0x5c7269['MailInteractionId']}});}return null;})[_0xe9f0('0x21')](handleEntityNotFound(_0x40dc5a,null))[_0xe9f0('0x21')](function(_0x28f5f5){if(_0x28f5f5){_0x25e121[_0xe9f0('0x7e')]=_0x28f5f5[_0xe9f0('0x7c')]({'plain':!![]});interaction_log['info'](_0xe9f0('0x8d'),_0x4de113[_0xe9f0('0x6d')]['id'],_0x4de113[_0xe9f0('0x6d')][_0xe9f0('0x39')],_0x4de113[_0xe9f0('0x6d')][_0xe9f0('0x80')],_0x25e121[_0xe9f0('0x7e')]['id'],_0x4de113['body']?JSON[_0xe9f0('0x25')](_0x4de113[_0xe9f0('0x59')]):'null');return respondWithRpcPromise('RejectMessage','rejectMessage',_0x25e121);}return null;})['then'](function(_0x3e273d){if(_0x3e273d){_0x3e273d['message']['interface']=util['format'](_0xe9f0('0x85'),_0x4de113['user'][_0xe9f0('0x39')]);_0x3e273d[_0xe9f0('0x29')][_0xe9f0('0x86')]=_0x25e121[_0xe9f0('0x86')];_0x3e273d['message']['event']='reject';respondWithRpcPromise(_0xe9f0('0x88'),_0xe9f0('0x88'),{'event':_0xe9f0('0x8e'),'message':_0x3e273d[_0xe9f0('0x29')]},client9002);return _0x25e121;}return null;})['then'](respondWithResult(_0x40dc5a,null))[_0xe9f0('0x2b')](handleError(_0x40dc5a,null));};exports[_0xe9f0('0x8f')]=function(_0x43ea07,_0x144d9a){var _0x32285e=moment()[_0xe9f0('0x90')]()[_0xe9f0('0x91')]();var _0x4b25fe=path[_0xe9f0('0x70')](config[_0xe9f0('0x92')],_0xe9f0('0x93'),_0xe9f0('0x94'),'tmp');var _0x2d53c9=path[_0xe9f0('0x70')](config[_0xe9f0('0x92')],_0xe9f0('0x93'),_0xe9f0('0x94'),'attachments');var _0x5396e2=util[_0xe9f0('0x95')]('message-%s.eml',_0x32285e);return db[_0xe9f0('0x51')][_0xe9f0('0x58')]({'where':{'id':_0x43ea07['params']['id']},'attributes':['id',_0xe9f0('0x59'),_0xe9f0('0x96'),'to','cc',_0xe9f0('0x97'),_0xe9f0('0x98'),_0xe9f0('0x99')],'include':_0x43ea07[_0xe9f0('0x43')][_0xe9f0('0x6f')]?[{'model':db[_0xe9f0('0x9a')],'as':_0xe9f0('0x9b')}]:undefined})[_0xe9f0('0x21')](handleEntityNotFound(_0x144d9a,null))[_0xe9f0('0x21')](function(_0x9c2ab5){if(_0x9c2ab5){var _0x5ce4f4=_0x9c2ab5;var _0x33fe7f={'from':_0x5ce4f4[_0xe9f0('0x96')],'to':_0x5ce4f4['to'],'subject':_0x5ce4f4[_0xe9f0('0x98')],'html':_0x5ce4f4['body'],'headers':{'Date':moment(_0x5ce4f4['createdAt'])[_0xe9f0('0x95')](_0xe9f0('0x9c'))},'attachments':[]};if(_0x9c2ab5['cc']){_0x33fe7f[_0xe9f0('0x9d')]['Cc']=_0x9c2ab5['cc'];}if(_0x9c2ab5['bcc']){_0x33fe7f[_0xe9f0('0x9d')][_0xe9f0('0x9e')]=_0x9c2ab5[_0xe9f0('0x97')];}return new BPromise(function(_0x2a9acb,_0x49177b){if(_0x9c2ab5[_0xe9f0('0x9b')]){for(var _0x3b5654=0x0;_0x3b5654<_0x9c2ab5['Attachments'][_0xe9f0('0x46')];_0x3b5654++){var _0x3c7b30=_0x9c2ab5['Attachments'][_0x3b5654];var _0x6fed93=path[_0xe9f0('0x70')](_0x2d53c9,_0x3c7b30['basename']);if(fs['existsSync'](_0x6fed93)){_0x33fe7f['attachments'][_0xe9f0('0x9f')]({'name':_0x3c7b30['name'],'contentType':_0x3c7b30[_0xe9f0('0x3d')],'data':fs[_0xe9f0('0xa0')](_0x6fed93)});}}}emlformat['build'](_0x33fe7f,function(_0x187388,_0x3aa4c1){if(_0x187388)return _0x49177b(_0x187388);fs[_0xe9f0('0xa1')](path[_0xe9f0('0x70')](_0x4b25fe,_0x5396e2),_0x3aa4c1);return _0x2a9acb(_0x3aa4c1);});});}})['then'](function(_0x177988){if(_0x177988){return _0x144d9a[_0xe9f0('0x8f')](path['join'](_0x4b25fe,_0x5396e2),_0x5396e2,function(_0x487484){if(_0x487484){console['log'](_0xe9f0('0xa2'),_0x487484);}else{fs[_0xe9f0('0xa3')](path[_0xe9f0('0x70')](_0x4b25fe,_0x5396e2));}});}})[_0xe9f0('0x2b')](handleError(_0x144d9a,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index fdde966..7becac0 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 _0xeaad=['hasOwnProperty','events','../../mysqldb','MailMessage','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeaad,0x163));var _0xdeaa=function(_0x4e0070,_0x260d2a){_0x4e0070=_0x4e0070-0x0;var _0x59655e=_0xeaad[_0x4e0070];return _0x59655e;};'use strict';var EventEmitter=require(_0xdeaa('0x0'));var MailMessage=require(_0xdeaa('0x1'))['db'][_0xdeaa('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdeaa('0x3'),'afterUpdate':_0xdeaa('0x4'),'afterDestroy':'remove'};function emitEvent(_0x54b8e3){return function(_0x57efdc,_0x484f60,_0x58a14f){MailMessageEvents['emit'](_0x54b8e3+':'+_0x57efdc['id'],_0x57efdc);MailMessageEvents['emit'](_0x54b8e3,_0x57efdc);_0x58a14f(null);};}for(var e in events){if(events[_0xdeaa('0x5')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0x44be=['update','remove','emit','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x549928,_0x363b7a){var _0x941e27=function(_0x280fe6){while(--_0x280fe6){_0x549928['push'](_0x549928['shift']());}};_0x941e27(++_0x363b7a);}(_0x44be,0x186));var _0xe44b=function(_0x3f2fea,_0x3c4ea8){_0x3f2fea=_0x3f2fea-0x0;var _0x69a4d5=_0x44be[_0x3f2fea];return _0x69a4d5;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0xe44b('0x0'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xe44b('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe44b('0x2'),'afterDestroy':_0xe44b('0x3')};function emitEvent(_0x57f52e){return function(_0x40126f,_0xc1084d,_0x1a65fe){MailMessageEvents[_0xe44b('0x4')](_0x57f52e+':'+_0x40126f['id'],_0x40126f);MailMessageEvents[_0xe44b('0x4')](_0x57f52e,_0x40126f);_0x1a65fe(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0xe44b('0x5')](e,emitEvent(event));}}module[_0xe44b('0x6')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index c68f04e..498491f 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 _0x1b3a=['html-to-text','path','../../config/environment','./mailMessage.attributes','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','body','get','direction','toLowerCase','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','request-promise'];(function(_0x1b87e5,_0x19a375){var _0x9bd700=function(_0x19d7ce){while(--_0x19d7ce){_0x1b87e5['push'](_0x1b87e5['shift']());}};_0x9bd700(++_0x19a375);}(_0x1b3a,0x132));var _0xa1b3=function(_0x48c2ad,_0x43a610){_0x48c2ad=_0x48c2ad-0x0;var _0x356dcd=_0x1b3a[_0x48c2ad];return _0x356dcd;};'use strict';var _=require(_0xa1b3('0x0'));var util=require('util');var logger=require(_0xa1b3('0x1'))(_0xa1b3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa1b3('0x3'));var htmlToText=require(_0xa1b3('0x4'));var fs=require('fs');var path=require(_0xa1b3('0x5'));var rimraf=require('rimraf');var config=require(_0xa1b3('0x6'));var attributes=require(_0xa1b3('0x7'));module['exports']=function(_0x2dbf51,_0x14c9ea){return _0x2dbf51[_0xa1b3('0x8')](_0xa1b3('0x9'),attributes,{'tableName':_0xa1b3('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xa1b3('0xb')]},{'name':_0xa1b3('0xc'),'fields':[_0xa1b3('0xd'),_0xa1b3('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x23e6e3,_0x16bdc2,_0x5a8000){if(_0x23e6e3[_0xa1b3('0xf')]){_0x23e6e3[_0xa1b3('0xd')]=htmlToText['fromString'](_0x23e6e3[_0xa1b3('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x5a8000(null,_0x16bdc2);},'afterCreate':function(_0x41b229,_0x530bb9,_0x3fc276){var _0x458583=_0x2dbf51['models'];var _0xbcd37c=_0x41b229[_0xa1b3('0x10')]({'plain':!![]});if(_0xbcd37c[_0xa1b3('0x11')][_0xa1b3('0x12')]()==='in'||_0xbcd37c[_0xa1b3('0x11')][_0xa1b3('0x12')]()==='out'&&!_0xbcd37c[_0xa1b3('0x13')]&&!_[_0xa1b3('0x14')](_0xbcd37c[_0xa1b3('0x15')])){_0x458583[_0xa1b3('0x16')][_0xa1b3('0x17')]({'where':{'id':_0xbcd37c[_0xa1b3('0x18')]}})[_0xa1b3('0x19')](function(_0x2bc9ae){if(_0x2bc9ae){_0x2bc9ae['update']({'lastMsgAt':_0xbcd37c[_0xa1b3('0x1a')],'lastMsgDirection':_0xbcd37c[_0xa1b3('0x11')][_0xa1b3('0x12')](),'lastMsgBody':_0xbcd37c[_0xa1b3('0xf')]});}})[_0xa1b3('0x1b')](function(_0x2d2eb3){console[_0xa1b3('0x1c')](_0x2d2eb3);});}_0x3fc276();}},'charset':_0xa1b3('0x1d'),'collate':_0xa1b3('0x1e')});}; \ No newline at end of file +var _0xa991=['html-to-text','rimraf','./mailMessage.attributes','define','messageId','plainBody','subject','FULLTEXT','fromString','get','toLowerCase','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','direction','body','error','utf8mb4','utf8mb4_unicode_ci','../../config/logger','bluebird'];(function(_0x19e469,_0x426f29){var _0x5f2b41=function(_0x5cc5c8){while(--_0x5cc5c8){_0x19e469['push'](_0x19e469['shift']());}};_0x5f2b41(++_0x426f29);}(_0xa991,0x10c));var _0x1a99=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xa991[_0x1e4360];return _0x31e6b4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1a99('0x0'))('api');var moment=require('moment');var BPromise=require(_0x1a99('0x1'));var rp=require('request-promise');var htmlToText=require(_0x1a99('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1a99('0x3'));var config=require('../../config/environment');var attributes=require(_0x1a99('0x4'));module['exports']=function(_0x5f157c,_0x33f0fe){return _0x5f157c[_0x1a99('0x5')]('MailMessage',attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x1a99('0x6'),'fields':[_0x1a99('0x6')]},{'name':'fti_mail_messages','fields':[_0x1a99('0x7'),_0x1a99('0x8')],'type':_0x1a99('0x9')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2d5685,_0x38cf52,_0x525e8d){if(_0x2d5685['body']){_0x2d5685['plainBody']=htmlToText[_0x1a99('0xa')](_0x2d5685['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x525e8d(null,_0x38cf52);},'afterCreate':function(_0x31ab45,_0x360a5d,_0xa78bad){var _0xc8f6d1=_0x5f157c['models'];var _0x1bfb71=_0x31ab45[_0x1a99('0xb')]({'plain':!![]});if(_0x1bfb71['direction'][_0x1a99('0xc')]()==='in'||_0x1bfb71['direction'][_0x1a99('0xc')]()==='out'&&!_0x1bfb71[_0x1a99('0xd')]&&!_[_0x1a99('0xe')](_0x1bfb71[_0x1a99('0xf')])){_0xc8f6d1[_0x1a99('0x10')][_0x1a99('0x11')]({'where':{'id':_0x1bfb71[_0x1a99('0x12')]}})[_0x1a99('0x13')](function(_0x2e33a2){if(_0x2e33a2){_0x2e33a2[_0x1a99('0x14')]({'lastMsgAt':_0x1bfb71[_0x1a99('0x15')],'lastMsgDirection':_0x1bfb71[_0x1a99('0x16')][_0x1a99('0xc')](),'lastMsgBody':_0x1bfb71[_0x1a99('0x17')]});}})['catch'](function(_0xbc0d3b){console[_0x1a99('0x18')](_0xbc0d3b);});}_0xa78bad();}},'charset':_0x1a99('0x19'),'collate':_0x1a99('0x1a')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 0e36657..8fad065 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 _0xcaf2=['MailMessage','create','body','options','raw','then','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','./mailMessage.socket','register','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailMessage'];(function(_0x485d7b,_0x3f3b52){var _0x899877=function(_0x34639c){while(--_0x34639c){_0x485d7b['push'](_0x485d7b['shift']());}};_0x899877(++_0x3f3b52);}(_0xcaf2,0x8a));var _0x2caf=function(_0x2f6c3e,_0x579279){_0x2f6c3e=_0x2f6c3e-0x0;var _0x5bd3b0=_0xcaf2[_0x2f6c3e];return _0x5bd3b0;};'use strict';var _=require(_0x2caf('0x0'));var util=require('util');var moment=require(_0x2caf('0x1'));var BPromise=require(_0x2caf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2caf('0x3'));var db=require(_0x2caf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2caf('0x5'))('rpc');var config=require(_0x2caf('0x6'));var jayson=require(_0x2caf('0x7'));var client=jayson[_0x2caf('0x8')]['http']({'port':0x232a});config[_0x2caf('0x9')]=_[_0x2caf('0xa')](config[_0x2caf('0x9')],{'host':_0x2caf('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2caf('0x9')]));require(_0x2caf('0xc'))[_0x2caf('0xd')](socket);function respondWithRpcPromise(_0x1ff859,_0x219d0f,_0x438434){return new BPromise(function(_0x1b20e3,_0x3b5631){return client[_0x2caf('0xe')](_0x1ff859,_0x438434)['then'](function(_0xd56396){logger[_0x2caf('0xf')](_0x2caf('0x10'),_0x219d0f,_0x2caf('0x11'));logger[_0x2caf('0x12')](_0x2caf('0x13'),_0x219d0f,_0x2caf('0x11'),JSON[_0x2caf('0x14')](_0xd56396));if(_0xd56396['error']){if(_0xd56396[_0x2caf('0x15')][_0x2caf('0x16')]===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x219d0f,_0xd56396['error'][_0x2caf('0x17')]);return _0x3b5631(_0xd56396['error'][_0x2caf('0x17')]);}logger[_0x2caf('0x15')](_0x2caf('0x10'),_0x219d0f,_0xd56396[_0x2caf('0x15')]['message']);return _0x1b20e3(_0xd56396[_0x2caf('0x15')]['message']);}else{logger[_0x2caf('0xf')]('MailMessage,\x20%s,\x20%s',_0x219d0f,'request\x20sent');_0x1b20e3(_0xd56396[_0x2caf('0x18')]['message']);}})[_0x2caf('0x19')](function(_0x9c7302){logger['error'](_0x2caf('0x10'),_0x219d0f,_0x9c7302);_0x3b5631(_0x9c7302);});});}exports[_0x2caf('0x1a')]=function(_0x6b3778){var _0x255c08=this;return new Promise(function(_0x20f7d3,_0x595f2f){return db[_0x2caf('0x1b')][_0x2caf('0x1c')](_0x6b3778[_0x2caf('0x1d')],{'raw':_0x6b3778[_0x2caf('0x1e')]?_0x6b3778[_0x2caf('0x1e')][_0x2caf('0x1f')]===undefined?!![]:![]:!![]})[_0x2caf('0x20')](function(_0x256cc4){logger[_0x2caf('0xf')](_0x2caf('0x1a'),_0x6b3778);logger[_0x2caf('0x12')]('CreateMailMessage',_0x6b3778,JSON[_0x2caf('0x14')](_0x256cc4));_0x20f7d3(_0x256cc4);})[_0x2caf('0x19')](function(_0x1f29b0){logger[_0x2caf('0x15')](_0x2caf('0x1a'),_0x1f29b0[_0x2caf('0x17')],_0x6b3778);_0x595f2f(_0x255c08[_0x2caf('0x15')](0x1f4,_0x1f29b0[_0x2caf('0x17')]));});});}; \ No newline at end of file +var _0xa5aa=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./mailMessage.socket','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailMessage','MailMessage','create','options','raw','then','lodash'];(function(_0x469eba,_0x39471c){var _0x355f69=function(_0x2ca612){while(--_0x2ca612){_0x469eba['push'](_0x469eba['shift']());}};_0x355f69(++_0x39471c);}(_0xa5aa,0x1ac));var _0xaa5a=function(_0x179aa2,_0x41e1ab){_0x179aa2=_0x179aa2-0x0;var _0x15e0e9=_0xa5aa[_0x179aa2];return _0x15e0e9;};'use strict';var _=require(_0xaa5a('0x0'));var util=require(_0xaa5a('0x1'));var moment=require('moment');var BPromise=require(_0xaa5a('0x2'));var rs=require(_0xaa5a('0x3'));var fs=require('fs');var Redis=require(_0xaa5a('0x4'));var db=require(_0xaa5a('0x5'))['db'];var utils=require(_0xaa5a('0x6'));var logger=require(_0xaa5a('0x7'))('rpc');var config=require(_0xaa5a('0x8'));var jayson=require(_0xaa5a('0x9'));var client=jayson[_0xaa5a('0xa')]['http']({'port':0x232a});config['redis']=_[_0xaa5a('0xb')](config[_0xaa5a('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xaa5a('0xd'))(new Redis(config[_0xaa5a('0xc')]));require(_0xaa5a('0xe'))['register'](socket);function respondWithRpcPromise(_0x1711cc,_0x1f57cd,_0x771d06){return new BPromise(function(_0x338653,_0x2db481){return client[_0xaa5a('0xf')](_0x1711cc,_0x771d06)['then'](function(_0x7dc4c2){logger[_0xaa5a('0x10')](_0xaa5a('0x11'),_0x1f57cd,_0xaa5a('0x12'));logger[_0xaa5a('0x13')](_0xaa5a('0x14'),_0x1f57cd,_0xaa5a('0x12'),JSON[_0xaa5a('0x15')](_0x7dc4c2));if(_0x7dc4c2[_0xaa5a('0x16')]){if(_0x7dc4c2[_0xaa5a('0x16')][_0xaa5a('0x17')]===0x1f4){logger[_0xaa5a('0x16')]('MailMessage,\x20%s,\x20%s',_0x1f57cd,_0x7dc4c2[_0xaa5a('0x16')][_0xaa5a('0x18')]);return _0x2db481(_0x7dc4c2[_0xaa5a('0x16')]['message']);}logger[_0xaa5a('0x16')](_0xaa5a('0x11'),_0x1f57cd,_0x7dc4c2[_0xaa5a('0x16')][_0xaa5a('0x18')]);return _0x338653(_0x7dc4c2[_0xaa5a('0x16')][_0xaa5a('0x18')]);}else{logger[_0xaa5a('0x10')](_0xaa5a('0x11'),_0x1f57cd,_0xaa5a('0x12'));_0x338653(_0x7dc4c2[_0xaa5a('0x19')][_0xaa5a('0x18')]);}})[_0xaa5a('0x1a')](function(_0x127d71){logger[_0xaa5a('0x16')](_0xaa5a('0x11'),_0x1f57cd,_0x127d71);_0x2db481(_0x127d71);});});}exports[_0xaa5a('0x1b')]=function(_0x222e5e){var _0x57cc60=this;return new Promise(function(_0x20ec46,_0xb9156c){return db[_0xaa5a('0x1c')][_0xaa5a('0x1d')](_0x222e5e['body'],{'raw':_0x222e5e[_0xaa5a('0x1e')]?_0x222e5e[_0xaa5a('0x1e')][_0xaa5a('0x1f')]===undefined?!![]:![]:!![]})[_0xaa5a('0x20')](function(_0xf50dd0){logger[_0xaa5a('0x10')](_0xaa5a('0x1b'),_0x222e5e);logger[_0xaa5a('0x13')](_0xaa5a('0x1b'),_0x222e5e,JSON['stringify'](_0xf50dd0));_0x20ec46(_0xf50dd0);})[_0xaa5a('0x1a')](function(_0x4c9035){logger[_0xaa5a('0x16')](_0xaa5a('0x1b'),_0x4c9035[_0xaa5a('0x18')],_0x222e5e);_0xb9156c(_0x57cc60[_0xaa5a('0x16')](0x1f4,_0x4c9035[_0xaa5a('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 7b89a3f..25ac633 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 _0x453a=['save','emit','removeListener','register','length','mailMessage:','./mailMessage.events'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0x453a,0x8b));var _0xa453=function(_0x2a7812,_0x1ce83a){_0x2a7812=_0x2a7812-0x0;var _0x3e1342=_0x453a[_0x2a7812];return _0x3e1342;};'use strict';var MailMessageEvents=require(_0xa453('0x0'));var events=[_0xa453('0x1'),'remove','update'];function createListener(_0x964877,_0x382b33){return function(_0x3e09ea){_0x382b33[_0xa453('0x2')](_0x964877,_0x3e09ea);};}function removeListener(_0x24d284,_0x1d24a9){return function(){MailMessageEvents[_0xa453('0x3')](_0x24d284,_0x1d24a9);};}exports[_0xa453('0x4')]=function(_0x5bf452){for(var _0x394f72=0x0,_0xd21183=events[_0xa453('0x5')];_0x394f72<_0xd21183;_0x394f72++){var _0x4f83de=events[_0x394f72];var _0xa06651=createListener(_0xa453('0x6')+_0x4f83de,_0x5bf452);MailMessageEvents['on'](_0x4f83de,_0xa06651);}}; \ No newline at end of file +var _0x6737=['mailMessage:','./mailMessage.events','save','emit','removeListener','length'];(function(_0x3a2e8c,_0x4001d3){var _0x588177=function(_0x2dbc02){while(--_0x2dbc02){_0x3a2e8c['push'](_0x3a2e8c['shift']());}};_0x588177(++_0x4001d3);}(_0x6737,0xaf));var _0x7673=function(_0x3372f6,_0x519b41){_0x3372f6=_0x3372f6-0x0;var _0x772d8a=_0x6737[_0x3372f6];return _0x772d8a;};'use strict';var MailMessageEvents=require(_0x7673('0x0'));var events=[_0x7673('0x1'),'remove','update'];function createListener(_0x3a4fff,_0x45df21){return function(_0x34301f){_0x45df21[_0x7673('0x2')](_0x3a4fff,_0x34301f);};}function removeListener(_0x3aa2e3,_0xc33628){return function(){MailMessageEvents[_0x7673('0x3')](_0x3aa2e3,_0xc33628);};}exports['register']=function(_0x4021df){for(var _0x4d5324=0x0,_0x335c7b=events[_0x7673('0x4')];_0x4d5324<_0x335c7b;_0x4d5324++){var _0x4abd31=events[_0x4d5324];var _0x70a5e0=createListener(_0x7673('0x5')+_0x4abd31,_0x4021df);MailMessageEvents['on'](_0x4abd31,_0x70a5e0);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index bbf6d77..9cf495a 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 _0x83cf=['removeTeams','multer','util','path','Router','../../components/auth/service','./mailQueue.controller','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','delete','destroy'];(function(_0x424b9c,_0x4124f9){var _0x516468=function(_0x514d26){while(--_0x514d26){_0x424b9c['push'](_0x424b9c['shift']());}};_0x516468(++_0x4124f9);}(_0x83cf,0xa3));var _0xf83c=function(_0x51f6ab,_0x55bdb5){_0x51f6ab=_0x51f6ab-0x0;var _0x505b02=_0x83cf[_0x51f6ab];return _0x505b02;};'use strict';var multer=require(_0xf83c('0x0'));var util=require(_0xf83c('0x1'));var path=require(_0xf83c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf83c('0x3')]();var auth=require(_0xf83c('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf83c('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xf83c('0x6')]);router[_0xf83c('0x7')](_0xf83c('0x8'),auth[_0xf83c('0x9')](),controller[_0xf83c('0xa')]);router[_0xf83c('0x7')](_0xf83c('0xb'),auth[_0xf83c('0x9')](),controller[_0xf83c('0xc')]);router[_0xf83c('0x7')](_0xf83c('0xd'),auth[_0xf83c('0x9')](),controller[_0xf83c('0xe')]);router[_0xf83c('0x7')](_0xf83c('0xf'),auth[_0xf83c('0x9')](),controller[_0xf83c('0x10')]);router['get'](_0xf83c('0x11'),auth['isAuthenticated'](),controller[_0xf83c('0x12')]);router[_0xf83c('0x13')]('/',auth[_0xf83c('0x9')](),controller[_0xf83c('0x14')]);router['post']('/:id/teams',auth[_0xf83c('0x9')](),controller[_0xf83c('0x15')]);router['post'](_0xf83c('0x11'),auth[_0xf83c('0x9')](),controller['addAgents']);router[_0xf83c('0x16')]('/:id',auth[_0xf83c('0x9')](),controller[_0xf83c('0x17')]);router[_0xf83c('0x18')](_0xf83c('0xb'),auth['isAuthenticated'](),controller[_0xf83c('0x19')]);router[_0xf83c('0x18')]('/:id/teams',auth['isAuthenticated'](),controller[_0xf83c('0x1a')]);router[_0xf83c('0x18')]('/:id/users',auth[_0xf83c('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x37ab=['post','create','addTeams','addAgents','put','update','destroy','delete','exports','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x37ab,0x183));var _0xb37a=function(_0x4d32e9,_0x390d44){_0x4d32e9=_0x4d32e9-0x0;var _0x2d9ece=_0x37ab[_0x4d32e9];return _0x2d9ece;};'use strict';var multer=require('multer');var util=require(_0xb37a('0x0'));var path=require('path');var timeout=require(_0xb37a('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0xb37a('0x2'));var interaction=require(_0xb37a('0x3'));var config=require(_0xb37a('0x4'));var controller=require(_0xb37a('0x5'));router[_0xb37a('0x6')]('/',auth[_0xb37a('0x7')](),controller[_0xb37a('0x8')]);router[_0xb37a('0x6')](_0xb37a('0x9'),auth[_0xb37a('0x7')](),controller[_0xb37a('0xa')]);router[_0xb37a('0x6')](_0xb37a('0xb'),auth[_0xb37a('0x7')](),controller[_0xb37a('0xc')]);router[_0xb37a('0x6')](_0xb37a('0xd'),auth[_0xb37a('0x7')](),controller[_0xb37a('0xe')]);router[_0xb37a('0x6')](_0xb37a('0xf'),auth['isAuthenticated'](),controller[_0xb37a('0x10')]);router[_0xb37a('0x6')](_0xb37a('0x11'),auth['isAuthenticated'](),controller['getAgents']);router[_0xb37a('0x12')]('/',auth[_0xb37a('0x7')](),controller[_0xb37a('0x13')]);router[_0xb37a('0x12')](_0xb37a('0xf'),auth[_0xb37a('0x7')](),controller[_0xb37a('0x14')]);router[_0xb37a('0x12')]('/:id/users',auth[_0xb37a('0x7')](),controller[_0xb37a('0x15')]);router[_0xb37a('0x16')](_0xb37a('0xb'),auth['isAuthenticated'](),controller[_0xb37a('0x17')]);router['delete'](_0xb37a('0xb'),auth[_0xb37a('0x7')](),controller[_0xb37a('0x18')]);router[_0xb37a('0x19')](_0xb37a('0xf'),auth['isAuthenticated'](),controller['removeTeams']);router[_0xb37a('0x19')]('/:id/users',auth[_0xb37a('0x7')](),controller['removeAgents']);module[_0xb37a('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index b57ad8d..01ff612 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 _0x7ebb=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','beepall'];(function(_0x4dca94,_0x11c75c){var _0x3fc449=function(_0x2684be){while(--_0x2684be){_0x4dca94['push'](_0x4dca94['shift']());}};_0x3fc449(++_0x11c75c);}(_0x7ebb,0x161));var _0xb7eb=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x7ebb[_0x45b034];return _0x509cb0;};'use strict';var Sequelize=require(_0xb7eb('0x0'));module[_0xb7eb('0x1')]={'name':{'type':Sequelize[_0xb7eb('0x2')],'unique':_0xb7eb('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb7eb('0x2')]},'timeout':{'type':Sequelize[_0xb7eb('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb7eb('0x5')]('rrmemory',_0xb7eb('0x6'),_0xb7eb('0x7'))}}; \ No newline at end of file +var _0x8e4f=['roundrobin','sequelize','exports','STRING','INTEGER','ENUM','rrmemory'];(function(_0x2c0acf,_0x4d2823){var _0x2455fc=function(_0x33c1fd){while(--_0x33c1fd){_0x2c0acf['push'](_0x2c0acf['shift']());}};_0x2455fc(++_0x4d2823);}(_0x8e4f,0xa9));var _0xf8e4=function(_0x3c5fec,_0x4fecdf){_0x3c5fec=_0x3c5fec-0x0;var _0x47eafa=_0x8e4f[_0x3c5fec];return _0x47eafa;};'use strict';var Sequelize=require(_0xf8e4('0x0'));module[_0xf8e4('0x1')]={'name':{'type':Sequelize[_0xf8e4('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf8e4('0x2')]},'timeout':{'type':Sequelize[_0xf8e4('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf8e4('0x4')](_0xf8e4('0x5'),'beepall',_0xf8e4('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 28b4706..5d1d071 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 _0x6b6c=['Content-Range','apply','reject','save','update','then','destroy','error','stack','send','index','MailQueue','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','name','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','describe','getMembers','findOne','UserMailQueue','User','UserId','agent','mailPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','rawAttributes','Agents','voicePause','flatMap','sequelize','transaction','addTeams','each','emit','userMailQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','union','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','pick','getAgents','html-pdf','eml-format','fast-json-patch','moment','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./mailQueue.socket','register','sendStatus','end','status','json','count','offset','limit','set'];(function(_0x190417,_0x54dc0d){var _0x110e9c=function(_0x517b86){while(--_0x517b86){_0x190417['push'](_0x190417['shift']());}};_0x110e9c(++_0x54dc0d);}(_0x6b6c,0x176));var _0xc6b6=function(_0x12408f,_0x56a9a5){_0x12408f=_0x12408f-0x0;var _0xccdd80=_0x6b6c[_0x12408f];return _0xccdd80;};'use strict';var pdf=require(_0xc6b6('0x0'));var emlformat=require(_0xc6b6('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc6b6('0x2'));var rp=require('request-promise');var moment=require(_0xc6b6('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc6b6('0x4'));var csv=require(_0xc6b6('0x5'));var ejs=require(_0xc6b6('0x6'));var fs=require('fs');var _=require(_0xc6b6('0x7'));var squel=require(_0xc6b6('0x8'));var crypto=require(_0xc6b6('0x9'));var jsforce=require(_0xc6b6('0xa'));var deskjs=require(_0xc6b6('0xb'));var toCsv=require('to-csv');var querystring=require(_0xc6b6('0xc'));var Papa=require(_0xc6b6('0xd'));var Redis=require(_0xc6b6('0xe'));var authService=require(_0xc6b6('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc6b6('0x10'));var logger=require(_0xc6b6('0x11'))(_0xc6b6('0x12'));var utils=require(_0xc6b6('0x13'));var config=require(_0xc6b6('0x14'));var db=require(_0xc6b6('0x15'))['db'];config[_0xc6b6('0x16')]=_['defaults'](config[_0xc6b6('0x16')],{'host':_0xc6b6('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc6b6('0x16')]));require(_0xc6b6('0x18'))[_0xc6b6('0x19')](socket);function respondWithStatusCode(_0x4025c5,_0x3283f2){_0x3283f2=_0x3283f2||0xcc;return function(_0x1cba0d){if(_0x1cba0d){return _0x4025c5[_0xc6b6('0x1a')](_0x3283f2);}return _0x4025c5['status'](_0x3283f2)[_0xc6b6('0x1b')]();};}function respondWithResult(_0x11dd50,_0x5b637a){_0x5b637a=_0x5b637a||0xc8;return function(_0x13fe3d){if(_0x13fe3d){return _0x11dd50[_0xc6b6('0x1c')](_0x5b637a)[_0xc6b6('0x1d')](_0x13fe3d);}};}function respondWithFilteredResult(_0x35e643,_0x2c3424){return function(_0xc9205d){if(_0xc9205d){var _0x428777=_0xc9205d[_0xc6b6('0x1e')],_0x4a1515=_0x2c3424[_0xc6b6('0x1f')],_0x580adc=_0x2c3424['offset']+_0x2c3424[_0xc6b6('0x20')],_0x4ddcd8;if(_0x580adc>=_0x428777){_0x580adc=_0x428777;_0x4ddcd8=0xc8;}else{_0x4ddcd8=0xce;}_0x35e643['status'](_0x4ddcd8);return _0x35e643[_0xc6b6('0x21')](_0xc6b6('0x22'),_0x4a1515+'-'+_0x580adc+'/'+_0x428777)[_0xc6b6('0x1d')](_0xc9205d);}return null;};}function patchUpdates(_0x1ef30f){return function(_0x36f5d1){try{jsonpatch[_0xc6b6('0x23')](_0x36f5d1,_0x1ef30f,!![]);}catch(_0x231f9a){return BPromise[_0xc6b6('0x24')](_0x231f9a);}return _0x36f5d1[_0xc6b6('0x25')]();};}function saveUpdates(_0x593802,_0x917962){return function(_0x15ece2){if(_0x15ece2){return _0x15ece2[_0xc6b6('0x26')](_0x593802)[_0xc6b6('0x27')](function(_0x51289c){return _0x51289c;});}return null;};}function removeEntity(_0x2fddf3,_0x522da0){return function(_0x4f5a8f){if(_0x4f5a8f){return _0x4f5a8f[_0xc6b6('0x28')]()[_0xc6b6('0x27')](function(){var _0x15c5bc=_0x4f5a8f['get']({'plain':!![]});var _0x1d4ffd='MailQueues';return db['UserProfileResource'][_0xc6b6('0x28')]({'where':{'type':_0x1d4ffd,'resourceId':_0x15c5bc['id']}})[_0xc6b6('0x27')](function(){return _0x4f5a8f;});})[_0xc6b6('0x27')](function(){_0x2fddf3[_0xc6b6('0x1c')](0xcc)[_0xc6b6('0x1b')]();});}};}function handleEntityNotFound(_0x2ed404,_0x366a29){return function(_0x231f15){if(!_0x231f15){_0x2ed404[_0xc6b6('0x1a')](0x194);}return _0x231f15;};}function handleError(_0x40718f,_0x408740){_0x408740=_0x408740||0x1f4;return function(_0x3e6a77){logger[_0xc6b6('0x29')](_0x3e6a77[_0xc6b6('0x2a')]);if(_0x3e6a77['name']){delete _0x3e6a77['name'];}_0x40718f['status'](_0x408740)[_0xc6b6('0x2b')](_0x3e6a77);};}exports[_0xc6b6('0x2c')]=function(_0x577348,_0x59ddfb){var _0x52bd4e={},_0x46b9d6={},_0x112baa={'count':0x0,'rows':[]};var _0x5ee16f=_['map'](db[_0xc6b6('0x2d')]['rawAttributes'],function(_0x1a3e7d){return{'name':_0x1a3e7d[_0xc6b6('0x2e')],'type':_0x1a3e7d[_0xc6b6('0x2f')]['key']};});_0x46b9d6[_0xc6b6('0x30')]=_[_0xc6b6('0x31')](_0x5ee16f,'name');_0x46b9d6[_0xc6b6('0x32')]=_[_0xc6b6('0x33')](_0x577348[_0xc6b6('0x32')]);_0x46b9d6[_0xc6b6('0x34')]=_[_0xc6b6('0x35')](_0x46b9d6[_0xc6b6('0x30')],_0x46b9d6[_0xc6b6('0x32')]);_0x52bd4e[_0xc6b6('0x36')]=_[_0xc6b6('0x35')](_0x46b9d6[_0xc6b6('0x30')],qs[_0xc6b6('0x37')](_0x577348[_0xc6b6('0x32')][_0xc6b6('0x37')]));_0x52bd4e['attributes']=_0x52bd4e[_0xc6b6('0x36')][_0xc6b6('0x38')]?_0x52bd4e[_0xc6b6('0x36')]:_0x46b9d6['model'];if(!_0x577348[_0xc6b6('0x32')][_0xc6b6('0x39')](_0xc6b6('0x3a'))){_0x52bd4e[_0xc6b6('0x20')]=qs[_0xc6b6('0x20')](_0x577348['query'][_0xc6b6('0x20')]);_0x52bd4e['offset']=qs[_0xc6b6('0x1f')](_0x577348[_0xc6b6('0x32')][_0xc6b6('0x1f')]);}_0x52bd4e[_0xc6b6('0x3b')]=qs['sort'](_0x577348[_0xc6b6('0x32')][_0xc6b6('0x3c')]);_0x52bd4e[_0xc6b6('0x3d')]=qs['filters'](_['pick'](_0x577348[_0xc6b6('0x32')],_0x46b9d6[_0xc6b6('0x34')]));if(_0x577348[_0xc6b6('0x32')]['filter']){_0x52bd4e[_0xc6b6('0x3d')]=_['merge'](_0x52bd4e['where'],{'$or':_[_0xc6b6('0x31')](_0x5ee16f,function(_0x11e2ac){if(_0x11e2ac[_0xc6b6('0x2f')]!==_0xc6b6('0x3e')){var _0x32f264={};_0x32f264[_0x11e2ac[_0xc6b6('0x3f')]]={'$like':'%'+_0x577348[_0xc6b6('0x32')][_0xc6b6('0x40')]+'%'};return _0x32f264;}})});}_0x52bd4e=_[_0xc6b6('0x41')]({},_0x52bd4e,_0x577348['options']);var _0x29dc6b={'where':_0x52bd4e[_0xc6b6('0x3d')]};return db[_0xc6b6('0x2d')]['count'](_0x29dc6b)['then'](function(_0x1433f3){_0x112baa['count']=_0x1433f3;if(_0x577348['query'][_0xc6b6('0x42')]){_0x52bd4e[_0xc6b6('0x43')]=[{'all':!![]}];}return db['MailQueue'][_0xc6b6('0x44')](_0x52bd4e);})['then'](function(_0x448ecc){_0x112baa[_0xc6b6('0x45')]=_0x448ecc;return _0x112baa;})[_0xc6b6('0x27')](respondWithFilteredResult(_0x59ddfb,_0x52bd4e))[_0xc6b6('0x46')](handleError(_0x59ddfb,null));};exports[_0xc6b6('0x47')]=function(_0x2335c3,_0x897c0e){var _0x1821c2={'raw':!![],'where':{'id':_0x2335c3[_0xc6b6('0x48')]['id']}},_0x208799={};_0x208799['model']=_[_0xc6b6('0x33')](db[_0xc6b6('0x2d')]['rawAttributes']);_0x208799[_0xc6b6('0x32')]=_[_0xc6b6('0x33')](_0x2335c3[_0xc6b6('0x32')]);_0x208799[_0xc6b6('0x34')]=_[_0xc6b6('0x35')](_0x208799['model'],_0x208799['query']);_0x1821c2['attributes']=_[_0xc6b6('0x35')](_0x208799['model'],qs[_0xc6b6('0x37')](_0x2335c3[_0xc6b6('0x32')][_0xc6b6('0x37')]));_0x1821c2[_0xc6b6('0x36')]=_0x1821c2[_0xc6b6('0x36')][_0xc6b6('0x38')]?_0x1821c2[_0xc6b6('0x36')]:_0x208799[_0xc6b6('0x30')];if(_0x2335c3[_0xc6b6('0x32')]['includeAll']){_0x1821c2[_0xc6b6('0x43')]=[{'all':!![]}];}_0x1821c2=_[_0xc6b6('0x41')]({},_0x1821c2,_0x2335c3[_0xc6b6('0x49')]);return db[_0xc6b6('0x2d')][_0xc6b6('0x4a')](_0x1821c2)[_0xc6b6('0x27')](handleEntityNotFound(_0x897c0e,null))['then'](respondWithResult(_0x897c0e,null))[_0xc6b6('0x46')](handleError(_0x897c0e,null));};exports[_0xc6b6('0x4b')]=function(_0x416798,_0x5e0519){return db[_0xc6b6('0x2d')][_0xc6b6('0x4b')](_0x416798[_0xc6b6('0x4c')],{})[_0xc6b6('0x27')](function(_0x2c4833){var _0x4ffcd8=_0x416798['user'][_0xc6b6('0x4d')]({'plain':!![]});if(!_0x4ffcd8)throw new Error(_0xc6b6('0x4e'));if(_0x4ffcd8[_0xc6b6('0x4f')]==='user'){var _0x54385d=_0x2c4833['get']({'plain':!![]});var _0x120f3f=_0xc6b6('0x50');return db[_0xc6b6('0x51')][_0xc6b6('0x4a')]({'where':{'name':_0x120f3f,'userProfileId':_0x4ffcd8[_0xc6b6('0x52')]},'raw':!![]})[_0xc6b6('0x27')](function(_0xc1025a){if(_0xc1025a&&_0xc1025a[_0xc6b6('0x53')]===0x0){return db[_0xc6b6('0x54')]['create']({'name':_0x54385d['name'],'resourceId':_0x54385d['id'],'type':_0xc1025a[_0xc6b6('0x3f')],'sectionId':_0xc1025a['id']},{})[_0xc6b6('0x27')](function(){return _0x2c4833;});}else{return _0x2c4833;}})[_0xc6b6('0x46')](function(_0x2e5cdc){logger[_0xc6b6('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2e5cdc);throw _0x2e5cdc;});}return _0x2c4833;})[_0xc6b6('0x27')](respondWithResult(_0x5e0519,0xc9))[_0xc6b6('0x46')](handleError(_0x5e0519,null));};exports[_0xc6b6('0x26')]=function(_0x213372,_0x4cc89e){if(_0x213372['body']['id']){delete _0x213372[_0xc6b6('0x4c')]['id'];}return db[_0xc6b6('0x2d')][_0xc6b6('0x4a')]({'where':{'id':_0x213372[_0xc6b6('0x48')]['id']}})[_0xc6b6('0x27')](handleEntityNotFound(_0x4cc89e,null))[_0xc6b6('0x27')](saveUpdates(_0x213372['body'],null))[_0xc6b6('0x27')](respondWithResult(_0x4cc89e,null))['catch'](handleError(_0x4cc89e,null));};exports['destroy']=function(_0x58d041,_0x8247df){return db['MailQueue'][_0xc6b6('0x4a')]({'where':{'id':_0x58d041['params']['id']}})['then'](handleEntityNotFound(_0x8247df,null))[_0xc6b6('0x27')](removeEntity(_0x8247df,null))[_0xc6b6('0x46')](handleError(_0x8247df,null));};exports[_0xc6b6('0x55')]=function(_0x351251,_0x2efbca){return db[_0xc6b6('0x2d')][_0xc6b6('0x55')]()[_0xc6b6('0x27')](respondWithResult(_0x2efbca,null))[_0xc6b6('0x46')](handleError(_0x2efbca,null));};exports[_0xc6b6('0x56')]=function(_0x10db47,_0x47a18b,_0x25ae9f){var _0x174768={'raw':!![],'where':{}},_0x16666a={},_0x2d6338;return db[_0xc6b6('0x2d')][_0xc6b6('0x57')]({'where':{'id':_0x10db47[_0xc6b6('0x48')]['id']}})['then'](handleEntityNotFound(_0x47a18b,null))[_0xc6b6('0x27')](function(_0x135e19){if(_0x135e19){_0x2d6338=_0x135e19[_0xc6b6('0x4d')]({'plain':!![]});_0x16666a[_0xc6b6('0x30')]=_[_0xc6b6('0x33')](db[_0xc6b6('0x58')]['rawAttributes']);_0x16666a[_0xc6b6('0x32')]=_['keys'](_0x10db47[_0xc6b6('0x32')]);_0x16666a[_0xc6b6('0x34')]=_['intersection'](_0x16666a[_0xc6b6('0x30')],_0x16666a[_0xc6b6('0x32')]);_0x174768[_0xc6b6('0x36')]=_[_0xc6b6('0x35')](_0x16666a[_0xc6b6('0x30')],qs[_0xc6b6('0x37')](_0x10db47[_0xc6b6('0x32')][_0xc6b6('0x37')]));_0x174768[_0xc6b6('0x36')]=_0x174768[_0xc6b6('0x36')]['length']?_0x174768['attributes']:_0x16666a[_0xc6b6('0x30')];if(!_0x10db47[_0xc6b6('0x32')]['hasOwnProperty'](_0xc6b6('0x3a'))){_0x174768[_0xc6b6('0x20')]=qs['limit'](_0x10db47[_0xc6b6('0x32')][_0xc6b6('0x20')]);_0x174768[_0xc6b6('0x1f')]=qs[_0xc6b6('0x1f')](_0x10db47[_0xc6b6('0x32')][_0xc6b6('0x1f')]);}_0x174768[_0xc6b6('0x3b')]=qs[_0xc6b6('0x3c')](_0x10db47['query'][_0xc6b6('0x3c')]);_0x174768['where']=qs[_0xc6b6('0x34')](_['pick'](_0x10db47[_0xc6b6('0x32')],_0x16666a[_0xc6b6('0x34')]));_0x174768['where']['MailQueueId']=_0x135e19['id'];if(_0x10db47[_0xc6b6('0x32')][_0xc6b6('0x40')]){_0x174768[_0xc6b6('0x3d')]=_['merge'](_0x174768[_0xc6b6('0x3d')],{'$or':_[_0xc6b6('0x31')](_0x174768[_0xc6b6('0x36')],function(_0x59e13f){var _0x5bc4ba={};_0x5bc4ba[_0x59e13f]={'$like':'%'+_0x10db47[_0xc6b6('0x32')][_0xc6b6('0x40')]+'%'};return _0x5bc4ba;})});}_0x174768=_[_0xc6b6('0x41')]({},_0x174768,_0x10db47[_0xc6b6('0x49')]);return db['UserMailQueue'][_0xc6b6('0x44')](_0x174768);}})[_0xc6b6('0x27')](function(_0x48131f){if(_0x48131f){return db[_0xc6b6('0x59')]['findAndCountAll']({'where':{'id':_[_0xc6b6('0x31')](_0x48131f,_0xc6b6('0x5a')),'role':_0xc6b6('0x5b')},'attributes':['id',_0xc6b6('0x3f'),_0xc6b6('0x5c'),_0xc6b6('0x5d'),'createdAt']});}})['then'](function(_0xbf1d01){if(_0xbf1d01){return{'count':_0xbf1d01[_0xc6b6('0x1e')],'rows':_[_0xc6b6('0x31')](_0xbf1d01['rows'],function(_0x319b77){return{'membername':_0x319b77[_0xc6b6('0x3f')],'UserId':_0x319b77['id'],'queue_name':_0x2d6338[_0xc6b6('0x3f')],'MailQueueId':_0x2d6338['id'],'interface':util[_0xc6b6('0x5e')](_0xc6b6('0x5f'),_0xc6b6('0x60'),_0x319b77[_0xc6b6('0x3f')]),'penalty':0x0,'paused':_0x319b77[_0xc6b6('0x5c')],'createdAt':_0x319b77[_0xc6b6('0x61')],'updatedAt':_0x319b77[_0xc6b6('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc6b6('0x27')](respondWithFilteredResult(_0x47a18b,_0x174768))[_0xc6b6('0x46')](handleError(_0x47a18b,null));};exports[_0xc6b6('0x62')]=function(_0x30be44,_0x2c4fbf,_0x5342d6){var _0x198a11={};var _0x49770e={};var _0x37c62a;var _0x42f538;return db[_0xc6b6('0x2d')][_0xc6b6('0x57')]({'where':{'id':_0x30be44[_0xc6b6('0x48')]['id']}})[_0xc6b6('0x27')](handleEntityNotFound(_0x2c4fbf,null))['then'](function(_0x2a4dce){if(_0x2a4dce){_0x37c62a=_0x2a4dce;_0x49770e['model']=_['keys'](db[_0xc6b6('0x63')][_0xc6b6('0x64')]);_0x49770e['query']=_[_0xc6b6('0x33')](_0x30be44[_0xc6b6('0x32')]);_0x49770e[_0xc6b6('0x34')]=_[_0xc6b6('0x35')](_0x49770e[_0xc6b6('0x30')],_0x49770e[_0xc6b6('0x32')]);_0x198a11[_0xc6b6('0x36')]=_[_0xc6b6('0x35')](_0x49770e[_0xc6b6('0x30')],qs[_0xc6b6('0x37')](_0x30be44['query'][_0xc6b6('0x37')]));_0x198a11[_0xc6b6('0x36')]=_0x198a11['attributes']['length']?_0x198a11[_0xc6b6('0x36')]:_0x49770e['model'];_0x198a11['order']=qs[_0xc6b6('0x3c')](_0x30be44[_0xc6b6('0x32')][_0xc6b6('0x3c')]);_0x198a11[_0xc6b6('0x3d')]=qs['filters'](_['pick'](_0x30be44['query'],_0x49770e['filters']));if(_0x30be44['query']['filter']){_0x198a11['where']=_[_0xc6b6('0x41')](_0x198a11[_0xc6b6('0x3d')],{'$or':_[_0xc6b6('0x31')](_0x198a11[_0xc6b6('0x36')],function(_0x364728){var _0x207f2f={};_0x207f2f[_0x364728]={'$like':'%'+_0x30be44[_0xc6b6('0x32')][_0xc6b6('0x40')]+'%'};return _0x207f2f;})});}_0x198a11=_['merge']({},_0x198a11,_0x30be44['options']);return _0x37c62a[_0xc6b6('0x62')](_0x198a11);}})[_0xc6b6('0x27')](function(_0x5a4177){if(_0x5a4177){_0x42f538=_0x5a4177[_0xc6b6('0x38')];if(!_0x30be44['query'][_0xc6b6('0x39')](_0xc6b6('0x3a'))){_0x198a11[_0xc6b6('0x20')]=qs[_0xc6b6('0x20')](_0x30be44[_0xc6b6('0x32')]['limit']);_0x198a11[_0xc6b6('0x1f')]=qs[_0xc6b6('0x1f')](_0x30be44['query']['offset']);}return _0x37c62a[_0xc6b6('0x62')](_0x198a11);}})[_0xc6b6('0x27')](function(_0x58dfc0){if(_0x58dfc0){return _0x58dfc0?{'count':_0x42f538,'rows':_0x58dfc0}:null;}})[_0xc6b6('0x27')](respondWithResult(_0x2c4fbf,null))[_0xc6b6('0x46')](handleError(_0x2c4fbf,null));};exports['addTeams']=function(_0x1ef5f7,_0x140608,_0x4d611a){var _0x2eee57=_0x1ef5f7[_0xc6b6('0x4c')]['ids'];return db[_0xc6b6('0x63')][_0xc6b6('0x44')]({'where':{'id':_0x2eee57},'attributes':['id'],'include':[{'model':db[_0xc6b6('0x59')],'as':_0xc6b6('0x65'),'attributes':['id',_0xc6b6('0x3f'),'online',_0xc6b6('0x66'),'interface'],'raw':!![]}]})[_0xc6b6('0x27')](function(_0x21a9da){if(_0x21a9da){var _0xc16394=_[_0xc6b6('0x67')](_0x21a9da,function(_0x59137e){var _0x4d77cf=_0x59137e[_0xc6b6('0x4d')]({'plain':!![]});return _0x4d77cf[_0xc6b6('0x65')];});return db[_0xc6b6('0x2d')][_0xc6b6('0x4a')]({'where':{'id':_0x1ef5f7['params']['id']}})[_0xc6b6('0x27')](function(_0x3c340e){return db[_0xc6b6('0x68')][_0xc6b6('0x69')](function(_0x455aaf){return _0x3c340e[_0xc6b6('0x6a')](_0x2eee57,{'transaction':_0x455aaf})['then'](function(){return BPromise[_0xc6b6('0x6b')](_0xc16394,function(_0x205563){return db[_0xc6b6('0x58')]['findOrCreate']({'where':{'UserId':_0x205563['id'],'MailQueueId':_0x1ef5f7[_0xc6b6('0x48')]['id']},'transaction':_0x455aaf});});})[_0xc6b6('0x27')](function(){_0xc16394['forEach'](function(_0x2663e6){socket[_0xc6b6('0x6c')](_0xc6b6('0x6d'),{'UserId':_0x2663e6['id'],'MailQueueId':_0x3c340e['id']});});});});});}})[_0xc6b6('0x27')](respondWithStatusCode(_0x140608,null))['catch'](handleError(_0x140608,null));};exports[_0xc6b6('0x6e')]=function(_0x9c7a02,_0x479e58,_0x3f407e){return db[_0xc6b6('0x63')][_0xc6b6('0x44')]({'where':{'id':_0x9c7a02[_0xc6b6('0x32')][_0xc6b6('0x6f')]},'attributes':['id'],'include':[{'model':db[_0xc6b6('0x59')],'as':_0xc6b6('0x65'),'attributes':['id'],'raw':!![]}]})[_0xc6b6('0x27')](handleEntityNotFound(_0x479e58,null))[_0xc6b6('0x27')](function(_0x387d8d){var _0x37f85a=_['map'](_0x387d8d,'id');var _0x5c9e5a=[];var _0x5a31e5=[];var _0x269191=squel[_0xc6b6('0x70')]();_0x269191[_0xc6b6('0x71')](_0xc6b6('0x72'))[_0xc6b6('0x73')](_0xc6b6('0x74'),'tq')[_0xc6b6('0x75')]('user_has_teams','ut',_0xc6b6('0x76'))[_0xc6b6('0x3d')]('MailQueueId\x20=\x20?',_0x9c7a02['params']['id']);for(var _0x3013d3=0x0;_0x3013d3<_0x387d8d[_0xc6b6('0x38')];_0x3013d3+=0x1){let _0x438c37=_0x387d8d[_0x3013d3];for(var _0x4f4ae1=0x0;_0x4f4ae1<_0x438c37[_0xc6b6('0x65')][_0xc6b6('0x38')];_0x4f4ae1+=0x1){let _0x1c9ff4=_0x438c37[_0xc6b6('0x65')][_0x4f4ae1];var _0x127bf3=_0x269191[_0xc6b6('0x77')]();_0x127bf3['where'](_0xc6b6('0x78'),_0x1c9ff4['id']);_0x5a31e5['push'](db['sequelize']['query'](_0x127bf3[_0xc6b6('0x79')](),{'type':db[_0xc6b6('0x68')][_0xc6b6('0x7a')][_0xc6b6('0x7b')]})[_0xc6b6('0x27')](function(_0x4113cd){if(_0x4113cd[_0xc6b6('0x38')]===0x1){return _0x1c9ff4['id'];}else{var _0x4f8fdd=_[_0xc6b6('0x7c')](_[_0xc6b6('0x31')](_0x4113cd,'TeamId'),function(_0x70ab2b){return _['includes'](_0x37f85a,_0x70ab2b);});if(_0x4f8fdd){return _0x1c9ff4['id'];}}}));}}return BPromise['all'](_0x5a31e5)['then'](function(_0x4ffbf7){_0x5c9e5a=_(_0x5c9e5a)[_0xc6b6('0x7d')](_0x4ffbf7)[_0xc6b6('0x7e')]()[_0xc6b6('0x7f')]();return db[_0xc6b6('0x2d')][_0xc6b6('0x4a')]({'where':{'id':_0x9c7a02[_0xc6b6('0x48')]['id']}})[_0xc6b6('0x27')](function(_0x5f18db){return db[_0xc6b6('0x68')][_0xc6b6('0x69')](function(_0x501e2d){return _0x5f18db['removeTeams'](_0x9c7a02[_0xc6b6('0x32')][_0xc6b6('0x6f')],{'transaction':_0x501e2d})[_0xc6b6('0x27')](function(){if(!_[_0xc6b6('0x80')](_0x5c9e5a)){return _0x5f18db[_0xc6b6('0x81')](_0x5c9e5a,{'transaction':_0x501e2d});}})['then'](function(){_0x5c9e5a['forEach'](function(_0x4fbc91){socket[_0xc6b6('0x6c')](_0xc6b6('0x82'),{'UserId':_0x4fbc91,'MailQueueId':_0x5f18db['id']});});});});});});})[_0xc6b6('0x27')](respondWithStatusCode(_0x479e58,null))[_0xc6b6('0x46')](handleError(_0x479e58,null));};exports[_0xc6b6('0x83')]=function(_0x76af9d,_0x1d5d78,_0x339d7b){return db['MailQueue'][_0xc6b6('0x4a')]({'where':{'id':_0x76af9d[_0xc6b6('0x48')]['id']}})[_0xc6b6('0x27')](handleEntityNotFound(_0x1d5d78,null))[_0xc6b6('0x27')](function(_0x21c5c4){if(_0x21c5c4){return _0x21c5c4[_0xc6b6('0x83')](_0x76af9d[_0xc6b6('0x4c')][_0xc6b6('0x6f')],_[_0xc6b6('0x84')](_0x76af9d[_0xc6b6('0x4c')],[_0xc6b6('0x6f'),'id'])||{})[_0xc6b6('0x85')](function(_0x18a393){for(var _0x228356=0x0;_0x228356<_0x76af9d['body'][_0xc6b6('0x6f')][_0xc6b6('0x38')];_0x228356+=0x1){socket[_0xc6b6('0x6c')](_0xc6b6('0x6d'),{'UserId':_0x76af9d[_0xc6b6('0x4c')][_0xc6b6('0x6f')][_0x228356],'MailQueueId':_0x76af9d[_0xc6b6('0x48')]['id']});}return _0x18a393;});}})[_0xc6b6('0x27')](respondWithResult(_0x1d5d78,null))[_0xc6b6('0x46')](handleError(_0x1d5d78,null));};exports[_0xc6b6('0x81')]=function(_0x3aeb45,_0x5e60c1,_0x4873c8){return db[_0xc6b6('0x2d')][_0xc6b6('0x4a')]({'where':{'id':_0x3aeb45[_0xc6b6('0x48')]['id']}})[_0xc6b6('0x27')](handleEntityNotFound(_0x5e60c1,null))[_0xc6b6('0x27')](function(_0x3df4ed){if(_0x3df4ed){return _0x3df4ed[_0xc6b6('0x81')](_0x3aeb45[_0xc6b6('0x32')][_0xc6b6('0x6f')])[_0xc6b6('0x27')](function(){if(_['isArray'](_0x3aeb45['query'][_0xc6b6('0x6f')])){for(var _0x4e9993=0x0;_0x4e9993<_0x3aeb45[_0xc6b6('0x32')][_0xc6b6('0x6f')]['length'];_0x4e9993+=0x1){socket[_0xc6b6('0x6c')](_0xc6b6('0x82'),{'UserId':Number(_0x3aeb45[_0xc6b6('0x32')][_0xc6b6('0x6f')][_0x4e9993]),'MailQueueId':Number(_0x3aeb45[_0xc6b6('0x48')]['id'])});}}else{socket[_0xc6b6('0x6c')](_0xc6b6('0x82'),{'UserId':Number(_0x3aeb45[_0xc6b6('0x32')]['ids']),'MailQueueId':Number(_0x3aeb45[_0xc6b6('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x5e60c1,null))[_0xc6b6('0x46')](handleError(_0x5e60c1,null));};exports['getAgents']=function(_0x5592c8,_0x5b174f,_0x372f1c){var _0x438645={};var _0x1783a1={};var _0x8ded90;var _0x3cf4b5;return db[_0xc6b6('0x2d')][_0xc6b6('0x57')]({'where':{'id':_0x5592c8['params']['id']}})[_0xc6b6('0x27')](handleEntityNotFound(_0x5b174f,null))['then'](function(_0x123351){if(_0x123351){_0x8ded90=_0x123351;_0x1783a1[_0xc6b6('0x30')]=_[_0xc6b6('0x33')](db['User'][_0xc6b6('0x64')]);_0x1783a1['query']=_['keys'](_0x5592c8[_0xc6b6('0x32')]);_0x1783a1[_0xc6b6('0x34')]=_[_0xc6b6('0x35')](_0x1783a1[_0xc6b6('0x30')],_0x1783a1[_0xc6b6('0x32')]);_0x438645[_0xc6b6('0x36')]=_[_0xc6b6('0x35')](_0x1783a1[_0xc6b6('0x30')],qs[_0xc6b6('0x37')](_0x5592c8[_0xc6b6('0x32')]['fields']));_0x438645['attributes']=_0x438645[_0xc6b6('0x36')]['length']?_0x438645[_0xc6b6('0x36')]:_0x1783a1[_0xc6b6('0x30')];_0x438645[_0xc6b6('0x3b')]=qs[_0xc6b6('0x3c')](_0x5592c8[_0xc6b6('0x32')][_0xc6b6('0x3c')]);_0x438645[_0xc6b6('0x3d')]=qs['filters'](_[_0xc6b6('0x86')](_0x5592c8[_0xc6b6('0x32')],_0x1783a1[_0xc6b6('0x34')]));if(_0x5592c8[_0xc6b6('0x32')][_0xc6b6('0x40')]){_0x438645[_0xc6b6('0x3d')]=_['merge'](_0x438645['where'],{'$or':_[_0xc6b6('0x31')](_0x438645[_0xc6b6('0x36')],function(_0x69340f){var _0x47b44c={};_0x47b44c[_0x69340f]={'$like':'%'+_0x5592c8[_0xc6b6('0x32')][_0xc6b6('0x40')]+'%'};return _0x47b44c;})});}_0x438645=_[_0xc6b6('0x41')]({},_0x438645,_0x5592c8[_0xc6b6('0x49')]);return _0x8ded90[_0xc6b6('0x87')](_0x438645);}})['then'](function(_0x292088){if(_0x292088){_0x3cf4b5=_0x292088[_0xc6b6('0x38')];if(!_0x5592c8[_0xc6b6('0x32')]['hasOwnProperty'](_0xc6b6('0x3a'))){_0x438645['limit']=qs[_0xc6b6('0x20')](_0x5592c8[_0xc6b6('0x32')][_0xc6b6('0x20')]);_0x438645[_0xc6b6('0x1f')]=qs['offset'](_0x5592c8[_0xc6b6('0x32')][_0xc6b6('0x1f')]);}return _0x8ded90[_0xc6b6('0x87')](_0x438645);}})[_0xc6b6('0x27')](function(_0x570bdc){if(_0x570bdc){return _0x570bdc?{'count':_0x3cf4b5,'rows':_0x570bdc}:null;}})[_0xc6b6('0x27')](respondWithResult(_0x5b174f,null))['catch'](handleError(_0x5b174f,null));}; \ No newline at end of file +var _0x0aba=['Team','getTeams','addTeams','ids','User','Agents','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','userMailQueue:save','removeTeams','field','tq.TeamId','from','team_has_mail_queues','user_has_teams','push','toString','SELECT','every','TeamId','includes','all','union','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','emit','isArray','getAgents','rimraf','zip-dir','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','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','MailQueues','UserProfileResource','error','stack','name','send','index','MailQueue','rawAttributes','key','map','query','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','includeAll','include','rows','show','params','keys','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','length','MailQueueId','UserMailQueue','findAll','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','mailPause'];(function(_0x50ca0d,_0x55d111){var _0x1d93b1=function(_0x25d750){while(--_0x25d750){_0x50ca0d['push'](_0x50ca0d['shift']());}};_0x1d93b1(++_0x55d111);}(_0x0aba,0x140));var _0xa0ab=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x0aba[_0x5608a3];return _0x1ed50a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xa0ab('0x0'));var zipdir=require(_0xa0ab('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa0ab('0x2'));var moment=require(_0xa0ab('0x3'));var BPromise=require(_0xa0ab('0x4'));var Mustache=require(_0xa0ab('0x5'));var util=require(_0xa0ab('0x6'));var path=require('path');var sox=require(_0xa0ab('0x7'));var csv=require(_0xa0ab('0x8'));var ejs=require(_0xa0ab('0x9'));var fs=require('fs');var _=require(_0xa0ab('0xa'));var squel=require('squel');var crypto=require(_0xa0ab('0xb'));var jsforce=require(_0xa0ab('0xc'));var deskjs=require(_0xa0ab('0xd'));var toCsv=require(_0xa0ab('0x8'));var querystring=require(_0xa0ab('0xe'));var Papa=require(_0xa0ab('0xf'));var Redis=require(_0xa0ab('0x10'));var authService=require(_0xa0ab('0x11'));var qs=require(_0xa0ab('0x12'));var as=require(_0xa0ab('0x13'));var hardwareService=require(_0xa0ab('0x14'));var logger=require(_0xa0ab('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xa0ab('0x16'));var db=require(_0xa0ab('0x17'))['db'];config[_0xa0ab('0x18')]=_[_0xa0ab('0x19')](config[_0xa0ab('0x18')],{'host':_0xa0ab('0x1a'),'port':0x18eb});var socket=require(_0xa0ab('0x1b'))(new Redis(config['redis']));require(_0xa0ab('0x1c'))[_0xa0ab('0x1d')](socket);function respondWithStatusCode(_0x42019b,_0x15bb89){_0x15bb89=_0x15bb89||0xcc;return function(_0x1f563f){if(_0x1f563f){return _0x42019b[_0xa0ab('0x1e')](_0x15bb89);}return _0x42019b['status'](_0x15bb89)[_0xa0ab('0x1f')]();};}function respondWithResult(_0x4acb49,_0x3adfe1){_0x3adfe1=_0x3adfe1||0xc8;return function(_0x515193){if(_0x515193){return _0x4acb49[_0xa0ab('0x20')](_0x3adfe1)[_0xa0ab('0x21')](_0x515193);}};}function respondWithFilteredResult(_0x103b48,_0x546ebd){return function(_0x45aa87){if(_0x45aa87){var _0x3032cf=_0x45aa87[_0xa0ab('0x22')],_0x4fb504=_0x546ebd['offset'],_0x516ed4=_0x546ebd[_0xa0ab('0x23')]+_0x546ebd[_0xa0ab('0x24')],_0x560354;if(_0x516ed4>=_0x3032cf){_0x516ed4=_0x3032cf;_0x560354=0xc8;}else{_0x560354=0xce;}_0x103b48['status'](_0x560354);return _0x103b48[_0xa0ab('0x25')](_0xa0ab('0x26'),_0x4fb504+'-'+_0x516ed4+'/'+_0x3032cf)[_0xa0ab('0x21')](_0x45aa87);}return null;};}function patchUpdates(_0x22fc61){return function(_0x5c315){try{jsonpatch['apply'](_0x5c315,_0x22fc61,!![]);}catch(_0x2f1d75){return BPromise[_0xa0ab('0x27')](_0x2f1d75);}return _0x5c315['save']();};}function saveUpdates(_0x3a1e1c,_0x46da02){return function(_0x5f526a){if(_0x5f526a){return _0x5f526a[_0xa0ab('0x28')](_0x3a1e1c)[_0xa0ab('0x29')](function(_0x2f396b){return _0x2f396b;});}return null;};}function removeEntity(_0xd94cc8,_0x36e4bd){return function(_0x5cffff){if(_0x5cffff){return _0x5cffff[_0xa0ab('0x2a')]()[_0xa0ab('0x29')](function(){var _0xb0797e=_0x5cffff['get']({'plain':!![]});var _0x47a8e5=_0xa0ab('0x2b');return db[_0xa0ab('0x2c')][_0xa0ab('0x2a')]({'where':{'type':_0x47a8e5,'resourceId':_0xb0797e['id']}})[_0xa0ab('0x29')](function(){return _0x5cffff;});})[_0xa0ab('0x29')](function(){_0xd94cc8[_0xa0ab('0x20')](0xcc)[_0xa0ab('0x1f')]();});}};}function handleEntityNotFound(_0x56324e,_0x1ad0c5){return function(_0x57c687){if(!_0x57c687){_0x56324e[_0xa0ab('0x1e')](0x194);}return _0x57c687;};}function handleError(_0x2b6cb6,_0x546137){_0x546137=_0x546137||0x1f4;return function(_0x42bba1){logger[_0xa0ab('0x2d')](_0x42bba1[_0xa0ab('0x2e')]);if(_0x42bba1[_0xa0ab('0x2f')]){delete _0x42bba1[_0xa0ab('0x2f')];}_0x2b6cb6[_0xa0ab('0x20')](_0x546137)[_0xa0ab('0x30')](_0x42bba1);};}exports[_0xa0ab('0x31')]=function(_0xa08bed,_0x3bea4c){var _0x14f309={},_0x3ade31={},_0x35d4d3={'count':0x0,'rows':[]};var _0x27a3d0=_['map'](db[_0xa0ab('0x32')][_0xa0ab('0x33')],function(_0x1d96a1){return{'name':_0x1d96a1['fieldName'],'type':_0x1d96a1['type'][_0xa0ab('0x34')]};});_0x3ade31['model']=_[_0xa0ab('0x35')](_0x27a3d0,_0xa0ab('0x2f'));_0x3ade31[_0xa0ab('0x36')]=_['keys'](_0xa08bed[_0xa0ab('0x36')]);_0x3ade31['filters']=_['intersection'](_0x3ade31[_0xa0ab('0x37')],_0x3ade31[_0xa0ab('0x36')]);_0x14f309[_0xa0ab('0x38')]=_[_0xa0ab('0x39')](_0x3ade31['model'],qs[_0xa0ab('0x3a')](_0xa08bed['query'][_0xa0ab('0x3a')]));_0x14f309[_0xa0ab('0x38')]=_0x14f309['attributes']['length']?_0x14f309[_0xa0ab('0x38')]:_0x3ade31[_0xa0ab('0x37')];if(!_0xa08bed[_0xa0ab('0x36')][_0xa0ab('0x3b')](_0xa0ab('0x3c'))){_0x14f309[_0xa0ab('0x24')]=qs[_0xa0ab('0x24')](_0xa08bed[_0xa0ab('0x36')][_0xa0ab('0x24')]);_0x14f309[_0xa0ab('0x23')]=qs[_0xa0ab('0x23')](_0xa08bed[_0xa0ab('0x36')][_0xa0ab('0x23')]);}_0x14f309[_0xa0ab('0x3d')]=qs[_0xa0ab('0x3e')](_0xa08bed['query']['sort']);_0x14f309['where']=qs['filters'](_[_0xa0ab('0x3f')](_0xa08bed[_0xa0ab('0x36')],_0x3ade31[_0xa0ab('0x40')]));if(_0xa08bed[_0xa0ab('0x36')][_0xa0ab('0x41')]){_0x14f309[_0xa0ab('0x42')]=_[_0xa0ab('0x43')](_0x14f309[_0xa0ab('0x42')],{'$or':_[_0xa0ab('0x35')](_0x27a3d0,function(_0x1267f4){if(_0x1267f4['type']!==_0xa0ab('0x44')){var _0x1492bd={};_0x1492bd[_0x1267f4['name']]={'$like':'%'+_0xa08bed[_0xa0ab('0x36')][_0xa0ab('0x41')]+'%'};return _0x1492bd;}})});}_0x14f309=_[_0xa0ab('0x43')]({},_0x14f309,_0xa08bed['options']);var _0x738886={'where':_0x14f309['where']};return db[_0xa0ab('0x32')][_0xa0ab('0x22')](_0x738886)[_0xa0ab('0x29')](function(_0x800819){_0x35d4d3[_0xa0ab('0x22')]=_0x800819;if(_0xa08bed[_0xa0ab('0x36')][_0xa0ab('0x45')]){_0x14f309[_0xa0ab('0x46')]=[{'all':!![]}];}return db[_0xa0ab('0x32')]['findAll'](_0x14f309);})['then'](function(_0x218210){_0x35d4d3[_0xa0ab('0x47')]=_0x218210;return _0x35d4d3;})[_0xa0ab('0x29')](respondWithFilteredResult(_0x3bea4c,_0x14f309))['catch'](handleError(_0x3bea4c,null));};exports[_0xa0ab('0x48')]=function(_0x5074ff,_0x46da90){var _0x5bd400={'raw':!![],'where':{'id':_0x5074ff[_0xa0ab('0x49')]['id']}},_0x127901={};_0x127901[_0xa0ab('0x37')]=_[_0xa0ab('0x4a')](db[_0xa0ab('0x32')][_0xa0ab('0x33')]);_0x127901[_0xa0ab('0x36')]=_[_0xa0ab('0x4a')](_0x5074ff[_0xa0ab('0x36')]);_0x127901[_0xa0ab('0x40')]=_[_0xa0ab('0x39')](_0x127901[_0xa0ab('0x37')],_0x127901['query']);_0x5bd400[_0xa0ab('0x38')]=_['intersection'](_0x127901['model'],qs[_0xa0ab('0x3a')](_0x5074ff[_0xa0ab('0x36')][_0xa0ab('0x3a')]));_0x5bd400[_0xa0ab('0x38')]=_0x5bd400[_0xa0ab('0x38')]['length']?_0x5bd400[_0xa0ab('0x38')]:_0x127901['model'];if(_0x5074ff['query'][_0xa0ab('0x45')]){_0x5bd400[_0xa0ab('0x46')]=[{'all':!![]}];}_0x5bd400=_[_0xa0ab('0x43')]({},_0x5bd400,_0x5074ff[_0xa0ab('0x4b')]);return db[_0xa0ab('0x32')][_0xa0ab('0x4c')](_0x5bd400)[_0xa0ab('0x29')](handleEntityNotFound(_0x46da90,null))[_0xa0ab('0x29')](respondWithResult(_0x46da90,null))['catch'](handleError(_0x46da90,null));};exports['create']=function(_0x30ddd6,_0x4216a7){return db[_0xa0ab('0x32')][_0xa0ab('0x4d')](_0x30ddd6[_0xa0ab('0x4e')],{})[_0xa0ab('0x29')](function(_0x48d464){var _0x2c5bdb=_0x30ddd6['user'][_0xa0ab('0x4f')]({'plain':!![]});if(!_0x2c5bdb)throw new Error(_0xa0ab('0x50'));if(_0x2c5bdb[_0xa0ab('0x51')]===_0xa0ab('0x52')){var _0x1637ba=_0x48d464[_0xa0ab('0x4f')]({'plain':!![]});var _0x21d4d3=_0xa0ab('0x2b');return db[_0xa0ab('0x53')]['find']({'where':{'name':_0x21d4d3,'userProfileId':_0x2c5bdb[_0xa0ab('0x54')]},'raw':!![]})[_0xa0ab('0x29')](function(_0x46f682){if(_0x46f682&&_0x46f682['autoAssociation']===0x0){return db[_0xa0ab('0x2c')][_0xa0ab('0x4d')]({'name':_0x1637ba[_0xa0ab('0x2f')],'resourceId':_0x1637ba['id'],'type':_0x46f682['name'],'sectionId':_0x46f682['id']},{})[_0xa0ab('0x29')](function(){return _0x48d464;});}else{return _0x48d464;}})[_0xa0ab('0x55')](function(_0x164312){logger['error'](_0xa0ab('0x56'),_0x164312);throw _0x164312;});}return _0x48d464;})[_0xa0ab('0x29')](respondWithResult(_0x4216a7,0xc9))[_0xa0ab('0x55')](handleError(_0x4216a7,null));};exports[_0xa0ab('0x28')]=function(_0x4f8f6e,_0x2685ea){if(_0x4f8f6e[_0xa0ab('0x4e')]['id']){delete _0x4f8f6e[_0xa0ab('0x4e')]['id'];}return db[_0xa0ab('0x32')][_0xa0ab('0x4c')]({'where':{'id':_0x4f8f6e[_0xa0ab('0x49')]['id']}})['then'](handleEntityNotFound(_0x2685ea,null))['then'](saveUpdates(_0x4f8f6e['body'],null))[_0xa0ab('0x29')](respondWithResult(_0x2685ea,null))[_0xa0ab('0x55')](handleError(_0x2685ea,null));};exports[_0xa0ab('0x2a')]=function(_0x19f467,_0xa03f00){return db['MailQueue'][_0xa0ab('0x4c')]({'where':{'id':_0x19f467['params']['id']}})[_0xa0ab('0x29')](handleEntityNotFound(_0xa03f00,null))[_0xa0ab('0x29')](removeEntity(_0xa03f00,null))['catch'](handleError(_0xa03f00,null));};exports[_0xa0ab('0x57')]=function(_0x3c7c6b,_0x3008a0){return db[_0xa0ab('0x32')][_0xa0ab('0x57')]()['then'](respondWithResult(_0x3008a0,null))['catch'](handleError(_0x3008a0,null));};exports[_0xa0ab('0x58')]=function(_0x4e1049,_0x26a475,_0x2655fd){var _0x3fa9ad={'raw':!![],'where':{}},_0x42904c={},_0x32d655;return db[_0xa0ab('0x32')][_0xa0ab('0x59')]({'where':{'id':_0x4e1049[_0xa0ab('0x49')]['id']}})[_0xa0ab('0x29')](handleEntityNotFound(_0x26a475,null))['then'](function(_0x19e220){if(_0x19e220){_0x32d655=_0x19e220[_0xa0ab('0x4f')]({'plain':!![]});_0x42904c[_0xa0ab('0x37')]=_[_0xa0ab('0x4a')](db['UserMailQueue']['rawAttributes']);_0x42904c['query']=_[_0xa0ab('0x4a')](_0x4e1049[_0xa0ab('0x36')]);_0x42904c[_0xa0ab('0x40')]=_[_0xa0ab('0x39')](_0x42904c[_0xa0ab('0x37')],_0x42904c['query']);_0x3fa9ad[_0xa0ab('0x38')]=_[_0xa0ab('0x39')](_0x42904c[_0xa0ab('0x37')],qs[_0xa0ab('0x3a')](_0x4e1049[_0xa0ab('0x36')][_0xa0ab('0x3a')]));_0x3fa9ad[_0xa0ab('0x38')]=_0x3fa9ad[_0xa0ab('0x38')][_0xa0ab('0x5a')]?_0x3fa9ad[_0xa0ab('0x38')]:_0x42904c[_0xa0ab('0x37')];if(!_0x4e1049[_0xa0ab('0x36')][_0xa0ab('0x3b')](_0xa0ab('0x3c'))){_0x3fa9ad[_0xa0ab('0x24')]=qs['limit'](_0x4e1049[_0xa0ab('0x36')][_0xa0ab('0x24')]);_0x3fa9ad[_0xa0ab('0x23')]=qs[_0xa0ab('0x23')](_0x4e1049[_0xa0ab('0x36')][_0xa0ab('0x23')]);}_0x3fa9ad[_0xa0ab('0x3d')]=qs[_0xa0ab('0x3e')](_0x4e1049[_0xa0ab('0x36')]['sort']);_0x3fa9ad['where']=qs['filters'](_[_0xa0ab('0x3f')](_0x4e1049[_0xa0ab('0x36')],_0x42904c[_0xa0ab('0x40')]));_0x3fa9ad[_0xa0ab('0x42')][_0xa0ab('0x5b')]=_0x19e220['id'];if(_0x4e1049[_0xa0ab('0x36')][_0xa0ab('0x41')]){_0x3fa9ad['where']=_['merge'](_0x3fa9ad[_0xa0ab('0x42')],{'$or':_[_0xa0ab('0x35')](_0x3fa9ad[_0xa0ab('0x38')],function(_0x1603c4){var _0x14bcdd={};_0x14bcdd[_0x1603c4]={'$like':'%'+_0x4e1049[_0xa0ab('0x36')][_0xa0ab('0x41')]+'%'};return _0x14bcdd;})});}_0x3fa9ad=_[_0xa0ab('0x43')]({},_0x3fa9ad,_0x4e1049['options']);return db[_0xa0ab('0x5c')][_0xa0ab('0x5d')](_0x3fa9ad);}})[_0xa0ab('0x29')](function(_0x10a491){if(_0x10a491){return db['User'][_0xa0ab('0x5e')]({'where':{'id':_['map'](_0x10a491,_0xa0ab('0x5f')),'role':_0xa0ab('0x60')},'attributes':['id',_0xa0ab('0x2f'),'mailPause',_0xa0ab('0x61'),_0xa0ab('0x62')]});}})[_0xa0ab('0x29')](function(_0x345965){if(_0x345965){return{'count':_0x345965[_0xa0ab('0x22')],'rows':_[_0xa0ab('0x35')](_0x345965[_0xa0ab('0x47')],function(_0x196dc6){return{'membername':_0x196dc6[_0xa0ab('0x2f')],'UserId':_0x196dc6['id'],'queue_name':_0x32d655[_0xa0ab('0x2f')],'MailQueueId':_0x32d655['id'],'interface':util[_0xa0ab('0x63')](_0xa0ab('0x64'),_0xa0ab('0x65'),_0x196dc6[_0xa0ab('0x2f')]),'penalty':0x0,'paused':_0x196dc6[_0xa0ab('0x66')],'createdAt':_0x196dc6[_0xa0ab('0x62')],'updatedAt':_0x196dc6[_0xa0ab('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa0ab('0x29')](respondWithFilteredResult(_0x26a475,_0x3fa9ad))[_0xa0ab('0x55')](handleError(_0x26a475,null));};exports['getTeams']=function(_0x4fa447,_0x52c73d,_0x1b2ceb){var _0x206367={};var _0xd9339b={};var _0x394745;var _0x687109;return db[_0xa0ab('0x32')]['findOne']({'where':{'id':_0x4fa447[_0xa0ab('0x49')]['id']}})[_0xa0ab('0x29')](handleEntityNotFound(_0x52c73d,null))['then'](function(_0x4ea854){if(_0x4ea854){_0x394745=_0x4ea854;_0xd9339b[_0xa0ab('0x37')]=_[_0xa0ab('0x4a')](db[_0xa0ab('0x67')][_0xa0ab('0x33')]);_0xd9339b['query']=_['keys'](_0x4fa447['query']);_0xd9339b[_0xa0ab('0x40')]=_[_0xa0ab('0x39')](_0xd9339b[_0xa0ab('0x37')],_0xd9339b[_0xa0ab('0x36')]);_0x206367[_0xa0ab('0x38')]=_['intersection'](_0xd9339b['model'],qs['fields'](_0x4fa447[_0xa0ab('0x36')]['fields']));_0x206367[_0xa0ab('0x38')]=_0x206367[_0xa0ab('0x38')][_0xa0ab('0x5a')]?_0x206367[_0xa0ab('0x38')]:_0xd9339b[_0xa0ab('0x37')];_0x206367[_0xa0ab('0x3d')]=qs[_0xa0ab('0x3e')](_0x4fa447[_0xa0ab('0x36')][_0xa0ab('0x3e')]);_0x206367['where']=qs['filters'](_[_0xa0ab('0x3f')](_0x4fa447[_0xa0ab('0x36')],_0xd9339b[_0xa0ab('0x40')]));if(_0x4fa447[_0xa0ab('0x36')][_0xa0ab('0x41')]){_0x206367[_0xa0ab('0x42')]=_['merge'](_0x206367[_0xa0ab('0x42')],{'$or':_[_0xa0ab('0x35')](_0x206367[_0xa0ab('0x38')],function(_0x189ca4){var _0x247227={};_0x247227[_0x189ca4]={'$like':'%'+_0x4fa447['query'][_0xa0ab('0x41')]+'%'};return _0x247227;})});}_0x206367=_['merge']({},_0x206367,_0x4fa447[_0xa0ab('0x4b')]);return _0x394745[_0xa0ab('0x68')](_0x206367);}})[_0xa0ab('0x29')](function(_0x5ede7c){if(_0x5ede7c){_0x687109=_0x5ede7c[_0xa0ab('0x5a')];if(!_0x4fa447['query'][_0xa0ab('0x3b')](_0xa0ab('0x3c'))){_0x206367[_0xa0ab('0x24')]=qs[_0xa0ab('0x24')](_0x4fa447[_0xa0ab('0x36')][_0xa0ab('0x24')]);_0x206367[_0xa0ab('0x23')]=qs['offset'](_0x4fa447['query'][_0xa0ab('0x23')]);}return _0x394745[_0xa0ab('0x68')](_0x206367);}})[_0xa0ab('0x29')](function(_0x53285e){if(_0x53285e){return _0x53285e?{'count':_0x687109,'rows':_0x53285e}:null;}})[_0xa0ab('0x29')](respondWithResult(_0x52c73d,null))['catch'](handleError(_0x52c73d,null));};exports[_0xa0ab('0x69')]=function(_0x16bf1f,_0x201eb9,_0x16bac3){var _0x3f9860=_0x16bf1f[_0xa0ab('0x4e')][_0xa0ab('0x6a')];return db[_0xa0ab('0x67')][_0xa0ab('0x5d')]({'where':{'id':_0x3f9860},'attributes':['id'],'include':[{'model':db[_0xa0ab('0x6b')],'as':_0xa0ab('0x6c'),'attributes':['id',_0xa0ab('0x2f'),'online',_0xa0ab('0x6d'),'interface'],'raw':!![]}]})[_0xa0ab('0x29')](function(_0x12e050){if(_0x12e050){var _0x43f581=_[_0xa0ab('0x6e')](_0x12e050,function(_0x3e269d){var _0x286eb0=_0x3e269d[_0xa0ab('0x4f')]({'plain':!![]});return _0x286eb0[_0xa0ab('0x6c')];});return db['MailQueue'][_0xa0ab('0x4c')]({'where':{'id':_0x16bf1f[_0xa0ab('0x49')]['id']}})[_0xa0ab('0x29')](function(_0x2b88e4){return db[_0xa0ab('0x6f')][_0xa0ab('0x70')](function(_0x2b66ae){return _0x2b88e4[_0xa0ab('0x69')](_0x3f9860,{'transaction':_0x2b66ae})[_0xa0ab('0x29')](function(){return BPromise[_0xa0ab('0x71')](_0x43f581,function(_0x51205a){return db[_0xa0ab('0x5c')][_0xa0ab('0x72')]({'where':{'UserId':_0x51205a['id'],'MailQueueId':_0x16bf1f['params']['id']},'transaction':_0x2b66ae});});})['then'](function(){_0x43f581[_0xa0ab('0x73')](function(_0x12489c){socket['emit'](_0xa0ab('0x74'),{'UserId':_0x12489c['id'],'MailQueueId':_0x2b88e4['id']});});});});});}})['then'](respondWithStatusCode(_0x201eb9,null))[_0xa0ab('0x55')](handleError(_0x201eb9,null));};exports[_0xa0ab('0x75')]=function(_0x16e1eb,_0x5c7f1e,_0x37aec7){return db[_0xa0ab('0x67')]['findAll']({'where':{'id':_0x16e1eb[_0xa0ab('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0xa0ab('0x6b')],'as':_0xa0ab('0x6c'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5c7f1e,null))[_0xa0ab('0x29')](function(_0x3cbec0){var _0x2e741d=_[_0xa0ab('0x35')](_0x3cbec0,'id');var _0xea861d=[];var _0x4e387c=[];var _0x5d6ac1=squel['select']();_0x5d6ac1[_0xa0ab('0x76')](_0xa0ab('0x77'))[_0xa0ab('0x78')](_0xa0ab('0x79'),'tq')['join'](_0xa0ab('0x7a'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xa0ab('0x42')]('MailQueueId\x20=\x20?',_0x16e1eb['params']['id']);for(var _0x2e2a4b=0x0;_0x2e2a4b<_0x3cbec0[_0xa0ab('0x5a')];_0x2e2a4b+=0x1){let _0x113db7=_0x3cbec0[_0x2e2a4b];for(var _0xff8745=0x0;_0xff8745<_0x113db7['Agents']['length'];_0xff8745+=0x1){let _0x3f45bb=_0x113db7[_0xa0ab('0x6c')][_0xff8745];var _0xe04631=_0x5d6ac1['clone']();_0xe04631[_0xa0ab('0x42')]('ut.UserId\x20=\x20?',_0x3f45bb['id']);_0x4e387c[_0xa0ab('0x7b')](db[_0xa0ab('0x6f')][_0xa0ab('0x36')](_0xe04631[_0xa0ab('0x7c')](),{'type':db['sequelize']['QueryTypes'][_0xa0ab('0x7d')]})[_0xa0ab('0x29')](function(_0x2556e3){if(_0x2556e3[_0xa0ab('0x5a')]===0x1){return _0x3f45bb['id'];}else{var _0x4f6bb3=_[_0xa0ab('0x7e')](_[_0xa0ab('0x35')](_0x2556e3,_0xa0ab('0x7f')),function(_0x37e3ee){return _[_0xa0ab('0x80')](_0x2e741d,_0x37e3ee);});if(_0x4f6bb3){return _0x3f45bb['id'];}}}));}}return BPromise[_0xa0ab('0x81')](_0x4e387c)['then'](function(_0x4520f6){_0xea861d=_(_0xea861d)[_0xa0ab('0x82')](_0x4520f6)['compact']()[_0xa0ab('0x83')]();return db[_0xa0ab('0x32')][_0xa0ab('0x4c')]({'where':{'id':_0x16e1eb[_0xa0ab('0x49')]['id']}})[_0xa0ab('0x29')](function(_0x2323b4){return db['sequelize'][_0xa0ab('0x70')](function(_0x42a17b){return _0x2323b4[_0xa0ab('0x75')](_0x16e1eb[_0xa0ab('0x36')][_0xa0ab('0x6a')],{'transaction':_0x42a17b})[_0xa0ab('0x29')](function(){if(!_[_0xa0ab('0x84')](_0xea861d)){return _0x2323b4[_0xa0ab('0x85')](_0xea861d,{'transaction':_0x42a17b});}})[_0xa0ab('0x29')](function(){_0xea861d[_0xa0ab('0x73')](function(_0x166877){socket['emit'](_0xa0ab('0x86'),{'UserId':_0x166877,'MailQueueId':_0x2323b4['id']});});});});});});})[_0xa0ab('0x29')](respondWithStatusCode(_0x5c7f1e,null))[_0xa0ab('0x55')](handleError(_0x5c7f1e,null));};exports[_0xa0ab('0x87')]=function(_0x5875f0,_0x4fb2de,_0x1d1559){return db['MailQueue'][_0xa0ab('0x4c')]({'where':{'id':_0x5875f0[_0xa0ab('0x49')]['id']}})[_0xa0ab('0x29')](handleEntityNotFound(_0x4fb2de,null))[_0xa0ab('0x29')](function(_0x257525){if(_0x257525){return _0x257525[_0xa0ab('0x87')](_0x5875f0[_0xa0ab('0x4e')][_0xa0ab('0x6a')],_[_0xa0ab('0x88')](_0x5875f0['body'],[_0xa0ab('0x6a'),'id'])||{})[_0xa0ab('0x89')](function(_0x486668){for(var _0xe002b6=0x0;_0xe002b6<_0x5875f0[_0xa0ab('0x4e')]['ids']['length'];_0xe002b6+=0x1){socket[_0xa0ab('0x8a')](_0xa0ab('0x74'),{'UserId':_0x5875f0[_0xa0ab('0x4e')]['ids'][_0xe002b6],'MailQueueId':_0x5875f0['params']['id']});}return _0x486668;});}})[_0xa0ab('0x29')](respondWithResult(_0x4fb2de,null))[_0xa0ab('0x55')](handleError(_0x4fb2de,null));};exports[_0xa0ab('0x85')]=function(_0x2dbb21,_0x470120,_0x5e6e44){return db[_0xa0ab('0x32')]['find']({'where':{'id':_0x2dbb21['params']['id']}})[_0xa0ab('0x29')](handleEntityNotFound(_0x470120,null))[_0xa0ab('0x29')](function(_0x2d6208){if(_0x2d6208){return _0x2d6208[_0xa0ab('0x85')](_0x2dbb21['query'][_0xa0ab('0x6a')])[_0xa0ab('0x29')](function(){if(_[_0xa0ab('0x8b')](_0x2dbb21[_0xa0ab('0x36')][_0xa0ab('0x6a')])){for(var _0xd507a9=0x0;_0xd507a9<_0x2dbb21['query'][_0xa0ab('0x6a')]['length'];_0xd507a9+=0x1){socket[_0xa0ab('0x8a')](_0xa0ab('0x86'),{'UserId':Number(_0x2dbb21[_0xa0ab('0x36')][_0xa0ab('0x6a')][_0xd507a9]),'MailQueueId':Number(_0x2dbb21['params']['id'])});}}else{socket[_0xa0ab('0x8a')](_0xa0ab('0x86'),{'UserId':Number(_0x2dbb21[_0xa0ab('0x36')]['ids']),'MailQueueId':Number(_0x2dbb21['params']['id'])});}});}})[_0xa0ab('0x29')](respondWithStatusCode(_0x470120,null))[_0xa0ab('0x55')](handleError(_0x470120,null));};exports['getAgents']=function(_0x3fdc07,_0x279a2a,_0x3f4cb7){var _0x2590c8={};var _0x133d66={};var _0x3b8027;var _0x48e5b0;return db[_0xa0ab('0x32')][_0xa0ab('0x59')]({'where':{'id':_0x3fdc07['params']['id']}})[_0xa0ab('0x29')](handleEntityNotFound(_0x279a2a,null))[_0xa0ab('0x29')](function(_0x466c30){if(_0x466c30){_0x3b8027=_0x466c30;_0x133d66[_0xa0ab('0x37')]=_[_0xa0ab('0x4a')](db[_0xa0ab('0x6b')][_0xa0ab('0x33')]);_0x133d66[_0xa0ab('0x36')]=_[_0xa0ab('0x4a')](_0x3fdc07[_0xa0ab('0x36')]);_0x133d66[_0xa0ab('0x40')]=_[_0xa0ab('0x39')](_0x133d66[_0xa0ab('0x37')],_0x133d66[_0xa0ab('0x36')]);_0x2590c8[_0xa0ab('0x38')]=_[_0xa0ab('0x39')](_0x133d66[_0xa0ab('0x37')],qs[_0xa0ab('0x3a')](_0x3fdc07['query']['fields']));_0x2590c8[_0xa0ab('0x38')]=_0x2590c8['attributes'][_0xa0ab('0x5a')]?_0x2590c8[_0xa0ab('0x38')]:_0x133d66['model'];_0x2590c8[_0xa0ab('0x3d')]=qs[_0xa0ab('0x3e')](_0x3fdc07['query']['sort']);_0x2590c8[_0xa0ab('0x42')]=qs[_0xa0ab('0x40')](_[_0xa0ab('0x3f')](_0x3fdc07[_0xa0ab('0x36')],_0x133d66[_0xa0ab('0x40')]));if(_0x3fdc07[_0xa0ab('0x36')]['filter']){_0x2590c8[_0xa0ab('0x42')]=_[_0xa0ab('0x43')](_0x2590c8[_0xa0ab('0x42')],{'$or':_[_0xa0ab('0x35')](_0x2590c8[_0xa0ab('0x38')],function(_0x181209){var _0x4573a9={};_0x4573a9[_0x181209]={'$like':'%'+_0x3fdc07[_0xa0ab('0x36')][_0xa0ab('0x41')]+'%'};return _0x4573a9;})});}_0x2590c8=_[_0xa0ab('0x43')]({},_0x2590c8,_0x3fdc07[_0xa0ab('0x4b')]);return _0x3b8027['getAgents'](_0x2590c8);}})[_0xa0ab('0x29')](function(_0x3e97fe){if(_0x3e97fe){_0x48e5b0=_0x3e97fe[_0xa0ab('0x5a')];if(!_0x3fdc07[_0xa0ab('0x36')][_0xa0ab('0x3b')]('nolimit')){_0x2590c8[_0xa0ab('0x24')]=qs['limit'](_0x3fdc07[_0xa0ab('0x36')][_0xa0ab('0x24')]);_0x2590c8[_0xa0ab('0x23')]=qs[_0xa0ab('0x23')](_0x3fdc07[_0xa0ab('0x36')][_0xa0ab('0x23')]);}return _0x3b8027[_0xa0ab('0x8c')](_0x2590c8);}})['then'](function(_0xb40bd8){if(_0xb40bd8){return _0xb40bd8?{'count':_0x48e5b0,'rows':_0xb40bd8}:null;}})['then'](respondWithResult(_0x279a2a,null))[_0xa0ab('0x55')](handleError(_0x279a2a,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 48f4a53..cf131e7 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 _0x4830=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailQueue','setMaxListeners'];(function(_0x17f8d8,_0x4d291b){var _0x5670d2=function(_0x3007d4){while(--_0x3007d4){_0x17f8d8['push'](_0x17f8d8['shift']());}};_0x5670d2(++_0x4d291b);}(_0x4830,0x140));var _0x0483=function(_0x306651,_0x1b8545){_0x306651=_0x306651-0x0;var _0xcf7db3=_0x4830[_0x306651];return _0xcf7db3;};'use strict';var EventEmitter=require(_0x0483('0x0'));var MailQueue=require(_0x0483('0x1'))['db'][_0x0483('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x0483('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0483('0x4'),'afterDestroy':'remove'};function emitEvent(_0xc7cf41){return function(_0x47d17a,_0x2667be,_0x4136a9){MailQueueEvents[_0x0483('0x5')](_0xc7cf41+':'+_0x47d17a['id'],_0x47d17a);MailQueueEvents[_0x0483('0x5')](_0xc7cf41,_0x47d17a);_0x4136a9(null);};}for(var e in events){if(events[_0x0483('0x6')](e)){var event=events[e];MailQueue[_0x0483('0x7')](e,emitEvent(event));}}module[_0x0483('0x8')]=MailQueueEvents; \ No newline at end of file +var _0x41e9=['events','../../mysqldb','MailQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x254e65,_0x5e32e5){var _0x22bd9d=function(_0x3c34aa){while(--_0x3c34aa){_0x254e65['push'](_0x254e65['shift']());}};_0x22bd9d(++_0x5e32e5);}(_0x41e9,0x140));var _0x941e=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x41e9[_0x17d9e3];return _0x14192d;};'use strict';var EventEmitter=require(_0x941e('0x0'));var MailQueue=require(_0x941e('0x1'))['db'][_0x941e('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x941e('0x3')](0x0);var events={'afterCreate':_0x941e('0x4'),'afterUpdate':_0x941e('0x5'),'afterDestroy':_0x941e('0x6')};function emitEvent(_0x50d629){return function(_0x2c997d,_0x16da36,_0x15e008){MailQueueEvents[_0x941e('0x7')](_0x50d629+':'+_0x2c997d['id'],_0x2c997d);MailQueueEvents['emit'](_0x50d629,_0x2c997d);_0x15e008(null);};}for(var e in events){if(events[_0x941e('0x8')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x941e('0x9')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index f6e086b..127853f 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 _0xc4f8=['mail_queues','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','exports','MailQueue'];(function(_0xe0a6b3,_0x1a75f4){var _0x179504=function(_0x157095){while(--_0x157095){_0xe0a6b3['push'](_0xe0a6b3['shift']());}};_0x179504(++_0x1a75f4);}(_0xc4f8,0x1a3));var _0x8c4f=function(_0x20b536,_0x2c5a7d){_0x20b536=_0x20b536-0x0;var _0x36b59e=_0xc4f8[_0x20b536];return _0x36b59e;};'use strict';var _=require(_0x8c4f('0x0'));var util=require(_0x8c4f('0x1'));var logger=require('../../config/logger')(_0x8c4f('0x2'));var moment=require(_0x8c4f('0x3'));var BPromise=require('bluebird');var rp=require(_0x8c4f('0x4'));var fs=require('fs');var path=require(_0x8c4f('0x5'));var rimraf=require(_0x8c4f('0x6'));var config=require(_0x8c4f('0x7'));var attributes=require('./mailQueue.attributes');module[_0x8c4f('0x8')]=function(_0x12d729,_0x56e1e5){return _0x12d729['define'](_0x8c4f('0x9'),attributes,{'tableName':_0x8c4f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xacd2=['./mailQueue.attributes','exports','define','MailQueue','mail_queues','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x261e29,_0x10fffd){var _0x25ef43=function(_0x21b8e7){while(--_0x21b8e7){_0x261e29['push'](_0x261e29['shift']());}};_0x25ef43(++_0x10fffd);}(_0xacd2,0x14a));var _0x2acd=function(_0x1de2bb,_0x23435b){_0x1de2bb=_0x1de2bb-0x0;var _0x48a090=_0xacd2[_0x1de2bb];return _0x48a090;};'use strict';var _=require('lodash');var util=require(_0x2acd('0x0'));var logger=require(_0x2acd('0x1'))(_0x2acd('0x2'));var moment=require(_0x2acd('0x3'));var BPromise=require('bluebird');var rp=require(_0x2acd('0x4'));var fs=require('fs');var path=require(_0x2acd('0x5'));var rimraf=require(_0x2acd('0x6'));var config=require(_0x2acd('0x7'));var attributes=require(_0x2acd('0x8'));module[_0x2acd('0x9')]=function(_0x19538f,_0x4c7420){return _0x19538f[_0x2acd('0xa')](_0x2acd('0xb'),attributes,{'tableName':_0x2acd('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 8c45b1f..391217f 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 _0xb455=['request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetMailQueue','findAll','options','raw','where','include','map','attributes','model','debug','catch','MailQueue','ShowMailQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','./mailQueue.socket','register'];(function(_0x3e3646,_0x35c8d9){var _0x24ec32=function(_0x3af02c){while(--_0x3af02c){_0x3e3646['push'](_0x3e3646['shift']());}};_0x24ec32(++_0x35c8d9);}(_0xb455,0xdf));var _0x5b45=function(_0x5e9ca8,_0x277320){_0x5e9ca8=_0x5e9ca8-0x0;var _0x3daccb=_0xb455[_0x5e9ca8];return _0x3daccb;};'use strict';var _=require(_0x5b45('0x0'));var util=require(_0x5b45('0x1'));var moment=require(_0x5b45('0x2'));var BPromise=require(_0x5b45('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5b45('0x4'));var db=require(_0x5b45('0x5'))['db'];var utils=require(_0x5b45('0x6'));var logger=require(_0x5b45('0x7'))(_0x5b45('0x8'));var config=require(_0x5b45('0x9'));var jayson=require(_0x5b45('0xa'));var client=jayson['client'][_0x5b45('0xb')]({'port':0x232a});config['redis']=_[_0x5b45('0xc')](config['redis'],{'host':_0x5b45('0xd'),'port':0x18eb});var socket=require(_0x5b45('0xe'))(new Redis(config['redis']));require(_0x5b45('0xf'))[_0x5b45('0x10')](socket);function respondWithRpcPromise(_0x4ac3e9,_0x1f9863,_0x18c4a7){return new BPromise(function(_0xf2f04b,_0x2d50c3){return client[_0x5b45('0x11')](_0x4ac3e9,_0x18c4a7)[_0x5b45('0x12')](function(_0x459735){logger[_0x5b45('0x13')](_0x5b45('0x14'),_0x1f9863,_0x5b45('0x15'));logger['debug'](_0x5b45('0x16'),_0x1f9863,_0x5b45('0x15'),JSON[_0x5b45('0x17')](_0x459735));if(_0x459735[_0x5b45('0x18')]){if(_0x459735[_0x5b45('0x18')]['code']===0x1f4){logger[_0x5b45('0x18')](_0x5b45('0x14'),_0x1f9863,_0x459735['error'][_0x5b45('0x19')]);return _0x2d50c3(_0x459735[_0x5b45('0x18')]['message']);}logger[_0x5b45('0x18')]('MailQueue,\x20%s,\x20%s',_0x1f9863,_0x459735[_0x5b45('0x18')][_0x5b45('0x19')]);return _0xf2f04b(_0x459735[_0x5b45('0x18')][_0x5b45('0x19')]);}else{logger[_0x5b45('0x13')](_0x5b45('0x14'),_0x1f9863,_0x5b45('0x15'));_0xf2f04b(_0x459735[_0x5b45('0x1a')][_0x5b45('0x19')]);}})['catch'](function(_0x4d454d){logger['error'](_0x5b45('0x14'),_0x1f9863,_0x4d454d);_0x2d50c3(_0x4d454d);});});}exports[_0x5b45('0x1b')]=function(_0x1026de){var _0x106992=this;return new Promise(function(_0x16dbdc,_0x5eb97b){return db['MailQueue'][_0x5b45('0x1c')]({'raw':_0x1026de[_0x5b45('0x1d')]?_0x1026de[_0x5b45('0x1d')][_0x5b45('0x1e')]===undefined?!![]:![]:!![],'where':_0x1026de['options']?_0x1026de[_0x5b45('0x1d')][_0x5b45('0x1f')]||null:null,'attributes':_0x1026de[_0x5b45('0x1d')]?_0x1026de[_0x5b45('0x1d')]['attributes']||null:null,'limit':_0x1026de[_0x5b45('0x1d')]?_0x1026de[_0x5b45('0x1d')]['limit']||null:null,'include':_0x1026de['options']?_0x1026de[_0x5b45('0x1d')][_0x5b45('0x20')]?_[_0x5b45('0x21')](_0x1026de['options'][_0x5b45('0x20')],function(_0xa1245f){return{'model':db[_0xa1245f['model']],'as':_0xa1245f['as'],'attributes':_0xa1245f[_0x5b45('0x22')],'include':_0xa1245f[_0x5b45('0x20')]?_[_0x5b45('0x21')](_0xa1245f[_0x5b45('0x20')],function(_0x2edd57){return{'model':db[_0x2edd57['model']],'as':_0x2edd57['as'],'attributes':_0x2edd57[_0x5b45('0x22')],'include':_0x2edd57[_0x5b45('0x20')]?_['map'](_0x2edd57[_0x5b45('0x20')],function(_0x50cca4){return{'model':db[_0x50cca4[_0x5b45('0x23')]],'as':_0x50cca4['as'],'attributes':_0x50cca4[_0x5b45('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2eb1ed){logger[_0x5b45('0x13')](_0x5b45('0x1b'),_0x1026de);logger[_0x5b45('0x24')](_0x5b45('0x1b'),_0x1026de,JSON[_0x5b45('0x17')](_0x2eb1ed));_0x16dbdc(_0x2eb1ed);})[_0x5b45('0x25')](function(_0x3e1d3c){logger[_0x5b45('0x18')](_0x5b45('0x1b'),_0x3e1d3c['message'],_0x1026de);_0x5eb97b(_0x106992['error'](0x1f4,_0x3e1d3c[_0x5b45('0x19')]));});});};exports['ShowMailQueue']=function(_0x147c98){var _0x2e5bd5=this;return new Promise(function(_0x393a85,_0x4bc817){return db[_0x5b45('0x26')]['find']({'raw':_0x147c98[_0x5b45('0x1d')]?_0x147c98[_0x5b45('0x1d')][_0x5b45('0x1e')]===undefined?!![]:![]:!![],'where':_0x147c98['options']?_0x147c98[_0x5b45('0x1d')]['where']||null:null,'attributes':_0x147c98[_0x5b45('0x1d')]?_0x147c98[_0x5b45('0x1d')][_0x5b45('0x22')]||null:null,'include':_0x147c98[_0x5b45('0x1d')]?_0x147c98['options'][_0x5b45('0x20')]?_['map'](_0x147c98[_0x5b45('0x1d')]['include'],function(_0x57c26e){return{'model':db[_0x57c26e[_0x5b45('0x23')]],'as':_0x57c26e['as'],'attributes':_0x57c26e['attributes'],'include':_0x57c26e['include']?_[_0x5b45('0x21')](_0x57c26e[_0x5b45('0x20')],function(_0x547671){return{'model':db[_0x547671[_0x5b45('0x23')]],'as':_0x547671['as'],'attributes':_0x547671['attributes'],'include':_0x547671[_0x5b45('0x20')]?_[_0x5b45('0x21')](_0x547671[_0x5b45('0x20')],function(_0x135a87){return{'model':db[_0x135a87[_0x5b45('0x23')]],'as':_0x135a87['as'],'attributes':_0x135a87[_0x5b45('0x22')]};}):[]};}):[]};}):[]:[]})[_0x5b45('0x12')](function(_0x9ec4e){logger[_0x5b45('0x13')](_0x5b45('0x27'),_0x147c98);logger[_0x5b45('0x24')]('ShowMailQueue',_0x147c98,JSON[_0x5b45('0x17')](_0x9ec4e));_0x393a85(_0x9ec4e);})[_0x5b45('0x25')](function(_0x4cf388){logger[_0x5b45('0x18')](_0x5b45('0x27'),_0x4cf388['message'],_0x147c98);_0x4bc817(_0x2e5bd5[_0x5b45('0x18')](0x1f4,_0x4cf388[_0x5b45('0x19')]));});});}; \ No newline at end of file +var _0x2080=['debug','ShowMailQueue','find','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailQueue','MailQueue','options','raw','where','limit','include','map','model','attributes'];(function(_0x1ccba0,_0x23280c){var _0x14ecda=function(_0xbc8e3b){while(--_0xbc8e3b){_0x1ccba0['push'](_0x1ccba0['shift']());}};_0x14ecda(++_0x23280c);}(_0x2080,0x1c6));var _0x0208=function(_0x292fbe,_0x1148ec){_0x292fbe=_0x292fbe-0x0;var _0x53ddce=_0x2080[_0x292fbe];return _0x53ddce;};'use strict';var _=require(_0x0208('0x0'));var util=require(_0x0208('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0208('0x2'));var fs=require('fs');var Redis=require(_0x0208('0x3'));var db=require(_0x0208('0x4'))['db'];var utils=require(_0x0208('0x5'));var logger=require(_0x0208('0x6'))(_0x0208('0x7'));var config=require(_0x0208('0x8'));var jayson=require(_0x0208('0x9'));var client=jayson[_0x0208('0xa')][_0x0208('0xb')]({'port':0x232a});config[_0x0208('0xc')]=_[_0x0208('0xd')](config['redis'],{'host':_0x0208('0xe'),'port':0x18eb});var socket=require(_0x0208('0xf'))(new Redis(config[_0x0208('0xc')]));require('./mailQueue.socket')[_0x0208('0x10')](socket);function respondWithRpcPromise(_0x449780,_0x5143ac,_0x2b914b){return new BPromise(function(_0xdad1fc,_0x539752){return client['request'](_0x449780,_0x2b914b)[_0x0208('0x11')](function(_0x5447eb){logger[_0x0208('0x12')](_0x0208('0x13'),_0x5143ac,_0x0208('0x14'));logger['debug'](_0x0208('0x15'),_0x5143ac,'request\x20sent',JSON[_0x0208('0x16')](_0x5447eb));if(_0x5447eb[_0x0208('0x17')]){if(_0x5447eb['error'][_0x0208('0x18')]===0x1f4){logger[_0x0208('0x17')](_0x0208('0x13'),_0x5143ac,_0x5447eb[_0x0208('0x17')][_0x0208('0x19')]);return _0x539752(_0x5447eb[_0x0208('0x17')][_0x0208('0x19')]);}logger[_0x0208('0x17')](_0x0208('0x13'),_0x5143ac,_0x5447eb[_0x0208('0x17')]['message']);return _0xdad1fc(_0x5447eb['error']['message']);}else{logger['info'](_0x0208('0x13'),_0x5143ac,_0x0208('0x14'));_0xdad1fc(_0x5447eb[_0x0208('0x1a')][_0x0208('0x19')]);}})[_0x0208('0x1b')](function(_0x4f37e6){logger[_0x0208('0x17')](_0x0208('0x13'),_0x5143ac,_0x4f37e6);_0x539752(_0x4f37e6);});});}exports[_0x0208('0x1c')]=function(_0x334136){var _0x4bd983=this;return new Promise(function(_0x4bf0b1,_0x4d1458){return db[_0x0208('0x1d')]['findAll']({'raw':_0x334136[_0x0208('0x1e')]?_0x334136[_0x0208('0x1e')][_0x0208('0x1f')]===undefined?!![]:![]:!![],'where':_0x334136[_0x0208('0x1e')]?_0x334136['options'][_0x0208('0x20')]||null:null,'attributes':_0x334136[_0x0208('0x1e')]?_0x334136[_0x0208('0x1e')]['attributes']||null:null,'limit':_0x334136['options']?_0x334136[_0x0208('0x1e')][_0x0208('0x21')]||null:null,'include':_0x334136[_0x0208('0x1e')]?_0x334136[_0x0208('0x1e')][_0x0208('0x22')]?_[_0x0208('0x23')](_0x334136[_0x0208('0x1e')][_0x0208('0x22')],function(_0x4e2ed5){return{'model':db[_0x4e2ed5[_0x0208('0x24')]],'as':_0x4e2ed5['as'],'attributes':_0x4e2ed5['attributes'],'include':_0x4e2ed5['include']?_[_0x0208('0x23')](_0x4e2ed5[_0x0208('0x22')],function(_0x42f1eb){return{'model':db[_0x42f1eb[_0x0208('0x24')]],'as':_0x42f1eb['as'],'attributes':_0x42f1eb[_0x0208('0x25')],'include':_0x42f1eb['include']?_['map'](_0x42f1eb[_0x0208('0x22')],function(_0x50835f){return{'model':db[_0x50835f[_0x0208('0x24')]],'as':_0x50835f['as'],'attributes':_0x50835f[_0x0208('0x25')]};}):[]};}):[]};}):[]:[]})[_0x0208('0x11')](function(_0xc85954){logger[_0x0208('0x12')](_0x0208('0x1c'),_0x334136);logger[_0x0208('0x26')](_0x0208('0x1c'),_0x334136,JSON[_0x0208('0x16')](_0xc85954));_0x4bf0b1(_0xc85954);})['catch'](function(_0x12ae5f){logger[_0x0208('0x17')]('GetMailQueue',_0x12ae5f[_0x0208('0x19')],_0x334136);_0x4d1458(_0x4bd983['error'](0x1f4,_0x12ae5f[_0x0208('0x19')]));});});};exports[_0x0208('0x27')]=function(_0x55a33b){var _0x292631=this;return new Promise(function(_0x518661,_0x476796){return db['MailQueue'][_0x0208('0x28')]({'raw':_0x55a33b[_0x0208('0x1e')]?_0x55a33b[_0x0208('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x55a33b['options']?_0x55a33b[_0x0208('0x1e')][_0x0208('0x20')]||null:null,'attributes':_0x55a33b[_0x0208('0x1e')]?_0x55a33b['options'][_0x0208('0x25')]||null:null,'include':_0x55a33b['options']?_0x55a33b['options'][_0x0208('0x22')]?_[_0x0208('0x23')](_0x55a33b[_0x0208('0x1e')]['include'],function(_0x45c7a9){return{'model':db[_0x45c7a9[_0x0208('0x24')]],'as':_0x45c7a9['as'],'attributes':_0x45c7a9['attributes'],'include':_0x45c7a9['include']?_[_0x0208('0x23')](_0x45c7a9[_0x0208('0x22')],function(_0x4923e3){return{'model':db[_0x4923e3[_0x0208('0x24')]],'as':_0x4923e3['as'],'attributes':_0x4923e3[_0x0208('0x25')],'include':_0x4923e3[_0x0208('0x22')]?_[_0x0208('0x23')](_0x4923e3[_0x0208('0x22')],function(_0x17c5fa){return{'model':db[_0x17c5fa[_0x0208('0x24')]],'as':_0x17c5fa['as'],'attributes':_0x17c5fa['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ecef9){logger[_0x0208('0x12')](_0x0208('0x27'),_0x55a33b);logger['debug'](_0x0208('0x27'),_0x55a33b,JSON[_0x0208('0x16')](_0x1ecef9));_0x518661(_0x1ecef9);})[_0x0208('0x1b')](function(_0x1290b4){logger['error'](_0x0208('0x27'),_0x1290b4[_0x0208('0x19')],_0x55a33b);_0x476796(_0x292631[_0x0208('0x17')](0x1f4,_0x1290b4[_0x0208('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 1426816..12a5720 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 _0x4cca=['update','emit','removeListener','register','length','mailQueue:','./mailQueue.events','save','remove'];(function(_0x49371f,_0x375326){var _0x542f79=function(_0x230ba2){while(--_0x230ba2){_0x49371f['push'](_0x49371f['shift']());}};_0x542f79(++_0x375326);}(_0x4cca,0xe7));var _0xa4cc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4cca[_0x20a584];return _0x4b41a8;};'use strict';var MailQueueEvents=require(_0xa4cc('0x0'));var events=[_0xa4cc('0x1'),_0xa4cc('0x2'),_0xa4cc('0x3')];function createListener(_0x537281,_0x5e4cd2){return function(_0x15a68e){_0x5e4cd2[_0xa4cc('0x4')](_0x537281,_0x15a68e);};}function removeListener(_0x51c7aa,_0x36441f){return function(){MailQueueEvents[_0xa4cc('0x5')](_0x51c7aa,_0x36441f);};}exports[_0xa4cc('0x6')]=function(_0x42f9ec){for(var _0x59f0f0=0x0,_0x34e87a=events[_0xa4cc('0x7')];_0x59f0f0<_0x34e87a;_0x59f0f0++){var _0x50848e=events[_0x59f0f0];var _0x582dc0=createListener(_0xa4cc('0x8')+_0x50848e,_0x42f9ec);MailQueueEvents['on'](_0x50848e,_0x582dc0);}}; \ No newline at end of file +var _0x9861=['update','emit','removeListener','register','mailQueue:','./mailQueue.events','remove'];(function(_0x4a5f5d,_0x577702){var _0x3344b4=function(_0x4ee75c){while(--_0x4ee75c){_0x4a5f5d['push'](_0x4a5f5d['shift']());}};_0x3344b4(++_0x577702);}(_0x9861,0x91));var _0x1986=function(_0x4ccb19,_0x16e232){_0x4ccb19=_0x4ccb19-0x0;var _0x28b9b6=_0x9861[_0x4ccb19];return _0x28b9b6;};'use strict';var MailQueueEvents=require(_0x1986('0x0'));var events=['save',_0x1986('0x1'),_0x1986('0x2')];function createListener(_0x5678bb,_0x40a324){return function(_0x22c762){_0x40a324[_0x1986('0x3')](_0x5678bb,_0x22c762);};}function removeListener(_0xcfefd2,_0x2d850d){return function(){MailQueueEvents[_0x1986('0x4')](_0xcfefd2,_0x2d850d);};}exports[_0x1986('0x5')]=function(_0x45c9dd){for(var _0x3163f8=0x0,_0x1396b4=events['length'];_0x3163f8<_0x1396b4;_0x3163f8++){var _0x531847=events[_0x3163f8];var _0x39b75d=createListener(_0x1986('0x6')+_0x531847,_0x45c9dd);MailQueueEvents['on'](_0x531847,_0x39b75d);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 7486431..d7a9a9e 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 _0xe778=['get','isAuthenticated','/describe','describe','/:id','show','post','put','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller'];(function(_0x11c090,_0x7d8e4e){var _0x444c13=function(_0x2fd312){while(--_0x2fd312){_0x11c090['push'](_0x11c090['shift']());}};_0x444c13(++_0x7d8e4e);}(_0xe778,0x128));var _0x8e77=function(_0x41925c,_0xf815ba){_0x41925c=_0x41925c-0x0;var _0x4fd288=_0xe778[_0x41925c];return _0x4fd288;};'use strict';var multer=require(_0x8e77('0x0'));var util=require(_0x8e77('0x1'));var path=require(_0x8e77('0x2'));var timeout=require(_0x8e77('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x8e77('0x4'));var interaction=require(_0x8e77('0x5'));var config=require(_0x8e77('0x6'));var controller=require(_0x8e77('0x7'));router[_0x8e77('0x8')]('/',auth[_0x8e77('0x9')](),controller['index']);router[_0x8e77('0x8')](_0x8e77('0xa'),auth[_0x8e77('0x9')](),controller[_0x8e77('0xb')]);router[_0x8e77('0x8')](_0x8e77('0xc'),auth[_0x8e77('0x9')](),controller[_0x8e77('0xd')]);router[_0x8e77('0xe')]('/',auth[_0x8e77('0x9')](),controller['create']);router[_0x8e77('0xf')](_0x8e77('0xc'),auth[_0x8e77('0x9')](),controller['update']);router[_0x8e77('0x10')](_0x8e77('0xc'),auth[_0x8e77('0x9')](),controller[_0x8e77('0x11')]);module[_0x8e77('0x12')]=router; \ No newline at end of file +var _0x598b=['update','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x598b,0x17d));var _0xb598=function(_0xc7b78b,_0x1f852e){_0xc7b78b=_0xc7b78b-0x0;var _0x4b5e17=_0x598b[_0xc7b78b];return _0x4b5e17;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb598('0x0'));var timeout=require(_0xb598('0x1'));var express=require(_0xb598('0x2'));var router=express[_0xb598('0x3')]();var auth=require(_0xb598('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb598('0x5'));router[_0xb598('0x6')]('/',auth[_0xb598('0x7')](),controller[_0xb598('0x8')]);router[_0xb598('0x6')](_0xb598('0x9'),auth[_0xb598('0x7')](),controller[_0xb598('0xa')]);router[_0xb598('0x6')](_0xb598('0xb'),auth[_0xb598('0x7')](),controller[_0xb598('0xc')]);router[_0xb598('0xd')]('/',auth[_0xb598('0x7')](),controller[_0xb598('0xe')]);router['put'](_0xb598('0xb'),auth['isAuthenticated'](),controller[_0xb598('0xf')]);router['delete'](_0xb598('0xb'),auth[_0xb598('0x7')](),controller[_0xb598('0x10')]);module[_0xb598('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 4a0a633..2a61c43 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 _0x99a3=['DATE','moment','sequelize','exports','STRING'];(function(_0x21de89,_0x367053){var _0x290b7e=function(_0x540704){while(--_0x540704){_0x21de89['push'](_0x21de89['shift']());}};_0x290b7e(++_0x367053);}(_0x99a3,0x1eb));var _0x399a=function(_0x48a6f3,_0xecaada){_0x48a6f3=_0x48a6f3-0x0;var _0x4a236e=_0x99a3[_0x48a6f3];return _0x4a236e;};'use strict';var moment=require(_0x399a('0x0'));var Sequelize=require(_0x399a('0x1'));module[_0x399a('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x399a('0x3')]},'joinAt':{'type':Sequelize[_0x399a('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x399a('0x4')]},'exitAt':{'type':Sequelize[_0x399a('0x4')]},'reason':{'type':Sequelize[_0x399a('0x3')]}}; \ No newline at end of file +var _0xeb51=['moment','sequelize','exports','STRING','DATE'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0xeb51,0x181));var _0x1eb5=function(_0x3d6650,_0x4ede52){_0x3d6650=_0x3d6650-0x0;var _0x20406e=_0xeb51[_0x3d6650];return _0x20406e;};'use strict';var moment=require(_0x1eb5('0x0'));var Sequelize=require(_0x1eb5('0x1'));module[_0x1eb5('0x2')]={'uniqueid':{'type':Sequelize[_0x1eb5('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x1eb5('0x3')]},'joinAt':{'type':Sequelize[_0x1eb5('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x1eb5('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 4b4f541..07ec29e 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 _0x64b8=['bluebird','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','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','MailQueueReport','includeAll','findAll','rows','catch','params','keys','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0x55cced,_0x2b93ae){var _0x56fad9=function(_0x593788){while(--_0x593788){_0x55cced['push'](_0x55cced['shift']());}};_0x56fad9(++_0x2b93ae);}(_0x64b8,0xde));var _0x864b=function(_0x20c769,_0x3ee17d){_0x20c769=_0x20c769-0x0;var _0xb4c58e=_0x64b8[_0x20c769];return _0xb4c58e;};'use strict';var pdf=require(_0x864b('0x0'));var emlformat=require(_0x864b('0x1'));var rimraf=require(_0x864b('0x2'));var zipdir=require(_0x864b('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x864b('0x4'));var moment=require(_0x864b('0x5'));var BPromise=require(_0x864b('0x6'));var Mustache=require(_0x864b('0x7'));var util=require(_0x864b('0x8'));var path=require(_0x864b('0x9'));var sox=require(_0x864b('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x864b('0xb'));var squel=require(_0x864b('0xc'));var crypto=require(_0x864b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x864b('0xe'));var toCsv=require(_0x864b('0xf'));var querystring=require(_0x864b('0x10'));var Papa=require(_0x864b('0x11'));var Redis=require(_0x864b('0x12'));var authService=require(_0x864b('0x13'));var qs=require(_0x864b('0x14'));var as=require(_0x864b('0x15'));var hardwareService=require(_0x864b('0x16'));var logger=require(_0x864b('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x864b('0x18'));var db=require(_0x864b('0x19'))['db'];function respondWithStatusCode(_0x527849,_0x5a17c4){_0x5a17c4=_0x5a17c4||0xcc;return function(_0x3030fc){if(_0x3030fc){return _0x527849[_0x864b('0x1a')](_0x5a17c4);}return _0x527849['status'](_0x5a17c4)['end']();};}function respondWithResult(_0x24ea70,_0xd5ff57){_0xd5ff57=_0xd5ff57||0xc8;return function(_0x18ed73){if(_0x18ed73){return _0x24ea70[_0x864b('0x1b')](_0xd5ff57)[_0x864b('0x1c')](_0x18ed73);}};}function respondWithFilteredResult(_0x2ea53e,_0x147d15){return function(_0xa8e9aa){if(_0xa8e9aa){var _0x33700f=_0xa8e9aa[_0x864b('0x1d')],_0x4fc9cd=_0x147d15[_0x864b('0x1e')],_0x1e0deb=_0x147d15[_0x864b('0x1e')]+_0x147d15[_0x864b('0x1f')],_0x408b2f;if(_0x1e0deb>=_0x33700f){_0x1e0deb=_0x33700f;_0x408b2f=0xc8;}else{_0x408b2f=0xce;}_0x2ea53e[_0x864b('0x1b')](_0x408b2f);return _0x2ea53e[_0x864b('0x20')](_0x864b('0x21'),_0x4fc9cd+'-'+_0x1e0deb+'/'+_0x33700f)['json'](_0xa8e9aa);}return null;};}function patchUpdates(_0x31d4f9){return function(_0x5e5dbc){try{jsonpatch['apply'](_0x5e5dbc,_0x31d4f9,!![]);}catch(_0xa11f38){return BPromise[_0x864b('0x22')](_0xa11f38);}return _0x5e5dbc[_0x864b('0x23')]();};}function saveUpdates(_0x583759,_0xbde592){return function(_0x57fd31){if(_0x57fd31){return _0x57fd31[_0x864b('0x24')](_0x583759)[_0x864b('0x25')](function(_0x4f78aa){return _0x4f78aa;});}return null;};}function removeEntity(_0x31074d,_0x48015b){return function(_0x4c8196){if(_0x4c8196){return _0x4c8196[_0x864b('0x26')]()[_0x864b('0x25')](function(){_0x31074d[_0x864b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54160f,_0x2e2077){return function(_0xd21cb6){if(!_0xd21cb6){_0x54160f[_0x864b('0x1a')](0x194);}return _0xd21cb6;};}function handleError(_0x28f229,_0x1eb948){_0x1eb948=_0x1eb948||0x1f4;return function(_0x21c658){logger[_0x864b('0x27')](_0x21c658[_0x864b('0x28')]);if(_0x21c658[_0x864b('0x29')]){delete _0x21c658['name'];}_0x28f229[_0x864b('0x1b')](_0x1eb948)[_0x864b('0x2a')](_0x21c658);};}exports[_0x864b('0x2b')]=function(_0x505a07,_0x5cb24d){var _0x34ec0e={},_0x51b1e8={},_0x58a41f={'count':0x0,'rows':[]};var _0x556613=_[_0x864b('0x2c')](db['MailQueueReport'][_0x864b('0x2d')],function(_0x1d69a4){return{'name':_0x1d69a4[_0x864b('0x2e')],'type':_0x1d69a4[_0x864b('0x2f')][_0x864b('0x30')]};});_0x51b1e8[_0x864b('0x31')]=_[_0x864b('0x2c')](_0x556613,_0x864b('0x29'));_0x51b1e8[_0x864b('0x32')]=_['keys'](_0x505a07[_0x864b('0x32')]);_0x51b1e8[_0x864b('0x33')]=_['intersection'](_0x51b1e8[_0x864b('0x31')],_0x51b1e8[_0x864b('0x32')]);_0x34ec0e[_0x864b('0x34')]=_[_0x864b('0x35')](_0x51b1e8['model'],qs[_0x864b('0x36')](_0x505a07['query'][_0x864b('0x36')]));_0x34ec0e[_0x864b('0x34')]=_0x34ec0e[_0x864b('0x34')][_0x864b('0x37')]?_0x34ec0e[_0x864b('0x34')]:_0x51b1e8[_0x864b('0x31')];if(!_0x505a07['query']['hasOwnProperty'](_0x864b('0x38'))){_0x34ec0e['limit']=qs[_0x864b('0x1f')](_0x505a07['query'][_0x864b('0x1f')]);_0x34ec0e[_0x864b('0x1e')]=qs[_0x864b('0x1e')](_0x505a07[_0x864b('0x32')][_0x864b('0x1e')]);}_0x34ec0e[_0x864b('0x39')]=qs['sort'](_0x505a07[_0x864b('0x32')][_0x864b('0x3a')]);_0x34ec0e[_0x864b('0x3b')]=qs[_0x864b('0x33')](_[_0x864b('0x3c')](_0x505a07[_0x864b('0x32')],_0x51b1e8['filters']));if(_0x505a07[_0x864b('0x32')][_0x864b('0x3d')]){_0x34ec0e['where']=_[_0x864b('0x3e')](_0x34ec0e['where'],{'$or':_[_0x864b('0x2c')](_0x556613,function(_0x39db5b){if(_0x39db5b['type']!==_0x864b('0x3f')){var _0x2ae249={};_0x2ae249[_0x39db5b[_0x864b('0x29')]]={'$like':'%'+_0x505a07[_0x864b('0x32')][_0x864b('0x3d')]+'%'};return _0x2ae249;}})});}_0x34ec0e=_[_0x864b('0x3e')]({},_0x34ec0e,_0x505a07[_0x864b('0x40')]);var _0x12f613={'where':_0x34ec0e[_0x864b('0x3b')]};return db[_0x864b('0x41')]['count'](_0x12f613)['then'](function(_0x4a0dc2){_0x58a41f[_0x864b('0x1d')]=_0x4a0dc2;if(_0x505a07[_0x864b('0x32')][_0x864b('0x42')]){_0x34ec0e['include']=[{'all':!![]}];}return db[_0x864b('0x41')][_0x864b('0x43')](_0x34ec0e);})[_0x864b('0x25')](function(_0x32892b){_0x58a41f[_0x864b('0x44')]=_0x32892b;return _0x58a41f;})[_0x864b('0x25')](respondWithFilteredResult(_0x5cb24d,_0x34ec0e))[_0x864b('0x45')](handleError(_0x5cb24d,null));};exports['show']=function(_0x7a3082,_0x35fd0a){var _0x2abe5d={'raw':!![],'where':{'id':_0x7a3082[_0x864b('0x46')]['id']}},_0x573f0b={};_0x573f0b['model']=_[_0x864b('0x47')](db[_0x864b('0x41')]['rawAttributes']);_0x573f0b[_0x864b('0x32')]=_['keys'](_0x7a3082[_0x864b('0x32')]);_0x573f0b[_0x864b('0x33')]=_['intersection'](_0x573f0b[_0x864b('0x31')],_0x573f0b['query']);_0x2abe5d[_0x864b('0x34')]=_['intersection'](_0x573f0b['model'],qs[_0x864b('0x36')](_0x7a3082[_0x864b('0x32')][_0x864b('0x36')]));_0x2abe5d[_0x864b('0x34')]=_0x2abe5d[_0x864b('0x34')]['length']?_0x2abe5d[_0x864b('0x34')]:_0x573f0b[_0x864b('0x31')];if(_0x7a3082[_0x864b('0x32')][_0x864b('0x42')]){_0x2abe5d['include']=[{'all':!![]}];}_0x2abe5d=_[_0x864b('0x3e')]({},_0x2abe5d,_0x7a3082[_0x864b('0x40')]);return db[_0x864b('0x41')][_0x864b('0x48')](_0x2abe5d)['then'](handleEntityNotFound(_0x35fd0a,null))[_0x864b('0x25')](respondWithResult(_0x35fd0a,null))['catch'](handleError(_0x35fd0a,null));};exports[_0x864b('0x49')]=function(_0x2b301c,_0x24fa0b){return db[_0x864b('0x41')]['create'](_0x2b301c[_0x864b('0x4a')],{})[_0x864b('0x25')](respondWithResult(_0x24fa0b,0xc9))[_0x864b('0x45')](handleError(_0x24fa0b,null));};exports['update']=function(_0x1ab499,_0x34d066){if(_0x1ab499[_0x864b('0x4a')]['id']){delete _0x1ab499['body']['id'];}return db[_0x864b('0x41')][_0x864b('0x48')]({'where':{'id':_0x1ab499[_0x864b('0x46')]['id']}})[_0x864b('0x25')](handleEntityNotFound(_0x34d066,null))[_0x864b('0x25')](saveUpdates(_0x1ab499[_0x864b('0x4a')],null))[_0x864b('0x25')](respondWithResult(_0x34d066,null))[_0x864b('0x45')](handleError(_0x34d066,null));};exports[_0x864b('0x26')]=function(_0x19fd63,_0x122982){return db[_0x864b('0x41')][_0x864b('0x48')]({'where':{'id':_0x19fd63['params']['id']}})[_0x864b('0x25')](handleEntityNotFound(_0x122982,null))[_0x864b('0x25')](removeEntity(_0x122982,null))[_0x864b('0x45')](handleError(_0x122982,null));};exports[_0x864b('0x4b')]=function(_0x2709a5,_0x2bdfa5){return db[_0x864b('0x41')][_0x864b('0x4b')]()[_0x864b('0x25')](respondWithResult(_0x2bdfa5,null))[_0x864b('0x45')](handleError(_0x2bdfa5,null));}; \ No newline at end of file +var _0x3fdf=['filter','options','includeAll','rows','catch','params','keys','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','set','Content-Range','reject','update','then','stack','name','map','MailQueueReport','fieldName','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL'];(function(_0x117ea2,_0x40c74c){var _0x3884c1=function(_0x4ee834){while(--_0x4ee834){_0x117ea2['push'](_0x117ea2['shift']());}};_0x3884c1(++_0x40c74c);}(_0x3fdf,0x124));var _0xf3fd=function(_0x168283,_0x42976a){_0x168283=_0x168283-0x0;var _0x22c638=_0x3fdf[_0x168283];return _0x22c638;};'use strict';var pdf=require(_0xf3fd('0x0'));var emlformat=require(_0xf3fd('0x1'));var rimraf=require(_0xf3fd('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf3fd('0x3'));var moment=require(_0xf3fd('0x4'));var BPromise=require(_0xf3fd('0x5'));var Mustache=require('mustache');var util=require(_0xf3fd('0x6'));var path=require(_0xf3fd('0x7'));var sox=require(_0xf3fd('0x8'));var csv=require('to-csv');var ejs=require(_0xf3fd('0x9'));var fs=require('fs');var _=require(_0xf3fd('0xa'));var squel=require(_0xf3fd('0xb'));var crypto=require(_0xf3fd('0xc'));var jsforce=require(_0xf3fd('0xd'));var deskjs=require(_0xf3fd('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf3fd('0xf'));var Papa=require('papaparse');var Redis=require(_0xf3fd('0x10'));var authService=require(_0xf3fd('0x11'));var qs=require(_0xf3fd('0x12'));var as=require(_0xf3fd('0x13'));var hardwareService=require(_0xf3fd('0x14'));var logger=require(_0xf3fd('0x15'))(_0xf3fd('0x16'));var utils=require(_0xf3fd('0x17'));var config=require(_0xf3fd('0x18'));var db=require(_0xf3fd('0x19'))['db'];function respondWithStatusCode(_0x5d377d,_0x234eb3){_0x234eb3=_0x234eb3||0xcc;return function(_0x2a2503){if(_0x2a2503){return _0x5d377d['sendStatus'](_0x234eb3);}return _0x5d377d[_0xf3fd('0x1a')](_0x234eb3)[_0xf3fd('0x1b')]();};}function respondWithResult(_0x449bf3,_0x523ecc){_0x523ecc=_0x523ecc||0xc8;return function(_0x2acdd7){if(_0x2acdd7){return _0x449bf3[_0xf3fd('0x1a')](_0x523ecc)[_0xf3fd('0x1c')](_0x2acdd7);}};}function respondWithFilteredResult(_0x13b46b,_0x333299){return function(_0x8ed0c){if(_0x8ed0c){var _0x5b44ef=_0x8ed0c[_0xf3fd('0x1d')],_0x45df14=_0x333299['offset'],_0x25ee4a=_0x333299[_0xf3fd('0x1e')]+_0x333299['limit'],_0x4b498d;if(_0x25ee4a>=_0x5b44ef){_0x25ee4a=_0x5b44ef;_0x4b498d=0xc8;}else{_0x4b498d=0xce;}_0x13b46b[_0xf3fd('0x1a')](_0x4b498d);return _0x13b46b[_0xf3fd('0x1f')](_0xf3fd('0x20'),_0x45df14+'-'+_0x25ee4a+'/'+_0x5b44ef)[_0xf3fd('0x1c')](_0x8ed0c);}return null;};}function patchUpdates(_0x55dbe9){return function(_0x2f8d46){try{jsonpatch['apply'](_0x2f8d46,_0x55dbe9,!![]);}catch(_0x5a1208){return BPromise[_0xf3fd('0x21')](_0x5a1208);}return _0x2f8d46['save']();};}function saveUpdates(_0x58d43f,_0x45af21){return function(_0x5489b0){if(_0x5489b0){return _0x5489b0[_0xf3fd('0x22')](_0x58d43f)['then'](function(_0x1d88be){return _0x1d88be;});}return null;};}function removeEntity(_0x5acbc9,_0x4c1664){return function(_0x450995){if(_0x450995){return _0x450995['destroy']()[_0xf3fd('0x23')](function(){_0x5acbc9[_0xf3fd('0x1a')](0xcc)[_0xf3fd('0x1b')]();});}};}function handleEntityNotFound(_0x305bfb,_0x910e18){return function(_0x437fac){if(!_0x437fac){_0x305bfb['sendStatus'](0x194);}return _0x437fac;};}function handleError(_0x1eef57,_0x4dbcf0){_0x4dbcf0=_0x4dbcf0||0x1f4;return function(_0x20eb13){logger['error'](_0x20eb13[_0xf3fd('0x24')]);if(_0x20eb13[_0xf3fd('0x25')]){delete _0x20eb13['name'];}_0x1eef57[_0xf3fd('0x1a')](_0x4dbcf0)['send'](_0x20eb13);};}exports['index']=function(_0x137b62,_0x4c0547){var _0x8dc693={},_0xbffd93={},_0xa3d128={'count':0x0,'rows':[]};var _0x23950d=_[_0xf3fd('0x26')](db[_0xf3fd('0x27')]['rawAttributes'],function(_0xad2303){return{'name':_0xad2303[_0xf3fd('0x28')],'type':_0xad2303['type'][_0xf3fd('0x29')]};});_0xbffd93[_0xf3fd('0x2a')]=_[_0xf3fd('0x26')](_0x23950d,_0xf3fd('0x25'));_0xbffd93['query']=_['keys'](_0x137b62[_0xf3fd('0x2b')]);_0xbffd93['filters']=_[_0xf3fd('0x2c')](_0xbffd93[_0xf3fd('0x2a')],_0xbffd93[_0xf3fd('0x2b')]);_0x8dc693['attributes']=_[_0xf3fd('0x2c')](_0xbffd93['model'],qs[_0xf3fd('0x2d')](_0x137b62[_0xf3fd('0x2b')][_0xf3fd('0x2d')]));_0x8dc693[_0xf3fd('0x2e')]=_0x8dc693['attributes'][_0xf3fd('0x2f')]?_0x8dc693[_0xf3fd('0x2e')]:_0xbffd93[_0xf3fd('0x2a')];if(!_0x137b62[_0xf3fd('0x2b')][_0xf3fd('0x30')](_0xf3fd('0x31'))){_0x8dc693[_0xf3fd('0x32')]=qs[_0xf3fd('0x32')](_0x137b62[_0xf3fd('0x2b')]['limit']);_0x8dc693[_0xf3fd('0x1e')]=qs[_0xf3fd('0x1e')](_0x137b62[_0xf3fd('0x2b')]['offset']);}_0x8dc693[_0xf3fd('0x33')]=qs[_0xf3fd('0x34')](_0x137b62[_0xf3fd('0x2b')][_0xf3fd('0x34')]);_0x8dc693[_0xf3fd('0x35')]=qs[_0xf3fd('0x36')](_[_0xf3fd('0x37')](_0x137b62['query'],_0xbffd93['filters']));if(_0x137b62[_0xf3fd('0x2b')]['filter']){_0x8dc693[_0xf3fd('0x35')]=_[_0xf3fd('0x38')](_0x8dc693[_0xf3fd('0x35')],{'$or':_[_0xf3fd('0x26')](_0x23950d,function(_0x329996){if(_0x329996['type']!==_0xf3fd('0x39')){var _0x597f40={};_0x597f40[_0x329996[_0xf3fd('0x25')]]={'$like':'%'+_0x137b62[_0xf3fd('0x2b')][_0xf3fd('0x3a')]+'%'};return _0x597f40;}})});}_0x8dc693=_[_0xf3fd('0x38')]({},_0x8dc693,_0x137b62[_0xf3fd('0x3b')]);var _0x28d22a={'where':_0x8dc693[_0xf3fd('0x35')]};return db[_0xf3fd('0x27')][_0xf3fd('0x1d')](_0x28d22a)[_0xf3fd('0x23')](function(_0xbb6ff1){_0xa3d128[_0xf3fd('0x1d')]=_0xbb6ff1;if(_0x137b62[_0xf3fd('0x2b')][_0xf3fd('0x3c')]){_0x8dc693['include']=[{'all':!![]}];}return db[_0xf3fd('0x27')]['findAll'](_0x8dc693);})[_0xf3fd('0x23')](function(_0x339e1d){_0xa3d128[_0xf3fd('0x3d')]=_0x339e1d;return _0xa3d128;})['then'](respondWithFilteredResult(_0x4c0547,_0x8dc693))[_0xf3fd('0x3e')](handleError(_0x4c0547,null));};exports['show']=function(_0x1310e7,_0x10be9a){var _0x2ff389={'raw':!![],'where':{'id':_0x1310e7[_0xf3fd('0x3f')]['id']}},_0x1bdbc9={};_0x1bdbc9[_0xf3fd('0x2a')]=_[_0xf3fd('0x40')](db['MailQueueReport']['rawAttributes']);_0x1bdbc9[_0xf3fd('0x2b')]=_[_0xf3fd('0x40')](_0x1310e7[_0xf3fd('0x2b')]);_0x1bdbc9[_0xf3fd('0x36')]=_['intersection'](_0x1bdbc9[_0xf3fd('0x2a')],_0x1bdbc9[_0xf3fd('0x2b')]);_0x2ff389[_0xf3fd('0x2e')]=_[_0xf3fd('0x2c')](_0x1bdbc9['model'],qs[_0xf3fd('0x2d')](_0x1310e7[_0xf3fd('0x2b')][_0xf3fd('0x2d')]));_0x2ff389[_0xf3fd('0x2e')]=_0x2ff389[_0xf3fd('0x2e')][_0xf3fd('0x2f')]?_0x2ff389[_0xf3fd('0x2e')]:_0x1bdbc9[_0xf3fd('0x2a')];if(_0x1310e7[_0xf3fd('0x2b')][_0xf3fd('0x3c')]){_0x2ff389['include']=[{'all':!![]}];}_0x2ff389=_[_0xf3fd('0x38')]({},_0x2ff389,_0x1310e7['options']);return db['MailQueueReport'][_0xf3fd('0x41')](_0x2ff389)[_0xf3fd('0x23')](handleEntityNotFound(_0x10be9a,null))[_0xf3fd('0x23')](respondWithResult(_0x10be9a,null))[_0xf3fd('0x3e')](handleError(_0x10be9a,null));};exports['create']=function(_0x44f4be,_0x277806){return db[_0xf3fd('0x27')][_0xf3fd('0x42')](_0x44f4be['body'],{})[_0xf3fd('0x23')](respondWithResult(_0x277806,0xc9))[_0xf3fd('0x3e')](handleError(_0x277806,null));};exports[_0xf3fd('0x22')]=function(_0x53f040,_0x97e07a){if(_0x53f040[_0xf3fd('0x43')]['id']){delete _0x53f040[_0xf3fd('0x43')]['id'];}return db['MailQueueReport']['find']({'where':{'id':_0x53f040[_0xf3fd('0x3f')]['id']}})[_0xf3fd('0x23')](handleEntityNotFound(_0x97e07a,null))[_0xf3fd('0x23')](saveUpdates(_0x53f040[_0xf3fd('0x43')],null))[_0xf3fd('0x23')](respondWithResult(_0x97e07a,null))[_0xf3fd('0x3e')](handleError(_0x97e07a,null));};exports[_0xf3fd('0x44')]=function(_0x5a7ce9,_0x2f4935){return db[_0xf3fd('0x27')]['find']({'where':{'id':_0x5a7ce9[_0xf3fd('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2f4935,null))['then'](removeEntity(_0x2f4935,null))[_0xf3fd('0x3e')](handleError(_0x2f4935,null));};exports[_0xf3fd('0x45')]=function(_0x25af8e,_0x18df9c){return db[_0xf3fd('0x27')]['describe']()['then'](respondWithResult(_0x18df9c,null))[_0xf3fd('0x3e')](handleError(_0x18df9c,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 2c277ad..7393b49 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 _0x578a=['define','uniqueid','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./mailQueueReport.attributes','exports'];(function(_0x478978,_0x287bd7){var _0x48cac6=function(_0x536571){while(--_0x536571){_0x478978['push'](_0x478978['shift']());}};_0x48cac6(++_0x287bd7);}(_0x578a,0x1db));var _0xa578=function(_0x2abc3d,_0x48edca){_0x2abc3d=_0x2abc3d-0x0;var _0x252745=_0x578a[_0x2abc3d];return _0x252745;};'use strict';var _=require(_0xa578('0x0'));var util=require(_0xa578('0x1'));var logger=require(_0xa578('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa578('0x3'));var rp=require(_0xa578('0x4'));var fs=require('fs');var path=require(_0xa578('0x5'));var rimraf=require(_0xa578('0x6'));var config=require('../../config/environment');var attributes=require(_0xa578('0x7'));module[_0xa578('0x8')]=function(_0x402f56,_0x4d3fce){return _0x402f56[_0xa578('0x9')]('MailQueueReport',attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xa578('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6c16=['./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','moment','../../config/environment'];(function(_0x358161,_0x31172c){var _0x2ca39d=function(_0x5e2a7e){while(--_0x5e2a7e){_0x358161['push'](_0x358161['shift']());}};_0x2ca39d(++_0x31172c);}(_0x6c16,0x11e));var _0x66c1=function(_0x196585,_0x1e2e9e){_0x196585=_0x196585-0x0;var _0x223bf2=_0x6c16[_0x196585];return _0x223bf2;};'use strict';var _=require(_0x66c1('0x0'));var util=require(_0x66c1('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x66c1('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x66c1('0x3'));var attributes=require(_0x66c1('0x4'));module[_0x66c1('0x5')]=function(_0x4a12b7,_0x40f537){return _0x4a12b7[_0x66c1('0x6')](_0x66c1('0x7'),attributes,{'tableName':_0x66c1('0x8'),'paranoid':![],'indexes':[{'name':_0x66c1('0x9'),'fields':[_0x66c1('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 5723132..c3b115e 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 _0x4975=['attributes','UpdateMailQueueReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','MailQueueReport','create','body','options','raw','then','CreateMailQueueReport','where'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x4975,0x86));var _0x5497=function(_0x421fba,_0x17444e){_0x421fba=_0x421fba-0x0;var _0x4a0dad=_0x4975[_0x421fba];return _0x4a0dad;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('MailQueueReport,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});}exports['CreateMailQueueReport']=function(_0x3f4d20){var _0x1bf442=this;return new Promise(function(_0x3a47fd,_0x5d9e24){return db[_0x5497('0x17')][_0x5497('0x18')](_0x3f4d20[_0x5497('0x19')],{'raw':_0x3f4d20[_0x5497('0x1a')]?_0x3f4d20[_0x5497('0x1a')][_0x5497('0x1b')]===undefined?!![]:![]:!![]})[_0x5497('0x1c')](function(_0x10226f){logger[_0x5497('0xd')](_0x5497('0x1d'),_0x3f4d20);logger[_0x5497('0x10')]('CreateMailQueueReport',_0x3f4d20,JSON[_0x5497('0x12')](_0x10226f));_0x3a47fd(_0x10226f);})['catch'](function(_0x19200a){logger[_0x5497('0x13')](_0x5497('0x1d'),_0x19200a[_0x5497('0x14')],_0x3f4d20);_0x5d9e24(_0x1bf442[_0x5497('0x13')](0x1f4,_0x19200a[_0x5497('0x14')]));});});};exports['UpdateMailQueueReport']=function(_0x54043a){var _0x1eefce=this;return new Promise(function(_0x34b97f,_0x24482a){return db[_0x5497('0x17')]['update'](_0x54043a[_0x5497('0x19')],{'raw':_0x54043a['options']?_0x54043a[_0x5497('0x1a')][_0x5497('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54043a[_0x5497('0x1a')]?_0x54043a[_0x5497('0x1a')][_0x5497('0x1e')]||null:null,'attributes':_0x54043a[_0x5497('0x1a')]?_0x54043a['options'][_0x5497('0x1f')]||null:null,'limit':_0x54043a['options']?_0x54043a['options']['limit']||null:null})[_0x5497('0x1c')](function(_0x48d146){logger['info'](_0x5497('0x20'),_0x54043a);logger[_0x5497('0x10')](_0x5497('0x20'),_0x54043a,JSON['stringify'](_0x48d146));_0x34b97f(_0x48d146);})['catch'](function(_0x58230b){logger[_0x5497('0x13')](_0x5497('0x20'),_0x58230b[_0x5497('0x14')],_0x54043a);_0x24482a(_0x1eefce['error'](0x1f4,_0x58230b['message']));});});}; \ No newline at end of file +var _0x1623=['catch','CreateMailQueueReport','MailQueueReport','create','body','options','update','raw','where','limit','UpdateMailQueueReport','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailQueueReport,\x20%s,\x20%s','message','result'];(function(_0x571a17,_0x63fb3d){var _0x3ef337=function(_0x12096b){while(--_0x12096b){_0x571a17['push'](_0x571a17['shift']());}};_0x3ef337(++_0x63fb3d);}(_0x1623,0xab));var _0x3162=function(_0x1f38dd,_0x4c1995){_0x1f38dd=_0x1f38dd-0x0;var _0x4afc77=_0x1623[_0x1f38dd];return _0x4afc77;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3162('0x1'));var rs=require(_0x3162('0x2'));var fs=require('fs');var Redis=require(_0x3162('0x3'));var db=require(_0x3162('0x4'))['db'];var utils=require(_0x3162('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3162('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3162('0x7')][_0x3162('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53260d,_0xffe9b6,_0x2dc07e){return new BPromise(function(_0x26ee32,_0x36609e){return client[_0x3162('0x9')](_0x53260d,_0x2dc07e)[_0x3162('0xa')](function(_0xe43099){logger[_0x3162('0xb')]('MailQueueReport,\x20%s,\x20%s',_0xffe9b6,'request\x20sent');logger[_0x3162('0xc')](_0x3162('0xd'),_0xffe9b6,_0x3162('0xe'),JSON[_0x3162('0xf')](_0xe43099));if(_0xe43099[_0x3162('0x10')]){if(_0xe43099[_0x3162('0x10')][_0x3162('0x11')]===0x1f4){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x36609e(_0xe43099['error'][_0x3162('0x13')]);}logger[_0x3162('0x10')]('MailQueueReport,\x20%s,\x20%s',_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x26ee32(_0xe43099[_0x3162('0x10')][_0x3162('0x13')]);}else{logger['info'](_0x3162('0x12'),_0xffe9b6,_0x3162('0xe'));_0x26ee32(_0xe43099[_0x3162('0x14')]['message']);}})[_0x3162('0x15')](function(_0x42cf7d){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0x42cf7d);_0x36609e(_0x42cf7d);});});}exports[_0x3162('0x16')]=function(_0x1eed46){var _0x391d97=this;return new Promise(function(_0x4b2bf3,_0x42f283){return db[_0x3162('0x17')][_0x3162('0x18')](_0x1eed46[_0x3162('0x19')],{'raw':_0x1eed46['options']?_0x1eed46[_0x3162('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0xa5c62b){logger[_0x3162('0xb')](_0x3162('0x16'),_0x1eed46);logger['debug']('CreateMailQueueReport',_0x1eed46,JSON[_0x3162('0xf')](_0xa5c62b));_0x4b2bf3(_0xa5c62b);})[_0x3162('0x15')](function(_0x32c051){logger[_0x3162('0x10')](_0x3162('0x16'),_0x32c051[_0x3162('0x13')],_0x1eed46);_0x42f283(_0x391d97[_0x3162('0x10')](0x1f4,_0x32c051[_0x3162('0x13')]));});});};exports['UpdateMailQueueReport']=function(_0xd283d6){var _0x2433f8=this;return new Promise(function(_0x3919e7,_0x1fd76f){return db[_0x3162('0x17')][_0x3162('0x1b')](_0xd283d6[_0x3162('0x19')],{'raw':_0xd283d6[_0x3162('0x1a')]?_0xd283d6[_0x3162('0x1a')][_0x3162('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd283d6[_0x3162('0x1a')]?_0xd283d6[_0x3162('0x1a')][_0x3162('0x1d')]||null:null,'attributes':_0xd283d6['options']?_0xd283d6[_0x3162('0x1a')]['attributes']||null:null,'limit':_0xd283d6[_0x3162('0x1a')]?_0xd283d6[_0x3162('0x1a')][_0x3162('0x1e')]||null:null})['then'](function(_0x4903e7){logger[_0x3162('0xb')](_0x3162('0x1f'),_0xd283d6);logger[_0x3162('0xc')](_0x3162('0x1f'),_0xd283d6,JSON[_0x3162('0xf')](_0x4903e7));_0x3919e7(_0x4903e7);})['catch'](function(_0x8a7bce){logger['error'](_0x3162('0x1f'),_0x8a7bce[_0x3162('0x13')],_0xd283d6);_0x1fd76f(_0x2433f8[_0x3162('0x10')](0x1f4,_0x8a7bce[_0x3162('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 18a0715..73c21c5 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 _0x0c54=['express','Router','../../components/interaction/service','../../config/environment','multer','util','connect-timeout'];(function(_0x3a4c64,_0xeef897){var _0x445832=function(_0x2a0c07){while(--_0x2a0c07){_0x3a4c64['push'](_0x3a4c64['shift']());}};_0x445832(++_0xeef897);}(_0x0c54,0xba));var _0x40c5=function(_0x386525,_0xefae6){_0x386525=_0x386525-0x0;var _0x14d015=_0x0c54[_0x386525];return _0x14d015;};'use strict';var multer=require(_0x40c5('0x0'));var util=require(_0x40c5('0x1'));var path=require('path');var timeout=require(_0x40c5('0x2'));var express=require(_0x40c5('0x3'));var router=express[_0x40c5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x40c5('0x5'));var config=require(_0x40c5('0x6'));module['exports']=router; \ No newline at end of file +var _0x76c7=['../../config/environment','exports','path','connect-timeout','../../components/auth/service'];(function(_0x3ad61a,_0x5bb429){var _0x3aa927=function(_0x54e3f1){while(--_0x54e3f1){_0x3ad61a['push'](_0x3ad61a['shift']());}};_0x3aa927(++_0x5bb429);}(_0x76c7,0x1c9));var _0x776c=function(_0x57c880,_0x3c9f1f){_0x57c880=_0x57c880-0x0;var _0x371a92=_0x76c7[_0x57c880];return _0x371a92;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x776c('0x0'));var timeout=require(_0x776c('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x776c('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x776c('0x3'));module[_0x776c('0x4')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index a8c5958..212604d 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 _0x606c=['INTEGER','sequelize','exports','STRING','BOOLEAN','username','INBOX'];(function(_0x5a38c8,_0x9dec30){var _0x10db74=function(_0x1a940a){while(--_0x1a940a){_0x5a38c8['push'](_0x5a38c8['shift']());}};_0x10db74(++_0x9dec30);}(_0x606c,0x71));var _0xc606=function(_0x35d8af,_0x14fd75){_0x35d8af=_0x35d8af-0x0;var _0x1d08b0=_0x606c[_0x35d8af];return _0x1d08b0;};'use strict';var Sequelize=require(_0xc606('0x0'));module[_0xc606('0x1')]={'description':{'type':Sequelize[_0xc606('0x2')]},'host':{'type':Sequelize[_0xc606('0x2')]},'authentication':{'type':Sequelize[_0xc606('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xc606('0x2')],'unique':_0xc606('0x4')},'password':{'type':Sequelize[_0xc606('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xc606('0x2')],'defaultValue':_0xc606('0x5')},'connTimeout':{'type':Sequelize[_0xc606('0x6')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xc606('0x6')],'defaultValue':0x5},'service':{'type':Sequelize[_0xc606('0x2')]}}; \ No newline at end of file +var _0xe955=['STRING','username','INTEGER','BOOLEAN','INBOX','sequelize','exports'];(function(_0x24c4c7,_0x607498){var _0x36fa37=function(_0x39eac2){while(--_0x39eac2){_0x24c4c7['push'](_0x24c4c7['shift']());}};_0x36fa37(++_0x607498);}(_0xe955,0x139));var _0x5e95=function(_0x202cc1,_0x3b0a1b){_0x202cc1=_0x202cc1-0x0;var _0x399915=_0xe955[_0x202cc1];return _0x399915;};'use strict';var Sequelize=require(_0x5e95('0x0'));module[_0x5e95('0x1')]={'description':{'type':Sequelize[_0x5e95('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize['STRING'],'unique':_0x5e95('0x3')},'password':{'type':Sequelize[_0x5e95('0x2')]},'port':{'type':Sequelize[_0x5e95('0x4')]},'tls':{'type':Sequelize[_0x5e95('0x5')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x5e95('0x2')],'defaultValue':_0x5e95('0x6')},'connTimeout':{'type':Sequelize[_0x5e95('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x5e95('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x5e95('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 2f34a85..7703059 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 _0xb688=['exports','MailServerIn','mail_servers_in','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailServerIn.attributes'];(function(_0x58ceab,_0x3973de){var _0x579fff=function(_0x1a7318){while(--_0x1a7318){_0x58ceab['push'](_0x58ceab['shift']());}};_0x579fff(++_0x3973de);}(_0xb688,0xcf));var _0x8b68=function(_0x303411,_0x32e28f){_0x303411=_0x303411-0x0;var _0x4353b5=_0xb688[_0x303411];return _0x4353b5;};'use strict';var _=require('lodash');var util=require(_0x8b68('0x0'));var logger=require(_0x8b68('0x1'))(_0x8b68('0x2'));var moment=require(_0x8b68('0x3'));var BPromise=require(_0x8b68('0x4'));var rp=require(_0x8b68('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b68('0x6'));var config=require(_0x8b68('0x7'));var attributes=require(_0x8b68('0x8'));module[_0x8b68('0x9')]=function(_0x583d16,_0x34314e){return _0x583d16['define'](_0x8b68('0xa'),attributes,{'tableName':_0x8b68('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd070=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','mail_servers_in','lodash'];(function(_0x52b7b9,_0x43ed4b){var _0x5b5d30=function(_0x4a5b9c){while(--_0x4a5b9c){_0x52b7b9['push'](_0x52b7b9['shift']());}};_0x5b5d30(++_0x43ed4b);}(_0xd070,0x8e));var _0x0d07=function(_0x5a2024,_0x4e1034){_0x5a2024=_0x5a2024-0x0;var _0x403e0d=_0xd070[_0x5a2024];return _0x403e0d;};'use strict';var _=require(_0x0d07('0x0'));var util=require('util');var logger=require(_0x0d07('0x1'))(_0x0d07('0x2'));var moment=require(_0x0d07('0x3'));var BPromise=require(_0x0d07('0x4'));var rp=require(_0x0d07('0x5'));var fs=require('fs');var path=require(_0x0d07('0x6'));var rimraf=require(_0x0d07('0x7'));var config=require(_0x0d07('0x8'));var attributes=require(_0x0d07('0x9'));module[_0x0d07('0xa')]=function(_0x18943f,_0x495815){return _0x18943f[_0x0d07('0xb')]('MailServerIn',attributes,{'tableName':_0x0d07('0xc'),'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 d9e0276..fdf5689 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 _0xb9fd=['options','raw','include','map','model','attributes','lodash','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','then','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetMailServerIn','MailServerIn'];(function(_0x1460f6,_0x59051a){var _0x46ce94=function(_0x1c3ddf){while(--_0x1c3ddf){_0x1460f6['push'](_0x1460f6['shift']());}};_0x46ce94(++_0x59051a);}(_0xb9fd,0x165));var _0xdb9f=function(_0x3b5049,_0x495a94){_0x3b5049=_0x3b5049-0x0;var _0x12454e=_0xb9fd[_0x3b5049];return _0x12454e;};'use strict';var _=require(_0xdb9f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xdb9f('0x1'));var rs=require(_0xdb9f('0x2'));var fs=require('fs');var Redis=require(_0xdb9f('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdb9f('0x4'));var config=require(_0xdb9f('0x5'));var jayson=require(_0xdb9f('0x6'));var client=jayson[_0xdb9f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x303a92,_0x3c7cfc,_0x5cb61c){return new BPromise(function(_0x37235c,_0x4baccd){return client['request'](_0x303a92,_0x5cb61c)[_0xdb9f('0x8')](function(_0xa10aa2){logger['info'](_0xdb9f('0x9'),_0x3c7cfc,_0xdb9f('0xa'));logger[_0xdb9f('0xb')](_0xdb9f('0xc'),_0x3c7cfc,'request\x20sent',JSON[_0xdb9f('0xd')](_0xa10aa2));if(_0xa10aa2['error']){if(_0xa10aa2[_0xdb9f('0xe')][_0xdb9f('0xf')]===0x1f4){logger[_0xdb9f('0xe')](_0xdb9f('0x9'),_0x3c7cfc,_0xa10aa2[_0xdb9f('0xe')][_0xdb9f('0x10')]);return _0x4baccd(_0xa10aa2[_0xdb9f('0xe')][_0xdb9f('0x10')]);}logger[_0xdb9f('0xe')](_0xdb9f('0x9'),_0x3c7cfc,_0xa10aa2[_0xdb9f('0xe')][_0xdb9f('0x10')]);return _0x37235c(_0xa10aa2[_0xdb9f('0xe')]['message']);}else{logger[_0xdb9f('0x11')](_0xdb9f('0x9'),_0x3c7cfc,_0xdb9f('0xa'));_0x37235c(_0xa10aa2['result']['message']);}})[_0xdb9f('0x12')](function(_0x3f73ea){logger[_0xdb9f('0xe')](_0xdb9f('0x9'),_0x3c7cfc,_0x3f73ea);_0x4baccd(_0x3f73ea);});});}exports[_0xdb9f('0x13')]=function(_0xddf6bc){var _0x26e710=this;return new Promise(function(_0x28e2a3,_0x4e27c9){return db[_0xdb9f('0x14')]['findAll']({'raw':_0xddf6bc[_0xdb9f('0x15')]?_0xddf6bc[_0xdb9f('0x15')][_0xdb9f('0x16')]===undefined?!![]:![]:!![],'where':_0xddf6bc['options']?_0xddf6bc[_0xdb9f('0x15')]['where']||null:null,'attributes':_0xddf6bc[_0xdb9f('0x15')]?_0xddf6bc[_0xdb9f('0x15')]['attributes']||null:null,'limit':_0xddf6bc[_0xdb9f('0x15')]?_0xddf6bc[_0xdb9f('0x15')]['limit']||null:null,'include':_0xddf6bc[_0xdb9f('0x15')]?_0xddf6bc[_0xdb9f('0x15')][_0xdb9f('0x17')]?_[_0xdb9f('0x18')](_0xddf6bc['options']['include'],function(_0x2e7675){return{'model':db[_0x2e7675[_0xdb9f('0x19')]],'as':_0x2e7675['as'],'attributes':_0x2e7675[_0xdb9f('0x1a')],'include':_0x2e7675['include']?_[_0xdb9f('0x18')](_0x2e7675[_0xdb9f('0x17')],function(_0x5a6dfe){return{'model':db[_0x5a6dfe['model']],'as':_0x5a6dfe['as'],'attributes':_0x5a6dfe[_0xdb9f('0x1a')],'include':_0x5a6dfe[_0xdb9f('0x17')]?_[_0xdb9f('0x18')](_0x5a6dfe['include'],function(_0x209c71){return{'model':db[_0x209c71[_0xdb9f('0x19')]],'as':_0x209c71['as'],'attributes':_0x209c71['attributes']};}):[]};}):[]};}):[]:[]})[_0xdb9f('0x8')](function(_0x466eeb){logger[_0xdb9f('0x11')]('GetMailServerIn',_0xddf6bc);logger[_0xdb9f('0xb')](_0xdb9f('0x13'),_0xddf6bc,JSON[_0xdb9f('0xd')](_0x466eeb));_0x28e2a3(_0x466eeb);})[_0xdb9f('0x12')](function(_0x3aaff9){logger[_0xdb9f('0xe')]('GetMailServerIn',_0x3aaff9[_0xdb9f('0x10')],_0xddf6bc);_0x4e27c9(_0x26e710[_0xdb9f('0xe')](0x1f4,_0x3aaff9['message']));});});}; \ No newline at end of file +var _0x3b97=['debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','MailServerIn,\x20%s,\x20%s','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','then','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','info'];(function(_0x50ffa5,_0x4b91f1){var _0x98a14d=function(_0x546ed0){while(--_0x546ed0){_0x50ffa5['push'](_0x50ffa5['shift']());}};_0x98a14d(++_0x4b91f1);}(_0x3b97,0x9e));var _0x73b9=function(_0x284319,_0x580b32){_0x284319=_0x284319-0x0;var _0x37e9b4=_0x3b97[_0x284319];return _0x37e9b4;};'use strict';var _=require('lodash');var util=require(_0x73b9('0x0'));var moment=require(_0x73b9('0x1'));var BPromise=require(_0x73b9('0x2'));var rs=require(_0x73b9('0x3'));var fs=require('fs');var Redis=require(_0x73b9('0x4'));var db=require(_0x73b9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x73b9('0x6'))('rpc');var config=require(_0x73b9('0x7'));var jayson=require(_0x73b9('0x8'));var client=jayson[_0x73b9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1710fc,_0xc45f5c,_0x2dd1fd){return new BPromise(function(_0x8b830c,_0x25d42d){return client[_0x73b9('0xa')](_0x1710fc,_0x2dd1fd)['then'](function(_0x2b4660){logger[_0x73b9('0xb')]('MailServerIn,\x20%s,\x20%s',_0xc45f5c,'request\x20sent');logger[_0x73b9('0xc')](_0x73b9('0xd'),_0xc45f5c,_0x73b9('0xe'),JSON['stringify'](_0x2b4660));if(_0x2b4660['error']){if(_0x2b4660[_0x73b9('0xf')][_0x73b9('0x10')]===0x1f4){logger[_0x73b9('0xf')](_0x73b9('0x11'),_0xc45f5c,_0x2b4660['error']['message']);return _0x25d42d(_0x2b4660[_0x73b9('0xf')][_0x73b9('0x12')]);}logger[_0x73b9('0xf')](_0x73b9('0x11'),_0xc45f5c,_0x2b4660[_0x73b9('0xf')]['message']);return _0x8b830c(_0x2b4660[_0x73b9('0xf')][_0x73b9('0x12')]);}else{logger[_0x73b9('0xb')](_0x73b9('0x11'),_0xc45f5c,_0x73b9('0xe'));_0x8b830c(_0x2b4660[_0x73b9('0x13')][_0x73b9('0x12')]);}})[_0x73b9('0x14')](function(_0x4a42af){logger[_0x73b9('0xf')](_0x73b9('0x11'),_0xc45f5c,_0x4a42af);_0x25d42d(_0x4a42af);});});}exports[_0x73b9('0x15')]=function(_0x188176){var _0x485868=this;return new Promise(function(_0x3441b4,_0x3a1bc5){return db[_0x73b9('0x16')][_0x73b9('0x17')]({'raw':_0x188176[_0x73b9('0x18')]?_0x188176[_0x73b9('0x18')][_0x73b9('0x19')]===undefined?!![]:![]:!![],'where':_0x188176['options']?_0x188176[_0x73b9('0x18')][_0x73b9('0x1a')]||null:null,'attributes':_0x188176[_0x73b9('0x18')]?_0x188176['options'][_0x73b9('0x1b')]||null:null,'limit':_0x188176[_0x73b9('0x18')]?_0x188176[_0x73b9('0x18')][_0x73b9('0x1c')]||null:null,'include':_0x188176[_0x73b9('0x18')]?_0x188176[_0x73b9('0x18')][_0x73b9('0x1d')]?_[_0x73b9('0x1e')](_0x188176[_0x73b9('0x18')]['include'],function(_0x38ee42){return{'model':db[_0x38ee42[_0x73b9('0x1f')]],'as':_0x38ee42['as'],'attributes':_0x38ee42[_0x73b9('0x1b')],'include':_0x38ee42[_0x73b9('0x1d')]?_[_0x73b9('0x1e')](_0x38ee42[_0x73b9('0x1d')],function(_0xd60e6e){return{'model':db[_0xd60e6e[_0x73b9('0x1f')]],'as':_0xd60e6e['as'],'attributes':_0xd60e6e[_0x73b9('0x1b')],'include':_0xd60e6e[_0x73b9('0x1d')]?_[_0x73b9('0x1e')](_0xd60e6e[_0x73b9('0x1d')],function(_0x112658){return{'model':db[_0x112658['model']],'as':_0x112658['as'],'attributes':_0x112658[_0x73b9('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x73b9('0x20')](function(_0x5bab31){logger['info'](_0x73b9('0x15'),_0x188176);logger[_0x73b9('0xc')](_0x73b9('0x15'),_0x188176,JSON[_0x73b9('0x21')](_0x5bab31));_0x3441b4(_0x5bab31);})[_0x73b9('0x14')](function(_0x298731){logger[_0x73b9('0xf')](_0x73b9('0x15'),_0x298731['message'],_0x188176);_0x3a1bc5(_0x485868[_0x73b9('0xf')](0x1f4,_0x298731['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 03240e5..559cf77 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 _0xbe29=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get','isAuthenticated','post','put','/:id','destroy','exports','multer','util','connect-timeout'];(function(_0x158a58,_0x28e8e7){var _0x4935d9=function(_0x1e698c){while(--_0x1e698c){_0x158a58['push'](_0x158a58['shift']());}};_0x4935d9(++_0x28e8e7);}(_0xbe29,0xed));var _0x9be2=function(_0x56e4e7,_0x1db098){_0x56e4e7=_0x56e4e7-0x0;var _0x383618=_0xbe29[_0x56e4e7];return _0x383618;};'use strict';var multer=require(_0x9be2('0x0'));var util=require(_0x9be2('0x1'));var path=require('path');var timeout=require(_0x9be2('0x2'));var express=require(_0x9be2('0x3'));var router=express['Router']();var auth=require(_0x9be2('0x4'));var interaction=require(_0x9be2('0x5'));var config=require(_0x9be2('0x6'));var controller=require(_0x9be2('0x7'));router[_0x9be2('0x8')]('/',auth[_0x9be2('0x9')](),controller['index']);router[_0x9be2('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x9be2('0xa')]('/',auth[_0x9be2('0x9')](),controller['create']);router[_0x9be2('0xb')](_0x9be2('0xc'),auth[_0x9be2('0x9')](),controller['update']);router['delete'](_0x9be2('0xc'),auth['isAuthenticated'](),controller[_0x9be2('0xd')]);module[_0x9be2('0xe')]=router; \ No newline at end of file +var _0xb8ff=['./mailServerOut.controller','get','isAuthenticated','/:id','post','create','put','update','delete','destroy','multer','util','path','express','../../components/interaction/service'];(function(_0x37643f,_0x72bf3c){var _0x3b4d95=function(_0x1d45e4){while(--_0x1d45e4){_0x37643f['push'](_0x37643f['shift']());}};_0x3b4d95(++_0x72bf3c);}(_0xb8ff,0x1db));var _0xfb8f=function(_0x4fd3ce,_0x4b0fbe){_0x4fd3ce=_0x4fd3ce-0x0;var _0x4d1a6e=_0xb8ff[_0x4fd3ce];return _0x4d1a6e;};'use strict';var multer=require(_0xfb8f('0x0'));var util=require(_0xfb8f('0x1'));var path=require(_0xfb8f('0x2'));var timeout=require('connect-timeout');var express=require(_0xfb8f('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xfb8f('0x4'));var config=require('../../config/environment');var controller=require(_0xfb8f('0x5'));router[_0xfb8f('0x6')]('/',auth[_0xfb8f('0x7')](),controller['index']);router[_0xfb8f('0x6')](_0xfb8f('0x8'),auth[_0xfb8f('0x7')](),controller['show']);router[_0xfb8f('0x9')]('/',auth[_0xfb8f('0x7')](),controller[_0xfb8f('0xa')]);router[_0xfb8f('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xfb8f('0xc')]);router[_0xfb8f('0xd')](_0xfb8f('0x8'),auth['isAuthenticated'](),controller[_0xfb8f('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 251b05e..b958c93 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 _0xc1d3=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x48d024,_0x3466b2){var _0x2c5803=function(_0x2d7327){while(--_0x2d7327){_0x48d024['push'](_0x48d024['shift']());}};_0x2c5803(++_0x3466b2);}(_0xc1d3,0x147));var _0x3c1d=function(_0x4f4c53,_0x58ba7b){_0x4f4c53=_0x4f4c53-0x0;var _0x568ff1=_0xc1d3[_0x4f4c53];return _0x568ff1;};'use strict';var Sequelize=require(_0x3c1d('0x0'));module[_0x3c1d('0x1')]={'description':{'type':Sequelize[_0x3c1d('0x2')]},'host':{'type':Sequelize[_0x3c1d('0x2')]},'user':{'type':Sequelize[_0x3c1d('0x2')]},'pass':{'type':Sequelize[_0x3c1d('0x2')]},'port':{'type':Sequelize[_0x3c1d('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x3c1d('0x4')],'defaultValue':!![]}}; \ No newline at end of file +var _0xa93a=['STRING','BOOLEAN'];(function(_0x116d56,_0x1eef34){var _0x4b4f63=function(_0x55574e){while(--_0x55574e){_0x116d56['push'](_0x116d56['shift']());}};_0x4b4f63(++_0x1eef34);}(_0xa93a,0xb8));var _0xaa93=function(_0x35f1d9,_0x52952b){_0x35f1d9=_0x35f1d9-0x0;var _0x274edd=_0xa93a[_0x35f1d9];return _0x274edd;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0xaa93('0x0')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0xaa93('0x0')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0xaa93('0x1')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xaa93('0x1')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 5d4f55d..e536e77 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 _0x72fb=['path','ejs','lodash','crypto','jsforce','desk.js','to-csv','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','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','MailServerOut','rawAttributes','type','key','map','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','VIRTUAL','filter','merge','includeAll','include','rows','catch','show','params','keys','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0xdb894b,_0x39a34e){var _0x979022=function(_0xee62c2){while(--_0xee62c2){_0xdb894b['push'](_0xdb894b['shift']());}};_0x979022(++_0x39a34e);}(_0x72fb,0x1f1));var _0xb72f=function(_0x404eed,_0x5390c5){_0x404eed=_0x404eed-0x0;var _0xd45887=_0x72fb[_0x404eed];return _0xd45887;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb72f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb72f('0x1'));var jsonpatch=require(_0xb72f('0x2'));var rp=require(_0xb72f('0x3'));var moment=require(_0xb72f('0x4'));var BPromise=require(_0xb72f('0x5'));var Mustache=require(_0xb72f('0x6'));var util=require('util');var path=require(_0xb72f('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb72f('0x8'));var fs=require('fs');var _=require(_0xb72f('0x9'));var squel=require('squel');var crypto=require(_0xb72f('0xa'));var jsforce=require(_0xb72f('0xb'));var deskjs=require(_0xb72f('0xc'));var toCsv=require(_0xb72f('0xd'));var querystring=require('querystring');var Papa=require(_0xb72f('0xe'));var Redis=require(_0xb72f('0xf'));var authService=require(_0xb72f('0x10'));var qs=require(_0xb72f('0x11'));var as=require(_0xb72f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb72f('0x13'))(_0xb72f('0x14'));var utils=require(_0xb72f('0x15'));var config=require(_0xb72f('0x16'));var db=require(_0xb72f('0x17'))['db'];function respondWithStatusCode(_0x487593,_0x3f8397){_0x3f8397=_0x3f8397||0xcc;return function(_0x749fb1){if(_0x749fb1){return _0x487593[_0xb72f('0x18')](_0x3f8397);}return _0x487593[_0xb72f('0x19')](_0x3f8397)[_0xb72f('0x1a')]();};}function respondWithResult(_0x4cd532,_0x17c3ff){_0x17c3ff=_0x17c3ff||0xc8;return function(_0x37faeb){if(_0x37faeb){return _0x4cd532[_0xb72f('0x19')](_0x17c3ff)[_0xb72f('0x1b')](_0x37faeb);}};}function respondWithFilteredResult(_0xeb14da,_0x3b3611){return function(_0x23fcf7){if(_0x23fcf7){var _0x4e63ef=_0x23fcf7[_0xb72f('0x1c')],_0x15b9e6=_0x3b3611[_0xb72f('0x1d')],_0x48ae05=_0x3b3611['offset']+_0x3b3611[_0xb72f('0x1e')],_0x5119a7;if(_0x48ae05>=_0x4e63ef){_0x48ae05=_0x4e63ef;_0x5119a7=0xc8;}else{_0x5119a7=0xce;}_0xeb14da[_0xb72f('0x19')](_0x5119a7);return _0xeb14da[_0xb72f('0x1f')](_0xb72f('0x20'),_0x15b9e6+'-'+_0x48ae05+'/'+_0x4e63ef)[_0xb72f('0x1b')](_0x23fcf7);}return null;};}function patchUpdates(_0x18783e){return function(_0x586b66){try{jsonpatch[_0xb72f('0x21')](_0x586b66,_0x18783e,!![]);}catch(_0x1e723d){return BPromise[_0xb72f('0x22')](_0x1e723d);}return _0x586b66[_0xb72f('0x23')]();};}function saveUpdates(_0x439351,_0x1f9cfe){return function(_0x3c56d9){if(_0x3c56d9){return _0x3c56d9[_0xb72f('0x24')](_0x439351)[_0xb72f('0x25')](function(_0x32f60f){return _0x32f60f;});}return null;};}function removeEntity(_0x284b95,_0x2b2d50){return function(_0x2038a3){if(_0x2038a3){return _0x2038a3[_0xb72f('0x26')]()[_0xb72f('0x25')](function(){_0x284b95[_0xb72f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x295ccd,_0x2d7137){return function(_0x49f2dd){if(!_0x49f2dd){_0x295ccd[_0xb72f('0x18')](0x194);}return _0x49f2dd;};}function handleError(_0x2d2623,_0x10be1d){_0x10be1d=_0x10be1d||0x1f4;return function(_0x6ae801){logger[_0xb72f('0x27')](_0x6ae801[_0xb72f('0x28')]);if(_0x6ae801[_0xb72f('0x29')]){delete _0x6ae801[_0xb72f('0x29')];}_0x2d2623[_0xb72f('0x19')](_0x10be1d)['send'](_0x6ae801);};}exports[_0xb72f('0x2a')]=function(_0x5d871f,_0x13c44a){var _0xa1ee2f={},_0x5ddbb3={},_0x704c53={'count':0x0,'rows':[]};var _0xc51d5c=_['map'](db[_0xb72f('0x2b')][_0xb72f('0x2c')],function(_0xd48ae2){return{'name':_0xd48ae2['fieldName'],'type':_0xd48ae2[_0xb72f('0x2d')][_0xb72f('0x2e')]};});_0x5ddbb3['model']=_[_0xb72f('0x2f')](_0xc51d5c,_0xb72f('0x29'));_0x5ddbb3[_0xb72f('0x30')]=_['keys'](_0x5d871f[_0xb72f('0x30')]);_0x5ddbb3[_0xb72f('0x31')]=_['intersection'](_0x5ddbb3[_0xb72f('0x32')],_0x5ddbb3[_0xb72f('0x30')]);_0xa1ee2f[_0xb72f('0x33')]=_[_0xb72f('0x34')](_0x5ddbb3[_0xb72f('0x32')],qs[_0xb72f('0x35')](_0x5d871f[_0xb72f('0x30')]['fields']));_0xa1ee2f[_0xb72f('0x33')]=_0xa1ee2f[_0xb72f('0x33')][_0xb72f('0x36')]?_0xa1ee2f[_0xb72f('0x33')]:_0x5ddbb3[_0xb72f('0x32')];if(!_0x5d871f['query'][_0xb72f('0x37')](_0xb72f('0x38'))){_0xa1ee2f['limit']=qs[_0xb72f('0x1e')](_0x5d871f[_0xb72f('0x30')]['limit']);_0xa1ee2f[_0xb72f('0x1d')]=qs[_0xb72f('0x1d')](_0x5d871f['query'][_0xb72f('0x1d')]);}_0xa1ee2f[_0xb72f('0x39')]=qs['sort'](_0x5d871f['query']['sort']);_0xa1ee2f[_0xb72f('0x3a')]=qs[_0xb72f('0x31')](_['pick'](_0x5d871f[_0xb72f('0x30')],_0x5ddbb3[_0xb72f('0x31')]));if(_0x5d871f[_0xb72f('0x30')]['filter']){_0xa1ee2f[_0xb72f('0x3a')]=_['merge'](_0xa1ee2f[_0xb72f('0x3a')],{'$or':_['map'](_0xc51d5c,function(_0x28dee5){if(_0x28dee5[_0xb72f('0x2d')]!==_0xb72f('0x3b')){var _0x4c58d2={};_0x4c58d2[_0x28dee5[_0xb72f('0x29')]]={'$like':'%'+_0x5d871f['query'][_0xb72f('0x3c')]+'%'};return _0x4c58d2;}})});}_0xa1ee2f=_[_0xb72f('0x3d')]({},_0xa1ee2f,_0x5d871f['options']);var _0x4f6af9={'where':_0xa1ee2f[_0xb72f('0x3a')]};return db[_0xb72f('0x2b')][_0xb72f('0x1c')](_0x4f6af9)['then'](function(_0x326c03){_0x704c53[_0xb72f('0x1c')]=_0x326c03;if(_0x5d871f['query'][_0xb72f('0x3e')]){_0xa1ee2f[_0xb72f('0x3f')]=[{'all':!![]}];}return db[_0xb72f('0x2b')]['findAll'](_0xa1ee2f);})[_0xb72f('0x25')](function(_0x38dfe1){_0x704c53[_0xb72f('0x40')]=_0x38dfe1;return _0x704c53;})[_0xb72f('0x25')](respondWithFilteredResult(_0x13c44a,_0xa1ee2f))[_0xb72f('0x41')](handleError(_0x13c44a,null));};exports[_0xb72f('0x42')]=function(_0x4ede0a,_0x24cd53){var _0x54096b={'raw':!![],'where':{'id':_0x4ede0a[_0xb72f('0x43')]['id']}},_0x57da19={};_0x57da19[_0xb72f('0x32')]=_[_0xb72f('0x44')](db[_0xb72f('0x2b')]['rawAttributes']);_0x57da19['query']=_[_0xb72f('0x44')](_0x4ede0a[_0xb72f('0x30')]);_0x57da19[_0xb72f('0x31')]=_[_0xb72f('0x34')](_0x57da19[_0xb72f('0x32')],_0x57da19[_0xb72f('0x30')]);_0x54096b[_0xb72f('0x33')]=_[_0xb72f('0x34')](_0x57da19['model'],qs[_0xb72f('0x35')](_0x4ede0a[_0xb72f('0x30')][_0xb72f('0x35')]));_0x54096b[_0xb72f('0x33')]=_0x54096b[_0xb72f('0x33')][_0xb72f('0x36')]?_0x54096b['attributes']:_0x57da19[_0xb72f('0x32')];if(_0x4ede0a[_0xb72f('0x30')][_0xb72f('0x3e')]){_0x54096b[_0xb72f('0x3f')]=[{'all':!![]}];}_0x54096b=_[_0xb72f('0x3d')]({},_0x54096b,_0x4ede0a['options']);return db[_0xb72f('0x2b')][_0xb72f('0x45')](_0x54096b)[_0xb72f('0x25')](handleEntityNotFound(_0x24cd53,null))[_0xb72f('0x25')](respondWithResult(_0x24cd53,null))['catch'](handleError(_0x24cd53,null));};exports[_0xb72f('0x46')]=function(_0x4710e6,_0x4f8f94){return db[_0xb72f('0x2b')]['create'](_0x4710e6[_0xb72f('0x47')],{})['then'](respondWithResult(_0x4f8f94,0xc9))[_0xb72f('0x41')](handleError(_0x4f8f94,null));};exports[_0xb72f('0x24')]=function(_0x40d187,_0x449402){if(_0x40d187[_0xb72f('0x47')]['id']){delete _0x40d187[_0xb72f('0x47')]['id'];}return db[_0xb72f('0x2b')][_0xb72f('0x45')]({'where':{'id':_0x40d187['params']['id']}})['then'](handleEntityNotFound(_0x449402,null))[_0xb72f('0x25')](saveUpdates(_0x40d187[_0xb72f('0x47')],null))[_0xb72f('0x25')](respondWithResult(_0x449402,null))[_0xb72f('0x41')](handleError(_0x449402,null));};exports[_0xb72f('0x26')]=function(_0x37be09,_0x33d92b){return db[_0xb72f('0x2b')][_0xb72f('0x45')]({'where':{'id':_0x37be09['params']['id']}})[_0xb72f('0x25')](handleEntityNotFound(_0x33d92b,null))[_0xb72f('0x25')](removeEntity(_0x33d92b,null))['catch'](handleError(_0x33d92b,null));}; \ No newline at end of file +var _0x9236=['name','send','index','MailServerOut','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','error','stack'];(function(_0x3bdb89,_0xcf4053){var _0x487001=function(_0x516d10){while(--_0x516d10){_0x3bdb89['push'](_0x3bdb89['shift']());}};_0x487001(++_0xcf4053);}(_0x9236,0x72));var _0x6923=function(_0xedf78e,_0xcc19d7){_0xedf78e=_0xedf78e-0x0;var _0x3ba904=_0x9236[_0xedf78e];return _0x3ba904;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6923('0x0'));var rimraf=require(_0x6923('0x1'));var zipdir=require(_0x6923('0x2'));var jsonpatch=require(_0x6923('0x3'));var rp=require(_0x6923('0x4'));var moment=require(_0x6923('0x5'));var BPromise=require(_0x6923('0x6'));var Mustache=require(_0x6923('0x7'));var util=require(_0x6923('0x8'));var path=require(_0x6923('0x9'));var sox=require(_0x6923('0xa'));var csv=require(_0x6923('0xb'));var ejs=require(_0x6923('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6923('0xd'));var jsforce=require(_0x6923('0xe'));var deskjs=require(_0x6923('0xf'));var toCsv=require(_0x6923('0xb'));var querystring=require(_0x6923('0x10'));var Papa=require(_0x6923('0x11'));var Redis=require(_0x6923('0x12'));var authService=require(_0x6923('0x13'));var qs=require(_0x6923('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6923('0x15'))(_0x6923('0x16'));var utils=require('../../config/utils');var config=require(_0x6923('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x379b1d,_0x581d0d){_0x581d0d=_0x581d0d||0xcc;return function(_0x33b909){if(_0x33b909){return _0x379b1d[_0x6923('0x18')](_0x581d0d);}return _0x379b1d[_0x6923('0x19')](_0x581d0d)[_0x6923('0x1a')]();};}function respondWithResult(_0x37115c,_0x7e92fb){_0x7e92fb=_0x7e92fb||0xc8;return function(_0x54ff4b){if(_0x54ff4b){return _0x37115c[_0x6923('0x19')](_0x7e92fb)[_0x6923('0x1b')](_0x54ff4b);}};}function respondWithFilteredResult(_0xcf90b7,_0x4976e6){return function(_0x11dc4c){if(_0x11dc4c){var _0x3b2f0d=_0x11dc4c[_0x6923('0x1c')],_0x78c892=_0x4976e6[_0x6923('0x1d')],_0x3b785c=_0x4976e6['offset']+_0x4976e6[_0x6923('0x1e')],_0x33b591;if(_0x3b785c>=_0x3b2f0d){_0x3b785c=_0x3b2f0d;_0x33b591=0xc8;}else{_0x33b591=0xce;}_0xcf90b7[_0x6923('0x19')](_0x33b591);return _0xcf90b7[_0x6923('0x1f')](_0x6923('0x20'),_0x78c892+'-'+_0x3b785c+'/'+_0x3b2f0d)['json'](_0x11dc4c);}return null;};}function patchUpdates(_0x1f4f34){return function(_0x33f9d5){try{jsonpatch['apply'](_0x33f9d5,_0x1f4f34,!![]);}catch(_0x579d84){return BPromise[_0x6923('0x21')](_0x579d84);}return _0x33f9d5[_0x6923('0x22')]();};}function saveUpdates(_0x2f8f31,_0x13dc73){return function(_0x135752){if(_0x135752){return _0x135752['update'](_0x2f8f31)[_0x6923('0x23')](function(_0x5e077c){return _0x5e077c;});}return null;};}function removeEntity(_0x892495,_0xdd646c){return function(_0x31a357){if(_0x31a357){return _0x31a357['destroy']()[_0x6923('0x23')](function(){_0x892495[_0x6923('0x19')](0xcc)[_0x6923('0x1a')]();});}};}function handleEntityNotFound(_0x3d6f81,_0x33aa85){return function(_0x4683da){if(!_0x4683da){_0x3d6f81['sendStatus'](0x194);}return _0x4683da;};}function handleError(_0x3c940b,_0x3dc82f){_0x3dc82f=_0x3dc82f||0x1f4;return function(_0x2b2e2e){logger[_0x6923('0x24')](_0x2b2e2e[_0x6923('0x25')]);if(_0x2b2e2e['name']){delete _0x2b2e2e[_0x6923('0x26')];}_0x3c940b[_0x6923('0x19')](_0x3dc82f)[_0x6923('0x27')](_0x2b2e2e);};}exports[_0x6923('0x28')]=function(_0x5f0b6d,_0x492d97){var _0xbc657a={},_0x4d790b={},_0x12399c={'count':0x0,'rows':[]};var _0x2a77df=_['map'](db[_0x6923('0x29')][_0x6923('0x2a')],function(_0x315aa0){return{'name':_0x315aa0[_0x6923('0x2b')],'type':_0x315aa0[_0x6923('0x2c')][_0x6923('0x2d')]};});_0x4d790b['model']=_['map'](_0x2a77df,_0x6923('0x26'));_0x4d790b[_0x6923('0x2e')]=_[_0x6923('0x2f')](_0x5f0b6d[_0x6923('0x2e')]);_0x4d790b[_0x6923('0x30')]=_[_0x6923('0x31')](_0x4d790b[_0x6923('0x32')],_0x4d790b[_0x6923('0x2e')]);_0xbc657a[_0x6923('0x33')]=_[_0x6923('0x31')](_0x4d790b[_0x6923('0x32')],qs['fields'](_0x5f0b6d['query'][_0x6923('0x34')]));_0xbc657a[_0x6923('0x33')]=_0xbc657a[_0x6923('0x33')][_0x6923('0x35')]?_0xbc657a[_0x6923('0x33')]:_0x4d790b[_0x6923('0x32')];if(!_0x5f0b6d[_0x6923('0x2e')][_0x6923('0x36')](_0x6923('0x37'))){_0xbc657a[_0x6923('0x1e')]=qs[_0x6923('0x1e')](_0x5f0b6d[_0x6923('0x2e')][_0x6923('0x1e')]);_0xbc657a['offset']=qs[_0x6923('0x1d')](_0x5f0b6d['query']['offset']);}_0xbc657a[_0x6923('0x38')]=qs[_0x6923('0x39')](_0x5f0b6d[_0x6923('0x2e')]['sort']);_0xbc657a['where']=qs[_0x6923('0x30')](_[_0x6923('0x3a')](_0x5f0b6d['query'],_0x4d790b[_0x6923('0x30')]));if(_0x5f0b6d[_0x6923('0x2e')][_0x6923('0x3b')]){_0xbc657a[_0x6923('0x3c')]=_[_0x6923('0x3d')](_0xbc657a[_0x6923('0x3c')],{'$or':_[_0x6923('0x3e')](_0x2a77df,function(_0x30f625){if(_0x30f625['type']!==_0x6923('0x3f')){var _0x3161da={};_0x3161da[_0x30f625['name']]={'$like':'%'+_0x5f0b6d[_0x6923('0x2e')]['filter']+'%'};return _0x3161da;}})});}_0xbc657a=_[_0x6923('0x3d')]({},_0xbc657a,_0x5f0b6d[_0x6923('0x40')]);var _0x5e5d16={'where':_0xbc657a[_0x6923('0x3c')]};return db[_0x6923('0x29')][_0x6923('0x1c')](_0x5e5d16)['then'](function(_0x3d43c6){_0x12399c['count']=_0x3d43c6;if(_0x5f0b6d[_0x6923('0x2e')]['includeAll']){_0xbc657a[_0x6923('0x41')]=[{'all':!![]}];}return db[_0x6923('0x29')][_0x6923('0x42')](_0xbc657a);})[_0x6923('0x23')](function(_0x2a1360){_0x12399c[_0x6923('0x43')]=_0x2a1360;return _0x12399c;})[_0x6923('0x23')](respondWithFilteredResult(_0x492d97,_0xbc657a))['catch'](handleError(_0x492d97,null));};exports[_0x6923('0x44')]=function(_0x94df81,_0x42e4fb){var _0x47e4ac={'raw':!![],'where':{'id':_0x94df81[_0x6923('0x45')]['id']}},_0x1d3c21={};_0x1d3c21[_0x6923('0x32')]=_[_0x6923('0x2f')](db['MailServerOut'][_0x6923('0x2a')]);_0x1d3c21['query']=_[_0x6923('0x2f')](_0x94df81[_0x6923('0x2e')]);_0x1d3c21['filters']=_['intersection'](_0x1d3c21[_0x6923('0x32')],_0x1d3c21[_0x6923('0x2e')]);_0x47e4ac[_0x6923('0x33')]=_[_0x6923('0x31')](_0x1d3c21[_0x6923('0x32')],qs[_0x6923('0x34')](_0x94df81[_0x6923('0x2e')][_0x6923('0x34')]));_0x47e4ac['attributes']=_0x47e4ac['attributes']['length']?_0x47e4ac[_0x6923('0x33')]:_0x1d3c21[_0x6923('0x32')];if(_0x94df81[_0x6923('0x2e')][_0x6923('0x46')]){_0x47e4ac[_0x6923('0x41')]=[{'all':!![]}];}_0x47e4ac=_[_0x6923('0x3d')]({},_0x47e4ac,_0x94df81[_0x6923('0x40')]);return db['MailServerOut'][_0x6923('0x47')](_0x47e4ac)[_0x6923('0x23')](handleEntityNotFound(_0x42e4fb,null))[_0x6923('0x23')](respondWithResult(_0x42e4fb,null))[_0x6923('0x48')](handleError(_0x42e4fb,null));};exports[_0x6923('0x49')]=function(_0x2ed48d,_0x4c244f){return db[_0x6923('0x29')][_0x6923('0x49')](_0x2ed48d[_0x6923('0x4a')],{})[_0x6923('0x23')](respondWithResult(_0x4c244f,0xc9))[_0x6923('0x48')](handleError(_0x4c244f,null));};exports['update']=function(_0x3cadb3,_0x4c829b){if(_0x3cadb3[_0x6923('0x4a')]['id']){delete _0x3cadb3[_0x6923('0x4a')]['id'];}return db[_0x6923('0x29')][_0x6923('0x47')]({'where':{'id':_0x3cadb3['params']['id']}})[_0x6923('0x23')](handleEntityNotFound(_0x4c829b,null))[_0x6923('0x23')](saveUpdates(_0x3cadb3['body'],null))['then'](respondWithResult(_0x4c829b,null))[_0x6923('0x48')](handleError(_0x4c829b,null));};exports[_0x6923('0x4b')]=function(_0x1685b6,_0x44ece5){return db[_0x6923('0x29')][_0x6923('0x47')]({'where':{'id':_0x1685b6[_0x6923('0x45')]['id']}})[_0x6923('0x23')](handleEntityNotFound(_0x44ece5,null))[_0x6923('0x23')](removeEntity(_0x44ece5,null))['catch'](handleError(_0x44ece5,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 3da4a47..6042d63 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 _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x4e7abc,_0x2aeca1){_0x4e7abc=_0x4e7abc-0x0;var _0x428796=_0x7fbe[_0x4e7abc];return _0x428796;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x24ca=['MailServerOut','mail_servers_out','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define'];(function(_0x5e97c6,_0x288f15){var _0x298d3c=function(_0x36ac9e){while(--_0x36ac9e){_0x5e97c6['push'](_0x5e97c6['shift']());}};_0x298d3c(++_0x288f15);}(_0x24ca,0x1bc));var _0xa24c=function(_0x16aaef,_0x410651){_0x16aaef=_0x16aaef-0x0;var _0x1c82ef=_0x24ca[_0x16aaef];return _0x1c82ef;};'use strict';var _=require(_0xa24c('0x0'));var util=require('util');var logger=require(_0xa24c('0x1'))(_0xa24c('0x2'));var moment=require(_0xa24c('0x3'));var BPromise=require('bluebird');var rp=require(_0xa24c('0x4'));var fs=require('fs');var path=require(_0xa24c('0x5'));var rimraf=require(_0xa24c('0x6'));var config=require(_0xa24c('0x7'));var attributes=require(_0xa24c('0x8'));module[_0xa24c('0x9')]=function(_0xf0511,_0x3c0aaa){return _0xf0511[_0xa24c('0xa')](_0xa24c('0xb'),attributes,{'tableName':_0xa24c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 0cd7f55..ba2c688 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 _0xd0ad=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x12af14,_0x135bc5){var _0x100286=function(_0x49ba84){while(--_0x49ba84){_0x12af14['push'](_0x12af14['shift']());}};_0x100286(++_0x135bc5);}(_0xd0ad,0x1c3));var _0xdd0a=function(_0x3b9098,_0x4abc92){_0x3b9098=_0x3b9098-0x0;var _0x23bda6=_0xd0ad[_0x3b9098];return _0x23bda6;};'use strict';var _=require(_0xdd0a('0x0'));var util=require('util');var moment=require(_0xdd0a('0x1'));var BPromise=require(_0xdd0a('0x2'));var rs=require(_0xdd0a('0x3'));var fs=require('fs');var Redis=require(_0xdd0a('0x4'));var db=require(_0xdd0a('0x5'))['db'];var utils=require(_0xdd0a('0x6'));var logger=require(_0xdd0a('0x7'))(_0xdd0a('0x8'));var config=require(_0xdd0a('0x9'));var jayson=require(_0xdd0a('0xa'));var client=jayson[_0xdd0a('0xb')][_0xdd0a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3f5b82,_0x30406b,_0x4eaf25){return new BPromise(function(_0x301460,_0x41b4c3){return client[_0xdd0a('0xd')](_0x3f5b82,_0x4eaf25)[_0xdd0a('0xe')](function(_0x42ba7e){logger[_0xdd0a('0xf')](_0xdd0a('0x10'),_0x30406b,_0xdd0a('0x11'));logger[_0xdd0a('0x12')](_0xdd0a('0x13'),_0x30406b,_0xdd0a('0x11'),JSON[_0xdd0a('0x14')](_0x42ba7e));if(_0x42ba7e[_0xdd0a('0x15')]){if(_0x42ba7e[_0xdd0a('0x15')]['code']===0x1f4){logger[_0xdd0a('0x15')]('MailServerOut,\x20%s,\x20%s',_0x30406b,_0x42ba7e[_0xdd0a('0x15')][_0xdd0a('0x16')]);return _0x41b4c3(_0x42ba7e[_0xdd0a('0x15')]['message']);}logger[_0xdd0a('0x15')](_0xdd0a('0x10'),_0x30406b,_0x42ba7e[_0xdd0a('0x15')][_0xdd0a('0x16')]);return _0x301460(_0x42ba7e[_0xdd0a('0x15')][_0xdd0a('0x16')]);}else{logger[_0xdd0a('0xf')](_0xdd0a('0x10'),_0x30406b,_0xdd0a('0x11'));_0x301460(_0x42ba7e[_0xdd0a('0x17')][_0xdd0a('0x16')]);}})[_0xdd0a('0x18')](function(_0x7a6d19){logger[_0xdd0a('0x15')](_0xdd0a('0x10'),_0x30406b,_0x7a6d19);_0x41b4c3(_0x7a6d19);});});} \ No newline at end of file +var _0xf4fd=['message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','MailServerOut,\x20%s,\x20%s'];(function(_0xd2d54,_0x5329f7){var _0x78b113=function(_0x7d2b29){while(--_0x7d2b29){_0xd2d54['push'](_0xd2d54['shift']());}};_0x78b113(++_0x5329f7);}(_0xf4fd,0xa2));var _0xdf4f=function(_0x1f5879,_0x2b34c1){_0x1f5879=_0x1f5879-0x0;var _0xf93552=_0xf4fd[_0x1f5879];return _0xf93552;};'use strict';var _=require('lodash');var util=require(_0xdf4f('0x0'));var moment=require(_0xdf4f('0x1'));var BPromise=require(_0xdf4f('0x2'));var rs=require(_0xdf4f('0x3'));var fs=require('fs');var Redis=require(_0xdf4f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdf4f('0x5'));var logger=require(_0xdf4f('0x6'))(_0xdf4f('0x7'));var config=require('../../config/environment');var jayson=require(_0xdf4f('0x8'));var client=jayson[_0xdf4f('0x9')][_0xdf4f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e1eba,_0x464236,_0x10675d){return new BPromise(function(_0x4c3f6c,_0x1872b7){return client['request'](_0x4e1eba,_0x10675d)[_0xdf4f('0xb')](function(_0x2a2a47){logger[_0xdf4f('0xc')]('MailServerOut,\x20%s,\x20%s',_0x464236,_0xdf4f('0xd'));logger[_0xdf4f('0xe')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x464236,_0xdf4f('0xd'),JSON[_0xdf4f('0xf')](_0x2a2a47));if(_0x2a2a47['error']){if(_0x2a2a47[_0xdf4f('0x10')]['code']===0x1f4){logger['error'](_0xdf4f('0x11'),_0x464236,_0x2a2a47[_0xdf4f('0x10')]['message']);return _0x1872b7(_0x2a2a47['error']['message']);}logger[_0xdf4f('0x10')](_0xdf4f('0x11'),_0x464236,_0x2a2a47['error']['message']);return _0x4c3f6c(_0x2a2a47['error'][_0xdf4f('0x12')]);}else{logger[_0xdf4f('0xc')]('MailServerOut,\x20%s,\x20%s',_0x464236,_0xdf4f('0xd'));_0x4c3f6c(_0x2a2a47[_0xdf4f('0x13')][_0xdf4f('0x12')]);}})['catch'](function(_0x5e8e45){logger[_0xdf4f('0x10')](_0xdf4f('0x11'),_0x464236,_0x5e8e45);_0x1872b7(_0x5e8e45);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 322918a..5a0566f 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 _0x2003=['/:id','delete','exports','util','express','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','post','create'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x2003,0x102));var _0x3200=function(_0x100e36,_0x4da225){_0x100e36=_0x100e36-0x0;var _0x1df0c9=_0x2003[_0x100e36];return _0x1df0c9;};'use strict';var multer=require('multer');var util=require(_0x3200('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3200('0x1'));var router=express['Router']();var auth=require(_0x3200('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x3200('0x3'));var controller=require('./mailSubstatus.controller');router[_0x3200('0x4')]('/',auth[_0x3200('0x5')](),controller[_0x3200('0x6')]);router[_0x3200('0x4')](_0x3200('0x7'),auth[_0x3200('0x5')](),controller[_0x3200('0x8')]);router[_0x3200('0x4')]('/:id',auth[_0x3200('0x5')](),controller[_0x3200('0x9')]);router[_0x3200('0xa')]('/',auth[_0x3200('0x5')](),controller[_0x3200('0xb')]);router['put'](_0x3200('0xc'),auth[_0x3200('0x5')](),controller['update']);router[_0x3200('0xd')]('/:id',auth[_0x3200('0x5')](),controller['destroy']);module[_0x3200('0xe')]=router; \ No newline at end of file +var _0xf3c6=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x29f324,_0x194384){var _0x502d6d=function(_0x171e3d){while(--_0x171e3d){_0x29f324['push'](_0x29f324['shift']());}};_0x502d6d(++_0x194384);}(_0xf3c6,0xc3));var _0x6f3c=function(_0x1783d6,_0xb976f1){_0x1783d6=_0x1783d6-0x0;var _0x326ad6=_0xf3c6[_0x1783d6];return _0x326ad6;};'use strict';var multer=require(_0x6f3c('0x0'));var util=require(_0x6f3c('0x1'));var path=require(_0x6f3c('0x2'));var timeout=require(_0x6f3c('0x3'));var express=require(_0x6f3c('0x4'));var router=express['Router']();var auth=require(_0x6f3c('0x5'));var interaction=require(_0x6f3c('0x6'));var config=require(_0x6f3c('0x7'));var controller=require(_0x6f3c('0x8'));router[_0x6f3c('0x9')]('/',auth[_0x6f3c('0xa')](),controller[_0x6f3c('0xb')]);router['get'](_0x6f3c('0xc'),auth[_0x6f3c('0xa')](),controller[_0x6f3c('0xd')]);router[_0x6f3c('0x9')](_0x6f3c('0xe'),auth[_0x6f3c('0xa')](),controller['show']);router[_0x6f3c('0xf')]('/',auth['isAuthenticated'](),controller[_0x6f3c('0x10')]);router[_0x6f3c('0x11')]('/:id',auth[_0x6f3c('0xa')](),controller[_0x6f3c('0x12')]);router[_0x6f3c('0x13')](_0x6f3c('0xe'),auth[_0x6f3c('0xa')](),controller[_0x6f3c('0x14')]);module[_0x6f3c('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index e7cbade..4d52a23 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 _0x8325=['STRING','sequelize'];(function(_0xe3b694,_0x2cd500){var _0x43033c=function(_0x45ec75){while(--_0x45ec75){_0xe3b694['push'](_0xe3b694['shift']());}};_0x43033c(++_0x2cd500);}(_0x8325,0x1f1));var _0x5832=function(_0x19a60b,_0x173450){_0x19a60b=_0x19a60b-0x0;var _0x351777=_0x8325[_0x19a60b];return _0x351777;};'use strict';var Sequelize=require(_0x5832('0x0'));module['exports']={'name':{'type':Sequelize[_0x5832('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5832('0x1')]}}; \ No newline at end of file +var _0x4a03=['exports','STRING','name'];(function(_0x9729d7,_0x1b79a8){var _0x3c4ac6=function(_0x401ba6){while(--_0x401ba6){_0x9729d7['push'](_0x9729d7['shift']());}};_0x3c4ac6(++_0x1b79a8);}(_0x4a03,0x16e));var _0x34a0=function(_0x1bee34,_0x5b2e47){_0x1bee34=_0x1bee34-0x0;var _0x4fb2ce=_0x4a03[_0x1bee34];return _0x4fb2ce;};'use strict';var Sequelize=require('sequelize');module[_0x34a0('0x0')]={'name':{'type':Sequelize[_0x34a0('0x1')],'unique':_0x34a0('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 61dd4c0..226a61c 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 _0xfcf0=['rawAttributes','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','pick','filter','where','merge','type','options','includeAll','include','findAll','rows','catch','params','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','MailSubstatus'];(function(_0x41085f,_0x4c4675){var _0x1fb4b2=function(_0x1a7b51){while(--_0x1a7b51){_0x41085f['push'](_0x41085f['shift']());}};_0x1fb4b2(++_0x4c4675);}(_0xfcf0,0x138));var _0x0fcf=function(_0x108d5f,_0x33f82d){_0x108d5f=_0x108d5f-0x0;var _0x456ea3=_0xfcf0[_0x108d5f];return _0x456ea3;};'use strict';var pdf=require(_0x0fcf('0x0'));var emlformat=require(_0x0fcf('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0fcf('0x2'));var jsonpatch=require(_0x0fcf('0x3'));var rp=require(_0x0fcf('0x4'));var moment=require(_0x0fcf('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0fcf('0x6'));var util=require(_0x0fcf('0x7'));var path=require(_0x0fcf('0x8'));var sox=require(_0x0fcf('0x9'));var csv=require(_0x0fcf('0xa'));var ejs=require(_0x0fcf('0xb'));var fs=require('fs');var _=require(_0x0fcf('0xc'));var squel=require(_0x0fcf('0xd'));var crypto=require('crypto');var jsforce=require(_0x0fcf('0xe'));var deskjs=require(_0x0fcf('0xf'));var toCsv=require(_0x0fcf('0xa'));var querystring=require('querystring');var Papa=require(_0x0fcf('0x10'));var Redis=require(_0x0fcf('0x11'));var authService=require(_0x0fcf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0fcf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0fcf('0x14'))(_0x0fcf('0x15'));var utils=require(_0x0fcf('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29336a,_0x3c999e){_0x3c999e=_0x3c999e||0xcc;return function(_0x4b4904){if(_0x4b4904){return _0x29336a[_0x0fcf('0x17')](_0x3c999e);}return _0x29336a[_0x0fcf('0x18')](_0x3c999e)[_0x0fcf('0x19')]();};}function respondWithResult(_0x26b169,_0x25fadc){_0x25fadc=_0x25fadc||0xc8;return function(_0x48bba6){if(_0x48bba6){return _0x26b169[_0x0fcf('0x18')](_0x25fadc)[_0x0fcf('0x1a')](_0x48bba6);}};}function respondWithFilteredResult(_0x1fcb47,_0x5e867f){return function(_0x3c09c4){if(_0x3c09c4){var _0x610106=_0x3c09c4[_0x0fcf('0x1b')],_0x445207=_0x5e867f[_0x0fcf('0x1c')],_0x177c8f=_0x5e867f[_0x0fcf('0x1c')]+_0x5e867f[_0x0fcf('0x1d')],_0x48dd53;if(_0x177c8f>=_0x610106){_0x177c8f=_0x610106;_0x48dd53=0xc8;}else{_0x48dd53=0xce;}_0x1fcb47[_0x0fcf('0x18')](_0x48dd53);return _0x1fcb47['set'](_0x0fcf('0x1e'),_0x445207+'-'+_0x177c8f+'/'+_0x610106)[_0x0fcf('0x1a')](_0x3c09c4);}return null;};}function patchUpdates(_0x5dad87){return function(_0x152686){try{jsonpatch[_0x0fcf('0x1f')](_0x152686,_0x5dad87,!![]);}catch(_0x4da7e3){return BPromise[_0x0fcf('0x20')](_0x4da7e3);}return _0x152686['save']();};}function saveUpdates(_0x3fc9e6,_0x13454e){return function(_0x5c8279){if(_0x5c8279){return _0x5c8279[_0x0fcf('0x21')](_0x3fc9e6)[_0x0fcf('0x22')](function(_0x29dbdf){return _0x29dbdf;});}return null;};}function removeEntity(_0x5c459c,_0x2f03ce){return function(_0x1dafc8){if(_0x1dafc8){return _0x1dafc8[_0x0fcf('0x23')]()[_0x0fcf('0x22')](function(){_0x5c459c[_0x0fcf('0x18')](0xcc)[_0x0fcf('0x19')]();});}};}function handleEntityNotFound(_0x5841a9,_0x2eef74){return function(_0x253641){if(!_0x253641){_0x5841a9[_0x0fcf('0x17')](0x194);}return _0x253641;};}function handleError(_0xd6f8b5,_0x233ac9){_0x233ac9=_0x233ac9||0x1f4;return function(_0x3cf074){logger[_0x0fcf('0x24')](_0x3cf074[_0x0fcf('0x25')]);if(_0x3cf074[_0x0fcf('0x26')]){delete _0x3cf074['name'];}_0xd6f8b5[_0x0fcf('0x18')](_0x233ac9)[_0x0fcf('0x27')](_0x3cf074);};}exports[_0x0fcf('0x28')]=function(_0x2f198b,_0x3876ed){var _0x38fe0e={},_0x2730b0={},_0x527d43={'count':0x0,'rows':[]};var _0x137e10=_[_0x0fcf('0x29')](db[_0x0fcf('0x2a')][_0x0fcf('0x2b')],function(_0x49fd0e){return{'name':_0x49fd0e['fieldName'],'type':_0x49fd0e['type'][_0x0fcf('0x2c')]};});_0x2730b0['model']=_[_0x0fcf('0x29')](_0x137e10,_0x0fcf('0x26'));_0x2730b0['query']=_[_0x0fcf('0x2d')](_0x2f198b[_0x0fcf('0x2e')]);_0x2730b0[_0x0fcf('0x2f')]=_[_0x0fcf('0x30')](_0x2730b0[_0x0fcf('0x31')],_0x2730b0[_0x0fcf('0x2e')]);_0x38fe0e['attributes']=_[_0x0fcf('0x30')](_0x2730b0[_0x0fcf('0x31')],qs[_0x0fcf('0x32')](_0x2f198b[_0x0fcf('0x2e')][_0x0fcf('0x32')]));_0x38fe0e[_0x0fcf('0x33')]=_0x38fe0e['attributes'][_0x0fcf('0x34')]?_0x38fe0e[_0x0fcf('0x33')]:_0x2730b0[_0x0fcf('0x31')];if(!_0x2f198b[_0x0fcf('0x2e')][_0x0fcf('0x35')](_0x0fcf('0x36'))){_0x38fe0e[_0x0fcf('0x1d')]=qs[_0x0fcf('0x1d')](_0x2f198b[_0x0fcf('0x2e')][_0x0fcf('0x1d')]);_0x38fe0e[_0x0fcf('0x1c')]=qs[_0x0fcf('0x1c')](_0x2f198b[_0x0fcf('0x2e')][_0x0fcf('0x1c')]);}_0x38fe0e['order']=qs['sort'](_0x2f198b[_0x0fcf('0x2e')]['sort']);_0x38fe0e['where']=qs[_0x0fcf('0x2f')](_[_0x0fcf('0x37')](_0x2f198b[_0x0fcf('0x2e')],_0x2730b0['filters']));if(_0x2f198b['query'][_0x0fcf('0x38')]){_0x38fe0e[_0x0fcf('0x39')]=_[_0x0fcf('0x3a')](_0x38fe0e['where'],{'$or':_[_0x0fcf('0x29')](_0x137e10,function(_0x1d2f3b){if(_0x1d2f3b[_0x0fcf('0x3b')]!=='VIRTUAL'){var _0x4c75e6={};_0x4c75e6[_0x1d2f3b['name']]={'$like':'%'+_0x2f198b[_0x0fcf('0x2e')][_0x0fcf('0x38')]+'%'};return _0x4c75e6;}})});}_0x38fe0e=_[_0x0fcf('0x3a')]({},_0x38fe0e,_0x2f198b[_0x0fcf('0x3c')]);var _0x370699={'where':_0x38fe0e['where']};return db[_0x0fcf('0x2a')][_0x0fcf('0x1b')](_0x370699)[_0x0fcf('0x22')](function(_0x4cbc84){_0x527d43['count']=_0x4cbc84;if(_0x2f198b[_0x0fcf('0x2e')][_0x0fcf('0x3d')]){_0x38fe0e[_0x0fcf('0x3e')]=[{'all':!![]}];}return db[_0x0fcf('0x2a')][_0x0fcf('0x3f')](_0x38fe0e);})['then'](function(_0x1dc2f7){_0x527d43[_0x0fcf('0x40')]=_0x1dc2f7;return _0x527d43;})[_0x0fcf('0x22')](respondWithFilteredResult(_0x3876ed,_0x38fe0e))[_0x0fcf('0x41')](handleError(_0x3876ed,null));};exports['show']=function(_0x5f3800,_0x252000){var _0x2444a6={'raw':!![],'where':{'id':_0x5f3800[_0x0fcf('0x42')]['id']}},_0x5544e3={};_0x5544e3[_0x0fcf('0x31')]=_['keys'](db[_0x0fcf('0x2a')][_0x0fcf('0x2b')]);_0x5544e3[_0x0fcf('0x2e')]=_[_0x0fcf('0x2d')](_0x5f3800[_0x0fcf('0x2e')]);_0x5544e3['filters']=_[_0x0fcf('0x30')](_0x5544e3[_0x0fcf('0x31')],_0x5544e3['query']);_0x2444a6['attributes']=_[_0x0fcf('0x30')](_0x5544e3['model'],qs['fields'](_0x5f3800[_0x0fcf('0x2e')][_0x0fcf('0x32')]));_0x2444a6[_0x0fcf('0x33')]=_0x2444a6[_0x0fcf('0x33')][_0x0fcf('0x34')]?_0x2444a6[_0x0fcf('0x33')]:_0x5544e3[_0x0fcf('0x31')];if(_0x5f3800[_0x0fcf('0x2e')][_0x0fcf('0x3d')]){_0x2444a6[_0x0fcf('0x3e')]=[{'all':!![]}];}_0x2444a6=_['merge']({},_0x2444a6,_0x5f3800[_0x0fcf('0x3c')]);return db[_0x0fcf('0x2a')][_0x0fcf('0x43')](_0x2444a6)['then'](handleEntityNotFound(_0x252000,null))['then'](respondWithResult(_0x252000,null))[_0x0fcf('0x41')](handleError(_0x252000,null));};exports[_0x0fcf('0x44')]=function(_0x1587df,_0x405bbe){return db['MailSubstatus']['create'](_0x1587df[_0x0fcf('0x45')],{})[_0x0fcf('0x22')](respondWithResult(_0x405bbe,0xc9))[_0x0fcf('0x41')](handleError(_0x405bbe,null));};exports[_0x0fcf('0x21')]=function(_0x345188,_0x1a7475){if(_0x345188[_0x0fcf('0x45')]['id']){delete _0x345188[_0x0fcf('0x45')]['id'];}return db['MailSubstatus']['find']({'where':{'id':_0x345188[_0x0fcf('0x42')]['id']}})[_0x0fcf('0x22')](handleEntityNotFound(_0x1a7475,null))[_0x0fcf('0x22')](saveUpdates(_0x345188[_0x0fcf('0x45')],null))[_0x0fcf('0x22')](respondWithResult(_0x1a7475,null))[_0x0fcf('0x41')](handleError(_0x1a7475,null));};exports['destroy']=function(_0x2b6ad3,_0x2aa7c4){return db['MailSubstatus'][_0x0fcf('0x43')]({'where':{'id':_0x2b6ad3[_0x0fcf('0x42')]['id']}})[_0x0fcf('0x22')](handleEntityNotFound(_0x2aa7c4,null))[_0x0fcf('0x22')](removeEntity(_0x2aa7c4,null))['catch'](handleError(_0x2aa7c4,null));};exports[_0x0fcf('0x46')]=function(_0x382448,_0x1bb062){return db[_0x0fcf('0x2a')][_0x0fcf('0x46')]()[_0x0fcf('0x22')](respondWithResult(_0x1bb062,null))[_0x0fcf('0x41')](handleError(_0x1bb062,null));}; \ No newline at end of file +var _0xe3da=['order','sort','pick','filter','where','merge','options','includeAll','include','rows','catch','show','create','body','find','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','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','apply','reject','update','then','destroy','error','stack','name','send','index','map','MailSubstatus','rawAttributes','type','key','query','keys','filters','attributes','intersection','model','fields','length','nolimit'];(function(_0x2e4136,_0x3eca4c){var _0x5e7d84=function(_0x245756){while(--_0x245756){_0x2e4136['push'](_0x2e4136['shift']());}};_0x5e7d84(++_0x3eca4c);}(_0xe3da,0x1cd));var _0xae3d=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe3da[_0x57b54c];return _0x59cc19;};'use strict';var pdf=require(_0xae3d('0x0'));var emlformat=require(_0xae3d('0x1'));var rimraf=require(_0xae3d('0x2'));var zipdir=require(_0xae3d('0x3'));var jsonpatch=require(_0xae3d('0x4'));var rp=require(_0xae3d('0x5'));var moment=require(_0xae3d('0x6'));var BPromise=require(_0xae3d('0x7'));var Mustache=require(_0xae3d('0x8'));var util=require(_0xae3d('0x9'));var path=require(_0xae3d('0xa'));var sox=require(_0xae3d('0xb'));var csv=require(_0xae3d('0xc'));var ejs=require(_0xae3d('0xd'));var fs=require('fs');var _=require(_0xae3d('0xe'));var squel=require(_0xae3d('0xf'));var crypto=require('crypto');var jsforce=require(_0xae3d('0x10'));var deskjs=require(_0xae3d('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xae3d('0x12'));var Redis=require(_0xae3d('0x13'));var authService=require(_0xae3d('0x14'));var qs=require(_0xae3d('0x15'));var as=require(_0xae3d('0x16'));var hardwareService=require(_0xae3d('0x17'));var logger=require('../../config/logger')(_0xae3d('0x18'));var utils=require('../../config/utils');var config=require(_0xae3d('0x19'));var db=require(_0xae3d('0x1a'))['db'];function respondWithStatusCode(_0x7770eb,_0x172f7a){_0x172f7a=_0x172f7a||0xcc;return function(_0x48aa74){if(_0x48aa74){return _0x7770eb[_0xae3d('0x1b')](_0x172f7a);}return _0x7770eb[_0xae3d('0x1c')](_0x172f7a)[_0xae3d('0x1d')]();};}function respondWithResult(_0x1605ac,_0x2afdd3){_0x2afdd3=_0x2afdd3||0xc8;return function(_0x430659){if(_0x430659){return _0x1605ac[_0xae3d('0x1c')](_0x2afdd3)['json'](_0x430659);}};}function respondWithFilteredResult(_0x1fb7a9,_0x42f4b4){return function(_0x46295b){if(_0x46295b){var _0x230afb=_0x46295b[_0xae3d('0x1e')],_0x192c13=_0x42f4b4[_0xae3d('0x1f')],_0x2da957=_0x42f4b4[_0xae3d('0x1f')]+_0x42f4b4['limit'],_0x585160;if(_0x2da957>=_0x230afb){_0x2da957=_0x230afb;_0x585160=0xc8;}else{_0x585160=0xce;}_0x1fb7a9[_0xae3d('0x1c')](_0x585160);return _0x1fb7a9[_0xae3d('0x20')]('Content-Range',_0x192c13+'-'+_0x2da957+'/'+_0x230afb)['json'](_0x46295b);}return null;};}function patchUpdates(_0x8a37cc){return function(_0x46a6d7){try{jsonpatch[_0xae3d('0x21')](_0x46a6d7,_0x8a37cc,!![]);}catch(_0x377546){return BPromise[_0xae3d('0x22')](_0x377546);}return _0x46a6d7['save']();};}function saveUpdates(_0x121024,_0x48f00e){return function(_0x4a09c2){if(_0x4a09c2){return _0x4a09c2[_0xae3d('0x23')](_0x121024)[_0xae3d('0x24')](function(_0x263b0e){return _0x263b0e;});}return null;};}function removeEntity(_0x1facc1,_0x3e7afc){return function(_0x26c419){if(_0x26c419){return _0x26c419[_0xae3d('0x25')]()[_0xae3d('0x24')](function(){_0x1facc1[_0xae3d('0x1c')](0xcc)[_0xae3d('0x1d')]();});}};}function handleEntityNotFound(_0x9bf34a,_0x37f5ff){return function(_0x1b2acb){if(!_0x1b2acb){_0x9bf34a[_0xae3d('0x1b')](0x194);}return _0x1b2acb;};}function handleError(_0x1fe90f,_0xfb54f6){_0xfb54f6=_0xfb54f6||0x1f4;return function(_0x21b608){logger[_0xae3d('0x26')](_0x21b608[_0xae3d('0x27')]);if(_0x21b608['name']){delete _0x21b608[_0xae3d('0x28')];}_0x1fe90f[_0xae3d('0x1c')](_0xfb54f6)[_0xae3d('0x29')](_0x21b608);};}exports[_0xae3d('0x2a')]=function(_0x256bd0,_0x4391db){var _0x8de288={},_0x54c1e1={},_0x57864e={'count':0x0,'rows':[]};var _0x12e3a5=_[_0xae3d('0x2b')](db[_0xae3d('0x2c')][_0xae3d('0x2d')],function(_0xb69ec9){return{'name':_0xb69ec9['fieldName'],'type':_0xb69ec9[_0xae3d('0x2e')][_0xae3d('0x2f')]};});_0x54c1e1['model']=_[_0xae3d('0x2b')](_0x12e3a5,_0xae3d('0x28'));_0x54c1e1[_0xae3d('0x30')]=_[_0xae3d('0x31')](_0x256bd0[_0xae3d('0x30')]);_0x54c1e1[_0xae3d('0x32')]=_['intersection'](_0x54c1e1['model'],_0x54c1e1['query']);_0x8de288[_0xae3d('0x33')]=_[_0xae3d('0x34')](_0x54c1e1[_0xae3d('0x35')],qs[_0xae3d('0x36')](_0x256bd0['query'][_0xae3d('0x36')]));_0x8de288[_0xae3d('0x33')]=_0x8de288[_0xae3d('0x33')][_0xae3d('0x37')]?_0x8de288[_0xae3d('0x33')]:_0x54c1e1[_0xae3d('0x35')];if(!_0x256bd0[_0xae3d('0x30')]['hasOwnProperty'](_0xae3d('0x38'))){_0x8de288['limit']=qs['limit'](_0x256bd0[_0xae3d('0x30')]['limit']);_0x8de288[_0xae3d('0x1f')]=qs['offset'](_0x256bd0['query'][_0xae3d('0x1f')]);}_0x8de288[_0xae3d('0x39')]=qs[_0xae3d('0x3a')](_0x256bd0['query'][_0xae3d('0x3a')]);_0x8de288['where']=qs[_0xae3d('0x32')](_[_0xae3d('0x3b')](_0x256bd0[_0xae3d('0x30')],_0x54c1e1[_0xae3d('0x32')]));if(_0x256bd0[_0xae3d('0x30')][_0xae3d('0x3c')]){_0x8de288[_0xae3d('0x3d')]=_[_0xae3d('0x3e')](_0x8de288[_0xae3d('0x3d')],{'$or':_[_0xae3d('0x2b')](_0x12e3a5,function(_0x18855c){if(_0x18855c['type']!=='VIRTUAL'){var _0x3992eb={};_0x3992eb[_0x18855c['name']]={'$like':'%'+_0x256bd0[_0xae3d('0x30')][_0xae3d('0x3c')]+'%'};return _0x3992eb;}})});}_0x8de288=_[_0xae3d('0x3e')]({},_0x8de288,_0x256bd0[_0xae3d('0x3f')]);var _0x2c2892={'where':_0x8de288[_0xae3d('0x3d')]};return db[_0xae3d('0x2c')][_0xae3d('0x1e')](_0x2c2892)[_0xae3d('0x24')](function(_0xd8cd66){_0x57864e[_0xae3d('0x1e')]=_0xd8cd66;if(_0x256bd0['query'][_0xae3d('0x40')]){_0x8de288[_0xae3d('0x41')]=[{'all':!![]}];}return db[_0xae3d('0x2c')]['findAll'](_0x8de288);})['then'](function(_0x99184f){_0x57864e[_0xae3d('0x42')]=_0x99184f;return _0x57864e;})['then'](respondWithFilteredResult(_0x4391db,_0x8de288))[_0xae3d('0x43')](handleError(_0x4391db,null));};exports[_0xae3d('0x44')]=function(_0xf2fb60,_0x1786a9){var _0x436a04={'raw':!![],'where':{'id':_0xf2fb60['params']['id']}},_0x1a483a={};_0x1a483a[_0xae3d('0x35')]=_[_0xae3d('0x31')](db[_0xae3d('0x2c')][_0xae3d('0x2d')]);_0x1a483a[_0xae3d('0x30')]=_['keys'](_0xf2fb60[_0xae3d('0x30')]);_0x1a483a['filters']=_[_0xae3d('0x34')](_0x1a483a[_0xae3d('0x35')],_0x1a483a[_0xae3d('0x30')]);_0x436a04[_0xae3d('0x33')]=_['intersection'](_0x1a483a['model'],qs['fields'](_0xf2fb60[_0xae3d('0x30')][_0xae3d('0x36')]));_0x436a04['attributes']=_0x436a04['attributes']['length']?_0x436a04[_0xae3d('0x33')]:_0x1a483a[_0xae3d('0x35')];if(_0xf2fb60[_0xae3d('0x30')][_0xae3d('0x40')]){_0x436a04[_0xae3d('0x41')]=[{'all':!![]}];}_0x436a04=_[_0xae3d('0x3e')]({},_0x436a04,_0xf2fb60[_0xae3d('0x3f')]);return db['MailSubstatus']['find'](_0x436a04)['then'](handleEntityNotFound(_0x1786a9,null))[_0xae3d('0x24')](respondWithResult(_0x1786a9,null))['catch'](handleError(_0x1786a9,null));};exports[_0xae3d('0x45')]=function(_0x14fad3,_0x41cb63){return db[_0xae3d('0x2c')][_0xae3d('0x45')](_0x14fad3[_0xae3d('0x46')],{})[_0xae3d('0x24')](respondWithResult(_0x41cb63,0xc9))[_0xae3d('0x43')](handleError(_0x41cb63,null));};exports[_0xae3d('0x23')]=function(_0x4ed0f9,_0x49b8df){if(_0x4ed0f9['body']['id']){delete _0x4ed0f9['body']['id'];}return db['MailSubstatus'][_0xae3d('0x47')]({'where':{'id':_0x4ed0f9[_0xae3d('0x48')]['id']}})[_0xae3d('0x24')](handleEntityNotFound(_0x49b8df,null))[_0xae3d('0x24')](saveUpdates(_0x4ed0f9['body'],null))['then'](respondWithResult(_0x49b8df,null))[_0xae3d('0x43')](handleError(_0x49b8df,null));};exports[_0xae3d('0x25')]=function(_0x3a7610,_0x247a37){return db['MailSubstatus'][_0xae3d('0x47')]({'where':{'id':_0x3a7610[_0xae3d('0x48')]['id']}})[_0xae3d('0x24')](handleEntityNotFound(_0x247a37,null))[_0xae3d('0x24')](removeEntity(_0x247a37,null))[_0xae3d('0x43')](handleError(_0x247a37,null));};exports[_0xae3d('0x49')]=function(_0x3e30ea,_0x291c7d){return db[_0xae3d('0x2c')][_0xae3d('0x49')]()[_0xae3d('0x24')](respondWithResult(_0x291c7d,null))[_0xae3d('0x43')](handleError(_0x291c7d,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index f890ae4..7ccab62 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 _0xb8a0=['./mailSubstatus.attributes','exports','define','MailSubstatus','mail_substatuses','../../config/logger','api','bluebird'];(function(_0x86597f,_0x5dc3b3){var _0x1f4e98=function(_0x5ed703){while(--_0x5ed703){_0x86597f['push'](_0x86597f['shift']());}};_0x1f4e98(++_0x5dc3b3);}(_0xb8a0,0x1d5));var _0x0b8a=function(_0x1902b7,_0x513502){_0x1902b7=_0x1902b7-0x0;var _0x568b41=_0xb8a0[_0x1902b7];return _0x568b41;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0b8a('0x0'))(_0x0b8a('0x1'));var moment=require('moment');var BPromise=require(_0x0b8a('0x2'));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(_0x0b8a('0x3'));module[_0x0b8a('0x4')]=function(_0x381b17,_0x165710){return _0x381b17[_0x0b8a('0x5')](_0x0b8a('0x6'),attributes,{'tableName':_0x0b8a('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9805=['define','MailSubstatus','mail_substatuses','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x237da8,_0x37b77a){var _0x558825=function(_0x45d7f1){while(--_0x45d7f1){_0x237da8['push'](_0x237da8['shift']());}};_0x558825(++_0x37b77a);}(_0x9805,0x18f));var _0x5980=function(_0x400b64,_0x5eb1bf){_0x400b64=_0x400b64-0x0;var _0x1d615d=_0x9805[_0x400b64];return _0x1d615d;};'use strict';var _=require(_0x5980('0x0'));var util=require(_0x5980('0x1'));var logger=require(_0x5980('0x2'))(_0x5980('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5980('0x4'));var fs=require('fs');var path=require(_0x5980('0x5'));var rimraf=require(_0x5980('0x6'));var config=require(_0x5980('0x7'));var attributes=require('./mailSubstatus.attributes');module['exports']=function(_0x1b1c8d,_0x255321){return _0x1b1c8d[_0x5980('0x8')](_0x5980('0x9'),attributes,{'tableName':_0x5980('0xa'),'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 4ff536e..03108c1 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 _0xa8a8=['stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug'];(function(_0x20a46d,_0x3f4bfd){var _0x5e91e7=function(_0x410156){while(--_0x410156){_0x20a46d['push'](_0x20a46d['shift']());}};_0x5e91e7(++_0x3f4bfd);}(_0xa8a8,0xec));var _0x8a8a=function(_0x21942b,_0x367135){_0x21942b=_0x21942b-0x0;var _0x4f875e=_0xa8a8[_0x21942b];return _0x4f875e;};'use strict';var _=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var moment=require(_0x8a8a('0x2'));var BPromise=require(_0x8a8a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a8a('0x4'));var db=require(_0x8a8a('0x5'))['db'];var utils=require(_0x8a8a('0x6'));var logger=require(_0x8a8a('0x7'))(_0x8a8a('0x8'));var config=require(_0x8a8a('0x9'));var jayson=require(_0x8a8a('0xa'));var client=jayson[_0x8a8a('0xb')][_0x8a8a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x315fe9,_0x1d7121,_0x8e7aa0){return new BPromise(function(_0x4225b9,_0xecaa6f){return client[_0x8a8a('0xd')](_0x315fe9,_0x8e7aa0)['then'](function(_0x576ef9){logger[_0x8a8a('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'));logger[_0x8a8a('0x10')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'),JSON[_0x8a8a('0x11')](_0x576ef9));if(_0x576ef9[_0x8a8a('0x12')]){if(_0x576ef9['error'][_0x8a8a('0x13')]===0x1f4){logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x576ef9[_0x8a8a('0x12')]['message']);return _0xecaa6f(_0x576ef9[_0x8a8a('0x12')]['message']);}logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x576ef9[_0x8a8a('0x12')][_0x8a8a('0x15')]);return _0x4225b9(_0x576ef9[_0x8a8a('0x12')][_0x8a8a('0x15')]);}else{logger[_0x8a8a('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'));_0x4225b9(_0x576ef9['result'][_0x8a8a('0x15')]);}})[_0x8a8a('0x16')](function(_0x46a4f4){logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x46a4f4);_0xecaa6f(_0x46a4f4);});});} \ No newline at end of file +var _0x1339=['info','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x351000,_0x22b335){var _0x1234d5=function(_0x2fc0ab){while(--_0x2fc0ab){_0x351000['push'](_0x351000['shift']());}};_0x1234d5(++_0x22b335);}(_0x1339,0x1ed));var _0x9133=function(_0x4e5e73,_0x812206){_0x4e5e73=_0x4e5e73-0x0;var _0x52ead4=_0x1339[_0x4e5e73];return _0x52ead4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9133('0x0'));var BPromise=require(_0x9133('0x1'));var rs=require(_0x9133('0x2'));var fs=require('fs');var Redis=require(_0x9133('0x3'));var db=require(_0x9133('0x4'))['db'];var utils=require(_0x9133('0x5'));var logger=require(_0x9133('0x6'))(_0x9133('0x7'));var config=require('../../config/environment');var jayson=require(_0x9133('0x8'));var client=jayson[_0x9133('0x9')][_0x9133('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x539af6,_0x2758e2,_0x334dcd){return new BPromise(function(_0x3059c4,_0x431a55){return client[_0x9133('0xb')](_0x539af6,_0x334dcd)[_0x9133('0xc')](function(_0x4294b7){logger[_0x9133('0xd')](_0x9133('0xe'),_0x2758e2,_0x9133('0xf'));logger['debug'](_0x9133('0x10'),_0x2758e2,_0x9133('0xf'),JSON[_0x9133('0x11')](_0x4294b7));if(_0x4294b7[_0x9133('0x12')]){if(_0x4294b7[_0x9133('0x12')][_0x9133('0x13')]===0x1f4){logger['error'](_0x9133('0xe'),_0x2758e2,_0x4294b7[_0x9133('0x12')]['message']);return _0x431a55(_0x4294b7['error'][_0x9133('0x14')]);}logger['error'](_0x9133('0xe'),_0x2758e2,_0x4294b7[_0x9133('0x12')][_0x9133('0x14')]);return _0x3059c4(_0x4294b7[_0x9133('0x12')][_0x9133('0x14')]);}else{logger[_0x9133('0xd')]('MailSubstatus,\x20%s,\x20%s',_0x2758e2,_0x9133('0xf'));_0x3059c4(_0x4294b7[_0x9133('0x15')]['message']);}})[_0x9133('0x16')](function(_0xa46eb1){logger[_0x9133('0x12')](_0x9133('0xe'),_0x2758e2,_0xa46eb1);_0x431a55(_0xa46eb1);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index f881c03..b321782 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 _0x2040=['put','/:id','update','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','describe','show','post'];(function(_0x4a0cc1,_0x865fb2){var _0x167d22=function(_0x4672c9){while(--_0x4672c9){_0x4a0cc1['push'](_0x4a0cc1['shift']());}};_0x167d22(++_0x865fb2);}(_0x2040,0x180));var _0x0204=function(_0x4bbaf9,_0x5d3179){_0x4bbaf9=_0x4bbaf9-0x0;var _0x1112a8=_0x2040[_0x4bbaf9];return _0x1112a8;};'use strict';var multer=require(_0x0204('0x0'));var util=require(_0x0204('0x1'));var path=require(_0x0204('0x2'));var timeout=require(_0x0204('0x3'));var express=require(_0x0204('0x4'));var router=express[_0x0204('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x0204('0x6'));var config=require(_0x0204('0x7'));var controller=require(_0x0204('0x8'));router[_0x0204('0x9')]('/',auth[_0x0204('0xa')](),controller[_0x0204('0xb')]);router[_0x0204('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x0204('0xc')]);router[_0x0204('0x9')]('/:id',auth[_0x0204('0xa')](),controller[_0x0204('0xd')]);router[_0x0204('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0204('0xf')](_0x0204('0x10'),auth['isAuthenticated'](),controller[_0x0204('0x11')]);router['delete']('/:id',auth[_0x0204('0xa')](),controller['destroy']);module[_0x0204('0x12')]=router; \ No newline at end of file +var _0x9aa3=['isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','exports','util','path','express','Router','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','/describe'];(function(_0x42d1d0,_0x281ece){var _0x39a59e=function(_0x5bb5eb){while(--_0x5bb5eb){_0x42d1d0['push'](_0x42d1d0['shift']());}};_0x39a59e(++_0x281ece);}(_0x9aa3,0x13a));var _0x39aa=function(_0x5cb2e5,_0x3e6211){_0x5cb2e5=_0x5cb2e5-0x0;var _0x1b3639=_0x9aa3[_0x5cb2e5];return _0x1b3639;};'use strict';var multer=require('multer');var util=require(_0x39aa('0x0'));var path=require(_0x39aa('0x1'));var timeout=require('connect-timeout');var express=require(_0x39aa('0x2'));var router=express[_0x39aa('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x39aa('0x4'));var config=require(_0x39aa('0x5'));var controller=require(_0x39aa('0x6'));router[_0x39aa('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x39aa('0x8'),auth[_0x39aa('0x9')](),controller[_0x39aa('0xa')]);router[_0x39aa('0x7')](_0x39aa('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x39aa('0xc')]('/',auth[_0x39aa('0x9')](),controller[_0x39aa('0xd')]);router[_0x39aa('0xe')](_0x39aa('0xb'),auth['isAuthenticated'](),controller[_0x39aa('0xf')]);router[_0x39aa('0x10')](_0x39aa('0xb'),auth['isAuthenticated'](),controller[_0x39aa('0x11')]);module[_0x39aa('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 7358e8c..3d1c1cc 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 _0x6f98=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x58b89c,_0x4a0753){var _0x200ee0=function(_0x13f0f8){while(--_0x13f0f8){_0x58b89c['push'](_0x58b89c['shift']());}};_0x200ee0(++_0x4a0753);}(_0x6f98,0x1a3));var _0x86f9=function(_0x2df344,_0x20f615){_0x2df344=_0x2df344-0x0;var _0x47af45=_0x6f98[_0x2df344];return _0x47af45;};'use strict';var moment=require(_0x86f9('0x0'));var Sequelize=require(_0x86f9('0x1'));module[_0x86f9('0x2')]={'uniqueid':{'type':Sequelize[_0x86f9('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x86f9('0x4'),_0x86f9('0x5'),_0x86f9('0x6')),'allowNull':![],'defaultValue':_0x86f9('0x6')},'transferredAt':{'type':Sequelize[_0x86f9('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x86f9('0x8')]}}; \ No newline at end of file +var _0x5972=['DATE','NOW','moment','sequelize','exports','STRING','ENUM','agent','queue'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x5972,0xc8));var _0x2597=function(_0x247fa1,_0x4ec37c){_0x247fa1=_0x247fa1-0x0;var _0x244f35=_0x5972[_0x247fa1];return _0x244f35;};'use strict';var moment=require(_0x2597('0x0'));var Sequelize=require(_0x2597('0x1'));module[_0x2597('0x2')]={'uniqueid':{'type':Sequelize[_0x2597('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x2597('0x4')]('account',_0x2597('0x5'),_0x2597('0x6')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x2597('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x2597('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index de02c00..5925ad2 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 _0x7a54=['Content-Range','apply','reject','save','then','destroy','sendStatus','error','name','send','map','MailTransferReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','count','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','update','describe','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','status','end','json','offset','set'];(function(_0x8317f1,_0x2406a3){var _0x1c582b=function(_0x59fe94){while(--_0x59fe94){_0x8317f1['push'](_0x8317f1['shift']());}};_0x1c582b(++_0x2406a3);}(_0x7a54,0x106));var _0x47a5=function(_0x5160ec,_0x176b5d){_0x5160ec=_0x5160ec-0x0;var _0x179b81=_0x7a54[_0x5160ec];return _0x179b81;};'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'];function respondWithStatusCode(_0xd612dd,_0xd308b8){_0xd308b8=_0xd308b8||0xcc;return function(_0x1eae59){if(_0x1eae59){return _0xd612dd['sendStatus'](_0xd308b8);}return _0xd612dd[_0x47a5('0x15')](_0xd308b8)[_0x47a5('0x16')]();};}function respondWithResult(_0x1cf309,_0x711793){_0x711793=_0x711793||0xc8;return function(_0x139f25){if(_0x139f25){return _0x1cf309[_0x47a5('0x15')](_0x711793)[_0x47a5('0x17')](_0x139f25);}};}function respondWithFilteredResult(_0x190faa,_0x4e99a8){return function(_0x362359){if(_0x362359){var _0x11faf5=_0x362359['count'],_0x3b001e=_0x4e99a8['offset'],_0x2a2cbb=_0x4e99a8[_0x47a5('0x18')]+_0x4e99a8['limit'],_0x1ef44c;if(_0x2a2cbb>=_0x11faf5){_0x2a2cbb=_0x11faf5;_0x1ef44c=0xc8;}else{_0x1ef44c=0xce;}_0x190faa['status'](_0x1ef44c);return _0x190faa[_0x47a5('0x19')](_0x47a5('0x1a'),_0x3b001e+'-'+_0x2a2cbb+'/'+_0x11faf5)[_0x47a5('0x17')](_0x362359);}return null;};}function patchUpdates(_0x1ef371){return function(_0x477b1d){try{jsonpatch[_0x47a5('0x1b')](_0x477b1d,_0x1ef371,!![]);}catch(_0x2763d6){return BPromise[_0x47a5('0x1c')](_0x2763d6);}return _0x477b1d[_0x47a5('0x1d')]();};}function saveUpdates(_0x4a9fcb,_0x1570bc){return function(_0xf160ba){if(_0xf160ba){return _0xf160ba['update'](_0x4a9fcb)[_0x47a5('0x1e')](function(_0x1f03f7){return _0x1f03f7;});}return null;};}function removeEntity(_0x36874d,_0x4c5910){return function(_0xb8ae6c){if(_0xb8ae6c){return _0xb8ae6c[_0x47a5('0x1f')]()[_0x47a5('0x1e')](function(){_0x36874d[_0x47a5('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe2dea9,_0x385687){return function(_0x513981){if(!_0x513981){_0xe2dea9[_0x47a5('0x20')](0x194);}return _0x513981;};}function handleError(_0xc4cd63,_0x4437f1){_0x4437f1=_0x4437f1||0x1f4;return function(_0x129ce5){logger[_0x47a5('0x21')](_0x129ce5['stack']);if(_0x129ce5['name']){delete _0x129ce5[_0x47a5('0x22')];}_0xc4cd63['status'](_0x4437f1)[_0x47a5('0x23')](_0x129ce5);};}exports['index']=function(_0x23cb77,_0x378208){var _0x36ad34={},_0x1dac65={},_0x21f296={'count':0x0,'rows':[]};var _0x3ba0b7=_[_0x47a5('0x24')](db[_0x47a5('0x25')][_0x47a5('0x26')],function(_0x361bfa){return{'name':_0x361bfa[_0x47a5('0x27')],'type':_0x361bfa[_0x47a5('0x28')][_0x47a5('0x29')]};});_0x1dac65['model']=_[_0x47a5('0x24')](_0x3ba0b7,'name');_0x1dac65[_0x47a5('0x2a')]=_[_0x47a5('0x2b')](_0x23cb77[_0x47a5('0x2a')]);_0x1dac65['filters']=_[_0x47a5('0x2c')](_0x1dac65[_0x47a5('0x2d')],_0x1dac65[_0x47a5('0x2a')]);_0x36ad34[_0x47a5('0x2e')]=_['intersection'](_0x1dac65['model'],qs[_0x47a5('0x2f')](_0x23cb77[_0x47a5('0x2a')]['fields']));_0x36ad34['attributes']=_0x36ad34[_0x47a5('0x2e')][_0x47a5('0x30')]?_0x36ad34['attributes']:_0x1dac65[_0x47a5('0x2d')];if(!_0x23cb77['query'][_0x47a5('0x31')](_0x47a5('0x32'))){_0x36ad34['limit']=qs['limit'](_0x23cb77[_0x47a5('0x2a')]['limit']);_0x36ad34[_0x47a5('0x18')]=qs[_0x47a5('0x18')](_0x23cb77[_0x47a5('0x2a')]['offset']);}_0x36ad34[_0x47a5('0x33')]=qs['sort'](_0x23cb77['query'][_0x47a5('0x34')]);_0x36ad34['where']=qs[_0x47a5('0x35')](_['pick'](_0x23cb77[_0x47a5('0x2a')],_0x1dac65[_0x47a5('0x35')]));if(_0x23cb77[_0x47a5('0x2a')][_0x47a5('0x36')]){_0x36ad34[_0x47a5('0x37')]=_[_0x47a5('0x38')](_0x36ad34[_0x47a5('0x37')],{'$or':_[_0x47a5('0x24')](_0x3ba0b7,function(_0x1a0d23){if(_0x1a0d23['type']!==_0x47a5('0x39')){var _0x10f136={};_0x10f136[_0x1a0d23['name']]={'$like':'%'+_0x23cb77[_0x47a5('0x2a')][_0x47a5('0x36')]+'%'};return _0x10f136;}})});}_0x36ad34=_[_0x47a5('0x38')]({},_0x36ad34,_0x23cb77['options']);var _0x101f70={'where':_0x36ad34[_0x47a5('0x37')]};return db['MailTransferReport'][_0x47a5('0x3a')](_0x101f70)[_0x47a5('0x1e')](function(_0x54ae35){_0x21f296['count']=_0x54ae35;if(_0x23cb77['query'][_0x47a5('0x3b')]){_0x36ad34['include']=[{'all':!![]}];}return db[_0x47a5('0x25')][_0x47a5('0x3c')](_0x36ad34);})[_0x47a5('0x1e')](function(_0x111f0d){_0x21f296[_0x47a5('0x3d')]=_0x111f0d;return _0x21f296;})[_0x47a5('0x1e')](respondWithFilteredResult(_0x378208,_0x36ad34))[_0x47a5('0x3e')](handleError(_0x378208,null));};exports[_0x47a5('0x3f')]=function(_0x3fa2a8,_0x36a24e){var _0x280500={'raw':!![],'where':{'id':_0x3fa2a8[_0x47a5('0x40')]['id']}},_0x1658e8={};_0x1658e8['model']=_[_0x47a5('0x2b')](db[_0x47a5('0x25')][_0x47a5('0x26')]);_0x1658e8[_0x47a5('0x2a')]=_['keys'](_0x3fa2a8[_0x47a5('0x2a')]);_0x1658e8['filters']=_['intersection'](_0x1658e8['model'],_0x1658e8['query']);_0x280500[_0x47a5('0x2e')]=_['intersection'](_0x1658e8[_0x47a5('0x2d')],qs[_0x47a5('0x2f')](_0x3fa2a8[_0x47a5('0x2a')]['fields']));_0x280500[_0x47a5('0x2e')]=_0x280500[_0x47a5('0x2e')]['length']?_0x280500['attributes']:_0x1658e8[_0x47a5('0x2d')];if(_0x3fa2a8['query'][_0x47a5('0x3b')]){_0x280500[_0x47a5('0x41')]=[{'all':!![]}];}_0x280500=_[_0x47a5('0x38')]({},_0x280500,_0x3fa2a8[_0x47a5('0x42')]);return db[_0x47a5('0x25')][_0x47a5('0x43')](_0x280500)[_0x47a5('0x1e')](handleEntityNotFound(_0x36a24e,null))[_0x47a5('0x1e')](respondWithResult(_0x36a24e,null))[_0x47a5('0x3e')](handleError(_0x36a24e,null));};exports[_0x47a5('0x44')]=function(_0x24ecb1,_0x3c3ebf){return db[_0x47a5('0x25')][_0x47a5('0x44')](_0x24ecb1[_0x47a5('0x45')],{})[_0x47a5('0x1e')](respondWithResult(_0x3c3ebf,0xc9))['catch'](handleError(_0x3c3ebf,null));};exports[_0x47a5('0x46')]=function(_0x23bb04,_0x49eab1){if(_0x23bb04['body']['id']){delete _0x23bb04[_0x47a5('0x45')]['id'];}return db['MailTransferReport'][_0x47a5('0x43')]({'where':{'id':_0x23bb04[_0x47a5('0x40')]['id']}})['then'](handleEntityNotFound(_0x49eab1,null))['then'](saveUpdates(_0x23bb04[_0x47a5('0x45')],null))['then'](respondWithResult(_0x49eab1,null))[_0x47a5('0x3e')](handleError(_0x49eab1,null));};exports[_0x47a5('0x1f')]=function(_0x3548bc,_0x3e12a7){return db[_0x47a5('0x25')][_0x47a5('0x43')]({'where':{'id':_0x3548bc[_0x47a5('0x40')]['id']}})['then'](handleEntityNotFound(_0x3e12a7,null))['then'](removeEntity(_0x3e12a7,null))[_0x47a5('0x3e')](handleError(_0x3e12a7,null));};exports[_0x47a5('0x47')]=function(_0x1163e3,_0x9ea93e){return db[_0x47a5('0x25')][_0x47a5('0x47')]()[_0x47a5('0x1e')](respondWithResult(_0x9ea93e,null))['catch'](handleError(_0x9ea93e,null));}; \ No newline at end of file +var _0x7a54=['Content-Range','apply','reject','save','then','destroy','sendStatus','error','name','send','map','MailTransferReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','count','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','update','describe','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','status','end','json','offset','set'];(function(_0x478373,_0x5292e2){var _0x2fe374=function(_0x3cd1b9){while(--_0x3cd1b9){_0x478373['push'](_0x478373['shift']());}};_0x2fe374(++_0x5292e2);}(_0x7a54,0x106));var _0x47a5=function(_0x529d50,_0x508e87){_0x529d50=_0x529d50-0x0;var _0x35a97d=_0x7a54[_0x529d50];return _0x35a97d;};'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'];function respondWithStatusCode(_0xd612dd,_0xd308b8){_0xd308b8=_0xd308b8||0xcc;return function(_0x1eae59){if(_0x1eae59){return _0xd612dd['sendStatus'](_0xd308b8);}return _0xd612dd[_0x47a5('0x15')](_0xd308b8)[_0x47a5('0x16')]();};}function respondWithResult(_0x1cf309,_0x711793){_0x711793=_0x711793||0xc8;return function(_0x139f25){if(_0x139f25){return _0x1cf309[_0x47a5('0x15')](_0x711793)[_0x47a5('0x17')](_0x139f25);}};}function respondWithFilteredResult(_0x190faa,_0x4e99a8){return function(_0x362359){if(_0x362359){var _0x11faf5=_0x362359['count'],_0x3b001e=_0x4e99a8['offset'],_0x2a2cbb=_0x4e99a8[_0x47a5('0x18')]+_0x4e99a8['limit'],_0x1ef44c;if(_0x2a2cbb>=_0x11faf5){_0x2a2cbb=_0x11faf5;_0x1ef44c=0xc8;}else{_0x1ef44c=0xce;}_0x190faa['status'](_0x1ef44c);return _0x190faa[_0x47a5('0x19')](_0x47a5('0x1a'),_0x3b001e+'-'+_0x2a2cbb+'/'+_0x11faf5)[_0x47a5('0x17')](_0x362359);}return null;};}function patchUpdates(_0x1ef371){return function(_0x477b1d){try{jsonpatch[_0x47a5('0x1b')](_0x477b1d,_0x1ef371,!![]);}catch(_0x2763d6){return BPromise[_0x47a5('0x1c')](_0x2763d6);}return _0x477b1d[_0x47a5('0x1d')]();};}function saveUpdates(_0x4a9fcb,_0x1570bc){return function(_0xf160ba){if(_0xf160ba){return _0xf160ba['update'](_0x4a9fcb)[_0x47a5('0x1e')](function(_0x1f03f7){return _0x1f03f7;});}return null;};}function removeEntity(_0x36874d,_0x4c5910){return function(_0xb8ae6c){if(_0xb8ae6c){return _0xb8ae6c[_0x47a5('0x1f')]()[_0x47a5('0x1e')](function(){_0x36874d[_0x47a5('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe2dea9,_0x385687){return function(_0x513981){if(!_0x513981){_0xe2dea9[_0x47a5('0x20')](0x194);}return _0x513981;};}function handleError(_0xc4cd63,_0x4437f1){_0x4437f1=_0x4437f1||0x1f4;return function(_0x129ce5){logger[_0x47a5('0x21')](_0x129ce5['stack']);if(_0x129ce5['name']){delete _0x129ce5[_0x47a5('0x22')];}_0xc4cd63['status'](_0x4437f1)[_0x47a5('0x23')](_0x129ce5);};}exports['index']=function(_0x23cb77,_0x378208){var _0x36ad34={},_0x1dac65={},_0x21f296={'count':0x0,'rows':[]};var _0x3ba0b7=_[_0x47a5('0x24')](db[_0x47a5('0x25')][_0x47a5('0x26')],function(_0x361bfa){return{'name':_0x361bfa[_0x47a5('0x27')],'type':_0x361bfa[_0x47a5('0x28')][_0x47a5('0x29')]};});_0x1dac65['model']=_[_0x47a5('0x24')](_0x3ba0b7,'name');_0x1dac65[_0x47a5('0x2a')]=_[_0x47a5('0x2b')](_0x23cb77[_0x47a5('0x2a')]);_0x1dac65['filters']=_[_0x47a5('0x2c')](_0x1dac65[_0x47a5('0x2d')],_0x1dac65[_0x47a5('0x2a')]);_0x36ad34[_0x47a5('0x2e')]=_['intersection'](_0x1dac65['model'],qs[_0x47a5('0x2f')](_0x23cb77[_0x47a5('0x2a')]['fields']));_0x36ad34['attributes']=_0x36ad34[_0x47a5('0x2e')][_0x47a5('0x30')]?_0x36ad34['attributes']:_0x1dac65[_0x47a5('0x2d')];if(!_0x23cb77['query'][_0x47a5('0x31')](_0x47a5('0x32'))){_0x36ad34['limit']=qs['limit'](_0x23cb77[_0x47a5('0x2a')]['limit']);_0x36ad34[_0x47a5('0x18')]=qs[_0x47a5('0x18')](_0x23cb77[_0x47a5('0x2a')]['offset']);}_0x36ad34[_0x47a5('0x33')]=qs['sort'](_0x23cb77['query'][_0x47a5('0x34')]);_0x36ad34['where']=qs[_0x47a5('0x35')](_['pick'](_0x23cb77[_0x47a5('0x2a')],_0x1dac65[_0x47a5('0x35')]));if(_0x23cb77[_0x47a5('0x2a')][_0x47a5('0x36')]){_0x36ad34[_0x47a5('0x37')]=_[_0x47a5('0x38')](_0x36ad34[_0x47a5('0x37')],{'$or':_[_0x47a5('0x24')](_0x3ba0b7,function(_0x1a0d23){if(_0x1a0d23['type']!==_0x47a5('0x39')){var _0x10f136={};_0x10f136[_0x1a0d23['name']]={'$like':'%'+_0x23cb77[_0x47a5('0x2a')][_0x47a5('0x36')]+'%'};return _0x10f136;}})});}_0x36ad34=_[_0x47a5('0x38')]({},_0x36ad34,_0x23cb77['options']);var _0x101f70={'where':_0x36ad34[_0x47a5('0x37')]};return db['MailTransferReport'][_0x47a5('0x3a')](_0x101f70)[_0x47a5('0x1e')](function(_0x54ae35){_0x21f296['count']=_0x54ae35;if(_0x23cb77['query'][_0x47a5('0x3b')]){_0x36ad34['include']=[{'all':!![]}];}return db[_0x47a5('0x25')][_0x47a5('0x3c')](_0x36ad34);})[_0x47a5('0x1e')](function(_0x111f0d){_0x21f296[_0x47a5('0x3d')]=_0x111f0d;return _0x21f296;})[_0x47a5('0x1e')](respondWithFilteredResult(_0x378208,_0x36ad34))[_0x47a5('0x3e')](handleError(_0x378208,null));};exports[_0x47a5('0x3f')]=function(_0x3fa2a8,_0x36a24e){var _0x280500={'raw':!![],'where':{'id':_0x3fa2a8[_0x47a5('0x40')]['id']}},_0x1658e8={};_0x1658e8['model']=_[_0x47a5('0x2b')](db[_0x47a5('0x25')][_0x47a5('0x26')]);_0x1658e8[_0x47a5('0x2a')]=_['keys'](_0x3fa2a8[_0x47a5('0x2a')]);_0x1658e8['filters']=_['intersection'](_0x1658e8['model'],_0x1658e8['query']);_0x280500[_0x47a5('0x2e')]=_['intersection'](_0x1658e8[_0x47a5('0x2d')],qs[_0x47a5('0x2f')](_0x3fa2a8[_0x47a5('0x2a')]['fields']));_0x280500[_0x47a5('0x2e')]=_0x280500[_0x47a5('0x2e')]['length']?_0x280500['attributes']:_0x1658e8[_0x47a5('0x2d')];if(_0x3fa2a8['query'][_0x47a5('0x3b')]){_0x280500[_0x47a5('0x41')]=[{'all':!![]}];}_0x280500=_[_0x47a5('0x38')]({},_0x280500,_0x3fa2a8[_0x47a5('0x42')]);return db[_0x47a5('0x25')][_0x47a5('0x43')](_0x280500)[_0x47a5('0x1e')](handleEntityNotFound(_0x36a24e,null))[_0x47a5('0x1e')](respondWithResult(_0x36a24e,null))[_0x47a5('0x3e')](handleError(_0x36a24e,null));};exports[_0x47a5('0x44')]=function(_0x24ecb1,_0x3c3ebf){return db[_0x47a5('0x25')][_0x47a5('0x44')](_0x24ecb1[_0x47a5('0x45')],{})[_0x47a5('0x1e')](respondWithResult(_0x3c3ebf,0xc9))['catch'](handleError(_0x3c3ebf,null));};exports[_0x47a5('0x46')]=function(_0x23bb04,_0x49eab1){if(_0x23bb04['body']['id']){delete _0x23bb04[_0x47a5('0x45')]['id'];}return db['MailTransferReport'][_0x47a5('0x43')]({'where':{'id':_0x23bb04[_0x47a5('0x40')]['id']}})['then'](handleEntityNotFound(_0x49eab1,null))['then'](saveUpdates(_0x23bb04[_0x47a5('0x45')],null))['then'](respondWithResult(_0x49eab1,null))[_0x47a5('0x3e')](handleError(_0x49eab1,null));};exports[_0x47a5('0x1f')]=function(_0x3548bc,_0x3e12a7){return db[_0x47a5('0x25')][_0x47a5('0x43')]({'where':{'id':_0x3548bc[_0x47a5('0x40')]['id']}})['then'](handleEntityNotFound(_0x3e12a7,null))['then'](removeEntity(_0x3e12a7,null))[_0x47a5('0x3e')](handleError(_0x3e12a7,null));};exports[_0x47a5('0x47')]=function(_0x1163e3,_0x9ea93e){return db[_0x47a5('0x25')][_0x47a5('0x47')]()[_0x47a5('0x1e')](respondWithResult(_0x9ea93e,null))['catch'](handleError(_0x9ea93e,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 481aded..79eb301 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 _0x7164=['util','../../config/logger','api','moment','bluebird','request-promise','path','./mailTransferReport.attributes','exports','define','MailTransferReport','uniqueid','lodash'];(function(_0x2d2685,_0x5b7112){var _0x113020=function(_0x53e18b){while(--_0x53e18b){_0x2d2685['push'](_0x2d2685['shift']());}};_0x113020(++_0x5b7112);}(_0x7164,0xb5));var _0x4716=function(_0x42c341,_0x31d467){_0x42c341=_0x42c341-0x0;var _0x43621b=_0x7164[_0x42c341];return _0x43621b;};'use strict';var _=require(_0x4716('0x0'));var util=require(_0x4716('0x1'));var logger=require(_0x4716('0x2'))(_0x4716('0x3'));var moment=require(_0x4716('0x4'));var BPromise=require(_0x4716('0x5'));var rp=require(_0x4716('0x6'));var fs=require('fs');var path=require(_0x4716('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4716('0x8'));module[_0x4716('0x9')]=function(_0x56cb16,_0x2f7bf0){return _0x56cb16[_0x4716('0xa')](_0x4716('0xb'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0x4716('0xc'),'fields':[_0x4716('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3217=['MailTransferReport','report_mail_transfer','uniqueid','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x3217,0x17c));var _0x7321=function(_0x5c0099,_0x5d7a3d){_0x5c0099=_0x5c0099-0x0;var _0x55ab84=_0x3217[_0x5c0099];return _0x55ab84;};'use strict';var _=require(_0x7321('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7321('0x1'));var moment=require(_0x7321('0x2'));var BPromise=require(_0x7321('0x3'));var rp=require(_0x7321('0x4'));var fs=require('fs');var path=require(_0x7321('0x5'));var rimraf=require(_0x7321('0x6'));var config=require(_0x7321('0x7'));var attributes=require(_0x7321('0x8'));module[_0x7321('0x9')]=function(_0x323545,_0x346c92){return _0x323545['define'](_0x7321('0xa'),attributes,{'tableName':_0x7321('0xb'),'paranoid':![],'indexes':[{'name':_0x7321('0xc'),'fields':[_0x7321('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 50b1cb8..98cf048 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 _0x3dcf=['stringify','error','message','MailTransferReport,\x20%s,\x20%s','result','catch','lodash','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent'];(function(_0x50f42c,_0x184ebc){var _0x1eb7ff=function(_0xd560da){while(--_0xd560da){_0x50f42c['push'](_0x50f42c['shift']());}};_0x1eb7ff(++_0x184ebc);}(_0x3dcf,0x1ce));var _0xf3dc=function(_0x57fc17,_0x41df14){_0x57fc17=_0x57fc17-0x0;var _0x18dc70=_0x3dcf[_0x57fc17];return _0x18dc70;};'use strict';var _=require(_0xf3dc('0x0'));var util=require(_0xf3dc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf3dc('0x2'))['db'];var utils=require(_0xf3dc('0x3'));var logger=require(_0xf3dc('0x4'))(_0xf3dc('0x5'));var config=require(_0xf3dc('0x6'));var jayson=require(_0xf3dc('0x7'));var client=jayson[_0xf3dc('0x8')][_0xf3dc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1033e8,_0x361e22,_0x5786c1){return new BPromise(function(_0x38b43e,_0x1220f6){return client['request'](_0x1033e8,_0x5786c1)[_0xf3dc('0xa')](function(_0x3bd32b){logger[_0xf3dc('0xb')]('MailTransferReport,\x20%s,\x20%s',_0x361e22,_0xf3dc('0xc'));logger['debug']('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x361e22,_0xf3dc('0xc'),JSON[_0xf3dc('0xd')](_0x3bd32b));if(_0x3bd32b[_0xf3dc('0xe')]){if(_0x3bd32b[_0xf3dc('0xe')]['code']===0x1f4){logger[_0xf3dc('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x361e22,_0x3bd32b[_0xf3dc('0xe')][_0xf3dc('0xf')]);return _0x1220f6(_0x3bd32b[_0xf3dc('0xe')][_0xf3dc('0xf')]);}logger[_0xf3dc('0xe')](_0xf3dc('0x10'),_0x361e22,_0x3bd32b[_0xf3dc('0xe')]['message']);return _0x38b43e(_0x3bd32b[_0xf3dc('0xe')][_0xf3dc('0xf')]);}else{logger[_0xf3dc('0xb')](_0xf3dc('0x10'),_0x361e22,_0xf3dc('0xc'));_0x38b43e(_0x3bd32b[_0xf3dc('0x11')][_0xf3dc('0xf')]);}})[_0xf3dc('0x12')](function(_0x166a15){logger[_0xf3dc('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x361e22,_0x166a15);_0x1220f6(_0x166a15);});});} \ No newline at end of file +var _0xe4ee=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','lodash','util'];(function(_0x1788e8,_0x488ae9){var _0x697cf=function(_0x32cd04){while(--_0x32cd04){_0x1788e8['push'](_0x1788e8['shift']());}};_0x697cf(++_0x488ae9);}(_0xe4ee,0xb6));var _0xee4e=function(_0x410ed1,_0x57e525){_0x410ed1=_0x410ed1-0x0;var _0x2f526b=_0xe4ee[_0x410ed1];return _0x2f526b;};'use strict';var _=require(_0xee4e('0x0'));var util=require(_0xee4e('0x1'));var moment=require(_0xee4e('0x2'));var BPromise=require(_0xee4e('0x3'));var rs=require(_0xee4e('0x4'));var fs=require('fs');var Redis=require(_0xee4e('0x5'));var db=require(_0xee4e('0x6'))['db'];var utils=require(_0xee4e('0x7'));var logger=require(_0xee4e('0x8'))(_0xee4e('0x9'));var config=require(_0xee4e('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xee4e('0xb')][_0xee4e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5600df,_0x32ca88,_0x43f192){return new BPromise(function(_0xcf42e7,_0x2d4eb6){return client[_0xee4e('0xd')](_0x5600df,_0x43f192)[_0xee4e('0xe')](function(_0x4cff2e){logger[_0xee4e('0xf')](_0xee4e('0x10'),_0x32ca88,'request\x20sent');logger['debug']('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x32ca88,'request\x20sent',JSON[_0xee4e('0x11')](_0x4cff2e));if(_0x4cff2e[_0xee4e('0x12')]){if(_0x4cff2e[_0xee4e('0x12')][_0xee4e('0x13')]===0x1f4){logger[_0xee4e('0x12')](_0xee4e('0x10'),_0x32ca88,_0x4cff2e[_0xee4e('0x12')][_0xee4e('0x14')]);return _0x2d4eb6(_0x4cff2e[_0xee4e('0x12')][_0xee4e('0x14')]);}logger[_0xee4e('0x12')](_0xee4e('0x10'),_0x32ca88,_0x4cff2e[_0xee4e('0x12')][_0xee4e('0x14')]);return _0xcf42e7(_0x4cff2e[_0xee4e('0x12')][_0xee4e('0x14')]);}else{logger[_0xee4e('0xf')](_0xee4e('0x10'),_0x32ca88,_0xee4e('0x15'));_0xcf42e7(_0x4cff2e[_0xee4e('0x16')]['message']);}})['catch'](function(_0x1f7566){logger[_0xee4e('0x12')](_0xee4e('0x10'),_0x32ca88,_0x1f7566);_0x2d4eb6(_0x1f7566);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index f1f6a23..97de5ec 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 _0x6e30=['update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put'];(function(_0x496769,_0x8b8afd){var _0x5d12c3=function(_0x562337){while(--_0x562337){_0x496769['push'](_0x496769['shift']());}};_0x5d12c3(++_0x8b8afd);}(_0x6e30,0x90));var _0x06e3=function(_0x496738,_0x3f1a9f){_0x496738=_0x496738-0x0;var _0xee1381=_0x6e30[_0x496738];return _0xee1381;};'use strict';var multer=require(_0x06e3('0x0'));var util=require(_0x06e3('0x1'));var path=require(_0x06e3('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x06e3('0x3')]();var auth=require(_0x06e3('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x06e3('0x5'));var controller=require(_0x06e3('0x6'));router[_0x06e3('0x7')]('/',auth[_0x06e3('0x8')](),controller[_0x06e3('0x9')]);router['get'](_0x06e3('0xa'),auth['isAuthenticated'](),controller[_0x06e3('0xb')]);router['get'](_0x06e3('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x06e3('0xd')]('/',auth['isAuthenticated'](),controller[_0x06e3('0xe')]);router[_0x06e3('0xf')]('/:id',auth[_0x06e3('0x8')](),controller[_0x06e3('0x10')]);router[_0x06e3('0x11')](_0x06e3('0xc'),auth[_0x06e3('0x8')](),controller[_0x06e3('0x12')]);module[_0x06e3('0x13')]=router; \ No newline at end of file +var _0x3f1d=['get','index','isAuthenticated','describe','/:id','show','post','delete','destroy','multer','util','path','connect-timeout','express','Router','./memberReport.controller'];(function(_0x4badf6,_0x4100f1){var _0xd33657=function(_0x1377c7){while(--_0x1377c7){_0x4badf6['push'](_0x4badf6['shift']());}};_0xd33657(++_0x4100f1);}(_0x3f1d,0x189));var _0xd3f1=function(_0x3ff7d2,_0x4584d3){_0x3ff7d2=_0x3ff7d2-0x0;var _0xe3f7ec=_0x3f1d[_0x3ff7d2];return _0xe3f7ec;};'use strict';var multer=require(_0xd3f1('0x0'));var util=require(_0xd3f1('0x1'));var path=require(_0xd3f1('0x2'));var timeout=require(_0xd3f1('0x3'));var express=require(_0xd3f1('0x4'));var router=express[_0xd3f1('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd3f1('0x6'));router[_0xd3f1('0x7')]('/',auth['isAuthenticated'](),controller[_0xd3f1('0x8')]);router[_0xd3f1('0x7')]('/describe',auth[_0xd3f1('0x9')](),controller[_0xd3f1('0xa')]);router[_0xd3f1('0x7')](_0xd3f1('0xb'),auth['isAuthenticated'](),controller[_0xd3f1('0xc')]);router[_0xd3f1('0xd')]('/',auth[_0xd3f1('0x9')](),controller['create']);router['put'](_0xd3f1('0xb'),auth[_0xd3f1('0x9')](),controller['update']);router[_0xd3f1('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xd3f1('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 8ac9caa..08992fc 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 _0x709a=['seconds','exitAt','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','getDataValue','enterAt'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x709a,0x75));var _0xa709=function(_0x46c163,_0x5c5488){_0x46c163=_0x46c163-0x0;var _0x30e117=_0x709a[_0x46c163];return _0x30e117;};'use strict';var Sequelize=require(_0xa709('0x0'));var moment=require(_0xa709('0x1'));module[_0xa709('0x2')]={'channel':{'type':Sequelize[_0xa709('0x3')]},'membername':{'type':Sequelize[_0xa709('0x3')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xa709('0x3')],'defaultValue':_0xa709('0x4'),'comment':_0xa709('0x5')},'duration':{'type':Sequelize[_0xa709('0x6')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x106ef8){var _0x438d67=moment(_0x106ef8);var _0x306e06=moment(this[_0xa709('0x7')](_0xa709('0x8')));var _0x4343d1=_0x438d67['diff'](_0x306e06,_0xa709('0x9'));this['setDataValue'](_0xa709('0xa'),_0x106ef8);this[_0xa709('0xb')](_0xa709('0xc'),_0x4343d1||null);}},'data1':{'type':Sequelize[_0xa709('0x3')],'comment':_0xa709('0xd')},'data2':{'type':Sequelize['STRING'],'comment':_0xa709('0xe')},'data3':{'type':Sequelize[_0xa709('0x3')],'comment':_0xa709('0xf')},'data4':{'type':Sequelize[_0xa709('0x3')],'comment':_0xa709('0x10')},'data5':{'type':Sequelize[_0xa709('0x3')],'comment':_0xa709('0x11')},'role':{'type':Sequelize[_0xa709('0x3')]},'internal':{'type':Sequelize[_0xa709('0x6')]},'uniqueid':{'type':Sequelize[_0xa709('0x3')]}}; \ No newline at end of file +var _0xeffe=['exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[queue]','moment','exports','STRING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue'];(function(_0x5d78f0,_0x3784f9){var _0x4d1012=function(_0x23d0ba){while(--_0x23d0ba){_0x5d78f0['push'](_0x5d78f0['shift']());}};_0x4d1012(++_0x3784f9);}(_0xeffe,0x7d));var _0xeeff=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xeffe[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xeeff('0x0'));module[_0xeeff('0x1')]={'channel':{'type':Sequelize[_0xeeff('0x2')]},'membername':{'type':Sequelize[_0xeeff('0x2')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE','comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0xeeff('0x3')]},'enterAt':{'type':Sequelize[_0xeeff('0x4')]},'exitAt':{'type':Sequelize[_0xeeff('0x4')],'set':function(_0x21e6dd){var _0x215bf4=moment(_0x21e6dd);var _0x4a0534=moment(this[_0xeeff('0x5')](_0xeeff('0x6')));var _0x34ca6a=_0x215bf4[_0xeeff('0x7')](_0x4a0534,_0xeeff('0x8'));this[_0xeeff('0x9')](_0xeeff('0xa'),_0x21e6dd);this[_0xeeff('0x9')](_0xeeff('0xb'),_0x34ca6a||null);}},'data1':{'type':Sequelize[_0xeeff('0x2')],'comment':_0xeeff('0xc')},'data2':{'type':Sequelize['STRING'],'comment':_0xeeff('0xd')},'data3':{'type':Sequelize['STRING'],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0xeeff('0x2')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0xeeff('0x2')],'comment':_0xeeff('0xe')},'role':{'type':Sequelize[_0xeeff('0x2')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 426def9..d494222 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 _0xb1d7=['filters','intersection','query','attributes','length','nolimit','limit','sort','where','pick','merge','VIRTUAL','options','MemberReport','includeAll','include','findAll','rows','catch','params','fields','find','create','body','describe','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/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','reject','update','then','destroy','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys'];(function(_0x1d78bc,_0x4a6cca){var _0x5eb763=function(_0x48475d){while(--_0x48475d){_0x1d78bc['push'](_0x1d78bc['shift']());}};_0x5eb763(++_0x4a6cca);}(_0xb1d7,0x66));var _0x7b1d=function(_0x4a0411,_0x5a91d4){_0x4a0411=_0x4a0411-0x0;var _0x248d1f=_0xb1d7[_0x4a0411];return _0x248d1f;};'use strict';var pdf=require(_0x7b1d('0x0'));var emlformat=require(_0x7b1d('0x1'));var rimraf=require(_0x7b1d('0x2'));var zipdir=require(_0x7b1d('0x3'));var jsonpatch=require(_0x7b1d('0x4'));var rp=require('request-promise');var moment=require(_0x7b1d('0x5'));var BPromise=require(_0x7b1d('0x6'));var Mustache=require(_0x7b1d('0x7'));var util=require(_0x7b1d('0x8'));var path=require(_0x7b1d('0x9'));var sox=require(_0x7b1d('0xa'));var csv=require(_0x7b1d('0xb'));var ejs=require(_0x7b1d('0xc'));var fs=require('fs');var _=require(_0x7b1d('0xd'));var squel=require(_0x7b1d('0xe'));var crypto=require(_0x7b1d('0xf'));var jsforce=require(_0x7b1d('0x10'));var deskjs=require(_0x7b1d('0x11'));var toCsv=require(_0x7b1d('0xb'));var querystring=require(_0x7b1d('0x12'));var Papa=require(_0x7b1d('0x13'));var Redis=require(_0x7b1d('0x14'));var authService=require(_0x7b1d('0x15'));var qs=require(_0x7b1d('0x16'));var as=require(_0x7b1d('0x17'));var hardwareService=require(_0x7b1d('0x18'));var logger=require(_0x7b1d('0x19'))(_0x7b1d('0x1a'));var utils=require(_0x7b1d('0x1b'));var config=require(_0x7b1d('0x1c'));var db=require(_0x7b1d('0x1d'))['db'];function respondWithStatusCode(_0x8d7013,_0x13a3ca){_0x13a3ca=_0x13a3ca||0xcc;return function(_0x37e3c5){if(_0x37e3c5){return _0x8d7013[_0x7b1d('0x1e')](_0x13a3ca);}return _0x8d7013[_0x7b1d('0x1f')](_0x13a3ca)[_0x7b1d('0x20')]();};}function respondWithResult(_0xc0cf53,_0xe74482){_0xe74482=_0xe74482||0xc8;return function(_0x1f3734){if(_0x1f3734){return _0xc0cf53[_0x7b1d('0x1f')](_0xe74482)[_0x7b1d('0x21')](_0x1f3734);}};}function respondWithFilteredResult(_0x1b19df,_0x222fb5){return function(_0x5cb695){if(_0x5cb695){var _0x27930e=_0x5cb695[_0x7b1d('0x22')],_0x339336=_0x222fb5[_0x7b1d('0x23')],_0x12d491=_0x222fb5['offset']+_0x222fb5['limit'],_0x524d72;if(_0x12d491>=_0x27930e){_0x12d491=_0x27930e;_0x524d72=0xc8;}else{_0x524d72=0xce;}_0x1b19df['status'](_0x524d72);return _0x1b19df[_0x7b1d('0x24')]('Content-Range',_0x339336+'-'+_0x12d491+'/'+_0x27930e)['json'](_0x5cb695);}return null;};}function patchUpdates(_0x31224b){return function(_0x5bfe7d){try{jsonpatch[_0x7b1d('0x25')](_0x5bfe7d,_0x31224b,!![]);}catch(_0x281d58){return BPromise[_0x7b1d('0x26')](_0x281d58);}return _0x5bfe7d['save']();};}function saveUpdates(_0xc99f20,_0x552e08){return function(_0x4a16cd){if(_0x4a16cd){return _0x4a16cd[_0x7b1d('0x27')](_0xc99f20)[_0x7b1d('0x28')](function(_0xc0adc){return _0xc0adc;});}return null;};}function removeEntity(_0x2b99bd,_0x55cfb0){return function(_0x53ee75){if(_0x53ee75){return _0x53ee75[_0x7b1d('0x29')]()[_0x7b1d('0x28')](function(){_0x2b99bd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4501c3,_0x1c5be5){return function(_0xc84c6){if(!_0xc84c6){_0x4501c3[_0x7b1d('0x1e')](0x194);}return _0xc84c6;};}function handleError(_0xe5aec4,_0x28d2dc){_0x28d2dc=_0x28d2dc||0x1f4;return function(_0xd3fefe){logger['error'](_0xd3fefe[_0x7b1d('0x2a')]);if(_0xd3fefe[_0x7b1d('0x2b')]){delete _0xd3fefe[_0x7b1d('0x2b')];}_0xe5aec4[_0x7b1d('0x1f')](_0x28d2dc)[_0x7b1d('0x2c')](_0xd3fefe);};}exports['index']=function(_0x5b224e,_0x49cf09){var _0x369eea={},_0x3b3800={},_0x31deec={'count':0x0,'rows':[]};var _0x13f485=_[_0x7b1d('0x2d')](db['MemberReport'][_0x7b1d('0x2e')],function(_0x202193){return{'name':_0x202193[_0x7b1d('0x2f')],'type':_0x202193[_0x7b1d('0x30')][_0x7b1d('0x31')]};});_0x3b3800[_0x7b1d('0x32')]=_[_0x7b1d('0x2d')](_0x13f485,_0x7b1d('0x2b'));_0x3b3800['query']=_[_0x7b1d('0x33')](_0x5b224e['query']);_0x3b3800[_0x7b1d('0x34')]=_[_0x7b1d('0x35')](_0x3b3800[_0x7b1d('0x32')],_0x3b3800[_0x7b1d('0x36')]);_0x369eea[_0x7b1d('0x37')]=_[_0x7b1d('0x35')](_0x3b3800[_0x7b1d('0x32')],qs['fields'](_0x5b224e[_0x7b1d('0x36')]['fields']));_0x369eea[_0x7b1d('0x37')]=_0x369eea[_0x7b1d('0x37')][_0x7b1d('0x38')]?_0x369eea[_0x7b1d('0x37')]:_0x3b3800[_0x7b1d('0x32')];if(!_0x5b224e[_0x7b1d('0x36')]['hasOwnProperty'](_0x7b1d('0x39'))){_0x369eea[_0x7b1d('0x3a')]=qs[_0x7b1d('0x3a')](_0x5b224e[_0x7b1d('0x36')][_0x7b1d('0x3a')]);_0x369eea[_0x7b1d('0x23')]=qs[_0x7b1d('0x23')](_0x5b224e[_0x7b1d('0x36')][_0x7b1d('0x23')]);}_0x369eea['order']=qs[_0x7b1d('0x3b')](_0x5b224e['query'][_0x7b1d('0x3b')]);_0x369eea[_0x7b1d('0x3c')]=qs[_0x7b1d('0x34')](_[_0x7b1d('0x3d')](_0x5b224e[_0x7b1d('0x36')],_0x3b3800[_0x7b1d('0x34')]));if(_0x5b224e[_0x7b1d('0x36')]['filter']){_0x369eea[_0x7b1d('0x3c')]=_[_0x7b1d('0x3e')](_0x369eea['where'],{'$or':_[_0x7b1d('0x2d')](_0x13f485,function(_0x44a474){if(_0x44a474['type']!==_0x7b1d('0x3f')){var _0x4d6ec8={};_0x4d6ec8[_0x44a474[_0x7b1d('0x2b')]]={'$like':'%'+_0x5b224e['query']['filter']+'%'};return _0x4d6ec8;}})});}_0x369eea=_[_0x7b1d('0x3e')]({},_0x369eea,_0x5b224e[_0x7b1d('0x40')]);var _0x11a19f={'where':_0x369eea['where']};return db[_0x7b1d('0x41')][_0x7b1d('0x22')](_0x11a19f)[_0x7b1d('0x28')](function(_0x5d805c){_0x31deec[_0x7b1d('0x22')]=_0x5d805c;if(_0x5b224e['query'][_0x7b1d('0x42')]){_0x369eea[_0x7b1d('0x43')]=[{'all':!![]}];}return db['MemberReport'][_0x7b1d('0x44')](_0x369eea);})['then'](function(_0x16567c){_0x31deec[_0x7b1d('0x45')]=_0x16567c;return _0x31deec;})[_0x7b1d('0x28')](respondWithFilteredResult(_0x49cf09,_0x369eea))[_0x7b1d('0x46')](handleError(_0x49cf09,null));};exports['show']=function(_0x5917f0,_0xe2ce07){var _0x38a66d={'raw':!![],'where':{'id':_0x5917f0[_0x7b1d('0x47')]['id']}},_0x361af1={};_0x361af1[_0x7b1d('0x32')]=_[_0x7b1d('0x33')](db[_0x7b1d('0x41')][_0x7b1d('0x2e')]);_0x361af1['query']=_[_0x7b1d('0x33')](_0x5917f0['query']);_0x361af1[_0x7b1d('0x34')]=_[_0x7b1d('0x35')](_0x361af1[_0x7b1d('0x32')],_0x361af1[_0x7b1d('0x36')]);_0x38a66d['attributes']=_[_0x7b1d('0x35')](_0x361af1[_0x7b1d('0x32')],qs[_0x7b1d('0x48')](_0x5917f0[_0x7b1d('0x36')][_0x7b1d('0x48')]));_0x38a66d[_0x7b1d('0x37')]=_0x38a66d[_0x7b1d('0x37')][_0x7b1d('0x38')]?_0x38a66d[_0x7b1d('0x37')]:_0x361af1['model'];if(_0x5917f0[_0x7b1d('0x36')][_0x7b1d('0x42')]){_0x38a66d[_0x7b1d('0x43')]=[{'all':!![]}];}_0x38a66d=_[_0x7b1d('0x3e')]({},_0x38a66d,_0x5917f0[_0x7b1d('0x40')]);return db[_0x7b1d('0x41')][_0x7b1d('0x49')](_0x38a66d)[_0x7b1d('0x28')](handleEntityNotFound(_0xe2ce07,null))[_0x7b1d('0x28')](respondWithResult(_0xe2ce07,null))[_0x7b1d('0x46')](handleError(_0xe2ce07,null));};exports['create']=function(_0x152d0f,_0x4c545f){return db[_0x7b1d('0x41')][_0x7b1d('0x4a')](_0x152d0f['body'],{})[_0x7b1d('0x28')](respondWithResult(_0x4c545f,0xc9))[_0x7b1d('0x46')](handleError(_0x4c545f,null));};exports[_0x7b1d('0x27')]=function(_0x353c11,_0x3e0d79){if(_0x353c11[_0x7b1d('0x4b')]['id']){delete _0x353c11[_0x7b1d('0x4b')]['id'];}return db[_0x7b1d('0x41')][_0x7b1d('0x49')]({'where':{'id':_0x353c11['params']['id']}})[_0x7b1d('0x28')](handleEntityNotFound(_0x3e0d79,null))[_0x7b1d('0x28')](saveUpdates(_0x353c11[_0x7b1d('0x4b')],null))[_0x7b1d('0x28')](respondWithResult(_0x3e0d79,null))[_0x7b1d('0x46')](handleError(_0x3e0d79,null));};exports[_0x7b1d('0x29')]=function(_0x56ec71,_0x400522){return db[_0x7b1d('0x41')]['find']({'where':{'id':_0x56ec71[_0x7b1d('0x47')]['id']}})['then'](handleEntityNotFound(_0x400522,null))[_0x7b1d('0x28')](removeEntity(_0x400522,null))[_0x7b1d('0x46')](handleError(_0x400522,null));};exports[_0x7b1d('0x4c')]=function(_0x4f1370,_0x2774eb){return db[_0x7b1d('0x41')][_0x7b1d('0x4c')]()[_0x7b1d('0x28')](respondWithResult(_0x2774eb,null))['catch'](handleError(_0x2774eb,null));}; \ No newline at end of file +var _0x7de2=['filter','merge','type','VIRTUAL','options','count','includeAll','findAll','rows','catch','params','find','create','body','describe','html-pdf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','end','offset','limit','status','set','Content-Range','json','apply','save','update','destroy','then','sendStatus','error','stack','name','send','index','MemberReport','rawAttributes','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters'];(function(_0x3b0675,_0x17502a){var _0x11b775=function(_0x30e206){while(--_0x30e206){_0x3b0675['push'](_0x3b0675['shift']());}};_0x11b775(++_0x17502a);}(_0x7de2,0x1bf));var _0x27de=function(_0x135f97,_0xc5bfab){_0x135f97=_0x135f97-0x0;var _0x1b8dd1=_0x7de2[_0x135f97];return _0x1b8dd1;};'use strict';var pdf=require(_0x27de('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x27de('0x1'));var rp=require(_0x27de('0x2'));var moment=require(_0x27de('0x3'));var BPromise=require(_0x27de('0x4'));var Mustache=require(_0x27de('0x5'));var util=require(_0x27de('0x6'));var path=require('path');var sox=require(_0x27de('0x7'));var csv=require('to-csv');var ejs=require(_0x27de('0x8'));var fs=require('fs');var _=require(_0x27de('0x9'));var squel=require(_0x27de('0xa'));var crypto=require(_0x27de('0xb'));var jsforce=require(_0x27de('0xc'));var deskjs=require(_0x27de('0xd'));var toCsv=require('to-csv');var querystring=require(_0x27de('0xe'));var Papa=require('papaparse');var Redis=require(_0x27de('0xf'));var authService=require(_0x27de('0x10'));var qs=require(_0x27de('0x11'));var as=require(_0x27de('0x12'));var hardwareService=require(_0x27de('0x13'));var logger=require(_0x27de('0x14'))(_0x27de('0x15'));var utils=require(_0x27de('0x16'));var config=require('../../config/environment');var db=require(_0x27de('0x17'))['db'];function respondWithStatusCode(_0x15c27a,_0x134129){_0x134129=_0x134129||0xcc;return function(_0x2f7913){if(_0x2f7913){return _0x15c27a['sendStatus'](_0x134129);}return _0x15c27a['status'](_0x134129)[_0x27de('0x18')]();};}function respondWithResult(_0xdb4bcd,_0x5dcb80){_0x5dcb80=_0x5dcb80||0xc8;return function(_0x4d7600){if(_0x4d7600){return _0xdb4bcd['status'](_0x5dcb80)['json'](_0x4d7600);}};}function respondWithFilteredResult(_0x5495b4,_0x1583f3){return function(_0x5e9b62){if(_0x5e9b62){var _0xb9b276=_0x5e9b62['count'],_0x50d217=_0x1583f3['offset'],_0x42847d=_0x1583f3[_0x27de('0x19')]+_0x1583f3[_0x27de('0x1a')],_0x5df352;if(_0x42847d>=_0xb9b276){_0x42847d=_0xb9b276;_0x5df352=0xc8;}else{_0x5df352=0xce;}_0x5495b4[_0x27de('0x1b')](_0x5df352);return _0x5495b4[_0x27de('0x1c')](_0x27de('0x1d'),_0x50d217+'-'+_0x42847d+'/'+_0xb9b276)[_0x27de('0x1e')](_0x5e9b62);}return null;};}function patchUpdates(_0x406022){return function(_0x530952){try{jsonpatch[_0x27de('0x1f')](_0x530952,_0x406022,!![]);}catch(_0x1c6da8){return BPromise['reject'](_0x1c6da8);}return _0x530952[_0x27de('0x20')]();};}function saveUpdates(_0x307c65,_0x3c87cd){return function(_0xb075c1){if(_0xb075c1){return _0xb075c1[_0x27de('0x21')](_0x307c65)['then'](function(_0x439d86){return _0x439d86;});}return null;};}function removeEntity(_0x5788e1,_0x1c46d4){return function(_0x1b71c3){if(_0x1b71c3){return _0x1b71c3[_0x27de('0x22')]()[_0x27de('0x23')](function(){_0x5788e1[_0x27de('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x358748,_0x4858d7){return function(_0x3935c4){if(!_0x3935c4){_0x358748[_0x27de('0x24')](0x194);}return _0x3935c4;};}function handleError(_0x16b9a8,_0x44026b){_0x44026b=_0x44026b||0x1f4;return function(_0x416a17){logger[_0x27de('0x25')](_0x416a17[_0x27de('0x26')]);if(_0x416a17[_0x27de('0x27')]){delete _0x416a17['name'];}_0x16b9a8['status'](_0x44026b)[_0x27de('0x28')](_0x416a17);};}exports[_0x27de('0x29')]=function(_0xce2880,_0x40a2f8){var _0x3e20bb={},_0xa4a11e={},_0x4f716d={'count':0x0,'rows':[]};var _0x377372=_['map'](db[_0x27de('0x2a')][_0x27de('0x2b')],function(_0xcd46d){return{'name':_0xcd46d['fieldName'],'type':_0xcd46d['type']['key']};});_0xa4a11e[_0x27de('0x2c')]=_[_0x27de('0x2d')](_0x377372,_0x27de('0x27'));_0xa4a11e[_0x27de('0x2e')]=_[_0x27de('0x2f')](_0xce2880[_0x27de('0x2e')]);_0xa4a11e['filters']=_[_0x27de('0x30')](_0xa4a11e['model'],_0xa4a11e[_0x27de('0x2e')]);_0x3e20bb['attributes']=_['intersection'](_0xa4a11e[_0x27de('0x2c')],qs[_0x27de('0x31')](_0xce2880[_0x27de('0x2e')]['fields']));_0x3e20bb[_0x27de('0x32')]=_0x3e20bb[_0x27de('0x32')][_0x27de('0x33')]?_0x3e20bb[_0x27de('0x32')]:_0xa4a11e[_0x27de('0x2c')];if(!_0xce2880[_0x27de('0x2e')][_0x27de('0x34')](_0x27de('0x35'))){_0x3e20bb['limit']=qs[_0x27de('0x1a')](_0xce2880[_0x27de('0x2e')][_0x27de('0x1a')]);_0x3e20bb[_0x27de('0x19')]=qs[_0x27de('0x19')](_0xce2880['query'][_0x27de('0x19')]);}_0x3e20bb['order']=qs[_0x27de('0x36')](_0xce2880['query'][_0x27de('0x36')]);_0x3e20bb[_0x27de('0x37')]=qs[_0x27de('0x38')](_['pick'](_0xce2880[_0x27de('0x2e')],_0xa4a11e[_0x27de('0x38')]));if(_0xce2880[_0x27de('0x2e')][_0x27de('0x39')]){_0x3e20bb[_0x27de('0x37')]=_[_0x27de('0x3a')](_0x3e20bb[_0x27de('0x37')],{'$or':_[_0x27de('0x2d')](_0x377372,function(_0x450e19){if(_0x450e19[_0x27de('0x3b')]!==_0x27de('0x3c')){var _0x25d19a={};_0x25d19a[_0x450e19['name']]={'$like':'%'+_0xce2880[_0x27de('0x2e')][_0x27de('0x39')]+'%'};return _0x25d19a;}})});}_0x3e20bb=_[_0x27de('0x3a')]({},_0x3e20bb,_0xce2880[_0x27de('0x3d')]);var _0x3cb302={'where':_0x3e20bb[_0x27de('0x37')]};return db['MemberReport'][_0x27de('0x3e')](_0x3cb302)[_0x27de('0x23')](function(_0x564d46){_0x4f716d[_0x27de('0x3e')]=_0x564d46;if(_0xce2880[_0x27de('0x2e')][_0x27de('0x3f')]){_0x3e20bb['include']=[{'all':!![]}];}return db['MemberReport'][_0x27de('0x40')](_0x3e20bb);})[_0x27de('0x23')](function(_0x44efbb){_0x4f716d[_0x27de('0x41')]=_0x44efbb;return _0x4f716d;})[_0x27de('0x23')](respondWithFilteredResult(_0x40a2f8,_0x3e20bb))[_0x27de('0x42')](handleError(_0x40a2f8,null));};exports['show']=function(_0xd3390,_0x6009a2){var _0x5476bd={'raw':!![],'where':{'id':_0xd3390[_0x27de('0x43')]['id']}},_0x51fb2f={};_0x51fb2f['model']=_[_0x27de('0x2f')](db[_0x27de('0x2a')][_0x27de('0x2b')]);_0x51fb2f[_0x27de('0x2e')]=_[_0x27de('0x2f')](_0xd3390[_0x27de('0x2e')]);_0x51fb2f[_0x27de('0x38')]=_['intersection'](_0x51fb2f[_0x27de('0x2c')],_0x51fb2f['query']);_0x5476bd[_0x27de('0x32')]=_['intersection'](_0x51fb2f[_0x27de('0x2c')],qs[_0x27de('0x31')](_0xd3390[_0x27de('0x2e')]['fields']));_0x5476bd['attributes']=_0x5476bd[_0x27de('0x32')][_0x27de('0x33')]?_0x5476bd[_0x27de('0x32')]:_0x51fb2f[_0x27de('0x2c')];if(_0xd3390[_0x27de('0x2e')][_0x27de('0x3f')]){_0x5476bd['include']=[{'all':!![]}];}_0x5476bd=_['merge']({},_0x5476bd,_0xd3390[_0x27de('0x3d')]);return db[_0x27de('0x2a')][_0x27de('0x44')](_0x5476bd)[_0x27de('0x23')](handleEntityNotFound(_0x6009a2,null))[_0x27de('0x23')](respondWithResult(_0x6009a2,null))[_0x27de('0x42')](handleError(_0x6009a2,null));};exports[_0x27de('0x45')]=function(_0x585dad,_0x45abde){return db['MemberReport'][_0x27de('0x45')](_0x585dad[_0x27de('0x46')],{})['then'](respondWithResult(_0x45abde,0xc9))[_0x27de('0x42')](handleError(_0x45abde,null));};exports[_0x27de('0x21')]=function(_0x3f50dd,_0x295435){if(_0x3f50dd['body']['id']){delete _0x3f50dd[_0x27de('0x46')]['id'];}return db[_0x27de('0x2a')][_0x27de('0x44')]({'where':{'id':_0x3f50dd[_0x27de('0x43')]['id']}})[_0x27de('0x23')](handleEntityNotFound(_0x295435,null))[_0x27de('0x23')](saveUpdates(_0x3f50dd[_0x27de('0x46')],null))[_0x27de('0x23')](respondWithResult(_0x295435,null))[_0x27de('0x42')](handleError(_0x295435,null));};exports['destroy']=function(_0x58e2b2,_0x177699){return db['MemberReport'][_0x27de('0x44')]({'where':{'id':_0x58e2b2[_0x27de('0x43')]['id']}})[_0x27de('0x23')](handleEntityNotFound(_0x177699,null))[_0x27de('0x23')](removeEntity(_0x177699,null))['catch'](handleError(_0x177699,null));};exports['describe']=function(_0x10e4df,_0x2b3abf){return db[_0x27de('0x2a')][_0x27de('0x47')]()[_0x27de('0x23')](respondWithResult(_0x2b3abf,null))['catch'](handleError(_0x2b3abf,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 54b7e3c..99fb0db 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 _0x5aee=['util','api','request-promise','rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member','interface','lodash'];(function(_0x2c6fb9,_0x45ed8e){var _0x42bcc4=function(_0x4b3cd6){while(--_0x4b3cd6){_0x2c6fb9['push'](_0x2c6fb9['shift']());}};_0x42bcc4(++_0x45ed8e);}(_0x5aee,0x143));var _0xe5ae=function(_0x2c989b,_0x340ec7){_0x2c989b=_0x2c989b-0x0;var _0x44054f=_0x5aee[_0x2c989b];return _0x44054f;};'use strict';var _=require(_0xe5ae('0x0'));var util=require(_0xe5ae('0x1'));var logger=require('../../config/logger')(_0xe5ae('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe5ae('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe5ae('0x4'));var config=require(_0xe5ae('0x5'));var attributes=require(_0xe5ae('0x6'));module[_0xe5ae('0x7')]=function(_0x1625da,_0x894ff5){return _0x1625da[_0xe5ae('0x8')](_0xe5ae('0x9'),attributes,{'tableName':_0xe5ae('0xa'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':['membername',_0xe5ae('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcff2=['path','rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member','membername_interface','membername','lodash','util','api','moment','bluebird'];(function(_0x20e439,_0x1c2abd){var _0xc2dac9=function(_0x1e322d){while(--_0x1e322d){_0x20e439['push'](_0x20e439['shift']());}};_0xc2dac9(++_0x1c2abd);}(_0xcff2,0xa0));var _0x2cff=function(_0x30b0d8,_0x57470c){_0x30b0d8=_0x30b0d8-0x0;var _0x459c09=_0xcff2[_0x30b0d8];return _0x459c09;};'use strict';var _=require(_0x2cff('0x0'));var util=require(_0x2cff('0x1'));var logger=require('../../config/logger')(_0x2cff('0x2'));var moment=require(_0x2cff('0x3'));var BPromise=require(_0x2cff('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2cff('0x5'));var rimraf=require(_0x2cff('0x6'));var config=require(_0x2cff('0x7'));var attributes=require(_0x2cff('0x8'));module[_0x2cff('0x9')]=function(_0x440ab8,_0x224159){return _0x440ab8[_0x2cff('0xa')](_0x2cff('0xb'),attributes,{'tableName':_0x2cff('0xc'),'paranoid':![],'indexes':[{'name':_0x2cff('0xd'),'fields':[_0x2cff('0xe'),'interface']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index c7b88c2..758dfd9 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 _0x1c9c=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','MemberReport','findAll','options','where','attributes','limit','include','map','model','then','GetMemberReport','CreateMemberReport','create','body','UpdateMemberReport'];(function(_0x4d79d9,_0x3e0f22){var _0x51bbc4=function(_0x5e6e91){while(--_0x5e6e91){_0x4d79d9['push'](_0x4d79d9['shift']());}};_0x51bbc4(++_0x3e0f22);}(_0x1c9c,0x172));var _0xc1c9=function(_0x2ed3a2,_0x5cc62a){_0x2ed3a2=_0x2ed3a2-0x0;var _0xf11bbc=_0x1c9c[_0x2ed3a2];return _0xf11bbc;};'use strict';var _=require(_0xc1c9('0x0'));var util=require(_0xc1c9('0x1'));var moment=require(_0xc1c9('0x2'));var BPromise=require(_0xc1c9('0x3'));var rs=require(_0xc1c9('0x4'));var fs=require('fs');var Redis=require(_0xc1c9('0x5'));var db=require(_0xc1c9('0x6'))['db'];var utils=require(_0xc1c9('0x7'));var logger=require(_0xc1c9('0x8'))(_0xc1c9('0x9'));var config=require(_0xc1c9('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xc1c9('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4de1cf,_0x22f416,_0x51e279){return new BPromise(function(_0x5cf08f,_0x1aaf46){return client[_0xc1c9('0xc')](_0x4de1cf,_0x51e279)['then'](function(_0x376ffa){logger[_0xc1c9('0xd')](_0xc1c9('0xe'),_0x22f416,_0xc1c9('0xf'));logger[_0xc1c9('0x10')](_0xc1c9('0x11'),_0x22f416,_0xc1c9('0xf'),JSON[_0xc1c9('0x12')](_0x376ffa));if(_0x376ffa[_0xc1c9('0x13')]){if(_0x376ffa[_0xc1c9('0x13')]['code']===0x1f4){logger[_0xc1c9('0x13')](_0xc1c9('0xe'),_0x22f416,_0x376ffa[_0xc1c9('0x13')][_0xc1c9('0x14')]);return _0x1aaf46(_0x376ffa['error'][_0xc1c9('0x14')]);}logger['error'](_0xc1c9('0xe'),_0x22f416,_0x376ffa[_0xc1c9('0x13')][_0xc1c9('0x14')]);return _0x5cf08f(_0x376ffa[_0xc1c9('0x13')][_0xc1c9('0x14')]);}else{logger['info'](_0xc1c9('0xe'),_0x22f416,_0xc1c9('0xf'));_0x5cf08f(_0x376ffa['result'][_0xc1c9('0x14')]);}})[_0xc1c9('0x15')](function(_0x24a034){logger[_0xc1c9('0x13')](_0xc1c9('0xe'),_0x22f416,_0x24a034);_0x1aaf46(_0x24a034);});});}exports['GetMemberReport']=function(_0x203675){var _0x59eebe=this;return new Promise(function(_0x511a0a,_0x5e0693){return db[_0xc1c9('0x16')][_0xc1c9('0x17')]({'raw':_0x203675[_0xc1c9('0x18')]?_0x203675[_0xc1c9('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x203675[_0xc1c9('0x18')]?_0x203675[_0xc1c9('0x18')][_0xc1c9('0x19')]||null:null,'attributes':_0x203675[_0xc1c9('0x18')]?_0x203675[_0xc1c9('0x18')][_0xc1c9('0x1a')]||null:null,'limit':_0x203675[_0xc1c9('0x18')]?_0x203675[_0xc1c9('0x18')][_0xc1c9('0x1b')]||null:null,'include':_0x203675[_0xc1c9('0x18')]?_0x203675[_0xc1c9('0x18')][_0xc1c9('0x1c')]?_[_0xc1c9('0x1d')](_0x203675[_0xc1c9('0x18')]['include'],function(_0x5a2be3){return{'model':db[_0x5a2be3[_0xc1c9('0x1e')]],'as':_0x5a2be3['as'],'attributes':_0x5a2be3[_0xc1c9('0x1a')],'include':_0x5a2be3[_0xc1c9('0x1c')]?_[_0xc1c9('0x1d')](_0x5a2be3[_0xc1c9('0x1c')],function(_0x108377){return{'model':db[_0x108377[_0xc1c9('0x1e')]],'as':_0x108377['as'],'attributes':_0x108377[_0xc1c9('0x1a')],'include':_0x108377[_0xc1c9('0x1c')]?_[_0xc1c9('0x1d')](_0x108377[_0xc1c9('0x1c')],function(_0x58c913){return{'model':db[_0x58c913[_0xc1c9('0x1e')]],'as':_0x58c913['as'],'attributes':_0x58c913[_0xc1c9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xc1c9('0x1f')](function(_0x30a3ac){logger['info']('GetMemberReport',_0x203675);logger['debug'](_0xc1c9('0x20'),_0x203675,JSON[_0xc1c9('0x12')](_0x30a3ac));_0x511a0a(_0x30a3ac);})[_0xc1c9('0x15')](function(_0x5bfed6){logger[_0xc1c9('0x13')]('GetMemberReport',_0x5bfed6[_0xc1c9('0x14')],_0x203675);_0x5e0693(_0x59eebe[_0xc1c9('0x13')](0x1f4,_0x5bfed6['message']));});});};exports[_0xc1c9('0x21')]=function(_0x4c6d11){var _0x2fecb1=this;return new Promise(function(_0x5482a7,_0x1949f6){return db['MemberReport'][_0xc1c9('0x22')](_0x4c6d11[_0xc1c9('0x23')],{'raw':_0x4c6d11[_0xc1c9('0x18')]?_0x4c6d11[_0xc1c9('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xc1c9('0x1f')](function(_0x11aa57){logger[_0xc1c9('0xd')](_0xc1c9('0x21'),_0x4c6d11);logger[_0xc1c9('0x10')](_0xc1c9('0x21'),_0x4c6d11,JSON[_0xc1c9('0x12')](_0x11aa57));_0x5482a7(_0x11aa57);})[_0xc1c9('0x15')](function(_0x3513a4){logger[_0xc1c9('0x13')](_0xc1c9('0x21'),_0x3513a4['message'],_0x4c6d11);_0x1949f6(_0x2fecb1[_0xc1c9('0x13')](0x1f4,_0x3513a4[_0xc1c9('0x14')]));});});};exports[_0xc1c9('0x24')]=function(_0x40a939){var _0x502e92=this;return new Promise(function(_0x2acecc,_0x299d47){return db[_0xc1c9('0x16')]['update'](_0x40a939[_0xc1c9('0x23')],{'raw':_0x40a939[_0xc1c9('0x18')]?_0x40a939['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40a939[_0xc1c9('0x18')]?_0x40a939[_0xc1c9('0x18')][_0xc1c9('0x19')]||null:null,'attributes':_0x40a939[_0xc1c9('0x18')]?_0x40a939[_0xc1c9('0x18')][_0xc1c9('0x1a')]||null:null,'limit':_0x40a939['options']?_0x40a939['options'][_0xc1c9('0x1b')]||null:null})['then'](function(_0x14a32e){logger[_0xc1c9('0xd')](_0xc1c9('0x24'),_0x40a939);logger['debug'](_0xc1c9('0x24'),_0x40a939,JSON[_0xc1c9('0x12')](_0x14a32e));_0x2acecc(_0x14a32e);})[_0xc1c9('0x15')](function(_0x2c4e8b){logger[_0xc1c9('0x13')](_0xc1c9('0x24'),_0x2c4e8b['message'],_0x40a939);_0x299d47(_0x502e92[_0xc1c9('0x13')](0x1f4,_0x2c4e8b[_0xc1c9('0x14')]));});});}; \ No newline at end of file +var _0x6f3d=['catch','GetMemberReport','MemberReport','findAll','options','raw','attributes','include','map','model','create','body','CreateMemberReport','UpdateMemberReport','where','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','MemberReport,\x20%s,\x20%s','message','result'];(function(_0x1f1be2,_0x357b81){var _0x46c7bd=function(_0x1e28c5){while(--_0x1e28c5){_0x1f1be2['push'](_0x1f1be2['shift']());}};_0x46c7bd(++_0x357b81);}(_0x6f3d,0x7e));var _0xd6f3=function(_0x6bb9,_0x10f2b6){_0x6bb9=_0x6bb9-0x0;var _0xe3b3bc=_0x6f3d[_0x6bb9];return _0xe3b3bc;};'use strict';var _=require(_0xd6f3('0x0'));var util=require(_0xd6f3('0x1'));var moment=require(_0xd6f3('0x2'));var BPromise=require(_0xd6f3('0x3'));var rs=require(_0xd6f3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd6f3('0x5'));var logger=require(_0xd6f3('0x6'))(_0xd6f3('0x7'));var config=require(_0xd6f3('0x8'));var jayson=require(_0xd6f3('0x9'));var client=jayson[_0xd6f3('0xa')][_0xd6f3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd04c0c,_0x5e1979,_0x2da365){return new BPromise(function(_0xe6809c,_0x44e6af){return client['request'](_0xd04c0c,_0x2da365)[_0xd6f3('0xc')](function(_0x3325ba){logger[_0xd6f3('0xd')]('MemberReport,\x20%s,\x20%s',_0x5e1979,_0xd6f3('0xe'));logger[_0xd6f3('0xf')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x5e1979,_0xd6f3('0xe'),JSON[_0xd6f3('0x10')](_0x3325ba));if(_0x3325ba[_0xd6f3('0x11')]){if(_0x3325ba[_0xd6f3('0x11')][_0xd6f3('0x12')]===0x1f4){logger[_0xd6f3('0x11')](_0xd6f3('0x13'),_0x5e1979,_0x3325ba[_0xd6f3('0x11')][_0xd6f3('0x14')]);return _0x44e6af(_0x3325ba[_0xd6f3('0x11')][_0xd6f3('0x14')]);}logger['error'](_0xd6f3('0x13'),_0x5e1979,_0x3325ba[_0xd6f3('0x11')][_0xd6f3('0x14')]);return _0xe6809c(_0x3325ba[_0xd6f3('0x11')][_0xd6f3('0x14')]);}else{logger['info'](_0xd6f3('0x13'),_0x5e1979,_0xd6f3('0xe'));_0xe6809c(_0x3325ba[_0xd6f3('0x15')][_0xd6f3('0x14')]);}})[_0xd6f3('0x16')](function(_0x5a4ecc){logger[_0xd6f3('0x11')](_0xd6f3('0x13'),_0x5e1979,_0x5a4ecc);_0x44e6af(_0x5a4ecc);});});}exports[_0xd6f3('0x17')]=function(_0x1d030d){var _0x1ac4d9=this;return new Promise(function(_0x524c20,_0x1ce3a8){return db[_0xd6f3('0x18')][_0xd6f3('0x19')]({'raw':_0x1d030d[_0xd6f3('0x1a')]?_0x1d030d[_0xd6f3('0x1a')][_0xd6f3('0x1b')]===undefined?!![]:![]:!![],'where':_0x1d030d[_0xd6f3('0x1a')]?_0x1d030d[_0xd6f3('0x1a')]['where']||null:null,'attributes':_0x1d030d[_0xd6f3('0x1a')]?_0x1d030d[_0xd6f3('0x1a')][_0xd6f3('0x1c')]||null:null,'limit':_0x1d030d[_0xd6f3('0x1a')]?_0x1d030d[_0xd6f3('0x1a')]['limit']||null:null,'include':_0x1d030d[_0xd6f3('0x1a')]?_0x1d030d[_0xd6f3('0x1a')][_0xd6f3('0x1d')]?_[_0xd6f3('0x1e')](_0x1d030d['options'][_0xd6f3('0x1d')],function(_0x34d338){return{'model':db[_0x34d338[_0xd6f3('0x1f')]],'as':_0x34d338['as'],'attributes':_0x34d338[_0xd6f3('0x1c')],'include':_0x34d338[_0xd6f3('0x1d')]?_[_0xd6f3('0x1e')](_0x34d338[_0xd6f3('0x1d')],function(_0x4b245e){return{'model':db[_0x4b245e[_0xd6f3('0x1f')]],'as':_0x4b245e['as'],'attributes':_0x4b245e[_0xd6f3('0x1c')],'include':_0x4b245e[_0xd6f3('0x1d')]?_[_0xd6f3('0x1e')](_0x4b245e['include'],function(_0x5e1935){return{'model':db[_0x5e1935[_0xd6f3('0x1f')]],'as':_0x5e1935['as'],'attributes':_0x5e1935['attributes']};}):[]};}):[]};}):[]:[]})[_0xd6f3('0xc')](function(_0x2fed66){logger[_0xd6f3('0xd')](_0xd6f3('0x17'),_0x1d030d);logger[_0xd6f3('0xf')]('GetMemberReport',_0x1d030d,JSON[_0xd6f3('0x10')](_0x2fed66));_0x524c20(_0x2fed66);})['catch'](function(_0x3b34aa){logger[_0xd6f3('0x11')](_0xd6f3('0x17'),_0x3b34aa[_0xd6f3('0x14')],_0x1d030d);_0x1ce3a8(_0x1ac4d9['error'](0x1f4,_0x3b34aa['message']));});});};exports['CreateMemberReport']=function(_0x41b668){var _0x1b76b7=this;return new Promise(function(_0x46abbe,_0x5701ae){return db['MemberReport'][_0xd6f3('0x20')](_0x41b668[_0xd6f3('0x21')],{'raw':_0x41b668[_0xd6f3('0x1a')]?_0x41b668['options'][_0xd6f3('0x1b')]===undefined?!![]:![]:!![]})[_0xd6f3('0xc')](function(_0x13dd41){logger['info'](_0xd6f3('0x22'),_0x41b668);logger[_0xd6f3('0xf')]('CreateMemberReport',_0x41b668,JSON[_0xd6f3('0x10')](_0x13dd41));_0x46abbe(_0x13dd41);})[_0xd6f3('0x16')](function(_0x7fa138){logger['error'](_0xd6f3('0x22'),_0x7fa138[_0xd6f3('0x14')],_0x41b668);_0x5701ae(_0x1b76b7[_0xd6f3('0x11')](0x1f4,_0x7fa138['message']));});});};exports[_0xd6f3('0x23')]=function(_0x268e1b){var _0x251b87=this;return new Promise(function(_0x438678,_0xf71396){return db[_0xd6f3('0x18')]['update'](_0x268e1b['body'],{'raw':_0x268e1b[_0xd6f3('0x1a')]?_0x268e1b[_0xd6f3('0x1a')][_0xd6f3('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x268e1b[_0xd6f3('0x1a')]?_0x268e1b[_0xd6f3('0x1a')][_0xd6f3('0x24')]||null:null,'attributes':_0x268e1b[_0xd6f3('0x1a')]?_0x268e1b['options'][_0xd6f3('0x1c')]||null:null,'limit':_0x268e1b[_0xd6f3('0x1a')]?_0x268e1b[_0xd6f3('0x1a')]['limit']||null:null})[_0xd6f3('0xc')](function(_0x17ede5){logger[_0xd6f3('0xd')](_0xd6f3('0x23'),_0x268e1b);logger[_0xd6f3('0xf')](_0xd6f3('0x23'),_0x268e1b,JSON[_0xd6f3('0x10')](_0x17ede5));_0x438678(_0x17ede5);})[_0xd6f3('0x16')](function(_0x45c505){logger['error'](_0xd6f3('0x23'),_0x45c505['message'],_0x268e1b);_0xf71396(_0x251b87[_0xd6f3('0x11')](0x1f4,_0x45c505['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index cc63788..b77b6fc 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 _0x5eb8=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports'];(function(_0x11dfbb,_0x1f4c8a){var _0x22d016=function(_0x38285c){while(--_0x38285c){_0x11dfbb['push'](_0x11dfbb['shift']());}};_0x22d016(++_0x1f4c8a);}(_0x5eb8,0xb0));var _0x85eb=function(_0x38c652,_0x1ea1b7){_0x38c652=_0x38c652-0x0;var _0x218a37=_0x5eb8[_0x38c652];return _0x218a37;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var auth=require(_0x85eb('0x4'));var interaction=require(_0x85eb('0x5'));var config=require(_0x85eb('0x6'));var controller=require(_0x85eb('0x7'));router[_0x85eb('0x8')]('/',controller[_0x85eb('0x9')]);module[_0x85eb('0xa')]=router; \ No newline at end of file +var _0x96cc=['exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x96cc,0x16c));var _0xc96c=function(_0x15542f,_0x3d79d6){_0x15542f=_0x15542f-0x0;var _0x3f2d03=_0x96cc[_0x15542f];return _0x3f2d03;};'use strict';var multer=require(_0xc96c('0x0'));var util=require('util');var path=require(_0xc96c('0x1'));var timeout=require('connect-timeout');var express=require(_0xc96c('0x2'));var router=express[_0xc96c('0x3')]();var auth=require(_0xc96c('0x4'));var interaction=require(_0xc96c('0x5'));var config=require(_0xc96c('0x6'));var controller=require(_0xc96c('0x7'));router[_0xc96c('0x8')]('/',controller[_0xc96c('0x9')]);module[_0xc96c('0xa')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 23efdc3..55a3bef 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 _0xe514=['version','sequelize','STRING'];(function(_0x22e870,_0x4ecf1f){var _0x2b7acb=function(_0x251348){while(--_0x251348){_0x22e870['push'](_0x22e870['shift']());}};_0x2b7acb(++_0x4ecf1f);}(_0xe514,0x175));var _0x4e51=function(_0x4a52ed,_0x25b476){_0x4a52ed=_0x4a52ed-0x0;var _0x2fa11b=_0xe514[_0x4a52ed];return _0x2fa11b;};'use strict';var Sequelize=require(_0x4e51('0x0'));module['exports']={'version':{'type':Sequelize[_0x4e51('0x1')],'unique':_0x4e51('0x2')}}; \ No newline at end of file +var _0xa0fb=['version','exports','STRING'];(function(_0x587dd0,_0x273922){var _0x56f153=function(_0x27fb33){while(--_0x27fb33){_0x587dd0['push'](_0x587dd0['shift']());}};_0x56f153(++_0x273922);}(_0xa0fb,0x1cf));var _0xba0f=function(_0x4019e5,_0xce1e39){_0x4019e5=_0x4019e5-0x0;var _0x5084af=_0xa0fb[_0x4019e5];return _0x5084af;};'use strict';var Sequelize=require('sequelize');module[_0xba0f('0x0')]={'version':{'type':Sequelize[_0xba0f('0x1')],'unique':_0xba0f('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index bf9224a..9d1c6a8 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 _0x5f2f=['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','end','error','stack','name','send','index','map','fieldName','type','query','keys','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','Migration','then','include','rows','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce'];(function(_0x250ef7,_0x5735cf){var _0xe0b8b=function(_0x5a8c34){while(--_0x5a8c34){_0x250ef7['push'](_0x250ef7['shift']());}};_0xe0b8b(++_0x5735cf);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1084a8,_0x4ab7bb){_0x1084a8=_0x1084a8-0x0;var _0x514e8c=_0x5f2f[_0x1084a8];return _0x514e8c;};'use strict';var pdf=require(_0xf5f2('0x0'));var emlformat=require(_0xf5f2('0x1'));var rimraf=require(_0xf5f2('0x2'));var zipdir=require(_0xf5f2('0x3'));var jsonpatch=require(_0xf5f2('0x4'));var rp=require(_0xf5f2('0x5'));var moment=require(_0xf5f2('0x6'));var BPromise=require(_0xf5f2('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf5f2('0x8'));var sox=require(_0xf5f2('0x9'));var csv=require(_0xf5f2('0xa'));var ejs=require(_0xf5f2('0xb'));var fs=require('fs');var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0xa'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var db=require(_0xf5f2('0x16'))['db'];function respondWithStatusCode(_0x14b51f,_0x331482){_0x331482=_0x331482||0xcc;return function(_0x3f2997){if(_0x3f2997){return _0x14b51f[_0xf5f2('0x17')](_0x331482);}return _0x14b51f[_0xf5f2('0x18')](_0x331482)['end']();};}function respondWithResult(_0x5850f4,_0xea612c){_0xea612c=_0xea612c||0xc8;return function(_0x269909){if(_0x269909){return _0x5850f4[_0xf5f2('0x18')](_0xea612c)[_0xf5f2('0x19')](_0x269909);}};}function respondWithFilteredResult(_0x4d97fc,_0xafe430){return function(_0x286197){if(_0x286197){var _0x17d656=_0x286197[_0xf5f2('0x1a')],_0x1b6dd2=_0xafe430[_0xf5f2('0x1b')],_0x23e23a=_0xafe430[_0xf5f2('0x1b')]+_0xafe430[_0xf5f2('0x1c')],_0x3a9dbb;if(_0x23e23a>=_0x17d656){_0x23e23a=_0x17d656;_0x3a9dbb=0xc8;}else{_0x3a9dbb=0xce;}_0x4d97fc[_0xf5f2('0x18')](_0x3a9dbb);return _0x4d97fc[_0xf5f2('0x1d')](_0xf5f2('0x1e'),_0x1b6dd2+'-'+_0x23e23a+'/'+_0x17d656)[_0xf5f2('0x19')](_0x286197);}return null;};}function patchUpdates(_0x3cf5ea){return function(_0x626999){try{jsonpatch[_0xf5f2('0x1f')](_0x626999,_0x3cf5ea,!![]);}catch(_0x56acc5){return BPromise[_0xf5f2('0x20')](_0x56acc5);}return _0x626999[_0xf5f2('0x21')]();};}function saveUpdates(_0x49dac2,_0x47acfc){return function(_0x2d2805){if(_0x2d2805){return _0x2d2805[_0xf5f2('0x22')](_0x49dac2)['then'](function(_0x45b74f){return _0x45b74f;});}return null;};}function removeEntity(_0x170042,_0x39e44a){return function(_0x39c024){if(_0x39c024){return _0x39c024[_0xf5f2('0x23')]()['then'](function(){_0x170042[_0xf5f2('0x18')](0xcc)[_0xf5f2('0x24')]();});}};}function handleEntityNotFound(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(!_0x287ad5){_0x4e8bda['sendStatus'](0x194);}return _0x287ad5;};}function handleError(_0x529f07,_0x5f1124){_0x5f1124=_0x5f1124||0x1f4;return function(_0x3f79d5){logger[_0xf5f2('0x25')](_0x3f79d5[_0xf5f2('0x26')]);if(_0x3f79d5[_0xf5f2('0x27')]){delete _0x3f79d5[_0xf5f2('0x27')];}_0x529f07[_0xf5f2('0x18')](_0x5f1124)[_0xf5f2('0x28')](_0x3f79d5);};}exports[_0xf5f2('0x29')]=function(_0x4ab014,_0xaa2602){var _0x102449={},_0x375ca8={},_0x31bfcb={'count':0x0,'rows':[]};var _0x198c73=_[_0xf5f2('0x2a')](db['Migration']['rawAttributes'],function(_0x22c826){return{'name':_0x22c826[_0xf5f2('0x2b')],'type':_0x22c826[_0xf5f2('0x2c')]['key']};});_0x375ca8['model']=_[_0xf5f2('0x2a')](_0x198c73,_0xf5f2('0x27'));_0x375ca8[_0xf5f2('0x2d')]=_[_0xf5f2('0x2e')](_0x4ab014[_0xf5f2('0x2d')]);_0x375ca8['filters']=_['intersection'](_0x375ca8[_0xf5f2('0x2f')],_0x375ca8['query']);_0x102449[_0xf5f2('0x30')]=_['intersection'](_0x375ca8[_0xf5f2('0x2f')],qs[_0xf5f2('0x31')](_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x31')]));_0x102449[_0xf5f2('0x30')]=_0x102449[_0xf5f2('0x30')][_0xf5f2('0x32')]?_0x102449[_0xf5f2('0x30')]:_0x375ca8['model'];if(!_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x33')](_0xf5f2('0x34'))){_0x102449[_0xf5f2('0x1c')]=qs[_0xf5f2('0x1c')](_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x1c')]);_0x102449['offset']=qs[_0xf5f2('0x1b')](_0x4ab014[_0xf5f2('0x2d')]['offset']);}_0x102449[_0xf5f2('0x35')]=qs['sort'](_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x36')]);_0x102449[_0xf5f2('0x37')]=qs[_0xf5f2('0x38')](_['pick'](_0x4ab014['query'],_0x375ca8[_0xf5f2('0x38')]));if(_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x39')]){_0x102449['where']=_[_0xf5f2('0x3a')](_0x102449['where'],{'$or':_[_0xf5f2('0x2a')](_0x198c73,function(_0x566c47){if(_0x566c47[_0xf5f2('0x2c')]!==_0xf5f2('0x3b')){var _0x5337a6={};_0x5337a6[_0x566c47[_0xf5f2('0x27')]]={'$like':'%'+_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x39')]+'%'};return _0x5337a6;}})});}_0x102449=_[_0xf5f2('0x3a')]({},_0x102449,_0x4ab014['options']);var _0x5d2d82={'where':_0x102449[_0xf5f2('0x37')]};return db[_0xf5f2('0x3c')][_0xf5f2('0x1a')](_0x5d2d82)[_0xf5f2('0x3d')](function(_0x2c7f65){_0x31bfcb[_0xf5f2('0x1a')]=_0x2c7f65;if(_0x4ab014[_0xf5f2('0x2d')]['includeAll']){_0x102449[_0xf5f2('0x3e')]=[{'all':!![]}];}return db[_0xf5f2('0x3c')]['findAll'](_0x102449);})[_0xf5f2('0x3d')](function(_0x3f3895){_0x31bfcb[_0xf5f2('0x3f')]=_0x3f3895;return _0x31bfcb;})[_0xf5f2('0x3d')](respondWithFilteredResult(_0xaa2602,_0x102449))[_0xf5f2('0x40')](handleError(_0xaa2602,null));}; \ No newline at end of file +var _0x5f2f=['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','end','error','stack','name','send','index','map','fieldName','type','query','keys','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','Migration','then','include','rows','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce'];(function(_0x3e332b,_0x54cde6){var _0x1794ef=function(_0x408708){while(--_0x408708){_0x3e332b['push'](_0x3e332b['shift']());}};_0x1794ef(++_0x54cde6);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1b6a50,_0x596246){_0x1b6a50=_0x1b6a50-0x0;var _0x4d5212=_0x5f2f[_0x1b6a50];return _0x4d5212;};'use strict';var pdf=require(_0xf5f2('0x0'));var emlformat=require(_0xf5f2('0x1'));var rimraf=require(_0xf5f2('0x2'));var zipdir=require(_0xf5f2('0x3'));var jsonpatch=require(_0xf5f2('0x4'));var rp=require(_0xf5f2('0x5'));var moment=require(_0xf5f2('0x6'));var BPromise=require(_0xf5f2('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf5f2('0x8'));var sox=require(_0xf5f2('0x9'));var csv=require(_0xf5f2('0xa'));var ejs=require(_0xf5f2('0xb'));var fs=require('fs');var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0xa'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var db=require(_0xf5f2('0x16'))['db'];function respondWithStatusCode(_0x14b51f,_0x331482){_0x331482=_0x331482||0xcc;return function(_0x3f2997){if(_0x3f2997){return _0x14b51f[_0xf5f2('0x17')](_0x331482);}return _0x14b51f[_0xf5f2('0x18')](_0x331482)['end']();};}function respondWithResult(_0x5850f4,_0xea612c){_0xea612c=_0xea612c||0xc8;return function(_0x269909){if(_0x269909){return _0x5850f4[_0xf5f2('0x18')](_0xea612c)[_0xf5f2('0x19')](_0x269909);}};}function respondWithFilteredResult(_0x4d97fc,_0xafe430){return function(_0x286197){if(_0x286197){var _0x17d656=_0x286197[_0xf5f2('0x1a')],_0x1b6dd2=_0xafe430[_0xf5f2('0x1b')],_0x23e23a=_0xafe430[_0xf5f2('0x1b')]+_0xafe430[_0xf5f2('0x1c')],_0x3a9dbb;if(_0x23e23a>=_0x17d656){_0x23e23a=_0x17d656;_0x3a9dbb=0xc8;}else{_0x3a9dbb=0xce;}_0x4d97fc[_0xf5f2('0x18')](_0x3a9dbb);return _0x4d97fc[_0xf5f2('0x1d')](_0xf5f2('0x1e'),_0x1b6dd2+'-'+_0x23e23a+'/'+_0x17d656)[_0xf5f2('0x19')](_0x286197);}return null;};}function patchUpdates(_0x3cf5ea){return function(_0x626999){try{jsonpatch[_0xf5f2('0x1f')](_0x626999,_0x3cf5ea,!![]);}catch(_0x56acc5){return BPromise[_0xf5f2('0x20')](_0x56acc5);}return _0x626999[_0xf5f2('0x21')]();};}function saveUpdates(_0x49dac2,_0x47acfc){return function(_0x2d2805){if(_0x2d2805){return _0x2d2805[_0xf5f2('0x22')](_0x49dac2)['then'](function(_0x45b74f){return _0x45b74f;});}return null;};}function removeEntity(_0x170042,_0x39e44a){return function(_0x39c024){if(_0x39c024){return _0x39c024[_0xf5f2('0x23')]()['then'](function(){_0x170042[_0xf5f2('0x18')](0xcc)[_0xf5f2('0x24')]();});}};}function handleEntityNotFound(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(!_0x287ad5){_0x4e8bda['sendStatus'](0x194);}return _0x287ad5;};}function handleError(_0x529f07,_0x5f1124){_0x5f1124=_0x5f1124||0x1f4;return function(_0x3f79d5){logger[_0xf5f2('0x25')](_0x3f79d5[_0xf5f2('0x26')]);if(_0x3f79d5[_0xf5f2('0x27')]){delete _0x3f79d5[_0xf5f2('0x27')];}_0x529f07[_0xf5f2('0x18')](_0x5f1124)[_0xf5f2('0x28')](_0x3f79d5);};}exports[_0xf5f2('0x29')]=function(_0x4ab014,_0xaa2602){var _0x102449={},_0x375ca8={},_0x31bfcb={'count':0x0,'rows':[]};var _0x198c73=_[_0xf5f2('0x2a')](db['Migration']['rawAttributes'],function(_0x22c826){return{'name':_0x22c826[_0xf5f2('0x2b')],'type':_0x22c826[_0xf5f2('0x2c')]['key']};});_0x375ca8['model']=_[_0xf5f2('0x2a')](_0x198c73,_0xf5f2('0x27'));_0x375ca8[_0xf5f2('0x2d')]=_[_0xf5f2('0x2e')](_0x4ab014[_0xf5f2('0x2d')]);_0x375ca8['filters']=_['intersection'](_0x375ca8[_0xf5f2('0x2f')],_0x375ca8['query']);_0x102449[_0xf5f2('0x30')]=_['intersection'](_0x375ca8[_0xf5f2('0x2f')],qs[_0xf5f2('0x31')](_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x31')]));_0x102449[_0xf5f2('0x30')]=_0x102449[_0xf5f2('0x30')][_0xf5f2('0x32')]?_0x102449[_0xf5f2('0x30')]:_0x375ca8['model'];if(!_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x33')](_0xf5f2('0x34'))){_0x102449[_0xf5f2('0x1c')]=qs[_0xf5f2('0x1c')](_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x1c')]);_0x102449['offset']=qs[_0xf5f2('0x1b')](_0x4ab014[_0xf5f2('0x2d')]['offset']);}_0x102449[_0xf5f2('0x35')]=qs['sort'](_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x36')]);_0x102449[_0xf5f2('0x37')]=qs[_0xf5f2('0x38')](_['pick'](_0x4ab014['query'],_0x375ca8[_0xf5f2('0x38')]));if(_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x39')]){_0x102449['where']=_[_0xf5f2('0x3a')](_0x102449['where'],{'$or':_[_0xf5f2('0x2a')](_0x198c73,function(_0x566c47){if(_0x566c47[_0xf5f2('0x2c')]!==_0xf5f2('0x3b')){var _0x5337a6={};_0x5337a6[_0x566c47[_0xf5f2('0x27')]]={'$like':'%'+_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x39')]+'%'};return _0x5337a6;}})});}_0x102449=_[_0xf5f2('0x3a')]({},_0x102449,_0x4ab014['options']);var _0x5d2d82={'where':_0x102449[_0xf5f2('0x37')]};return db[_0xf5f2('0x3c')][_0xf5f2('0x1a')](_0x5d2d82)[_0xf5f2('0x3d')](function(_0x2c7f65){_0x31bfcb[_0xf5f2('0x1a')]=_0x2c7f65;if(_0x4ab014[_0xf5f2('0x2d')]['includeAll']){_0x102449[_0xf5f2('0x3e')]=[{'all':!![]}];}return db[_0xf5f2('0x3c')]['findAll'](_0x102449);})[_0xf5f2('0x3d')](function(_0x3f3895){_0x31bfcb[_0xf5f2('0x3f')]=_0x3f3895;return _0x31bfcb;})[_0xf5f2('0x3d')](respondWithFilteredResult(_0xaa2602,_0x102449))[_0xf5f2('0x40')](handleError(_0xaa2602,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 053b4df..70e4a81 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 _0x82de=['moment','request-promise','path','rimraf','../../config/environment','exports','Migration','migrations','lodash','util','../../config/logger','api'];(function(_0x239a00,_0x1cc049){var _0x248dd3=function(_0x4fd868){while(--_0x4fd868){_0x239a00['push'](_0x239a00['shift']());}};_0x248dd3(++_0x1cc049);}(_0x82de,0x188));var _0xe82d=function(_0x9a18d0,_0x24ae9b){_0x9a18d0=_0x9a18d0-0x0;var _0x561924=_0x82de[_0x9a18d0];return _0x561924;};'use strict';var _=require(_0xe82d('0x0'));var util=require(_0xe82d('0x1'));var logger=require(_0xe82d('0x2'))(_0xe82d('0x3'));var moment=require(_0xe82d('0x4'));var BPromise=require('bluebird');var rp=require(_0xe82d('0x5'));var fs=require('fs');var path=require(_0xe82d('0x6'));var rimraf=require(_0xe82d('0x7'));var config=require(_0xe82d('0x8'));var attributes=require('./migration.attributes');module[_0xe82d('0x9')]=function(_0x5b110c,_0x10ae76){return _0x5b110c['define'](_0xe82d('0xa'),attributes,{'tableName':_0xe82d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8949=['request-promise','path','../../config/environment','./migration.attributes','define','Migration','migrations','util','api','moment','bluebird'];(function(_0x39e2d7,_0x1b15f6){var _0x413d0d=function(_0x3af71d){while(--_0x3af71d){_0x39e2d7['push'](_0x39e2d7['shift']());}};_0x413d0d(++_0x1b15f6);}(_0x8949,0x1b4));var _0x9894=function(_0x3590ed,_0x3a4587){_0x3590ed=_0x3590ed-0x0;var _0x21f72f=_0x8949[_0x3590ed];return _0x21f72f;};'use strict';var _=require('lodash');var util=require(_0x9894('0x0'));var logger=require('../../config/logger')(_0x9894('0x1'));var moment=require(_0x9894('0x2'));var BPromise=require(_0x9894('0x3'));var rp=require(_0x9894('0x4'));var fs=require('fs');var path=require(_0x9894('0x5'));var rimraf=require('rimraf');var config=require(_0x9894('0x6'));var attributes=require(_0x9894('0x7'));module['exports']=function(_0x524d84,_0x13ec6d){return _0x524d84[_0x9894('0x8')](_0x9894('0x9'),attributes,{'tableName':_0x9894('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 49fa630..eb537c7 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 _0x7e83=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','message','Migration,\x20%s,\x20%s','result','catch','lodash','util'];(function(_0x4a095e,_0x381cd5){var _0x10ef73=function(_0x1f6964){while(--_0x1f6964){_0x4a095e['push'](_0x4a095e['shift']());}};_0x10ef73(++_0x381cd5);}(_0x7e83,0x7c));var _0x37e8=function(_0x547587,_0x48cbd9){_0x547587=_0x547587-0x0;var _0x3d7777=_0x7e83[_0x547587];return _0x3d7777;};'use strict';var _=require(_0x37e8('0x0'));var util=require(_0x37e8('0x1'));var moment=require(_0x37e8('0x2'));var BPromise=require(_0x37e8('0x3'));var rs=require(_0x37e8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x37e8('0x5'));var logger=require(_0x37e8('0x6'))(_0x37e8('0x7'));var config=require('../../config/environment');var jayson=require(_0x37e8('0x8'));var client=jayson[_0x37e8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21f644,_0x2d4f25,_0x4a669c){return new BPromise(function(_0x18c5ed,_0x396fdf){return client[_0x37e8('0xa')](_0x21f644,_0x4a669c)[_0x37e8('0xb')](function(_0x50680c){logger[_0x37e8('0xc')]('Migration,\x20%s,\x20%s',_0x2d4f25,_0x37e8('0xd'));logger[_0x37e8('0xe')](_0x37e8('0xf'),_0x2d4f25,_0x37e8('0xd'),JSON['stringify'](_0x50680c));if(_0x50680c[_0x37e8('0x10')]){if(_0x50680c[_0x37e8('0x10')]['code']===0x1f4){logger[_0x37e8('0x10')]('Migration,\x20%s,\x20%s',_0x2d4f25,_0x50680c['error'][_0x37e8('0x11')]);return _0x396fdf(_0x50680c[_0x37e8('0x10')][_0x37e8('0x11')]);}logger[_0x37e8('0x10')](_0x37e8('0x12'),_0x2d4f25,_0x50680c['error'][_0x37e8('0x11')]);return _0x18c5ed(_0x50680c[_0x37e8('0x10')]['message']);}else{logger['info'](_0x37e8('0x12'),_0x2d4f25,_0x37e8('0xd'));_0x18c5ed(_0x50680c[_0x37e8('0x13')][_0x37e8('0x11')]);}})[_0x37e8('0x14')](function(_0x3a333e){logger[_0x37e8('0x10')](_0x37e8('0x12'),_0x2d4f25,_0x3a333e);_0x396fdf(_0x3a333e);});});} \ No newline at end of file +var _0x560e=['../../config/environment','jayson/promise','http','request','then','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x19d433,_0x4b63f8){var _0x18d114=function(_0x3f3d45){while(--_0x3f3d45){_0x19d433['push'](_0x19d433['shift']());}};_0x18d114(++_0x4b63f8);}(_0x560e,0x1ee));var _0xe560=function(_0x2eb6f6,_0x2476fa){_0x2eb6f6=_0x2eb6f6-0x0;var _0x2387f6=_0x560e[_0x2eb6f6];return _0x2387f6;};'use strict';var _=require(_0xe560('0x0'));var util=require(_0xe560('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe560('0x2'))['db'];var utils=require(_0xe560('0x3'));var logger=require(_0xe560('0x4'))(_0xe560('0x5'));var config=require(_0xe560('0x6'));var jayson=require(_0xe560('0x7'));var client=jayson['client'][_0xe560('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4d75b7,_0x91d4c4,_0x35137f){return new BPromise(function(_0x2db1d2,_0x4cc43a){return client[_0xe560('0x9')](_0x4d75b7,_0x35137f)[_0xe560('0xa')](function(_0x3e4995){logger['info'](_0xe560('0xb'),_0x91d4c4,_0xe560('0xc'));logger[_0xe560('0xd')](_0xe560('0xe'),_0x91d4c4,_0xe560('0xc'),JSON[_0xe560('0xf')](_0x3e4995));if(_0x3e4995['error']){if(_0x3e4995[_0xe560('0x10')][_0xe560('0x11')]===0x1f4){logger[_0xe560('0x10')](_0xe560('0xb'),_0x91d4c4,_0x3e4995[_0xe560('0x10')]['message']);return _0x4cc43a(_0x3e4995[_0xe560('0x10')][_0xe560('0x12')]);}logger[_0xe560('0x10')](_0xe560('0xb'),_0x91d4c4,_0x3e4995[_0xe560('0x10')]['message']);return _0x2db1d2(_0x3e4995['error'][_0xe560('0x12')]);}else{logger['info'](_0xe560('0xb'),_0x91d4c4,_0xe560('0xc'));_0x2db1d2(_0x3e4995['result'][_0xe560('0x12')]);}})[_0xe560('0x13')](function(_0x4c0c9e){logger[_0xe560('0x10')](_0xe560('0xb'),_0x91d4c4,_0x4c0c9e);_0x4cc43a(_0x4c0c9e);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 116e8d0..33e3c24 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 _0x241f=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./network.controller','isAuthenticated','index','get','show','create','/:id','update','delete','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x241f,0x169));var _0xf241=function(_0xa4b8e1,_0x49d30b){_0xa4b8e1=_0xa4b8e1-0x0;var _0x507e42=_0x241f[_0xa4b8e1];return _0x507e42;};'use strict';var multer=require(_0xf241('0x0'));var util=require(_0xf241('0x1'));var path=require(_0xf241('0x2'));var timeout=require(_0xf241('0x3'));var express=require(_0xf241('0x4'));var router=express['Router']();var auth=require(_0xf241('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf241('0x6'));var controller=require(_0xf241('0x7'));router['get']('/',auth[_0xf241('0x8')](),controller[_0xf241('0x9')]);router[_0xf241('0xa')]('/:id',auth[_0xf241('0x8')](),controller[_0xf241('0xb')]);router['post']('/',auth[_0xf241('0x8')](),controller[_0xf241('0xc')]);router['put'](_0xf241('0xd'),auth['isAuthenticated'](),controller[_0xf241('0xe')]);router[_0xf241('0xf')](_0xf241('0xd'),auth['isAuthenticated'](),controller[_0xf241('0x10')]);module[_0xf241('0x11')]=router; \ No newline at end of file +var _0xebc8=['/:id','update','delete','destroy','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','post','create','put'];(function(_0x3d469c,_0x12086f){var _0x40749b=function(_0x20132c){while(--_0x20132c){_0x3d469c['push'](_0x3d469c['shift']());}};_0x40749b(++_0x12086f);}(_0xebc8,0x94));var _0x8ebc=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xebc8[_0x6c993a];return _0x27f547;};'use strict';var multer=require('multer');var util=require(_0x8ebc('0x0'));var path=require('path');var timeout=require(_0x8ebc('0x1'));var express=require(_0x8ebc('0x2'));var router=express[_0x8ebc('0x3')]();var auth=require(_0x8ebc('0x4'));var interaction=require(_0x8ebc('0x5'));var config=require(_0x8ebc('0x6'));var controller=require('./network.controller');router['get']('/',auth[_0x8ebc('0x7')](),controller['index']);router[_0x8ebc('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x8ebc('0x9')]('/',auth[_0x8ebc('0x7')](),controller[_0x8ebc('0xa')]);router[_0x8ebc('0xb')](_0x8ebc('0xc'),auth[_0x8ebc('0x7')](),controller[_0x8ebc('0xd')]);router[_0x8ebc('0xe')]('/:id',auth[_0x8ebc('0x7')](),controller[_0x8ebc('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index c955c59..6c6e91e 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(_0x5e3898,_0x39f21a){var _0xd775f6=function(_0x4c6831){while(--_0x4c6831){_0x5e3898['push'](_0x5e3898['shift']());}};_0xd775f6(++_0x39f21a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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(_0x510164,_0x38128b){var _0x51ab16=function(_0x5c86a9){while(--_0x5c86a9){_0x510164['push'](_0x510164['shift']());}};_0x51ab16(++_0x38128b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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 ec94b25..3b899a7 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 _0xc4d6=['destroy','stack','name','index','map','Network','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','options','find','create','sequelize','body','toUpperCase','STUN','readFileSync','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','Reload','join','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','format','html-pdf','eml-format','rimraf','zip-dir','bluebird','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','jayson/promise','http','test','Sequelize','request','info','request\x20sent','debug','stringify','error','code','Network,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','update','then'];(function(_0x4f9ba8,_0x87b3bb){var _0x5ad37f=function(_0xa34cb){while(--_0xa34cb){_0x4f9ba8['push'](_0x4f9ba8['shift']());}};_0x5ad37f(++_0x87b3bb);}(_0xc4d6,0x16e));var _0x6c4d=function(_0x1fb4a0,_0x48a602){_0x1fb4a0=_0x1fb4a0-0x0;var _0x1094e7=_0xc4d6[_0x1fb4a0];return _0x1094e7;};'use strict';var pdf=require(_0x6c4d('0x0'));var emlformat=require(_0x6c4d('0x1'));var rimraf=require(_0x6c4d('0x2'));var zipdir=require(_0x6c4d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6c4d('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6c4d('0x5'));var sox=require('sox');var csv=require(_0x6c4d('0x6'));var ejs=require(_0x6c4d('0x7'));var fs=require('fs');var _=require(_0x6c4d('0x8'));var squel=require(_0x6c4d('0x9'));var crypto=require(_0x6c4d('0xa'));var jsforce=require(_0x6c4d('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6c4d('0x6'));var querystring=require(_0x6c4d('0xc'));var Papa=require(_0x6c4d('0xd'));var Redis=require(_0x6c4d('0xe'));var authService=require(_0x6c4d('0xf'));var qs=require(_0x6c4d('0x10'));var as=require(_0x6c4d('0x11'));var hardwareService=require(_0x6c4d('0x12'));var logger=require(_0x6c4d('0x13'))(_0x6c4d('0x14'));var utils=require('../../config/utils');var config=require(_0x6c4d('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0x6c4d('0x16'));var client=jayson['client'][_0x6c4d('0x17')]({'port':0x232a});function checkPasswordPattern(_0x211ee4,_0x549c89,_0x4c9d28){if(_0x4c9d28){var _0x45e139=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x45e139[_0x6c4d('0x18')](_0x549c89)){return _0x211ee4;}else{throw new db[(_0x6c4d('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 _0x211ee4;}}function respondWithRpcPromise(_0x3123e6,_0x29ef71,_0x294e47,_0x224569){return new BPromise(function(_0x28783b,_0x4e0103){var _0xd620d7=_0x224569||client;return _0xd620d7[_0x6c4d('0x1a')](_0x3123e6,_0x294e47)['then'](function(_0x20d829){logger[_0x6c4d('0x1b')]('Network,\x20%s,\x20%s',_0x29ef71,_0x6c4d('0x1c'));logger[_0x6c4d('0x1d')]('Network,\x20%s,\x20%s,\x20%s',_0x29ef71,'request\x20sent',JSON[_0x6c4d('0x1e')](_0x20d829));if(_0x20d829[_0x6c4d('0x1f')]){if(_0x20d829[_0x6c4d('0x1f')][_0x6c4d('0x20')]===0x1f4){logger['error'](_0x6c4d('0x21'),_0x29ef71,_0x20d829['error'][_0x6c4d('0x22')]);return _0x4e0103(_0x20d829[_0x6c4d('0x1f')]['message']);}logger[_0x6c4d('0x1f')]('Network,\x20%s,\x20%s',_0x29ef71,_0x20d829[_0x6c4d('0x1f')][_0x6c4d('0x22')]);return _0x28783b(_0x20d829[_0x6c4d('0x1f')][_0x6c4d('0x22')]);}else{logger[_0x6c4d('0x1b')](_0x6c4d('0x21'),_0x29ef71,_0x6c4d('0x1c'));_0x28783b(_0x20d829[_0x6c4d('0x23')][_0x6c4d('0x22')]);}})[_0x6c4d('0x24')](function(_0x35c9d7){logger[_0x6c4d('0x1f')](_0x6c4d('0x21'),_0x29ef71,_0x35c9d7);_0x4e0103(_0x35c9d7);});});}function respondWithStatusCode(_0x4a4fa8,_0x539dc4){_0x539dc4=_0x539dc4||0xcc;return function(_0x530e13){if(_0x530e13){return _0x4a4fa8[_0x6c4d('0x25')](_0x539dc4);}return _0x4a4fa8['status'](_0x539dc4)[_0x6c4d('0x26')]();};}function respondWithResult(_0x349379,_0x587869){_0x587869=_0x587869||0xc8;return function(_0x1c3f39){if(_0x1c3f39){return _0x349379[_0x6c4d('0x27')](_0x587869)[_0x6c4d('0x28')](_0x1c3f39);}};}function respondWithFilteredResult(_0x5ddbee,_0x880430){return function(_0x2bb954){if(_0x2bb954){var _0x10c0bd=_0x2bb954[_0x6c4d('0x29')],_0x5eced5=_0x880430[_0x6c4d('0x2a')],_0x685f25=_0x880430['offset']+_0x880430[_0x6c4d('0x2b')],_0x2cce6c;if(_0x685f25>=_0x10c0bd){_0x685f25=_0x10c0bd;_0x2cce6c=0xc8;}else{_0x2cce6c=0xce;}_0x5ddbee[_0x6c4d('0x27')](_0x2cce6c);return _0x5ddbee[_0x6c4d('0x2c')](_0x6c4d('0x2d'),_0x5eced5+'-'+_0x685f25+'/'+_0x10c0bd)[_0x6c4d('0x28')](_0x2bb954);}return null;};}function patchUpdates(_0x5c6aef){return function(_0x3ea302){try{jsonpatch['apply'](_0x3ea302,_0x5c6aef,!![]);}catch(_0x2b62d3){return BPromise[_0x6c4d('0x2e')](_0x2b62d3);}return _0x3ea302[_0x6c4d('0x2f')]();};}function saveUpdates(_0x409247,_0x593ca){return function(_0x9f2b27){if(_0x9f2b27){return _0x9f2b27[_0x6c4d('0x30')](_0x409247)[_0x6c4d('0x31')](function(_0x25a9ac){return _0x25a9ac;});}return null;};}function removeEntity(_0x41613f,_0x274b62){return function(_0x40d412){if(_0x40d412){return _0x40d412[_0x6c4d('0x32')]()[_0x6c4d('0x31')](function(){_0x41613f[_0x6c4d('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cd86e,_0x159627){return function(_0x2baed5){if(!_0x2baed5){_0x5cd86e[_0x6c4d('0x25')](0x194);}return _0x2baed5;};}function handleError(_0x21d4bb,_0x13fc16){_0x13fc16=_0x13fc16||0x1f4;return function(_0x1c1042){logger[_0x6c4d('0x1f')](_0x1c1042[_0x6c4d('0x33')]);if(_0x1c1042[_0x6c4d('0x34')]){delete _0x1c1042[_0x6c4d('0x34')];}_0x21d4bb[_0x6c4d('0x27')](_0x13fc16)['send'](_0x1c1042);};}exports[_0x6c4d('0x35')]=function(_0x43678b,_0x1b0aef){var _0x4d7120={},_0x4394c1={},_0x3fa56b={'count':0x0,'rows':[]};var _0x5ec631=_[_0x6c4d('0x36')](db[_0x6c4d('0x37')][_0x6c4d('0x38')],function(_0x505e29){return{'name':_0x505e29[_0x6c4d('0x39')],'type':_0x505e29[_0x6c4d('0x3a')][_0x6c4d('0x3b')]};});_0x4394c1[_0x6c4d('0x3c')]=_[_0x6c4d('0x36')](_0x5ec631,_0x6c4d('0x34'));_0x4394c1[_0x6c4d('0x3d')]=_[_0x6c4d('0x3e')](_0x43678b[_0x6c4d('0x3d')]);_0x4394c1['filters']=_['intersection'](_0x4394c1[_0x6c4d('0x3c')],_0x4394c1[_0x6c4d('0x3d')]);_0x4d7120[_0x6c4d('0x3f')]=_[_0x6c4d('0x40')](_0x4394c1[_0x6c4d('0x3c')],qs[_0x6c4d('0x41')](_0x43678b[_0x6c4d('0x3d')][_0x6c4d('0x41')]));_0x4d7120['attributes']=_0x4d7120[_0x6c4d('0x3f')][_0x6c4d('0x42')]?_0x4d7120['attributes']:_0x4394c1['model'];if(!_0x43678b[_0x6c4d('0x3d')]['hasOwnProperty'](_0x6c4d('0x43'))){_0x4d7120[_0x6c4d('0x2b')]=qs[_0x6c4d('0x2b')](_0x43678b[_0x6c4d('0x3d')]['limit']);_0x4d7120[_0x6c4d('0x2a')]=qs['offset'](_0x43678b[_0x6c4d('0x3d')][_0x6c4d('0x2a')]);}_0x4d7120['order']=qs[_0x6c4d('0x44')](_0x43678b[_0x6c4d('0x3d')][_0x6c4d('0x44')]);_0x4d7120[_0x6c4d('0x45')]=qs[_0x6c4d('0x46')](_['pick'](_0x43678b[_0x6c4d('0x3d')],_0x4394c1['filters']));if(_0x43678b[_0x6c4d('0x3d')][_0x6c4d('0x47')]){_0x4d7120[_0x6c4d('0x45')]=_[_0x6c4d('0x48')](_0x4d7120[_0x6c4d('0x45')],{'$or':_['map'](_0x5ec631,function(_0x45e2b9){if(_0x45e2b9[_0x6c4d('0x3a')]!==_0x6c4d('0x49')){var _0x2fbe1e={};_0x2fbe1e[_0x45e2b9[_0x6c4d('0x34')]]={'$like':'%'+_0x43678b[_0x6c4d('0x3d')]['filter']+'%'};return _0x2fbe1e;}})});}_0x4d7120=_[_0x6c4d('0x48')]({},_0x4d7120,_0x43678b['options']);var _0x56f08d={'where':_0x4d7120['where']};return db['Network']['count'](_0x56f08d)[_0x6c4d('0x31')](function(_0x27545c){_0x3fa56b[_0x6c4d('0x29')]=_0x27545c;if(_0x43678b['query'][_0x6c4d('0x4a')]){_0x4d7120[_0x6c4d('0x4b')]=[{'all':!![]}];}return db[_0x6c4d('0x37')][_0x6c4d('0x4c')](_0x4d7120);})[_0x6c4d('0x31')](function(_0x581336){_0x3fa56b[_0x6c4d('0x4d')]=_0x581336;return _0x3fa56b;})['then'](respondWithFilteredResult(_0x1b0aef,_0x4d7120))['catch'](handleError(_0x1b0aef,null));};exports['show']=function(_0x541c09,_0xa14216){var _0x1ee494={'raw':!![],'where':{'id':_0x541c09[_0x6c4d('0x4e')]['id']}},_0x2ce55b={};_0x2ce55b['model']=_[_0x6c4d('0x3e')](db[_0x6c4d('0x37')]['rawAttributes']);_0x2ce55b[_0x6c4d('0x3d')]=_[_0x6c4d('0x3e')](_0x541c09[_0x6c4d('0x3d')]);_0x2ce55b[_0x6c4d('0x46')]=_[_0x6c4d('0x40')](_0x2ce55b[_0x6c4d('0x3c')],_0x2ce55b[_0x6c4d('0x3d')]);_0x1ee494[_0x6c4d('0x3f')]=_['intersection'](_0x2ce55b[_0x6c4d('0x3c')],qs[_0x6c4d('0x41')](_0x541c09['query'][_0x6c4d('0x41')]));_0x1ee494[_0x6c4d('0x3f')]=_0x1ee494['attributes'][_0x6c4d('0x42')]?_0x1ee494['attributes']:_0x2ce55b[_0x6c4d('0x3c')];if(_0x541c09['query']['includeAll']){_0x1ee494[_0x6c4d('0x4b')]=[{'all':!![]}];}_0x1ee494=_['merge']({},_0x1ee494,_0x541c09[_0x6c4d('0x4f')]);return db[_0x6c4d('0x37')][_0x6c4d('0x50')](_0x1ee494)['then'](handleEntityNotFound(_0xa14216,null))[_0x6c4d('0x31')](respondWithResult(_0xa14216,null))[_0x6c4d('0x24')](handleError(_0xa14216,null));};exports[_0x6c4d('0x51')]=function(_0x5e990f,_0x30271c,_0x3b0846){var _0x1b2129;return db[_0x6c4d('0x52')]['transaction'](function(_0x4d0821){return db[_0x6c4d('0x37')]['create'](_0x5e990f[_0x6c4d('0x53')],{'raw':!![]})['then'](function(_0x48c6cd){_0x1b2129=_0x48c6cd;return db[_0x6c4d('0x37')][_0x6c4d('0x4c')]({'where':{'type':_0x5e990f[_0x6c4d('0x53')][_0x6c4d('0x3a')]},'raw':!![]});})['then'](function(_0x45c0eb){if(_0x1b2129[_0x6c4d('0x3a')][_0x6c4d('0x54')]()==_0x6c4d('0x55')){var _0x3375aa=fs[_0x6c4d('0x56')](path['join'](config[_0x6c4d('0x57')],_0x6c4d('0x58')),_0x6c4d('0x59'));var _0x3c15d0=ejs[_0x6c4d('0x5a')](_0x3375aa,{'networks':_0x45c0eb||[]});fs[_0x6c4d('0x5b')](_0x6c4d('0x5c'),_0x3c15d0);return respondWithRpcPromise('Reload','create',{'module':_0x6c4d('0x5d')});}else if(_0x1b2129[_0x6c4d('0x3a')]['toUpperCase']()==_0x6c4d('0x5e')){var _0x690c5f=fs['readFileSync'](path['join'](config[_0x6c4d('0x57')],_0x6c4d('0x5f')),_0x6c4d('0x59'));var _0x27a06a=ejs[_0x6c4d('0x5a')](_0x690c5f,{'networks':_0x45c0eb||[]});fs[_0x6c4d('0x5b')](_0x6c4d('0x60'),_0x27a06a);return respondWithRpcPromise(_0x6c4d('0x61'),_0x6c4d('0x51'),{'module':_0x6c4d('0x5d')});}else{var _0x2ee181=fs['readFileSync'](path[_0x6c4d('0x62')](config['root'],_0x6c4d('0x63')),_0x6c4d('0x59'));var _0x50739c=ejs['render'](_0x2ee181,{'networks':_0x45c0eb||[]});fs[_0x6c4d('0x5b')](util['format'](_0x6c4d('0x64'),_0x5e990f[_0x6c4d('0x53')][_0x6c4d('0x3a')][_0x6c4d('0x65')]()),_0x50739c);return respondWithRpcPromise(_0x6c4d('0x61'),'create',{'module':_0x6c4d('0x66')});}return null;})[_0x6c4d('0x31')](function(){return _0x1b2129;});})[_0x6c4d('0x31')](respondWithResult(_0x30271c,0xc9))['catch'](handleError(_0x30271c,null));};exports[_0x6c4d('0x30')]=function(_0x223343,_0x16d792,_0x4e4631){var _0x42b177;return db[_0x6c4d('0x52')]['transaction'](function(_0x2dbe77){return db[_0x6c4d('0x37')]['find']({'where':{'id':_0x223343[_0x6c4d('0x4e')]['id']}})[_0x6c4d('0x31')](handleEntityNotFound(_0x16d792,null))[_0x6c4d('0x31')](saveUpdates(_0x223343[_0x6c4d('0x53')],null))['then'](function(_0xd0027a){if(_0xd0027a){_0x42b177=_0xd0027a;return db[_0x6c4d('0x37')]['findAll']({'where':{'type':_0x42b177[_0x6c4d('0x3a')]},'raw':!![]});}return null;})[_0x6c4d('0x31')](function(_0x157a4e){if(_0x42b177[_0x6c4d('0x3a')][_0x6c4d('0x54')]()=='STUN'){var _0x1695a3=fs[_0x6c4d('0x56')](path['join'](config['root'],_0x6c4d('0x58')),_0x6c4d('0x59'));var _0x15f296=ejs['render'](_0x1695a3,{'networks':_0x157a4e||[]});fs['writeFileSync'](_0x6c4d('0x5c'),_0x15f296);return respondWithRpcPromise(_0x6c4d('0x61'),'update',{'module':'res_stun_monitor.so'});}else if(_0x42b177[_0x6c4d('0x3a')]['toUpperCase']()=='TURN'){var _0x36280b=fs[_0x6c4d('0x56')](path['join'](config[_0x6c4d('0x57')],_0x6c4d('0x5f')),_0x6c4d('0x59'));var _0x391864=ejs[_0x6c4d('0x5a')](_0x36280b,{'networks':_0x157a4e||[]});fs[_0x6c4d('0x5b')](_0x6c4d('0x60'),_0x391864);return respondWithRpcPromise(_0x6c4d('0x61'),_0x6c4d('0x30'),{'module':_0x6c4d('0x5d')});}else{var _0x54eae2=fs['readFileSync'](path[_0x6c4d('0x62')](config['root'],_0x6c4d('0x63')),_0x6c4d('0x59'));var _0x4c1b5c=ejs[_0x6c4d('0x5a')](_0x54eae2,{'networks':_0x157a4e||[]});fs[_0x6c4d('0x5b')](util[_0x6c4d('0x67')](_0x6c4d('0x64'),_0x223343[_0x6c4d('0x53')]['type'][_0x6c4d('0x65')]()),_0x4c1b5c);return respondWithRpcPromise(_0x6c4d('0x61'),_0x6c4d('0x30'),{'module':_0x6c4d('0x66')});}return null;})[_0x6c4d('0x31')](function(_0x1224f5){if(_0x1224f5){return _0x42b177;}return null;});})[_0x6c4d('0x31')](respondWithResult(_0x16d792,null))[_0x6c4d('0x24')](handleError(_0x16d792,null));};exports['destroy']=function(_0x3e73c6,_0x1da4f9,_0x191043){var _0x4fe3b5;return db[_0x6c4d('0x37')][_0x6c4d('0x50')]({'where':{'id':_0x3e73c6['params']['id']}})['then'](function(_0x3673d4){_0x4fe3b5=_0x3673d4;return _0x3673d4;})[_0x6c4d('0x31')](handleEntityNotFound(_0x1da4f9,null))['then'](removeEntity(_0x1da4f9,null))[_0x6c4d('0x31')](function(){if(_0x4fe3b5){return db[_0x6c4d('0x37')][_0x6c4d('0x4c')]({'where':{'type':_0x4fe3b5[_0x6c4d('0x3a')]},'raw':!![]});}})['then'](function(_0xea8447){if(_0x4fe3b5[_0x6c4d('0x3a')][_0x6c4d('0x54')]()==_0x6c4d('0x55')){var _0x1779cd=fs['readFileSync'](path[_0x6c4d('0x62')](config[_0x6c4d('0x57')],'server/files/templates/stun_multiple.ejs'),_0x6c4d('0x59'));var _0x3e316c=ejs[_0x6c4d('0x5a')](_0x1779cd,{'networks':_0xea8447||[]});fs[_0x6c4d('0x5b')](_0x6c4d('0x5c'),_0x3e316c);return respondWithRpcPromise(_0x6c4d('0x61'),_0x6c4d('0x32'),{'module':'res_stun_monitor.so'});}else if(_0x4fe3b5[_0x6c4d('0x3a')][_0x6c4d('0x54')]()==_0x6c4d('0x5e')){var _0x248286=fs[_0x6c4d('0x56')](path['join'](config[_0x6c4d('0x57')],_0x6c4d('0x5f')),_0x6c4d('0x59'));var _0x15cad3=ejs['render'](_0x248286,{'networks':_0xea8447||[]});fs[_0x6c4d('0x5b')](_0x6c4d('0x60'),_0x15cad3);return respondWithRpcPromise(_0x6c4d('0x61'),'destroy',{'module':_0x6c4d('0x5d')});}else{var _0xac1717=fs[_0x6c4d('0x56')](path['join'](config['root'],'server/files/templates/network.ejs'),_0x6c4d('0x59'));var _0x317068=ejs[_0x6c4d('0x5a')](_0xac1717,{'networks':_0xea8447||[]});fs[_0x6c4d('0x5b')](util[_0x6c4d('0x67')](_0x6c4d('0x64'),_0x3e73c6[_0x6c4d('0x53')][_0x6c4d('0x3a')]['toLowerCase']()),_0x317068);return respondWithRpcPromise(_0x6c4d('0x61'),'destroy',{'module':'chan_sip.so'});}return null;})[_0x6c4d('0x24')](handleError(_0x1da4f9,null));}; \ No newline at end of file +var _0xcae8=['to-csv','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','request\x20sent','debug','stringify','error','code','Network,\x20%s,\x20%s','message','result','catch','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','stack','name','index','map','Network','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','create','sequelize','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','Reload','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','transaction','find','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','server/files/templates/network.ejs','/etc/asterisk/turn_xcally.conf','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xcae8,0xcb));var _0x8cae=function(_0x1306f3,_0x1da761){_0x1306f3=_0x1306f3-0x0;var _0xc1c7bf=_0xcae8[_0x1306f3];return _0xc1c7bf;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x8cae('0x0'));var zipdir=require(_0x8cae('0x1'));var jsonpatch=require(_0x8cae('0x2'));var rp=require(_0x8cae('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8cae('0x4'));var util=require(_0x8cae('0x5'));var path=require('path');var sox=require(_0x8cae('0x6'));var csv=require(_0x8cae('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8cae('0x8'));var squel=require(_0x8cae('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8cae('0xa'));var toCsv=require(_0x8cae('0x7'));var querystring=require('querystring');var Papa=require(_0x8cae('0xb'));var Redis=require(_0x8cae('0xc'));var authService=require(_0x8cae('0xd'));var qs=require(_0x8cae('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8cae('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0x8cae('0x10'));var config=require(_0x8cae('0x11'));var db=require(_0x8cae('0x12'))['db'];var jayson=require(_0x8cae('0x13'));var client=jayson[_0x8cae('0x14')][_0x8cae('0x15')]({'port':0x232a});function checkPasswordPattern(_0x1c420a,_0x2d526d,_0x3ec480){if(_0x3ec480){var _0x5a5e24=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5a5e24[_0x8cae('0x16')](_0x2d526d)){return _0x1c420a;}else{throw new db[(_0x8cae('0x17'))][(_0x8cae('0x18'))](_0x8cae('0x19'));}}else{return _0x1c420a;}}function respondWithRpcPromise(_0x180ac4,_0x10c941,_0x154076,_0x25e9fa){return new BPromise(function(_0x378724,_0x207861){var _0x356675=_0x25e9fa||client;return _0x356675[_0x8cae('0x1a')](_0x180ac4,_0x154076)['then'](function(_0x14999d){logger[_0x8cae('0x1b')]('Network,\x20%s,\x20%s',_0x10c941,_0x8cae('0x1c'));logger[_0x8cae('0x1d')]('Network,\x20%s,\x20%s,\x20%s',_0x10c941,_0x8cae('0x1c'),JSON[_0x8cae('0x1e')](_0x14999d));if(_0x14999d[_0x8cae('0x1f')]){if(_0x14999d[_0x8cae('0x1f')][_0x8cae('0x20')]===0x1f4){logger[_0x8cae('0x1f')](_0x8cae('0x21'),_0x10c941,_0x14999d[_0x8cae('0x1f')]['message']);return _0x207861(_0x14999d[_0x8cae('0x1f')][_0x8cae('0x22')]);}logger['error'](_0x8cae('0x21'),_0x10c941,_0x14999d['error'][_0x8cae('0x22')]);return _0x378724(_0x14999d[_0x8cae('0x1f')][_0x8cae('0x22')]);}else{logger[_0x8cae('0x1b')](_0x8cae('0x21'),_0x10c941,_0x8cae('0x1c'));_0x378724(_0x14999d[_0x8cae('0x23')][_0x8cae('0x22')]);}})[_0x8cae('0x24')](function(_0x4302b1){logger[_0x8cae('0x1f')](_0x8cae('0x21'),_0x10c941,_0x4302b1);_0x207861(_0x4302b1);});});}function respondWithStatusCode(_0x516dd3,_0x51257f){_0x51257f=_0x51257f||0xcc;return function(_0x54e478){if(_0x54e478){return _0x516dd3['sendStatus'](_0x51257f);}return _0x516dd3[_0x8cae('0x25')](_0x51257f)[_0x8cae('0x26')]();};}function respondWithResult(_0x4a19b4,_0x60f6f2){_0x60f6f2=_0x60f6f2||0xc8;return function(_0xd843d){if(_0xd843d){return _0x4a19b4[_0x8cae('0x25')](_0x60f6f2)['json'](_0xd843d);}};}function respondWithFilteredResult(_0x2d143c,_0x197345){return function(_0x38962c){if(_0x38962c){var _0x186af2=_0x38962c[_0x8cae('0x27')],_0x25cc1e=_0x197345[_0x8cae('0x28')],_0x5b8573=_0x197345[_0x8cae('0x28')]+_0x197345['limit'],_0x41366f;if(_0x5b8573>=_0x186af2){_0x5b8573=_0x186af2;_0x41366f=0xc8;}else{_0x41366f=0xce;}_0x2d143c[_0x8cae('0x25')](_0x41366f);return _0x2d143c[_0x8cae('0x29')](_0x8cae('0x2a'),_0x25cc1e+'-'+_0x5b8573+'/'+_0x186af2)[_0x8cae('0x2b')](_0x38962c);}return null;};}function patchUpdates(_0x54497f){return function(_0x2b9412){try{jsonpatch[_0x8cae('0x2c')](_0x2b9412,_0x54497f,!![]);}catch(_0x32c112){return BPromise[_0x8cae('0x2d')](_0x32c112);}return _0x2b9412[_0x8cae('0x2e')]();};}function saveUpdates(_0x851cd4,_0xfc988d){return function(_0x16c3e8){if(_0x16c3e8){return _0x16c3e8[_0x8cae('0x2f')](_0x851cd4)[_0x8cae('0x30')](function(_0x107b06){return _0x107b06;});}return null;};}function removeEntity(_0x461ca7,_0x2480d4){return function(_0x5b263b){if(_0x5b263b){return _0x5b263b[_0x8cae('0x31')]()[_0x8cae('0x30')](function(){_0x461ca7[_0x8cae('0x25')](0xcc)[_0x8cae('0x26')]();});}};}function handleEntityNotFound(_0x3b4384,_0x3c3ea3){return function(_0x388432){if(!_0x388432){_0x3b4384[_0x8cae('0x32')](0x194);}return _0x388432;};}function handleError(_0x5d39fc,_0x499482){_0x499482=_0x499482||0x1f4;return function(_0x398058){logger[_0x8cae('0x1f')](_0x398058[_0x8cae('0x33')]);if(_0x398058[_0x8cae('0x34')]){delete _0x398058[_0x8cae('0x34')];}_0x5d39fc[_0x8cae('0x25')](_0x499482)['send'](_0x398058);};}exports[_0x8cae('0x35')]=function(_0x1f3433,_0x142b19){var _0x152345={},_0x4e9c68={},_0x41755a={'count':0x0,'rows':[]};var _0x2f625a=_[_0x8cae('0x36')](db[_0x8cae('0x37')][_0x8cae('0x38')],function(_0x519d29){return{'name':_0x519d29['fieldName'],'type':_0x519d29[_0x8cae('0x39')][_0x8cae('0x3a')]};});_0x4e9c68[_0x8cae('0x3b')]=_[_0x8cae('0x36')](_0x2f625a,'name');_0x4e9c68['query']=_[_0x8cae('0x3c')](_0x1f3433[_0x8cae('0x3d')]);_0x4e9c68['filters']=_[_0x8cae('0x3e')](_0x4e9c68[_0x8cae('0x3b')],_0x4e9c68['query']);_0x152345[_0x8cae('0x3f')]=_[_0x8cae('0x3e')](_0x4e9c68[_0x8cae('0x3b')],qs[_0x8cae('0x40')](_0x1f3433[_0x8cae('0x3d')][_0x8cae('0x40')]));_0x152345[_0x8cae('0x3f')]=_0x152345[_0x8cae('0x3f')]['length']?_0x152345[_0x8cae('0x3f')]:_0x4e9c68[_0x8cae('0x3b')];if(!_0x1f3433[_0x8cae('0x3d')]['hasOwnProperty']('nolimit')){_0x152345[_0x8cae('0x41')]=qs[_0x8cae('0x41')](_0x1f3433[_0x8cae('0x3d')][_0x8cae('0x41')]);_0x152345['offset']=qs[_0x8cae('0x28')](_0x1f3433[_0x8cae('0x3d')]['offset']);}_0x152345[_0x8cae('0x42')]=qs['sort'](_0x1f3433['query'][_0x8cae('0x43')]);_0x152345['where']=qs['filters'](_[_0x8cae('0x44')](_0x1f3433[_0x8cae('0x3d')],_0x4e9c68['filters']));if(_0x1f3433[_0x8cae('0x3d')][_0x8cae('0x45')]){_0x152345[_0x8cae('0x46')]=_[_0x8cae('0x47')](_0x152345[_0x8cae('0x46')],{'$or':_[_0x8cae('0x36')](_0x2f625a,function(_0x4d15ca){if(_0x4d15ca[_0x8cae('0x39')]!==_0x8cae('0x48')){var _0x8921cc={};_0x8921cc[_0x4d15ca[_0x8cae('0x34')]]={'$like':'%'+_0x1f3433['query']['filter']+'%'};return _0x8921cc;}})});}_0x152345=_[_0x8cae('0x47')]({},_0x152345,_0x1f3433[_0x8cae('0x49')]);var _0x4df3ad={'where':_0x152345['where']};return db['Network'][_0x8cae('0x27')](_0x4df3ad)[_0x8cae('0x30')](function(_0x42ee8a){_0x41755a[_0x8cae('0x27')]=_0x42ee8a;if(_0x1f3433[_0x8cae('0x3d')][_0x8cae('0x4a')]){_0x152345[_0x8cae('0x4b')]=[{'all':!![]}];}return db['Network'][_0x8cae('0x4c')](_0x152345);})[_0x8cae('0x30')](function(_0x56faab){_0x41755a[_0x8cae('0x4d')]=_0x56faab;return _0x41755a;})[_0x8cae('0x30')](respondWithFilteredResult(_0x142b19,_0x152345))[_0x8cae('0x24')](handleError(_0x142b19,null));};exports[_0x8cae('0x4e')]=function(_0xb438ea,_0x46c91a){var _0x5860f4={'raw':!![],'where':{'id':_0xb438ea[_0x8cae('0x4f')]['id']}},_0x4aed4c={};_0x4aed4c['model']=_[_0x8cae('0x3c')](db[_0x8cae('0x37')]['rawAttributes']);_0x4aed4c[_0x8cae('0x3d')]=_[_0x8cae('0x3c')](_0xb438ea[_0x8cae('0x3d')]);_0x4aed4c['filters']=_[_0x8cae('0x3e')](_0x4aed4c[_0x8cae('0x3b')],_0x4aed4c['query']);_0x5860f4[_0x8cae('0x3f')]=_[_0x8cae('0x3e')](_0x4aed4c[_0x8cae('0x3b')],qs[_0x8cae('0x40')](_0xb438ea['query']['fields']));_0x5860f4[_0x8cae('0x3f')]=_0x5860f4['attributes']['length']?_0x5860f4['attributes']:_0x4aed4c[_0x8cae('0x3b')];if(_0xb438ea[_0x8cae('0x3d')]['includeAll']){_0x5860f4['include']=[{'all':!![]}];}_0x5860f4=_[_0x8cae('0x47')]({},_0x5860f4,_0xb438ea[_0x8cae('0x49')]);return db[_0x8cae('0x37')]['find'](_0x5860f4)[_0x8cae('0x30')](handleEntityNotFound(_0x46c91a,null))[_0x8cae('0x30')](respondWithResult(_0x46c91a,null))[_0x8cae('0x24')](handleError(_0x46c91a,null));};exports[_0x8cae('0x50')]=function(_0x4691f8,_0x3135c8,_0x2e4b59){var _0x5e3e51;return db[_0x8cae('0x51')]['transaction'](function(_0x29a65d){return db[_0x8cae('0x37')][_0x8cae('0x50')](_0x4691f8[_0x8cae('0x52')],{'raw':!![]})['then'](function(_0x4baf63){_0x5e3e51=_0x4baf63;return db[_0x8cae('0x37')][_0x8cae('0x4c')]({'where':{'type':_0x4691f8['body'][_0x8cae('0x39')]},'raw':!![]});})[_0x8cae('0x30')](function(_0x3b490f){if(_0x5e3e51[_0x8cae('0x39')][_0x8cae('0x53')]()==_0x8cae('0x54')){var _0x497ddd=fs[_0x8cae('0x55')](path[_0x8cae('0x56')](config[_0x8cae('0x57')],_0x8cae('0x58')),_0x8cae('0x59'));var _0x224bcc=ejs[_0x8cae('0x5a')](_0x497ddd,{'networks':_0x3b490f||[]});fs[_0x8cae('0x5b')]('/etc/asterisk/stun_xcally.conf',_0x224bcc);return respondWithRpcPromise(_0x8cae('0x5c'),_0x8cae('0x50'),{'module':'res_stun_monitor.so'});}else if(_0x5e3e51[_0x8cae('0x39')][_0x8cae('0x53')]()=='TURN'){var _0x421ce2=fs[_0x8cae('0x55')](path[_0x8cae('0x56')](config[_0x8cae('0x57')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x5a6e33=ejs[_0x8cae('0x5a')](_0x421ce2,{'networks':_0x3b490f||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x5a6e33);return respondWithRpcPromise(_0x8cae('0x5c'),_0x8cae('0x50'),{'module':'res_stun_monitor.so'});}else{var _0x57ab27=fs['readFileSync'](path['join'](config[_0x8cae('0x57')],'server/files/templates/network.ejs'),'utf8');var _0x127b66=ejs[_0x8cae('0x5a')](_0x57ab27,{'networks':_0x3b490f||[]});fs[_0x8cae('0x5b')](util[_0x8cae('0x5d')](_0x8cae('0x5e'),_0x4691f8[_0x8cae('0x52')][_0x8cae('0x39')][_0x8cae('0x5f')]()),_0x127b66);return respondWithRpcPromise(_0x8cae('0x5c'),_0x8cae('0x50'),{'module':_0x8cae('0x60')});}return null;})['then'](function(){return _0x5e3e51;});})[_0x8cae('0x30')](respondWithResult(_0x3135c8,0xc9))[_0x8cae('0x24')](handleError(_0x3135c8,null));};exports[_0x8cae('0x2f')]=function(_0x1d7e82,_0x45a3aa,_0x70ff80){var _0x53dfed;return db[_0x8cae('0x51')][_0x8cae('0x61')](function(_0x5c0a02){return db[_0x8cae('0x37')][_0x8cae('0x62')]({'where':{'id':_0x1d7e82[_0x8cae('0x4f')]['id']}})['then'](handleEntityNotFound(_0x45a3aa,null))[_0x8cae('0x30')](saveUpdates(_0x1d7e82[_0x8cae('0x52')],null))[_0x8cae('0x30')](function(_0xc661f){if(_0xc661f){_0x53dfed=_0xc661f;return db[_0x8cae('0x37')][_0x8cae('0x4c')]({'where':{'type':_0x53dfed[_0x8cae('0x39')]},'raw':!![]});}return null;})[_0x8cae('0x30')](function(_0x276695){if(_0x53dfed[_0x8cae('0x39')][_0x8cae('0x53')]()==_0x8cae('0x54')){var _0x2ed53a=fs[_0x8cae('0x55')](path[_0x8cae('0x56')](config[_0x8cae('0x57')],_0x8cae('0x58')),_0x8cae('0x59'));var _0x2dd84d=ejs['render'](_0x2ed53a,{'networks':_0x276695||[]});fs[_0x8cae('0x5b')](_0x8cae('0x63'),_0x2dd84d);return respondWithRpcPromise(_0x8cae('0x5c'),_0x8cae('0x2f'),{'module':_0x8cae('0x64')});}else if(_0x53dfed['type']['toUpperCase']()==_0x8cae('0x65')){var _0x476f80=fs[_0x8cae('0x55')](path[_0x8cae('0x56')](config[_0x8cae('0x57')],_0x8cae('0x66')),_0x8cae('0x59'));var _0xf2fc21=ejs[_0x8cae('0x5a')](_0x476f80,{'networks':_0x276695||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0xf2fc21);return respondWithRpcPromise(_0x8cae('0x5c'),_0x8cae('0x2f'),{'module':_0x8cae('0x64')});}else{var _0xd37bf5=fs[_0x8cae('0x55')](path[_0x8cae('0x56')](config[_0x8cae('0x57')],_0x8cae('0x67')),_0x8cae('0x59'));var _0x205686=ejs['render'](_0xd37bf5,{'networks':_0x276695||[]});fs[_0x8cae('0x5b')](util[_0x8cae('0x5d')]('/etc/asterisk/sip_xcally_%s.conf',_0x1d7e82[_0x8cae('0x52')][_0x8cae('0x39')][_0x8cae('0x5f')]()),_0x205686);return respondWithRpcPromise(_0x8cae('0x5c'),_0x8cae('0x2f'),{'module':_0x8cae('0x60')});}return null;})[_0x8cae('0x30')](function(_0x3045b0){if(_0x3045b0){return _0x53dfed;}return null;});})[_0x8cae('0x30')](respondWithResult(_0x45a3aa,null))[_0x8cae('0x24')](handleError(_0x45a3aa,null));};exports['destroy']=function(_0x5ca8d2,_0x409182,_0x4dcce5){var _0x2e0be1;return db[_0x8cae('0x37')][_0x8cae('0x62')]({'where':{'id':_0x5ca8d2['params']['id']}})['then'](function(_0x2a115e){_0x2e0be1=_0x2a115e;return _0x2a115e;})[_0x8cae('0x30')](handleEntityNotFound(_0x409182,null))['then'](removeEntity(_0x409182,null))[_0x8cae('0x30')](function(){if(_0x2e0be1){return db['Network']['findAll']({'where':{'type':_0x2e0be1['type']},'raw':!![]});}})[_0x8cae('0x30')](function(_0x35a874){if(_0x2e0be1['type'][_0x8cae('0x53')]()==_0x8cae('0x54')){var _0x81a5d4=fs['readFileSync'](path[_0x8cae('0x56')](config[_0x8cae('0x57')],_0x8cae('0x58')),_0x8cae('0x59'));var _0xc1489e=ejs['render'](_0x81a5d4,{'networks':_0x35a874||[]});fs[_0x8cae('0x5b')](_0x8cae('0x63'),_0xc1489e);return respondWithRpcPromise('Reload',_0x8cae('0x31'),{'module':_0x8cae('0x64')});}else if(_0x2e0be1[_0x8cae('0x39')][_0x8cae('0x53')]()==_0x8cae('0x65')){var _0x486165=fs[_0x8cae('0x55')](path[_0x8cae('0x56')](config['root'],_0x8cae('0x66')),'utf8');var _0x5cecc0=ejs[_0x8cae('0x5a')](_0x486165,{'networks':_0x35a874||[]});fs['writeFileSync'](_0x8cae('0x68'),_0x5cecc0);return respondWithRpcPromise(_0x8cae('0x5c'),_0x8cae('0x31'),{'module':_0x8cae('0x64')});}else{var _0x2e4abe=fs[_0x8cae('0x55')](path[_0x8cae('0x56')](config[_0x8cae('0x57')],_0x8cae('0x67')),_0x8cae('0x59'));var _0x1c3a3e=ejs[_0x8cae('0x5a')](_0x2e4abe,{'networks':_0x35a874||[]});fs[_0x8cae('0x5b')](util[_0x8cae('0x5d')](_0x8cae('0x5e'),_0x5ca8d2[_0x8cae('0x52')]['type'][_0x8cae('0x5f')]()),_0x1c3a3e);return respondWithRpcPromise('Reload','destroy',{'module':'chan_sip.so'});}return null;})[_0x8cae('0x24')](handleError(_0x409182,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 8732af0..f65903d 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 _0x66ff=['request-promise','rimraf','../../config/environment','define','network','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1529a3,_0x529f63){var _0x1a0d4b=function(_0x6f1058){while(--_0x6f1058){_0x1529a3['push'](_0x1529a3['shift']());}};_0x1a0d4b(++_0x529f63);}(_0x66ff,0x73));var _0xf66f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x66ff[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf66f('0x0'));var util=require(_0xf66f('0x1'));var logger=require(_0xf66f('0x2'))(_0xf66f('0x3'));var moment=require(_0xf66f('0x4'));var BPromise=require(_0xf66f('0x5'));var rp=require(_0xf66f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf66f('0x7'));var config=require(_0xf66f('0x8'));var attributes=require('./network.attributes');module['exports']=function(_0x58e441,_0x3eb340){return _0x58e441[_0xf66f('0x9')]('Network',attributes,{'tableName':_0xf66f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6466=['./network.attributes','exports','define','Network','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment'];(function(_0x441f6e,_0x56459e){var _0x46e675=function(_0xc0320b){while(--_0xc0320b){_0x441f6e['push'](_0x441f6e['shift']());}};_0x46e675(++_0x56459e);}(_0x6466,0x122));var _0x6646=function(_0x2e9999,_0x559e9a){_0x2e9999=_0x2e9999-0x0;var _0x3d034c=_0x6466[_0x2e9999];return _0x3d034c;};'use strict';var _=require(_0x6646('0x0'));var util=require(_0x6646('0x1'));var logger=require(_0x6646('0x2'))('api');var moment=require(_0x6646('0x3'));var BPromise=require(_0x6646('0x4'));var rp=require(_0x6646('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6646('0x6'));var attributes=require(_0x6646('0x7'));module[_0x6646('0x8')]=function(_0x3a7a1e,_0x34f6d2){return _0x3a7a1e[_0x6646('0x9')](_0x6646('0xa'),attributes,{'tableName':'network','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 9f940ac..259d5a4 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 _0xc627=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0x9d425b,_0x4dc33f){var _0x442621=function(_0x32e1ab){while(--_0x32e1ab){_0x9d425b['push'](_0x9d425b['shift']());}};_0x442621(++_0x4dc33f);}(_0xc627,0x126));var _0x7c62=function(_0x368f2b,_0xc912a9){_0x368f2b=_0x368f2b-0x0;var _0x1bb808=_0xc627[_0x368f2b];return _0x1bb808;};'use strict';var _=require(_0x7c62('0x0'));var util=require('util');var moment=require(_0x7c62('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7c62('0x2'));var db=require(_0x7c62('0x3'))['db'];var utils=require(_0x7c62('0x4'));var logger=require(_0x7c62('0x5'))(_0x7c62('0x6'));var config=require(_0x7c62('0x7'));var jayson=require(_0x7c62('0x8'));var client=jayson[_0x7c62('0x9')][_0x7c62('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c4c5f,_0x9ded2e,_0x852951){return new BPromise(function(_0x724e74,_0x41535d){return client['request'](_0x1c4c5f,_0x852951)[_0x7c62('0xb')](function(_0x81f640){logger[_0x7c62('0xc')](_0x7c62('0xd'),_0x9ded2e,'request\x20sent');logger[_0x7c62('0xe')](_0x7c62('0xf'),_0x9ded2e,'request\x20sent',JSON[_0x7c62('0x10')](_0x81f640));if(_0x81f640[_0x7c62('0x11')]){if(_0x81f640[_0x7c62('0x11')][_0x7c62('0x12')]===0x1f4){logger[_0x7c62('0x11')](_0x7c62('0xd'),_0x9ded2e,_0x81f640['error'][_0x7c62('0x13')]);return _0x41535d(_0x81f640[_0x7c62('0x11')][_0x7c62('0x13')]);}logger['error']('Network,\x20%s,\x20%s',_0x9ded2e,_0x81f640[_0x7c62('0x11')][_0x7c62('0x13')]);return _0x724e74(_0x81f640['error'][_0x7c62('0x13')]);}else{logger[_0x7c62('0xc')]('Network,\x20%s,\x20%s',_0x9ded2e,_0x7c62('0x14'));_0x724e74(_0x81f640[_0x7c62('0x15')][_0x7c62('0x13')]);}})[_0x7c62('0x16')](function(_0x4cd9d5){logger[_0x7c62('0x11')]('Network,\x20%s,\x20%s',_0x9ded2e,_0x4cd9d5);_0x41535d(_0x4cd9d5);});});} \ No newline at end of file +var _0xc1e2=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util'];(function(_0x42cb0c,_0x148d03){var _0x4ac84b=function(_0x5c4516){while(--_0x5c4516){_0x42cb0c['push'](_0x42cb0c['shift']());}};_0x4ac84b(++_0x148d03);}(_0xc1e2,0x139));var _0x2c1e=function(_0x9edf8f,_0x129e70){_0x9edf8f=_0x9edf8f-0x0;var _0x4882c1=_0xc1e2[_0x9edf8f];return _0x4882c1;};'use strict';var _=require(_0x2c1e('0x0'));var util=require(_0x2c1e('0x1'));var moment=require('moment');var BPromise=require(_0x2c1e('0x2'));var rs=require(_0x2c1e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2c1e('0x4'))['db'];var utils=require(_0x2c1e('0x5'));var logger=require(_0x2c1e('0x6'))('rpc');var config=require(_0x2c1e('0x7'));var jayson=require(_0x2c1e('0x8'));var client=jayson[_0x2c1e('0x9')][_0x2c1e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xac1181,_0x5e4c51,_0x1847e7){return new BPromise(function(_0x32e173,_0x264f9c){return client[_0x2c1e('0xb')](_0xac1181,_0x1847e7)['then'](function(_0x2374c6){logger[_0x2c1e('0xc')](_0x2c1e('0xd'),_0x5e4c51,_0x2c1e('0xe'));logger['debug'](_0x2c1e('0xf'),_0x5e4c51,'request\x20sent',JSON['stringify'](_0x2374c6));if(_0x2374c6[_0x2c1e('0x10')]){if(_0x2374c6[_0x2c1e('0x10')][_0x2c1e('0x11')]===0x1f4){logger[_0x2c1e('0x10')](_0x2c1e('0xd'),_0x5e4c51,_0x2374c6[_0x2c1e('0x10')][_0x2c1e('0x12')]);return _0x264f9c(_0x2374c6['error']['message']);}logger[_0x2c1e('0x10')](_0x2c1e('0xd'),_0x5e4c51,_0x2374c6[_0x2c1e('0x10')][_0x2c1e('0x12')]);return _0x32e173(_0x2374c6[_0x2c1e('0x10')][_0x2c1e('0x12')]);}else{logger[_0x2c1e('0xc')]('Network,\x20%s,\x20%s',_0x5e4c51,_0x2c1e('0xe'));_0x32e173(_0x2374c6[_0x2c1e('0x13')][_0x2c1e('0x12')]);}})[_0x2c1e('0x14')](function(_0x138881){logger[_0x2c1e('0x10')](_0x2c1e('0xd'),_0x5e4c51,_0x138881);_0x264f9c(_0x138881);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index 6d85dfd..8cdabc0 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 _0x2df6=['../../components/interaction/service','../../config/environment','./notification.controller','post','isAuthenticated','sendNotification','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x3a368d,_0x1fe235){var _0xf8a17e=function(_0x327e1e){while(--_0x327e1e){_0x3a368d['push'](_0x3a368d['shift']());}};_0xf8a17e(++_0x1fe235);}(_0x2df6,0xb0));var _0x62df=function(_0x5b8723,_0x171c83){_0x5b8723=_0x5b8723-0x0;var _0x44d58e=_0x2df6[_0x5b8723];return _0x44d58e;};'use strict';var multer=require(_0x62df('0x0'));var util=require(_0x62df('0x1'));var path=require(_0x62df('0x2'));var timeout=require(_0x62df('0x3'));var express=require(_0x62df('0x4'));var router=express[_0x62df('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x62df('0x6'));var config=require(_0x62df('0x7'));var controller=require(_0x62df('0x8'));router[_0x62df('0x9')]('/',auth[_0x62df('0xa')](),controller[_0x62df('0xb')]);module[_0x62df('0xc')]=router; \ No newline at end of file +var _0x4117=['util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','post','isAuthenticated','sendNotification','multer'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4117,0x1e9));var _0x7411=function(_0x2c42d7,_0x5941a8){_0x2c42d7=_0x2c42d7-0x0;var _0x1adb20=_0x4117[_0x2c42d7];return _0x1adb20;};'use strict';var multer=require(_0x7411('0x0'));var util=require(_0x7411('0x1'));var path=require('path');var timeout=require(_0x7411('0x2'));var express=require(_0x7411('0x3'));var router=express[_0x7411('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x7411('0x5'));var config=require(_0x7411('0x6'));var controller=require('./notification.controller');router[_0x7411('0x7')]('/',auth[_0x7411('0x8')](),controller[_0x7411('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/notification/notification.attributes.js b/server/api/notification/notification.attributes.js index 8c88267..ebdf54b 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 _0x73d6=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x73d6,0x172));var _0x673d=function(_0xa72a90,_0x3d2ff5){_0xa72a90=_0xa72a90-0x0;var _0x264a45=_0x73d6[_0xa72a90];return _0x264a45;};'use strict';var Sequelize=require(_0x673d('0x0'));module[_0x673d('0x1')]={'body':{'type':Sequelize[_0x673d('0x2')]},'senderName':{'type':Sequelize[_0x673d('0x3')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x673d('0x3')]},'beep':{'type':Sequelize[_0x673d('0x4')]}}; \ No newline at end of file +var _0x83d3=['STRING','BOOLEAN','exports','TEXT'];(function(_0xa4efd9,_0x32e05c){var _0x2e708a=function(_0x36320e){while(--_0x36320e){_0xa4efd9['push'](_0xa4efd9['shift']());}};_0x2e708a(++_0x32e05c);}(_0x83d3,0x1ce));var _0x383d=function(_0x1a0600,_0x41feef){_0x1a0600=_0x1a0600-0x0;var _0x734670=_0x83d3[_0x1a0600];return _0x734670;};'use strict';var Sequelize=require('sequelize');module[_0x383d('0x0')]={'body':{'type':Sequelize[_0x383d('0x1')]},'senderName':{'type':Sequelize[_0x383d('0x2')]},'recipientsId':{'type':Sequelize[_0x383d('0x1')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x383d('0x3')]}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index 1b07361..7395fa9 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 _0xbef9=['Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','SenderId','recipientsId','join','sequelize','transaction','create','recipient','emit','notification:send','catch','Template','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','view','forEach','startCase','User','union','ids','queue','Queue','push','all','flatten','findOne','getAgents','map','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./notification.socket','register','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','then','destroy','stack','name','send','sendNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Missing\x20\x27view\x27\x20parameter','recipients'];(function(_0x1bcb17,_0x492d13){var _0x21432d=function(_0x11b25a){while(--_0x11b25a){_0x1bcb17['push'](_0x1bcb17['shift']());}};_0x21432d(++_0x492d13);}(_0xbef9,0x1b7));var _0x9bef=function(_0x471a31,_0x2bf98e){_0x471a31=_0x471a31-0x0;var _0x4aa01e=_0xbef9[_0x471a31];return _0x4aa01e;};'use strict';var pdf=require(_0x9bef('0x0'));var emlformat=require(_0x9bef('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9bef('0x2'));var jsonpatch=require(_0x9bef('0x3'));var rp=require(_0x9bef('0x4'));var moment=require('moment');var BPromise=require(_0x9bef('0x5'));var Mustache=require(_0x9bef('0x6'));var util=require(_0x9bef('0x7'));var path=require(_0x9bef('0x8'));var sox=require(_0x9bef('0x9'));var csv=require(_0x9bef('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x9bef('0xb'));var crypto=require(_0x9bef('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9bef('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9bef('0xe'));var Redis=require('ioredis');var authService=require(_0x9bef('0xf'));var qs=require(_0x9bef('0x10'));var as=require(_0x9bef('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9bef('0x12'));var utils=require(_0x9bef('0x13'));var config=require('../../config/environment');var db=require(_0x9bef('0x14'))['db'];config[_0x9bef('0x15')]=_[_0x9bef('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9bef('0x17'))(new Redis(config[_0x9bef('0x15')]));require(_0x9bef('0x18'))[_0x9bef('0x19')](socket);function respondWithStatusCode(_0x5dff5c,_0x200ab9){_0x200ab9=_0x200ab9||0xcc;return function(_0x5a6043){if(_0x5a6043){return _0x5dff5c[_0x9bef('0x1a')](_0x200ab9);}return _0x5dff5c[_0x9bef('0x1b')](_0x200ab9)[_0x9bef('0x1c')]();};}function respondWithResult(_0x21cf82,_0x6de056){_0x6de056=_0x6de056||0xc8;return function(_0x2ca774){if(_0x2ca774){return _0x21cf82[_0x9bef('0x1b')](_0x6de056)['json'](_0x2ca774);}};}function respondWithFilteredResult(_0x2f7c3b,_0xc00e19){return function(_0x1fce76){if(_0x1fce76){var _0x3b62bd=_0x1fce76[_0x9bef('0x1d')],_0x2f0a61=_0xc00e19[_0x9bef('0x1e')],_0x107a03=_0xc00e19['offset']+_0xc00e19['limit'],_0x2532bf;if(_0x107a03>=_0x3b62bd){_0x107a03=_0x3b62bd;_0x2532bf=0xc8;}else{_0x2532bf=0xce;}_0x2f7c3b[_0x9bef('0x1b')](_0x2532bf);return _0x2f7c3b[_0x9bef('0x1f')](_0x9bef('0x20'),_0x2f0a61+'-'+_0x107a03+'/'+_0x3b62bd)[_0x9bef('0x21')](_0x1fce76);}return null;};}function patchUpdates(_0x5c26bc){return function(_0x2b408a){try{jsonpatch[_0x9bef('0x22')](_0x2b408a,_0x5c26bc,!![]);}catch(_0x3f5036){return BPromise[_0x9bef('0x23')](_0x3f5036);}return _0x2b408a['save']();};}function saveUpdates(_0x909204,_0x582bfc){return function(_0x559723){if(_0x559723){return _0x559723['update'](_0x909204)[_0x9bef('0x24')](function(_0x2f1e84){return _0x2f1e84;});}return null;};}function removeEntity(_0x582a0f,_0xb6c6fd){return function(_0x773430){if(_0x773430){return _0x773430[_0x9bef('0x25')]()[_0x9bef('0x24')](function(){_0x582a0f[_0x9bef('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fce3e,_0x1d9a8f){return function(_0x279831){if(!_0x279831){_0x4fce3e[_0x9bef('0x1a')](0x194);}return _0x279831;};}function handleError(_0x57a894,_0x4cdeb9){_0x4cdeb9=_0x4cdeb9||0x1f4;return function(_0x24025f){logger['error'](_0x24025f[_0x9bef('0x26')]);if(_0x24025f[_0x9bef('0x27')]){delete _0x24025f[_0x9bef('0x27')];}_0x57a894[_0x9bef('0x1b')](_0x4cdeb9)[_0x9bef('0x28')](_0x24025f);};}exports[_0x9bef('0x29')]=function(_0x41e169,_0x89cf83,_0x4539fa){if(!_0x41e169[_0x9bef('0x2a')][_0x9bef('0x2b')](_0x9bef('0x2c'))&&!_0x41e169[_0x9bef('0x2a')][_0x9bef('0x2b')](_0x9bef('0x2d'))){throw new db[(_0x9bef('0x2e'))][(_0x9bef('0x2f'))](_0x9bef('0x30'));}else{if(_0x41e169[_0x9bef('0x2a')]['hasOwnProperty'](_0x9bef('0x2d'))&&!_0x41e169[_0x9bef('0x2a')][_0x9bef('0x2b')]('view')){throw new db['Sequelize'][(_0x9bef('0x2f'))](_0x9bef('0x31'));}if(!_0x41e169['body'][_0x9bef('0x2b')](_0x9bef('0x32'))){throw new db['Sequelize'][(_0x9bef('0x2f'))](_0x9bef('0x33'));}else{try{var _0x3e886d=JSON[_0x9bef('0x34')](_0x41e169[_0x9bef('0x2a')]['recipients']);}catch(_0x928265){logger['error'](_0x928265);throw new db[(_0x9bef('0x2e'))][(_0x9bef('0x2f'))](_0x9bef('0x35'));}var _0x131177=[_0x9bef('0x36'),_0x9bef('0x37'),_0x9bef('0x38'),_0x9bef('0x39'),'smsqueue','voicequeue',_0x9bef('0x3a'),_0x9bef('0x3b'),_0x9bef('0x3c')];if(_[_0x9bef('0x3d')](_0x3e886d,function(_0x5b7165){return!_[_0x9bef('0x3e')](_0x131177,_0x5b7165[_0x9bef('0x3f')][_0x9bef('0x40')]());})){throw new db['Sequelize'][(_0x9bef('0x2f'))](_0x9bef('0x41'));}}}var _0xa25749={};_0xa25749[_0x9bef('0x42')]=_0x41e169[_0x9bef('0x2a')][_0x9bef('0x2b')](_0x9bef('0x42'))?_0x41e169['body'][_0x9bef('0x42')]:_0x41e169['user'][_0x9bef('0x43')];_0xa25749[_0x9bef('0x44')]=_['isEmpty'](_0x41e169['body'][_0x9bef('0x44')])?null:_0x41e169[_0x9bef('0x2a')][_0x9bef('0x44')];_0xa25749[_0x9bef('0x45')]=_0x41e169[_0x9bef('0x2a')][_0x9bef('0x45')]||![];_0xa25749[_0x9bef('0x46')]=_0x41e169[_0x9bef('0x3c')]['id'];return getContent(_0x41e169[_0x9bef('0x2a')])[_0x9bef('0x24')](function(_0x58d061){_0xa25749[_0x9bef('0x2a')]=_0x58d061;return getRecipients(_0x3e886d);})['then'](function(_0x268843){_0xa25749[_0x9bef('0x47')]=_['sortBy'](_0x268843)[_0x9bef('0x48')](',');return db[_0x9bef('0x49')][_0x9bef('0x4a')](function(_0x5fb676){return db['Notification'][_0x9bef('0x4b')](_0xa25749,{'raw':!![],'transaction':_0x5fb676})[_0x9bef('0x24')](function(_0x24a0fa){var _0x22d28c={'sender':_0xa25749[_0x9bef('0x42')],'description':_0xa25749[_0x9bef('0x44')],'content':_0xa25749['body'],'beep':_0xa25749[_0x9bef('0x45')]};_0x268843['forEach'](function(_0x362af0){_0x22d28c[_0x9bef('0x4c')]=_0x362af0;socket[_0x9bef('0x4d')](_0x9bef('0x4e'),_0x22d28c);});return _0x24a0fa;});});})[_0x9bef('0x24')](respondWithResult(_0x89cf83,0xc9))[_0x9bef('0x4f')](handleError(_0x89cf83,null));};function getContent(_0x5f5424){return new BPromise(function(_0x151436,_0x2d9670){if(_0x5f5424[_0x9bef('0x2c')]){_0x151436(_0x5f5424[_0x9bef('0x2c')]);return;}return db[_0x9bef('0x50')]['findOne']({'attributes':[_0x9bef('0x51')],'where':{'id':_0x5f5424[_0x9bef('0x2d')]},'raw':!![]})['then'](function(_0x159a3f){if(!_0x159a3f)throw new db[(_0x9bef('0x2e'))][(_0x9bef('0x2f'))](_0x9bef('0x52'));var _0x70acf8=Mustache[_0x9bef('0x53')](_0x159a3f[_0x9bef('0x51')],_0x5f5424[_0x9bef('0x54')]);_0x151436(_0x70acf8);})[_0x9bef('0x4f')](function(_0x3f7248){_0x2d9670(_0x3f7248);});});}function getRecipients(_0x4ace99){return new BPromise(function(_0x1d4bd5,_0x42c7f0){var _0x352f86=[];var _0x2e3ab1=[];_0x4ace99[_0x9bef('0x55')](function(_0x51ca40){var _0x5b84b2=_[_0x9bef('0x56')](_0x51ca40['model']['toLowerCase']());if(_0x5b84b2===_0x9bef('0x57')){_0x352f86=_[_0x9bef('0x58')](_0x352f86,_0x51ca40[_0x9bef('0x59')]);}else{if(_[_0x9bef('0x3e')](_0x5b84b2,_0x9bef('0x5a')))_0x5b84b2=_0x5b84b2['replace'](_0x9bef('0x5a'),_0x9bef('0x5b'));_0x51ca40[_0x9bef('0x59')][_0x9bef('0x55')](function(_0x304072){_0x2e3ab1[_0x9bef('0x5c')](getAgents(_0x5b84b2,_0x304072));});}});return BPromise[_0x9bef('0x5d')](_0x2e3ab1)[_0x9bef('0x24')](function(_0x47149e){_0x352f86=_[_0x9bef('0x58')](_0x352f86,_[_0x9bef('0x5e')](_0x47149e));_0x1d4bd5(_0x352f86);})['catch'](function(_0x36af74){_0x42c7f0(_0x36af74);});});}function getAgents(_0x1e9dfd,_0x371e5c){return new BPromise(function(_0x56ce01,_0xfcafc4){return db[_0x1e9dfd][_0x9bef('0x5f')]({'where':{'id':_0x371e5c}})[_0x9bef('0x24')](function(_0x542de9){return _0x542de9[_0x9bef('0x60')]({'attributes':['id'],'raw':!![]})['then'](function(_0x44ee81){var _0x3d9bac=_[_0x9bef('0x61')](_0x44ee81,'id');_0x56ce01(_0x3d9bac);});})['catch'](function(_0x1f6c9a){_0xfcafc4(_0x1f6c9a);});});} \ No newline at end of file +var _0x1ac8=['mailqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','senderName','fullname','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','Notification','create','forEach','emit','notification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','toLowerCase','User','union','ids','queue','replace','Queue','push','all','flatten','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','register','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','then','name','send','sendNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','error','Invalid\x20\x27recipients\x27\x20object','faxqueue'];(function(_0x4ab4bf,_0x37241e){var _0x45424e=function(_0x2666f7){while(--_0x2666f7){_0x4ab4bf['push'](_0x4ab4bf['shift']());}};_0x45424e(++_0x37241e);}(_0x1ac8,0x154));var _0x81ac=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x1ac8[_0x59ee6f];return _0x4c0979;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x81ac('0x0'));var rimraf=require(_0x81ac('0x1'));var zipdir=require(_0x81ac('0x2'));var jsonpatch=require(_0x81ac('0x3'));var rp=require(_0x81ac('0x4'));var moment=require(_0x81ac('0x5'));var BPromise=require(_0x81ac('0x6'));var Mustache=require('mustache');var util=require(_0x81ac('0x7'));var path=require(_0x81ac('0x8'));var sox=require(_0x81ac('0x9'));var csv=require(_0x81ac('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x81ac('0xb'));var crypto=require(_0x81ac('0xc'));var jsforce=require(_0x81ac('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x81ac('0xe'));var Redis=require('ioredis');var authService=require(_0x81ac('0xf'));var qs=require(_0x81ac('0x10'));var as=require(_0x81ac('0x11'));var hardwareService=require(_0x81ac('0x12'));var logger=require(_0x81ac('0x13'))(_0x81ac('0x14'));var utils=require('../../config/utils');var config=require(_0x81ac('0x15'));var db=require(_0x81ac('0x16'))['db'];config['redis']=_['defaults'](config[_0x81ac('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x81ac('0x17')]));require('./notification.socket')[_0x81ac('0x18')](socket);function respondWithStatusCode(_0x40aea6,_0x38a945){_0x38a945=_0x38a945||0xcc;return function(_0x55b859){if(_0x55b859){return _0x40aea6[_0x81ac('0x19')](_0x38a945);}return _0x40aea6[_0x81ac('0x1a')](_0x38a945)[_0x81ac('0x1b')]();};}function respondWithResult(_0x25d694,_0x4502c4){_0x4502c4=_0x4502c4||0xc8;return function(_0x4a4d8e){if(_0x4a4d8e){return _0x25d694[_0x81ac('0x1a')](_0x4502c4)['json'](_0x4a4d8e);}};}function respondWithFilteredResult(_0x3508f0,_0x368623){return function(_0x56b6b6){if(_0x56b6b6){var _0x29dfd7=_0x56b6b6['count'],_0x397ce9=_0x368623['offset'],_0x54eacf=_0x368623[_0x81ac('0x1c')]+_0x368623[_0x81ac('0x1d')],_0x30a6d1;if(_0x54eacf>=_0x29dfd7){_0x54eacf=_0x29dfd7;_0x30a6d1=0xc8;}else{_0x30a6d1=0xce;}_0x3508f0[_0x81ac('0x1a')](_0x30a6d1);return _0x3508f0[_0x81ac('0x1e')](_0x81ac('0x1f'),_0x397ce9+'-'+_0x54eacf+'/'+_0x29dfd7)[_0x81ac('0x20')](_0x56b6b6);}return null;};}function patchUpdates(_0x239c20){return function(_0x2ead89){try{jsonpatch[_0x81ac('0x21')](_0x2ead89,_0x239c20,!![]);}catch(_0x3b53b5){return BPromise[_0x81ac('0x22')](_0x3b53b5);}return _0x2ead89[_0x81ac('0x23')]();};}function saveUpdates(_0x1723d4,_0x2a5b34){return function(_0x291ad7){if(_0x291ad7){return _0x291ad7[_0x81ac('0x24')](_0x1723d4)[_0x81ac('0x25')](function(_0x4c4ada){return _0x4c4ada;});}return null;};}function removeEntity(_0x5d44a9,_0x1fbd76){return function(_0x3bdf47){if(_0x3bdf47){return _0x3bdf47['destroy']()['then'](function(){_0x5d44a9[_0x81ac('0x1a')](0xcc)[_0x81ac('0x1b')]();});}};}function handleEntityNotFound(_0x3aacc6,_0x1757e3){return function(_0x450e10){if(!_0x450e10){_0x3aacc6[_0x81ac('0x19')](0x194);}return _0x450e10;};}function handleError(_0x54c896,_0x1937a7){_0x1937a7=_0x1937a7||0x1f4;return function(_0x420362){logger['error'](_0x420362['stack']);if(_0x420362[_0x81ac('0x26')]){delete _0x420362[_0x81ac('0x26')];}_0x54c896[_0x81ac('0x1a')](_0x1937a7)[_0x81ac('0x27')](_0x420362);};}exports[_0x81ac('0x28')]=function(_0x2d5e17,_0x2de446,_0x18ae89){if(!_0x2d5e17[_0x81ac('0x29')][_0x81ac('0x2a')](_0x81ac('0x2b'))&&!_0x2d5e17[_0x81ac('0x29')][_0x81ac('0x2a')](_0x81ac('0x2c'))){throw new db[(_0x81ac('0x2d'))][(_0x81ac('0x2e'))](_0x81ac('0x2f'));}else{if(_0x2d5e17['body'][_0x81ac('0x2a')](_0x81ac('0x2c'))&&!_0x2d5e17['body'][_0x81ac('0x2a')](_0x81ac('0x30'))){throw new db[(_0x81ac('0x2d'))]['ValidationError'](_0x81ac('0x31'));}if(!_0x2d5e17[_0x81ac('0x29')][_0x81ac('0x2a')](_0x81ac('0x32'))){throw new db[(_0x81ac('0x2d'))]['ValidationError'](_0x81ac('0x33'));}else{try{var _0x305b79=JSON[_0x81ac('0x34')](_0x2d5e17['body'][_0x81ac('0x32')]);}catch(_0x2608f7){logger[_0x81ac('0x35')](_0x2608f7);throw new db['Sequelize'][(_0x81ac('0x2e'))](_0x81ac('0x36'));}var _0x127aaf=['chatqueue',_0x81ac('0x37'),_0x81ac('0x38'),'openchannelqueue',_0x81ac('0x39'),_0x81ac('0x3a'),_0x81ac('0x3b'),_0x81ac('0x3c'),_0x81ac('0x3d')];if(_[_0x81ac('0x3e')](_0x305b79,function(_0x1d5317){return!_[_0x81ac('0x3f')](_0x127aaf,_0x1d5317[_0x81ac('0x40')]['toLowerCase']());})){throw new db[(_0x81ac('0x2d'))][(_0x81ac('0x2e'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x2c6553={};_0x2c6553['senderName']=_0x2d5e17[_0x81ac('0x29')]['hasOwnProperty']('senderName')?_0x2d5e17[_0x81ac('0x29')][_0x81ac('0x41')]:_0x2d5e17[_0x81ac('0x3d')][_0x81ac('0x42')];_0x2c6553[_0x81ac('0x43')]=_['isEmpty'](_0x2d5e17['body']['recipientsDescription'])?null:_0x2d5e17['body'][_0x81ac('0x43')];_0x2c6553[_0x81ac('0x44')]=_0x2d5e17[_0x81ac('0x29')]['beep']||![];_0x2c6553[_0x81ac('0x45')]=_0x2d5e17[_0x81ac('0x3d')]['id'];return getContent(_0x2d5e17['body'])[_0x81ac('0x25')](function(_0x84c9a2){_0x2c6553[_0x81ac('0x29')]=_0x84c9a2;return getRecipients(_0x305b79);})[_0x81ac('0x25')](function(_0x504ceb){_0x2c6553[_0x81ac('0x46')]=_[_0x81ac('0x47')](_0x504ceb)[_0x81ac('0x48')](',');return db[_0x81ac('0x49')][_0x81ac('0x4a')](function(_0x1c6dbc){return db[_0x81ac('0x4b')][_0x81ac('0x4c')](_0x2c6553,{'raw':!![],'transaction':_0x1c6dbc})[_0x81ac('0x25')](function(_0x537e59){var _0x1590a0={'sender':_0x2c6553[_0x81ac('0x41')],'description':_0x2c6553[_0x81ac('0x43')],'content':_0x2c6553[_0x81ac('0x29')],'beep':_0x2c6553[_0x81ac('0x44')]};_0x504ceb[_0x81ac('0x4d')](function(_0xd271ba){_0x1590a0['recipient']=_0xd271ba;socket[_0x81ac('0x4e')](_0x81ac('0x4f'),_0x1590a0);});return _0x537e59;});});})[_0x81ac('0x25')](respondWithResult(_0x2de446,0xc9))[_0x81ac('0x50')](handleError(_0x2de446,null));};function getContent(_0x19eefb){return new BPromise(function(_0x44347e,_0x141f4e){if(_0x19eefb[_0x81ac('0x2b')]){_0x44347e(_0x19eefb['text']);return;}return db[_0x81ac('0x51')][_0x81ac('0x52')]({'attributes':[_0x81ac('0x53')],'where':{'id':_0x19eefb[_0x81ac('0x2c')]},'raw':!![]})['then'](function(_0x12850d){if(!_0x12850d)throw new db[(_0x81ac('0x2d'))][(_0x81ac('0x2e'))](_0x81ac('0x54'));var _0x515a1f=Mustache[_0x81ac('0x55')](_0x12850d[_0x81ac('0x53')],_0x19eefb[_0x81ac('0x30')]);_0x44347e(_0x515a1f);})[_0x81ac('0x50')](function(_0x1cda33){_0x141f4e(_0x1cda33);});});}function getRecipients(_0x453910){return new BPromise(function(_0x1aad83,_0x42d1e4){var _0x5b3993=[];var _0x442325=[];_0x453910[_0x81ac('0x4d')](function(_0x57a435){var _0x4d34f6=_[_0x81ac('0x56')](_0x57a435['model'][_0x81ac('0x57')]());if(_0x4d34f6===_0x81ac('0x58')){_0x5b3993=_[_0x81ac('0x59')](_0x5b3993,_0x57a435[_0x81ac('0x5a')]);}else{if(_[_0x81ac('0x3f')](_0x4d34f6,_0x81ac('0x5b')))_0x4d34f6=_0x4d34f6[_0x81ac('0x5c')](_0x81ac('0x5b'),_0x81ac('0x5d'));_0x57a435[_0x81ac('0x5a')][_0x81ac('0x4d')](function(_0x451c8a){_0x442325[_0x81ac('0x5e')](getAgents(_0x4d34f6,_0x451c8a));});}});return BPromise[_0x81ac('0x5f')](_0x442325)[_0x81ac('0x25')](function(_0x5e9d58){_0x5b3993=_[_0x81ac('0x59')](_0x5b3993,_[_0x81ac('0x60')](_0x5e9d58));_0x1aad83(_0x5b3993);})['catch'](function(_0xfa4278){_0x42d1e4(_0xfa4278);});});}function getAgents(_0x410377,_0xc1b01b){return new BPromise(function(_0x4f3ba0,_0x544505){return db[_0x410377][_0x81ac('0x52')]({'where':{'id':_0xc1b01b}})[_0x81ac('0x25')](function(_0xf7b739){return _0xf7b739[_0x81ac('0x61')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3de784){var _0x14adf8=_[_0x81ac('0x62')](_0x3de784,'id');_0x4f3ba0(_0x14adf8);});})['catch'](function(_0x3fcc18){_0x544505(_0x3fcc18);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index c305f1e..b7ee1c3 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 _0xdb28=['Notification','setMaxListeners','update','remove','emit','exports','events','../../mysqldb'];(function(_0x39b0c4,_0x4f59c1){var _0x1af9c1=function(_0xea49c2){while(--_0xea49c2){_0x39b0c4['push'](_0x39b0c4['shift']());}};_0x1af9c1(++_0x4f59c1);}(_0xdb28,0x106));var _0x8db2=function(_0x47459b,_0x18e5ce){_0x47459b=_0x47459b-0x0;var _0x3b83ab=_0xdb28[_0x47459b];return _0x3b83ab;};'use strict';var EventEmitter=require(_0x8db2('0x0'));var Notification=require(_0x8db2('0x1'))['db'][_0x8db2('0x2')];var NotificationEvents=new EventEmitter();NotificationEvents[_0x8db2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8db2('0x4'),'afterDestroy':_0x8db2('0x5')};function emitEvent(_0xfcf49f){return function(_0x4426fe,_0x11109e,_0x52bf99){NotificationEvents[_0x8db2('0x6')](_0xfcf49f+':'+_0x4426fe['id'],_0x4426fe);NotificationEvents[_0x8db2('0x6')](_0xfcf49f,_0x4426fe);_0x52bf99(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Notification['hook'](e,emitEvent(event));}}module[_0x8db2('0x7')]=NotificationEvents; \ No newline at end of file +var _0x5f66=['remove','emit','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x1ba427,_0x386726){var _0x189323=function(_0x5a64f0){while(--_0x5a64f0){_0x1ba427['push'](_0x1ba427['shift']());}};_0x189323(++_0x386726);}(_0x5f66,0x1a0));var _0x65f6=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5f66[_0x19e35c];return _0x3e1fe8;};'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 acab81d..1649ad5 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 _0xa3a7=['define','notifications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','rimraf','exports'];(function(_0x33dbe5,_0x5e532f){var _0x1438bb=function(_0x40d3c6){while(--_0x40d3c6){_0x33dbe5['push'](_0x33dbe5['shift']());}};_0x1438bb(++_0x5e532f);}(_0xa3a7,0x175));var _0x7a3a=function(_0x4d7d43,_0x5ecccb){_0x4d7d43=_0x4d7d43-0x0;var _0x9e0feb=_0xa3a7[_0x4d7d43];return _0x9e0feb;};'use strict';var _=require(_0x7a3a('0x0'));var util=require(_0x7a3a('0x1'));var logger=require(_0x7a3a('0x2'))(_0x7a3a('0x3'));var moment=require(_0x7a3a('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7a3a('0x5'));var config=require('../../config/environment');var attributes=require('./notification.attributes');module[_0x7a3a('0x6')]=function(_0x3130f8,_0x163bea){return _0x3130f8[_0x7a3a('0x7')]('Notification',attributes,{'tableName':_0x7a3a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x7a3a('0x9')});}; \ No newline at end of file +var _0x6297=['./notification.attributes','exports','define','Notification','notifications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1c0991,_0x4f22d2){var _0x5034de=function(_0x520f49){while(--_0x520f49){_0x1c0991['push'](_0x1c0991['shift']());}};_0x5034de(++_0x4f22d2);}(_0x6297,0x106));var _0x7629=function(_0x3cb7d1,_0x47c94c){_0x3cb7d1=_0x3cb7d1-0x0;var _0x39db46=_0x6297[_0x3cb7d1];return _0x39db46;};'use strict';var _=require(_0x7629('0x0'));var util=require(_0x7629('0x1'));var logger=require(_0x7629('0x2'))(_0x7629('0x3'));var moment=require(_0x7629('0x4'));var BPromise=require(_0x7629('0x5'));var rp=require(_0x7629('0x6'));var fs=require('fs');var path=require(_0x7629('0x7'));var rimraf=require(_0x7629('0x8'));var config=require(_0x7629('0x9'));var attributes=require(_0x7629('0xa'));module[_0x7629('0xb')]=function(_0x585974,_0x2ed10e){return _0x585974[_0x7629('0xc')](_0x7629('0xd'),attributes,{'tableName':_0x7629('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x7629('0xf')});}; \ No newline at end of file diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index af979fb..fb8ffb7 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 _0x22bc=['../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','register','then','info','request\x20sent','debug','Notification,\x20%s,\x20%s,\x20%s','stringify','error','code','Notification,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','../../mysqldb'];(function(_0x59ee66,_0x9dffe8){var _0x433201=function(_0x1adde0){while(--_0x1adde0){_0x59ee66['push'](_0x59ee66['shift']());}};_0x433201(++_0x9dffe8);}(_0x22bc,0x172));var _0xc22b=function(_0x20da8b,_0x23df88){_0x20da8b=_0x20da8b-0x0;var _0x138b53=_0x22bc[_0x20da8b];return _0x138b53;};'use strict';var _=require(_0xc22b('0x0'));var util=require(_0xc22b('0x1'));var moment=require(_0xc22b('0x2'));var BPromise=require(_0xc22b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc22b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc22b('0x5'))(_0xc22b('0x6'));var config=require('../../config/environment');var jayson=require(_0xc22b('0x7'));var client=jayson['client'][_0xc22b('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0xc22b('0x9')],{'host':_0xc22b('0xa'),'port':0x18eb});var socket=require(_0xc22b('0xb'))(new Redis(config['redis']));require('./notification.socket')[_0xc22b('0xc')](socket);function respondWithRpcPromise(_0x34d6d6,_0xb2e94a,_0x58ad18){return new BPromise(function(_0x40d1e9,_0x2f05ed){return client['request'](_0x34d6d6,_0x58ad18)[_0xc22b('0xd')](function(_0x3b60de){logger[_0xc22b('0xe')]('Notification,\x20%s,\x20%s',_0xb2e94a,_0xc22b('0xf'));logger[_0xc22b('0x10')](_0xc22b('0x11'),_0xb2e94a,_0xc22b('0xf'),JSON[_0xc22b('0x12')](_0x3b60de));if(_0x3b60de[_0xc22b('0x13')]){if(_0x3b60de['error'][_0xc22b('0x14')]===0x1f4){logger[_0xc22b('0x13')](_0xc22b('0x15'),_0xb2e94a,_0x3b60de[_0xc22b('0x13')][_0xc22b('0x16')]);return _0x2f05ed(_0x3b60de[_0xc22b('0x13')]['message']);}logger[_0xc22b('0x13')](_0xc22b('0x15'),_0xb2e94a,_0x3b60de[_0xc22b('0x13')]['message']);return _0x40d1e9(_0x3b60de['error'][_0xc22b('0x16')]);}else{logger[_0xc22b('0xe')](_0xc22b('0x15'),_0xb2e94a,_0xc22b('0xf'));_0x40d1e9(_0x3b60de[_0xc22b('0x17')][_0xc22b('0x16')]);}})[_0xc22b('0x18')](function(_0x10b082){logger['error'](_0xc22b('0x15'),_0xb2e94a,_0x10b082);_0x2f05ed(_0x10b082);});});} \ No newline at end of file +var _0xc472=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','request\x20sent','debug','error','code','Notification,\x20%s,\x20%s','message','info','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xc472,0xe4));var _0x2c47=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xc472[_0x311c35];return _0x5cc50c;};'use strict';var _=require('lodash');var util=require(_0x2c47('0x0'));var moment=require(_0x2c47('0x1'));var BPromise=require('bluebird');var rs=require(_0x2c47('0x2'));var fs=require('fs');var Redis=require(_0x2c47('0x3'));var db=require(_0x2c47('0x4'))['db'];var utils=require(_0x2c47('0x5'));var logger=require(_0x2c47('0x6'))(_0x2c47('0x7'));var config=require(_0x2c47('0x8'));var jayson=require(_0x2c47('0x9'));var client=jayson[_0x2c47('0xa')][_0x2c47('0xb')]({'port':0x232a});config[_0x2c47('0xc')]=_[_0x2c47('0xd')](config['redis'],{'host':_0x2c47('0xe'),'port':0x18eb});var socket=require(_0x2c47('0xf'))(new Redis(config[_0x2c47('0xc')]));require('./notification.socket')[_0x2c47('0x10')](socket);function respondWithRpcPromise(_0x58190c,_0x5985ef,_0x1057aa){return new BPromise(function(_0x497c2c,_0x31f53d){return client[_0x2c47('0x11')](_0x58190c,_0x1057aa)['then'](function(_0x16771e){logger['info']('Notification,\x20%s,\x20%s',_0x5985ef,_0x2c47('0x12'));logger[_0x2c47('0x13')]('Notification,\x20%s,\x20%s,\x20%s',_0x5985ef,_0x2c47('0x12'),JSON['stringify'](_0x16771e));if(_0x16771e[_0x2c47('0x14')]){if(_0x16771e[_0x2c47('0x14')][_0x2c47('0x15')]===0x1f4){logger['error'](_0x2c47('0x16'),_0x5985ef,_0x16771e[_0x2c47('0x14')][_0x2c47('0x17')]);return _0x31f53d(_0x16771e[_0x2c47('0x14')][_0x2c47('0x17')]);}logger[_0x2c47('0x14')](_0x2c47('0x16'),_0x5985ef,_0x16771e[_0x2c47('0x14')][_0x2c47('0x17')]);return _0x497c2c(_0x16771e[_0x2c47('0x14')][_0x2c47('0x17')]);}else{logger[_0x2c47('0x18')](_0x2c47('0x16'),_0x5985ef,_0x2c47('0x12'));_0x497c2c(_0x16771e[_0x2c47('0x19')][_0x2c47('0x17')]);}})['catch'](function(_0x2516b0){logger[_0x2c47('0x14')](_0x2c47('0x16'),_0x5985ef,_0x2516b0);_0x31f53d(_0x2516b0);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index 07eea78..eea18a8 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 _0xb81e=['./notification.events','remove','update','emit','register'];(function(_0x4ede67,_0x2ff0a7){var _0x40ab3a=function(_0x3179be){while(--_0x3179be){_0x4ede67['push'](_0x4ede67['shift']());}};_0x40ab3a(++_0x2ff0a7);}(_0xb81e,0x9b));var _0xeb81=function(_0x24f951,_0x1b9836){_0x24f951=_0x24f951-0x0;var _0x5d0a66=_0xb81e[_0x24f951];return _0x5d0a66;};'use strict';var NotificationEvents=require(_0xeb81('0x0'));var events=['save',_0xeb81('0x1'),_0xeb81('0x2')];function createListener(_0x528048,_0x16fa3b){return function(_0x55ea97){_0x16fa3b[_0xeb81('0x3')](_0x528048,_0x55ea97);};}function removeListener(_0x69c463,_0x5caf1e){return function(){NotificationEvents['removeListener'](_0x69c463,_0x5caf1e);};}exports[_0xeb81('0x4')]=function(_0x459fde){for(var _0x22cea3=0x0,_0x52634c=events['length'];_0x22cea3<_0x52634c;_0x22cea3++){var _0x3199df=events[_0x22cea3];var _0x383ca4=createListener('notification:'+_0x3199df,_0x459fde);NotificationEvents['on'](_0x3199df,_0x383ca4);}}; \ No newline at end of file +var _0xbab9=['removeListener','register','length','notification:','./notification.events','remove'];(function(_0x540a70,_0xad64aa){var _0xebf67e=function(_0x8455b6){while(--_0x8455b6){_0x540a70['push'](_0x540a70['shift']());}};_0xebf67e(++_0xad64aa);}(_0xbab9,0x136));var _0x9bab=function(_0x15ff2d,_0x4db217){_0x15ff2d=_0x15ff2d-0x0;var _0x2c0756=_0xbab9[_0x15ff2d];return _0x2c0756;};'use strict';var NotificationEvents=require(_0x9bab('0x0'));var events=['save',_0x9bab('0x1'),'update'];function createListener(_0xf9c4fe,_0x5473d8){return function(_0x15852d){_0x5473d8['emit'](_0xf9c4fe,_0x15852d);};}function removeListener(_0x329395,_0x43fa51){return function(){NotificationEvents[_0x9bab('0x2')](_0x329395,_0x43fa51);};}exports[_0x9bab('0x3')]=function(_0x39af45){for(var _0x6b453a=0x0,_0x5c6f23=events[_0x9bab('0x4')];_0x6b453a<_0x5c6f23;_0x6b453a++){var _0x3e01a1=events[_0x6b453a];var _0x374a22=createListener(_0x9bab('0x5')+_0x3e01a1,_0x39af45);NotificationEvents['on'](_0x3e01a1,_0x374a22);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 1cf8a8b..f0ae1b2 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 _0x84b2=['getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','create','post','addAnswer','notify','addAgents','/:id/send','send','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers'];(function(_0x2f7cc4,_0x24d6df){var _0xcfd88c=function(_0x46da0c){while(--_0x46da0c){_0x2f7cc4['push'](_0x2f7cc4['shift']());}};_0xcfd88c(++_0x24d6df);}(_0x84b2,0x64));var _0x284b=function(_0xcc499b,_0x1802f){_0xcc499b=_0xcc499b-0x0;var _0xa1dd8e=_0x84b2[_0xcc499b];return _0xa1dd8e;};'use strict';var multer=require(_0x284b('0x0'));var util=require(_0x284b('0x1'));var path=require(_0x284b('0x2'));var timeout=require(_0x284b('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x284b('0x4'));var interaction=require(_0x284b('0x5'));var config=require(_0x284b('0x6'));var controller=require(_0x284b('0x7'));router[_0x284b('0x8')]('/',auth[_0x284b('0x9')](),controller[_0x284b('0xa')]);router['get'](_0x284b('0xb'),auth[_0x284b('0x9')](),controller[_0x284b('0xc')]);router[_0x284b('0x8')](_0x284b('0xd'),auth[_0x284b('0x9')](),controller['show']);router[_0x284b('0x8')](_0x284b('0xe'),auth[_0x284b('0x9')](),controller[_0x284b('0xf')]);router[_0x284b('0x8')](_0x284b('0x10'),auth[_0x284b('0x9')](),controller[_0x284b('0x11')]);router['get'](_0x284b('0x12'),auth['isAuthenticated'](),controller[_0x284b('0x13')]);router[_0x284b('0x8')](_0x284b('0x14'),auth['isAuthenticated'](),controller[_0x284b('0x15')]);router[_0x284b('0x8')](_0x284b('0x16'),auth[_0x284b('0x9')](),controller[_0x284b('0x17')]);router['post']('/',auth['isAuthenticated'](),controller[_0x284b('0x18')]);router[_0x284b('0x19')](_0x284b('0xe'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x284b('0x19')](_0x284b('0x10'),auth[_0x284b('0x9')](),controller[_0x284b('0x1a')]);router[_0x284b('0x19')]('/:id/notify',controller[_0x284b('0x1b')]);router[_0x284b('0x19')](_0x284b('0x12'),auth[_0x284b('0x9')](),controller['addApplications']);router[_0x284b('0x19')](_0x284b('0x16'),auth[_0x284b('0x9')](),controller[_0x284b('0x1c')]);router[_0x284b('0x19')](_0x284b('0x1d'),auth[_0x284b('0x9')](),controller[_0x284b('0x1e')]);router[_0x284b('0x1f')](_0x284b('0xd'),auth[_0x284b('0x9')](),controller[_0x284b('0x20')]);router['delete']('/:id',auth[_0x284b('0x9')](),controller[_0x284b('0x21')]);router[_0x284b('0x22')](_0x284b('0xe'),auth[_0x284b('0x9')](),controller[_0x284b('0x23')]);router[_0x284b('0x22')]('/:id/canned_answers',auth[_0x284b('0x9')](),controller[_0x284b('0x24')]);router[_0x284b('0x22')]('/:id/users',auth[_0x284b('0x9')](),controller[_0x284b('0x25')]);module[_0x284b('0x26')]=router; \ No newline at end of file +var _0x1200=['exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/users','getAgents','create','post','addDisposition','/:id/notify','notify','/:id/applications','addApplications','/:id/send','update','delete','removeAgents'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1200,0x111));var _0x0120=function(_0x571c1d,_0x3b0586){_0x571c1d=_0x571c1d-0x0;var _0x33c609=_0x1200[_0x571c1d];return _0x33c609;};'use strict';var multer=require(_0x0120('0x0'));var util=require(_0x0120('0x1'));var path=require(_0x0120('0x2'));var timeout=require('connect-timeout');var express=require(_0x0120('0x3'));var router=express[_0x0120('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x0120('0x5'));var config=require(_0x0120('0x6'));var controller=require('./openchannelAccount.controller');router[_0x0120('0x7')]('/',auth['isAuthenticated'](),controller[_0x0120('0x8')]);router['get'](_0x0120('0x9'),auth[_0x0120('0xa')](),controller[_0x0120('0xb')]);router['get'](_0x0120('0xc'),auth[_0x0120('0xa')](),controller[_0x0120('0xd')]);router[_0x0120('0x7')](_0x0120('0xe'),auth[_0x0120('0xa')](),controller[_0x0120('0xf')]);router['get'](_0x0120('0x10'),auth[_0x0120('0xa')](),controller[_0x0120('0x11')]);router[_0x0120('0x7')]('/:id/applications',auth[_0x0120('0xa')](),controller['getApplications']);router[_0x0120('0x7')](_0x0120('0x12'),auth[_0x0120('0xa')](),controller[_0x0120('0x13')]);router[_0x0120('0x7')](_0x0120('0x14'),auth[_0x0120('0xa')](),controller[_0x0120('0x15')]);router['post']('/',auth[_0x0120('0xa')](),controller[_0x0120('0x16')]);router[_0x0120('0x17')](_0x0120('0xe'),auth['isAuthenticated'](),controller[_0x0120('0x18')]);router[_0x0120('0x17')](_0x0120('0x10'),auth['isAuthenticated'](),controller['addAnswer']);router['post'](_0x0120('0x19'),controller[_0x0120('0x1a')]);router[_0x0120('0x17')](_0x0120('0x1b'),auth['isAuthenticated'](),controller[_0x0120('0x1c')]);router[_0x0120('0x17')](_0x0120('0x14'),auth['isAuthenticated'](),controller['addAgents']);router['post'](_0x0120('0x1d'),auth[_0x0120('0xa')](),controller['send']);router['put'](_0x0120('0xc'),auth[_0x0120('0xa')](),controller[_0x0120('0x1e')]);router[_0x0120('0x1f')](_0x0120('0xc'),auth['isAuthenticated'](),controller['destroy']);router[_0x0120('0x1f')](_0x0120('0xe'),auth[_0x0120('0xa')](),controller['removeDispositions']);router[_0x0120('0x1f')](_0x0120('0x10'),auth[_0x0120('0xa')](),controller['removeAnswers']);router['delete'](_0x0120('0x14'),auth[_0x0120('0xa')](),controller[_0x0120('0x20')]);module[_0x0120('0x21')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 8c6d211..cc532f9 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 _0xc8b6=['sequelize','randomstring','exports','STRING','name','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x37fd17,_0x448615){var _0x548ff6=function(_0x3a79d0){while(--_0x3a79d0){_0x37fd17['push'](_0x37fd17['shift']());}};_0x548ff6(++_0x448615);}(_0xc8b6,0x118));var _0x6c8b=function(_0x1e2321,_0x3ae1c5){_0x1e2321=_0x1e2321-0x0;var _0x1d346d=_0xc8b6[_0x1e2321];return _0x1d346d;};'use strict';var Sequelize=require(_0x6c8b('0x0'));var rs=require(_0x6c8b('0x1'));module[_0x6c8b('0x2')]={'name':{'type':Sequelize[_0x6c8b('0x3')],'unique':_0x6c8b('0x4'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x6c8b('0x3')],'defaultValue':function(){return rs[_0x6c8b('0x5')]();}},'replyUri':{'type':Sequelize[_0x6c8b('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x6c8b('0x6');}},'notificationSound':{'type':Sequelize[_0x6c8b('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6c8b('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6c8b('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x6c8b('0x3')]},'queueTransfer':{'type':Sequelize[_0x6c8b('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6c8b('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6c8b('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x6c8b('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x6c8b('0xa'),'set':function(_0xd2d92d){if(!_0xd2d92d)this[_0x6c8b('0xb')](_0x6c8b('0xc'),null);this[_0x6c8b('0xb')](_0x6c8b('0xd'),_0xd2d92d);}}}; \ No newline at end of file +var _0xa61a=['sequelize','randomstring','STRING','name','generate','BOOLEAN','INTEGER','setDataValue','mandatoryDisposition'];(function(_0xd3756e,_0x526342){var _0x385776=function(_0x12d073){while(--_0x12d073){_0xd3756e['push'](_0xd3756e['shift']());}};_0x385776(++_0x526342);}(_0xa61a,0x99));var _0xaa61=function(_0x591db7,_0x150445){_0x591db7=_0x591db7-0x0;var _0x4ad760=_0xa61a[_0x591db7];return _0x4ad760;};'use strict';var Sequelize=require(_0xaa61('0x0'));var rs=require(_0xaa61('0x1'));module['exports']={'name':{'type':Sequelize[_0xaa61('0x2')],'unique':_0xaa61('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xaa61('0x2')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xaa61('0x4')]();}},'replyUri':{'type':Sequelize[_0xaa61('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xaa61('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xaa61('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xaa61('0x2')]},'queueTransfer':{'type':Sequelize[_0xaa61('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xaa61('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xaa61('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xaa61('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xaa61('0x6')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xaa61('0x5')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x461438){if(!_0x461438)this[_0xaa61('0x7')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0xaa61('0x8'),_0x461438);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index b422257..ea69ecb 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 _0x5a24=['send','index','mandatoryDispositionPause','OpenchannelAccount','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','Pause','keys','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','addDisposition','Disposition','findOne','rawAttributes','OpenchannelAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','List','orderBy','priority','asc','contact','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','transaction','bulkCreate','getApplications','Contact','User','Owner','fullname','internal','Tag','Tags','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','redis','defaults','localhost','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','count','offset','set','apply','reject','save','update','then','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name'];(function(_0x1d44d7,_0x3619fd){var _0x31105=function(_0xf8a5a0){while(--_0xf8a5a0){_0x1d44d7['push'](_0x1d44d7['shift']());}};_0x31105(++_0x3619fd);}(_0x5a24,0x1ef));var _0x45a2=function(_0x194f46,_0x2bb869){_0x194f46=_0x194f46-0x0;var _0x1925df=_0x5a24[_0x194f46];return _0x1925df;};'use strict';var pdf=require(_0x45a2('0x0'));var emlformat=require(_0x45a2('0x1'));var rimraf=require(_0x45a2('0x2'));var zipdir=require(_0x45a2('0x3'));var jsonpatch=require(_0x45a2('0x4'));var rp=require(_0x45a2('0x5'));var moment=require('moment');var BPromise=require(_0x45a2('0x6'));var Mustache=require(_0x45a2('0x7'));var util=require(_0x45a2('0x8'));var path=require(_0x45a2('0x9'));var sox=require(_0x45a2('0xa'));var csv=require('to-csv');var ejs=require(_0x45a2('0xb'));var fs=require('fs');var _=require(_0x45a2('0xc'));var squel=require('squel');var crypto=require(_0x45a2('0xd'));var jsforce=require(_0x45a2('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x45a2('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x45a2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x45a2('0x11'));var as=require(_0x45a2('0x12'));var hardwareService=require(_0x45a2('0x13'));var logger=require('../../config/logger')(_0x45a2('0x14'));var utils=require('../../config/utils');var config=require(_0x45a2('0x15'));var db=require('../../mysqldb')['db'];config[_0x45a2('0x16')]=_[_0x45a2('0x17')](config[_0x45a2('0x16')],{'host':_0x45a2('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelAccount.socket')[_0x45a2('0x19')](socket);var jayson=require(_0x45a2('0x1a'));var client=jayson[_0x45a2('0x1b')]['http']({'port':0x232c});var client9002=jayson['client'][_0x45a2('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x369011,_0x3d47c2,_0x4398ae){if(_0x4398ae){var _0x54bfd8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x54bfd8[_0x45a2('0x1d')](_0x3d47c2)){return _0x369011;}else{throw new db[(_0x45a2('0x1e'))][(_0x45a2('0x1f'))](_0x45a2('0x20'));}}else{return _0x369011;}}function respondWithRpcPromise(_0x288311,_0x190523,_0x5264b1,_0x1d6bc0){return new BPromise(function(_0xb4f977,_0x25ae8f){var _0x2df218=_0x1d6bc0||client;return _0x2df218[_0x45a2('0x21')](_0x288311,_0x5264b1)['then'](function(_0x3e7f0c){logger[_0x45a2('0x22')]('OpenchannelAccount,\x20%s,\x20%s',_0x190523,'request\x20sent');logger[_0x45a2('0x23')](_0x45a2('0x24'),_0x190523,_0x45a2('0x25'),JSON[_0x45a2('0x26')](_0x3e7f0c));if(_0x3e7f0c[_0x45a2('0x27')]){if(_0x3e7f0c[_0x45a2('0x27')][_0x45a2('0x28')]===0x1f4){logger[_0x45a2('0x27')](_0x45a2('0x29'),_0x190523,_0x3e7f0c[_0x45a2('0x27')]['message']);return _0x25ae8f(_0x3e7f0c[_0x45a2('0x27')][_0x45a2('0x2a')]);}logger[_0x45a2('0x27')](_0x45a2('0x29'),_0x190523,_0x3e7f0c[_0x45a2('0x27')][_0x45a2('0x2a')]);return _0xb4f977(_0x3e7f0c['error'][_0x45a2('0x2a')]);}else{logger[_0x45a2('0x22')]('OpenchannelAccount,\x20%s,\x20%s',_0x190523,'request\x20sent');_0xb4f977(_0x3e7f0c[_0x45a2('0x2b')][_0x45a2('0x2a')]);}})[_0x45a2('0x2c')](function(_0x87c09f){logger['error'](_0x45a2('0x29'),_0x190523,_0x87c09f);_0x25ae8f(_0x87c09f);});});}function respondWithStatusCode(_0x15dd97,_0x3f13f1){_0x3f13f1=_0x3f13f1||0xcc;return function(_0x5c30d1){if(_0x5c30d1){return _0x15dd97[_0x45a2('0x2d')](_0x3f13f1);}return _0x15dd97['status'](_0x3f13f1)[_0x45a2('0x2e')]();};}function respondWithResult(_0x49c4a1,_0x431521){_0x431521=_0x431521||0xc8;return function(_0x59c599){if(_0x59c599){return _0x49c4a1[_0x45a2('0x2f')](_0x431521)[_0x45a2('0x30')](_0x59c599);}};}function respondWithFilteredResult(_0x5c2929,_0x37c784){return function(_0x6f3835){if(_0x6f3835){var _0x5b4c28=_0x6f3835[_0x45a2('0x31')],_0x3889dd=_0x37c784[_0x45a2('0x32')],_0xb9f7d1=_0x37c784[_0x45a2('0x32')]+_0x37c784['limit'],_0x513ccf;if(_0xb9f7d1>=_0x5b4c28){_0xb9f7d1=_0x5b4c28;_0x513ccf=0xc8;}else{_0x513ccf=0xce;}_0x5c2929['status'](_0x513ccf);return _0x5c2929[_0x45a2('0x33')]('Content-Range',_0x3889dd+'-'+_0xb9f7d1+'/'+_0x5b4c28)[_0x45a2('0x30')](_0x6f3835);}return null;};}function patchUpdates(_0x22f7d7){return function(_0xdf8ccf){try{jsonpatch[_0x45a2('0x34')](_0xdf8ccf,_0x22f7d7,!![]);}catch(_0xfa7e97){return BPromise[_0x45a2('0x35')](_0xfa7e97);}return _0xdf8ccf[_0x45a2('0x36')]();};}function saveUpdates(_0x1bda7d,_0x49e17c){return function(_0x1efd24){if(_0x1efd24){return _0x1efd24[_0x45a2('0x37')](_0x1bda7d)[_0x45a2('0x38')](function(_0x83a3f){return _0x83a3f;});}return null;};}function removeEntity(_0x1da7fc,_0x42b0a8){return function(_0x7e2a5){if(_0x7e2a5){return _0x7e2a5[_0x45a2('0x39')]()[_0x45a2('0x38')](function(){var _0xf20d48=_0x7e2a5[_0x45a2('0x3a')]({'plain':!![]});var _0x5ab1c2=_0x45a2('0x3b');return db[_0x45a2('0x3c')][_0x45a2('0x39')]({'where':{'type':_0x5ab1c2,'resourceId':_0xf20d48['id']}})[_0x45a2('0x38')](function(){return _0x7e2a5;});})[_0x45a2('0x38')](function(){_0x1da7fc[_0x45a2('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d6ddc,_0x1bbbea){return function(_0x3b8d96){if(!_0x3b8d96){_0x5d6ddc[_0x45a2('0x2d')](0x194);}return _0x3b8d96;};}function handleError(_0x36f9b5,_0x875a82){_0x875a82=_0x875a82||0x1f4;return function(_0x162a12){logger[_0x45a2('0x27')](_0x162a12[_0x45a2('0x3d')]);if(_0x162a12[_0x45a2('0x3e')]){delete _0x162a12['name'];}_0x36f9b5[_0x45a2('0x2f')](_0x875a82)[_0x45a2('0x3f')](_0x162a12);};}exports[_0x45a2('0x40')]=function(_0x2124ca,_0x45d925){var _0x398b03={'include':[{'model':db['Pause'],'as':_0x45a2('0x41')}]},_0x43d6bc={},_0x2efa42={'count':0x0,'rows':[]};var _0x23e068=_['map'](db[_0x45a2('0x42')]['rawAttributes'],function(_0x3bb2d8){return{'name':_0x3bb2d8['fieldName'],'type':_0x3bb2d8[_0x45a2('0x43')]['key']};});_0x43d6bc[_0x45a2('0x44')]=_[_0x45a2('0x45')](_0x23e068,_0x45a2('0x3e'));_0x43d6bc['query']=_['keys'](_0x2124ca[_0x45a2('0x46')]);_0x43d6bc[_0x45a2('0x47')]=_[_0x45a2('0x48')](_0x43d6bc[_0x45a2('0x44')],_0x43d6bc[_0x45a2('0x46')]);_0x398b03[_0x45a2('0x49')]=_[_0x45a2('0x48')](_0x43d6bc[_0x45a2('0x44')],qs[_0x45a2('0x4a')](_0x2124ca['query'][_0x45a2('0x4a')]));_0x398b03[_0x45a2('0x49')]=_0x398b03[_0x45a2('0x49')][_0x45a2('0x4b')]?_0x398b03[_0x45a2('0x49')]:_0x43d6bc[_0x45a2('0x44')];if(!_0x2124ca['query'][_0x45a2('0x4c')](_0x45a2('0x4d'))){_0x398b03[_0x45a2('0x4e')]=qs['limit'](_0x2124ca[_0x45a2('0x46')]['limit']);_0x398b03[_0x45a2('0x32')]=qs[_0x45a2('0x32')](_0x2124ca[_0x45a2('0x46')][_0x45a2('0x32')]);}_0x398b03[_0x45a2('0x4f')]=qs[_0x45a2('0x50')](_0x2124ca[_0x45a2('0x46')][_0x45a2('0x50')]);_0x398b03[_0x45a2('0x51')]=qs[_0x45a2('0x47')](_[_0x45a2('0x52')](_0x2124ca[_0x45a2('0x46')],_0x43d6bc[_0x45a2('0x47')]));if(_0x2124ca[_0x45a2('0x46')][_0x45a2('0x53')]){_0x398b03[_0x45a2('0x51')]=_[_0x45a2('0x54')](_0x398b03[_0x45a2('0x51')],{'$or':_[_0x45a2('0x45')](_0x23e068,function(_0x1cb04a){if(_0x1cb04a[_0x45a2('0x43')]!==_0x45a2('0x55')){var _0x3ee26d={};_0x3ee26d[_0x1cb04a['name']]={'$like':'%'+_0x2124ca[_0x45a2('0x46')][_0x45a2('0x53')]+'%'};return _0x3ee26d;}})});}_0x398b03=_[_0x45a2('0x54')]({},_0x398b03,_0x2124ca['options']);var _0x5dc7d2={'where':_0x398b03[_0x45a2('0x51')]};return db[_0x45a2('0x42')][_0x45a2('0x31')](_0x5dc7d2)[_0x45a2('0x38')](function(_0x52b600){_0x2efa42['count']=_0x52b600;if(_0x2124ca['query'][_0x45a2('0x56')]){_0x398b03[_0x45a2('0x57')]=[{'all':!![]}];}return db[_0x45a2('0x42')][_0x45a2('0x58')](_0x398b03);})['then'](function(_0x2a7673){_0x2efa42[_0x45a2('0x59')]=_0x2a7673;return _0x2efa42;})[_0x45a2('0x38')](respondWithFilteredResult(_0x45d925,_0x398b03))[_0x45a2('0x2c')](handleError(_0x45d925,null));};exports[_0x45a2('0x5a')]=function(_0x185072,_0x5d0ef5){var _0x2a0415={'raw':![],'where':{'id':_0x185072[_0x45a2('0x5b')]['id']},'include':[{'model':db[_0x45a2('0x5c')],'as':_0x45a2('0x41')}]},_0x3a21b0={};_0x3a21b0['model']=_[_0x45a2('0x5d')](db['OpenchannelAccount']['rawAttributes']);_0x3a21b0[_0x45a2('0x46')]=_['keys'](_0x185072['query']);_0x3a21b0[_0x45a2('0x47')]=_['intersection'](_0x3a21b0[_0x45a2('0x44')],_0x3a21b0[_0x45a2('0x46')]);_0x2a0415[_0x45a2('0x49')]=_[_0x45a2('0x48')](_0x3a21b0[_0x45a2('0x44')],qs[_0x45a2('0x4a')](_0x185072[_0x45a2('0x46')][_0x45a2('0x4a')]));_0x2a0415[_0x45a2('0x49')]=_0x2a0415[_0x45a2('0x49')]['length']?_0x2a0415[_0x45a2('0x49')]:_0x3a21b0[_0x45a2('0x44')];if(_0x185072['query'][_0x45a2('0x56')]){_0x2a0415[_0x45a2('0x57')]=[{'all':!![]}];}_0x2a0415=_[_0x45a2('0x54')]({},_0x2a0415,_0x185072[_0x45a2('0x5e')]);return db['OpenchannelAccount']['find'](_0x2a0415)[_0x45a2('0x38')](handleEntityNotFound(_0x5d0ef5,null))[_0x45a2('0x38')](respondWithResult(_0x5d0ef5,null))['catch'](handleError(_0x5d0ef5,null));};exports[_0x45a2('0x5f')]=function(_0x355dc7,_0x16eb47){return db[_0x45a2('0x42')][_0x45a2('0x5f')](_0x355dc7[_0x45a2('0x60')],{})['then'](function(_0x1502fd){var _0x2d123e=_0x355dc7[_0x45a2('0x61')][_0x45a2('0x3a')]({'plain':!![]});if(!_0x2d123e)throw new Error(_0x45a2('0x62'));if(_0x2d123e[_0x45a2('0x63')]===_0x45a2('0x61')){var _0xbdecd5=_0x1502fd[_0x45a2('0x3a')]({'plain':!![]});var _0x160c31='OpenchannelAccounts';return db[_0x45a2('0x64')]['find']({'where':{'name':_0x160c31,'userProfileId':_0x2d123e[_0x45a2('0x65')]},'raw':!![]})[_0x45a2('0x38')](function(_0x47305f){if(_0x47305f&&_0x47305f['autoAssociation']===0x0){return db[_0x45a2('0x3c')][_0x45a2('0x5f')]({'name':_0xbdecd5[_0x45a2('0x3e')],'resourceId':_0xbdecd5['id'],'type':_0x47305f[_0x45a2('0x3e')],'sectionId':_0x47305f['id']},{})[_0x45a2('0x38')](function(){return _0x1502fd;});}else{return _0x1502fd;}})[_0x45a2('0x2c')](function(_0x2b6d1e){logger[_0x45a2('0x27')](_0x45a2('0x66'),_0x2b6d1e);throw _0x2b6d1e;});}return _0x1502fd;})[_0x45a2('0x38')](respondWithResult(_0x16eb47,0xc9))[_0x45a2('0x2c')](handleError(_0x16eb47,null));};exports['update']=function(_0x254f5a,_0x36ee92){if(_0x254f5a['body']['id']){delete _0x254f5a['body']['id'];}return db['OpenchannelAccount'][_0x45a2('0x67')]({'where':{'id':_0x254f5a['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x45a2('0x38')](handleEntityNotFound(_0x36ee92,null))[_0x45a2('0x38')](saveUpdates(_0x254f5a[_0x45a2('0x60')],null))['then'](respondWithResult(_0x36ee92,null))[_0x45a2('0x2c')](handleError(_0x36ee92,null));};exports[_0x45a2('0x39')]=function(_0x5646f6,_0x11b870){return db[_0x45a2('0x42')][_0x45a2('0x67')]({'where':{'id':_0x5646f6[_0x45a2('0x5b')]['id']}})['then'](handleEntityNotFound(_0x11b870,null))[_0x45a2('0x38')](removeEntity(_0x11b870,null))[_0x45a2('0x2c')](handleError(_0x11b870,null));};exports['describe']=function(_0x15e91c,_0x45f8d){return db['OpenchannelAccount'][_0x45a2('0x68')]()[_0x45a2('0x38')](respondWithResult(_0x45f8d,null))[_0x45a2('0x2c')](handleError(_0x45f8d,null));};exports[_0x45a2('0x69')]=function(_0x2a5cee,_0x48e729,_0x451ccb){if(_0x2a5cee[_0x45a2('0x60')]['id']){delete _0x2a5cee[_0x45a2('0x60')]['id'];}return db['OpenchannelAccount'][_0x45a2('0x67')]({'where':{'id':_0x2a5cee[_0x45a2('0x5b')]['id']}})['then'](handleEntityNotFound(_0x48e729,null))[_0x45a2('0x38')](function(_0x6cbe28){if(_0x6cbe28){_0x2a5cee[_0x45a2('0x60')]['OpnechannelAccountId']=_0x6cbe28['id'];return db[_0x45a2('0x6a')]['create'](_0x2a5cee['body']);}})['then'](respondWithResult(_0x48e729,null))['catch'](handleError(_0x48e729,null));};exports['getDispositions']=function(_0x38271a,_0x5ca169,_0xa29792){var _0x18881a={'raw':![],'where':{}};var _0x535ade={};var _0x3909bf={'count':0x0,'rows':[]};return db[_0x45a2('0x42')][_0x45a2('0x6b')]({'where':{'id':_0x38271a[_0x45a2('0x5b')]['id']}})[_0x45a2('0x38')](handleEntityNotFound(_0x5ca169,null))[_0x45a2('0x38')](function(_0x148519){if(_0x148519){_0x535ade[_0x45a2('0x44')]=_[_0x45a2('0x5d')](db[_0x45a2('0x6a')][_0x45a2('0x6c')]);_0x535ade[_0x45a2('0x46')]=_[_0x45a2('0x5d')](_0x38271a[_0x45a2('0x46')]);_0x535ade[_0x45a2('0x47')]=_[_0x45a2('0x48')](_0x535ade[_0x45a2('0x44')],_0x535ade[_0x45a2('0x46')]);_0x18881a[_0x45a2('0x49')]=_[_0x45a2('0x48')](_0x535ade[_0x45a2('0x44')],qs[_0x45a2('0x4a')](_0x38271a[_0x45a2('0x46')][_0x45a2('0x4a')]));_0x18881a[_0x45a2('0x49')]=_0x18881a['attributes']['length']?_0x18881a[_0x45a2('0x49')]:_0x535ade[_0x45a2('0x44')];if(!_0x38271a[_0x45a2('0x46')][_0x45a2('0x4c')]('nolimit')){_0x18881a[_0x45a2('0x4e')]=qs[_0x45a2('0x4e')](_0x38271a[_0x45a2('0x46')]['limit']);_0x18881a[_0x45a2('0x32')]=qs[_0x45a2('0x32')](_0x38271a[_0x45a2('0x46')][_0x45a2('0x32')]);}_0x18881a[_0x45a2('0x4f')]=qs[_0x45a2('0x50')](_0x38271a[_0x45a2('0x46')][_0x45a2('0x50')]);_0x18881a[_0x45a2('0x51')]=qs['filters'](_[_0x45a2('0x52')](_0x38271a[_0x45a2('0x46')],_0x535ade[_0x45a2('0x47')]));_0x18881a[_0x45a2('0x51')][_0x45a2('0x6d')]=_0x148519['id'];if(_0x38271a[_0x45a2('0x46')][_0x45a2('0x53')]){_0x18881a[_0x45a2('0x51')]=_[_0x45a2('0x54')](_0x18881a[_0x45a2('0x51')],{'$or':_['map'](_0x18881a[_0x45a2('0x49')],function(_0x4d5bdc){var _0x2f969c={};_0x2f969c[_0x4d5bdc]={'$like':'%'+_0x38271a['query'][_0x45a2('0x53')]+'%'};return _0x2f969c;})});}_0x18881a=_['merge']({},_0x18881a,_0x38271a['options']);return db['Disposition'][_0x45a2('0x31')]({'where':_0x18881a[_0x45a2('0x51')]})[_0x45a2('0x38')](function(_0x29c826){_0x3909bf[_0x45a2('0x31')]=_0x29c826;if(_0x38271a[_0x45a2('0x46')][_0x45a2('0x56')]){_0x18881a[_0x45a2('0x57')]=[{'all':!![]}];}return db[_0x45a2('0x6a')][_0x45a2('0x58')](_0x18881a);})['then'](function(_0x1ae54b){_0x3909bf[_0x45a2('0x59')]=_0x1ae54b;return _0x3909bf;});}})[_0x45a2('0x38')](respondWithFilteredResult(_0x5ca169,_0x18881a))[_0x45a2('0x2c')](handleError(_0x5ca169,null));};exports[_0x45a2('0x6e')]=function(_0x11ba5a,_0x19dd8c,_0x152b34){return db[_0x45a2('0x42')][_0x45a2('0x67')]({'where':{'id':_0x11ba5a[_0x45a2('0x5b')]['id']}})[_0x45a2('0x38')](handleEntityNotFound(_0x19dd8c,null))['then'](function(_0x33b63c){if(_0x33b63c){return _0x33b63c['removeDispositions'](_0x11ba5a[_0x45a2('0x46')][_0x45a2('0x6f')]);}})[_0x45a2('0x38')](respondWithStatusCode(_0x19dd8c,null))[_0x45a2('0x2c')](handleError(_0x19dd8c,null));};exports[_0x45a2('0x70')]=function(_0x236a59,_0x3c23da,_0x1a2e81){if(_0x236a59['body']['id']){delete _0x236a59[_0x45a2('0x60')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x236a59[_0x45a2('0x5b')]['id']}})[_0x45a2('0x38')](handleEntityNotFound(_0x3c23da,null))[_0x45a2('0x38')](function(_0x141790){if(_0x141790){_0x236a59['body'][_0x45a2('0x6d')]=_0x141790['id'];return db[_0x45a2('0x71')][_0x45a2('0x5f')](_0x236a59[_0x45a2('0x60')]);}})[_0x45a2('0x38')](respondWithResult(_0x3c23da,null))['catch'](handleError(_0x3c23da,null));};exports[_0x45a2('0x72')]=function(_0x42ad81,_0x587894,_0x1966c4){var _0x3e11cf={'raw':![],'where':{}};var _0x3b807f={};var _0x443f43={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x45a2('0x6b')]({'where':{'id':_0x42ad81[_0x45a2('0x5b')]['id']}})[_0x45a2('0x38')](handleEntityNotFound(_0x587894,null))[_0x45a2('0x38')](function(_0x30e389){if(_0x30e389){_0x3b807f[_0x45a2('0x44')]=_['keys'](db[_0x45a2('0x71')]['rawAttributes']);_0x3b807f[_0x45a2('0x46')]=_['keys'](_0x42ad81[_0x45a2('0x46')]);_0x3b807f['filters']=_['intersection'](_0x3b807f[_0x45a2('0x44')],_0x3b807f['query']);_0x3e11cf[_0x45a2('0x49')]=_['intersection'](_0x3b807f[_0x45a2('0x44')],qs[_0x45a2('0x4a')](_0x42ad81[_0x45a2('0x46')][_0x45a2('0x4a')]));_0x3e11cf['attributes']=_0x3e11cf[_0x45a2('0x49')][_0x45a2('0x4b')]?_0x3e11cf['attributes']:_0x3b807f[_0x45a2('0x44')];if(!_0x42ad81['query']['hasOwnProperty'](_0x45a2('0x4d'))){_0x3e11cf[_0x45a2('0x4e')]=qs['limit'](_0x42ad81[_0x45a2('0x46')][_0x45a2('0x4e')]);_0x3e11cf[_0x45a2('0x32')]=qs[_0x45a2('0x32')](_0x42ad81[_0x45a2('0x46')][_0x45a2('0x32')]);}_0x3e11cf[_0x45a2('0x4f')]=qs[_0x45a2('0x50')](_0x42ad81['query']['sort']);_0x3e11cf['where']=qs[_0x45a2('0x47')](_[_0x45a2('0x52')](_0x42ad81['query'],_0x3b807f[_0x45a2('0x47')]));_0x3e11cf[_0x45a2('0x51')][_0x45a2('0x6d')]=_0x30e389['id'];if(_0x42ad81[_0x45a2('0x46')][_0x45a2('0x53')]){_0x3e11cf[_0x45a2('0x51')]=_['merge'](_0x3e11cf[_0x45a2('0x51')],{'$or':_['map'](_0x3e11cf[_0x45a2('0x49')],function(_0x25be9f){var _0x54fc91={};_0x54fc91[_0x25be9f]={'$like':'%'+_0x42ad81[_0x45a2('0x46')][_0x45a2('0x53')]+'%'};return _0x54fc91;})});}_0x3e11cf=_['merge']({},_0x3e11cf,_0x42ad81[_0x45a2('0x5e')]);return db[_0x45a2('0x71')][_0x45a2('0x31')]({'where':_0x3e11cf[_0x45a2('0x51')]})[_0x45a2('0x38')](function(_0x1824e8){_0x443f43['count']=_0x1824e8;if(_0x42ad81['query'][_0x45a2('0x56')]){_0x3e11cf[_0x45a2('0x57')]=[{'all':!![]}];}return db[_0x45a2('0x71')][_0x45a2('0x58')](_0x3e11cf);})[_0x45a2('0x38')](function(_0x3281ee){_0x443f43[_0x45a2('0x59')]=_0x3281ee;return _0x443f43;});}})[_0x45a2('0x38')](respondWithFilteredResult(_0x587894,_0x3e11cf))['catch'](handleError(_0x587894,null));};exports[_0x45a2('0x73')]=function(_0x13bd57,_0x131383,_0xaa2bec){return db['OpenchannelAccount']['find']({'where':{'id':_0x13bd57['params']['id']}})[_0x45a2('0x38')](handleEntityNotFound(_0x131383,null))[_0x45a2('0x38')](function(_0x44f0d0){if(_0x44f0d0){return _0x44f0d0[_0x45a2('0x73')](_0x13bd57[_0x45a2('0x46')][_0x45a2('0x6f')]);}})[_0x45a2('0x38')](respondWithStatusCode(_0x131383,null))[_0x45a2('0x2c')](handleError(_0x131383,null));};exports[_0x45a2('0x74')]=function(_0x42a0c9,_0x9ae6c7,_0x24aab1){var _0x3cd5d0={'body':_0x42a0c9[_0x45a2('0x60')],'channel':'openchannel'};var _0xbf79d9=[];var _0x11f378=[];var _0x860911={};var _0x27f24d=![];return db[_0x45a2('0x75')]['describe']()[_0x45a2('0x38')](function(_0x510a0b){if(!_0x510a0b){throw new db[(_0x45a2('0x1e'))][(_0x45a2('0x1f'))](_0x45a2('0x76'));}_0xbf79d9=_[_0x45a2('0x77')](_['keys'](_0x510a0b),[_0x45a2('0x78'),_0x45a2('0x79')]);_0x11f378=_[_0x45a2('0x77')](_['keys'](_0x510a0b),['createdAt','updatedAt',_0x45a2('0x7a'),_0x45a2('0x7b')]);if(_0x42a0c9[_0x45a2('0x60')]['id']){delete _0x42a0c9[_0x45a2('0x60')]['id'];}if(_[_0x45a2('0x7c')](_0x42a0c9[_0x45a2('0x60')][_0x45a2('0x7d')])){throw new db[(_0x45a2('0x1e'))][(_0x45a2('0x1f'))](_0x45a2('0x7e'));}if(_[_0x45a2('0x7c')](_0x42a0c9[_0x45a2('0x60')][_0x45a2('0x60')])||_0x42a0c9[_0x45a2('0x60')]['body']===''){throw new db[(_0x45a2('0x1e'))][(_0x45a2('0x1f'))](_0x45a2('0x7f'));}if(_['isNil'](_0x42a0c9[_0x45a2('0x60')][_0x45a2('0x80')])){throw new db['Sequelize'][(_0x45a2('0x1f'))](_0x45a2('0x81')+_0x11f378);}if(!_[_0x45a2('0x82')](_0x11f378,_0x42a0c9['body'][_0x45a2('0x80')])){throw new db['Sequelize'][(_0x45a2('0x1f'))](_0x45a2('0x83')+_0x11f378);}_0x860911[_0x42a0c9[_0x45a2('0x60')]['mapKey']]=_0x42a0c9['body'][_0x45a2('0x7d')];})[_0x45a2('0x38')](function(){return db['OpenchannelAccount']['find']({'where':{'id':_0x42a0c9[_0x45a2('0x5b')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x45a2('0x75')],'as':_0x45a2('0x84'),'where':_0x860911,'limit':0x1,'order':[[_0x45a2('0x79'),_0x45a2('0x85')]]}]},{'model':db[_0x45a2('0x86')],'as':_0x45a2('0x87')}]});})[_0x45a2('0x38')](handleEntityNotFound(_0x9ae6c7,null))[_0x45a2('0x38')](function(_0x362993){if(_0x362993&&_0x362993['List']){_0x3cd5d0[_0x45a2('0x88')]=_0x362993;_0x3cd5d0[_0x45a2('0x89')]=_0x362993[_0x45a2('0x87')];_0x3cd5d0[_0x45a2('0x8a')]=_0x362993[_0x45a2('0x8b')];_0x3cd5d0['applications']=_[_0x45a2('0x8c')](_0x3cd5d0[_0x45a2('0x89')],[_0x45a2('0x8d')],[_0x45a2('0x8e')]);if(_0x3cd5d0[_0x45a2('0x88')][_0x45a2('0x87')]){delete _0x3cd5d0[_0x45a2('0x88')][_0x45a2('0x87')];}if(_0x3cd5d0['account']['List']&&_0x3cd5d0[_0x45a2('0x88')][_0x45a2('0x8b')]['Contacts']['length']){return _0x3cd5d0[_0x45a2('0x88')][_0x45a2('0x8b')]['Contacts'][0x0];}var _0xe7a929=_[_0x45a2('0x17')](_0x42a0c9[_0x45a2('0x60')],{'firstName':_0x42a0c9[_0x45a2('0x60')]['from'],'ListId':_0x362993['ListId']});_0xe7a929[_0x42a0c9[_0x45a2('0x60')][_0x45a2('0x80')]]=_0x42a0c9['body'][_0x45a2('0x7d')];return db['CmContact']['create'](_0xe7a929,{'fields':_0xbf79d9,'raw':!![]});}})[_0x45a2('0x38')](handleEntityNotFound(_0x9ae6c7,null))[_0x45a2('0x38')](function(_0x41d421){_0x3cd5d0[_0x45a2('0x8f')]=_0x41d421;if(_0x41d421){var _0x239cb3={'ContactId':_0x41d421['id'],'OpenchannelAccountId':_0x42a0c9[_0x45a2('0x5b')]['id'],'from':(_0x41d421[_0x45a2('0x90')]||'')+'\x20'+(_0x41d421['lastName']||'')};var _0x980e53={'OpenchannelAccountId':_0x42a0c9[_0x45a2('0x5b')]['id'],'closed':![]};if(_0x42a0c9[_0x45a2('0x60')][_0x45a2('0x91')]){_0x980e53[_0x45a2('0x91')]=_0x42a0c9[_0x45a2('0x60')][_0x45a2('0x91')];return db[_0x45a2('0x92')][_0x45a2('0x67')]({'where':_0x980e53})['then'](function(_0x117c8f){if(_0x117c8f){return[_0x117c8f,![]];}_0x239cb3['threadId']=_0x42a0c9[_0x45a2('0x60')][_0x45a2('0x91')];_0x239cb3[_0x45a2('0x93')]=_0x42a0c9['body'][_0x45a2('0x93')];return db['OpenchannelInteraction'][_0x45a2('0x5f')](_0x239cb3)['then'](function(_0xe91a4){return[_0xe91a4,!![]];});});}else{_0x980e53[_0x45a2('0x91')]=null;}_0x980e53[_0x45a2('0x94')]=_0x41d421['id'];return db[_0x45a2('0x92')]['find']({'where':_0x980e53})[_0x45a2('0x38')](function(_0x34e497){if(_0x34e497){return[_0x34e497,![]];}return db[_0x45a2('0x92')]['create'](_0x239cb3)[_0x45a2('0x38')](function(_0x135259){return[_0x135259,!![]];});});}})[_0x45a2('0x95')](function(_0x2b988a,_0x3a7058){if(_0x2b988a){_0x27f24d=_0x3a7058;if(!_0x3a7058){var _0x554b29={'from':(_0x3cd5d0[_0x45a2('0x8f')]['firstName']||'')+'\x20'+(_0x3cd5d0[_0x45a2('0x8f')]['lastName']||'')};if(_0x42a0c9[_0x45a2('0x60')]['threadId']&&_0x42a0c9[_0x45a2('0x60')][_0x45a2('0x96')]&&_0x42a0c9[_0x45a2('0x60')][_0x45a2('0x91')]!=_0x42a0c9[_0x45a2('0x60')][_0x45a2('0x96')]){_0x554b29['threadId']=_0x42a0c9[_0x45a2('0x60')][_0x45a2('0x96')];}return _0x2b988a['update'](_0x554b29);}else{return _0x2b988a;}}})[_0x45a2('0x38')](function(_0x13a5e1){_0x3cd5d0[_0x45a2('0x97')]=_0x13a5e1[_0x45a2('0x3a')]({'plain':!![]});_0x3cd5d0[_0x45a2('0x97')]['created']=_0x27f24d;if(_0x3cd5d0[_0x45a2('0x97')]['created']){if(_0x3cd5d0[_0x45a2('0x88')]['autoclose']){_0x3cd5d0[_0x45a2('0x89')]['push']({'id':0x0,'priority':_0x3cd5d0['applications']['length']+0x1,'app':_0x45a2('0x98'),'appdata':_0x45a2('0x99'),'interval':_0x45a2('0x9a')});}}return db[_0x45a2('0x9b')]['create']({'body':_0x42a0c9[_0x45a2('0x60')]['body'],'OpenchannelAccountId':_0x42a0c9[_0x45a2('0x5b')]['id'],'OpenchannelInteractionId':_0x13a5e1['id'],'direction':'in','ContactId':_0x3cd5d0[_0x45a2('0x8f')]['id'],'AttachmentId':_0x42a0c9[_0x45a2('0x60')][_0x45a2('0x9c')]});})['then'](function(_0x3c90d2){_0x3cd5d0[_0x45a2('0x2a')]=_0x3c90d2;if(_0x3cd5d0[_0x45a2('0x97')][_0x45a2('0x9d')]){return db['User'][_0x45a2('0x67')]({'attributes':['id',_0x45a2('0x3e')],'where':{'id':_0x3cd5d0['interaction'][_0x45a2('0x9d')]}})[_0x45a2('0x38')](function(_0x582ad8){if(_0x582ad8){_0x3cd5d0['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x45a2('0x9e'),'appdata':_0x582ad8[_0x45a2('0x3e')]+','+(_0x3cd5d0['account'][_0x45a2('0x9f')]||0xa),'interval':_0x45a2('0x9a')});_0x3cd5d0[_0x45a2('0xa0')]=![];}return respondWithRpcPromise(_0x45a2('0xa1'),'startRouting',_0x3cd5d0);});}return respondWithRpcPromise('Start',_0x45a2('0xa2'),_0x3cd5d0);})['then'](function(_0x3a14b2){respondWithRpcPromise('EventManager',_0x45a2('0xa3'),{'event':_0x45a2('0x74'),'message':_0x3a14b2},client9002);return _0x3a14b2;})[_0x45a2('0x38')](respondWithResult(_0x9ae6c7,null))[_0x45a2('0x2c')](handleError(_0x9ae6c7,null));};exports[_0x45a2('0xa4')]=function(_0x97c5d6,_0x2ab946,_0x31bee6){return db[_0x45a2('0x42')][_0x45a2('0x6b')]({'where':{'id':_0x97c5d6[_0x45a2('0x5b')]['id']}})[_0x45a2('0x38')](handleEntityNotFound(_0x2ab946,null))[_0x45a2('0x38')](function(_0x157ee2){if(_0x157ee2){return db['sequelize'][_0x45a2('0xa5')](function(_0x21e315){return db[_0x45a2('0x86')][_0x45a2('0x39')]({'where':{'OpenchannelAccountId':_0x97c5d6[_0x45a2('0x5b')]['id']},'transaction':_0x21e315})[_0x45a2('0x38')](function(_0x606d25){var _0x2f8abe=_[_0x45a2('0x45')](_0x97c5d6[_0x45a2('0x60')],function(_0x2758b4){_0x2758b4[_0x45a2('0x6d')]=_0x97c5d6[_0x45a2('0x5b')]['id'];return _0x2758b4;});return db[_0x45a2('0x86')][_0x45a2('0xa6')](_0x2f8abe,{'transaction':_0x21e315});});})[_0x45a2('0x38')](function(){return db[_0x45a2('0x86')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x97c5d6['params']['id']},'order':'priority'});});}})['then'](respondWithResult(_0x2ab946,null))[_0x45a2('0x2c')](handleError(_0x2ab946,null));};exports[_0x45a2('0xa7')]=function(_0x2238ca,_0x1faace,_0x292c94){var _0x5aa97c={};var _0x52eece={};var _0x33d19e;var _0x92149d;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x2238ca[_0x45a2('0x5b')]['id']}})[_0x45a2('0x38')](handleEntityNotFound(_0x1faace,null))['then'](function(_0x1e18ae){if(_0x1e18ae){_0x33d19e=_0x1e18ae;_0x52eece[_0x45a2('0x44')]=_[_0x45a2('0x5d')](db[_0x45a2('0x86')]['rawAttributes']);_0x52eece[_0x45a2('0x46')]=_[_0x45a2('0x5d')](_0x2238ca[_0x45a2('0x46')]);_0x52eece[_0x45a2('0x47')]=_[_0x45a2('0x48')](_0x52eece[_0x45a2('0x44')],_0x52eece[_0x45a2('0x46')]);_0x5aa97c[_0x45a2('0x49')]=_['intersection'](_0x52eece[_0x45a2('0x44')],qs[_0x45a2('0x4a')](_0x2238ca[_0x45a2('0x46')][_0x45a2('0x4a')]));_0x5aa97c[_0x45a2('0x49')]=_0x5aa97c[_0x45a2('0x49')][_0x45a2('0x4b')]?_0x5aa97c['attributes']:_0x52eece[_0x45a2('0x44')];_0x5aa97c['order']=qs[_0x45a2('0x50')](_0x2238ca['query']['sort']);_0x5aa97c[_0x45a2('0x51')]=qs[_0x45a2('0x47')](_[_0x45a2('0x52')](_0x2238ca[_0x45a2('0x46')],_0x52eece[_0x45a2('0x47')]));if(_0x2238ca[_0x45a2('0x46')][_0x45a2('0x53')]){_0x5aa97c[_0x45a2('0x51')]=_['merge'](_0x5aa97c[_0x45a2('0x51')],{'$or':_[_0x45a2('0x45')](_0x5aa97c['attributes'],function(_0x4fe0df){var _0xf2930b={};_0xf2930b[_0x4fe0df]={'$like':'%'+_0x2238ca[_0x45a2('0x46')][_0x45a2('0x53')]+'%'};return _0xf2930b;})});}_0x5aa97c=_[_0x45a2('0x54')]({},_0x5aa97c,_0x2238ca[_0x45a2('0x5e')]);return _0x33d19e[_0x45a2('0xa7')](_0x5aa97c);}})[_0x45a2('0x38')](function(_0x537e7b){if(_0x537e7b){_0x92149d=_0x537e7b['length'];if(!_0x2238ca[_0x45a2('0x46')]['hasOwnProperty'](_0x45a2('0x4d'))){_0x5aa97c[_0x45a2('0x4e')]=qs[_0x45a2('0x4e')](_0x2238ca[_0x45a2('0x46')][_0x45a2('0x4e')]);_0x5aa97c[_0x45a2('0x32')]=qs['offset'](_0x2238ca['query'][_0x45a2('0x32')]);}return _0x33d19e[_0x45a2('0xa7')](_0x5aa97c);}})[_0x45a2('0x38')](function(_0x1f61b0){if(_0x1f61b0){return _0x1f61b0?{'count':_0x92149d,'rows':_0x1f61b0}:null;}})[_0x45a2('0x38')](respondWithResult(_0x1faace,null))[_0x45a2('0x2c')](handleError(_0x1faace,null));};exports['getInteractions']=function(_0x23b15b,_0x5108de,_0x17cc55){var _0x281586={'raw':![],'where':{}};var _0x54f8e4={};var _0x339cf1={'count':0x0,'rows':[]};return db[_0x45a2('0x42')][_0x45a2('0x6b')]({'where':{'id':_0x23b15b[_0x45a2('0x5b')]['id']}})[_0x45a2('0x38')](handleEntityNotFound(_0x5108de,null))[_0x45a2('0x38')](function(_0xb5c22d){if(_0xb5c22d){_0x54f8e4['model']=_[_0x45a2('0x5d')](db[_0x45a2('0x92')][_0x45a2('0x6c')]);_0x54f8e4[_0x45a2('0x46')]=_[_0x45a2('0x5d')](_0x23b15b[_0x45a2('0x46')]);_0x54f8e4['filters']=_[_0x45a2('0x48')](_0x54f8e4[_0x45a2('0x44')],_0x54f8e4[_0x45a2('0x46')]);_0x281586[_0x45a2('0x49')]=_[_0x45a2('0x48')](_0x54f8e4[_0x45a2('0x44')],qs['fields'](_0x23b15b['query'][_0x45a2('0x4a')]));_0x281586[_0x45a2('0x49')]=_0x281586['attributes'][_0x45a2('0x4b')]?_0x281586[_0x45a2('0x49')]:_0x54f8e4[_0x45a2('0x44')];if(!_0x23b15b[_0x45a2('0x46')][_0x45a2('0x4c')](_0x45a2('0x4d'))){_0x281586[_0x45a2('0x4e')]=qs['limit'](_0x23b15b['query'][_0x45a2('0x4e')]);_0x281586[_0x45a2('0x32')]=qs['offset'](_0x23b15b[_0x45a2('0x46')][_0x45a2('0x32')]);}_0x281586['order']=qs[_0x45a2('0x50')](_0x23b15b[_0x45a2('0x46')][_0x45a2('0x50')]);_0x281586[_0x45a2('0x51')]=qs[_0x45a2('0x47')](_[_0x45a2('0x52')](_0x23b15b['query'],_0x54f8e4[_0x45a2('0x47')]));_0x281586[_0x45a2('0x51')]['OpenchannelAccountId']=_0xb5c22d['id'];if(_0x23b15b['query']['filter']){_0x281586[_0x45a2('0x51')]=_[_0x45a2('0x54')](_0x281586['where'],{'$or':_[_0x45a2('0x45')](_0x281586[_0x45a2('0x49')],function(_0x10157a){var _0x326749={};_0x326749[_0x10157a]={'$like':'%'+_0x23b15b[_0x45a2('0x46')][_0x45a2('0x53')]+'%'};return _0x326749;})});}_0x281586=_[_0x45a2('0x54')]({},_0x281586,_0x23b15b[_0x45a2('0x5e')]);return db[_0x45a2('0x92')][_0x45a2('0x31')]({'where':_0x281586[_0x45a2('0x51')]})['then'](function(_0x2f88fb){_0x339cf1['count']=_0x2f88fb;if(_0x23b15b['query'][_0x45a2('0x56')]){_0x281586['include']=[{'model':db['CmContact'],'as':_0x45a2('0xa8'),'required':![]},{'model':db[_0x45a2('0xa9')],'as':_0x45a2('0xaa'),'attributes':[_0x45a2('0x3e'),_0x45a2('0xab'),_0x45a2('0xac')],'required':![]},{'model':db[_0x45a2('0xad')],'as':_0x45a2('0xae'),'attributes':['id','name','color'],'where':_0x23b15b[_0x45a2('0x46')][_0x45a2('0xaf')]?{'id':_0x23b15b[_0x45a2('0x46')][_0x45a2('0xaf')]}:undefined,'required':_0x23b15b['query'][_0x45a2('0xaf')]?!![]:![]}];}return db[_0x45a2('0x92')][_0x45a2('0x58')](_0x281586);})[_0x45a2('0x38')](function(_0x54b2ba){_0x339cf1[_0x45a2('0x59')]=_0x54b2ba;return _0x339cf1;});}})[_0x45a2('0x38')](respondWithFilteredResult(_0x5108de,_0x281586))[_0x45a2('0x2c')](handleError(_0x5108de,null));};exports[_0x45a2('0xb0')]=function(_0x1a59df,_0x1bd5c5,_0x266997){return db['OpenchannelAccount'][_0x45a2('0x67')]({'where':{'id':_0x1a59df['params']['id']}})[_0x45a2('0x38')](handleEntityNotFound(_0x1bd5c5,null))[_0x45a2('0x38')](function(_0x49eb16){if(_0x49eb16){return _0x49eb16[_0x45a2('0xb0')](_0x1a59df['body'][_0x45a2('0x6f')],_[_0x45a2('0xb1')](_0x1a59df[_0x45a2('0x60')],[_0x45a2('0x6f'),'id'])||{})['spread'](function(_0x1fcc78){for(var _0x46d475=0x0;_0x46d475<_0x1a59df[_0x45a2('0x60')][_0x45a2('0x6f')]['length'];_0x46d475+=0x1){socket[_0x45a2('0xb2')](_0x45a2('0xb3'),{'UserId':_0x1a59df['body'][_0x45a2('0x6f')][_0x46d475],'OpenchannelAccountId':_0x1a59df['params']['id']});}return _0x1fcc78;});}})[_0x45a2('0x38')](respondWithResult(_0x1bd5c5,null))['catch'](handleError(_0x1bd5c5,null));};exports[_0x45a2('0xb4')]=function(_0x1e7cf4,_0x530039,_0x1b019f){return db[_0x45a2('0x42')][_0x45a2('0x67')]({'where':{'id':_0x1e7cf4[_0x45a2('0x5b')]['id']}})[_0x45a2('0x38')](handleEntityNotFound(_0x530039,null))['then'](function(_0x252da8){if(_0x252da8){return _0x252da8[_0x45a2('0xb4')](_0x1e7cf4[_0x45a2('0x46')][_0x45a2('0x6f')])['then'](function(){if(_['isArray'](_0x1e7cf4[_0x45a2('0x46')]['ids'])){for(var _0x2d55bb=0x0;_0x2d55bb<_0x1e7cf4[_0x45a2('0x46')][_0x45a2('0x6f')][_0x45a2('0x4b')];_0x2d55bb+=0x1){socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x1e7cf4[_0x45a2('0x46')]['ids'][_0x2d55bb]),'OpenchannelAccountId':Number(_0x1e7cf4['params']['id'])});}}else{socket['emit'](_0x45a2('0xb5'),{'UserId':Number(_0x1e7cf4[_0x45a2('0x46')][_0x45a2('0x6f')]),'OpenchannelAccountId':Number(_0x1e7cf4['params']['id'])});}});}})[_0x45a2('0x38')](respondWithStatusCode(_0x530039,null))[_0x45a2('0x2c')](handleError(_0x530039,null));};exports['getAgents']=function(_0x43b1e6,_0xe7a80d,_0x376c17){var _0xd74dad={};var _0x1ea9a5={};var _0x51bdf4;var _0x6c1ab3;return db[_0x45a2('0x42')][_0x45a2('0x6b')]({'where':{'id':_0x43b1e6[_0x45a2('0x5b')]['id']}})[_0x45a2('0x38')](handleEntityNotFound(_0xe7a80d,null))[_0x45a2('0x38')](function(_0x51d74e){if(_0x51d74e){_0x51bdf4=_0x51d74e;_0x1ea9a5[_0x45a2('0x44')]=_[_0x45a2('0x5d')](db['User']['rawAttributes']);_0x1ea9a5[_0x45a2('0x46')]=_[_0x45a2('0x5d')](_0x43b1e6[_0x45a2('0x46')]);_0x1ea9a5[_0x45a2('0x47')]=_['intersection'](_0x1ea9a5['model'],_0x1ea9a5['query']);_0xd74dad[_0x45a2('0x49')]=_[_0x45a2('0x48')](_0x1ea9a5['model'],qs[_0x45a2('0x4a')](_0x43b1e6['query']['fields']));_0xd74dad[_0x45a2('0x49')]=_0xd74dad[_0x45a2('0x49')][_0x45a2('0x4b')]?_0xd74dad[_0x45a2('0x49')]:_0x1ea9a5[_0x45a2('0x44')];_0xd74dad[_0x45a2('0x4f')]=qs[_0x45a2('0x50')](_0x43b1e6[_0x45a2('0x46')]['sort']);_0xd74dad[_0x45a2('0x51')]=qs[_0x45a2('0x47')](_['pick'](_0x43b1e6[_0x45a2('0x46')],_0x1ea9a5[_0x45a2('0x47')]));if(_0x43b1e6[_0x45a2('0x46')][_0x45a2('0x53')]){_0xd74dad[_0x45a2('0x51')]=_['merge'](_0xd74dad[_0x45a2('0x51')],{'$or':_['map'](_0xd74dad[_0x45a2('0x49')],function(_0x4969e3){var _0x2ae9a1={};_0x2ae9a1[_0x4969e3]={'$like':'%'+_0x43b1e6[_0x45a2('0x46')][_0x45a2('0x53')]+'%'};return _0x2ae9a1;})});}_0xd74dad=_['merge']({},_0xd74dad,_0x43b1e6[_0x45a2('0x5e')]);return _0x51bdf4[_0x45a2('0xb6')](_0xd74dad);}})[_0x45a2('0x38')](function(_0x475ad1){if(_0x475ad1){_0x6c1ab3=_0x475ad1[_0x45a2('0x4b')];if(!_0x43b1e6[_0x45a2('0x46')][_0x45a2('0x4c')]('nolimit')){_0xd74dad[_0x45a2('0x4e')]=qs[_0x45a2('0x4e')](_0x43b1e6[_0x45a2('0x46')]['limit']);_0xd74dad['offset']=qs[_0x45a2('0x32')](_0x43b1e6[_0x45a2('0x46')][_0x45a2('0x32')]);}return _0x51bdf4['getAgents'](_0xd74dad);}})[_0x45a2('0x38')](function(_0x27441e){if(_0x27441e){return _0x27441e?{'count':_0x6c1ab3,'rows':_0x27441e}:null;}})[_0x45a2('0x38')](respondWithResult(_0xe7a80d,null))[_0x45a2('0x2c')](handleError(_0xe7a80d,null));};exports[_0x45a2('0x3f')]=function(_0x1e0bc9,_0x59cb81,_0x158336){var _0x15b28f,_0x1049f3,_0x3e34f9;if(_[_0x45a2('0x7c')](_0x1e0bc9['body'][_0x45a2('0x60')])||_0x1e0bc9[_0x45a2('0x60')][_0x45a2('0x60')]===''){throw new db[(_0x45a2('0x1e'))]['ValidationError'](_0x45a2('0x7f'));}if(_['isNil'](_0x1e0bc9['body']['to'])){}_0x15b28f=_0x1e0bc9[_0x45a2('0x60')]['to'];return db[_0x45a2('0x42')][_0x45a2('0x6b')]({'where':{'id':_0x1e0bc9[_0x45a2('0x5b')]['id']}})[_0x45a2('0x38')](handleEntityNotFound(_0x59cb81,null))[_0x45a2('0x38')](function(_0x37cd61){if(_0x37cd61){return db[_0x45a2('0x42')][_0x45a2('0x67')]({'where':{'id':_0x37cd61['id']},'include':[{'model':db['CmList'],'as':_0x45a2('0x8b'),'include':[{'model':db[_0x45a2('0x75')],'as':_0x45a2('0x84'),'where':{[_0x37cd61[_0x45a2('0x80')]]:_0x15b28f},'limit':0x1,'order':[[_0x45a2('0x79'),_0x45a2('0x85')]]}]}]})[_0x45a2('0x38')](handleEntityNotFound(_0x59cb81,null))[_0x45a2('0x38')](function(_0x5b5ffa){if(_0x5b5ffa&&_0x5b5ffa['List']){_0x1049f3=_0x5b5ffa['get']({'plain':!![]});if(_0x1049f3[_0x45a2('0x8b')]&&_0x1049f3['List'][_0x45a2('0x84')][_0x45a2('0x4b')]){return _0x1049f3['List'][_0x45a2('0x84')][0x0];}return db[_0x45a2('0x75')][_0x45a2('0x5f')](_['defaults'](_0x1e0bc9[_0x45a2('0x60')],{'firstName':_0x15b28f,[_0x5b5ffa[_0x45a2('0x80')]]:_0x15b28f,'phone':_0x15b28f,'ListId':_0x1049f3[_0x45a2('0x7b')]}));}})[_0x45a2('0x38')](handleEntityNotFound(_0x59cb81,null))[_0x45a2('0x38')](function(_0x5a5ef5){if(_0x5a5ef5){_0x3e34f9=_0x5a5ef5;return db[_0x45a2('0x92')][_0x45a2('0x67')]({'where':{'ContactId':_0x3e34f9['id'],'closed':![],'OpenchannelAccountId':_0x1049f3['id']}})[_0x45a2('0x38')](function(_0x362141){if(_0x362141){return[_0x362141,![]];}return db['OpenchannelInteraction']['create']({'UserId':_0x1e0bc9[_0x45a2('0x61')]['id'],'ContactId':_0x3e34f9['id'],'OpenchannelAccountId':_0x1049f3['id'],'lastMsgDirection':_0x45a2('0xb7'),'Messages':[_[_0x45a2('0x54')](_0x1e0bc9['body'],{'read':![],'body':_0x1e0bc9[_0x45a2('0x60')][_0x45a2('0x60')],'OpenchannelAccountId':_0x1049f3['id'],'UserId':_0x1e0bc9[_0x45a2('0x61')]['id'],'ContactId':_0x3e34f9['id']})]},{'include':[{'model':db[_0x45a2('0x9b')],'as':_0x45a2('0xb8')}]})[_0x45a2('0x38')](function(_0x4d34d4){return[_0x4d34d4,!![]];});});}})[_0x45a2('0x95')](function(_0x121b14,_0x501196){if(_0x501196){return _0x121b14;}return db[_0x45a2('0x9b')]['create'](_[_0x45a2('0x54')](_0x1e0bc9[_0x45a2('0x60')],{'read':![],'body':_0x1e0bc9[_0x45a2('0x60')]['body'],'OpenchannelAccountId':_0x1049f3['id'],'OpenchannelInteractionId':_0x121b14['id'],'UserId':_0x1e0bc9[_0x45a2('0x61')]['id'],'ContactId':_0x3e34f9['id']}))[_0x45a2('0x38')](function(_0x389f94){_0x121b14[_0x45a2('0xb9')][_0x45a2('0xb8')]=[];_0x121b14[_0x45a2('0xb9')][_0x45a2('0xb8')]['push'](_0x389f94[_0x45a2('0xb9')]);return _0x121b14;});});}})[_0x45a2('0x38')](respondWithResult(_0x59cb81,null))[_0x45a2('0x2c')](handleError(_0x59cb81,null));}; \ No newline at end of file +var _0xc1b9=['moment','bluebird','util','path','sox','ejs','crypto','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','./openchannelAccount.socket','register','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','findAll','rows','show','params','keys','include','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpnechannelAccountId','Disposition','findOne','OpenchannelAccountId','addAnswer','CannedAnswer','removeAnswers','ids','openchannel','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','CmContact','Contacts','DESC','OpenchannelApplication','Applications','account','applications','orderBy','priority','asc','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','User','UserId','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','notify','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','Tag','Tags','color','tag','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','CmList','out','Messages','dataValues','html-pdf','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x2285be,_0x39728b){var _0x59ce16=function(_0x24abea){while(--_0x24abea){_0x2285be['push'](_0x2285be['shift']());}};_0x59ce16(++_0x39728b);}(_0xc1b9,0xb8));var _0x9c1b=function(_0x4c05da,_0x414720){_0x4c05da=_0x4c05da-0x0;var _0x1614db=_0xc1b9[_0x4c05da];return _0x1614db;};'use strict';var pdf=require(_0x9c1b('0x0'));var emlformat=require(_0x9c1b('0x1'));var rimraf=require(_0x9c1b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9c1b('0x3'));var rp=require(_0x9c1b('0x4'));var moment=require(_0x9c1b('0x5'));var BPromise=require(_0x9c1b('0x6'));var Mustache=require('mustache');var util=require(_0x9c1b('0x7'));var path=require(_0x9c1b('0x8'));var sox=require(_0x9c1b('0x9'));var csv=require('to-csv');var ejs=require(_0x9c1b('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9c1b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9c1b('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9c1b('0xd'));var Papa=require(_0x9c1b('0xe'));var Redis=require(_0x9c1b('0xf'));var authService=require(_0x9c1b('0x10'));var qs=require(_0x9c1b('0x11'));var as=require(_0x9c1b('0x12'));var hardwareService=require(_0x9c1b('0x13'));var logger=require(_0x9c1b('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x9c1b('0x15'))['db'];config[_0x9c1b('0x16')]=_[_0x9c1b('0x17')](config[_0x9c1b('0x16')],{'host':_0x9c1b('0x18'),'port':0x18eb});var socket=require(_0x9c1b('0x19'))(new Redis(config['redis']));require(_0x9c1b('0x1a'))[_0x9c1b('0x1b')](socket);var jayson=require(_0x9c1b('0x1c'));var client=jayson[_0x9c1b('0x1d')]['http']({'port':0x232c});var client9002=jayson['client'][_0x9c1b('0x1e')]({'port':0x232a});function checkPasswordPattern(_0xb33928,_0x51307c,_0x4a7260){if(_0x4a7260){var _0x390ba8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x390ba8[_0x9c1b('0x1f')](_0x51307c)){return _0xb33928;}else{throw new db[(_0x9c1b('0x20'))]['ValidationError'](_0x9c1b('0x21'));}}else{return _0xb33928;}}function respondWithRpcPromise(_0x508010,_0x2564a7,_0x26462f,_0x17912c){return new BPromise(function(_0x5c8d89,_0x202109){var _0x201fd=_0x17912c||client;return _0x201fd[_0x9c1b('0x22')](_0x508010,_0x26462f)[_0x9c1b('0x23')](function(_0xe976b9){logger[_0x9c1b('0x24')](_0x9c1b('0x25'),_0x2564a7,_0x9c1b('0x26'));logger[_0x9c1b('0x27')](_0x9c1b('0x28'),_0x2564a7,_0x9c1b('0x26'),JSON[_0x9c1b('0x29')](_0xe976b9));if(_0xe976b9['error']){if(_0xe976b9['error']['code']===0x1f4){logger[_0x9c1b('0x2a')](_0x9c1b('0x25'),_0x2564a7,_0xe976b9[_0x9c1b('0x2a')][_0x9c1b('0x2b')]);return _0x202109(_0xe976b9['error'][_0x9c1b('0x2b')]);}logger[_0x9c1b('0x2a')](_0x9c1b('0x25'),_0x2564a7,_0xe976b9[_0x9c1b('0x2a')][_0x9c1b('0x2b')]);return _0x5c8d89(_0xe976b9['error'][_0x9c1b('0x2b')]);}else{logger[_0x9c1b('0x24')](_0x9c1b('0x25'),_0x2564a7,_0x9c1b('0x26'));_0x5c8d89(_0xe976b9[_0x9c1b('0x2c')][_0x9c1b('0x2b')]);}})[_0x9c1b('0x2d')](function(_0x4adb60){logger[_0x9c1b('0x2a')](_0x9c1b('0x25'),_0x2564a7,_0x4adb60);_0x202109(_0x4adb60);});});}function respondWithStatusCode(_0x3aa337,_0x3a8cf2){_0x3a8cf2=_0x3a8cf2||0xcc;return function(_0x158ccd){if(_0x158ccd){return _0x3aa337[_0x9c1b('0x2e')](_0x3a8cf2);}return _0x3aa337[_0x9c1b('0x2f')](_0x3a8cf2)[_0x9c1b('0x30')]();};}function respondWithResult(_0x30711a,_0x3cc409){_0x3cc409=_0x3cc409||0xc8;return function(_0x287358){if(_0x287358){return _0x30711a[_0x9c1b('0x2f')](_0x3cc409)['json'](_0x287358);}};}function respondWithFilteredResult(_0x401aa7,_0x3e01e2){return function(_0x48913a){if(_0x48913a){var _0x3bcbf4=_0x48913a[_0x9c1b('0x31')],_0x8d23f7=_0x3e01e2[_0x9c1b('0x32')],_0x173102=_0x3e01e2['offset']+_0x3e01e2['limit'],_0x22d4a3;if(_0x173102>=_0x3bcbf4){_0x173102=_0x3bcbf4;_0x22d4a3=0xc8;}else{_0x22d4a3=0xce;}_0x401aa7['status'](_0x22d4a3);return _0x401aa7[_0x9c1b('0x33')](_0x9c1b('0x34'),_0x8d23f7+'-'+_0x173102+'/'+_0x3bcbf4)[_0x9c1b('0x35')](_0x48913a);}return null;};}function patchUpdates(_0x18305d){return function(_0x3060c6){try{jsonpatch[_0x9c1b('0x36')](_0x3060c6,_0x18305d,!![]);}catch(_0x86bfb5){return BPromise[_0x9c1b('0x37')](_0x86bfb5);}return _0x3060c6[_0x9c1b('0x38')]();};}function saveUpdates(_0x5cd852,_0x4b75eb){return function(_0x43062e){if(_0x43062e){return _0x43062e[_0x9c1b('0x39')](_0x5cd852)['then'](function(_0x534fee){return _0x534fee;});}return null;};}function removeEntity(_0x2f2050,_0x120477){return function(_0x5cca92){if(_0x5cca92){return _0x5cca92[_0x9c1b('0x3a')]()[_0x9c1b('0x23')](function(){var _0x17001d=_0x5cca92['get']({'plain':!![]});var _0x5dc154='OpenchannelAccounts';return db['UserProfileResource'][_0x9c1b('0x3a')]({'where':{'type':_0x5dc154,'resourceId':_0x17001d['id']}})[_0x9c1b('0x23')](function(){return _0x5cca92;});})[_0x9c1b('0x23')](function(){_0x2f2050['status'](0xcc)[_0x9c1b('0x30')]();});}};}function handleEntityNotFound(_0x2bbeef,_0xe56bcc){return function(_0x21749c){if(!_0x21749c){_0x2bbeef[_0x9c1b('0x2e')](0x194);}return _0x21749c;};}function handleError(_0x3b0636,_0x5d0bd6){_0x5d0bd6=_0x5d0bd6||0x1f4;return function(_0x40baa2){logger[_0x9c1b('0x2a')](_0x40baa2[_0x9c1b('0x3b')]);if(_0x40baa2[_0x9c1b('0x3c')]){delete _0x40baa2['name'];}_0x3b0636[_0x9c1b('0x2f')](_0x5d0bd6)[_0x9c1b('0x3d')](_0x40baa2);};}exports[_0x9c1b('0x3e')]=function(_0x35e268,_0x2a983f){var _0x106bdc={'include':[{'model':db[_0x9c1b('0x3f')],'as':_0x9c1b('0x40')}]},_0x1cd508={},_0x19e0ec={'count':0x0,'rows':[]};var _0x16fc2a=_[_0x9c1b('0x41')](db[_0x9c1b('0x42')][_0x9c1b('0x43')],function(_0x582c04){return{'name':_0x582c04[_0x9c1b('0x44')],'type':_0x582c04[_0x9c1b('0x45')][_0x9c1b('0x46')]};});_0x1cd508[_0x9c1b('0x47')]=_[_0x9c1b('0x41')](_0x16fc2a,_0x9c1b('0x3c'));_0x1cd508['query']=_['keys'](_0x35e268[_0x9c1b('0x48')]);_0x1cd508[_0x9c1b('0x49')]=_[_0x9c1b('0x4a')](_0x1cd508[_0x9c1b('0x47')],_0x1cd508[_0x9c1b('0x48')]);_0x106bdc['attributes']=_[_0x9c1b('0x4a')](_0x1cd508[_0x9c1b('0x47')],qs[_0x9c1b('0x4b')](_0x35e268[_0x9c1b('0x48')][_0x9c1b('0x4b')]));_0x106bdc['attributes']=_0x106bdc[_0x9c1b('0x4c')][_0x9c1b('0x4d')]?_0x106bdc[_0x9c1b('0x4c')]:_0x1cd508[_0x9c1b('0x47')];if(!_0x35e268['query'][_0x9c1b('0x4e')](_0x9c1b('0x4f'))){_0x106bdc['limit']=qs[_0x9c1b('0x50')](_0x35e268[_0x9c1b('0x48')][_0x9c1b('0x50')]);_0x106bdc[_0x9c1b('0x32')]=qs['offset'](_0x35e268[_0x9c1b('0x48')][_0x9c1b('0x32')]);}_0x106bdc[_0x9c1b('0x51')]=qs['sort'](_0x35e268[_0x9c1b('0x48')][_0x9c1b('0x52')]);_0x106bdc[_0x9c1b('0x53')]=qs['filters'](_[_0x9c1b('0x54')](_0x35e268[_0x9c1b('0x48')],_0x1cd508[_0x9c1b('0x49')]));if(_0x35e268[_0x9c1b('0x48')]['filter']){_0x106bdc[_0x9c1b('0x53')]=_[_0x9c1b('0x55')](_0x106bdc[_0x9c1b('0x53')],{'$or':_[_0x9c1b('0x41')](_0x16fc2a,function(_0x5e749d){if(_0x5e749d[_0x9c1b('0x45')]!==_0x9c1b('0x56')){var _0x428732={};_0x428732[_0x5e749d['name']]={'$like':'%'+_0x35e268['query'][_0x9c1b('0x57')]+'%'};return _0x428732;}})});}_0x106bdc=_['merge']({},_0x106bdc,_0x35e268['options']);var _0x5e706a={'where':_0x106bdc[_0x9c1b('0x53')]};return db[_0x9c1b('0x42')][_0x9c1b('0x31')](_0x5e706a)[_0x9c1b('0x23')](function(_0xc48b99){_0x19e0ec[_0x9c1b('0x31')]=_0xc48b99;if(_0x35e268[_0x9c1b('0x48')][_0x9c1b('0x58')]){_0x106bdc['include']=[{'all':!![]}];}return db['OpenchannelAccount'][_0x9c1b('0x59')](_0x106bdc);})[_0x9c1b('0x23')](function(_0x3b9691){_0x19e0ec[_0x9c1b('0x5a')]=_0x3b9691;return _0x19e0ec;})['then'](respondWithFilteredResult(_0x2a983f,_0x106bdc))[_0x9c1b('0x2d')](handleError(_0x2a983f,null));};exports[_0x9c1b('0x5b')]=function(_0x2fd544,_0x294e69){var _0x4bcc89={'raw':![],'where':{'id':_0x2fd544[_0x9c1b('0x5c')]['id']},'include':[{'model':db[_0x9c1b('0x3f')],'as':_0x9c1b('0x40')}]},_0x21c9da={};_0x21c9da['model']=_[_0x9c1b('0x5d')](db['OpenchannelAccount'][_0x9c1b('0x43')]);_0x21c9da[_0x9c1b('0x48')]=_['keys'](_0x2fd544[_0x9c1b('0x48')]);_0x21c9da['filters']=_[_0x9c1b('0x4a')](_0x21c9da[_0x9c1b('0x47')],_0x21c9da['query']);_0x4bcc89[_0x9c1b('0x4c')]=_[_0x9c1b('0x4a')](_0x21c9da[_0x9c1b('0x47')],qs[_0x9c1b('0x4b')](_0x2fd544[_0x9c1b('0x48')]['fields']));_0x4bcc89[_0x9c1b('0x4c')]=_0x4bcc89[_0x9c1b('0x4c')][_0x9c1b('0x4d')]?_0x4bcc89[_0x9c1b('0x4c')]:_0x21c9da[_0x9c1b('0x47')];if(_0x2fd544[_0x9c1b('0x48')][_0x9c1b('0x58')]){_0x4bcc89[_0x9c1b('0x5e')]=[{'all':!![]}];}_0x4bcc89=_[_0x9c1b('0x55')]({},_0x4bcc89,_0x2fd544[_0x9c1b('0x5f')]);return db[_0x9c1b('0x42')][_0x9c1b('0x60')](_0x4bcc89)[_0x9c1b('0x23')](handleEntityNotFound(_0x294e69,null))['then'](respondWithResult(_0x294e69,null))[_0x9c1b('0x2d')](handleError(_0x294e69,null));};exports[_0x9c1b('0x61')]=function(_0x502bc8,_0x78f791){return db[_0x9c1b('0x42')][_0x9c1b('0x61')](_0x502bc8[_0x9c1b('0x62')],{})[_0x9c1b('0x23')](function(_0x5e28f1){var _0x29132f=_0x502bc8[_0x9c1b('0x63')][_0x9c1b('0x64')]({'plain':!![]});if(!_0x29132f)throw new Error(_0x9c1b('0x65'));if(_0x29132f[_0x9c1b('0x66')]===_0x9c1b('0x63')){var _0x46c16b=_0x5e28f1[_0x9c1b('0x64')]({'plain':!![]});var _0x48df7a=_0x9c1b('0x67');return db[_0x9c1b('0x68')][_0x9c1b('0x60')]({'where':{'name':_0x48df7a,'userProfileId':_0x29132f[_0x9c1b('0x69')]},'raw':!![]})[_0x9c1b('0x23')](function(_0x326d44){if(_0x326d44&&_0x326d44['autoAssociation']===0x0){return db['UserProfileResource'][_0x9c1b('0x61')]({'name':_0x46c16b['name'],'resourceId':_0x46c16b['id'],'type':_0x326d44[_0x9c1b('0x3c')],'sectionId':_0x326d44['id']},{})[_0x9c1b('0x23')](function(){return _0x5e28f1;});}else{return _0x5e28f1;}})[_0x9c1b('0x2d')](function(_0x1f87dd){logger[_0x9c1b('0x2a')](_0x9c1b('0x6a'),_0x1f87dd);throw _0x1f87dd;});}return _0x5e28f1;})[_0x9c1b('0x23')](respondWithResult(_0x78f791,0xc9))[_0x9c1b('0x2d')](handleError(_0x78f791,null));};exports[_0x9c1b('0x39')]=function(_0xf3e58,_0x5094d8){if(_0xf3e58[_0x9c1b('0x62')]['id']){delete _0xf3e58[_0x9c1b('0x62')]['id'];}return db[_0x9c1b('0x42')][_0x9c1b('0x60')]({'where':{'id':_0xf3e58[_0x9c1b('0x5c')]['id']},'include':[{'model':db[_0x9c1b('0x3f')],'as':_0x9c1b('0x40')}]})['then'](handleEntityNotFound(_0x5094d8,null))['then'](saveUpdates(_0xf3e58[_0x9c1b('0x62')],null))[_0x9c1b('0x23')](respondWithResult(_0x5094d8,null))[_0x9c1b('0x2d')](handleError(_0x5094d8,null));};exports[_0x9c1b('0x3a')]=function(_0x54ea6c,_0x9f971c){return db[_0x9c1b('0x42')][_0x9c1b('0x60')]({'where':{'id':_0x54ea6c['params']['id']}})[_0x9c1b('0x23')](handleEntityNotFound(_0x9f971c,null))[_0x9c1b('0x23')](removeEntity(_0x9f971c,null))[_0x9c1b('0x2d')](handleError(_0x9f971c,null));};exports[_0x9c1b('0x6b')]=function(_0x454ed2,_0x505956){return db[_0x9c1b('0x42')]['describe']()[_0x9c1b('0x23')](respondWithResult(_0x505956,null))['catch'](handleError(_0x505956,null));};exports[_0x9c1b('0x6c')]=function(_0xfe9fa3,_0x306513,_0x8f3074){if(_0xfe9fa3['body']['id']){delete _0xfe9fa3[_0x9c1b('0x62')]['id'];}return db[_0x9c1b('0x42')]['find']({'where':{'id':_0xfe9fa3[_0x9c1b('0x5c')]['id']}})[_0x9c1b('0x23')](handleEntityNotFound(_0x306513,null))[_0x9c1b('0x23')](function(_0x2f1949){if(_0x2f1949){_0xfe9fa3['body'][_0x9c1b('0x6d')]=_0x2f1949['id'];return db[_0x9c1b('0x6e')]['create'](_0xfe9fa3['body']);}})[_0x9c1b('0x23')](respondWithResult(_0x306513,null))[_0x9c1b('0x2d')](handleError(_0x306513,null));};exports['getDispositions']=function(_0x37613a,_0x5c0dcd,_0x19ec66){var _0x4521b3={'raw':![],'where':{}};var _0x2a07ad={};var _0x32a504={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x9c1b('0x6f')]({'where':{'id':_0x37613a['params']['id']}})['then'](handleEntityNotFound(_0x5c0dcd,null))[_0x9c1b('0x23')](function(_0xe5496b){if(_0xe5496b){_0x2a07ad[_0x9c1b('0x47')]=_[_0x9c1b('0x5d')](db['Disposition']['rawAttributes']);_0x2a07ad[_0x9c1b('0x48')]=_[_0x9c1b('0x5d')](_0x37613a[_0x9c1b('0x48')]);_0x2a07ad[_0x9c1b('0x49')]=_[_0x9c1b('0x4a')](_0x2a07ad['model'],_0x2a07ad[_0x9c1b('0x48')]);_0x4521b3[_0x9c1b('0x4c')]=_['intersection'](_0x2a07ad[_0x9c1b('0x47')],qs['fields'](_0x37613a[_0x9c1b('0x48')]['fields']));_0x4521b3[_0x9c1b('0x4c')]=_0x4521b3['attributes'][_0x9c1b('0x4d')]?_0x4521b3[_0x9c1b('0x4c')]:_0x2a07ad['model'];if(!_0x37613a['query']['hasOwnProperty'](_0x9c1b('0x4f'))){_0x4521b3[_0x9c1b('0x50')]=qs['limit'](_0x37613a[_0x9c1b('0x48')][_0x9c1b('0x50')]);_0x4521b3[_0x9c1b('0x32')]=qs[_0x9c1b('0x32')](_0x37613a['query'][_0x9c1b('0x32')]);}_0x4521b3[_0x9c1b('0x51')]=qs[_0x9c1b('0x52')](_0x37613a[_0x9c1b('0x48')][_0x9c1b('0x52')]);_0x4521b3[_0x9c1b('0x53')]=qs[_0x9c1b('0x49')](_[_0x9c1b('0x54')](_0x37613a['query'],_0x2a07ad[_0x9c1b('0x49')]));_0x4521b3[_0x9c1b('0x53')][_0x9c1b('0x70')]=_0xe5496b['id'];if(_0x37613a['query'][_0x9c1b('0x57')]){_0x4521b3['where']=_[_0x9c1b('0x55')](_0x4521b3[_0x9c1b('0x53')],{'$or':_['map'](_0x4521b3['attributes'],function(_0x652dc8){var _0xd98e80={};_0xd98e80[_0x652dc8]={'$like':'%'+_0x37613a['query'][_0x9c1b('0x57')]+'%'};return _0xd98e80;})});}_0x4521b3=_[_0x9c1b('0x55')]({},_0x4521b3,_0x37613a[_0x9c1b('0x5f')]);return db[_0x9c1b('0x6e')][_0x9c1b('0x31')]({'where':_0x4521b3[_0x9c1b('0x53')]})[_0x9c1b('0x23')](function(_0x276a12){_0x32a504['count']=_0x276a12;if(_0x37613a[_0x9c1b('0x48')][_0x9c1b('0x58')]){_0x4521b3[_0x9c1b('0x5e')]=[{'all':!![]}];}return db[_0x9c1b('0x6e')][_0x9c1b('0x59')](_0x4521b3);})['then'](function(_0x4ad7d9){_0x32a504[_0x9c1b('0x5a')]=_0x4ad7d9;return _0x32a504;});}})[_0x9c1b('0x23')](respondWithFilteredResult(_0x5c0dcd,_0x4521b3))['catch'](handleError(_0x5c0dcd,null));};exports['removeDispositions']=function(_0x4b79c9,_0x5b8edb,_0x4b0bc9){return db[_0x9c1b('0x42')][_0x9c1b('0x60')]({'where':{'id':_0x4b79c9['params']['id']}})['then'](handleEntityNotFound(_0x5b8edb,null))['then'](function(_0x398321){if(_0x398321){return _0x398321['removeDispositions'](_0x4b79c9[_0x9c1b('0x48')]['ids']);}})[_0x9c1b('0x23')](respondWithStatusCode(_0x5b8edb,null))['catch'](handleError(_0x5b8edb,null));};exports[_0x9c1b('0x71')]=function(_0x47b243,_0x388e06,_0x2cc8dd){if(_0x47b243['body']['id']){delete _0x47b243[_0x9c1b('0x62')]['id'];}return db[_0x9c1b('0x42')][_0x9c1b('0x60')]({'where':{'id':_0x47b243['params']['id']}})['then'](handleEntityNotFound(_0x388e06,null))[_0x9c1b('0x23')](function(_0x5f495e){if(_0x5f495e){_0x47b243['body'][_0x9c1b('0x70')]=_0x5f495e['id'];return db[_0x9c1b('0x72')][_0x9c1b('0x61')](_0x47b243['body']);}})[_0x9c1b('0x23')](respondWithResult(_0x388e06,null))[_0x9c1b('0x2d')](handleError(_0x388e06,null));};exports['getAnswers']=function(_0x1a279b,_0x46fe2d,_0x47151f){var _0x90ad4e={'raw':![],'where':{}};var _0x13a281={};var _0xcb1125={'count':0x0,'rows':[]};return db[_0x9c1b('0x42')][_0x9c1b('0x6f')]({'where':{'id':_0x1a279b[_0x9c1b('0x5c')]['id']}})[_0x9c1b('0x23')](handleEntityNotFound(_0x46fe2d,null))[_0x9c1b('0x23')](function(_0x58c89e){if(_0x58c89e){_0x13a281[_0x9c1b('0x47')]=_[_0x9c1b('0x5d')](db[_0x9c1b('0x72')][_0x9c1b('0x43')]);_0x13a281[_0x9c1b('0x48')]=_['keys'](_0x1a279b[_0x9c1b('0x48')]);_0x13a281[_0x9c1b('0x49')]=_[_0x9c1b('0x4a')](_0x13a281[_0x9c1b('0x47')],_0x13a281['query']);_0x90ad4e['attributes']=_[_0x9c1b('0x4a')](_0x13a281[_0x9c1b('0x47')],qs[_0x9c1b('0x4b')](_0x1a279b[_0x9c1b('0x48')][_0x9c1b('0x4b')]));_0x90ad4e[_0x9c1b('0x4c')]=_0x90ad4e[_0x9c1b('0x4c')][_0x9c1b('0x4d')]?_0x90ad4e['attributes']:_0x13a281[_0x9c1b('0x47')];if(!_0x1a279b['query']['hasOwnProperty'](_0x9c1b('0x4f'))){_0x90ad4e['limit']=qs[_0x9c1b('0x50')](_0x1a279b['query'][_0x9c1b('0x50')]);_0x90ad4e[_0x9c1b('0x32')]=qs[_0x9c1b('0x32')](_0x1a279b[_0x9c1b('0x48')][_0x9c1b('0x32')]);}_0x90ad4e[_0x9c1b('0x51')]=qs['sort'](_0x1a279b['query'][_0x9c1b('0x52')]);_0x90ad4e[_0x9c1b('0x53')]=qs[_0x9c1b('0x49')](_[_0x9c1b('0x54')](_0x1a279b[_0x9c1b('0x48')],_0x13a281[_0x9c1b('0x49')]));_0x90ad4e['where'][_0x9c1b('0x70')]=_0x58c89e['id'];if(_0x1a279b[_0x9c1b('0x48')][_0x9c1b('0x57')]){_0x90ad4e['where']=_['merge'](_0x90ad4e[_0x9c1b('0x53')],{'$or':_['map'](_0x90ad4e[_0x9c1b('0x4c')],function(_0x3bf746){var _0xbbcd04={};_0xbbcd04[_0x3bf746]={'$like':'%'+_0x1a279b[_0x9c1b('0x48')]['filter']+'%'};return _0xbbcd04;})});}_0x90ad4e=_['merge']({},_0x90ad4e,_0x1a279b[_0x9c1b('0x5f')]);return db['CannedAnswer'][_0x9c1b('0x31')]({'where':_0x90ad4e[_0x9c1b('0x53')]})[_0x9c1b('0x23')](function(_0x1242bf){_0xcb1125[_0x9c1b('0x31')]=_0x1242bf;if(_0x1a279b[_0x9c1b('0x48')][_0x9c1b('0x58')]){_0x90ad4e['include']=[{'all':!![]}];}return db[_0x9c1b('0x72')]['findAll'](_0x90ad4e);})[_0x9c1b('0x23')](function(_0xdc767f){_0xcb1125[_0x9c1b('0x5a')]=_0xdc767f;return _0xcb1125;});}})[_0x9c1b('0x23')](respondWithFilteredResult(_0x46fe2d,_0x90ad4e))[_0x9c1b('0x2d')](handleError(_0x46fe2d,null));};exports[_0x9c1b('0x73')]=function(_0x2199fb,_0x7535a5,_0x3e679f){return db[_0x9c1b('0x42')][_0x9c1b('0x60')]({'where':{'id':_0x2199fb[_0x9c1b('0x5c')]['id']}})[_0x9c1b('0x23')](handleEntityNotFound(_0x7535a5,null))[_0x9c1b('0x23')](function(_0x24628e){if(_0x24628e){return _0x24628e[_0x9c1b('0x73')](_0x2199fb[_0x9c1b('0x48')][_0x9c1b('0x74')]);}})[_0x9c1b('0x23')](respondWithStatusCode(_0x7535a5,null))[_0x9c1b('0x2d')](handleError(_0x7535a5,null));};exports['notify']=function(_0x431f5e,_0x26e608,_0x56f523){var _0x3345a6={'body':_0x431f5e[_0x9c1b('0x62')],'channel':_0x9c1b('0x75')};var _0x596c2f=[];var _0x2d4115=[];var _0x1ab892={};var _0xbfa049=![];return db['CmContact'][_0x9c1b('0x6b')]()[_0x9c1b('0x23')](function(_0x401a90){if(!_0x401a90){throw new db[(_0x9c1b('0x20'))][(_0x9c1b('0x76'))](_0x9c1b('0x77'));}_0x596c2f=_[_0x9c1b('0x78')](_['keys'](_0x401a90),[_0x9c1b('0x79'),_0x9c1b('0x7a')]);_0x2d4115=_[_0x9c1b('0x78')](_[_0x9c1b('0x5d')](_0x401a90),[_0x9c1b('0x79'),_0x9c1b('0x7a'),_0x9c1b('0x7b'),_0x9c1b('0x7c')]);if(_0x431f5e[_0x9c1b('0x62')]['id']){delete _0x431f5e[_0x9c1b('0x62')]['id'];}if(_[_0x9c1b('0x7d')](_0x431f5e['body'][_0x9c1b('0x7e')])){throw new db[(_0x9c1b('0x20'))][(_0x9c1b('0x76'))](_0x9c1b('0x7f'));}if(_[_0x9c1b('0x7d')](_0x431f5e[_0x9c1b('0x62')][_0x9c1b('0x62')])||_0x431f5e[_0x9c1b('0x62')]['body']===''){throw new db[(_0x9c1b('0x20'))][(_0x9c1b('0x76'))](_0x9c1b('0x80'));}if(_[_0x9c1b('0x7d')](_0x431f5e[_0x9c1b('0x62')][_0x9c1b('0x81')])){throw new db[(_0x9c1b('0x20'))][(_0x9c1b('0x76'))](_0x9c1b('0x82')+_0x2d4115);}if(!_[_0x9c1b('0x83')](_0x2d4115,_0x431f5e['body'][_0x9c1b('0x81')])){throw new db[(_0x9c1b('0x20'))]['ValidationError'](_0x9c1b('0x84')+_0x2d4115);}_0x1ab892[_0x431f5e[_0x9c1b('0x62')]['mapKey']]=_0x431f5e[_0x9c1b('0x62')][_0x9c1b('0x7e')];})[_0x9c1b('0x23')](function(){return db['OpenchannelAccount'][_0x9c1b('0x60')]({'where':{'id':_0x431f5e[_0x9c1b('0x5c')]['id']},'include':[{'model':db['CmList'],'as':_0x9c1b('0x85'),'include':[{'model':db[_0x9c1b('0x86')],'as':_0x9c1b('0x87'),'where':_0x1ab892,'limit':0x1,'order':[['updatedAt',_0x9c1b('0x88')]]}]},{'model':db[_0x9c1b('0x89')],'as':_0x9c1b('0x8a')}]});})[_0x9c1b('0x23')](handleEntityNotFound(_0x26e608,null))[_0x9c1b('0x23')](function(_0x3107be){if(_0x3107be&&_0x3107be['List']){_0x3345a6[_0x9c1b('0x8b')]=_0x3107be;_0x3345a6['applications']=_0x3107be[_0x9c1b('0x8a')];_0x3345a6['list']=_0x3107be[_0x9c1b('0x85')];_0x3345a6[_0x9c1b('0x8c')]=_[_0x9c1b('0x8d')](_0x3345a6[_0x9c1b('0x8c')],[_0x9c1b('0x8e')],[_0x9c1b('0x8f')]);if(_0x3345a6[_0x9c1b('0x8b')][_0x9c1b('0x8a')]){delete _0x3345a6['account'][_0x9c1b('0x8a')];}if(_0x3345a6[_0x9c1b('0x8b')][_0x9c1b('0x85')]&&_0x3345a6['account'][_0x9c1b('0x85')][_0x9c1b('0x87')]['length']){return _0x3345a6[_0x9c1b('0x8b')]['List'][_0x9c1b('0x87')][0x0];}var _0x1a133b=_['defaults'](_0x431f5e[_0x9c1b('0x62')],{'firstName':_0x431f5e[_0x9c1b('0x62')][_0x9c1b('0x7e')],'ListId':_0x3107be[_0x9c1b('0x7c')]});_0x1a133b[_0x431f5e[_0x9c1b('0x62')][_0x9c1b('0x81')]]=_0x431f5e['body'][_0x9c1b('0x7e')];return db['CmContact']['create'](_0x1a133b,{'fields':_0x596c2f,'raw':!![]});}})[_0x9c1b('0x23')](handleEntityNotFound(_0x26e608,null))[_0x9c1b('0x23')](function(_0x713701){_0x3345a6[_0x9c1b('0x90')]=_0x713701;if(_0x713701){var _0x2230a7={'ContactId':_0x713701['id'],'OpenchannelAccountId':_0x431f5e[_0x9c1b('0x5c')]['id'],'from':(_0x713701[_0x9c1b('0x91')]||'')+'\x20'+(_0x713701[_0x9c1b('0x92')]||'')};var _0x1f6e0c={'OpenchannelAccountId':_0x431f5e[_0x9c1b('0x5c')]['id'],'closed':![]};if(_0x431f5e['body'][_0x9c1b('0x93')]){_0x1f6e0c[_0x9c1b('0x93')]=_0x431f5e[_0x9c1b('0x62')][_0x9c1b('0x93')];return db[_0x9c1b('0x94')][_0x9c1b('0x60')]({'where':_0x1f6e0c})[_0x9c1b('0x23')](function(_0x127318){if(_0x127318){return[_0x127318,![]];}_0x2230a7[_0x9c1b('0x93')]=_0x431f5e[_0x9c1b('0x62')][_0x9c1b('0x93')];_0x2230a7['externalUrl']=_0x431f5e['body'][_0x9c1b('0x95')];return db[_0x9c1b('0x94')][_0x9c1b('0x61')](_0x2230a7)[_0x9c1b('0x23')](function(_0x25edfe){return[_0x25edfe,!![]];});});}else{_0x1f6e0c['threadId']=null;}_0x1f6e0c[_0x9c1b('0x96')]=_0x713701['id'];return db[_0x9c1b('0x94')][_0x9c1b('0x60')]({'where':_0x1f6e0c})[_0x9c1b('0x23')](function(_0x35a98b){if(_0x35a98b){return[_0x35a98b,![]];}return db[_0x9c1b('0x94')][_0x9c1b('0x61')](_0x2230a7)['then'](function(_0x1bd306){return[_0x1bd306,!![]];});});}})[_0x9c1b('0x97')](function(_0x5aa03f,_0x3eaee4){if(_0x5aa03f){_0xbfa049=_0x3eaee4;if(!_0x3eaee4){var _0x5e9873={'from':(_0x3345a6['contact'][_0x9c1b('0x91')]||'')+'\x20'+(_0x3345a6[_0x9c1b('0x90')][_0x9c1b('0x92')]||'')};if(_0x431f5e[_0x9c1b('0x62')][_0x9c1b('0x93')]&&_0x431f5e['body']['messageId']&&_0x431f5e[_0x9c1b('0x62')]['threadId']!=_0x431f5e['body']['messageId']){_0x5e9873[_0x9c1b('0x93')]=_0x431f5e[_0x9c1b('0x62')][_0x9c1b('0x98')];}return _0x5aa03f[_0x9c1b('0x39')](_0x5e9873);}else{return _0x5aa03f;}}})[_0x9c1b('0x23')](function(_0x34b3bb){_0x3345a6[_0x9c1b('0x99')]=_0x34b3bb['get']({'plain':!![]});_0x3345a6[_0x9c1b('0x99')][_0x9c1b('0x9a')]=_0xbfa049;if(_0x3345a6['interaction']['created']){if(_0x3345a6['account']['autoclose']){_0x3345a6[_0x9c1b('0x8c')][_0x9c1b('0x9b')]({'id':0x0,'priority':_0x3345a6['applications']['length']+0x1,'app':_0x9c1b('0x9c'),'appdata':_0x9c1b('0x9d'),'interval':_0x9c1b('0x9e')});}}return db[_0x9c1b('0x9f')][_0x9c1b('0x61')]({'body':_0x431f5e[_0x9c1b('0x62')][_0x9c1b('0x62')],'OpenchannelAccountId':_0x431f5e[_0x9c1b('0x5c')]['id'],'OpenchannelInteractionId':_0x34b3bb['id'],'direction':'in','ContactId':_0x3345a6[_0x9c1b('0x90')]['id'],'AttachmentId':_0x431f5e[_0x9c1b('0x62')][_0x9c1b('0xa0')]});})[_0x9c1b('0x23')](function(_0x2d49ee){_0x3345a6['message']=_0x2d49ee;if(_0x3345a6['interaction']['UserId']){return db[_0x9c1b('0xa1')][_0x9c1b('0x60')]({'attributes':['id',_0x9c1b('0x3c')],'where':{'id':_0x3345a6[_0x9c1b('0x99')][_0x9c1b('0xa2')]}})[_0x9c1b('0x23')](function(_0x52b20a){if(_0x52b20a){_0x3345a6['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x9c1b('0xa3'),'appdata':_0x52b20a[_0x9c1b('0x3c')]+','+(_0x3345a6[_0x9c1b('0x8b')][_0x9c1b('0xa4')]||0xa),'interval':_0x9c1b('0x9e')});_0x3345a6[_0x9c1b('0xa5')]=![];}return respondWithRpcPromise(_0x9c1b('0xa6'),_0x9c1b('0xa7'),_0x3345a6);});}return respondWithRpcPromise(_0x9c1b('0xa6'),'startRouting',_0x3345a6);})[_0x9c1b('0x23')](function(_0x3206c3){respondWithRpcPromise('EventManager','EventManager',{'event':_0x9c1b('0xa8'),'message':_0x3206c3},client9002);return _0x3206c3;})[_0x9c1b('0x23')](respondWithResult(_0x26e608,null))['catch'](handleError(_0x26e608,null));};exports['addApplications']=function(_0x3303da,_0x40444f,_0x33ebe8){return db[_0x9c1b('0x42')][_0x9c1b('0x6f')]({'where':{'id':_0x3303da[_0x9c1b('0x5c')]['id']}})[_0x9c1b('0x23')](handleEntityNotFound(_0x40444f,null))[_0x9c1b('0x23')](function(_0x26f774){if(_0x26f774){return db['sequelize']['transaction'](function(_0x500c67){return db['OpenchannelApplication'][_0x9c1b('0x3a')]({'where':{'OpenchannelAccountId':_0x3303da['params']['id']},'transaction':_0x500c67})[_0x9c1b('0x23')](function(_0x348147){var _0x2f82e9=_[_0x9c1b('0x41')](_0x3303da[_0x9c1b('0x62')],function(_0x104491){_0x104491[_0x9c1b('0x70')]=_0x3303da[_0x9c1b('0x5c')]['id'];return _0x104491;});return db[_0x9c1b('0x89')][_0x9c1b('0xa9')](_0x2f82e9,{'transaction':_0x500c67});});})[_0x9c1b('0x23')](function(){return db[_0x9c1b('0x89')][_0x9c1b('0xaa')]({'where':{'OpenchannelAccountId':_0x3303da['params']['id']},'order':'priority'});});}})[_0x9c1b('0x23')](respondWithResult(_0x40444f,null))[_0x9c1b('0x2d')](handleError(_0x40444f,null));};exports[_0x9c1b('0xab')]=function(_0x2a9a9c,_0x3fbc89,_0x279f8c){var _0x1f4d29={};var _0xfaab8f={};var _0x3c788e;var _0x50310b;return db[_0x9c1b('0x42')][_0x9c1b('0x6f')]({'where':{'id':_0x2a9a9c[_0x9c1b('0x5c')]['id']}})[_0x9c1b('0x23')](handleEntityNotFound(_0x3fbc89,null))[_0x9c1b('0x23')](function(_0x35d9e3){if(_0x35d9e3){_0x3c788e=_0x35d9e3;_0xfaab8f['model']=_['keys'](db[_0x9c1b('0x89')][_0x9c1b('0x43')]);_0xfaab8f[_0x9c1b('0x48')]=_[_0x9c1b('0x5d')](_0x2a9a9c[_0x9c1b('0x48')]);_0xfaab8f[_0x9c1b('0x49')]=_['intersection'](_0xfaab8f[_0x9c1b('0x47')],_0xfaab8f[_0x9c1b('0x48')]);_0x1f4d29[_0x9c1b('0x4c')]=_[_0x9c1b('0x4a')](_0xfaab8f['model'],qs[_0x9c1b('0x4b')](_0x2a9a9c[_0x9c1b('0x48')][_0x9c1b('0x4b')]));_0x1f4d29[_0x9c1b('0x4c')]=_0x1f4d29['attributes'][_0x9c1b('0x4d')]?_0x1f4d29['attributes']:_0xfaab8f[_0x9c1b('0x47')];_0x1f4d29[_0x9c1b('0x51')]=qs[_0x9c1b('0x52')](_0x2a9a9c['query'][_0x9c1b('0x52')]);_0x1f4d29[_0x9c1b('0x53')]=qs[_0x9c1b('0x49')](_[_0x9c1b('0x54')](_0x2a9a9c[_0x9c1b('0x48')],_0xfaab8f[_0x9c1b('0x49')]));if(_0x2a9a9c['query']['filter']){_0x1f4d29['where']=_[_0x9c1b('0x55')](_0x1f4d29['where'],{'$or':_[_0x9c1b('0x41')](_0x1f4d29[_0x9c1b('0x4c')],function(_0x22e666){var _0x4f4f9c={};_0x4f4f9c[_0x22e666]={'$like':'%'+_0x2a9a9c['query'][_0x9c1b('0x57')]+'%'};return _0x4f4f9c;})});}_0x1f4d29=_[_0x9c1b('0x55')]({},_0x1f4d29,_0x2a9a9c[_0x9c1b('0x5f')]);return _0x3c788e[_0x9c1b('0xab')](_0x1f4d29);}})[_0x9c1b('0x23')](function(_0x22beb4){if(_0x22beb4){_0x50310b=_0x22beb4[_0x9c1b('0x4d')];if(!_0x2a9a9c[_0x9c1b('0x48')][_0x9c1b('0x4e')](_0x9c1b('0x4f'))){_0x1f4d29[_0x9c1b('0x50')]=qs[_0x9c1b('0x50')](_0x2a9a9c['query']['limit']);_0x1f4d29[_0x9c1b('0x32')]=qs[_0x9c1b('0x32')](_0x2a9a9c[_0x9c1b('0x48')][_0x9c1b('0x32')]);}return _0x3c788e[_0x9c1b('0xab')](_0x1f4d29);}})[_0x9c1b('0x23')](function(_0x5bc039){if(_0x5bc039){return _0x5bc039?{'count':_0x50310b,'rows':_0x5bc039}:null;}})[_0x9c1b('0x23')](respondWithResult(_0x3fbc89,null))['catch'](handleError(_0x3fbc89,null));};exports[_0x9c1b('0xac')]=function(_0x53974d,_0xeb6b31,_0x48003f){var _0x49ca7a={'raw':![],'where':{}};var _0x3c65b5={};var _0x54cc1b={'count':0x0,'rows':[]};return db[_0x9c1b('0x42')][_0x9c1b('0x6f')]({'where':{'id':_0x53974d[_0x9c1b('0x5c')]['id']}})[_0x9c1b('0x23')](handleEntityNotFound(_0xeb6b31,null))[_0x9c1b('0x23')](function(_0x4c555f){if(_0x4c555f){_0x3c65b5[_0x9c1b('0x47')]=_[_0x9c1b('0x5d')](db[_0x9c1b('0x94')][_0x9c1b('0x43')]);_0x3c65b5['query']=_['keys'](_0x53974d['query']);_0x3c65b5[_0x9c1b('0x49')]=_[_0x9c1b('0x4a')](_0x3c65b5[_0x9c1b('0x47')],_0x3c65b5[_0x9c1b('0x48')]);_0x49ca7a['attributes']=_[_0x9c1b('0x4a')](_0x3c65b5[_0x9c1b('0x47')],qs['fields'](_0x53974d[_0x9c1b('0x48')][_0x9c1b('0x4b')]));_0x49ca7a[_0x9c1b('0x4c')]=_0x49ca7a[_0x9c1b('0x4c')][_0x9c1b('0x4d')]?_0x49ca7a[_0x9c1b('0x4c')]:_0x3c65b5['model'];if(!_0x53974d[_0x9c1b('0x48')][_0x9c1b('0x4e')](_0x9c1b('0x4f'))){_0x49ca7a[_0x9c1b('0x50')]=qs[_0x9c1b('0x50')](_0x53974d[_0x9c1b('0x48')][_0x9c1b('0x50')]);_0x49ca7a[_0x9c1b('0x32')]=qs[_0x9c1b('0x32')](_0x53974d[_0x9c1b('0x48')][_0x9c1b('0x32')]);}_0x49ca7a[_0x9c1b('0x51')]=qs[_0x9c1b('0x52')](_0x53974d[_0x9c1b('0x48')]['sort']);_0x49ca7a['where']=qs[_0x9c1b('0x49')](_['pick'](_0x53974d[_0x9c1b('0x48')],_0x3c65b5['filters']));_0x49ca7a[_0x9c1b('0x53')][_0x9c1b('0x70')]=_0x4c555f['id'];if(_0x53974d[_0x9c1b('0x48')][_0x9c1b('0x57')]){_0x49ca7a[_0x9c1b('0x53')]=_['merge'](_0x49ca7a['where'],{'$or':_[_0x9c1b('0x41')](_0x49ca7a[_0x9c1b('0x4c')],function(_0x33a51f){var _0x4c1467={};_0x4c1467[_0x33a51f]={'$like':'%'+_0x53974d[_0x9c1b('0x48')][_0x9c1b('0x57')]+'%'};return _0x4c1467;})});}_0x49ca7a=_[_0x9c1b('0x55')]({},_0x49ca7a,_0x53974d[_0x9c1b('0x5f')]);return db[_0x9c1b('0x94')][_0x9c1b('0x31')]({'where':_0x49ca7a[_0x9c1b('0x53')]})[_0x9c1b('0x23')](function(_0xbdfc28){_0x54cc1b[_0x9c1b('0x31')]=_0xbdfc28;if(_0x53974d['query']['includeAll']){_0x49ca7a[_0x9c1b('0x5e')]=[{'model':db['CmContact'],'as':_0x9c1b('0xad'),'required':![]},{'model':db[_0x9c1b('0xa1')],'as':_0x9c1b('0xae'),'attributes':[_0x9c1b('0x3c'),'fullname','internal'],'required':![]},{'model':db[_0x9c1b('0xaf')],'as':_0x9c1b('0xb0'),'attributes':['id',_0x9c1b('0x3c'),_0x9c1b('0xb1')],'where':_0x53974d[_0x9c1b('0x48')][_0x9c1b('0xb2')]?{'id':_0x53974d[_0x9c1b('0x48')][_0x9c1b('0xb2')]}:undefined,'required':_0x53974d[_0x9c1b('0x48')][_0x9c1b('0xb2')]?!![]:![]}];}return db['OpenchannelInteraction']['findAll'](_0x49ca7a);})[_0x9c1b('0x23')](function(_0x15f3f1){_0x54cc1b[_0x9c1b('0x5a')]=_0x15f3f1;return _0x54cc1b;});}})[_0x9c1b('0x23')](respondWithFilteredResult(_0xeb6b31,_0x49ca7a))[_0x9c1b('0x2d')](handleError(_0xeb6b31,null));};exports['addAgents']=function(_0xc61ffc,_0x5bb200,_0x28aab5){return db[_0x9c1b('0x42')][_0x9c1b('0x60')]({'where':{'id':_0xc61ffc[_0x9c1b('0x5c')]['id']}})[_0x9c1b('0x23')](handleEntityNotFound(_0x5bb200,null))[_0x9c1b('0x23')](function(_0x382bc5){if(_0x382bc5){return _0x382bc5['addAgents'](_0xc61ffc[_0x9c1b('0x62')][_0x9c1b('0x74')],_['omit'](_0xc61ffc[_0x9c1b('0x62')],[_0x9c1b('0x74'),'id'])||{})[_0x9c1b('0x97')](function(_0x5dee65){for(var _0xc2d093=0x0;_0xc2d093<_0xc61ffc['body'][_0x9c1b('0x74')][_0x9c1b('0x4d')];_0xc2d093+=0x1){socket[_0x9c1b('0xb3')](_0x9c1b('0xb4'),{'UserId':_0xc61ffc['body'][_0x9c1b('0x74')][_0xc2d093],'OpenchannelAccountId':_0xc61ffc[_0x9c1b('0x5c')]['id']});}return _0x5dee65;});}})[_0x9c1b('0x23')](respondWithResult(_0x5bb200,null))[_0x9c1b('0x2d')](handleError(_0x5bb200,null));};exports['removeAgents']=function(_0x52eafe,_0x1bfe23,_0x20e90f){return db[_0x9c1b('0x42')][_0x9c1b('0x60')]({'where':{'id':_0x52eafe[_0x9c1b('0x5c')]['id']}})[_0x9c1b('0x23')](handleEntityNotFound(_0x1bfe23,null))[_0x9c1b('0x23')](function(_0x2cd51a){if(_0x2cd51a){return _0x2cd51a[_0x9c1b('0xb5')](_0x52eafe['query'][_0x9c1b('0x74')])[_0x9c1b('0x23')](function(){if(_[_0x9c1b('0xb6')](_0x52eafe['query'][_0x9c1b('0x74')])){for(var _0x237ff4=0x0;_0x237ff4<_0x52eafe[_0x9c1b('0x48')]['ids'][_0x9c1b('0x4d')];_0x237ff4+=0x1){socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x52eafe[_0x9c1b('0x48')]['ids'][_0x237ff4]),'OpenchannelAccountId':Number(_0x52eafe[_0x9c1b('0x5c')]['id'])});}}else{socket[_0x9c1b('0xb3')](_0x9c1b('0xb7'),{'UserId':Number(_0x52eafe['query'][_0x9c1b('0x74')]),'OpenchannelAccountId':Number(_0x52eafe['params']['id'])});}});}})[_0x9c1b('0x23')](respondWithStatusCode(_0x1bfe23,null))[_0x9c1b('0x2d')](handleError(_0x1bfe23,null));};exports['getAgents']=function(_0x2ba8e0,_0x4e1278,_0x503b9e){var _0x52ef75={};var _0x3d35f3={};var _0x1d69ba;var _0x3bd638;return db[_0x9c1b('0x42')]['findOne']({'where':{'id':_0x2ba8e0[_0x9c1b('0x5c')]['id']}})[_0x9c1b('0x23')](handleEntityNotFound(_0x4e1278,null))[_0x9c1b('0x23')](function(_0x54ebb2){if(_0x54ebb2){_0x1d69ba=_0x54ebb2;_0x3d35f3[_0x9c1b('0x47')]=_['keys'](db['User'][_0x9c1b('0x43')]);_0x3d35f3[_0x9c1b('0x48')]=_['keys'](_0x2ba8e0[_0x9c1b('0x48')]);_0x3d35f3[_0x9c1b('0x49')]=_['intersection'](_0x3d35f3[_0x9c1b('0x47')],_0x3d35f3[_0x9c1b('0x48')]);_0x52ef75[_0x9c1b('0x4c')]=_[_0x9c1b('0x4a')](_0x3d35f3['model'],qs[_0x9c1b('0x4b')](_0x2ba8e0[_0x9c1b('0x48')][_0x9c1b('0x4b')]));_0x52ef75[_0x9c1b('0x4c')]=_0x52ef75[_0x9c1b('0x4c')][_0x9c1b('0x4d')]?_0x52ef75['attributes']:_0x3d35f3[_0x9c1b('0x47')];_0x52ef75['order']=qs[_0x9c1b('0x52')](_0x2ba8e0[_0x9c1b('0x48')][_0x9c1b('0x52')]);_0x52ef75[_0x9c1b('0x53')]=qs[_0x9c1b('0x49')](_[_0x9c1b('0x54')](_0x2ba8e0[_0x9c1b('0x48')],_0x3d35f3[_0x9c1b('0x49')]));if(_0x2ba8e0['query'][_0x9c1b('0x57')]){_0x52ef75['where']=_[_0x9c1b('0x55')](_0x52ef75[_0x9c1b('0x53')],{'$or':_[_0x9c1b('0x41')](_0x52ef75[_0x9c1b('0x4c')],function(_0x33925c){var _0x4d6058={};_0x4d6058[_0x33925c]={'$like':'%'+_0x2ba8e0[_0x9c1b('0x48')]['filter']+'%'};return _0x4d6058;})});}_0x52ef75=_['merge']({},_0x52ef75,_0x2ba8e0[_0x9c1b('0x5f')]);return _0x1d69ba[_0x9c1b('0xb8')](_0x52ef75);}})[_0x9c1b('0x23')](function(_0x262049){if(_0x262049){_0x3bd638=_0x262049[_0x9c1b('0x4d')];if(!_0x2ba8e0['query'][_0x9c1b('0x4e')](_0x9c1b('0x4f'))){_0x52ef75[_0x9c1b('0x50')]=qs['limit'](_0x2ba8e0['query'][_0x9c1b('0x50')]);_0x52ef75[_0x9c1b('0x32')]=qs[_0x9c1b('0x32')](_0x2ba8e0[_0x9c1b('0x48')]['offset']);}return _0x1d69ba[_0x9c1b('0xb8')](_0x52ef75);}})['then'](function(_0xd63f6d){if(_0xd63f6d){return _0xd63f6d?{'count':_0x3bd638,'rows':_0xd63f6d}:null;}})[_0x9c1b('0x23')](respondWithResult(_0x4e1278,null))[_0x9c1b('0x2d')](handleError(_0x4e1278,null));};exports['send']=function(_0x2d9e7b,_0x5b6afe,_0x1b0c10){var _0x23e056,_0x2608f8,_0x66871a;if(_['isNil'](_0x2d9e7b['body'][_0x9c1b('0x62')])||_0x2d9e7b[_0x9c1b('0x62')][_0x9c1b('0x62')]===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2d9e7b[_0x9c1b('0x62')]['to'])){}_0x23e056=_0x2d9e7b[_0x9c1b('0x62')]['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0x2d9e7b['params']['id']}})['then'](handleEntityNotFound(_0x5b6afe,null))['then'](function(_0x292ae3){if(_0x292ae3){return db[_0x9c1b('0x42')][_0x9c1b('0x60')]({'where':{'id':_0x292ae3['id']},'include':[{'model':db[_0x9c1b('0xb9')],'as':_0x9c1b('0x85'),'include':[{'model':db[_0x9c1b('0x86')],'as':_0x9c1b('0x87'),'where':{[_0x292ae3[_0x9c1b('0x81')]]:_0x23e056},'limit':0x1,'order':[['updatedAt',_0x9c1b('0x88')]]}]}]})[_0x9c1b('0x23')](handleEntityNotFound(_0x5b6afe,null))[_0x9c1b('0x23')](function(_0x4238e1){if(_0x4238e1&&_0x4238e1[_0x9c1b('0x85')]){_0x2608f8=_0x4238e1['get']({'plain':!![]});if(_0x2608f8[_0x9c1b('0x85')]&&_0x2608f8[_0x9c1b('0x85')]['Contacts'][_0x9c1b('0x4d')]){return _0x2608f8[_0x9c1b('0x85')][_0x9c1b('0x87')][0x0];}return db[_0x9c1b('0x86')][_0x9c1b('0x61')](_[_0x9c1b('0x17')](_0x2d9e7b[_0x9c1b('0x62')],{'firstName':_0x23e056,[_0x4238e1[_0x9c1b('0x81')]]:_0x23e056,'phone':_0x23e056,'ListId':_0x2608f8['ListId']}));}})[_0x9c1b('0x23')](handleEntityNotFound(_0x5b6afe,null))[_0x9c1b('0x23')](function(_0x3c1201){if(_0x3c1201){_0x66871a=_0x3c1201;return db[_0x9c1b('0x94')]['find']({'where':{'ContactId':_0x66871a['id'],'closed':![],'OpenchannelAccountId':_0x2608f8['id']}})[_0x9c1b('0x23')](function(_0x2f5716){if(_0x2f5716){return[_0x2f5716,![]];}return db['OpenchannelInteraction'][_0x9c1b('0x61')]({'UserId':_0x2d9e7b[_0x9c1b('0x63')]['id'],'ContactId':_0x66871a['id'],'OpenchannelAccountId':_0x2608f8['id'],'lastMsgDirection':_0x9c1b('0xba'),'Messages':[_[_0x9c1b('0x55')](_0x2d9e7b[_0x9c1b('0x62')],{'read':![],'body':_0x2d9e7b[_0x9c1b('0x62')][_0x9c1b('0x62')],'OpenchannelAccountId':_0x2608f8['id'],'UserId':_0x2d9e7b['user']['id'],'ContactId':_0x66871a['id']})]},{'include':[{'model':db[_0x9c1b('0x9f')],'as':_0x9c1b('0xbb')}]})['then'](function(_0x4c3dc5){return[_0x4c3dc5,!![]];});});}})['spread'](function(_0x4df146,_0x59e6fe){if(_0x59e6fe){return _0x4df146;}return db[_0x9c1b('0x9f')][_0x9c1b('0x61')](_[_0x9c1b('0x55')](_0x2d9e7b['body'],{'read':![],'body':_0x2d9e7b[_0x9c1b('0x62')][_0x9c1b('0x62')],'OpenchannelAccountId':_0x2608f8['id'],'OpenchannelInteractionId':_0x4df146['id'],'UserId':_0x2d9e7b[_0x9c1b('0x63')]['id'],'ContactId':_0x66871a['id']}))['then'](function(_0xeb063b){_0x4df146['dataValues'][_0x9c1b('0xbb')]=[];_0x4df146['dataValues'][_0x9c1b('0xbb')][_0x9c1b('0x9b')](_0xeb063b[_0x9c1b('0xbc')]);return _0x4df146;});});}})[_0x9c1b('0x23')](respondWithResult(_0x5b6afe,null))[_0x9c1b('0x2d')](handleError(_0x5b6afe,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 135d7a8..c02dbfb 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 _0x7531=['update','emit','hook','exports','events','../../mysqldb','OpenchannelAccount','setMaxListeners','save'];(function(_0x200eaf,_0x51f6b6){var _0x2d649a=function(_0x4fd875){while(--_0x4fd875){_0x200eaf['push'](_0x200eaf['shift']());}};_0x2d649a(++_0x51f6b6);}(_0x7531,0x67));var _0x1753=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x7531[_0x501510];return _0x1e6ee5;};'use strict';var EventEmitter=require(_0x1753('0x0'));var OpenchannelAccount=require(_0x1753('0x1'))['db'][_0x1753('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x1753('0x3')](0x0);var events={'afterCreate':_0x1753('0x4'),'afterUpdate':_0x1753('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4c4395){return function(_0x38f6d2,_0x2b1d13,_0x38ba51){OpenchannelAccountEvents[_0x1753('0x6')](_0x4c4395+':'+_0x38f6d2['id'],_0x38f6d2);OpenchannelAccountEvents[_0x1753('0x6')](_0x4c4395,_0x38f6d2);_0x38ba51(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x1753('0x7')](e,emitEvent(event));}}module[_0x1753('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xc1fd=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xc1fd,0x115));var _0xdc1f=function(_0x4b059a,_0xa69702){_0x4b059a=_0x4b059a-0x0;var _0xc128cc=_0xc1fd[_0x4b059a];return _0xc128cc;};'use strict';var EventEmitter=require(_0xdc1f('0x0'));var OpenchannelAccount=require(_0xdc1f('0x1'))['db'][_0xdc1f('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xdc1f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdc1f('0x4'),'afterDestroy':_0xdc1f('0x5')};function emitEvent(_0x466362){return function(_0x2fb636,_0x3abb4f,_0x14c7ac){OpenchannelAccountEvents[_0xdc1f('0x6')](_0x466362+':'+_0x2fb636['id'],_0x2fb636);OpenchannelAccountEvents[_0xdc1f('0x6')](_0x466362,_0x2fb636);_0x14c7ac(null);};}for(var e in events){if(events[_0xdc1f('0x7')](e)){var event=events[e];OpenchannelAccount[_0xdc1f('0x8')](e,emitEvent(event));}}module[_0xdc1f('0x9')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index e5243b7..abefd34 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 _0xbb4b=['rimraf','../../config/environment','exports','define','OpenchannelAccount','openchannel_accounts','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x129c27,_0x333c44){var _0x5a8017=function(_0x5c5083){while(--_0x5c5083){_0x129c27['push'](_0x129c27['shift']());}};_0x5a8017(++_0x333c44);}(_0xbb4b,0x13e));var _0xbbb4=function(_0x21d53f,_0x1616af){_0x21d53f=_0x21d53f-0x0;var _0x1fa7a9=_0xbb4b[_0x21d53f];return _0x1fa7a9;};'use strict';var _=require(_0xbbb4('0x0'));var util=require(_0xbbb4('0x1'));var logger=require(_0xbbb4('0x2'))('api');var moment=require(_0xbbb4('0x3'));var BPromise=require(_0xbbb4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbbb4('0x5'));var rimraf=require(_0xbbb4('0x6'));var config=require(_0xbbb4('0x7'));var attributes=require('./openchannelAccount.attributes');module[_0xbbb4('0x8')]=function(_0x41f0e9,_0xac6972){return _0x41f0e9[_0xbbb4('0x9')](_0xbbb4('0xa'),attributes,{'tableName':_0xbbb4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe7f8=['OpenchannelAccount','openchannel_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelAccount.attributes','exports','define'];(function(_0x4d79bc,_0x32c905){var _0x4b4760=function(_0x212302){while(--_0x212302){_0x4d79bc['push'](_0x4d79bc['shift']());}};_0x4b4760(++_0x32c905);}(_0xe7f8,0x18a));var _0x8e7f=function(_0x562043,_0x475d72){_0x562043=_0x562043-0x0;var _0x376ea5=_0xe7f8[_0x562043];return _0x376ea5;};'use strict';var _=require(_0x8e7f('0x0'));var util=require(_0x8e7f('0x1'));var logger=require('../../config/logger')(_0x8e7f('0x2'));var moment=require(_0x8e7f('0x3'));var BPromise=require(_0x8e7f('0x4'));var rp=require(_0x8e7f('0x5'));var fs=require('fs');var path=require(_0x8e7f('0x6'));var rimraf=require(_0x8e7f('0x7'));var config=require(_0x8e7f('0x8'));var attributes=require(_0x8e7f('0x9'));module[_0x8e7f('0xa')]=function(_0x105b14,_0x42791e){return _0x105b14[_0x8e7f('0xb')](_0x8e7f('0xc'),attributes,{'tableName':_0x8e7f('0xd'),'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 7ff8d9b..1f6da20 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 _0xc033=['socket.io-emitter','./openchannelAccount.socket','register','request','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x4ebf50,_0x2ff389){var _0x100eaa=function(_0x5986f0){while(--_0x5986f0){_0x4ebf50['push'](_0x4ebf50['shift']());}};_0x100eaa(++_0x2ff389);}(_0xc033,0x1c7));var _0x3c03=function(_0x4b6a01,_0x386039){_0x4b6a01=_0x4b6a01-0x0;var _0xc374a3=_0xc033[_0x4b6a01];return _0xc374a3;};'use strict';var _=require(_0x3c03('0x0'));var util=require(_0x3c03('0x1'));var moment=require(_0x3c03('0x2'));var BPromise=require(_0x3c03('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3c03('0x4'))['db'];var utils=require(_0x3c03('0x5'));var logger=require('../../config/logger')(_0x3c03('0x6'));var config=require('../../config/environment');var jayson=require(_0x3c03('0x7'));var client=jayson[_0x3c03('0x8')][_0x3c03('0x9')]({'port':0x232a});config[_0x3c03('0xa')]=_[_0x3c03('0xb')](config[_0x3c03('0xa')],{'host':_0x3c03('0xc'),'port':0x18eb});var socket=require(_0x3c03('0xd'))(new Redis(config['redis']));require(_0x3c03('0xe'))[_0x3c03('0xf')](socket);function respondWithRpcPromise(_0x2c8c87,_0x387d6a,_0x4b0dca){return new BPromise(function(_0x10fb5f,_0x4d5085){return client[_0x3c03('0x10')](_0x2c8c87,_0x4b0dca)['then'](function(_0x3c8179){logger['info'](_0x3c03('0x11'),_0x387d6a,_0x3c03('0x12'));logger[_0x3c03('0x13')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x387d6a,_0x3c03('0x12'),JSON[_0x3c03('0x14')](_0x3c8179));if(_0x3c8179[_0x3c03('0x15')]){if(_0x3c8179[_0x3c03('0x15')]['code']===0x1f4){logger[_0x3c03('0x15')](_0x3c03('0x11'),_0x387d6a,_0x3c8179[_0x3c03('0x15')][_0x3c03('0x16')]);return _0x4d5085(_0x3c8179['error'][_0x3c03('0x16')]);}logger[_0x3c03('0x15')](_0x3c03('0x11'),_0x387d6a,_0x3c8179[_0x3c03('0x15')][_0x3c03('0x16')]);return _0x10fb5f(_0x3c8179['error']['message']);}else{logger[_0x3c03('0x17')](_0x3c03('0x11'),_0x387d6a,_0x3c03('0x12'));_0x10fb5f(_0x3c8179[_0x3c03('0x18')][_0x3c03('0x16')]);}})[_0x3c03('0x19')](function(_0x1c20a0){logger['error'](_0x3c03('0x11'),_0x387d6a,_0x1c20a0);_0x4d5085(_0x1c20a0);});});} \ No newline at end of file +var _0x70a9=['OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','localhost','./openchannelAccount.socket','register','info'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x70a9,0x181));var _0x970a=function(_0x903373,_0x587aea){_0x903373=_0x903373-0x0;var _0x5aa4c0=_0x70a9[_0x903373];return _0x5aa4c0;};'use strict';var _=require(_0x970a('0x0'));var util=require('util');var moment=require(_0x970a('0x1'));var BPromise=require(_0x970a('0x2'));var rs=require(_0x970a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x970a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x970a('0x5'))(_0x970a('0x6'));var config=require(_0x970a('0x7'));var jayson=require(_0x970a('0x8'));var client=jayson[_0x970a('0x9')]['http']({'port':0x232a});config['redis']=_[_0x970a('0xa')](config['redis'],{'host':_0x970a('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x970a('0xc'))[_0x970a('0xd')](socket);function respondWithRpcPromise(_0x15e62f,_0x30fc25,_0x1641e5){return new BPromise(function(_0xcbdd61,_0x142ad1){return client['request'](_0x15e62f,_0x1641e5)['then'](function(_0x100e47){logger[_0x970a('0xe')](_0x970a('0xf'),_0x30fc25,_0x970a('0x10'));logger[_0x970a('0x11')](_0x970a('0x12'),_0x30fc25,'request\x20sent',JSON[_0x970a('0x13')](_0x100e47));if(_0x100e47['error']){if(_0x100e47[_0x970a('0x14')][_0x970a('0x15')]===0x1f4){logger[_0x970a('0x14')](_0x970a('0xf'),_0x30fc25,_0x100e47['error'][_0x970a('0x16')]);return _0x142ad1(_0x100e47[_0x970a('0x14')][_0x970a('0x16')]);}logger[_0x970a('0x14')](_0x970a('0xf'),_0x30fc25,_0x100e47['error'][_0x970a('0x16')]);return _0xcbdd61(_0x100e47[_0x970a('0x14')][_0x970a('0x16')]);}else{logger[_0x970a('0xe')](_0x970a('0xf'),_0x30fc25,'request\x20sent');_0xcbdd61(_0x100e47[_0x970a('0x17')][_0x970a('0x16')]);}})[_0x970a('0x18')](function(_0x36d48f){logger[_0x970a('0x14')](_0x970a('0xf'),_0x30fc25,_0x36d48f);_0x142ad1(_0x36d48f);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 238ea86..0a54489 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 _0xdf2a=['register','length','./openchannelAccount.events','save','update','removeListener'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xdf2a,0x9e));var _0xadf2=function(_0x29ac9e,_0x150921){_0x29ac9e=_0x29ac9e-0x0;var _0xef5c34=_0xdf2a[_0x29ac9e];return _0xef5c34;};'use strict';var OpenchannelAccountEvents=require(_0xadf2('0x0'));var events=[_0xadf2('0x1'),'remove',_0xadf2('0x2')];function createListener(_0x1e83db,_0x3a1ae6){return function(_0x390d69){_0x3a1ae6['emit'](_0x1e83db,_0x390d69);};}function removeListener(_0xe82324,_0x17a3b3){return function(){OpenchannelAccountEvents[_0xadf2('0x3')](_0xe82324,_0x17a3b3);};}exports[_0xadf2('0x4')]=function(_0x1174c0){for(var _0x5a3810=0x0,_0x21f956=events[_0xadf2('0x5')];_0x5a3810<_0x21f956;_0x5a3810++){var _0x1e4434=events[_0x5a3810];var _0x1df6eb=createListener('openchannelAccount:'+_0x1e4434,_0x1174c0);OpenchannelAccountEvents['on'](_0x1e4434,_0x1df6eb);}}; \ No newline at end of file +var _0xcba4=['emit','register','length','openchannelAccount:','save','remove','update'];(function(_0x17ac5b,_0x1a2d16){var _0x2dcec9=function(_0x4bbe8d){while(--_0x4bbe8d){_0x17ac5b['push'](_0x17ac5b['shift']());}};_0x2dcec9(++_0x1a2d16);}(_0xcba4,0xe4));var _0x4cba=function(_0x5933ab,_0x596b26){_0x5933ab=_0x5933ab-0x0;var _0x4734df=_0xcba4[_0x5933ab];return _0x4734df;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x4cba('0x0'),_0x4cba('0x1'),_0x4cba('0x2')];function createListener(_0x41075e,_0x3c4469){return function(_0x39f45f){_0x3c4469[_0x4cba('0x3')](_0x41075e,_0x39f45f);};}function removeListener(_0xe5e04a,_0x7af0de){return function(){OpenchannelAccountEvents['removeListener'](_0xe5e04a,_0x7af0de);};}exports[_0x4cba('0x4')]=function(_0x5d4203){for(var _0x1acf1e=0x0,_0x28a3e6=events[_0x4cba('0x5')];_0x1acf1e<_0x28a3e6;_0x1acf1e++){var _0x8cdf8c=events[_0x1acf1e];var _0x373e18=createListener(_0x4cba('0x6')+_0x8cdf8c,_0x5d4203);OpenchannelAccountEvents['on'](_0x8cdf8c,_0x373e18);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 512b3a8..3057960 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 _0x5a6c=['/:id','show','post','put','update','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index'];(function(_0x4b4f24,_0x5654a8){var _0x1c13d4=function(_0x4940bf){while(--_0x4940bf){_0x4b4f24['push'](_0x4b4f24['shift']());}};_0x1c13d4(++_0x5654a8);}(_0x5a6c,0x103));var _0xc5a6=function(_0x30e86a,_0xdb8ad1){_0x30e86a=_0x30e86a-0x0;var _0x484b30=_0x5a6c[_0x30e86a];return _0x484b30;};'use strict';var multer=require(_0xc5a6('0x0'));var util=require('util');var path=require(_0xc5a6('0x1'));var timeout=require(_0xc5a6('0x2'));var express=require('express');var router=express[_0xc5a6('0x3')]();var auth=require(_0xc5a6('0x4'));var interaction=require(_0xc5a6('0x5'));var config=require(_0xc5a6('0x6'));var controller=require(_0xc5a6('0x7'));router[_0xc5a6('0x8')]('/',auth[_0xc5a6('0x9')](),controller[_0xc5a6('0xa')]);router[_0xc5a6('0x8')](_0xc5a6('0xb'),auth[_0xc5a6('0x9')](),controller[_0xc5a6('0xc')]);router[_0xc5a6('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc5a6('0xe')](_0xc5a6('0xb'),auth[_0xc5a6('0x9')](),controller[_0xc5a6('0xf')]);router['delete'](_0xc5a6('0xb'),auth[_0xc5a6('0x9')](),controller[_0xc5a6('0x10')]);module[_0xc5a6('0x11')]=router; \ No newline at end of file +var _0x3e72=['express','Router','../../components/interaction/service','./openchannelApplication.controller','get','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports','multer','util','path'];(function(_0x1b6828,_0x240c5c){var _0x14e66f=function(_0x49a0f0){while(--_0x49a0f0){_0x1b6828['push'](_0x1b6828['shift']());}};_0x14e66f(++_0x240c5c);}(_0x3e72,0x140));var _0x23e7=function(_0x53afe9,_0x2c9f40){_0x53afe9=_0x53afe9-0x0;var _0x396396=_0x3e72[_0x53afe9];return _0x396396;};'use strict';var multer=require(_0x23e7('0x0'));var util=require(_0x23e7('0x1'));var path=require(_0x23e7('0x2'));var timeout=require('connect-timeout');var express=require(_0x23e7('0x3'));var router=express[_0x23e7('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x23e7('0x5'));var config=require('../../config/environment');var controller=require(_0x23e7('0x6'));router[_0x23e7('0x7')]('/',auth[_0x23e7('0x8')](),controller['index']);router['get'](_0x23e7('0x9'),auth[_0x23e7('0x8')](),controller[_0x23e7('0xa')]);router[_0x23e7('0xb')]('/',auth[_0x23e7('0x8')](),controller[_0x23e7('0xc')]);router[_0x23e7('0xd')](_0x23e7('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x23e7('0xe')](_0x23e7('0x9'),auth['isAuthenticated'](),controller[_0x23e7('0xf')]);module[_0x23e7('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 9436e8a..feaa71c 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 _0x4c55=['STRING','noop','TEXT','*,*,*,*','INTEGER'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0x4c55,0x16c));var _0x54c5=function(_0x44cb92,_0x59afa3){_0x44cb92=_0x44cb92-0x0;var _0x56b9e6=_0x4c55[_0x44cb92];return _0x56b9e6;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x54c5('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x54c5('0x1')],'allowNull':![],'defaultValue':_0x54c5('0x2')},'appdata':{'type':Sequelize[_0x54c5('0x3')]()},'description':{'type':Sequelize[_0x54c5('0x1')]},'interval':{'type':Sequelize[_0x54c5('0x1')],'defaultValue':_0x54c5('0x4')}}; \ No newline at end of file +var _0xde83=['*,*,*,*','sequelize','INTEGER','STRING','noop','TEXT'];(function(_0x408753,_0x5176e1){var _0x1ba6f1=function(_0x2ed00d){while(--_0x2ed00d){_0x408753['push'](_0x408753['shift']());}};_0x1ba6f1(++_0x5176e1);}(_0xde83,0x1e1));var _0x3de8=function(_0x350182,_0x2a9feb){_0x350182=_0x350182-0x0;var _0x4a0892=_0xde83[_0x350182];return _0x4a0892;};'use strict';var Sequelize=require(_0x3de8('0x0'));module['exports']={'priority':{'type':Sequelize[_0x3de8('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x3de8('0x2')],'allowNull':![],'defaultValue':_0x3de8('0x3')},'appdata':{'type':Sequelize[_0x3de8('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x3de8('0x2')],'defaultValue':_0x3de8('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 1085ae8..056a124 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 _0x1ec8=['sendStatus','json','offset','limit','status','apply','reject','update','then','destroy','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','type','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','catch','params','keys','options','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb'];(function(_0x34ec98,_0x360b84){var _0x33b961=function(_0x49e418){while(--_0x49e418){_0x34ec98['push'](_0x34ec98['shift']());}};_0x33b961(++_0x360b84);}(_0x1ec8,0x72));var _0x81ec=function(_0xbe87de,_0x5d1eeb){_0xbe87de=_0xbe87de-0x0;var _0x41d692=_0x1ec8[_0xbe87de];return _0x41d692;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x81ec('0x0'));var zipdir=require(_0x81ec('0x1'));var jsonpatch=require(_0x81ec('0x2'));var rp=require(_0x81ec('0x3'));var moment=require(_0x81ec('0x4'));var BPromise=require(_0x81ec('0x5'));var Mustache=require(_0x81ec('0x6'));var util=require('util');var path=require(_0x81ec('0x7'));var sox=require('sox');var csv=require(_0x81ec('0x8'));var ejs=require(_0x81ec('0x9'));var fs=require('fs');var _=require(_0x81ec('0xa'));var squel=require(_0x81ec('0xb'));var crypto=require('crypto');var jsforce=require(_0x81ec('0xc'));var deskjs=require(_0x81ec('0xd'));var toCsv=require(_0x81ec('0x8'));var querystring=require(_0x81ec('0xe'));var Papa=require(_0x81ec('0xf'));var Redis=require(_0x81ec('0x10'));var authService=require(_0x81ec('0x11'));var qs=require(_0x81ec('0x12'));var as=require(_0x81ec('0x13'));var hardwareService=require(_0x81ec('0x14'));var logger=require(_0x81ec('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x81ec('0x16'));var db=require(_0x81ec('0x17'))['db'];function respondWithStatusCode(_0x5035d3,_0x14466d){_0x14466d=_0x14466d||0xcc;return function(_0x253a4e){if(_0x253a4e){return _0x5035d3[_0x81ec('0x18')](_0x14466d);}return _0x5035d3['status'](_0x14466d)['end']();};}function respondWithResult(_0x437542,_0x355f34){_0x355f34=_0x355f34||0xc8;return function(_0x235424){if(_0x235424){return _0x437542['status'](_0x355f34)[_0x81ec('0x19')](_0x235424);}};}function respondWithFilteredResult(_0x28c231,_0x24f913){return function(_0x37f655){if(_0x37f655){var _0x5850a5=_0x37f655['count'],_0x101c48=_0x24f913[_0x81ec('0x1a')],_0x925263=_0x24f913['offset']+_0x24f913[_0x81ec('0x1b')],_0x3e8e0a;if(_0x925263>=_0x5850a5){_0x925263=_0x5850a5;_0x3e8e0a=0xc8;}else{_0x3e8e0a=0xce;}_0x28c231[_0x81ec('0x1c')](_0x3e8e0a);return _0x28c231['set']('Content-Range',_0x101c48+'-'+_0x925263+'/'+_0x5850a5)[_0x81ec('0x19')](_0x37f655);}return null;};}function patchUpdates(_0xb05327){return function(_0x11a382){try{jsonpatch[_0x81ec('0x1d')](_0x11a382,_0xb05327,!![]);}catch(_0x5f3fc1){return BPromise[_0x81ec('0x1e')](_0x5f3fc1);}return _0x11a382['save']();};}function saveUpdates(_0x1670fe,_0x425ff5){return function(_0x254517){if(_0x254517){return _0x254517[_0x81ec('0x1f')](_0x1670fe)[_0x81ec('0x20')](function(_0x2d4129){return _0x2d4129;});}return null;};}function removeEntity(_0x386741,_0x4f2dce){return function(_0x3b8f91){if(_0x3b8f91){return _0x3b8f91[_0x81ec('0x21')]()[_0x81ec('0x20')](function(){_0x386741[_0x81ec('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53ab2d,_0x2ec7e7){return function(_0x3f7841){if(!_0x3f7841){_0x53ab2d[_0x81ec('0x18')](0x194);}return _0x3f7841;};}function handleError(_0x1091c2,_0x4669f7){_0x4669f7=_0x4669f7||0x1f4;return function(_0x25ef69){logger[_0x81ec('0x22')](_0x25ef69[_0x81ec('0x23')]);if(_0x25ef69[_0x81ec('0x24')]){delete _0x25ef69['name'];}_0x1091c2[_0x81ec('0x1c')](_0x4669f7)[_0x81ec('0x25')](_0x25ef69);};}exports[_0x81ec('0x26')]=function(_0x4ecf45,_0x159508){var _0x501af2={},_0x4453dd={},_0x5c4abc={'count':0x0,'rows':[]};var _0x53ef0b=_[_0x81ec('0x27')](db[_0x81ec('0x28')][_0x81ec('0x29')],function(_0x374a16){return{'name':_0x374a16['fieldName'],'type':_0x374a16[_0x81ec('0x2a')]['key']};});_0x4453dd[_0x81ec('0x2b')]=_[_0x81ec('0x27')](_0x53ef0b,_0x81ec('0x24'));_0x4453dd[_0x81ec('0x2c')]=_['keys'](_0x4ecf45[_0x81ec('0x2c')]);_0x4453dd[_0x81ec('0x2d')]=_[_0x81ec('0x2e')](_0x4453dd[_0x81ec('0x2b')],_0x4453dd[_0x81ec('0x2c')]);_0x501af2['attributes']=_[_0x81ec('0x2e')](_0x4453dd[_0x81ec('0x2b')],qs['fields'](_0x4ecf45[_0x81ec('0x2c')][_0x81ec('0x2f')]));_0x501af2[_0x81ec('0x30')]=_0x501af2[_0x81ec('0x30')][_0x81ec('0x31')]?_0x501af2['attributes']:_0x4453dd[_0x81ec('0x2b')];if(!_0x4ecf45['query']['hasOwnProperty'](_0x81ec('0x32'))){_0x501af2[_0x81ec('0x1b')]=qs[_0x81ec('0x1b')](_0x4ecf45[_0x81ec('0x2c')][_0x81ec('0x1b')]);_0x501af2[_0x81ec('0x1a')]=qs[_0x81ec('0x1a')](_0x4ecf45[_0x81ec('0x2c')][_0x81ec('0x1a')]);}_0x501af2[_0x81ec('0x33')]=qs[_0x81ec('0x34')](_0x4ecf45['query'][_0x81ec('0x34')]);_0x501af2[_0x81ec('0x35')]=qs[_0x81ec('0x2d')](_[_0x81ec('0x36')](_0x4ecf45[_0x81ec('0x2c')],_0x4453dd[_0x81ec('0x2d')]));if(_0x4ecf45['query'][_0x81ec('0x37')]){_0x501af2['where']=_[_0x81ec('0x38')](_0x501af2[_0x81ec('0x35')],{'$or':_[_0x81ec('0x27')](_0x53ef0b,function(_0x5c12fd){if(_0x5c12fd[_0x81ec('0x2a')]!==_0x81ec('0x39')){var _0x2876f1={};_0x2876f1[_0x5c12fd[_0x81ec('0x24')]]={'$like':'%'+_0x4ecf45[_0x81ec('0x2c')][_0x81ec('0x37')]+'%'};return _0x2876f1;}})});}_0x501af2=_[_0x81ec('0x38')]({},_0x501af2,_0x4ecf45['options']);var _0x23de64={'where':_0x501af2[_0x81ec('0x35')]};return db[_0x81ec('0x28')][_0x81ec('0x3a')](_0x23de64)['then'](function(_0x210b1e){_0x5c4abc[_0x81ec('0x3a')]=_0x210b1e;if(_0x4ecf45[_0x81ec('0x2c')][_0x81ec('0x3b')]){_0x501af2[_0x81ec('0x3c')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x81ec('0x3d')](_0x501af2);})[_0x81ec('0x20')](function(_0x480ffe){_0x5c4abc['rows']=_0x480ffe;return _0x5c4abc;})[_0x81ec('0x20')](respondWithFilteredResult(_0x159508,_0x501af2))[_0x81ec('0x3e')](handleError(_0x159508,null));};exports['show']=function(_0x3de264,_0x1dd689){var _0x5968db={'raw':!![],'where':{'id':_0x3de264[_0x81ec('0x3f')]['id']}},_0x56f3bf={};_0x56f3bf['model']=_[_0x81ec('0x40')](db[_0x81ec('0x28')][_0x81ec('0x29')]);_0x56f3bf['query']=_[_0x81ec('0x40')](_0x3de264['query']);_0x56f3bf[_0x81ec('0x2d')]=_[_0x81ec('0x2e')](_0x56f3bf['model'],_0x56f3bf[_0x81ec('0x2c')]);_0x5968db[_0x81ec('0x30')]=_[_0x81ec('0x2e')](_0x56f3bf[_0x81ec('0x2b')],qs[_0x81ec('0x2f')](_0x3de264['query'][_0x81ec('0x2f')]));_0x5968db[_0x81ec('0x30')]=_0x5968db[_0x81ec('0x30')][_0x81ec('0x31')]?_0x5968db['attributes']:_0x56f3bf[_0x81ec('0x2b')];if(_0x3de264['query'][_0x81ec('0x3b')]){_0x5968db[_0x81ec('0x3c')]=[{'all':!![]}];}_0x5968db=_[_0x81ec('0x38')]({},_0x5968db,_0x3de264[_0x81ec('0x41')]);return db[_0x81ec('0x28')][_0x81ec('0x42')](_0x5968db)[_0x81ec('0x20')](handleEntityNotFound(_0x1dd689,null))['then'](respondWithResult(_0x1dd689,null))[_0x81ec('0x3e')](handleError(_0x1dd689,null));};exports[_0x81ec('0x43')]=function(_0x1bf8dd,_0x523550){return db['OpenchannelApplication'][_0x81ec('0x43')](_0x1bf8dd[_0x81ec('0x44')],{})[_0x81ec('0x20')](respondWithResult(_0x523550,0xc9))[_0x81ec('0x3e')](handleError(_0x523550,null));};exports[_0x81ec('0x1f')]=function(_0x2bdf43,_0x3e805c){if(_0x2bdf43[_0x81ec('0x44')]['id']){delete _0x2bdf43[_0x81ec('0x44')]['id'];}return db['OpenchannelApplication'][_0x81ec('0x42')]({'where':{'id':_0x2bdf43[_0x81ec('0x3f')]['id']}})[_0x81ec('0x20')](handleEntityNotFound(_0x3e805c,null))[_0x81ec('0x20')](saveUpdates(_0x2bdf43[_0x81ec('0x44')],null))[_0x81ec('0x20')](respondWithResult(_0x3e805c,null))[_0x81ec('0x3e')](handleError(_0x3e805c,null));};exports[_0x81ec('0x21')]=function(_0x48c1f5,_0x2654c2){return db[_0x81ec('0x28')][_0x81ec('0x42')]({'where':{'id':_0x48c1f5[_0x81ec('0x3f')]['id']}})[_0x81ec('0x20')](handleEntityNotFound(_0x2654c2,null))[_0x81ec('0x20')](removeEntity(_0x2654c2,null))['catch'](handleError(_0x2654c2,null));}; \ No newline at end of file +var _0x15cd=['params','find','create','update','body','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','count','offset','limit','status','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','include','catch','show'];(function(_0xdd827a,_0x482ad2){var _0x2f46f1=function(_0x221046){while(--_0x221046){_0xdd827a['push'](_0xdd827a['shift']());}};_0x2f46f1(++_0x482ad2);}(_0x15cd,0xd4));var _0xd15c=function(_0x57645b,_0x25f73a){_0x57645b=_0x57645b-0x0;var _0xe82f00=_0x15cd[_0x57645b];return _0xe82f00;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd15c('0x0'));var jsonpatch=require(_0xd15c('0x1'));var rp=require(_0xd15c('0x2'));var moment=require(_0xd15c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd15c('0x4'));var util=require(_0xd15c('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xd15c('0x6'));var ejs=require(_0xd15c('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd15c('0x8'));var crypto=require(_0xd15c('0x9'));var jsforce=require(_0xd15c('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xd15c('0x6'));var querystring=require(_0xd15c('0xb'));var Papa=require(_0xd15c('0xc'));var Redis=require(_0xd15c('0xd'));var authService=require(_0xd15c('0xe'));var qs=require(_0xd15c('0xf'));var as=require(_0xd15c('0x10'));var hardwareService=require(_0xd15c('0x11'));var logger=require(_0xd15c('0x12'))(_0xd15c('0x13'));var utils=require(_0xd15c('0x14'));var config=require(_0xd15c('0x15'));var db=require(_0xd15c('0x16'))['db'];function respondWithStatusCode(_0x8f3a5b,_0xa09ca6){_0xa09ca6=_0xa09ca6||0xcc;return function(_0x18fafc){if(_0x18fafc){return _0x8f3a5b[_0xd15c('0x17')](_0xa09ca6);}return _0x8f3a5b['status'](_0xa09ca6)['end']();};}function respondWithResult(_0x388f95,_0x6c5ea3){_0x6c5ea3=_0x6c5ea3||0xc8;return function(_0x4225b8){if(_0x4225b8){return _0x388f95['status'](_0x6c5ea3)[_0xd15c('0x18')](_0x4225b8);}};}function respondWithFilteredResult(_0xc5d37d,_0x2b28a4){return function(_0x452e60){if(_0x452e60){var _0x3faaa6=_0x452e60[_0xd15c('0x19')],_0x38f8c0=_0x2b28a4[_0xd15c('0x1a')],_0x5124e3=_0x2b28a4[_0xd15c('0x1a')]+_0x2b28a4[_0xd15c('0x1b')],_0x4bc850;if(_0x5124e3>=_0x3faaa6){_0x5124e3=_0x3faaa6;_0x4bc850=0xc8;}else{_0x4bc850=0xce;}_0xc5d37d[_0xd15c('0x1c')](_0x4bc850);return _0xc5d37d['set'](_0xd15c('0x1d'),_0x38f8c0+'-'+_0x5124e3+'/'+_0x3faaa6)[_0xd15c('0x18')](_0x452e60);}return null;};}function patchUpdates(_0x13153a){return function(_0x520629){try{jsonpatch[_0xd15c('0x1e')](_0x520629,_0x13153a,!![]);}catch(_0x321813){return BPromise[_0xd15c('0x1f')](_0x321813);}return _0x520629['save']();};}function saveUpdates(_0x420f27,_0x132010){return function(_0x5dcba0){if(_0x5dcba0){return _0x5dcba0['update'](_0x420f27)[_0xd15c('0x20')](function(_0x4c9a53){return _0x4c9a53;});}return null;};}function removeEntity(_0x170b81,_0x2e9f79){return function(_0x14fe62){if(_0x14fe62){return _0x14fe62[_0xd15c('0x21')]()[_0xd15c('0x20')](function(){_0x170b81[_0xd15c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x427218,_0x4b3677){return function(_0x28505f){if(!_0x28505f){_0x427218['sendStatus'](0x194);}return _0x28505f;};}function handleError(_0x32cb9e,_0x683267){_0x683267=_0x683267||0x1f4;return function(_0x46de0a){logger[_0xd15c('0x22')](_0x46de0a[_0xd15c('0x23')]);if(_0x46de0a['name']){delete _0x46de0a[_0xd15c('0x24')];}_0x32cb9e['status'](_0x683267)[_0xd15c('0x25')](_0x46de0a);};}exports[_0xd15c('0x26')]=function(_0x2dc24d,_0x1d11b8){var _0x552cc2={},_0x3c40e9={},_0x424480={'count':0x0,'rows':[]};var _0x663877=_[_0xd15c('0x27')](db[_0xd15c('0x28')][_0xd15c('0x29')],function(_0x1b527e){return{'name':_0x1b527e['fieldName'],'type':_0x1b527e[_0xd15c('0x2a')][_0xd15c('0x2b')]};});_0x3c40e9[_0xd15c('0x2c')]=_[_0xd15c('0x27')](_0x663877,_0xd15c('0x24'));_0x3c40e9['query']=_[_0xd15c('0x2d')](_0x2dc24d[_0xd15c('0x2e')]);_0x3c40e9['filters']=_[_0xd15c('0x2f')](_0x3c40e9['model'],_0x3c40e9[_0xd15c('0x2e')]);_0x552cc2['attributes']=_[_0xd15c('0x2f')](_0x3c40e9['model'],qs['fields'](_0x2dc24d['query'][_0xd15c('0x30')]));_0x552cc2[_0xd15c('0x31')]=_0x552cc2['attributes'][_0xd15c('0x32')]?_0x552cc2[_0xd15c('0x31')]:_0x3c40e9['model'];if(!_0x2dc24d[_0xd15c('0x2e')][_0xd15c('0x33')](_0xd15c('0x34'))){_0x552cc2[_0xd15c('0x1b')]=qs[_0xd15c('0x1b')](_0x2dc24d['query'][_0xd15c('0x1b')]);_0x552cc2['offset']=qs[_0xd15c('0x1a')](_0x2dc24d[_0xd15c('0x2e')][_0xd15c('0x1a')]);}_0x552cc2['order']=qs[_0xd15c('0x35')](_0x2dc24d[_0xd15c('0x2e')][_0xd15c('0x35')]);_0x552cc2[_0xd15c('0x36')]=qs[_0xd15c('0x37')](_[_0xd15c('0x38')](_0x2dc24d[_0xd15c('0x2e')],_0x3c40e9[_0xd15c('0x37')]));if(_0x2dc24d['query'][_0xd15c('0x39')]){_0x552cc2[_0xd15c('0x36')]=_[_0xd15c('0x3a')](_0x552cc2['where'],{'$or':_[_0xd15c('0x27')](_0x663877,function(_0x562a39){if(_0x562a39[_0xd15c('0x2a')]!=='VIRTUAL'){var _0x5c3229={};_0x5c3229[_0x562a39['name']]={'$like':'%'+_0x2dc24d[_0xd15c('0x2e')]['filter']+'%'};return _0x5c3229;}})});}_0x552cc2=_['merge']({},_0x552cc2,_0x2dc24d[_0xd15c('0x3b')]);var _0x20b41c={'where':_0x552cc2['where']};return db['OpenchannelApplication'][_0xd15c('0x19')](_0x20b41c)[_0xd15c('0x20')](function(_0x222e4a){_0x424480[_0xd15c('0x19')]=_0x222e4a;if(_0x2dc24d[_0xd15c('0x2e')][_0xd15c('0x3c')]){_0x552cc2[_0xd15c('0x3d')]=[{'all':!![]}];}return db[_0xd15c('0x28')]['findAll'](_0x552cc2);})[_0xd15c('0x20')](function(_0x25a18e){_0x424480['rows']=_0x25a18e;return _0x424480;})[_0xd15c('0x20')](respondWithFilteredResult(_0x1d11b8,_0x552cc2))[_0xd15c('0x3e')](handleError(_0x1d11b8,null));};exports[_0xd15c('0x3f')]=function(_0x2cacea,_0x3aeff6){var _0x5ac946={'raw':!![],'where':{'id':_0x2cacea[_0xd15c('0x40')]['id']}},_0x546d03={};_0x546d03[_0xd15c('0x2c')]=_[_0xd15c('0x2d')](db[_0xd15c('0x28')][_0xd15c('0x29')]);_0x546d03[_0xd15c('0x2e')]=_[_0xd15c('0x2d')](_0x2cacea[_0xd15c('0x2e')]);_0x546d03['filters']=_['intersection'](_0x546d03[_0xd15c('0x2c')],_0x546d03[_0xd15c('0x2e')]);_0x5ac946[_0xd15c('0x31')]=_[_0xd15c('0x2f')](_0x546d03[_0xd15c('0x2c')],qs['fields'](_0x2cacea[_0xd15c('0x2e')]['fields']));_0x5ac946[_0xd15c('0x31')]=_0x5ac946[_0xd15c('0x31')][_0xd15c('0x32')]?_0x5ac946[_0xd15c('0x31')]:_0x546d03['model'];if(_0x2cacea['query'][_0xd15c('0x3c')]){_0x5ac946[_0xd15c('0x3d')]=[{'all':!![]}];}_0x5ac946=_[_0xd15c('0x3a')]({},_0x5ac946,_0x2cacea[_0xd15c('0x3b')]);return db[_0xd15c('0x28')][_0xd15c('0x41')](_0x5ac946)[_0xd15c('0x20')](handleEntityNotFound(_0x3aeff6,null))[_0xd15c('0x20')](respondWithResult(_0x3aeff6,null))[_0xd15c('0x3e')](handleError(_0x3aeff6,null));};exports[_0xd15c('0x42')]=function(_0xf3346d,_0x5373f4){return db[_0xd15c('0x28')][_0xd15c('0x42')](_0xf3346d['body'],{})['then'](respondWithResult(_0x5373f4,0xc9))[_0xd15c('0x3e')](handleError(_0x5373f4,null));};exports[_0xd15c('0x43')]=function(_0x3304ba,_0x8afe3d){if(_0x3304ba[_0xd15c('0x44')]['id']){delete _0x3304ba[_0xd15c('0x44')]['id'];}return db[_0xd15c('0x28')][_0xd15c('0x41')]({'where':{'id':_0x3304ba[_0xd15c('0x40')]['id']}})[_0xd15c('0x20')](handleEntityNotFound(_0x8afe3d,null))['then'](saveUpdates(_0x3304ba['body'],null))[_0xd15c('0x20')](respondWithResult(_0x8afe3d,null))[_0xd15c('0x3e')](handleError(_0x8afe3d,null));};exports[_0xd15c('0x21')]=function(_0x707491,_0x5ac4e5){return db[_0xd15c('0x28')][_0xd15c('0x41')]({'where':{'id':_0x707491['params']['id']}})[_0xd15c('0x20')](handleEntityNotFound(_0x5ac4e5,null))[_0xd15c('0x20')](removeEntity(_0x5ac4e5,null))[_0xd15c('0x3e')](handleError(_0x5ac4e5,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 1acf87e..cb8ef1d 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 _0x0436=['util','../../config/logger','api','moment','../../config/environment','./openchannelApplication.attributes','exports','define','openchannel_applications','utf8mb4_unicode_ci'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0x0436,0xbe));var _0x6043=function(_0x452217,_0x54024a){_0x452217=_0x452217-0x0;var _0x562e46=_0x0436[_0x452217];return _0x562e46;};'use strict';var _=require('lodash');var util=require(_0x6043('0x0'));var logger=require(_0x6043('0x1'))(_0x6043('0x2'));var moment=require(_0x6043('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6043('0x4'));var attributes=require(_0x6043('0x5'));module[_0x6043('0x6')]=function(_0x276f4b,_0x314f3c){return _0x276f4b[_0x6043('0x7')]('OpenchannelApplication',attributes,{'tableName':_0x6043('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x6043('0x9')});}; \ No newline at end of file +var _0xf88b=['../../config/environment','./openchannelApplication.attributes','exports','OpenchannelApplication','openchannel_applications','utf8mb4','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5e9817,_0xa29439){var _0x25b437=function(_0x46851b){while(--_0x46851b){_0x5e9817['push'](_0x5e9817['shift']());}};_0x25b437(++_0xa29439);}(_0xf88b,0x68));var _0xbf88=function(_0x360819,_0x5557f9){_0x360819=_0x360819-0x0;var _0x5a1c45=_0xf88b[_0x360819];return _0x5a1c45;};'use strict';var _=require(_0xbf88('0x0'));var util=require('util');var logger=require(_0xbf88('0x1'))(_0xbf88('0x2'));var moment=require(_0xbf88('0x3'));var BPromise=require(_0xbf88('0x4'));var rp=require(_0xbf88('0x5'));var fs=require('fs');var path=require(_0xbf88('0x6'));var rimraf=require(_0xbf88('0x7'));var config=require(_0xbf88('0x8'));var attributes=require(_0xbf88('0x9'));module[_0xbf88('0xa')]=function(_0x1e60ef,_0x58afef){return _0x1e60ef['define'](_0xbf88('0xb'),attributes,{'tableName':_0xbf88('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbf88('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 02af06d..4033500 100644 --- a/server/api/openchannelApplication/openchannelApplication.rpc.js +++ b/server/api/openchannelApplication/openchannelApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['error','code','message','request\x20sent','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','limit','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','OpenchannelApplication,\x20%s,\x20%s','debug','stringify'];(function(_0x123df5,_0x5a535b){var _0x115fc5=function(_0x44e410){while(--_0x44e410){_0x123df5['push'](_0x123df5['shift']());}};_0x115fc5(++_0x5a535b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x23059a,_0x22a394){_0x23059a=_0x23059a-0x0;var _0x5aef66=_0x5f2f[_0x23059a];return _0x5aef66;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20fccd['options']?_0x20fccd['options'][_0xf5f2('0x1d')]||null:null,'attributes':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd['options'][_0xf5f2('0x1e')]||null:null,'limit':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null})[_0xf5f2('0x20')](function(_0x4c691a){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger[_0xf5f2('0xf')](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x4c691a));_0x4ff59b(_0x4c691a);})['catch'](function(_0x529f07){logger[_0xf5f2('0x11')](_0xf5f2('0x17'),_0x529f07[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x529f07[_0xf5f2('0x13')]));});});}; \ No newline at end of file +var _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(_0x46361e,_0x243aaf){var _0x14e302=function(_0x9ebecf){while(--_0x9ebecf){_0x46361e['push'](_0x46361e['shift']());}};_0x14e302(++_0x243aaf);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});}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 diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 685c0ed..d80153d 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 _0x1926=['Router','../../components/auth/service','./openchannelInteraction.controller','get','isAuthenticated','/:id','getMessages','/:id/download','download','create','/:id/messages','addMessage','/:id/tags','openchannel','openchannelinteraction:addtags','put','openchannelinteraction:update','update','delete','tracked','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x568750,_0x295b25){var _0x37644f=function(_0x59e2ef){while(--_0x59e2ef){_0x568750['push'](_0x568750['shift']());}};_0x37644f(++_0x295b25);}(_0x1926,0x124));var _0x6192=function(_0x48297f,_0x132aec){_0x48297f=_0x48297f-0x0;var _0x405872=_0x1926[_0x48297f];return _0x405872;};'use strict';var multer=require(_0x6192('0x0'));var util=require(_0x6192('0x1'));var path=require(_0x6192('0x2'));var timeout=require(_0x6192('0x3'));var express=require(_0x6192('0x4'));var router=express[_0x6192('0x5')]();var auth=require(_0x6192('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6192('0x7'));router[_0x6192('0x8')]('/',auth[_0x6192('0x9')](),controller['index']);router['get']('/describe',auth[_0x6192('0x9')](),controller['describe']);router[_0x6192('0x8')](_0x6192('0xa'),auth[_0x6192('0x9')](),controller['show']);router[_0x6192('0x8')]('/:id/messages',auth[_0x6192('0x9')](),controller[_0x6192('0xb')]);router['get'](_0x6192('0xc'),auth[_0x6192('0x9')](),controller[_0x6192('0xd')]);router['post']('/',auth[_0x6192('0x9')](),controller[_0x6192('0xe')]);router['post'](_0x6192('0xf'),auth[_0x6192('0x9')](),controller[_0x6192('0x10')]);router['post'](_0x6192('0x11'),auth['isAuthenticated'](),interaction['tracked'](_0x6192('0x12'),_0x6192('0x13')),controller['addTags']);router[_0x6192('0x14')](_0x6192('0xa'),auth[_0x6192('0x9')](),interaction['tracked'](_0x6192('0x12'),_0x6192('0x15')),controller[_0x6192('0x16')]);router[_0x6192('0x17')](_0x6192('0xa'),auth[_0x6192('0x9')](),interaction[_0x6192('0x18')](_0x6192('0x12'),'openchannelinteraction:destroy'),controller[_0x6192('0x19')]);router['delete']('/:id/tags',auth[_0x6192('0x9')](),controller['removeTags']);module[_0x6192('0x1a')]=router; \ No newline at end of file +var _0x4789=['../../config/environment','./openchannelInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','openchannel','addTags','put','openchannelinteraction:update','delete','openchannelinteraction:destroy','removeTags','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x4789,0x19f));var _0x9478=function(_0x2a3c4d,_0x9c6b37){_0x2a3c4d=_0x2a3c4d-0x0;var _0x55c390=_0x4789[_0x2a3c4d];return _0x55c390;};'use strict';var multer=require(_0x9478('0x0'));var util=require(_0x9478('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9478('0x2')]();var auth=require(_0x9478('0x3'));var interaction=require(_0x9478('0x4'));var config=require(_0x9478('0x5'));var controller=require(_0x9478('0x6'));router[_0x9478('0x7')]('/',auth['isAuthenticated'](),controller[_0x9478('0x8')]);router[_0x9478('0x7')](_0x9478('0x9'),auth[_0x9478('0xa')](),controller[_0x9478('0xb')]);router[_0x9478('0x7')](_0x9478('0xc'),auth['isAuthenticated'](),controller[_0x9478('0xd')]);router[_0x9478('0x7')]('/:id/messages',auth[_0x9478('0xa')](),controller[_0x9478('0xe')]);router[_0x9478('0x7')](_0x9478('0xf'),auth['isAuthenticated'](),controller[_0x9478('0x10')]);router['post']('/',auth[_0x9478('0xa')](),controller[_0x9478('0x11')]);router[_0x9478('0x12')]('/:id/messages',auth['isAuthenticated'](),controller[_0x9478('0x13')]);router['post'](_0x9478('0x14'),auth[_0x9478('0xa')](),interaction[_0x9478('0x15')](_0x9478('0x16'),'openchannelinteraction:addtags'),controller[_0x9478('0x17')]);router[_0x9478('0x18')](_0x9478('0xc'),auth['isAuthenticated'](),interaction[_0x9478('0x15')]('openchannel',_0x9478('0x19')),controller['update']);router[_0x9478('0x1a')]('/:id',auth[_0x9478('0xa')](),interaction[_0x9478('0x15')](_0x9478('0x16'),_0x9478('0x1b')),controller['destroy']);router['delete'](_0x9478('0x14'),auth[_0x9478('0xa')](),controller[_0x9478('0x1c')]);module[_0x9478('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index afbe120..9d02662 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 _0x4803=['sequelize','exports','DATE','STRING'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x4803,0x1d4));var _0x3480=function(_0x1f2d62,_0x26b666){_0x1f2d62=_0x1f2d62-0x0;var _0x40f3a6=_0x4803[_0x1f2d62];return _0x40f3a6;};'use strict';var Sequelize=require(_0x3480('0x0'));module[_0x3480('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3480('0x2')]},'disposition':{'type':Sequelize[_0x3480('0x3')]},'note':{'type':Sequelize[_0x3480('0x3')]},'read1stAt':{'type':Sequelize[_0x3480('0x2')]},'threadId':{'type':Sequelize[_0x3480('0x3')]},'externalUrl':{'type':Sequelize[_0x3480('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x3480('0x3')]}}; \ No newline at end of file +var _0x76d6=['DATE','ENUM','sequelize','BOOLEAN','STRING'];(function(_0x31784c,_0x1cf34c){var _0x4af226=function(_0x2a98f0){while(--_0x2a98f0){_0x31784c['push'](_0x31784c['shift']());}};_0x4af226(++_0x1cf34c);}(_0x76d6,0x192));var _0x676d=function(_0x46eca1,_0x4ca010){_0x46eca1=_0x46eca1-0x0;var _0x3b5b16=_0x76d6[_0x46eca1];return _0x3b5b16;};'use strict';var Sequelize=require(_0x676d('0x0'));module['exports']={'closed':{'type':Sequelize[_0x676d('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x676d('0x2')]},'note':{'type':Sequelize[_0x676d('0x2')]},'read1stAt':{'type':Sequelize[_0x676d('0x3')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x676d('0x2')]},'lastMsgAt':{'type':Sequelize[_0x676d('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x676d('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x676d('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index f320b2d..31df45a 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 _0x96a8=['Openchannel','YYYY-MM-DD','Account','N.A.','closed','closedAt','threadId','Public','Private','basename','existsSync','createReadStream','pipe','out','System','secret','renderFile','server','views','downloadInteraction.html','toFile','transcript-','.pdf','err','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','redis','defaults','localhost','./openchannelInteraction.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','end','stack','send','Users','map','fullname','TagIds','Tags','split','forEach','catch','OpenchannelInteraction','rawAttributes','fieldName','type','key','model','name','keys','query','filters','intersection','fields','attributes','sort','where','select','field','color','from','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','left_join','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','`\x20=\x200','`\x20>\x200','Contact','$substring','value','length','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$lte','null','\x20IS\x20NULL','read','having','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','t.id\x20IN\x20?','resolve','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.email','c.phone','Contact.phone','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','OpenchannelInteractionId','push','all','show','params','includeAll','include','merge','options','create','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','hasOwnProperty','pick','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','spread','unix','join','root','files','tmp','transcript-%d-%s.zip','User','firstName','lastName','Attachment','Messages','direction','OpenchannelAccount','Owner','get','mkdirSync','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\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'];(function(_0x16a17a,_0x22b8ac){var _0x569e87=function(_0x44f026){while(--_0x44f026){_0x16a17a['push'](_0x16a17a['shift']());}};_0x569e87(++_0x22b8ac);}(_0x96a8,0x103));var _0x896a=function(_0x2ea6d1,_0x56636a){_0x2ea6d1=_0x2ea6d1-0x0;var _0x381137=_0x96a8[_0x2ea6d1];return _0x381137;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x896a('0x0'));var rimraf=require(_0x896a('0x1'));var zipdir=require(_0x896a('0x2'));var jsonpatch=require(_0x896a('0x3'));var rp=require(_0x896a('0x4'));var moment=require('moment');var BPromise=require(_0x896a('0x5'));var Mustache=require(_0x896a('0x6'));var util=require('util');var path=require('path');var sox=require(_0x896a('0x7'));var csv=require(_0x896a('0x8'));var ejs=require(_0x896a('0x9'));var fs=require('fs');var _=require(_0x896a('0xa'));var squel=require(_0x896a('0xb'));var crypto=require(_0x896a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x896a('0xd'));var toCsv=require(_0x896a('0x8'));var querystring=require(_0x896a('0xe'));var Papa=require(_0x896a('0xf'));var Redis=require(_0x896a('0x10'));var authService=require(_0x896a('0x11'));var qs=require(_0x896a('0x12'));var as=require(_0x896a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x896a('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x896a('0x15'));var db=require('../../mysqldb')['db'];config[_0x896a('0x16')]=_[_0x896a('0x17')](config[_0x896a('0x16')],{'host':_0x896a('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x896a('0x16')]));require(_0x896a('0x19'))[_0x896a('0x1a')](socket);function respondWithStatusCode(_0x25f59c,_0x1147da){_0x1147da=_0x1147da||0xcc;return function(_0x119356){if(_0x119356){return _0x25f59c[_0x896a('0x1b')](_0x1147da);}return _0x25f59c['status'](_0x1147da)['end']();};}function respondWithResult(_0x5dcf3b,_0x93b65e){_0x93b65e=_0x93b65e||0xc8;return function(_0x4e19f7){if(_0x4e19f7){return _0x5dcf3b[_0x896a('0x1c')](_0x93b65e)[_0x896a('0x1d')](_0x4e19f7);}};}function respondWithFilteredResult(_0x914e1d,_0x33474e){return function(_0x3eb298){if(_0x3eb298){var _0x397a4b=_0x3eb298[_0x896a('0x1e')],_0x494e49=_0x33474e['offset'],_0x20cfb6=_0x33474e[_0x896a('0x1f')]+_0x33474e[_0x896a('0x20')],_0x406d82;if(_0x20cfb6>=_0x397a4b){_0x20cfb6=_0x397a4b;_0x406d82=0xc8;}else{_0x406d82=0xce;}_0x914e1d[_0x896a('0x1c')](_0x406d82);return _0x914e1d[_0x896a('0x21')](_0x896a('0x22'),_0x494e49+'-'+_0x20cfb6+'/'+_0x397a4b)[_0x896a('0x1d')](_0x3eb298);}return null;};}function patchUpdates(_0x537b1d){return function(_0x37489c){try{jsonpatch[_0x896a('0x23')](_0x37489c,_0x537b1d,!![]);}catch(_0x42bcf8){return BPromise['reject'](_0x42bcf8);}return _0x37489c[_0x896a('0x24')]();};}function saveUpdates(_0x288eea,_0x24ac7c){return function(_0x3f70f0){if(_0x3f70f0){return _0x3f70f0[_0x896a('0x25')](_0x288eea)[_0x896a('0x26')](function(_0x5c76c4){return _0x5c76c4;});}return null;};}function removeEntity(_0x2749f4,_0x3ef060){return function(_0x284b8b){if(_0x284b8b){return _0x284b8b[_0x896a('0x27')]()['then'](function(){_0x2749f4[_0x896a('0x1c')](0xcc)[_0x896a('0x28')]();});}};}function handleEntityNotFound(_0x1ab07e,_0xfc125b){return function(_0x4f22eb){if(!_0x4f22eb){_0x1ab07e[_0x896a('0x1b')](0x194);}return _0x4f22eb;};}function handleError(_0x3888d5,_0x2d1174){_0x2d1174=_0x2d1174||0x1f4;return function(_0xbef32c){logger['error'](_0xbef32c[_0x896a('0x29')]);if(_0xbef32c['name']){delete _0xbef32c['name'];}_0x3888d5[_0x896a('0x1c')](_0x2d1174)[_0x896a('0x2a')](_0xbef32c);};}function getInteractionUsers(_0x273e98,_0x3e5dc4){return new BPromise(function(_0x278081,_0x3a277d){try{if(_0x3e5dc4[_0x273e98['id']]){_0x273e98[_0x896a('0x2b')]=_[_0x896a('0x2c')](_0x3e5dc4[_0x273e98['id']],function(_0xc9699){return{'id':_0xc9699['id'],'fullname':_0xc9699[_0x896a('0x2d')]};});}}catch(_0x539fa6){_0x3a277d(_0x539fa6);}_0x278081(_0x273e98);});}function getInteractionTags(_0x48920c,_0x52d108){return new BPromise(function(_0x25dd27,_0x157a17){try{if(_0x48920c[_0x896a('0x2e')]){_0x48920c[_0x896a('0x2f')]=[];_0x48920c[_0x896a('0x2e')][_0x896a('0x30')](',')[_0x896a('0x31')](function(_0x477835){_0x48920c['Tags']['push'](_0x52d108[_0x477835]);});}delete _0x48920c[_0x896a('0x2e')];}catch(_0x189b68){_0x157a17(_0x189b68);}_0x25dd27(_0x48920c);});}function updateOpenchannelInteraction(_0x207436,_0x2c1997,_0x1ba2a7){return new BPromise(function(_0x25aa99,_0x16f098){return getInteractionUsers(_0x207436,_0x1ba2a7)['then'](function(_0x4dcd91){return getInteractionTags(_0x4dcd91,_0x2c1997);})[_0x896a('0x26')](function(_0x4a06da){_0x25aa99(_0x4a06da);})[_0x896a('0x32')](function(_0x3a7239){_0x16f098(_0x3a7239);});});}exports['index']=function(_0x43b136,_0x68797b){var _0x46694e={},_0x560ca1={},_0x36c906={'count':0x0,'rows':[]};var _0x1927be=_['map'](db[_0x896a('0x33')][_0x896a('0x34')],function(_0x32cc42){return{'name':_0x32cc42[_0x896a('0x35')],'type':_0x32cc42[_0x896a('0x36')][_0x896a('0x37')]};});_0x560ca1[_0x896a('0x38')]=_[_0x896a('0x2c')](_0x1927be,_0x896a('0x39'));_0x560ca1['query']=_[_0x896a('0x3a')](_0x43b136[_0x896a('0x3b')]);_0x560ca1[_0x896a('0x3c')]=_[_0x896a('0x3d')](_0x560ca1[_0x896a('0x38')],_0x560ca1[_0x896a('0x3b')]);_0x46694e['attributes']=_[_0x896a('0x3d')](_0x560ca1['model'],qs[_0x896a('0x3e')](_0x43b136[_0x896a('0x3b')]['fields']));_0x46694e['attributes']=_0x46694e['attributes']['length']?_0x46694e[_0x896a('0x3f')]:_0x560ca1[_0x896a('0x38')];if(!_0x43b136[_0x896a('0x3b')]['hasOwnProperty']('nolimit')){_0x46694e[_0x896a('0x20')]=qs['limit'](_0x43b136[_0x896a('0x3b')][_0x896a('0x20')]);_0x46694e['offset']=qs[_0x896a('0x1f')](_0x43b136[_0x896a('0x3b')][_0x896a('0x1f')]);}_0x46694e['order']=qs[_0x896a('0x40')](_0x43b136[_0x896a('0x3b')]['sort']);_0x46694e[_0x896a('0x41')]=qs[_0x896a('0x3c')](_['pick'](_0x43b136[_0x896a('0x3b')],_0x560ca1['filters']));var _0x4ba48a=[];var _0x4ced17=squel[_0x896a('0x42')]()[_0x896a('0x43')]('id')['field'](_0x896a('0x39'))[_0x896a('0x43')](_0x896a('0x44'))[_0x896a('0x45')](_0x896a('0x46'));var _0x13d936=squel['select']()[_0x896a('0x43')](_0x896a('0x47'))[_0x896a('0x43')](_0x896a('0x48'))['field'](_0x896a('0x49'))[_0x896a('0x45')]('user_has_openchannel_interactions','ui')[_0x896a('0x4a')]('users','u',_0x896a('0x4b'));var _0x1fdab1=squel[_0x896a('0x42')]()[_0x896a('0x45')](_0x896a('0x4c'),'i')[_0x896a('0x4a')](_0x896a('0x4d'),'c',_0x896a('0x4e'))[_0x896a('0x4a')](_0x896a('0x4f'),'o','o.id\x20=\x20i.UserId')[_0x896a('0x4a')]('openchannel_accounts','a','a.id\x20=\x20i.OpenchannelAccountId')['left_join'](_0x896a('0x50'),'me',_0x896a('0x51'))[_0x896a('0x4a')](_0x896a('0x52'),'it',_0x896a('0x53'))[_0x896a('0x4a')](_0x896a('0x46'),'t',_0x896a('0x54'));var _0x26f326=squel['expr']();var _0x27e5f1=[];var _0x38a23a=squel[_0x896a('0x55')]();var _0x437c9f;if(_0x43b136[_0x896a('0x3b')]['search']){_0x437c9f=as[_0x896a('0x56')](_0x43b136[_0x896a('0x3b')][_0x896a('0x57')]);var _0x212b6c=_0x437c9f[_0x896a('0x58')];for(var _0x31af48=0x0;_0x31af48<_0x437c9f[_0x896a('0x59')]['length'];_0x31af48++){var _0xf356d4=_0x437c9f['conditions'][_0x31af48];var _0x4e3bb5='i';var _0x1bb578=_[_0x896a('0x5a')](_0x1927be,['name',_0xf356d4['field']]);if(!_0x1bb578){switch(_0xf356d4[_0x896a('0x43')]){case _0x896a('0x5b'):if(_0xf356d4['value']==0x1){_0x1fdab1['having']('`'+_0xf356d4['field']+_0x896a('0x5c'));}else{_0x1fdab1['having']('`'+_0xf356d4[_0x896a('0x43')]+_0x896a('0x5d'));}break;case _0x896a('0x5e'):if(_0xf356d4['operator']===_0x896a('0x5f')){if(_0xf356d4[_0x896a('0x60')][_0x896a('0x30')]('\x20')[_0x896a('0x61')]>0x1){_0x26f326[_0x212b6c]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x896a('0x62')](_0xf356d4[_0x896a('0x60')]),null);}else{var _0x513abb='%'+_0xf356d4['value']+'%';_0x26f326[_0x212b6c](_0x896a('0x63'),_0x513abb,_0x513abb,_0x513abb);}}else{_0x1bb578=_[_0x896a('0x5a')](_0x1927be,['name',_0x896a('0x64')]);_0xf356d4['field']=_0x896a('0x64');_0x237b1c=as[_0x896a('0x65')](_0x4e3bb5,_0x1bb578[_0x896a('0x36')],_0xf356d4);_0x26f326[_0x212b6c](_0x237b1c[_0x896a('0x66')],_0x237b1c[_0x896a('0x60')][_0x896a('0x67')],_0x237b1c['value'][_0x896a('0x28')]);}break;case _0x896a('0x68'):var _0x180391=_0xf356d4['value'][_0x896a('0x30')](',')[_0x896a('0x2c')](function(_0xa1d3aa){return Number(_0xa1d3aa);});_0x180391['forEach'](function(_0x4b8856){_0x38a23a['or'](_0x896a('0x69'),'%,'+_0x4b8856+',%');});_0x27e5f1=_[_0x896a('0x6a')](_0x27e5f1,_0x180391);break;case'User':if(_0xf356d4[_0x896a('0x6b')]===_0x896a('0x5f')){_0x26f326[_0x212b6c](_0x896a('0x6c'),'%'+_0xf356d4[_0x896a('0x60')]+'%',null);}else{_0x1bb578=_[_0x896a('0x5a')](_0x1927be,[_0x896a('0x39'),_0x896a('0x6d')]);_0xf356d4[_0x896a('0x43')]='UserId';_0x237b1c=as[_0x896a('0x65')](_0x4e3bb5,_0x1bb578['type'],_0xf356d4);_0x26f326[_0x212b6c](_0x237b1c[_0x896a('0x66')],_0x237b1c['value'][_0x896a('0x67')],_0x237b1c[_0x896a('0x60')]['end']);}break;case _0x896a('0x6e'):_0x237b1c=as[_0x896a('0x65')]('me',null,_0xf356d4);_0x26f326[_0x212b6c](_0x237b1c[_0x896a('0x66')],_0x237b1c[_0x896a('0x60')][_0x896a('0x67')],_0x237b1c[_0x896a('0x60')][_0x896a('0x28')]);break;}}else{var _0x237b1c=as['buildExpression'](_0x4e3bb5,_0x1bb578['type'],_0xf356d4);_0x26f326[_0x212b6c](_0x237b1c[_0x896a('0x66')],_0x237b1c['value'][_0x896a('0x67')],_0x237b1c[_0x896a('0x60')][_0x896a('0x28')]);}}}else{var _0x301524=_(_0x43b136[_0x896a('0x3b')])[_0x896a('0x3a')]()['map'](function(_0x233e3e){return _[_0x896a('0x6f')](_0x1927be,['name',_0x233e3e])?_0x233e3e:undefined;})[_0x896a('0x70')]()[_0x896a('0x60')]();if(!_[_0x896a('0x71')](_0x301524)){_0x301524[_0x896a('0x31')](function(_0x3e9b07){if(_0x3e9b07===_0x896a('0x72')){_0x1fdab1[_0x896a('0x41')](_0x896a('0x73'),[][_0x896a('0x74')](_0x43b136[_0x896a('0x3b')][_0x3e9b07]));}else if(_0x3e9b07===_0x896a('0x75')){var _0x379736=JSON[_0x896a('0x76')](_0x43b136[_0x896a('0x3b')][_0x3e9b07])['$gte'];var _0x246738=JSON['parse'](_0x43b136['query'][_0x3e9b07])[_0x896a('0x77')];_0x1fdab1[_0x896a('0x41')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x379736,_0x246738);}else{if(_0x43b136[_0x896a('0x3b')][_0x3e9b07]===_0x896a('0x78')){_0x1fdab1[_0x896a('0x41')]('i.'+_0x3e9b07+_0x896a('0x79'));}else{_0x1fdab1[_0x896a('0x41')]('i.'+_0x3e9b07+'\x20=\x20?',_0x43b136['query'][_0x3e9b07]);}}});}if(_0x43b136[_0x896a('0x3b')][_0x896a('0x7a')]){if(_0x43b136[_0x896a('0x3b')][_0x896a('0x7a')]==0x1){_0x1fdab1[_0x896a('0x7b')](_0x896a('0x7c'));}else{_0x1fdab1[_0x896a('0x7b')]('`unreadMessages`\x20>\x200');}}if(_0x43b136[_0x896a('0x3b')][_0x896a('0x7d')]){_0x27e5f1=_[_0x896a('0x7e')](_0x43b136[_0x896a('0x3b')][_0x896a('0x7d')])?_0x43b136[_0x896a('0x3b')][_0x896a('0x7d')]:new Array(_0x43b136['query']['tag']);_0x27e5f1[_0x896a('0x31')](function(_0x189a49){_0x38a23a['or'](_0x896a('0x69'),'%,'+_0x189a49+',%');});}if(_0x43b136[_0x896a('0x3b')][_0x896a('0x7f')]){var _0x5e3807=_0x43b136['query'][_0x896a('0x7f')][_0x896a('0x80')]('\x5c','\x5c\x5c')[_0x896a('0x80')]('\x27\x27',_0x896a('0x81'));if(qs['isNumeric'](_0x5e3807)){_0x26f326['or'](_0x896a('0x82'),_0x5e3807+'%');}else{_0x26f326['or'](_0x896a('0x83'),qs[_0x896a('0x62')](_0x5e3807))['or'](_0x896a('0x84'),_0x5e3807+'%')['or'](_0x896a('0x85'),_0x5e3807+'%');}}}_0x1fdab1[_0x896a('0x41')](_0x26f326);_0x1fdab1[_0x896a('0x86')](_0x896a('0x87'));var _0x203dce={'type':db['Sequelize'][_0x896a('0x88')][_0x896a('0x89')],'raw':!![]};var _0x212e58=_0x1fdab1['clone']();_0x212e58[_0x896a('0x43')]('i.id');_0x212e58[_0x896a('0x43')](_0x896a('0x8a'),'unreadMessages');if(_0x46694e[_0x896a('0x8b')]){_0x46694e['order'][_0x896a('0x31')](function(_0x2b4222){_0x1fdab1[_0x896a('0x8b')]('i.'+_0x2b4222[0x0],_0x2b4222[0x1]===_0x896a('0x8c')?![]:!![]);});}if(!_[_0x896a('0x71')](_0x27e5f1)){_0x1fdab1['having'](_0x38a23a);_0x212e58[_0x896a('0x41')](_0x896a('0x8d'),_0x27e5f1);}BPromise[_0x896a('0x8e')]()[_0x896a('0x26')](function(){if(!_0x437c9f){if(_0x43b136[_0x896a('0x3b')]['OpenchannelAccountId']||_0x43b136[_0x896a('0x3b')][_0x896a('0x8f')])return;_0x212e58[_0x896a('0x41')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x1fdab1[_0x896a('0x41')](_0x896a('0x90'));return;}return _0x43b136[_0x896a('0x91')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0x896a('0x26')](function(_0x9e8006){if(_[_0x896a('0x71')](_0x9e8006)){_0x212e58['where'](_0x896a('0x92'));_0x1fdab1[_0x896a('0x41')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x212e58[_0x896a('0x41')](_0x896a('0x73'),_['map'](_0x9e8006,'id'));_0x1fdab1[_0x896a('0x41')](_0x896a('0x73'),_[_0x896a('0x2c')](_0x9e8006,'id'));}});})[_0x896a('0x26')](function(){db[_0x896a('0x93')][_0x896a('0x3b')](_0x212e58[_0x896a('0x94')](),_0x203dce)[_0x896a('0x26')](function(_0x31fa5a){_0x36c906['count']=_0x31fa5a[_0x896a('0x61')];if(_0x36c906['count']===0x0)return[];return db['sequelize'][_0x896a('0x3b')](_0x4ced17[_0x896a('0x94')](),_0x203dce)[_0x896a('0x26')](function(_0x2a3f1b){_0x4ba48a=_[_0x896a('0x95')](_0x2a3f1b,'id');_0x203dce=_['merge'](_0x203dce,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x43b136[_0x896a('0x3b')]['fields']){_0x46694e[_0x896a('0x3f')][_0x896a('0x31')](function(_0x392338){_0x1fdab1[_0x896a('0x43')]('i.'+_0x392338);});}else{_0x1fdab1[_0x896a('0x43')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x896a('0x5b'));_0x1fdab1['field'](_0x896a('0x96'),_0x896a('0x97'));_0x1fdab1[_0x896a('0x43')](_0x896a('0x98'),_0x896a('0x99'));_0x1fdab1[_0x896a('0x43')]('i.*');_0x1fdab1[_0x896a('0x43')](_0x896a('0x9a'),_0x896a('0x9b'));_0x1fdab1[_0x896a('0x43')](_0x896a('0x9c'),'Contact.lastName');_0x1fdab1[_0x896a('0x43')]('c.email',_0x896a('0x9d'));_0x1fdab1[_0x896a('0x43')](_0x896a('0x9e'),_0x896a('0x9f'));_0x1fdab1[_0x896a('0x43')]('c.mobile','Contact.mobile');_0x1fdab1[_0x896a('0x43')](_0x896a('0xa0'),_0x896a('0xa1'));_0x1fdab1['field'](_0x896a('0xa2'),'Owner.fullname');_0x1fdab1[_0x896a('0x43')](_0x896a('0xa3'),_0x896a('0xa4'));_0x1fdab1[_0x896a('0x43')](_0x896a('0xa5'),_0x896a('0x2e'));}_0x1fdab1[_0x896a('0x20')](_0x46694e['limit']);_0x1fdab1[_0x896a('0x1f')](_0x46694e[_0x896a('0x1f')]);return db['sequelize'][_0x896a('0x3b')](_0x1fdab1[_0x896a('0x94')](),_0x203dce);})[_0x896a('0x26')](function(_0x436744){_0x13d936[_0x896a('0x41')]('ui.OpenchannelInteractionId\x20IN\x20?',_['map'](_0x436744,'id'));return db[_0x896a('0x93')][_0x896a('0x3b')](_0x13d936['toString'](),_0x203dce)[_0x896a('0x26')](function(_0x550a00){var _0x56a211=_['groupBy'](_0x550a00,_0x896a('0xa6'));var _0x3c3cb9=[];_0x436744[_0x896a('0x31')](function(_0x5e2905){_0x3c3cb9[_0x896a('0xa7')](updateOpenchannelInteraction(_0x5e2905,_0x4ba48a,_0x56a211));});return BPromise[_0x896a('0xa8')](_0x3c3cb9);});});})[_0x896a('0x26')](function(_0x6f6a84){_0x36c906['rows']=_0x6f6a84;return _0x36c906;})[_0x896a('0x26')](respondWithFilteredResult(_0x68797b,_0x46694e));})[_0x896a('0x32')](handleError(_0x68797b,null));};exports[_0x896a('0xa9')]=function(_0x353b88,_0x1f83c7){var _0x16e08f={'raw':![],'where':{'id':_0x353b88[_0x896a('0xaa')]['id']}},_0xa18032={};_0xa18032[_0x896a('0x38')]=_[_0x896a('0x3a')](db['OpenchannelInteraction']['rawAttributes']);_0xa18032['query']=_[_0x896a('0x3a')](_0x353b88[_0x896a('0x3b')]);_0xa18032['filters']=_[_0x896a('0x3d')](_0xa18032[_0x896a('0x38')],_0xa18032[_0x896a('0x3b')]);_0x16e08f[_0x896a('0x3f')]=_[_0x896a('0x3d')](_0xa18032[_0x896a('0x38')],qs['fields'](_0x353b88[_0x896a('0x3b')][_0x896a('0x3e')]));_0x16e08f['attributes']=_0x16e08f[_0x896a('0x3f')]['length']?_0x16e08f[_0x896a('0x3f')]:_0xa18032[_0x896a('0x38')];if(_0x353b88[_0x896a('0x3b')][_0x896a('0xab')]){_0x16e08f[_0x896a('0xac')]=[{'all':!![]}];}_0x16e08f=_[_0x896a('0xad')]({},_0x16e08f,_0x353b88[_0x896a('0xae')]);return db[_0x896a('0x33')]['find'](_0x16e08f)[_0x896a('0x26')](handleEntityNotFound(_0x1f83c7,null))[_0x896a('0x26')](respondWithResult(_0x1f83c7,null))[_0x896a('0x32')](handleError(_0x1f83c7,null));};exports[_0x896a('0xaf')]=function(_0x5204ee,_0x3c29c9){return db['OpenchannelInteraction'][_0x896a('0xaf')](_0x5204ee[_0x896a('0x6e')],{})[_0x896a('0x26')](respondWithResult(_0x3c29c9,0xc9))[_0x896a('0x32')](handleError(_0x3c29c9,null));};exports['update']=function(_0x3d1cd5,_0x237cd3){if(_0x3d1cd5[_0x896a('0x6e')]['id']){delete _0x3d1cd5['body']['id'];}return db[_0x896a('0x33')][_0x896a('0x5a')]({'where':{'id':_0x3d1cd5[_0x896a('0xaa')]['id']}})[_0x896a('0x26')](handleEntityNotFound(_0x237cd3,null))['then'](saveUpdates(_0x3d1cd5[_0x896a('0x6e')],null))[_0x896a('0x26')](respondWithResult(_0x237cd3,null))[_0x896a('0x32')](handleError(_0x237cd3,null));};exports['destroy']=function(_0x23a6ad,_0x300b8b){return db[_0x896a('0x33')][_0x896a('0x5a')]({'where':{'id':_0x23a6ad[_0x896a('0xaa')]['id']}})['then'](handleEntityNotFound(_0x300b8b,null))['then'](removeEntity(_0x300b8b,null))['catch'](handleError(_0x300b8b,null));};exports['describe']=function(_0x24a278,_0x2d8d08){return db[_0x896a('0x33')][_0x896a('0xb0')]()['then'](respondWithResult(_0x2d8d08,null))[_0x896a('0x32')](handleError(_0x2d8d08,null));};exports[_0x896a('0xb1')]=function(_0x9aa1be,_0x51423d,_0x50eeea){return db[_0x896a('0xb2')]['find']({'where':{'id':_0x9aa1be['params']['id']}})[_0x896a('0x26')](handleEntityNotFound(_0x51423d,null))[_0x896a('0x26')](function(_0x40f87){if(_0x40f87){return _0x40f87[_0x896a('0xb1')](_0x9aa1be[_0x896a('0x6e')][_0x896a('0xb3')],_[_0x896a('0xb4')](_0x9aa1be['body'],['ids','id'])||{});}})[_0x896a('0x26')](respondWithResult(_0x51423d,null))[_0x896a('0x32')](handleError(_0x51423d,null));};exports[_0x896a('0xb5')]=function(_0x4c116d,_0x5ba76e,_0x429105){var _0x156064={'raw':![],'where':{}};var _0x231e2e={};var _0x1219da={'count':0x0,'rows':[]};return db[_0x896a('0x33')]['findOne']({'where':{'id':_0x4c116d[_0x896a('0xaa')]['id']}})[_0x896a('0x26')](handleEntityNotFound(_0x5ba76e,null))[_0x896a('0x26')](function(_0x272840){if(_0x272840){_0x231e2e['model']=_['keys'](db[_0x896a('0xb2')][_0x896a('0x34')]);_0x231e2e[_0x896a('0x3b')]=_[_0x896a('0x3a')](_0x4c116d[_0x896a('0x3b')]);_0x231e2e[_0x896a('0x3c')]=_['intersection'](_0x231e2e[_0x896a('0x38')],_0x231e2e[_0x896a('0x3b')]);_0x156064[_0x896a('0x3f')]=_[_0x896a('0x3d')](_0x231e2e[_0x896a('0x38')],qs[_0x896a('0x3e')](_0x4c116d[_0x896a('0x3b')]['fields']));_0x156064[_0x896a('0x3f')]=_0x156064[_0x896a('0x3f')][_0x896a('0x61')]?_0x156064[_0x896a('0x3f')]:_0x231e2e['model'];if(!_0x4c116d[_0x896a('0x3b')][_0x896a('0xb6')]('nolimit')){_0x156064[_0x896a('0x20')]=qs[_0x896a('0x20')](_0x4c116d[_0x896a('0x3b')][_0x896a('0x20')]);_0x156064[_0x896a('0x1f')]=qs[_0x896a('0x1f')](_0x4c116d[_0x896a('0x3b')][_0x896a('0x1f')]);}_0x156064[_0x896a('0x8b')]=qs[_0x896a('0x40')](_0x4c116d[_0x896a('0x3b')][_0x896a('0x40')]);_0x156064['where']=qs[_0x896a('0x3c')](_[_0x896a('0xb7')](_0x4c116d[_0x896a('0x3b')],_0x231e2e[_0x896a('0x3c')]));_0x156064['where'][_0x896a('0xa6')]=_0x272840['id'];if(_0x4c116d[_0x896a('0x3b')][_0x896a('0x7f')]){_0x156064[_0x896a('0x41')]=_[_0x896a('0xad')](_0x156064[_0x896a('0x41')],{'$or':_['map'](_0x156064[_0x896a('0x3f')],function(_0x6885de){var _0x259944={};_0x259944[_0x6885de]={'$like':'%'+_0x4c116d[_0x896a('0x3b')][_0x896a('0x7f')]+'%'};return _0x259944;})});}if(_0x4c116d[_0x896a('0x3b')]['$gte']){var _0x26a64f=_0x4c116d['query'][_0x896a('0xb8')][_0x896a('0x30')](',');var _0x18c77f={};_0x18c77f[_0x26a64f[0x0]]={'$gte':moment(_0x26a64f[0x1])[_0x896a('0xb9')](_0x896a('0xba'))};_0x156064[_0x896a('0x41')]=_[_0x896a('0xad')](_0x156064[_0x896a('0x41')],_0x18c77f);}_0x156064=_[_0x896a('0xad')]({},_0x156064,_0x4c116d[_0x896a('0xae')]);return db[_0x896a('0xb2')][_0x896a('0x1e')]({'where':_0x156064['where']})[_0x896a('0x26')](function(_0x3fdc39){_0x1219da[_0x896a('0x1e')]=_0x3fdc39;if(_0x4c116d[_0x896a('0x3b')][_0x896a('0xab')]){_0x156064[_0x896a('0xac')]=[{'all':!![]}];}return db[_0x896a('0xb2')][_0x896a('0xbb')](_0x156064);})[_0x896a('0x26')](function(_0x5de906){_0x1219da[_0x896a('0xbc')]=_0x5de906;return _0x1219da;});}})['then'](respondWithFilteredResult(_0x5ba76e,_0x156064))[_0x896a('0x32')](handleError(_0x5ba76e,null));};exports[_0x896a('0xbd')]=function(_0x4dac79,_0x1d0239,_0x337148){return db[_0x896a('0x33')]['find']({'where':{'id':_0x4dac79[_0x896a('0xaa')]['id']}})[_0x896a('0x26')](handleEntityNotFound(_0x1d0239,null))[_0x896a('0x26')](function(_0x5debc2){if(_0x5debc2){return _0x5debc2[_0x896a('0xbe')](_0x4dac79['body'][_0x896a('0xb3')],_[_0x896a('0xb4')](_0x4dac79[_0x896a('0x6e')],['ids','id'])||{})[_0x896a('0xbf')](function(){return db[_0x896a('0x68')]['findAll']({'attributes':['id','name',_0x896a('0x44')],'where':{'id':_0x4dac79[_0x896a('0x6e')][_0x896a('0xb3')]}});})['then'](function(_0x1d6b4f){socket['emit']('openchannelInteractionTags:save',{'id':Number(_0x4dac79[_0x896a('0xaa')]['id']),'tags':_0x1d6b4f||[]});return{'id':Number(_0x4dac79['params']['id']),'tags':_0x1d6b4f||[]};});}})[_0x896a('0x26')](respondWithResult(_0x1d0239,null))['catch'](handleError(_0x1d0239,null));};exports['removeTags']=function(_0x1bff02,_0x4e22b8,_0x28d292){return db['OpenchannelInteraction'][_0x896a('0x5a')]({'where':{'id':_0x1bff02[_0x896a('0xaa')]['id']}})['then'](handleEntityNotFound(_0x4e22b8,null))['then'](function(_0x4c708d){if(_0x4c708d){return _0x4c708d['removeTags'](_0x1bff02[_0x896a('0x3b')]['ids']);}})[_0x896a('0x26')](respondWithStatusCode(_0x4e22b8,null))[_0x896a('0x32')](handleError(_0x4e22b8,null));};exports['download']=function(_0x399674,_0x1b960d){var _0x476b3f=moment()[_0x896a('0xc0')]()[_0x896a('0x94')]();var _0x664d6b=path[_0x896a('0xc1')](config[_0x896a('0xc2')],'server',_0x896a('0xc3'),_0x896a('0xc4'));var _0x52c24a=path[_0x896a('0xc1')](config[_0x896a('0xc2')],'server',_0x896a('0xc3'),'attachments');var _0x521f52=path[_0x896a('0xc1')](_0x664d6b,_0x476b3f);var _0x18f040=util[_0x896a('0xb9')](_0x896a('0xc5'),_0x399674[_0x896a('0xaa')]['id'],_0x476b3f);var _0x1bb56b=path['join'](_0x664d6b,_0x18f040);var _0x1504a0=[];_0x1504a0[_0x896a('0xa7')]({'model':db[_0x896a('0xc6')],'as':_0x896a('0xc6'),'attributes':['id',_0x896a('0x2d')],'raw':!![]});_0x1504a0[_0x896a('0xa7')]({'model':db['CmContact'],'as':_0x896a('0x5e'),'attributes':['id',_0x896a('0xc7'),_0x896a('0xc8')],'raw':!![]});if(_0x399674[_0x896a('0x3b')]['attachments']){_0x1504a0[_0x896a('0xa7')]({'model':db[_0x896a('0xc9')],'as':'Attachment','raw':!![]});}var _0x20b923=[{'model':db[_0x896a('0xb2')],'as':_0x896a('0xca'),'attributes':['id',_0x896a('0x6e'),'createdAt',_0x896a('0xcb'),'secret',_0x896a('0x7a')],'include':_0x1504a0}];_0x20b923[_0x896a('0xa7')]({'model':db[_0x896a('0xcc')],'as':'Account','attributes':['id',_0x896a('0x39')]});_0x20b923[_0x896a('0xa7')]({'model':db[_0x896a('0xc6')],'as':_0x896a('0xcd'),'attributes':['id',_0x896a('0x2d')]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x399674['params']['id']},'include':_0x20b923})['then'](handleEntityNotFound(_0x1b960d,null))[_0x896a('0x26')](function(_0x381bac){if(_0x381bac){var _0x3bf5b3=_0x381bac[_0x896a('0xce')]({'plain':!![]});fs[_0x896a('0xcf')](_0x521f52);var _0xac6b64={'format':'A4','border':'10px','header':{'height':'40px','contents':{'first':_0x896a('0xd0')}},'footer':{'height':'30px','contents':{'default':util['format'](_0x896a('0xd1'),util['format'](_0x896a('0xd2'),_0x896a('0xd3'),_0x3bf5b3['id']),moment()[_0x896a('0xb9')](_0x896a('0xd4'))[_0x896a('0x94')]())}}};var _0x400206={'channel':_0x896a('0xd3'),'account':_0x3bf5b3[_0x896a('0xd5')][_0x896a('0x39')],'agent':_0x3bf5b3[_0x896a('0xcd')]?_0x3bf5b3[_0x896a('0xcd')][_0x896a('0x2d')]:_0x896a('0xd6'),'createdAt':moment(_0x3bf5b3[_0x896a('0x75')])[_0x896a('0xb9')](_0x896a('0xba'))[_0x896a('0x94')](),'closedAt':_0x3bf5b3[_0x896a('0xd7')]?moment(_0x3bf5b3[_0x896a('0xd8')])[_0x896a('0xb9')](_0x896a('0xba'))[_0x896a('0x94')]():'','disposition':_0x3bf5b3['disposition'],'visibility':_0x3bf5b3[_0x896a('0xd9')]?_0x896a('0xda'):_0x896a('0xdb'),'messages':_(_0x3bf5b3[_0x896a('0xca')])['filter']({'secret':![]})[_0x896a('0x2c')](function(_0x24dc51){if(_0x24dc51[_0x896a('0xc9')]){var _0x3327b0=path[_0x896a('0xc1')](_0x52c24a,_0x24dc51[_0x896a('0xc9')][_0x896a('0xdc')]);if(fs[_0x896a('0xdd')](_0x3327b0)){fs[_0x896a('0xde')](_0x3327b0)[_0x896a('0xdf')](fs['createWriteStream'](path['join'](_0x521f52,_0x24dc51['Attachment'][_0x896a('0xdc')])));}}return{'date':moment(_0x24dc51[_0x896a('0x75')])[_0x896a('0xb9')]('YYYY-MM-DD\x20HH:mm:ss')[_0x896a('0x94')](),'sender':_0x24dc51['direction']===_0x896a('0xe0')?_0x24dc51['User']?_0x24dc51['User'][_0x896a('0x2d')]:_0x896a('0xe1'):_0x24dc51[_0x896a('0x5e')][_0x896a('0xc7')]+(_0x24dc51[_0x896a('0x5e')][_0x896a('0xc8')]?'\x20'+_0x24dc51[_0x896a('0x5e')][_0x896a('0xc8')]:''),'body':_0x24dc51['Attachment']?_0x24dc51[_0x896a('0xc9')][_0x896a('0xdc')]:_0x24dc51['body'],'direction':_0x24dc51[_0x896a('0xcb')]===_0x896a('0xe0')?'A':'C','secret':_0x24dc51[_0x896a('0xe2')],'read':_0x24dc51[_0x896a('0x7a')],'attachment':_0x24dc51[_0x896a('0xc9')]};})[_0x896a('0x60')]()};return ejs[_0x896a('0xe3')](path[_0x896a('0xc1')](config[_0x896a('0xc2')],_0x896a('0xe4'),_0x896a('0xe5'),_0x896a('0xe6')),{'interaction':_0x400206})[_0x896a('0x26')](function(_0x28e4df){return new BPromise(function(_0x1c29e9,_0x16db58){pdf[_0x896a('0xaf')](_0x28e4df,_0xac6b64)[_0x896a('0xe7')](path[_0x896a('0xc1')](_0x521f52,_0x896a('0xe8')+_0x3bf5b3['id']+'-'+_0x476b3f+_0x896a('0xe9')),function(_0x439c9b,_0x1e7fe8){if(_0x439c9b)return _0x16db58(_0x439c9b);_0x1c29e9(_0x1e7fe8);});});})[_0x896a('0x26')](function(){return new BPromise(function(_0xa1da4c,_0x1c6330){zipdir(_0x521f52,{'saveTo':_0x1bb56b},function(_0x53744b,_0x33c2f6){if(_0x53744b)return _0x1c6330(_0x53744b);return _0xa1da4c(_0x33c2f6);});})[_0x896a('0x26')](function(){return new BPromise(function(_0xe8a9c1,_0x15f36a){rimraf(_0x521f52,function(_0x52eb08){if(_0x52eb08)_0x15f36a(_0x52eb08);return _0xe8a9c1();});});})[_0x896a('0x26')](function(){return _0x1b960d['download'](_0x1bb56b,_0x18f040,function(_0x35de0b){if(_0x35de0b){console['log'](_0x896a('0xea'),_0x35de0b);}else{fs['unlinkSync'](_0x1bb56b);}});});});}else{return _0x1b960d[_0x896a('0x1b')](0xc8);}})['catch'](handleError(_0x1b960d,null));}; \ No newline at end of file +var _0x614f=['createWriteStream','System','out','renderFile','views','downloadInteraction.html','toFile','.pdf','log','err','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','end','status','offset','set','json','apply','reject','save','update','destroy','then','error','stack','name','Users','map','fullname','TagIds','split','forEach','catch','index','rawAttributes','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','field','color','from','tools_tags','select','u.id','u.fullname','ui.OpenchannelInteractionId','left_join','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','openchannel_accounts','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','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','ContactId','buildExpression','type','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','body','keys','some','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.from\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','count','keyBy','OpenchannelInteraction','a.key','a.mandatoryDisposition','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','ui.OpenchannelInteractionId\x20IN\x20?','all','rows','show','fields','includeAll','include','merge','create','params','describe','OpenchannelMessage','addMessage','ids','omit','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','addTags','setTags','spread','Tag','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','firstName','lastName','Attachment','Messages','direction','secret','OpenchannelAccount','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','YYYY-MM-DD','Account','closed','disposition','threadId','Public','Private','basename','existsSync'];(function(_0x39cce9,_0x2bfdfc){var _0x12e796=function(_0x1e7b17){while(--_0x1e7b17){_0x39cce9['push'](_0x39cce9['shift']());}};_0x12e796(++_0x2bfdfc);}(_0x614f,0x1d4));var _0xf614=function(_0x40dfe8,_0x473123){_0x40dfe8=_0x40dfe8-0x0;var _0x2cdc1b=_0x614f[_0x40dfe8];return _0x2cdc1b;};'use strict';var pdf=require(_0xf614('0x0'));var emlformat=require(_0xf614('0x1'));var rimraf=require(_0xf614('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf614('0x3'));var rp=require(_0xf614('0x4'));var moment=require(_0xf614('0x5'));var BPromise=require(_0xf614('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xf614('0x7'));var csv=require(_0xf614('0x8'));var ejs=require(_0xf614('0x9'));var fs=require('fs');var _=require(_0xf614('0xa'));var squel=require(_0xf614('0xb'));var crypto=require(_0xf614('0xc'));var jsforce=require(_0xf614('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf614('0x8'));var querystring=require('querystring');var Papa=require(_0xf614('0xe'));var Redis=require(_0xf614('0xf'));var authService=require(_0xf614('0x10'));var qs=require(_0xf614('0x11'));var as=require(_0xf614('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xf614('0x13'));var db=require(_0xf614('0x14'))['db'];config['redis']=_[_0xf614('0x15')](config[_0xf614('0x16')],{'host':_0xf614('0x17'),'port':0x18eb});var socket=require(_0xf614('0x18'))(new Redis(config[_0xf614('0x16')]));require('./openchannelInteraction.socket')[_0xf614('0x19')](socket);function respondWithStatusCode(_0x1a2c44,_0x3caea7){_0x3caea7=_0x3caea7||0xcc;return function(_0x50789d){if(_0x50789d){return _0x1a2c44[_0xf614('0x1a')](_0x3caea7);}return _0x1a2c44['status'](_0x3caea7)[_0xf614('0x1b')]();};}function respondWithResult(_0x137901,_0x2d8df1){_0x2d8df1=_0x2d8df1||0xc8;return function(_0x4ac1db){if(_0x4ac1db){return _0x137901[_0xf614('0x1c')](_0x2d8df1)['json'](_0x4ac1db);}};}function respondWithFilteredResult(_0x324207,_0x1a4571){return function(_0x2db77c){if(_0x2db77c){var _0x267de5=_0x2db77c['count'],_0x269672=_0x1a4571['offset'],_0x319217=_0x1a4571[_0xf614('0x1d')]+_0x1a4571['limit'],_0x23a2e0;if(_0x319217>=_0x267de5){_0x319217=_0x267de5;_0x23a2e0=0xc8;}else{_0x23a2e0=0xce;}_0x324207[_0xf614('0x1c')](_0x23a2e0);return _0x324207[_0xf614('0x1e')]('Content-Range',_0x269672+'-'+_0x319217+'/'+_0x267de5)[_0xf614('0x1f')](_0x2db77c);}return null;};}function patchUpdates(_0x1a83b2){return function(_0x1e0516){try{jsonpatch[_0xf614('0x20')](_0x1e0516,_0x1a83b2,!![]);}catch(_0x2cc707){return BPromise[_0xf614('0x21')](_0x2cc707);}return _0x1e0516[_0xf614('0x22')]();};}function saveUpdates(_0x20d70b,_0x2d603d){return function(_0x5278ef){if(_0x5278ef){return _0x5278ef[_0xf614('0x23')](_0x20d70b)['then'](function(_0x41a8b7){return _0x41a8b7;});}return null;};}function removeEntity(_0x554472,_0x3790e1){return function(_0x270ad1){if(_0x270ad1){return _0x270ad1[_0xf614('0x24')]()[_0xf614('0x25')](function(){_0x554472[_0xf614('0x1c')](0xcc)[_0xf614('0x1b')]();});}};}function handleEntityNotFound(_0x48b2ac,_0x564b75){return function(_0x1df094){if(!_0x1df094){_0x48b2ac['sendStatus'](0x194);}return _0x1df094;};}function handleError(_0x35167e,_0x44a7d9){_0x44a7d9=_0x44a7d9||0x1f4;return function(_0x1832ef){logger[_0xf614('0x26')](_0x1832ef[_0xf614('0x27')]);if(_0x1832ef['name']){delete _0x1832ef[_0xf614('0x28')];}_0x35167e['status'](_0x44a7d9)['send'](_0x1832ef);};}function getInteractionUsers(_0x281bfd,_0x58571f){return new BPromise(function(_0x5ae0bb,_0xdb210c){try{if(_0x58571f[_0x281bfd['id']]){_0x281bfd[_0xf614('0x29')]=_[_0xf614('0x2a')](_0x58571f[_0x281bfd['id']],function(_0x3e1acb){return{'id':_0x3e1acb['id'],'fullname':_0x3e1acb[_0xf614('0x2b')]};});}}catch(_0x25c034){_0xdb210c(_0x25c034);}_0x5ae0bb(_0x281bfd);});}function getInteractionTags(_0x4578c9,_0x343a43){return new BPromise(function(_0x2d232e,_0x266c24){try{if(_0x4578c9[_0xf614('0x2c')]){_0x4578c9['Tags']=[];_0x4578c9[_0xf614('0x2c')][_0xf614('0x2d')](',')[_0xf614('0x2e')](function(_0x17fc32){_0x4578c9['Tags']['push'](_0x343a43[_0x17fc32]);});}delete _0x4578c9[_0xf614('0x2c')];}catch(_0x173d05){_0x266c24(_0x173d05);}_0x2d232e(_0x4578c9);});}function updateOpenchannelInteraction(_0x456896,_0x1e4e53,_0x3899f8){return new BPromise(function(_0xb65767,_0x31ff0b){return getInteractionUsers(_0x456896,_0x3899f8)[_0xf614('0x25')](function(_0x380be7){return getInteractionTags(_0x380be7,_0x1e4e53);})[_0xf614('0x25')](function(_0x3f20af){_0xb65767(_0x3f20af);})[_0xf614('0x2f')](function(_0x50573d){_0x31ff0b(_0x50573d);});});}exports[_0xf614('0x30')]=function(_0x44c0a6,_0xf31848){var _0x46b757={},_0x1ea442={},_0xaf5fa7={'count':0x0,'rows':[]};var _0x308060=_[_0xf614('0x2a')](db['OpenchannelInteraction'][_0xf614('0x31')],function(_0x1384d3){return{'name':_0x1384d3['fieldName'],'type':_0x1384d3['type'][_0xf614('0x32')]};});_0x1ea442[_0xf614('0x33')]=_[_0xf614('0x2a')](_0x308060,_0xf614('0x28'));_0x1ea442[_0xf614('0x34')]=_['keys'](_0x44c0a6['query']);_0x1ea442[_0xf614('0x35')]=_[_0xf614('0x36')](_0x1ea442[_0xf614('0x33')],_0x1ea442['query']);_0x46b757['attributes']=_[_0xf614('0x36')](_0x1ea442[_0xf614('0x33')],qs['fields'](_0x44c0a6['query']['fields']));_0x46b757[_0xf614('0x37')]=_0x46b757[_0xf614('0x37')][_0xf614('0x38')]?_0x46b757['attributes']:_0x1ea442[_0xf614('0x33')];if(!_0x44c0a6['query'][_0xf614('0x39')](_0xf614('0x3a'))){_0x46b757[_0xf614('0x3b')]=qs[_0xf614('0x3b')](_0x44c0a6[_0xf614('0x34')][_0xf614('0x3b')]);_0x46b757[_0xf614('0x1d')]=qs[_0xf614('0x1d')](_0x44c0a6[_0xf614('0x34')][_0xf614('0x1d')]);}_0x46b757[_0xf614('0x3c')]=qs[_0xf614('0x3d')](_0x44c0a6[_0xf614('0x34')][_0xf614('0x3d')]);_0x46b757[_0xf614('0x3e')]=qs[_0xf614('0x35')](_[_0xf614('0x3f')](_0x44c0a6[_0xf614('0x34')],_0x1ea442[_0xf614('0x35')]));var _0xce6f5e=[];var _0x803ca9=squel['select']()[_0xf614('0x40')]('id')[_0xf614('0x40')](_0xf614('0x28'))['field'](_0xf614('0x41'))[_0xf614('0x42')](_0xf614('0x43'));var _0x9073b8=squel[_0xf614('0x44')]()[_0xf614('0x40')](_0xf614('0x45'))[_0xf614('0x40')](_0xf614('0x46'))[_0xf614('0x40')](_0xf614('0x47'))[_0xf614('0x42')]('user_has_openchannel_interactions','ui')[_0xf614('0x48')]('users','u',_0xf614('0x49'));var _0x221593=squel[_0xf614('0x44')]()[_0xf614('0x42')](_0xf614('0x4a'),'i')[_0xf614('0x48')](_0xf614('0x4b'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xf614('0x48')]('users','o','o.id\x20=\x20i.UserId')['left_join'](_0xf614('0x4c'),'a','a.id\x20=\x20i.OpenchannelAccountId')[_0xf614('0x48')](_0xf614('0x4d'),'me',_0xf614('0x4e'))[_0xf614('0x48')](_0xf614('0x4f'),'it',_0xf614('0x50'))['left_join']('tools_tags','t',_0xf614('0x51'));var _0x3b5f46=squel[_0xf614('0x52')]();var _0x52b18e=[];var _0x475932=squel[_0xf614('0x52')]();var _0x2c409a;if(_0x44c0a6[_0xf614('0x34')][_0xf614('0x53')]){_0x2c409a=as['parseSearch'](_0x44c0a6[_0xf614('0x34')][_0xf614('0x53')]);var _0x2c9675=_0x2c409a[_0xf614('0x54')];for(var _0x5a4dfc=0x0;_0x5a4dfc<_0x2c409a['conditions']['length'];_0x5a4dfc++){var _0x734d66=_0x2c409a[_0xf614('0x55')][_0x5a4dfc];var _0x403635='i';var _0x24bb0f=_[_0xf614('0x56')](_0x308060,[_0xf614('0x28'),_0x734d66[_0xf614('0x40')]]);if(!_0x24bb0f){switch(_0x734d66['field']){case _0xf614('0x57'):if(_0x734d66[_0xf614('0x58')]==0x1){_0x221593['having']('`'+_0x734d66[_0xf614('0x40')]+_0xf614('0x59'));}else{_0x221593[_0xf614('0x5a')]('`'+_0x734d66[_0xf614('0x40')]+_0xf614('0x5b'));}break;case _0xf614('0x5c'):if(_0x734d66[_0xf614('0x5d')]===_0xf614('0x5e')){if(_0x734d66[_0xf614('0x58')][_0xf614('0x2d')]('\x20')[_0xf614('0x38')]>0x1){_0x3b5f46[_0x2c9675](_0xf614('0x5f'),qs[_0xf614('0x60')](_0x734d66['value']),null);}else{var _0x1a94e4='%'+_0x734d66[_0xf614('0x58')]+'%';_0x3b5f46[_0x2c9675]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x1a94e4,_0x1a94e4,_0x1a94e4);}}else{_0x24bb0f=_['find'](_0x308060,[_0xf614('0x28'),_0xf614('0x61')]);_0x734d66[_0xf614('0x40')]=_0xf614('0x61');_0x1535cc=as[_0xf614('0x62')](_0x403635,_0x24bb0f[_0xf614('0x63')],_0x734d66);_0x3b5f46[_0x2c9675](_0x1535cc[_0xf614('0x64')],_0x1535cc[_0xf614('0x58')][_0xf614('0x65')],_0x1535cc[_0xf614('0x58')][_0xf614('0x1b')]);}break;case'Tag':var _0x45eea4=_0x734d66[_0xf614('0x58')]['split'](',')['map'](function(_0x34c4b0){return Number(_0x34c4b0);});_0x45eea4[_0xf614('0x2e')](function(_0x28f049){_0x475932['or'](_0xf614('0x66'),'%,'+_0x28f049+',%');});_0x52b18e=_[_0xf614('0x67')](_0x52b18e,_0x45eea4);break;case _0xf614('0x68'):if(_0x734d66[_0xf614('0x5d')]===_0xf614('0x5e')){_0x3b5f46[_0x2c9675]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x734d66[_0xf614('0x58')]+'%',null);}else{_0x24bb0f=_[_0xf614('0x56')](_0x308060,['name','UserId']);_0x734d66['field']='UserId';_0x1535cc=as['buildExpression'](_0x403635,_0x24bb0f[_0xf614('0x63')],_0x734d66);_0x3b5f46[_0x2c9675](_0x1535cc['text'],_0x1535cc['value'][_0xf614('0x65')],_0x1535cc['value'][_0xf614('0x1b')]);}break;case _0xf614('0x69'):_0x1535cc=as[_0xf614('0x62')]('me',null,_0x734d66);_0x3b5f46[_0x2c9675](_0x1535cc[_0xf614('0x64')],_0x1535cc['value'][_0xf614('0x65')],_0x1535cc['value'][_0xf614('0x1b')]);break;}}else{var _0x1535cc=as[_0xf614('0x62')](_0x403635,_0x24bb0f['type'],_0x734d66);_0x3b5f46[_0x2c9675](_0x1535cc['text'],_0x1535cc['value'][_0xf614('0x65')],_0x1535cc[_0xf614('0x58')][_0xf614('0x1b')]);}}}else{var _0x494c1c=_(_0x44c0a6[_0xf614('0x34')])[_0xf614('0x6a')]()['map'](function(_0x24a307){return _[_0xf614('0x6b')](_0x308060,[_0xf614('0x28'),_0x24a307])?_0x24a307:undefined;})['compact']()[_0xf614('0x58')]();if(!_[_0xf614('0x6c')](_0x494c1c)){_0x494c1c[_0xf614('0x2e')](function(_0x419ff8){if(_0x419ff8===_0xf614('0x6d')){_0x221593[_0xf614('0x3e')](_0xf614('0x6e'),[][_0xf614('0x6f')](_0x44c0a6[_0xf614('0x34')][_0x419ff8]));}else if(_0x419ff8===_0xf614('0x70')){var _0x252b29=JSON['parse'](_0x44c0a6[_0xf614('0x34')][_0x419ff8])[_0xf614('0x71')];var _0x1a0928=JSON[_0xf614('0x72')](_0x44c0a6[_0xf614('0x34')][_0x419ff8])[_0xf614('0x73')];_0x221593[_0xf614('0x3e')](_0xf614('0x74'),_0x252b29,_0x1a0928);}else{if(_0x44c0a6['query'][_0x419ff8]===_0xf614('0x75')){_0x221593[_0xf614('0x3e')]('i.'+_0x419ff8+_0xf614('0x76'));}else{_0x221593[_0xf614('0x3e')]('i.'+_0x419ff8+_0xf614('0x77'),_0x44c0a6[_0xf614('0x34')][_0x419ff8]);}}});}if(_0x44c0a6[_0xf614('0x34')][_0xf614('0x78')]){if(_0x44c0a6[_0xf614('0x34')]['read']==0x1){_0x221593[_0xf614('0x5a')](_0xf614('0x79'));}else{_0x221593[_0xf614('0x5a')]('`unreadMessages`\x20>\x200');}}if(_0x44c0a6[_0xf614('0x34')][_0xf614('0x7a')]){_0x52b18e=_[_0xf614('0x7b')](_0x44c0a6[_0xf614('0x34')][_0xf614('0x7a')])?_0x44c0a6[_0xf614('0x34')][_0xf614('0x7a')]:new Array(_0x44c0a6[_0xf614('0x34')][_0xf614('0x7a')]);_0x52b18e[_0xf614('0x2e')](function(_0x462ee5){_0x475932['or'](_0xf614('0x66'),'%,'+_0x462ee5+',%');});}if(_0x44c0a6[_0xf614('0x34')][_0xf614('0x7c')]){var _0x286089=_0x44c0a6['query'][_0xf614('0x7c')]['replace']('\x5c','\x5c\x5c')[_0xf614('0x7d')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0xf614('0x7e')](_0x286089)){_0x3b5f46['or']('i.id\x20LIKE\x20?',_0x286089+'%');}else{_0x3b5f46['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xf614('0x60')](_0x286089))['or'](_0xf614('0x7f'),_0x286089+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x286089+'%');}}}_0x221593[_0xf614('0x3e')](_0x3b5f46);_0x221593[_0xf614('0x80')]('i.id');var _0x5eb3f0={'type':db[_0xf614('0x81')][_0xf614('0x82')][_0xf614('0x83')],'raw':!![]};var _0x13a6e8=_0x221593[_0xf614('0x84')]();_0x13a6e8[_0xf614('0x40')](_0xf614('0x85'));_0x13a6e8['field'](_0xf614('0x86'),_0xf614('0x57'));if(_0x46b757[_0xf614('0x3c')]){_0x46b757[_0xf614('0x3c')]['forEach'](function(_0x37953c){_0x221593['order']('i.'+_0x37953c[0x0],_0x37953c[0x1]===_0xf614('0x87')?![]:!![]);});}if(!_[_0xf614('0x6c')](_0x52b18e)){_0x221593[_0xf614('0x5a')](_0x475932);_0x13a6e8[_0xf614('0x3e')](_0xf614('0x88'),_0x52b18e);}BPromise[_0xf614('0x89')]()['then'](function(){if(!_0x2c409a){if(_0x44c0a6['query']['OpenchannelAccountId']||_0x44c0a6[_0xf614('0x34')]['journey'])return;_0x13a6e8[_0xf614('0x3e')](_0xf614('0x8a'));_0x221593[_0xf614('0x3e')](_0xf614('0x8a'));return;}return _0x44c0a6['user'][_0xf614('0x8b')]({'attributes':['id'],'raw':!![]})[_0xf614('0x25')](function(_0x5c8b4c){if(_[_0xf614('0x6c')](_0x5c8b4c)){_0x13a6e8['where']('i.OpenchannelAccountId\x20IS\x20NULL');_0x221593[_0xf614('0x3e')](_0xf614('0x8c'));}else{_0x13a6e8[_0xf614('0x3e')](_0xf614('0x6e'),_[_0xf614('0x2a')](_0x5c8b4c,'id'));_0x221593[_0xf614('0x3e')](_0xf614('0x6e'),_[_0xf614('0x2a')](_0x5c8b4c,'id'));}});})['then'](function(){db[_0xf614('0x8d')][_0xf614('0x34')](_0x13a6e8[_0xf614('0x8e')](),_0x5eb3f0)[_0xf614('0x25')](function(_0x349218){_0xaf5fa7[_0xf614('0x8f')]=_0x349218[_0xf614('0x38')];if(_0xaf5fa7[_0xf614('0x8f')]===0x0)return[];return db['sequelize'][_0xf614('0x34')](_0x803ca9['toString'](),_0x5eb3f0)[_0xf614('0x25')](function(_0x19eb46){_0xce6f5e=_[_0xf614('0x90')](_0x19eb46,'id');_0x5eb3f0=_['merge'](_0x5eb3f0,{'model':db[_0xf614('0x91')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x44c0a6[_0xf614('0x34')]['fields']){_0x46b757[_0xf614('0x37')]['forEach'](function(_0x411eeb){_0x221593[_0xf614('0x40')]('i.'+_0x411eeb);});}else{_0x221593[_0xf614('0x40')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xf614('0x57'));_0x221593[_0xf614('0x40')](_0xf614('0x92'),'Account.key');_0x221593[_0xf614('0x40')](_0xf614('0x93'),'Account.mandatoryDisposition');_0x221593['field'](_0xf614('0x94'));_0x221593['field'](_0xf614('0x95'),'Contact.firstName');_0x221593['field'](_0xf614('0x96'),_0xf614('0x97'));_0x221593[_0xf614('0x40')](_0xf614('0x98'),_0xf614('0x99'));_0x221593['field'](_0xf614('0x9a'),'Contact.phone');_0x221593[_0xf614('0x40')](_0xf614('0x9b'),_0xf614('0x9c'));_0x221593[_0xf614('0x40')](_0xf614('0x9d'),_0xf614('0x9e'));_0x221593[_0xf614('0x40')](_0xf614('0x9f'),_0xf614('0xa0'));_0x221593['field'](_0xf614('0xa1'),'Owner.internal');_0x221593['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0xf614('0x2c'));}_0x221593['limit'](_0x46b757[_0xf614('0x3b')]);_0x221593[_0xf614('0x1d')](_0x46b757['offset']);return db[_0xf614('0x8d')][_0xf614('0x34')](_0x221593[_0xf614('0x8e')](),_0x5eb3f0);})[_0xf614('0x25')](function(_0x5afe87){_0x9073b8[_0xf614('0x3e')](_0xf614('0xa2'),_[_0xf614('0x2a')](_0x5afe87,'id'));return db[_0xf614('0x8d')][_0xf614('0x34')](_0x9073b8['toString'](),_0x5eb3f0)[_0xf614('0x25')](function(_0x4e3e79){var _0x2ed0be=_['groupBy'](_0x4e3e79,'OpenchannelInteractionId');var _0x204141=[];_0x5afe87[_0xf614('0x2e')](function(_0x2e9cca){_0x204141['push'](updateOpenchannelInteraction(_0x2e9cca,_0xce6f5e,_0x2ed0be));});return BPromise[_0xf614('0xa3')](_0x204141);});});})['then'](function(_0x40716a){_0xaf5fa7[_0xf614('0xa4')]=_0x40716a;return _0xaf5fa7;})['then'](respondWithFilteredResult(_0xf31848,_0x46b757));})[_0xf614('0x2f')](handleError(_0xf31848,null));};exports[_0xf614('0xa5')]=function(_0x1d0c92,_0x54a55b){var _0x54fc7f={'raw':![],'where':{'id':_0x1d0c92['params']['id']}},_0x78ec6c={};_0x78ec6c[_0xf614('0x33')]=_['keys'](db[_0xf614('0x91')]['rawAttributes']);_0x78ec6c[_0xf614('0x34')]=_[_0xf614('0x6a')](_0x1d0c92[_0xf614('0x34')]);_0x78ec6c[_0xf614('0x35')]=_[_0xf614('0x36')](_0x78ec6c['model'],_0x78ec6c[_0xf614('0x34')]);_0x54fc7f['attributes']=_[_0xf614('0x36')](_0x78ec6c[_0xf614('0x33')],qs[_0xf614('0xa6')](_0x1d0c92[_0xf614('0x34')][_0xf614('0xa6')]));_0x54fc7f[_0xf614('0x37')]=_0x54fc7f['attributes'][_0xf614('0x38')]?_0x54fc7f['attributes']:_0x78ec6c[_0xf614('0x33')];if(_0x1d0c92[_0xf614('0x34')][_0xf614('0xa7')]){_0x54fc7f[_0xf614('0xa8')]=[{'all':!![]}];}_0x54fc7f=_[_0xf614('0xa9')]({},_0x54fc7f,_0x1d0c92['options']);return db[_0xf614('0x91')]['find'](_0x54fc7f)[_0xf614('0x25')](handleEntityNotFound(_0x54a55b,null))['then'](respondWithResult(_0x54a55b,null))['catch'](handleError(_0x54a55b,null));};exports[_0xf614('0xaa')]=function(_0x55bcc3,_0x8fb17a){return db[_0xf614('0x91')]['create'](_0x55bcc3['body'],{})[_0xf614('0x25')](respondWithResult(_0x8fb17a,0xc9))[_0xf614('0x2f')](handleError(_0x8fb17a,null));};exports[_0xf614('0x23')]=function(_0x25ad8a,_0x5d688f){if(_0x25ad8a['body']['id']){delete _0x25ad8a[_0xf614('0x69')]['id'];}return db[_0xf614('0x91')][_0xf614('0x56')]({'where':{'id':_0x25ad8a['params']['id']}})[_0xf614('0x25')](handleEntityNotFound(_0x5d688f,null))['then'](saveUpdates(_0x25ad8a[_0xf614('0x69')],null))[_0xf614('0x25')](respondWithResult(_0x5d688f,null))[_0xf614('0x2f')](handleError(_0x5d688f,null));};exports['destroy']=function(_0x2e8428,_0x59c809){return db['OpenchannelInteraction']['find']({'where':{'id':_0x2e8428[_0xf614('0xab')]['id']}})[_0xf614('0x25')](handleEntityNotFound(_0x59c809,null))['then'](removeEntity(_0x59c809,null))[_0xf614('0x2f')](handleError(_0x59c809,null));};exports[_0xf614('0xac')]=function(_0x568bd0,_0x11a881){return db[_0xf614('0x91')][_0xf614('0xac')]()['then'](respondWithResult(_0x11a881,null))['catch'](handleError(_0x11a881,null));};exports['addMessage']=function(_0x5a887c,_0x4dba6b,_0x54ad91){return db[_0xf614('0xad')][_0xf614('0x56')]({'where':{'id':_0x5a887c[_0xf614('0xab')]['id']}})['then'](handleEntityNotFound(_0x4dba6b,null))[_0xf614('0x25')](function(_0x5f0040){if(_0x5f0040){return _0x5f0040[_0xf614('0xae')](_0x5a887c[_0xf614('0x69')][_0xf614('0xaf')],_[_0xf614('0xb0')](_0x5a887c[_0xf614('0x69')],[_0xf614('0xaf'),'id'])||{});}})[_0xf614('0x25')](respondWithResult(_0x4dba6b,null))[_0xf614('0x2f')](handleError(_0x4dba6b,null));};exports[_0xf614('0xb1')]=function(_0x140b05,_0x201c88,_0x14b668){var _0x35a5da={'raw':![],'where':{}};var _0x4332a0={};var _0x250bec={'count':0x0,'rows':[]};return db[_0xf614('0x91')][_0xf614('0xb2')]({'where':{'id':_0x140b05[_0xf614('0xab')]['id']}})[_0xf614('0x25')](handleEntityNotFound(_0x201c88,null))[_0xf614('0x25')](function(_0x328a7e){if(_0x328a7e){_0x4332a0[_0xf614('0x33')]=_['keys'](db[_0xf614('0xad')][_0xf614('0x31')]);_0x4332a0['query']=_[_0xf614('0x6a')](_0x140b05[_0xf614('0x34')]);_0x4332a0[_0xf614('0x35')]=_[_0xf614('0x36')](_0x4332a0['model'],_0x4332a0[_0xf614('0x34')]);_0x35a5da[_0xf614('0x37')]=_['intersection'](_0x4332a0[_0xf614('0x33')],qs['fields'](_0x140b05[_0xf614('0x34')][_0xf614('0xa6')]));_0x35a5da[_0xf614('0x37')]=_0x35a5da[_0xf614('0x37')][_0xf614('0x38')]?_0x35a5da[_0xf614('0x37')]:_0x4332a0['model'];if(!_0x140b05['query'][_0xf614('0x39')](_0xf614('0x3a'))){_0x35a5da['limit']=qs[_0xf614('0x3b')](_0x140b05[_0xf614('0x34')][_0xf614('0x3b')]);_0x35a5da[_0xf614('0x1d')]=qs['offset'](_0x140b05[_0xf614('0x34')][_0xf614('0x1d')]);}_0x35a5da[_0xf614('0x3c')]=qs['sort'](_0x140b05[_0xf614('0x34')][_0xf614('0x3d')]);_0x35a5da['where']=qs[_0xf614('0x35')](_[_0xf614('0x3f')](_0x140b05[_0xf614('0x34')],_0x4332a0[_0xf614('0x35')]));_0x35a5da[_0xf614('0x3e')]['OpenchannelInteractionId']=_0x328a7e['id'];if(_0x140b05[_0xf614('0x34')]['filter']){_0x35a5da[_0xf614('0x3e')]=_[_0xf614('0xa9')](_0x35a5da[_0xf614('0x3e')],{'$or':_[_0xf614('0x2a')](_0x35a5da[_0xf614('0x37')],function(_0x545f29){var _0xa93d0a={};_0xa93d0a[_0x545f29]={'$like':'%'+_0x140b05[_0xf614('0x34')]['filter']+'%'};return _0xa93d0a;})});}if(_0x140b05[_0xf614('0x34')][_0xf614('0x71')]){var _0x2e8f99=_0x140b05[_0xf614('0x34')][_0xf614('0x71')]['split'](',');var _0x342113={};_0x342113[_0x2e8f99[0x0]]={'$gte':moment(_0x2e8f99[0x1])[_0xf614('0xb3')](_0xf614('0xb4'))};_0x35a5da[_0xf614('0x3e')]=_[_0xf614('0xa9')](_0x35a5da[_0xf614('0x3e')],_0x342113);}_0x35a5da=_[_0xf614('0xa9')]({},_0x35a5da,_0x140b05[_0xf614('0xb5')]);return db[_0xf614('0xad')]['count']({'where':_0x35a5da[_0xf614('0x3e')]})[_0xf614('0x25')](function(_0x16786d){_0x250bec['count']=_0x16786d;if(_0x140b05[_0xf614('0x34')][_0xf614('0xa7')]){_0x35a5da[_0xf614('0xa8')]=[{'all':!![]}];}return db[_0xf614('0xad')][_0xf614('0xb6')](_0x35a5da);})['then'](function(_0x487625){_0x250bec[_0xf614('0xa4')]=_0x487625;return _0x250bec;});}})[_0xf614('0x25')](respondWithFilteredResult(_0x201c88,_0x35a5da))[_0xf614('0x2f')](handleError(_0x201c88,null));};exports[_0xf614('0xb7')]=function(_0xb5f8da,_0x18988d,_0x315b07){return db[_0xf614('0x91')][_0xf614('0x56')]({'where':{'id':_0xb5f8da[_0xf614('0xab')]['id']}})['then'](handleEntityNotFound(_0x18988d,null))[_0xf614('0x25')](function(_0x4eec41){if(_0x4eec41){return _0x4eec41[_0xf614('0xb8')](_0xb5f8da[_0xf614('0x69')][_0xf614('0xaf')],_['omit'](_0xb5f8da[_0xf614('0x69')],[_0xf614('0xaf'),'id'])||{})[_0xf614('0xb9')](function(){return db[_0xf614('0xba')][_0xf614('0xb6')]({'attributes':['id',_0xf614('0x28'),_0xf614('0x41')],'where':{'id':_0xb5f8da[_0xf614('0x69')]['ids']}});})[_0xf614('0x25')](function(_0x3527ea){socket['emit'](_0xf614('0xbb'),{'id':Number(_0xb5f8da[_0xf614('0xab')]['id']),'tags':_0x3527ea||[]});return{'id':Number(_0xb5f8da[_0xf614('0xab')]['id']),'tags':_0x3527ea||[]};});}})[_0xf614('0x25')](respondWithResult(_0x18988d,null))[_0xf614('0x2f')](handleError(_0x18988d,null));};exports[_0xf614('0xbc')]=function(_0x55512a,_0x1c1087,_0x2b90eb){return db[_0xf614('0x91')][_0xf614('0x56')]({'where':{'id':_0x55512a[_0xf614('0xab')]['id']}})[_0xf614('0x25')](handleEntityNotFound(_0x1c1087,null))[_0xf614('0x25')](function(_0x14d4a8){if(_0x14d4a8){return _0x14d4a8[_0xf614('0xbc')](_0x55512a[_0xf614('0x34')][_0xf614('0xaf')]);}})[_0xf614('0x25')](respondWithStatusCode(_0x1c1087,null))[_0xf614('0x2f')](handleError(_0x1c1087,null));};exports[_0xf614('0xbd')]=function(_0x101692,_0x47362f){var _0x392d77=moment()[_0xf614('0xbe')]()[_0xf614('0x8e')]();var _0xbad9bf=path[_0xf614('0xbf')](config[_0xf614('0xc0')],_0xf614('0xc1'),_0xf614('0xc2'),_0xf614('0xc3'));var _0x3498ad=path['join'](config[_0xf614('0xc0')],_0xf614('0xc1'),'files',_0xf614('0xc4'));var _0x3ee00b=path['join'](_0xbad9bf,_0x392d77);var _0x54c351=util[_0xf614('0xb3')](_0xf614('0xc5'),_0x101692['params']['id'],_0x392d77);var _0x53d9e4=path['join'](_0xbad9bf,_0x54c351);var _0x13900a=[];_0x13900a[_0xf614('0xc6')]({'model':db[_0xf614('0x68')],'as':_0xf614('0x68'),'attributes':['id','fullname'],'raw':!![]});_0x13900a[_0xf614('0xc6')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0xf614('0xc7'),_0xf614('0xc8')],'raw':!![]});if(_0x101692[_0xf614('0x34')][_0xf614('0xc4')]){_0x13900a[_0xf614('0xc6')]({'model':db[_0xf614('0xc9')],'as':_0xf614('0xc9'),'raw':!![]});}var _0xc8ed96=[{'model':db['OpenchannelMessage'],'as':_0xf614('0xca'),'attributes':['id','body',_0xf614('0x70'),_0xf614('0xcb'),_0xf614('0xcc'),'read'],'include':_0x13900a}];_0xc8ed96[_0xf614('0xc6')]({'model':db[_0xf614('0xcd')],'as':'Account','attributes':['id',_0xf614('0x28')]});_0xc8ed96[_0xf614('0xc6')]({'model':db[_0xf614('0x68')],'as':'Owner','attributes':['id',_0xf614('0x2b')]});return db['OpenchannelInteraction'][_0xf614('0x56')]({'where':{'id':_0x101692[_0xf614('0xab')]['id']},'include':_0xc8ed96})[_0xf614('0x25')](handleEntityNotFound(_0x47362f,null))[_0xf614('0x25')](function(_0xabdfe0){if(_0xabdfe0){var _0x1bd46a=_0xabdfe0['get']({'plain':!![]});fs[_0xf614('0xce')](_0x3ee00b);var _0x3d6f9b={'format':'A4','border':'10px','header':{'height':_0xf614('0xcf'),'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':_0xf614('0xd0'),'contents':{'default':util[_0xf614('0xb3')](_0xf614('0xd1'),util[_0xf614('0xb3')]('%s\x20#%d','Openchannel',_0x1bd46a['id']),moment()[_0xf614('0xb3')](_0xf614('0xd2'))[_0xf614('0x8e')]())}}};var _0x45d464={'channel':'Openchannel','account':_0x1bd46a[_0xf614('0xd3')][_0xf614('0x28')],'agent':_0x1bd46a['Owner']?_0x1bd46a['Owner']['fullname']:'N.A.','createdAt':moment(_0x1bd46a[_0xf614('0x70')])[_0xf614('0xb3')]('YYYY-MM-DD\x20HH:mm:ss')[_0xf614('0x8e')](),'closedAt':_0x1bd46a[_0xf614('0xd4')]?moment(_0x1bd46a['closedAt'])[_0xf614('0xb3')](_0xf614('0xb4'))[_0xf614('0x8e')]():'','disposition':_0x1bd46a[_0xf614('0xd5')],'visibility':_0x1bd46a[_0xf614('0xd6')]?_0xf614('0xd7'):_0xf614('0xd8'),'messages':_(_0x1bd46a[_0xf614('0xca')])[_0xf614('0x7c')]({'secret':![]})[_0xf614('0x2a')](function(_0x51c68f){if(_0x51c68f['Attachment']){var _0x1cc606=path['join'](_0x3498ad,_0x51c68f[_0xf614('0xc9')][_0xf614('0xd9')]);if(fs[_0xf614('0xda')](_0x1cc606)){fs['createReadStream'](_0x1cc606)['pipe'](fs[_0xf614('0xdb')](path[_0xf614('0xbf')](_0x3ee00b,_0x51c68f[_0xf614('0xc9')][_0xf614('0xd9')])));}}return{'date':moment(_0x51c68f[_0xf614('0x70')])[_0xf614('0xb3')](_0xf614('0xb4'))[_0xf614('0x8e')](),'sender':_0x51c68f[_0xf614('0xcb')]==='out'?_0x51c68f[_0xf614('0x68')]?_0x51c68f[_0xf614('0x68')][_0xf614('0x2b')]:_0xf614('0xdc'):_0x51c68f['Contact'][_0xf614('0xc7')]+(_0x51c68f[_0xf614('0x5c')]['lastName']?'\x20'+_0x51c68f[_0xf614('0x5c')]['lastName']:''),'body':_0x51c68f[_0xf614('0xc9')]?_0x51c68f[_0xf614('0xc9')][_0xf614('0xd9')]:_0x51c68f[_0xf614('0x69')],'direction':_0x51c68f[_0xf614('0xcb')]===_0xf614('0xdd')?'A':'C','secret':_0x51c68f[_0xf614('0xcc')],'read':_0x51c68f[_0xf614('0x78')],'attachment':_0x51c68f['Attachment']};})[_0xf614('0x58')]()};return ejs[_0xf614('0xde')](path['join'](config[_0xf614('0xc0')],_0xf614('0xc1'),_0xf614('0xdf'),_0xf614('0xe0')),{'interaction':_0x45d464})[_0xf614('0x25')](function(_0x2f98a2){return new BPromise(function(_0x364915,_0x117f61){pdf[_0xf614('0xaa')](_0x2f98a2,_0x3d6f9b)[_0xf614('0xe1')](path[_0xf614('0xbf')](_0x3ee00b,'transcript-'+_0x1bd46a['id']+'-'+_0x392d77+_0xf614('0xe2')),function(_0x3b1a09,_0x42ecb0){if(_0x3b1a09)return _0x117f61(_0x3b1a09);_0x364915(_0x42ecb0);});});})[_0xf614('0x25')](function(){return new BPromise(function(_0x20d930,_0xd30cae){zipdir(_0x3ee00b,{'saveTo':_0x53d9e4},function(_0x493321,_0xc6306){if(_0x493321)return _0xd30cae(_0x493321);return _0x20d930(_0xc6306);});})['then'](function(){return new BPromise(function(_0x4c5430,_0x27b9e3){rimraf(_0x3ee00b,function(_0xee41dc){if(_0xee41dc)_0x27b9e3(_0xee41dc);return _0x4c5430();});});})[_0xf614('0x25')](function(){return _0x47362f[_0xf614('0xbd')](_0x53d9e4,_0x54c351,function(_0x21c93b){if(_0x21c93b){console[_0xf614('0xe3')](_0xf614('0xe4'),_0x21c93b);}else{fs['unlinkSync'](_0x53d9e4);}});});});}else{return _0x47362f[_0xf614('0x1a')](0xc8);}})[_0xf614('0x2f')](handleError(_0x47362f,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 6a0263e..c82c0c3 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 _0xbbc4=['map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','setMaxListeners','save','update','getUsers','then','setDataValue','Users'];(function(_0x316e2b,_0x40efd7){var _0x2e4809=function(_0x145130){while(--_0x145130){_0x316e2b['push'](_0x316e2b['shift']());}};_0x2e4809(++_0x40efd7);}(_0xbbc4,0x139));var _0x4bbc=function(_0x2a3382,_0x3ed2e4){_0x2a3382=_0x2a3382-0x0;var _0x507f4a=_0xbbc4[_0x2a3382];return _0x507f4a;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require('../../mysqldb')['db']['OpenchannelInteraction'];var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x4bbc('0x0')](0x0);var events={'afterCreate':_0x4bbc('0x1'),'afterUpdate':_0x4bbc('0x2'),'afterDestroy':'remove'};function emitEvent(_0x18317f){return function(_0x5ce1df,_0x975e9c,_0x20c5ae){_0x5ce1df[_0x4bbc('0x3')]({'attributes':['id'],'raw':!![]})[_0x4bbc('0x4')](function(_0x3a9918){_0x5ce1df[_0x4bbc('0x5')](_0x4bbc('0x6'),_0x3a9918[_0x4bbc('0x7')](function(_0x363e7b){return{'id':_0x363e7b['id']};}));return OpenchannelMessage[_0x4bbc('0x8')]({'where':{'OpenchannelInteractionId':_0x5ce1df['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4bbc('0x4')](function(_0x456a3){_0x5ce1df[_0x4bbc('0x5')](_0x4bbc('0x9'),_0x456a3[_0x4bbc('0xa')]);OpenchannelInteractionEvents[_0x4bbc('0xb')](_0x18317f+':'+_0x5ce1df['id'],_0x5ce1df);OpenchannelInteractionEvents[_0x4bbc('0xb')](_0x18317f,_0x5ce1df);_0x20c5ae(null);})[_0x4bbc('0xc')](_0x20c5ae(null));};}for(var e in events){if(events[_0x4bbc('0xd')](e)){var event=events[e];OpenchannelInteraction[_0x4bbc('0xe')](e,emitEvent(event));}}module[_0x4bbc('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x4675=['Users','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','getUsers','then','setDataValue'];(function(_0x2beff4,_0x3e5f84){var _0x402c9f=function(_0x434231){while(--_0x434231){_0x2beff4['push'](_0x2beff4['shift']());}};_0x402c9f(++_0x3e5f84);}(_0x4675,0x141));var _0x5467=function(_0x52d73c,_0x5ce553){_0x52d73c=_0x52d73c-0x0;var _0x506cf7=_0x4675[_0x52d73c];return _0x506cf7;};'use strict';var EventEmitter=require(_0x5467('0x0'));var OpenchannelInteraction=require(_0x5467('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x5467('0x2')](0x0);var events={'afterCreate':_0x5467('0x3'),'afterUpdate':_0x5467('0x4'),'afterDestroy':_0x5467('0x5')};function emitEvent(_0x550353){return function(_0xcc2e3c,_0x1a02db,_0x3bd694){_0xcc2e3c[_0x5467('0x6')]({'attributes':['id'],'raw':!![]})[_0x5467('0x7')](function(_0x21e548){_0xcc2e3c[_0x5467('0x8')](_0x5467('0x9'),_0x21e548['map'](function(_0x5390d3){return{'id':_0x5390d3['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0xcc2e3c['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5467('0x7')](function(_0x4f9d26){_0xcc2e3c[_0x5467('0x8')]('unreadMessages',_0x4f9d26['length']);OpenchannelInteractionEvents[_0x5467('0xa')](_0x550353+':'+_0xcc2e3c['id'],_0xcc2e3c);OpenchannelInteractionEvents[_0x5467('0xa')](_0x550353,_0xcc2e3c);_0x3bd694(null);})[_0x5467('0xb')](_0x3bd694(null));};}for(var e in events){if(events[_0x5467('0xc')](e)){var event=events[e];OpenchannelInteraction[_0x5467('0xd')](e,emitEvent(event));}}module[_0x5467('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 64d1ca2..ce9040b 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 _0xf494=['request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird'];(function(_0x752005,_0x14dc74){var _0x40629c=function(_0x189e3d){while(--_0x189e3d){_0x752005['push'](_0x752005['shift']());}};_0x40629c(++_0x14dc74);}(_0xf494,0x1c6));var _0x4f49=function(_0xd78d44,_0x508879){_0xd78d44=_0xd78d44-0x0;var _0x373342=_0xf494[_0xd78d44];return _0x373342;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('OpenchannelInteraction',attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x169c95,_0x327bd5,_0x31a725){if(_0x169c95[_0x4f49('0xc')](_0x4f49('0xd'))){_0x169c95[_0x4f49('0xe')]=moment()[_0x4f49('0xf')](_0x4f49('0x10'));}_0x31a725(null,_0x169c95);}}});}; \ No newline at end of file +var _0xf69d=['request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment'];(function(_0x1259e9,_0x11d4a5){var _0x55e926=function(_0x27cbdd){while(--_0x27cbdd){_0x1259e9['push'](_0x1259e9['shift']());}};_0x55e926(++_0x11d4a5);}(_0xf69d,0xd3));var _0xdf69=function(_0x360f8e,_0x56871a){_0x360f8e=_0x360f8e-0x0;var _0xf23bd3=_0xf69d[_0x360f8e];return _0xf23bd3;};'use strict';var _=require(_0xdf69('0x0'));var util=require(_0xdf69('0x1'));var logger=require(_0xdf69('0x2'))(_0xdf69('0x3'));var moment=require(_0xdf69('0x4'));var BPromise=require('bluebird');var rp=require(_0xdf69('0x5'));var fs=require('fs');var path=require(_0xdf69('0x6'));var rimraf=require(_0xdf69('0x7'));var config=require(_0xdf69('0x8'));var attributes=require(_0xdf69('0x9'));module[_0xdf69('0xa')]=function(_0x2d456f,_0x465b1b){return _0x2d456f[_0xdf69('0xb')](_0xdf69('0xc'),attributes,{'tableName':_0xdf69('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xc1b77e,_0x38909e,_0x466c26){if(_0xc1b77e[_0xdf69('0xe')](_0xdf69('0xf'))){_0xc1b77e[_0xdf69('0x10')]=moment()['format'](_0xdf69('0x11'));}_0x466c26(null,_0xc1b77e);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 4f97b13..7aa42d4 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 _0x43f0=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','./openchannelInteraction.socket','register','request','info','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','OpenchannelInteraction,\x20%s,\x20%s','catch','UpdateOpenchannelInteraction','update','raw','options','where','then','stringify','AddTagsToOpenchannelInteraction','OpenchannelInteraction','ids','omit','body','spread','AddTags','lodash'];(function(_0x1ded13,_0x575e99){var _0x4f12d9=function(_0x53c6b5){while(--_0x53c6b5){_0x1ded13['push'](_0x1ded13['shift']());}};_0x4f12d9(++_0x575e99);}(_0x43f0,0x110));var _0x043f=function(_0xad7541,_0x2c3714){_0xad7541=_0xad7541-0x0;var _0x488e1b=_0x43f0[_0xad7541];return _0x488e1b;};'use strict';var _=require(_0x043f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x043f('0x1'));var rs=require(_0x043f('0x2'));var fs=require('fs');var Redis=require(_0x043f('0x3'));var db=require(_0x043f('0x4'))['db'];var utils=require(_0x043f('0x5'));var logger=require(_0x043f('0x6'))(_0x043f('0x7'));var config=require(_0x043f('0x8'));var jayson=require(_0x043f('0x9'));var client=jayson[_0x043f('0xa')][_0x043f('0xb')]({'port':0x232a});config[_0x043f('0xc')]=_['defaults'](config[_0x043f('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x043f('0xc')]));require(_0x043f('0xd'))[_0x043f('0xe')](socket);function respondWithRpcPromise(_0x53d338,_0x28fc86,_0x42060c){return new BPromise(function(_0x33b2f4,_0x2ebf24){return client[_0x043f('0xf')](_0x53d338,_0x42060c)['then'](function(_0xb28adb){logger[_0x043f('0x10')]('OpenchannelInteraction,\x20%s,\x20%s',_0x28fc86,_0x043f('0x11'));logger[_0x043f('0x12')](_0x043f('0x13'),_0x28fc86,_0x043f('0x11'),JSON['stringify'](_0xb28adb));if(_0xb28adb['error']){if(_0xb28adb[_0x043f('0x14')][_0x043f('0x15')]===0x1f4){logger[_0x043f('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x28fc86,_0xb28adb['error']['message']);return _0x2ebf24(_0xb28adb[_0x043f('0x14')][_0x043f('0x16')]);}logger[_0x043f('0x14')](_0x043f('0x17'),_0x28fc86,_0xb28adb[_0x043f('0x14')][_0x043f('0x16')]);return _0x33b2f4(_0xb28adb[_0x043f('0x14')][_0x043f('0x16')]);}else{logger[_0x043f('0x10')](_0x043f('0x17'),_0x28fc86,_0x043f('0x11'));_0x33b2f4(_0xb28adb['result'][_0x043f('0x16')]);}})[_0x043f('0x18')](function(_0x54b302){logger[_0x043f('0x14')](_0x043f('0x17'),_0x28fc86,_0x54b302);_0x2ebf24(_0x54b302);});});}exports[_0x043f('0x19')]=function(_0xce87ac){var _0x1ad1a5=this;return new Promise(function(_0x194337,_0x47bff1){return db['OpenchannelInteraction'][_0x043f('0x1a')](_0xce87ac['body'],{'raw':_0xce87ac['options']?_0xce87ac['options'][_0x043f('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xce87ac[_0x043f('0x1c')]?_0xce87ac[_0x043f('0x1c')][_0x043f('0x1d')]||null:null,'attributes':_0xce87ac[_0x043f('0x1c')]?_0xce87ac['options']['attributes']||null:null,'limit':_0xce87ac['options']?_0xce87ac[_0x043f('0x1c')]['limit']||null:null})[_0x043f('0x1e')](function(_0x4f9434){logger[_0x043f('0x10')]('UpdateOpenchannelInteraction',_0xce87ac);logger[_0x043f('0x12')]('UpdateOpenchannelInteraction',_0xce87ac,JSON[_0x043f('0x1f')](_0x4f9434));_0x194337(_0x4f9434);})[_0x043f('0x18')](function(_0x1ce74a){logger[_0x043f('0x14')](_0x043f('0x19'),_0x1ce74a[_0x043f('0x16')],_0xce87ac);_0x47bff1(_0x1ad1a5['error'](0x1f4,_0x1ce74a['message']));});});};exports[_0x043f('0x20')]=function(_0x2f2347){return new Promise(function(_0x585c44,_0x26926f){return db[_0x043f('0x21')]['find']({'where':_0x2f2347[_0x043f('0x1c')]?_0x2f2347[_0x043f('0x1c')][_0x043f('0x1d')]||null:null})[_0x043f('0x1e')](function(_0x3296ac){if(_0x3296ac){return _0x3296ac['addTags'](_0x2f2347['body'][_0x043f('0x22')],_[_0x043f('0x23')](_0x2f2347[_0x043f('0x24')],[_0x043f('0x22'),'id'])||{});}})[_0x043f('0x25')](function(_0x9f3f35){logger['info']('AddTags',_0x2f2347);logger[_0x043f('0x12')](_0x043f('0x26'),_0x2f2347,JSON['stringify'](_0x9f3f35));_0x585c44(_0x9f3f35);})['catch'](function(_0x5422bd){logger['error'](_0x043f('0x26'),_0x5422bd[_0x043f('0x16')],_0x2f2347);_0x26926f(_this['error'](0x1f4,_0x5422bd['message']));});});}; \ No newline at end of file +var _0x89be=['attributes','stringify','AddTagsToOpenchannelInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','./openchannelInteraction.socket','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','raw','where'];(function(_0xd9a87d,_0x1ab290){var _0x23863b=function(_0x422107){while(--_0x422107){_0xd9a87d['push'](_0xd9a87d['shift']());}};_0x23863b(++_0x1ab290);}(_0x89be,0x18d));var _0xe89b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x89be[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xe89b('0x0'));var util=require(_0xe89b('0x1'));var moment=require('moment');var BPromise=require(_0xe89b('0x2'));var rs=require(_0xe89b('0x3'));var fs=require('fs');var Redis=require(_0xe89b('0x4'));var db=require(_0xe89b('0x5'))['db'];var utils=require(_0xe89b('0x6'));var logger=require(_0xe89b('0x7'))(_0xe89b('0x8'));var config=require('../../config/environment');var jayson=require(_0xe89b('0x9'));var client=jayson[_0xe89b('0xa')][_0xe89b('0xb')]({'port':0x232a});config[_0xe89b('0xc')]=_['defaults'](config[_0xe89b('0xc')],{'host':_0xe89b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe89b('0xc')]));require(_0xe89b('0xe'))['register'](socket);function respondWithRpcPromise(_0x303e49,_0x184acf,_0x19132c){return new BPromise(function(_0x117b4b,_0x1c29ad){return client[_0xe89b('0xf')](_0x303e49,_0x19132c)[_0xe89b('0x10')](function(_0x402450){logger[_0xe89b('0x11')](_0xe89b('0x12'),_0x184acf,_0xe89b('0x13'));logger[_0xe89b('0x14')](_0xe89b('0x15'),_0x184acf,_0xe89b('0x13'),JSON['stringify'](_0x402450));if(_0x402450[_0xe89b('0x16')]){if(_0x402450[_0xe89b('0x16')][_0xe89b('0x17')]===0x1f4){logger[_0xe89b('0x16')](_0xe89b('0x12'),_0x184acf,_0x402450[_0xe89b('0x16')][_0xe89b('0x18')]);return _0x1c29ad(_0x402450['error'][_0xe89b('0x18')]);}logger[_0xe89b('0x16')](_0xe89b('0x12'),_0x184acf,_0x402450[_0xe89b('0x16')][_0xe89b('0x18')]);return _0x117b4b(_0x402450['error'][_0xe89b('0x18')]);}else{logger['info'](_0xe89b('0x12'),_0x184acf,_0xe89b('0x13'));_0x117b4b(_0x402450[_0xe89b('0x19')]['message']);}})[_0xe89b('0x1a')](function(_0x67ab41){logger[_0xe89b('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x184acf,_0x67ab41);_0x1c29ad(_0x67ab41);});});}exports[_0xe89b('0x1b')]=function(_0x5a80a8){var _0x54bdac=this;return new Promise(function(_0x3028de,_0x3c51d2){return db[_0xe89b('0x1c')][_0xe89b('0x1d')](_0x5a80a8['body'],{'raw':_0x5a80a8['options']?_0x5a80a8[_0xe89b('0x1e')][_0xe89b('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a80a8['options']?_0x5a80a8[_0xe89b('0x1e')][_0xe89b('0x20')]||null:null,'attributes':_0x5a80a8[_0xe89b('0x1e')]?_0x5a80a8['options'][_0xe89b('0x21')]||null:null,'limit':_0x5a80a8[_0xe89b('0x1e')]?_0x5a80a8['options']['limit']||null:null})[_0xe89b('0x10')](function(_0x180223){logger[_0xe89b('0x11')](_0xe89b('0x1b'),_0x5a80a8);logger['debug'](_0xe89b('0x1b'),_0x5a80a8,JSON[_0xe89b('0x22')](_0x180223));_0x3028de(_0x180223);})[_0xe89b('0x1a')](function(_0xf9b01d){logger['error'](_0xe89b('0x1b'),_0xf9b01d[_0xe89b('0x18')],_0x5a80a8);_0x3c51d2(_0x54bdac[_0xe89b('0x16')](0x1f4,_0xf9b01d[_0xe89b('0x18')]));});});};exports[_0xe89b('0x23')]=function(_0x388d9c){return new Promise(function(_0x2c9249,_0x513b17){return db[_0xe89b('0x1c')][_0xe89b('0x24')]({'where':_0x388d9c[_0xe89b('0x1e')]?_0x388d9c[_0xe89b('0x1e')][_0xe89b('0x20')]||null:null})[_0xe89b('0x10')](function(_0x46c80c){if(_0x46c80c){return _0x46c80c[_0xe89b('0x25')](_0x388d9c[_0xe89b('0x26')][_0xe89b('0x27')],_[_0xe89b('0x28')](_0x388d9c[_0xe89b('0x26')],[_0xe89b('0x27'),'id'])||{});}})[_0xe89b('0x29')](function(_0x77d7a5){logger[_0xe89b('0x11')]('AddTags',_0x388d9c);logger[_0xe89b('0x14')](_0xe89b('0x2a'),_0x388d9c,JSON[_0xe89b('0x22')](_0x77d7a5));_0x2c9249(_0x77d7a5);})[_0xe89b('0x1a')](function(_0x5aa478){logger[_0xe89b('0x16')](_0xe89b('0x2a'),_0x5aa478['message'],_0x388d9c);_0x513b17(_this['error'](0x1f4,_0x5aa478['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 27ad7dd..abc1b31 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 _0x3a65=['save','remove','removeListener','register','length','./openchannelInteraction.events'];(function(_0x6261e0,_0xbe1bce){var _0x58e6b4=function(_0x2d2caa){while(--_0x2d2caa){_0x6261e0['push'](_0x6261e0['shift']());}};_0x58e6b4(++_0xbe1bce);}(_0x3a65,0x155));var _0x53a6=function(_0xa5434,_0x37cddc){_0xa5434=_0xa5434-0x0;var _0x3df2d0=_0x3a65[_0xa5434];return _0x3df2d0;};'use strict';var OpenchannelInteractionEvents=require(_0x53a6('0x0'));var events=[_0x53a6('0x1'),_0x53a6('0x2'),'update'];function createListener(_0xeef894,_0x17d1a6){return function(_0x4db087){_0x17d1a6['emit'](_0xeef894,_0x4db087);};}function removeListener(_0x39eec8,_0x5db043){return function(){OpenchannelInteractionEvents[_0x53a6('0x3')](_0x39eec8,_0x5db043);};}exports[_0x53a6('0x4')]=function(_0x455430){for(var _0x28f7ec=0x0,_0x1d3970=events[_0x53a6('0x5')];_0x28f7ec<_0x1d3970;_0x28f7ec++){var _0x3c5168=events[_0x28f7ec];var _0x1108c0=createListener('openchannelInteraction:'+_0x3c5168,_0x455430);OpenchannelInteractionEvents['on'](_0x3c5168,_0x1108c0);}}; \ No newline at end of file +var _0xc468=['removeListener','register','openchannelInteraction:','./openchannelInteraction.events','update','emit'];(function(_0x18eca4,_0x14cc23){var _0x1bb25f=function(_0x2d2bc3){while(--_0x2d2bc3){_0x18eca4['push'](_0x18eca4['shift']());}};_0x1bb25f(++_0x14cc23);}(_0xc468,0x75));var _0x8c46=function(_0x11988d,_0xf629b8){_0x11988d=_0x11988d-0x0;var _0x34397b=_0xc468[_0x11988d];return _0x34397b;};'use strict';var OpenchannelInteractionEvents=require(_0x8c46('0x0'));var events=['save','remove',_0x8c46('0x1')];function createListener(_0x4c8378,_0x2d934d){return function(_0x38f4b8){_0x2d934d[_0x8c46('0x2')](_0x4c8378,_0x38f4b8);};}function removeListener(_0x2c01e1,_0x37c735){return function(){OpenchannelInteractionEvents[_0x8c46('0x3')](_0x2c01e1,_0x37c735);};}exports[_0x8c46('0x4')]=function(_0x1d79d6){for(var _0x419580=0x0,_0x374ff5=events['length'];_0x419580<_0x374ff5;_0x419580++){var _0xec46c5=events[_0x419580];var _0x585b87=createListener(_0x8c46('0x5')+_0xec46c5,_0x1d79d6);OpenchannelInteractionEvents['on'](_0xec46c5,_0x585b87);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index b6adc6e..e9cf18c 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 _0x246f=['../../components/interaction/service','./openchannelMessage.controller','isAuthenticated','get','/describe','describe','show','post','tracked','openchannel','openchannelmessage:create','create','put','/:id','update','accept','reject','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x51a3cc,_0x16a5ef){var _0x151fc=function(_0x1498a2){while(--_0x1498a2){_0x51a3cc['push'](_0x51a3cc['shift']());}};_0x151fc(++_0x16a5ef);}(_0x246f,0x1b4));var _0xf246=function(_0x29e100,_0x4d7a2d){_0x29e100=_0x29e100-0x0;var _0x5cbc6c=_0x246f[_0x29e100];return _0x5cbc6c;};'use strict';var multer=require(_0xf246('0x0'));var util=require('util');var path=require(_0xf246('0x1'));var timeout=require(_0xf246('0x2'));var express=require(_0xf246('0x3'));var router=express[_0xf246('0x4')]();var auth=require(_0xf246('0x5'));var interaction=require(_0xf246('0x6'));var config=require('../../config/environment');var controller=require(_0xf246('0x7'));router['get']('/',auth[_0xf246('0x8')](),controller['index']);router[_0xf246('0x9')](_0xf246('0xa'),auth[_0xf246('0x8')](),controller[_0xf246('0xb')]);router[_0xf246('0x9')]('/:id',auth[_0xf246('0x8')](),controller[_0xf246('0xc')]);router[_0xf246('0xd')]('/',auth[_0xf246('0x8')](),interaction[_0xf246('0xe')](_0xf246('0xf'),_0xf246('0x10')),controller[_0xf246('0x11')]);router[_0xf246('0x12')](_0xf246('0x13'),auth[_0xf246('0x8')](),controller[_0xf246('0x14')]);router[_0xf246('0x12')]('/:id/accept',auth[_0xf246('0x8')](),controller[_0xf246('0x15')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0xf246('0x16')]);router[_0xf246('0x17')]('/:id',auth[_0xf246('0x8')](),controller[_0xf246('0x18')]);module[_0xf246('0x19')]=router; \ No newline at end of file +var _0xadb1=['multer','util','path','connect-timeout','Router','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','describe','/:id','show','tracked','create','put','accept','/:id/reject','reject','delete','destroy'];(function(_0x42fc8e,_0x26620d){var _0x4ad7b5=function(_0x4b217b){while(--_0x4b217b){_0x42fc8e['push'](_0x42fc8e['shift']());}};_0x4ad7b5(++_0x26620d);}(_0xadb1,0x7e));var _0x1adb=function(_0x508222,_0x35a1c8){_0x508222=_0x508222-0x0;var _0x15d49a=_0xadb1[_0x508222];return _0x15d49a;};'use strict';var multer=require(_0x1adb('0x0'));var util=require(_0x1adb('0x1'));var path=require(_0x1adb('0x2'));var timeout=require(_0x1adb('0x3'));var express=require('express');var router=express[_0x1adb('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1adb('0x5'));var controller=require(_0x1adb('0x6'));router[_0x1adb('0x7')]('/',auth[_0x1adb('0x8')](),controller[_0x1adb('0x9')]);router['get']('/describe',auth[_0x1adb('0x8')](),controller[_0x1adb('0xa')]);router[_0x1adb('0x7')](_0x1adb('0xb'),auth['isAuthenticated'](),controller[_0x1adb('0xc')]);router['post']('/',auth[_0x1adb('0x8')](),interaction[_0x1adb('0xd')]('openchannel','openchannelmessage:create'),controller[_0x1adb('0xe')]);router[_0x1adb('0xf')](_0x1adb('0xb'),auth[_0x1adb('0x8')](),controller['update']);router[_0x1adb('0xf')]('/:id/accept',auth[_0x1adb('0x8')](),controller[_0x1adb('0x10')]);router[_0x1adb('0xf')](_0x1adb('0x11'),auth[_0x1adb('0x8')](),controller[_0x1adb('0x12')]);router[_0x1adb('0x13')]('/:id',auth[_0x1adb('0x8')](),controller[_0x1adb('0x14')]);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 2440017..0e6c133 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 _0xe763=['exports','TEXT','BOOLEAN','ENUM','out','DATE'];(function(_0x14a1da,_0x24f2e5){var _0x201fe1=function(_0xc2e852){while(--_0xc2e852){_0x14a1da['push'](_0x14a1da['shift']());}};_0x201fe1(++_0x24f2e5);}(_0xe763,0x16e));var _0x3e76=function(_0x45f6cb,_0x531af6){_0x45f6cb=_0x45f6cb-0x0;var _0x5b7f93=_0xe763[_0x45f6cb];return _0x5b7f93;};'use strict';var Sequelize=require('sequelize');module[_0x3e76('0x0')]={'body':{'type':Sequelize[_0x3e76('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x3e76('0x2')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x3e76('0x3')]('in',_0x3e76('0x4')),'defaultValue':_0x3e76('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x3e76('0x5')]}}; \ No newline at end of file +var _0xcff4=['DATE','sequelize','exports','TEXT','BOOLEAN','out'];(function(_0x47add9,_0x54ac9a){var _0x7cfccc=function(_0x668b61){while(--_0x668b61){_0x47add9['push'](_0x47add9['shift']());}};_0x7cfccc(++_0x54ac9a);}(_0xcff4,0xa9));var _0x4cff=function(_0x18f9cc,_0x3a3fe2){_0x18f9cc=_0x18f9cc-0x0;var _0x149e0b=_0xcff4[_0x18f9cc];return _0x149e0b;};'use strict';var Sequelize=require(_0x4cff('0x0'));module[_0x4cff('0x1')]={'body':{'type':Sequelize[_0x4cff('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x4cff('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x4cff('0x4')),'defaultValue':_0x4cff('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x4cff('0x5')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index d0d8b7e..8d58ff7 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 _0x8ae6=['register','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','OpenchannelMessage,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','stack','name','send','rawAttributes','fieldName','type','key','map','query','intersection','attributes','model','length','order','sort','where','pick','filters','merge','VIRTUAL','options','OpenchannelMessage','includeAll','include','findAll','rows','show','params','keys','fields','create','body','find','describe','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','openchannel-interactions','reject','agent','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','moment','util','path','to-csv','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8ae6,0x155));var _0x68ae=function(_0xfb4ee5,_0x4ab1ae){_0xfb4ee5=_0xfb4ee5-0x0;var _0x522e89=_0x8ae6[_0xfb4ee5];return _0x522e89;};'use strict';var pdf=require(_0x68ae('0x0'));var emlformat=require(_0x68ae('0x1'));var rimraf=require(_0x68ae('0x2'));var zipdir=require(_0x68ae('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x68ae('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x68ae('0x5'));var path=require(_0x68ae('0x6'));var sox=require('sox');var csv=require(_0x68ae('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x68ae('0x8'));var crypto=require('crypto');var jsforce=require(_0x68ae('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x68ae('0x7'));var querystring=require(_0x68ae('0xa'));var Papa=require(_0x68ae('0xb'));var Redis=require(_0x68ae('0xc'));var authService=require(_0x68ae('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x68ae('0xe'));var hardwareService=require(_0x68ae('0xf'));var logger=require(_0x68ae('0x10'))(_0x68ae('0x11'));var utils=require('../../config/utils');var config=require(_0x68ae('0x12'));var db=require(_0x68ae('0x13'))['db'];config[_0x68ae('0x14')]=_[_0x68ae('0x15')](config[_0x68ae('0x14')],{'host':_0x68ae('0x16'),'port':0x18eb});var socket=require(_0x68ae('0x17'))(new Redis(config[_0x68ae('0x14')]));require(_0x68ae('0x18'))[_0x68ae('0x19')](socket);var jayson=require(_0x68ae('0x1a'));var client=jayson[_0x68ae('0x1b')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x23d526,_0x366fd7,_0x384f1c){if(_0x384f1c){var _0x50a0c5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x50a0c5[_0x68ae('0x1c')](_0x366fd7)){return _0x23d526;}else{throw new db[(_0x68ae('0x1d'))][(_0x68ae('0x1e'))](_0x68ae('0x1f'));}}else{return _0x23d526;}}function respondWithRpcPromise(_0x46fc07,_0x2ce1bf,_0x1673a6,_0x30f557){return new BPromise(function(_0x8e65f6,_0x5edf94){var _0x33bf3b=_0x30f557||client;return _0x33bf3b['request'](_0x46fc07,_0x1673a6)[_0x68ae('0x20')](function(_0x4d6e08){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x2ce1bf,_0x68ae('0x21'));logger['debug'](_0x68ae('0x22'),_0x2ce1bf,_0x68ae('0x21'),JSON[_0x68ae('0x23')](_0x4d6e08));if(_0x4d6e08['error']){if(_0x4d6e08['error'][_0x68ae('0x24')]===0x1f4){logger[_0x68ae('0x25')](_0x68ae('0x26'),_0x2ce1bf,_0x4d6e08[_0x68ae('0x25')][_0x68ae('0x27')]);return _0x5edf94(_0x4d6e08[_0x68ae('0x25')][_0x68ae('0x27')]);}logger[_0x68ae('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0x2ce1bf,_0x4d6e08['error']['message']);return _0x8e65f6(_0x4d6e08[_0x68ae('0x25')][_0x68ae('0x27')]);}else{logger[_0x68ae('0x28')](_0x68ae('0x26'),_0x2ce1bf,_0x68ae('0x21'));_0x8e65f6(_0x4d6e08[_0x68ae('0x29')][_0x68ae('0x27')]);}})[_0x68ae('0x2a')](function(_0x42abe2){logger[_0x68ae('0x25')](_0x68ae('0x26'),_0x2ce1bf,_0x42abe2);_0x5edf94(_0x42abe2);});});}function respondWithStatusCode(_0x40ff97,_0x25d793){_0x25d793=_0x25d793||0xcc;return function(_0x57c40b){if(_0x57c40b){return _0x40ff97[_0x68ae('0x2b')](_0x25d793);}return _0x40ff97[_0x68ae('0x2c')](_0x25d793)[_0x68ae('0x2d')]();};}function respondWithResult(_0x2f1c09,_0x51f5ed){_0x51f5ed=_0x51f5ed||0xc8;return function(_0x2d3f5){if(_0x2d3f5){return _0x2f1c09[_0x68ae('0x2c')](_0x51f5ed)[_0x68ae('0x2e')](_0x2d3f5);}};}function respondWithFilteredResult(_0x221378,_0x340137){return function(_0x1bd7b2){if(_0x1bd7b2){var _0x538b5b=_0x1bd7b2[_0x68ae('0x2f')],_0x54deed=_0x340137[_0x68ae('0x30')],_0x5d67c0=_0x340137['offset']+_0x340137[_0x68ae('0x31')],_0x10677c;if(_0x5d67c0>=_0x538b5b){_0x5d67c0=_0x538b5b;_0x10677c=0xc8;}else{_0x10677c=0xce;}_0x221378[_0x68ae('0x2c')](_0x10677c);return _0x221378[_0x68ae('0x32')](_0x68ae('0x33'),_0x54deed+'-'+_0x5d67c0+'/'+_0x538b5b)[_0x68ae('0x2e')](_0x1bd7b2);}return null;};}function patchUpdates(_0x375583){return function(_0x56e34b){try{jsonpatch[_0x68ae('0x34')](_0x56e34b,_0x375583,!![]);}catch(_0x1687c9){return BPromise['reject'](_0x1687c9);}return _0x56e34b[_0x68ae('0x35')]();};}function saveUpdates(_0x2e6c1b,_0x506902){return function(_0x3f64fa){if(_0x3f64fa){return _0x3f64fa[_0x68ae('0x36')](_0x2e6c1b)[_0x68ae('0x20')](function(_0x2d99e6){return _0x2d99e6;});}return null;};}function removeEntity(_0x2874e3,_0x1d62c9){return function(_0x15567a){if(_0x15567a){return _0x15567a['destroy']()[_0x68ae('0x20')](function(){_0x2874e3[_0x68ae('0x2c')](0xcc)[_0x68ae('0x2d')]();});}};}function handleEntityNotFound(_0x3e8d77,_0x16a3d5){return function(_0x453711){if(!_0x453711){_0x3e8d77['sendStatus'](0x194);}return _0x453711;};}function handleError(_0x43903f,_0x372707){_0x372707=_0x372707||0x1f4;return function(_0xc23e3d){logger[_0x68ae('0x25')](_0xc23e3d[_0x68ae('0x37')]);if(_0xc23e3d['name']){delete _0xc23e3d[_0x68ae('0x38')];}_0x43903f[_0x68ae('0x2c')](_0x372707)[_0x68ae('0x39')](_0xc23e3d);};}exports['index']=function(_0x1d7409,_0x514213){var _0x30d120={},_0x69923f={},_0xfd9240={'count':0x0,'rows':[]};var _0x5b607d=_['map'](db['OpenchannelMessage'][_0x68ae('0x3a')],function(_0x33e89b){return{'name':_0x33e89b[_0x68ae('0x3b')],'type':_0x33e89b[_0x68ae('0x3c')][_0x68ae('0x3d')]};});_0x69923f['model']=_[_0x68ae('0x3e')](_0x5b607d,_0x68ae('0x38'));_0x69923f[_0x68ae('0x3f')]=_['keys'](_0x1d7409[_0x68ae('0x3f')]);_0x69923f['filters']=_[_0x68ae('0x40')](_0x69923f['model'],_0x69923f[_0x68ae('0x3f')]);_0x30d120[_0x68ae('0x41')]=_['intersection'](_0x69923f[_0x68ae('0x42')],qs['fields'](_0x1d7409['query']['fields']));_0x30d120[_0x68ae('0x41')]=_0x30d120['attributes'][_0x68ae('0x43')]?_0x30d120[_0x68ae('0x41')]:_0x69923f[_0x68ae('0x42')];if(!_0x1d7409['query']['hasOwnProperty']('nolimit')){_0x30d120[_0x68ae('0x31')]=qs[_0x68ae('0x31')](_0x1d7409[_0x68ae('0x3f')][_0x68ae('0x31')]);_0x30d120['offset']=qs[_0x68ae('0x30')](_0x1d7409[_0x68ae('0x3f')][_0x68ae('0x30')]);}_0x30d120[_0x68ae('0x44')]=qs[_0x68ae('0x45')](_0x1d7409['query'][_0x68ae('0x45')]);_0x30d120[_0x68ae('0x46')]=qs['filters'](_[_0x68ae('0x47')](_0x1d7409[_0x68ae('0x3f')],_0x69923f[_0x68ae('0x48')]));if(_0x1d7409[_0x68ae('0x3f')]['filter']){_0x30d120[_0x68ae('0x46')]=_[_0x68ae('0x49')](_0x30d120[_0x68ae('0x46')],{'$or':_[_0x68ae('0x3e')](_0x5b607d,function(_0x5547ac){if(_0x5547ac[_0x68ae('0x3c')]!==_0x68ae('0x4a')){var _0x171023={};_0x171023[_0x5547ac['name']]={'$like':'%'+_0x1d7409['query']['filter']+'%'};return _0x171023;}})});}_0x30d120=_[_0x68ae('0x49')]({},_0x30d120,_0x1d7409[_0x68ae('0x4b')]);var _0x447836={'where':_0x30d120['where']};return db[_0x68ae('0x4c')][_0x68ae('0x2f')](_0x447836)[_0x68ae('0x20')](function(_0x31d39e){_0xfd9240[_0x68ae('0x2f')]=_0x31d39e;if(_0x1d7409['query'][_0x68ae('0x4d')]){_0x30d120[_0x68ae('0x4e')]=[{'all':!![]}];}return db[_0x68ae('0x4c')][_0x68ae('0x4f')](_0x30d120);})['then'](function(_0xcd2d10){_0xfd9240[_0x68ae('0x50')]=_0xcd2d10;return _0xfd9240;})['then'](respondWithFilteredResult(_0x514213,_0x30d120))[_0x68ae('0x2a')](handleError(_0x514213,null));};exports[_0x68ae('0x51')]=function(_0x2e9c97,_0xa40125){var _0x14abcf={'raw':!![],'where':{'id':_0x2e9c97[_0x68ae('0x52')]['id']}},_0x2cf13c={};_0x2cf13c['model']=_['keys'](db[_0x68ae('0x4c')][_0x68ae('0x3a')]);_0x2cf13c[_0x68ae('0x3f')]=_[_0x68ae('0x53')](_0x2e9c97[_0x68ae('0x3f')]);_0x2cf13c['filters']=_['intersection'](_0x2cf13c[_0x68ae('0x42')],_0x2cf13c[_0x68ae('0x3f')]);_0x14abcf[_0x68ae('0x41')]=_[_0x68ae('0x40')](_0x2cf13c[_0x68ae('0x42')],qs[_0x68ae('0x54')](_0x2e9c97['query'][_0x68ae('0x54')]));_0x14abcf[_0x68ae('0x41')]=_0x14abcf['attributes'][_0x68ae('0x43')]?_0x14abcf[_0x68ae('0x41')]:_0x2cf13c[_0x68ae('0x42')];if(_0x2e9c97[_0x68ae('0x3f')][_0x68ae('0x4d')]){_0x14abcf['include']=[{'all':!![]}];}_0x14abcf=_[_0x68ae('0x49')]({},_0x14abcf,_0x2e9c97[_0x68ae('0x4b')]);return db[_0x68ae('0x4c')]['find'](_0x14abcf)[_0x68ae('0x20')](handleEntityNotFound(_0xa40125,null))[_0x68ae('0x20')](respondWithResult(_0xa40125,null))[_0x68ae('0x2a')](handleError(_0xa40125,null));};exports[_0x68ae('0x55')]=function(_0x588ebd,_0x2fa49f){return db[_0x68ae('0x4c')][_0x68ae('0x55')](_0x588ebd[_0x68ae('0x56')],{})['then'](respondWithResult(_0x2fa49f,0xc9))['catch'](handleError(_0x2fa49f,null));};exports['update']=function(_0x4714ff,_0x381442){if(_0x4714ff['body']['id']){delete _0x4714ff[_0x68ae('0x56')]['id'];}return db['OpenchannelMessage'][_0x68ae('0x57')]({'where':{'id':_0x4714ff[_0x68ae('0x52')]['id']}})[_0x68ae('0x20')](handleEntityNotFound(_0x381442,null))[_0x68ae('0x20')](saveUpdates(_0x4714ff[_0x68ae('0x56')],null))[_0x68ae('0x20')](respondWithResult(_0x381442,null))[_0x68ae('0x2a')](handleError(_0x381442,null));};exports['destroy']=function(_0x47f3e6,_0x23c55d){return db[_0x68ae('0x4c')]['find']({'where':{'id':_0x47f3e6[_0x68ae('0x52')]['id']}})[_0x68ae('0x20')](handleEntityNotFound(_0x23c55d,null))[_0x68ae('0x20')](removeEntity(_0x23c55d,null))[_0x68ae('0x2a')](handleError(_0x23c55d,null));};exports[_0x68ae('0x58')]=function(_0x28a682,_0x2e0280){return db['OpenchannelMessage'][_0x68ae('0x58')]()['then'](respondWithResult(_0x2e0280,null))[_0x68ae('0x2a')](handleError(_0x2e0280,null));};var interaction_log=require(_0x68ae('0x10'))('openchannel-interactions');exports[_0x68ae('0x59')]=function(_0x2440ba,_0x6a4a0f,_0x18f7b2){var _0xbe19a4={'channel':_0x68ae('0x5a')};if(_0x2440ba[_0x68ae('0x56')]['id']){delete _0x2440ba[_0x68ae('0x56')]['id'];}_0x2440ba[_0x68ae('0x56')][_0x68ae('0x5b')]=!![];_0x2440ba['body'][_0x68ae('0x5c')]=moment()[_0x68ae('0x5d')](_0x68ae('0x5e'));_0x2440ba[_0x68ae('0x56')]['UserId']=_0x2440ba[_0x68ae('0x56')][_0x68ae('0x5f')]||_0x2440ba[_0x68ae('0x60')]['id'];return db[_0x68ae('0x4c')][_0x68ae('0x57')]({'where':{'id':_0x2440ba[_0x68ae('0x52')]['id'],'UserId':null},'include':[{'model':db[_0x68ae('0x61')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x6a4a0f,null))[_0x68ae('0x20')](saveUpdates(_0x2440ba[_0x68ae('0x56')],null))[_0x68ae('0x20')](function(_0x3ca813){if(_0x3ca813){_0xbe19a4[_0x68ae('0x27')]=_0x3ca813[_0x68ae('0x62')]({'plain':!![]});return db[_0x68ae('0x63')]['find']({'where':{'id':_0x3ca813[_0x68ae('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x6a4a0f,null))[_0x68ae('0x20')](function(_0x4df909){if(_0x4df909){return _0x4df909[_0x68ae('0x36')]({'UserId':_0x2440ba['body'][_0x68ae('0x5f')],'read1stAt':_[_0x68ae('0x65')](_0x4df909[_0x68ae('0x66')])?moment()[_0x68ae('0x5d')](_0x68ae('0x5e')):undefined});}return null;})[_0x68ae('0x20')](function(_0xad9009){if(_0xad9009){_0xbe19a4[_0x68ae('0x67')]=_0xad9009[_0x68ae('0x62')]({'plain':!![]});interaction_log[_0x68ae('0x28')](_0x68ae('0x68'),_0x2440ba[_0x68ae('0x60')]['id'],_0x2440ba[_0x68ae('0x60')][_0x68ae('0x38')],_0x2440ba[_0x68ae('0x60')][_0x68ae('0x69')],_0xbe19a4[_0x68ae('0x67')]['id'],_0x2440ba[_0x68ae('0x56')]?JSON[_0x68ae('0x23')](_0x2440ba[_0x68ae('0x56')]):_0x68ae('0x6a'));return respondWithRpcPromise(_0x68ae('0x6b'),_0x68ae('0x6c'),_0xbe19a4);}return null;})['then'](function(_0x227a68){if(_0x227a68){if(_0x2440ba['body'][_0x68ae('0x6d')]){_0xbe19a4['message'][_0x68ae('0x6e')]=util[_0x68ae('0x5d')](_0x68ae('0x6f'),_0x2440ba[_0x68ae('0x60')][_0x68ae('0x38')]);_0xbe19a4[_0x68ae('0x27')][_0x68ae('0x70')]=_0xbe19a4[_0x68ae('0x70')];_0xbe19a4[_0x68ae('0x27')][_0x68ae('0x71')]='accept';return respondWithRpcPromise(_0x68ae('0x72'),_0x68ae('0x72'),{'event':'acceptmessage','message':_0xbe19a4[_0x68ae('0x27')]},client9002)[_0x68ae('0x20')](function(){return _0xbe19a4;});}return _0xbe19a4;}return null;})[_0x68ae('0x20')](respondWithResult(_0x6a4a0f,null))[_0x68ae('0x2a')](handleError(_0x6a4a0f,null));};var interaction_log=require(_0x68ae('0x10'))(_0x68ae('0x73'));exports[_0x68ae('0x74')]=function(_0x436b0e,_0x34ab81,_0x12a3f8){var _0x24c340={'agent':{},'channel':_0x68ae('0x5a')};if(_0x436b0e[_0x68ae('0x56')]['id']){delete _0x436b0e[_0x68ae('0x56')]['id'];}_0x436b0e[_0x68ae('0x56')][_0x68ae('0x5f')]=_0x436b0e[_0x68ae('0x56')][_0x68ae('0x5f')]||_0x436b0e[_0x68ae('0x60')]['id'];_0x24c340[_0x68ae('0x75')]['id']=_0x436b0e['body'][_0x68ae('0x5f')];return db[_0x68ae('0x4c')][_0x68ae('0x57')]({'where':{'id':_0x436b0e['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x34ab81,null))[_0x68ae('0x20')](function(_0x41b044){if(_0x41b044){_0x24c340[_0x68ae('0x27')]=_0x41b044[_0x68ae('0x62')]({'plain':!![]});return db[_0x68ae('0x63')][_0x68ae('0x57')]({'where':{'id':_0x41b044[_0x68ae('0x64')]}});}return null;})[_0x68ae('0x20')](handleEntityNotFound(_0x34ab81,null))[_0x68ae('0x20')](function(_0x25f713){if(_0x25f713){_0x24c340[_0x68ae('0x67')]=_0x25f713[_0x68ae('0x62')]({'plain':!![]});interaction_log['info'](_0x68ae('0x76'),_0x436b0e[_0x68ae('0x60')]['id'],_0x436b0e[_0x68ae('0x60')]['name'],_0x436b0e[_0x68ae('0x60')][_0x68ae('0x69')],_0x24c340[_0x68ae('0x67')]['id'],_0x436b0e[_0x68ae('0x56')]?JSON[_0x68ae('0x23')](_0x436b0e[_0x68ae('0x56')]):'null');return respondWithRpcPromise(_0x68ae('0x77'),_0x68ae('0x78'),_0x24c340);}return null;})[_0x68ae('0x20')](function(_0x11fbf2){if(_0x11fbf2){_0x11fbf2[_0x68ae('0x27')][_0x68ae('0x6e')]=util['format']('SIP/%s',_0x436b0e[_0x68ae('0x60')][_0x68ae('0x38')]);_0x11fbf2['message'][_0x68ae('0x70')]=_0x24c340[_0x68ae('0x70')];_0x11fbf2[_0x68ae('0x27')]['event']=_0x68ae('0x74');respondWithRpcPromise(_0x68ae('0x72'),'EventManager',{'event':_0x68ae('0x79'),'message':_0x11fbf2['message']},client9002);return _0x24c340;}return null;})[_0x68ae('0x20')](respondWithResult(_0x34ab81,null))['catch'](handleError(_0x34ab81,null));}; \ No newline at end of file +var _0x3a6c=['read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','null','AcceptMessage','acceptMessage','manual','format','SIP/%s','channel','event','EventManager','openchannel-interactions','reject','agent','RejectMessage','rejectMessage','interface','rejectmessage','eml-format','rimraf','zip-dir','mustache','util','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','../../mysqldb','redis','defaults','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','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','end','status','json','count','limit','set','Content-Range','apply','save','update','destroy','sendStatus','stack','name','send','index','OpenchannelMessage','rawAttributes','fieldName','map','query','keys','filters','model','intersection','fields','length','nolimit','offset','order','pick','filter','where','merge','options','includeAll','include','rows','params','attributes','create','catch','body','find','describe','accept','openchannel','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','Contact','get','OpenchannelInteraction','OpenchannelInteractionId'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x3a6c,0x10c));var _0xc3a6=function(_0x2d2b83,_0x133632){_0x2d2b83=_0x2d2b83-0x0;var _0x7afc29=_0x3a6c[_0x2d2b83];return _0x7afc29;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc3a6('0x0'));var rimraf=require(_0xc3a6('0x1'));var zipdir=require(_0xc3a6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc3a6('0x3'));var util=require(_0xc3a6('0x4'));var path=require(_0xc3a6('0x5'));var sox=require(_0xc3a6('0x6'));var csv=require(_0xc3a6('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc3a6('0x8'));var squel=require(_0xc3a6('0x9'));var crypto=require(_0xc3a6('0xa'));var jsforce=require(_0xc3a6('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xc3a6('0x7'));var querystring=require(_0xc3a6('0xc'));var Papa=require(_0xc3a6('0xd'));var Redis=require(_0xc3a6('0xe'));var authService=require(_0xc3a6('0xf'));var qs=require(_0xc3a6('0x10'));var as=require(_0xc3a6('0x11'));var hardwareService=require(_0xc3a6('0x12'));var logger=require(_0xc3a6('0x13'))(_0xc3a6('0x14'));var utils=require(_0xc3a6('0x15'));var config=require('../../config/environment');var db=require(_0xc3a6('0x16'))['db'];config[_0xc3a6('0x17')]=_[_0xc3a6('0x18')](config[_0xc3a6('0x17')],{'host':_0xc3a6('0x19'),'port':0x18eb});var socket=require(_0xc3a6('0x1a'))(new Redis(config['redis']));require('./openchannelMessage.socket')[_0xc3a6('0x1b')](socket);var jayson=require(_0xc3a6('0x1c'));var client=jayson[_0xc3a6('0x1d')][_0xc3a6('0x1e')]({'port':0x232c});var client9002=jayson[_0xc3a6('0x1d')]['http']({'port':0x232a});function checkPasswordPattern(_0x355b02,_0x2f20c8,_0x1e4289){if(_0x1e4289){var _0x566a4b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x566a4b[_0xc3a6('0x1f')](_0x2f20c8)){return _0x355b02;}else{throw new db[(_0xc3a6('0x20'))][(_0xc3a6('0x21'))](_0xc3a6('0x22'));}}else{return _0x355b02;}}function respondWithRpcPromise(_0x5b4ab7,_0x12029e,_0x1aa90f,_0x41c8f7){return new BPromise(function(_0x4f6c73,_0x1743c3){var _0x4b4aaa=_0x41c8f7||client;return _0x4b4aaa[_0xc3a6('0x23')](_0x5b4ab7,_0x1aa90f)[_0xc3a6('0x24')](function(_0x411ba6){logger[_0xc3a6('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0x12029e,_0xc3a6('0x26'));logger[_0xc3a6('0x27')](_0xc3a6('0x28'),_0x12029e,_0xc3a6('0x26'),JSON['stringify'](_0x411ba6));if(_0x411ba6[_0xc3a6('0x29')]){if(_0x411ba6[_0xc3a6('0x29')][_0xc3a6('0x2a')]===0x1f4){logger['error'](_0xc3a6('0x2b'),_0x12029e,_0x411ba6[_0xc3a6('0x29')][_0xc3a6('0x2c')]);return _0x1743c3(_0x411ba6['error'][_0xc3a6('0x2c')]);}logger[_0xc3a6('0x29')](_0xc3a6('0x2b'),_0x12029e,_0x411ba6[_0xc3a6('0x29')][_0xc3a6('0x2c')]);return _0x4f6c73(_0x411ba6[_0xc3a6('0x29')][_0xc3a6('0x2c')]);}else{logger[_0xc3a6('0x25')](_0xc3a6('0x2b'),_0x12029e,_0xc3a6('0x26'));_0x4f6c73(_0x411ba6[_0xc3a6('0x2d')]['message']);}})['catch'](function(_0x58dc5c){logger[_0xc3a6('0x29')](_0xc3a6('0x2b'),_0x12029e,_0x58dc5c);_0x1743c3(_0x58dc5c);});});}function respondWithStatusCode(_0x444758,_0x4512b5){_0x4512b5=_0x4512b5||0xcc;return function(_0x40fa80){if(_0x40fa80){return _0x444758['sendStatus'](_0x4512b5);}return _0x444758['status'](_0x4512b5)[_0xc3a6('0x2e')]();};}function respondWithResult(_0xdbbb81,_0x417aad){_0x417aad=_0x417aad||0xc8;return function(_0x41de02){if(_0x41de02){return _0xdbbb81[_0xc3a6('0x2f')](_0x417aad)[_0xc3a6('0x30')](_0x41de02);}};}function respondWithFilteredResult(_0x2aa537,_0x1fec1a){return function(_0x3764fc){if(_0x3764fc){var _0x5de3a2=_0x3764fc[_0xc3a6('0x31')],_0x3c643b=_0x1fec1a['offset'],_0x4a36d9=_0x1fec1a['offset']+_0x1fec1a[_0xc3a6('0x32')],_0x36e8ac;if(_0x4a36d9>=_0x5de3a2){_0x4a36d9=_0x5de3a2;_0x36e8ac=0xc8;}else{_0x36e8ac=0xce;}_0x2aa537[_0xc3a6('0x2f')](_0x36e8ac);return _0x2aa537[_0xc3a6('0x33')](_0xc3a6('0x34'),_0x3c643b+'-'+_0x4a36d9+'/'+_0x5de3a2)['json'](_0x3764fc);}return null;};}function patchUpdates(_0x48ee81){return function(_0x55b92e){try{jsonpatch[_0xc3a6('0x35')](_0x55b92e,_0x48ee81,!![]);}catch(_0x5197d0){return BPromise['reject'](_0x5197d0);}return _0x55b92e[_0xc3a6('0x36')]();};}function saveUpdates(_0x1b0a4e,_0x233065){return function(_0x12b122){if(_0x12b122){return _0x12b122[_0xc3a6('0x37')](_0x1b0a4e)[_0xc3a6('0x24')](function(_0x2b8901){return _0x2b8901;});}return null;};}function removeEntity(_0x1913e8,_0x5f553e){return function(_0x5cdb2a){if(_0x5cdb2a){return _0x5cdb2a[_0xc3a6('0x38')]()[_0xc3a6('0x24')](function(){_0x1913e8[_0xc3a6('0x2f')](0xcc)[_0xc3a6('0x2e')]();});}};}function handleEntityNotFound(_0x3699b0,_0x5aea86){return function(_0x3608c1){if(!_0x3608c1){_0x3699b0[_0xc3a6('0x39')](0x194);}return _0x3608c1;};}function handleError(_0x3b27ac,_0x37122a){_0x37122a=_0x37122a||0x1f4;return function(_0xd56069){logger[_0xc3a6('0x29')](_0xd56069[_0xc3a6('0x3a')]);if(_0xd56069[_0xc3a6('0x3b')]){delete _0xd56069[_0xc3a6('0x3b')];}_0x3b27ac[_0xc3a6('0x2f')](_0x37122a)[_0xc3a6('0x3c')](_0xd56069);};}exports[_0xc3a6('0x3d')]=function(_0x2faa5a,_0x4b1a3){var _0x3cc12d={},_0x177499={},_0x2c0723={'count':0x0,'rows':[]};var _0x21a05d=_['map'](db[_0xc3a6('0x3e')][_0xc3a6('0x3f')],function(_0x593da2){return{'name':_0x593da2[_0xc3a6('0x40')],'type':_0x593da2['type']['key']};});_0x177499['model']=_[_0xc3a6('0x41')](_0x21a05d,'name');_0x177499[_0xc3a6('0x42')]=_[_0xc3a6('0x43')](_0x2faa5a[_0xc3a6('0x42')]);_0x177499[_0xc3a6('0x44')]=_['intersection'](_0x177499[_0xc3a6('0x45')],_0x177499[_0xc3a6('0x42')]);_0x3cc12d['attributes']=_[_0xc3a6('0x46')](_0x177499[_0xc3a6('0x45')],qs['fields'](_0x2faa5a['query'][_0xc3a6('0x47')]));_0x3cc12d['attributes']=_0x3cc12d['attributes'][_0xc3a6('0x48')]?_0x3cc12d['attributes']:_0x177499[_0xc3a6('0x45')];if(!_0x2faa5a[_0xc3a6('0x42')]['hasOwnProperty'](_0xc3a6('0x49'))){_0x3cc12d[_0xc3a6('0x32')]=qs['limit'](_0x2faa5a[_0xc3a6('0x42')][_0xc3a6('0x32')]);_0x3cc12d[_0xc3a6('0x4a')]=qs[_0xc3a6('0x4a')](_0x2faa5a['query'][_0xc3a6('0x4a')]);}_0x3cc12d[_0xc3a6('0x4b')]=qs['sort'](_0x2faa5a[_0xc3a6('0x42')]['sort']);_0x3cc12d['where']=qs[_0xc3a6('0x44')](_[_0xc3a6('0x4c')](_0x2faa5a['query'],_0x177499['filters']));if(_0x2faa5a[_0xc3a6('0x42')][_0xc3a6('0x4d')]){_0x3cc12d[_0xc3a6('0x4e')]=_[_0xc3a6('0x4f')](_0x3cc12d[_0xc3a6('0x4e')],{'$or':_[_0xc3a6('0x41')](_0x21a05d,function(_0x328593){if(_0x328593['type']!=='VIRTUAL'){var _0x91f677={};_0x91f677[_0x328593[_0xc3a6('0x3b')]]={'$like':'%'+_0x2faa5a[_0xc3a6('0x42')][_0xc3a6('0x4d')]+'%'};return _0x91f677;}})});}_0x3cc12d=_['merge']({},_0x3cc12d,_0x2faa5a[_0xc3a6('0x50')]);var _0x214d74={'where':_0x3cc12d[_0xc3a6('0x4e')]};return db[_0xc3a6('0x3e')][_0xc3a6('0x31')](_0x214d74)['then'](function(_0x5acaa6){_0x2c0723[_0xc3a6('0x31')]=_0x5acaa6;if(_0x2faa5a[_0xc3a6('0x42')][_0xc3a6('0x51')]){_0x3cc12d[_0xc3a6('0x52')]=[{'all':!![]}];}return db[_0xc3a6('0x3e')]['findAll'](_0x3cc12d);})[_0xc3a6('0x24')](function(_0x75bdac){_0x2c0723[_0xc3a6('0x53')]=_0x75bdac;return _0x2c0723;})[_0xc3a6('0x24')](respondWithFilteredResult(_0x4b1a3,_0x3cc12d))['catch'](handleError(_0x4b1a3,null));};exports['show']=function(_0x5c4e8b,_0x1a23de){var _0x1e0a0f={'raw':!![],'where':{'id':_0x5c4e8b[_0xc3a6('0x54')]['id']}},_0x24179b={};_0x24179b[_0xc3a6('0x45')]=_[_0xc3a6('0x43')](db[_0xc3a6('0x3e')][_0xc3a6('0x3f')]);_0x24179b[_0xc3a6('0x42')]=_[_0xc3a6('0x43')](_0x5c4e8b['query']);_0x24179b[_0xc3a6('0x44')]=_[_0xc3a6('0x46')](_0x24179b['model'],_0x24179b[_0xc3a6('0x42')]);_0x1e0a0f[_0xc3a6('0x55')]=_[_0xc3a6('0x46')](_0x24179b[_0xc3a6('0x45')],qs['fields'](_0x5c4e8b[_0xc3a6('0x42')][_0xc3a6('0x47')]));_0x1e0a0f[_0xc3a6('0x55')]=_0x1e0a0f['attributes'][_0xc3a6('0x48')]?_0x1e0a0f[_0xc3a6('0x55')]:_0x24179b[_0xc3a6('0x45')];if(_0x5c4e8b[_0xc3a6('0x42')][_0xc3a6('0x51')]){_0x1e0a0f[_0xc3a6('0x52')]=[{'all':!![]}];}_0x1e0a0f=_[_0xc3a6('0x4f')]({},_0x1e0a0f,_0x5c4e8b[_0xc3a6('0x50')]);return db[_0xc3a6('0x3e')]['find'](_0x1e0a0f)[_0xc3a6('0x24')](handleEntityNotFound(_0x1a23de,null))['then'](respondWithResult(_0x1a23de,null))['catch'](handleError(_0x1a23de,null));};exports['create']=function(_0x1e7f21,_0x4dada5){return db[_0xc3a6('0x3e')][_0xc3a6('0x56')](_0x1e7f21['body'],{})[_0xc3a6('0x24')](respondWithResult(_0x4dada5,0xc9))[_0xc3a6('0x57')](handleError(_0x4dada5,null));};exports['update']=function(_0x7d4429,_0x490643){if(_0x7d4429[_0xc3a6('0x58')]['id']){delete _0x7d4429[_0xc3a6('0x58')]['id'];}return db[_0xc3a6('0x3e')]['find']({'where':{'id':_0x7d4429[_0xc3a6('0x54')]['id']}})[_0xc3a6('0x24')](handleEntityNotFound(_0x490643,null))['then'](saveUpdates(_0x7d4429[_0xc3a6('0x58')],null))[_0xc3a6('0x24')](respondWithResult(_0x490643,null))[_0xc3a6('0x57')](handleError(_0x490643,null));};exports[_0xc3a6('0x38')]=function(_0x372bde,_0x14cca7){return db[_0xc3a6('0x3e')][_0xc3a6('0x59')]({'where':{'id':_0x372bde[_0xc3a6('0x54')]['id']}})[_0xc3a6('0x24')](handleEntityNotFound(_0x14cca7,null))['then'](removeEntity(_0x14cca7,null))[_0xc3a6('0x57')](handleError(_0x14cca7,null));};exports[_0xc3a6('0x5a')]=function(_0x1a40de,_0x57aef3){return db[_0xc3a6('0x3e')][_0xc3a6('0x5a')]()[_0xc3a6('0x24')](respondWithResult(_0x57aef3,null))[_0xc3a6('0x57')](handleError(_0x57aef3,null));};var interaction_log=require(_0xc3a6('0x13'))('openchannel-interactions');exports[_0xc3a6('0x5b')]=function(_0x5d4626,_0x48ba7e,_0x1094b1){var _0x409df4={'channel':_0xc3a6('0x5c')};if(_0x5d4626[_0xc3a6('0x58')]['id']){delete _0x5d4626[_0xc3a6('0x58')]['id'];}_0x5d4626[_0xc3a6('0x58')][_0xc3a6('0x5d')]=!![];_0x5d4626[_0xc3a6('0x58')][_0xc3a6('0x5e')]=moment()['format'](_0xc3a6('0x5f'));_0x5d4626[_0xc3a6('0x58')][_0xc3a6('0x60')]=_0x5d4626['body'][_0xc3a6('0x60')]||_0x5d4626['user']['id'];return db['OpenchannelMessage'][_0xc3a6('0x59')]({'where':{'id':_0x5d4626['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xc3a6('0x61')}]})['then'](handleEntityNotFound(_0x48ba7e,null))[_0xc3a6('0x24')](saveUpdates(_0x5d4626['body'],null))[_0xc3a6('0x24')](function(_0x3f9183){if(_0x3f9183){_0x409df4[_0xc3a6('0x2c')]=_0x3f9183[_0xc3a6('0x62')]({'plain':!![]});return db[_0xc3a6('0x63')]['find']({'where':{'id':_0x3f9183[_0xc3a6('0x64')]}});}return null;})[_0xc3a6('0x24')](handleEntityNotFound(_0x48ba7e,null))[_0xc3a6('0x24')](function(_0x272080){if(_0x272080){return _0x272080['update']({'UserId':_0x5d4626['body']['UserId'],'read1stAt':_['isNil'](_0x272080[_0xc3a6('0x65')])?moment()['format'](_0xc3a6('0x5f')):undefined});}return null;})['then'](function(_0x46b90c){if(_0x46b90c){_0x409df4[_0xc3a6('0x66')]=_0x46b90c[_0xc3a6('0x62')]({'plain':!![]});interaction_log[_0xc3a6('0x25')](_0xc3a6('0x67'),_0x5d4626[_0xc3a6('0x68')]['id'],_0x5d4626[_0xc3a6('0x68')]['name'],_0x5d4626[_0xc3a6('0x68')][_0xc3a6('0x69')],_0x409df4['interaction']['id'],_0x5d4626[_0xc3a6('0x58')]?JSON[_0xc3a6('0x6a')](_0x5d4626[_0xc3a6('0x58')]):_0xc3a6('0x6b'));return respondWithRpcPromise(_0xc3a6('0x6c'),_0xc3a6('0x6d'),_0x409df4);}return null;})['then'](function(_0x4cf13f){if(_0x4cf13f){if(_0x5d4626[_0xc3a6('0x58')][_0xc3a6('0x6e')]){_0x409df4[_0xc3a6('0x2c')]['interface']=util[_0xc3a6('0x6f')](_0xc3a6('0x70'),_0x5d4626['user'][_0xc3a6('0x3b')]);_0x409df4[_0xc3a6('0x2c')][_0xc3a6('0x71')]=_0x409df4[_0xc3a6('0x71')];_0x409df4[_0xc3a6('0x2c')][_0xc3a6('0x72')]='accept';return respondWithRpcPromise(_0xc3a6('0x73'),_0xc3a6('0x73'),{'event':'acceptmessage','message':_0x409df4[_0xc3a6('0x2c')]},client9002)['then'](function(){return _0x409df4;});}return _0x409df4;}return null;})[_0xc3a6('0x24')](respondWithResult(_0x48ba7e,null))[_0xc3a6('0x57')](handleError(_0x48ba7e,null));};var interaction_log=require('../../config/logger')(_0xc3a6('0x74'));exports[_0xc3a6('0x75')]=function(_0x2ba4a1,_0x35b58e,_0x114fa0){var _0x159217={'agent':{},'channel':'openchannel'};if(_0x2ba4a1[_0xc3a6('0x58')]['id']){delete _0x2ba4a1[_0xc3a6('0x58')]['id'];}_0x2ba4a1[_0xc3a6('0x58')][_0xc3a6('0x60')]=_0x2ba4a1['body'][_0xc3a6('0x60')]||_0x2ba4a1[_0xc3a6('0x68')]['id'];_0x159217[_0xc3a6('0x76')]['id']=_0x2ba4a1[_0xc3a6('0x58')][_0xc3a6('0x60')];return db[_0xc3a6('0x3e')][_0xc3a6('0x59')]({'where':{'id':_0x2ba4a1[_0xc3a6('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x35b58e,null))[_0xc3a6('0x24')](function(_0x2337b5){if(_0x2337b5){_0x159217[_0xc3a6('0x2c')]=_0x2337b5[_0xc3a6('0x62')]({'plain':!![]});return db[_0xc3a6('0x63')][_0xc3a6('0x59')]({'where':{'id':_0x2337b5[_0xc3a6('0x64')]}});}return null;})[_0xc3a6('0x24')](handleEntityNotFound(_0x35b58e,null))[_0xc3a6('0x24')](function(_0x163ed1){if(_0x163ed1){_0x159217['interaction']=_0x163ed1[_0xc3a6('0x62')]({'plain':!![]});interaction_log[_0xc3a6('0x25')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2ba4a1[_0xc3a6('0x68')]['id'],_0x2ba4a1[_0xc3a6('0x68')]['name'],_0x2ba4a1[_0xc3a6('0x68')][_0xc3a6('0x69')],_0x159217[_0xc3a6('0x66')]['id'],_0x2ba4a1[_0xc3a6('0x58')]?JSON['stringify'](_0x2ba4a1[_0xc3a6('0x58')]):_0xc3a6('0x6b'));return respondWithRpcPromise(_0xc3a6('0x77'),_0xc3a6('0x78'),_0x159217);}return null;})['then'](function(_0x564de5){if(_0x564de5){_0x564de5[_0xc3a6('0x2c')][_0xc3a6('0x79')]=util[_0xc3a6('0x6f')](_0xc3a6('0x70'),_0x2ba4a1['user']['name']);_0x564de5[_0xc3a6('0x2c')][_0xc3a6('0x71')]=_0x159217[_0xc3a6('0x71')];_0x564de5[_0xc3a6('0x2c')]['event']=_0xc3a6('0x75');respondWithRpcPromise(_0xc3a6('0x73'),_0xc3a6('0x73'),{'event':_0xc3a6('0x7a'),'message':_0x564de5['message']},client9002);return _0x159217;}return null;})['then'](respondWithResult(_0x35b58e,null))[_0xc3a6('0x57')](handleError(_0x35b58e,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 10fa134..9a8023e 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 _0x27e8=['update','emit','hasOwnProperty','hook','exports','events','setMaxListeners','save'];(function(_0x4ddfe9,_0x11daa8){var _0xb09fb7=function(_0x78002){while(--_0x78002){_0x4ddfe9['push'](_0x4ddfe9['shift']());}};_0xb09fb7(++_0x11daa8);}(_0x27e8,0x1bd));var _0x827e=function(_0x293417,_0x42eeec){_0x293417=_0x293417-0x0;var _0x446250=_0x27e8[_0x293417];return _0x446250;};'use strict';var EventEmitter=require(_0x827e('0x0'));var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x827e('0x1')](0x0);var events={'afterCreate':_0x827e('0x2'),'afterUpdate':_0x827e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x16be3e){return function(_0x2f27e0,_0x1d3959,_0x4d394a){OpenchannelMessageEvents['emit'](_0x16be3e+':'+_0x2f27e0['id'],_0x2f27e0);OpenchannelMessageEvents[_0x827e('0x4')](_0x16be3e,_0x2f27e0);_0x4d394a(null);};}for(var e in events){if(events[_0x827e('0x5')](e)){var event=events[e];OpenchannelMessage[_0x827e('0x6')](e,emitEvent(event));}}module[_0x827e('0x7')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xe6a6=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x5bebfe,_0x5b1a52){var _0x182a8a=function(_0xe398fa){while(--_0xe398fa){_0x5bebfe['push'](_0x5bebfe['shift']());}};_0x182a8a(++_0x5b1a52);}(_0xe6a6,0x18b));var _0x6e6a=function(_0x3087cb,_0x360413){_0x3087cb=_0x3087cb-0x0;var _0x3256e7=_0xe6a6[_0x3087cb];return _0x3256e7;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x6e6a('0x0'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x6e6a('0x1')](0x0);var events={'afterCreate':_0x6e6a('0x2'),'afterUpdate':_0x6e6a('0x3'),'afterDestroy':_0x6e6a('0x4')};function emitEvent(_0x518818){return function(_0x3eeb3b,_0x172a68,_0x15c214){OpenchannelMessageEvents[_0x6e6a('0x5')](_0x518818+':'+_0x3eeb3b['id'],_0x3eeb3b);OpenchannelMessageEvents[_0x6e6a('0x5')](_0x518818,_0x3eeb3b);_0x15c214(null);};}for(var e in events){if(events[_0x6e6a('0x6')](e)){var event=events[e];OpenchannelMessage[_0x6e6a('0x7')](e,emitEvent(event));}}module[_0x6e6a('0x8')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 90019f3..7bf6fd0 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 _0x30d7=['Interaction','omit','replyUri','method','GET','POST','body','Message\x20%d\x20forwarded\x20to\x20%s','threadId','afterCreate','inspect','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','OpenchannelInteractionId','then','update','createdAt','catch','error','CmContact','describe','OpenchannelAccount','find','Interactions','Contact','keys','info','OpenchannelMessage,\x20%s,\x20%s','Forwarding\x20message\x20%d\x20to\x20%s'];(function(_0x1c2f29,_0x5a2668){var _0x258465=function(_0x30332f){while(--_0x30332f){_0x1c2f29['push'](_0x1c2f29['shift']());}};_0x258465(++_0x5a2668);}(_0x30d7,0x1d8));var _0x730d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x30d7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x730d('0x0'));var util=require(_0x730d('0x1'));var logger=require('../../config/logger')(_0x730d('0x2'));var moment=require(_0x730d('0x3'));var BPromise=require(_0x730d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x730d('0x5'));var rimraf=require(_0x730d('0x6'));var config=require(_0x730d('0x7'));var attributes=require(_0x730d('0x8'));module[_0x730d('0x9')]=function(_0x15bc14,_0x56221e){return _0x15bc14[_0x730d('0xa')](_0x730d('0xb'),attributes,{'tableName':_0x730d('0xc'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':['body'],'type':_0x730d('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x53e983,_0x480cf5,_0xf188c8){var _0x433228=_0x15bc14['models'];var _0x415908=_0x53e983[_0x730d('0xe')]({'plain':!![]});if(_0x415908[_0x730d('0xf')][_0x730d('0x10')]()==='in'||_0x415908['direction'][_0x730d('0x10')]()===_0x730d('0x11')&&!_0x415908[_0x730d('0x12')]&&!_[_0x730d('0x13')](_0x415908[_0x730d('0x14')])){_0x433228[_0x730d('0x15')]['findOne']({'where':{'id':_0x415908[_0x730d('0x16')]}})[_0x730d('0x17')](function(_0x354ad3){if(_0x354ad3){_0x354ad3[_0x730d('0x18')]({'lastMsgAt':_0x415908[_0x730d('0x19')],'lastMsgDirection':_0x415908[_0x730d('0xf')][_0x730d('0x10')]()});}})[_0x730d('0x1a')](function(_0x5a03d7){console[_0x730d('0x1b')](_0x5a03d7);});}if(_0x415908[_0x730d('0xf')]===_0x730d('0x11')&&!_0x415908[_0x730d('0x12')]){var _0x449670;_0x433228[_0x730d('0x1c')][_0x730d('0x1d')]()[_0x730d('0x17')](function(_0x551a17){return _0x433228[_0x730d('0x1e')][_0x730d('0x1f')]({'where':{'id':_0x415908['OpenchannelAccountId']},'include':[{'model':_0x433228[_0x730d('0x15')],'as':_0x730d('0x20'),'where':{'id':_0x415908[_0x730d('0x16')]},'limit':0x1,'include':[{'model':_0x433228['CmContact'],'as':_0x730d('0x21'),'attributes':_[_0x730d('0x22')](_0x551a17)}]}]});})[_0x730d('0x17')](function(_0x1886a3){_0x449670=_0x1886a3[_0x730d('0xe')]({'plain':!![]});if(_0x449670&&_0x449670['replyUri']){logger[_0x730d('0x23')](_0x730d('0x24'),'afterCreate',util['format'](_0x730d('0x25'),_0x415908['id'],_0x449670['replyUri']));if(_0x449670[_0x730d('0x20')]&&_0x449670['Interactions']['length']){_0x415908[_0x730d('0x26')]=_[_0x730d('0x27')](_0x449670['Interactions'][0x0],'Contact');_0x415908[_0x730d('0x21')]=_0x449670['Interactions'][0x0]['Contact'];}var _0x480cf5={'method':'POST','uri':encodeURI(_0x449670[_0x730d('0x28')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x480cf5[_0x730d('0x29')]){case _0x730d('0x2a'):_0x480cf5['qs']=_0x415908;break;case _0x730d('0x2b'):_0x480cf5[_0x730d('0x2c')]=_0x415908;break;}return rp(_0x480cf5)['then'](function(_0x1e1065){logger['info'](_0x730d('0x24'),'afterCreate',util['format'](_0x730d('0x2d'),_0x415908['id'],_0x449670['replyUri']));if(_0x1e1065[_0x730d('0x2c')][_0x730d('0x2e')]&&_0x1e1065[_0x730d('0x2c')][_0x730d('0x2e')]!=_0x415908[_0x730d('0x26')]['threadId']){return _0x433228[_0x730d('0x15')]['update']({'threadId':_0x1e1065[_0x730d('0x2c')][_0x730d('0x2e')]},{'logging':!![],'where':{'id':_0x415908[_0x730d('0x26')]['id']}});}else{return;}})[_0x730d('0x17')](function(){return _0x53e983[_0x730d('0x18')]({'read':!![]});})['catch'](function(_0x4534ac){logger[_0x730d('0x1b')](_0x730d('0x24'),_0x730d('0x2f'),util[_0x730d('0x30')](_0x4534ac,{'showHidden':![],'depth':null}));_0xf188c8();});}else{_0xf188c8();}})['finally'](function(){_0xf188c8();});}else{_0xf188c8();}}},'charset':_0x730d('0x31'),'collate':_0x730d('0x32')});}; \ No newline at end of file +var _0x17dd=['error','CmContact','OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteraction','Contact','keys','get','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','Interaction','omit','method','GET','POST','threadId','catch','inspect','finally','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','define','OpenchannelMessage','openchannel_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','UserId','findOne','OpenchannelInteractionId','then','update','createdAt'];(function(_0x5b1db5,_0x559cd7){var _0x39995c=function(_0x18c72f){while(--_0x18c72f){_0x5b1db5['push'](_0x5b1db5['shift']());}};_0x39995c(++_0x559cd7);}(_0x17dd,0x7f));var _0xd17d=function(_0x48e88c,_0x4ede23){_0x48e88c=_0x48e88c-0x0;var _0x37dd62=_0x17dd[_0x48e88c];return _0x37dd62;};'use strict';var _=require(_0xd17d('0x0'));var util=require('util');var logger=require(_0xd17d('0x1'))(_0xd17d('0x2'));var moment=require(_0xd17d('0x3'));var BPromise=require(_0xd17d('0x4'));var rp=require(_0xd17d('0x5'));var fs=require('fs');var path=require(_0xd17d('0x6'));var rimraf=require(_0xd17d('0x7'));var config=require(_0xd17d('0x8'));var attributes=require(_0xd17d('0x9'));module['exports']=function(_0x1b34ae,_0x26270e){return _0x1b34ae[_0xd17d('0xa')](_0xd17d('0xb'),attributes,{'tableName':_0xd17d('0xc'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0xd17d('0xd')],'type':_0xd17d('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3c8097,_0x5a604a,_0x3bff6f){var _0x52995b=_0x1b34ae[_0xd17d('0xf')];var _0x23e732=_0x3c8097['get']({'plain':!![]});if(_0x23e732[_0xd17d('0x10')][_0xd17d('0x11')]()==='in'||_0x23e732['direction']['toLowerCase']()===_0xd17d('0x12')&&!_0x23e732[_0xd17d('0x13')]&&!_['isNil'](_0x23e732[_0xd17d('0x14')])){_0x52995b['OpenchannelInteraction'][_0xd17d('0x15')]({'where':{'id':_0x23e732[_0xd17d('0x16')]}})[_0xd17d('0x17')](function(_0x381524){if(_0x381524){_0x381524[_0xd17d('0x18')]({'lastMsgAt':_0x23e732[_0xd17d('0x19')],'lastMsgDirection':_0x23e732[_0xd17d('0x10')][_0xd17d('0x11')]()});}})['catch'](function(_0x5dc94e){console[_0xd17d('0x1a')](_0x5dc94e);});}if(_0x23e732[_0xd17d('0x10')]===_0xd17d('0x12')&&!_0x23e732[_0xd17d('0x13')]){var _0x48e29a;_0x52995b[_0xd17d('0x1b')]['describe']()[_0xd17d('0x17')](function(_0x1fab75){return _0x52995b[_0xd17d('0x1c')][_0xd17d('0x1d')]({'where':{'id':_0x23e732[_0xd17d('0x1e')]},'include':[{'model':_0x52995b[_0xd17d('0x1f')],'as':'Interactions','where':{'id':_0x23e732[_0xd17d('0x16')]},'limit':0x1,'include':[{'model':_0x52995b[_0xd17d('0x1b')],'as':_0xd17d('0x20'),'attributes':_[_0xd17d('0x21')](_0x1fab75)}]}]});})[_0xd17d('0x17')](function(_0x481a68){_0x48e29a=_0x481a68[_0xd17d('0x22')]({'plain':!![]});if(_0x48e29a&&_0x48e29a[_0xd17d('0x23')]){logger[_0xd17d('0x24')](_0xd17d('0x25'),_0xd17d('0x26'),util['format'](_0xd17d('0x27'),_0x23e732['id'],_0x48e29a[_0xd17d('0x23')]));if(_0x48e29a[_0xd17d('0x28')]&&_0x48e29a[_0xd17d('0x28')][_0xd17d('0x29')]){_0x23e732[_0xd17d('0x2a')]=_[_0xd17d('0x2b')](_0x48e29a[_0xd17d('0x28')][0x0],_0xd17d('0x20'));_0x23e732['Contact']=_0x48e29a[_0xd17d('0x28')][0x0][_0xd17d('0x20')];}var _0x5a604a={'method':'POST','uri':encodeURI(_0x48e29a['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5a604a[_0xd17d('0x2c')]){case _0xd17d('0x2d'):_0x5a604a['qs']=_0x23e732;break;case _0xd17d('0x2e'):_0x5a604a[_0xd17d('0xd')]=_0x23e732;break;}return rp(_0x5a604a)[_0xd17d('0x17')](function(_0x4b37b0){logger['info'](_0xd17d('0x25'),'afterCreate',util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x23e732['id'],_0x48e29a[_0xd17d('0x23')]));if(_0x4b37b0['body'][_0xd17d('0x2f')]&&_0x4b37b0['body'][_0xd17d('0x2f')]!=_0x23e732[_0xd17d('0x2a')][_0xd17d('0x2f')]){return _0x52995b[_0xd17d('0x1f')][_0xd17d('0x18')]({'threadId':_0x4b37b0[_0xd17d('0xd')]['threadId']},{'logging':!![],'where':{'id':_0x23e732[_0xd17d('0x2a')]['id']}});}else{return;}})['then'](function(){return _0x3c8097['update']({'read':!![]});})[_0xd17d('0x30')](function(_0x538c93){logger[_0xd17d('0x1a')](_0xd17d('0x25'),'afterCreate',util[_0xd17d('0x31')](_0x538c93,{'showHidden':![],'depth':null}));_0x3bff6f();});}else{_0x3bff6f();}})[_0xd17d('0x32')](function(){_0x3bff6f();});}else{_0x3bff6f();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index c72030f..f6e2faa 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 _0xaa64=['client','http','redis','defaults','socket.io-emitter','register','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x25b40d,_0x3d8e6c){var _0x25adab=function(_0x44de2b){while(--_0x44de2b){_0x25b40d['push'](_0x25b40d['shift']());}};_0x25adab(++_0x3d8e6c);}(_0xaa64,0xf7));var _0x4aa6=function(_0x128de4,_0x511592){_0x128de4=_0x128de4-0x0;var _0x167659=_0xaa64[_0x128de4];return _0x167659;};'use strict';var _=require(_0x4aa6('0x0'));var util=require(_0x4aa6('0x1'));var moment=require('moment');var BPromise=require(_0x4aa6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4aa6('0x3'));var db=require(_0x4aa6('0x4'))['db'];var utils=require(_0x4aa6('0x5'));var logger=require('../../config/logger')(_0x4aa6('0x6'));var config=require(_0x4aa6('0x7'));var jayson=require(_0x4aa6('0x8'));var client=jayson[_0x4aa6('0x9')][_0x4aa6('0xa')]({'port':0x232a});config[_0x4aa6('0xb')]=_[_0x4aa6('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4aa6('0xd'))(new Redis(config[_0x4aa6('0xb')]));require('./openchannelMessage.socket')[_0x4aa6('0xe')](socket);function respondWithRpcPromise(_0x521ae3,_0x1df231,_0xf48bbb){return new BPromise(function(_0x205770,_0x136e55){return client['request'](_0x521ae3,_0xf48bbb)[_0x4aa6('0xf')](function(_0x1d23d2){logger[_0x4aa6('0x10')](_0x4aa6('0x11'),_0x1df231,_0x4aa6('0x12'));logger[_0x4aa6('0x13')](_0x4aa6('0x14'),_0x1df231,_0x4aa6('0x12'),JSON[_0x4aa6('0x15')](_0x1d23d2));if(_0x1d23d2[_0x4aa6('0x16')]){if(_0x1d23d2['error'][_0x4aa6('0x17')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x1df231,_0x1d23d2[_0x4aa6('0x16')][_0x4aa6('0x18')]);return _0x136e55(_0x1d23d2[_0x4aa6('0x16')][_0x4aa6('0x18')]);}logger[_0x4aa6('0x16')](_0x4aa6('0x11'),_0x1df231,_0x1d23d2[_0x4aa6('0x16')][_0x4aa6('0x18')]);return _0x205770(_0x1d23d2['error'][_0x4aa6('0x18')]);}else{logger['info'](_0x4aa6('0x11'),_0x1df231,'request\x20sent');_0x205770(_0x1d23d2['result'][_0x4aa6('0x18')]);}})[_0x4aa6('0x19')](function(_0x2458fd){logger[_0x4aa6('0x16')](_0x4aa6('0x11'),_0x1df231,_0x2458fd);_0x136e55(_0x2458fd);});});}exports[_0x4aa6('0x1a')]=function(_0x1d4a09){var _0x10a2e7=this;return new Promise(function(_0x15365e,_0x4c9159){return db[_0x4aa6('0x1b')][_0x4aa6('0x1c')](_0x1d4a09[_0x4aa6('0x1d')],{'raw':_0x1d4a09[_0x4aa6('0x1e')]?_0x1d4a09[_0x4aa6('0x1e')][_0x4aa6('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0xa0f5be){logger[_0x4aa6('0x10')](_0x4aa6('0x1a'),_0x1d4a09);logger[_0x4aa6('0x13')](_0x4aa6('0x1a'),_0x1d4a09,JSON[_0x4aa6('0x15')](_0xa0f5be));_0x15365e(_0xa0f5be);})['catch'](function(_0x2f4943){logger[_0x4aa6('0x16')]('CreateOpenchannelMessage',_0x2f4943['message'],_0x1d4a09);_0x4c9159(_0x10a2e7[_0x4aa6('0x16')](0x1f4,_0x2f4943[_0x4aa6('0x18')]));});});}; \ No newline at end of file +var _0x6050=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','http','localhost','socket.io-emitter','redis','./openchannelMessage.socket','register','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','lodash','util'];(function(_0x32f70c,_0x53af77){var _0x78375e=function(_0x4268e3){while(--_0x4268e3){_0x32f70c['push'](_0x32f70c['shift']());}};_0x78375e(++_0x53af77);}(_0x6050,0x196));var _0x0605=function(_0x4c17b0,_0x44e5a7){_0x4c17b0=_0x4c17b0-0x0;var _0x4857f3=_0x6050[_0x4c17b0];return _0x4857f3;};'use strict';var _=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var moment=require(_0x0605('0x2'));var BPromise=require(_0x0605('0x3'));var rs=require(_0x0605('0x4'));var fs=require('fs');var Redis=require(_0x0605('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0605('0x6'));var logger=require(_0x0605('0x7'))(_0x0605('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0605('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x0605('0xa'),'port':0x18eb});var socket=require(_0x0605('0xb'))(new Redis(config[_0x0605('0xc')]));require(_0x0605('0xd'))[_0x0605('0xe')](socket);function respondWithRpcPromise(_0x52bb63,_0x1882e6,_0x23dc2b){return new BPromise(function(_0xe54b22,_0x2c5e23){return client[_0x0605('0xf')](_0x52bb63,_0x23dc2b)[_0x0605('0x10')](function(_0x4385d3){logger[_0x0605('0x11')](_0x0605('0x12'),_0x1882e6,_0x0605('0x13'));logger[_0x0605('0x14')](_0x0605('0x15'),_0x1882e6,_0x0605('0x13'),JSON[_0x0605('0x16')](_0x4385d3));if(_0x4385d3[_0x0605('0x17')]){if(_0x4385d3[_0x0605('0x17')][_0x0605('0x18')]===0x1f4){logger[_0x0605('0x17')](_0x0605('0x12'),_0x1882e6,_0x4385d3['error'][_0x0605('0x19')]);return _0x2c5e23(_0x4385d3[_0x0605('0x17')][_0x0605('0x19')]);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x1882e6,_0x4385d3[_0x0605('0x17')][_0x0605('0x19')]);return _0xe54b22(_0x4385d3[_0x0605('0x17')][_0x0605('0x19')]);}else{logger[_0x0605('0x11')](_0x0605('0x12'),_0x1882e6,_0x0605('0x13'));_0xe54b22(_0x4385d3[_0x0605('0x1a')][_0x0605('0x19')]);}})[_0x0605('0x1b')](function(_0x3a22e9){logger[_0x0605('0x17')](_0x0605('0x12'),_0x1882e6,_0x3a22e9);_0x2c5e23(_0x3a22e9);});});}exports[_0x0605('0x1c')]=function(_0x59bc87){var _0x254020=this;return new Promise(function(_0x14a920,_0x430f28){return db[_0x0605('0x1d')][_0x0605('0x1e')](_0x59bc87[_0x0605('0x1f')],{'raw':_0x59bc87[_0x0605('0x20')]?_0x59bc87[_0x0605('0x20')][_0x0605('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0xc334b8){logger['info'](_0x0605('0x1c'),_0x59bc87);logger[_0x0605('0x14')](_0x0605('0x1c'),_0x59bc87,JSON[_0x0605('0x16')](_0xc334b8));_0x14a920(_0xc334b8);})[_0x0605('0x1b')](function(_0xb4d805){logger[_0x0605('0x17')](_0x0605('0x1c'),_0xb4d805[_0x0605('0x19')],_0x59bc87);_0x430f28(_0x254020[_0x0605('0x17')](0x1f4,_0xb4d805[_0x0605('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 86b6449..f9ef5cf 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 _0x0713=['removeListener','register','length','openchannelMessage:','remove','update'];(function(_0x582f72,_0x886d8){var _0x4cd5fe=function(_0x4ac1c7){while(--_0x4ac1c7){_0x582f72['push'](_0x582f72['shift']());}};_0x4cd5fe(++_0x886d8);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save',_0x3071('0x0'),_0x3071('0x1')];function createListener(_0x27405a,_0x305d85){return function(_0x864539){_0x305d85['emit'](_0x27405a,_0x864539);};}function removeListener(_0x2c547f,_0x7b18a4){return function(){OpenchannelMessageEvents[_0x3071('0x2')](_0x2c547f,_0x7b18a4);};}exports[_0x3071('0x3')]=function(_0xabd7b6){for(var _0x41cf76=0x0,_0x1d3dd6=events[_0x3071('0x4')];_0x41cf76<_0x1d3dd6;_0x41cf76++){var _0xbd737f=events[_0x41cf76];var _0x22274c=createListener(_0x3071('0x5')+_0xbd737f,_0xabd7b6);OpenchannelMessageEvents['on'](_0xbd737f,_0x22274c);}}; \ No newline at end of file +var _0x70e0=['openchannelMessage:','./openchannelMessage.events','save','remove','emit','removeListener'];(function(_0xc5c7a5,_0x1c5205){var _0xae0b01=function(_0x376cd4){while(--_0x376cd4){_0xc5c7a5['push'](_0xc5c7a5['shift']());}};_0xae0b01(++_0x1c5205);}(_0x70e0,0x17b));var _0x070e=function(_0x2aff6f,_0x5bb4bb){_0x2aff6f=_0x2aff6f-0x0;var _0x2eb580=_0x70e0[_0x2aff6f];return _0x2eb580;};'use strict';var OpenchannelMessageEvents=require(_0x070e('0x0'));var events=[_0x070e('0x1'),_0x070e('0x2'),'update'];function createListener(_0x579b83,_0x16e651){return function(_0xee173){_0x16e651[_0x070e('0x3')](_0x579b83,_0xee173);};}function removeListener(_0x2593e5,_0x5c90fc){return function(){OpenchannelMessageEvents[_0x070e('0x4')](_0x2593e5,_0x5c90fc);};}exports['register']=function(_0x46fe68){for(var _0x4b041d=0x0,_0x56e420=events['length'];_0x4b041d<_0x56e420;_0x4b041d++){var _0x35ab0c=events[_0x4b041d];var _0x1e11f0=createListener(_0x070e('0x5')+_0x35ab0c,_0x46fe68);OpenchannelMessageEvents['on'](_0x35ab0c,_0x1e11f0);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 273d05b..0ff5895 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 _0x02a7=['index','/describe','isAuthenticated','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','update','destroy','delete','removeTeams','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get'];(function(_0x56c70f,_0x4e4493){var _0x3812ed=function(_0x25460f){while(--_0x25460f){_0x56c70f['push'](_0x56c70f['shift']());}};_0x3812ed(++_0x4e4493);}(_0x02a7,0x7a));var _0x702a=function(_0xb9c1ec,_0x4ff82e){_0xb9c1ec=_0xb9c1ec-0x0;var _0x3739ca=_0x02a7[_0xb9c1ec];return _0x3739ca;};'use strict';var multer=require('multer');var util=require(_0x702a('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x702a('0x1'));var router=express[_0x702a('0x2')]();var auth=require(_0x702a('0x3'));var interaction=require(_0x702a('0x4'));var config=require(_0x702a('0x5'));var controller=require(_0x702a('0x6'));router[_0x702a('0x7')]('/',auth['isAuthenticated'](),controller[_0x702a('0x8')]);router['get'](_0x702a('0x9'),auth[_0x702a('0xa')](),controller[_0x702a('0xb')]);router[_0x702a('0x7')](_0x702a('0xc'),auth[_0x702a('0xa')](),controller[_0x702a('0xd')]);router['get'](_0x702a('0xe'),auth['isAuthenticated'](),controller['getMembers']);router[_0x702a('0x7')](_0x702a('0xf'),auth[_0x702a('0xa')](),controller[_0x702a('0x10')]);router['get'](_0x702a('0x11'),auth[_0x702a('0xa')](),controller[_0x702a('0x12')]);router[_0x702a('0x13')]('/',auth[_0x702a('0xa')](),controller[_0x702a('0x14')]);router[_0x702a('0x13')]('/:id/teams',auth['isAuthenticated'](),controller[_0x702a('0x15')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x702a('0xc'),auth[_0x702a('0xa')](),controller[_0x702a('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x702a('0x17')]);router[_0x702a('0x18')](_0x702a('0xf'),auth['isAuthenticated'](),controller[_0x702a('0x19')]);router['delete'](_0x702a('0x11'),auth[_0x702a('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x106f=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id'];(function(_0x5a86da,_0x5cdde2){var _0x348bd3=function(_0x332a72){while(--_0x332a72){_0x5a86da['push'](_0x5a86da['shift']());}};_0x348bd3(++_0x5cdde2);}(_0x106f,0x162));var _0xf106=function(_0x54cf0d,_0x3732c2){_0x54cf0d=_0x54cf0d-0x0;var _0x4d292b=_0x106f[_0x54cf0d];return _0x4d292b;};'use strict';var multer=require(_0xf106('0x0'));var util=require(_0xf106('0x1'));var path=require('path');var timeout=require(_0xf106('0x2'));var express=require(_0xf106('0x3'));var router=express['Router']();var auth=require(_0xf106('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf106('0x5'));var controller=require(_0xf106('0x6'));router[_0xf106('0x7')]('/',auth[_0xf106('0x8')](),controller[_0xf106('0x9')]);router[_0xf106('0x7')](_0xf106('0xa'),auth['isAuthenticated'](),controller[_0xf106('0xb')]);router[_0xf106('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router['get']('/:id/members',auth[_0xf106('0x8')](),controller[_0xf106('0xc')]);router[_0xf106('0x7')](_0xf106('0xd'),auth[_0xf106('0x8')](),controller[_0xf106('0xe')]);router[_0xf106('0x7')](_0xf106('0xf'),auth[_0xf106('0x8')](),controller[_0xf106('0x10')]);router[_0xf106('0x11')]('/',auth['isAuthenticated'](),controller[_0xf106('0x12')]);router[_0xf106('0x11')]('/:id/teams',auth['isAuthenticated'](),controller[_0xf106('0x13')]);router[_0xf106('0x11')](_0xf106('0xf'),auth['isAuthenticated'](),controller[_0xf106('0x14')]);router[_0xf106('0x15')](_0xf106('0x16'),auth['isAuthenticated'](),controller[_0xf106('0x17')]);router[_0xf106('0x18')]('/:id',auth[_0xf106('0x8')](),controller[_0xf106('0x19')]);router[_0xf106('0x18')]('/:id/teams',auth['isAuthenticated'](),controller[_0xf106('0x1a')]);router[_0xf106('0x18')](_0xf106('0xf'),auth['isAuthenticated'](),controller[_0xf106('0x1b')]);module[_0xf106('0x1c')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 8e83bc4..56a7fd7 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 _0x4325=['name','STRING','INTEGER','beepall','roundrobin','sequelize','exports'];(function(_0x2a4468,_0x577f1f){var _0x45d2c9=function(_0x29ce2a){while(--_0x29ce2a){_0x2a4468['push'](_0x2a4468['shift']());}};_0x45d2c9(++_0x577f1f);}(_0x4325,0x1da));var _0x5432=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4325[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x5432('0x0'));module[_0x5432('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x5432('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5432('0x3')]},'timeout':{'type':Sequelize[_0x5432('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x5432('0x5'),_0x5432('0x6'))}}; \ No newline at end of file +var _0xa1c9=['name','INTEGER','ENUM','rrmemory','beepall','sequelize','exports','STRING'];(function(_0x47c28c,_0xda58f9){var _0x4b3012=function(_0x4ac294){while(--_0x4ac294){_0x47c28c['push'](_0x47c28c['shift']());}};_0x4b3012(++_0xda58f9);}(_0xa1c9,0x135));var _0x9a1c=function(_0x53eeac,_0x1babff){_0x53eeac=_0x53eeac-0x0;var _0x41dddf=_0xa1c9[_0x53eeac];return _0x41dddf;};'use strict';var Sequelize=require(_0x9a1c('0x0'));module[_0x9a1c('0x1')]={'name':{'type':Sequelize[_0x9a1c('0x2')],'unique':_0x9a1c('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9a1c('0x2')]},'timeout':{'type':Sequelize[_0x9a1c('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9a1c('0x5')](_0x9a1c('0x6'),_0x9a1c('0x7'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 904d6c5..63f8506 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 _0xde49=['value','isEmpty','forEach','addAgents','omit','emit','removeAgents','userOpenchannelQueue:remove','getAgents','html-pdf','eml-format','fast-json-patch','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','end','status','json','count','set','Content-Range','reject','update','then','get','OpenchannelQueues','UserProfileResource','destroy','sendStatus','name','send','map','OpenchannelQueue','rawAttributes','fieldName','type','key','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','offset','order','sort','pick','filter','merge','where','options','includeAll','include','findAll','rows','catch','params','keys','model','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserOpenchannelQueue','OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','addTeams','ids','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','push','QueryTypes','SELECT','every','TeamId','all','union','compact'];(function(_0x34c027,_0x123688){var _0x47bff0=function(_0x19c4a9){while(--_0x19c4a9){_0x34c027['push'](_0x34c027['shift']());}};_0x47bff0(++_0x123688);}(_0xde49,0x119));var _0x9de4=function(_0x1e68da,_0x28c012){_0x1e68da=_0x1e68da-0x0;var _0x2b845e=_0xde49[_0x1e68da];return _0x2b845e;};'use strict';var pdf=require(_0x9de4('0x0'));var emlformat=require(_0x9de4('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9de4('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9de4('0x3'));var util=require(_0x9de4('0x4'));var path=require(_0x9de4('0x5'));var sox=require(_0x9de4('0x6'));var csv=require(_0x9de4('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9de4('0x8'));var squel=require(_0x9de4('0x9'));var crypto=require('crypto');var jsforce=require(_0x9de4('0xa'));var deskjs=require(_0x9de4('0xb'));var toCsv=require(_0x9de4('0x7'));var querystring=require(_0x9de4('0xc'));var Papa=require('papaparse');var Redis=require(_0x9de4('0xd'));var authService=require(_0x9de4('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9de4('0xf'));var utils=require('../../config/utils');var config=require(_0x9de4('0x10'));var db=require(_0x9de4('0x11'))['db'];config[_0x9de4('0x12')]=_[_0x9de4('0x13')](config[_0x9de4('0x12')],{'host':'localhost','port':0x18eb});var socket=require(_0x9de4('0x14'))(new Redis(config[_0x9de4('0x12')]));require(_0x9de4('0x15'))[_0x9de4('0x16')](socket);function respondWithStatusCode(_0x157a79,_0x19e7cc){_0x19e7cc=_0x19e7cc||0xcc;return function(_0x881ff6){if(_0x881ff6){return _0x157a79['sendStatus'](_0x19e7cc);}return _0x157a79['status'](_0x19e7cc)[_0x9de4('0x17')]();};}function respondWithResult(_0x338df5,_0x176683){_0x176683=_0x176683||0xc8;return function(_0x123b0d){if(_0x123b0d){return _0x338df5[_0x9de4('0x18')](_0x176683)[_0x9de4('0x19')](_0x123b0d);}};}function respondWithFilteredResult(_0x49d426,_0x43babe){return function(_0x112bc4){if(_0x112bc4){var _0x7f3167=_0x112bc4[_0x9de4('0x1a')],_0x1b16b6=_0x43babe['offset'],_0x154047=_0x43babe['offset']+_0x43babe['limit'],_0x593b8e;if(_0x154047>=_0x7f3167){_0x154047=_0x7f3167;_0x593b8e=0xc8;}else{_0x593b8e=0xce;}_0x49d426[_0x9de4('0x18')](_0x593b8e);return _0x49d426[_0x9de4('0x1b')](_0x9de4('0x1c'),_0x1b16b6+'-'+_0x154047+'/'+_0x7f3167)[_0x9de4('0x19')](_0x112bc4);}return null;};}function patchUpdates(_0x285983){return function(_0x451edb){try{jsonpatch['apply'](_0x451edb,_0x285983,!![]);}catch(_0x185134){return BPromise[_0x9de4('0x1d')](_0x185134);}return _0x451edb['save']();};}function saveUpdates(_0xd6a2d6,_0x6574b4){return function(_0x5efac1){if(_0x5efac1){return _0x5efac1[_0x9de4('0x1e')](_0xd6a2d6)[_0x9de4('0x1f')](function(_0x5f08ed){return _0x5f08ed;});}return null;};}function removeEntity(_0x2b507d,_0x2b4cfa){return function(_0x5ab7d8){if(_0x5ab7d8){return _0x5ab7d8['destroy']()[_0x9de4('0x1f')](function(){var _0x521c33=_0x5ab7d8[_0x9de4('0x20')]({'plain':!![]});var _0x3ec014=_0x9de4('0x21');return db[_0x9de4('0x22')][_0x9de4('0x23')]({'where':{'type':_0x3ec014,'resourceId':_0x521c33['id']}})[_0x9de4('0x1f')](function(){return _0x5ab7d8;});})[_0x9de4('0x1f')](function(){_0x2b507d[_0x9de4('0x18')](0xcc)[_0x9de4('0x17')]();});}};}function handleEntityNotFound(_0x163191,_0x265287){return function(_0x16a1b6){if(!_0x16a1b6){_0x163191[_0x9de4('0x24')](0x194);}return _0x16a1b6;};}function handleError(_0x14a335,_0x14f1a5){_0x14f1a5=_0x14f1a5||0x1f4;return function(_0x31cfed){logger['error'](_0x31cfed['stack']);if(_0x31cfed[_0x9de4('0x25')]){delete _0x31cfed[_0x9de4('0x25')];}_0x14a335[_0x9de4('0x18')](_0x14f1a5)[_0x9de4('0x26')](_0x31cfed);};}exports['index']=function(_0x4ed337,_0x3db2d2){var _0x3fc68a={},_0x64402={},_0x2c5eef={'count':0x0,'rows':[]};var _0x4e7800=_[_0x9de4('0x27')](db[_0x9de4('0x28')][_0x9de4('0x29')],function(_0x1ade13){return{'name':_0x1ade13[_0x9de4('0x2a')],'type':_0x1ade13[_0x9de4('0x2b')][_0x9de4('0x2c')]};});_0x64402['model']=_['map'](_0x4e7800,'name');_0x64402[_0x9de4('0x2d')]=_['keys'](_0x4ed337[_0x9de4('0x2d')]);_0x64402[_0x9de4('0x2e')]=_['intersection'](_0x64402['model'],_0x64402[_0x9de4('0x2d')]);_0x3fc68a[_0x9de4('0x2f')]=_[_0x9de4('0x30')](_0x64402['model'],qs[_0x9de4('0x31')](_0x4ed337[_0x9de4('0x2d')][_0x9de4('0x31')]));_0x3fc68a[_0x9de4('0x2f')]=_0x3fc68a['attributes'][_0x9de4('0x32')]?_0x3fc68a['attributes']:_0x64402['model'];if(!_0x4ed337['query'][_0x9de4('0x33')](_0x9de4('0x34'))){_0x3fc68a[_0x9de4('0x35')]=qs[_0x9de4('0x35')](_0x4ed337[_0x9de4('0x2d')][_0x9de4('0x35')]);_0x3fc68a[_0x9de4('0x36')]=qs[_0x9de4('0x36')](_0x4ed337[_0x9de4('0x2d')]['offset']);}_0x3fc68a[_0x9de4('0x37')]=qs[_0x9de4('0x38')](_0x4ed337[_0x9de4('0x2d')]['sort']);_0x3fc68a['where']=qs[_0x9de4('0x2e')](_[_0x9de4('0x39')](_0x4ed337[_0x9de4('0x2d')],_0x64402['filters']));if(_0x4ed337[_0x9de4('0x2d')][_0x9de4('0x3a')]){_0x3fc68a['where']=_[_0x9de4('0x3b')](_0x3fc68a[_0x9de4('0x3c')],{'$or':_['map'](_0x4e7800,function(_0x3a4019){if(_0x3a4019['type']!=='VIRTUAL'){var _0x6c1e0={};_0x6c1e0[_0x3a4019[_0x9de4('0x25')]]={'$like':'%'+_0x4ed337['query']['filter']+'%'};return _0x6c1e0;}})});}_0x3fc68a=_[_0x9de4('0x3b')]({},_0x3fc68a,_0x4ed337[_0x9de4('0x3d')]);var _0x24633a={'where':_0x3fc68a[_0x9de4('0x3c')]};return db['OpenchannelQueue']['count'](_0x24633a)['then'](function(_0x541782){_0x2c5eef['count']=_0x541782;if(_0x4ed337[_0x9de4('0x2d')][_0x9de4('0x3e')]){_0x3fc68a[_0x9de4('0x3f')]=[{'all':!![]}];}return db[_0x9de4('0x28')][_0x9de4('0x40')](_0x3fc68a);})['then'](function(_0x421ce9){_0x2c5eef[_0x9de4('0x41')]=_0x421ce9;return _0x2c5eef;})[_0x9de4('0x1f')](respondWithFilteredResult(_0x3db2d2,_0x3fc68a))[_0x9de4('0x42')](handleError(_0x3db2d2,null));};exports['show']=function(_0x116ede,_0x5c2d21){var _0x277c2c={'raw':!![],'where':{'id':_0x116ede[_0x9de4('0x43')]['id']}},_0x5757f1={};_0x5757f1['model']=_['keys'](db['OpenchannelQueue'][_0x9de4('0x29')]);_0x5757f1['query']=_[_0x9de4('0x44')](_0x116ede[_0x9de4('0x2d')]);_0x5757f1[_0x9de4('0x2e')]=_[_0x9de4('0x30')](_0x5757f1['model'],_0x5757f1[_0x9de4('0x2d')]);_0x277c2c[_0x9de4('0x2f')]=_[_0x9de4('0x30')](_0x5757f1[_0x9de4('0x45')],qs[_0x9de4('0x31')](_0x116ede[_0x9de4('0x2d')][_0x9de4('0x31')]));_0x277c2c['attributes']=_0x277c2c['attributes'][_0x9de4('0x32')]?_0x277c2c['attributes']:_0x5757f1['model'];if(_0x116ede[_0x9de4('0x2d')][_0x9de4('0x3e')]){_0x277c2c['include']=[{'all':!![]}];}_0x277c2c=_[_0x9de4('0x3b')]({},_0x277c2c,_0x116ede[_0x9de4('0x3d')]);return db[_0x9de4('0x28')]['find'](_0x277c2c)[_0x9de4('0x1f')](handleEntityNotFound(_0x5c2d21,null))[_0x9de4('0x1f')](respondWithResult(_0x5c2d21,null))[_0x9de4('0x42')](handleError(_0x5c2d21,null));};exports['create']=function(_0x150821,_0x46a79f){return db[_0x9de4('0x28')][_0x9de4('0x46')](_0x150821['body'],{})[_0x9de4('0x1f')](function(_0x5f2a59){var _0x5ce952=_0x150821[_0x9de4('0x47')][_0x9de4('0x20')]({'plain':!![]});if(!_0x5ce952)throw new Error(_0x9de4('0x48'));if(_0x5ce952[_0x9de4('0x49')]===_0x9de4('0x47')){var _0x4c5251=_0x5f2a59[_0x9de4('0x20')]({'plain':!![]});var _0x269bb0=_0x9de4('0x21');return db[_0x9de4('0x4a')][_0x9de4('0x4b')]({'where':{'name':_0x269bb0,'userProfileId':_0x5ce952[_0x9de4('0x4c')]},'raw':!![]})['then'](function(_0x2cc3e0){if(_0x2cc3e0&&_0x2cc3e0[_0x9de4('0x4d')]===0x0){return db[_0x9de4('0x22')][_0x9de4('0x46')]({'name':_0x4c5251[_0x9de4('0x25')],'resourceId':_0x4c5251['id'],'type':_0x2cc3e0[_0x9de4('0x25')],'sectionId':_0x2cc3e0['id']},{})[_0x9de4('0x1f')](function(){return _0x5f2a59;});}else{return _0x5f2a59;}})[_0x9de4('0x42')](function(_0x5429e8){logger[_0x9de4('0x4e')](_0x9de4('0x4f'),_0x5429e8);throw _0x5429e8;});}return _0x5f2a59;})[_0x9de4('0x1f')](respondWithResult(_0x46a79f,0xc9))['catch'](handleError(_0x46a79f,null));};exports[_0x9de4('0x1e')]=function(_0x1dcc49,_0x3453b9){if(_0x1dcc49[_0x9de4('0x50')]['id']){delete _0x1dcc49['body']['id'];}return db['OpenchannelQueue'][_0x9de4('0x4b')]({'where':{'id':_0x1dcc49[_0x9de4('0x43')]['id']}})['then'](handleEntityNotFound(_0x3453b9,null))[_0x9de4('0x1f')](saveUpdates(_0x1dcc49[_0x9de4('0x50')],null))[_0x9de4('0x1f')](respondWithResult(_0x3453b9,null))['catch'](handleError(_0x3453b9,null));};exports[_0x9de4('0x23')]=function(_0x277e7f,_0x5ee610){return db[_0x9de4('0x28')]['find']({'where':{'id':_0x277e7f[_0x9de4('0x43')]['id']}})['then'](handleEntityNotFound(_0x5ee610,null))[_0x9de4('0x1f')](removeEntity(_0x5ee610,null))[_0x9de4('0x42')](handleError(_0x5ee610,null));};exports['describe']=function(_0x9c8767,_0x37029c){return db[_0x9de4('0x28')][_0x9de4('0x51')]()[_0x9de4('0x1f')](respondWithResult(_0x37029c,null))['catch'](handleError(_0x37029c,null));};exports[_0x9de4('0x52')]=function(_0x1fbfaa,_0x21e155,_0x1d2378){var _0x48cea8={'raw':!![],'where':{}},_0x57a1a5={},_0x39d686;return db['OpenchannelQueue'][_0x9de4('0x53')]({'where':{'id':_0x1fbfaa['params']['id']}})[_0x9de4('0x1f')](handleEntityNotFound(_0x21e155,null))[_0x9de4('0x1f')](function(_0xcc76be){if(_0xcc76be){_0x39d686=_0xcc76be[_0x9de4('0x20')]({'plain':!![]});_0x57a1a5[_0x9de4('0x45')]=_[_0x9de4('0x44')](db[_0x9de4('0x54')]['rawAttributes']);_0x57a1a5['query']=_[_0x9de4('0x44')](_0x1fbfaa[_0x9de4('0x2d')]);_0x57a1a5[_0x9de4('0x2e')]=_[_0x9de4('0x30')](_0x57a1a5[_0x9de4('0x45')],_0x57a1a5[_0x9de4('0x2d')]);_0x48cea8[_0x9de4('0x2f')]=_['intersection'](_0x57a1a5[_0x9de4('0x45')],qs[_0x9de4('0x31')](_0x1fbfaa[_0x9de4('0x2d')][_0x9de4('0x31')]));_0x48cea8[_0x9de4('0x2f')]=_0x48cea8[_0x9de4('0x2f')][_0x9de4('0x32')]?_0x48cea8[_0x9de4('0x2f')]:_0x57a1a5[_0x9de4('0x45')];if(!_0x1fbfaa[_0x9de4('0x2d')][_0x9de4('0x33')](_0x9de4('0x34'))){_0x48cea8[_0x9de4('0x35')]=qs[_0x9de4('0x35')](_0x1fbfaa['query']['limit']);_0x48cea8['offset']=qs[_0x9de4('0x36')](_0x1fbfaa[_0x9de4('0x2d')][_0x9de4('0x36')]);}_0x48cea8['order']=qs[_0x9de4('0x38')](_0x1fbfaa[_0x9de4('0x2d')][_0x9de4('0x38')]);_0x48cea8[_0x9de4('0x3c')]=qs[_0x9de4('0x2e')](_[_0x9de4('0x39')](_0x1fbfaa[_0x9de4('0x2d')],_0x57a1a5['filters']));_0x48cea8['where'][_0x9de4('0x55')]=_0xcc76be['id'];if(_0x1fbfaa[_0x9de4('0x2d')][_0x9de4('0x3a')]){_0x48cea8[_0x9de4('0x3c')]=_[_0x9de4('0x3b')](_0x48cea8[_0x9de4('0x3c')],{'$or':_[_0x9de4('0x27')](_0x48cea8[_0x9de4('0x2f')],function(_0x5553fe){var _0x9477c2={};_0x9477c2[_0x5553fe]={'$like':'%'+_0x1fbfaa['query']['filter']+'%'};return _0x9477c2;})});}_0x48cea8=_[_0x9de4('0x3b')]({},_0x48cea8,_0x1fbfaa['options']);return db[_0x9de4('0x54')][_0x9de4('0x40')](_0x48cea8);}})[_0x9de4('0x1f')](function(_0x4babed){if(_0x4babed){return db[_0x9de4('0x56')][_0x9de4('0x57')]({'where':{'id':_['map'](_0x4babed,_0x9de4('0x58')),'role':_0x9de4('0x59')},'attributes':['id',_0x9de4('0x25'),_0x9de4('0x5a'),_0x9de4('0x5b'),'createdAt']});}})[_0x9de4('0x1f')](function(_0x5c1d74){if(_0x5c1d74){return{'count':_0x5c1d74['count'],'rows':_[_0x9de4('0x27')](_0x5c1d74['rows'],function(_0x23a6b1){return{'membername':_0x23a6b1[_0x9de4('0x25')],'UserId':_0x23a6b1['id'],'queue_name':_0x39d686[_0x9de4('0x25')],'OpenchannelQueueId':_0x39d686['id'],'interface':util[_0x9de4('0x5c')](_0x9de4('0x5d'),_0x9de4('0x5e'),_0x23a6b1[_0x9de4('0x25')]),'penalty':0x0,'paused':_0x23a6b1['openchannelPause'],'createdAt':_0x23a6b1[_0x9de4('0x5f')],'updatedAt':_0x23a6b1[_0x9de4('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9de4('0x1f')](respondWithFilteredResult(_0x21e155,_0x48cea8))['catch'](handleError(_0x21e155,null));};exports[_0x9de4('0x60')]=function(_0x569d55,_0x3718d4,_0x4d614e){var _0x40edef={};var _0x1c33ea={};var _0x17a884;var _0x6bb1e2;return db[_0x9de4('0x28')][_0x9de4('0x53')]({'where':{'id':_0x569d55['params']['id']}})['then'](handleEntityNotFound(_0x3718d4,null))[_0x9de4('0x1f')](function(_0x156c73){if(_0x156c73){_0x17a884=_0x156c73;_0x1c33ea['model']=_['keys'](db[_0x9de4('0x61')][_0x9de4('0x29')]);_0x1c33ea[_0x9de4('0x2d')]=_['keys'](_0x569d55['query']);_0x1c33ea['filters']=_[_0x9de4('0x30')](_0x1c33ea[_0x9de4('0x45')],_0x1c33ea['query']);_0x40edef[_0x9de4('0x2f')]=_[_0x9de4('0x30')](_0x1c33ea['model'],qs[_0x9de4('0x31')](_0x569d55['query'][_0x9de4('0x31')]));_0x40edef[_0x9de4('0x2f')]=_0x40edef[_0x9de4('0x2f')][_0x9de4('0x32')]?_0x40edef[_0x9de4('0x2f')]:_0x1c33ea['model'];_0x40edef[_0x9de4('0x37')]=qs[_0x9de4('0x38')](_0x569d55[_0x9de4('0x2d')][_0x9de4('0x38')]);_0x40edef[_0x9de4('0x3c')]=qs[_0x9de4('0x2e')](_['pick'](_0x569d55[_0x9de4('0x2d')],_0x1c33ea[_0x9de4('0x2e')]));if(_0x569d55['query'][_0x9de4('0x3a')]){_0x40edef['where']=_[_0x9de4('0x3b')](_0x40edef['where'],{'$or':_[_0x9de4('0x27')](_0x40edef[_0x9de4('0x2f')],function(_0x3e6aa1){var _0x9b4eb3={};_0x9b4eb3[_0x3e6aa1]={'$like':'%'+_0x569d55[_0x9de4('0x2d')][_0x9de4('0x3a')]+'%'};return _0x9b4eb3;})});}_0x40edef=_[_0x9de4('0x3b')]({},_0x40edef,_0x569d55['options']);return _0x17a884['getTeams'](_0x40edef);}})['then'](function(_0x5d3669){if(_0x5d3669){_0x6bb1e2=_0x5d3669['length'];if(!_0x569d55[_0x9de4('0x2d')][_0x9de4('0x33')]('nolimit')){_0x40edef[_0x9de4('0x35')]=qs[_0x9de4('0x35')](_0x569d55[_0x9de4('0x2d')][_0x9de4('0x35')]);_0x40edef[_0x9de4('0x36')]=qs[_0x9de4('0x36')](_0x569d55[_0x9de4('0x2d')]['offset']);}return _0x17a884[_0x9de4('0x60')](_0x40edef);}})[_0x9de4('0x1f')](function(_0x2453c4){if(_0x2453c4){return _0x2453c4?{'count':_0x6bb1e2,'rows':_0x2453c4}:null;}})[_0x9de4('0x1f')](respondWithResult(_0x3718d4,null))[_0x9de4('0x42')](handleError(_0x3718d4,null));};exports[_0x9de4('0x62')]=function(_0x491b91,_0x357883,_0x5322d0){var _0x2ffc57=_0x491b91[_0x9de4('0x50')][_0x9de4('0x63')];return db[_0x9de4('0x61')][_0x9de4('0x40')]({'where':{'id':_0x2ffc57},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9de4('0x64'),'attributes':['id',_0x9de4('0x25'),_0x9de4('0x65'),'voicePause',_0x9de4('0x66')],'raw':!![]}]})[_0x9de4('0x1f')](function(_0x3f46fd){if(_0x3f46fd){var _0x96d766=_[_0x9de4('0x67')](_0x3f46fd,function(_0x17d824){var _0x414b46=_0x17d824[_0x9de4('0x20')]({'plain':!![]});return _0x414b46[_0x9de4('0x64')];});return db[_0x9de4('0x28')][_0x9de4('0x4b')]({'where':{'id':_0x491b91['params']['id']}})[_0x9de4('0x1f')](function(_0x408d3e){return db[_0x9de4('0x68')][_0x9de4('0x69')](function(_0x209d10){return _0x408d3e[_0x9de4('0x62')](_0x2ffc57,{'transaction':_0x209d10})[_0x9de4('0x1f')](function(){return BPromise[_0x9de4('0x6a')](_0x96d766,function(_0x5a6cd0){return db['UserOpenchannelQueue'][_0x9de4('0x6b')]({'where':{'UserId':_0x5a6cd0['id'],'OpenchannelQueueId':_0x491b91['params']['id']},'transaction':_0x209d10});});})['then'](function(){_0x96d766['forEach'](function(_0x91b74c){socket['emit'](_0x9de4('0x6c'),{'UserId':_0x91b74c['id'],'OpenchannelQueueId':_0x408d3e['id']});});});});});}})[_0x9de4('0x1f')](respondWithStatusCode(_0x357883,null))[_0x9de4('0x42')](handleError(_0x357883,null));};exports[_0x9de4('0x6d')]=function(_0x3e5047,_0x5cd6f7,_0x58ca45){return db[_0x9de4('0x61')]['findAll']({'where':{'id':_0x3e5047['query'][_0x9de4('0x63')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9de4('0x64'),'attributes':['id'],'raw':!![]}]})[_0x9de4('0x1f')](handleEntityNotFound(_0x5cd6f7,null))[_0x9de4('0x1f')](function(_0x4e06df){var _0xb4afed=_[_0x9de4('0x27')](_0x4e06df,'id');var _0x1ba9e1=[];var _0x5442fc=[];var _0x2e3a70=squel[_0x9de4('0x6e')]();_0x2e3a70[_0x9de4('0x6f')](_0x9de4('0x70'))[_0x9de4('0x71')](_0x9de4('0x72'),'tq')[_0x9de4('0x73')](_0x9de4('0x74'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x9de4('0x3c')](_0x9de4('0x75'),_0x3e5047[_0x9de4('0x43')]['id']);for(var _0x34c8a0=0x0;_0x34c8a0<_0x4e06df[_0x9de4('0x32')];_0x34c8a0+=0x1){let _0x29c345=_0x4e06df[_0x34c8a0];for(var _0x150750=0x0;_0x150750<_0x29c345['Agents']['length'];_0x150750+=0x1){let _0x40c1cc=_0x29c345['Agents'][_0x150750];var _0x473d13=_0x2e3a70[_0x9de4('0x76')]();_0x473d13[_0x9de4('0x3c')]('ut.UserId\x20=\x20?',_0x40c1cc['id']);_0x5442fc[_0x9de4('0x77')](db['sequelize']['query'](_0x473d13['toString'](),{'type':db[_0x9de4('0x68')][_0x9de4('0x78')][_0x9de4('0x79')]})['then'](function(_0x4737bd){if(_0x4737bd[_0x9de4('0x32')]===0x1){return _0x40c1cc['id'];}else{var _0x10c930=_[_0x9de4('0x7a')](_[_0x9de4('0x27')](_0x4737bd,_0x9de4('0x7b')),function(_0x4c3f28){return _['includes'](_0xb4afed,_0x4c3f28);});if(_0x10c930){return _0x40c1cc['id'];}}}));}}return BPromise[_0x9de4('0x7c')](_0x5442fc)[_0x9de4('0x1f')](function(_0xaf27c3){_0x1ba9e1=_(_0x1ba9e1)[_0x9de4('0x7d')](_0xaf27c3)[_0x9de4('0x7e')]()[_0x9de4('0x7f')]();return db[_0x9de4('0x28')][_0x9de4('0x4b')]({'where':{'id':_0x3e5047[_0x9de4('0x43')]['id']}})[_0x9de4('0x1f')](function(_0x51ae10){return db[_0x9de4('0x68')][_0x9de4('0x69')](function(_0x2a7d75){return _0x51ae10[_0x9de4('0x6d')](_0x3e5047[_0x9de4('0x2d')][_0x9de4('0x63')],{'transaction':_0x2a7d75})[_0x9de4('0x1f')](function(){if(!_[_0x9de4('0x80')](_0x1ba9e1)){return _0x51ae10['removeAgents'](_0x1ba9e1,{'transaction':_0x2a7d75});}})['then'](function(){_0x1ba9e1[_0x9de4('0x81')](function(_0x1fa1f3){socket['emit']('userOpenchannelQueue:remove',{'UserId':_0x1fa1f3,'OpenchannelQueueId':_0x51ae10['id']});});});});});});})['then'](respondWithStatusCode(_0x5cd6f7,null))[_0x9de4('0x42')](handleError(_0x5cd6f7,null));};exports[_0x9de4('0x82')]=function(_0x1aa74b,_0x3baf4e,_0x5f37e7){return db[_0x9de4('0x28')][_0x9de4('0x4b')]({'where':{'id':_0x1aa74b[_0x9de4('0x43')]['id']}})[_0x9de4('0x1f')](handleEntityNotFound(_0x3baf4e,null))[_0x9de4('0x1f')](function(_0x1d4584){if(_0x1d4584){return _0x1d4584[_0x9de4('0x82')](_0x1aa74b[_0x9de4('0x50')][_0x9de4('0x63')],_[_0x9de4('0x83')](_0x1aa74b[_0x9de4('0x50')],['ids','id'])||{})['spread'](function(_0x13460e){for(var _0x56663f=0x0;_0x56663f<_0x1aa74b['body'][_0x9de4('0x63')][_0x9de4('0x32')];_0x56663f+=0x1){socket[_0x9de4('0x84')](_0x9de4('0x6c'),{'UserId':_0x1aa74b[_0x9de4('0x50')][_0x9de4('0x63')][_0x56663f],'OpenchannelQueueId':_0x1aa74b[_0x9de4('0x43')]['id']});}return _0x13460e;});}})[_0x9de4('0x1f')](respondWithResult(_0x3baf4e,null))['catch'](handleError(_0x3baf4e,null));};exports[_0x9de4('0x85')]=function(_0x3fd98a,_0x116c9c,_0x1ba27c){return db[_0x9de4('0x28')][_0x9de4('0x4b')]({'where':{'id':_0x3fd98a[_0x9de4('0x43')]['id']}})[_0x9de4('0x1f')](handleEntityNotFound(_0x116c9c,null))[_0x9de4('0x1f')](function(_0x459bfc){if(_0x459bfc){return _0x459bfc['removeAgents'](_0x3fd98a[_0x9de4('0x2d')][_0x9de4('0x63')])[_0x9de4('0x1f')](function(){if(_['isArray'](_0x3fd98a[_0x9de4('0x2d')][_0x9de4('0x63')])){for(var _0x3c97d4=0x0;_0x3c97d4<_0x3fd98a[_0x9de4('0x2d')][_0x9de4('0x63')]['length'];_0x3c97d4+=0x1){socket['emit'](_0x9de4('0x86'),{'UserId':Number(_0x3fd98a[_0x9de4('0x2d')][_0x9de4('0x63')][_0x3c97d4]),'OpenchannelQueueId':Number(_0x3fd98a[_0x9de4('0x43')]['id'])});}}else{socket[_0x9de4('0x84')]('userOpenchannelQueue:remove',{'UserId':Number(_0x3fd98a[_0x9de4('0x2d')]['ids']),'OpenchannelQueueId':Number(_0x3fd98a[_0x9de4('0x43')]['id'])});}});}})[_0x9de4('0x1f')](respondWithStatusCode(_0x116c9c,null))['catch'](handleError(_0x116c9c,null));};exports[_0x9de4('0x87')]=function(_0xc29e5d,_0x132fae,_0x59ad38){var _0x2dd99f={};var _0x5ea042={};var _0x2dca51;var _0x5ddea7;return db['OpenchannelQueue'][_0x9de4('0x53')]({'where':{'id':_0xc29e5d[_0x9de4('0x43')]['id']}})[_0x9de4('0x1f')](handleEntityNotFound(_0x132fae,null))['then'](function(_0x33dc3c){if(_0x33dc3c){_0x2dca51=_0x33dc3c;_0x5ea042['model']=_[_0x9de4('0x44')](db[_0x9de4('0x56')][_0x9de4('0x29')]);_0x5ea042[_0x9de4('0x2d')]=_[_0x9de4('0x44')](_0xc29e5d[_0x9de4('0x2d')]);_0x5ea042[_0x9de4('0x2e')]=_[_0x9de4('0x30')](_0x5ea042[_0x9de4('0x45')],_0x5ea042[_0x9de4('0x2d')]);_0x2dd99f[_0x9de4('0x2f')]=_[_0x9de4('0x30')](_0x5ea042['model'],qs['fields'](_0xc29e5d[_0x9de4('0x2d')]['fields']));_0x2dd99f[_0x9de4('0x2f')]=_0x2dd99f['attributes'][_0x9de4('0x32')]?_0x2dd99f['attributes']:_0x5ea042[_0x9de4('0x45')];_0x2dd99f[_0x9de4('0x37')]=qs[_0x9de4('0x38')](_0xc29e5d[_0x9de4('0x2d')][_0x9de4('0x38')]);_0x2dd99f[_0x9de4('0x3c')]=qs[_0x9de4('0x2e')](_[_0x9de4('0x39')](_0xc29e5d[_0x9de4('0x2d')],_0x5ea042[_0x9de4('0x2e')]));if(_0xc29e5d['query']['filter']){_0x2dd99f[_0x9de4('0x3c')]=_['merge'](_0x2dd99f[_0x9de4('0x3c')],{'$or':_[_0x9de4('0x27')](_0x2dd99f[_0x9de4('0x2f')],function(_0x1a2891){var _0x338961={};_0x338961[_0x1a2891]={'$like':'%'+_0xc29e5d[_0x9de4('0x2d')][_0x9de4('0x3a')]+'%'};return _0x338961;})});}_0x2dd99f=_[_0x9de4('0x3b')]({},_0x2dd99f,_0xc29e5d[_0x9de4('0x3d')]);return _0x2dca51['getAgents'](_0x2dd99f);}})[_0x9de4('0x1f')](function(_0x5c2e8f){if(_0x5c2e8f){_0x5ddea7=_0x5c2e8f[_0x9de4('0x32')];if(!_0xc29e5d['query']['hasOwnProperty'](_0x9de4('0x34'))){_0x2dd99f[_0x9de4('0x35')]=qs[_0x9de4('0x35')](_0xc29e5d[_0x9de4('0x2d')][_0x9de4('0x35')]);_0x2dd99f[_0x9de4('0x36')]=qs['offset'](_0xc29e5d[_0x9de4('0x2d')][_0x9de4('0x36')]);}return _0x2dca51[_0x9de4('0x87')](_0x2dd99f);}})[_0x9de4('0x1f')](function(_0x5c619f){if(_0x5c619f){return _0x5c619f?{'count':_0x5ddea7,'rows':_0x5c619f}:null;}})[_0x9de4('0x1f')](respondWithResult(_0x132fae,null))[_0x9de4('0x42')](handleError(_0x132fae,null));}; \ No newline at end of file +var _0xf6fb=['compact','value','removeTeams','userOpenchannelQueue:remove','addAgents','spread','userOpenchannelQueue:save','removeAgents','getAgents','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','count','offset','limit','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','name','index','map','OpenchannelQueue','rawAttributes','fieldName','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','show','params','keys','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelQueues','UserProfileSection','userProfileId','update','describe','getMembers','findOne','OpenchannelQueueId','UserOpenchannelQueue','findAll','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','format','SIP','createdAt','getTeams','addTeams','online','voicePause','interface','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','ids','select','tq.TeamId','from','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','QueryTypes','every','includes','all','union'];(function(_0x269e2d,_0x561780){var _0x42c9e2=function(_0x3c0dbb){while(--_0x3c0dbb){_0x269e2d['push'](_0x269e2d['shift']());}};_0x42c9e2(++_0x561780);}(_0xf6fb,0x111));var _0xbf6f=function(_0x30285a,_0x1de145){_0x30285a=_0x30285a-0x0;var _0x45023f=_0xf6fb[_0x30285a];return _0x45023f;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xbf6f('0x0'));var zipdir=require(_0xbf6f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbf6f('0x2'));var moment=require(_0xbf6f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbf6f('0x4'));var util=require('util');var path=require(_0xbf6f('0x5'));var sox=require(_0xbf6f('0x6'));var csv=require(_0xbf6f('0x7'));var ejs=require(_0xbf6f('0x8'));var fs=require('fs');var _=require(_0xbf6f('0x9'));var squel=require(_0xbf6f('0xa'));var crypto=require(_0xbf6f('0xb'));var jsforce=require(_0xbf6f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xbf6f('0x7'));var querystring=require(_0xbf6f('0xd'));var Papa=require(_0xbf6f('0xe'));var Redis=require(_0xbf6f('0xf'));var authService=require(_0xbf6f('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbf6f('0x11'));var logger=require(_0xbf6f('0x12'))(_0xbf6f('0x13'));var utils=require('../../config/utils');var config=require(_0xbf6f('0x14'));var db=require('../../mysqldb')['db'];config[_0xbf6f('0x15')]=_[_0xbf6f('0x16')](config[_0xbf6f('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0xbf6f('0x17'))(new Redis(config[_0xbf6f('0x15')]));require(_0xbf6f('0x18'))[_0xbf6f('0x19')](socket);function respondWithStatusCode(_0xce557a,_0x1dd2f1){_0x1dd2f1=_0x1dd2f1||0xcc;return function(_0x5100d4){if(_0x5100d4){return _0xce557a[_0xbf6f('0x1a')](_0x1dd2f1);}return _0xce557a[_0xbf6f('0x1b')](_0x1dd2f1)[_0xbf6f('0x1c')]();};}function respondWithResult(_0x40ad56,_0x270ec6){_0x270ec6=_0x270ec6||0xc8;return function(_0x2abe87){if(_0x2abe87){return _0x40ad56[_0xbf6f('0x1b')](_0x270ec6)['json'](_0x2abe87);}};}function respondWithFilteredResult(_0x4b2006,_0x734fe8){return function(_0x1a37bd){if(_0x1a37bd){var _0x21b485=_0x1a37bd[_0xbf6f('0x1d')],_0x4b3c33=_0x734fe8[_0xbf6f('0x1e')],_0x56b4da=_0x734fe8[_0xbf6f('0x1e')]+_0x734fe8[_0xbf6f('0x1f')],_0x2a0537;if(_0x56b4da>=_0x21b485){_0x56b4da=_0x21b485;_0x2a0537=0xc8;}else{_0x2a0537=0xce;}_0x4b2006['status'](_0x2a0537);return _0x4b2006['set'](_0xbf6f('0x20'),_0x4b3c33+'-'+_0x56b4da+'/'+_0x21b485)['json'](_0x1a37bd);}return null;};}function patchUpdates(_0x3bd472){return function(_0x117a43){try{jsonpatch[_0xbf6f('0x21')](_0x117a43,_0x3bd472,!![]);}catch(_0x4e71e9){return BPromise[_0xbf6f('0x22')](_0x4e71e9);}return _0x117a43[_0xbf6f('0x23')]();};}function saveUpdates(_0x3a0087,_0x528bf0){return function(_0x446857){if(_0x446857){return _0x446857['update'](_0x3a0087)[_0xbf6f('0x24')](function(_0xb9e8bc){return _0xb9e8bc;});}return null;};}function removeEntity(_0xba4b6a,_0x49979a){return function(_0x28d8f6){if(_0x28d8f6){return _0x28d8f6[_0xbf6f('0x25')]()[_0xbf6f('0x24')](function(){var _0x17fe26=_0x28d8f6[_0xbf6f('0x26')]({'plain':!![]});var _0x442f60='OpenchannelQueues';return db[_0xbf6f('0x27')][_0xbf6f('0x25')]({'where':{'type':_0x442f60,'resourceId':_0x17fe26['id']}})['then'](function(){return _0x28d8f6;});})['then'](function(){_0xba4b6a['status'](0xcc)[_0xbf6f('0x1c')]();});}};}function handleEntityNotFound(_0x588fbe,_0x3588c0){return function(_0x153304){if(!_0x153304){_0x588fbe[_0xbf6f('0x1a')](0x194);}return _0x153304;};}function handleError(_0x34cd97,_0xb440e8){_0xb440e8=_0xb440e8||0x1f4;return function(_0x237b67){logger[_0xbf6f('0x28')](_0x237b67['stack']);if(_0x237b67['name']){delete _0x237b67[_0xbf6f('0x29')];}_0x34cd97[_0xbf6f('0x1b')](_0xb440e8)['send'](_0x237b67);};}exports[_0xbf6f('0x2a')]=function(_0x4f2430,_0x36ff7e){var _0x386911={},_0x7f92e9={},_0x44f7fe={'count':0x0,'rows':[]};var _0x37bf96=_[_0xbf6f('0x2b')](db[_0xbf6f('0x2c')][_0xbf6f('0x2d')],function(_0xed5db){return{'name':_0xed5db[_0xbf6f('0x2e')],'type':_0xed5db['type']['key']};});_0x7f92e9[_0xbf6f('0x2f')]=_[_0xbf6f('0x2b')](_0x37bf96,_0xbf6f('0x29'));_0x7f92e9[_0xbf6f('0x30')]=_['keys'](_0x4f2430[_0xbf6f('0x30')]);_0x7f92e9[_0xbf6f('0x31')]=_[_0xbf6f('0x32')](_0x7f92e9[_0xbf6f('0x2f')],_0x7f92e9[_0xbf6f('0x30')]);_0x386911['attributes']=_[_0xbf6f('0x32')](_0x7f92e9[_0xbf6f('0x2f')],qs[_0xbf6f('0x33')](_0x4f2430['query'][_0xbf6f('0x33')]));_0x386911['attributes']=_0x386911[_0xbf6f('0x34')][_0xbf6f('0x35')]?_0x386911[_0xbf6f('0x34')]:_0x7f92e9[_0xbf6f('0x2f')];if(!_0x4f2430[_0xbf6f('0x30')][_0xbf6f('0x36')](_0xbf6f('0x37'))){_0x386911[_0xbf6f('0x1f')]=qs[_0xbf6f('0x1f')](_0x4f2430[_0xbf6f('0x30')][_0xbf6f('0x1f')]);_0x386911[_0xbf6f('0x1e')]=qs['offset'](_0x4f2430[_0xbf6f('0x30')][_0xbf6f('0x1e')]);}_0x386911[_0xbf6f('0x38')]=qs[_0xbf6f('0x39')](_0x4f2430[_0xbf6f('0x30')][_0xbf6f('0x39')]);_0x386911[_0xbf6f('0x3a')]=qs['filters'](_[_0xbf6f('0x3b')](_0x4f2430[_0xbf6f('0x30')],_0x7f92e9[_0xbf6f('0x31')]));if(_0x4f2430['query'][_0xbf6f('0x3c')]){_0x386911[_0xbf6f('0x3a')]=_[_0xbf6f('0x3d')](_0x386911['where'],{'$or':_[_0xbf6f('0x2b')](_0x37bf96,function(_0x26da28){if(_0x26da28[_0xbf6f('0x3e')]!==_0xbf6f('0x3f')){var _0x30732c={};_0x30732c[_0x26da28[_0xbf6f('0x29')]]={'$like':'%'+_0x4f2430[_0xbf6f('0x30')][_0xbf6f('0x3c')]+'%'};return _0x30732c;}})});}_0x386911=_[_0xbf6f('0x3d')]({},_0x386911,_0x4f2430[_0xbf6f('0x40')]);var _0x126376={'where':_0x386911[_0xbf6f('0x3a')]};return db[_0xbf6f('0x2c')][_0xbf6f('0x1d')](_0x126376)['then'](function(_0x30f8ce){_0x44f7fe['count']=_0x30f8ce;if(_0x4f2430[_0xbf6f('0x30')][_0xbf6f('0x41')]){_0x386911['include']=[{'all':!![]}];}return db[_0xbf6f('0x2c')]['findAll'](_0x386911);})[_0xbf6f('0x24')](function(_0x186757){_0x44f7fe[_0xbf6f('0x42')]=_0x186757;return _0x44f7fe;})[_0xbf6f('0x24')](respondWithFilteredResult(_0x36ff7e,_0x386911))[_0xbf6f('0x43')](handleError(_0x36ff7e,null));};exports[_0xbf6f('0x44')]=function(_0x3b5f5b,_0x2f184a){var _0x39727e={'raw':!![],'where':{'id':_0x3b5f5b[_0xbf6f('0x45')]['id']}},_0x1c5c1d={};_0x1c5c1d[_0xbf6f('0x2f')]=_[_0xbf6f('0x46')](db[_0xbf6f('0x2c')][_0xbf6f('0x2d')]);_0x1c5c1d[_0xbf6f('0x30')]=_[_0xbf6f('0x46')](_0x3b5f5b[_0xbf6f('0x30')]);_0x1c5c1d[_0xbf6f('0x31')]=_[_0xbf6f('0x32')](_0x1c5c1d[_0xbf6f('0x2f')],_0x1c5c1d['query']);_0x39727e[_0xbf6f('0x34')]=_[_0xbf6f('0x32')](_0x1c5c1d['model'],qs[_0xbf6f('0x33')](_0x3b5f5b[_0xbf6f('0x30')][_0xbf6f('0x33')]));_0x39727e[_0xbf6f('0x34')]=_0x39727e['attributes'][_0xbf6f('0x35')]?_0x39727e['attributes']:_0x1c5c1d[_0xbf6f('0x2f')];if(_0x3b5f5b[_0xbf6f('0x30')][_0xbf6f('0x41')]){_0x39727e[_0xbf6f('0x47')]=[{'all':!![]}];}_0x39727e=_[_0xbf6f('0x3d')]({},_0x39727e,_0x3b5f5b['options']);return db[_0xbf6f('0x2c')][_0xbf6f('0x48')](_0x39727e)[_0xbf6f('0x24')](handleEntityNotFound(_0x2f184a,null))[_0xbf6f('0x24')](respondWithResult(_0x2f184a,null))['catch'](handleError(_0x2f184a,null));};exports['create']=function(_0x3b62e5,_0x89536e){return db[_0xbf6f('0x2c')][_0xbf6f('0x49')](_0x3b62e5[_0xbf6f('0x4a')],{})[_0xbf6f('0x24')](function(_0x4a5ee8){var _0x396272=_0x3b62e5[_0xbf6f('0x4b')][_0xbf6f('0x26')]({'plain':!![]});if(!_0x396272)throw new Error(_0xbf6f('0x4c'));if(_0x396272[_0xbf6f('0x4d')]===_0xbf6f('0x4b')){var _0x4a293=_0x4a5ee8[_0xbf6f('0x26')]({'plain':!![]});var _0x1ed880=_0xbf6f('0x4e');return db[_0xbf6f('0x4f')][_0xbf6f('0x48')]({'where':{'name':_0x1ed880,'userProfileId':_0x396272[_0xbf6f('0x50')]},'raw':!![]})[_0xbf6f('0x24')](function(_0xa5edf3){if(_0xa5edf3&&_0xa5edf3['autoAssociation']===0x0){return db[_0xbf6f('0x27')][_0xbf6f('0x49')]({'name':_0x4a293['name'],'resourceId':_0x4a293['id'],'type':_0xa5edf3[_0xbf6f('0x29')],'sectionId':_0xa5edf3['id']},{})[_0xbf6f('0x24')](function(){return _0x4a5ee8;});}else{return _0x4a5ee8;}})[_0xbf6f('0x43')](function(_0x45afea){logger[_0xbf6f('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x45afea);throw _0x45afea;});}return _0x4a5ee8;})[_0xbf6f('0x24')](respondWithResult(_0x89536e,0xc9))['catch'](handleError(_0x89536e,null));};exports[_0xbf6f('0x51')]=function(_0x2e5a1a,_0x497d9a){if(_0x2e5a1a[_0xbf6f('0x4a')]['id']){delete _0x2e5a1a[_0xbf6f('0x4a')]['id'];}return db[_0xbf6f('0x2c')][_0xbf6f('0x48')]({'where':{'id':_0x2e5a1a[_0xbf6f('0x45')]['id']}})[_0xbf6f('0x24')](handleEntityNotFound(_0x497d9a,null))[_0xbf6f('0x24')](saveUpdates(_0x2e5a1a[_0xbf6f('0x4a')],null))[_0xbf6f('0x24')](respondWithResult(_0x497d9a,null))[_0xbf6f('0x43')](handleError(_0x497d9a,null));};exports['destroy']=function(_0x3a1b3a,_0x2e80a5){return db[_0xbf6f('0x2c')]['find']({'where':{'id':_0x3a1b3a[_0xbf6f('0x45')]['id']}})[_0xbf6f('0x24')](handleEntityNotFound(_0x2e80a5,null))[_0xbf6f('0x24')](removeEntity(_0x2e80a5,null))[_0xbf6f('0x43')](handleError(_0x2e80a5,null));};exports[_0xbf6f('0x52')]=function(_0x1f08e2,_0x2949c5){return db[_0xbf6f('0x2c')][_0xbf6f('0x52')]()['then'](respondWithResult(_0x2949c5,null))[_0xbf6f('0x43')](handleError(_0x2949c5,null));};exports[_0xbf6f('0x53')]=function(_0x1040a8,_0x575beb,_0x39699b){var _0x32d825={'raw':!![],'where':{}},_0xd0c897={},_0xa4f86f;return db['OpenchannelQueue'][_0xbf6f('0x54')]({'where':{'id':_0x1040a8[_0xbf6f('0x45')]['id']}})[_0xbf6f('0x24')](handleEntityNotFound(_0x575beb,null))[_0xbf6f('0x24')](function(_0x54d268){if(_0x54d268){_0xa4f86f=_0x54d268[_0xbf6f('0x26')]({'plain':!![]});_0xd0c897[_0xbf6f('0x2f')]=_[_0xbf6f('0x46')](db['UserOpenchannelQueue'][_0xbf6f('0x2d')]);_0xd0c897[_0xbf6f('0x30')]=_['keys'](_0x1040a8[_0xbf6f('0x30')]);_0xd0c897[_0xbf6f('0x31')]=_[_0xbf6f('0x32')](_0xd0c897[_0xbf6f('0x2f')],_0xd0c897[_0xbf6f('0x30')]);_0x32d825[_0xbf6f('0x34')]=_[_0xbf6f('0x32')](_0xd0c897['model'],qs[_0xbf6f('0x33')](_0x1040a8[_0xbf6f('0x30')][_0xbf6f('0x33')]));_0x32d825[_0xbf6f('0x34')]=_0x32d825['attributes'][_0xbf6f('0x35')]?_0x32d825['attributes']:_0xd0c897['model'];if(!_0x1040a8[_0xbf6f('0x30')][_0xbf6f('0x36')]('nolimit')){_0x32d825[_0xbf6f('0x1f')]=qs[_0xbf6f('0x1f')](_0x1040a8[_0xbf6f('0x30')][_0xbf6f('0x1f')]);_0x32d825[_0xbf6f('0x1e')]=qs[_0xbf6f('0x1e')](_0x1040a8['query'][_0xbf6f('0x1e')]);}_0x32d825[_0xbf6f('0x38')]=qs[_0xbf6f('0x39')](_0x1040a8[_0xbf6f('0x30')][_0xbf6f('0x39')]);_0x32d825[_0xbf6f('0x3a')]=qs[_0xbf6f('0x31')](_['pick'](_0x1040a8['query'],_0xd0c897[_0xbf6f('0x31')]));_0x32d825['where'][_0xbf6f('0x55')]=_0x54d268['id'];if(_0x1040a8[_0xbf6f('0x30')][_0xbf6f('0x3c')]){_0x32d825[_0xbf6f('0x3a')]=_[_0xbf6f('0x3d')](_0x32d825['where'],{'$or':_[_0xbf6f('0x2b')](_0x32d825[_0xbf6f('0x34')],function(_0x346567){var _0x596f34={};_0x596f34[_0x346567]={'$like':'%'+_0x1040a8[_0xbf6f('0x30')]['filter']+'%'};return _0x596f34;})});}_0x32d825=_[_0xbf6f('0x3d')]({},_0x32d825,_0x1040a8[_0xbf6f('0x40')]);return db[_0xbf6f('0x56')][_0xbf6f('0x57')](_0x32d825);}})[_0xbf6f('0x24')](function(_0x462519){if(_0x462519){return db[_0xbf6f('0x58')][_0xbf6f('0x59')]({'where':{'id':_[_0xbf6f('0x2b')](_0x462519,_0xbf6f('0x5a')),'role':_0xbf6f('0x5b')},'attributes':['id',_0xbf6f('0x29'),_0xbf6f('0x5c'),_0xbf6f('0x5d'),'createdAt']});}})[_0xbf6f('0x24')](function(_0x193ae2){if(_0x193ae2){return{'count':_0x193ae2[_0xbf6f('0x1d')],'rows':_[_0xbf6f('0x2b')](_0x193ae2['rows'],function(_0x340b19){return{'membername':_0x340b19[_0xbf6f('0x29')],'UserId':_0x340b19['id'],'queue_name':_0xa4f86f['name'],'OpenchannelQueueId':_0xa4f86f['id'],'interface':util[_0xbf6f('0x5e')]('%s/%s',_0xbf6f('0x5f'),_0x340b19['name']),'penalty':0x0,'paused':_0x340b19[_0xbf6f('0x5c')],'createdAt':_0x340b19[_0xbf6f('0x60')],'updatedAt':_0x340b19[_0xbf6f('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xbf6f('0x24')](respondWithFilteredResult(_0x575beb,_0x32d825))[_0xbf6f('0x43')](handleError(_0x575beb,null));};exports['getTeams']=function(_0x72260,_0x48a919,_0x5ba3f2){var _0x5641e0={};var _0x291966={};var _0x3df0fe;var _0x58011d;return db[_0xbf6f('0x2c')][_0xbf6f('0x54')]({'where':{'id':_0x72260[_0xbf6f('0x45')]['id']}})[_0xbf6f('0x24')](handleEntityNotFound(_0x48a919,null))[_0xbf6f('0x24')](function(_0x42aac9){if(_0x42aac9){_0x3df0fe=_0x42aac9;_0x291966[_0xbf6f('0x2f')]=_[_0xbf6f('0x46')](db['Team'][_0xbf6f('0x2d')]);_0x291966[_0xbf6f('0x30')]=_[_0xbf6f('0x46')](_0x72260[_0xbf6f('0x30')]);_0x291966[_0xbf6f('0x31')]=_[_0xbf6f('0x32')](_0x291966[_0xbf6f('0x2f')],_0x291966[_0xbf6f('0x30')]);_0x5641e0[_0xbf6f('0x34')]=_[_0xbf6f('0x32')](_0x291966['model'],qs[_0xbf6f('0x33')](_0x72260['query'][_0xbf6f('0x33')]));_0x5641e0[_0xbf6f('0x34')]=_0x5641e0[_0xbf6f('0x34')]['length']?_0x5641e0[_0xbf6f('0x34')]:_0x291966[_0xbf6f('0x2f')];_0x5641e0[_0xbf6f('0x38')]=qs[_0xbf6f('0x39')](_0x72260[_0xbf6f('0x30')][_0xbf6f('0x39')]);_0x5641e0['where']=qs[_0xbf6f('0x31')](_['pick'](_0x72260[_0xbf6f('0x30')],_0x291966[_0xbf6f('0x31')]));if(_0x72260[_0xbf6f('0x30')]['filter']){_0x5641e0['where']=_[_0xbf6f('0x3d')](_0x5641e0[_0xbf6f('0x3a')],{'$or':_[_0xbf6f('0x2b')](_0x5641e0[_0xbf6f('0x34')],function(_0x5e7342){var _0x541aae={};_0x541aae[_0x5e7342]={'$like':'%'+_0x72260[_0xbf6f('0x30')][_0xbf6f('0x3c')]+'%'};return _0x541aae;})});}_0x5641e0=_[_0xbf6f('0x3d')]({},_0x5641e0,_0x72260[_0xbf6f('0x40')]);return _0x3df0fe[_0xbf6f('0x61')](_0x5641e0);}})[_0xbf6f('0x24')](function(_0x473fac){if(_0x473fac){_0x58011d=_0x473fac['length'];if(!_0x72260[_0xbf6f('0x30')]['hasOwnProperty']('nolimit')){_0x5641e0[_0xbf6f('0x1f')]=qs['limit'](_0x72260[_0xbf6f('0x30')][_0xbf6f('0x1f')]);_0x5641e0[_0xbf6f('0x1e')]=qs[_0xbf6f('0x1e')](_0x72260[_0xbf6f('0x30')][_0xbf6f('0x1e')]);}return _0x3df0fe['getTeams'](_0x5641e0);}})[_0xbf6f('0x24')](function(_0xdd5678){if(_0xdd5678){return _0xdd5678?{'count':_0x58011d,'rows':_0xdd5678}:null;}})[_0xbf6f('0x24')](respondWithResult(_0x48a919,null))[_0xbf6f('0x43')](handleError(_0x48a919,null));};exports[_0xbf6f('0x62')]=function(_0x3da311,_0x514413,_0x40ef92){var _0x216582=_0x3da311[_0xbf6f('0x4a')]['ids'];return db['Team'][_0xbf6f('0x57')]({'where':{'id':_0x216582},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0xbf6f('0x63'),_0xbf6f('0x64'),_0xbf6f('0x65')],'raw':!![]}]})['then'](function(_0x4286ef){if(_0x4286ef){var _0x401122=_['flatMap'](_0x4286ef,function(_0x5ed81d){var _0x1e99d0=_0x5ed81d[_0xbf6f('0x26')]({'plain':!![]});return _0x1e99d0[_0xbf6f('0x66')];});return db[_0xbf6f('0x2c')][_0xbf6f('0x48')]({'where':{'id':_0x3da311[_0xbf6f('0x45')]['id']}})[_0xbf6f('0x24')](function(_0x10b503){return db[_0xbf6f('0x67')][_0xbf6f('0x68')](function(_0x11cf95){return _0x10b503[_0xbf6f('0x62')](_0x216582,{'transaction':_0x11cf95})['then'](function(){return BPromise[_0xbf6f('0x69')](_0x401122,function(_0x26e6f6){return db[_0xbf6f('0x56')][_0xbf6f('0x6a')]({'where':{'UserId':_0x26e6f6['id'],'OpenchannelQueueId':_0x3da311[_0xbf6f('0x45')]['id']},'transaction':_0x11cf95});});})[_0xbf6f('0x24')](function(){_0x401122[_0xbf6f('0x6b')](function(_0x371579){socket[_0xbf6f('0x6c')]('userOpenchannelQueue:save',{'UserId':_0x371579['id'],'OpenchannelQueueId':_0x10b503['id']});});});});});}})[_0xbf6f('0x24')](respondWithStatusCode(_0x514413,null))[_0xbf6f('0x43')](handleError(_0x514413,null));};exports['removeTeams']=function(_0x1961fd,_0xd04e05,_0x1ded6c){return db['Team']['findAll']({'where':{'id':_0x1961fd[_0xbf6f('0x30')][_0xbf6f('0x6d')]},'attributes':['id'],'include':[{'model':db[_0xbf6f('0x58')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xbf6f('0x24')](handleEntityNotFound(_0xd04e05,null))['then'](function(_0xf023f4){var _0x4c978e=_[_0xbf6f('0x2b')](_0xf023f4,'id');var _0xd2c6af=[];var _0x2dd70f=[];var _0x5240db=squel[_0xbf6f('0x6e')]();_0x5240db['field'](_0xbf6f('0x6f'))[_0xbf6f('0x70')](_0xbf6f('0x71'),'tq')['join'](_0xbf6f('0x72'),'ut',_0xbf6f('0x73'))[_0xbf6f('0x3a')]('OpenchannelQueueId\x20=\x20?',_0x1961fd[_0xbf6f('0x45')]['id']);for(var _0x18f196=0x0;_0x18f196<_0xf023f4[_0xbf6f('0x35')];_0x18f196+=0x1){let _0x37fcbf=_0xf023f4[_0x18f196];for(var _0x1e6fd3=0x0;_0x1e6fd3<_0x37fcbf[_0xbf6f('0x66')][_0xbf6f('0x35')];_0x1e6fd3+=0x1){let _0x4f0b9a=_0x37fcbf['Agents'][_0x1e6fd3];var _0x9f768f=_0x5240db[_0xbf6f('0x74')]();_0x9f768f[_0xbf6f('0x3a')](_0xbf6f('0x75'),_0x4f0b9a['id']);_0x2dd70f['push'](db[_0xbf6f('0x67')][_0xbf6f('0x30')](_0x9f768f['toString'](),{'type':db[_0xbf6f('0x67')][_0xbf6f('0x76')]['SELECT']})[_0xbf6f('0x24')](function(_0x3d631d){if(_0x3d631d['length']===0x1){return _0x4f0b9a['id'];}else{var _0x495409=_[_0xbf6f('0x77')](_[_0xbf6f('0x2b')](_0x3d631d,'TeamId'),function(_0x3354c3){return _[_0xbf6f('0x78')](_0x4c978e,_0x3354c3);});if(_0x495409){return _0x4f0b9a['id'];}}}));}}return BPromise[_0xbf6f('0x79')](_0x2dd70f)['then'](function(_0x311a7a){_0xd2c6af=_(_0xd2c6af)[_0xbf6f('0x7a')](_0x311a7a)[_0xbf6f('0x7b')]()[_0xbf6f('0x7c')]();return db['OpenchannelQueue'][_0xbf6f('0x48')]({'where':{'id':_0x1961fd[_0xbf6f('0x45')]['id']}})[_0xbf6f('0x24')](function(_0x5d3cc9){return db['sequelize'][_0xbf6f('0x68')](function(_0x139a21){return _0x5d3cc9[_0xbf6f('0x7d')](_0x1961fd[_0xbf6f('0x30')]['ids'],{'transaction':_0x139a21})[_0xbf6f('0x24')](function(){if(!_['isEmpty'](_0xd2c6af)){return _0x5d3cc9['removeAgents'](_0xd2c6af,{'transaction':_0x139a21});}})[_0xbf6f('0x24')](function(){_0xd2c6af[_0xbf6f('0x6b')](function(_0x3beaca){socket['emit'](_0xbf6f('0x7e'),{'UserId':_0x3beaca,'OpenchannelQueueId':_0x5d3cc9['id']});});});});});});})['then'](respondWithStatusCode(_0xd04e05,null))[_0xbf6f('0x43')](handleError(_0xd04e05,null));};exports[_0xbf6f('0x7f')]=function(_0x3e2664,_0x76da8f,_0x18e147){return db[_0xbf6f('0x2c')]['find']({'where':{'id':_0x3e2664[_0xbf6f('0x45')]['id']}})[_0xbf6f('0x24')](handleEntityNotFound(_0x76da8f,null))['then'](function(_0x1e0df2){if(_0x1e0df2){return _0x1e0df2['addAgents'](_0x3e2664[_0xbf6f('0x4a')][_0xbf6f('0x6d')],_['omit'](_0x3e2664[_0xbf6f('0x4a')],[_0xbf6f('0x6d'),'id'])||{})[_0xbf6f('0x80')](function(_0x1d302b){for(var _0x4b3497=0x0;_0x4b3497<_0x3e2664[_0xbf6f('0x4a')][_0xbf6f('0x6d')][_0xbf6f('0x35')];_0x4b3497+=0x1){socket[_0xbf6f('0x6c')](_0xbf6f('0x81'),{'UserId':_0x3e2664['body'][_0xbf6f('0x6d')][_0x4b3497],'OpenchannelQueueId':_0x3e2664[_0xbf6f('0x45')]['id']});}return _0x1d302b;});}})[_0xbf6f('0x24')](respondWithResult(_0x76da8f,null))[_0xbf6f('0x43')](handleError(_0x76da8f,null));};exports['removeAgents']=function(_0x183f6c,_0x477fc9,_0x49b9f3){return db[_0xbf6f('0x2c')][_0xbf6f('0x48')]({'where':{'id':_0x183f6c[_0xbf6f('0x45')]['id']}})[_0xbf6f('0x24')](handleEntityNotFound(_0x477fc9,null))[_0xbf6f('0x24')](function(_0x5527d4){if(_0x5527d4){return _0x5527d4[_0xbf6f('0x82')](_0x183f6c[_0xbf6f('0x30')][_0xbf6f('0x6d')])[_0xbf6f('0x24')](function(){if(_['isArray'](_0x183f6c[_0xbf6f('0x30')][_0xbf6f('0x6d')])){for(var _0x454206=0x0;_0x454206<_0x183f6c['query'][_0xbf6f('0x6d')]['length'];_0x454206+=0x1){socket['emit'](_0xbf6f('0x7e'),{'UserId':Number(_0x183f6c[_0xbf6f('0x30')][_0xbf6f('0x6d')][_0x454206]),'OpenchannelQueueId':Number(_0x183f6c['params']['id'])});}}else{socket[_0xbf6f('0x6c')]('userOpenchannelQueue:remove',{'UserId':Number(_0x183f6c['query'][_0xbf6f('0x6d')]),'OpenchannelQueueId':Number(_0x183f6c[_0xbf6f('0x45')]['id'])});}});}})[_0xbf6f('0x24')](respondWithStatusCode(_0x477fc9,null))[_0xbf6f('0x43')](handleError(_0x477fc9,null));};exports['getAgents']=function(_0x30c109,_0x5cc225,_0x4afa81){var _0x5f68b2={};var _0x357adc={};var _0x3a17de;var _0x2e9dc2;return db[_0xbf6f('0x2c')][_0xbf6f('0x54')]({'where':{'id':_0x30c109['params']['id']}})[_0xbf6f('0x24')](handleEntityNotFound(_0x5cc225,null))[_0xbf6f('0x24')](function(_0x33fb35){if(_0x33fb35){_0x3a17de=_0x33fb35;_0x357adc[_0xbf6f('0x2f')]=_[_0xbf6f('0x46')](db[_0xbf6f('0x58')]['rawAttributes']);_0x357adc[_0xbf6f('0x30')]=_['keys'](_0x30c109[_0xbf6f('0x30')]);_0x357adc['filters']=_[_0xbf6f('0x32')](_0x357adc['model'],_0x357adc[_0xbf6f('0x30')]);_0x5f68b2[_0xbf6f('0x34')]=_[_0xbf6f('0x32')](_0x357adc[_0xbf6f('0x2f')],qs[_0xbf6f('0x33')](_0x30c109[_0xbf6f('0x30')][_0xbf6f('0x33')]));_0x5f68b2[_0xbf6f('0x34')]=_0x5f68b2[_0xbf6f('0x34')]['length']?_0x5f68b2[_0xbf6f('0x34')]:_0x357adc['model'];_0x5f68b2[_0xbf6f('0x38')]=qs['sort'](_0x30c109['query'][_0xbf6f('0x39')]);_0x5f68b2[_0xbf6f('0x3a')]=qs[_0xbf6f('0x31')](_[_0xbf6f('0x3b')](_0x30c109[_0xbf6f('0x30')],_0x357adc['filters']));if(_0x30c109['query'][_0xbf6f('0x3c')]){_0x5f68b2[_0xbf6f('0x3a')]=_[_0xbf6f('0x3d')](_0x5f68b2['where'],{'$or':_[_0xbf6f('0x2b')](_0x5f68b2[_0xbf6f('0x34')],function(_0x1bef03){var _0x1bb19b={};_0x1bb19b[_0x1bef03]={'$like':'%'+_0x30c109[_0xbf6f('0x30')][_0xbf6f('0x3c')]+'%'};return _0x1bb19b;})});}_0x5f68b2=_[_0xbf6f('0x3d')]({},_0x5f68b2,_0x30c109[_0xbf6f('0x40')]);return _0x3a17de[_0xbf6f('0x83')](_0x5f68b2);}})[_0xbf6f('0x24')](function(_0x2baa3b){if(_0x2baa3b){_0x2e9dc2=_0x2baa3b[_0xbf6f('0x35')];if(!_0x30c109[_0xbf6f('0x30')][_0xbf6f('0x36')](_0xbf6f('0x37'))){_0x5f68b2[_0xbf6f('0x1f')]=qs[_0xbf6f('0x1f')](_0x30c109[_0xbf6f('0x30')][_0xbf6f('0x1f')]);_0x5f68b2[_0xbf6f('0x1e')]=qs[_0xbf6f('0x1e')](_0x30c109['query'][_0xbf6f('0x1e')]);}return _0x3a17de['getAgents'](_0x5f68b2);}})[_0xbf6f('0x24')](function(_0x18a547){if(_0x18a547){return _0x18a547?{'count':_0x2e9dc2,'rows':_0x18a547}:null;}})[_0xbf6f('0x24')](respondWithResult(_0x5cc225,null))['catch'](handleError(_0x5cc225,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index f512cee..2a1d1c4 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 _0x988b=['exports','events','../../mysqldb','setMaxListeners','save','hasOwnProperty','hook'];(function(_0x562faa,_0x23adc7){var _0xc70f59=function(_0x2d7dec){while(--_0x2d7dec){_0x562faa['push'](_0x562faa['shift']());}};_0xc70f59(++_0x23adc7);}(_0x988b,0x14a));var _0xb988=function(_0x5a2424,_0x33d683){_0x5a2424=_0x5a2424-0x0;var _0x449398=_0x988b[_0x5a2424];return _0x449398;};'use strict';var EventEmitter=require(_0xb988('0x0'));var OpenchannelQueue=require(_0xb988('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xb988('0x2')](0x0);var events={'afterCreate':_0xb988('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xb32997){return function(_0x54c037,_0xde92f6,_0x1fbc89){OpenchannelQueueEvents['emit'](_0xb32997+':'+_0x54c037['id'],_0x54c037);OpenchannelQueueEvents['emit'](_0xb32997,_0x54c037);_0x1fbc89(null);};}for(var e in events){if(events[_0xb988('0x4')](e)){var event=events[e];OpenchannelQueue[_0xb988('0x5')](e,emitEvent(event));}}module[_0xb988('0x6')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x7122=['update','remove','emit','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save'];(function(_0x1b4919,_0x55d152){var _0x4d66d8=function(_0x2fc6a4){while(--_0x2fc6a4){_0x1b4919['push'](_0x1b4919['shift']());}};_0x4d66d8(++_0x55d152);}(_0x7122,0x1eb));var _0x2712=function(_0x4f6a80,_0xa3e4c1){_0x4f6a80=_0x4f6a80-0x0;var _0x296ea6=_0x7122[_0x4f6a80];return _0x296ea6;};'use strict';var EventEmitter=require(_0x2712('0x0'));var OpenchannelQueue=require(_0x2712('0x1'))['db'][_0x2712('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x2712('0x3')](0x0);var events={'afterCreate':_0x2712('0x4'),'afterUpdate':_0x2712('0x5'),'afterDestroy':_0x2712('0x6')};function emitEvent(_0x3d9ff1){return function(_0x23919d,_0x28ff44,_0x771f1e){OpenchannelQueueEvents[_0x2712('0x7')](_0x3d9ff1+':'+_0x23919d['id'],_0x23919d);OpenchannelQueueEvents['emit'](_0x3d9ff1,_0x23919d);_0x771f1e(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 c386dc9..c6c83b8 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 _0x57b2=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define','openchannel_queues','lodash','util'];(function(_0x4d5787,_0x1f1e69){var _0x2eb57b=function(_0x272f00){while(--_0x272f00){_0x4d5787['push'](_0x4d5787['shift']());}};_0x2eb57b(++_0x1f1e69);}(_0x57b2,0xda));var _0x257b=function(_0x50564e,_0x10299f){_0x50564e=_0x50564e-0x0;var _0x54550b=_0x57b2[_0x50564e];return _0x54550b;};'use strict';var _=require(_0x257b('0x0'));var util=require(_0x257b('0x1'));var logger=require(_0x257b('0x2'))(_0x257b('0x3'));var moment=require(_0x257b('0x4'));var BPromise=require(_0x257b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x257b('0x6'));var rimraf=require(_0x257b('0x7'));var config=require(_0x257b('0x8'));var attributes=require('./openchannelQueue.attributes');module['exports']=function(_0x49c567,_0x561728){return _0x49c567[_0x257b('0x9')]('OpenchannelQueue',attributes,{'tableName':_0x257b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9e2d=['define','OpenchannelQueue','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9e2d,0x16a));var _0xd9e2=function(_0x35a97b,_0x3a045b){_0x35a97b=_0x35a97b-0x0;var _0x1a4189=_0x9e2d[_0x35a97b];return _0x1a4189;};'use strict';var _=require(_0xd9e2('0x0'));var util=require(_0xd9e2('0x1'));var logger=require(_0xd9e2('0x2'))('api');var moment=require(_0xd9e2('0x3'));var BPromise=require(_0xd9e2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd9e2('0x5'));var config=require(_0xd9e2('0x6'));var attributes=require('./openchannelQueue.attributes');module['exports']=function(_0x57ac27,_0x4bbc40){return _0x57ac27[_0xd9e2('0x7')](_0xd9e2('0x8'),attributes,{'tableName':'openchannel_queues','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 d0da931..4d682aa 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 _0xa1eb=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','then','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetOpenchannelQueue','OpenchannelQueue','options','where','limit','include','map','model','attributes','ShowOpenchannelQueue','raw','lodash','util','bluebird','randomstring'];(function(_0x3893b8,_0xa8b6f6){var _0x48421e=function(_0x341bef){while(--_0x341bef){_0x3893b8['push'](_0x3893b8['shift']());}};_0x48421e(++_0xa8b6f6);}(_0xa1eb,0x134));var _0xba1e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa1eb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xba1e('0x0'));var util=require(_0xba1e('0x1'));var moment=require('moment');var BPromise=require(_0xba1e('0x2'));var rs=require(_0xba1e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba1e('0x4'))['db'];var utils=require(_0xba1e('0x5'));var logger=require(_0xba1e('0x6'))(_0xba1e('0x7'));var config=require(_0xba1e('0x8'));var jayson=require(_0xba1e('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xba1e('0xa')]=_[_0xba1e('0xb')](config[_0xba1e('0xa')],{'host':_0xba1e('0xc'),'port':0x18eb});var socket=require(_0xba1e('0xd'))(new Redis(config[_0xba1e('0xa')]));require(_0xba1e('0xe'))[_0xba1e('0xf')](socket);function respondWithRpcPromise(_0x40dce7,_0x5189bb,_0x13fbc8){return new BPromise(function(_0x2bbbd4,_0x526ff9){return client['request'](_0x40dce7,_0x13fbc8)[_0xba1e('0x10')](function(_0x1ece36){logger['info'](_0xba1e('0x11'),_0x5189bb,'request\x20sent');logger[_0xba1e('0x12')](_0xba1e('0x13'),_0x5189bb,_0xba1e('0x14'),JSON[_0xba1e('0x15')](_0x1ece36));if(_0x1ece36[_0xba1e('0x16')]){if(_0x1ece36[_0xba1e('0x16')][_0xba1e('0x17')]===0x1f4){logger[_0xba1e('0x16')](_0xba1e('0x11'),_0x5189bb,_0x1ece36[_0xba1e('0x16')][_0xba1e('0x18')]);return _0x526ff9(_0x1ece36['error']['message']);}logger['error'](_0xba1e('0x11'),_0x5189bb,_0x1ece36[_0xba1e('0x16')][_0xba1e('0x18')]);return _0x2bbbd4(_0x1ece36[_0xba1e('0x16')][_0xba1e('0x18')]);}else{logger[_0xba1e('0x19')]('OpenchannelQueue,\x20%s,\x20%s',_0x5189bb,_0xba1e('0x14'));_0x2bbbd4(_0x1ece36[_0xba1e('0x1a')]['message']);}})[_0xba1e('0x1b')](function(_0xd6cfd0){logger[_0xba1e('0x16')](_0xba1e('0x11'),_0x5189bb,_0xd6cfd0);_0x526ff9(_0xd6cfd0);});});}exports[_0xba1e('0x1c')]=function(_0x5394b3){var _0x132cf2=this;return new Promise(function(_0x2bf46e,_0x5d7358){return db[_0xba1e('0x1d')]['findAll']({'raw':_0x5394b3['options']?_0x5394b3[_0xba1e('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x5394b3[_0xba1e('0x1e')]?_0x5394b3['options'][_0xba1e('0x1f')]||null:null,'attributes':_0x5394b3[_0xba1e('0x1e')]?_0x5394b3['options']['attributes']||null:null,'limit':_0x5394b3[_0xba1e('0x1e')]?_0x5394b3[_0xba1e('0x1e')][_0xba1e('0x20')]||null:null,'include':_0x5394b3['options']?_0x5394b3[_0xba1e('0x1e')][_0xba1e('0x21')]?_[_0xba1e('0x22')](_0x5394b3[_0xba1e('0x1e')][_0xba1e('0x21')],function(_0x4a014c){return{'model':db[_0x4a014c[_0xba1e('0x23')]],'as':_0x4a014c['as'],'attributes':_0x4a014c[_0xba1e('0x24')],'include':_0x4a014c['include']?_['map'](_0x4a014c[_0xba1e('0x21')],function(_0x587521){return{'model':db[_0x587521['model']],'as':_0x587521['as'],'attributes':_0x587521[_0xba1e('0x24')],'include':_0x587521[_0xba1e('0x21')]?_[_0xba1e('0x22')](_0x587521[_0xba1e('0x21')],function(_0x36b175){return{'model':db[_0x36b175[_0xba1e('0x23')]],'as':_0x36b175['as'],'attributes':_0x36b175[_0xba1e('0x24')]};}):[]};}):[]};}):[]:[]})[_0xba1e('0x10')](function(_0x3066ca){logger[_0xba1e('0x19')](_0xba1e('0x1c'),_0x5394b3);logger[_0xba1e('0x12')]('GetOpenchannelQueue',_0x5394b3,JSON[_0xba1e('0x15')](_0x3066ca));_0x2bf46e(_0x3066ca);})['catch'](function(_0x2a177b){logger[_0xba1e('0x16')]('GetOpenchannelQueue',_0x2a177b[_0xba1e('0x18')],_0x5394b3);_0x5d7358(_0x132cf2['error'](0x1f4,_0x2a177b[_0xba1e('0x18')]));});});};exports[_0xba1e('0x25')]=function(_0x3e9344){var _0x5f565f=this;return new Promise(function(_0x3e2711,_0x584c8d){return db[_0xba1e('0x1d')]['find']({'raw':_0x3e9344['options']?_0x3e9344[_0xba1e('0x1e')][_0xba1e('0x26')]===undefined?!![]:![]:!![],'where':_0x3e9344[_0xba1e('0x1e')]?_0x3e9344[_0xba1e('0x1e')]['where']||null:null,'attributes':_0x3e9344[_0xba1e('0x1e')]?_0x3e9344[_0xba1e('0x1e')][_0xba1e('0x24')]||null:null,'include':_0x3e9344[_0xba1e('0x1e')]?_0x3e9344[_0xba1e('0x1e')]['include']?_['map'](_0x3e9344[_0xba1e('0x1e')][_0xba1e('0x21')],function(_0xf1b8b8){return{'model':db[_0xf1b8b8[_0xba1e('0x23')]],'as':_0xf1b8b8['as'],'attributes':_0xf1b8b8[_0xba1e('0x24')],'include':_0xf1b8b8[_0xba1e('0x21')]?_[_0xba1e('0x22')](_0xf1b8b8[_0xba1e('0x21')],function(_0x3cbcea){return{'model':db[_0x3cbcea[_0xba1e('0x23')]],'as':_0x3cbcea['as'],'attributes':_0x3cbcea['attributes'],'include':_0x3cbcea['include']?_['map'](_0x3cbcea[_0xba1e('0x21')],function(_0x299eed){return{'model':db[_0x299eed[_0xba1e('0x23')]],'as':_0x299eed['as'],'attributes':_0x299eed[_0xba1e('0x24')]};}):[]};}):[]};}):[]:[]})[_0xba1e('0x10')](function(_0x50367b){logger[_0xba1e('0x19')](_0xba1e('0x25'),_0x3e9344);logger[_0xba1e('0x12')](_0xba1e('0x25'),_0x3e9344,JSON[_0xba1e('0x15')](_0x50367b));_0x3e2711(_0x50367b);})[_0xba1e('0x1b')](function(_0x1b70c7){logger['error']('ShowOpenchannelQueue',_0x1b70c7[_0xba1e('0x18')],_0x3e9344);_0x584c8d(_0x5f565f[_0xba1e('0x16')](0x1f4,_0x1b70c7[_0xba1e('0x18')]));});});}; \ No newline at end of file +var _0xfa81=['client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','request','then','info','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelQueue,\x20%s,\x20%s','message','result','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','find','ShowOpenchannelQueue','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x99d066,_0x13a9d0){var _0x548c90=function(_0x4cbe26){while(--_0x4cbe26){_0x99d066['push'](_0x99d066['shift']());}};_0x548c90(++_0x13a9d0);}(_0xfa81,0x1c4));var _0x1fa8=function(_0x40c49a,_0xe860fc){_0x40c49a=_0x40c49a-0x0;var _0x464aa9=_0xfa81[_0x40c49a];return _0x464aa9;};'use strict';var _=require(_0x1fa8('0x0'));var util=require(_0x1fa8('0x1'));var moment=require(_0x1fa8('0x2'));var BPromise=require(_0x1fa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1fa8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1fa8('0x5'));var logger=require(_0x1fa8('0x6'))(_0x1fa8('0x7'));var config=require(_0x1fa8('0x8'));var jayson=require(_0x1fa8('0x9'));var client=jayson[_0x1fa8('0xa')][_0x1fa8('0xb')]({'port':0x232a});config[_0x1fa8('0xc')]=_[_0x1fa8('0xd')](config['redis'],{'host':_0x1fa8('0xe'),'port':0x18eb});var socket=require(_0x1fa8('0xf'))(new Redis(config[_0x1fa8('0xc')]));require(_0x1fa8('0x10'))['register'](socket);function respondWithRpcPromise(_0x260329,_0x1b93d9,_0x2af4c3){return new BPromise(function(_0x2357a7,_0x59d483){return client[_0x1fa8('0x11')](_0x260329,_0x2af4c3)[_0x1fa8('0x12')](function(_0x44eed6){logger[_0x1fa8('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x1b93d9,_0x1fa8('0x14'));logger[_0x1fa8('0x15')](_0x1fa8('0x16'),_0x1b93d9,_0x1fa8('0x14'),JSON[_0x1fa8('0x17')](_0x44eed6));if(_0x44eed6[_0x1fa8('0x18')]){if(_0x44eed6[_0x1fa8('0x18')]['code']===0x1f4){logger[_0x1fa8('0x18')](_0x1fa8('0x19'),_0x1b93d9,_0x44eed6[_0x1fa8('0x18')][_0x1fa8('0x1a')]);return _0x59d483(_0x44eed6[_0x1fa8('0x18')][_0x1fa8('0x1a')]);}logger[_0x1fa8('0x18')](_0x1fa8('0x19'),_0x1b93d9,_0x44eed6[_0x1fa8('0x18')]['message']);return _0x2357a7(_0x44eed6[_0x1fa8('0x18')]['message']);}else{logger['info'](_0x1fa8('0x19'),_0x1b93d9,'request\x20sent');_0x2357a7(_0x44eed6[_0x1fa8('0x1b')][_0x1fa8('0x1a')]);}})['catch'](function(_0x6549a5){logger[_0x1fa8('0x18')]('OpenchannelQueue,\x20%s,\x20%s',_0x1b93d9,_0x6549a5);_0x59d483(_0x6549a5);});});}exports[_0x1fa8('0x1c')]=function(_0x297f0b){var _0x196b42=this;return new Promise(function(_0x3ee912,_0x180663){return db[_0x1fa8('0x1d')][_0x1fa8('0x1e')]({'raw':_0x297f0b[_0x1fa8('0x1f')]?_0x297f0b[_0x1fa8('0x1f')][_0x1fa8('0x20')]===undefined?!![]:![]:!![],'where':_0x297f0b['options']?_0x297f0b['options'][_0x1fa8('0x21')]||null:null,'attributes':_0x297f0b[_0x1fa8('0x1f')]?_0x297f0b['options'][_0x1fa8('0x22')]||null:null,'limit':_0x297f0b['options']?_0x297f0b[_0x1fa8('0x1f')][_0x1fa8('0x23')]||null:null,'include':_0x297f0b[_0x1fa8('0x1f')]?_0x297f0b['options']['include']?_['map'](_0x297f0b[_0x1fa8('0x1f')][_0x1fa8('0x24')],function(_0x2da735){return{'model':db[_0x2da735['model']],'as':_0x2da735['as'],'attributes':_0x2da735[_0x1fa8('0x22')],'include':_0x2da735[_0x1fa8('0x24')]?_[_0x1fa8('0x25')](_0x2da735[_0x1fa8('0x24')],function(_0x2b64b8){return{'model':db[_0x2b64b8[_0x1fa8('0x26')]],'as':_0x2b64b8['as'],'attributes':_0x2b64b8['attributes'],'include':_0x2b64b8[_0x1fa8('0x24')]?_[_0x1fa8('0x25')](_0x2b64b8[_0x1fa8('0x24')],function(_0x27f0f6){return{'model':db[_0x27f0f6[_0x1fa8('0x26')]],'as':_0x27f0f6['as'],'attributes':_0x27f0f6[_0x1fa8('0x22')]};}):[]};}):[]};}):[]:[]})[_0x1fa8('0x12')](function(_0x318673){logger[_0x1fa8('0x13')](_0x1fa8('0x1c'),_0x297f0b);logger[_0x1fa8('0x15')]('GetOpenchannelQueue',_0x297f0b,JSON[_0x1fa8('0x17')](_0x318673));_0x3ee912(_0x318673);})['catch'](function(_0x16fdb1){logger[_0x1fa8('0x18')](_0x1fa8('0x1c'),_0x16fdb1[_0x1fa8('0x1a')],_0x297f0b);_0x180663(_0x196b42[_0x1fa8('0x18')](0x1f4,_0x16fdb1['message']));});});};exports['ShowOpenchannelQueue']=function(_0x30e355){var _0x4ba5bf=this;return new Promise(function(_0x214370,_0x260259){return db[_0x1fa8('0x1d')][_0x1fa8('0x27')]({'raw':_0x30e355[_0x1fa8('0x1f')]?_0x30e355[_0x1fa8('0x1f')][_0x1fa8('0x20')]===undefined?!![]:![]:!![],'where':_0x30e355[_0x1fa8('0x1f')]?_0x30e355[_0x1fa8('0x1f')][_0x1fa8('0x21')]||null:null,'attributes':_0x30e355[_0x1fa8('0x1f')]?_0x30e355['options'][_0x1fa8('0x22')]||null:null,'include':_0x30e355['options']?_0x30e355[_0x1fa8('0x1f')][_0x1fa8('0x24')]?_[_0x1fa8('0x25')](_0x30e355[_0x1fa8('0x1f')][_0x1fa8('0x24')],function(_0x15ad29){return{'model':db[_0x15ad29[_0x1fa8('0x26')]],'as':_0x15ad29['as'],'attributes':_0x15ad29[_0x1fa8('0x22')],'include':_0x15ad29[_0x1fa8('0x24')]?_[_0x1fa8('0x25')](_0x15ad29[_0x1fa8('0x24')],function(_0xe225ca){return{'model':db[_0xe225ca[_0x1fa8('0x26')]],'as':_0xe225ca['as'],'attributes':_0xe225ca[_0x1fa8('0x22')],'include':_0xe225ca[_0x1fa8('0x24')]?_[_0x1fa8('0x25')](_0xe225ca[_0x1fa8('0x24')],function(_0x26c7a8){return{'model':db[_0x26c7a8[_0x1fa8('0x26')]],'as':_0x26c7a8['as'],'attributes':_0x26c7a8[_0x1fa8('0x22')]};}):[]};}):[]};}):[]:[]})[_0x1fa8('0x12')](function(_0xb39ecf){logger[_0x1fa8('0x13')]('ShowOpenchannelQueue',_0x30e355);logger[_0x1fa8('0x15')](_0x1fa8('0x28'),_0x30e355,JSON[_0x1fa8('0x17')](_0xb39ecf));_0x214370(_0xb39ecf);})[_0x1fa8('0x29')](function(_0x378044){logger[_0x1fa8('0x18')](_0x1fa8('0x28'),_0x378044[_0x1fa8('0x1a')],_0x30e355);_0x260259(_0x4ba5bf[_0x1fa8('0x18')](0x1f4,_0x378044[_0x1fa8('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 8eed2f3..b590fab 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 _0xad45=['remove','update','removeListener','register','length','./openchannelQueue.events'];(function(_0x2c52a5,_0x350627){var _0x55f434=function(_0x31e26d){while(--_0x31e26d){_0x2c52a5['push'](_0x2c52a5['shift']());}};_0x55f434(++_0x350627);}(_0xad45,0x113));var _0x5ad4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xad45[_0x14add3];return _0x4a174f;};'use strict';var OpenchannelQueueEvents=require(_0x5ad4('0x0'));var events=['save',_0x5ad4('0x1'),_0x5ad4('0x2')];function createListener(_0xd8453e,_0x4ccbb2){return function(_0x1cfafc){_0x4ccbb2['emit'](_0xd8453e,_0x1cfafc);};}function removeListener(_0x4c9e29,_0x12e7bb){return function(){OpenchannelQueueEvents[_0x5ad4('0x3')](_0x4c9e29,_0x12e7bb);};}exports[_0x5ad4('0x4')]=function(_0x1d83f8){for(var _0x1516b3=0x0,_0x3825db=events[_0x5ad4('0x5')];_0x1516b3<_0x3825db;_0x1516b3++){var _0x4502d0=events[_0x1516b3];var _0xfb6f4=createListener('openchannelQueue:'+_0x4502d0,_0x1d83f8);OpenchannelQueueEvents['on'](_0x4502d0,_0xfb6f4);}}; \ No newline at end of file +var _0x183e=['save','remove','update','emit','register','length','openchannelQueue:','./openchannelQueue.events'];(function(_0x3cb83f,_0x2bc6dd){var _0x105d68=function(_0x18bd0f){while(--_0x18bd0f){_0x3cb83f['push'](_0x3cb83f['shift']());}};_0x105d68(++_0x2bc6dd);}(_0x183e,0x157));var _0xe183=function(_0x3c1ad0,_0x1b3ac3){_0x3c1ad0=_0x3c1ad0-0x0;var _0x504171=_0x183e[_0x3c1ad0];return _0x504171;};'use strict';var OpenchannelQueueEvents=require(_0xe183('0x0'));var events=[_0xe183('0x1'),_0xe183('0x2'),_0xe183('0x3')];function createListener(_0x7dc637,_0x1de1ca){return function(_0x27e224){_0x1de1ca[_0xe183('0x4')](_0x7dc637,_0x27e224);};}function removeListener(_0x13034a,_0x1ebd5f){return function(){OpenchannelQueueEvents['removeListener'](_0x13034a,_0x1ebd5f);};}exports[_0xe183('0x5')]=function(_0x55aeb7){for(var _0x13abdc=0x0,_0x4ddc1b=events[_0xe183('0x6')];_0x13abdc<_0x4ddc1b;_0x13abdc++){var _0x342a4b=events[_0x13abdc];var _0x2e21a6=createListener(_0xe183('0x7')+_0x342a4b,_0x55aeb7);OpenchannelQueueEvents['on'](_0x342a4b,_0x2e21a6);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 1c198a7..7b26f2a 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 _0xd539=['multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x103478,_0x353eca){var _0x55d015=function(_0x5a8665){while(--_0x5a8665){_0x103478['push'](_0x103478['shift']());}};_0x55d015(++_0x353eca);}(_0xd539,0x1b8));var _0x9d53=function(_0x1f8570,_0x4cbcf9){_0x1f8570=_0x1f8570-0x0;var _0x2e7db3=_0xd539[_0x1f8570];return _0x2e7db3;};'use strict';var multer=require(_0x9d53('0x0'));var util=require(_0x9d53('0x1'));var path=require(_0x9d53('0x2'));var timeout=require(_0x9d53('0x3'));var express=require(_0x9d53('0x4'));var router=express[_0x9d53('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x9d53('0x6'));var config=require(_0x9d53('0x7'));var controller=require('./openchannelQueueReport.controller');router[_0x9d53('0x8')]('/',auth[_0x9d53('0x9')](),controller[_0x9d53('0xa')]);router[_0x9d53('0x8')]('/describe',auth[_0x9d53('0x9')](),controller[_0x9d53('0xb')]);router['get'](_0x9d53('0xc'),auth['isAuthenticated'](),controller[_0x9d53('0xd')]);router[_0x9d53('0xe')]('/',auth[_0x9d53('0x9')](),controller[_0x9d53('0xf')]);router['put'](_0x9d53('0xc'),auth['isAuthenticated'](),controller[_0x9d53('0x10')]);router[_0x9d53('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x9d53('0x12')]);module[_0x9d53('0x13')]=router; \ No newline at end of file +var _0x1e95=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','exports','util','connect-timeout','express','Router'];(function(_0x12a201,_0x30aaba){var _0x52a4d2=function(_0x5ca28d){while(--_0x5ca28d){_0x12a201['push'](_0x12a201['shift']());}};_0x52a4d2(++_0x30aaba);}(_0x1e95,0x18b));var _0x51e9=function(_0x1a8c9b,_0x21cb32){_0x1a8c9b=_0x1a8c9b-0x0;var _0x4ac363=_0x1e95[_0x1a8c9b];return _0x4ac363;};'use strict';var multer=require('multer');var util=require(_0x51e9('0x0'));var path=require('path');var timeout=require(_0x51e9('0x1'));var express=require(_0x51e9('0x2'));var router=express[_0x51e9('0x3')]();var auth=require(_0x51e9('0x4'));var interaction=require(_0x51e9('0x5'));var config=require(_0x51e9('0x6'));var controller=require('./openchannelQueueReport.controller');router[_0x51e9('0x7')]('/',auth[_0x51e9('0x8')](),controller[_0x51e9('0x9')]);router[_0x51e9('0x7')](_0x51e9('0xa'),auth[_0x51e9('0x8')](),controller[_0x51e9('0xb')]);router[_0x51e9('0x7')](_0x51e9('0xc'),auth[_0x51e9('0x8')](),controller[_0x51e9('0xd')]);router[_0x51e9('0xe')]('/',auth[_0x51e9('0x8')](),controller[_0x51e9('0xf')]);router[_0x51e9('0x10')](_0x51e9('0xc'),auth[_0x51e9('0x8')](),controller['update']);router[_0x51e9('0x11')](_0x51e9('0xc'),auth[_0x51e9('0x8')](),controller['destroy']);module[_0x51e9('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 2253ee2..d20d9eb 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 _0x9b08=['sequelize','STRING','DATE','moment'];(function(_0x3b6184,_0x1e3d52){var _0x1548c9=function(_0x329f5a){while(--_0x329f5a){_0x3b6184['push'](_0x3b6184['shift']());}};_0x1548c9(++_0x1e3d52);}(_0x9b08,0xb7));var _0x89b0=function(_0x1d8119,_0xc98f17){_0x1d8119=_0x1d8119-0x0;var _0x3e30f6=_0x9b08[_0x1d8119];return _0x3e30f6;};'use strict';var moment=require(_0x89b0('0x0'));var Sequelize=require(_0x89b0('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x89b0('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x89b0('0x2')]},'joinAt':{'type':Sequelize[_0x89b0('0x3')]},'leaveAt':{'type':Sequelize[_0x89b0('0x3')]},'acceptAt':{'type':Sequelize[_0x89b0('0x3')]},'exitAt':{'type':Sequelize[_0x89b0('0x3')]},'reason':{'type':Sequelize[_0x89b0('0x2')]}}; \ No newline at end of file +var _0xba97=['sequelize','exports','DATE','STRING'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xba97,0xfc));var _0x7ba9=function(_0x562e2d,_0xb96daf){_0x562e2d=_0x562e2d-0x0;var _0x23f7c=_0xba97[_0x562e2d];return _0x23f7c;};'use strict';var moment=require('moment');var Sequelize=require(_0x7ba9('0x0'));module[_0x7ba9('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x7ba9('0x2')]},'leaveAt':{'type':Sequelize[_0x7ba9('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x7ba9('0x2')]},'reason':{'type':Sequelize[_0x7ba9('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index c4072f9..4096dce 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 _0xb6fa=['where','pick','merge','VIRTUAL','filter','options','count','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','html-pdf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','index','map','OpenchannelQueueReport','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x4b5394,_0x5def8c){var _0x4dc370=function(_0x3386ee){while(--_0x3386ee){_0x4b5394['push'](_0x4b5394['shift']());}};_0x4dc370(++_0x5def8c);}(_0xb6fa,0x1c2));var _0xab6f=function(_0x5e9a69,_0x40c0ec){_0x5e9a69=_0x5e9a69-0x0;var _0x5979c8=_0xb6fa[_0x5e9a69];return _0x5979c8;};'use strict';var pdf=require(_0xab6f('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xab6f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xab6f('0x2'));var BPromise=require(_0xab6f('0x3'));var Mustache=require('mustache');var util=require(_0xab6f('0x4'));var path=require(_0xab6f('0x5'));var sox=require(_0xab6f('0x6'));var csv=require(_0xab6f('0x7'));var ejs=require(_0xab6f('0x8'));var fs=require('fs');var _=require(_0xab6f('0x9'));var squel=require(_0xab6f('0xa'));var crypto=require(_0xab6f('0xb'));var jsforce=require(_0xab6f('0xc'));var deskjs=require(_0xab6f('0xd'));var toCsv=require(_0xab6f('0x7'));var querystring=require(_0xab6f('0xe'));var Papa=require(_0xab6f('0xf'));var Redis=require(_0xab6f('0x10'));var authService=require(_0xab6f('0x11'));var qs=require(_0xab6f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xab6f('0x13'))(_0xab6f('0x14'));var utils=require('../../config/utils');var config=require(_0xab6f('0x15'));var db=require(_0xab6f('0x16'))['db'];function respondWithStatusCode(_0x318c53,_0x437b32){_0x437b32=_0x437b32||0xcc;return function(_0x139fcf){if(_0x139fcf){return _0x318c53[_0xab6f('0x17')](_0x437b32);}return _0x318c53[_0xab6f('0x18')](_0x437b32)['end']();};}function respondWithResult(_0x383c30,_0x17d180){_0x17d180=_0x17d180||0xc8;return function(_0x3b5791){if(_0x3b5791){return _0x383c30['status'](_0x17d180)[_0xab6f('0x19')](_0x3b5791);}};}function respondWithFilteredResult(_0x53d5e2,_0x49d9f1){return function(_0x2a6aac){if(_0x2a6aac){var _0x5eed74=_0x2a6aac['count'],_0x422850=_0x49d9f1[_0xab6f('0x1a')],_0x3653f0=_0x49d9f1['offset']+_0x49d9f1[_0xab6f('0x1b')],_0x14447f;if(_0x3653f0>=_0x5eed74){_0x3653f0=_0x5eed74;_0x14447f=0xc8;}else{_0x14447f=0xce;}_0x53d5e2[_0xab6f('0x18')](_0x14447f);return _0x53d5e2[_0xab6f('0x1c')](_0xab6f('0x1d'),_0x422850+'-'+_0x3653f0+'/'+_0x5eed74)[_0xab6f('0x19')](_0x2a6aac);}return null;};}function patchUpdates(_0x63d478){return function(_0x455c20){try{jsonpatch['apply'](_0x455c20,_0x63d478,!![]);}catch(_0x1f7322){return BPromise[_0xab6f('0x1e')](_0x1f7322);}return _0x455c20[_0xab6f('0x1f')]();};}function saveUpdates(_0x485200,_0x43eda0){return function(_0x375e68){if(_0x375e68){return _0x375e68[_0xab6f('0x20')](_0x485200)[_0xab6f('0x21')](function(_0x2c20cc){return _0x2c20cc;});}return null;};}function removeEntity(_0x210d19,_0x47fead){return function(_0x4dc7c1){if(_0x4dc7c1){return _0x4dc7c1[_0xab6f('0x22')]()[_0xab6f('0x21')](function(){_0x210d19[_0xab6f('0x18')](0xcc)[_0xab6f('0x23')]();});}};}function handleEntityNotFound(_0x15c3e6,_0x149321){return function(_0xb1ef77){if(!_0xb1ef77){_0x15c3e6['sendStatus'](0x194);}return _0xb1ef77;};}function handleError(_0x1294d3,_0xf849b5){_0xf849b5=_0xf849b5||0x1f4;return function(_0x4f6659){logger[_0xab6f('0x24')](_0x4f6659[_0xab6f('0x25')]);if(_0x4f6659[_0xab6f('0x26')]){delete _0x4f6659[_0xab6f('0x26')];}_0x1294d3[_0xab6f('0x18')](_0xf849b5)['send'](_0x4f6659);};}exports[_0xab6f('0x27')]=function(_0x205926,_0x4bcedd){var _0x149fad={},_0x30e0fa={},_0x441423={'count':0x0,'rows':[]};var _0x2f8ebc=_[_0xab6f('0x28')](db[_0xab6f('0x29')]['rawAttributes'],function(_0x3f95e8){return{'name':_0x3f95e8['fieldName'],'type':_0x3f95e8['type']['key']};});_0x30e0fa['model']=_['map'](_0x2f8ebc,_0xab6f('0x26'));_0x30e0fa[_0xab6f('0x2a')]=_[_0xab6f('0x2b')](_0x205926[_0xab6f('0x2a')]);_0x30e0fa[_0xab6f('0x2c')]=_['intersection'](_0x30e0fa[_0xab6f('0x2d')],_0x30e0fa[_0xab6f('0x2a')]);_0x149fad[_0xab6f('0x2e')]=_[_0xab6f('0x2f')](_0x30e0fa[_0xab6f('0x2d')],qs[_0xab6f('0x30')](_0x205926[_0xab6f('0x2a')]['fields']));_0x149fad[_0xab6f('0x2e')]=_0x149fad[_0xab6f('0x2e')][_0xab6f('0x31')]?_0x149fad['attributes']:_0x30e0fa[_0xab6f('0x2d')];if(!_0x205926['query'][_0xab6f('0x32')](_0xab6f('0x33'))){_0x149fad[_0xab6f('0x1b')]=qs[_0xab6f('0x1b')](_0x205926[_0xab6f('0x2a')][_0xab6f('0x1b')]);_0x149fad[_0xab6f('0x1a')]=qs[_0xab6f('0x1a')](_0x205926[_0xab6f('0x2a')]['offset']);}_0x149fad[_0xab6f('0x34')]=qs['sort'](_0x205926['query'][_0xab6f('0x35')]);_0x149fad[_0xab6f('0x36')]=qs[_0xab6f('0x2c')](_[_0xab6f('0x37')](_0x205926[_0xab6f('0x2a')],_0x30e0fa[_0xab6f('0x2c')]));if(_0x205926['query']['filter']){_0x149fad['where']=_[_0xab6f('0x38')](_0x149fad[_0xab6f('0x36')],{'$or':_[_0xab6f('0x28')](_0x2f8ebc,function(_0x421bd2){if(_0x421bd2['type']!==_0xab6f('0x39')){var _0x33ce7d={};_0x33ce7d[_0x421bd2['name']]={'$like':'%'+_0x205926['query'][_0xab6f('0x3a')]+'%'};return _0x33ce7d;}})});}_0x149fad=_[_0xab6f('0x38')]({},_0x149fad,_0x205926[_0xab6f('0x3b')]);var _0x347988={'where':_0x149fad['where']};return db['OpenchannelQueueReport'][_0xab6f('0x3c')](_0x347988)[_0xab6f('0x21')](function(_0x2228f4){_0x441423[_0xab6f('0x3c')]=_0x2228f4;if(_0x205926[_0xab6f('0x2a')][_0xab6f('0x3d')]){_0x149fad['include']=[{'all':!![]}];}return db[_0xab6f('0x29')][_0xab6f('0x3e')](_0x149fad);})[_0xab6f('0x21')](function(_0x435525){_0x441423[_0xab6f('0x3f')]=_0x435525;return _0x441423;})[_0xab6f('0x21')](respondWithFilteredResult(_0x4bcedd,_0x149fad))[_0xab6f('0x40')](handleError(_0x4bcedd,null));};exports[_0xab6f('0x41')]=function(_0x43d307,_0xe12df6){var _0x3df7f1={'raw':!![],'where':{'id':_0x43d307[_0xab6f('0x42')]['id']}},_0x3f6fcb={};_0x3f6fcb[_0xab6f('0x2d')]=_[_0xab6f('0x2b')](db[_0xab6f('0x29')]['rawAttributes']);_0x3f6fcb[_0xab6f('0x2a')]=_[_0xab6f('0x2b')](_0x43d307[_0xab6f('0x2a')]);_0x3f6fcb[_0xab6f('0x2c')]=_[_0xab6f('0x2f')](_0x3f6fcb['model'],_0x3f6fcb['query']);_0x3df7f1[_0xab6f('0x2e')]=_[_0xab6f('0x2f')](_0x3f6fcb[_0xab6f('0x2d')],qs[_0xab6f('0x30')](_0x43d307[_0xab6f('0x2a')]['fields']));_0x3df7f1[_0xab6f('0x2e')]=_0x3df7f1[_0xab6f('0x2e')]['length']?_0x3df7f1['attributes']:_0x3f6fcb[_0xab6f('0x2d')];if(_0x43d307[_0xab6f('0x2a')]['includeAll']){_0x3df7f1[_0xab6f('0x43')]=[{'all':!![]}];}_0x3df7f1=_[_0xab6f('0x38')]({},_0x3df7f1,_0x43d307[_0xab6f('0x3b')]);return db[_0xab6f('0x29')][_0xab6f('0x44')](_0x3df7f1)[_0xab6f('0x21')](handleEntityNotFound(_0xe12df6,null))['then'](respondWithResult(_0xe12df6,null))[_0xab6f('0x40')](handleError(_0xe12df6,null));};exports[_0xab6f('0x45')]=function(_0x1f4f08,_0x326c7c){return db[_0xab6f('0x29')][_0xab6f('0x45')](_0x1f4f08[_0xab6f('0x46')],{})[_0xab6f('0x21')](respondWithResult(_0x326c7c,0xc9))[_0xab6f('0x40')](handleError(_0x326c7c,null));};exports[_0xab6f('0x20')]=function(_0x6f0f4c,_0x298690){if(_0x6f0f4c[_0xab6f('0x46')]['id']){delete _0x6f0f4c['body']['id'];}return db[_0xab6f('0x29')][_0xab6f('0x44')]({'where':{'id':_0x6f0f4c['params']['id']}})[_0xab6f('0x21')](handleEntityNotFound(_0x298690,null))[_0xab6f('0x21')](saveUpdates(_0x6f0f4c[_0xab6f('0x46')],null))[_0xab6f('0x21')](respondWithResult(_0x298690,null))[_0xab6f('0x40')](handleError(_0x298690,null));};exports[_0xab6f('0x22')]=function(_0x12e1f8,_0x438ca4){return db[_0xab6f('0x29')][_0xab6f('0x44')]({'where':{'id':_0x12e1f8[_0xab6f('0x42')]['id']}})[_0xab6f('0x21')](handleEntityNotFound(_0x438ca4,null))[_0xab6f('0x21')](removeEntity(_0x438ca4,null))[_0xab6f('0x40')](handleError(_0x438ca4,null));};exports['describe']=function(_0x2a7966,_0x5af17e){return db['OpenchannelQueueReport'][_0xab6f('0x47')]()[_0xab6f('0x21')](respondWithResult(_0x5af17e,null))['catch'](handleError(_0x5af17e,null));}; \ No newline at end of file +var _0xa5c1=['destroy','sendStatus','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','include','rows','catch','show','params','merge','find','create','body','describe','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then'];(function(_0xf7c892,_0x4c030f){var _0x74459e=function(_0x15cebf){while(--_0x15cebf){_0xf7c892['push'](_0xf7c892['shift']());}};_0x74459e(++_0x4c030f);}(_0xa5c1,0x19f));var _0x1a5c=function(_0x5998e3,_0x3f77cf){_0x5998e3=_0x5998e3-0x0;var _0x114287=_0xa5c1[_0x5998e3];return _0x114287;};'use strict';var pdf=require(_0x1a5c('0x0'));var emlformat=require(_0x1a5c('0x1'));var rimraf=require(_0x1a5c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1a5c('0x3'));var moment=require('moment');var BPromise=require(_0x1a5c('0x4'));var Mustache=require(_0x1a5c('0x5'));var util=require(_0x1a5c('0x6'));var path=require(_0x1a5c('0x7'));var sox=require(_0x1a5c('0x8'));var csv=require(_0x1a5c('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1a5c('0xa'));var squel=require('squel');var crypto=require(_0x1a5c('0xb'));var jsforce=require(_0x1a5c('0xc'));var deskjs=require(_0x1a5c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1a5c('0xe'));var Papa=require('papaparse');var Redis=require(_0x1a5c('0xf'));var authService=require(_0x1a5c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1a5c('0x11'));var hardwareService=require(_0x1a5c('0x12'));var logger=require('../../config/logger')(_0x1a5c('0x13'));var utils=require(_0x1a5c('0x14'));var config=require(_0x1a5c('0x15'));var db=require(_0x1a5c('0x16'))['db'];function respondWithStatusCode(_0x3e344e,_0x2b8a65){_0x2b8a65=_0x2b8a65||0xcc;return function(_0x38c7d7){if(_0x38c7d7){return _0x3e344e['sendStatus'](_0x2b8a65);}return _0x3e344e[_0x1a5c('0x17')](_0x2b8a65)[_0x1a5c('0x18')]();};}function respondWithResult(_0x4b240a,_0x157ebb){_0x157ebb=_0x157ebb||0xc8;return function(_0x207899){if(_0x207899){return _0x4b240a['status'](_0x157ebb)[_0x1a5c('0x19')](_0x207899);}};}function respondWithFilteredResult(_0x115aa6,_0xf76c73){return function(_0x170112){if(_0x170112){var _0x555b63=_0x170112[_0x1a5c('0x1a')],_0x2f3ba7=_0xf76c73[_0x1a5c('0x1b')],_0x4e9b28=_0xf76c73['offset']+_0xf76c73['limit'],_0x24dfa0;if(_0x4e9b28>=_0x555b63){_0x4e9b28=_0x555b63;_0x24dfa0=0xc8;}else{_0x24dfa0=0xce;}_0x115aa6[_0x1a5c('0x17')](_0x24dfa0);return _0x115aa6[_0x1a5c('0x1c')](_0x1a5c('0x1d'),_0x2f3ba7+'-'+_0x4e9b28+'/'+_0x555b63)[_0x1a5c('0x19')](_0x170112);}return null;};}function patchUpdates(_0x232798){return function(_0x57edcd){try{jsonpatch[_0x1a5c('0x1e')](_0x57edcd,_0x232798,!![]);}catch(_0x505162){return BPromise[_0x1a5c('0x1f')](_0x505162);}return _0x57edcd[_0x1a5c('0x20')]();};}function saveUpdates(_0x1de306,_0x5b4dfd){return function(_0x31d957){if(_0x31d957){return _0x31d957[_0x1a5c('0x21')](_0x1de306)[_0x1a5c('0x22')](function(_0x3502cb){return _0x3502cb;});}return null;};}function removeEntity(_0x144abf,_0x4d04d0){return function(_0x11964c){if(_0x11964c){return _0x11964c[_0x1a5c('0x23')]()[_0x1a5c('0x22')](function(){_0x144abf[_0x1a5c('0x17')](0xcc)[_0x1a5c('0x18')]();});}};}function handleEntityNotFound(_0x2a2f54,_0x1991f6){return function(_0x414482){if(!_0x414482){_0x2a2f54[_0x1a5c('0x24')](0x194);}return _0x414482;};}function handleError(_0x751c88,_0x38244c){_0x38244c=_0x38244c||0x1f4;return function(_0x323272){logger['error'](_0x323272[_0x1a5c('0x25')]);if(_0x323272['name']){delete _0x323272[_0x1a5c('0x26')];}_0x751c88['status'](_0x38244c)[_0x1a5c('0x27')](_0x323272);};}exports[_0x1a5c('0x28')]=function(_0x12784b,_0x1ba1cf){var _0xcd3e0a={},_0x1e5e87={},_0x157376={'count':0x0,'rows':[]};var _0x3e3dd1=_[_0x1a5c('0x29')](db[_0x1a5c('0x2a')][_0x1a5c('0x2b')],function(_0x4e2fe3){return{'name':_0x4e2fe3[_0x1a5c('0x2c')],'type':_0x4e2fe3[_0x1a5c('0x2d')][_0x1a5c('0x2e')]};});_0x1e5e87[_0x1a5c('0x2f')]=_[_0x1a5c('0x29')](_0x3e3dd1,_0x1a5c('0x26'));_0x1e5e87[_0x1a5c('0x30')]=_[_0x1a5c('0x31')](_0x12784b[_0x1a5c('0x30')]);_0x1e5e87['filters']=_[_0x1a5c('0x32')](_0x1e5e87[_0x1a5c('0x2f')],_0x1e5e87[_0x1a5c('0x30')]);_0xcd3e0a[_0x1a5c('0x33')]=_['intersection'](_0x1e5e87[_0x1a5c('0x2f')],qs[_0x1a5c('0x34')](_0x12784b[_0x1a5c('0x30')][_0x1a5c('0x34')]));_0xcd3e0a[_0x1a5c('0x33')]=_0xcd3e0a[_0x1a5c('0x33')][_0x1a5c('0x35')]?_0xcd3e0a['attributes']:_0x1e5e87[_0x1a5c('0x2f')];if(!_0x12784b[_0x1a5c('0x30')]['hasOwnProperty'](_0x1a5c('0x36'))){_0xcd3e0a[_0x1a5c('0x37')]=qs[_0x1a5c('0x37')](_0x12784b[_0x1a5c('0x30')]['limit']);_0xcd3e0a[_0x1a5c('0x1b')]=qs[_0x1a5c('0x1b')](_0x12784b['query'][_0x1a5c('0x1b')]);}_0xcd3e0a[_0x1a5c('0x38')]=qs[_0x1a5c('0x39')](_0x12784b[_0x1a5c('0x30')][_0x1a5c('0x39')]);_0xcd3e0a[_0x1a5c('0x3a')]=qs[_0x1a5c('0x3b')](_[_0x1a5c('0x3c')](_0x12784b[_0x1a5c('0x30')],_0x1e5e87[_0x1a5c('0x3b')]));if(_0x12784b['query'][_0x1a5c('0x3d')]){_0xcd3e0a[_0x1a5c('0x3a')]=_['merge'](_0xcd3e0a[_0x1a5c('0x3a')],{'$or':_[_0x1a5c('0x29')](_0x3e3dd1,function(_0x4ba8cf){if(_0x4ba8cf['type']!==_0x1a5c('0x3e')){var _0xefaf30={};_0xefaf30[_0x4ba8cf[_0x1a5c('0x26')]]={'$like':'%'+_0x12784b[_0x1a5c('0x30')]['filter']+'%'};return _0xefaf30;}})});}_0xcd3e0a=_['merge']({},_0xcd3e0a,_0x12784b[_0x1a5c('0x3f')]);var _0x387152={'where':_0xcd3e0a[_0x1a5c('0x3a')]};return db['OpenchannelQueueReport'][_0x1a5c('0x1a')](_0x387152)[_0x1a5c('0x22')](function(_0x129cd1){_0x157376[_0x1a5c('0x1a')]=_0x129cd1;if(_0x12784b[_0x1a5c('0x30')][_0x1a5c('0x40')]){_0xcd3e0a[_0x1a5c('0x41')]=[{'all':!![]}];}return db[_0x1a5c('0x2a')]['findAll'](_0xcd3e0a);})['then'](function(_0x5354eb){_0x157376[_0x1a5c('0x42')]=_0x5354eb;return _0x157376;})['then'](respondWithFilteredResult(_0x1ba1cf,_0xcd3e0a))[_0x1a5c('0x43')](handleError(_0x1ba1cf,null));};exports[_0x1a5c('0x44')]=function(_0x420f66,_0x4a7b07){var _0x1072d5={'raw':!![],'where':{'id':_0x420f66[_0x1a5c('0x45')]['id']}},_0x29aec3={};_0x29aec3['model']=_[_0x1a5c('0x31')](db[_0x1a5c('0x2a')][_0x1a5c('0x2b')]);_0x29aec3['query']=_[_0x1a5c('0x31')](_0x420f66[_0x1a5c('0x30')]);_0x29aec3[_0x1a5c('0x3b')]=_['intersection'](_0x29aec3[_0x1a5c('0x2f')],_0x29aec3[_0x1a5c('0x30')]);_0x1072d5['attributes']=_[_0x1a5c('0x32')](_0x29aec3[_0x1a5c('0x2f')],qs['fields'](_0x420f66['query']['fields']));_0x1072d5[_0x1a5c('0x33')]=_0x1072d5[_0x1a5c('0x33')]['length']?_0x1072d5[_0x1a5c('0x33')]:_0x29aec3[_0x1a5c('0x2f')];if(_0x420f66[_0x1a5c('0x30')][_0x1a5c('0x40')]){_0x1072d5[_0x1a5c('0x41')]=[{'all':!![]}];}_0x1072d5=_[_0x1a5c('0x46')]({},_0x1072d5,_0x420f66[_0x1a5c('0x3f')]);return db[_0x1a5c('0x2a')][_0x1a5c('0x47')](_0x1072d5)[_0x1a5c('0x22')](handleEntityNotFound(_0x4a7b07,null))['then'](respondWithResult(_0x4a7b07,null))[_0x1a5c('0x43')](handleError(_0x4a7b07,null));};exports[_0x1a5c('0x48')]=function(_0x3e03f5,_0x11f4c2){return db[_0x1a5c('0x2a')][_0x1a5c('0x48')](_0x3e03f5[_0x1a5c('0x49')],{})[_0x1a5c('0x22')](respondWithResult(_0x11f4c2,0xc9))[_0x1a5c('0x43')](handleError(_0x11f4c2,null));};exports['update']=function(_0x572a01,_0x511c19){if(_0x572a01[_0x1a5c('0x49')]['id']){delete _0x572a01[_0x1a5c('0x49')]['id'];}return db[_0x1a5c('0x2a')]['find']({'where':{'id':_0x572a01[_0x1a5c('0x45')]['id']}})[_0x1a5c('0x22')](handleEntityNotFound(_0x511c19,null))[_0x1a5c('0x22')](saveUpdates(_0x572a01[_0x1a5c('0x49')],null))[_0x1a5c('0x22')](respondWithResult(_0x511c19,null))['catch'](handleError(_0x511c19,null));};exports[_0x1a5c('0x23')]=function(_0x59d583,_0x24e1e9){return db[_0x1a5c('0x2a')][_0x1a5c('0x47')]({'where':{'id':_0x59d583[_0x1a5c('0x45')]['id']}})['then'](handleEntityNotFound(_0x24e1e9,null))[_0x1a5c('0x22')](removeEntity(_0x24e1e9,null))[_0x1a5c('0x43')](handleError(_0x24e1e9,null));};exports[_0x1a5c('0x4a')]=function(_0xd51a84,_0x3d0f37){return db[_0x1a5c('0x2a')][_0x1a5c('0x4a')]()['then'](respondWithResult(_0x3d0f37,null))[_0x1a5c('0x43')](handleError(_0x3d0f37,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 3e258d5..1ba9282 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 _0xf961=['request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','bluebird'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xf961,0x1cf));var _0x1f96=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0xf961[_0x24259d];return _0x5a701;};'use strict';var _=require(_0x1f96('0x0'));var util=require(_0x1f96('0x1'));var logger=require(_0x1f96('0x2'))(_0x1f96('0x3'));var moment=require('moment');var BPromise=require(_0x1f96('0x4'));var rp=require(_0x1f96('0x5'));var fs=require('fs');var path=require(_0x1f96('0x6'));var rimraf=require('rimraf');var config=require(_0x1f96('0x7'));var attributes=require(_0x1f96('0x8'));module[_0x1f96('0x9')]=function(_0x518062,_0x40caad){return _0x518062['define'](_0x1f96('0xa'),attributes,{'tableName':_0x1f96('0xb'),'paranoid':![],'indexes':[{'name':_0x1f96('0xc'),'fields':[_0x1f96('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xccdc=['bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','moment'];(function(_0x555b2f,_0x43b622){var _0x81c0a6=function(_0x4629e6){while(--_0x4629e6){_0x555b2f['push'](_0x555b2f['shift']());}};_0x81c0a6(++_0x43b622);}(_0xccdc,0x1c4));var _0xcccd=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0xccdc[_0x11ce46];return _0x368a1e;};'use strict';var _=require(_0xcccd('0x0'));var util=require(_0xcccd('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcccd('0x2'));var BPromise=require(_0xcccd('0x3'));var rp=require(_0xcccd('0x4'));var fs=require('fs');var path=require(_0xcccd('0x5'));var rimraf=require(_0xcccd('0x6'));var config=require(_0xcccd('0x7'));var attributes=require(_0xcccd('0x8'));module[_0xcccd('0x9')]=function(_0x2da46a,_0x18365a){return _0x2da46a['define'](_0xcccd('0xa'),attributes,{'tableName':_0xcccd('0xb'),'paranoid':![],'indexes':[{'name':_0xcccd('0xc'),'fields':[_0xcccd('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index a8d293c..dd11e05 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 _0xfbbb=['message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','stringify','UpdateOpenchannelQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','OpenchannelQueueReport,\x20%s,\x20%s'];(function(_0x33a61e,_0x159e28){var _0xc6a2e3=function(_0x51b464){while(--_0x51b464){_0x33a61e['push'](_0x33a61e['shift']());}};_0xc6a2e3(++_0x159e28);}(_0xfbbb,0x1b3));var _0xbfbb=function(_0x590096,_0x1ad366){_0x590096=_0x590096-0x0;var _0xbd6ea2=_0xfbbb[_0x590096];return _0xbd6ea2;};'use strict';var _=require(_0xbfbb('0x0'));var util=require(_0xbfbb('0x1'));var moment=require(_0xbfbb('0x2'));var BPromise=require(_0xbfbb('0x3'));var rs=require(_0xbfbb('0x4'));var fs=require('fs');var Redis=require(_0xbfbb('0x5'));var db=require(_0xbfbb('0x6'))['db'];var utils=require(_0xbfbb('0x7'));var logger=require(_0xbfbb('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbfbb('0x9'));var client=jayson['client'][_0xbfbb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16c6cc,_0x16a41c,_0x5a69b3){return new BPromise(function(_0x1f2c31,_0x3260a7){return client[_0xbfbb('0xb')](_0x16c6cc,_0x5a69b3)[_0xbfbb('0xc')](function(_0x1baefa){logger[_0xbfbb('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x16a41c,_0xbfbb('0xe'));logger[_0xbfbb('0xf')](_0xbfbb('0x10'),_0x16a41c,_0xbfbb('0xe'),JSON['stringify'](_0x1baefa));if(_0x1baefa[_0xbfbb('0x11')]){if(_0x1baefa[_0xbfbb('0x11')][_0xbfbb('0x12')]===0x1f4){logger[_0xbfbb('0x11')](_0xbfbb('0x13'),_0x16a41c,_0x1baefa[_0xbfbb('0x11')][_0xbfbb('0x14')]);return _0x3260a7(_0x1baefa[_0xbfbb('0x11')]['message']);}logger[_0xbfbb('0x11')](_0xbfbb('0x13'),_0x16a41c,_0x1baefa[_0xbfbb('0x11')][_0xbfbb('0x14')]);return _0x1f2c31(_0x1baefa[_0xbfbb('0x11')]['message']);}else{logger[_0xbfbb('0xd')](_0xbfbb('0x13'),_0x16a41c,_0xbfbb('0xe'));_0x1f2c31(_0x1baefa[_0xbfbb('0x15')][_0xbfbb('0x14')]);}})[_0xbfbb('0x16')](function(_0x2f49e5){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x16a41c,_0x2f49e5);_0x3260a7(_0x2f49e5);});});}exports[_0xbfbb('0x17')]=function(_0x4be5df){var _0xc18041=this;return new Promise(function(_0x4834a9,_0x20337e){return db[_0xbfbb('0x18')][_0xbfbb('0x19')](_0x4be5df[_0xbfbb('0x1a')],{'raw':_0x4be5df[_0xbfbb('0x1b')]?_0x4be5df['options'][_0xbfbb('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x26c69f){logger[_0xbfbb('0xd')](_0xbfbb('0x17'),_0x4be5df);logger[_0xbfbb('0xf')](_0xbfbb('0x17'),_0x4be5df,JSON[_0xbfbb('0x1d')](_0x26c69f));_0x4834a9(_0x26c69f);})[_0xbfbb('0x16')](function(_0x1c9943){logger['error'](_0xbfbb('0x17'),_0x1c9943[_0xbfbb('0x14')],_0x4be5df);_0x20337e(_0xc18041['error'](0x1f4,_0x1c9943[_0xbfbb('0x14')]));});});};exports[_0xbfbb('0x1e')]=function(_0x44bf61){var _0x26b9d6=this;return new Promise(function(_0x5adf09,_0x1116d1){return db['OpenchannelQueueReport'][_0xbfbb('0x1f')](_0x44bf61[_0xbfbb('0x1a')],{'raw':_0x44bf61[_0xbfbb('0x1b')]?_0x44bf61[_0xbfbb('0x1b')][_0xbfbb('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44bf61[_0xbfbb('0x1b')]?_0x44bf61[_0xbfbb('0x1b')][_0xbfbb('0x20')]||null:null,'attributes':_0x44bf61[_0xbfbb('0x1b')]?_0x44bf61[_0xbfbb('0x1b')][_0xbfbb('0x21')]||null:null,'limit':_0x44bf61[_0xbfbb('0x1b')]?_0x44bf61[_0xbfbb('0x1b')][_0xbfbb('0x22')]||null:null})['then'](function(_0x21a72a){logger[_0xbfbb('0xd')](_0xbfbb('0x1e'),_0x44bf61);logger[_0xbfbb('0xf')]('UpdateOpenchannelQueueReport',_0x44bf61,JSON[_0xbfbb('0x1d')](_0x21a72a));_0x5adf09(_0x21a72a);})[_0xbfbb('0x16')](function(_0x303f3b){logger['error'](_0xbfbb('0x1e'),_0x303f3b[_0xbfbb('0x14')],_0x44bf61);_0x1116d1(_0x26b9d6[_0xbfbb('0x11')](0x1f4,_0x303f3b[_0xbfbb('0x14')]));});});}; \ No newline at end of file +var _0x7880=['body','options','then','stringify','update','raw','where','attributes','limit','UpdateOpenchannelQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateOpenchannelQueueReport','create'];(function(_0x5817bb,_0x47d407){var _0x16c4d7=function(_0x319d47){while(--_0x319d47){_0x5817bb['push'](_0x5817bb['shift']());}};_0x16c4d7(++_0x47d407);}(_0x7880,0x1f4));var _0x0788=function(_0x53c552,_0x129587){_0x53c552=_0x53c552-0x0;var _0x599000=_0x7880[_0x53c552];return _0x599000;};'use strict';var _=require('lodash');var util=require(_0x0788('0x0'));var moment=require(_0x0788('0x1'));var BPromise=require(_0x0788('0x2'));var rs=require(_0x0788('0x3'));var fs=require('fs');var Redis=require(_0x0788('0x4'));var db=require(_0x0788('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0788('0x6'))(_0x0788('0x7'));var config=require(_0x0788('0x8'));var jayson=require(_0x0788('0x9'));var client=jayson[_0x0788('0xa')][_0x0788('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f9cb8,_0x44bbb5,_0x3c29f3){return new BPromise(function(_0x422f8b,_0x55e48a){return client[_0x0788('0xc')](_0x3f9cb8,_0x3c29f3)['then'](function(_0xabaf81){logger['info'](_0x0788('0xd'),_0x44bbb5,_0x0788('0xe'));logger[_0x0788('0xf')](_0x0788('0x10'),_0x44bbb5,_0x0788('0xe'),JSON['stringify'](_0xabaf81));if(_0xabaf81[_0x0788('0x11')]){if(_0xabaf81[_0x0788('0x11')][_0x0788('0x12')]===0x1f4){logger[_0x0788('0x11')](_0x0788('0xd'),_0x44bbb5,_0xabaf81[_0x0788('0x11')][_0x0788('0x13')]);return _0x55e48a(_0xabaf81['error'][_0x0788('0x13')]);}logger[_0x0788('0x11')](_0x0788('0xd'),_0x44bbb5,_0xabaf81[_0x0788('0x11')]['message']);return _0x422f8b(_0xabaf81[_0x0788('0x11')]['message']);}else{logger[_0x0788('0x14')](_0x0788('0xd'),_0x44bbb5,_0x0788('0xe'));_0x422f8b(_0xabaf81[_0x0788('0x15')][_0x0788('0x13')]);}})[_0x0788('0x16')](function(_0x5e1a29){logger['error'](_0x0788('0xd'),_0x44bbb5,_0x5e1a29);_0x55e48a(_0x5e1a29);});});}exports[_0x0788('0x17')]=function(_0x5b2bdc){var _0x654e4b=this;return new Promise(function(_0x415f19,_0x17ae59){return db['OpenchannelQueueReport'][_0x0788('0x18')](_0x5b2bdc[_0x0788('0x19')],{'raw':_0x5b2bdc['options']?_0x5b2bdc[_0x0788('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x0788('0x1b')](function(_0x48bc5f){logger[_0x0788('0x14')](_0x0788('0x17'),_0x5b2bdc);logger[_0x0788('0xf')](_0x0788('0x17'),_0x5b2bdc,JSON[_0x0788('0x1c')](_0x48bc5f));_0x415f19(_0x48bc5f);})['catch'](function(_0x48ec43){logger[_0x0788('0x11')](_0x0788('0x17'),_0x48ec43[_0x0788('0x13')],_0x5b2bdc);_0x17ae59(_0x654e4b[_0x0788('0x11')](0x1f4,_0x48ec43['message']));});});};exports['UpdateOpenchannelQueueReport']=function(_0x79204e){var _0x18cc33=this;return new Promise(function(_0x40309d,_0x50b65c){return db['OpenchannelQueueReport'][_0x0788('0x1d')](_0x79204e[_0x0788('0x19')],{'raw':_0x79204e['options']?_0x79204e['options'][_0x0788('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x79204e[_0x0788('0x1a')]?_0x79204e['options'][_0x0788('0x1f')]||null:null,'attributes':_0x79204e[_0x0788('0x1a')]?_0x79204e[_0x0788('0x1a')][_0x0788('0x20')]||null:null,'limit':_0x79204e[_0x0788('0x1a')]?_0x79204e[_0x0788('0x1a')][_0x0788('0x21')]||null:null})[_0x0788('0x1b')](function(_0x5b7594){logger['info'](_0x0788('0x22'),_0x79204e);logger[_0x0788('0xf')]('UpdateOpenchannelQueueReport',_0x79204e,JSON['stringify'](_0x5b7594));_0x40309d(_0x5b7594);})[_0x0788('0x16')](function(_0x68658a){logger[_0x0788('0x11')](_0x0788('0x22'),_0x68658a[_0x0788('0x13')],_0x79204e);_0x50b65c(_0x18cc33[_0x0788('0x11')](0x1f4,_0x68658a[_0x0788('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index b77a3c0..06e6f98 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(_0x54c9dd,_0x233a86){var _0x855156=function(_0x2dd60b){while(--_0x2dd60b){_0x54c9dd['push'](_0x54c9dd['shift']());}};_0x855156(++_0x233a86);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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(_0x1c9c24,_0x2a517b){var _0x349c69=function(_0x259ff7){while(--_0x259ff7){_0x1c9c24['push'](_0x1c9c24['shift']());}};_0x349c69(++_0x2a517b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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 25b9d8e..39605dc 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 _0x3df4=['exports','STRING','ENUM','account','agent','queue','moment','sequelize'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x3df4,0x1e6));var _0x43df=function(_0x1d0896,_0x35be56){_0x1d0896=_0x1d0896-0x0;var _0x504899=_0x3df4[_0x1d0896];return _0x504899;};'use strict';var moment=require(_0x43df('0x0'));var Sequelize=require(_0x43df('0x1'));module[_0x43df('0x2')]={'uniqueid':{'type':Sequelize[_0x43df('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x43df('0x4')](_0x43df('0x5'),_0x43df('0x6'),_0x43df('0x7')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xa8c7=['queue','DATE','NOW','moment','exports','STRING','ENUM'];(function(_0x314f0d,_0x47d027){var _0x546dee=function(_0x7fc401){while(--_0x7fc401){_0x314f0d['push'](_0x314f0d['shift']());}};_0x546dee(++_0x47d027);}(_0xa8c7,0x15a));var _0x7a8c=function(_0x1402a2,_0x34beff){_0x1402a2=_0x1402a2-0x0;var _0x9f6c1f=_0xa8c7[_0x1402a2];return _0x9f6c1f;};'use strict';var moment=require(_0x7a8c('0x0'));var Sequelize=require('sequelize');module[_0x7a8c('0x1')]={'uniqueid':{'type':Sequelize[_0x7a8c('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7a8c('0x3')]('account','agent','queue'),'allowNull':![],'defaultValue':_0x7a8c('0x4')},'transferredAt':{'type':Sequelize[_0x7a8c('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x7a8c('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 904109e..c64c98b 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 _0x561a=['../../mysqldb','sendStatus','end','status','json','count','offset','Content-Range','save','update','then','destroy','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x561a,0x1a9));var _0xa561=function(_0x376db5,_0x2b8874){_0x376db5=_0x376db5-0x0;var _0x304c17=_0x561a[_0x376db5];return _0x304c17;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa561('0x0'));var rimraf=require(_0xa561('0x1'));var zipdir=require(_0xa561('0x2'));var jsonpatch=require(_0xa561('0x3'));var rp=require('request-promise');var moment=require(_0xa561('0x4'));var BPromise=require(_0xa561('0x5'));var Mustache=require(_0xa561('0x6'));var util=require(_0xa561('0x7'));var path=require(_0xa561('0x8'));var sox=require(_0xa561('0x9'));var csv=require(_0xa561('0xa'));var ejs=require(_0xa561('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa561('0xc'));var crypto=require(_0xa561('0xd'));var jsforce=require(_0xa561('0xe'));var deskjs=require(_0xa561('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa561('0x10'));var Papa=require(_0xa561('0x11'));var Redis=require('ioredis');var authService=require(_0xa561('0x12'));var qs=require(_0xa561('0x13'));var as=require(_0xa561('0x14'));var hardwareService=require(_0xa561('0x15'));var logger=require(_0xa561('0x16'))('api');var utils=require(_0xa561('0x17'));var config=require(_0xa561('0x18'));var db=require(_0xa561('0x19'))['db'];function respondWithStatusCode(_0x254d84,_0xba7dc2){_0xba7dc2=_0xba7dc2||0xcc;return function(_0x2cabc7){if(_0x2cabc7){return _0x254d84[_0xa561('0x1a')](_0xba7dc2);}return _0x254d84['status'](_0xba7dc2)[_0xa561('0x1b')]();};}function respondWithResult(_0x5e1f55,_0x1d2814){_0x1d2814=_0x1d2814||0xc8;return function(_0x41dbdf){if(_0x41dbdf){return _0x5e1f55[_0xa561('0x1c')](_0x1d2814)[_0xa561('0x1d')](_0x41dbdf);}};}function respondWithFilteredResult(_0x2764da,_0x509bfd){return function(_0x2507fe){if(_0x2507fe){var _0x3b1cad=_0x2507fe[_0xa561('0x1e')],_0x2a64df=_0x509bfd[_0xa561('0x1f')],_0x3fa486=_0x509bfd[_0xa561('0x1f')]+_0x509bfd['limit'],_0x3914af;if(_0x3fa486>=_0x3b1cad){_0x3fa486=_0x3b1cad;_0x3914af=0xc8;}else{_0x3914af=0xce;}_0x2764da['status'](_0x3914af);return _0x2764da['set'](_0xa561('0x20'),_0x2a64df+'-'+_0x3fa486+'/'+_0x3b1cad)[_0xa561('0x1d')](_0x2507fe);}return null;};}function patchUpdates(_0x1911b1){return function(_0xfcb67a){try{jsonpatch['apply'](_0xfcb67a,_0x1911b1,!![]);}catch(_0x5d9f0a){return BPromise['reject'](_0x5d9f0a);}return _0xfcb67a[_0xa561('0x21')]();};}function saveUpdates(_0x345422,_0x1862de){return function(_0x1407ab){if(_0x1407ab){return _0x1407ab[_0xa561('0x22')](_0x345422)[_0xa561('0x23')](function(_0x59faba){return _0x59faba;});}return null;};}function removeEntity(_0x39a617,_0x2e7e7c){return function(_0x183951){if(_0x183951){return _0x183951[_0xa561('0x24')]()[_0xa561('0x23')](function(){_0x39a617[_0xa561('0x1c')](0xcc)[_0xa561('0x1b')]();});}};}function handleEntityNotFound(_0x5d7e98,_0x1510d0){return function(_0x11c6b7){if(!_0x11c6b7){_0x5d7e98[_0xa561('0x1a')](0x194);}return _0x11c6b7;};}function handleError(_0x202363,_0x1c2469){_0x1c2469=_0x1c2469||0x1f4;return function(_0x193728){logger[_0xa561('0x25')](_0x193728[_0xa561('0x26')]);if(_0x193728[_0xa561('0x27')]){delete _0x193728[_0xa561('0x27')];}_0x202363[_0xa561('0x1c')](_0x1c2469)[_0xa561('0x28')](_0x193728);};}exports[_0xa561('0x29')]=function(_0x15e49e,_0x2a99a6){var _0x40da6f={},_0x50177d={},_0x57bf31={'count':0x0,'rows':[]};var _0x4ed770=_[_0xa561('0x2a')](db[_0xa561('0x2b')][_0xa561('0x2c')],function(_0x4f12a3){return{'name':_0x4f12a3['fieldName'],'type':_0x4f12a3['type']['key']};});_0x50177d[_0xa561('0x2d')]=_['map'](_0x4ed770,'name');_0x50177d[_0xa561('0x2e')]=_[_0xa561('0x2f')](_0x15e49e['query']);_0x50177d[_0xa561('0x30')]=_[_0xa561('0x31')](_0x50177d[_0xa561('0x2d')],_0x50177d[_0xa561('0x2e')]);_0x40da6f[_0xa561('0x32')]=_['intersection'](_0x50177d[_0xa561('0x2d')],qs['fields'](_0x15e49e[_0xa561('0x2e')][_0xa561('0x33')]));_0x40da6f['attributes']=_0x40da6f['attributes'][_0xa561('0x34')]?_0x40da6f[_0xa561('0x32')]:_0x50177d[_0xa561('0x2d')];if(!_0x15e49e[_0xa561('0x2e')][_0xa561('0x35')]('nolimit')){_0x40da6f[_0xa561('0x36')]=qs[_0xa561('0x36')](_0x15e49e[_0xa561('0x2e')][_0xa561('0x36')]);_0x40da6f[_0xa561('0x1f')]=qs[_0xa561('0x1f')](_0x15e49e[_0xa561('0x2e')][_0xa561('0x1f')]);}_0x40da6f[_0xa561('0x37')]=qs[_0xa561('0x38')](_0x15e49e[_0xa561('0x2e')][_0xa561('0x38')]);_0x40da6f[_0xa561('0x39')]=qs[_0xa561('0x30')](_[_0xa561('0x3a')](_0x15e49e[_0xa561('0x2e')],_0x50177d[_0xa561('0x30')]));if(_0x15e49e[_0xa561('0x2e')]['filter']){_0x40da6f[_0xa561('0x39')]=_[_0xa561('0x3b')](_0x40da6f[_0xa561('0x39')],{'$or':_[_0xa561('0x2a')](_0x4ed770,function(_0x154910){if(_0x154910[_0xa561('0x3c')]!==_0xa561('0x3d')){var _0x6492c8={};_0x6492c8[_0x154910[_0xa561('0x27')]]={'$like':'%'+_0x15e49e['query'][_0xa561('0x3e')]+'%'};return _0x6492c8;}})});}_0x40da6f=_[_0xa561('0x3b')]({},_0x40da6f,_0x15e49e[_0xa561('0x3f')]);var _0x5283b4={'where':_0x40da6f[_0xa561('0x39')]};return db[_0xa561('0x2b')][_0xa561('0x1e')](_0x5283b4)[_0xa561('0x23')](function(_0x374918){_0x57bf31['count']=_0x374918;if(_0x15e49e[_0xa561('0x2e')]['includeAll']){_0x40da6f[_0xa561('0x40')]=[{'all':!![]}];}return db[_0xa561('0x2b')][_0xa561('0x41')](_0x40da6f);})[_0xa561('0x23')](function(_0x2827d0){_0x57bf31[_0xa561('0x42')]=_0x2827d0;return _0x57bf31;})['then'](respondWithFilteredResult(_0x2a99a6,_0x40da6f))[_0xa561('0x43')](handleError(_0x2a99a6,null));};exports[_0xa561('0x44')]=function(_0x214585,_0x524db9){var _0x215f0f={'raw':!![],'where':{'id':_0x214585[_0xa561('0x45')]['id']}},_0x14e59f={};_0x14e59f[_0xa561('0x2d')]=_[_0xa561('0x2f')](db[_0xa561('0x2b')][_0xa561('0x2c')]);_0x14e59f['query']=_[_0xa561('0x2f')](_0x214585['query']);_0x14e59f[_0xa561('0x30')]=_[_0xa561('0x31')](_0x14e59f[_0xa561('0x2d')],_0x14e59f[_0xa561('0x2e')]);_0x215f0f['attributes']=_[_0xa561('0x31')](_0x14e59f[_0xa561('0x2d')],qs[_0xa561('0x33')](_0x214585[_0xa561('0x2e')][_0xa561('0x33')]));_0x215f0f[_0xa561('0x32')]=_0x215f0f[_0xa561('0x32')][_0xa561('0x34')]?_0x215f0f[_0xa561('0x32')]:_0x14e59f[_0xa561('0x2d')];if(_0x214585[_0xa561('0x2e')][_0xa561('0x46')]){_0x215f0f[_0xa561('0x40')]=[{'all':!![]}];}_0x215f0f=_[_0xa561('0x3b')]({},_0x215f0f,_0x214585[_0xa561('0x3f')]);return db[_0xa561('0x2b')][_0xa561('0x47')](_0x215f0f)[_0xa561('0x23')](handleEntityNotFound(_0x524db9,null))[_0xa561('0x23')](respondWithResult(_0x524db9,null))[_0xa561('0x43')](handleError(_0x524db9,null));};exports[_0xa561('0x48')]=function(_0x135d7a,_0xf2c733){return db['OpenchannelTransferReport']['create'](_0x135d7a[_0xa561('0x49')],{})['then'](respondWithResult(_0xf2c733,0xc9))[_0xa561('0x43')](handleError(_0xf2c733,null));};exports['update']=function(_0x156219,_0x2a8ec4){if(_0x156219[_0xa561('0x49')]['id']){delete _0x156219[_0xa561('0x49')]['id'];}return db[_0xa561('0x2b')][_0xa561('0x47')]({'where':{'id':_0x156219[_0xa561('0x45')]['id']}})['then'](handleEntityNotFound(_0x2a8ec4,null))[_0xa561('0x23')](saveUpdates(_0x156219[_0xa561('0x49')],null))[_0xa561('0x23')](respondWithResult(_0x2a8ec4,null))[_0xa561('0x43')](handleError(_0x2a8ec4,null));};exports[_0xa561('0x24')]=function(_0x10fc5d,_0x298ad8){return db[_0xa561('0x2b')][_0xa561('0x47')]({'where':{'id':_0x10fc5d[_0xa561('0x45')]['id']}})[_0xa561('0x23')](handleEntityNotFound(_0x298ad8,null))[_0xa561('0x23')](removeEntity(_0x298ad8,null))['catch'](handleError(_0x298ad8,null));};exports[_0xa561('0x4a')]=function(_0x5f33a1,_0x1ea418){return db['OpenchannelTransferReport'][_0xa561('0x4a')]()[_0xa561('0x23')](respondWithResult(_0x1ea418,null))[_0xa561('0x43')](handleError(_0x1ea418,null));}; \ No newline at end of file +var _0x3d4a=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','OpenchannelTransferReport','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','includeAll','include','findAll','catch','show','params','keys','rawAttributes','options','create','body','find','describe','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x136604,_0x2990ce){var _0x444cc6=function(_0x5ee8c6){while(--_0x5ee8c6){_0x136604['push'](_0x136604['shift']());}};_0x444cc6(++_0x2990ce);}(_0x3d4a,0x87));var _0xa3d4=function(_0x5cc623,_0x2013e){_0x5cc623=_0x5cc623-0x0;var _0x31799e=_0x3d4a[_0x5cc623];return _0x31799e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa3d4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa3d4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa3d4('0x2'));var BPromise=require(_0xa3d4('0x3'));var Mustache=require(_0xa3d4('0x4'));var util=require(_0xa3d4('0x5'));var path=require(_0xa3d4('0x6'));var sox=require(_0xa3d4('0x7'));var csv=require(_0xa3d4('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xa3d4('0x9'));var crypto=require(_0xa3d4('0xa'));var jsforce=require(_0xa3d4('0xb'));var deskjs=require(_0xa3d4('0xc'));var toCsv=require(_0xa3d4('0x8'));var querystring=require(_0xa3d4('0xd'));var Papa=require('papaparse');var Redis=require(_0xa3d4('0xe'));var authService=require(_0xa3d4('0xf'));var qs=require(_0xa3d4('0x10'));var as=require(_0xa3d4('0x11'));var hardwareService=require(_0xa3d4('0x12'));var logger=require(_0xa3d4('0x13'))(_0xa3d4('0x14'));var utils=require(_0xa3d4('0x15'));var config=require(_0xa3d4('0x16'));var db=require(_0xa3d4('0x17'))['db'];function respondWithStatusCode(_0x31cc29,_0x43d7dc){_0x43d7dc=_0x43d7dc||0xcc;return function(_0x2aed25){if(_0x2aed25){return _0x31cc29[_0xa3d4('0x18')](_0x43d7dc);}return _0x31cc29[_0xa3d4('0x19')](_0x43d7dc)[_0xa3d4('0x1a')]();};}function respondWithResult(_0x27c0ee,_0x51b7fd){_0x51b7fd=_0x51b7fd||0xc8;return function(_0x46e0e6){if(_0x46e0e6){return _0x27c0ee['status'](_0x51b7fd)[_0xa3d4('0x1b')](_0x46e0e6);}};}function respondWithFilteredResult(_0x45b57c,_0x6c568f){return function(_0x33ea38){if(_0x33ea38){var _0x2f33d4=_0x33ea38[_0xa3d4('0x1c')],_0x1d98f0=_0x6c568f[_0xa3d4('0x1d')],_0x238b0c=_0x6c568f[_0xa3d4('0x1d')]+_0x6c568f[_0xa3d4('0x1e')],_0x1ce082;if(_0x238b0c>=_0x2f33d4){_0x238b0c=_0x2f33d4;_0x1ce082=0xc8;}else{_0x1ce082=0xce;}_0x45b57c[_0xa3d4('0x19')](_0x1ce082);return _0x45b57c[_0xa3d4('0x1f')](_0xa3d4('0x20'),_0x1d98f0+'-'+_0x238b0c+'/'+_0x2f33d4)[_0xa3d4('0x1b')](_0x33ea38);}return null;};}function patchUpdates(_0x4aa4da){return function(_0x567a77){try{jsonpatch[_0xa3d4('0x21')](_0x567a77,_0x4aa4da,!![]);}catch(_0x3612d6){return BPromise[_0xa3d4('0x22')](_0x3612d6);}return _0x567a77[_0xa3d4('0x23')]();};}function saveUpdates(_0x36e3ed,_0x25beae){return function(_0x27c948){if(_0x27c948){return _0x27c948[_0xa3d4('0x24')](_0x36e3ed)['then'](function(_0x4fd104){return _0x4fd104;});}return null;};}function removeEntity(_0x74d534,_0x4b6847){return function(_0x104c79){if(_0x104c79){return _0x104c79[_0xa3d4('0x25')]()[_0xa3d4('0x26')](function(){_0x74d534['status'](0xcc)[_0xa3d4('0x1a')]();});}};}function handleEntityNotFound(_0x9205dc,_0x1285c1){return function(_0x3dc319){if(!_0x3dc319){_0x9205dc[_0xa3d4('0x18')](0x194);}return _0x3dc319;};}function handleError(_0x204fd6,_0x2a5ac5){_0x2a5ac5=_0x2a5ac5||0x1f4;return function(_0x296bc1){logger[_0xa3d4('0x27')](_0x296bc1[_0xa3d4('0x28')]);if(_0x296bc1[_0xa3d4('0x29')]){delete _0x296bc1['name'];}_0x204fd6[_0xa3d4('0x19')](_0x2a5ac5)[_0xa3d4('0x2a')](_0x296bc1);};}exports[_0xa3d4('0x2b')]=function(_0x1891fa,_0x86386){var _0x248561={},_0x4a4176={},_0x401553={'count':0x0,'rows':[]};var _0x3a2da5=_['map'](db[_0xa3d4('0x2c')]['rawAttributes'],function(_0xc057c8){return{'name':_0xc057c8[_0xa3d4('0x2d')],'type':_0xc057c8[_0xa3d4('0x2e')][_0xa3d4('0x2f')]};});_0x4a4176[_0xa3d4('0x30')]=_[_0xa3d4('0x31')](_0x3a2da5,_0xa3d4('0x29'));_0x4a4176['query']=_['keys'](_0x1891fa[_0xa3d4('0x32')]);_0x4a4176[_0xa3d4('0x33')]=_[_0xa3d4('0x34')](_0x4a4176[_0xa3d4('0x30')],_0x4a4176['query']);_0x248561[_0xa3d4('0x35')]=_['intersection'](_0x4a4176[_0xa3d4('0x30')],qs[_0xa3d4('0x36')](_0x1891fa[_0xa3d4('0x32')]['fields']));_0x248561[_0xa3d4('0x35')]=_0x248561[_0xa3d4('0x35')][_0xa3d4('0x37')]?_0x248561[_0xa3d4('0x35')]:_0x4a4176[_0xa3d4('0x30')];if(!_0x1891fa['query'][_0xa3d4('0x38')]('nolimit')){_0x248561[_0xa3d4('0x1e')]=qs[_0xa3d4('0x1e')](_0x1891fa[_0xa3d4('0x32')]['limit']);_0x248561['offset']=qs[_0xa3d4('0x1d')](_0x1891fa[_0xa3d4('0x32')][_0xa3d4('0x1d')]);}_0x248561[_0xa3d4('0x39')]=qs[_0xa3d4('0x3a')](_0x1891fa[_0xa3d4('0x32')]['sort']);_0x248561['where']=qs[_0xa3d4('0x33')](_[_0xa3d4('0x3b')](_0x1891fa[_0xa3d4('0x32')],_0x4a4176[_0xa3d4('0x33')]));if(_0x1891fa[_0xa3d4('0x32')][_0xa3d4('0x3c')]){_0x248561['where']=_[_0xa3d4('0x3d')](_0x248561[_0xa3d4('0x3e')],{'$or':_[_0xa3d4('0x31')](_0x3a2da5,function(_0x18f69b){if(_0x18f69b[_0xa3d4('0x2e')]!=='VIRTUAL'){var _0x2d80dc={};_0x2d80dc[_0x18f69b[_0xa3d4('0x29')]]={'$like':'%'+_0x1891fa['query']['filter']+'%'};return _0x2d80dc;}})});}_0x248561=_[_0xa3d4('0x3d')]({},_0x248561,_0x1891fa['options']);var _0x8fcd1c={'where':_0x248561[_0xa3d4('0x3e')]};return db[_0xa3d4('0x2c')]['count'](_0x8fcd1c)['then'](function(_0x1ff106){_0x401553['count']=_0x1ff106;if(_0x1891fa[_0xa3d4('0x32')][_0xa3d4('0x3f')]){_0x248561[_0xa3d4('0x40')]=[{'all':!![]}];}return db[_0xa3d4('0x2c')][_0xa3d4('0x41')](_0x248561);})[_0xa3d4('0x26')](function(_0x46c91b){_0x401553['rows']=_0x46c91b;return _0x401553;})[_0xa3d4('0x26')](respondWithFilteredResult(_0x86386,_0x248561))[_0xa3d4('0x42')](handleError(_0x86386,null));};exports[_0xa3d4('0x43')]=function(_0x556b0c,_0x538ab6){var _0x257f83={'raw':!![],'where':{'id':_0x556b0c[_0xa3d4('0x44')]['id']}},_0x39acb5={};_0x39acb5['model']=_[_0xa3d4('0x45')](db[_0xa3d4('0x2c')][_0xa3d4('0x46')]);_0x39acb5[_0xa3d4('0x32')]=_[_0xa3d4('0x45')](_0x556b0c[_0xa3d4('0x32')]);_0x39acb5['filters']=_[_0xa3d4('0x34')](_0x39acb5['model'],_0x39acb5[_0xa3d4('0x32')]);_0x257f83[_0xa3d4('0x35')]=_[_0xa3d4('0x34')](_0x39acb5[_0xa3d4('0x30')],qs[_0xa3d4('0x36')](_0x556b0c[_0xa3d4('0x32')][_0xa3d4('0x36')]));_0x257f83['attributes']=_0x257f83[_0xa3d4('0x35')]['length']?_0x257f83[_0xa3d4('0x35')]:_0x39acb5[_0xa3d4('0x30')];if(_0x556b0c[_0xa3d4('0x32')][_0xa3d4('0x3f')]){_0x257f83[_0xa3d4('0x40')]=[{'all':!![]}];}_0x257f83=_['merge']({},_0x257f83,_0x556b0c[_0xa3d4('0x47')]);return db['OpenchannelTransferReport']['find'](_0x257f83)[_0xa3d4('0x26')](handleEntityNotFound(_0x538ab6,null))[_0xa3d4('0x26')](respondWithResult(_0x538ab6,null))[_0xa3d4('0x42')](handleError(_0x538ab6,null));};exports[_0xa3d4('0x48')]=function(_0x4cb56e,_0x361c7a){return db[_0xa3d4('0x2c')]['create'](_0x4cb56e['body'],{})[_0xa3d4('0x26')](respondWithResult(_0x361c7a,0xc9))['catch'](handleError(_0x361c7a,null));};exports[_0xa3d4('0x24')]=function(_0x17e2b4,_0x21f672){if(_0x17e2b4[_0xa3d4('0x49')]['id']){delete _0x17e2b4['body']['id'];}return db['OpenchannelTransferReport'][_0xa3d4('0x4a')]({'where':{'id':_0x17e2b4['params']['id']}})[_0xa3d4('0x26')](handleEntityNotFound(_0x21f672,null))[_0xa3d4('0x26')](saveUpdates(_0x17e2b4[_0xa3d4('0x49')],null))[_0xa3d4('0x26')](respondWithResult(_0x21f672,null))[_0xa3d4('0x42')](handleError(_0x21f672,null));};exports['destroy']=function(_0x450d6f,_0x40a9c2){return db['OpenchannelTransferReport'][_0xa3d4('0x4a')]({'where':{'id':_0x450d6f[_0xa3d4('0x44')]['id']}})[_0xa3d4('0x26')](handleEntityNotFound(_0x40a9c2,null))[_0xa3d4('0x26')](removeEntity(_0x40a9c2,null))[_0xa3d4('0x42')](handleError(_0x40a9c2,null));};exports[_0xa3d4('0x4b')]=function(_0x479c00,_0x217e85){return db['OpenchannelTransferReport']['describe']()[_0xa3d4('0x26')](respondWithResult(_0x217e85,null))[_0xa3d4('0x42')](handleError(_0x217e85,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 5674a28..ad95ea2 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 _0x6613=['bluebird','request-promise','./openchannelTransferReport.attributes','exports','define','report_openchannel_transfer','uniqueid','lodash','util','api'];(function(_0xc6cd9,_0x24938f){var _0x39ca4b=function(_0x454857){while(--_0x454857){_0xc6cd9['push'](_0xc6cd9['shift']());}};_0x39ca4b(++_0x24938f);}(_0x6613,0x1b5));var _0x3661=function(_0x5c6a30,_0x498d4f){_0x5c6a30=_0x5c6a30-0x0;var _0x40dc55=_0x6613[_0x5c6a30];return _0x40dc55;};'use strict';var _=require(_0x3661('0x0'));var util=require(_0x3661('0x1'));var logger=require('../../config/logger')(_0x3661('0x2'));var moment=require('moment');var BPromise=require(_0x3661('0x3'));var rp=require(_0x3661('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3661('0x5'));module[_0x3661('0x6')]=function(_0xebd361,_0xd2270f){return _0xebd361[_0x3661('0x7')]('OpenchannelTransferReport',attributes,{'tableName':_0x3661('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x3661('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x898e=['bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','api','moment'];(function(_0x47b15f,_0x103e93){var _0x55bf25=function(_0x51fe7f){while(--_0x51fe7f){_0x47b15f['push'](_0x47b15f['shift']());}};_0x55bf25(++_0x103e93);}(_0x898e,0x8d));var _0xe898=function(_0x4bed77,_0x34df35){_0x4bed77=_0x4bed77-0x0;var _0x45835d=_0x898e[_0x4bed77];return _0x45835d;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xe898('0x0'));var moment=require(_0xe898('0x1'));var BPromise=require(_0xe898('0x2'));var rp=require(_0xe898('0x3'));var fs=require('fs');var path=require(_0xe898('0x4'));var rimraf=require(_0xe898('0x5'));var config=require(_0xe898('0x6'));var attributes=require(_0xe898('0x7'));module[_0xe898('0x8')]=function(_0xc7a2b,_0x4d4102){return _0xc7a2b[_0xe898('0x9')](_0xe898('0xa'),attributes,{'tableName':_0xe898('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xe898('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 30b3532..6d9a529 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 _0x714b=['code','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','client','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x714b,0xed));var _0xb714=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x714b[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0xb714('0x0'));var moment=require(_0xb714('0x1'));var BPromise=require(_0xb714('0x2'));var rs=require(_0xb714('0x3'));var fs=require('fs');var Redis=require(_0xb714('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb714('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xb714('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb714('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c83e7,_0x1339e5,_0x15c851){return new BPromise(function(_0x53f18a,_0x45cf6d){return client['request'](_0x3c83e7,_0x15c851)[_0xb714('0x8')](function(_0xf92413){logger['info'](_0xb714('0x9'),_0x1339e5,_0xb714('0xa'));logger[_0xb714('0xb')](_0xb714('0xc'),_0x1339e5,'request\x20sent',JSON[_0xb714('0xd')](_0xf92413));if(_0xf92413[_0xb714('0xe')]){if(_0xf92413[_0xb714('0xe')][_0xb714('0xf')]===0x1f4){logger[_0xb714('0xe')](_0xb714('0x9'),_0x1339e5,_0xf92413[_0xb714('0xe')][_0xb714('0x10')]);return _0x45cf6d(_0xf92413[_0xb714('0xe')][_0xb714('0x10')]);}logger[_0xb714('0xe')](_0xb714('0x9'),_0x1339e5,_0xf92413[_0xb714('0xe')][_0xb714('0x10')]);return _0x53f18a(_0xf92413['error']['message']);}else{logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x1339e5,_0xb714('0xa'));_0x53f18a(_0xf92413['result'][_0xb714('0x10')]);}})[_0xb714('0x11')](function(_0x388f5d){logger['error'](_0xb714('0x9'),_0x1339e5,_0x388f5d);_0x45cf6d(_0x388f5d);});});} \ No newline at end of file +var _0x2e23=['jayson/promise','client','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x222f3a,_0x3d4f8b){var _0x2012f1=function(_0x411d29){while(--_0x411d29){_0x222f3a['push'](_0x222f3a['shift']());}};_0x2012f1(++_0x3d4f8b);}(_0x2e23,0xb5));var _0x32e2=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x2e23[_0x4e9628];return _0x27bc8c;};'use strict';var _=require(_0x32e2('0x0'));var util=require(_0x32e2('0x1'));var moment=require(_0x32e2('0x2'));var BPromise=require(_0x32e2('0x3'));var rs=require(_0x32e2('0x4'));var fs=require('fs');var Redis=require(_0x32e2('0x5'));var db=require(_0x32e2('0x6'))['db'];var utils=require(_0x32e2('0x7'));var logger=require(_0x32e2('0x8'))(_0x32e2('0x9'));var config=require(_0x32e2('0xa'));var jayson=require(_0x32e2('0xb'));var client=jayson[_0x32e2('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x491709,_0x571acf,_0xfe35a3){return new BPromise(function(_0xb2cde6,_0x48322f){return client[_0x32e2('0xd')](_0x491709,_0xfe35a3)[_0x32e2('0xe')](function(_0x3df391){logger[_0x32e2('0xf')](_0x32e2('0x10'),_0x571acf,_0x32e2('0x11'));logger['debug'](_0x32e2('0x12'),_0x571acf,_0x32e2('0x11'),JSON[_0x32e2('0x13')](_0x3df391));if(_0x3df391[_0x32e2('0x14')]){if(_0x3df391[_0x32e2('0x14')]['code']===0x1f4){logger[_0x32e2('0x14')](_0x32e2('0x10'),_0x571acf,_0x3df391[_0x32e2('0x14')][_0x32e2('0x15')]);return _0x48322f(_0x3df391['error'][_0x32e2('0x15')]);}logger[_0x32e2('0x14')](_0x32e2('0x10'),_0x571acf,_0x3df391['error'][_0x32e2('0x15')]);return _0xb2cde6(_0x3df391['error'][_0x32e2('0x15')]);}else{logger['info'](_0x32e2('0x10'),_0x571acf,'request\x20sent');_0xb2cde6(_0x3df391[_0x32e2('0x16')][_0x32e2('0x15')]);}})[_0x32e2('0x17')](function(_0x4fdc82){logger[_0x32e2('0x14')](_0x32e2('0x10'),_0x571acf,_0x4fdc82);_0x48322f(_0x4fdc82);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index b474155..13a4d0c 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 _0x09d4=['index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated'];(function(_0x2465c0,_0x44e2b0){var _0x52ca9d=function(_0x5ce8f8){while(--_0x5ce8f8){_0x2465c0['push'](_0x2465c0['shift']());}};_0x52ca9d(++_0x44e2b0);}(_0x09d4,0x171));var _0x409d=function(_0x54eb4d,_0x55b9c8){_0x54eb4d=_0x54eb4d-0x0;var _0x4b15da=_0x09d4[_0x54eb4d];return _0x4b15da;};'use strict';var multer=require(_0x409d('0x0'));var util=require(_0x409d('0x1'));var path=require(_0x409d('0x2'));var timeout=require(_0x409d('0x3'));var express=require(_0x409d('0x4'));var router=express['Router']();var auth=require(_0x409d('0x5'));var interaction=require(_0x409d('0x6'));var config=require(_0x409d('0x7'));var controller=require(_0x409d('0x8'));router[_0x409d('0x9')]('/',auth[_0x409d('0xa')](),controller[_0x409d('0xb')]);router[_0x409d('0x9')](_0x409d('0xc'),auth[_0x409d('0xa')](),controller[_0x409d('0xd')]);router[_0x409d('0xe')]('/',auth[_0x409d('0xa')](),controller[_0x409d('0xf')]);router[_0x409d('0x10')](_0x409d('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x409d('0x11')](_0x409d('0xc'),auth[_0x409d('0xa')](),controller[_0x409d('0x12')]);module[_0x409d('0x13')]=router; \ No newline at end of file +var _0x528f=['get','isAuthenticated','index','show','post','create','put','update','delete','/:id','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller'];(function(_0x5ee582,_0x5c1898){var _0x176a90=function(_0x302057){while(--_0x302057){_0x5ee582['push'](_0x5ee582['shift']());}};_0x176a90(++_0x5c1898);}(_0x528f,0x131));var _0xf528=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x528f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xf528('0x0'));var util=require(_0xf528('0x1'));var path=require(_0xf528('0x2'));var timeout=require(_0xf528('0x3'));var express=require(_0xf528('0x4'));var router=express[_0xf528('0x5')]();var auth=require(_0xf528('0x6'));var interaction=require(_0xf528('0x7'));var config=require(_0xf528('0x8'));var controller=require(_0xf528('0x9'));router[_0xf528('0xa')]('/',auth[_0xf528('0xb')](),controller[_0xf528('0xc')]);router[_0xf528('0xa')]('/:id',auth[_0xf528('0xb')](),controller[_0xf528('0xd')]);router[_0xf528('0xe')]('/',auth[_0xf528('0xb')](),controller[_0xf528('0xf')]);router[_0xf528('0x10')]('/:id',auth[_0xf528('0xb')](),controller[_0xf528('0x11')]);router[_0xf528('0x12')](_0xf528('0x13'),auth[_0xf528('0xb')](),controller[_0xf528('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 7687fb6..253f52e 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 _0x684c=['exports','STRING','name','sequelize'];(function(_0x15eab7,_0x49bed6){var _0x1f15c6=function(_0x33acb0){while(--_0x33acb0){_0x15eab7['push'](_0x15eab7['shift']());}};_0x1f15c6(++_0x49bed6);}(_0x684c,0x6f));var _0xc684=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x684c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc684('0x0'));module[_0xc684('0x1')]={'name':{'type':Sequelize[_0xc684('0x2')],'unique':_0xc684('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xc684('0x2')]}}; \ No newline at end of file +var _0x31a2=['STRING','name','sequelize'];(function(_0x2e4582,_0x2b2c22){var _0x7ed577=function(_0x4256de){while(--_0x4256de){_0x2e4582['push'](_0x2e4582['shift']());}};_0x7ed577(++_0x2b2c22);}(_0x31a2,0x10d));var _0x231a=function(_0x33b07c,_0x429a14){_0x33b07c=_0x33b07c-0x0;var _0x175ee0=_0x31a2[_0x33b07c];return _0x175ee0;};'use strict';var Sequelize=require(_0x231a('0x0'));module['exports']={'name':{'type':Sequelize[_0x231a('0x1')],'unique':_0x231a('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x231a('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index e336888..d5a8a77 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 _0xf955=['util','path','ejs','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','get','Pauses','error','stack','name','send','map','Pause','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird'];(function(_0x51fe5f,_0x1d8632){var _0x4abce9=function(_0x34afb7){while(--_0x34afb7){_0x51fe5f['push'](_0x51fe5f['shift']());}};_0x4abce9(++_0x1d8632);}(_0xf955,0x176));var _0x5f95=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xf955[_0x3c4737];return _0x2bb926;};'use strict';var pdf=require(_0x5f95('0x0'));var emlformat=require(_0x5f95('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5f95('0x2'));var jsonpatch=require(_0x5f95('0x3'));var rp=require(_0x5f95('0x4'));var moment=require('moment');var BPromise=require(_0x5f95('0x5'));var Mustache=require('mustache');var util=require(_0x5f95('0x6'));var path=require(_0x5f95('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5f95('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5f95('0x9'));var crypto=require('crypto');var jsforce=require(_0x5f95('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5f95('0xb'));var Papa=require(_0x5f95('0xc'));var Redis=require(_0x5f95('0xd'));var authService=require(_0x5f95('0xe'));var qs=require(_0x5f95('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5f95('0x10'));var logger=require('../../config/logger')(_0x5f95('0x11'));var utils=require(_0x5f95('0x12'));var config=require('../../config/environment');var db=require(_0x5f95('0x13'))['db'];function respondWithStatusCode(_0x105963,_0x5674e9){_0x5674e9=_0x5674e9||0xcc;return function(_0x59b041){if(_0x59b041){return _0x105963[_0x5f95('0x14')](_0x5674e9);}return _0x105963['status'](_0x5674e9)[_0x5f95('0x15')]();};}function respondWithResult(_0x8b6a44,_0xcc9668){_0xcc9668=_0xcc9668||0xc8;return function(_0x5aa243){if(_0x5aa243){return _0x8b6a44[_0x5f95('0x16')](_0xcc9668)[_0x5f95('0x17')](_0x5aa243);}};}function respondWithFilteredResult(_0x418063,_0x35fa25){return function(_0x3b0535){if(_0x3b0535){var _0x119ede=_0x3b0535[_0x5f95('0x18')],_0x1d61a1=_0x35fa25[_0x5f95('0x19')],_0x4e57f3=_0x35fa25[_0x5f95('0x19')]+_0x35fa25[_0x5f95('0x1a')],_0x2d613c;if(_0x4e57f3>=_0x119ede){_0x4e57f3=_0x119ede;_0x2d613c=0xc8;}else{_0x2d613c=0xce;}_0x418063[_0x5f95('0x16')](_0x2d613c);return _0x418063[_0x5f95('0x1b')](_0x5f95('0x1c'),_0x1d61a1+'-'+_0x4e57f3+'/'+_0x119ede)[_0x5f95('0x17')](_0x3b0535);}return null;};}function patchUpdates(_0x553cfe){return function(_0x1f8781){try{jsonpatch[_0x5f95('0x1d')](_0x1f8781,_0x553cfe,!![]);}catch(_0x397ec9){return BPromise[_0x5f95('0x1e')](_0x397ec9);}return _0x1f8781[_0x5f95('0x1f')]();};}function saveUpdates(_0x515fcb,_0x10a2d6){return function(_0x1457b1){if(_0x1457b1){return _0x1457b1['update'](_0x515fcb)['then'](function(_0x1e3a6c){return _0x1e3a6c;});}return null;};}function removeEntity(_0x2d9dc9,_0x44d994){return function(_0x429908){if(_0x429908){return _0x429908[_0x5f95('0x20')]()[_0x5f95('0x21')](function(){var _0x43d8aa=_0x429908[_0x5f95('0x22')]({'plain':!![]});var _0x157498=_0x5f95('0x23');return db['UserProfileResource'][_0x5f95('0x20')]({'where':{'type':_0x157498,'resourceId':_0x43d8aa['id']}})[_0x5f95('0x21')](function(){return _0x429908;});})['then'](function(){_0x2d9dc9[_0x5f95('0x16')](0xcc)[_0x5f95('0x15')]();});}};}function handleEntityNotFound(_0x343d63,_0x1b9a1e){return function(_0x58857b){if(!_0x58857b){_0x343d63['sendStatus'](0x194);}return _0x58857b;};}function handleError(_0x4d7e64,_0x459889){_0x459889=_0x459889||0x1f4;return function(_0x5d73a2){logger[_0x5f95('0x24')](_0x5d73a2[_0x5f95('0x25')]);if(_0x5d73a2['name']){delete _0x5d73a2[_0x5f95('0x26')];}_0x4d7e64['status'](_0x459889)[_0x5f95('0x27')](_0x5d73a2);};}exports['index']=function(_0x1c3fea,_0x2fb5e5){var _0x2fa941={},_0x535b01={},_0xe182fb={'count':0x0,'rows':[]};var _0x245dbb=_[_0x5f95('0x28')](db[_0x5f95('0x29')]['rawAttributes'],function(_0x16901){return{'name':_0x16901[_0x5f95('0x2a')],'type':_0x16901[_0x5f95('0x2b')][_0x5f95('0x2c')]};});_0x535b01['model']=_[_0x5f95('0x28')](_0x245dbb,_0x5f95('0x26'));_0x535b01['query']=_[_0x5f95('0x2d')](_0x1c3fea[_0x5f95('0x2e')]);_0x535b01[_0x5f95('0x2f')]=_[_0x5f95('0x30')](_0x535b01['model'],_0x535b01[_0x5f95('0x2e')]);_0x2fa941['attributes']=_[_0x5f95('0x30')](_0x535b01[_0x5f95('0x31')],qs[_0x5f95('0x32')](_0x1c3fea[_0x5f95('0x2e')][_0x5f95('0x32')]));_0x2fa941[_0x5f95('0x33')]=_0x2fa941[_0x5f95('0x33')][_0x5f95('0x34')]?_0x2fa941[_0x5f95('0x33')]:_0x535b01[_0x5f95('0x31')];if(!_0x1c3fea[_0x5f95('0x2e')][_0x5f95('0x35')](_0x5f95('0x36'))){_0x2fa941[_0x5f95('0x1a')]=qs[_0x5f95('0x1a')](_0x1c3fea[_0x5f95('0x2e')][_0x5f95('0x1a')]);_0x2fa941[_0x5f95('0x19')]=qs[_0x5f95('0x19')](_0x1c3fea['query'][_0x5f95('0x19')]);}_0x2fa941['order']=qs[_0x5f95('0x37')](_0x1c3fea['query'][_0x5f95('0x37')]);_0x2fa941['where']=qs[_0x5f95('0x2f')](_['pick'](_0x1c3fea[_0x5f95('0x2e')],_0x535b01['filters']));if(_0x1c3fea['query']['filter']){_0x2fa941[_0x5f95('0x38')]=_[_0x5f95('0x39')](_0x2fa941[_0x5f95('0x38')],{'$or':_[_0x5f95('0x28')](_0x245dbb,function(_0x3f1da8){if(_0x3f1da8[_0x5f95('0x2b')]!=='VIRTUAL'){var _0x3d9d9d={};_0x3d9d9d[_0x3f1da8[_0x5f95('0x26')]]={'$like':'%'+_0x1c3fea[_0x5f95('0x2e')]['filter']+'%'};return _0x3d9d9d;}})});}_0x2fa941=_[_0x5f95('0x39')]({},_0x2fa941,_0x1c3fea[_0x5f95('0x3a')]);var _0x167dc3={'where':_0x2fa941['where']};return db[_0x5f95('0x29')][_0x5f95('0x18')](_0x167dc3)[_0x5f95('0x21')](function(_0x5b58e7){_0xe182fb[_0x5f95('0x18')]=_0x5b58e7;if(_0x1c3fea[_0x5f95('0x2e')][_0x5f95('0x3b')]){_0x2fa941[_0x5f95('0x3c')]=[{'all':!![]}];}return db[_0x5f95('0x29')]['findAll'](_0x2fa941);})[_0x5f95('0x21')](function(_0xec4b4c){_0xe182fb[_0x5f95('0x3d')]=_0xec4b4c;return _0xe182fb;})['then'](respondWithFilteredResult(_0x2fb5e5,_0x2fa941))[_0x5f95('0x3e')](handleError(_0x2fb5e5,null));};exports[_0x5f95('0x3f')]=function(_0x2a86e6,_0x41ec39){var _0x517b86={'raw':!![],'where':{'id':_0x2a86e6[_0x5f95('0x40')]['id']}},_0x4b6ec1={};_0x4b6ec1[_0x5f95('0x31')]=_[_0x5f95('0x2d')](db[_0x5f95('0x29')][_0x5f95('0x41')]);_0x4b6ec1[_0x5f95('0x2e')]=_[_0x5f95('0x2d')](_0x2a86e6[_0x5f95('0x2e')]);_0x4b6ec1[_0x5f95('0x2f')]=_[_0x5f95('0x30')](_0x4b6ec1[_0x5f95('0x31')],_0x4b6ec1[_0x5f95('0x2e')]);_0x517b86[_0x5f95('0x33')]=_[_0x5f95('0x30')](_0x4b6ec1[_0x5f95('0x31')],qs['fields'](_0x2a86e6[_0x5f95('0x2e')][_0x5f95('0x32')]));_0x517b86['attributes']=_0x517b86['attributes'][_0x5f95('0x34')]?_0x517b86['attributes']:_0x4b6ec1['model'];if(_0x2a86e6[_0x5f95('0x2e')]['includeAll']){_0x517b86[_0x5f95('0x3c')]=[{'all':!![]}];}_0x517b86=_['merge']({},_0x517b86,_0x2a86e6['options']);return db[_0x5f95('0x29')][_0x5f95('0x42')](_0x517b86)[_0x5f95('0x21')](handleEntityNotFound(_0x41ec39,null))[_0x5f95('0x21')](respondWithResult(_0x41ec39,null))[_0x5f95('0x3e')](handleError(_0x41ec39,null));};exports[_0x5f95('0x43')]=function(_0x2471f6,_0x18047e){return db[_0x5f95('0x29')][_0x5f95('0x43')](_0x2471f6[_0x5f95('0x44')],{})[_0x5f95('0x21')](function(_0x2f4cd5){var _0x31a4cd=_0x2471f6[_0x5f95('0x45')][_0x5f95('0x22')]({'plain':!![]});if(!_0x31a4cd)throw new Error(_0x5f95('0x46'));if(_0x31a4cd[_0x5f95('0x47')]===_0x5f95('0x45')){var _0x551307=_0x2f4cd5[_0x5f95('0x22')]({'plain':!![]});var _0x4e00ba='Pauses';return db[_0x5f95('0x48')]['find']({'where':{'name':_0x4e00ba,'userProfileId':_0x31a4cd[_0x5f95('0x49')]},'raw':!![]})[_0x5f95('0x21')](function(_0x11b8f9){if(_0x11b8f9&&_0x11b8f9[_0x5f95('0x4a')]===0x0){return db['UserProfileResource'][_0x5f95('0x43')]({'name':_0x551307['name'],'resourceId':_0x551307['id'],'type':_0x11b8f9[_0x5f95('0x26')],'sectionId':_0x11b8f9['id']},{})[_0x5f95('0x21')](function(){return _0x2f4cd5;});}else{return _0x2f4cd5;}})[_0x5f95('0x3e')](function(_0x3ca157){logger[_0x5f95('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ca157);throw _0x3ca157;});}return _0x2f4cd5;})['then'](respondWithResult(_0x18047e,0xc9))['catch'](handleError(_0x18047e,null));};exports[_0x5f95('0x4b')]=function(_0x6bb44c,_0x4a25b1){if(_0x6bb44c[_0x5f95('0x44')]['id']){delete _0x6bb44c[_0x5f95('0x44')]['id'];}return db['Pause'][_0x5f95('0x42')]({'where':{'id':_0x6bb44c[_0x5f95('0x40')]['id']}})[_0x5f95('0x21')](handleEntityNotFound(_0x4a25b1,null))['then'](saveUpdates(_0x6bb44c[_0x5f95('0x44')],null))['then'](respondWithResult(_0x4a25b1,null))[_0x5f95('0x3e')](handleError(_0x4a25b1,null));};exports[_0x5f95('0x20')]=function(_0x3b3236,_0x557fda){return db[_0x5f95('0x29')][_0x5f95('0x42')]({'where':{'id':_0x3b3236[_0x5f95('0x40')]['id']}})[_0x5f95('0x21')](handleEntityNotFound(_0x557fda,null))['then'](removeEntity(_0x557fda,null))[_0x5f95('0x3e')](handleError(_0x557fda,null));}; \ No newline at end of file +var _0x03fe=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','status','count','offset','limit','set','Content-Range','json','save','then','get','Pauses','UserProfileResource','end','sendStatus','error','stack','name','index','map','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','Pause','includeAll','include','rows','catch','show','params','keys','options','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','destroy','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','util','sox','ejs','lodash','squel','crypto','desk.js','to-csv'];(function(_0x1a0600,_0x41feef){var _0x734670=function(_0x2da4e4){while(--_0x2da4e4){_0x1a0600['push'](_0x1a0600['shift']());}};_0x734670(++_0x41feef);}(_0x03fe,0x17d));var _0xe03f=function(_0x1c2802,_0xc1d15d){_0x1c2802=_0x1c2802-0x0;var _0x29f295=_0x03fe[_0x1c2802];return _0x29f295;};'use strict';var pdf=require(_0xe03f('0x0'));var emlformat=require(_0xe03f('0x1'));var rimraf=require(_0xe03f('0x2'));var zipdir=require(_0xe03f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe03f('0x4'));var BPromise=require(_0xe03f('0x5'));var Mustache=require('mustache');var util=require(_0xe03f('0x6'));var path=require('path');var sox=require(_0xe03f('0x7'));var csv=require('to-csv');var ejs=require(_0xe03f('0x8'));var fs=require('fs');var _=require(_0xe03f('0x9'));var squel=require(_0xe03f('0xa'));var crypto=require(_0xe03f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe03f('0xc'));var toCsv=require(_0xe03f('0xd'));var querystring=require(_0xe03f('0xe'));var Papa=require(_0xe03f('0xf'));var Redis=require('ioredis');var authService=require(_0xe03f('0x10'));var qs=require(_0xe03f('0x11'));var as=require(_0xe03f('0x12'));var hardwareService=require(_0xe03f('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xe03f('0x14'));var db=require(_0xe03f('0x15'))['db'];function respondWithStatusCode(_0x3d0bdf,_0x30b476){_0x30b476=_0x30b476||0xcc;return function(_0x1c444d){if(_0x1c444d){return _0x3d0bdf['sendStatus'](_0x30b476);}return _0x3d0bdf[_0xe03f('0x16')](_0x30b476)['end']();};}function respondWithResult(_0x234f6c,_0x213193){_0x213193=_0x213193||0xc8;return function(_0x5e3eb4){if(_0x5e3eb4){return _0x234f6c['status'](_0x213193)['json'](_0x5e3eb4);}};}function respondWithFilteredResult(_0x36bf06,_0x26e83b){return function(_0x183623){if(_0x183623){var _0x5e91cf=_0x183623[_0xe03f('0x17')],_0x32a0f9=_0x26e83b[_0xe03f('0x18')],_0x857c58=_0x26e83b['offset']+_0x26e83b[_0xe03f('0x19')],_0x4067f0;if(_0x857c58>=_0x5e91cf){_0x857c58=_0x5e91cf;_0x4067f0=0xc8;}else{_0x4067f0=0xce;}_0x36bf06[_0xe03f('0x16')](_0x4067f0);return _0x36bf06[_0xe03f('0x1a')](_0xe03f('0x1b'),_0x32a0f9+'-'+_0x857c58+'/'+_0x5e91cf)[_0xe03f('0x1c')](_0x183623);}return null;};}function patchUpdates(_0xbe7e78){return function(_0x223aeb){try{jsonpatch['apply'](_0x223aeb,_0xbe7e78,!![]);}catch(_0x87ecc1){return BPromise['reject'](_0x87ecc1);}return _0x223aeb[_0xe03f('0x1d')]();};}function saveUpdates(_0x3a4bc1,_0x1f8cde){return function(_0x3df109){if(_0x3df109){return _0x3df109['update'](_0x3a4bc1)[_0xe03f('0x1e')](function(_0x1c191a){return _0x1c191a;});}return null;};}function removeEntity(_0x32b343,_0x156e82){return function(_0x4162b3){if(_0x4162b3){return _0x4162b3['destroy']()[_0xe03f('0x1e')](function(){var _0x5b4c4f=_0x4162b3[_0xe03f('0x1f')]({'plain':!![]});var _0x104617=_0xe03f('0x20');return db[_0xe03f('0x21')]['destroy']({'where':{'type':_0x104617,'resourceId':_0x5b4c4f['id']}})[_0xe03f('0x1e')](function(){return _0x4162b3;});})[_0xe03f('0x1e')](function(){_0x32b343['status'](0xcc)[_0xe03f('0x22')]();});}};}function handleEntityNotFound(_0x116c3d,_0x51cc98){return function(_0x1e154f){if(!_0x1e154f){_0x116c3d[_0xe03f('0x23')](0x194);}return _0x1e154f;};}function handleError(_0xdfa55b,_0x4fc526){_0x4fc526=_0x4fc526||0x1f4;return function(_0x1a9fa1){logger[_0xe03f('0x24')](_0x1a9fa1[_0xe03f('0x25')]);if(_0x1a9fa1['name']){delete _0x1a9fa1[_0xe03f('0x26')];}_0xdfa55b[_0xe03f('0x16')](_0x4fc526)['send'](_0x1a9fa1);};}exports[_0xe03f('0x27')]=function(_0x17c1a8,_0x5ca943){var _0x3a6b7b={},_0x55811f={},_0x65e56b={'count':0x0,'rows':[]};var _0x36b08d=_[_0xe03f('0x28')](db['Pause'][_0xe03f('0x29')],function(_0x2208e4){return{'name':_0x2208e4['fieldName'],'type':_0x2208e4[_0xe03f('0x2a')][_0xe03f('0x2b')]};});_0x55811f[_0xe03f('0x2c')]=_[_0xe03f('0x28')](_0x36b08d,_0xe03f('0x26'));_0x55811f[_0xe03f('0x2d')]=_['keys'](_0x17c1a8['query']);_0x55811f[_0xe03f('0x2e')]=_['intersection'](_0x55811f['model'],_0x55811f[_0xe03f('0x2d')]);_0x3a6b7b[_0xe03f('0x2f')]=_[_0xe03f('0x30')](_0x55811f[_0xe03f('0x2c')],qs[_0xe03f('0x31')](_0x17c1a8['query'][_0xe03f('0x31')]));_0x3a6b7b['attributes']=_0x3a6b7b[_0xe03f('0x2f')][_0xe03f('0x32')]?_0x3a6b7b[_0xe03f('0x2f')]:_0x55811f['model'];if(!_0x17c1a8[_0xe03f('0x2d')][_0xe03f('0x33')](_0xe03f('0x34'))){_0x3a6b7b[_0xe03f('0x19')]=qs[_0xe03f('0x19')](_0x17c1a8[_0xe03f('0x2d')][_0xe03f('0x19')]);_0x3a6b7b['offset']=qs['offset'](_0x17c1a8[_0xe03f('0x2d')]['offset']);}_0x3a6b7b[_0xe03f('0x35')]=qs[_0xe03f('0x36')](_0x17c1a8[_0xe03f('0x2d')][_0xe03f('0x36')]);_0x3a6b7b[_0xe03f('0x37')]=qs['filters'](_[_0xe03f('0x38')](_0x17c1a8[_0xe03f('0x2d')],_0x55811f['filters']));if(_0x17c1a8['query'][_0xe03f('0x39')]){_0x3a6b7b[_0xe03f('0x37')]=_[_0xe03f('0x3a')](_0x3a6b7b['where'],{'$or':_['map'](_0x36b08d,function(_0x2ae672){if(_0x2ae672[_0xe03f('0x2a')]!==_0xe03f('0x3b')){var _0x45aa6b={};_0x45aa6b[_0x2ae672[_0xe03f('0x26')]]={'$like':'%'+_0x17c1a8[_0xe03f('0x2d')][_0xe03f('0x39')]+'%'};return _0x45aa6b;}})});}_0x3a6b7b=_['merge']({},_0x3a6b7b,_0x17c1a8['options']);var _0x3c1346={'where':_0x3a6b7b[_0xe03f('0x37')]};return db[_0xe03f('0x3c')][_0xe03f('0x17')](_0x3c1346)[_0xe03f('0x1e')](function(_0x34e3bd){_0x65e56b[_0xe03f('0x17')]=_0x34e3bd;if(_0x17c1a8[_0xe03f('0x2d')][_0xe03f('0x3d')]){_0x3a6b7b[_0xe03f('0x3e')]=[{'all':!![]}];}return db[_0xe03f('0x3c')]['findAll'](_0x3a6b7b);})[_0xe03f('0x1e')](function(_0x3fe2c5){_0x65e56b[_0xe03f('0x3f')]=_0x3fe2c5;return _0x65e56b;})['then'](respondWithFilteredResult(_0x5ca943,_0x3a6b7b))[_0xe03f('0x40')](handleError(_0x5ca943,null));};exports[_0xe03f('0x41')]=function(_0x407784,_0x4a3bf0){var _0xb95c76={'raw':!![],'where':{'id':_0x407784[_0xe03f('0x42')]['id']}},_0x40bb48={};_0x40bb48[_0xe03f('0x2c')]=_[_0xe03f('0x43')](db[_0xe03f('0x3c')][_0xe03f('0x29')]);_0x40bb48[_0xe03f('0x2d')]=_[_0xe03f('0x43')](_0x407784[_0xe03f('0x2d')]);_0x40bb48[_0xe03f('0x2e')]=_['intersection'](_0x40bb48[_0xe03f('0x2c')],_0x40bb48[_0xe03f('0x2d')]);_0xb95c76[_0xe03f('0x2f')]=_[_0xe03f('0x30')](_0x40bb48[_0xe03f('0x2c')],qs[_0xe03f('0x31')](_0x407784[_0xe03f('0x2d')]['fields']));_0xb95c76[_0xe03f('0x2f')]=_0xb95c76[_0xe03f('0x2f')][_0xe03f('0x32')]?_0xb95c76['attributes']:_0x40bb48[_0xe03f('0x2c')];if(_0x407784[_0xe03f('0x2d')][_0xe03f('0x3d')]){_0xb95c76['include']=[{'all':!![]}];}_0xb95c76=_[_0xe03f('0x3a')]({},_0xb95c76,_0x407784[_0xe03f('0x44')]);return db['Pause']['find'](_0xb95c76)[_0xe03f('0x1e')](handleEntityNotFound(_0x4a3bf0,null))['then'](respondWithResult(_0x4a3bf0,null))[_0xe03f('0x40')](handleError(_0x4a3bf0,null));};exports['create']=function(_0x4f5ce3,_0x15b7e1){return db[_0xe03f('0x3c')][_0xe03f('0x45')](_0x4f5ce3[_0xe03f('0x46')],{})[_0xe03f('0x1e')](function(_0x45fc3b){var _0x25f954=_0x4f5ce3[_0xe03f('0x47')][_0xe03f('0x1f')]({'plain':!![]});if(!_0x25f954)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x25f954['role']===_0xe03f('0x47')){var _0xb3389a=_0x45fc3b[_0xe03f('0x1f')]({'plain':!![]});var _0x3b1677=_0xe03f('0x20');return db[_0xe03f('0x48')]['find']({'where':{'name':_0x3b1677,'userProfileId':_0x25f954[_0xe03f('0x49')]},'raw':!![]})[_0xe03f('0x1e')](function(_0x55fe37){if(_0x55fe37&&_0x55fe37[_0xe03f('0x4a')]===0x0){return db[_0xe03f('0x21')]['create']({'name':_0xb3389a['name'],'resourceId':_0xb3389a['id'],'type':_0x55fe37[_0xe03f('0x26')],'sectionId':_0x55fe37['id']},{})[_0xe03f('0x1e')](function(){return _0x45fc3b;});}else{return _0x45fc3b;}})[_0xe03f('0x40')](function(_0x159172){logger[_0xe03f('0x24')](_0xe03f('0x4b'),_0x159172);throw _0x159172;});}return _0x45fc3b;})['then'](respondWithResult(_0x15b7e1,0xc9))[_0xe03f('0x40')](handleError(_0x15b7e1,null));};exports[_0xe03f('0x4c')]=function(_0x248928,_0x2da2d2){if(_0x248928[_0xe03f('0x46')]['id']){delete _0x248928['body']['id'];}return db[_0xe03f('0x3c')][_0xe03f('0x4d')]({'where':{'id':_0x248928[_0xe03f('0x42')]['id']}})[_0xe03f('0x1e')](handleEntityNotFound(_0x2da2d2,null))[_0xe03f('0x1e')](saveUpdates(_0x248928['body'],null))['then'](respondWithResult(_0x2da2d2,null))[_0xe03f('0x40')](handleError(_0x2da2d2,null));};exports[_0xe03f('0x4e')]=function(_0x46f994,_0x5b51d8){return db[_0xe03f('0x3c')][_0xe03f('0x4d')]({'where':{'id':_0x46f994['params']['id']}})[_0xe03f('0x1e')](handleEntityNotFound(_0x5b51d8,null))[_0xe03f('0x1e')](removeEntity(_0x5b51d8,null))['catch'](handleError(_0x5b51d8,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 56ad02f..9ae50a1 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 _0xd4dc=['Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./pause.attributes'];(function(_0x1ebdc9,_0x2b1455){var _0x175c0c=function(_0x480ed1){while(--_0x480ed1){_0x1ebdc9['push'](_0x1ebdc9['shift']());}};_0x175c0c(++_0x2b1455);}(_0xd4dc,0xff));var _0xcd4d=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xd4dc[_0x5f3f88];return _0xd08119;};'use strict';var _=require(_0xcd4d('0x0'));var util=require('util');var logger=require(_0xcd4d('0x1'))(_0xcd4d('0x2'));var moment=require(_0xcd4d('0x3'));var BPromise=require(_0xcd4d('0x4'));var rp=require(_0xcd4d('0x5'));var fs=require('fs');var path=require(_0xcd4d('0x6'));var rimraf=require(_0xcd4d('0x7'));var config=require('../../config/environment');var attributes=require(_0xcd4d('0x8'));module['exports']=function(_0x5d70fb,_0x3c5bbd){return _0x5d70fb['define'](_0xcd4d('0x9'),attributes,{'tableName':_0xcd4d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed3c=['util','../../config/logger','api','bluebird','request-promise','path','./pause.attributes','exports','lodash'];(function(_0x5b88f7,_0x5e0acd){var _0x43a5c0=function(_0x5ec0f3){while(--_0x5ec0f3){_0x5b88f7['push'](_0x5b88f7['shift']());}};_0x43a5c0(++_0x5e0acd);}(_0xed3c,0x1a6));var _0xced3=function(_0x131c81,_0x12fe63){_0x131c81=_0x131c81-0x0;var _0x241e7a=_0xed3c[_0x131c81];return _0x241e7a;};'use strict';var _=require(_0xced3('0x0'));var util=require(_0xced3('0x1'));var logger=require(_0xced3('0x2'))(_0xced3('0x3'));var moment=require('moment');var BPromise=require(_0xced3('0x4'));var rp=require(_0xced3('0x5'));var fs=require('fs');var path=require(_0xced3('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xced3('0x7'));module[_0xced3('0x8')]=function(_0x2f92f8,_0x1cd694){return _0x2f92f8['define']('Pause',attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 32a2f70..44836f9 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 _0x04cc=['find','options','attributes','include','map','model','stringify','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','request\x20sent','debug','error','code','Pause,\x20%s,\x20%s','message','ShowPause','Pause'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x04cc,0x10d));var _0xc04c=function(_0x169790,_0x48aa33){_0x169790=_0x169790-0x0;var _0x4d0f36=_0x04cc[_0x169790];return _0x4d0f36;};'use strict';var _=require(_0xc04c('0x0'));var util=require(_0xc04c('0x1'));var moment=require(_0xc04c('0x2'));var BPromise=require('bluebird');var rs=require(_0xc04c('0x3'));var fs=require('fs');var Redis=require(_0xc04c('0x4'));var db=require(_0xc04c('0x5'))['db'];var utils=require(_0xc04c('0x6'));var logger=require(_0xc04c('0x7'))('rpc');var config=require(_0xc04c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc04c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x321533,_0x4bbe70,_0x4a1cd3){return new BPromise(function(_0x1534d4,_0x3699ca){return client[_0xc04c('0xa')](_0x321533,_0x4a1cd3)[_0xc04c('0xb')](function(_0x440084){logger[_0xc04c('0xc')]('Pause,\x20%s,\x20%s',_0x4bbe70,_0xc04c('0xd'));logger[_0xc04c('0xe')]('Pause,\x20%s,\x20%s,\x20%s',_0x4bbe70,_0xc04c('0xd'),JSON['stringify'](_0x440084));if(_0x440084[_0xc04c('0xf')]){if(_0x440084[_0xc04c('0xf')][_0xc04c('0x10')]===0x1f4){logger[_0xc04c('0xf')](_0xc04c('0x11'),_0x4bbe70,_0x440084[_0xc04c('0xf')][_0xc04c('0x12')]);return _0x3699ca(_0x440084[_0xc04c('0xf')]['message']);}logger[_0xc04c('0xf')](_0xc04c('0x11'),_0x4bbe70,_0x440084[_0xc04c('0xf')][_0xc04c('0x12')]);return _0x1534d4(_0x440084['error'][_0xc04c('0x12')]);}else{logger[_0xc04c('0xc')](_0xc04c('0x11'),_0x4bbe70,_0xc04c('0xd'));_0x1534d4(_0x440084['result'][_0xc04c('0x12')]);}})['catch'](function(_0x416031){logger[_0xc04c('0xf')](_0xc04c('0x11'),_0x4bbe70,_0x416031);_0x3699ca(_0x416031);});});}exports[_0xc04c('0x13')]=function(_0x34757a){var _0x59d334=this;return new Promise(function(_0x14d60e,_0x44d514){return db[_0xc04c('0x14')][_0xc04c('0x15')]({'raw':_0x34757a[_0xc04c('0x16')]?_0x34757a[_0xc04c('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x34757a[_0xc04c('0x16')]?_0x34757a[_0xc04c('0x16')]['where']||null:null,'attributes':_0x34757a[_0xc04c('0x16')]?_0x34757a['options'][_0xc04c('0x17')]||null:null,'include':_0x34757a[_0xc04c('0x16')]?_0x34757a[_0xc04c('0x16')][_0xc04c('0x18')]?_[_0xc04c('0x19')](_0x34757a[_0xc04c('0x16')][_0xc04c('0x18')],function(_0x341d49){return{'model':db[_0x341d49[_0xc04c('0x1a')]],'as':_0x341d49['as'],'attributes':_0x341d49[_0xc04c('0x17')],'include':_0x341d49['include']?_['map'](_0x341d49['include'],function(_0x25c10d){return{'model':db[_0x25c10d[_0xc04c('0x1a')]],'as':_0x25c10d['as'],'attributes':_0x25c10d[_0xc04c('0x17')],'include':_0x25c10d[_0xc04c('0x18')]?_[_0xc04c('0x19')](_0x25c10d[_0xc04c('0x18')],function(_0xb5d96e){return{'model':db[_0xb5d96e['model']],'as':_0xb5d96e['as'],'attributes':_0xb5d96e[_0xc04c('0x17')]};}):[]};}):[]};}):[]:[]})[_0xc04c('0xb')](function(_0x5e67b0){logger[_0xc04c('0xc')](_0xc04c('0x13'),_0x34757a);logger['debug'](_0xc04c('0x13'),_0x34757a,JSON[_0xc04c('0x1b')](_0x5e67b0));_0x14d60e(_0x5e67b0);})[_0xc04c('0x1c')](function(_0x31f038){logger[_0xc04c('0xf')](_0xc04c('0x13'),_0x31f038[_0xc04c('0x12')],_0x34757a);_0x44d514(_0x59d334[_0xc04c('0xf')](0x1f4,_0x31f038[_0xc04c('0x12')]));});});}; \ No newline at end of file +var _0x68ef=['message','result','catch','ShowPause','Pause','find','options','raw','where','attributes','include','map','model','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','request\x20sent','Pause,\x20%s,\x20%s,\x20%s','stringify','error','Pause,\x20%s,\x20%s'];(function(_0x23f0e1,_0x11d94b){var _0x257f0d=function(_0xab63c7){while(--_0xab63c7){_0x23f0e1['push'](_0x23f0e1['shift']());}};_0x257f0d(++_0x11d94b);}(_0x68ef,0x9e));var _0xf68e=function(_0x31dd25,_0x237baa){_0x31dd25=_0x31dd25-0x0;var _0x2d76a4=_0x68ef[_0x31dd25];return _0x2d76a4;};'use strict';var _=require(_0xf68e('0x0'));var util=require(_0xf68e('0x1'));var moment=require('moment');var BPromise=require(_0xf68e('0x2'));var rs=require(_0xf68e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf68e('0x4'));var logger=require(_0xf68e('0x5'))(_0xf68e('0x6'));var config=require(_0xf68e('0x7'));var jayson=require(_0xf68e('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x34cba6,_0x3643c9,_0x49b91d){return new BPromise(function(_0x518e73,_0x2beee9){return client['request'](_0x34cba6,_0x49b91d)[_0xf68e('0x9')](function(_0x2d11f7){logger[_0xf68e('0xa')]('Pause,\x20%s,\x20%s',_0x3643c9,_0xf68e('0xb'));logger['debug'](_0xf68e('0xc'),_0x3643c9,_0xf68e('0xb'),JSON[_0xf68e('0xd')](_0x2d11f7));if(_0x2d11f7[_0xf68e('0xe')]){if(_0x2d11f7[_0xf68e('0xe')]['code']===0x1f4){logger['error'](_0xf68e('0xf'),_0x3643c9,_0x2d11f7['error'][_0xf68e('0x10')]);return _0x2beee9(_0x2d11f7[_0xf68e('0xe')][_0xf68e('0x10')]);}logger['error']('Pause,\x20%s,\x20%s',_0x3643c9,_0x2d11f7['error']['message']);return _0x518e73(_0x2d11f7[_0xf68e('0xe')][_0xf68e('0x10')]);}else{logger[_0xf68e('0xa')]('Pause,\x20%s,\x20%s',_0x3643c9,'request\x20sent');_0x518e73(_0x2d11f7[_0xf68e('0x11')]['message']);}})[_0xf68e('0x12')](function(_0x38540b){logger[_0xf68e('0xe')](_0xf68e('0xf'),_0x3643c9,_0x38540b);_0x2beee9(_0x38540b);});});}exports[_0xf68e('0x13')]=function(_0x3c8f8a){var _0x161412=this;return new Promise(function(_0x123a43,_0x337958){return db[_0xf68e('0x14')][_0xf68e('0x15')]({'raw':_0x3c8f8a[_0xf68e('0x16')]?_0x3c8f8a[_0xf68e('0x16')][_0xf68e('0x17')]===undefined?!![]:![]:!![],'where':_0x3c8f8a[_0xf68e('0x16')]?_0x3c8f8a[_0xf68e('0x16')][_0xf68e('0x18')]||null:null,'attributes':_0x3c8f8a['options']?_0x3c8f8a[_0xf68e('0x16')][_0xf68e('0x19')]||null:null,'include':_0x3c8f8a['options']?_0x3c8f8a[_0xf68e('0x16')][_0xf68e('0x1a')]?_[_0xf68e('0x1b')](_0x3c8f8a[_0xf68e('0x16')]['include'],function(_0x56ce38){return{'model':db[_0x56ce38['model']],'as':_0x56ce38['as'],'attributes':_0x56ce38[_0xf68e('0x19')],'include':_0x56ce38['include']?_[_0xf68e('0x1b')](_0x56ce38[_0xf68e('0x1a')],function(_0x34408e){return{'model':db[_0x34408e[_0xf68e('0x1c')]],'as':_0x34408e['as'],'attributes':_0x34408e['attributes'],'include':_0x34408e[_0xf68e('0x1a')]?_[_0xf68e('0x1b')](_0x34408e['include'],function(_0x4d2c91){return{'model':db[_0x4d2c91['model']],'as':_0x4d2c91['as'],'attributes':_0x4d2c91[_0xf68e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5778fa){logger[_0xf68e('0xa')](_0xf68e('0x13'),_0x3c8f8a);logger['debug'](_0xf68e('0x13'),_0x3c8f8a,JSON[_0xf68e('0xd')](_0x5778fa));_0x123a43(_0x5778fa);})[_0xf68e('0x12')](function(_0xb8aa){logger[_0xf68e('0xe')]('ShowPause',_0xb8aa[_0xf68e('0x10')],_0x3c8f8a);_0x337958(_0x161412[_0xf68e('0xe')](0x1f4,_0xb8aa[_0xf68e('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 55ace8e..a9c24d3 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 _0xa95f=['get','/webhook','webhookGet','/:id','show','/:id/download','download','diskStorage','join','root','originalname','replace','%s-%s%s','basename','extname','now','upload','post','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./plugin.controller','isAuthenticated','index'];(function(_0x58014d,_0x148f70){var _0x500dbc=function(_0x4225b4){while(--_0x4225b4){_0x58014d['push'](_0x58014d['shift']());}};_0x500dbc(++_0x148f70);}(_0xa95f,0xd6));var _0xfa95=function(_0x4f1e9d,_0x2bd07a){_0x4f1e9d=_0x4f1e9d-0x0;var _0x17eef7=_0xa95f[_0x4f1e9d];return _0x17eef7;};'use strict';var multer=require('multer');var util=require(_0xfa95('0x0'));var path=require(_0xfa95('0x1'));var timeout=require(_0xfa95('0x2'));var express=require(_0xfa95('0x3'));var router=express[_0xfa95('0x4')]();var auth=require(_0xfa95('0x5'));var interaction=require(_0xfa95('0x6'));var config=require('../../config/environment');var controller=require(_0xfa95('0x7'));router['get']('/',auth[_0xfa95('0x8')](),controller[_0xfa95('0x9')]);router[_0xfa95('0xa')](_0xfa95('0xb'),controller[_0xfa95('0xc')]);router[_0xfa95('0xa')](_0xfa95('0xd'),auth[_0xfa95('0x8')](),controller[_0xfa95('0xe')]);router['get'](_0xfa95('0xf'),auth[_0xfa95('0x8')](),controller[_0xfa95('0x10')]);var upload=multer({'storage':multer[_0xfa95('0x11')]({'destination':function(_0xefbc72,_0x2ac7f9,_0x1c8dc5){_0x1c8dc5(null,path[_0xfa95('0x12')](config[_0xfa95('0x13')],'server/files/plugins'));},'filename':function(_0x5752ae,_0x2ce600,_0x21696d){_0x2ce600['originalname']=_0x2ce600[_0xfa95('0x14')][_0xfa95('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x21696d(null,util['format'](_0xfa95('0x16'),path[_0xfa95('0x17')](_0x2ce600[_0xfa95('0x14')],path[_0xfa95('0x18')](_0x2ce600[_0xfa95('0x14')])),Date[_0xfa95('0x19')](),path[_0xfa95('0x18')](_0x2ce600[_0xfa95('0x14')])));}})});router['post']('/',upload['single']('file'),controller[_0xfa95('0x1a')]);router[_0xfa95('0x1b')](_0xfa95('0xb'),controller['webhookPost']);router[_0xfa95('0x1c')]('/:id',auth[_0xfa95('0x8')](),controller[_0xfa95('0x1d')]);router['delete'](_0xfa95('0xd'),auth[_0xfa95('0x8')](),controller[_0xfa95('0x1e')]);module[_0xfa95('0x1f')]=router; \ No newline at end of file +var _0xf056=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./plugin.controller','get','index','/:id','isAuthenticated','/:id/download','download','diskStorage','server/files/plugins','originalname','replace','format','%s-%s%s','extname','now','single','file','upload','post','/webhook','put','update','delete','exports'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xf056,0x1e0));var _0x6f05=function(_0x2a81b6,_0x248e4e){_0x2a81b6=_0x2a81b6-0x0;var _0x2e8ed6=_0xf056[_0x2a81b6];return _0x2e8ed6;};'use strict';var multer=require('multer');var util=require(_0x6f05('0x0'));var path=require(_0x6f05('0x1'));var timeout=require(_0x6f05('0x2'));var express=require('express');var router=express[_0x6f05('0x3')]();var auth=require(_0x6f05('0x4'));var interaction=require(_0x6f05('0x5'));var config=require('../../config/environment');var controller=require(_0x6f05('0x6'));router[_0x6f05('0x7')]('/',auth['isAuthenticated'](),controller[_0x6f05('0x8')]);router[_0x6f05('0x7')]('/webhook',controller['webhookGet']);router[_0x6f05('0x7')](_0x6f05('0x9'),auth[_0x6f05('0xa')](),controller['show']);router[_0x6f05('0x7')](_0x6f05('0xb'),auth['isAuthenticated'](),controller[_0x6f05('0xc')]);var upload=multer({'storage':multer[_0x6f05('0xd')]({'destination':function(_0x44cb9c,_0x42f518,_0x2356f0){_0x2356f0(null,path['join'](config['root'],_0x6f05('0xe')));},'filename':function(_0x3b7f5c,_0x335615,_0x26a218){_0x335615[_0x6f05('0xf')]=_0x335615[_0x6f05('0xf')][_0x6f05('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x26a218(null,util[_0x6f05('0x11')](_0x6f05('0x12'),path['basename'](_0x335615[_0x6f05('0xf')],path[_0x6f05('0x13')](_0x335615[_0x6f05('0xf')])),Date[_0x6f05('0x14')](),path['extname'](_0x335615[_0x6f05('0xf')])));}})});router['post']('/',upload[_0x6f05('0x15')](_0x6f05('0x16')),controller[_0x6f05('0x17')]);router[_0x6f05('0x18')](_0x6f05('0x19'),controller['webhookPost']);router[_0x6f05('0x1a')](_0x6f05('0x9'),auth[_0x6f05('0xa')](),controller[_0x6f05('0x1b')]);router[_0x6f05('0x1c')](_0x6f05('0x9'),auth[_0x6f05('0xa')](),controller[_0x6f05('0x1c')]);module[_0x6f05('0x1d')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 479afe4..bfdce7d 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 _0xcec9=['sequelize','STRING','ENUM','html','script','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'];(function(_0x12e3e3,_0x501eaf){var _0x26602e=function(_0x427882){while(--_0x427882){_0x12e3e3['push'](_0x12e3e3['shift']());}};_0x26602e(++_0x501eaf);}(_0xcec9,0x78));var _0x9cec=function(_0x57fd39,_0x4c2473){_0x57fd39=_0x57fd39-0x0;var _0x4aa88c=_0xcec9[_0x57fd39];return _0x4aa88c;};'use strict';var Sequelize=require(_0x9cec('0x0'));module['exports']={'name':{'type':Sequelize[_0x9cec('0x1')]},'type':{'type':Sequelize[_0x9cec('0x2')](_0x9cec('0x3'),_0x9cec('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize['STRING'],'comment':_0x9cec('0x5')},'active':{'type':Sequelize[_0x9cec('0x6')],'defaultValue':0x0,'comment':_0x9cec('0x7')},'sidebar':{'type':Sequelize['ENUM'](_0x9cec('0x8'),'agentOnly',_0x9cec('0x9'),_0x9cec('0xa')),'defaultValue':'always','comment':_0x9cec('0xb')},'icon':{'type':Sequelize[_0x9cec('0x1')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x9cec('0x1')]},'scriptName':{'type':Sequelize[_0x9cec('0x1')]},'scriptPath':{'type':Sequelize[_0x9cec('0x1')]}}; \ No newline at end of file +var _0xf527=['exports','STRING','html','script','TEXT','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','ENUM','adminOnly','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0xf527,0x110));var _0x7f52=function(_0x5856ba,_0x3ceebb){_0x5856ba=_0x5856ba-0x0;var _0x170028=_0xf527[_0x5856ba];return _0x170028;};'use strict';var Sequelize=require(_0x7f52('0x0'));module[_0x7f52('0x1')]={'name':{'type':Sequelize[_0x7f52('0x2')]},'type':{'type':Sequelize['ENUM'](_0x7f52('0x3'),_0x7f52('0x4'))},'description':{'type':Sequelize[_0x7f52('0x5')]},'version':{'type':Sequelize[_0x7f52('0x5')]},'path':{'type':Sequelize[_0x7f52('0x2')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x7f52('0x6')],'defaultValue':0x0,'comment':_0x7f52('0x7')},'sidebar':{'type':Sequelize[_0x7f52('0x8')](_0x7f52('0x9'),_0x7f52('0xa'),_0x7f52('0xb'),'never'),'defaultValue':_0x7f52('0xb'),'comment':_0x7f52('0xc')},'icon':{'type':Sequelize[_0x7f52('0x2')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x7f52('0x2')]},'scriptName':{'type':Sequelize[_0x7f52('0x2')]},'scriptPath':{'type':Sequelize[_0x7f52('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 3d60976..fb29dcd 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 _0x53d8=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./plugin.socket','register','sendStatus','status','count','offset','limit','json','apply','save','update','then','get','Plugins','UserProfileResource','end','error','stack','name','index','map','Plugin','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','include','find','download','params','root','server/files/plugins','%s.zip','basename','zip','warning','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','Error','pipe','glob','dirname','join','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','format','Error\x20while\x20downloading\x20the\x20plugin','Download\x20completed','info','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','0777','Invalid\x20plugin\x20structure','isFile','isDirectory','readdirSync','some','Plugin\x20manifest\x20missing','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','undefined','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','script','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','send','Zip\x20archive\x20removed','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','resolve','html-pdf','eml-format','rimraf','zip-dir','request-promise'];(function(_0x46d87a,_0x5183db){var _0x115296=function(_0x880a1c){while(--_0x880a1c){_0x46d87a['push'](_0x46d87a['shift']());}};_0x115296(++_0x5183db);}(_0x53d8,0x147));var _0x853d=function(_0x39f643,_0x4f4be2){_0x39f643=_0x39f643-0x0;var _0x1b2fcf=_0x53d8[_0x39f643];return _0x1b2fcf;};'use strict';var pdf=require(_0x853d('0x0'));var emlformat=require(_0x853d('0x1'));var rimraf=require(_0x853d('0x2'));var zipdir=require(_0x853d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x853d('0x4'));var moment=require(_0x853d('0x5'));var BPromise=require(_0x853d('0x6'));var Mustache=require(_0x853d('0x7'));var util=require(_0x853d('0x8'));var path=require(_0x853d('0x9'));var sox=require(_0x853d('0xa'));var csv=require(_0x853d('0xb'));var ejs=require(_0x853d('0xc'));var fs=require('fs');var _=require(_0x853d('0xd'));var squel=require(_0x853d('0xe'));var crypto=require(_0x853d('0xf'));var jsforce=require(_0x853d('0x10'));var deskjs=require(_0x853d('0x11'));var toCsv=require(_0x853d('0xb'));var querystring=require('querystring');var Papa=require(_0x853d('0x12'));var extract=require('extract-zip');var rimraf=require(_0x853d('0x2'));var archiver=require(_0x853d('0x13'));var Redis=require(_0x853d('0x14'));var authService=require(_0x853d('0x15'));var qs=require(_0x853d('0x16'));var as=require(_0x853d('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x853d('0x18'))(_0x853d('0x19'));var utils=require('../../config/utils');var config=require(_0x853d('0x1a'));var db=require(_0x853d('0x1b'))['db'];config[_0x853d('0x1c')]=_['defaults'](config[_0x853d('0x1c')],{'host':_0x853d('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x853d('0x1c')]));require(_0x853d('0x1e'))[_0x853d('0x1f')](socket);function respondWithStatusCode(_0x5b109d,_0x307c4c){_0x307c4c=_0x307c4c||0xcc;return function(_0x56c10b){if(_0x56c10b){return _0x5b109d[_0x853d('0x20')](_0x307c4c);}return _0x5b109d[_0x853d('0x21')](_0x307c4c)['end']();};}function respondWithResult(_0xbca897,_0x2f07d7){_0x2f07d7=_0x2f07d7||0xc8;return function(_0xe58be){if(_0xe58be){return _0xbca897[_0x853d('0x21')](_0x2f07d7)['json'](_0xe58be);}};}function respondWithFilteredResult(_0x26130a,_0x46aead){return function(_0xfb45d3){if(_0xfb45d3){var _0x403f5e=_0xfb45d3[_0x853d('0x22')],_0x7c1b7a=_0x46aead['offset'],_0x1261a2=_0x46aead[_0x853d('0x23')]+_0x46aead[_0x853d('0x24')],_0x24ea94;if(_0x1261a2>=_0x403f5e){_0x1261a2=_0x403f5e;_0x24ea94=0xc8;}else{_0x24ea94=0xce;}_0x26130a[_0x853d('0x21')](_0x24ea94);return _0x26130a['set']('Content-Range',_0x7c1b7a+'-'+_0x1261a2+'/'+_0x403f5e)[_0x853d('0x25')](_0xfb45d3);}return null;};}function patchUpdates(_0x2fd11b){return function(_0x14fec0){try{jsonpatch[_0x853d('0x26')](_0x14fec0,_0x2fd11b,!![]);}catch(_0x156bdf){return BPromise['reject'](_0x156bdf);}return _0x14fec0[_0x853d('0x27')]();};}function saveUpdates(_0x4b0862,_0x457f40){return function(_0x48e218){if(_0x48e218){return _0x48e218[_0x853d('0x28')](_0x4b0862)[_0x853d('0x29')](function(_0x1bd913){return _0x1bd913;});}return null;};}function removeEntity(_0xcd36b6,_0x3afc23){return function(_0x37c46c){if(_0x37c46c){return _0x37c46c['destroy']()[_0x853d('0x29')](function(){var _0x3bb534=_0x37c46c[_0x853d('0x2a')]({'plain':!![]});var _0x3b9d10=_0x853d('0x2b');return db[_0x853d('0x2c')]['destroy']({'where':{'type':_0x3b9d10,'resourceId':_0x3bb534['id']}})[_0x853d('0x29')](function(){return _0x37c46c;});})[_0x853d('0x29')](function(){_0xcd36b6['status'](0xcc)[_0x853d('0x2d')]();});}};}function handleEntityNotFound(_0x2f8493,_0x58698f){return function(_0x39673d){if(!_0x39673d){_0x2f8493[_0x853d('0x20')](0x194);}return _0x39673d;};}function handleError(_0x26fb47,_0x3f2552){_0x3f2552=_0x3f2552||0x1f4;return function(_0x541cab){logger[_0x853d('0x2e')](_0x541cab[_0x853d('0x2f')]);if(_0x541cab[_0x853d('0x30')]){delete _0x541cab[_0x853d('0x30')];}_0x26fb47[_0x853d('0x21')](_0x3f2552)['send'](_0x541cab);};}exports[_0x853d('0x31')]=function(_0xa0b52f,_0xe4fd07){var _0x59b854={},_0x5982ed={},_0x2afa1c={'count':0x0,'rows':[]};var _0x8a8cfc=_[_0x853d('0x32')](db[_0x853d('0x33')][_0x853d('0x34')],function(_0x1e7a87){return{'name':_0x1e7a87[_0x853d('0x35')],'type':_0x1e7a87[_0x853d('0x36')][_0x853d('0x37')]};});_0x5982ed[_0x853d('0x38')]=_[_0x853d('0x32')](_0x8a8cfc,_0x853d('0x30'));_0x5982ed[_0x853d('0x39')]=_[_0x853d('0x3a')](_0xa0b52f[_0x853d('0x39')]);_0x5982ed[_0x853d('0x3b')]=_['intersection'](_0x5982ed[_0x853d('0x38')],_0x5982ed['query']);_0x59b854[_0x853d('0x3c')]=_[_0x853d('0x3d')](_0x5982ed[_0x853d('0x38')],qs[_0x853d('0x3e')](_0xa0b52f['query'][_0x853d('0x3e')]));_0x59b854[_0x853d('0x3c')]=_0x59b854[_0x853d('0x3c')][_0x853d('0x3f')]?_0x59b854['attributes']:_0x5982ed[_0x853d('0x38')];if(!_0xa0b52f[_0x853d('0x39')]['hasOwnProperty'](_0x853d('0x40'))){_0x59b854[_0x853d('0x24')]=qs[_0x853d('0x24')](_0xa0b52f[_0x853d('0x39')][_0x853d('0x24')]);_0x59b854[_0x853d('0x23')]=qs[_0x853d('0x23')](_0xa0b52f[_0x853d('0x39')][_0x853d('0x23')]);}_0x59b854[_0x853d('0x41')]=qs[_0x853d('0x42')](_0xa0b52f[_0x853d('0x39')][_0x853d('0x42')]);_0x59b854[_0x853d('0x43')]=qs[_0x853d('0x3b')](_[_0x853d('0x44')](_0xa0b52f[_0x853d('0x39')],_0x5982ed['filters']));if(_0xa0b52f[_0x853d('0x39')][_0x853d('0x45')]){_0x59b854[_0x853d('0x43')]=_[_0x853d('0x46')](_0x59b854['where'],{'$or':_[_0x853d('0x32')](_0x8a8cfc,function(_0xf78717){if(_0xf78717['type']!==_0x853d('0x47')){var _0x1592e3={};_0x1592e3[_0xf78717[_0x853d('0x30')]]={'$like':'%'+_0xa0b52f[_0x853d('0x39')][_0x853d('0x45')]+'%'};return _0x1592e3;}})});}_0x59b854=_['merge']({},_0x59b854,_0xa0b52f[_0x853d('0x48')]);var _0x269ebb={'where':_0x59b854['where']};return db[_0x853d('0x33')][_0x853d('0x22')](_0x269ebb)[_0x853d('0x29')](function(_0x3d57e0){_0x2afa1c[_0x853d('0x22')]=_0x3d57e0;if(_0xa0b52f[_0x853d('0x39')][_0x853d('0x49')]){_0x59b854['include']=[{'all':!![]}];}return db[_0x853d('0x33')][_0x853d('0x4a')](_0x59b854);})[_0x853d('0x29')](function(_0x155a4e){_0x2afa1c['rows']=_0x155a4e;return _0x2afa1c;})['then'](respondWithFilteredResult(_0xe4fd07,_0x59b854))[_0x853d('0x4b')](handleError(_0xe4fd07,null));};exports[_0x853d('0x4c')]=function(_0x4d8430,_0x570a75){var _0x401c81={'raw':!![],'where':{'id':_0x4d8430['params']['id']}},_0x2dbe3b={};_0x2dbe3b[_0x853d('0x38')]=_[_0x853d('0x3a')](db[_0x853d('0x33')]['rawAttributes']);_0x2dbe3b['query']=_[_0x853d('0x3a')](_0x4d8430[_0x853d('0x39')]);_0x2dbe3b[_0x853d('0x3b')]=_[_0x853d('0x3d')](_0x2dbe3b[_0x853d('0x38')],_0x2dbe3b['query']);_0x401c81['attributes']=_[_0x853d('0x3d')](_0x2dbe3b['model'],qs['fields'](_0x4d8430[_0x853d('0x39')]['fields']));_0x401c81[_0x853d('0x3c')]=_0x401c81[_0x853d('0x3c')][_0x853d('0x3f')]?_0x401c81[_0x853d('0x3c')]:_0x2dbe3b[_0x853d('0x38')];if(_0x4d8430['query'][_0x853d('0x49')]){_0x401c81[_0x853d('0x4d')]=[{'all':!![]}];}_0x401c81=_['merge']({},_0x401c81,_0x4d8430[_0x853d('0x48')]);return db['Plugin'][_0x853d('0x4e')](_0x401c81)[_0x853d('0x29')](handleEntityNotFound(_0x570a75,null))[_0x853d('0x29')](respondWithResult(_0x570a75,null))[_0x853d('0x4b')](handleError(_0x570a75,null));};exports[_0x853d('0x4f')]=function(_0x219bd2,_0x293ca5,_0x3ca7e6){return db[_0x853d('0x33')][_0x853d('0x4e')]({'where':{'id':_0x219bd2[_0x853d('0x50')]['id']},'attributes':['name','path'],'raw':!![]})[_0x853d('0x29')](handleEntityNotFound(_0x293ca5,null))[_0x853d('0x29')](function(_0x1f5021){if(_0x1f5021){var _0x3e8a18=path['join'](config[_0x853d('0x51')],_0x853d('0x52'),util['format'](_0x853d('0x53'),path[_0x853d('0x54')](_0x1f5021[_0x853d('0x9')])));var _0x4fa76b=fs['createWriteStream'](_0x3e8a18);var _0x300ddf=archiver(_0x853d('0x55'),{'zlib':{'level':0x9}});_0x300ddf['on'](_0x853d('0x56'),function(_0x5c78a4){if(_0x5c78a4['code']==='ENOENT'){logger['error'](_0x5c78a4);}else{throw new db['Sequelize']['Error'](_0x853d('0x57'));}});_0x300ddf['on'](_0x853d('0x2e'),function(_0x335a1a){throw new db[(_0x853d('0x58'))][(_0x853d('0x59'))](_0x853d('0x57'));});_0x300ddf[_0x853d('0x5a')](_0x4fa76b);_0x300ddf[_0x853d('0x5b')]('**/*',{'cwd':path['join'](config[_0x853d('0x51')],'server/files/plugins',path[_0x853d('0x5c')](_0x1f5021[_0x853d('0x9')])),'ignore':[path[_0x853d('0x5d')](path[_0x853d('0x54')](_0x1f5021['path']),_0x853d('0x5e')),path[_0x853d('0x5d')](path['basename'](_0x1f5021[_0x853d('0x9')]),_0x853d('0x5f'))],'nodir':!![]})[_0x853d('0x60')]();_0x4fa76b['on'](_0x853d('0x61'),function(){if(!fs[_0x853d('0x62')](_0x3e8a18)){throw new db[(_0x853d('0x58'))][(_0x853d('0x59'))](_0x853d('0x63'));}return _0x293ca5[_0x853d('0x4f')](_0x3e8a18,util[_0x853d('0x64')](_0x853d('0x53'),path['basename'](_0x1f5021[_0x853d('0x9')])),function(_0x5a26e1){if(_0x5a26e1){throw new db[(_0x853d('0x58'))][(_0x853d('0x59'))](_0x853d('0x65'));}fs['unlinkSync'](_0x3e8a18);logger['info'](_0x853d('0x66'));logger[_0x853d('0x67')]('Temporary\x20file\x20removed');});});}return null;})['catch'](handleError(_0x293ca5,null));};exports['upload']=function(_0x1fbcbb,_0x283e7e,_0x5ec07f){var _0x1157b9=path[_0x853d('0x54')](_0x1fbcbb[_0x853d('0x68')][_0x853d('0x69')],path['extname'](_0x1fbcbb[_0x853d('0x68')]['filename']));var _0x124341=path['join'](config['root'],_0x853d('0x52'),_0x1fbcbb[_0x853d('0x68')][_0x853d('0x69')]);var _0x3f474c=path['join'](config[_0x853d('0x51')],_0x853d('0x52'),_0x1157b9);logger[_0x853d('0x67')](_0x853d('0x6a'),_0x124341);logger[_0x853d('0x67')](_0x853d('0x6b'),_0x3f474c);try{fs['chmodSync'](_0x124341,parseInt(_0x853d('0x6c'),0x8));extract(_0x124341,{'dir':_0x3f474c},function(_0x4a52ba){if(_0x4a52ba){logger[_0x853d('0x2e')](_0x4a52ba);handleError(_0x4a52ba,!![]);};var _0x4a5463=fs['readdirSync'](_0x3f474c);if(_0x4a5463[_0x853d('0x3f')]>0x1){removeReferences(_0x124341,_0x3f474c);logger[_0x853d('0x2e')](_0x853d('0x6d'));return _0x5ec07f(new Error('Invalid\x20plugin\x20structure'));}var _0x2b082a=fs['lstatSync'](path[_0x853d('0x5d')](_0x3f474c,_0x4a5463[0x0]));if(_0x2b082a[_0x853d('0x6e')]()){removeReferences(_0x124341,_0x3f474c);logger['error'](_0x853d('0x6d'));return _0x5ec07f(new Error(_0x853d('0x6d')));}if(_0x2b082a[_0x853d('0x6f')]()){var _0x4a24f2=fs[_0x853d('0x70')](path[_0x853d('0x5d')](_0x3f474c,_0x4a5463[0x0]));if(_0x4a24f2[_0x853d('0x3f')]===0x0){removeReferences(_0x124341,_0x3f474c);logger[_0x853d('0x2e')](_0x853d('0x6d'));return _0x5ec07f(new Error(_0x853d('0x6d')));}var _0xe59474=_0x4a24f2[_0x853d('0x71')](function(_0x38b9de){return _0x38b9de==='manifest.json';});if(!_0xe59474){return _0x5ec07f(new Error(_0x853d('0x72')));}var _0x581dde=fs['readFileSync'](path['join'](_0x3f474c,_0x4a5463[0x0],_0x853d('0x73')));var _0x3ba303=JSON[_0x853d('0x74')](_0x581dde);if('undefined'==typeof _0x3ba303[_0x853d('0x30')]){return _0x5ec07f(new Error(_0x853d('0x75')));}if(_0x853d('0x76')==typeof _0x3ba303[_0x853d('0x36')]){return _0x5ec07f(new Error(_0x853d('0x77')));}if(_0x853d('0x76')==typeof _0x3ba303[_0x853d('0x78')]){return _0x5ec07f(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x853d('0x76')==typeof _0x3ba303['parameters']){return _0x5ec07f(new Error(_0x853d('0x79')));}if(_0x3ba303[_0x853d('0x36')]===_0x853d('0x7a')){if(_0x853d('0x76')==typeof _0x3ba303[_0x853d('0x7b')][_0x853d('0x7c')]){return _0x5ec07f(new Error('Invalid\x20manifest:\x20views\x20missing'));}if('undefined'==typeof _0x3ba303[_0x853d('0x7b')][_0x853d('0x7c')][_0x853d('0x7d')]&&_0x853d('0x76')==typeof _0x3ba303[_0x853d('0x7b')][_0x853d('0x7c')][_0x853d('0x7e')]){return _0x5ec07f(new Error(_0x853d('0x7f')));}}else if(_0x3ba303[_0x853d('0x36')]==='script'){if('undefined'==typeof _0x3ba303[_0x853d('0x7b')][_0x853d('0x80')]){return _0x5ec07f(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x853d('0x76')==typeof _0x3ba303[_0x853d('0x7b')][_0x853d('0x81')]){return _0x5ec07f(new Error(_0x853d('0x82')));}}else{return _0x5ec07f(new Error(_0x853d('0x83')));}var _0x25421f=_0x3ba303['name'];var _0x3e7ed5=_0x3ba303[_0x853d('0x84')];var _0x28dd42=_0x3ba303[_0x853d('0x36')];var _0x362f6f=_0x3ba303[_0x853d('0x85')]?_0x3ba303['sidebar']:'always';var _0x1f2d72=_0x3ba303[_0x853d('0x86')]?_0x3ba303['icon']:'icon-apps';var _0x33b33='';var _0x2382ca='';var _0x54d003='';var _0x211696='';var _0x47e8c6=_0x3ba303[_0x853d('0x78')];if(_0x28dd42==='html'){if(_0x853d('0x76')!=typeof _0x3ba303[_0x853d('0x7b')][_0x853d('0x7c')][_0x853d('0x7d')]){var _0x5bf391=_0x3ba303[_0x853d('0x7b')]['views'][_0x853d('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0x853d('0x87')](_0x5bf391)){_0x33b33=path[_0x853d('0x5d')](_0x853d('0x88'),_0x1157b9,_0x4a5463[0x0],_0x5bf391);}else{_0x33b33=_0x5bf391;}}else{logger[_0x853d('0x67')](_0x853d('0x89'));}if(_0x853d('0x76')!=typeof _0x3ba303[_0x853d('0x7b')][_0x853d('0x7c')][_0x853d('0x7e')]){var _0x41a4b5=_0x3ba303[_0x853d('0x7b')][_0x853d('0x7c')][_0x853d('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0x853d('0x87')](_0x41a4b5)){_0x2382ca=path[_0x853d('0x5d')](_0x853d('0x88'),_0x1157b9,_0x4a5463[0x0],_0x41a4b5);}else{_0x2382ca=_0x41a4b5;}}else{logger[_0x853d('0x67')](_0x853d('0x8a'));}}else if(_0x28dd42===_0x853d('0x8b')){_0x54d003=_0x3ba303[_0x853d('0x7b')][_0x853d('0x80')];_0x211696=_0x3ba303[_0x853d('0x7b')]['scriptPath'];if(_0x853d('0x76')!=typeof _0x3ba303['parameters']['views']){if('undefined'!=typeof _0x3ba303[_0x853d('0x7b')][_0x853d('0x7c')][_0x853d('0x7d')]){var _0x5bf391=_0x3ba303[_0x853d('0x7b')][_0x853d('0x7c')][_0x853d('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0x853d('0x87')](_0x5bf391)){_0x33b33=path[_0x853d('0x5d')](_0x853d('0x88'),_0x1157b9,_0x4a5463[0x0],_0x5bf391);}else{_0x33b33=_0x5bf391;}}if(_0x853d('0x76')!=typeof _0x3ba303[_0x853d('0x7b')][_0x853d('0x7c')]['agent']){var _0x41a4b5=_0x3ba303[_0x853d('0x7b')][_0x853d('0x7c')][_0x853d('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0x853d('0x87')](_0x41a4b5)){_0x2382ca=path['join'](_0x853d('0x88'),_0x1157b9,_0x4a5463[0x0],_0x41a4b5);}else{_0x2382ca=_0x41a4b5;}}}}var _0x50e4bf={'name':_0x25421f,'description':_0x3e7ed5,'path':path[_0x853d('0x5d')](_0x1157b9,_0x4a5463[0x0]),'type':_0x28dd42,'sidebar':_0x362f6f,'icon':_0x1f2d72,'adminUrl':_0x33b33,'agentUrl':_0x2382ca,'scriptName':_0x54d003,'scriptPath':_0x211696,'version':_0x47e8c6};removeReferences(_0x124341,null);return db['Plugin'][_0x853d('0x8c')](_0x50e4bf)[_0x853d('0x29')](function(_0x3ec812){var _0x3183a3={'role':_0x1fbcbb[_0x853d('0x8d')]['role'],'userProfileId':_0x1fbcbb[_0x853d('0x8d')]['userProfileId']};if(!_0x3183a3)throw new Error(_0x853d('0x8e'));if(_0x3183a3['role']==='user'){var _0x4e26e0=_0x3ec812[_0x853d('0x2a')]({'plain':!![]});return db[_0x853d('0x8f')][_0x853d('0x4e')]({'where':{'name':_0x853d('0x2b'),'userProfileId':_0x3183a3[_0x853d('0x90')]},'raw':!![]})[_0x853d('0x29')](function(_0x488669){if(_0x488669&&_0x488669[_0x853d('0x91')]===0x0){return db[_0x853d('0x2c')][_0x853d('0x8c')]({'name':_0x4e26e0[_0x853d('0x30')],'resourceId':_0x4e26e0['id'],'type':_0x488669['name'],'sectionId':_0x488669['id']},{})['then'](function(){return _0x3ec812;});}else{return _0x3ec812;}})[_0x853d('0x4b')](function(_0x4f59c9){logger[_0x853d('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f59c9);throw _0x4f59c9;});}return _0x3ec812;})[_0x853d('0x29')](respondWithResult(_0x283e7e,null))['catch'](handleError(_0x283e7e,null));}});}catch(_0x11e44d){_0x283e7e[_0x853d('0x21')](0x1f4)[_0x853d('0x92')](_0x11e44d);}};function removeReferences(_0x2f76fa,_0x409ea4){try{if(_0x2f76fa){fs['unlinkSync'](_0x2f76fa);logger['info'](_0x853d('0x93'));}if(_0x409ea4){rimraf(_0x409ea4,function(){});logger[_0x853d('0x67')]('Extracted\x20folder\x20removed');}}catch(_0x42e95a){logger['error'](_0x42e95a);}}exports[_0x853d('0x28')]=function(_0x3d9130,_0x1df96c,_0x1f1f89){return db[_0x853d('0x33')]['find']({'where':{'id':_0x3d9130[_0x853d('0x50')]['id']}})[_0x853d('0x29')](handleEntityNotFound(_0x1df96c,null))[_0x853d('0x29')](saveUpdates(_0x3d9130[_0x853d('0x8d')],null))[_0x853d('0x29')](respondWithResult(_0x1df96c,null))[_0x853d('0x4b')](handleError(_0x1df96c,null));};exports[_0x853d('0x94')]=function(_0x128da,_0x313994,_0xc4fdc7){return db[_0x853d('0x33')][_0x853d('0x4e')]({'where':{'id':_0x128da['params']['id']}})[_0x853d('0x29')](function(_0x5dc5ad){if(_0x5dc5ad){return _0x5dc5ad['destroy']();}})['then'](function(_0xb52b02){rimraf(path['join'](config[_0x853d('0x51')],_0x853d('0x52'),path[_0x853d('0x5c')](_0xb52b02['path'])),function(){});return _0xb52b02;})[_0x853d('0x29')](handleEntityNotFound(_0x313994,null))[_0x853d('0x29')](respondWithStatusCode(_0x313994,null))['catch'](handleError(_0x313994,null));};exports[_0x853d('0x95')]=function(_0x277c01,_0x84723d,_0x109602){return BPromise['resolve']()[_0x853d('0x29')](function(){if(!_0x277c01[_0x853d('0x39')][_0x853d('0x9')]){throw new Error(_0x853d('0x96'));}if(!_0x277c01[_0x853d('0x39')][_0x853d('0x97')]){throw new Error(_0x853d('0x98'));}var _0x1b6024=_0x277c01[_0x853d('0x39')][_0x853d('0x99')]?_0x277c01[_0x853d('0x39')][_0x853d('0x99')]+':'+_0x277c01[_0x853d('0x39')][_0x853d('0x97')]:_0x853d('0x9a')+_0x277c01[_0x853d('0x39')][_0x853d('0x97')];var _0x56d79d=_0x277c01[_0x853d('0x39')][_0x853d('0x25')]?_0x277c01[_0x853d('0x39')][_0x853d('0x25')]:!![];var _0xe83c28=_0x277c01[_0x853d('0x39')][_0x853d('0x9b')]?_0x277c01[_0x853d('0x39')][_0x853d('0x9b')]:null;var _0x2e1f01={'method':_0x277c01[_0x853d('0x9c')],'uri':util[_0x853d('0x64')](_0x853d('0x9d'),_0x1b6024,_0x277c01[_0x853d('0x39')][_0x853d('0x9')]),'json':_0x56d79d,'resolveWithFullResponse':!![],'encoding':_0xe83c28,'qs':_0x277c01['query']};if(_0x277c01['headers']){_0x2e1f01['headers']=_0x277c01[_0x853d('0x9e')];if(_0x2e1f01[_0x853d('0x9e')][_0x853d('0x9f')]){delete _0x2e1f01['headers'][_0x853d('0x9f')];}}if(_0x2e1f01[_0x853d('0x9e')][_0x853d('0xa0')]){delete _0x2e1f01[_0x853d('0x9e')][_0x853d('0xa0')];}return rp(_0x2e1f01);})['then'](function(_0x537b9f){if(_0x537b9f){_0x84723d[_0x853d('0xa1')](_0x537b9f[_0x853d('0x9e')]);logger[_0x853d('0x67')](_0x537b9f[_0x853d('0x8d')]);if(_[_0x853d('0xa2')](_0x277c01[_0x853d('0x39')]['path'],_0x853d('0x4f'))&&_0x537b9f['statusCode']==0x1f4){return _0x84723d[_0x853d('0x20')](_0x537b9f[_0x853d('0xa3')]);}else{return _0x84723d['status'](_0x537b9f[_0x853d('0xa3')])[_0x853d('0x92')](_0x537b9f['body']);}}else{return _0x84723d['sendStatus'](0xc8);}})[_0x853d('0x4b')](handleError(_0x84723d,null));};exports[_0x853d('0xa4')]=function(_0x32f3ae,_0x5d1030,_0x572dec){return BPromise[_0x853d('0xa5')]()[_0x853d('0x29')](function(){if(!_0x32f3ae[_0x853d('0x39')][_0x853d('0x9')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x32f3ae[_0x853d('0x39')]['port']){throw new Error(_0x853d('0x98'));}var _0x11f374=_0x32f3ae[_0x853d('0x39')][_0x853d('0x99')]?_0x32f3ae[_0x853d('0x39')][_0x853d('0x99')]+':'+_0x32f3ae[_0x853d('0x39')]['port']:_0x853d('0x9a')+_0x32f3ae[_0x853d('0x39')][_0x853d('0x97')];var _0x33f9b7=_0x32f3ae[_0x853d('0x39')][_0x853d('0x25')]?_0x32f3ae[_0x853d('0x39')][_0x853d('0x25')]:!![];var _0x5bf131=_0x32f3ae[_0x853d('0x39')][_0x853d('0x9b')]?_0x32f3ae[_0x853d('0x39')][_0x853d('0x9b')]:null;var _0x455e6f={'method':_0x32f3ae['method'],'uri':util[_0x853d('0x64')](_0x853d('0x9d'),_0x11f374,_0x32f3ae[_0x853d('0x39')]['path']),'json':_0x33f9b7,'resolveWithFullResponse':!![],'encoding':_0x5bf131,'body':_0x32f3ae[_0x853d('0x8d')]};if(_0x32f3ae[_0x853d('0x9e')]){_0x455e6f['headers']=_0x32f3ae['headers'];if(_0x455e6f['headers']['content-length']){delete _0x455e6f[_0x853d('0x9e')][_0x853d('0x9f')];}}if(_0x455e6f['headers'][_0x853d('0xa0')]){delete _0x455e6f[_0x853d('0x9e')][_0x853d('0xa0')];}return rp(_0x455e6f);})['then'](function(_0x4f0561){if(_0x4f0561){_0x5d1030[_0x853d('0xa1')](_0x4f0561[_0x853d('0x9e')]);logger['info'](_0x4f0561[_0x853d('0x8d')]);return _0x5d1030[_0x853d('0x21')](_0x4f0561[_0x853d('0xa3')])[_0x853d('0x92')](_0x4f0561[_0x853d('0x8d')]);}else{return _0x5d1030[_0x853d('0x20')](0xc8);}})[_0x853d('0x4b')](handleError(_0x5d1030,null));}; \ No newline at end of file +var _0x9174=['statusCode','webhookPost','%s%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','count','offset','limit','set','apply','save','then','get','UserProfileResource','error','stack','name','send','Plugin','rawAttributes','fieldName','key','model','map','attributes','intersection','fields','query','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','catch','show','params','keys','includeAll','include','options','find','download','root','server/files/plugins','%s.zip','basename','createWriteStream','zip','warning','code','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','Error','glob','**/*','join','dirname','node_modules/**/*','attachments/**/*','finalize','close','Plugin\x20not\x20found','format','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','upload','filename','file','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','Plugin\x20manifest\x20missing','readFileSync','parse','undefined','Invalid\x20manifest:\x20name\x20missing','type','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','scriptName','create','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','Plugins','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','body','delete','destroy','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','headers','content-length','content-type','endsWith'];(function(_0x1fcde2,_0xa49b11){var _0x378d7b=function(_0x3a75ad){while(--_0x3a75ad){_0x1fcde2['push'](_0x1fcde2['shift']());}};_0x378d7b(++_0xa49b11);}(_0x9174,0xa9));var _0x4917=function(_0x19792d,_0x1984a9){_0x19792d=_0x19792d-0x0;var _0x4f2117=_0x9174[_0x19792d];return _0x4f2117;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4917('0x0'));var rimraf=require(_0x4917('0x1'));var zipdir=require(_0x4917('0x2'));var jsonpatch=require(_0x4917('0x3'));var rp=require(_0x4917('0x4'));var moment=require('moment');var BPromise=require(_0x4917('0x5'));var Mustache=require('mustache');var util=require(_0x4917('0x6'));var path=require(_0x4917('0x7'));var sox=require(_0x4917('0x8'));var csv=require('to-csv');var ejs=require(_0x4917('0x9'));var fs=require('fs');var _=require(_0x4917('0xa'));var squel=require(_0x4917('0xb'));var crypto=require('crypto');var jsforce=require(_0x4917('0xc'));var deskjs=require(_0x4917('0xd'));var toCsv=require(_0x4917('0xe'));var querystring=require(_0x4917('0xf'));var Papa=require('papaparse');var extract=require(_0x4917('0x10'));var rimraf=require(_0x4917('0x1'));var archiver=require(_0x4917('0x11'));var Redis=require(_0x4917('0x12'));var authService=require(_0x4917('0x13'));var qs=require(_0x4917('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4917('0x15'));var logger=require(_0x4917('0x16'))(_0x4917('0x17'));var utils=require(_0x4917('0x18'));var config=require('../../config/environment');var db=require(_0x4917('0x19'))['db'];config[_0x4917('0x1a')]=_[_0x4917('0x1b')](config['redis'],{'host':_0x4917('0x1c'),'port':0x18eb});var socket=require(_0x4917('0x1d'))(new Redis(config[_0x4917('0x1a')]));require('./plugin.socket')[_0x4917('0x1e')](socket);function respondWithStatusCode(_0x534e68,_0x152048){_0x152048=_0x152048||0xcc;return function(_0x48d96c){if(_0x48d96c){return _0x534e68[_0x4917('0x1f')](_0x152048);}return _0x534e68['status'](_0x152048)[_0x4917('0x20')]();};}function respondWithResult(_0x10922c,_0x30384a){_0x30384a=_0x30384a||0xc8;return function(_0x402f51){if(_0x402f51){return _0x10922c[_0x4917('0x21')](_0x30384a)[_0x4917('0x22')](_0x402f51);}};}function respondWithFilteredResult(_0x4860cf,_0x584e81){return function(_0x923de1){if(_0x923de1){var _0x1defa8=_0x923de1[_0x4917('0x23')],_0x433ffb=_0x584e81['offset'],_0xe9fa2c=_0x584e81[_0x4917('0x24')]+_0x584e81[_0x4917('0x25')],_0x2b2c22;if(_0xe9fa2c>=_0x1defa8){_0xe9fa2c=_0x1defa8;_0x2b2c22=0xc8;}else{_0x2b2c22=0xce;}_0x4860cf[_0x4917('0x21')](_0x2b2c22);return _0x4860cf[_0x4917('0x26')]('Content-Range',_0x433ffb+'-'+_0xe9fa2c+'/'+_0x1defa8)['json'](_0x923de1);}return null;};}function patchUpdates(_0x47d12a){return function(_0x21b24b){try{jsonpatch[_0x4917('0x27')](_0x21b24b,_0x47d12a,!![]);}catch(_0x430f74){return BPromise['reject'](_0x430f74);}return _0x21b24b[_0x4917('0x28')]();};}function saveUpdates(_0x5b3577,_0x6bf290){return function(_0x4c3ca5){if(_0x4c3ca5){return _0x4c3ca5['update'](_0x5b3577)['then'](function(_0x165e91){return _0x165e91;});}return null;};}function removeEntity(_0x5184ab,_0x3b2064){return function(_0x1d0017){if(_0x1d0017){return _0x1d0017['destroy']()[_0x4917('0x29')](function(){var _0x27a3b3=_0x1d0017[_0x4917('0x2a')]({'plain':!![]});var _0x49a929='Plugins';return db[_0x4917('0x2b')]['destroy']({'where':{'type':_0x49a929,'resourceId':_0x27a3b3['id']}})[_0x4917('0x29')](function(){return _0x1d0017;});})['then'](function(){_0x5184ab['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x570579,_0x4694b6){return function(_0x12dcd2){if(!_0x12dcd2){_0x570579[_0x4917('0x1f')](0x194);}return _0x12dcd2;};}function handleError(_0x1f5551,_0x21ce8f){_0x21ce8f=_0x21ce8f||0x1f4;return function(_0x1635f1){logger[_0x4917('0x2c')](_0x1635f1[_0x4917('0x2d')]);if(_0x1635f1[_0x4917('0x2e')]){delete _0x1635f1[_0x4917('0x2e')];}_0x1f5551[_0x4917('0x21')](_0x21ce8f)[_0x4917('0x2f')](_0x1635f1);};}exports['index']=function(_0xfb42b3,_0x4cdcbf){var _0x13c687={},_0x207ebb={},_0x4fdda0={'count':0x0,'rows':[]};var _0x3c702e=_['map'](db[_0x4917('0x30')][_0x4917('0x31')],function(_0x103d2b){return{'name':_0x103d2b[_0x4917('0x32')],'type':_0x103d2b['type'][_0x4917('0x33')]};});_0x207ebb[_0x4917('0x34')]=_[_0x4917('0x35')](_0x3c702e,_0x4917('0x2e'));_0x207ebb['query']=_['keys'](_0xfb42b3['query']);_0x207ebb['filters']=_['intersection'](_0x207ebb['model'],_0x207ebb['query']);_0x13c687[_0x4917('0x36')]=_[_0x4917('0x37')](_0x207ebb[_0x4917('0x34')],qs[_0x4917('0x38')](_0xfb42b3[_0x4917('0x39')][_0x4917('0x38')]));_0x13c687[_0x4917('0x36')]=_0x13c687[_0x4917('0x36')][_0x4917('0x3a')]?_0x13c687[_0x4917('0x36')]:_0x207ebb[_0x4917('0x34')];if(!_0xfb42b3[_0x4917('0x39')][_0x4917('0x3b')](_0x4917('0x3c'))){_0x13c687[_0x4917('0x25')]=qs['limit'](_0xfb42b3[_0x4917('0x39')]['limit']);_0x13c687[_0x4917('0x24')]=qs[_0x4917('0x24')](_0xfb42b3['query'][_0x4917('0x24')]);}_0x13c687[_0x4917('0x3d')]=qs['sort'](_0xfb42b3[_0x4917('0x39')]['sort']);_0x13c687[_0x4917('0x3e')]=qs[_0x4917('0x3f')](_[_0x4917('0x40')](_0xfb42b3['query'],_0x207ebb[_0x4917('0x3f')]));if(_0xfb42b3[_0x4917('0x39')][_0x4917('0x41')]){_0x13c687[_0x4917('0x3e')]=_[_0x4917('0x42')](_0x13c687[_0x4917('0x3e')],{'$or':_[_0x4917('0x35')](_0x3c702e,function(_0x354f14){if(_0x354f14['type']!==_0x4917('0x43')){var _0x1da742={};_0x1da742[_0x354f14[_0x4917('0x2e')]]={'$like':'%'+_0xfb42b3['query']['filter']+'%'};return _0x1da742;}})});}_0x13c687=_[_0x4917('0x42')]({},_0x13c687,_0xfb42b3['options']);var _0x5c5f2c={'where':_0x13c687['where']};return db['Plugin']['count'](_0x5c5f2c)[_0x4917('0x29')](function(_0x3beeb0){_0x4fdda0[_0x4917('0x23')]=_0x3beeb0;if(_0xfb42b3[_0x4917('0x39')]['includeAll']){_0x13c687['include']=[{'all':!![]}];}return db['Plugin']['findAll'](_0x13c687);})['then'](function(_0x118a25){_0x4fdda0['rows']=_0x118a25;return _0x4fdda0;})[_0x4917('0x29')](respondWithFilteredResult(_0x4cdcbf,_0x13c687))[_0x4917('0x44')](handleError(_0x4cdcbf,null));};exports[_0x4917('0x45')]=function(_0x4d680c,_0x5bb2f0){var _0x311baa={'raw':!![],'where':{'id':_0x4d680c[_0x4917('0x46')]['id']}},_0x4e05fd={};_0x4e05fd['model']=_[_0x4917('0x47')](db[_0x4917('0x30')]['rawAttributes']);_0x4e05fd[_0x4917('0x39')]=_[_0x4917('0x47')](_0x4d680c[_0x4917('0x39')]);_0x4e05fd[_0x4917('0x3f')]=_[_0x4917('0x37')](_0x4e05fd[_0x4917('0x34')],_0x4e05fd[_0x4917('0x39')]);_0x311baa['attributes']=_[_0x4917('0x37')](_0x4e05fd[_0x4917('0x34')],qs[_0x4917('0x38')](_0x4d680c[_0x4917('0x39')][_0x4917('0x38')]));_0x311baa[_0x4917('0x36')]=_0x311baa[_0x4917('0x36')][_0x4917('0x3a')]?_0x311baa['attributes']:_0x4e05fd[_0x4917('0x34')];if(_0x4d680c[_0x4917('0x39')][_0x4917('0x48')]){_0x311baa[_0x4917('0x49')]=[{'all':!![]}];}_0x311baa=_[_0x4917('0x42')]({},_0x311baa,_0x4d680c[_0x4917('0x4a')]);return db[_0x4917('0x30')][_0x4917('0x4b')](_0x311baa)['then'](handleEntityNotFound(_0x5bb2f0,null))['then'](respondWithResult(_0x5bb2f0,null))[_0x4917('0x44')](handleError(_0x5bb2f0,null));};exports[_0x4917('0x4c')]=function(_0x387aff,_0x3a1c48,_0x2ac3d7){return db[_0x4917('0x30')][_0x4917('0x4b')]({'where':{'id':_0x387aff[_0x4917('0x46')]['id']},'attributes':[_0x4917('0x2e'),_0x4917('0x7')],'raw':!![]})['then'](handleEntityNotFound(_0x3a1c48,null))['then'](function(_0x400105){if(_0x400105){var _0x3eb526=path['join'](config[_0x4917('0x4d')],_0x4917('0x4e'),util['format'](_0x4917('0x4f'),path[_0x4917('0x50')](_0x400105[_0x4917('0x7')])));var _0x2d04d7=fs[_0x4917('0x51')](_0x3eb526);var _0x5a73d6=archiver(_0x4917('0x52'),{'zlib':{'level':0x9}});_0x5a73d6['on'](_0x4917('0x53'),function(_0x245d5c){if(_0x245d5c[_0x4917('0x54')]==='ENOENT'){logger[_0x4917('0x2c')](_0x245d5c);}else{throw new db['Sequelize']['Error'](_0x4917('0x55'));}});_0x5a73d6['on'](_0x4917('0x2c'),function(_0x438810){throw new db[(_0x4917('0x56'))][(_0x4917('0x57'))](_0x4917('0x55'));});_0x5a73d6['pipe'](_0x2d04d7);_0x5a73d6[_0x4917('0x58')](_0x4917('0x59'),{'cwd':path[_0x4917('0x5a')](config[_0x4917('0x4d')],_0x4917('0x4e'),path[_0x4917('0x5b')](_0x400105[_0x4917('0x7')])),'ignore':[path[_0x4917('0x5a')](path[_0x4917('0x50')](_0x400105[_0x4917('0x7')]),_0x4917('0x5c')),path[_0x4917('0x5a')](path[_0x4917('0x50')](_0x400105[_0x4917('0x7')]),_0x4917('0x5d'))],'nodir':!![]})[_0x4917('0x5e')]();_0x2d04d7['on'](_0x4917('0x5f'),function(){if(!fs['existsSync'](_0x3eb526)){throw new db[(_0x4917('0x56'))][(_0x4917('0x57'))](_0x4917('0x60'));}return _0x3a1c48[_0x4917('0x4c')](_0x3eb526,util[_0x4917('0x61')]('%s.zip',path['basename'](_0x400105[_0x4917('0x7')])),function(_0xa5d1f3){if(_0xa5d1f3){throw new db[(_0x4917('0x56'))][(_0x4917('0x57'))](_0x4917('0x62'));}fs[_0x4917('0x63')](_0x3eb526);logger[_0x4917('0x64')]('Download\x20completed');logger[_0x4917('0x64')]('Temporary\x20file\x20removed');});});}return null;})['catch'](handleError(_0x3a1c48,null));};exports[_0x4917('0x65')]=function(_0x53af0f,_0x502999,_0x485a91){var _0x3fa7a0=path[_0x4917('0x50')](_0x53af0f['file'][_0x4917('0x66')],path['extname'](_0x53af0f[_0x4917('0x67')][_0x4917('0x66')]));var _0x16baeb=path['join'](config[_0x4917('0x4d')],_0x4917('0x4e'),_0x53af0f[_0x4917('0x67')][_0x4917('0x66')]);var _0x274182=path[_0x4917('0x5a')](config[_0x4917('0x4d')],_0x4917('0x4e'),_0x3fa7a0);logger[_0x4917('0x64')]('Plugin\x20upload\x20filepath:\x20%s',_0x16baeb);logger[_0x4917('0x64')](_0x4917('0x68'),_0x274182);try{fs[_0x4917('0x69')](_0x16baeb,parseInt(_0x4917('0x6a'),0x8));extract(_0x16baeb,{'dir':_0x274182},function(_0x4f5ffa){if(_0x4f5ffa){logger['error'](_0x4f5ffa);handleError(_0x4f5ffa,!![]);};var _0x212ed5=fs[_0x4917('0x6b')](_0x274182);if(_0x212ed5[_0x4917('0x3a')]>0x1){removeReferences(_0x16baeb,_0x274182);logger[_0x4917('0x2c')]('Invalid\x20plugin\x20structure');return _0x485a91(new Error(_0x4917('0x6c')));}var _0x164f3e=fs[_0x4917('0x6d')](path['join'](_0x274182,_0x212ed5[0x0]));if(_0x164f3e[_0x4917('0x6e')]()){removeReferences(_0x16baeb,_0x274182);logger[_0x4917('0x2c')](_0x4917('0x6c'));return _0x485a91(new Error('Invalid\x20plugin\x20structure'));}if(_0x164f3e[_0x4917('0x6f')]()){var _0x4ecab5=fs['readdirSync'](path['join'](_0x274182,_0x212ed5[0x0]));if(_0x4ecab5[_0x4917('0x3a')]===0x0){removeReferences(_0x16baeb,_0x274182);logger[_0x4917('0x2c')](_0x4917('0x6c'));return _0x485a91(new Error(_0x4917('0x6c')));}var _0x4544a3=_0x4ecab5[_0x4917('0x70')](function(_0x33a2b3){return _0x33a2b3==='manifest.json';});if(!_0x4544a3){return _0x485a91(new Error(_0x4917('0x71')));}var _0x36ea1e=fs[_0x4917('0x72')](path[_0x4917('0x5a')](_0x274182,_0x212ed5[0x0],'manifest.json'));var _0x36b07c=JSON[_0x4917('0x73')](_0x36ea1e);if(_0x4917('0x74')==typeof _0x36b07c[_0x4917('0x2e')]){return _0x485a91(new Error(_0x4917('0x75')));}if(_0x4917('0x74')==typeof _0x36b07c[_0x4917('0x76')]){return _0x485a91(new Error('Invalid\x20manifest:\x20type\x20missing'));}if('undefined'==typeof _0x36b07c[_0x4917('0x77')]){return _0x485a91(new Error(_0x4917('0x78')));}if(_0x4917('0x74')==typeof _0x36b07c[_0x4917('0x79')]){return _0x485a91(new Error(_0x4917('0x7a')));}if(_0x36b07c[_0x4917('0x76')]===_0x4917('0x7b')){if(_0x4917('0x74')==typeof _0x36b07c[_0x4917('0x79')]['views']){return _0x485a91(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x4917('0x74')==typeof _0x36b07c['parameters'][_0x4917('0x7c')][_0x4917('0x7d')]&&'undefined'==typeof _0x36b07c[_0x4917('0x79')][_0x4917('0x7c')][_0x4917('0x7e')]){return _0x485a91(new Error(_0x4917('0x7f')));}}else if(_0x36b07c[_0x4917('0x76')]==='script'){if(_0x4917('0x74')==typeof _0x36b07c[_0x4917('0x79')]['scriptName']){return _0x485a91(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x4917('0x74')==typeof _0x36b07c[_0x4917('0x79')][_0x4917('0x80')]){return _0x485a91(new Error(_0x4917('0x81')));}}else{return _0x485a91(new Error(_0x4917('0x82')));}var _0x470ac0=_0x36b07c[_0x4917('0x2e')];var _0x4a9518=_0x36b07c[_0x4917('0x83')];var _0xb1085e=_0x36b07c['type'];var _0x4a1bf1=_0x36b07c[_0x4917('0x84')]?_0x36b07c[_0x4917('0x84')]:_0x4917('0x85');var _0x3f6074=_0x36b07c[_0x4917('0x86')]?_0x36b07c[_0x4917('0x86')]:_0x4917('0x87');var _0x5b011d='';var _0x21d81d='';var _0x2cd60a='';var _0x25da6f='';var _0x4a30fb=_0x36b07c['version'];if(_0xb1085e===_0x4917('0x7b')){if(_0x4917('0x74')!=typeof _0x36b07c[_0x4917('0x79')][_0x4917('0x7c')][_0x4917('0x7d')]){var _0x59d75f=_0x36b07c[_0x4917('0x79')][_0x4917('0x7c')][_0x4917('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0x4917('0x88')](_0x59d75f)){_0x5b011d=path[_0x4917('0x5a')](_0x4917('0x89'),_0x3fa7a0,_0x212ed5[0x0],_0x59d75f);}else{_0x5b011d=_0x59d75f;}}else{logger[_0x4917('0x64')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x4917('0x74')!=typeof _0x36b07c['parameters']['views'][_0x4917('0x7e')]){var _0x58d3aa=_0x36b07c['parameters'][_0x4917('0x7c')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x4917('0x88')](_0x58d3aa)){_0x21d81d=path[_0x4917('0x5a')](_0x4917('0x89'),_0x3fa7a0,_0x212ed5[0x0],_0x58d3aa);}else{_0x21d81d=_0x58d3aa;}}else{logger[_0x4917('0x64')](_0x4917('0x8a'));}}else if(_0xb1085e==='script'){_0x2cd60a=_0x36b07c[_0x4917('0x79')][_0x4917('0x8b')];_0x25da6f=_0x36b07c[_0x4917('0x79')][_0x4917('0x80')];if(_0x4917('0x74')!=typeof _0x36b07c[_0x4917('0x79')]['views']){if(_0x4917('0x74')!=typeof _0x36b07c[_0x4917('0x79')][_0x4917('0x7c')][_0x4917('0x7d')]){var _0x59d75f=_0x36b07c[_0x4917('0x79')][_0x4917('0x7c')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x4917('0x88')](_0x59d75f)){_0x5b011d=path[_0x4917('0x5a')](_0x4917('0x89'),_0x3fa7a0,_0x212ed5[0x0],_0x59d75f);}else{_0x5b011d=_0x59d75f;}}if(_0x4917('0x74')!=typeof _0x36b07c['parameters'][_0x4917('0x7c')]['agent']){var _0x58d3aa=_0x36b07c[_0x4917('0x79')][_0x4917('0x7c')][_0x4917('0x7e')];if(!/^(f|ht)tps?:\/\//i['test'](_0x58d3aa)){_0x21d81d=path[_0x4917('0x5a')](_0x4917('0x89'),_0x3fa7a0,_0x212ed5[0x0],_0x58d3aa);}else{_0x21d81d=_0x58d3aa;}}}}var _0x1e3187={'name':_0x470ac0,'description':_0x4a9518,'path':path[_0x4917('0x5a')](_0x3fa7a0,_0x212ed5[0x0]),'type':_0xb1085e,'sidebar':_0x4a1bf1,'icon':_0x3f6074,'adminUrl':_0x5b011d,'agentUrl':_0x21d81d,'scriptName':_0x2cd60a,'scriptPath':_0x25da6f,'version':_0x4a30fb};removeReferences(_0x16baeb,null);return db[_0x4917('0x30')][_0x4917('0x8c')](_0x1e3187)['then'](function(_0x1b7d97){var _0x497139={'role':_0x53af0f['body'][_0x4917('0x8d')],'userProfileId':_0x53af0f['body']['userProfileId']};if(!_0x497139)throw new Error(_0x4917('0x8e'));if(_0x497139[_0x4917('0x8d')]==='user'){var _0x98f311=_0x1b7d97[_0x4917('0x2a')]({'plain':!![]});return db['UserProfileSection'][_0x4917('0x4b')]({'where':{'name':_0x4917('0x8f'),'userProfileId':_0x497139['userProfileId']},'raw':!![]})[_0x4917('0x29')](function(_0x473d1c){if(_0x473d1c&&_0x473d1c[_0x4917('0x90')]===0x0){return db['UserProfileResource']['create']({'name':_0x98f311[_0x4917('0x2e')],'resourceId':_0x98f311['id'],'type':_0x473d1c[_0x4917('0x2e')],'sectionId':_0x473d1c['id']},{})[_0x4917('0x29')](function(){return _0x1b7d97;});}else{return _0x1b7d97;}})[_0x4917('0x44')](function(_0x4e9634){logger['error'](_0x4917('0x91'),_0x4e9634);throw _0x4e9634;});}return _0x1b7d97;})[_0x4917('0x29')](respondWithResult(_0x502999,null))[_0x4917('0x44')](handleError(_0x502999,null));}});}catch(_0x24bdba){_0x502999['status'](0x1f4)[_0x4917('0x2f')](_0x24bdba);}};function removeReferences(_0x58bf7b,_0x35b49d){try{if(_0x58bf7b){fs[_0x4917('0x63')](_0x58bf7b);logger[_0x4917('0x64')](_0x4917('0x92'));}if(_0x35b49d){rimraf(_0x35b49d,function(){});logger[_0x4917('0x64')]('Extracted\x20folder\x20removed');}}catch(_0x20e01c){logger[_0x4917('0x2c')](_0x20e01c);}}exports['update']=function(_0x1b0fd7,_0x5f24f6,_0x4de241){return db['Plugin'][_0x4917('0x4b')]({'where':{'id':_0x1b0fd7['params']['id']}})['then'](handleEntityNotFound(_0x5f24f6,null))[_0x4917('0x29')](saveUpdates(_0x1b0fd7[_0x4917('0x93')],null))['then'](respondWithResult(_0x5f24f6,null))['catch'](handleError(_0x5f24f6,null));};exports[_0x4917('0x94')]=function(_0x655b89,_0x234bb4,_0x29f014){return db[_0x4917('0x30')][_0x4917('0x4b')]({'where':{'id':_0x655b89[_0x4917('0x46')]['id']}})['then'](function(_0xd4e897){if(_0xd4e897){return _0xd4e897[_0x4917('0x95')]();}})[_0x4917('0x29')](function(_0x517d65){rimraf(path[_0x4917('0x5a')](config[_0x4917('0x4d')],_0x4917('0x4e'),path[_0x4917('0x5b')](_0x517d65['path'])),function(){});return _0x517d65;})['then'](handleEntityNotFound(_0x234bb4,null))[_0x4917('0x29')](respondWithStatusCode(_0x234bb4,null))[_0x4917('0x44')](handleError(_0x234bb4,null));};exports[_0x4917('0x96')]=function(_0x181aa0,_0x4c22d5,_0x311016){return BPromise[_0x4917('0x97')]()[_0x4917('0x29')](function(){if(!_0x181aa0['query'][_0x4917('0x7')]){throw new Error(_0x4917('0x98'));}if(!_0x181aa0[_0x4917('0x39')][_0x4917('0x99')]){throw new Error(_0x4917('0x9a'));}var _0x56e785=_0x181aa0[_0x4917('0x39')][_0x4917('0x9b')]?_0x181aa0[_0x4917('0x39')][_0x4917('0x9b')]+':'+_0x181aa0[_0x4917('0x39')][_0x4917('0x99')]:_0x4917('0x9c')+_0x181aa0['query'][_0x4917('0x99')];var _0x14ceab=_0x181aa0[_0x4917('0x39')][_0x4917('0x22')]?_0x181aa0[_0x4917('0x39')]['json']:!![];var _0x4c9dcc=_0x181aa0[_0x4917('0x39')][_0x4917('0x9d')]?_0x181aa0[_0x4917('0x39')][_0x4917('0x9d')]:null;var _0x3ac8a1={'method':_0x181aa0[_0x4917('0x9e')],'uri':util[_0x4917('0x61')]('%s%s',_0x56e785,_0x181aa0[_0x4917('0x39')][_0x4917('0x7')]),'json':_0x14ceab,'resolveWithFullResponse':!![],'encoding':_0x4c9dcc,'qs':_0x181aa0['query']};if(_0x181aa0[_0x4917('0x9f')]){_0x3ac8a1[_0x4917('0x9f')]=_0x181aa0[_0x4917('0x9f')];if(_0x3ac8a1[_0x4917('0x9f')][_0x4917('0xa0')]){delete _0x3ac8a1[_0x4917('0x9f')][_0x4917('0xa0')];}}if(_0x3ac8a1[_0x4917('0x9f')]['content-type']){delete _0x3ac8a1[_0x4917('0x9f')][_0x4917('0xa1')];}return rp(_0x3ac8a1);})[_0x4917('0x29')](function(_0x473843){if(_0x473843){_0x4c22d5['set'](_0x473843[_0x4917('0x9f')]);logger[_0x4917('0x64')](_0x473843[_0x4917('0x93')]);if(_[_0x4917('0xa2')](_0x181aa0[_0x4917('0x39')][_0x4917('0x7')],_0x4917('0x4c'))&&_0x473843[_0x4917('0xa3')]==0x1f4){return _0x4c22d5[_0x4917('0x1f')](_0x473843['statusCode']);}else{return _0x4c22d5[_0x4917('0x21')](_0x473843['statusCode'])[_0x4917('0x2f')](_0x473843['body']);}}else{return _0x4c22d5[_0x4917('0x1f')](0xc8);}})[_0x4917('0x44')](handleError(_0x4c22d5,null));};exports[_0x4917('0xa4')]=function(_0x4ca69d,_0x45580c,_0x45e866){return BPromise[_0x4917('0x97')]()[_0x4917('0x29')](function(){if(!_0x4ca69d[_0x4917('0x39')][_0x4917('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x4ca69d[_0x4917('0x39')][_0x4917('0x99')]){throw new Error(_0x4917('0x9a'));}var _0x1a3559=_0x4ca69d[_0x4917('0x39')][_0x4917('0x9b')]?_0x4ca69d[_0x4917('0x39')]['hostname']+':'+_0x4ca69d[_0x4917('0x39')][_0x4917('0x99')]:'http://localhost:'+_0x4ca69d[_0x4917('0x39')][_0x4917('0x99')];var _0x453ee1=_0x4ca69d[_0x4917('0x39')][_0x4917('0x22')]?_0x4ca69d[_0x4917('0x39')][_0x4917('0x22')]:!![];var _0x56595b=_0x4ca69d[_0x4917('0x39')][_0x4917('0x9d')]?_0x4ca69d[_0x4917('0x39')][_0x4917('0x9d')]:null;var _0x518bc8={'method':_0x4ca69d[_0x4917('0x9e')],'uri':util[_0x4917('0x61')](_0x4917('0xa5'),_0x1a3559,_0x4ca69d[_0x4917('0x39')][_0x4917('0x7')]),'json':_0x453ee1,'resolveWithFullResponse':!![],'encoding':_0x56595b,'body':_0x4ca69d['body']};if(_0x4ca69d[_0x4917('0x9f')]){_0x518bc8[_0x4917('0x9f')]=_0x4ca69d[_0x4917('0x9f')];if(_0x518bc8[_0x4917('0x9f')][_0x4917('0xa0')]){delete _0x518bc8[_0x4917('0x9f')][_0x4917('0xa0')];}}if(_0x518bc8[_0x4917('0x9f')][_0x4917('0xa1')]){delete _0x518bc8[_0x4917('0x9f')]['content-type'];}return rp(_0x518bc8);})[_0x4917('0x29')](function(_0x424b46){if(_0x424b46){_0x45580c[_0x4917('0x26')](_0x424b46['headers']);logger[_0x4917('0x64')](_0x424b46['body']);return _0x45580c[_0x4917('0x21')](_0x424b46[_0x4917('0xa3')])[_0x4917('0x2f')](_0x424b46['body']);}else{return _0x45580c[_0x4917('0x1f')](0xc8);}})[_0x4917('0x44')](handleError(_0x45580c,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index b4da604..e66fbb1 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 _0x4888=['emit','hasOwnProperty','hook','../../mysqldb','Plugin','setMaxListeners','save','update','remove'];(function(_0x2dd752,_0x59b4fc){var _0x297823=function(_0x44a37f){while(--_0x44a37f){_0x2dd752['push'](_0x2dd752['shift']());}};_0x297823(++_0x59b4fc);}(_0x4888,0x198));var _0x8488=function(_0x36199a,_0x4f756c){_0x36199a=_0x36199a-0x0;var _0x5b36f1=_0x4888[_0x36199a];return _0x5b36f1;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x8488('0x0'))['db'][_0x8488('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x8488('0x2')](0x0);var events={'afterCreate':_0x8488('0x3'),'afterUpdate':_0x8488('0x4'),'afterDestroy':_0x8488('0x5')};function emitEvent(_0x19e51d){return function(_0x571e4b,_0x267093,_0xf45c3f){PluginEvents[_0x8488('0x6')](_0x19e51d+':'+_0x571e4b['id'],_0x571e4b);PluginEvents[_0x8488('0x6')](_0x19e51d,_0x571e4b);_0xf45c3f(null);};}for(var e in events){if(events[_0x8488('0x7')](e)){var event=events[e];Plugin[_0x8488('0x8')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0xdf55=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x107b7a,_0x251df1){var _0x2917cd=function(_0x3e8996){while(--_0x3e8996){_0x107b7a['push'](_0x107b7a['shift']());}};_0x2917cd(++_0x251df1);}(_0xdf55,0x83));var _0x5df5=function(_0x283952,_0x442596){_0x283952=_0x283952-0x0;var _0x57bb99=_0xdf55[_0x283952];return _0x57bb99;};'use strict';var EventEmitter=require(_0x5df5('0x0'));var Plugin=require(_0x5df5('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x5df5('0x2')](0x0);var events={'afterCreate':_0x5df5('0x3'),'afterUpdate':'update','afterDestroy':_0x5df5('0x4')};function emitEvent(_0x773e15){return function(_0x381a4c,_0x521007,_0x289af4){PluginEvents[_0x5df5('0x5')](_0x773e15+':'+_0x381a4c['id'],_0x381a4c);PluginEvents[_0x5df5('0x5')](_0x773e15,_0x381a4c);_0x289af4(null);};}for(var e in events){if(events[_0x5df5('0x6')](e)){var event=events[e];Plugin[_0x5df5('0x7')](e,emitEvent(event));}}module[_0x5df5('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 57547c3..f06ce6d 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 _0x2d17=['define','plugins','lodash','util','api','moment','request-promise','path','../../config/environment','exports'];(function(_0x1b2efa,_0x140918){var _0x451b76=function(_0x11d0fd){while(--_0x11d0fd){_0x1b2efa['push'](_0x1b2efa['shift']());}};_0x451b76(++_0x140918);}(_0x2d17,0x17e));var _0x72d1=function(_0x389b45,_0x31d117){_0x389b45=_0x389b45-0x0;var _0x3ad29=_0x2d17[_0x389b45];return _0x3ad29;};'use strict';var _=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var logger=require('../../config/logger')(_0x72d1('0x2'));var moment=require(_0x72d1('0x3'));var BPromise=require('bluebird');var rp=require(_0x72d1('0x4'));var fs=require('fs');var path=require(_0x72d1('0x5'));var rimraf=require('rimraf');var config=require(_0x72d1('0x6'));var attributes=require('./plugin.attributes');module[_0x72d1('0x7')]=function(_0x50f551,_0x139ba0){return _0x50f551[_0x72d1('0x8')]('Plugin',attributes,{'tableName':_0x72d1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b84=['moment','path','rimraf','../../config/environment','Plugin','lodash','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4b84,0x1cc));var _0x44b8=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x4b84[_0x18ab2a];return _0x16dcee;};'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('./plugin.attributes');module['exports']=function(_0x55f25d,_0x996a8b){return _0x55f25d['define'](_0x44b8('0x6'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index a5c49c7..085ffb8 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 _0x1b01=['code','message','catch','CreatePlugin','Plugin','create','body','raw','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./plugin.socket','register','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3bdf4b,_0x3e87d6){var _0x18dc5b=function(_0x18db8f){while(--_0x18db8f){_0x3bdf4b['push'](_0x3bdf4b['shift']());}};_0x18dc5b(++_0x3e87d6);}(_0x1b01,0xc8));var _0x11b0=function(_0x13d4f8,_0x2657ef){_0x13d4f8=_0x13d4f8-0x0;var _0x424d9d=_0x1b01[_0x13d4f8];return _0x424d9d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x11b0('0x0'));var BPromise=require(_0x11b0('0x1'));var rs=require(_0x11b0('0x2'));var fs=require('fs');var Redis=require(_0x11b0('0x3'));var db=require(_0x11b0('0x4'))['db'];var utils=require(_0x11b0('0x5'));var logger=require(_0x11b0('0x6'))(_0x11b0('0x7'));var config=require(_0x11b0('0x8'));var jayson=require(_0x11b0('0x9'));var client=jayson['client'][_0x11b0('0xa')]({'port':0x232a});config[_0x11b0('0xb')]=_[_0x11b0('0xc')](config[_0x11b0('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x11b0('0xd'))(new Redis(config[_0x11b0('0xb')]));require(_0x11b0('0xe'))[_0x11b0('0xf')](socket);function respondWithRpcPromise(_0x644d5a,_0x3893be,_0x5aa251){return new BPromise(function(_0x1d1a84,_0x10730f){return client['request'](_0x644d5a,_0x5aa251)[_0x11b0('0x10')](function(_0x2afc06){logger[_0x11b0('0x11')](_0x11b0('0x12'),_0x3893be,_0x11b0('0x13'));logger[_0x11b0('0x14')](_0x11b0('0x15'),_0x3893be,'request\x20sent',JSON[_0x11b0('0x16')](_0x2afc06));if(_0x2afc06[_0x11b0('0x17')]){if(_0x2afc06[_0x11b0('0x17')][_0x11b0('0x18')]===0x1f4){logger[_0x11b0('0x17')](_0x11b0('0x12'),_0x3893be,_0x2afc06[_0x11b0('0x17')][_0x11b0('0x19')]);return _0x10730f(_0x2afc06['error'][_0x11b0('0x19')]);}logger['error']('Plugin,\x20%s,\x20%s',_0x3893be,_0x2afc06[_0x11b0('0x17')][_0x11b0('0x19')]);return _0x1d1a84(_0x2afc06[_0x11b0('0x17')][_0x11b0('0x19')]);}else{logger[_0x11b0('0x11')](_0x11b0('0x12'),_0x3893be,_0x11b0('0x13'));_0x1d1a84(_0x2afc06['result'][_0x11b0('0x19')]);}})[_0x11b0('0x1a')](function(_0x1fd10b){logger[_0x11b0('0x17')]('Plugin,\x20%s,\x20%s',_0x3893be,_0x1fd10b);_0x10730f(_0x1fd10b);});});}exports[_0x11b0('0x1b')]=function(_0x186ee5){var _0x557ea3=this;return new Promise(function(_0xb2228e,_0x44840c){return db[_0x11b0('0x1c')][_0x11b0('0x1d')](_0x186ee5[_0x11b0('0x1e')],{'raw':_0x186ee5['options']?_0x186ee5['options'][_0x11b0('0x1f')]===undefined?!![]:![]:!![]})[_0x11b0('0x10')](function(_0x238fbc){logger[_0x11b0('0x11')](_0x11b0('0x1b'),_0x186ee5);logger['debug'](_0x11b0('0x1b'),_0x186ee5,JSON[_0x11b0('0x16')](_0x238fbc));_0xb2228e(_0x238fbc);})[_0x11b0('0x1a')](function(_0x3d87bd){logger[_0x11b0('0x17')]('CreatePlugin',_0x3d87bd['message'],_0x186ee5);_0x44840c(_0x557ea3[_0x11b0('0x17')](0x1f4,_0x3d87bd[_0x11b0('0x19')]));});});}; \ No newline at end of file +var _0xe083=['redis','socket.io-emitter','./plugin.socket','register','request','then','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','Plugin,\x20%s,\x20%s','message','info','result','catch','CreatePlugin','Plugin','create','options','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults'];(function(_0x283e90,_0x154e08){var _0x53aad8=function(_0x163aeb){while(--_0x163aeb){_0x283e90['push'](_0x283e90['shift']());}};_0x53aad8(++_0x154e08);}(_0xe083,0x174));var _0x3e08=function(_0x158de2,_0x3cf71d){_0x158de2=_0x158de2-0x0;var _0x5171dc=_0xe083[_0x158de2];return _0x5171dc;};'use strict';var _=require(_0x3e08('0x0'));var util=require(_0x3e08('0x1'));var moment=require(_0x3e08('0x2'));var BPromise=require('bluebird');var rs=require(_0x3e08('0x3'));var fs=require('fs');var Redis=require(_0x3e08('0x4'));var db=require(_0x3e08('0x5'))['db'];var utils=require(_0x3e08('0x6'));var logger=require(_0x3e08('0x7'))(_0x3e08('0x8'));var config=require(_0x3e08('0x9'));var jayson=require(_0x3e08('0xa'));var client=jayson[_0x3e08('0xb')]['http']({'port':0x232a});config['redis']=_[_0x3e08('0xc')](config[_0x3e08('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x3e08('0xe'))(new Redis(config['redis']));require(_0x3e08('0xf'))[_0x3e08('0x10')](socket);function respondWithRpcPromise(_0x10c00b,_0x128910,_0x5632ca){return new BPromise(function(_0x1d32b5,_0x56c5e3){return client[_0x3e08('0x11')](_0x10c00b,_0x5632ca)[_0x3e08('0x12')](function(_0x111988){logger['info']('Plugin,\x20%s,\x20%s',_0x128910,_0x3e08('0x13'));logger[_0x3e08('0x14')](_0x3e08('0x15'),_0x128910,_0x3e08('0x13'),JSON[_0x3e08('0x16')](_0x111988));if(_0x111988[_0x3e08('0x17')]){if(_0x111988[_0x3e08('0x17')][_0x3e08('0x18')]===0x1f4){logger['error'](_0x3e08('0x19'),_0x128910,_0x111988[_0x3e08('0x17')][_0x3e08('0x1a')]);return _0x56c5e3(_0x111988[_0x3e08('0x17')][_0x3e08('0x1a')]);}logger[_0x3e08('0x17')](_0x3e08('0x19'),_0x128910,_0x111988[_0x3e08('0x17')][_0x3e08('0x1a')]);return _0x1d32b5(_0x111988['error'][_0x3e08('0x1a')]);}else{logger[_0x3e08('0x1b')]('Plugin,\x20%s,\x20%s',_0x128910,_0x3e08('0x13'));_0x1d32b5(_0x111988[_0x3e08('0x1c')][_0x3e08('0x1a')]);}})[_0x3e08('0x1d')](function(_0x4b89e1){logger[_0x3e08('0x17')](_0x3e08('0x19'),_0x128910,_0x4b89e1);_0x56c5e3(_0x4b89e1);});});}exports[_0x3e08('0x1e')]=function(_0x25cee5){var _0x3c8853=this;return new Promise(function(_0x53f510,_0x46de02){return db[_0x3e08('0x1f')][_0x3e08('0x20')](_0x25cee5['body'],{'raw':_0x25cee5['options']?_0x25cee5[_0x3e08('0x21')][_0x3e08('0x22')]===undefined?!![]:![]:!![]})[_0x3e08('0x12')](function(_0xa2af90){logger[_0x3e08('0x1b')](_0x3e08('0x1e'),_0x25cee5);logger[_0x3e08('0x14')](_0x3e08('0x1e'),_0x25cee5,JSON[_0x3e08('0x16')](_0xa2af90));_0x53f510(_0xa2af90);})[_0x3e08('0x1d')](function(_0x47970a){logger[_0x3e08('0x17')](_0x3e08('0x1e'),_0x47970a[_0x3e08('0x1a')],_0x25cee5);_0x46de02(_0x3c8853['error'](0x1f4,_0x47970a[_0x3e08('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index abd0b85..cf87a5d 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 _0x6569=['removeListener','plugin:','save','remove','emit'];(function(_0x257e65,_0x3f4a68){var _0x3eef2f=function(_0x1c61e2){while(--_0x1c61e2){_0x257e65['push'](_0x257e65['shift']());}};_0x3eef2f(++_0x3f4a68);}(_0x6569,0x129));var _0x9656=function(_0x2536d0,_0x308433){_0x2536d0=_0x2536d0-0x0;var _0x53691d=_0x6569[_0x2536d0];return _0x53691d;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x9656('0x0'),_0x9656('0x1'),'update'];function createListener(_0x1c01a0,_0x5c089e){return function(_0x108dcf){_0x5c089e[_0x9656('0x2')](_0x1c01a0,_0x108dcf);};}function removeListener(_0x3edc60,_0x5acbc0){return function(){PluginEvents[_0x9656('0x3')](_0x3edc60,_0x5acbc0);};}exports['register']=function(_0x17c46e){for(var _0x5ec825=0x0,_0x50dbeb=events['length'];_0x5ec825<_0x50dbeb;_0x5ec825++){var _0x3a08bf=events[_0x5ec825];var _0x23de68=createListener(_0x9656('0x4')+_0x3a08bf,_0x17c46e);PluginEvents['on'](_0x3a08bf,_0x23de68);}}; \ No newline at end of file +var _0x9233=['register','length','plugin:','./plugin.events','save','remove','update'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x9233,0x1a0));var _0x3923=function(_0xb19de0,_0x28572e){_0xb19de0=_0xb19de0-0x0;var _0x4d39ec=_0x9233[_0xb19de0];return _0x4d39ec;};'use strict';var PluginEvents=require(_0x3923('0x0'));var events=[_0x3923('0x1'),_0x3923('0x2'),_0x3923('0x3')];function createListener(_0x55b372,_0x434ef4){return function(_0x3d0ae6){_0x434ef4['emit'](_0x55b372,_0x3d0ae6);};}function removeListener(_0x259305,_0x9f09e0){return function(){PluginEvents['removeListener'](_0x259305,_0x9f09e0);};}exports[_0x3923('0x4')]=function(_0xd066){for(var _0x19eab0=0x0,_0x4f3117=events[_0x3923('0x5')];_0x19eab0<_0x4f3117;_0x19eab0++){var _0x43a615=events[_0x19eab0];var _0x46bdf5=createListener(_0x3923('0x6')+_0x43a615,_0xd066);PluginEvents['on'](_0x43a615,_0x46bdf5);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index cc2686e..a9eb9fc 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 _0x3dc9=['create','put','update','delete','express','Router','./pm2.controller','get','isAuthenticated','index','/:id','show'];(function(_0x454f30,_0x576cde){var _0x3c16c1=function(_0x29a727){while(--_0x29a727){_0x454f30['push'](_0x454f30['shift']());}};_0x3c16c1(++_0x576cde);}(_0x3dc9,0x94));var _0x93dc=function(_0x1aea31,_0x2c9184){_0x1aea31=_0x1aea31-0x0;var _0x2b6f52=_0x3dc9[_0x1aea31];return _0x2b6f52;};'use strict';var express=require(_0x93dc('0x0'));var router=express[_0x93dc('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x93dc('0x2'));router[_0x93dc('0x3')]('/',auth[_0x93dc('0x4')](),controller[_0x93dc('0x5')]);router['get'](_0x93dc('0x6'),auth['isAuthenticated'](),controller[_0x93dc('0x7')]);router['post']('/',auth[_0x93dc('0x4')](),controller[_0x93dc('0x8')]);router[_0x93dc('0x9')](_0x93dc('0x6'),auth['isAuthenticated'](),controller[_0x93dc('0xa')]);router[_0x93dc('0xb')](_0x93dc('0x6'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1647=['/:id','show','post','update','Router','./pm2.controller','get','isAuthenticated','index'];(function(_0x3246a6,_0x2a685a){var _0x1df64d=function(_0x4868ad){while(--_0x4868ad){_0x3246a6['push'](_0x3246a6['shift']());}};_0x1df64d(++_0x2a685a);}(_0x1647,0x1e1));var _0x7164=function(_0x4cb5ee,_0x497b9a){_0x4cb5ee=_0x4cb5ee-0x0;var _0x32cba2=_0x1647[_0x4cb5ee];return _0x32cba2;};'use strict';var express=require('express');var router=express[_0x7164('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x7164('0x1'));router[_0x7164('0x2')]('/',auth[_0x7164('0x3')](),controller[_0x7164('0x4')]);router[_0x7164('0x2')](_0x7164('0x5'),auth[_0x7164('0x3')](),controller[_0x7164('0x6')]);router[_0x7164('0x7')]('/',auth[_0x7164('0x3')](),controller['create']);router['put']('/:id',auth[_0x7164('0x3')](),controller[_0x7164('0x8')]);router['delete'](_0x7164('0x5'),auth[_0x7164('0x3')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index ae21edf..c6c9e18 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 _0xa34f=['length','then','catch','show','params','create','body','script','cwd','chdir','dirname','dump','update','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','lodash','../../config/pm2','../../config/logger','api','child_process','exec','bluebird','sendStatus','status','json','error','stack','name','send','npm\x20install','info','index','reject'];(function(_0x33d318,_0x6bd7ad){var _0x219840=function(_0x17c17a){while(--_0x17c17a){_0x33d318['push'](_0x33d318['shift']());}};_0x219840(++_0x6bd7ad);}(_0xa34f,0xcc));var _0xfa34=function(_0x5bc279,_0x2f4f84){_0x5bc279=_0x5bc279-0x0;var _0x2467eb=_0xa34f[_0x5bc279];return _0x2467eb;};'use strict';var _=require(_0xfa34('0x0'));var pm2=require(_0xfa34('0x1'));var logger=require(_0xfa34('0x2'))(_0xfa34('0x3'));var path=require('path');var exec=require(_0xfa34('0x4'))[_0xfa34('0x5')];var BPromise=require(_0xfa34('0x6'));function handleEntityNotFound(_0x68b4b,_0x5755d2){return function(_0x521b80){if(!_0x521b80){_0x68b4b[_0xfa34('0x7')](0x194);;}return _0x521b80;};}function respondWithResult(_0x3009c3,_0x5a1fbc){_0x5a1fbc=_0x5a1fbc||0xc8;return function(_0x1c4659){if(_0x1c4659){return _0x3009c3[_0xfa34('0x8')](_0x5a1fbc)[_0xfa34('0x9')](_0x1c4659);}return null;};}function handleError(_0x4f8ab0,_0x1fc995){_0x1fc995=_0x1fc995||0x1f4;return function(_0x13192e){logger[_0xfa34('0xa')](_0x13192e[_0xfa34('0xb')]);if(_0x13192e[_0xfa34('0xc')]){delete _0x13192e[_0xfa34('0xc')];}_0x4f8ab0[_0xfa34('0x8')](_0x1fc995)[_0xfa34('0xd')](_0x13192e);};}function execChildProcess(){return new BPromise(function(_0x5661fb,_0x140c49){exec(_0xfa34('0xe'),function(_0x34218c,_0x5c6a68,_0x3cb38f){logger['info'](_0x5c6a68);logger[_0xfa34('0xf')](_0x3cb38f);if(_0x34218c){logger[_0xfa34('0xa')](_0x34218c);return _0x140c49(_0x34218c);}return _0x5661fb(_0x5c6a68);});});}exports[_0xfa34('0x10')]=function(_0x13be44,_0x2380ea){return pm2['list']()['then'](function(_0x921276){if(_0x921276){var _0x156c22=_[_0xfa34('0x11')](_0x921276,function(_0x3cab8b){return _0x3cab8b[_0xfa34('0xc')]==='express'||_0x3cab8b[_0xfa34('0xc')]==='motion2';});return{'rows':_0x156c22,'count':_0x156c22[_0xfa34('0x12')]};}return null;})[_0xfa34('0x13')](respondWithResult(_0x2380ea,null))[_0xfa34('0x14')](handleError(_0x2380ea,null));};exports[_0xfa34('0x15')]=function(_0x572403,_0x7127a6){return pm2['describe'](_0x572403[_0xfa34('0x16')]['id'])[_0xfa34('0x13')](respondWithResult(_0x7127a6,null))['then'](handleEntityNotFound(_0x7127a6,null))[_0xfa34('0x14')](handleError(_0x7127a6,null));};exports[_0xfa34('0x17')]=function(_0x329ee8,_0x142cd8){if(_0x329ee8[_0xfa34('0x18')][_0xfa34('0xc')]&&_0x329ee8[_0xfa34('0x18')]['script']){var _0x47377a=path['join'](__dirname,'../../files/plugins',_0x329ee8[_0xfa34('0x18')][_0xfa34('0x19')]);var _0x57746=process[_0xfa34('0x1a')]();process[_0xfa34('0x1b')](path[_0xfa34('0x1c')](_0x47377a));return execChildProcess()[_0xfa34('0x13')](function(_0x2a2f71){process[_0xfa34('0x1b')](_0x57746);return pm2['start']({'name':_0x329ee8[_0xfa34('0x18')][_0xfa34('0xc')],'script':_0x47377a});})[_0xfa34('0x13')](function(_0x5647ac){pm2[_0xfa34('0x1d')]();return _0x5647ac[0x0];})[_0xfa34('0x13')](respondWithResult(_0x142cd8,0xc9))[_0xfa34('0x14')](handleError(_0x142cd8,null));}else{return _0x142cd8[_0xfa34('0x8')](0x1f4)['send']({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0xfa34('0x1e')]=function(_0x52b131,_0x1ca9eb){if(_0x52b131[_0xfa34('0x18')]['id']){delete _0x52b131[_0xfa34('0x18')]['id'];}var _0x4de973={'online':_0xfa34('0x1f'),'stopped':_0xfa34('0x20')};if(_0x4de973[_0xfa34('0x21')](_0x52b131['body'][_0xfa34('0x8')])){return pm2[_0x4de973[_0x52b131[_0xfa34('0x18')][_0xfa34('0x8')]]](_0x52b131[_0xfa34('0x16')]['id'])[_0xfa34('0x13')](respondWithResult(_0x1ca9eb,0xc8))[_0xfa34('0x14')](handleError(_0x1ca9eb,null));}else{return _0x1ca9eb['status'](0x1f4)[_0xfa34('0xd')]({'message':_0xfa34('0x22')});}};exports[_0xfa34('0x23')]=function(_0x14e036,_0x133137){if(_0x14e036[_0xfa34('0x18')]['id']){delete _0x14e036[_0xfa34('0x18')]['id'];}if(_0x14e036['params']['id']){return pm2[_0xfa34('0x24')](_0x14e036['params']['id'])[_0xfa34('0x13')](function(_0x418961){pm2[_0xfa34('0x1d')]();return _0x418961[0x0];})[_0xfa34('0x13')](respondWithResult(_0x133137,null))[_0xfa34('0x14')](handleError(_0x133137,null));}else{return _0x133137['status'](0x1f4)[_0xfa34('0xd')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0x84f0=['list','reject','motion2','length','then','catch','show','describe','params','create','body','script','join','../../files/plugins','cwd','chdir','start','dump','Missing\x20name\x20and/or\x20path','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','child_process','exec','bluebird','status','json','stack','name','send','info','error'];(function(_0x125aeb,_0x29238c){var _0x35d4b8=function(_0xde4166){while(--_0xde4166){_0x125aeb['push'](_0x125aeb['shift']());}};_0x35d4b8(++_0x29238c);}(_0x84f0,0x132));var _0x084f=function(_0x243869,_0x18bf48){_0x243869=_0x243869-0x0;var _0x1173f1=_0x84f0[_0x243869];return _0x1173f1;};'use strict';var _=require(_0x084f('0x0'));var pm2=require(_0x084f('0x1'));var logger=require(_0x084f('0x2'))(_0x084f('0x3'));var path=require('path');var exec=require(_0x084f('0x4'))[_0x084f('0x5')];var BPromise=require(_0x084f('0x6'));function handleEntityNotFound(_0x139aeb,_0x17c446){return function(_0x1e6953){if(!_0x1e6953){_0x139aeb['sendStatus'](0x194);;}return _0x1e6953;};}function respondWithResult(_0x544b8a,_0xb6907){_0xb6907=_0xb6907||0xc8;return function(_0x2ba965){if(_0x2ba965){return _0x544b8a[_0x084f('0x7')](_0xb6907)[_0x084f('0x8')](_0x2ba965);}return null;};}function handleError(_0x5f2793,_0x405f33){_0x405f33=_0x405f33||0x1f4;return function(_0x412ca3){logger['error'](_0x412ca3[_0x084f('0x9')]);if(_0x412ca3[_0x084f('0xa')]){delete _0x412ca3[_0x084f('0xa')];}_0x5f2793[_0x084f('0x7')](_0x405f33)[_0x084f('0xb')](_0x412ca3);};}function execChildProcess(){return new BPromise(function(_0x145e28,_0xde14d8){exec('npm\x20install',function(_0x15c94a,_0x2bf68c,_0x1e101c){logger[_0x084f('0xc')](_0x2bf68c);logger[_0x084f('0xc')](_0x1e101c);if(_0x15c94a){logger[_0x084f('0xd')](_0x15c94a);return _0xde14d8(_0x15c94a);}return _0x145e28(_0x2bf68c);});});}exports['index']=function(_0x3dd3eb,_0x375fda){return pm2[_0x084f('0xe')]()['then'](function(_0x4a0089){if(_0x4a0089){var _0x185983=_[_0x084f('0xf')](_0x4a0089,function(_0x582d91){return _0x582d91[_0x084f('0xa')]==='express'||_0x582d91['name']===_0x084f('0x10');});return{'rows':_0x185983,'count':_0x185983[_0x084f('0x11')]};}return null;})[_0x084f('0x12')](respondWithResult(_0x375fda,null))[_0x084f('0x13')](handleError(_0x375fda,null));};exports[_0x084f('0x14')]=function(_0x3311ca,_0xd67ed1){return pm2[_0x084f('0x15')](_0x3311ca[_0x084f('0x16')]['id'])[_0x084f('0x12')](respondWithResult(_0xd67ed1,null))[_0x084f('0x12')](handleEntityNotFound(_0xd67ed1,null))['catch'](handleError(_0xd67ed1,null));};exports[_0x084f('0x17')]=function(_0x18408f,_0x47371b){if(_0x18408f['body'][_0x084f('0xa')]&&_0x18408f[_0x084f('0x18')][_0x084f('0x19')]){var _0x46c5e5=path[_0x084f('0x1a')](__dirname,_0x084f('0x1b'),_0x18408f[_0x084f('0x18')]['script']);var _0x2f95e2=process[_0x084f('0x1c')]();process[_0x084f('0x1d')](path['dirname'](_0x46c5e5));return execChildProcess()[_0x084f('0x12')](function(_0x3f4e40){process[_0x084f('0x1d')](_0x2f95e2);return pm2[_0x084f('0x1e')]({'name':_0x18408f[_0x084f('0x18')]['name'],'script':_0x46c5e5});})[_0x084f('0x12')](function(_0x24a17b){pm2[_0x084f('0x1f')]();return _0x24a17b[0x0];})['then'](respondWithResult(_0x47371b,0xc9))['catch'](handleError(_0x47371b,null));}else{return _0x47371b[_0x084f('0x7')](0x1f4)['send']({'message':_0x084f('0x20')});}};exports['update']=function(_0x487630,_0x4eada8){if(_0x487630[_0x084f('0x18')]['id']){delete _0x487630['body']['id'];}var _0x3d3bfc={'online':_0x084f('0x21'),'stopped':_0x084f('0x22')};if(_0x3d3bfc[_0x084f('0x23')](_0x487630[_0x084f('0x18')]['status'])){return pm2[_0x3d3bfc[_0x487630[_0x084f('0x18')][_0x084f('0x7')]]](_0x487630['params']['id'])['then'](respondWithResult(_0x4eada8,0xc8))[_0x084f('0x13')](handleError(_0x4eada8,null));}else{return _0x4eada8['status'](0x1f4)[_0x084f('0xb')]({'message':_0x084f('0x24')});}};exports[_0x084f('0x25')]=function(_0x520185,_0x3e4c7c){if(_0x520185[_0x084f('0x18')]['id']){delete _0x520185[_0x084f('0x18')]['id'];}if(_0x520185[_0x084f('0x16')]['id']){return pm2[_0x084f('0x26')](_0x520185[_0x084f('0x16')]['id'])[_0x084f('0x12')](function(_0x2e5636){pm2['dump']();return _0x2e5636[0x0];})[_0x084f('0x12')](respondWithResult(_0x3e4c7c,null))[_0x084f('0x13')](handleError(_0x3e4c7c,null));}else{return _0x3e4c7c['status'](0x1f4)[_0x084f('0xb')]({'message':_0x084f('0x27')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 6facaac..b6843ef 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 _0x35ba=['connect-timeout','express','Router','../../config/environment','multer','util','path'];(function(_0x2d4e29,_0x507c12){var _0x3e6792=function(_0x274685){while(--_0x274685){_0x2d4e29['push'](_0x2d4e29['shift']());}};_0x3e6792(++_0x507c12);}(_0x35ba,0x19a));var _0xa35b=function(_0x1ec7b0,_0x2eb52a){_0x1ec7b0=_0x1ec7b0-0x0;var _0x5aff54=_0x35ba[_0x1ec7b0];return _0x5aff54;};'use strict';var multer=require(_0xa35b('0x0'));var util=require(_0xa35b('0x1'));var path=require(_0xa35b('0x2'));var timeout=require(_0xa35b('0x3'));var express=require(_0xa35b('0x4'));var router=express[_0xa35b('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa35b('0x6'));module['exports']=router; \ No newline at end of file +var _0x816f=['../../components/interaction/service','util','path','connect-timeout','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x816f,0x1af));var _0xf816=function(_0x1362e7,_0x8f4ed2){_0x1362e7=_0x1362e7-0x0;var _0x184bf0=_0x816f[_0x1362e7];return _0x184bf0;};'use strict';var multer=require('multer');var util=require(_0xf816('0x0'));var path=require(_0xf816('0x1'));var timeout=require(_0xf816('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xf816('0x3'));var interaction=require(_0xf816('0x4'));var config=require('../../config/environment');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 f2ef5c6..ba66661 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 _0x8eaf=['DATE','sequelize','exports','INTEGER','STRING'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x8eaf,0x182));var _0xf8ea=function(_0x404458,_0x320912){_0x404458=_0x404458-0x0;var _0x5313c9=_0x8eaf[_0x404458];return _0x5313c9;};'use strict';var Sequelize=require(_0xf8ea('0x0'));module[_0xf8ea('0x1')]={'state':{'type':Sequelize[_0xf8ea('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xf8ea('0x3')]},'scheduledat':{'type':Sequelize[_0xf8ea('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xf8ea('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xf8ea('0x3')]},'campaigntype':{'type':Sequelize[_0xf8ea('0x3')]},'membername':{'type':Sequelize[_0xf8ea('0x3')]}}; \ No newline at end of file +var _0xe5be=['STRING','sequelize','exports','INTEGER'];(function(_0x2bb19a,_0x3cde55){var _0x6f236c=function(_0x3483f1){while(--_0x3483f1){_0x2bb19a['push'](_0x2bb19a['shift']());}};_0x6f236c(++_0x3cde55);}(_0xe5be,0x179));var _0xee5b=function(_0x57e71a,_0x62c8e2){_0x57e71a=_0x57e71a-0x0;var _0x499942=_0xe5be[_0x57e71a];return _0x499942;};'use strict';var Sequelize=require(_0xee5b('0x0'));module[_0xee5b('0x1')]={'state':{'type':Sequelize[_0xee5b('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xee5b('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xee5b('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xee5b('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xee5b('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index adfdd89..40abc3a 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 _0xf224=['report_agent_preview','lodash','../../config/logger','api','bluebird','path','../../config/environment','exports','define','ReportAgentPreview'];(function(_0x539855,_0x2276cc){var _0x545af4=function(_0x3c3ac6){while(--_0x3c3ac6){_0x539855['push'](_0x539855['shift']());}};_0x545af4(++_0x2276cc);}(_0xf224,0xdd));var _0x4f22=function(_0x58829e,_0xcf066a){_0x58829e=_0x58829e-0x0;var _0x27faba=_0xf224[_0x58829e];return _0x27faba;};'use strict';var _=require(_0x4f22('0x0'));var util=require('util');var logger=require(_0x4f22('0x1'))(_0x4f22('0x2'));var moment=require('moment');var BPromise=require(_0x4f22('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f22('0x4'));var rimraf=require('rimraf');var config=require(_0x4f22('0x5'));var attributes=require('./reportAgentPreview.attributes');module[_0x4f22('0x6')]=function(_0x1cf89a,_0x166c33){return _0x1cf89a[_0x4f22('0x7')](_0x4f22('0x8'),attributes,{'tableName':_0x4f22('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f39=['./reportAgentPreview.attributes','exports','define','report_agent_preview','lodash','api','moment','bluebird','path','../../config/environment'];(function(_0x478094,_0x3145b3){var _0x57cff8=function(_0x596962){while(--_0x596962){_0x478094['push'](_0x478094['shift']());}};_0x57cff8(++_0x3145b3);}(_0x6f39,0xea));var _0x96f3=function(_0x50cfc3,_0x526cc6){_0x50cfc3=_0x50cfc3-0x0;var _0x5c11ef=_0x6f39[_0x50cfc3];return _0x5c11ef;};'use strict';var _=require(_0x96f3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x96f3('0x1'));var moment=require(_0x96f3('0x2'));var BPromise=require(_0x96f3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x96f3('0x4'));var rimraf=require('rimraf');var config=require(_0x96f3('0x5'));var attributes=require(_0x96f3('0x6'));module[_0x96f3('0x7')]=function(_0x574b77,_0x2f911e){return _0x574b77[_0x96f3('0x8')]('ReportAgentPreview',attributes,{'tableName':_0x96f3('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 3ec0500..988837a 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 _0x536d=['then','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ReportAgentPreview','create','options','raw','CreateReportAgentPreview','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x591f7b,_0x1e1cd1){var _0x21a460=function(_0x4c7888){while(--_0x4c7888){_0x591f7b['push'](_0x591f7b['shift']());}};_0x21a460(++_0x1e1cd1);}(_0x536d,0xe2));var _0xd536=function(_0x2e23c1,_0xde9a8b){_0x2e23c1=_0x2e23c1-0x0;var _0x564041=_0x536d[_0x2e23c1];return _0x564041;};'use strict';var _=require(_0xd536('0x0'));var util=require(_0xd536('0x1'));var moment=require(_0xd536('0x2'));var BPromise=require(_0xd536('0x3'));var rs=require(_0xd536('0x4'));var fs=require('fs');var Redis=require(_0xd536('0x5'));var db=require(_0xd536('0x6'))['db'];var utils=require(_0xd536('0x7'));var logger=require(_0xd536('0x8'))('rpc');var config=require(_0xd536('0x9'));var jayson=require(_0xd536('0xa'));var client=jayson[_0xd536('0xb')][_0xd536('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5af02d,_0x30365d,_0x52f311){return new BPromise(function(_0x1a9766,_0x125b58){return client[_0xd536('0xd')](_0x5af02d,_0x52f311)[_0xd536('0xe')](function(_0x35a856){logger['info'](_0xd536('0xf'),_0x30365d,'request\x20sent');logger[_0xd536('0x10')](_0xd536('0x11'),_0x30365d,'request\x20sent',JSON[_0xd536('0x12')](_0x35a856));if(_0x35a856[_0xd536('0x13')]){if(_0x35a856[_0xd536('0x13')][_0xd536('0x14')]===0x1f4){logger['error'](_0xd536('0xf'),_0x30365d,_0x35a856['error'][_0xd536('0x15')]);return _0x125b58(_0x35a856['error'][_0xd536('0x15')]);}logger['error'](_0xd536('0xf'),_0x30365d,_0x35a856[_0xd536('0x13')]['message']);return _0x1a9766(_0x35a856[_0xd536('0x13')]['message']);}else{logger[_0xd536('0x16')]('ReportAgentPreview,\x20%s,\x20%s',_0x30365d,'request\x20sent');_0x1a9766(_0x35a856[_0xd536('0x17')][_0xd536('0x15')]);}})[_0xd536('0x18')](function(_0xc86292){logger['error'](_0xd536('0xf'),_0x30365d,_0xc86292);_0x125b58(_0xc86292);});});}exports['CreateReportAgentPreview']=function(_0x28955a){var _0x98d776=this;return new Promise(function(_0x322ebf,_0x248126){return db[_0xd536('0x19')][_0xd536('0x1a')](_0x28955a['body'],{'raw':_0x28955a[_0xd536('0x1b')]?_0x28955a['options'][_0xd536('0x1c')]===undefined?!![]:![]:!![]})[_0xd536('0xe')](function(_0x4413c7){logger['info']('CreateReportAgentPreview',_0x28955a);logger[_0xd536('0x10')](_0xd536('0x1d'),_0x28955a,JSON[_0xd536('0x12')](_0x4413c7));_0x322ebf(_0x4413c7);})[_0xd536('0x18')](function(_0x5df121){logger['error'](_0xd536('0x1d'),_0x5df121['message'],_0x28955a);_0x248126(_0x98d776[_0xd536('0x13')](0x1f4,_0x5df121['message']));});});}; \ No newline at end of file +var _0x8a83=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ReportAgentPreview,\x20%s,\x20%s','message','info','catch','ReportAgentPreview','create','body','options','CreateReportAgentPreview','debug','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x26da15,_0x43252d){var _0x263987=function(_0xd619a5){while(--_0xd619a5){_0x26da15['push'](_0x26da15['shift']());}};_0x263987(++_0x43252d);}(_0x8a83,0x173));var _0x38a8=function(_0x59e821,_0x86c723){_0x59e821=_0x59e821-0x0;var _0x5333f6=_0x8a83[_0x59e821];return _0x5333f6;};'use strict';var _=require(_0x38a8('0x0'));var util=require(_0x38a8('0x1'));var moment=require(_0x38a8('0x2'));var BPromise=require(_0x38a8('0x3'));var rs=require(_0x38a8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x38a8('0x5'))['db'];var utils=require(_0x38a8('0x6'));var logger=require(_0x38a8('0x7'))(_0x38a8('0x8'));var config=require(_0x38a8('0x9'));var jayson=require(_0x38a8('0xa'));var client=jayson['client'][_0x38a8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x26950a,_0x58432b,_0x5f42a1){return new BPromise(function(_0x2822e8,_0x196137){return client[_0x38a8('0xc')](_0x26950a,_0x5f42a1)[_0x38a8('0xd')](function(_0x3bc5cf){logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x58432b,'request\x20sent');logger['debug'](_0x38a8('0xe'),_0x58432b,_0x38a8('0xf'),JSON['stringify'](_0x3bc5cf));if(_0x3bc5cf[_0x38a8('0x10')]){if(_0x3bc5cf[_0x38a8('0x10')][_0x38a8('0x11')]===0x1f4){logger['error'](_0x38a8('0x12'),_0x58432b,_0x3bc5cf[_0x38a8('0x10')][_0x38a8('0x13')]);return _0x196137(_0x3bc5cf['error']['message']);}logger[_0x38a8('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x58432b,_0x3bc5cf[_0x38a8('0x10')]['message']);return _0x2822e8(_0x3bc5cf['error'][_0x38a8('0x13')]);}else{logger[_0x38a8('0x14')]('ReportAgentPreview,\x20%s,\x20%s',_0x58432b,_0x38a8('0xf'));_0x2822e8(_0x3bc5cf['result']['message']);}})[_0x38a8('0x15')](function(_0x376ffc){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x58432b,_0x376ffc);_0x196137(_0x376ffc);});});}exports['CreateReportAgentPreview']=function(_0x4cab60){var _0x532bc0=this;return new Promise(function(_0x4ab425,_0x5acc49){return db[_0x38a8('0x16')][_0x38a8('0x17')](_0x4cab60[_0x38a8('0x18')],{'raw':_0x4cab60[_0x38a8('0x19')]?_0x4cab60[_0x38a8('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x38a8('0xd')](function(_0x5bc693){logger[_0x38a8('0x14')](_0x38a8('0x1a'),_0x4cab60);logger[_0x38a8('0x1b')]('CreateReportAgentPreview',_0x4cab60,JSON[_0x38a8('0x1c')](_0x5bc693));_0x4ab425(_0x5bc693);})['catch'](function(_0x2a33bd){logger[_0x38a8('0x10')](_0x38a8('0x1a'),_0x2a33bd[_0x38a8('0x13')],_0x4cab60);_0x5acc49(_0x532bc0[_0x38a8('0x10')](0x1f4,_0x2a33bd[_0x38a8('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index e2be831..34506d7 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 _0xce31=['post','queueNotify','mail','chat','showChatQueues','/fax/queues/:id/notify','fax','showFaxQueues','/openchannel/queues/:id/notify','showOpenchannelQueues','sms','/agents/:id/notify','agentNotify','exports','multer','util','express','Router','../../components/auth/service','./rpc.controller','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','voiceChannelStopMixMonitor','get','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','/voice/queues/channels/:uniqueid','voiceQueuesChannelRedirect','/voice/queues/:id','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','put','/agents/:id/capacity','agentCapacity','/telephones','telephones','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','smsQueuesWaitingInteractions','/fax/queues/waitinginteractions'];(function(_0x587a80,_0x4b0de4){var _0x35926d=function(_0x11dce1){while(--_0x11dce1){_0x587a80['push'](_0x587a80['shift']());}};_0x35926d(++_0x4b0de4);}(_0xce31,0x1d5));var _0x1ce3=function(_0x252bb8,_0x23f657){_0x252bb8=_0x252bb8-0x0;var _0x21da54=_0xce31[_0x252bb8];return _0x21da54;};'use strict';var multer=require(_0x1ce3('0x0'));var util=require(_0x1ce3('0x1'));var path=require('path');var express=require(_0x1ce3('0x2'));var router=express[_0x1ce3('0x3')]();var auth=require(_0x1ce3('0x4'));var controller=require(_0x1ce3('0x5'));router['get']('/voice/channels',auth[_0x1ce3('0x6')](),controller[_0x1ce3('0x7')]);router['get'](_0x1ce3('0x8'),auth['isAuthenticated'](),controller[_0x1ce3('0x9')]);router['get']('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x1ce3('0x6')](),controller[_0x1ce3('0xa')]);router[_0x1ce3('0xb')](_0x1ce3('0xc'),auth[_0x1ce3('0x6')](),controller[_0x1ce3('0xd')]);router[_0x1ce3('0xb')](_0x1ce3('0xe'),auth[_0x1ce3('0x6')](),controller[_0x1ce3('0xf')]);router[_0x1ce3('0xb')](_0x1ce3('0x10'),auth[_0x1ce3('0x6')](),controller[_0x1ce3('0x11')]);router['get'](_0x1ce3('0x12'),auth[_0x1ce3('0x6')](),controller[_0x1ce3('0x13')]);router[_0x1ce3('0xb')](_0x1ce3('0x14'),auth['isAuthenticated'](),controller[_0x1ce3('0x15')]);router[_0x1ce3('0xb')](_0x1ce3('0x16'),auth[_0x1ce3('0x6')](),controller[_0x1ce3('0x17')]);router[_0x1ce3('0xb')](_0x1ce3('0x18'),auth['isAuthenticated'](),controller[_0x1ce3('0x19')]);router[_0x1ce3('0xb')](_0x1ce3('0x1a'),auth[_0x1ce3('0x6')](),controller['voiceQueuesPreview']);router[_0x1ce3('0xb')](_0x1ce3('0x1b'),auth[_0x1ce3('0x6')](),controller['voiceQueuesChannels']);router[_0x1ce3('0xb')](_0x1ce3('0x1c'),auth['isAuthenticated'](),controller['voiceQueuesChannel']);router[_0x1ce3('0xb')]('/voice/queues/channels/:uniqueid/hangup',auth[_0x1ce3('0x6')](),controller['voiceQueuesChannelHangup']);router[_0x1ce3('0xb')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x1ce3('0x6')](),controller[_0x1ce3('0x1d')]);router[_0x1ce3('0xb')](_0x1ce3('0x1e'),auth[_0x1ce3('0x6')](),controller['showVoiceQueues']);router[_0x1ce3('0xb')](_0x1ce3('0x1f'),auth['isAuthenticated'](),controller[_0x1ce3('0x20')]);router[_0x1ce3('0xb')](_0x1ce3('0x21'),auth[_0x1ce3('0x6')](),controller[_0x1ce3('0x22')]);router[_0x1ce3('0xb')](_0x1ce3('0x23'),auth[_0x1ce3('0x6')](),controller[_0x1ce3('0x24')]);router[_0x1ce3('0x25')](_0x1ce3('0x26'),auth[_0x1ce3('0x6')](),controller[_0x1ce3('0x27')]);router[_0x1ce3('0xb')](_0x1ce3('0x28'),auth['isAuthenticated'](),controller[_0x1ce3('0x29')]);router[_0x1ce3('0xb')]('/trunks',auth[_0x1ce3('0x6')](),controller[_0x1ce3('0x2a')]);router[_0x1ce3('0xb')](_0x1ce3('0x2b'),auth[_0x1ce3('0x6')](),controller[_0x1ce3('0x2c')]);router[_0x1ce3('0xb')](_0x1ce3('0x2d'),auth[_0x1ce3('0x6')](),controller[_0x1ce3('0x2e')]);router[_0x1ce3('0xb')]('/chat/queues/waitinginteractions',auth['isAuthenticated'](),controller['chatQueuesWaitingInteractions']);router[_0x1ce3('0xb')](_0x1ce3('0x2f'),auth[_0x1ce3('0x6')](),controller['mailQueuesWaitingInteractions']);router[_0x1ce3('0xb')](_0x1ce3('0x30'),auth[_0x1ce3('0x6')](),controller['openchannelQueuesWaitingInteractions']);router[_0x1ce3('0xb')]('/sms/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x1ce3('0x31')]);router[_0x1ce3('0xb')](_0x1ce3('0x32'),auth[_0x1ce3('0x6')](),controller['faxQueuesWaitingInteractions']);router[_0x1ce3('0x33')]('/mail/queues/:id/notify',auth[_0x1ce3('0x6')](),controller[_0x1ce3('0x34')](_0x1ce3('0x35')));router['get']('/mail/queues/:id',auth[_0x1ce3('0x6')](),controller['showMailQueues']);router[_0x1ce3('0x33')]('/chat/queues/:id/notify',auth[_0x1ce3('0x6')](),controller[_0x1ce3('0x34')](_0x1ce3('0x36')));router['get']('/chat/queues/:id',auth[_0x1ce3('0x6')](),controller[_0x1ce3('0x37')]);router[_0x1ce3('0x33')](_0x1ce3('0x38'),auth['isAuthenticated'](),controller[_0x1ce3('0x34')](_0x1ce3('0x39')));router['get']('/fax/queues/:id',auth[_0x1ce3('0x6')](),controller[_0x1ce3('0x3a')]);router[_0x1ce3('0x33')](_0x1ce3('0x3b'),auth[_0x1ce3('0x6')](),controller['queueNotify']('openchannel'));router[_0x1ce3('0xb')]('/openchannel/queues/:id',auth[_0x1ce3('0x6')](),controller[_0x1ce3('0x3c')]);router['post']('/sms/queues/:id/notify',auth['isAuthenticated'](),controller[_0x1ce3('0x34')](_0x1ce3('0x3d')));router['get']('/sms/queues/:id',auth[_0x1ce3('0x6')](),controller['showSmsQueues']);router[_0x1ce3('0x33')](_0x1ce3('0x3e'),auth['isAuthenticated'](),controller[_0x1ce3('0x3f')]);module[_0x1ce3('0x40')]=router; \ No newline at end of file +var _0x86bc=['/fax/accounts','faxAccounts','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','queueNotify','showChatQueues','fax','showFaxQueues','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','sms','showSmsQueues','/agents/:id/notify','agentNotify','exports','multer','path','express','Router','../../components/auth/service','./rpc.controller','get','voiceChannels','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','isAuthenticated','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','openchannelQueues','/sms/queues','smsQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','showVoiceQueues','/outbound','outbound','/outbound/channels','/agents','agents','put','agentCapacity','/telephones','/trunks','trunks','/campaigns','campaigns'];(function(_0x1e6509,_0x181af6){var _0x1f9b28=function(_0x5557e2){while(--_0x5557e2){_0x1e6509['push'](_0x1e6509['shift']());}};_0x1f9b28(++_0x181af6);}(_0x86bc,0x1b1));var _0xc86b=function(_0x35b17e,_0xb17617){_0x35b17e=_0x35b17e-0x0;var _0x54ae4f=_0x86bc[_0x35b17e];return _0x54ae4f;};'use strict';var multer=require(_0xc86b('0x0'));var util=require('util');var path=require(_0xc86b('0x1'));var express=require(_0xc86b('0x2'));var router=express[_0xc86b('0x3')]();var auth=require(_0xc86b('0x4'));var controller=require(_0xc86b('0x5'));router[_0xc86b('0x6')]('/voice/channels',auth['isAuthenticated'](),controller[_0xc86b('0x7')]);router['get'](_0xc86b('0x8'),auth['isAuthenticated'](),controller['voiceChannelMixMonitor']);router[_0xc86b('0x6')](_0xc86b('0x9'),auth[_0xc86b('0xa')](),controller[_0xc86b('0xb')]);router[_0xc86b('0x6')]('/voice/queues',auth[_0xc86b('0xa')](),controller[_0xc86b('0xc')]);router[_0xc86b('0x6')](_0xc86b('0xd'),auth[_0xc86b('0xa')](),controller[_0xc86b('0xe')]);router[_0xc86b('0x6')](_0xc86b('0xf'),auth['isAuthenticated'](),controller[_0xc86b('0x10')]);router[_0xc86b('0x6')](_0xc86b('0x11'),auth['isAuthenticated'](),controller[_0xc86b('0x12')]);router['get']('/openchannel/queues',auth[_0xc86b('0xa')](),controller[_0xc86b('0x13')]);router['get'](_0xc86b('0x14'),auth['isAuthenticated'](),controller[_0xc86b('0x15')]);router[_0xc86b('0x6')](_0xc86b('0x16'),auth[_0xc86b('0xa')](),controller[_0xc86b('0x17')]);router['get'](_0xc86b('0x18'),auth[_0xc86b('0xa')](),controller[_0xc86b('0x19')]);router[_0xc86b('0x6')]('/voice/queues/channels',auth[_0xc86b('0xa')](),controller[_0xc86b('0x1a')]);router[_0xc86b('0x6')](_0xc86b('0x1b'),auth['isAuthenticated'](),controller[_0xc86b('0x1c')]);router[_0xc86b('0x6')]('/voice/queues/channels/:uniqueid/hangup',auth[_0xc86b('0xa')](),controller[_0xc86b('0x1d')]);router['get']('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0xc86b('0xa')](),controller['voiceQueuesChannelRedirect']);router[_0xc86b('0x6')]('/voice/queues/:id',auth[_0xc86b('0xa')](),controller[_0xc86b('0x1e')]);router['get'](_0xc86b('0x1f'),auth['isAuthenticated'](),controller[_0xc86b('0x20')]);router[_0xc86b('0x6')](_0xc86b('0x21'),auth[_0xc86b('0xa')](),controller['outboundChannels']);router[_0xc86b('0x6')](_0xc86b('0x22'),auth[_0xc86b('0xa')](),controller[_0xc86b('0x23')]);router[_0xc86b('0x24')]('/agents/:id/capacity',auth[_0xc86b('0xa')](),controller[_0xc86b('0x25')]);router[_0xc86b('0x6')](_0xc86b('0x26'),auth[_0xc86b('0xa')](),controller['telephones']);router[_0xc86b('0x6')](_0xc86b('0x27'),auth[_0xc86b('0xa')](),controller[_0xc86b('0x28')]);router[_0xc86b('0x6')](_0xc86b('0x29'),auth[_0xc86b('0xa')](),controller[_0xc86b('0x2a')]);router[_0xc86b('0x6')](_0xc86b('0x2b'),auth[_0xc86b('0xa')](),controller[_0xc86b('0x2c')]);router[_0xc86b('0x6')]('/chat/queues/waitinginteractions',auth['isAuthenticated'](),controller['chatQueuesWaitingInteractions']);router[_0xc86b('0x6')]('/mail/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xc86b('0x2d')]);router[_0xc86b('0x6')](_0xc86b('0x2e'),auth[_0xc86b('0xa')](),controller[_0xc86b('0x2f')]);router['get']('/sms/queues/waitinginteractions',auth[_0xc86b('0xa')](),controller[_0xc86b('0x30')]);router[_0xc86b('0x6')](_0xc86b('0x31'),auth[_0xc86b('0xa')](),controller[_0xc86b('0x32')]);router[_0xc86b('0x33')]('/mail/queues/:id/notify',auth[_0xc86b('0xa')](),controller['queueNotify'](_0xc86b('0x34')));router[_0xc86b('0x6')](_0xc86b('0x35'),auth[_0xc86b('0xa')](),controller[_0xc86b('0x36')]);router['post'](_0xc86b('0x37'),auth[_0xc86b('0xa')](),controller[_0xc86b('0x38')]('chat'));router[_0xc86b('0x6')]('/chat/queues/:id',auth['isAuthenticated'](),controller[_0xc86b('0x39')]);router['post']('/fax/queues/:id/notify',auth[_0xc86b('0xa')](),controller[_0xc86b('0x38')](_0xc86b('0x3a')));router['get']('/fax/queues/:id',auth[_0xc86b('0xa')](),controller[_0xc86b('0x3b')]);router['post']('/openchannel/queues/:id/notify',auth[_0xc86b('0xa')](),controller[_0xc86b('0x38')](_0xc86b('0x3c')));router[_0xc86b('0x6')]('/openchannel/queues/:id',auth[_0xc86b('0xa')](),controller[_0xc86b('0x3d')]);router[_0xc86b('0x33')](_0xc86b('0x3e'),auth[_0xc86b('0xa')](),controller[_0xc86b('0x38')](_0xc86b('0x3f')));router[_0xc86b('0x6')]('/sms/queues/:id',auth[_0xc86b('0xa')](),controller[_0xc86b('0x40')]);router[_0xc86b('0x33')](_0xc86b('0x41'),auth[_0xc86b('0xa')](),controller[_0xc86b('0x42')]);module[_0xc86b('0x43')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 1197c23..87c8276 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 _0x95df=['INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','interface','SIP/%s','agent','internal','AgentCapacity','telephones','Telephones','Trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','OpenchannelQueues','showOpenchannelQueues','SmsQueues','showSmsQueues','faxQueues','FaxQueues','showFaxQueues','FaxAccounts','ChatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','\x20Queue\x20not\x20found','Message','messageId','Interaction','update','queue','MessageId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','User','findOne','Agent\x20not\x20found','\x20Message\x20not\x20found','agentTransferTimeout','bluebird','moment','lodash','util','api','jayson/promise','http','client','request','then','error','code','message','result','catch','json','sendStatus','name','isNil','find','rows','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','showVoiceQueues','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','body','user','interaction','hasOwnProperty','MemberReport'];(function(_0x21b7f5,_0x54fe00){var _0x1f184f=function(_0x103317){while(--_0x103317){_0x21b7f5['push'](_0x21b7f5['shift']());}};_0x1f184f(++_0x54fe00);}(_0x95df,0x11c));var _0xf95d=function(_0x236fbb,_0xa721d9){_0x236fbb=_0x236fbb-0x0;var _0x4d9c67=_0x95df[_0x236fbb];return _0x4d9c67;};'use strict';var BPromise=require(_0xf95d('0x0'));var moment=require(_0xf95d('0x1'));var _=require(_0xf95d('0x2'));var util=require(_0xf95d('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0xf95d('0x4'));var jayson=require(_0xf95d('0x5'));var amiClient=jayson['client'][_0xf95d('0x6')]({'port':0x232a});var mailClient=jayson[_0xf95d('0x7')][_0xf95d('0x6')]({'port':0x232b});var routingClient=jayson[_0xf95d('0x7')]['http']({'port':0x232c});function respondWithRpcPromise(_0x4b58dd,_0x1adb85,_0x15660a){return new BPromise(function(_0x9e553f,_0x42379f){var _0x1464fb=_0x15660a?_0x15660a:amiClient;return _0x1464fb[_0xf95d('0x8')](_0x4b58dd,_0x1adb85)[_0xf95d('0x9')](function(_0x54f1b9){if(_0x54f1b9[_0xf95d('0xa')]){if(_0x54f1b9[_0xf95d('0xa')][_0xf95d('0xb')]===0x1f4){return _0x42379f(_0x54f1b9[_0xf95d('0xa')][_0xf95d('0xc')]);}return _0x9e553f(_0x54f1b9[_0xf95d('0xa')][_0xf95d('0xc')]);}else{_0x9e553f(_0x54f1b9[_0xf95d('0xd')]);}})[_0xf95d('0xe')](function(_0x15d19c){_0x42379f(_0x15d19c);});});}function respondWithResult(_0x245248,_0x524ccd){_0x524ccd=_0x524ccd||0xc8;return function(_0x43dab0){if(_0x43dab0){return _0x245248['status'](_0x524ccd)[_0xf95d('0xf')](_0x43dab0);}return _0x245248[_0xf95d('0x10')](0x194);};}function handleError(_0x425ddc,_0x1b4f67){_0x1b4f67=_0x1b4f67||0x1f4;return function(_0x16649f){logger[_0xf95d('0xa')](_0x16649f['stack']);if(_0x16649f[_0xf95d('0x11')]){delete _0x16649f[_0xf95d('0x11')];}_0x425ddc['status'](_0x1b4f67)['send'](_0x16649f);};}function findById(_0x2e0045){return function(_0x555bff){if(!_[_0xf95d('0x12')](_0x2e0045)&&!_['isNil'](_0x555bff)&&!_[_0xf95d('0x12')](_0x555bff['rows'])){return _[_0xf95d('0x13')](_0x555bff[_0xf95d('0x14')],function(_0x49dd36){return _0x49dd36['id']==_0x2e0045;});}return null;};}exports[_0xf95d('0x15')]=function(_0x2f33e1,_0x3186cf){return respondWithRpcPromise(_0xf95d('0x16'),_0x2f33e1[_0xf95d('0x17')])[_0xf95d('0x9')](respondWithResult(_0x3186cf,null))[_0xf95d('0xe')](handleError(_0x3186cf,null));};exports[_0xf95d('0x18')]=function(_0x454361,_0x59b2ab){return respondWithRpcPromise(_0xf95d('0x19'),_[_0xf95d('0x1a')](_0x454361[_0xf95d('0x17')],_0x454361[_0xf95d('0x1b')]))['then'](respondWithResult(_0x59b2ab,null))[_0xf95d('0xe')](handleError(_0x59b2ab,null));};exports[_0xf95d('0x1c')]=function(_0x5e3090,_0x4fb9e5){return respondWithRpcPromise(_0xf95d('0x1d'),_[_0xf95d('0x1a')](_0x5e3090[_0xf95d('0x17')],_0x5e3090[_0xf95d('0x1b')]))[_0xf95d('0x9')](respondWithResult(_0x4fb9e5,null))[_0xf95d('0xe')](handleError(_0x4fb9e5,null));};exports['voiceQueues']=function(_0x386ab0,_0x549bd0){return respondWithRpcPromise('VoiceQueues',_0x386ab0[_0xf95d('0x17')])[_0xf95d('0x9')](respondWithResult(_0x549bd0,null))[_0xf95d('0xe')](handleError(_0x549bd0,null));};exports[_0xf95d('0x1e')]=function(_0x1751db,_0x196708){return respondWithRpcPromise('VoiceQueues',_0x1751db[_0xf95d('0x17')])[_0xf95d('0x9')](findById(_0x1751db[_0xf95d('0x1b')]['id']))[_0xf95d('0x9')](respondWithResult(_0x196708,null))['catch'](handleError(_0x196708,null));};exports['voiceQueuesPreview']=function(_0x13c6c1,_0x4a4172){return respondWithRpcPromise(_0xf95d('0x1f'),_[_0xf95d('0x1a')](_0x13c6c1[_0xf95d('0x17')],_0x13c6c1[_0xf95d('0x1b')]))[_0xf95d('0x9')](respondWithResult(_0x4a4172,null))[_0xf95d('0xe')](handleError(_0x4a4172,null));};exports[_0xf95d('0x20')]=function(_0x14921c,_0x1d696b){return respondWithRpcPromise(_0xf95d('0x21'),_0x14921c[_0xf95d('0x17')])[_0xf95d('0x9')](respondWithResult(_0x1d696b,null))['catch'](handleError(_0x1d696b,null));};exports[_0xf95d('0x22')]=function(_0x4436b4,_0x421514){return respondWithRpcPromise('VoiceQueuesChannel',_['merge'](_0x4436b4[_0xf95d('0x17')],_0x4436b4[_0xf95d('0x1b')]))[_0xf95d('0x9')](respondWithResult(_0x421514,null))[_0xf95d('0xe')](handleError(_0x421514,null));};exports[_0xf95d('0x23')]=function(_0x4bee86,_0x33877c){return respondWithRpcPromise(_0xf95d('0x24'),_[_0xf95d('0x1a')](_0x4bee86[_0xf95d('0x17')],_0x4bee86[_0xf95d('0x1b')]))[_0xf95d('0x9')](respondWithResult(_0x33877c,null))[_0xf95d('0xe')](handleError(_0x33877c,null));};exports[_0xf95d('0x25')]=function(_0x3afc8a,_0x34ac3f){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_['merge'](_0x3afc8a['query'],_0x3afc8a['params']))[_0xf95d('0x9')](respondWithResult(_0x34ac3f,null))[_0xf95d('0xe')](handleError(_0x34ac3f,null));};exports[_0xf95d('0x26')]=function(_0x56fb11,_0x4b9e4e){return respondWithRpcPromise(_0xf95d('0x27'),_0x56fb11[_0xf95d('0x17')])[_0xf95d('0x9')](respondWithResult(_0x4b9e4e,null))[_0xf95d('0xe')](handleError(_0x4b9e4e,null));};exports[_0xf95d('0x28')]=function(_0x514195,_0x1817d3){return respondWithRpcPromise(_0xf95d('0x29'),_0x514195[_0xf95d('0x17')])['then'](respondWithResult(_0x1817d3,null))[_0xf95d('0xe')](handleError(_0x1817d3,null));};exports[_0xf95d('0x2a')]=function(_0x4eb08a,_0x340a9c){var _0xa53488;return respondWithRpcPromise(_0xf95d('0x2b'),_0x4eb08a[_0xf95d('0x17')])[_0xf95d('0x9')](function(_0x1432be){_0xa53488=_0x1432be;return respondWithRpcPromise(_0xf95d('0x2b'),_0x4eb08a[_0xf95d('0x17')],routingClient);})[_0xf95d('0x9')](function(_0x3392d6){return _['merge']({},_0x3392d6,_0xa53488);})['then'](respondWithResult(_0x340a9c,null))[_0xf95d('0xe')](handleError(_0x340a9c,null));};exports['agentCapacity']=function(_0x4a0139,_0x107f52){if(_0x4a0139[_0xf95d('0x2c')]&&_0x4a0139[_0xf95d('0x2c')]['interaction']&&_0x4a0139[_0xf95d('0x2d')]&&_0x4a0139[_0xf95d('0x2d')][_0xf95d('0x11')]){for(var _0x379d40 in _0x4a0139[_0xf95d('0x2c')][_0xf95d('0x2e')]){if(_0x4a0139[_0xf95d('0x2c')]['interaction'][_0xf95d('0x2f')](_0x379d40)){db[_0xf95d('0x30')]['findAll']({'where':{'channel':_0x379d40,'membername':_0x4a0139[_0xf95d('0x2d')][_0xf95d('0x11')],'type':_0xf95d('0x31'),'exitAt':null,'uniqueid':_0x4a0139[_0xf95d('0x2c')][_0xf95d('0x2e')][_0x379d40]&&_0x4a0139[_0xf95d('0x2c')][_0xf95d('0x2e')][_0x379d40]['length']?{'$notIn':_0x4a0139['body'][_0xf95d('0x2e')][_0x379d40]}:{'$ne':null}}})['then'](function(_0x1030b5){var _0x43ba61=moment()[_0xf95d('0x32')](_0xf95d('0x33'));for(var _0x4d8c3b=0x0,_0x336480=_0x1030b5[_0xf95d('0x34')];_0x4d8c3b<_0x336480;_0x4d8c3b+=0x1){_0x1030b5[_0x4d8c3b][_0xf95d('0x35')]({'exitAt':_0x43ba61});}});for(var _0x289ba9=0x0;_0x289ba9<_0x4a0139[_0xf95d('0x2c')][_0xf95d('0x2e')][_0x379d40][_0xf95d('0x34')];_0x289ba9+=0x1){db[_0xf95d('0x30')]['findOrCreate']({'where':{'channel':_0x379d40,'membername':_0x4a0139[_0xf95d('0x2d')][_0xf95d('0x11')],'type':_0xf95d('0x31'),'uniqueid':_0x4a0139[_0xf95d('0x2c')][_0xf95d('0x2e')][_0x379d40][_0x289ba9],'exitAt':null},'defaults':{'channel':_0x379d40,'membername':_0x4a0139[_0xf95d('0x2d')]['name'],'interface':_[_0xf95d('0x12')](_0x4a0139[_0xf95d('0x2d')][_0xf95d('0x36')])?util[_0xf95d('0x32')](_0xf95d('0x37'),_0x4a0139[_0xf95d('0x2d')][_0xf95d('0x11')]):_0x4a0139[_0xf95d('0x2d')][_0xf95d('0x36')],'type':_0xf95d('0x31'),'enterAt':moment()[_0xf95d('0x32')](_0xf95d('0x33')),'role':_0xf95d('0x38'),'internal':_0x4a0139['user'][_0xf95d('0x39')],'uniqueid':_0x4a0139[_0xf95d('0x2c')][_0xf95d('0x2e')][_0x379d40][_0x289ba9]}});}}}}return respondWithRpcPromise(_0xf95d('0x3a'),{'id':_0x4a0139[_0xf95d('0x1b')]['id'],'capacity':_0x4a0139['body']['capacity']},routingClient)[_0xf95d('0x9')](respondWithResult(_0x107f52,null))[_0xf95d('0xe')](handleError(_0x107f52,null));};exports[_0xf95d('0x3b')]=function(_0x12ac53,_0x5b0775){return respondWithRpcPromise(_0xf95d('0x3c'),_0x12ac53[_0xf95d('0x17')])[_0xf95d('0x9')](respondWithResult(_0x5b0775,null))[_0xf95d('0xe')](handleError(_0x5b0775,null));};exports['trunks']=function(_0x1618d3,_0x485f60){return respondWithRpcPromise(_0xf95d('0x3d'),_0x1618d3[_0xf95d('0x17')])[_0xf95d('0x9')](respondWithResult(_0x485f60,null))[_0xf95d('0xe')](handleError(_0x485f60,null));};exports['campaigns']=function(_0x2bad3d,_0x31d389){return respondWithRpcPromise(_0xf95d('0x3e'),_0x2bad3d[_0xf95d('0x17')])[_0xf95d('0x9')](respondWithResult(_0x31d389,null))[_0xf95d('0xe')](handleError(_0x31d389,null));};exports[_0xf95d('0x3f')]=function(_0x300be4,_0x3c5d9e){return respondWithRpcPromise(_0xf95d('0x40'),_0x300be4[_0xf95d('0x17')],routingClient)['then'](respondWithResult(_0x3c5d9e,null))[_0xf95d('0xe')](handleError(_0x3c5d9e,null));};exports[_0xf95d('0x41')]=function(_0x3fb4cb,_0x4bf6c2){return respondWithRpcPromise(_0xf95d('0x40'),_0x3fb4cb[_0xf95d('0x17')],routingClient)[_0xf95d('0x9')](findById(_0x3fb4cb['params']['id']))[_0xf95d('0x9')](respondWithResult(_0x4bf6c2,null))[_0xf95d('0xe')](handleError(_0x4bf6c2,null));};exports['mailQueues']=function(_0x558dae,_0x32fc7a){return respondWithRpcPromise('MailQueues',_0x558dae['query'],routingClient)[_0xf95d('0x9')](respondWithResult(_0x32fc7a,null))[_0xf95d('0xe')](handleError(_0x32fc7a,null));};exports[_0xf95d('0x42')]=function(_0x2db4cd,_0x5b1a84){return respondWithRpcPromise(_0xf95d('0x43'),_0x2db4cd[_0xf95d('0x17')],routingClient)[_0xf95d('0x9')](findById(_0x2db4cd[_0xf95d('0x1b')]['id']))[_0xf95d('0x9')](respondWithResult(_0x5b1a84,null))[_0xf95d('0xe')](handleError(_0x5b1a84,null));};exports[_0xf95d('0x44')]=function(_0x186093,_0x5975b2){return respondWithRpcPromise(_0xf95d('0x45'),_0x186093['query'],mailClient)[_0xf95d('0x9')](respondWithResult(_0x5975b2,null))['catch'](handleError(_0x5975b2,null));};exports['openchannelQueues']=function(_0x124f78,_0x146ca7){return respondWithRpcPromise(_0xf95d('0x46'),_0x124f78[_0xf95d('0x17')],routingClient)[_0xf95d('0x9')](respondWithResult(_0x146ca7,null))[_0xf95d('0xe')](handleError(_0x146ca7,null));};exports[_0xf95d('0x47')]=function(_0x2be7b1,_0x490ee6){return respondWithRpcPromise(_0xf95d('0x46'),_0x2be7b1[_0xf95d('0x17')],routingClient)['then'](findById(_0x2be7b1[_0xf95d('0x1b')]['id']))[_0xf95d('0x9')](respondWithResult(_0x490ee6,null))[_0xf95d('0xe')](handleError(_0x490ee6,null));};exports['smsQueues']=function(_0x587220,_0x293362){return respondWithRpcPromise(_0xf95d('0x48'),_0x587220[_0xf95d('0x17')],routingClient)[_0xf95d('0x9')](respondWithResult(_0x293362,null))['catch'](handleError(_0x293362,null));};exports[_0xf95d('0x49')]=function(_0x2cf930,_0x1b8315){return respondWithRpcPromise('SmsQueues',_0x2cf930[_0xf95d('0x17')],routingClient)[_0xf95d('0x9')](findById(_0x2cf930[_0xf95d('0x1b')]['id']))['then'](respondWithResult(_0x1b8315,null))[_0xf95d('0xe')](handleError(_0x1b8315,null));};exports[_0xf95d('0x4a')]=function(_0x49fb01,_0x27c65a){return respondWithRpcPromise(_0xf95d('0x4b'),_0x49fb01[_0xf95d('0x17')],routingClient)['then'](respondWithResult(_0x27c65a,null))[_0xf95d('0xe')](handleError(_0x27c65a,null));};exports[_0xf95d('0x4c')]=function(_0x4e8480,_0x3aa0a9){return respondWithRpcPromise(_0xf95d('0x4b'),_0x4e8480[_0xf95d('0x17')],routingClient)['then'](findById(_0x4e8480[_0xf95d('0x1b')]['id']))['then'](respondWithResult(_0x3aa0a9,null))['catch'](handleError(_0x3aa0a9,null));};exports['faxAccounts']=function(_0x2df822,_0x8214a2){return respondWithRpcPromise(_0xf95d('0x4d'),_0x2df822[_0xf95d('0x17')])['then'](respondWithResult(_0x8214a2,null))['catch'](handleError(_0x8214a2,null));};exports['chatQueuesWaitingInteractions']=function(_0x5b6720,_0x3b903b){return respondWithRpcPromise(_0xf95d('0x4e'),_0x5b6720[_0xf95d('0x17')],routingClient)['then'](respondWithResult(_0x3b903b,null))[_0xf95d('0xe')](handleError(_0x3b903b,null));};exports['mailQueuesWaitingInteractions']=function(_0x5db9f8,_0xf5f074){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x5db9f8[_0xf95d('0x17')],routingClient)['then'](respondWithResult(_0xf5f074,null))[_0xf95d('0xe')](handleError(_0xf5f074,null));};exports[_0xf95d('0x4f')]=function(_0x558355,_0x28d171){return respondWithRpcPromise(_0xf95d('0x50'),_0x558355[_0xf95d('0x17')],routingClient)['then'](respondWithResult(_0x28d171,null))['catch'](handleError(_0x28d171,null));};exports[_0xf95d('0x51')]=function(_0x5ed6e8,_0x1f6b0e){return respondWithRpcPromise(_0xf95d('0x52'),_0x5ed6e8['query'],routingClient)[_0xf95d('0x9')](respondWithResult(_0x1f6b0e,null))[_0xf95d('0xe')](handleError(_0x1f6b0e,null));};exports[_0xf95d('0x53')]=function(_0x122752,_0x246a6e){return respondWithRpcPromise(_0xf95d('0x54'),_0x122752[_0xf95d('0x17')],routingClient)[_0xf95d('0x9')](respondWithResult(_0x246a6e,null))[_0xf95d('0xe')](handleError(_0x246a6e,null));};exports[_0xf95d('0x55')]=function(_0x447eb3){return function(_0x566452,_0x3e3ccd){var _0x3334f2,_0xae598c;var _0x3c6667=_[_0xf95d('0x56')](_0x447eb3);var _0x1ebb51=_0x447eb3===_0xf95d('0x57')?_0xf95d('0x58'):_0xf95d('0x59');return db[_0x3c6667+'Queue']['findOne']({'raw':!![],'where':{'id':_0x566452[_0xf95d('0x1b')]['id']}})['then'](function(_0xd296f8){if(_['isNil'](_0xd296f8)){throw new Error(_0x3c6667+_0xf95d('0x5a'));}_0x3334f2=_0xd296f8;return db[_0x3c6667+_0xf95d('0x5b')]['findOne']({'where':{'id':_0x566452[_0xf95d('0x2c')][_0xf95d('0x5c')]},'include':[{'model':db[_0x3c6667+_0xf95d('0x5d')],'as':_0xf95d('0x5d')},{'model':db[_0x3c6667+_0x1ebb51],'as':_0xf95d('0x59')}]});})[_0xf95d('0x9')](function(_0x5622f1){if(_[_0xf95d('0x12')](_0x5622f1)){throw new Error(_0x3c6667+'\x20Message\x20not\x20found');}_0xae598c=_0x5622f1;return _0x5622f1[_0xf95d('0x5e')]({'read':0x0,'readAt':null,'UserId':null});})[_0xf95d('0x9')](function(){var _0x1c486e={'uniqueid':_0x447eb3+'.'+_0xae598c['id']+'.'+_0xae598c[_0xf95d('0x5d')]['id'],'FromUserId':_0x566452[_0xf95d('0x2d')]['id'],'type':_0xf95d('0x5f')};_0x1c486e[_0x3c6667+_0xf95d('0x60')]=_0xae598c['id'];_0x1c486e[_0x3c6667+'InteractionId']=_0xae598c[_0xf95d('0x5d')]['id'];_0x1c486e[_0xf95d('0x61')+_0x3c6667+_0x1ebb51+'Id']=_0xae598c[_0xf95d('0x59')]['id'];_0x1c486e['To'+_0x3c6667+_0xf95d('0x62')]=_0x3334f2['id'];return db[_0x3c6667+_0xf95d('0x63')][_0xf95d('0x64')](_0x1c486e);})[_0xf95d('0x9')](function(){return respondWithRpcPromise(_0xf95d('0x65'),{'channel':_0x447eb3,'interaction':_0xae598c['Interaction'],'message':_0xae598c,'account':_0xae598c[_0xf95d('0x59')],'applications':[{'id':0x0,'priority':0x1,'app':_0xf95d('0x5f'),'appdata':_0x3334f2['name']+','+(_0xae598c[_0xf95d('0x59')][_0xf95d('0x66')]||0x12c),'interval':_0xf95d('0x67')}]},routingClient);})[_0xf95d('0x9')](respondWithResult(_0x3e3ccd,null))[_0xf95d('0xe')](handleError(_0x3e3ccd,null));};};exports[_0xf95d('0x68')]=function(_0x10f2d1,_0x327fed){var _0x465665,_0x4562cf;if(_['isNil'](_0x10f2d1['body']['channel'])){throw new Error(_0xf95d('0x69'));}var _0x555083=_0x10f2d1['body']['channel'];var _0x92cb71=_[_0xf95d('0x56')](_0x555083);var _0x287df1=_0x555083==='chat'?_0xf95d('0x58'):_0xf95d('0x59');return db[_0xf95d('0x6a')][_0xf95d('0x6b')]({'raw':!![],'where':{'id':_0x10f2d1['params']['id'],'role':_0xf95d('0x38')}})[_0xf95d('0x9')](function(_0x4c1ce4){if(_['isNil'](_0x4c1ce4)){throw new Error(_0xf95d('0x6c'));}_0x465665=_0x4c1ce4;return db[_0x92cb71+_0xf95d('0x5b')][_0xf95d('0x6b')]({'where':{'id':_0x10f2d1[_0xf95d('0x2c')][_0xf95d('0x5c')]},'include':[{'model':db[_0x92cb71+_0xf95d('0x5d')],'as':'Interaction'},{'model':db[_0x92cb71+_0x287df1],'as':_0xf95d('0x59')}]});})['then'](function(_0x4e3bad){if(_[_0xf95d('0x12')](_0x4e3bad)){throw new Error(_0x92cb71+_0xf95d('0x6d'));}_0x4562cf=_0x4e3bad;return _0x4e3bad[_0xf95d('0x5e')]({'read':0x0,'readAt':null,'UserId':null});})[_0xf95d('0x9')](function(){var _0x1c6f84={'uniqueid':_0x555083+'.'+_0x4562cf['id']+'.'+_0x4562cf[_0xf95d('0x5d')]['id'],'FromUserId':_0x10f2d1[_0xf95d('0x2d')]['id'],'type':_0xf95d('0x5f'),'ToUserId':_0x465665['id']};_0x1c6f84[_0x92cb71+_0xf95d('0x60')]=_0x4562cf['id'];_0x1c6f84[_0x92cb71+'InteractionId']=_0x4562cf[_0xf95d('0x5d')]['id'];_0x1c6f84[_0xf95d('0x61')+_0x92cb71+_0x287df1+'Id']=_0x4562cf[_0xf95d('0x59')]['id'];return db[_0x92cb71+_0xf95d('0x63')][_0xf95d('0x64')](_0x1c6f84);})[_0xf95d('0x9')](function(){return respondWithRpcPromise(_0xf95d('0x65'),{'channel':_0x555083,'interaction':_0x4562cf[_0xf95d('0x5d')],'message':_0x4562cf,'account':_0x4562cf[_0xf95d('0x59')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x465665[_0xf95d('0x11')]+','+(_0x4562cf[_0xf95d('0x59')][_0xf95d('0x6e')]||0x12c),'interval':_0xf95d('0x67')}]},routingClient);})[_0xf95d('0x9')](respondWithResult(_0x327fed,null))[_0xf95d('0xe')](handleError(_0x327fed,null));}; \ No newline at end of file +var _0x5832=['Trunks','campaigns','chatQueues','showChatQueues','ChatQueues','MailQueues','showMailQueues','MailAccounts','showOpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','faxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','Interaction','\x20Message\x20not\x20found','update','queue','InteractionId','From','QueueId','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','User','Agent\x20not\x20found','MessageId','TransferReport','bluebird','lodash','util','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','sendStatus','stack','name','isNil','rows','find','voiceChannels','query','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','voiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','agent','AgentCapacity','telephones','Telephones'];(function(_0x53b263,_0x59bd53){var _0x3a153d=function(_0x27ecdc){while(--_0x27ecdc){_0x53b263['push'](_0x53b263['shift']());}};_0x3a153d(++_0x59bd53);}(_0x5832,0x177));var _0x2583=function(_0x4cbf20,_0x1bfa66){_0x4cbf20=_0x4cbf20-0x0;var _0x582ae4=_0x5832[_0x4cbf20];return _0x582ae4;};'use strict';var BPromise=require(_0x2583('0x0'));var moment=require('moment');var _=require(_0x2583('0x1'));var util=require(_0x2583('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x2583('0x3'))(_0x2583('0x4'));var jayson=require(_0x2583('0x5'));var amiClient=jayson[_0x2583('0x6')][_0x2583('0x7')]({'port':0x232a});var mailClient=jayson[_0x2583('0x6')][_0x2583('0x7')]({'port':0x232b});var routingClient=jayson[_0x2583('0x6')][_0x2583('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x3e4204,_0x32f11f,_0x3f374d){return new BPromise(function(_0x524cbb,_0x6e36d2){var _0x2e1a6b=_0x3f374d?_0x3f374d:amiClient;return _0x2e1a6b[_0x2583('0x8')](_0x3e4204,_0x32f11f)[_0x2583('0x9')](function(_0x1aa2ad){if(_0x1aa2ad['error']){if(_0x1aa2ad[_0x2583('0xa')][_0x2583('0xb')]===0x1f4){return _0x6e36d2(_0x1aa2ad['error']['message']);}return _0x524cbb(_0x1aa2ad[_0x2583('0xa')][_0x2583('0xc')]);}else{_0x524cbb(_0x1aa2ad[_0x2583('0xd')]);}})[_0x2583('0xe')](function(_0x53cbd4){_0x6e36d2(_0x53cbd4);});});}function respondWithResult(_0x99c615,_0x20487a){_0x20487a=_0x20487a||0xc8;return function(_0x2f4d3e){if(_0x2f4d3e){return _0x99c615[_0x2583('0xf')](_0x20487a)['json'](_0x2f4d3e);}return _0x99c615[_0x2583('0x10')](0x194);};}function handleError(_0x4acbcf,_0x2f1a25){_0x2f1a25=_0x2f1a25||0x1f4;return function(_0x20eac2){logger[_0x2583('0xa')](_0x20eac2[_0x2583('0x11')]);if(_0x20eac2['name']){delete _0x20eac2[_0x2583('0x12')];}_0x4acbcf['status'](_0x2f1a25)['send'](_0x20eac2);};}function findById(_0x363562){return function(_0x5449ed){if(!_[_0x2583('0x13')](_0x363562)&&!_[_0x2583('0x13')](_0x5449ed)&&!_[_0x2583('0x13')](_0x5449ed[_0x2583('0x14')])){return _[_0x2583('0x15')](_0x5449ed['rows'],function(_0x9776b0){return _0x9776b0['id']==_0x363562;});}return null;};}exports[_0x2583('0x16')]=function(_0x54e8ba,_0x5a7b60){return respondWithRpcPromise('VoiceChannels',_0x54e8ba[_0x2583('0x17')])['then'](respondWithResult(_0x5a7b60,null))['catch'](handleError(_0x5a7b60,null));};exports['voiceChannelMixMonitor']=function(_0x274a77,_0x34e7da){return respondWithRpcPromise(_0x2583('0x18'),_[_0x2583('0x19')](_0x274a77[_0x2583('0x17')],_0x274a77[_0x2583('0x1a')]))['then'](respondWithResult(_0x34e7da,null))[_0x2583('0xe')](handleError(_0x34e7da,null));};exports['voiceChannelStopMixMonitor']=function(_0x36353b,_0xda4a69){return respondWithRpcPromise(_0x2583('0x1b'),_[_0x2583('0x19')](_0x36353b[_0x2583('0x17')],_0x36353b['params']))[_0x2583('0x9')](respondWithResult(_0xda4a69,null))[_0x2583('0xe')](handleError(_0xda4a69,null));};exports[_0x2583('0x1c')]=function(_0x25579a,_0x221eab){return respondWithRpcPromise(_0x2583('0x1d'),_0x25579a[_0x2583('0x17')])[_0x2583('0x9')](respondWithResult(_0x221eab,null))[_0x2583('0xe')](handleError(_0x221eab,null));};exports[_0x2583('0x1e')]=function(_0x2c5016,_0x2403b2){return respondWithRpcPromise(_0x2583('0x1d'),_0x2c5016[_0x2583('0x17')])[_0x2583('0x9')](findById(_0x2c5016[_0x2583('0x1a')]['id']))[_0x2583('0x9')](respondWithResult(_0x2403b2,null))['catch'](handleError(_0x2403b2,null));};exports[_0x2583('0x1f')]=function(_0x24a34d,_0x2728aa){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x2583('0x19')](_0x24a34d[_0x2583('0x17')],_0x24a34d[_0x2583('0x1a')]))[_0x2583('0x9')](respondWithResult(_0x2728aa,null))['catch'](handleError(_0x2728aa,null));};exports[_0x2583('0x20')]=function(_0xa7de19,_0x262758){return respondWithRpcPromise('VoiceQueuesChannels',_0xa7de19[_0x2583('0x17')])[_0x2583('0x9')](respondWithResult(_0x262758,null))[_0x2583('0xe')](handleError(_0x262758,null));};exports[_0x2583('0x21')]=function(_0x43bf91,_0x55bc69){return respondWithRpcPromise(_0x2583('0x22'),_[_0x2583('0x19')](_0x43bf91[_0x2583('0x17')],_0x43bf91[_0x2583('0x1a')]))['then'](respondWithResult(_0x55bc69,null))[_0x2583('0xe')](handleError(_0x55bc69,null));};exports[_0x2583('0x23')]=function(_0x28fd2c,_0x89b935){return respondWithRpcPromise(_0x2583('0x24'),_['merge'](_0x28fd2c[_0x2583('0x17')],_0x28fd2c['params']))[_0x2583('0x9')](respondWithResult(_0x89b935,null))[_0x2583('0xe')](handleError(_0x89b935,null));};exports[_0x2583('0x25')]=function(_0x5ba295,_0x196ac9){return respondWithRpcPromise(_0x2583('0x26'),_[_0x2583('0x19')](_0x5ba295[_0x2583('0x17')],_0x5ba295[_0x2583('0x1a')]))['then'](respondWithResult(_0x196ac9,null))['catch'](handleError(_0x196ac9,null));};exports['outbound']=function(_0x3131f8,_0x1fb458){return respondWithRpcPromise(_0x2583('0x27'),_0x3131f8[_0x2583('0x17')])[_0x2583('0x9')](respondWithResult(_0x1fb458,null))['catch'](handleError(_0x1fb458,null));};exports['outboundChannels']=function(_0x473081,_0x20f3e9){return respondWithRpcPromise(_0x2583('0x28'),_0x473081[_0x2583('0x17')])[_0x2583('0x9')](respondWithResult(_0x20f3e9,null))[_0x2583('0xe')](handleError(_0x20f3e9,null));};exports[_0x2583('0x29')]=function(_0x1bc8d7,_0x256b67){var _0x8cad7;return respondWithRpcPromise(_0x2583('0x2a'),_0x1bc8d7[_0x2583('0x17')])[_0x2583('0x9')](function(_0x9f0fac){_0x8cad7=_0x9f0fac;return respondWithRpcPromise(_0x2583('0x2a'),_0x1bc8d7['query'],routingClient);})[_0x2583('0x9')](function(_0xbf1b77){return _[_0x2583('0x19')]({},_0xbf1b77,_0x8cad7);})[_0x2583('0x9')](respondWithResult(_0x256b67,null))[_0x2583('0xe')](handleError(_0x256b67,null));};exports[_0x2583('0x2b')]=function(_0x5e1651,_0x2820b6){if(_0x5e1651[_0x2583('0x2c')]&&_0x5e1651['body'][_0x2583('0x2d')]&&_0x5e1651[_0x2583('0x2e')]&&_0x5e1651['user'][_0x2583('0x12')]){for(var _0xdda01d in _0x5e1651[_0x2583('0x2c')]['interaction']){if(_0x5e1651[_0x2583('0x2c')][_0x2583('0x2d')]['hasOwnProperty'](_0xdda01d)){db[_0x2583('0x2f')][_0x2583('0x30')]({'where':{'channel':_0xdda01d,'membername':_0x5e1651['user'][_0x2583('0x12')],'type':_0x2583('0x31'),'exitAt':null,'uniqueid':_0x5e1651['body'][_0x2583('0x2d')][_0xdda01d]&&_0x5e1651[_0x2583('0x2c')]['interaction'][_0xdda01d][_0x2583('0x32')]?{'$notIn':_0x5e1651['body'][_0x2583('0x2d')][_0xdda01d]}:{'$ne':null}}})[_0x2583('0x9')](function(_0x4c830d){var _0x3eafbc=moment()[_0x2583('0x33')](_0x2583('0x34'));for(var _0x11da4b=0x0,_0x57fdba=_0x4c830d[_0x2583('0x32')];_0x11da4b<_0x57fdba;_0x11da4b+=0x1){_0x4c830d[_0x11da4b][_0x2583('0x35')]({'exitAt':_0x3eafbc});}});for(var _0x5d358b=0x0;_0x5d358b<_0x5e1651[_0x2583('0x2c')][_0x2583('0x2d')][_0xdda01d][_0x2583('0x32')];_0x5d358b+=0x1){db[_0x2583('0x2f')][_0x2583('0x36')]({'where':{'channel':_0xdda01d,'membername':_0x5e1651[_0x2583('0x2e')][_0x2583('0x12')],'type':_0x2583('0x31'),'uniqueid':_0x5e1651[_0x2583('0x2c')][_0x2583('0x2d')][_0xdda01d][_0x5d358b],'exitAt':null},'defaults':{'channel':_0xdda01d,'membername':_0x5e1651[_0x2583('0x2e')]['name'],'interface':_[_0x2583('0x13')](_0x5e1651['user'][_0x2583('0x37')])?util['format'](_0x2583('0x38'),_0x5e1651[_0x2583('0x2e')]['name']):_0x5e1651['user'][_0x2583('0x37')],'type':_0x2583('0x31'),'enterAt':moment()[_0x2583('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x2583('0x39'),'internal':_0x5e1651[_0x2583('0x2e')]['internal'],'uniqueid':_0x5e1651['body'][_0x2583('0x2d')][_0xdda01d][_0x5d358b]}});}}}}return respondWithRpcPromise(_0x2583('0x3a'),{'id':_0x5e1651[_0x2583('0x1a')]['id'],'capacity':_0x5e1651[_0x2583('0x2c')]['capacity']},routingClient)[_0x2583('0x9')](respondWithResult(_0x2820b6,null))[_0x2583('0xe')](handleError(_0x2820b6,null));};exports[_0x2583('0x3b')]=function(_0x26cbce,_0x3a8450){return respondWithRpcPromise(_0x2583('0x3c'),_0x26cbce[_0x2583('0x17')])[_0x2583('0x9')](respondWithResult(_0x3a8450,null))[_0x2583('0xe')](handleError(_0x3a8450,null));};exports['trunks']=function(_0x541483,_0x3b072c){return respondWithRpcPromise(_0x2583('0x3d'),_0x541483[_0x2583('0x17')])[_0x2583('0x9')](respondWithResult(_0x3b072c,null))[_0x2583('0xe')](handleError(_0x3b072c,null));};exports[_0x2583('0x3e')]=function(_0x1bea0c,_0x16df8c){return respondWithRpcPromise('Campaigns',_0x1bea0c[_0x2583('0x17')])['then'](respondWithResult(_0x16df8c,null))[_0x2583('0xe')](handleError(_0x16df8c,null));};exports[_0x2583('0x3f')]=function(_0x3df9e5,_0x5bed55){return respondWithRpcPromise('ChatQueues',_0x3df9e5[_0x2583('0x17')],routingClient)[_0x2583('0x9')](respondWithResult(_0x5bed55,null))['catch'](handleError(_0x5bed55,null));};exports[_0x2583('0x40')]=function(_0x50f9ed,_0x5552cc){return respondWithRpcPromise(_0x2583('0x41'),_0x50f9ed[_0x2583('0x17')],routingClient)[_0x2583('0x9')](findById(_0x50f9ed[_0x2583('0x1a')]['id']))[_0x2583('0x9')](respondWithResult(_0x5552cc,null))['catch'](handleError(_0x5552cc,null));};exports['mailQueues']=function(_0x528181,_0x4037f5){return respondWithRpcPromise(_0x2583('0x42'),_0x528181['query'],routingClient)['then'](respondWithResult(_0x4037f5,null))[_0x2583('0xe')](handleError(_0x4037f5,null));};exports[_0x2583('0x43')]=function(_0x4cf5c1,_0x18325d){return respondWithRpcPromise(_0x2583('0x42'),_0x4cf5c1['query'],routingClient)[_0x2583('0x9')](findById(_0x4cf5c1['params']['id']))[_0x2583('0x9')](respondWithResult(_0x18325d,null))[_0x2583('0xe')](handleError(_0x18325d,null));};exports['mailAccounts']=function(_0x232475,_0x352321){return respondWithRpcPromise(_0x2583('0x44'),_0x232475[_0x2583('0x17')],mailClient)['then'](respondWithResult(_0x352321,null))[_0x2583('0xe')](handleError(_0x352321,null));};exports['openchannelQueues']=function(_0x280da0,_0xb0a26d){return respondWithRpcPromise('OpenchannelQueues',_0x280da0[_0x2583('0x17')],routingClient)[_0x2583('0x9')](respondWithResult(_0xb0a26d,null))[_0x2583('0xe')](handleError(_0xb0a26d,null));};exports[_0x2583('0x45')]=function(_0x4a335d,_0x3bbc50){return respondWithRpcPromise('OpenchannelQueues',_0x4a335d[_0x2583('0x17')],routingClient)['then'](findById(_0x4a335d[_0x2583('0x1a')]['id']))[_0x2583('0x9')](respondWithResult(_0x3bbc50,null))[_0x2583('0xe')](handleError(_0x3bbc50,null));};exports[_0x2583('0x46')]=function(_0x2c093d,_0x35cf96){return respondWithRpcPromise('SmsQueues',_0x2c093d[_0x2583('0x17')],routingClient)[_0x2583('0x9')](respondWithResult(_0x35cf96,null))[_0x2583('0xe')](handleError(_0x35cf96,null));};exports[_0x2583('0x47')]=function(_0x4d026b,_0x2da346){return respondWithRpcPromise(_0x2583('0x48'),_0x4d026b[_0x2583('0x17')],routingClient)['then'](findById(_0x4d026b[_0x2583('0x1a')]['id']))[_0x2583('0x9')](respondWithResult(_0x2da346,null))[_0x2583('0xe')](handleError(_0x2da346,null));};exports[_0x2583('0x49')]=function(_0x29d9be,_0x58e438){return respondWithRpcPromise('FaxQueues',_0x29d9be['query'],routingClient)[_0x2583('0x9')](respondWithResult(_0x58e438,null))[_0x2583('0xe')](handleError(_0x58e438,null));};exports[_0x2583('0x4a')]=function(_0x4479f5,_0x358d33){return respondWithRpcPromise('FaxQueues',_0x4479f5[_0x2583('0x17')],routingClient)['then'](findById(_0x4479f5[_0x2583('0x1a')]['id']))[_0x2583('0x9')](respondWithResult(_0x358d33,null))['catch'](handleError(_0x358d33,null));};exports[_0x2583('0x4b')]=function(_0x57506a,_0x4b7ed0){return respondWithRpcPromise(_0x2583('0x4c'),_0x57506a['query'])[_0x2583('0x9')](respondWithResult(_0x4b7ed0,null))[_0x2583('0xe')](handleError(_0x4b7ed0,null));};exports[_0x2583('0x4d')]=function(_0x66cd53,_0x3a727a){return respondWithRpcPromise(_0x2583('0x4e'),_0x66cd53[_0x2583('0x17')],routingClient)[_0x2583('0x9')](respondWithResult(_0x3a727a,null))['catch'](handleError(_0x3a727a,null));};exports['mailQueuesWaitingInteractions']=function(_0x3e3775,_0x42b961){return respondWithRpcPromise(_0x2583('0x4f'),_0x3e3775[_0x2583('0x17')],routingClient)[_0x2583('0x9')](respondWithResult(_0x42b961,null))[_0x2583('0xe')](handleError(_0x42b961,null));};exports[_0x2583('0x50')]=function(_0x266379,_0x5e7136){return respondWithRpcPromise(_0x2583('0x51'),_0x266379[_0x2583('0x17')],routingClient)[_0x2583('0x9')](respondWithResult(_0x5e7136,null))[_0x2583('0xe')](handleError(_0x5e7136,null));};exports[_0x2583('0x52')]=function(_0x2f6cf7,_0x3fc8ac){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2f6cf7[_0x2583('0x17')],routingClient)[_0x2583('0x9')](respondWithResult(_0x3fc8ac,null))[_0x2583('0xe')](handleError(_0x3fc8ac,null));};exports['faxQueuesWaitingInteractions']=function(_0x1a1879,_0x32c0ba){return respondWithRpcPromise(_0x2583('0x53'),_0x1a1879[_0x2583('0x17')],routingClient)[_0x2583('0x9')](respondWithResult(_0x32c0ba,null))[_0x2583('0xe')](handleError(_0x32c0ba,null));};exports['queueNotify']=function(_0x40369a){return function(_0x329190,_0x507f51){var _0x29c974,_0x123429;var _0x21955d=_[_0x2583('0x54')](_0x40369a);var _0x3f96d4=_0x40369a===_0x2583('0x55')?_0x2583('0x56'):_0x2583('0x57');return db[_0x21955d+_0x2583('0x58')][_0x2583('0x59')]({'raw':!![],'where':{'id':_0x329190[_0x2583('0x1a')]['id']}})[_0x2583('0x9')](function(_0x1e4831){if(_[_0x2583('0x13')](_0x1e4831)){throw new Error(_0x21955d+_0x2583('0x5a'));}_0x29c974=_0x1e4831;return db[_0x21955d+_0x2583('0x5b')]['findOne']({'where':{'id':_0x329190['body']['messageId']},'include':[{'model':db[_0x21955d+_0x2583('0x5c')],'as':_0x2583('0x5c')},{'model':db[_0x21955d+_0x3f96d4],'as':_0x2583('0x57')}]});})[_0x2583('0x9')](function(_0x115a7c){if(_['isNil'](_0x115a7c)){throw new Error(_0x21955d+_0x2583('0x5d'));}_0x123429=_0x115a7c;return _0x115a7c[_0x2583('0x5e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x2583('0x9')](function(){var _0x57cdaa={'uniqueid':_0x40369a+'.'+_0x123429['id']+'.'+_0x123429[_0x2583('0x5c')]['id'],'FromUserId':_0x329190[_0x2583('0x2e')]['id'],'type':_0x2583('0x5f')};_0x57cdaa[_0x21955d+'MessageId']=_0x123429['id'];_0x57cdaa[_0x21955d+_0x2583('0x60')]=_0x123429[_0x2583('0x5c')]['id'];_0x57cdaa[_0x2583('0x61')+_0x21955d+_0x3f96d4+'Id']=_0x123429[_0x2583('0x57')]['id'];_0x57cdaa['To'+_0x21955d+_0x2583('0x62')]=_0x29c974['id'];return db[_0x21955d+'TransferReport'][_0x2583('0x63')](_0x57cdaa);})[_0x2583('0x9')](function(){return respondWithRpcPromise(_0x2583('0x64'),{'channel':_0x40369a,'interaction':_0x123429['Interaction'],'message':_0x123429,'account':_0x123429[_0x2583('0x57')],'applications':[{'id':0x0,'priority':0x1,'app':_0x2583('0x5f'),'appdata':_0x29c974[_0x2583('0x12')]+','+(_0x123429[_0x2583('0x57')][_0x2583('0x65')]||0x12c),'interval':_0x2583('0x66')}]},routingClient);})[_0x2583('0x9')](respondWithResult(_0x507f51,null))[_0x2583('0xe')](handleError(_0x507f51,null));};};exports[_0x2583('0x67')]=function(_0x1c7528,_0x333103){var _0x6751c1,_0x691c1f;if(_[_0x2583('0x13')](_0x1c7528[_0x2583('0x2c')][_0x2583('0x68')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x41b3c3=_0x1c7528['body'][_0x2583('0x68')];var _0x1e9c20=_[_0x2583('0x54')](_0x41b3c3);var _0x3bf400=_0x41b3c3===_0x2583('0x55')?_0x2583('0x56'):_0x2583('0x57');return db[_0x2583('0x69')]['findOne']({'raw':!![],'where':{'id':_0x1c7528[_0x2583('0x1a')]['id'],'role':'agent'}})['then'](function(_0x52060d){if(_[_0x2583('0x13')](_0x52060d)){throw new Error(_0x2583('0x6a'));}_0x6751c1=_0x52060d;return db[_0x1e9c20+'Message'][_0x2583('0x59')]({'where':{'id':_0x1c7528[_0x2583('0x2c')]['messageId']},'include':[{'model':db[_0x1e9c20+'Interaction'],'as':_0x2583('0x5c')},{'model':db[_0x1e9c20+_0x3bf400],'as':_0x2583('0x57')}]});})[_0x2583('0x9')](function(_0x8e697b){if(_[_0x2583('0x13')](_0x8e697b)){throw new Error(_0x1e9c20+_0x2583('0x5d'));}_0x691c1f=_0x8e697b;return _0x8e697b['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x2583('0x9')](function(){var _0x328a17={'uniqueid':_0x41b3c3+'.'+_0x691c1f['id']+'.'+_0x691c1f[_0x2583('0x5c')]['id'],'FromUserId':_0x1c7528[_0x2583('0x2e')]['id'],'type':_0x2583('0x5f'),'ToUserId':_0x6751c1['id']};_0x328a17[_0x1e9c20+_0x2583('0x6b')]=_0x691c1f['id'];_0x328a17[_0x1e9c20+'InteractionId']=_0x691c1f[_0x2583('0x5c')]['id'];_0x328a17['From'+_0x1e9c20+_0x3bf400+'Id']=_0x691c1f['Account']['id'];return db[_0x1e9c20+_0x2583('0x6c')][_0x2583('0x63')](_0x328a17);})['then'](function(){return respondWithRpcPromise(_0x2583('0x64'),{'channel':_0x41b3c3,'interaction':_0x691c1f[_0x2583('0x5c')],'message':_0x691c1f,'account':_0x691c1f[_0x2583('0x57')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x6751c1[_0x2583('0x12')]+','+(_0x691c1f[_0x2583('0x57')]['agentTransferTimeout']||0x12c),'interval':_0x2583('0x66')}]},routingClient);})['then'](respondWithResult(_0x333103,null))[_0x2583('0xe')](handleError(_0x333103,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 3d06ceb..9aca56d 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 _0xb4ec=['get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller'];(function(_0x4c2750,_0x28b841){var _0x15faff=function(_0x4c1df1){while(--_0x4c1df1){_0x4c2750['push'](_0x4c2750['shift']());}};_0x15faff(++_0x28b841);}(_0xb4ec,0x6f));var _0xcb4e=function(_0x17178a,_0x23b5a0){_0x17178a=_0x17178a-0x0;var _0x883dd1=_0xb4ec[_0x17178a];return _0x883dd1;};'use strict';var multer=require(_0xcb4e('0x0'));var util=require(_0xcb4e('0x1'));var path=require(_0xcb4e('0x2'));var timeout=require('connect-timeout');var express=require(_0xcb4e('0x3'));var router=express[_0xcb4e('0x4')]();var auth=require(_0xcb4e('0x5'));var interaction=require(_0xcb4e('0x6'));var config=require(_0xcb4e('0x7'));var controller=require(_0xcb4e('0x8'));router[_0xcb4e('0x9')]('/',auth[_0xcb4e('0xa')](),controller[_0xcb4e('0xb')]);router['get'](_0xcb4e('0xc'),auth['isAuthenticated'](),controller[_0xcb4e('0xd')]);router[_0xcb4e('0x9')]('/:id/run',auth[_0xcb4e('0xa')](),controller['run']);router[_0xcb4e('0xe')]('/',auth[_0xcb4e('0xa')](),controller[_0xcb4e('0xf')]);router['put']('/:id',auth[_0xcb4e('0xa')](),controller[_0xcb4e('0x10')]);router[_0xcb4e('0x11')](_0xcb4e('0xc'),auth[_0xcb4e('0xa')](),controller[_0xcb4e('0x12')]);module[_0xcb4e('0x13')]=router; \ No newline at end of file +var _0x94af=['create','put','update','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','show','/:id/run','run','post'];(function(_0x5a186e,_0xbf9a12){var _0x20447a=function(_0x5af8d2){while(--_0x5af8d2){_0x5a186e['push'](_0x5a186e['shift']());}};_0x20447a(++_0xbf9a12);}(_0x94af,0x145));var _0xf94a=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x94af[_0x297fd3];return _0x2af381;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf94a('0x0'));var timeout=require(_0xf94a('0x1'));var express=require(_0xf94a('0x2'));var router=express[_0xf94a('0x3')]();var auth=require(_0xf94a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf94a('0x5'));var controller=require(_0xf94a('0x6'));router[_0xf94a('0x7')]('/',auth[_0xf94a('0x8')](),controller[_0xf94a('0x9')]);router['get'](_0xf94a('0xa'),auth[_0xf94a('0x8')](),controller[_0xf94a('0xb')]);router[_0xf94a('0x7')](_0xf94a('0xc'),auth[_0xf94a('0x8')](),controller[_0xf94a('0xd')]);router[_0xf94a('0xe')]('/',auth[_0xf94a('0x8')](),controller[_0xf94a('0xf')]);router[_0xf94a('0x10')](_0xf94a('0xa'),auth[_0xf94a('0x8')](),controller[_0xf94a('0x11')]);router['delete'](_0xf94a('0xa'),auth[_0xf94a('0x8')](),controller[_0xf94a('0x12')]);module[_0xf94a('0x13')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index e24e958..74a4438 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 _0x80c3=['days','hours','ENUM','pdf','xlsx','custom','default','BOOLEAN','TEXT','sequelize','STRING','0\x200\x20*\x20*\x20*','DATE','years','weeks'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x80c3,0x18f));var _0x380c=function(_0x5f4cd7,_0x459c44){_0x5f4cd7=_0x5f4cd7-0x0;var _0x47c93f=_0x80c3[_0x5f4cd7];return _0x47c93f;};'use strict';var Sequelize=require(_0x380c('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x380c('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x380c('0x1')],'allowNull':![],'defaultValue':_0x380c('0x2')},'startAt':{'type':Sequelize[_0x380c('0x3')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x380c('0x4'),'quarters','months',_0x380c('0x5'),_0x380c('0x6'),_0x380c('0x7'),'minutes'),'allowNull':![],'defaultValue':_0x380c('0x6')},'output':{'type':Sequelize[_0x380c('0x8')]('csv',_0x380c('0x9'),_0x380c('0xa')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x380c('0x8')](_0x380c('0xb'),_0x380c('0xc')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x380c('0xd')],'defaultValue':![]},'email':{'type':Sequelize[_0x380c('0x1')]},'cc':{'type':Sequelize[_0x380c('0xe')]},'bcc':{'type':Sequelize[_0x380c('0xe')]},'sendIfEmpty':{'type':Sequelize[_0x380c('0xd')],'defaultValue':!![]}}; \ No newline at end of file +var _0x1b9b=['DATE','quarters','months','days','hours','minutes','ENUM','csv','pdf','custom','TEXT','sequelize','STRING','BOOLEAN'];(function(_0xcd9d6,_0x895125){var _0x3801fe=function(_0x79c3af){while(--_0x79c3af){_0xcd9d6['push'](_0xcd9d6['shift']());}};_0x3801fe(++_0x895125);}(_0x1b9b,0x89));var _0xb1b9=function(_0x6f3bd0,_0x93f449){_0x6f3bd0=_0x6f3bd0-0x0;var _0x1c0461=_0x1b9b[_0x6f3bd0];return _0x1c0461;};'use strict';var Sequelize=require(_0xb1b9('0x0'));module['exports']={'name':{'type':Sequelize[_0xb1b9('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xb1b9('0x1')]},'active':{'type':Sequelize[_0xb1b9('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xb1b9('0x1')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0xb1b9('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0xb1b9('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM']('years',_0xb1b9('0x4'),_0xb1b9('0x5'),'weeks',_0xb1b9('0x6'),_0xb1b9('0x7'),_0xb1b9('0x8')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0xb1b9('0x9')](_0xb1b9('0xa'),_0xb1b9('0xb'),'xlsx'),'allowNull':![],'defaultValue':_0xb1b9('0xa')},'type':{'type':Sequelize['ENUM'](_0xb1b9('0xc'),'default'),'allowNull':![],'defaultValue':_0xb1b9('0xc')},'sendMail':{'type':Sequelize[_0xb1b9('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xb1b9('0x1')]},'cc':{'type':Sequelize[_0xb1b9('0xd')]},'bcc':{'type':Sequelize[_0xb1b9('0xd')]},'sendIfEmpty':{'type':Sequelize[_0xb1b9('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 1b93020..6376932 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 _0xebc7=['length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','type','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','../../config/schedule','run','html-pdf','zip-dir','request-promise','mustache','util','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','sendStatus','end','json','count','offset','status','set','Content-Range','apply','reject','save','update','then','destroy','get','Scheduler','UserProfileResource','error','stack','name','send','Schedule','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields'];(function(_0xd0e550,_0x566add){var _0x59ec51=function(_0x26b994){while(--_0x26b994){_0xd0e550['push'](_0xd0e550['shift']());}};_0x59ec51(++_0x566add);}(_0xebc7,0x111));var _0x7ebc=function(_0x1690fb,_0x22ffcb){_0x1690fb=_0x1690fb-0x0;var _0xbec96f=_0xebc7[_0x1690fb];return _0xbec96f;};'use strict';var pdf=require(_0x7ebc('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7ebc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7ebc('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7ebc('0x3'));var util=require(_0x7ebc('0x4'));var path=require(_0x7ebc('0x5'));var sox=require(_0x7ebc('0x6'));var csv=require(_0x7ebc('0x7'));var ejs=require(_0x7ebc('0x8'));var fs=require('fs');var _=require(_0x7ebc('0x9'));var squel=require(_0x7ebc('0xa'));var crypto=require('crypto');var jsforce=require(_0x7ebc('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7ebc('0xc'));var Papa=require(_0x7ebc('0xd'));var Redis=require(_0x7ebc('0xe'));var authService=require(_0x7ebc('0xf'));var qs=require(_0x7ebc('0x10'));var as=require(_0x7ebc('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7ebc('0x12'))(_0x7ebc('0x13'));var utils=require(_0x7ebc('0x14'));var config=require(_0x7ebc('0x15'));var db=require(_0x7ebc('0x16'))['db'];function respondWithStatusCode(_0x3cc213,_0x27d001){_0x27d001=_0x27d001||0xcc;return function(_0x4700ad){if(_0x4700ad){return _0x3cc213[_0x7ebc('0x17')](_0x27d001);}return _0x3cc213['status'](_0x27d001)[_0x7ebc('0x18')]();};}function respondWithResult(_0x278d01,_0x483071){_0x483071=_0x483071||0xc8;return function(_0x4c2092){if(_0x4c2092){return _0x278d01['status'](_0x483071)[_0x7ebc('0x19')](_0x4c2092);}};}function respondWithFilteredResult(_0x3e3bcc,_0x2c4cae){return function(_0x3e3bd6){if(_0x3e3bd6){var _0x5260af=_0x3e3bd6[_0x7ebc('0x1a')],_0x598fd1=_0x2c4cae[_0x7ebc('0x1b')],_0xa8d27b=_0x2c4cae[_0x7ebc('0x1b')]+_0x2c4cae['limit'],_0x10c5d2;if(_0xa8d27b>=_0x5260af){_0xa8d27b=_0x5260af;_0x10c5d2=0xc8;}else{_0x10c5d2=0xce;}_0x3e3bcc[_0x7ebc('0x1c')](_0x10c5d2);return _0x3e3bcc[_0x7ebc('0x1d')](_0x7ebc('0x1e'),_0x598fd1+'-'+_0xa8d27b+'/'+_0x5260af)[_0x7ebc('0x19')](_0x3e3bd6);}return null;};}function patchUpdates(_0x4af4e3){return function(_0x7fbb2e){try{jsonpatch[_0x7ebc('0x1f')](_0x7fbb2e,_0x4af4e3,!![]);}catch(_0x68a664){return BPromise[_0x7ebc('0x20')](_0x68a664);}return _0x7fbb2e[_0x7ebc('0x21')]();};}function saveUpdates(_0x32372a,_0x19ad42){return function(_0x2bff51){if(_0x2bff51){return _0x2bff51[_0x7ebc('0x22')](_0x32372a)[_0x7ebc('0x23')](function(_0x31f8b3){return _0x31f8b3;});}return null;};}function removeEntity(_0x186a59,_0x35d307){return function(_0x2f9834){if(_0x2f9834){return _0x2f9834[_0x7ebc('0x24')]()[_0x7ebc('0x23')](function(){var _0x4bb6e3=_0x2f9834[_0x7ebc('0x25')]({'plain':!![]});var _0x337e56=_0x7ebc('0x26');return db[_0x7ebc('0x27')][_0x7ebc('0x24')]({'where':{'type':_0x337e56,'resourceId':_0x4bb6e3['id']}})[_0x7ebc('0x23')](function(){return _0x2f9834;});})[_0x7ebc('0x23')](function(){_0x186a59[_0x7ebc('0x1c')](0xcc)[_0x7ebc('0x18')]();});}};}function handleEntityNotFound(_0x35fe52,_0x3f88b2){return function(_0x2f0243){if(!_0x2f0243){_0x35fe52[_0x7ebc('0x17')](0x194);}return _0x2f0243;};}function handleError(_0x4e486e,_0x6c8dff){_0x6c8dff=_0x6c8dff||0x1f4;return function(_0x388a12){logger[_0x7ebc('0x28')](_0x388a12[_0x7ebc('0x29')]);if(_0x388a12[_0x7ebc('0x2a')]){delete _0x388a12[_0x7ebc('0x2a')];}_0x4e486e[_0x7ebc('0x1c')](_0x6c8dff)[_0x7ebc('0x2b')](_0x388a12);};}exports['index']=function(_0x31f011,_0x53356f){var _0x2642fd={},_0x1318f5={},_0x4b19ee={'count':0x0,'rows':[]};var _0x913c7c=_['map'](db[_0x7ebc('0x2c')]['rawAttributes'],function(_0xd61a03){return{'name':_0xd61a03[_0x7ebc('0x2d')],'type':_0xd61a03['type'][_0x7ebc('0x2e')]};});_0x1318f5[_0x7ebc('0x2f')]=_[_0x7ebc('0x30')](_0x913c7c,'name');_0x1318f5[_0x7ebc('0x31')]=_[_0x7ebc('0x32')](_0x31f011['query']);_0x1318f5[_0x7ebc('0x33')]=_[_0x7ebc('0x34')](_0x1318f5[_0x7ebc('0x2f')],_0x1318f5[_0x7ebc('0x31')]);_0x2642fd[_0x7ebc('0x35')]=_[_0x7ebc('0x34')](_0x1318f5[_0x7ebc('0x2f')],qs[_0x7ebc('0x36')](_0x31f011[_0x7ebc('0x31')][_0x7ebc('0x36')]));_0x2642fd[_0x7ebc('0x35')]=_0x2642fd[_0x7ebc('0x35')][_0x7ebc('0x37')]?_0x2642fd[_0x7ebc('0x35')]:_0x1318f5[_0x7ebc('0x2f')];if(!_0x31f011[_0x7ebc('0x31')][_0x7ebc('0x38')](_0x7ebc('0x39'))){_0x2642fd[_0x7ebc('0x3a')]=qs[_0x7ebc('0x3a')](_0x31f011[_0x7ebc('0x31')]['limit']);_0x2642fd['offset']=qs[_0x7ebc('0x1b')](_0x31f011[_0x7ebc('0x31')][_0x7ebc('0x1b')]);}_0x2642fd[_0x7ebc('0x3b')]=qs[_0x7ebc('0x3c')](_0x31f011[_0x7ebc('0x31')]['sort']);_0x2642fd[_0x7ebc('0x3d')]=qs[_0x7ebc('0x33')](_[_0x7ebc('0x3e')](_0x31f011[_0x7ebc('0x31')],_0x1318f5[_0x7ebc('0x33')]));if(_0x31f011[_0x7ebc('0x31')][_0x7ebc('0x3f')]){_0x2642fd['where']=_['merge'](_0x2642fd[_0x7ebc('0x3d')],{'$or':_[_0x7ebc('0x30')](_0x913c7c,function(_0x455d5e){if(_0x455d5e[_0x7ebc('0x40')]!=='VIRTUAL'){var _0x219236={};_0x219236[_0x455d5e['name']]={'$like':'%'+_0x31f011[_0x7ebc('0x31')]['filter']+'%'};return _0x219236;}})});}_0x2642fd=_['merge']({},_0x2642fd,_0x31f011[_0x7ebc('0x41')]);var _0x25358e={'where':_0x2642fd[_0x7ebc('0x3d')]};return db[_0x7ebc('0x2c')]['count'](_0x25358e)['then'](function(_0x29e33a){_0x4b19ee[_0x7ebc('0x1a')]=_0x29e33a;if(_0x31f011[_0x7ebc('0x31')][_0x7ebc('0x42')]){_0x2642fd[_0x7ebc('0x43')]=[{'all':!![]}];}return db[_0x7ebc('0x2c')][_0x7ebc('0x44')](_0x2642fd);})[_0x7ebc('0x23')](function(_0x375d03){_0x4b19ee[_0x7ebc('0x45')]=_0x375d03;return _0x4b19ee;})[_0x7ebc('0x23')](respondWithFilteredResult(_0x53356f,_0x2642fd))[_0x7ebc('0x46')](handleError(_0x53356f,null));};exports['show']=function(_0x57ccb5,_0x1a2230){var _0x655b35={'raw':![],'where':{'id':_0x57ccb5[_0x7ebc('0x47')]['id']}},_0x2aef23={};_0x2aef23[_0x7ebc('0x2f')]=_[_0x7ebc('0x32')](db['Schedule'][_0x7ebc('0x48')]);_0x2aef23[_0x7ebc('0x31')]=_[_0x7ebc('0x32')](_0x57ccb5[_0x7ebc('0x31')]);_0x2aef23['filters']=_[_0x7ebc('0x34')](_0x2aef23[_0x7ebc('0x2f')],_0x2aef23[_0x7ebc('0x31')]);_0x655b35['attributes']=_[_0x7ebc('0x34')](_0x2aef23[_0x7ebc('0x2f')],qs[_0x7ebc('0x36')](_0x57ccb5[_0x7ebc('0x31')]['fields']));_0x655b35[_0x7ebc('0x35')]=_0x655b35[_0x7ebc('0x35')][_0x7ebc('0x37')]?_0x655b35['attributes']:_0x2aef23[_0x7ebc('0x2f')];if(_0x57ccb5[_0x7ebc('0x31')]['includeAll']){_0x655b35[_0x7ebc('0x43')]=[{'all':!![]}];}_0x655b35=_['merge']({},_0x655b35,_0x57ccb5['options']);return db['Schedule'][_0x7ebc('0x49')](_0x655b35)[_0x7ebc('0x23')](handleEntityNotFound(_0x1a2230,null))[_0x7ebc('0x23')](respondWithResult(_0x1a2230,null))[_0x7ebc('0x46')](handleError(_0x1a2230,null));};exports[_0x7ebc('0x4a')]=function(_0xa0ab6c,_0x49ed8d){return db[_0x7ebc('0x2c')][_0x7ebc('0x4a')](_0xa0ab6c[_0x7ebc('0x4b')],{})[_0x7ebc('0x23')](function(_0x2f6cd4){var _0x4661af=_0xa0ab6c[_0x7ebc('0x4c')][_0x7ebc('0x25')]({'plain':!![]});if(!_0x4661af)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4661af['role']===_0x7ebc('0x4c')){var _0x56673a=_0x2f6cd4[_0x7ebc('0x25')]({'plain':!![]});var _0x1496d0='Scheduler';return db[_0x7ebc('0x4d')][_0x7ebc('0x49')]({'where':{'name':_0x1496d0,'userProfileId':_0x4661af[_0x7ebc('0x4e')]},'raw':!![]})['then'](function(_0x2f7088){if(_0x2f7088&&_0x2f7088[_0x7ebc('0x4f')]===0x0){return db[_0x7ebc('0x27')][_0x7ebc('0x4a')]({'name':_0x56673a[_0x7ebc('0x2a')],'resourceId':_0x56673a['id'],'type':_0x2f7088['name'],'sectionId':_0x2f7088['id']},{})[_0x7ebc('0x23')](function(){return _0x2f6cd4;});}else{return _0x2f6cd4;}})['catch'](function(_0x3fa1ff){logger[_0x7ebc('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3fa1ff);throw _0x3fa1ff;});}return _0x2f6cd4;})[_0x7ebc('0x23')](respondWithResult(_0x49ed8d,0xc9))['catch'](handleError(_0x49ed8d,null));};exports['update']=function(_0x28e6c6,_0x197d33){if(_0x28e6c6[_0x7ebc('0x4b')]['id']){delete _0x28e6c6[_0x7ebc('0x4b')]['id'];}return db['Schedule'][_0x7ebc('0x49')]({'where':{'id':_0x28e6c6[_0x7ebc('0x47')]['id']}})['then'](handleEntityNotFound(_0x197d33,null))['then'](saveUpdates(_0x28e6c6[_0x7ebc('0x4b')],null))[_0x7ebc('0x23')](respondWithResult(_0x197d33,null))[_0x7ebc('0x46')](handleError(_0x197d33,null));};exports[_0x7ebc('0x24')]=function(_0x3508b6,_0x2ac0af){return db[_0x7ebc('0x2c')]['find']({'where':{'id':_0x3508b6[_0x7ebc('0x47')]['id']}})[_0x7ebc('0x23')](handleEntityNotFound(_0x2ac0af,null))[_0x7ebc('0x23')](removeEntity(_0x2ac0af,null))['catch'](handleError(_0x2ac0af,null));};exports['run']=function(_0x849339,_0x373496,_0x3d84a8){var _0x30880a=require(_0x7ebc('0x50'));return db[_0x7ebc('0x2c')][_0x7ebc('0x49')]({'where':{'id':_0x849339[_0x7ebc('0x47')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x373496,null))['then'](function(){_0x30880a[_0x7ebc('0x51')](_0x849339[_0x7ebc('0x47')]['id']);})['then'](respondWithStatusCode(_0x373496,null))[_0x7ebc('0x46')](handleError(_0x373496,null));}; \ No newline at end of file +var _0x08cc=['zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','Schedule','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','params','length','find','create','user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','run','eml-format'];(function(_0x387f93,_0x3266ca){var _0x41b457=function(_0x46f80e){while(--_0x46f80e){_0x387f93['push'](_0x387f93['shift']());}};_0x41b457(++_0x3266ca);}(_0x08cc,0x1df));var _0xc08c=function(_0x126f8f,_0x475057){_0x126f8f=_0x126f8f-0x0;var _0x5d19d0=_0x08cc[_0x126f8f];return _0x5d19d0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc08c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc08c('0x1'));var jsonpatch=require(_0xc08c('0x2'));var rp=require(_0xc08c('0x3'));var moment=require('moment');var BPromise=require(_0xc08c('0x4'));var Mustache=require(_0xc08c('0x5'));var util=require('util');var path=require(_0xc08c('0x6'));var sox=require(_0xc08c('0x7'));var csv=require(_0xc08c('0x8'));var ejs=require(_0xc08c('0x9'));var fs=require('fs');var _=require(_0xc08c('0xa'));var squel=require(_0xc08c('0xb'));var crypto=require(_0xc08c('0xc'));var jsforce=require(_0xc08c('0xd'));var deskjs=require(_0xc08c('0xe'));var toCsv=require(_0xc08c('0x8'));var querystring=require(_0xc08c('0xf'));var Papa=require(_0xc08c('0x10'));var Redis=require('ioredis');var authService=require(_0xc08c('0x11'));var qs=require(_0xc08c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc08c('0x13'));var logger=require('../../config/logger')(_0xc08c('0x14'));var utils=require(_0xc08c('0x15'));var config=require(_0xc08c('0x16'));var db=require(_0xc08c('0x17'))['db'];function respondWithStatusCode(_0x4010cf,_0x3008a1){_0x3008a1=_0x3008a1||0xcc;return function(_0x88898a){if(_0x88898a){return _0x4010cf[_0xc08c('0x18')](_0x3008a1);}return _0x4010cf[_0xc08c('0x19')](_0x3008a1)[_0xc08c('0x1a')]();};}function respondWithResult(_0x532810,_0x348763){_0x348763=_0x348763||0xc8;return function(_0x57d00c){if(_0x57d00c){return _0x532810[_0xc08c('0x19')](_0x348763)[_0xc08c('0x1b')](_0x57d00c);}};}function respondWithFilteredResult(_0x279882,_0x1df954){return function(_0x1abcfd){if(_0x1abcfd){var _0x3031b8=_0x1abcfd[_0xc08c('0x1c')],_0x482f08=_0x1df954[_0xc08c('0x1d')],_0x12aed2=_0x1df954[_0xc08c('0x1d')]+_0x1df954[_0xc08c('0x1e')],_0xc413fb;if(_0x12aed2>=_0x3031b8){_0x12aed2=_0x3031b8;_0xc413fb=0xc8;}else{_0xc413fb=0xce;}_0x279882['status'](_0xc413fb);return _0x279882[_0xc08c('0x1f')]('Content-Range',_0x482f08+'-'+_0x12aed2+'/'+_0x3031b8)[_0xc08c('0x1b')](_0x1abcfd);}return null;};}function patchUpdates(_0x57c73a){return function(_0x35186a){try{jsonpatch['apply'](_0x35186a,_0x57c73a,!![]);}catch(_0x4ca620){return BPromise['reject'](_0x4ca620);}return _0x35186a[_0xc08c('0x20')]();};}function saveUpdates(_0x40470b,_0x4b7ece){return function(_0x17e66c){if(_0x17e66c){return _0x17e66c[_0xc08c('0x21')](_0x40470b)[_0xc08c('0x22')](function(_0x59a92e){return _0x59a92e;});}return null;};}function removeEntity(_0x286f52,_0x3bb185){return function(_0x69d3b3){if(_0x69d3b3){return _0x69d3b3[_0xc08c('0x23')]()[_0xc08c('0x22')](function(){var _0x1c2413=_0x69d3b3['get']({'plain':!![]});var _0x226565='Scheduler';return db[_0xc08c('0x24')][_0xc08c('0x23')]({'where':{'type':_0x226565,'resourceId':_0x1c2413['id']}})['then'](function(){return _0x69d3b3;});})[_0xc08c('0x22')](function(){_0x286f52[_0xc08c('0x19')](0xcc)[_0xc08c('0x1a')]();});}};}function handleEntityNotFound(_0x1bfcc6,_0x1cd67c){return function(_0x3938e2){if(!_0x3938e2){_0x1bfcc6[_0xc08c('0x18')](0x194);}return _0x3938e2;};}function handleError(_0x23c2f9,_0x136127){_0x136127=_0x136127||0x1f4;return function(_0x2b3c97){logger[_0xc08c('0x25')](_0x2b3c97[_0xc08c('0x26')]);if(_0x2b3c97[_0xc08c('0x27')]){delete _0x2b3c97[_0xc08c('0x27')];}_0x23c2f9[_0xc08c('0x19')](_0x136127)[_0xc08c('0x28')](_0x2b3c97);};}exports[_0xc08c('0x29')]=function(_0x950f04,_0x5aaeb9){var _0x979c9c={},_0x37c6ba={},_0x4d3f18={'count':0x0,'rows':[]};var _0x3eddce=_['map'](db[_0xc08c('0x2a')][_0xc08c('0x2b')],function(_0x2536d2){return{'name':_0x2536d2['fieldName'],'type':_0x2536d2[_0xc08c('0x2c')][_0xc08c('0x2d')]};});_0x37c6ba[_0xc08c('0x2e')]=_[_0xc08c('0x2f')](_0x3eddce,_0xc08c('0x27'));_0x37c6ba[_0xc08c('0x30')]=_[_0xc08c('0x31')](_0x950f04[_0xc08c('0x30')]);_0x37c6ba[_0xc08c('0x32')]=_[_0xc08c('0x33')](_0x37c6ba[_0xc08c('0x2e')],_0x37c6ba['query']);_0x979c9c[_0xc08c('0x34')]=_[_0xc08c('0x33')](_0x37c6ba['model'],qs[_0xc08c('0x35')](_0x950f04[_0xc08c('0x30')]['fields']));_0x979c9c['attributes']=_0x979c9c[_0xc08c('0x34')]['length']?_0x979c9c[_0xc08c('0x34')]:_0x37c6ba[_0xc08c('0x2e')];if(!_0x950f04[_0xc08c('0x30')][_0xc08c('0x36')](_0xc08c('0x37'))){_0x979c9c[_0xc08c('0x1e')]=qs['limit'](_0x950f04[_0xc08c('0x30')][_0xc08c('0x1e')]);_0x979c9c[_0xc08c('0x1d')]=qs[_0xc08c('0x1d')](_0x950f04[_0xc08c('0x30')][_0xc08c('0x1d')]);}_0x979c9c[_0xc08c('0x38')]=qs['sort'](_0x950f04[_0xc08c('0x30')][_0xc08c('0x39')]);_0x979c9c[_0xc08c('0x3a')]=qs['filters'](_[_0xc08c('0x3b')](_0x950f04[_0xc08c('0x30')],_0x37c6ba[_0xc08c('0x32')]));if(_0x950f04['query'][_0xc08c('0x3c')]){_0x979c9c[_0xc08c('0x3a')]=_[_0xc08c('0x3d')](_0x979c9c[_0xc08c('0x3a')],{'$or':_['map'](_0x3eddce,function(_0x2c82b5){if(_0x2c82b5[_0xc08c('0x2c')]!=='VIRTUAL'){var _0x176d37={};_0x176d37[_0x2c82b5[_0xc08c('0x27')]]={'$like':'%'+_0x950f04['query'][_0xc08c('0x3c')]+'%'};return _0x176d37;}})});}_0x979c9c=_[_0xc08c('0x3d')]({},_0x979c9c,_0x950f04['options']);var _0x19c23a={'where':_0x979c9c[_0xc08c('0x3a')]};return db[_0xc08c('0x2a')][_0xc08c('0x1c')](_0x19c23a)[_0xc08c('0x22')](function(_0x15b5b1){_0x4d3f18['count']=_0x15b5b1;if(_0x950f04[_0xc08c('0x30')][_0xc08c('0x3e')]){_0x979c9c[_0xc08c('0x3f')]=[{'all':!![]}];}return db[_0xc08c('0x2a')][_0xc08c('0x40')](_0x979c9c);})[_0xc08c('0x22')](function(_0x1f614c){_0x4d3f18[_0xc08c('0x41')]=_0x1f614c;return _0x4d3f18;})[_0xc08c('0x22')](respondWithFilteredResult(_0x5aaeb9,_0x979c9c))[_0xc08c('0x42')](handleError(_0x5aaeb9,null));};exports['show']=function(_0x319c8c,_0x351eca){var _0xf3e0e7={'raw':![],'where':{'id':_0x319c8c[_0xc08c('0x43')]['id']}},_0x2eb048={};_0x2eb048[_0xc08c('0x2e')]=_[_0xc08c('0x31')](db['Schedule']['rawAttributes']);_0x2eb048[_0xc08c('0x30')]=_['keys'](_0x319c8c[_0xc08c('0x30')]);_0x2eb048[_0xc08c('0x32')]=_[_0xc08c('0x33')](_0x2eb048[_0xc08c('0x2e')],_0x2eb048[_0xc08c('0x30')]);_0xf3e0e7['attributes']=_[_0xc08c('0x33')](_0x2eb048[_0xc08c('0x2e')],qs[_0xc08c('0x35')](_0x319c8c[_0xc08c('0x30')][_0xc08c('0x35')]));_0xf3e0e7['attributes']=_0xf3e0e7[_0xc08c('0x34')][_0xc08c('0x44')]?_0xf3e0e7[_0xc08c('0x34')]:_0x2eb048['model'];if(_0x319c8c[_0xc08c('0x30')][_0xc08c('0x3e')]){_0xf3e0e7[_0xc08c('0x3f')]=[{'all':!![]}];}_0xf3e0e7=_[_0xc08c('0x3d')]({},_0xf3e0e7,_0x319c8c['options']);return db[_0xc08c('0x2a')][_0xc08c('0x45')](_0xf3e0e7)[_0xc08c('0x22')](handleEntityNotFound(_0x351eca,null))[_0xc08c('0x22')](respondWithResult(_0x351eca,null))['catch'](handleError(_0x351eca,null));};exports[_0xc08c('0x46')]=function(_0x44b0f4,_0x27780e){return db[_0xc08c('0x2a')][_0xc08c('0x46')](_0x44b0f4['body'],{})['then'](function(_0x4d968f){var _0x316ab9=_0x44b0f4[_0xc08c('0x47')]['get']({'plain':!![]});if(!_0x316ab9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x316ab9[_0xc08c('0x48')]===_0xc08c('0x47')){var _0x4c26de=_0x4d968f[_0xc08c('0x49')]({'plain':!![]});var _0x58d2c3='Scheduler';return db[_0xc08c('0x4a')][_0xc08c('0x45')]({'where':{'name':_0x58d2c3,'userProfileId':_0x316ab9[_0xc08c('0x4b')]},'raw':!![]})[_0xc08c('0x22')](function(_0x2c09f4){if(_0x2c09f4&&_0x2c09f4[_0xc08c('0x4c')]===0x0){return db[_0xc08c('0x24')][_0xc08c('0x46')]({'name':_0x4c26de['name'],'resourceId':_0x4c26de['id'],'type':_0x2c09f4[_0xc08c('0x27')],'sectionId':_0x2c09f4['id']},{})[_0xc08c('0x22')](function(){return _0x4d968f;});}else{return _0x4d968f;}})[_0xc08c('0x42')](function(_0x2dc915){logger['error'](_0xc08c('0x4d'),_0x2dc915);throw _0x2dc915;});}return _0x4d968f;})['then'](respondWithResult(_0x27780e,0xc9))[_0xc08c('0x42')](handleError(_0x27780e,null));};exports[_0xc08c('0x21')]=function(_0x48db70,_0x24dddb){if(_0x48db70[_0xc08c('0x4e')]['id']){delete _0x48db70[_0xc08c('0x4e')]['id'];}return db[_0xc08c('0x2a')]['find']({'where':{'id':_0x48db70[_0xc08c('0x43')]['id']}})[_0xc08c('0x22')](handleEntityNotFound(_0x24dddb,null))['then'](saveUpdates(_0x48db70[_0xc08c('0x4e')],null))['then'](respondWithResult(_0x24dddb,null))['catch'](handleError(_0x24dddb,null));};exports[_0xc08c('0x23')]=function(_0x3568db,_0x2e3627){return db['Schedule'][_0xc08c('0x45')]({'where':{'id':_0x3568db[_0xc08c('0x43')]['id']}})[_0xc08c('0x22')](handleEntityNotFound(_0x2e3627,null))[_0xc08c('0x22')](removeEntity(_0x2e3627,null))['catch'](handleError(_0x2e3627,null));};exports[_0xc08c('0x4f')]=function(_0x53a5f5,_0x12d6c9,_0x3ecaf5){var _0x3cd73c=require('../../config/schedule');return db[_0xc08c('0x2a')][_0xc08c('0x45')]({'where':{'id':_0x53a5f5[_0xc08c('0x43')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x12d6c9,null))[_0xc08c('0x22')](function(){_0x3cd73c[_0xc08c('0x4f')](_0x53a5f5[_0xc08c('0x43')]['id']);})[_0xc08c('0x22')](respondWithStatusCode(_0x12d6c9,null))[_0xc08c('0x42')](handleError(_0x12d6c9,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 9eea6c6..54a33c7 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 _0x7b05=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','Schedule','lodash','util'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x7b05,0x1ea));var _0x57b0=function(_0x3a8db5,_0x31cff7){_0x3a8db5=_0x3a8db5-0x0;var _0x2c03cd=_0x7b05[_0x3a8db5];return _0x2c03cd;};'use strict';var _=require(_0x57b0('0x0'));var util=require(_0x57b0('0x1'));var logger=require(_0x57b0('0x2'))(_0x57b0('0x3'));var moment=require(_0x57b0('0x4'));var BPromise=require(_0x57b0('0x5'));var rp=require(_0x57b0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x57b0('0x7'));var config=require(_0x57b0('0x8'));var attributes=require('./schedule.attributes');module[_0x57b0('0x9')]=function(_0x4a4add,_0x417786){return _0x4a4add[_0x57b0('0xa')](_0x57b0('0xb'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe13d=['tools_schedules','api','request-promise','rimraf','./schedule.attributes','exports','define','Schedule'];(function(_0x56e3c8,_0x498fc3){var _0x1c86e7=function(_0x59eac4){while(--_0x59eac4){_0x56e3c8['push'](_0x56e3c8['shift']());}};_0x1c86e7(++_0x498fc3);}(_0xe13d,0x101));var _0xde13=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xe13d[_0x4baae2];return _0x1a2285;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xde13('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xde13('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde13('0x2'));var config=require('../../config/environment');var attributes=require(_0xde13('0x3'));module[_0xde13('0x4')]=function(_0x32b9f7,_0x3a1b28){return _0x32b9f7[_0xde13('0x5')](_0xde13('0x6'),attributes,{'tableName':_0xde13('0x7'),'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 c0cf708..e1c02ae 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 _0x9874=['then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x2cb4c4,_0xd735e7){var _0x4026fb=function(_0x197d3b){while(--_0x197d3b){_0x2cb4c4['push'](_0x2cb4c4['shift']());}};_0x4026fb(++_0xd735e7);}(_0x9874,0x7e));var _0x4987=function(_0x29bdef,_0x2fee37){_0x29bdef=_0x29bdef-0x0;var _0x16c46e=_0x9874[_0x29bdef];return _0x16c46e;};'use strict';var _=require(_0x4987('0x0'));var util=require('util');var moment=require(_0x4987('0x1'));var BPromise=require(_0x4987('0x2'));var rs=require(_0x4987('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4987('0x4'));var logger=require(_0x4987('0x5'))(_0x4987('0x6'));var config=require(_0x4987('0x7'));var jayson=require(_0x4987('0x8'));var client=jayson[_0x4987('0x9')][_0x4987('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x979532,_0x410df2,_0xa184c8){return new BPromise(function(_0x52ff07,_0x462143){return client[_0x4987('0xb')](_0x979532,_0xa184c8)[_0x4987('0xc')](function(_0xc9b9a3){logger[_0x4987('0xd')](_0x4987('0xe'),_0x410df2,_0x4987('0xf'));logger[_0x4987('0x10')](_0x4987('0x11'),_0x410df2,'request\x20sent',JSON['stringify'](_0xc9b9a3));if(_0xc9b9a3['error']){if(_0xc9b9a3[_0x4987('0x12')][_0x4987('0x13')]===0x1f4){logger[_0x4987('0x12')](_0x4987('0xe'),_0x410df2,_0xc9b9a3[_0x4987('0x12')][_0x4987('0x14')]);return _0x462143(_0xc9b9a3[_0x4987('0x12')]['message']);}logger[_0x4987('0x12')](_0x4987('0xe'),_0x410df2,_0xc9b9a3['error'][_0x4987('0x14')]);return _0x52ff07(_0xc9b9a3[_0x4987('0x12')][_0x4987('0x14')]);}else{logger[_0x4987('0xd')](_0x4987('0xe'),_0x410df2,_0x4987('0xf'));_0x52ff07(_0xc9b9a3[_0x4987('0x15')][_0x4987('0x14')]);}})[_0x4987('0x16')](function(_0x122fcb){logger[_0x4987('0x12')]('Schedule,\x20%s,\x20%s',_0x410df2,_0x122fcb);_0x462143(_0x122fcb);});});} \ No newline at end of file +var _0xba54=['message','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x29c306,_0x5e0918){var _0x32451c=function(_0x23f34f){while(--_0x23f34f){_0x29c306['push'](_0x29c306['shift']());}};_0x32451c(++_0x5e0918);}(_0xba54,0x1ba));var _0x4ba5=function(_0x140c71,_0x495992){_0x140c71=_0x140c71-0x0;var _0x5e5fa0=_0xba54[_0x140c71];return _0x5e5fa0;};'use strict';var _=require(_0x4ba5('0x0'));var util=require(_0x4ba5('0x1'));var moment=require(_0x4ba5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4ba5('0x3'));var db=require(_0x4ba5('0x4'))['db'];var utils=require(_0x4ba5('0x5'));var logger=require('../../config/logger')(_0x4ba5('0x6'));var config=require(_0x4ba5('0x7'));var jayson=require(_0x4ba5('0x8'));var client=jayson[_0x4ba5('0x9')][_0x4ba5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a661f,_0x526002,_0x165e3b){return new BPromise(function(_0x50b53b,_0x1d0db9){return client[_0x4ba5('0xb')](_0x1a661f,_0x165e3b)[_0x4ba5('0xc')](function(_0x2f3dde){logger[_0x4ba5('0xd')](_0x4ba5('0xe'),_0x526002,_0x4ba5('0xf'));logger[_0x4ba5('0x10')](_0x4ba5('0x11'),_0x526002,_0x4ba5('0xf'),JSON['stringify'](_0x2f3dde));if(_0x2f3dde[_0x4ba5('0x12')]){if(_0x2f3dde[_0x4ba5('0x12')][_0x4ba5('0x13')]===0x1f4){logger[_0x4ba5('0x12')](_0x4ba5('0xe'),_0x526002,_0x2f3dde['error'][_0x4ba5('0x14')]);return _0x1d0db9(_0x2f3dde['error'][_0x4ba5('0x14')]);}logger[_0x4ba5('0x12')](_0x4ba5('0xe'),_0x526002,_0x2f3dde[_0x4ba5('0x12')]['message']);return _0x50b53b(_0x2f3dde['error']['message']);}else{logger[_0x4ba5('0xd')](_0x4ba5('0xe'),_0x526002,_0x4ba5('0xf'));_0x50b53b(_0x2f3dde['result'][_0x4ba5('0x14')]);}})['catch'](function(_0x245c99){logger['error'](_0x4ba5('0xe'),_0x526002,_0x245c99);_0x1d0db9(_0x245c99);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 96fc3d6..28b60b5 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 _0xe1e0=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','describe','/:id','show','/:id/download','download','post','create','put','delete'];(function(_0x1098db,_0x39ba6b){var _0x14f090=function(_0x473ffe){while(--_0x473ffe){_0x1098db['push'](_0x1098db['shift']());}};_0x14f090(++_0x39ba6b);}(_0xe1e0,0x119));var _0x0e1e=function(_0x4d8512,_0x3cf01a){_0x4d8512=_0x4d8512-0x0;var _0x70ba69=_0xe1e0[_0x4d8512];return _0x70ba69;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0e1e('0x0'));var timeout=require(_0x0e1e('0x1'));var express=require(_0x0e1e('0x2'));var router=express[_0x0e1e('0x3')]();var auth=require(_0x0e1e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0e1e('0x5'));var controller=require(_0x0e1e('0x6'));router[_0x0e1e('0x7')]('/',auth[_0x0e1e('0x8')](),controller[_0x0e1e('0x9')]);router[_0x0e1e('0x7')]('/describe',auth[_0x0e1e('0x8')](),controller[_0x0e1e('0xa')]);router['get'](_0x0e1e('0xb'),auth['isAuthenticated'](),controller[_0x0e1e('0xc')]);router[_0x0e1e('0x7')](_0x0e1e('0xd'),auth['isAuthenticated'](),controller[_0x0e1e('0xe')]);router[_0x0e1e('0xf')]('/',auth[_0x0e1e('0x8')](),controller[_0x0e1e('0x10')]);router[_0x0e1e('0x11')](_0x0e1e('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x0e1e('0x12')](_0x0e1e('0xb'),auth[_0x0e1e('0x8')](),controller['destroy']);module[_0x0e1e('0x13')]=router; \ No newline at end of file +var _0xe1a0=['isAuthenticated','index','/describe','describe','show','/:id/download','download','post','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./screenRecording.controller','get'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0xe1a0,0x132));var _0x0e1a=function(_0x45f111,_0x3a1a4a){_0x45f111=_0x45f111-0x0;var _0x483508=_0xe1a0[_0x45f111];return _0x483508;};'use strict';var multer=require(_0x0e1a('0x0'));var util=require(_0x0e1a('0x1'));var path=require(_0x0e1a('0x2'));var timeout=require(_0x0e1a('0x3'));var express=require('express');var router=express[_0x0e1a('0x4')]();var auth=require(_0x0e1a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0e1a('0x6'));var controller=require(_0x0e1a('0x7'));router[_0x0e1a('0x8')]('/',auth[_0x0e1a('0x9')](),controller[_0x0e1a('0xa')]);router['get'](_0x0e1a('0xb'),auth['isAuthenticated'](),controller[_0x0e1a('0xc')]);router['get']('/:id',auth[_0x0e1a('0x9')](),controller[_0x0e1a('0xd')]);router[_0x0e1a('0x8')](_0x0e1a('0xe'),auth[_0x0e1a('0x9')](),controller[_0x0e1a('0xf')]);router[_0x0e1a('0x10')]('/',auth[_0x0e1a('0x9')](),controller['create']);router['put'](_0x0e1a('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x0e1a('0x12')](_0x0e1a('0x11'),auth['isAuthenticated'](),controller[_0x0e1a('0x13')]);module[_0x0e1a('0x14')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index bebd1b4..c714eac 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 _0x2bd8=['sequelize','path','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','closedAt','DATE','format','toString','MM-DD-YYYY\x20HH:mm','updatedAt'];(function(_0x519e22,_0x2ff411){var _0x106589=function(_0x28acd5){while(--_0x28acd5){_0x519e22['push'](_0x519e22['shift']());}};_0x106589(++_0x2ff411);}(_0x2bd8,0x130));var _0x82bd=function(_0x229df8,_0x36e2cf){_0x229df8=_0x229df8-0x0;var _0x543b1b=_0x2bd8[_0x229df8];return _0x543b1b;};'use strict';var Sequelize=require(_0x82bd('0x0'));var moment=require('moment');var path=require(_0x82bd('0x1'));var config=require(_0x82bd('0x2'));module[_0x82bd('0x3')]={'format':{'type':Sequelize[_0x82bd('0x4')],'get':function(){return this[_0x82bd('0x5')](_0x82bd('0x6'))?path[_0x82bd('0x7')](this['getDataValue'](_0x82bd('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x82bd('0x8')]},'channel':{'type':Sequelize[_0x82bd('0x8')]},'value':{'type':Sequelize['STRING'],'set':function(_0x19dbb1){var _0x77d7a9=_0x19dbb1[_0x82bd('0x9')](/\\/g,'/');this[_0x82bd('0xa')]('value',_0x77d7a9);}},'rating':{'type':Sequelize[_0x82bd('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x4a9b2c){this['setDataValue'](_0x82bd('0xc'),moment()['subtract'](_0x4a9b2c,'ms'));this['setDataValue'](_0x82bd('0xd'),moment());this['setDataValue']('duration',_0x4a9b2c);}},'startedAt':{'type':Sequelize[_0x82bd('0xe')],'get':function(){return moment(this[_0x82bd('0x5')]('startedAt'))[_0x82bd('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x82bd('0x10')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x82bd('0x5')](_0x82bd('0xd')))[_0x82bd('0xf')](_0x82bd('0x11'))['toString']();}},'createdAt':{'type':Sequelize[_0x82bd('0xe')],'get':function(){return moment(this[_0x82bd('0x5')]('createdAt'))[_0x82bd('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x82bd('0x10')]();}},'updatedAt':{'type':Sequelize[_0x82bd('0xe')],'get':function(){return moment(this[_0x82bd('0x5')](_0x82bd('0x12')))[_0x82bd('0xf')](_0x82bd('0x11'))[_0x82bd('0x10')]();}}}; \ No newline at end of file +var _0x7bae=['setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','format','toString','MM-DD-YYYY\x20HH:mm','createdAt','path','../../config/environment','VIRTUAL','value','extname','getDataValue','STRING','replace'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x7bae,0x13b));var _0xe7ba=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x7bae[_0x24237f];return _0x48298e;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var path=require(_0xe7ba('0x0'));var config=require(_0xe7ba('0x1'));module['exports']={'format':{'type':Sequelize[_0xe7ba('0x2')],'get':function(){return this['getDataValue'](_0xe7ba('0x3'))?path[_0xe7ba('0x4')](this[_0xe7ba('0x5')](_0xe7ba('0x3'))):undefined;}},'interactionid':{'type':Sequelize[_0xe7ba('0x6')]},'channel':{'type':Sequelize[_0xe7ba('0x6')]},'value':{'type':Sequelize[_0xe7ba('0x6')],'set':function(_0x3c5e59){var _0x10b307=_0x3c5e59[_0xe7ba('0x7')](/\\/g,'/');this[_0xe7ba('0x8')](_0xe7ba('0x3'),_0x10b307);}},'rating':{'type':Sequelize[_0xe7ba('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xe7ba('0x9')],'set':function(_0x588f08){this[_0xe7ba('0x8')](_0xe7ba('0xa'),moment()[_0xe7ba('0xb')](_0x588f08,'ms'));this[_0xe7ba('0x8')](_0xe7ba('0xc'),moment());this[_0xe7ba('0x8')](_0xe7ba('0xd'),_0x588f08);}},'startedAt':{'type':Sequelize[_0xe7ba('0xe')],'get':function(){return moment(this[_0xe7ba('0x5')]('startedAt'))[_0xe7ba('0xf')]('MM-DD-YYYY\x20HH:mm')[_0xe7ba('0x10')]();}},'closedAt':{'type':Sequelize[_0xe7ba('0xe')],'get':function(){return moment(this[_0xe7ba('0x5')](_0xe7ba('0xc')))[_0xe7ba('0xf')](_0xe7ba('0x11'))['toString']();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xe7ba('0x5')](_0xe7ba('0x12')))[_0xe7ba('0xf')]('MM-DD-YYYY\x20HH:mm')[_0xe7ba('0x10')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue']('updatedAt'))[_0xe7ba('0xf')]('MM-DD-YYYY\x20HH:mm')[_0xe7ba('0x10')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 7ed61f1..ad54add 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 _0x5cf7=['rows','catch','show','params','intersection','find','create','body','duration','closedAt','value','describe','../../components/encryptor','uniqueid','join','root','%s.cypher','secrets','recording','server/files/screen_recordings','Sequelize','download','filename','unlink','ScreenRecording\x20not\x20found','Not\x20found','destroy','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','existsSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','update','then','end','error','stack','name','send','index','map','rawAttributes','type','key','model','format','query','keys','filters','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','ScreenRecording','findAll'];(function(_0x3c487b,_0x44c5e2){var _0x1d65f6=function(_0x135e6d){while(--_0x135e6d){_0x3c487b['push'](_0x3c487b['shift']());}};_0x1d65f6(++_0x44c5e2);}(_0x5cf7,0x87));var _0x75cf=function(_0x308c3a,_0xe692e5){_0x308c3a=_0x308c3a-0x0;var _0x44e011=_0x5cf7[_0x308c3a];return _0x44e011;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x75cf('0x0'));var rimraf=require(_0x75cf('0x1'));var zipdir=require(_0x75cf('0x2'));var jsonpatch=require(_0x75cf('0x3'));var rp=require(_0x75cf('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x75cf('0x5'));var util=require(_0x75cf('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x75cf('0x7'));var squel=require(_0x75cf('0x8'));var crypto=require(_0x75cf('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x75cf('0xa'));var toCsv=require(_0x75cf('0xb'));var querystring=require(_0x75cf('0xc'));var Papa=require(_0x75cf('0xd'));var Redis=require(_0x75cf('0xe'));var authService=require(_0x75cf('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x75cf('0x10'));var hardwareService=require(_0x75cf('0x11'));var logger=require(_0x75cf('0x12'))(_0x75cf('0x13'));var utils=require('../../config/utils');var config=require(_0x75cf('0x14'));var db=require(_0x75cf('0x15'))['db'];function respondWithStatusCode(_0x4d01df,_0x5e8df0){_0x5e8df0=_0x5e8df0||0xcc;return function(_0x5bbc76){if(_0x5bbc76){return _0x4d01df[_0x75cf('0x16')](_0x5e8df0);}return _0x4d01df[_0x75cf('0x17')](_0x5e8df0)['end']();};}function respondWithResult(_0x329e14,_0x159cf9){_0x159cf9=_0x159cf9||0xc8;return function(_0x58a8bf){if(_0x58a8bf){return _0x329e14[_0x75cf('0x17')](_0x159cf9)[_0x75cf('0x18')](_0x58a8bf);}};}function respondWithFilteredResult(_0x3dd0d0,_0x15afad){return function(_0x3b6624){if(_0x3b6624){var _0x26a34c=_0x3b6624[_0x75cf('0x19')],_0x52d8eb=_0x15afad[_0x75cf('0x1a')],_0x470499=_0x15afad[_0x75cf('0x1a')]+_0x15afad[_0x75cf('0x1b')],_0x5788b7;if(_0x470499>=_0x26a34c){_0x470499=_0x26a34c;_0x5788b7=0xc8;}else{_0x5788b7=0xce;}_0x3dd0d0[_0x75cf('0x17')](_0x5788b7);return _0x3dd0d0['set'](_0x75cf('0x1c'),_0x52d8eb+'-'+_0x470499+'/'+_0x26a34c)['json'](_0x3b6624);}return null;};}function patchUpdates(_0x860307){return function(_0x47e6db){try{jsonpatch[_0x75cf('0x1d')](_0x47e6db,_0x860307,!![]);}catch(_0x20d5ed){return BPromise[_0x75cf('0x1e')](_0x20d5ed);}return _0x47e6db['save']();};}function saveUpdates(_0x3cf26c,_0x2d3238){return function(_0x147de7){if(_0x147de7){return _0x147de7[_0x75cf('0x1f')](_0x3cf26c)['then'](function(_0x138b26){return _0x138b26;});}return null;};}function removeEntity(_0x5121b5,_0x3b1f79){return function(_0x22fde6){if(_0x22fde6){return _0x22fde6['destroy']()[_0x75cf('0x20')](function(){_0x5121b5[_0x75cf('0x17')](0xcc)[_0x75cf('0x21')]();});}};}function handleEntityNotFound(_0x2a995e,_0x1a3d33){return function(_0xaad22f){if(!_0xaad22f){_0x2a995e[_0x75cf('0x16')](0x194);}return _0xaad22f;};}function handleError(_0x1919e3,_0x39a346){_0x39a346=_0x39a346||0x1f4;return function(_0x592174){logger[_0x75cf('0x22')](_0x592174[_0x75cf('0x23')]);if(_0x592174['name']){delete _0x592174[_0x75cf('0x24')];}_0x1919e3[_0x75cf('0x17')](_0x39a346)[_0x75cf('0x25')](_0x592174);};}exports[_0x75cf('0x26')]=function(_0x565ea2,_0x413e79){var _0x9cf48b={},_0x24ea87={},_0x2573ff={'count':0x0,'rows':[]};var _0xd0fd51=_[_0x75cf('0x27')](db['ScreenRecording'][_0x75cf('0x28')],function(_0x2ba8b2){return{'name':_0x2ba8b2['fieldName'],'type':_0x2ba8b2[_0x75cf('0x29')][_0x75cf('0x2a')]};});_0x24ea87[_0x75cf('0x2b')]=_['differenceBy'](_[_0x75cf('0x27')](_0xd0fd51,'name'),[_0x75cf('0x2c')]);_0x24ea87[_0x75cf('0x2d')]=_[_0x75cf('0x2e')](_0x565ea2[_0x75cf('0x2d')]);_0x24ea87[_0x75cf('0x2f')]=_['intersection'](_0x24ea87[_0x75cf('0x2b')],_0x24ea87[_0x75cf('0x2d')]);_0x9cf48b[_0x75cf('0x30')]=_['intersection'](_0x24ea87['model'],qs['fields'](_0x565ea2[_0x75cf('0x2d')][_0x75cf('0x31')]));_0x9cf48b[_0x75cf('0x30')]=_0x9cf48b[_0x75cf('0x30')][_0x75cf('0x32')]?_0x9cf48b[_0x75cf('0x30')]:_0x24ea87[_0x75cf('0x2b')];if(!_0x565ea2[_0x75cf('0x2d')][_0x75cf('0x33')]('nolimit')){_0x9cf48b[_0x75cf('0x1b')]=qs[_0x75cf('0x1b')](_0x565ea2['query'][_0x75cf('0x1b')]);_0x9cf48b[_0x75cf('0x1a')]=qs['offset'](_0x565ea2[_0x75cf('0x2d')][_0x75cf('0x1a')]);}_0x9cf48b['order']=qs['sort'](_0x565ea2[_0x75cf('0x2d')][_0x75cf('0x34')]);_0x9cf48b[_0x75cf('0x35')]=qs[_0x75cf('0x2f')](_[_0x75cf('0x36')](_0x565ea2[_0x75cf('0x2d')],_0x24ea87[_0x75cf('0x2f')]));if(_0x565ea2[_0x75cf('0x2d')]['filter']){_0x9cf48b[_0x75cf('0x35')]=_[_0x75cf('0x37')](_0x9cf48b['where'],{'$or':_['map'](_0xd0fd51,function(_0x6604f9){if(_0x6604f9[_0x75cf('0x29')]!==_0x75cf('0x38')){var _0x46a73d={};_0x46a73d[_0x6604f9[_0x75cf('0x24')]]={'$like':'%'+_0x565ea2[_0x75cf('0x2d')][_0x75cf('0x39')]+'%'};return _0x46a73d;}})});}_0x9cf48b=_[_0x75cf('0x37')]({},_0x9cf48b,_0x565ea2[_0x75cf('0x3a')]);var _0x50e1e8={'where':_0x9cf48b[_0x75cf('0x35')]};return db['ScreenRecording'][_0x75cf('0x19')](_0x50e1e8)[_0x75cf('0x20')](function(_0xea1f2b){_0x2573ff[_0x75cf('0x19')]=_0xea1f2b;if(_0x565ea2[_0x75cf('0x2d')][_0x75cf('0x3b')]){_0x9cf48b[_0x75cf('0x3c')]=[{'all':!![]}];}return db[_0x75cf('0x3d')][_0x75cf('0x3e')](_0x9cf48b);})['then'](function(_0x297324){_0x2573ff[_0x75cf('0x3f')]=_0x297324;return _0x2573ff;})[_0x75cf('0x20')](respondWithFilteredResult(_0x413e79,_0x9cf48b))[_0x75cf('0x40')](handleError(_0x413e79,null));};exports[_0x75cf('0x41')]=function(_0x2ff8c0,_0x2c4b77){var _0x34e529={'raw':![],'where':{'id':_0x2ff8c0[_0x75cf('0x42')]['id']}},_0x4ef086={};_0x4ef086[_0x75cf('0x2b')]=_[_0x75cf('0x2e')](db[_0x75cf('0x3d')]['rawAttributes']);_0x4ef086[_0x75cf('0x2d')]=_[_0x75cf('0x2e')](_0x2ff8c0[_0x75cf('0x2d')]);_0x4ef086['filters']=_[_0x75cf('0x43')](_0x4ef086[_0x75cf('0x2b')],_0x4ef086['query']);_0x34e529[_0x75cf('0x30')]=_[_0x75cf('0x43')](_0x4ef086[_0x75cf('0x2b')],qs[_0x75cf('0x31')](_0x2ff8c0['query'][_0x75cf('0x31')]));_0x34e529[_0x75cf('0x30')]=_0x34e529[_0x75cf('0x30')][_0x75cf('0x32')]?_0x34e529['attributes']:_0x4ef086['model'];if(_0x2ff8c0['query'][_0x75cf('0x3b')]){_0x34e529[_0x75cf('0x3c')]=[{'all':!![]}];}_0x34e529=_['merge']({},_0x34e529,_0x2ff8c0['options']);return db[_0x75cf('0x3d')][_0x75cf('0x44')](_0x34e529)[_0x75cf('0x20')](handleEntityNotFound(_0x2c4b77,null))[_0x75cf('0x20')](respondWithResult(_0x2c4b77,null))[_0x75cf('0x40')](handleError(_0x2c4b77,null));};exports[_0x75cf('0x45')]=function(_0x30db0c,_0x13ad32){return db[_0x75cf('0x3d')]['create'](_0x30db0c['body'],{})[_0x75cf('0x20')](respondWithResult(_0x13ad32,0xc9))[_0x75cf('0x40')](handleError(_0x13ad32,null));};exports[_0x75cf('0x1f')]=function(_0x4b0e83,_0x2fdaca){if(_0x4b0e83[_0x75cf('0x46')]['id']){delete _0x4b0e83[_0x75cf('0x46')]['id'];}delete _0x4b0e83['body'][_0x75cf('0x47')];delete _0x4b0e83[_0x75cf('0x46')]['createdAt'];delete _0x4b0e83['body'][_0x75cf('0x48')];delete _0x4b0e83[_0x75cf('0x46')][_0x75cf('0x49')];return db[_0x75cf('0x3d')][_0x75cf('0x44')]({'where':{'id':_0x4b0e83[_0x75cf('0x42')]['id']}})[_0x75cf('0x20')](handleEntityNotFound(_0x2fdaca,null))[_0x75cf('0x20')](saveUpdates(_0x4b0e83['body'],null))[_0x75cf('0x20')](respondWithResult(_0x2fdaca,null))['catch'](handleError(_0x2fdaca,null));};exports[_0x75cf('0x4a')]=function(_0x287e87,_0x4645ac){return db[_0x75cf('0x3d')][_0x75cf('0x4a')]()['then'](respondWithResult(_0x4645ac,null))[_0x75cf('0x40')](handleError(_0x4645ac,null));};exports['download']=function(_0x2b0bef,_0x2f61ce,_0x49b7ae){var _0x367748=require(_0x75cf('0x4b'));var _0x1ae1ce=![];var _0x36fa3c={};if(_0x2b0bef[_0x75cf('0x2d')][_0x75cf('0x29')]&&_0x2b0bef[_0x75cf('0x2d')]['type']===_0x75cf('0x4c')){_0x36fa3c[_0x75cf('0x4c')]=_0x2b0bef[_0x75cf('0x42')]['id'];}else{_0x36fa3c['id']=_0x2b0bef['params']['id'];}return db[_0x75cf('0x3d')][_0x75cf('0x44')]({'where':_0x36fa3c,'attributes':['id','value'],'raw':!![]})[_0x75cf('0x20')](handleEntityNotFound(_0x2f61ce,null))[_0x75cf('0x20')](function(_0x5f44fc){if(_0x5f44fc){var _0x377e18=path[_0x75cf('0x4d')](config[_0x75cf('0x4e')],'server/files/screen_recordings',_0x5f44fc['value']);var _0xa5b4db=util[_0x75cf('0x2c')](_0x75cf('0x4f'),_0x377e18);if(fs['existsSync'](_0xa5b4db)){_0x1ae1ce=!![];return _0x367748['decryptFile'](_0xa5b4db,_0x377e18,config[_0x75cf('0x50')][_0x75cf('0x51')])['then'](function(){return _0x5f44fc;});}return _0x5f44fc;}})['then'](function(_0x5c9c2f){if(_0x5c9c2f){var _0x2b4c17=path[_0x75cf('0x4d')](config['root'],_0x75cf('0x52'),_0x5c9c2f[_0x75cf('0x49')]);if(!fs['existsSync'](_0x2b4c17)){throw new db[(_0x75cf('0x53'))]['ValidationError']('ScreenRecording\x20not\x20found');}if(_0x5c9c2f['filename']){return _0x2f61ce[_0x75cf('0x54')](_0x2b4c17,_0x5c9c2f[_0x75cf('0x55')]+path['extname'](_0x2b4c17),function(){if(_0x1ae1ce){fs[_0x75cf('0x56')](_0x2b4c17);}});}else{return _0x2f61ce[_0x75cf('0x54')](_0x2b4c17,function(_0x947a3a){if(_0x1ae1ce){fs[_0x75cf('0x56')](_0x2b4c17);}});}}})[_0x75cf('0x40')](function(_0x419231){if(_0x419231['message']===_0x75cf('0x57')){_0x2f61ce[_0x75cf('0x17')](0x194)[_0x75cf('0x25')](_0x75cf('0x58'));}else{return handleError(_0x2f61ce,null);}});};exports[_0x75cf('0x59')]=function(_0x26ea69,_0x1eb9b9){return db[_0x75cf('0x3d')][_0x75cf('0x44')]({'where':{'id':_0x26ea69[_0x75cf('0x42')]['id']}})[_0x75cf('0x20')](function(_0x5331f4){if(!_0x5331f4)throw new ReferenceError(_0x75cf('0x5a'));return _0x5331f4;})['then'](function(_0x4b72f3){var _0x597ba5=path['join'](config[_0x75cf('0x4e')],_0x75cf('0x52'),_0x4b72f3[_0x75cf('0x49')]);logger[_0x75cf('0x5b')](_0x75cf('0x5c'),_0x597ba5);if(!_[_0x75cf('0x5d')](_0x4b72f3[_0x75cf('0x49')])&&fs[_0x75cf('0x5e')](_0x597ba5)){logger[_0x75cf('0x5b')]('File:\x20\x22'+_0x597ba5+_0x75cf('0x5f'));fs[_0x75cf('0x60')](_0x597ba5);}_0x597ba5=_0x597ba5+_0x75cf('0x61');if(!_['isNil'](_0x4b72f3['value'])&&fs['existsSync'](_0x597ba5)){logger[_0x75cf('0x5b')](_0x75cf('0x62')+_0x597ba5+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x597ba5);}return _0x4b72f3;})[_0x75cf('0x20')](function(_0x564a74){if(!_0x564a74)throw new InternalError();return _0x564a74[_0x75cf('0x59')]();})[_0x75cf('0x20')](function(){_0x1eb9b9[_0x75cf('0x17')](0xcc)[_0x75cf('0x21')]();})['catch'](handleError(_0x1eb9b9,null));}; \ No newline at end of file +var _0x56e9=['recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','download','unlink','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','unlinkSync','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','limit','set','Content-Range','reject','save','update','then','destroy','end','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','body','duration','createdAt','closedAt','value','describe','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','format','existsSync'];(function(_0xd081f2,_0x58e091){var _0x298d29=function(_0x4039bd){while(--_0x4039bd){_0xd081f2['push'](_0xd081f2['shift']());}};_0x298d29(++_0x58e091);}(_0x56e9,0x1e9));var _0x956e=function(_0x16ef9c,_0x55568f){_0x16ef9c=_0x16ef9c-0x0;var _0x38ad91=_0x56e9[_0x16ef9c];return _0x38ad91;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x956e('0x0'));var jsonpatch=require(_0x956e('0x1'));var rp=require('request-promise');var moment=require(_0x956e('0x2'));var BPromise=require(_0x956e('0x3'));var Mustache=require(_0x956e('0x4'));var util=require(_0x956e('0x5'));var path=require(_0x956e('0x6'));var sox=require(_0x956e('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x956e('0x8'));var crypto=require('crypto');var jsforce=require(_0x956e('0x9'));var deskjs=require(_0x956e('0xa'));var toCsv=require('to-csv');var querystring=require(_0x956e('0xb'));var Papa=require(_0x956e('0xc'));var Redis=require(_0x956e('0xd'));var authService=require(_0x956e('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x956e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x956e('0x10'));var utils=require(_0x956e('0x11'));var config=require(_0x956e('0x12'));var db=require(_0x956e('0x13'))['db'];function respondWithStatusCode(_0x3e1044,_0x196da7){_0x196da7=_0x196da7||0xcc;return function(_0x5a0507){if(_0x5a0507){return _0x3e1044[_0x956e('0x14')](_0x196da7);}return _0x3e1044['status'](_0x196da7)['end']();};}function respondWithResult(_0x146b25,_0x842c75){_0x842c75=_0x842c75||0xc8;return function(_0x32320f){if(_0x32320f){return _0x146b25[_0x956e('0x15')](_0x842c75)[_0x956e('0x16')](_0x32320f);}};}function respondWithFilteredResult(_0x32b3cd,_0x27550d){return function(_0x317b57){if(_0x317b57){var _0xdaf72=_0x317b57[_0x956e('0x17')],_0x2ae14b=_0x27550d['offset'],_0x3fc3cb=_0x27550d['offset']+_0x27550d[_0x956e('0x18')],_0x5a3c7a;if(_0x3fc3cb>=_0xdaf72){_0x3fc3cb=_0xdaf72;_0x5a3c7a=0xc8;}else{_0x5a3c7a=0xce;}_0x32b3cd[_0x956e('0x15')](_0x5a3c7a);return _0x32b3cd[_0x956e('0x19')](_0x956e('0x1a'),_0x2ae14b+'-'+_0x3fc3cb+'/'+_0xdaf72)[_0x956e('0x16')](_0x317b57);}return null;};}function patchUpdates(_0x61458e){return function(_0x33340b){try{jsonpatch['apply'](_0x33340b,_0x61458e,!![]);}catch(_0x37b6ae){return BPromise[_0x956e('0x1b')](_0x37b6ae);}return _0x33340b[_0x956e('0x1c')]();};}function saveUpdates(_0x4c58d4,_0x3c00b5){return function(_0x488b5c){if(_0x488b5c){return _0x488b5c[_0x956e('0x1d')](_0x4c58d4)[_0x956e('0x1e')](function(_0x5355cb){return _0x5355cb;});}return null;};}function removeEntity(_0x16dbd4,_0x3f00af){return function(_0x540b32){if(_0x540b32){return _0x540b32[_0x956e('0x1f')]()[_0x956e('0x1e')](function(){_0x16dbd4[_0x956e('0x15')](0xcc)[_0x956e('0x20')]();});}};}function handleEntityNotFound(_0x18869d,_0x23fd6f){return function(_0x5d8c41){if(!_0x5d8c41){_0x18869d[_0x956e('0x14')](0x194);}return _0x5d8c41;};}function handleError(_0xb58fba,_0x30acd2){_0x30acd2=_0x30acd2||0x1f4;return function(_0x4011ce){logger['error'](_0x4011ce[_0x956e('0x21')]);if(_0x4011ce['name']){delete _0x4011ce[_0x956e('0x22')];}_0xb58fba[_0x956e('0x15')](_0x30acd2)[_0x956e('0x23')](_0x4011ce);};}exports[_0x956e('0x24')]=function(_0x3019be,_0x469f63){var _0x1ff945={},_0x22333d={},_0x14716b={'count':0x0,'rows':[]};var _0x3860c7=_[_0x956e('0x25')](db[_0x956e('0x26')][_0x956e('0x27')],function(_0x184539){return{'name':_0x184539[_0x956e('0x28')],'type':_0x184539[_0x956e('0x29')]['key']};});_0x22333d[_0x956e('0x2a')]=_['differenceBy'](_[_0x956e('0x25')](_0x3860c7,_0x956e('0x22')),['format']);_0x22333d['query']=_['keys'](_0x3019be[_0x956e('0x2b')]);_0x22333d['filters']=_[_0x956e('0x2c')](_0x22333d[_0x956e('0x2a')],_0x22333d['query']);_0x1ff945[_0x956e('0x2d')]=_[_0x956e('0x2c')](_0x22333d[_0x956e('0x2a')],qs[_0x956e('0x2e')](_0x3019be['query'][_0x956e('0x2e')]));_0x1ff945[_0x956e('0x2d')]=_0x1ff945[_0x956e('0x2d')][_0x956e('0x2f')]?_0x1ff945[_0x956e('0x2d')]:_0x22333d[_0x956e('0x2a')];if(!_0x3019be[_0x956e('0x2b')][_0x956e('0x30')](_0x956e('0x31'))){_0x1ff945[_0x956e('0x18')]=qs[_0x956e('0x18')](_0x3019be[_0x956e('0x2b')]['limit']);_0x1ff945[_0x956e('0x32')]=qs[_0x956e('0x32')](_0x3019be[_0x956e('0x2b')][_0x956e('0x32')]);}_0x1ff945[_0x956e('0x33')]=qs[_0x956e('0x34')](_0x3019be[_0x956e('0x2b')][_0x956e('0x34')]);_0x1ff945['where']=qs[_0x956e('0x35')](_[_0x956e('0x36')](_0x3019be['query'],_0x22333d[_0x956e('0x35')]));if(_0x3019be[_0x956e('0x2b')][_0x956e('0x37')]){_0x1ff945['where']=_[_0x956e('0x38')](_0x1ff945[_0x956e('0x39')],{'$or':_[_0x956e('0x25')](_0x3860c7,function(_0x29f91b){if(_0x29f91b[_0x956e('0x29')]!==_0x956e('0x3a')){var _0x59dd7={};_0x59dd7[_0x29f91b[_0x956e('0x22')]]={'$like':'%'+_0x3019be['query']['filter']+'%'};return _0x59dd7;}})});}_0x1ff945=_[_0x956e('0x38')]({},_0x1ff945,_0x3019be[_0x956e('0x3b')]);var _0x2209c7={'where':_0x1ff945['where']};return db['ScreenRecording']['count'](_0x2209c7)['then'](function(_0x3538a8){_0x14716b[_0x956e('0x17')]=_0x3538a8;if(_0x3019be[_0x956e('0x2b')][_0x956e('0x3c')]){_0x1ff945[_0x956e('0x3d')]=[{'all':!![]}];}return db[_0x956e('0x26')][_0x956e('0x3e')](_0x1ff945);})[_0x956e('0x1e')](function(_0x391c4b){_0x14716b[_0x956e('0x3f')]=_0x391c4b;return _0x14716b;})[_0x956e('0x1e')](respondWithFilteredResult(_0x469f63,_0x1ff945))[_0x956e('0x40')](handleError(_0x469f63,null));};exports['show']=function(_0x2baad7,_0x1fd0f9){var _0x51e88c={'raw':![],'where':{'id':_0x2baad7[_0x956e('0x41')]['id']}},_0x577838={};_0x577838[_0x956e('0x2a')]=_[_0x956e('0x42')](db['ScreenRecording'][_0x956e('0x27')]);_0x577838[_0x956e('0x2b')]=_['keys'](_0x2baad7[_0x956e('0x2b')]);_0x577838[_0x956e('0x35')]=_[_0x956e('0x2c')](_0x577838[_0x956e('0x2a')],_0x577838[_0x956e('0x2b')]);_0x51e88c[_0x956e('0x2d')]=_[_0x956e('0x2c')](_0x577838['model'],qs[_0x956e('0x2e')](_0x2baad7[_0x956e('0x2b')][_0x956e('0x2e')]));_0x51e88c[_0x956e('0x2d')]=_0x51e88c['attributes'][_0x956e('0x2f')]?_0x51e88c[_0x956e('0x2d')]:_0x577838[_0x956e('0x2a')];if(_0x2baad7[_0x956e('0x2b')]['includeAll']){_0x51e88c[_0x956e('0x3d')]=[{'all':!![]}];}_0x51e88c=_[_0x956e('0x38')]({},_0x51e88c,_0x2baad7['options']);return db[_0x956e('0x26')][_0x956e('0x43')](_0x51e88c)['then'](handleEntityNotFound(_0x1fd0f9,null))[_0x956e('0x1e')](respondWithResult(_0x1fd0f9,null))[_0x956e('0x40')](handleError(_0x1fd0f9,null));};exports['create']=function(_0x2cbd38,_0x5960b4){return db['ScreenRecording']['create'](_0x2cbd38[_0x956e('0x44')],{})[_0x956e('0x1e')](respondWithResult(_0x5960b4,0xc9))[_0x956e('0x40')](handleError(_0x5960b4,null));};exports[_0x956e('0x1d')]=function(_0x2f17a1,_0x4dcef1){if(_0x2f17a1[_0x956e('0x44')]['id']){delete _0x2f17a1[_0x956e('0x44')]['id'];}delete _0x2f17a1[_0x956e('0x44')][_0x956e('0x45')];delete _0x2f17a1['body'][_0x956e('0x46')];delete _0x2f17a1[_0x956e('0x44')][_0x956e('0x47')];delete _0x2f17a1[_0x956e('0x44')][_0x956e('0x48')];return db['ScreenRecording'][_0x956e('0x43')]({'where':{'id':_0x2f17a1[_0x956e('0x41')]['id']}})[_0x956e('0x1e')](handleEntityNotFound(_0x4dcef1,null))[_0x956e('0x1e')](saveUpdates(_0x2f17a1[_0x956e('0x44')],null))[_0x956e('0x1e')](respondWithResult(_0x4dcef1,null))[_0x956e('0x40')](handleError(_0x4dcef1,null));};exports[_0x956e('0x49')]=function(_0x4bb6aa,_0x18ce22){return db['ScreenRecording']['describe']()[_0x956e('0x1e')](respondWithResult(_0x18ce22,null))[_0x956e('0x40')](handleError(_0x18ce22,null));};exports['download']=function(_0x5ad838,_0x42f7b8,_0xeaf6cf){var _0x414fb6=require(_0x956e('0x4a'));var _0x3ccf4b=![];var _0x30ba05={};if(_0x5ad838[_0x956e('0x2b')][_0x956e('0x29')]&&_0x5ad838[_0x956e('0x2b')][_0x956e('0x29')]===_0x956e('0x4b')){_0x30ba05[_0x956e('0x4b')]=_0x5ad838['params']['id'];}else{_0x30ba05['id']=_0x5ad838[_0x956e('0x41')]['id'];}return db[_0x956e('0x26')][_0x956e('0x43')]({'where':_0x30ba05,'attributes':['id',_0x956e('0x48')],'raw':!![]})[_0x956e('0x1e')](handleEntityNotFound(_0x42f7b8,null))[_0x956e('0x1e')](function(_0x555a5c){if(_0x555a5c){var _0x1e17c4=path[_0x956e('0x4c')](config[_0x956e('0x4d')],_0x956e('0x4e'),_0x555a5c[_0x956e('0x48')]);var _0x574f23=util[_0x956e('0x4f')]('%s.cypher',_0x1e17c4);if(fs[_0x956e('0x50')](_0x574f23)){_0x3ccf4b=!![];return _0x414fb6['decryptFile'](_0x574f23,_0x1e17c4,config['secrets'][_0x956e('0x51')])[_0x956e('0x1e')](function(){return _0x555a5c;});}return _0x555a5c;}})[_0x956e('0x1e')](function(_0x37f7a9){if(_0x37f7a9){var _0x1107df=path['join'](config[_0x956e('0x4d')],'server/files/screen_recordings',_0x37f7a9['value']);if(!fs['existsSync'](_0x1107df)){throw new db[(_0x956e('0x52'))][(_0x956e('0x53'))](_0x956e('0x54'));}if(_0x37f7a9[_0x956e('0x55')]){return _0x42f7b8[_0x956e('0x56')](_0x1107df,_0x37f7a9[_0x956e('0x55')]+path['extname'](_0x1107df),function(){if(_0x3ccf4b){fs[_0x956e('0x57')](_0x1107df);}});}else{return _0x42f7b8[_0x956e('0x56')](_0x1107df,function(_0x5c588d){if(_0x3ccf4b){fs[_0x956e('0x57')](_0x1107df);}});}}})[_0x956e('0x40')](function(_0x585bd0){if(_0x585bd0['message']===_0x956e('0x54')){_0x42f7b8[_0x956e('0x15')](0x194)[_0x956e('0x23')](_0x956e('0x58'));}else{return handleError(_0x42f7b8,null);}});};exports['destroy']=function(_0x38e78f,_0x2107af){return db[_0x956e('0x26')][_0x956e('0x43')]({'where':{'id':_0x38e78f['params']['id']}})[_0x956e('0x1e')](function(_0x32b1c5){if(!_0x32b1c5)throw new ReferenceError(_0x956e('0x59'));return _0x32b1c5;})['then'](function(_0x200183){var _0x13dd4c=path[_0x956e('0x4c')](config['root'],_0x956e('0x4e'),_0x200183[_0x956e('0x48')]);logger[_0x956e('0x5a')](_0x956e('0x5b'),_0x13dd4c);if(!_[_0x956e('0x5c')](_0x200183[_0x956e('0x48')])&&fs[_0x956e('0x50')](_0x13dd4c)){logger[_0x956e('0x5a')](_0x956e('0x5d')+_0x13dd4c+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x956e('0x5e')](_0x13dd4c);}_0x13dd4c=_0x13dd4c+'.cypher';if(!_[_0x956e('0x5c')](_0x200183['value'])&&fs[_0x956e('0x50')](_0x13dd4c)){logger[_0x956e('0x5a')](_0x956e('0x5d')+_0x13dd4c+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x13dd4c);}return _0x200183;})[_0x956e('0x1e')](function(_0x3b607b){if(!_0x3b607b)throw new InternalError();return _0x3b607b[_0x956e('0x1f')]();})[_0x956e('0x1e')](function(){_0x2107af[_0x956e('0x15')](0xcc)[_0x956e('0x20')]();})[_0x956e('0x40')](handleError(_0x2107af,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 0131545..52f07d9 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 _0x3641=['path','rimraf','../../config/environment','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1e0144,_0x1528e3){var _0x172a14=function(_0x3ab22e){while(--_0x3ab22e){_0x1e0144['push'](_0x1e0144['shift']());}};_0x172a14(++_0x1528e3);}(_0x3641,0xc9));var _0x1364=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3641[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1364('0x0'));var util=require(_0x1364('0x1'));var logger=require(_0x1364('0x2'))(_0x1364('0x3'));var moment=require(_0x1364('0x4'));var BPromise=require(_0x1364('0x5'));var rp=require(_0x1364('0x6'));var fs=require('fs');var path=require(_0x1364('0x7'));var rimraf=require(_0x1364('0x8'));var config=require(_0x1364('0x9'));var attributes=require('./screenRecording.attributes');module['exports']=function(_0x223e20,_0xf14d99){return _0x223e20['define'](_0x1364('0xa'),attributes,{'tableName':_0x1364('0xb'),'paranoid':![],'indexes':[{'name':_0x1364('0xc'),'fields':[_0x1364('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x93e5=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./screenRecording.attributes','ScreenRecording','screen_recordings','interactionid'];(function(_0x442c6b,_0xd3a99c){var _0x2c6525=function(_0x199e41){while(--_0x199e41){_0x442c6b['push'](_0x442c6b['shift']());}};_0x2c6525(++_0xd3a99c);}(_0x93e5,0x180));var _0x593e=function(_0x4b33e4,_0x2023be){_0x4b33e4=_0x4b33e4-0x0;var _0x9d9a43=_0x93e5[_0x4b33e4];return _0x9d9a43;};'use strict';var _=require('lodash');var util=require(_0x593e('0x0'));var logger=require(_0x593e('0x1'))(_0x593e('0x2'));var moment=require(_0x593e('0x3'));var BPromise=require(_0x593e('0x4'));var rp=require(_0x593e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x593e('0x6'));var config=require(_0x593e('0x7'));var attributes=require(_0x593e('0x8'));module['exports']=function(_0x54c636,_0x11b1f7){return _0x54c636['define'](_0x593e('0x9'),attributes,{'tableName':_0x593e('0xa'),'paranoid':![],'indexes':[{'name':_0x593e('0xb'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 0c0babb..9edc714 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(_0x297563,_0x5f2a2a){var _0x24e0c5=function(_0x220e16){while(--_0x220e16){_0x297563['push'](_0x297563['shift']());}};_0x24e0c5(++_0x5f2a2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _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(_0x12340b,_0xedab89){var _0x4a6a43=function(_0x36542f){while(--_0x36542f){_0x12340b['push'](_0x12340b['shift']());}};_0x4a6a43(++_0xedab89);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 b70b564..b362185 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 _0x366c=['getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','getPreferred','/:id/favicon','getFavicon','join','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','file','addLogo','diskStorage','logologin','single','addLogoLogin','preferred','favicon','addFavicon','put','update','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/:id','show','/:id/logo'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x366c,0xf4));var _0xc366=function(_0x416878,_0x5b41e7){_0x416878=_0x416878-0x0;var _0x50d256=_0x366c[_0x416878];return _0x50d256;};'use strict';var multer=require(_0xc366('0x0'));var util=require(_0xc366('0x1'));var path=require('path');var timeout=require(_0xc366('0x2'));var express=require(_0xc366('0x3'));var router=express[_0xc366('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xc366('0x5'));var config=require(_0xc366('0x6'));var controller=require(_0xc366('0x7'));router[_0xc366('0x8')]('/',auth[_0xc366('0x9')](),controller[_0xc366('0xa')]);router[_0xc366('0x8')](_0xc366('0xb'),controller[_0xc366('0xc')]);router[_0xc366('0x8')](_0xc366('0xd'),controller[_0xc366('0xe')]);router['get'](_0xc366('0xf'),controller[_0xc366('0x10')]);router[_0xc366('0x8')](_0xc366('0x11'),controller[_0xc366('0x12')]);router[_0xc366('0x8')]('/:id/preferred',controller[_0xc366('0x13')]);router['get'](_0xc366('0x14'),controller[_0xc366('0x15')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x507211,_0x1ca43c,_0x5cafd3){_0x5cafd3(null,path[_0xc366('0x16')](config[_0xc366('0x17')],_0xc366('0x18')));},'filename':function(_0x336762,_0x3d6479,_0x36c550){_0x36c550(null,util[_0xc366('0x19')](_0xc366('0x1a'),_0xc366('0x1b'),path[_0xc366('0x1c')](_0x3d6479[_0xc366('0x1d')])));}})});router[_0xc366('0x1e')](_0xc366('0xd'),upload['single'](_0xc366('0x1f')),controller[_0xc366('0x20')]);var upload=multer({'storage':multer[_0xc366('0x21')]({'destination':function(_0x19951c,_0x226a74,_0x53a682){_0x53a682(null,path['join'](config[_0xc366('0x17')],_0xc366('0x18')));},'filename':function(_0xe18839,_0xede9b2,_0x5eeb5e){_0x5eeb5e(null,util[_0xc366('0x19')](_0xc366('0x1a'),_0xc366('0x22'),path[_0xc366('0x1c')](_0xede9b2[_0xc366('0x1d')])));}})});router['post']('/:id/logo_login',upload[_0xc366('0x23')](_0xc366('0x1f')),controller[_0xc366('0x24')]);var upload=multer({'storage':multer[_0xc366('0x21')]({'destination':function(_0x27d4ba,_0x4a3996,_0x3d85d9){_0x3d85d9(null,path['join'](config[_0xc366('0x17')],_0xc366('0x18')));},'filename':function(_0x58229a,_0x157681,_0x87c667){_0x87c667(null,util[_0xc366('0x19')](_0xc366('0x1a'),_0xc366('0x25'),path[_0xc366('0x1c')](_0x157681['originalname'])));}})});router[_0xc366('0x1e')]('/:id/preferred',upload[_0xc366('0x23')](_0xc366('0x1f')),controller['addPreferred']);var upload=multer({'storage':multer[_0xc366('0x21')]({'destination':function(_0x4c5373,_0x5c351b,_0xd067e9){_0xd067e9(null,path['join'](config[_0xc366('0x17')],'server/files/images/logos/'));},'filename':function(_0x589ed1,_0x166ad6,_0x4c646f){_0x4c646f(null,util['format'](_0xc366('0x1a'),_0xc366('0x26'),path['extname'](_0x166ad6[_0xc366('0x1d')])));}})});router[_0xc366('0x1e')]('/:id/favicon',upload[_0xc366('0x23')](_0xc366('0x1f')),controller[_0xc366('0x27')]);router[_0xc366('0x28')](_0xc366('0xb'),auth[_0xc366('0x9')](),controller[_0xc366('0x29')]);module[_0xc366('0x2a')]=router; \ No newline at end of file +var _0x7b86=['/:id/preferred','getPreferred','/:id/favicon','getFavicon','join','root','server/files/images/logos/','logo','extname','originalname','post','file','addLogo','diskStorage','format','%s%s','logologin','single','favicon','addFavicon','put','update','exports','multer','util','path','express','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/:id','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7b86,0xb3));var _0x67b8=function(_0x27e0a9,_0x25ad01){_0x27e0a9=_0x27e0a9-0x0;var _0x51d645=_0x7b86[_0x27e0a9];return _0x51d645;};'use strict';var multer=require(_0x67b8('0x0'));var util=require(_0x67b8('0x1'));var path=require(_0x67b8('0x2'));var timeout=require('connect-timeout');var express=require(_0x67b8('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x67b8('0x4'));var config=require(_0x67b8('0x5'));var controller=require(_0x67b8('0x6'));router[_0x67b8('0x7')]('/',auth[_0x67b8('0x8')](),controller[_0x67b8('0x9')]);router[_0x67b8('0x7')](_0x67b8('0xa'),controller['show']);router[_0x67b8('0x7')](_0x67b8('0xb'),controller['getLogo']);router[_0x67b8('0x7')](_0x67b8('0xc'),controller[_0x67b8('0xd')]);router[_0x67b8('0x7')](_0x67b8('0xe'),controller[_0x67b8('0xf')]);router[_0x67b8('0x7')](_0x67b8('0x10'),controller[_0x67b8('0x11')]);router['get'](_0x67b8('0x12'),controller[_0x67b8('0x13')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x187442,_0x1d444f,_0x212bcd){_0x212bcd(null,path[_0x67b8('0x14')](config[_0x67b8('0x15')],_0x67b8('0x16')));},'filename':function(_0x389b5d,_0x31c1ce,_0xea979){_0xea979(null,util['format']('%s%s',_0x67b8('0x17'),path[_0x67b8('0x18')](_0x31c1ce[_0x67b8('0x19')])));}})});router[_0x67b8('0x1a')](_0x67b8('0xb'),upload['single'](_0x67b8('0x1b')),controller[_0x67b8('0x1c')]);var upload=multer({'storage':multer[_0x67b8('0x1d')]({'destination':function(_0x4be2af,_0x4a01d1,_0x2fc2d2){_0x2fc2d2(null,path[_0x67b8('0x14')](config[_0x67b8('0x15')],_0x67b8('0x16')));},'filename':function(_0x3d624c,_0x380001,_0x378fce){_0x378fce(null,util[_0x67b8('0x1e')](_0x67b8('0x1f'),_0x67b8('0x20'),path[_0x67b8('0x18')](_0x380001[_0x67b8('0x19')])));}})});router[_0x67b8('0x1a')](_0x67b8('0xc'),upload[_0x67b8('0x21')]('file'),controller['addLogoLogin']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x153311,_0x20c2a3,_0x3eabe5){_0x3eabe5(null,path[_0x67b8('0x14')](config[_0x67b8('0x15')],_0x67b8('0x16')));},'filename':function(_0x32ab2c,_0x4c4ad9,_0x604421){_0x604421(null,util[_0x67b8('0x1e')](_0x67b8('0x1f'),'preferred',path[_0x67b8('0x18')](_0x4c4ad9[_0x67b8('0x19')])));}})});router[_0x67b8('0x1a')]('/:id/preferred',upload[_0x67b8('0x21')](_0x67b8('0x1b')),controller['addPreferred']);var upload=multer({'storage':multer[_0x67b8('0x1d')]({'destination':function(_0x521a0f,_0x3305d1,_0x3fb6f5){_0x3fb6f5(null,path[_0x67b8('0x14')](config['root'],_0x67b8('0x16')));},'filename':function(_0x320ae9,_0x1f83fa,_0x2aa91f){_0x2aa91f(null,util['format'](_0x67b8('0x1f'),_0x67b8('0x22'),path[_0x67b8('0x18')](_0x1f83fa[_0x67b8('0x19')])));}})});router['post'](_0x67b8('0x12'),upload[_0x67b8('0x21')]('file'),controller[_0x67b8('0x23')]);router[_0x67b8('0x24')](_0x67b8('0xa'),auth[_0x67b8('0x8')](),controller[_0x67b8('0x25')]);module[_0x67b8('0x26')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 76557f3..eb4b9ae 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 _0x4ed9=['exports','INTEGER','min_internal','min_mailbox','STRING','BOOLEAN','alternate','sequelize'];(function(_0x3fb396,_0x3339cf){var _0xc9ea16=function(_0x1aa880){while(--_0x1aa880){_0x3fb396['push'](_0x3fb396['shift']());}};_0xc9ea16(++_0x3339cf);}(_0x4ed9,0xaf));var _0x94ed=function(_0x4818bc,_0xff2f95){_0x4818bc=_0x4818bc-0x0;var _0x505869=_0x4ed9[_0x4818bc];return _0x505869;};'use strict';var Sequelize=require(_0x94ed('0x0'));module[_0x94ed('0x1')]={'min_internal':{'type':Sequelize[_0x94ed('0x2')](0xb),'unique':_0x94ed('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x94ed('0x2')](0xb),'unique':_0x94ed('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x94ed('0x5')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0x94ed('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x94ed('0x5')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x94ed('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x94ed('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x94ed('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x94ed('0x5')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0x94ed('0x5')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x94ed('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x94ed('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x94ed('0x5')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x94ed('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x94ed('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x94ed('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x94ed('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x94ed('0x5')],'defaultValue':_0x94ed('0x7')},'chatTimeout':{'type':Sequelize[_0x94ed('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x94ed('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x94ed('0x5')]},'defaultPreferred':{'type':Sequelize[_0x94ed('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x94ed('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x94ed('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x94ed('0x5')]},'defaultFavicon':{'type':Sequelize[_0x94ed('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x94ed('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'googleSsoEnabled':{'type':Sequelize[_0x94ed('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x8eb7=['/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','sequelize','exports','INTEGER','min_internal','min_mailbox','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8eb7,0x1a8));var _0x78eb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8eb7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x78eb('0x0'));module[_0x78eb('0x1')]={'min_internal':{'type':Sequelize[_0x78eb('0x2')](0xb),'unique':_0x78eb('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x78eb('0x2')](0xb),'unique':_0x78eb('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x78eb('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x78eb('0x5')],'defaultValue':_0x78eb('0x6')},'logo':{'type':Sequelize[_0x78eb('0x5')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x78eb('0x5')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x78eb('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x78eb('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x78eb('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x78eb('0x5')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0x78eb('0x5')]},'pageTitle':{'type':Sequelize[_0x78eb('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x78eb('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x78eb('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x78eb('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0x78eb('0x8')},'enableEmailPreview':{'type':Sequelize[_0x78eb('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0x78eb('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x78eb('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x78eb('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x78eb('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x78eb('0x5')],'defaultValue':_0x78eb('0x9')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x78eb('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x78eb('0x5')]},'defaultPreferred':{'type':Sequelize[_0x78eb('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x78eb('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x78eb('0x5')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x78eb('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x78eb('0x5')]},'defaultFavicon':{'type':Sequelize[_0x78eb('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x78eb('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'googleSsoEnabled':{'type':Sequelize[_0x78eb('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 5632ba5..01f01d7 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 _0xaba8=['body','addLogo','file','logo','addLogoLogin','filename','loginLogo','getLogo','getLicense','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','toLower','root','default_logo.png','default','upperFirst','download','../../config/license/util','server/files/images/logos','preferred','custom','ValidationError','securePassword','getPreferred','default_preferred.png','\x20not\x20found','addFavicon','getFavicon','default_favicon.ico','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','jayson/promise','client','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','Setting','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','pick','merge','where','VIRTUAL','filter','options','include','rows','params','keys','length','includeAll','find'];(function(_0x40937b,_0x1c15fd){var _0xbbe422=function(_0x5c374b){while(--_0x5c374b){_0x40937b['push'](_0x40937b['shift']());}};_0xbbe422(++_0x1c15fd);}(_0xaba8,0x95));var _0x8aba=function(_0x12e682,_0x33f3a3){_0x12e682=_0x12e682-0x0;var _0x26e600=_0xaba8[_0x12e682];return _0x26e600;};'use strict';var pdf=require(_0x8aba('0x0'));var emlformat=require(_0x8aba('0x1'));var rimraf=require(_0x8aba('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8aba('0x3'));var rp=require(_0x8aba('0x4'));var moment=require(_0x8aba('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8aba('0x6'));var util=require(_0x8aba('0x7'));var path=require(_0x8aba('0x8'));var sox=require(_0x8aba('0x9'));var csv=require(_0x8aba('0xa'));var ejs=require(_0x8aba('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8aba('0xc'));var crypto=require(_0x8aba('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8aba('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8aba('0xf'));var Papa=require(_0x8aba('0x10'));var Redis=require('ioredis');var authService=require(_0x8aba('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8aba('0x12'));var logger=require(_0x8aba('0x13'))(_0x8aba('0x14'));var utils=require('../../config/utils');var config=require(_0x8aba('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0x8aba('0x16'));var client=jayson[_0x8aba('0x17')]['http']({'port':0x232a});function checkPasswordPattern(_0x25da4b,_0x2657dd,_0x531e16){if(_0x531e16){var _0x2c7a29=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2c7a29[_0x8aba('0x18')](_0x2657dd)){return _0x25da4b;}else{throw new db[(_0x8aba('0x19'))]['ValidationError'](_0x8aba('0x1a'));}}else{return _0x25da4b;}}function respondWithRpcPromise(_0x28681f,_0x28bf2c,_0x17eac8,_0x27bd95){return new BPromise(function(_0x333e2d,_0x301f60){var _0x22ed6a=_0x27bd95||client;return _0x22ed6a['request'](_0x28681f,_0x17eac8)['then'](function(_0x3eca89){logger['info'](_0x8aba('0x1b'),_0x28bf2c,_0x8aba('0x1c'));logger[_0x8aba('0x1d')](_0x8aba('0x1e'),_0x28bf2c,_0x8aba('0x1c'),JSON[_0x8aba('0x1f')](_0x3eca89));if(_0x3eca89[_0x8aba('0x20')]){if(_0x3eca89[_0x8aba('0x20')][_0x8aba('0x21')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x28bf2c,_0x3eca89[_0x8aba('0x20')][_0x8aba('0x22')]);return _0x301f60(_0x3eca89[_0x8aba('0x20')][_0x8aba('0x22')]);}logger['error'](_0x8aba('0x1b'),_0x28bf2c,_0x3eca89['error'][_0x8aba('0x22')]);return _0x333e2d(_0x3eca89[_0x8aba('0x20')]['message']);}else{logger['info'](_0x8aba('0x1b'),_0x28bf2c,_0x8aba('0x1c'));_0x333e2d(_0x3eca89[_0x8aba('0x23')]['message']);}})[_0x8aba('0x24')](function(_0x78a6ad){logger[_0x8aba('0x20')](_0x8aba('0x1b'),_0x28bf2c,_0x78a6ad);_0x301f60(_0x78a6ad);});});}function respondWithStatusCode(_0x38ae6a,_0x1724b0){_0x1724b0=_0x1724b0||0xcc;return function(_0x335cfb){if(_0x335cfb){return _0x38ae6a['sendStatus'](_0x1724b0);}return _0x38ae6a['status'](_0x1724b0)[_0x8aba('0x25')]();};}function respondWithResult(_0x2d0984,_0x2b2220){_0x2b2220=_0x2b2220||0xc8;return function(_0x3a7e27){if(_0x3a7e27){return _0x2d0984[_0x8aba('0x26')](_0x2b2220)[_0x8aba('0x27')](_0x3a7e27);}};}function respondWithFilteredResult(_0x5cabc5,_0x179f8e){return function(_0x2d4d37){if(_0x2d4d37){var _0x3ae75e=_0x2d4d37[_0x8aba('0x28')],_0x39016a=_0x179f8e[_0x8aba('0x29')],_0x440d76=_0x179f8e[_0x8aba('0x29')]+_0x179f8e[_0x8aba('0x2a')],_0x4fdf60;if(_0x440d76>=_0x3ae75e){_0x440d76=_0x3ae75e;_0x4fdf60=0xc8;}else{_0x4fdf60=0xce;}_0x5cabc5[_0x8aba('0x26')](_0x4fdf60);return _0x5cabc5[_0x8aba('0x2b')](_0x8aba('0x2c'),_0x39016a+'-'+_0x440d76+'/'+_0x3ae75e)['json'](_0x2d4d37);}return null;};}function patchUpdates(_0x365d21){return function(_0x508f96){try{jsonpatch[_0x8aba('0x2d')](_0x508f96,_0x365d21,!![]);}catch(_0x555e28){return BPromise[_0x8aba('0x2e')](_0x555e28);}return _0x508f96[_0x8aba('0x2f')]();};}function saveUpdates(_0x147b78,_0x18f0be){return function(_0x1b9afd){if(_0x1b9afd){return _0x1b9afd[_0x8aba('0x30')](_0x147b78)[_0x8aba('0x31')](function(_0x436f09){return _0x436f09;});}return null;};}function removeEntity(_0x291ba1,_0x44537a){return function(_0x3af3ee){if(_0x3af3ee){return _0x3af3ee['destroy']()[_0x8aba('0x31')](function(){_0x291ba1[_0x8aba('0x26')](0xcc)[_0x8aba('0x25')]();});}};}function handleEntityNotFound(_0x3e4826,_0x4b6e95){return function(_0x4bf5d3){if(!_0x4bf5d3){_0x3e4826['sendStatus'](0x194);}return _0x4bf5d3;};}function handleError(_0x211261,_0x5c1d7d){_0x5c1d7d=_0x5c1d7d||0x1f4;return function(_0x1c8994){logger[_0x8aba('0x20')](_0x1c8994[_0x8aba('0x32')]);if(_0x1c8994[_0x8aba('0x33')]){delete _0x1c8994[_0x8aba('0x33')];}_0x211261[_0x8aba('0x26')](_0x5c1d7d)[_0x8aba('0x34')](_0x1c8994);};}exports[_0x8aba('0x35')]=function(_0x50e554,_0x53680c){var _0x47f8aa={},_0x90c8f5={},_0x5b78eb={'count':0x0,'rows':[]};var _0x503d08=_[_0x8aba('0x36')](db[_0x8aba('0x37')][_0x8aba('0x38')],function(_0x23c2cf){return{'name':_0x23c2cf['fieldName'],'type':_0x23c2cf[_0x8aba('0x39')][_0x8aba('0x3a')]};});_0x90c8f5[_0x8aba('0x3b')]=_['map'](_0x503d08,_0x8aba('0x33'));_0x90c8f5[_0x8aba('0x3c')]=_['keys'](_0x50e554[_0x8aba('0x3c')]);_0x90c8f5[_0x8aba('0x3d')]=_[_0x8aba('0x3e')](_0x90c8f5[_0x8aba('0x3b')],_0x90c8f5[_0x8aba('0x3c')]);_0x47f8aa['attributes']=_[_0x8aba('0x3e')](_0x90c8f5['model'],qs[_0x8aba('0x3f')](_0x50e554[_0x8aba('0x3c')]['fields']));_0x47f8aa[_0x8aba('0x40')]=_0x47f8aa[_0x8aba('0x40')]['length']?_0x47f8aa[_0x8aba('0x40')]:_0x90c8f5['model'];if(!_0x50e554[_0x8aba('0x3c')][_0x8aba('0x41')]('nolimit')){_0x47f8aa[_0x8aba('0x2a')]=qs['limit'](_0x50e554[_0x8aba('0x3c')]['limit']);_0x47f8aa['offset']=qs[_0x8aba('0x29')](_0x50e554[_0x8aba('0x3c')]['offset']);}_0x47f8aa[_0x8aba('0x42')]=qs[_0x8aba('0x43')](_0x50e554['query'][_0x8aba('0x43')]);_0x47f8aa['where']=qs[_0x8aba('0x3d')](_[_0x8aba('0x44')](_0x50e554['query'],_0x90c8f5[_0x8aba('0x3d')]));if(_0x50e554[_0x8aba('0x3c')]['filter']){_0x47f8aa['where']=_[_0x8aba('0x45')](_0x47f8aa[_0x8aba('0x46')],{'$or':_[_0x8aba('0x36')](_0x503d08,function(_0x2b38f3){if(_0x2b38f3[_0x8aba('0x39')]!==_0x8aba('0x47')){var _0x3ed00f={};_0x3ed00f[_0x2b38f3['name']]={'$like':'%'+_0x50e554[_0x8aba('0x3c')][_0x8aba('0x48')]+'%'};return _0x3ed00f;}})});}_0x47f8aa=_['merge']({},_0x47f8aa,_0x50e554[_0x8aba('0x49')]);var _0x1d30e8={'where':_0x47f8aa[_0x8aba('0x46')]};return db[_0x8aba('0x37')]['count'](_0x1d30e8)[_0x8aba('0x31')](function(_0x52d757){_0x5b78eb[_0x8aba('0x28')]=_0x52d757;if(_0x50e554[_0x8aba('0x3c')]['includeAll']){_0x47f8aa[_0x8aba('0x4a')]=[{'all':!![]}];}return db[_0x8aba('0x37')]['findAll'](_0x47f8aa);})[_0x8aba('0x31')](function(_0x21c070){_0x5b78eb[_0x8aba('0x4b')]=_0x21c070;return _0x5b78eb;})['then'](respondWithFilteredResult(_0x53680c,_0x47f8aa))[_0x8aba('0x24')](handleError(_0x53680c,null));};exports['show']=function(_0x3b4da8,_0x58dbd0){var _0x14faf5={'raw':![],'where':{'id':_0x3b4da8[_0x8aba('0x4c')]['id']}},_0x5c6eff={};_0x5c6eff[_0x8aba('0x3b')]=_[_0x8aba('0x4d')](db[_0x8aba('0x37')][_0x8aba('0x38')]);_0x5c6eff[_0x8aba('0x3c')]=_['keys'](_0x3b4da8[_0x8aba('0x3c')]);_0x5c6eff[_0x8aba('0x3d')]=_[_0x8aba('0x3e')](_0x5c6eff[_0x8aba('0x3b')],_0x5c6eff[_0x8aba('0x3c')]);_0x14faf5['attributes']=_[_0x8aba('0x3e')](_0x5c6eff[_0x8aba('0x3b')],qs[_0x8aba('0x3f')](_0x3b4da8[_0x8aba('0x3c')]['fields']));_0x14faf5[_0x8aba('0x40')]=_0x14faf5[_0x8aba('0x40')][_0x8aba('0x4e')]?_0x14faf5[_0x8aba('0x40')]:_0x5c6eff[_0x8aba('0x3b')];if(_0x3b4da8[_0x8aba('0x3c')][_0x8aba('0x4f')]){_0x14faf5['include']=[{'all':!![]}];}_0x14faf5=_['merge']({},_0x14faf5,_0x3b4da8['options']);return db['Setting'][_0x8aba('0x50')](_0x14faf5)[_0x8aba('0x31')](handleEntityNotFound(_0x58dbd0,null))[_0x8aba('0x31')](respondWithResult(_0x58dbd0,null))[_0x8aba('0x24')](handleError(_0x58dbd0,null));};exports[_0x8aba('0x30')]=function(_0x1e661c,_0x51b9c2){if(_0x1e661c['body']['id']){delete _0x1e661c[_0x8aba('0x51')]['id'];}return db[_0x8aba('0x37')][_0x8aba('0x50')]({'where':{'id':_0x1e661c[_0x8aba('0x4c')]['id']}})['then'](handleEntityNotFound(_0x51b9c2,null))[_0x8aba('0x31')](saveUpdates(_0x1e661c[_0x8aba('0x51')],null))['then'](respondWithResult(_0x51b9c2,null))[_0x8aba('0x24')](handleError(_0x51b9c2,null));};exports[_0x8aba('0x52')]=function(_0x50ef71,_0x5cad62,_0x1369c3){if(_0x50ef71[_0x8aba('0x53')]&&_0x50ef71[_0x8aba('0x53')]['filename']){_0x50ef71[_0x8aba('0x51')][_0x8aba('0x54')]=_0x50ef71['file']['filename'];}return db[_0x8aba('0x37')][_0x8aba('0x50')]({'where':{'id':_0x50ef71[_0x8aba('0x4c')]['id']}})[_0x8aba('0x31')](handleEntityNotFound(_0x5cad62,null))[_0x8aba('0x31')](saveUpdates(_0x50ef71[_0x8aba('0x51')],null))[_0x8aba('0x31')](respondWithResult(_0x5cad62,null))[_0x8aba('0x24')](handleError(_0x5cad62,null));};exports[_0x8aba('0x55')]=function(_0x35c55c,_0x2a8737,_0x28a46f){if(_0x35c55c[_0x8aba('0x53')]&&_0x35c55c[_0x8aba('0x53')][_0x8aba('0x56')]){_0x35c55c[_0x8aba('0x51')][_0x8aba('0x57')]=_0x35c55c[_0x8aba('0x53')][_0x8aba('0x56')];}return db[_0x8aba('0x37')][_0x8aba('0x50')]({'where':{'id':_0x35c55c[_0x8aba('0x4c')]['id']}})[_0x8aba('0x31')](handleEntityNotFound(_0x2a8737,null))[_0x8aba('0x31')](saveUpdates(_0x35c55c[_0x8aba('0x51')],null))[_0x8aba('0x31')](respondWithResult(_0x2a8737,null))[_0x8aba('0x24')](handleError(_0x2a8737,null));};var utilLicense=require('../../config/license/util');exports[_0x8aba('0x58')]=function(_0x10db5d,_0x5b4b53,_0x2a601e){var _0x53e0ed='server/files/images/logos';var _0x1d3f3d={'custom':![]};return utilLicense[_0x8aba('0x59')]()['then'](function(_0x5be977){if(_0x5be977){_0x1d3f3d=_0x5be977;}return db[_0x8aba('0x37')][_0x8aba('0x50')]({'where':{'id':_0x10db5d[_0x8aba('0x4c')]['id']},'attributes':['logo',_0x8aba('0x57'),'preferred',_0x8aba('0x5a'),_0x8aba('0x5b'),_0x8aba('0x5c'),_0x8aba('0x5d'),_0x8aba('0x5e')],'raw':!![]});})[_0x8aba('0x31')](handleEntityNotFound(_0x5b4b53,null))['then'](function(_0x30af75){if(_0x30af75){var _0x5ce446=_0x30af75[_0x8aba('0x54')]&&fs[_0x8aba('0x5f')](path[_0x8aba('0x60')](config['root'],_0x53e0ed,_[_0x8aba('0x61')](_0x30af75[_0x8aba('0x54')])))?path[_0x8aba('0x60')](config[_0x8aba('0x62')],_0x53e0ed,_[_0x8aba('0x61')](_0x30af75['logo'])):path[_0x8aba('0x60')](config[_0x8aba('0x62')],_0x53e0ed,_['toLower'](_0x8aba('0x63')));var _0x5b1efa=_0x8aba('0x64')+_[_0x8aba('0x65')](_0x8aba('0x54'));if(_0x30af75[_0x5b1efa]||!_0x1d3f3d['custom']){_0x5ce446=path[_0x8aba('0x60')](config['root'],_0x53e0ed,_['toLower'](_0x8aba('0x63')));}if(!fs['existsSync'](_0x5ce446)){throw new db['Sequelize']['ValidationError'](_[_0x8aba('0x65')](_0x8aba('0x54'))+'\x20not\x20found');}return _0x5b4b53[_0x8aba('0x66')](_0x5ce446);}})[_0x8aba('0x24')](handleError(_0x5b4b53,null));};var utilLicense=require(_0x8aba('0x67'));exports['getLogoLogin']=function(_0x47f374,_0x448a6c,_0x5d1ccf){var _0x19d6ef=_0x8aba('0x68');var _0x3258ac={'custom':![]};return utilLicense[_0x8aba('0x59')]()[_0x8aba('0x31')](function(_0x533f2f){if(_0x533f2f){_0x3258ac=_0x533f2f;}return db[_0x8aba('0x37')]['find']({'where':{'id':_0x47f374['params']['id']},'attributes':[_0x8aba('0x54'),_0x8aba('0x57'),_0x8aba('0x69'),_0x8aba('0x5a'),_0x8aba('0x5b'),'defaultLoginLogo',_0x8aba('0x5d'),_0x8aba('0x5e')],'raw':!![]});})[_0x8aba('0x31')](handleEntityNotFound(_0x448a6c,null))[_0x8aba('0x31')](function(_0x468aa0){if(_0x468aa0){var _0x48a522=_0x468aa0[_0x8aba('0x57')]&&fs['existsSync'](path[_0x8aba('0x60')](config[_0x8aba('0x62')],_0x19d6ef,_['toLower'](_0x468aa0[_0x8aba('0x57')])))?path['join'](config[_0x8aba('0x62')],_0x19d6ef,_[_0x8aba('0x61')](_0x468aa0['loginLogo'])):path['join'](config[_0x8aba('0x62')],_0x19d6ef,_[_0x8aba('0x61')]('default_loginLogo.png'));var _0x3d5c8f=_0x8aba('0x64')+_[_0x8aba('0x65')](_0x8aba('0x57'));if(_0x468aa0[_0x3d5c8f]||!_0x3258ac[_0x8aba('0x6a')]){_0x48a522=path[_0x8aba('0x60')](config[_0x8aba('0x62')],_0x19d6ef,_['toLower']('default_loginLogo.png'));}if(!fs[_0x8aba('0x5f')](_0x48a522)){throw new db[(_0x8aba('0x19'))][(_0x8aba('0x6b'))](_['upperFirst'](_0x8aba('0x57'))+'\x20not\x20found');}return _0x448a6c['download'](_0x48a522);}})[_0x8aba('0x24')](handleError(_0x448a6c,null));};exports['gdpr']=function(_0x582977,_0x389bfd){return db['Setting']['find']({'where':{'id':_0x582977['params']['id']},'attributes':[_0x8aba('0x6c')]})['then'](respondWithResult(_0x389bfd,null))['catch'](handleError(_0x389bfd,null));};exports['addPreferred']=function(_0x22a73a,_0x69ac20,_0x59fa82){if(_0x22a73a[_0x8aba('0x53')]&&_0x22a73a['file'][_0x8aba('0x56')]){_0x22a73a[_0x8aba('0x51')][_0x8aba('0x69')]=_0x22a73a[_0x8aba('0x53')][_0x8aba('0x56')];}return db[_0x8aba('0x37')][_0x8aba('0x50')]({'where':{'id':_0x22a73a['params']['id']}})[_0x8aba('0x31')](handleEntityNotFound(_0x69ac20,null))[_0x8aba('0x31')](saveUpdates(_0x22a73a[_0x8aba('0x51')],null))[_0x8aba('0x31')](respondWithResult(_0x69ac20,null))[_0x8aba('0x24')](handleError(_0x69ac20,null));};var utilLicense=require('../../config/license/util');exports[_0x8aba('0x6d')]=function(_0x108ab5,_0xb22bc3,_0xf2dcdb){var _0x3e2d2d='server/files/images/logos';var _0x23b1a7={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x18d170){if(_0x18d170){_0x23b1a7=_0x18d170;}return db[_0x8aba('0x37')][_0x8aba('0x50')]({'where':{'id':_0x108ab5[_0x8aba('0x4c')]['id']},'attributes':[_0x8aba('0x54'),'loginLogo',_0x8aba('0x69'),_0x8aba('0x5a'),_0x8aba('0x5b'),_0x8aba('0x5c'),_0x8aba('0x5d'),'defaultFavicon'],'raw':!![]});})[_0x8aba('0x31')](handleEntityNotFound(_0xb22bc3,null))[_0x8aba('0x31')](function(_0x455754){if(_0x455754){var _0x1d5f31=_0x455754[_0x8aba('0x69')]&&fs[_0x8aba('0x5f')](path[_0x8aba('0x60')](config[_0x8aba('0x62')],_0x3e2d2d,_[_0x8aba('0x61')](_0x455754[_0x8aba('0x69')])))?path[_0x8aba('0x60')](config['root'],_0x3e2d2d,_[_0x8aba('0x61')](_0x455754[_0x8aba('0x69')])):path[_0x8aba('0x60')](config['root'],_0x3e2d2d,_['toLower'](_0x8aba('0x6e')));var _0xcf1d3=_0x8aba('0x64')+_[_0x8aba('0x65')](_0x8aba('0x69'));if(_0x455754[_0xcf1d3]||!_0x23b1a7[_0x8aba('0x6a')]||!_0x23b1a7[_0x8aba('0x69')]){_0x1d5f31=path['join'](config['root'],_0x3e2d2d,_[_0x8aba('0x61')](_0x8aba('0x6e')));}if(!fs[_0x8aba('0x5f')](_0x1d5f31)){throw new db[(_0x8aba('0x19'))][(_0x8aba('0x6b'))](_[_0x8aba('0x65')](_0x8aba('0x69'))+_0x8aba('0x6f'));}return _0xb22bc3[_0x8aba('0x66')](_0x1d5f31);}})['catch'](handleError(_0xb22bc3,null));};exports[_0x8aba('0x70')]=function(_0x469184,_0x1242c2,_0x6660d0){if(_0x469184[_0x8aba('0x53')]&&_0x469184[_0x8aba('0x53')][_0x8aba('0x56')]){_0x469184['body'][_0x8aba('0x5a')]=_0x469184[_0x8aba('0x53')][_0x8aba('0x56')];}return db[_0x8aba('0x37')]['find']({'where':{'id':_0x469184['params']['id']}})['then'](handleEntityNotFound(_0x1242c2,null))[_0x8aba('0x31')](saveUpdates(_0x469184[_0x8aba('0x51')],null))['then'](respondWithResult(_0x1242c2,null))['catch'](handleError(_0x1242c2,null));};var utilLicense=require(_0x8aba('0x67'));exports[_0x8aba('0x71')]=function(_0x41af83,_0x24cb99,_0x9deaf8){var _0x26f131=_0x8aba('0x68');var _0x4341d2={'custom':![]};return utilLicense['getLicense']()[_0x8aba('0x31')](function(_0x58a9e0){if(_0x58a9e0){_0x4341d2=_0x58a9e0;}return db[_0x8aba('0x37')][_0x8aba('0x50')]({'where':{'id':_0x41af83[_0x8aba('0x4c')]['id']},'attributes':[_0x8aba('0x54'),'loginLogo',_0x8aba('0x69'),_0x8aba('0x5a'),_0x8aba('0x5b'),_0x8aba('0x5c'),_0x8aba('0x5d'),_0x8aba('0x5e')],'raw':!![]});})[_0x8aba('0x31')](handleEntityNotFound(_0x24cb99,null))[_0x8aba('0x31')](function(_0x4e2db8){if(_0x4e2db8){var _0x53ab4e=_0x4e2db8[_0x8aba('0x5a')]&&fs[_0x8aba('0x5f')](path[_0x8aba('0x60')](config[_0x8aba('0x62')],_0x26f131,_[_0x8aba('0x61')](_0x4e2db8[_0x8aba('0x5a')])))?path['join'](config[_0x8aba('0x62')],_0x26f131,_['toLower'](_0x4e2db8[_0x8aba('0x5a')])):path['join'](config[_0x8aba('0x62')],_0x26f131,_[_0x8aba('0x61')](_0x8aba('0x72')));var _0x1a031a=_0x8aba('0x64')+_[_0x8aba('0x65')](_0x8aba('0x5a'));if(_0x4e2db8[_0x1a031a]||!_0x4341d2[_0x8aba('0x6a')]){_0x53ab4e=path[_0x8aba('0x60')](config['root'],_0x26f131,_[_0x8aba('0x61')](_0x8aba('0x72')));}if(!fs[_0x8aba('0x5f')](_0x53ab4e)){throw new db[(_0x8aba('0x19'))][(_0x8aba('0x6b'))](_[_0x8aba('0x65')](_0x8aba('0x5a'))+'\x20not\x20found');}return _0x24cb99[_0x8aba('0x66')](_0x53ab4e);}})[_0x8aba('0x24')](handleError(_0x24cb99,null));}; \ No newline at end of file +var _0xea4d=['intersection','fields','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','count','findAll','show','params','rawAttributes','includeAll','include','find','body','file','filename','logo','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','defaultLoginLogo','defaultFavicon','existsSync','join','root','toLower','default_logo.png','default','custom','ValidationError','upperFirst','\x20not\x20found','download','../../config/license/util','getLogoLogin','preferred','favicon','defaultLogo','defaultPreferred','default_loginLogo.png','Sequelize','gdpr','getPreferred','default_preferred.png','addFavicon','default_favicon.ico','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','api','../../config/utils','client','http','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','json','offset','limit','set','Content-Range','apply','save','update','destroy','end','stack','name','send','map','Setting','fieldName','type','key','model','query','keys','filters'];(function(_0x28de53,_0x306310){var _0x16d1e0=function(_0x3611c6){while(--_0x3611c6){_0x28de53['push'](_0x28de53['shift']());}};_0x16d1e0(++_0x306310);}(_0xea4d,0x195));var _0xdea4=function(_0x3d6afd,_0x3873ab){_0x3d6afd=_0x3d6afd-0x0;var _0x46d4d8=_0xea4d[_0x3d6afd];return _0x46d4d8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdea4('0x0'));var rimraf=require(_0xdea4('0x1'));var zipdir=require(_0xdea4('0x2'));var jsonpatch=require(_0xdea4('0x3'));var rp=require(_0xdea4('0x4'));var moment=require(_0xdea4('0x5'));var BPromise=require(_0xdea4('0x6'));var Mustache=require('mustache');var util=require(_0xdea4('0x7'));var path=require('path');var sox=require(_0xdea4('0x8'));var csv=require(_0xdea4('0x9'));var ejs=require(_0xdea4('0xa'));var fs=require('fs');var _=require(_0xdea4('0xb'));var squel=require(_0xdea4('0xc'));var crypto=require(_0xdea4('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xdea4('0xe'));var toCsv=require(_0xdea4('0x9'));var querystring=require(_0xdea4('0xf'));var Papa=require(_0xdea4('0x10'));var Redis=require(_0xdea4('0x11'));var authService=require(_0xdea4('0x12'));var qs=require(_0xdea4('0x13'));var as=require(_0xdea4('0x14'));var hardwareService=require(_0xdea4('0x15'));var logger=require(_0xdea4('0x16'))(_0xdea4('0x17'));var utils=require(_0xdea4('0x18'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0xdea4('0x19')][_0xdea4('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x5867f3,_0x5b942d,_0x1ae4a1){if(_0x1ae4a1){var _0x32083d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x32083d['test'](_0x5b942d)){return _0x5867f3;}else{throw new db['Sequelize']['ValidationError'](_0xdea4('0x1b'));}}else{return _0x5867f3;}}function respondWithRpcPromise(_0x25c8d7,_0x24b3a6,_0x500854,_0x375fb8){return new BPromise(function(_0x19845f,_0xd562d){var _0xe2d5fd=_0x375fb8||client;return _0xe2d5fd[_0xdea4('0x1c')](_0x25c8d7,_0x500854)[_0xdea4('0x1d')](function(_0x18cff5){logger[_0xdea4('0x1e')](_0xdea4('0x1f'),_0x24b3a6,_0xdea4('0x20'));logger['debug'](_0xdea4('0x21'),_0x24b3a6,_0xdea4('0x20'),JSON[_0xdea4('0x22')](_0x18cff5));if(_0x18cff5[_0xdea4('0x23')]){if(_0x18cff5[_0xdea4('0x23')][_0xdea4('0x24')]===0x1f4){logger[_0xdea4('0x23')](_0xdea4('0x1f'),_0x24b3a6,_0x18cff5[_0xdea4('0x23')][_0xdea4('0x25')]);return _0xd562d(_0x18cff5[_0xdea4('0x23')][_0xdea4('0x25')]);}logger[_0xdea4('0x23')](_0xdea4('0x1f'),_0x24b3a6,_0x18cff5[_0xdea4('0x23')][_0xdea4('0x25')]);return _0x19845f(_0x18cff5[_0xdea4('0x23')][_0xdea4('0x25')]);}else{logger[_0xdea4('0x1e')]('Setting,\x20%s,\x20%s',_0x24b3a6,_0xdea4('0x20'));_0x19845f(_0x18cff5['result'][_0xdea4('0x25')]);}})[_0xdea4('0x26')](function(_0xe111c9){logger[_0xdea4('0x23')](_0xdea4('0x1f'),_0x24b3a6,_0xe111c9);_0xd562d(_0xe111c9);});});}function respondWithStatusCode(_0x40a5b1,_0x4a2982){_0x4a2982=_0x4a2982||0xcc;return function(_0x1c6c39){if(_0x1c6c39){return _0x40a5b1[_0xdea4('0x27')](_0x4a2982);}return _0x40a5b1[_0xdea4('0x28')](_0x4a2982)['end']();};}function respondWithResult(_0x5502aa,_0x521ac4){_0x521ac4=_0x521ac4||0xc8;return function(_0x3c95c5){if(_0x3c95c5){return _0x5502aa[_0xdea4('0x28')](_0x521ac4)[_0xdea4('0x29')](_0x3c95c5);}};}function respondWithFilteredResult(_0x17eb23,_0x1c3e41){return function(_0x1bef4a){if(_0x1bef4a){var _0x20890f=_0x1bef4a['count'],_0xe55180=_0x1c3e41[_0xdea4('0x2a')],_0x289698=_0x1c3e41[_0xdea4('0x2a')]+_0x1c3e41[_0xdea4('0x2b')],_0x38e3a1;if(_0x289698>=_0x20890f){_0x289698=_0x20890f;_0x38e3a1=0xc8;}else{_0x38e3a1=0xce;}_0x17eb23[_0xdea4('0x28')](_0x38e3a1);return _0x17eb23[_0xdea4('0x2c')](_0xdea4('0x2d'),_0xe55180+'-'+_0x289698+'/'+_0x20890f)[_0xdea4('0x29')](_0x1bef4a);}return null;};}function patchUpdates(_0x4cefe6){return function(_0x3f770e){try{jsonpatch[_0xdea4('0x2e')](_0x3f770e,_0x4cefe6,!![]);}catch(_0x24b06d){return BPromise['reject'](_0x24b06d);}return _0x3f770e[_0xdea4('0x2f')]();};}function saveUpdates(_0x3ebf58,_0x424016){return function(_0xf6ea1d){if(_0xf6ea1d){return _0xf6ea1d[_0xdea4('0x30')](_0x3ebf58)[_0xdea4('0x1d')](function(_0x25e931){return _0x25e931;});}return null;};}function removeEntity(_0x345c1f,_0x3a3d5e){return function(_0x3ed030){if(_0x3ed030){return _0x3ed030[_0xdea4('0x31')]()[_0xdea4('0x1d')](function(){_0x345c1f['status'](0xcc)[_0xdea4('0x32')]();});}};}function handleEntityNotFound(_0x39bc82,_0x5752f2){return function(_0x189a16){if(!_0x189a16){_0x39bc82[_0xdea4('0x27')](0x194);}return _0x189a16;};}function handleError(_0x405ec9,_0x4b99af){_0x4b99af=_0x4b99af||0x1f4;return function(_0x2770eb){logger['error'](_0x2770eb[_0xdea4('0x33')]);if(_0x2770eb[_0xdea4('0x34')]){delete _0x2770eb[_0xdea4('0x34')];}_0x405ec9[_0xdea4('0x28')](_0x4b99af)[_0xdea4('0x35')](_0x2770eb);};}exports['index']=function(_0x40a534,_0x5809af){var _0x5ae4e7={},_0x149c54={},_0x39eac3={'count':0x0,'rows':[]};var _0x14c5a3=_[_0xdea4('0x36')](db[_0xdea4('0x37')]['rawAttributes'],function(_0x40cec1){return{'name':_0x40cec1[_0xdea4('0x38')],'type':_0x40cec1[_0xdea4('0x39')][_0xdea4('0x3a')]};});_0x149c54[_0xdea4('0x3b')]=_[_0xdea4('0x36')](_0x14c5a3,_0xdea4('0x34'));_0x149c54[_0xdea4('0x3c')]=_[_0xdea4('0x3d')](_0x40a534[_0xdea4('0x3c')]);_0x149c54[_0xdea4('0x3e')]=_['intersection'](_0x149c54[_0xdea4('0x3b')],_0x149c54[_0xdea4('0x3c')]);_0x5ae4e7['attributes']=_[_0xdea4('0x3f')](_0x149c54[_0xdea4('0x3b')],qs[_0xdea4('0x40')](_0x40a534[_0xdea4('0x3c')][_0xdea4('0x40')]));_0x5ae4e7[_0xdea4('0x41')]=_0x5ae4e7[_0xdea4('0x41')][_0xdea4('0x42')]?_0x5ae4e7['attributes']:_0x149c54[_0xdea4('0x3b')];if(!_0x40a534[_0xdea4('0x3c')]['hasOwnProperty']('nolimit')){_0x5ae4e7[_0xdea4('0x2b')]=qs[_0xdea4('0x2b')](_0x40a534[_0xdea4('0x3c')][_0xdea4('0x2b')]);_0x5ae4e7[_0xdea4('0x2a')]=qs[_0xdea4('0x2a')](_0x40a534[_0xdea4('0x3c')]['offset']);}_0x5ae4e7[_0xdea4('0x43')]=qs[_0xdea4('0x44')](_0x40a534[_0xdea4('0x3c')][_0xdea4('0x44')]);_0x5ae4e7[_0xdea4('0x45')]=qs['filters'](_[_0xdea4('0x46')](_0x40a534[_0xdea4('0x3c')],_0x149c54[_0xdea4('0x3e')]));if(_0x40a534['query'][_0xdea4('0x47')]){_0x5ae4e7[_0xdea4('0x45')]=_[_0xdea4('0x48')](_0x5ae4e7[_0xdea4('0x45')],{'$or':_['map'](_0x14c5a3,function(_0x360221){if(_0x360221[_0xdea4('0x39')]!==_0xdea4('0x49')){var _0xc93d7={};_0xc93d7[_0x360221[_0xdea4('0x34')]]={'$like':'%'+_0x40a534[_0xdea4('0x3c')][_0xdea4('0x47')]+'%'};return _0xc93d7;}})});}_0x5ae4e7=_['merge']({},_0x5ae4e7,_0x40a534['options']);var _0x2d9ad1={'where':_0x5ae4e7[_0xdea4('0x45')]};return db['Setting']['count'](_0x2d9ad1)[_0xdea4('0x1d')](function(_0x257c58){_0x39eac3[_0xdea4('0x4a')]=_0x257c58;if(_0x40a534[_0xdea4('0x3c')]['includeAll']){_0x5ae4e7['include']=[{'all':!![]}];}return db['Setting'][_0xdea4('0x4b')](_0x5ae4e7);})[_0xdea4('0x1d')](function(_0x1b3844){_0x39eac3['rows']=_0x1b3844;return _0x39eac3;})[_0xdea4('0x1d')](respondWithFilteredResult(_0x5809af,_0x5ae4e7))[_0xdea4('0x26')](handleError(_0x5809af,null));};exports[_0xdea4('0x4c')]=function(_0x320641,_0x3e6799){var _0x553048={'raw':![],'where':{'id':_0x320641[_0xdea4('0x4d')]['id']}},_0x489bbf={};_0x489bbf[_0xdea4('0x3b')]=_[_0xdea4('0x3d')](db['Setting'][_0xdea4('0x4e')]);_0x489bbf[_0xdea4('0x3c')]=_[_0xdea4('0x3d')](_0x320641[_0xdea4('0x3c')]);_0x489bbf[_0xdea4('0x3e')]=_[_0xdea4('0x3f')](_0x489bbf['model'],_0x489bbf[_0xdea4('0x3c')]);_0x553048[_0xdea4('0x41')]=_[_0xdea4('0x3f')](_0x489bbf[_0xdea4('0x3b')],qs['fields'](_0x320641['query'][_0xdea4('0x40')]));_0x553048[_0xdea4('0x41')]=_0x553048[_0xdea4('0x41')][_0xdea4('0x42')]?_0x553048[_0xdea4('0x41')]:_0x489bbf[_0xdea4('0x3b')];if(_0x320641[_0xdea4('0x3c')][_0xdea4('0x4f')]){_0x553048[_0xdea4('0x50')]=[{'all':!![]}];}_0x553048=_[_0xdea4('0x48')]({},_0x553048,_0x320641['options']);return db[_0xdea4('0x37')][_0xdea4('0x51')](_0x553048)[_0xdea4('0x1d')](handleEntityNotFound(_0x3e6799,null))[_0xdea4('0x1d')](respondWithResult(_0x3e6799,null))[_0xdea4('0x26')](handleError(_0x3e6799,null));};exports['update']=function(_0x219090,_0xe77b8e){if(_0x219090[_0xdea4('0x52')]['id']){delete _0x219090['body']['id'];}return db[_0xdea4('0x37')][_0xdea4('0x51')]({'where':{'id':_0x219090['params']['id']}})['then'](handleEntityNotFound(_0xe77b8e,null))[_0xdea4('0x1d')](saveUpdates(_0x219090[_0xdea4('0x52')],null))[_0xdea4('0x1d')](respondWithResult(_0xe77b8e,null))['catch'](handleError(_0xe77b8e,null));};exports['addLogo']=function(_0x4065d7,_0x39c0db,_0x22effa){if(_0x4065d7['file']&&_0x4065d7[_0xdea4('0x53')][_0xdea4('0x54')]){_0x4065d7[_0xdea4('0x52')][_0xdea4('0x55')]=_0x4065d7['file'][_0xdea4('0x54')];}return db[_0xdea4('0x37')]['find']({'where':{'id':_0x4065d7[_0xdea4('0x4d')]['id']}})['then'](handleEntityNotFound(_0x39c0db,null))[_0xdea4('0x1d')](saveUpdates(_0x4065d7['body'],null))[_0xdea4('0x1d')](respondWithResult(_0x39c0db,null))[_0xdea4('0x26')](handleError(_0x39c0db,null));};exports[_0xdea4('0x56')]=function(_0x1b851d,_0xfb10e7,_0x2e989d){if(_0x1b851d['file']&&_0x1b851d[_0xdea4('0x53')][_0xdea4('0x54')]){_0x1b851d[_0xdea4('0x52')][_0xdea4('0x57')]=_0x1b851d[_0xdea4('0x53')]['filename'];}return db['Setting'][_0xdea4('0x51')]({'where':{'id':_0x1b851d['params']['id']}})[_0xdea4('0x1d')](handleEntityNotFound(_0xfb10e7,null))['then'](saveUpdates(_0x1b851d[_0xdea4('0x52')],null))[_0xdea4('0x1d')](respondWithResult(_0xfb10e7,null))[_0xdea4('0x26')](handleError(_0xfb10e7,null));};var utilLicense=require('../../config/license/util');exports[_0xdea4('0x58')]=function(_0x571db1,_0x2fe736,_0x11afd4){var _0x3e94a9=_0xdea4('0x59');var _0x45d0d7={'custom':![]};return utilLicense[_0xdea4('0x5a')]()[_0xdea4('0x1d')](function(_0x5445dc){if(_0x5445dc){_0x45d0d7=_0x5445dc;}return db[_0xdea4('0x37')][_0xdea4('0x51')]({'where':{'id':_0x571db1['params']['id']},'attributes':[_0xdea4('0x55'),_0xdea4('0x57'),'preferred','favicon','defaultLogo',_0xdea4('0x5b'),'defaultPreferred',_0xdea4('0x5c')],'raw':!![]});})[_0xdea4('0x1d')](handleEntityNotFound(_0x2fe736,null))[_0xdea4('0x1d')](function(_0x21bb38){if(_0x21bb38){var _0x2737b0=_0x21bb38[_0xdea4('0x55')]&&fs[_0xdea4('0x5d')](path[_0xdea4('0x5e')](config[_0xdea4('0x5f')],_0x3e94a9,_[_0xdea4('0x60')](_0x21bb38[_0xdea4('0x55')])))?path[_0xdea4('0x5e')](config[_0xdea4('0x5f')],_0x3e94a9,_[_0xdea4('0x60')](_0x21bb38[_0xdea4('0x55')])):path[_0xdea4('0x5e')](config[_0xdea4('0x5f')],_0x3e94a9,_[_0xdea4('0x60')](_0xdea4('0x61')));var _0x1aeb9a=_0xdea4('0x62')+_['upperFirst'](_0xdea4('0x55'));if(_0x21bb38[_0x1aeb9a]||!_0x45d0d7[_0xdea4('0x63')]){_0x2737b0=path['join'](config['root'],_0x3e94a9,_[_0xdea4('0x60')]('default_logo.png'));}if(!fs[_0xdea4('0x5d')](_0x2737b0)){throw new db['Sequelize'][(_0xdea4('0x64'))](_[_0xdea4('0x65')](_0xdea4('0x55'))+_0xdea4('0x66'));}return _0x2fe736[_0xdea4('0x67')](_0x2737b0);}})[_0xdea4('0x26')](handleError(_0x2fe736,null));};var utilLicense=require(_0xdea4('0x68'));exports[_0xdea4('0x69')]=function(_0xcddacb,_0x3213d3,_0x51cfa1){var _0x57f01d=_0xdea4('0x59');var _0x2de8c5={'custom':![]};return utilLicense[_0xdea4('0x5a')]()['then'](function(_0x16b6b7){if(_0x16b6b7){_0x2de8c5=_0x16b6b7;}return db[_0xdea4('0x37')][_0xdea4('0x51')]({'where':{'id':_0xcddacb['params']['id']},'attributes':[_0xdea4('0x55'),_0xdea4('0x57'),_0xdea4('0x6a'),_0xdea4('0x6b'),_0xdea4('0x6c'),'defaultLoginLogo',_0xdea4('0x6d'),_0xdea4('0x5c')],'raw':!![]});})[_0xdea4('0x1d')](handleEntityNotFound(_0x3213d3,null))['then'](function(_0x2cef5b){if(_0x2cef5b){var _0x44156f=_0x2cef5b[_0xdea4('0x57')]&&fs[_0xdea4('0x5d')](path['join'](config[_0xdea4('0x5f')],_0x57f01d,_[_0xdea4('0x60')](_0x2cef5b[_0xdea4('0x57')])))?path[_0xdea4('0x5e')](config['root'],_0x57f01d,_[_0xdea4('0x60')](_0x2cef5b['loginLogo'])):path[_0xdea4('0x5e')](config[_0xdea4('0x5f')],_0x57f01d,_[_0xdea4('0x60')](_0xdea4('0x6e')));var _0x4e3cc0=_0xdea4('0x62')+_[_0xdea4('0x65')](_0xdea4('0x57'));if(_0x2cef5b[_0x4e3cc0]||!_0x2de8c5['custom']){_0x44156f=path['join'](config[_0xdea4('0x5f')],_0x57f01d,_['toLower'](_0xdea4('0x6e')));}if(!fs['existsSync'](_0x44156f)){throw new db[(_0xdea4('0x6f'))][(_0xdea4('0x64'))](_[_0xdea4('0x65')](_0xdea4('0x57'))+'\x20not\x20found');}return _0x3213d3[_0xdea4('0x67')](_0x44156f);}})[_0xdea4('0x26')](handleError(_0x3213d3,null));};exports[_0xdea4('0x70')]=function(_0x5626c4,_0x1166f7){return db['Setting']['find']({'where':{'id':_0x5626c4[_0xdea4('0x4d')]['id']},'attributes':['securePassword']})['then'](respondWithResult(_0x1166f7,null))[_0xdea4('0x26')](handleError(_0x1166f7,null));};exports['addPreferred']=function(_0x4d260a,_0x4e7455,_0x5d732e){if(_0x4d260a[_0xdea4('0x53')]&&_0x4d260a['file'][_0xdea4('0x54')]){_0x4d260a[_0xdea4('0x52')]['preferred']=_0x4d260a[_0xdea4('0x53')][_0xdea4('0x54')];}return db['Setting'][_0xdea4('0x51')]({'where':{'id':_0x4d260a[_0xdea4('0x4d')]['id']}})[_0xdea4('0x1d')](handleEntityNotFound(_0x4e7455,null))[_0xdea4('0x1d')](saveUpdates(_0x4d260a[_0xdea4('0x52')],null))[_0xdea4('0x1d')](respondWithResult(_0x4e7455,null))[_0xdea4('0x26')](handleError(_0x4e7455,null));};var utilLicense=require(_0xdea4('0x68'));exports[_0xdea4('0x71')]=function(_0x425c70,_0x4d3cb9,_0x3cbaaf){var _0x24175b='server/files/images/logos';var _0x4a4c3a={'custom':![]};return utilLicense[_0xdea4('0x5a')]()[_0xdea4('0x1d')](function(_0x39674c){if(_0x39674c){_0x4a4c3a=_0x39674c;}return db[_0xdea4('0x37')]['find']({'where':{'id':_0x425c70[_0xdea4('0x4d')]['id']},'attributes':[_0xdea4('0x55'),_0xdea4('0x57'),'preferred',_0xdea4('0x6b'),_0xdea4('0x6c'),_0xdea4('0x5b'),_0xdea4('0x6d'),_0xdea4('0x5c')],'raw':!![]});})[_0xdea4('0x1d')](handleEntityNotFound(_0x4d3cb9,null))[_0xdea4('0x1d')](function(_0x5ba160){if(_0x5ba160){var _0xc7e16e=_0x5ba160[_0xdea4('0x6a')]&&fs[_0xdea4('0x5d')](path[_0xdea4('0x5e')](config[_0xdea4('0x5f')],_0x24175b,_[_0xdea4('0x60')](_0x5ba160[_0xdea4('0x6a')])))?path['join'](config['root'],_0x24175b,_[_0xdea4('0x60')](_0x5ba160[_0xdea4('0x6a')])):path[_0xdea4('0x5e')](config[_0xdea4('0x5f')],_0x24175b,_['toLower'](_0xdea4('0x72')));var _0x25b223='default'+_[_0xdea4('0x65')](_0xdea4('0x6a'));if(_0x5ba160[_0x25b223]||!_0x4a4c3a[_0xdea4('0x63')]||!_0x4a4c3a[_0xdea4('0x6a')]){_0xc7e16e=path[_0xdea4('0x5e')](config[_0xdea4('0x5f')],_0x24175b,_[_0xdea4('0x60')]('default_preferred.png'));}if(!fs[_0xdea4('0x5d')](_0xc7e16e)){throw new db[(_0xdea4('0x6f'))]['ValidationError'](_[_0xdea4('0x65')](_0xdea4('0x6a'))+'\x20not\x20found');}return _0x4d3cb9['download'](_0xc7e16e);}})[_0xdea4('0x26')](handleError(_0x4d3cb9,null));};exports[_0xdea4('0x73')]=function(_0x4183e8,_0x574dc3,_0x355573){if(_0x4183e8[_0xdea4('0x53')]&&_0x4183e8[_0xdea4('0x53')][_0xdea4('0x54')]){_0x4183e8[_0xdea4('0x52')]['favicon']=_0x4183e8[_0xdea4('0x53')][_0xdea4('0x54')];}return db['Setting'][_0xdea4('0x51')]({'where':{'id':_0x4183e8[_0xdea4('0x4d')]['id']}})[_0xdea4('0x1d')](handleEntityNotFound(_0x574dc3,null))[_0xdea4('0x1d')](saveUpdates(_0x4183e8[_0xdea4('0x52')],null))[_0xdea4('0x1d')](respondWithResult(_0x574dc3,null))['catch'](handleError(_0x574dc3,null));};var utilLicense=require(_0xdea4('0x68'));exports['getFavicon']=function(_0x52f9bf,_0x5ae672,_0x84ad1c){var _0x8b65a8=_0xdea4('0x59');var _0x5341fd={'custom':![]};return utilLicense[_0xdea4('0x5a')]()[_0xdea4('0x1d')](function(_0x1b4aad){if(_0x1b4aad){_0x5341fd=_0x1b4aad;}return db[_0xdea4('0x37')]['find']({'where':{'id':_0x52f9bf['params']['id']},'attributes':[_0xdea4('0x55'),'loginLogo',_0xdea4('0x6a'),_0xdea4('0x6b'),'defaultLogo',_0xdea4('0x5b'),_0xdea4('0x6d'),'defaultFavicon'],'raw':!![]});})[_0xdea4('0x1d')](handleEntityNotFound(_0x5ae672,null))[_0xdea4('0x1d')](function(_0x4767d4){if(_0x4767d4){var _0x5cc08b=_0x4767d4['favicon']&&fs[_0xdea4('0x5d')](path[_0xdea4('0x5e')](config['root'],_0x8b65a8,_[_0xdea4('0x60')](_0x4767d4[_0xdea4('0x6b')])))?path[_0xdea4('0x5e')](config[_0xdea4('0x5f')],_0x8b65a8,_[_0xdea4('0x60')](_0x4767d4[_0xdea4('0x6b')])):path['join'](config['root'],_0x8b65a8,_[_0xdea4('0x60')](_0xdea4('0x74')));var _0x304719=_0xdea4('0x62')+_['upperFirst'](_0xdea4('0x6b'));if(_0x4767d4[_0x304719]||!_0x5341fd[_0xdea4('0x63')]){_0x5cc08b=path[_0xdea4('0x5e')](config['root'],_0x8b65a8,_[_0xdea4('0x60')](_0xdea4('0x74')));}if(!fs[_0xdea4('0x5d')](_0x5cc08b)){throw new db[(_0xdea4('0x6f'))][(_0xdea4('0x64'))](_[_0xdea4('0x65')](_0xdea4('0x6b'))+_0xdea4('0x66'));}return _0x5ae672[_0xdea4('0x67')](_0x5cc08b);}})[_0xdea4('0x26')](handleError(_0x5ae672,null));}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 064c77c..dd12e0c 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 _0x823d=['moment','bluebird','request-promise','path','rimraf','./setting.attributes','Setting','settings','util','../../config/logger'];(function(_0x146c3f,_0xf3ad48){var _0x316c56=function(_0x25809a){while(--_0x25809a){_0x146c3f['push'](_0x146c3f['shift']());}};_0x316c56(++_0xf3ad48);}(_0x823d,0x166));var _0xd823=function(_0x24c405,_0x56d6fb){_0x24c405=_0x24c405-0x0;var _0x383aef=_0x823d[_0x24c405];return _0x383aef;};'use strict';var _=require('lodash');var util=require(_0xd823('0x0'));var logger=require(_0xd823('0x1'))('api');var moment=require(_0xd823('0x2'));var BPromise=require(_0xd823('0x3'));var rp=require(_0xd823('0x4'));var fs=require('fs');var path=require(_0xd823('0x5'));var rimraf=require(_0xd823('0x6'));var config=require('../../config/environment');var attributes=require(_0xd823('0x7'));module['exports']=function(_0x5f2875,_0x5d5ad0){return _0x5f2875['define'](_0xd823('0x8'),attributes,{'tableName':_0xd823('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8a02=['settings','lodash','../../config/logger','moment','bluebird','rimraf','../../config/environment','exports','define','Setting'];(function(_0x3a0c4f,_0x5dd1a3){var _0x247049=function(_0x144695){while(--_0x144695){_0x3a0c4f['push'](_0x3a0c4f['shift']());}};_0x247049(++_0x5dd1a3);}(_0x8a02,0x15f));var _0x28a0=function(_0x2a210b,_0x49de5b){_0x2a210b=_0x2a210b-0x0;var _0x1bfc83=_0x8a02[_0x2a210b];return _0x1bfc83;};'use strict';var _=require(_0x28a0('0x0'));var util=require('util');var logger=require(_0x28a0('0x1'))('api');var moment=require(_0x28a0('0x2'));var BPromise=require(_0x28a0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x28a0('0x4'));var config=require(_0x28a0('0x5'));var attributes=require('./setting.attributes');module[_0x28a0('0x6')]=function(_0x5d2f01,_0x4385de){return _0x5d2f01[_0x28a0('0x7')](_0x28a0('0x8'),attributes,{'tableName':_0x28a0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index f6a895e..2857bcb 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 _0x4fef=['message','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1d59e2,_0x567c01){var _0x4352be=function(_0x164dd4){while(--_0x164dd4){_0x1d59e2['push'](_0x1d59e2['shift']());}};_0x4352be(++_0x567c01);}(_0x4fef,0x1d1));var _0xf4fe=function(_0x3806f7,_0x329096){_0x3806f7=_0x3806f7-0x0;var _0x2c3d5a=_0x4fef[_0x3806f7];return _0x2c3d5a;};'use strict';var _=require(_0xf4fe('0x0'));var util=require(_0xf4fe('0x1'));var moment=require(_0xf4fe('0x2'));var BPromise=require('bluebird');var rs=require(_0xf4fe('0x3'));var fs=require('fs');var Redis=require(_0xf4fe('0x4'));var db=require(_0xf4fe('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf4fe('0x6'))(_0xf4fe('0x7'));var config=require(_0xf4fe('0x8'));var jayson=require(_0xf4fe('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x401997,_0x1708b1,_0xadb635){return new BPromise(function(_0x100494,_0x1d6eb2){return client[_0xf4fe('0xa')](_0x401997,_0xadb635)[_0xf4fe('0xb')](function(_0x417862){logger['info'](_0xf4fe('0xc'),_0x1708b1,_0xf4fe('0xd'));logger[_0xf4fe('0xe')](_0xf4fe('0xf'),_0x1708b1,_0xf4fe('0xd'),JSON[_0xf4fe('0x10')](_0x417862));if(_0x417862[_0xf4fe('0x11')]){if(_0x417862[_0xf4fe('0x11')][_0xf4fe('0x12')]===0x1f4){logger[_0xf4fe('0x11')](_0xf4fe('0xc'),_0x1708b1,_0x417862[_0xf4fe('0x11')][_0xf4fe('0x13')]);return _0x1d6eb2(_0x417862['error']['message']);}logger[_0xf4fe('0x11')](_0xf4fe('0xc'),_0x1708b1,_0x417862[_0xf4fe('0x11')][_0xf4fe('0x13')]);return _0x100494(_0x417862['error'][_0xf4fe('0x13')]);}else{logger[_0xf4fe('0x14')](_0xf4fe('0xc'),_0x1708b1,_0xf4fe('0xd'));_0x100494(_0x417862['result']['message']);}})[_0xf4fe('0x15')](function(_0x5d0dcb){logger[_0xf4fe('0x11')](_0xf4fe('0xc'),_0x1708b1,_0x5d0dcb);_0x1d6eb2(_0x5d0dcb);});});} \ No newline at end of file +var _0x1a19=['request','then','info','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','Setting,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3bee55,_0x4e25c8){var _0x5649d2=function(_0x13d730){while(--_0x13d730){_0x3bee55['push'](_0x3bee55['shift']());}};_0x5649d2(++_0x4e25c8);}(_0x1a19,0x155));var _0x91a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1a19[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x91a1('0x0'));var util=require(_0x91a1('0x1'));var moment=require(_0x91a1('0x2'));var BPromise=require(_0x91a1('0x3'));var rs=require(_0x91a1('0x4'));var fs=require('fs');var Redis=require(_0x91a1('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x91a1('0x6'))(_0x91a1('0x7'));var config=require(_0x91a1('0x8'));var jayson=require(_0x91a1('0x9'));var client=jayson[_0x91a1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4845f1,_0x10cae0,_0x75813d){return new BPromise(function(_0xeee062,_0x12c6d3){return client[_0x91a1('0xb')](_0x4845f1,_0x75813d)[_0x91a1('0xc')](function(_0xdfe80f){logger[_0x91a1('0xd')]('Setting,\x20%s,\x20%s',_0x10cae0,_0x91a1('0xe'));logger['debug'](_0x91a1('0xf'),_0x10cae0,_0x91a1('0xe'),JSON[_0x91a1('0x10')](_0xdfe80f));if(_0xdfe80f[_0x91a1('0x11')]){if(_0xdfe80f[_0x91a1('0x11')]['code']===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x10cae0,_0xdfe80f[_0x91a1('0x11')][_0x91a1('0x12')]);return _0x12c6d3(_0xdfe80f[_0x91a1('0x11')][_0x91a1('0x12')]);}logger[_0x91a1('0x11')]('Setting,\x20%s,\x20%s',_0x10cae0,_0xdfe80f[_0x91a1('0x11')]['message']);return _0xeee062(_0xdfe80f[_0x91a1('0x11')][_0x91a1('0x12')]);}else{logger[_0x91a1('0xd')](_0x91a1('0x13'),_0x10cae0,_0x91a1('0xe'));_0xeee062(_0xdfe80f[_0x91a1('0x14')][_0x91a1('0x12')]);}})[_0x91a1('0x15')](function(_0x1d6a31){logger[_0x91a1('0x11')]('Setting,\x20%s,\x20%s',_0x10cae0,_0x1d6a31);_0x12c6d3(_0x1d6a31);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 6b04bf5..75427d5 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 _0x9a02=['multer','path','Router','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','getApplications','/:id/interactions','/:id/status','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','/:id/notify','/:id/applications','addApplications','/:id/send','send','status','addAgents','put','update','delete','removeAgents','exports'];(function(_0x2251a6,_0xe7f053){var _0x184a06=function(_0x57986f){while(--_0x57986f){_0x2251a6['push'](_0x2251a6['shift']());}};_0x184a06(++_0xe7f053);}(_0x9a02,0x1a4));var _0x29a0=function(_0x2476c0,_0x56122f){_0x2476c0=_0x2476c0-0x0;var _0x23b926=_0x9a02[_0x2476c0];return _0x23b926;};'use strict';var multer=require(_0x29a0('0x0'));var util=require('util');var path=require(_0x29a0('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x29a0('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x29a0('0x3'));var config=require(_0x29a0('0x4'));var controller=require('./smsAccount.controller');router[_0x29a0('0x5')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x29a0('0x6'),auth[_0x29a0('0x7')](),controller[_0x29a0('0x8')]);router[_0x29a0('0x5')](_0x29a0('0x9'),auth[_0x29a0('0x7')](),controller[_0x29a0('0xa')]);router[_0x29a0('0x5')](_0x29a0('0xb'),auth[_0x29a0('0x7')](),controller[_0x29a0('0xc')]);router['get']('/:id/canned_answers',auth[_0x29a0('0x7')](),controller['getAnswers']);router[_0x29a0('0x5')]('/:id/applications',auth['isAuthenticated'](),controller[_0x29a0('0xd')]);router['get'](_0x29a0('0xe'),auth[_0x29a0('0x7')](),controller['getInteractions']);router['get'](_0x29a0('0xf'),controller['statusGet']);router[_0x29a0('0x5')](_0x29a0('0x10'),auth[_0x29a0('0x7')](),controller[_0x29a0('0x11')]);router[_0x29a0('0x12')]('/',auth[_0x29a0('0x7')](),controller[_0x29a0('0x13')]);router['post'](_0x29a0('0xb'),auth['isAuthenticated'](),controller[_0x29a0('0x14')]);router['post'](_0x29a0('0x15'),auth['isAuthenticated'](),controller[_0x29a0('0x16')]);router[_0x29a0('0x12')](_0x29a0('0x17'),controller['notify']);router['post'](_0x29a0('0x18'),auth[_0x29a0('0x7')](),controller[_0x29a0('0x19')]);router[_0x29a0('0x12')](_0x29a0('0x1a'),auth[_0x29a0('0x7')](),controller[_0x29a0('0x1b')]);router[_0x29a0('0x12')]('/:id/status',controller[_0x29a0('0x1c')]);router[_0x29a0('0x12')]('/:id/users',auth['isAuthenticated'](),controller[_0x29a0('0x1d')]);router[_0x29a0('0x1e')](_0x29a0('0x9'),auth[_0x29a0('0x7')](),controller[_0x29a0('0x1f')]);router[_0x29a0('0x20')]('/:id',auth[_0x29a0('0x7')](),controller['destroy']);router['delete'](_0x29a0('0xb'),auth[_0x29a0('0x7')](),controller['removeDispositions']);router[_0x29a0('0x20')](_0x29a0('0x15'),auth[_0x29a0('0x7')](),controller['removeAnswers']);router[_0x29a0('0x20')]('/:id/users',auth[_0x29a0('0x7')](),controller[_0x29a0('0x21')]);module[_0x29a0('0x22')]=router; \ No newline at end of file +var _0x2e63=['isAuthenticated','index','/describe','/:id','/:id/dispositions','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/status','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','/:id/notify','notify','/:id/applications','addApplications','/:id/send','send','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get'];(function(_0x21b9c7,_0x4b4ad6){var _0x21fed3=function(_0x209e50){while(--_0x209e50){_0x21b9c7['push'](_0x21b9c7['shift']());}};_0x21fed3(++_0x4b4ad6);}(_0x2e63,0x6f));var _0x32e6=function(_0x39e8f5,_0xb151a6){_0x39e8f5=_0x39e8f5-0x0;var _0x346526=_0x2e63[_0x39e8f5];return _0x346526;};'use strict';var multer=require('multer');var util=require(_0x32e6('0x0'));var path=require(_0x32e6('0x1'));var timeout=require(_0x32e6('0x2'));var express=require(_0x32e6('0x3'));var router=express[_0x32e6('0x4')]();var auth=require(_0x32e6('0x5'));var interaction=require(_0x32e6('0x6'));var config=require('../../config/environment');var controller=require(_0x32e6('0x7'));router[_0x32e6('0x8')]('/',auth[_0x32e6('0x9')](),controller[_0x32e6('0xa')]);router[_0x32e6('0x8')](_0x32e6('0xb'),auth[_0x32e6('0x9')](),controller['describe']);router[_0x32e6('0x8')](_0x32e6('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x32e6('0x8')](_0x32e6('0xd'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x32e6('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x32e6('0xe')]);router['get']('/:id/applications',auth[_0x32e6('0x9')](),controller[_0x32e6('0xf')]);router[_0x32e6('0x8')](_0x32e6('0x10'),auth[_0x32e6('0x9')](),controller[_0x32e6('0x11')]);router[_0x32e6('0x8')](_0x32e6('0x12'),controller['statusGet']);router[_0x32e6('0x8')](_0x32e6('0x13'),auth['isAuthenticated'](),controller[_0x32e6('0x14')]);router[_0x32e6('0x15')]('/',auth[_0x32e6('0x9')](),controller['create']);router['post'](_0x32e6('0xd'),auth[_0x32e6('0x9')](),controller[_0x32e6('0x16')]);router['post'](_0x32e6('0x17'),auth[_0x32e6('0x9')](),controller[_0x32e6('0x18')]);router[_0x32e6('0x15')](_0x32e6('0x19'),controller[_0x32e6('0x1a')]);router['post'](_0x32e6('0x1b'),auth['isAuthenticated'](),controller[_0x32e6('0x1c')]);router[_0x32e6('0x15')](_0x32e6('0x1d'),auth['isAuthenticated'](),controller[_0x32e6('0x1e')]);router['post'](_0x32e6('0x12'),controller['status']);router[_0x32e6('0x15')](_0x32e6('0x13'),auth['isAuthenticated'](),controller[_0x32e6('0x1f')]);router[_0x32e6('0x20')]('/:id',auth['isAuthenticated'](),controller[_0x32e6('0x21')]);router[_0x32e6('0x22')](_0x32e6('0xc'),auth['isAuthenticated'](),controller[_0x32e6('0x23')]);router[_0x32e6('0x22')]('/:id/dispositions',auth[_0x32e6('0x9')](),controller[_0x32e6('0x24')]);router[_0x32e6('0x22')](_0x32e6('0x17'),auth['isAuthenticated'](),controller[_0x32e6('0x25')]);router[_0x32e6('0x22')]('/:id/users',auth[_0x32e6('0x9')](),controller[_0x32e6('0x26')]);module[_0x32e6('0x27')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 47d0ec8..3ae9de3 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 _0x9170=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','ENUM','twilio','skebby','connectel','clicksend','clickatell','csc','intelepeer','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x9170,0x9f));var _0x0917=function(_0x50233f,_0x463f10){_0x50233f=_0x50233f-0x0;var _0x2ff4d5=_0x9170[_0x50233f];return _0x2ff4d5;};'use strict';var Sequelize=require(_0x0917('0x0'));var rs=require(_0x0917('0x1'));module[_0x0917('0x2')]={'name':{'type':Sequelize[_0x0917('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x0917('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x0917('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x0917('0x4')]();}},'phone':{'type':Sequelize[_0x0917('0x3')]},'type':{'type':Sequelize[_0x0917('0x5')](_0x0917('0x6'),_0x0917('0x7'),_0x0917('0x8'),_0x0917('0x9'),'plivo',_0x0917('0xa'),_0x0917('0xb'),'infobip',_0x0917('0xc'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x0917('0x3')]},'authToken':{'type':Sequelize[_0x0917('0x3')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x0917('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x0917('0x3')]},'senderString':{'type':Sequelize[_0x0917('0x3')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x0917('0x3')]},'notificationTemplate':{'type':Sequelize[_0x0917('0xd')],'defaultValue':function(){return _0x0917('0xe');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0917('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0917('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0917('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x0917('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0917('0x10')],'comment':_0x0917('0x11')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x0917('0x12'),'set':function(_0x2fb127){if(!_0x2fb127)this[_0x0917('0x13')](_0x0917('0x14'),null);this[_0x0917('0x13')](_0x0917('0x15'),_0x2fb127);}}}; \ No newline at end of file +var _0xf253=['connectel','clicksend','plivo','clickatell','csc','infobip','ENUM','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','name','STRING','generate','twilio','skebby'];(function(_0x383f4b,_0x25800d){var _0x195528=function(_0x360523){while(--_0x360523){_0x383f4b['push'](_0x383f4b['shift']());}};_0x195528(++_0x25800d);}(_0xf253,0x1b1));var _0x3f25=function(_0x17d0ea,_0x227e5e){_0x17d0ea=_0x17d0ea-0x0;var _0x36f095=_0xf253[_0x17d0ea];return _0x36f095;};'use strict';var Sequelize=require(_0x3f25('0x0'));var rs=require(_0x3f25('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x3f25('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x3f25('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x3f25('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x3f25('0x3')],'defaultValue':function(){return rs[_0x3f25('0x4')]();}},'phone':{'type':Sequelize[_0x3f25('0x3')]},'type':{'type':Sequelize['ENUM'](_0x3f25('0x5'),_0x3f25('0x6'),_0x3f25('0x7'),_0x3f25('0x8'),_0x3f25('0x9'),_0x3f25('0xa'),_0x3f25('0xb'),_0x3f25('0xc'),'intelepeer')},'accountSid':{'type':Sequelize[_0x3f25('0x3')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x3f25('0x3')]},'smsMethod':{'type':Sequelize[_0x3f25('0xd')]('SI','TI','GP')},'username':{'type':Sequelize[_0x3f25('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x3f25('0x3')]},'senderString':{'type':Sequelize[_0x3f25('0x3')]},'deliveryReport':{'type':Sequelize[_0x3f25('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0x3f25('0x3')]},'notificationTemplate':{'type':Sequelize[_0x3f25('0xf')],'defaultValue':function(){return _0x3f25('0x10');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3f25('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3f25('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3f25('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3f25('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x3f25('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x3f25('0x13'),'set':function(_0x34b93a){if(!_0x34b93a)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x3f25('0x14')](_0x3f25('0x15'),_0x34b93a);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 26fbefd..4e79739 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 _0x02ce=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','client','Sequelize','ValidationError','request','then','info','request\x20sent','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','UserProfileResource','name','send','index','Pause','map','SmsAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsAccounts','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','mandatoryDispositionPause','describe','SmsAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findAll','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','priority','CmContact','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','connectel','clicksend','message_id','plivo','Text','infobip','results','text','csc','originatingAddress','segmentedMessage','fromNumber','replyMessageId','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','list','contact','SmsInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','Start','startRouting','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','text/xml','\x0a','addApplications','sequelize','bulkCreate','findAndCountAll','getApplications','Contact','fullname','internal','Tag','color','tag','to\x20is\x20mandatory','CmList','DESC','List','out','user','Messages','spread','dataValues','log','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','clickatell','redif','skebby','SmsAccount,\x20%s,\x20%s,\x20%s','error_code','groupName','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','omit','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x32f1c3,_0x3d75f7){var _0x12ab63=function(_0x3215f4){while(--_0x3215f4){_0x32f1c3['push'](_0x32f1c3['shift']());}};_0x12ab63(++_0x3d75f7);}(_0x02ce,0x1ac));var _0xe02c=function(_0x28ac42,_0x2ef917){_0x28ac42=_0x28ac42-0x0;var _0x1aebd6=_0x02ce[_0x28ac42];return _0x1aebd6;};'use strict';var pdf=require(_0xe02c('0x0'));var emlformat=require(_0xe02c('0x1'));var rimraf=require(_0xe02c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe02c('0x3'));var rp=require('request-promise');var moment=require(_0xe02c('0x4'));var BPromise=require(_0xe02c('0x5'));var Mustache=require(_0xe02c('0x6'));var util=require(_0xe02c('0x7'));var path=require(_0xe02c('0x8'));var sox=require(_0xe02c('0x9'));var csv=require(_0xe02c('0xa'));var ejs=require(_0xe02c('0xb'));var fs=require('fs');var _=require(_0xe02c('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe02c('0xd'));var deskjs=require(_0xe02c('0xe'));var toCsv=require(_0xe02c('0xa'));var querystring=require(_0xe02c('0xf'));var Papa=require(_0xe02c('0x10'));var Redis=require(_0xe02c('0x11'));var authService=require(_0xe02c('0x12'));var qs=require(_0xe02c('0x13'));var as=require(_0xe02c('0x14'));var hardwareService=require(_0xe02c('0x15'));var logger=require(_0xe02c('0x16'))(_0xe02c('0x17'));var utils=require(_0xe02c('0x18'));var config=require(_0xe02c('0x19'));var db=require(_0xe02c('0x1a'))['db'];config[_0xe02c('0x1b')]=_[_0xe02c('0x1c')](config[_0xe02c('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xe02c('0x1d'))(new Redis(config['redis']));require('./smsAccount.socket')[_0xe02c('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0xe02c('0x1f')]['http']({'port':0x232c});function checkPasswordPattern(_0x3a5a2c,_0x4e9c6d,_0x256311){if(_0x256311){var _0x366893=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x366893['test'](_0x4e9c6d)){return _0x3a5a2c;}else{throw new db[(_0xe02c('0x20'))][(_0xe02c('0x21'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x3a5a2c;}}function respondWithRpcPromise(_0x12a564,_0x20f492,_0x5a4583,_0x52917f){return new BPromise(function(_0x3e37bf,_0x49604a){var _0x1f8f37=_0x52917f||client;return _0x1f8f37[_0xe02c('0x22')](_0x12a564,_0x5a4583)[_0xe02c('0x23')](function(_0x36fed0){logger[_0xe02c('0x24')]('SmsAccount,\x20%s,\x20%s',_0x20f492,_0xe02c('0x25'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x20f492,_0xe02c('0x25'),JSON[_0xe02c('0x26')](_0x36fed0));if(_0x36fed0['error']){if(_0x36fed0[_0xe02c('0x27')][_0xe02c('0x28')]===0x1f4){logger['error'](_0xe02c('0x29'),_0x20f492,_0x36fed0[_0xe02c('0x27')][_0xe02c('0x2a')]);return _0x49604a(_0x36fed0[_0xe02c('0x27')][_0xe02c('0x2a')]);}logger[_0xe02c('0x27')](_0xe02c('0x29'),_0x20f492,_0x36fed0[_0xe02c('0x27')][_0xe02c('0x2a')]);return _0x3e37bf(_0x36fed0[_0xe02c('0x27')][_0xe02c('0x2a')]);}else{logger['info'](_0xe02c('0x29'),_0x20f492,_0xe02c('0x25'));_0x3e37bf(_0x36fed0[_0xe02c('0x2b')][_0xe02c('0x2a')]);}})[_0xe02c('0x2c')](function(_0x303d24){logger[_0xe02c('0x27')](_0xe02c('0x29'),_0x20f492,_0x303d24);_0x49604a(_0x303d24);});});}function respondWithStatusCode(_0x55ef2a,_0x55e475){_0x55e475=_0x55e475||0xcc;return function(_0x3790eb){if(_0x3790eb){return _0x55ef2a[_0xe02c('0x2d')](_0x55e475);}return _0x55ef2a['status'](_0x55e475)[_0xe02c('0x2e')]();};}function respondWithResult(_0x2d1d98,_0x445421){_0x445421=_0x445421||0xc8;return function(_0x287f7e){if(_0x287f7e){return _0x2d1d98[_0xe02c('0x2f')](_0x445421)[_0xe02c('0x30')](_0x287f7e);}};}function respondWithFilteredResult(_0x22a285,_0x1b8f21){return function(_0x9ee479){if(_0x9ee479){var _0x288004=_0x9ee479[_0xe02c('0x31')],_0x17d5b3=_0x1b8f21[_0xe02c('0x32')],_0x5a2da0=_0x1b8f21[_0xe02c('0x32')]+_0x1b8f21[_0xe02c('0x33')],_0x3c3d2c;if(_0x5a2da0>=_0x288004){_0x5a2da0=_0x288004;_0x3c3d2c=0xc8;}else{_0x3c3d2c=0xce;}_0x22a285[_0xe02c('0x2f')](_0x3c3d2c);return _0x22a285['set'](_0xe02c('0x34'),_0x17d5b3+'-'+_0x5a2da0+'/'+_0x288004)[_0xe02c('0x30')](_0x9ee479);}return null;};}function patchUpdates(_0x4fc4fd){return function(_0x1ce34c){try{jsonpatch[_0xe02c('0x35')](_0x1ce34c,_0x4fc4fd,!![]);}catch(_0x43ac5d){return BPromise[_0xe02c('0x36')](_0x43ac5d);}return _0x1ce34c[_0xe02c('0x37')]();};}function saveUpdates(_0x538001,_0x4a0350){return function(_0x388063){if(_0x388063){return _0x388063[_0xe02c('0x38')](_0x538001)['then'](function(_0x1afae6){return _0x1afae6;});}return null;};}function removeEntity(_0x58c724,_0x42d617){return function(_0xaa8cc7){if(_0xaa8cc7){return _0xaa8cc7[_0xe02c('0x39')]()[_0xe02c('0x23')](function(){var _0x10ae8b=_0xaa8cc7['get']({'plain':!![]});var _0x3f888c='SmsAccounts';return db[_0xe02c('0x3a')][_0xe02c('0x39')]({'where':{'type':_0x3f888c,'resourceId':_0x10ae8b['id']}})[_0xe02c('0x23')](function(){return _0xaa8cc7;});})[_0xe02c('0x23')](function(){_0x58c724[_0xe02c('0x2f')](0xcc)[_0xe02c('0x2e')]();});}};}function handleEntityNotFound(_0x559bc1,_0x1c795a){return function(_0x38845a){if(!_0x38845a){_0x559bc1['sendStatus'](0x194);}return _0x38845a;};}function handleError(_0xcb664c,_0xa6028){_0xa6028=_0xa6028||0x1f4;return function(_0x4ea038){logger[_0xe02c('0x27')](_0x4ea038['stack']);if(_0x4ea038[_0xe02c('0x3b')]){delete _0x4ea038[_0xe02c('0x3b')];}_0xcb664c['status'](_0xa6028)[_0xe02c('0x3c')](_0x4ea038);};}exports[_0xe02c('0x3d')]=function(_0x2502c8,_0x441961){var _0x3c4a65={'include':[{'model':db[_0xe02c('0x3e')],'as':'mandatoryDispositionPause'}]},_0x28922a={},_0x59a2fd={'count':0x0,'rows':[]};var _0x5ae8cd=_[_0xe02c('0x3f')](db[_0xe02c('0x40')][_0xe02c('0x41')],function(_0x21a67a){return{'name':_0x21a67a['fieldName'],'type':_0x21a67a[_0xe02c('0x42')][_0xe02c('0x43')]};});_0x28922a[_0xe02c('0x44')]=_['map'](_0x5ae8cd,'name');_0x28922a[_0xe02c('0x45')]=_[_0xe02c('0x46')](_0x2502c8[_0xe02c('0x45')]);_0x28922a[_0xe02c('0x47')]=_[_0xe02c('0x48')](_0x28922a[_0xe02c('0x44')],_0x28922a[_0xe02c('0x45')]);_0x3c4a65[_0xe02c('0x49')]=_[_0xe02c('0x48')](_0x28922a['model'],qs[_0xe02c('0x4a')](_0x2502c8['query']['fields']));_0x3c4a65[_0xe02c('0x49')]=_0x3c4a65[_0xe02c('0x49')][_0xe02c('0x4b')]?_0x3c4a65[_0xe02c('0x49')]:_0x28922a[_0xe02c('0x44')];if(!_0x2502c8[_0xe02c('0x45')][_0xe02c('0x4c')](_0xe02c('0x4d'))){_0x3c4a65['limit']=qs['limit'](_0x2502c8[_0xe02c('0x45')][_0xe02c('0x33')]);_0x3c4a65[_0xe02c('0x32')]=qs['offset'](_0x2502c8[_0xe02c('0x45')][_0xe02c('0x32')]);}_0x3c4a65[_0xe02c('0x4e')]=qs[_0xe02c('0x4f')](_0x2502c8[_0xe02c('0x45')][_0xe02c('0x4f')]);_0x3c4a65[_0xe02c('0x50')]=qs[_0xe02c('0x47')](_[_0xe02c('0x51')](_0x2502c8[_0xe02c('0x45')],_0x28922a['filters']));if(_0x2502c8[_0xe02c('0x45')][_0xe02c('0x52')]){_0x3c4a65[_0xe02c('0x50')]=_[_0xe02c('0x53')](_0x3c4a65[_0xe02c('0x50')],{'$or':_[_0xe02c('0x3f')](_0x5ae8cd,function(_0x125c43){if(_0x125c43[_0xe02c('0x42')]!==_0xe02c('0x54')){var _0x1176c9={};_0x1176c9[_0x125c43[_0xe02c('0x3b')]]={'$like':'%'+_0x2502c8[_0xe02c('0x45')][_0xe02c('0x52')]+'%'};return _0x1176c9;}})});}_0x3c4a65=_['merge']({},_0x3c4a65,_0x2502c8[_0xe02c('0x55')]);var _0x4866e1={'where':_0x3c4a65[_0xe02c('0x50')]};return db[_0xe02c('0x40')][_0xe02c('0x31')](_0x4866e1)[_0xe02c('0x23')](function(_0x1e736f){_0x59a2fd[_0xe02c('0x31')]=_0x1e736f;if(_0x2502c8[_0xe02c('0x45')][_0xe02c('0x56')]){_0x3c4a65[_0xe02c('0x57')]=[{'all':!![]}];}return db[_0xe02c('0x40')]['findAll'](_0x3c4a65);})[_0xe02c('0x23')](function(_0x43beb){_0x59a2fd[_0xe02c('0x58')]=_0x43beb;return _0x59a2fd;})['then'](respondWithFilteredResult(_0x441961,_0x3c4a65))[_0xe02c('0x2c')](handleError(_0x441961,null));};exports['show']=function(_0x21a126,_0x56b9e2){var _0x5b41e4={'raw':![],'where':{'id':_0x21a126['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x5b66f4={};_0x5b66f4[_0xe02c('0x44')]=_[_0xe02c('0x46')](db[_0xe02c('0x40')][_0xe02c('0x41')]);_0x5b66f4['query']=_[_0xe02c('0x46')](_0x21a126[_0xe02c('0x45')]);_0x5b66f4['filters']=_[_0xe02c('0x48')](_0x5b66f4[_0xe02c('0x44')],_0x5b66f4[_0xe02c('0x45')]);_0x5b41e4['attributes']=_['intersection'](_0x5b66f4[_0xe02c('0x44')],qs[_0xe02c('0x4a')](_0x21a126[_0xe02c('0x45')]['fields']));_0x5b41e4[_0xe02c('0x49')]=_0x5b41e4['attributes']['length']?_0x5b41e4[_0xe02c('0x49')]:_0x5b66f4[_0xe02c('0x44')];if(_0x21a126['query'][_0xe02c('0x56')]){_0x5b41e4[_0xe02c('0x57')]=[{'all':!![]}];}_0x5b41e4=_[_0xe02c('0x53')]({},_0x5b41e4,_0x21a126['options']);return db[_0xe02c('0x40')][_0xe02c('0x59')](_0x5b41e4)['then'](handleEntityNotFound(_0x56b9e2,null))[_0xe02c('0x23')](respondWithResult(_0x56b9e2,null))[_0xe02c('0x2c')](handleError(_0x56b9e2,null));};exports[_0xe02c('0x5a')]=function(_0x1c7206,_0x446c71){return db[_0xe02c('0x40')][_0xe02c('0x5a')](_0x1c7206[_0xe02c('0x5b')],{})[_0xe02c('0x23')](function(_0x49b1b4){var _0x56dd8b=_0x1c7206['user'][_0xe02c('0x5c')]({'plain':!![]});if(!_0x56dd8b)throw new Error(_0xe02c('0x5d'));if(_0x56dd8b[_0xe02c('0x5e')]==='user'){var _0x4eb35d=_0x49b1b4[_0xe02c('0x5c')]({'plain':!![]});var _0x383e5b=_0xe02c('0x5f');return db[_0xe02c('0x60')][_0xe02c('0x59')]({'where':{'name':_0x383e5b,'userProfileId':_0x56dd8b['userProfileId']},'raw':!![]})[_0xe02c('0x23')](function(_0x43e1d4){if(_0x43e1d4&&_0x43e1d4['autoAssociation']===0x0){return db['UserProfileResource'][_0xe02c('0x5a')]({'name':_0x4eb35d['name'],'resourceId':_0x4eb35d['id'],'type':_0x43e1d4['name'],'sectionId':_0x43e1d4['id']},{})['then'](function(){return _0x49b1b4;});}else{return _0x49b1b4;}})[_0xe02c('0x2c')](function(_0x28d7a2){logger[_0xe02c('0x27')](_0xe02c('0x61'),_0x28d7a2);throw _0x28d7a2;});}return _0x49b1b4;})[_0xe02c('0x23')](respondWithResult(_0x446c71,0xc9))[_0xe02c('0x2c')](handleError(_0x446c71,null));};exports['update']=function(_0x562e6a,_0x557f5a){if(_0x562e6a['body']['id']){delete _0x562e6a[_0xe02c('0x5b')]['id'];}return db[_0xe02c('0x40')][_0xe02c('0x59')]({'where':{'id':_0x562e6a[_0xe02c('0x62')]['id']},'include':[{'model':db['Pause'],'as':_0xe02c('0x63')}]})[_0xe02c('0x23')](handleEntityNotFound(_0x557f5a,null))['then'](saveUpdates(_0x562e6a[_0xe02c('0x5b')],null))[_0xe02c('0x23')](respondWithResult(_0x557f5a,null))['catch'](handleError(_0x557f5a,null));};exports[_0xe02c('0x39')]=function(_0x391dfb,_0x44f28f){return db[_0xe02c('0x40')][_0xe02c('0x59')]({'where':{'id':_0x391dfb[_0xe02c('0x62')]['id']}})[_0xe02c('0x23')](handleEntityNotFound(_0x44f28f,null))['then'](removeEntity(_0x44f28f,null))[_0xe02c('0x2c')](handleError(_0x44f28f,null));};exports['describe']=function(_0x558344,_0x489919){return db[_0xe02c('0x40')][_0xe02c('0x64')]()[_0xe02c('0x23')](respondWithResult(_0x489919,null))[_0xe02c('0x2c')](handleError(_0x489919,null));};exports['addDisposition']=function(_0x32e149,_0x327777,_0x503bb3){if(_0x32e149['body']['id']){delete _0x32e149['body']['id'];}return db[_0xe02c('0x40')][_0xe02c('0x59')]({'where':{'id':_0x32e149['params']['id']}})['then'](handleEntityNotFound(_0x327777,null))[_0xe02c('0x23')](function(_0x30ad9f){if(_0x30ad9f){_0x32e149[_0xe02c('0x5b')][_0xe02c('0x65')]=_0x30ad9f['id'];return db[_0xe02c('0x66')]['create'](_0x32e149[_0xe02c('0x5b')]);}})[_0xe02c('0x23')](respondWithResult(_0x327777,null))[_0xe02c('0x2c')](handleError(_0x327777,null));};exports[_0xe02c('0x67')]=function(_0x11c506,_0x119119,_0x526276){var _0x1d9d2b={'raw':![],'where':{}};var _0x42219f={};var _0x489da1={'count':0x0,'rows':[]};return db[_0xe02c('0x40')][_0xe02c('0x68')]({'where':{'id':_0x11c506[_0xe02c('0x62')]['id']}})[_0xe02c('0x23')](handleEntityNotFound(_0x119119,null))['then'](function(_0x19c253){if(_0x19c253){_0x42219f[_0xe02c('0x44')]=_['keys'](db['Disposition']['rawAttributes']);_0x42219f[_0xe02c('0x45')]=_[_0xe02c('0x46')](_0x11c506[_0xe02c('0x45')]);_0x42219f[_0xe02c('0x47')]=_[_0xe02c('0x48')](_0x42219f['model'],_0x42219f[_0xe02c('0x45')]);_0x1d9d2b[_0xe02c('0x49')]=_[_0xe02c('0x48')](_0x42219f['model'],qs['fields'](_0x11c506['query'][_0xe02c('0x4a')]));_0x1d9d2b[_0xe02c('0x49')]=_0x1d9d2b[_0xe02c('0x49')][_0xe02c('0x4b')]?_0x1d9d2b['attributes']:_0x42219f[_0xe02c('0x44')];if(!_0x11c506['query']['hasOwnProperty'](_0xe02c('0x4d'))){_0x1d9d2b[_0xe02c('0x33')]=qs[_0xe02c('0x33')](_0x11c506[_0xe02c('0x45')][_0xe02c('0x33')]);_0x1d9d2b[_0xe02c('0x32')]=qs[_0xe02c('0x32')](_0x11c506[_0xe02c('0x45')]['offset']);}_0x1d9d2b[_0xe02c('0x4e')]=qs[_0xe02c('0x4f')](_0x11c506[_0xe02c('0x45')][_0xe02c('0x4f')]);_0x1d9d2b[_0xe02c('0x50')]=qs[_0xe02c('0x47')](_[_0xe02c('0x51')](_0x11c506[_0xe02c('0x45')],_0x42219f[_0xe02c('0x47')]));_0x1d9d2b[_0xe02c('0x50')]['SmsAccountId']=_0x19c253['id'];if(_0x11c506['query'][_0xe02c('0x52')]){_0x1d9d2b[_0xe02c('0x50')]=_[_0xe02c('0x53')](_0x1d9d2b[_0xe02c('0x50')],{'$or':_[_0xe02c('0x3f')](_0x1d9d2b['attributes'],function(_0x405b16){var _0x1a6b76={};_0x1a6b76[_0x405b16]={'$like':'%'+_0x11c506[_0xe02c('0x45')][_0xe02c('0x52')]+'%'};return _0x1a6b76;})});}_0x1d9d2b=_[_0xe02c('0x53')]({},_0x1d9d2b,_0x11c506[_0xe02c('0x55')]);return db[_0xe02c('0x66')][_0xe02c('0x31')]({'where':_0x1d9d2b[_0xe02c('0x50')]})[_0xe02c('0x23')](function(_0x287eca){_0x489da1[_0xe02c('0x31')]=_0x287eca;if(_0x11c506['query']['includeAll']){_0x1d9d2b[_0xe02c('0x57')]=[{'all':!![]}];}return db[_0xe02c('0x66')]['findAll'](_0x1d9d2b);})[_0xe02c('0x23')](function(_0x488a54){_0x489da1[_0xe02c('0x58')]=_0x488a54;return _0x489da1;});}})['then'](respondWithFilteredResult(_0x119119,_0x1d9d2b))[_0xe02c('0x2c')](handleError(_0x119119,null));};exports[_0xe02c('0x69')]=function(_0x43c503,_0x18c946,_0x28755a){return db[_0xe02c('0x40')][_0xe02c('0x59')]({'where':{'id':_0x43c503[_0xe02c('0x62')]['id']}})[_0xe02c('0x23')](handleEntityNotFound(_0x18c946,null))[_0xe02c('0x23')](function(_0x567478){if(_0x567478){return _0x567478['removeDispositions'](_0x43c503['query'][_0xe02c('0x6a')]);}})[_0xe02c('0x23')](respondWithStatusCode(_0x18c946,null))[_0xe02c('0x2c')](handleError(_0x18c946,null));};exports[_0xe02c('0x6b')]=function(_0x3adbcd,_0x365c24,_0x31ddee){if(_0x3adbcd[_0xe02c('0x5b')]['id']){delete _0x3adbcd[_0xe02c('0x5b')]['id'];}return db[_0xe02c('0x40')][_0xe02c('0x59')]({'where':{'id':_0x3adbcd[_0xe02c('0x62')]['id']}})[_0xe02c('0x23')](handleEntityNotFound(_0x365c24,null))['then'](function(_0x504c81){if(_0x504c81){_0x3adbcd[_0xe02c('0x5b')][_0xe02c('0x65')]=_0x504c81['id'];return db[_0xe02c('0x6c')]['create'](_0x3adbcd[_0xe02c('0x5b')]);}})[_0xe02c('0x23')](respondWithResult(_0x365c24,null))[_0xe02c('0x2c')](handleError(_0x365c24,null));};exports[_0xe02c('0x6d')]=function(_0xf2ea75,_0x5c0506,_0x3a749d){var _0x3b2bac={'raw':![],'where':{}};var _0x80a459={};var _0x4e5ea9={'count':0x0,'rows':[]};return db[_0xe02c('0x40')][_0xe02c('0x68')]({'where':{'id':_0xf2ea75[_0xe02c('0x62')]['id']}})[_0xe02c('0x23')](handleEntityNotFound(_0x5c0506,null))[_0xe02c('0x23')](function(_0x4e3f5f){if(_0x4e3f5f){_0x80a459[_0xe02c('0x44')]=_[_0xe02c('0x46')](db[_0xe02c('0x6c')]['rawAttributes']);_0x80a459[_0xe02c('0x45')]=_[_0xe02c('0x46')](_0xf2ea75[_0xe02c('0x45')]);_0x80a459[_0xe02c('0x47')]=_[_0xe02c('0x48')](_0x80a459['model'],_0x80a459[_0xe02c('0x45')]);_0x3b2bac[_0xe02c('0x49')]=_['intersection'](_0x80a459[_0xe02c('0x44')],qs['fields'](_0xf2ea75['query']['fields']));_0x3b2bac[_0xe02c('0x49')]=_0x3b2bac[_0xe02c('0x49')][_0xe02c('0x4b')]?_0x3b2bac[_0xe02c('0x49')]:_0x80a459[_0xe02c('0x44')];if(!_0xf2ea75[_0xe02c('0x45')][_0xe02c('0x4c')](_0xe02c('0x4d'))){_0x3b2bac[_0xe02c('0x33')]=qs[_0xe02c('0x33')](_0xf2ea75[_0xe02c('0x45')][_0xe02c('0x33')]);_0x3b2bac[_0xe02c('0x32')]=qs[_0xe02c('0x32')](_0xf2ea75[_0xe02c('0x45')][_0xe02c('0x32')]);}_0x3b2bac['order']=qs[_0xe02c('0x4f')](_0xf2ea75['query'][_0xe02c('0x4f')]);_0x3b2bac[_0xe02c('0x50')]=qs[_0xe02c('0x47')](_[_0xe02c('0x51')](_0xf2ea75[_0xe02c('0x45')],_0x80a459[_0xe02c('0x47')]));_0x3b2bac[_0xe02c('0x50')][_0xe02c('0x65')]=_0x4e3f5f['id'];if(_0xf2ea75[_0xe02c('0x45')][_0xe02c('0x52')]){_0x3b2bac[_0xe02c('0x50')]=_[_0xe02c('0x53')](_0x3b2bac['where'],{'$or':_[_0xe02c('0x3f')](_0x3b2bac[_0xe02c('0x49')],function(_0x51686d){var _0x3a83cf={};_0x3a83cf[_0x51686d]={'$like':'%'+_0xf2ea75['query']['filter']+'%'};return _0x3a83cf;})});}_0x3b2bac=_[_0xe02c('0x53')]({},_0x3b2bac,_0xf2ea75[_0xe02c('0x55')]);return db[_0xe02c('0x6c')][_0xe02c('0x31')]({'where':_0x3b2bac['where']})['then'](function(_0x20d63b){_0x4e5ea9[_0xe02c('0x31')]=_0x20d63b;if(_0xf2ea75['query'][_0xe02c('0x56')]){_0x3b2bac[_0xe02c('0x57')]=[{'all':!![]}];}return db[_0xe02c('0x6c')][_0xe02c('0x6e')](_0x3b2bac);})[_0xe02c('0x23')](function(_0x654feb){_0x4e5ea9['rows']=_0x654feb;return _0x4e5ea9;});}})[_0xe02c('0x23')](respondWithFilteredResult(_0x5c0506,_0x3b2bac))[_0xe02c('0x2c')](handleError(_0x5c0506,null));};exports[_0xe02c('0x6f')]=function(_0x24928e,_0x1a13dd,_0x21e8b1){return db[_0xe02c('0x40')][_0xe02c('0x59')]({'where':{'id':_0x24928e[_0xe02c('0x62')]['id']}})[_0xe02c('0x23')](handleEntityNotFound(_0x1a13dd,null))[_0xe02c('0x23')](function(_0xbe3ff6){if(_0xbe3ff6){return _0xbe3ff6[_0xe02c('0x6f')](_0x24928e[_0xe02c('0x45')]['ids']);}})[_0xe02c('0x23')](respondWithStatusCode(_0x1a13dd,null))[_0xe02c('0x2c')](handleError(_0x1a13dd,null));};exports[_0xe02c('0x70')]=function(_0x4a0334,_0x3bd125,_0x2d0c36){var _0x1832ad={'channel':_0xe02c('0x71')};var _0x3b73a5=[];var _0x2be264=[];var _0x2f3ecd={};return db['SmsAccount'][_0xe02c('0x59')]({'where':{'id':_0x4a0334[_0xe02c('0x62')]['id']},'include':[{'model':db[_0xe02c('0x72')],'as':_0xe02c('0x73')}]})[_0xe02c('0x23')](handleEntityNotFound(_0x3bd125,null))[_0xe02c('0x23')](function(_0x1c2222){_0x1832ad[_0xe02c('0x74')]=_0x1c2222;_0x1832ad[_0xe02c('0x75')]=_['orderBy'](_0x1c2222[_0xe02c('0x73')],[_0xe02c('0x76')],['asc']);if(_0x1832ad[_0xe02c('0x74')][_0xe02c('0x73')]){delete _0x1832ad[_0xe02c('0x74')][_0xe02c('0x73')];}return db[_0xe02c('0x77')][_0xe02c('0x64')]();})['then'](function(_0xc21958){if(!_0xc21958){throw new db[(_0xe02c('0x20'))][(_0xe02c('0x21'))]('no\x20available\x20attributes');}_0x3b73a5=_['difference'](_[_0xe02c('0x46')](_0xc21958),[_0xe02c('0x78'),_0xe02c('0x79')]);_0x2be264=_['difference'](_[_0xe02c('0x46')](_0xc21958),[_0xe02c('0x78'),_0xe02c('0x79'),_0xe02c('0x7a'),_0xe02c('0x7b')]);_0x1832ad['body']={'mapKey':_0xe02c('0x7c')};if(_0x1832ad[_0xe02c('0x74')][_0xe02c('0x42')]){switch(_0x1832ad[_0xe02c('0x74')][_0xe02c('0x42')]){case _0xe02c('0x7d'):_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x7e')]=_0x4a0334[_0xe02c('0x5b')][_0xe02c('0x7f')];_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x5b')]=_0x4a0334[_0xe02c('0x5b')][_0xe02c('0x80')];_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x81')]=_0x4a0334[_0xe02c('0x5b')]['MessageSid'];break;case'skebby':_0x1832ad[_0xe02c('0x5b')]['from']='+'+_0x4a0334['body']['sender'];_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x5b')]=_0x4a0334[_0xe02c('0x5b')]['text'];break;case _0xe02c('0x82'):_0x1832ad['body']['from']=_0x4a0334[_0xe02c('0x5b')][_0xe02c('0x7e')];_0x1832ad['body'][_0xe02c('0x5b')]=_0x4a0334['body']['message'];break;case _0xe02c('0x83'):_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x7e')]=_0x4a0334[_0xe02c('0x5b')]['from'];_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x5b')]=_0x4a0334[_0xe02c('0x5b')][_0xe02c('0x5b')];_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x81')]=_0x4a0334[_0xe02c('0x5b')][_0xe02c('0x84')];break;case _0xe02c('0x85'):_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x7e')]=_0x4a0334[_0xe02c('0x5b')][_0xe02c('0x7f')];_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x5b')]=_0x4a0334[_0xe02c('0x5b')][_0xe02c('0x86')];_0x1832ad['body'][_0xe02c('0x81')]=_0x4a0334[_0xe02c('0x5b')]['MessageUUID'];break;case _0xe02c('0x87'):_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x7e')]='+'+_0x4a0334['body'][_0xe02c('0x88')][0x0][_0xe02c('0x7e')];_0x1832ad[_0xe02c('0x5b')]['body']=_0x4a0334[_0xe02c('0x5b')][_0xe02c('0x88')][0x0][_0xe02c('0x89')];_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x81')]=_0x4a0334['body'][_0xe02c('0x88')][0x0]['messageId'];break;case _0xe02c('0x8a'):_0x1832ad['body'][_0xe02c('0x7e')]=_0x4a0334['body'][_0xe02c('0x8b')];_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x5b')]=_0x4a0334[_0xe02c('0x5b')][_0xe02c('0x8c')]['message'];break;case'clickatell':_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x7e')]=_0x4a0334[_0xe02c('0x5b')][_0xe02c('0x8d')];_0x1832ad[_0xe02c('0x5b')]['body']=_0x4a0334[_0xe02c('0x5b')][_0xe02c('0x89')];_0x1832ad[_0xe02c('0x5b')]['messageId']=_0x4a0334[_0xe02c('0x5b')][_0xe02c('0x8e')];break;case _0xe02c('0x8f'):_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x7e')]=_0x4a0334[_0xe02c('0x5b')]['from'];_0x1832ad['body'][_0xe02c('0x5b')]=_0x4a0334[_0xe02c('0x5b')]['message'];_0x1832ad['body']['messageId']=_0x4a0334['body'][_0xe02c('0x90')];break;}}if(_0x1832ad[_0xe02c('0x5b')]['id']){delete _0x1832ad[_0xe02c('0x5b')]['id'];}if(_[_0xe02c('0x91')](_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x7e')])){throw new db[(_0xe02c('0x20'))][(_0xe02c('0x21'))](_0xe02c('0x92'));}if(_['isNil'](_0x1832ad['body'][_0xe02c('0x5b')])||_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x5b')]===''){throw new db[(_0xe02c('0x20'))][(_0xe02c('0x21'))](_0xe02c('0x93'));}if(_[_0xe02c('0x91')](_0x1832ad['body'][_0xe02c('0x94')])){throw new db['Sequelize']['ValidationError'](_0xe02c('0x95')+_0x2be264);}if(!_['includes'](_0x2be264,_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x94')])){throw new db[(_0xe02c('0x20'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2be264);}_0x2f3ecd[_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x94')]]=_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x7e')];return db['CmList']['find']({'where':{'id':_0x1832ad[_0xe02c('0x74')][_0xe02c('0x7b')]},'include':[{'model':db[_0xe02c('0x77')],'as':_0xe02c('0x96'),'where':_0x2f3ecd,'limit':0x1,'order':[[_0xe02c('0x79'),'DESC']]}]});})[_0xe02c('0x23')](handleEntityNotFound(_0x3bd125,null))[_0xe02c('0x23')](function(_0xcf8168){if(_0xcf8168){_0x1832ad[_0xe02c('0x97')]=_['omit'](_0xcf8168,[_0xe02c('0x96')]);if(_0xcf8168[_0xe02c('0x96')][_0xe02c('0x4b')]){return _0xcf8168['Contacts'][0x0];}var _0x4dc435=_[_0xe02c('0x1c')](_0x1832ad[_0xe02c('0x5b')],{'firstName':_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x7e')],'ListId':_0xcf8168['id']});_0x4dc435[_0x1832ad[_0xe02c('0x5b')]['mapKey']]=_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x7e')];return db[_0xe02c('0x77')][_0xe02c('0x5a')](_0x4dc435,{'fields':_0x3b73a5,'raw':!![]});}})[_0xe02c('0x23')](handleEntityNotFound(_0x3bd125,null))['then'](function(_0x5a973b){if(_0x5a973b){_0x1832ad[_0xe02c('0x98')]=_0x5a973b;var _0x1511e4={'ContactId':_0x5a973b['id'],'phone':_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x7e')],'SmsAccountId':_0x4a0334[_0xe02c('0x62')]['id']};var _0x140876={'ContactId':_0x5a973b['id'],'SmsAccountId':_0x4a0334[_0xe02c('0x62')]['id'],'closed':![]};return db[_0xe02c('0x99')][_0xe02c('0x59')]({'where':_0x140876})[_0xe02c('0x23')](function(_0x3a1d3f){if(_0x3a1d3f){return[_0x3a1d3f,![]];}return db['SmsInteraction']['create'](_0x1511e4)['then'](function(_0x26aefe){return[_0x26aefe,!![]];});});}})['spread'](function(_0x3d2be5,_0x14f58b){_0x1832ad[_0xe02c('0x9a')]=_0x3d2be5['get']({'plain':!![]});_0x1832ad['interaction'][_0xe02c('0x9b')]=![];if(_0x14f58b){if(_0x1832ad['account'][_0xe02c('0x9c')]){_0x1832ad[_0xe02c('0x75')][_0xe02c('0x9d')]({'id':0x0,'priority':_0x1832ad[_0xe02c('0x75')][_0xe02c('0x4b')]+0x1,'app':_0xe02c('0x9e'),'appdata':_0xe02c('0x9f'),'interval':_0xe02c('0xa0')});}_0x1832ad[_0xe02c('0x9a')][_0xe02c('0x9b')]=!![];}return db[_0xe02c('0xa1')][_0xe02c('0x5a')]({'phone':_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x7e')],'messageId':_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x81')],'body':_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x5b')],'SmsAccountId':_0x4a0334[_0xe02c('0x62')]['id'],'SmsInteractionId':_0x3d2be5['id'],'direction':'in','ContactId':_0x3d2be5[_0xe02c('0xa2')],'AttachmentId':_0x1832ad['body'][_0xe02c('0xa3')]});})[_0xe02c('0x23')](function(_0x1e6e2c){_0x1832ad[_0xe02c('0x2a')]=_0x1e6e2c;if(_0x1832ad[_0xe02c('0x9a')][_0xe02c('0xa4')]){return db[_0xe02c('0xa5')]['find']({'attributes':['id',_0xe02c('0x3b')],'where':{'id':_0x1832ad[_0xe02c('0x9a')][_0xe02c('0xa4')]}})[_0xe02c('0x23')](function(_0x54b70e){if(_0x54b70e){_0x1832ad[_0xe02c('0x75')][_0xe02c('0xa6')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x54b70e['name']+','+(_0x1832ad[_0xe02c('0x74')][_0xe02c('0xa7')]||0xa),'interval':_0xe02c('0xa0')});}return respondWithRpcPromise(_0xe02c('0xa8'),_0xe02c('0xa9'),_0x1832ad);});}return respondWithRpcPromise(_0xe02c('0xa8'),_0xe02c('0xa9'),_0x1832ad);})[_0xe02c('0x23')](function(_0x57e1a4){if(_0x57e1a4){var _0x19d766=0xc8;var _0x235d39='receiveMessage';logger['info']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x235d39,_0x19d766,_0xe02c('0xaa'));logger[_0xe02c('0xab')](_0xe02c('0xac'),_0x235d39,_0x19d766,_0xe02c('0xaa'),JSON[_0xe02c('0x26')](_0x57e1a4));if(_0x1832ad[_0xe02c('0x74')][_0xe02c('0x42')]===_0xe02c('0x7d')){return _0x3bd125[_0xe02c('0x2f')](_0x19d766)[_0xe02c('0xad')]('Content-Type',_0xe02c('0xae'))[_0xe02c('0x3c')](_0xe02c('0xaf'));}else{return _0x3bd125[_0xe02c('0x2f')](_0x19d766)[_0xe02c('0x30')](_0x57e1a4);}}})[_0xe02c('0x2c')](handleError(_0x3bd125,null));};exports[_0xe02c('0xb0')]=function(_0x50fa5a,_0x5bb23d,_0x538d32){return db['SmsAccount'][_0xe02c('0x68')]({'where':{'id':_0x50fa5a[_0xe02c('0x62')]['id']}})['then'](handleEntityNotFound(_0x5bb23d,null))[_0xe02c('0x23')](function(_0x28e509){if(_0x28e509){return db[_0xe02c('0xb1')]['transaction'](function(_0x3b20e9){return db[_0xe02c('0x72')][_0xe02c('0x39')]({'where':{'SmsAccountId':_0x50fa5a[_0xe02c('0x62')]['id']},'transaction':_0x3b20e9})[_0xe02c('0x23')](function(_0x5ebf58){var _0x473bc2=_[_0xe02c('0x3f')](_0x50fa5a[_0xe02c('0x5b')],function(_0x5cc515){_0x5cc515[_0xe02c('0x65')]=_0x50fa5a['params']['id'];return _0x5cc515;});return db[_0xe02c('0x72')][_0xe02c('0xb2')](_0x473bc2,{'transaction':_0x3b20e9});});})['then'](function(){return db[_0xe02c('0x72')][_0xe02c('0xb3')]({'where':{'SmsAccountId':_0x50fa5a[_0xe02c('0x62')]['id']},'order':_0xe02c('0x76')});});}})[_0xe02c('0x23')](respondWithResult(_0x5bb23d,null))[_0xe02c('0x2c')](handleError(_0x5bb23d,null));};exports[_0xe02c('0xb4')]=function(_0x3dd774,_0x37a2bc,_0x15f5d6){var _0x3e4ed4={};var _0x57ef2e={};var _0xa384c1;var _0x19d9a2;return db['SmsAccount']['findOne']({'where':{'id':_0x3dd774[_0xe02c('0x62')]['id']}})['then'](handleEntityNotFound(_0x37a2bc,null))['then'](function(_0x513998){if(_0x513998){_0xa384c1=_0x513998;_0x57ef2e[_0xe02c('0x44')]=_[_0xe02c('0x46')](db[_0xe02c('0x72')][_0xe02c('0x41')]);_0x57ef2e[_0xe02c('0x45')]=_[_0xe02c('0x46')](_0x3dd774['query']);_0x57ef2e[_0xe02c('0x47')]=_[_0xe02c('0x48')](_0x57ef2e['model'],_0x57ef2e['query']);_0x3e4ed4[_0xe02c('0x49')]=_[_0xe02c('0x48')](_0x57ef2e[_0xe02c('0x44')],qs[_0xe02c('0x4a')](_0x3dd774['query']['fields']));_0x3e4ed4[_0xe02c('0x49')]=_0x3e4ed4[_0xe02c('0x49')][_0xe02c('0x4b')]?_0x3e4ed4['attributes']:_0x57ef2e[_0xe02c('0x44')];_0x3e4ed4[_0xe02c('0x4e')]=qs[_0xe02c('0x4f')](_0x3dd774[_0xe02c('0x45')][_0xe02c('0x4f')]);_0x3e4ed4[_0xe02c('0x50')]=qs[_0xe02c('0x47')](_['pick'](_0x3dd774[_0xe02c('0x45')],_0x57ef2e[_0xe02c('0x47')]));if(_0x3dd774[_0xe02c('0x45')][_0xe02c('0x52')]){_0x3e4ed4[_0xe02c('0x50')]=_[_0xe02c('0x53')](_0x3e4ed4[_0xe02c('0x50')],{'$or':_['map'](_0x3e4ed4[_0xe02c('0x49')],function(_0x4d9c7c){var _0x12d26a={};_0x12d26a[_0x4d9c7c]={'$like':'%'+_0x3dd774['query'][_0xe02c('0x52')]+'%'};return _0x12d26a;})});}_0x3e4ed4=_[_0xe02c('0x53')]({},_0x3e4ed4,_0x3dd774[_0xe02c('0x55')]);return _0xa384c1[_0xe02c('0xb4')](_0x3e4ed4);}})['then'](function(_0x2a927e){if(_0x2a927e){_0x19d9a2=_0x2a927e[_0xe02c('0x4b')];if(!_0x3dd774[_0xe02c('0x45')][_0xe02c('0x4c')](_0xe02c('0x4d'))){_0x3e4ed4[_0xe02c('0x33')]=qs[_0xe02c('0x33')](_0x3dd774[_0xe02c('0x45')][_0xe02c('0x33')]);_0x3e4ed4[_0xe02c('0x32')]=qs[_0xe02c('0x32')](_0x3dd774[_0xe02c('0x45')][_0xe02c('0x32')]);}return _0xa384c1[_0xe02c('0xb4')](_0x3e4ed4);}})[_0xe02c('0x23')](function(_0x1c9887){if(_0x1c9887){return _0x1c9887?{'count':_0x19d9a2,'rows':_0x1c9887}:null;}})[_0xe02c('0x23')](respondWithResult(_0x37a2bc,null))[_0xe02c('0x2c')](handleError(_0x37a2bc,null));};exports['getInteractions']=function(_0x547e8c,_0x49c9fb,_0x493435){var _0x36398e={'raw':![],'where':{}};var _0x34b748={};var _0x282e79={'count':0x0,'rows':[]};return db[_0xe02c('0x40')]['findOne']({'where':{'id':_0x547e8c['params']['id']}})['then'](handleEntityNotFound(_0x49c9fb,null))[_0xe02c('0x23')](function(_0x2a1f02){if(_0x2a1f02){_0x34b748[_0xe02c('0x44')]=_[_0xe02c('0x46')](db['SmsInteraction'][_0xe02c('0x41')]);_0x34b748['query']=_['keys'](_0x547e8c[_0xe02c('0x45')]);_0x34b748[_0xe02c('0x47')]=_[_0xe02c('0x48')](_0x34b748['model'],_0x34b748[_0xe02c('0x45')]);_0x36398e[_0xe02c('0x49')]=_[_0xe02c('0x48')](_0x34b748[_0xe02c('0x44')],qs[_0xe02c('0x4a')](_0x547e8c[_0xe02c('0x45')][_0xe02c('0x4a')]));_0x36398e[_0xe02c('0x49')]=_0x36398e['attributes']['length']?_0x36398e[_0xe02c('0x49')]:_0x34b748[_0xe02c('0x44')];if(!_0x547e8c[_0xe02c('0x45')][_0xe02c('0x4c')]('nolimit')){_0x36398e['limit']=qs[_0xe02c('0x33')](_0x547e8c[_0xe02c('0x45')][_0xe02c('0x33')]);_0x36398e[_0xe02c('0x32')]=qs[_0xe02c('0x32')](_0x547e8c[_0xe02c('0x45')][_0xe02c('0x32')]);}_0x36398e[_0xe02c('0x4e')]=qs[_0xe02c('0x4f')](_0x547e8c[_0xe02c('0x45')][_0xe02c('0x4f')]);_0x36398e['where']=qs[_0xe02c('0x47')](_[_0xe02c('0x51')](_0x547e8c['query'],_0x34b748[_0xe02c('0x47')]));_0x36398e[_0xe02c('0x50')]['SmsAccountId']=_0x2a1f02['id'];if(_0x547e8c[_0xe02c('0x45')][_0xe02c('0x52')]){_0x36398e[_0xe02c('0x50')]=_[_0xe02c('0x53')](_0x36398e[_0xe02c('0x50')],{'$or':_[_0xe02c('0x3f')](_0x36398e[_0xe02c('0x49')],function(_0x41350b){var _0xadb5a0={};_0xadb5a0[_0x41350b]={'$like':'%'+_0x547e8c[_0xe02c('0x45')][_0xe02c('0x52')]+'%'};return _0xadb5a0;})});}_0x36398e=_[_0xe02c('0x53')]({},_0x36398e,_0x547e8c[_0xe02c('0x55')]);return db[_0xe02c('0x99')][_0xe02c('0x31')]({'where':_0x36398e[_0xe02c('0x50')]})[_0xe02c('0x23')](function(_0xb7a31e){_0x282e79[_0xe02c('0x31')]=_0xb7a31e;if(_0x547e8c[_0xe02c('0x45')][_0xe02c('0x56')]){_0x36398e[_0xe02c('0x57')]=[{'model':db['CmContact'],'as':_0xe02c('0xb5'),'required':![]},{'model':db[_0xe02c('0xa5')],'as':'Owner','attributes':[_0xe02c('0x3b'),_0xe02c('0xb6'),_0xe02c('0xb7')],'required':![]},{'model':db[_0xe02c('0xb8')],'as':'Tags','attributes':['id','name',_0xe02c('0xb9')],'where':_0x547e8c['query'][_0xe02c('0xba')]?{'id':_0x547e8c[_0xe02c('0x45')][_0xe02c('0xba')]}:undefined,'required':_0x547e8c[_0xe02c('0x45')]['tag']?!![]:![]}];}return db['SmsInteraction'][_0xe02c('0x6e')](_0x36398e);})[_0xe02c('0x23')](function(_0x2adfd4){_0x282e79[_0xe02c('0x58')]=_0x2adfd4;return _0x282e79;});}})[_0xe02c('0x23')](respondWithFilteredResult(_0x49c9fb,_0x36398e))[_0xe02c('0x2c')](handleError(_0x49c9fb,null));};exports[_0xe02c('0x3c')]=function(_0x1617e0,_0x2d2921,_0x2a61e3){var _0x2b8b5d,_0x2fc0d6,_0x1bf71e;if(_['isNil'](_0x1617e0['body'][_0xe02c('0x5b')])||_0x1617e0[_0xe02c('0x5b')]['body']===''){throw new db[(_0xe02c('0x20'))][(_0xe02c('0x21'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xe02c('0x91')](_0x1617e0[_0xe02c('0x5b')]['to'])){throw new db['Sequelize'][(_0xe02c('0x21'))](_0xe02c('0xbb'));}_0x2b8b5d=_0x1617e0['body']['to'];return db['SmsAccount'][_0xe02c('0x59')]({'where':{'id':_0x1617e0[_0xe02c('0x62')]['id']},'include':[{'model':db[_0xe02c('0xbc')],'as':'List','include':[{'model':db[_0xe02c('0x77')],'as':'Contacts','where':{'mobile':_0x2b8b5d},'limit':0x1,'order':[[_0xe02c('0x79'),_0xe02c('0xbd')]]}]}]})[_0xe02c('0x23')](handleEntityNotFound(_0x2d2921,null))[_0xe02c('0x23')](function(_0x1e191d){if(_0x1e191d&&_0x1e191d[_0xe02c('0xbe')]){_0x2fc0d6=_0x1e191d[_0xe02c('0x5c')]({'plain':!![]});if(_0x2fc0d6[_0xe02c('0xbe')]&&_0x2fc0d6[_0xe02c('0xbe')][_0xe02c('0x96')][_0xe02c('0x4b')]){return _0x2fc0d6[_0xe02c('0xbe')]['Contacts'][0x0];}return db['CmContact'][_0xe02c('0x5a')](_[_0xe02c('0x1c')](_0x1617e0[_0xe02c('0x5b')],{'firstName':_0x2b8b5d,'mobile':_0x2b8b5d,'phone':_0x2b8b5d,'ListId':_0x2fc0d6[_0xe02c('0x7b')]}));}})[_0xe02c('0x23')](handleEntityNotFound(_0x2d2921,null))[_0xe02c('0x23')](function(_0x308581){if(_0x308581){_0x1bf71e=_0x308581;return db[_0xe02c('0x99')][_0xe02c('0x59')]({'where':{'ContactId':_0x1bf71e['id'],'closed':![],'SmsAccountId':_0x2fc0d6['id']}})[_0xe02c('0x23')](function(_0x10a1ec){if(_0x10a1ec){return[_0x10a1ec,![]];}return db['SmsInteraction']['create']({'UserId':_0x1617e0['user']['id'],'ContactId':_0x1bf71e['id'],'SmsAccountId':_0x2fc0d6['id'],'phone':_0x2b8b5d,'firstMsgDirection':_0xe02c('0xbf'),'Messages':[_['merge'](_0x1617e0[_0xe02c('0x5b')],{'read':![],'body':_0x1617e0[_0xe02c('0x5b')]['body'],'phone':_0x2b8b5d,'SmsAccountId':_0x2fc0d6['id'],'UserId':_0x1617e0[_0xe02c('0xc0')]['id'],'ContactId':_0x1bf71e['id']})]},{'include':[{'model':db[_0xe02c('0xa1')],'as':_0xe02c('0xc1')}]})['then'](function(_0x1ea0e2){return[_0x1ea0e2,!![]];});});}})[_0xe02c('0xc2')](function(_0x5a9fca,_0x3e082c){if(_0x3e082c){return _0x5a9fca;}return db[_0xe02c('0xa1')][_0xe02c('0x5a')](_[_0xe02c('0x53')](_0x1617e0['body'],{'read':![],'body':_0x1617e0[_0xe02c('0x5b')][_0xe02c('0x5b')],'phone':_0x2b8b5d,'SmsAccountId':_0x2fc0d6['id'],'SmsInteractionId':_0x5a9fca['id'],'UserId':_0x1617e0[_0xe02c('0xc0')]['id'],'ContactId':_0x1bf71e['id']}))[_0xe02c('0x23')](function(_0x47ddd0){_0x5a9fca[_0xe02c('0xc3')]['Messages']=[];_0x5a9fca[_0xe02c('0xc3')][_0xe02c('0xc1')][_0xe02c('0x9d')](_0x47ddd0[_0xe02c('0xc3')]);return _0x5a9fca;});})[_0xe02c('0x23')](respondWithResult(_0x2d2921,null))[_0xe02c('0x2c')](handleError(_0x2d2921,null));};exports[_0xe02c('0x2f')]=function(_0x3576cf,_0x6fccba,_0x3eac9d){if(_0x3576cf[_0xe02c('0x5b')]['id']){delete _0x3576cf[_0xe02c('0x5b')]['id'];}console[_0xe02c('0xc4')]('endpoint\x20/status\x20POST\x20/',_0x3576cf['body']);var _0x59cdba,_0x4cbcf0,_0x2a4b69;return db[_0xe02c('0x40')][_0xe02c('0x59')]({'where':{'id':_0x3576cf[_0xe02c('0x62')]['id']}})['then'](handleEntityNotFound(_0x6fccba,null))['then'](function(_0x1bbdff){if(_0x1bbdff){_0x2a4b69=_0x1bbdff;logger[_0xe02c('0xab')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe02c('0x2f'),_0xe02c('0xc5'),_0x1bbdff['type'],util[_0xe02c('0xc6')](_0x3576cf[_0xe02c('0x5b')],{'showHidden':![],'depth':null}));switch(_0x1bbdff[_0xe02c('0x42')]){case'skebby':if(_0x3576cf[_0xe02c('0x5b')]['skebby_dispatch_id']&&_0x3576cf[_0xe02c('0x5b')][_0xe02c('0x2f')]){_0x4cbcf0=_0x3576cf[_0xe02c('0x5b')][_0xe02c('0x2f')];return db['SmsMessage']['find']({'where':{'messageId':_0x3576cf[_0xe02c('0x5b')][_0xe02c('0xc7')]}});}break;case _0xe02c('0x82'):if(_0x3576cf[_0xe02c('0x5b')][_0xe02c('0xc8')]&&_0x3576cf[_0xe02c('0x5b')][_0xe02c('0xc9')]){_0x4cbcf0=_0x3576cf['body'][_0xe02c('0xc9')];return db['SmsMessage'][_0xe02c('0x59')]({'where':{'messageId':_0x3576cf[_0xe02c('0x5b')][_0xe02c('0xc8')]}});}break;case _0xe02c('0x83'):if(_0x3576cf['body'][_0xe02c('0x84')]&&_0x3576cf['body']['status_code']){_0x4cbcf0=_0x3576cf[_0xe02c('0x5b')][_0xe02c('0xca')];return db[_0xe02c('0xa1')][_0xe02c('0x59')]({'where':{'messageId':_0x3576cf['body'][_0xe02c('0x84')]}});}break;case'infobip':var _0x43f497=_0x3576cf[_0xe02c('0x5b')][_0xe02c('0x88')][0x0];if(_0x43f497[_0xe02c('0x81')]&&_0x43f497[_0xe02c('0x2f')]['groupName']==='DELIVERED'){_0x4cbcf0=_0x43f497['status']['groupName'];return db[_0xe02c('0xa1')]['find']({'where':{'messageId':_0x43f497['messageId']}});}break;case _0xe02c('0xcb'):if(_0x3576cf[_0xe02c('0x5b')][_0xe02c('0x81')]&&_0x3576cf[_0xe02c('0x5b')][_0xe02c('0x2f')]){_0x4cbcf0=_0x3576cf[_0xe02c('0x5b')][_0xe02c('0x2f')];return db[_0xe02c('0xa1')][_0xe02c('0x59')]({'where':{'messageId':_0x3576cf[_0xe02c('0x5b')][_0xe02c('0x81')]}});}break;case _0xe02c('0x8f'):if(_0x3576cf[_0xe02c('0x5b')][_0xe02c('0xcc')]&&_0x3576cf[_0xe02c('0x5b')][_0xe02c('0x2f')]){_0x4cbcf0=_0x3576cf[_0xe02c('0x5b')][_0xe02c('0x2f')];return db[_0xe02c('0xa1')][_0xe02c('0x59')]({'where':{'messageId':_0x3576cf[_0xe02c('0x5b')][_0xe02c('0xcc')]}});}break;}}})[_0xe02c('0x23')](handleEntityNotFound(_0x6fccba,null))['then'](function(_0x52688f){if(_0x52688f){_0x59cdba=_0x52688f;switch(_0x2a4b69['type']){case _0xe02c('0xcd'):if(_0x4cbcf0==='DELIVERED'){return _0x59cdba[_0xe02c('0x38')]({'read':!![]});}else{logger[_0xe02c('0x27')](_0xe02c('0xce'),_0xe02c('0x2f'),'skebby',util[_0xe02c('0xc6')](_0x3576cf[_0xe02c('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xe02c('0x82'):if(_0x4cbcf0==='1'){return _0x59cdba['update']({'read':!![]});}else{logger[_0xe02c('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe02c('0x2f'),'skebby',util['inspect'](_0x3576cf[_0xe02c('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xe02c('0x83'):if(!_0x3576cf[_0xe02c('0x5b')][_0xe02c('0xcf')]&&_0x4cbcf0>=0xc8&&_0x4cbcf0<=0xce){return _0x59cdba[_0xe02c('0x38')]({'read':!![]});}else{logger[_0xe02c('0x27')](_0xe02c('0xce'),_0xe02c('0x2f'),_0xe02c('0x83'),util[_0xe02c('0xc6')](_0x3576cf[_0xe02c('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xe02c('0x87'):var _0x5433a6=_0x3576cf[_0xe02c('0x5b')]['results'][0x0];if(_0x5433a6[_0xe02c('0x2f')][_0xe02c('0xd0')]==='DELIVERED'){return _0x59cdba[_0xe02c('0x38')]({'read':!![]});}else{logger['error'](_0xe02c('0xce'),_0xe02c('0x2f'),'infobip',util[_0xe02c('0xc6')](_0x3576cf[_0xe02c('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xe02c('0xcb'):if(_0x4cbcf0==_0xe02c('0xd1')||_0x4cbcf0==_0xe02c('0xd2')){return _0x59cdba['update']({'read':!![]});}else{logger[_0xe02c('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe02c('0x2f'),'clickatell',util['inspect'](_0x3576cf[_0xe02c('0x5b')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x4cbcf0===_0xe02c('0xd3')||_0x4cbcf0===_0xe02c('0xd4')){return _0x59cdba['update']({'read':!![]});}else{logger[_0xe02c('0x27')](_0xe02c('0xce'),_0xe02c('0x2f'),_0xe02c('0x8f'),util['inspect'](_0x3576cf[_0xe02c('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x59cdba;}})['then'](respondWithResult(_0x6fccba,null))[_0xe02c('0x2c')](handleError(_0x6fccba,null));};exports[_0xe02c('0xd5')]=function(_0x14c95e,_0x47b7ff,_0x309bf4){var _0x4f367a,_0x443f17,_0x340b1f;return db['SmsAccount'][_0xe02c('0x59')]({'where':{'id':_0x14c95e[_0xe02c('0x62')]['id']}})[_0xe02c('0x23')](handleEntityNotFound(_0x47b7ff,null))[_0xe02c('0x23')](function(_0x56706c){if(_0x56706c){_0x340b1f=_0x56706c;logger[_0xe02c('0xab')](_0xe02c('0xce'),'status','received\x20delivery\x20report\x20from',_0x56706c[_0xe02c('0x42')],util[_0xe02c('0xc6')](_0x14c95e['query'],{'showHidden':![],'depth':null}));switch(_0x56706c[_0xe02c('0x42')]){case _0xe02c('0x8a'):if(_0x14c95e[_0xe02c('0x45')][_0xe02c('0xd6')]&&_0x14c95e[_0xe02c('0x45')][_0xe02c('0xd7')]){_0x443f17=_0x14c95e[_0xe02c('0x45')]['state'];return db[_0xe02c('0xa1')][_0xe02c('0x59')]({'where':{'messageId':_0x14c95e[_0xe02c('0x45')]['message-id']}});}break;}}})[_0xe02c('0x23')](handleEntityNotFound(_0x47b7ff,null))['then'](function(_0x4d4b7c){if(_0x4d4b7c){_0x4f367a=_0x4d4b7c;switch(_0x340b1f['type']){case _0xe02c('0x8a'):if(_0x443f17==='2'||_0x443f17==='6'){return _0x4f367a[_0xe02c('0x38')]({'read':!![]});}else{logger[_0xe02c('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe02c('0x2f'),_0xe02c('0x8a'),util[_0xe02c('0xc6')](_0x14c95e['query'],{'showHidden':![],'depth':null}));};break;}return _0x4f367a;}})[_0xe02c('0x23')](respondWithResult(_0x47b7ff,null))[_0xe02c('0x2c')](handleError(_0x47b7ff,null));};exports[_0xe02c('0xd8')]=function(_0x321f85,_0x5d6a21,_0x5923ed){return db[_0xe02c('0x40')]['find']({'where':{'id':_0x321f85[_0xe02c('0x62')]['id']}})[_0xe02c('0x23')](handleEntityNotFound(_0x5d6a21,null))[_0xe02c('0x23')](function(_0x5a0b69){if(_0x5a0b69){return _0x5a0b69[_0xe02c('0xd8')](_0x321f85[_0xe02c('0x5b')][_0xe02c('0x6a')],_[_0xe02c('0xd9')](_0x321f85[_0xe02c('0x5b')],[_0xe02c('0x6a'),'id'])||{})['spread'](function(_0x2ce10e){for(var _0x5f01ed=0x0;_0x5f01ed<_0x321f85[_0xe02c('0x5b')][_0xe02c('0x6a')][_0xe02c('0x4b')];_0x5f01ed+=0x1){socket[_0xe02c('0xda')](_0xe02c('0xdb'),{'UserId':_0x321f85[_0xe02c('0x5b')][_0xe02c('0x6a')][_0x5f01ed],'SmsAccountId':_0x321f85['params']['id']});}return _0x2ce10e;});}})[_0xe02c('0x23')](respondWithResult(_0x5d6a21,null))[_0xe02c('0x2c')](handleError(_0x5d6a21,null));};exports[_0xe02c('0xdc')]=function(_0x3bc894,_0x1eba43,_0x9bf228){return db[_0xe02c('0x40')][_0xe02c('0x59')]({'where':{'id':_0x3bc894[_0xe02c('0x62')]['id']}})['then'](handleEntityNotFound(_0x1eba43,null))[_0xe02c('0x23')](function(_0x291c91){if(_0x291c91){return _0x291c91[_0xe02c('0xdc')](_0x3bc894[_0xe02c('0x45')][_0xe02c('0x6a')])[_0xe02c('0x23')](function(){if(_[_0xe02c('0xdd')](_0x3bc894[_0xe02c('0x45')]['ids'])){for(var _0x3cfbc8=0x0;_0x3cfbc8<_0x3bc894[_0xe02c('0x45')][_0xe02c('0x6a')][_0xe02c('0x4b')];_0x3cfbc8+=0x1){socket['emit'](_0xe02c('0xde'),{'UserId':Number(_0x3bc894[_0xe02c('0x45')][_0xe02c('0x6a')][_0x3cfbc8]),'SmsAccountId':Number(_0x3bc894[_0xe02c('0x62')]['id'])});}}else{socket[_0xe02c('0xda')]('userSmsAccount:remove',{'UserId':Number(_0x3bc894[_0xe02c('0x45')]['ids']),'SmsAccountId':Number(_0x3bc894[_0xe02c('0x62')]['id'])});}});}})[_0xe02c('0x23')](respondWithStatusCode(_0x1eba43,null))['catch'](handleError(_0x1eba43,null));};exports[_0xe02c('0xdf')]=function(_0x121eca,_0x440261,_0x32d1f2){var _0xfa8bd6={};var _0x256328={};var _0x4ae8db;var _0x1b53c8;return db[_0xe02c('0x40')][_0xe02c('0x68')]({'where':{'id':_0x121eca['params']['id']}})[_0xe02c('0x23')](handleEntityNotFound(_0x440261,null))[_0xe02c('0x23')](function(_0x54be90){if(_0x54be90){_0x4ae8db=_0x54be90;_0x256328[_0xe02c('0x44')]=_['keys'](db['User'][_0xe02c('0x41')]);_0x256328[_0xe02c('0x45')]=_[_0xe02c('0x46')](_0x121eca[_0xe02c('0x45')]);_0x256328[_0xe02c('0x47')]=_[_0xe02c('0x48')](_0x256328[_0xe02c('0x44')],_0x256328[_0xe02c('0x45')]);_0xfa8bd6[_0xe02c('0x49')]=_[_0xe02c('0x48')](_0x256328['model'],qs['fields'](_0x121eca[_0xe02c('0x45')][_0xe02c('0x4a')]));_0xfa8bd6['attributes']=_0xfa8bd6['attributes'][_0xe02c('0x4b')]?_0xfa8bd6[_0xe02c('0x49')]:_0x256328[_0xe02c('0x44')];_0xfa8bd6[_0xe02c('0x4e')]=qs[_0xe02c('0x4f')](_0x121eca['query'][_0xe02c('0x4f')]);_0xfa8bd6[_0xe02c('0x50')]=qs[_0xe02c('0x47')](_[_0xe02c('0x51')](_0x121eca[_0xe02c('0x45')],_0x256328[_0xe02c('0x47')]));if(_0x121eca[_0xe02c('0x45')][_0xe02c('0x52')]){_0xfa8bd6[_0xe02c('0x50')]=_[_0xe02c('0x53')](_0xfa8bd6[_0xe02c('0x50')],{'$or':_[_0xe02c('0x3f')](_0xfa8bd6[_0xe02c('0x49')],function(_0x34e8d5){var _0x30cc86={};_0x30cc86[_0x34e8d5]={'$like':'%'+_0x121eca[_0xe02c('0x45')]['filter']+'%'};return _0x30cc86;})});}_0xfa8bd6=_[_0xe02c('0x53')]({},_0xfa8bd6,_0x121eca['options']);return _0x4ae8db[_0xe02c('0xdf')](_0xfa8bd6);}})['then'](function(_0x3a8aa6){if(_0x3a8aa6){_0x1b53c8=_0x3a8aa6[_0xe02c('0x4b')];if(!_0x121eca[_0xe02c('0x45')][_0xe02c('0x4c')](_0xe02c('0x4d'))){_0xfa8bd6['limit']=qs[_0xe02c('0x33')](_0x121eca[_0xe02c('0x45')][_0xe02c('0x33')]);_0xfa8bd6[_0xe02c('0x32')]=qs[_0xe02c('0x32')](_0x121eca[_0xe02c('0x45')]['offset']);}return _0x4ae8db['getAgents'](_0xfa8bd6);}})[_0xe02c('0x23')](function(_0x393d2e){if(_0x393d2e){return _0x393d2e?{'count':_0x1b53c8,'rows':_0x393d2e}:null;}})[_0xe02c('0x23')](respondWithResult(_0x440261,null))[_0xe02c('0x2c')](handleError(_0x440261,null));}; \ No newline at end of file +var _0x9f37=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','redis','defaults','localhost','./smsAccount.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','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','update','get','SmsAccounts','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','hasOwnProperty','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','account','applications','Applications','priority','asc','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','MessageSid','sender','connectel','clicksend','message_id','plivo','Text','MessageUUID','infobip','results','text','csc','originatingAddress','segmentedMessage','clickatell','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','contact','SmsInteraction','spread','interaction','created','autoclose','close','unmanaged','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','\x0a','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','Contact','Owner','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','SmsMessage','Messages','dataValues','push','log','inspect','skebby','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','redif','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','state','message-id','addAgents','omit','emit','userSmsAccount:save','removeAgents','isArray','getAgents','html-pdf','eml-format','zip-dir','moment','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service'];(function(_0x24ca79,_0x41b9b4){var _0x273007=function(_0x4eed7a){while(--_0x4eed7a){_0x24ca79['push'](_0x24ca79['shift']());}};_0x273007(++_0x41b9b4);}(_0x9f37,0xd1));var _0x79f3=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x9f37[_0x5f0089];return _0x193892;};'use strict';var pdf=require(_0x79f3('0x0'));var emlformat=require(_0x79f3('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x79f3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x79f3('0x3'));var BPromise=require(_0x79f3('0x4'));var Mustache=require(_0x79f3('0x5'));var util=require('util');var path=require(_0x79f3('0x6'));var sox=require(_0x79f3('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x79f3('0x8'));var squel=require(_0x79f3('0x9'));var crypto=require(_0x79f3('0xa'));var jsforce=require(_0x79f3('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x79f3('0xc'));var querystring=require(_0x79f3('0xd'));var Papa=require('papaparse');var Redis=require(_0x79f3('0xe'));var authService=require(_0x79f3('0xf'));var qs=require(_0x79f3('0x10'));var as=require(_0x79f3('0x11'));var hardwareService=require(_0x79f3('0x12'));var logger=require('../../config/logger')(_0x79f3('0x13'));var utils=require(_0x79f3('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x79f3('0x15')]=_[_0x79f3('0x16')](config[_0x79f3('0x15')],{'host':_0x79f3('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x79f3('0x15')]));require(_0x79f3('0x18'))[_0x79f3('0x19')](socket);var jayson=require(_0x79f3('0x1a'));var client=jayson[_0x79f3('0x1b')][_0x79f3('0x1c')]({'port':0x232c});function checkPasswordPattern(_0x5a79eb,_0x5764d4,_0x39c0bb){if(_0x39c0bb){var _0x7bf340=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x7bf340['test'](_0x5764d4)){return _0x5a79eb;}else{throw new db[(_0x79f3('0x1d'))][(_0x79f3('0x1e'))](_0x79f3('0x1f'));}}else{return _0x5a79eb;}}function respondWithRpcPromise(_0x162f71,_0x51685f,_0x31e411,_0x897f98){return new BPromise(function(_0x2179d0,_0x331b30){var _0x430f4c=_0x897f98||client;return _0x430f4c[_0x79f3('0x20')](_0x162f71,_0x31e411)[_0x79f3('0x21')](function(_0x4064b5){logger[_0x79f3('0x22')](_0x79f3('0x23'),_0x51685f,_0x79f3('0x24'));logger[_0x79f3('0x25')](_0x79f3('0x26'),_0x51685f,_0x79f3('0x24'),JSON[_0x79f3('0x27')](_0x4064b5));if(_0x4064b5[_0x79f3('0x28')]){if(_0x4064b5[_0x79f3('0x28')][_0x79f3('0x29')]===0x1f4){logger[_0x79f3('0x28')](_0x79f3('0x23'),_0x51685f,_0x4064b5[_0x79f3('0x28')][_0x79f3('0x2a')]);return _0x331b30(_0x4064b5[_0x79f3('0x28')][_0x79f3('0x2a')]);}logger[_0x79f3('0x28')]('SmsAccount,\x20%s,\x20%s',_0x51685f,_0x4064b5[_0x79f3('0x28')]['message']);return _0x2179d0(_0x4064b5[_0x79f3('0x28')][_0x79f3('0x2a')]);}else{logger[_0x79f3('0x22')]('SmsAccount,\x20%s,\x20%s',_0x51685f,'request\x20sent');_0x2179d0(_0x4064b5[_0x79f3('0x2b')][_0x79f3('0x2a')]);}})[_0x79f3('0x2c')](function(_0x2e0bcb){logger[_0x79f3('0x28')](_0x79f3('0x23'),_0x51685f,_0x2e0bcb);_0x331b30(_0x2e0bcb);});});}function respondWithStatusCode(_0x5d7954,_0x31efe8){_0x31efe8=_0x31efe8||0xcc;return function(_0x30b394){if(_0x30b394){return _0x5d7954['sendStatus'](_0x31efe8);}return _0x5d7954[_0x79f3('0x2d')](_0x31efe8)[_0x79f3('0x2e')]();};}function respondWithResult(_0x39ab86,_0x4c3c11){_0x4c3c11=_0x4c3c11||0xc8;return function(_0x4b0670){if(_0x4b0670){return _0x39ab86[_0x79f3('0x2d')](_0x4c3c11)[_0x79f3('0x2f')](_0x4b0670);}};}function respondWithFilteredResult(_0x1cb0c5,_0x337911){return function(_0x205267){if(_0x205267){var _0x69d14f=_0x205267[_0x79f3('0x30')],_0x3db9cd=_0x337911[_0x79f3('0x31')],_0x250a48=_0x337911[_0x79f3('0x31')]+_0x337911[_0x79f3('0x32')],_0x3b30ce;if(_0x250a48>=_0x69d14f){_0x250a48=_0x69d14f;_0x3b30ce=0xc8;}else{_0x3b30ce=0xce;}_0x1cb0c5[_0x79f3('0x2d')](_0x3b30ce);return _0x1cb0c5[_0x79f3('0x33')](_0x79f3('0x34'),_0x3db9cd+'-'+_0x250a48+'/'+_0x69d14f)[_0x79f3('0x2f')](_0x205267);}return null;};}function patchUpdates(_0x29e665){return function(_0x20108a){try{jsonpatch[_0x79f3('0x35')](_0x20108a,_0x29e665,!![]);}catch(_0x9fe9){return BPromise['reject'](_0x9fe9);}return _0x20108a['save']();};}function saveUpdates(_0x36554f,_0x4f154f){return function(_0x98195e){if(_0x98195e){return _0x98195e[_0x79f3('0x36')](_0x36554f)[_0x79f3('0x21')](function(_0x518dca){return _0x518dca;});}return null;};}function removeEntity(_0x356a48,_0x323414){return function(_0x22b732){if(_0x22b732){return _0x22b732['destroy']()[_0x79f3('0x21')](function(){var _0x5a77d2=_0x22b732[_0x79f3('0x37')]({'plain':!![]});var _0x49a237=_0x79f3('0x38');return db[_0x79f3('0x39')][_0x79f3('0x3a')]({'where':{'type':_0x49a237,'resourceId':_0x5a77d2['id']}})[_0x79f3('0x21')](function(){return _0x22b732;});})[_0x79f3('0x21')](function(){_0x356a48['status'](0xcc)[_0x79f3('0x2e')]();});}};}function handleEntityNotFound(_0x118ec3,_0xd34738){return function(_0x559429){if(!_0x559429){_0x118ec3['sendStatus'](0x194);}return _0x559429;};}function handleError(_0x90ff00,_0xa88d7c){_0xa88d7c=_0xa88d7c||0x1f4;return function(_0x4e20a2){logger[_0x79f3('0x28')](_0x4e20a2[_0x79f3('0x3b')]);if(_0x4e20a2['name']){delete _0x4e20a2[_0x79f3('0x3c')];}_0x90ff00['status'](_0xa88d7c)[_0x79f3('0x3d')](_0x4e20a2);};}exports[_0x79f3('0x3e')]=function(_0x1c94cb,_0x1cad9e){var _0x552ae6={'include':[{'model':db[_0x79f3('0x3f')],'as':_0x79f3('0x40')}]},_0x4440fc={},_0x5372ea={'count':0x0,'rows':[]};var _0x5bc78b=_[_0x79f3('0x41')](db[_0x79f3('0x42')]['rawAttributes'],function(_0x447cfb){return{'name':_0x447cfb[_0x79f3('0x43')],'type':_0x447cfb[_0x79f3('0x44')][_0x79f3('0x45')]};});_0x4440fc[_0x79f3('0x46')]=_[_0x79f3('0x41')](_0x5bc78b,'name');_0x4440fc[_0x79f3('0x47')]=_[_0x79f3('0x48')](_0x1c94cb[_0x79f3('0x47')]);_0x4440fc[_0x79f3('0x49')]=_['intersection'](_0x4440fc['model'],_0x4440fc[_0x79f3('0x47')]);_0x552ae6['attributes']=_[_0x79f3('0x4a')](_0x4440fc[_0x79f3('0x46')],qs[_0x79f3('0x4b')](_0x1c94cb[_0x79f3('0x47')][_0x79f3('0x4b')]));_0x552ae6[_0x79f3('0x4c')]=_0x552ae6['attributes'][_0x79f3('0x4d')]?_0x552ae6[_0x79f3('0x4c')]:_0x4440fc['model'];if(!_0x1c94cb[_0x79f3('0x47')]['hasOwnProperty'](_0x79f3('0x4e'))){_0x552ae6[_0x79f3('0x32')]=qs['limit'](_0x1c94cb[_0x79f3('0x47')][_0x79f3('0x32')]);_0x552ae6[_0x79f3('0x31')]=qs[_0x79f3('0x31')](_0x1c94cb[_0x79f3('0x47')][_0x79f3('0x31')]);}_0x552ae6[_0x79f3('0x4f')]=qs['sort'](_0x1c94cb[_0x79f3('0x47')][_0x79f3('0x50')]);_0x552ae6['where']=qs[_0x79f3('0x49')](_[_0x79f3('0x51')](_0x1c94cb[_0x79f3('0x47')],_0x4440fc[_0x79f3('0x49')]));if(_0x1c94cb[_0x79f3('0x47')][_0x79f3('0x52')]){_0x552ae6[_0x79f3('0x53')]=_['merge'](_0x552ae6[_0x79f3('0x53')],{'$or':_['map'](_0x5bc78b,function(_0x3f69e8){if(_0x3f69e8[_0x79f3('0x44')]!==_0x79f3('0x54')){var _0x1a75f9={};_0x1a75f9[_0x3f69e8[_0x79f3('0x3c')]]={'$like':'%'+_0x1c94cb[_0x79f3('0x47')][_0x79f3('0x52')]+'%'};return _0x1a75f9;}})});}_0x552ae6=_[_0x79f3('0x55')]({},_0x552ae6,_0x1c94cb[_0x79f3('0x56')]);var _0x405bcd={'where':_0x552ae6[_0x79f3('0x53')]};return db['SmsAccount'][_0x79f3('0x30')](_0x405bcd)[_0x79f3('0x21')](function(_0x3498b1){_0x5372ea['count']=_0x3498b1;if(_0x1c94cb[_0x79f3('0x47')][_0x79f3('0x57')]){_0x552ae6[_0x79f3('0x58')]=[{'all':!![]}];}return db[_0x79f3('0x42')][_0x79f3('0x59')](_0x552ae6);})[_0x79f3('0x21')](function(_0x159fd4){_0x5372ea[_0x79f3('0x5a')]=_0x159fd4;return _0x5372ea;})[_0x79f3('0x21')](respondWithFilteredResult(_0x1cad9e,_0x552ae6))[_0x79f3('0x2c')](handleError(_0x1cad9e,null));};exports['show']=function(_0xd9e6bf,_0x349943){var _0x2935ff={'raw':![],'where':{'id':_0xd9e6bf[_0x79f3('0x5b')]['id']},'include':[{'model':db[_0x79f3('0x3f')],'as':_0x79f3('0x40')}]},_0x2aed12={};_0x2aed12[_0x79f3('0x46')]=_[_0x79f3('0x48')](db[_0x79f3('0x42')][_0x79f3('0x5c')]);_0x2aed12[_0x79f3('0x47')]=_[_0x79f3('0x48')](_0xd9e6bf[_0x79f3('0x47')]);_0x2aed12[_0x79f3('0x49')]=_[_0x79f3('0x4a')](_0x2aed12[_0x79f3('0x46')],_0x2aed12[_0x79f3('0x47')]);_0x2935ff[_0x79f3('0x4c')]=_[_0x79f3('0x4a')](_0x2aed12[_0x79f3('0x46')],qs[_0x79f3('0x4b')](_0xd9e6bf[_0x79f3('0x47')]['fields']));_0x2935ff[_0x79f3('0x4c')]=_0x2935ff['attributes']['length']?_0x2935ff[_0x79f3('0x4c')]:_0x2aed12['model'];if(_0xd9e6bf[_0x79f3('0x47')][_0x79f3('0x57')]){_0x2935ff[_0x79f3('0x58')]=[{'all':!![]}];}_0x2935ff=_[_0x79f3('0x55')]({},_0x2935ff,_0xd9e6bf[_0x79f3('0x56')]);return db[_0x79f3('0x42')]['find'](_0x2935ff)[_0x79f3('0x21')](handleEntityNotFound(_0x349943,null))[_0x79f3('0x21')](respondWithResult(_0x349943,null))[_0x79f3('0x2c')](handleError(_0x349943,null));};exports[_0x79f3('0x5d')]=function(_0x53674f,_0x1c0e78){return db[_0x79f3('0x42')][_0x79f3('0x5d')](_0x53674f[_0x79f3('0x5e')],{})[_0x79f3('0x21')](function(_0x38279c){var _0x114b26=_0x53674f[_0x79f3('0x5f')][_0x79f3('0x37')]({'plain':!![]});if(!_0x114b26)throw new Error(_0x79f3('0x60'));if(_0x114b26[_0x79f3('0x61')]===_0x79f3('0x5f')){var _0x5c753d=_0x38279c['get']({'plain':!![]});var _0x177654='SmsAccounts';return db['UserProfileSection'][_0x79f3('0x62')]({'where':{'name':_0x177654,'userProfileId':_0x114b26[_0x79f3('0x63')]},'raw':!![]})[_0x79f3('0x21')](function(_0x39023e){if(_0x39023e&&_0x39023e[_0x79f3('0x64')]===0x0){return db[_0x79f3('0x39')][_0x79f3('0x5d')]({'name':_0x5c753d[_0x79f3('0x3c')],'resourceId':_0x5c753d['id'],'type':_0x39023e['name'],'sectionId':_0x39023e['id']},{})[_0x79f3('0x21')](function(){return _0x38279c;});}else{return _0x38279c;}})[_0x79f3('0x2c')](function(_0x190dd9){logger['error'](_0x79f3('0x65'),_0x190dd9);throw _0x190dd9;});}return _0x38279c;})[_0x79f3('0x21')](respondWithResult(_0x1c0e78,0xc9))[_0x79f3('0x2c')](handleError(_0x1c0e78,null));};exports[_0x79f3('0x36')]=function(_0xdd72e0,_0x2ced4e){if(_0xdd72e0[_0x79f3('0x5e')]['id']){delete _0xdd72e0[_0x79f3('0x5e')]['id'];}return db[_0x79f3('0x42')]['find']({'where':{'id':_0xdd72e0['params']['id']},'include':[{'model':db[_0x79f3('0x3f')],'as':_0x79f3('0x40')}]})[_0x79f3('0x21')](handleEntityNotFound(_0x2ced4e,null))[_0x79f3('0x21')](saveUpdates(_0xdd72e0['body'],null))[_0x79f3('0x21')](respondWithResult(_0x2ced4e,null))['catch'](handleError(_0x2ced4e,null));};exports[_0x79f3('0x3a')]=function(_0x5720f9,_0x4e7e80){return db[_0x79f3('0x42')][_0x79f3('0x62')]({'where':{'id':_0x5720f9[_0x79f3('0x5b')]['id']}})[_0x79f3('0x21')](handleEntityNotFound(_0x4e7e80,null))[_0x79f3('0x21')](removeEntity(_0x4e7e80,null))[_0x79f3('0x2c')](handleError(_0x4e7e80,null));};exports['describe']=function(_0x9fe4bf,_0x1ebc6a){return db[_0x79f3('0x42')][_0x79f3('0x66')]()[_0x79f3('0x21')](respondWithResult(_0x1ebc6a,null))[_0x79f3('0x2c')](handleError(_0x1ebc6a,null));};exports[_0x79f3('0x67')]=function(_0x16864d,_0x4c992d,_0x51726f){if(_0x16864d[_0x79f3('0x5e')]['id']){delete _0x16864d[_0x79f3('0x5e')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x16864d[_0x79f3('0x5b')]['id']}})[_0x79f3('0x21')](handleEntityNotFound(_0x4c992d,null))['then'](function(_0x44f55a){if(_0x44f55a){_0x16864d['body'][_0x79f3('0x68')]=_0x44f55a['id'];return db[_0x79f3('0x69')]['create'](_0x16864d[_0x79f3('0x5e')]);}})[_0x79f3('0x21')](respondWithResult(_0x4c992d,null))[_0x79f3('0x2c')](handleError(_0x4c992d,null));};exports[_0x79f3('0x6a')]=function(_0x33ea04,_0x1be89d,_0x36fd30){var _0x1cca8f={'raw':![],'where':{}};var _0x1b97d9={};var _0x2b5b6d={'count':0x0,'rows':[]};return db[_0x79f3('0x42')][_0x79f3('0x6b')]({'where':{'id':_0x33ea04[_0x79f3('0x5b')]['id']}})[_0x79f3('0x21')](handleEntityNotFound(_0x1be89d,null))[_0x79f3('0x21')](function(_0x268442){if(_0x268442){_0x1b97d9[_0x79f3('0x46')]=_['keys'](db['Disposition']['rawAttributes']);_0x1b97d9[_0x79f3('0x47')]=_['keys'](_0x33ea04[_0x79f3('0x47')]);_0x1b97d9[_0x79f3('0x49')]=_[_0x79f3('0x4a')](_0x1b97d9[_0x79f3('0x46')],_0x1b97d9['query']);_0x1cca8f['attributes']=_[_0x79f3('0x4a')](_0x1b97d9[_0x79f3('0x46')],qs[_0x79f3('0x4b')](_0x33ea04[_0x79f3('0x47')][_0x79f3('0x4b')]));_0x1cca8f[_0x79f3('0x4c')]=_0x1cca8f[_0x79f3('0x4c')][_0x79f3('0x4d')]?_0x1cca8f[_0x79f3('0x4c')]:_0x1b97d9[_0x79f3('0x46')];if(!_0x33ea04[_0x79f3('0x47')][_0x79f3('0x6c')](_0x79f3('0x4e'))){_0x1cca8f[_0x79f3('0x32')]=qs[_0x79f3('0x32')](_0x33ea04['query'][_0x79f3('0x32')]);_0x1cca8f[_0x79f3('0x31')]=qs[_0x79f3('0x31')](_0x33ea04[_0x79f3('0x47')][_0x79f3('0x31')]);}_0x1cca8f[_0x79f3('0x4f')]=qs[_0x79f3('0x50')](_0x33ea04[_0x79f3('0x47')][_0x79f3('0x50')]);_0x1cca8f[_0x79f3('0x53')]=qs['filters'](_[_0x79f3('0x51')](_0x33ea04[_0x79f3('0x47')],_0x1b97d9[_0x79f3('0x49')]));_0x1cca8f[_0x79f3('0x53')]['SmsAccountId']=_0x268442['id'];if(_0x33ea04[_0x79f3('0x47')][_0x79f3('0x52')]){_0x1cca8f['where']=_[_0x79f3('0x55')](_0x1cca8f[_0x79f3('0x53')],{'$or':_['map'](_0x1cca8f[_0x79f3('0x4c')],function(_0x2e9cf0){var _0x51097a={};_0x51097a[_0x2e9cf0]={'$like':'%'+_0x33ea04['query'][_0x79f3('0x52')]+'%'};return _0x51097a;})});}_0x1cca8f=_[_0x79f3('0x55')]({},_0x1cca8f,_0x33ea04[_0x79f3('0x56')]);return db[_0x79f3('0x69')][_0x79f3('0x30')]({'where':_0x1cca8f['where']})[_0x79f3('0x21')](function(_0x58c671){_0x2b5b6d[_0x79f3('0x30')]=_0x58c671;if(_0x33ea04[_0x79f3('0x47')]['includeAll']){_0x1cca8f[_0x79f3('0x58')]=[{'all':!![]}];}return db[_0x79f3('0x69')]['findAll'](_0x1cca8f);})[_0x79f3('0x21')](function(_0x1ea9a4){_0x2b5b6d['rows']=_0x1ea9a4;return _0x2b5b6d;});}})[_0x79f3('0x21')](respondWithFilteredResult(_0x1be89d,_0x1cca8f))[_0x79f3('0x2c')](handleError(_0x1be89d,null));};exports['removeDispositions']=function(_0x357982,_0x232198,_0x16efa0){return db[_0x79f3('0x42')][_0x79f3('0x62')]({'where':{'id':_0x357982[_0x79f3('0x5b')]['id']}})[_0x79f3('0x21')](handleEntityNotFound(_0x232198,null))['then'](function(_0x438030){if(_0x438030){return _0x438030['removeDispositions'](_0x357982['query'][_0x79f3('0x6d')]);}})[_0x79f3('0x21')](respondWithStatusCode(_0x232198,null))[_0x79f3('0x2c')](handleError(_0x232198,null));};exports[_0x79f3('0x6e')]=function(_0x4e0ec5,_0x4a8e49,_0x3a9c11){if(_0x4e0ec5[_0x79f3('0x5e')]['id']){delete _0x4e0ec5[_0x79f3('0x5e')]['id'];}return db[_0x79f3('0x42')]['find']({'where':{'id':_0x4e0ec5[_0x79f3('0x5b')]['id']}})[_0x79f3('0x21')](handleEntityNotFound(_0x4a8e49,null))[_0x79f3('0x21')](function(_0x427774){if(_0x427774){_0x4e0ec5[_0x79f3('0x5e')][_0x79f3('0x68')]=_0x427774['id'];return db[_0x79f3('0x6f')][_0x79f3('0x5d')](_0x4e0ec5[_0x79f3('0x5e')]);}})[_0x79f3('0x21')](respondWithResult(_0x4a8e49,null))[_0x79f3('0x2c')](handleError(_0x4a8e49,null));};exports[_0x79f3('0x70')]=function(_0x54262e,_0x47db63,_0x2fc340){var _0x283c1e={'raw':![],'where':{}};var _0x528975={};var _0x135606={'count':0x0,'rows':[]};return db[_0x79f3('0x42')]['findOne']({'where':{'id':_0x54262e['params']['id']}})['then'](handleEntityNotFound(_0x47db63,null))[_0x79f3('0x21')](function(_0x1bacb2){if(_0x1bacb2){_0x528975[_0x79f3('0x46')]=_['keys'](db[_0x79f3('0x6f')]['rawAttributes']);_0x528975['query']=_[_0x79f3('0x48')](_0x54262e[_0x79f3('0x47')]);_0x528975['filters']=_['intersection'](_0x528975[_0x79f3('0x46')],_0x528975[_0x79f3('0x47')]);_0x283c1e[_0x79f3('0x4c')]=_[_0x79f3('0x4a')](_0x528975[_0x79f3('0x46')],qs[_0x79f3('0x4b')](_0x54262e[_0x79f3('0x47')][_0x79f3('0x4b')]));_0x283c1e[_0x79f3('0x4c')]=_0x283c1e[_0x79f3('0x4c')][_0x79f3('0x4d')]?_0x283c1e['attributes']:_0x528975[_0x79f3('0x46')];if(!_0x54262e[_0x79f3('0x47')][_0x79f3('0x6c')]('nolimit')){_0x283c1e[_0x79f3('0x32')]=qs['limit'](_0x54262e['query']['limit']);_0x283c1e['offset']=qs[_0x79f3('0x31')](_0x54262e[_0x79f3('0x47')][_0x79f3('0x31')]);}_0x283c1e['order']=qs[_0x79f3('0x50')](_0x54262e['query']['sort']);_0x283c1e[_0x79f3('0x53')]=qs[_0x79f3('0x49')](_[_0x79f3('0x51')](_0x54262e[_0x79f3('0x47')],_0x528975['filters']));_0x283c1e[_0x79f3('0x53')][_0x79f3('0x68')]=_0x1bacb2['id'];if(_0x54262e[_0x79f3('0x47')][_0x79f3('0x52')]){_0x283c1e[_0x79f3('0x53')]=_[_0x79f3('0x55')](_0x283c1e[_0x79f3('0x53')],{'$or':_[_0x79f3('0x41')](_0x283c1e['attributes'],function(_0x1ca3bd){var _0x24cc98={};_0x24cc98[_0x1ca3bd]={'$like':'%'+_0x54262e[_0x79f3('0x47')][_0x79f3('0x52')]+'%'};return _0x24cc98;})});}_0x283c1e=_[_0x79f3('0x55')]({},_0x283c1e,_0x54262e[_0x79f3('0x56')]);return db['CannedAnswer'][_0x79f3('0x30')]({'where':_0x283c1e['where']})[_0x79f3('0x21')](function(_0xd2c1b5){_0x135606[_0x79f3('0x30')]=_0xd2c1b5;if(_0x54262e[_0x79f3('0x47')][_0x79f3('0x57')]){_0x283c1e['include']=[{'all':!![]}];}return db[_0x79f3('0x6f')]['findAll'](_0x283c1e);})[_0x79f3('0x21')](function(_0xf76ea8){_0x135606['rows']=_0xf76ea8;return _0x135606;});}})['then'](respondWithFilteredResult(_0x47db63,_0x283c1e))[_0x79f3('0x2c')](handleError(_0x47db63,null));};exports[_0x79f3('0x71')]=function(_0x171dfd,_0x53202e,_0x5d69b2){return db[_0x79f3('0x42')]['find']({'where':{'id':_0x171dfd[_0x79f3('0x5b')]['id']}})['then'](handleEntityNotFound(_0x53202e,null))['then'](function(_0x325b2b){if(_0x325b2b){return _0x325b2b[_0x79f3('0x71')](_0x171dfd['query']['ids']);}})[_0x79f3('0x21')](respondWithStatusCode(_0x53202e,null))[_0x79f3('0x2c')](handleError(_0x53202e,null));};exports[_0x79f3('0x72')]=function(_0x4f914b,_0x42fcc9,_0x2dda2f){var _0x17a04f={'channel':_0x79f3('0x73')};var _0x1b1a56=[];var _0x32837f=[];var _0x5662fb={};return db[_0x79f3('0x42')][_0x79f3('0x62')]({'where':{'id':_0x4f914b[_0x79f3('0x5b')]['id']},'include':[{'model':db[_0x79f3('0x74')],'as':'Applications'}]})[_0x79f3('0x21')](handleEntityNotFound(_0x42fcc9,null))['then'](function(_0x3fcb0f){_0x17a04f[_0x79f3('0x75')]=_0x3fcb0f;_0x17a04f[_0x79f3('0x76')]=_['orderBy'](_0x3fcb0f[_0x79f3('0x77')],[_0x79f3('0x78')],[_0x79f3('0x79')]);if(_0x17a04f[_0x79f3('0x75')]['Applications']){delete _0x17a04f[_0x79f3('0x75')][_0x79f3('0x77')];}return db[_0x79f3('0x7a')]['describe']();})[_0x79f3('0x21')](function(_0x22b4f5){if(!_0x22b4f5){throw new db[(_0x79f3('0x1d'))]['ValidationError'](_0x79f3('0x7b'));}_0x1b1a56=_[_0x79f3('0x7c')](_[_0x79f3('0x48')](_0x22b4f5),[_0x79f3('0x7d'),_0x79f3('0x7e')]);_0x32837f=_[_0x79f3('0x7c')](_['keys'](_0x22b4f5),[_0x79f3('0x7d'),'updatedAt',_0x79f3('0x7f'),_0x79f3('0x80')]);_0x17a04f[_0x79f3('0x5e')]={'mapKey':_0x79f3('0x81')};if(_0x17a04f[_0x79f3('0x75')][_0x79f3('0x44')]){switch(_0x17a04f[_0x79f3('0x75')][_0x79f3('0x44')]){case _0x79f3('0x82'):_0x17a04f[_0x79f3('0x5e')][_0x79f3('0x83')]=_0x4f914b['body'][_0x79f3('0x84')];_0x17a04f[_0x79f3('0x5e')]['body']=_0x4f914b[_0x79f3('0x5e')][_0x79f3('0x85')];_0x17a04f[_0x79f3('0x5e')][_0x79f3('0x86')]=_0x4f914b[_0x79f3('0x5e')][_0x79f3('0x87')];break;case'skebby':_0x17a04f['body'][_0x79f3('0x83')]='+'+_0x4f914b[_0x79f3('0x5e')][_0x79f3('0x88')];_0x17a04f[_0x79f3('0x5e')][_0x79f3('0x5e')]=_0x4f914b[_0x79f3('0x5e')]['text'];break;case _0x79f3('0x89'):_0x17a04f['body'][_0x79f3('0x83')]=_0x4f914b[_0x79f3('0x5e')]['from'];_0x17a04f[_0x79f3('0x5e')][_0x79f3('0x5e')]=_0x4f914b[_0x79f3('0x5e')]['message'];break;case _0x79f3('0x8a'):_0x17a04f[_0x79f3('0x5e')][_0x79f3('0x83')]=_0x4f914b[_0x79f3('0x5e')]['from'];_0x17a04f[_0x79f3('0x5e')][_0x79f3('0x5e')]=_0x4f914b[_0x79f3('0x5e')][_0x79f3('0x5e')];_0x17a04f['body'][_0x79f3('0x86')]=_0x4f914b['body'][_0x79f3('0x8b')];break;case _0x79f3('0x8c'):_0x17a04f[_0x79f3('0x5e')][_0x79f3('0x83')]=_0x4f914b['body'][_0x79f3('0x84')];_0x17a04f[_0x79f3('0x5e')][_0x79f3('0x5e')]=_0x4f914b[_0x79f3('0x5e')][_0x79f3('0x8d')];_0x17a04f[_0x79f3('0x5e')]['messageId']=_0x4f914b[_0x79f3('0x5e')][_0x79f3('0x8e')];break;case _0x79f3('0x8f'):_0x17a04f[_0x79f3('0x5e')][_0x79f3('0x83')]='+'+_0x4f914b[_0x79f3('0x5e')]['results'][0x0][_0x79f3('0x83')];_0x17a04f['body'][_0x79f3('0x5e')]=_0x4f914b[_0x79f3('0x5e')][_0x79f3('0x90')][0x0][_0x79f3('0x91')];_0x17a04f[_0x79f3('0x5e')][_0x79f3('0x86')]=_0x4f914b[_0x79f3('0x5e')]['results'][0x0][_0x79f3('0x86')];break;case _0x79f3('0x92'):_0x17a04f[_0x79f3('0x5e')][_0x79f3('0x83')]=_0x4f914b['body'][_0x79f3('0x93')];_0x17a04f[_0x79f3('0x5e')][_0x79f3('0x5e')]=_0x4f914b[_0x79f3('0x5e')][_0x79f3('0x94')]['message'];break;case _0x79f3('0x95'):_0x17a04f['body'][_0x79f3('0x83')]=_0x4f914b['body']['fromNumber'];_0x17a04f['body'][_0x79f3('0x5e')]=_0x4f914b[_0x79f3('0x5e')][_0x79f3('0x91')];_0x17a04f[_0x79f3('0x5e')]['messageId']=_0x4f914b['body']['replyMessageId'];break;case _0x79f3('0x96'):_0x17a04f['body'][_0x79f3('0x83')]=_0x4f914b[_0x79f3('0x5e')]['from'];_0x17a04f[_0x79f3('0x5e')][_0x79f3('0x5e')]=_0x4f914b[_0x79f3('0x5e')]['message'];_0x17a04f[_0x79f3('0x5e')][_0x79f3('0x86')]=_0x4f914b[_0x79f3('0x5e')][_0x79f3('0x97')];break;}}if(_0x17a04f[_0x79f3('0x5e')]['id']){delete _0x17a04f[_0x79f3('0x5e')]['id'];}if(_[_0x79f3('0x98')](_0x17a04f[_0x79f3('0x5e')][_0x79f3('0x83')])){throw new db[(_0x79f3('0x1d'))][(_0x79f3('0x1e'))](_0x79f3('0x99'));}if(_[_0x79f3('0x98')](_0x17a04f[_0x79f3('0x5e')][_0x79f3('0x5e')])||_0x17a04f['body']['body']===''){throw new db[(_0x79f3('0x1d'))][(_0x79f3('0x1e'))](_0x79f3('0x9a'));}if(_['isNil'](_0x17a04f[_0x79f3('0x5e')][_0x79f3('0x9b')])){throw new db[(_0x79f3('0x1d'))]['ValidationError'](_0x79f3('0x9c')+_0x32837f);}if(!_['includes'](_0x32837f,_0x17a04f[_0x79f3('0x5e')][_0x79f3('0x9b')])){throw new db[(_0x79f3('0x1d'))][(_0x79f3('0x1e'))](_0x79f3('0x9d')+_0x32837f);}_0x5662fb[_0x17a04f[_0x79f3('0x5e')][_0x79f3('0x9b')]]=_0x17a04f['body'][_0x79f3('0x83')];return db[_0x79f3('0x9e')][_0x79f3('0x62')]({'where':{'id':_0x17a04f['account'][_0x79f3('0x80')]},'include':[{'model':db['CmContact'],'as':_0x79f3('0x9f'),'where':_0x5662fb,'limit':0x1,'order':[[_0x79f3('0x7e'),_0x79f3('0xa0')]]}]});})[_0x79f3('0x21')](handleEntityNotFound(_0x42fcc9,null))[_0x79f3('0x21')](function(_0x4d9450){if(_0x4d9450){_0x17a04f['list']=_['omit'](_0x4d9450,[_0x79f3('0x9f')]);if(_0x4d9450[_0x79f3('0x9f')][_0x79f3('0x4d')]){return _0x4d9450[_0x79f3('0x9f')][0x0];}var _0x2c2b50=_[_0x79f3('0x16')](_0x17a04f[_0x79f3('0x5e')],{'firstName':_0x17a04f[_0x79f3('0x5e')][_0x79f3('0x83')],'ListId':_0x4d9450['id']});_0x2c2b50[_0x17a04f[_0x79f3('0x5e')]['mapKey']]=_0x17a04f['body'][_0x79f3('0x83')];return db['CmContact'][_0x79f3('0x5d')](_0x2c2b50,{'fields':_0x1b1a56,'raw':!![]});}})[_0x79f3('0x21')](handleEntityNotFound(_0x42fcc9,null))[_0x79f3('0x21')](function(_0x3df77f){if(_0x3df77f){_0x17a04f[_0x79f3('0xa1')]=_0x3df77f;var _0x556167={'ContactId':_0x3df77f['id'],'phone':_0x17a04f[_0x79f3('0x5e')]['from'],'SmsAccountId':_0x4f914b['params']['id']};var _0x534bbd={'ContactId':_0x3df77f['id'],'SmsAccountId':_0x4f914b[_0x79f3('0x5b')]['id'],'closed':![]};return db[_0x79f3('0xa2')][_0x79f3('0x62')]({'where':_0x534bbd})['then'](function(_0x2b9572){if(_0x2b9572){return[_0x2b9572,![]];}return db[_0x79f3('0xa2')][_0x79f3('0x5d')](_0x556167)[_0x79f3('0x21')](function(_0x4f9b57){return[_0x4f9b57,!![]];});});}})[_0x79f3('0xa3')](function(_0x91d36e,_0x265793){_0x17a04f['interaction']=_0x91d36e[_0x79f3('0x37')]({'plain':!![]});_0x17a04f[_0x79f3('0xa4')][_0x79f3('0xa5')]=![];if(_0x265793){if(_0x17a04f[_0x79f3('0x75')][_0x79f3('0xa6')]){_0x17a04f[_0x79f3('0x76')]['push']({'id':0x0,'priority':_0x17a04f[_0x79f3('0x76')]['length']+0x1,'app':_0x79f3('0xa7'),'appdata':_0x79f3('0xa8'),'interval':'*,*,*,*'});}_0x17a04f[_0x79f3('0xa4')][_0x79f3('0xa5')]=!![];}return db['SmsMessage'][_0x79f3('0x5d')]({'phone':_0x17a04f[_0x79f3('0x5e')][_0x79f3('0x83')],'messageId':_0x17a04f[_0x79f3('0x5e')][_0x79f3('0x86')],'body':_0x17a04f['body'][_0x79f3('0x5e')],'SmsAccountId':_0x4f914b[_0x79f3('0x5b')]['id'],'SmsInteractionId':_0x91d36e['id'],'direction':'in','ContactId':_0x91d36e['ContactId'],'AttachmentId':_0x17a04f[_0x79f3('0x5e')][_0x79f3('0xa9')]});})[_0x79f3('0x21')](function(_0x1ca7ae){_0x17a04f[_0x79f3('0x2a')]=_0x1ca7ae;if(_0x17a04f[_0x79f3('0xa4')][_0x79f3('0xaa')]){return db[_0x79f3('0xab')][_0x79f3('0x62')]({'attributes':['id',_0x79f3('0x3c')],'where':{'id':_0x17a04f[_0x79f3('0xa4')]['UserId']}})[_0x79f3('0x21')](function(_0xab9f66){if(_0xab9f66){_0x17a04f['applications'][_0x79f3('0xac')]({'id':0x0,'priority':0x0,'app':_0x79f3('0xad'),'appdata':_0xab9f66[_0x79f3('0x3c')]+','+(_0x17a04f['account'][_0x79f3('0xae')]||0xa),'interval':_0x79f3('0xaf')});}return respondWithRpcPromise(_0x79f3('0xb0'),_0x79f3('0xb1'),_0x17a04f);});}return respondWithRpcPromise('Start','startRouting',_0x17a04f);})[_0x79f3('0x21')](function(_0x5cd69e){if(_0x5cd69e){var _0x21e11c=0xc8;var _0x9d2068=_0x79f3('0xb2');logger[_0x79f3('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9d2068,_0x21e11c,_0x79f3('0xb3'));logger[_0x79f3('0x25')](_0x79f3('0xb4'),_0x9d2068,_0x21e11c,_0x79f3('0xb3'),JSON['stringify'](_0x5cd69e));if(_0x17a04f['account'][_0x79f3('0x44')]==='twilio'){return _0x42fcc9[_0x79f3('0x2d')](_0x21e11c)[_0x79f3('0x33')](_0x79f3('0xb5'),'text/xml')[_0x79f3('0x3d')](_0x79f3('0xb6'));}else{return _0x42fcc9[_0x79f3('0x2d')](_0x21e11c)['json'](_0x5cd69e);}}})[_0x79f3('0x2c')](handleError(_0x42fcc9,null));};exports['addApplications']=function(_0x493061,_0x24d14a,_0x2e8c20){return db[_0x79f3('0x42')]['findOne']({'where':{'id':_0x493061['params']['id']}})[_0x79f3('0x21')](handleEntityNotFound(_0x24d14a,null))[_0x79f3('0x21')](function(_0x49d17a){if(_0x49d17a){return db[_0x79f3('0xb7')][_0x79f3('0xb8')](function(_0x399e60){return db[_0x79f3('0x74')][_0x79f3('0x3a')]({'where':{'SmsAccountId':_0x493061[_0x79f3('0x5b')]['id']},'transaction':_0x399e60})[_0x79f3('0x21')](function(_0x1c3e9a){var _0x301979=_['map'](_0x493061[_0x79f3('0x5e')],function(_0x5421b2){_0x5421b2[_0x79f3('0x68')]=_0x493061[_0x79f3('0x5b')]['id'];return _0x5421b2;});return db[_0x79f3('0x74')][_0x79f3('0xb9')](_0x301979,{'transaction':_0x399e60});});})[_0x79f3('0x21')](function(){return db[_0x79f3('0x74')][_0x79f3('0xba')]({'where':{'SmsAccountId':_0x493061[_0x79f3('0x5b')]['id']},'order':'priority'});});}})[_0x79f3('0x21')](respondWithResult(_0x24d14a,null))[_0x79f3('0x2c')](handleError(_0x24d14a,null));};exports[_0x79f3('0xbb')]=function(_0x21adb9,_0x169b65,_0x5856e7){var _0x203931={};var _0x5ab249={};var _0x3c310b;var _0x588d13;return db['SmsAccount'][_0x79f3('0x6b')]({'where':{'id':_0x21adb9[_0x79f3('0x5b')]['id']}})[_0x79f3('0x21')](handleEntityNotFound(_0x169b65,null))['then'](function(_0x45bd37){if(_0x45bd37){_0x3c310b=_0x45bd37;_0x5ab249[_0x79f3('0x46')]=_['keys'](db[_0x79f3('0x74')][_0x79f3('0x5c')]);_0x5ab249[_0x79f3('0x47')]=_[_0x79f3('0x48')](_0x21adb9[_0x79f3('0x47')]);_0x5ab249[_0x79f3('0x49')]=_['intersection'](_0x5ab249[_0x79f3('0x46')],_0x5ab249[_0x79f3('0x47')]);_0x203931['attributes']=_[_0x79f3('0x4a')](_0x5ab249['model'],qs[_0x79f3('0x4b')](_0x21adb9['query'][_0x79f3('0x4b')]));_0x203931[_0x79f3('0x4c')]=_0x203931[_0x79f3('0x4c')][_0x79f3('0x4d')]?_0x203931[_0x79f3('0x4c')]:_0x5ab249[_0x79f3('0x46')];_0x203931[_0x79f3('0x4f')]=qs['sort'](_0x21adb9[_0x79f3('0x47')]['sort']);_0x203931['where']=qs[_0x79f3('0x49')](_[_0x79f3('0x51')](_0x21adb9['query'],_0x5ab249[_0x79f3('0x49')]));if(_0x21adb9[_0x79f3('0x47')][_0x79f3('0x52')]){_0x203931[_0x79f3('0x53')]=_[_0x79f3('0x55')](_0x203931[_0x79f3('0x53')],{'$or':_[_0x79f3('0x41')](_0x203931[_0x79f3('0x4c')],function(_0x5f478e){var _0x196ace={};_0x196ace[_0x5f478e]={'$like':'%'+_0x21adb9['query'][_0x79f3('0x52')]+'%'};return _0x196ace;})});}_0x203931=_[_0x79f3('0x55')]({},_0x203931,_0x21adb9[_0x79f3('0x56')]);return _0x3c310b[_0x79f3('0xbb')](_0x203931);}})[_0x79f3('0x21')](function(_0x1c45f){if(_0x1c45f){_0x588d13=_0x1c45f[_0x79f3('0x4d')];if(!_0x21adb9[_0x79f3('0x47')][_0x79f3('0x6c')]('nolimit')){_0x203931[_0x79f3('0x32')]=qs[_0x79f3('0x32')](_0x21adb9[_0x79f3('0x47')]['limit']);_0x203931[_0x79f3('0x31')]=qs[_0x79f3('0x31')](_0x21adb9[_0x79f3('0x47')][_0x79f3('0x31')]);}return _0x3c310b['getApplications'](_0x203931);}})[_0x79f3('0x21')](function(_0x72bb05){if(_0x72bb05){return _0x72bb05?{'count':_0x588d13,'rows':_0x72bb05}:null;}})[_0x79f3('0x21')](respondWithResult(_0x169b65,null))[_0x79f3('0x2c')](handleError(_0x169b65,null));};exports['getInteractions']=function(_0x58d7ef,_0x97ad2f,_0x555761){var _0x3cede9={'raw':![],'where':{}};var _0x52d5a4={};var _0x140b8b={'count':0x0,'rows':[]};return db['SmsAccount'][_0x79f3('0x6b')]({'where':{'id':_0x58d7ef[_0x79f3('0x5b')]['id']}})[_0x79f3('0x21')](handleEntityNotFound(_0x97ad2f,null))[_0x79f3('0x21')](function(_0x5c9e38){if(_0x5c9e38){_0x52d5a4[_0x79f3('0x46')]=_[_0x79f3('0x48')](db[_0x79f3('0xa2')][_0x79f3('0x5c')]);_0x52d5a4[_0x79f3('0x47')]=_['keys'](_0x58d7ef[_0x79f3('0x47')]);_0x52d5a4[_0x79f3('0x49')]=_[_0x79f3('0x4a')](_0x52d5a4[_0x79f3('0x46')],_0x52d5a4[_0x79f3('0x47')]);_0x3cede9[_0x79f3('0x4c')]=_[_0x79f3('0x4a')](_0x52d5a4[_0x79f3('0x46')],qs[_0x79f3('0x4b')](_0x58d7ef[_0x79f3('0x47')][_0x79f3('0x4b')]));_0x3cede9[_0x79f3('0x4c')]=_0x3cede9[_0x79f3('0x4c')][_0x79f3('0x4d')]?_0x3cede9[_0x79f3('0x4c')]:_0x52d5a4[_0x79f3('0x46')];if(!_0x58d7ef[_0x79f3('0x47')][_0x79f3('0x6c')]('nolimit')){_0x3cede9[_0x79f3('0x32')]=qs[_0x79f3('0x32')](_0x58d7ef['query']['limit']);_0x3cede9['offset']=qs[_0x79f3('0x31')](_0x58d7ef['query'][_0x79f3('0x31')]);}_0x3cede9[_0x79f3('0x4f')]=qs[_0x79f3('0x50')](_0x58d7ef[_0x79f3('0x47')][_0x79f3('0x50')]);_0x3cede9[_0x79f3('0x53')]=qs[_0x79f3('0x49')](_[_0x79f3('0x51')](_0x58d7ef[_0x79f3('0x47')],_0x52d5a4[_0x79f3('0x49')]));_0x3cede9[_0x79f3('0x53')][_0x79f3('0x68')]=_0x5c9e38['id'];if(_0x58d7ef['query'][_0x79f3('0x52')]){_0x3cede9['where']=_['merge'](_0x3cede9[_0x79f3('0x53')],{'$or':_['map'](_0x3cede9[_0x79f3('0x4c')],function(_0xb9fa35){var _0xdcbe8b={};_0xdcbe8b[_0xb9fa35]={'$like':'%'+_0x58d7ef['query'][_0x79f3('0x52')]+'%'};return _0xdcbe8b;})});}_0x3cede9=_['merge']({},_0x3cede9,_0x58d7ef[_0x79f3('0x56')]);return db[_0x79f3('0xa2')][_0x79f3('0x30')]({'where':_0x3cede9[_0x79f3('0x53')]})[_0x79f3('0x21')](function(_0x51899e){_0x140b8b[_0x79f3('0x30')]=_0x51899e;if(_0x58d7ef[_0x79f3('0x47')]['includeAll']){_0x3cede9['include']=[{'model':db[_0x79f3('0x7a')],'as':_0x79f3('0xbc'),'required':![]},{'model':db[_0x79f3('0xab')],'as':_0x79f3('0xbd'),'attributes':[_0x79f3('0x3c'),'fullname',_0x79f3('0xbe')],'required':![]},{'model':db[_0x79f3('0xbf')],'as':_0x79f3('0xc0'),'attributes':['id',_0x79f3('0x3c'),_0x79f3('0xc1')],'where':_0x58d7ef[_0x79f3('0x47')][_0x79f3('0xc2')]?{'id':_0x58d7ef[_0x79f3('0x47')][_0x79f3('0xc2')]}:undefined,'required':_0x58d7ef[_0x79f3('0x47')]['tag']?!![]:![]}];}return db[_0x79f3('0xa2')]['findAll'](_0x3cede9);})[_0x79f3('0x21')](function(_0x5b0dd5){_0x140b8b[_0x79f3('0x5a')]=_0x5b0dd5;return _0x140b8b;});}})[_0x79f3('0x21')](respondWithFilteredResult(_0x97ad2f,_0x3cede9))[_0x79f3('0x2c')](handleError(_0x97ad2f,null));};exports['send']=function(_0x567389,_0x3011c3,_0x10b8ba){var _0x37e7e0,_0x4fa1df,_0x133d7c;if(_[_0x79f3('0x98')](_0x567389[_0x79f3('0x5e')]['body'])||_0x567389[_0x79f3('0x5e')][_0x79f3('0x5e')]===''){throw new db[(_0x79f3('0x1d'))][(_0x79f3('0x1e'))](_0x79f3('0x9a'));}if(_[_0x79f3('0x98')](_0x567389[_0x79f3('0x5e')]['to'])){throw new db[(_0x79f3('0x1d'))]['ValidationError'](_0x79f3('0xc3'));}_0x37e7e0=_0x567389[_0x79f3('0x5e')]['to'];return db[_0x79f3('0x42')]['find']({'where':{'id':_0x567389[_0x79f3('0x5b')]['id']},'include':[{'model':db['CmList'],'as':_0x79f3('0xc4'),'include':[{'model':db[_0x79f3('0x7a')],'as':_0x79f3('0x9f'),'where':{'mobile':_0x37e7e0},'limit':0x1,'order':[['updatedAt',_0x79f3('0xa0')]]}]}]})[_0x79f3('0x21')](handleEntityNotFound(_0x3011c3,null))['then'](function(_0x2ac3af){if(_0x2ac3af&&_0x2ac3af[_0x79f3('0xc4')]){_0x4fa1df=_0x2ac3af[_0x79f3('0x37')]({'plain':!![]});if(_0x4fa1df['List']&&_0x4fa1df[_0x79f3('0xc4')][_0x79f3('0x9f')][_0x79f3('0x4d')]){return _0x4fa1df[_0x79f3('0xc4')][_0x79f3('0x9f')][0x0];}return db[_0x79f3('0x7a')][_0x79f3('0x5d')](_[_0x79f3('0x16')](_0x567389['body'],{'firstName':_0x37e7e0,'mobile':_0x37e7e0,'phone':_0x37e7e0,'ListId':_0x4fa1df[_0x79f3('0x80')]}));}})[_0x79f3('0x21')](handleEntityNotFound(_0x3011c3,null))['then'](function(_0x31472d){if(_0x31472d){_0x133d7c=_0x31472d;return db[_0x79f3('0xa2')][_0x79f3('0x62')]({'where':{'ContactId':_0x133d7c['id'],'closed':![],'SmsAccountId':_0x4fa1df['id']}})[_0x79f3('0x21')](function(_0x560dfe){if(_0x560dfe){return[_0x560dfe,![]];}return db[_0x79f3('0xa2')][_0x79f3('0x5d')]({'UserId':_0x567389['user']['id'],'ContactId':_0x133d7c['id'],'SmsAccountId':_0x4fa1df['id'],'phone':_0x37e7e0,'firstMsgDirection':'out','Messages':[_[_0x79f3('0x55')](_0x567389[_0x79f3('0x5e')],{'read':![],'body':_0x567389[_0x79f3('0x5e')]['body'],'phone':_0x37e7e0,'SmsAccountId':_0x4fa1df['id'],'UserId':_0x567389['user']['id'],'ContactId':_0x133d7c['id']})]},{'include':[{'model':db[_0x79f3('0xc5')],'as':'Messages'}]})[_0x79f3('0x21')](function(_0x4a647f){return[_0x4a647f,!![]];});});}})[_0x79f3('0xa3')](function(_0x316b87,_0x181ca2){if(_0x181ca2){return _0x316b87;}return db['SmsMessage']['create'](_['merge'](_0x567389['body'],{'read':![],'body':_0x567389[_0x79f3('0x5e')][_0x79f3('0x5e')],'phone':_0x37e7e0,'SmsAccountId':_0x4fa1df['id'],'SmsInteractionId':_0x316b87['id'],'UserId':_0x567389[_0x79f3('0x5f')]['id'],'ContactId':_0x133d7c['id']}))['then'](function(_0x3cb0df){_0x316b87['dataValues'][_0x79f3('0xc6')]=[];_0x316b87[_0x79f3('0xc7')]['Messages'][_0x79f3('0xc8')](_0x3cb0df['dataValues']);return _0x316b87;});})['then'](respondWithResult(_0x3011c3,null))['catch'](handleError(_0x3011c3,null));};exports['status']=function(_0x151fac,_0x3a694d,_0x5da41e){if(_0x151fac[_0x79f3('0x5e')]['id']){delete _0x151fac[_0x79f3('0x5e')]['id'];}console[_0x79f3('0xc9')]('endpoint\x20/status\x20POST\x20/',_0x151fac[_0x79f3('0x5e')]);var _0x1f261a,_0x3e28de,_0x46a13c;return db[_0x79f3('0x42')][_0x79f3('0x62')]({'where':{'id':_0x151fac[_0x79f3('0x5b')]['id']}})[_0x79f3('0x21')](handleEntityNotFound(_0x3a694d,null))[_0x79f3('0x21')](function(_0x2a5d99){if(_0x2a5d99){_0x46a13c=_0x2a5d99;logger[_0x79f3('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','received\x20delivery\x20report\x20from',_0x2a5d99['type'],util[_0x79f3('0xca')](_0x151fac[_0x79f3('0x5e')],{'showHidden':![],'depth':null}));switch(_0x2a5d99[_0x79f3('0x44')]){case _0x79f3('0xcb'):if(_0x151fac['body'][_0x79f3('0xcc')]&&_0x151fac[_0x79f3('0x5e')]['status']){_0x3e28de=_0x151fac[_0x79f3('0x5e')][_0x79f3('0x2d')];return db['SmsMessage'][_0x79f3('0x62')]({'where':{'messageId':_0x151fac[_0x79f3('0x5e')][_0x79f3('0xcc')]}});}break;case _0x79f3('0x89'):if(_0x151fac['body'][_0x79f3('0xcd')]&&_0x151fac['body'][_0x79f3('0xce')]){_0x3e28de=_0x151fac[_0x79f3('0x5e')]['statusInt'];return db[_0x79f3('0xc5')]['find']({'where':{'messageId':_0x151fac[_0x79f3('0x5e')][_0x79f3('0xcd')]}});}break;case _0x79f3('0x8a'):if(_0x151fac['body']['message_id']&&_0x151fac[_0x79f3('0x5e')]['status_code']){_0x3e28de=_0x151fac[_0x79f3('0x5e')][_0x79f3('0xcf')];return db[_0x79f3('0xc5')][_0x79f3('0x62')]({'where':{'messageId':_0x151fac[_0x79f3('0x5e')][_0x79f3('0x8b')]}});}break;case _0x79f3('0x8f'):var _0x527dd3=_0x151fac['body']['results'][0x0];if(_0x527dd3[_0x79f3('0x86')]&&_0x527dd3[_0x79f3('0x2d')][_0x79f3('0xd0')]===_0x79f3('0xd1')){_0x3e28de=_0x527dd3[_0x79f3('0x2d')]['groupName'];return db['SmsMessage'][_0x79f3('0x62')]({'where':{'messageId':_0x527dd3[_0x79f3('0x86')]}});}break;case _0x79f3('0x95'):if(_0x151fac[_0x79f3('0x5e')][_0x79f3('0x86')]&&_0x151fac[_0x79f3('0x5e')][_0x79f3('0x2d')]){_0x3e28de=_0x151fac['body']['status'];return db[_0x79f3('0xc5')][_0x79f3('0x62')]({'where':{'messageId':_0x151fac['body'][_0x79f3('0x86')]}});}break;case _0x79f3('0x96'):if(_0x151fac[_0x79f3('0x5e')][_0x79f3('0xd2')]&&_0x151fac[_0x79f3('0x5e')][_0x79f3('0x2d')]){_0x3e28de=_0x151fac[_0x79f3('0x5e')][_0x79f3('0x2d')];return db['SmsMessage'][_0x79f3('0x62')]({'where':{'messageId':_0x151fac['body'][_0x79f3('0xd2')]}});}break;}}})[_0x79f3('0x21')](handleEntityNotFound(_0x3a694d,null))[_0x79f3('0x21')](function(_0x4ea21a){if(_0x4ea21a){_0x1f261a=_0x4ea21a;switch(_0x46a13c[_0x79f3('0x44')]){case _0x79f3('0xcb'):if(_0x3e28de==='DELIVERED'){return _0x1f261a[_0x79f3('0x36')]({'read':!![]});}else{logger['error'](_0x79f3('0x26'),_0x79f3('0x2d'),'skebby',util[_0x79f3('0xca')](_0x151fac[_0x79f3('0x5e')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x3e28de==='1'){return _0x1f261a[_0x79f3('0x36')]({'read':!![]});}else{logger[_0x79f3('0x28')](_0x79f3('0x26'),_0x79f3('0x2d'),_0x79f3('0xcb'),util[_0x79f3('0xca')](_0x151fac[_0x79f3('0x5e')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x151fac[_0x79f3('0x5e')]['error_code']&&_0x3e28de>=0xc8&&_0x3e28de<=0xce){return _0x1f261a['update']({'read':!![]});}else{logger[_0x79f3('0x28')](_0x79f3('0x26'),_0x79f3('0x2d'),'clicksend',util[_0x79f3('0xca')](_0x151fac[_0x79f3('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x79f3('0x8f'):var _0x12b2e7=_0x151fac['body']['results'][0x0];if(_0x12b2e7[_0x79f3('0x2d')]['groupName']===_0x79f3('0xd1')){return _0x1f261a[_0x79f3('0x36')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x79f3('0x2d'),'infobip',util[_0x79f3('0xca')](_0x151fac[_0x79f3('0x5e')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x3e28de==_0x79f3('0xd3')||_0x3e28de==_0x79f3('0xd4')){return _0x1f261a['update']({'read':!![]});}else{logger[_0x79f3('0x28')](_0x79f3('0x26'),_0x79f3('0x2d'),_0x79f3('0x95'),util[_0x79f3('0xca')](_0x151fac[_0x79f3('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x79f3('0x96'):if(_0x3e28de==='DELIVRD'||_0x3e28de===_0x79f3('0xd5')){return _0x1f261a['update']({'read':!![]});}else{logger[_0x79f3('0x28')](_0x79f3('0x26'),'status',_0x79f3('0x96'),util[_0x79f3('0xca')](_0x151fac[_0x79f3('0x5e')],{'showHidden':![],'depth':null}));}break;}return _0x1f261a;}})['then'](respondWithResult(_0x3a694d,null))[_0x79f3('0x2c')](handleError(_0x3a694d,null));};exports[_0x79f3('0xd6')]=function(_0x14c48e,_0x15b40d,_0x43c046){var _0x1ee058,_0x4d1ef1,_0x1b5c2a;return db[_0x79f3('0x42')][_0x79f3('0x62')]({'where':{'id':_0x14c48e[_0x79f3('0x5b')]['id']}})[_0x79f3('0x21')](handleEntityNotFound(_0x15b40d,null))[_0x79f3('0x21')](function(_0xb23c3b){if(_0xb23c3b){_0x1b5c2a=_0xb23c3b;logger['debug'](_0x79f3('0x26'),_0x79f3('0x2d'),_0x79f3('0xd7'),_0xb23c3b[_0x79f3('0x44')],util[_0x79f3('0xca')](_0x14c48e[_0x79f3('0x47')],{'showHidden':![],'depth':null}));switch(_0xb23c3b[_0x79f3('0x44')]){case _0x79f3('0x92'):if(_0x14c48e[_0x79f3('0x47')]['message-id']&&_0x14c48e[_0x79f3('0x47')][_0x79f3('0xd8')]){_0x4d1ef1=_0x14c48e[_0x79f3('0x47')][_0x79f3('0xd8')];return db[_0x79f3('0xc5')][_0x79f3('0x62')]({'where':{'messageId':_0x14c48e['query'][_0x79f3('0xd9')]}});}break;}}})['then'](handleEntityNotFound(_0x15b40d,null))[_0x79f3('0x21')](function(_0x9607a1){if(_0x9607a1){_0x1ee058=_0x9607a1;switch(_0x1b5c2a['type']){case _0x79f3('0x92'):if(_0x4d1ef1==='2'||_0x4d1ef1==='6'){return _0x1ee058['update']({'read':!![]});}else{logger[_0x79f3('0x28')](_0x79f3('0x26'),'status','csc',util[_0x79f3('0xca')](_0x14c48e[_0x79f3('0x47')],{'showHidden':![],'depth':null}));};break;}return _0x1ee058;}})[_0x79f3('0x21')](respondWithResult(_0x15b40d,null))[_0x79f3('0x2c')](handleError(_0x15b40d,null));};exports['addAgents']=function(_0x4d5b5c,_0x419123,_0x49b8ae){return db[_0x79f3('0x42')]['find']({'where':{'id':_0x4d5b5c[_0x79f3('0x5b')]['id']}})[_0x79f3('0x21')](handleEntityNotFound(_0x419123,null))[_0x79f3('0x21')](function(_0x3d4e9c){if(_0x3d4e9c){return _0x3d4e9c[_0x79f3('0xda')](_0x4d5b5c[_0x79f3('0x5e')]['ids'],_[_0x79f3('0xdb')](_0x4d5b5c[_0x79f3('0x5e')],[_0x79f3('0x6d'),'id'])||{})[_0x79f3('0xa3')](function(_0x4a8258){for(var _0x44c404=0x0;_0x44c404<_0x4d5b5c[_0x79f3('0x5e')]['ids'][_0x79f3('0x4d')];_0x44c404+=0x1){socket[_0x79f3('0xdc')](_0x79f3('0xdd'),{'UserId':_0x4d5b5c[_0x79f3('0x5e')][_0x79f3('0x6d')][_0x44c404],'SmsAccountId':_0x4d5b5c['params']['id']});}return _0x4a8258;});}})[_0x79f3('0x21')](respondWithResult(_0x419123,null))[_0x79f3('0x2c')](handleError(_0x419123,null));};exports[_0x79f3('0xde')]=function(_0x4b9c76,_0x5a0f66,_0x1749cb){return db[_0x79f3('0x42')]['find']({'where':{'id':_0x4b9c76['params']['id']}})[_0x79f3('0x21')](handleEntityNotFound(_0x5a0f66,null))[_0x79f3('0x21')](function(_0x21edaa){if(_0x21edaa){return _0x21edaa[_0x79f3('0xde')](_0x4b9c76[_0x79f3('0x47')]['ids'])[_0x79f3('0x21')](function(){if(_[_0x79f3('0xdf')](_0x4b9c76[_0x79f3('0x47')][_0x79f3('0x6d')])){for(var _0x1633b4=0x0;_0x1633b4<_0x4b9c76[_0x79f3('0x47')][_0x79f3('0x6d')][_0x79f3('0x4d')];_0x1633b4+=0x1){socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x4b9c76[_0x79f3('0x47')]['ids'][_0x1633b4]),'SmsAccountId':Number(_0x4b9c76[_0x79f3('0x5b')]['id'])});}}else{socket[_0x79f3('0xdc')]('userSmsAccount:remove',{'UserId':Number(_0x4b9c76[_0x79f3('0x47')]['ids']),'SmsAccountId':Number(_0x4b9c76[_0x79f3('0x5b')]['id'])});}});}})[_0x79f3('0x21')](respondWithStatusCode(_0x5a0f66,null))[_0x79f3('0x2c')](handleError(_0x5a0f66,null));};exports[_0x79f3('0xe0')]=function(_0x3c4fc6,_0xd7b1cf,_0x5d6025){var _0x21013c={};var _0x2db78b={};var _0x16efc0;var _0x702393;return db['SmsAccount'][_0x79f3('0x6b')]({'where':{'id':_0x3c4fc6['params']['id']}})[_0x79f3('0x21')](handleEntityNotFound(_0xd7b1cf,null))[_0x79f3('0x21')](function(_0xa091b7){if(_0xa091b7){_0x16efc0=_0xa091b7;_0x2db78b['model']=_[_0x79f3('0x48')](db[_0x79f3('0xab')][_0x79f3('0x5c')]);_0x2db78b['query']=_[_0x79f3('0x48')](_0x3c4fc6['query']);_0x2db78b[_0x79f3('0x49')]=_[_0x79f3('0x4a')](_0x2db78b['model'],_0x2db78b[_0x79f3('0x47')]);_0x21013c['attributes']=_['intersection'](_0x2db78b[_0x79f3('0x46')],qs[_0x79f3('0x4b')](_0x3c4fc6[_0x79f3('0x47')][_0x79f3('0x4b')]));_0x21013c[_0x79f3('0x4c')]=_0x21013c[_0x79f3('0x4c')][_0x79f3('0x4d')]?_0x21013c[_0x79f3('0x4c')]:_0x2db78b['model'];_0x21013c[_0x79f3('0x4f')]=qs[_0x79f3('0x50')](_0x3c4fc6['query'][_0x79f3('0x50')]);_0x21013c['where']=qs[_0x79f3('0x49')](_[_0x79f3('0x51')](_0x3c4fc6[_0x79f3('0x47')],_0x2db78b[_0x79f3('0x49')]));if(_0x3c4fc6[_0x79f3('0x47')][_0x79f3('0x52')]){_0x21013c[_0x79f3('0x53')]=_[_0x79f3('0x55')](_0x21013c['where'],{'$or':_[_0x79f3('0x41')](_0x21013c[_0x79f3('0x4c')],function(_0x105d20){var _0x150322={};_0x150322[_0x105d20]={'$like':'%'+_0x3c4fc6[_0x79f3('0x47')][_0x79f3('0x52')]+'%'};return _0x150322;})});}_0x21013c=_[_0x79f3('0x55')]({},_0x21013c,_0x3c4fc6[_0x79f3('0x56')]);return _0x16efc0[_0x79f3('0xe0')](_0x21013c);}})[_0x79f3('0x21')](function(_0x263b43){if(_0x263b43){_0x702393=_0x263b43[_0x79f3('0x4d')];if(!_0x3c4fc6[_0x79f3('0x47')][_0x79f3('0x6c')](_0x79f3('0x4e'))){_0x21013c['limit']=qs[_0x79f3('0x32')](_0x3c4fc6[_0x79f3('0x47')][_0x79f3('0x32')]);_0x21013c[_0x79f3('0x31')]=qs[_0x79f3('0x31')](_0x3c4fc6['query'][_0x79f3('0x31')]);}return _0x16efc0[_0x79f3('0xe0')](_0x21013c);}})['then'](function(_0x3ae2eb){if(_0x3ae2eb){return _0x3ae2eb?{'count':_0x702393,'rows':_0x3ae2eb}:null;}})[_0x79f3('0x21')](respondWithResult(_0xd7b1cf,null))['catch'](handleError(_0xd7b1cf,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 17109b5..47c25dc 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 _0x70a2=['emit','hasOwnProperty','events','../../mysqldb','SmsAccount','setMaxListeners','update','remove'];(function(_0x4d8357,_0x3071fb){var _0x25df73=function(_0x48e36b){while(--_0x48e36b){_0x4d8357['push'](_0x4d8357['shift']());}};_0x25df73(++_0x3071fb);}(_0x70a2,0x1ea));var _0x270a=function(_0x381927,_0x684dab){_0x381927=_0x381927-0x0;var _0x5f2835=_0x70a2[_0x381927];return _0x5f2835;};'use strict';var EventEmitter=require(_0x270a('0x0'));var SmsAccount=require(_0x270a('0x1'))['db'][_0x270a('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x270a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x270a('0x4'),'afterDestroy':_0x270a('0x5')};function emitEvent(_0x1fa725){return function(_0x484302,_0x5a9acf,_0x2f0f75){SmsAccountEvents[_0x270a('0x6')](_0x1fa725+':'+_0x484302['id'],_0x484302);SmsAccountEvents[_0x270a('0x6')](_0x1fa725,_0x484302);_0x2f0f75(null);};}for(var e in events){if(events[_0x270a('0x7')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0x76ed=['setMaxListeners','save','update','events','../../mysqldb'];(function(_0x32f679,_0x5b3550){var _0x4333fc=function(_0x209ca4){while(--_0x209ca4){_0x32f679['push'](_0x32f679['shift']());}};_0x4333fc(++_0x5b3550);}(_0x76ed,0x166));var _0xd76e=function(_0x41cc94,_0x41e752){_0x41cc94=_0x41cc94-0x0;var _0x15d020=_0x76ed[_0x41cc94];return _0x15d020;};'use strict';var EventEmitter=require(_0xd76e('0x0'));var SmsAccount=require(_0xd76e('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xd76e('0x2')](0x0);var events={'afterCreate':_0xd76e('0x3'),'afterUpdate':_0xd76e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x46e640){return function(_0x275843,_0x44f316,_0xc7f1da){SmsAccountEvents['emit'](_0x46e640+':'+_0x275843['id'],_0x275843);SmsAccountEvents['emit'](_0x46e640,_0x275843);_0xc7f1da(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 4900622..3e1107f 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 _0xcd73=['define','SmsAccount','sms_accounts','lodash','util','api','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x217144,_0x2306f8){var _0x250bb3=function(_0x4e3275){while(--_0x4e3275){_0x217144['push'](_0x217144['shift']());}};_0x250bb3(++_0x2306f8);}(_0xcd73,0x184));var _0x3cd7=function(_0x5948e3,_0x2b900d){_0x5948e3=_0x5948e3-0x0;var _0x357237=_0xcd73[_0x5948e3];return _0x357237;};'use strict';var _=require(_0x3cd7('0x0'));var util=require(_0x3cd7('0x1'));var logger=require('../../config/logger')(_0x3cd7('0x2'));var moment=require('moment');var BPromise=require(_0x3cd7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3cd7('0x4'));var rimraf=require(_0x3cd7('0x5'));var config=require(_0x3cd7('0x6'));var attributes=require('./smsAccount.attributes');module[_0x3cd7('0x7')]=function(_0x490c5f,_0xca9fb){return _0x490c5f[_0x3cd7('0x8')](_0x3cd7('0x9'),attributes,{'tableName':_0x3cd7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e52=['define','SmsAccount','sms_accounts','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports'];(function(_0xf44d98,_0x12a472){var _0x5ebb04=function(_0x930c33){while(--_0x930c33){_0xf44d98['push'](_0xf44d98['shift']());}};_0x5ebb04(++_0x12a472);}(_0x6e52,0x189));var _0x26e5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6e52[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x26e5('0x0'));var util=require('util');var logger=require(_0x26e5('0x1'))('api');var moment=require(_0x26e5('0x2'));var BPromise=require(_0x26e5('0x3'));var rp=require(_0x26e5('0x4'));var fs=require('fs');var path=require(_0x26e5('0x5'));var rimraf=require(_0x26e5('0x6'));var config=require(_0x26e5('0x7'));var attributes=require(_0x26e5('0x8'));module[_0x26e5('0x9')]=function(_0x2f1c73,_0x30e8a9){return _0x2f1c73[_0x26e5('0xa')](_0x26e5('0xb'),attributes,{'tableName':_0x26e5('0xc'),'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 c93ffd7..4e3009c 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 _0x5aaa=['map','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','register','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','model'];(function(_0x1ab724,_0x2e2566){var _0x2167ac=function(_0xb2e7fd){while(--_0xb2e7fd){_0x1ab724['push'](_0x1ab724['shift']());}};_0x2167ac(++_0x2e2566);}(_0x5aaa,0x18e));var _0xa5aa=function(_0xcea957,_0xb30371){_0xcea957=_0xcea957-0x0;var _0xea6f1b=_0x5aaa[_0xcea957];return _0xea6f1b;};'use strict';var _=require(_0xa5aa('0x0'));var util=require(_0xa5aa('0x1'));var moment=require(_0xa5aa('0x2'));var BPromise=require(_0xa5aa('0x3'));var rs=require(_0xa5aa('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa5aa('0x5'))('rpc');var config=require(_0xa5aa('0x6'));var jayson=require(_0xa5aa('0x7'));var client=jayson[_0xa5aa('0x8')][_0xa5aa('0x9')]({'port':0x232a});config['redis']=_[_0xa5aa('0xa')](config[_0xa5aa('0xb')],{'host':_0xa5aa('0xc'),'port':0x18eb});var socket=require(_0xa5aa('0xd'))(new Redis(config[_0xa5aa('0xb')]));require(_0xa5aa('0xe'))[_0xa5aa('0xf')](socket);function respondWithRpcPromise(_0x8113b9,_0x2c7dda,_0x475df9){return new BPromise(function(_0x4b81f5,_0xa36b57){return client['request'](_0x8113b9,_0x475df9)[_0xa5aa('0x10')](function(_0x25eda5){logger[_0xa5aa('0x11')](_0xa5aa('0x12'),_0x2c7dda,_0xa5aa('0x13'));logger[_0xa5aa('0x14')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2c7dda,'request\x20sent',JSON[_0xa5aa('0x15')](_0x25eda5));if(_0x25eda5[_0xa5aa('0x16')]){if(_0x25eda5[_0xa5aa('0x16')][_0xa5aa('0x17')]===0x1f4){logger[_0xa5aa('0x16')](_0xa5aa('0x12'),_0x2c7dda,_0x25eda5[_0xa5aa('0x16')][_0xa5aa('0x18')]);return _0xa36b57(_0x25eda5[_0xa5aa('0x16')][_0xa5aa('0x18')]);}logger[_0xa5aa('0x16')](_0xa5aa('0x12'),_0x2c7dda,_0x25eda5[_0xa5aa('0x16')]['message']);return _0x4b81f5(_0x25eda5['error'][_0xa5aa('0x18')]);}else{logger[_0xa5aa('0x11')](_0xa5aa('0x12'),_0x2c7dda,_0xa5aa('0x13'));_0x4b81f5(_0x25eda5['result']['message']);}})['catch'](function(_0xde4b3b){logger[_0xa5aa('0x16')](_0xa5aa('0x12'),_0x2c7dda,_0xde4b3b);_0xa36b57(_0xde4b3b);});});}exports[_0xa5aa('0x19')]=function(_0x1a1ae8){var _0x8b06d8=this;return new Promise(function(_0x2007bb,_0x5f197b){return db[_0xa5aa('0x1a')][_0xa5aa('0x1b')]({'raw':_0x1a1ae8[_0xa5aa('0x1c')]?_0x1a1ae8[_0xa5aa('0x1c')][_0xa5aa('0x1d')]===undefined?!![]:![]:!![],'where':_0x1a1ae8[_0xa5aa('0x1c')]?_0x1a1ae8[_0xa5aa('0x1c')][_0xa5aa('0x1e')]||null:null,'attributes':_0x1a1ae8[_0xa5aa('0x1c')]?_0x1a1ae8[_0xa5aa('0x1c')][_0xa5aa('0x1f')]||null:null,'include':_0x1a1ae8[_0xa5aa('0x1c')]?_0x1a1ae8[_0xa5aa('0x1c')][_0xa5aa('0x20')]?_['map'](_0x1a1ae8['options']['include'],function(_0x22e944){return{'model':db[_0x22e944[_0xa5aa('0x21')]],'as':_0x22e944['as'],'attributes':_0x22e944[_0xa5aa('0x1f')],'include':_0x22e944[_0xa5aa('0x20')]?_[_0xa5aa('0x22')](_0x22e944[_0xa5aa('0x20')],function(_0x2056aa){return{'model':db[_0x2056aa[_0xa5aa('0x21')]],'as':_0x2056aa['as'],'attributes':_0x2056aa[_0xa5aa('0x1f')],'include':_0x2056aa[_0xa5aa('0x20')]?_[_0xa5aa('0x22')](_0x2056aa['include'],function(_0x21699f){return{'model':db[_0x21699f['model']],'as':_0x21699f['as'],'attributes':_0x21699f['attributes']};}):[]};}):[]};}):[]:[]})[_0xa5aa('0x10')](function(_0x1b3530){logger[_0xa5aa('0x11')](_0xa5aa('0x19'),_0x1a1ae8);logger[_0xa5aa('0x14')]('ShowSmsAccount',_0x1a1ae8,JSON[_0xa5aa('0x15')](_0x1b3530));_0x2007bb(_0x1b3530);})[_0xa5aa('0x23')](function(_0x3ee78e){logger['error'](_0xa5aa('0x19'),_0x3ee78e[_0xa5aa('0x18')],_0x1a1ae8);_0x5f197b(_0x8b06d8[_0xa5aa('0x16')](0x1f4,_0x3ee78e[_0xa5aa('0x18')]));});});}; \ No newline at end of file +var _0x7141=['catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','map','model'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7141,0x13c));var _0x1714=function(_0x2243ac,_0x44c2bb){_0x2243ac=_0x2243ac-0x0;var _0x3e4fd8=_0x7141[_0x2243ac];return _0x3e4fd8;};'use strict';var _=require(_0x1714('0x0'));var util=require('util');var moment=require(_0x1714('0x1'));var BPromise=require(_0x1714('0x2'));var rs=require(_0x1714('0x3'));var fs=require('fs');var Redis=require(_0x1714('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1714('0x5'))(_0x1714('0x6'));var config=require(_0x1714('0x7'));var jayson=require(_0x1714('0x8'));var client=jayson[_0x1714('0x9')][_0x1714('0xa')]({'port':0x232a});config[_0x1714('0xb')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1714('0xc'))(new Redis(config['redis']));require('./smsAccount.socket')['register'](socket);function respondWithRpcPromise(_0x5ccd11,_0x4e0921,_0x3b3d40){return new BPromise(function(_0x57ce0e,_0x5acbf0){return client[_0x1714('0xd')](_0x5ccd11,_0x3b3d40)[_0x1714('0xe')](function(_0x2e62f5){logger['info'](_0x1714('0xf'),_0x4e0921,_0x1714('0x10'));logger[_0x1714('0x11')](_0x1714('0x12'),_0x4e0921,'request\x20sent',JSON[_0x1714('0x13')](_0x2e62f5));if(_0x2e62f5[_0x1714('0x14')]){if(_0x2e62f5[_0x1714('0x14')][_0x1714('0x15')]===0x1f4){logger[_0x1714('0x14')]('SmsAccount,\x20%s,\x20%s',_0x4e0921,_0x2e62f5[_0x1714('0x14')][_0x1714('0x16')]);return _0x5acbf0(_0x2e62f5['error']['message']);}logger[_0x1714('0x14')](_0x1714('0xf'),_0x4e0921,_0x2e62f5[_0x1714('0x14')][_0x1714('0x16')]);return _0x57ce0e(_0x2e62f5[_0x1714('0x14')][_0x1714('0x16')]);}else{logger['info'](_0x1714('0xf'),_0x4e0921,_0x1714('0x10'));_0x57ce0e(_0x2e62f5[_0x1714('0x17')][_0x1714('0x16')]);}})['catch'](function(_0x2fe370){logger[_0x1714('0x14')](_0x1714('0xf'),_0x4e0921,_0x2fe370);_0x5acbf0(_0x2fe370);});});}exports[_0x1714('0x18')]=function(_0x10084e){var _0x18b466=this;return new Promise(function(_0x65480e,_0x255f06){return db[_0x1714('0x19')][_0x1714('0x1a')]({'raw':_0x10084e['options']?_0x10084e[_0x1714('0x1b')][_0x1714('0x1c')]===undefined?!![]:![]:!![],'where':_0x10084e['options']?_0x10084e['options'][_0x1714('0x1d')]||null:null,'attributes':_0x10084e['options']?_0x10084e[_0x1714('0x1b')][_0x1714('0x1e')]||null:null,'include':_0x10084e[_0x1714('0x1b')]?_0x10084e[_0x1714('0x1b')][_0x1714('0x1f')]?_[_0x1714('0x20')](_0x10084e[_0x1714('0x1b')][_0x1714('0x1f')],function(_0x2c2202){return{'model':db[_0x2c2202[_0x1714('0x21')]],'as':_0x2c2202['as'],'attributes':_0x2c2202['attributes'],'include':_0x2c2202['include']?_[_0x1714('0x20')](_0x2c2202['include'],function(_0x364b5c){return{'model':db[_0x364b5c[_0x1714('0x21')]],'as':_0x364b5c['as'],'attributes':_0x364b5c[_0x1714('0x1e')],'include':_0x364b5c[_0x1714('0x1f')]?_['map'](_0x364b5c[_0x1714('0x1f')],function(_0x12f7d2){return{'model':db[_0x12f7d2[_0x1714('0x21')]],'as':_0x12f7d2['as'],'attributes':_0x12f7d2['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x49bfe6){logger['info'](_0x1714('0x18'),_0x10084e);logger[_0x1714('0x11')](_0x1714('0x18'),_0x10084e,JSON['stringify'](_0x49bfe6));_0x65480e(_0x49bfe6);})[_0x1714('0x22')](function(_0x2ae8a4){logger[_0x1714('0x14')]('ShowSmsAccount',_0x2ae8a4[_0x1714('0x16')],_0x10084e);_0x255f06(_0x18b466['error'](0x1f4,_0x2ae8a4[_0x1714('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 93d5abe..407fb38 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 _0x29d8=['register','length','save','remove','removeListener'];(function(_0x4cb408,_0x2054c9){var _0x28fc52=function(_0x5a2d57){while(--_0x5a2d57){_0x4cb408['push'](_0x4cb408['shift']());}};_0x28fc52(++_0x2054c9);}(_0x29d8,0xc5));var _0x829d=function(_0x5ed153,_0x5db670){_0x5ed153=_0x5ed153-0x0;var _0x2cde9f=_0x29d8[_0x5ed153];return _0x2cde9f;};'use strict';var SmsAccountEvents=require('./smsAccount.events');var events=[_0x829d('0x0'),_0x829d('0x1'),'update'];function createListener(_0x1143ec,_0x448333){return function(_0x4b254a){_0x448333['emit'](_0x1143ec,_0x4b254a);};}function removeListener(_0x5f1bf3,_0x1d2838){return function(){SmsAccountEvents[_0x829d('0x2')](_0x5f1bf3,_0x1d2838);};}exports[_0x829d('0x3')]=function(_0x33b5fd){for(var _0x3d7fc7=0x0,_0x229b2b=events[_0x829d('0x4')];_0x3d7fc7<_0x229b2b;_0x3d7fc7++){var _0x5275ec=events[_0x3d7fc7];var _0x5cbede=createListener('smsAccount:'+_0x5275ec,_0x33b5fd);SmsAccountEvents['on'](_0x5275ec,_0x5cbede);}}; \ No newline at end of file +var _0x7bb1=['update','emit','removeListener','smsAccount:','./smsAccount.events','save','remove'];(function(_0x3607d9,_0x495135){var _0x1cf173=function(_0x29be75){while(--_0x29be75){_0x3607d9['push'](_0x3607d9['shift']());}};_0x1cf173(++_0x495135);}(_0x7bb1,0x1bd));var _0x17bb=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x7bb1[_0x500419];return _0x241c1a;};'use strict';var SmsAccountEvents=require(_0x17bb('0x0'));var events=[_0x17bb('0x1'),_0x17bb('0x2'),_0x17bb('0x3')];function createListener(_0x281b93,_0x327529){return function(_0x440800){_0x327529[_0x17bb('0x4')](_0x281b93,_0x440800);};}function removeListener(_0x536571,_0xb5974a){return function(){SmsAccountEvents[_0x17bb('0x5')](_0x536571,_0xb5974a);};}exports['register']=function(_0x3dba3b){for(var _0x3a70f6=0x0,_0x39410d=events['length'];_0x3a70f6<_0x39410d;_0x3a70f6++){var _0x5e9748=events[_0x3a70f6];var _0x563376=createListener(_0x17bb('0x6')+_0x5e9748,_0x3dba3b);SmsAccountEvents['on'](_0x5e9748,_0x563376);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 3a306be..c77c91f 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 _0xcbda=['connect-timeout','express','Router','../../config/environment','./smsApplication.controller','get','isAuthenticated','/:id','create','delete','destroy','exports','multer','util'];(function(_0x1f7102,_0x2201fb){var _0x3c01bd=function(_0x517f06){while(--_0x517f06){_0x1f7102['push'](_0x1f7102['shift']());}};_0x3c01bd(++_0x2201fb);}(_0xcbda,0xec));var _0xacbd=function(_0x354d7d,_0x755380){_0x354d7d=_0x354d7d-0x0;var _0x2979f6=_0xcbda[_0x354d7d];return _0x2979f6;};'use strict';var multer=require(_0xacbd('0x0'));var util=require(_0xacbd('0x1'));var path=require('path');var timeout=require(_0xacbd('0x2'));var express=require(_0xacbd('0x3'));var router=express[_0xacbd('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xacbd('0x5'));var controller=require(_0xacbd('0x6'));router[_0xacbd('0x7')]('/',auth[_0xacbd('0x8')](),controller['index']);router[_0xacbd('0x7')](_0xacbd('0x9'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xacbd('0x8')](),controller[_0xacbd('0xa')]);router['put']('/:id',auth[_0xacbd('0x8')](),controller['update']);router[_0xacbd('0xb')]('/:id',auth[_0xacbd('0x8')](),controller[_0xacbd('0xc')]);module[_0xacbd('0xd')]=router; \ No newline at end of file +var _0x44b8=['show','put','update','/:id','destroy','exports','multer','Router','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index'];(function(_0x49d8b3,_0xeac856){var _0x2c124e=function(_0x2b7545){while(--_0x2b7545){_0x49d8b3['push'](_0x49d8b3['shift']());}};_0x2c124e(++_0xeac856);}(_0x44b8,0x11e));var _0x844b=function(_0x3f31ce,_0x468d32){_0x3f31ce=_0x3f31ce-0x0;var _0x13d692=_0x44b8[_0x3f31ce];return _0x13d692;};'use strict';var multer=require(_0x844b('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x844b('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0x844b('0x2'));var config=require(_0x844b('0x3'));var controller=require(_0x844b('0x4'));router[_0x844b('0x5')]('/',auth[_0x844b('0x6')](),controller[_0x844b('0x7')]);router[_0x844b('0x5')]('/:id',auth[_0x844b('0x6')](),controller[_0x844b('0x8')]);router['post']('/',auth[_0x844b('0x6')](),controller['create']);router[_0x844b('0x9')]('/:id',auth[_0x844b('0x6')](),controller[_0x844b('0xa')]);router['delete'](_0x844b('0xb'),auth[_0x844b('0x6')](),controller[_0x844b('0xc')]);module[_0x844b('0xd')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 5cbf057..95d7fb2 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 _0xf8e9=['noop','STRING','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x42c8ce,_0xdc007f){var _0x348975=function(_0x7528ca){while(--_0x7528ca){_0x42c8ce['push'](_0x42c8ce['shift']());}};_0x348975(++_0xdc007f);}(_0xf8e9,0x1c5));var _0x9f8e=function(_0x46b7b1,_0x3d10e4){_0x46b7b1=_0x46b7b1-0x0;var _0x3c9bba=_0xf8e9[_0x46b7b1];return _0x3c9bba;};'use strict';var Sequelize=require(_0x9f8e('0x0'));module[_0x9f8e('0x1')]={'priority':{'type':Sequelize[_0x9f8e('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9f8e('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x9f8e('0x4')]},'interval':{'type':Sequelize[_0x9f8e('0x4')],'defaultValue':_0x9f8e('0x5')}}; \ No newline at end of file +var _0xc31e=['noop','TEXT','*,*,*,*','exports','INTEGER'];(function(_0x2f8431,_0x10a4b4){var _0x2640c7=function(_0x3ecf4b){while(--_0x3ecf4b){_0x2f8431['push'](_0x2f8431['shift']());}};_0x2640c7(++_0x10a4b4);}(_0xc31e,0x111));var _0xec31=function(_0x4f711d,_0x364b1c){_0x4f711d=_0x4f711d-0x0;var _0x592067=_0xc31e[_0x4f711d];return _0x592067;};'use strict';var Sequelize=require('sequelize');module[_0xec31('0x0')]={'priority':{'type':Sequelize[_0xec31('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xec31('0x2')},'appdata':{'type':Sequelize[_0xec31('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xec31('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 896a34c..99d5d3d 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 _0x6679=['ioredis','../../components/auth/service','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','SmsApplication','rawAttributes','fieldName','type','key','model','query','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','catch','show','params','fields','find','create','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x42da27,_0x51f56a){var _0x52fbde=function(_0x57e636){while(--_0x57e636){_0x42da27['push'](_0x42da27['shift']());}};_0x52fbde(++_0x51f56a);}(_0x6679,0x142));var _0x9667=function(_0x246148,_0x1358ee){_0x246148=_0x246148-0x0;var _0x453d94=_0x6679[_0x246148];return _0x453d94;};'use strict';var pdf=require(_0x9667('0x0'));var emlformat=require(_0x9667('0x1'));var rimraf=require(_0x9667('0x2'));var zipdir=require(_0x9667('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9667('0x4'));var moment=require('moment');var BPromise=require(_0x9667('0x5'));var Mustache=require(_0x9667('0x6'));var util=require(_0x9667('0x7'));var path=require(_0x9667('0x8'));var sox=require(_0x9667('0x9'));var csv=require(_0x9667('0xa'));var ejs=require(_0x9667('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9667('0xc'));var crypto=require(_0x9667('0xd'));var jsforce=require(_0x9667('0xe'));var deskjs=require(_0x9667('0xf'));var toCsv=require(_0x9667('0xa'));var querystring=require(_0x9667('0x10'));var Papa=require(_0x9667('0x11'));var Redis=require(_0x9667('0x12'));var authService=require(_0x9667('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x9667('0x14'))['db'];function respondWithStatusCode(_0x3ada09,_0x30c16c){_0x30c16c=_0x30c16c||0xcc;return function(_0x3805dc){if(_0x3805dc){return _0x3ada09[_0x9667('0x15')](_0x30c16c);}return _0x3ada09[_0x9667('0x16')](_0x30c16c)[_0x9667('0x17')]();};}function respondWithResult(_0x220f0d,_0x3ea64b){_0x3ea64b=_0x3ea64b||0xc8;return function(_0x41b872){if(_0x41b872){return _0x220f0d[_0x9667('0x16')](_0x3ea64b)[_0x9667('0x18')](_0x41b872);}};}function respondWithFilteredResult(_0x510593,_0x29c84e){return function(_0x284926){if(_0x284926){var _0x37ca9f=_0x284926[_0x9667('0x19')],_0x506000=_0x29c84e[_0x9667('0x1a')],_0x13b834=_0x29c84e[_0x9667('0x1a')]+_0x29c84e['limit'],_0x35aa86;if(_0x13b834>=_0x37ca9f){_0x13b834=_0x37ca9f;_0x35aa86=0xc8;}else{_0x35aa86=0xce;}_0x510593[_0x9667('0x16')](_0x35aa86);return _0x510593['set'](_0x9667('0x1b'),_0x506000+'-'+_0x13b834+'/'+_0x37ca9f)[_0x9667('0x18')](_0x284926);}return null;};}function patchUpdates(_0x525eaa){return function(_0x489152){try{jsonpatch['apply'](_0x489152,_0x525eaa,!![]);}catch(_0x3525b3){return BPromise[_0x9667('0x1c')](_0x3525b3);}return _0x489152[_0x9667('0x1d')]();};}function saveUpdates(_0x124fe9,_0x5c3995){return function(_0x59c10d){if(_0x59c10d){return _0x59c10d[_0x9667('0x1e')](_0x124fe9)[_0x9667('0x1f')](function(_0x19f7f6){return _0x19f7f6;});}return null;};}function removeEntity(_0x1ae65f,_0x2f8ffc){return function(_0x3be32b){if(_0x3be32b){return _0x3be32b[_0x9667('0x20')]()[_0x9667('0x1f')](function(){_0x1ae65f[_0x9667('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0xde9264,_0x29acb3){return function(_0x707abe){if(!_0x707abe){_0xde9264['sendStatus'](0x194);}return _0x707abe;};}function handleError(_0x1e7bc6,_0x5e14d5){_0x5e14d5=_0x5e14d5||0x1f4;return function(_0x35079c){logger[_0x9667('0x21')](_0x35079c[_0x9667('0x22')]);if(_0x35079c[_0x9667('0x23')]){delete _0x35079c[_0x9667('0x23')];}_0x1e7bc6['status'](_0x5e14d5)[_0x9667('0x24')](_0x35079c);};}exports['index']=function(_0x1c60e2,_0x274cd1){var _0x475540={},_0x18c31e={},_0x1606ba={'count':0x0,'rows':[]};var _0x2b3287=_[_0x9667('0x25')](db[_0x9667('0x26')][_0x9667('0x27')],function(_0xdda33){return{'name':_0xdda33[_0x9667('0x28')],'type':_0xdda33[_0x9667('0x29')][_0x9667('0x2a')]};});_0x18c31e[_0x9667('0x2b')]=_[_0x9667('0x25')](_0x2b3287,_0x9667('0x23'));_0x18c31e['query']=_['keys'](_0x1c60e2[_0x9667('0x2c')]);_0x18c31e['filters']=_[_0x9667('0x2d')](_0x18c31e[_0x9667('0x2b')],_0x18c31e[_0x9667('0x2c')]);_0x475540[_0x9667('0x2e')]=_[_0x9667('0x2d')](_0x18c31e[_0x9667('0x2b')],qs['fields'](_0x1c60e2[_0x9667('0x2c')]['fields']));_0x475540['attributes']=_0x475540[_0x9667('0x2e')][_0x9667('0x2f')]?_0x475540['attributes']:_0x18c31e[_0x9667('0x2b')];if(!_0x1c60e2[_0x9667('0x2c')][_0x9667('0x30')](_0x9667('0x31'))){_0x475540['limit']=qs[_0x9667('0x32')](_0x1c60e2['query'][_0x9667('0x32')]);_0x475540['offset']=qs['offset'](_0x1c60e2[_0x9667('0x2c')][_0x9667('0x1a')]);}_0x475540[_0x9667('0x33')]=qs['sort'](_0x1c60e2[_0x9667('0x2c')]['sort']);_0x475540[_0x9667('0x34')]=qs[_0x9667('0x35')](_[_0x9667('0x36')](_0x1c60e2[_0x9667('0x2c')],_0x18c31e[_0x9667('0x35')]));if(_0x1c60e2[_0x9667('0x2c')]['filter']){_0x475540[_0x9667('0x34')]=_[_0x9667('0x37')](_0x475540['where'],{'$or':_[_0x9667('0x25')](_0x2b3287,function(_0x3704df){if(_0x3704df[_0x9667('0x29')]!==_0x9667('0x38')){var _0x416a26={};_0x416a26[_0x3704df[_0x9667('0x23')]]={'$like':'%'+_0x1c60e2[_0x9667('0x2c')][_0x9667('0x39')]+'%'};return _0x416a26;}})});}_0x475540=_[_0x9667('0x37')]({},_0x475540,_0x1c60e2[_0x9667('0x3a')]);var _0x3ff529={'where':_0x475540['where']};return db[_0x9667('0x26')][_0x9667('0x19')](_0x3ff529)[_0x9667('0x1f')](function(_0x14a56f){_0x1606ba[_0x9667('0x19')]=_0x14a56f;if(_0x1c60e2[_0x9667('0x2c')][_0x9667('0x3b')]){_0x475540[_0x9667('0x3c')]=[{'all':!![]}];}return db['SmsApplication']['findAll'](_0x475540);})['then'](function(_0x31c763){_0x1606ba['rows']=_0x31c763;return _0x1606ba;})[_0x9667('0x1f')](respondWithFilteredResult(_0x274cd1,_0x475540))[_0x9667('0x3d')](handleError(_0x274cd1,null));};exports[_0x9667('0x3e')]=function(_0x298789,_0x2ce8c6){var _0x51459d={'raw':!![],'where':{'id':_0x298789[_0x9667('0x3f')]['id']}},_0x1b17e3={};_0x1b17e3[_0x9667('0x2b')]=_['keys'](db[_0x9667('0x26')][_0x9667('0x27')]);_0x1b17e3['query']=_['keys'](_0x298789[_0x9667('0x2c')]);_0x1b17e3[_0x9667('0x35')]=_['intersection'](_0x1b17e3[_0x9667('0x2b')],_0x1b17e3[_0x9667('0x2c')]);_0x51459d[_0x9667('0x2e')]=_[_0x9667('0x2d')](_0x1b17e3[_0x9667('0x2b')],qs['fields'](_0x298789[_0x9667('0x2c')][_0x9667('0x40')]));_0x51459d[_0x9667('0x2e')]=_0x51459d[_0x9667('0x2e')][_0x9667('0x2f')]?_0x51459d[_0x9667('0x2e')]:_0x1b17e3['model'];if(_0x298789[_0x9667('0x2c')][_0x9667('0x3b')]){_0x51459d['include']=[{'all':!![]}];}_0x51459d=_['merge']({},_0x51459d,_0x298789[_0x9667('0x3a')]);return db['SmsApplication'][_0x9667('0x41')](_0x51459d)[_0x9667('0x1f')](handleEntityNotFound(_0x2ce8c6,null))[_0x9667('0x1f')](respondWithResult(_0x2ce8c6,null))[_0x9667('0x3d')](handleError(_0x2ce8c6,null));};exports[_0x9667('0x42')]=function(_0x2a120a,_0x5a1932){return db['SmsApplication'][_0x9667('0x42')](_0x2a120a[_0x9667('0x43')],{})[_0x9667('0x1f')](respondWithResult(_0x5a1932,0xc9))['catch'](handleError(_0x5a1932,null));};exports[_0x9667('0x1e')]=function(_0x1cecf0,_0x4164cb){if(_0x1cecf0[_0x9667('0x43')]['id']){delete _0x1cecf0[_0x9667('0x43')]['id'];}return db[_0x9667('0x26')][_0x9667('0x41')]({'where':{'id':_0x1cecf0['params']['id']}})[_0x9667('0x1f')](handleEntityNotFound(_0x4164cb,null))[_0x9667('0x1f')](saveUpdates(_0x1cecf0[_0x9667('0x43')],null))[_0x9667('0x1f')](respondWithResult(_0x4164cb,null))[_0x9667('0x3d')](handleError(_0x4164cb,null));};exports[_0x9667('0x20')]=function(_0x1e0e15,_0x54e5cb){return db['SmsApplication'][_0x9667('0x41')]({'where':{'id':_0x1e0e15[_0x9667('0x3f')]['id']}})[_0x9667('0x1f')](handleEntityNotFound(_0x54e5cb,null))[_0x9667('0x1f')](removeEntity(_0x54e5cb,null))[_0x9667('0x3d')](handleError(_0x54e5cb,null));}; \ No newline at end of file +var _0x50c1=['limit','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','sort','filter','where','merge','VIRTUAL','count','includeAll','SmsApplication','rows','catch','show','params','include','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x50c1,0xf9));var _0x150c=function(_0x1bd7dd,_0x2402ad){_0x1bd7dd=_0x1bd7dd-0x0;var _0x2a2c05=_0x50c1[_0x1bd7dd];return _0x2a2c05;};'use strict';var pdf=require(_0x150c('0x0'));var emlformat=require(_0x150c('0x1'));var rimraf=require(_0x150c('0x2'));var zipdir=require(_0x150c('0x3'));var jsonpatch=require(_0x150c('0x4'));var rp=require(_0x150c('0x5'));var moment=require(_0x150c('0x6'));var BPromise=require(_0x150c('0x7'));var Mustache=require(_0x150c('0x8'));var util=require(_0x150c('0x9'));var path=require('path');var sox=require(_0x150c('0xa'));var csv=require(_0x150c('0xb'));var ejs=require(_0x150c('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x150c('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x150c('0xe'));var toCsv=require(_0x150c('0xb'));var querystring=require(_0x150c('0xf'));var Papa=require(_0x150c('0x10'));var Redis=require(_0x150c('0x11'));var authService=require(_0x150c('0x12'));var qs=require(_0x150c('0x13'));var as=require(_0x150c('0x14'));var hardwareService=require(_0x150c('0x15'));var logger=require(_0x150c('0x16'))(_0x150c('0x17'));var utils=require(_0x150c('0x18'));var config=require(_0x150c('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ae79b,_0x225cd2){_0x225cd2=_0x225cd2||0xcc;return function(_0x155f5b){if(_0x155f5b){return _0x5ae79b[_0x150c('0x1a')](_0x225cd2);}return _0x5ae79b[_0x150c('0x1b')](_0x225cd2)[_0x150c('0x1c')]();};}function respondWithResult(_0x24bafb,_0x29a0a2){_0x29a0a2=_0x29a0a2||0xc8;return function(_0x21a07d){if(_0x21a07d){return _0x24bafb[_0x150c('0x1b')](_0x29a0a2)[_0x150c('0x1d')](_0x21a07d);}};}function respondWithFilteredResult(_0x56d97b,_0x4223dd){return function(_0x2f64d5){if(_0x2f64d5){var _0x4bbe58=_0x2f64d5['count'],_0x4b39fc=_0x4223dd[_0x150c('0x1e')],_0x118131=_0x4223dd[_0x150c('0x1e')]+_0x4223dd[_0x150c('0x1f')],_0x310a06;if(_0x118131>=_0x4bbe58){_0x118131=_0x4bbe58;_0x310a06=0xc8;}else{_0x310a06=0xce;}_0x56d97b[_0x150c('0x1b')](_0x310a06);return _0x56d97b['set']('Content-Range',_0x4b39fc+'-'+_0x118131+'/'+_0x4bbe58)[_0x150c('0x1d')](_0x2f64d5);}return null;};}function patchUpdates(_0x227a7e){return function(_0x3fba62){try{jsonpatch[_0x150c('0x20')](_0x3fba62,_0x227a7e,!![]);}catch(_0x577427){return BPromise[_0x150c('0x21')](_0x577427);}return _0x3fba62[_0x150c('0x22')]();};}function saveUpdates(_0x14074d,_0x513759){return function(_0x148eae){if(_0x148eae){return _0x148eae[_0x150c('0x23')](_0x14074d)[_0x150c('0x24')](function(_0xc614a6){return _0xc614a6;});}return null;};}function removeEntity(_0x3d8272,_0x3b24e2){return function(_0x4f77cc){if(_0x4f77cc){return _0x4f77cc[_0x150c('0x25')]()[_0x150c('0x24')](function(){_0x3d8272[_0x150c('0x1b')](0xcc)[_0x150c('0x1c')]();});}};}function handleEntityNotFound(_0x345bcd,_0x23856f){return function(_0x52b72e){if(!_0x52b72e){_0x345bcd['sendStatus'](0x194);}return _0x52b72e;};}function handleError(_0x538fdb,_0x3e0ce1){_0x3e0ce1=_0x3e0ce1||0x1f4;return function(_0x142b23){logger['error'](_0x142b23[_0x150c('0x26')]);if(_0x142b23[_0x150c('0x27')]){delete _0x142b23['name'];}_0x538fdb[_0x150c('0x1b')](_0x3e0ce1)[_0x150c('0x28')](_0x142b23);};}exports[_0x150c('0x29')]=function(_0x4aff86,_0x26a4cc){var _0x264523={},_0x3b68ac={},_0x1d2102={'count':0x0,'rows':[]};var _0x521b42=_[_0x150c('0x2a')](db['SmsApplication'][_0x150c('0x2b')],function(_0x235f39){return{'name':_0x235f39[_0x150c('0x2c')],'type':_0x235f39[_0x150c('0x2d')]['key']};});_0x3b68ac['model']=_[_0x150c('0x2a')](_0x521b42,_0x150c('0x27'));_0x3b68ac[_0x150c('0x2e')]=_[_0x150c('0x2f')](_0x4aff86[_0x150c('0x2e')]);_0x3b68ac[_0x150c('0x30')]=_[_0x150c('0x31')](_0x3b68ac[_0x150c('0x32')],_0x3b68ac[_0x150c('0x2e')]);_0x264523[_0x150c('0x33')]=_['intersection'](_0x3b68ac['model'],qs['fields'](_0x4aff86[_0x150c('0x2e')][_0x150c('0x34')]));_0x264523['attributes']=_0x264523[_0x150c('0x33')][_0x150c('0x35')]?_0x264523[_0x150c('0x33')]:_0x3b68ac[_0x150c('0x32')];if(!_0x4aff86[_0x150c('0x2e')]['hasOwnProperty']('nolimit')){_0x264523['limit']=qs[_0x150c('0x1f')](_0x4aff86[_0x150c('0x2e')]['limit']);_0x264523[_0x150c('0x1e')]=qs[_0x150c('0x1e')](_0x4aff86[_0x150c('0x2e')][_0x150c('0x1e')]);}_0x264523['order']=qs[_0x150c('0x36')](_0x4aff86[_0x150c('0x2e')]['sort']);_0x264523['where']=qs[_0x150c('0x30')](_['pick'](_0x4aff86[_0x150c('0x2e')],_0x3b68ac[_0x150c('0x30')]));if(_0x4aff86['query'][_0x150c('0x37')]){_0x264523[_0x150c('0x38')]=_[_0x150c('0x39')](_0x264523[_0x150c('0x38')],{'$or':_['map'](_0x521b42,function(_0x2b8a50){if(_0x2b8a50[_0x150c('0x2d')]!==_0x150c('0x3a')){var _0x511794={};_0x511794[_0x2b8a50['name']]={'$like':'%'+_0x4aff86['query'][_0x150c('0x37')]+'%'};return _0x511794;}})});}_0x264523=_[_0x150c('0x39')]({},_0x264523,_0x4aff86['options']);var _0x551060={'where':_0x264523[_0x150c('0x38')]};return db['SmsApplication'][_0x150c('0x3b')](_0x551060)[_0x150c('0x24')](function(_0x39e527){_0x1d2102[_0x150c('0x3b')]=_0x39e527;if(_0x4aff86[_0x150c('0x2e')][_0x150c('0x3c')]){_0x264523['include']=[{'all':!![]}];}return db[_0x150c('0x3d')]['findAll'](_0x264523);})[_0x150c('0x24')](function(_0x381557){_0x1d2102[_0x150c('0x3e')]=_0x381557;return _0x1d2102;})[_0x150c('0x24')](respondWithFilteredResult(_0x26a4cc,_0x264523))[_0x150c('0x3f')](handleError(_0x26a4cc,null));};exports[_0x150c('0x40')]=function(_0x47357e,_0x101a95){var _0x57204f={'raw':!![],'where':{'id':_0x47357e[_0x150c('0x41')]['id']}},_0x16365a={};_0x16365a[_0x150c('0x32')]=_[_0x150c('0x2f')](db[_0x150c('0x3d')]['rawAttributes']);_0x16365a[_0x150c('0x2e')]=_[_0x150c('0x2f')](_0x47357e['query']);_0x16365a[_0x150c('0x30')]=_['intersection'](_0x16365a['model'],_0x16365a[_0x150c('0x2e')]);_0x57204f[_0x150c('0x33')]=_[_0x150c('0x31')](_0x16365a[_0x150c('0x32')],qs['fields'](_0x47357e['query'][_0x150c('0x34')]));_0x57204f[_0x150c('0x33')]=_0x57204f['attributes'][_0x150c('0x35')]?_0x57204f['attributes']:_0x16365a[_0x150c('0x32')];if(_0x47357e[_0x150c('0x2e')][_0x150c('0x3c')]){_0x57204f[_0x150c('0x42')]=[{'all':!![]}];}_0x57204f=_[_0x150c('0x39')]({},_0x57204f,_0x47357e['options']);return db[_0x150c('0x3d')][_0x150c('0x43')](_0x57204f)[_0x150c('0x24')](handleEntityNotFound(_0x101a95,null))[_0x150c('0x24')](respondWithResult(_0x101a95,null))[_0x150c('0x3f')](handleError(_0x101a95,null));};exports[_0x150c('0x44')]=function(_0x6b6154,_0x5aa058){return db[_0x150c('0x3d')]['create'](_0x6b6154['body'],{})[_0x150c('0x24')](respondWithResult(_0x5aa058,0xc9))[_0x150c('0x3f')](handleError(_0x5aa058,null));};exports[_0x150c('0x23')]=function(_0x56288b,_0x3b7893){if(_0x56288b['body']['id']){delete _0x56288b[_0x150c('0x45')]['id'];}return db['SmsApplication'][_0x150c('0x43')]({'where':{'id':_0x56288b['params']['id']}})[_0x150c('0x24')](handleEntityNotFound(_0x3b7893,null))[_0x150c('0x24')](saveUpdates(_0x56288b['body'],null))[_0x150c('0x24')](respondWithResult(_0x3b7893,null))[_0x150c('0x3f')](handleError(_0x3b7893,null));};exports[_0x150c('0x25')]=function(_0x32c14a,_0x2db391){return db[_0x150c('0x3d')][_0x150c('0x43')]({'where':{'id':_0x32c14a[_0x150c('0x41')]['id']}})[_0x150c('0x24')](handleEntityNotFound(_0x2db391,null))[_0x150c('0x24')](removeEntity(_0x2db391,null))[_0x150c('0x3f')](handleError(_0x2db391,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index d982b7b..131c58a 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 _0xbdb0=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./smsApplication.attributes','define','SmsApplication','utf8mb4_unicode_ci','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbdb0,0x14f));var _0x0bdb=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xbdb0[_0x4c7fb5];return _0x2e10ac;};'use strict';var _=require(_0x0bdb('0x0'));var util=require('util');var logger=require(_0x0bdb('0x1'))(_0x0bdb('0x2'));var moment=require(_0x0bdb('0x3'));var BPromise=require(_0x0bdb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0bdb('0x5'));var rimraf=require(_0x0bdb('0x6'));var config=require(_0x0bdb('0x7'));var attributes=require(_0x0bdb('0x8'));module['exports']=function(_0x3e0020,_0x137892){return _0x3e0020[_0x0bdb('0x9')](_0x0bdb('0xa'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0bdb('0xb')});}; \ No newline at end of file +var _0x1195=['bluebird','path','rimraf','../../config/environment','./smsApplication.attributes','exports','utf8mb4','utf8mb4_unicode_ci'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1195,0x70));var _0x5119=function(_0x585b83,_0x25d403){_0x585b83=_0x585b83-0x0;var _0x2faa24=_0x1195[_0x585b83];return _0x2faa24;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x5119('0x0'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5119('0x1'));var rimraf=require(_0x5119('0x2'));var config=require(_0x5119('0x3'));var attributes=require(_0x5119('0x4'));module[_0x5119('0x5')]=function(_0x35045a,_0x1e9057){return _0x35045a['define']('SmsApplication',attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5119('0x6'),'collate':_0x5119('0x7')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 4317efc..ccc3973 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 _0x1db9=['../../config/utils','../../config/logger','jayson/promise','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x848500,_0x5409c4){var _0x3afd1a=function(_0x312f68){while(--_0x312f68){_0x848500['push'](_0x848500['shift']());}};_0x3afd1a(++_0x5409c4);}(_0x1db9,0x176));var _0x91db=function(_0x39f1a4,_0x26589a){_0x39f1a4=_0x39f1a4-0x0;var _0x5ce71e=_0x1db9[_0x39f1a4];return _0x5ce71e;};'use strict';var _=require(_0x91db('0x0'));var util=require(_0x91db('0x1'));var moment=require(_0x91db('0x2'));var BPromise=require(_0x91db('0x3'));var rs=require(_0x91db('0x4'));var fs=require('fs');var Redis=require(_0x91db('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x91db('0x6'));var logger=require(_0x91db('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x91db('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x433c75,_0x3b0c53,_0x45fea0){return new BPromise(function(_0x2330c2,_0x2d89a1){return client['request'](_0x433c75,_0x45fea0)[_0x91db('0x9')](function(_0x58cda2){logger[_0x91db('0xa')](_0x91db('0xb'),_0x3b0c53,_0x91db('0xc'));logger['debug'](_0x91db('0xd'),_0x3b0c53,'request\x20sent',JSON['stringify'](_0x58cda2));if(_0x58cda2['error']){if(_0x58cda2[_0x91db('0xe')][_0x91db('0xf')]===0x1f4){logger['error']('SmsApplication,\x20%s,\x20%s',_0x3b0c53,_0x58cda2[_0x91db('0xe')][_0x91db('0x10')]);return _0x2d89a1(_0x58cda2[_0x91db('0xe')][_0x91db('0x10')]);}logger[_0x91db('0xe')]('SmsApplication,\x20%s,\x20%s',_0x3b0c53,_0x58cda2[_0x91db('0xe')][_0x91db('0x10')]);return _0x2330c2(_0x58cda2[_0x91db('0xe')][_0x91db('0x10')]);}else{logger[_0x91db('0xa')](_0x91db('0xb'),_0x3b0c53,_0x91db('0xc'));_0x2330c2(_0x58cda2[_0x91db('0x11')][_0x91db('0x10')]);}})[_0x91db('0x12')](function(_0x1e9679){logger[_0x91db('0xe')]('SmsApplication,\x20%s,\x20%s',_0x3b0c53,_0x1e9679);_0x2d89a1(_0x1e9679);});});} \ No newline at end of file +var _0xa87e=['then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x5608d7,_0x2e74b6){var _0xd4aa72=function(_0x446c36){while(--_0x446c36){_0x5608d7['push'](_0x5608d7['shift']());}};_0xd4aa72(++_0x2e74b6);}(_0xa87e,0x1c2));var _0xea87=function(_0x2b84f7,_0x3eeb07){_0x2b84f7=_0x2b84f7-0x0;var _0x18f7f1=_0xa87e[_0x2b84f7];return _0x18f7f1;};'use strict';var _=require(_0xea87('0x0'));var util=require(_0xea87('0x1'));var moment=require(_0xea87('0x2'));var BPromise=require(_0xea87('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xea87('0x4'));var db=require(_0xea87('0x5'))['db'];var utils=require(_0xea87('0x6'));var logger=require('../../config/logger')(_0xea87('0x7'));var config=require(_0xea87('0x8'));var jayson=require(_0xea87('0x9'));var client=jayson[_0xea87('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa4b0bc,_0x329f85,_0x284019){return new BPromise(function(_0x415772,_0xe43a6a){return client[_0xea87('0xb')](_0xa4b0bc,_0x284019)[_0xea87('0xc')](function(_0x36d16c){logger[_0xea87('0xd')](_0xea87('0xe'),_0x329f85,_0xea87('0xf'));logger[_0xea87('0x10')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x329f85,_0xea87('0xf'),JSON[_0xea87('0x11')](_0x36d16c));if(_0x36d16c[_0xea87('0x12')]){if(_0x36d16c['error'][_0xea87('0x13')]===0x1f4){logger['error'](_0xea87('0xe'),_0x329f85,_0x36d16c[_0xea87('0x12')][_0xea87('0x14')]);return _0xe43a6a(_0x36d16c['error'][_0xea87('0x14')]);}logger[_0xea87('0x12')](_0xea87('0xe'),_0x329f85,_0x36d16c[_0xea87('0x12')][_0xea87('0x14')]);return _0x415772(_0x36d16c[_0xea87('0x12')][_0xea87('0x14')]);}else{logger['info'](_0xea87('0xe'),_0x329f85,'request\x20sent');_0x415772(_0x36d16c['result']['message']);}})['catch'](function(_0x27be9b){logger[_0xea87('0x12')](_0xea87('0xe'),_0x329f85,_0x27be9b);_0xe43a6a(_0x27be9b);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index c6bc6fb..f17d5a8 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 _0xd5f9=['delete','smsinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','/describe','isAuthenticated','/:id','show','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','sms','smsinteraction:update','update'];(function(_0xdaab62,_0x2728ab){var _0x13d767=function(_0x14bf14){while(--_0x14bf14){_0xdaab62['push'](_0xdaab62['shift']());}};_0x13d767(++_0x2728ab);}(_0xd5f9,0x1f1));var _0x9d5f=function(_0x36087c,_0x34daad){_0x36087c=_0x36087c-0x0;var _0x24563e=_0xd5f9[_0x36087c];return _0x24563e;};'use strict';var multer=require(_0x9d5f('0x0'));var util=require(_0x9d5f('0x1'));var path=require(_0x9d5f('0x2'));var timeout=require(_0x9d5f('0x3'));var express=require('express');var router=express[_0x9d5f('0x4')]();var auth=require(_0x9d5f('0x5'));var interaction=require(_0x9d5f('0x6'));var config=require(_0x9d5f('0x7'));var controller=require(_0x9d5f('0x8'));router[_0x9d5f('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x9d5f('0xa'),auth[_0x9d5f('0xb')](),controller['describe']);router[_0x9d5f('0x9')](_0x9d5f('0xc'),auth['isAuthenticated'](),controller[_0x9d5f('0xd')]);router[_0x9d5f('0x9')]('/:id/messages',auth[_0x9d5f('0xb')](),controller['getMessages']);router[_0x9d5f('0x9')](_0x9d5f('0xe'),auth[_0x9d5f('0xb')](),controller[_0x9d5f('0xf')]);router[_0x9d5f('0x10')]('/',auth['isAuthenticated'](),controller[_0x9d5f('0x11')]);router[_0x9d5f('0x10')](_0x9d5f('0x12'),auth[_0x9d5f('0xb')](),controller[_0x9d5f('0x13')]);router[_0x9d5f('0x10')](_0x9d5f('0x14'),auth[_0x9d5f('0xb')](),interaction[_0x9d5f('0x15')]('sms','smsinteraction:addtags'),controller['addTags']);router['put'](_0x9d5f('0xc'),auth[_0x9d5f('0xb')](),interaction['tracked'](_0x9d5f('0x16'),_0x9d5f('0x17')),controller[_0x9d5f('0x18')]);router[_0x9d5f('0x19')](_0x9d5f('0xc'),auth['isAuthenticated'](),interaction[_0x9d5f('0x15')](_0x9d5f('0x16'),_0x9d5f('0x1a')),controller[_0x9d5f('0x1b')]);router[_0x9d5f('0x19')](_0x9d5f('0x14'),auth[_0x9d5f('0xb')](),controller['removeTags']);module[_0x9d5f('0x1c')]=router; \ No newline at end of file +var _0x34bd=['exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','isAuthenticated','describe','get','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','sms','smsinteraction:addtags','addTags','update','delete','tracked','smsinteraction:destroy','destroy','removeTags'];(function(_0xfc6247,_0x5cbddb){var _0x291245=function(_0x41d7ba){while(--_0x41d7ba){_0xfc6247['push'](_0xfc6247['shift']());}};_0x291245(++_0x5cbddb);}(_0x34bd,0x1d2));var _0xd34b=function(_0x7025b0,_0x9533f1){_0x7025b0=_0x7025b0-0x0;var _0x6e444c=_0x34bd[_0x7025b0];return _0x6e444c;};'use strict';var multer=require(_0xd34b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd34b('0x1'));var express=require(_0xd34b('0x2'));var router=express[_0xd34b('0x3')]();var auth=require(_0xd34b('0x4'));var interaction=require(_0xd34b('0x5'));var config=require(_0xd34b('0x6'));var controller=require(_0xd34b('0x7'));router['get']('/',auth[_0xd34b('0x8')](),controller['index']);router['get']('/describe',auth[_0xd34b('0x8')](),controller[_0xd34b('0x9')]);router[_0xd34b('0xa')](_0xd34b('0xb'),auth[_0xd34b('0x8')](),controller[_0xd34b('0xc')]);router[_0xd34b('0xa')](_0xd34b('0xd'),auth[_0xd34b('0x8')](),controller[_0xd34b('0xe')]);router[_0xd34b('0xa')](_0xd34b('0xf'),auth['isAuthenticated'](),controller[_0xd34b('0x10')]);router['post']('/',auth[_0xd34b('0x8')](),controller[_0xd34b('0x11')]);router[_0xd34b('0x12')](_0xd34b('0xd'),auth[_0xd34b('0x8')](),controller[_0xd34b('0x13')]);router['post'](_0xd34b('0x14'),auth[_0xd34b('0x8')](),interaction['tracked'](_0xd34b('0x15'),_0xd34b('0x16')),controller[_0xd34b('0x17')]);router['put'](_0xd34b('0xb'),auth[_0xd34b('0x8')](),interaction['tracked'](_0xd34b('0x15'),'smsinteraction:update'),controller[_0xd34b('0x18')]);router[_0xd34b('0x19')](_0xd34b('0xb'),auth['isAuthenticated'](),interaction[_0xd34b('0x1a')](_0xd34b('0x15'),_0xd34b('0x1b')),controller[_0xd34b('0x1c')]);router[_0xd34b('0x19')]('/:id/tags',auth['isAuthenticated'](),controller[_0xd34b('0x1d')]);module[_0xd34b('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 5a3878e..76032db 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(_0x8af54b,_0x280be5){var _0x27d8f0=function(_0x559734){while(--_0x559734){_0x8af54b['push'](_0x8af54b['shift']());}};_0x27d8f0(++_0x280be5);}(_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 _0xbaf0=['DATE','STRING','ENUM','out','moment','exports','BOOLEAN'];(function(_0x269a18,_0x19ff44){var _0x490e13=function(_0x4fcd8d){while(--_0x4fcd8d){_0x269a18['push'](_0x269a18['shift']());}};_0x490e13(++_0x19ff44);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0baf('0x0'));module[_0x0baf('0x1')]={'closed':{'type':Sequelize[_0x0baf('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0baf('0x3')]},'disposition':{'type':Sequelize[_0x0baf('0x4')]},'note':{'type':Sequelize[_0x0baf('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x0baf('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x0baf('0x5')]('in',_0x0baf('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0baf('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x0baf('0x5')]('in',_0x0baf('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 320748f..36bce7a 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 _0xe2fe=['having','`\x20=\x200','`\x20>\x200','Contact','operator','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','UserId','body','text','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','group','Sequelize','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','a.key','Account.key','a.mandatoryDisposition','c.firstName','Contact.firstName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','SmsInteractionId','all','catch','show','include','merge','options','SmsInteraction','create','params','describe','addMessage','ids','omit','getMessages','findOne','nolimit','format','YYYY-MM-DD\x20HH:mm:ss','SmsMessage','includeAll','findAll','addTags','setTags','emit','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Messages','direction','secret','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','%s\x20#%d','Sms','YYYY-MM-DD','Account','Owner','N.A.','closed','closedAt','out','System','views','downloadInteraction.html','transcript-','log','err','html-pdf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','api','redis','defaults','localhost','socket.io-emitter','register','status','end','json','count','offset','set','Content-Range','reject','save','update','destroy','then','sendStatus','name','send','map','fullname','TagIds','forEach','push','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','limit','sort','where','filters','pick','field','color','tools_tags','select','u.id','u.fullname','ui.SmsInteractionId','from','sms_interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','it.SmsInteractionId\x20=\x20i.id','expr','sqlOperator','conditions','find','unreadMessages','value'];(function(_0x478b3d,_0x173852){var _0x3c402c=function(_0x3dd8c0){while(--_0x3dd8c0){_0x478b3d['push'](_0x478b3d['shift']());}};_0x3c402c(++_0x173852);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xee2f('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xee2f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xee2f('0x2'));var moment=require(_0xee2f('0x3'));var BPromise=require(_0xee2f('0x4'));var Mustache=require(_0xee2f('0x5'));var util=require(_0xee2f('0x6'));var path=require('path');var sox=require(_0xee2f('0x7'));var csv=require(_0xee2f('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xee2f('0x9'));var squel=require(_0xee2f('0xa'));var crypto=require('crypto');var jsforce=require(_0xee2f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xee2f('0x8'));var querystring=require(_0xee2f('0xc'));var Papa=require('papaparse');var Redis=require(_0xee2f('0xd'));var authService=require(_0xee2f('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xee2f('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xee2f('0x10')]=_[_0xee2f('0x11')](config[_0xee2f('0x10')],{'host':_0xee2f('0x12'),'port':0x18eb});var socket=require(_0xee2f('0x13'))(new Redis(config[_0xee2f('0x10')]));require('./smsInteraction.socket')[_0xee2f('0x14')](socket);function respondWithStatusCode(_0x531c3a,_0x36db10){_0x36db10=_0x36db10||0xcc;return function(_0x271c1d){if(_0x271c1d){return _0x531c3a['sendStatus'](_0x36db10);}return _0x531c3a[_0xee2f('0x15')](_0x36db10)[_0xee2f('0x16')]();};}function respondWithResult(_0x28b614,_0x1bbf7d){_0x1bbf7d=_0x1bbf7d||0xc8;return function(_0x390c2c){if(_0x390c2c){return _0x28b614['status'](_0x1bbf7d)[_0xee2f('0x17')](_0x390c2c);}};}function respondWithFilteredResult(_0x4afcd1,_0x17d288){return function(_0x3359ff){if(_0x3359ff){var _0x502eb6=_0x3359ff[_0xee2f('0x18')],_0x550da7=_0x17d288[_0xee2f('0x19')],_0x40b5bc=_0x17d288[_0xee2f('0x19')]+_0x17d288['limit'],_0x5a5078;if(_0x40b5bc>=_0x502eb6){_0x40b5bc=_0x502eb6;_0x5a5078=0xc8;}else{_0x5a5078=0xce;}_0x4afcd1[_0xee2f('0x15')](_0x5a5078);return _0x4afcd1[_0xee2f('0x1a')](_0xee2f('0x1b'),_0x550da7+'-'+_0x40b5bc+'/'+_0x502eb6)[_0xee2f('0x17')](_0x3359ff);}return null;};}function patchUpdates(_0x3d892d){return function(_0x5d36d4){try{jsonpatch['apply'](_0x5d36d4,_0x3d892d,!![]);}catch(_0x40d1fd){return BPromise[_0xee2f('0x1c')](_0x40d1fd);}return _0x5d36d4[_0xee2f('0x1d')]();};}function saveUpdates(_0x203b2f,_0x472e3b){return function(_0xf278cc){if(_0xf278cc){return _0xf278cc[_0xee2f('0x1e')](_0x203b2f)['then'](function(_0x250399){return _0x250399;});}return null;};}function removeEntity(_0x2c47c5,_0x15ceda){return function(_0x70e308){if(_0x70e308){return _0x70e308[_0xee2f('0x1f')]()[_0xee2f('0x20')](function(){_0x2c47c5[_0xee2f('0x15')](0xcc)[_0xee2f('0x16')]();});}};}function handleEntityNotFound(_0x382174,_0x1e394f){return function(_0x11edc8){if(!_0x11edc8){_0x382174[_0xee2f('0x21')](0x194);}return _0x11edc8;};}function handleError(_0x1c8454,_0x45c4a0){_0x45c4a0=_0x45c4a0||0x1f4;return function(_0x53f6ed){logger['error'](_0x53f6ed['stack']);if(_0x53f6ed[_0xee2f('0x22')]){delete _0x53f6ed[_0xee2f('0x22')];}_0x1c8454[_0xee2f('0x15')](_0x45c4a0)[_0xee2f('0x23')](_0x53f6ed);};}function getInteractionUsers(_0x892a4e,_0x3737fd){return new BPromise(function(_0x4d8398,_0x3d3806){try{if(_0x3737fd[_0x892a4e['id']]){_0x892a4e['Users']=_[_0xee2f('0x24')](_0x3737fd[_0x892a4e['id']],function(_0x180429){return{'id':_0x180429['id'],'fullname':_0x180429[_0xee2f('0x25')]};});}}catch(_0x8a0bf7){_0x3d3806(_0x8a0bf7);}_0x4d8398(_0x892a4e);});}function getInteractionTags(_0x3ddbe3,_0x47d5a6){return new BPromise(function(_0x310c0b,_0xd16e35){try{if(_0x3ddbe3['TagIds']){_0x3ddbe3['Tags']=[];_0x3ddbe3[_0xee2f('0x26')]['split'](',')[_0xee2f('0x27')](function(_0xc447e){_0x3ddbe3['Tags'][_0xee2f('0x28')](_0x47d5a6[_0xc447e]);});}delete _0x3ddbe3['TagIds'];}catch(_0x5ec1b0){_0xd16e35(_0x5ec1b0);}_0x310c0b(_0x3ddbe3);});}function updateSmsInteraction(_0x5b3ef0,_0x3f1fe8,_0x433d64){return new BPromise(function(_0x5c15bb,_0x39f224){return getInteractionUsers(_0x5b3ef0,_0x433d64)[_0xee2f('0x20')](function(_0xd64b7){return getInteractionTags(_0xd64b7,_0x3f1fe8);})[_0xee2f('0x20')](function(_0x1c3a01){_0x5c15bb(_0x1c3a01);})['catch'](function(_0x2c789d){_0x39f224(_0x2c789d);});});}exports['index']=function(_0x6fe685,_0x86cad4){var _0x3dcb9e={},_0x4a5047={},_0x169c75={'count':0x0,'rows':[]};var _0x5ed71e=_[_0xee2f('0x24')](db['SmsInteraction'][_0xee2f('0x29')],function(_0x13a824){return{'name':_0x13a824[_0xee2f('0x2a')],'type':_0x13a824[_0xee2f('0x2b')][_0xee2f('0x2c')]};});_0x4a5047[_0xee2f('0x2d')]=_[_0xee2f('0x24')](_0x5ed71e,_0xee2f('0x22'));_0x4a5047[_0xee2f('0x2e')]=_[_0xee2f('0x2f')](_0x6fe685[_0xee2f('0x2e')]);_0x4a5047['filters']=_[_0xee2f('0x30')](_0x4a5047['model'],_0x4a5047[_0xee2f('0x2e')]);_0x3dcb9e[_0xee2f('0x31')]=_[_0xee2f('0x30')](_0x4a5047[_0xee2f('0x2d')],qs[_0xee2f('0x32')](_0x6fe685[_0xee2f('0x2e')][_0xee2f('0x32')]));_0x3dcb9e[_0xee2f('0x31')]=_0x3dcb9e['attributes']['length']?_0x3dcb9e['attributes']:_0x4a5047[_0xee2f('0x2d')];if(!_0x6fe685['query'][_0xee2f('0x33')]('nolimit')){_0x3dcb9e['limit']=qs['limit'](_0x6fe685['query'][_0xee2f('0x34')]);_0x3dcb9e[_0xee2f('0x19')]=qs[_0xee2f('0x19')](_0x6fe685[_0xee2f('0x2e')]['offset']);}_0x3dcb9e['order']=qs[_0xee2f('0x35')](_0x6fe685['query']['sort']);_0x3dcb9e[_0xee2f('0x36')]=qs[_0xee2f('0x37')](_[_0xee2f('0x38')](_0x6fe685['query'],_0x4a5047[_0xee2f('0x37')]));var _0x27c447=[];var _0x19bd4d=squel['select']()['field']('id')[_0xee2f('0x39')](_0xee2f('0x22'))[_0xee2f('0x39')](_0xee2f('0x3a'))['from'](_0xee2f('0x3b'));var _0x1df63d=squel[_0xee2f('0x3c')]()[_0xee2f('0x39')](_0xee2f('0x3d'))[_0xee2f('0x39')](_0xee2f('0x3e'))[_0xee2f('0x39')](_0xee2f('0x3f'))[_0xee2f('0x40')]('user_has_sms_interactions','ui')['left_join']('users','u','u.id\x20=\x20ui.UserId');var _0x11aecb=squel[_0xee2f('0x3c')]()[_0xee2f('0x40')](_0xee2f('0x41'),'i')[_0xee2f('0x42')]('cm_contacts','c',_0xee2f('0x43'))[_0xee2f('0x42')](_0xee2f('0x44'),'o',_0xee2f('0x45'))['left_join']('sms_accounts','a','a.id\x20=\x20i.SmsAccountId')[_0xee2f('0x42')]('sms_messages','me','me.SmsInteractionId\x20=\x20i.id')['left_join']('sms_interaction_has_tags','it',_0xee2f('0x46'))[_0xee2f('0x42')](_0xee2f('0x3b'),'t','t.id\x20=\x20it.TagId');var _0x22506e=squel['expr']();var _0x3d95b8=[];var _0x35d738=squel[_0xee2f('0x47')]();var _0x2e804a;if(_0x6fe685[_0xee2f('0x2e')]['search']){_0x2e804a=as['parseSearch'](_0x6fe685[_0xee2f('0x2e')]['search']);var _0x2b6beb=_0x2e804a[_0xee2f('0x48')];for(var _0x1928f8=0x0;_0x1928f8<_0x2e804a[_0xee2f('0x49')]['length'];_0x1928f8++){var _0x5df503=_0x2e804a[_0xee2f('0x49')][_0x1928f8];var _0xf4aa97='i';var _0x1b00a8=_[_0xee2f('0x4a')](_0x5ed71e,[_0xee2f('0x22'),_0x5df503[_0xee2f('0x39')]]);if(!_0x1b00a8){switch(_0x5df503[_0xee2f('0x39')]){case _0xee2f('0x4b'):if(_0x5df503[_0xee2f('0x4c')]==0x1){_0x11aecb[_0xee2f('0x4d')]('`'+_0x5df503[_0xee2f('0x39')]+_0xee2f('0x4e'));}else{_0x11aecb['having']('`'+_0x5df503[_0xee2f('0x39')]+_0xee2f('0x4f'));}break;case _0xee2f('0x50'):if(_0x5df503[_0xee2f('0x51')]==='$substring'){if(_0x5df503[_0xee2f('0x4c')][_0xee2f('0x52')]('\x20')[_0xee2f('0x53')]>0x1){_0x22506e[_0x2b6beb](_0xee2f('0x54'),qs[_0xee2f('0x55')](_0x5df503['value']),null);}else{var _0x8b135b='%'+_0x5df503['value']+'%';_0x22506e[_0x2b6beb]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x8b135b,_0x8b135b,_0x8b135b);}}else{_0x1b00a8=_[_0xee2f('0x4a')](_0x5ed71e,[_0xee2f('0x22'),_0xee2f('0x56')]);_0x5df503[_0xee2f('0x39')]=_0xee2f('0x56');_0x58e464=as[_0xee2f('0x57')](_0xf4aa97,_0x1b00a8[_0xee2f('0x2b')],_0x5df503);_0x22506e[_0x2b6beb](_0x58e464['text'],_0x58e464[_0xee2f('0x4c')][_0xee2f('0x58')],_0x58e464[_0xee2f('0x4c')][_0xee2f('0x16')]);}break;case _0xee2f('0x59'):var _0x3e1184=_0x5df503[_0xee2f('0x4c')][_0xee2f('0x52')](',')[_0xee2f('0x24')](function(_0x5d6c40){return Number(_0x5d6c40);});_0x3e1184[_0xee2f('0x27')](function(_0x4b9d29){_0x35d738['or'](_0xee2f('0x5a'),'%,'+_0x4b9d29+',%');});_0x3d95b8=_[_0xee2f('0x5b')](_0x3d95b8,_0x3e1184);break;case _0xee2f('0x5c'):if(_0x5df503[_0xee2f('0x51')]===_0xee2f('0x5d')){_0x22506e[_0x2b6beb]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x5df503[_0xee2f('0x4c')]+'%',null);}else{_0x1b00a8=_[_0xee2f('0x4a')](_0x5ed71e,[_0xee2f('0x22'),_0xee2f('0x5e')]);_0x5df503['field']='UserId';_0x58e464=as['buildExpression'](_0xf4aa97,_0x1b00a8['type'],_0x5df503);_0x22506e[_0x2b6beb](_0x58e464['text'],_0x58e464[_0xee2f('0x4c')]['start'],_0x58e464[_0xee2f('0x4c')][_0xee2f('0x16')]);}break;case _0xee2f('0x5f'):_0x58e464=as[_0xee2f('0x57')]('me',null,_0x5df503);_0x22506e[_0x2b6beb](_0x58e464[_0xee2f('0x60')],_0x58e464[_0xee2f('0x4c')]['start'],_0x58e464['value'][_0xee2f('0x16')]);break;}}else{var _0x58e464=as[_0xee2f('0x57')](_0xf4aa97,_0x1b00a8['type'],_0x5df503);_0x22506e[_0x2b6beb](_0x58e464[_0xee2f('0x60')],_0x58e464['value'][_0xee2f('0x58')],_0x58e464[_0xee2f('0x4c')][_0xee2f('0x16')]);}}}else{var _0x5655f4=_(_0x6fe685[_0xee2f('0x2e')])[_0xee2f('0x2f')]()[_0xee2f('0x24')](function(_0x90923f){return _[_0xee2f('0x61')](_0x5ed71e,[_0xee2f('0x22'),_0x90923f])?_0x90923f:undefined;})[_0xee2f('0x62')]()['value']();if(!_[_0xee2f('0x63')](_0x5655f4)){_0x5655f4[_0xee2f('0x27')](function(_0xcf14c7){if(_0xcf14c7===_0xee2f('0x64')){_0x11aecb[_0xee2f('0x36')](_0xee2f('0x65'),[][_0xee2f('0x66')](_0x6fe685[_0xee2f('0x2e')][_0xcf14c7]));}else if(_0xcf14c7===_0xee2f('0x67')){var _0x35200d=JSON[_0xee2f('0x68')](_0x6fe685['query'][_0xcf14c7])[_0xee2f('0x69')];var _0xf15bc1=JSON['parse'](_0x6fe685[_0xee2f('0x2e')][_0xcf14c7])['$lte'];_0x11aecb[_0xee2f('0x36')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x35200d,_0xf15bc1);}else{if(_0x6fe685['query'][_0xcf14c7]===_0xee2f('0x6a')){_0x11aecb[_0xee2f('0x36')]('i.'+_0xcf14c7+_0xee2f('0x6b'));}else{_0x11aecb[_0xee2f('0x36')]('i.'+_0xcf14c7+_0xee2f('0x6c'),_0x6fe685['query'][_0xcf14c7]);}}});}if(_0x6fe685[_0xee2f('0x2e')][_0xee2f('0x6d')]){if(_0x6fe685[_0xee2f('0x2e')]['read']==0x1){_0x11aecb[_0xee2f('0x4d')](_0xee2f('0x6e'));}else{_0x11aecb['having'](_0xee2f('0x6f'));}}if(_0x6fe685[_0xee2f('0x2e')][_0xee2f('0x70')]){_0x3d95b8=_[_0xee2f('0x71')](_0x6fe685[_0xee2f('0x2e')][_0xee2f('0x70')])?_0x6fe685[_0xee2f('0x2e')][_0xee2f('0x70')]:new Array(_0x6fe685[_0xee2f('0x2e')]['tag']);_0x3d95b8['forEach'](function(_0x58d16e){_0x35d738['or'](_0xee2f('0x5a'),'%,'+_0x58d16e+',%');});}if(_0x6fe685[_0xee2f('0x2e')][_0xee2f('0x72')]){var _0x7ab1db=_0x6fe685[_0xee2f('0x2e')]['filter'][_0xee2f('0x73')]('\x5c','\x5c\x5c')[_0xee2f('0x73')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0xee2f('0x74')](_0x7ab1db)){_0x22506e['or'](_0xee2f('0x75'),_0x7ab1db+'%')['or'](_0xee2f('0x76'),_0x7ab1db+'%');}else{_0x22506e['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xee2f('0x55')](_0x7ab1db))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x7ab1db+'%');}}}_0x11aecb[_0xee2f('0x36')](_0x22506e);_0x11aecb[_0xee2f('0x77')]('i.id');var _0x179774={'type':db[_0xee2f('0x78')]['QueryTypes']['SELECT'],'raw':!![]};var _0x48f0ff=_0x11aecb[_0xee2f('0x79')]();_0x48f0ff['field']('i.id');_0x48f0ff[_0xee2f('0x39')](_0xee2f('0x7a'),'unreadMessages');if(_0x3dcb9e[_0xee2f('0x7b')]){_0x3dcb9e['order'][_0xee2f('0x27')](function(_0x10d5f2){_0x11aecb[_0xee2f('0x7b')]('i.'+_0x10d5f2[0x0],_0x10d5f2[0x1]===_0xee2f('0x7c')?![]:!![]);});}if(!_[_0xee2f('0x63')](_0x3d95b8)){_0x11aecb[_0xee2f('0x4d')](_0x35d738);_0x48f0ff[_0xee2f('0x36')]('t.id\x20IN\x20?',_0x3d95b8);}BPromise[_0xee2f('0x7d')]()[_0xee2f('0x20')](function(){if(!_0x2e804a){if(_0x6fe685[_0xee2f('0x2e')][_0xee2f('0x64')]||_0x6fe685[_0xee2f('0x2e')]['journey'])return;_0x48f0ff[_0xee2f('0x36')](_0xee2f('0x7e'));_0x11aecb[_0xee2f('0x36')](_0xee2f('0x7e'));return;}return _0x6fe685[_0xee2f('0x7f')][_0xee2f('0x80')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4c2975){if(_[_0xee2f('0x63')](_0x4c2975)){_0x48f0ff[_0xee2f('0x36')](_0xee2f('0x81'));_0x11aecb[_0xee2f('0x36')](_0xee2f('0x81'));}else{_0x48f0ff[_0xee2f('0x36')](_0xee2f('0x65'),_['map'](_0x4c2975,'id'));_0x11aecb['where'](_0xee2f('0x65'),_[_0xee2f('0x24')](_0x4c2975,'id'));}});})[_0xee2f('0x20')](function(){db[_0xee2f('0x82')][_0xee2f('0x2e')](_0x48f0ff[_0xee2f('0x83')](),_0x179774)[_0xee2f('0x20')](function(_0x1908c1){_0x169c75[_0xee2f('0x18')]=_0x1908c1[_0xee2f('0x53')];if(_0x169c75[_0xee2f('0x18')]===0x0)return[];return db[_0xee2f('0x82')]['query'](_0x19bd4d['toString'](),_0x179774)[_0xee2f('0x20')](function(_0x5bd7c8){_0x27c447=_['keyBy'](_0x5bd7c8,'id');_0x179774=_['merge'](_0x179774,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x6fe685[_0xee2f('0x2e')][_0xee2f('0x32')]){_0x3dcb9e['attributes']['forEach'](function(_0x9c89a3){_0x11aecb[_0xee2f('0x39')]('i.'+_0x9c89a3);});}else{_0x11aecb[_0xee2f('0x39')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x11aecb[_0xee2f('0x39')](_0xee2f('0x84'),_0xee2f('0x85'));_0x11aecb['field'](_0xee2f('0x86'),'Account.mandatoryDisposition');_0x11aecb[_0xee2f('0x39')]('i.*');_0x11aecb[_0xee2f('0x39')](_0xee2f('0x87'),_0xee2f('0x88'));_0x11aecb['field']('c.lastName',_0xee2f('0x89'));_0x11aecb[_0xee2f('0x39')](_0xee2f('0x8a'),'Contact.email');_0x11aecb[_0xee2f('0x39')](_0xee2f('0x8b'),_0xee2f('0x8c'));_0x11aecb[_0xee2f('0x39')](_0xee2f('0x8d'),_0xee2f('0x8e'));_0x11aecb[_0xee2f('0x39')](_0xee2f('0x8f'),_0xee2f('0x90'));_0x11aecb[_0xee2f('0x39')](_0xee2f('0x91'),_0xee2f('0x92'));_0x11aecb[_0xee2f('0x39')](_0xee2f('0x93'),'Owner.internal');_0x11aecb[_0xee2f('0x39')](_0xee2f('0x94'),_0xee2f('0x26'));}_0x11aecb[_0xee2f('0x34')](_0x3dcb9e[_0xee2f('0x34')]);_0x11aecb[_0xee2f('0x19')](_0x3dcb9e[_0xee2f('0x19')]);return db[_0xee2f('0x82')][_0xee2f('0x2e')](_0x11aecb[_0xee2f('0x83')](),_0x179774);})[_0xee2f('0x20')](function(_0x49c92f){_0x1df63d[_0xee2f('0x36')](_0xee2f('0x95'),_[_0xee2f('0x24')](_0x49c92f,'id'));return db[_0xee2f('0x82')]['query'](_0x1df63d[_0xee2f('0x83')](),_0x179774)[_0xee2f('0x20')](function(_0x1e67ea){var _0x5d0aae=_['groupBy'](_0x1e67ea,_0xee2f('0x96'));var _0x48fe47=[];_0x49c92f['forEach'](function(_0x4fe6f2){_0x48fe47[_0xee2f('0x28')](updateSmsInteraction(_0x4fe6f2,_0x27c447,_0x5d0aae));});return BPromise[_0xee2f('0x97')](_0x48fe47);});});})[_0xee2f('0x20')](function(_0x172cee){_0x169c75['rows']=_0x172cee;return _0x169c75;})[_0xee2f('0x20')](respondWithFilteredResult(_0x86cad4,_0x3dcb9e));})[_0xee2f('0x98')](handleError(_0x86cad4,null));};exports[_0xee2f('0x99')]=function(_0x4bc0d8,_0x20e5db){var _0x481e16={'raw':![],'where':{'id':_0x4bc0d8['params']['id']}},_0x150445={};_0x150445['model']=_[_0xee2f('0x2f')](db['SmsInteraction'][_0xee2f('0x29')]);_0x150445['query']=_['keys'](_0x4bc0d8[_0xee2f('0x2e')]);_0x150445[_0xee2f('0x37')]=_['intersection'](_0x150445[_0xee2f('0x2d')],_0x150445[_0xee2f('0x2e')]);_0x481e16['attributes']=_['intersection'](_0x150445[_0xee2f('0x2d')],qs[_0xee2f('0x32')](_0x4bc0d8['query'][_0xee2f('0x32')]));_0x481e16[_0xee2f('0x31')]=_0x481e16[_0xee2f('0x31')][_0xee2f('0x53')]?_0x481e16[_0xee2f('0x31')]:_0x150445['model'];if(_0x4bc0d8['query']['includeAll']){_0x481e16[_0xee2f('0x9a')]=[{'all':!![]}];}_0x481e16=_[_0xee2f('0x9b')]({},_0x481e16,_0x4bc0d8[_0xee2f('0x9c')]);return db[_0xee2f('0x9d')][_0xee2f('0x4a')](_0x481e16)[_0xee2f('0x20')](handleEntityNotFound(_0x20e5db,null))[_0xee2f('0x20')](respondWithResult(_0x20e5db,null))[_0xee2f('0x98')](handleError(_0x20e5db,null));};exports[_0xee2f('0x9e')]=function(_0x173f5f,_0x230ee7){return db[_0xee2f('0x9d')][_0xee2f('0x9e')](_0x173f5f[_0xee2f('0x5f')],{})[_0xee2f('0x20')](respondWithResult(_0x230ee7,0xc9))[_0xee2f('0x98')](handleError(_0x230ee7,null));};exports['update']=function(_0x59569c,_0x1c9bc4){if(_0x59569c[_0xee2f('0x5f')]['id']){delete _0x59569c['body']['id'];}return db[_0xee2f('0x9d')][_0xee2f('0x4a')]({'where':{'id':_0x59569c[_0xee2f('0x9f')]['id']}})['then'](handleEntityNotFound(_0x1c9bc4,null))[_0xee2f('0x20')](saveUpdates(_0x59569c[_0xee2f('0x5f')],null))[_0xee2f('0x20')](respondWithResult(_0x1c9bc4,null))[_0xee2f('0x98')](handleError(_0x1c9bc4,null));};exports[_0xee2f('0x1f')]=function(_0x34bd13,_0x25d36b){return db[_0xee2f('0x9d')][_0xee2f('0x4a')]({'where':{'id':_0x34bd13['params']['id']}})[_0xee2f('0x20')](handleEntityNotFound(_0x25d36b,null))[_0xee2f('0x20')](removeEntity(_0x25d36b,null))[_0xee2f('0x98')](handleError(_0x25d36b,null));};exports[_0xee2f('0xa0')]=function(_0xe7e196,_0x32469d){return db[_0xee2f('0x9d')][_0xee2f('0xa0')]()['then'](respondWithResult(_0x32469d,null))[_0xee2f('0x98')](handleError(_0x32469d,null));};exports[_0xee2f('0xa1')]=function(_0x5696fc,_0xf40a38,_0x51b50d){return db['SmsMessage'][_0xee2f('0x4a')]({'where':{'id':_0x5696fc[_0xee2f('0x9f')]['id']}})[_0xee2f('0x20')](handleEntityNotFound(_0xf40a38,null))[_0xee2f('0x20')](function(_0x374d4f){if(_0x374d4f){return _0x374d4f[_0xee2f('0xa1')](_0x5696fc['body'][_0xee2f('0xa2')],_[_0xee2f('0xa3')](_0x5696fc['body'],[_0xee2f('0xa2'),'id'])||{});}})[_0xee2f('0x20')](respondWithResult(_0xf40a38,null))['catch'](handleError(_0xf40a38,null));};exports[_0xee2f('0xa4')]=function(_0x26dd6c,_0x2578f1,_0x338974){var _0x1bc9d5={'raw':![],'where':{}};var _0x1fb82b={};var _0x426e1f={'count':0x0,'rows':[]};return db[_0xee2f('0x9d')][_0xee2f('0xa5')]({'where':{'id':_0x26dd6c[_0xee2f('0x9f')]['id']}})[_0xee2f('0x20')](handleEntityNotFound(_0x2578f1,null))[_0xee2f('0x20')](function(_0x59224f){if(_0x59224f){_0x1fb82b[_0xee2f('0x2d')]=_['keys'](db['SmsMessage']['rawAttributes']);_0x1fb82b[_0xee2f('0x2e')]=_['keys'](_0x26dd6c[_0xee2f('0x2e')]);_0x1fb82b[_0xee2f('0x37')]=_[_0xee2f('0x30')](_0x1fb82b['model'],_0x1fb82b[_0xee2f('0x2e')]);_0x1bc9d5[_0xee2f('0x31')]=_['intersection'](_0x1fb82b[_0xee2f('0x2d')],qs[_0xee2f('0x32')](_0x26dd6c[_0xee2f('0x2e')][_0xee2f('0x32')]));_0x1bc9d5[_0xee2f('0x31')]=_0x1bc9d5[_0xee2f('0x31')][_0xee2f('0x53')]?_0x1bc9d5['attributes']:_0x1fb82b[_0xee2f('0x2d')];if(!_0x26dd6c[_0xee2f('0x2e')]['hasOwnProperty'](_0xee2f('0xa6'))){_0x1bc9d5[_0xee2f('0x34')]=qs[_0xee2f('0x34')](_0x26dd6c['query'][_0xee2f('0x34')]);_0x1bc9d5[_0xee2f('0x19')]=qs[_0xee2f('0x19')](_0x26dd6c[_0xee2f('0x2e')][_0xee2f('0x19')]);}_0x1bc9d5[_0xee2f('0x7b')]=qs['sort'](_0x26dd6c[_0xee2f('0x2e')][_0xee2f('0x35')]);_0x1bc9d5[_0xee2f('0x36')]=qs['filters'](_['pick'](_0x26dd6c[_0xee2f('0x2e')],_0x1fb82b['filters']));_0x1bc9d5[_0xee2f('0x36')][_0xee2f('0x96')]=_0x59224f['id'];if(_0x26dd6c['query'][_0xee2f('0x72')]){_0x1bc9d5[_0xee2f('0x36')]=_['merge'](_0x1bc9d5['where'],{'$or':_[_0xee2f('0x24')](_0x1bc9d5[_0xee2f('0x31')],function(_0x551cc3){var _0x1c9f70={};_0x1c9f70[_0x551cc3]={'$like':'%'+_0x26dd6c[_0xee2f('0x2e')][_0xee2f('0x72')]+'%'};return _0x1c9f70;})});}if(_0x26dd6c[_0xee2f('0x2e')]['$gte']){var _0x27475a=_0x26dd6c[_0xee2f('0x2e')][_0xee2f('0x69')]['split'](',');var _0x2aa5a5={};_0x2aa5a5[_0x27475a[0x0]]={'$gte':moment(_0x27475a[0x1])[_0xee2f('0xa7')](_0xee2f('0xa8'))};_0x1bc9d5[_0xee2f('0x36')]=_['merge'](_0x1bc9d5['where'],_0x2aa5a5);}_0x1bc9d5=_[_0xee2f('0x9b')]({},_0x1bc9d5,_0x26dd6c[_0xee2f('0x9c')]);return db[_0xee2f('0xa9')]['count']({'where':_0x1bc9d5[_0xee2f('0x36')]})[_0xee2f('0x20')](function(_0x50e8a2){_0x426e1f[_0xee2f('0x18')]=_0x50e8a2;if(_0x26dd6c[_0xee2f('0x2e')][_0xee2f('0xaa')]){_0x1bc9d5[_0xee2f('0x9a')]=[{'all':!![]}];}return db[_0xee2f('0xa9')][_0xee2f('0xab')](_0x1bc9d5);})[_0xee2f('0x20')](function(_0x236b63){_0x426e1f['rows']=_0x236b63;return _0x426e1f;});}})[_0xee2f('0x20')](respondWithFilteredResult(_0x2578f1,_0x1bc9d5))[_0xee2f('0x98')](handleError(_0x2578f1,null));};exports[_0xee2f('0xac')]=function(_0x54708b,_0x423ab9,_0x3b95c4){return db[_0xee2f('0x9d')][_0xee2f('0x4a')]({'where':{'id':_0x54708b[_0xee2f('0x9f')]['id']}})[_0xee2f('0x20')](handleEntityNotFound(_0x423ab9,null))[_0xee2f('0x20')](function(_0x3a71fa){if(_0x3a71fa){return _0x3a71fa[_0xee2f('0xad')](_0x54708b[_0xee2f('0x5f')][_0xee2f('0xa2')],_[_0xee2f('0xa3')](_0x54708b['body'],[_0xee2f('0xa2'),'id'])||{})['spread'](function(){return db[_0xee2f('0x59')][_0xee2f('0xab')]({'attributes':['id','name',_0xee2f('0x3a')],'where':{'id':_0x54708b[_0xee2f('0x5f')][_0xee2f('0xa2')]}});})[_0xee2f('0x20')](function(_0x1813f2){socket[_0xee2f('0xae')]('smsInteractionTags:save',{'id':Number(_0x54708b[_0xee2f('0x9f')]['id']),'tags':_0x1813f2||[]});return{'id':Number(_0x54708b[_0xee2f('0x9f')]['id']),'tags':_0x1813f2||[]};});}})[_0xee2f('0x20')](respondWithResult(_0x423ab9,null))[_0xee2f('0x98')](handleError(_0x423ab9,null));};exports[_0xee2f('0xaf')]=function(_0x31b0f7,_0xe86d94,_0xf515ca){return db[_0xee2f('0x9d')][_0xee2f('0x4a')]({'where':{'id':_0x31b0f7['params']['id']}})[_0xee2f('0x20')](handleEntityNotFound(_0xe86d94,null))[_0xee2f('0x20')](function(_0x37ebf7){if(_0x37ebf7){return _0x37ebf7['removeTags'](_0x31b0f7['query'][_0xee2f('0xa2')]);}})[_0xee2f('0x20')](respondWithStatusCode(_0xe86d94,null))[_0xee2f('0x98')](handleError(_0xe86d94,null));};exports[_0xee2f('0xb0')]=function(_0x24a2f1,_0x4a91ca){var _0x1cee16=moment()[_0xee2f('0xb1')]()['toString']();var _0x15e686=path[_0xee2f('0xb2')](config[_0xee2f('0xb3')],_0xee2f('0xb4'),_0xee2f('0xb5'),_0xee2f('0xb6'));var _0x542435=path[_0xee2f('0xb2')](config[_0xee2f('0xb3')],_0xee2f('0xb4'),_0xee2f('0xb5'),_0xee2f('0xb7'));var _0x2b899a=path[_0xee2f('0xb2')](_0x15e686,_0x1cee16);var _0x2bd952=util[_0xee2f('0xa7')](_0xee2f('0xb8'),_0x24a2f1[_0xee2f('0x9f')]['id'],_0x1cee16);var _0x5010eb=path[_0xee2f('0xb2')](_0x15e686,_0x2bd952);var _0x467078=[];_0x467078[_0xee2f('0x28')]({'model':db[_0xee2f('0x5c')],'as':_0xee2f('0x5c'),'attributes':['id',_0xee2f('0x25')],'raw':!![]});_0x467078['push']({'model':db[_0xee2f('0xb9')],'as':_0xee2f('0x50'),'attributes':['id',_0xee2f('0xba'),_0xee2f('0xbb')],'raw':!![]});var _0x4f5554=[{'model':db[_0xee2f('0xa9')],'as':_0xee2f('0xbc'),'attributes':['id',_0xee2f('0x5f'),_0xee2f('0x67'),_0xee2f('0xbd'),_0xee2f('0xbe'),_0xee2f('0x6d')],'include':_0x467078}];_0x4f5554[_0xee2f('0x28')]({'model':db['SmsAccount'],'as':'Account','attributes':['id',_0xee2f('0x22')]});_0x4f5554[_0xee2f('0x28')]({'model':db[_0xee2f('0x5c')],'as':'Owner','attributes':['id',_0xee2f('0x25')]});return db['SmsInteraction'][_0xee2f('0x4a')]({'where':{'id':_0x24a2f1['params']['id']},'include':_0x4f5554})[_0xee2f('0x20')](handleEntityNotFound(_0x4a91ca,null))[_0xee2f('0x20')](function(_0x48ce0c){if(_0x48ce0c){var _0x173a4a=_0x48ce0c['get']({'plain':!![]});fs[_0xee2f('0xbf')](_0x2b899a);var _0x5e1e96={'format':'A4','border':_0xee2f('0xc0'),'header':{'height':_0xee2f('0xc1'),'contents':{'first':_0xee2f('0xc2')}},'footer':{'height':_0xee2f('0xc3'),'contents':{'default':util[_0xee2f('0xa7')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\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[_0xee2f('0xa7')](_0xee2f('0xc4'),_0xee2f('0xc5'),_0x173a4a['id']),moment()[_0xee2f('0xa7')](_0xee2f('0xc6'))[_0xee2f('0x83')]())}}};var _0x55f1bd={'channel':_0xee2f('0xc5'),'account':_0x173a4a[_0xee2f('0xc7')][_0xee2f('0x22')],'agent':_0x173a4a['Owner']?_0x173a4a[_0xee2f('0xc8')][_0xee2f('0x25')]:_0xee2f('0xc9'),'createdAt':moment(_0x173a4a[_0xee2f('0x67')])[_0xee2f('0xa7')](_0xee2f('0xa8'))[_0xee2f('0x83')](),'closedAt':_0x173a4a[_0xee2f('0xca')]?moment(_0x173a4a[_0xee2f('0xcb')])[_0xee2f('0xa7')](_0xee2f('0xa8'))[_0xee2f('0x83')]():'','disposition':_0x173a4a['disposition'],'messages':_(_0x173a4a[_0xee2f('0xbc')])['filter']({'secret':![]})[_0xee2f('0x24')](function(_0xb2b9c6){return{'date':moment(_0xb2b9c6['createdAt'])[_0xee2f('0xa7')]('YYYY-MM-DD\x20HH:mm:ss')[_0xee2f('0x83')](),'sender':_0xb2b9c6[_0xee2f('0xbd')]===_0xee2f('0xcc')?_0xb2b9c6[_0xee2f('0x5c')]?_0xb2b9c6['User'][_0xee2f('0x25')]:_0xee2f('0xcd'):_0xb2b9c6[_0xee2f('0x50')][_0xee2f('0xba')]+(_0xb2b9c6[_0xee2f('0x50')][_0xee2f('0xbb')]?'\x20'+_0xb2b9c6['Contact'][_0xee2f('0xbb')]:''),'body':_0xb2b9c6['body'],'direction':_0xb2b9c6[_0xee2f('0xbd')]===_0xee2f('0xcc')?'A':'C','secret':_0xb2b9c6['secret'],'read':_0xb2b9c6[_0xee2f('0x6d')]};})[_0xee2f('0x4c')]()};return ejs['renderFile'](path['join'](config[_0xee2f('0xb3')],_0xee2f('0xb4'),_0xee2f('0xce'),_0xee2f('0xcf')),{'interaction':_0x55f1bd})[_0xee2f('0x20')](function(_0x33182c){return new BPromise(function(_0x50b1a0,_0x2c09b6){pdf['create'](_0x33182c,_0x5e1e96)['toFile'](path['join'](_0x2b899a,_0xee2f('0xd0')+_0x173a4a['id']+'-'+_0x1cee16+'.pdf'),function(_0x1ec84b,_0xb2074f){if(_0x1ec84b)return _0x2c09b6(_0x1ec84b);_0x50b1a0(_0xb2074f);});});})['then'](function(){return new BPromise(function(_0x135a8d,_0x4971c0){zipdir(_0x2b899a,{'saveTo':_0x5010eb},function(_0x1c2faa,_0x3ad2a2){if(_0x1c2faa)return _0x4971c0(_0x1c2faa);return _0x135a8d(_0x3ad2a2);});})[_0xee2f('0x20')](function(){return new BPromise(function(_0x4d2448,_0x30e7bc){rimraf(_0x2b899a,function(_0xf5c9bd){if(_0xf5c9bd)_0x30e7bc(_0xf5c9bd);return _0x4d2448();});});})[_0xee2f('0x20')](function(){return _0x4a91ca[_0xee2f('0xb0')](_0x5010eb,_0x2bd952,function(_0x4753e2){if(_0x4753e2){console[_0xee2f('0xd1')](_0xee2f('0xd2'),_0x4753e2);}else{fs['unlinkSync'](_0x5010eb);}});});});}else{return _0x4a91ca[_0xee2f('0x21')](0xc8);}})[_0xee2f('0x98')](handleError(_0x4a91ca,null));}; \ No newline at end of file +var _0x6a95=['request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','status','end','count','offset','limit','set','Content-Range','apply','reject','update','destroy','error','stack','name','TagIds','Tags','split','forEach','push','then','index','map','SmsInteraction','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','field','color','from','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','cm_contacts','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','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','isEmpty','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','isNumeric','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','SmsAccountId','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','sequelize','toString','keyBy','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','show','params','merge','options','catch','create','describe','addMessage','SmsMessage','omit','ids','getMessages','findOne','YYYY-MM-DD\x20HH:mm:ss','includeAll','include','findAll','addTags','removeTags','download','unix','join','files','tmp','root','server','format','transcript-%d-%s.zip','fullname','firstName','lastName','Messages','direction','secret','SmsAccount','Owner','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Account','N.A.','closed','closedAt','disposition','out','System','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','err','unlinkSync','sendStatus','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x4653f7,_0x3d3ae3){var _0x5454da=function(_0x448f55){while(--_0x448f55){_0x4653f7['push'](_0x4653f7['shift']());}};_0x5454da(++_0x3d3ae3);}(_0x6a95,0x1db));var _0x56a9=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x6a95[_0x6c993a];return _0x27f547;};'use strict';var pdf=require(_0x56a9('0x0'));var emlformat=require(_0x56a9('0x1'));var rimraf=require(_0x56a9('0x2'));var zipdir=require(_0x56a9('0x3'));var jsonpatch=require(_0x56a9('0x4'));var rp=require(_0x56a9('0x5'));var moment=require(_0x56a9('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x56a9('0x7'));var path=require(_0x56a9('0x8'));var sox=require(_0x56a9('0x9'));var csv=require(_0x56a9('0xa'));var ejs=require(_0x56a9('0xb'));var fs=require('fs');var _=require(_0x56a9('0xc'));var squel=require(_0x56a9('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x56a9('0xe'));var toCsv=require(_0x56a9('0xa'));var querystring=require('querystring');var Papa=require(_0x56a9('0xf'));var Redis=require(_0x56a9('0x10'));var authService=require(_0x56a9('0x11'));var qs=require(_0x56a9('0x12'));var as=require(_0x56a9('0x13'));var hardwareService=require(_0x56a9('0x14'));var logger=require(_0x56a9('0x15'))(_0x56a9('0x16'));var utils=require(_0x56a9('0x17'));var config=require('../../config/environment');var db=require(_0x56a9('0x18'))['db'];config['redis']=_[_0x56a9('0x19')](config[_0x56a9('0x1a')],{'host':_0x56a9('0x1b'),'port':0x18eb});var socket=require(_0x56a9('0x1c'))(new Redis(config[_0x56a9('0x1a')]));require(_0x56a9('0x1d'))[_0x56a9('0x1e')](socket);function respondWithStatusCode(_0x1a2eb4,_0x40b2cb){_0x40b2cb=_0x40b2cb||0xcc;return function(_0x561bec){if(_0x561bec){return _0x1a2eb4['sendStatus'](_0x40b2cb);}return _0x1a2eb4[_0x56a9('0x1f')](_0x40b2cb)[_0x56a9('0x20')]();};}function respondWithResult(_0x42007b,_0x46f854){_0x46f854=_0x46f854||0xc8;return function(_0x5b2637){if(_0x5b2637){return _0x42007b[_0x56a9('0x1f')](_0x46f854)['json'](_0x5b2637);}};}function respondWithFilteredResult(_0x5e5218,_0x4e292f){return function(_0x312e58){if(_0x312e58){var _0x576bdf=_0x312e58[_0x56a9('0x21')],_0x59c0ec=_0x4e292f[_0x56a9('0x22')],_0x105fe5=_0x4e292f[_0x56a9('0x22')]+_0x4e292f[_0x56a9('0x23')],_0x459a87;if(_0x105fe5>=_0x576bdf){_0x105fe5=_0x576bdf;_0x459a87=0xc8;}else{_0x459a87=0xce;}_0x5e5218[_0x56a9('0x1f')](_0x459a87);return _0x5e5218[_0x56a9('0x24')](_0x56a9('0x25'),_0x59c0ec+'-'+_0x105fe5+'/'+_0x576bdf)['json'](_0x312e58);}return null;};}function patchUpdates(_0x5bc03a){return function(_0x3a2e5e){try{jsonpatch[_0x56a9('0x26')](_0x3a2e5e,_0x5bc03a,!![]);}catch(_0x64d4a7){return BPromise[_0x56a9('0x27')](_0x64d4a7);}return _0x3a2e5e['save']();};}function saveUpdates(_0x6100fe,_0x3355c4){return function(_0x4036e5){if(_0x4036e5){return _0x4036e5[_0x56a9('0x28')](_0x6100fe)['then'](function(_0x44762e){return _0x44762e;});}return null;};}function removeEntity(_0x32839b,_0x21ab38){return function(_0xd029f7){if(_0xd029f7){return _0xd029f7[_0x56a9('0x29')]()['then'](function(){_0x32839b[_0x56a9('0x1f')](0xcc)[_0x56a9('0x20')]();});}};}function handleEntityNotFound(_0x35fe6d,_0x5e3052){return function(_0x1099ba){if(!_0x1099ba){_0x35fe6d['sendStatus'](0x194);}return _0x1099ba;};}function handleError(_0x22744f,_0x8d41d6){_0x8d41d6=_0x8d41d6||0x1f4;return function(_0x216464){logger[_0x56a9('0x2a')](_0x216464[_0x56a9('0x2b')]);if(_0x216464[_0x56a9('0x2c')]){delete _0x216464[_0x56a9('0x2c')];}_0x22744f[_0x56a9('0x1f')](_0x8d41d6)['send'](_0x216464);};}function getInteractionUsers(_0x437ccf,_0x2bb1eb){return new BPromise(function(_0x5f23e1,_0x4441ce){try{if(_0x2bb1eb[_0x437ccf['id']]){_0x437ccf['Users']=_['map'](_0x2bb1eb[_0x437ccf['id']],function(_0x20d940){return{'id':_0x20d940['id'],'fullname':_0x20d940['fullname']};});}}catch(_0x2f933a){_0x4441ce(_0x2f933a);}_0x5f23e1(_0x437ccf);});}function getInteractionTags(_0x11002a,_0x2fbd5d){return new BPromise(function(_0x2c1c3d,_0x5879db){try{if(_0x11002a[_0x56a9('0x2d')]){_0x11002a[_0x56a9('0x2e')]=[];_0x11002a[_0x56a9('0x2d')][_0x56a9('0x2f')](',')[_0x56a9('0x30')](function(_0x1fa0a6){_0x11002a[_0x56a9('0x2e')][_0x56a9('0x31')](_0x2fbd5d[_0x1fa0a6]);});}delete _0x11002a[_0x56a9('0x2d')];}catch(_0x392b72){_0x5879db(_0x392b72);}_0x2c1c3d(_0x11002a);});}function updateSmsInteraction(_0x243f1c,_0x277a04,_0x5738fe){return new BPromise(function(_0x142bd2,_0x1bb817){return getInteractionUsers(_0x243f1c,_0x5738fe)[_0x56a9('0x32')](function(_0x524765){return getInteractionTags(_0x524765,_0x277a04);})[_0x56a9('0x32')](function(_0x51ce05){_0x142bd2(_0x51ce05);})['catch'](function(_0x5732fb){_0x1bb817(_0x5732fb);});});}exports[_0x56a9('0x33')]=function(_0x134dfc,_0x5914b5){var _0x5473cb={},_0x164652={},_0x18d7d0={'count':0x0,'rows':[]};var _0x1ba22e=_[_0x56a9('0x34')](db[_0x56a9('0x35')][_0x56a9('0x36')],function(_0x269268){return{'name':_0x269268[_0x56a9('0x37')],'type':_0x269268[_0x56a9('0x38')][_0x56a9('0x39')]};});_0x164652['model']=_['map'](_0x1ba22e,'name');_0x164652['query']=_[_0x56a9('0x3a')](_0x134dfc[_0x56a9('0x3b')]);_0x164652['filters']=_[_0x56a9('0x3c')](_0x164652[_0x56a9('0x3d')],_0x164652[_0x56a9('0x3b')]);_0x5473cb[_0x56a9('0x3e')]=_[_0x56a9('0x3c')](_0x164652[_0x56a9('0x3d')],qs[_0x56a9('0x3f')](_0x134dfc['query'][_0x56a9('0x3f')]));_0x5473cb[_0x56a9('0x3e')]=_0x5473cb['attributes']['length']?_0x5473cb[_0x56a9('0x3e')]:_0x164652[_0x56a9('0x3d')];if(!_0x134dfc[_0x56a9('0x3b')][_0x56a9('0x40')](_0x56a9('0x41'))){_0x5473cb[_0x56a9('0x23')]=qs[_0x56a9('0x23')](_0x134dfc[_0x56a9('0x3b')][_0x56a9('0x23')]);_0x5473cb[_0x56a9('0x22')]=qs[_0x56a9('0x22')](_0x134dfc[_0x56a9('0x3b')][_0x56a9('0x22')]);}_0x5473cb[_0x56a9('0x42')]=qs[_0x56a9('0x43')](_0x134dfc[_0x56a9('0x3b')][_0x56a9('0x43')]);_0x5473cb[_0x56a9('0x44')]=qs['filters'](_[_0x56a9('0x45')](_0x134dfc[_0x56a9('0x3b')],_0x164652[_0x56a9('0x46')]));var _0x5ce001=[];var _0x1f8b30=squel['select']()[_0x56a9('0x47')]('id')['field'](_0x56a9('0x2c'))[_0x56a9('0x47')](_0x56a9('0x48'))[_0x56a9('0x49')]('tools_tags');var _0x4f541b=squel['select']()[_0x56a9('0x47')](_0x56a9('0x4a'))[_0x56a9('0x47')](_0x56a9('0x4b'))[_0x56a9('0x47')](_0x56a9('0x4c'))[_0x56a9('0x49')](_0x56a9('0x4d'),'ui')[_0x56a9('0x4e')](_0x56a9('0x4f'),'u',_0x56a9('0x50'));var _0x49e6a4=squel[_0x56a9('0x51')]()[_0x56a9('0x49')]('sms_interactions','i')[_0x56a9('0x4e')](_0x56a9('0x52'),'c',_0x56a9('0x53'))['left_join'](_0x56a9('0x4f'),'o',_0x56a9('0x54'))['left_join'](_0x56a9('0x55'),'a',_0x56a9('0x56'))[_0x56a9('0x4e')](_0x56a9('0x57'),'me','me.SmsInteractionId\x20=\x20i.id')[_0x56a9('0x4e')](_0x56a9('0x58'),'it',_0x56a9('0x59'))[_0x56a9('0x4e')](_0x56a9('0x5a'),'t',_0x56a9('0x5b'));var _0x31aaf5=squel[_0x56a9('0x5c')]();var _0x2b1324=[];var _0x2c3794=squel[_0x56a9('0x5c')]();var _0x500656;if(_0x134dfc['query'][_0x56a9('0x5d')]){_0x500656=as[_0x56a9('0x5e')](_0x134dfc[_0x56a9('0x3b')][_0x56a9('0x5d')]);var _0x4a3cd3=_0x500656[_0x56a9('0x5f')];for(var _0x942bee=0x0;_0x942bee<_0x500656[_0x56a9('0x60')][_0x56a9('0x61')];_0x942bee++){var _0x52ba21=_0x500656[_0x56a9('0x60')][_0x942bee];var _0x1f905b='i';var _0x52dc06=_[_0x56a9('0x62')](_0x1ba22e,[_0x56a9('0x2c'),_0x52ba21['field']]);if(!_0x52dc06){switch(_0x52ba21[_0x56a9('0x47')]){case _0x56a9('0x63'):if(_0x52ba21[_0x56a9('0x64')]==0x1){_0x49e6a4[_0x56a9('0x65')]('`'+_0x52ba21['field']+'`\x20=\x200');}else{_0x49e6a4[_0x56a9('0x65')]('`'+_0x52ba21[_0x56a9('0x47')]+_0x56a9('0x66'));}break;case _0x56a9('0x67'):if(_0x52ba21[_0x56a9('0x68')]===_0x56a9('0x69')){if(_0x52ba21[_0x56a9('0x64')][_0x56a9('0x2f')]('\x20')[_0x56a9('0x61')]>0x1){_0x31aaf5[_0x4a3cd3](_0x56a9('0x6a'),qs['getFullTextValue'](_0x52ba21[_0x56a9('0x64')]),null);}else{var _0x20ce89='%'+_0x52ba21[_0x56a9('0x64')]+'%';_0x31aaf5[_0x4a3cd3](_0x56a9('0x6b'),_0x20ce89,_0x20ce89,_0x20ce89);}}else{_0x52dc06=_[_0x56a9('0x62')](_0x1ba22e,[_0x56a9('0x2c'),_0x56a9('0x6c')]);_0x52ba21['field']=_0x56a9('0x6c');_0x57d1d9=as[_0x56a9('0x6d')](_0x1f905b,_0x52dc06[_0x56a9('0x38')],_0x52ba21);_0x31aaf5[_0x4a3cd3](_0x57d1d9[_0x56a9('0x6e')],_0x57d1d9[_0x56a9('0x64')][_0x56a9('0x6f')],_0x57d1d9[_0x56a9('0x64')]['end']);}break;case _0x56a9('0x70'):var _0x5667e4=_0x52ba21['value'][_0x56a9('0x2f')](',')['map'](function(_0x229c12){return Number(_0x229c12);});_0x5667e4[_0x56a9('0x30')](function(_0x3dfd55){_0x2c3794['or'](_0x56a9('0x71'),'%,'+_0x3dfd55+',%');});_0x2b1324=_[_0x56a9('0x72')](_0x2b1324,_0x5667e4);break;case _0x56a9('0x73'):if(_0x52ba21[_0x56a9('0x68')]===_0x56a9('0x69')){_0x31aaf5[_0x4a3cd3](_0x56a9('0x74'),'%'+_0x52ba21['value']+'%',null);}else{_0x52dc06=_[_0x56a9('0x62')](_0x1ba22e,[_0x56a9('0x2c'),_0x56a9('0x75')]);_0x52ba21[_0x56a9('0x47')]=_0x56a9('0x75');_0x57d1d9=as[_0x56a9('0x6d')](_0x1f905b,_0x52dc06[_0x56a9('0x38')],_0x52ba21);_0x31aaf5[_0x4a3cd3](_0x57d1d9[_0x56a9('0x6e')],_0x57d1d9[_0x56a9('0x64')][_0x56a9('0x6f')],_0x57d1d9['value'][_0x56a9('0x20')]);}break;case _0x56a9('0x76'):_0x57d1d9=as[_0x56a9('0x6d')]('me',null,_0x52ba21);_0x31aaf5[_0x4a3cd3](_0x57d1d9['text'],_0x57d1d9[_0x56a9('0x64')][_0x56a9('0x6f')],_0x57d1d9[_0x56a9('0x64')]['end']);break;}}else{var _0x57d1d9=as[_0x56a9('0x6d')](_0x1f905b,_0x52dc06[_0x56a9('0x38')],_0x52ba21);_0x31aaf5[_0x4a3cd3](_0x57d1d9[_0x56a9('0x6e')],_0x57d1d9[_0x56a9('0x64')][_0x56a9('0x6f')],_0x57d1d9['value'][_0x56a9('0x20')]);}}}else{var _0x52bc63=_(_0x134dfc[_0x56a9('0x3b')])[_0x56a9('0x3a')]()[_0x56a9('0x34')](function(_0x23ed84){return _[_0x56a9('0x77')](_0x1ba22e,['name',_0x23ed84])?_0x23ed84:undefined;})['compact']()['value']();if(!_[_0x56a9('0x78')](_0x52bc63)){_0x52bc63[_0x56a9('0x30')](function(_0x41ca05){if(_0x41ca05==='SmsAccountId'){_0x49e6a4[_0x56a9('0x44')]('i.SmsAccountId\x20IN\x20?',[][_0x56a9('0x79')](_0x134dfc[_0x56a9('0x3b')][_0x41ca05]));}else if(_0x41ca05===_0x56a9('0x7a')){var _0x5c114d=JSON['parse'](_0x134dfc[_0x56a9('0x3b')][_0x41ca05])[_0x56a9('0x7b')];var _0x46a834=JSON[_0x56a9('0x7c')](_0x134dfc[_0x56a9('0x3b')][_0x41ca05])[_0x56a9('0x7d')];_0x49e6a4['where'](_0x56a9('0x7e'),_0x5c114d,_0x46a834);}else{if(_0x134dfc[_0x56a9('0x3b')][_0x41ca05]===_0x56a9('0x7f')){_0x49e6a4['where']('i.'+_0x41ca05+'\x20IS\x20NULL');}else{_0x49e6a4['where']('i.'+_0x41ca05+'\x20=\x20?',_0x134dfc[_0x56a9('0x3b')][_0x41ca05]);}}});}if(_0x134dfc[_0x56a9('0x3b')]['read']){if(_0x134dfc[_0x56a9('0x3b')][_0x56a9('0x80')]==0x1){_0x49e6a4[_0x56a9('0x65')](_0x56a9('0x81'));}else{_0x49e6a4['having'](_0x56a9('0x82'));}}if(_0x134dfc[_0x56a9('0x3b')][_0x56a9('0x83')]){_0x2b1324=_[_0x56a9('0x84')](_0x134dfc[_0x56a9('0x3b')][_0x56a9('0x83')])?_0x134dfc[_0x56a9('0x3b')][_0x56a9('0x83')]:new Array(_0x134dfc[_0x56a9('0x3b')][_0x56a9('0x83')]);_0x2b1324[_0x56a9('0x30')](function(_0x1e3c64){_0x2c3794['or'](_0x56a9('0x71'),'%,'+_0x1e3c64+',%');});}if(_0x134dfc[_0x56a9('0x3b')][_0x56a9('0x85')]){var _0x4c8e31=_0x134dfc['query'][_0x56a9('0x85')]['replace']('\x5c','\x5c\x5c')[_0x56a9('0x86')]('\x27\x27',_0x56a9('0x87'));if(qs[_0x56a9('0x88')](_0x4c8e31)){_0x31aaf5['or']('i.id\x20LIKE\x20?',_0x4c8e31+'%')['or'](_0x56a9('0x89'),_0x4c8e31+'%');}else{_0x31aaf5['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x4c8e31))['or'](_0x56a9('0x8a'),_0x4c8e31+'%');}}}_0x49e6a4[_0x56a9('0x44')](_0x31aaf5);_0x49e6a4[_0x56a9('0x8b')](_0x56a9('0x8c'));var _0x500ddf={'type':db[_0x56a9('0x8d')][_0x56a9('0x8e')][_0x56a9('0x8f')],'raw':!![]};var _0x7321ab=_0x49e6a4['clone']();_0x7321ab['field']('i.id');_0x7321ab[_0x56a9('0x47')](_0x56a9('0x90'),_0x56a9('0x63'));if(_0x5473cb[_0x56a9('0x42')]){_0x5473cb[_0x56a9('0x42')][_0x56a9('0x30')](function(_0x106017){_0x49e6a4[_0x56a9('0x42')]('i.'+_0x106017[0x0],_0x106017[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x2b1324)){_0x49e6a4['having'](_0x2c3794);_0x7321ab[_0x56a9('0x44')]('t.id\x20IN\x20?',_0x2b1324);}BPromise['resolve']()['then'](function(){if(!_0x500656){if(_0x134dfc['query'][_0x56a9('0x91')]||_0x134dfc[_0x56a9('0x3b')][_0x56a9('0x92')])return;_0x7321ab[_0x56a9('0x44')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x49e6a4[_0x56a9('0x44')](_0x56a9('0x93'));return;}return _0x134dfc[_0x56a9('0x94')][_0x56a9('0x95')]({'attributes':['id'],'raw':!![]})[_0x56a9('0x32')](function(_0x469bf6){if(_[_0x56a9('0x78')](_0x469bf6)){_0x7321ab[_0x56a9('0x44')](_0x56a9('0x96'));_0x49e6a4[_0x56a9('0x44')](_0x56a9('0x96'));}else{_0x7321ab[_0x56a9('0x44')](_0x56a9('0x97'),_['map'](_0x469bf6,'id'));_0x49e6a4['where']('i.SmsAccountId\x20IN\x20?',_['map'](_0x469bf6,'id'));}});})[_0x56a9('0x32')](function(){db[_0x56a9('0x98')]['query'](_0x7321ab[_0x56a9('0x99')](),_0x500ddf)[_0x56a9('0x32')](function(_0x2a39dd){_0x18d7d0[_0x56a9('0x21')]=_0x2a39dd[_0x56a9('0x61')];if(_0x18d7d0[_0x56a9('0x21')]===0x0)return[];return db['sequelize'][_0x56a9('0x3b')](_0x1f8b30['toString'](),_0x500ddf)[_0x56a9('0x32')](function(_0x296203){_0x5ce001=_[_0x56a9('0x9a')](_0x296203,'id');_0x500ddf=_['merge'](_0x500ddf,{'model':db[_0x56a9('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x134dfc[_0x56a9('0x3b')][_0x56a9('0x3f')]){_0x5473cb[_0x56a9('0x3e')][_0x56a9('0x30')](function(_0x3e37fa){_0x49e6a4['field']('i.'+_0x3e37fa);});}else{_0x49e6a4[_0x56a9('0x47')](_0x56a9('0x90'),_0x56a9('0x63'));_0x49e6a4[_0x56a9('0x47')](_0x56a9('0x9b'),'Account.key');_0x49e6a4[_0x56a9('0x47')](_0x56a9('0x9c'),_0x56a9('0x9d'));_0x49e6a4[_0x56a9('0x47')](_0x56a9('0x9e'));_0x49e6a4['field'](_0x56a9('0x9f'),_0x56a9('0xa0'));_0x49e6a4['field'](_0x56a9('0xa1'),_0x56a9('0xa2'));_0x49e6a4[_0x56a9('0x47')]('c.email',_0x56a9('0xa3'));_0x49e6a4[_0x56a9('0x47')](_0x56a9('0xa4'),_0x56a9('0xa5'));_0x49e6a4[_0x56a9('0x47')](_0x56a9('0xa6'),_0x56a9('0xa7'));_0x49e6a4[_0x56a9('0x47')](_0x56a9('0xa8'),_0x56a9('0xa9'));_0x49e6a4['field'](_0x56a9('0xaa'),_0x56a9('0xab'));_0x49e6a4[_0x56a9('0x47')](_0x56a9('0xac'),_0x56a9('0xad'));_0x49e6a4[_0x56a9('0x47')](_0x56a9('0xae'),'TagIds');}_0x49e6a4[_0x56a9('0x23')](_0x5473cb['limit']);_0x49e6a4[_0x56a9('0x22')](_0x5473cb[_0x56a9('0x22')]);return db[_0x56a9('0x98')][_0x56a9('0x3b')](_0x49e6a4[_0x56a9('0x99')](),_0x500ddf);})['then'](function(_0x4453b4){_0x4f541b['where'](_0x56a9('0xaf'),_[_0x56a9('0x34')](_0x4453b4,'id'));return db[_0x56a9('0x98')][_0x56a9('0x3b')](_0x4f541b[_0x56a9('0x99')](),_0x500ddf)[_0x56a9('0x32')](function(_0x2bd95a){var _0x26b133=_[_0x56a9('0xb0')](_0x2bd95a,_0x56a9('0xb1'));var _0x497222=[];_0x4453b4[_0x56a9('0x30')](function(_0x47fb34){_0x497222['push'](updateSmsInteraction(_0x47fb34,_0x5ce001,_0x26b133));});return BPromise[_0x56a9('0xb2')](_0x497222);});});})[_0x56a9('0x32')](function(_0x5a2080){_0x18d7d0[_0x56a9('0xb3')]=_0x5a2080;return _0x18d7d0;})[_0x56a9('0x32')](respondWithFilteredResult(_0x5914b5,_0x5473cb));})['catch'](handleError(_0x5914b5,null));};exports[_0x56a9('0xb4')]=function(_0x5eb05d,_0x2cf047){var _0x18fd5e={'raw':![],'where':{'id':_0x5eb05d[_0x56a9('0xb5')]['id']}},_0x5f5db6={};_0x5f5db6['model']=_[_0x56a9('0x3a')](db['SmsInteraction'][_0x56a9('0x36')]);_0x5f5db6[_0x56a9('0x3b')]=_[_0x56a9('0x3a')](_0x5eb05d[_0x56a9('0x3b')]);_0x5f5db6[_0x56a9('0x46')]=_['intersection'](_0x5f5db6[_0x56a9('0x3d')],_0x5f5db6[_0x56a9('0x3b')]);_0x18fd5e[_0x56a9('0x3e')]=_[_0x56a9('0x3c')](_0x5f5db6[_0x56a9('0x3d')],qs['fields'](_0x5eb05d[_0x56a9('0x3b')][_0x56a9('0x3f')]));_0x18fd5e[_0x56a9('0x3e')]=_0x18fd5e['attributes'][_0x56a9('0x61')]?_0x18fd5e[_0x56a9('0x3e')]:_0x5f5db6[_0x56a9('0x3d')];if(_0x5eb05d[_0x56a9('0x3b')]['includeAll']){_0x18fd5e['include']=[{'all':!![]}];}_0x18fd5e=_[_0x56a9('0xb6')]({},_0x18fd5e,_0x5eb05d[_0x56a9('0xb7')]);return db[_0x56a9('0x35')][_0x56a9('0x62')](_0x18fd5e)[_0x56a9('0x32')](handleEntityNotFound(_0x2cf047,null))[_0x56a9('0x32')](respondWithResult(_0x2cf047,null))[_0x56a9('0xb8')](handleError(_0x2cf047,null));};exports[_0x56a9('0xb9')]=function(_0x3a082d,_0x562a74){return db[_0x56a9('0x35')]['create'](_0x3a082d[_0x56a9('0x76')],{})[_0x56a9('0x32')](respondWithResult(_0x562a74,0xc9))[_0x56a9('0xb8')](handleError(_0x562a74,null));};exports[_0x56a9('0x28')]=function(_0x7153f5,_0x4d2bf5){if(_0x7153f5[_0x56a9('0x76')]['id']){delete _0x7153f5[_0x56a9('0x76')]['id'];}return db[_0x56a9('0x35')][_0x56a9('0x62')]({'where':{'id':_0x7153f5[_0x56a9('0xb5')]['id']}})[_0x56a9('0x32')](handleEntityNotFound(_0x4d2bf5,null))[_0x56a9('0x32')](saveUpdates(_0x7153f5['body'],null))[_0x56a9('0x32')](respondWithResult(_0x4d2bf5,null))[_0x56a9('0xb8')](handleError(_0x4d2bf5,null));};exports[_0x56a9('0x29')]=function(_0x1957b6,_0x17c62e){return db[_0x56a9('0x35')]['find']({'where':{'id':_0x1957b6[_0x56a9('0xb5')]['id']}})['then'](handleEntityNotFound(_0x17c62e,null))[_0x56a9('0x32')](removeEntity(_0x17c62e,null))[_0x56a9('0xb8')](handleError(_0x17c62e,null));};exports[_0x56a9('0xba')]=function(_0x581ebe,_0x38c70){return db[_0x56a9('0x35')][_0x56a9('0xba')]()[_0x56a9('0x32')](respondWithResult(_0x38c70,null))[_0x56a9('0xb8')](handleError(_0x38c70,null));};exports[_0x56a9('0xbb')]=function(_0x371e20,_0x54d046,_0x4fee66){return db[_0x56a9('0xbc')][_0x56a9('0x62')]({'where':{'id':_0x371e20['params']['id']}})[_0x56a9('0x32')](handleEntityNotFound(_0x54d046,null))[_0x56a9('0x32')](function(_0x14d54d){if(_0x14d54d){return _0x14d54d['addMessage'](_0x371e20[_0x56a9('0x76')]['ids'],_[_0x56a9('0xbd')](_0x371e20['body'],[_0x56a9('0xbe'),'id'])||{});}})[_0x56a9('0x32')](respondWithResult(_0x54d046,null))['catch'](handleError(_0x54d046,null));};exports[_0x56a9('0xbf')]=function(_0x41c07e,_0x11a6ab,_0xc803d2){var _0x474ae4={'raw':![],'where':{}};var _0x3fe3e9={};var _0x51f4e0={'count':0x0,'rows':[]};return db[_0x56a9('0x35')][_0x56a9('0xc0')]({'where':{'id':_0x41c07e[_0x56a9('0xb5')]['id']}})['then'](handleEntityNotFound(_0x11a6ab,null))[_0x56a9('0x32')](function(_0x22f222){if(_0x22f222){_0x3fe3e9[_0x56a9('0x3d')]=_[_0x56a9('0x3a')](db[_0x56a9('0xbc')][_0x56a9('0x36')]);_0x3fe3e9[_0x56a9('0x3b')]=_[_0x56a9('0x3a')](_0x41c07e[_0x56a9('0x3b')]);_0x3fe3e9['filters']=_[_0x56a9('0x3c')](_0x3fe3e9['model'],_0x3fe3e9[_0x56a9('0x3b')]);_0x474ae4[_0x56a9('0x3e')]=_[_0x56a9('0x3c')](_0x3fe3e9[_0x56a9('0x3d')],qs[_0x56a9('0x3f')](_0x41c07e['query'][_0x56a9('0x3f')]));_0x474ae4[_0x56a9('0x3e')]=_0x474ae4['attributes'][_0x56a9('0x61')]?_0x474ae4[_0x56a9('0x3e')]:_0x3fe3e9[_0x56a9('0x3d')];if(!_0x41c07e[_0x56a9('0x3b')]['hasOwnProperty'](_0x56a9('0x41'))){_0x474ae4['limit']=qs[_0x56a9('0x23')](_0x41c07e[_0x56a9('0x3b')][_0x56a9('0x23')]);_0x474ae4[_0x56a9('0x22')]=qs['offset'](_0x41c07e[_0x56a9('0x3b')][_0x56a9('0x22')]);}_0x474ae4[_0x56a9('0x42')]=qs['sort'](_0x41c07e[_0x56a9('0x3b')][_0x56a9('0x43')]);_0x474ae4[_0x56a9('0x44')]=qs['filters'](_['pick'](_0x41c07e[_0x56a9('0x3b')],_0x3fe3e9[_0x56a9('0x46')]));_0x474ae4['where'][_0x56a9('0xb1')]=_0x22f222['id'];if(_0x41c07e[_0x56a9('0x3b')][_0x56a9('0x85')]){_0x474ae4['where']=_[_0x56a9('0xb6')](_0x474ae4[_0x56a9('0x44')],{'$or':_[_0x56a9('0x34')](_0x474ae4[_0x56a9('0x3e')],function(_0x2d9e98){var _0xff2bfb={};_0xff2bfb[_0x2d9e98]={'$like':'%'+_0x41c07e[_0x56a9('0x3b')][_0x56a9('0x85')]+'%'};return _0xff2bfb;})});}if(_0x41c07e[_0x56a9('0x3b')][_0x56a9('0x7b')]){var _0x10eca5=_0x41c07e[_0x56a9('0x3b')][_0x56a9('0x7b')][_0x56a9('0x2f')](',');var _0x842c62={};_0x842c62[_0x10eca5[0x0]]={'$gte':moment(_0x10eca5[0x1])['format'](_0x56a9('0xc1'))};_0x474ae4[_0x56a9('0x44')]=_['merge'](_0x474ae4['where'],_0x842c62);}_0x474ae4=_[_0x56a9('0xb6')]({},_0x474ae4,_0x41c07e['options']);return db[_0x56a9('0xbc')][_0x56a9('0x21')]({'where':_0x474ae4['where']})[_0x56a9('0x32')](function(_0x5025a4){_0x51f4e0['count']=_0x5025a4;if(_0x41c07e[_0x56a9('0x3b')][_0x56a9('0xc2')]){_0x474ae4[_0x56a9('0xc3')]=[{'all':!![]}];}return db[_0x56a9('0xbc')][_0x56a9('0xc4')](_0x474ae4);})[_0x56a9('0x32')](function(_0xa16c9b){_0x51f4e0[_0x56a9('0xb3')]=_0xa16c9b;return _0x51f4e0;});}})[_0x56a9('0x32')](respondWithFilteredResult(_0x11a6ab,_0x474ae4))[_0x56a9('0xb8')](handleError(_0x11a6ab,null));};exports[_0x56a9('0xc5')]=function(_0xce980c,_0x28388a,_0x332380){return db[_0x56a9('0x35')]['find']({'where':{'id':_0xce980c[_0x56a9('0xb5')]['id']}})[_0x56a9('0x32')](handleEntityNotFound(_0x28388a,null))[_0x56a9('0x32')](function(_0x44b579){if(_0x44b579){return _0x44b579['setTags'](_0xce980c[_0x56a9('0x76')][_0x56a9('0xbe')],_[_0x56a9('0xbd')](_0xce980c[_0x56a9('0x76')],[_0x56a9('0xbe'),'id'])||{})['spread'](function(){return db[_0x56a9('0x70')][_0x56a9('0xc4')]({'attributes':['id',_0x56a9('0x2c'),_0x56a9('0x48')],'where':{'id':_0xce980c[_0x56a9('0x76')][_0x56a9('0xbe')]}});})[_0x56a9('0x32')](function(_0x56b8c3){socket['emit']('smsInteractionTags:save',{'id':Number(_0xce980c[_0x56a9('0xb5')]['id']),'tags':_0x56b8c3||[]});return{'id':Number(_0xce980c[_0x56a9('0xb5')]['id']),'tags':_0x56b8c3||[]};});}})['then'](respondWithResult(_0x28388a,null))[_0x56a9('0xb8')](handleError(_0x28388a,null));};exports['removeTags']=function(_0x5cb040,_0x216da3,_0x1e8a01){return db[_0x56a9('0x35')][_0x56a9('0x62')]({'where':{'id':_0x5cb040[_0x56a9('0xb5')]['id']}})[_0x56a9('0x32')](handleEntityNotFound(_0x216da3,null))[_0x56a9('0x32')](function(_0x1e586a){if(_0x1e586a){return _0x1e586a[_0x56a9('0xc6')](_0x5cb040[_0x56a9('0x3b')][_0x56a9('0xbe')]);}})[_0x56a9('0x32')](respondWithStatusCode(_0x216da3,null))[_0x56a9('0xb8')](handleError(_0x216da3,null));};exports[_0x56a9('0xc7')]=function(_0x1f54f0,_0x28b021){var _0xca0341=moment()[_0x56a9('0xc8')]()[_0x56a9('0x99')]();var _0x1d2d96=path[_0x56a9('0xc9')](config['root'],'server',_0x56a9('0xca'),_0x56a9('0xcb'));var _0x570eec=path[_0x56a9('0xc9')](config[_0x56a9('0xcc')],_0x56a9('0xcd'),'files','attachments');var _0x33cb31=path[_0x56a9('0xc9')](_0x1d2d96,_0xca0341);var _0xb16d5f=util[_0x56a9('0xce')](_0x56a9('0xcf'),_0x1f54f0[_0x56a9('0xb5')]['id'],_0xca0341);var _0x93f849=path[_0x56a9('0xc9')](_0x1d2d96,_0xb16d5f);var _0x5c6232=[];_0x5c6232[_0x56a9('0x31')]({'model':db[_0x56a9('0x73')],'as':_0x56a9('0x73'),'attributes':['id',_0x56a9('0xd0')],'raw':!![]});_0x5c6232[_0x56a9('0x31')]({'model':db['CmContact'],'as':_0x56a9('0x67'),'attributes':['id',_0x56a9('0xd1'),_0x56a9('0xd2')],'raw':!![]});var _0x83f4bc=[{'model':db[_0x56a9('0xbc')],'as':_0x56a9('0xd3'),'attributes':['id',_0x56a9('0x76'),_0x56a9('0x7a'),_0x56a9('0xd4'),_0x56a9('0xd5'),_0x56a9('0x80')],'include':_0x5c6232}];_0x83f4bc['push']({'model':db[_0x56a9('0xd6')],'as':'Account','attributes':['id',_0x56a9('0x2c')]});_0x83f4bc[_0x56a9('0x31')]({'model':db['User'],'as':_0x56a9('0xd7'),'attributes':['id','fullname']});return db['SmsInteraction'][_0x56a9('0x62')]({'where':{'id':_0x1f54f0['params']['id']},'include':_0x83f4bc})['then'](handleEntityNotFound(_0x28b021,null))[_0x56a9('0x32')](function(_0x493d19){if(_0x493d19){var _0x5790fc=_0x493d19[_0x56a9('0xd8')]({'plain':!![]});fs[_0x56a9('0xd9')](_0x33cb31);var _0x30d844={'format':'A4','border':_0x56a9('0xda'),'header':{'height':_0x56a9('0xdb'),'contents':{'first':_0x56a9('0xdc')}},'footer':{'height':'30px','contents':{'default':util[_0x56a9('0xce')](_0x56a9('0xdd'),util['format'](_0x56a9('0xde'),'Sms',_0x5790fc['id']),moment()['format']('YYYY-MM-DD')['toString']())}}};var _0x2fb76a={'channel':'Sms','account':_0x5790fc[_0x56a9('0xdf')][_0x56a9('0x2c')],'agent':_0x5790fc[_0x56a9('0xd7')]?_0x5790fc['Owner'][_0x56a9('0xd0')]:_0x56a9('0xe0'),'createdAt':moment(_0x5790fc[_0x56a9('0x7a')])['format'](_0x56a9('0xc1'))[_0x56a9('0x99')](),'closedAt':_0x5790fc[_0x56a9('0xe1')]?moment(_0x5790fc[_0x56a9('0xe2')])[_0x56a9('0xce')](_0x56a9('0xc1'))[_0x56a9('0x99')]():'','disposition':_0x5790fc[_0x56a9('0xe3')],'messages':_(_0x5790fc[_0x56a9('0xd3')])[_0x56a9('0x85')]({'secret':![]})[_0x56a9('0x34')](function(_0x3026fe){return{'date':moment(_0x3026fe[_0x56a9('0x7a')])['format'](_0x56a9('0xc1'))[_0x56a9('0x99')](),'sender':_0x3026fe[_0x56a9('0xd4')]===_0x56a9('0xe4')?_0x3026fe[_0x56a9('0x73')]?_0x3026fe[_0x56a9('0x73')][_0x56a9('0xd0')]:_0x56a9('0xe5'):_0x3026fe[_0x56a9('0x67')][_0x56a9('0xd1')]+(_0x3026fe[_0x56a9('0x67')]['lastName']?'\x20'+_0x3026fe[_0x56a9('0x67')][_0x56a9('0xd2')]:''),'body':_0x3026fe[_0x56a9('0x76')],'direction':_0x3026fe[_0x56a9('0xd4')]===_0x56a9('0xe4')?'A':'C','secret':_0x3026fe[_0x56a9('0xd5')],'read':_0x3026fe['read']};})['value']()};return ejs[_0x56a9('0xe6')](path['join'](config['root'],_0x56a9('0xcd'),_0x56a9('0xe7'),_0x56a9('0xe8')),{'interaction':_0x2fb76a})[_0x56a9('0x32')](function(_0x30ee7b){return new BPromise(function(_0x4c6583,_0x559542){pdf[_0x56a9('0xb9')](_0x30ee7b,_0x30d844)[_0x56a9('0xe9')](path['join'](_0x33cb31,_0x56a9('0xea')+_0x5790fc['id']+'-'+_0xca0341+_0x56a9('0xeb')),function(_0x884fa1,_0x1ab213){if(_0x884fa1)return _0x559542(_0x884fa1);_0x4c6583(_0x1ab213);});});})[_0x56a9('0x32')](function(){return new BPromise(function(_0x1ae51e,_0x83ee4c){zipdir(_0x33cb31,{'saveTo':_0x93f849},function(_0x2c4bb1,_0x32b972){if(_0x2c4bb1)return _0x83ee4c(_0x2c4bb1);return _0x1ae51e(_0x32b972);});})[_0x56a9('0x32')](function(){return new BPromise(function(_0x4aad76,_0xa80c04){rimraf(_0x33cb31,function(_0x4db636){if(_0x4db636)_0xa80c04(_0x4db636);return _0x4aad76();});});})[_0x56a9('0x32')](function(){return _0x28b021[_0x56a9('0xc7')](_0x93f849,_0xb16d5f,function(_0x43db44){if(_0x43db44){console[_0x56a9('0xec')](_0x56a9('0xed'),_0x43db44);}else{fs[_0x56a9('0xee')](_0x93f849);}});});});}else{return _0x28b021[_0x56a9('0xef')](0xc8);}})[_0x56a9('0xb8')](handleError(_0x28b021,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index c0fe023..95dfcb9 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 _0xac95=['emit','hasOwnProperty','exports','events','../../mysqldb','SmsInteraction','save','update','getUsers','then','Users','map','findAll','unreadMessages','length'];(function(_0x415d4d,_0x53f5ab){var _0x2a831e=function(_0x2ac48e){while(--_0x2ac48e){_0x415d4d['push'](_0x415d4d['shift']());}};_0x2a831e(++_0x53f5ab);}(_0xac95,0xa8));var _0x5ac9=function(_0x11bcdd,_0x4c04df){_0x11bcdd=_0x11bcdd-0x0;var _0x3a6398=_0xac95[_0x11bcdd];return _0x3a6398;};'use strict';var EventEmitter=require(_0x5ac9('0x0'));var SmsInteraction=require(_0x5ac9('0x1'))['db'][_0x5ac9('0x2')];var SmsMessage=require(_0x5ac9('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5ac9('0x3'),'afterUpdate':_0x5ac9('0x4'),'afterDestroy':'remove'};function emitEvent(_0xafa08d){return function(_0x3790d1,_0x5b445a,_0x1dc09a){_0x3790d1[_0x5ac9('0x5')]({'attributes':['id'],'raw':!![]})[_0x5ac9('0x6')](function(_0x4bddcf){_0x3790d1['setDataValue'](_0x5ac9('0x7'),_0x4bddcf[_0x5ac9('0x8')](function(_0x28bc1f){return{'id':_0x28bc1f['id']};}));return SmsMessage[_0x5ac9('0x9')]({'where':{'SmsInteractionId':_0x3790d1['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5ac9('0x6')](function(_0x5da6fb){_0x3790d1['setDataValue'](_0x5ac9('0xa'),_0x5da6fb[_0x5ac9('0xb')]);SmsInteractionEvents['emit'](_0xafa08d+':'+_0x3790d1['id'],_0x3790d1);SmsInteractionEvents[_0x5ac9('0xc')](_0xafa08d,_0x3790d1);_0x1dc09a(null);})['catch'](_0x1dc09a(null));};}for(var e in events){if(events[_0x5ac9('0xd')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x5ac9('0xe')]=SmsInteractionEvents; \ No newline at end of file +var _0x106f=['hook','exports','events','../../mysqldb','SmsMessage','save','remove','getUsers','then','setDataValue','Users','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x21ce79,_0x55e60e){var _0xf6d9e3=function(_0x31c6d6){while(--_0x31c6d6){_0x21ce79['push'](_0x21ce79['shift']());}};_0xf6d9e3(++_0x55e60e);}(_0x106f,0x162));var _0xf106=function(_0x38ff83,_0x2fc816){_0x38ff83=_0x38ff83-0x0;var _0x3ce5dc=_0x106f[_0x38ff83];return _0x3ce5dc;};'use strict';var EventEmitter=require(_0xf106('0x0'));var SmsInteraction=require(_0xf106('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0xf106('0x1'))['db'][_0xf106('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf106('0x3'),'afterUpdate':'update','afterDestroy':_0xf106('0x4')};function emitEvent(_0x370f6a){return function(_0x1f2919,_0x318376,_0x253f6d){_0x1f2919[_0xf106('0x5')]({'attributes':['id'],'raw':!![]})[_0xf106('0x6')](function(_0x546acc){_0x1f2919[_0xf106('0x7')](_0xf106('0x8'),_0x546acc['map'](function(_0x4a35bc){return{'id':_0x4a35bc['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x1f2919['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x52befe){_0x1f2919[_0xf106('0x7')](_0xf106('0x9'),_0x52befe[_0xf106('0xa')]);SmsInteractionEvents[_0xf106('0xb')](_0x370f6a+':'+_0x1f2919['id'],_0x1f2919);SmsInteractionEvents[_0xf106('0xb')](_0x370f6a,_0x1f2919);_0x253f6d(null);})[_0xf106('0xc')](_0x253f6d(null));};}for(var e in events){if(events[_0xf106('0xd')](e)){var event=events[e];SmsInteraction[_0xf106('0xe')](e,emitEvent(event));}}module[_0xf106('0xf')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index f86be9d..fd47a59 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 _0x3fe2=['path','rimraf','../../config/environment','./smsInteraction.attributes','define','sms_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','request-promise'];(function(_0x408626,_0x421fc6){var _0x36ef72=function(_0x495f53){while(--_0x495f53){_0x408626['push'](_0x408626['shift']());}};_0x36ef72(++_0x421fc6);}(_0x3fe2,0x109));var _0x23fe=function(_0x1a7fad,_0x265f12){_0x1a7fad=_0x1a7fad-0x0;var _0x377179=_0x3fe2[_0x1a7fad];return _0x377179;};'use strict';var _=require(_0x23fe('0x0'));var util=require(_0x23fe('0x1'));var logger=require(_0x23fe('0x2'))(_0x23fe('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x23fe('0x4'));var fs=require('fs');var path=require(_0x23fe('0x5'));var rimraf=require(_0x23fe('0x6'));var config=require(_0x23fe('0x7'));var attributes=require(_0x23fe('0x8'));module['exports']=function(_0x235573,_0x4fd6fc){return _0x235573[_0x23fe('0x9')]('SmsInteraction',attributes,{'tableName':_0x23fe('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x23fe96,_0x1994bb,_0x17e5f3){if(_0x23fe96[_0x23fe('0xb')]('closed')){_0x23fe96[_0x23fe('0xc')]=moment()[_0x23fe('0xd')](_0x23fe('0xe'));}_0x17e5f3(null,_0x23fe96);}}});}; \ No newline at end of file +var _0x272b=['api','moment','bluebird','rimraf','../../config/environment','define','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger'];(function(_0x294870,_0x496744){var _0x26c818=function(_0xc830e9){while(--_0xc830e9){_0x294870['push'](_0x294870['shift']());}};_0x26c818(++_0x496744);}(_0x272b,0x136));var _0xb272=function(_0x53dcac,_0x351c81){_0x53dcac=_0x53dcac-0x0;var _0x372c8e=_0x272b[_0x53dcac];return _0x372c8e;};'use strict';var _=require(_0xb272('0x0'));var util=require('util');var logger=require(_0xb272('0x1'))(_0xb272('0x2'));var moment=require(_0xb272('0x3'));var BPromise=require(_0xb272('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb272('0x5'));var config=require(_0xb272('0x6'));var attributes=require('./smsInteraction.attributes');module['exports']=function(_0xb2bc8,_0x379dbc){return _0xb2bc8[_0xb272('0x7')]('SmsInteraction',attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2e31f9,_0x2dbe92,_0x47a041){if(_0x2e31f9['changed'](_0xb272('0x8'))){_0x2e31f9[_0xb272('0x9')]=moment()[_0xb272('0xa')](_0xb272('0xb'));}_0x47a041(null,_0x2e31f9);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index b05d579..fa998e1 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 _0xef46=['request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','SmsInteraction,\x20%s,\x20%s','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes','limit','stringify','AddTagsToSmsInteraction','find','addTags','omit','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./smsInteraction.socket','request','then','info'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xef46,0x15c));var _0x6ef4=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xef46[_0x23e7c1];return _0x1add43;};'use strict';var _=require(_0x6ef4('0x0'));var util=require(_0x6ef4('0x1'));var moment=require(_0x6ef4('0x2'));var BPromise=require(_0x6ef4('0x3'));var rs=require(_0x6ef4('0x4'));var fs=require('fs');var Redis=require(_0x6ef4('0x5'));var db=require(_0x6ef4('0x6'))['db'];var utils=require(_0x6ef4('0x7'));var logger=require(_0x6ef4('0x8'))(_0x6ef4('0x9'));var config=require(_0x6ef4('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x6ef4('0xb')][_0x6ef4('0xc')]({'port':0x232a});config[_0x6ef4('0xd')]=_[_0x6ef4('0xe')](config[_0x6ef4('0xd')],{'host':_0x6ef4('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6ef4('0xd')]));require(_0x6ef4('0x10'))['register'](socket);function respondWithRpcPromise(_0x99c358,_0x350bc4,_0x343624){return new BPromise(function(_0x4133d8,_0x48ae89){return client[_0x6ef4('0x11')](_0x99c358,_0x343624)[_0x6ef4('0x12')](function(_0x177acd){logger[_0x6ef4('0x13')]('SmsInteraction,\x20%s,\x20%s',_0x350bc4,_0x6ef4('0x14'));logger[_0x6ef4('0x15')](_0x6ef4('0x16'),_0x350bc4,'request\x20sent',JSON['stringify'](_0x177acd));if(_0x177acd[_0x6ef4('0x17')]){if(_0x177acd['error'][_0x6ef4('0x18')]===0x1f4){logger['error'](_0x6ef4('0x19'),_0x350bc4,_0x177acd[_0x6ef4('0x17')][_0x6ef4('0x1a')]);return _0x48ae89(_0x177acd[_0x6ef4('0x17')][_0x6ef4('0x1a')]);}logger[_0x6ef4('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x350bc4,_0x177acd[_0x6ef4('0x17')][_0x6ef4('0x1a')]);return _0x4133d8(_0x177acd[_0x6ef4('0x17')]['message']);}else{logger[_0x6ef4('0x13')](_0x6ef4('0x19'),_0x350bc4,_0x6ef4('0x14'));_0x4133d8(_0x177acd[_0x6ef4('0x1b')]['message']);}})[_0x6ef4('0x1c')](function(_0x20166c){logger[_0x6ef4('0x17')](_0x6ef4('0x19'),_0x350bc4,_0x20166c);_0x48ae89(_0x20166c);});});}exports[_0x6ef4('0x1d')]=function(_0x25842b){var _0x376ad6=this;return new Promise(function(_0x12d7c4,_0x7ef730){return db[_0x6ef4('0x1e')][_0x6ef4('0x1f')](_0x25842b[_0x6ef4('0x20')],{'raw':_0x25842b[_0x6ef4('0x21')]?_0x25842b['options'][_0x6ef4('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25842b[_0x6ef4('0x21')]?_0x25842b[_0x6ef4('0x21')][_0x6ef4('0x23')]||null:null,'attributes':_0x25842b['options']?_0x25842b[_0x6ef4('0x21')][_0x6ef4('0x24')]||null:null,'limit':_0x25842b[_0x6ef4('0x21')]?_0x25842b[_0x6ef4('0x21')][_0x6ef4('0x25')]||null:null})['then'](function(_0xb7d53c){logger[_0x6ef4('0x13')](_0x6ef4('0x1d'),_0x25842b);logger[_0x6ef4('0x15')]('UpdateSmsInteraction',_0x25842b,JSON[_0x6ef4('0x26')](_0xb7d53c));_0x12d7c4(_0xb7d53c);})[_0x6ef4('0x1c')](function(_0x3929ff){logger[_0x6ef4('0x17')]('UpdateSmsInteraction',_0x3929ff[_0x6ef4('0x1a')],_0x25842b);_0x7ef730(_0x376ad6['error'](0x1f4,_0x3929ff[_0x6ef4('0x1a')]));});});};exports[_0x6ef4('0x27')]=function(_0x599e54){return new Promise(function(_0x16ae4a,_0x5e1eba){return db[_0x6ef4('0x1e')][_0x6ef4('0x28')]({'where':_0x599e54[_0x6ef4('0x21')]?_0x599e54[_0x6ef4('0x21')]['where']||null:null})[_0x6ef4('0x12')](function(_0x7be808){if(_0x7be808){return _0x7be808[_0x6ef4('0x29')](_0x599e54[_0x6ef4('0x20')]['ids'],_[_0x6ef4('0x2a')](_0x599e54[_0x6ef4('0x20')],[_0x6ef4('0x2b'),'id'])||{});}})[_0x6ef4('0x2c')](function(_0x4782d3){logger[_0x6ef4('0x13')](_0x6ef4('0x2d'),_0x599e54);logger[_0x6ef4('0x15')](_0x6ef4('0x2d'),_0x599e54,JSON[_0x6ef4('0x26')](_0x4782d3));_0x16ae4a(_0x4782d3);})[_0x6ef4('0x1c')](function(_0x22430c){logger[_0x6ef4('0x17')](_0x6ef4('0x2d'),_0x22430c[_0x6ef4('0x1a')],_0x599e54);_0x5e1eba(_this['error'](0x1f4,_0x22430c[_0x6ef4('0x1a')]));});});}; \ No newline at end of file +var _0x787a=['where','limit','debug','stringify','AddTagsToSmsInteraction','find','omit','ids','spread','AddTags','lodash','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','error','code','message','catch','UpdateSmsInteraction','SmsInteraction','body','options','raw'];(function(_0x1dd2cc,_0x36ddfe){var _0x305d8e=function(_0x27df09){while(--_0x27df09){_0x1dd2cc['push'](_0x1dd2cc['shift']());}};_0x305d8e(++_0x36ddfe);}(_0x787a,0x157));var _0xa787=function(_0x26aa44,_0x4bc900){_0x26aa44=_0x26aa44-0x0;var _0x25ce6b=_0x787a[_0x26aa44];return _0x25ce6b;};'use strict';var _=require(_0xa787('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa787('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa787('0x2'))['db'];var utils=require(_0xa787('0x3'));var logger=require('../../config/logger')(_0xa787('0x4'));var config=require(_0xa787('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xa787('0x6')][_0xa787('0x7')]({'port':0x232a});config[_0xa787('0x8')]=_[_0xa787('0x9')](config[_0xa787('0x8')],{'host':_0xa787('0xa'),'port':0x18eb});var socket=require(_0xa787('0xb'))(new Redis(config[_0xa787('0x8')]));require(_0xa787('0xc'))['register'](socket);function respondWithRpcPromise(_0x5ae0d9,_0xa0662b,_0x534e43){return new BPromise(function(_0x15e8a3,_0x51bc77){return client[_0xa787('0xd')](_0x5ae0d9,_0x534e43)[_0xa787('0xe')](function(_0x2371bc){logger[_0xa787('0xf')](_0xa787('0x10'),_0xa0662b,_0xa787('0x11'));logger['debug']('SmsInteraction,\x20%s,\x20%s,\x20%s',_0xa0662b,'request\x20sent',JSON['stringify'](_0x2371bc));if(_0x2371bc[_0xa787('0x12')]){if(_0x2371bc[_0xa787('0x12')][_0xa787('0x13')]===0x1f4){logger[_0xa787('0x12')](_0xa787('0x10'),_0xa0662b,_0x2371bc['error'][_0xa787('0x14')]);return _0x51bc77(_0x2371bc[_0xa787('0x12')][_0xa787('0x14')]);}logger[_0xa787('0x12')](_0xa787('0x10'),_0xa0662b,_0x2371bc[_0xa787('0x12')][_0xa787('0x14')]);return _0x15e8a3(_0x2371bc[_0xa787('0x12')][_0xa787('0x14')]);}else{logger['info'](_0xa787('0x10'),_0xa0662b,'request\x20sent');_0x15e8a3(_0x2371bc['result'][_0xa787('0x14')]);}})[_0xa787('0x15')](function(_0x3606b3){logger['error'](_0xa787('0x10'),_0xa0662b,_0x3606b3);_0x51bc77(_0x3606b3);});});}exports[_0xa787('0x16')]=function(_0x1a701d){var _0x1b77c2=this;return new Promise(function(_0x207caf,_0x4d85e2){return db[_0xa787('0x17')]['update'](_0x1a701d[_0xa787('0x18')],{'raw':_0x1a701d['options']?_0x1a701d[_0xa787('0x19')][_0xa787('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a701d['options']?_0x1a701d[_0xa787('0x19')][_0xa787('0x1b')]||null:null,'attributes':_0x1a701d['options']?_0x1a701d[_0xa787('0x19')]['attributes']||null:null,'limit':_0x1a701d['options']?_0x1a701d[_0xa787('0x19')][_0xa787('0x1c')]||null:null})[_0xa787('0xe')](function(_0x37a042){logger[_0xa787('0xf')](_0xa787('0x16'),_0x1a701d);logger[_0xa787('0x1d')](_0xa787('0x16'),_0x1a701d,JSON[_0xa787('0x1e')](_0x37a042));_0x207caf(_0x37a042);})[_0xa787('0x15')](function(_0x1734b0){logger['error'](_0xa787('0x16'),_0x1734b0[_0xa787('0x14')],_0x1a701d);_0x4d85e2(_0x1b77c2['error'](0x1f4,_0x1734b0[_0xa787('0x14')]));});});};exports[_0xa787('0x1f')]=function(_0x11f963){return new Promise(function(_0x4dff1b,_0x4217bc){return db[_0xa787('0x17')][_0xa787('0x20')]({'where':_0x11f963[_0xa787('0x19')]?_0x11f963[_0xa787('0x19')]['where']||null:null})[_0xa787('0xe')](function(_0x79fe36){if(_0x79fe36){return _0x79fe36['addTags'](_0x11f963[_0xa787('0x18')]['ids'],_[_0xa787('0x21')](_0x11f963[_0xa787('0x18')],[_0xa787('0x22'),'id'])||{});}})[_0xa787('0x23')](function(_0x153306){logger['info'](_0xa787('0x24'),_0x11f963);logger['debug'](_0xa787('0x24'),_0x11f963,JSON['stringify'](_0x153306));_0x4dff1b(_0x153306);})[_0xa787('0x15')](function(_0x50d499){logger['error']('AddTags',_0x50d499[_0xa787('0x14')],_0x11f963);_0x4217bc(_this['error'](0x1f4,_0x50d499[_0xa787('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index b568da5..1e98d91 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 _0xb10b=['emit','removeListener','register','smsInteraction:','./smsInteraction.events','remove','update'];(function(_0x192b7d,_0x3db1eb){var _0x57e19a=function(_0x15287d){while(--_0x15287d){_0x192b7d['push'](_0x192b7d['shift']());}};_0x57e19a(++_0x3db1eb);}(_0xb10b,0x12a));var _0xbb10=function(_0x35b7ba,_0x155c7f){_0x35b7ba=_0x35b7ba-0x0;var _0x25ea5e=_0xb10b[_0x35b7ba];return _0x25ea5e;};'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 +var _0xb7e7=['remove','removeListener','length','smsInteraction:','./smsInteraction.events'];(function(_0x3e87da,_0x74fa1d){var _0x39f4b7=function(_0x37705a){while(--_0x37705a){_0x3e87da['push'](_0x3e87da['shift']());}};_0x39f4b7(++_0x74fa1d);}(_0xb7e7,0x121));var _0x7b7e=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0xb7e7[_0x68ee8b];return _0x5148f7;};'use strict';var SmsInteractionEvents=require(_0x7b7e('0x0'));var events=['save',_0x7b7e('0x1'),'update'];function createListener(_0x1b7cc7,_0x54a37f){return function(_0x3f5804){_0x54a37f['emit'](_0x1b7cc7,_0x3f5804);};}function removeListener(_0x31d0ed,_0x118577){return function(){SmsInteractionEvents[_0x7b7e('0x2')](_0x31d0ed,_0x118577);};}exports['register']=function(_0x53ed64){for(var _0x333fa4=0x0,_0x372bde=events[_0x7b7e('0x3')];_0x333fa4<_0x372bde;_0x333fa4++){var _0x55ce81=events[_0x333fa4];var _0x42b871=createListener(_0x7b7e('0x4')+_0x55ce81,_0x53ed64);SmsInteractionEvents['on'](_0x55ce81,_0x42b871);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 10a27f5..2c37815 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 _0xa7a6=['exports','multer','connect-timeout','Router','../../components/auth/service','../../config/environment','./smsMessage.controller','isAuthenticated','/describe','describe','get','show','tracked','sms','smsmessage:create','create','/:id/status','status','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','destroy'];(function(_0x12ef42,_0x5db436){var _0x5a83d7=function(_0x1757a1){while(--_0x1757a1){_0x12ef42['push'](_0x12ef42['shift']());}};_0x5a83d7(++_0x5db436);}(_0xa7a6,0x196));var _0x6a7a=function(_0x30ad18,_0x5e57f2){_0x30ad18=_0x30ad18-0x0;var _0x5d09a7=_0xa7a6[_0x30ad18];return _0x5d09a7;};'use strict';var multer=require(_0x6a7a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6a7a('0x1'));var express=require('express');var router=express[_0x6a7a('0x2')]();var auth=require(_0x6a7a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x6a7a('0x4'));var controller=require(_0x6a7a('0x5'));router['get']('/',auth[_0x6a7a('0x6')](),controller['index']);router['get'](_0x6a7a('0x7'),auth['isAuthenticated'](),controller[_0x6a7a('0x8')]);router[_0x6a7a('0x9')]('/:id',auth[_0x6a7a('0x6')](),controller[_0x6a7a('0xa')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x6a7a('0xb')](_0x6a7a('0xc'),_0x6a7a('0xd')),controller[_0x6a7a('0xe')]);router['post'](_0x6a7a('0xf'),controller[_0x6a7a('0x10')]);router[_0x6a7a('0x11')](_0x6a7a('0x12'),auth[_0x6a7a('0x6')](),controller[_0x6a7a('0x13')]);router[_0x6a7a('0x11')](_0x6a7a('0x14'),auth[_0x6a7a('0x6')](),controller[_0x6a7a('0x15')]);router['put'](_0x6a7a('0x16'),auth[_0x6a7a('0x6')](),controller[_0x6a7a('0x17')]);router[_0x6a7a('0x18')]('/:id',auth[_0x6a7a('0x6')](),controller[_0x6a7a('0x19')]);module[_0x6a7a('0x1a')]=router; \ No newline at end of file +var _0x2016=['reject','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','/:id','show','post','tracked','sms','smsmessage:create','create','/:id/status','put','accept','/:id/reject'];(function(_0x4a4743,_0x3cc5b0){var _0x1aa3b7=function(_0x409ffa){while(--_0x409ffa){_0x4a4743['push'](_0x4a4743['shift']());}};_0x1aa3b7(++_0x3cc5b0);}(_0x2016,0x6c));var _0x6201=function(_0x36de36,_0xa58ad1){_0x36de36=_0x36de36-0x0;var _0x5a35a1=_0x2016[_0x36de36];return _0x5a35a1;};'use strict';var multer=require(_0x6201('0x0'));var util=require('util');var path=require(_0x6201('0x1'));var timeout=require(_0x6201('0x2'));var express=require(_0x6201('0x3'));var router=express['Router']();var auth=require(_0x6201('0x4'));var interaction=require(_0x6201('0x5'));var config=require(_0x6201('0x6'));var controller=require('./smsMessage.controller');router['get']('/',auth[_0x6201('0x7')](),controller[_0x6201('0x8')]);router[_0x6201('0x9')](_0x6201('0xa'),auth[_0x6201('0x7')](),controller['describe']);router['get'](_0x6201('0xb'),auth[_0x6201('0x7')](),controller[_0x6201('0xc')]);router[_0x6201('0xd')]('/',auth[_0x6201('0x7')](),interaction[_0x6201('0xe')](_0x6201('0xf'),_0x6201('0x10')),controller[_0x6201('0x11')]);router[_0x6201('0xd')](_0x6201('0x12'),controller['status']);router[_0x6201('0x13')](_0x6201('0xb'),auth[_0x6201('0x7')](),controller['update']);router[_0x6201('0x13')]('/:id/accept',auth[_0x6201('0x7')](),controller[_0x6201('0x14')]);router['put'](_0x6201('0x15'),auth['isAuthenticated'](),controller[_0x6201('0x16')]);router[_0x6201('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x6201('0x18')]);module[_0x6201('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 9b48985..9091d4a 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 _0x5909=['TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports'];(function(_0x30780e,_0x537b34){var _0x5b9129=function(_0xcf4cd1){while(--_0xcf4cd1){_0x30780e['push'](_0x30780e['shift']());}};_0x5b9129(++_0x537b34);}(_0x5909,0x73));var _0x9590=function(_0x1bb58c,_0x2c8a4d){_0x1bb58c=_0x1bb58c-0x0;var _0x277586=_0x5909[_0x1bb58c];return _0x277586;};'use strict';var Sequelize=require(_0x9590('0x0'));module[_0x9590('0x1')]={'body':{'type':Sequelize[_0x9590('0x2')](_0x9590('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x9590('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9590('0x5')]('in',_0x9590('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x9590('0x7')](0xbe)},'phone':{'type':Sequelize[_0x9590('0x7')]},'readAt':{'type':Sequelize[_0x9590('0x8')]},'secret':{'type':Sequelize[_0x9590('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x57f8=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x531c2c,_0x3d7191){var _0x430f77=function(_0x1ff8a9){while(--_0x1ff8a9){_0x531c2c['push'](_0x531c2c['shift']());}};_0x430f77(++_0x3d7191);}(_0x57f8,0x198));var _0x857f=function(_0x51bda1,_0x44f80d){_0x51bda1=_0x51bda1-0x0;var _0x1ce08c=_0x57f8[_0x51bda1];return _0x1ce08c;};'use strict';var Sequelize=require('sequelize');module[_0x857f('0x0')]={'body':{'type':Sequelize[_0x857f('0x1')](_0x857f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x857f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x857f('0x4')]('in',_0x857f('0x5')),'defaultValue':_0x857f('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x857f('0x6')](0xbe)},'phone':{'type':Sequelize[_0x857f('0x6')]},'readAt':{'type':Sequelize[_0x857f('0x7')]},'secret':{'type':Sequelize[_0x857f('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 7d43461..dc6c9a0 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 _0x9489=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','redis','./smsMessage.socket','register','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~!@#$%^&-_=+[{]}.','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','name','send','index','map','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','options','SmsMessage','count','include','rows','show','includeAll','find','create','body','params','describe','sms-interactions','sms','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','SmsInteraction','SmsInteractionId','read1stAt','format','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','acceptMessage','interface','channel','accept','EventManager','acceptmessage','agent','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SIP/%s','event','rejectmessage','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','groupName','eml-format'];(function(_0x5783ca,_0x5c2fbd){var _0x1fca68=function(_0x21aa00){while(--_0x21aa00){_0x5783ca['push'](_0x5783ca['shift']());}};_0x1fca68(++_0x5c2fbd);}(_0x9489,0x10b));var _0x9948=function(_0x48c733,_0x165f2b){_0x48c733=_0x48c733-0x0;var _0x3eacfb=_0x9489[_0x48c733];return _0x3eacfb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9948('0x0'));var rimraf=require(_0x9948('0x1'));var zipdir=require(_0x9948('0x2'));var jsonpatch=require(_0x9948('0x3'));var rp=require(_0x9948('0x4'));var moment=require(_0x9948('0x5'));var BPromise=require(_0x9948('0x6'));var Mustache=require(_0x9948('0x7'));var util=require(_0x9948('0x8'));var path=require(_0x9948('0x9'));var sox=require(_0x9948('0xa'));var csv=require(_0x9948('0xb'));var ejs=require(_0x9948('0xc'));var fs=require('fs');var _=require(_0x9948('0xd'));var squel=require(_0x9948('0xe'));var crypto=require('crypto');var jsforce=require(_0x9948('0xf'));var deskjs=require(_0x9948('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9948('0x11'));var authService=require(_0x9948('0x12'));var qs=require(_0x9948('0x13'));var as=require(_0x9948('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9948('0x15'))('api');var utils=require(_0x9948('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x9948('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9948('0x17')]));require(_0x9948('0x18'))[_0x9948('0x19')](socket);var jayson=require(_0x9948('0x1a'));var client=jayson[_0x9948('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0x9948('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x2cb141,_0x5c5931,_0x5c854e){if(_0x5c854e){var _0x3ab431=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3ab431[_0x9948('0x1c')](_0x5c5931)){return _0x2cb141;}else{throw new db['Sequelize'][(_0x9948('0x1d'))](_0x9948('0x1e'));}}else{return _0x2cb141;}}function respondWithRpcPromise(_0x3c82b0,_0x1d2d4a,_0x56f2b2,_0x3b8ea0){return new BPromise(function(_0x54fc9a,_0x8cf4d7){var _0x4174a1=_0x3b8ea0||client;return _0x4174a1['request'](_0x3c82b0,_0x56f2b2)['then'](function(_0x3c62a0){logger[_0x9948('0x1f')](_0x9948('0x20'),_0x1d2d4a,_0x9948('0x21'));logger[_0x9948('0x22')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1d2d4a,_0x9948('0x21'),JSON['stringify'](_0x3c62a0));if(_0x3c62a0[_0x9948('0x23')]){if(_0x3c62a0[_0x9948('0x23')]['code']===0x1f4){logger[_0x9948('0x23')]('SmsMessage,\x20%s,\x20%s',_0x1d2d4a,_0x3c62a0[_0x9948('0x23')][_0x9948('0x24')]);return _0x8cf4d7(_0x3c62a0[_0x9948('0x23')][_0x9948('0x24')]);}logger[_0x9948('0x23')](_0x9948('0x20'),_0x1d2d4a,_0x3c62a0[_0x9948('0x23')]['message']);return _0x54fc9a(_0x3c62a0[_0x9948('0x23')][_0x9948('0x24')]);}else{logger[_0x9948('0x1f')](_0x9948('0x20'),_0x1d2d4a,'request\x20sent');_0x54fc9a(_0x3c62a0[_0x9948('0x25')]['message']);}})[_0x9948('0x26')](function(_0x1a30e6){logger[_0x9948('0x23')](_0x9948('0x20'),_0x1d2d4a,_0x1a30e6);_0x8cf4d7(_0x1a30e6);});});}function respondWithStatusCode(_0x50b6e1,_0x516452){_0x516452=_0x516452||0xcc;return function(_0x52c173){if(_0x52c173){return _0x50b6e1[_0x9948('0x27')](_0x516452);}return _0x50b6e1['status'](_0x516452)[_0x9948('0x28')]();};}function respondWithResult(_0x57723f,_0x407a3f){_0x407a3f=_0x407a3f||0xc8;return function(_0x59ca06){if(_0x59ca06){return _0x57723f[_0x9948('0x29')](_0x407a3f)[_0x9948('0x2a')](_0x59ca06);}};}function respondWithFilteredResult(_0x1f3147,_0x5e80a5){return function(_0x332470){if(_0x332470){var _0x11c84f=_0x332470['count'],_0x1f4a14=_0x5e80a5[_0x9948('0x2b')],_0x2efb4d=_0x5e80a5[_0x9948('0x2b')]+_0x5e80a5[_0x9948('0x2c')],_0x5c42e1;if(_0x2efb4d>=_0x11c84f){_0x2efb4d=_0x11c84f;_0x5c42e1=0xc8;}else{_0x5c42e1=0xce;}_0x1f3147['status'](_0x5c42e1);return _0x1f3147[_0x9948('0x2d')](_0x9948('0x2e'),_0x1f4a14+'-'+_0x2efb4d+'/'+_0x11c84f)['json'](_0x332470);}return null;};}function patchUpdates(_0x33e637){return function(_0x3896aa){try{jsonpatch[_0x9948('0x2f')](_0x3896aa,_0x33e637,!![]);}catch(_0x4e3083){return BPromise[_0x9948('0x30')](_0x4e3083);}return _0x3896aa[_0x9948('0x31')]();};}function saveUpdates(_0x6967e4,_0x57d068){return function(_0x5c1933){if(_0x5c1933){return _0x5c1933[_0x9948('0x32')](_0x6967e4)['then'](function(_0x124d16){return _0x124d16;});}return null;};}function removeEntity(_0x3734a5,_0x2613ce){return function(_0x35409a){if(_0x35409a){return _0x35409a[_0x9948('0x33')]()[_0x9948('0x34')](function(){_0x3734a5[_0x9948('0x29')](0xcc)[_0x9948('0x28')]();});}};}function handleEntityNotFound(_0x1ed87f,_0x353404){return function(_0x2d2450){if(!_0x2d2450){_0x1ed87f['sendStatus'](0x194);}return _0x2d2450;};}function handleError(_0x557819,_0x90d3b2){_0x90d3b2=_0x90d3b2||0x1f4;return function(_0x2bf725){logger['error'](_0x2bf725['stack']);if(_0x2bf725[_0x9948('0x35')]){delete _0x2bf725[_0x9948('0x35')];}_0x557819[_0x9948('0x29')](_0x90d3b2)[_0x9948('0x36')](_0x2bf725);};}exports[_0x9948('0x37')]=function(_0x315b84,_0x2c0b6a){var _0x260981={},_0x5a792a={},_0x29c740={'count':0x0,'rows':[]};var _0x29af91=_[_0x9948('0x38')](db['SmsMessage']['rawAttributes'],function(_0xc503f8){return{'name':_0xc503f8['fieldName'],'type':_0xc503f8[_0x9948('0x39')][_0x9948('0x3a')]};});_0x5a792a[_0x9948('0x3b')]=_['map'](_0x29af91,_0x9948('0x35'));_0x5a792a[_0x9948('0x3c')]=_[_0x9948('0x3d')](_0x315b84['query']);_0x5a792a[_0x9948('0x3e')]=_[_0x9948('0x3f')](_0x5a792a['model'],_0x5a792a[_0x9948('0x3c')]);_0x260981[_0x9948('0x40')]=_['intersection'](_0x5a792a[_0x9948('0x3b')],qs[_0x9948('0x41')](_0x315b84[_0x9948('0x3c')][_0x9948('0x41')]));_0x260981[_0x9948('0x40')]=_0x260981['attributes'][_0x9948('0x42')]?_0x260981[_0x9948('0x40')]:_0x5a792a[_0x9948('0x3b')];if(!_0x315b84[_0x9948('0x3c')]['hasOwnProperty'](_0x9948('0x43'))){_0x260981['limit']=qs[_0x9948('0x2c')](_0x315b84['query'][_0x9948('0x2c')]);_0x260981['offset']=qs[_0x9948('0x2b')](_0x315b84[_0x9948('0x3c')][_0x9948('0x2b')]);}_0x260981[_0x9948('0x44')]=qs[_0x9948('0x45')](_0x315b84[_0x9948('0x3c')]['sort']);_0x260981['where']=qs[_0x9948('0x3e')](_[_0x9948('0x46')](_0x315b84[_0x9948('0x3c')],_0x5a792a[_0x9948('0x3e')]));if(_0x315b84['query'][_0x9948('0x47')]){_0x260981[_0x9948('0x48')]=_['merge'](_0x260981['where'],{'$or':_[_0x9948('0x38')](_0x29af91,function(_0x4fe9d8){if(_0x4fe9d8[_0x9948('0x39')]!=='VIRTUAL'){var _0xa2fbcc={};_0xa2fbcc[_0x4fe9d8[_0x9948('0x35')]]={'$like':'%'+_0x315b84[_0x9948('0x3c')]['filter']+'%'};return _0xa2fbcc;}})});}_0x260981=_[_0x9948('0x49')]({},_0x260981,_0x315b84[_0x9948('0x4a')]);var _0x34fb66={'where':_0x260981[_0x9948('0x48')]};return db[_0x9948('0x4b')]['count'](_0x34fb66)[_0x9948('0x34')](function(_0x1e2a34){_0x29c740[_0x9948('0x4c')]=_0x1e2a34;if(_0x315b84[_0x9948('0x3c')]['includeAll']){_0x260981[_0x9948('0x4d')]=[{'all':!![]}];}return db[_0x9948('0x4b')]['findAll'](_0x260981);})[_0x9948('0x34')](function(_0x36edd8){_0x29c740[_0x9948('0x4e')]=_0x36edd8;return _0x29c740;})[_0x9948('0x34')](respondWithFilteredResult(_0x2c0b6a,_0x260981))[_0x9948('0x26')](handleError(_0x2c0b6a,null));};exports[_0x9948('0x4f')]=function(_0x4055cc,_0x46d702){var _0x49ef8c={'raw':!![],'where':{'id':_0x4055cc['params']['id']}},_0x3f0940={};_0x3f0940[_0x9948('0x3b')]=_[_0x9948('0x3d')](db[_0x9948('0x4b')]['rawAttributes']);_0x3f0940[_0x9948('0x3c')]=_[_0x9948('0x3d')](_0x4055cc[_0x9948('0x3c')]);_0x3f0940[_0x9948('0x3e')]=_[_0x9948('0x3f')](_0x3f0940[_0x9948('0x3b')],_0x3f0940['query']);_0x49ef8c[_0x9948('0x40')]=_['intersection'](_0x3f0940[_0x9948('0x3b')],qs[_0x9948('0x41')](_0x4055cc[_0x9948('0x3c')][_0x9948('0x41')]));_0x49ef8c[_0x9948('0x40')]=_0x49ef8c[_0x9948('0x40')]['length']?_0x49ef8c[_0x9948('0x40')]:_0x3f0940[_0x9948('0x3b')];if(_0x4055cc['query'][_0x9948('0x50')]){_0x49ef8c[_0x9948('0x4d')]=[{'all':!![]}];}_0x49ef8c=_[_0x9948('0x49')]({},_0x49ef8c,_0x4055cc[_0x9948('0x4a')]);return db[_0x9948('0x4b')][_0x9948('0x51')](_0x49ef8c)[_0x9948('0x34')](handleEntityNotFound(_0x46d702,null))[_0x9948('0x34')](respondWithResult(_0x46d702,null))[_0x9948('0x26')](handleError(_0x46d702,null));};exports[_0x9948('0x52')]=function(_0xc672fc,_0x32195c){return db[_0x9948('0x4b')][_0x9948('0x52')](_0xc672fc[_0x9948('0x53')],{})[_0x9948('0x34')](respondWithResult(_0x32195c,0xc9))[_0x9948('0x26')](handleError(_0x32195c,null));};exports[_0x9948('0x32')]=function(_0x44e90a,_0x570598){if(_0x44e90a[_0x9948('0x53')]['id']){delete _0x44e90a[_0x9948('0x53')]['id'];}return db[_0x9948('0x4b')]['find']({'where':{'id':_0x44e90a[_0x9948('0x54')]['id']}})[_0x9948('0x34')](handleEntityNotFound(_0x570598,null))[_0x9948('0x34')](saveUpdates(_0x44e90a[_0x9948('0x53')],null))[_0x9948('0x34')](respondWithResult(_0x570598,null))['catch'](handleError(_0x570598,null));};exports[_0x9948('0x33')]=function(_0x237501,_0x10711a){return db['SmsMessage']['find']({'where':{'id':_0x237501[_0x9948('0x54')]['id']}})[_0x9948('0x34')](handleEntityNotFound(_0x10711a,null))[_0x9948('0x34')](removeEntity(_0x10711a,null))[_0x9948('0x26')](handleError(_0x10711a,null));};exports[_0x9948('0x55')]=function(_0x5ac914,_0x493f14){return db['SmsMessage'][_0x9948('0x55')]()[_0x9948('0x34')](respondWithResult(_0x493f14,null))[_0x9948('0x26')](handleError(_0x493f14,null));};var interaction_log=require(_0x9948('0x15'))(_0x9948('0x56'));exports['accept']=function(_0x357c15,_0x4eb314,_0x39f5b4){var _0x5a488d={'channel':_0x9948('0x57')};if(_0x357c15[_0x9948('0x53')]['id']){delete _0x357c15[_0x9948('0x53')]['id'];}_0x357c15[_0x9948('0x53')][_0x9948('0x58')]=!![];_0x357c15[_0x9948('0x53')][_0x9948('0x59')]=moment()['format'](_0x9948('0x5a'));_0x357c15[_0x9948('0x53')][_0x9948('0x5b')]=_0x357c15[_0x9948('0x53')][_0x9948('0x5b')]||_0x357c15[_0x9948('0x5c')]['id'];return db[_0x9948('0x4b')][_0x9948('0x51')]({'where':{'id':_0x357c15[_0x9948('0x54')]['id'],'UserId':null},'include':[{'model':db[_0x9948('0x5d')],'as':_0x9948('0x5e')}]})[_0x9948('0x34')](handleEntityNotFound(_0x4eb314,null))[_0x9948('0x34')](saveUpdates(_0x357c15[_0x9948('0x53')],null))['then'](function(_0x420313){if(_0x420313){_0x5a488d[_0x9948('0x24')]=_0x420313[_0x9948('0x5f')]({'plain':!![]});return db[_0x9948('0x60')][_0x9948('0x51')]({'where':{'id':_0x420313[_0x9948('0x61')]}});}return null;})[_0x9948('0x34')](handleEntityNotFound(_0x4eb314,null))['then'](function(_0x449e18){if(_0x449e18){return _0x449e18[_0x9948('0x32')]({'UserId':_0x357c15[_0x9948('0x53')][_0x9948('0x5b')],'read1stAt':_['isNil'](_0x449e18[_0x9948('0x62')])?moment()[_0x9948('0x63')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x138ce5){if(_0x138ce5){_0x5a488d[_0x9948('0x64')]=_0x138ce5[_0x9948('0x5f')]({'plain':!![]});interaction_log[_0x9948('0x1f')](_0x9948('0x65'),_0x357c15['user']['id'],_0x357c15[_0x9948('0x5c')]['name'],_0x357c15[_0x9948('0x5c')][_0x9948('0x66')],_0x5a488d[_0x9948('0x64')]['id'],_0x357c15[_0x9948('0x53')]?JSON[_0x9948('0x67')](_0x357c15[_0x9948('0x53')]):_0x9948('0x68'));return respondWithRpcPromise('AcceptMessage',_0x9948('0x69'),_0x5a488d);}return null;})[_0x9948('0x34')](function(_0x3d63ae){if(_0x3d63ae){if(_0x357c15[_0x9948('0x53')]['manual']){_0x5a488d['message'][_0x9948('0x6a')]=util[_0x9948('0x63')]('SIP/%s',_0x357c15['user'][_0x9948('0x35')]);_0x5a488d[_0x9948('0x24')][_0x9948('0x6b')]=_0x5a488d[_0x9948('0x6b')];_0x5a488d['message']['event']=_0x9948('0x6c');return respondWithRpcPromise('EventManager',_0x9948('0x6d'),{'event':_0x9948('0x6e'),'message':_0x5a488d[_0x9948('0x24')]},client9002)[_0x9948('0x34')](function(){return _0x5a488d;});}return _0x5a488d;}return null;})['then'](respondWithResult(_0x4eb314,null))[_0x9948('0x26')](handleError(_0x4eb314,null));};var interaction_log=require(_0x9948('0x15'))(_0x9948('0x56'));exports[_0x9948('0x30')]=function(_0x29c6d5,_0x389fd3,_0x4e04d2){var _0x4562d3={'agent':{},'channel':_0x9948('0x57')};if(_0x29c6d5[_0x9948('0x53')]['id']){delete _0x29c6d5[_0x9948('0x53')]['id'];}_0x29c6d5['body'][_0x9948('0x5b')]=_0x29c6d5[_0x9948('0x53')]['UserId']||_0x29c6d5['user']['id'];_0x4562d3[_0x9948('0x6f')]['id']=_0x29c6d5[_0x9948('0x53')][_0x9948('0x5b')];return db['SmsMessage'][_0x9948('0x51')]({'where':{'id':_0x29c6d5[_0x9948('0x54')]['id'],'UserId':null}})[_0x9948('0x34')](handleEntityNotFound(_0x389fd3,null))[_0x9948('0x34')](function(_0x567388){if(_0x567388){_0x4562d3[_0x9948('0x24')]=_0x567388[_0x9948('0x5f')]({'plain':!![]});return db[_0x9948('0x60')][_0x9948('0x51')]({'where':{'id':_0x567388[_0x9948('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x389fd3,null))[_0x9948('0x34')](function(_0x3ec56e){if(_0x3ec56e){_0x4562d3[_0x9948('0x64')]=_0x3ec56e['get']({'plain':!![]});interaction_log[_0x9948('0x1f')](_0x9948('0x70'),_0x29c6d5[_0x9948('0x5c')]['id'],_0x29c6d5[_0x9948('0x5c')]['name'],_0x29c6d5['user'][_0x9948('0x66')],_0x4562d3['interaction']['id'],_0x29c6d5[_0x9948('0x53')]?JSON[_0x9948('0x67')](_0x29c6d5[_0x9948('0x53')]):_0x9948('0x68'));return respondWithRpcPromise('RejectMessage',_0x9948('0x71'),_0x4562d3);}return null;})[_0x9948('0x34')](function(_0x366599){if(_0x366599){_0x366599[_0x9948('0x24')][_0x9948('0x6a')]=util[_0x9948('0x63')](_0x9948('0x72'),_0x29c6d5['user'][_0x9948('0x35')]);_0x366599[_0x9948('0x24')]['channel']=_0x4562d3[_0x9948('0x6b')];_0x366599[_0x9948('0x24')][_0x9948('0x73')]='reject';respondWithRpcPromise('EventManager',_0x9948('0x6d'),{'event':_0x9948('0x74'),'message':_0x366599[_0x9948('0x24')]},client9002);return _0x4562d3;}return null;})[_0x9948('0x34')](respondWithResult(_0x389fd3,null))[_0x9948('0x26')](handleError(_0x389fd3,null));};exports[_0x9948('0x29')]=function(_0x4a3dbe,_0x1096b8,_0x5a23ac){if(_0x4a3dbe[_0x9948('0x53')]['id']){delete _0x4a3dbe['body']['id'];}var _0x3b09aa;return db[_0x9948('0x4b')][_0x9948('0x51')]({'where':{'id':_0x4a3dbe[_0x9948('0x54')]['id']}})[_0x9948('0x34')](handleEntityNotFound(_0x1096b8,null))[_0x9948('0x34')](function(_0x175de8){if(_0x175de8){_0x3b09aa=_0x175de8;return db[_0x9948('0x75')][_0x9948('0x51')]({'where':{'id':_0x175de8[_0x9948('0x76')]}});}})[_0x9948('0x34')](handleEntityNotFound(_0x1096b8,null))[_0x9948('0x34')](function(_0x2efd39){if(_0x2efd39){logger[_0x9948('0x22')](_0x9948('0x77'),_0x9948('0x29'),'received\x20delivery\x20report\x20from',_0x2efd39[_0x9948('0x39')],util[_0x9948('0x78')](_0x4a3dbe[_0x9948('0x53')],{'showHidden':![],'depth':null}));switch(_0x2efd39[_0x9948('0x39')]){case _0x9948('0x79'):if(_0x4a3dbe[_0x9948('0x53')][_0x9948('0x7a')]&&_0x4a3dbe[_0x9948('0x53')][_0x9948('0x7a')]===_0x3b09aa[_0x9948('0x7b')]){return _0x3b09aa[_0x9948('0x32')]({'read':!![]});}else{logger[_0x9948('0x23')](_0x9948('0x7c'),_0x9948('0x29'),_0x9948('0x79'),util[_0x9948('0x78')](_0x4a3dbe[_0x9948('0x53')],{'showHidden':![],'depth':null}));}break;case _0x9948('0x7d'):if(_0x4a3dbe['body'][_0x9948('0x7e')]&&_0x4a3dbe['body'][_0x9948('0x7e')]===_0x3b09aa[_0x9948('0x7b')]&&_[_0x9948('0x7f')]([_0x9948('0x80'),_0x9948('0x81')],_0x4a3dbe['body'][_0x9948('0x82')])>=0x0){return _0x3b09aa[_0x9948('0x32')]({'read':!![]});}else{logger[_0x9948('0x23')](_0x9948('0x7c'),'status',_0x9948('0x83'),util[_0x9948('0x78')](_0x4a3dbe[_0x9948('0x53')],{'showHidden':![],'depth':null}));}break;case _0x9948('0x84'):var _0x100b55=_0x4a3dbe[_0x9948('0x53')]['results'][0x0];if(_0x100b55[_0x9948('0x29')][_0x9948('0x85')]==='DELIVERED'){return _0x3b09aa[_0x9948('0x32')]({'read':!![]});}else{logger[_0x9948('0x23')](_0x9948('0x7c'),'status',_0x9948('0x84'),util[_0x9948('0x78')](_0x4a3dbe[_0x9948('0x53')],{'showHidden':![],'depth':null}));}break;}return _0x3b09aa;}})['then'](respondWithResult(_0x1096b8,null))['catch'](handleError(_0x1096b8,null));}; \ No newline at end of file +var _0xb89f=['save','then','destroy','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','query','keys','filters','intersection','model','fields','hasOwnProperty','order','sort','where','merge','type','VIRTUAL','filter','includeAll','attributes','length','include','find','create','body','params','describe','accept','sms','read','readAt','format','UserId','user','Contact','get','SmsInteraction','SmsInteractionId','update','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','interface','channel','event','EventManager','acceptmessage','agent','stringify','RejectMessage','SIP/%s','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','Status','inspect','infobip','results','groupName','DELIVERED','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','SmsMessage,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject'];(function(_0x476ddb,_0x5e4456){var _0x4e78a9=function(_0x1146ac){while(--_0x1146ac){_0x476ddb['push'](_0x476ddb['shift']());}};_0x4e78a9(++_0x5e4456);}(_0xb89f,0x16a));var _0xfb89=function(_0x4e2665,_0x55b326){_0x4e2665=_0x4e2665-0x0;var _0x2bd882=_0xb89f[_0x4e2665];return _0x2bd882;};'use strict';var pdf=require(_0xfb89('0x0'));var emlformat=require(_0xfb89('0x1'));var rimraf=require(_0xfb89('0x2'));var zipdir=require(_0xfb89('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfb89('0x4'));var moment=require(_0xfb89('0x5'));var BPromise=require(_0xfb89('0x6'));var Mustache=require(_0xfb89('0x7'));var util=require(_0xfb89('0x8'));var path=require(_0xfb89('0x9'));var sox=require('sox');var csv=require(_0xfb89('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfb89('0xb'));var squel=require(_0xfb89('0xc'));var crypto=require('crypto');var jsforce=require(_0xfb89('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfb89('0xa'));var querystring=require(_0xfb89('0xe'));var Papa=require(_0xfb89('0xf'));var Redis=require(_0xfb89('0x10'));var authService=require(_0xfb89('0x11'));var qs=require(_0xfb89('0x12'));var as=require(_0xfb89('0x13'));var hardwareService=require(_0xfb89('0x14'));var logger=require(_0xfb89('0x15'))(_0xfb89('0x16'));var utils=require(_0xfb89('0x17'));var config=require('../../config/environment');var db=require(_0xfb89('0x18'))['db'];config[_0xfb89('0x19')]=_[_0xfb89('0x1a')](config[_0xfb89('0x19')],{'host':_0xfb89('0x1b'),'port':0x18eb});var socket=require(_0xfb89('0x1c'))(new Redis(config[_0xfb89('0x19')]));require(_0xfb89('0x1d'))[_0xfb89('0x1e')](socket);var jayson=require(_0xfb89('0x1f'));var client=jayson[_0xfb89('0x20')][_0xfb89('0x21')]({'port':0x232c});var client9002=jayson[_0xfb89('0x20')][_0xfb89('0x21')]({'port':0x232a});function checkPasswordPattern(_0x951e85,_0x56a5c1,_0x4eed64){if(_0x4eed64){var _0x43585e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x43585e['test'](_0x56a5c1)){return _0x951e85;}else{throw new db[(_0xfb89('0x22'))][(_0xfb89('0x23'))](_0xfb89('0x24'));}}else{return _0x951e85;}}function respondWithRpcPromise(_0x5f1066,_0x9b3e65,_0x3fcc7b,_0x2a1608){return new BPromise(function(_0x447e25,_0x2d2d41){var _0x442675=_0x2a1608||client;return _0x442675[_0xfb89('0x25')](_0x5f1066,_0x3fcc7b)['then'](function(_0x205999){logger['info'](_0xfb89('0x26'),_0x9b3e65,'request\x20sent');logger[_0xfb89('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9b3e65,_0xfb89('0x28'),JSON['stringify'](_0x205999));if(_0x205999[_0xfb89('0x29')]){if(_0x205999[_0xfb89('0x29')][_0xfb89('0x2a')]===0x1f4){logger['error'](_0xfb89('0x26'),_0x9b3e65,_0x205999['error'][_0xfb89('0x2b')]);return _0x2d2d41(_0x205999['error'][_0xfb89('0x2b')]);}logger['error'](_0xfb89('0x26'),_0x9b3e65,_0x205999[_0xfb89('0x29')][_0xfb89('0x2b')]);return _0x447e25(_0x205999['error'][_0xfb89('0x2b')]);}else{logger[_0xfb89('0x2c')]('SmsMessage,\x20%s,\x20%s',_0x9b3e65,_0xfb89('0x28'));_0x447e25(_0x205999[_0xfb89('0x2d')][_0xfb89('0x2b')]);}})[_0xfb89('0x2e')](function(_0xec4d9e){logger[_0xfb89('0x29')](_0xfb89('0x26'),_0x9b3e65,_0xec4d9e);_0x2d2d41(_0xec4d9e);});});}function respondWithStatusCode(_0x18df97,_0x4a3ac4){_0x4a3ac4=_0x4a3ac4||0xcc;return function(_0x2c5170){if(_0x2c5170){return _0x18df97[_0xfb89('0x2f')](_0x4a3ac4);}return _0x18df97[_0xfb89('0x30')](_0x4a3ac4)[_0xfb89('0x31')]();};}function respondWithResult(_0x5cd5a9,_0x2e2834){_0x2e2834=_0x2e2834||0xc8;return function(_0x3746a9){if(_0x3746a9){return _0x5cd5a9[_0xfb89('0x30')](_0x2e2834)[_0xfb89('0x32')](_0x3746a9);}};}function respondWithFilteredResult(_0x521555,_0x2d9bd7){return function(_0x5c5b0e){if(_0x5c5b0e){var _0x2edd30=_0x5c5b0e[_0xfb89('0x33')],_0x575f8b=_0x2d9bd7[_0xfb89('0x34')],_0x3a1c64=_0x2d9bd7[_0xfb89('0x34')]+_0x2d9bd7[_0xfb89('0x35')],_0x31bd11;if(_0x3a1c64>=_0x2edd30){_0x3a1c64=_0x2edd30;_0x31bd11=0xc8;}else{_0x31bd11=0xce;}_0x521555[_0xfb89('0x30')](_0x31bd11);return _0x521555[_0xfb89('0x36')](_0xfb89('0x37'),_0x575f8b+'-'+_0x3a1c64+'/'+_0x2edd30)[_0xfb89('0x32')](_0x5c5b0e);}return null;};}function patchUpdates(_0x38b8da){return function(_0x1155e3){try{jsonpatch[_0xfb89('0x38')](_0x1155e3,_0x38b8da,!![]);}catch(_0x274bf0){return BPromise[_0xfb89('0x39')](_0x274bf0);}return _0x1155e3[_0xfb89('0x3a')]();};}function saveUpdates(_0x447144,_0x51f94c){return function(_0x486f2c){if(_0x486f2c){return _0x486f2c['update'](_0x447144)[_0xfb89('0x3b')](function(_0x151ad6){return _0x151ad6;});}return null;};}function removeEntity(_0x2a9acf,_0x34f751){return function(_0x50af50){if(_0x50af50){return _0x50af50[_0xfb89('0x3c')]()['then'](function(){_0x2a9acf[_0xfb89('0x30')](0xcc)[_0xfb89('0x31')]();});}};}function handleEntityNotFound(_0x3c98e1,_0x3c803e){return function(_0x5952fc){if(!_0x5952fc){_0x3c98e1[_0xfb89('0x2f')](0x194);}return _0x5952fc;};}function handleError(_0x338db5,_0x249bd5){_0x249bd5=_0x249bd5||0x1f4;return function(_0x38c159){logger[_0xfb89('0x29')](_0x38c159[_0xfb89('0x3d')]);if(_0x38c159[_0xfb89('0x3e')]){delete _0x38c159[_0xfb89('0x3e')];}_0x338db5[_0xfb89('0x30')](_0x249bd5)[_0xfb89('0x3f')](_0x38c159);};}exports[_0xfb89('0x40')]=function(_0x5bd447,_0x47f4f4){var _0x5d3d09={},_0xf640ca={},_0x1bb3c4={'count':0x0,'rows':[]};var _0x3843a7=_[_0xfb89('0x41')](db[_0xfb89('0x42')][_0xfb89('0x43')],function(_0x5b9869){return{'name':_0x5b9869[_0xfb89('0x44')],'type':_0x5b9869['type']['key']};});_0xf640ca['model']=_[_0xfb89('0x41')](_0x3843a7,_0xfb89('0x3e'));_0xf640ca[_0xfb89('0x45')]=_[_0xfb89('0x46')](_0x5bd447[_0xfb89('0x45')]);_0xf640ca[_0xfb89('0x47')]=_[_0xfb89('0x48')](_0xf640ca[_0xfb89('0x49')],_0xf640ca[_0xfb89('0x45')]);_0x5d3d09['attributes']=_['intersection'](_0xf640ca[_0xfb89('0x49')],qs[_0xfb89('0x4a')](_0x5bd447[_0xfb89('0x45')][_0xfb89('0x4a')]));_0x5d3d09['attributes']=_0x5d3d09['attributes']['length']?_0x5d3d09['attributes']:_0xf640ca[_0xfb89('0x49')];if(!_0x5bd447[_0xfb89('0x45')][_0xfb89('0x4b')]('nolimit')){_0x5d3d09[_0xfb89('0x35')]=qs[_0xfb89('0x35')](_0x5bd447['query']['limit']);_0x5d3d09[_0xfb89('0x34')]=qs[_0xfb89('0x34')](_0x5bd447[_0xfb89('0x45')][_0xfb89('0x34')]);}_0x5d3d09[_0xfb89('0x4c')]=qs[_0xfb89('0x4d')](_0x5bd447[_0xfb89('0x45')]['sort']);_0x5d3d09[_0xfb89('0x4e')]=qs[_0xfb89('0x47')](_['pick'](_0x5bd447[_0xfb89('0x45')],_0xf640ca[_0xfb89('0x47')]));if(_0x5bd447[_0xfb89('0x45')]['filter']){_0x5d3d09['where']=_[_0xfb89('0x4f')](_0x5d3d09[_0xfb89('0x4e')],{'$or':_[_0xfb89('0x41')](_0x3843a7,function(_0xec43d1){if(_0xec43d1[_0xfb89('0x50')]!==_0xfb89('0x51')){var _0x13d484={};_0x13d484[_0xec43d1[_0xfb89('0x3e')]]={'$like':'%'+_0x5bd447['query'][_0xfb89('0x52')]+'%'};return _0x13d484;}})});}_0x5d3d09=_[_0xfb89('0x4f')]({},_0x5d3d09,_0x5bd447['options']);var _0x505360={'where':_0x5d3d09['where']};return db[_0xfb89('0x42')][_0xfb89('0x33')](_0x505360)[_0xfb89('0x3b')](function(_0xdb1ed1){_0x1bb3c4[_0xfb89('0x33')]=_0xdb1ed1;if(_0x5bd447[_0xfb89('0x45')][_0xfb89('0x53')]){_0x5d3d09['include']=[{'all':!![]}];}return db[_0xfb89('0x42')]['findAll'](_0x5d3d09);})['then'](function(_0x51cb2e){_0x1bb3c4['rows']=_0x51cb2e;return _0x1bb3c4;})[_0xfb89('0x3b')](respondWithFilteredResult(_0x47f4f4,_0x5d3d09))[_0xfb89('0x2e')](handleError(_0x47f4f4,null));};exports['show']=function(_0x205293,_0x5c980d){var _0xeea6b8={'raw':!![],'where':{'id':_0x205293['params']['id']}},_0x227e1b={};_0x227e1b[_0xfb89('0x49')]=_['keys'](db['SmsMessage'][_0xfb89('0x43')]);_0x227e1b['query']=_[_0xfb89('0x46')](_0x205293[_0xfb89('0x45')]);_0x227e1b[_0xfb89('0x47')]=_['intersection'](_0x227e1b[_0xfb89('0x49')],_0x227e1b[_0xfb89('0x45')]);_0xeea6b8[_0xfb89('0x54')]=_[_0xfb89('0x48')](_0x227e1b[_0xfb89('0x49')],qs[_0xfb89('0x4a')](_0x205293[_0xfb89('0x45')][_0xfb89('0x4a')]));_0xeea6b8[_0xfb89('0x54')]=_0xeea6b8[_0xfb89('0x54')][_0xfb89('0x55')]?_0xeea6b8[_0xfb89('0x54')]:_0x227e1b[_0xfb89('0x49')];if(_0x205293[_0xfb89('0x45')][_0xfb89('0x53')]){_0xeea6b8[_0xfb89('0x56')]=[{'all':!![]}];}_0xeea6b8=_[_0xfb89('0x4f')]({},_0xeea6b8,_0x205293['options']);return db[_0xfb89('0x42')][_0xfb89('0x57')](_0xeea6b8)[_0xfb89('0x3b')](handleEntityNotFound(_0x5c980d,null))[_0xfb89('0x3b')](respondWithResult(_0x5c980d,null))[_0xfb89('0x2e')](handleError(_0x5c980d,null));};exports[_0xfb89('0x58')]=function(_0x6b4485,_0x55d3c4){return db[_0xfb89('0x42')][_0xfb89('0x58')](_0x6b4485[_0xfb89('0x59')],{})[_0xfb89('0x3b')](respondWithResult(_0x55d3c4,0xc9))[_0xfb89('0x2e')](handleError(_0x55d3c4,null));};exports['update']=function(_0x18a510,_0x2a4e5c){if(_0x18a510[_0xfb89('0x59')]['id']){delete _0x18a510[_0xfb89('0x59')]['id'];}return db[_0xfb89('0x42')][_0xfb89('0x57')]({'where':{'id':_0x18a510[_0xfb89('0x5a')]['id']}})[_0xfb89('0x3b')](handleEntityNotFound(_0x2a4e5c,null))['then'](saveUpdates(_0x18a510[_0xfb89('0x59')],null))[_0xfb89('0x3b')](respondWithResult(_0x2a4e5c,null))[_0xfb89('0x2e')](handleError(_0x2a4e5c,null));};exports['destroy']=function(_0x33925d,_0x558bd9){return db[_0xfb89('0x42')][_0xfb89('0x57')]({'where':{'id':_0x33925d[_0xfb89('0x5a')]['id']}})[_0xfb89('0x3b')](handleEntityNotFound(_0x558bd9,null))[_0xfb89('0x3b')](removeEntity(_0x558bd9,null))[_0xfb89('0x2e')](handleError(_0x558bd9,null));};exports['describe']=function(_0x4a2300,_0x84f52){return db[_0xfb89('0x42')][_0xfb89('0x5b')]()[_0xfb89('0x3b')](respondWithResult(_0x84f52,null))[_0xfb89('0x2e')](handleError(_0x84f52,null));};var interaction_log=require(_0xfb89('0x15'))('sms-interactions');exports[_0xfb89('0x5c')]=function(_0x13c64a,_0x414c33,_0x1eb1b0){var _0xff346b={'channel':_0xfb89('0x5d')};if(_0x13c64a['body']['id']){delete _0x13c64a[_0xfb89('0x59')]['id'];}_0x13c64a[_0xfb89('0x59')][_0xfb89('0x5e')]=!![];_0x13c64a['body'][_0xfb89('0x5f')]=moment()[_0xfb89('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x13c64a['body'][_0xfb89('0x61')]=_0x13c64a['body'][_0xfb89('0x61')]||_0x13c64a[_0xfb89('0x62')]['id'];return db[_0xfb89('0x42')][_0xfb89('0x57')]({'where':{'id':_0x13c64a[_0xfb89('0x5a')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xfb89('0x63')}]})[_0xfb89('0x3b')](handleEntityNotFound(_0x414c33,null))['then'](saveUpdates(_0x13c64a[_0xfb89('0x59')],null))['then'](function(_0x3c0d87){if(_0x3c0d87){_0xff346b['message']=_0x3c0d87[_0xfb89('0x64')]({'plain':!![]});return db[_0xfb89('0x65')][_0xfb89('0x57')]({'where':{'id':_0x3c0d87[_0xfb89('0x66')]}});}return null;})[_0xfb89('0x3b')](handleEntityNotFound(_0x414c33,null))[_0xfb89('0x3b')](function(_0x3f2508){if(_0x3f2508){return _0x3f2508[_0xfb89('0x67')]({'UserId':_0x13c64a['body'][_0xfb89('0x61')],'read1stAt':_[_0xfb89('0x68')](_0x3f2508[_0xfb89('0x69')])?moment()[_0xfb89('0x60')](_0xfb89('0x6a')):undefined});}return null;})[_0xfb89('0x3b')](function(_0xe5512d){if(_0xe5512d){_0xff346b[_0xfb89('0x6b')]=_0xe5512d['get']({'plain':!![]});interaction_log['info'](_0xfb89('0x6c'),_0x13c64a['user']['id'],_0x13c64a[_0xfb89('0x62')][_0xfb89('0x3e')],_0x13c64a['user'][_0xfb89('0x6d')],_0xff346b[_0xfb89('0x6b')]['id'],_0x13c64a[_0xfb89('0x59')]?JSON['stringify'](_0x13c64a[_0xfb89('0x59')]):_0xfb89('0x6e'));return respondWithRpcPromise(_0xfb89('0x6f'),'acceptMessage',_0xff346b);}return null;})[_0xfb89('0x3b')](function(_0x29398e){if(_0x29398e){if(_0x13c64a[_0xfb89('0x59')]['manual']){_0xff346b[_0xfb89('0x2b')][_0xfb89('0x70')]=util['format']('SIP/%s',_0x13c64a['user']['name']);_0xff346b['message'][_0xfb89('0x71')]=_0xff346b[_0xfb89('0x71')];_0xff346b[_0xfb89('0x2b')][_0xfb89('0x72')]='accept';return respondWithRpcPromise('EventManager',_0xfb89('0x73'),{'event':_0xfb89('0x74'),'message':_0xff346b[_0xfb89('0x2b')]},client9002)[_0xfb89('0x3b')](function(){return _0xff346b;});}return _0xff346b;}return null;})[_0xfb89('0x3b')](respondWithResult(_0x414c33,null))[_0xfb89('0x2e')](handleError(_0x414c33,null));};var interaction_log=require('../../config/logger')('sms-interactions');exports[_0xfb89('0x39')]=function(_0x551843,_0x34884d,_0x2dcf2d){var _0x3adb52={'agent':{},'channel':'sms'};if(_0x551843[_0xfb89('0x59')]['id']){delete _0x551843[_0xfb89('0x59')]['id'];}_0x551843[_0xfb89('0x59')]['UserId']=_0x551843[_0xfb89('0x59')][_0xfb89('0x61')]||_0x551843[_0xfb89('0x62')]['id'];_0x3adb52[_0xfb89('0x75')]['id']=_0x551843[_0xfb89('0x59')][_0xfb89('0x61')];return db[_0xfb89('0x42')]['find']({'where':{'id':_0x551843[_0xfb89('0x5a')]['id'],'UserId':null}})[_0xfb89('0x3b')](handleEntityNotFound(_0x34884d,null))[_0xfb89('0x3b')](function(_0x558054){if(_0x558054){_0x3adb52['message']=_0x558054[_0xfb89('0x64')]({'plain':!![]});return db[_0xfb89('0x65')][_0xfb89('0x57')]({'where':{'id':_0x558054[_0xfb89('0x66')]}});}return null;})[_0xfb89('0x3b')](handleEntityNotFound(_0x34884d,null))[_0xfb89('0x3b')](function(_0xf32c12){if(_0xf32c12){_0x3adb52[_0xfb89('0x6b')]=_0xf32c12['get']({'plain':!![]});interaction_log[_0xfb89('0x2c')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x551843[_0xfb89('0x62')]['id'],_0x551843[_0xfb89('0x62')][_0xfb89('0x3e')],_0x551843['user']['role'],_0x3adb52['interaction']['id'],_0x551843[_0xfb89('0x59')]?JSON[_0xfb89('0x76')](_0x551843['body']):_0xfb89('0x6e'));return respondWithRpcPromise(_0xfb89('0x77'),'rejectMessage',_0x3adb52);}return null;})[_0xfb89('0x3b')](function(_0x16ced2){if(_0x16ced2){_0x16ced2[_0xfb89('0x2b')]['interface']=util['format'](_0xfb89('0x78'),_0x551843[_0xfb89('0x62')][_0xfb89('0x3e')]);_0x16ced2[_0xfb89('0x2b')][_0xfb89('0x71')]=_0x3adb52[_0xfb89('0x71')];_0x16ced2['message'][_0xfb89('0x72')]=_0xfb89('0x39');respondWithRpcPromise(_0xfb89('0x73'),'EventManager',{'event':'rejectmessage','message':_0x16ced2[_0xfb89('0x2b')]},client9002);return _0x3adb52;}return null;})['then'](respondWithResult(_0x34884d,null))[_0xfb89('0x2e')](handleError(_0x34884d,null));};exports[_0xfb89('0x30')]=function(_0xd3b375,_0x388999,_0x257b80){if(_0xd3b375['body']['id']){delete _0xd3b375['body']['id'];}var _0x366409;return db[_0xfb89('0x42')][_0xfb89('0x57')]({'where':{'id':_0xd3b375[_0xfb89('0x5a')]['id']}})[_0xfb89('0x3b')](handleEntityNotFound(_0x388999,null))['then'](function(_0x5947bc){if(_0x5947bc){_0x366409=_0x5947bc;return db[_0xfb89('0x79')][_0xfb89('0x57')]({'where':{'id':_0x5947bc[_0xfb89('0x7a')]}});}})[_0xfb89('0x3b')](handleEntityNotFound(_0x388999,null))[_0xfb89('0x3b')](function(_0x4f316f){if(_0x4f316f){logger['debug'](_0xfb89('0x7b'),'status',_0xfb89('0x7c'),_0x4f316f['type'],util['inspect'](_0xd3b375['body'],{'showHidden':![],'depth':null}));switch(_0x4f316f[_0xfb89('0x50')]){case _0xfb89('0x7d'):if(_0xd3b375['body'][_0xfb89('0x7e')]&&_0xd3b375[_0xfb89('0x59')][_0xfb89('0x7e')]===_0x366409[_0xfb89('0x7f')]){return _0x366409[_0xfb89('0x67')]({'read':!![]});}else{logger['error'](_0xfb89('0x80'),_0xfb89('0x30'),_0xfb89('0x7d'),util['inspect'](_0xd3b375[_0xfb89('0x59')],{'showHidden':![],'depth':null}));}break;case _0xfb89('0x81'):if(_0xd3b375[_0xfb89('0x59')][_0xfb89('0x82')]&&_0xd3b375['body'][_0xfb89('0x82')]===_0x366409[_0xfb89('0x7f')]&&_[_0xfb89('0x83')]([_0xfb89('0x84'),_0xfb89('0x85')],_0xd3b375[_0xfb89('0x59')][_0xfb89('0x86')])>=0x0){return _0x366409[_0xfb89('0x67')]({'read':!![]});}else{logger[_0xfb89('0x29')](_0xfb89('0x80'),'status','plivio',util[_0xfb89('0x87')](_0xd3b375[_0xfb89('0x59')],{'showHidden':![],'depth':null}));}break;case _0xfb89('0x88'):var _0x1f08b3=_0xd3b375['body'][_0xfb89('0x89')][0x0];if(_0x1f08b3['status'][_0xfb89('0x8a')]===_0xfb89('0x8b')){return _0x366409['update']({'read':!![]});}else{logger[_0xfb89('0x29')](_0xfb89('0x80'),_0xfb89('0x30'),_0xfb89('0x88'),util[_0xfb89('0x87')](_0xd3b375['body'],{'showHidden':![],'depth':null}));}break;}return _0x366409;}})[_0xfb89('0x3b')](respondWithResult(_0x388999,null))[_0xfb89('0x2e')](handleError(_0x388999,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index d1b95e4..35d7087 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 _0x718d=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update'];(function(_0x299784,_0xb0918f){var _0x5ab008=function(_0x49c1f5){while(--_0x49c1f5){_0x299784['push'](_0x299784['shift']());}};_0x5ab008(++_0xb0918f);}(_0x718d,0x1f4));var _0xd718=function(_0x44d33f,_0x3a09c0){_0x44d33f=_0x44d33f-0x0;var _0x6ab40d=_0x718d[_0x44d33f];return _0x6ab40d;};'use strict';var EventEmitter=require(_0xd718('0x0'));var SmsMessage=require(_0xd718('0x1'))['db'][_0xd718('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xd718('0x3')](0x0);var events={'afterCreate':_0xd718('0x4'),'afterUpdate':_0xd718('0x5'),'afterDestroy':_0xd718('0x6')};function emitEvent(_0x31a09e){return function(_0x324329,_0x55ed62,_0x1fe1b0){SmsMessageEvents[_0xd718('0x7')](_0x31a09e+':'+_0x324329['id'],_0x324329);SmsMessageEvents[_0xd718('0x7')](_0x31a09e,_0x324329);_0x1fe1b0(null);};}for(var e in events){if(events[_0xd718('0x8')](e)){var event=events[e];SmsMessage[_0xd718('0x9')](e,emitEvent(event));}}module[_0xd718('0xa')]=SmsMessageEvents; \ No newline at end of file +var _0x42fd=['../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x5cff4e,_0x4daca2){var _0x23ebd5=function(_0x2e275d){while(--_0x2e275d){_0x5cff4e['push'](_0x5cff4e['shift']());}};_0x23ebd5(++_0x4daca2);}(_0x42fd,0x12b));var _0xd42f=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0x42fd[_0x2160a9];return _0xa88cf7;};'use strict';var EventEmitter=require(_0xd42f('0x0'));var SmsMessage=require(_0xd42f('0x1'))['db'][_0xd42f('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xd42f('0x3')](0x0);var events={'afterCreate':_0xd42f('0x4'),'afterUpdate':_0xd42f('0x5'),'afterDestroy':_0xd42f('0x6')};function emitEvent(_0x5253aa){return function(_0x47b833,_0x374166,_0x392791){SmsMessageEvents['emit'](_0x5253aa+':'+_0x47b833['id'],_0x47b833);SmsMessageEvents[_0xd42f('0x7')](_0x5253aa,_0x47b833);_0x392791(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0xd42f('0x8')](e,emitEvent(event));}}module[_0xd42f('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 0b3e909..c5a7f91 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 _0x426d=['SmsAccount','find','SmsAccountId','type','twilio','authToken','phone','messages','remote','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','&password=','GET','sms','POST','user_key','session_key','total_sent','internal_order_id','Missing\x20parameters:\x20username,\x20password','requestid','read','connectel','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','senderString','format','%s:%s','https://rest.clicksend.com/v3/sms/send','toString','http_code','data','queued_count','head','message_id','deliveryReport','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','message_uuid','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','text','sort','length','apiKey','createHash','digest','/external/get/send.php?','keys','id_sms','Missing\x20parameters:\x20apiKey','clickatell','uuid','UTF-8','apiMessageId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','status','message','refid','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','SmsInteractionId','then','update','createdAt','catch','error'];(function(_0xf66a25,_0x527689){var _0x231422=function(_0x164b05){while(--_0x164b05){_0xf66a25['push'](_0xf66a25['shift']());}};_0x231422(++_0x527689);}(_0x426d,0x1bd));var _0xd426=function(_0x32fa68,_0x551115){_0x32fa68=_0x32fa68-0x0;var _0x506365=_0x426d[_0x32fa68];return _0x506365;};'use strict';var _=require(_0xd426('0x0'));var util=require(_0xd426('0x1'));var logger=require('../../config/logger')(_0xd426('0x2'));var moment=require(_0xd426('0x3'));var BPromise=require('bluebird');var rp=require(_0xd426('0x4'));var fs=require('fs');var path=require(_0xd426('0x5'));var rimraf=require(_0xd426('0x6'));var config=require(_0xd426('0x7'));var attributes=require('./smsMessage.attributes');module[_0xd426('0x8')]=function(_0x479210,_0x4aadca){return _0x479210[_0xd426('0x9')](_0xd426('0xa'),attributes,{'tableName':_0xd426('0xb'),'paranoid':![],'indexes':[{'name':_0xd426('0xc'),'fields':[_0xd426('0xc')]},{'name':_0xd426('0xd'),'fields':[_0xd426('0xe')],'type':_0xd426('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5f4911,_0x2db418,_0x3cb6b2){var _0x5c7251=_0x479210[_0xd426('0x10')];var _0x4f1c03=_0x5f4911[_0xd426('0x11')]({'plain':!![]});if(_0x4f1c03[_0xd426('0x12')][_0xd426('0x13')]()==='in'||_0x4f1c03[_0xd426('0x12')][_0xd426('0x13')]()===_0xd426('0x14')&&!_0x4f1c03[_0xd426('0x15')]&&!_[_0xd426('0x16')](_0x4f1c03[_0xd426('0x17')])){_0x5c7251[_0xd426('0x18')]['findOne']({'where':{'id':_0x4f1c03[_0xd426('0x19')]}})[_0xd426('0x1a')](function(_0x152081){if(_0x152081){_0x152081[_0xd426('0x1b')]({'lastMsgAt':_0x4f1c03[_0xd426('0x1c')],'lastMsgDirection':_0x4f1c03['direction'][_0xd426('0x13')]()});}})[_0xd426('0x1d')](function(_0xa46356){console[_0xd426('0x1e')](_0xa46356);});}if(_0x4f1c03[_0xd426('0x12')]===_0xd426('0x14')&&!_0x4f1c03[_0xd426('0x15')]){var _0x22e246;_0x5c7251[_0xd426('0x1f')][_0xd426('0x20')]({'where':{'id':_0x4f1c03[_0xd426('0x21')]},'raw':!![]})[_0xd426('0x1a')](function(_0x7a7256){_0x22e246=_0x7a7256;if(_0x22e246&&_0x22e246['type']){switch(_0x22e246[_0xd426('0x22')]){case _0xd426('0x23'):var _0x3c9077=require(_0xd426('0x23'));if(_0x22e246['accountSid']&&_0x22e246[_0xd426('0x24')]&&_0x22e246[_0xd426('0x25')]){var _0x6705b2=new _0x3c9077(_0x22e246['accountSid'],_0x22e246['authToken']);_0x6705b2[_0xd426('0x26')]['create']({'body':_0x4f1c03[_0xd426('0xe')],'to':_0x4f1c03[_0xd426('0x25')],'from':_0x22e246[_0xd426('0x25')],'statusCallback':_0x22e246[_0xd426('0x27')]+_0xd426('0x28')+_0x4f1c03['id']+_0xd426('0x29')+_0x22e246[_0xd426('0x2a')]})[_0xd426('0x1a')](function(_0x2d0b14){if(_0x2d0b14['sid']){return _0x5f4911[_0xd426('0x1b')]({'messageId':_0x2d0b14[_0xd426('0x2b')]});}})[_0xd426('0x1d')](function(_0x474ce6){logger[_0xd426('0x1e')](_0xd426('0x2c'),'afterCreate',_0xd426('0x23'),util[_0xd426('0x2d')](_0x474ce6,{'showHidden':![],'depth':null}));});}else{logger[_0xd426('0x1e')](_0xd426('0x2c'),_0xd426('0x2e'),_0xd426('0x23'),_0xd426('0x2f'));}break;case _0xd426('0x30'):var _0x5078a0=_0xd426('0x31');if(_0x22e246[_0xd426('0x32')]&&_0x22e246[_0xd426('0x33')]){var _0x42652c={'recipient':[_0x4f1c03[_0xd426('0x25')]],'message':_0x4f1c03[_0xd426('0xe')],'message_type':_0x22e246[_0xd426('0x34')]};if(_0x22e246[_0xd426('0x34')]&&_0x22e246['smsMethod']!=='SI'){_0x42652c[_0xd426('0x35')]=_0x22e246['phone'];}var _0x617d8f={'url':_0x5078a0+'login?username='+_0x22e246['username']+_0xd426('0x36')+_0x22e246[_0xd426('0x33')],'method':_0xd426('0x37')};rp(_0x617d8f)[_0xd426('0x1a')](function(_0x57f760){var _0x267f83=_0x57f760['split'](';');var _0xfab709={'user_key':_0x267f83[0x0],'session_key':_0x267f83[0x1]};_0x617d8f={'url':_0x5078a0+_0xd426('0x38'),'method':_0xd426('0x39'),'headers':{'user_key':_0xfab709[_0xd426('0x3a')],'Session_key':_0xfab709[_0xd426('0x3b')]},'json':!![],'body':_0x42652c};return rp(_0x617d8f);})[_0xd426('0x1a')](function(_0x20caff){if(_0x20caff[_0xd426('0x3c')]>=0x1){var _0x46bcc5={'messageId':_0x20caff[_0xd426('0x3d')]};if(_0x22e246['smsMethod']!=='GP'||!_0x22e246['deliveryReport']){_0x46bcc5['read']=!![];}return _0x5f4911[_0xd426('0x1b')](_0x46bcc5);}else{return logger[_0xd426('0x1e')](_0xd426('0x2c'),_0xd426('0x2e'),_0xd426('0x30'),util[_0xd426('0x2d')](_0x20caff,{'showHidden':![],'depth':null}));}})[_0xd426('0x1d')](function(_0x2c1d81){return logger[_0xd426('0x1e')](_0xd426('0x2c'),'afterCreate',_0xd426('0x30'),util[_0xd426('0x2d')](_0x2c1d81,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd426('0x2e'),_0xd426('0x30'),_0xd426('0x3e'));}break;case'connectel':if(_0x22e246[_0xd426('0x24')]){var _0x5a29a5={'recipient':_0x4f1c03[_0xd426('0x25')],'message':_0x4f1c03['body'],'sender':_0x22e246['senderString']||_0x22e246['phone'],'authorization':_0x22e246[_0xd426('0x24')]};var _0x2db418={'method':_0xd426('0x39'),'uri':'https://smsapi.connectel.se/api/send/','body':_0x5a29a5,'json':!![]};rp(_0x2db418)[_0xd426('0x1a')](function(_0x250fec){var _0x41a25d={'messageId':_0x250fec[_0xd426('0x3f')]};if(!_0x22e246['deliveryReport']){_0x41a25d[_0xd426('0x40')]=!![];}return _0x5f4911['update'](_0x41a25d);})[_0xd426('0x1d')](function(_0x50bd69){logger[_0xd426('0x1e')](_0xd426('0x2c'),_0xd426('0x2e'),'connectel',util['inspect'](_0x50bd69,{'showHidden':![],'depth':null}));});}else{logger[_0xd426('0x1e')](_0xd426('0x2c'),'afterCreate',_0xd426('0x41'),_0xd426('0x42'));}break;case'clicksend':if(_0x22e246[_0xd426('0x32')]&&_0x22e246[_0xd426('0x33')]){var _0x5a29a5={'messages':[{'source':_0xd426('0x43'),'to':_0x4f1c03[_0xd426('0x25')],'body':_0x4f1c03['body'],'from':_0x22e246[_0xd426('0x44')]||_0x22e246[_0xd426('0x25')]}]};var _0xf54436=util[_0xd426('0x45')](_0xd426('0x46'),_0x22e246['username'],_0x22e246[_0xd426('0x33')]);var _0x2db418={'method':_0xd426('0x39'),'uri':_0xd426('0x47'),'body':_0x5a29a5,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0xf54436)[_0xd426('0x48')]('base64'))},'json':!![]};rp(_0x2db418)[_0xd426('0x1a')](function(_0x63be31){if(_0x63be31[_0xd426('0x49')]>=0xc8&&_0x63be31[_0xd426('0x49')]<=0xce){if(_0x63be31[_0xd426('0x4a')]&&_0x63be31['data'][_0xd426('0x4b')]>0x0){var _0x4e6388=_[_0xd426('0x4c')](_0x63be31[_0xd426('0x4a')][_0xd426('0x26')]);var _0x213506={'messageId':_0x4e6388[_0xd426('0x4d')]};if(!_0x22e246[_0xd426('0x4e')]){_0x213506[_0xd426('0x40')]=!![];}return _0x5f4911[_0xd426('0x1b')](_0x213506);}else{logger[_0xd426('0x1e')](_0xd426('0x2c'),'afterCreate','clickSend',util[_0xd426('0x2d')](_0x63be31,{'showHidden':![],'depth':null}));}}else{logger[_0xd426('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd426('0x2e'),_0xd426('0x4f'),util[_0xd426('0x2d')](_0x63be31,{'showHidden':![],'depth':null}));}})[_0xd426('0x1d')](function(_0x468db4){logger['error'](_0xd426('0x2c'),_0xd426('0x2e'),'clickSend',util[_0xd426('0x2d')](_0x468db4,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xd426('0x2c'),_0xd426('0x2e'),_0xd426('0x4f'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xd426('0x50'):if(_0x22e246['authId']&&_0x22e246[_0xd426('0x24')]){var _0x5a29a5={'dst':_0x4f1c03[_0xd426('0x25')],'text':_0x4f1c03[_0xd426('0xe')],'src':_0x22e246[_0xd426('0x44')]||_0x22e246[_0xd426('0x25')],'url':_0x22e246[_0xd426('0x27')]+_0xd426('0x28')+_0x4f1c03['id']+_0xd426('0x29')+_0x22e246['token']};var _0xf54436=util['format']('%s:%s',_0x22e246[_0xd426('0x51')],_0x22e246[_0xd426('0x24')]);var _0x2db418={'method':_0xd426('0x39'),'uri':util[_0xd426('0x45')](_0xd426('0x52'),_0x22e246['authId']),'body':_0x5a29a5,'headers':{'Authorization':util[_0xd426('0x45')](_0xd426('0x53'),new Buffer(_0xf54436)[_0xd426('0x48')]('base64'))},'json':!![]};rp(_0x2db418)['then'](function(_0x3c0b83){var _0x4cf76b={'messageId':_0x3c0b83[_0xd426('0x54')][0x0]};return _0x5f4911[_0xd426('0x1b')](_0x4cf76b);})['catch'](function(_0x11503b){logger[_0xd426('0x1e')](_0xd426('0x2c'),'afterCreate',_0xd426('0x50'),util[_0xd426('0x2d')](_0x11503b,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xd426('0x2c'),_0xd426('0x2e'),_0xd426('0x50'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0xd426('0x55'):if(_0x22e246['username']&&_0x22e246[_0xd426('0x33')]){if(_0x22e246[_0xd426('0x56')]){var _0x4dcf88={'method':_0xd426('0x39'),'uri':_0x22e246['baseUrl']+_0xd426('0x57'),'body':{'username':_0x22e246[_0xd426('0x32')],'password':_0x22e246[_0xd426('0x33')]},'json':!![]};return rp(_0x4dcf88)[_0xd426('0x1a')](function(_0x523987){var _0x4a153d={'method':'POST','uri':_0x22e246[_0xd426('0x56')]+_0xd426('0x58'),'body':{'messages':[{'from':_0x22e246[_0xd426('0x25')],'destinations':[{'to':_0x4f1c03[_0xd426('0x25')]}],'text':_0x4f1c03['body'],'notifyUrl':_0x22e246['remote']+'/api/sms/messages/'+_0x4f1c03['id']+_0xd426('0x29')+_0x22e246['token'],'notifyContentType':_0xd426('0x59'),'callbackData':_0x22e246[_0xd426('0x25')]+';'+_0x4f1c03['body']}]},'headers':{'Authorization':_0xd426('0x5a')+_0x523987[_0xd426('0x2a')]},'json':!![]};return rp(_0x4a153d)[_0xd426('0x1a')](function(_0x962883){if(_0x962883[_0xd426('0x26')]){var _0x425cdd={'messageId':_0x962883['messages'][0x0][_0xd426('0xc')]};if(!_0x22e246['deliveryReport']){_0x425cdd[_0xd426('0x40')]=!![];}return _0x5f4911[_0xd426('0x1b')](_0x425cdd);}else{return logger[_0xd426('0x1e')](_0xd426('0x2c'),_0xd426('0x2e'),'infobip',util['inspect'](_0x962883,{'showHidden':![],'depth':null}));}});})[_0xd426('0x1d')](function(_0x335aa7){return logger[_0xd426('0x1e')](_0xd426('0x2c'),_0xd426('0x2e'),_0xd426('0x55'),util['inspect'](_0x335aa7,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xd426('0x2c'),_0xd426('0x2e'),_0xd426('0x55'),_0xd426('0x5b'));}}else{logger[_0xd426('0x1e')](_0xd426('0x2c'),'afterCreate',_0xd426('0x55'),_0xd426('0x3e'));}break;case _0xd426('0x5c'):var _0x251970=require(_0xd426('0x5d'));if(_0x22e246['apiKey']){var _0x3e8f63={};_0x3e8f63['login']=_0x22e246[_0xd426('0x32')];_0x3e8f63['phone']=_0x4f1c03[_0xd426('0x25')];_0x3e8f63['sender']=_0x22e246[_0xd426('0x25')];_0x3e8f63[_0xd426('0x5e')]=_0x4f1c03[_0xd426('0xe')];_0x3e8f63['timestamp']=+new Date();var _0x1e4d6a='';var _0x2b167d='';var _0x94cfd3=Object['keys'](_0x3e8f63);_0x94cfd3[_0xd426('0x5f')]();for(var _0x3e1f4d=0x0;_0x3e1f4d<_0x94cfd3[_0xd426('0x60')];_0x3e1f4d++){if(_0x1e4d6a!=''){_0x1e4d6a+='&';}_0x1e4d6a+=_0x94cfd3[_0x3e1f4d]+'='+encodeURIComponent(_0x3e8f63[_0x94cfd3[_0x3e1f4d]]);_0x2b167d+=_0x3e8f63[_0x94cfd3[_0x3e1f4d]];}_0x2b167d+=_0x22e246[_0xd426('0x61')];_0x2b167d=_0x251970[_0xd426('0x62')]('md5')[_0xd426('0x1b')](_0x2b167d)[_0xd426('0x63')]('hex');if(_0x1e4d6a!==''){_0x1e4d6a+='&';}_0x1e4d6a+='signature='+_0x2b167d;var _0x617d8f={'method':'GET','uri':_0x22e246['baseUrl']+_0xd426('0x64')+_0x1e4d6a,'json':!![]};return rp(_0x617d8f)[_0xd426('0x1a')](function(_0xb8c70c){var _0x5c5861=Object[_0xd426('0x65')](_0xb8c70c);if(_0xb8c70c[_0x5c5861[0x0]][_0xd426('0x1e')]&&parseInt(_0xb8c70c[_0x5c5861[0x0]][_0xd426('0x1e')])===0x0){var _0x248dd1={'messageId':_0xb8c70c[_0x5c5861[0x0]][_0xd426('0x66')]};if(!_0x22e246['deliveryReport']){_0x248dd1[_0xd426('0x40')]=!![];}return _0x5f4911[_0xd426('0x1b')](_0x248dd1);}else{return logger[_0xd426('0x1e')](_0xd426('0x2c'),_0xd426('0x2e'),_0xd426('0x5c'),util[_0xd426('0x2d')](_0xb8c70c[_0xd426('0x1e')],{'showHidden':![],'depth':null}));}})[_0xd426('0x1d')](function(_0x173262){return logger[_0xd426('0x1e')](_0xd426('0x2c'),_0xd426('0x2e'),'csc',util[_0xd426('0x2d')](_0x173262,{'showHidden':![],'depth':null}));});}else{logger[_0xd426('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xd426('0x5c'),_0xd426('0x67'));}break;case _0xd426('0x68'):if(_0x22e246['apiKey']){var _0x1fb269={'method':_0xd426('0x39'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x22e246['apiKey']},'body':{'content':_0x4f1c03[_0xd426('0xe')],'to':[_0x4f1c03['phone']],'from':_0x22e246['phone'],'binary':![],'clientMessageId':_0xd426('0x69'),'charset':_0xd426('0x6a')},'json':!![]};rp(_0x1fb269)[_0xd426('0x1a')](function(_0xe0e97a){if(!_0xe0e97a[_0xd426('0x1e')]){var _0x28173e={'messageId':_0xe0e97a['messages'][0x0][_0xd426('0x6b')]};if(!_0x22e246['deliveryReport']){_0x28173e[_0xd426('0x40')]=!![];}return _0x5f4911[_0xd426('0x1b')](_0x28173e);}else{return logger[_0xd426('0x1e')](_0xd426('0x2c'),'afterCreate',_0xd426('0x68'),util['inspect'](_0xe0e97a[_0xd426('0x1e')],{'showHidden':![],'depth':null}));}})[_0xd426('0x1d')](function(_0xa416ce){return logger[_0xd426('0x1e')](_0xd426('0x2c'),_0xd426('0x2e'),_0xd426('0x68'),util[_0xd426('0x2d')](_0xa416ce,{'showHidden':![],'depth':null}));});}else{logger[_0xd426('0x1e')](_0xd426('0x2c'),_0xd426('0x2e'),_0xd426('0x68'),'Missing\x20parameters:\x20apiKey');}break;case _0xd426('0x6c'):if(_0x22e246[_0xd426('0x61')]){var _0x586f09={};var _0x617d8f={'method':_0xd426('0x39'),'uri':_0xd426('0x6d'),'headers':{'Authorization':_0xd426('0x6e')+_0x22e246[_0xd426('0x61')],'Content-Type':'application/json'},'body':{'from':_0x22e246['phone'],'to':_0x4f1c03[_0xd426('0x25')],'text':_0x4f1c03[_0xd426('0xe')]},'json':!![]};return rp(_0x617d8f)[_0xd426('0x1a')](function(_0x5f0754){if(_0x5f0754[_0xd426('0x6f')]==0xca){_0x586f09['message']=_0x5f0754;var _0x430d42={'method':_0xd426('0x39'),'uri':_0xd426('0x70'),'headers':{'Authorization':'Bearer\x20'+_0x22e246['apiKey'],'Content-Type':_0xd426('0x59')},'body':{'refid':_0x586f09['message']['refid']},'json':!![]};return rp(_0x430d42)[_0xd426('0x1a')](function(_0x3c7039){_0x586f09[_0xd426('0x71')]=_0x3c7039;var _0x38b6d3={'messageId':_0x586f09[_0xd426('0x72')][_0xd426('0x73')],'read':!![]};return _0x5f4911[_0xd426('0x1b')](_0x38b6d3);});}else{return logger[_0xd426('0x1e')](_0xd426('0x2c'),_0xd426('0x2e'),'intelepeer',util[_0xd426('0x2d')](_0x5f0754,{'showHidden':![],'depth':null}));}})[_0xd426('0x1d')](function(_0xdbb78d){return logger[_0xd426('0x1e')](_0xd426('0x2c'),_0xd426('0x2e'),_0xd426('0x6c'),util[_0xd426('0x2d')](_0xdbb78d,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0xd426('0x2c'),_0xd426('0x2e'),_0xd426('0x6c'),'Token\x20not\x20received');}break;}}})[_0xd426('0x74')](function(){_0x3cb6b2();});}else{_0x3cb6b2();}}},'charset':_0xd426('0x75'),'collate':_0xd426('0x76')});}; \ No newline at end of file +var _0x5cdd=['status','message','refid','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','direction','toLowerCase','SmsInteraction','findOne','SmsInteractionId','then','update','catch','error','secret','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','/api/sms/messages/','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','&password=','GET','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','skebby','inspect','Missing\x20parameters:\x20username,\x20password','https://smsapi.connectel.se/api/send/','requestid','connectel','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','senderString','format','%s:%s','base64','http_code','data','head','message_id','clickSend','plivo','authId','remote','/status?token=','token','Basic\x20%s','toString','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','application/json','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','timestamp','sort','createHash','md5','digest','hex','signature=','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','apiMessageId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20'];(function(_0x2adac5,_0x38fea6){var _0x1661ab=function(_0x10797b){while(--_0x10797b){_0x2adac5['push'](_0x2adac5['shift']());}};_0x1661ab(++_0x38fea6);}(_0x5cdd,0x1db));var _0xd5cd=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x5cdd[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xd5cd('0x0'));var util=require(_0xd5cd('0x1'));var logger=require(_0xd5cd('0x2'))(_0xd5cd('0x3'));var moment=require(_0xd5cd('0x4'));var BPromise=require(_0xd5cd('0x5'));var rp=require(_0xd5cd('0x6'));var fs=require('fs');var path=require(_0xd5cd('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd5cd('0x8'));module[_0xd5cd('0x9')]=function(_0x5efa43,_0x3b4728){return _0x5efa43[_0xd5cd('0xa')](_0xd5cd('0xb'),attributes,{'tableName':_0xd5cd('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xd5cd('0xd')]},{'name':_0xd5cd('0xe'),'fields':[_0xd5cd('0xf')],'type':_0xd5cd('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2a995a,_0x434c8e,_0x3fcc6f){var _0x4382de=_0x5efa43[_0xd5cd('0x11')];var _0xdfcf09=_0x2a995a['get']({'plain':!![]});if(_0xdfcf09[_0xd5cd('0x12')][_0xd5cd('0x13')]()==='in'||_0xdfcf09[_0xd5cd('0x12')][_0xd5cd('0x13')]()==='out'&&!_0xdfcf09['secret']&&!_['isNil'](_0xdfcf09['UserId'])){_0x4382de[_0xd5cd('0x14')][_0xd5cd('0x15')]({'where':{'id':_0xdfcf09[_0xd5cd('0x16')]}})[_0xd5cd('0x17')](function(_0x5c69f8){if(_0x5c69f8){_0x5c69f8[_0xd5cd('0x18')]({'lastMsgAt':_0xdfcf09['createdAt'],'lastMsgDirection':_0xdfcf09[_0xd5cd('0x12')][_0xd5cd('0x13')]()});}})[_0xd5cd('0x19')](function(_0x185d62){console[_0xd5cd('0x1a')](_0x185d62);});}if(_0xdfcf09['direction']==='out'&&!_0xdfcf09[_0xd5cd('0x1b')]){var _0x153724;_0x4382de[_0xd5cd('0x1c')][_0xd5cd('0x1d')]({'where':{'id':_0xdfcf09[_0xd5cd('0x1e')]},'raw':!![]})['then'](function(_0x142c6c){_0x153724=_0x142c6c;if(_0x153724&&_0x153724[_0xd5cd('0x1f')]){switch(_0x153724[_0xd5cd('0x1f')]){case _0xd5cd('0x20'):var _0x3cefbd=require('twilio');if(_0x153724[_0xd5cd('0x21')]&&_0x153724[_0xd5cd('0x22')]&&_0x153724[_0xd5cd('0x23')]){var _0x1180d4=new _0x3cefbd(_0x153724[_0xd5cd('0x21')],_0x153724[_0xd5cd('0x22')]);_0x1180d4[_0xd5cd('0x24')][_0xd5cd('0x25')]({'body':_0xdfcf09[_0xd5cd('0xf')],'to':_0xdfcf09[_0xd5cd('0x23')],'from':_0x153724['phone'],'statusCallback':_0x153724['remote']+_0xd5cd('0x26')+_0xdfcf09['id']+'/status?token='+_0x153724['token']})['then'](function(_0x56cc80){if(_0x56cc80[_0xd5cd('0x27')]){return _0x2a995a[_0xd5cd('0x18')]({'messageId':_0x56cc80[_0xd5cd('0x27')]});}})[_0xd5cd('0x19')](function(_0x299dea){logger['error'](_0xd5cd('0x28'),'afterCreate',_0xd5cd('0x20'),util['inspect'](_0x299dea,{'showHidden':![],'depth':null}));});}else{logger[_0xd5cd('0x1a')](_0xd5cd('0x28'),_0xd5cd('0x29'),'twilio',_0xd5cd('0x2a'));}break;case'skebby':var _0x347b6b=_0xd5cd('0x2b');if(_0x153724[_0xd5cd('0x2c')]&&_0x153724[_0xd5cd('0x2d')]){var _0x1d5611={'recipient':[_0xdfcf09['phone']],'message':_0xdfcf09[_0xd5cd('0xf')],'message_type':_0x153724[_0xd5cd('0x2e')]};if(_0x153724[_0xd5cd('0x2e')]&&_0x153724['smsMethod']!=='SI'){_0x1d5611[_0xd5cd('0x2f')]=_0x153724[_0xd5cd('0x23')];}var _0x17d5b6={'url':_0x347b6b+'login?username='+_0x153724['username']+_0xd5cd('0x30')+_0x153724[_0xd5cd('0x2d')],'method':_0xd5cd('0x31')};rp(_0x17d5b6)[_0xd5cd('0x17')](function(_0x6b03bb){var _0xcdbcf=_0x6b03bb['split'](';');var _0x548bc8={'user_key':_0xcdbcf[0x0],'session_key':_0xcdbcf[0x1]};_0x17d5b6={'url':_0x347b6b+'sms','method':_0xd5cd('0x32'),'headers':{'user_key':_0x548bc8[_0xd5cd('0x33')],'Session_key':_0x548bc8[_0xd5cd('0x34')]},'json':!![],'body':_0x1d5611};return rp(_0x17d5b6);})[_0xd5cd('0x17')](function(_0x5a4e44){if(_0x5a4e44[_0xd5cd('0x35')]>=0x1){var _0x57af9f={'messageId':_0x5a4e44[_0xd5cd('0x36')]};if(_0x153724['smsMethod']!=='GP'||!_0x153724[_0xd5cd('0x37')]){_0x57af9f[_0xd5cd('0x38')]=!![];}return _0x2a995a[_0xd5cd('0x18')](_0x57af9f);}else{return logger[_0xd5cd('0x1a')](_0xd5cd('0x28'),'afterCreate',_0xd5cd('0x39'),util[_0xd5cd('0x3a')](_0x5a4e44,{'showHidden':![],'depth':null}));}})[_0xd5cd('0x19')](function(_0x481fc7){return logger[_0xd5cd('0x1a')](_0xd5cd('0x28'),_0xd5cd('0x29'),_0xd5cd('0x39'),util['inspect'](_0x481fc7,{'showHidden':![],'depth':null}));});}else{logger[_0xd5cd('0x1a')](_0xd5cd('0x28'),_0xd5cd('0x29'),_0xd5cd('0x39'),_0xd5cd('0x3b'));}break;case'connectel':if(_0x153724['authToken']){var _0xe7835d={'recipient':_0xdfcf09[_0xd5cd('0x23')],'message':_0xdfcf09['body'],'sender':_0x153724['senderString']||_0x153724[_0xd5cd('0x23')],'authorization':_0x153724['authToken']};var _0x434c8e={'method':_0xd5cd('0x32'),'uri':_0xd5cd('0x3c'),'body':_0xe7835d,'json':!![]};rp(_0x434c8e)[_0xd5cd('0x17')](function(_0x3acf67){var _0x52d597={'messageId':_0x3acf67[_0xd5cd('0x3d')]};if(!_0x153724[_0xd5cd('0x37')]){_0x52d597[_0xd5cd('0x38')]=!![];}return _0x2a995a['update'](_0x52d597);})['catch'](function(_0x554bc6){logger[_0xd5cd('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd5cd('0x29'),'connectel',util[_0xd5cd('0x3a')](_0x554bc6,{'showHidden':![],'depth':null}));});}else{logger[_0xd5cd('0x1a')](_0xd5cd('0x28'),_0xd5cd('0x29'),_0xd5cd('0x3e'),_0xd5cd('0x3f'));}break;case _0xd5cd('0x40'):if(_0x153724[_0xd5cd('0x2c')]&&_0x153724[_0xd5cd('0x2d')]){var _0xe7835d={'messages':[{'source':_0xd5cd('0x41'),'to':_0xdfcf09[_0xd5cd('0x23')],'body':_0xdfcf09['body'],'from':_0x153724[_0xd5cd('0x42')]||_0x153724[_0xd5cd('0x23')]}]};var _0x4e0324=util[_0xd5cd('0x43')](_0xd5cd('0x44'),_0x153724[_0xd5cd('0x2c')],_0x153724[_0xd5cd('0x2d')]);var _0x434c8e={'method':_0xd5cd('0x32'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0xe7835d,'headers':{'Authorization':util[_0xd5cd('0x43')]('Basic\x20%s',new Buffer(_0x4e0324)['toString'](_0xd5cd('0x45')))},'json':!![]};rp(_0x434c8e)[_0xd5cd('0x17')](function(_0x17d63e){if(_0x17d63e[_0xd5cd('0x46')]>=0xc8&&_0x17d63e[_0xd5cd('0x46')]<=0xce){if(_0x17d63e[_0xd5cd('0x47')]&&_0x17d63e['data']['queued_count']>0x0){var _0x33234f=_[_0xd5cd('0x48')](_0x17d63e[_0xd5cd('0x47')]['messages']);var _0x18ec4a={'messageId':_0x33234f[_0xd5cd('0x49')]};if(!_0x153724[_0xd5cd('0x37')]){_0x18ec4a['read']=!![];}return _0x2a995a['update'](_0x18ec4a);}else{logger[_0xd5cd('0x1a')](_0xd5cd('0x28'),_0xd5cd('0x29'),_0xd5cd('0x4a'),util[_0xd5cd('0x3a')](_0x17d63e,{'showHidden':![],'depth':null}));}}else{logger[_0xd5cd('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd5cd('0x29'),_0xd5cd('0x4a'),util[_0xd5cd('0x3a')](_0x17d63e,{'showHidden':![],'depth':null}));}})[_0xd5cd('0x19')](function(_0x1b5f4f){logger[_0xd5cd('0x1a')](_0xd5cd('0x28'),_0xd5cd('0x29'),_0xd5cd('0x4a'),util[_0xd5cd('0x3a')](_0x1b5f4f,{'showHidden':![],'depth':null}));});}else{logger[_0xd5cd('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xd5cd('0x4a'),_0xd5cd('0x3b'));}break;case _0xd5cd('0x4b'):if(_0x153724[_0xd5cd('0x4c')]&&_0x153724[_0xd5cd('0x22')]){var _0xe7835d={'dst':_0xdfcf09[_0xd5cd('0x23')],'text':_0xdfcf09['body'],'src':_0x153724[_0xd5cd('0x42')]||_0x153724[_0xd5cd('0x23')],'url':_0x153724[_0xd5cd('0x4d')]+_0xd5cd('0x26')+_0xdfcf09['id']+_0xd5cd('0x4e')+_0x153724[_0xd5cd('0x4f')]};var _0x4e0324=util[_0xd5cd('0x43')](_0xd5cd('0x44'),_0x153724[_0xd5cd('0x4c')],_0x153724['authToken']);var _0x434c8e={'method':_0xd5cd('0x32'),'uri':util['format']('https://api.plivo.com/v1/Account/%s/Message/',_0x153724[_0xd5cd('0x4c')]),'body':_0xe7835d,'headers':{'Authorization':util[_0xd5cd('0x43')](_0xd5cd('0x50'),new Buffer(_0x4e0324)[_0xd5cd('0x51')](_0xd5cd('0x45')))},'json':!![]};rp(_0x434c8e)[_0xd5cd('0x17')](function(_0x3914d3){var _0x36ecb5={'messageId':_0x3914d3[_0xd5cd('0x52')][0x0]};return _0x2a995a['update'](_0x36ecb5);})['catch'](function(_0x2fccd1){logger[_0xd5cd('0x1a')](_0xd5cd('0x28'),_0xd5cd('0x29'),_0xd5cd('0x4b'),util['inspect'](_0x2fccd1,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xd5cd('0x28'),_0xd5cd('0x29'),_0xd5cd('0x4b'),_0xd5cd('0x53'));}break;case _0xd5cd('0x54'):if(_0x153724[_0xd5cd('0x2c')]&&_0x153724[_0xd5cd('0x2d')]){if(_0x153724[_0xd5cd('0x55')]){var _0x2cbaa0={'method':_0xd5cd('0x32'),'uri':_0x153724[_0xd5cd('0x55')]+'/auth/1/session','body':{'username':_0x153724[_0xd5cd('0x2c')],'password':_0x153724[_0xd5cd('0x2d')]},'json':!![]};return rp(_0x2cbaa0)[_0xd5cd('0x17')](function(_0x2b09b9){var _0x132320={'method':'POST','uri':_0x153724[_0xd5cd('0x55')]+_0xd5cd('0x56'),'body':{'messages':[{'from':_0x153724['phone'],'destinations':[{'to':_0xdfcf09[_0xd5cd('0x23')]}],'text':_0xdfcf09[_0xd5cd('0xf')],'notifyUrl':_0x153724[_0xd5cd('0x4d')]+'/api/sms/messages/'+_0xdfcf09['id']+'/status?token='+_0x153724['token'],'notifyContentType':_0xd5cd('0x57'),'callbackData':_0x153724[_0xd5cd('0x23')]+';'+_0xdfcf09[_0xd5cd('0xf')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x2b09b9[_0xd5cd('0x4f')]},'json':!![]};return rp(_0x132320)[_0xd5cd('0x17')](function(_0x305008){if(_0x305008['messages']){var _0x4463c1={'messageId':_0x305008['messages'][0x0]['messageId']};if(!_0x153724['deliveryReport']){_0x4463c1['read']=!![];}return _0x2a995a['update'](_0x4463c1);}else{return logger['error'](_0xd5cd('0x28'),_0xd5cd('0x29'),_0xd5cd('0x54'),util['inspect'](_0x305008,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x25111e){return logger[_0xd5cd('0x1a')](_0xd5cd('0x28'),_0xd5cd('0x29'),_0xd5cd('0x54'),util[_0xd5cd('0x3a')](_0x25111e,{'showHidden':![],'depth':null}));});}else{logger[_0xd5cd('0x1a')](_0xd5cd('0x28'),_0xd5cd('0x29'),_0xd5cd('0x54'),_0xd5cd('0x58'));}}else{logger[_0xd5cd('0x1a')](_0xd5cd('0x28'),_0xd5cd('0x29'),'infobip','Missing\x20parameters:\x20username,\x20password');}break;case _0xd5cd('0x59'):var _0x339e99=require(_0xd5cd('0x5a'));if(_0x153724[_0xd5cd('0x5b')]){var _0x7e0408={};_0x7e0408['login']=_0x153724[_0xd5cd('0x2c')];_0x7e0408[_0xd5cd('0x23')]=_0xdfcf09['phone'];_0x7e0408[_0xd5cd('0x2f')]=_0x153724[_0xd5cd('0x23')];_0x7e0408['text']=_0xdfcf09['body'];_0x7e0408[_0xd5cd('0x5c')]=+new Date();var _0x2a8b6c='';var _0x5064b3='';var _0x192f7a=Object['keys'](_0x7e0408);_0x192f7a[_0xd5cd('0x5d')]();for(var _0x107a0c=0x0;_0x107a0c<_0x192f7a['length'];_0x107a0c++){if(_0x2a8b6c!=''){_0x2a8b6c+='&';}_0x2a8b6c+=_0x192f7a[_0x107a0c]+'='+encodeURIComponent(_0x7e0408[_0x192f7a[_0x107a0c]]);_0x5064b3+=_0x7e0408[_0x192f7a[_0x107a0c]];}_0x5064b3+=_0x153724[_0xd5cd('0x5b')];_0x5064b3=_0x339e99[_0xd5cd('0x5e')](_0xd5cd('0x5f'))[_0xd5cd('0x18')](_0x5064b3)[_0xd5cd('0x60')](_0xd5cd('0x61'));if(_0x2a8b6c!==''){_0x2a8b6c+='&';}_0x2a8b6c+=_0xd5cd('0x62')+_0x5064b3;var _0x17d5b6={'method':_0xd5cd('0x31'),'uri':_0x153724['baseUrl']+'/external/get/send.php?'+_0x2a8b6c,'json':!![]};return rp(_0x17d5b6)[_0xd5cd('0x17')](function(_0x2c62a1){var _0x3c05b6=Object['keys'](_0x2c62a1);if(_0x2c62a1[_0x3c05b6[0x0]][_0xd5cd('0x1a')]&&parseInt(_0x2c62a1[_0x3c05b6[0x0]][_0xd5cd('0x1a')])===0x0){var _0x46dc7c={'messageId':_0x2c62a1[_0x3c05b6[0x0]][_0xd5cd('0x63')]};if(!_0x153724['deliveryReport']){_0x46dc7c['read']=!![];}return _0x2a995a[_0xd5cd('0x18')](_0x46dc7c);}else{return logger['error'](_0xd5cd('0x28'),_0xd5cd('0x29'),_0xd5cd('0x59'),util[_0xd5cd('0x3a')](_0x2c62a1[_0xd5cd('0x1a')],{'showHidden':![],'depth':null}));}})[_0xd5cd('0x19')](function(_0xc69d8a){return logger[_0xd5cd('0x1a')](_0xd5cd('0x28'),_0xd5cd('0x29'),_0xd5cd('0x59'),util['inspect'](_0xc69d8a,{'showHidden':![],'depth':null}));});}else{logger[_0xd5cd('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd5cd('0x29'),_0xd5cd('0x59'),_0xd5cd('0x64'));}break;case _0xd5cd('0x65'):if(_0x153724['apiKey']){var _0x5aebd6={'method':_0xd5cd('0x32'),'uri':_0xd5cd('0x66'),'headers':{'Authorization':_0x153724[_0xd5cd('0x5b')]},'body':{'content':_0xdfcf09['body'],'to':[_0xdfcf09[_0xd5cd('0x23')]],'from':_0x153724[_0xd5cd('0x23')],'binary':![],'clientMessageId':_0xd5cd('0x67'),'charset':'UTF-8'},'json':!![]};rp(_0x5aebd6)['then'](function(_0x25d14a){if(!_0x25d14a[_0xd5cd('0x1a')]){var _0x18b403={'messageId':_0x25d14a[_0xd5cd('0x24')][0x0][_0xd5cd('0x68')]};if(!_0x153724[_0xd5cd('0x37')]){_0x18b403[_0xd5cd('0x38')]=!![];}return _0x2a995a['update'](_0x18b403);}else{return logger[_0xd5cd('0x1a')](_0xd5cd('0x28'),_0xd5cd('0x29'),_0xd5cd('0x65'),util['inspect'](_0x25d14a[_0xd5cd('0x1a')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x5c7c12){return logger[_0xd5cd('0x1a')](_0xd5cd('0x28'),_0xd5cd('0x29'),_0xd5cd('0x65'),util[_0xd5cd('0x3a')](_0x5c7c12,{'showHidden':![],'depth':null}));});}else{logger[_0xd5cd('0x1a')](_0xd5cd('0x28'),_0xd5cd('0x29'),_0xd5cd('0x65'),'Missing\x20parameters:\x20apiKey');}break;case _0xd5cd('0x69'):if(_0x153724[_0xd5cd('0x5b')]){var _0x4c2030={};var _0x17d5b6={'method':'POST','uri':_0xd5cd('0x6a'),'headers':{'Authorization':'Bearer\x20'+_0x153724[_0xd5cd('0x5b')],'Content-Type':_0xd5cd('0x57')},'body':{'from':_0x153724[_0xd5cd('0x23')],'to':_0xdfcf09[_0xd5cd('0x23')],'text':_0xdfcf09[_0xd5cd('0xf')]},'json':!![]};return rp(_0x17d5b6)[_0xd5cd('0x17')](function(_0x59ce6c){if(_0x59ce6c[_0xd5cd('0x6b')]==0xca){_0x4c2030['message']=_0x59ce6c;var _0x5aca95={'method':'POST','uri':_0xd5cd('0x6c'),'headers':{'Authorization':_0xd5cd('0x6d')+_0x153724[_0xd5cd('0x5b')],'Content-Type':_0xd5cd('0x57')},'body':{'refid':_0x4c2030['message']['refid']},'json':!![]};return rp(_0x5aca95)[_0xd5cd('0x17')](function(_0x4deaf4){_0x4c2030[_0xd5cd('0x6e')]=_0x4deaf4;var _0x22191b={'messageId':_0x4c2030[_0xd5cd('0x6f')][_0xd5cd('0x70')],'read':!![]};return _0x2a995a[_0xd5cd('0x18')](_0x22191b);});}else{return logger[_0xd5cd('0x1a')](_0xd5cd('0x28'),'afterCreate',_0xd5cd('0x69'),util[_0xd5cd('0x3a')](_0x59ce6c,{'showHidden':![],'depth':null}));}})[_0xd5cd('0x19')](function(_0x25029b){return logger[_0xd5cd('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','intelepeer',util['inspect'](_0x25029b,{'showHidden':![],'depth':null}));});}else{return logger[_0xd5cd('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd5cd('0x29'),_0xd5cd('0x69'),_0xd5cd('0x71'));}break;}}})[_0xd5cd('0x72')](function(){_0x3fcc6f();});}else{_0x3fcc6f();}}},'charset':_0xd5cd('0x73'),'collate':_0xd5cd('0x74')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index bf77908..e0c2c19 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(_0x48d633,_0x450470){var _0x550af1=function(_0x4c5152){while(--_0x4c5152){_0x48d633['push'](_0x48d633['shift']());}};_0x550af1(++_0x450470);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5622c2,_0x1337b1){_0x5622c2=_0x5622c2-0x0;var _0x15f4b8=_0x5f2f[_0x5622c2];return _0x15f4b8;};'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 _0x1a85=['info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsMessage','SmsMessage','create','options','raw','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','socket.io-emitter','register','request','then'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x1a85,0x178));var _0x51a8=function(_0x481778,_0x3591a2){_0x481778=_0x481778-0x0;var _0x180616=_0x1a85[_0x481778];return _0x180616;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});config['redis']=_[_0x51a8('0x8')](config[_0x51a8('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x51a8('0xa'))(new Redis(config['redis']));require('./smsMessage.socket')[_0x51a8('0xb')](socket);function respondWithRpcPromise(_0x2f276b,_0x1a476d,_0x45a3f4){return new BPromise(function(_0x418f06,_0x421fa4){return client[_0x51a8('0xc')](_0x2f276b,_0x45a3f4)[_0x51a8('0xd')](function(_0x34c887){logger[_0x51a8('0xe')](_0x51a8('0xf'),_0x1a476d,_0x51a8('0x10'));logger[_0x51a8('0x11')](_0x51a8('0x12'),_0x1a476d,_0x51a8('0x10'),JSON[_0x51a8('0x13')](_0x34c887));if(_0x34c887[_0x51a8('0x14')]){if(_0x34c887['error'][_0x51a8('0x15')]===0x1f4){logger[_0x51a8('0x14')](_0x51a8('0xf'),_0x1a476d,_0x34c887['error'][_0x51a8('0x16')]);return _0x421fa4(_0x34c887['error'][_0x51a8('0x16')]);}logger[_0x51a8('0x14')](_0x51a8('0xf'),_0x1a476d,_0x34c887[_0x51a8('0x14')][_0x51a8('0x16')]);return _0x418f06(_0x34c887[_0x51a8('0x14')][_0x51a8('0x16')]);}else{logger['info'](_0x51a8('0xf'),_0x1a476d,_0x51a8('0x10'));_0x418f06(_0x34c887[_0x51a8('0x17')][_0x51a8('0x16')]);}})[_0x51a8('0x18')](function(_0x544886){logger['error'](_0x51a8('0xf'),_0x1a476d,_0x544886);_0x421fa4(_0x544886);});});}exports[_0x51a8('0x19')]=function(_0x2217ce){var _0x2f2681=this;return new Promise(function(_0x2a4c4c,_0x3bc044){return db[_0x51a8('0x1a')][_0x51a8('0x1b')](_0x2217ce['body'],{'raw':_0x2217ce[_0x51a8('0x1c')]?_0x2217ce['options'][_0x51a8('0x1d')]===undefined?!![]:![]:!![]})[_0x51a8('0xd')](function(_0x8bda40){logger[_0x51a8('0xe')]('CreateSmsMessage',_0x2217ce);logger[_0x51a8('0x11')]('CreateSmsMessage',_0x2217ce,JSON['stringify'](_0x8bda40));_0x2a4c4c(_0x8bda40);})[_0x51a8('0x18')](function(_0x52e503){logger[_0x51a8('0x14')](_0x51a8('0x19'),_0x52e503[_0x51a8('0x16')],_0x2217ce);_0x3bc044(_0x2f2681[_0x51a8('0x14')](0x1f4,_0x52e503[_0x51a8('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 1425600..9786265 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 _0xefec=['emit','removeListener','register','length','smsMessage:','remove','update'];(function(_0xc2f5c2,_0x5c3145){var _0x21a2ec=function(_0x57bf8f){while(--_0x57bf8f){_0xc2f5c2['push'](_0xc2f5c2['shift']());}};_0x21a2ec(++_0x5c3145);}(_0xefec,0x1a2));var _0xcefe=function(_0x542a55,_0x44cf24){_0x542a55=_0x542a55-0x0;var _0x5598ad=_0xefec[_0x542a55];return _0x5598ad;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=['save',_0xcefe('0x0'),_0xcefe('0x1')];function createListener(_0x412947,_0x1a20a3){return function(_0x587fcc){_0x1a20a3[_0xcefe('0x2')](_0x412947,_0x587fcc);};}function removeListener(_0x14a68e,_0x35323b){return function(){SmsMessageEvents[_0xcefe('0x3')](_0x14a68e,_0x35323b);};}exports[_0xcefe('0x4')]=function(_0x2e0791){for(var _0x2dde84=0x0,_0x142ad0=events[_0xcefe('0x5')];_0x2dde84<_0x142ad0;_0x2dde84++){var _0x6d3083=events[_0x2dde84];var _0x4705ee=createListener(_0xcefe('0x6')+_0x6d3083,_0x2e0791);SmsMessageEvents['on'](_0x6d3083,_0x4705ee);}}; \ No newline at end of file +var _0x9d63=['length','smsMessage:','save','remove','update','emit','removeListener','register'];(function(_0x49c84e,_0x597200){var _0x25e64d=function(_0x1aab65){while(--_0x1aab65){_0x49c84e['push'](_0x49c84e['shift']());}};_0x25e64d(++_0x597200);}(_0x9d63,0x15a));var _0x39d6=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x9d63[_0x138f59];return _0x3d114d;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x39d6('0x0'),_0x39d6('0x1'),_0x39d6('0x2')];function createListener(_0x5ce728,_0x354af9){return function(_0x25d7d9){_0x354af9[_0x39d6('0x3')](_0x5ce728,_0x25d7d9);};}function removeListener(_0x3c1c21,_0x3a9870){return function(){SmsMessageEvents[_0x39d6('0x4')](_0x3c1c21,_0x3a9870);};}exports[_0x39d6('0x5')]=function(_0x271d9c){for(var _0x26dbae=0x0,_0x560146=events[_0x39d6('0x6')];_0x26dbae<_0x560146;_0x26dbae++){var _0x23eb58=events[_0x26dbae];var _0x31d3a8=createListener(_0x39d6('0x7')+_0x23eb58,_0x271d9c);SmsMessageEvents['on'](_0x23eb58,_0x31d3a8);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index da4b517..66213b4 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 _0x5f71=['get','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','express','../../config/environment','./smsQueue.controller','isAuthenticated','index'];(function(_0x4b2ed9,_0x5e49fb){var _0x2bb358=function(_0x568dce){while(--_0x568dce){_0x4b2ed9['push'](_0x4b2ed9['shift']());}};_0x2bb358(++_0x5e49fb);}(_0x5f71,0xc9));var _0x15f7=function(_0x5abd1a,_0x2610d0){_0x5abd1a=_0x5abd1a-0x0;var _0x86ab1b=_0x5f71[_0x5abd1a];return _0x86ab1b;};'use strict';var multer=require(_0x15f7('0x0'));var util=require('util');var path=require(_0x15f7('0x1'));var timeout=require('connect-timeout');var express=require(_0x15f7('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x15f7('0x3'));var controller=require(_0x15f7('0x4'));router['get']('/',auth[_0x15f7('0x5')](),controller[_0x15f7('0x6')]);router[_0x15f7('0x7')](_0x15f7('0x8'),auth[_0x15f7('0x5')](),controller[_0x15f7('0x9')]);router[_0x15f7('0x7')](_0x15f7('0xa'),auth[_0x15f7('0x5')](),controller[_0x15f7('0xb')]);router[_0x15f7('0x7')](_0x15f7('0xc'),auth['isAuthenticated'](),controller['getMembers']);router[_0x15f7('0x7')](_0x15f7('0xd'),auth['isAuthenticated'](),controller[_0x15f7('0xe')]);router[_0x15f7('0x7')](_0x15f7('0xf'),auth[_0x15f7('0x5')](),controller[_0x15f7('0x10')]);router[_0x15f7('0x11')]('/',auth[_0x15f7('0x5')](),controller['create']);router[_0x15f7('0x11')](_0x15f7('0xd'),auth[_0x15f7('0x5')](),controller['addTeams']);router[_0x15f7('0x11')](_0x15f7('0xf'),auth['isAuthenticated'](),controller[_0x15f7('0x12')]);router[_0x15f7('0x13')](_0x15f7('0xa'),auth[_0x15f7('0x5')](),controller[_0x15f7('0x14')]);router[_0x15f7('0x15')](_0x15f7('0xa'),auth['isAuthenticated'](),controller[_0x15f7('0x16')]);router[_0x15f7('0x15')]('/:id/teams',auth[_0x15f7('0x5')](),controller[_0x15f7('0x17')]);router[_0x15f7('0x15')](_0x15f7('0xf'),auth[_0x15f7('0x5')](),controller[_0x15f7('0x18')]);module[_0x15f7('0x19')]=router; \ No newline at end of file +var _0x01d9=['describe','/:id','show','/:id/members','getMembers','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','/describe'];(function(_0x317faf,_0x354aa9){var _0x432a45=function(_0x2b6819){while(--_0x2b6819){_0x317faf['push'](_0x317faf['shift']());}};_0x432a45(++_0x354aa9);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var path=require(_0x901d('0x2'));var timeout=require(_0x901d('0x3'));var express=require('express');var router=express[_0x901d('0x4')]();var auth=require(_0x901d('0x5'));var interaction=require(_0x901d('0x6'));var config=require(_0x901d('0x7'));var controller=require(_0x901d('0x8'));router[_0x901d('0x9')]('/',auth[_0x901d('0xa')](),controller['index']);router[_0x901d('0x9')](_0x901d('0xb'),auth[_0x901d('0xa')](),controller[_0x901d('0xc')]);router[_0x901d('0x9')](_0x901d('0xd'),auth[_0x901d('0xa')](),controller[_0x901d('0xe')]);router[_0x901d('0x9')](_0x901d('0xf'),auth[_0x901d('0xa')](),controller[_0x901d('0x10')]);router[_0x901d('0x9')]('/:id/teams',auth[_0x901d('0xa')](),controller['getTeams']);router[_0x901d('0x9')](_0x901d('0x11'),auth[_0x901d('0xa')](),controller[_0x901d('0x12')]);router[_0x901d('0x13')]('/',auth['isAuthenticated'](),controller[_0x901d('0x14')]);router[_0x901d('0x13')](_0x901d('0x15'),auth[_0x901d('0xa')](),controller[_0x901d('0x16')]);router[_0x901d('0x13')]('/:id/users',auth[_0x901d('0xa')](),controller[_0x901d('0x17')]);router[_0x901d('0x18')](_0x901d('0xd'),auth[_0x901d('0xa')](),controller[_0x901d('0x19')]);router[_0x901d('0x1a')](_0x901d('0xd'),auth[_0x901d('0xa')](),controller[_0x901d('0x1b')]);router[_0x901d('0x1a')](_0x901d('0x15'),auth[_0x901d('0xa')](),controller[_0x901d('0x1c')]);router[_0x901d('0x1a')](_0x901d('0x11'),auth[_0x901d('0xa')](),controller[_0x901d('0x1d')]);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 592d8a7..9b4079f 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 _0x4d7e=['roundrobin','sequelize','exports','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x2ed6e7,_0x3a0df6){var _0x2d7e84=function(_0x1669a6){while(--_0x1669a6){_0x2ed6e7['push'](_0x2ed6e7['shift']());}};_0x2d7e84(++_0x3a0df6);}(_0x4d7e,0xf9));var _0xe4d7=function(_0x52c408,_0x35f852){_0x52c408=_0x52c408-0x0;var _0x31ad08=_0x4d7e[_0x52c408];return _0x31ad08;};'use strict';var Sequelize=require(_0xe4d7('0x0'));module[_0xe4d7('0x1')]={'name':{'type':Sequelize[_0xe4d7('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe4d7('0x2')]},'timeout':{'type':Sequelize[_0xe4d7('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe4d7('0x4')](_0xe4d7('0x5'),_0xe4d7('0x6'),_0xe4d7('0x7'))}}; \ No newline at end of file +var _0xcef6=['rrmemory','beepall','roundrobin','sequelize','exports','name','STRING','ENUM'];(function(_0x4fe007,_0x159d81){var _0x21b59c=function(_0x3f70f1){while(--_0x3f70f1){_0x4fe007['push'](_0x4fe007['shift']());}};_0x21b59c(++_0x159d81);}(_0xcef6,0xa3));var _0x6cef=function(_0x3422bf,_0x21b1da){_0x3422bf=_0x3422bf-0x0;var _0x4de668=_0xcef6[_0x3422bf];return _0x4de668;};'use strict';var Sequelize=require(_0x6cef('0x0'));module[_0x6cef('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x6cef('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6cef('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6cef('0x4')](_0x6cef('0x5'),_0x6cef('0x6'),_0x6cef('0x7'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 044d9a4..092f65f 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 _0x57ca=['userSmsQueue:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','end','count','offset','json','apply','reject','save','update','then','destroy','get','SmsQueues','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','where','filter','merge','VIRTUAL','options','SmsQueue','rows','params','keys','includeAll','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','catch','describe','findOne','UserSmsQueue','sort','pick','SmsQueueId','findAll','findAndCountAll','UserId','smsPause','updatedAt','format','%s/%s','getTeams','Team','addTeams','ids','User','online','Agents','sequelize','each','emit','userSmsQueue:save','removeTeams','select','tq.TeamId','from','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','push','QueryTypes','TeamId','includes','all','union','compact','value','transaction','isEmpty','forEach','addAgents','omit','spread','removeAgents','isArray'];(function(_0x21d691,_0x114a69){var _0x5b6fe6=function(_0x141727){while(--_0x141727){_0x21d691['push'](_0x21d691['shift']());}};_0x5b6fe6(++_0x114a69);}(_0x57ca,0x108));var _0xa57c=function(_0x66dd96,_0xd86c27){_0x66dd96=_0x66dd96-0x0;var _0x2ddda2=_0x57ca[_0x66dd96];return _0x2ddda2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa57c('0x0'));var rimraf=require(_0xa57c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa57c('0x2'));var rp=require(_0xa57c('0x3'));var moment=require(_0xa57c('0x4'));var BPromise=require(_0xa57c('0x5'));var Mustache=require(_0xa57c('0x6'));var util=require('util');var path=require(_0xa57c('0x7'));var sox=require(_0xa57c('0x8'));var csv=require(_0xa57c('0x9'));var ejs=require(_0xa57c('0xa'));var fs=require('fs');var _=require(_0xa57c('0xb'));var squel=require(_0xa57c('0xc'));var crypto=require(_0xa57c('0xd'));var jsforce=require(_0xa57c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa57c('0x9'));var querystring=require('querystring');var Papa=require(_0xa57c('0xf'));var Redis=require(_0xa57c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa57c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa57c('0x12'));var logger=require(_0xa57c('0x13'))('api');var utils=require(_0xa57c('0x14'));var config=require('../../config/environment');var db=require(_0xa57c('0x15'))['db'];config[_0xa57c('0x16')]=_[_0xa57c('0x17')](config[_0xa57c('0x16')],{'host':_0xa57c('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa57c('0x16')]));require('./smsQueue.socket')[_0xa57c('0x19')](socket);function respondWithStatusCode(_0x3d5995,_0x30940d){_0x30940d=_0x30940d||0xcc;return function(_0x3821d2){if(_0x3821d2){return _0x3d5995[_0xa57c('0x1a')](_0x30940d);}return _0x3d5995[_0xa57c('0x1b')](_0x30940d)[_0xa57c('0x1c')]();};}function respondWithResult(_0x4b4bdb,_0x26607a){_0x26607a=_0x26607a||0xc8;return function(_0xdf7ff6){if(_0xdf7ff6){return _0x4b4bdb[_0xa57c('0x1b')](_0x26607a)['json'](_0xdf7ff6);}};}function respondWithFilteredResult(_0x2746a0,_0x5f33f1){return function(_0x3e7afa){if(_0x3e7afa){var _0x3d781d=_0x3e7afa[_0xa57c('0x1d')],_0x93462c=_0x5f33f1[_0xa57c('0x1e')],_0xe3d505=_0x5f33f1[_0xa57c('0x1e')]+_0x5f33f1['limit'],_0x1fd0d8;if(_0xe3d505>=_0x3d781d){_0xe3d505=_0x3d781d;_0x1fd0d8=0xc8;}else{_0x1fd0d8=0xce;}_0x2746a0[_0xa57c('0x1b')](_0x1fd0d8);return _0x2746a0['set']('Content-Range',_0x93462c+'-'+_0xe3d505+'/'+_0x3d781d)[_0xa57c('0x1f')](_0x3e7afa);}return null;};}function patchUpdates(_0xa5b314){return function(_0x3eee75){try{jsonpatch[_0xa57c('0x20')](_0x3eee75,_0xa5b314,!![]);}catch(_0x49242c){return BPromise[_0xa57c('0x21')](_0x49242c);}return _0x3eee75[_0xa57c('0x22')]();};}function saveUpdates(_0x34d1bc,_0x2213b2){return function(_0x3bb969){if(_0x3bb969){return _0x3bb969[_0xa57c('0x23')](_0x34d1bc)[_0xa57c('0x24')](function(_0x42038e){return _0x42038e;});}return null;};}function removeEntity(_0x2e99ed,_0xdf65dd){return function(_0x382a26){if(_0x382a26){return _0x382a26[_0xa57c('0x25')]()[_0xa57c('0x24')](function(){var _0x10a33d=_0x382a26[_0xa57c('0x26')]({'plain':!![]});var _0x511a26=_0xa57c('0x27');return db[_0xa57c('0x28')][_0xa57c('0x25')]({'where':{'type':_0x511a26,'resourceId':_0x10a33d['id']}})[_0xa57c('0x24')](function(){return _0x382a26;});})[_0xa57c('0x24')](function(){_0x2e99ed[_0xa57c('0x1b')](0xcc)[_0xa57c('0x1c')]();});}};}function handleEntityNotFound(_0xe50fb8,_0x337f97){return function(_0x1d59c2){if(!_0x1d59c2){_0xe50fb8['sendStatus'](0x194);}return _0x1d59c2;};}function handleError(_0x3b7364,_0x4c1478){_0x4c1478=_0x4c1478||0x1f4;return function(_0x54a18b){logger[_0xa57c('0x29')](_0x54a18b[_0xa57c('0x2a')]);if(_0x54a18b['name']){delete _0x54a18b[_0xa57c('0x2b')];}_0x3b7364[_0xa57c('0x1b')](_0x4c1478)[_0xa57c('0x2c')](_0x54a18b);};}exports['index']=function(_0xd779f1,_0x58d46f){var _0xf5f70c={},_0x5464f2={},_0x2a3bbe={'count':0x0,'rows':[]};var _0x51ad09=_[_0xa57c('0x2d')](db['SmsQueue'][_0xa57c('0x2e')],function(_0x1d82d9){return{'name':_0x1d82d9[_0xa57c('0x2f')],'type':_0x1d82d9[_0xa57c('0x30')][_0xa57c('0x31')]};});_0x5464f2[_0xa57c('0x32')]=_[_0xa57c('0x2d')](_0x51ad09,'name');_0x5464f2[_0xa57c('0x33')]=_['keys'](_0xd779f1[_0xa57c('0x33')]);_0x5464f2[_0xa57c('0x34')]=_[_0xa57c('0x35')](_0x5464f2['model'],_0x5464f2[_0xa57c('0x33')]);_0xf5f70c['attributes']=_[_0xa57c('0x35')](_0x5464f2['model'],qs[_0xa57c('0x36')](_0xd779f1['query'][_0xa57c('0x36')]));_0xf5f70c[_0xa57c('0x37')]=_0xf5f70c['attributes'][_0xa57c('0x38')]?_0xf5f70c['attributes']:_0x5464f2[_0xa57c('0x32')];if(!_0xd779f1['query'][_0xa57c('0x39')](_0xa57c('0x3a'))){_0xf5f70c[_0xa57c('0x3b')]=qs[_0xa57c('0x3b')](_0xd779f1[_0xa57c('0x33')][_0xa57c('0x3b')]);_0xf5f70c['offset']=qs['offset'](_0xd779f1[_0xa57c('0x33')][_0xa57c('0x1e')]);}_0xf5f70c[_0xa57c('0x3c')]=qs['sort'](_0xd779f1[_0xa57c('0x33')]['sort']);_0xf5f70c[_0xa57c('0x3d')]=qs[_0xa57c('0x34')](_['pick'](_0xd779f1['query'],_0x5464f2['filters']));if(_0xd779f1[_0xa57c('0x33')][_0xa57c('0x3e')]){_0xf5f70c[_0xa57c('0x3d')]=_[_0xa57c('0x3f')](_0xf5f70c[_0xa57c('0x3d')],{'$or':_[_0xa57c('0x2d')](_0x51ad09,function(_0x5a444a){if(_0x5a444a[_0xa57c('0x30')]!==_0xa57c('0x40')){var _0x5a5490={};_0x5a5490[_0x5a444a['name']]={'$like':'%'+_0xd779f1[_0xa57c('0x33')][_0xa57c('0x3e')]+'%'};return _0x5a5490;}})});}_0xf5f70c=_['merge']({},_0xf5f70c,_0xd779f1[_0xa57c('0x41')]);var _0x5603cf={'where':_0xf5f70c[_0xa57c('0x3d')]};return db[_0xa57c('0x42')][_0xa57c('0x1d')](_0x5603cf)[_0xa57c('0x24')](function(_0x5d210b){_0x2a3bbe[_0xa57c('0x1d')]=_0x5d210b;if(_0xd779f1['query']['includeAll']){_0xf5f70c['include']=[{'all':!![]}];}return db['SmsQueue']['findAll'](_0xf5f70c);})[_0xa57c('0x24')](function(_0x32ed25){_0x2a3bbe[_0xa57c('0x43')]=_0x32ed25;return _0x2a3bbe;})['then'](respondWithFilteredResult(_0x58d46f,_0xf5f70c))['catch'](handleError(_0x58d46f,null));};exports['show']=function(_0x44f1e8,_0x2755bc){var _0x44e38f={'raw':!![],'where':{'id':_0x44f1e8[_0xa57c('0x44')]['id']}},_0x40715e={};_0x40715e[_0xa57c('0x32')]=_['keys'](db[_0xa57c('0x42')][_0xa57c('0x2e')]);_0x40715e[_0xa57c('0x33')]=_[_0xa57c('0x45')](_0x44f1e8[_0xa57c('0x33')]);_0x40715e[_0xa57c('0x34')]=_['intersection'](_0x40715e[_0xa57c('0x32')],_0x40715e[_0xa57c('0x33')]);_0x44e38f[_0xa57c('0x37')]=_[_0xa57c('0x35')](_0x40715e[_0xa57c('0x32')],qs['fields'](_0x44f1e8[_0xa57c('0x33')][_0xa57c('0x36')]));_0x44e38f[_0xa57c('0x37')]=_0x44e38f[_0xa57c('0x37')][_0xa57c('0x38')]?_0x44e38f[_0xa57c('0x37')]:_0x40715e['model'];if(_0x44f1e8[_0xa57c('0x33')][_0xa57c('0x46')]){_0x44e38f[_0xa57c('0x47')]=[{'all':!![]}];}_0x44e38f=_[_0xa57c('0x3f')]({},_0x44e38f,_0x44f1e8[_0xa57c('0x41')]);return db[_0xa57c('0x42')]['find'](_0x44e38f)['then'](handleEntityNotFound(_0x2755bc,null))['then'](respondWithResult(_0x2755bc,null))['catch'](handleError(_0x2755bc,null));};exports[_0xa57c('0x48')]=function(_0x49492f,_0x273a17){return db[_0xa57c('0x42')]['create'](_0x49492f[_0xa57c('0x49')],{})[_0xa57c('0x24')](function(_0x368e87){var _0x128ea2=_0x49492f[_0xa57c('0x4a')]['get']({'plain':!![]});if(!_0x128ea2)throw new Error(_0xa57c('0x4b'));if(_0x128ea2[_0xa57c('0x4c')]===_0xa57c('0x4a')){var _0xd57bac=_0x368e87[_0xa57c('0x26')]({'plain':!![]});var _0x5ace6d=_0xa57c('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x5ace6d,'userProfileId':_0x128ea2[_0xa57c('0x4d')]},'raw':!![]})[_0xa57c('0x24')](function(_0x5ded49){if(_0x5ded49&&_0x5ded49['autoAssociation']===0x0){return db['UserProfileResource'][_0xa57c('0x48')]({'name':_0xd57bac[_0xa57c('0x2b')],'resourceId':_0xd57bac['id'],'type':_0x5ded49[_0xa57c('0x2b')],'sectionId':_0x5ded49['id']},{})[_0xa57c('0x24')](function(){return _0x368e87;});}else{return _0x368e87;}})['catch'](function(_0x3c450f){logger[_0xa57c('0x29')](_0xa57c('0x4e'),_0x3c450f);throw _0x3c450f;});}return _0x368e87;})['then'](respondWithResult(_0x273a17,0xc9))['catch'](handleError(_0x273a17,null));};exports[_0xa57c('0x23')]=function(_0x25fc6b,_0x4d5d46){if(_0x25fc6b[_0xa57c('0x49')]['id']){delete _0x25fc6b[_0xa57c('0x49')]['id'];}return db[_0xa57c('0x42')][_0xa57c('0x4f')]({'where':{'id':_0x25fc6b[_0xa57c('0x44')]['id']}})[_0xa57c('0x24')](handleEntityNotFound(_0x4d5d46,null))[_0xa57c('0x24')](saveUpdates(_0x25fc6b['body'],null))['then'](respondWithResult(_0x4d5d46,null))[_0xa57c('0x50')](handleError(_0x4d5d46,null));};exports[_0xa57c('0x25')]=function(_0x2fd759,_0x2a6538){return db[_0xa57c('0x42')][_0xa57c('0x4f')]({'where':{'id':_0x2fd759[_0xa57c('0x44')]['id']}})[_0xa57c('0x24')](handleEntityNotFound(_0x2a6538,null))['then'](removeEntity(_0x2a6538,null))['catch'](handleError(_0x2a6538,null));};exports[_0xa57c('0x51')]=function(_0x4e18ad,_0x1880e6){return db[_0xa57c('0x42')][_0xa57c('0x51')]()['then'](respondWithResult(_0x1880e6,null))[_0xa57c('0x50')](handleError(_0x1880e6,null));};exports['getMembers']=function(_0x21b00a,_0x4b3416,_0x39484d){var _0x170187={'raw':!![],'where':{}},_0x398743={},_0x26a8e1;return db['SmsQueue'][_0xa57c('0x52')]({'where':{'id':_0x21b00a[_0xa57c('0x44')]['id']}})[_0xa57c('0x24')](handleEntityNotFound(_0x4b3416,null))[_0xa57c('0x24')](function(_0x3345d5){if(_0x3345d5){_0x26a8e1=_0x3345d5['get']({'plain':!![]});_0x398743[_0xa57c('0x32')]=_[_0xa57c('0x45')](db[_0xa57c('0x53')][_0xa57c('0x2e')]);_0x398743[_0xa57c('0x33')]=_[_0xa57c('0x45')](_0x21b00a[_0xa57c('0x33')]);_0x398743[_0xa57c('0x34')]=_[_0xa57c('0x35')](_0x398743[_0xa57c('0x32')],_0x398743['query']);_0x170187[_0xa57c('0x37')]=_[_0xa57c('0x35')](_0x398743[_0xa57c('0x32')],qs[_0xa57c('0x36')](_0x21b00a[_0xa57c('0x33')][_0xa57c('0x36')]));_0x170187['attributes']=_0x170187[_0xa57c('0x37')][_0xa57c('0x38')]?_0x170187['attributes']:_0x398743[_0xa57c('0x32')];if(!_0x21b00a[_0xa57c('0x33')][_0xa57c('0x39')](_0xa57c('0x3a'))){_0x170187[_0xa57c('0x3b')]=qs[_0xa57c('0x3b')](_0x21b00a[_0xa57c('0x33')]['limit']);_0x170187[_0xa57c('0x1e')]=qs['offset'](_0x21b00a[_0xa57c('0x33')]['offset']);}_0x170187[_0xa57c('0x3c')]=qs['sort'](_0x21b00a[_0xa57c('0x33')][_0xa57c('0x54')]);_0x170187['where']=qs[_0xa57c('0x34')](_[_0xa57c('0x55')](_0x21b00a[_0xa57c('0x33')],_0x398743[_0xa57c('0x34')]));_0x170187['where'][_0xa57c('0x56')]=_0x3345d5['id'];if(_0x21b00a[_0xa57c('0x33')][_0xa57c('0x3e')]){_0x170187[_0xa57c('0x3d')]=_[_0xa57c('0x3f')](_0x170187[_0xa57c('0x3d')],{'$or':_[_0xa57c('0x2d')](_0x170187[_0xa57c('0x37')],function(_0x11c13e){var _0x428ac0={};_0x428ac0[_0x11c13e]={'$like':'%'+_0x21b00a[_0xa57c('0x33')][_0xa57c('0x3e')]+'%'};return _0x428ac0;})});}_0x170187=_[_0xa57c('0x3f')]({},_0x170187,_0x21b00a[_0xa57c('0x41')]);return db[_0xa57c('0x53')][_0xa57c('0x57')](_0x170187);}})['then'](function(_0x393119){if(_0x393119){return db['User'][_0xa57c('0x58')]({'where':{'id':_[_0xa57c('0x2d')](_0x393119,_0xa57c('0x59')),'role':'agent'},'attributes':['id',_0xa57c('0x2b'),_0xa57c('0x5a'),_0xa57c('0x5b'),'createdAt']});}})['then'](function(_0x20ff5f){if(_0x20ff5f){return{'count':_0x20ff5f[_0xa57c('0x1d')],'rows':_[_0xa57c('0x2d')](_0x20ff5f[_0xa57c('0x43')],function(_0x3fd9aa){return{'membername':_0x3fd9aa[_0xa57c('0x2b')],'UserId':_0x3fd9aa['id'],'queue_name':_0x26a8e1[_0xa57c('0x2b')],'SmsQueueId':_0x26a8e1['id'],'interface':util[_0xa57c('0x5c')](_0xa57c('0x5d'),'SIP',_0x3fd9aa[_0xa57c('0x2b')]),'penalty':0x0,'paused':_0x3fd9aa[_0xa57c('0x5a')],'createdAt':_0x3fd9aa['createdAt'],'updatedAt':_0x3fd9aa[_0xa57c('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa57c('0x24')](respondWithFilteredResult(_0x4b3416,_0x170187))[_0xa57c('0x50')](handleError(_0x4b3416,null));};exports[_0xa57c('0x5e')]=function(_0x1bb561,_0x28ec46,_0x42763b){var _0x10616e={};var _0x5a457d={};var _0x2960fd;var _0x29bf7f;return db['SmsQueue'][_0xa57c('0x52')]({'where':{'id':_0x1bb561[_0xa57c('0x44')]['id']}})['then'](handleEntityNotFound(_0x28ec46,null))['then'](function(_0x30dac7){if(_0x30dac7){_0x2960fd=_0x30dac7;_0x5a457d[_0xa57c('0x32')]=_[_0xa57c('0x45')](db[_0xa57c('0x5f')][_0xa57c('0x2e')]);_0x5a457d['query']=_[_0xa57c('0x45')](_0x1bb561[_0xa57c('0x33')]);_0x5a457d[_0xa57c('0x34')]=_['intersection'](_0x5a457d[_0xa57c('0x32')],_0x5a457d['query']);_0x10616e[_0xa57c('0x37')]=_[_0xa57c('0x35')](_0x5a457d[_0xa57c('0x32')],qs[_0xa57c('0x36')](_0x1bb561['query'][_0xa57c('0x36')]));_0x10616e[_0xa57c('0x37')]=_0x10616e[_0xa57c('0x37')][_0xa57c('0x38')]?_0x10616e['attributes']:_0x5a457d[_0xa57c('0x32')];_0x10616e[_0xa57c('0x3c')]=qs[_0xa57c('0x54')](_0x1bb561['query'][_0xa57c('0x54')]);_0x10616e[_0xa57c('0x3d')]=qs[_0xa57c('0x34')](_['pick'](_0x1bb561[_0xa57c('0x33')],_0x5a457d[_0xa57c('0x34')]));if(_0x1bb561[_0xa57c('0x33')][_0xa57c('0x3e')]){_0x10616e['where']=_[_0xa57c('0x3f')](_0x10616e[_0xa57c('0x3d')],{'$or':_['map'](_0x10616e[_0xa57c('0x37')],function(_0x1157ea){var _0x59d2a2={};_0x59d2a2[_0x1157ea]={'$like':'%'+_0x1bb561[_0xa57c('0x33')]['filter']+'%'};return _0x59d2a2;})});}_0x10616e=_[_0xa57c('0x3f')]({},_0x10616e,_0x1bb561[_0xa57c('0x41')]);return _0x2960fd[_0xa57c('0x5e')](_0x10616e);}})[_0xa57c('0x24')](function(_0x599408){if(_0x599408){_0x29bf7f=_0x599408[_0xa57c('0x38')];if(!_0x1bb561[_0xa57c('0x33')][_0xa57c('0x39')](_0xa57c('0x3a'))){_0x10616e[_0xa57c('0x3b')]=qs[_0xa57c('0x3b')](_0x1bb561[_0xa57c('0x33')][_0xa57c('0x3b')]);_0x10616e[_0xa57c('0x1e')]=qs[_0xa57c('0x1e')](_0x1bb561[_0xa57c('0x33')]['offset']);}return _0x2960fd['getTeams'](_0x10616e);}})['then'](function(_0x29b491){if(_0x29b491){return _0x29b491?{'count':_0x29bf7f,'rows':_0x29b491}:null;}})['then'](respondWithResult(_0x28ec46,null))[_0xa57c('0x50')](handleError(_0x28ec46,null));};exports[_0xa57c('0x60')]=function(_0x193705,_0x4c543a,_0x21c428){var _0x3e7946=_0x193705[_0xa57c('0x49')][_0xa57c('0x61')];return db[_0xa57c('0x5f')][_0xa57c('0x57')]({'where':{'id':_0x3e7946},'attributes':['id'],'include':[{'model':db[_0xa57c('0x62')],'as':'Agents','attributes':['id',_0xa57c('0x2b'),_0xa57c('0x63'),'voicePause','interface'],'raw':!![]}]})[_0xa57c('0x24')](function(_0x201983){if(_0x201983){var _0x4fc97e=_['flatMap'](_0x201983,function(_0xc5f17e){var _0x4962ae=_0xc5f17e[_0xa57c('0x26')]({'plain':!![]});return _0x4962ae[_0xa57c('0x64')];});return db['SmsQueue'][_0xa57c('0x4f')]({'where':{'id':_0x193705[_0xa57c('0x44')]['id']}})[_0xa57c('0x24')](function(_0x3df8f5){return db[_0xa57c('0x65')]['transaction'](function(_0x17fc78){return _0x3df8f5['addTeams'](_0x3e7946,{'transaction':_0x17fc78})[_0xa57c('0x24')](function(){return BPromise[_0xa57c('0x66')](_0x4fc97e,function(_0x4a2b64){return db['UserSmsQueue']['findOrCreate']({'where':{'UserId':_0x4a2b64['id'],'SmsQueueId':_0x193705[_0xa57c('0x44')]['id']},'transaction':_0x17fc78});});})['then'](function(){_0x4fc97e['forEach'](function(_0x175253){socket[_0xa57c('0x67')](_0xa57c('0x68'),{'UserId':_0x175253['id'],'SmsQueueId':_0x3df8f5['id']});});});});});}})['then'](respondWithStatusCode(_0x4c543a,null))[_0xa57c('0x50')](handleError(_0x4c543a,null));};exports[_0xa57c('0x69')]=function(_0x11e592,_0x5bbb59,_0x4b8228){return db[_0xa57c('0x5f')]['findAll']({'where':{'id':_0x11e592[_0xa57c('0x33')][_0xa57c('0x61')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa57c('0x64'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5bbb59,null))['then'](function(_0x5db013){var _0x6825df=_['map'](_0x5db013,'id');var _0x5143c0=[];var _0x542194=[];var _0x3e12e5=squel[_0xa57c('0x6a')]();_0x3e12e5['field'](_0xa57c('0x6b'))[_0xa57c('0x6c')](_0xa57c('0x6d'),'tq')['join'](_0xa57c('0x6e'),'ut',_0xa57c('0x6f'))[_0xa57c('0x3d')](_0xa57c('0x70'),_0x11e592['params']['id']);for(var _0x5e0db8=0x0;_0x5e0db8<_0x5db013[_0xa57c('0x38')];_0x5e0db8+=0x1){let _0x512e3d=_0x5db013[_0x5e0db8];for(var _0x121343=0x0;_0x121343<_0x512e3d[_0xa57c('0x64')][_0xa57c('0x38')];_0x121343+=0x1){let _0x4dc6ac=_0x512e3d[_0xa57c('0x64')][_0x121343];var _0x513f24=_0x3e12e5['clone']();_0x513f24[_0xa57c('0x3d')]('ut.UserId\x20=\x20?',_0x4dc6ac['id']);_0x542194[_0xa57c('0x71')](db[_0xa57c('0x65')]['query'](_0x513f24['toString'](),{'type':db[_0xa57c('0x65')][_0xa57c('0x72')]['SELECT']})['then'](function(_0x2550bc){if(_0x2550bc[_0xa57c('0x38')]===0x1){return _0x4dc6ac['id'];}else{var _0xa09ff=_['every'](_[_0xa57c('0x2d')](_0x2550bc,_0xa57c('0x73')),function(_0xb51336){return _[_0xa57c('0x74')](_0x6825df,_0xb51336);});if(_0xa09ff){return _0x4dc6ac['id'];}}}));}}return BPromise[_0xa57c('0x75')](_0x542194)[_0xa57c('0x24')](function(_0x10f1b5){_0x5143c0=_(_0x5143c0)[_0xa57c('0x76')](_0x10f1b5)[_0xa57c('0x77')]()[_0xa57c('0x78')]();return db[_0xa57c('0x42')][_0xa57c('0x4f')]({'where':{'id':_0x11e592[_0xa57c('0x44')]['id']}})['then'](function(_0x89be65){return db[_0xa57c('0x65')][_0xa57c('0x79')](function(_0x107ebd){return _0x89be65[_0xa57c('0x69')](_0x11e592[_0xa57c('0x33')]['ids'],{'transaction':_0x107ebd})['then'](function(){if(!_[_0xa57c('0x7a')](_0x5143c0)){return _0x89be65['removeAgents'](_0x5143c0,{'transaction':_0x107ebd});}})['then'](function(){_0x5143c0[_0xa57c('0x7b')](function(_0x138edd){socket[_0xa57c('0x67')]('userSmsQueue:remove',{'UserId':_0x138edd,'SmsQueueId':_0x89be65['id']});});});});});});})[_0xa57c('0x24')](respondWithStatusCode(_0x5bbb59,null))[_0xa57c('0x50')](handleError(_0x5bbb59,null));};exports[_0xa57c('0x7c')]=function(_0x2c0db4,_0x3eb06d,_0x4cabef){return db['SmsQueue'][_0xa57c('0x4f')]({'where':{'id':_0x2c0db4[_0xa57c('0x44')]['id']}})[_0xa57c('0x24')](handleEntityNotFound(_0x3eb06d,null))['then'](function(_0x3f2152){if(_0x3f2152){return _0x3f2152['addAgents'](_0x2c0db4[_0xa57c('0x49')][_0xa57c('0x61')],_[_0xa57c('0x7d')](_0x2c0db4[_0xa57c('0x49')],[_0xa57c('0x61'),'id'])||{})[_0xa57c('0x7e')](function(_0xda3db4){for(var _0x5c76b0=0x0;_0x5c76b0<_0x2c0db4['body'][_0xa57c('0x61')][_0xa57c('0x38')];_0x5c76b0+=0x1){socket[_0xa57c('0x67')]('userSmsQueue:save',{'UserId':_0x2c0db4['body'][_0xa57c('0x61')][_0x5c76b0],'SmsQueueId':_0x2c0db4[_0xa57c('0x44')]['id']});}return _0xda3db4;});}})[_0xa57c('0x24')](respondWithResult(_0x3eb06d,null))[_0xa57c('0x50')](handleError(_0x3eb06d,null));};exports[_0xa57c('0x7f')]=function(_0x58a3c9,_0x41ffe3,_0x28dc85){return db[_0xa57c('0x42')]['find']({'where':{'id':_0x58a3c9[_0xa57c('0x44')]['id']}})[_0xa57c('0x24')](handleEntityNotFound(_0x41ffe3,null))['then'](function(_0x1883b8){if(_0x1883b8){return _0x1883b8[_0xa57c('0x7f')](_0x58a3c9[_0xa57c('0x33')][_0xa57c('0x61')])[_0xa57c('0x24')](function(){if(_[_0xa57c('0x80')](_0x58a3c9[_0xa57c('0x33')][_0xa57c('0x61')])){for(var _0x16e745=0x0;_0x16e745<_0x58a3c9['query'][_0xa57c('0x61')][_0xa57c('0x38')];_0x16e745+=0x1){socket[_0xa57c('0x67')](_0xa57c('0x81'),{'UserId':Number(_0x58a3c9['query']['ids'][_0x16e745]),'SmsQueueId':Number(_0x58a3c9[_0xa57c('0x44')]['id'])});}}else{socket['emit'](_0xa57c('0x81'),{'UserId':Number(_0x58a3c9['query'][_0xa57c('0x61')]),'SmsQueueId':Number(_0x58a3c9['params']['id'])});}});}})['then'](respondWithStatusCode(_0x41ffe3,null))[_0xa57c('0x50')](handleError(_0x41ffe3,null));};exports['getAgents']=function(_0x3facda,_0x5a4843,_0x1ecfa9){var _0x3698aa={};var _0x129a89={};var _0x422849;var _0x5abf60;return db['SmsQueue'][_0xa57c('0x52')]({'where':{'id':_0x3facda[_0xa57c('0x44')]['id']}})['then'](handleEntityNotFound(_0x5a4843,null))[_0xa57c('0x24')](function(_0xeb14ed){if(_0xeb14ed){_0x422849=_0xeb14ed;_0x129a89[_0xa57c('0x32')]=_[_0xa57c('0x45')](db[_0xa57c('0x62')][_0xa57c('0x2e')]);_0x129a89[_0xa57c('0x33')]=_[_0xa57c('0x45')](_0x3facda[_0xa57c('0x33')]);_0x129a89[_0xa57c('0x34')]=_['intersection'](_0x129a89['model'],_0x129a89[_0xa57c('0x33')]);_0x3698aa['attributes']=_[_0xa57c('0x35')](_0x129a89[_0xa57c('0x32')],qs[_0xa57c('0x36')](_0x3facda['query'][_0xa57c('0x36')]));_0x3698aa['attributes']=_0x3698aa['attributes'][_0xa57c('0x38')]?_0x3698aa[_0xa57c('0x37')]:_0x129a89[_0xa57c('0x32')];_0x3698aa[_0xa57c('0x3c')]=qs['sort'](_0x3facda[_0xa57c('0x33')]['sort']);_0x3698aa['where']=qs['filters'](_[_0xa57c('0x55')](_0x3facda[_0xa57c('0x33')],_0x129a89[_0xa57c('0x34')]));if(_0x3facda[_0xa57c('0x33')]['filter']){_0x3698aa[_0xa57c('0x3d')]=_['merge'](_0x3698aa[_0xa57c('0x3d')],{'$or':_[_0xa57c('0x2d')](_0x3698aa['attributes'],function(_0x2ca1af){var _0x287b5c={};_0x287b5c[_0x2ca1af]={'$like':'%'+_0x3facda[_0xa57c('0x33')][_0xa57c('0x3e')]+'%'};return _0x287b5c;})});}_0x3698aa=_[_0xa57c('0x3f')]({},_0x3698aa,_0x3facda['options']);return _0x422849[_0xa57c('0x82')](_0x3698aa);}})['then'](function(_0x185ee5){if(_0x185ee5){_0x5abf60=_0x185ee5[_0xa57c('0x38')];if(!_0x3facda[_0xa57c('0x33')][_0xa57c('0x39')](_0xa57c('0x3a'))){_0x3698aa[_0xa57c('0x3b')]=qs[_0xa57c('0x3b')](_0x3facda[_0xa57c('0x33')][_0xa57c('0x3b')]);_0x3698aa[_0xa57c('0x1e')]=qs['offset'](_0x3facda[_0xa57c('0x33')][_0xa57c('0x1e')]);}return _0x422849['getAgents'](_0x3698aa);}})['then'](function(_0x525865){if(_0x525865){return _0x525865?{'count':_0x5abf60,'rows':_0x525865}:null;}})[_0xa57c('0x24')](respondWithResult(_0x5a4843,null))[_0xa57c('0x50')](handleError(_0x5a4843,null));}; \ No newline at end of file +var _0x8603=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','SmsQueues','UserProfileResource','error','name','send','index','SmsQueue','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','VIRTUAL','filter','merge','then','includeAll','include','findAll','rows','show','keys','rawAttributes','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','SmsQueueId','UserSmsQueue','User','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','getTeams','Team','addTeams','ids','Agents','online','interface','flatMap','each','findOrCreate','emit','userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','sequelize','SELECT','every','includes','all','compact','transaction','isEmpty','removeAgents','forEach','addAgents','omit','spread','isArray','userSmsQueue:remove','getAgents','order','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','querystring','papaparse'];(function(_0x153597,_0x492f6f){var _0x27d9de=function(_0x42f31f){while(--_0x42f31f){_0x153597['push'](_0x153597['shift']());}};_0x27d9de(++_0x492f6f);}(_0x8603,0x190));var _0x3860=function(_0x28a180,_0x5bb5b0){_0x28a180=_0x28a180-0x0;var _0x1161d3=_0x8603[_0x28a180];return _0x1161d3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3860('0x0'));var rimraf=require(_0x3860('0x1'));var zipdir=require(_0x3860('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3860('0x3'));var BPromise=require(_0x3860('0x4'));var Mustache=require(_0x3860('0x5'));var util=require('util');var path=require(_0x3860('0x6'));var sox=require('sox');var csv=require(_0x3860('0x7'));var ejs=require(_0x3860('0x8'));var fs=require('fs');var _=require(_0x3860('0x9'));var squel=require(_0x3860('0xa'));var crypto=require(_0x3860('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3860('0xc'));var Papa=require(_0x3860('0xd'));var Redis=require('ioredis');var authService=require(_0x3860('0xe'));var qs=require(_0x3860('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3860('0x10'));var logger=require(_0x3860('0x11'))('api');var utils=require(_0x3860('0x12'));var config=require(_0x3860('0x13'));var db=require('../../mysqldb')['db'];config[_0x3860('0x14')]=_[_0x3860('0x15')](config[_0x3860('0x14')],{'host':_0x3860('0x16'),'port':0x18eb});var socket=require(_0x3860('0x17'))(new Redis(config[_0x3860('0x14')]));require(_0x3860('0x18'))[_0x3860('0x19')](socket);function respondWithStatusCode(_0x465d8d,_0x46264d){_0x46264d=_0x46264d||0xcc;return function(_0x54dbc3){if(_0x54dbc3){return _0x465d8d[_0x3860('0x1a')](_0x46264d);}return _0x465d8d[_0x3860('0x1b')](_0x46264d)[_0x3860('0x1c')]();};}function respondWithResult(_0x37d9ab,_0x1055b3){_0x1055b3=_0x1055b3||0xc8;return function(_0xfa0c9a){if(_0xfa0c9a){return _0x37d9ab[_0x3860('0x1b')](_0x1055b3)[_0x3860('0x1d')](_0xfa0c9a);}};}function respondWithFilteredResult(_0x311fdb,_0x3c0d91){return function(_0x3e51b4){if(_0x3e51b4){var _0x45b799=_0x3e51b4[_0x3860('0x1e')],_0x4b6b15=_0x3c0d91[_0x3860('0x1f')],_0x4863bd=_0x3c0d91['offset']+_0x3c0d91[_0x3860('0x20')],_0x373b06;if(_0x4863bd>=_0x45b799){_0x4863bd=_0x45b799;_0x373b06=0xc8;}else{_0x373b06=0xce;}_0x311fdb[_0x3860('0x1b')](_0x373b06);return _0x311fdb[_0x3860('0x21')](_0x3860('0x22'),_0x4b6b15+'-'+_0x4863bd+'/'+_0x45b799)[_0x3860('0x1d')](_0x3e51b4);}return null;};}function patchUpdates(_0x45081f){return function(_0xc06ba1){try{jsonpatch[_0x3860('0x23')](_0xc06ba1,_0x45081f,!![]);}catch(_0x21d179){return BPromise[_0x3860('0x24')](_0x21d179);}return _0xc06ba1[_0x3860('0x25')]();};}function saveUpdates(_0x2e0b6e,_0x280ea9){return function(_0x9eaaa1){if(_0x9eaaa1){return _0x9eaaa1[_0x3860('0x26')](_0x2e0b6e)['then'](function(_0xfc10a5){return _0xfc10a5;});}return null;};}function removeEntity(_0x133093,_0x2b91f2){return function(_0x301e03){if(_0x301e03){return _0x301e03[_0x3860('0x27')]()['then'](function(){var _0x29ea87=_0x301e03['get']({'plain':!![]});var _0x577750=_0x3860('0x28');return db[_0x3860('0x29')]['destroy']({'where':{'type':_0x577750,'resourceId':_0x29ea87['id']}})['then'](function(){return _0x301e03;});})['then'](function(){_0x133093[_0x3860('0x1b')](0xcc)[_0x3860('0x1c')]();});}};}function handleEntityNotFound(_0xb25cc2,_0x371f3a){return function(_0x9332a5){if(!_0x9332a5){_0xb25cc2[_0x3860('0x1a')](0x194);}return _0x9332a5;};}function handleError(_0x544b9a,_0x4c4314){_0x4c4314=_0x4c4314||0x1f4;return function(_0x389bd0){logger[_0x3860('0x2a')](_0x389bd0['stack']);if(_0x389bd0[_0x3860('0x2b')]){delete _0x389bd0[_0x3860('0x2b')];}_0x544b9a[_0x3860('0x1b')](_0x4c4314)[_0x3860('0x2c')](_0x389bd0);};}exports[_0x3860('0x2d')]=function(_0x4bbae9,_0x36ae2b){var _0xf624ba={},_0x367b14={},_0x4bd90c={'count':0x0,'rows':[]};var _0x45d24f=_['map'](db[_0x3860('0x2e')]['rawAttributes'],function(_0x1c498c){return{'name':_0x1c498c[_0x3860('0x2f')],'type':_0x1c498c[_0x3860('0x30')]['key']};});_0x367b14[_0x3860('0x31')]=_[_0x3860('0x32')](_0x45d24f,'name');_0x367b14[_0x3860('0x33')]=_['keys'](_0x4bbae9[_0x3860('0x33')]);_0x367b14[_0x3860('0x34')]=_[_0x3860('0x35')](_0x367b14[_0x3860('0x31')],_0x367b14[_0x3860('0x33')]);_0xf624ba[_0x3860('0x36')]=_[_0x3860('0x35')](_0x367b14['model'],qs[_0x3860('0x37')](_0x4bbae9[_0x3860('0x33')]['fields']));_0xf624ba[_0x3860('0x36')]=_0xf624ba[_0x3860('0x36')][_0x3860('0x38')]?_0xf624ba['attributes']:_0x367b14['model'];if(!_0x4bbae9[_0x3860('0x33')][_0x3860('0x39')](_0x3860('0x3a'))){_0xf624ba[_0x3860('0x20')]=qs['limit'](_0x4bbae9['query'][_0x3860('0x20')]);_0xf624ba[_0x3860('0x1f')]=qs[_0x3860('0x1f')](_0x4bbae9[_0x3860('0x33')][_0x3860('0x1f')]);}_0xf624ba['order']=qs[_0x3860('0x3b')](_0x4bbae9[_0x3860('0x33')]['sort']);_0xf624ba['where']=qs[_0x3860('0x34')](_[_0x3860('0x3c')](_0x4bbae9[_0x3860('0x33')],_0x367b14[_0x3860('0x34')]));if(_0x4bbae9[_0x3860('0x33')]['filter']){_0xf624ba[_0x3860('0x3d')]=_['merge'](_0xf624ba[_0x3860('0x3d')],{'$or':_[_0x3860('0x32')](_0x45d24f,function(_0x53d443){if(_0x53d443[_0x3860('0x30')]!==_0x3860('0x3e')){var _0x4f3303={};_0x4f3303[_0x53d443[_0x3860('0x2b')]]={'$like':'%'+_0x4bbae9[_0x3860('0x33')][_0x3860('0x3f')]+'%'};return _0x4f3303;}})});}_0xf624ba=_[_0x3860('0x40')]({},_0xf624ba,_0x4bbae9['options']);var _0x312ffc={'where':_0xf624ba[_0x3860('0x3d')]};return db[_0x3860('0x2e')]['count'](_0x312ffc)[_0x3860('0x41')](function(_0x4e27c4){_0x4bd90c[_0x3860('0x1e')]=_0x4e27c4;if(_0x4bbae9[_0x3860('0x33')][_0x3860('0x42')]){_0xf624ba[_0x3860('0x43')]=[{'all':!![]}];}return db[_0x3860('0x2e')][_0x3860('0x44')](_0xf624ba);})['then'](function(_0xbbbf01){_0x4bd90c[_0x3860('0x45')]=_0xbbbf01;return _0x4bd90c;})['then'](respondWithFilteredResult(_0x36ae2b,_0xf624ba))['catch'](handleError(_0x36ae2b,null));};exports[_0x3860('0x46')]=function(_0x5840f7,_0x4f2f53){var _0x164a77={'raw':!![],'where':{'id':_0x5840f7['params']['id']}},_0x30d8eb={};_0x30d8eb[_0x3860('0x31')]=_[_0x3860('0x47')](db[_0x3860('0x2e')][_0x3860('0x48')]);_0x30d8eb[_0x3860('0x33')]=_[_0x3860('0x47')](_0x5840f7[_0x3860('0x33')]);_0x30d8eb[_0x3860('0x34')]=_[_0x3860('0x35')](_0x30d8eb[_0x3860('0x31')],_0x30d8eb[_0x3860('0x33')]);_0x164a77[_0x3860('0x36')]=_[_0x3860('0x35')](_0x30d8eb['model'],qs[_0x3860('0x37')](_0x5840f7['query'][_0x3860('0x37')]));_0x164a77[_0x3860('0x36')]=_0x164a77[_0x3860('0x36')][_0x3860('0x38')]?_0x164a77[_0x3860('0x36')]:_0x30d8eb[_0x3860('0x31')];if(_0x5840f7[_0x3860('0x33')][_0x3860('0x42')]){_0x164a77['include']=[{'all':!![]}];}_0x164a77=_[_0x3860('0x40')]({},_0x164a77,_0x5840f7[_0x3860('0x49')]);return db[_0x3860('0x2e')]['find'](_0x164a77)[_0x3860('0x41')](handleEntityNotFound(_0x4f2f53,null))[_0x3860('0x41')](respondWithResult(_0x4f2f53,null))[_0x3860('0x4a')](handleError(_0x4f2f53,null));};exports[_0x3860('0x4b')]=function(_0x5ed2db,_0x5bb2d1){return db[_0x3860('0x2e')]['create'](_0x5ed2db[_0x3860('0x4c')],{})[_0x3860('0x41')](function(_0x410dab){var _0x52456e=_0x5ed2db[_0x3860('0x4d')]['get']({'plain':!![]});if(!_0x52456e)throw new Error(_0x3860('0x4e'));if(_0x52456e['role']===_0x3860('0x4d')){var _0x25d22f=_0x410dab[_0x3860('0x4f')]({'plain':!![]});var _0x4b5790='SmsQueues';return db[_0x3860('0x50')][_0x3860('0x51')]({'where':{'name':_0x4b5790,'userProfileId':_0x52456e['userProfileId']},'raw':!![]})[_0x3860('0x41')](function(_0x58237e){if(_0x58237e&&_0x58237e[_0x3860('0x52')]===0x0){return db[_0x3860('0x29')][_0x3860('0x4b')]({'name':_0x25d22f[_0x3860('0x2b')],'resourceId':_0x25d22f['id'],'type':_0x58237e[_0x3860('0x2b')],'sectionId':_0x58237e['id']},{})[_0x3860('0x41')](function(){return _0x410dab;});}else{return _0x410dab;}})[_0x3860('0x4a')](function(_0x5a9987){logger[_0x3860('0x2a')](_0x3860('0x53'),_0x5a9987);throw _0x5a9987;});}return _0x410dab;})[_0x3860('0x41')](respondWithResult(_0x5bb2d1,0xc9))[_0x3860('0x4a')](handleError(_0x5bb2d1,null));};exports[_0x3860('0x26')]=function(_0x447163,_0x47ff99){if(_0x447163[_0x3860('0x4c')]['id']){delete _0x447163[_0x3860('0x4c')]['id'];}return db[_0x3860('0x2e')][_0x3860('0x51')]({'where':{'id':_0x447163[_0x3860('0x54')]['id']}})[_0x3860('0x41')](handleEntityNotFound(_0x47ff99,null))[_0x3860('0x41')](saveUpdates(_0x447163[_0x3860('0x4c')],null))['then'](respondWithResult(_0x47ff99,null))[_0x3860('0x4a')](handleError(_0x47ff99,null));};exports[_0x3860('0x27')]=function(_0x53a669,_0x1fe680){return db[_0x3860('0x2e')][_0x3860('0x51')]({'where':{'id':_0x53a669['params']['id']}})[_0x3860('0x41')](handleEntityNotFound(_0x1fe680,null))['then'](removeEntity(_0x1fe680,null))[_0x3860('0x4a')](handleError(_0x1fe680,null));};exports[_0x3860('0x55')]=function(_0x13b978,_0x2cc119){return db[_0x3860('0x2e')][_0x3860('0x55')]()[_0x3860('0x41')](respondWithResult(_0x2cc119,null))[_0x3860('0x4a')](handleError(_0x2cc119,null));};exports[_0x3860('0x56')]=function(_0x151492,_0x3ba9a1,_0x2bac24){var _0x58147d={'raw':!![],'where':{}},_0x5ce9a4={},_0x5111e0;return db[_0x3860('0x2e')]['findOne']({'where':{'id':_0x151492['params']['id']}})[_0x3860('0x41')](handleEntityNotFound(_0x3ba9a1,null))[_0x3860('0x41')](function(_0x2ff440){if(_0x2ff440){_0x5111e0=_0x2ff440[_0x3860('0x4f')]({'plain':!![]});_0x5ce9a4[_0x3860('0x31')]=_[_0x3860('0x47')](db['UserSmsQueue']['rawAttributes']);_0x5ce9a4['query']=_[_0x3860('0x47')](_0x151492[_0x3860('0x33')]);_0x5ce9a4[_0x3860('0x34')]=_['intersection'](_0x5ce9a4[_0x3860('0x31')],_0x5ce9a4['query']);_0x58147d[_0x3860('0x36')]=_[_0x3860('0x35')](_0x5ce9a4['model'],qs[_0x3860('0x37')](_0x151492[_0x3860('0x33')][_0x3860('0x37')]));_0x58147d[_0x3860('0x36')]=_0x58147d['attributes'][_0x3860('0x38')]?_0x58147d[_0x3860('0x36')]:_0x5ce9a4[_0x3860('0x31')];if(!_0x151492['query']['hasOwnProperty'](_0x3860('0x3a'))){_0x58147d[_0x3860('0x20')]=qs[_0x3860('0x20')](_0x151492[_0x3860('0x33')][_0x3860('0x20')]);_0x58147d[_0x3860('0x1f')]=qs['offset'](_0x151492[_0x3860('0x33')][_0x3860('0x1f')]);}_0x58147d['order']=qs[_0x3860('0x3b')](_0x151492[_0x3860('0x33')][_0x3860('0x3b')]);_0x58147d[_0x3860('0x3d')]=qs[_0x3860('0x34')](_[_0x3860('0x3c')](_0x151492['query'],_0x5ce9a4[_0x3860('0x34')]));_0x58147d[_0x3860('0x3d')][_0x3860('0x57')]=_0x2ff440['id'];if(_0x151492[_0x3860('0x33')][_0x3860('0x3f')]){_0x58147d[_0x3860('0x3d')]=_['merge'](_0x58147d[_0x3860('0x3d')],{'$or':_[_0x3860('0x32')](_0x58147d[_0x3860('0x36')],function(_0x5ebf70){var _0x4e386e={};_0x4e386e[_0x5ebf70]={'$like':'%'+_0x151492[_0x3860('0x33')][_0x3860('0x3f')]+'%'};return _0x4e386e;})});}_0x58147d=_[_0x3860('0x40')]({},_0x58147d,_0x151492[_0x3860('0x49')]);return db[_0x3860('0x58')]['findAll'](_0x58147d);}})['then'](function(_0x2db53f){if(_0x2db53f){return db[_0x3860('0x59')]['findAndCountAll']({'where':{'id':_['map'](_0x2db53f,_0x3860('0x5a')),'role':_0x3860('0x5b')},'attributes':['id','name',_0x3860('0x5c'),_0x3860('0x5d'),_0x3860('0x5e')]});}})[_0x3860('0x41')](function(_0x495167){if(_0x495167){return{'count':_0x495167[_0x3860('0x1e')],'rows':_[_0x3860('0x32')](_0x495167['rows'],function(_0x57e944){return{'membername':_0x57e944[_0x3860('0x2b')],'UserId':_0x57e944['id'],'queue_name':_0x5111e0[_0x3860('0x2b')],'SmsQueueId':_0x5111e0['id'],'interface':util['format'](_0x3860('0x5f'),'SIP',_0x57e944[_0x3860('0x2b')]),'penalty':0x0,'paused':_0x57e944['smsPause'],'createdAt':_0x57e944['createdAt'],'updatedAt':_0x57e944[_0x3860('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3ba9a1,_0x58147d))[_0x3860('0x4a')](handleError(_0x3ba9a1,null));};exports[_0x3860('0x60')]=function(_0x29eb2c,_0x2fd2f4,_0x19f717){var _0x43c5a1={};var _0x4b3447={};var _0x3756b3;var _0x297321;return db[_0x3860('0x2e')]['findOne']({'where':{'id':_0x29eb2c[_0x3860('0x54')]['id']}})['then'](handleEntityNotFound(_0x2fd2f4,null))[_0x3860('0x41')](function(_0x3dc2c5){if(_0x3dc2c5){_0x3756b3=_0x3dc2c5;_0x4b3447['model']=_[_0x3860('0x47')](db[_0x3860('0x61')][_0x3860('0x48')]);_0x4b3447['query']=_['keys'](_0x29eb2c['query']);_0x4b3447['filters']=_[_0x3860('0x35')](_0x4b3447[_0x3860('0x31')],_0x4b3447[_0x3860('0x33')]);_0x43c5a1[_0x3860('0x36')]=_['intersection'](_0x4b3447['model'],qs[_0x3860('0x37')](_0x29eb2c[_0x3860('0x33')][_0x3860('0x37')]));_0x43c5a1[_0x3860('0x36')]=_0x43c5a1['attributes'][_0x3860('0x38')]?_0x43c5a1[_0x3860('0x36')]:_0x4b3447['model'];_0x43c5a1['order']=qs[_0x3860('0x3b')](_0x29eb2c[_0x3860('0x33')][_0x3860('0x3b')]);_0x43c5a1[_0x3860('0x3d')]=qs['filters'](_['pick'](_0x29eb2c[_0x3860('0x33')],_0x4b3447['filters']));if(_0x29eb2c[_0x3860('0x33')][_0x3860('0x3f')]){_0x43c5a1['where']=_['merge'](_0x43c5a1['where'],{'$or':_[_0x3860('0x32')](_0x43c5a1[_0x3860('0x36')],function(_0x507480){var _0x22177b={};_0x22177b[_0x507480]={'$like':'%'+_0x29eb2c[_0x3860('0x33')][_0x3860('0x3f')]+'%'};return _0x22177b;})});}_0x43c5a1=_[_0x3860('0x40')]({},_0x43c5a1,_0x29eb2c[_0x3860('0x49')]);return _0x3756b3['getTeams'](_0x43c5a1);}})[_0x3860('0x41')](function(_0x31e791){if(_0x31e791){_0x297321=_0x31e791[_0x3860('0x38')];if(!_0x29eb2c[_0x3860('0x33')][_0x3860('0x39')]('nolimit')){_0x43c5a1[_0x3860('0x20')]=qs[_0x3860('0x20')](_0x29eb2c[_0x3860('0x33')][_0x3860('0x20')]);_0x43c5a1[_0x3860('0x1f')]=qs['offset'](_0x29eb2c['query'][_0x3860('0x1f')]);}return _0x3756b3[_0x3860('0x60')](_0x43c5a1);}})[_0x3860('0x41')](function(_0xf950d8){if(_0xf950d8){return _0xf950d8?{'count':_0x297321,'rows':_0xf950d8}:null;}})[_0x3860('0x41')](respondWithResult(_0x2fd2f4,null))[_0x3860('0x4a')](handleError(_0x2fd2f4,null));};exports[_0x3860('0x62')]=function(_0x532163,_0x458c1b,_0x3eb292){var _0x58eddd=_0x532163[_0x3860('0x4c')][_0x3860('0x63')];return db[_0x3860('0x61')]['findAll']({'where':{'id':_0x58eddd},'attributes':['id'],'include':[{'model':db[_0x3860('0x59')],'as':_0x3860('0x64'),'attributes':['id','name',_0x3860('0x65'),'voicePause',_0x3860('0x66')],'raw':!![]}]})[_0x3860('0x41')](function(_0x479d65){if(_0x479d65){var _0x330fd0=_[_0x3860('0x67')](_0x479d65,function(_0x361113){var _0x37b34a=_0x361113[_0x3860('0x4f')]({'plain':!![]});return _0x37b34a['Agents'];});return db[_0x3860('0x2e')][_0x3860('0x51')]({'where':{'id':_0x532163[_0x3860('0x54')]['id']}})[_0x3860('0x41')](function(_0x3c9837){return db['sequelize']['transaction'](function(_0x170554){return _0x3c9837[_0x3860('0x62')](_0x58eddd,{'transaction':_0x170554})['then'](function(){return BPromise[_0x3860('0x68')](_0x330fd0,function(_0x27ef52){return db[_0x3860('0x58')][_0x3860('0x69')]({'where':{'UserId':_0x27ef52['id'],'SmsQueueId':_0x532163['params']['id']},'transaction':_0x170554});});})[_0x3860('0x41')](function(){_0x330fd0['forEach'](function(_0x1a0768){socket[_0x3860('0x6a')](_0x3860('0x6b'),{'UserId':_0x1a0768['id'],'SmsQueueId':_0x3c9837['id']});});});});});}})[_0x3860('0x41')](respondWithStatusCode(_0x458c1b,null))[_0x3860('0x4a')](handleError(_0x458c1b,null));};exports[_0x3860('0x6c')]=function(_0x467b1b,_0x4936e7,_0x277aba){return db[_0x3860('0x61')]['findAll']({'where':{'id':_0x467b1b['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x3860('0x64'),'attributes':['id'],'raw':!![]}]})[_0x3860('0x41')](handleEntityNotFound(_0x4936e7,null))[_0x3860('0x41')](function(_0x1482cd){var _0x1d989c=_[_0x3860('0x32')](_0x1482cd,'id');var _0x51999d=[];var _0x204da6=[];var _0x5e2959=squel[_0x3860('0x6d')]();_0x5e2959[_0x3860('0x6e')](_0x3860('0x6f'))[_0x3860('0x70')](_0x3860('0x71'),'tq')[_0x3860('0x72')](_0x3860('0x73'),'ut',_0x3860('0x74'))[_0x3860('0x3d')](_0x3860('0x75'),_0x467b1b[_0x3860('0x54')]['id']);for(var _0x5bdd94=0x0;_0x5bdd94<_0x1482cd[_0x3860('0x38')];_0x5bdd94+=0x1){let _0x304c95=_0x1482cd[_0x5bdd94];for(var _0x1c87bd=0x0;_0x1c87bd<_0x304c95['Agents'][_0x3860('0x38')];_0x1c87bd+=0x1){let _0x2fb8fc=_0x304c95[_0x3860('0x64')][_0x1c87bd];var _0x3d4469=_0x5e2959['clone']();_0x3d4469[_0x3860('0x3d')](_0x3860('0x76'),_0x2fb8fc['id']);_0x204da6[_0x3860('0x77')](db['sequelize'][_0x3860('0x33')](_0x3d4469[_0x3860('0x78')](),{'type':db[_0x3860('0x79')]['QueryTypes'][_0x3860('0x7a')]})[_0x3860('0x41')](function(_0x171400){if(_0x171400['length']===0x1){return _0x2fb8fc['id'];}else{var _0x11d103=_[_0x3860('0x7b')](_[_0x3860('0x32')](_0x171400,'TeamId'),function(_0x3c6005){return _[_0x3860('0x7c')](_0x1d989c,_0x3c6005);});if(_0x11d103){return _0x2fb8fc['id'];}}}));}}return BPromise[_0x3860('0x7d')](_0x204da6)['then'](function(_0x213c8f){_0x51999d=_(_0x51999d)['union'](_0x213c8f)[_0x3860('0x7e')]()['value']();return db[_0x3860('0x2e')][_0x3860('0x51')]({'where':{'id':_0x467b1b[_0x3860('0x54')]['id']}})[_0x3860('0x41')](function(_0xcf291){return db[_0x3860('0x79')][_0x3860('0x7f')](function(_0x3c9ccc){return _0xcf291[_0x3860('0x6c')](_0x467b1b[_0x3860('0x33')][_0x3860('0x63')],{'transaction':_0x3c9ccc})[_0x3860('0x41')](function(){if(!_[_0x3860('0x80')](_0x51999d)){return _0xcf291[_0x3860('0x81')](_0x51999d,{'transaction':_0x3c9ccc});}})[_0x3860('0x41')](function(){_0x51999d[_0x3860('0x82')](function(_0x46661f){socket[_0x3860('0x6a')]('userSmsQueue:remove',{'UserId':_0x46661f,'SmsQueueId':_0xcf291['id']});});});});});});})[_0x3860('0x41')](respondWithStatusCode(_0x4936e7,null))[_0x3860('0x4a')](handleError(_0x4936e7,null));};exports[_0x3860('0x83')]=function(_0x28cf53,_0x3e6bf8,_0x27802b){return db[_0x3860('0x2e')][_0x3860('0x51')]({'where':{'id':_0x28cf53[_0x3860('0x54')]['id']}})[_0x3860('0x41')](handleEntityNotFound(_0x3e6bf8,null))[_0x3860('0x41')](function(_0x50a18b){if(_0x50a18b){return _0x50a18b[_0x3860('0x83')](_0x28cf53[_0x3860('0x4c')][_0x3860('0x63')],_[_0x3860('0x84')](_0x28cf53['body'],[_0x3860('0x63'),'id'])||{})[_0x3860('0x85')](function(_0x2fcf2c){for(var _0x20d615=0x0;_0x20d615<_0x28cf53['body'][_0x3860('0x63')]['length'];_0x20d615+=0x1){socket['emit'](_0x3860('0x6b'),{'UserId':_0x28cf53[_0x3860('0x4c')][_0x3860('0x63')][_0x20d615],'SmsQueueId':_0x28cf53[_0x3860('0x54')]['id']});}return _0x2fcf2c;});}})[_0x3860('0x41')](respondWithResult(_0x3e6bf8,null))[_0x3860('0x4a')](handleError(_0x3e6bf8,null));};exports[_0x3860('0x81')]=function(_0x273fed,_0x3e4a88,_0x468e83){return db[_0x3860('0x2e')][_0x3860('0x51')]({'where':{'id':_0x273fed[_0x3860('0x54')]['id']}})['then'](handleEntityNotFound(_0x3e4a88,null))[_0x3860('0x41')](function(_0x509122){if(_0x509122){return _0x509122[_0x3860('0x81')](_0x273fed[_0x3860('0x33')]['ids'])[_0x3860('0x41')](function(){if(_[_0x3860('0x86')](_0x273fed[_0x3860('0x33')][_0x3860('0x63')])){for(var _0x959e5b=0x0;_0x959e5b<_0x273fed[_0x3860('0x33')][_0x3860('0x63')]['length'];_0x959e5b+=0x1){socket[_0x3860('0x6a')](_0x3860('0x87'),{'UserId':Number(_0x273fed[_0x3860('0x33')][_0x3860('0x63')][_0x959e5b]),'SmsQueueId':Number(_0x273fed[_0x3860('0x54')]['id'])});}}else{socket['emit'](_0x3860('0x87'),{'UserId':Number(_0x273fed['query']['ids']),'SmsQueueId':Number(_0x273fed['params']['id'])});}});}})[_0x3860('0x41')](respondWithStatusCode(_0x3e4a88,null))[_0x3860('0x4a')](handleError(_0x3e4a88,null));};exports[_0x3860('0x88')]=function(_0x1558dc,_0x161efa,_0x276a75){var _0x270ca1={};var _0xe24a1d={};var _0x59c203;var _0x3c738a;return db[_0x3860('0x2e')]['findOne']({'where':{'id':_0x1558dc['params']['id']}})[_0x3860('0x41')](handleEntityNotFound(_0x161efa,null))[_0x3860('0x41')](function(_0x1cf541){if(_0x1cf541){_0x59c203=_0x1cf541;_0xe24a1d['model']=_[_0x3860('0x47')](db['User'][_0x3860('0x48')]);_0xe24a1d['query']=_[_0x3860('0x47')](_0x1558dc[_0x3860('0x33')]);_0xe24a1d['filters']=_[_0x3860('0x35')](_0xe24a1d[_0x3860('0x31')],_0xe24a1d['query']);_0x270ca1[_0x3860('0x36')]=_[_0x3860('0x35')](_0xe24a1d[_0x3860('0x31')],qs['fields'](_0x1558dc[_0x3860('0x33')]['fields']));_0x270ca1[_0x3860('0x36')]=_0x270ca1[_0x3860('0x36')]['length']?_0x270ca1[_0x3860('0x36')]:_0xe24a1d[_0x3860('0x31')];_0x270ca1[_0x3860('0x89')]=qs[_0x3860('0x3b')](_0x1558dc[_0x3860('0x33')]['sort']);_0x270ca1[_0x3860('0x3d')]=qs[_0x3860('0x34')](_['pick'](_0x1558dc['query'],_0xe24a1d[_0x3860('0x34')]));if(_0x1558dc['query'][_0x3860('0x3f')]){_0x270ca1[_0x3860('0x3d')]=_['merge'](_0x270ca1[_0x3860('0x3d')],{'$or':_['map'](_0x270ca1[_0x3860('0x36')],function(_0x4b8128){var _0x10c82d={};_0x10c82d[_0x4b8128]={'$like':'%'+_0x1558dc[_0x3860('0x33')][_0x3860('0x3f')]+'%'};return _0x10c82d;})});}_0x270ca1=_[_0x3860('0x40')]({},_0x270ca1,_0x1558dc['options']);return _0x59c203[_0x3860('0x88')](_0x270ca1);}})[_0x3860('0x41')](function(_0x20071c){if(_0x20071c){_0x3c738a=_0x20071c[_0x3860('0x38')];if(!_0x1558dc['query'][_0x3860('0x39')](_0x3860('0x3a'))){_0x270ca1['limit']=qs[_0x3860('0x20')](_0x1558dc[_0x3860('0x33')][_0x3860('0x20')]);_0x270ca1[_0x3860('0x1f')]=qs['offset'](_0x1558dc[_0x3860('0x33')][_0x3860('0x1f')]);}return _0x59c203[_0x3860('0x88')](_0x270ca1);}})[_0x3860('0x41')](function(_0x48b8a8){if(_0x48b8a8){return _0x48b8a8?{'count':_0x3c738a,'rows':_0x48b8a8}:null;}})[_0x3860('0x41')](respondWithResult(_0x161efa,null))['catch'](handleError(_0x161efa,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 62c88b6..7a7d26c 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 _0x92e2=['setMaxListeners','save','update','remove','emit','hook','exports','events','SmsQueue'];(function(_0x24f4fc,_0x2997b6){var _0x1b11d3=function(_0x8b8423){while(--_0x8b8423){_0x24f4fc['push'](_0x24f4fc['shift']());}};_0x1b11d3(++_0x2997b6);}(_0x92e2,0x19c));var _0x292e=function(_0x4800bf,_0x3f6aa0){_0x4800bf=_0x4800bf-0x0;var _0x4dc339=_0x92e2[_0x4800bf];return _0x4dc339;};'use strict';var EventEmitter=require(_0x292e('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x292e('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x292e('0x2')](0x0);var events={'afterCreate':_0x292e('0x3'),'afterUpdate':_0x292e('0x4'),'afterDestroy':_0x292e('0x5')};function emitEvent(_0x1aec0a){return function(_0x8a24f2,_0xa46039,_0x47d038){SmsQueueEvents['emit'](_0x1aec0a+':'+_0x8a24f2['id'],_0x8a24f2);SmsQueueEvents[_0x292e('0x6')](_0x1aec0a,_0x8a24f2);_0x47d038(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x292e('0x7')](e,emitEvent(event));}}module[_0x292e('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0x1b95=['emit','hasOwnProperty','hook','exports','events','update','remove'];(function(_0x55f90e,_0x5aee6d){var _0x37a8d8=function(_0x5b640e){while(--_0x5b640e){_0x55f90e['push'](_0x55f90e['shift']());}};_0x37a8d8(++_0x5aee6d);}(_0x1b95,0x115));var _0x51b9=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x1b95[_0x4709c0];return _0x13348b;};'use strict';var EventEmitter=require(_0x51b9('0x0'));var SmsQueue=require('../../mysqldb')['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x51b9('0x1'),'afterDestroy':_0x51b9('0x2')};function emitEvent(_0x313174){return function(_0xe107c2,_0x27ff7e,_0x2bbd9e){SmsQueueEvents['emit'](_0x313174+':'+_0xe107c2['id'],_0xe107c2);SmsQueueEvents[_0x51b9('0x3')](_0x313174,_0xe107c2);_0x2bbd9e(null);};}for(var e in events){if(events[_0x51b9('0x4')](e)){var event=events[e];SmsQueue[_0x51b9('0x5')](e,emitEvent(event));}}module[_0x51b9('0x6')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 999fae4..1799626 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 _0xc068=['api','bluebird','request-promise','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','util','../../config/logger'];(function(_0xd7bae9,_0x53ce66){var _0x3048fe=function(_0x4f49b6){while(--_0x4f49b6){_0xd7bae9['push'](_0xd7bae9['shift']());}};_0x3048fe(++_0x53ce66);}(_0xc068,0xf4));var _0x8c06=function(_0x1d5dde,_0x1c02cc){_0x1d5dde=_0x1d5dde-0x0;var _0x5f59e5=_0xc068[_0x1d5dde];return _0x5f59e5;};'use strict';var _=require(_0x8c06('0x0'));var util=require(_0x8c06('0x1'));var logger=require(_0x8c06('0x2'))(_0x8c06('0x3'));var moment=require('moment');var BPromise=require(_0x8c06('0x4'));var rp=require(_0x8c06('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8c06('0x6'));var config=require(_0x8c06('0x7'));var attributes=require(_0x8c06('0x8'));module[_0x8c06('0x9')]=function(_0x2a0caa,_0x5ea6f6){return _0x2a0caa[_0x8c06('0xa')](_0x8c06('0xb'),attributes,{'tableName':_0x8c06('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1dfa=['define','SmsQueue','sms_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x1dfa,0x18f));var _0xa1df=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x1dfa[_0x465028];return _0xb783d4;};'use strict';var _=require(_0xa1df('0x0'));var util=require(_0xa1df('0x1'));var logger=require(_0xa1df('0x2'))('api');var moment=require(_0xa1df('0x3'));var BPromise=require(_0xa1df('0x4'));var rp=require(_0xa1df('0x5'));var fs=require('fs');var path=require(_0xa1df('0x6'));var rimraf=require('rimraf');var config=require(_0xa1df('0x7'));var attributes=require('./smsQueue.attributes');module[_0xa1df('0x8')]=function(_0x1cc8b6,_0x219179){return _0x1cc8b6[_0xa1df('0x9')](_0xa1df('0xa'),attributes,{'tableName':_0xa1df('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 763df76..440dbde 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 _0xcc3a=['message','result','catch','GetSmsQueue','findAll','options','raw','where','limit','include','map','model','attributes','ShowSmsQueue','SmsQueue','lodash','util','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter','./smsQueue.socket','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5a3e69,_0x346f71){var _0x27073b=function(_0x36283e){while(--_0x36283e){_0x5a3e69['push'](_0x5a3e69['shift']());}};_0x27073b(++_0x346f71);}(_0xcc3a,0x15c));var _0xacc3=function(_0x219d87,_0x1cb6f7){_0x219d87=_0x219d87-0x0;var _0x22823d=_0xcc3a[_0x219d87];return _0x22823d;};'use strict';var _=require(_0xacc3('0x0'));var util=require(_0xacc3('0x1'));var moment=require(_0xacc3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xacc3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xacc3('0x4'))(_0xacc3('0x5'));var config=require(_0xacc3('0x6'));var jayson=require(_0xacc3('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0xacc3('0x8')]=_[_0xacc3('0x9')](config[_0xacc3('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xacc3('0xa'))(new Redis(config[_0xacc3('0x8')]));require(_0xacc3('0xb'))['register'](socket);function respondWithRpcPromise(_0x1e8dfb,_0x3f24e1,_0xd97931){return new BPromise(function(_0x1cbce3,_0x3ffcd3){return client[_0xacc3('0xc')](_0x1e8dfb,_0xd97931)[_0xacc3('0xd')](function(_0x4a2495){logger[_0xacc3('0xe')](_0xacc3('0xf'),_0x3f24e1,_0xacc3('0x10'));logger[_0xacc3('0x11')](_0xacc3('0x12'),_0x3f24e1,'request\x20sent',JSON[_0xacc3('0x13')](_0x4a2495));if(_0x4a2495[_0xacc3('0x14')]){if(_0x4a2495[_0xacc3('0x14')][_0xacc3('0x15')]===0x1f4){logger['error'](_0xacc3('0xf'),_0x3f24e1,_0x4a2495[_0xacc3('0x14')]['message']);return _0x3ffcd3(_0x4a2495[_0xacc3('0x14')][_0xacc3('0x16')]);}logger[_0xacc3('0x14')](_0xacc3('0xf'),_0x3f24e1,_0x4a2495['error'][_0xacc3('0x16')]);return _0x1cbce3(_0x4a2495[_0xacc3('0x14')][_0xacc3('0x16')]);}else{logger['info'](_0xacc3('0xf'),_0x3f24e1,_0xacc3('0x10'));_0x1cbce3(_0x4a2495[_0xacc3('0x17')][_0xacc3('0x16')]);}})[_0xacc3('0x18')](function(_0x51372c){logger['error'](_0xacc3('0xf'),_0x3f24e1,_0x51372c);_0x3ffcd3(_0x51372c);});});}exports[_0xacc3('0x19')]=function(_0x5d24d3){var _0x412311=this;return new Promise(function(_0xc095dc,_0x3395ab){return db['SmsQueue'][_0xacc3('0x1a')]({'raw':_0x5d24d3[_0xacc3('0x1b')]?_0x5d24d3[_0xacc3('0x1b')][_0xacc3('0x1c')]===undefined?!![]:![]:!![],'where':_0x5d24d3[_0xacc3('0x1b')]?_0x5d24d3[_0xacc3('0x1b')][_0xacc3('0x1d')]||null:null,'attributes':_0x5d24d3[_0xacc3('0x1b')]?_0x5d24d3[_0xacc3('0x1b')]['attributes']||null:null,'limit':_0x5d24d3['options']?_0x5d24d3[_0xacc3('0x1b')][_0xacc3('0x1e')]||null:null,'include':_0x5d24d3[_0xacc3('0x1b')]?_0x5d24d3[_0xacc3('0x1b')][_0xacc3('0x1f')]?_[_0xacc3('0x20')](_0x5d24d3['options'][_0xacc3('0x1f')],function(_0x1c76a8){return{'model':db[_0x1c76a8[_0xacc3('0x21')]],'as':_0x1c76a8['as'],'attributes':_0x1c76a8[_0xacc3('0x22')],'include':_0x1c76a8[_0xacc3('0x1f')]?_[_0xacc3('0x20')](_0x1c76a8[_0xacc3('0x1f')],function(_0x21b6c5){return{'model':db[_0x21b6c5[_0xacc3('0x21')]],'as':_0x21b6c5['as'],'attributes':_0x21b6c5[_0xacc3('0x22')],'include':_0x21b6c5[_0xacc3('0x1f')]?_[_0xacc3('0x20')](_0x21b6c5[_0xacc3('0x1f')],function(_0x2f6c92){return{'model':db[_0x2f6c92['model']],'as':_0x2f6c92['as'],'attributes':_0x2f6c92[_0xacc3('0x22')]};}):[]};}):[]};}):[]:[]})[_0xacc3('0xd')](function(_0x2aff5f){logger[_0xacc3('0xe')](_0xacc3('0x19'),_0x5d24d3);logger[_0xacc3('0x11')]('GetSmsQueue',_0x5d24d3,JSON[_0xacc3('0x13')](_0x2aff5f));_0xc095dc(_0x2aff5f);})[_0xacc3('0x18')](function(_0x27e2c2){logger[_0xacc3('0x14')](_0xacc3('0x19'),_0x27e2c2[_0xacc3('0x16')],_0x5d24d3);_0x3395ab(_0x412311[_0xacc3('0x14')](0x1f4,_0x27e2c2[_0xacc3('0x16')]));});});};exports[_0xacc3('0x23')]=function(_0x2a44bd){var _0x5549ed=this;return new Promise(function(_0x2cdf78,_0x56f61e){return db[_0xacc3('0x24')]['find']({'raw':_0x2a44bd[_0xacc3('0x1b')]?_0x2a44bd[_0xacc3('0x1b')][_0xacc3('0x1c')]===undefined?!![]:![]:!![],'where':_0x2a44bd['options']?_0x2a44bd[_0xacc3('0x1b')]['where']||null:null,'attributes':_0x2a44bd[_0xacc3('0x1b')]?_0x2a44bd[_0xacc3('0x1b')][_0xacc3('0x22')]||null:null,'include':_0x2a44bd[_0xacc3('0x1b')]?_0x2a44bd[_0xacc3('0x1b')][_0xacc3('0x1f')]?_[_0xacc3('0x20')](_0x2a44bd[_0xacc3('0x1b')][_0xacc3('0x1f')],function(_0x27d871){return{'model':db[_0x27d871[_0xacc3('0x21')]],'as':_0x27d871['as'],'attributes':_0x27d871[_0xacc3('0x22')],'include':_0x27d871[_0xacc3('0x1f')]?_[_0xacc3('0x20')](_0x27d871[_0xacc3('0x1f')],function(_0x5b7d64){return{'model':db[_0x5b7d64[_0xacc3('0x21')]],'as':_0x5b7d64['as'],'attributes':_0x5b7d64['attributes'],'include':_0x5b7d64[_0xacc3('0x1f')]?_[_0xacc3('0x20')](_0x5b7d64[_0xacc3('0x1f')],function(_0xaeca62){return{'model':db[_0xaeca62['model']],'as':_0xaeca62['as'],'attributes':_0xaeca62[_0xacc3('0x22')]};}):[]};}):[]};}):[]:[]})[_0xacc3('0xd')](function(_0x53e029){logger[_0xacc3('0xe')](_0xacc3('0x23'),_0x2a44bd);logger[_0xacc3('0x11')](_0xacc3('0x23'),_0x2a44bd,JSON[_0xacc3('0x13')](_0x53e029));_0x2cdf78(_0x53e029);})[_0xacc3('0x18')](function(_0x26f49a){logger[_0xacc3('0x14')](_0xacc3('0x23'),_0x26f49a['message'],_0x2a44bd);_0x56f61e(_0x5549ed['error'](0x1f4,_0x26f49a[_0xacc3('0x16')]));});});}; \ No newline at end of file +var _0x5316=['options','raw','where','attributes','limit','include','map','model','GetSmsQueue','ShowSmsQueue','find','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','SmsQueue','findAll'];(function(_0x1f2020,_0x2738c6){var _0x401e2b=function(_0x32ba94){while(--_0x32ba94){_0x1f2020['push'](_0x1f2020['shift']());}};_0x401e2b(++_0x2738c6);}(_0x5316,0x143));var _0x6531=function(_0x28db4a,_0x6d6d5a){_0x28db4a=_0x28db4a-0x0;var _0x3bf87e=_0x5316[_0x28db4a];return _0x3bf87e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6531('0x0'));var BPromise=require(_0x6531('0x1'));var rs=require(_0x6531('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6531('0x3'))['db'];var utils=require(_0x6531('0x4'));var logger=require(_0x6531('0x5'))(_0x6531('0x6'));var config=require(_0x6531('0x7'));var jayson=require(_0x6531('0x8'));var client=jayson[_0x6531('0x9')]['http']({'port':0x232a});config[_0x6531('0xa')]=_[_0x6531('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6531('0xc'))(new Redis(config['redis']));require('./smsQueue.socket')[_0x6531('0xd')](socket);function respondWithRpcPromise(_0x3da628,_0x2a7bee,_0x2689a2){return new BPromise(function(_0x31388b,_0x42e16e){return client[_0x6531('0xe')](_0x3da628,_0x2689a2)[_0x6531('0xf')](function(_0x4fa46f){logger[_0x6531('0x10')](_0x6531('0x11'),_0x2a7bee,_0x6531('0x12'));logger[_0x6531('0x13')](_0x6531('0x14'),_0x2a7bee,_0x6531('0x12'),JSON[_0x6531('0x15')](_0x4fa46f));if(_0x4fa46f[_0x6531('0x16')]){if(_0x4fa46f[_0x6531('0x16')]['code']===0x1f4){logger[_0x6531('0x16')](_0x6531('0x11'),_0x2a7bee,_0x4fa46f[_0x6531('0x16')][_0x6531('0x17')]);return _0x42e16e(_0x4fa46f[_0x6531('0x16')][_0x6531('0x17')]);}logger[_0x6531('0x16')]('SmsQueue,\x20%s,\x20%s',_0x2a7bee,_0x4fa46f[_0x6531('0x16')]['message']);return _0x31388b(_0x4fa46f['error'][_0x6531('0x17')]);}else{logger[_0x6531('0x10')](_0x6531('0x11'),_0x2a7bee,_0x6531('0x12'));_0x31388b(_0x4fa46f[_0x6531('0x18')][_0x6531('0x17')]);}})[_0x6531('0x19')](function(_0x296b94){logger[_0x6531('0x16')](_0x6531('0x11'),_0x2a7bee,_0x296b94);_0x42e16e(_0x296b94);});});}exports['GetSmsQueue']=function(_0x4c6f78){var _0x374677=this;return new Promise(function(_0x3b852d,_0x5e4697){return db[_0x6531('0x1a')][_0x6531('0x1b')]({'raw':_0x4c6f78[_0x6531('0x1c')]?_0x4c6f78[_0x6531('0x1c')][_0x6531('0x1d')]===undefined?!![]:![]:!![],'where':_0x4c6f78[_0x6531('0x1c')]?_0x4c6f78[_0x6531('0x1c')][_0x6531('0x1e')]||null:null,'attributes':_0x4c6f78[_0x6531('0x1c')]?_0x4c6f78[_0x6531('0x1c')][_0x6531('0x1f')]||null:null,'limit':_0x4c6f78[_0x6531('0x1c')]?_0x4c6f78[_0x6531('0x1c')][_0x6531('0x20')]||null:null,'include':_0x4c6f78['options']?_0x4c6f78[_0x6531('0x1c')][_0x6531('0x21')]?_[_0x6531('0x22')](_0x4c6f78[_0x6531('0x1c')][_0x6531('0x21')],function(_0xd80e72){return{'model':db[_0xd80e72[_0x6531('0x23')]],'as':_0xd80e72['as'],'attributes':_0xd80e72['attributes'],'include':_0xd80e72[_0x6531('0x21')]?_[_0x6531('0x22')](_0xd80e72[_0x6531('0x21')],function(_0xad3f27){return{'model':db[_0xad3f27[_0x6531('0x23')]],'as':_0xad3f27['as'],'attributes':_0xad3f27[_0x6531('0x1f')],'include':_0xad3f27[_0x6531('0x21')]?_[_0x6531('0x22')](_0xad3f27[_0x6531('0x21')],function(_0x274727){return{'model':db[_0x274727['model']],'as':_0x274727['as'],'attributes':_0x274727[_0x6531('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6531('0xf')](function(_0x4ada38){logger['info'](_0x6531('0x24'),_0x4c6f78);logger[_0x6531('0x13')](_0x6531('0x24'),_0x4c6f78,JSON[_0x6531('0x15')](_0x4ada38));_0x3b852d(_0x4ada38);})['catch'](function(_0xedb555){logger['error'](_0x6531('0x24'),_0xedb555[_0x6531('0x17')],_0x4c6f78);_0x5e4697(_0x374677['error'](0x1f4,_0xedb555[_0x6531('0x17')]));});});};exports[_0x6531('0x25')]=function(_0x4bbd53){var _0x4db2de=this;return new Promise(function(_0xad61c8,_0x1270a6){return db[_0x6531('0x1a')][_0x6531('0x26')]({'raw':_0x4bbd53[_0x6531('0x1c')]?_0x4bbd53['options']['raw']===undefined?!![]:![]:!![],'where':_0x4bbd53[_0x6531('0x1c')]?_0x4bbd53['options']['where']||null:null,'attributes':_0x4bbd53['options']?_0x4bbd53['options'][_0x6531('0x1f')]||null:null,'include':_0x4bbd53[_0x6531('0x1c')]?_0x4bbd53[_0x6531('0x1c')][_0x6531('0x21')]?_[_0x6531('0x22')](_0x4bbd53[_0x6531('0x1c')]['include'],function(_0x4d335c){return{'model':db[_0x4d335c[_0x6531('0x23')]],'as':_0x4d335c['as'],'attributes':_0x4d335c[_0x6531('0x1f')],'include':_0x4d335c[_0x6531('0x21')]?_['map'](_0x4d335c[_0x6531('0x21')],function(_0x2b93b9){return{'model':db[_0x2b93b9[_0x6531('0x23')]],'as':_0x2b93b9['as'],'attributes':_0x2b93b9['attributes'],'include':_0x2b93b9['include']?_[_0x6531('0x22')](_0x2b93b9[_0x6531('0x21')],function(_0x7d3c9f){return{'model':db[_0x7d3c9f[_0x6531('0x23')]],'as':_0x7d3c9f['as'],'attributes':_0x7d3c9f['attributes']};}):[]};}):[]};}):[]:[]})[_0x6531('0xf')](function(_0x1eaf3f){logger['info'](_0x6531('0x25'),_0x4bbd53);logger[_0x6531('0x13')]('ShowSmsQueue',_0x4bbd53,JSON[_0x6531('0x15')](_0x1eaf3f));_0xad61c8(_0x1eaf3f);})[_0x6531('0x19')](function(_0x49d97e){logger[_0x6531('0x16')]('ShowSmsQueue',_0x49d97e[_0x6531('0x17')],_0x4bbd53);_0x1270a6(_0x4db2de['error'](0x1f4,_0x49d97e[_0x6531('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 6ac0064..2fd2c41 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 _0xf3c3=['length','smsQueue:','./smsQueue.events','save','remove','update','emit','removeListener'];(function(_0x3da559,_0x2fa59c){var _0xbf7fea=function(_0x598699){while(--_0x598699){_0x3da559['push'](_0x3da559['shift']());}};_0xbf7fea(++_0x2fa59c);}(_0xf3c3,0x14a));var _0x3f3c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf3c3[_0x3dd15e];return _0x231fd0;};'use strict';var SmsQueueEvents=require(_0x3f3c('0x0'));var events=[_0x3f3c('0x1'),_0x3f3c('0x2'),_0x3f3c('0x3')];function createListener(_0x6fa918,_0x350e6b){return function(_0x488706){_0x350e6b[_0x3f3c('0x4')](_0x6fa918,_0x488706);};}function removeListener(_0x349876,_0x4686ee){return function(){SmsQueueEvents[_0x3f3c('0x5')](_0x349876,_0x4686ee);};}exports['register']=function(_0x39ead5){for(var _0x39a48d=0x0,_0x552219=events[_0x3f3c('0x6')];_0x39a48d<_0x552219;_0x39a48d++){var _0x49736b=events[_0x39a48d];var _0x3f8f4a=createListener(_0x3f3c('0x7')+_0x49736b,_0x39ead5);SmsQueueEvents['on'](_0x49736b,_0x3f8f4a);}}; \ No newline at end of file +var _0xb952=['removeListener','register','length','./smsQueue.events','save','emit'];(function(_0x136d42,_0x3c89c3){var _0x4bd8cf=function(_0x5755fc){while(--_0x5755fc){_0x136d42['push'](_0x136d42['shift']());}};_0x4bd8cf(++_0x3c89c3);}(_0xb952,0x14d));var _0x2b95=function(_0x30999c,_0x2623dd){_0x30999c=_0x30999c-0x0;var _0x5f2c04=_0xb952[_0x30999c];return _0x5f2c04;};'use strict';var SmsQueueEvents=require(_0x2b95('0x0'));var events=[_0x2b95('0x1'),'remove','update'];function createListener(_0x3a999c,_0x4cc877){return function(_0x5753f7){_0x4cc877[_0x2b95('0x2')](_0x3a999c,_0x5753f7);};}function removeListener(_0x5e01b1,_0x496a2d){return function(){SmsQueueEvents[_0x2b95('0x3')](_0x5e01b1,_0x496a2d);};}exports[_0x2b95('0x4')]=function(_0x406f83){for(var _0x4b5682=0x0,_0x326e72=events[_0x2b95('0x5')];_0x4b5682<_0x326e72;_0x4b5682++){var _0x399767=events[_0x4b5682];var _0x1b3d4b=createListener('smsQueue:'+_0x399767,_0x406f83);SmsQueueEvents['on'](_0x399767,_0x1b3d4b);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 1a312d8..f8281f1 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 _0x295e=['express','Router','../../components/auth/service','../../config/environment','./smsQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','put','delete','destroy','multer','util','path'];(function(_0x2e914,_0x1c7566){var _0x936e45=function(_0x1b22e4){while(--_0x1b22e4){_0x2e914['push'](_0x2e914['shift']());}};_0x936e45(++_0x1c7566);}(_0x295e,0x18c));var _0xe295=function(_0x348467,_0x5ec66b){_0x348467=_0x348467-0x0;var _0x2d5789=_0x295e[_0x348467];return _0x2d5789;};'use strict';var multer=require(_0xe295('0x0'));var util=require(_0xe295('0x1'));var path=require(_0xe295('0x2'));var timeout=require('connect-timeout');var express=require(_0xe295('0x3'));var router=express[_0xe295('0x4')]();var auth=require(_0xe295('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe295('0x6'));var controller=require(_0xe295('0x7'));router['get']('/',auth[_0xe295('0x8')](),controller[_0xe295('0x9')]);router[_0xe295('0xa')](_0xe295('0xb'),auth[_0xe295('0x8')](),controller[_0xe295('0xc')]);router['get'](_0xe295('0xd'),auth['isAuthenticated'](),controller[_0xe295('0xe')]);router[_0xe295('0xf')]('/',auth[_0xe295('0x8')](),controller['create']);router[_0xe295('0x10')]('/:id',auth[_0xe295('0x8')](),controller['update']);router[_0xe295('0x11')]('/:id',auth[_0xe295('0x8')](),controller[_0xe295('0x12')]);module['exports']=router; \ No newline at end of file +var _0xdd82=['express','Router','../../config/environment','./smsQueueReport.controller','isAuthenticated','index','/describe','get','/:id','show','post','create','destroy','exports','multer','connect-timeout'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xdd82,0x18e));var _0x2dd8=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xdd82[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x2dd8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2dd8('0x1'));var express=require(_0x2dd8('0x2'));var router=express[_0x2dd8('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2dd8('0x4'));var controller=require(_0x2dd8('0x5'));router['get']('/',auth[_0x2dd8('0x6')](),controller[_0x2dd8('0x7')]);router['get'](_0x2dd8('0x8'),auth[_0x2dd8('0x6')](),controller['describe']);router[_0x2dd8('0x9')](_0x2dd8('0xa'),auth['isAuthenticated'](),controller[_0x2dd8('0xb')]);router[_0x2dd8('0xc')]('/',auth[_0x2dd8('0x6')](),controller[_0x2dd8('0xd')]);router['put']('/:id',auth[_0x2dd8('0x6')](),controller['update']);router['delete']('/:id',auth[_0x2dd8('0x6')](),controller[_0x2dd8('0xe')]);module[_0x2dd8('0xf')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 6b33a8c..def6011 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 _0x7a56=['STRING','DATE','sequelize','exports'];(function(_0x562279,_0x248089){var _0x585afb=function(_0x437980){while(--_0x437980){_0x562279['push'](_0x562279['shift']());}};_0x585afb(++_0x248089);}(_0x7a56,0x17e));var _0x67a5=function(_0x16f440,_0x499247){_0x16f440=_0x16f440-0x0;var _0x5ef5be=_0x7a56[_0x16f440];return _0x5ef5be;};'use strict';var moment=require('moment');var Sequelize=require(_0x67a5('0x0'));module[_0x67a5('0x1')]={'uniqueid':{'type':Sequelize[_0x67a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x67a5('0x3')]},'leaveAt':{'type':Sequelize[_0x67a5('0x3')]},'acceptAt':{'type':Sequelize[_0x67a5('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x67a5('0x2')]}}; \ No newline at end of file +var _0x3dd1=['DATE','moment','sequelize','exports','STRING'];(function(_0x2cc0b3,_0x120bf1){var _0x1667ef=function(_0x3abcb4){while(--_0x3abcb4){_0x2cc0b3['push'](_0x2cc0b3['shift']());}};_0x1667ef(++_0x120bf1);}(_0x3dd1,0x1e6));var _0x13dd=function(_0x4fa3a0,_0x530b99){_0x4fa3a0=_0x4fa3a0-0x0;var _0x38f908=_0x3dd1[_0x4fa3a0];return _0x38f908;};'use strict';var moment=require(_0x13dd('0x0'));var Sequelize=require(_0x13dd('0x1'));module[_0x13dd('0x2')]={'uniqueid':{'type':Sequelize[_0x13dd('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x13dd('0x3')]},'joinAt':{'type':Sequelize[_0x13dd('0x4')]},'leaveAt':{'type':Sequelize[_0x13dd('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x13dd('0x4')]},'reason':{'type':Sequelize[_0x13dd('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 866e32d..df36bd0 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 _0x14c7=['sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','stack','name','send','index','SmsQueueReport','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','rows','catch','show','params','include','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x308897,_0x301609){var _0x15f49c=function(_0x3f3848){while(--_0x3f3848){_0x308897['push'](_0x308897['shift']());}};_0x15f49c(++_0x301609);}(_0x14c7,0x148));var _0x714c=function(_0x4cc25c,_0x14c186){_0x4cc25c=_0x4cc25c-0x0;var _0x5f5766=_0x14c7[_0x4cc25c];return _0x5f5766;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x714c('0x0'));var zipdir=require(_0x714c('0x1'));var jsonpatch=require(_0x714c('0x2'));var rp=require(_0x714c('0x3'));var moment=require(_0x714c('0x4'));var BPromise=require(_0x714c('0x5'));var Mustache=require(_0x714c('0x6'));var util=require(_0x714c('0x7'));var path=require('path');var sox=require(_0x714c('0x8'));var csv=require(_0x714c('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x714c('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x714c('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x714c('0xc'));var Redis=require('ioredis');var authService=require(_0x714c('0xd'));var qs=require(_0x714c('0xe'));var as=require(_0x714c('0xf'));var hardwareService=require(_0x714c('0x10'));var logger=require(_0x714c('0x11'))(_0x714c('0x12'));var utils=require(_0x714c('0x13'));var config=require(_0x714c('0x14'));var db=require(_0x714c('0x15'))['db'];function respondWithStatusCode(_0x4383d7,_0x1914fa){_0x1914fa=_0x1914fa||0xcc;return function(_0x206842){if(_0x206842){return _0x4383d7[_0x714c('0x16')](_0x1914fa);}return _0x4383d7[_0x714c('0x17')](_0x1914fa)[_0x714c('0x18')]();};}function respondWithResult(_0x4d15e4,_0x3b8b3c){_0x3b8b3c=_0x3b8b3c||0xc8;return function(_0x28f02b){if(_0x28f02b){return _0x4d15e4[_0x714c('0x17')](_0x3b8b3c)['json'](_0x28f02b);}};}function respondWithFilteredResult(_0x3403a5,_0x237dad){return function(_0x240ab2){if(_0x240ab2){var _0x5f0e8b=_0x240ab2[_0x714c('0x19')],_0x3e4426=_0x237dad[_0x714c('0x1a')],_0x365dd1=_0x237dad[_0x714c('0x1a')]+_0x237dad[_0x714c('0x1b')],_0x24507e;if(_0x365dd1>=_0x5f0e8b){_0x365dd1=_0x5f0e8b;_0x24507e=0xc8;}else{_0x24507e=0xce;}_0x3403a5[_0x714c('0x17')](_0x24507e);return _0x3403a5[_0x714c('0x1c')](_0x714c('0x1d'),_0x3e4426+'-'+_0x365dd1+'/'+_0x5f0e8b)[_0x714c('0x1e')](_0x240ab2);}return null;};}function patchUpdates(_0x545b22){return function(_0x557443){try{jsonpatch['apply'](_0x557443,_0x545b22,!![]);}catch(_0x3b26f1){return BPromise[_0x714c('0x1f')](_0x3b26f1);}return _0x557443[_0x714c('0x20')]();};}function saveUpdates(_0x35961a,_0x1d98d4){return function(_0x9fafab){if(_0x9fafab){return _0x9fafab[_0x714c('0x21')](_0x35961a)[_0x714c('0x22')](function(_0x14c68c){return _0x14c68c;});}return null;};}function removeEntity(_0x34cb7a,_0x3756af){return function(_0x1a96c1){if(_0x1a96c1){return _0x1a96c1[_0x714c('0x23')]()[_0x714c('0x22')](function(){_0x34cb7a['status'](0xcc)[_0x714c('0x18')]();});}};}function handleEntityNotFound(_0x48bb8c,_0x5f1c32){return function(_0x16d13c){if(!_0x16d13c){_0x48bb8c[_0x714c('0x16')](0x194);}return _0x16d13c;};}function handleError(_0x111c31,_0x21d984){_0x21d984=_0x21d984||0x1f4;return function(_0x534443){logger['error'](_0x534443[_0x714c('0x24')]);if(_0x534443[_0x714c('0x25')]){delete _0x534443['name'];}_0x111c31[_0x714c('0x17')](_0x21d984)[_0x714c('0x26')](_0x534443);};}exports[_0x714c('0x27')]=function(_0x40d928,_0x120743){var _0x52f3dd={},_0x3fd275={},_0x426d5c={'count':0x0,'rows':[]};var _0x919074=_['map'](db[_0x714c('0x28')][_0x714c('0x29')],function(_0x2dd290){return{'name':_0x2dd290[_0x714c('0x2a')],'type':_0x2dd290[_0x714c('0x2b')]['key']};});_0x3fd275[_0x714c('0x2c')]=_[_0x714c('0x2d')](_0x919074,_0x714c('0x25'));_0x3fd275['query']=_[_0x714c('0x2e')](_0x40d928[_0x714c('0x2f')]);_0x3fd275[_0x714c('0x30')]=_[_0x714c('0x31')](_0x3fd275[_0x714c('0x2c')],_0x3fd275['query']);_0x52f3dd['attributes']=_[_0x714c('0x31')](_0x3fd275[_0x714c('0x2c')],qs[_0x714c('0x32')](_0x40d928[_0x714c('0x2f')][_0x714c('0x32')]));_0x52f3dd[_0x714c('0x33')]=_0x52f3dd[_0x714c('0x33')][_0x714c('0x34')]?_0x52f3dd['attributes']:_0x3fd275['model'];if(!_0x40d928[_0x714c('0x2f')][_0x714c('0x35')](_0x714c('0x36'))){_0x52f3dd[_0x714c('0x1b')]=qs['limit'](_0x40d928[_0x714c('0x2f')][_0x714c('0x1b')]);_0x52f3dd[_0x714c('0x1a')]=qs[_0x714c('0x1a')](_0x40d928[_0x714c('0x2f')][_0x714c('0x1a')]);}_0x52f3dd['order']=qs['sort'](_0x40d928[_0x714c('0x2f')][_0x714c('0x37')]);_0x52f3dd[_0x714c('0x38')]=qs[_0x714c('0x30')](_[_0x714c('0x39')](_0x40d928[_0x714c('0x2f')],_0x3fd275['filters']));if(_0x40d928['query'][_0x714c('0x3a')]){_0x52f3dd[_0x714c('0x38')]=_[_0x714c('0x3b')](_0x52f3dd['where'],{'$or':_[_0x714c('0x2d')](_0x919074,function(_0x2ce84b){if(_0x2ce84b[_0x714c('0x2b')]!=='VIRTUAL'){var _0xab6977={};_0xab6977[_0x2ce84b[_0x714c('0x25')]]={'$like':'%'+_0x40d928[_0x714c('0x2f')]['filter']+'%'};return _0xab6977;}})});}_0x52f3dd=_['merge']({},_0x52f3dd,_0x40d928[_0x714c('0x3c')]);var _0x2ebb90={'where':_0x52f3dd[_0x714c('0x38')]};return db[_0x714c('0x28')][_0x714c('0x19')](_0x2ebb90)['then'](function(_0x198dfe){_0x426d5c[_0x714c('0x19')]=_0x198dfe;if(_0x40d928['query'][_0x714c('0x3d')]){_0x52f3dd['include']=[{'all':!![]}];}return db[_0x714c('0x28')]['findAll'](_0x52f3dd);})[_0x714c('0x22')](function(_0x366a9d){_0x426d5c[_0x714c('0x3e')]=_0x366a9d;return _0x426d5c;})[_0x714c('0x22')](respondWithFilteredResult(_0x120743,_0x52f3dd))[_0x714c('0x3f')](handleError(_0x120743,null));};exports[_0x714c('0x40')]=function(_0x202070,_0x5ad4f2){var _0x239449={'raw':!![],'where':{'id':_0x202070[_0x714c('0x41')]['id']}},_0x3314f1={};_0x3314f1[_0x714c('0x2c')]=_[_0x714c('0x2e')](db[_0x714c('0x28')][_0x714c('0x29')]);_0x3314f1['query']=_[_0x714c('0x2e')](_0x202070['query']);_0x3314f1['filters']=_[_0x714c('0x31')](_0x3314f1[_0x714c('0x2c')],_0x3314f1['query']);_0x239449[_0x714c('0x33')]=_['intersection'](_0x3314f1[_0x714c('0x2c')],qs['fields'](_0x202070[_0x714c('0x2f')][_0x714c('0x32')]));_0x239449[_0x714c('0x33')]=_0x239449['attributes'][_0x714c('0x34')]?_0x239449['attributes']:_0x3314f1[_0x714c('0x2c')];if(_0x202070[_0x714c('0x2f')][_0x714c('0x3d')]){_0x239449[_0x714c('0x42')]=[{'all':!![]}];}_0x239449=_[_0x714c('0x3b')]({},_0x239449,_0x202070[_0x714c('0x3c')]);return db['SmsQueueReport']['find'](_0x239449)[_0x714c('0x22')](handleEntityNotFound(_0x5ad4f2,null))[_0x714c('0x22')](respondWithResult(_0x5ad4f2,null))['catch'](handleError(_0x5ad4f2,null));};exports[_0x714c('0x43')]=function(_0x1b0e78,_0x3169db){return db[_0x714c('0x28')][_0x714c('0x43')](_0x1b0e78[_0x714c('0x44')],{})[_0x714c('0x22')](respondWithResult(_0x3169db,0xc9))[_0x714c('0x3f')](handleError(_0x3169db,null));};exports[_0x714c('0x21')]=function(_0x3010e7,_0x2f1220){if(_0x3010e7[_0x714c('0x44')]['id']){delete _0x3010e7[_0x714c('0x44')]['id'];}return db[_0x714c('0x28')]['find']({'where':{'id':_0x3010e7['params']['id']}})[_0x714c('0x22')](handleEntityNotFound(_0x2f1220,null))['then'](saveUpdates(_0x3010e7[_0x714c('0x44')],null))['then'](respondWithResult(_0x2f1220,null))[_0x714c('0x3f')](handleError(_0x2f1220,null));};exports[_0x714c('0x23')]=function(_0x2fd191,_0x58f09b){return db[_0x714c('0x28')][_0x714c('0x45')]({'where':{'id':_0x2fd191['params']['id']}})[_0x714c('0x22')](handleEntityNotFound(_0x58f09b,null))[_0x714c('0x22')](removeEntity(_0x58f09b,null))[_0x714c('0x3f')](handleError(_0x58f09b,null));};exports['describe']=function(_0x577945,_0x585e23){return db[_0x714c('0x28')]['describe']()[_0x714c('0x22')](respondWithResult(_0x585e23,null))[_0x714c('0x3f')](handleError(_0x585e23,null));}; \ No newline at end of file +var _0x46a8=['length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','params','keys','rawAttributes','include','catch','create','body','find','describe','html-pdf','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','status','json','count','offset','apply','save','update','then','destroy','sendStatus','error','name','send','index','map','SmsQueueReport','fieldName','type','query','filters','intersection','model','fields','attributes'];(function(_0x15d56e,_0x4c567e){var _0x3cdd8c=function(_0x345851){while(--_0x345851){_0x15d56e['push'](_0x15d56e['shift']());}};_0x3cdd8c(++_0x4c567e);}(_0x46a8,0xe6));var _0x846a=function(_0x2c1450,_0x131773){_0x2c1450=_0x2c1450-0x0;var _0x5ba1de=_0x46a8[_0x2c1450];return _0x5ba1de;};'use strict';var pdf=require(_0x846a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x846a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x846a('0x2'));var moment=require(_0x846a('0x3'));var BPromise=require(_0x846a('0x4'));var Mustache=require(_0x846a('0x5'));var util=require(_0x846a('0x6'));var path=require(_0x846a('0x7'));var sox=require(_0x846a('0x8'));var csv=require(_0x846a('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x846a('0xa'));var squel=require('squel');var crypto=require(_0x846a('0xb'));var jsforce=require(_0x846a('0xc'));var deskjs=require(_0x846a('0xd'));var toCsv=require(_0x846a('0x9'));var querystring=require(_0x846a('0xe'));var Papa=require(_0x846a('0xf'));var Redis=require(_0x846a('0x10'));var authService=require(_0x846a('0x11'));var qs=require(_0x846a('0x12'));var as=require(_0x846a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x846a('0x14'));var utils=require(_0x846a('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d2db6,_0x42556c){_0x42556c=_0x42556c||0xcc;return function(_0x47adbf){if(_0x47adbf){return _0x5d2db6['sendStatus'](_0x42556c);}return _0x5d2db6[_0x846a('0x16')](_0x42556c)['end']();};}function respondWithResult(_0x49a611,_0x1e1f63){_0x1e1f63=_0x1e1f63||0xc8;return function(_0x10bcde){if(_0x10bcde){return _0x49a611['status'](_0x1e1f63)[_0x846a('0x17')](_0x10bcde);}};}function respondWithFilteredResult(_0x2ea619,_0x4aa05b){return function(_0xc36484){if(_0xc36484){var _0x14b920=_0xc36484[_0x846a('0x18')],_0x3c228b=_0x4aa05b[_0x846a('0x19')],_0x2afb18=_0x4aa05b[_0x846a('0x19')]+_0x4aa05b['limit'],_0x3d5564;if(_0x2afb18>=_0x14b920){_0x2afb18=_0x14b920;_0x3d5564=0xc8;}else{_0x3d5564=0xce;}_0x2ea619[_0x846a('0x16')](_0x3d5564);return _0x2ea619['set']('Content-Range',_0x3c228b+'-'+_0x2afb18+'/'+_0x14b920)['json'](_0xc36484);}return null;};}function patchUpdates(_0x1a55bb){return function(_0x25a5d6){try{jsonpatch[_0x846a('0x1a')](_0x25a5d6,_0x1a55bb,!![]);}catch(_0x239761){return BPromise['reject'](_0x239761);}return _0x25a5d6[_0x846a('0x1b')]();};}function saveUpdates(_0x4d9895,_0x762ce2){return function(_0x56ad0){if(_0x56ad0){return _0x56ad0[_0x846a('0x1c')](_0x4d9895)[_0x846a('0x1d')](function(_0x2a180b){return _0x2a180b;});}return null;};}function removeEntity(_0x2916bd,_0x7655fd){return function(_0x4c94a6){if(_0x4c94a6){return _0x4c94a6[_0x846a('0x1e')]()[_0x846a('0x1d')](function(){_0x2916bd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b5d11,_0x5103a2){return function(_0x53b515){if(!_0x53b515){_0x1b5d11[_0x846a('0x1f')](0x194);}return _0x53b515;};}function handleError(_0x50ec4c,_0x283467){_0x283467=_0x283467||0x1f4;return function(_0x500aeb){logger[_0x846a('0x20')](_0x500aeb['stack']);if(_0x500aeb[_0x846a('0x21')]){delete _0x500aeb[_0x846a('0x21')];}_0x50ec4c[_0x846a('0x16')](_0x283467)[_0x846a('0x22')](_0x500aeb);};}exports[_0x846a('0x23')]=function(_0x3e1c13,_0xee5d9f){var _0x4ee54d={},_0x48d0dc={},_0x45f8d9={'count':0x0,'rows':[]};var _0x1d19b5=_[_0x846a('0x24')](db[_0x846a('0x25')]['rawAttributes'],function(_0x5f511e){return{'name':_0x5f511e[_0x846a('0x26')],'type':_0x5f511e[_0x846a('0x27')]['key']};});_0x48d0dc['model']=_['map'](_0x1d19b5,'name');_0x48d0dc[_0x846a('0x28')]=_['keys'](_0x3e1c13[_0x846a('0x28')]);_0x48d0dc[_0x846a('0x29')]=_[_0x846a('0x2a')](_0x48d0dc['model'],_0x48d0dc[_0x846a('0x28')]);_0x4ee54d['attributes']=_[_0x846a('0x2a')](_0x48d0dc[_0x846a('0x2b')],qs[_0x846a('0x2c')](_0x3e1c13['query']['fields']));_0x4ee54d['attributes']=_0x4ee54d[_0x846a('0x2d')][_0x846a('0x2e')]?_0x4ee54d[_0x846a('0x2d')]:_0x48d0dc[_0x846a('0x2b')];if(!_0x3e1c13[_0x846a('0x28')][_0x846a('0x2f')](_0x846a('0x30'))){_0x4ee54d[_0x846a('0x31')]=qs[_0x846a('0x31')](_0x3e1c13[_0x846a('0x28')][_0x846a('0x31')]);_0x4ee54d['offset']=qs[_0x846a('0x19')](_0x3e1c13[_0x846a('0x28')][_0x846a('0x19')]);}_0x4ee54d[_0x846a('0x32')]=qs[_0x846a('0x33')](_0x3e1c13[_0x846a('0x28')]['sort']);_0x4ee54d[_0x846a('0x34')]=qs['filters'](_[_0x846a('0x35')](_0x3e1c13[_0x846a('0x28')],_0x48d0dc[_0x846a('0x29')]));if(_0x3e1c13['query']['filter']){_0x4ee54d[_0x846a('0x34')]=_[_0x846a('0x36')](_0x4ee54d[_0x846a('0x34')],{'$or':_['map'](_0x1d19b5,function(_0x5cfbe5){if(_0x5cfbe5[_0x846a('0x27')]!==_0x846a('0x37')){var _0x5e82f4={};_0x5e82f4[_0x5cfbe5[_0x846a('0x21')]]={'$like':'%'+_0x3e1c13['query']['filter']+'%'};return _0x5e82f4;}})});}_0x4ee54d=_[_0x846a('0x36')]({},_0x4ee54d,_0x3e1c13[_0x846a('0x38')]);var _0x35479f={'where':_0x4ee54d['where']};return db[_0x846a('0x25')][_0x846a('0x18')](_0x35479f)[_0x846a('0x1d')](function(_0x2e1ed1){_0x45f8d9[_0x846a('0x18')]=_0x2e1ed1;if(_0x3e1c13[_0x846a('0x28')][_0x846a('0x39')]){_0x4ee54d['include']=[{'all':!![]}];}return db[_0x846a('0x25')][_0x846a('0x3a')](_0x4ee54d);})['then'](function(_0x5f1b07){_0x45f8d9[_0x846a('0x3b')]=_0x5f1b07;return _0x45f8d9;})['then'](respondWithFilteredResult(_0xee5d9f,_0x4ee54d))['catch'](handleError(_0xee5d9f,null));};exports['show']=function(_0x5d76fb,_0x421087){var _0x20f819={'raw':!![],'where':{'id':_0x5d76fb[_0x846a('0x3c')]['id']}},_0x21a06e={};_0x21a06e[_0x846a('0x2b')]=_[_0x846a('0x3d')](db[_0x846a('0x25')][_0x846a('0x3e')]);_0x21a06e[_0x846a('0x28')]=_[_0x846a('0x3d')](_0x5d76fb[_0x846a('0x28')]);_0x21a06e['filters']=_[_0x846a('0x2a')](_0x21a06e[_0x846a('0x2b')],_0x21a06e['query']);_0x20f819[_0x846a('0x2d')]=_[_0x846a('0x2a')](_0x21a06e[_0x846a('0x2b')],qs[_0x846a('0x2c')](_0x5d76fb[_0x846a('0x28')][_0x846a('0x2c')]));_0x20f819[_0x846a('0x2d')]=_0x20f819[_0x846a('0x2d')][_0x846a('0x2e')]?_0x20f819[_0x846a('0x2d')]:_0x21a06e[_0x846a('0x2b')];if(_0x5d76fb[_0x846a('0x28')]['includeAll']){_0x20f819[_0x846a('0x3f')]=[{'all':!![]}];}_0x20f819=_[_0x846a('0x36')]({},_0x20f819,_0x5d76fb[_0x846a('0x38')]);return db[_0x846a('0x25')]['find'](_0x20f819)['then'](handleEntityNotFound(_0x421087,null))[_0x846a('0x1d')](respondWithResult(_0x421087,null))[_0x846a('0x40')](handleError(_0x421087,null));};exports[_0x846a('0x41')]=function(_0x3649de,_0x576683){return db[_0x846a('0x25')][_0x846a('0x41')](_0x3649de[_0x846a('0x42')],{})[_0x846a('0x1d')](respondWithResult(_0x576683,0xc9))[_0x846a('0x40')](handleError(_0x576683,null));};exports['update']=function(_0xf73b8d,_0x1b91bb){if(_0xf73b8d[_0x846a('0x42')]['id']){delete _0xf73b8d[_0x846a('0x42')]['id'];}return db[_0x846a('0x25')][_0x846a('0x43')]({'where':{'id':_0xf73b8d[_0x846a('0x3c')]['id']}})[_0x846a('0x1d')](handleEntityNotFound(_0x1b91bb,null))[_0x846a('0x1d')](saveUpdates(_0xf73b8d[_0x846a('0x42')],null))[_0x846a('0x1d')](respondWithResult(_0x1b91bb,null))[_0x846a('0x40')](handleError(_0x1b91bb,null));};exports[_0x846a('0x1e')]=function(_0x5c8139,_0x20c0ba){return db[_0x846a('0x25')]['find']({'where':{'id':_0x5c8139['params']['id']}})['then'](handleEntityNotFound(_0x20c0ba,null))[_0x846a('0x1d')](removeEntity(_0x20c0ba,null))[_0x846a('0x40')](handleError(_0x20c0ba,null));};exports[_0x846a('0x44')]=function(_0x16419f,_0x41a335){return db[_0x846a('0x25')][_0x846a('0x44')]()[_0x846a('0x1d')](respondWithResult(_0x41a335,null))['catch'](handleError(_0x41a335,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 919cfdf..af2663a 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 _0x0f61=['bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','util','moment'];(function(_0x552f57,_0xb5c93a){var _0x599df2=function(_0x49c29e){while(--_0x49c29e){_0x552f57['push'](_0x552f57['shift']());}};_0x599df2(++_0xb5c93a);}(_0x0f61,0xa6));var _0x10f6=function(_0x39a080,_0x5bdef4){_0x39a080=_0x39a080-0x0;var _0x58cb9e=_0x0f61[_0x39a080];return _0x58cb9e;};'use strict';var _=require('lodash');var util=require(_0x10f6('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x10f6('0x1'));var BPromise=require(_0x10f6('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x10f6('0x3'));var rimraf=require(_0x10f6('0x4'));var config=require(_0x10f6('0x5'));var attributes=require(_0x10f6('0x6'));module[_0x10f6('0x7')]=function(_0x3f7624,_0x14defc){return _0x3f7624[_0x10f6('0x8')](_0x10f6('0x9'),attributes,{'tableName':_0x10f6('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x10f6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5ed3=['define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes'];(function(_0x3e4477,_0x15971e){var _0xd46363=function(_0x4d5b90){while(--_0x4d5b90){_0x3e4477['push'](_0x3e4477['shift']());}};_0xd46363(++_0x15971e);}(_0x5ed3,0x9e));var _0x35ed=function(_0xb5950b,_0x383dfe){_0xb5950b=_0xb5950b-0x0;var _0x123ced=_0x5ed3[_0xb5950b];return _0x123ced;};'use strict';var _=require(_0x35ed('0x0'));var util=require(_0x35ed('0x1'));var logger=require(_0x35ed('0x2'))(_0x35ed('0x3'));var moment=require(_0x35ed('0x4'));var BPromise=require(_0x35ed('0x5'));var rp=require(_0x35ed('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x35ed('0x7'));var config=require(_0x35ed('0x8'));var attributes=require(_0x35ed('0x9'));module['exports']=function(_0x592fe2,_0x1b11ce){return _0x592fe2[_0x35ed('0xa')](_0x35ed('0xb'),attributes,{'tableName':_0x35ed('0xc'),'paranoid':![],'indexes':[{'name':_0x35ed('0xd'),'fields':[_0x35ed('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 4a3d160..6311f10 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 _0xafac=['stringify','error','code','message','CreateSmsQueueReport','create','options','debug','UpdateSmsQueueReport','SmsQueueReport','update','body','attributes','limit','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x39cd3c,_0xa21102){var _0x47a0ae=function(_0x330b05){while(--_0x330b05){_0x39cd3c['push'](_0x39cd3c['shift']());}};_0x47a0ae(++_0xa21102);}(_0xafac,0x1cf));var _0xcafa=function(_0x1f3ca1,_0x35f925){_0x1f3ca1=_0x1f3ca1-0x0;var _0x243ec7=_0xafac[_0x1f3ca1];return _0x243ec7;};'use strict';var _=require(_0xcafa('0x0'));var util=require('util');var moment=require(_0xcafa('0x1'));var BPromise=require(_0xcafa('0x2'));var rs=require(_0xcafa('0x3'));var fs=require('fs');var Redis=require(_0xcafa('0x4'));var db=require(_0xcafa('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcafa('0x6'))(_0xcafa('0x7'));var config=require(_0xcafa('0x8'));var jayson=require(_0xcafa('0x9'));var client=jayson['client'][_0xcafa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x260ed2,_0x21d70c,_0x11d26e){return new BPromise(function(_0x1e79a2,_0x43d586){return client[_0xcafa('0xb')](_0x260ed2,_0x11d26e)[_0xcafa('0xc')](function(_0x4007eb){logger[_0xcafa('0xd')](_0xcafa('0xe'),_0x21d70c,_0xcafa('0xf'));logger['debug'](_0xcafa('0x10'),_0x21d70c,'request\x20sent',JSON[_0xcafa('0x11')](_0x4007eb));if(_0x4007eb[_0xcafa('0x12')]){if(_0x4007eb[_0xcafa('0x12')][_0xcafa('0x13')]===0x1f4){logger[_0xcafa('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x21d70c,_0x4007eb['error']['message']);return _0x43d586(_0x4007eb[_0xcafa('0x12')]['message']);}logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x21d70c,_0x4007eb[_0xcafa('0x12')][_0xcafa('0x14')]);return _0x1e79a2(_0x4007eb[_0xcafa('0x12')][_0xcafa('0x14')]);}else{logger[_0xcafa('0xd')](_0xcafa('0xe'),_0x21d70c,_0xcafa('0xf'));_0x1e79a2(_0x4007eb['result'][_0xcafa('0x14')]);}})['catch'](function(_0x5078f0){logger[_0xcafa('0x12')](_0xcafa('0xe'),_0x21d70c,_0x5078f0);_0x43d586(_0x5078f0);});});}exports[_0xcafa('0x15')]=function(_0x5027a7){var _0x425ae4=this;return new Promise(function(_0x11d1ee,_0x46d48e){return db['SmsQueueReport'][_0xcafa('0x16')](_0x5027a7['body'],{'raw':_0x5027a7[_0xcafa('0x17')]?_0x5027a7[_0xcafa('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xcafa('0xc')](function(_0x47cafd){logger[_0xcafa('0xd')](_0xcafa('0x15'),_0x5027a7);logger[_0xcafa('0x18')](_0xcafa('0x15'),_0x5027a7,JSON[_0xcafa('0x11')](_0x47cafd));_0x11d1ee(_0x47cafd);})['catch'](function(_0x44ab12){logger[_0xcafa('0x12')](_0xcafa('0x15'),_0x44ab12[_0xcafa('0x14')],_0x5027a7);_0x46d48e(_0x425ae4[_0xcafa('0x12')](0x1f4,_0x44ab12[_0xcafa('0x14')]));});});};exports[_0xcafa('0x19')]=function(_0x110534){var _0x232e5e=this;return new Promise(function(_0x4377be,_0x4df0e6){return db[_0xcafa('0x1a')][_0xcafa('0x1b')](_0x110534[_0xcafa('0x1c')],{'raw':_0x110534[_0xcafa('0x17')]?_0x110534[_0xcafa('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x110534[_0xcafa('0x17')]?_0x110534[_0xcafa('0x17')]['where']||null:null,'attributes':_0x110534[_0xcafa('0x17')]?_0x110534[_0xcafa('0x17')][_0xcafa('0x1d')]||null:null,'limit':_0x110534[_0xcafa('0x17')]?_0x110534[_0xcafa('0x17')][_0xcafa('0x1e')]||null:null})['then'](function(_0x4c0413){logger[_0xcafa('0xd')]('UpdateSmsQueueReport',_0x110534);logger[_0xcafa('0x18')](_0xcafa('0x19'),_0x110534,JSON[_0xcafa('0x11')](_0x4c0413));_0x4377be(_0x4c0413);})[_0xcafa('0x1f')](function(_0x53e6d5){logger['error'](_0xcafa('0x19'),_0x53e6d5[_0xcafa('0x14')],_0x110534);_0x4df0e6(_0x232e5e[_0xcafa('0x12')](0x1f4,_0x53e6d5[_0xcafa('0x14')]));});});}; \ No newline at end of file +var _0x8936=['code','SmsQueueReport,\x20%s,\x20%s','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','UpdateSmsQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x16954c,_0x2f3051){var _0x93e220=function(_0x539dd1){while(--_0x539dd1){_0x16954c['push'](_0x16954c['shift']());}};_0x93e220(++_0x2f3051);}(_0x8936,0x1dd));var _0x6893=function(_0x163e4e,_0x44cc89){_0x163e4e=_0x163e4e-0x0;var _0x4d825c=_0x8936[_0x163e4e];return _0x4d825c;};'use strict';var _=require(_0x6893('0x0'));var util=require(_0x6893('0x1'));var moment=require(_0x6893('0x2'));var BPromise=require(_0x6893('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6893('0x4'));var db=require(_0x6893('0x5'))['db'];var utils=require(_0x6893('0x6'));var logger=require(_0x6893('0x7'))(_0x6893('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6893('0x9')][_0x6893('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f66f0,_0x33c208,_0x497478){return new BPromise(function(_0x5f51eb,_0x581e7b){return client['request'](_0x2f66f0,_0x497478)[_0x6893('0xb')](function(_0x27bcbe){logger[_0x6893('0xc')]('SmsQueueReport,\x20%s,\x20%s',_0x33c208,_0x6893('0xd'));logger[_0x6893('0xe')](_0x6893('0xf'),_0x33c208,_0x6893('0xd'),JSON[_0x6893('0x10')](_0x27bcbe));if(_0x27bcbe[_0x6893('0x11')]){if(_0x27bcbe[_0x6893('0x11')][_0x6893('0x12')]===0x1f4){logger[_0x6893('0x11')](_0x6893('0x13'),_0x33c208,_0x27bcbe[_0x6893('0x11')][_0x6893('0x14')]);return _0x581e7b(_0x27bcbe[_0x6893('0x11')]['message']);}logger['error'](_0x6893('0x13'),_0x33c208,_0x27bcbe[_0x6893('0x11')][_0x6893('0x14')]);return _0x5f51eb(_0x27bcbe[_0x6893('0x11')]['message']);}else{logger[_0x6893('0xc')](_0x6893('0x13'),_0x33c208,_0x6893('0xd'));_0x5f51eb(_0x27bcbe[_0x6893('0x15')][_0x6893('0x14')]);}})[_0x6893('0x16')](function(_0x1e4516){logger[_0x6893('0x11')](_0x6893('0x13'),_0x33c208,_0x1e4516);_0x581e7b(_0x1e4516);});});}exports[_0x6893('0x17')]=function(_0x1f0f7){var _0x58b26d=this;return new Promise(function(_0xb2b86d,_0x43ef3f){return db[_0x6893('0x18')][_0x6893('0x19')](_0x1f0f7[_0x6893('0x1a')],{'raw':_0x1f0f7[_0x6893('0x1b')]?_0x1f0f7[_0x6893('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x6893('0xb')](function(_0x5924cb){logger[_0x6893('0xc')](_0x6893('0x17'),_0x1f0f7);logger[_0x6893('0xe')](_0x6893('0x17'),_0x1f0f7,JSON[_0x6893('0x10')](_0x5924cb));_0xb2b86d(_0x5924cb);})[_0x6893('0x16')](function(_0x4c216b){logger[_0x6893('0x11')](_0x6893('0x17'),_0x4c216b['message'],_0x1f0f7);_0x43ef3f(_0x58b26d[_0x6893('0x11')](0x1f4,_0x4c216b[_0x6893('0x14')]));});});};exports[_0x6893('0x1c')]=function(_0x4dafd0){var _0x430ea6=this;return new Promise(function(_0x26963a,_0x362a7d){return db[_0x6893('0x18')][_0x6893('0x1d')](_0x4dafd0[_0x6893('0x1a')],{'raw':_0x4dafd0[_0x6893('0x1b')]?_0x4dafd0[_0x6893('0x1b')][_0x6893('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4dafd0[_0x6893('0x1b')]?_0x4dafd0[_0x6893('0x1b')][_0x6893('0x1f')]||null:null,'attributes':_0x4dafd0[_0x6893('0x1b')]?_0x4dafd0[_0x6893('0x1b')]['attributes']||null:null,'limit':_0x4dafd0[_0x6893('0x1b')]?_0x4dafd0[_0x6893('0x1b')][_0x6893('0x20')]||null:null})['then'](function(_0x203a70){logger['info'](_0x6893('0x1c'),_0x4dafd0);logger[_0x6893('0xe')]('UpdateSmsQueueReport',_0x4dafd0,JSON['stringify'](_0x203a70));_0x26963a(_0x203a70);})['catch'](function(_0x22157d){logger[_0x6893('0x11')](_0x6893('0x1c'),_0x22157d[_0x6893('0x14')],_0x4dafd0);_0x362a7d(_0x430ea6[_0x6893('0x11')](0x1f4,_0x22157d['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 9d30da3..9c09ea0 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 _0x2547=['../../config/environment','get','isAuthenticated','index','describe','create','put','/:id','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x80bc3a,_0x139f7b){var _0x230e8d=function(_0x31f61a){while(--_0x31f61a){_0x80bc3a['push'](_0x80bc3a['shift']());}};_0x230e8d(++_0x139f7b);}(_0x2547,0x1cd));var _0x7254=function(_0x3cf966,_0x46604e){_0x3cf966=_0x3cf966-0x0;var _0x46e03a=_0x2547[_0x3cf966];return _0x46e03a;};'use strict';var multer=require('multer');var util=require(_0x7254('0x0'));var path=require(_0x7254('0x1'));var timeout=require(_0x7254('0x2'));var express=require(_0x7254('0x3'));var router=express[_0x7254('0x4')]();var auth=require(_0x7254('0x5'));var interaction=require(_0x7254('0x6'));var config=require(_0x7254('0x7'));var controller=require('./smsTransferReport.controller');router[_0x7254('0x8')]('/',auth[_0x7254('0x9')](),controller[_0x7254('0xa')]);router[_0x7254('0x8')]('/describe',auth[_0x7254('0x9')](),controller[_0x7254('0xb')]);router[_0x7254('0x8')]('/:id',auth[_0x7254('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x7254('0xc')]);router[_0x7254('0xd')](_0x7254('0xe'),auth[_0x7254('0x9')](),controller[_0x7254('0xf')]);router[_0x7254('0x10')]('/:id',auth[_0x7254('0x9')](),controller['destroy']);module[_0x7254('0x11')]=router; \ No newline at end of file +var _0x3266=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x2f3b78,_0x4b2ba9){var _0x2c202b=function(_0x5f0b12){while(--_0x5f0b12){_0x2f3b78['push'](_0x2f3b78['shift']());}};_0x2c202b(++_0x4b2ba9);}(_0x3266,0x6a));var _0x6326=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0x3266[_0x9c2427];return _0x51984f;};'use strict';var multer=require(_0x6326('0x0'));var util=require(_0x6326('0x1'));var path=require(_0x6326('0x2'));var timeout=require(_0x6326('0x3'));var express=require(_0x6326('0x4'));var router=express[_0x6326('0x5')]();var auth=require(_0x6326('0x6'));var interaction=require(_0x6326('0x7'));var config=require(_0x6326('0x8'));var controller=require('./smsTransferReport.controller');router[_0x6326('0x9')]('/',auth['isAuthenticated'](),controller[_0x6326('0xa')]);router[_0x6326('0x9')](_0x6326('0xb'),auth['isAuthenticated'](),controller[_0x6326('0xc')]);router['get'](_0x6326('0xd'),auth[_0x6326('0xe')](),controller[_0x6326('0xf')]);router[_0x6326('0x10')]('/',auth[_0x6326('0xe')](),controller['create']);router[_0x6326('0x11')](_0x6326('0xd'),auth[_0x6326('0xe')](),controller[_0x6326('0x12')]);router[_0x6326('0x13')](_0x6326('0xd'),auth[_0x6326('0xe')](),controller[_0x6326('0x14')]);module[_0x6326('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index ce4a274..0cf24b0 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 _0x5de1=['agent','queue','DATE','NOW','moment','sequelize','exports','STRING','ENUM','account'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x5de1,0x130));var _0x15de=function(_0x566301,_0x4dd87b){_0x566301=_0x566301-0x0;var _0xc0994=_0x5de1[_0x566301];return _0xc0994;};'use strict';var moment=require(_0x15de('0x0'));var Sequelize=require(_0x15de('0x1'));module[_0x15de('0x2')]={'uniqueid':{'type':Sequelize[_0x15de('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x15de('0x4')](_0x15de('0x5'),_0x15de('0x6'),_0x15de('0x7')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x15de('0x8')],'allowNull':![],'defaultValue':Sequelize[_0x15de('0x9')]}}; \ No newline at end of file +var _0xfe69=['queue','DATE','NOW','moment','exports','STRING','ENUM','account','agent'];(function(_0x14f579,_0x26f578){var _0x52bc49=function(_0x395c88){while(--_0x395c88){_0x14f579['push'](_0x14f579['shift']());}};_0x52bc49(++_0x26f578);}(_0xfe69,0x198));var _0x9fe6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfe69[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x9fe6('0x0'));var Sequelize=require('sequelize');module[_0x9fe6('0x1')]={'uniqueid':{'type':Sequelize[_0x9fe6('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9fe6('0x3')](_0x9fe6('0x4'),_0x9fe6('0x5'),'queue'),'allowNull':![],'defaultValue':_0x9fe6('0x6')},'transferredAt':{'type':Sequelize[_0x9fe6('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x9fe6('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index d4c9dab..a4bb3b8 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 _0x49b4=['lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','error','name','index','map','SmsTransferReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','rows','catch','params','includeAll','include','find','create','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x4394fa,_0x1364ff){var _0x3ec0ac=function(_0x3b0d96){while(--_0x3b0d96){_0x4394fa['push'](_0x4394fa['shift']());}};_0x3ec0ac(++_0x1364ff);}(_0x49b4,0x10d));var _0x449b=function(_0x48a828,_0x51ffaf){_0x48a828=_0x48a828-0x0;var _0x1d498c=_0x49b4[_0x48a828];return _0x1d498c;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x449b('0x0'));var zipdir=require(_0x449b('0x1'));var jsonpatch=require(_0x449b('0x2'));var rp=require('request-promise');var moment=require(_0x449b('0x3'));var BPromise=require(_0x449b('0x4'));var Mustache=require(_0x449b('0x5'));var util=require(_0x449b('0x6'));var path=require(_0x449b('0x7'));var sox=require(_0x449b('0x8'));var csv=require(_0x449b('0x9'));var ejs=require(_0x449b('0xa'));var fs=require('fs');var _=require(_0x449b('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x449b('0xc'));var deskjs=require(_0x449b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x449b('0xe'));var Papa=require(_0x449b('0xf'));var Redis=require(_0x449b('0x10'));var authService=require(_0x449b('0x11'));var qs=require(_0x449b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x449b('0x13'));var logger=require(_0x449b('0x14'))(_0x449b('0x15'));var utils=require(_0x449b('0x16'));var config=require(_0x449b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b85d8,_0x167faa){_0x167faa=_0x167faa||0xcc;return function(_0x344887){if(_0x344887){return _0x4b85d8[_0x449b('0x18')](_0x167faa);}return _0x4b85d8[_0x449b('0x19')](_0x167faa)[_0x449b('0x1a')]();};}function respondWithResult(_0x20b703,_0xcdb08f){_0xcdb08f=_0xcdb08f||0xc8;return function(_0x582f51){if(_0x582f51){return _0x20b703[_0x449b('0x19')](_0xcdb08f)[_0x449b('0x1b')](_0x582f51);}};}function respondWithFilteredResult(_0x31ee9c,_0x2a71e2){return function(_0x53d34b){if(_0x53d34b){var _0x28cfd1=_0x53d34b[_0x449b('0x1c')],_0x2fb33d=_0x2a71e2[_0x449b('0x1d')],_0xa8734f=_0x2a71e2[_0x449b('0x1d')]+_0x2a71e2['limit'],_0x2cbfe7;if(_0xa8734f>=_0x28cfd1){_0xa8734f=_0x28cfd1;_0x2cbfe7=0xc8;}else{_0x2cbfe7=0xce;}_0x31ee9c[_0x449b('0x19')](_0x2cbfe7);return _0x31ee9c[_0x449b('0x1e')](_0x449b('0x1f'),_0x2fb33d+'-'+_0xa8734f+'/'+_0x28cfd1)[_0x449b('0x1b')](_0x53d34b);}return null;};}function patchUpdates(_0x4546ef){return function(_0x583c77){try{jsonpatch[_0x449b('0x20')](_0x583c77,_0x4546ef,!![]);}catch(_0x9d0a67){return BPromise['reject'](_0x9d0a67);}return _0x583c77[_0x449b('0x21')]();};}function saveUpdates(_0x23c787,_0x1317c8){return function(_0x50f9cf){if(_0x50f9cf){return _0x50f9cf[_0x449b('0x22')](_0x23c787)[_0x449b('0x23')](function(_0x26641b){return _0x26641b;});}return null;};}function removeEntity(_0x655ae4,_0xa8986f){return function(_0x4aaf64){if(_0x4aaf64){return _0x4aaf64[_0x449b('0x24')]()[_0x449b('0x23')](function(){_0x655ae4[_0x449b('0x19')](0xcc)[_0x449b('0x1a')]();});}};}function handleEntityNotFound(_0x547cb5,_0x1a7ff6){return function(_0x1b3c1a){if(!_0x1b3c1a){_0x547cb5[_0x449b('0x18')](0x194);}return _0x1b3c1a;};}function handleError(_0x247783,_0x20a0dd){_0x20a0dd=_0x20a0dd||0x1f4;return function(_0x265cb1){logger[_0x449b('0x25')](_0x265cb1['stack']);if(_0x265cb1['name']){delete _0x265cb1[_0x449b('0x26')];}_0x247783[_0x449b('0x19')](_0x20a0dd)['send'](_0x265cb1);};}exports[_0x449b('0x27')]=function(_0x28bec0,_0x5d8a54){var _0x365589={},_0x4d9035={},_0x3c9c69={'count':0x0,'rows':[]};var _0x4f1b45=_[_0x449b('0x28')](db[_0x449b('0x29')][_0x449b('0x2a')],function(_0x4b7f70){return{'name':_0x4b7f70['fieldName'],'type':_0x4b7f70[_0x449b('0x2b')][_0x449b('0x2c')]};});_0x4d9035[_0x449b('0x2d')]=_[_0x449b('0x28')](_0x4f1b45,_0x449b('0x26'));_0x4d9035[_0x449b('0x2e')]=_[_0x449b('0x2f')](_0x28bec0['query']);_0x4d9035[_0x449b('0x30')]=_[_0x449b('0x31')](_0x4d9035[_0x449b('0x2d')],_0x4d9035['query']);_0x365589[_0x449b('0x32')]=_[_0x449b('0x31')](_0x4d9035['model'],qs['fields'](_0x28bec0[_0x449b('0x2e')][_0x449b('0x33')]));_0x365589[_0x449b('0x32')]=_0x365589[_0x449b('0x32')]['length']?_0x365589[_0x449b('0x32')]:_0x4d9035['model'];if(!_0x28bec0[_0x449b('0x2e')][_0x449b('0x34')](_0x449b('0x35'))){_0x365589['limit']=qs['limit'](_0x28bec0[_0x449b('0x2e')][_0x449b('0x36')]);_0x365589['offset']=qs[_0x449b('0x1d')](_0x28bec0[_0x449b('0x2e')][_0x449b('0x1d')]);}_0x365589['order']=qs[_0x449b('0x37')](_0x28bec0[_0x449b('0x2e')][_0x449b('0x37')]);_0x365589[_0x449b('0x38')]=qs[_0x449b('0x30')](_[_0x449b('0x39')](_0x28bec0['query'],_0x4d9035['filters']));if(_0x28bec0[_0x449b('0x2e')][_0x449b('0x3a')]){_0x365589['where']=_[_0x449b('0x3b')](_0x365589[_0x449b('0x38')],{'$or':_[_0x449b('0x28')](_0x4f1b45,function(_0x1ccb47){if(_0x1ccb47[_0x449b('0x2b')]!==_0x449b('0x3c')){var _0x48d947={};_0x48d947[_0x1ccb47[_0x449b('0x26')]]={'$like':'%'+_0x28bec0[_0x449b('0x2e')][_0x449b('0x3a')]+'%'};return _0x48d947;}})});}_0x365589=_[_0x449b('0x3b')]({},_0x365589,_0x28bec0[_0x449b('0x3d')]);var _0x387aef={'where':_0x365589[_0x449b('0x38')]};return db['SmsTransferReport'][_0x449b('0x1c')](_0x387aef)[_0x449b('0x23')](function(_0x45fb0d){_0x3c9c69['count']=_0x45fb0d;if(_0x28bec0[_0x449b('0x2e')]['includeAll']){_0x365589['include']=[{'all':!![]}];}return db[_0x449b('0x29')]['findAll'](_0x365589);})['then'](function(_0x374be0){_0x3c9c69[_0x449b('0x3e')]=_0x374be0;return _0x3c9c69;})[_0x449b('0x23')](respondWithFilteredResult(_0x5d8a54,_0x365589))[_0x449b('0x3f')](handleError(_0x5d8a54,null));};exports['show']=function(_0x49f186,_0x46bd5d){var _0x100161={'raw':!![],'where':{'id':_0x49f186[_0x449b('0x40')]['id']}},_0x5a6725={};_0x5a6725[_0x449b('0x2d')]=_[_0x449b('0x2f')](db['SmsTransferReport']['rawAttributes']);_0x5a6725[_0x449b('0x2e')]=_[_0x449b('0x2f')](_0x49f186['query']);_0x5a6725[_0x449b('0x30')]=_[_0x449b('0x31')](_0x5a6725[_0x449b('0x2d')],_0x5a6725[_0x449b('0x2e')]);_0x100161[_0x449b('0x32')]=_[_0x449b('0x31')](_0x5a6725[_0x449b('0x2d')],qs['fields'](_0x49f186[_0x449b('0x2e')][_0x449b('0x33')]));_0x100161[_0x449b('0x32')]=_0x100161[_0x449b('0x32')]['length']?_0x100161[_0x449b('0x32')]:_0x5a6725['model'];if(_0x49f186[_0x449b('0x2e')][_0x449b('0x41')]){_0x100161[_0x449b('0x42')]=[{'all':!![]}];}_0x100161=_[_0x449b('0x3b')]({},_0x100161,_0x49f186[_0x449b('0x3d')]);return db[_0x449b('0x29')][_0x449b('0x43')](_0x100161)[_0x449b('0x23')](handleEntityNotFound(_0x46bd5d,null))[_0x449b('0x23')](respondWithResult(_0x46bd5d,null))[_0x449b('0x3f')](handleError(_0x46bd5d,null));};exports[_0x449b('0x44')]=function(_0x10b500,_0x485ec1){return db[_0x449b('0x29')]['create'](_0x10b500[_0x449b('0x45')],{})['then'](respondWithResult(_0x485ec1,0xc9))['catch'](handleError(_0x485ec1,null));};exports['update']=function(_0x5cfe57,_0x25a22c){if(_0x5cfe57['body']['id']){delete _0x5cfe57[_0x449b('0x45')]['id'];}return db['SmsTransferReport'][_0x449b('0x43')]({'where':{'id':_0x5cfe57[_0x449b('0x40')]['id']}})['then'](handleEntityNotFound(_0x25a22c,null))[_0x449b('0x23')](saveUpdates(_0x5cfe57[_0x449b('0x45')],null))[_0x449b('0x23')](respondWithResult(_0x25a22c,null))[_0x449b('0x3f')](handleError(_0x25a22c,null));};exports[_0x449b('0x24')]=function(_0x44ad62,_0x841a49){return db['SmsTransferReport'][_0x449b('0x43')]({'where':{'id':_0x44ad62[_0x449b('0x40')]['id']}})[_0x449b('0x23')](handleEntityNotFound(_0x841a49,null))[_0x449b('0x23')](removeEntity(_0x841a49,null))[_0x449b('0x3f')](handleError(_0x841a49,null));};exports['describe']=function(_0x4bc46b,_0x28e922){return db[_0x449b('0x29')]['describe']()[_0x449b('0x23')](respondWithResult(_0x28e922,null))['catch'](handleError(_0x28e922,null));}; \ No newline at end of file +var _0xa8e8=['rawAttributes','fieldName','type','key','model','query','attributes','fields','length','nolimit','limit','order','sort','filters','where','merge','VIRTUAL','filter','options','SmsTransferReport','count','includeAll','include','findAll','rows','catch','keys','intersection','find','create','body','params','destroy','describe','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','status','set','Content-Range','apply','reject','update','then','name','send','index','map'];(function(_0x568a61,_0x2124f8){var _0x334c3b=function(_0x1afc39){while(--_0x1afc39){_0x568a61['push'](_0x568a61['shift']());}};_0x334c3b(++_0x2124f8);}(_0xa8e8,0x14a));var _0x8a8e=function(_0x536a51,_0x2bf510){_0x536a51=_0x536a51-0x0;var _0x4a4d9e=_0xa8e8[_0x536a51];return _0x4a4d9e;};'use strict';var pdf=require(_0x8a8e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8a8e('0x1'));var zipdir=require(_0x8a8e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8a8e('0x3'));var moment=require(_0x8a8e('0x4'));var BPromise=require(_0x8a8e('0x5'));var Mustache=require('mustache');var util=require(_0x8a8e('0x6'));var path=require(_0x8a8e('0x7'));var sox=require(_0x8a8e('0x8'));var csv=require(_0x8a8e('0x9'));var ejs=require(_0x8a8e('0xa'));var fs=require('fs');var _=require(_0x8a8e('0xb'));var squel=require(_0x8a8e('0xc'));var crypto=require(_0x8a8e('0xd'));var jsforce=require(_0x8a8e('0xe'));var deskjs=require(_0x8a8e('0xf'));var toCsv=require(_0x8a8e('0x9'));var querystring=require('querystring');var Papa=require(_0x8a8e('0x10'));var Redis=require(_0x8a8e('0x11'));var authService=require(_0x8a8e('0x12'));var qs=require(_0x8a8e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8a8e('0x14'));var logger=require(_0x8a8e('0x15'))(_0x8a8e('0x16'));var utils=require(_0x8a8e('0x17'));var config=require(_0x8a8e('0x18'));var db=require(_0x8a8e('0x19'))['db'];function respondWithStatusCode(_0x4a66e7,_0x4871d0){_0x4871d0=_0x4871d0||0xcc;return function(_0x1b4978){if(_0x1b4978){return _0x4a66e7[_0x8a8e('0x1a')](_0x4871d0);}return _0x4a66e7['status'](_0x4871d0)['end']();};}function respondWithResult(_0x57a9d8,_0x3f5382){_0x3f5382=_0x3f5382||0xc8;return function(_0x2f68c7){if(_0x2f68c7){return _0x57a9d8['status'](_0x3f5382)[_0x8a8e('0x1b')](_0x2f68c7);}};}function respondWithFilteredResult(_0x3a0ca2,_0x581097){return function(_0x511d7c){if(_0x511d7c){var _0x29ae57=_0x511d7c['count'],_0x2fa4dd=_0x581097[_0x8a8e('0x1c')],_0xe352ba=_0x581097['offset']+_0x581097['limit'],_0x42d32a;if(_0xe352ba>=_0x29ae57){_0xe352ba=_0x29ae57;_0x42d32a=0xc8;}else{_0x42d32a=0xce;}_0x3a0ca2[_0x8a8e('0x1d')](_0x42d32a);return _0x3a0ca2[_0x8a8e('0x1e')](_0x8a8e('0x1f'),_0x2fa4dd+'-'+_0xe352ba+'/'+_0x29ae57)[_0x8a8e('0x1b')](_0x511d7c);}return null;};}function patchUpdates(_0x4319b0){return function(_0x4005a2){try{jsonpatch[_0x8a8e('0x20')](_0x4005a2,_0x4319b0,!![]);}catch(_0x1e6d14){return BPromise[_0x8a8e('0x21')](_0x1e6d14);}return _0x4005a2['save']();};}function saveUpdates(_0x89bf2e,_0x1fda64){return function(_0x4995fa){if(_0x4995fa){return _0x4995fa[_0x8a8e('0x22')](_0x89bf2e)[_0x8a8e('0x23')](function(_0x4005e4){return _0x4005e4;});}return null;};}function removeEntity(_0x3b12c9,_0x30ae1b){return function(_0x23f602){if(_0x23f602){return _0x23f602['destroy']()['then'](function(){_0x3b12c9[_0x8a8e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x599e64,_0x5e2af0){return function(_0x1cbace){if(!_0x1cbace){_0x599e64['sendStatus'](0x194);}return _0x1cbace;};}function handleError(_0x19c3a8,_0x3a7169){_0x3a7169=_0x3a7169||0x1f4;return function(_0x65f613){logger['error'](_0x65f613['stack']);if(_0x65f613['name']){delete _0x65f613[_0x8a8e('0x24')];}_0x19c3a8['status'](_0x3a7169)[_0x8a8e('0x25')](_0x65f613);};}exports[_0x8a8e('0x26')]=function(_0x375acf,_0x3b3122){var _0x11982a={},_0x4a11f7={},_0x5ce224={'count':0x0,'rows':[]};var _0x3ace69=_[_0x8a8e('0x27')](db['SmsTransferReport'][_0x8a8e('0x28')],function(_0x226325){return{'name':_0x226325[_0x8a8e('0x29')],'type':_0x226325[_0x8a8e('0x2a')][_0x8a8e('0x2b')]};});_0x4a11f7[_0x8a8e('0x2c')]=_[_0x8a8e('0x27')](_0x3ace69,'name');_0x4a11f7[_0x8a8e('0x2d')]=_['keys'](_0x375acf[_0x8a8e('0x2d')]);_0x4a11f7['filters']=_['intersection'](_0x4a11f7[_0x8a8e('0x2c')],_0x4a11f7['query']);_0x11982a[_0x8a8e('0x2e')]=_['intersection'](_0x4a11f7[_0x8a8e('0x2c')],qs[_0x8a8e('0x2f')](_0x375acf[_0x8a8e('0x2d')][_0x8a8e('0x2f')]));_0x11982a[_0x8a8e('0x2e')]=_0x11982a[_0x8a8e('0x2e')][_0x8a8e('0x30')]?_0x11982a[_0x8a8e('0x2e')]:_0x4a11f7[_0x8a8e('0x2c')];if(!_0x375acf[_0x8a8e('0x2d')]['hasOwnProperty'](_0x8a8e('0x31'))){_0x11982a[_0x8a8e('0x32')]=qs[_0x8a8e('0x32')](_0x375acf[_0x8a8e('0x2d')][_0x8a8e('0x32')]);_0x11982a[_0x8a8e('0x1c')]=qs[_0x8a8e('0x1c')](_0x375acf[_0x8a8e('0x2d')]['offset']);}_0x11982a[_0x8a8e('0x33')]=qs['sort'](_0x375acf[_0x8a8e('0x2d')][_0x8a8e('0x34')]);_0x11982a['where']=qs[_0x8a8e('0x35')](_['pick'](_0x375acf[_0x8a8e('0x2d')],_0x4a11f7[_0x8a8e('0x35')]));if(_0x375acf[_0x8a8e('0x2d')]['filter']){_0x11982a[_0x8a8e('0x36')]=_[_0x8a8e('0x37')](_0x11982a[_0x8a8e('0x36')],{'$or':_[_0x8a8e('0x27')](_0x3ace69,function(_0x3aca58){if(_0x3aca58[_0x8a8e('0x2a')]!==_0x8a8e('0x38')){var _0x1f6610={};_0x1f6610[_0x3aca58['name']]={'$like':'%'+_0x375acf[_0x8a8e('0x2d')][_0x8a8e('0x39')]+'%'};return _0x1f6610;}})});}_0x11982a=_[_0x8a8e('0x37')]({},_0x11982a,_0x375acf[_0x8a8e('0x3a')]);var _0x2b9976={'where':_0x11982a[_0x8a8e('0x36')]};return db[_0x8a8e('0x3b')][_0x8a8e('0x3c')](_0x2b9976)[_0x8a8e('0x23')](function(_0x19eea2){_0x5ce224[_0x8a8e('0x3c')]=_0x19eea2;if(_0x375acf['query'][_0x8a8e('0x3d')]){_0x11982a[_0x8a8e('0x3e')]=[{'all':!![]}];}return db[_0x8a8e('0x3b')][_0x8a8e('0x3f')](_0x11982a);})[_0x8a8e('0x23')](function(_0x1f1c32){_0x5ce224[_0x8a8e('0x40')]=_0x1f1c32;return _0x5ce224;})[_0x8a8e('0x23')](respondWithFilteredResult(_0x3b3122,_0x11982a))[_0x8a8e('0x41')](handleError(_0x3b3122,null));};exports['show']=function(_0x1a6619,_0x377a7d){var _0x4f4512={'raw':!![],'where':{'id':_0x1a6619['params']['id']}},_0x269f07={};_0x269f07['model']=_[_0x8a8e('0x42')](db[_0x8a8e('0x3b')][_0x8a8e('0x28')]);_0x269f07[_0x8a8e('0x2d')]=_[_0x8a8e('0x42')](_0x1a6619['query']);_0x269f07['filters']=_['intersection'](_0x269f07[_0x8a8e('0x2c')],_0x269f07[_0x8a8e('0x2d')]);_0x4f4512[_0x8a8e('0x2e')]=_[_0x8a8e('0x43')](_0x269f07[_0x8a8e('0x2c')],qs[_0x8a8e('0x2f')](_0x1a6619[_0x8a8e('0x2d')][_0x8a8e('0x2f')]));_0x4f4512[_0x8a8e('0x2e')]=_0x4f4512['attributes']['length']?_0x4f4512[_0x8a8e('0x2e')]:_0x269f07[_0x8a8e('0x2c')];if(_0x1a6619['query'][_0x8a8e('0x3d')]){_0x4f4512[_0x8a8e('0x3e')]=[{'all':!![]}];}_0x4f4512=_[_0x8a8e('0x37')]({},_0x4f4512,_0x1a6619[_0x8a8e('0x3a')]);return db['SmsTransferReport'][_0x8a8e('0x44')](_0x4f4512)[_0x8a8e('0x23')](handleEntityNotFound(_0x377a7d,null))[_0x8a8e('0x23')](respondWithResult(_0x377a7d,null))[_0x8a8e('0x41')](handleError(_0x377a7d,null));};exports[_0x8a8e('0x45')]=function(_0x564f47,_0x98ce14){return db[_0x8a8e('0x3b')][_0x8a8e('0x45')](_0x564f47[_0x8a8e('0x46')],{})[_0x8a8e('0x23')](respondWithResult(_0x98ce14,0xc9))['catch'](handleError(_0x98ce14,null));};exports[_0x8a8e('0x22')]=function(_0x541f77,_0x307fcf){if(_0x541f77['body']['id']){delete _0x541f77[_0x8a8e('0x46')]['id'];}return db['SmsTransferReport'][_0x8a8e('0x44')]({'where':{'id':_0x541f77[_0x8a8e('0x47')]['id']}})[_0x8a8e('0x23')](handleEntityNotFound(_0x307fcf,null))[_0x8a8e('0x23')](saveUpdates(_0x541f77[_0x8a8e('0x46')],null))[_0x8a8e('0x23')](respondWithResult(_0x307fcf,null))[_0x8a8e('0x41')](handleError(_0x307fcf,null));};exports[_0x8a8e('0x48')]=function(_0x4bd83d,_0x46620d){return db[_0x8a8e('0x3b')][_0x8a8e('0x44')]({'where':{'id':_0x4bd83d[_0x8a8e('0x47')]['id']}})['then'](handleEntityNotFound(_0x46620d,null))['then'](removeEntity(_0x46620d,null))[_0x8a8e('0x41')](handleError(_0x46620d,null));};exports[_0x8a8e('0x49')]=function(_0x12a47d,_0x539ede){return db[_0x8a8e('0x3b')][_0x8a8e('0x49')]()['then'](respondWithResult(_0x539ede,null))[_0x8a8e('0x41')](handleError(_0x539ede,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 4ee81e0..ed87900 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 _0x2542=['api','bluebird','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x3f7e26,_0xd2561){var _0x4db8f2=function(_0x33ecf4){while(--_0x33ecf4){_0x3f7e26['push'](_0x3f7e26['shift']());}};_0x4db8f2(++_0xd2561);}(_0x2542,0x169));var _0x2254=function(_0x30691f,_0x3399df){_0x30691f=_0x30691f-0x0;var _0xa31f5a=_0x2542[_0x30691f];return _0xa31f5a;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var logger=require(_0x2254('0x2'))(_0x2254('0x3'));var moment=require('moment');var BPromise=require(_0x2254('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2254('0x5'));var rimraf=require(_0x2254('0x6'));var config=require(_0x2254('0x7'));var attributes=require(_0x2254('0x8'));module[_0x2254('0x9')]=function(_0x508183,_0x19ad3c){return _0x508183[_0x2254('0xa')](_0x2254('0xb'),attributes,{'tableName':_0x2254('0xc'),'paranoid':![],'indexes':[{'name':_0x2254('0xd'),'fields':[_0x2254('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8fb=['exports','SmsTransferReport','uniqueid','lodash','util','../../config/logger','api','path','rimraf','./smsTransferReport.attributes'];(function(_0x2e9a2e,_0x4d4897){var _0x277729=function(_0x53fff9){while(--_0x53fff9){_0x2e9a2e['push'](_0x2e9a2e['shift']());}};_0x277729(++_0x4d4897);}(_0xd8fb,0x99));var _0xbd8f=function(_0xfc7bd7,_0x8bed1){_0xfc7bd7=_0xfc7bd7-0x0;var _0x2f7f96=_0xd8fb[_0xfc7bd7];return _0x2f7f96;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var logger=require(_0xbd8f('0x2'))(_0xbd8f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd8f('0x4'));var rimraf=require(_0xbd8f('0x5'));var config=require('../../config/environment');var attributes=require(_0xbd8f('0x6'));module[_0xbd8f('0x7')]=function(_0x5543b2,_0x33d541){return _0x5543b2['define'](_0xbd8f('0x8'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xbd8f('0x9'),'fields':[_0xbd8f('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 9f77cdd..0ae5440 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 _0x9b58=['SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x23c0f0,_0x3ccaee){var _0x445687=function(_0x29aa05){while(--_0x29aa05){_0x23c0f0['push'](_0x23c0f0['shift']());}};_0x445687(++_0x3ccaee);}(_0x9b58,0x9c));var _0x89b5=function(_0x383869,_0x118d3d){_0x383869=_0x383869-0x0;var _0x4846d2=_0x9b58[_0x383869];return _0x4846d2;};'use strict';var _=require(_0x89b5('0x0'));var util=require(_0x89b5('0x1'));var moment=require(_0x89b5('0x2'));var BPromise=require(_0x89b5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x89b5('0x4'));var db=require(_0x89b5('0x5'))['db'];var utils=require(_0x89b5('0x6'));var logger=require(_0x89b5('0x7'))(_0x89b5('0x8'));var config=require(_0x89b5('0x9'));var jayson=require(_0x89b5('0xa'));var client=jayson[_0x89b5('0xb')][_0x89b5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3526ba,_0x33b219,_0x4d89c3){return new BPromise(function(_0x35bc27,_0x1e2a3c){return client[_0x89b5('0xd')](_0x3526ba,_0x4d89c3)[_0x89b5('0xe')](function(_0x4d6b84){logger[_0x89b5('0xf')](_0x89b5('0x10'),_0x33b219,_0x89b5('0x11'));logger[_0x89b5('0x12')](_0x89b5('0x13'),_0x33b219,_0x89b5('0x11'),JSON[_0x89b5('0x14')](_0x4d6b84));if(_0x4d6b84['error']){if(_0x4d6b84[_0x89b5('0x15')][_0x89b5('0x16')]===0x1f4){logger[_0x89b5('0x15')](_0x89b5('0x10'),_0x33b219,_0x4d6b84['error']['message']);return _0x1e2a3c(_0x4d6b84[_0x89b5('0x15')][_0x89b5('0x17')]);}logger[_0x89b5('0x15')]('SmsTransferReport,\x20%s,\x20%s',_0x33b219,_0x4d6b84[_0x89b5('0x15')][_0x89b5('0x17')]);return _0x35bc27(_0x4d6b84[_0x89b5('0x15')]['message']);}else{logger['info'](_0x89b5('0x10'),_0x33b219,_0x89b5('0x11'));_0x35bc27(_0x4d6b84['result'][_0x89b5('0x17')]);}})[_0x89b5('0x18')](function(_0x2890f9){logger['error'](_0x89b5('0x10'),_0x33b219,_0x2890f9);_0x1e2a3c(_0x2890f9);});});} \ No newline at end of file +var _0x19f6=['catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x324103,_0x4fc4e8){var _0x5bb0ed=function(_0x215b1c){while(--_0x215b1c){_0x324103['push'](_0x324103['shift']());}};_0x5bb0ed(++_0x4fc4e8);}(_0x19f6,0x1b9));var _0x619f=function(_0x4c9ed7,_0x3e1f68){_0x4c9ed7=_0x4c9ed7-0x0;var _0x2072c8=_0x19f6[_0x4c9ed7];return _0x2072c8;};'use strict';var _=require(_0x619f('0x0'));var util=require('util');var moment=require(_0x619f('0x1'));var BPromise=require(_0x619f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x619f('0x3'));var db=require(_0x619f('0x4'))['db'];var utils=require(_0x619f('0x5'));var logger=require(_0x619f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x619f('0x7'));var client=jayson['client'][_0x619f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f51a0,_0x3894be,_0x2fdab6){return new BPromise(function(_0x21a63a,_0x4e81af){return client[_0x619f('0x9')](_0x3f51a0,_0x2fdab6)[_0x619f('0xa')](function(_0x27c194){logger[_0x619f('0xb')](_0x619f('0xc'),_0x3894be,_0x619f('0xd'));logger[_0x619f('0xe')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x3894be,_0x619f('0xd'),JSON[_0x619f('0xf')](_0x27c194));if(_0x27c194['error']){if(_0x27c194[_0x619f('0x10')][_0x619f('0x11')]===0x1f4){logger[_0x619f('0x10')](_0x619f('0xc'),_0x3894be,_0x27c194['error']['message']);return _0x4e81af(_0x27c194[_0x619f('0x10')]['message']);}logger['error'](_0x619f('0xc'),_0x3894be,_0x27c194['error'][_0x619f('0x12')]);return _0x21a63a(_0x27c194[_0x619f('0x10')][_0x619f('0x12')]);}else{logger['info'](_0x619f('0xc'),_0x3894be,_0x619f('0xd'));_0x21a63a(_0x27c194['result'][_0x619f('0x12')]);}})[_0x619f('0x13')](function(_0x1c3529){logger[_0x619f('0x10')](_0x619f('0xc'),_0x3894be,_0x1c3529);_0x4e81af(_0x1c3529);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index e0e8050..b640a8b 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 _0xd036=['replace','%s-%s%s','basename','extname','post','create','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','join','server/files/sounds/original/','originalname'];(function(_0x462a5b,_0x455475){var _0x2fb43e=function(_0x4c0cb2){while(--_0x4c0cb2){_0x462a5b['push'](_0x462a5b['shift']());}};_0x2fb43e(++_0x455475);}(_0xd036,0x148));var _0x6d03=function(_0x42ab91,_0x2a0179){_0x42ab91=_0x42ab91-0x0;var _0x259d35=_0xd036[_0x42ab91];return _0x259d35;};'use strict';var multer=require(_0x6d03('0x0'));var util=require(_0x6d03('0x1'));var path=require(_0x6d03('0x2'));var timeout=require(_0x6d03('0x3'));var express=require(_0x6d03('0x4'));var router=express[_0x6d03('0x5')]();var auth=require(_0x6d03('0x6'));var interaction=require(_0x6d03('0x7'));var config=require(_0x6d03('0x8'));var controller=require('./sound.controller');router[_0x6d03('0x9')]('/',auth[_0x6d03('0xa')](),controller[_0x6d03('0xb')]);router['get'](_0x6d03('0xc'),auth[_0x6d03('0xa')](),controller[_0x6d03('0xd')]);router[_0x6d03('0x9')](_0x6d03('0xe'),auth['isAuthenticated'](),controller[_0x6d03('0xf')]);var upload=multer({'storage':multer[_0x6d03('0x10')]({'destination':function(_0x488a7b,_0x3a129d,_0x489fee){_0x489fee(null,path[_0x6d03('0x11')](config['root'],_0x6d03('0x12')));},'filename':function(_0x41a724,_0x596e30,_0x38f6a3){_0x596e30[_0x6d03('0x13')]=_0x596e30[_0x6d03('0x13')][_0x6d03('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x38f6a3(null,util['format'](_0x6d03('0x15'),path[_0x6d03('0x16')](_0x596e30[_0x6d03('0x13')],path[_0x6d03('0x17')](_0x596e30[_0x6d03('0x13')])),Date['now'](),path[_0x6d03('0x17')](_0x596e30[_0x6d03('0x13')])));}})});router[_0x6d03('0x18')]('/',upload['single']('file'),controller[_0x6d03('0x19')]);router[_0x6d03('0x1a')](_0x6d03('0xc'),auth['isAuthenticated'](),controller[_0x6d03('0x1b')]);router[_0x6d03('0x1c')]('/:id',auth[_0x6d03('0xa')](),controller[_0x6d03('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x3bf5=['replace','format','%s-%s%s','extname','now','post','single','file','create','/:id','update','delete','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./sound.controller','get','isAuthenticated','show','/:id/download','download','join','root','originalname'];(function(_0x24d24e,_0x4e17a4){var _0x20e068=function(_0x48d5e5){while(--_0x48d5e5){_0x24d24e['push'](_0x24d24e['shift']());}};_0x20e068(++_0x4e17a4);}(_0x3bf5,0x78));var _0x53bf=function(_0xea6018,_0x4cf082){_0xea6018=_0xea6018-0x0;var _0x57b54d=_0x3bf5[_0xea6018];return _0x57b54d;};'use strict';var multer=require(_0x53bf('0x0'));var util=require(_0x53bf('0x1'));var path=require('path');var timeout=require(_0x53bf('0x2'));var express=require('express');var router=express[_0x53bf('0x3')]();var auth=require(_0x53bf('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x53bf('0x5'));var controller=require(_0x53bf('0x6'));router[_0x53bf('0x7')]('/',auth[_0x53bf('0x8')](),controller['index']);router[_0x53bf('0x7')]('/:id',auth[_0x53bf('0x8')](),controller[_0x53bf('0x9')]);router[_0x53bf('0x7')](_0x53bf('0xa'),auth[_0x53bf('0x8')](),controller[_0x53bf('0xb')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1cf5d2,_0x2124b1,_0x555857){_0x555857(null,path[_0x53bf('0xc')](config[_0x53bf('0xd')],'server/files/sounds/original/'));},'filename':function(_0x39fabc,_0x133a3e,_0x4f1cd6){_0x133a3e[_0x53bf('0xe')]=_0x133a3e[_0x53bf('0xe')][_0x53bf('0xf')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4f1cd6(null,util[_0x53bf('0x10')](_0x53bf('0x11'),path['basename'](_0x133a3e[_0x53bf('0xe')],path[_0x53bf('0x12')](_0x133a3e[_0x53bf('0xe')])),Date[_0x53bf('0x13')](),path[_0x53bf('0x12')](_0x133a3e[_0x53bf('0xe')])));}})});router[_0x53bf('0x14')]('/',upload[_0x53bf('0x15')](_0x53bf('0x16')),controller[_0x53bf('0x17')]);router['put'](_0x53bf('0x18'),auth[_0x53bf('0x8')](),controller[_0x53bf('0x19')]);router[_0x53bf('0x1a')]('/:id',auth[_0x53bf('0x8')](),controller[_0x53bf('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 039f264..3b0946f 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 _0x7bd9=['name','BIGINT','FLOAT','INTEGER','sequelize','exports','STRING'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x7bd9,0x146));var _0x97bd=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x7bd9[_0x12d033];return _0x3b4e80;};'use strict';var Sequelize=require(_0x97bd('0x0'));module[_0x97bd('0x1')]={'name':{'type':Sequelize[_0x97bd('0x2')],'unique':_0x97bd('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x97bd('0x2')]},'display_name':{'type':Sequelize[_0x97bd('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x97bd('0x2')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x97bd('0x4')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x97bd('0x4')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x97bd('0x5')]},'converted_sampleCount':{'type':Sequelize[_0x97bd('0x4')]},'converted_channelCount':{'type':Sequelize[_0x97bd('0x6')]},'converted_bitRate':{'type':Sequelize[_0x97bd('0x4')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x8c80=['sequelize','exports','STRING','name','FLOAT','BIGINT','INTEGER'];(function(_0x1529a3,_0x529f63){var _0x1a0d4b=function(_0x6f1058){while(--_0x6f1058){_0x1529a3['push'](_0x1529a3['shift']());}};_0x1a0d4b(++_0x529f63);}(_0x8c80,0xf5));var _0x08c8=function(_0x5d8631,_0x44944b){_0x5d8631=_0x5d8631-0x0;var _0x34c15e=_0x8c80[_0x5d8631];return _0x34c15e;};'use strict';var Sequelize=require(_0x08c8('0x0'));module[_0x08c8('0x1')]={'name':{'type':Sequelize[_0x08c8('0x2')],'unique':_0x08c8('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x08c8('0x2')]},'display_name':{'type':Sequelize[_0x08c8('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x08c8('0x2')]},'original_format':{'type':Sequelize[_0x08c8('0x2')]},'original_duration':{'type':Sequelize[_0x08c8('0x4')]},'original_sampleCount':{'type':Sequelize[_0x08c8('0x5')]},'original_channelCount':{'type':Sequelize[_0x08c8('0x6')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x08c8('0x6')]},'converted_format':{'type':Sequelize[_0x08c8('0x2')]},'converted_duration':{'type':Sequelize[_0x08c8('0x4')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x08c8('0x6')]},'converted_bitRate':{'type':Sequelize[_0x08c8('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x08c8('0x6')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 2153db7..ed20592 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 _0xf7bd=['original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_sampleCount','converted_channelCount','converted_bitRate','end','create','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Sounds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','delete','original_format','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','squel','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','count','offset','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','map','Sound','rawAttributes','fieldName','key','query','keys','intersection','model','fields','attributes','nolimit','limit','sort','where','filters','pick','filter','type','merge','includeAll','include','findAll','rows','catch','params','length','options','find','download','save_name','converted_format','existsSync','join','Sequelize','Sound\x20not\x20found','root','server/files/sounds/converted','format','%s.%s','basename','extname','file','originalname','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','src'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0xf7bd,0x184));var _0xdf7b=function(_0x78d8b7,_0x2cfc1d){_0x78d8b7=_0x78d8b7-0x0;var _0x5a979c=_0xf7bd[_0x78d8b7];return _0x5a979c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdf7b('0x0'));var rimraf=require(_0xdf7b('0x1'));var zipdir=require(_0xdf7b('0x2'));var jsonpatch=require(_0xdf7b('0x3'));var rp=require(_0xdf7b('0x4'));var moment=require('moment');var BPromise=require(_0xdf7b('0x5'));var Mustache=require(_0xdf7b('0x6'));var util=require(_0xdf7b('0x7'));var path=require('path');var sox=require(_0xdf7b('0x8'));var csv=require('to-csv');var ejs=require(_0xdf7b('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xdf7b('0xa'));var crypto=require(_0xdf7b('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdf7b('0xc'));var querystring=require(_0xdf7b('0xd'));var Papa=require('papaparse');var Redis=require(_0xdf7b('0xe'));var authService=require(_0xdf7b('0xf'));var qs=require(_0xdf7b('0x10'));var as=require(_0xdf7b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdf7b('0x12'))(_0xdf7b('0x13'));var utils=require(_0xdf7b('0x14'));var config=require('../../config/environment');var db=require(_0xdf7b('0x15'))['db'];function respondWithStatusCode(_0x1e20f2,_0x52606d){_0x52606d=_0x52606d||0xcc;return function(_0xeca2c3){if(_0xeca2c3){return _0x1e20f2[_0xdf7b('0x16')](_0x52606d);}return _0x1e20f2[_0xdf7b('0x17')](_0x52606d)['end']();};}function respondWithResult(_0x3b1778,_0x36d124){_0x36d124=_0x36d124||0xc8;return function(_0x5ef5cf){if(_0x5ef5cf){return _0x3b1778['status'](_0x36d124)['json'](_0x5ef5cf);}};}function respondWithFilteredResult(_0x1d250a,_0x20afd3){return function(_0x50087c){if(_0x50087c){var _0x183a74=_0x50087c[_0xdf7b('0x18')],_0x5e8581=_0x20afd3['offset'],_0x2dd49e=_0x20afd3[_0xdf7b('0x19')]+_0x20afd3['limit'],_0x6bf6fb;if(_0x2dd49e>=_0x183a74){_0x2dd49e=_0x183a74;_0x6bf6fb=0xc8;}else{_0x6bf6fb=0xce;}_0x1d250a['status'](_0x6bf6fb);return _0x1d250a[_0xdf7b('0x1a')](_0xdf7b('0x1b'),_0x5e8581+'-'+_0x2dd49e+'/'+_0x183a74)['json'](_0x50087c);}return null;};}function patchUpdates(_0x4b970b){return function(_0x5e4e33){try{jsonpatch['apply'](_0x5e4e33,_0x4b970b,!![]);}catch(_0x358c35){return BPromise[_0xdf7b('0x1c')](_0x358c35);}return _0x5e4e33[_0xdf7b('0x1d')]();};}function saveUpdates(_0x4d189e,_0x449b50){return function(_0x25d99d){if(_0x25d99d){return _0x25d99d[_0xdf7b('0x1e')](_0x4d189e)[_0xdf7b('0x1f')](function(_0x37c0e6){return _0x37c0e6;});}return null;};}function removeEntity(_0x362813,_0x3dd1d1){return function(_0x59bee9){if(_0x59bee9){return _0x59bee9[_0xdf7b('0x20')]()[_0xdf7b('0x1f')](function(){var _0x4b6c16=_0x59bee9[_0xdf7b('0x21')]({'plain':!![]});var _0x189029='Sounds';return db[_0xdf7b('0x22')]['destroy']({'where':{'type':_0x189029,'resourceId':_0x4b6c16['id']}})[_0xdf7b('0x1f')](function(){return _0x59bee9;});})[_0xdf7b('0x1f')](function(){_0x362813[_0xdf7b('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x207d3e,_0x15c9ef){return function(_0x34ddf3){if(!_0x34ddf3){_0x207d3e[_0xdf7b('0x16')](0x194);}return _0x34ddf3;};}function handleError(_0x5ea0b1,_0xdfd25c){_0xdfd25c=_0xdfd25c||0x1f4;return function(_0x240791){logger[_0xdf7b('0x23')](_0x240791[_0xdf7b('0x24')]);if(_0x240791[_0xdf7b('0x25')]){delete _0x240791[_0xdf7b('0x25')];}_0x5ea0b1['status'](_0xdfd25c)['send'](_0x240791);};}exports['index']=function(_0x5ebe49,_0x3d0bf5){var _0x1ded5b={},_0xcb57bc={},_0x180cd0={'count':0x0,'rows':[]};var _0x2ad8dc=_[_0xdf7b('0x26')](db[_0xdf7b('0x27')][_0xdf7b('0x28')],function(_0x4d37af){return{'name':_0x4d37af[_0xdf7b('0x29')],'type':_0x4d37af['type'][_0xdf7b('0x2a')]};});_0xcb57bc['model']=_[_0xdf7b('0x26')](_0x2ad8dc,_0xdf7b('0x25'));_0xcb57bc[_0xdf7b('0x2b')]=_[_0xdf7b('0x2c')](_0x5ebe49[_0xdf7b('0x2b')]);_0xcb57bc['filters']=_[_0xdf7b('0x2d')](_0xcb57bc[_0xdf7b('0x2e')],_0xcb57bc['query']);_0x1ded5b['attributes']=_[_0xdf7b('0x2d')](_0xcb57bc[_0xdf7b('0x2e')],qs['fields'](_0x5ebe49[_0xdf7b('0x2b')][_0xdf7b('0x2f')]));_0x1ded5b[_0xdf7b('0x30')]=_0x1ded5b['attributes']['length']?_0x1ded5b['attributes']:_0xcb57bc[_0xdf7b('0x2e')];if(!_0x5ebe49['query']['hasOwnProperty'](_0xdf7b('0x31'))){_0x1ded5b[_0xdf7b('0x32')]=qs[_0xdf7b('0x32')](_0x5ebe49[_0xdf7b('0x2b')]['limit']);_0x1ded5b[_0xdf7b('0x19')]=qs['offset'](_0x5ebe49[_0xdf7b('0x2b')][_0xdf7b('0x19')]);}_0x1ded5b['order']=qs[_0xdf7b('0x33')](_0x5ebe49[_0xdf7b('0x2b')][_0xdf7b('0x33')]);_0x1ded5b[_0xdf7b('0x34')]=qs[_0xdf7b('0x35')](_[_0xdf7b('0x36')](_0x5ebe49[_0xdf7b('0x2b')],_0xcb57bc[_0xdf7b('0x35')]));if(_0x5ebe49[_0xdf7b('0x2b')][_0xdf7b('0x37')]){_0x1ded5b[_0xdf7b('0x34')]=_['merge'](_0x1ded5b['where'],{'$or':_[_0xdf7b('0x26')](_0x2ad8dc,function(_0x5f41a3){if(_0x5f41a3[_0xdf7b('0x38')]!=='VIRTUAL'){var _0x5547af={};_0x5547af[_0x5f41a3[_0xdf7b('0x25')]]={'$like':'%'+_0x5ebe49[_0xdf7b('0x2b')]['filter']+'%'};return _0x5547af;}})});}_0x1ded5b=_[_0xdf7b('0x39')]({},_0x1ded5b,_0x5ebe49['options']);var _0x2f6af3={'where':_0x1ded5b[_0xdf7b('0x34')]};return db[_0xdf7b('0x27')]['count'](_0x2f6af3)[_0xdf7b('0x1f')](function(_0x1b4f0a){_0x180cd0[_0xdf7b('0x18')]=_0x1b4f0a;if(_0x5ebe49[_0xdf7b('0x2b')][_0xdf7b('0x3a')]){_0x1ded5b[_0xdf7b('0x3b')]=[{'all':!![]}];}return db[_0xdf7b('0x27')][_0xdf7b('0x3c')](_0x1ded5b);})[_0xdf7b('0x1f')](function(_0x45608f){_0x180cd0[_0xdf7b('0x3d')]=_0x45608f;return _0x180cd0;})['then'](respondWithFilteredResult(_0x3d0bf5,_0x1ded5b))[_0xdf7b('0x3e')](handleError(_0x3d0bf5,null));};exports['show']=function(_0x3c78dd,_0x375144){var _0x4f6a2b={'raw':!![],'where':{'id':_0x3c78dd[_0xdf7b('0x3f')]['id']}},_0x3f5610={};_0x3f5610[_0xdf7b('0x2e')]=_[_0xdf7b('0x2c')](db['Sound'][_0xdf7b('0x28')]);_0x3f5610[_0xdf7b('0x2b')]=_['keys'](_0x3c78dd[_0xdf7b('0x2b')]);_0x3f5610[_0xdf7b('0x35')]=_[_0xdf7b('0x2d')](_0x3f5610['model'],_0x3f5610[_0xdf7b('0x2b')]);_0x4f6a2b['attributes']=_[_0xdf7b('0x2d')](_0x3f5610[_0xdf7b('0x2e')],qs[_0xdf7b('0x2f')](_0x3c78dd[_0xdf7b('0x2b')][_0xdf7b('0x2f')]));_0x4f6a2b[_0xdf7b('0x30')]=_0x4f6a2b[_0xdf7b('0x30')][_0xdf7b('0x40')]?_0x4f6a2b[_0xdf7b('0x30')]:_0x3f5610[_0xdf7b('0x2e')];if(_0x3c78dd[_0xdf7b('0x2b')][_0xdf7b('0x3a')]){_0x4f6a2b[_0xdf7b('0x3b')]=[{'all':!![]}];}_0x4f6a2b=_[_0xdf7b('0x39')]({},_0x4f6a2b,_0x3c78dd[_0xdf7b('0x41')]);return db[_0xdf7b('0x27')][_0xdf7b('0x42')](_0x4f6a2b)[_0xdf7b('0x1f')](handleEntityNotFound(_0x375144,null))['then'](respondWithResult(_0x375144,null))[_0xdf7b('0x3e')](handleError(_0x375144,null));};exports[_0xdf7b('0x43')]=function(_0x4e5d44,_0x4a87bf,_0x23cf0d){return db[_0xdf7b('0x27')]['find']({'where':{'id':_0x4e5d44[_0xdf7b('0x3f')]['id']},'attributes':['name',_0xdf7b('0x44'),_0xdf7b('0x45')],'raw':!![]})[_0xdf7b('0x1f')](handleEntityNotFound(_0x4a87bf,null))['then'](function(_0x2591cb){if(_0x2591cb){if(!fs[_0xdf7b('0x46')](path[_0xdf7b('0x47')](config['root'],'server/files/sounds/converted',_0x2591cb[_0xdf7b('0x44')]+'.'+_0x2591cb[_0xdf7b('0x45')]))){throw new db[(_0xdf7b('0x48'))]['ValidationError'](_0xdf7b('0x49'));}return _0x4a87bf['download'](path[_0xdf7b('0x47')](config[_0xdf7b('0x4a')],_0xdf7b('0x4b'),util[_0xdf7b('0x4c')](_0xdf7b('0x4d'),_0x2591cb[_0xdf7b('0x44')],_0x2591cb[_0xdf7b('0x45')])),util[_0xdf7b('0x4c')]('%s.%s',_0x2591cb['name'],_0x2591cb[_0xdf7b('0x45')]));}return null;})[_0xdf7b('0x3e')](handleError(_0x4a87bf,null));};exports['create']=function(_0x20b184,_0x591e9b,_0x29b447){var _0x22d3a4={'name':path[_0xdf7b('0x4e')](_0x20b184['file']['originalname'],path[_0xdf7b('0x4f')](_0x20b184[_0xdf7b('0x50')][_0xdf7b('0x51')])),'save_name':path[_0xdf7b('0x4e')](_0x20b184[_0xdf7b('0x50')][_0xdf7b('0x52')],path[_0xdf7b('0x4f')](_0x20b184['file'][_0xdf7b('0x52')])),'original_format':path[_0xdf7b('0x4f')](_0x20b184[_0xdf7b('0x50')]['originalname'])[_0xdf7b('0x53')](0x1),'converted_format':_0xdf7b('0x54')};var _0x1650a6=path[_0xdf7b('0x47')](config['root'],_0xdf7b('0x55'),_0x20b184[_0xdf7b('0x50')][_0xdf7b('0x52')]);var _0x4e8fcd=path[_0xdf7b('0x47')](config[_0xdf7b('0x4a')],_0xdf7b('0x4b'),util[_0xdf7b('0x4c')](_0xdf7b('0x4d'),path[_0xdf7b('0x4e')](_0x20b184[_0xdf7b('0x50')][_0xdf7b('0x52')],path['extname'](_0x20b184['file']['filename'])),_0x22d3a4['converted_format']));logger[_0xdf7b('0x56')](_0xdf7b('0x57'),_0x1650a6);logger[_0xdf7b('0x56')](_0xdf7b('0x58'),_0x4e8fcd);try{fs[_0xdf7b('0x59')](_0x1650a6,parseInt(_0xdf7b('0x5a'),0x8));var _0x3e56fc=sox['transcode'](_0x1650a6,_0x4e8fcd,{'sampleRate':0x1f40,'format':_0xdf7b('0x54'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3e56fc['on'](_0xdf7b('0x23'),function(_0x1b4c9f){fs['unlinkSync'](_0x1650a6);_0x591e9b['status'](0x1f4)['send'](_0x1b4c9f);});_0x3e56fc['on'](_0xdf7b('0x5b'),function(_0x3dfca3){_0x22d3a4[_0xdf7b('0x5c')]=isNaN(_0x3dfca3['duration'])?null:_0x3dfca3[_0xdf7b('0x5d')]*0x3e8;_0x22d3a4[_0xdf7b('0x5e')]=isNaN(_0x3dfca3[_0xdf7b('0x5f')])?null:_0x3dfca3[_0xdf7b('0x5f')];_0x22d3a4[_0xdf7b('0x60')]=isNaN(_0x3dfca3[_0xdf7b('0x61')])?null:_0x3dfca3[_0xdf7b('0x61')];_0x22d3a4[_0xdf7b('0x62')]=isNaN(_0x3dfca3[_0xdf7b('0x63')])?null:_0x3dfca3[_0xdf7b('0x63')];_0x22d3a4[_0xdf7b('0x64')]=isNaN(_0x3dfca3[_0xdf7b('0x65')])?null:_0x3dfca3[_0xdf7b('0x65')];});_0x3e56fc['on']('dest',function(_0x2d8fdf){_0x22d3a4['converted_duration']=isNaN(_0x2d8fdf['duration'])?null:_0x2d8fdf[_0xdf7b('0x5d')]*0x3e8;_0x22d3a4[_0xdf7b('0x66')]=isNaN(_0x2d8fdf['sampleCount'])?null:_0x2d8fdf['sampleCount'];_0x22d3a4[_0xdf7b('0x67')]=isNaN(_0x2d8fdf[_0xdf7b('0x61')])?null:_0x2d8fdf[_0xdf7b('0x61')];_0x22d3a4[_0xdf7b('0x68')]=isNaN(_0x2d8fdf[_0xdf7b('0x63')])?null:_0x2d8fdf['bitRate'];_0x22d3a4['converted_sampleRate']=isNaN(_0x2d8fdf[_0xdf7b('0x65')])?null:_0x2d8fdf[_0xdf7b('0x65')];});_0x3e56fc['on'](_0xdf7b('0x69'),function(){fs[_0xdf7b('0x59')](_0x4e8fcd,parseInt(_0xdf7b('0x5a'),0x8));return db[_0xdf7b('0x27')][_0xdf7b('0x6a')](_0x22d3a4)['then'](function(_0x1875f5){var _0x905913={'role':_0x20b184['body'][_0xdf7b('0x6b')],'userProfileId':_0x20b184[_0xdf7b('0x6c')][_0xdf7b('0x6d')]};if(!_0x905913)throw new Error(_0xdf7b('0x6e'));if(_0x905913['role']===_0xdf7b('0x6f')){var _0x206915=_0x1875f5[_0xdf7b('0x21')]({'plain':!![]});return db[_0xdf7b('0x70')][_0xdf7b('0x42')]({'where':{'name':_0xdf7b('0x71'),'userProfileId':_0x905913['userProfileId']},'raw':!![]})[_0xdf7b('0x1f')](function(_0x11f890){if(_0x11f890&&_0x11f890[_0xdf7b('0x72')]===0x0){return db[_0xdf7b('0x22')][_0xdf7b('0x6a')]({'name':_0x206915[_0xdf7b('0x25')],'resourceId':_0x206915['id'],'type':_0x11f890[_0xdf7b('0x25')],'sectionId':_0x11f890['id']},{})['then'](function(){return _0x1875f5;});}else{return _0x1875f5;}})[_0xdf7b('0x3e')](function(_0x82f60c){logger[_0xdf7b('0x23')](_0xdf7b('0x73'),_0x82f60c);throw _0x82f60c;});}return _0x1875f5;})[_0xdf7b('0x1f')](respondWithResult(_0x591e9b,null))[_0xdf7b('0x3e')](handleError(_0x591e9b,null));});_0x3e56fc['start']();}catch(_0x322819){_0x591e9b[_0xdf7b('0x17')](0x1f4)[_0xdf7b('0x74')](_0x322819);}};exports[_0xdf7b('0x1e')]=function(_0x2e2e15,_0x2ee71a,_0x5a8694){return db[_0xdf7b('0x27')][_0xdf7b('0x42')]({'where':{'id':_0x2e2e15[_0xdf7b('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2ee71a,null))['then'](saveUpdates(_[_0xdf7b('0x36')](_0x2e2e15[_0xdf7b('0x6c')],['name','description']),null))[_0xdf7b('0x1f')](respondWithResult(_0x2ee71a,null))[_0xdf7b('0x3e')](handleError(_0x2ee71a,null));};exports[_0xdf7b('0x75')]=function(_0x6d6cba,_0x242f2f,_0x126c11){return db['Sound'][_0xdf7b('0x42')]({'where':{'id':_0x6d6cba[_0xdf7b('0x3f')]['id']}})['then'](function(_0x2a8c3c){if(_0x2a8c3c){return _0x2a8c3c['destroy']();}})['then'](function(_0x361033){var _0x3d19b5=path['join'](config[_0xdf7b('0x4a')],_0xdf7b('0x55'),util['format'](_0xdf7b('0x4d'),_0x361033[_0xdf7b('0x44')],_0x361033[_0xdf7b('0x76')]));var _0x16eb63=path[_0xdf7b('0x47')](config[_0xdf7b('0x4a')],'server/files/sounds/converted',util[_0xdf7b('0x4c')]('%s.%s',_0x361033[_0xdf7b('0x44')],_0x361033[_0xdf7b('0x45')]));fs[_0xdf7b('0x77')](_0x3d19b5);fs[_0xdf7b('0x77')](_0x16eb63);return _0x361033;})[_0xdf7b('0x1f')](function(_0x247f8d){if(_0x247f8d){return _0x242f2f['status'](0xcc)[_0xdf7b('0x69')]();}})[_0xdf7b('0x1f')](handleEntityNotFound(_0x242f2f,null))[_0xdf7b('0x3e')](handleError(_0x242f2f,null));}; \ No newline at end of file +var _0x19f2=['sampleRate','dest','converted_channelCount','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','delete','server/files/sounds/original','original_format','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','moment','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','offset','limit','set','Content-Range','save','update','then','destroy','get','Sounds','end','error','stack','name','send','index','map','Sound','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','rows','catch','show','params','rawAttributes','options','find','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','download','format','%s.%s','create','basename','file','originalname','filename','extname','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','wav','src','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate'];(function(_0x418b98,_0x5dfbb4){var _0x292cb0=function(_0x3b48e0){while(--_0x3b48e0){_0x418b98['push'](_0x418b98['shift']());}};_0x292cb0(++_0x5dfbb4);}(_0x19f2,0x84));var _0x219f=function(_0x581960,_0x1232ff){_0x581960=_0x581960-0x0;var _0x4ee892=_0x19f2[_0x581960];return _0x4ee892;};'use strict';var pdf=require(_0x219f('0x0'));var emlformat=require(_0x219f('0x1'));var rimraf=require(_0x219f('0x2'));var zipdir=require(_0x219f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x219f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x219f('0x5'));var path=require(_0x219f('0x6'));var sox=require(_0x219f('0x7'));var csv=require(_0x219f('0x8'));var ejs=require(_0x219f('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x219f('0xa'));var crypto=require(_0x219f('0xb'));var jsforce=require(_0x219f('0xc'));var deskjs=require(_0x219f('0xd'));var toCsv=require(_0x219f('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x219f('0xe'));var as=require(_0x219f('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x219f('0x10'))('api');var utils=require(_0x219f('0x11'));var config=require(_0x219f('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11ba5d,_0x3a209b){_0x3a209b=_0x3a209b||0xcc;return function(_0x461a94){if(_0x461a94){return _0x11ba5d[_0x219f('0x13')](_0x3a209b);}return _0x11ba5d[_0x219f('0x14')](_0x3a209b)['end']();};}function respondWithResult(_0xda2bf2,_0x460451){_0x460451=_0x460451||0xc8;return function(_0x12b3f4){if(_0x12b3f4){return _0xda2bf2[_0x219f('0x14')](_0x460451)[_0x219f('0x15')](_0x12b3f4);}};}function respondWithFilteredResult(_0x168bea,_0xa11193){return function(_0x1dfa2b){if(_0x1dfa2b){var _0x26a24a=_0x1dfa2b['count'],_0x9997d8=_0xa11193['offset'],_0x2db65a=_0xa11193[_0x219f('0x16')]+_0xa11193[_0x219f('0x17')],_0x12c034;if(_0x2db65a>=_0x26a24a){_0x2db65a=_0x26a24a;_0x12c034=0xc8;}else{_0x12c034=0xce;}_0x168bea[_0x219f('0x14')](_0x12c034);return _0x168bea[_0x219f('0x18')](_0x219f('0x19'),_0x9997d8+'-'+_0x2db65a+'/'+_0x26a24a)[_0x219f('0x15')](_0x1dfa2b);}return null;};}function patchUpdates(_0x4c8788){return function(_0x3566db){try{jsonpatch['apply'](_0x3566db,_0x4c8788,!![]);}catch(_0x2c55ff){return BPromise['reject'](_0x2c55ff);}return _0x3566db[_0x219f('0x1a')]();};}function saveUpdates(_0x522bd0,_0x32b212){return function(_0x37d71e){if(_0x37d71e){return _0x37d71e[_0x219f('0x1b')](_0x522bd0)[_0x219f('0x1c')](function(_0x5ce481){return _0x5ce481;});}return null;};}function removeEntity(_0x4e784a,_0xb2d803){return function(_0x1ef1ad){if(_0x1ef1ad){return _0x1ef1ad[_0x219f('0x1d')]()[_0x219f('0x1c')](function(){var _0x1dc028=_0x1ef1ad[_0x219f('0x1e')]({'plain':!![]});var _0x1b51f2=_0x219f('0x1f');return db['UserProfileResource']['destroy']({'where':{'type':_0x1b51f2,'resourceId':_0x1dc028['id']}})[_0x219f('0x1c')](function(){return _0x1ef1ad;});})['then'](function(){_0x4e784a['status'](0xcc)[_0x219f('0x20')]();});}};}function handleEntityNotFound(_0x3c5920,_0x3fe23e){return function(_0x4dbceb){if(!_0x4dbceb){_0x3c5920[_0x219f('0x13')](0x194);}return _0x4dbceb;};}function handleError(_0x4a2bd4,_0xa74b51){_0xa74b51=_0xa74b51||0x1f4;return function(_0x896911){logger[_0x219f('0x21')](_0x896911[_0x219f('0x22')]);if(_0x896911[_0x219f('0x23')]){delete _0x896911[_0x219f('0x23')];}_0x4a2bd4[_0x219f('0x14')](_0xa74b51)[_0x219f('0x24')](_0x896911);};}exports[_0x219f('0x25')]=function(_0x549c51,_0x1b6c47){var _0x18083c={},_0x5aa823={},_0x2fe358={'count':0x0,'rows':[]};var _0x4c4325=_[_0x219f('0x26')](db[_0x219f('0x27')]['rawAttributes'],function(_0x1ba09d){return{'name':_0x1ba09d[_0x219f('0x28')],'type':_0x1ba09d[_0x219f('0x29')]['key']};});_0x5aa823[_0x219f('0x2a')]=_[_0x219f('0x26')](_0x4c4325,_0x219f('0x23'));_0x5aa823[_0x219f('0x2b')]=_[_0x219f('0x2c')](_0x549c51[_0x219f('0x2b')]);_0x5aa823[_0x219f('0x2d')]=_[_0x219f('0x2e')](_0x5aa823[_0x219f('0x2a')],_0x5aa823[_0x219f('0x2b')]);_0x18083c[_0x219f('0x2f')]=_[_0x219f('0x2e')](_0x5aa823[_0x219f('0x2a')],qs[_0x219f('0x30')](_0x549c51[_0x219f('0x2b')][_0x219f('0x30')]));_0x18083c[_0x219f('0x2f')]=_0x18083c['attributes'][_0x219f('0x31')]?_0x18083c[_0x219f('0x2f')]:_0x5aa823[_0x219f('0x2a')];if(!_0x549c51['query'][_0x219f('0x32')]('nolimit')){_0x18083c['limit']=qs['limit'](_0x549c51[_0x219f('0x2b')]['limit']);_0x18083c[_0x219f('0x16')]=qs[_0x219f('0x16')](_0x549c51[_0x219f('0x2b')]['offset']);}_0x18083c[_0x219f('0x33')]=qs[_0x219f('0x34')](_0x549c51['query'][_0x219f('0x34')]);_0x18083c[_0x219f('0x35')]=qs[_0x219f('0x2d')](_[_0x219f('0x36')](_0x549c51[_0x219f('0x2b')],_0x5aa823['filters']));if(_0x549c51[_0x219f('0x2b')][_0x219f('0x37')]){_0x18083c['where']=_[_0x219f('0x38')](_0x18083c[_0x219f('0x35')],{'$or':_[_0x219f('0x26')](_0x4c4325,function(_0x553a4b){if(_0x553a4b['type']!==_0x219f('0x39')){var _0x19247c={};_0x19247c[_0x553a4b[_0x219f('0x23')]]={'$like':'%'+_0x549c51[_0x219f('0x2b')][_0x219f('0x37')]+'%'};return _0x19247c;}})});}_0x18083c=_['merge']({},_0x18083c,_0x549c51['options']);var _0x3cbbdb={'where':_0x18083c[_0x219f('0x35')]};return db[_0x219f('0x27')][_0x219f('0x3a')](_0x3cbbdb)[_0x219f('0x1c')](function(_0x5898d6){_0x2fe358[_0x219f('0x3a')]=_0x5898d6;if(_0x549c51[_0x219f('0x2b')][_0x219f('0x3b')]){_0x18083c[_0x219f('0x3c')]=[{'all':!![]}];}return db[_0x219f('0x27')]['findAll'](_0x18083c);})[_0x219f('0x1c')](function(_0xeecf4e){_0x2fe358[_0x219f('0x3d')]=_0xeecf4e;return _0x2fe358;})[_0x219f('0x1c')](respondWithFilteredResult(_0x1b6c47,_0x18083c))[_0x219f('0x3e')](handleError(_0x1b6c47,null));};exports[_0x219f('0x3f')]=function(_0x34967d,_0x15370a){var _0x2e72fc={'raw':!![],'where':{'id':_0x34967d[_0x219f('0x40')]['id']}},_0x5ec531={};_0x5ec531[_0x219f('0x2a')]=_['keys'](db[_0x219f('0x27')][_0x219f('0x41')]);_0x5ec531['query']=_[_0x219f('0x2c')](_0x34967d[_0x219f('0x2b')]);_0x5ec531[_0x219f('0x2d')]=_[_0x219f('0x2e')](_0x5ec531['model'],_0x5ec531[_0x219f('0x2b')]);_0x2e72fc[_0x219f('0x2f')]=_[_0x219f('0x2e')](_0x5ec531[_0x219f('0x2a')],qs[_0x219f('0x30')](_0x34967d['query'][_0x219f('0x30')]));_0x2e72fc[_0x219f('0x2f')]=_0x2e72fc[_0x219f('0x2f')][_0x219f('0x31')]?_0x2e72fc['attributes']:_0x5ec531[_0x219f('0x2a')];if(_0x34967d[_0x219f('0x2b')][_0x219f('0x3b')]){_0x2e72fc[_0x219f('0x3c')]=[{'all':!![]}];}_0x2e72fc=_[_0x219f('0x38')]({},_0x2e72fc,_0x34967d[_0x219f('0x42')]);return db[_0x219f('0x27')][_0x219f('0x43')](_0x2e72fc)[_0x219f('0x1c')](handleEntityNotFound(_0x15370a,null))[_0x219f('0x1c')](respondWithResult(_0x15370a,null))['catch'](handleError(_0x15370a,null));};exports['download']=function(_0x24d400,_0xc07c89,_0x16bb8b){return db[_0x219f('0x27')][_0x219f('0x43')]({'where':{'id':_0x24d400[_0x219f('0x40')]['id']},'attributes':[_0x219f('0x23'),_0x219f('0x44'),_0x219f('0x45')],'raw':!![]})[_0x219f('0x1c')](handleEntityNotFound(_0xc07c89,null))['then'](function(_0x314fe7){if(_0x314fe7){if(!fs[_0x219f('0x46')](path[_0x219f('0x47')](config[_0x219f('0x48')],_0x219f('0x49'),_0x314fe7[_0x219f('0x44')]+'.'+_0x314fe7[_0x219f('0x45')]))){throw new db[(_0x219f('0x4a'))][(_0x219f('0x4b'))](_0x219f('0x4c'));}return _0xc07c89[_0x219f('0x4d')](path[_0x219f('0x47')](config['root'],_0x219f('0x49'),util[_0x219f('0x4e')](_0x219f('0x4f'),_0x314fe7['save_name'],_0x314fe7['converted_format'])),util[_0x219f('0x4e')](_0x219f('0x4f'),_0x314fe7['name'],_0x314fe7['converted_format']));}return null;})[_0x219f('0x3e')](handleError(_0xc07c89,null));};exports[_0x219f('0x50')]=function(_0x4b7242,_0x11931a,_0xbd530f){var _0x299bd1={'name':path[_0x219f('0x51')](_0x4b7242[_0x219f('0x52')][_0x219f('0x53')],path['extname'](_0x4b7242['file']['originalname'])),'save_name':path['basename'](_0x4b7242[_0x219f('0x52')][_0x219f('0x54')],path['extname'](_0x4b7242[_0x219f('0x52')][_0x219f('0x54')])),'original_format':path[_0x219f('0x55')](_0x4b7242[_0x219f('0x52')]['originalname'])['substring'](0x1),'converted_format':'wav'};var _0x3970ed=path[_0x219f('0x47')](config[_0x219f('0x48')],'server/files/sounds/original',_0x4b7242[_0x219f('0x52')][_0x219f('0x54')]);var _0xfece7=path[_0x219f('0x47')](config[_0x219f('0x48')],'server/files/sounds/converted',util[_0x219f('0x4e')](_0x219f('0x4f'),path[_0x219f('0x51')](_0x4b7242[_0x219f('0x52')]['filename'],path['extname'](_0x4b7242['file']['filename'])),_0x299bd1[_0x219f('0x45')]));logger[_0x219f('0x56')](_0x219f('0x57'),_0x3970ed);logger[_0x219f('0x56')](_0x219f('0x58'),_0xfece7);try{fs[_0x219f('0x59')](_0x3970ed,parseInt(_0x219f('0x5a'),0x8));var _0x33bde6=sox[_0x219f('0x5b')](_0x3970ed,_0xfece7,{'sampleRate':0x1f40,'format':_0x219f('0x5c'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x33bde6['on'](_0x219f('0x21'),function(_0x28058f){fs['unlinkSync'](_0x3970ed);_0x11931a[_0x219f('0x14')](0x1f4)['send'](_0x28058f);});_0x33bde6['on'](_0x219f('0x5d'),function(_0x53d1fc){_0x299bd1['original_duration']=isNaN(_0x53d1fc['duration'])?null:_0x53d1fc[_0x219f('0x5e')]*0x3e8;_0x299bd1[_0x219f('0x5f')]=isNaN(_0x53d1fc['sampleCount'])?null:_0x53d1fc[_0x219f('0x60')];_0x299bd1[_0x219f('0x61')]=isNaN(_0x53d1fc['channelCount'])?null:_0x53d1fc[_0x219f('0x62')];_0x299bd1[_0x219f('0x63')]=isNaN(_0x53d1fc[_0x219f('0x64')])?null:_0x53d1fc[_0x219f('0x64')];_0x299bd1[_0x219f('0x65')]=isNaN(_0x53d1fc[_0x219f('0x66')])?null:_0x53d1fc[_0x219f('0x66')];});_0x33bde6['on'](_0x219f('0x67'),function(_0x2f54b4){_0x299bd1['converted_duration']=isNaN(_0x2f54b4[_0x219f('0x5e')])?null:_0x2f54b4['duration']*0x3e8;_0x299bd1['converted_sampleCount']=isNaN(_0x2f54b4[_0x219f('0x60')])?null:_0x2f54b4['sampleCount'];_0x299bd1[_0x219f('0x68')]=isNaN(_0x2f54b4[_0x219f('0x62')])?null:_0x2f54b4[_0x219f('0x62')];_0x299bd1['converted_bitRate']=isNaN(_0x2f54b4[_0x219f('0x64')])?null:_0x2f54b4[_0x219f('0x64')];_0x299bd1['converted_sampleRate']=isNaN(_0x2f54b4[_0x219f('0x66')])?null:_0x2f54b4[_0x219f('0x66')];});_0x33bde6['on'](_0x219f('0x20'),function(){fs['chmodSync'](_0xfece7,parseInt(_0x219f('0x5a'),0x8));return db[_0x219f('0x27')][_0x219f('0x50')](_0x299bd1)[_0x219f('0x1c')](function(_0x5207c5){var _0x3ccbf2={'role':_0x4b7242[_0x219f('0x69')][_0x219f('0x6a')],'userProfileId':_0x4b7242['body'][_0x219f('0x6b')]};if(!_0x3ccbf2)throw new Error(_0x219f('0x6c'));if(_0x3ccbf2[_0x219f('0x6a')]===_0x219f('0x6d')){var _0x1d3ed3=_0x5207c5[_0x219f('0x1e')]({'plain':!![]});return db[_0x219f('0x6e')][_0x219f('0x43')]({'where':{'name':'Sounds','userProfileId':_0x3ccbf2[_0x219f('0x6b')]},'raw':!![]})[_0x219f('0x1c')](function(_0x3533b7){if(_0x3533b7&&_0x3533b7[_0x219f('0x6f')]===0x0){return db['UserProfileResource'][_0x219f('0x50')]({'name':_0x1d3ed3[_0x219f('0x23')],'resourceId':_0x1d3ed3['id'],'type':_0x3533b7['name'],'sectionId':_0x3533b7['id']},{})[_0x219f('0x1c')](function(){return _0x5207c5;});}else{return _0x5207c5;}})[_0x219f('0x3e')](function(_0x252a4f){logger[_0x219f('0x21')](_0x219f('0x70'),_0x252a4f);throw _0x252a4f;});}return _0x5207c5;})[_0x219f('0x1c')](respondWithResult(_0x11931a,null))['catch'](handleError(_0x11931a,null));});_0x33bde6['start']();}catch(_0x5ad43a){_0x11931a[_0x219f('0x14')](0x1f4)[_0x219f('0x24')](_0x5ad43a);}};exports['update']=function(_0x2d74ca,_0x33507d,_0x2251f2){return db[_0x219f('0x27')][_0x219f('0x43')]({'where':{'id':_0x2d74ca['params']['id']}})['then'](handleEntityNotFound(_0x33507d,null))['then'](saveUpdates(_[_0x219f('0x36')](_0x2d74ca['body'],[_0x219f('0x23'),'description']),null))[_0x219f('0x1c')](respondWithResult(_0x33507d,null))[_0x219f('0x3e')](handleError(_0x33507d,null));};exports[_0x219f('0x71')]=function(_0x4adcfb,_0x1495e1,_0x1a635b){return db['Sound'][_0x219f('0x43')]({'where':{'id':_0x4adcfb[_0x219f('0x40')]['id']}})[_0x219f('0x1c')](function(_0x2b5f99){if(_0x2b5f99){return _0x2b5f99['destroy']();}})[_0x219f('0x1c')](function(_0x4609b3){var _0x1383d3=path[_0x219f('0x47')](config[_0x219f('0x48')],_0x219f('0x72'),util[_0x219f('0x4e')](_0x219f('0x4f'),_0x4609b3[_0x219f('0x44')],_0x4609b3[_0x219f('0x73')]));var _0x41e9e8=path[_0x219f('0x47')](config[_0x219f('0x48')],_0x219f('0x49'),util[_0x219f('0x4e')]('%s.%s',_0x4609b3['save_name'],_0x4609b3[_0x219f('0x45')]));fs[_0x219f('0x74')](_0x1383d3);fs[_0x219f('0x74')](_0x41e9e8);return _0x4609b3;})[_0x219f('0x1c')](function(_0x3737e1){if(_0x3737e1){return _0x1495e1[_0x219f('0x14')](0xcc)['end']();}})[_0x219f('0x1c')](handleEntityNotFound(_0x1495e1,null))[_0x219f('0x3e')](handleError(_0x1495e1,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index f7f39a8..e267e21 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 _0x420e=['exports','define','Sound','tools_sounds','lodash','util','api','moment','bluebird','rimraf','./sound.attributes'];(function(_0x202782,_0x42b300){var _0x2c8a7c=function(_0x26683e){while(--_0x26683e){_0x202782['push'](_0x202782['shift']());}};_0x2c8a7c(++_0x42b300);}(_0x420e,0x7d));var _0xe420=function(_0x102eda,_0x1c2975){_0x102eda=_0x102eda-0x0;var _0x1f3d99=_0x420e[_0x102eda];return _0x1f3d99;};'use strict';var _=require(_0xe420('0x0'));var util=require(_0xe420('0x1'));var logger=require('../../config/logger')(_0xe420('0x2'));var moment=require(_0xe420('0x3'));var BPromise=require(_0xe420('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe420('0x5'));var config=require('../../config/environment');var attributes=require(_0xe420('0x6'));module[_0xe420('0x7')]=function(_0x2b172b,_0x8b445b){return _0x2b172b[_0xe420('0x8')](_0xe420('0x9'),attributes,{'tableName':_0xe420('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa107=['./sound.attributes','exports','define','Sound','lodash','util','api','moment','request-promise','path','../../config/environment'];(function(_0x5401ae,_0x5e58ac){var _0x286068=function(_0x2cac88){while(--_0x2cac88){_0x5401ae['push'](_0x5401ae['shift']());}};_0x286068(++_0x5e58ac);}(_0xa107,0xf6));var _0x7a10=function(_0x337066,_0x3d0dd6){_0x337066=_0x337066-0x0;var _0xa47a1=_0xa107[_0x337066];return _0xa47a1;};'use strict';var _=require(_0x7a10('0x0'));var util=require(_0x7a10('0x1'));var logger=require('../../config/logger')(_0x7a10('0x2'));var moment=require(_0x7a10('0x3'));var BPromise=require('bluebird');var rp=require(_0x7a10('0x4'));var fs=require('fs');var path=require(_0x7a10('0x5'));var rimraf=require('rimraf');var config=require(_0x7a10('0x6'));var attributes=require(_0x7a10('0x7'));module[_0x7a10('0x8')]=function(_0x2e3c1f,_0x17c1e1){return _0x2e3c1f[_0x7a10('0x9')](_0x7a10('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 dc3cc2c..d32a171 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 _0xb3d4=['error','code','Sound,\x20%s,\x20%s','message','result','catch','Sound','options','raw','attributes','include','model','map','ShowSound','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x76b9ae,_0xcb437b){var _0x39158f=function(_0x12afd2){while(--_0x12afd2){_0x76b9ae['push'](_0x76b9ae['shift']());}};_0x39158f(++_0xcb437b);}(_0xb3d4,0x137));var _0x4b3d=function(_0x41ceeb,_0x3ce326){_0x41ceeb=_0x41ceeb-0x0;var _0x411b2d=_0xb3d4[_0x41ceeb];return _0x411b2d;};'use strict';var _=require('lodash');var util=require(_0x4b3d('0x0'));var moment=require(_0x4b3d('0x1'));var BPromise=require(_0x4b3d('0x2'));var rs=require(_0x4b3d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4b3d('0x4'))['db'];var utils=require(_0x4b3d('0x5'));var logger=require(_0x4b3d('0x6'))(_0x4b3d('0x7'));var config=require(_0x4b3d('0x8'));var jayson=require(_0x4b3d('0x9'));var client=jayson[_0x4b3d('0xa')][_0x4b3d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4355e1,_0x33f6a3,_0x2a8f30){return new BPromise(function(_0x1440d5,_0x383720){return client[_0x4b3d('0xc')](_0x4355e1,_0x2a8f30)[_0x4b3d('0xd')](function(_0xa6117){logger[_0x4b3d('0xe')]('Sound,\x20%s,\x20%s',_0x33f6a3,_0x4b3d('0xf'));logger[_0x4b3d('0x10')](_0x4b3d('0x11'),_0x33f6a3,_0x4b3d('0xf'),JSON[_0x4b3d('0x12')](_0xa6117));if(_0xa6117[_0x4b3d('0x13')]){if(_0xa6117['error'][_0x4b3d('0x14')]===0x1f4){logger[_0x4b3d('0x13')](_0x4b3d('0x15'),_0x33f6a3,_0xa6117[_0x4b3d('0x13')][_0x4b3d('0x16')]);return _0x383720(_0xa6117[_0x4b3d('0x13')]['message']);}logger[_0x4b3d('0x13')]('Sound,\x20%s,\x20%s',_0x33f6a3,_0xa6117[_0x4b3d('0x13')][_0x4b3d('0x16')]);return _0x1440d5(_0xa6117[_0x4b3d('0x13')][_0x4b3d('0x16')]);}else{logger[_0x4b3d('0xe')]('Sound,\x20%s,\x20%s',_0x33f6a3,_0x4b3d('0xf'));_0x1440d5(_0xa6117[_0x4b3d('0x17')][_0x4b3d('0x16')]);}})[_0x4b3d('0x18')](function(_0x757f4c){logger[_0x4b3d('0x13')](_0x4b3d('0x15'),_0x33f6a3,_0x757f4c);_0x383720(_0x757f4c);});});}exports['ShowSound']=function(_0x300901){var _0x5447fa=this;return new Promise(function(_0x33a539,_0x1cf040){return db[_0x4b3d('0x19')]['find']({'raw':_0x300901['options']?_0x300901[_0x4b3d('0x1a')][_0x4b3d('0x1b')]===undefined?!![]:![]:!![],'where':_0x300901['options']?_0x300901[_0x4b3d('0x1a')]['where']||null:null,'attributes':_0x300901[_0x4b3d('0x1a')]?_0x300901[_0x4b3d('0x1a')][_0x4b3d('0x1c')]||null:null,'include':_0x300901[_0x4b3d('0x1a')]?_0x300901[_0x4b3d('0x1a')][_0x4b3d('0x1d')]?_['map'](_0x300901[_0x4b3d('0x1a')][_0x4b3d('0x1d')],function(_0xa48975){return{'model':db[_0xa48975[_0x4b3d('0x1e')]],'as':_0xa48975['as'],'attributes':_0xa48975[_0x4b3d('0x1c')],'include':_0xa48975[_0x4b3d('0x1d')]?_['map'](_0xa48975[_0x4b3d('0x1d')],function(_0x173ba1){return{'model':db[_0x173ba1['model']],'as':_0x173ba1['as'],'attributes':_0x173ba1[_0x4b3d('0x1c')],'include':_0x173ba1[_0x4b3d('0x1d')]?_[_0x4b3d('0x1f')](_0x173ba1[_0x4b3d('0x1d')],function(_0x146618){return{'model':db[_0x146618['model']],'as':_0x146618['as'],'attributes':_0x146618[_0x4b3d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4b3d('0xd')](function(_0x45bbd8){logger[_0x4b3d('0xe')]('ShowSound',_0x300901);logger[_0x4b3d('0x10')](_0x4b3d('0x20'),_0x300901,JSON[_0x4b3d('0x12')](_0x45bbd8));_0x33a539(_0x45bbd8);})[_0x4b3d('0x18')](function(_0x4edf62){logger['error']('ShowSound',_0x4edf62[_0x4b3d('0x16')],_0x300901);_0x1cf040(_0x5447fa[_0x4b3d('0x13')](0x1f4,_0x4edf62[_0x4b3d('0x16')]));});});}; \ No newline at end of file +var _0xc497=['result','catch','ShowSound','Sound','find','options','raw','where','attributes','map','include','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0xc497,0x18d));var _0x7c49=function(_0x10fa5b,_0x425d90){_0x10fa5b=_0x10fa5b-0x0;var _0x11bd39=_0xc497[_0x10fa5b];return _0x11bd39;};'use strict';var _=require(_0x7c49('0x0'));var util=require(_0x7c49('0x1'));var moment=require(_0x7c49('0x2'));var BPromise=require(_0x7c49('0x3'));var rs=require(_0x7c49('0x4'));var fs=require('fs');var Redis=require(_0x7c49('0x5'));var db=require(_0x7c49('0x6'))['db'];var utils=require(_0x7c49('0x7'));var logger=require(_0x7c49('0x8'))(_0x7c49('0x9'));var config=require('../../config/environment');var jayson=require(_0x7c49('0xa'));var client=jayson[_0x7c49('0xb')][_0x7c49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x158e59,_0x559e3c,_0x48342b){return new BPromise(function(_0x5eb9b3,_0x4b9725){return client[_0x7c49('0xd')](_0x158e59,_0x48342b)[_0x7c49('0xe')](function(_0x6274af){logger[_0x7c49('0xf')](_0x7c49('0x10'),_0x559e3c,_0x7c49('0x11'));logger[_0x7c49('0x12')](_0x7c49('0x13'),_0x559e3c,_0x7c49('0x11'),JSON[_0x7c49('0x14')](_0x6274af));if(_0x6274af['error']){if(_0x6274af['error']['code']===0x1f4){logger[_0x7c49('0x15')](_0x7c49('0x10'),_0x559e3c,_0x6274af[_0x7c49('0x15')][_0x7c49('0x16')]);return _0x4b9725(_0x6274af[_0x7c49('0x15')]['message']);}logger[_0x7c49('0x15')]('Sound,\x20%s,\x20%s',_0x559e3c,_0x6274af[_0x7c49('0x15')]['message']);return _0x5eb9b3(_0x6274af[_0x7c49('0x15')][_0x7c49('0x16')]);}else{logger[_0x7c49('0xf')](_0x7c49('0x10'),_0x559e3c,_0x7c49('0x11'));_0x5eb9b3(_0x6274af[_0x7c49('0x17')][_0x7c49('0x16')]);}})[_0x7c49('0x18')](function(_0x4256bd){logger[_0x7c49('0x15')](_0x7c49('0x10'),_0x559e3c,_0x4256bd);_0x4b9725(_0x4256bd);});});}exports[_0x7c49('0x19')]=function(_0x4ce005){var _0x4827e=this;return new Promise(function(_0x34b7cb,_0xd2007c){return db[_0x7c49('0x1a')][_0x7c49('0x1b')]({'raw':_0x4ce005[_0x7c49('0x1c')]?_0x4ce005['options'][_0x7c49('0x1d')]===undefined?!![]:![]:!![],'where':_0x4ce005['options']?_0x4ce005['options'][_0x7c49('0x1e')]||null:null,'attributes':_0x4ce005['options']?_0x4ce005[_0x7c49('0x1c')][_0x7c49('0x1f')]||null:null,'include':_0x4ce005[_0x7c49('0x1c')]?_0x4ce005[_0x7c49('0x1c')]['include']?_[_0x7c49('0x20')](_0x4ce005[_0x7c49('0x1c')]['include'],function(_0xdb554d){return{'model':db[_0xdb554d['model']],'as':_0xdb554d['as'],'attributes':_0xdb554d[_0x7c49('0x1f')],'include':_0xdb554d[_0x7c49('0x21')]?_['map'](_0xdb554d[_0x7c49('0x21')],function(_0x5abf72){return{'model':db[_0x5abf72[_0x7c49('0x22')]],'as':_0x5abf72['as'],'attributes':_0x5abf72[_0x7c49('0x1f')],'include':_0x5abf72[_0x7c49('0x21')]?_['map'](_0x5abf72['include'],function(_0x3c8ab5){return{'model':db[_0x3c8ab5[_0x7c49('0x22')]],'as':_0x3c8ab5['as'],'attributes':_0x3c8ab5[_0x7c49('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7c49('0xe')](function(_0xf46923){logger[_0x7c49('0xf')](_0x7c49('0x19'),_0x4ce005);logger['debug']('ShowSound',_0x4ce005,JSON[_0x7c49('0x14')](_0xf46923));_0x34b7cb(_0xf46923);})[_0x7c49('0x18')](function(_0x4cdffb){logger['error'](_0x7c49('0x19'),_0x4cdffb[_0x7c49('0x16')],_0x4ce005);_0xd2007c(_0x4827e[_0x7c49('0x15')](0x1f4,_0x4cdffb['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index fee4a8c..a098270 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 _0x755a=['../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','show','post','create','put','update','delete','/:id','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x50e7ae,_0x1f9da9){var _0x18b841=function(_0x163a4c){while(--_0x163a4c){_0x50e7ae['push'](_0x50e7ae['shift']());}};_0x18b841(++_0x1f9da9);}(_0x755a,0x1e8));var _0xa755=function(_0x534fc4,_0x3efdb7){_0x534fc4=_0x534fc4-0x0;var _0x496bb7=_0x755a[_0x534fc4];return _0x496bb7;};'use strict';var multer=require(_0xa755('0x0'));var util=require(_0xa755('0x1'));var path=require(_0xa755('0x2'));var timeout=require(_0xa755('0x3'));var express=require(_0xa755('0x4'));var router=express[_0xa755('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xa755('0x6'));var config=require(_0xa755('0x7'));var controller=require(_0xa755('0x8'));router[_0xa755('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0xa755('0xa')](),controller[_0xa755('0xb')]);router[_0xa755('0xc')]('/',auth[_0xa755('0xa')](),controller[_0xa755('0xd')]);router[_0xa755('0xe')]('/:id',auth[_0xa755('0xa')](),controller[_0xa755('0xf')]);router[_0xa755('0x10')](_0xa755('0x11'),auth[_0xa755('0xa')](),controller['destroy']);module[_0xa755('0x12')]=router; \ No newline at end of file +var _0xd9cc=['index','get','isAuthenticated','show','post','create','/:id','delete','destroy','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./squareMessage.controller'];(function(_0x5718af,_0x438012){var _0x9a0f42=function(_0x3423ef){while(--_0x3423ef){_0x5718af['push'](_0x5718af['shift']());}};_0x9a0f42(++_0x438012);}(_0xd9cc,0x149));var _0xcd9c=function(_0x374283,_0x478549){_0x374283=_0x374283-0x0;var _0x349ef2=_0xd9cc[_0x374283];return _0x349ef2;};'use strict';var multer=require('multer');var util=require(_0xcd9c('0x0'));var path=require(_0xcd9c('0x1'));var timeout=require(_0xcd9c('0x2'));var express=require('express');var router=express[_0xcd9c('0x3')]();var auth=require(_0xcd9c('0x4'));var interaction=require(_0xcd9c('0x5'));var config=require('../../config/environment');var controller=require(_0xcd9c('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xcd9c('0x7')]);router[_0xcd9c('0x8')]('/:id',auth[_0xcd9c('0x9')](),controller[_0xcd9c('0xa')]);router[_0xcd9c('0xb')]('/',auth['isAuthenticated'](),controller[_0xcd9c('0xc')]);router['put'](_0xcd9c('0xd'),auth[_0xcd9c('0x9')](),controller['update']);router[_0xcd9c('0xe')](_0xcd9c('0xd'),auth['isAuthenticated'](),controller[_0xcd9c('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index f682615..4c94463 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 _0x1d7c=['medium','ENUM','out'];(function(_0x3da1c5,_0x53f43f){var _0x20d262=function(_0x5b914f){while(--_0x5b914f){_0x3da1c5['push'](_0x3da1c5['shift']());}};_0x20d262(++_0x53f43f);}(_0x1d7c,0x1e9));var _0xc1d7=function(_0x43762c,_0x48ff0f){_0x43762c=_0x43762c-0x0;var _0x4a85e0=_0x1d7c[_0x43762c];return _0x4a85e0;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize['TEXT'](_0xc1d7('0x0')),'allowNull':![]},'direction':{'type':Sequelize[_0xc1d7('0x1')]('in','out'),'defaultValue':_0xc1d7('0x2'),'allowNull':![]}}; \ No newline at end of file +var _0x7239=['STRING','medium','ENUM','out'];(function(_0x17351a,_0x53cd09){var _0x5f38e6=function(_0x14a948){while(--_0x14a948){_0x17351a['push'](_0x17351a['shift']());}};_0x5f38e6(++_0x53cd09);}(_0x7239,0xa0));var _0x9723=function(_0x4141d7,_0x21dd0d){_0x4141d7=_0x4141d7-0x0;var _0xe5674=_0x7239[_0x4141d7];return _0xe5674;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x9723('0x0')]},'body':{'type':Sequelize['TEXT'](_0x9723('0x1')),'allowNull':![]},'direction':{'type':Sequelize[_0x9723('0x2')]('in',_0x9723('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 53a9146..e7f68c3 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 _0xc16a=['nolimit','order','sort','filters','where','VIRTUAL','filter','merge','includeAll','include','rows','catch','params','options','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','name','send','map','SquareMessage','rawAttributes','type','key','model','query','keys','intersection','fields','length','attributes'];(function(_0x55a6cc,_0x4b5c86){var _0x489147=function(_0x526f69){while(--_0x526f69){_0x55a6cc['push'](_0x55a6cc['shift']());}};_0x489147(++_0x4b5c86);}(_0xc16a,0x160));var _0xac16=function(_0x3477bc,_0xeb3045){_0x3477bc=_0x3477bc-0x0;var _0x35b974=_0xc16a[_0x3477bc];return _0x35b974;};'use strict';var pdf=require(_0xac16('0x0'));var emlformat=require(_0xac16('0x1'));var rimraf=require(_0xac16('0x2'));var zipdir=require(_0xac16('0x3'));var jsonpatch=require(_0xac16('0x4'));var rp=require('request-promise');var moment=require(_0xac16('0x5'));var BPromise=require(_0xac16('0x6'));var Mustache=require(_0xac16('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xac16('0x8'));var ejs=require(_0xac16('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xac16('0xa'));var crypto=require(_0xac16('0xb'));var jsforce=require(_0xac16('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xac16('0x8'));var querystring=require(_0xac16('0xd'));var Papa=require('papaparse');var Redis=require(_0xac16('0xe'));var authService=require(_0xac16('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xac16('0x10'));var hardwareService=require(_0xac16('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xac16('0x12'));var config=require(_0xac16('0x13'));var db=require(_0xac16('0x14'))['db'];function respondWithStatusCode(_0x2e0770,_0x49da34){_0x49da34=_0x49da34||0xcc;return function(_0x36e38c){if(_0x36e38c){return _0x2e0770[_0xac16('0x15')](_0x49da34);}return _0x2e0770[_0xac16('0x16')](_0x49da34)[_0xac16('0x17')]();};}function respondWithResult(_0x176b46,_0x48efdb){_0x48efdb=_0x48efdb||0xc8;return function(_0x1ed6dd){if(_0x1ed6dd){return _0x176b46[_0xac16('0x16')](_0x48efdb)[_0xac16('0x18')](_0x1ed6dd);}};}function respondWithFilteredResult(_0x53649c,_0x424db7){return function(_0x38627e){if(_0x38627e){var _0x1aefc0=_0x38627e[_0xac16('0x19')],_0x295e1f=_0x424db7[_0xac16('0x1a')],_0x194f69=_0x424db7[_0xac16('0x1a')]+_0x424db7[_0xac16('0x1b')],_0x4d3dcc;if(_0x194f69>=_0x1aefc0){_0x194f69=_0x1aefc0;_0x4d3dcc=0xc8;}else{_0x4d3dcc=0xce;}_0x53649c[_0xac16('0x16')](_0x4d3dcc);return _0x53649c[_0xac16('0x1c')]('Content-Range',_0x295e1f+'-'+_0x194f69+'/'+_0x1aefc0)[_0xac16('0x18')](_0x38627e);}return null;};}function patchUpdates(_0x91adca){return function(_0x36e71c){try{jsonpatch[_0xac16('0x1d')](_0x36e71c,_0x91adca,!![]);}catch(_0x2a0c19){return BPromise[_0xac16('0x1e')](_0x2a0c19);}return _0x36e71c[_0xac16('0x1f')]();};}function saveUpdates(_0x2cfc0b,_0x1070ba){return function(_0x48402f){if(_0x48402f){return _0x48402f[_0xac16('0x20')](_0x2cfc0b)[_0xac16('0x21')](function(_0x29f7f5){return _0x29f7f5;});}return null;};}function removeEntity(_0x548d05,_0x34e33d){return function(_0x14ece6){if(_0x14ece6){return _0x14ece6[_0xac16('0x22')]()[_0xac16('0x21')](function(){_0x548d05['status'](0xcc)[_0xac16('0x17')]();});}};}function handleEntityNotFound(_0xfec18f,_0x409871){return function(_0x13e195){if(!_0x13e195){_0xfec18f[_0xac16('0x15')](0x194);}return _0x13e195;};}function handleError(_0x4a6036,_0x3c3113){_0x3c3113=_0x3c3113||0x1f4;return function(_0x543848){logger[_0xac16('0x23')](_0x543848['stack']);if(_0x543848[_0xac16('0x24')]){delete _0x543848[_0xac16('0x24')];}_0x4a6036[_0xac16('0x16')](_0x3c3113)[_0xac16('0x25')](_0x543848);};}exports['index']=function(_0x477496,_0x16d0fe){var _0x52d880={},_0x1e587d={},_0x518f86={'count':0x0,'rows':[]};var _0x153fe7=_[_0xac16('0x26')](db[_0xac16('0x27')][_0xac16('0x28')],function(_0x197a63){return{'name':_0x197a63['fieldName'],'type':_0x197a63[_0xac16('0x29')][_0xac16('0x2a')]};});_0x1e587d[_0xac16('0x2b')]=_[_0xac16('0x26')](_0x153fe7,_0xac16('0x24'));_0x1e587d[_0xac16('0x2c')]=_[_0xac16('0x2d')](_0x477496[_0xac16('0x2c')]);_0x1e587d['filters']=_['intersection'](_0x1e587d[_0xac16('0x2b')],_0x1e587d['query']);_0x52d880['attributes']=_[_0xac16('0x2e')](_0x1e587d[_0xac16('0x2b')],qs[_0xac16('0x2f')](_0x477496[_0xac16('0x2c')][_0xac16('0x2f')]));_0x52d880['attributes']=_0x52d880['attributes'][_0xac16('0x30')]?_0x52d880[_0xac16('0x31')]:_0x1e587d[_0xac16('0x2b')];if(!_0x477496[_0xac16('0x2c')]['hasOwnProperty'](_0xac16('0x32'))){_0x52d880['limit']=qs['limit'](_0x477496[_0xac16('0x2c')][_0xac16('0x1b')]);_0x52d880[_0xac16('0x1a')]=qs[_0xac16('0x1a')](_0x477496[_0xac16('0x2c')][_0xac16('0x1a')]);}_0x52d880[_0xac16('0x33')]=qs[_0xac16('0x34')](_0x477496['query'][_0xac16('0x34')]);_0x52d880['where']=qs['filters'](_['pick'](_0x477496[_0xac16('0x2c')],_0x1e587d[_0xac16('0x35')]));if(_0x477496[_0xac16('0x2c')]['filter']){_0x52d880[_0xac16('0x36')]=_['merge'](_0x52d880['where'],{'$or':_[_0xac16('0x26')](_0x153fe7,function(_0x1f8691){if(_0x1f8691[_0xac16('0x29')]!==_0xac16('0x37')){var _0x5f220d={};_0x5f220d[_0x1f8691[_0xac16('0x24')]]={'$like':'%'+_0x477496[_0xac16('0x2c')][_0xac16('0x38')]+'%'};return _0x5f220d;}})});}_0x52d880=_[_0xac16('0x39')]({},_0x52d880,_0x477496['options']);var _0xf3f17b={'where':_0x52d880[_0xac16('0x36')]};return db['SquareMessage'][_0xac16('0x19')](_0xf3f17b)[_0xac16('0x21')](function(_0x34b9b7){_0x518f86['count']=_0x34b9b7;if(_0x477496['query'][_0xac16('0x3a')]){_0x52d880[_0xac16('0x3b')]=[{'all':!![]}];}return db[_0xac16('0x27')]['findAll'](_0x52d880);})[_0xac16('0x21')](function(_0x4e0680){_0x518f86[_0xac16('0x3c')]=_0x4e0680;return _0x518f86;})[_0xac16('0x21')](respondWithFilteredResult(_0x16d0fe,_0x52d880))[_0xac16('0x3d')](handleError(_0x16d0fe,null));};exports['show']=function(_0x1fe23a,_0xc1f2d7){var _0x3156eb={'raw':!![],'where':{'id':_0x1fe23a[_0xac16('0x3e')]['id']}},_0x357e5a={};_0x357e5a[_0xac16('0x2b')]=_[_0xac16('0x2d')](db[_0xac16('0x27')]['rawAttributes']);_0x357e5a[_0xac16('0x2c')]=_['keys'](_0x1fe23a[_0xac16('0x2c')]);_0x357e5a[_0xac16('0x35')]=_[_0xac16('0x2e')](_0x357e5a[_0xac16('0x2b')],_0x357e5a[_0xac16('0x2c')]);_0x3156eb[_0xac16('0x31')]=_['intersection'](_0x357e5a['model'],qs[_0xac16('0x2f')](_0x1fe23a[_0xac16('0x2c')][_0xac16('0x2f')]));_0x3156eb[_0xac16('0x31')]=_0x3156eb['attributes']['length']?_0x3156eb[_0xac16('0x31')]:_0x357e5a[_0xac16('0x2b')];if(_0x1fe23a[_0xac16('0x2c')][_0xac16('0x3a')]){_0x3156eb['include']=[{'all':!![]}];}_0x3156eb=_[_0xac16('0x39')]({},_0x3156eb,_0x1fe23a[_0xac16('0x3f')]);return db[_0xac16('0x27')][_0xac16('0x40')](_0x3156eb)[_0xac16('0x21')](handleEntityNotFound(_0xc1f2d7,null))[_0xac16('0x21')](respondWithResult(_0xc1f2d7,null))[_0xac16('0x3d')](handleError(_0xc1f2d7,null));};exports[_0xac16('0x41')]=function(_0x1b8fcb,_0x4d8a25){return db['SquareMessage'][_0xac16('0x41')](_0x1b8fcb[_0xac16('0x42')],{})[_0xac16('0x21')](respondWithResult(_0x4d8a25,0xc9))[_0xac16('0x3d')](handleError(_0x4d8a25,null));};exports[_0xac16('0x20')]=function(_0x4c0afe,_0x46f4c5){if(_0x4c0afe[_0xac16('0x42')]['id']){delete _0x4c0afe['body']['id'];}return db[_0xac16('0x27')]['find']({'where':{'id':_0x4c0afe[_0xac16('0x3e')]['id']}})[_0xac16('0x21')](handleEntityNotFound(_0x46f4c5,null))[_0xac16('0x21')](saveUpdates(_0x4c0afe[_0xac16('0x42')],null))['then'](respondWithResult(_0x46f4c5,null))[_0xac16('0x3d')](handleError(_0x46f4c5,null));};exports[_0xac16('0x22')]=function(_0x2ae36f,_0xeeb167){return db[_0xac16('0x27')][_0xac16('0x40')]({'where':{'id':_0x2ae36f[_0xac16('0x3e')]['id']}})[_0xac16('0x21')](handleEntityNotFound(_0xeeb167,null))['then'](removeEntity(_0xeeb167,null))['catch'](handleError(_0xeeb167,null));}; \ No newline at end of file +var _0x0b6f=['length','nolimit','sort','where','pick','merge','VIRTUAL','options','include','findAll','rows','catch','create','body','find','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields'];(function(_0x5d209e,_0x4b1caf){var _0x4ecadd=function(_0x439731){while(--_0x439731){_0x5d209e['push'](_0x5d209e['shift']());}};_0x4ecadd(++_0x4b1caf);}(_0x0b6f,0x134));var _0xf0b6=function(_0x39772f,_0x5605cb){_0x39772f=_0x39772f-0x0;var _0xc9edbf=_0x0b6f[_0x39772f];return _0xc9edbf;};'use strict';var pdf=require(_0xf0b6('0x0'));var emlformat=require(_0xf0b6('0x1'));var rimraf=require(_0xf0b6('0x2'));var zipdir=require(_0xf0b6('0x3'));var jsonpatch=require(_0xf0b6('0x4'));var rp=require(_0xf0b6('0x5'));var moment=require(_0xf0b6('0x6'));var BPromise=require(_0xf0b6('0x7'));var Mustache=require(_0xf0b6('0x8'));var util=require(_0xf0b6('0x9'));var path=require(_0xf0b6('0xa'));var sox=require(_0xf0b6('0xb'));var csv=require(_0xf0b6('0xc'));var ejs=require(_0xf0b6('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf0b6('0xe'));var crypto=require(_0xf0b6('0xf'));var jsforce=require(_0xf0b6('0x10'));var deskjs=require(_0xf0b6('0x11'));var toCsv=require(_0xf0b6('0xc'));var querystring=require(_0xf0b6('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf0b6('0x13'));var qs=require(_0xf0b6('0x14'));var as=require(_0xf0b6('0x15'));var hardwareService=require(_0xf0b6('0x16'));var logger=require(_0xf0b6('0x17'))(_0xf0b6('0x18'));var utils=require(_0xf0b6('0x19'));var config=require(_0xf0b6('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3df117,_0x474524){_0x474524=_0x474524||0xcc;return function(_0x12a702){if(_0x12a702){return _0x3df117['sendStatus'](_0x474524);}return _0x3df117[_0xf0b6('0x1b')](_0x474524)[_0xf0b6('0x1c')]();};}function respondWithResult(_0x3ee732,_0x268cb9){_0x268cb9=_0x268cb9||0xc8;return function(_0x18c314){if(_0x18c314){return _0x3ee732['status'](_0x268cb9)[_0xf0b6('0x1d')](_0x18c314);}};}function respondWithFilteredResult(_0x21b380,_0x40221b){return function(_0xeee677){if(_0xeee677){var _0x324b8a=_0xeee677[_0xf0b6('0x1e')],_0x335b29=_0x40221b[_0xf0b6('0x1f')],_0x2be350=_0x40221b[_0xf0b6('0x1f')]+_0x40221b[_0xf0b6('0x20')],_0x2cd0b8;if(_0x2be350>=_0x324b8a){_0x2be350=_0x324b8a;_0x2cd0b8=0xc8;}else{_0x2cd0b8=0xce;}_0x21b380[_0xf0b6('0x1b')](_0x2cd0b8);return _0x21b380[_0xf0b6('0x21')](_0xf0b6('0x22'),_0x335b29+'-'+_0x2be350+'/'+_0x324b8a)['json'](_0xeee677);}return null;};}function patchUpdates(_0x46a715){return function(_0xc8c2a9){try{jsonpatch[_0xf0b6('0x23')](_0xc8c2a9,_0x46a715,!![]);}catch(_0x49b4ff){return BPromise['reject'](_0x49b4ff);}return _0xc8c2a9[_0xf0b6('0x24')]();};}function saveUpdates(_0x437283,_0x18d36f){return function(_0x52956d){if(_0x52956d){return _0x52956d[_0xf0b6('0x25')](_0x437283)[_0xf0b6('0x26')](function(_0x4ebd05){return _0x4ebd05;});}return null;};}function removeEntity(_0x3162e7,_0x196ae9){return function(_0x1e8263){if(_0x1e8263){return _0x1e8263[_0xf0b6('0x27')]()[_0xf0b6('0x26')](function(){_0x3162e7[_0xf0b6('0x1b')](0xcc)[_0xf0b6('0x1c')]();});}};}function handleEntityNotFound(_0x32d408,_0x3af838){return function(_0x6a6d8a){if(!_0x6a6d8a){_0x32d408[_0xf0b6('0x28')](0x194);}return _0x6a6d8a;};}function handleError(_0x10514a,_0x1d78d9){_0x1d78d9=_0x1d78d9||0x1f4;return function(_0x3cac1c){logger[_0xf0b6('0x29')](_0x3cac1c['stack']);if(_0x3cac1c[_0xf0b6('0x2a')]){delete _0x3cac1c['name'];}_0x10514a['status'](_0x1d78d9)[_0xf0b6('0x2b')](_0x3cac1c);};}exports[_0xf0b6('0x2c')]=function(_0x13e014,_0x40b369){var _0x355d66={},_0xcb3452={},_0x2e80cf={'count':0x0,'rows':[]};var _0xb8d36a=_[_0xf0b6('0x2d')](db[_0xf0b6('0x2e')][_0xf0b6('0x2f')],function(_0x46b774){return{'name':_0x46b774[_0xf0b6('0x30')],'type':_0x46b774[_0xf0b6('0x31')]['key']};});_0xcb3452[_0xf0b6('0x32')]=_[_0xf0b6('0x2d')](_0xb8d36a,_0xf0b6('0x2a'));_0xcb3452[_0xf0b6('0x33')]=_[_0xf0b6('0x34')](_0x13e014[_0xf0b6('0x33')]);_0xcb3452[_0xf0b6('0x35')]=_[_0xf0b6('0x36')](_0xcb3452[_0xf0b6('0x32')],_0xcb3452[_0xf0b6('0x33')]);_0x355d66[_0xf0b6('0x37')]=_['intersection'](_0xcb3452['model'],qs[_0xf0b6('0x38')](_0x13e014[_0xf0b6('0x33')][_0xf0b6('0x38')]));_0x355d66[_0xf0b6('0x37')]=_0x355d66['attributes'][_0xf0b6('0x39')]?_0x355d66[_0xf0b6('0x37')]:_0xcb3452['model'];if(!_0x13e014[_0xf0b6('0x33')]['hasOwnProperty'](_0xf0b6('0x3a'))){_0x355d66['limit']=qs[_0xf0b6('0x20')](_0x13e014[_0xf0b6('0x33')][_0xf0b6('0x20')]);_0x355d66[_0xf0b6('0x1f')]=qs[_0xf0b6('0x1f')](_0x13e014[_0xf0b6('0x33')]['offset']);}_0x355d66['order']=qs[_0xf0b6('0x3b')](_0x13e014[_0xf0b6('0x33')][_0xf0b6('0x3b')]);_0x355d66[_0xf0b6('0x3c')]=qs[_0xf0b6('0x35')](_[_0xf0b6('0x3d')](_0x13e014['query'],_0xcb3452[_0xf0b6('0x35')]));if(_0x13e014[_0xf0b6('0x33')]['filter']){_0x355d66[_0xf0b6('0x3c')]=_[_0xf0b6('0x3e')](_0x355d66[_0xf0b6('0x3c')],{'$or':_[_0xf0b6('0x2d')](_0xb8d36a,function(_0x164b61){if(_0x164b61[_0xf0b6('0x31')]!==_0xf0b6('0x3f')){var _0x41f5d3={};_0x41f5d3[_0x164b61[_0xf0b6('0x2a')]]={'$like':'%'+_0x13e014[_0xf0b6('0x33')]['filter']+'%'};return _0x41f5d3;}})});}_0x355d66=_[_0xf0b6('0x3e')]({},_0x355d66,_0x13e014[_0xf0b6('0x40')]);var _0xda4ecb={'where':_0x355d66[_0xf0b6('0x3c')]};return db[_0xf0b6('0x2e')]['count'](_0xda4ecb)['then'](function(_0x643ab9){_0x2e80cf[_0xf0b6('0x1e')]=_0x643ab9;if(_0x13e014[_0xf0b6('0x33')]['includeAll']){_0x355d66[_0xf0b6('0x41')]=[{'all':!![]}];}return db[_0xf0b6('0x2e')][_0xf0b6('0x42')](_0x355d66);})[_0xf0b6('0x26')](function(_0x5cda0b){_0x2e80cf[_0xf0b6('0x43')]=_0x5cda0b;return _0x2e80cf;})[_0xf0b6('0x26')](respondWithFilteredResult(_0x40b369,_0x355d66))[_0xf0b6('0x44')](handleError(_0x40b369,null));};exports['show']=function(_0x4d1306,_0x5c4b3f){var _0x1334f6={'raw':!![],'where':{'id':_0x4d1306['params']['id']}},_0x42ea8c={};_0x42ea8c['model']=_[_0xf0b6('0x34')](db[_0xf0b6('0x2e')]['rawAttributes']);_0x42ea8c['query']=_['keys'](_0x4d1306[_0xf0b6('0x33')]);_0x42ea8c[_0xf0b6('0x35')]=_['intersection'](_0x42ea8c['model'],_0x42ea8c[_0xf0b6('0x33')]);_0x1334f6[_0xf0b6('0x37')]=_[_0xf0b6('0x36')](_0x42ea8c['model'],qs[_0xf0b6('0x38')](_0x4d1306[_0xf0b6('0x33')][_0xf0b6('0x38')]));_0x1334f6[_0xf0b6('0x37')]=_0x1334f6[_0xf0b6('0x37')][_0xf0b6('0x39')]?_0x1334f6[_0xf0b6('0x37')]:_0x42ea8c[_0xf0b6('0x32')];if(_0x4d1306[_0xf0b6('0x33')]['includeAll']){_0x1334f6['include']=[{'all':!![]}];}_0x1334f6=_[_0xf0b6('0x3e')]({},_0x1334f6,_0x4d1306['options']);return db[_0xf0b6('0x2e')]['find'](_0x1334f6)['then'](handleEntityNotFound(_0x5c4b3f,null))[_0xf0b6('0x26')](respondWithResult(_0x5c4b3f,null))[_0xf0b6('0x44')](handleError(_0x5c4b3f,null));};exports[_0xf0b6('0x45')]=function(_0x502a5a,_0x53ccab){return db['SquareMessage'][_0xf0b6('0x45')](_0x502a5a[_0xf0b6('0x46')],{})[_0xf0b6('0x26')](respondWithResult(_0x53ccab,0xc9))[_0xf0b6('0x44')](handleError(_0x53ccab,null));};exports[_0xf0b6('0x25')]=function(_0x5a0efa,_0x29ae90){if(_0x5a0efa[_0xf0b6('0x46')]['id']){delete _0x5a0efa['body']['id'];}return db['SquareMessage'][_0xf0b6('0x47')]({'where':{'id':_0x5a0efa[_0xf0b6('0x48')]['id']}})['then'](handleEntityNotFound(_0x29ae90,null))[_0xf0b6('0x26')](saveUpdates(_0x5a0efa[_0xf0b6('0x46')],null))['then'](respondWithResult(_0x29ae90,null))[_0xf0b6('0x44')](handleError(_0x29ae90,null));};exports['destroy']=function(_0x1a18d4,_0x477b4c){return db[_0xf0b6('0x2e')][_0xf0b6('0x47')]({'where':{'id':_0x1a18d4[_0xf0b6('0x48')]['id']}})[_0xf0b6('0x26')](handleEntityNotFound(_0x477b4c,null))[_0xf0b6('0x26')](removeEntity(_0x477b4c,null))[_0xf0b6('0x44')](handleError(_0x477b4c,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index a290094..878c72e 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 _0x0d9b=['path','rimraf','../../config/environment','./squareMessage.attributes','exports','square_messages','moment','bluebird','request-promise'];(function(_0x4c852c,_0x3114a1){var _0x2e3b3f=function(_0x3ac9f7){while(--_0x3ac9f7){_0x4c852c['push'](_0x4c852c['shift']());}};_0x2e3b3f(++_0x3114a1);}(_0x0d9b,0xc3));var _0xb0d9=function(_0x19441d,_0x192336){_0x19441d=_0x19441d-0x0;var _0x74006b=_0x0d9b[_0x19441d];return _0x74006b;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb0d9('0x0'));var BPromise=require(_0xb0d9('0x1'));var rp=require(_0xb0d9('0x2'));var fs=require('fs');var path=require(_0xb0d9('0x3'));var rimraf=require(_0xb0d9('0x4'));var config=require(_0xb0d9('0x5'));var attributes=require(_0xb0d9('0x6'));module[_0xb0d9('0x7')]=function(_0x3b9b7a,_0x428520){return _0x3b9b7a['define']('SquareMessage',attributes,{'tableName':_0xb0d9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x49f2=['SquareMessage','square_messages','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define'];(function(_0x43d587,_0x498ad0){var _0x5d2108=function(_0x5f4d02){while(--_0x5f4d02){_0x43d587['push'](_0x43d587['shift']());}};_0x5d2108(++_0x498ad0);}(_0x49f2,0x1e3));var _0x249f=function(_0xfc06be,_0x4b6fda){_0xfc06be=_0xfc06be-0x0;var _0x339ae4=_0x49f2[_0xfc06be];return _0x339ae4;};'use strict';var _=require(_0x249f('0x0'));var util=require(_0x249f('0x1'));var logger=require(_0x249f('0x2'))(_0x249f('0x3'));var moment=require(_0x249f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x249f('0x5'));var rimraf=require(_0x249f('0x6'));var config=require(_0x249f('0x7'));var attributes=require(_0x249f('0x8'));module[_0x249f('0x9')]=function(_0x2757f8,_0x4c4626){return _0x2757f8[_0x249f('0xa')](_0x249f('0xb'),attributes,{'tableName':_0x249f('0xc'),'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 18d2a3b..e6baecc 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 _0xd1f9=['message','result','catch','CreateSquareMessage','body','options','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x30c9ba,_0xdcedf1){var _0x220f85=function(_0xa5e35){while(--_0xa5e35){_0x30c9ba['push'](_0x30c9ba['shift']());}};_0x220f85(++_0xdcedf1);}(_0xd1f9,0x88));var _0x9d1f=function(_0x2c40bf,_0x5ce37a){_0x2c40bf=_0x2c40bf-0x0;var _0x31ab19=_0xd1f9[_0x2c40bf];return _0x31ab19;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9d1f('0x0'));var BPromise=require(_0x9d1f('0x1'));var rs=require(_0x9d1f('0x2'));var fs=require('fs');var Redis=require(_0x9d1f('0x3'));var db=require(_0x9d1f('0x4'))['db'];var utils=require(_0x9d1f('0x5'));var logger=require(_0x9d1f('0x6'))(_0x9d1f('0x7'));var config=require(_0x9d1f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9d1f('0x9')][_0x9d1f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c146b,_0x432319,_0x10ce17){return new BPromise(function(_0x270b08,_0xb6b61c){return client[_0x9d1f('0xb')](_0x2c146b,_0x10ce17)[_0x9d1f('0xc')](function(_0x259a49){logger[_0x9d1f('0xd')](_0x9d1f('0xe'),_0x432319,_0x9d1f('0xf'));logger[_0x9d1f('0x10')](_0x9d1f('0x11'),_0x432319,_0x9d1f('0xf'),JSON[_0x9d1f('0x12')](_0x259a49));if(_0x259a49[_0x9d1f('0x13')]){if(_0x259a49[_0x9d1f('0x13')]['code']===0x1f4){logger[_0x9d1f('0x13')](_0x9d1f('0xe'),_0x432319,_0x259a49[_0x9d1f('0x13')]['message']);return _0xb6b61c(_0x259a49[_0x9d1f('0x13')]['message']);}logger['error'](_0x9d1f('0xe'),_0x432319,_0x259a49[_0x9d1f('0x13')][_0x9d1f('0x14')]);return _0x270b08(_0x259a49[_0x9d1f('0x13')][_0x9d1f('0x14')]);}else{logger[_0x9d1f('0xd')](_0x9d1f('0xe'),_0x432319,_0x9d1f('0xf'));_0x270b08(_0x259a49[_0x9d1f('0x15')][_0x9d1f('0x14')]);}})[_0x9d1f('0x16')](function(_0x1dd0bd){logger[_0x9d1f('0x13')]('SquareMessage,\x20%s,\x20%s',_0x432319,_0x1dd0bd);_0xb6b61c(_0x1dd0bd);});});}exports[_0x9d1f('0x17')]=function(_0x42a2b4){var _0x4e5328=this;return new Promise(function(_0x329b69,_0x4f7224){return db['SquareMessage']['create'](_0x42a2b4[_0x9d1f('0x18')],{'raw':_0x42a2b4[_0x9d1f('0x19')]?_0x42a2b4[_0x9d1f('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x9d1f('0xc')](function(_0x4cfcf5){logger[_0x9d1f('0xd')]('CreateSquareMessage',_0x42a2b4);logger['debug'](_0x9d1f('0x17'),_0x42a2b4,JSON[_0x9d1f('0x12')](_0x4cfcf5));_0x329b69(_0x4cfcf5);})[_0x9d1f('0x16')](function(_0x2d861b){logger[_0x9d1f('0x13')](_0x9d1f('0x17'),_0x2d861b[_0x9d1f('0x14')],_0x42a2b4);_0x4f7224(_0x4e5328[_0x9d1f('0x13')](0x1f4,_0x2d861b[_0x9d1f('0x14')]));});});}; \ No newline at end of file +var _0x23f4=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','SquareMessage,\x20%s,\x20%s','debug','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateSquareMessage','create','options','then'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x23f4,0x1ee));var _0x423f=function(_0x534aad,_0x59c653){_0x534aad=_0x534aad-0x0;var _0xecd46a=_0x23f4[_0x534aad];return _0xecd46a;};'use strict';var _=require('lodash');var util=require(_0x423f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x423f('0x1'));var fs=require('fs');var Redis=require(_0x423f('0x2'));var db=require(_0x423f('0x3'))['db'];var utils=require(_0x423f('0x4'));var logger=require(_0x423f('0x5'))(_0x423f('0x6'));var config=require(_0x423f('0x7'));var jayson=require(_0x423f('0x8'));var client=jayson[_0x423f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x260eae,_0x47716d,_0x55258d){return new BPromise(function(_0x727b4e,_0x416fb1){return client[_0x423f('0xa')](_0x260eae,_0x55258d)['then'](function(_0x5b5ee6){logger['info'](_0x423f('0xb'),_0x47716d,'request\x20sent');logger[_0x423f('0xc')](_0x423f('0xd'),_0x47716d,_0x423f('0xe'),JSON[_0x423f('0xf')](_0x5b5ee6));if(_0x5b5ee6['error']){if(_0x5b5ee6[_0x423f('0x10')][_0x423f('0x11')]===0x1f4){logger[_0x423f('0x10')](_0x423f('0xb'),_0x47716d,_0x5b5ee6[_0x423f('0x10')]['message']);return _0x416fb1(_0x5b5ee6[_0x423f('0x10')][_0x423f('0x12')]);}logger[_0x423f('0x10')](_0x423f('0xb'),_0x47716d,_0x5b5ee6[_0x423f('0x10')][_0x423f('0x12')]);return _0x727b4e(_0x5b5ee6[_0x423f('0x10')][_0x423f('0x12')]);}else{logger[_0x423f('0x13')](_0x423f('0xb'),_0x47716d,_0x423f('0xe'));_0x727b4e(_0x5b5ee6[_0x423f('0x14')][_0x423f('0x12')]);}})[_0x423f('0x15')](function(_0x9d1487){logger[_0x423f('0x10')](_0x423f('0xb'),_0x47716d,_0x9d1487);_0x416fb1(_0x9d1487);});});}exports[_0x423f('0x16')]=function(_0x26b6d1){var _0x5424e6=this;return new Promise(function(_0x99435f,_0x569fd0){return db['SquareMessage'][_0x423f('0x17')](_0x26b6d1['body'],{'raw':_0x26b6d1[_0x423f('0x18')]?_0x26b6d1[_0x423f('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x423f('0x19')](function(_0x1fc317){logger['info'](_0x423f('0x16'),_0x26b6d1);logger[_0x423f('0xc')]('CreateSquareMessage',_0x26b6d1,JSON[_0x423f('0xf')](_0x1fc317));_0x99435f(_0x1fc317);})[_0x423f('0x15')](function(_0x568dcd){logger[_0x423f('0x10')]('CreateSquareMessage',_0x568dcd[_0x423f('0x12')],_0x26b6d1);_0x569fd0(_0x5424e6[_0x423f('0x10')](0x1f4,_0x568dcd[_0x423f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 3e87c49..2fc1e8a 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 _0xfbf2=['test','post','create','put','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/test','15s'];(function(_0x49f950,_0x343ea9){var _0xa17bf6=function(_0x546bec){while(--_0x546bec){_0x49f950['push'](_0x49f950['shift']());}};_0xa17bf6(++_0x343ea9);}(_0xfbf2,0x102));var _0x2fbf=function(_0x392a06,_0x233e23){_0x392a06=_0x392a06-0x0;var _0x42fb44=_0xfbf2[_0x392a06];return _0x42fb44;};'use strict';var multer=require(_0x2fbf('0x0'));var util=require('util');var path=require(_0x2fbf('0x1'));var timeout=require(_0x2fbf('0x2'));var express=require(_0x2fbf('0x3'));var router=express[_0x2fbf('0x4')]();var auth=require(_0x2fbf('0x5'));var interaction=require(_0x2fbf('0x6'));var config=require(_0x2fbf('0x7'));var controller=require('./squareOdbc.controller');router[_0x2fbf('0x8')]('/',auth['isAuthenticated'](),controller[_0x2fbf('0x9')]);router[_0x2fbf('0x8')](_0x2fbf('0xa'),auth[_0x2fbf('0xb')](),controller[_0x2fbf('0xc')]);router[_0x2fbf('0x8')](_0x2fbf('0xd'),auth[_0x2fbf('0xb')](),timeout(_0x2fbf('0xe')),controller[_0x2fbf('0xf')]);router[_0x2fbf('0x10')]('/',auth[_0x2fbf('0xb')](),controller[_0x2fbf('0x11')]);router[_0x2fbf('0x12')](_0x2fbf('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x2fbf('0x13')](_0x2fbf('0xa'),auth[_0x2fbf('0xb')](),controller['destroy']);module[_0x2fbf('0x14')]=router; \ No newline at end of file +var _0xdafe=['test','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','show','15s'];(function(_0x33e5e2,_0x10d7a8){var _0x21e5af=function(_0x4b4103){while(--_0x4b4103){_0x33e5e2['push'](_0x33e5e2['shift']());}};_0x21e5af(++_0x10d7a8);}(_0xdafe,0x6a));var _0xedaf=function(_0x50539e,_0x1037ab){_0x50539e=_0x50539e-0x0;var _0x1aa439=_0xdafe[_0x50539e];return _0x1aa439;};'use strict';var multer=require(_0xedaf('0x0'));var util=require(_0xedaf('0x1'));var path=require(_0xedaf('0x2'));var timeout=require(_0xedaf('0x3'));var express=require(_0xedaf('0x4'));var router=express[_0xedaf('0x5')]();var auth=require(_0xedaf('0x6'));var interaction=require(_0xedaf('0x7'));var config=require(_0xedaf('0x8'));var controller=require(_0xedaf('0x9'));router[_0xedaf('0xa')]('/',auth[_0xedaf('0xb')](),controller['index']);router[_0xedaf('0xa')]('/:id',auth[_0xedaf('0xb')](),controller[_0xedaf('0xc')]);router['get']('/:id/test',auth[_0xedaf('0xb')](),timeout(_0xedaf('0xd')),controller[_0xedaf('0xe')]);router[_0xedaf('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0xedaf('0xb')](),controller[_0xedaf('0x10')]);router[_0xedaf('0x11')]('/:id',auth[_0xedaf('0xb')](),controller[_0xedaf('0x12')]);module[_0xedaf('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 0262ce2..9df9888 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 _0xa223=['name','sequelize','exports','STRING'];(function(_0x428dbd,_0x30eeb5){var _0xc411d8=function(_0x12cab8){while(--_0x12cab8){_0x428dbd['push'](_0x428dbd['shift']());}};_0xc411d8(++_0x30eeb5);}(_0xa223,0x129));var _0x3a22=function(_0x296708,_0x11b4fc){_0x296708=_0x296708-0x0;var _0x35d80a=_0xa223[_0x296708];return _0x35d80a;};'use strict';var Sequelize=require(_0x3a22('0x0'));module[_0x3a22('0x1')]={'name':{'type':Sequelize[_0x3a22('0x2')],'unique':_0x3a22('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x3a22('0x2')]},'description':{'type':Sequelize[_0x3a22('0x2')]}}; \ No newline at end of file +var _0x0a33=['sequelize','STRING','name'];(function(_0x1eb0dd,_0x5729f){var _0x78e76b=function(_0x2b893d){while(--_0x2b893d){_0x1eb0dd['push'](_0x1eb0dd['shift']());}};_0x78e76b(++_0x5729f);}(_0x0a33,0x1bc));var _0x30a3=function(_0x534f3c,_0x3b079c){_0x534f3c=_0x534f3c-0x0;var _0x14c25e=_0x0a33[_0x534f3c];return _0x14c25e;};'use strict';var Sequelize=require(_0x30a3('0x0'));module['exports']={'name':{'type':Sequelize[_0x30a3('0x1')],'unique':_0x30a3('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x30a3('0x1')]},'description':{'type':Sequelize[_0x30a3('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 66fe394..300e09b 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 _0x2467=['request-promise','bluebird','mustache','util','sox','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','then','get','ODBC','UserProfileResource','destroy','error','stack','name','send','index','map','SquareOdbc','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','where','pick','type','VIRTUAL','filter','merge','count','includeAll','findAll','show','options','catch','create','body','user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','test','dsn','odbc','openSync','closeSync','html-pdf','rimraf','fast-json-patch'];(function(_0x401676,_0x3f1436){var _0x4f13fe=function(_0xd2f197){while(--_0xd2f197){_0x401676['push'](_0x401676['shift']());}};_0x4f13fe(++_0x3f1436);}(_0x2467,0xfc));var _0x7246=function(_0x373acb,_0x462b69){_0x373acb=_0x373acb-0x0;var _0x4458a1=_0x2467[_0x373acb];return _0x4458a1;};'use strict';var pdf=require(_0x7246('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7246('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7246('0x2'));var rp=require(_0x7246('0x3'));var moment=require('moment');var BPromise=require(_0x7246('0x4'));var Mustache=require(_0x7246('0x5'));var util=require(_0x7246('0x6'));var path=require('path');var sox=require(_0x7246('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x7246('0x8'));var squel=require(_0x7246('0x9'));var crypto=require(_0x7246('0xa'));var jsforce=require(_0x7246('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x7246('0xc'));var querystring=require(_0x7246('0xd'));var Papa=require(_0x7246('0xe'));var Redis=require('ioredis');var authService=require(_0x7246('0xf'));var qs=require(_0x7246('0x10'));var as=require(_0x7246('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7246('0x12'))(_0x7246('0x13'));var utils=require(_0x7246('0x14'));var config=require(_0x7246('0x15'));var db=require(_0x7246('0x16'))['db'];function respondWithStatusCode(_0x4386bc,_0x574961){_0x574961=_0x574961||0xcc;return function(_0x4e2e0e){if(_0x4e2e0e){return _0x4386bc[_0x7246('0x17')](_0x574961);}return _0x4386bc[_0x7246('0x18')](_0x574961)[_0x7246('0x19')]();};}function respondWithResult(_0x279fbf,_0x80a702){_0x80a702=_0x80a702||0xc8;return function(_0x4a8559){if(_0x4a8559){return _0x279fbf[_0x7246('0x18')](_0x80a702)[_0x7246('0x1a')](_0x4a8559);}};}function respondWithFilteredResult(_0x287d92,_0x1e1a74){return function(_0x126c6b){if(_0x126c6b){var _0x51a91f=_0x126c6b['count'],_0x5ec529=_0x1e1a74[_0x7246('0x1b')],_0x2af12c=_0x1e1a74['offset']+_0x1e1a74[_0x7246('0x1c')],_0x4ba8ea;if(_0x2af12c>=_0x51a91f){_0x2af12c=_0x51a91f;_0x4ba8ea=0xc8;}else{_0x4ba8ea=0xce;}_0x287d92[_0x7246('0x18')](_0x4ba8ea);return _0x287d92[_0x7246('0x1d')](_0x7246('0x1e'),_0x5ec529+'-'+_0x2af12c+'/'+_0x51a91f)['json'](_0x126c6b);}return null;};}function patchUpdates(_0x1cbc6d){return function(_0x101a30){try{jsonpatch[_0x7246('0x1f')](_0x101a30,_0x1cbc6d,!![]);}catch(_0x32c7ed){return BPromise['reject'](_0x32c7ed);}return _0x101a30[_0x7246('0x20')]();};}function saveUpdates(_0x1dee2e,_0x190ac1){return function(_0x32a32c){if(_0x32a32c){return _0x32a32c['update'](_0x1dee2e)[_0x7246('0x21')](function(_0x1a5c9d){return _0x1a5c9d;});}return null;};}function removeEntity(_0x4b6795,_0x2e107a){return function(_0x41c023){if(_0x41c023){return _0x41c023['destroy']()[_0x7246('0x21')](function(){var _0x1ec877=_0x41c023[_0x7246('0x22')]({'plain':!![]});var _0x17427d=_0x7246('0x23');return db[_0x7246('0x24')][_0x7246('0x25')]({'where':{'type':_0x17427d,'resourceId':_0x1ec877['id']}})[_0x7246('0x21')](function(){return _0x41c023;});})['then'](function(){_0x4b6795[_0x7246('0x18')](0xcc)[_0x7246('0x19')]();});}};}function handleEntityNotFound(_0x286594,_0x16d858){return function(_0x3c150a){if(!_0x3c150a){_0x286594[_0x7246('0x17')](0x194);}return _0x3c150a;};}function handleError(_0x3ac525,_0x11c327){_0x11c327=_0x11c327||0x1f4;return function(_0x154dce){logger[_0x7246('0x26')](_0x154dce[_0x7246('0x27')]);if(_0x154dce[_0x7246('0x28')]){delete _0x154dce[_0x7246('0x28')];}_0x3ac525['status'](_0x11c327)[_0x7246('0x29')](_0x154dce);};}exports[_0x7246('0x2a')]=function(_0x27c12d,_0x34e917){var _0x12ed2f={},_0x5bf1c2={},_0x4820e3={'count':0x0,'rows':[]};var _0x269878=_[_0x7246('0x2b')](db[_0x7246('0x2c')][_0x7246('0x2d')],function(_0x369abc){return{'name':_0x369abc[_0x7246('0x2e')],'type':_0x369abc['type'][_0x7246('0x2f')]};});_0x5bf1c2[_0x7246('0x30')]=_[_0x7246('0x2b')](_0x269878,_0x7246('0x28'));_0x5bf1c2[_0x7246('0x31')]=_[_0x7246('0x32')](_0x27c12d['query']);_0x5bf1c2[_0x7246('0x33')]=_[_0x7246('0x34')](_0x5bf1c2[_0x7246('0x30')],_0x5bf1c2['query']);_0x12ed2f['attributes']=_[_0x7246('0x34')](_0x5bf1c2[_0x7246('0x30')],qs[_0x7246('0x35')](_0x27c12d['query'][_0x7246('0x35')]));_0x12ed2f[_0x7246('0x36')]=_0x12ed2f[_0x7246('0x36')][_0x7246('0x37')]?_0x12ed2f[_0x7246('0x36')]:_0x5bf1c2[_0x7246('0x30')];if(!_0x27c12d[_0x7246('0x31')][_0x7246('0x38')]('nolimit')){_0x12ed2f[_0x7246('0x1c')]=qs['limit'](_0x27c12d['query'][_0x7246('0x1c')]);_0x12ed2f[_0x7246('0x1b')]=qs[_0x7246('0x1b')](_0x27c12d[_0x7246('0x31')]['offset']);}_0x12ed2f[_0x7246('0x39')]=qs['sort'](_0x27c12d[_0x7246('0x31')]['sort']);_0x12ed2f[_0x7246('0x3a')]=qs['filters'](_[_0x7246('0x3b')](_0x27c12d[_0x7246('0x31')],_0x5bf1c2[_0x7246('0x33')]));if(_0x27c12d[_0x7246('0x31')]['filter']){_0x12ed2f[_0x7246('0x3a')]=_['merge'](_0x12ed2f[_0x7246('0x3a')],{'$or':_['map'](_0x269878,function(_0x23ce50){if(_0x23ce50[_0x7246('0x3c')]!==_0x7246('0x3d')){var _0x294e9f={};_0x294e9f[_0x23ce50[_0x7246('0x28')]]={'$like':'%'+_0x27c12d[_0x7246('0x31')][_0x7246('0x3e')]+'%'};return _0x294e9f;}})});}_0x12ed2f=_[_0x7246('0x3f')]({},_0x12ed2f,_0x27c12d['options']);var _0x92de3f={'where':_0x12ed2f['where']};return db[_0x7246('0x2c')][_0x7246('0x40')](_0x92de3f)[_0x7246('0x21')](function(_0xee3db9){_0x4820e3['count']=_0xee3db9;if(_0x27c12d[_0x7246('0x31')][_0x7246('0x41')]){_0x12ed2f['include']=[{'all':!![]}];}return db['SquareOdbc'][_0x7246('0x42')](_0x12ed2f);})[_0x7246('0x21')](function(_0x12bda0){_0x4820e3['rows']=_0x12bda0;return _0x4820e3;})['then'](respondWithFilteredResult(_0x34e917,_0x12ed2f))['catch'](handleError(_0x34e917,null));};exports[_0x7246('0x43')]=function(_0x69db8a,_0x2c4785){var _0x818001={'raw':!![],'where':{'id':_0x69db8a['params']['id']}},_0x58f2c2={};_0x58f2c2['model']=_[_0x7246('0x32')](db['SquareOdbc'][_0x7246('0x2d')]);_0x58f2c2[_0x7246('0x31')]=_[_0x7246('0x32')](_0x69db8a[_0x7246('0x31')]);_0x58f2c2['filters']=_[_0x7246('0x34')](_0x58f2c2[_0x7246('0x30')],_0x58f2c2[_0x7246('0x31')]);_0x818001['attributes']=_[_0x7246('0x34')](_0x58f2c2['model'],qs['fields'](_0x69db8a[_0x7246('0x31')][_0x7246('0x35')]));_0x818001[_0x7246('0x36')]=_0x818001[_0x7246('0x36')][_0x7246('0x37')]?_0x818001[_0x7246('0x36')]:_0x58f2c2['model'];if(_0x69db8a[_0x7246('0x31')][_0x7246('0x41')]){_0x818001['include']=[{'all':!![]}];}_0x818001=_['merge']({},_0x818001,_0x69db8a[_0x7246('0x44')]);return db[_0x7246('0x2c')]['find'](_0x818001)[_0x7246('0x21')](handleEntityNotFound(_0x2c4785,null))['then'](respondWithResult(_0x2c4785,null))[_0x7246('0x45')](handleError(_0x2c4785,null));};exports[_0x7246('0x46')]=function(_0x181e52,_0x443742){return db[_0x7246('0x2c')][_0x7246('0x46')](_0x181e52[_0x7246('0x47')],{})[_0x7246('0x21')](function(_0x147279){var _0xc1fcac=_0x181e52[_0x7246('0x48')][_0x7246('0x22')]({'plain':!![]});if(!_0xc1fcac)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xc1fcac[_0x7246('0x49')]===_0x7246('0x48')){var _0x4bef49=_0x147279[_0x7246('0x22')]({'plain':!![]});var _0x59c400=_0x7246('0x23');return db['UserProfileSection'][_0x7246('0x4a')]({'where':{'name':_0x59c400,'userProfileId':_0xc1fcac[_0x7246('0x4b')]},'raw':!![]})['then'](function(_0x3f9995){if(_0x3f9995&&_0x3f9995[_0x7246('0x4c')]===0x0){return db[_0x7246('0x24')]['create']({'name':_0x4bef49['name'],'resourceId':_0x4bef49['id'],'type':_0x3f9995[_0x7246('0x28')],'sectionId':_0x3f9995['id']},{})[_0x7246('0x21')](function(){return _0x147279;});}else{return _0x147279;}})[_0x7246('0x45')](function(_0xcd1b5a){logger[_0x7246('0x26')](_0x7246('0x4d'),_0xcd1b5a);throw _0xcd1b5a;});}return _0x147279;})[_0x7246('0x21')](respondWithResult(_0x443742,0xc9))[_0x7246('0x45')](handleError(_0x443742,null));};exports[_0x7246('0x4e')]=function(_0x4e2732,_0x10aaa2){if(_0x4e2732[_0x7246('0x47')]['id']){delete _0x4e2732['body']['id'];}return db[_0x7246('0x2c')][_0x7246('0x4a')]({'where':{'id':_0x4e2732['params']['id']}})['then'](handleEntityNotFound(_0x10aaa2,null))[_0x7246('0x21')](saveUpdates(_0x4e2732[_0x7246('0x47')],null))['then'](respondWithResult(_0x10aaa2,null))['catch'](handleError(_0x10aaa2,null));};exports[_0x7246('0x25')]=function(_0x3b5597,_0x1344d2){return db['SquareOdbc'][_0x7246('0x4a')]({'where':{'id':_0x3b5597[_0x7246('0x4f')]['id']}})[_0x7246('0x21')](handleEntityNotFound(_0x1344d2,null))['then'](removeEntity(_0x1344d2,null))[_0x7246('0x45')](handleError(_0x1344d2,null));};exports[_0x7246('0x50')]=function(_0x9354f1,_0xac958a,_0x2a8dd2){var _0x2f7d21;return db[_0x7246('0x2c')]['find']({'where':{'id':_0x9354f1['params']['id']},'attributes':['id',_0x7246('0x51')]})[_0x7246('0x21')](handleEntityNotFound(_0xac958a,null))[_0x7246('0x21')](function(_0x85b013){if(_0x85b013){var _0x1852d9=require(_0x7246('0x52'))();_0x1852d9[_0x7246('0x53')](_0x85b013[_0x7246('0x51')]);_0x1852d9[_0x7246('0x54')]();return _0x85b013;}})['then'](respondWithResult(_0xac958a,null))[_0x7246('0x45')](handleError(_0xac958a,null));}; \ No newline at end of file +var _0xfa4e=['fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','Content-Range','apply','update','then','destroy','UserProfileResource','error','stack','name','send','map','SquareOdbc','rawAttributes','fieldName','model','query','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','type','options','count','includeAll','rows','catch','show','keys','include','find','create','body','user','get','role','ODBC','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','dsn','closeSync','html-pdf','eml-format'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfa4e,0x1d8));var _0xefa4=function(_0x2abf11,_0xde947b){_0x2abf11=_0x2abf11-0x0;var _0x41d602=_0xfa4e[_0x2abf11];return _0x41d602;};'use strict';var pdf=require(_0xefa4('0x0'));var emlformat=require(_0xefa4('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xefa4('0x2'));var rp=require(_0xefa4('0x3'));var moment=require(_0xefa4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xefa4('0x5'));var util=require(_0xefa4('0x6'));var path=require(_0xefa4('0x7'));var sox=require(_0xefa4('0x8'));var csv=require(_0xefa4('0x9'));var ejs=require(_0xefa4('0xa'));var fs=require('fs');var _=require(_0xefa4('0xb'));var squel=require(_0xefa4('0xc'));var crypto=require(_0xefa4('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xefa4('0xe'));var toCsv=require(_0xefa4('0x9'));var querystring=require(_0xefa4('0xf'));var Papa=require(_0xefa4('0x10'));var Redis=require(_0xefa4('0x11'));var authService=require(_0xefa4('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xefa4('0x13'));var hardwareService=require(_0xefa4('0x14'));var logger=require('../../config/logger')(_0xefa4('0x15'));var utils=require(_0xefa4('0x16'));var config=require(_0xefa4('0x17'));var db=require(_0xefa4('0x18'))['db'];function respondWithStatusCode(_0x4f3db2,_0x9d8991){_0x9d8991=_0x9d8991||0xcc;return function(_0x2b2b0e){if(_0x2b2b0e){return _0x4f3db2['sendStatus'](_0x9d8991);}return _0x4f3db2['status'](_0x9d8991)['end']();};}function respondWithResult(_0x10c150,_0x32c459){_0x32c459=_0x32c459||0xc8;return function(_0x428cb2){if(_0x428cb2){return _0x10c150[_0xefa4('0x19')](_0x32c459)[_0xefa4('0x1a')](_0x428cb2);}};}function respondWithFilteredResult(_0x4ffb2f,_0x3888cf){return function(_0x304201){if(_0x304201){var _0x22370e=_0x304201['count'],_0x40c4ac=_0x3888cf[_0xefa4('0x1b')],_0x36744d=_0x3888cf[_0xefa4('0x1b')]+_0x3888cf['limit'],_0x39848b;if(_0x36744d>=_0x22370e){_0x36744d=_0x22370e;_0x39848b=0xc8;}else{_0x39848b=0xce;}_0x4ffb2f[_0xefa4('0x19')](_0x39848b);return _0x4ffb2f['set'](_0xefa4('0x1c'),_0x40c4ac+'-'+_0x36744d+'/'+_0x22370e)['json'](_0x304201);}return null;};}function patchUpdates(_0x36eb99){return function(_0x2100b8){try{jsonpatch[_0xefa4('0x1d')](_0x2100b8,_0x36eb99,!![]);}catch(_0x481134){return BPromise['reject'](_0x481134);}return _0x2100b8['save']();};}function saveUpdates(_0x3e7508,_0x23343c){return function(_0x539bfc){if(_0x539bfc){return _0x539bfc[_0xefa4('0x1e')](_0x3e7508)[_0xefa4('0x1f')](function(_0x47980b){return _0x47980b;});}return null;};}function removeEntity(_0x538c71,_0x139c27){return function(_0x4be191){if(_0x4be191){return _0x4be191[_0xefa4('0x20')]()[_0xefa4('0x1f')](function(){var _0x468b86=_0x4be191['get']({'plain':!![]});var _0x264805='ODBC';return db[_0xefa4('0x21')][_0xefa4('0x20')]({'where':{'type':_0x264805,'resourceId':_0x468b86['id']}})[_0xefa4('0x1f')](function(){return _0x4be191;});})['then'](function(){_0x538c71[_0xefa4('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x305104,_0x2cdd8a){return function(_0x266e1b){if(!_0x266e1b){_0x305104['sendStatus'](0x194);}return _0x266e1b;};}function handleError(_0x3edc06,_0x26df3b){_0x26df3b=_0x26df3b||0x1f4;return function(_0x26168a){logger[_0xefa4('0x22')](_0x26168a[_0xefa4('0x23')]);if(_0x26168a['name']){delete _0x26168a[_0xefa4('0x24')];}_0x3edc06[_0xefa4('0x19')](_0x26df3b)[_0xefa4('0x25')](_0x26168a);};}exports['index']=function(_0x118959,_0x4fe622){var _0x495944={},_0x129062={},_0x24d9ed={'count':0x0,'rows':[]};var _0x373bca=_[_0xefa4('0x26')](db[_0xefa4('0x27')][_0xefa4('0x28')],function(_0x51b7de){return{'name':_0x51b7de[_0xefa4('0x29')],'type':_0x51b7de['type']['key']};});_0x129062[_0xefa4('0x2a')]=_[_0xefa4('0x26')](_0x373bca,'name');_0x129062[_0xefa4('0x2b')]=_['keys'](_0x118959[_0xefa4('0x2b')]);_0x129062['filters']=_[_0xefa4('0x2c')](_0x129062[_0xefa4('0x2a')],_0x129062['query']);_0x495944[_0xefa4('0x2d')]=_[_0xefa4('0x2c')](_0x129062['model'],qs[_0xefa4('0x2e')](_0x118959[_0xefa4('0x2b')]['fields']));_0x495944[_0xefa4('0x2d')]=_0x495944[_0xefa4('0x2d')][_0xefa4('0x2f')]?_0x495944[_0xefa4('0x2d')]:_0x129062['model'];if(!_0x118959['query'][_0xefa4('0x30')]('nolimit')){_0x495944[_0xefa4('0x31')]=qs[_0xefa4('0x31')](_0x118959['query'][_0xefa4('0x31')]);_0x495944[_0xefa4('0x1b')]=qs[_0xefa4('0x1b')](_0x118959[_0xefa4('0x2b')][_0xefa4('0x1b')]);}_0x495944[_0xefa4('0x32')]=qs[_0xefa4('0x33')](_0x118959['query'][_0xefa4('0x33')]);_0x495944[_0xefa4('0x34')]=qs['filters'](_[_0xefa4('0x35')](_0x118959['query'],_0x129062['filters']));if(_0x118959['query'][_0xefa4('0x36')]){_0x495944[_0xefa4('0x34')]=_[_0xefa4('0x37')](_0x495944[_0xefa4('0x34')],{'$or':_[_0xefa4('0x26')](_0x373bca,function(_0x54e5a5){if(_0x54e5a5[_0xefa4('0x38')]!=='VIRTUAL'){var _0x3c95a0={};_0x3c95a0[_0x54e5a5[_0xefa4('0x24')]]={'$like':'%'+_0x118959[_0xefa4('0x2b')][_0xefa4('0x36')]+'%'};return _0x3c95a0;}})});}_0x495944=_[_0xefa4('0x37')]({},_0x495944,_0x118959[_0xefa4('0x39')]);var _0x13817a={'where':_0x495944[_0xefa4('0x34')]};return db[_0xefa4('0x27')][_0xefa4('0x3a')](_0x13817a)['then'](function(_0x47f705){_0x24d9ed[_0xefa4('0x3a')]=_0x47f705;if(_0x118959[_0xefa4('0x2b')][_0xefa4('0x3b')]){_0x495944['include']=[{'all':!![]}];}return db[_0xefa4('0x27')]['findAll'](_0x495944);})['then'](function(_0x14e9bd){_0x24d9ed[_0xefa4('0x3c')]=_0x14e9bd;return _0x24d9ed;})[_0xefa4('0x1f')](respondWithFilteredResult(_0x4fe622,_0x495944))[_0xefa4('0x3d')](handleError(_0x4fe622,null));};exports[_0xefa4('0x3e')]=function(_0x48d894,_0x5cb79e){var _0x4a31ac={'raw':!![],'where':{'id':_0x48d894['params']['id']}},_0x4742a4={};_0x4742a4['model']=_[_0xefa4('0x3f')](db[_0xefa4('0x27')][_0xefa4('0x28')]);_0x4742a4[_0xefa4('0x2b')]=_['keys'](_0x48d894[_0xefa4('0x2b')]);_0x4742a4['filters']=_['intersection'](_0x4742a4[_0xefa4('0x2a')],_0x4742a4['query']);_0x4a31ac[_0xefa4('0x2d')]=_[_0xefa4('0x2c')](_0x4742a4['model'],qs[_0xefa4('0x2e')](_0x48d894['query'][_0xefa4('0x2e')]));_0x4a31ac['attributes']=_0x4a31ac['attributes']['length']?_0x4a31ac[_0xefa4('0x2d')]:_0x4742a4[_0xefa4('0x2a')];if(_0x48d894[_0xefa4('0x2b')][_0xefa4('0x3b')]){_0x4a31ac[_0xefa4('0x40')]=[{'all':!![]}];}_0x4a31ac=_[_0xefa4('0x37')]({},_0x4a31ac,_0x48d894[_0xefa4('0x39')]);return db[_0xefa4('0x27')][_0xefa4('0x41')](_0x4a31ac)[_0xefa4('0x1f')](handleEntityNotFound(_0x5cb79e,null))['then'](respondWithResult(_0x5cb79e,null))[_0xefa4('0x3d')](handleError(_0x5cb79e,null));};exports[_0xefa4('0x42')]=function(_0x3343b8,_0x26a652){return db[_0xefa4('0x27')]['create'](_0x3343b8[_0xefa4('0x43')],{})[_0xefa4('0x1f')](function(_0x402d2b){var _0x32716e=_0x3343b8[_0xefa4('0x44')][_0xefa4('0x45')]({'plain':!![]});if(!_0x32716e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x32716e[_0xefa4('0x46')]===_0xefa4('0x44')){var _0x573025=_0x402d2b[_0xefa4('0x45')]({'plain':!![]});var _0x144519=_0xefa4('0x47');return db[_0xefa4('0x48')][_0xefa4('0x41')]({'where':{'name':_0x144519,'userProfileId':_0x32716e[_0xefa4('0x49')]},'raw':!![]})[_0xefa4('0x1f')](function(_0x1b0db8){if(_0x1b0db8&&_0x1b0db8[_0xefa4('0x4a')]===0x0){return db['UserProfileResource']['create']({'name':_0x573025[_0xefa4('0x24')],'resourceId':_0x573025['id'],'type':_0x1b0db8[_0xefa4('0x24')],'sectionId':_0x1b0db8['id']},{})[_0xefa4('0x1f')](function(){return _0x402d2b;});}else{return _0x402d2b;}})['catch'](function(_0x154cde){logger['error'](_0xefa4('0x4b'),_0x154cde);throw _0x154cde;});}return _0x402d2b;})['then'](respondWithResult(_0x26a652,0xc9))[_0xefa4('0x3d')](handleError(_0x26a652,null));};exports[_0xefa4('0x1e')]=function(_0x461e30,_0x24a79e){if(_0x461e30[_0xefa4('0x43')]['id']){delete _0x461e30['body']['id'];}return db[_0xefa4('0x27')][_0xefa4('0x41')]({'where':{'id':_0x461e30[_0xefa4('0x4c')]['id']}})[_0xefa4('0x1f')](handleEntityNotFound(_0x24a79e,null))[_0xefa4('0x1f')](saveUpdates(_0x461e30[_0xefa4('0x43')],null))[_0xefa4('0x1f')](respondWithResult(_0x24a79e,null))[_0xefa4('0x3d')](handleError(_0x24a79e,null));};exports[_0xefa4('0x20')]=function(_0x4aa7a5,_0x37b679){return db[_0xefa4('0x27')][_0xefa4('0x41')]({'where':{'id':_0x4aa7a5['params']['id']}})[_0xefa4('0x1f')](handleEntityNotFound(_0x37b679,null))[_0xefa4('0x1f')](removeEntity(_0x37b679,null))[_0xefa4('0x3d')](handleError(_0x37b679,null));};exports['test']=function(_0x2e1891,_0x418568,_0x242e20){var _0x480303;return db[_0xefa4('0x27')][_0xefa4('0x41')]({'where':{'id':_0x2e1891[_0xefa4('0x4c')]['id']},'attributes':['id',_0xefa4('0x4d')]})[_0xefa4('0x1f')](handleEntityNotFound(_0x418568,null))['then'](function(_0x2e5fe0){if(_0x2e5fe0){var _0x162bd5=require('odbc')();_0x162bd5['openSync'](_0x2e5fe0['dsn']);_0x162bd5[_0xefa4('0x4e')]();return _0x2e5fe0;}})[_0xefa4('0x1f')](respondWithResult(_0x418568,null))['catch'](handleError(_0x418568,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index ba6d96e..9af6e46 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 _0xf57e=['path','exports','square_odbc','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x4ce2f4,_0x5e3d4a){var _0x13145e=function(_0x4bc990){while(--_0x4bc990){_0x4ce2f4['push'](_0x4ce2f4['shift']());}};_0x13145e(++_0x5e3d4a);}(_0xf57e,0x1e9));var _0xef57=function(_0x49c817,_0x49e108){_0x49c817=_0x49c817-0x0;var _0x6e3579=_0xf57e[_0x49c817];return _0x6e3579;};'use strict';var _=require(_0xef57('0x0'));var util=require(_0xef57('0x1'));var logger=require(_0xef57('0x2'))(_0xef57('0x3'));var moment=require(_0xef57('0x4'));var BPromise=require('bluebird');var rp=require(_0xef57('0x5'));var fs=require('fs');var path=require(_0xef57('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./squareOdbc.attributes');module[_0xef57('0x7')]=function(_0x3da419,_0x5ee7e5){return _0x3da419['define']('SquareOdbc',attributes,{'tableName':_0xef57('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf3ec=['./squareOdbc.attributes','define','square_odbc','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5d983c,_0x57b322){var _0x45d2f8=function(_0x4fb48d){while(--_0x4fb48d){_0x5d983c['push'](_0x5d983c['shift']());}};_0x45d2f8(++_0x57b322);}(_0xf3ec,0xbe));var _0xcf3e=function(_0x16ed83,_0x57a007){_0x16ed83=_0x16ed83-0x0;var _0x4325e9=_0xf3ec[_0x16ed83];return _0x4325e9;};'use strict';var _=require(_0xcf3e('0x0'));var util=require(_0xcf3e('0x1'));var logger=require(_0xcf3e('0x2'))(_0xcf3e('0x3'));var moment=require(_0xcf3e('0x4'));var BPromise=require(_0xcf3e('0x5'));var rp=require(_0xcf3e('0x6'));var fs=require('fs');var path=require(_0xcf3e('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcf3e('0x8'));module['exports']=function(_0x5b38a5,_0x32c5aa){return _0x5b38a5[_0xcf3e('0x9')]('SquareOdbc',attributes,{'tableName':_0xcf3e('0xa'),'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 6eb7e67..e5ce6db 100644 --- a/server/api/squareOdbc/squareOdbc.rpc.js +++ b/server/api/squareOdbc/squareOdbc.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['stringify','ShowSquareOdbc','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SquareOdbc,\x20%s,\x20%s','message','catch','find','options','include','map','attributes','model','then'];(function(_0x179c89,_0x3a69b2){var _0x4b87e5=function(_0xbdf6f2){while(--_0xbdf6f2){_0x179c89['push'](_0x179c89['shift']());}};_0x4b87e5(++_0x3a69b2);}(_0x008c,0x188));var _0xc008=function(_0x37d5ff,_0x5ee83b){_0x37d5ff=_0x37d5ff-0x0;var _0x146b37=_0x008c[_0x37d5ff];return _0x146b37;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c8cb2,_0x4af530,_0x428fa9){return new BPromise(function(_0x5aa09b,_0x30be38){return client['request'](_0x9c8cb2,_0x428fa9)['then'](function(_0x27830d){logger[_0xc008('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,'request\x20sent');logger['debug'](_0xc008('0xe'),_0x4af530,_0xc008('0xf'),JSON['stringify'](_0x27830d));if(_0x27830d[_0xc008('0x10')]){if(_0x27830d[_0xc008('0x10')][_0xc008('0x11')]===0x1f4){logger[_0xc008('0x10')](_0xc008('0x12'),_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x30be38(_0x27830d['error']['message']);}logger[_0xc008('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x5aa09b(_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);}else{logger[_0xc008('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,'request\x20sent');_0x5aa09b(_0x27830d['result'][_0xc008('0x13')]);}})[_0xc008('0x14')](function(_0x3cafe3){logger[_0xc008('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,_0x3cafe3);_0x30be38(_0x3cafe3);});});}exports['ShowSquareOdbc']=function(_0x540e45){var _0x5c2668=this;return new Promise(function(_0x46042b,_0x462af5){return db['SquareOdbc'][_0xc008('0x15')]({'raw':_0x540e45['options']?_0x540e45['options']['raw']===undefined?!![]:![]:!![],'where':_0x540e45['options']?_0x540e45[_0xc008('0x16')]['where']||null:null,'attributes':_0x540e45['options']?_0x540e45['options']['attributes']||null:null,'include':_0x540e45['options']?_0x540e45[_0xc008('0x16')][_0xc008('0x17')]?_[_0xc008('0x18')](_0x540e45[_0xc008('0x16')][_0xc008('0x17')],function(_0x110128){return{'model':db[_0x110128['model']],'as':_0x110128['as'],'attributes':_0x110128[_0xc008('0x19')],'include':_0x110128['include']?_['map'](_0x110128[_0xc008('0x17')],function(_0x36f358){return{'model':db[_0x36f358[_0xc008('0x1a')]],'as':_0x36f358['as'],'attributes':_0x36f358[_0xc008('0x19')],'include':_0x36f358['include']?_['map'](_0x36f358['include'],function(_0x3f7b07){return{'model':db[_0x3f7b07[_0xc008('0x1a')]],'as':_0x3f7b07['as'],'attributes':_0x3f7b07[_0xc008('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc008('0x1b')](function(_0x5bebd9){logger['info']('ShowSquareOdbc',_0x540e45);logger['debug']('ShowSquareOdbc',_0x540e45,JSON[_0xc008('0x1c')](_0x5bebd9));_0x46042b(_0x5bebd9);})[_0xc008('0x14')](function(_0x25eae4){logger['error'](_0xc008('0x1d'),_0x25eae4[_0xc008('0x13')],_0x540e45);_0x462af5(_0x5c2668[_0xc008('0x10')](0x1f4,_0x25eae4[_0xc008('0x13')]));});});}; \ No newline at end of file +var _0x008c=['stringify','ShowSquareOdbc','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SquareOdbc,\x20%s,\x20%s','message','catch','find','options','include','map','attributes','model','then'];(function(_0x2c961d,_0x106e3a){var _0xb29a42=function(_0xc899d8){while(--_0xc899d8){_0x2c961d['push'](_0x2c961d['shift']());}};_0xb29a42(++_0x106e3a);}(_0x008c,0x188));var _0xc008=function(_0x6171c0,_0x127af3){_0x6171c0=_0x6171c0-0x0;var _0x227390=_0x008c[_0x6171c0];return _0x227390;};'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 3605cd5..9742199 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 _0xa5fa=['post','put','update','delete','removeUsers','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./squareProject.controller','get','isAuthenticated','index','/:id','show','/:id/users'];(function(_0x4a324e,_0x14c504){var _0x5ede4f=function(_0x8ad7ff){while(--_0x8ad7ff){_0x4a324e['push'](_0x4a324e['shift']());}};_0x5ede4f(++_0x14c504);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x10296f,_0x4db559){_0x10296f=_0x10296f-0x0;var _0x404832=_0xa5fa[_0x10296f];return _0x404832;};'use strict';var multer=require('multer');var util=require(_0xaa5f('0x0'));var path=require(_0xaa5f('0x1'));var timeout=require(_0xaa5f('0x2'));var express=require(_0xaa5f('0x3'));var router=express['Router']();var auth=require(_0xaa5f('0x4'));var interaction=require(_0xaa5f('0x5'));var config=require('../../config/environment');var controller=require(_0xaa5f('0x6'));router[_0xaa5f('0x7')]('/',auth[_0xaa5f('0x8')](),controller[_0xaa5f('0x9')]);router[_0xaa5f('0x7')](_0xaa5f('0xa'),auth[_0xaa5f('0x8')](),controller[_0xaa5f('0xb')]);router[_0xaa5f('0x7')](_0xaa5f('0xc'),auth[_0xaa5f('0x8')](),controller['getUsers']);router[_0xaa5f('0xd')]('/',auth[_0xaa5f('0x8')](),controller['create']);router['post'](_0xaa5f('0xc'),auth['isAuthenticated'](),controller['addUsers']);router[_0xaa5f('0xe')]('/:id',auth[_0xaa5f('0x8')](),controller[_0xaa5f('0xf')]);router[_0xaa5f('0x10')](_0xaa5f('0xa'),auth[_0xaa5f('0x8')](),controller['destroy']);router[_0xaa5f('0x10')]('/:id/users',auth[_0xaa5f('0x8')](),controller[_0xaa5f('0x11')]);module[_0xaa5f('0x12')]=router; \ No newline at end of file +var _0xb78e=['removeUsers','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','index','/:id','isAuthenticated','show','/:id/users','getUsers','post','create','addUsers','put','update','delete','destroy'];(function(_0x37a8ee,_0x87e41c){var _0x1f6588=function(_0x586d4d){while(--_0x586d4d){_0x37a8ee['push'](_0x37a8ee['shift']());}};_0x1f6588(++_0x87e41c);}(_0xb78e,0x1c9));var _0xeb78=function(_0x4b64fe,_0x71b2a4){_0x4b64fe=_0x4b64fe-0x0;var _0x288459=_0xb78e[_0x4b64fe];return _0x288459;};'use strict';var multer=require(_0xeb78('0x0'));var util=require(_0xeb78('0x1'));var path=require('path');var timeout=require(_0xeb78('0x2'));var express=require(_0xeb78('0x3'));var router=express[_0xeb78('0x4')]();var auth=require(_0xeb78('0x5'));var interaction=require(_0xeb78('0x6'));var config=require(_0xeb78('0x7'));var controller=require(_0xeb78('0x8'));router[_0xeb78('0x9')]('/',auth['isAuthenticated'](),controller[_0xeb78('0xa')]);router[_0xeb78('0x9')](_0xeb78('0xb'),auth[_0xeb78('0xc')](),controller[_0xeb78('0xd')]);router[_0xeb78('0x9')](_0xeb78('0xe'),auth['isAuthenticated'](),controller[_0xeb78('0xf')]);router[_0xeb78('0x10')]('/',auth[_0xeb78('0xc')](),controller[_0xeb78('0x11')]);router[_0xeb78('0x10')](_0xeb78('0xe'),auth[_0xeb78('0xc')](),controller[_0xeb78('0x12')]);router[_0xeb78('0x13')]('/:id',auth[_0xeb78('0xc')](),controller[_0xeb78('0x14')]);router[_0xeb78('0x15')](_0xeb78('0xb'),auth[_0xeb78('0xc')](),controller[_0xeb78('0x16')]);router[_0xeb78('0x15')](_0xeb78('0xe'),auth[_0xeb78('0xc')](),controller[_0xeb78('0x17')]);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 1bd6835..39fda8e 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 _0x7839=['utf8','BLOB','production','sequelize','exports','name','STRING','TEXT','getDataValue','preproduction','toString'];(function(_0xdc5664,_0x4eef5a){var _0xd65a92=function(_0x73d50){while(--_0x73d50){_0xdc5664['push'](_0xdc5664['shift']());}};_0xd65a92(++_0x4eef5a);}(_0x7839,0x1dc));var _0x9783=function(_0x287665,_0x1202ee){_0x287665=_0x287665-0x0;var _0x1443d2=_0x7839[_0x287665];return _0x1443d2;};'use strict';var Sequelize=require(_0x9783('0x0'));module[_0x9783('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9783('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x9783('0x3')]},'notes':{'type':Sequelize[_0x9783('0x4')]},'preproduction':{'type':Sequelize['BLOB']('long'),'get':function(){if(this[_0x9783('0x5')](_0x9783('0x6'))){return this[_0x9783('0x5')]('preproduction')[_0x9783('0x7')](_0x9783('0x8'));}}},'production':{'type':Sequelize[_0x9783('0x9')]('long'),'get':function(){if(this['getDataValue']('production')){return this[_0x9783('0x5')](_0x9783('0xa'))[_0x9783('0x7')]('utf8');}}}}; \ No newline at end of file +var _0x7a0c=['BLOB','long','getDataValue','preproduction','toString','utf8','production','exports','STRING','name','TEXT'];(function(_0x5e732f,_0x4f3add){var _0x263923=function(_0x325b49){while(--_0x325b49){_0x5e732f['push'](_0x5e732f['shift']());}};_0x263923(++_0x4f3add);}(_0x7a0c,0x1b4));var _0xc7a0=function(_0x163f43,_0x323076){_0x163f43=_0x163f43-0x0;var _0x4449eb=_0x7a0c[_0x163f43];return _0x4449eb;};'use strict';var Sequelize=require('sequelize');module[_0xc7a0('0x0')]={'name':{'type':Sequelize[_0xc7a0('0x1')],'unique':_0xc7a0('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xc7a0('0x1')]},'notes':{'type':Sequelize[_0xc7a0('0x3')]},'preproduction':{'type':Sequelize[_0xc7a0('0x4')](_0xc7a0('0x5')),'get':function(){if(this[_0xc7a0('0x6')](_0xc7a0('0x7'))){return this[_0xc7a0('0x6')](_0xc7a0('0x7'))[_0xc7a0('0x8')](_0xc7a0('0x9'));}}},'production':{'type':Sequelize[_0xc7a0('0x4')](_0xc7a0('0x5')),'get':function(){if(this[_0xc7a0('0x6')](_0xc7a0('0xa'))){return this[_0xc7a0('0x6')](_0xc7a0('0xa'))[_0xc7a0('0x8')](_0xc7a0('0x9'));}}}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 939b771..fc13906 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 _0x91a7=['keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','findAll','rows','catch','show','params','length','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','SquareProjects','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','removeUsers','isArray','emit','userSquareProject:remove','findOne','User','getUsers','eml-format','rimraf','zip-dir','request-promise','bluebird','path','sox','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','offset','limit','set','json','apply','reject','save','update','then','get','UserProfileResource','destroy','end','error','stack','name','send','map','SquareProject','rawAttributes','fieldName','type','key','model','query'];(function(_0x539bde,_0x14b7db){var _0x1718d4=function(_0x1d35e0){while(--_0x1d35e0){_0x539bde['push'](_0x539bde['shift']());}};_0x1718d4(++_0x14b7db);}(_0x91a7,0xe7));var _0x791a=function(_0x37d8f8,_0x4ffa43){_0x37d8f8=_0x37d8f8-0x0;var _0x1f5139=_0x91a7[_0x37d8f8];return _0x1f5139;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x791a('0x0'));var rimraf=require(_0x791a('0x1'));var zipdir=require(_0x791a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x791a('0x3'));var moment=require('moment');var BPromise=require(_0x791a('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x791a('0x5'));var sox=require(_0x791a('0x6'));var csv=require('to-csv');var ejs=require(_0x791a('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x791a('0x8'));var crypto=require(_0x791a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x791a('0xa'));var toCsv=require(_0x791a('0xb'));var querystring=require(_0x791a('0xc'));var Papa=require(_0x791a('0xd'));var Redis=require(_0x791a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x791a('0xf'));var as=require(_0x791a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x791a('0x11'))(_0x791a('0x12'));var utils=require(_0x791a('0x13'));var config=require(_0x791a('0x14'));var db=require(_0x791a('0x15'))['db'];config[_0x791a('0x16')]=_['defaults'](config['redis'],{'host':_0x791a('0x17'),'port':0x18eb});var socket=require(_0x791a('0x18'))(new Redis(config['redis']));require(_0x791a('0x19'))[_0x791a('0x1a')](socket);function respondWithStatusCode(_0x5d5b11,_0x2887f0){_0x2887f0=_0x2887f0||0xcc;return function(_0x31b86d){if(_0x31b86d){return _0x5d5b11[_0x791a('0x1b')](_0x2887f0);}return _0x5d5b11[_0x791a('0x1c')](_0x2887f0)['end']();};}function respondWithResult(_0x2ce2e0,_0x575d11){_0x575d11=_0x575d11||0xc8;return function(_0x43dea6){if(_0x43dea6){return _0x2ce2e0[_0x791a('0x1c')](_0x575d11)['json'](_0x43dea6);}};}function respondWithFilteredResult(_0x237adb,_0x5bea2e){return function(_0x35fe48){if(_0x35fe48){var _0x52941d=_0x35fe48['count'],_0x4a84ee=_0x5bea2e['offset'],_0x588d00=_0x5bea2e[_0x791a('0x1d')]+_0x5bea2e[_0x791a('0x1e')],_0x40f0d3;if(_0x588d00>=_0x52941d){_0x588d00=_0x52941d;_0x40f0d3=0xc8;}else{_0x40f0d3=0xce;}_0x237adb[_0x791a('0x1c')](_0x40f0d3);return _0x237adb[_0x791a('0x1f')]('Content-Range',_0x4a84ee+'-'+_0x588d00+'/'+_0x52941d)[_0x791a('0x20')](_0x35fe48);}return null;};}function patchUpdates(_0xcb5e66){return function(_0x234514){try{jsonpatch[_0x791a('0x21')](_0x234514,_0xcb5e66,!![]);}catch(_0x530e32){return BPromise[_0x791a('0x22')](_0x530e32);}return _0x234514[_0x791a('0x23')]();};}function saveUpdates(_0x25bae5,_0x9e17b5){return function(_0x3200dd){if(_0x3200dd){return _0x3200dd[_0x791a('0x24')](_0x25bae5)[_0x791a('0x25')](function(_0x45a67d){return _0x45a67d;});}return null;};}function removeEntity(_0x323c6a,_0xe8e452){return function(_0x137992){if(_0x137992){return _0x137992['destroy']()[_0x791a('0x25')](function(){var _0x2728a0=_0x137992[_0x791a('0x26')]({'plain':!![]});var _0x2966b8='SquareProjects';return db[_0x791a('0x27')][_0x791a('0x28')]({'where':{'type':_0x2966b8,'resourceId':_0x2728a0['id']}})['then'](function(){return _0x137992;});})[_0x791a('0x25')](function(){_0x323c6a[_0x791a('0x1c')](0xcc)[_0x791a('0x29')]();});}};}function handleEntityNotFound(_0x4c1626,_0x29194d){return function(_0x2b3327){if(!_0x2b3327){_0x4c1626[_0x791a('0x1b')](0x194);}return _0x2b3327;};}function handleError(_0x395376,_0x4f423){_0x4f423=_0x4f423||0x1f4;return function(_0x1a9c6b){logger[_0x791a('0x2a')](_0x1a9c6b[_0x791a('0x2b')]);if(_0x1a9c6b['name']){delete _0x1a9c6b[_0x791a('0x2c')];}_0x395376[_0x791a('0x1c')](_0x4f423)[_0x791a('0x2d')](_0x1a9c6b);};}exports['index']=function(_0x1cdda9,_0x5df656){var _0xc59f5e={},_0x2e4ec8={},_0xcde862={'count':0x0,'rows':[]};var _0xe72e0c=_[_0x791a('0x2e')](db[_0x791a('0x2f')][_0x791a('0x30')],function(_0x4f5506){return{'name':_0x4f5506[_0x791a('0x31')],'type':_0x4f5506[_0x791a('0x32')][_0x791a('0x33')]};});_0x2e4ec8[_0x791a('0x34')]=_[_0x791a('0x2e')](_0xe72e0c,'name');_0x2e4ec8[_0x791a('0x35')]=_[_0x791a('0x36')](_0x1cdda9[_0x791a('0x35')]);_0x2e4ec8[_0x791a('0x37')]=_[_0x791a('0x38')](_0x2e4ec8['model'],_0x2e4ec8[_0x791a('0x35')]);_0xc59f5e[_0x791a('0x39')]=_[_0x791a('0x38')](_0x2e4ec8[_0x791a('0x34')],qs[_0x791a('0x3a')](_0x1cdda9['query'][_0x791a('0x3a')]));_0xc59f5e['attributes']=_0xc59f5e[_0x791a('0x39')]['length']?_0xc59f5e['attributes']:_0x2e4ec8[_0x791a('0x34')];if(!_0x1cdda9[_0x791a('0x35')][_0x791a('0x3b')](_0x791a('0x3c'))){_0xc59f5e[_0x791a('0x1e')]=qs[_0x791a('0x1e')](_0x1cdda9[_0x791a('0x35')]['limit']);_0xc59f5e[_0x791a('0x1d')]=qs['offset'](_0x1cdda9[_0x791a('0x35')]['offset']);}_0xc59f5e[_0x791a('0x3d')]=qs[_0x791a('0x3e')](_0x1cdda9['query'][_0x791a('0x3e')]);_0xc59f5e[_0x791a('0x3f')]=qs['filters'](_[_0x791a('0x40')](_0x1cdda9[_0x791a('0x35')],_0x2e4ec8[_0x791a('0x37')]));if(_0x1cdda9[_0x791a('0x35')][_0x791a('0x41')]){_0xc59f5e[_0x791a('0x3f')]=_[_0x791a('0x42')](_0xc59f5e[_0x791a('0x3f')],{'$or':_[_0x791a('0x2e')](_0xe72e0c,function(_0xeafbb5){if(_0xeafbb5['type']!==_0x791a('0x43')){var _0x7ebf84={};_0x7ebf84[_0xeafbb5[_0x791a('0x2c')]]={'$like':'%'+_0x1cdda9['query'][_0x791a('0x41')]+'%'};return _0x7ebf84;}})});}_0xc59f5e=_['merge']({},_0xc59f5e,_0x1cdda9['options']);var _0x5ab82f={'where':_0xc59f5e[_0x791a('0x3f')]};return db[_0x791a('0x2f')]['count'](_0x5ab82f)[_0x791a('0x25')](function(_0x2d1692){_0xcde862[_0x791a('0x44')]=_0x2d1692;if(_0x1cdda9[_0x791a('0x35')]['includeAll']){_0xc59f5e['include']=[{'all':!![]}];}return db['SquareProject'][_0x791a('0x45')](_0xc59f5e);})[_0x791a('0x25')](function(_0x4e0191){_0xcde862[_0x791a('0x46')]=_0x4e0191;return _0xcde862;})[_0x791a('0x25')](respondWithFilteredResult(_0x5df656,_0xc59f5e))[_0x791a('0x47')](handleError(_0x5df656,null));};exports[_0x791a('0x48')]=function(_0x508727,_0x11263d){var _0x5911db={'raw':![],'where':{'id':_0x508727[_0x791a('0x49')]['id']}},_0x3682db={};_0x3682db[_0x791a('0x34')]=_[_0x791a('0x36')](db[_0x791a('0x2f')]['rawAttributes']);_0x3682db[_0x791a('0x35')]=_[_0x791a('0x36')](_0x508727[_0x791a('0x35')]);_0x3682db[_0x791a('0x37')]=_[_0x791a('0x38')](_0x3682db['model'],_0x3682db[_0x791a('0x35')]);_0x5911db[_0x791a('0x39')]=_['intersection'](_0x3682db['model'],qs[_0x791a('0x3a')](_0x508727[_0x791a('0x35')][_0x791a('0x3a')]));_0x5911db['attributes']=_0x5911db['attributes'][_0x791a('0x4a')]?_0x5911db[_0x791a('0x39')]:_0x3682db['model'];if(_0x508727[_0x791a('0x35')][_0x791a('0x4b')]){_0x5911db[_0x791a('0x4c')]=[{'all':!![]}];}_0x5911db=_['merge']({},_0x5911db,_0x508727['options']);return db[_0x791a('0x2f')][_0x791a('0x4d')](_0x5911db)[_0x791a('0x25')](handleEntityNotFound(_0x11263d,null))[_0x791a('0x25')](respondWithResult(_0x11263d,null))['catch'](handleError(_0x11263d,null));};exports[_0x791a('0x4e')]=function(_0x9f768a,_0x4e6d0d){return db[_0x791a('0x2f')]['create'](_0x9f768a[_0x791a('0x4f')],{})[_0x791a('0x25')](function(_0xe0696b){var _0x227199=_0x9f768a[_0x791a('0x50')][_0x791a('0x26')]({'plain':!![]});if(!_0x227199)throw new Error(_0x791a('0x51'));if(_0x227199['role']===_0x791a('0x50')){var _0x1fd826=_0xe0696b['get']({'plain':!![]});var _0x2cf7e=_0x791a('0x52');return db['UserProfileSection'][_0x791a('0x4d')]({'where':{'name':_0x2cf7e,'userProfileId':_0x227199[_0x791a('0x53')]},'raw':!![]})[_0x791a('0x25')](function(_0x2e357c){if(_0x2e357c&&_0x2e357c[_0x791a('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x1fd826['name'],'resourceId':_0x1fd826['id'],'type':_0x2e357c[_0x791a('0x2c')],'sectionId':_0x2e357c['id']},{})['then'](function(){return _0xe0696b;});}else{return _0xe0696b;}})['catch'](function(_0x2f764a){logger['error'](_0x791a('0x55'),_0x2f764a);throw _0x2f764a;});}return _0xe0696b;})[_0x791a('0x25')](respondWithResult(_0x4e6d0d,0xc9))['catch'](handleError(_0x4e6d0d,null));};exports['update']=function(_0x3599f6,_0x597df2){if(_0x3599f6[_0x791a('0x4f')]['id']){delete _0x3599f6[_0x791a('0x4f')]['id'];}return db[_0x791a('0x2f')]['find']({'where':{'id':_0x3599f6[_0x791a('0x49')]['id']}})[_0x791a('0x25')](handleEntityNotFound(_0x597df2,null))['then'](saveUpdates(_0x3599f6[_0x791a('0x4f')],null))[_0x791a('0x25')](respondWithResult(_0x597df2,null))[_0x791a('0x47')](handleError(_0x597df2,null));};exports[_0x791a('0x28')]=function(_0x450ad8,_0x38080b){return db['SquareProject']['find']({'where':{'id':_0x450ad8[_0x791a('0x49')]['id']}})['then'](handleEntityNotFound(_0x38080b,null))[_0x791a('0x25')](removeEntity(_0x38080b,null))[_0x791a('0x47')](handleError(_0x38080b,null));};exports[_0x791a('0x56')]=function(_0xf11dea,_0x3b760c,_0x2bd2cc){return db[_0x791a('0x2f')]['find']({'where':{'id':_0xf11dea[_0x791a('0x49')]['id']}})[_0x791a('0x25')](handleEntityNotFound(_0x3b760c,null))[_0x791a('0x25')](function(_0x1a4376){if(_0x1a4376){return _0x1a4376[_0x791a('0x56')](_0xf11dea[_0x791a('0x4f')][_0x791a('0x57')],_['omit'](_0xf11dea[_0x791a('0x4f')],['ids','id'])||{});}})['then'](respondWithResult(_0x3b760c,null))[_0x791a('0x47')](handleError(_0x3b760c,null));};exports[_0x791a('0x58')]=function(_0x216b69,_0x2e3432,_0x31255c){return db[_0x791a('0x2f')][_0x791a('0x4d')]({'where':{'id':_0x216b69[_0x791a('0x49')]['id']}})[_0x791a('0x25')](handleEntityNotFound(_0x2e3432,null))[_0x791a('0x25')](function(_0x35acf7){if(_0x35acf7){return _0x35acf7[_0x791a('0x58')](_0x216b69[_0x791a('0x35')][_0x791a('0x57')])[_0x791a('0x25')](function(){if(_[_0x791a('0x59')](_0x216b69[_0x791a('0x35')][_0x791a('0x57')])){for(var _0x2abfe3=0x0;_0x2abfe3<_0x216b69[_0x791a('0x35')]['ids'][_0x791a('0x4a')];_0x2abfe3+=0x1){socket[_0x791a('0x5a')](_0x791a('0x5b'),{'UserId':Number(_0x216b69[_0x791a('0x35')][_0x791a('0x57')][_0x2abfe3]),'SquareProjectId':Number(_0x216b69['params']['id'])});}}else{socket[_0x791a('0x5a')](_0x791a('0x5b'),{'UserId':Number(_0x216b69[_0x791a('0x35')][_0x791a('0x57')]),'SquareProjectId':Number(_0x216b69['params']['id'])});}});}})[_0x791a('0x25')](respondWithStatusCode(_0x2e3432,null))['catch'](handleError(_0x2e3432,null));};exports['getUsers']=function(_0x482fa6,_0x5278e8,_0x22aaf2){var _0x40207b={};var _0x11c11f={};var _0x181ac7;var _0x1bf9a3;return db[_0x791a('0x2f')][_0x791a('0x5c')]({'where':{'id':_0x482fa6['params']['id']}})['then'](handleEntityNotFound(_0x5278e8,null))[_0x791a('0x25')](function(_0x185620){if(_0x185620){_0x181ac7=_0x185620;_0x11c11f['model']=_['keys'](db[_0x791a('0x5d')][_0x791a('0x30')]);_0x11c11f['query']=_[_0x791a('0x36')](_0x482fa6[_0x791a('0x35')]);_0x11c11f[_0x791a('0x37')]=_[_0x791a('0x38')](_0x11c11f['model'],_0x11c11f['query']);_0x40207b[_0x791a('0x39')]=_[_0x791a('0x38')](_0x11c11f['model'],qs[_0x791a('0x3a')](_0x482fa6[_0x791a('0x35')][_0x791a('0x3a')]));_0x40207b[_0x791a('0x39')]=_0x40207b['attributes'][_0x791a('0x4a')]?_0x40207b[_0x791a('0x39')]:_0x11c11f[_0x791a('0x34')];_0x40207b[_0x791a('0x3d')]=qs[_0x791a('0x3e')](_0x482fa6[_0x791a('0x35')][_0x791a('0x3e')]);_0x40207b[_0x791a('0x3f')]=qs['filters'](_['pick'](_0x482fa6['query'],_0x11c11f[_0x791a('0x37')]));if(_0x482fa6[_0x791a('0x35')][_0x791a('0x41')]){_0x40207b[_0x791a('0x3f')]=_[_0x791a('0x42')](_0x40207b[_0x791a('0x3f')],{'$or':_[_0x791a('0x2e')](_0x40207b[_0x791a('0x39')],function(_0x360083){var _0x13523a={};_0x13523a[_0x360083]={'$like':'%'+_0x482fa6['query'][_0x791a('0x41')]+'%'};return _0x13523a;})});}_0x40207b=_[_0x791a('0x42')]({},_0x40207b,_0x482fa6['options']);return _0x181ac7[_0x791a('0x5e')](_0x40207b);}})[_0x791a('0x25')](function(_0x591328){if(_0x591328){_0x1bf9a3=_0x591328['length'];if(!_0x482fa6[_0x791a('0x35')][_0x791a('0x3b')]('nolimit')){_0x40207b['limit']=qs[_0x791a('0x1e')](_0x482fa6[_0x791a('0x35')][_0x791a('0x1e')]);_0x40207b['offset']=qs[_0x791a('0x1d')](_0x482fa6['query'][_0x791a('0x1d')]);}return _0x181ac7[_0x791a('0x5e')](_0x40207b);}})[_0x791a('0x25')](function(_0x4072d0){if(_0x4072d0){return _0x4072d0?{'count':_0x1bf9a3,'rows':_0x4072d0}:null;}})[_0x791a('0x25')](respondWithResult(_0x5278e8,null))[_0x791a('0x47')](handleError(_0x5278e8,null));}; \ No newline at end of file +var _0xb49a=['Content-Range','apply','then','SquareProjects','error','name','index','map','rawAttributes','fieldName','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','type','VIRTUAL','options','count','includeAll','include','SquareProject','findAll','rows','show','params','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','findOne','getUsers','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','json','offset','limit','set'];(function(_0x4cf369,_0x35f48d){var _0x567f95=function(_0x462605){while(--_0x462605){_0x4cf369['push'](_0x4cf369['shift']());}};_0x567f95(++_0x35f48d);}(_0xb49a,0xfb));var _0xab49=function(_0x8d5844,_0x48eb67){_0x8d5844=_0x8d5844-0x0;var _0x56726c=_0xb49a[_0x8d5844];return _0x56726c;};'use strict';var pdf=require(_0xab49('0x0'));var emlformat=require(_0xab49('0x1'));var rimraf=require(_0xab49('0x2'));var zipdir=require(_0xab49('0x3'));var jsonpatch=require(_0xab49('0x4'));var rp=require('request-promise');var moment=require(_0xab49('0x5'));var BPromise=require(_0xab49('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xab49('0x7'));var sox=require(_0xab49('0x8'));var csv=require(_0xab49('0x9'));var ejs=require(_0xab49('0xa'));var fs=require('fs');var _=require(_0xab49('0xb'));var squel=require(_0xab49('0xc'));var crypto=require(_0xab49('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xab49('0xe'));var toCsv=require(_0xab49('0x9'));var querystring=require(_0xab49('0xf'));var Papa=require(_0xab49('0x10'));var Redis=require(_0xab49('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xab49('0x12'));var hardwareService=require(_0xab49('0x13'));var logger=require(_0xab49('0x14'))(_0xab49('0x15'));var utils=require(_0xab49('0x16'));var config=require('../../config/environment');var db=require(_0xab49('0x17'))['db'];config[_0xab49('0x18')]=_[_0xab49('0x19')](config[_0xab49('0x18')],{'host':_0xab49('0x1a'),'port':0x18eb});var socket=require(_0xab49('0x1b'))(new Redis(config[_0xab49('0x18')]));require(_0xab49('0x1c'))[_0xab49('0x1d')](socket);function respondWithStatusCode(_0x389ebb,_0x40f465){_0x40f465=_0x40f465||0xcc;return function(_0x5ea744){if(_0x5ea744){return _0x389ebb[_0xab49('0x1e')](_0x40f465);}return _0x389ebb[_0xab49('0x1f')](_0x40f465)[_0xab49('0x20')]();};}function respondWithResult(_0x9c59e1,_0x14d8b8){_0x14d8b8=_0x14d8b8||0xc8;return function(_0x589dc4){if(_0x589dc4){return _0x9c59e1[_0xab49('0x1f')](_0x14d8b8)[_0xab49('0x21')](_0x589dc4);}};}function respondWithFilteredResult(_0x311de3,_0xcaa6ca){return function(_0x2bf1ce){if(_0x2bf1ce){var _0x47f977=_0x2bf1ce['count'],_0x167a2a=_0xcaa6ca['offset'],_0x24cb8f=_0xcaa6ca[_0xab49('0x22')]+_0xcaa6ca[_0xab49('0x23')],_0x28449b;if(_0x24cb8f>=_0x47f977){_0x24cb8f=_0x47f977;_0x28449b=0xc8;}else{_0x28449b=0xce;}_0x311de3['status'](_0x28449b);return _0x311de3[_0xab49('0x24')](_0xab49('0x25'),_0x167a2a+'-'+_0x24cb8f+'/'+_0x47f977)['json'](_0x2bf1ce);}return null;};}function patchUpdates(_0x3662b2){return function(_0x588707){try{jsonpatch[_0xab49('0x26')](_0x588707,_0x3662b2,!![]);}catch(_0x1aafa0){return BPromise['reject'](_0x1aafa0);}return _0x588707['save']();};}function saveUpdates(_0x333506,_0x4fa8d2){return function(_0x32a1d1){if(_0x32a1d1){return _0x32a1d1['update'](_0x333506)[_0xab49('0x27')](function(_0x2faeca){return _0x2faeca;});}return null;};}function removeEntity(_0x2ba18a,_0x579039){return function(_0x2bf8e0){if(_0x2bf8e0){return _0x2bf8e0['destroy']()[_0xab49('0x27')](function(){var _0xeb6d91=_0x2bf8e0['get']({'plain':!![]});var _0x29096f=_0xab49('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x29096f,'resourceId':_0xeb6d91['id']}})[_0xab49('0x27')](function(){return _0x2bf8e0;});})[_0xab49('0x27')](function(){_0x2ba18a[_0xab49('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b1fed,_0x237273){return function(_0x4bf0cf){if(!_0x4bf0cf){_0x1b1fed[_0xab49('0x1e')](0x194);}return _0x4bf0cf;};}function handleError(_0x169fd7,_0x342fdf){_0x342fdf=_0x342fdf||0x1f4;return function(_0x57fbad){logger[_0xab49('0x29')](_0x57fbad['stack']);if(_0x57fbad[_0xab49('0x2a')]){delete _0x57fbad['name'];}_0x169fd7[_0xab49('0x1f')](_0x342fdf)['send'](_0x57fbad);};}exports[_0xab49('0x2b')]=function(_0x24bd0f,_0x1c48ef){var _0x211be2={},_0x49f122={},_0x6e83f6={'count':0x0,'rows':[]};var _0x1ea20e=_[_0xab49('0x2c')](db['SquareProject'][_0xab49('0x2d')],function(_0x569569){return{'name':_0x569569[_0xab49('0x2e')],'type':_0x569569['type']['key']};});_0x49f122['model']=_[_0xab49('0x2c')](_0x1ea20e,'name');_0x49f122[_0xab49('0x2f')]=_[_0xab49('0x30')](_0x24bd0f[_0xab49('0x2f')]);_0x49f122['filters']=_[_0xab49('0x31')](_0x49f122[_0xab49('0x32')],_0x49f122[_0xab49('0x2f')]);_0x211be2[_0xab49('0x33')]=_[_0xab49('0x31')](_0x49f122['model'],qs[_0xab49('0x34')](_0x24bd0f[_0xab49('0x2f')]['fields']));_0x211be2['attributes']=_0x211be2[_0xab49('0x33')][_0xab49('0x35')]?_0x211be2[_0xab49('0x33')]:_0x49f122[_0xab49('0x32')];if(!_0x24bd0f[_0xab49('0x2f')][_0xab49('0x36')](_0xab49('0x37'))){_0x211be2[_0xab49('0x23')]=qs[_0xab49('0x23')](_0x24bd0f[_0xab49('0x2f')][_0xab49('0x23')]);_0x211be2[_0xab49('0x22')]=qs[_0xab49('0x22')](_0x24bd0f['query'][_0xab49('0x22')]);}_0x211be2[_0xab49('0x38')]=qs[_0xab49('0x39')](_0x24bd0f[_0xab49('0x2f')][_0xab49('0x39')]);_0x211be2['where']=qs[_0xab49('0x3a')](_['pick'](_0x24bd0f['query'],_0x49f122[_0xab49('0x3a')]));if(_0x24bd0f[_0xab49('0x2f')][_0xab49('0x3b')]){_0x211be2[_0xab49('0x3c')]=_[_0xab49('0x3d')](_0x211be2['where'],{'$or':_[_0xab49('0x2c')](_0x1ea20e,function(_0x2cdcbf){if(_0x2cdcbf[_0xab49('0x3e')]!==_0xab49('0x3f')){var _0x212041={};_0x212041[_0x2cdcbf['name']]={'$like':'%'+_0x24bd0f['query'][_0xab49('0x3b')]+'%'};return _0x212041;}})});}_0x211be2=_[_0xab49('0x3d')]({},_0x211be2,_0x24bd0f[_0xab49('0x40')]);var _0x538cb9={'where':_0x211be2[_0xab49('0x3c')]};return db['SquareProject']['count'](_0x538cb9)['then'](function(_0x5d24e2){_0x6e83f6[_0xab49('0x41')]=_0x5d24e2;if(_0x24bd0f[_0xab49('0x2f')][_0xab49('0x42')]){_0x211be2[_0xab49('0x43')]=[{'all':!![]}];}return db[_0xab49('0x44')][_0xab49('0x45')](_0x211be2);})[_0xab49('0x27')](function(_0x164838){_0x6e83f6[_0xab49('0x46')]=_0x164838;return _0x6e83f6;})[_0xab49('0x27')](respondWithFilteredResult(_0x1c48ef,_0x211be2))['catch'](handleError(_0x1c48ef,null));};exports[_0xab49('0x47')]=function(_0x1ea64d,_0x523dd2){var _0x20ecfb={'raw':![],'where':{'id':_0x1ea64d[_0xab49('0x48')]['id']}},_0x204ff3={};_0x204ff3[_0xab49('0x32')]=_[_0xab49('0x30')](db[_0xab49('0x44')][_0xab49('0x2d')]);_0x204ff3[_0xab49('0x2f')]=_['keys'](_0x1ea64d[_0xab49('0x2f')]);_0x204ff3[_0xab49('0x3a')]=_[_0xab49('0x31')](_0x204ff3['model'],_0x204ff3[_0xab49('0x2f')]);_0x20ecfb[_0xab49('0x33')]=_[_0xab49('0x31')](_0x204ff3[_0xab49('0x32')],qs[_0xab49('0x34')](_0x1ea64d[_0xab49('0x2f')]['fields']));_0x20ecfb[_0xab49('0x33')]=_0x20ecfb[_0xab49('0x33')][_0xab49('0x35')]?_0x20ecfb[_0xab49('0x33')]:_0x204ff3[_0xab49('0x32')];if(_0x1ea64d[_0xab49('0x2f')]['includeAll']){_0x20ecfb[_0xab49('0x43')]=[{'all':!![]}];}_0x20ecfb=_[_0xab49('0x3d')]({},_0x20ecfb,_0x1ea64d[_0xab49('0x40')]);return db[_0xab49('0x44')][_0xab49('0x49')](_0x20ecfb)[_0xab49('0x27')](handleEntityNotFound(_0x523dd2,null))[_0xab49('0x27')](respondWithResult(_0x523dd2,null))[_0xab49('0x4a')](handleError(_0x523dd2,null));};exports[_0xab49('0x4b')]=function(_0xfb7d69,_0x1ceb71){return db[_0xab49('0x44')]['create'](_0xfb7d69[_0xab49('0x4c')],{})[_0xab49('0x27')](function(_0x2d7072){var _0x394c3f=_0xfb7d69[_0xab49('0x4d')][_0xab49('0x4e')]({'plain':!![]});if(!_0x394c3f)throw new Error(_0xab49('0x4f'));if(_0x394c3f['role']===_0xab49('0x4d')){var _0x5316ae=_0x2d7072[_0xab49('0x4e')]({'plain':!![]});var _0x49c9ad=_0xab49('0x28');return db[_0xab49('0x50')]['find']({'where':{'name':_0x49c9ad,'userProfileId':_0x394c3f[_0xab49('0x51')]},'raw':!![]})[_0xab49('0x27')](function(_0x1a5326){if(_0x1a5326&&_0x1a5326[_0xab49('0x52')]===0x0){return db[_0xab49('0x53')][_0xab49('0x4b')]({'name':_0x5316ae[_0xab49('0x2a')],'resourceId':_0x5316ae['id'],'type':_0x1a5326[_0xab49('0x2a')],'sectionId':_0x1a5326['id']},{})[_0xab49('0x27')](function(){return _0x2d7072;});}else{return _0x2d7072;}})[_0xab49('0x4a')](function(_0xceee59){logger[_0xab49('0x29')](_0xab49('0x54'),_0xceee59);throw _0xceee59;});}return _0x2d7072;})[_0xab49('0x27')](respondWithResult(_0x1ceb71,0xc9))[_0xab49('0x4a')](handleError(_0x1ceb71,null));};exports[_0xab49('0x55')]=function(_0x487e52,_0x52e66d){if(_0x487e52[_0xab49('0x4c')]['id']){delete _0x487e52[_0xab49('0x4c')]['id'];}return db[_0xab49('0x44')][_0xab49('0x49')]({'where':{'id':_0x487e52[_0xab49('0x48')]['id']}})['then'](handleEntityNotFound(_0x52e66d,null))[_0xab49('0x27')](saveUpdates(_0x487e52[_0xab49('0x4c')],null))[_0xab49('0x27')](respondWithResult(_0x52e66d,null))[_0xab49('0x4a')](handleError(_0x52e66d,null));};exports[_0xab49('0x56')]=function(_0x122850,_0x5a924b){return db[_0xab49('0x44')][_0xab49('0x49')]({'where':{'id':_0x122850[_0xab49('0x48')]['id']}})[_0xab49('0x27')](handleEntityNotFound(_0x5a924b,null))['then'](removeEntity(_0x5a924b,null))['catch'](handleError(_0x5a924b,null));};exports[_0xab49('0x57')]=function(_0x4d3629,_0x3e4c4a,_0x139705){return db[_0xab49('0x44')][_0xab49('0x49')]({'where':{'id':_0x4d3629[_0xab49('0x48')]['id']}})[_0xab49('0x27')](handleEntityNotFound(_0x3e4c4a,null))[_0xab49('0x27')](function(_0x10da44){if(_0x10da44){return _0x10da44['addUsers'](_0x4d3629[_0xab49('0x4c')][_0xab49('0x58')],_[_0xab49('0x59')](_0x4d3629[_0xab49('0x4c')],[_0xab49('0x58'),'id'])||{});}})['then'](respondWithResult(_0x3e4c4a,null))[_0xab49('0x4a')](handleError(_0x3e4c4a,null));};exports[_0xab49('0x5a')]=function(_0x88ce9b,_0x4464bd,_0x32cdf2){return db[_0xab49('0x44')][_0xab49('0x49')]({'where':{'id':_0x88ce9b[_0xab49('0x48')]['id']}})[_0xab49('0x27')](handleEntityNotFound(_0x4464bd,null))[_0xab49('0x27')](function(_0xeccf30){if(_0xeccf30){return _0xeccf30[_0xab49('0x5a')](_0x88ce9b[_0xab49('0x2f')]['ids'])[_0xab49('0x27')](function(){if(_[_0xab49('0x5b')](_0x88ce9b[_0xab49('0x2f')][_0xab49('0x58')])){for(var _0x106be9=0x0;_0x106be9<_0x88ce9b[_0xab49('0x2f')][_0xab49('0x58')][_0xab49('0x35')];_0x106be9+=0x1){socket[_0xab49('0x5c')](_0xab49('0x5d'),{'UserId':Number(_0x88ce9b['query'][_0xab49('0x58')][_0x106be9]),'SquareProjectId':Number(_0x88ce9b[_0xab49('0x48')]['id'])});}}else{socket['emit'](_0xab49('0x5d'),{'UserId':Number(_0x88ce9b[_0xab49('0x2f')][_0xab49('0x58')]),'SquareProjectId':Number(_0x88ce9b['params']['id'])});}});}})[_0xab49('0x27')](respondWithStatusCode(_0x4464bd,null))[_0xab49('0x4a')](handleError(_0x4464bd,null));};exports['getUsers']=function(_0x47b7f4,_0x425d2e,_0x376163){var _0x2acd68={};var _0x48fb06={};var _0x4c750f;var _0x148ff0;return db[_0xab49('0x44')][_0xab49('0x5e')]({'where':{'id':_0x47b7f4[_0xab49('0x48')]['id']}})[_0xab49('0x27')](handleEntityNotFound(_0x425d2e,null))[_0xab49('0x27')](function(_0x16505d){if(_0x16505d){_0x4c750f=_0x16505d;_0x48fb06[_0xab49('0x32')]=_['keys'](db['User'][_0xab49('0x2d')]);_0x48fb06[_0xab49('0x2f')]=_[_0xab49('0x30')](_0x47b7f4[_0xab49('0x2f')]);_0x48fb06[_0xab49('0x3a')]=_[_0xab49('0x31')](_0x48fb06[_0xab49('0x32')],_0x48fb06[_0xab49('0x2f')]);_0x2acd68[_0xab49('0x33')]=_[_0xab49('0x31')](_0x48fb06['model'],qs[_0xab49('0x34')](_0x47b7f4[_0xab49('0x2f')][_0xab49('0x34')]));_0x2acd68[_0xab49('0x33')]=_0x2acd68[_0xab49('0x33')][_0xab49('0x35')]?_0x2acd68[_0xab49('0x33')]:_0x48fb06[_0xab49('0x32')];_0x2acd68['order']=qs[_0xab49('0x39')](_0x47b7f4['query'][_0xab49('0x39')]);_0x2acd68[_0xab49('0x3c')]=qs[_0xab49('0x3a')](_['pick'](_0x47b7f4[_0xab49('0x2f')],_0x48fb06[_0xab49('0x3a')]));if(_0x47b7f4['query'][_0xab49('0x3b')]){_0x2acd68[_0xab49('0x3c')]=_[_0xab49('0x3d')](_0x2acd68[_0xab49('0x3c')],{'$or':_[_0xab49('0x2c')](_0x2acd68[_0xab49('0x33')],function(_0x35e5cc){var _0x324684={};_0x324684[_0x35e5cc]={'$like':'%'+_0x47b7f4[_0xab49('0x2f')][_0xab49('0x3b')]+'%'};return _0x324684;})});}_0x2acd68=_[_0xab49('0x3d')]({},_0x2acd68,_0x47b7f4[_0xab49('0x40')]);return _0x4c750f[_0xab49('0x5f')](_0x2acd68);}})['then'](function(_0x396686){if(_0x396686){_0x148ff0=_0x396686[_0xab49('0x35')];if(!_0x47b7f4[_0xab49('0x2f')]['hasOwnProperty'](_0xab49('0x37'))){_0x2acd68[_0xab49('0x23')]=qs['limit'](_0x47b7f4[_0xab49('0x2f')][_0xab49('0x23')]);_0x2acd68['offset']=qs[_0xab49('0x22')](_0x47b7f4[_0xab49('0x2f')][_0xab49('0x22')]);}return _0x4c750f[_0xab49('0x5f')](_0x2acd68);}})[_0xab49('0x27')](function(_0x451b31){if(_0x451b31){return _0x451b31?{'count':_0x148ff0,'rows':_0x451b31}:null;}})[_0xab49('0x27')](respondWithResult(_0x425d2e,null))[_0xab49('0x4a')](handleError(_0x425d2e,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 8c73c69..115cf71 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 _0x8cb5=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SquareProject'];(function(_0x37bcd8,_0x27bed9){var _0x422480=function(_0x510db3){while(--_0x510db3){_0x37bcd8['push'](_0x37bcd8['shift']());}};_0x422480(++_0x27bed9);}(_0x8cb5,0x19f));var _0x58cb=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x8cb5[_0x21a9d9];return _0x46adce;};'use strict';var EventEmitter=require(_0x58cb('0x0'));var SquareProject=require(_0x58cb('0x1'))['db'][_0x58cb('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x58cb('0x3')](0x0);var events={'afterCreate':_0x58cb('0x4'),'afterUpdate':_0x58cb('0x5'),'afterDestroy':_0x58cb('0x6')};function emitEvent(_0x66b14f){return function(_0x585b7a,_0x17b402,_0x28f599){SquareProjectEvents[_0x58cb('0x7')](_0x66b14f+':'+_0x585b7a['id'],_0x585b7a);SquareProjectEvents[_0x58cb('0x7')](_0x66b14f,_0x585b7a);_0x28f599(null);};}for(var e in events){if(events[_0x58cb('0x8')](e)){var event=events[e];SquareProject[_0x58cb('0x9')](e,emitEvent(event));}}module[_0x58cb('0xa')]=SquareProjectEvents; \ No newline at end of file +var _0x255d=['emit','hasOwnProperty','hook','exports','events','SquareProject','setMaxListeners','save','update'];(function(_0x2f4e5d,_0x48c674){var _0x17136a=function(_0x50a25b){while(--_0x50a25b){_0x2f4e5d['push'](_0x2f4e5d['shift']());}};_0x17136a(++_0x48c674);}(_0x255d,0xc1));var _0xd255=function(_0x441f16,_0x1849ae){_0x441f16=_0x441f16-0x0;var _0x1efcf0=_0x255d[_0x441f16];return _0x1efcf0;};'use strict';var EventEmitter=require(_0xd255('0x0'));var SquareProject=require('../../mysqldb')['db'][_0xd255('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xd255('0x2')](0x0);var events={'afterCreate':_0xd255('0x3'),'afterUpdate':_0xd255('0x4'),'afterDestroy':'remove'};function emitEvent(_0x34b542){return function(_0x3db2de,_0x419f45,_0x39548b){SquareProjectEvents[_0xd255('0x5')](_0x34b542+':'+_0x3db2de['id'],_0x3db2de);SquareProjectEvents[_0xd255('0x5')](_0x34b542,_0x3db2de);_0x39548b(null);};}for(var e in events){if(events[_0xd255('0x6')](e)){var event=events[e];SquareProject[_0xd255('0x7')](e,emitEvent(event));}}module[_0xd255('0x8')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 29a0349..3ec2ea1 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 _0x89cb=['define','SquareProject','square_projects','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports'];(function(_0x261040,_0x72f9ef){var _0x469f09=function(_0x429f96){while(--_0x429f96){_0x261040['push'](_0x261040['shift']());}};_0x469f09(++_0x72f9ef);}(_0x89cb,0x16b));var _0xb89c=function(_0x334444,_0x20403c){_0x334444=_0x334444-0x0;var _0x303741=_0x89cb[_0x334444];return _0x303741;};'use strict';var _=require(_0xb89c('0x0'));var util=require(_0xb89c('0x1'));var logger=require(_0xb89c('0x2'))(_0xb89c('0x3'));var moment=require(_0xb89c('0x4'));var BPromise=require(_0xb89c('0x5'));var rp=require(_0xb89c('0x6'));var fs=require('fs');var path=require(_0xb89c('0x7'));var rimraf=require(_0xb89c('0x8'));var config=require(_0xb89c('0x9'));var attributes=require(_0xb89c('0xa'));module[_0xb89c('0xb')]=function(_0x148237,_0x5662d4){return _0x148237[_0xb89c('0xc')](_0xb89c('0xd'),attributes,{'tableName':_0xb89c('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x208f=['../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x12ba49,_0x799605){var _0x259df5=function(_0x204b3a){while(--_0x204b3a){_0x12ba49['push'](_0x12ba49['shift']());}};_0x259df5(++_0x799605);}(_0x208f,0xd6));var _0xf208=function(_0x258973,_0xa768c){_0x258973=_0x258973-0x0;var _0x315ea4=_0x208f[_0x258973];return _0x315ea4;};'use strict';var _=require(_0xf208('0x0'));var util=require(_0xf208('0x1'));var logger=require('../../config/logger')(_0xf208('0x2'));var moment=require('moment');var BPromise=require(_0xf208('0x3'));var rp=require(_0xf208('0x4'));var fs=require('fs');var path=require(_0xf208('0x5'));var rimraf=require(_0xf208('0x6'));var config=require(_0xf208('0x7'));var attributes=require(_0xf208('0x8'));module[_0xf208('0x9')]=function(_0x20bcbc,_0xa3e73e){return _0x20bcbc[_0xf208('0xa')](_0xf208('0xb'),attributes,{'tableName':_0xf208('0xc'),'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 7afec7b..ea0a851 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 _0x6a29=['../../config/logger','../../config/environment','client','http','redis','defaults','socket.io-emitter','register','request','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSquareProject','options','where','attributes','include','map','model','util','ioredis','../../mysqldb','../../config/utils'];(function(_0x4fd3dd,_0x2cb2ba){var _0x23447c=function(_0x10b29c){while(--_0x10b29c){_0x4fd3dd['push'](_0x4fd3dd['shift']());}};_0x23447c(++_0x2cb2ba);}(_0x6a29,0x1bc));var _0x96a2=function(_0xe64ac0,_0x5e09ee){_0xe64ac0=_0xe64ac0-0x0;var _0x3afbdd=_0x6a29[_0xe64ac0];return _0x3afbdd;};'use strict';var _=require('lodash');var util=require(_0x96a2('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x96a2('0x1'));var db=require(_0x96a2('0x2'))['db'];var utils=require(_0x96a2('0x3'));var logger=require(_0x96a2('0x4'))('rpc');var config=require(_0x96a2('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x96a2('0x6')][_0x96a2('0x7')]({'port':0x232a});config[_0x96a2('0x8')]=_[_0x96a2('0x9')](config[_0x96a2('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x96a2('0xa'))(new Redis(config[_0x96a2('0x8')]));require('./squareProject.socket')[_0x96a2('0xb')](socket);function respondWithRpcPromise(_0x110e40,_0x21c7cd,_0xfe8cf5){return new BPromise(function(_0x4b4f6e,_0x470664){return client[_0x96a2('0xc')](_0x110e40,_0xfe8cf5)[_0x96a2('0xd')](function(_0x15a20b){logger[_0x96a2('0xe')](_0x96a2('0xf'),_0x21c7cd,_0x96a2('0x10'));logger[_0x96a2('0x11')](_0x96a2('0x12'),_0x21c7cd,_0x96a2('0x10'),JSON[_0x96a2('0x13')](_0x15a20b));if(_0x15a20b[_0x96a2('0x14')]){if(_0x15a20b[_0x96a2('0x14')][_0x96a2('0x15')]===0x1f4){logger[_0x96a2('0x14')](_0x96a2('0xf'),_0x21c7cd,_0x15a20b[_0x96a2('0x14')]['message']);return _0x470664(_0x15a20b['error']['message']);}logger['error'](_0x96a2('0xf'),_0x21c7cd,_0x15a20b['error'][_0x96a2('0x16')]);return _0x4b4f6e(_0x15a20b[_0x96a2('0x14')][_0x96a2('0x16')]);}else{logger[_0x96a2('0xe')](_0x96a2('0xf'),_0x21c7cd,_0x96a2('0x10'));_0x4b4f6e(_0x15a20b[_0x96a2('0x17')][_0x96a2('0x16')]);}})[_0x96a2('0x18')](function(_0x4af869){logger[_0x96a2('0x14')](_0x96a2('0xf'),_0x21c7cd,_0x4af869);_0x470664(_0x4af869);});});}exports[_0x96a2('0x19')]=function(_0x251e29){var _0x587eb6=this;return new Promise(function(_0x593955,_0x282987){return db['SquareProject']['find']({'raw':_0x251e29[_0x96a2('0x1a')]?_0x251e29[_0x96a2('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x251e29[_0x96a2('0x1a')]?_0x251e29[_0x96a2('0x1a')][_0x96a2('0x1b')]||null:null,'attributes':_0x251e29['options']?_0x251e29[_0x96a2('0x1a')][_0x96a2('0x1c')]||null:null,'include':_0x251e29[_0x96a2('0x1a')]?_0x251e29[_0x96a2('0x1a')][_0x96a2('0x1d')]?_[_0x96a2('0x1e')](_0x251e29[_0x96a2('0x1a')][_0x96a2('0x1d')],function(_0x2aa6aa){return{'model':db[_0x2aa6aa['model']],'as':_0x2aa6aa['as'],'attributes':_0x2aa6aa[_0x96a2('0x1c')],'include':_0x2aa6aa[_0x96a2('0x1d')]?_[_0x96a2('0x1e')](_0x2aa6aa[_0x96a2('0x1d')],function(_0x3dc22b){return{'model':db[_0x3dc22b['model']],'as':_0x3dc22b['as'],'attributes':_0x3dc22b['attributes'],'include':_0x3dc22b[_0x96a2('0x1d')]?_[_0x96a2('0x1e')](_0x3dc22b[_0x96a2('0x1d')],function(_0x50719f){return{'model':db[_0x50719f[_0x96a2('0x1f')]],'as':_0x50719f['as'],'attributes':_0x50719f[_0x96a2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x96a2('0xd')](function(_0x3f523f){logger[_0x96a2('0xe')]('ShowSquareProject',_0x251e29);logger[_0x96a2('0x11')]('ShowSquareProject',_0x251e29,JSON['stringify'](_0x3f523f));_0x593955(_0x3f523f);})[_0x96a2('0x18')](function(_0x498ac6){logger[_0x96a2('0x14')](_0x96a2('0x19'),_0x498ac6[_0x96a2('0x16')],_0x251e29);_0x282987(_0x587eb6[_0x96a2('0x14')](0x1f4,_0x498ac6[_0x96a2('0x16')]));});});}; \ No newline at end of file +var _0x318e=['SquareProject','find','options','where','include','model','map','attributes','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','jayson/promise','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','request','info','SquareProject,\x20%s,\x20%s','SquareProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowSquareProject'];(function(_0x3b8ae9,_0x1f4ca7){var _0x323422=function(_0x3026c6){while(--_0x3026c6){_0x3b8ae9['push'](_0x3b8ae9['shift']());}};_0x323422(++_0x1f4ca7);}(_0x318e,0x153));var _0xe318=function(_0x3e83ec,_0x3aa38c){_0x3e83ec=_0x3e83ec-0x0;var _0x3773ce=_0x318e[_0x3e83ec];return _0x3773ce;};'use strict';var _=require(_0xe318('0x0'));var util=require(_0xe318('0x1'));var moment=require(_0xe318('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe318('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe318('0x4'));var logger=require(_0xe318('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe318('0x6'));var client=jayson['client']['http']({'port':0x232a});config[_0xe318('0x7')]=_[_0xe318('0x8')](config['redis'],{'host':_0xe318('0x9'),'port':0x18eb});var socket=require(_0xe318('0xa'))(new Redis(config['redis']));require(_0xe318('0xb'))['register'](socket);function respondWithRpcPromise(_0x56d288,_0x4a83d2,_0x4e3f4d){return new BPromise(function(_0x268f8c,_0x563313){return client[_0xe318('0xc')](_0x56d288,_0x4e3f4d)['then'](function(_0x305511){logger[_0xe318('0xd')](_0xe318('0xe'),_0x4a83d2,'request\x20sent');logger['debug'](_0xe318('0xf'),_0x4a83d2,_0xe318('0x10'),JSON[_0xe318('0x11')](_0x305511));if(_0x305511[_0xe318('0x12')]){if(_0x305511['error'][_0xe318('0x13')]===0x1f4){logger['error'](_0xe318('0xe'),_0x4a83d2,_0x305511['error'][_0xe318('0x14')]);return _0x563313(_0x305511['error'][_0xe318('0x14')]);}logger[_0xe318('0x12')](_0xe318('0xe'),_0x4a83d2,_0x305511['error']['message']);return _0x268f8c(_0x305511[_0xe318('0x12')][_0xe318('0x14')]);}else{logger[_0xe318('0xd')](_0xe318('0xe'),_0x4a83d2,_0xe318('0x10'));_0x268f8c(_0x305511[_0xe318('0x15')][_0xe318('0x14')]);}})[_0xe318('0x16')](function(_0x2a7126){logger['error'](_0xe318('0xe'),_0x4a83d2,_0x2a7126);_0x563313(_0x2a7126);});});}exports[_0xe318('0x17')]=function(_0x100fd6){var _0x57d6d1=this;return new Promise(function(_0xc92e6,_0x4a68ed){return db[_0xe318('0x18')][_0xe318('0x19')]({'raw':_0x100fd6[_0xe318('0x1a')]?_0x100fd6[_0xe318('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x100fd6[_0xe318('0x1a')]?_0x100fd6['options'][_0xe318('0x1b')]||null:null,'attributes':_0x100fd6['options']?_0x100fd6[_0xe318('0x1a')]['attributes']||null:null,'include':_0x100fd6[_0xe318('0x1a')]?_0x100fd6['options'][_0xe318('0x1c')]?_['map'](_0x100fd6[_0xe318('0x1a')][_0xe318('0x1c')],function(_0x5d51d4){return{'model':db[_0x5d51d4[_0xe318('0x1d')]],'as':_0x5d51d4['as'],'attributes':_0x5d51d4['attributes'],'include':_0x5d51d4[_0xe318('0x1c')]?_[_0xe318('0x1e')](_0x5d51d4[_0xe318('0x1c')],function(_0x2ed69e){return{'model':db[_0x2ed69e[_0xe318('0x1d')]],'as':_0x2ed69e['as'],'attributes':_0x2ed69e['attributes'],'include':_0x2ed69e[_0xe318('0x1c')]?_[_0xe318('0x1e')](_0x2ed69e[_0xe318('0x1c')],function(_0x1d14d5){return{'model':db[_0x1d14d5[_0xe318('0x1d')]],'as':_0x1d14d5['as'],'attributes':_0x1d14d5[_0xe318('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe318('0x20')](function(_0x3f6af6){logger['info'](_0xe318('0x17'),_0x100fd6);logger['debug']('ShowSquareProject',_0x100fd6,JSON[_0xe318('0x11')](_0x3f6af6));_0xc92e6(_0x3f6af6);})[_0xe318('0x16')](function(_0x16e29d){logger[_0xe318('0x12')](_0xe318('0x17'),_0x16e29d['message'],_0x100fd6);_0x4a68ed(_0x57d6d1['error'](0x1f4,_0x16e29d[_0xe318('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index fd35482..508e7e0 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 _0x0295=['emit','removeListener','register','squareProject:','./squareProject.events','update'];(function(_0x52f408,_0x271d1c){var _0x52d63a=function(_0x26aefe){while(--_0x26aefe){_0x52f408['push'](_0x52f408['shift']());}};_0x52d63a(++_0x271d1c);}(_0x0295,0x1f0));var _0x5029=function(_0x1e0d60,_0x503460){_0x1e0d60=_0x1e0d60-0x0;var _0x5b9564=_0x0295[_0x1e0d60];return _0x5b9564;};'use strict';var SquareProjectEvents=require(_0x5029('0x0'));var events=['save','remove',_0x5029('0x1')];function createListener(_0x4f552a,_0x53c2e1){return function(_0x315589){_0x53c2e1[_0x5029('0x2')](_0x4f552a,_0x315589);};}function removeListener(_0x157a4f,_0x3d0af1){return function(){SquareProjectEvents[_0x5029('0x3')](_0x157a4f,_0x3d0af1);};}exports[_0x5029('0x4')]=function(_0x200217){for(var _0x215955=0x0,_0x5b3cd=events['length'];_0x215955<_0x5b3cd;_0x215955++){var _0x54978f=events[_0x215955];var _0x4ee867=createListener(_0x5029('0x5')+_0x54978f,_0x200217);SquareProjectEvents['on'](_0x54978f,_0x4ee867);}}; \ No newline at end of file +var _0x7c09=['save','remove','emit','removeListener','length','squareProject:'];(function(_0x150ca0,_0x1c8f2a){var _0x3ba4ec=function(_0x1159af){while(--_0x1159af){_0x150ca0['push'](_0x150ca0['shift']());}};_0x3ba4ec(++_0x1c8f2a);}(_0x7c09,0x102));var _0x97c0=function(_0x213cf1,_0x101d86){_0x213cf1=_0x213cf1-0x0;var _0x221d64=_0x7c09[_0x213cf1];return _0x221d64;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x97c0('0x0'),_0x97c0('0x1'),'update'];function createListener(_0xfbf689,_0x7d8f6f){return function(_0x2d04b9){_0x7d8f6f[_0x97c0('0x2')](_0xfbf689,_0x2d04b9);};}function removeListener(_0x12eb6d,_0x99bf54){return function(){SquareProjectEvents[_0x97c0('0x3')](_0x12eb6d,_0x99bf54);};}exports['register']=function(_0x4b2f81){for(var _0x590368=0x0,_0x46fdd9=events[_0x97c0('0x4')];_0x590368<_0x46fdd9;_0x590368++){var _0x2c19fa=events[_0x590368];var _0x109bc8=createListener(_0x97c0('0x5')+_0x2c19fa,_0x4b2f81);SquareProjectEvents['on'](_0x2c19fa,_0x109bc8);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 4dc2e67..93f662b 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 _0xe4d4=['isAuthenticated','index','show','/:id/download','download','post','put','/:id','delete','destroy','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./squareRecording.controller','get'];(function(_0x471e16,_0x24cce8){var _0x38df5f=function(_0xd91da1){while(--_0xd91da1){_0x471e16['push'](_0x471e16['shift']());}};_0x38df5f(++_0x24cce8);}(_0xe4d4,0x106));var _0x4e4d=function(_0x2057a8,_0x30d448){_0x2057a8=_0x2057a8-0x0;var _0x5dd74d=_0xe4d4[_0x2057a8];return _0x5dd74d;};'use strict';var multer=require('multer');var util=require(_0x4e4d('0x0'));var path=require(_0x4e4d('0x1'));var timeout=require(_0x4e4d('0x2'));var express=require('express');var router=express[_0x4e4d('0x3')]();var auth=require(_0x4e4d('0x4'));var interaction=require(_0x4e4d('0x5'));var config=require('../../config/environment');var controller=require(_0x4e4d('0x6'));router[_0x4e4d('0x7')]('/',auth[_0x4e4d('0x8')](),controller[_0x4e4d('0x9')]);router['get']('/:id',auth[_0x4e4d('0x8')](),controller[_0x4e4d('0xa')]);router[_0x4e4d('0x7')](_0x4e4d('0xb'),auth[_0x4e4d('0x8')](),controller[_0x4e4d('0xc')]);router[_0x4e4d('0xd')]('/',auth[_0x4e4d('0x8')](),controller['create']);router[_0x4e4d('0xe')](_0x4e4d('0xf'),auth[_0x4e4d('0x8')](),controller['update']);router[_0x4e4d('0x10')]('/:id/delete',auth[_0x4e4d('0x8')](),controller[_0x4e4d('0x11')]);module['exports']=router; \ No newline at end of file +var _0xa070=['../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','show','/:id/download','download','post','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x45bb11,_0x2a4d7a){var _0x59cf55=function(_0x4858bc){while(--_0x4858bc){_0x45bb11['push'](_0x45bb11['shift']());}};_0x59cf55(++_0x2a4d7a);}(_0xa070,0xc8));var _0x0a07=function(_0x4bc18b,_0x33ecdf){_0x4bc18b=_0x4bc18b-0x0;var _0x5e1d7e=_0xa070[_0x4bc18b];return _0x5e1d7e;};'use strict';var multer=require(_0x0a07('0x0'));var util=require(_0x0a07('0x1'));var path=require(_0x0a07('0x2'));var timeout=require(_0x0a07('0x3'));var express=require(_0x0a07('0x4'));var router=express[_0x0a07('0x5')]();var auth=require(_0x0a07('0x6'));var interaction=require(_0x0a07('0x7'));var config=require(_0x0a07('0x8'));var controller=require(_0x0a07('0x9'));router[_0x0a07('0xa')]('/',auth[_0x0a07('0xb')](),controller[_0x0a07('0xc')]);router[_0x0a07('0xa')]('/:id',auth[_0x0a07('0xb')](),controller[_0x0a07('0xd')]);router[_0x0a07('0xa')](_0x0a07('0xe'),auth['isAuthenticated'](),controller[_0x0a07('0xf')]);router[_0x0a07('0x10')]('/',auth[_0x0a07('0xb')](),controller[_0x0a07('0x11')]);router[_0x0a07('0x12')](_0x0a07('0x13'),auth[_0x0a07('0xb')](),controller[_0x0a07('0x14')]);router[_0x0a07('0x15')]('/:id/delete',auth[_0x0a07('0xb')](),controller[_0x0a07('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 52c7d63..93f7be4 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 _0x0605=['getDataValue','substring','lastIndexOf','sequelize','exports','STRING','VIRTUAL'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0605,0x1d1));var _0x5060=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x0605[_0x47a7d0];return _0xb9bd08;};'use strict';var Sequelize=require(_0x5060('0x0'));module[_0x5060('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x5060('0x2')]},'calleridname':{'type':Sequelize[_0x5060('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x5060('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x5060('0x2')]},'dnid':{'type':Sequelize[_0x5060('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x5060('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x5060('0x3')],'get':function(){var _0x1e4472='';var _0x25b718=this[_0x5060('0x4')]('savePath');if(_0x25b718){_0x1e4472=_0x25b718[_0x5060('0x5')](_0x25b718[_0x5060('0x6')]('.'));}return _0x1e4472;}}}; \ No newline at end of file +var _0x752a=['lastIndexOf','exports','STRING','VIRTUAL','getDataValue','substring'];(function(_0x10a5a4,_0x42fc70){var _0x3933d8=function(_0x2e5ae0){while(--_0x2e5ae0){_0x10a5a4['push'](_0x10a5a4['shift']());}};_0x3933d8(++_0x42fc70);}(_0x752a,0x109));var _0xa752=function(_0x335271,_0x5025f2){_0x335271=_0x335271-0x0;var _0xa9fff8=_0x752a[_0x335271];return _0xa9fff8;};'use strict';var Sequelize=require('sequelize');module[_0xa752('0x0')]={'uniqueid':{'type':Sequelize[_0xa752('0x1')]},'callerid':{'type':Sequelize[_0xa752('0x1')]},'calleridname':{'type':Sequelize[_0xa752('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xa752('0x1')]},'priority':{'type':Sequelize[_0xa752('0x1')]},'accountcode':{'type':Sequelize[_0xa752('0x1')]},'dnid':{'type':Sequelize[_0xa752('0x1')]},'projectName':{'type':Sequelize[_0xa752('0x1')]},'saveName':{'type':Sequelize[_0xa752('0x1')]},'filename':{'type':Sequelize[_0xa752('0x1')]},'savePath':{'type':Sequelize[_0xa752('0x1')]},'format':{'type':Sequelize[_0xa752('0x2')],'get':function(){var _0x421793='';var _0x7c6eb3=this[_0xa752('0x3')]('savePath');if(_0x7c6eb3){_0x421793=_0x7c6eb3[_0xa752('0x4')](_0x7c6eb3[_0xa752('0x5')]('.'));}return _0x421793;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index fd4733a..72a7a21 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 _0x4e55=['findAll','rows','catch','params','length','options','find','create','body','download','../../components/encryptor','uniqueid','savePath','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','extname','message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','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','json','count','offset','limit','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','type','VIRTUAL','SquareRecording','includeAll'];(function(_0x104a84,_0x285970){var _0x4973ff=function(_0x5064e7){while(--_0x5064e7){_0x104a84['push'](_0x104a84['shift']());}};_0x4973ff(++_0x285970);}(_0x4e55,0x14b));var _0x54e5=function(_0x1bf8f5,_0x28f62c){_0x1bf8f5=_0x1bf8f5-0x0;var _0x36a54e=_0x4e55[_0x1bf8f5];return _0x36a54e;};'use strict';var pdf=require(_0x54e5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x54e5('0x1'));var zipdir=require(_0x54e5('0x2'));var jsonpatch=require(_0x54e5('0x3'));var rp=require(_0x54e5('0x4'));var moment=require(_0x54e5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x54e5('0x6'));var util=require(_0x54e5('0x7'));var path=require('path');var sox=require(_0x54e5('0x8'));var csv=require(_0x54e5('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x54e5('0xa'));var squel=require(_0x54e5('0xb'));var crypto=require(_0x54e5('0xc'));var jsforce=require(_0x54e5('0xd'));var deskjs=require(_0x54e5('0xe'));var toCsv=require('to-csv');var querystring=require(_0x54e5('0xf'));var Papa=require(_0x54e5('0x10'));var Redis=require(_0x54e5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x54e5('0x12'));var as=require(_0x54e5('0x13'));var hardwareService=require(_0x54e5('0x14'));var logger=require(_0x54e5('0x15'))(_0x54e5('0x16'));var utils=require(_0x54e5('0x17'));var config=require('../../config/environment');var db=require(_0x54e5('0x18'))['db'];function respondWithStatusCode(_0x306873,_0x114b99){_0x114b99=_0x114b99||0xcc;return function(_0x34d208){if(_0x34d208){return _0x306873[_0x54e5('0x19')](_0x114b99);}return _0x306873[_0x54e5('0x1a')](_0x114b99)['end']();};}function respondWithResult(_0x46e28e,_0x140a8f){_0x140a8f=_0x140a8f||0xc8;return function(_0x3e0b57){if(_0x3e0b57){return _0x46e28e[_0x54e5('0x1a')](_0x140a8f)[_0x54e5('0x1b')](_0x3e0b57);}};}function respondWithFilteredResult(_0xacc803,_0x2a840e){return function(_0x5ed583){if(_0x5ed583){var _0x576e96=_0x5ed583[_0x54e5('0x1c')],_0x1d77b2=_0x2a840e[_0x54e5('0x1d')],_0x152696=_0x2a840e[_0x54e5('0x1d')]+_0x2a840e[_0x54e5('0x1e')],_0xa2058b;if(_0x152696>=_0x576e96){_0x152696=_0x576e96;_0xa2058b=0xc8;}else{_0xa2058b=0xce;}_0xacc803[_0x54e5('0x1a')](_0xa2058b);return _0xacc803[_0x54e5('0x1f')]('Content-Range',_0x1d77b2+'-'+_0x152696+'/'+_0x576e96)[_0x54e5('0x1b')](_0x5ed583);}return null;};}function patchUpdates(_0x54072e){return function(_0x57ba80){try{jsonpatch[_0x54e5('0x20')](_0x57ba80,_0x54072e,!![]);}catch(_0x4819f8){return BPromise[_0x54e5('0x21')](_0x4819f8);}return _0x57ba80[_0x54e5('0x22')]();};}function saveUpdates(_0xbb0e10,_0x2902cc){return function(_0x4025fa){if(_0x4025fa){return _0x4025fa[_0x54e5('0x23')](_0xbb0e10)[_0x54e5('0x24')](function(_0x5bcfdd){return _0x5bcfdd;});}return null;};}function removeEntity(_0x2805b1,_0x5efef0){return function(_0x54a844){if(_0x54a844){return _0x54a844[_0x54e5('0x25')]()[_0x54e5('0x24')](function(){_0x2805b1[_0x54e5('0x1a')](0xcc)[_0x54e5('0x26')]();});}};}function handleEntityNotFound(_0x51aae8,_0x5bf5b1){return function(_0x8c814f){if(!_0x8c814f){_0x51aae8[_0x54e5('0x19')](0x194);}return _0x8c814f;};}function handleError(_0x278d6c,_0x55d068){_0x55d068=_0x55d068||0x1f4;return function(_0x713ca3){logger[_0x54e5('0x27')](_0x713ca3[_0x54e5('0x28')]);if(_0x713ca3[_0x54e5('0x29')]){delete _0x713ca3[_0x54e5('0x29')];}_0x278d6c[_0x54e5('0x1a')](_0x55d068)[_0x54e5('0x2a')](_0x713ca3);};}exports[_0x54e5('0x2b')]=function(_0x7977a2,_0x1bf166){var _0x2b4ab0={},_0x484870={},_0x3f5882={'count':0x0,'rows':[]};var _0x2fcfb3=_[_0x54e5('0x2c')](db['SquareRecording'][_0x54e5('0x2d')],function(_0x4b920c){return{'name':_0x4b920c[_0x54e5('0x2e')],'type':_0x4b920c['type'][_0x54e5('0x2f')]};});_0x484870[_0x54e5('0x30')]=_[_0x54e5('0x2c')](_0x2fcfb3,_0x54e5('0x29'));_0x484870[_0x54e5('0x31')]=_[_0x54e5('0x32')](_0x7977a2[_0x54e5('0x31')]);_0x484870[_0x54e5('0x33')]=_[_0x54e5('0x34')](_0x484870['model'],_0x484870['query']);_0x2b4ab0[_0x54e5('0x35')]=_['intersection'](_0x484870[_0x54e5('0x30')],qs['fields'](_0x7977a2[_0x54e5('0x31')][_0x54e5('0x36')]));_0x2b4ab0[_0x54e5('0x35')]=_0x2b4ab0[_0x54e5('0x35')]['length']?_0x2b4ab0[_0x54e5('0x35')]:_0x484870[_0x54e5('0x30')];if(!_0x7977a2[_0x54e5('0x31')]['hasOwnProperty'](_0x54e5('0x37'))){_0x2b4ab0['limit']=qs[_0x54e5('0x1e')](_0x7977a2[_0x54e5('0x31')][_0x54e5('0x1e')]);_0x2b4ab0[_0x54e5('0x1d')]=qs[_0x54e5('0x1d')](_0x7977a2[_0x54e5('0x31')][_0x54e5('0x1d')]);}_0x2b4ab0[_0x54e5('0x38')]=qs[_0x54e5('0x39')](_0x7977a2[_0x54e5('0x31')]['sort']);_0x2b4ab0[_0x54e5('0x3a')]=qs[_0x54e5('0x33')](_['pick'](_0x7977a2[_0x54e5('0x31')],_0x484870[_0x54e5('0x33')]));if(_0x7977a2['query'][_0x54e5('0x3b')]){_0x2b4ab0['where']=_[_0x54e5('0x3c')](_0x2b4ab0[_0x54e5('0x3a')],{'$or':_[_0x54e5('0x2c')](_0x2fcfb3,function(_0x5a6927){if(_0x5a6927[_0x54e5('0x3d')]!==_0x54e5('0x3e')){var _0x115c8b={};_0x115c8b[_0x5a6927[_0x54e5('0x29')]]={'$like':'%'+_0x7977a2[_0x54e5('0x31')]['filter']+'%'};return _0x115c8b;}})});}_0x2b4ab0=_[_0x54e5('0x3c')]({},_0x2b4ab0,_0x7977a2['options']);var _0x1a7ba9={'where':_0x2b4ab0[_0x54e5('0x3a')]};return db[_0x54e5('0x3f')][_0x54e5('0x1c')](_0x1a7ba9)[_0x54e5('0x24')](function(_0x4c9a18){_0x3f5882['count']=_0x4c9a18;if(_0x7977a2[_0x54e5('0x31')][_0x54e5('0x40')]){_0x2b4ab0['include']=[{'all':!![]}];}return db[_0x54e5('0x3f')][_0x54e5('0x41')](_0x2b4ab0);})[_0x54e5('0x24')](function(_0xbc4575){_0x3f5882[_0x54e5('0x42')]=_0xbc4575;return _0x3f5882;})[_0x54e5('0x24')](respondWithFilteredResult(_0x1bf166,_0x2b4ab0))[_0x54e5('0x43')](handleError(_0x1bf166,null));};exports['show']=function(_0x143a1a,_0x3cc23b){var _0x10767e={'raw':!![],'where':{'id':_0x143a1a[_0x54e5('0x44')]['id']}},_0x308635={};_0x308635[_0x54e5('0x30')]=_[_0x54e5('0x32')](db[_0x54e5('0x3f')]['rawAttributes']);_0x308635[_0x54e5('0x31')]=_[_0x54e5('0x32')](_0x143a1a['query']);_0x308635[_0x54e5('0x33')]=_[_0x54e5('0x34')](_0x308635[_0x54e5('0x30')],_0x308635[_0x54e5('0x31')]);_0x10767e[_0x54e5('0x35')]=_[_0x54e5('0x34')](_0x308635[_0x54e5('0x30')],qs['fields'](_0x143a1a['query'][_0x54e5('0x36')]));_0x10767e['attributes']=_0x10767e[_0x54e5('0x35')][_0x54e5('0x45')]?_0x10767e[_0x54e5('0x35')]:_0x308635[_0x54e5('0x30')];if(_0x143a1a[_0x54e5('0x31')][_0x54e5('0x40')]){_0x10767e['include']=[{'all':!![]}];}_0x10767e=_[_0x54e5('0x3c')]({},_0x10767e,_0x143a1a[_0x54e5('0x46')]);return db[_0x54e5('0x3f')][_0x54e5('0x47')](_0x10767e)[_0x54e5('0x24')](handleEntityNotFound(_0x3cc23b,null))[_0x54e5('0x24')](respondWithResult(_0x3cc23b,null))['catch'](handleError(_0x3cc23b,null));};exports[_0x54e5('0x48')]=function(_0x5130f2,_0x17bcda){return db[_0x54e5('0x3f')]['create'](_0x5130f2[_0x54e5('0x49')],{})['then'](respondWithResult(_0x17bcda,0xc9))['catch'](handleError(_0x17bcda,null));};exports[_0x54e5('0x23')]=function(_0x3ba9c3,_0x3954ac){if(_0x3ba9c3['body']['id']){delete _0x3ba9c3[_0x54e5('0x49')]['id'];}return db['SquareRecording'][_0x54e5('0x47')]({'where':{'id':_0x3ba9c3[_0x54e5('0x44')]['id']}})[_0x54e5('0x24')](handleEntityNotFound(_0x3954ac,null))[_0x54e5('0x24')](saveUpdates(_0x3ba9c3[_0x54e5('0x49')],null))[_0x54e5('0x24')](respondWithResult(_0x3954ac,null))[_0x54e5('0x43')](handleError(_0x3954ac,null));};exports[_0x54e5('0x4a')]=function(_0xa44f1b,_0x536bf9,_0x2a71d6){var _0x4ec484=require(_0x54e5('0x4b'));var _0x53cc2d=![];var _0x2e688e={};if(_0xa44f1b[_0x54e5('0x31')]['type']&&_0xa44f1b[_0x54e5('0x31')][_0x54e5('0x3d')]===_0x54e5('0x4c')){_0x2e688e[_0x54e5('0x4c')]=_0xa44f1b[_0x54e5('0x44')]['id'];}else{_0x2e688e['id']=_0xa44f1b['params']['id'];}return db['SquareRecording']['find']({'where':_0x2e688e,'attributes':['id','savePath','filename'],'raw':!![]})['then'](handleEntityNotFound(_0x536bf9,null))['then'](function(_0xf8265b){if(_0xf8265b){var _0x1d9e48=_0xf8265b[_0x54e5('0x4d')];var _0x53866e=util[_0x54e5('0x4e')](_0x54e5('0x4f'),_0x1d9e48);if(fs[_0x54e5('0x50')](_0x53866e)){_0x53cc2d=!![];return _0x4ec484[_0x54e5('0x51')](_0x53866e,_0x1d9e48,config[_0x54e5('0x52')][_0x54e5('0x53')])[_0x54e5('0x24')](function(){return _0xf8265b;});}return _0xf8265b;}})['then'](function(_0x844e05){if(_0x844e05){var _0x1792a8=_0x844e05[_0x54e5('0x4d')];if(!fs['existsSync'](_0x1792a8)){throw new db[(_0x54e5('0x54'))][(_0x54e5('0x55'))](_0x54e5('0x56'));}if(_0x844e05[_0x54e5('0x57')]){return _0x536bf9['download'](_0x1792a8,_0x844e05[_0x54e5('0x57')]+path[_0x54e5('0x58')](_0x1792a8),function(){if(_0x53cc2d){fs['unlink'](_0x1792a8);}});}else{return _0x536bf9[_0x54e5('0x4a')](_0x1792a8,function(_0x1dca00){if(_0x53cc2d){fs['unlink'](_0x1792a8);}});}}})[_0x54e5('0x43')](function(_0x484a67){if(_0x484a67[_0x54e5('0x59')]===_0x54e5('0x56')){_0x536bf9[_0x54e5('0x1a')](0x194)[_0x54e5('0x2a')](_0x54e5('0x5a'));}else{return handleError(_0x536bf9,null);}});};exports[_0x54e5('0x25')]=function(_0x31c77d,_0x528287){return db[_0x54e5('0x3f')][_0x54e5('0x47')]({'where':{'id':_0x31c77d[_0x54e5('0x44')]['id']}})[_0x54e5('0x24')](function(_0x6116c4){if(!_0x6116c4)throw new ReferenceError(_0x54e5('0x5b'));return _0x6116c4;})['then'](function(_0x4b7039){var _0x198bb0=_0x4b7039['savePath'];logger[_0x54e5('0x5c')](_0x54e5('0x5d'),_0x198bb0);if(!_[_0x54e5('0x5e')](_0x4b7039[_0x54e5('0x4d')])&&fs['existsSync'](_0x198bb0)){logger[_0x54e5('0x5c')](_0x54e5('0x5f')+_0x198bb0+_0x54e5('0x60'));fs[_0x54e5('0x61')](_0x198bb0);}_0x198bb0=_0x198bb0+_0x54e5('0x62');if(!_[_0x54e5('0x5e')](_0x4b7039[_0x54e5('0x4d')])&&fs['existsSync'](_0x198bb0)){logger[_0x54e5('0x5c')](_0x54e5('0x5f')+_0x198bb0+_0x54e5('0x60'));fs[_0x54e5('0x61')](_0x198bb0);}return _0x4b7039;})['then'](function(_0x5ba003){if(!_0x5ba003)throw new InternalError();return _0x5ba003[_0x54e5('0x25')]();})[_0x54e5('0x24')](function(){_0x528287[_0x54e5('0x1a')](0xcc)['end']();})[_0x54e5('0x43')](handleError(_0x528287,null));}; \ No newline at end of file +var _0xe654=['sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','status','end','json','offset','limit','apply','update','then','destroy','sendStatus','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','count','includeAll','include','rows','catch','show','params','find','create','body','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','SquareRecording\x20not\x20found','unlink','message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path'];(function(_0x13e197,_0x21b487){var _0x187cdc=function(_0x1634b7){while(--_0x1634b7){_0x13e197['push'](_0x13e197['shift']());}};_0x187cdc(++_0x21b487);}(_0xe654,0x1d7));var _0x4e65=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xe654[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require(_0x4e65('0x0'));var emlformat=require(_0x4e65('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4e65('0x2'));var jsonpatch=require(_0x4e65('0x3'));var rp=require(_0x4e65('0x4'));var moment=require('moment');var BPromise=require(_0x4e65('0x5'));var Mustache=require(_0x4e65('0x6'));var util=require(_0x4e65('0x7'));var path=require(_0x4e65('0x8'));var sox=require(_0x4e65('0x9'));var csv=require(_0x4e65('0xa'));var ejs=require(_0x4e65('0xb'));var fs=require('fs');var _=require(_0x4e65('0xc'));var squel=require('squel');var crypto=require(_0x4e65('0xd'));var jsforce=require(_0x4e65('0xe'));var deskjs=require(_0x4e65('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4e65('0x10'));var Redis=require('ioredis');var authService=require(_0x4e65('0x11'));var qs=require(_0x4e65('0x12'));var as=require(_0x4e65('0x13'));var hardwareService=require(_0x4e65('0x14'));var logger=require('../../config/logger')(_0x4e65('0x15'));var utils=require('../../config/utils');var config=require(_0x4e65('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa60886,_0x3fb948){_0x3fb948=_0x3fb948||0xcc;return function(_0x585165){if(_0x585165){return _0xa60886['sendStatus'](_0x3fb948);}return _0xa60886[_0x4e65('0x17')](_0x3fb948)[_0x4e65('0x18')]();};}function respondWithResult(_0x264901,_0x3312f4){_0x3312f4=_0x3312f4||0xc8;return function(_0x46bb3a){if(_0x46bb3a){return _0x264901[_0x4e65('0x17')](_0x3312f4)[_0x4e65('0x19')](_0x46bb3a);}};}function respondWithFilteredResult(_0x196999,_0x567c4d){return function(_0x508d32){if(_0x508d32){var _0x50b64d=_0x508d32['count'],_0x4cf2f9=_0x567c4d[_0x4e65('0x1a')],_0x56c865=_0x567c4d[_0x4e65('0x1a')]+_0x567c4d[_0x4e65('0x1b')],_0x860682;if(_0x56c865>=_0x50b64d){_0x56c865=_0x50b64d;_0x860682=0xc8;}else{_0x860682=0xce;}_0x196999[_0x4e65('0x17')](_0x860682);return _0x196999['set']('Content-Range',_0x4cf2f9+'-'+_0x56c865+'/'+_0x50b64d)[_0x4e65('0x19')](_0x508d32);}return null;};}function patchUpdates(_0x35d54){return function(_0x393e4b){try{jsonpatch[_0x4e65('0x1c')](_0x393e4b,_0x35d54,!![]);}catch(_0x3bd9f8){return BPromise['reject'](_0x3bd9f8);}return _0x393e4b['save']();};}function saveUpdates(_0x3588ac,_0x418f60){return function(_0x327d22){if(_0x327d22){return _0x327d22[_0x4e65('0x1d')](_0x3588ac)[_0x4e65('0x1e')](function(_0x5273cd){return _0x5273cd;});}return null;};}function removeEntity(_0x211c7f,_0xa023e0){return function(_0x40f38f){if(_0x40f38f){return _0x40f38f[_0x4e65('0x1f')]()[_0x4e65('0x1e')](function(){_0x211c7f[_0x4e65('0x17')](0xcc)[_0x4e65('0x18')]();});}};}function handleEntityNotFound(_0x220756,_0x99481e){return function(_0x2b0e2b){if(!_0x2b0e2b){_0x220756[_0x4e65('0x20')](0x194);}return _0x2b0e2b;};}function handleError(_0x183f97,_0x59ac62){_0x59ac62=_0x59ac62||0x1f4;return function(_0x2054c7){logger[_0x4e65('0x21')](_0x2054c7[_0x4e65('0x22')]);if(_0x2054c7[_0x4e65('0x23')]){delete _0x2054c7['name'];}_0x183f97['status'](_0x59ac62)[_0x4e65('0x24')](_0x2054c7);};}exports[_0x4e65('0x25')]=function(_0x5ea412,_0x41aca0){var _0x4bdea0={},_0x187338={},_0x195c44={'count':0x0,'rows':[]};var _0xde26f6=_[_0x4e65('0x26')](db[_0x4e65('0x27')][_0x4e65('0x28')],function(_0x2834d4){return{'name':_0x2834d4[_0x4e65('0x29')],'type':_0x2834d4[_0x4e65('0x2a')][_0x4e65('0x2b')]};});_0x187338[_0x4e65('0x2c')]=_[_0x4e65('0x26')](_0xde26f6,_0x4e65('0x23'));_0x187338['query']=_[_0x4e65('0x2d')](_0x5ea412[_0x4e65('0x2e')]);_0x187338['filters']=_[_0x4e65('0x2f')](_0x187338[_0x4e65('0x2c')],_0x187338['query']);_0x4bdea0[_0x4e65('0x30')]=_['intersection'](_0x187338[_0x4e65('0x2c')],qs[_0x4e65('0x31')](_0x5ea412[_0x4e65('0x2e')][_0x4e65('0x31')]));_0x4bdea0['attributes']=_0x4bdea0[_0x4e65('0x30')][_0x4e65('0x32')]?_0x4bdea0[_0x4e65('0x30')]:_0x187338[_0x4e65('0x2c')];if(!_0x5ea412['query'][_0x4e65('0x33')](_0x4e65('0x34'))){_0x4bdea0[_0x4e65('0x1b')]=qs[_0x4e65('0x1b')](_0x5ea412['query'][_0x4e65('0x1b')]);_0x4bdea0['offset']=qs[_0x4e65('0x1a')](_0x5ea412[_0x4e65('0x2e')][_0x4e65('0x1a')]);}_0x4bdea0[_0x4e65('0x35')]=qs[_0x4e65('0x36')](_0x5ea412[_0x4e65('0x2e')][_0x4e65('0x36')]);_0x4bdea0[_0x4e65('0x37')]=qs['filters'](_[_0x4e65('0x38')](_0x5ea412[_0x4e65('0x2e')],_0x187338[_0x4e65('0x39')]));if(_0x5ea412[_0x4e65('0x2e')][_0x4e65('0x3a')]){_0x4bdea0[_0x4e65('0x37')]=_['merge'](_0x4bdea0[_0x4e65('0x37')],{'$or':_[_0x4e65('0x26')](_0xde26f6,function(_0x1a186b){if(_0x1a186b[_0x4e65('0x2a')]!==_0x4e65('0x3b')){var _0x1c8c41={};_0x1c8c41[_0x1a186b[_0x4e65('0x23')]]={'$like':'%'+_0x5ea412[_0x4e65('0x2e')]['filter']+'%'};return _0x1c8c41;}})});}_0x4bdea0=_[_0x4e65('0x3c')]({},_0x4bdea0,_0x5ea412[_0x4e65('0x3d')]);var _0x41142c={'where':_0x4bdea0['where']};return db[_0x4e65('0x27')][_0x4e65('0x3e')](_0x41142c)[_0x4e65('0x1e')](function(_0x2c622f){_0x195c44[_0x4e65('0x3e')]=_0x2c622f;if(_0x5ea412[_0x4e65('0x2e')][_0x4e65('0x3f')]){_0x4bdea0[_0x4e65('0x40')]=[{'all':!![]}];}return db[_0x4e65('0x27')]['findAll'](_0x4bdea0);})['then'](function(_0x29b19e){_0x195c44[_0x4e65('0x41')]=_0x29b19e;return _0x195c44;})['then'](respondWithFilteredResult(_0x41aca0,_0x4bdea0))[_0x4e65('0x42')](handleError(_0x41aca0,null));};exports[_0x4e65('0x43')]=function(_0x189ca3,_0x533b2c){var _0x433640={'raw':!![],'where':{'id':_0x189ca3[_0x4e65('0x44')]['id']}},_0x2bd5ae={};_0x2bd5ae[_0x4e65('0x2c')]=_['keys'](db[_0x4e65('0x27')]['rawAttributes']);_0x2bd5ae[_0x4e65('0x2e')]=_[_0x4e65('0x2d')](_0x189ca3[_0x4e65('0x2e')]);_0x2bd5ae[_0x4e65('0x39')]=_[_0x4e65('0x2f')](_0x2bd5ae[_0x4e65('0x2c')],_0x2bd5ae[_0x4e65('0x2e')]);_0x433640[_0x4e65('0x30')]=_[_0x4e65('0x2f')](_0x2bd5ae['model'],qs[_0x4e65('0x31')](_0x189ca3[_0x4e65('0x2e')]['fields']));_0x433640[_0x4e65('0x30')]=_0x433640[_0x4e65('0x30')][_0x4e65('0x32')]?_0x433640[_0x4e65('0x30')]:_0x2bd5ae[_0x4e65('0x2c')];if(_0x189ca3[_0x4e65('0x2e')][_0x4e65('0x3f')]){_0x433640['include']=[{'all':!![]}];}_0x433640=_[_0x4e65('0x3c')]({},_0x433640,_0x189ca3['options']);return db[_0x4e65('0x27')][_0x4e65('0x45')](_0x433640)[_0x4e65('0x1e')](handleEntityNotFound(_0x533b2c,null))[_0x4e65('0x1e')](respondWithResult(_0x533b2c,null))[_0x4e65('0x42')](handleError(_0x533b2c,null));};exports[_0x4e65('0x46')]=function(_0x363810,_0x47bc91){return db[_0x4e65('0x27')][_0x4e65('0x46')](_0x363810['body'],{})[_0x4e65('0x1e')](respondWithResult(_0x47bc91,0xc9))[_0x4e65('0x42')](handleError(_0x47bc91,null));};exports[_0x4e65('0x1d')]=function(_0x4dde3f,_0x48d8ab){if(_0x4dde3f[_0x4e65('0x47')]['id']){delete _0x4dde3f[_0x4e65('0x47')]['id'];}return db[_0x4e65('0x27')]['find']({'where':{'id':_0x4dde3f[_0x4e65('0x44')]['id']}})[_0x4e65('0x1e')](handleEntityNotFound(_0x48d8ab,null))['then'](saveUpdates(_0x4dde3f[_0x4e65('0x47')],null))[_0x4e65('0x1e')](respondWithResult(_0x48d8ab,null))[_0x4e65('0x42')](handleError(_0x48d8ab,null));};exports[_0x4e65('0x48')]=function(_0x27c988,_0x1bd810,_0x3b0b47){var _0x3699ee=require(_0x4e65('0x49'));var _0x759699=![];var _0xfb5176={};if(_0x27c988[_0x4e65('0x2e')][_0x4e65('0x2a')]&&_0x27c988['query']['type']===_0x4e65('0x4a')){_0xfb5176['uniqueid']=_0x27c988['params']['id'];}else{_0xfb5176['id']=_0x27c988[_0x4e65('0x44')]['id'];}return db[_0x4e65('0x27')]['find']({'where':_0xfb5176,'attributes':['id',_0x4e65('0x4b'),_0x4e65('0x4c')],'raw':!![]})[_0x4e65('0x1e')](handleEntityNotFound(_0x1bd810,null))[_0x4e65('0x1e')](function(_0x41701b){if(_0x41701b){var _0x10c197=_0x41701b['savePath'];var _0x291e34=util[_0x4e65('0x4d')](_0x4e65('0x4e'),_0x10c197);if(fs[_0x4e65('0x4f')](_0x291e34)){_0x759699=!![];return _0x3699ee[_0x4e65('0x50')](_0x291e34,_0x10c197,config[_0x4e65('0x51')][_0x4e65('0x52')])[_0x4e65('0x1e')](function(){return _0x41701b;});}return _0x41701b;}})['then'](function(_0x3ddb81){if(_0x3ddb81){var _0x429e18=_0x3ddb81[_0x4e65('0x4b')];if(!fs[_0x4e65('0x4f')](_0x429e18)){throw new db['Sequelize'][(_0x4e65('0x53'))](_0x4e65('0x54'));}if(_0x3ddb81[_0x4e65('0x4c')]){return _0x1bd810[_0x4e65('0x48')](_0x429e18,_0x3ddb81[_0x4e65('0x4c')]+path['extname'](_0x429e18),function(){if(_0x759699){fs[_0x4e65('0x55')](_0x429e18);}});}else{return _0x1bd810[_0x4e65('0x48')](_0x429e18,function(_0x330d86){if(_0x759699){fs[_0x4e65('0x55')](_0x429e18);}});}}})[_0x4e65('0x42')](function(_0x144782){if(_0x144782[_0x4e65('0x56')]===_0x4e65('0x54')){_0x1bd810['status'](0x194)['send'](_0x4e65('0x57'));}else{return handleError(_0x1bd810,null);}});};exports[_0x4e65('0x1f')]=function(_0x48f8c7,_0x28398d){return db[_0x4e65('0x27')][_0x4e65('0x45')]({'where':{'id':_0x48f8c7[_0x4e65('0x44')]['id']}})[_0x4e65('0x1e')](function(_0x22be42){if(!_0x22be42)throw new ReferenceError(_0x4e65('0x58'));return _0x22be42;})[_0x4e65('0x1e')](function(_0x5c782f){var _0x2cda8f=_0x5c782f[_0x4e65('0x4b')];logger[_0x4e65('0x59')](_0x4e65('0x5a'),_0x2cda8f);if(!_[_0x4e65('0x5b')](_0x5c782f['savePath'])&&fs['existsSync'](_0x2cda8f)){logger[_0x4e65('0x59')](_0x4e65('0x5c')+_0x2cda8f+_0x4e65('0x5d'));fs[_0x4e65('0x5e')](_0x2cda8f);}_0x2cda8f=_0x2cda8f+_0x4e65('0x5f');if(!_[_0x4e65('0x5b')](_0x5c782f[_0x4e65('0x4b')])&&fs['existsSync'](_0x2cda8f)){logger[_0x4e65('0x59')](_0x4e65('0x5c')+_0x2cda8f+_0x4e65('0x5d'));fs['unlinkSync'](_0x2cda8f);}return _0x5c782f;})['then'](function(_0x2f1926){if(!_0x2f1926)throw new InternalError();return _0x2f1926['destroy']();})[_0x4e65('0x1e')](function(){_0x28398d[_0x4e65('0x17')](0xcc)[_0x4e65('0x18')]();})['catch'](handleError(_0x28398d,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 0675b8a..0bc075c 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 _0x14a0=['../../config/logger','api','moment','bluebird','request-promise','path','./squareRecording.attributes','exports','SquareRecording','square_recordings','util'];(function(_0x7f3ffa,_0xaed5ee){var _0x593cc5=function(_0x58dcf5){while(--_0x58dcf5){_0x7f3ffa['push'](_0x7f3ffa['shift']());}};_0x593cc5(++_0xaed5ee);}(_0x14a0,0x8e));var _0x014a=function(_0xee5d2a,_0x534134){_0xee5d2a=_0xee5d2a-0x0;var _0x346948=_0x14a0[_0xee5d2a];return _0x346948;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var logger=require(_0x014a('0x1'))(_0x014a('0x2'));var moment=require(_0x014a('0x3'));var BPromise=require(_0x014a('0x4'));var rp=require(_0x014a('0x5'));var fs=require('fs');var path=require(_0x014a('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x014a('0x7'));module[_0x014a('0x8')]=function(_0x38a22c,_0x5ec84d){return _0x38a22c['define'](_0x014a('0x9'),attributes,{'tableName':_0x014a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3266=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./squareRecording.attributes','define','square_recordings','lodash','util'];(function(_0x44f6fe,_0x4a1864){var _0x28cf00=function(_0x15396d){while(--_0x15396d){_0x44f6fe['push'](_0x44f6fe['shift']());}};_0x28cf00(++_0x4a1864);}(_0x3266,0x6a));var _0x6326=function(_0x14fad0,_0x278d75){_0x14fad0=_0x14fad0-0x0;var _0x5c665f=_0x3266[_0x14fad0];return _0x5c665f;};'use strict';var _=require(_0x6326('0x0'));var util=require(_0x6326('0x1'));var logger=require(_0x6326('0x2'))(_0x6326('0x3'));var moment=require(_0x6326('0x4'));var BPromise=require(_0x6326('0x5'));var rp=require(_0x6326('0x6'));var fs=require('fs');var path=require(_0x6326('0x7'));var rimraf=require(_0x6326('0x8'));var config=require('../../config/environment');var attributes=require(_0x6326('0x9'));module['exports']=function(_0x25ecd8,_0x44460c){return _0x25ecd8[_0x6326('0xa')]('SquareRecording',attributes,{'tableName':_0x6326('0xb'),'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 0613263..f375750 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 _0x238a=['rpc','client','http','request','info','debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SquareRecording,\x20%s,\x20%s','result','catch','CreateSquareRecording','SquareRecording','body','options','raw','then','lodash','util','moment','ioredis','../../mysqldb','../../config/logger'];(function(_0x1f7367,_0x31fd7c){var _0x54349d=function(_0x28925f){while(--_0x28925f){_0x1f7367['push'](_0x1f7367['shift']());}};_0x54349d(++_0x31fd7c);}(_0x238a,0x81));var _0xa238=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0x238a[_0xd09668];return _0x68726;};'use strict';var _=require(_0xa238('0x0'));var util=require(_0xa238('0x1'));var moment=require(_0xa238('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa238('0x3'));var db=require(_0xa238('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa238('0x5'))(_0xa238('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa238('0x7')][_0xa238('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33090f,_0x4d5b13,_0x302b80){return new BPromise(function(_0x856a31,_0x37b998){return client[_0xa238('0x9')](_0x33090f,_0x302b80)['then'](function(_0x1a3a94){logger[_0xa238('0xa')]('SquareRecording,\x20%s,\x20%s',_0x4d5b13,'request\x20sent');logger[_0xa238('0xb')](_0xa238('0xc'),_0x4d5b13,_0xa238('0xd'),JSON[_0xa238('0xe')](_0x1a3a94));if(_0x1a3a94[_0xa238('0xf')]){if(_0x1a3a94[_0xa238('0xf')][_0xa238('0x10')]===0x1f4){logger['error']('SquareRecording,\x20%s,\x20%s',_0x4d5b13,_0x1a3a94['error'][_0xa238('0x11')]);return _0x37b998(_0x1a3a94['error']['message']);}logger[_0xa238('0xf')](_0xa238('0x12'),_0x4d5b13,_0x1a3a94[_0xa238('0xf')]['message']);return _0x856a31(_0x1a3a94[_0xa238('0xf')][_0xa238('0x11')]);}else{logger['info'](_0xa238('0x12'),_0x4d5b13,_0xa238('0xd'));_0x856a31(_0x1a3a94[_0xa238('0x13')]['message']);}})[_0xa238('0x14')](function(_0x797731){logger[_0xa238('0xf')](_0xa238('0x12'),_0x4d5b13,_0x797731);_0x37b998(_0x797731);});});}exports[_0xa238('0x15')]=function(_0x4b078a){var _0x25385d=this;return new Promise(function(_0x2b3d58,_0x4530ac){return db[_0xa238('0x16')]['create'](_0x4b078a[_0xa238('0x17')],{'raw':_0x4b078a[_0xa238('0x18')]?_0x4b078a[_0xa238('0x18')][_0xa238('0x19')]===undefined?!![]:![]:!![]})[_0xa238('0x1a')](function(_0x413923){logger[_0xa238('0xa')](_0xa238('0x15'),_0x4b078a);logger[_0xa238('0xb')](_0xa238('0x15'),_0x4b078a,JSON['stringify'](_0x413923));_0x2b3d58(_0x413923);})[_0xa238('0x14')](function(_0x393683){logger[_0xa238('0xf')]('CreateSquareRecording',_0x393683[_0xa238('0x11')],_0x4b078a);_0x4530ac(_0x25385d['error'](0x1f4,_0x393683[_0xa238('0x11')]));});});}; \ No newline at end of file +var _0x03d8=['http','request','then','info','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareRecording','SquareRecording','create','options','raw','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client'];(function(_0x1e6e4e,_0x2b1b09){var _0x3d746b=function(_0x4483dd){while(--_0x4483dd){_0x1e6e4e['push'](_0x1e6e4e['shift']());}};_0x3d746b(++_0x2b1b09);}(_0x03d8,0x1ed));var _0x803d=function(_0x68cae0,_0x7d78cd){_0x68cae0=_0x68cae0-0x0;var _0x5e7200=_0x03d8[_0x68cae0];return _0x5e7200;};'use strict';var _=require(_0x803d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x803d('0x1'));var fs=require('fs');var Redis=require(_0x803d('0x2'));var db=require(_0x803d('0x3'))['db'];var utils=require(_0x803d('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x803d('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x803d('0x6')][_0x803d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x950934,_0x2bf82f,_0x4ff3ac){return new BPromise(function(_0xd6cfc,_0x21d920){return client[_0x803d('0x8')](_0x950934,_0x4ff3ac)[_0x803d('0x9')](function(_0x2bdbfd){logger[_0x803d('0xa')](_0x803d('0xb'),_0x2bf82f,'request\x20sent');logger[_0x803d('0xc')](_0x803d('0xd'),_0x2bf82f,'request\x20sent',JSON[_0x803d('0xe')](_0x2bdbfd));if(_0x2bdbfd[_0x803d('0xf')]){if(_0x2bdbfd[_0x803d('0xf')][_0x803d('0x10')]===0x1f4){logger[_0x803d('0xf')](_0x803d('0xb'),_0x2bf82f,_0x2bdbfd[_0x803d('0xf')][_0x803d('0x11')]);return _0x21d920(_0x2bdbfd[_0x803d('0xf')]['message']);}logger[_0x803d('0xf')](_0x803d('0xb'),_0x2bf82f,_0x2bdbfd[_0x803d('0xf')][_0x803d('0x11')]);return _0xd6cfc(_0x2bdbfd[_0x803d('0xf')][_0x803d('0x11')]);}else{logger[_0x803d('0xa')]('SquareRecording,\x20%s,\x20%s',_0x2bf82f,'request\x20sent');_0xd6cfc(_0x2bdbfd[_0x803d('0x12')][_0x803d('0x11')]);}})[_0x803d('0x13')](function(_0x5ec2de){logger[_0x803d('0xf')](_0x803d('0xb'),_0x2bf82f,_0x5ec2de);_0x21d920(_0x5ec2de);});});}exports[_0x803d('0x14')]=function(_0x37fbcd){var _0x4b0456=this;return new Promise(function(_0x558f2b,_0x32740a){return db[_0x803d('0x15')][_0x803d('0x16')](_0x37fbcd['body'],{'raw':_0x37fbcd[_0x803d('0x17')]?_0x37fbcd[_0x803d('0x17')][_0x803d('0x18')]===undefined?!![]:![]:!![]})[_0x803d('0x9')](function(_0x14c18d){logger['info']('CreateSquareRecording',_0x37fbcd);logger[_0x803d('0xc')](_0x803d('0x14'),_0x37fbcd,JSON[_0x803d('0xe')](_0x14c18d));_0x558f2b(_0x14c18d);})[_0x803d('0x13')](function(_0x2d4ca8){logger[_0x803d('0xf')]('CreateSquareRecording',_0x2d4ca8[_0x803d('0x11')],_0x37fbcd);_0x32740a(_0x4b0456[_0x803d('0xf')](0x1f4,_0x2d4ca8[_0x803d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index b3e90ad..9fc8121 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 _0x4188=['describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x4c6d81,_0x462b1d){var _0x1b6cad=function(_0x16dc1c){while(--_0x16dc1c){_0x4c6d81['push'](_0x4c6d81['shift']());}};_0x1b6cad(++_0x462b1d);}(_0x4188,0x81));var _0x8418=function(_0x19e17e,_0x2190a3){_0x19e17e=_0x19e17e-0x0;var _0x2d04da=_0x4188[_0x19e17e];return _0x2d04da;};'use strict';var multer=require(_0x8418('0x0'));var util=require(_0x8418('0x1'));var path=require(_0x8418('0x2'));var timeout=require(_0x8418('0x3'));var express=require('express');var router=express[_0x8418('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x8418('0x5'));var config=require(_0x8418('0x6'));var controller=require(_0x8418('0x7'));router[_0x8418('0x8')]('/',auth[_0x8418('0x9')](),controller[_0x8418('0xa')]);router['get']('/describe',auth[_0x8418('0x9')](),controller[_0x8418('0xb')]);router['get'](_0x8418('0xc'),auth[_0x8418('0x9')](),controller[_0x8418('0xd')]);router[_0x8418('0xe')]('/',auth[_0x8418('0x9')](),controller[_0x8418('0xf')]);router[_0x8418('0x10')]('/:id',auth[_0x8418('0x9')](),controller[_0x8418('0x11')]);router[_0x8418('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x8418('0x13')]);module['exports']=router; \ No newline at end of file +var _0x32ec=['express','../../components/interaction/service','./squareReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x1001bb,_0x4231f7){var _0x343d7b=function(_0x421c47){while(--_0x421c47){_0x1001bb['push'](_0x1001bb['shift']());}};_0x343d7b(++_0x4231f7);}(_0x32ec,0x12f));var _0xc32e=function(_0x48f510,_0x5eee35){_0x48f510=_0x48f510-0x0;var _0xa37637=_0x32ec[_0x48f510];return _0xa37637;};'use strict';var multer=require(_0xc32e('0x0'));var util=require('util');var path=require(_0xc32e('0x1'));var timeout=require(_0xc32e('0x2'));var express=require(_0xc32e('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xc32e('0x4'));var config=require('../../config/environment');var controller=require(_0xc32e('0x5'));router[_0xc32e('0x6')]('/',auth[_0xc32e('0x7')](),controller['index']);router[_0xc32e('0x6')](_0xc32e('0x8'),auth['isAuthenticated'](),controller[_0xc32e('0x9')]);router[_0xc32e('0x6')](_0xc32e('0xa'),auth['isAuthenticated'](),controller[_0xc32e('0xb')]);router[_0xc32e('0xc')]('/',auth[_0xc32e('0x7')](),controller[_0xc32e('0xd')]);router['put'](_0xc32e('0xa'),auth[_0xc32e('0x7')](),controller[_0xc32e('0xe')]);router[_0xc32e('0xf')]('/:id',auth[_0xc32e('0x7')](),controller[_0xc32e('0x10')]);module[_0xc32e('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index bda20bd..195ffe9 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 _0x7380=['BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x7380,0x10a));var _0x0738=function(_0x120376,_0x571898){_0x120376=_0x120376-0x0;var _0x28c529=_0x7380[_0x120376];return _0x28c529;};'use strict';var Sequelize=require(_0x0738('0x0'));module[_0x0738('0x1')]={'network':{'type':Sequelize[_0x0738('0x2')]},'network_script':{'type':Sequelize[_0x0738('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x0738('0x2')]},'language':{'type':Sequelize[_0x0738('0x2')]},'type':{'type':Sequelize[_0x0738('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x0738('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0738('0x2')]},'callingpres':{'type':Sequelize[_0x0738('0x2')]},'callingani2':{'type':Sequelize[_0x0738('0x2')]},'callington':{'type':Sequelize[_0x0738('0x2')]},'callingtns':{'type':Sequelize[_0x0738('0x2')]},'dnid':{'type':Sequelize[_0x0738('0x2')]},'rdnis':{'type':Sequelize[_0x0738('0x2')]},'context':{'type':Sequelize[_0x0738('0x2')]},'extension':{'type':Sequelize[_0x0738('0x2')]},'priority':{'type':Sequelize[_0x0738('0x2')]},'enhanced':{'type':Sequelize[_0x0738('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x0738('0x2')]},'project_name':{'type':Sequelize[_0x0738('0x2')]},'joinAt':{'type':Sequelize[_0x0738('0x3')]},'leaveAt':{'type':Sequelize[_0x0738('0x3')]},'bot':{'type':Sequelize[_0x0738('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x448f=['exports','STRING','DATE','BOOLEAN','sequelize'];(function(_0x57ccc9,_0x23c47d){var _0x3eab71=function(_0x56ef92){while(--_0x56ef92){_0x57ccc9['push'](_0x57ccc9['shift']());}};_0x3eab71(++_0x23c47d);}(_0x448f,0x17b));var _0xf448=function(_0x28ab2c,_0x4b8e37){_0x28ab2c=_0x28ab2c-0x0;var _0x203d40=_0x448f[_0x28ab2c];return _0x203d40;};'use strict';var Sequelize=require(_0xf448('0x0'));module[_0xf448('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xf448('0x2')]},'request':{'type':Sequelize[_0xf448('0x2')]},'channel':{'type':Sequelize[_0xf448('0x2')]},'language':{'type':Sequelize[_0xf448('0x2')]},'type':{'type':Sequelize[_0xf448('0x2')]},'uniqueid':{'type':Sequelize[_0xf448('0x2')]},'version':{'type':Sequelize[_0xf448('0x2')]},'callerid':{'type':Sequelize[_0xf448('0x2')]},'calleridname':{'type':Sequelize[_0xf448('0x2')]},'callingpres':{'type':Sequelize[_0xf448('0x2')]},'callingani2':{'type':Sequelize[_0xf448('0x2')]},'callington':{'type':Sequelize[_0xf448('0x2')]},'callingtns':{'type':Sequelize[_0xf448('0x2')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0xf448('0x2')]},'context':{'type':Sequelize[_0xf448('0x2')]},'extension':{'type':Sequelize[_0xf448('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0xf448('0x2')]},'accountcode':{'type':Sequelize[_0xf448('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0xf448('0x2')]},'joinAt':{'type':Sequelize[_0xf448('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0xf448('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 92387f0..a8d7595 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 _0x814b=['index','map','rawAttributes','fieldName','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show','SquareReport','options','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send'];(function(_0x13b70c,_0x40be1c){var _0x2d0edd=function(_0x485ea4){while(--_0x485ea4){_0x13b70c['push'](_0x13b70c['shift']());}};_0x2d0edd(++_0x40be1c);}(_0x814b,0x1a2));var _0xb814=function(_0x4ca288,_0x254dd8){_0x4ca288=_0x4ca288-0x0;var _0x2362c1=_0x814b[_0x4ca288];return _0x2362c1;};'use strict';var pdf=require(_0xb814('0x0'));var emlformat=require(_0xb814('0x1'));var rimraf=require(_0xb814('0x2'));var zipdir=require(_0xb814('0x3'));var jsonpatch=require(_0xb814('0x4'));var rp=require(_0xb814('0x5'));var moment=require('moment');var BPromise=require(_0xb814('0x6'));var Mustache=require(_0xb814('0x7'));var util=require(_0xb814('0x8'));var path=require(_0xb814('0x9'));var sox=require(_0xb814('0xa'));var csv=require(_0xb814('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xb'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var db=require(_0xb814('0x19'))['db'];function respondWithStatusCode(_0x15d6ef,_0x35b10d){_0x35b10d=_0x35b10d||0xcc;return function(_0x2cc46b){if(_0x2cc46b){return _0x15d6ef[_0xb814('0x1a')](_0x35b10d);}return _0x15d6ef[_0xb814('0x1b')](_0x35b10d)[_0xb814('0x1c')]();};}function respondWithResult(_0x41ed7b,_0xa0a2e5){_0xa0a2e5=_0xa0a2e5||0xc8;return function(_0x2ab627){if(_0x2ab627){return _0x41ed7b[_0xb814('0x1b')](_0xa0a2e5)[_0xb814('0x1d')](_0x2ab627);}};}function respondWithFilteredResult(_0x17f5bd,_0x39bfcf){return function(_0x303aca){if(_0x303aca){var _0x3a71d6=_0x303aca[_0xb814('0x1e')],_0x45e0d0=_0x39bfcf[_0xb814('0x1f')],_0x265a83=_0x39bfcf['offset']+_0x39bfcf[_0xb814('0x20')],_0x125ce2;if(_0x265a83>=_0x3a71d6){_0x265a83=_0x3a71d6;_0x125ce2=0xc8;}else{_0x125ce2=0xce;}_0x17f5bd['status'](_0x125ce2);return _0x17f5bd[_0xb814('0x21')](_0xb814('0x22'),_0x45e0d0+'-'+_0x265a83+'/'+_0x3a71d6)['json'](_0x303aca);}return null;};}function patchUpdates(_0x4b55a7){return function(_0x55d63c){try{jsonpatch[_0xb814('0x23')](_0x55d63c,_0x4b55a7,!![]);}catch(_0x4d5276){return BPromise['reject'](_0x4d5276);}return _0x55d63c[_0xb814('0x24')]();};}function saveUpdates(_0x24211d,_0x25b6b6){return function(_0x4e139e){if(_0x4e139e){return _0x4e139e[_0xb814('0x25')](_0x24211d)['then'](function(_0x1e6393){return _0x1e6393;});}return null;};}function removeEntity(_0x1808a3,_0x3b267e){return function(_0x470e81){if(_0x470e81){return _0x470e81[_0xb814('0x26')]()[_0xb814('0x27')](function(){_0x1808a3[_0xb814('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ead86,_0x52b7a3){return function(_0x3f81d0){if(!_0x3f81d0){_0x2ead86[_0xb814('0x1a')](0x194);}return _0x3f81d0;};}function handleError(_0x31c7ec,_0x208927){_0x208927=_0x208927||0x1f4;return function(_0x1c8a2e){logger[_0xb814('0x28')](_0x1c8a2e[_0xb814('0x29')]);if(_0x1c8a2e['name']){delete _0x1c8a2e[_0xb814('0x2a')];}_0x31c7ec[_0xb814('0x1b')](_0x208927)[_0xb814('0x2b')](_0x1c8a2e);};}exports[_0xb814('0x2c')]=function(_0x32ed56,_0x1d5965){var _0x3f0150={},_0x1e4e89={},_0x5a6291={'count':0x0,'rows':[]};var _0x271aa8=_[_0xb814('0x2d')](db['SquareReport'][_0xb814('0x2e')],function(_0x37d24d){return{'name':_0x37d24d[_0xb814('0x2f')],'type':_0x37d24d['type'][_0xb814('0x30')]};});_0x1e4e89[_0xb814('0x31')]=_['map'](_0x271aa8,_0xb814('0x2a'));_0x1e4e89['query']=_[_0xb814('0x32')](_0x32ed56['query']);_0x1e4e89['filters']=_[_0xb814('0x33')](_0x1e4e89['model'],_0x1e4e89[_0xb814('0x34')]);_0x3f0150[_0xb814('0x35')]=_[_0xb814('0x33')](_0x1e4e89['model'],qs['fields'](_0x32ed56[_0xb814('0x34')][_0xb814('0x36')]));_0x3f0150['attributes']=_0x3f0150[_0xb814('0x35')][_0xb814('0x37')]?_0x3f0150[_0xb814('0x35')]:_0x1e4e89[_0xb814('0x31')];if(!_0x32ed56[_0xb814('0x34')][_0xb814('0x38')](_0xb814('0x39'))){_0x3f0150['limit']=qs[_0xb814('0x20')](_0x32ed56[_0xb814('0x34')][_0xb814('0x20')]);_0x3f0150[_0xb814('0x1f')]=qs[_0xb814('0x1f')](_0x32ed56['query'][_0xb814('0x1f')]);}_0x3f0150['order']=qs[_0xb814('0x3a')](_0x32ed56[_0xb814('0x34')][_0xb814('0x3a')]);_0x3f0150['where']=qs[_0xb814('0x3b')](_[_0xb814('0x3c')](_0x32ed56['query'],_0x1e4e89[_0xb814('0x3b')]));if(_0x32ed56[_0xb814('0x34')][_0xb814('0x3d')]){_0x3f0150[_0xb814('0x3e')]=_[_0xb814('0x3f')](_0x3f0150[_0xb814('0x3e')],{'$or':_['map'](_0x271aa8,function(_0xa6ce87){if(_0xa6ce87['type']!==_0xb814('0x40')){var _0x4b5583={};_0x4b5583[_0xa6ce87[_0xb814('0x2a')]]={'$like':'%'+_0x32ed56['query'][_0xb814('0x3d')]+'%'};return _0x4b5583;}})});}_0x3f0150=_[_0xb814('0x3f')]({},_0x3f0150,_0x32ed56['options']);var _0x4d308a={'where':_0x3f0150['where']};return db['SquareReport'][_0xb814('0x1e')](_0x4d308a)[_0xb814('0x27')](function(_0x38cdc2){_0x5a6291[_0xb814('0x1e')]=_0x38cdc2;if(_0x32ed56['query']['includeAll']){_0x3f0150[_0xb814('0x41')]=[{'all':!![]}];}return db['SquareReport'][_0xb814('0x42')](_0x3f0150);})[_0xb814('0x27')](function(_0x178823){_0x5a6291[_0xb814('0x43')]=_0x178823;return _0x5a6291;})[_0xb814('0x27')](respondWithFilteredResult(_0x1d5965,_0x3f0150))[_0xb814('0x44')](handleError(_0x1d5965,null));};exports[_0xb814('0x45')]=function(_0x28b2b4,_0x31989d){var _0x4b6ff8={'raw':!![],'where':{'id':_0x28b2b4['params']['id']}},_0x544d36={};_0x544d36[_0xb814('0x31')]=_['keys'](db[_0xb814('0x46')]['rawAttributes']);_0x544d36[_0xb814('0x34')]=_[_0xb814('0x32')](_0x28b2b4[_0xb814('0x34')]);_0x544d36[_0xb814('0x3b')]=_['intersection'](_0x544d36[_0xb814('0x31')],_0x544d36[_0xb814('0x34')]);_0x4b6ff8[_0xb814('0x35')]=_[_0xb814('0x33')](_0x544d36[_0xb814('0x31')],qs[_0xb814('0x36')](_0x28b2b4['query'][_0xb814('0x36')]));_0x4b6ff8[_0xb814('0x35')]=_0x4b6ff8[_0xb814('0x35')][_0xb814('0x37')]?_0x4b6ff8[_0xb814('0x35')]:_0x544d36[_0xb814('0x31')];if(_0x28b2b4[_0xb814('0x34')]['includeAll']){_0x4b6ff8['include']=[{'all':!![]}];}_0x4b6ff8=_[_0xb814('0x3f')]({},_0x4b6ff8,_0x28b2b4[_0xb814('0x47')]);return db[_0xb814('0x46')][_0xb814('0x48')](_0x4b6ff8)[_0xb814('0x27')](handleEntityNotFound(_0x31989d,null))[_0xb814('0x27')](respondWithResult(_0x31989d,null))[_0xb814('0x44')](handleError(_0x31989d,null));};exports[_0xb814('0x49')]=function(_0x2eb9b6,_0x344198){return db[_0xb814('0x46')]['create'](_0x2eb9b6[_0xb814('0x4a')],{})[_0xb814('0x27')](respondWithResult(_0x344198,0xc9))['catch'](handleError(_0x344198,null));};exports[_0xb814('0x25')]=function(_0x55234d,_0x2fb0f7){if(_0x55234d[_0xb814('0x4a')]['id']){delete _0x55234d[_0xb814('0x4a')]['id'];}return db[_0xb814('0x46')][_0xb814('0x48')]({'where':{'id':_0x55234d[_0xb814('0x4b')]['id']}})[_0xb814('0x27')](handleEntityNotFound(_0x2fb0f7,null))[_0xb814('0x27')](saveUpdates(_0x55234d[_0xb814('0x4a')],null))[_0xb814('0x27')](respondWithResult(_0x2fb0f7,null))['catch'](handleError(_0x2fb0f7,null));};exports['destroy']=function(_0x32eca6,_0x30f07b){return db[_0xb814('0x46')][_0xb814('0x48')]({'where':{'id':_0x32eca6[_0xb814('0x4b')]['id']}})[_0xb814('0x27')](handleEntityNotFound(_0x30f07b,null))[_0xb814('0x27')](removeEntity(_0x30f07b,null))['catch'](handleError(_0x30f07b,null));};exports[_0xb814('0x4c')]=function(_0x388324,_0xf27a6e){return db['SquareReport'][_0xb814('0x4c')]()['then'](respondWithResult(_0xf27a6e,null))[_0xb814('0x44')](handleError(_0xf27a6e,null));}; \ No newline at end of file +var _0x4975=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','SquareReport','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','filter','map','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x5d0e85,_0x28b42d){var _0x57202e=function(_0x5f5582){while(--_0x5f5582){_0x5d0e85['push'](_0x5d0e85['shift']());}};_0x57202e(++_0x28b42d);}(_0x4975,0x86));var _0x5497=function(_0x1b1185,_0x4a4e4d){_0x1b1185=_0x1b1185-0x0;var _0x570baa=_0x4975[_0x1b1185];return _0x570baa;};'use strict';var pdf=require(_0x5497('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5497('0x1'));var zipdir=require(_0x5497('0x2'));var jsonpatch=require(_0x5497('0x3'));var rp=require(_0x5497('0x4'));var moment=require(_0x5497('0x5'));var BPromise=require(_0x5497('0x6'));var Mustache=require(_0x5497('0x7'));var util=require(_0x5497('0x8'));var path=require(_0x5497('0x9'));var sox=require(_0x5497('0xa'));var csv=require('to-csv');var ejs=require(_0x5497('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xf'));var querystring=require('querystring');var Papa=require(_0x5497('0x10'));var Redis=require(_0x5497('0x11'));var authService=require(_0x5497('0x12'));var qs=require(_0x5497('0x13'));var as=require(_0x5497('0x14'));var hardwareService=require(_0x5497('0x15'));var logger=require(_0x5497('0x16'))(_0x5497('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc250bb,_0x1b23df){_0x1b23df=_0x1b23df||0xcc;return function(_0x1bb794){if(_0x1bb794){return _0xc250bb[_0x5497('0x18')](_0x1b23df);}return _0xc250bb[_0x5497('0x19')](_0x1b23df)[_0x5497('0x1a')]();};}function respondWithResult(_0x1f7169,_0xaca97d){_0xaca97d=_0xaca97d||0xc8;return function(_0x363a5b){if(_0x363a5b){return _0x1f7169[_0x5497('0x19')](_0xaca97d)['json'](_0x363a5b);}};}function respondWithFilteredResult(_0x11b0a9,_0x4fb8e9){return function(_0x4237a9){if(_0x4237a9){var _0x2bfd8a=_0x4237a9[_0x5497('0x1b')],_0x19e5f3=_0x4fb8e9[_0x5497('0x1c')],_0x3ce50b=_0x4fb8e9['offset']+_0x4fb8e9['limit'],_0x37c18e;if(_0x3ce50b>=_0x2bfd8a){_0x3ce50b=_0x2bfd8a;_0x37c18e=0xc8;}else{_0x37c18e=0xce;}_0x11b0a9[_0x5497('0x19')](_0x37c18e);return _0x11b0a9[_0x5497('0x1d')](_0x5497('0x1e'),_0x19e5f3+'-'+_0x3ce50b+'/'+_0x2bfd8a)['json'](_0x4237a9);}return null;};}function patchUpdates(_0xbf1ba7){return function(_0xcbd71d){try{jsonpatch[_0x5497('0x1f')](_0xcbd71d,_0xbf1ba7,!![]);}catch(_0x43da2c){return BPromise[_0x5497('0x20')](_0x43da2c);}return _0xcbd71d[_0x5497('0x21')]();};}function saveUpdates(_0x16d378,_0x10226f){return function(_0x2e3960){if(_0x2e3960){return _0x2e3960[_0x5497('0x22')](_0x16d378)[_0x5497('0x23')](function(_0x52c049){return _0x52c049;});}return null;};}function removeEntity(_0x720767,_0x4d1b27){return function(_0x19200a){if(_0x19200a){return _0x19200a[_0x5497('0x24')]()[_0x5497('0x23')](function(){_0x720767[_0x5497('0x19')](0xcc)[_0x5497('0x1a')]();});}};}function handleEntityNotFound(_0x3b2fbc,_0x5018fa){return function(_0x54043a){if(!_0x54043a){_0x3b2fbc[_0x5497('0x18')](0x194);}return _0x54043a;};}function handleError(_0x34b97f,_0x24482a){_0x24482a=_0x24482a||0x1f4;return function(_0x281155){logger['error'](_0x281155[_0x5497('0x25')]);if(_0x281155['name']){delete _0x281155[_0x5497('0x26')];}_0x34b97f[_0x5497('0x19')](_0x24482a)[_0x5497('0x27')](_0x281155);};}exports[_0x5497('0x28')]=function(_0x163a30,_0x31cd01){var _0x48b835={},_0x4af5f4={},_0x5406e2={'count':0x0,'rows':[]};var _0x583d06=_['map'](db[_0x5497('0x29')]['rawAttributes'],function(_0x5e9356){return{'name':_0x5e9356[_0x5497('0x2a')],'type':_0x5e9356[_0x5497('0x2b')][_0x5497('0x2c')]};});_0x4af5f4['model']=_['map'](_0x583d06,'name');_0x4af5f4[_0x5497('0x2d')]=_[_0x5497('0x2e')](_0x163a30[_0x5497('0x2d')]);_0x4af5f4['filters']=_['intersection'](_0x4af5f4['model'],_0x4af5f4[_0x5497('0x2d')]);_0x48b835['attributes']=_[_0x5497('0x2f')](_0x4af5f4[_0x5497('0x30')],qs[_0x5497('0x31')](_0x163a30['query'][_0x5497('0x31')]));_0x48b835[_0x5497('0x32')]=_0x48b835['attributes'][_0x5497('0x33')]?_0x48b835[_0x5497('0x32')]:_0x4af5f4[_0x5497('0x30')];if(!_0x163a30['query'][_0x5497('0x34')](_0x5497('0x35'))){_0x48b835[_0x5497('0x36')]=qs[_0x5497('0x36')](_0x163a30[_0x5497('0x2d')]['limit']);_0x48b835[_0x5497('0x1c')]=qs[_0x5497('0x1c')](_0x163a30['query'][_0x5497('0x1c')]);}_0x48b835[_0x5497('0x37')]=qs[_0x5497('0x38')](_0x163a30[_0x5497('0x2d')][_0x5497('0x38')]);_0x48b835[_0x5497('0x39')]=qs['filters'](_[_0x5497('0x3a')](_0x163a30['query'],_0x4af5f4[_0x5497('0x3b')]));if(_0x163a30[_0x5497('0x2d')][_0x5497('0x3c')]){_0x48b835['where']=_['merge'](_0x48b835[_0x5497('0x39')],{'$or':_[_0x5497('0x3d')](_0x583d06,function(_0x326d48){if(_0x326d48[_0x5497('0x2b')]!==_0x5497('0x3e')){var _0xc8a689={};_0xc8a689[_0x326d48['name']]={'$like':'%'+_0x163a30[_0x5497('0x2d')][_0x5497('0x3c')]+'%'};return _0xc8a689;}})});}_0x48b835=_[_0x5497('0x3f')]({},_0x48b835,_0x163a30[_0x5497('0x40')]);var _0x275aa7={'where':_0x48b835[_0x5497('0x39')]};return db[_0x5497('0x29')][_0x5497('0x1b')](_0x275aa7)[_0x5497('0x23')](function(_0x544065){_0x5406e2[_0x5497('0x1b')]=_0x544065;if(_0x163a30[_0x5497('0x2d')][_0x5497('0x41')]){_0x48b835[_0x5497('0x42')]=[{'all':!![]}];}return db[_0x5497('0x29')][_0x5497('0x43')](_0x48b835);})[_0x5497('0x23')](function(_0x59ed13){_0x5406e2[_0x5497('0x44')]=_0x59ed13;return _0x5406e2;})[_0x5497('0x23')](respondWithFilteredResult(_0x31cd01,_0x48b835))[_0x5497('0x45')](handleError(_0x31cd01,null));};exports[_0x5497('0x46')]=function(_0x1b251b,_0x125526){var _0x114471={'raw':!![],'where':{'id':_0x1b251b[_0x5497('0x47')]['id']}},_0x547437={};_0x547437[_0x5497('0x30')]=_[_0x5497('0x2e')](db[_0x5497('0x29')][_0x5497('0x48')]);_0x547437[_0x5497('0x2d')]=_[_0x5497('0x2e')](_0x1b251b[_0x5497('0x2d')]);_0x547437[_0x5497('0x3b')]=_[_0x5497('0x2f')](_0x547437['model'],_0x547437[_0x5497('0x2d')]);_0x114471['attributes']=_[_0x5497('0x2f')](_0x547437[_0x5497('0x30')],qs[_0x5497('0x31')](_0x1b251b[_0x5497('0x2d')][_0x5497('0x31')]));_0x114471['attributes']=_0x114471[_0x5497('0x32')][_0x5497('0x33')]?_0x114471['attributes']:_0x547437[_0x5497('0x30')];if(_0x1b251b['query'][_0x5497('0x41')]){_0x114471['include']=[{'all':!![]}];}_0x114471=_[_0x5497('0x3f')]({},_0x114471,_0x1b251b[_0x5497('0x40')]);return db[_0x5497('0x29')][_0x5497('0x49')](_0x114471)[_0x5497('0x23')](handleEntityNotFound(_0x125526,null))['then'](respondWithResult(_0x125526,null))['catch'](handleError(_0x125526,null));};exports['create']=function(_0x55f654,_0x3cbe4b){return db[_0x5497('0x29')][_0x5497('0x4a')](_0x55f654[_0x5497('0x4b')],{})[_0x5497('0x23')](respondWithResult(_0x3cbe4b,0xc9))[_0x5497('0x45')](handleError(_0x3cbe4b,null));};exports[_0x5497('0x22')]=function(_0x466287,_0x2626bf){if(_0x466287['body']['id']){delete _0x466287[_0x5497('0x4b')]['id'];}return db[_0x5497('0x29')][_0x5497('0x49')]({'where':{'id':_0x466287['params']['id']}})[_0x5497('0x23')](handleEntityNotFound(_0x2626bf,null))['then'](saveUpdates(_0x466287[_0x5497('0x4b')],null))[_0x5497('0x23')](respondWithResult(_0x2626bf,null))[_0x5497('0x45')](handleError(_0x2626bf,null));};exports['destroy']=function(_0x43bebe,_0x356d61){return db['SquareReport'][_0x5497('0x49')]({'where':{'id':_0x43bebe['params']['id']}})[_0x5497('0x23')](handleEntityNotFound(_0x356d61,null))['then'](removeEntity(_0x356d61,null))[_0x5497('0x45')](handleError(_0x356d61,null));};exports[_0x5497('0x4c')]=function(_0x26fd9f,_0xf07541){return db[_0x5497('0x29')][_0x5497('0x4c')]()[_0x5497('0x23')](respondWithResult(_0xf07541,null))[_0x5497('0x45')](handleError(_0xf07541,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index d907a36..0f352d2 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 _0x0cd0=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','util'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x0cd0,0x13f));var _0x00cd=function(_0x6c673d,_0x540597){_0x6c673d=_0x6c673d-0x0;var _0x544f99=_0x0cd0[_0x6c673d];return _0x544f99;};'use strict';var _=require('lodash');var util=require(_0x00cd('0x0'));var logger=require(_0x00cd('0x1'))(_0x00cd('0x2'));var moment=require(_0x00cd('0x3'));var BPromise=require(_0x00cd('0x4'));var rp=require(_0x00cd('0x5'));var fs=require('fs');var path=require(_0x00cd('0x6'));var rimraf=require(_0x00cd('0x7'));var config=require(_0x00cd('0x8'));var attributes=require(_0x00cd('0x9'));module['exports']=function(_0x4f558e,_0x5de534){return _0x4f558e['define'](_0x00cd('0xa'),attributes,{'tableName':_0x00cd('0xb'),'paranoid':![],'indexes':[{'name':_0x00cd('0xc'),'fields':[_0x00cd('0xd'),_0x00cd('0xe')]},{'name':_0x00cd('0xf'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0x58b7=['report_square','project_name','leaveAt','../../config/logger','api','rimraf','./squareReport.attributes','exports'];(function(_0x2b5408,_0x4a32d8){var _0x54de60=function(_0x18927f){while(--_0x18927f){_0x2b5408['push'](_0x2b5408['shift']());}};_0x54de60(++_0x4a32d8);}(_0x58b7,0xbb));var _0x758b=function(_0x29dcb3,_0x55676f){_0x29dcb3=_0x29dcb3-0x0;var _0x41e2d7=_0x58b7[_0x29dcb3];return _0x41e2d7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x758b('0x0'))(_0x758b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x758b('0x2'));var config=require('../../config/environment');var attributes=require(_0x758b('0x3'));module[_0x758b('0x4')]=function(_0xc60ec6,_0x3116d4){return _0xc60ec6['define']('SquareReport',attributes,{'tableName':_0x758b('0x5'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':['uniqueid',_0x758b('0x6')]},{'name':_0x758b('0x7'),'fields':[_0x758b('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 423fd04..c36e568 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 _0xd9cc=['randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','SquareReport,\x20%s,\x20%s','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateSquareReport','create','body','options','raw','then','SquareReport','update','where','attributes','UpdateSquareReport','lodash','moment','bluebird'];(function(_0x421263,_0x18187d){var _0x34e4b5=function(_0x4e7978){while(--_0x4e7978){_0x421263['push'](_0x421263['shift']());}};_0x34e4b5(++_0x18187d);}(_0xd9cc,0x7d));var _0xcd9c=function(_0x28ef22,_0x4b43d8){_0x28ef22=_0x28ef22-0x0;var _0x4cf375=_0xd9cc[_0x28ef22];return _0x4cf375;};'use strict';var _=require(_0xcd9c('0x0'));var util=require('util');var moment=require(_0xcd9c('0x1'));var BPromise=require(_0xcd9c('0x2'));var rs=require(_0xcd9c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcd9c('0x4'))['db'];var utils=require(_0xcd9c('0x5'));var logger=require('../../config/logger')(_0xcd9c('0x6'));var config=require(_0xcd9c('0x7'));var jayson=require(_0xcd9c('0x8'));var client=jayson[_0xcd9c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a82b9,_0x4e9c8c,_0x505b10){return new BPromise(function(_0x3b2071,_0x5a629a){return client[_0xcd9c('0xa')](_0x2a82b9,_0x505b10)['then'](function(_0x971a9a){logger[_0xcd9c('0xb')](_0xcd9c('0xc'),_0x4e9c8c,'request\x20sent');logger[_0xcd9c('0xd')](_0xcd9c('0xe'),_0x4e9c8c,_0xcd9c('0xf'),JSON[_0xcd9c('0x10')](_0x971a9a));if(_0x971a9a[_0xcd9c('0x11')]){if(_0x971a9a[_0xcd9c('0x11')][_0xcd9c('0x12')]===0x1f4){logger[_0xcd9c('0x11')]('SquareReport,\x20%s,\x20%s',_0x4e9c8c,_0x971a9a[_0xcd9c('0x11')][_0xcd9c('0x13')]);return _0x5a629a(_0x971a9a[_0xcd9c('0x11')][_0xcd9c('0x13')]);}logger[_0xcd9c('0x11')]('SquareReport,\x20%s,\x20%s',_0x4e9c8c,_0x971a9a[_0xcd9c('0x11')]['message']);return _0x3b2071(_0x971a9a['error'][_0xcd9c('0x13')]);}else{logger[_0xcd9c('0xb')](_0xcd9c('0xc'),_0x4e9c8c,_0xcd9c('0xf'));_0x3b2071(_0x971a9a['result'][_0xcd9c('0x13')]);}})[_0xcd9c('0x14')](function(_0xdccbb6){logger[_0xcd9c('0x11')](_0xcd9c('0xc'),_0x4e9c8c,_0xdccbb6);_0x5a629a(_0xdccbb6);});});}exports[_0xcd9c('0x15')]=function(_0x4811b1){var _0x28cec5=this;return new Promise(function(_0x564f4c,_0xd101aa){return db['SquareReport'][_0xcd9c('0x16')](_0x4811b1[_0xcd9c('0x17')],{'raw':_0x4811b1['options']?_0x4811b1[_0xcd9c('0x18')][_0xcd9c('0x19')]===undefined?!![]:![]:!![]})[_0xcd9c('0x1a')](function(_0x4f8578){logger[_0xcd9c('0xb')](_0xcd9c('0x15'),_0x4811b1);logger[_0xcd9c('0xd')](_0xcd9c('0x15'),_0x4811b1,JSON[_0xcd9c('0x10')](_0x4f8578));_0x564f4c(_0x4f8578);})[_0xcd9c('0x14')](function(_0x41eebd){logger[_0xcd9c('0x11')](_0xcd9c('0x15'),_0x41eebd[_0xcd9c('0x13')],_0x4811b1);_0xd101aa(_0x28cec5['error'](0x1f4,_0x41eebd[_0xcd9c('0x13')]));});});};exports['UpdateSquareReport']=function(_0x5e4dc3){var _0x223435=this;return new Promise(function(_0x43fed9,_0x4cae80){return db[_0xcd9c('0x1b')][_0xcd9c('0x1c')](_0x5e4dc3['body'],{'raw':_0x5e4dc3[_0xcd9c('0x18')]?_0x5e4dc3['options'][_0xcd9c('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e4dc3['options']?_0x5e4dc3[_0xcd9c('0x18')][_0xcd9c('0x1d')]||null:null,'attributes':_0x5e4dc3[_0xcd9c('0x18')]?_0x5e4dc3[_0xcd9c('0x18')][_0xcd9c('0x1e')]||null:null,'limit':_0x5e4dc3[_0xcd9c('0x18')]?_0x5e4dc3['options']['limit']||null:null})['then'](function(_0x5d8d37){logger['info'](_0xcd9c('0x1f'),_0x5e4dc3);logger[_0xcd9c('0xd')](_0xcd9c('0x1f'),_0x5e4dc3,JSON[_0xcd9c('0x10')](_0x5d8d37));_0x43fed9(_0x5d8d37);})[_0xcd9c('0x14')](function(_0x84e783){logger[_0xcd9c('0x11')](_0xcd9c('0x1f'),_0x84e783[_0xcd9c('0x13')],_0x5e4dc3);_0x4cae80(_0x223435[_0xcd9c('0x11')](0x1f4,_0x84e783[_0xcd9c('0x13')]));});});}; \ No newline at end of file +var _0x1088=['randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareReport,\x20%s,\x20%s','result','catch','CreateSquareReport','SquareReport','create','body','options','raw','then','info','where','attributes','UpdateSquareReport','lodash','moment','bluebird'];(function(_0x4fd279,_0x1fe081){var _0x48cc96=function(_0x56ef34){while(--_0x56ef34){_0x4fd279['push'](_0x4fd279['shift']());}};_0x48cc96(++_0x1fe081);}(_0x1088,0x11f));var _0x8108=function(_0x89a280,_0x5829fb){_0x89a280=_0x89a280-0x0;var _0x357fe1=_0x1088[_0x89a280];return _0x357fe1;};'use strict';var _=require(_0x8108('0x0'));var util=require('util');var moment=require(_0x8108('0x1'));var BPromise=require(_0x8108('0x2'));var rs=require(_0x8108('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8108('0x4'))['db'];var utils=require(_0x8108('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x8108('0x6'));var jayson=require(_0x8108('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xd86490,_0x535176,_0x3cc6c9){return new BPromise(function(_0x484a06,_0x5d4320){return client['request'](_0xd86490,_0x3cc6c9)['then'](function(_0x12a6ad){logger['info']('SquareReport,\x20%s,\x20%s',_0x535176,_0x8108('0x8'));logger[_0x8108('0x9')](_0x8108('0xa'),_0x535176,'request\x20sent',JSON[_0x8108('0xb')](_0x12a6ad));if(_0x12a6ad[_0x8108('0xc')]){if(_0x12a6ad[_0x8108('0xc')][_0x8108('0xd')]===0x1f4){logger[_0x8108('0xc')]('SquareReport,\x20%s,\x20%s',_0x535176,_0x12a6ad[_0x8108('0xc')][_0x8108('0xe')]);return _0x5d4320(_0x12a6ad[_0x8108('0xc')][_0x8108('0xe')]);}logger['error'](_0x8108('0xf'),_0x535176,_0x12a6ad['error'][_0x8108('0xe')]);return _0x484a06(_0x12a6ad[_0x8108('0xc')]['message']);}else{logger['info'](_0x8108('0xf'),_0x535176,_0x8108('0x8'));_0x484a06(_0x12a6ad[_0x8108('0x10')][_0x8108('0xe')]);}})[_0x8108('0x11')](function(_0x222123){logger[_0x8108('0xc')](_0x8108('0xf'),_0x535176,_0x222123);_0x5d4320(_0x222123);});});}exports[_0x8108('0x12')]=function(_0x53b478){var _0x5a8596=this;return new Promise(function(_0x40e043,_0x61b683){return db[_0x8108('0x13')][_0x8108('0x14')](_0x53b478[_0x8108('0x15')],{'raw':_0x53b478[_0x8108('0x16')]?_0x53b478[_0x8108('0x16')][_0x8108('0x17')]===undefined?!![]:![]:!![]})[_0x8108('0x18')](function(_0x914c1c){logger[_0x8108('0x19')](_0x8108('0x12'),_0x53b478);logger['debug'](_0x8108('0x12'),_0x53b478,JSON[_0x8108('0xb')](_0x914c1c));_0x40e043(_0x914c1c);})['catch'](function(_0x31c62e){logger[_0x8108('0xc')](_0x8108('0x12'),_0x31c62e[_0x8108('0xe')],_0x53b478);_0x61b683(_0x5a8596['error'](0x1f4,_0x31c62e['message']));});});};exports['UpdateSquareReport']=function(_0x40c624){var _0x11d741=this;return new Promise(function(_0x3fc677,_0x470770){return db[_0x8108('0x13')]['update'](_0x40c624['body'],{'raw':_0x40c624[_0x8108('0x16')]?_0x40c624[_0x8108('0x16')][_0x8108('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40c624[_0x8108('0x16')]?_0x40c624['options'][_0x8108('0x1a')]||null:null,'attributes':_0x40c624['options']?_0x40c624[_0x8108('0x16')][_0x8108('0x1b')]||null:null,'limit':_0x40c624['options']?_0x40c624[_0x8108('0x16')]['limit']||null:null})[_0x8108('0x18')](function(_0x17cf07){logger[_0x8108('0x19')](_0x8108('0x1c'),_0x40c624);logger[_0x8108('0x9')]('UpdateSquareReport',_0x40c624,JSON[_0x8108('0xb')](_0x17cf07));_0x3fc677(_0x17cf07);})[_0x8108('0x11')](function(_0x1c0862){logger['error'](_0x8108('0x1c'),_0x1c0862['message'],_0x40c624);_0x470770(_0x11d741[_0x8108('0xc')](0x1f4,_0x1c0862[_0x8108('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index b3c0d12..4c24ab8 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(_0x32e831,_0x1f37f8){var _0x460410=function(_0x326700){while(--_0x326700){_0x32e831['push'](_0x32e831['shift']());}};_0x460410(++_0x1f37f8);}(_0x5f2f,0x73));var _0xf5f2=function(_0x144001,_0x5b35f2){_0x144001=_0x144001-0x0;var _0x2ff439=_0x5f2f[_0x144001];return _0x2ff439;};'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 _0x7a54=['describe','/:id','create','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated'];(function(_0x205250,_0x518f3f){var _0x14c680=function(_0x29a5d8){while(--_0x29a5d8){_0x205250['push'](_0x205250['shift']());}};_0x14c680(++_0x518f3f);}(_0x7a54,0x106));var _0x47a5=function(_0x20b5ca,_0x1e15c7){_0x20b5ca=_0x20b5ca-0x0;var _0x5f31c4=_0x7a54[_0x20b5ca];return _0x5f31c4;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var controller=require(_0x47a5('0x7'));router[_0x47a5('0x8')]('/',auth[_0x47a5('0x9')](),controller['index']);router[_0x47a5('0x8')]('/describe',auth[_0x47a5('0x9')](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x47a5('0x9')](),controller[_0x47a5('0xc')]);router['put'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x47a5('0xd')](_0x47a5('0xb'),auth[_0x47a5('0x9')](),controller[_0x47a5('0xe')]);module[_0x47a5('0xf')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 16c2fcd..181b5b7 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 _0x5f1e=['exports','STRING','TEXT','sequelize'];(function(_0x20e7e3,_0x1529be){var _0x14b9de=function(_0xa82925){while(--_0xa82925){_0x20e7e3['push'](_0x20e7e3['shift']());}};_0x14b9de(++_0x1529be);}(_0x5f1e,0xd7));var _0xe5f1=function(_0x9e9c23,_0x207501){_0x9e9c23=_0x9e9c23-0x0;var _0x54617c=_0x5f1e[_0x9e9c23];return _0x54617c;};'use strict';var Sequelize=require(_0xe5f1('0x0'));module[_0xe5f1('0x1')]={'uniqueid':{'type':Sequelize[_0xe5f1('0x2')]},'node':{'type':Sequelize[_0xe5f1('0x2')]},'application':{'type':Sequelize[_0xe5f1('0x2')]},'data':{'type':Sequelize[_0xe5f1('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xe5f1('0x2')]}}; \ No newline at end of file +var _0x7e34=['sequelize','STRING'];(function(_0x510b08,_0x16cd04){var _0xbf9488=function(_0x2bd2bd){while(--_0x2bd2bd){_0x510b08['push'](_0x510b08['shift']());}};_0xbf9488(++_0x16cd04);}(_0x7e34,0x1ea));var _0x47e3=function(_0x109e5a,_0x9e715e){_0x109e5a=_0x109e5a-0x0;var _0x4ee4cf=_0x7e34[_0x109e5a];return _0x4ee4cf;};'use strict';var Sequelize=require(_0x47e3('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x47e3('0x1')]},'application':{'type':Sequelize[_0x47e3('0x1')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 2d85701..cf4b8d5 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 _0xdea7=['type','key','map','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','limit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','length','find','create','body','update','describe','html-pdf','eml-format','rimraf','zip-dir','moment','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','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','apply','then','stack','name','send','index','SquareDetailsReport','rawAttributes','fieldName'];(function(_0xe92e06,_0x394ae7){var _0x387ae3=function(_0x5cd616){while(--_0x5cd616){_0xe92e06['push'](_0xe92e06['shift']());}};_0x387ae3(++_0x394ae7);}(_0xdea7,0x1d6));var _0x7dea=function(_0x3f483a,_0x276424){_0x3f483a=_0x3f483a-0x0;var _0x5caa01=_0xdea7[_0x3f483a];return _0x5caa01;};'use strict';var pdf=require(_0x7dea('0x0'));var emlformat=require(_0x7dea('0x1'));var rimraf=require(_0x7dea('0x2'));var zipdir=require(_0x7dea('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7dea('0x4'));var BPromise=require(_0x7dea('0x5'));var Mustache=require(_0x7dea('0x6'));var util=require(_0x7dea('0x7'));var path=require('path');var sox=require(_0x7dea('0x8'));var csv=require(_0x7dea('0x9'));var ejs=require(_0x7dea('0xa'));var fs=require('fs');var _=require(_0x7dea('0xb'));var squel=require(_0x7dea('0xc'));var crypto=require(_0x7dea('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7dea('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7dea('0xf'));var Papa=require(_0x7dea('0x10'));var Redis=require(_0x7dea('0x11'));var authService=require(_0x7dea('0x12'));var qs=require(_0x7dea('0x13'));var as=require(_0x7dea('0x14'));var hardwareService=require(_0x7dea('0x15'));var logger=require(_0x7dea('0x16'))(_0x7dea('0x17'));var utils=require(_0x7dea('0x18'));var config=require(_0x7dea('0x19'));var db=require(_0x7dea('0x1a'))['db'];function respondWithStatusCode(_0x4f575b,_0x379a7a){_0x379a7a=_0x379a7a||0xcc;return function(_0x1efd2a){if(_0x1efd2a){return _0x4f575b[_0x7dea('0x1b')](_0x379a7a);}return _0x4f575b[_0x7dea('0x1c')](_0x379a7a)['end']();};}function respondWithResult(_0x49d014,_0x3b8e00){_0x3b8e00=_0x3b8e00||0xc8;return function(_0x4b1267){if(_0x4b1267){return _0x49d014[_0x7dea('0x1c')](_0x3b8e00)[_0x7dea('0x1d')](_0x4b1267);}};}function respondWithFilteredResult(_0x545cb6,_0x5f4d63){return function(_0x53ec0e){if(_0x53ec0e){var _0x5abb3e=_0x53ec0e[_0x7dea('0x1e')],_0x2f021e=_0x5f4d63[_0x7dea('0x1f')],_0x522f6e=_0x5f4d63[_0x7dea('0x1f')]+_0x5f4d63['limit'],_0x32b02e;if(_0x522f6e>=_0x5abb3e){_0x522f6e=_0x5abb3e;_0x32b02e=0xc8;}else{_0x32b02e=0xce;}_0x545cb6[_0x7dea('0x1c')](_0x32b02e);return _0x545cb6['set']('Content-Range',_0x2f021e+'-'+_0x522f6e+'/'+_0x5abb3e)['json'](_0x53ec0e);}return null;};}function patchUpdates(_0x4a3679){return function(_0x168984){try{jsonpatch[_0x7dea('0x20')](_0x168984,_0x4a3679,!![]);}catch(_0x385c5e){return BPromise['reject'](_0x385c5e);}return _0x168984['save']();};}function saveUpdates(_0x7231ff,_0x51784f){return function(_0x56b961){if(_0x56b961){return _0x56b961['update'](_0x7231ff)[_0x7dea('0x21')](function(_0x4a8766){return _0x4a8766;});}return null;};}function removeEntity(_0x320b8c,_0x22f55f){return function(_0x5762ea){if(_0x5762ea){return _0x5762ea['destroy']()[_0x7dea('0x21')](function(){_0x320b8c[_0x7dea('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xaed92,_0x2f2f95){return function(_0x570375){if(!_0x570375){_0xaed92[_0x7dea('0x1b')](0x194);}return _0x570375;};}function handleError(_0x34b88b,_0xaba68a){_0xaba68a=_0xaba68a||0x1f4;return function(_0x4fd961){logger['error'](_0x4fd961[_0x7dea('0x22')]);if(_0x4fd961[_0x7dea('0x23')]){delete _0x4fd961[_0x7dea('0x23')];}_0x34b88b[_0x7dea('0x1c')](_0xaba68a)[_0x7dea('0x24')](_0x4fd961);};}exports[_0x7dea('0x25')]=function(_0x15fb4b,_0x6b3014){var _0x33d994={},_0xfbeee9={},_0x26b0fd={'count':0x0,'rows':[]};var _0x4caaa9=_['map'](db[_0x7dea('0x26')][_0x7dea('0x27')],function(_0x510cb6){return{'name':_0x510cb6[_0x7dea('0x28')],'type':_0x510cb6[_0x7dea('0x29')][_0x7dea('0x2a')]};});_0xfbeee9['model']=_[_0x7dea('0x2b')](_0x4caaa9,_0x7dea('0x23'));_0xfbeee9[_0x7dea('0x2c')]=_[_0x7dea('0x2d')](_0x15fb4b[_0x7dea('0x2c')]);_0xfbeee9[_0x7dea('0x2e')]=_[_0x7dea('0x2f')](_0xfbeee9[_0x7dea('0x30')],_0xfbeee9[_0x7dea('0x2c')]);_0x33d994['attributes']=_[_0x7dea('0x2f')](_0xfbeee9[_0x7dea('0x30')],qs[_0x7dea('0x31')](_0x15fb4b[_0x7dea('0x2c')]['fields']));_0x33d994['attributes']=_0x33d994[_0x7dea('0x32')]['length']?_0x33d994[_0x7dea('0x32')]:_0xfbeee9[_0x7dea('0x30')];if(!_0x15fb4b[_0x7dea('0x2c')][_0x7dea('0x33')]('nolimit')){_0x33d994[_0x7dea('0x34')]=qs[_0x7dea('0x34')](_0x15fb4b[_0x7dea('0x2c')][_0x7dea('0x34')]);_0x33d994[_0x7dea('0x1f')]=qs[_0x7dea('0x1f')](_0x15fb4b['query'][_0x7dea('0x1f')]);}_0x33d994[_0x7dea('0x35')]=qs[_0x7dea('0x36')](_0x15fb4b[_0x7dea('0x2c')]['sort']);_0x33d994['where']=qs[_0x7dea('0x2e')](_[_0x7dea('0x37')](_0x15fb4b[_0x7dea('0x2c')],_0xfbeee9[_0x7dea('0x2e')]));if(_0x15fb4b[_0x7dea('0x2c')][_0x7dea('0x38')]){_0x33d994[_0x7dea('0x39')]=_['merge'](_0x33d994[_0x7dea('0x39')],{'$or':_['map'](_0x4caaa9,function(_0x1d0760){if(_0x1d0760[_0x7dea('0x29')]!==_0x7dea('0x3a')){var _0x11aa94={};_0x11aa94[_0x1d0760[_0x7dea('0x23')]]={'$like':'%'+_0x15fb4b['query'][_0x7dea('0x38')]+'%'};return _0x11aa94;}})});}_0x33d994=_[_0x7dea('0x3b')]({},_0x33d994,_0x15fb4b[_0x7dea('0x3c')]);var _0x292567={'where':_0x33d994[_0x7dea('0x39')]};return db[_0x7dea('0x26')][_0x7dea('0x1e')](_0x292567)[_0x7dea('0x21')](function(_0x2497db){_0x26b0fd['count']=_0x2497db;if(_0x15fb4b['query'][_0x7dea('0x3d')]){_0x33d994[_0x7dea('0x3e')]=[{'all':!![]}];}return db[_0x7dea('0x26')]['findAll'](_0x33d994);})[_0x7dea('0x21')](function(_0xf9c9d7){_0x26b0fd[_0x7dea('0x3f')]=_0xf9c9d7;return _0x26b0fd;})['then'](respondWithFilteredResult(_0x6b3014,_0x33d994))[_0x7dea('0x40')](handleError(_0x6b3014,null));};exports[_0x7dea('0x41')]=function(_0x3b31c8,_0x391183){var _0x31c77f={'raw':!![],'where':{'id':_0x3b31c8[_0x7dea('0x42')]['id']}},_0x324b9f={};_0x324b9f['model']=_['keys'](db[_0x7dea('0x26')][_0x7dea('0x27')]);_0x324b9f[_0x7dea('0x2c')]=_[_0x7dea('0x2d')](_0x3b31c8[_0x7dea('0x2c')]);_0x324b9f[_0x7dea('0x2e')]=_[_0x7dea('0x2f')](_0x324b9f[_0x7dea('0x30')],_0x324b9f['query']);_0x31c77f[_0x7dea('0x32')]=_[_0x7dea('0x2f')](_0x324b9f[_0x7dea('0x30')],qs['fields'](_0x3b31c8[_0x7dea('0x2c')][_0x7dea('0x31')]));_0x31c77f[_0x7dea('0x32')]=_0x31c77f[_0x7dea('0x32')][_0x7dea('0x43')]?_0x31c77f['attributes']:_0x324b9f[_0x7dea('0x30')];if(_0x3b31c8['query']['includeAll']){_0x31c77f[_0x7dea('0x3e')]=[{'all':!![]}];}_0x31c77f=_['merge']({},_0x31c77f,_0x3b31c8[_0x7dea('0x3c')]);return db['SquareDetailsReport'][_0x7dea('0x44')](_0x31c77f)[_0x7dea('0x21')](handleEntityNotFound(_0x391183,null))[_0x7dea('0x21')](respondWithResult(_0x391183,null))['catch'](handleError(_0x391183,null));};exports[_0x7dea('0x45')]=function(_0x1d4e96,_0x381d0e){return db[_0x7dea('0x26')][_0x7dea('0x45')](_0x1d4e96[_0x7dea('0x46')],{})[_0x7dea('0x21')](respondWithResult(_0x381d0e,0xc9))[_0x7dea('0x40')](handleError(_0x381d0e,null));};exports[_0x7dea('0x47')]=function(_0x34fd0c,_0x549a13){if(_0x34fd0c[_0x7dea('0x46')]['id']){delete _0x34fd0c['body']['id'];}return db['SquareDetailsReport'][_0x7dea('0x44')]({'where':{'id':_0x34fd0c[_0x7dea('0x42')]['id']}})['then'](handleEntityNotFound(_0x549a13,null))[_0x7dea('0x21')](saveUpdates(_0x34fd0c[_0x7dea('0x46')],null))[_0x7dea('0x21')](respondWithResult(_0x549a13,null))[_0x7dea('0x40')](handleError(_0x549a13,null));};exports['destroy']=function(_0x3dd5d7,_0xba29ff){return db['SquareDetailsReport'][_0x7dea('0x44')]({'where':{'id':_0x3dd5d7[_0x7dea('0x42')]['id']}})[_0x7dea('0x21')](handleEntityNotFound(_0xba29ff,null))[_0x7dea('0x21')](removeEntity(_0xba29ff,null))[_0x7dea('0x40')](handleError(_0xba29ff,null));};exports[_0x7dea('0x48')]=function(_0x4b08e9,_0x3e8e9b){return db[_0x7dea('0x26')][_0x7dea('0x48')]()[_0x7dea('0x21')](respondWithResult(_0x3e8e9b,null))[_0x7dea('0x40')](handleError(_0x3e8e9b,null));}; \ No newline at end of file +var _0xfaa7=['moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','SquareDetailsReport','findAll','rows','catch','show','params','filters','fields','length','find','create','body','update','describe','html-pdf','eml-format','rimraf','request-promise'];(function(_0x24f42f,_0x41e98f){var _0x24df68=function(_0x418b53){while(--_0x418b53){_0x24f42f['push'](_0x24f42f['shift']());}};_0x24df68(++_0x41e98f);}(_0xfaa7,0xe3));var _0x7faa=function(_0xb00a3c,_0xa062e4){_0xb00a3c=_0xb00a3c-0x0;var _0x5427ca=_0xfaa7[_0xb00a3c];return _0x5427ca;};'use strict';var pdf=require(_0x7faa('0x0'));var emlformat=require(_0x7faa('0x1'));var rimraf=require(_0x7faa('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7faa('0x3'));var moment=require(_0x7faa('0x4'));var BPromise=require(_0x7faa('0x5'));var Mustache=require(_0x7faa('0x6'));var util=require(_0x7faa('0x7'));var path=require(_0x7faa('0x8'));var sox=require(_0x7faa('0x9'));var csv=require('to-csv');var ejs=require(_0x7faa('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7faa('0xb'));var crypto=require(_0x7faa('0xc'));var jsforce=require(_0x7faa('0xd'));var deskjs=require(_0x7faa('0xe'));var toCsv=require(_0x7faa('0xf'));var querystring=require('querystring');var Papa=require(_0x7faa('0x10'));var Redis=require(_0x7faa('0x11'));var authService=require(_0x7faa('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7faa('0x13'));var hardwareService=require(_0x7faa('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x7faa('0x15'));var config=require(_0x7faa('0x16'));var db=require(_0x7faa('0x17'))['db'];function respondWithStatusCode(_0x617937,_0x5aad75){_0x5aad75=_0x5aad75||0xcc;return function(_0x4bbaba){if(_0x4bbaba){return _0x617937[_0x7faa('0x18')](_0x5aad75);}return _0x617937[_0x7faa('0x19')](_0x5aad75)[_0x7faa('0x1a')]();};}function respondWithResult(_0x111a00,_0x26a78a){_0x26a78a=_0x26a78a||0xc8;return function(_0x535e74){if(_0x535e74){return _0x111a00['status'](_0x26a78a)[_0x7faa('0x1b')](_0x535e74);}};}function respondWithFilteredResult(_0x5a6638,_0x46dc7){return function(_0x2e695f){if(_0x2e695f){var _0x162cfd=_0x2e695f[_0x7faa('0x1c')],_0x21dd19=_0x46dc7[_0x7faa('0x1d')],_0x184811=_0x46dc7[_0x7faa('0x1d')]+_0x46dc7[_0x7faa('0x1e')],_0x1d5ca3;if(_0x184811>=_0x162cfd){_0x184811=_0x162cfd;_0x1d5ca3=0xc8;}else{_0x1d5ca3=0xce;}_0x5a6638[_0x7faa('0x19')](_0x1d5ca3);return _0x5a6638[_0x7faa('0x1f')](_0x7faa('0x20'),_0x21dd19+'-'+_0x184811+'/'+_0x162cfd)[_0x7faa('0x1b')](_0x2e695f);}return null;};}function patchUpdates(_0x32df92){return function(_0x248950){try{jsonpatch[_0x7faa('0x21')](_0x248950,_0x32df92,!![]);}catch(_0x36039c){return BPromise['reject'](_0x36039c);}return _0x248950[_0x7faa('0x22')]();};}function saveUpdates(_0xb8d3c8,_0x9bb0ac){return function(_0x391bb6){if(_0x391bb6){return _0x391bb6['update'](_0xb8d3c8)[_0x7faa('0x23')](function(_0x5ce235){return _0x5ce235;});}return null;};}function removeEntity(_0x251811,_0x7beb39){return function(_0x3ce8ce){if(_0x3ce8ce){return _0x3ce8ce[_0x7faa('0x24')]()[_0x7faa('0x23')](function(){_0x251811[_0x7faa('0x19')](0xcc)[_0x7faa('0x1a')]();});}};}function handleEntityNotFound(_0x326d3f,_0x59bacc){return function(_0x47bfcd){if(!_0x47bfcd){_0x326d3f[_0x7faa('0x18')](0x194);}return _0x47bfcd;};}function handleError(_0x148789,_0x14efa4){_0x14efa4=_0x14efa4||0x1f4;return function(_0x2c3dc9){logger[_0x7faa('0x25')](_0x2c3dc9[_0x7faa('0x26')]);if(_0x2c3dc9[_0x7faa('0x27')]){delete _0x2c3dc9[_0x7faa('0x27')];}_0x148789['status'](_0x14efa4)[_0x7faa('0x28')](_0x2c3dc9);};}exports[_0x7faa('0x29')]=function(_0x39fc6f,_0x5c9cfb){var _0x4d2e6c={},_0x3cf56e={},_0x519134={'count':0x0,'rows':[]};var _0x544a80=_[_0x7faa('0x2a')](db['SquareDetailsReport'][_0x7faa('0x2b')],function(_0x39fa33){return{'name':_0x39fa33[_0x7faa('0x2c')],'type':_0x39fa33[_0x7faa('0x2d')]['key']};});_0x3cf56e[_0x7faa('0x2e')]=_[_0x7faa('0x2a')](_0x544a80,'name');_0x3cf56e['query']=_[_0x7faa('0x2f')](_0x39fc6f[_0x7faa('0x30')]);_0x3cf56e['filters']=_[_0x7faa('0x31')](_0x3cf56e[_0x7faa('0x2e')],_0x3cf56e[_0x7faa('0x30')]);_0x4d2e6c[_0x7faa('0x32')]=_[_0x7faa('0x31')](_0x3cf56e[_0x7faa('0x2e')],qs['fields'](_0x39fc6f['query']['fields']));_0x4d2e6c[_0x7faa('0x32')]=_0x4d2e6c[_0x7faa('0x32')]['length']?_0x4d2e6c[_0x7faa('0x32')]:_0x3cf56e[_0x7faa('0x2e')];if(!_0x39fc6f['query'][_0x7faa('0x33')](_0x7faa('0x34'))){_0x4d2e6c['limit']=qs[_0x7faa('0x1e')](_0x39fc6f[_0x7faa('0x30')][_0x7faa('0x1e')]);_0x4d2e6c[_0x7faa('0x1d')]=qs[_0x7faa('0x1d')](_0x39fc6f[_0x7faa('0x30')][_0x7faa('0x1d')]);}_0x4d2e6c[_0x7faa('0x35')]=qs[_0x7faa('0x36')](_0x39fc6f[_0x7faa('0x30')][_0x7faa('0x36')]);_0x4d2e6c[_0x7faa('0x37')]=qs['filters'](_[_0x7faa('0x38')](_0x39fc6f[_0x7faa('0x30')],_0x3cf56e['filters']));if(_0x39fc6f['query'][_0x7faa('0x39')]){_0x4d2e6c[_0x7faa('0x37')]=_[_0x7faa('0x3a')](_0x4d2e6c['where'],{'$or':_[_0x7faa('0x2a')](_0x544a80,function(_0x34dcc9){if(_0x34dcc9[_0x7faa('0x2d')]!==_0x7faa('0x3b')){var _0x147dcf={};_0x147dcf[_0x34dcc9[_0x7faa('0x27')]]={'$like':'%'+_0x39fc6f[_0x7faa('0x30')][_0x7faa('0x39')]+'%'};return _0x147dcf;}})});}_0x4d2e6c=_['merge']({},_0x4d2e6c,_0x39fc6f[_0x7faa('0x3c')]);var _0x441624={'where':_0x4d2e6c[_0x7faa('0x37')]};return db['SquareDetailsReport'][_0x7faa('0x1c')](_0x441624)[_0x7faa('0x23')](function(_0x4da551){_0x519134[_0x7faa('0x1c')]=_0x4da551;if(_0x39fc6f['query'][_0x7faa('0x3d')]){_0x4d2e6c[_0x7faa('0x3e')]=[{'all':!![]}];}return db[_0x7faa('0x3f')][_0x7faa('0x40')](_0x4d2e6c);})[_0x7faa('0x23')](function(_0x415661){_0x519134[_0x7faa('0x41')]=_0x415661;return _0x519134;})[_0x7faa('0x23')](respondWithFilteredResult(_0x5c9cfb,_0x4d2e6c))[_0x7faa('0x42')](handleError(_0x5c9cfb,null));};exports[_0x7faa('0x43')]=function(_0x1b55fd,_0x2a5f29){var _0x427e80={'raw':!![],'where':{'id':_0x1b55fd[_0x7faa('0x44')]['id']}},_0x427f3c={};_0x427f3c[_0x7faa('0x2e')]=_['keys'](db[_0x7faa('0x3f')][_0x7faa('0x2b')]);_0x427f3c[_0x7faa('0x30')]=_[_0x7faa('0x2f')](_0x1b55fd['query']);_0x427f3c[_0x7faa('0x45')]=_[_0x7faa('0x31')](_0x427f3c[_0x7faa('0x2e')],_0x427f3c['query']);_0x427e80[_0x7faa('0x32')]=_['intersection'](_0x427f3c[_0x7faa('0x2e')],qs[_0x7faa('0x46')](_0x1b55fd['query'][_0x7faa('0x46')]));_0x427e80[_0x7faa('0x32')]=_0x427e80[_0x7faa('0x32')][_0x7faa('0x47')]?_0x427e80[_0x7faa('0x32')]:_0x427f3c[_0x7faa('0x2e')];if(_0x1b55fd[_0x7faa('0x30')][_0x7faa('0x3d')]){_0x427e80[_0x7faa('0x3e')]=[{'all':!![]}];}_0x427e80=_[_0x7faa('0x3a')]({},_0x427e80,_0x1b55fd[_0x7faa('0x3c')]);return db[_0x7faa('0x3f')][_0x7faa('0x48')](_0x427e80)[_0x7faa('0x23')](handleEntityNotFound(_0x2a5f29,null))[_0x7faa('0x23')](respondWithResult(_0x2a5f29,null))[_0x7faa('0x42')](handleError(_0x2a5f29,null));};exports[_0x7faa('0x49')]=function(_0x112930,_0x30beb6){return db[_0x7faa('0x3f')][_0x7faa('0x49')](_0x112930[_0x7faa('0x4a')],{})['then'](respondWithResult(_0x30beb6,0xc9))[_0x7faa('0x42')](handleError(_0x30beb6,null));};exports[_0x7faa('0x4b')]=function(_0x5c674a,_0x776fa2){if(_0x5c674a[_0x7faa('0x4a')]['id']){delete _0x5c674a['body']['id'];}return db[_0x7faa('0x3f')][_0x7faa('0x48')]({'where':{'id':_0x5c674a[_0x7faa('0x44')]['id']}})['then'](handleEntityNotFound(_0x776fa2,null))[_0x7faa('0x23')](saveUpdates(_0x5c674a[_0x7faa('0x4a')],null))[_0x7faa('0x23')](respondWithResult(_0x776fa2,null))['catch'](handleError(_0x776fa2,null));};exports[_0x7faa('0x24')]=function(_0x1a8c02,_0x19f3bb){return db[_0x7faa('0x3f')][_0x7faa('0x48')]({'where':{'id':_0x1a8c02[_0x7faa('0x44')]['id']}})[_0x7faa('0x23')](handleEntityNotFound(_0x19f3bb,null))[_0x7faa('0x23')](removeEntity(_0x19f3bb,null))[_0x7faa('0x42')](handleError(_0x19f3bb,null));};exports[_0x7faa('0x4c')]=function(_0x3211a5,_0x1d093d){return db[_0x7faa('0x3f')][_0x7faa('0x4c')]()[_0x7faa('0x23')](respondWithResult(_0x1d093d,null))['catch'](handleError(_0x1d093d,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index ee4709d..ee17231 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 _0x4be7=['./squareReportDetail.attributes','exports','define','SquareDetailsReport','util','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x11c644,_0x3f9572){var _0x4b856e=function(_0x34a1e7){while(--_0x34a1e7){_0x11c644['push'](_0x11c644['shift']());}};_0x4b856e(++_0x3f9572);}(_0x4be7,0x93));var _0x74be=function(_0x18b931,_0x2cad1d){_0x18b931=_0x18b931-0x0;var _0x114958=_0x4be7[_0x18b931];return _0x114958;};'use strict';var _=require('lodash');var util=require(_0x74be('0x0'));var logger=require('../../config/logger')(_0x74be('0x1'));var moment=require('moment');var BPromise=require(_0x74be('0x2'));var rp=require(_0x74be('0x3'));var fs=require('fs');var path=require(_0x74be('0x4'));var rimraf=require(_0x74be('0x5'));var config=require(_0x74be('0x6'));var attributes=require(_0x74be('0x7'));module[_0x74be('0x8')]=function(_0x178f9e,_0x47555e){return _0x178f9e[_0x74be('0x9')](_0x74be('0xa'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3feb=['moment','bluebird','path','../../config/environment','define','SquareDetailsReport','lodash','api'];(function(_0x384e65,_0x1944de){var _0x547015=function(_0x104f32){while(--_0x104f32){_0x384e65['push'](_0x384e65['shift']());}};_0x547015(++_0x1944de);}(_0x3feb,0x1ce));var _0xb3fe=function(_0x2beda9,_0x31cf95){_0x2beda9=_0x2beda9-0x0;var _0x7c3df6=_0x3feb[_0x2beda9];return _0x7c3df6;};'use strict';var _=require(_0xb3fe('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb3fe('0x1'));var moment=require(_0xb3fe('0x2'));var BPromise=require(_0xb3fe('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb3fe('0x4'));var rimraf=require('rimraf');var config=require(_0xb3fe('0x5'));var attributes=require('./squareReportDetail.attributes');module['exports']=function(_0x29fcf7,_0x21d1ff){return _0x29fcf7[_0xb3fe('0x6')](_0xb3fe('0x7'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 29ddbb6..b3ed02a 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 _0x563d=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','code','SquareDetailsReport,\x20%s,\x20%s','message','info','result','CreateSquareDetailsReport','SquareDetailsReport','body','options','raw','then','stringify','catch','lodash','moment'];(function(_0xf29840,_0x5071a6){var _0x1c5935=function(_0xe902b7){while(--_0xe902b7){_0xf29840['push'](_0xf29840['shift']());}};_0x1c5935(++_0x5071a6);}(_0x563d,0x178));var _0xd563=function(_0x30033a,_0x5ce4a6){_0x30033a=_0x30033a-0x0;var _0x5e3518=_0x563d[_0x30033a];return _0x5e3518;};'use strict';var _=require(_0xd563('0x0'));var util=require('util');var moment=require(_0xd563('0x1'));var BPromise=require('bluebird');var rs=require(_0xd563('0x2'));var fs=require('fs');var Redis=require(_0xd563('0x3'));var db=require(_0xd563('0x4'))['db'];var utils=require(_0xd563('0x5'));var logger=require(_0xd563('0x6'))('rpc');var config=require(_0xd563('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd563('0x8')][_0xd563('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x568947,_0x29c4d9,_0x4c78d4){return new BPromise(function(_0x514c39,_0x444e7b){return client['request'](_0x568947,_0x4c78d4)['then'](function(_0x492316){logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x29c4d9,_0xd563('0xa'));logger[_0xd563('0xb')](_0xd563('0xc'),_0x29c4d9,_0xd563('0xa'),JSON['stringify'](_0x492316));if(_0x492316[_0xd563('0xd')]){if(_0x492316[_0xd563('0xd')][_0xd563('0xe')]===0x1f4){logger['error'](_0xd563('0xf'),_0x29c4d9,_0x492316['error'][_0xd563('0x10')]);return _0x444e7b(_0x492316[_0xd563('0xd')][_0xd563('0x10')]);}logger[_0xd563('0xd')](_0xd563('0xf'),_0x29c4d9,_0x492316[_0xd563('0xd')]['message']);return _0x514c39(_0x492316['error'][_0xd563('0x10')]);}else{logger[_0xd563('0x11')](_0xd563('0xf'),_0x29c4d9,_0xd563('0xa'));_0x514c39(_0x492316[_0xd563('0x12')][_0xd563('0x10')]);}})['catch'](function(_0x5e4318){logger[_0xd563('0xd')](_0xd563('0xf'),_0x29c4d9,_0x5e4318);_0x444e7b(_0x5e4318);});});}exports[_0xd563('0x13')]=function(_0x35adf5){var _0x10b8b=this;return new Promise(function(_0x144439,_0x438396){return db[_0xd563('0x14')]['create'](_0x35adf5[_0xd563('0x15')],{'raw':_0x35adf5[_0xd563('0x16')]?_0x35adf5[_0xd563('0x16')][_0xd563('0x17')]===undefined?!![]:![]:!![]})[_0xd563('0x18')](function(_0x44bea8){logger[_0xd563('0x11')](_0xd563('0x13'),_0x35adf5);logger['debug'](_0xd563('0x13'),_0x35adf5,JSON[_0xd563('0x19')](_0x44bea8));_0x144439(_0x44bea8);})[_0xd563('0x1a')](function(_0x4115dc){logger[_0xd563('0xd')](_0xd563('0x13'),_0x4115dc['message'],_0x35adf5);_0x438396(_0x10b8b['error'](0x1f4,_0x4115dc[_0xd563('0x10')]));});});}; \ No newline at end of file +var _0xf678=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateSquareDetailsReport','create','body','options','raw','lodash'];(function(_0x5aea31,_0x1192ca){var _0x5cc58d=function(_0x519773){while(--_0x519773){_0x5aea31['push'](_0x5aea31['shift']());}};_0x5cc58d(++_0x1192ca);}(_0xf678,0x1cf));var _0x8f67=function(_0x37a997,_0x2a9b5e){_0x37a997=_0x37a997-0x0;var _0x1a24a3=_0xf678[_0x37a997];return _0x1a24a3;};'use strict';var _=require(_0x8f67('0x0'));var util=require(_0x8f67('0x1'));var moment=require(_0x8f67('0x2'));var BPromise=require('bluebird');var rs=require(_0x8f67('0x3'));var fs=require('fs');var Redis=require(_0x8f67('0x4'));var db=require(_0x8f67('0x5'))['db'];var utils=require(_0x8f67('0x6'));var logger=require(_0x8f67('0x7'))(_0x8f67('0x8'));var config=require(_0x8f67('0x9'));var jayson=require(_0x8f67('0xa'));var client=jayson[_0x8f67('0xb')][_0x8f67('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x20f5cc,_0x5f5657,_0xde9d1e){return new BPromise(function(_0x319c87,_0x5140ef){return client[_0x8f67('0xd')](_0x20f5cc,_0xde9d1e)[_0x8f67('0xe')](function(_0x52e94f){logger[_0x8f67('0xf')](_0x8f67('0x10'),_0x5f5657,'request\x20sent');logger['debug'](_0x8f67('0x11'),_0x5f5657,_0x8f67('0x12'),JSON[_0x8f67('0x13')](_0x52e94f));if(_0x52e94f[_0x8f67('0x14')]){if(_0x52e94f[_0x8f67('0x14')][_0x8f67('0x15')]===0x1f4){logger[_0x8f67('0x14')](_0x8f67('0x10'),_0x5f5657,_0x52e94f[_0x8f67('0x14')][_0x8f67('0x16')]);return _0x5140ef(_0x52e94f[_0x8f67('0x14')][_0x8f67('0x16')]);}logger['error'](_0x8f67('0x10'),_0x5f5657,_0x52e94f[_0x8f67('0x14')][_0x8f67('0x16')]);return _0x319c87(_0x52e94f['error'][_0x8f67('0x16')]);}else{logger[_0x8f67('0xf')](_0x8f67('0x10'),_0x5f5657,_0x8f67('0x12'));_0x319c87(_0x52e94f['result'][_0x8f67('0x16')]);}})[_0x8f67('0x17')](function(_0xa614d9){logger[_0x8f67('0x14')](_0x8f67('0x10'),_0x5f5657,_0xa614d9);_0x5140ef(_0xa614d9);});});}exports[_0x8f67('0x18')]=function(_0x590f95){var _0x55c75e=this;return new Promise(function(_0x3bd82c,_0x1ae332){return db['SquareDetailsReport'][_0x8f67('0x19')](_0x590f95[_0x8f67('0x1a')],{'raw':_0x590f95[_0x8f67('0x1b')]?_0x590f95['options'][_0x8f67('0x1c')]===undefined?!![]:![]:!![]})[_0x8f67('0xe')](function(_0x202f94){logger['info'](_0x8f67('0x18'),_0x590f95);logger['debug'](_0x8f67('0x18'),_0x590f95,JSON['stringify'](_0x202f94));_0x3bd82c(_0x202f94);})[_0x8f67('0x17')](function(_0x4b8940){logger['error']('CreateSquareDetailsReport',_0x4b8940[_0x8f67('0x16')],_0x590f95);_0x1ae332(_0x55c75e[_0x8f67('0x14')](0x1f4,_0x4b8940[_0x8f67('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index ea24831..b6ea4c0 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 _0xe426=['isAuthenticated','index','/process/:pid/kill','killProcess','exports','express','../../components/auth/service','./system.controller','get'];(function(_0x2f1114,_0x4561f1){var _0x2fe856=function(_0x8397f8){while(--_0x8397f8){_0x2f1114['push'](_0x2f1114['shift']());}};_0x2fe856(++_0x4561f1);}(_0xe426,0xf8));var _0x6e42=function(_0x312efb,_0x1b5af2){_0x312efb=_0x312efb-0x0;var _0x491c34=_0xe426[_0x312efb];return _0x491c34;};'use strict';var express=require(_0x6e42('0x0'));var router=express['Router']();var auth=require(_0x6e42('0x1'));var controller=require(_0x6e42('0x2'));router[_0x6e42('0x3')]('/',auth[_0x6e42('0x4')](),controller[_0x6e42('0x5')]);router['get'](_0x6e42('0x6'),auth[_0x6e42('0x4')](),controller[_0x6e42('0x7')]);module[_0x6e42('0x8')]=router; \ No newline at end of file +var _0x6458=['isAuthenticated','/process/:pid/kill','killProcess','exports','express','../../components/auth/service','./system.controller','get'];(function(_0x535650,_0x34099f){var _0x502196=function(_0x4b5ae2){while(--_0x4b5ae2){_0x535650['push'](_0x535650['shift']());}};_0x502196(++_0x34099f);}(_0x6458,0x124));var _0x8645=function(_0x337ef8,_0x3971ab){_0x337ef8=_0x337ef8-0x0;var _0x585b75=_0x6458[_0x337ef8];return _0x585b75;};'use strict';var express=require(_0x8645('0x0'));var router=express['Router']();var auth=require(_0x8645('0x1'));var controller=require(_0x8645('0x2'));router[_0x8645('0x3')]('/',auth[_0x8645('0x4')](),controller['index']);router['get'](_0x8645('0x5'),auth[_0x8645('0x4')](),controller[_0x8645('0x6')]);module[_0x8645('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index c27a9e3..8a81180 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 _0x187d=['SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','exec','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','kill'];(function(_0x1001c6,_0x5dcba0){var _0x197ae0=function(_0x193a17){while(--_0x193a17){_0x1001c6['push'](_0x1001c6['shift']());}};_0x197ae0(++_0x5dcba0);}(_0x187d,0x93));var _0xd187=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x187d[_0x42245d];return _0x4b211a;};'use strict';var info=require(_0xd187('0x0'));var exec=require('child_process')[_0xd187('0x1')];var logger=require(_0xd187('0x2'))(_0xd187('0x3'));var util=require(_0xd187('0x4'));var BPromise=require(_0xd187('0x5'));var _=require(_0xd187('0x6'));function handleError(_0x58622a,_0x28fa0b,_0x163807){_0x28fa0b=_0x28fa0b||0x1f4;return function(_0x4ebc8d){logger[_0xd187('0x7')](_0xd187('0x8'),_0x163807,_0x28fa0b,util[_0xd187('0x9')](_0x4ebc8d,{'showHidden':![],'depth':null}));delete _0x4ebc8d[_0xd187('0xa')];_0x58622a[_0xd187('0xb')](_0x28fa0b)[_0xd187('0xc')](_0x4ebc8d);};}exports[_0xd187('0xd')]=function(_0x461a44,_0x5b480f){return info[_0xd187('0xe')]()[_0xd187('0xf')](function(_0x4039f6){return _0x5b480f[_0xd187('0xb')](0xc8)[_0xd187('0x10')](_0x4039f6);})[_0xd187('0x11')](function(_0x59c194){return _0x5b480f[_0xd187('0xb')](0x1f4)[_0xd187('0x10')](_0x59c194);});};exports[_0xd187('0x12')]=function(_0x5e6180,_0x37e80c){var _0x4545cf=[_0xd187('0x13')];return new BPromise(function(_0x59ee4a,_0x33e3d5){return exec(util[_0xd187('0x14')](_0xd187('0x15'),_0x5e6180[_0xd187('0x16')]['pid']),function(_0x39a927,_0x2050d5,_0x45ab10){if(_0x39a927){return _0x33e3d5(_0x39a927);}return _0x59ee4a(_0x2050d5);});})[_0xd187('0xf')](function(_0x4c8f68){var _0x245d3e=![];var _0x52a208=_0x4c8f68['split'](/\n/);for(var _0x40ed84=0x0,_0x5a4986=_0x4545cf['length'];_0x40ed84<_0x5a4986,_0x245d3e===![];_0x40ed84+=0x1){if(_0x4c8f68[_0xd187('0x17')](_0x4545cf[_0x40ed84])>=0x0){_0x245d3e=!![];}}if(!_0x245d3e){throw new Error(util[_0xd187('0x14')](_0xd187('0x18'),_0x5e6180[_0xd187('0x16')][_0xd187('0x19')]));}process[_0xd187('0x1a')](_0x5e6180[_0xd187('0x16')][_0xd187('0x19')],_0xd187('0x1b'));return _0x37e80c[_0xd187('0xb')](0xc8)[_0xd187('0x10')]({'message':util[_0xd187('0x14')](_0xd187('0x1c'),_0x5e6180['params'][_0xd187('0x19')])});})[_0xd187('0x11')](handleError(_0x37e80c,null,_0xd187('0x12')));}; \ No newline at end of file +var _0x3b19=['length','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','json','systeminformation','child_process','exec','util','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','then','catch','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split'];(function(_0x3a7305,_0x12cb0b){var _0x5a6280=function(_0x53563e){while(--_0x53563e){_0x3a7305['push'](_0x3a7305['shift']());}};_0x5a6280(++_0x12cb0b);}(_0x3b19,0xa5));var _0x93b1=function(_0x6ec12b,_0x89312c){_0x6ec12b=_0x6ec12b-0x0;var _0x494756=_0x3b19[_0x6ec12b];return _0x494756;};'use strict';var info=require(_0x93b1('0x0'));var exec=require(_0x93b1('0x1'))[_0x93b1('0x2')];var logger=require('../../config/logger')('api');var util=require(_0x93b1('0x3'));var BPromise=require(_0x93b1('0x4'));var _=require('lodash');function handleError(_0x3ffab1,_0x289387,_0x31d2d1){_0x289387=_0x289387||0x1f4;return function(_0x3d977e){logger[_0x93b1('0x5')](_0x93b1('0x6'),_0x31d2d1,_0x289387,util[_0x93b1('0x7')](_0x3d977e,{'showHidden':![],'depth':null}));delete _0x3d977e[_0x93b1('0x8')];_0x3ffab1[_0x93b1('0x9')](_0x289387)[_0x93b1('0xa')](_0x3d977e);};}exports[_0x93b1('0xb')]=function(_0x5abc83,_0x67749f){return info[_0x93b1('0xc')]()[_0x93b1('0xd')](function(_0x43c533){return _0x67749f[_0x93b1('0x9')](0xc8)['json'](_0x43c533);})[_0x93b1('0xe')](function(_0x4fd8ad){return _0x67749f[_0x93b1('0x9')](0x1f4)['json'](_0x4fd8ad);});};exports['killProcess']=function(_0x4d8a29,_0x5cb013){var _0x3ceddd=['components/import/cm'];return new BPromise(function(_0x2be257,_0x22007f){return exec(util['format'](_0x93b1('0xf'),_0x4d8a29[_0x93b1('0x10')][_0x93b1('0x11')]),function(_0x5b7870,_0x35ed18,_0x402496){if(_0x5b7870){return _0x22007f(_0x5b7870);}return _0x2be257(_0x35ed18);});})[_0x93b1('0xd')](function(_0x4fe220){var _0x9082ba=![];var _0x3421c4=_0x4fe220[_0x93b1('0x12')](/\n/);for(var _0x1b65e9=0x0,_0x2037b7=_0x3ceddd[_0x93b1('0x13')];_0x1b65e9<_0x2037b7,_0x9082ba===![];_0x1b65e9+=0x1){if(_0x4fe220['indexOf'](_0x3ceddd[_0x1b65e9])>=0x0){_0x9082ba=!![];}}if(!_0x9082ba){throw new Error(util['format'](_0x93b1('0x14'),_0x4d8a29['params'][_0x93b1('0x11')]));}process[_0x93b1('0x15')](_0x4d8a29['params'][_0x93b1('0x11')],'SIGINT');return _0x5cb013[_0x93b1('0x9')](0xc8)[_0x93b1('0x16')]({'message':util['format']('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x4d8a29[_0x93b1('0x10')][_0x93b1('0x11')])});})['catch'](handleError(_0x5cb013,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 6444276..9aa7bd2 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 _0xbdb7=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','post','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x586956,_0x3265a6){var _0x1f53a8=function(_0x425b4f){while(--_0x425b4f){_0x586956['push'](_0x586956['shift']());}};_0x1f53a8(++_0x3265a6);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x5acb94,_0x389dbc){_0x5acb94=_0x5acb94-0x0;var _0x11800a=_0xbdb7[_0x5acb94];return _0x11800a;};'use strict';var multer=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var path=require(_0x7bdb('0x2'));var timeout=require(_0x7bdb('0x3'));var express=require(_0x7bdb('0x4'));var router=express[_0x7bdb('0x5')]();var auth=require(_0x7bdb('0x6'));var interaction=require(_0x7bdb('0x7'));var config=require(_0x7bdb('0x8'));var controller=require('./tag.controller');router[_0x7bdb('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7bdb('0x9')](_0x7bdb('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x7bdb('0xb')]('/',auth[_0x7bdb('0xc')](),controller['create']);router['put'](_0x7bdb('0xa'),auth[_0x7bdb('0xc')](),controller[_0x7bdb('0xd')]);router[_0x7bdb('0xe')](_0x7bdb('0xa'),auth[_0x7bdb('0xc')](),controller[_0x7bdb('0xf')]);module[_0x7bdb('0x10')]=router; \ No newline at end of file +var _0xb821=['post','create','put','update','delete','destroy','exports','util','path','Router','../../config/environment','./tag.controller','get','isAuthenticated','/:id','show'];(function(_0x3d5e2c,_0x32f045){var _0x40e407=function(_0x551d6f){while(--_0x551d6f){_0x3d5e2c['push'](_0x3d5e2c['shift']());}};_0x40e407(++_0x32f045);}(_0xb821,0xa7));var _0x1b82=function(_0x2ee4a6,_0x1acf75){_0x2ee4a6=_0x2ee4a6-0x0;var _0xa783e8=_0xb821[_0x2ee4a6];return _0xa783e8;};'use strict';var multer=require('multer');var util=require(_0x1b82('0x0'));var path=require(_0x1b82('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1b82('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1b82('0x3'));var controller=require(_0x1b82('0x4'));router[_0x1b82('0x5')]('/',auth[_0x1b82('0x6')](),controller['index']);router[_0x1b82('0x5')](_0x1b82('0x7'),auth[_0x1b82('0x6')](),controller[_0x1b82('0x8')]);router[_0x1b82('0x9')]('/',auth[_0x1b82('0x6')](),controller[_0x1b82('0xa')]);router[_0x1b82('0xb')](_0x1b82('0x7'),auth['isAuthenticated'](),controller[_0x1b82('0xc')]);router[_0x1b82('0xd')](_0x1b82('0x7'),auth[_0x1b82('0x6')](),controller[_0x1b82('0xe')]);module[_0x1b82('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 659c5e7..3a3b8a7 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 _0x5c00=['STRING','sequelize','exports'];(function(_0x14c2d3,_0x156730){var _0x29c8d7=function(_0x43e5e0){while(--_0x43e5e0){_0x14c2d3['push'](_0x14c2d3['shift']());}};_0x29c8d7(++_0x156730);}(_0x5c00,0x17e));var _0x05c0=function(_0x15214b,_0x3a7ebd){_0x15214b=_0x15214b-0x0;var _0xe42e19=_0x5c00[_0x15214b];return _0xe42e19;};'use strict';var Sequelize=require(_0x05c0('0x0'));module[_0x05c0('0x1')]={'name':{'type':Sequelize[_0x05c0('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x05c0('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x05c0('0x2')]}}; \ No newline at end of file +var _0x878f=['STRING','name','#0091EA','exports'];(function(_0x3d951c,_0x4a0695){var _0x1b91b5=function(_0x31c33b){while(--_0x31c33b){_0x3d951c['push'](_0x3d951c['shift']());}};_0x1b91b5(++_0x4a0695);}(_0x878f,0x173));var _0xf878=function(_0x407e2d,_0x214ccc){_0x407e2d=_0x407e2d-0x0;var _0x1e8675=_0x878f[_0x407e2d];return _0x1e8675;};'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 8b0e81d..e608eba 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 _0x160c=['autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','offset','limit','apply','reject','save','update','destroy','then','Tags','sendStatus','error','name','send','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Tag','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection'];(function(_0x8fd7be,_0xcd1d8d){var _0xd527d7=function(_0x34a173){while(--_0x34a173){_0x8fd7be['push'](_0x8fd7be['shift']());}};_0xd527d7(++_0xcd1d8d);}(_0x160c,0xa7));var _0xc160=function(_0x4b994b,_0x2cbbbd){_0x4b994b=_0x4b994b-0x0;var _0x5960da=_0x160c[_0x4b994b];return _0x5960da;};'use strict';var pdf=require(_0xc160('0x0'));var emlformat=require(_0xc160('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc160('0x2'));var rp=require(_0xc160('0x3'));var moment=require(_0xc160('0x4'));var BPromise=require(_0xc160('0x5'));var Mustache=require(_0xc160('0x6'));var util=require('util');var path=require(_0xc160('0x7'));var sox=require(_0xc160('0x8'));var csv=require(_0xc160('0x9'));var ejs=require(_0xc160('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc160('0xb'));var crypto=require('crypto');var jsforce=require(_0xc160('0xc'));var deskjs=require(_0xc160('0xd'));var toCsv=require(_0xc160('0x9'));var querystring=require(_0xc160('0xe'));var Papa=require(_0xc160('0xf'));var Redis=require(_0xc160('0x10'));var authService=require(_0xc160('0x11'));var qs=require(_0xc160('0x12'));var as=require(_0xc160('0x13'));var hardwareService=require(_0xc160('0x14'));var logger=require(_0xc160('0x15'))(_0xc160('0x16'));var utils=require(_0xc160('0x17'));var config=require(_0xc160('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x141b73,_0x10f16a){_0x10f16a=_0x10f16a||0xcc;return function(_0x1e6894){if(_0x1e6894){return _0x141b73['sendStatus'](_0x10f16a);}return _0x141b73[_0xc160('0x19')](_0x10f16a)[_0xc160('0x1a')]();};}function respondWithResult(_0x3bb650,_0x1a14e4){_0x1a14e4=_0x1a14e4||0xc8;return function(_0xd56473){if(_0xd56473){return _0x3bb650['status'](_0x1a14e4)[_0xc160('0x1b')](_0xd56473);}};}function respondWithFilteredResult(_0x4a5e16,_0x5c8327){return function(_0x1481af){if(_0x1481af){var _0xae6b66=_0x1481af[_0xc160('0x1c')],_0x272d0d=_0x5c8327['offset'],_0x38884a=_0x5c8327[_0xc160('0x1d')]+_0x5c8327[_0xc160('0x1e')],_0x177085;if(_0x38884a>=_0xae6b66){_0x38884a=_0xae6b66;_0x177085=0xc8;}else{_0x177085=0xce;}_0x4a5e16['status'](_0x177085);return _0x4a5e16['set']('Content-Range',_0x272d0d+'-'+_0x38884a+'/'+_0xae6b66)[_0xc160('0x1b')](_0x1481af);}return null;};}function patchUpdates(_0x60db49){return function(_0x3be33f){try{jsonpatch[_0xc160('0x1f')](_0x3be33f,_0x60db49,!![]);}catch(_0x219a8f){return BPromise[_0xc160('0x20')](_0x219a8f);}return _0x3be33f[_0xc160('0x21')]();};}function saveUpdates(_0x4f45a1,_0x27e9fc){return function(_0x56c631){if(_0x56c631){return _0x56c631[_0xc160('0x22')](_0x4f45a1)['then'](function(_0x56c958){return _0x56c958;});}return null;};}function removeEntity(_0x1f8b56,_0x134124){return function(_0x12d329){if(_0x12d329){return _0x12d329[_0xc160('0x23')]()[_0xc160('0x24')](function(){var _0x57330e=_0x12d329['get']({'plain':!![]});var _0x4f3323=_0xc160('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x4f3323,'resourceId':_0x57330e['id']}})['then'](function(){return _0x12d329;});})[_0xc160('0x24')](function(){_0x1f8b56[_0xc160('0x19')](0xcc)[_0xc160('0x1a')]();});}};}function handleEntityNotFound(_0x8fe442,_0x1162c0){return function(_0x484a20){if(!_0x484a20){_0x8fe442[_0xc160('0x26')](0x194);}return _0x484a20;};}function handleError(_0x150a1a,_0x5a6acb){_0x5a6acb=_0x5a6acb||0x1f4;return function(_0xf9e4bc){logger[_0xc160('0x27')](_0xf9e4bc['stack']);if(_0xf9e4bc[_0xc160('0x28')]){delete _0xf9e4bc[_0xc160('0x28')];}_0x150a1a[_0xc160('0x19')](_0x5a6acb)[_0xc160('0x29')](_0xf9e4bc);};}exports['index']=function(_0x362c8b,_0x2b414f){var _0x29c507={},_0x57d418={},_0x5252e5={'count':0x0,'rows':[]};var _0x49b4fc=_['map'](db['Tag'][_0xc160('0x2a')],function(_0x33bcc7){return{'name':_0x33bcc7[_0xc160('0x2b')],'type':_0x33bcc7['type'][_0xc160('0x2c')]};});_0x57d418[_0xc160('0x2d')]=_[_0xc160('0x2e')](_0x49b4fc,_0xc160('0x28'));_0x57d418[_0xc160('0x2f')]=_['keys'](_0x362c8b[_0xc160('0x2f')]);_0x57d418[_0xc160('0x30')]=_[_0xc160('0x31')](_0x57d418['model'],_0x57d418['query']);_0x29c507[_0xc160('0x32')]=_[_0xc160('0x31')](_0x57d418[_0xc160('0x2d')],qs[_0xc160('0x33')](_0x362c8b[_0xc160('0x2f')][_0xc160('0x33')]));_0x29c507[_0xc160('0x32')]=_0x29c507[_0xc160('0x32')][_0xc160('0x34')]?_0x29c507[_0xc160('0x32')]:_0x57d418[_0xc160('0x2d')];if(!_0x362c8b[_0xc160('0x2f')][_0xc160('0x35')](_0xc160('0x36'))){_0x29c507[_0xc160('0x1e')]=qs['limit'](_0x362c8b['query']['limit']);_0x29c507[_0xc160('0x1d')]=qs['offset'](_0x362c8b[_0xc160('0x2f')][_0xc160('0x1d')]);}_0x29c507[_0xc160('0x37')]=qs['sort'](_0x362c8b[_0xc160('0x2f')][_0xc160('0x38')]);_0x29c507[_0xc160('0x39')]=qs[_0xc160('0x30')](_[_0xc160('0x3a')](_0x362c8b['query'],_0x57d418[_0xc160('0x30')]));if(_0x362c8b[_0xc160('0x2f')][_0xc160('0x3b')]){_0x29c507[_0xc160('0x39')]=_[_0xc160('0x3c')](_0x29c507[_0xc160('0x39')],{'$or':_[_0xc160('0x2e')](_0x49b4fc,function(_0x4757a2){if(_0x4757a2['type']!==_0xc160('0x3d')){var _0x356bc8={};_0x356bc8[_0x4757a2[_0xc160('0x28')]]={'$like':'%'+_0x362c8b[_0xc160('0x2f')][_0xc160('0x3b')]+'%'};return _0x356bc8;}})});}_0x29c507=_[_0xc160('0x3c')]({},_0x29c507,_0x362c8b[_0xc160('0x3e')]);var _0x416a3f={'where':_0x29c507[_0xc160('0x39')]};return db[_0xc160('0x3f')][_0xc160('0x1c')](_0x416a3f)['then'](function(_0x355f46){_0x5252e5[_0xc160('0x1c')]=_0x355f46;if(_0x362c8b[_0xc160('0x2f')][_0xc160('0x40')]){_0x29c507[_0xc160('0x41')]=[{'all':!![]}];}return db['Tag'][_0xc160('0x42')](_0x29c507);})[_0xc160('0x24')](function(_0x5081c6){_0x5252e5[_0xc160('0x43')]=_0x5081c6;return _0x5252e5;})[_0xc160('0x24')](respondWithFilteredResult(_0x2b414f,_0x29c507))[_0xc160('0x44')](handleError(_0x2b414f,null));};exports[_0xc160('0x45')]=function(_0x3f487e,_0xb72e3b){var _0x349a0d={'raw':!![],'where':{'id':_0x3f487e[_0xc160('0x46')]['id']}},_0x892eba={};_0x892eba['model']=_['keys'](db['Tag'][_0xc160('0x2a')]);_0x892eba[_0xc160('0x2f')]=_[_0xc160('0x47')](_0x3f487e[_0xc160('0x2f')]);_0x892eba[_0xc160('0x30')]=_[_0xc160('0x31')](_0x892eba[_0xc160('0x2d')],_0x892eba['query']);_0x349a0d[_0xc160('0x32')]=_[_0xc160('0x31')](_0x892eba[_0xc160('0x2d')],qs[_0xc160('0x33')](_0x3f487e[_0xc160('0x2f')][_0xc160('0x33')]));_0x349a0d[_0xc160('0x32')]=_0x349a0d[_0xc160('0x32')][_0xc160('0x34')]?_0x349a0d['attributes']:_0x892eba[_0xc160('0x2d')];if(_0x3f487e['query']['includeAll']){_0x349a0d[_0xc160('0x41')]=[{'all':!![]}];}_0x349a0d=_['merge']({},_0x349a0d,_0x3f487e[_0xc160('0x3e')]);return db[_0xc160('0x3f')][_0xc160('0x48')](_0x349a0d)[_0xc160('0x24')](handleEntityNotFound(_0xb72e3b,null))[_0xc160('0x24')](respondWithResult(_0xb72e3b,null))[_0xc160('0x44')](handleError(_0xb72e3b,null));};exports['create']=function(_0x9f7650,_0x5b7e7a){return db[_0xc160('0x3f')][_0xc160('0x49')](_0x9f7650[_0xc160('0x4a')],{})['then'](function(_0x417c5c){var _0x3aac04=_0x9f7650[_0xc160('0x4b')]['get']({'plain':!![]});if(!_0x3aac04)throw new Error(_0xc160('0x4c'));if(_0x3aac04['role']===_0xc160('0x4b')){var _0x38186a=_0x417c5c[_0xc160('0x4d')]({'plain':!![]});var _0x3512cb='Tags';return db[_0xc160('0x4e')]['find']({'where':{'name':_0x3512cb,'userProfileId':_0x3aac04['userProfileId']},'raw':!![]})[_0xc160('0x24')](function(_0x290f33){if(_0x290f33&&_0x290f33[_0xc160('0x4f')]===0x0){return db[_0xc160('0x50')][_0xc160('0x49')]({'name':_0x38186a[_0xc160('0x28')],'resourceId':_0x38186a['id'],'type':_0x290f33[_0xc160('0x28')],'sectionId':_0x290f33['id']},{})['then'](function(){return _0x417c5c;});}else{return _0x417c5c;}})[_0xc160('0x44')](function(_0x279c2b){logger[_0xc160('0x27')](_0xc160('0x51'),_0x279c2b);throw _0x279c2b;});}return _0x417c5c;})[_0xc160('0x24')](respondWithResult(_0x5b7e7a,0xc9))['catch'](handleError(_0x5b7e7a,null));};exports[_0xc160('0x22')]=function(_0x278fe0,_0x12bfe8){if(_0x278fe0[_0xc160('0x4a')]['id']){delete _0x278fe0['body']['id'];}return db[_0xc160('0x3f')][_0xc160('0x48')]({'where':{'id':_0x278fe0['params']['id']}})[_0xc160('0x24')](handleEntityNotFound(_0x12bfe8,null))[_0xc160('0x24')](saveUpdates(_0x278fe0[_0xc160('0x4a')],null))['then'](respondWithResult(_0x12bfe8,null))[_0xc160('0x44')](handleError(_0x12bfe8,null));};exports[_0xc160('0x23')]=function(_0x36e6dd,_0x2642a2){return db['Tag'][_0xc160('0x48')]({'where':{'id':_0x36e6dd[_0xc160('0x46')]['id']}})[_0xc160('0x24')](handleEntityNotFound(_0x2642a2,null))[_0xc160('0x24')](removeEntity(_0x2642a2,null))[_0xc160('0x44')](handleError(_0x2642a2,null));}; \ No newline at end of file +var _0x8b3f=['squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','get','Tags','error','name','send','index','Tag','rawAttributes','fieldName','type','keys','intersection','model','query','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','includeAll','rows','catch','show','params','find','create','user','role','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs'];(function(_0x51a75f,_0x219eba){var _0x2ecef4=function(_0x178f12){while(--_0x178f12){_0x51a75f['push'](_0x51a75f['shift']());}};_0x2ecef4(++_0x219eba);}(_0x8b3f,0x8e));var _0xf8b3=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x8b3f[_0x2641f9];return _0x585741;};'use strict';var pdf=require(_0xf8b3('0x0'));var emlformat=require(_0xf8b3('0x1'));var rimraf=require(_0xf8b3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf8b3('0x3'));var rp=require(_0xf8b3('0x4'));var moment=require(_0xf8b3('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf8b3('0x6'));var util=require(_0xf8b3('0x7'));var path=require(_0xf8b3('0x8'));var sox=require(_0xf8b3('0x9'));var csv=require(_0xf8b3('0xa'));var ejs=require(_0xf8b3('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf8b3('0xc'));var crypto=require(_0xf8b3('0xd'));var jsforce=require(_0xf8b3('0xe'));var deskjs=require(_0xf8b3('0xf'));var toCsv=require(_0xf8b3('0xa'));var querystring=require(_0xf8b3('0x10'));var Papa=require(_0xf8b3('0x11'));var Redis=require('ioredis');var authService=require(_0xf8b3('0x12'));var qs=require(_0xf8b3('0x13'));var as=require(_0xf8b3('0x14'));var hardwareService=require(_0xf8b3('0x15'));var logger=require(_0xf8b3('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xf8b3('0x17'));var db=require(_0xf8b3('0x18'))['db'];function respondWithStatusCode(_0x1a632d,_0x44900d){_0x44900d=_0x44900d||0xcc;return function(_0x5ee179){if(_0x5ee179){return _0x1a632d['sendStatus'](_0x44900d);}return _0x1a632d[_0xf8b3('0x19')](_0x44900d)[_0xf8b3('0x1a')]();};}function respondWithResult(_0x31934e,_0x18cc54){_0x18cc54=_0x18cc54||0xc8;return function(_0x47517b){if(_0x47517b){return _0x31934e[_0xf8b3('0x19')](_0x18cc54)[_0xf8b3('0x1b')](_0x47517b);}};}function respondWithFilteredResult(_0x2b7f0e,_0x341082){return function(_0x2c005e){if(_0x2c005e){var _0x4b0140=_0x2c005e[_0xf8b3('0x1c')],_0x455310=_0x341082['offset'],_0x5c0aba=_0x341082[_0xf8b3('0x1d')]+_0x341082[_0xf8b3('0x1e')],_0x581bb4;if(_0x5c0aba>=_0x4b0140){_0x5c0aba=_0x4b0140;_0x581bb4=0xc8;}else{_0x581bb4=0xce;}_0x2b7f0e['status'](_0x581bb4);return _0x2b7f0e[_0xf8b3('0x1f')](_0xf8b3('0x20'),_0x455310+'-'+_0x5c0aba+'/'+_0x4b0140)[_0xf8b3('0x1b')](_0x2c005e);}return null;};}function patchUpdates(_0x292661){return function(_0x493a85){try{jsonpatch['apply'](_0x493a85,_0x292661,!![]);}catch(_0x5bafa2){return BPromise['reject'](_0x5bafa2);}return _0x493a85[_0xf8b3('0x21')]();};}function saveUpdates(_0x38f5fc,_0xf8acb1){return function(_0x1a8644){if(_0x1a8644){return _0x1a8644[_0xf8b3('0x22')](_0x38f5fc)[_0xf8b3('0x23')](function(_0x5b0dfc){return _0x5b0dfc;});}return null;};}function removeEntity(_0x2c0652,_0x54f3ea){return function(_0x4db6d3){if(_0x4db6d3){return _0x4db6d3[_0xf8b3('0x24')]()[_0xf8b3('0x23')](function(){var _0x5d5014=_0x4db6d3[_0xf8b3('0x25')]({'plain':!![]});var _0x4fee25=_0xf8b3('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x4fee25,'resourceId':_0x5d5014['id']}})[_0xf8b3('0x23')](function(){return _0x4db6d3;});})[_0xf8b3('0x23')](function(){_0x2c0652[_0xf8b3('0x19')](0xcc)[_0xf8b3('0x1a')]();});}};}function handleEntityNotFound(_0x43c218,_0x4048ea){return function(_0x5893bd){if(!_0x5893bd){_0x43c218['sendStatus'](0x194);}return _0x5893bd;};}function handleError(_0x374ee6,_0x3ffe75){_0x3ffe75=_0x3ffe75||0x1f4;return function(_0x11dbec){logger[_0xf8b3('0x27')](_0x11dbec['stack']);if(_0x11dbec[_0xf8b3('0x28')]){delete _0x11dbec[_0xf8b3('0x28')];}_0x374ee6[_0xf8b3('0x19')](_0x3ffe75)[_0xf8b3('0x29')](_0x11dbec);};}exports[_0xf8b3('0x2a')]=function(_0x5eecb5,_0x30e911){var _0x44d0d7={},_0x888194={},_0x3a8597={'count':0x0,'rows':[]};var _0x13bbd8=_['map'](db[_0xf8b3('0x2b')][_0xf8b3('0x2c')],function(_0x41c443){return{'name':_0x41c443[_0xf8b3('0x2d')],'type':_0x41c443[_0xf8b3('0x2e')]['key']};});_0x888194['model']=_['map'](_0x13bbd8,_0xf8b3('0x28'));_0x888194['query']=_[_0xf8b3('0x2f')](_0x5eecb5['query']);_0x888194['filters']=_[_0xf8b3('0x30')](_0x888194[_0xf8b3('0x31')],_0x888194[_0xf8b3('0x32')]);_0x44d0d7['attributes']=_[_0xf8b3('0x30')](_0x888194[_0xf8b3('0x31')],qs[_0xf8b3('0x33')](_0x5eecb5['query'][_0xf8b3('0x33')]));_0x44d0d7['attributes']=_0x44d0d7[_0xf8b3('0x34')]['length']?_0x44d0d7['attributes']:_0x888194[_0xf8b3('0x31')];if(!_0x5eecb5[_0xf8b3('0x32')][_0xf8b3('0x35')](_0xf8b3('0x36'))){_0x44d0d7[_0xf8b3('0x1e')]=qs[_0xf8b3('0x1e')](_0x5eecb5[_0xf8b3('0x32')][_0xf8b3('0x1e')]);_0x44d0d7[_0xf8b3('0x1d')]=qs[_0xf8b3('0x1d')](_0x5eecb5[_0xf8b3('0x32')][_0xf8b3('0x1d')]);}_0x44d0d7[_0xf8b3('0x37')]=qs[_0xf8b3('0x38')](_0x5eecb5[_0xf8b3('0x32')][_0xf8b3('0x38')]);_0x44d0d7[_0xf8b3('0x39')]=qs[_0xf8b3('0x3a')](_[_0xf8b3('0x3b')](_0x5eecb5[_0xf8b3('0x32')],_0x888194['filters']));if(_0x5eecb5[_0xf8b3('0x32')][_0xf8b3('0x3c')]){_0x44d0d7['where']=_[_0xf8b3('0x3d')](_0x44d0d7[_0xf8b3('0x39')],{'$or':_[_0xf8b3('0x3e')](_0x13bbd8,function(_0x41c828){if(_0x41c828['type']!==_0xf8b3('0x3f')){var _0x24938d={};_0x24938d[_0x41c828[_0xf8b3('0x28')]]={'$like':'%'+_0x5eecb5['query'][_0xf8b3('0x3c')]+'%'};return _0x24938d;}})});}_0x44d0d7=_[_0xf8b3('0x3d')]({},_0x44d0d7,_0x5eecb5['options']);var _0x3f0cfb={'where':_0x44d0d7['where']};return db[_0xf8b3('0x2b')]['count'](_0x3f0cfb)[_0xf8b3('0x23')](function(_0x24aef0){_0x3a8597[_0xf8b3('0x1c')]=_0x24aef0;if(_0x5eecb5[_0xf8b3('0x32')][_0xf8b3('0x40')]){_0x44d0d7['include']=[{'all':!![]}];}return db['Tag']['findAll'](_0x44d0d7);})[_0xf8b3('0x23')](function(_0x5a879d){_0x3a8597[_0xf8b3('0x41')]=_0x5a879d;return _0x3a8597;})[_0xf8b3('0x23')](respondWithFilteredResult(_0x30e911,_0x44d0d7))[_0xf8b3('0x42')](handleError(_0x30e911,null));};exports[_0xf8b3('0x43')]=function(_0x2b8807,_0xd877e7){var _0x302ce8={'raw':!![],'where':{'id':_0x2b8807[_0xf8b3('0x44')]['id']}},_0x2bd1ff={};_0x2bd1ff[_0xf8b3('0x31')]=_['keys'](db[_0xf8b3('0x2b')][_0xf8b3('0x2c')]);_0x2bd1ff[_0xf8b3('0x32')]=_[_0xf8b3('0x2f')](_0x2b8807[_0xf8b3('0x32')]);_0x2bd1ff[_0xf8b3('0x3a')]=_[_0xf8b3('0x30')](_0x2bd1ff['model'],_0x2bd1ff[_0xf8b3('0x32')]);_0x302ce8[_0xf8b3('0x34')]=_[_0xf8b3('0x30')](_0x2bd1ff[_0xf8b3('0x31')],qs['fields'](_0x2b8807[_0xf8b3('0x32')][_0xf8b3('0x33')]));_0x302ce8[_0xf8b3('0x34')]=_0x302ce8[_0xf8b3('0x34')]['length']?_0x302ce8[_0xf8b3('0x34')]:_0x2bd1ff[_0xf8b3('0x31')];if(_0x2b8807[_0xf8b3('0x32')][_0xf8b3('0x40')]){_0x302ce8['include']=[{'all':!![]}];}_0x302ce8=_['merge']({},_0x302ce8,_0x2b8807['options']);return db[_0xf8b3('0x2b')][_0xf8b3('0x45')](_0x302ce8)['then'](handleEntityNotFound(_0xd877e7,null))[_0xf8b3('0x23')](respondWithResult(_0xd877e7,null))[_0xf8b3('0x42')](handleError(_0xd877e7,null));};exports[_0xf8b3('0x46')]=function(_0x5e5520,_0x4d25b4){return db[_0xf8b3('0x2b')]['create'](_0x5e5520['body'],{})[_0xf8b3('0x23')](function(_0x449662){var _0x44a743=_0x5e5520[_0xf8b3('0x47')][_0xf8b3('0x25')]({'plain':!![]});if(!_0x44a743)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x44a743[_0xf8b3('0x48')]===_0xf8b3('0x47')){var _0x2eb405=_0x449662[_0xf8b3('0x25')]({'plain':!![]});var _0xbca357='Tags';return db['UserProfileSection'][_0xf8b3('0x45')]({'where':{'name':_0xbca357,'userProfileId':_0x44a743[_0xf8b3('0x49')]},'raw':!![]})['then'](function(_0xa42b22){if(_0xa42b22&&_0xa42b22['autoAssociation']===0x0){return db[_0xf8b3('0x4a')][_0xf8b3('0x46')]({'name':_0x2eb405[_0xf8b3('0x28')],'resourceId':_0x2eb405['id'],'type':_0xa42b22[_0xf8b3('0x28')],'sectionId':_0xa42b22['id']},{})['then'](function(){return _0x449662;});}else{return _0x449662;}})[_0xf8b3('0x42')](function(_0x3bd768){logger[_0xf8b3('0x27')](_0xf8b3('0x4b'),_0x3bd768);throw _0x3bd768;});}return _0x449662;})[_0xf8b3('0x23')](respondWithResult(_0x4d25b4,0xc9))[_0xf8b3('0x42')](handleError(_0x4d25b4,null));};exports[_0xf8b3('0x22')]=function(_0x3ee7c9,_0x6e226c){if(_0x3ee7c9[_0xf8b3('0x4c')]['id']){delete _0x3ee7c9[_0xf8b3('0x4c')]['id'];}return db[_0xf8b3('0x2b')]['find']({'where':{'id':_0x3ee7c9[_0xf8b3('0x44')]['id']}})['then'](handleEntityNotFound(_0x6e226c,null))[_0xf8b3('0x23')](saveUpdates(_0x3ee7c9[_0xf8b3('0x4c')],null))[_0xf8b3('0x23')](respondWithResult(_0x6e226c,null))[_0xf8b3('0x42')](handleError(_0x6e226c,null));};exports['destroy']=function(_0x3661f0,_0xaf9bba){return db[_0xf8b3('0x2b')][_0xf8b3('0x45')]({'where':{'id':_0x3661f0[_0xf8b3('0x44')]['id']}})[_0xf8b3('0x23')](handleEntityNotFound(_0xaf9bba,null))[_0xf8b3('0x23')](removeEntity(_0xaf9bba,null))['catch'](handleError(_0xaf9bba,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 820375a..abdf96b 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 _0xbdfb=['Tag','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x1b2473,_0x1996e5){var _0x3defa2=function(_0x2603a7){while(--_0x2603a7){_0x1b2473['push'](_0x1b2473['shift']());}};_0x3defa2(++_0x1996e5);}(_0xbdfb,0x1ef));var _0xbbdf=function(_0x352d28,_0x444033){_0x352d28=_0x352d28-0x0;var _0x387d7e=_0xbdfb[_0x352d28];return _0x387d7e;};'use strict';var _=require(_0xbbdf('0x0'));var util=require(_0xbbdf('0x1'));var logger=require(_0xbbdf('0x2'))(_0xbbdf('0x3'));var moment=require(_0xbbdf('0x4'));var BPromise=require(_0xbbdf('0x5'));var rp=require(_0xbbdf('0x6'));var fs=require('fs');var path=require(_0xbbdf('0x7'));var rimraf=require(_0xbbdf('0x8'));var config=require(_0xbbdf('0x9'));var attributes=require('./tag.attributes');module[_0xbbdf('0xa')]=function(_0x3184ff,_0x54d048){return _0x3184ff[_0xbbdf('0xb')](_0xbbdf('0xc'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd49=['../../config/environment','./tag.attributes','tools_tags','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x1ea67e,_0x2f43c5){var _0x1d05fa=function(_0x18c1c5){while(--_0x18c1c5){_0x1ea67e['push'](_0x1ea67e['shift']());}};_0x1d05fa(++_0x2f43c5);}(_0xfd49,0x121));var _0x9fd4=function(_0xf66a57,_0x33033f){_0xf66a57=_0xf66a57-0x0;var _0x1ec530=_0xfd49[_0xf66a57];return _0x1ec530;};'use strict';var _=require(_0x9fd4('0x0'));var util=require(_0x9fd4('0x1'));var logger=require(_0x9fd4('0x2'))(_0x9fd4('0x3'));var moment=require(_0x9fd4('0x4'));var BPromise=require('bluebird');var rp=require(_0x9fd4('0x5'));var fs=require('fs');var path=require(_0x9fd4('0x6'));var rimraf=require(_0x9fd4('0x7'));var config=require(_0x9fd4('0x8'));var attributes=require(_0x9fd4('0x9'));module['exports']=function(_0x5d8420,_0x89e59b){return _0x5d8420['define']('Tag',attributes,{'tableName':_0x9fd4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 8b9ce23..ac2893c 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 _0x579c=['message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','debug','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x3d67c6,_0x481f96){var _0xcaf28b=function(_0x8d34e1){while(--_0x8d34e1){_0x3d67c6['push'](_0x3d67c6['shift']());}};_0xcaf28b(++_0x481f96);}(_0x579c,0xda));var _0xc579=function(_0x1d0567,_0x1af6c7){_0x1d0567=_0x1d0567-0x0;var _0x50774b=_0x579c[_0x1d0567];return _0x50774b;};'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 +var _0x13f6=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','Tag,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','lodash','util'];(function(_0x1977c2,_0x19446a){var _0x1f591c=function(_0x33d69d){while(--_0x33d69d){_0x1977c2['push'](_0x1977c2['shift']());}};_0x1f591c(++_0x19446a);}(_0x13f6,0x124));var _0x613f=function(_0x4a4c6d,_0x41392c){_0x4a4c6d=_0x4a4c6d-0x0;var _0x1f3713=_0x13f6[_0x4a4c6d];return _0x1f3713;};'use strict';var _=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x613f('0x2'));var fs=require('fs');var Redis=require(_0x613f('0x3'));var db=require(_0x613f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x613f('0x5'))(_0x613f('0x6'));var config=require(_0x613f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x613f('0x8')][_0x613f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5618fa,_0x4b546b,_0x5a84f2){return new BPromise(function(_0x5c93c0,_0x2d5973){return client[_0x613f('0xa')](_0x5618fa,_0x5a84f2)[_0x613f('0xb')](function(_0x35b672){logger['info'](_0x613f('0xc'),_0x4b546b,_0x613f('0xd'));logger[_0x613f('0xe')]('Tag,\x20%s,\x20%s,\x20%s',_0x4b546b,_0x613f('0xd'),JSON[_0x613f('0xf')](_0x35b672));if(_0x35b672[_0x613f('0x10')]){if(_0x35b672['error'][_0x613f('0x11')]===0x1f4){logger[_0x613f('0x10')]('Tag,\x20%s,\x20%s',_0x4b546b,_0x35b672['error']['message']);return _0x2d5973(_0x35b672[_0x613f('0x10')][_0x613f('0x12')]);}logger[_0x613f('0x10')](_0x613f('0xc'),_0x4b546b,_0x35b672[_0x613f('0x10')][_0x613f('0x12')]);return _0x5c93c0(_0x35b672[_0x613f('0x10')][_0x613f('0x12')]);}else{logger[_0x613f('0x13')](_0x613f('0xc'),_0x4b546b,'request\x20sent');_0x5c93c0(_0x35b672[_0x613f('0x14')]['message']);}})['catch'](function(_0x1bc605){logger[_0x613f('0x10')]('Tag,\x20%s,\x20%s',_0x4b546b,_0x1bc605);_0x2d5973(_0x1bc605);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 75c69ea..bc9d0fe 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 _0xda0f=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./team.controller','isAuthenticated','index','get','/:id','show','getQueues','/:id/users','getAgents','post','create','/:id/queues','addQueues','addAgents','put','delete','destroy','removeQueues','removeAgents','exports','multer','util'];(function(_0x270061,_0x4e41e1){var _0x329604=function(_0x719737){while(--_0x719737){_0x270061['push'](_0x270061['shift']());}};_0x329604(++_0x4e41e1);}(_0xda0f,0xde));var _0xfda0=function(_0x199973,_0x5b279f){_0x199973=_0x199973-0x0;var _0x1b1646=_0xda0f[_0x199973];return _0x1b1646;};'use strict';var multer=require(_0xfda0('0x0'));var util=require(_0xfda0('0x1'));var path=require(_0xfda0('0x2'));var timeout=require(_0xfda0('0x3'));var express=require(_0xfda0('0x4'));var router=express[_0xfda0('0x5')]();var auth=require(_0xfda0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfda0('0x7'));var controller=require(_0xfda0('0x8'));router['get']('/',auth[_0xfda0('0x9')](),controller[_0xfda0('0xa')]);router[_0xfda0('0xb')](_0xfda0('0xc'),auth[_0xfda0('0x9')](),controller[_0xfda0('0xd')]);router[_0xfda0('0xb')]('/:id/queues',auth[_0xfda0('0x9')](),controller[_0xfda0('0xe')]);router[_0xfda0('0xb')](_0xfda0('0xf'),auth['isAuthenticated'](),controller[_0xfda0('0x10')]);router[_0xfda0('0x11')]('/',auth[_0xfda0('0x9')](),controller[_0xfda0('0x12')]);router['post'](_0xfda0('0x13'),auth[_0xfda0('0x9')](),controller[_0xfda0('0x14')]);router[_0xfda0('0x11')](_0xfda0('0xf'),auth[_0xfda0('0x9')](),controller[_0xfda0('0x15')]);router[_0xfda0('0x16')](_0xfda0('0xc'),auth[_0xfda0('0x9')](),controller['update']);router[_0xfda0('0x17')](_0xfda0('0xc'),auth[_0xfda0('0x9')](),controller[_0xfda0('0x18')]);router[_0xfda0('0x17')]('/:id/queues',auth[_0xfda0('0x9')](),controller[_0xfda0('0x19')]);router['delete'](_0xfda0('0xf'),auth[_0xfda0('0x9')](),controller[_0xfda0('0x1a')]);module[_0xfda0('0x1b')]=router; \ No newline at end of file +var _0xe369=['/:id','show','/:id/queues','getQueues','/:id/users','getAgents','create','addQueues','post','addAgents','put','delete','destroy','removeQueues','removeAgents','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','./team.controller','get','isAuthenticated'];(function(_0x257b0e,_0x563d7e){var _0x27ac2a=function(_0x3a4bbc){while(--_0x3a4bbc){_0x257b0e['push'](_0x257b0e['shift']());}};_0x27ac2a(++_0x563d7e);}(_0xe369,0x16e));var _0x9e36=function(_0x90bc48,_0xc4750e){_0x90bc48=_0x90bc48-0x0;var _0x3c090c=_0xe369[_0x90bc48];return _0x3c090c;};'use strict';var multer=require(_0x9e36('0x0'));var util=require(_0x9e36('0x1'));var path=require(_0x9e36('0x2'));var timeout=require(_0x9e36('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x9e36('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9e36('0x5'));var controller=require(_0x9e36('0x6'));router[_0x9e36('0x7')]('/',auth[_0x9e36('0x8')](),controller['index']);router[_0x9e36('0x7')](_0x9e36('0x9'),auth[_0x9e36('0x8')](),controller[_0x9e36('0xa')]);router[_0x9e36('0x7')](_0x9e36('0xb'),auth[_0x9e36('0x8')](),controller[_0x9e36('0xc')]);router['get'](_0x9e36('0xd'),auth[_0x9e36('0x8')](),controller[_0x9e36('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9e36('0xf')]);router['post']('/:id/queues',auth[_0x9e36('0x8')](),controller[_0x9e36('0x10')]);router[_0x9e36('0x11')]('/:id/users',auth[_0x9e36('0x8')](),controller[_0x9e36('0x12')]);router[_0x9e36('0x13')](_0x9e36('0x9'),auth[_0x9e36('0x8')](),controller['update']);router[_0x9e36('0x14')]('/:id',auth[_0x9e36('0x8')](),controller[_0x9e36('0x15')]);router[_0x9e36('0x14')]('/:id/queues',auth['isAuthenticated'](),controller[_0x9e36('0x16')]);router[_0x9e36('0x14')](_0x9e36('0xd'),auth[_0x9e36('0x8')](),controller[_0x9e36('0x17')]);module[_0x9e36('0x18')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 95aa0dc..36cb8ec 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 _0x301a=['exports','name','STRING','sequelize'];(function(_0xb9726c,_0x4fdbdd){var _0x58a29c=function(_0x220d0d){while(--_0x220d0d){_0xb9726c['push'](_0xb9726c['shift']());}};_0x58a29c(++_0x4fdbdd);}(_0x301a,0x1c3));var _0xa301=function(_0x442c29,_0x46a973){_0x442c29=_0x442c29-0x0;var _0x1f9524=_0x301a[_0x442c29];return _0x1f9524;};'use strict';var Sequelize=require(_0xa301('0x0'));module[_0xa301('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa301('0x2')},'description':{'type':Sequelize[_0xa301('0x3')]}}; \ No newline at end of file +var _0x090b=['STRING','name','exports'];(function(_0x49b78e,_0x4bd166){var _0xd7ba5b=function(_0x273a05){while(--_0x273a05){_0x49b78e['push'](_0x49b78e['shift']());}};_0xd7ba5b(++_0x4bd166);}(_0x090b,0x155));var _0xb090=function(_0x57cb39,_0x1fe405){_0x57cb39=_0x57cb39-0x0;var _0x90aa1e=_0x090b[_0x57cb39];return _0x90aa1e;};'use strict';var Sequelize=require('sequelize');module[_0xb090('0x0')]={'name':{'type':Sequelize[_0xb090('0x1')],'allowNull':![],'unique':_0xb090('0x2')},'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 b3cc174..94a4bdf 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 _0x3c32=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','limit','set','reject','save','then','destroy','get','Teams','UserProfileResource','error','stack','name','send','index','Team','type','key','model','map','query','keys','filters','fields','attributes','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','rawAttributes','intersection','find','create','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','getQueues','isValidChannel','Sequelize','Unknown\x20channel','toLowerCase','Queue','order','channel','Queues','addQueues','ValidationError','capitalize','ids','removeQueues','findOne','remove','addAgents','Voice','Chat','Mail','each','findAll','voicePause','interface','UserVoiceQueueRt','isNil','SIP/%s','omit','spread','userTeam:save','voice','mail','sms','fax','openchannel','removeAgents','isArray','userTeam:remove','emit','getAgents','User','hasOwnProperty','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x150af0,_0x20f67f){var _0x194f25=function(_0x18c81a){while(--_0x18c81a){_0x150af0['push'](_0x150af0['shift']());}};_0x194f25(++_0x20f67f);}(_0x3c32,0x161));var _0x23c3=function(_0x2634e9,_0x4b701c){_0x2634e9=_0x2634e9-0x0;var _0x46d5ee=_0x3c32[_0x2634e9];return _0x46d5ee;};'use strict';var pdf=require(_0x23c3('0x0'));var emlformat=require(_0x23c3('0x1'));var rimraf=require(_0x23c3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x23c3('0x3'));var rp=require(_0x23c3('0x4'));var moment=require(_0x23c3('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x23c3('0x6'));var util=require('util');var path=require(_0x23c3('0x7'));var sox=require(_0x23c3('0x8'));var csv=require(_0x23c3('0x9'));var ejs=require(_0x23c3('0xa'));var fs=require('fs');var _=require(_0x23c3('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x23c3('0xc'));var toCsv=require(_0x23c3('0x9'));var querystring=require(_0x23c3('0xd'));var Papa=require(_0x23c3('0xe'));var Redis=require(_0x23c3('0xf'));var authService=require(_0x23c3('0x10'));var qs=require(_0x23c3('0x11'));var as=require(_0x23c3('0x12'));var hardwareService=require(_0x23c3('0x13'));var logger=require(_0x23c3('0x14'))(_0x23c3('0x15'));var utils=require(_0x23c3('0x16'));var config=require(_0x23c3('0x17'));var db=require(_0x23c3('0x18'))['db'];config[_0x23c3('0x19')]=_[_0x23c3('0x1a')](config[_0x23c3('0x19')],{'host':_0x23c3('0x1b'),'port':0x18eb});var socket=require(_0x23c3('0x1c'))(new Redis(config[_0x23c3('0x19')]));require('./team.socket')['register'](socket);function respondWithStatusCode(_0x22a034,_0x38a11a){_0x38a11a=_0x38a11a||0xcc;return function(_0x4192bf){if(_0x4192bf){return _0x22a034[_0x23c3('0x1d')](_0x38a11a);}return _0x22a034[_0x23c3('0x1e')](_0x38a11a)[_0x23c3('0x1f')]();};}function respondWithResult(_0x16b80c,_0x51e880){_0x51e880=_0x51e880||0xc8;return function(_0x4f65f8){if(_0x4f65f8){return _0x16b80c[_0x23c3('0x1e')](_0x51e880)[_0x23c3('0x20')](_0x4f65f8);}};}function respondWithFilteredResult(_0x5a0eba,_0x4737e4){return function(_0x2d63e2){if(_0x2d63e2){var _0x20a8b7=_0x2d63e2['count'],_0x1456a3=_0x4737e4[_0x23c3('0x21')],_0x25880d=_0x4737e4[_0x23c3('0x21')]+_0x4737e4[_0x23c3('0x22')],_0x18990f;if(_0x25880d>=_0x20a8b7){_0x25880d=_0x20a8b7;_0x18990f=0xc8;}else{_0x18990f=0xce;}_0x5a0eba['status'](_0x18990f);return _0x5a0eba[_0x23c3('0x23')]('Content-Range',_0x1456a3+'-'+_0x25880d+'/'+_0x20a8b7)['json'](_0x2d63e2);}return null;};}function patchUpdates(_0x338d5a){return function(_0x584f90){try{jsonpatch['apply'](_0x584f90,_0x338d5a,!![]);}catch(_0x21c133){return BPromise[_0x23c3('0x24')](_0x21c133);}return _0x584f90[_0x23c3('0x25')]();};}function saveUpdates(_0x381aee,_0x5c5993){return function(_0x47067e){if(_0x47067e){return _0x47067e['update'](_0x381aee)[_0x23c3('0x26')](function(_0x238d27){return _0x238d27;});}return null;};}function removeEntity(_0x30fe87,_0x1210a4){return function(_0x576c20){if(_0x576c20){return _0x576c20[_0x23c3('0x27')]()[_0x23c3('0x26')](function(){var _0x4968d5=_0x576c20[_0x23c3('0x28')]({'plain':!![]});var _0x27cd14=_0x23c3('0x29');return db[_0x23c3('0x2a')][_0x23c3('0x27')]({'where':{'type':_0x27cd14,'resourceId':_0x4968d5['id']}})['then'](function(){return _0x576c20;});})[_0x23c3('0x26')](function(){_0x30fe87[_0x23c3('0x1e')](0xcc)[_0x23c3('0x1f')]();});}};}function handleEntityNotFound(_0x1c958a,_0xa520fc){return function(_0x32b6f1){if(!_0x32b6f1){_0x1c958a[_0x23c3('0x1d')](0x194);}return _0x32b6f1;};}function handleError(_0x2a1b2c,_0x856e72){_0x856e72=_0x856e72||0x1f4;return function(_0x347ef8){logger[_0x23c3('0x2b')](_0x347ef8[_0x23c3('0x2c')]);if(_0x347ef8[_0x23c3('0x2d')]){delete _0x347ef8[_0x23c3('0x2d')];}_0x2a1b2c[_0x23c3('0x1e')](_0x856e72)[_0x23c3('0x2e')](_0x347ef8);};}exports[_0x23c3('0x2f')]=function(_0x28af56,_0x12b8be){var _0xd732d7={},_0x1bc3ce={},_0x47abc5={'count':0x0,'rows':[]};var _0x5411dc=_['map'](db[_0x23c3('0x30')]['rawAttributes'],function(_0x218b84){return{'name':_0x218b84['fieldName'],'type':_0x218b84[_0x23c3('0x31')][_0x23c3('0x32')]};});_0x1bc3ce[_0x23c3('0x33')]=_[_0x23c3('0x34')](_0x5411dc,_0x23c3('0x2d'));_0x1bc3ce[_0x23c3('0x35')]=_[_0x23c3('0x36')](_0x28af56['query']);_0x1bc3ce[_0x23c3('0x37')]=_['intersection'](_0x1bc3ce[_0x23c3('0x33')],_0x1bc3ce[_0x23c3('0x35')]);_0xd732d7['attributes']=_['intersection'](_0x1bc3ce['model'],qs[_0x23c3('0x38')](_0x28af56[_0x23c3('0x35')][_0x23c3('0x38')]));_0xd732d7['attributes']=_0xd732d7[_0x23c3('0x39')][_0x23c3('0x3a')]?_0xd732d7[_0x23c3('0x39')]:_0x1bc3ce[_0x23c3('0x33')];if(!_0x28af56[_0x23c3('0x35')]['hasOwnProperty'](_0x23c3('0x3b'))){_0xd732d7[_0x23c3('0x22')]=qs[_0x23c3('0x22')](_0x28af56['query']['limit']);_0xd732d7[_0x23c3('0x21')]=qs[_0x23c3('0x21')](_0x28af56[_0x23c3('0x35')][_0x23c3('0x21')]);}_0xd732d7['order']=qs[_0x23c3('0x3c')](_0x28af56[_0x23c3('0x35')][_0x23c3('0x3c')]);_0xd732d7[_0x23c3('0x3d')]=qs[_0x23c3('0x37')](_[_0x23c3('0x3e')](_0x28af56['query'],_0x1bc3ce['filters']));if(_0x28af56[_0x23c3('0x35')]['filter']){_0xd732d7[_0x23c3('0x3d')]=_[_0x23c3('0x3f')](_0xd732d7[_0x23c3('0x3d')],{'$or':_[_0x23c3('0x34')](_0x5411dc,function(_0x16e40f){if(_0x16e40f[_0x23c3('0x31')]!==_0x23c3('0x40')){var _0x373036={};_0x373036[_0x16e40f[_0x23c3('0x2d')]]={'$like':'%'+_0x28af56[_0x23c3('0x35')][_0x23c3('0x41')]+'%'};return _0x373036;}})});}_0xd732d7=_[_0x23c3('0x3f')]({},_0xd732d7,_0x28af56[_0x23c3('0x42')]);var _0x155245={'where':_0xd732d7[_0x23c3('0x3d')]};return db['Team']['count'](_0x155245)[_0x23c3('0x26')](function(_0x43388e){_0x47abc5['count']=_0x43388e;if(_0x28af56[_0x23c3('0x35')][_0x23c3('0x43')]){_0xd732d7[_0x23c3('0x44')]=[{'all':!![]}];}return db['Team']['findAll'](_0xd732d7);})[_0x23c3('0x26')](function(_0x25f42d){_0x47abc5[_0x23c3('0x45')]=_0x25f42d;return _0x47abc5;})[_0x23c3('0x26')](respondWithFilteredResult(_0x12b8be,_0xd732d7))[_0x23c3('0x46')](handleError(_0x12b8be,null));};exports[_0x23c3('0x47')]=function(_0x3bcaad,_0x33b393){var _0xef696c={'raw':![],'where':{'id':_0x3bcaad['params']['id']}},_0x5dfb33={};_0x5dfb33[_0x23c3('0x33')]=_['keys'](db[_0x23c3('0x30')][_0x23c3('0x48')]);_0x5dfb33['query']=_[_0x23c3('0x36')](_0x3bcaad[_0x23c3('0x35')]);_0x5dfb33[_0x23c3('0x37')]=_[_0x23c3('0x49')](_0x5dfb33[_0x23c3('0x33')],_0x5dfb33['query']);_0xef696c[_0x23c3('0x39')]=_[_0x23c3('0x49')](_0x5dfb33['model'],qs['fields'](_0x3bcaad['query']['fields']));_0xef696c[_0x23c3('0x39')]=_0xef696c[_0x23c3('0x39')][_0x23c3('0x3a')]?_0xef696c[_0x23c3('0x39')]:_0x5dfb33[_0x23c3('0x33')];if(_0x3bcaad[_0x23c3('0x35')][_0x23c3('0x43')]){_0xef696c[_0x23c3('0x44')]=[{'all':!![]}];}_0xef696c=_['merge']({},_0xef696c,_0x3bcaad[_0x23c3('0x42')]);return db['Team'][_0x23c3('0x4a')](_0xef696c)[_0x23c3('0x26')](handleEntityNotFound(_0x33b393,null))['then'](respondWithResult(_0x33b393,null))[_0x23c3('0x46')](handleError(_0x33b393,null));};exports[_0x23c3('0x4b')]=function(_0x13d2e1,_0x20a08b){return db[_0x23c3('0x30')][_0x23c3('0x4b')](_0x13d2e1['body'],{})['then'](function(_0xcb8172){var _0x2550e8=_0x13d2e1['user'][_0x23c3('0x28')]({'plain':!![]});if(!_0x2550e8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2550e8[_0x23c3('0x4c')]==='user'){var _0x5a7701=_0xcb8172[_0x23c3('0x28')]({'plain':!![]});var _0x18f28d=_0x23c3('0x29');return db['UserProfileSection']['find']({'where':{'name':_0x18f28d,'userProfileId':_0x2550e8[_0x23c3('0x4d')]},'raw':!![]})[_0x23c3('0x26')](function(_0x4ae18e){if(_0x4ae18e&&_0x4ae18e['autoAssociation']===0x0){return db['UserProfileResource'][_0x23c3('0x4b')]({'name':_0x5a7701['name'],'resourceId':_0x5a7701['id'],'type':_0x4ae18e[_0x23c3('0x2d')],'sectionId':_0x4ae18e['id']},{})[_0x23c3('0x26')](function(){return _0xcb8172;});}else{return _0xcb8172;}})[_0x23c3('0x46')](function(_0x40f444){logger[_0x23c3('0x2b')](_0x23c3('0x4e'),_0x40f444);throw _0x40f444;});}return _0xcb8172;})['then'](respondWithResult(_0x20a08b,0xc9))['catch'](handleError(_0x20a08b,null));};exports[_0x23c3('0x4f')]=function(_0x479d90,_0x5f31ca){if(_0x479d90[_0x23c3('0x50')]['id']){delete _0x479d90[_0x23c3('0x50')]['id'];}return db['Team'][_0x23c3('0x4a')]({'where':{'id':_0x479d90[_0x23c3('0x51')]['id']}})[_0x23c3('0x26')](handleEntityNotFound(_0x5f31ca,null))['then'](saveUpdates(_0x479d90['body'],null))[_0x23c3('0x26')](respondWithResult(_0x5f31ca,null))['catch'](handleError(_0x5f31ca,null));};exports[_0x23c3('0x27')]=function(_0x1c17d6,_0x41aadd){return db[_0x23c3('0x30')][_0x23c3('0x4a')]({'where':{'id':_0x1c17d6[_0x23c3('0x51')]['id']}})[_0x23c3('0x26')](handleEntityNotFound(_0x41aadd,null))[_0x23c3('0x26')](removeEntity(_0x41aadd,null))[_0x23c3('0x46')](handleError(_0x41aadd,null));};exports[_0x23c3('0x52')]=function(_0xafde77,_0x5df662,_0xb6734){return db[_0x23c3('0x30')]['findOne']({'where':{'id':_0xafde77[_0x23c3('0x51')]['id']}})[_0x23c3('0x26')](handleEntityNotFound(_0x5df662,null))[_0x23c3('0x26')](function(_0x5eeefb){if(!_0xafde77[_0x23c3('0x35')]['channel']||!utils[_0x23c3('0x53')](_0xafde77[_0x23c3('0x35')]['channel'])){throw new db[(_0x23c3('0x54'))]['ValidationError'](_0x23c3('0x55'));}var _0x11c837={};var _0x154619={};_0x154619[_0x23c3('0x33')]=_['keys'](db[_['capitalize'](_0xafde77['query']['channel'][_0x23c3('0x56')]())+_0x23c3('0x57')][_0x23c3('0x48')]);_0x154619[_0x23c3('0x35')]=_[_0x23c3('0x36')](_0xafde77[_0x23c3('0x35')]);_0x154619[_0x23c3('0x37')]=_[_0x23c3('0x49')](_0x154619[_0x23c3('0x33')],_0x154619[_0x23c3('0x35')]);_0x11c837[_0x23c3('0x39')]=_[_0x23c3('0x49')](_0x154619[_0x23c3('0x33')],qs[_0x23c3('0x38')](_0xafde77[_0x23c3('0x35')]['fields']));_0x11c837[_0x23c3('0x39')]=_0x11c837[_0x23c3('0x39')]['length']?_0x11c837['attributes']:_0x154619['model'];_0x11c837[_0x23c3('0x22')]=qs[_0x23c3('0x22')](_0xafde77['query']['limit']);_0x11c837[_0x23c3('0x21')]=qs[_0x23c3('0x21')](_0xafde77['query']['offset']);_0x11c837[_0x23c3('0x58')]=qs[_0x23c3('0x3c')](_0xafde77[_0x23c3('0x35')][_0x23c3('0x3c')]);_0x11c837[_0x23c3('0x3d')]=qs[_0x23c3('0x37')](_[_0x23c3('0x3e')](_0xafde77[_0x23c3('0x35')],_0x154619[_0x23c3('0x37')]));_0x11c837=_[_0x23c3('0x3f')]({},_0x11c837,_0xafde77['options']);return _0x5eeefb['get'+_['capitalize'](_0xafde77['query'][_0x23c3('0x59')][_0x23c3('0x56')]())+_0x23c3('0x5a')](_0x11c837);})[_0x23c3('0x26')](respondWithResult(_0x5df662,null))[_0x23c3('0x46')](handleError(_0x5df662,null));};exports[_0x23c3('0x5b')]=function(_0xa850e3,_0x5016ae,_0x1fc2e1){return db[_0x23c3('0x30')]['findOne']({'where':{'id':_0xa850e3[_0x23c3('0x51')]['id']}})['then'](function(_0x3abcbc){if(_0x3abcbc){if(!_0xa850e3[_0x23c3('0x50')]['channel']||!utils[_0x23c3('0x53')](_0xa850e3['body'][_0x23c3('0x59')])){throw new db['Sequelize'][(_0x23c3('0x5c'))](_0x23c3('0x55'));}return _0x3abcbc['add'+_[_0x23c3('0x5d')](_0xa850e3['body'][_0x23c3('0x59')][_0x23c3('0x56')]())+_0x23c3('0x5a')](_0xa850e3[_0x23c3('0x50')][_0x23c3('0x5e')]);}return null;})[_0x23c3('0x26')](handleEntityNotFound(_0x5016ae,null))[_0x23c3('0x26')](respondWithStatusCode(_0x5016ae,null))[_0x23c3('0x46')](handleError(_0x5016ae,null));};exports[_0x23c3('0x5f')]=function(_0x193b8f,_0x209369,_0x181c40){return db['Team'][_0x23c3('0x60')]({'where':{'id':_0x193b8f[_0x23c3('0x51')]['id']}})[_0x23c3('0x26')](function(_0x42225f){if(_0x42225f){if(!_0x193b8f[_0x23c3('0x35')]['channel']||!utils[_0x23c3('0x53')](_0x193b8f[_0x23c3('0x35')][_0x23c3('0x59')])){throw new db[(_0x23c3('0x54'))][(_0x23c3('0x5c'))](_0x23c3('0x55'));}return _0x42225f[_0x23c3('0x61')+_[_0x23c3('0x5d')](_0x193b8f[_0x23c3('0x35')][_0x23c3('0x59')][_0x23c3('0x56')]())+'Queues'](_0x193b8f['query'][_0x23c3('0x5e')]);}return null;})[_0x23c3('0x26')](handleEntityNotFound(_0x209369,null))[_0x23c3('0x26')](respondWithStatusCode(_0x209369,null))['catch'](handleError(_0x209369,null));};exports[_0x23c3('0x62')]=function(_0x2472b4,_0x5027e1,_0x1c8f9b){return db[_0x23c3('0x30')][_0x23c3('0x4a')]({'where':{'id':_0x2472b4[_0x23c3('0x51')]['id']}})[_0x23c3('0x26')](handleEntityNotFound(_0x5027e1,null))['then'](function(_0x48d1dc){if(_0x48d1dc){var _0x3da3db=[_0x23c3('0x63'),_0x23c3('0x64'),_0x23c3('0x65'),'Sms','Fax','Openchannel'];return BPromise[_0x23c3('0x66')](_0x3da3db,function(_0x1dc0ef){return _0x48d1dc[_0x23c3('0x28')+_0x1dc0ef+'Queues']({'attributes':['id',_0x23c3('0x2d')]})[_0x23c3('0x26')](function(_0x153c3c){return BPromise[_0x23c3('0x66')](_0x153c3c,function(_0x542e48){return _0x542e48['addAgents'](_0x2472b4[_0x23c3('0x50')]['ids'])[_0x23c3('0x26')](function(){if(_0x1dc0ef===_0x23c3('0x63')){return db['User'][_0x23c3('0x67')]({'where':{'id':_0x2472b4[_0x23c3('0x50')][_0x23c3('0x5e')]},'attributes':['id','name','online',_0x23c3('0x68'),_0x23c3('0x69')],'raw':!![]})['then'](function(_0x3c74e0){return BPromise['each'](_['filter'](_0x3c74e0,{'online':0x1}),function(_0x5132f7){return db[_0x23c3('0x6a')]['upsert']({'membername':_0x5132f7[_0x23c3('0x2d')],'UserId':_0x5132f7['id'],'queue_name':_0x542e48[_0x23c3('0x2d')],'VoiceQueueId':_0x542e48['id'],'interface':_[_0x23c3('0x6b')](_0x5132f7[_0x23c3('0x69')])?util['format'](_0x23c3('0x6c'),_0x5132f7[_0x23c3('0x2d')]):_0x5132f7['interface'],'paused':_0x5132f7[_0x23c3('0x68')]||![],'penalty':0x0});});});}});});})[_0x23c3('0x26')](function(){return _0x48d1dc;});})[_0x23c3('0x26')](function(){return _0x48d1dc;});}})[_0x23c3('0x26')](function(_0x1d252c){if(_0x1d252c){return _0x1d252c[_0x23c3('0x62')](_0x2472b4[_0x23c3('0x50')][_0x23c3('0x5e')],_[_0x23c3('0x6d')](_0x2472b4[_0x23c3('0x50')],['ids','id'])||{})[_0x23c3('0x6e')](function(_0x3ef0fb){for(var _0x514db2=0x0;_0x514db2<_0x2472b4['body'][_0x23c3('0x5e')][_0x23c3('0x3a')];_0x514db2+=0x1){socket['emit'](_0x23c3('0x6f'),{'UserId':_0x2472b4[_0x23c3('0x50')][_0x23c3('0x5e')][_0x514db2],'TeamId':_0x2472b4[_0x23c3('0x51')]['id']});}return _0x3ef0fb;});}})[_0x23c3('0x26')](respondWithResult(_0x5027e1,null))['catch'](handleError(_0x5027e1,null));};exports['removeAgents']=function(_0x10364f,_0x10305b,_0x3ec4af){return db[_0x23c3('0x30')][_0x23c3('0x4a')]({'where':{'id':_0x10364f['params']['id']}})[_0x23c3('0x26')](handleEntityNotFound(_0x10305b,null))[_0x23c3('0x26')](function(_0x14f9b5){if(_0x14f9b5){return BPromise[_0x23c3('0x66')]([_0x23c3('0x70'),'chat',_0x23c3('0x71'),_0x23c3('0x72'),_0x23c3('0x73'),_0x23c3('0x74')],function(_0x589ed2){return _0x14f9b5[_0x23c3('0x28')+_[_0x23c3('0x5d')](_0x589ed2)+'Queues']({'attributes':['id',_0x23c3('0x2d')]})[_0x23c3('0x26')](function(_0x5344ef){return BPromise[_0x23c3('0x66')](_0x5344ef,function(_0xf34f22){return _0xf34f22[_0x23c3('0x75')](_0x10364f['query'][_0x23c3('0x5e')])['then'](function(){if(_0x589ed2==='voice'){return db[_0x23c3('0x6a')][_0x23c3('0x27')]({'where':{'VoiceQueueId':_0xf34f22['id'],'UserId':_0x10364f[_0x23c3('0x35')][_0x23c3('0x5e')]}});}});});})[_0x23c3('0x26')](function(){return _0x14f9b5;});})[_0x23c3('0x26')](function(){return _0x14f9b5;});}})[_0x23c3('0x26')](function(_0x379ea4){if(_0x379ea4){return _0x379ea4[_0x23c3('0x75')](_0x10364f[_0x23c3('0x35')][_0x23c3('0x5e')])['then'](function(){if(_[_0x23c3('0x76')](_0x10364f['query'][_0x23c3('0x5e')])){for(var _0x2e4ebf=0x0;_0x2e4ebf<_0x10364f[_0x23c3('0x35')][_0x23c3('0x5e')][_0x23c3('0x3a')];_0x2e4ebf+=0x1){socket['emit'](_0x23c3('0x77'),{'UserId':Number(_0x10364f[_0x23c3('0x35')][_0x23c3('0x5e')][_0x2e4ebf]),'TeamId':Number(_0x10364f['params']['id'])});}}else{socket[_0x23c3('0x78')]('userTeam:remove',{'UserId':Number(_0x10364f['query']['ids']),'TeamId':Number(_0x10364f[_0x23c3('0x51')]['id'])});}});}})[_0x23c3('0x26')](respondWithStatusCode(_0x10305b,null))[_0x23c3('0x46')](handleError(_0x10305b,null));};exports[_0x23c3('0x79')]=function(_0x1677ec,_0x52c519,_0x179b69){var _0xb0e9ad={};var _0x1f3e9c={};var _0x5e9c53;var _0x384f13;return db[_0x23c3('0x30')][_0x23c3('0x60')]({'where':{'id':_0x1677ec[_0x23c3('0x51')]['id']}})['then'](handleEntityNotFound(_0x52c519,null))[_0x23c3('0x26')](function(_0x456ffc){if(_0x456ffc){_0x5e9c53=_0x456ffc;_0x1f3e9c[_0x23c3('0x33')]=_[_0x23c3('0x36')](db[_0x23c3('0x7a')][_0x23c3('0x48')]);_0x1f3e9c[_0x23c3('0x35')]=_['keys'](_0x1677ec[_0x23c3('0x35')]);_0x1f3e9c[_0x23c3('0x37')]=_[_0x23c3('0x49')](_0x1f3e9c[_0x23c3('0x33')],_0x1f3e9c['query']);_0xb0e9ad[_0x23c3('0x39')]=_[_0x23c3('0x49')](_0x1f3e9c['model'],qs[_0x23c3('0x38')](_0x1677ec['query'][_0x23c3('0x38')]));_0xb0e9ad['attributes']=_0xb0e9ad[_0x23c3('0x39')]['length']?_0xb0e9ad[_0x23c3('0x39')]:_0x1f3e9c[_0x23c3('0x33')];_0xb0e9ad['order']=qs[_0x23c3('0x3c')](_0x1677ec[_0x23c3('0x35')][_0x23c3('0x3c')]);_0xb0e9ad[_0x23c3('0x3d')]=qs['filters'](_['pick'](_0x1677ec[_0x23c3('0x35')],_0x1f3e9c['filters']));if(_0x1677ec['query']['filter']){_0xb0e9ad[_0x23c3('0x3d')]=_[_0x23c3('0x3f')](_0xb0e9ad[_0x23c3('0x3d')],{'$or':_[_0x23c3('0x34')](_0xb0e9ad[_0x23c3('0x39')],function(_0x525fa6){var _0x1f47fe={};_0x1f47fe[_0x525fa6]={'$like':'%'+_0x1677ec[_0x23c3('0x35')][_0x23c3('0x41')]+'%'};return _0x1f47fe;})});}_0xb0e9ad=_['merge']({},_0xb0e9ad,_0x1677ec['options']);return _0x5e9c53[_0x23c3('0x79')](_0xb0e9ad);}})[_0x23c3('0x26')](function(_0x30227f){if(_0x30227f){_0x384f13=_0x30227f[_0x23c3('0x3a')];if(!_0x1677ec[_0x23c3('0x35')][_0x23c3('0x7b')](_0x23c3('0x3b'))){_0xb0e9ad['limit']=qs['limit'](_0x1677ec['query']['limit']);_0xb0e9ad[_0x23c3('0x21')]=qs[_0x23c3('0x21')](_0x1677ec[_0x23c3('0x35')][_0x23c3('0x21')]);}return _0x5e9c53['getAgents'](_0xb0e9ad);}})[_0x23c3('0x26')](function(_0x54d59d){if(_0x54d59d){return _0x54d59d?{'count':_0x384f13,'rows':_0x54d59d}:null;}})[_0x23c3('0x26')](respondWithResult(_0x52c519,null))[_0x23c3('0x46')](handleError(_0x52c519,null));}; \ No newline at end of file +var _0x87bc=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','findOne','channel','isValidChannel','Sequelize','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queues','add','removeQueues','remove','ids','Voice','Chat','Sms','Fax','each','User','online','voicePause','interface','UserVoiceQueueRt','upsert','SIP/%s','addAgents','omit','removeAgents','voice','chat','mail','sms','openchannel','isArray','emit','userTeam:remove','getAgents','html-pdf','eml-format','zip-dir','moment','mustache','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./team.socket','register','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Teams','UserProfileResource','error','name','index','map','Team','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId'];(function(_0x42daae,_0x167049){var _0x291df4=function(_0x309dc2){while(--_0x309dc2){_0x42daae['push'](_0x42daae['shift']());}};_0x291df4(++_0x167049);}(_0x87bc,0x189));var _0xc87b=function(_0x1ca064,_0xbe096c){_0x1ca064=_0x1ca064-0x0;var _0x3943cd=_0x87bc[_0x1ca064];return _0x3943cd;};'use strict';var pdf=require(_0xc87b('0x0'));var emlformat=require(_0xc87b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc87b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc87b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc87b('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xc87b('0x5'));var ejs=require(_0xc87b('0x6'));var fs=require('fs');var _=require(_0xc87b('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc87b('0x8'));var toCsv=require(_0xc87b('0x5'));var querystring=require(_0xc87b('0x9'));var Papa=require(_0xc87b('0xa'));var Redis=require(_0xc87b('0xb'));var authService=require(_0xc87b('0xc'));var qs=require(_0xc87b('0xd'));var as=require(_0xc87b('0xe'));var hardwareService=require(_0xc87b('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0xc87b('0x10'));var config=require('../../config/environment');var db=require(_0xc87b('0x11'))['db'];config[_0xc87b('0x12')]=_[_0xc87b('0x13')](config[_0xc87b('0x12')],{'host':'localhost','port':0x18eb});var socket=require(_0xc87b('0x14'))(new Redis(config['redis']));require(_0xc87b('0x15'))[_0xc87b('0x16')](socket);function respondWithStatusCode(_0x536105,_0x148922){_0x148922=_0x148922||0xcc;return function(_0x25006a){if(_0x25006a){return _0x536105['sendStatus'](_0x148922);}return _0x536105[_0xc87b('0x17')](_0x148922)[_0xc87b('0x18')]();};}function respondWithResult(_0x34195e,_0x1cd9c0){_0x1cd9c0=_0x1cd9c0||0xc8;return function(_0x212813){if(_0x212813){return _0x34195e[_0xc87b('0x17')](_0x1cd9c0)[_0xc87b('0x19')](_0x212813);}};}function respondWithFilteredResult(_0x461bbd,_0x5db718){return function(_0x124962){if(_0x124962){var _0x5b5a36=_0x124962[_0xc87b('0x1a')],_0x30179b=_0x5db718[_0xc87b('0x1b')],_0x67e40e=_0x5db718['offset']+_0x5db718[_0xc87b('0x1c')],_0x534b6d;if(_0x67e40e>=_0x5b5a36){_0x67e40e=_0x5b5a36;_0x534b6d=0xc8;}else{_0x534b6d=0xce;}_0x461bbd['status'](_0x534b6d);return _0x461bbd[_0xc87b('0x1d')](_0xc87b('0x1e'),_0x30179b+'-'+_0x67e40e+'/'+_0x5b5a36)[_0xc87b('0x19')](_0x124962);}return null;};}function patchUpdates(_0x3bd1ee){return function(_0x144d68){try{jsonpatch[_0xc87b('0x1f')](_0x144d68,_0x3bd1ee,!![]);}catch(_0x100159){return BPromise[_0xc87b('0x20')](_0x100159);}return _0x144d68[_0xc87b('0x21')]();};}function saveUpdates(_0x528c54,_0x37c706){return function(_0x5266c2){if(_0x5266c2){return _0x5266c2[_0xc87b('0x22')](_0x528c54)[_0xc87b('0x23')](function(_0x147731){return _0x147731;});}return null;};}function removeEntity(_0x4bff29,_0x540ae5){return function(_0x31b14){if(_0x31b14){return _0x31b14[_0xc87b('0x24')]()[_0xc87b('0x23')](function(){var _0x2e4b16=_0x31b14[_0xc87b('0x25')]({'plain':!![]});var _0x557efe=_0xc87b('0x26');return db[_0xc87b('0x27')][_0xc87b('0x24')]({'where':{'type':_0x557efe,'resourceId':_0x2e4b16['id']}})[_0xc87b('0x23')](function(){return _0x31b14;});})[_0xc87b('0x23')](function(){_0x4bff29['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x56d3d8,_0x9507c0){return function(_0x1c4a82){if(!_0x1c4a82){_0x56d3d8['sendStatus'](0x194);}return _0x1c4a82;};}function handleError(_0x580a7a,_0x281692){_0x281692=_0x281692||0x1f4;return function(_0x5900ad){logger[_0xc87b('0x28')](_0x5900ad['stack']);if(_0x5900ad[_0xc87b('0x29')]){delete _0x5900ad[_0xc87b('0x29')];}_0x580a7a[_0xc87b('0x17')](_0x281692)['send'](_0x5900ad);};}exports[_0xc87b('0x2a')]=function(_0x24fd6f,_0x166456){var _0x384230={},_0x458a86={},_0xd427f5={'count':0x0,'rows':[]};var _0x215be4=_[_0xc87b('0x2b')](db[_0xc87b('0x2c')][_0xc87b('0x2d')],function(_0x210522){return{'name':_0x210522[_0xc87b('0x2e')],'type':_0x210522['type'][_0xc87b('0x2f')]};});_0x458a86[_0xc87b('0x30')]=_['map'](_0x215be4,_0xc87b('0x29'));_0x458a86[_0xc87b('0x31')]=_[_0xc87b('0x32')](_0x24fd6f['query']);_0x458a86[_0xc87b('0x33')]=_[_0xc87b('0x34')](_0x458a86[_0xc87b('0x30')],_0x458a86[_0xc87b('0x31')]);_0x384230[_0xc87b('0x35')]=_['intersection'](_0x458a86['model'],qs[_0xc87b('0x36')](_0x24fd6f['query'][_0xc87b('0x36')]));_0x384230[_0xc87b('0x35')]=_0x384230[_0xc87b('0x35')][_0xc87b('0x37')]?_0x384230['attributes']:_0x458a86[_0xc87b('0x30')];if(!_0x24fd6f[_0xc87b('0x31')][_0xc87b('0x38')](_0xc87b('0x39'))){_0x384230[_0xc87b('0x1c')]=qs[_0xc87b('0x1c')](_0x24fd6f[_0xc87b('0x31')]['limit']);_0x384230[_0xc87b('0x1b')]=qs['offset'](_0x24fd6f['query'][_0xc87b('0x1b')]);}_0x384230[_0xc87b('0x3a')]=qs[_0xc87b('0x3b')](_0x24fd6f[_0xc87b('0x31')][_0xc87b('0x3b')]);_0x384230[_0xc87b('0x3c')]=qs['filters'](_[_0xc87b('0x3d')](_0x24fd6f[_0xc87b('0x31')],_0x458a86[_0xc87b('0x33')]));if(_0x24fd6f[_0xc87b('0x31')]['filter']){_0x384230[_0xc87b('0x3c')]=_[_0xc87b('0x3e')](_0x384230[_0xc87b('0x3c')],{'$or':_[_0xc87b('0x2b')](_0x215be4,function(_0x563ce3){if(_0x563ce3['type']!=='VIRTUAL'){var _0x1295fa={};_0x1295fa[_0x563ce3[_0xc87b('0x29')]]={'$like':'%'+_0x24fd6f['query'][_0xc87b('0x3f')]+'%'};return _0x1295fa;}})});}_0x384230=_[_0xc87b('0x3e')]({},_0x384230,_0x24fd6f[_0xc87b('0x40')]);var _0x24ff7c={'where':_0x384230[_0xc87b('0x3c')]};return db[_0xc87b('0x2c')][_0xc87b('0x1a')](_0x24ff7c)[_0xc87b('0x23')](function(_0x4501ab){_0xd427f5[_0xc87b('0x1a')]=_0x4501ab;if(_0x24fd6f[_0xc87b('0x31')][_0xc87b('0x41')]){_0x384230[_0xc87b('0x42')]=[{'all':!![]}];}return db[_0xc87b('0x2c')][_0xc87b('0x43')](_0x384230);})['then'](function(_0x1fe353){_0xd427f5[_0xc87b('0x44')]=_0x1fe353;return _0xd427f5;})[_0xc87b('0x23')](respondWithFilteredResult(_0x166456,_0x384230))[_0xc87b('0x45')](handleError(_0x166456,null));};exports[_0xc87b('0x46')]=function(_0x56fc5e,_0x51f9a8){var _0xd5f31b={'raw':![],'where':{'id':_0x56fc5e['params']['id']}},_0x3d5d25={};_0x3d5d25[_0xc87b('0x30')]=_[_0xc87b('0x32')](db[_0xc87b('0x2c')][_0xc87b('0x2d')]);_0x3d5d25[_0xc87b('0x31')]=_[_0xc87b('0x32')](_0x56fc5e['query']);_0x3d5d25['filters']=_[_0xc87b('0x34')](_0x3d5d25[_0xc87b('0x30')],_0x3d5d25[_0xc87b('0x31')]);_0xd5f31b[_0xc87b('0x35')]=_[_0xc87b('0x34')](_0x3d5d25[_0xc87b('0x30')],qs[_0xc87b('0x36')](_0x56fc5e[_0xc87b('0x31')][_0xc87b('0x36')]));_0xd5f31b[_0xc87b('0x35')]=_0xd5f31b[_0xc87b('0x35')][_0xc87b('0x37')]?_0xd5f31b[_0xc87b('0x35')]:_0x3d5d25['model'];if(_0x56fc5e[_0xc87b('0x31')][_0xc87b('0x41')]){_0xd5f31b['include']=[{'all':!![]}];}_0xd5f31b=_[_0xc87b('0x3e')]({},_0xd5f31b,_0x56fc5e[_0xc87b('0x40')]);return db[_0xc87b('0x2c')][_0xc87b('0x47')](_0xd5f31b)[_0xc87b('0x23')](handleEntityNotFound(_0x51f9a8,null))[_0xc87b('0x23')](respondWithResult(_0x51f9a8,null))[_0xc87b('0x45')](handleError(_0x51f9a8,null));};exports['create']=function(_0x4c5507,_0x114ef7){return db['Team'][_0xc87b('0x48')](_0x4c5507[_0xc87b('0x49')],{})[_0xc87b('0x23')](function(_0x544437){var _0x3439ba=_0x4c5507[_0xc87b('0x4a')][_0xc87b('0x25')]({'plain':!![]});if(!_0x3439ba)throw new Error(_0xc87b('0x4b'));if(_0x3439ba[_0xc87b('0x4c')]===_0xc87b('0x4a')){var _0x7c4e93=_0x544437['get']({'plain':!![]});var _0x4fb487=_0xc87b('0x26');return db[_0xc87b('0x4d')][_0xc87b('0x47')]({'where':{'name':_0x4fb487,'userProfileId':_0x3439ba[_0xc87b('0x4e')]},'raw':!![]})[_0xc87b('0x23')](function(_0x51a6a9){if(_0x51a6a9&&_0x51a6a9['autoAssociation']===0x0){return db[_0xc87b('0x27')][_0xc87b('0x48')]({'name':_0x7c4e93['name'],'resourceId':_0x7c4e93['id'],'type':_0x51a6a9[_0xc87b('0x29')],'sectionId':_0x51a6a9['id']},{})[_0xc87b('0x23')](function(){return _0x544437;});}else{return _0x544437;}})[_0xc87b('0x45')](function(_0x1918ba){logger['error'](_0xc87b('0x4f'),_0x1918ba);throw _0x1918ba;});}return _0x544437;})[_0xc87b('0x23')](respondWithResult(_0x114ef7,0xc9))[_0xc87b('0x45')](handleError(_0x114ef7,null));};exports['update']=function(_0x2b5c16,_0x1d5a58){if(_0x2b5c16['body']['id']){delete _0x2b5c16[_0xc87b('0x49')]['id'];}return db[_0xc87b('0x2c')][_0xc87b('0x47')]({'where':{'id':_0x2b5c16[_0xc87b('0x50')]['id']}})[_0xc87b('0x23')](handleEntityNotFound(_0x1d5a58,null))[_0xc87b('0x23')](saveUpdates(_0x2b5c16[_0xc87b('0x49')],null))['then'](respondWithResult(_0x1d5a58,null))['catch'](handleError(_0x1d5a58,null));};exports[_0xc87b('0x24')]=function(_0x24fd7d,_0x306a56){return db[_0xc87b('0x2c')][_0xc87b('0x47')]({'where':{'id':_0x24fd7d[_0xc87b('0x50')]['id']}})['then'](handleEntityNotFound(_0x306a56,null))['then'](removeEntity(_0x306a56,null))[_0xc87b('0x45')](handleError(_0x306a56,null));};exports['getQueues']=function(_0x5d45d5,_0x2ef012,_0x20b740){return db[_0xc87b('0x2c')][_0xc87b('0x51')]({'where':{'id':_0x5d45d5[_0xc87b('0x50')]['id']}})[_0xc87b('0x23')](handleEntityNotFound(_0x2ef012,null))[_0xc87b('0x23')](function(_0x5c3134){if(!_0x5d45d5[_0xc87b('0x31')][_0xc87b('0x52')]||!utils[_0xc87b('0x53')](_0x5d45d5[_0xc87b('0x31')][_0xc87b('0x52')])){throw new db[(_0xc87b('0x54'))][(_0xc87b('0x55'))](_0xc87b('0x56'));}var _0x81d8f5={};var _0x5f4553={};_0x5f4553[_0xc87b('0x30')]=_[_0xc87b('0x32')](db[_[_0xc87b('0x57')](_0x5d45d5[_0xc87b('0x31')]['channel'][_0xc87b('0x58')]())+'Queue'][_0xc87b('0x2d')]);_0x5f4553[_0xc87b('0x31')]=_[_0xc87b('0x32')](_0x5d45d5['query']);_0x5f4553[_0xc87b('0x33')]=_[_0xc87b('0x34')](_0x5f4553[_0xc87b('0x30')],_0x5f4553[_0xc87b('0x31')]);_0x81d8f5[_0xc87b('0x35')]=_[_0xc87b('0x34')](_0x5f4553[_0xc87b('0x30')],qs[_0xc87b('0x36')](_0x5d45d5[_0xc87b('0x31')][_0xc87b('0x36')]));_0x81d8f5[_0xc87b('0x35')]=_0x81d8f5[_0xc87b('0x35')][_0xc87b('0x37')]?_0x81d8f5['attributes']:_0x5f4553['model'];_0x81d8f5[_0xc87b('0x1c')]=qs[_0xc87b('0x1c')](_0x5d45d5[_0xc87b('0x31')][_0xc87b('0x1c')]);_0x81d8f5['offset']=qs[_0xc87b('0x1b')](_0x5d45d5[_0xc87b('0x31')]['offset']);_0x81d8f5[_0xc87b('0x3a')]=qs[_0xc87b('0x3b')](_0x5d45d5[_0xc87b('0x31')][_0xc87b('0x3b')]);_0x81d8f5[_0xc87b('0x3c')]=qs[_0xc87b('0x33')](_[_0xc87b('0x3d')](_0x5d45d5[_0xc87b('0x31')],_0x5f4553[_0xc87b('0x33')]));_0x81d8f5=_['merge']({},_0x81d8f5,_0x5d45d5['options']);return _0x5c3134[_0xc87b('0x25')+_[_0xc87b('0x57')](_0x5d45d5[_0xc87b('0x31')][_0xc87b('0x52')][_0xc87b('0x58')]())+_0xc87b('0x59')](_0x81d8f5);})[_0xc87b('0x23')](respondWithResult(_0x2ef012,null))[_0xc87b('0x45')](handleError(_0x2ef012,null));};exports['addQueues']=function(_0x12c54e,_0x112d54,_0x41d93b){return db[_0xc87b('0x2c')]['findOne']({'where':{'id':_0x12c54e[_0xc87b('0x50')]['id']}})[_0xc87b('0x23')](function(_0x3bc08a){if(_0x3bc08a){if(!_0x12c54e['body'][_0xc87b('0x52')]||!utils[_0xc87b('0x53')](_0x12c54e[_0xc87b('0x49')][_0xc87b('0x52')])){throw new db[(_0xc87b('0x54'))][(_0xc87b('0x55'))](_0xc87b('0x56'));}return _0x3bc08a[_0xc87b('0x5a')+_['capitalize'](_0x12c54e['body']['channel'][_0xc87b('0x58')]())+_0xc87b('0x59')](_0x12c54e[_0xc87b('0x49')]['ids']);}return null;})[_0xc87b('0x23')](handleEntityNotFound(_0x112d54,null))[_0xc87b('0x23')](respondWithStatusCode(_0x112d54,null))[_0xc87b('0x45')](handleError(_0x112d54,null));};exports[_0xc87b('0x5b')]=function(_0x1b0242,_0x3dffc5,_0x3729e8){return db[_0xc87b('0x2c')][_0xc87b('0x51')]({'where':{'id':_0x1b0242[_0xc87b('0x50')]['id']}})[_0xc87b('0x23')](function(_0x55189a){if(_0x55189a){if(!_0x1b0242[_0xc87b('0x31')]['channel']||!utils[_0xc87b('0x53')](_0x1b0242[_0xc87b('0x31')]['channel'])){throw new db[(_0xc87b('0x54'))]['ValidationError']('Unknown\x20channel');}return _0x55189a[_0xc87b('0x5c')+_[_0xc87b('0x57')](_0x1b0242[_0xc87b('0x31')][_0xc87b('0x52')][_0xc87b('0x58')]())+_0xc87b('0x59')](_0x1b0242[_0xc87b('0x31')][_0xc87b('0x5d')]);}return null;})[_0xc87b('0x23')](handleEntityNotFound(_0x3dffc5,null))[_0xc87b('0x23')](respondWithStatusCode(_0x3dffc5,null))[_0xc87b('0x45')](handleError(_0x3dffc5,null));};exports['addAgents']=function(_0x1f41d9,_0x2edb82,_0x39794c){return db['Team']['find']({'where':{'id':_0x1f41d9['params']['id']}})['then'](handleEntityNotFound(_0x2edb82,null))[_0xc87b('0x23')](function(_0x2cd691){if(_0x2cd691){var _0x5818a7=[_0xc87b('0x5e'),_0xc87b('0x5f'),'Mail',_0xc87b('0x60'),_0xc87b('0x61'),'Openchannel'];return BPromise[_0xc87b('0x62')](_0x5818a7,function(_0x1694de){return _0x2cd691['get'+_0x1694de+_0xc87b('0x59')]({'attributes':['id',_0xc87b('0x29')]})[_0xc87b('0x23')](function(_0x5ca046){return BPromise[_0xc87b('0x62')](_0x5ca046,function(_0x55f5ce){return _0x55f5ce['addAgents'](_0x1f41d9[_0xc87b('0x49')]['ids'])['then'](function(){if(_0x1694de===_0xc87b('0x5e')){return db[_0xc87b('0x63')]['findAll']({'where':{'id':_0x1f41d9['body'][_0xc87b('0x5d')]},'attributes':['id',_0xc87b('0x29'),_0xc87b('0x64'),_0xc87b('0x65'),_0xc87b('0x66')],'raw':!![]})['then'](function(_0x2d8f87){return BPromise['each'](_[_0xc87b('0x3f')](_0x2d8f87,{'online':0x1}),function(_0x111073){return db[_0xc87b('0x67')][_0xc87b('0x68')]({'membername':_0x111073[_0xc87b('0x29')],'UserId':_0x111073['id'],'queue_name':_0x55f5ce[_0xc87b('0x29')],'VoiceQueueId':_0x55f5ce['id'],'interface':_['isNil'](_0x111073[_0xc87b('0x66')])?util['format'](_0xc87b('0x69'),_0x111073[_0xc87b('0x29')]):_0x111073[_0xc87b('0x66')],'paused':_0x111073['voicePause']||![],'penalty':0x0});});});}});});})[_0xc87b('0x23')](function(){return _0x2cd691;});})[_0xc87b('0x23')](function(){return _0x2cd691;});}})['then'](function(_0x54cc92){if(_0x54cc92){return _0x54cc92[_0xc87b('0x6a')](_0x1f41d9['body'][_0xc87b('0x5d')],_[_0xc87b('0x6b')](_0x1f41d9[_0xc87b('0x49')],[_0xc87b('0x5d'),'id'])||{})['spread'](function(_0x16e820){for(var _0x27ea89=0x0;_0x27ea89<_0x1f41d9[_0xc87b('0x49')][_0xc87b('0x5d')][_0xc87b('0x37')];_0x27ea89+=0x1){socket['emit']('userTeam:save',{'UserId':_0x1f41d9['body'][_0xc87b('0x5d')][_0x27ea89],'TeamId':_0x1f41d9['params']['id']});}return _0x16e820;});}})[_0xc87b('0x23')](respondWithResult(_0x2edb82,null))[_0xc87b('0x45')](handleError(_0x2edb82,null));};exports[_0xc87b('0x6c')]=function(_0x347c16,_0x176b7f,_0x3f1de5){return db['Team'][_0xc87b('0x47')]({'where':{'id':_0x347c16[_0xc87b('0x50')]['id']}})[_0xc87b('0x23')](handleEntityNotFound(_0x176b7f,null))[_0xc87b('0x23')](function(_0x421487){if(_0x421487){return BPromise[_0xc87b('0x62')]([_0xc87b('0x6d'),_0xc87b('0x6e'),_0xc87b('0x6f'),_0xc87b('0x70'),'fax',_0xc87b('0x71')],function(_0x38455c){return _0x421487[_0xc87b('0x25')+_[_0xc87b('0x57')](_0x38455c)+'Queues']({'attributes':['id','name']})[_0xc87b('0x23')](function(_0x4d6982){return BPromise['each'](_0x4d6982,function(_0x2ff7c8){return _0x2ff7c8[_0xc87b('0x6c')](_0x347c16[_0xc87b('0x31')][_0xc87b('0x5d')])[_0xc87b('0x23')](function(){if(_0x38455c==='voice'){return db[_0xc87b('0x67')][_0xc87b('0x24')]({'where':{'VoiceQueueId':_0x2ff7c8['id'],'UserId':_0x347c16[_0xc87b('0x31')][_0xc87b('0x5d')]}});}});});})['then'](function(){return _0x421487;});})['then'](function(){return _0x421487;});}})['then'](function(_0x5df6a4){if(_0x5df6a4){return _0x5df6a4[_0xc87b('0x6c')](_0x347c16[_0xc87b('0x31')][_0xc87b('0x5d')])[_0xc87b('0x23')](function(){if(_[_0xc87b('0x72')](_0x347c16['query'][_0xc87b('0x5d')])){for(var _0x244235=0x0;_0x244235<_0x347c16[_0xc87b('0x31')][_0xc87b('0x5d')][_0xc87b('0x37')];_0x244235+=0x1){socket[_0xc87b('0x73')]('userTeam:remove',{'UserId':Number(_0x347c16['query']['ids'][_0x244235]),'TeamId':Number(_0x347c16[_0xc87b('0x50')]['id'])});}}else{socket[_0xc87b('0x73')](_0xc87b('0x74'),{'UserId':Number(_0x347c16['query'][_0xc87b('0x5d')]),'TeamId':Number(_0x347c16[_0xc87b('0x50')]['id'])});}});}})['then'](respondWithStatusCode(_0x176b7f,null))['catch'](handleError(_0x176b7f,null));};exports['getAgents']=function(_0x3fa6a2,_0x28e7e2,_0x430086){var _0x32d390={};var _0x43f857={};var _0x12ebe4;var _0x4bd067;return db[_0xc87b('0x2c')][_0xc87b('0x51')]({'where':{'id':_0x3fa6a2[_0xc87b('0x50')]['id']}})[_0xc87b('0x23')](handleEntityNotFound(_0x28e7e2,null))[_0xc87b('0x23')](function(_0x1bc858){if(_0x1bc858){_0x12ebe4=_0x1bc858;_0x43f857['model']=_[_0xc87b('0x32')](db['User'][_0xc87b('0x2d')]);_0x43f857[_0xc87b('0x31')]=_[_0xc87b('0x32')](_0x3fa6a2['query']);_0x43f857[_0xc87b('0x33')]=_[_0xc87b('0x34')](_0x43f857[_0xc87b('0x30')],_0x43f857[_0xc87b('0x31')]);_0x32d390[_0xc87b('0x35')]=_[_0xc87b('0x34')](_0x43f857['model'],qs[_0xc87b('0x36')](_0x3fa6a2['query']['fields']));_0x32d390[_0xc87b('0x35')]=_0x32d390[_0xc87b('0x35')]['length']?_0x32d390[_0xc87b('0x35')]:_0x43f857[_0xc87b('0x30')];_0x32d390[_0xc87b('0x3a')]=qs[_0xc87b('0x3b')](_0x3fa6a2[_0xc87b('0x31')][_0xc87b('0x3b')]);_0x32d390[_0xc87b('0x3c')]=qs[_0xc87b('0x33')](_[_0xc87b('0x3d')](_0x3fa6a2[_0xc87b('0x31')],_0x43f857[_0xc87b('0x33')]));if(_0x3fa6a2['query']['filter']){_0x32d390[_0xc87b('0x3c')]=_['merge'](_0x32d390[_0xc87b('0x3c')],{'$or':_['map'](_0x32d390[_0xc87b('0x35')],function(_0x55c803){var _0x349e98={};_0x349e98[_0x55c803]={'$like':'%'+_0x3fa6a2[_0xc87b('0x31')][_0xc87b('0x3f')]+'%'};return _0x349e98;})});}_0x32d390=_[_0xc87b('0x3e')]({},_0x32d390,_0x3fa6a2['options']);return _0x12ebe4[_0xc87b('0x75')](_0x32d390);}})[_0xc87b('0x23')](function(_0x6e6a9){if(_0x6e6a9){_0x4bd067=_0x6e6a9['length'];if(!_0x3fa6a2['query'][_0xc87b('0x38')](_0xc87b('0x39'))){_0x32d390[_0xc87b('0x1c')]=qs[_0xc87b('0x1c')](_0x3fa6a2[_0xc87b('0x31')]['limit']);_0x32d390[_0xc87b('0x1b')]=qs[_0xc87b('0x1b')](_0x3fa6a2['query'][_0xc87b('0x1b')]);}return _0x12ebe4['getAgents'](_0x32d390);}})['then'](function(_0x131f63){if(_0x131f63){return _0x131f63?{'count':_0x4bd067,'rows':_0x131f63}:null;}})[_0xc87b('0x23')](respondWithResult(_0x28e7e2,null))[_0xc87b('0x45')](handleError(_0x28e7e2,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 405b291..75d7178 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 _0x906e=['remove','emit','hook','exports','events','../../mysqldb','Team','setMaxListeners','save','update'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x906e,0x90));var _0xe906=function(_0x3b56c0,_0xe100d8){_0x3b56c0=_0x3b56c0-0x0;var _0x377efe=_0x906e[_0x3b56c0];return _0x377efe;};'use strict';var EventEmitter=require(_0xe906('0x0'));var Team=require(_0xe906('0x1'))['db'][_0xe906('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xe906('0x3')](0x0);var events={'afterCreate':_0xe906('0x4'),'afterUpdate':_0xe906('0x5'),'afterDestroy':_0xe906('0x6')};function emitEvent(_0x5a8bda){return function(_0x4958a7,_0x17c189,_0x5b4913){TeamEvents['emit'](_0x5a8bda+':'+_0x4958a7['id'],_0x4958a7);TeamEvents[_0xe906('0x7')](_0x5a8bda,_0x4958a7);_0x5b4913(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0xe906('0x8')](e,emitEvent(event));}}module[_0xe906('0x9')]=TeamEvents; \ No newline at end of file +var _0x7a54=['save','update','remove','hasOwnProperty','hook','exports','events','setMaxListeners'];(function(_0x1d87fc,_0x1e5321){var _0x492b56=function(_0x4c6b16){while(--_0x4c6b16){_0x1d87fc['push'](_0x1d87fc['shift']());}};_0x492b56(++_0x1e5321);}(_0x7a54,0x1ce));var _0x47a5=function(_0x95bdc0,_0x1ad848){_0x95bdc0=_0x95bdc0-0x0;var _0x24a938=_0x7a54[_0x95bdc0];return _0x24a938;};'use strict';var EventEmitter=require(_0x47a5('0x0'));var Team=require('../../mysqldb')['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x47a5('0x1')](0x0);var events={'afterCreate':_0x47a5('0x2'),'afterUpdate':_0x47a5('0x3'),'afterDestroy':_0x47a5('0x4')};function emitEvent(_0x45ea43){return function(_0x105564,_0x4a75ea,_0x46b6f0){TeamEvents['emit'](_0x45ea43+':'+_0x105564['id'],_0x105564);TeamEvents['emit'](_0x45ea43,_0x105564);_0x46b6f0(null);};}for(var e in events){if(events[_0x47a5('0x5')](e)){var event=events[e];Team[_0x47a5('0x6')](e,emitEvent(event));}}module[_0x47a5('0x7')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 7bd4476..c3979da 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 _0xafa6=['bluebird','request-promise','path','./team.attributes','define','Team','lodash','util','api'];(function(_0x5c0295,_0x585046){var _0x202650=function(_0x20b2dc){while(--_0x20b2dc){_0x5c0295['push'](_0x5c0295['shift']());}};_0x202650(++_0x585046);}(_0xafa6,0x1a4));var _0x6afa=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0xafa6[_0x2adbeb];return _0x5e18a6;};'use strict';var _=require(_0x6afa('0x0'));var util=require(_0x6afa('0x1'));var logger=require('../../config/logger')(_0x6afa('0x2'));var moment=require('moment');var BPromise=require(_0x6afa('0x3'));var rp=require(_0x6afa('0x4'));var fs=require('fs');var path=require(_0x6afa('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6afa('0x6'));module['exports']=function(_0x5e3434,_0x2b9b23){return _0x5e3434[_0x6afa('0x7')](_0x6afa('0x8'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe6a=['util','../../config/logger','api','bluebird','request-promise','../../config/environment','./team.attributes','exports','define','Team','teams','lodash'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xfe6a,0xfb));var _0xafe6=function(_0x3410de,_0x39d416){_0x3410de=_0x3410de-0x0;var _0x40e220=_0xfe6a[_0x3410de];return _0x40e220;};'use strict';var _=require(_0xafe6('0x0'));var util=require(_0xafe6('0x1'));var logger=require(_0xafe6('0x2'))(_0xafe6('0x3'));var moment=require('moment');var BPromise=require(_0xafe6('0x4'));var rp=require(_0xafe6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xafe6('0x6'));var attributes=require(_0xafe6('0x7'));module[_0xafe6('0x8')]=function(_0x3ed274,_0x5771cb){return _0x3ed274[_0xafe6('0x9')](_0xafe6('0xa'),attributes,{'tableName':_0xafe6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 44cea62..e2b04f2 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 _0xc3c3=['http','redis','localhost','./team.socket','register','request','info','Team,\x20%s,\x20%s','Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xc3c3,0x74));var _0x3c3c=function(_0x176866,_0x391252){_0x176866=_0x176866-0x0;var _0x1b2a54=_0xc3c3[_0x176866];return _0x1b2a54;};'use strict';var _=require(_0x3c3c('0x0'));var util=require(_0x3c3c('0x1'));var moment=require(_0x3c3c('0x2'));var BPromise=require(_0x3c3c('0x3'));var rs=require(_0x3c3c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3c3c('0x5'));var logger=require(_0x3c3c('0x6'))('rpc');var config=require(_0x3c3c('0x7'));var jayson=require(_0x3c3c('0x8'));var client=jayson['client'][_0x3c3c('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x3c3c('0xa')],{'host':_0x3c3c('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3c3c('0xc'))[_0x3c3c('0xd')](socket);function respondWithRpcPromise(_0xb09dc2,_0x15404d,_0x31afab){return new BPromise(function(_0x49f531,_0x5dbe7c){return client[_0x3c3c('0xe')](_0xb09dc2,_0x31afab)['then'](function(_0x1a8bb6){logger[_0x3c3c('0xf')](_0x3c3c('0x10'),_0x15404d,'request\x20sent');logger['debug'](_0x3c3c('0x11'),_0x15404d,_0x3c3c('0x12'),JSON[_0x3c3c('0x13')](_0x1a8bb6));if(_0x1a8bb6[_0x3c3c('0x14')]){if(_0x1a8bb6[_0x3c3c('0x14')][_0x3c3c('0x15')]===0x1f4){logger['error'](_0x3c3c('0x10'),_0x15404d,_0x1a8bb6[_0x3c3c('0x14')]['message']);return _0x5dbe7c(_0x1a8bb6[_0x3c3c('0x14')]['message']);}logger['error'](_0x3c3c('0x10'),_0x15404d,_0x1a8bb6['error'][_0x3c3c('0x16')]);return _0x49f531(_0x1a8bb6[_0x3c3c('0x14')]['message']);}else{logger[_0x3c3c('0xf')]('Team,\x20%s,\x20%s',_0x15404d,_0x3c3c('0x12'));_0x49f531(_0x1a8bb6[_0x3c3c('0x17')]['message']);}})[_0x3c3c('0x18')](function(_0xd6a5e5){logger[_0x3c3c('0x14')](_0x3c3c('0x10'),_0x15404d,_0xd6a5e5);_0x5dbe7c(_0xd6a5e5);});});} \ No newline at end of file +var _0xd53c=['debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./team.socket','request','info','Team,\x20%s,\x20%s','request\x20sent'];(function(_0x43bc64,_0x489fe3){var _0x3ef249=function(_0x136a2c){while(--_0x136a2c){_0x43bc64['push'](_0x43bc64['shift']());}};_0x3ef249(++_0x489fe3);}(_0xd53c,0xbe));var _0xcd53=function(_0x3ef7d8,_0x5d3d85){_0x3ef7d8=_0x3ef7d8-0x0;var _0x48cf35=_0xd53c[_0x3ef7d8];return _0x48cf35;};'use strict';var _=require(_0xcd53('0x0'));var util=require('util');var moment=require(_0xcd53('0x1'));var BPromise=require('bluebird');var rs=require(_0xcd53('0x2'));var fs=require('fs');var Redis=require(_0xcd53('0x3'));var db=require(_0xcd53('0x4'))['db'];var utils=require(_0xcd53('0x5'));var logger=require('../../config/logger')(_0xcd53('0x6'));var config=require('../../config/environment');var jayson=require(_0xcd53('0x7'));var client=jayson[_0xcd53('0x8')][_0xcd53('0x9')]({'port':0x232a});config[_0xcd53('0xa')]=_['defaults'](config[_0xcd53('0xa')],{'host':_0xcd53('0xb'),'port':0x18eb});var socket=require(_0xcd53('0xc'))(new Redis(config[_0xcd53('0xa')]));require(_0xcd53('0xd'))['register'](socket);function respondWithRpcPromise(_0xa4d60a,_0x3d6360,_0x51a73e){return new BPromise(function(_0x51bfdb,_0x12fd3a){return client[_0xcd53('0xe')](_0xa4d60a,_0x51a73e)['then'](function(_0x7c5ea){logger[_0xcd53('0xf')](_0xcd53('0x10'),_0x3d6360,_0xcd53('0x11'));logger[_0xcd53('0x12')](_0xcd53('0x13'),_0x3d6360,_0xcd53('0x11'),JSON[_0xcd53('0x14')](_0x7c5ea));if(_0x7c5ea[_0xcd53('0x15')]){if(_0x7c5ea[_0xcd53('0x15')][_0xcd53('0x16')]===0x1f4){logger['error'](_0xcd53('0x10'),_0x3d6360,_0x7c5ea[_0xcd53('0x15')]['message']);return _0x12fd3a(_0x7c5ea['error'][_0xcd53('0x17')]);}logger[_0xcd53('0x15')](_0xcd53('0x10'),_0x3d6360,_0x7c5ea[_0xcd53('0x15')][_0xcd53('0x17')]);return _0x51bfdb(_0x7c5ea['error'][_0xcd53('0x17')]);}else{logger['info'](_0xcd53('0x10'),_0x3d6360,_0xcd53('0x11'));_0x51bfdb(_0x7c5ea[_0xcd53('0x18')][_0xcd53('0x17')]);}})[_0xcd53('0x19')](function(_0x1af7c2){logger['error'](_0xcd53('0x10'),_0x3d6360,_0x1af7c2);_0x12fd3a(_0x1af7c2);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 28bedbe..744590e 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 _0x524e=['remove','update','emit','removeListener','register','length','team:'];(function(_0x43a7fd,_0xb2af6a){var _0x8547b0=function(_0x51441e){while(--_0x51441e){_0x43a7fd['push'](_0x43a7fd['shift']());}};_0x8547b0(++_0xb2af6a);}(_0x524e,0x15e));var _0xe524=function(_0x2d1b89,_0x5b9055){_0x2d1b89=_0x2d1b89-0x0;var _0x1c830c=_0x524e[_0x2d1b89];return _0x1c830c;};'use strict';var TeamEvents=require('./team.events');var events=['save',_0xe524('0x0'),_0xe524('0x1')];function createListener(_0xc5f6b5,_0x29e619){return function(_0x699159){_0x29e619[_0xe524('0x2')](_0xc5f6b5,_0x699159);};}function removeListener(_0xabd694,_0x32c90b){return function(){TeamEvents[_0xe524('0x3')](_0xabd694,_0x32c90b);};}exports[_0xe524('0x4')]=function(_0x4f75d6){for(var _0xaaeaa9=0x0,_0x41e1a3=events[_0xe524('0x5')];_0xaaeaa9<_0x41e1a3;_0xaaeaa9++){var _0x533c14=events[_0xaaeaa9];var _0x384935=createListener(_0xe524('0x6')+_0x533c14,_0x4f75d6);TeamEvents['on'](_0x533c14,_0x384935);}}; \ No newline at end of file +var _0xe797=['register','length','./team.events','save','remove','update','emit','removeListener'];(function(_0x4e697a,_0x56a14b){var _0x88850c=function(_0x4e368a){while(--_0x4e368a){_0x4e697a['push'](_0x4e697a['shift']());}};_0x88850c(++_0x56a14b);}(_0xe797,0x12a));var _0x7e79=function(_0x1e8a47,_0x5e83ac){_0x1e8a47=_0x1e8a47-0x0;var _0x40e586=_0xe797[_0x1e8a47];return _0x40e586;};'use strict';var TeamEvents=require(_0x7e79('0x0'));var events=[_0x7e79('0x1'),_0x7e79('0x2'),_0x7e79('0x3')];function createListener(_0x366839,_0x34a91e){return function(_0x5317b1){_0x34a91e[_0x7e79('0x4')](_0x366839,_0x5317b1);};}function removeListener(_0x22a597,_0x5ba3bf){return function(){TeamEvents[_0x7e79('0x5')](_0x22a597,_0x5ba3bf);};}exports[_0x7e79('0x6')]=function(_0x3cd4c9){for(var _0x48a8c1=0x0,_0x4fdfa1=events[_0x7e79('0x7')];_0x48a8c1<_0x4fdfa1;_0x48a8c1++){var _0x358bd6=events[_0x48a8c1];var _0x484e66=createListener('team:'+_0x358bd6,_0x3cd4c9);TeamEvents['on'](_0x358bd6,_0x484e66);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index d954c33..ba450b8 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 _0x303e=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','/:id','post','update','delete','destroy','exports','util','path'];(function(_0xfa9b97,_0x24a570){var _0x48cc61=function(_0x49a365){while(--_0x49a365){_0xfa9b97['push'](_0xfa9b97['shift']());}};_0x48cc61(++_0x24a570);}(_0x303e,0x185));var _0xe303=function(_0x45085a,_0x4f12c4){_0x45085a=_0x45085a-0x0;var _0x249b7b=_0x303e[_0x45085a];return _0x249b7b;};'use strict';var multer=require('multer');var util=require(_0xe303('0x0'));var path=require(_0xe303('0x1'));var timeout=require(_0xe303('0x2'));var express=require(_0xe303('0x3'));var router=express[_0xe303('0x4')]();var auth=require(_0xe303('0x5'));var interaction=require(_0xe303('0x6'));var config=require(_0xe303('0x7'));var controller=require(_0xe303('0x8'));router[_0xe303('0x9')]('/',auth[_0xe303('0xa')](),controller['index']);router[_0xe303('0x9')](_0xe303('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xe303('0xc')]('/',auth[_0xe303('0xa')](),controller['create']);router['put'](_0xe303('0xb'),auth[_0xe303('0xa')](),controller[_0xe303('0xd')]);router[_0xe303('0xe')](_0xe303('0xb'),auth['isAuthenticated'](),controller[_0xe303('0xf')]);module[_0xe303('0x10')]=router; \ No newline at end of file +var _0xf9da=['put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x23a971,_0x70b461){var _0x36c6d3=function(_0x3ccc4e){while(--_0x3ccc4e){_0x23a971['push'](_0x23a971['shift']());}};_0x36c6d3(++_0x70b461);}(_0xf9da,0x82));var _0xaf9d=function(_0x779e96,_0x12508f){_0x779e96=_0x779e96-0x0;var _0x3ce41e=_0xf9da[_0x779e96];return _0x3ce41e;};'use strict';var multer=require('multer');var util=require(_0xaf9d('0x0'));var path=require(_0xaf9d('0x1'));var timeout=require(_0xaf9d('0x2'));var express=require(_0xaf9d('0x3'));var router=express[_0xaf9d('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xaf9d('0x5'));var config=require(_0xaf9d('0x6'));var controller=require(_0xaf9d('0x7'));router[_0xaf9d('0x8')]('/',auth[_0xaf9d('0x9')](),controller[_0xaf9d('0xa')]);router['get'](_0xaf9d('0xb'),auth['isAuthenticated'](),controller[_0xaf9d('0xc')]);router[_0xaf9d('0xd')]('/',auth[_0xaf9d('0x9')](),controller['create']);router[_0xaf9d('0xe')](_0xaf9d('0xb'),auth[_0xaf9d('0x9')](),controller[_0xaf9d('0xf')]);router[_0xaf9d('0x10')](_0xaf9d('0xb'),auth[_0xaf9d('0x9')](),controller['destroy']);module[_0xaf9d('0x11')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index d5e0236..07495ef 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 _0x9f49=['sequelize','exports','STRING','TEXT'];(function(_0x29c33d,_0x4bc7d1){var _0x4fe384=function(_0x25f63f){while(--_0x25f63f){_0x29c33d['push'](_0x29c33d['shift']());}};_0x4fe384(++_0x4bc7d1);}(_0x9f49,0x1b0));var _0x99f4=function(_0xc7b94e,_0x1112b6){_0xc7b94e=_0xc7b94e-0x0;var _0x489b82=_0x9f49[_0xc7b94e];return _0x489b82;};'use strict';var Sequelize=require(_0x99f4('0x0'));module[_0x99f4('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x99f4('0x2')]},'html':{'type':Sequelize[_0x99f4('0x3')]}}; \ No newline at end of file +var _0xe754=['STRING','TEXT','exports'];(function(_0x4bc6b1,_0x3ea45d){var _0x26c505=function(_0x5d4925){while(--_0x5d4925){_0x4bc6b1['push'](_0x4bc6b1['shift']());}};_0x26c505(++_0x3ea45d);}(_0xe754,0xaa));var _0x4e75=function(_0x3ee02a,_0x239e72){_0x3ee02a=_0x3ee02a-0x0;var _0x4fe031=_0xe754[_0x3ee02a];return _0x4fe031;};'use strict';var Sequelize=require('sequelize');module[_0x4e75('0x0')]={'name':{'type':Sequelize[_0x4e75('0x1')]},'description':{'type':Sequelize[_0x4e75('0x1')]},'html':{'type':Sequelize[_0x4e75('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index c6613b7..9359072 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 _0x9f48=['../../config/environment','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','Template','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x9f48,0x1de));var _0x89f4=function(_0x1581f3,_0x26f75a){_0x1581f3=_0x1581f3-0x0;var _0x519f3b=_0x9f48[_0x1581f3];return _0x519f3b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x89f4('0x0'));var rimraf=require(_0x89f4('0x1'));var zipdir=require(_0x89f4('0x2'));var jsonpatch=require(_0x89f4('0x3'));var rp=require(_0x89f4('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x89f4('0x5'));var path=require('path');var sox=require(_0x89f4('0x6'));var csv=require(_0x89f4('0x7'));var ejs=require(_0x89f4('0x8'));var fs=require('fs');var _=require(_0x89f4('0x9'));var squel=require('squel');var crypto=require(_0x89f4('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x89f4('0xb'));var toCsv=require(_0x89f4('0x7'));var querystring=require(_0x89f4('0xc'));var Papa=require(_0x89f4('0xd'));var Redis=require(_0x89f4('0xe'));var authService=require(_0x89f4('0xf'));var qs=require(_0x89f4('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x89f4('0x11'));var logger=require(_0x89f4('0x12'))('api');var utils=require(_0x89f4('0x13'));var config=require(_0x89f4('0x14'));var db=require(_0x89f4('0x15'))['db'];function respondWithStatusCode(_0x2663db,_0x27f0ca){_0x27f0ca=_0x27f0ca||0xcc;return function(_0x31f3ee){if(_0x31f3ee){return _0x2663db['sendStatus'](_0x27f0ca);}return _0x2663db[_0x89f4('0x16')](_0x27f0ca)[_0x89f4('0x17')]();};}function respondWithResult(_0x592103,_0x25480f){_0x25480f=_0x25480f||0xc8;return function(_0x2b01c7){if(_0x2b01c7){return _0x592103[_0x89f4('0x16')](_0x25480f)['json'](_0x2b01c7);}};}function respondWithFilteredResult(_0x519648,_0x295933){return function(_0x4834e0){if(_0x4834e0){var _0x597fde=_0x4834e0[_0x89f4('0x18')],_0x159219=_0x295933[_0x89f4('0x19')],_0x1194f8=_0x295933[_0x89f4('0x19')]+_0x295933[_0x89f4('0x1a')],_0x4633af;if(_0x1194f8>=_0x597fde){_0x1194f8=_0x597fde;_0x4633af=0xc8;}else{_0x4633af=0xce;}_0x519648['status'](_0x4633af);return _0x519648[_0x89f4('0x1b')](_0x89f4('0x1c'),_0x159219+'-'+_0x1194f8+'/'+_0x597fde)[_0x89f4('0x1d')](_0x4834e0);}return null;};}function patchUpdates(_0x231153){return function(_0x32d083){try{jsonpatch[_0x89f4('0x1e')](_0x32d083,_0x231153,!![]);}catch(_0x18536f){return BPromise['reject'](_0x18536f);}return _0x32d083[_0x89f4('0x1f')]();};}function saveUpdates(_0x53bafc,_0x3f551f){return function(_0xd39561){if(_0xd39561){return _0xd39561[_0x89f4('0x20')](_0x53bafc)[_0x89f4('0x21')](function(_0x3964c0){return _0x3964c0;});}return null;};}function removeEntity(_0x1b6b31,_0x3806a8){return function(_0x3ca8c2){if(_0x3ca8c2){return _0x3ca8c2[_0x89f4('0x22')]()[_0x89f4('0x21')](function(){var _0x539d4f=_0x3ca8c2[_0x89f4('0x23')]({'plain':!![]});var _0x1a333f='Templates';return db[_0x89f4('0x24')][_0x89f4('0x22')]({'where':{'type':_0x1a333f,'resourceId':_0x539d4f['id']}})[_0x89f4('0x21')](function(){return _0x3ca8c2;});})['then'](function(){_0x1b6b31[_0x89f4('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bfe65,_0xbd1ca9){return function(_0x11ead2){if(!_0x11ead2){_0x4bfe65[_0x89f4('0x25')](0x194);}return _0x11ead2;};}function handleError(_0xecf92f,_0x21549a){_0x21549a=_0x21549a||0x1f4;return function(_0x20b945){logger[_0x89f4('0x26')](_0x20b945[_0x89f4('0x27')]);if(_0x20b945[_0x89f4('0x28')]){delete _0x20b945[_0x89f4('0x28')];}_0xecf92f[_0x89f4('0x16')](_0x21549a)[_0x89f4('0x29')](_0x20b945);};}exports[_0x89f4('0x2a')]=function(_0x1c2763,_0x22f0ba){var _0x35cec7={},_0x2a2617={},_0x38aee3={'count':0x0,'rows':[]};var _0x31a46e=_[_0x89f4('0x2b')](db[_0x89f4('0x2c')][_0x89f4('0x2d')],function(_0x367c65){return{'name':_0x367c65[_0x89f4('0x2e')],'type':_0x367c65[_0x89f4('0x2f')][_0x89f4('0x30')]};});_0x2a2617[_0x89f4('0x31')]=_[_0x89f4('0x2b')](_0x31a46e,_0x89f4('0x28'));_0x2a2617[_0x89f4('0x32')]=_[_0x89f4('0x33')](_0x1c2763[_0x89f4('0x32')]);_0x2a2617[_0x89f4('0x34')]=_[_0x89f4('0x35')](_0x2a2617[_0x89f4('0x31')],_0x2a2617['query']);_0x35cec7['attributes']=_[_0x89f4('0x35')](_0x2a2617['model'],qs[_0x89f4('0x36')](_0x1c2763['query'][_0x89f4('0x36')]));_0x35cec7[_0x89f4('0x37')]=_0x35cec7[_0x89f4('0x37')][_0x89f4('0x38')]?_0x35cec7['attributes']:_0x2a2617[_0x89f4('0x31')];if(!_0x1c2763['query'][_0x89f4('0x39')](_0x89f4('0x3a'))){_0x35cec7[_0x89f4('0x1a')]=qs[_0x89f4('0x1a')](_0x1c2763[_0x89f4('0x32')][_0x89f4('0x1a')]);_0x35cec7[_0x89f4('0x19')]=qs['offset'](_0x1c2763[_0x89f4('0x32')]['offset']);}_0x35cec7[_0x89f4('0x3b')]=qs['sort'](_0x1c2763[_0x89f4('0x32')][_0x89f4('0x3c')]);_0x35cec7[_0x89f4('0x3d')]=qs[_0x89f4('0x34')](_[_0x89f4('0x3e')](_0x1c2763[_0x89f4('0x32')],_0x2a2617[_0x89f4('0x34')]));if(_0x1c2763[_0x89f4('0x32')]['filter']){_0x35cec7[_0x89f4('0x3d')]=_['merge'](_0x35cec7['where'],{'$or':_[_0x89f4('0x2b')](_0x31a46e,function(_0x13d52d){if(_0x13d52d[_0x89f4('0x2f')]!==_0x89f4('0x3f')){var _0x257ef5={};_0x257ef5[_0x13d52d[_0x89f4('0x28')]]={'$like':'%'+_0x1c2763['query'][_0x89f4('0x40')]+'%'};return _0x257ef5;}})});}_0x35cec7=_[_0x89f4('0x41')]({},_0x35cec7,_0x1c2763[_0x89f4('0x42')]);var _0xa972b4={'where':_0x35cec7['where']};return db[_0x89f4('0x2c')][_0x89f4('0x18')](_0xa972b4)[_0x89f4('0x21')](function(_0x482952){_0x38aee3['count']=_0x482952;if(_0x1c2763[_0x89f4('0x32')][_0x89f4('0x43')]){_0x35cec7[_0x89f4('0x44')]=[{'all':!![]}];}return db[_0x89f4('0x2c')][_0x89f4('0x45')](_0x35cec7);})[_0x89f4('0x21')](function(_0x386357){_0x38aee3[_0x89f4('0x46')]=_0x386357;return _0x38aee3;})[_0x89f4('0x21')](respondWithFilteredResult(_0x22f0ba,_0x35cec7))[_0x89f4('0x47')](handleError(_0x22f0ba,null));};exports[_0x89f4('0x48')]=function(_0x9f7d8a,_0x5a9357){var _0x53675d={'raw':!![],'where':{'id':_0x9f7d8a[_0x89f4('0x49')]['id']}},_0x4d01d0={};_0x4d01d0['model']=_[_0x89f4('0x33')](db['Template']['rawAttributes']);_0x4d01d0[_0x89f4('0x32')]=_[_0x89f4('0x33')](_0x9f7d8a[_0x89f4('0x32')]);_0x4d01d0[_0x89f4('0x34')]=_[_0x89f4('0x35')](_0x4d01d0[_0x89f4('0x31')],_0x4d01d0['query']);_0x53675d['attributes']=_[_0x89f4('0x35')](_0x4d01d0[_0x89f4('0x31')],qs[_0x89f4('0x36')](_0x9f7d8a[_0x89f4('0x32')][_0x89f4('0x36')]));_0x53675d[_0x89f4('0x37')]=_0x53675d[_0x89f4('0x37')]['length']?_0x53675d[_0x89f4('0x37')]:_0x4d01d0[_0x89f4('0x31')];if(_0x9f7d8a[_0x89f4('0x32')][_0x89f4('0x43')]){_0x53675d['include']=[{'all':!![]}];}_0x53675d=_['merge']({},_0x53675d,_0x9f7d8a[_0x89f4('0x42')]);return db[_0x89f4('0x2c')]['find'](_0x53675d)[_0x89f4('0x21')](handleEntityNotFound(_0x5a9357,null))[_0x89f4('0x21')](respondWithResult(_0x5a9357,null))[_0x89f4('0x47')](handleError(_0x5a9357,null));};exports[_0x89f4('0x4a')]=function(_0x97cf9a,_0x4b40c1){return db[_0x89f4('0x2c')][_0x89f4('0x4a')](_0x97cf9a['body'],{})[_0x89f4('0x21')](function(_0x143640){var _0x2dadfc=_0x97cf9a[_0x89f4('0x4b')]['get']({'plain':!![]});if(!_0x2dadfc)throw new Error(_0x89f4('0x4c'));if(_0x2dadfc[_0x89f4('0x4d')]===_0x89f4('0x4b')){var _0x5938f3=_0x143640['get']({'plain':!![]});var _0x3c843d='Templates';return db['UserProfileSection'][_0x89f4('0x4e')]({'where':{'name':_0x3c843d,'userProfileId':_0x2dadfc[_0x89f4('0x4f')]},'raw':!![]})[_0x89f4('0x21')](function(_0x73fdd){if(_0x73fdd&&_0x73fdd[_0x89f4('0x50')]===0x0){return db[_0x89f4('0x24')][_0x89f4('0x4a')]({'name':_0x5938f3[_0x89f4('0x28')],'resourceId':_0x5938f3['id'],'type':_0x73fdd[_0x89f4('0x28')],'sectionId':_0x73fdd['id']},{})[_0x89f4('0x21')](function(){return _0x143640;});}else{return _0x143640;}})['catch'](function(_0x59492d){logger[_0x89f4('0x26')](_0x89f4('0x51'),_0x59492d);throw _0x59492d;});}return _0x143640;})[_0x89f4('0x21')](respondWithResult(_0x4b40c1,0xc9))['catch'](handleError(_0x4b40c1,null));};exports['update']=function(_0x540f44,_0x110b2a){if(_0x540f44[_0x89f4('0x52')]['id']){delete _0x540f44[_0x89f4('0x52')]['id'];}return db[_0x89f4('0x2c')][_0x89f4('0x4e')]({'where':{'id':_0x540f44[_0x89f4('0x49')]['id']}})[_0x89f4('0x21')](handleEntityNotFound(_0x110b2a,null))[_0x89f4('0x21')](saveUpdates(_0x540f44['body'],null))['then'](respondWithResult(_0x110b2a,null))[_0x89f4('0x47')](handleError(_0x110b2a,null));};exports[_0x89f4('0x22')]=function(_0x2119e9,_0x13f5e8){return db[_0x89f4('0x2c')][_0x89f4('0x4e')]({'where':{'id':_0x2119e9['params']['id']}})[_0x89f4('0x21')](handleEntityNotFound(_0x13f5e8,null))[_0x89f4('0x21')](removeEntity(_0x13f5e8,null))[_0x89f4('0x47')](handleError(_0x13f5e8,null));}; \ No newline at end of file +var _0x5c70=['autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','count','offset','limit','set','Content-Range','json','reject','then','destroy','get','Templates','UserProfileResource','end','stack','name','index','map','Template','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','findAll','rows','catch','show','params','includeAll','include','find','create','user','role','UserProfileSection','userProfileId'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x5c70,0x1eb));var _0x05c7=function(_0x45632e,_0x1774dc){_0x45632e=_0x45632e-0x0;var _0x589218=_0x5c70[_0x45632e];return _0x589218;};'use strict';var pdf=require(_0x05c7('0x0'));var emlformat=require(_0x05c7('0x1'));var rimraf=require(_0x05c7('0x2'));var zipdir=require(_0x05c7('0x3'));var jsonpatch=require(_0x05c7('0x4'));var rp=require('request-promise');var moment=require(_0x05c7('0x5'));var BPromise=require(_0x05c7('0x6'));var Mustache=require(_0x05c7('0x7'));var util=require(_0x05c7('0x8'));var path=require(_0x05c7('0x9'));var sox=require(_0x05c7('0xa'));var csv=require(_0x05c7('0xb'));var ejs=require(_0x05c7('0xc'));var fs=require('fs');var _=require(_0x05c7('0xd'));var squel=require('squel');var crypto=require(_0x05c7('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x05c7('0xf'));var Papa=require(_0x05c7('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x05c7('0x11'));var as=require(_0x05c7('0x12'));var hardwareService=require(_0x05c7('0x13'));var logger=require(_0x05c7('0x14'))('api');var utils=require(_0x05c7('0x15'));var config=require(_0x05c7('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3bcf3f,_0x3f4e3b){_0x3f4e3b=_0x3f4e3b||0xcc;return function(_0x498cda){if(_0x498cda){return _0x3bcf3f[_0x05c7('0x17')](_0x3f4e3b);}return _0x3bcf3f[_0x05c7('0x18')](_0x3f4e3b)['end']();};}function respondWithResult(_0x3916c1,_0x3f836f){_0x3f836f=_0x3f836f||0xc8;return function(_0x363a99){if(_0x363a99){return _0x3916c1[_0x05c7('0x18')](_0x3f836f)['json'](_0x363a99);}};}function respondWithFilteredResult(_0x2ecabd,_0x2b7f3b){return function(_0x3cec10){if(_0x3cec10){var _0x31c48d=_0x3cec10[_0x05c7('0x19')],_0xa43e03=_0x2b7f3b[_0x05c7('0x1a')],_0x1df821=_0x2b7f3b['offset']+_0x2b7f3b[_0x05c7('0x1b')],_0xda7d86;if(_0x1df821>=_0x31c48d){_0x1df821=_0x31c48d;_0xda7d86=0xc8;}else{_0xda7d86=0xce;}_0x2ecabd['status'](_0xda7d86);return _0x2ecabd[_0x05c7('0x1c')](_0x05c7('0x1d'),_0xa43e03+'-'+_0x1df821+'/'+_0x31c48d)[_0x05c7('0x1e')](_0x3cec10);}return null;};}function patchUpdates(_0x4c1460){return function(_0x239bf6){try{jsonpatch['apply'](_0x239bf6,_0x4c1460,!![]);}catch(_0x481248){return BPromise[_0x05c7('0x1f')](_0x481248);}return _0x239bf6['save']();};}function saveUpdates(_0x3f9580,_0x5dedc0){return function(_0x55d2cb){if(_0x55d2cb){return _0x55d2cb['update'](_0x3f9580)[_0x05c7('0x20')](function(_0x174ea6){return _0x174ea6;});}return null;};}function removeEntity(_0x2fe9c3,_0x5616fd){return function(_0x172a9e){if(_0x172a9e){return _0x172a9e[_0x05c7('0x21')]()[_0x05c7('0x20')](function(){var _0x1bf034=_0x172a9e[_0x05c7('0x22')]({'plain':!![]});var _0x51a14f=_0x05c7('0x23');return db[_0x05c7('0x24')][_0x05c7('0x21')]({'where':{'type':_0x51a14f,'resourceId':_0x1bf034['id']}})[_0x05c7('0x20')](function(){return _0x172a9e;});})[_0x05c7('0x20')](function(){_0x2fe9c3['status'](0xcc)[_0x05c7('0x25')]();});}};}function handleEntityNotFound(_0x27c4c6,_0x4895b5){return function(_0xe0d8a3){if(!_0xe0d8a3){_0x27c4c6[_0x05c7('0x17')](0x194);}return _0xe0d8a3;};}function handleError(_0x4df7bd,_0x4fa83a){_0x4fa83a=_0x4fa83a||0x1f4;return function(_0x43a514){logger['error'](_0x43a514[_0x05c7('0x26')]);if(_0x43a514[_0x05c7('0x27')]){delete _0x43a514['name'];}_0x4df7bd[_0x05c7('0x18')](_0x4fa83a)['send'](_0x43a514);};}exports[_0x05c7('0x28')]=function(_0x103542,_0x119c98){var _0x12ee3e={},_0x53ad94={},_0x489cde={'count':0x0,'rows':[]};var _0xa709ef=_[_0x05c7('0x29')](db[_0x05c7('0x2a')][_0x05c7('0x2b')],function(_0x4f3e83){return{'name':_0x4f3e83[_0x05c7('0x2c')],'type':_0x4f3e83[_0x05c7('0x2d')][_0x05c7('0x2e')]};});_0x53ad94['model']=_[_0x05c7('0x29')](_0xa709ef,_0x05c7('0x27'));_0x53ad94[_0x05c7('0x2f')]=_[_0x05c7('0x30')](_0x103542[_0x05c7('0x2f')]);_0x53ad94['filters']=_[_0x05c7('0x31')](_0x53ad94[_0x05c7('0x32')],_0x53ad94[_0x05c7('0x2f')]);_0x12ee3e[_0x05c7('0x33')]=_[_0x05c7('0x31')](_0x53ad94[_0x05c7('0x32')],qs[_0x05c7('0x34')](_0x103542[_0x05c7('0x2f')]['fields']));_0x12ee3e['attributes']=_0x12ee3e[_0x05c7('0x33')]['length']?_0x12ee3e[_0x05c7('0x33')]:_0x53ad94['model'];if(!_0x103542[_0x05c7('0x2f')][_0x05c7('0x35')]('nolimit')){_0x12ee3e['limit']=qs[_0x05c7('0x1b')](_0x103542[_0x05c7('0x2f')][_0x05c7('0x1b')]);_0x12ee3e[_0x05c7('0x1a')]=qs['offset'](_0x103542[_0x05c7('0x2f')]['offset']);}_0x12ee3e[_0x05c7('0x36')]=qs[_0x05c7('0x37')](_0x103542[_0x05c7('0x2f')]['sort']);_0x12ee3e['where']=qs[_0x05c7('0x38')](_[_0x05c7('0x39')](_0x103542[_0x05c7('0x2f')],_0x53ad94[_0x05c7('0x38')]));if(_0x103542[_0x05c7('0x2f')][_0x05c7('0x3a')]){_0x12ee3e[_0x05c7('0x3b')]=_['merge'](_0x12ee3e[_0x05c7('0x3b')],{'$or':_[_0x05c7('0x29')](_0xa709ef,function(_0x2d4934){if(_0x2d4934[_0x05c7('0x2d')]!==_0x05c7('0x3c')){var _0xe27ad5={};_0xe27ad5[_0x2d4934[_0x05c7('0x27')]]={'$like':'%'+_0x103542[_0x05c7('0x2f')][_0x05c7('0x3a')]+'%'};return _0xe27ad5;}})});}_0x12ee3e=_[_0x05c7('0x3d')]({},_0x12ee3e,_0x103542[_0x05c7('0x3e')]);var _0x36c2bb={'where':_0x12ee3e[_0x05c7('0x3b')]};return db[_0x05c7('0x2a')][_0x05c7('0x19')](_0x36c2bb)[_0x05c7('0x20')](function(_0x2b8747){_0x489cde[_0x05c7('0x19')]=_0x2b8747;if(_0x103542[_0x05c7('0x2f')]['includeAll']){_0x12ee3e['include']=[{'all':!![]}];}return db[_0x05c7('0x2a')][_0x05c7('0x3f')](_0x12ee3e);})[_0x05c7('0x20')](function(_0x38de8d){_0x489cde[_0x05c7('0x40')]=_0x38de8d;return _0x489cde;})[_0x05c7('0x20')](respondWithFilteredResult(_0x119c98,_0x12ee3e))[_0x05c7('0x41')](handleError(_0x119c98,null));};exports[_0x05c7('0x42')]=function(_0x3fa77c,_0x49b4f7){var _0x34e821={'raw':!![],'where':{'id':_0x3fa77c[_0x05c7('0x43')]['id']}},_0x2e5f57={};_0x2e5f57[_0x05c7('0x32')]=_['keys'](db[_0x05c7('0x2a')][_0x05c7('0x2b')]);_0x2e5f57[_0x05c7('0x2f')]=_[_0x05c7('0x30')](_0x3fa77c[_0x05c7('0x2f')]);_0x2e5f57[_0x05c7('0x38')]=_['intersection'](_0x2e5f57['model'],_0x2e5f57['query']);_0x34e821['attributes']=_[_0x05c7('0x31')](_0x2e5f57['model'],qs[_0x05c7('0x34')](_0x3fa77c[_0x05c7('0x2f')]['fields']));_0x34e821[_0x05c7('0x33')]=_0x34e821[_0x05c7('0x33')]['length']?_0x34e821[_0x05c7('0x33')]:_0x2e5f57[_0x05c7('0x32')];if(_0x3fa77c['query'][_0x05c7('0x44')]){_0x34e821[_0x05c7('0x45')]=[{'all':!![]}];}_0x34e821=_[_0x05c7('0x3d')]({},_0x34e821,_0x3fa77c[_0x05c7('0x3e')]);return db['Template'][_0x05c7('0x46')](_0x34e821)[_0x05c7('0x20')](handleEntityNotFound(_0x49b4f7,null))[_0x05c7('0x20')](respondWithResult(_0x49b4f7,null))['catch'](handleError(_0x49b4f7,null));};exports[_0x05c7('0x47')]=function(_0x518059,_0x2475b1){return db[_0x05c7('0x2a')][_0x05c7('0x47')](_0x518059['body'],{})[_0x05c7('0x20')](function(_0x7438d2){var _0x3ff7a7=_0x518059[_0x05c7('0x48')][_0x05c7('0x22')]({'plain':!![]});if(!_0x3ff7a7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ff7a7[_0x05c7('0x49')]===_0x05c7('0x48')){var _0x1118b8=_0x7438d2[_0x05c7('0x22')]({'plain':!![]});var _0x46a57a=_0x05c7('0x23');return db[_0x05c7('0x4a')][_0x05c7('0x46')]({'where':{'name':_0x46a57a,'userProfileId':_0x3ff7a7[_0x05c7('0x4b')]},'raw':!![]})[_0x05c7('0x20')](function(_0x36798c){if(_0x36798c&&_0x36798c[_0x05c7('0x4c')]===0x0){return db['UserProfileResource'][_0x05c7('0x47')]({'name':_0x1118b8[_0x05c7('0x27')],'resourceId':_0x1118b8['id'],'type':_0x36798c[_0x05c7('0x27')],'sectionId':_0x36798c['id']},{})[_0x05c7('0x20')](function(){return _0x7438d2;});}else{return _0x7438d2;}})[_0x05c7('0x41')](function(_0x18e0b6){logger[_0x05c7('0x4d')](_0x05c7('0x4e'),_0x18e0b6);throw _0x18e0b6;});}return _0x7438d2;})['then'](respondWithResult(_0x2475b1,0xc9))['catch'](handleError(_0x2475b1,null));};exports[_0x05c7('0x4f')]=function(_0x52ccb2,_0x16087f){if(_0x52ccb2['body']['id']){delete _0x52ccb2[_0x05c7('0x50')]['id'];}return db['Template'][_0x05c7('0x46')]({'where':{'id':_0x52ccb2[_0x05c7('0x43')]['id']}})[_0x05c7('0x20')](handleEntityNotFound(_0x16087f,null))[_0x05c7('0x20')](saveUpdates(_0x52ccb2[_0x05c7('0x50')],null))['then'](respondWithResult(_0x16087f,null))['catch'](handleError(_0x16087f,null));};exports[_0x05c7('0x21')]=function(_0x1a1057,_0x5aee05){return db[_0x05c7('0x2a')][_0x05c7('0x46')]({'where':{'id':_0x1a1057[_0x05c7('0x43')]['id']}})[_0x05c7('0x20')](handleEntityNotFound(_0x5aee05,null))[_0x05c7('0x20')](removeEntity(_0x5aee05,null))['catch'](handleError(_0x5aee05,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index ccc1e4c..f830ae8 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 _0x23c9=['Template','tools_templates','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x18e0bf,_0x2b3088){var _0x13c438=function(_0x377a84){while(--_0x377a84){_0x18e0bf['push'](_0x18e0bf['shift']());}};_0x13c438(++_0x2b3088);}(_0x23c9,0xce));var _0x923c=function(_0x37f5b9,_0x30b602){_0x37f5b9=_0x37f5b9-0x0;var _0x2e1467=_0x23c9[_0x37f5b9];return _0x2e1467;};'use strict';var _=require(_0x923c('0x0'));var util=require(_0x923c('0x1'));var logger=require(_0x923c('0x2'))('api');var moment=require(_0x923c('0x3'));var BPromise=require(_0x923c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x923c('0x5'));var rimraf=require(_0x923c('0x6'));var config=require(_0x923c('0x7'));var attributes=require('./template.attributes');module[_0x923c('0x8')]=function(_0x23da0b,_0x2f500c){return _0x23da0b[_0x923c('0x9')](_0x923c('0xa'),attributes,{'tableName':_0x923c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcfeb=['api','bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','define','Template','lodash','util'];(function(_0x5105bb,_0x5df8e6){var _0x260341=function(_0x2ff1ce){while(--_0x2ff1ce){_0x5105bb['push'](_0x5105bb['shift']());}};_0x260341(++_0x5df8e6);}(_0xcfeb,0x195));var _0xbcfe=function(_0x193453,_0x21318c){_0x193453=_0x193453-0x0;var _0x1bce75=_0xcfeb[_0x193453];return _0x1bce75;};'use strict';var _=require(_0xbcfe('0x0'));var util=require(_0xbcfe('0x1'));var logger=require('../../config/logger')(_0xbcfe('0x2'));var moment=require('moment');var BPromise=require(_0xbcfe('0x3'));var rp=require(_0xbcfe('0x4'));var fs=require('fs');var path=require(_0xbcfe('0x5'));var rimraf=require(_0xbcfe('0x6'));var config=require(_0xbcfe('0x7'));var attributes=require(_0xbcfe('0x8'));module['exports']=function(_0x179426,_0x32b296){return _0x179426[_0xbcfe('0x9')](_0xbcfe('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 1775585..0b88b4a 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 _0xca9d=['include','map','model','GetTemplate','debug','stringify','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','request','then','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','findAll','options','raw','attributes','limit'];(function(_0x248df1,_0x2840d0){var _0x276d5d=function(_0x1afc5b){while(--_0x1afc5b){_0x248df1['push'](_0x248df1['shift']());}};_0x276d5d(++_0x2840d0);}(_0xca9d,0x1c8));var _0xdca9=function(_0x22fa0b,_0x1cd7f8){_0x22fa0b=_0x22fa0b-0x0;var _0x4a9ced=_0xca9d[_0x22fa0b];return _0x4a9ced;};'use strict';var _=require('lodash');var util=require(_0xdca9('0x0'));var moment=require(_0xdca9('0x1'));var BPromise=require('bluebird');var rs=require(_0xdca9('0x2'));var fs=require('fs');var Redis=require(_0xdca9('0x3'));var db=require(_0xdca9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdca9('0x5'))(_0xdca9('0x6'));var config=require(_0xdca9('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x181dbf,_0x4a6606,_0x51caa5){return new BPromise(function(_0x230e50,_0x21248e){return client[_0xdca9('0x8')](_0x181dbf,_0x51caa5)[_0xdca9('0x9')](function(_0x5b16d3){logger['info'](_0xdca9('0xa'),_0x4a6606,_0xdca9('0xb'));logger['debug'](_0xdca9('0xc'),_0x4a6606,_0xdca9('0xb'),JSON['stringify'](_0x5b16d3));if(_0x5b16d3['error']){if(_0x5b16d3[_0xdca9('0xd')][_0xdca9('0xe')]===0x1f4){logger[_0xdca9('0xd')](_0xdca9('0xa'),_0x4a6606,_0x5b16d3['error'][_0xdca9('0xf')]);return _0x21248e(_0x5b16d3[_0xdca9('0xd')][_0xdca9('0xf')]);}logger['error'](_0xdca9('0xa'),_0x4a6606,_0x5b16d3[_0xdca9('0xd')][_0xdca9('0xf')]);return _0x230e50(_0x5b16d3['error']['message']);}else{logger[_0xdca9('0x10')](_0xdca9('0xa'),_0x4a6606,'request\x20sent');_0x230e50(_0x5b16d3[_0xdca9('0x11')][_0xdca9('0xf')]);}})[_0xdca9('0x12')](function(_0x526ae3){logger[_0xdca9('0xd')](_0xdca9('0xa'),_0x4a6606,_0x526ae3);_0x21248e(_0x526ae3);});});}exports['GetTemplate']=function(_0x466dce){var _0x454bba=this;return new Promise(function(_0x3294f5,_0x2e6763){return db['Template'][_0xdca9('0x13')]({'raw':_0x466dce['options']?_0x466dce[_0xdca9('0x14')][_0xdca9('0x15')]===undefined?!![]:![]:!![],'where':_0x466dce[_0xdca9('0x14')]?_0x466dce[_0xdca9('0x14')]['where']||null:null,'attributes':_0x466dce['options']?_0x466dce[_0xdca9('0x14')][_0xdca9('0x16')]||null:null,'limit':_0x466dce['options']?_0x466dce[_0xdca9('0x14')][_0xdca9('0x17')]||null:null,'include':_0x466dce[_0xdca9('0x14')]?_0x466dce['options'][_0xdca9('0x18')]?_[_0xdca9('0x19')](_0x466dce[_0xdca9('0x14')][_0xdca9('0x18')],function(_0x58a7f5){return{'model':db[_0x58a7f5[_0xdca9('0x1a')]],'as':_0x58a7f5['as'],'attributes':_0x58a7f5['attributes'],'include':_0x58a7f5[_0xdca9('0x18')]?_[_0xdca9('0x19')](_0x58a7f5['include'],function(_0x5d617f){return{'model':db[_0x5d617f[_0xdca9('0x1a')]],'as':_0x5d617f['as'],'attributes':_0x5d617f[_0xdca9('0x16')],'include':_0x5d617f[_0xdca9('0x18')]?_[_0xdca9('0x19')](_0x5d617f['include'],function(_0x1340b7){return{'model':db[_0x1340b7[_0xdca9('0x1a')]],'as':_0x1340b7['as'],'attributes':_0x1340b7[_0xdca9('0x16')]};}):[]};}):[]};}):[]:[]})[_0xdca9('0x9')](function(_0xb5ab1e){logger[_0xdca9('0x10')](_0xdca9('0x1b'),_0x466dce);logger[_0xdca9('0x1c')]('GetTemplate',_0x466dce,JSON[_0xdca9('0x1d')](_0xb5ab1e));_0x3294f5(_0xb5ab1e);})['catch'](function(_0x67632b){logger['error']('GetTemplate',_0x67632b['message'],_0x466dce);_0x2e6763(_0x454bba[_0xdca9('0xd')](0x1f4,_0x67632b[_0xdca9('0xf')]));});});}; \ No newline at end of file +var _0x304d=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','GetTemplate','findAll','options','where','attributes','limit','include','map','model'];(function(_0x11d684,_0x4d4123){var _0x78a301=function(_0x1a1966){while(--_0x1a1966){_0x11d684['push'](_0x11d684['shift']());}};_0x78a301(++_0x4d4123);}(_0x304d,0x66));var _0xd304=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x304d[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xd304('0x0'));var util=require(_0xd304('0x1'));var moment=require(_0xd304('0x2'));var BPromise=require(_0xd304('0x3'));var rs=require(_0xd304('0x4'));var fs=require('fs');var Redis=require(_0xd304('0x5'));var db=require(_0xd304('0x6'))['db'];var utils=require(_0xd304('0x7'));var logger=require(_0xd304('0x8'))('rpc');var config=require(_0xd304('0x9'));var jayson=require(_0xd304('0xa'));var client=jayson[_0xd304('0xb')][_0xd304('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2eae79,_0x15f370,_0x5052cc){return new BPromise(function(_0x19fb67,_0x503493){return client[_0xd304('0xd')](_0x2eae79,_0x5052cc)[_0xd304('0xe')](function(_0x30702d){logger[_0xd304('0xf')](_0xd304('0x10'),_0x15f370,'request\x20sent');logger[_0xd304('0x11')](_0xd304('0x12'),_0x15f370,'request\x20sent',JSON[_0xd304('0x13')](_0x30702d));if(_0x30702d['error']){if(_0x30702d['error']['code']===0x1f4){logger[_0xd304('0x14')](_0xd304('0x10'),_0x15f370,_0x30702d[_0xd304('0x14')][_0xd304('0x15')]);return _0x503493(_0x30702d[_0xd304('0x14')]['message']);}logger[_0xd304('0x14')]('Template,\x20%s,\x20%s',_0x15f370,_0x30702d['error']['message']);return _0x19fb67(_0x30702d[_0xd304('0x14')][_0xd304('0x15')]);}else{logger[_0xd304('0xf')](_0xd304('0x10'),_0x15f370,_0xd304('0x16'));_0x19fb67(_0x30702d[_0xd304('0x17')][_0xd304('0x15')]);}})[_0xd304('0x18')](function(_0x2e1d19){logger[_0xd304('0x14')](_0xd304('0x10'),_0x15f370,_0x2e1d19);_0x503493(_0x2e1d19);});});}exports[_0xd304('0x19')]=function(_0x459653){var _0x10c016=this;return new Promise(function(_0x42e448,_0x171459){return db['Template'][_0xd304('0x1a')]({'raw':_0x459653[_0xd304('0x1b')]?_0x459653[_0xd304('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x459653[_0xd304('0x1b')]?_0x459653[_0xd304('0x1b')][_0xd304('0x1c')]||null:null,'attributes':_0x459653[_0xd304('0x1b')]?_0x459653[_0xd304('0x1b')][_0xd304('0x1d')]||null:null,'limit':_0x459653[_0xd304('0x1b')]?_0x459653[_0xd304('0x1b')][_0xd304('0x1e')]||null:null,'include':_0x459653[_0xd304('0x1b')]?_0x459653[_0xd304('0x1b')][_0xd304('0x1f')]?_[_0xd304('0x20')](_0x459653[_0xd304('0x1b')][_0xd304('0x1f')],function(_0x1462e4){return{'model':db[_0x1462e4[_0xd304('0x21')]],'as':_0x1462e4['as'],'attributes':_0x1462e4[_0xd304('0x1d')],'include':_0x1462e4[_0xd304('0x1f')]?_[_0xd304('0x20')](_0x1462e4[_0xd304('0x1f')],function(_0x35a01b){return{'model':db[_0x35a01b['model']],'as':_0x35a01b['as'],'attributes':_0x35a01b[_0xd304('0x1d')],'include':_0x35a01b[_0xd304('0x1f')]?_[_0xd304('0x20')](_0x35a01b[_0xd304('0x1f')],function(_0x103ae9){return{'model':db[_0x103ae9[_0xd304('0x21')]],'as':_0x103ae9['as'],'attributes':_0x103ae9['attributes']};}):[]};}):[]};}):[]:[]})[_0xd304('0xe')](function(_0x2c3495){logger[_0xd304('0xf')]('GetTemplate',_0x459653);logger[_0xd304('0x11')]('GetTemplate',_0x459653,JSON[_0xd304('0x13')](_0x2c3495));_0x42e448(_0x2c3495);})[_0xd304('0x18')](function(_0xe4a684){logger[_0xd304('0x14')](_0xd304('0x19'),_0xe4a684[_0xd304('0x15')],_0x459653);_0x171459(_0x10c016['error'](0x1f4,_0xe4a684[_0xd304('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 52d5eee..7e57bd6 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 _0x8819=['addAllCondition','addAnyCondition','/:id/actions','update','/:id','destroy','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','show','getAllConditions','/:id/any_conditions','getAnyConditions','post','create','/:id/all_conditions'];(function(_0x11c73f,_0x3bbd19){var _0x503a57=function(_0x5bbbbb){while(--_0x5bbbbb){_0x11c73f['push'](_0x11c73f['shift']());}};_0x503a57(++_0x3bbd19);}(_0x8819,0x1bb));var _0x9881=function(_0x1827f7,_0x22c525){_0x1827f7=_0x1827f7-0x0;var _0x1b3847=_0x8819[_0x1827f7];return _0x1b3847;};'use strict';var multer=require(_0x9881('0x0'));var util=require(_0x9881('0x1'));var path=require('path');var timeout=require(_0x9881('0x2'));var express=require(_0x9881('0x3'));var router=express['Router']();var auth=require(_0x9881('0x4'));var interaction=require(_0x9881('0x5'));var config=require(_0x9881('0x6'));var controller=require(_0x9881('0x7'));router[_0x9881('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9881('0x8')]('/:id',auth[_0x9881('0x9')](),controller[_0x9881('0xa')]);router[_0x9881('0x8')]('/:id/all_conditions',auth[_0x9881('0x9')](),controller[_0x9881('0xb')]);router['get'](_0x9881('0xc'),auth[_0x9881('0x9')](),controller[_0x9881('0xd')]);router[_0x9881('0x8')]('/:id/actions',auth[_0x9881('0x9')](),controller['getActions']);router[_0x9881('0xe')]('/',auth[_0x9881('0x9')](),controller[_0x9881('0xf')]);router[_0x9881('0xe')](_0x9881('0x10'),auth['isAuthenticated'](),controller[_0x9881('0x11')]);router[_0x9881('0xe')](_0x9881('0xc'),auth[_0x9881('0x9')](),controller[_0x9881('0x12')]);router['post'](_0x9881('0x13'),auth['isAuthenticated'](),controller['addAction']);router['put']('/:id',auth[_0x9881('0x9')](),controller[_0x9881('0x14')]);router['delete'](_0x9881('0x15'),auth[_0x9881('0x9')](),controller[_0x9881('0x16')]);module['exports']=router; \ No newline at end of file +var _0xf27a=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','post','create','/:id/all_conditions','addAllCondition','addAnyCondition','update','delete','exports'];(function(_0x5df90f,_0x5913a8){var _0x1f7bf3=function(_0x5d901e){while(--_0x5d901e){_0x5df90f['push'](_0x5df90f['shift']());}};_0x1f7bf3(++_0x5913a8);}(_0xf27a,0x1c8));var _0xaf27=function(_0x49e34d,_0x51070d){_0x49e34d=_0x49e34d-0x0;var _0x11d01e=_0xf27a[_0x49e34d];return _0x11d01e;};'use strict';var multer=require(_0xaf27('0x0'));var util=require(_0xaf27('0x1'));var path=require(_0xaf27('0x2'));var timeout=require(_0xaf27('0x3'));var express=require('express');var router=express[_0xaf27('0x4')]();var auth=require(_0xaf27('0x5'));var interaction=require(_0xaf27('0x6'));var config=require('../../config/environment');var controller=require('./trigger.controller');router['get']('/',auth[_0xaf27('0x7')](),controller[_0xaf27('0x8')]);router[_0xaf27('0x9')](_0xaf27('0xa'),auth['isAuthenticated'](),controller[_0xaf27('0xb')]);router[_0xaf27('0x9')]('/:id/all_conditions',auth[_0xaf27('0x7')](),controller[_0xaf27('0xc')]);router[_0xaf27('0x9')](_0xaf27('0xd'),auth['isAuthenticated'](),controller[_0xaf27('0xe')]);router[_0xaf27('0x9')](_0xaf27('0xf'),auth[_0xaf27('0x7')](),controller['getActions']);router[_0xaf27('0x10')]('/',auth[_0xaf27('0x7')](),controller[_0xaf27('0x11')]);router[_0xaf27('0x10')](_0xaf27('0x12'),auth[_0xaf27('0x7')](),controller[_0xaf27('0x13')]);router[_0xaf27('0x10')](_0xaf27('0xd'),auth['isAuthenticated'](),controller[_0xaf27('0x14')]);router[_0xaf27('0x10')](_0xaf27('0xf'),auth[_0xaf27('0x7')](),controller['addAction']);router['put'](_0xaf27('0xa'),auth['isAuthenticated'](),controller[_0xaf27('0x15')]);router[_0xaf27('0x16')](_0xaf27('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xaf27('0x17')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index ded64d6..0c3d766 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 _0xdf74=['STRING','BOOLEAN','sequelize','exports'];(function(_0x8f3866,_0x269978){var _0x58ea7b=function(_0x277ab7){while(--_0x277ab7){_0x8f3866['push'](_0x8f3866['shift']());}};_0x58ea7b(++_0x269978);}(_0xdf74,0x192));var _0x4df7=function(_0x3bdf06,_0x31bd37){_0x3bdf06=_0x3bdf06-0x0;var _0x95d5e5=_0xdf74[_0x3bdf06];return _0x95d5e5;};'use strict';var Sequelize=require(_0x4df7('0x0'));module[_0x4df7('0x1')]={'name':{'type':Sequelize[_0x4df7('0x2')]},'channel':{'type':Sequelize[_0x4df7('0x2')]},'description':{'type':Sequelize[_0x4df7('0x2')]},'status':{'type':Sequelize[_0x4df7('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xf10e=['exports','STRING','sequelize'];(function(_0x543eac,_0x3a39a1){var _0x16c036=function(_0x446e5d){while(--_0x446e5d){_0x543eac['push'](_0x543eac['shift']());}};_0x16c036(++_0x3a39a1);}(_0xf10e,0x161));var _0xef10=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0xf10e[_0x3740fe];return _0x55492b;};'use strict';var Sequelize=require(_0xef10('0x0'));module[_0xef10('0x1')]={'name':{'type':Sequelize[_0xef10('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xef10('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 7c6be03..4573f72 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 _0x81d4=['ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','reject','save','then','destroy','get','Triggers','error','stack','name','send','index','map','Trigger','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','role','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','findOne','getAllConditions','hasOwnProperty','getAnyConditions','addAction','TriggerId','Action','getActions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse'];(function(_0xba1760,_0x191969){var _0x1f3143=function(_0x5aa807){while(--_0x5aa807){_0xba1760['push'](_0xba1760['shift']());}};_0x1f3143(++_0x191969);}(_0x81d4,0x1ca));var _0x481d=function(_0x369bae,_0xaed164){_0x369bae=_0x369bae-0x0;var _0x585cb8=_0x81d4[_0x369bae];return _0x585cb8;};'use strict';var pdf=require(_0x481d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x481d('0x1'));var zipdir=require(_0x481d('0x2'));var jsonpatch=require(_0x481d('0x3'));var rp=require(_0x481d('0x4'));var moment=require('moment');var BPromise=require(_0x481d('0x5'));var Mustache=require(_0x481d('0x6'));var util=require(_0x481d('0x7'));var path=require(_0x481d('0x8'));var sox=require('sox');var csv=require(_0x481d('0x9'));var ejs=require(_0x481d('0xa'));var fs=require('fs');var _=require(_0x481d('0xb'));var squel=require(_0x481d('0xc'));var crypto=require(_0x481d('0xd'));var jsforce=require(_0x481d('0xe'));var deskjs=require(_0x481d('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x481d('0x10'));var Redis=require(_0x481d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x481d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x481d('0x13'));var logger=require(_0x481d('0x14'))(_0x481d('0x15'));var utils=require(_0x481d('0x16'));var config=require(_0x481d('0x17'));var db=require(_0x481d('0x18'))['db'];function respondWithStatusCode(_0x3d9cb6,_0x253324){_0x253324=_0x253324||0xcc;return function(_0x348f18){if(_0x348f18){return _0x3d9cb6[_0x481d('0x19')](_0x253324);}return _0x3d9cb6[_0x481d('0x1a')](_0x253324)[_0x481d('0x1b')]();};}function respondWithResult(_0x16e0ec,_0x101eb0){_0x101eb0=_0x101eb0||0xc8;return function(_0x137193){if(_0x137193){return _0x16e0ec['status'](_0x101eb0)[_0x481d('0x1c')](_0x137193);}};}function respondWithFilteredResult(_0x477b2e,_0x2aa561){return function(_0xe25d67){if(_0xe25d67){var _0x4e25af=_0xe25d67[_0x481d('0x1d')],_0x4e9e98=_0x2aa561[_0x481d('0x1e')],_0x3c8674=_0x2aa561[_0x481d('0x1e')]+_0x2aa561['limit'],_0x31487b;if(_0x3c8674>=_0x4e25af){_0x3c8674=_0x4e25af;_0x31487b=0xc8;}else{_0x31487b=0xce;}_0x477b2e['status'](_0x31487b);return _0x477b2e[_0x481d('0x1f')]('Content-Range',_0x4e9e98+'-'+_0x3c8674+'/'+_0x4e25af)[_0x481d('0x1c')](_0xe25d67);}return null;};}function patchUpdates(_0xbe8f46){return function(_0x79adff){try{jsonpatch[_0x481d('0x20')](_0x79adff,_0xbe8f46,!![]);}catch(_0x1320d1){return BPromise[_0x481d('0x21')](_0x1320d1);}return _0x79adff[_0x481d('0x22')]();};}function saveUpdates(_0x2d0ca8,_0x59f24f){return function(_0x378fd0){if(_0x378fd0){return _0x378fd0['update'](_0x2d0ca8)[_0x481d('0x23')](function(_0x2d0933){return _0x2d0933;});}return null;};}function removeEntity(_0x4bc31b,_0x1dff91){return function(_0x11ab9d){if(_0x11ab9d){return _0x11ab9d[_0x481d('0x24')]()[_0x481d('0x23')](function(){var _0x2fe442=_0x11ab9d[_0x481d('0x25')]({'plain':!![]});var _0x3c184f=_0x481d('0x26');return db['UserProfileResource'][_0x481d('0x24')]({'where':{'type':_0x3c184f,'resourceId':_0x2fe442['id']}})[_0x481d('0x23')](function(){return _0x11ab9d;});})[_0x481d('0x23')](function(){_0x4bc31b[_0x481d('0x1a')](0xcc)[_0x481d('0x1b')]();});}};}function handleEntityNotFound(_0x69507f,_0x3dd2ce){return function(_0x55defd){if(!_0x55defd){_0x69507f['sendStatus'](0x194);}return _0x55defd;};}function handleError(_0x4db983,_0xc81350){_0xc81350=_0xc81350||0x1f4;return function(_0x287698){logger[_0x481d('0x27')](_0x287698[_0x481d('0x28')]);if(_0x287698[_0x481d('0x29')]){delete _0x287698[_0x481d('0x29')];}_0x4db983['status'](_0xc81350)[_0x481d('0x2a')](_0x287698);};}exports[_0x481d('0x2b')]=function(_0x786969,_0x1e8682){var _0x2ec7dd={},_0x379a0d={},_0x2218b7={'count':0x0,'rows':[]};var _0x5a891b=_[_0x481d('0x2c')](db[_0x481d('0x2d')][_0x481d('0x2e')],function(_0x2192a7){return{'name':_0x2192a7['fieldName'],'type':_0x2192a7[_0x481d('0x2f')][_0x481d('0x30')]};});_0x379a0d['model']=_[_0x481d('0x2c')](_0x5a891b,_0x481d('0x29'));_0x379a0d[_0x481d('0x31')]=_[_0x481d('0x32')](_0x786969['query']);_0x379a0d[_0x481d('0x33')]=_[_0x481d('0x34')](_0x379a0d[_0x481d('0x35')],_0x379a0d[_0x481d('0x31')]);_0x2ec7dd['attributes']=_[_0x481d('0x34')](_0x379a0d[_0x481d('0x35')],qs[_0x481d('0x36')](_0x786969[_0x481d('0x31')][_0x481d('0x36')]));_0x2ec7dd['attributes']=_0x2ec7dd[_0x481d('0x37')][_0x481d('0x38')]?_0x2ec7dd[_0x481d('0x37')]:_0x379a0d['model'];if(!_0x786969[_0x481d('0x31')]['hasOwnProperty'](_0x481d('0x39'))){_0x2ec7dd['limit']=qs[_0x481d('0x3a')](_0x786969['query'][_0x481d('0x3a')]);_0x2ec7dd[_0x481d('0x1e')]=qs[_0x481d('0x1e')](_0x786969[_0x481d('0x31')][_0x481d('0x1e')]);}_0x2ec7dd[_0x481d('0x3b')]=qs[_0x481d('0x3c')](_0x786969[_0x481d('0x31')][_0x481d('0x3c')]);_0x2ec7dd[_0x481d('0x3d')]=qs[_0x481d('0x33')](_[_0x481d('0x3e')](_0x786969['query'],_0x379a0d[_0x481d('0x33')]));if(_0x786969[_0x481d('0x31')][_0x481d('0x3f')]){_0x2ec7dd[_0x481d('0x3d')]=_[_0x481d('0x40')](_0x2ec7dd['where'],{'$or':_[_0x481d('0x2c')](_0x5a891b,function(_0x3c7641){if(_0x3c7641[_0x481d('0x2f')]!==_0x481d('0x41')){var _0x345d95={};_0x345d95[_0x3c7641[_0x481d('0x29')]]={'$like':'%'+_0x786969[_0x481d('0x31')][_0x481d('0x3f')]+'%'};return _0x345d95;}})});}_0x2ec7dd=_[_0x481d('0x40')]({},_0x2ec7dd,_0x786969[_0x481d('0x42')]);var _0x31b3f9={'where':_0x2ec7dd[_0x481d('0x3d')]};return db[_0x481d('0x2d')][_0x481d('0x1d')](_0x31b3f9)[_0x481d('0x23')](function(_0x3e6c4a){_0x2218b7['count']=_0x3e6c4a;if(_0x786969[_0x481d('0x31')][_0x481d('0x43')]){_0x2ec7dd[_0x481d('0x44')]=[{'all':!![]}];}return db['Trigger'][_0x481d('0x45')](_0x2ec7dd);})['then'](function(_0x2a4f2d){_0x2218b7[_0x481d('0x46')]=_0x2a4f2d;return _0x2218b7;})[_0x481d('0x23')](respondWithFilteredResult(_0x1e8682,_0x2ec7dd))[_0x481d('0x47')](handleError(_0x1e8682,null));};exports[_0x481d('0x48')]=function(_0x646ef3,_0x1cc5e3){var _0x4ab98b={'raw':![],'where':{'id':_0x646ef3[_0x481d('0x49')]['id']}},_0x998c52={};_0x998c52[_0x481d('0x35')]=_[_0x481d('0x32')](db[_0x481d('0x2d')][_0x481d('0x2e')]);_0x998c52[_0x481d('0x31')]=_[_0x481d('0x32')](_0x646ef3['query']);_0x998c52[_0x481d('0x33')]=_[_0x481d('0x34')](_0x998c52[_0x481d('0x35')],_0x998c52[_0x481d('0x31')]);_0x4ab98b['attributes']=_[_0x481d('0x34')](_0x998c52['model'],qs[_0x481d('0x36')](_0x646ef3[_0x481d('0x31')]['fields']));_0x4ab98b[_0x481d('0x37')]=_0x4ab98b[_0x481d('0x37')]['length']?_0x4ab98b['attributes']:_0x998c52[_0x481d('0x35')];if(_0x646ef3['query'][_0x481d('0x43')]){_0x4ab98b['include']=[{'all':!![]}];}_0x4ab98b=_[_0x481d('0x40')]({},_0x4ab98b,_0x646ef3[_0x481d('0x42')]);return db[_0x481d('0x2d')][_0x481d('0x4a')](_0x4ab98b)['then'](handleEntityNotFound(_0x1cc5e3,null))[_0x481d('0x23')](respondWithResult(_0x1cc5e3,null))['catch'](handleError(_0x1cc5e3,null));};exports[_0x481d('0x4b')]=function(_0x50789d,_0x2eb631){return db[_0x481d('0x2d')][_0x481d('0x4b')](_0x50789d['body'],{})[_0x481d('0x23')](function(_0x194225){var _0x26823b=_0x50789d['user'][_0x481d('0x25')]({'plain':!![]});if(!_0x26823b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26823b[_0x481d('0x4c')]==='user'){var _0x5f5c92=_0x194225['get']({'plain':!![]});var _0x4f1d7c=_0x481d('0x26');return db[_0x481d('0x4d')][_0x481d('0x4a')]({'where':{'name':_0x4f1d7c,'userProfileId':_0x26823b['userProfileId']},'raw':!![]})[_0x481d('0x23')](function(_0x32adf2){if(_0x32adf2&&_0x32adf2['autoAssociation']===0x0){return db[_0x481d('0x4e')][_0x481d('0x4b')]({'name':_0x5f5c92[_0x481d('0x29')],'resourceId':_0x5f5c92['id'],'type':_0x32adf2[_0x481d('0x29')],'sectionId':_0x32adf2['id']},{})[_0x481d('0x23')](function(){return _0x194225;});}else{return _0x194225;}})['catch'](function(_0x35da2b){logger[_0x481d('0x27')](_0x481d('0x4f'),_0x35da2b);throw _0x35da2b;});}return _0x194225;})[_0x481d('0x23')](respondWithResult(_0x2eb631,0xc9))[_0x481d('0x47')](handleError(_0x2eb631,null));};exports[_0x481d('0x50')]=function(_0xfd0207,_0xad79de){if(_0xfd0207[_0x481d('0x51')]['id']){delete _0xfd0207[_0x481d('0x51')]['id'];}return db[_0x481d('0x2d')][_0x481d('0x4a')]({'where':{'id':_0xfd0207[_0x481d('0x49')]['id']}})[_0x481d('0x23')](handleEntityNotFound(_0xad79de,null))['then'](saveUpdates(_0xfd0207['body'],null))[_0x481d('0x23')](respondWithResult(_0xad79de,null))[_0x481d('0x47')](handleError(_0xad79de,null));};exports[_0x481d('0x24')]=function(_0x1958c0,_0x536267){return db['Trigger'][_0x481d('0x4a')]({'where':{'id':_0x1958c0[_0x481d('0x49')]['id']}})[_0x481d('0x23')](handleEntityNotFound(_0x536267,null))[_0x481d('0x23')](removeEntity(_0x536267,null))[_0x481d('0x47')](handleError(_0x536267,null));};exports[_0x481d('0x52')]=function(_0x2df0b6,_0x47b03a,_0x4025c7){if(_0x2df0b6[_0x481d('0x51')]['id']){delete _0x2df0b6[_0x481d('0x51')]['id'];}return db[_0x481d('0x2d')][_0x481d('0x4a')]({'where':{'id':_0x2df0b6[_0x481d('0x49')]['id']}})['then'](handleEntityNotFound(_0x47b03a,null))[_0x481d('0x23')](function(_0x7e4754){if(_0x7e4754){_0x2df0b6[_0x481d('0x51')][_0x481d('0x53')]=_0x7e4754['id'];return db[_0x481d('0x54')][_0x481d('0x4b')](_0x2df0b6[_0x481d('0x51')]);}})[_0x481d('0x23')](respondWithResult(_0x47b03a,null))[_0x481d('0x47')](handleError(_0x47b03a,null));};exports[_0x481d('0x55')]=function(_0x2a8b16,_0x526080,_0x376d7f){if(_0x2a8b16[_0x481d('0x51')]['id']){delete _0x2a8b16[_0x481d('0x51')]['id'];}return db[_0x481d('0x2d')][_0x481d('0x4a')]({'where':{'id':_0x2a8b16[_0x481d('0x49')]['id']}})['then'](handleEntityNotFound(_0x526080,null))[_0x481d('0x23')](function(_0x51c0a2){if(_0x51c0a2){_0x2a8b16[_0x481d('0x51')][_0x481d('0x56')]=_0x51c0a2['id'];return db[_0x481d('0x54')]['create'](_0x2a8b16[_0x481d('0x51')]);}})[_0x481d('0x23')](respondWithResult(_0x526080,null))[_0x481d('0x47')](handleError(_0x526080,null));};exports['getAllConditions']=function(_0x37c222,_0x39be6f,_0x384787){var _0x4a2fbe={};var _0x1658df={};var _0x4e1579;var _0x49919a;return db[_0x481d('0x2d')][_0x481d('0x57')]({'where':{'id':_0x37c222[_0x481d('0x49')]['id']}})[_0x481d('0x23')](handleEntityNotFound(_0x39be6f,null))[_0x481d('0x23')](function(_0x376cec){if(_0x376cec){_0x4e1579=_0x376cec;_0x1658df[_0x481d('0x35')]=_[_0x481d('0x32')](db[_0x481d('0x54')]['rawAttributes']);_0x1658df[_0x481d('0x31')]=_[_0x481d('0x32')](_0x37c222['query']);_0x1658df[_0x481d('0x33')]=_[_0x481d('0x34')](_0x1658df[_0x481d('0x35')],_0x1658df[_0x481d('0x31')]);_0x4a2fbe[_0x481d('0x37')]=_['intersection'](_0x1658df['model'],qs[_0x481d('0x36')](_0x37c222[_0x481d('0x31')]['fields']));_0x4a2fbe[_0x481d('0x37')]=_0x4a2fbe[_0x481d('0x37')][_0x481d('0x38')]?_0x4a2fbe[_0x481d('0x37')]:_0x1658df[_0x481d('0x35')];_0x4a2fbe['order']=qs[_0x481d('0x3c')](_0x37c222[_0x481d('0x31')][_0x481d('0x3c')]);_0x4a2fbe[_0x481d('0x3d')]=qs['filters'](_[_0x481d('0x3e')](_0x37c222[_0x481d('0x31')],_0x1658df[_0x481d('0x33')]));if(_0x37c222['query']['filter']){_0x4a2fbe[_0x481d('0x3d')]=_[_0x481d('0x40')](_0x4a2fbe[_0x481d('0x3d')],{'$or':_[_0x481d('0x2c')](_0x4a2fbe['attributes'],function(_0xadbcd5){var _0x3a741c={};_0x3a741c[_0xadbcd5]={'$like':'%'+_0x37c222[_0x481d('0x31')]['filter']+'%'};return _0x3a741c;})});}_0x4a2fbe=_[_0x481d('0x40')]({},_0x4a2fbe,_0x37c222[_0x481d('0x42')]);return _0x4e1579[_0x481d('0x58')](_0x4a2fbe);}})[_0x481d('0x23')](function(_0x51b9a9){if(_0x51b9a9){_0x49919a=_0x51b9a9[_0x481d('0x38')];if(!_0x37c222['query'][_0x481d('0x59')](_0x481d('0x39'))){_0x4a2fbe['limit']=qs[_0x481d('0x3a')](_0x37c222[_0x481d('0x31')]['limit']);_0x4a2fbe['offset']=qs[_0x481d('0x1e')](_0x37c222[_0x481d('0x31')][_0x481d('0x1e')]);}return _0x4e1579['getAllConditions'](_0x4a2fbe);}})[_0x481d('0x23')](function(_0x1118ce){if(_0x1118ce){return _0x1118ce?{'count':_0x49919a,'rows':_0x1118ce}:null;}})[_0x481d('0x23')](respondWithResult(_0x39be6f,null))[_0x481d('0x47')](handleError(_0x39be6f,null));};exports[_0x481d('0x5a')]=function(_0x11f0f0,_0x1083a8,_0x4f28d1){var _0x315087={};var _0x4a2e10={};var _0x3971a3;var _0x108ba9;return db[_0x481d('0x2d')][_0x481d('0x57')]({'where':{'id':_0x11f0f0['params']['id']}})[_0x481d('0x23')](handleEntityNotFound(_0x1083a8,null))[_0x481d('0x23')](function(_0x112fb0){if(_0x112fb0){_0x3971a3=_0x112fb0;_0x4a2e10[_0x481d('0x35')]=_[_0x481d('0x32')](db[_0x481d('0x54')][_0x481d('0x2e')]);_0x4a2e10[_0x481d('0x31')]=_[_0x481d('0x32')](_0x11f0f0['query']);_0x4a2e10[_0x481d('0x33')]=_['intersection'](_0x4a2e10[_0x481d('0x35')],_0x4a2e10[_0x481d('0x31')]);_0x315087[_0x481d('0x37')]=_[_0x481d('0x34')](_0x4a2e10[_0x481d('0x35')],qs[_0x481d('0x36')](_0x11f0f0[_0x481d('0x31')][_0x481d('0x36')]));_0x315087[_0x481d('0x37')]=_0x315087['attributes']['length']?_0x315087[_0x481d('0x37')]:_0x4a2e10[_0x481d('0x35')];_0x315087[_0x481d('0x3b')]=qs[_0x481d('0x3c')](_0x11f0f0[_0x481d('0x31')]['sort']);_0x315087[_0x481d('0x3d')]=qs[_0x481d('0x33')](_[_0x481d('0x3e')](_0x11f0f0[_0x481d('0x31')],_0x4a2e10[_0x481d('0x33')]));if(_0x11f0f0['query'][_0x481d('0x3f')]){_0x315087[_0x481d('0x3d')]=_[_0x481d('0x40')](_0x315087[_0x481d('0x3d')],{'$or':_['map'](_0x315087[_0x481d('0x37')],function(_0x3e98e8){var _0x3a580c={};_0x3a580c[_0x3e98e8]={'$like':'%'+_0x11f0f0[_0x481d('0x31')][_0x481d('0x3f')]+'%'};return _0x3a580c;})});}_0x315087=_[_0x481d('0x40')]({},_0x315087,_0x11f0f0[_0x481d('0x42')]);return _0x3971a3[_0x481d('0x5a')](_0x315087);}})[_0x481d('0x23')](function(_0x3ed985){if(_0x3ed985){_0x108ba9=_0x3ed985['length'];if(!_0x11f0f0[_0x481d('0x31')][_0x481d('0x59')]('nolimit')){_0x315087[_0x481d('0x3a')]=qs[_0x481d('0x3a')](_0x11f0f0[_0x481d('0x31')][_0x481d('0x3a')]);_0x315087[_0x481d('0x1e')]=qs['offset'](_0x11f0f0[_0x481d('0x31')][_0x481d('0x1e')]);}return _0x3971a3[_0x481d('0x5a')](_0x315087);}})[_0x481d('0x23')](function(_0x456896){if(_0x456896){return _0x456896?{'count':_0x108ba9,'rows':_0x456896}:null;}})[_0x481d('0x23')](respondWithResult(_0x1083a8,null))[_0x481d('0x47')](handleError(_0x1083a8,null));};exports[_0x481d('0x5b')]=function(_0x3bb95e,_0x483313,_0x3305d4){if(_0x3bb95e[_0x481d('0x51')]['id']){delete _0x3bb95e['body']['id'];}return db[_0x481d('0x2d')]['find']({'where':{'id':_0x3bb95e['params']['id']}})[_0x481d('0x23')](handleEntityNotFound(_0x483313,null))[_0x481d('0x23')](function(_0x21d471){if(_0x21d471){_0x3bb95e[_0x481d('0x51')][_0x481d('0x5c')]=_0x21d471['id'];return db[_0x481d('0x5d')][_0x481d('0x4b')](_0x3bb95e[_0x481d('0x51')]);}})['then'](respondWithResult(_0x483313,null))[_0x481d('0x47')](handleError(_0x483313,null));};exports[_0x481d('0x5e')]=function(_0x26c09b,_0x2bf210,_0x1540c5){var _0x27a8a9={};var _0x14beb6={};var _0x1b363e;var _0x2ab2ad;return db[_0x481d('0x2d')][_0x481d('0x57')]({'where':{'id':_0x26c09b[_0x481d('0x49')]['id']}})['then'](handleEntityNotFound(_0x2bf210,null))['then'](function(_0x3857ae){if(_0x3857ae){_0x1b363e=_0x3857ae;_0x14beb6[_0x481d('0x35')]=_[_0x481d('0x32')](db['Action'][_0x481d('0x2e')]);_0x14beb6[_0x481d('0x31')]=_[_0x481d('0x32')](_0x26c09b[_0x481d('0x31')]);_0x14beb6['filters']=_[_0x481d('0x34')](_0x14beb6[_0x481d('0x35')],_0x14beb6['query']);_0x27a8a9[_0x481d('0x37')]=_['intersection'](_0x14beb6[_0x481d('0x35')],qs[_0x481d('0x36')](_0x26c09b[_0x481d('0x31')][_0x481d('0x36')]));_0x27a8a9[_0x481d('0x37')]=_0x27a8a9['attributes']['length']?_0x27a8a9['attributes']:_0x14beb6[_0x481d('0x35')];_0x27a8a9[_0x481d('0x3b')]=qs['sort'](_0x26c09b[_0x481d('0x31')][_0x481d('0x3c')]);_0x27a8a9['where']=qs['filters'](_[_0x481d('0x3e')](_0x26c09b[_0x481d('0x31')],_0x14beb6['filters']));if(_0x26c09b[_0x481d('0x31')][_0x481d('0x3f')]){_0x27a8a9[_0x481d('0x3d')]=_[_0x481d('0x40')](_0x27a8a9[_0x481d('0x3d')],{'$or':_['map'](_0x27a8a9[_0x481d('0x37')],function(_0x55ccdb){var _0xf95303={};_0xf95303[_0x55ccdb]={'$like':'%'+_0x26c09b[_0x481d('0x31')][_0x481d('0x3f')]+'%'};return _0xf95303;})});}_0x27a8a9=_[_0x481d('0x40')]({},_0x27a8a9,_0x26c09b['options']);return _0x1b363e[_0x481d('0x5e')](_0x27a8a9);}})[_0x481d('0x23')](function(_0x253565){if(_0x253565){_0x2ab2ad=_0x253565['length'];if(!_0x26c09b[_0x481d('0x31')][_0x481d('0x59')](_0x481d('0x39'))){_0x27a8a9[_0x481d('0x3a')]=qs[_0x481d('0x3a')](_0x26c09b[_0x481d('0x31')][_0x481d('0x3a')]);_0x27a8a9[_0x481d('0x1e')]=qs['offset'](_0x26c09b['query']['offset']);}return _0x1b363e['getActions'](_0x27a8a9);}})['then'](function(_0x3cb17e){if(_0x3cb17e){return _0x3cb17e?{'count':_0x2ab2ad,'rows':_0x3cb17e}:null;}})['then'](respondWithResult(_0x2bf210,null))[_0x481d('0x47')](handleError(_0x2bf210,null));}; \ No newline at end of file +var _0xc4e2=['rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','Trigger','count','findAll','rows','catch','show','params','includeAll','include','merge','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','addAnyCondition','TriggerAnyId','getAllConditions','Condition','hasOwnProperty','getAnyConditions','findOne','length','addAction','TriggerId','getActions','Action','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','squel','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','json','offset','limit','set','apply','reject','update','destroy','get','Triggers','UserProfileResource','then','sendStatus','error','stack','name','send','index','map'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc4e2,0xe2));var _0x2c4e=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xc4e2[_0xd1d19a];return _0x52a79d;};'use strict';var pdf=require(_0x2c4e('0x0'));var emlformat=require(_0x2c4e('0x1'));var rimraf=require(_0x2c4e('0x2'));var zipdir=require(_0x2c4e('0x3'));var jsonpatch=require(_0x2c4e('0x4'));var rp=require(_0x2c4e('0x5'));var moment=require(_0x2c4e('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2c4e('0x7'));var path=require('path');var sox=require(_0x2c4e('0x8'));var csv=require(_0x2c4e('0x9'));var ejs=require(_0x2c4e('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2c4e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2c4e('0xc'));var toCsv=require(_0x2c4e('0x9'));var querystring=require(_0x2c4e('0xd'));var Papa=require(_0x2c4e('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2c4e('0xf'));var hardwareService=require(_0x2c4e('0x10'));var logger=require(_0x2c4e('0x11'))(_0x2c4e('0x12'));var utils=require(_0x2c4e('0x13'));var config=require(_0x2c4e('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x185a4c,_0x2097ed){_0x2097ed=_0x2097ed||0xcc;return function(_0x2493d3){if(_0x2493d3){return _0x185a4c['sendStatus'](_0x2097ed);}return _0x185a4c[_0x2c4e('0x15')](_0x2097ed)['end']();};}function respondWithResult(_0x1f4f71,_0x2503ff){_0x2503ff=_0x2503ff||0xc8;return function(_0xa4d017){if(_0xa4d017){return _0x1f4f71[_0x2c4e('0x15')](_0x2503ff)[_0x2c4e('0x16')](_0xa4d017);}};}function respondWithFilteredResult(_0x5ae3b4,_0x2d7309){return function(_0x5e1970){if(_0x5e1970){var _0x2b74d7=_0x5e1970['count'],_0x59dcad=_0x2d7309[_0x2c4e('0x17')],_0x253c47=_0x2d7309[_0x2c4e('0x17')]+_0x2d7309[_0x2c4e('0x18')],_0xd07bca;if(_0x253c47>=_0x2b74d7){_0x253c47=_0x2b74d7;_0xd07bca=0xc8;}else{_0xd07bca=0xce;}_0x5ae3b4[_0x2c4e('0x15')](_0xd07bca);return _0x5ae3b4[_0x2c4e('0x19')]('Content-Range',_0x59dcad+'-'+_0x253c47+'/'+_0x2b74d7)['json'](_0x5e1970);}return null;};}function patchUpdates(_0xfb6508){return function(_0x4e94d1){try{jsonpatch[_0x2c4e('0x1a')](_0x4e94d1,_0xfb6508,!![]);}catch(_0x337bed){return BPromise[_0x2c4e('0x1b')](_0x337bed);}return _0x4e94d1['save']();};}function saveUpdates(_0x52830a,_0x4b2a2d){return function(_0x108b8a){if(_0x108b8a){return _0x108b8a[_0x2c4e('0x1c')](_0x52830a)['then'](function(_0x5bf751){return _0x5bf751;});}return null;};}function removeEntity(_0x5ba38a,_0x5c2f01){return function(_0x3eb3f5){if(_0x3eb3f5){return _0x3eb3f5[_0x2c4e('0x1d')]()['then'](function(){var _0x167b82=_0x3eb3f5[_0x2c4e('0x1e')]({'plain':!![]});var _0x4045d0=_0x2c4e('0x1f');return db[_0x2c4e('0x20')][_0x2c4e('0x1d')]({'where':{'type':_0x4045d0,'resourceId':_0x167b82['id']}})['then'](function(){return _0x3eb3f5;});})[_0x2c4e('0x21')](function(){_0x5ba38a[_0x2c4e('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9565f5,_0xba8dac){return function(_0x315b2a){if(!_0x315b2a){_0x9565f5[_0x2c4e('0x22')](0x194);}return _0x315b2a;};}function handleError(_0x34a502,_0x40b7e0){_0x40b7e0=_0x40b7e0||0x1f4;return function(_0x47f8eb){logger[_0x2c4e('0x23')](_0x47f8eb[_0x2c4e('0x24')]);if(_0x47f8eb[_0x2c4e('0x25')]){delete _0x47f8eb[_0x2c4e('0x25')];}_0x34a502[_0x2c4e('0x15')](_0x40b7e0)[_0x2c4e('0x26')](_0x47f8eb);};}exports[_0x2c4e('0x27')]=function(_0x1db0af,_0x2e3e3d){var _0x4a8df6={},_0x314db9={},_0x4bc46e={'count':0x0,'rows':[]};var _0x1c4b41=_[_0x2c4e('0x28')](db['Trigger'][_0x2c4e('0x29')],function(_0x2f38da){return{'name':_0x2f38da[_0x2c4e('0x2a')],'type':_0x2f38da[_0x2c4e('0x2b')][_0x2c4e('0x2c')]};});_0x314db9[_0x2c4e('0x2d')]=_[_0x2c4e('0x28')](_0x1c4b41,_0x2c4e('0x25'));_0x314db9[_0x2c4e('0x2e')]=_[_0x2c4e('0x2f')](_0x1db0af[_0x2c4e('0x2e')]);_0x314db9['filters']=_[_0x2c4e('0x30')](_0x314db9[_0x2c4e('0x2d')],_0x314db9[_0x2c4e('0x2e')]);_0x4a8df6['attributes']=_['intersection'](_0x314db9[_0x2c4e('0x2d')],qs[_0x2c4e('0x31')](_0x1db0af[_0x2c4e('0x2e')][_0x2c4e('0x31')]));_0x4a8df6[_0x2c4e('0x32')]=_0x4a8df6['attributes']['length']?_0x4a8df6[_0x2c4e('0x32')]:_0x314db9[_0x2c4e('0x2d')];if(!_0x1db0af['query']['hasOwnProperty'](_0x2c4e('0x33'))){_0x4a8df6['limit']=qs[_0x2c4e('0x18')](_0x1db0af[_0x2c4e('0x2e')]['limit']);_0x4a8df6[_0x2c4e('0x17')]=qs[_0x2c4e('0x17')](_0x1db0af[_0x2c4e('0x2e')][_0x2c4e('0x17')]);}_0x4a8df6[_0x2c4e('0x34')]=qs[_0x2c4e('0x35')](_0x1db0af[_0x2c4e('0x2e')][_0x2c4e('0x35')]);_0x4a8df6[_0x2c4e('0x36')]=qs[_0x2c4e('0x37')](_[_0x2c4e('0x38')](_0x1db0af[_0x2c4e('0x2e')],_0x314db9[_0x2c4e('0x37')]));if(_0x1db0af['query'][_0x2c4e('0x39')]){_0x4a8df6[_0x2c4e('0x36')]=_['merge'](_0x4a8df6[_0x2c4e('0x36')],{'$or':_['map'](_0x1c4b41,function(_0x3a4e28){if(_0x3a4e28[_0x2c4e('0x2b')]!==_0x2c4e('0x3a')){var _0x62280={};_0x62280[_0x3a4e28[_0x2c4e('0x25')]]={'$like':'%'+_0x1db0af[_0x2c4e('0x2e')][_0x2c4e('0x39')]+'%'};return _0x62280;}})});}_0x4a8df6=_['merge']({},_0x4a8df6,_0x1db0af[_0x2c4e('0x3b')]);var _0x266650={'where':_0x4a8df6[_0x2c4e('0x36')]};return db[_0x2c4e('0x3c')][_0x2c4e('0x3d')](_0x266650)['then'](function(_0xa0e4b5){_0x4bc46e[_0x2c4e('0x3d')]=_0xa0e4b5;if(_0x1db0af[_0x2c4e('0x2e')]['includeAll']){_0x4a8df6['include']=[{'all':!![]}];}return db[_0x2c4e('0x3c')][_0x2c4e('0x3e')](_0x4a8df6);})[_0x2c4e('0x21')](function(_0xa5219f){_0x4bc46e[_0x2c4e('0x3f')]=_0xa5219f;return _0x4bc46e;})['then'](respondWithFilteredResult(_0x2e3e3d,_0x4a8df6))[_0x2c4e('0x40')](handleError(_0x2e3e3d,null));};exports[_0x2c4e('0x41')]=function(_0x42b798,_0x5627f6){var _0x274542={'raw':![],'where':{'id':_0x42b798[_0x2c4e('0x42')]['id']}},_0x11400f={};_0x11400f[_0x2c4e('0x2d')]=_[_0x2c4e('0x2f')](db['Trigger'][_0x2c4e('0x29')]);_0x11400f[_0x2c4e('0x2e')]=_['keys'](_0x42b798[_0x2c4e('0x2e')]);_0x11400f[_0x2c4e('0x37')]=_[_0x2c4e('0x30')](_0x11400f['model'],_0x11400f['query']);_0x274542[_0x2c4e('0x32')]=_['intersection'](_0x11400f[_0x2c4e('0x2d')],qs[_0x2c4e('0x31')](_0x42b798[_0x2c4e('0x2e')][_0x2c4e('0x31')]));_0x274542['attributes']=_0x274542[_0x2c4e('0x32')]['length']?_0x274542['attributes']:_0x11400f[_0x2c4e('0x2d')];if(_0x42b798[_0x2c4e('0x2e')][_0x2c4e('0x43')]){_0x274542[_0x2c4e('0x44')]=[{'all':!![]}];}_0x274542=_[_0x2c4e('0x45')]({},_0x274542,_0x42b798[_0x2c4e('0x3b')]);return db[_0x2c4e('0x3c')][_0x2c4e('0x46')](_0x274542)['then'](handleEntityNotFound(_0x5627f6,null))['then'](respondWithResult(_0x5627f6,null))[_0x2c4e('0x40')](handleError(_0x5627f6,null));};exports[_0x2c4e('0x47')]=function(_0x6ee74e,_0x43a404){return db[_0x2c4e('0x3c')]['create'](_0x6ee74e[_0x2c4e('0x48')],{})[_0x2c4e('0x21')](function(_0x2582a0){var _0x9f2367=_0x6ee74e['user'][_0x2c4e('0x1e')]({'plain':!![]});if(!_0x9f2367)throw new Error(_0x2c4e('0x49'));if(_0x9f2367['role']==='user'){var _0x5d29f6=_0x2582a0[_0x2c4e('0x1e')]({'plain':!![]});var _0x1d172d='Triggers';return db[_0x2c4e('0x4a')][_0x2c4e('0x46')]({'where':{'name':_0x1d172d,'userProfileId':_0x9f2367['userProfileId']},'raw':!![]})[_0x2c4e('0x21')](function(_0x343b10){if(_0x343b10&&_0x343b10['autoAssociation']===0x0){return db[_0x2c4e('0x20')][_0x2c4e('0x47')]({'name':_0x5d29f6[_0x2c4e('0x25')],'resourceId':_0x5d29f6['id'],'type':_0x343b10[_0x2c4e('0x25')],'sectionId':_0x343b10['id']},{})[_0x2c4e('0x21')](function(){return _0x2582a0;});}else{return _0x2582a0;}})[_0x2c4e('0x40')](function(_0x213c6b){logger['error'](_0x2c4e('0x4b'),_0x213c6b);throw _0x213c6b;});}return _0x2582a0;})['then'](respondWithResult(_0x43a404,0xc9))['catch'](handleError(_0x43a404,null));};exports[_0x2c4e('0x1c')]=function(_0x1bc468,_0x38f2ae){if(_0x1bc468[_0x2c4e('0x48')]['id']){delete _0x1bc468[_0x2c4e('0x48')]['id'];}return db['Trigger'][_0x2c4e('0x46')]({'where':{'id':_0x1bc468[_0x2c4e('0x42')]['id']}})[_0x2c4e('0x21')](handleEntityNotFound(_0x38f2ae,null))['then'](saveUpdates(_0x1bc468[_0x2c4e('0x48')],null))[_0x2c4e('0x21')](respondWithResult(_0x38f2ae,null))[_0x2c4e('0x40')](handleError(_0x38f2ae,null));};exports[_0x2c4e('0x1d')]=function(_0x5aed9a,_0x68ae60){return db[_0x2c4e('0x3c')]['find']({'where':{'id':_0x5aed9a[_0x2c4e('0x42')]['id']}})[_0x2c4e('0x21')](handleEntityNotFound(_0x68ae60,null))[_0x2c4e('0x21')](removeEntity(_0x68ae60,null))[_0x2c4e('0x40')](handleError(_0x68ae60,null));};exports[_0x2c4e('0x4c')]=function(_0x49a5db,_0x57eefd,_0x40fdbb){if(_0x49a5db[_0x2c4e('0x48')]['id']){delete _0x49a5db[_0x2c4e('0x48')]['id'];}return db[_0x2c4e('0x3c')]['find']({'where':{'id':_0x49a5db['params']['id']}})[_0x2c4e('0x21')](handleEntityNotFound(_0x57eefd,null))[_0x2c4e('0x21')](function(_0x1d3158){if(_0x1d3158){_0x49a5db[_0x2c4e('0x48')]['TriggerAllId']=_0x1d3158['id'];return db['Condition'][_0x2c4e('0x47')](_0x49a5db['body']);}})[_0x2c4e('0x21')](respondWithResult(_0x57eefd,null))['catch'](handleError(_0x57eefd,null));};exports[_0x2c4e('0x4d')]=function(_0x3424d1,_0x2f3d44,_0x157a8b){if(_0x3424d1[_0x2c4e('0x48')]['id']){delete _0x3424d1['body']['id'];}return db[_0x2c4e('0x3c')][_0x2c4e('0x46')]({'where':{'id':_0x3424d1[_0x2c4e('0x42')]['id']}})[_0x2c4e('0x21')](handleEntityNotFound(_0x2f3d44,null))['then'](function(_0x58a3fa){if(_0x58a3fa){_0x3424d1['body'][_0x2c4e('0x4e')]=_0x58a3fa['id'];return db['Condition'][_0x2c4e('0x47')](_0x3424d1[_0x2c4e('0x48')]);}})[_0x2c4e('0x21')](respondWithResult(_0x2f3d44,null))['catch'](handleError(_0x2f3d44,null));};exports[_0x2c4e('0x4f')]=function(_0x302952,_0x459973,_0xb27cb4){var _0x175180={};var _0x49e531={};var _0x4b2d2a;var _0x4c5cc3;return db[_0x2c4e('0x3c')]['findOne']({'where':{'id':_0x302952[_0x2c4e('0x42')]['id']}})['then'](handleEntityNotFound(_0x459973,null))['then'](function(_0x428479){if(_0x428479){_0x4b2d2a=_0x428479;_0x49e531['model']=_[_0x2c4e('0x2f')](db[_0x2c4e('0x50')][_0x2c4e('0x29')]);_0x49e531['query']=_['keys'](_0x302952[_0x2c4e('0x2e')]);_0x49e531[_0x2c4e('0x37')]=_['intersection'](_0x49e531[_0x2c4e('0x2d')],_0x49e531[_0x2c4e('0x2e')]);_0x175180[_0x2c4e('0x32')]=_['intersection'](_0x49e531[_0x2c4e('0x2d')],qs['fields'](_0x302952['query'][_0x2c4e('0x31')]));_0x175180[_0x2c4e('0x32')]=_0x175180['attributes']['length']?_0x175180[_0x2c4e('0x32')]:_0x49e531[_0x2c4e('0x2d')];_0x175180[_0x2c4e('0x34')]=qs[_0x2c4e('0x35')](_0x302952[_0x2c4e('0x2e')][_0x2c4e('0x35')]);_0x175180[_0x2c4e('0x36')]=qs[_0x2c4e('0x37')](_[_0x2c4e('0x38')](_0x302952[_0x2c4e('0x2e')],_0x49e531[_0x2c4e('0x37')]));if(_0x302952[_0x2c4e('0x2e')][_0x2c4e('0x39')]){_0x175180[_0x2c4e('0x36')]=_[_0x2c4e('0x45')](_0x175180['where'],{'$or':_[_0x2c4e('0x28')](_0x175180['attributes'],function(_0x17ce0b){var _0x451bcc={};_0x451bcc[_0x17ce0b]={'$like':'%'+_0x302952[_0x2c4e('0x2e')]['filter']+'%'};return _0x451bcc;})});}_0x175180=_[_0x2c4e('0x45')]({},_0x175180,_0x302952[_0x2c4e('0x3b')]);return _0x4b2d2a[_0x2c4e('0x4f')](_0x175180);}})[_0x2c4e('0x21')](function(_0x4942b7){if(_0x4942b7){_0x4c5cc3=_0x4942b7['length'];if(!_0x302952[_0x2c4e('0x2e')][_0x2c4e('0x51')](_0x2c4e('0x33'))){_0x175180['limit']=qs[_0x2c4e('0x18')](_0x302952[_0x2c4e('0x2e')][_0x2c4e('0x18')]);_0x175180['offset']=qs[_0x2c4e('0x17')](_0x302952[_0x2c4e('0x2e')]['offset']);}return _0x4b2d2a[_0x2c4e('0x4f')](_0x175180);}})[_0x2c4e('0x21')](function(_0x389c62){if(_0x389c62){return _0x389c62?{'count':_0x4c5cc3,'rows':_0x389c62}:null;}})[_0x2c4e('0x21')](respondWithResult(_0x459973,null))[_0x2c4e('0x40')](handleError(_0x459973,null));};exports[_0x2c4e('0x52')]=function(_0x46ad0d,_0x1e17b9,_0x25c9b6){var _0x52d5f7={};var _0x5efd88={};var _0x591fdf;var _0x360160;return db['Trigger'][_0x2c4e('0x53')]({'where':{'id':_0x46ad0d['params']['id']}})[_0x2c4e('0x21')](handleEntityNotFound(_0x1e17b9,null))['then'](function(_0x53f459){if(_0x53f459){_0x591fdf=_0x53f459;_0x5efd88['model']=_[_0x2c4e('0x2f')](db[_0x2c4e('0x50')][_0x2c4e('0x29')]);_0x5efd88[_0x2c4e('0x2e')]=_['keys'](_0x46ad0d[_0x2c4e('0x2e')]);_0x5efd88[_0x2c4e('0x37')]=_['intersection'](_0x5efd88[_0x2c4e('0x2d')],_0x5efd88[_0x2c4e('0x2e')]);_0x52d5f7[_0x2c4e('0x32')]=_['intersection'](_0x5efd88[_0x2c4e('0x2d')],qs['fields'](_0x46ad0d[_0x2c4e('0x2e')][_0x2c4e('0x31')]));_0x52d5f7[_0x2c4e('0x32')]=_0x52d5f7[_0x2c4e('0x32')][_0x2c4e('0x54')]?_0x52d5f7[_0x2c4e('0x32')]:_0x5efd88[_0x2c4e('0x2d')];_0x52d5f7[_0x2c4e('0x34')]=qs[_0x2c4e('0x35')](_0x46ad0d[_0x2c4e('0x2e')]['sort']);_0x52d5f7['where']=qs['filters'](_[_0x2c4e('0x38')](_0x46ad0d[_0x2c4e('0x2e')],_0x5efd88[_0x2c4e('0x37')]));if(_0x46ad0d[_0x2c4e('0x2e')][_0x2c4e('0x39')]){_0x52d5f7[_0x2c4e('0x36')]=_[_0x2c4e('0x45')](_0x52d5f7[_0x2c4e('0x36')],{'$or':_['map'](_0x52d5f7[_0x2c4e('0x32')],function(_0x4f32e2){var _0x4ac241={};_0x4ac241[_0x4f32e2]={'$like':'%'+_0x46ad0d[_0x2c4e('0x2e')][_0x2c4e('0x39')]+'%'};return _0x4ac241;})});}_0x52d5f7=_['merge']({},_0x52d5f7,_0x46ad0d[_0x2c4e('0x3b')]);return _0x591fdf[_0x2c4e('0x52')](_0x52d5f7);}})[_0x2c4e('0x21')](function(_0x1a63a1){if(_0x1a63a1){_0x360160=_0x1a63a1[_0x2c4e('0x54')];if(!_0x46ad0d[_0x2c4e('0x2e')][_0x2c4e('0x51')](_0x2c4e('0x33'))){_0x52d5f7[_0x2c4e('0x18')]=qs[_0x2c4e('0x18')](_0x46ad0d[_0x2c4e('0x2e')][_0x2c4e('0x18')]);_0x52d5f7[_0x2c4e('0x17')]=qs['offset'](_0x46ad0d[_0x2c4e('0x2e')]['offset']);}return _0x591fdf[_0x2c4e('0x52')](_0x52d5f7);}})[_0x2c4e('0x21')](function(_0x5152e4){if(_0x5152e4){return _0x5152e4?{'count':_0x360160,'rows':_0x5152e4}:null;}})['then'](respondWithResult(_0x1e17b9,null))[_0x2c4e('0x40')](handleError(_0x1e17b9,null));};exports[_0x2c4e('0x55')]=function(_0x3ce523,_0x2fcf06,_0x3c8509){if(_0x3ce523[_0x2c4e('0x48')]['id']){delete _0x3ce523[_0x2c4e('0x48')]['id'];}return db[_0x2c4e('0x3c')]['find']({'where':{'id':_0x3ce523[_0x2c4e('0x42')]['id']}})[_0x2c4e('0x21')](handleEntityNotFound(_0x2fcf06,null))[_0x2c4e('0x21')](function(_0x4961a4){if(_0x4961a4){_0x3ce523['body'][_0x2c4e('0x56')]=_0x4961a4['id'];return db['Action']['create'](_0x3ce523[_0x2c4e('0x48')]);}})[_0x2c4e('0x21')](respondWithResult(_0x2fcf06,null))['catch'](handleError(_0x2fcf06,null));};exports[_0x2c4e('0x57')]=function(_0x36a5fc,_0x5c4849,_0x11fb79){var _0x3c71ae={};var _0x517573={};var _0x44f30e;var _0x1c8d45;return db[_0x2c4e('0x3c')][_0x2c4e('0x53')]({'where':{'id':_0x36a5fc[_0x2c4e('0x42')]['id']}})[_0x2c4e('0x21')](handleEntityNotFound(_0x5c4849,null))[_0x2c4e('0x21')](function(_0x68f09d){if(_0x68f09d){_0x44f30e=_0x68f09d;_0x517573[_0x2c4e('0x2d')]=_[_0x2c4e('0x2f')](db[_0x2c4e('0x58')][_0x2c4e('0x29')]);_0x517573[_0x2c4e('0x2e')]=_[_0x2c4e('0x2f')](_0x36a5fc['query']);_0x517573['filters']=_[_0x2c4e('0x30')](_0x517573['model'],_0x517573[_0x2c4e('0x2e')]);_0x3c71ae[_0x2c4e('0x32')]=_['intersection'](_0x517573[_0x2c4e('0x2d')],qs[_0x2c4e('0x31')](_0x36a5fc[_0x2c4e('0x2e')][_0x2c4e('0x31')]));_0x3c71ae[_0x2c4e('0x32')]=_0x3c71ae['attributes'][_0x2c4e('0x54')]?_0x3c71ae[_0x2c4e('0x32')]:_0x517573[_0x2c4e('0x2d')];_0x3c71ae[_0x2c4e('0x34')]=qs[_0x2c4e('0x35')](_0x36a5fc['query'][_0x2c4e('0x35')]);_0x3c71ae[_0x2c4e('0x36')]=qs[_0x2c4e('0x37')](_[_0x2c4e('0x38')](_0x36a5fc[_0x2c4e('0x2e')],_0x517573[_0x2c4e('0x37')]));if(_0x36a5fc[_0x2c4e('0x2e')][_0x2c4e('0x39')]){_0x3c71ae[_0x2c4e('0x36')]=_[_0x2c4e('0x45')](_0x3c71ae[_0x2c4e('0x36')],{'$or':_['map'](_0x3c71ae['attributes'],function(_0x4bcc3a){var _0x4cc6a7={};_0x4cc6a7[_0x4bcc3a]={'$like':'%'+_0x36a5fc[_0x2c4e('0x2e')][_0x2c4e('0x39')]+'%'};return _0x4cc6a7;})});}_0x3c71ae=_[_0x2c4e('0x45')]({},_0x3c71ae,_0x36a5fc[_0x2c4e('0x3b')]);return _0x44f30e['getActions'](_0x3c71ae);}})[_0x2c4e('0x21')](function(_0x4ce73e){if(_0x4ce73e){_0x1c8d45=_0x4ce73e['length'];if(!_0x36a5fc['query'][_0x2c4e('0x51')](_0x2c4e('0x33'))){_0x3c71ae[_0x2c4e('0x18')]=qs[_0x2c4e('0x18')](_0x36a5fc[_0x2c4e('0x2e')]['limit']);_0x3c71ae[_0x2c4e('0x17')]=qs[_0x2c4e('0x17')](_0x36a5fc[_0x2c4e('0x2e')][_0x2c4e('0x17')]);}return _0x44f30e[_0x2c4e('0x57')](_0x3c71ae);}})['then'](function(_0x2e3c3d){if(_0x2e3c3d){return _0x2e3c3d?{'count':_0x1c8d45,'rows':_0x2e3c3d}:null;}})[_0x2c4e('0x21')](respondWithResult(_0x5c4849,null))[_0x2c4e('0x40')](handleError(_0x5c4849,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 1e2081c..1298ad5 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 _0x7ca5=['Trigger','tools_triggers','lodash','api','moment','bluebird','rimraf','../../config/environment','./trigger.attributes','exports'];(function(_0x29fdbb,_0x3555ca){var _0x1e1462=function(_0x29c89c){while(--_0x29c89c){_0x29fdbb['push'](_0x29fdbb['shift']());}};_0x1e1462(++_0x3555ca);}(_0x7ca5,0x160));var _0x57ca=function(_0x1258f3,_0x18ebb1){_0x1258f3=_0x1258f3-0x0;var _0x6a639b=_0x7ca5[_0x1258f3];return _0x6a639b;};'use strict';var _=require(_0x57ca('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x57ca('0x1'));var moment=require(_0x57ca('0x2'));var BPromise=require(_0x57ca('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x57ca('0x4'));var config=require(_0x57ca('0x5'));var attributes=require(_0x57ca('0x6'));module[_0x57ca('0x7')]=function(_0x5efda2,_0x40ebf5){return _0x5efda2['define'](_0x57ca('0x8'),attributes,{'tableName':_0x57ca('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc45a=['request-promise','path','rimraf','exports','define','Trigger','tools_triggers','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc45a,0x1c9));var _0xac45=function(_0x391187,_0x4b67c3){_0x391187=_0x391187-0x0;var _0x2a01eb=_0xc45a[_0x391187];return _0x2a01eb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xac45('0x0'))(_0xac45('0x1'));var moment=require(_0xac45('0x2'));var BPromise=require('bluebird');var rp=require(_0xac45('0x3'));var fs=require('fs');var path=require(_0xac45('0x4'));var rimraf=require(_0xac45('0x5'));var config=require('../../config/environment');var attributes=require('./trigger.attributes');module[_0xac45('0x6')]=function(_0x54cd32,_0x586c4e){return _0x54cd32[_0xac45('0x7')](_0xac45('0x8'),attributes,{'tableName':_0xac45('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 6776968..f6fe148 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 _0x1eba=['find','where','debug','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','Trigger,\x20%s,\x20%s','message','result','GetTrigger','Trigger','findAll','options','raw','attributes','limit','include','map','model','catch','ShowTrigger'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x1eba[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xa1eb('0x0'));var util=require(_0xa1eb('0x1'));var moment=require(_0xa1eb('0x2'));var BPromise=require(_0xa1eb('0x3'));var rs=require(_0xa1eb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa1eb('0x5'));var logger=require(_0xa1eb('0x6'))(_0xa1eb('0x7'));var config=require(_0xa1eb('0x8'));var jayson=require(_0xa1eb('0x9'));var client=jayson[_0xa1eb('0xa')][_0xa1eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2bfbb0,_0x39a5a3,_0x7d2982){return new BPromise(function(_0x2aebb6,_0x9d7113){return client['request'](_0x2bfbb0,_0x7d2982)[_0xa1eb('0xc')](function(_0x4d4aaf){logger[_0xa1eb('0xd')]('Trigger,\x20%s,\x20%s',_0x39a5a3,_0xa1eb('0xe'));logger['debug'](_0xa1eb('0xf'),_0x39a5a3,'request\x20sent',JSON[_0xa1eb('0x10')](_0x4d4aaf));if(_0x4d4aaf[_0xa1eb('0x11')]){if(_0x4d4aaf[_0xa1eb('0x11')]['code']===0x1f4){logger[_0xa1eb('0x11')](_0xa1eb('0x12'),_0x39a5a3,_0x4d4aaf['error'][_0xa1eb('0x13')]);return _0x9d7113(_0x4d4aaf['error']['message']);}logger[_0xa1eb('0x11')]('Trigger,\x20%s,\x20%s',_0x39a5a3,_0x4d4aaf[_0xa1eb('0x11')][_0xa1eb('0x13')]);return _0x2aebb6(_0x4d4aaf[_0xa1eb('0x11')][_0xa1eb('0x13')]);}else{logger[_0xa1eb('0xd')](_0xa1eb('0x12'),_0x39a5a3,_0xa1eb('0xe'));_0x2aebb6(_0x4d4aaf[_0xa1eb('0x14')][_0xa1eb('0x13')]);}})['catch'](function(_0xbd6a6b){logger['error'](_0xa1eb('0x12'),_0x39a5a3,_0xbd6a6b);_0x9d7113(_0xbd6a6b);});});}exports[_0xa1eb('0x15')]=function(_0x33c4e3){var _0x1a5d2c=this;return new Promise(function(_0x49bfaa,_0x1dd621){return db[_0xa1eb('0x16')][_0xa1eb('0x17')]({'raw':_0x33c4e3[_0xa1eb('0x18')]?_0x33c4e3[_0xa1eb('0x18')][_0xa1eb('0x19')]===undefined?!![]:![]:!![],'where':_0x33c4e3[_0xa1eb('0x18')]?_0x33c4e3[_0xa1eb('0x18')]['where']||null:null,'attributes':_0x33c4e3[_0xa1eb('0x18')]?_0x33c4e3['options'][_0xa1eb('0x1a')]||null:null,'limit':_0x33c4e3[_0xa1eb('0x18')]?_0x33c4e3[_0xa1eb('0x18')][_0xa1eb('0x1b')]||null:null,'include':_0x33c4e3['options']?_0x33c4e3['options'][_0xa1eb('0x1c')]?_[_0xa1eb('0x1d')](_0x33c4e3['options'][_0xa1eb('0x1c')],function(_0x250728){return{'model':db[_0x250728[_0xa1eb('0x1e')]],'as':_0x250728['as'],'attributes':_0x250728[_0xa1eb('0x1a')],'include':_0x250728[_0xa1eb('0x1c')]?_[_0xa1eb('0x1d')](_0x250728[_0xa1eb('0x1c')],function(_0x364b1c){return{'model':db[_0x364b1c[_0xa1eb('0x1e')]],'as':_0x364b1c['as'],'attributes':_0x364b1c[_0xa1eb('0x1a')],'include':_0x364b1c[_0xa1eb('0x1c')]?_[_0xa1eb('0x1d')](_0x364b1c['include'],function(_0x7c617e){return{'model':db[_0x7c617e[_0xa1eb('0x1e')]],'as':_0x7c617e['as'],'attributes':_0x7c617e['attributes']};}):[]};}):[]};}):[]:[]})[_0xa1eb('0xc')](function(_0x4e2aa7){logger[_0xa1eb('0xd')](_0xa1eb('0x15'),_0x33c4e3);logger['debug'](_0xa1eb('0x15'),_0x33c4e3,JSON[_0xa1eb('0x10')](_0x4e2aa7));_0x49bfaa(_0x4e2aa7);})[_0xa1eb('0x1f')](function(_0x4f64bb){logger[_0xa1eb('0x11')](_0xa1eb('0x15'),_0x4f64bb['message'],_0x33c4e3);_0x1dd621(_0x1a5d2c[_0xa1eb('0x11')](0x1f4,_0x4f64bb[_0xa1eb('0x13')]));});});};exports[_0xa1eb('0x20')]=function(_0x2e281a){var _0x5a6544=this;return new Promise(function(_0x52f9c7,_0x9d49d8){return db[_0xa1eb('0x16')][_0xa1eb('0x21')]({'raw':_0x2e281a[_0xa1eb('0x18')]?_0x2e281a[_0xa1eb('0x18')][_0xa1eb('0x19')]===undefined?!![]:![]:!![],'where':_0x2e281a[_0xa1eb('0x18')]?_0x2e281a[_0xa1eb('0x18')][_0xa1eb('0x22')]||null:null,'attributes':_0x2e281a[_0xa1eb('0x18')]?_0x2e281a[_0xa1eb('0x18')]['attributes']||null:null,'include':_0x2e281a['options']?_0x2e281a[_0xa1eb('0x18')][_0xa1eb('0x1c')]?_[_0xa1eb('0x1d')](_0x2e281a[_0xa1eb('0x18')][_0xa1eb('0x1c')],function(_0x58d336){return{'model':db[_0x58d336['model']],'as':_0x58d336['as'],'attributes':_0x58d336[_0xa1eb('0x1a')],'include':_0x58d336[_0xa1eb('0x1c')]?_['map'](_0x58d336['include'],function(_0x3761bf){return{'model':db[_0x3761bf['model']],'as':_0x3761bf['as'],'attributes':_0x3761bf[_0xa1eb('0x1a')],'include':_0x3761bf['include']?_[_0xa1eb('0x1d')](_0x3761bf[_0xa1eb('0x1c')],function(_0x229931){return{'model':db[_0x229931['model']],'as':_0x229931['as'],'attributes':_0x229931[_0xa1eb('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa1eb('0xc')](function(_0x35ed30){logger['info'](_0xa1eb('0x20'),_0x2e281a);logger[_0xa1eb('0x23')](_0xa1eb('0x20'),_0x2e281a,JSON[_0xa1eb('0x10')](_0x35ed30));_0x52f9c7(_0x35ed30);})[_0xa1eb('0x1f')](function(_0x5912d5){logger[_0xa1eb('0x11')](_0xa1eb('0x20'),_0x5912d5[_0xa1eb('0x13')],_0x2e281a);_0x9d49d8(_0x5a6544[_0xa1eb('0x11')](0x1f4,_0x5912d5[_0xa1eb('0x13')]));});});}; \ No newline at end of file +var _0xed3c=['catch','Trigger','findAll','options','raw','where','limit','include','map','model','attributes','GetTrigger','ShowTrigger','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xed3c,0x1a6));var _0xced3=function(_0x35c514,_0x22bb8a){_0x35c514=_0x35c514-0x0;var _0x448f20=_0xed3c[_0x35c514];return _0x448f20;};'use strict';var _=require(_0xced3('0x0'));var util=require(_0xced3('0x1'));var moment=require(_0xced3('0x2'));var BPromise=require(_0xced3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xced3('0x4'));var db=require(_0xced3('0x5'))['db'];var utils=require(_0xced3('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xced3('0x7'));var jayson=require(_0xced3('0x8'));var client=jayson[_0xced3('0x9')][_0xced3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4795cd,_0x510164,_0x5ca701){return new BPromise(function(_0x851bd3,_0x5f2f90){return client['request'](_0x4795cd,_0x5ca701)['then'](function(_0x19a727){logger[_0xced3('0xb')](_0xced3('0xc'),_0x510164,_0xced3('0xd'));logger[_0xced3('0xe')]('Trigger,\x20%s,\x20%s,\x20%s',_0x510164,_0xced3('0xd'),JSON[_0xced3('0xf')](_0x19a727));if(_0x19a727[_0xced3('0x10')]){if(_0x19a727['error'][_0xced3('0x11')]===0x1f4){logger[_0xced3('0x10')](_0xced3('0xc'),_0x510164,_0x19a727[_0xced3('0x10')][_0xced3('0x12')]);return _0x5f2f90(_0x19a727[_0xced3('0x10')][_0xced3('0x12')]);}logger['error'](_0xced3('0xc'),_0x510164,_0x19a727['error'][_0xced3('0x12')]);return _0x851bd3(_0x19a727[_0xced3('0x10')][_0xced3('0x12')]);}else{logger[_0xced3('0xb')]('Trigger,\x20%s,\x20%s',_0x510164,_0xced3('0xd'));_0x851bd3(_0x19a727[_0xced3('0x13')]['message']);}})[_0xced3('0x14')](function(_0x37e2d5){logger[_0xced3('0x10')](_0xced3('0xc'),_0x510164,_0x37e2d5);_0x5f2f90(_0x37e2d5);});});}exports['GetTrigger']=function(_0x4569af){var _0x4a3afe=this;return new Promise(function(_0x353580,_0x4480a6){return db[_0xced3('0x15')][_0xced3('0x16')]({'raw':_0x4569af[_0xced3('0x17')]?_0x4569af[_0xced3('0x17')][_0xced3('0x18')]===undefined?!![]:![]:!![],'where':_0x4569af[_0xced3('0x17')]?_0x4569af[_0xced3('0x17')][_0xced3('0x19')]||null:null,'attributes':_0x4569af[_0xced3('0x17')]?_0x4569af['options']['attributes']||null:null,'limit':_0x4569af['options']?_0x4569af[_0xced3('0x17')][_0xced3('0x1a')]||null:null,'include':_0x4569af[_0xced3('0x17')]?_0x4569af['options'][_0xced3('0x1b')]?_[_0xced3('0x1c')](_0x4569af['options']['include'],function(_0x3adf14){return{'model':db[_0x3adf14[_0xced3('0x1d')]],'as':_0x3adf14['as'],'attributes':_0x3adf14[_0xced3('0x1e')],'include':_0x3adf14[_0xced3('0x1b')]?_['map'](_0x3adf14[_0xced3('0x1b')],function(_0x23f92b){return{'model':db[_0x23f92b['model']],'as':_0x23f92b['as'],'attributes':_0x23f92b[_0xced3('0x1e')],'include':_0x23f92b['include']?_[_0xced3('0x1c')](_0x23f92b[_0xced3('0x1b')],function(_0x3b728d){return{'model':db[_0x3b728d[_0xced3('0x1d')]],'as':_0x3b728d['as'],'attributes':_0x3b728d[_0xced3('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5454c0){logger[_0xced3('0xb')]('GetTrigger',_0x4569af);logger[_0xced3('0xe')](_0xced3('0x1f'),_0x4569af,JSON['stringify'](_0x5454c0));_0x353580(_0x5454c0);})[_0xced3('0x14')](function(_0x4024fa){logger[_0xced3('0x10')](_0xced3('0x1f'),_0x4024fa[_0xced3('0x12')],_0x4569af);_0x4480a6(_0x4a3afe[_0xced3('0x10')](0x1f4,_0x4024fa[_0xced3('0x12')]));});});};exports[_0xced3('0x20')]=function(_0x116cc7){var _0x559b8e=this;return new Promise(function(_0xa78899,_0x1b8baa){return db[_0xced3('0x15')][_0xced3('0x21')]({'raw':_0x116cc7[_0xced3('0x17')]?_0x116cc7[_0xced3('0x17')][_0xced3('0x18')]===undefined?!![]:![]:!![],'where':_0x116cc7[_0xced3('0x17')]?_0x116cc7[_0xced3('0x17')][_0xced3('0x19')]||null:null,'attributes':_0x116cc7[_0xced3('0x17')]?_0x116cc7[_0xced3('0x17')][_0xced3('0x1e')]||null:null,'include':_0x116cc7[_0xced3('0x17')]?_0x116cc7[_0xced3('0x17')][_0xced3('0x1b')]?_[_0xced3('0x1c')](_0x116cc7[_0xced3('0x17')][_0xced3('0x1b')],function(_0xcd0fe3){return{'model':db[_0xcd0fe3[_0xced3('0x1d')]],'as':_0xcd0fe3['as'],'attributes':_0xcd0fe3['attributes'],'include':_0xcd0fe3[_0xced3('0x1b')]?_['map'](_0xcd0fe3[_0xced3('0x1b')],function(_0x28f674){return{'model':db[_0x28f674[_0xced3('0x1d')]],'as':_0x28f674['as'],'attributes':_0x28f674[_0xced3('0x1e')],'include':_0x28f674[_0xced3('0x1b')]?_[_0xced3('0x1c')](_0x28f674[_0xced3('0x1b')],function(_0x340be1){return{'model':db[_0x340be1[_0xced3('0x1d')]],'as':_0x340be1['as'],'attributes':_0x340be1[_0xced3('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x342c11){logger[_0xced3('0xb')]('ShowTrigger',_0x116cc7);logger[_0xced3('0xe')](_0xced3('0x20'),_0x116cc7,JSON[_0xced3('0xf')](_0x342c11));_0xa78899(_0x342c11);})['catch'](function(_0x59c3aa){logger[_0xced3('0x10')]('ShowTrigger',_0x59c3aa[_0xced3('0x12')],_0x116cc7);_0x1b8baa(_0x559b8e[_0xced3('0x10')](0x1f4,_0x59c3aa['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 569c7e4..22b1690 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 _0xed1f=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','post','clone','create','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0xed1f,0x6a));var _0xfed1=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0xed1f[_0x1a7846];return _0x48049;};'use strict';var multer=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var path=require(_0xfed1('0x2'));var timeout=require(_0xfed1('0x3'));var express=require(_0xfed1('0x4'));var router=express[_0xfed1('0x5')]();var auth=require(_0xfed1('0x6'));var interaction=require(_0xfed1('0x7'));var config=require(_0xfed1('0x8'));var controller=require(_0xfed1('0x9'));router[_0xfed1('0xa')]('/',auth[_0xfed1('0xb')](),controller[_0xfed1('0xc')]);router[_0xfed1('0xa')](_0xfed1('0xd'),auth[_0xfed1('0xb')](),controller[_0xfed1('0xe')]);router[_0xfed1('0xf')]('/:id/clone',auth[_0xfed1('0xb')](),controller[_0xfed1('0x10')]);router['post']('/',auth[_0xfed1('0xb')](),controller[_0xfed1('0x11')]);router['put'](_0xfed1('0xd'),auth['isAuthenticated'](),controller[_0xfed1('0x12')]);router[_0xfed1('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xfed1('0x14')]);module[_0xfed1('0x15')]=router; \ No newline at end of file +var _0x99e9=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','post','/:id/clone','clone','create','put','update','delete','destroy','exports'];(function(_0x4afbee,_0x43d67a){var _0x12b129=function(_0x5da57b){while(--_0x5da57b){_0x4afbee['push'](_0x4afbee['shift']());}};_0x12b129(++_0x43d67a);}(_0x99e9,0xb4));var _0x999e=function(_0x9a3d47,_0x1953a0){_0x9a3d47=_0x9a3d47-0x0;var _0xf60b78=_0x99e9[_0x9a3d47];return _0xf60b78;};'use strict';var multer=require('multer');var util=require(_0x999e('0x0'));var path=require(_0x999e('0x1'));var timeout=require(_0x999e('0x2'));var express=require(_0x999e('0x3'));var router=express['Router']();var auth=require(_0x999e('0x4'));var interaction=require(_0x999e('0x5'));var config=require(_0x999e('0x6'));var controller=require('./trunk.controller');router[_0x999e('0x7')]('/',auth['isAuthenticated'](),controller[_0x999e('0x8')]);router[_0x999e('0x7')](_0x999e('0x9'),auth[_0x999e('0xa')](),controller['show']);router[_0x999e('0xb')](_0x999e('0xc'),auth[_0x999e('0xa')](),controller[_0x999e('0xd')]);router[_0x999e('0xb')]('/',auth[_0x999e('0xa')](),controller[_0x999e('0xe')]);router[_0x999e('0xf')](_0x999e('0x9'),auth[_0x999e('0xa')](),controller[_0x999e('0x10')]);router[_0x999e('0x11')](_0x999e('0x9'),auth[_0x999e('0xa')](),controller[_0x999e('0x12')]);module[_0x999e('0x13')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 7bf7af2..b72a6fb 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 _0x4a11=['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','active','actpass','dynamic','BOOLEAN','sequelize','exports','ENUM','friend','user','peer','STRING','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','yes','nonat','update','outgoing','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure'];(function(_0x2ed1ad,_0x1fb8a1){var _0x1deb5e=function(_0x4a5d76){while(--_0x4a5d76){_0x2ed1ad['push'](_0x2ed1ad['shift']());}};_0x1deb5e(++_0x1fb8a1);}(_0x4a11,0xcb));var _0x14a1=function(_0x22aabe,_0x1667d4){_0x22aabe=_0x22aabe-0x0;var _0x7ae05=_0x4a11[_0x22aabe];return _0x7ae05;};'use strict';var Sequelize=require(_0x14a1('0x0'));module[_0x14a1('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x14a1('0x2')](_0x14a1('0x3'),_0x14a1('0x4'),_0x14a1('0x5')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x14a1('0x6')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x14a1('0x2')](_0x14a1('0x7'),_0x14a1('0x8'),'ALLOWED_FAILED_SCREEN',_0x14a1('0x9'),_0x14a1('0xa'),'PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB')},'deny':{'type':Sequelize[_0x14a1('0x6')]},'permit':{'type':Sequelize[_0x14a1('0x6')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x14a1('0x6')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x14a1('0x6')],'defaultValue':_0x14a1('0xb'),'set':function(_0x5edb83){this[_0x14a1('0xc')](_0x14a1('0xd'),_0x5edb83?_0x5edb83[_0x14a1('0xe')](','):null);},'get':function(){return this[_0x14a1('0xf')](_0x14a1('0xd'))?this['getDataValue'](_0x14a1('0xd'))[_0x14a1('0x10')](','):null;},'comment':_0x14a1('0x11')},'dtmfmode':{'type':Sequelize['ENUM'](_0x14a1('0x12'),'info',_0x14a1('0x13'),_0x14a1('0x14'),_0x14a1('0x15')),'defaultValue':_0x14a1('0x12')},'directmedia':{'type':Sequelize[_0x14a1('0x2')](_0x14a1('0x16'),'no',_0x14a1('0x17'),_0x14a1('0x18'),_0x14a1('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x14a1('0x2')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x14a1('0x6')]},'nat':{'type':Sequelize[_0x14a1('0x6')],'defaultValue':'force_rport,comedia','set':function(_0x356acc){this[_0x14a1('0xc')](_0x14a1('0x1a'),_0x356acc?_0x356acc[_0x14a1('0xe')](','):null);},'get':function(){return this[_0x14a1('0xf')](_0x14a1('0x1a'))?this[_0x14a1('0xf')](_0x14a1('0x1a'))[_0x14a1('0x10')](','):null;},'comment':_0x14a1('0x1b')},'callgroup':{'type':Sequelize[_0x14a1('0x6')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x14a1('0x6')]},'language':{'type':Sequelize[_0x14a1('0x6')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x14a1('0x6')],'defaultValue':_0x14a1('0x1c')},'allow':{'type':Sequelize[_0x14a1('0x6')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x25a600){this['setDataValue'](_0x14a1('0x1d'),_0x25a600?_0x25a600[_0x14a1('0xe')](';'):'ulaw;alaw;gsm');},'get':function(){return this['getDataValue'](_0x14a1('0x1d'))?this[_0x14a1('0xf')](_0x14a1('0x1d'))['split'](';'):null;},'comment':_0x14a1('0x1e')},'autoframing':{'type':Sequelize[_0x14a1('0x2')](_0x14a1('0x16'),'no')},'insecure':{'type':Sequelize[_0x14a1('0x6')],'defaultValue':'port,invite','set':function(_0x523306){this[_0x14a1('0xc')](_0x14a1('0x1f'),_0x523306?_0x523306[_0x14a1('0xe')](','):null);},'get':function(){return this[_0x14a1('0xf')](_0x14a1('0x1f'))?this['getDataValue'](_0x14a1('0x1f'))[_0x14a1('0x10')](','):null;},'comment':_0x14a1('0x20')},'trustrpid':{'type':Sequelize[_0x14a1('0x2')](_0x14a1('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x14a1('0x16'),'no',_0x14a1('0x21'))},'promiscredir':{'type':Sequelize[_0x14a1('0x2')](_0x14a1('0x16'),'no')},'useclientcode':{'type':Sequelize[_0x14a1('0x2')](_0x14a1('0x16'),'no')},'accountcode':{'type':Sequelize[_0x14a1('0x22')](0xb)},'setvar':{'type':Sequelize[_0x14a1('0x6')]},'callerid':{'type':Sequelize[_0x14a1('0x6')],'defaultValue':_0x14a1('0x23')},'amaflags':{'type':Sequelize[_0x14a1('0x6')]},'callcounter':{'type':Sequelize['ENUM'](_0x14a1('0x16'),'no'),'defaultValue':_0x14a1('0x16')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x14a1('0x2')](_0x14a1('0x16'),'no')},'allowsubscribe':{'type':Sequelize[_0x14a1('0x2')](_0x14a1('0x16'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x14a1('0x16'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x14a1('0x16'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x14a1('0x6')]},'videosupport':{'type':Sequelize[_0x14a1('0x2')](_0x14a1('0x16'),'no',_0x14a1('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x14a1('0x22')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x14a1('0x2')](_0x14a1('0x16'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x14a1('0x2')](_0x14a1('0x25'),_0x14a1('0x26'),'originate')},'session_expires':{'type':Sequelize[_0x14a1('0x22')](0xb)},'session_minse':{'type':Sequelize[_0x14a1('0x22')](0xb)},'session_refresher':{'type':Sequelize[_0x14a1('0x2')](_0x14a1('0x27'),_0x14a1('0x28')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x14a1('0x6')]},'regexten':{'type':Sequelize[_0x14a1('0x6')]},'fromdomain':{'type':Sequelize[_0x14a1('0x6')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x14a1('0x22')](0x5)},'qualify':{'type':Sequelize[_0x14a1('0x2')](_0x14a1('0x16'),'no'),'defaultValue':_0x14a1('0x16')},'keepalive':{'type':Sequelize[_0x14a1('0x22')](0xb)},'defaultip':{'type':Sequelize[_0x14a1('0x6')]},'defaultuser':{'type':Sequelize[_0x14a1('0x6')]},'rtptimeout':{'type':Sequelize[_0x14a1('0x22')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x14a1('0x22')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x14a1('0x2')](_0x14a1('0x16'),'no',_0x14a1('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x14a1('0x6')]},'callbackextension':{'type':Sequelize[_0x14a1('0x6')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x14a1('0x22')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x14a1('0x6')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x14a1('0x6')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x14a1('0x22')](0xb)},'encryption':{'type':Sequelize[_0x14a1('0x2')](_0x14a1('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x14a1('0x2')](_0x14a1('0x16'),'no')},'force_avp':{'type':Sequelize[_0x14a1('0x2')](_0x14a1('0x16'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0x14a1('0x16'),'no')},'dtlsenable':{'type':Sequelize[_0x14a1('0x2')](_0x14a1('0x16'),'no')},'dtlsverify':{'type':Sequelize[_0x14a1('0x2')](_0x14a1('0x16'),'no',_0x14a1('0x2a'),'certificate')},'dtlsrekey':{'type':Sequelize[_0x14a1('0x22')](0xb)},'dtlscertfile':{'type':Sequelize[_0x14a1('0x6')]},'dtlsprivatekey':{'type':Sequelize[_0x14a1('0x6')]},'dtlscipher':{'type':Sequelize[_0x14a1('0x6')]},'dtlscafile':{'type':Sequelize[_0x14a1('0x6')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x14a1('0x2')](_0x14a1('0x2b'),'passive',_0x14a1('0x2c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x14a1('0x6')]},'usereqphone':{'type':Sequelize[_0x14a1('0x2')](_0x14a1('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x14a1('0x6')]},'recordofffeature':{'type':Sequelize[_0x14a1('0x6')]},'call_limit':{'type':Sequelize[_0x14a1('0x22')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x14a1('0x16'),'no')},'subscribemwi':{'type':Sequelize[_0x14a1('0x2')](_0x14a1('0x16'),'no')},'vmexten':{'type':Sequelize[_0x14a1('0x6')]},'mohinterpret':{'type':Sequelize[_0x14a1('0x6')]},'mohsuggest':{'type':Sequelize[_0x14a1('0x6')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x14a1('0x6')]},'host':{'type':Sequelize[_0x14a1('0x6')],'defaultValue':_0x14a1('0x2d')},'canreinvite':{'type':Sequelize[_0x14a1('0x2')](_0x14a1('0x16'),'no','nonat','update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x14a1('0x6')]},'otherFields':{'type':Sequelize[_0x14a1('0x6')]},'active':{'type':Sequelize[_0x14a1('0x2e')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x14a1('0x6')],'defaultValue':'no'}}; \ No newline at end of file +var _0x17a6=['String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','nonat','update','outgoing','yes','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','join','ulaw;alaw;gsm','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','refuse','originate','uac','pai','fingerprint','certificate','active','actpass','dynamic','BOOLEAN','exports','name','friend','user','peer','from-voip-provider','ENUM','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','STRING','setDataValue','getDataValue','transport','split'];(function(_0xa0154a,_0x4721fb){var _0x3bd19d=function(_0x321d84){while(--_0x321d84){_0xa0154a['push'](_0xa0154a['shift']());}};_0x3bd19d(++_0x4721fb);}(_0x17a6,0x10e));var _0x617a=function(_0x305ba9,_0x5f4917){_0x305ba9=_0x305ba9-0x0;var _0x2672c4=_0x17a6[_0x305ba9];return _0x2672c4;};'use strict';var Sequelize=require('sequelize');module[_0x617a('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x617a('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x617a('0x2'),_0x617a('0x3'),_0x617a('0x4')),'allowNull':![],'defaultValue':_0x617a('0x2')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x617a('0x5')},'callingpres':{'type':Sequelize[_0x617a('0x6')]('ALLOWED_NOT_SCREENED',_0x617a('0x7'),_0x617a('0x8'),_0x617a('0x9'),_0x617a('0xa'),'PROHIB_PASSED_SCREEN',_0x617a('0xb'),_0x617a('0xc'))},'deny':{'type':Sequelize[_0x617a('0xd')]},'permit':{'type':Sequelize[_0x617a('0xd')]},'secret':{'type':Sequelize[_0x617a('0xd')]},'md5secret':{'type':Sequelize[_0x617a('0xd')]},'remotesecret':{'type':Sequelize[_0x617a('0xd')]},'transport':{'type':Sequelize['STRING'],'defaultValue':'udp','set':function(_0x3706a9){this[_0x617a('0xe')]('transport',_0x3706a9?_0x3706a9['join'](','):null);},'get':function(){return this[_0x617a('0xf')]('transport')?this[_0x617a('0xf')](_0x617a('0x10'))[_0x617a('0x11')](','):null;},'comment':_0x617a('0x12')},'dtmfmode':{'type':Sequelize['ENUM'](_0x617a('0x13'),'info',_0x617a('0x14'),'inband','auto'),'defaultValue':_0x617a('0x13')},'directmedia':{'type':Sequelize[_0x617a('0x6')]('yes','no',_0x617a('0x15'),_0x617a('0x16'),_0x617a('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x617a('0x6')](_0x617a('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x617a('0xd')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize['STRING'],'defaultValue':'force_rport,comedia','set':function(_0x57a7b2){this['setDataValue'](_0x617a('0x19'),_0x57a7b2?_0x57a7b2['join'](','):null);},'get':function(){return this[_0x617a('0xf')](_0x617a('0x19'))?this['getDataValue']('nat')['split'](','):null;},'comment':_0x617a('0x1a')},'callgroup':{'type':Sequelize[_0x617a('0xd')]},'namedcallgroup':{'type':Sequelize[_0x617a('0xd')]},'pickupgroup':{'type':Sequelize[_0x617a('0xd')]},'namedpickupgroup':{'type':Sequelize[_0x617a('0xd')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x617a('0xd')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x617a('0xd')],'defaultValue':_0x617a('0x1b')},'allow':{'type':Sequelize[_0x617a('0xd')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x8cc590){this[_0x617a('0xe')](_0x617a('0x1c'),_0x8cc590?_0x8cc590[_0x617a('0x1d')](';'):_0x617a('0x1e'));},'get':function(){return this[_0x617a('0xf')]('allow')?this[_0x617a('0xf')](_0x617a('0x1c'))[_0x617a('0x11')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x617a('0x6')](_0x617a('0x18'),'no')},'insecure':{'type':Sequelize[_0x617a('0xd')],'defaultValue':_0x617a('0x1f'),'set':function(_0x12a113){this[_0x617a('0xe')]('insecure',_0x12a113?_0x12a113[_0x617a('0x1d')](','):null);},'get':function(){return this[_0x617a('0xf')](_0x617a('0x20'))?this[_0x617a('0xf')](_0x617a('0x20'))['split'](','):null;},'comment':_0x617a('0x21')},'trustrpid':{'type':Sequelize[_0x617a('0x6')](_0x617a('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x617a('0x6')](_0x617a('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x617a('0x18'),'no',_0x617a('0x22'))},'promiscredir':{'type':Sequelize[_0x617a('0x6')]('yes','no')},'useclientcode':{'type':Sequelize[_0x617a('0x6')](_0x617a('0x18'),'no')},'accountcode':{'type':Sequelize[_0x617a('0x23')](0xb)},'setvar':{'type':Sequelize[_0x617a('0xd')]},'callerid':{'type':Sequelize[_0x617a('0xd')],'defaultValue':_0x617a('0x24')},'amaflags':{'type':Sequelize[_0x617a('0xd')]},'callcounter':{'type':Sequelize[_0x617a('0x6')]('yes','no'),'defaultValue':_0x617a('0x18')},'busylevel':{'type':Sequelize[_0x617a('0x23')](0xb)},'allowoverlap':{'type':Sequelize[_0x617a('0x6')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0x617a('0x6')](_0x617a('0x18'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x617a('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0x617a('0x6')](_0x617a('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0x617a('0xd')]},'template':{'type':Sequelize[_0x617a('0xd')]},'videosupport':{'type':Sequelize[_0x617a('0x6')](_0x617a('0x18'),'no',_0x617a('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x617a('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x617a('0x6')]('yes','no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x617a('0x6')]('accept',_0x617a('0x26'),_0x617a('0x27'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x617a('0x23')](0xb)},'session_refresher':{'type':Sequelize[_0x617a('0x6')](_0x617a('0x28'),'uas'),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x617a('0xd')]},'regexten':{'type':Sequelize[_0x617a('0xd')]},'fromdomain':{'type':Sequelize[_0x617a('0xd')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x617a('0x23')](0x5)},'qualify':{'type':Sequelize[_0x617a('0x6')](_0x617a('0x18'),'no'),'defaultValue':_0x617a('0x18')},'keepalive':{'type':Sequelize[_0x617a('0x23')](0xb)},'defaultip':{'type':Sequelize[_0x617a('0xd')]},'defaultuser':{'type':Sequelize[_0x617a('0xd')]},'rtptimeout':{'type':Sequelize[_0x617a('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x617a('0x23')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x617a('0x18'),'no',_0x617a('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x617a('0xd')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x617a('0x23')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x617a('0x23')](0xb)},'contactpermit':{'type':Sequelize[_0x617a('0xd')]},'contactdeny':{'type':Sequelize[_0x617a('0xd')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x617a('0xd')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x617a('0x6')](_0x617a('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x617a('0x6')]('yes','no')},'force_avp':{'type':Sequelize[_0x617a('0x6')](_0x617a('0x18'),'no')},'icesupport':{'type':Sequelize[_0x617a('0x6')](_0x617a('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0x617a('0x6')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x617a('0x6')](_0x617a('0x18'),'no',_0x617a('0x2a'),_0x617a('0x2b'))},'dtlsrekey':{'type':Sequelize[_0x617a('0x23')](0xb)},'dtlscertfile':{'type':Sequelize[_0x617a('0xd')]},'dtlsprivatekey':{'type':Sequelize[_0x617a('0xd')]},'dtlscipher':{'type':Sequelize[_0x617a('0xd')]},'dtlscafile':{'type':Sequelize[_0x617a('0xd')]},'dtlscapath':{'type':Sequelize[_0x617a('0xd')]},'dtlssetup':{'type':Sequelize[_0x617a('0x6')](_0x617a('0x2c'),'passive',_0x617a('0x2d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x617a('0x6')](_0x617a('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x617a('0xd')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x617a('0x18'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x617a('0x18'),'no')},'vmexten':{'type':Sequelize[_0x617a('0xd')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x617a('0xd')]},'parkinglot':{'type':Sequelize[_0x617a('0xd')]},'description':{'type':Sequelize[_0x617a('0xd')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x617a('0x2e')},'canreinvite':{'type':Sequelize[_0x617a('0x6')]('yes','no',_0x617a('0x15'),_0x617a('0x16'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x617a('0xd')]},'otherFields':{'type':Sequelize[_0x617a('0xd')]},'active':{'type':Sequelize[_0x617a('0x2f')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'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 df6f0f9..0521843 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 _0x9ccf=['find','clone','omit','createdAt','updatedAt','body','create','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','root','server/files/templates/trunk.ejs','utf8','readFileSync','join','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','update','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','save','destroy','get','Trunks','name','send','index','Trunk','rawAttributes','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','show','params','keys','length'];(function(_0x2a36e6,_0x250137){var _0x438728=function(_0x3598c6){while(--_0x3598c6){_0x2a36e6['push'](_0x2a36e6['shift']());}};_0x438728(++_0x250137);}(_0x9ccf,0x1e9));var _0xf9cc=function(_0x478184,_0x456249){_0x478184=_0x478184-0x0;var _0x230af3=_0x9ccf[_0x478184];return _0x230af3;};'use strict';var pdf=require(_0xf9cc('0x0'));var emlformat=require(_0xf9cc('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf9cc('0x2'));var rp=require(_0xf9cc('0x3'));var moment=require(_0xf9cc('0x4'));var BPromise=require(_0xf9cc('0x5'));var Mustache=require('mustache');var util=require(_0xf9cc('0x6'));var path=require(_0xf9cc('0x7'));var sox=require(_0xf9cc('0x8'));var csv=require(_0xf9cc('0x9'));var ejs=require(_0xf9cc('0xa'));var fs=require('fs');var _=require(_0xf9cc('0xb'));var squel=require(_0xf9cc('0xc'));var crypto=require(_0xf9cc('0xd'));var jsforce=require(_0xf9cc('0xe'));var deskjs=require(_0xf9cc('0xf'));var toCsv=require(_0xf9cc('0x9'));var querystring=require('querystring');var Papa=require(_0xf9cc('0x10'));var Redis=require('ioredis');var authService=require(_0xf9cc('0x11'));var qs=require(_0xf9cc('0x12'));var as=require(_0xf9cc('0x13'));var hardwareService=require(_0xf9cc('0x14'));var logger=require('../../config/logger')(_0xf9cc('0x15'));var utils=require(_0xf9cc('0x16'));var config=require('../../config/environment');var db=require(_0xf9cc('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xf9cc('0x18')][_0xf9cc('0x19')]({'port':0x232a});function checkPasswordPattern(_0x3b00f6,_0x149ef3,_0x21138a){if(_0x21138a){var _0x537884=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x537884['test'](_0x149ef3)){return _0x3b00f6;}else{throw new db[(_0xf9cc('0x1a'))][(_0xf9cc('0x1b'))](_0xf9cc('0x1c'));}}else{return _0x3b00f6;}}function respondWithRpcPromise(_0xc425e5,_0x293d59,_0x1169d6,_0x327ecf){return new BPromise(function(_0x46fc13,_0x18a50b){var _0xdd2175=_0x327ecf||client;return _0xdd2175[_0xf9cc('0x1d')](_0xc425e5,_0x1169d6)[_0xf9cc('0x1e')](function(_0x1bc115){logger['info'](_0xf9cc('0x1f'),_0x293d59,_0xf9cc('0x20'));logger[_0xf9cc('0x21')](_0xf9cc('0x22'),_0x293d59,_0xf9cc('0x20'),JSON[_0xf9cc('0x23')](_0x1bc115));if(_0x1bc115['error']){if(_0x1bc115[_0xf9cc('0x24')][_0xf9cc('0x25')]===0x1f4){logger['error'](_0xf9cc('0x1f'),_0x293d59,_0x1bc115[_0xf9cc('0x24')][_0xf9cc('0x26')]);return _0x18a50b(_0x1bc115[_0xf9cc('0x24')][_0xf9cc('0x26')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x293d59,_0x1bc115['error'][_0xf9cc('0x26')]);return _0x46fc13(_0x1bc115['error'][_0xf9cc('0x26')]);}else{logger[_0xf9cc('0x27')]('Trunk,\x20%s,\x20%s',_0x293d59,_0xf9cc('0x20'));_0x46fc13(_0x1bc115['result'][_0xf9cc('0x26')]);}})[_0xf9cc('0x28')](function(_0x1abb8c){logger[_0xf9cc('0x24')](_0xf9cc('0x1f'),_0x293d59,_0x1abb8c);_0x18a50b(_0x1abb8c);});});}function respondWithStatusCode(_0x2b9dc2,_0x54b43c){_0x54b43c=_0x54b43c||0xcc;return function(_0x433a57){if(_0x433a57){return _0x2b9dc2[_0xf9cc('0x29')](_0x54b43c);}return _0x2b9dc2[_0xf9cc('0x2a')](_0x54b43c)[_0xf9cc('0x2b')]();};}function respondWithResult(_0x5b64e1,_0x3f79cf){_0x3f79cf=_0x3f79cf||0xc8;return function(_0x221c6e){if(_0x221c6e){return _0x5b64e1['status'](_0x3f79cf)[_0xf9cc('0x2c')](_0x221c6e);}};}function respondWithFilteredResult(_0xd0afd9,_0x5dc6fb){return function(_0xd72e6b){if(_0xd72e6b){var _0x119300=_0xd72e6b[_0xf9cc('0x2d')],_0x7242ae=_0x5dc6fb['offset'],_0x332323=_0x5dc6fb['offset']+_0x5dc6fb[_0xf9cc('0x2e')],_0x35e195;if(_0x332323>=_0x119300){_0x332323=_0x119300;_0x35e195=0xc8;}else{_0x35e195=0xce;}_0xd0afd9['status'](_0x35e195);return _0xd0afd9[_0xf9cc('0x2f')](_0xf9cc('0x30'),_0x7242ae+'-'+_0x332323+'/'+_0x119300)[_0xf9cc('0x2c')](_0xd72e6b);}return null;};}function patchUpdates(_0x3b8f38){return function(_0x2a4610){try{jsonpatch[_0xf9cc('0x31')](_0x2a4610,_0x3b8f38,!![]);}catch(_0x32cb52){return BPromise[_0xf9cc('0x32')](_0x32cb52);}return _0x2a4610[_0xf9cc('0x33')]();};}function saveUpdates(_0x2dc096,_0x34c2fe){return function(_0x3c6a78){if(_0x3c6a78){return _0x3c6a78['update'](_0x2dc096)['then'](function(_0x4a41e5){return _0x4a41e5;});}return null;};}function removeEntity(_0x496c16,_0x3c2e58){return function(_0xe0c468){if(_0xe0c468){return _0xe0c468[_0xf9cc('0x34')]()[_0xf9cc('0x1e')](function(){var _0x58bde5=_0xe0c468[_0xf9cc('0x35')]({'plain':!![]});var _0x59c27f=_0xf9cc('0x36');return db['UserProfileResource'][_0xf9cc('0x34')]({'where':{'type':_0x59c27f,'resourceId':_0x58bde5['id']}})['then'](function(){return _0xe0c468;});})[_0xf9cc('0x1e')](function(){_0x496c16['status'](0xcc)[_0xf9cc('0x2b')]();});}};}function handleEntityNotFound(_0xb911c2,_0x29ffd8){return function(_0x3a7c0f){if(!_0x3a7c0f){_0xb911c2[_0xf9cc('0x29')](0x194);}return _0x3a7c0f;};}function handleError(_0x5ca0c1,_0xa23174){_0xa23174=_0xa23174||0x1f4;return function(_0x42908e){logger['error'](_0x42908e['stack']);if(_0x42908e['name']){delete _0x42908e[_0xf9cc('0x37')];}_0x5ca0c1['status'](_0xa23174)[_0xf9cc('0x38')](_0x42908e);};}exports[_0xf9cc('0x39')]=function(_0x302498,_0x677b62){var _0x4bff52={},_0x1de867={},_0x1a87cd={'count':0x0,'rows':[]};var _0x26aedd=_['map'](db[_0xf9cc('0x3a')][_0xf9cc('0x3b')],function(_0x5e3a7e){return{'name':_0x5e3a7e['fieldName'],'type':_0x5e3a7e[_0xf9cc('0x3c')]['key']};});_0x1de867[_0xf9cc('0x3d')]=_[_0xf9cc('0x3e')](_0x26aedd,'name');_0x1de867[_0xf9cc('0x3f')]=_['keys'](_0x302498[_0xf9cc('0x3f')]);_0x1de867[_0xf9cc('0x40')]=_[_0xf9cc('0x41')](_0x1de867[_0xf9cc('0x3d')],_0x1de867[_0xf9cc('0x3f')]);_0x4bff52[_0xf9cc('0x42')]=_[_0xf9cc('0x41')](_0x1de867[_0xf9cc('0x3d')],qs[_0xf9cc('0x43')](_0x302498['query']['fields']));_0x4bff52[_0xf9cc('0x42')]=_0x4bff52[_0xf9cc('0x42')]['length']?_0x4bff52['attributes']:_0x1de867[_0xf9cc('0x3d')];if(!_0x302498['query'][_0xf9cc('0x44')](_0xf9cc('0x45'))){_0x4bff52['limit']=qs['limit'](_0x302498[_0xf9cc('0x3f')][_0xf9cc('0x2e')]);_0x4bff52[_0xf9cc('0x46')]=qs[_0xf9cc('0x46')](_0x302498['query']['offset']);}_0x4bff52[_0xf9cc('0x47')]=qs[_0xf9cc('0x48')](_0x302498['query'][_0xf9cc('0x48')]);_0x4bff52['where']=qs[_0xf9cc('0x40')](_[_0xf9cc('0x49')](_0x302498[_0xf9cc('0x3f')],_0x1de867[_0xf9cc('0x40')]));if(_0x302498[_0xf9cc('0x3f')][_0xf9cc('0x4a')]){_0x4bff52[_0xf9cc('0x4b')]=_[_0xf9cc('0x4c')](_0x4bff52[_0xf9cc('0x4b')],{'$or':_[_0xf9cc('0x3e')](_0x26aedd,function(_0x19a1f2){if(_0x19a1f2[_0xf9cc('0x3c')]!==_0xf9cc('0x4d')){var _0x102570={};_0x102570[_0x19a1f2[_0xf9cc('0x37')]]={'$like':'%'+_0x302498[_0xf9cc('0x3f')]['filter']+'%'};return _0x102570;}})});}_0x4bff52=_[_0xf9cc('0x4c')]({},_0x4bff52,_0x302498[_0xf9cc('0x4e')]);var _0xab8d0b={'where':_0x4bff52['where']};return db[_0xf9cc('0x3a')][_0xf9cc('0x2d')](_0xab8d0b)['then'](function(_0x3614e0){_0x1a87cd['count']=_0x3614e0;if(_0x302498[_0xf9cc('0x3f')][_0xf9cc('0x4f')]){_0x4bff52[_0xf9cc('0x50')]=[{'all':!![]}];}return db[_0xf9cc('0x3a')]['findAll'](_0x4bff52);})[_0xf9cc('0x1e')](function(_0x378623){_0x1a87cd[_0xf9cc('0x51')]=_0x378623;return _0x1a87cd;})[_0xf9cc('0x1e')](respondWithFilteredResult(_0x677b62,_0x4bff52))[_0xf9cc('0x28')](handleError(_0x677b62,null));};exports[_0xf9cc('0x52')]=function(_0x6b23c3,_0xe49e7){var _0x35cc0f={'raw':![],'where':{'id':_0x6b23c3[_0xf9cc('0x53')]['id']}},_0x294a74={};_0x294a74[_0xf9cc('0x3d')]=_[_0xf9cc('0x54')](db[_0xf9cc('0x3a')][_0xf9cc('0x3b')]);_0x294a74[_0xf9cc('0x3f')]=_[_0xf9cc('0x54')](_0x6b23c3['query']);_0x294a74['filters']=_['intersection'](_0x294a74[_0xf9cc('0x3d')],_0x294a74[_0xf9cc('0x3f')]);_0x35cc0f[_0xf9cc('0x42')]=_[_0xf9cc('0x41')](_0x294a74[_0xf9cc('0x3d')],qs['fields'](_0x6b23c3[_0xf9cc('0x3f')][_0xf9cc('0x43')]));_0x35cc0f[_0xf9cc('0x42')]=_0x35cc0f['attributes'][_0xf9cc('0x55')]?_0x35cc0f['attributes']:_0x294a74[_0xf9cc('0x3d')];if(_0x6b23c3['query'][_0xf9cc('0x4f')]){_0x35cc0f[_0xf9cc('0x50')]=[{'all':!![]}];}_0x35cc0f=_[_0xf9cc('0x4c')]({},_0x35cc0f,_0x6b23c3[_0xf9cc('0x4e')]);return db[_0xf9cc('0x3a')][_0xf9cc('0x56')](_0x35cc0f)[_0xf9cc('0x1e')](handleEntityNotFound(_0xe49e7,null))[_0xf9cc('0x1e')](respondWithResult(_0xe49e7,null))[_0xf9cc('0x28')](handleError(_0xe49e7,null));};exports[_0xf9cc('0x57')]=function(_0x182404,_0x165822){var _0x37438b={'where':{'id':_0x182404['params']['id']}},_0x2c1d34={};_0x2c1d34[_0xf9cc('0x3d')]=_['keys'](db[_0xf9cc('0x3a')][_0xf9cc('0x3b')]);_0x37438b[_0xf9cc('0x42')]=_['intersection'](_0x2c1d34[_0xf9cc('0x3d')],qs[_0xf9cc('0x43')](_0x182404[_0xf9cc('0x3f')][_0xf9cc('0x43')]));_0x37438b[_0xf9cc('0x42')]=_0x37438b[_0xf9cc('0x42')][_0xf9cc('0x55')]?_0x37438b[_0xf9cc('0x42')]:_0x2c1d34[_0xf9cc('0x3d')];if(_0x182404[_0xf9cc('0x3f')][_0xf9cc('0x4f')]){_0x37438b[_0xf9cc('0x50')]=[{'all':!![]}];}_0x37438b=_[_0xf9cc('0x4c')]({},_0x37438b,_0x182404[_0xf9cc('0x4e')]);return db[_0xf9cc('0x3a')][_0xf9cc('0x56')](_0x37438b)['then'](handleEntityNotFound(_0x165822,null))[_0xf9cc('0x1e')](function(_0x1af281){if(_0x1af281){var _0x4d397c=_0x1af281[_0xf9cc('0x35')]({'plain':!![]});_0x4d397c=qs[_0xf9cc('0x58')](_0x4d397c,['id',_0xf9cc('0x59'),_0xf9cc('0x5a')]);_0x182404[_0xf9cc('0x5b')]=_[_0xf9cc('0x58')](_0x182404[_0xf9cc('0x5b')],['id','createdAt',_0xf9cc('0x5a')]);return db[_0xf9cc('0x3a')][_0xf9cc('0x5c')](_['merge'](_0x4d397c,_0x182404[_0xf9cc('0x5b')]),{'include':_0x182404[_0xf9cc('0x3f')][_0xf9cc('0x4f')]?[{'all':!![]}]:undefined})[_0xf9cc('0x1e')](function(_0xa3fed7){var _0x42f390=_0x182404[_0xf9cc('0x5d')]['get']({'plain':!![]});if(!_0x42f390)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x42f390[_0xf9cc('0x5e')]===_0xf9cc('0x5d')){var _0x36e409=_0xa3fed7[_0xf9cc('0x35')]({'plain':!![]});var _0x4b934b=_0xf9cc('0x36');return db[_0xf9cc('0x5f')][_0xf9cc('0x56')]({'where':{'name':_0x4b934b,'userProfileId':_0x42f390[_0xf9cc('0x60')]},'raw':!![]})[_0xf9cc('0x1e')](function(_0x5a15a2){if(_0x5a15a2&&_0x5a15a2[_0xf9cc('0x61')]===0x0){return db[_0xf9cc('0x62')]['create']({'name':_0x36e409[_0xf9cc('0x37')],'resourceId':_0x36e409['id'],'type':_0x5a15a2['name'],'sectionId':_0x5a15a2['id']},{})[_0xf9cc('0x1e')](function(){return _0xa3fed7;});}else{return _0xa3fed7;}})['catch'](function(_0x108cd6){logger[_0xf9cc('0x24')](_0xf9cc('0x63'),_0x108cd6);throw _0x108cd6;});}return _0xa3fed7;});}})['then'](respondWithResult(_0x165822,0xc9))[_0xf9cc('0x28')](handleError(_0x165822,null));};exports[_0xf9cc('0x5c')]=function(_0x38a10a,_0x133e16,_0x341e2e){var _0x3a04ad;return db[_0xf9cc('0x3a')][_0xf9cc('0x5c')](_0x38a10a[_0xf9cc('0x5b')],{'raw':!![]})[_0xf9cc('0x1e')](function(_0x10e2d2){_0x3a04ad=_0x10e2d2;return db['Trunk'][_0xf9cc('0x64')]({'raw':!![]});})[_0xf9cc('0x1e')](function(_0x104ea2){var _0x5b4ec2=fs['readFileSync'](path['join'](config[_0xf9cc('0x65')],_0xf9cc('0x66')),_0xf9cc('0x67'));var _0x23ab98=fs[_0xf9cc('0x68')](path[_0xf9cc('0x69')](config[_0xf9cc('0x65')],_0xf9cc('0x6a')),'utf8');var _0x12169f=ejs[_0xf9cc('0x6b')](_0x5b4ec2,{'trunks':_0x104ea2||[]});fs[_0xf9cc('0x6c')](_0xf9cc('0x6d'),_0x12169f);if(_0x3a04ad['registry']){var _0x48771a=ejs[_0xf9cc('0x6b')](_0x23ab98,{'trunks':_0x104ea2||[]});fs['writeFileSync'](_0xf9cc('0x6e'),_0x48771a);}})[_0xf9cc('0x1e')](function(){return respondWithRpcPromise(_0xf9cc('0x6f'),_0xf9cc('0x5c'),{'module':_0xf9cc('0x70')});})[_0xf9cc('0x1e')](function(){var _0x370826=_0x38a10a[_0xf9cc('0x5d')][_0xf9cc('0x35')]({'plain':!![]});if(!_0x370826)throw new Error(_0xf9cc('0x71'));if(_0x370826['role']===_0xf9cc('0x5d')){var _0x3f30ac=_0x3a04ad['get']({'plain':!![]});return db[_0xf9cc('0x5f')][_0xf9cc('0x56')]({'where':{'name':_0xf9cc('0x36'),'userProfileId':_0x370826[_0xf9cc('0x60')]},'raw':!![]})[_0xf9cc('0x1e')](function(_0x3a65f9){if(_0x3a65f9&&_0x3a65f9[_0xf9cc('0x61')]===0x0){return db[_0xf9cc('0x62')][_0xf9cc('0x5c')]({'name':_0x3f30ac[_0xf9cc('0x37')],'resourceId':_0x3f30ac['id'],'type':_0x3a65f9[_0xf9cc('0x37')],'sectionId':_0x3a65f9['id']},{})[_0xf9cc('0x1e')](function(){return _0x3a04ad;});}else{return _0x3a04ad;}})[_0xf9cc('0x28')](function(_0x28bdce){logger[_0xf9cc('0x24')](_0xf9cc('0x63'),_0x28bdce);throw _0x28bdce;});}return _0x3a04ad;})['then'](respondWithResult(_0x133e16,0xc9))[_0xf9cc('0x28')](handleError(_0x133e16,null));};exports[_0xf9cc('0x72')]=function(_0x10ce5f,_0x13dc9f,_0x4b00ef){var _0x568c17;return db[_0xf9cc('0x3a')][_0xf9cc('0x56')]({'where':{'id':_0x10ce5f[_0xf9cc('0x53')]['id']}})[_0xf9cc('0x1e')](handleEntityNotFound(_0x13dc9f,null))[_0xf9cc('0x1e')](saveUpdates(_0x10ce5f['body'],null))[_0xf9cc('0x1e')](function(_0x52feb9){if(_0x52feb9){_0x568c17=_0x52feb9;return db[_0xf9cc('0x3a')][_0xf9cc('0x64')]({'raw':!![]});}})[_0xf9cc('0x1e')](function(_0x48f713){if(_0x48f713){var _0x16f75f=fs[_0xf9cc('0x68')](path[_0xf9cc('0x69')](config['root'],_0xf9cc('0x66')),_0xf9cc('0x67'));var _0xbb99a0=fs[_0xf9cc('0x68')](path['join'](config[_0xf9cc('0x65')],_0xf9cc('0x6a')),_0xf9cc('0x67'));var _0x169089=ejs['render'](_0x16f75f,{'trunks':_0x48f713||[]});fs[_0xf9cc('0x6c')](_0xf9cc('0x6d'),_0x169089);var _0x3a09f8=ejs[_0xf9cc('0x6b')](_0xbb99a0,{'trunks':_0x48f713||[]});fs[_0xf9cc('0x6c')](_0xf9cc('0x6e'),_0x3a09f8);return respondWithRpcPromise('Reload',_0xf9cc('0x72'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x6f2693){if(_0x6f2693){return _0x568c17;}})[_0xf9cc('0x1e')](respondWithResult(_0x13dc9f,null))['catch'](handleError(_0x13dc9f,null));};exports[_0xf9cc('0x34')]=function(_0x46d788,_0x118c62,_0x1ceac6){var _0x384923;return db[_0xf9cc('0x3a')][_0xf9cc('0x56')]({'where':{'id':_0x46d788[_0xf9cc('0x53')]['id']}})[_0xf9cc('0x1e')](handleEntityNotFound(_0x118c62,null))[_0xf9cc('0x1e')](removeEntity(_0x118c62,null))[_0xf9cc('0x1e')](function(){return db[_0xf9cc('0x3a')]['findAll']({'raw':!![]});})[_0xf9cc('0x1e')](function(_0x1931cb){var _0x399e23=fs[_0xf9cc('0x68')](path[_0xf9cc('0x69')](config[_0xf9cc('0x65')],_0xf9cc('0x66')),_0xf9cc('0x67'));var _0x20818b=fs[_0xf9cc('0x68')](path[_0xf9cc('0x69')](config[_0xf9cc('0x65')],_0xf9cc('0x6a')),'utf8');var _0x5441b8=ejs[_0xf9cc('0x6b')](_0x399e23,{'trunks':_0x1931cb});var _0x5c372f=ejs[_0xf9cc('0x6b')](_0x20818b,{'trunks':_0x1931cb});fs[_0xf9cc('0x6c')](_0xf9cc('0x6d'),_0x5441b8);fs[_0xf9cc('0x6c')]('/etc/asterisk/sip_xcally_registers.conf',_0x5c372f);return respondWithRpcPromise(_0xf9cc('0x6f'),_0xf9cc('0x34'),{'module':_0xf9cc('0x70')});})[_0xf9cc('0x28')](handleError(_0x118c62,null));}; \ No newline at end of file +var _0x1398=['lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../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~!@#$%^&-_=+[{]}.','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','offset','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','stack','name','send','index','map','Trunk','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','rows','params','intersection','options','find','clone','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','findAll','readFileSync','join','root','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','UserProfileSection','Trunks','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','server/files/templates/trunk.ejs','chan_sip.so','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox'];(function(_0x37bfb4,_0x8893f){var _0x16a6f0=function(_0xb8542){while(--_0xb8542){_0x37bfb4['push'](_0x37bfb4['shift']());}};_0x16a6f0(++_0x8893f);}(_0x1398,0xd7));var _0x8139=function(_0x388b9c,_0x3a5398){_0x388b9c=_0x388b9c-0x0;var _0x290109=_0x1398[_0x388b9c];return _0x290109;};'use strict';var pdf=require(_0x8139('0x0'));var emlformat=require(_0x8139('0x1'));var rimraf=require(_0x8139('0x2'));var zipdir=require(_0x8139('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8139('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8139('0x5'));var util=require(_0x8139('0x6'));var path=require(_0x8139('0x7'));var sox=require(_0x8139('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x8139('0x9'));var squel=require('squel');var crypto=require(_0x8139('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x8139('0xb'));var toCsv=require('to-csv');var querystring=require(_0x8139('0xc'));var Papa=require(_0x8139('0xd'));var Redis=require(_0x8139('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x8139('0xf'));var as=require(_0x8139('0x10'));var hardwareService=require(_0x8139('0x11'));var logger=require(_0x8139('0x12'))(_0x8139('0x13'));var utils=require(_0x8139('0x14'));var config=require(_0x8139('0x15'));var db=require(_0x8139('0x16'))['db'];var jayson=require(_0x8139('0x17'));var client=jayson[_0x8139('0x18')][_0x8139('0x19')]({'port':0x232a});function checkPasswordPattern(_0x1525bc,_0x3017b1,_0x12c2fb){if(_0x12c2fb){var _0x40d40c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x40d40c[_0x8139('0x1a')](_0x3017b1)){return _0x1525bc;}else{throw new db['Sequelize'][(_0x8139('0x1b'))](_0x8139('0x1c'));}}else{return _0x1525bc;}}function respondWithRpcPromise(_0x432703,_0x7a53bf,_0x5782c0,_0x4b7a2d){return new BPromise(function(_0x57f6a2,_0x54d45b){var _0xd3b4d=_0x4b7a2d||client;return _0xd3b4d[_0x8139('0x1d')](_0x432703,_0x5782c0)[_0x8139('0x1e')](function(_0x16f712){logger[_0x8139('0x1f')](_0x8139('0x20'),_0x7a53bf,_0x8139('0x21'));logger['debug']('Trunk,\x20%s,\x20%s,\x20%s',_0x7a53bf,_0x8139('0x21'),JSON[_0x8139('0x22')](_0x16f712));if(_0x16f712[_0x8139('0x23')]){if(_0x16f712[_0x8139('0x23')][_0x8139('0x24')]===0x1f4){logger[_0x8139('0x23')](_0x8139('0x20'),_0x7a53bf,_0x16f712[_0x8139('0x23')][_0x8139('0x25')]);return _0x54d45b(_0x16f712[_0x8139('0x23')][_0x8139('0x25')]);}logger[_0x8139('0x23')](_0x8139('0x20'),_0x7a53bf,_0x16f712['error']['message']);return _0x57f6a2(_0x16f712['error'][_0x8139('0x25')]);}else{logger[_0x8139('0x1f')]('Trunk,\x20%s,\x20%s',_0x7a53bf,'request\x20sent');_0x57f6a2(_0x16f712[_0x8139('0x26')][_0x8139('0x25')]);}})[_0x8139('0x27')](function(_0x3839d0){logger[_0x8139('0x23')](_0x8139('0x20'),_0x7a53bf,_0x3839d0);_0x54d45b(_0x3839d0);});});}function respondWithStatusCode(_0x51693e,_0xc220b7){_0xc220b7=_0xc220b7||0xcc;return function(_0x56f177){if(_0x56f177){return _0x51693e[_0x8139('0x28')](_0xc220b7);}return _0x51693e[_0x8139('0x29')](_0xc220b7)['end']();};}function respondWithResult(_0x34bec7,_0x1fbf4){_0x1fbf4=_0x1fbf4||0xc8;return function(_0xdcdabb){if(_0xdcdabb){return _0x34bec7[_0x8139('0x29')](_0x1fbf4)[_0x8139('0x2a')](_0xdcdabb);}};}function respondWithFilteredResult(_0x179458,_0x5a2a96){return function(_0x1564cc){if(_0x1564cc){var _0x39c8ca=_0x1564cc['count'],_0x5596f2=_0x5a2a96[_0x8139('0x2b')],_0x3cc843=_0x5a2a96['offset']+_0x5a2a96['limit'],_0x7d239c;if(_0x3cc843>=_0x39c8ca){_0x3cc843=_0x39c8ca;_0x7d239c=0xc8;}else{_0x7d239c=0xce;}_0x179458[_0x8139('0x29')](_0x7d239c);return _0x179458['set'](_0x8139('0x2c'),_0x5596f2+'-'+_0x3cc843+'/'+_0x39c8ca)[_0x8139('0x2a')](_0x1564cc);}return null;};}function patchUpdates(_0x126da0){return function(_0x5bfee1){try{jsonpatch[_0x8139('0x2d')](_0x5bfee1,_0x126da0,!![]);}catch(_0x7e73bc){return BPromise[_0x8139('0x2e')](_0x7e73bc);}return _0x5bfee1[_0x8139('0x2f')]();};}function saveUpdates(_0x5e8ef6,_0x173360){return function(_0x56619b){if(_0x56619b){return _0x56619b[_0x8139('0x30')](_0x5e8ef6)[_0x8139('0x1e')](function(_0x2f01a8){return _0x2f01a8;});}return null;};}function removeEntity(_0x874581,_0x4ecbd3){return function(_0x23d305){if(_0x23d305){return _0x23d305[_0x8139('0x31')]()[_0x8139('0x1e')](function(){var _0x58e9e9=_0x23d305[_0x8139('0x32')]({'plain':!![]});var _0x1bf8e4='Trunks';return db[_0x8139('0x33')][_0x8139('0x31')]({'where':{'type':_0x1bf8e4,'resourceId':_0x58e9e9['id']}})[_0x8139('0x1e')](function(){return _0x23d305;});})[_0x8139('0x1e')](function(){_0x874581[_0x8139('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc7e9ab,_0x10be26){return function(_0x3c4d8a){if(!_0x3c4d8a){_0xc7e9ab[_0x8139('0x28')](0x194);}return _0x3c4d8a;};}function handleError(_0x5ad6e3,_0xcb2fd3){_0xcb2fd3=_0xcb2fd3||0x1f4;return function(_0xc8afc6){logger[_0x8139('0x23')](_0xc8afc6[_0x8139('0x34')]);if(_0xc8afc6[_0x8139('0x35')]){delete _0xc8afc6[_0x8139('0x35')];}_0x5ad6e3['status'](_0xcb2fd3)[_0x8139('0x36')](_0xc8afc6);};}exports[_0x8139('0x37')]=function(_0x48ca07,_0x438f94){var _0x53d2a1={},_0x492a5b={},_0x1d7566={'count':0x0,'rows':[]};var _0x2ce1de=_[_0x8139('0x38')](db[_0x8139('0x39')][_0x8139('0x3a')],function(_0x514740){return{'name':_0x514740['fieldName'],'type':_0x514740[_0x8139('0x3b')][_0x8139('0x3c')]};});_0x492a5b[_0x8139('0x3d')]=_['map'](_0x2ce1de,_0x8139('0x35'));_0x492a5b[_0x8139('0x3e')]=_[_0x8139('0x3f')](_0x48ca07[_0x8139('0x3e')]);_0x492a5b[_0x8139('0x40')]=_['intersection'](_0x492a5b[_0x8139('0x3d')],_0x492a5b['query']);_0x53d2a1[_0x8139('0x41')]=_['intersection'](_0x492a5b[_0x8139('0x3d')],qs[_0x8139('0x42')](_0x48ca07[_0x8139('0x3e')][_0x8139('0x42')]));_0x53d2a1['attributes']=_0x53d2a1[_0x8139('0x41')][_0x8139('0x43')]?_0x53d2a1[_0x8139('0x41')]:_0x492a5b['model'];if(!_0x48ca07[_0x8139('0x3e')][_0x8139('0x44')]('nolimit')){_0x53d2a1[_0x8139('0x45')]=qs[_0x8139('0x45')](_0x48ca07['query']['limit']);_0x53d2a1['offset']=qs[_0x8139('0x2b')](_0x48ca07[_0x8139('0x3e')][_0x8139('0x2b')]);}_0x53d2a1[_0x8139('0x46')]=qs[_0x8139('0x47')](_0x48ca07[_0x8139('0x3e')]['sort']);_0x53d2a1[_0x8139('0x48')]=qs['filters'](_['pick'](_0x48ca07['query'],_0x492a5b[_0x8139('0x40')]));if(_0x48ca07[_0x8139('0x3e')][_0x8139('0x49')]){_0x53d2a1['where']=_['merge'](_0x53d2a1[_0x8139('0x48')],{'$or':_[_0x8139('0x38')](_0x2ce1de,function(_0x5b8c84){if(_0x5b8c84[_0x8139('0x3b')]!==_0x8139('0x4a')){var _0x27173d={};_0x27173d[_0x5b8c84[_0x8139('0x35')]]={'$like':'%'+_0x48ca07[_0x8139('0x3e')][_0x8139('0x49')]+'%'};return _0x27173d;}})});}_0x53d2a1=_[_0x8139('0x4b')]({},_0x53d2a1,_0x48ca07['options']);var _0x49449c={'where':_0x53d2a1[_0x8139('0x48')]};return db[_0x8139('0x39')][_0x8139('0x4c')](_0x49449c)[_0x8139('0x1e')](function(_0x3e34a8){_0x1d7566[_0x8139('0x4c')]=_0x3e34a8;if(_0x48ca07[_0x8139('0x3e')][_0x8139('0x4d')]){_0x53d2a1[_0x8139('0x4e')]=[{'all':!![]}];}return db[_0x8139('0x39')]['findAll'](_0x53d2a1);})[_0x8139('0x1e')](function(_0x6db125){_0x1d7566[_0x8139('0x4f')]=_0x6db125;return _0x1d7566;})[_0x8139('0x1e')](respondWithFilteredResult(_0x438f94,_0x53d2a1))[_0x8139('0x27')](handleError(_0x438f94,null));};exports['show']=function(_0x46de6a,_0x29f43a){var _0x44f8b7={'raw':![],'where':{'id':_0x46de6a[_0x8139('0x50')]['id']}},_0x12bed0={};_0x12bed0[_0x8139('0x3d')]=_[_0x8139('0x3f')](db[_0x8139('0x39')]['rawAttributes']);_0x12bed0[_0x8139('0x3e')]=_[_0x8139('0x3f')](_0x46de6a[_0x8139('0x3e')]);_0x12bed0['filters']=_[_0x8139('0x51')](_0x12bed0[_0x8139('0x3d')],_0x12bed0['query']);_0x44f8b7[_0x8139('0x41')]=_[_0x8139('0x51')](_0x12bed0[_0x8139('0x3d')],qs[_0x8139('0x42')](_0x46de6a['query'][_0x8139('0x42')]));_0x44f8b7[_0x8139('0x41')]=_0x44f8b7['attributes'][_0x8139('0x43')]?_0x44f8b7[_0x8139('0x41')]:_0x12bed0[_0x8139('0x3d')];if(_0x46de6a[_0x8139('0x3e')][_0x8139('0x4d')]){_0x44f8b7['include']=[{'all':!![]}];}_0x44f8b7=_[_0x8139('0x4b')]({},_0x44f8b7,_0x46de6a[_0x8139('0x52')]);return db[_0x8139('0x39')][_0x8139('0x53')](_0x44f8b7)[_0x8139('0x1e')](handleEntityNotFound(_0x29f43a,null))['then'](respondWithResult(_0x29f43a,null))[_0x8139('0x27')](handleError(_0x29f43a,null));};exports[_0x8139('0x54')]=function(_0x568694,_0x302751){var _0x516cd9={'where':{'id':_0x568694[_0x8139('0x50')]['id']}},_0x387bd1={};_0x387bd1[_0x8139('0x3d')]=_[_0x8139('0x3f')](db[_0x8139('0x39')][_0x8139('0x3a')]);_0x516cd9[_0x8139('0x41')]=_[_0x8139('0x51')](_0x387bd1[_0x8139('0x3d')],qs['fields'](_0x568694[_0x8139('0x3e')]['fields']));_0x516cd9[_0x8139('0x41')]=_0x516cd9[_0x8139('0x41')][_0x8139('0x43')]?_0x516cd9[_0x8139('0x41')]:_0x387bd1['model'];if(_0x568694[_0x8139('0x3e')][_0x8139('0x4d')]){_0x516cd9[_0x8139('0x4e')]=[{'all':!![]}];}_0x516cd9=_['merge']({},_0x516cd9,_0x568694[_0x8139('0x52')]);return db[_0x8139('0x39')][_0x8139('0x53')](_0x516cd9)[_0x8139('0x1e')](handleEntityNotFound(_0x302751,null))['then'](function(_0x50b666){if(_0x50b666){var _0x2e743d=_0x50b666[_0x8139('0x32')]({'plain':!![]});_0x2e743d=qs[_0x8139('0x55')](_0x2e743d,['id',_0x8139('0x56'),_0x8139('0x57')]);_0x568694[_0x8139('0x58')]=_[_0x8139('0x55')](_0x568694[_0x8139('0x58')],['id',_0x8139('0x56'),_0x8139('0x57')]);return db[_0x8139('0x39')][_0x8139('0x59')](_[_0x8139('0x4b')](_0x2e743d,_0x568694[_0x8139('0x58')]),{'include':_0x568694['query'][_0x8139('0x4d')]?[{'all':!![]}]:undefined})[_0x8139('0x1e')](function(_0x50978a){var _0x8efd65=_0x568694[_0x8139('0x5a')][_0x8139('0x32')]({'plain':!![]});if(!_0x8efd65)throw new Error(_0x8139('0x5b'));if(_0x8efd65[_0x8139('0x5c')]===_0x8139('0x5a')){var _0x8b46c3=_0x50978a[_0x8139('0x32')]({'plain':!![]});var _0x1f146a='Trunks';return db['UserProfileSection']['find']({'where':{'name':_0x1f146a,'userProfileId':_0x8efd65[_0x8139('0x5d')]},'raw':!![]})['then'](function(_0x1a073e){if(_0x1a073e&&_0x1a073e['autoAssociation']===0x0){return db['UserProfileResource'][_0x8139('0x59')]({'name':_0x8b46c3[_0x8139('0x35')],'resourceId':_0x8b46c3['id'],'type':_0x1a073e['name'],'sectionId':_0x1a073e['id']},{})[_0x8139('0x1e')](function(){return _0x50978a;});}else{return _0x50978a;}})[_0x8139('0x27')](function(_0x43564d){logger[_0x8139('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x43564d);throw _0x43564d;});}return _0x50978a;});}})[_0x8139('0x1e')](respondWithResult(_0x302751,0xc9))[_0x8139('0x27')](handleError(_0x302751,null));};exports[_0x8139('0x59')]=function(_0x3dfd1f,_0x41d86c,_0x5a534c){var _0x55b674;return db[_0x8139('0x39')][_0x8139('0x59')](_0x3dfd1f[_0x8139('0x58')],{'raw':!![]})[_0x8139('0x1e')](function(_0x4b4c75){_0x55b674=_0x4b4c75;return db['Trunk'][_0x8139('0x5e')]({'raw':!![]});})[_0x8139('0x1e')](function(_0x1208ea){var _0x543704=fs[_0x8139('0x5f')](path[_0x8139('0x60')](config[_0x8139('0x61')],'server/files/templates/trunk.ejs'),_0x8139('0x62'));var _0x3a352e=fs[_0x8139('0x5f')](path[_0x8139('0x60')](config[_0x8139('0x61')],_0x8139('0x63')),_0x8139('0x62'));var _0x531d43=ejs[_0x8139('0x64')](_0x543704,{'trunks':_0x1208ea||[]});fs[_0x8139('0x65')](_0x8139('0x66'),_0x531d43);if(_0x55b674[_0x8139('0x67')]){var _0x1600fb=ejs['render'](_0x3a352e,{'trunks':_0x1208ea||[]});fs['writeFileSync'](_0x8139('0x68'),_0x1600fb);}})[_0x8139('0x1e')](function(){return respondWithRpcPromise(_0x8139('0x69'),_0x8139('0x59'),{'module':'chan_sip.so'});})[_0x8139('0x1e')](function(){var _0x54781e=_0x3dfd1f['user'][_0x8139('0x32')]({'plain':!![]});if(!_0x54781e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x54781e[_0x8139('0x5c')]===_0x8139('0x5a')){var _0xd7372c=_0x55b674[_0x8139('0x32')]({'plain':!![]});return db[_0x8139('0x6a')][_0x8139('0x53')]({'where':{'name':_0x8139('0x6b'),'userProfileId':_0x54781e[_0x8139('0x5d')]},'raw':!![]})[_0x8139('0x1e')](function(_0x56dea4){if(_0x56dea4&&_0x56dea4[_0x8139('0x6c')]===0x0){return db[_0x8139('0x33')]['create']({'name':_0xd7372c[_0x8139('0x35')],'resourceId':_0xd7372c['id'],'type':_0x56dea4[_0x8139('0x35')],'sectionId':_0x56dea4['id']},{})['then'](function(){return _0x55b674;});}else{return _0x55b674;}})[_0x8139('0x27')](function(_0x1f05b0){logger[_0x8139('0x23')](_0x8139('0x6d'),_0x1f05b0);throw _0x1f05b0;});}return _0x55b674;})[_0x8139('0x1e')](respondWithResult(_0x41d86c,0xc9))[_0x8139('0x27')](handleError(_0x41d86c,null));};exports['update']=function(_0x4ef01e,_0x558a13,_0x15c991){var _0x49e452;return db[_0x8139('0x39')][_0x8139('0x53')]({'where':{'id':_0x4ef01e[_0x8139('0x50')]['id']}})['then'](handleEntityNotFound(_0x558a13,null))[_0x8139('0x1e')](saveUpdates(_0x4ef01e[_0x8139('0x58')],null))[_0x8139('0x1e')](function(_0x1c909a){if(_0x1c909a){_0x49e452=_0x1c909a;return db[_0x8139('0x39')][_0x8139('0x5e')]({'raw':!![]});}})[_0x8139('0x1e')](function(_0x184637){if(_0x184637){var _0xab5af7=fs[_0x8139('0x5f')](path['join'](config['root'],_0x8139('0x6e')),_0x8139('0x62'));var _0x56793c=fs[_0x8139('0x5f')](path['join'](config['root'],_0x8139('0x63')),_0x8139('0x62'));var _0x128b8a=ejs['render'](_0xab5af7,{'trunks':_0x184637||[]});fs[_0x8139('0x65')]('/etc/asterisk/sip_xcally_trunks.conf',_0x128b8a);var _0x4bc5b4=ejs[_0x8139('0x64')](_0x56793c,{'trunks':_0x184637||[]});fs['writeFileSync'](_0x8139('0x68'),_0x4bc5b4);return respondWithRpcPromise('Reload',_0x8139('0x30'),{'module':'chan_sip.so'});}return null;})[_0x8139('0x1e')](function(_0x4f3bea){if(_0x4f3bea){return _0x49e452;}})[_0x8139('0x1e')](respondWithResult(_0x558a13,null))[_0x8139('0x27')](handleError(_0x558a13,null));};exports['destroy']=function(_0xc0215f,_0x3f37d1,_0x501014){var _0x3b878f;return db[_0x8139('0x39')][_0x8139('0x53')]({'where':{'id':_0xc0215f[_0x8139('0x50')]['id']}})[_0x8139('0x1e')](handleEntityNotFound(_0x3f37d1,null))[_0x8139('0x1e')](removeEntity(_0x3f37d1,null))[_0x8139('0x1e')](function(){return db['Trunk'][_0x8139('0x5e')]({'raw':!![]});})[_0x8139('0x1e')](function(_0x3aea7c){var _0x3d304d=fs[_0x8139('0x5f')](path[_0x8139('0x60')](config[_0x8139('0x61')],_0x8139('0x6e')),_0x8139('0x62'));var _0x5d8985=fs[_0x8139('0x5f')](path[_0x8139('0x60')](config[_0x8139('0x61')],_0x8139('0x63')),'utf8');var _0x40b325=ejs[_0x8139('0x64')](_0x3d304d,{'trunks':_0x3aea7c});var _0x2a99c7=ejs['render'](_0x5d8985,{'trunks':_0x3aea7c});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x40b325);fs['writeFileSync'](_0x8139('0x68'),_0x2a99c7);return respondWithRpcPromise(_0x8139('0x69'),_0x8139('0x31'),{'module':_0x8139('0x6f')});})[_0x8139('0x27')](handleError(_0x3f37d1,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 1bf92ae..a439339 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 _0x9f76=['moment','bluebird','path','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util','../../config/logger','api'];(function(_0x28577d,_0x58f108){var _0x303bff=function(_0x20ff98){while(--_0x20ff98){_0x28577d['push'](_0x28577d['shift']());}};_0x303bff(++_0x58f108);}(_0x9f76,0x6c));var _0x69f7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9f76[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x69f7('0x0'));var util=require(_0x69f7('0x1'));var logger=require(_0x69f7('0x2'))(_0x69f7('0x3'));var moment=require(_0x69f7('0x4'));var BPromise=require(_0x69f7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x69f7('0x6'));var rimraf=require(_0x69f7('0x7'));var config=require(_0x69f7('0x8'));var attributes=require(_0x69f7('0x9'));module[_0x69f7('0xa')]=function(_0x2407f2,_0x26dc8c){return _0x2407f2[_0x69f7('0xb')](_0x69f7('0xc'),attributes,{'tableName':_0x69f7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee13=['./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x1982cc,_0x35cba2){var _0x322da9=function(_0x52c3a4){while(--_0x52c3a4){_0x1982cc['push'](_0x1982cc['shift']());}};_0x322da9(++_0x35cba2);}(_0xee13,0x131));var _0x3ee1=function(_0x8398a9,_0x510eef){_0x8398a9=_0x8398a9-0x0;var _0x175a1e=_0xee13[_0x8398a9];return _0x175a1e;};'use strict';var _=require(_0x3ee1('0x0'));var util=require(_0x3ee1('0x1'));var logger=require(_0x3ee1('0x2'))('api');var moment=require(_0x3ee1('0x3'));var BPromise=require(_0x3ee1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ee1('0x5'));var rimraf=require(_0x3ee1('0x6'));var config=require('../../config/environment');var attributes=require(_0x3ee1('0x7'));module[_0x3ee1('0x8')]=function(_0x53c62d,_0xeef5af){return _0x53c62d[_0x3ee1('0x9')](_0x3ee1('0xa'),attributes,{'tableName':_0x3ee1('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 c8f47f1..626155f 100644 --- a/server/api/trunk/trunk.rpc.js +++ b/server/api/trunk/trunk.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['error','code','message','info','result','catch','GetTrunk','Trunk','options','raw','where','map','model','attributes','include','stringify','ShowTrunk','find','then','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','Trunk,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x277fda,_0x57df6e){var _0x34475a=function(_0x164c2d){while(--_0x164c2d){_0x277fda['push'](_0x277fda['shift']());}};_0x34475a(++_0x57df6e);}(_0x2032,0xd9));var _0x2203=function(_0x4be594,_0xece053){_0x4be594=_0x4be594-0x0;var _0x4aaabe=_0x2032[_0x4be594];return _0x4aaabe;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var BPromise=require(_0x2203('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2203('0x3'));var db=require(_0x2203('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2203('0x5'))(_0x2203('0x6'));var config=require(_0x2203('0x7'));var jayson=require(_0x2203('0x8'));var client=jayson[_0x2203('0x9')][_0x2203('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e0f63,_0x2676aa,_0x18c4d6){return new BPromise(function(_0x2049ff,_0x2999ed){return client['request'](_0x2e0f63,_0x18c4d6)['then'](function(_0x10f055){logger['info'](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));logger[_0x2203('0xd')]('Trunk,\x20%s,\x20%s,\x20%s',_0x2676aa,_0x2203('0xc'),JSON['stringify'](_0x10f055));if(_0x10f055[_0x2203('0xe')]){if(_0x10f055['error'][_0x2203('0xf')]===0x1f4){logger[_0x2203('0xe')]('Trunk,\x20%s,\x20%s',_0x2676aa,_0x10f055['error']['message']);return _0x2999ed(_0x10f055['error']['message']);}logger[_0x2203('0xe')]('Trunk,\x20%s,\x20%s',_0x2676aa,_0x10f055['error'][_0x2203('0x10')]);return _0x2049ff(_0x10f055[_0x2203('0xe')][_0x2203('0x10')]);}else{logger[_0x2203('0x11')](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));_0x2049ff(_0x10f055[_0x2203('0x12')][_0x2203('0x10')]);}})[_0x2203('0x13')](function(_0x3053f3){logger['error'](_0x2203('0xb'),_0x2676aa,_0x3053f3);_0x2999ed(_0x3053f3);});});}exports[_0x2203('0x14')]=function(_0x4893ff){var _0x3f9ef6=this;return new Promise(function(_0x8906e1,_0x4aeb9f){return db[_0x2203('0x15')]['findAll']({'raw':_0x4893ff[_0x2203('0x16')]?_0x4893ff[_0x2203('0x16')][_0x2203('0x17')]===undefined?!![]:![]:!![],'where':_0x4893ff[_0x2203('0x16')]?_0x4893ff[_0x2203('0x16')][_0x2203('0x18')]||null:null,'attributes':_0x4893ff['options']?_0x4893ff[_0x2203('0x16')]['attributes']||null:null,'limit':_0x4893ff['options']?_0x4893ff[_0x2203('0x16')]['limit']||null:null,'include':_0x4893ff[_0x2203('0x16')]?_0x4893ff[_0x2203('0x16')]['include']?_[_0x2203('0x19')](_0x4893ff['options']['include'],function(_0x226374){return{'model':db[_0x226374[_0x2203('0x1a')]],'as':_0x226374['as'],'attributes':_0x226374[_0x2203('0x1b')],'include':_0x226374[_0x2203('0x1c')]?_[_0x2203('0x19')](_0x226374[_0x2203('0x1c')],function(_0x49c12){return{'model':db[_0x49c12[_0x2203('0x1a')]],'as':_0x49c12['as'],'attributes':_0x49c12['attributes'],'include':_0x49c12[_0x2203('0x1c')]?_[_0x2203('0x19')](_0x49c12[_0x2203('0x1c')],function(_0x5f11bf){return{'model':db[_0x5f11bf[_0x2203('0x1a')]],'as':_0x5f11bf['as'],'attributes':_0x5f11bf[_0x2203('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xd6e109){logger[_0x2203('0x11')](_0x2203('0x14'),_0x4893ff);logger[_0x2203('0xd')](_0x2203('0x14'),_0x4893ff,JSON[_0x2203('0x1d')](_0xd6e109));_0x8906e1(_0xd6e109);})[_0x2203('0x13')](function(_0x5a95c1){logger[_0x2203('0xe')](_0x2203('0x14'),_0x5a95c1[_0x2203('0x10')],_0x4893ff);_0x4aeb9f(_0x3f9ef6[_0x2203('0xe')](0x1f4,_0x5a95c1['message']));});});};exports[_0x2203('0x1e')]=function(_0x21ff0d){var _0x287c95=this;return new Promise(function(_0xf59954,_0x520602){return db[_0x2203('0x15')][_0x2203('0x1f')]({'raw':_0x21ff0d['options']?_0x21ff0d['options'][_0x2203('0x17')]===undefined?!![]:![]:!![],'where':_0x21ff0d['options']?_0x21ff0d['options'][_0x2203('0x18')]||null:null,'attributes':_0x21ff0d[_0x2203('0x16')]?_0x21ff0d[_0x2203('0x16')][_0x2203('0x1b')]||null:null,'include':_0x21ff0d[_0x2203('0x16')]?_0x21ff0d['options'][_0x2203('0x1c')]?_[_0x2203('0x19')](_0x21ff0d['options'][_0x2203('0x1c')],function(_0x20fbe1){return{'model':db[_0x20fbe1[_0x2203('0x1a')]],'as':_0x20fbe1['as'],'attributes':_0x20fbe1[_0x2203('0x1b')],'include':_0x20fbe1[_0x2203('0x1c')]?_[_0x2203('0x19')](_0x20fbe1[_0x2203('0x1c')],function(_0x44228e){return{'model':db[_0x44228e[_0x2203('0x1a')]],'as':_0x44228e['as'],'attributes':_0x44228e['attributes'],'include':_0x44228e[_0x2203('0x1c')]?_[_0x2203('0x19')](_0x44228e['include'],function(_0x54b90b){return{'model':db[_0x54b90b[_0x2203('0x1a')]],'as':_0x54b90b['as'],'attributes':_0x54b90b['attributes']};}):[]};}):[]};}):[]:[]})[_0x2203('0x20')](function(_0x3b1eeb){logger[_0x2203('0x11')]('ShowTrunk',_0x21ff0d);logger['debug'](_0x2203('0x1e'),_0x21ff0d,JSON['stringify'](_0x3b1eeb));_0xf59954(_0x3b1eeb);})[_0x2203('0x13')](function(_0x5cfe5e){logger[_0x2203('0xe')]('ShowTrunk',_0x5cfe5e[_0x2203('0x10')],_0x21ff0d);_0x520602(_0x287c95[_0x2203('0xe')](0x1f4,_0x5cfe5e[_0x2203('0x10')]));});});}; \ No newline at end of file +var _0xb10b=['../../config/environment','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetTrunk','Trunk','findAll','options','raw','where','attributes','include','map','model','debug','catch','ShowTrunk','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3160e1,_0x2bc5cd){var _0xa1268e=function(_0x3cdd35){while(--_0x3cdd35){_0x3160e1['push'](_0x3160e1['shift']());}};_0xa1268e(++_0x2bc5cd);}(_0xb10b,0x12a));var _0xbb10=function(_0x4b432a,_0x578c42){_0x4b432a=_0x4b432a-0x0;var _0x505158=_0xb10b[_0x4b432a];return _0x505158;};'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')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'limit':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['limit']||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1c')],function(_0x407cb4){return{'model':db[_0x407cb4[_0xbb10('0x1e')]],'as':_0x407cb4['as'],'attributes':_0x407cb4[_0xbb10('0x1b')],'include':_0x407cb4[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x407cb4[_0xbb10('0x1c')],function(_0x537898){return{'model':db[_0x537898['model']],'as':_0x537898['as'],'attributes':_0x537898['attributes'],'include':_0x537898[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x537898[_0xbb10('0x1c')],function(_0x4e25ff){return{'model':db[_0x4e25ff[_0xbb10('0x1e')]],'as':_0x4e25ff['as'],'attributes':_0x4e25ff[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x1d5e95){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')]('GetTrunk',_0x378da8,JSON[_0xbb10('0x11')](_0x1d5e95));_0x575cca(_0x1d5e95);})[_0xbb10('0x20')](function(_0xfc3595){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0xfc3595[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0xfc3595[_0xbb10('0x13')]));});});};exports['ShowTrunk']=function(_0x448d5c){var _0x56f2da=this;return new Promise(function(_0x16ad2a,_0x1dcc9c){return db[_0xbb10('0x16')]['find']({'raw':_0x448d5c['options']?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x448d5c['options']?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x448d5c[_0xbb10('0x18')]?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'include':_0x448d5c[_0xbb10('0x18')]?_0x448d5c[_0xbb10('0x18')]['include']?_[_0xbb10('0x1d')](_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1c')],function(_0x8c1ce6){return{'model':db[_0x8c1ce6[_0xbb10('0x1e')]],'as':_0x8c1ce6['as'],'attributes':_0x8c1ce6[_0xbb10('0x1b')],'include':_0x8c1ce6[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x8c1ce6[_0xbb10('0x1c')],function(_0x56943c){return{'model':db[_0x56943c[_0xbb10('0x1e')]],'as':_0x56943c['as'],'attributes':_0x56943c[_0xbb10('0x1b')],'include':_0x56943c[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x56943c['include'],function(_0x111762){return{'model':db[_0x111762['model']],'as':_0x111762['as'],'attributes':_0x111762['attributes']};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x40c164){logger[_0xbb10('0xd')](_0xbb10('0x21'),_0x448d5c);logger[_0xbb10('0x1f')](_0xbb10('0x21'),_0x448d5c,JSON['stringify'](_0x40c164));_0x16ad2a(_0x40c164);})[_0xbb10('0x20')](function(_0x25d72f){logger['error']('ShowTrunk',_0x25d72f['message'],_0x448d5c);_0x1dcc9c(_0x56f2da[_0xbb10('0x12')](0x1f4,_0x25d72f[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index edd81ee..2aa8230 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 _0xadb5=['/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getFaxInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','post','/create_many','bulkCreate','addContacts','addQueues','diskStorage','join','root','server/files/images/','format','now','single','addAvatar','/:id/logout','/:id/pause','pause','addTeams','/:id/chat_interactions','addChatInteractions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addChatWebsites','addSquareProjects','/:id/api_key','createApiKey','put','update','removeQueues','delete','removeChatInteractions','/:id/mail_interactions','removeMailInteractions','removeFaxInteractions','/:id/openchannel_interactions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeApiKey','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','index','get','/describe','describe','/whoami','whoami','/:id','show','getAvatar','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions'];(function(_0x53da67,_0x50f467){var _0x5cf8f7=function(_0x5b4ee1){while(--_0x5b4ee1){_0x53da67['push'](_0x53da67['shift']());}};_0x5cf8f7(++_0x50f467);}(_0xadb5,0xad));var _0x5adb=function(_0x1c61f9,_0x41fb61){_0x1c61f9=_0x1c61f9-0x0;var _0x7e5395=_0xadb5[_0x1c61f9];return _0x7e5395;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x5adb('0x4'));var config=require(_0x5adb('0x5'));var controller=require(_0x5adb('0x6'));router['get']('/',auth[_0x5adb('0x7')](),controller[_0x5adb('0x8')]);router[_0x5adb('0x9')](_0x5adb('0xa'),auth[_0x5adb('0x7')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x9')](_0x5adb('0xc'),auth[_0x5adb('0x7')](),controller[_0x5adb('0xd')]);router[_0x5adb('0x9')](_0x5adb('0xe'),auth[_0x5adb('0x7')](),controller[_0x5adb('0xf')]);router['get']('/:id/avatar',controller[_0x5adb('0x10')]);router[_0x5adb('0x9')](_0x5adb('0x11'),auth['isAuthenticated'](),controller[_0x5adb('0x12')]);router['get'](_0x5adb('0x13'),auth['isAuthenticated'](),controller[_0x5adb('0x14')]);router[_0x5adb('0x9')](_0x5adb('0x15'),auth['isAuthenticated'](),controller[_0x5adb('0x16')]);router[_0x5adb('0x9')](_0x5adb('0x17'),auth['isAuthenticated'](),controller[_0x5adb('0x18')]);router['get'](_0x5adb('0x19'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x1a')]);router[_0x5adb('0x9')](_0x5adb('0x1b'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x1c')]);router[_0x5adb('0x9')](_0x5adb('0x1d'),auth['isAuthenticated'](),controller[_0x5adb('0x1e')]);router['get'](_0x5adb('0x1f'),auth['isAuthenticated'](),controller[_0x5adb('0x20')]);router['get']('/:id/mail/interactions',auth[_0x5adb('0x7')](),controller[_0x5adb('0x21')]);router[_0x5adb('0x9')](_0x5adb('0x22'),auth[_0x5adb('0x7')](),controller['getSmsInteractions']);router[_0x5adb('0x9')]('/:id/fax/interactions',auth['isAuthenticated'](),controller[_0x5adb('0x23')]);router[_0x5adb('0x9')](_0x5adb('0x24'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x25')]);router[_0x5adb('0x9')](_0x5adb('0x26'),auth['isAuthenticated'](),controller[_0x5adb('0x27')]);router[_0x5adb('0x9')](_0x5adb('0x28'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x29')]);router['get'](_0x5adb('0x2a'),auth[_0x5adb('0x7')](),controller['getVoicePrefixes']);router[_0x5adb('0x9')](_0x5adb('0x2b'),auth[_0x5adb('0x7')](),controller['getFaxAccounts']);router[_0x5adb('0x9')](_0x5adb('0x2c'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x2d')]);router[_0x5adb('0x9')](_0x5adb('0x2e'),auth['isAuthenticated'](),controller['getOpenchannelAccounts']);router['get'](_0x5adb('0x2f'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x30')]);router[_0x5adb('0x9')](_0x5adb('0x31'),auth['isAuthenticated'](),controller[_0x5adb('0x32')]);router[_0x5adb('0x9')](_0x5adb('0x33'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x34')]);router[_0x5adb('0x9')](_0x5adb('0x35'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x36')]);router[_0x5adb('0x9')]('/:id/api_key',auth[_0x5adb('0x7')](),controller['getApiKey']);router[_0x5adb('0x37')](_0x5adb('0x38'),auth['isAuthenticated'](),controller[_0x5adb('0x39')]);router[_0x5adb('0x37')](_0x5adb('0x11'),auth['isAuthenticated'](),controller[_0x5adb('0x3a')]);router[_0x5adb('0x37')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5adb('0x37')]('/:id/queues',auth[_0x5adb('0x7')](),controller[_0x5adb('0x3b')]);var upload=multer({'storage':multer[_0x5adb('0x3c')]({'destination':function(_0x2da912,_0x9bdece,_0x5ece39){_0x5ece39(null,path[_0x5adb('0x3d')](config[_0x5adb('0x3e')],_0x5adb('0x3f')));},'filename':function(_0x54851b,_0x4c8870,_0x32eb69){_0x32eb69(null,util[_0x5adb('0x40')]('%s-%s',Date[_0x5adb('0x41')](),_0x4c8870['originalname']));}})});router[_0x5adb('0x37')]('/:id/avatar',upload[_0x5adb('0x42')]('file'),controller[_0x5adb('0x43')]);router[_0x5adb('0x37')]('/:id/login',auth[_0x5adb('0x7')](),controller['login']);router[_0x5adb('0x37')](_0x5adb('0x44'),auth[_0x5adb('0x7')](),controller['logout']);router[_0x5adb('0x37')](_0x5adb('0x45'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x46')]);router[_0x5adb('0x37')]('/:id/unpause',auth['isAuthenticated'](),controller['unpause']);router['post'](_0x5adb('0x24'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x47')]);router[_0x5adb('0x37')](_0x5adb('0x48'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x49')]);router[_0x5adb('0x37')]('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0x5adb('0x4a')]);router['post'](_0x5adb('0x4b'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x4c')]);router[_0x5adb('0x37')](_0x5adb('0x4d'),auth['isAuthenticated'](),controller[_0x5adb('0x4e')]);router[_0x5adb('0x37')]('/:id/openchannel_interactions',auth[_0x5adb('0x7')](),controller[_0x5adb('0x4f')]);router['post'](_0x5adb('0x2b'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x50')]);router[_0x5adb('0x37')](_0x5adb('0x2c'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x51')]);router['post']('/:id/openchannel_accounts',auth[_0x5adb('0x7')](),controller[_0x5adb('0x52')]);router[_0x5adb('0x37')](_0x5adb('0x2f'),auth['isAuthenticated'](),controller['addSmsAccounts']);router[_0x5adb('0x37')](_0x5adb('0x31'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x53')]);router[_0x5adb('0x37')]('/:id/square_projects',auth[_0x5adb('0x7')](),controller[_0x5adb('0x54')]);router['post'](_0x5adb('0x55'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x56')]);router[_0x5adb('0x57')](_0x5adb('0xe'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x58')]);router[_0x5adb('0x57')]('/:id/password',auth[_0x5adb('0x7')](),controller['changePassword']);router['delete']('/:id/queues',auth[_0x5adb('0x7')](),controller[_0x5adb('0x59')]);router[_0x5adb('0x5a')]('/:id/teams',auth[_0x5adb('0x7')](),controller['removeTeams']);router[_0x5adb('0x5a')](_0x5adb('0xe'),auth[_0x5adb('0x7')](),controller['destroy']);router[_0x5adb('0x5a')]('/:id/chat_interactions',auth[_0x5adb('0x7')](),controller[_0x5adb('0x5b')]);router['delete'](_0x5adb('0x5c'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x5d')]);router[_0x5adb('0x5a')](_0x5adb('0x4b'),auth['isAuthenticated'](),controller[_0x5adb('0x5e')]);router[_0x5adb('0x5a')](_0x5adb('0x4d'),auth[_0x5adb('0x7')](),controller['removeSmsInteractions']);router[_0x5adb('0x5a')](_0x5adb('0x5f'),auth[_0x5adb('0x7')](),controller['removeOpenchannelInteractions']);router[_0x5adb('0x5a')](_0x5adb('0x2b'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x60')]);router['delete'](_0x5adb('0x2c'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x61')]);router[_0x5adb('0x5a')](_0x5adb('0x2e'),auth['isAuthenticated'](),controller[_0x5adb('0x62')]);router['delete'](_0x5adb('0x2f'),auth['isAuthenticated'](),controller[_0x5adb('0x63')]);router[_0x5adb('0x5a')](_0x5adb('0x31'),auth[_0x5adb('0x7')](),controller['removeChatWebsites']);router[_0x5adb('0x5a')](_0x5adb('0x33'),auth[_0x5adb('0x7')](),controller['removeSquareProjects']);router['delete']('/:id/api_key',auth[_0x5adb('0x7')](),controller[_0x5adb('0x64')]);module[_0x5adb('0x65')]=router; \ No newline at end of file +var _0xc4aa=['put','update','changePassword','removeQueues','removeTeams','delete','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeSquareProjects','removeApiKey','exports','multer','util','path','connect-timeout','express','Router','./user.controller','get','isAuthenticated','index','/describe','describe','whoami','show','getAvatar','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','/:id/square_projects','getSquareProjects','getApiKey','post','/create_many','bulkCreate','addContacts','create','addQueues','root','server/files/images/','format','%s-%s','originalname','/:id/avatar','file','addAvatar','login','pause','/:id/unpause','unpause','/:id/teams','addTeams','/:id/chat_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addFaxAccounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','addChatWebsites','addSquareProjects','/:id/api_key'];(function(_0x2acd35,_0x2b21df){var _0x272693=function(_0x118994){while(--_0x118994){_0x2acd35['push'](_0x2acd35['shift']());}};_0x272693(++_0x2b21df);}(_0xc4aa,0x1b7));var _0xac4a=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xc4aa[_0xa148b7];return _0x51efd3;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xac4a('0x6'));router[_0xac4a('0x7')]('/',auth[_0xac4a('0x8')](),controller[_0xac4a('0x9')]);router[_0xac4a('0x7')](_0xac4a('0xa'),auth[_0xac4a('0x8')](),controller[_0xac4a('0xb')]);router['get']('/whoami',auth[_0xac4a('0x8')](),controller[_0xac4a('0xc')]);router[_0xac4a('0x7')]('/:id',auth[_0xac4a('0x8')](),controller[_0xac4a('0xd')]);router[_0xac4a('0x7')]('/:id/avatar',controller[_0xac4a('0xe')]);router['get'](_0xac4a('0xf'),auth['isAuthenticated'](),controller[_0xac4a('0x10')]);router[_0xac4a('0x7')](_0xac4a('0x11'),auth['isAuthenticated'](),controller[_0xac4a('0x12')]);router[_0xac4a('0x7')](_0xac4a('0x13'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x14')]);router[_0xac4a('0x7')](_0xac4a('0x15'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x16')]);router[_0xac4a('0x7')](_0xac4a('0x17'),auth[_0xac4a('0x8')](),controller['getRecordings']);router[_0xac4a('0x7')](_0xac4a('0x18'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x19')]);router[_0xac4a('0x7')](_0xac4a('0x1a'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x1b')]);router['get']('/:id/openchannel/interactions',auth[_0xac4a('0x8')](),controller[_0xac4a('0x1c')]);router[_0xac4a('0x7')]('/:id/mail/interactions',auth[_0xac4a('0x8')](),controller[_0xac4a('0x1d')]);router[_0xac4a('0x7')](_0xac4a('0x1e'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x1f')]);router[_0xac4a('0x7')](_0xac4a('0x20'),auth['isAuthenticated'](),controller[_0xac4a('0x21')]);router[_0xac4a('0x7')]('/:id/teams',auth[_0xac4a('0x8')](),controller[_0xac4a('0x22')]);router[_0xac4a('0x7')](_0xac4a('0x23'),auth['isAuthenticated'](),controller[_0xac4a('0x24')]);router[_0xac4a('0x7')](_0xac4a('0x25'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x26')]);router[_0xac4a('0x7')](_0xac4a('0x27'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x28')]);router[_0xac4a('0x7')](_0xac4a('0x29'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x2a')]);router[_0xac4a('0x7')](_0xac4a('0x2b'),auth[_0xac4a('0x8')](),controller['getMailAccounts']);router[_0xac4a('0x7')](_0xac4a('0x2c'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x2d')]);router[_0xac4a('0x7')]('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0xac4a('0x2e')]);router[_0xac4a('0x7')](_0xac4a('0x2f'),auth['isAuthenticated'](),controller['getChatWebsites']);router[_0xac4a('0x7')](_0xac4a('0x30'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x31')]);router[_0xac4a('0x7')]('/:id/scheduled_calls',auth[_0xac4a('0x8')](),controller['getScheduledCalls']);router[_0xac4a('0x7')]('/:id/api_key',auth[_0xac4a('0x8')](),controller[_0xac4a('0x32')]);router[_0xac4a('0x33')](_0xac4a('0x34'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x35')]);router[_0xac4a('0x33')](_0xac4a('0xf'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x36')]);router[_0xac4a('0x33')]('/',auth[_0xac4a('0x8')](),controller[_0xac4a('0x37')]);router[_0xac4a('0x33')]('/:id/queues',auth[_0xac4a('0x8')](),controller[_0xac4a('0x38')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2a5419,_0x1af1c1,_0x565164){_0x565164(null,path['join'](config[_0xac4a('0x39')],_0xac4a('0x3a')));},'filename':function(_0x1b42b6,_0x3de9e2,_0x4f5986){_0x4f5986(null,util[_0xac4a('0x3b')](_0xac4a('0x3c'),Date['now'](),_0x3de9e2[_0xac4a('0x3d')]));}})});router[_0xac4a('0x33')](_0xac4a('0x3e'),upload['single'](_0xac4a('0x3f')),controller[_0xac4a('0x40')]);router[_0xac4a('0x33')]('/:id/login',auth[_0xac4a('0x8')](),controller[_0xac4a('0x41')]);router['post']('/:id/logout',auth[_0xac4a('0x8')](),controller['logout']);router['post']('/:id/pause',auth['isAuthenticated'](),controller[_0xac4a('0x42')]);router[_0xac4a('0x33')](_0xac4a('0x43'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x44')]);router[_0xac4a('0x33')](_0xac4a('0x45'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x46')]);router[_0xac4a('0x33')](_0xac4a('0x47'),auth[_0xac4a('0x8')](),controller['addChatInteractions']);router['post']('/:id/mail_interactions',auth[_0xac4a('0x8')](),controller[_0xac4a('0x48')]);router[_0xac4a('0x33')](_0xac4a('0x49'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x4a')]);router[_0xac4a('0x33')](_0xac4a('0x4b'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x4c')]);router['post'](_0xac4a('0x4d'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x4e')]);router[_0xac4a('0x33')](_0xac4a('0x29'),auth['isAuthenticated'](),controller[_0xac4a('0x4f')]);router[_0xac4a('0x33')]('/:id/mail_accounts',auth[_0xac4a('0x8')](),controller['addMailAccounts']);router[_0xac4a('0x33')](_0xac4a('0x2c'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x50')]);router[_0xac4a('0x33')](_0xac4a('0x51'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x52')]);router[_0xac4a('0x33')](_0xac4a('0x2f'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x53')]);router['post'](_0xac4a('0x30'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x54')]);router['post'](_0xac4a('0x55'),auth[_0xac4a('0x8')](),controller['createApiKey']);router[_0xac4a('0x56')]('/:id',auth[_0xac4a('0x8')](),controller[_0xac4a('0x57')]);router[_0xac4a('0x56')]('/:id/password',auth['isAuthenticated'](),controller[_0xac4a('0x58')]);router['delete'](_0xac4a('0x11'),auth['isAuthenticated'](),controller[_0xac4a('0x59')]);router['delete'](_0xac4a('0x45'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x5a')]);router[_0xac4a('0x5b')]('/:id',auth[_0xac4a('0x8')](),controller[_0xac4a('0x5c')]);router[_0xac4a('0x5b')](_0xac4a('0x47'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x5d')]);router[_0xac4a('0x5b')]('/:id/mail_interactions',auth[_0xac4a('0x8')](),controller[_0xac4a('0x5e')]);router['delete'](_0xac4a('0x49'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x5f')]);router[_0xac4a('0x5b')]('/:id/sms_interactions',auth[_0xac4a('0x8')](),controller[_0xac4a('0x60')]);router[_0xac4a('0x5b')](_0xac4a('0x4d'),auth[_0xac4a('0x8')](),controller['removeOpenchannelInteractions']);router[_0xac4a('0x5b')]('/:id/fax_accounts',auth[_0xac4a('0x8')](),controller[_0xac4a('0x61')]);router['delete']('/:id/mail_accounts',auth[_0xac4a('0x8')](),controller[_0xac4a('0x62')]);router['delete'](_0xac4a('0x2c'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x63')]);router[_0xac4a('0x5b')]('/:id/sms_accounts',auth[_0xac4a('0x8')](),controller[_0xac4a('0x64')]);router[_0xac4a('0x5b')](_0xac4a('0x2f'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x65')]);router[_0xac4a('0x5b')]('/:id/square_projects',auth[_0xac4a('0x8')](),controller[_0xac4a('0x66')]);router[_0xac4a('0x5b')](_0xac4a('0x55'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x67')]);module[_0xac4a('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 68db3a3..8dfc9a6 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 _0xa9e0=['\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','certificate','passive','update,nonat','showWebBar','get','wss','force_avp','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','encryption','icesupport','actpass','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','sequelize','moment','util','STRING','setDataValue','name','defaultuser','callerid','getDataValue','internal','email','admin','user','agent','telephone','INTEGER','format','fullname','BOOLEAN','DATE','DEFAULT\x20PAUSE','ENUM','peer','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','join','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never'];(function(_0xb3dbe0,_0x41779b){var _0x46ab96=function(_0x46d340){while(--_0x46d340){_0xb3dbe0['push'](_0xb3dbe0['shift']());}};_0x46ab96(++_0x41779b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x333808){this[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x333808);this[_0x0a9e('0x4')](_0x0a9e('0x6'),_0x333808);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'set':function(_0x441e3a){this[_0x0a9e('0x4')]('fullname',_0x441e3a);this['setDataValue'](_0x0a9e('0x7'),util['format']('\x22%s\x22\x20<%s>',_0x441e3a,this[_0x0a9e('0x8')](_0x0a9e('0x9'))));}},'alias':{'type':Sequelize[_0x0a9e('0x3')]},'email':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':_0x0a9e('0xa'),'validate':{'isEmail':!![]},'set':function(_0xbd1168){if(_0xbd1168){this['setDataValue']('email',_0xbd1168['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':![],'unique':_0x0a9e('0x9'),'set':function(_0x2b4227){this[_0x0a9e('0x4')](_0x0a9e('0x9'),_0x2b4227);this[_0x0a9e('0x4')]('accountcode',_0x2b4227);this[_0x0a9e('0x4')]('callerid',util[_0x0a9e('0x10')]('\x22%s\x22\x20<%s>',this[_0x0a9e('0x8')](_0x0a9e('0x11')),_0x2b4227));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x0a9e('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x0a9e('0x3')]},'zipcode':{'type':Sequelize[_0x0a9e('0x3')]},'userpic':{'type':Sequelize[_0x0a9e('0x3')]},'city':{'type':Sequelize[_0x0a9e('0x3')]},'country':{'type':Sequelize[_0x0a9e('0x3')]},'online':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x0a9e('0x13')]},'voicePause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':_0x0a9e('0x14')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'description':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x0a9e('0xf')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x0a9e('0x15')]('friend',_0x0a9e('0xc'),_0x0a9e('0x16')),'allowNull':!![],'defaultValue':_0x0a9e('0x17')},'context':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x18')},'callingpres':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x19'),_0x0a9e('0x1a'),'ALLOWED_FAILED_SCREEN',_0x0a9e('0x1b'),_0x0a9e('0x1c'),_0x0a9e('0x1d'),_0x0a9e('0x1e'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x1f'),'set':function(_0x2e8759){this[_0x0a9e('0x4')]('transport',_0x2e8759?_0x2e8759[_0x0a9e('0x20')](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x21'))?this[_0x0a9e('0x8')](_0x0a9e('0x21'))[_0x0a9e('0x22')](','):null;},'comment':_0x0a9e('0x23')},'dtmfmode':{'type':Sequelize['ENUM'](_0x0a9e('0x24'),_0x0a9e('0x25'),_0x0a9e('0x26'),_0x0a9e('0x27'),_0x0a9e('0x28')),'allowNull':!![],'defaultValue':_0x0a9e('0x24')},'directmedia':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no','nonat',_0x0a9e('0x2a'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x0a9e('0x2b'),'set':function(_0xd1836d){this[_0x0a9e('0x4')](_0x0a9e('0x2c'),_0xd1836d?_0xd1836d['join'](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x2c'))?this['getDataValue'](_0x0a9e('0x2c'))[_0x0a9e('0x22')](','):null;},'comment':_0x0a9e('0x2d')},'callgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'language':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':_0x0a9e('0x2e')},'allow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x546ef8){this[_0x0a9e('0x4')](_0x0a9e('0x2f'),_0x546ef8?_0x546ef8['join'](';'):_0x0a9e('0x30'));},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x2f'))?this[_0x0a9e('0x8')]('allow')['split'](';'):null;},'comment':_0x0a9e('0x31')},'autoframing':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'set':function(_0x1dec2e){this[_0x0a9e('0x4')]('insecure',_0x1dec2e?_0x1dec2e[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x32'))?this[_0x0a9e('0x8')](_0x0a9e('0x32'))[_0x0a9e('0x22')](','):null;},'comment':_0x0a9e('0x33')},'trustrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no',_0x0a9e('0x34')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x35')},'amaflags':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x29')},'busylevel':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x0a9e('0x15')]('yes','no',_0x0a9e('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x0a9e('0x37'),_0x0a9e('0x38'),_0x0a9e('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x3a'),'uas'),'allowNull':!![],'defaultValue':_0x0a9e('0x3b')},'t38pt_usertpsource':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x29')},'keepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no',_0x0a9e('0x3c'),_0x0a9e('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x0a9e('0x15')]('active',_0x0a9e('0x3e'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no','nonat',_0x0a9e('0x2a'),_0x0a9e('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x0a9e('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x0a9e('0x13')]},'showWebBar':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0,'set':function(_0x5d86e9){this[_0x0a9e('0x4')](_0x0a9e('0x40'),_0x5d86e9);var _0x5239ef=this[_0x0a9e('0x41')]({'plain':!![]});switch(_0x5d86e9){case 0x0:case 0x1:var _0x5cc8fb=_0x5239ef[_0x0a9e('0x21')]?_['isArray'](_0x5239ef['transport'])?_0x5239ef['transport'][_0x0a9e('0x20')]():_0x5239ef['transport']:_0x0a9e('0x1f');if(_0x5cc8fb===_0x0a9e('0x42')){_0x5cc8fb=_0x0a9e('0x1f');}this[_0x0a9e('0x4')](_0x0a9e('0x21'),_0x5cc8fb);this[_0x0a9e('0x4')]('encryption','no');this[_0x0a9e('0x4')]('avpf',null);this[_0x0a9e('0x4')](_0x0a9e('0x43'),null);this[_0x0a9e('0x4')]('icesupport',null);this[_0x0a9e('0x4')](_0x0a9e('0x44'),null);this[_0x0a9e('0x4')](_0x0a9e('0x45'),null);this['setDataValue'](_0x0a9e('0x46'),null);this[_0x0a9e('0x4')]('dtlscertfile',null);this[_0x0a9e('0x4')](_0x0a9e('0x47'),null);this[_0x0a9e('0x4')](_0x0a9e('0x48'),'no');break;case 0x2:this[_0x0a9e('0x4')]('transport',_0x0a9e('0x42'));this[_0x0a9e('0x4')](_0x0a9e('0x49'),'yes');this[_0x0a9e('0x4')]('avpf','yes');this[_0x0a9e('0x4')](_0x0a9e('0x43'),_0x0a9e('0x29'));this[_0x0a9e('0x4')](_0x0a9e('0x4a'),_0x0a9e('0x29'));this[_0x0a9e('0x4')](_0x0a9e('0x44'),_0x0a9e('0x29'));this[_0x0a9e('0x4')](_0x0a9e('0x45'),'no');this[_0x0a9e('0x4')](_0x0a9e('0x46'),_0x0a9e('0x4b'));this[_0x0a9e('0x4')](_0x0a9e('0x4c'),_0x5239ef[_0x0a9e('0x4c')]||_0x0a9e('0x4d'));this['setDataValue'](_0x0a9e('0x47'),_0x5239ef[_0x0a9e('0x47')]||_0x0a9e('0x4e'));this['setDataValue'](_0x0a9e('0x48'),_0x0a9e('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x83f0b2){this[_0x0a9e('0x4')](_0x0a9e('0x4f'),_0x83f0b2?_0x83f0b2[_0x0a9e('0x20')](','):[]);},'get':function(){return this[_0x0a9e('0x8')]('permissions')?_['map'](this['getDataValue'](_0x0a9e('0x4f'))[_0x0a9e('0x22')](','),function(_0x1104ad){return parseInt(_0x1104ad,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x0a9e('0x3')]},'passwordResetAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x50'))?this[_0x0a9e('0x8')](_0x0a9e('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'interface':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0x30a4c7){if(typeof _0x30a4c7===_0x0a9e('0x51')){var _0x332367=_0x30a4c7==='1'?!![]:_0x30a4c7==='0'?![]:_0x30a4c7===_0x0a9e('0x52')?!![]:_0x30a4c7===_0x0a9e('0x53')?![]:![];this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0x332367);}else{this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0x30a4c7);}}},'blocked':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0x25744a){this[_0x0a9e('0x4')]('blocked',_0x25744a);if(_0x25744a===!![]){this[_0x0a9e('0x4')](_0x0a9e('0x55'),moment());this[_0x0a9e('0x4')]('loginAttempts',0x0);}else{this[_0x0a9e('0x4')](_0x0a9e('0x55'),null);}}},'blockedAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xa9e0=['\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','certificate','passive','update,nonat','showWebBar','get','wss','force_avp','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','encryption','icesupport','actpass','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','sequelize','moment','util','STRING','setDataValue','name','defaultuser','callerid','getDataValue','internal','email','admin','user','agent','telephone','INTEGER','format','fullname','BOOLEAN','DATE','DEFAULT\x20PAUSE','ENUM','peer','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','join','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never'];(function(_0x1ca110,_0x5d21b6){var _0x30ae8e=function(_0x4ed795){while(--_0x4ed795){_0x1ca110['push'](_0x1ca110['shift']());}};_0x30ae8e(++_0x5d21b6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x333808){this[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x333808);this[_0x0a9e('0x4')](_0x0a9e('0x6'),_0x333808);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'set':function(_0x441e3a){this[_0x0a9e('0x4')]('fullname',_0x441e3a);this['setDataValue'](_0x0a9e('0x7'),util['format']('\x22%s\x22\x20<%s>',_0x441e3a,this[_0x0a9e('0x8')](_0x0a9e('0x9'))));}},'alias':{'type':Sequelize[_0x0a9e('0x3')]},'email':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':_0x0a9e('0xa'),'validate':{'isEmail':!![]},'set':function(_0xbd1168){if(_0xbd1168){this['setDataValue']('email',_0xbd1168['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':![],'unique':_0x0a9e('0x9'),'set':function(_0x2b4227){this[_0x0a9e('0x4')](_0x0a9e('0x9'),_0x2b4227);this[_0x0a9e('0x4')]('accountcode',_0x2b4227);this[_0x0a9e('0x4')]('callerid',util[_0x0a9e('0x10')]('\x22%s\x22\x20<%s>',this[_0x0a9e('0x8')](_0x0a9e('0x11')),_0x2b4227));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x0a9e('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x0a9e('0x3')]},'zipcode':{'type':Sequelize[_0x0a9e('0x3')]},'userpic':{'type':Sequelize[_0x0a9e('0x3')]},'city':{'type':Sequelize[_0x0a9e('0x3')]},'country':{'type':Sequelize[_0x0a9e('0x3')]},'online':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x0a9e('0x13')]},'voicePause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':_0x0a9e('0x14')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'description':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x0a9e('0xf')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x0a9e('0x15')]('friend',_0x0a9e('0xc'),_0x0a9e('0x16')),'allowNull':!![],'defaultValue':_0x0a9e('0x17')},'context':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x18')},'callingpres':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x19'),_0x0a9e('0x1a'),'ALLOWED_FAILED_SCREEN',_0x0a9e('0x1b'),_0x0a9e('0x1c'),_0x0a9e('0x1d'),_0x0a9e('0x1e'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x1f'),'set':function(_0x2e8759){this[_0x0a9e('0x4')]('transport',_0x2e8759?_0x2e8759[_0x0a9e('0x20')](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x21'))?this[_0x0a9e('0x8')](_0x0a9e('0x21'))[_0x0a9e('0x22')](','):null;},'comment':_0x0a9e('0x23')},'dtmfmode':{'type':Sequelize['ENUM'](_0x0a9e('0x24'),_0x0a9e('0x25'),_0x0a9e('0x26'),_0x0a9e('0x27'),_0x0a9e('0x28')),'allowNull':!![],'defaultValue':_0x0a9e('0x24')},'directmedia':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no','nonat',_0x0a9e('0x2a'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x0a9e('0x2b'),'set':function(_0xd1836d){this[_0x0a9e('0x4')](_0x0a9e('0x2c'),_0xd1836d?_0xd1836d['join'](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x2c'))?this['getDataValue'](_0x0a9e('0x2c'))[_0x0a9e('0x22')](','):null;},'comment':_0x0a9e('0x2d')},'callgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'language':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':_0x0a9e('0x2e')},'allow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x546ef8){this[_0x0a9e('0x4')](_0x0a9e('0x2f'),_0x546ef8?_0x546ef8['join'](';'):_0x0a9e('0x30'));},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x2f'))?this[_0x0a9e('0x8')]('allow')['split'](';'):null;},'comment':_0x0a9e('0x31')},'autoframing':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'set':function(_0x1dec2e){this[_0x0a9e('0x4')]('insecure',_0x1dec2e?_0x1dec2e[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x32'))?this[_0x0a9e('0x8')](_0x0a9e('0x32'))[_0x0a9e('0x22')](','):null;},'comment':_0x0a9e('0x33')},'trustrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no',_0x0a9e('0x34')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x35')},'amaflags':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x29')},'busylevel':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x0a9e('0x15')]('yes','no',_0x0a9e('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x0a9e('0x37'),_0x0a9e('0x38'),_0x0a9e('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x3a'),'uas'),'allowNull':!![],'defaultValue':_0x0a9e('0x3b')},'t38pt_usertpsource':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x29')},'keepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no',_0x0a9e('0x3c'),_0x0a9e('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x0a9e('0x15')]('active',_0x0a9e('0x3e'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no','nonat',_0x0a9e('0x2a'),_0x0a9e('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x0a9e('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x0a9e('0x13')]},'showWebBar':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0,'set':function(_0x5d86e9){this[_0x0a9e('0x4')](_0x0a9e('0x40'),_0x5d86e9);var _0x5239ef=this[_0x0a9e('0x41')]({'plain':!![]});switch(_0x5d86e9){case 0x0:case 0x1:var _0x5cc8fb=_0x5239ef[_0x0a9e('0x21')]?_['isArray'](_0x5239ef['transport'])?_0x5239ef['transport'][_0x0a9e('0x20')]():_0x5239ef['transport']:_0x0a9e('0x1f');if(_0x5cc8fb===_0x0a9e('0x42')){_0x5cc8fb=_0x0a9e('0x1f');}this[_0x0a9e('0x4')](_0x0a9e('0x21'),_0x5cc8fb);this[_0x0a9e('0x4')]('encryption','no');this[_0x0a9e('0x4')]('avpf',null);this[_0x0a9e('0x4')](_0x0a9e('0x43'),null);this[_0x0a9e('0x4')]('icesupport',null);this[_0x0a9e('0x4')](_0x0a9e('0x44'),null);this[_0x0a9e('0x4')](_0x0a9e('0x45'),null);this['setDataValue'](_0x0a9e('0x46'),null);this[_0x0a9e('0x4')]('dtlscertfile',null);this[_0x0a9e('0x4')](_0x0a9e('0x47'),null);this[_0x0a9e('0x4')](_0x0a9e('0x48'),'no');break;case 0x2:this[_0x0a9e('0x4')]('transport',_0x0a9e('0x42'));this[_0x0a9e('0x4')](_0x0a9e('0x49'),'yes');this[_0x0a9e('0x4')]('avpf','yes');this[_0x0a9e('0x4')](_0x0a9e('0x43'),_0x0a9e('0x29'));this[_0x0a9e('0x4')](_0x0a9e('0x4a'),_0x0a9e('0x29'));this[_0x0a9e('0x4')](_0x0a9e('0x44'),_0x0a9e('0x29'));this[_0x0a9e('0x4')](_0x0a9e('0x45'),'no');this[_0x0a9e('0x4')](_0x0a9e('0x46'),_0x0a9e('0x4b'));this[_0x0a9e('0x4')](_0x0a9e('0x4c'),_0x5239ef[_0x0a9e('0x4c')]||_0x0a9e('0x4d'));this['setDataValue'](_0x0a9e('0x47'),_0x5239ef[_0x0a9e('0x47')]||_0x0a9e('0x4e'));this['setDataValue'](_0x0a9e('0x48'),_0x0a9e('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x83f0b2){this[_0x0a9e('0x4')](_0x0a9e('0x4f'),_0x83f0b2?_0x83f0b2[_0x0a9e('0x20')](','):[]);},'get':function(){return this[_0x0a9e('0x8')]('permissions')?_['map'](this['getDataValue'](_0x0a9e('0x4f'))[_0x0a9e('0x22')](','),function(_0x1104ad){return parseInt(_0x1104ad,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x0a9e('0x3')]},'passwordResetAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x50'))?this[_0x0a9e('0x8')](_0x0a9e('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'interface':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0x30a4c7){if(typeof _0x30a4c7===_0x0a9e('0x51')){var _0x332367=_0x30a4c7==='1'?!![]:_0x30a4c7==='0'?![]:_0x30a4c7===_0x0a9e('0x52')?!![]:_0x30a4c7===_0x0a9e('0x53')?![]:![];this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0x332367);}else{this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0x30a4c7);}}},'blocked':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0x25744a){this[_0x0a9e('0x4')]('blocked',_0x25744a);if(_0x25744a===!![]){this[_0x0a9e('0x4')](_0x0a9e('0x55'),moment());this[_0x0a9e('0x4')]('loginAttempts',0x0);}else{this[_0x0a9e('0x4')](_0x0a9e('0x55'),null);}}},'blockedAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index fd790c2..f390b2c 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 _0xb90a=['Telephones','filter','ignore','map','value','role','find','name','destroy','stack','rawAttributes','fieldName','key','model','differenceBy','password','salt','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','pick','filters','where','merge','type','VIRTUAL','sequelize','lower','col','options','User','includeAll','include','findAll','rows','show','keys','bulkCreate','body','params','describe','addContacts','omit','ids','agent\x20role','telephone','admin','../../config/license/util','getLicense','users','isNil','License\x20limit\x20reached','count\x20%s:\x20%s','internal','Setting','findById','securePassword','min_internal','max','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','from','voicemail','fullname','email','permissions','101','103','110','106','107','108','109','100','VoiceMail','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','changePassword','findOne','oldPassword','newPassword','Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword','authenticate','Wrong\x20credentials','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','addQueues','channel','online','voicePause','interface','isValidChannel','add','capitalize','Queues','spread','toLowerCase','emit','Queue:save','voice','VoiceQueue','push','penalty','each','UserVoiceQueueRt','removeQueues','Unknown\x20channel','remove','QueueId','addAvatar','userpic','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','CmContact','sort','getContacts','CmList','Tag','Tags','color','tag','getQueues','Queue','Unknown\x20role','getVoiceQueuesRt','getRecordings','VoiceRecording','getScreenRecordings','UserId','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','SmsInteraction','getSmsInteractions','getFaxInteractions','login','phone','mobile','loginInPause','format','LOCAL/%s@from-sip/n','SIP/%s','intrf','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','all','getChannels','LOGIN','LOGININPAUSE','isMiddleware','resolve','logout','pause','QueuePause','PAUSE','updateAttributes','unpause','mailPause','chatPause','faxPause','openchannelPause','smsPause','pauseType','lastPauseAt','manual','mail','chat','fax','sms','Pause','getTeams','Team','addTeams','Voice','setDataValue','getMailQueues','Mail','getSmsQueues','Sms','Fax','getOpenchannelQueues','Openchannel','flatten','transaction','getDataValue','removeTeams','getChatQueues','getFaxQueues','removeAgent','Queue:remove','getLists','values','send','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','isArray','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','getVoicePrefixes','VoicePrefix','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','OpenchannelAccount','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','SquareProject','getSquareProjects','addSquareProjects','getScheduledCalls','CmHopper','concat','$and','$or','$gt','$lt','$lte','$ne','$eq','$notBetween','$in','$notIn','$notLike','$iLike','$notILike','$like','$overlap','$contained','firstName','lastName','Contact','dialActive','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','html-pdf','eml-format','zip-dir','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./user.socket','register','jayson/promise','client','http','Sequelize','ValidationError','request','User,\x20%s,\x20%s','debug','User,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','reject','save','update','then','get','Users','Agents','agent'];(function(_0x2d2ca2,_0x51873f){var _0x48489d=function(_0x1a2cf7){while(--_0x1a2cf7){_0x2d2ca2['push'](_0x2d2ca2['shift']());}};_0x48489d(++_0x51873f);}(_0xb90a,0x12a));var _0xab90=function(_0x22ea24,_0x9d91fa){_0x22ea24=_0x22ea24-0x0;var _0x6946d0=_0xb90a[_0x22ea24];return _0x6946d0;};'use strict';var pdf=require(_0xab90('0x0'));var emlformat=require(_0xab90('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xab90('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xab90('0x3'));var path=require(_0xab90('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xab90('0x5'));var fs=require('fs');var _=require(_0xab90('0x6'));var squel=require(_0xab90('0x7'));var crypto=require('crypto');var jsforce=require(_0xab90('0x8'));var deskjs=require(_0xab90('0x9'));var toCsv=require(_0xab90('0xa'));var querystring=require(_0xab90('0xb'));var Papa=require(_0xab90('0xc'));var Redis=require(_0xab90('0xd'));var authService=require(_0xab90('0xe'));var qs=require(_0xab90('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xab90('0x10'));var logger=require(_0xab90('0x11'))(_0xab90('0x12'));var utils=require(_0xab90('0x13'));var config=require(_0xab90('0x14'));var db=require('../../mysqldb')['db'];config[_0xab90('0x15')]=_[_0xab90('0x16')](config[_0xab90('0x15')],{'host':_0xab90('0x17'),'port':0x18eb});var socket=require(_0xab90('0x18'))(new Redis(config[_0xab90('0x15')]));require(_0xab90('0x19'))[_0xab90('0x1a')](socket);var jayson=require(_0xab90('0x1b'));var client=jayson[_0xab90('0x1c')][_0xab90('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x29f352,_0x1c3d44,_0x556828){if(_0x556828){var _0x282723=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x282723['test'](_0x1c3d44)){return _0x29f352;}else{throw new db[(_0xab90('0x1e'))][(_0xab90('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 _0x29f352;}}function respondWithRpcPromise(_0x3eb936,_0x2e0cf0,_0x2eef86,_0x58cc79){return new BPromise(function(_0x2ab85c,_0x18323a){var _0x1d5222=_0x58cc79||client;return _0x1d5222[_0xab90('0x20')](_0x3eb936,_0x2eef86)['then'](function(_0x2f6904){logger['info'](_0xab90('0x21'),_0x2e0cf0,'request\x20sent');logger[_0xab90('0x22')](_0xab90('0x23'),_0x2e0cf0,_0xab90('0x24'),JSON[_0xab90('0x25')](_0x2f6904));if(_0x2f6904['error']){if(_0x2f6904[_0xab90('0x26')][_0xab90('0x27')]===0x1f4){logger[_0xab90('0x26')](_0xab90('0x21'),_0x2e0cf0,_0x2f6904[_0xab90('0x26')][_0xab90('0x28')]);return _0x18323a(_0x2f6904[_0xab90('0x26')][_0xab90('0x28')]);}logger[_0xab90('0x26')](_0xab90('0x21'),_0x2e0cf0,_0x2f6904[_0xab90('0x26')][_0xab90('0x28')]);return _0x2ab85c(_0x2f6904[_0xab90('0x26')][_0xab90('0x28')]);}else{logger['info'](_0xab90('0x21'),_0x2e0cf0,_0xab90('0x24'));_0x2ab85c(_0x2f6904[_0xab90('0x29')][_0xab90('0x28')]);}})[_0xab90('0x2a')](function(_0x205b63){logger[_0xab90('0x26')](_0xab90('0x21'),_0x2e0cf0,_0x205b63);_0x18323a(_0x205b63);});});}function respondWithStatusCode(_0x1a79d0,_0x52acf0){_0x52acf0=_0x52acf0||0xcc;return function(_0x38b3ae){if(_0x38b3ae){return _0x1a79d0[_0xab90('0x2b')](_0x52acf0);}return _0x1a79d0['status'](_0x52acf0)[_0xab90('0x2c')]();};}function respondWithResult(_0x16be33,_0x146cf7){_0x146cf7=_0x146cf7||0xc8;return function(_0x2f81e2){if(_0x2f81e2){return _0x16be33[_0xab90('0x2d')](_0x146cf7)[_0xab90('0x2e')](_0x2f81e2);}};}function respondWithFilteredResult(_0x44a7a0,_0x15e415){return function(_0xe23096){if(_0xe23096){var _0x2eec36=_0xe23096[_0xab90('0x2f')],_0x581cc6=_0x15e415['offset'],_0x59ed30=_0x15e415[_0xab90('0x30')]+_0x15e415[_0xab90('0x31')],_0x5671c2;if(_0x59ed30>=_0x2eec36){_0x59ed30=_0x2eec36;_0x5671c2=0xc8;}else{_0x5671c2=0xce;}_0x44a7a0[_0xab90('0x2d')](_0x5671c2);return _0x44a7a0[_0xab90('0x32')]('Content-Range',_0x581cc6+'-'+_0x59ed30+'/'+_0x2eec36)[_0xab90('0x2e')](_0xe23096);}return null;};}function patchUpdates(_0x2b0073){return function(_0x3436db){try{jsonpatch['apply'](_0x3436db,_0x2b0073,!![]);}catch(_0x4ef77a){return BPromise[_0xab90('0x33')](_0x4ef77a);}return _0x3436db[_0xab90('0x34')]();};}function saveUpdates(_0x28c108,_0x3355f1){return function(_0x36098d){if(_0x36098d){return _0x36098d[_0xab90('0x35')](_0x28c108)[_0xab90('0x36')](function(_0x1523bf){return _0x1523bf;});}return null;};}function removeEntity(_0x359090,_0xc8f66){return function(_0x12f540){if(_0x12f540){return _0x12f540['destroy']()[_0xab90('0x36')](function(){var _0x1eb4d0=_0x12f540[_0xab90('0x37')]({'plain':!![]});var _0x39d841=[{'name':_0xab90('0x38'),'value':'user','ignore':!![]},{'name':_0xab90('0x39'),'value':_0xab90('0x3a'),'ignore':![]},{'name':_0xab90('0x3b'),'value':'telephone','ignore':![]}];var _0x24031c=_(_0x39d841)[_0xab90('0x3c')](_0xab90('0x3d'))[_0xab90('0x3e')](_0xab90('0x3f'))[_0xab90('0x3f')]();if(_['includes'](_0x24031c,_0x1eb4d0[_0xab90('0x40')])){return;}var _0x47e71b=_[_0xab90('0x41')](_0x39d841,[_0xab90('0x3f'),_0x1eb4d0['role']])[_0xab90('0x42')];return db['UserProfileResource'][_0xab90('0x43')]({'where':{'type':_0x47e71b,'resourceId':_0x1eb4d0['id']}})[_0xab90('0x36')](function(){return _0x12f540;});})[_0xab90('0x36')](function(){_0x359090[_0xab90('0x2d')](0xcc)[_0xab90('0x2c')]();});}};}function handleEntityNotFound(_0x5d0d26,_0x2aca74){return function(_0x4ddc10){if(!_0x4ddc10){_0x5d0d26[_0xab90('0x2b')](0x194);}return _0x4ddc10;};}function handleError(_0x1fadc9,_0x533f4c){_0x533f4c=_0x533f4c||0x1f4;return function(_0x14165e){logger[_0xab90('0x26')](_0x14165e[_0xab90('0x44')]);if(_0x14165e['name']){delete _0x14165e[_0xab90('0x42')];}_0x1fadc9[_0xab90('0x2d')](_0x533f4c)['send'](_0x14165e);};}exports['index']=function(_0xe573ca,_0x3ee976){var _0x61aeb={},_0x1c3328={},_0x3204ea={'count':0x0,'rows':[]};var _0x31972a=_[_0xab90('0x3e')](db['User'][_0xab90('0x45')],function(_0x5563eb){return{'name':_0x5563eb[_0xab90('0x46')],'type':_0x5563eb['type'][_0xab90('0x47')]};});_0x1c3328[_0xab90('0x48')]=_[_0xab90('0x49')](_[_0xab90('0x3e')](_0x31972a,_0xab90('0x42')),[_0xab90('0x4a'),_0xab90('0x4b')]);_0x1c3328[_0xab90('0x4c')]=_['keys'](_0xe573ca['query']);_0x1c3328['filters']=_['intersection'](_0x1c3328[_0xab90('0x48')],_0x1c3328['query']);_0x61aeb[_0xab90('0x4d')]=_[_0xab90('0x4e')](_0x1c3328[_0xab90('0x48')],qs[_0xab90('0x4f')](_0xe573ca[_0xab90('0x4c')]['fields']));_0x61aeb[_0xab90('0x4d')]=_0x61aeb['attributes'][_0xab90('0x50')]?_0x61aeb[_0xab90('0x4d')]:_0x1c3328['model'];if(!_0xe573ca[_0xab90('0x4c')][_0xab90('0x51')](_0xab90('0x52'))){_0x61aeb[_0xab90('0x31')]=qs[_0xab90('0x31')](_0xe573ca[_0xab90('0x4c')]['limit']);_0x61aeb[_0xab90('0x30')]=qs['offset'](_0xe573ca[_0xab90('0x4c')]['offset']);}_0x61aeb[_0xab90('0x53')]=qs['sort'](_0xe573ca[_0xab90('0x4c')]['sort']);_0x61aeb['where']=qs['filters'](_[_0xab90('0x54')](_0xe573ca[_0xab90('0x4c')],_0x1c3328[_0xab90('0x55')]));if(_0xe573ca[_0xab90('0x4c')][_0xab90('0x3c')]){_0x61aeb[_0xab90('0x56')]=_[_0xab90('0x57')](_0x61aeb[_0xab90('0x56')],{'$or':_[_0xab90('0x3e')](_0x31972a,function(_0x4c416d){if(_0x4c416d[_0xab90('0x58')]!==_0xab90('0x59')){return db[_0xab90('0x5a')]['where'](db['sequelize']['fn'](_0xab90('0x5b'),db[_0xab90('0x5a')][_0xab90('0x5c')](_0x4c416d['name'])),{'$like':db[_0xab90('0x5a')]['fn'](_0xab90('0x5b'),'%'+_0xe573ca[_0xab90('0x4c')][_0xab90('0x3c')]+'%')});}})});}_0x61aeb=_[_0xab90('0x57')]({},_0x61aeb,_0xe573ca[_0xab90('0x5d')]);var _0x2b8858={'where':_0x61aeb['where']};return db[_0xab90('0x5e')][_0xab90('0x2f')](_0x2b8858)[_0xab90('0x36')](function(_0x39aca2){_0x3204ea[_0xab90('0x2f')]=_0x39aca2;if(_0xe573ca['query'][_0xab90('0x5f')]){_0x61aeb[_0xab90('0x60')]=[{'all':!![]}];}return db[_0xab90('0x5e')][_0xab90('0x61')](_0x61aeb);})[_0xab90('0x36')](function(_0x1cb7c7){_0x3204ea[_0xab90('0x62')]=_0x1cb7c7;return _0x3204ea;})[_0xab90('0x36')](respondWithFilteredResult(_0x3ee976,_0x61aeb))[_0xab90('0x2a')](handleError(_0x3ee976,null));};exports[_0xab90('0x63')]=function(_0x489c71,_0x206833){var _0x92afda={'raw':![],'where':{'id':_0x489c71['params']['id']}},_0x2b50e0={};_0x2b50e0[_0xab90('0x48')]=_[_0xab90('0x49')](_[_0xab90('0x64')](db[_0xab90('0x5e')][_0xab90('0x45')]),[_0xab90('0x4a'),'salt']);_0x2b50e0[_0xab90('0x4c')]=_[_0xab90('0x64')](_0x489c71[_0xab90('0x4c')]);_0x2b50e0[_0xab90('0x55')]=_[_0xab90('0x4e')](_0x2b50e0[_0xab90('0x48')],_0x2b50e0[_0xab90('0x4c')]);_0x92afda[_0xab90('0x4d')]=_[_0xab90('0x4e')](_0x2b50e0[_0xab90('0x48')],qs[_0xab90('0x4f')](_0x489c71[_0xab90('0x4c')][_0xab90('0x4f')]));_0x92afda[_0xab90('0x4d')]=_0x92afda[_0xab90('0x4d')][_0xab90('0x50')]?_0x92afda[_0xab90('0x4d')]:_0x2b50e0[_0xab90('0x48')];if(_0x489c71[_0xab90('0x4c')][_0xab90('0x5f')]){_0x92afda[_0xab90('0x60')]=[{'all':!![]}];}_0x92afda=_[_0xab90('0x57')]({},_0x92afda,_0x489c71['options']);return db[_0xab90('0x5e')]['find'](_0x92afda)[_0xab90('0x36')](handleEntityNotFound(_0x206833,null))[_0xab90('0x36')](respondWithResult(_0x206833,null))['catch'](handleError(_0x206833,null));};exports[_0xab90('0x65')]=function(_0x490e1f,_0x3ce4b2){return db[_0xab90('0x5e')][_0xab90('0x65')](_0x490e1f['body'],{'raw':![],'individualHooks':!![]})[_0xab90('0x36')](respondWithResult(_0x3ce4b2,0xc9))[_0xab90('0x2a')](handleError(_0x3ce4b2,null));};exports[_0xab90('0x35')]=function(_0x2f1296,_0x5a6004){if(_0x2f1296[_0xab90('0x66')]['id']){delete _0x2f1296[_0xab90('0x66')]['id'];}delete _0x2f1296[_0xab90('0x66')][_0xab90('0x40')];return db[_0xab90('0x5e')]['find']({'where':{'id':_0x2f1296[_0xab90('0x67')]['id']}})[_0xab90('0x36')](handleEntityNotFound(_0x5a6004,null))[_0xab90('0x36')](saveUpdates(_0x2f1296['body'],null))[_0xab90('0x36')](respondWithResult(_0x5a6004,null))['catch'](handleError(_0x5a6004,null));};exports[_0xab90('0x68')]=function(_0x332ea2,_0x3e698e){return db[_0xab90('0x5e')][_0xab90('0x68')]()[_0xab90('0x36')](respondWithResult(_0x3e698e,null))[_0xab90('0x2a')](handleError(_0x3e698e,null));};exports[_0xab90('0x69')]=function(_0xc7c44c,_0x4670d5,_0x1cad79){return db[_0xab90('0x5e')]['find']({'where':{'id':_0xc7c44c[_0xab90('0x67')]['id']}})[_0xab90('0x36')](handleEntityNotFound(_0x4670d5,null))[_0xab90('0x36')](function(_0x17a454){if(_0x17a454){return _0x17a454['addContacts'](_0xc7c44c[_0xab90('0x66')]['ids'],_[_0xab90('0x6a')](_0xc7c44c[_0xab90('0x66')],[_0xab90('0x6b'),'id'])||{});}})[_0xab90('0x36')](respondWithResult(_0x4670d5,null))[_0xab90('0x2a')](handleError(_0x4670d5,null));};var getLicense=function(_0x41bb4a){return new BPromise(function(_0x2c8ab9,_0x3c121d){var _0x27fa8=0x0;_0x41bb4a['body'][_0xab90('0x40')]===_0xab90('0x3a')&&_0x2c8ab9(_0xab90('0x6c'));return db['User'][_0xab90('0x2f')]({'where':{'$or':[{'role':_0x41bb4a[_0xab90('0x66')][_0xab90('0x40')]==='telephone'?_0xab90('0x6d'):[_0xab90('0x6e'),'user']}]}})[_0xab90('0x36')](function(_0x4fd9e0){_0x27fa8=_0x4fd9e0;return require(_0xab90('0x6f'))[_0xab90('0x70')]();})[_0xab90('0x36')](function(_0x15517e){var _0x5b28e6=_0x41bb4a['body'][_0xab90('0x40')]===_0xab90('0x6d')?'telephones':_0xab90('0x71');if(!_[_0xab90('0x72')](_0x15517e[_0x5b28e6])&&_0x27fa8>=_0x15517e[_0x5b28e6]){return _0x3c121d({'message':_0xab90('0x73')});}return _0x2c8ab9(util['format'](_0xab90('0x74'),_0x5b28e6,_0x27fa8));})[_0xab90('0x2a')](function(_0x2c93a9){return _0x3c121d(_0x2c93a9);});});};exports['create']=function(_0x576302,_0x5dc558){return getLicense(_0x576302)[_0xab90('0x36')](function(_0x4da0b0){if(!_0x576302[_0xab90('0x66')][_0xab90('0x75')]){var _0xf69b2c;return db[_0xab90('0x76')][_0xab90('0x77')](0x1)['then'](function(_0x2a07ab){return checkPasswordPattern(_0x2a07ab,_0x576302['body'][_0xab90('0x4a')],_0x2a07ab[_0xab90('0x78')]);})['then'](function(_0x598928){_0xf69b2c=_0x598928[_0xab90('0x79')];return db[_0xab90('0x5e')][_0xab90('0x7a')](_0xab90('0x75'));})[_0xab90('0x36')](function(_0x4d9810){if(_[_0xab90('0x72')](_0x4d9810)){if(_0xf69b2c){_0x576302['body']['internal']=_0xf69b2c;}else{_0x576302[_0xab90('0x66')][_0xab90('0x75')]=0x1;}}else{if(_['isNil'](_0xf69b2c)||_0xf69b2c==_0x4d9810){_0x576302[_0xab90('0x66')][_0xab90('0x75')]=_0x4d9810+0x1;}else if(_0xf69b2c>_0x4d9810){_0x576302['body']['internal']=_0xf69b2c;}else{return db[_0xab90('0x5a')][_0xab90('0x4c')](_0xab90('0x7b'),{'type':db['sequelize'][_0xab90('0x7c')]['SELECT']})[_0xab90('0x36')](function(_0x83c8bc){if(_0x83c8bc&&_0x83c8bc[_0xab90('0x50')]){for(var _0x282ca7=0x0,_0x2f9bbb=_0x83c8bc[_0xab90('0x50')];_0x282ca7<_0x2f9bbb&&_['isNil'](_0x576302[_0xab90('0x66')][_0xab90('0x75')]);_0x282ca7++){if(_0xf69b2c<=_0x83c8bc[_0x282ca7][_0xab90('0x7d')]){_0x576302['body'][_0xab90('0x75')]=_0x83c8bc[_0x282ca7][_0xab90('0x7d')];}else if(_0xf69b2c>_0x83c8bc[_0x282ca7][_0xab90('0x7d')]&&_0xf69b2c<=_0x83c8bc[_0x282ca7]['to']){_0x576302[_0xab90('0x66')][_0xab90('0x75')]=_0xf69b2c;}}}if(_[_0xab90('0x72')](_0x576302[_0xab90('0x66')][_0xab90('0x75')])){_0x576302['body'][_0xab90('0x75')]=_0x4d9810+0x1;}});}}});}})['then'](function(){if(_0x576302['body'][_0xab90('0x7e')]){_0x576302[_0xab90('0x66')]['mailbox']=_0x576302[_0xab90('0x66')][_0xab90('0x75')];_0x576302[_0xab90('0x66')]['VoiceMail']={'mailbox':_0x576302['body'][_0xab90('0x75')],'password':_0x576302[_0xab90('0x66')][_0xab90('0x4a')],'fullname':_0x576302[_0xab90('0x66')][_0xab90('0x7f')],'email':_0x576302[_0xab90('0x66')][_0xab90('0x80')]};}if(_0x576302[_0xab90('0x66')]&&_0x576302[_0xab90('0x66')][_0xab90('0x40')]===_0xab90('0x3a')){_0x576302[_0xab90('0x66')][_0xab90('0x81')]=[_0xab90('0x82'),'102',_0xab90('0x83'),_0xab90('0x84'),'104','105',_0xab90('0x85'),_0xab90('0x86'),_0xab90('0x87'),_0xab90('0x88'),_0xab90('0x89'),'111'];}return db[_0xab90('0x5e')]['create'](_0x576302['body'],{'include':[{'model':db[_0xab90('0x8a')],'as':_0xab90('0x8a')}]});})[_0xab90('0x36')](function(_0x974f04){if(_0x576302['body'][_0xab90('0x40')]===_0xab90('0x8b'))return _0x974f04;var _0x7ebc2c=_0x576302[_0xab90('0x8b')]['get']({'plain':!![]});if(!_0x7ebc2c)throw new Error(_0xab90('0x8c'));if(_0x7ebc2c[_0xab90('0x40')]===_0xab90('0x8b')){var _0x1c9c28=_0x974f04[_0xab90('0x37')]({'plain':!![]});var _0x5ce3d4=[{'name':_0xab90('0x39'),'value':_0xab90('0x3a')},{'name':_0xab90('0x3b'),'value':'telephone'}];var _0x855f51=_['find'](_0x5ce3d4,[_0xab90('0x3f'),_0x1c9c28[_0xab90('0x40')]])[_0xab90('0x42')];return db[_0xab90('0x8d')][_0xab90('0x41')]({'where':{'name':_0x855f51,'userProfileId':_0x7ebc2c[_0xab90('0x8e')]},'raw':!![]})[_0xab90('0x36')](function(_0x4e664c){if(_0x4e664c&&_0x4e664c[_0xab90('0x8f')]===0x0){return db['UserProfileResource']['create']({'name':_0x1c9c28[_0xab90('0x42')],'resourceId':_0x1c9c28['id'],'type':_0x4e664c[_0xab90('0x42')],'sectionId':_0x4e664c['id']},{})[_0xab90('0x36')](function(){return _0x974f04;});}else{return _0x974f04;}})[_0xab90('0x2a')](function(_0xe79335){logger[_0xab90('0x26')](_0xab90('0x90'),_0xe79335);throw _0xe79335;});}return _0x974f04;})[_0xab90('0x36')](respondWithResult(_0x5dc558,0xc9))['catch'](handleError(_0x5dc558,null));};exports[_0xab90('0x91')]=function(_0x191b57,_0x22c06f,_0x58feb1){var _0x3820be=![];if(_0x191b57[_0xab90('0x66')]['id']){delete _0x191b57['body']['id'];}return db[_0xab90('0x76')][_0xab90('0x92')]({'attributes':['id',_0xab90('0x78')]})[_0xab90('0x36')](function(_0x576de0){_0x3820be=_0x576de0['securePassword'];return db['User'][_0xab90('0x41')]({'where':{'id':_0x191b57['params']['id']}});})[_0xab90('0x36')](function(_0x364df5){if(_0x364df5){if(_0x364df5['id']==_0x191b57[_0xab90('0x8b')]['id']){if(!_0x191b57[_0xab90('0x66')][_0xab90('0x93')]||!_0x191b57['body'][_0xab90('0x94')]){throw new db[(_0xab90('0x1e'))]['ValidationError'](_0xab90('0x95'));}if(!_0x364df5[_0xab90('0x96')](_0x191b57['body'][_0xab90('0x93')])){throw new db[(_0xab90('0x1e'))][(_0xab90('0x1f'))](_0xab90('0x97'));}if(_0x191b57[_0xab90('0x66')][_0xab90('0x93')]==_0x191b57[_0xab90('0x66')]['newPassword']){throw new db[(_0xab90('0x1e'))][(_0xab90('0x1f'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}return _0x364df5;}else if(_0x191b57[_0xab90('0x8b')][_0xab90('0x40')]==_0xab90('0x6e')){if(!_0x191b57['body'][_0xab90('0x94')]){throw new db[(_0xab90('0x1e'))][(_0xab90('0x1f'))](_0xab90('0x98'));}return _0x364df5;}else if(_0x191b57['user']['role']=='user'){if(!_0x191b57[_0xab90('0x66')]['newPassword']){throw new db[(_0xab90('0x1e'))][(_0xab90('0x1f'))](_0xab90('0x98'));}if(_0x364df5[_0xab90('0x40')]!='agent'){throw new db[(_0xab90('0x1e'))][(_0xab90('0x1f'))](_0xab90('0x99'));}return _0x364df5;}else{throw new db[(_0xab90('0x1e'))][(_0xab90('0x1f'))]('Unauthorized');}}return null;})[_0xab90('0x36')](handleEntityNotFound(_0x22c06f,null))[_0xab90('0x36')](function(_0x58d33d){return checkPasswordPattern(_0x58d33d,_0x191b57['body'][_0xab90('0x94')],_0x3820be);})[_0xab90('0x36')](saveUpdates({'password':_0x191b57[_0xab90('0x66')][_0xab90('0x94')],'passwordResetAt':_0x191b57[_0xab90('0x8b')]['id']==_0x191b57['params']['id']?moment():null},null))[_0xab90('0x36')](respondWithResult(_0x22c06f,null))['catch'](handleError(_0x22c06f,null));};exports[_0xab90('0x9a')]=function(_0x474efc,_0x53534f,_0xd02da0){var _0x4d6c9=_0x474efc[_0xab90('0x66')][_0xab90('0x9b')];return db['User'][_0xab90('0x41')]({'where':{'id':_0x474efc[_0xab90('0x67')]['id']},'attributes':['id',_0xab90('0x42'),_0xab90('0x40'),_0xab90('0x9c'),'loginInPause',_0xab90('0x9d'),_0xab90('0x9e')]})[_0xab90('0x36')](handleEntityNotFound(_0x53534f,null))[_0xab90('0x36')](function(_0x18628c){if(_0x18628c){if(!utils[_0xab90('0x9f')](_0x4d6c9)){throw new db[(_0xab90('0x1e'))]['ValidationError']('Unknown\x20channel');}return _0x18628c[_0xab90('0xa0')+_[_0xab90('0xa1')](_0x4d6c9['toLowerCase']())+_0xab90('0xa2')](_0x474efc['body']['ids'],{'penalty':_0x474efc[_0xab90('0x66')]['penalty']||0x0})[_0xab90('0xa3')](function(_0x3197b2){for(var _0x5a1cc5=0x0;_0x5a1cc5<_0x474efc['body'][_0xab90('0x6b')][_0xab90('0x50')];_0x5a1cc5+=0x1){var _0x2d88ef={'UserId':_0x474efc[_0xab90('0x67')]['id']};_0x2d88ef[_[_0xab90('0xa1')](_0x4d6c9[_0xab90('0xa4')]())+'QueueId']=_0x474efc[_0xab90('0x66')]['ids'][_0x5a1cc5];socket[_0xab90('0xa5')]('user'+_['capitalize'](_0x4d6c9[_0xab90('0xa4')]())+_0xab90('0xa6'),_0x2d88ef);}return _0x3197b2;})[_0xab90('0x36')](function(){if(_0x4d6c9===_0xab90('0xa7')){return db[_0xab90('0xa8')][_0xab90('0x61')]({'where':{'id':_0x474efc['body'][_0xab90('0x6b')]||[]},'raw':!![],'attributes':['id',_0xab90('0x42')]});}})['then'](function(_0x153cce){var _0x1f7e7d=_0x18628c[_0xab90('0x37')]({'plain':!![]});var _0x4241bd=[];if(_0x4d6c9===_0xab90('0xa7')&&_0x1f7e7d['role']===_0xab90('0x3a')&&_0x1f7e7d[_0xab90('0x9c')]){for(var _0x4c8746=0x0;_0x4c8746<_0x153cce[_0xab90('0x50')];_0x4c8746+=0x1){_0x4241bd[_0xab90('0xa9')]({'membername':_0x1f7e7d[_0xab90('0x42')],'UserId':_0x1f7e7d['id'],'queue_name':_0x153cce[_0x4c8746][_0xab90('0x42')],'VoiceQueueId':_0x153cce[_0x4c8746]['id'],'interface':_[_0xab90('0x72')](_0x1f7e7d[_0xab90('0x9e')])?util['format']('SIP/%s',_0x1f7e7d['name']):_0x1f7e7d[_0xab90('0x9e')],'paused':_0x1f7e7d[_0xab90('0x9d')]||![],'penalty':_0x474efc[_0xab90('0x66')][_0xab90('0xaa')]||0x0});}return BPromise[_0xab90('0xab')](_0x4241bd,function(_0x48aaa0){return db[_0xab90('0xac')]['upsert'](_0x48aaa0);});}return _0x18628c;});}})[_0xab90('0x36')](respondWithStatusCode(_0x53534f,null))[_0xab90('0x2a')](handleError(_0x53534f,null));};exports[_0xab90('0xad')]=function(_0x325b09,_0x327793,_0x3e4312){var _0x5afb8e;return db[_0xab90('0x5e')][_0xab90('0x41')]({'where':{'id':_0x325b09['params']['id']},'attributes':['id',_0xab90('0x42'),_0xab90('0x40')]})[_0xab90('0x36')](handleEntityNotFound(_0x327793,null))[_0xab90('0x36')](function(_0x494424){if(_0x494424){_0x5afb8e=_0x494424;if(!_0x325b09[_0xab90('0x4c')]['channel']||!utils['isValidChannel'](_0x325b09[_0xab90('0x4c')][_0xab90('0x9b')])){throw new db[(_0xab90('0x1e'))][(_0xab90('0x1f'))](_0xab90('0xae'));}return _0x494424[_0xab90('0xaf')+_[_0xab90('0xa1')](_0x325b09[_0xab90('0x4c')]['channel'][_0xab90('0xa4')]())+_0xab90('0xa2')](_0x325b09[_0xab90('0x4c')][_0xab90('0x6b')]);}})[_0xab90('0x36')](function(_0x138b6c){for(var _0x18f8c2=0x0;_0x18f8c2<_0x325b09[_0xab90('0x4c')][_0xab90('0x6b')][_0xab90('0x50')];_0x18f8c2+=0x1){var _0x2788e6={'UserId':_0x325b09[_0xab90('0x67')]['id']};_0x2788e6[_[_0xab90('0xa1')](_0x325b09[_0xab90('0x4c')][_0xab90('0x9b')]['toLowerCase']())+_0xab90('0xb0')]=_0x325b09['query'][_0xab90('0x6b')][_0x18f8c2];socket['emit'](_0xab90('0x8b')+_[_0xab90('0xa1')](_0x325b09[_0xab90('0x4c')][_0xab90('0x9b')][_0xab90('0xa4')]())+'Queue:remove',_0x2788e6);}return _0x138b6c;})[_0xab90('0x36')](function(){if(_0x325b09[_0xab90('0x4c')][_0xab90('0x9b')]===_0xab90('0xa7')){return db[_0xab90('0xac')][_0xab90('0x43')]({'where':{'UserId':_0x325b09[_0xab90('0x67')]['id'],'VoiceQueueId':_0x325b09[_0xab90('0x4c')][_0xab90('0x6b')]},'individualHooks':!![]})[_0xab90('0x36')](function(){return _0x5afb8e;});}return _0x5afb8e;})[_0xab90('0x36')](respondWithStatusCode(_0x327793,null))[_0xab90('0x2a')](handleError(_0x327793,null));};exports[_0xab90('0xb1')]=function(_0x1e43fa,_0x1c5249,_0x464200){_0x1e43fa[_0xab90('0x66')][_0xab90('0xb2')]=_0x1e43fa['file'][_0xab90('0xb3')];return db[_0xab90('0x5e')][_0xab90('0x41')]({'where':{'id':_0x1e43fa[_0xab90('0x67')]['id']}})[_0xab90('0x36')](handleEntityNotFound(_0x1c5249,null))[_0xab90('0x36')](saveUpdates(_0x1e43fa['body'],null))[_0xab90('0x36')](respondWithResult(_0x1c5249,null))['catch'](handleError(_0x1c5249,null));};exports[_0xab90('0xb4')]=function(_0x107a07,_0x595227,_0x3aa94b){var _0xce71c=path[_0xab90('0xb5')](config[_0xab90('0xb6')],_0xab90('0xb7'));return db[_0xab90('0x5e')][_0xab90('0x41')]({'where':{'id':_0x107a07[_0xab90('0x67')]['id']},'attributes':['id',_0xab90('0xb2')],'raw':!![]})[_0xab90('0x36')](handleEntityNotFound(_0x595227,null))['then'](function(_0x6d93a){if(_0x6d93a){if(_['isNil'](_0x6d93a[_0xab90('0xb2')])){return _0x595227[_0xab90('0xb8')](_0xce71c);}else{if(!fs[_0xab90('0xb9')](path[_0xab90('0xb5')](config[_0xab90('0xb6')],_0xab90('0xba'),_0x6d93a[_0xab90('0xb2')]))){return _0x595227[_0xab90('0xb8')](_0xce71c);}return _0x595227[_0xab90('0xb8')](path[_0xab90('0xb5')](config[_0xab90('0xb6')],_0xab90('0xba'),_0x6d93a[_0xab90('0xb2')]));}}})['catch'](handleError(_0x595227,null));};exports['getContacts']=function(_0x66ef14,_0x400245,_0x21a74f){var _0x1120a3={};var _0x1c487f={};var _0xa30b0c;var _0x233c29;return db[_0xab90('0x5e')][_0xab90('0x92')]({'where':{'id':_0x66ef14[_0xab90('0x67')]['id']}})[_0xab90('0x36')](handleEntityNotFound(_0x400245,null))[_0xab90('0x36')](function(_0x1319c4){if(_0x1319c4){_0xa30b0c=_0x1319c4;_0x1c487f[_0xab90('0x48')]=_[_0xab90('0x64')](db[_0xab90('0xbb')][_0xab90('0x45')]);_0x1c487f[_0xab90('0x4c')]=_[_0xab90('0x64')](_0x66ef14[_0xab90('0x4c')]);_0x1c487f[_0xab90('0x55')]=_[_0xab90('0x4e')](_0x1c487f[_0xab90('0x48')],_0x1c487f['query']);_0x1120a3[_0xab90('0x4d')]=_[_0xab90('0x4e')](_0x1c487f[_0xab90('0x48')],qs[_0xab90('0x4f')](_0x66ef14['query'][_0xab90('0x4f')]));_0x1120a3[_0xab90('0x4d')]=_0x1120a3[_0xab90('0x4d')][_0xab90('0x50')]?_0x1120a3['attributes']:_0x1c487f['model'];_0x1120a3[_0xab90('0x53')]=qs['sort'](_0x66ef14[_0xab90('0x4c')][_0xab90('0xbc')]);_0x1120a3[_0xab90('0x56')]=qs[_0xab90('0x55')](_['pick'](_0x66ef14[_0xab90('0x4c')],_0x1c487f[_0xab90('0x55')]));if(_0x66ef14[_0xab90('0x4c')]['filter']){_0x1120a3[_0xab90('0x56')]=_[_0xab90('0x57')](_0x1120a3[_0xab90('0x56')],{'$or':_[_0xab90('0x3e')](_0x1120a3['attributes'],function(_0x4f5dcc){var _0x59a57f={};_0x59a57f[_0x4f5dcc]={'$like':'%'+_0x66ef14['query'][_0xab90('0x3c')]+'%'};return _0x59a57f;})});}_0x1120a3=_[_0xab90('0x57')]({},_0x1120a3,_0x66ef14[_0xab90('0x5d')]);return _0xa30b0c[_0xab90('0xbd')](_0x1120a3);}})[_0xab90('0x36')](function(_0x2290fb){if(_0x2290fb){_0x233c29=_0x2290fb[_0xab90('0x50')];if(_0x66ef14['query'][_0xab90('0x51')](_0xab90('0x5f'))){_0x1120a3[_0xab90('0x60')]=[{'model':db[_0xab90('0xbe')],'as':'List','required':![]},{'model':db[_0xab90('0xbf')],'as':_0xab90('0xc0'),'attributes':['id',_0xab90('0x42'),_0xab90('0xc1')],'where':_0x66ef14['query'][_0xab90('0xc2')]?{'id':_0x66ef14['query']['tag']}:undefined,'required':_0x66ef14[_0xab90('0x4c')]['tag']?!![]:![]}];}if(!_0x66ef14[_0xab90('0x4c')][_0xab90('0x51')]('nolimit')){_0x1120a3[_0xab90('0x31')]=qs[_0xab90('0x31')](_0x66ef14[_0xab90('0x4c')][_0xab90('0x31')]);_0x1120a3[_0xab90('0x30')]=qs[_0xab90('0x30')](_0x66ef14[_0xab90('0x4c')]['offset']);}return _0xa30b0c[_0xab90('0xbd')](_0x1120a3);}})[_0xab90('0x36')](function(_0x3d083b){if(_0x3d083b){return _0x3d083b?{'count':_0x233c29,'rows':_0x3d083b}:null;}})[_0xab90('0x36')](respondWithResult(_0x400245,null))[_0xab90('0x2a')](handleError(_0x400245,null));};exports[_0xab90('0xc3')]=function(_0x5e8666,_0x36ecb5,_0x14f534){var _0x3054d5;var _0x231440;var _0x157c1f={};var _0x2d3af3;return db['User'][_0xab90('0x92')]({'where':{'id':_0x5e8666[_0xab90('0x67')]['id']},'attributes':['id',_0xab90('0x42'),_0xab90('0x40')]})[_0xab90('0x36')](handleEntityNotFound(_0x36ecb5,null))[_0xab90('0x36')](function(_0x7a642e){if(!utils['isValidChannel'](_0x5e8666['query'][_0xab90('0x9b')])){throw new db['Sequelize'][(_0xab90('0x1f'))](_0xab90('0xae'));}_0x3054d5=_0x7a642e;var _0x2ed1ac={};_0x2ed1ac[_0xab90('0x48')]=_[_0xab90('0x64')](db[_[_0xab90('0xa1')](_0x5e8666[_0xab90('0x4c')][_0xab90('0x9b')])+_0xab90('0xc4')][_0xab90('0x45')]);_0x2ed1ac[_0xab90('0x4c')]=_[_0xab90('0x64')](_0x5e8666[_0xab90('0x4c')]);_0x2ed1ac['filters']=_[_0xab90('0x4e')](_0x2ed1ac[_0xab90('0x48')],_0x2ed1ac[_0xab90('0x4c')]);_0x157c1f[_0xab90('0x4d')]=_[_0xab90('0x4e')](_0x2ed1ac[_0xab90('0x48')],qs[_0xab90('0x4f')](_0x5e8666['query'][_0xab90('0x4f')]));_0x157c1f[_0xab90('0x4d')]=_0x157c1f['attributes'][_0xab90('0x50')]?_0x157c1f['attributes']:_0x2ed1ac[_0xab90('0x48')];_0x157c1f[_0xab90('0x53')]=qs[_0xab90('0xbc')](_0x5e8666['query'][_0xab90('0xbc')]);_0x157c1f[_0xab90('0x56')]=qs[_0xab90('0x55')](_[_0xab90('0x54')](_0x5e8666[_0xab90('0x4c')],_0x2ed1ac[_0xab90('0x55')]));if(_0x5e8666[_0xab90('0x4c')]['filter']){_0x157c1f[_0xab90('0x56')]=_[_0xab90('0x57')](_0x157c1f[_0xab90('0x56')],{'$or':_[_0xab90('0x3e')](_0x157c1f['attributes'],function(_0x465beb){var _0x205a94={};_0x205a94[_0x465beb]={'$like':'%'+_0x5e8666[_0xab90('0x4c')][_0xab90('0x3c')]+'%'};return _0x205a94;})});}_0x157c1f=_[_0xab90('0x57')]({},_0x157c1f,_0x5e8666[_0xab90('0x5d')]);switch(_0x3054d5[_0xab90('0x40')]){case _0xab90('0x6e'):return db[_['capitalize'](_0x5e8666[_0xab90('0x4c')][_0xab90('0x9b')])+'Queue'][_0xab90('0x61')](_0x157c1f);case _0xab90('0x8b'):case _0xab90('0x3a'):return _0x3054d5[_0xab90('0x37')+_[_0xab90('0xa1')](_0x5e8666[_0xab90('0x4c')][_0xab90('0x9b')])+_0xab90('0xa2')](_0x157c1f);default:throw new db[(_0xab90('0x1e'))]['ValidationError'](_0xab90('0xc5'));}})[_0xab90('0x36')](function(_0x54e5c6){_0x2d3af3=_0x54e5c6[_0xab90('0x50')];if(!_0x5e8666['query'][_0xab90('0x51')](_0xab90('0x52'))){_0x157c1f[_0xab90('0x31')]=qs[_0xab90('0x31')](_0x5e8666[_0xab90('0x4c')][_0xab90('0x31')]);_0x157c1f[_0xab90('0x30')]=qs['offset'](_0x5e8666['query'][_0xab90('0x30')]);}switch(_0x3054d5[_0xab90('0x40')]){case'admin':return db[_[_0xab90('0xa1')](_0x5e8666[_0xab90('0x4c')]['channel'])+'Queue'][_0xab90('0x61')](_0x157c1f);case _0xab90('0x8b'):case _0xab90('0x3a'):return _0x3054d5['get'+_[_0xab90('0xa1')](_0x5e8666['query'][_0xab90('0x9b')])+'Queues'](_0x157c1f);}})['then'](function(_0x49ffbe){return{'count':_0x2d3af3,'rows':_0x49ffbe};})[_0xab90('0x36')](respondWithResult(_0x36ecb5,null))['catch'](handleError(_0x36ecb5,null));};exports[_0xab90('0xc6')]=function(_0x4acec0,_0x264d55,_0x447793){var _0x4db3a7={};var _0x10ab69={};var _0x414db7;var _0x15a8f3;return db[_0xab90('0x5e')][_0xab90('0x92')]({'where':{'id':_0x4acec0[_0xab90('0x67')]['id']}})[_0xab90('0x36')](handleEntityNotFound(_0x264d55,null))[_0xab90('0x36')](function(_0x951bce){if(_0x951bce){_0x414db7=_0x951bce;_0x10ab69[_0xab90('0x48')]=_['keys'](db[_0xab90('0xac')]['rawAttributes']);_0x10ab69[_0xab90('0x4c')]=_[_0xab90('0x64')](_0x4acec0[_0xab90('0x4c')]);_0x10ab69[_0xab90('0x55')]=_[_0xab90('0x4e')](_0x10ab69[_0xab90('0x48')],_0x10ab69['query']);_0x4db3a7[_0xab90('0x4d')]=_['intersection'](_0x10ab69[_0xab90('0x48')],qs[_0xab90('0x4f')](_0x4acec0[_0xab90('0x4c')]['fields']));_0x4db3a7['attributes']=_0x4db3a7['attributes'][_0xab90('0x50')]?_0x4db3a7[_0xab90('0x4d')]:_0x10ab69[_0xab90('0x48')];_0x4db3a7[_0xab90('0x53')]=qs[_0xab90('0xbc')](_0x4acec0[_0xab90('0x4c')][_0xab90('0xbc')]);_0x4db3a7[_0xab90('0x56')]=qs[_0xab90('0x55')](_[_0xab90('0x54')](_0x4acec0['query'],_0x10ab69[_0xab90('0x55')]));if(_0x4acec0[_0xab90('0x4c')][_0xab90('0x3c')]){_0x4db3a7['where']=_['merge'](_0x4db3a7['where'],{'$or':_['map'](_0x4db3a7[_0xab90('0x4d')],function(_0x4b3b25){var _0x34454e={};_0x34454e[_0x4b3b25]={'$like':'%'+_0x4acec0[_0xab90('0x4c')]['filter']+'%'};return _0x34454e;})});}_0x4db3a7=_['merge']({},_0x4db3a7,_0x4acec0[_0xab90('0x5d')]);return _0x414db7[_0xab90('0xc6')](_0x4db3a7);}})[_0xab90('0x36')](function(_0x173a5d){if(_0x173a5d){_0x15a8f3=_0x173a5d['length'];if(!_0x4acec0[_0xab90('0x4c')][_0xab90('0x51')](_0xab90('0x52'))){_0x4db3a7['limit']=qs[_0xab90('0x31')](_0x4acec0['query'][_0xab90('0x31')]);_0x4db3a7[_0xab90('0x30')]=qs[_0xab90('0x30')](_0x4acec0[_0xab90('0x4c')]['offset']);}return _0x414db7[_0xab90('0xc6')](_0x4db3a7);}})[_0xab90('0x36')](function(_0x5b7066){if(_0x5b7066){return _0x5b7066?{'count':_0x15a8f3,'rows':_0x5b7066}:null;}})['then'](respondWithResult(_0x264d55,null))[_0xab90('0x2a')](handleError(_0x264d55,null));};exports['getGroups']=function(_0x8bd8cc,_0x290031,_0x3ab5a7){var _0x278fe9={};var _0x428589={};var _0x1fecce;var _0x3034bf;return db['User']['findOne']({'where':{'id':_0x8bd8cc[_0xab90('0x67')]['id']}})[_0xab90('0x36')](handleEntityNotFound(_0x290031,null))['then'](function(_0x3d9852){if(_0x3d9852){_0x1fecce=_0x3d9852;_0x428589[_0xab90('0x48')]=_[_0xab90('0x64')](db['ChatGroup'][_0xab90('0x45')]);_0x428589[_0xab90('0x4c')]=_[_0xab90('0x64')](_0x8bd8cc[_0xab90('0x4c')]);_0x428589[_0xab90('0x55')]=_[_0xab90('0x4e')](_0x428589[_0xab90('0x48')],_0x428589[_0xab90('0x4c')]);_0x278fe9[_0xab90('0x4d')]=_['intersection'](_0x428589[_0xab90('0x48')],qs[_0xab90('0x4f')](_0x8bd8cc['query'][_0xab90('0x4f')]));_0x278fe9[_0xab90('0x4d')]=_0x278fe9[_0xab90('0x4d')][_0xab90('0x50')]?_0x278fe9[_0xab90('0x4d')]:_0x428589[_0xab90('0x48')];_0x278fe9[_0xab90('0x53')]=qs[_0xab90('0xbc')](_0x8bd8cc['query'][_0xab90('0xbc')]);_0x278fe9['where']=qs[_0xab90('0x55')](_[_0xab90('0x54')](_0x8bd8cc[_0xab90('0x4c')],_0x428589[_0xab90('0x55')]));if(_0x8bd8cc['query'][_0xab90('0x3c')]){_0x278fe9['where']=_[_0xab90('0x57')](_0x278fe9[_0xab90('0x56')],{'$or':_[_0xab90('0x3e')](_0x278fe9[_0xab90('0x4d')],function(_0x22b632){var _0x247a22={};_0x247a22[_0x22b632]={'$like':'%'+_0x8bd8cc[_0xab90('0x4c')][_0xab90('0x3c')]+'%'};return _0x247a22;})});}_0x278fe9=_[_0xab90('0x57')]({},_0x278fe9,_0x8bd8cc['options']);return _0x1fecce['getGroups'](_0x278fe9);}})[_0xab90('0x36')](function(_0x1e71c5){if(_0x1e71c5){_0x3034bf=_0x1e71c5[_0xab90('0x50')];if(!_0x8bd8cc['query'][_0xab90('0x51')]('nolimit')){_0x278fe9[_0xab90('0x31')]=qs[_0xab90('0x31')](_0x8bd8cc[_0xab90('0x4c')]['limit']);_0x278fe9[_0xab90('0x30')]=qs[_0xab90('0x30')](_0x8bd8cc[_0xab90('0x4c')][_0xab90('0x30')]);}return _0x1fecce['getGroups'](_0x278fe9);}})['then'](function(_0x26db77){if(_0x26db77){return _0x26db77?{'count':_0x3034bf,'rows':_0x26db77}:null;}})['then'](respondWithResult(_0x290031,null))[_0xab90('0x2a')](handleError(_0x290031,null));};exports[_0xab90('0xc7')]=function(_0x43b503,_0x5805c5,_0x31f746){var _0x2856ac={'raw':!![],'where':{}};var _0x47a003={};var _0x39538a={'count':0x0,'rows':[]};return db[_0xab90('0x5e')][_0xab90('0x92')]({'where':{'id':_0x43b503['params']['id']}})[_0xab90('0x36')](handleEntityNotFound(_0x5805c5,null))[_0xab90('0x36')](function(_0x25618a){if(_0x25618a){_0x47a003[_0xab90('0x48')]=_[_0xab90('0x64')](db[_0xab90('0xc8')][_0xab90('0x45')]);_0x47a003[_0xab90('0x4c')]=_[_0xab90('0x64')](_0x43b503[_0xab90('0x4c')]);_0x47a003[_0xab90('0x55')]=_[_0xab90('0x4e')](_0x47a003[_0xab90('0x48')],_0x47a003['query']);_0x2856ac[_0xab90('0x4d')]=_[_0xab90('0x4e')](_0x47a003['model'],qs[_0xab90('0x4f')](_0x43b503[_0xab90('0x4c')][_0xab90('0x4f')]));_0x2856ac[_0xab90('0x4d')]=_0x2856ac['attributes'][_0xab90('0x50')]?_0x2856ac['attributes']:_0x47a003[_0xab90('0x48')];if(!_0x43b503[_0xab90('0x4c')][_0xab90('0x51')](_0xab90('0x52'))){_0x2856ac[_0xab90('0x31')]=qs[_0xab90('0x31')](_0x43b503[_0xab90('0x4c')][_0xab90('0x31')]);_0x2856ac[_0xab90('0x30')]=qs[_0xab90('0x30')](_0x43b503[_0xab90('0x4c')]['offset']);}_0x2856ac[_0xab90('0x53')]=qs[_0xab90('0xbc')](_0x43b503['query']['sort']);_0x2856ac[_0xab90('0x56')]=qs[_0xab90('0x55')](_[_0xab90('0x54')](_0x43b503[_0xab90('0x4c')],_0x47a003[_0xab90('0x55')]));_0x2856ac[_0xab90('0x56')]['UserId']=_0x25618a['id'];if(_0x43b503[_0xab90('0x4c')][_0xab90('0x3c')]){_0x2856ac['where']=_[_0xab90('0x57')](_0x2856ac[_0xab90('0x56')],{'$or':_[_0xab90('0x3e')](_0x2856ac[_0xab90('0x4d')],function(_0x16d18e){var _0x4b5ab5={};_0x4b5ab5[_0x16d18e]={'$like':'%'+_0x43b503['query'][_0xab90('0x3c')]+'%'};return _0x4b5ab5;})});}_0x2856ac=_[_0xab90('0x57')]({},_0x2856ac,_0x43b503[_0xab90('0x5d')]);return db['VoiceRecording'][_0xab90('0x2f')]({'where':_0x2856ac[_0xab90('0x56')]})[_0xab90('0x36')](function(_0x3c59ad){_0x39538a[_0xab90('0x2f')]=_0x3c59ad;if(_0x43b503[_0xab90('0x4c')][_0xab90('0x5f')]){_0x2856ac['include']=[{'all':!![]}];}return db[_0xab90('0xc8')][_0xab90('0x61')](_0x2856ac);})['then'](function(_0x148058){_0x39538a[_0xab90('0x62')]=_0x148058;return _0x39538a;});}})[_0xab90('0x36')](respondWithFilteredResult(_0x5805c5,_0x2856ac))[_0xab90('0x2a')](handleError(_0x5805c5,null));};exports[_0xab90('0xc9')]=function(_0x53a165,_0x5c84ec,_0x42d08b){var _0x464409={'raw':!![],'where':{}};var _0x506dbf={};var _0x347889={'count':0x0,'rows':[]};return db[_0xab90('0x5e')]['findOne']({'where':{'id':_0x53a165['params']['id']}})[_0xab90('0x36')](handleEntityNotFound(_0x5c84ec,null))[_0xab90('0x36')](function(_0x388097){if(_0x388097){_0x506dbf[_0xab90('0x48')]=_['keys'](db['ScreenRecording'][_0xab90('0x45')]);_0x506dbf[_0xab90('0x4c')]=_[_0xab90('0x64')](_0x53a165[_0xab90('0x4c')]);_0x506dbf['filters']=_[_0xab90('0x4e')](_0x506dbf[_0xab90('0x48')],_0x506dbf[_0xab90('0x4c')]);_0x464409[_0xab90('0x4d')]=_[_0xab90('0x4e')](_0x506dbf['model'],qs[_0xab90('0x4f')](_0x53a165[_0xab90('0x4c')][_0xab90('0x4f')]));_0x464409['attributes']=_0x464409[_0xab90('0x4d')][_0xab90('0x50')]?_0x464409[_0xab90('0x4d')]:_0x506dbf[_0xab90('0x48')];if(!_0x53a165[_0xab90('0x4c')][_0xab90('0x51')](_0xab90('0x52'))){_0x464409['limit']=qs[_0xab90('0x31')](_0x53a165[_0xab90('0x4c')][_0xab90('0x31')]);_0x464409[_0xab90('0x30')]=qs[_0xab90('0x30')](_0x53a165['query'][_0xab90('0x30')]);}_0x464409[_0xab90('0x53')]=qs[_0xab90('0xbc')](_0x53a165['query'][_0xab90('0xbc')]);_0x464409[_0xab90('0x56')]=qs[_0xab90('0x55')](_[_0xab90('0x54')](_0x53a165[_0xab90('0x4c')],_0x506dbf['filters']));_0x464409[_0xab90('0x56')][_0xab90('0xca')]=_0x388097['id'];if(_0x53a165['query'][_0xab90('0x3c')]){_0x464409[_0xab90('0x56')]=_[_0xab90('0x57')](_0x464409[_0xab90('0x56')],{'$or':_[_0xab90('0x3e')](_0x464409[_0xab90('0x4d')],function(_0x3ae9f4){var _0x4fe9a5={};_0x4fe9a5[_0x3ae9f4]={'$like':'%'+_0x53a165['query'][_0xab90('0x3c')]+'%'};return _0x4fe9a5;})});}_0x464409=_[_0xab90('0x57')]({},_0x464409,_0x53a165['options']);return db[_0xab90('0xcb')][_0xab90('0x2f')]({'where':_0x464409['where']})['then'](function(_0x3627bc){_0x347889[_0xab90('0x2f')]=_0x3627bc;if(_0x53a165[_0xab90('0x4c')]['includeAll']){_0x464409[_0xab90('0x60')]=[{'all':!![]}];}return db[_0xab90('0xcb')]['findAll'](_0x464409);})['then'](function(_0x5e3d24){_0x347889['rows']=_0x5e3d24;return _0x347889;});}})[_0xab90('0x36')](respondWithFilteredResult(_0x5c84ec,_0x464409))[_0xab90('0x2a')](handleError(_0x5c84ec,null));};exports[_0xab90('0xcc')]=function(_0x456ef0,_0x3fdf2f,_0x47f963){var _0x49411f={};var _0x182fc1={};var _0x31bf5e;var _0x5d8b1c;return db[_0xab90('0x5e')][_0xab90('0x92')]({'where':{'id':_0x456ef0[_0xab90('0x67')]['id']}})[_0xab90('0x36')](handleEntityNotFound(_0x3fdf2f,null))[_0xab90('0x36')](function(_0x1b18b5){if(_0x1b18b5){_0x31bf5e=_0x1b18b5;_0x182fc1[_0xab90('0x48')]=_['keys'](db[_0xab90('0xcd')][_0xab90('0x45')]);_0x182fc1['query']=_[_0xab90('0x64')](_0x456ef0[_0xab90('0x4c')]);_0x182fc1[_0xab90('0x55')]=_[_0xab90('0x4e')](_0x182fc1[_0xab90('0x48')],_0x182fc1['query']);_0x49411f['attributes']=_[_0xab90('0x4e')](_0x182fc1[_0xab90('0x48')],qs[_0xab90('0x4f')](_0x456ef0['query'][_0xab90('0x4f')]));_0x49411f[_0xab90('0x4d')]=_0x49411f[_0xab90('0x4d')][_0xab90('0x50')]?_0x49411f[_0xab90('0x4d')]:_0x182fc1[_0xab90('0x48')];_0x49411f['order']=qs[_0xab90('0xbc')](_0x456ef0[_0xab90('0x4c')]['sort']);_0x49411f[_0xab90('0x56')]=qs[_0xab90('0x55')](_[_0xab90('0x54')](_0x456ef0[_0xab90('0x4c')],_0x182fc1[_0xab90('0x55')]));if(_0x456ef0[_0xab90('0x4c')][_0xab90('0x3c')]){_0x49411f[_0xab90('0x56')]=_['merge'](_0x49411f[_0xab90('0x56')],{'$or':_[_0xab90('0x3e')](_0x49411f[_0xab90('0x4d')],function(_0x5944fd){var _0x4c2a58={};_0x4c2a58[_0x5944fd]={'$like':'%'+_0x456ef0[_0xab90('0x4c')][_0xab90('0x3c')]+'%'};return _0x4c2a58;})});}_0x49411f=_[_0xab90('0x57')]({},_0x49411f,_0x456ef0[_0xab90('0x5d')]);return _0x31bf5e[_0xab90('0xcc')](_0x49411f);}})['then'](function(_0x299e5b){if(_0x299e5b){_0x5d8b1c=_0x299e5b[_0xab90('0x50')];if(!_0x456ef0[_0xab90('0x4c')]['hasOwnProperty'](_0xab90('0x52'))){_0x49411f[_0xab90('0x31')]=qs['limit'](_0x456ef0['query'][_0xab90('0x31')]);_0x49411f['offset']=qs[_0xab90('0x30')](_0x456ef0['query'][_0xab90('0x30')]);}return _0x31bf5e[_0xab90('0xcc')](_0x49411f);}})['then'](function(_0x218545){if(_0x218545){return _0x218545?{'count':_0x5d8b1c,'rows':_0x218545}:null;}})[_0xab90('0x36')](respondWithResult(_0x3fdf2f,null))['catch'](handleError(_0x3fdf2f,null));};exports['getOpenchannelInteractions']=function(_0x17b45b,_0x188848,_0xb769d0){var _0x5eb91b={};var _0x449d45={};var _0x35f1b9;var _0x30ce55;return db[_0xab90('0x5e')][_0xab90('0x92')]({'where':{'id':_0x17b45b[_0xab90('0x67')]['id']}})[_0xab90('0x36')](handleEntityNotFound(_0x188848,null))[_0xab90('0x36')](function(_0x528df9){if(_0x528df9){_0x35f1b9=_0x528df9;_0x449d45['model']=_[_0xab90('0x64')](db['OpenchannelInteraction'][_0xab90('0x45')]);_0x449d45[_0xab90('0x4c')]=_[_0xab90('0x64')](_0x17b45b[_0xab90('0x4c')]);_0x449d45['filters']=_[_0xab90('0x4e')](_0x449d45[_0xab90('0x48')],_0x449d45[_0xab90('0x4c')]);_0x5eb91b[_0xab90('0x4d')]=_[_0xab90('0x4e')](_0x449d45[_0xab90('0x48')],qs[_0xab90('0x4f')](_0x17b45b[_0xab90('0x4c')][_0xab90('0x4f')]));_0x5eb91b['attributes']=_0x5eb91b[_0xab90('0x4d')]['length']?_0x5eb91b[_0xab90('0x4d')]:_0x449d45['model'];_0x5eb91b[_0xab90('0x53')]=qs[_0xab90('0xbc')](_0x17b45b[_0xab90('0x4c')][_0xab90('0xbc')]);_0x5eb91b['where']=qs[_0xab90('0x55')](_[_0xab90('0x54')](_0x17b45b[_0xab90('0x4c')],_0x449d45[_0xab90('0x55')]));if(_0x17b45b[_0xab90('0x4c')][_0xab90('0x3c')]){_0x5eb91b['where']=_[_0xab90('0x57')](_0x5eb91b[_0xab90('0x56')],{'$or':_[_0xab90('0x3e')](_0x5eb91b[_0xab90('0x4d')],function(_0x8d15ef){var _0x3dfbd4={};_0x3dfbd4[_0x8d15ef]={'$like':'%'+_0x17b45b[_0xab90('0x4c')][_0xab90('0x3c')]+'%'};return _0x3dfbd4;})});}_0x5eb91b=_[_0xab90('0x57')]({},_0x5eb91b,_0x17b45b[_0xab90('0x5d')]);return _0x35f1b9[_0xab90('0xce')](_0x5eb91b);}})[_0xab90('0x36')](function(_0x448995){if(_0x448995){_0x30ce55=_0x448995[_0xab90('0x50')];if(!_0x17b45b[_0xab90('0x4c')]['hasOwnProperty'](_0xab90('0x52'))){_0x5eb91b['limit']=qs[_0xab90('0x31')](_0x17b45b[_0xab90('0x4c')][_0xab90('0x31')]);_0x5eb91b[_0xab90('0x30')]=qs[_0xab90('0x30')](_0x17b45b[_0xab90('0x4c')][_0xab90('0x30')]);}return _0x35f1b9[_0xab90('0xce')](_0x5eb91b);}})[_0xab90('0x36')](function(_0x2dcb76){if(_0x2dcb76){return _0x2dcb76?{'count':_0x30ce55,'rows':_0x2dcb76}:null;}})[_0xab90('0x36')](respondWithResult(_0x188848,null))[_0xab90('0x2a')](handleError(_0x188848,null));};exports[_0xab90('0xcf')]=function(_0x149317,_0x2008b0,_0x2d474d){var _0x2a1faa={'raw':!![],'where':{}};var _0x2e5e1d={};var _0x388c7a={'count':0x0,'rows':[]};return db[_0xab90('0x5e')]['findOne']({'where':{'id':_0x149317[_0xab90('0x67')]['id']}})[_0xab90('0x36')](handleEntityNotFound(_0x2008b0,null))[_0xab90('0x36')](function(_0x96a625){if(_0x96a625){_0x2e5e1d[_0xab90('0x48')]=_[_0xab90('0x64')](db['MailInteraction'][_0xab90('0x45')]);_0x2e5e1d[_0xab90('0x4c')]=_[_0xab90('0x64')](_0x149317[_0xab90('0x4c')]);_0x2e5e1d['filters']=_['intersection'](_0x2e5e1d[_0xab90('0x48')],_0x2e5e1d[_0xab90('0x4c')]);_0x2a1faa[_0xab90('0x4d')]=_[_0xab90('0x4e')](_0x2e5e1d[_0xab90('0x48')],qs[_0xab90('0x4f')](_0x149317['query']['fields']));_0x2a1faa['attributes']=_0x2a1faa['attributes'][_0xab90('0x50')]?_0x2a1faa[_0xab90('0x4d')]:_0x2e5e1d[_0xab90('0x48')];if(!_0x149317[_0xab90('0x4c')][_0xab90('0x51')](_0xab90('0x52'))){_0x2a1faa[_0xab90('0x31')]=qs[_0xab90('0x31')](_0x149317[_0xab90('0x4c')][_0xab90('0x31')]);_0x2a1faa[_0xab90('0x30')]=qs[_0xab90('0x30')](_0x149317[_0xab90('0x4c')][_0xab90('0x30')]);}_0x2a1faa[_0xab90('0x53')]=qs[_0xab90('0xbc')](_0x149317[_0xab90('0x4c')][_0xab90('0xbc')]);_0x2a1faa[_0xab90('0x56')]=qs['filters'](_[_0xab90('0x54')](_0x149317[_0xab90('0x4c')],_0x2e5e1d[_0xab90('0x55')]));_0x2a1faa['where'][_0xab90('0xca')]=_0x96a625['id'];if(_0x149317['query'][_0xab90('0x3c')]){_0x2a1faa[_0xab90('0x56')]=_[_0xab90('0x57')](_0x2a1faa[_0xab90('0x56')],{'$or':_[_0xab90('0x3e')](_0x2a1faa['attributes'],function(_0x121f7b){var _0x15b12e={};_0x15b12e[_0x121f7b]={'$like':'%'+_0x149317[_0xab90('0x4c')]['filter']+'%'};return _0x15b12e;})});}_0x2a1faa=_[_0xab90('0x57')]({},_0x2a1faa,_0x149317[_0xab90('0x5d')]);return db[_0xab90('0xd0')][_0xab90('0x2f')]({'where':_0x2a1faa[_0xab90('0x56')]})['then'](function(_0x137ccc){_0x388c7a['count']=_0x137ccc;if(_0x149317[_0xab90('0x4c')][_0xab90('0x5f')]){_0x2a1faa[_0xab90('0x60')]=[{'all':!![]}];}return db[_0xab90('0xd0')]['findAll'](_0x2a1faa);})['then'](function(_0x501e56){_0x388c7a['rows']=_0x501e56;return _0x388c7a;});}})[_0xab90('0x36')](respondWithFilteredResult(_0x2008b0,_0x2a1faa))[_0xab90('0x2a')](handleError(_0x2008b0,null));};exports['getSmsInteractions']=function(_0x2f3017,_0xa311c3,_0x55d721){var _0x347bd2={};var _0x3b1336={};var _0x1d010b;var _0x4e475c;return db[_0xab90('0x5e')][_0xab90('0x92')]({'where':{'id':_0x2f3017[_0xab90('0x67')]['id']}})[_0xab90('0x36')](handleEntityNotFound(_0xa311c3,null))[_0xab90('0x36')](function(_0x561d4e){if(_0x561d4e){_0x1d010b=_0x561d4e;_0x3b1336[_0xab90('0x48')]=_['keys'](db[_0xab90('0xd1')][_0xab90('0x45')]);_0x3b1336[_0xab90('0x4c')]=_['keys'](_0x2f3017[_0xab90('0x4c')]);_0x3b1336[_0xab90('0x55')]=_[_0xab90('0x4e')](_0x3b1336[_0xab90('0x48')],_0x3b1336['query']);_0x347bd2[_0xab90('0x4d')]=_[_0xab90('0x4e')](_0x3b1336[_0xab90('0x48')],qs['fields'](_0x2f3017['query'][_0xab90('0x4f')]));_0x347bd2[_0xab90('0x4d')]=_0x347bd2[_0xab90('0x4d')][_0xab90('0x50')]?_0x347bd2[_0xab90('0x4d')]:_0x3b1336[_0xab90('0x48')];_0x347bd2[_0xab90('0x53')]=qs[_0xab90('0xbc')](_0x2f3017[_0xab90('0x4c')][_0xab90('0xbc')]);_0x347bd2['where']=qs[_0xab90('0x55')](_[_0xab90('0x54')](_0x2f3017['query'],_0x3b1336['filters']));if(_0x2f3017[_0xab90('0x4c')][_0xab90('0x3c')]){_0x347bd2[_0xab90('0x56')]=_[_0xab90('0x57')](_0x347bd2[_0xab90('0x56')],{'$or':_[_0xab90('0x3e')](_0x347bd2[_0xab90('0x4d')],function(_0x180203){var _0x2bb960={};_0x2bb960[_0x180203]={'$like':'%'+_0x2f3017[_0xab90('0x4c')][_0xab90('0x3c')]+'%'};return _0x2bb960;})});}_0x347bd2=_[_0xab90('0x57')]({},_0x347bd2,_0x2f3017['options']);return _0x1d010b[_0xab90('0xd2')](_0x347bd2);}})[_0xab90('0x36')](function(_0xb5acee){if(_0xb5acee){_0x4e475c=_0xb5acee[_0xab90('0x50')];if(!_0x2f3017[_0xab90('0x4c')][_0xab90('0x51')](_0xab90('0x52'))){_0x347bd2['limit']=qs[_0xab90('0x31')](_0x2f3017['query'][_0xab90('0x31')]);_0x347bd2['offset']=qs[_0xab90('0x30')](_0x2f3017[_0xab90('0x4c')][_0xab90('0x30')]);}return _0x1d010b['getSmsInteractions'](_0x347bd2);}})[_0xab90('0x36')](function(_0x3cde16){if(_0x3cde16){return _0x3cde16?{'count':_0x4e475c,'rows':_0x3cde16}:null;}})['then'](respondWithResult(_0xa311c3,null))[_0xab90('0x2a')](handleError(_0xa311c3,null));};exports[_0xab90('0xd3')]=function(_0x1e5a22,_0x263046,_0x4d883a){var _0x583cfb={};var _0x32f5e5={};var _0x534b9d;var _0x1d86a6;return db['User']['findOne']({'where':{'id':_0x1e5a22['params']['id']}})['then'](handleEntityNotFound(_0x263046,null))[_0xab90('0x36')](function(_0x4733e9){if(_0x4733e9){_0x534b9d=_0x4733e9;_0x32f5e5[_0xab90('0x48')]=_[_0xab90('0x64')](db['FaxInteraction']['rawAttributes']);_0x32f5e5[_0xab90('0x4c')]=_[_0xab90('0x64')](_0x1e5a22[_0xab90('0x4c')]);_0x32f5e5['filters']=_[_0xab90('0x4e')](_0x32f5e5[_0xab90('0x48')],_0x32f5e5[_0xab90('0x4c')]);_0x583cfb[_0xab90('0x4d')]=_['intersection'](_0x32f5e5['model'],qs['fields'](_0x1e5a22[_0xab90('0x4c')][_0xab90('0x4f')]));_0x583cfb[_0xab90('0x4d')]=_0x583cfb[_0xab90('0x4d')][_0xab90('0x50')]?_0x583cfb[_0xab90('0x4d')]:_0x32f5e5['model'];_0x583cfb['order']=qs[_0xab90('0xbc')](_0x1e5a22[_0xab90('0x4c')][_0xab90('0xbc')]);_0x583cfb[_0xab90('0x56')]=qs[_0xab90('0x55')](_['pick'](_0x1e5a22[_0xab90('0x4c')],_0x32f5e5[_0xab90('0x55')]));if(_0x1e5a22[_0xab90('0x4c')][_0xab90('0x3c')]){_0x583cfb[_0xab90('0x56')]=_[_0xab90('0x57')](_0x583cfb[_0xab90('0x56')],{'$or':_[_0xab90('0x3e')](_0x583cfb['attributes'],function(_0x7cefc3){var _0x4c88fd={};_0x4c88fd[_0x7cefc3]={'$like':'%'+_0x1e5a22['query'][_0xab90('0x3c')]+'%'};return _0x4c88fd;})});}_0x583cfb=_[_0xab90('0x57')]({},_0x583cfb,_0x1e5a22[_0xab90('0x5d')]);return _0x534b9d[_0xab90('0xd3')](_0x583cfb);}})[_0xab90('0x36')](function(_0x51afec){if(_0x51afec){_0x1d86a6=_0x51afec[_0xab90('0x50')];if(!_0x1e5a22['query'][_0xab90('0x51')](_0xab90('0x52'))){_0x583cfb[_0xab90('0x31')]=qs[_0xab90('0x31')](_0x1e5a22[_0xab90('0x4c')][_0xab90('0x31')]);_0x583cfb[_0xab90('0x30')]=qs[_0xab90('0x30')](_0x1e5a22[_0xab90('0x4c')][_0xab90('0x30')]);}return _0x534b9d[_0xab90('0xd3')](_0x583cfb);}})[_0xab90('0x36')](function(_0x19bc89){if(_0x19bc89){return _0x19bc89?{'count':_0x1d86a6,'rows':_0x19bc89}:null;}})[_0xab90('0x36')](respondWithResult(_0x263046,null))['catch'](handleError(_0x263046,null));};exports[_0xab90('0xd4')]=function(_0x47d0c1,_0x52839b,_0x2a7f2d){var _0x471faf;var _0x595378;var _0x4e9d54;var _0x54cda9=!_[_0xab90('0x72')](_0x47d0c1[_0xab90('0x67')]['id'])?_0x47d0c1[_0xab90('0x67')]['id']:!_[_0xab90('0x72')](_0x47d0c1[_0xab90('0x8b')]['id'])?_0x47d0c1[_0xab90('0x8b')]['id']:null;return db['User'][_0xab90('0x41')]({'where':{'id':_0x54cda9,'role':{'$or':[_0xab90('0x6e'),_0xab90('0x8b'),_0xab90('0x3a')]}},'attributes':['id',_0xab90('0x42'),_0xab90('0xd5'),_0xab90('0xd6'),'role',_0xab90('0x75'),_0xab90('0xd7')]})[_0xab90('0x36')](function(_0x25900a){if(_0x25900a){if(_0x25900a[_0xab90('0x40')]===_0xab90('0x3a')){_0x471faf=_0x25900a;if(_0x47d0c1[_0xab90('0x66')]['interface']){_0x4e9d54=util[_0xab90('0xd8')](_0xab90('0xd9'),_0x471faf[_0x47d0c1[_0xab90('0x66')][_0xab90('0x9e')]]);}else if(_0x47d0c1[_0xab90('0x66')]['intrf']){_0x4e9d54=util[_0xab90('0xd8')](_0xab90('0xda'),_0x47d0c1['body'][_0xab90('0xdb')]);}else{_0x4e9d54=util['format'](_0xab90('0xda'),_0x471faf[_0xab90('0x42')]);}socket['to'](util[_0xab90('0xd8')]('user:%s',_0x471faf[_0xab90('0x42')]))[_0xab90('0xa5')](_0xab90('0xdc'),{'ip':_0x47d0c1[_0xab90('0xdd')][_0xab90('0xde')]||_0x47d0c1[_0xab90('0xdf')][_0xab90('0xe0')]||_0x47d0c1[_0xab90('0xe1')][_0xab90('0xe0')]||_0x47d0c1[_0xab90('0xdf')][_0xab90('0xe1')][_0xab90('0xe0')]});return db[_0xab90('0xac')][_0xab90('0x43')]({'where':{'membername':_0x471faf[_0xab90('0x42')]},'individualHooks':!![]});}}else{throw new db[(_0xab90('0x1e'))][(_0xab90('0x1f'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0xab90('0x36')](function(){if(_0x471faf){return _0x471faf[_0xab90('0xe2')]({'raw':!![]});}})[_0xab90('0x36')](function(_0x19986b){if(_0x471faf){var _0x5ee9d3=[];if(_0x19986b){_0x595378=_0x19986b;if(_0x595378[_0xab90('0x50')]){for(var _0x4db1c4=0x0;_0x4db1c4<_0x595378[_0xab90('0x50')];_0x4db1c4++){_0x5ee9d3[_0xab90('0xa9')]({'membername':_0x471faf[_0xab90('0x42')],'UserId':_0x471faf['id'],'queue_name':_0x595378[_0x4db1c4][_0xab90('0x42')],'VoiceQueueId':_0x595378[_0x4db1c4]['id'],'interface':_0x4e9d54,'paused':_0x471faf['loginInPause']||![],'penalty':_0x595378[_0x4db1c4][_0xab90('0xe3')]||0x0});}return BPromise[_0xab90('0xab')](_0x5ee9d3,function(_0x5e6f57){return db['UserVoiceQueueRt']['upsert'](_0x5e6f57);});}}}})['then'](function(){if(_0x471faf){return db[_0xab90('0xe4')][_0xab90('0x61')]({'where':{'membername':_0x471faf[_0xab90('0x42')],'exitAt':null}});}})[_0xab90('0x36')](function(_0x5409ae){if(_0x471faf){var _0xa1b98e=[];_0x5409ae[_0xab90('0xe5')](function(_0x1b1b27){_0xa1b98e[_0xab90('0xa9')](_0x1b1b27[_0xab90('0x35')]({'exitAt':moment()[_0xab90('0xd8')](_0xab90('0xe6'))}));});return BPromise[_0xab90('0xe7')](_0xa1b98e);}})['then'](function(){if(_0x471faf){var _0xc5cb3f=[];var _0x5428ca=[];var _0x18dcbf=utils[_0xab90('0xe8')]();var _0x5c8bdb={'membername':_0x471faf[_0xab90('0x42')],'interface':_0x4e9d54,'enterAt':moment()[_0xab90('0xd8')](_0xab90('0xe6')),'role':_0x471faf[_0xab90('0x40')],'internal':_0x471faf[_0xab90('0x75')]};_0x18dcbf[_0xab90('0xe5')](function(_0x2b016b){_0xc5cb3f[_0xab90('0xa9')](_['merge']({'channel':_0x2b016b,'type':_0xab90('0xe9'),'data1':_0x47d0c1[_0xab90('0x66')]['device'],'data2':_0x4e9d54},_0x5c8bdb));if(_0x471faf[_0xab90('0xd7')]){_0x5428ca[_0xab90('0xa9')](_['merge']({'channel':_0x2b016b,'type':'PAUSE','data1':'LOGININPAUSE'},_0x5c8bdb));}});return db['MemberReport'][_0xab90('0x65')](_0xc5cb3f['concat'](_0x5428ca),{'individualHooks':!![]});}})[_0xab90('0x36')](function(){if(_0x471faf){return _0x471faf[_0xab90('0x35')]({'online':!![],'lastLoginAt':moment()[_0xab90('0xd8')](_0xab90('0xe6')),'voicePause':_0x471faf[_0xab90('0xd7')]||![],'mailPause':_0x471faf[_0xab90('0xd7')]||![],'chatPause':_0x471faf['loginInPause']||![],'faxPause':_0x471faf['loginInPause']||![],'smsPause':_0x471faf[_0xab90('0xd7')]||![],'openchannelPause':_0x471faf['loginInPause']||![],'pauseType':_0x471faf[_0xab90('0xd7')]?_0xab90('0xea'):null,'interface':_0x4e9d54,'lastPauseAt':moment()[_0xab90('0xd8')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xab90('0x36')](function(_0xe07e30){if(_0x47d0c1[_0xab90('0xeb')]){return _0x2a7f2d();}else{return BPromise[_0xab90('0xec')](_0xe07e30)[_0xab90('0x36')](respondWithResult(_0x52839b,null));}})[_0xab90('0x2a')](handleError(_0x52839b,null));};exports[_0xab90('0xed')]=function(_0x35e6c7,_0x578f99,_0x2dfbc6){var _0x854f4d;return db['User']['find']({'where':{'id':_0x35e6c7[_0xab90('0x67')]['id'],'role':_0xab90('0x3a')},'attributes':['id',_0xab90('0x42'),_0xab90('0x40')]})[_0xab90('0x36')](handleEntityNotFound(_0x578f99,null))[_0xab90('0x36')](function(_0x4e6e03){if(_0x4e6e03){_0x854f4d=_0x4e6e03;return db[_0xab90('0xac')][_0xab90('0x43')]({'where':{'membername':_0x854f4d[_0xab90('0x42')]},'individualHooks':!![]});}})['then'](function(){return db[_0xab90('0xe4')][_0xab90('0x61')]({'where':{'membername':_0x854f4d['name'],'exitAt':null}});})[_0xab90('0x36')](function(_0x481236){var _0x13d714=[];_0x481236[_0xab90('0xe5')](function(_0x15a28c){_0x13d714[_0xab90('0xa9')](_0x15a28c[_0xab90('0x35')]({'exitAt':moment()[_0xab90('0xd8')](_0xab90('0xe6'))}));});return BPromise['all'](_0x13d714);})[_0xab90('0x36')](function(){return _0x854f4d[_0xab90('0x35')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'interface':null});})[_0xab90('0x36')](respondWithResult(_0x578f99,null))[_0xab90('0x2a')](handleError(_0x578f99,null));};exports[_0xab90('0xee')]=function(_0x67a985,_0x125bf6,_0x487e56){var _0x1e19bc;return db['UserVoiceQueueRt']['update']({'paused':0x1},{'where':{'UserId':_0x67a985['params']['id']},'individualHooks':!![]})['then'](function(){return db[_0xab90('0x5e')][_0xab90('0x41')]({'where':{'id':_0x67a985[_0xab90('0x67')]['id'],'role':'agent'},'attributes':['id',_0xab90('0x42'),_0xab90('0x40'),_0xab90('0x75'),_0xab90('0x9e')]});})[_0xab90('0x36')](handleEntityNotFound(_0x125bf6,null))[_0xab90('0x36')](function(_0x3519ff){if(_0x3519ff){_0x1e19bc=_0x3519ff;return respondWithRpcPromise(_0xab90('0xef'),_0xab90('0xee'),{'id':_0x1e19bc['id'],'name':_0x1e19bc[_0xab90('0x42')],'pause':!![]});}})[_0xab90('0x36')](function(){if(_0x1e19bc){return db['MemberReport'][_0xab90('0x61')]({'where':{'membername':_0x1e19bc[_0xab90('0x42')],'type':_0xab90('0xf0'),'exitAt':null}});}})[_0xab90('0x36')](function(_0x2235c4){if(_0x2235c4[_0xab90('0x50')]){var _0xbfc981=moment()[_0xab90('0xd8')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x1d9e0d=0x0,_0x1e14c5=_0x2235c4['length'];_0x1d9e0d<_0x1e14c5;_0x1d9e0d++){_0x2235c4[_0x1d9e0d][_0xab90('0xf1')]({'exitAt':_0xbfc981});}}})['then'](function(){var _0x563ce4=[];var _0x1b00a8=utils['getChannels']();_0x1b00a8[_0xab90('0xe5')](function(_0x11cf16){_0x563ce4['push']({'channel':_0x11cf16,'membername':_0x1e19bc['name'],'interface':_['isNil'](_0x1e19bc[_0xab90('0x9e')])?util[_0xab90('0xd8')](_0xab90('0xda'),_0x1e19bc['name']):_0x1e19bc[_0xab90('0x9e')],'type':_0xab90('0xf0'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x67a985[_0xab90('0x66')][_0xab90('0x58')]||'DEFAULT\x20PAUSE','role':_0x1e19bc['role'],'internal':_0x1e19bc[_0xab90('0x75')]});});return db[_0xab90('0xe4')][_0xab90('0x65')](_0x563ce4,{'individualHooks':!![]});})[_0xab90('0x36')](function(){return _0x1e19bc[_0xab90('0x35')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x67a985[_0xab90('0x66')]['type']||'DEFAULT\x20PAUSE','lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0xab90('0x36')](respondWithResult(_0x125bf6,null))[_0xab90('0x2a')](handleError(_0x125bf6,null));};exports[_0xab90('0xf2')]=function(_0x3857eb,_0x4365d2,_0x1fde70){var _0x11e4d5;return db[_0xab90('0x5e')]['find']({'where':{'id':_0x3857eb[_0xab90('0x67')]['id']},'attributes':['id','name','role','voicePause',_0xab90('0xf3'),_0xab90('0xf4'),_0xab90('0xf5'),_0xab90('0xf6'),_0xab90('0xf7'),_0xab90('0xf8'),_0xab90('0xf9')]})['then'](handleEntityNotFound(_0x4365d2,null))['then'](function(_0x51293b){if(_0x51293b){_0x11e4d5=_0x51293b;if(_0x3857eb[_0xab90('0x66')]['channel']&&!utils[_0xab90('0x9f')](_0x3857eb['body']['channel'])){throw new db[(_0xab90('0x1e'))][(_0xab90('0x1f'))](_0xab90('0xae'));}switch(_0x3857eb[_0xab90('0x66')][_0xab90('0x9b')]){case _0xab90('0xa7'):return respondWithRpcPromise(_0xab90('0xef'),_0xab90('0xf2'),{'id':_0x11e4d5['id'],'name':_0x11e4d5[_0xab90('0x42')],'pause':![]})['then'](function(){return db[_0xab90('0xac')][_0xab90('0x35')]({'paused':0x0},{'where':{'UserId':_0x11e4d5['id']},'individualHooks':!![]});})[_0xab90('0x36')](function(){return db[_0xab90('0xe4')][_0xab90('0x41')]({'where':{'channel':_0x3857eb[_0xab90('0x66')][_0xab90('0x9b')],'membername':_0x11e4d5['name'],'type':_0xab90('0xf0'),'exitAt':null}});})[_0xab90('0x36')](function(_0x4d32c3){if(_0x4d32c3){return _0x4d32c3[_0xab90('0x35')]({'exitAt':moment()[_0xab90('0xd8')](_0xab90('0xe6')),'data2':_0xab90('0xfa')},{'individualHooks':!![]});}return null;})[_0xab90('0x36')](function(){return _0x11e4d5[_0xab90('0x35')]({'voicePause':![]});});case _0xab90('0xfb'):case _0xab90('0xfc'):case _0xab90('0xfd'):case _0xab90('0xfe'):case'openchannel':return db[_0xab90('0xe4')][_0xab90('0x41')]({'where':{'channel':_0x3857eb[_0xab90('0x66')]['channel'],'membername':_0x11e4d5[_0xab90('0x42')],'type':_0xab90('0xf0'),'exitAt':null}})[_0xab90('0x36')](function(_0x4a829d){if(_0x4a829d){return _0x4a829d['update']({'exitAt':moment()[_0xab90('0xd8')](_0xab90('0xe6')),'data2':_0xab90('0xfa')},{'individualHooks':!![]});}return null;})[_0xab90('0x36')](function(){var _0x2ff207={};_[_0xab90('0x32')](_0x2ff207,util[_0xab90('0xd8')]('%s%s',_0x3857eb[_0xab90('0x66')]['channel'],_0xab90('0xff')),![]);return _0x11e4d5['update'](_0x2ff207);});default:return respondWithRpcPromise('QueuePause',_0xab90('0xf2'),{'id':_0x11e4d5['id'],'name':_0x11e4d5[_0xab90('0x42')],'pause':![]})[_0xab90('0x36')](function(){return db['UserVoiceQueueRt']['update']({'paused':0x0},{'where':{'UserId':_0x11e4d5['id']}});})[_0xab90('0x36')](function(){return db[_0xab90('0xe4')][_0xab90('0x61')]({'where':{'membername':_0x11e4d5['name'],'type':'PAUSE','exitAt':null}});})[_0xab90('0x36')](function(_0x28e5f4){var _0x9ad82e=[];_0x28e5f4[_0xab90('0xe5')](function(_0x28cca8){_0x9ad82e[_0xab90('0xa9')](_0x28cca8[_0xab90('0x35')]({'exitAt':moment()[_0xab90('0xd8')](_0xab90('0xe6')),'data2':'manual'}));});return BPromise[_0xab90('0xe7')](_0x9ad82e);})[_0xab90('0x36')](function(){return _0x11e4d5['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0x4365d2,null))['catch'](handleError(_0x4365d2,null));};exports[_0xab90('0x100')]=function(_0x1cc744,_0x5e641f,_0x295e61){var _0x380085={};var _0x277bfa={};var _0x5f1d4a;var _0x2cebfc;return db[_0xab90('0x5e')][_0xab90('0x92')]({'where':{'id':_0x1cc744['params']['id']}})[_0xab90('0x36')](handleEntityNotFound(_0x5e641f,null))[_0xab90('0x36')](function(_0x7933f8){if(_0x7933f8){_0x5f1d4a=_0x7933f8;_0x277bfa['model']=_[_0xab90('0x64')](db[_0xab90('0x101')][_0xab90('0x45')]);_0x277bfa[_0xab90('0x4c')]=_['keys'](_0x1cc744['query']);_0x277bfa[_0xab90('0x55')]=_[_0xab90('0x4e')](_0x277bfa[_0xab90('0x48')],_0x277bfa[_0xab90('0x4c')]);_0x380085[_0xab90('0x4d')]=_[_0xab90('0x4e')](_0x277bfa[_0xab90('0x48')],qs[_0xab90('0x4f')](_0x1cc744[_0xab90('0x4c')][_0xab90('0x4f')]));_0x380085['attributes']=_0x380085['attributes'][_0xab90('0x50')]?_0x380085[_0xab90('0x4d')]:_0x277bfa['model'];_0x380085[_0xab90('0x53')]=qs[_0xab90('0xbc')](_0x1cc744['query'][_0xab90('0xbc')]);_0x380085[_0xab90('0x56')]=qs[_0xab90('0x55')](_[_0xab90('0x54')](_0x1cc744['query'],_0x277bfa[_0xab90('0x55')]));if(_0x1cc744[_0xab90('0x4c')][_0xab90('0x3c')]){_0x380085['where']=_['merge'](_0x380085['where'],{'$or':_[_0xab90('0x3e')](_0x380085[_0xab90('0x4d')],function(_0x55bcc5){var _0x497046={};_0x497046[_0x55bcc5]={'$like':'%'+_0x1cc744[_0xab90('0x4c')][_0xab90('0x3c')]+'%'};return _0x497046;})});}_0x380085=_[_0xab90('0x57')]({},_0x380085,_0x1cc744[_0xab90('0x5d')]);return _0x5f1d4a[_0xab90('0x100')](_0x380085);}})[_0xab90('0x36')](function(_0x3f407f){if(_0x3f407f){_0x2cebfc=_0x3f407f[_0xab90('0x50')];if(!_0x1cc744[_0xab90('0x4c')][_0xab90('0x51')](_0xab90('0x52'))){_0x380085[_0xab90('0x31')]=qs[_0xab90('0x31')](_0x1cc744['query'][_0xab90('0x31')]);_0x380085[_0xab90('0x30')]=qs[_0xab90('0x30')](_0x1cc744['query'][_0xab90('0x30')]);}return _0x5f1d4a['getTeams'](_0x380085);}})[_0xab90('0x36')](function(_0xf735af){if(_0xf735af){return _0xf735af?{'count':_0x2cebfc,'rows':_0xf735af}:null;}})[_0xab90('0x36')](respondWithResult(_0x5e641f,null))[_0xab90('0x2a')](handleError(_0x5e641f,null));};exports[_0xab90('0x102')]=function(_0x4b634c,_0x3ec8ba){return db[_0xab90('0x5e')][_0xab90('0x41')]({'where':{'id':_0x4b634c['params']['id']}})[_0xab90('0x36')](handleEntityNotFound(_0x3ec8ba,null))[_0xab90('0x36')](function(_0x3b6207){if(_0x3b6207){var _0x225a28=_0x3b6207['get']({'plain':!![]});return _0x3b6207[_0xab90('0x102')](_0x4b634c[_0xab90('0x66')][_0xab90('0x6b')],_[_0xab90('0x6a')](_0x4b634c['body'],[_0xab90('0x6b'),'id'])||{})['then'](function(){for(var _0x59e9be=0x0;_0x59e9be<_0x4b634c['body'][_0xab90('0x6b')][_0xab90('0x50')];_0x59e9be++){var _0x21d65d=[];db[_0xab90('0x101')]['findOne']({'where':{'id':_0x4b634c[_0xab90('0x66')][_0xab90('0x6b')][_0x59e9be]}})[_0xab90('0x36')](function(_0x20ad39){_0x21d65d[_0xab90('0xa9')](_0x20ad39['getVoiceQueues']()[_0xab90('0x36')](function(_0x4d5d47){for(var _0x3fecc2=0x0;_0x3fecc2<_0x4d5d47['length'];_0x3fecc2++){_0x4d5d47[_0x3fecc2]['setDataValue'](_0xab90('0x9b'),_0xab90('0x103'));}return _0x4d5d47;}));_0x21d65d[_0xab90('0xa9')](_0x20ad39['getChatQueues']()[_0xab90('0x36')](function(_0x443411){for(var _0x440c8f=0x0;_0x440c8f<_0x443411['length'];_0x440c8f++){_0x443411[_0x440c8f][_0xab90('0x104')]('channel','Chat');}return _0x443411;}));_0x21d65d[_0xab90('0xa9')](_0x20ad39[_0xab90('0x105')]()['then'](function(_0x1b94b2){for(var _0x10110e=0x0;_0x10110e<_0x1b94b2['length'];_0x10110e++){_0x1b94b2[_0x10110e][_0xab90('0x104')]('channel',_0xab90('0x106'));}return _0x1b94b2;}));_0x21d65d[_0xab90('0xa9')](_0x20ad39[_0xab90('0x107')]()[_0xab90('0x36')](function(_0x453d21){for(var _0x4fecf5=0x0;_0x4fecf5<_0x453d21['length'];_0x4fecf5++){_0x453d21[_0x4fecf5]['setDataValue'](_0xab90('0x9b'),_0xab90('0x108'));}return _0x453d21;}));_0x21d65d['push'](_0x20ad39['getFaxQueues']()[_0xab90('0x36')](function(_0x35fc21){for(var _0x3179e8=0x0;_0x3179e8<_0x35fc21['length'];_0x3179e8++){_0x35fc21[_0x3179e8][_0xab90('0x104')](_0xab90('0x9b'),_0xab90('0x109'));}return _0x35fc21;}));_0x21d65d['push'](_0x20ad39[_0xab90('0x10a')]()[_0xab90('0x36')](function(_0x390692){for(var _0x1331d4=0x0;_0x1331d4<_0x390692[_0xab90('0x50')];_0x1331d4++){_0x390692[_0x1331d4][_0xab90('0x104')]('channel',_0xab90('0x10b'));}return _0x390692;}));return BPromise[_0xab90('0xe7')](_0x21d65d);})[_0xab90('0x36')](function(_0x34b0c2){var _0x48891c=_[_0xab90('0x10c')](_0x34b0c2);_0x21d65d=[];return db[_0xab90('0x5a')][_0xab90('0x10d')](function(_0x42eb20){for(var _0x2668df=0x0;_0x2668df<_0x48891c['length'];_0x2668df++){_0x21d65d[_0xab90('0xa9')](_0x48891c[_0x2668df]['addAgent'](_0x225a28['id']),{'transaction':_0x42eb20});}return BPromise[_0xab90('0xe7')](_0x21d65d)[_0xab90('0x36')](function(){if(_0x225a28[_0xab90('0x9c')]){return BPromise[_0xab90('0xab')](_[_0xab90('0x3c')](_0x48891c,function(_0x4c1c9c){return _0x4c1c9c[_0xab90('0x10e')]('channel')===_0xab90('0x103');}),function(_0xeb434f){return db[_0xab90('0xac')]['upsert']({'membername':_0x225a28[_0xab90('0x42')],'UserId':_0x225a28['id'],'queue_name':_0xeb434f[_0xab90('0x42')],'VoiceQueueId':_0xeb434f['id'],'interface':_[_0xab90('0x72')](_0x225a28['interface'])?util[_0xab90('0xd8')](_0xab90('0xda'),_0x225a28[_0xab90('0x42')]):_0x225a28[_0xab90('0x9e')],'paused':_0x225a28[_0xab90('0x9d')]||![],'penalty':_0x225a28[_0xab90('0xaa')]},{'transaction':_0x42eb20});});}else{return;}})[_0xab90('0x36')](function(){for(var _0x346b41=0x0;_0x346b41<_0x48891c[_0xab90('0x50')];_0x346b41++){var _0x1b5ba7=_0x48891c[_0x346b41][_0xab90('0x10e')]('channel');var _0x222e43=_0x1b5ba7+_0xab90('0xb0');socket[_0xab90('0xa5')](_0xab90('0x8b')+_0x1b5ba7+'Queue:save',{'UserId':_0x225a28['id'],['queueField']:_0x48891c[_0x346b41]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x3ec8ba,null))[_0xab90('0x2a')](handleError(_0x3ec8ba,null));};exports[_0xab90('0x10f')]=function(_0x42ee0d,_0x59f777){return db['User'][_0xab90('0x92')]({'where':{'id':_0x42ee0d['params']['id']}})[_0xab90('0x36')](handleEntityNotFound(_0x59f777,null))[_0xab90('0x36')](function(_0x8f17df){if(_0x8f17df){var _0xe09c0=_0x8f17df[_0xab90('0x37')]({'plain':!![]});var _0x205a21=_0x42ee0d[_0xab90('0x4c')][_0xab90('0x6b')];return _0x8f17df[_0xab90('0x10f')](_0x205a21)[_0xab90('0x36')](function(){for(var _0xeee18a=0x0;_0xeee18a<_0x205a21[_0xab90('0x50')];_0xeee18a++){var _0x165c34=[];db[_0xab90('0x101')][_0xab90('0x92')]({'where':{'id':_0x205a21[_0xeee18a]}})[_0xab90('0x36')](function(_0x3261d3){_0x165c34[_0xab90('0xa9')](_0x3261d3['getVoiceQueues']()[_0xab90('0x36')](function(_0x10cd1d){for(var _0x5dbf2c=0x0;_0x5dbf2c<_0x10cd1d[_0xab90('0x50')];_0x5dbf2c++){_0x10cd1d[_0x5dbf2c][_0xab90('0x104')](_0xab90('0x9b'),_0xab90('0x103'));}return _0x10cd1d;}));_0x165c34[_0xab90('0xa9')](_0x3261d3[_0xab90('0x110')]()[_0xab90('0x36')](function(_0x3da947){for(var _0x49a838=0x0;_0x49a838<_0x3da947[_0xab90('0x50')];_0x49a838++){_0x3da947[_0x49a838][_0xab90('0x104')](_0xab90('0x9b'),'Chat');}return _0x3da947;}));_0x165c34[_0xab90('0xa9')](_0x3261d3['getMailQueues']()[_0xab90('0x36')](function(_0xc72998){for(var _0x5ed98a=0x0;_0x5ed98a<_0xc72998[_0xab90('0x50')];_0x5ed98a++){_0xc72998[_0x5ed98a]['setDataValue'](_0xab90('0x9b'),_0xab90('0x106'));}return _0xc72998;}));_0x165c34[_0xab90('0xa9')](_0x3261d3[_0xab90('0x107')]()['then'](function(_0x1de64e){for(var _0xfabad6=0x0;_0xfabad6<_0x1de64e[_0xab90('0x50')];_0xfabad6++){_0x1de64e[_0xfabad6][_0xab90('0x104')](_0xab90('0x9b'),_0xab90('0x108'));}return _0x1de64e;}));_0x165c34['push'](_0x3261d3[_0xab90('0x111')]()[_0xab90('0x36')](function(_0x33ffe9){for(var _0x3e03b6=0x0;_0x3e03b6<_0x33ffe9[_0xab90('0x50')];_0x3e03b6++){_0x33ffe9[_0x3e03b6][_0xab90('0x104')](_0xab90('0x9b'),_0xab90('0x109'));}return _0x33ffe9;}));_0x165c34[_0xab90('0xa9')](_0x3261d3[_0xab90('0x10a')]()[_0xab90('0x36')](function(_0x220744){for(var _0x260896=0x0;_0x260896<_0x220744[_0xab90('0x50')];_0x260896++){_0x220744[_0x260896][_0xab90('0x104')](_0xab90('0x9b'),'Openchannel');}return _0x220744;}));return BPromise[_0xab90('0xe7')](_0x165c34);})[_0xab90('0x36')](function(_0xcc4ec5){var _0x899768=_[_0xab90('0x10c')](_0xcc4ec5);_0x165c34=[];return db[_0xab90('0x5a')][_0xab90('0x10d')](function(_0x334f7c){for(var _0xf32b01=0x0;_0xf32b01<_0x899768[_0xab90('0x50')];_0xf32b01++){_0x165c34[_0xab90('0xa9')](_0x899768[_0xf32b01][_0xab90('0x112')](_0xe09c0['id']),{'transaction':_0x334f7c});}return BPromise[_0xab90('0xe7')](_0x165c34)[_0xab90('0x36')](function(){if(_0xe09c0[_0xab90('0x9c')]){return BPromise['each'](_[_0xab90('0x3c')](_0x899768,function(_0x59b2ec){return _0x59b2ec[_0xab90('0x10e')](_0xab90('0x9b'))===_0xab90('0x103');}),function(_0x2f4f5c){return db[_0xab90('0xac')][_0xab90('0x43')]({'where':{'VoiceQueueId':_0x2f4f5c['id'],'UserId':_0xe09c0['id']},'transaction':_0x334f7c});});}else{return;}})['then'](function(){for(var _0x5773bf=0x0;_0x5773bf<_0x899768['length'];_0x5773bf++){var _0x3e5886=_0x899768[_0x5773bf][_0xab90('0x10e')]('channel');var _0x59fe8c=_0x3e5886+_0xab90('0xb0');socket['emit'](_0xab90('0x8b')+_0x3e5886+_0xab90('0x113'),{'UserId':_0xe09c0['id'],['queueField']:_0x899768[_0x5773bf]['id']});}});});});}});}})[_0xab90('0x36')](respondWithStatusCode(_0x59f777,null))['catch'](handleError(_0x59f777,null));};exports[_0xab90('0x114')]=function(_0x3df852,_0x334cf8,_0x56beee){var _0x123f80={};var _0x412623={};var _0x1aedb7;var _0x166ae2;return db[_0xab90('0x5e')]['findOne']({'where':{'id':_0x3df852[_0xab90('0x67')]['id']}})[_0xab90('0x36')](handleEntityNotFound(_0x334cf8,null))[_0xab90('0x36')](function(_0x39385e){if(_0x39385e){_0x1aedb7=_0x39385e;_0x412623[_0xab90('0x48')]=_[_0xab90('0x64')](db[_0xab90('0xbe')][_0xab90('0x45')]);_0x412623[_0xab90('0x4c')]=_[_0xab90('0x64')](_0x3df852[_0xab90('0x4c')]);_0x412623['filters']=_['intersection'](_0x412623[_0xab90('0x48')],_0x412623[_0xab90('0x4c')]);_0x123f80['attributes']=_['intersection'](_0x412623[_0xab90('0x48')],qs[_0xab90('0x4f')](_0x3df852[_0xab90('0x4c')]['fields']));_0x123f80['attributes']=_0x123f80[_0xab90('0x4d')][_0xab90('0x50')]?_0x123f80[_0xab90('0x4d')]:_0x412623[_0xab90('0x48')];_0x123f80[_0xab90('0x53')]=qs[_0xab90('0xbc')](_0x3df852[_0xab90('0x4c')]['sort']);_0x123f80[_0xab90('0x56')]=qs['filters'](_[_0xab90('0x54')](_0x3df852['query'],_0x412623['filters']));if(_0x3df852[_0xab90('0x4c')][_0xab90('0x3c')]){_0x123f80[_0xab90('0x56')]=_['merge'](_0x123f80['where'],{'$or':_['map'](_0x123f80['attributes'],function(_0x185995){var _0x5c9d2d={};_0x5c9d2d[_0x185995]={'$like':'%'+_0x3df852[_0xab90('0x4c')][_0xab90('0x3c')]+'%'};return _0x5c9d2d;})});}_0x123f80=_[_0xab90('0x57')]({},_0x123f80,_0x3df852[_0xab90('0x5d')]);return _0x1aedb7[_0xab90('0x114')](_0x123f80);}})[_0xab90('0x36')](function(_0x537eb5){if(_0x537eb5){_0x166ae2=_0x537eb5[_0xab90('0x50')];if(!_0x3df852[_0xab90('0x4c')][_0xab90('0x51')](_0xab90('0x52'))){_0x123f80[_0xab90('0x31')]=qs[_0xab90('0x31')](_0x3df852['query'][_0xab90('0x31')]);_0x123f80[_0xab90('0x30')]=qs[_0xab90('0x30')](_0x3df852[_0xab90('0x4c')][_0xab90('0x30')]);}return _0x1aedb7[_0xab90('0x114')](_0x123f80);}})[_0xab90('0x36')](function(_0x3b5faf){if(_0x3b5faf){return _0x3b5faf?{'count':_0x166ae2,'rows':_0x3b5faf}:null;}})['then'](respondWithResult(_0x334cf8,null))[_0xab90('0x2a')](handleError(_0x334cf8,null));};exports['getAgents']=function(_0x52a100,_0x372383,_0x436884){var _0x2963aa={};var _0x4770a0={};var _0x345759;var _0x1fb07a;return db['User'][_0xab90('0x92')]({'where':{'id':_0x52a100[_0xab90('0x67')]['id']}})[_0xab90('0x36')](handleEntityNotFound(_0x372383,null))[_0xab90('0x36')](function(_0x3a88a9){if(_0x3a88a9){_0x345759=_0x3a88a9;_0x4770a0[_0xab90('0x48')]=_['keys'](db[_0xab90('0x5e')][_0xab90('0x45')]);_0x4770a0['query']=_['keys'](_0x52a100[_0xab90('0x4c')]);_0x4770a0[_0xab90('0x55')]=_[_0xab90('0x4e')](_0x4770a0[_0xab90('0x48')],_0x4770a0['query']);_0x2963aa['attributes']=_[_0xab90('0x4e')](_0x4770a0[_0xab90('0x48')],qs['fields'](_0x52a100[_0xab90('0x4c')][_0xab90('0x4f')]));_0x2963aa['attributes']=_0x2963aa[_0xab90('0x4d')][_0xab90('0x50')]?_0x2963aa[_0xab90('0x4d')]:_0x4770a0[_0xab90('0x48')];_0x2963aa[_0xab90('0x53')]=qs[_0xab90('0xbc')](_0x52a100[_0xab90('0x4c')][_0xab90('0xbc')]);_0x2963aa['where']=qs[_0xab90('0x55')](_[_0xab90('0x54')](_0x52a100[_0xab90('0x4c')],_0x4770a0[_0xab90('0x55')]));if(_0x52a100[_0xab90('0x4c')][_0xab90('0x3c')]){_0x2963aa[_0xab90('0x56')]=_[_0xab90('0x57')](_0x2963aa[_0xab90('0x56')],{'$or':_[_0xab90('0x3e')](_0x2963aa[_0xab90('0x4d')],function(_0x5735bf){var _0x2988be={};_0x2988be[_0x5735bf]={'$like':'%'+_0x52a100[_0xab90('0x4c')][_0xab90('0x3c')]+'%'};return _0x2988be;})});}_0x2963aa[_0xab90('0x48')]=db[_0xab90('0x5e')];_0x2963aa['as']=_0xab90('0x39');_0x2963aa=_[_0xab90('0x57')]({},_0x2963aa,_0x52a100[_0xab90('0x5d')]);return _0x345759[_0xab90('0xe2')]({'include':[_0x2963aa]});}})[_0xab90('0x36')](function(_0x5c01f4){if(_0x5c01f4){var _0x2eee96={},_0x5c7c6a=[],_0x58a987=0x0;for(var _0x30b526=0x0;_0x30b526<_0x5c01f4['length'];_0x30b526+=0x1){for(var _0x327a11=0x0,_0x254820;_0x327a11<_0x5c01f4[_0x30b526][_0xab90('0x39')][_0xab90('0x50')];_0x327a11+=0x1){_0x254820=_0x5c01f4[_0x30b526][_0xab90('0x39')][_0x327a11][_0xab90('0x37')]({'plain':!![]});_0x2eee96[_0x254820['id']]=_0x254820;}}_0x2eee96=_[_0xab90('0x115')](_0x2eee96);for(var _0x48c4f1=qs[_0xab90('0x30')](_0x52a100[_0xab90('0x4c')][_0xab90('0x30')]);_0x48c4f1<_0x2eee96[_0xab90('0x50')]&&_0x5c7c6a[_0xab90('0x50')]=_0x230be5){_0x22bcc9=_0x230be5;_0x9a03c5=0xc8;}else{_0x9a03c5=0xce;}_0x1748c9[_0xd3d3('0x30')](_0x9a03c5);return _0x1748c9['set']('Content-Range',_0x325185+'-'+_0x22bcc9+'/'+_0x230be5)[_0xd3d3('0x31')](_0xd5ad91);}return null;};}function patchUpdates(_0x4007de){return function(_0x50be0b){try{jsonpatch[_0xd3d3('0x35')](_0x50be0b,_0x4007de,!![]);}catch(_0x30c27e){return BPromise[_0xd3d3('0x36')](_0x30c27e);}return _0x50be0b[_0xd3d3('0x37')]();};}function saveUpdates(_0x427e32,_0x583d34){return function(_0x2c1473){if(_0x2c1473){return _0x2c1473['update'](_0x427e32)['then'](function(_0x41fd40){return _0x41fd40;});}return null;};}function removeEntity(_0x48e246,_0x308ead){return function(_0x5194f9){if(_0x5194f9){return _0x5194f9[_0xd3d3('0x38')]()[_0xd3d3('0x22')](function(){var _0x37432f=_0x5194f9[_0xd3d3('0x39')]({'plain':!![]});var _0x43ab07=[{'name':'Users','value':_0xd3d3('0x3a'),'ignore':!![]},{'name':_0xd3d3('0x3b'),'value':_0xd3d3('0x3c'),'ignore':![]},{'name':_0xd3d3('0x3d'),'value':_0xd3d3('0x3e'),'ignore':![]}];var _0x21e613=_(_0x43ab07)[_0xd3d3('0x3f')](_0xd3d3('0x40'))[_0xd3d3('0x41')]('value')[_0xd3d3('0x42')]();if(_[_0xd3d3('0x43')](_0x21e613,_0x37432f[_0xd3d3('0x44')])){return;}var _0x388505=_[_0xd3d3('0x45')](_0x43ab07,['value',_0x37432f['role']])[_0xd3d3('0x46')];return db[_0xd3d3('0x47')]['destroy']({'where':{'type':_0x388505,'resourceId':_0x37432f['id']}})[_0xd3d3('0x22')](function(){return _0x5194f9;});})[_0xd3d3('0x22')](function(){_0x48e246[_0xd3d3('0x30')](0xcc)[_0xd3d3('0x2f')]();});}};}function handleEntityNotFound(_0x149553,_0x14938c){return function(_0x1f8ba4){if(!_0x1f8ba4){_0x149553['sendStatus'](0x194);}return _0x1f8ba4;};}function handleError(_0x5f3513,_0x23c5c5){_0x23c5c5=_0x23c5c5||0x1f4;return function(_0x24f86a){logger[_0xd3d3('0x29')](_0x24f86a[_0xd3d3('0x48')]);if(_0x24f86a['name']){delete _0x24f86a['name'];}_0x5f3513['status'](_0x23c5c5)['send'](_0x24f86a);};}exports['index']=function(_0x57d151,_0x5bd282){var _0x5ef720={},_0x208af6={},_0x1344d5={'count':0x0,'rows':[]};var _0x367952=_[_0xd3d3('0x41')](db['User']['rawAttributes'],function(_0x50cb32){return{'name':_0x50cb32[_0xd3d3('0x49')],'type':_0x50cb32['type'][_0xd3d3('0x4a')]};});_0x208af6[_0xd3d3('0x4b')]=_[_0xd3d3('0x4c')](_[_0xd3d3('0x41')](_0x367952,_0xd3d3('0x46')),['password',_0xd3d3('0x4d')]);_0x208af6['query']=_[_0xd3d3('0x4e')](_0x57d151['query']);_0x208af6[_0xd3d3('0x4f')]=_['intersection'](_0x208af6[_0xd3d3('0x4b')],_0x208af6[_0xd3d3('0x50')]);_0x5ef720['attributes']=_['intersection'](_0x208af6[_0xd3d3('0x4b')],qs['fields'](_0x57d151[_0xd3d3('0x50')][_0xd3d3('0x51')]));_0x5ef720[_0xd3d3('0x52')]=_0x5ef720[_0xd3d3('0x52')][_0xd3d3('0x53')]?_0x5ef720['attributes']:_0x208af6[_0xd3d3('0x4b')];if(!_0x57d151[_0xd3d3('0x50')]['hasOwnProperty']('nolimit')){_0x5ef720[_0xd3d3('0x34')]=qs[_0xd3d3('0x34')](_0x57d151[_0xd3d3('0x50')][_0xd3d3('0x34')]);_0x5ef720[_0xd3d3('0x33')]=qs[_0xd3d3('0x33')](_0x57d151['query'][_0xd3d3('0x33')]);}_0x5ef720[_0xd3d3('0x54')]=qs[_0xd3d3('0x55')](_0x57d151[_0xd3d3('0x50')]['sort']);_0x5ef720[_0xd3d3('0x56')]=qs[_0xd3d3('0x4f')](_[_0xd3d3('0x57')](_0x57d151[_0xd3d3('0x50')],_0x208af6[_0xd3d3('0x4f')]));if(_0x57d151[_0xd3d3('0x50')][_0xd3d3('0x3f')]){_0x5ef720[_0xd3d3('0x56')]=_[_0xd3d3('0x58')](_0x5ef720[_0xd3d3('0x56')],{'$or':_[_0xd3d3('0x41')](_0x367952,function(_0x368aa6){if(_0x368aa6['type']!==_0xd3d3('0x59')){return db['sequelize'][_0xd3d3('0x56')](db[_0xd3d3('0x5a')]['fn'](_0xd3d3('0x5b'),db[_0xd3d3('0x5a')]['col'](_0x368aa6[_0xd3d3('0x46')])),{'$like':db[_0xd3d3('0x5a')]['fn'](_0xd3d3('0x5b'),'%'+_0x57d151[_0xd3d3('0x50')][_0xd3d3('0x3f')]+'%')});}})});}_0x5ef720=_[_0xd3d3('0x58')]({},_0x5ef720,_0x57d151['options']);var _0x215612={'where':_0x5ef720[_0xd3d3('0x56')]};return db[_0xd3d3('0x5c')][_0xd3d3('0x32')](_0x215612)[_0xd3d3('0x22')](function(_0x39abe8){_0x1344d5[_0xd3d3('0x32')]=_0x39abe8;if(_0x57d151[_0xd3d3('0x50')][_0xd3d3('0x5d')]){_0x5ef720['include']=[{'all':!![]}];}return db['User']['findAll'](_0x5ef720);})[_0xd3d3('0x22')](function(_0x17881c){_0x1344d5[_0xd3d3('0x5e')]=_0x17881c;return _0x1344d5;})[_0xd3d3('0x22')](respondWithFilteredResult(_0x5bd282,_0x5ef720))[_0xd3d3('0x2d')](handleError(_0x5bd282,null));};exports['show']=function(_0x1c5977,_0xd85d58){var _0x399410={'raw':![],'where':{'id':_0x1c5977[_0xd3d3('0x5f')]['id']}},_0x544224={};_0x544224['model']=_[_0xd3d3('0x4c')](_['keys'](db[_0xd3d3('0x5c')][_0xd3d3('0x60')]),[_0xd3d3('0x61'),_0xd3d3('0x4d')]);_0x544224[_0xd3d3('0x50')]=_['keys'](_0x1c5977[_0xd3d3('0x50')]);_0x544224['filters']=_[_0xd3d3('0x62')](_0x544224[_0xd3d3('0x4b')],_0x544224['query']);_0x399410[_0xd3d3('0x52')]=_[_0xd3d3('0x62')](_0x544224[_0xd3d3('0x4b')],qs[_0xd3d3('0x51')](_0x1c5977['query'][_0xd3d3('0x51')]));_0x399410[_0xd3d3('0x52')]=_0x399410[_0xd3d3('0x52')]['length']?_0x399410[_0xd3d3('0x52')]:_0x544224[_0xd3d3('0x4b')];if(_0x1c5977[_0xd3d3('0x50')][_0xd3d3('0x5d')]){_0x399410[_0xd3d3('0x63')]=[{'all':!![]}];}_0x399410=_[_0xd3d3('0x58')]({},_0x399410,_0x1c5977[_0xd3d3('0x64')]);return db['User']['find'](_0x399410)[_0xd3d3('0x22')](handleEntityNotFound(_0xd85d58,null))[_0xd3d3('0x22')](respondWithResult(_0xd85d58,null))[_0xd3d3('0x2d')](handleError(_0xd85d58,null));};exports['bulkCreate']=function(_0x1345bd,_0xce9533){return db[_0xd3d3('0x5c')]['bulkCreate'](_0x1345bd[_0xd3d3('0x65')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0xce9533,0xc9))[_0xd3d3('0x2d')](handleError(_0xce9533,null));};exports['update']=function(_0x5daf01,_0x42733a){if(_0x5daf01[_0xd3d3('0x65')]['id']){delete _0x5daf01[_0xd3d3('0x65')]['id'];}delete _0x5daf01[_0xd3d3('0x65')][_0xd3d3('0x44')];return db[_0xd3d3('0x5c')][_0xd3d3('0x45')]({'where':{'id':_0x5daf01[_0xd3d3('0x5f')]['id']}})[_0xd3d3('0x22')](handleEntityNotFound(_0x42733a,null))[_0xd3d3('0x22')](saveUpdates(_0x5daf01[_0xd3d3('0x65')],null))[_0xd3d3('0x22')](respondWithResult(_0x42733a,null))[_0xd3d3('0x2d')](handleError(_0x42733a,null));};exports[_0xd3d3('0x66')]=function(_0x12c2c4,_0x37b726){return db[_0xd3d3('0x5c')][_0xd3d3('0x66')]()[_0xd3d3('0x22')](respondWithResult(_0x37b726,null))[_0xd3d3('0x2d')](handleError(_0x37b726,null));};exports[_0xd3d3('0x67')]=function(_0x1f188c,_0x44bbc5,_0x9a5d5b){return db[_0xd3d3('0x5c')]['find']({'where':{'id':_0x1f188c['params']['id']}})['then'](handleEntityNotFound(_0x44bbc5,null))['then'](function(_0x445689){if(_0x445689){return _0x445689['addContacts'](_0x1f188c[_0xd3d3('0x65')]['ids'],_['omit'](_0x1f188c[_0xd3d3('0x65')],['ids','id'])||{});}})[_0xd3d3('0x22')](respondWithResult(_0x44bbc5,null))[_0xd3d3('0x2d')](handleError(_0x44bbc5,null));};var getLicense=function(_0x4636cd){return new BPromise(function(_0x491410,_0x23419c){var _0x39ff59=0x0;_0x4636cd[_0xd3d3('0x65')][_0xd3d3('0x44')]==='agent'&&_0x491410(_0xd3d3('0x68'));return db[_0xd3d3('0x5c')][_0xd3d3('0x32')]({'where':{'$or':[{'role':_0x4636cd[_0xd3d3('0x65')][_0xd3d3('0x44')]===_0xd3d3('0x3e')?_0xd3d3('0x3e'):['admin',_0xd3d3('0x3a')]}]}})[_0xd3d3('0x22')](function(_0x427028){_0x39ff59=_0x427028;return require(_0xd3d3('0x69'))[_0xd3d3('0x6a')]();})['then'](function(_0x56eea4){var _0x365196=_0x4636cd[_0xd3d3('0x65')][_0xd3d3('0x44')]===_0xd3d3('0x3e')?'telephones':_0xd3d3('0x6b');if(!_['isNil'](_0x56eea4[_0x365196])&&_0x39ff59>=_0x56eea4[_0x365196]){return _0x23419c({'message':_0xd3d3('0x6c')});}return _0x491410(util[_0xd3d3('0x6d')](_0xd3d3('0x6e'),_0x365196,_0x39ff59));})[_0xd3d3('0x2d')](function(_0x2edcc0){return _0x23419c(_0x2edcc0);});});};exports[_0xd3d3('0x6f')]=function(_0x39cf73,_0x5183eb){return getLicense(_0x39cf73)[_0xd3d3('0x22')](function(_0x4f43e2){if(!_0x39cf73[_0xd3d3('0x65')][_0xd3d3('0x70')]){var _0x6c0f4b;return db['Setting']['findById'](0x1)[_0xd3d3('0x22')](function(_0x1b32a1){return checkPasswordPattern(_0x1b32a1,_0x39cf73[_0xd3d3('0x65')][_0xd3d3('0x61')],_0x1b32a1['securePassword']);})[_0xd3d3('0x22')](function(_0x5b0d8a){_0x6c0f4b=_0x5b0d8a[_0xd3d3('0x71')];return db[_0xd3d3('0x5c')]['max'](_0xd3d3('0x70'));})[_0xd3d3('0x22')](function(_0x1dd173){if(_[_0xd3d3('0x72')](_0x1dd173)){if(_0x6c0f4b){_0x39cf73['body'][_0xd3d3('0x70')]=_0x6c0f4b;}else{_0x39cf73['body'][_0xd3d3('0x70')]=0x1;}}else{if(_['isNil'](_0x6c0f4b)||_0x6c0f4b==_0x1dd173){_0x39cf73[_0xd3d3('0x65')][_0xd3d3('0x70')]=_0x1dd173+0x1;}else if(_0x6c0f4b>_0x1dd173){_0x39cf73['body'][_0xd3d3('0x70')]=_0x6c0f4b;}else{return db[_0xd3d3('0x5a')][_0xd3d3('0x50')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0xd3d3('0x5a')]['QueryTypes'][_0xd3d3('0x73')]})[_0xd3d3('0x22')](function(_0x5ea6ea){if(_0x5ea6ea&&_0x5ea6ea[_0xd3d3('0x53')]){for(var _0x284bf3=0x0,_0x377343=_0x5ea6ea[_0xd3d3('0x53')];_0x284bf3<_0x377343&&_[_0xd3d3('0x72')](_0x39cf73[_0xd3d3('0x65')]['internal']);_0x284bf3++){if(_0x6c0f4b<=_0x5ea6ea[_0x284bf3][_0xd3d3('0x74')]){_0x39cf73[_0xd3d3('0x65')][_0xd3d3('0x70')]=_0x5ea6ea[_0x284bf3][_0xd3d3('0x74')];}else if(_0x6c0f4b>_0x5ea6ea[_0x284bf3]['from']&&_0x6c0f4b<=_0x5ea6ea[_0x284bf3]['to']){_0x39cf73[_0xd3d3('0x65')][_0xd3d3('0x70')]=_0x6c0f4b;}}}if(_['isNil'](_0x39cf73[_0xd3d3('0x65')]['internal'])){_0x39cf73[_0xd3d3('0x65')][_0xd3d3('0x70')]=_0x1dd173+0x1;}});}}});}})[_0xd3d3('0x22')](function(){if(_0x39cf73[_0xd3d3('0x65')]['voicemail']){_0x39cf73[_0xd3d3('0x65')][_0xd3d3('0x75')]=_0x39cf73[_0xd3d3('0x65')]['internal'];_0x39cf73[_0xd3d3('0x65')][_0xd3d3('0x76')]={'mailbox':_0x39cf73[_0xd3d3('0x65')][_0xd3d3('0x70')],'password':_0x39cf73['body']['password'],'fullname':_0x39cf73[_0xd3d3('0x65')][_0xd3d3('0x77')],'email':_0x39cf73['body'][_0xd3d3('0x78')]};}if(_0x39cf73[_0xd3d3('0x65')]&&_0x39cf73[_0xd3d3('0x65')][_0xd3d3('0x44')]===_0xd3d3('0x3c')){_0x39cf73['body'][_0xd3d3('0x79')]=['101','102',_0xd3d3('0x7a'),_0xd3d3('0x7b'),_0xd3d3('0x7c'),_0xd3d3('0x7d'),_0xd3d3('0x7e'),_0xd3d3('0x7f'),_0xd3d3('0x80'),_0xd3d3('0x81'),_0xd3d3('0x82'),_0xd3d3('0x83')];}return db[_0xd3d3('0x5c')][_0xd3d3('0x6f')](_0x39cf73['body'],{'include':[{'model':db[_0xd3d3('0x76')],'as':_0xd3d3('0x76')}]});})[_0xd3d3('0x22')](function(_0x9de526){if(_0x39cf73[_0xd3d3('0x65')][_0xd3d3('0x44')]===_0xd3d3('0x3a'))return _0x9de526;var _0xa21f7a=_0x39cf73['user'][_0xd3d3('0x39')]({'plain':!![]});if(!_0xa21f7a)throw new Error(_0xd3d3('0x84'));if(_0xa21f7a[_0xd3d3('0x44')]===_0xd3d3('0x3a')){var _0x25e881=_0x9de526[_0xd3d3('0x39')]({'plain':!![]});var _0x487432=[{'name':_0xd3d3('0x3b'),'value':_0xd3d3('0x3c')},{'name':_0xd3d3('0x3d'),'value':_0xd3d3('0x3e')}];var _0x54223e=_['find'](_0x487432,[_0xd3d3('0x42'),_0x25e881[_0xd3d3('0x44')]])[_0xd3d3('0x46')];return db[_0xd3d3('0x85')][_0xd3d3('0x45')]({'where':{'name':_0x54223e,'userProfileId':_0xa21f7a['userProfileId']},'raw':!![]})[_0xd3d3('0x22')](function(_0x554812){if(_0x554812&&_0x554812[_0xd3d3('0x86')]===0x0){return db[_0xd3d3('0x47')]['create']({'name':_0x25e881[_0xd3d3('0x46')],'resourceId':_0x25e881['id'],'type':_0x554812[_0xd3d3('0x46')],'sectionId':_0x554812['id']},{})[_0xd3d3('0x22')](function(){return _0x9de526;});}else{return _0x9de526;}})[_0xd3d3('0x2d')](function(_0x2f9f29){logger['error'](_0xd3d3('0x87'),_0x2f9f29);throw _0x2f9f29;});}return _0x9de526;})['then'](respondWithResult(_0x5183eb,0xc9))[_0xd3d3('0x2d')](handleError(_0x5183eb,null));};exports['changePassword']=function(_0x547df0,_0x31ce96,_0x32d95b){var _0x12513d=![];if(_0x547df0[_0xd3d3('0x65')]['id']){delete _0x547df0[_0xd3d3('0x65')]['id'];}return db[_0xd3d3('0x88')][_0xd3d3('0x89')]({'attributes':['id',_0xd3d3('0x8a')]})[_0xd3d3('0x22')](function(_0x54569a){_0x12513d=_0x54569a['securePassword'];return db[_0xd3d3('0x5c')][_0xd3d3('0x45')]({'where':{'id':_0x547df0['params']['id']}});})[_0xd3d3('0x22')](function(_0x21ec03){if(_0x21ec03){if(_0x21ec03['id']==_0x547df0['user']['id']){if(!_0x547df0[_0xd3d3('0x65')]['oldPassword']||!_0x547df0[_0xd3d3('0x65')][_0xd3d3('0x8b')]){throw new db[(_0xd3d3('0x20'))][(_0xd3d3('0x21'))](_0xd3d3('0x8c'));}if(!_0x21ec03[_0xd3d3('0x8d')](_0x547df0['body'][_0xd3d3('0x8e')])){throw new db[(_0xd3d3('0x20'))]['ValidationError'](_0xd3d3('0x8f'));}if(_0x547df0[_0xd3d3('0x65')][_0xd3d3('0x8e')]==_0x547df0[_0xd3d3('0x65')][_0xd3d3('0x8b')]){throw new db[(_0xd3d3('0x20'))]['ValidationError'](_0xd3d3('0x90'));}return _0x21ec03;}else if(_0x547df0[_0xd3d3('0x3a')][_0xd3d3('0x44')]==_0xd3d3('0x91')){if(!_0x547df0[_0xd3d3('0x65')]['newPassword']){throw new db[(_0xd3d3('0x20'))][(_0xd3d3('0x21'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}return _0x21ec03;}else if(_0x547df0['user'][_0xd3d3('0x44')]=='user'){if(!_0x547df0[_0xd3d3('0x65')]['newPassword']){throw new db[(_0xd3d3('0x20'))][(_0xd3d3('0x21'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x21ec03[_0xd3d3('0x44')]!=_0xd3d3('0x3c')){throw new db[(_0xd3d3('0x20'))][(_0xd3d3('0x21'))]('Unauthorized');}return _0x21ec03;}else{throw new db[(_0xd3d3('0x20'))][(_0xd3d3('0x21'))]('Unauthorized');}}return null;})[_0xd3d3('0x22')](handleEntityNotFound(_0x31ce96,null))[_0xd3d3('0x22')](function(_0x27c99b){return checkPasswordPattern(_0x27c99b,_0x547df0[_0xd3d3('0x65')][_0xd3d3('0x8b')],_0x12513d);})[_0xd3d3('0x22')](saveUpdates({'password':_0x547df0[_0xd3d3('0x65')][_0xd3d3('0x8b')],'passwordResetAt':_0x547df0[_0xd3d3('0x3a')]['id']==_0x547df0[_0xd3d3('0x5f')]['id']?moment():null},null))[_0xd3d3('0x22')](respondWithResult(_0x31ce96,null))[_0xd3d3('0x2d')](handleError(_0x31ce96,null));};exports[_0xd3d3('0x92')]=function(_0x440004,_0x167add,_0xb1bfa4){var _0x54d447=_0x440004[_0xd3d3('0x65')][_0xd3d3('0x93')];return db['User'][_0xd3d3('0x45')]({'where':{'id':_0x440004[_0xd3d3('0x5f')]['id']},'attributes':['id','name',_0xd3d3('0x44'),_0xd3d3('0x94'),_0xd3d3('0x95'),_0xd3d3('0x96'),_0xd3d3('0x97')]})['then'](handleEntityNotFound(_0x167add,null))[_0xd3d3('0x22')](function(_0x242e9c){if(_0x242e9c){if(!utils[_0xd3d3('0x98')](_0x54d447)){throw new db[(_0xd3d3('0x20'))]['ValidationError']('Unknown\x20channel');}return _0x242e9c[_0xd3d3('0x99')+_['capitalize'](_0x54d447[_0xd3d3('0x9a')]())+_0xd3d3('0x9b')](_0x440004[_0xd3d3('0x65')]['ids'],{'penalty':_0x440004['body']['penalty']||0x0})['spread'](function(_0xd69e4e){for(var _0x3507d9=0x0;_0x3507d9<_0x440004['body']['ids'][_0xd3d3('0x53')];_0x3507d9+=0x1){var _0x27cf21={'UserId':_0x440004['params']['id']};_0x27cf21[_[_0xd3d3('0x9c')](_0x54d447[_0xd3d3('0x9a')]())+'QueueId']=_0x440004[_0xd3d3('0x65')][_0xd3d3('0x9d')][_0x3507d9];socket[_0xd3d3('0x9e')](_0xd3d3('0x3a')+_[_0xd3d3('0x9c')](_0x54d447[_0xd3d3('0x9a')]())+_0xd3d3('0x9f'),_0x27cf21);}return _0xd69e4e;})['then'](function(){if(_0x54d447===_0xd3d3('0xa0')){return db[_0xd3d3('0xa1')][_0xd3d3('0xa2')]({'where':{'id':_0x440004['body'][_0xd3d3('0x9d')]||[]},'raw':!![],'attributes':['id',_0xd3d3('0x46')]});}})[_0xd3d3('0x22')](function(_0x359e34){var _0x5d779a=_0x242e9c[_0xd3d3('0x39')]({'plain':!![]});var _0x253201=[];if(_0x54d447===_0xd3d3('0xa0')&&_0x5d779a[_0xd3d3('0x44')]===_0xd3d3('0x3c')&&_0x5d779a['online']){for(var _0x5e5d82=0x0;_0x5e5d82<_0x359e34['length'];_0x5e5d82+=0x1){_0x253201['push']({'membername':_0x5d779a[_0xd3d3('0x46')],'UserId':_0x5d779a['id'],'queue_name':_0x359e34[_0x5e5d82][_0xd3d3('0x46')],'VoiceQueueId':_0x359e34[_0x5e5d82]['id'],'interface':_[_0xd3d3('0x72')](_0x5d779a[_0xd3d3('0x97')])?util[_0xd3d3('0x6d')](_0xd3d3('0xa3'),_0x5d779a[_0xd3d3('0x46')]):_0x5d779a[_0xd3d3('0x97')],'paused':_0x5d779a[_0xd3d3('0x96')]||![],'penalty':_0x440004[_0xd3d3('0x65')][_0xd3d3('0xa4')]||0x0});}return BPromise['each'](_0x253201,function(_0xb6c909){return db['UserVoiceQueueRt'][_0xd3d3('0xa5')](_0xb6c909);});}return _0x242e9c;});}})[_0xd3d3('0x22')](respondWithStatusCode(_0x167add,null))['catch'](handleError(_0x167add,null));};exports[_0xd3d3('0xa6')]=function(_0x3fbd66,_0x143988,_0x565a13){var _0x5b8444;return db['User'][_0xd3d3('0x45')]({'where':{'id':_0x3fbd66['params']['id']},'attributes':['id','name',_0xd3d3('0x44')]})['then'](handleEntityNotFound(_0x143988,null))[_0xd3d3('0x22')](function(_0x18547a){if(_0x18547a){_0x5b8444=_0x18547a;if(!_0x3fbd66[_0xd3d3('0x50')][_0xd3d3('0x93')]||!utils[_0xd3d3('0x98')](_0x3fbd66[_0xd3d3('0x50')]['channel'])){throw new db['Sequelize'][(_0xd3d3('0x21'))](_0xd3d3('0xa7'));}return _0x18547a[_0xd3d3('0xa8')+_['capitalize'](_0x3fbd66[_0xd3d3('0x50')][_0xd3d3('0x93')][_0xd3d3('0x9a')]())+_0xd3d3('0x9b')](_0x3fbd66[_0xd3d3('0x50')][_0xd3d3('0x9d')]);}})['then'](function(_0xd2f231){for(var _0x113912=0x0;_0x113912<_0x3fbd66['query'][_0xd3d3('0x9d')][_0xd3d3('0x53')];_0x113912+=0x1){var _0x3e05cd={'UserId':_0x3fbd66[_0xd3d3('0x5f')]['id']};_0x3e05cd[_[_0xd3d3('0x9c')](_0x3fbd66['query'][_0xd3d3('0x93')][_0xd3d3('0x9a')]())+_0xd3d3('0xa9')]=_0x3fbd66[_0xd3d3('0x50')][_0xd3d3('0x9d')][_0x113912];socket[_0xd3d3('0x9e')](_0xd3d3('0x3a')+_[_0xd3d3('0x9c')](_0x3fbd66[_0xd3d3('0x50')][_0xd3d3('0x93')][_0xd3d3('0x9a')]())+'Queue:remove',_0x3e05cd);}return _0xd2f231;})[_0xd3d3('0x22')](function(){if(_0x3fbd66[_0xd3d3('0x50')]['channel']===_0xd3d3('0xa0')){return db['UserVoiceQueueRt'][_0xd3d3('0x38')]({'where':{'UserId':_0x3fbd66[_0xd3d3('0x5f')]['id'],'VoiceQueueId':_0x3fbd66[_0xd3d3('0x50')][_0xd3d3('0x9d')]},'individualHooks':!![]})['then'](function(){return _0x5b8444;});}return _0x5b8444;})[_0xd3d3('0x22')](respondWithStatusCode(_0x143988,null))['catch'](handleError(_0x143988,null));};exports[_0xd3d3('0xaa')]=function(_0x35129e,_0x32d55f,_0x32333e){_0x35129e[_0xd3d3('0x65')][_0xd3d3('0xab')]=_0x35129e[_0xd3d3('0xac')]['filename'];return db[_0xd3d3('0x5c')][_0xd3d3('0x45')]({'where':{'id':_0x35129e['params']['id']}})['then'](handleEntityNotFound(_0x32d55f,null))[_0xd3d3('0x22')](saveUpdates(_0x35129e[_0xd3d3('0x65')],null))[_0xd3d3('0x22')](respondWithResult(_0x32d55f,null))[_0xd3d3('0x2d')](handleError(_0x32d55f,null));};exports[_0xd3d3('0xad')]=function(_0x415780,_0x35040d,_0x5d8697){var _0x1e2492=path['join'](config[_0xd3d3('0xae')],_0xd3d3('0xaf'));return db[_0xd3d3('0x5c')]['find']({'where':{'id':_0x415780[_0xd3d3('0x5f')]['id']},'attributes':['id','userpic'],'raw':!![]})['then'](handleEntityNotFound(_0x35040d,null))['then'](function(_0x449681){if(_0x449681){if(_[_0xd3d3('0x72')](_0x449681[_0xd3d3('0xab')])){return _0x35040d[_0xd3d3('0xb0')](_0x1e2492);}else{if(!fs[_0xd3d3('0xb1')](path['join'](config[_0xd3d3('0xae')],'server/files/images/',_0x449681[_0xd3d3('0xab')]))){return _0x35040d[_0xd3d3('0xb0')](_0x1e2492);}return _0x35040d['download'](path[_0xd3d3('0xb2')](config[_0xd3d3('0xae')],'server/files/images/',_0x449681['userpic']));}}})[_0xd3d3('0x2d')](handleError(_0x35040d,null));};exports[_0xd3d3('0xb3')]=function(_0x10a99e,_0x12df6f,_0x5bbe86){var _0x2e54e8={};var _0x1cadc6={};var _0x5db5b7;var _0x16adc5;return db['User'][_0xd3d3('0x89')]({'where':{'id':_0x10a99e[_0xd3d3('0x5f')]['id']}})['then'](handleEntityNotFound(_0x12df6f,null))[_0xd3d3('0x22')](function(_0x3dfb64){if(_0x3dfb64){_0x5db5b7=_0x3dfb64;_0x1cadc6[_0xd3d3('0x4b')]=_[_0xd3d3('0x4e')](db[_0xd3d3('0xb4')][_0xd3d3('0x60')]);_0x1cadc6['query']=_[_0xd3d3('0x4e')](_0x10a99e[_0xd3d3('0x50')]);_0x1cadc6[_0xd3d3('0x4f')]=_[_0xd3d3('0x62')](_0x1cadc6['model'],_0x1cadc6[_0xd3d3('0x50')]);_0x2e54e8[_0xd3d3('0x52')]=_[_0xd3d3('0x62')](_0x1cadc6[_0xd3d3('0x4b')],qs[_0xd3d3('0x51')](_0x10a99e[_0xd3d3('0x50')]['fields']));_0x2e54e8[_0xd3d3('0x52')]=_0x2e54e8['attributes'][_0xd3d3('0x53')]?_0x2e54e8[_0xd3d3('0x52')]:_0x1cadc6[_0xd3d3('0x4b')];_0x2e54e8['order']=qs[_0xd3d3('0x55')](_0x10a99e[_0xd3d3('0x50')][_0xd3d3('0x55')]);_0x2e54e8[_0xd3d3('0x56')]=qs['filters'](_[_0xd3d3('0x57')](_0x10a99e[_0xd3d3('0x50')],_0x1cadc6[_0xd3d3('0x4f')]));if(_0x10a99e[_0xd3d3('0x50')]['filter']){_0x2e54e8[_0xd3d3('0x56')]=_['merge'](_0x2e54e8['where'],{'$or':_[_0xd3d3('0x41')](_0x2e54e8[_0xd3d3('0x52')],function(_0x2627b3){var _0x4aa29d={};_0x4aa29d[_0x2627b3]={'$like':'%'+_0x10a99e[_0xd3d3('0x50')][_0xd3d3('0x3f')]+'%'};return _0x4aa29d;})});}_0x2e54e8=_[_0xd3d3('0x58')]({},_0x2e54e8,_0x10a99e[_0xd3d3('0x64')]);return _0x5db5b7[_0xd3d3('0xb3')](_0x2e54e8);}})[_0xd3d3('0x22')](function(_0x2fd04b){if(_0x2fd04b){_0x16adc5=_0x2fd04b[_0xd3d3('0x53')];if(_0x10a99e[_0xd3d3('0x50')][_0xd3d3('0xb5')](_0xd3d3('0x5d'))){_0x2e54e8[_0xd3d3('0x63')]=[{'model':db[_0xd3d3('0xb6')],'as':_0xd3d3('0xb7'),'required':![]},{'model':db[_0xd3d3('0xb8')],'as':_0xd3d3('0xb9'),'attributes':['id',_0xd3d3('0x46'),_0xd3d3('0xba')],'where':_0x10a99e[_0xd3d3('0x50')][_0xd3d3('0xbb')]?{'id':_0x10a99e['query'][_0xd3d3('0xbb')]}:undefined,'required':_0x10a99e['query'][_0xd3d3('0xbb')]?!![]:![]}];}if(!_0x10a99e[_0xd3d3('0x50')]['hasOwnProperty'](_0xd3d3('0xbc'))){_0x2e54e8[_0xd3d3('0x34')]=qs[_0xd3d3('0x34')](_0x10a99e[_0xd3d3('0x50')][_0xd3d3('0x34')]);_0x2e54e8['offset']=qs[_0xd3d3('0x33')](_0x10a99e[_0xd3d3('0x50')][_0xd3d3('0x33')]);}return _0x5db5b7['getContacts'](_0x2e54e8);}})[_0xd3d3('0x22')](function(_0x509325){if(_0x509325){return _0x509325?{'count':_0x16adc5,'rows':_0x509325}:null;}})['then'](respondWithResult(_0x12df6f,null))[_0xd3d3('0x2d')](handleError(_0x12df6f,null));};exports[_0xd3d3('0xbd')]=function(_0x1af9a3,_0xf250b5,_0xcd2678){var _0x2bb208;var _0x33f577;var _0x3c38d0={};var _0x375988;return db[_0xd3d3('0x5c')][_0xd3d3('0x89')]({'where':{'id':_0x1af9a3[_0xd3d3('0x5f')]['id']},'attributes':['id',_0xd3d3('0x46'),_0xd3d3('0x44')]})[_0xd3d3('0x22')](handleEntityNotFound(_0xf250b5,null))[_0xd3d3('0x22')](function(_0x3ab680){if(!utils['isValidChannel'](_0x1af9a3[_0xd3d3('0x50')][_0xd3d3('0x93')])){throw new db['Sequelize'][(_0xd3d3('0x21'))]('Unknown\x20channel');}_0x2bb208=_0x3ab680;var _0x44497d={};_0x44497d[_0xd3d3('0x4b')]=_[_0xd3d3('0x4e')](db[_['capitalize'](_0x1af9a3['query'][_0xd3d3('0x93')])+_0xd3d3('0xbe')][_0xd3d3('0x60')]);_0x44497d['query']=_[_0xd3d3('0x4e')](_0x1af9a3[_0xd3d3('0x50')]);_0x44497d[_0xd3d3('0x4f')]=_[_0xd3d3('0x62')](_0x44497d['model'],_0x44497d['query']);_0x3c38d0[_0xd3d3('0x52')]=_[_0xd3d3('0x62')](_0x44497d[_0xd3d3('0x4b')],qs['fields'](_0x1af9a3[_0xd3d3('0x50')][_0xd3d3('0x51')]));_0x3c38d0['attributes']=_0x3c38d0[_0xd3d3('0x52')][_0xd3d3('0x53')]?_0x3c38d0[_0xd3d3('0x52')]:_0x44497d[_0xd3d3('0x4b')];_0x3c38d0['order']=qs['sort'](_0x1af9a3[_0xd3d3('0x50')][_0xd3d3('0x55')]);_0x3c38d0[_0xd3d3('0x56')]=qs[_0xd3d3('0x4f')](_[_0xd3d3('0x57')](_0x1af9a3['query'],_0x44497d[_0xd3d3('0x4f')]));if(_0x1af9a3[_0xd3d3('0x50')][_0xd3d3('0x3f')]){_0x3c38d0[_0xd3d3('0x56')]=_[_0xd3d3('0x58')](_0x3c38d0[_0xd3d3('0x56')],{'$or':_[_0xd3d3('0x41')](_0x3c38d0[_0xd3d3('0x52')],function(_0x18a0ad){var _0x1f1b60={};_0x1f1b60[_0x18a0ad]={'$like':'%'+_0x1af9a3[_0xd3d3('0x50')][_0xd3d3('0x3f')]+'%'};return _0x1f1b60;})});}_0x3c38d0=_[_0xd3d3('0x58')]({},_0x3c38d0,_0x1af9a3[_0xd3d3('0x64')]);switch(_0x2bb208[_0xd3d3('0x44')]){case _0xd3d3('0x91'):return db[_['capitalize'](_0x1af9a3[_0xd3d3('0x50')][_0xd3d3('0x93')])+'Queue'][_0xd3d3('0xa2')](_0x3c38d0);case _0xd3d3('0x3a'):case _0xd3d3('0x3c'):return _0x2bb208[_0xd3d3('0x39')+_[_0xd3d3('0x9c')](_0x1af9a3[_0xd3d3('0x50')][_0xd3d3('0x93')])+_0xd3d3('0x9b')](_0x3c38d0);default:throw new db[(_0xd3d3('0x20'))]['ValidationError']('Unknown\x20role');}})[_0xd3d3('0x22')](function(_0x30c911){_0x375988=_0x30c911[_0xd3d3('0x53')];if(!_0x1af9a3[_0xd3d3('0x50')][_0xd3d3('0xb5')](_0xd3d3('0xbc'))){_0x3c38d0[_0xd3d3('0x34')]=qs[_0xd3d3('0x34')](_0x1af9a3[_0xd3d3('0x50')][_0xd3d3('0x34')]);_0x3c38d0[_0xd3d3('0x33')]=qs[_0xd3d3('0x33')](_0x1af9a3[_0xd3d3('0x50')][_0xd3d3('0x33')]);}switch(_0x2bb208[_0xd3d3('0x44')]){case _0xd3d3('0x91'):return db[_['capitalize'](_0x1af9a3['query'][_0xd3d3('0x93')])+'Queue'][_0xd3d3('0xa2')](_0x3c38d0);case _0xd3d3('0x3a'):case _0xd3d3('0x3c'):return _0x2bb208[_0xd3d3('0x39')+_[_0xd3d3('0x9c')](_0x1af9a3[_0xd3d3('0x50')][_0xd3d3('0x93')])+_0xd3d3('0x9b')](_0x3c38d0);}})[_0xd3d3('0x22')](function(_0x3e907b){return{'count':_0x375988,'rows':_0x3e907b};})[_0xd3d3('0x22')](respondWithResult(_0xf250b5,null))[_0xd3d3('0x2d')](handleError(_0xf250b5,null));};exports[_0xd3d3('0xbf')]=function(_0x28bff9,_0x312950,_0x9cc801){var _0x403568={};var _0x243ba1={};var _0x2d35ca;var _0xf6c1dc;return db[_0xd3d3('0x5c')][_0xd3d3('0x89')]({'where':{'id':_0x28bff9[_0xd3d3('0x5f')]['id']}})[_0xd3d3('0x22')](handleEntityNotFound(_0x312950,null))['then'](function(_0x59a4c7){if(_0x59a4c7){_0x2d35ca=_0x59a4c7;_0x243ba1['model']=_[_0xd3d3('0x4e')](db['UserVoiceQueueRt'][_0xd3d3('0x60')]);_0x243ba1['query']=_[_0xd3d3('0x4e')](_0x28bff9[_0xd3d3('0x50')]);_0x243ba1[_0xd3d3('0x4f')]=_[_0xd3d3('0x62')](_0x243ba1[_0xd3d3('0x4b')],_0x243ba1[_0xd3d3('0x50')]);_0x403568[_0xd3d3('0x52')]=_[_0xd3d3('0x62')](_0x243ba1['model'],qs[_0xd3d3('0x51')](_0x28bff9[_0xd3d3('0x50')]['fields']));_0x403568['attributes']=_0x403568['attributes'][_0xd3d3('0x53')]?_0x403568[_0xd3d3('0x52')]:_0x243ba1['model'];_0x403568[_0xd3d3('0x54')]=qs[_0xd3d3('0x55')](_0x28bff9['query'][_0xd3d3('0x55')]);_0x403568[_0xd3d3('0x56')]=qs[_0xd3d3('0x4f')](_[_0xd3d3('0x57')](_0x28bff9[_0xd3d3('0x50')],_0x243ba1[_0xd3d3('0x4f')]));if(_0x28bff9[_0xd3d3('0x50')]['filter']){_0x403568[_0xd3d3('0x56')]=_[_0xd3d3('0x58')](_0x403568[_0xd3d3('0x56')],{'$or':_['map'](_0x403568[_0xd3d3('0x52')],function(_0x17b574){var _0x148ddc={};_0x148ddc[_0x17b574]={'$like':'%'+_0x28bff9[_0xd3d3('0x50')]['filter']+'%'};return _0x148ddc;})});}_0x403568=_[_0xd3d3('0x58')]({},_0x403568,_0x28bff9[_0xd3d3('0x64')]);return _0x2d35ca[_0xd3d3('0xbf')](_0x403568);}})[_0xd3d3('0x22')](function(_0x189bd1){if(_0x189bd1){_0xf6c1dc=_0x189bd1[_0xd3d3('0x53')];if(!_0x28bff9['query']['hasOwnProperty'](_0xd3d3('0xbc'))){_0x403568['limit']=qs[_0xd3d3('0x34')](_0x28bff9[_0xd3d3('0x50')][_0xd3d3('0x34')]);_0x403568[_0xd3d3('0x33')]=qs['offset'](_0x28bff9[_0xd3d3('0x50')][_0xd3d3('0x33')]);}return _0x2d35ca[_0xd3d3('0xbf')](_0x403568);}})[_0xd3d3('0x22')](function(_0x55ffb1){if(_0x55ffb1){return _0x55ffb1?{'count':_0xf6c1dc,'rows':_0x55ffb1}:null;}})[_0xd3d3('0x22')](respondWithResult(_0x312950,null))[_0xd3d3('0x2d')](handleError(_0x312950,null));};exports['getGroups']=function(_0x2d05e9,_0x2a0ceb,_0x289ffb){var _0x14ae91={};var _0x1d66e4={};var _0x474ddc;var _0x28039b;return db['User'][_0xd3d3('0x89')]({'where':{'id':_0x2d05e9[_0xd3d3('0x5f')]['id']}})[_0xd3d3('0x22')](handleEntityNotFound(_0x2a0ceb,null))[_0xd3d3('0x22')](function(_0x986ad0){if(_0x986ad0){_0x474ddc=_0x986ad0;_0x1d66e4[_0xd3d3('0x4b')]=_[_0xd3d3('0x4e')](db[_0xd3d3('0xc0')][_0xd3d3('0x60')]);_0x1d66e4['query']=_[_0xd3d3('0x4e')](_0x2d05e9[_0xd3d3('0x50')]);_0x1d66e4[_0xd3d3('0x4f')]=_[_0xd3d3('0x62')](_0x1d66e4['model'],_0x1d66e4[_0xd3d3('0x50')]);_0x14ae91[_0xd3d3('0x52')]=_[_0xd3d3('0x62')](_0x1d66e4[_0xd3d3('0x4b')],qs['fields'](_0x2d05e9[_0xd3d3('0x50')][_0xd3d3('0x51')]));_0x14ae91['attributes']=_0x14ae91['attributes']['length']?_0x14ae91['attributes']:_0x1d66e4[_0xd3d3('0x4b')];_0x14ae91['order']=qs['sort'](_0x2d05e9['query'][_0xd3d3('0x55')]);_0x14ae91[_0xd3d3('0x56')]=qs[_0xd3d3('0x4f')](_['pick'](_0x2d05e9[_0xd3d3('0x50')],_0x1d66e4[_0xd3d3('0x4f')]));if(_0x2d05e9[_0xd3d3('0x50')][_0xd3d3('0x3f')]){_0x14ae91[_0xd3d3('0x56')]=_['merge'](_0x14ae91[_0xd3d3('0x56')],{'$or':_[_0xd3d3('0x41')](_0x14ae91[_0xd3d3('0x52')],function(_0x4ef42a){var _0x319852={};_0x319852[_0x4ef42a]={'$like':'%'+_0x2d05e9[_0xd3d3('0x50')]['filter']+'%'};return _0x319852;})});}_0x14ae91=_['merge']({},_0x14ae91,_0x2d05e9[_0xd3d3('0x64')]);return _0x474ddc[_0xd3d3('0xc1')](_0x14ae91);}})[_0xd3d3('0x22')](function(_0x132491){if(_0x132491){_0x28039b=_0x132491[_0xd3d3('0x53')];if(!_0x2d05e9[_0xd3d3('0x50')][_0xd3d3('0xb5')](_0xd3d3('0xbc'))){_0x14ae91[_0xd3d3('0x34')]=qs['limit'](_0x2d05e9[_0xd3d3('0x50')][_0xd3d3('0x34')]);_0x14ae91[_0xd3d3('0x33')]=qs[_0xd3d3('0x33')](_0x2d05e9[_0xd3d3('0x50')][_0xd3d3('0x33')]);}return _0x474ddc['getGroups'](_0x14ae91);}})['then'](function(_0x519b87){if(_0x519b87){return _0x519b87?{'count':_0x28039b,'rows':_0x519b87}:null;}})[_0xd3d3('0x22')](respondWithResult(_0x2a0ceb,null))[_0xd3d3('0x2d')](handleError(_0x2a0ceb,null));};exports[_0xd3d3('0xc2')]=function(_0x4d9787,_0x11609f,_0x4c8237){var _0x286df6={'raw':!![],'where':{}};var _0x51b5b3={};var _0x30c4ea={'count':0x0,'rows':[]};return db[_0xd3d3('0x5c')][_0xd3d3('0x89')]({'where':{'id':_0x4d9787[_0xd3d3('0x5f')]['id']}})['then'](handleEntityNotFound(_0x11609f,null))[_0xd3d3('0x22')](function(_0x5c7efe){if(_0x5c7efe){_0x51b5b3[_0xd3d3('0x4b')]=_['keys'](db[_0xd3d3('0xc3')][_0xd3d3('0x60')]);_0x51b5b3[_0xd3d3('0x50')]=_[_0xd3d3('0x4e')](_0x4d9787[_0xd3d3('0x50')]);_0x51b5b3[_0xd3d3('0x4f')]=_[_0xd3d3('0x62')](_0x51b5b3[_0xd3d3('0x4b')],_0x51b5b3['query']);_0x286df6['attributes']=_['intersection'](_0x51b5b3['model'],qs[_0xd3d3('0x51')](_0x4d9787[_0xd3d3('0x50')][_0xd3d3('0x51')]));_0x286df6[_0xd3d3('0x52')]=_0x286df6[_0xd3d3('0x52')][_0xd3d3('0x53')]?_0x286df6['attributes']:_0x51b5b3[_0xd3d3('0x4b')];if(!_0x4d9787[_0xd3d3('0x50')][_0xd3d3('0xb5')](_0xd3d3('0xbc'))){_0x286df6[_0xd3d3('0x34')]=qs['limit'](_0x4d9787[_0xd3d3('0x50')][_0xd3d3('0x34')]);_0x286df6[_0xd3d3('0x33')]=qs[_0xd3d3('0x33')](_0x4d9787[_0xd3d3('0x50')]['offset']);}_0x286df6[_0xd3d3('0x54')]=qs[_0xd3d3('0x55')](_0x4d9787[_0xd3d3('0x50')][_0xd3d3('0x55')]);_0x286df6[_0xd3d3('0x56')]=qs['filters'](_[_0xd3d3('0x57')](_0x4d9787[_0xd3d3('0x50')],_0x51b5b3[_0xd3d3('0x4f')]));_0x286df6['where'][_0xd3d3('0xc4')]=_0x5c7efe['id'];if(_0x4d9787[_0xd3d3('0x50')][_0xd3d3('0x3f')]){_0x286df6[_0xd3d3('0x56')]=_[_0xd3d3('0x58')](_0x286df6[_0xd3d3('0x56')],{'$or':_['map'](_0x286df6[_0xd3d3('0x52')],function(_0x2c793b){var _0x4780c9={};_0x4780c9[_0x2c793b]={'$like':'%'+_0x4d9787[_0xd3d3('0x50')]['filter']+'%'};return _0x4780c9;})});}_0x286df6=_[_0xd3d3('0x58')]({},_0x286df6,_0x4d9787[_0xd3d3('0x64')]);return db[_0xd3d3('0xc3')][_0xd3d3('0x32')]({'where':_0x286df6[_0xd3d3('0x56')]})[_0xd3d3('0x22')](function(_0x38a845){_0x30c4ea[_0xd3d3('0x32')]=_0x38a845;if(_0x4d9787[_0xd3d3('0x50')]['includeAll']){_0x286df6[_0xd3d3('0x63')]=[{'all':!![]}];}return db[_0xd3d3('0xc3')][_0xd3d3('0xa2')](_0x286df6);})[_0xd3d3('0x22')](function(_0x1c7c39){_0x30c4ea[_0xd3d3('0x5e')]=_0x1c7c39;return _0x30c4ea;});}})[_0xd3d3('0x22')](respondWithFilteredResult(_0x11609f,_0x286df6))['catch'](handleError(_0x11609f,null));};exports[_0xd3d3('0xc5')]=function(_0x45d4d3,_0x4896e2,_0x18d1bc){var _0x14c55a={'raw':!![],'where':{}};var _0x5b4754={};var _0x1db66a={'count':0x0,'rows':[]};return db[_0xd3d3('0x5c')][_0xd3d3('0x89')]({'where':{'id':_0x45d4d3[_0xd3d3('0x5f')]['id']}})['then'](handleEntityNotFound(_0x4896e2,null))[_0xd3d3('0x22')](function(_0x52cfa6){if(_0x52cfa6){_0x5b4754[_0xd3d3('0x4b')]=_['keys'](db[_0xd3d3('0xc6')][_0xd3d3('0x60')]);_0x5b4754['query']=_[_0xd3d3('0x4e')](_0x45d4d3[_0xd3d3('0x50')]);_0x5b4754[_0xd3d3('0x4f')]=_[_0xd3d3('0x62')](_0x5b4754[_0xd3d3('0x4b')],_0x5b4754[_0xd3d3('0x50')]);_0x14c55a['attributes']=_[_0xd3d3('0x62')](_0x5b4754[_0xd3d3('0x4b')],qs[_0xd3d3('0x51')](_0x45d4d3[_0xd3d3('0x50')]['fields']));_0x14c55a[_0xd3d3('0x52')]=_0x14c55a[_0xd3d3('0x52')]['length']?_0x14c55a[_0xd3d3('0x52')]:_0x5b4754[_0xd3d3('0x4b')];if(!_0x45d4d3[_0xd3d3('0x50')][_0xd3d3('0xb5')]('nolimit')){_0x14c55a[_0xd3d3('0x34')]=qs[_0xd3d3('0x34')](_0x45d4d3[_0xd3d3('0x50')][_0xd3d3('0x34')]);_0x14c55a[_0xd3d3('0x33')]=qs['offset'](_0x45d4d3[_0xd3d3('0x50')]['offset']);}_0x14c55a[_0xd3d3('0x54')]=qs[_0xd3d3('0x55')](_0x45d4d3[_0xd3d3('0x50')][_0xd3d3('0x55')]);_0x14c55a[_0xd3d3('0x56')]=qs[_0xd3d3('0x4f')](_[_0xd3d3('0x57')](_0x45d4d3[_0xd3d3('0x50')],_0x5b4754[_0xd3d3('0x4f')]));_0x14c55a[_0xd3d3('0x56')]['UserId']=_0x52cfa6['id'];if(_0x45d4d3[_0xd3d3('0x50')][_0xd3d3('0x3f')]){_0x14c55a[_0xd3d3('0x56')]=_['merge'](_0x14c55a[_0xd3d3('0x56')],{'$or':_[_0xd3d3('0x41')](_0x14c55a['attributes'],function(_0x4240dd){var _0x2c68b0={};_0x2c68b0[_0x4240dd]={'$like':'%'+_0x45d4d3[_0xd3d3('0x50')]['filter']+'%'};return _0x2c68b0;})});}_0x14c55a=_['merge']({},_0x14c55a,_0x45d4d3[_0xd3d3('0x64')]);return db['ScreenRecording'][_0xd3d3('0x32')]({'where':_0x14c55a[_0xd3d3('0x56')]})[_0xd3d3('0x22')](function(_0x2a5fe5){_0x1db66a[_0xd3d3('0x32')]=_0x2a5fe5;if(_0x45d4d3[_0xd3d3('0x50')][_0xd3d3('0x5d')]){_0x14c55a[_0xd3d3('0x63')]=[{'all':!![]}];}return db[_0xd3d3('0xc6')][_0xd3d3('0xa2')](_0x14c55a);})[_0xd3d3('0x22')](function(_0x554ef7){_0x1db66a['rows']=_0x554ef7;return _0x1db66a;});}})['then'](respondWithFilteredResult(_0x4896e2,_0x14c55a))['catch'](handleError(_0x4896e2,null));};exports[_0xd3d3('0xc7')]=function(_0x41499f,_0x1b10c3,_0x3ed252){var _0x1e80de={};var _0x155dd4={};var _0x4caa0b;var _0x15b719;return db['User']['findOne']({'where':{'id':_0x41499f[_0xd3d3('0x5f')]['id']}})[_0xd3d3('0x22')](handleEntityNotFound(_0x1b10c3,null))[_0xd3d3('0x22')](function(_0x224564){if(_0x224564){_0x4caa0b=_0x224564;_0x155dd4[_0xd3d3('0x4b')]=_[_0xd3d3('0x4e')](db[_0xd3d3('0xc8')][_0xd3d3('0x60')]);_0x155dd4['query']=_[_0xd3d3('0x4e')](_0x41499f[_0xd3d3('0x50')]);_0x155dd4['filters']=_[_0xd3d3('0x62')](_0x155dd4[_0xd3d3('0x4b')],_0x155dd4[_0xd3d3('0x50')]);_0x1e80de[_0xd3d3('0x52')]=_[_0xd3d3('0x62')](_0x155dd4[_0xd3d3('0x4b')],qs[_0xd3d3('0x51')](_0x41499f[_0xd3d3('0x50')][_0xd3d3('0x51')]));_0x1e80de[_0xd3d3('0x52')]=_0x1e80de[_0xd3d3('0x52')]['length']?_0x1e80de[_0xd3d3('0x52')]:_0x155dd4[_0xd3d3('0x4b')];_0x1e80de[_0xd3d3('0x54')]=qs['sort'](_0x41499f[_0xd3d3('0x50')][_0xd3d3('0x55')]);_0x1e80de['where']=qs['filters'](_['pick'](_0x41499f[_0xd3d3('0x50')],_0x155dd4[_0xd3d3('0x4f')]));if(_0x41499f[_0xd3d3('0x50')][_0xd3d3('0x3f')]){_0x1e80de['where']=_[_0xd3d3('0x58')](_0x1e80de[_0xd3d3('0x56')],{'$or':_[_0xd3d3('0x41')](_0x1e80de['attributes'],function(_0x422452){var _0x548179={};_0x548179[_0x422452]={'$like':'%'+_0x41499f[_0xd3d3('0x50')]['filter']+'%'};return _0x548179;})});}_0x1e80de=_[_0xd3d3('0x58')]({},_0x1e80de,_0x41499f[_0xd3d3('0x64')]);return _0x4caa0b[_0xd3d3('0xc7')](_0x1e80de);}})[_0xd3d3('0x22')](function(_0x459888){if(_0x459888){_0x15b719=_0x459888[_0xd3d3('0x53')];if(!_0x41499f[_0xd3d3('0x50')]['hasOwnProperty']('nolimit')){_0x1e80de[_0xd3d3('0x34')]=qs[_0xd3d3('0x34')](_0x41499f[_0xd3d3('0x50')]['limit']);_0x1e80de['offset']=qs[_0xd3d3('0x33')](_0x41499f[_0xd3d3('0x50')]['offset']);}return _0x4caa0b[_0xd3d3('0xc7')](_0x1e80de);}})[_0xd3d3('0x22')](function(_0x1268f0){if(_0x1268f0){return _0x1268f0?{'count':_0x15b719,'rows':_0x1268f0}:null;}})['then'](respondWithResult(_0x1b10c3,null))[_0xd3d3('0x2d')](handleError(_0x1b10c3,null));};exports[_0xd3d3('0xc9')]=function(_0x4cdcbe,_0x2b8c14,_0x4a9af1){var _0x35f9f9={};var _0x5554da={};var _0x1de157;var _0xfc5ef6;return db[_0xd3d3('0x5c')][_0xd3d3('0x89')]({'where':{'id':_0x4cdcbe[_0xd3d3('0x5f')]['id']}})[_0xd3d3('0x22')](handleEntityNotFound(_0x2b8c14,null))[_0xd3d3('0x22')](function(_0x3dbd5e){if(_0x3dbd5e){_0x1de157=_0x3dbd5e;_0x5554da['model']=_['keys'](db['OpenchannelInteraction'][_0xd3d3('0x60')]);_0x5554da[_0xd3d3('0x50')]=_[_0xd3d3('0x4e')](_0x4cdcbe[_0xd3d3('0x50')]);_0x5554da[_0xd3d3('0x4f')]=_['intersection'](_0x5554da['model'],_0x5554da[_0xd3d3('0x50')]);_0x35f9f9[_0xd3d3('0x52')]=_[_0xd3d3('0x62')](_0x5554da[_0xd3d3('0x4b')],qs[_0xd3d3('0x51')](_0x4cdcbe[_0xd3d3('0x50')][_0xd3d3('0x51')]));_0x35f9f9['attributes']=_0x35f9f9[_0xd3d3('0x52')][_0xd3d3('0x53')]?_0x35f9f9[_0xd3d3('0x52')]:_0x5554da[_0xd3d3('0x4b')];_0x35f9f9[_0xd3d3('0x54')]=qs[_0xd3d3('0x55')](_0x4cdcbe[_0xd3d3('0x50')][_0xd3d3('0x55')]);_0x35f9f9[_0xd3d3('0x56')]=qs[_0xd3d3('0x4f')](_[_0xd3d3('0x57')](_0x4cdcbe[_0xd3d3('0x50')],_0x5554da[_0xd3d3('0x4f')]));if(_0x4cdcbe[_0xd3d3('0x50')]['filter']){_0x35f9f9[_0xd3d3('0x56')]=_[_0xd3d3('0x58')](_0x35f9f9[_0xd3d3('0x56')],{'$or':_[_0xd3d3('0x41')](_0x35f9f9['attributes'],function(_0x207bfd){var _0x4c3d0a={};_0x4c3d0a[_0x207bfd]={'$like':'%'+_0x4cdcbe['query'][_0xd3d3('0x3f')]+'%'};return _0x4c3d0a;})});}_0x35f9f9=_[_0xd3d3('0x58')]({},_0x35f9f9,_0x4cdcbe[_0xd3d3('0x64')]);return _0x1de157[_0xd3d3('0xc9')](_0x35f9f9);}})[_0xd3d3('0x22')](function(_0x4a249d){if(_0x4a249d){_0xfc5ef6=_0x4a249d[_0xd3d3('0x53')];if(!_0x4cdcbe[_0xd3d3('0x50')]['hasOwnProperty'](_0xd3d3('0xbc'))){_0x35f9f9[_0xd3d3('0x34')]=qs[_0xd3d3('0x34')](_0x4cdcbe[_0xd3d3('0x50')]['limit']);_0x35f9f9[_0xd3d3('0x33')]=qs[_0xd3d3('0x33')](_0x4cdcbe[_0xd3d3('0x50')][_0xd3d3('0x33')]);}return _0x1de157[_0xd3d3('0xc9')](_0x35f9f9);}})[_0xd3d3('0x22')](function(_0x515eb6){if(_0x515eb6){return _0x515eb6?{'count':_0xfc5ef6,'rows':_0x515eb6}:null;}})[_0xd3d3('0x22')](respondWithResult(_0x2b8c14,null))[_0xd3d3('0x2d')](handleError(_0x2b8c14,null));};exports[_0xd3d3('0xca')]=function(_0x20cc7f,_0x4fa098,_0x227c18){var _0x48fbeb={'raw':!![],'where':{}};var _0x3134b8={};var _0x1f3b2a={'count':0x0,'rows':[]};return db[_0xd3d3('0x5c')]['findOne']({'where':{'id':_0x20cc7f[_0xd3d3('0x5f')]['id']}})[_0xd3d3('0x22')](handleEntityNotFound(_0x4fa098,null))[_0xd3d3('0x22')](function(_0x5c800c){if(_0x5c800c){_0x3134b8[_0xd3d3('0x4b')]=_[_0xd3d3('0x4e')](db[_0xd3d3('0xcb')][_0xd3d3('0x60')]);_0x3134b8[_0xd3d3('0x50')]=_[_0xd3d3('0x4e')](_0x20cc7f[_0xd3d3('0x50')]);_0x3134b8[_0xd3d3('0x4f')]=_[_0xd3d3('0x62')](_0x3134b8[_0xd3d3('0x4b')],_0x3134b8[_0xd3d3('0x50')]);_0x48fbeb['attributes']=_[_0xd3d3('0x62')](_0x3134b8[_0xd3d3('0x4b')],qs[_0xd3d3('0x51')](_0x20cc7f['query'][_0xd3d3('0x51')]));_0x48fbeb[_0xd3d3('0x52')]=_0x48fbeb[_0xd3d3('0x52')]['length']?_0x48fbeb[_0xd3d3('0x52')]:_0x3134b8['model'];if(!_0x20cc7f[_0xd3d3('0x50')][_0xd3d3('0xb5')](_0xd3d3('0xbc'))){_0x48fbeb['limit']=qs[_0xd3d3('0x34')](_0x20cc7f[_0xd3d3('0x50')][_0xd3d3('0x34')]);_0x48fbeb[_0xd3d3('0x33')]=qs[_0xd3d3('0x33')](_0x20cc7f['query'][_0xd3d3('0x33')]);}_0x48fbeb[_0xd3d3('0x54')]=qs['sort'](_0x20cc7f[_0xd3d3('0x50')][_0xd3d3('0x55')]);_0x48fbeb[_0xd3d3('0x56')]=qs[_0xd3d3('0x4f')](_[_0xd3d3('0x57')](_0x20cc7f[_0xd3d3('0x50')],_0x3134b8[_0xd3d3('0x4f')]));_0x48fbeb['where'][_0xd3d3('0xc4')]=_0x5c800c['id'];if(_0x20cc7f[_0xd3d3('0x50')][_0xd3d3('0x3f')]){_0x48fbeb[_0xd3d3('0x56')]=_[_0xd3d3('0x58')](_0x48fbeb[_0xd3d3('0x56')],{'$or':_['map'](_0x48fbeb[_0xd3d3('0x52')],function(_0x1ece14){var _0xb87eea={};_0xb87eea[_0x1ece14]={'$like':'%'+_0x20cc7f[_0xd3d3('0x50')][_0xd3d3('0x3f')]+'%'};return _0xb87eea;})});}_0x48fbeb=_[_0xd3d3('0x58')]({},_0x48fbeb,_0x20cc7f['options']);return db[_0xd3d3('0xcb')][_0xd3d3('0x32')]({'where':_0x48fbeb['where']})[_0xd3d3('0x22')](function(_0x2c90b4){_0x1f3b2a['count']=_0x2c90b4;if(_0x20cc7f['query'][_0xd3d3('0x5d')]){_0x48fbeb[_0xd3d3('0x63')]=[{'all':!![]}];}return db[_0xd3d3('0xcb')][_0xd3d3('0xa2')](_0x48fbeb);})['then'](function(_0x5e501a){_0x1f3b2a[_0xd3d3('0x5e')]=_0x5e501a;return _0x1f3b2a;});}})[_0xd3d3('0x22')](respondWithFilteredResult(_0x4fa098,_0x48fbeb))[_0xd3d3('0x2d')](handleError(_0x4fa098,null));};exports[_0xd3d3('0xcc')]=function(_0x1021f2,_0x4c993f,_0xadc429){var _0x54184a={};var _0xd67b8a={};var _0x3d2f63;var _0x124949;return db['User'][_0xd3d3('0x89')]({'where':{'id':_0x1021f2['params']['id']}})[_0xd3d3('0x22')](handleEntityNotFound(_0x4c993f,null))[_0xd3d3('0x22')](function(_0x273031){if(_0x273031){_0x3d2f63=_0x273031;_0xd67b8a['model']=_['keys'](db[_0xd3d3('0xcd')][_0xd3d3('0x60')]);_0xd67b8a[_0xd3d3('0x50')]=_[_0xd3d3('0x4e')](_0x1021f2[_0xd3d3('0x50')]);_0xd67b8a[_0xd3d3('0x4f')]=_[_0xd3d3('0x62')](_0xd67b8a['model'],_0xd67b8a[_0xd3d3('0x50')]);_0x54184a['attributes']=_['intersection'](_0xd67b8a[_0xd3d3('0x4b')],qs['fields'](_0x1021f2[_0xd3d3('0x50')][_0xd3d3('0x51')]));_0x54184a[_0xd3d3('0x52')]=_0x54184a[_0xd3d3('0x52')][_0xd3d3('0x53')]?_0x54184a[_0xd3d3('0x52')]:_0xd67b8a['model'];_0x54184a[_0xd3d3('0x54')]=qs[_0xd3d3('0x55')](_0x1021f2['query'][_0xd3d3('0x55')]);_0x54184a[_0xd3d3('0x56')]=qs['filters'](_[_0xd3d3('0x57')](_0x1021f2['query'],_0xd67b8a[_0xd3d3('0x4f')]));if(_0x1021f2[_0xd3d3('0x50')][_0xd3d3('0x3f')]){_0x54184a[_0xd3d3('0x56')]=_[_0xd3d3('0x58')](_0x54184a[_0xd3d3('0x56')],{'$or':_[_0xd3d3('0x41')](_0x54184a[_0xd3d3('0x52')],function(_0x39222){var _0x520fc5={};_0x520fc5[_0x39222]={'$like':'%'+_0x1021f2['query']['filter']+'%'};return _0x520fc5;})});}_0x54184a=_[_0xd3d3('0x58')]({},_0x54184a,_0x1021f2[_0xd3d3('0x64')]);return _0x3d2f63[_0xd3d3('0xcc')](_0x54184a);}})[_0xd3d3('0x22')](function(_0x5f4490){if(_0x5f4490){_0x124949=_0x5f4490[_0xd3d3('0x53')];if(!_0x1021f2[_0xd3d3('0x50')][_0xd3d3('0xb5')](_0xd3d3('0xbc'))){_0x54184a[_0xd3d3('0x34')]=qs[_0xd3d3('0x34')](_0x1021f2[_0xd3d3('0x50')][_0xd3d3('0x34')]);_0x54184a[_0xd3d3('0x33')]=qs[_0xd3d3('0x33')](_0x1021f2['query']['offset']);}return _0x3d2f63[_0xd3d3('0xcc')](_0x54184a);}})[_0xd3d3('0x22')](function(_0x29ed43){if(_0x29ed43){return _0x29ed43?{'count':_0x124949,'rows':_0x29ed43}:null;}})[_0xd3d3('0x22')](respondWithResult(_0x4c993f,null))['catch'](handleError(_0x4c993f,null));};exports['getFaxInteractions']=function(_0x2f1f94,_0x15bf85,_0x207ee7){var _0x414ca4={};var _0x1e514f={};var _0x29441a;var _0x591dcc;return db['User'][_0xd3d3('0x89')]({'where':{'id':_0x2f1f94[_0xd3d3('0x5f')]['id']}})[_0xd3d3('0x22')](handleEntityNotFound(_0x15bf85,null))['then'](function(_0x50eff6){if(_0x50eff6){_0x29441a=_0x50eff6;_0x1e514f[_0xd3d3('0x4b')]=_[_0xd3d3('0x4e')](db[_0xd3d3('0xce')][_0xd3d3('0x60')]);_0x1e514f[_0xd3d3('0x50')]=_[_0xd3d3('0x4e')](_0x2f1f94[_0xd3d3('0x50')]);_0x1e514f['filters']=_[_0xd3d3('0x62')](_0x1e514f[_0xd3d3('0x4b')],_0x1e514f['query']);_0x414ca4[_0xd3d3('0x52')]=_[_0xd3d3('0x62')](_0x1e514f['model'],qs['fields'](_0x2f1f94[_0xd3d3('0x50')]['fields']));_0x414ca4[_0xd3d3('0x52')]=_0x414ca4[_0xd3d3('0x52')]['length']?_0x414ca4[_0xd3d3('0x52')]:_0x1e514f[_0xd3d3('0x4b')];_0x414ca4[_0xd3d3('0x54')]=qs[_0xd3d3('0x55')](_0x2f1f94['query'][_0xd3d3('0x55')]);_0x414ca4[_0xd3d3('0x56')]=qs[_0xd3d3('0x4f')](_['pick'](_0x2f1f94[_0xd3d3('0x50')],_0x1e514f[_0xd3d3('0x4f')]));if(_0x2f1f94[_0xd3d3('0x50')][_0xd3d3('0x3f')]){_0x414ca4[_0xd3d3('0x56')]=_['merge'](_0x414ca4['where'],{'$or':_['map'](_0x414ca4[_0xd3d3('0x52')],function(_0x352ddb){var _0x12296e={};_0x12296e[_0x352ddb]={'$like':'%'+_0x2f1f94[_0xd3d3('0x50')][_0xd3d3('0x3f')]+'%'};return _0x12296e;})});}_0x414ca4=_['merge']({},_0x414ca4,_0x2f1f94[_0xd3d3('0x64')]);return _0x29441a['getFaxInteractions'](_0x414ca4);}})[_0xd3d3('0x22')](function(_0x58945a){if(_0x58945a){_0x591dcc=_0x58945a['length'];if(!_0x2f1f94['query'][_0xd3d3('0xb5')]('nolimit')){_0x414ca4[_0xd3d3('0x34')]=qs[_0xd3d3('0x34')](_0x2f1f94[_0xd3d3('0x50')][_0xd3d3('0x34')]);_0x414ca4[_0xd3d3('0x33')]=qs[_0xd3d3('0x33')](_0x2f1f94[_0xd3d3('0x50')][_0xd3d3('0x33')]);}return _0x29441a[_0xd3d3('0xcf')](_0x414ca4);}})[_0xd3d3('0x22')](function(_0x452aaf){if(_0x452aaf){return _0x452aaf?{'count':_0x591dcc,'rows':_0x452aaf}:null;}})[_0xd3d3('0x22')](respondWithResult(_0x15bf85,null))[_0xd3d3('0x2d')](handleError(_0x15bf85,null));};exports[_0xd3d3('0xd0')]=function(_0x56b834,_0x5ac6aa,_0x349856){var _0x6ceb08;var _0x154365;var _0x56ec4d;var _0x716f54=!_[_0xd3d3('0x72')](_0x56b834['params']['id'])?_0x56b834['params']['id']:!_['isNil'](_0x56b834[_0xd3d3('0x3a')]['id'])?_0x56b834[_0xd3d3('0x3a')]['id']:null;return db[_0xd3d3('0x5c')][_0xd3d3('0x45')]({'where':{'id':_0x716f54,'role':{'$or':[_0xd3d3('0x91'),_0xd3d3('0x3a'),_0xd3d3('0x3c')]}},'attributes':['id',_0xd3d3('0x46'),'phone',_0xd3d3('0xd1'),'role',_0xd3d3('0x70'),_0xd3d3('0x95')]})[_0xd3d3('0x22')](function(_0x2980a0){if(_0x2980a0){if(_0x2980a0['role']===_0xd3d3('0x3c')){_0x6ceb08=_0x2980a0;if(_0x56b834[_0xd3d3('0x65')][_0xd3d3('0x97')]){_0x56ec4d=util[_0xd3d3('0x6d')](_0xd3d3('0xd2'),_0x6ceb08[_0x56b834[_0xd3d3('0x65')][_0xd3d3('0x97')]]);}else if(_0x56b834[_0xd3d3('0x65')][_0xd3d3('0xd3')]){_0x56ec4d=util['format'](_0xd3d3('0xa3'),_0x56b834[_0xd3d3('0x65')]['intrf']);}else{_0x56ec4d=util[_0xd3d3('0x6d')](_0xd3d3('0xa3'),_0x6ceb08[_0xd3d3('0x46')]);}socket['to'](util[_0xd3d3('0x6d')](_0xd3d3('0xd4'),_0x6ceb08[_0xd3d3('0x46')]))[_0xd3d3('0x9e')](_0xd3d3('0xd5'),{'ip':_0x56b834[_0xd3d3('0xd6')][_0xd3d3('0xd7')]||_0x56b834['connection']['remoteAddress']||_0x56b834[_0xd3d3('0xd8')][_0xd3d3('0xd9')]||_0x56b834['connection'][_0xd3d3('0xd8')][_0xd3d3('0xd9')]});return db[_0xd3d3('0xda')]['destroy']({'where':{'membername':_0x6ceb08['name']},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0xd3d3('0x21'))](_0xd3d3('0xdb'));}})[_0xd3d3('0x22')](function(){if(_0x6ceb08){return _0x6ceb08[_0xd3d3('0xdc')]({'raw':!![]});}})['then'](function(_0x5e5a01){if(_0x6ceb08){var _0x409d39=[];if(_0x5e5a01){_0x154365=_0x5e5a01;if(_0x154365['length']){for(var _0xecec5b=0x0;_0xecec5b<_0x154365[_0xd3d3('0x53')];_0xecec5b++){_0x409d39[_0xd3d3('0xdd')]({'membername':_0x6ceb08['name'],'UserId':_0x6ceb08['id'],'queue_name':_0x154365[_0xecec5b][_0xd3d3('0x46')],'VoiceQueueId':_0x154365[_0xecec5b]['id'],'interface':_0x56ec4d,'paused':_0x6ceb08['loginInPause']||![],'penalty':_0x154365[_0xecec5b]['UserVoiceQueue.penalty']||0x0});}return BPromise[_0xd3d3('0xde')](_0x409d39,function(_0x2ee3c5){return db[_0xd3d3('0xda')][_0xd3d3('0xa5')](_0x2ee3c5);});}}}})[_0xd3d3('0x22')](function(){if(_0x6ceb08){return db[_0xd3d3('0xdf')][_0xd3d3('0xa2')]({'where':{'membername':_0x6ceb08[_0xd3d3('0x46')],'exitAt':null}});}})['then'](function(_0x2aa832){if(_0x6ceb08){var _0x149d87=[];_0x2aa832['forEach'](function(_0x2e1f6a){_0x149d87[_0xd3d3('0xdd')](_0x2e1f6a[_0xd3d3('0xe0')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xd3d3('0xe1')](_0x149d87);}})[_0xd3d3('0x22')](function(){if(_0x6ceb08){var _0x2ff598=[];var _0x5cf318=[];var _0x318186=utils[_0xd3d3('0xe2')]();var _0x2fbb39={'membername':_0x6ceb08[_0xd3d3('0x46')],'interface':_0x56ec4d,'enterAt':moment()[_0xd3d3('0x6d')](_0xd3d3('0xe3')),'role':_0x6ceb08[_0xd3d3('0x44')],'internal':_0x6ceb08[_0xd3d3('0x70')]};_0x318186[_0xd3d3('0xe4')](function(_0x11fba7){_0x2ff598[_0xd3d3('0xdd')](_['merge']({'channel':_0x11fba7,'type':'LOGIN','data1':_0x56b834[_0xd3d3('0x65')][_0xd3d3('0xe5')],'data2':_0x56ec4d},_0x2fbb39));if(_0x6ceb08[_0xd3d3('0x95')]){_0x5cf318[_0xd3d3('0xdd')](_[_0xd3d3('0x58')]({'channel':_0x11fba7,'type':_0xd3d3('0xe6'),'data1':_0xd3d3('0xe7')},_0x2fbb39));}});return db[_0xd3d3('0xdf')][_0xd3d3('0xe8')](_0x2ff598[_0xd3d3('0xe9')](_0x5cf318),{'individualHooks':!![]});}})['then'](function(){if(_0x6ceb08){return _0x6ceb08[_0xd3d3('0xe0')]({'online':!![],'lastLoginAt':moment()[_0xd3d3('0x6d')](_0xd3d3('0xe3')),'voicePause':_0x6ceb08[_0xd3d3('0x95')]||![],'mailPause':_0x6ceb08[_0xd3d3('0x95')]||![],'chatPause':_0x6ceb08[_0xd3d3('0x95')]||![],'faxPause':_0x6ceb08['loginInPause']||![],'smsPause':_0x6ceb08[_0xd3d3('0x95')]||![],'openchannelPause':_0x6ceb08[_0xd3d3('0x95')]||![],'pauseType':_0x6ceb08['loginInPause']?'LOGININPAUSE':null,'interface':_0x56ec4d,'lastPauseAt':moment()['format'](_0xd3d3('0xe3'))});}})[_0xd3d3('0x22')](function(_0x1341f8){if(_0x56b834[_0xd3d3('0xea')]){return _0x349856();}else{return BPromise['resolve'](_0x1341f8)[_0xd3d3('0x22')](respondWithResult(_0x5ac6aa,null));}})['catch'](handleError(_0x5ac6aa,null));};exports[_0xd3d3('0xeb')]=function(_0x58a2a5,_0x33876f,_0x2a4166){var _0x1bc599;return db[_0xd3d3('0x5c')][_0xd3d3('0x45')]({'where':{'id':_0x58a2a5[_0xd3d3('0x5f')]['id'],'role':'agent'},'attributes':['id',_0xd3d3('0x46'),_0xd3d3('0x44')]})[_0xd3d3('0x22')](handleEntityNotFound(_0x33876f,null))[_0xd3d3('0x22')](function(_0x156125){if(_0x156125){_0x1bc599=_0x156125;return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x1bc599[_0xd3d3('0x46')]},'individualHooks':!![]});}})[_0xd3d3('0x22')](function(){return db['MemberReport'][_0xd3d3('0xa2')]({'where':{'membername':_0x1bc599['name'],'exitAt':null}});})['then'](function(_0x94475f){var _0x1445c8=[];_0x94475f[_0xd3d3('0xe4')](function(_0x440497){_0x1445c8[_0xd3d3('0xdd')](_0x440497[_0xd3d3('0xe0')]({'exitAt':moment()[_0xd3d3('0x6d')](_0xd3d3('0xe3'))}));});return BPromise[_0xd3d3('0xe1')](_0x1445c8);})[_0xd3d3('0x22')](function(){return _0x1bc599[_0xd3d3('0xe0')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'interface':null});})['then'](respondWithResult(_0x33876f,null))[_0xd3d3('0x2d')](handleError(_0x33876f,null));};exports['pause']=function(_0x338913,_0x20fa04,_0x3587fe){var _0x491bf2;return db['UserVoiceQueueRt'][_0xd3d3('0xe0')]({'paused':0x1},{'where':{'UserId':_0x338913['params']['id']},'individualHooks':!![]})[_0xd3d3('0x22')](function(){return db[_0xd3d3('0x5c')]['find']({'where':{'id':_0x338913[_0xd3d3('0x5f')]['id'],'role':_0xd3d3('0x3c')},'attributes':['id',_0xd3d3('0x46'),_0xd3d3('0x44'),'internal','interface']});})['then'](handleEntityNotFound(_0x20fa04,null))[_0xd3d3('0x22')](function(_0x174671){if(_0x174671){_0x491bf2=_0x174671;return respondWithRpcPromise(_0xd3d3('0xec'),'pause',{'id':_0x491bf2['id'],'name':_0x491bf2[_0xd3d3('0x46')],'pause':!![]});}})[_0xd3d3('0x22')](function(){if(_0x491bf2){return db[_0xd3d3('0xdf')][_0xd3d3('0xa2')]({'where':{'membername':_0x491bf2[_0xd3d3('0x46')],'type':_0xd3d3('0xe6'),'exitAt':null}});}})[_0xd3d3('0x22')](function(_0x59e977){if(_0x59e977['length']){var _0x24f03c=moment()[_0xd3d3('0x6d')](_0xd3d3('0xe3'));for(var _0x119ad5=0x0,_0x47c810=_0x59e977[_0xd3d3('0x53')];_0x119ad5<_0x47c810;_0x119ad5++){_0x59e977[_0x119ad5][_0xd3d3('0xed')]({'exitAt':_0x24f03c});}}})[_0xd3d3('0x22')](function(){var _0x4a875c=[];var _0xc17792=utils[_0xd3d3('0xe2')]();_0xc17792['forEach'](function(_0x4c38ca){_0x4a875c[_0xd3d3('0xdd')]({'channel':_0x4c38ca,'membername':_0x491bf2[_0xd3d3('0x46')],'interface':_['isNil'](_0x491bf2[_0xd3d3('0x97')])?util[_0xd3d3('0x6d')](_0xd3d3('0xa3'),_0x491bf2[_0xd3d3('0x46')]):_0x491bf2[_0xd3d3('0x97')],'type':_0xd3d3('0xe6'),'enterAt':moment()[_0xd3d3('0x6d')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x338913[_0xd3d3('0x65')][_0xd3d3('0xee')]||_0xd3d3('0xef'),'role':_0x491bf2[_0xd3d3('0x44')],'internal':_0x491bf2['internal']});});return db[_0xd3d3('0xdf')][_0xd3d3('0xe8')](_0x4a875c,{'individualHooks':!![]});})['then'](function(){return _0x491bf2[_0xd3d3('0xe0')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x338913[_0xd3d3('0x65')][_0xd3d3('0xee')]||_0xd3d3('0xef'),'lastPauseAt':moment()['format'](_0xd3d3('0xe3'))});})['then'](respondWithResult(_0x20fa04,null))[_0xd3d3('0x2d')](handleError(_0x20fa04,null));};exports['unpause']=function(_0x5bf9c0,_0x19d9c0,_0x12ae2e){var _0x2bb5d2;return db[_0xd3d3('0x5c')][_0xd3d3('0x45')]({'where':{'id':_0x5bf9c0['params']['id']},'attributes':['id','name',_0xd3d3('0x44'),_0xd3d3('0x96'),'mailPause',_0xd3d3('0xf0'),_0xd3d3('0xf1'),_0xd3d3('0xf2'),_0xd3d3('0xf3'),_0xd3d3('0xf4'),_0xd3d3('0xf5')]})[_0xd3d3('0x22')](handleEntityNotFound(_0x19d9c0,null))['then'](function(_0xf0738d){if(_0xf0738d){_0x2bb5d2=_0xf0738d;if(_0x5bf9c0[_0xd3d3('0x65')]['channel']&&!utils[_0xd3d3('0x98')](_0x5bf9c0['body'][_0xd3d3('0x93')])){throw new db[(_0xd3d3('0x20'))][(_0xd3d3('0x21'))](_0xd3d3('0xa7'));}switch(_0x5bf9c0[_0xd3d3('0x65')]['channel']){case _0xd3d3('0xa0'):return respondWithRpcPromise(_0xd3d3('0xec'),_0xd3d3('0xf6'),{'id':_0x2bb5d2['id'],'name':_0x2bb5d2[_0xd3d3('0x46')],'pause':![]})[_0xd3d3('0x22')](function(){return db['UserVoiceQueueRt'][_0xd3d3('0xe0')]({'paused':0x0},{'where':{'UserId':_0x2bb5d2['id']},'individualHooks':!![]});})[_0xd3d3('0x22')](function(){return db[_0xd3d3('0xdf')][_0xd3d3('0x45')]({'where':{'channel':_0x5bf9c0[_0xd3d3('0x65')][_0xd3d3('0x93')],'membername':_0x2bb5d2[_0xd3d3('0x46')],'type':_0xd3d3('0xe6'),'exitAt':null}});})[_0xd3d3('0x22')](function(_0x153efb){if(_0x153efb){return _0x153efb[_0xd3d3('0xe0')]({'exitAt':moment()[_0xd3d3('0x6d')](_0xd3d3('0xe3')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0xd3d3('0x22')](function(){return _0x2bb5d2[_0xd3d3('0xe0')]({'voicePause':![]});});case _0xd3d3('0xf7'):case _0xd3d3('0xf8'):case'fax':case _0xd3d3('0xf9'):case _0xd3d3('0xfa'):return db[_0xd3d3('0xdf')]['find']({'where':{'channel':_0x5bf9c0[_0xd3d3('0x65')][_0xd3d3('0x93')],'membername':_0x2bb5d2[_0xd3d3('0x46')],'type':_0xd3d3('0xe6'),'exitAt':null}})[_0xd3d3('0x22')](function(_0x3f4d88){if(_0x3f4d88){return _0x3f4d88[_0xd3d3('0xe0')]({'exitAt':moment()[_0xd3d3('0x6d')](_0xd3d3('0xe3')),'data2':_0xd3d3('0xfb')},{'individualHooks':!![]});}return null;})[_0xd3d3('0x22')](function(){var _0x19f462={};_['set'](_0x19f462,util[_0xd3d3('0x6d')]('%s%s',_0x5bf9c0[_0xd3d3('0x65')]['channel'],'Pause'),![]);return _0x2bb5d2['update'](_0x19f462);});default:return respondWithRpcPromise(_0xd3d3('0xec'),_0xd3d3('0xf6'),{'id':_0x2bb5d2['id'],'name':_0x2bb5d2[_0xd3d3('0x46')],'pause':![]})[_0xd3d3('0x22')](function(){return db[_0xd3d3('0xda')][_0xd3d3('0xe0')]({'paused':0x0},{'where':{'UserId':_0x2bb5d2['id']}});})[_0xd3d3('0x22')](function(){return db[_0xd3d3('0xdf')][_0xd3d3('0xa2')]({'where':{'membername':_0x2bb5d2[_0xd3d3('0x46')],'type':_0xd3d3('0xe6'),'exitAt':null}});})[_0xd3d3('0x22')](function(_0x194edf){var _0x140818=[];_0x194edf[_0xd3d3('0xe4')](function(_0xded843){_0x140818[_0xd3d3('0xdd')](_0xded843['update']({'exitAt':moment()[_0xd3d3('0x6d')](_0xd3d3('0xe3')),'data2':_0xd3d3('0xfb')}));});return BPromise[_0xd3d3('0xe1')](_0x140818);})[_0xd3d3('0x22')](function(){return _0x2bb5d2['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0xd3d3('0x22')](respondWithResult(_0x19d9c0,null))[_0xd3d3('0x2d')](handleError(_0x19d9c0,null));};exports[_0xd3d3('0xfc')]=function(_0x1cf065,_0x4c1095,_0x5cda1e){var _0x71b4d5={};var _0x194ef5={};var _0x55bd25;var _0xeb7515;return db[_0xd3d3('0x5c')][_0xd3d3('0x89')]({'where':{'id':_0x1cf065[_0xd3d3('0x5f')]['id']}})[_0xd3d3('0x22')](handleEntityNotFound(_0x4c1095,null))[_0xd3d3('0x22')](function(_0x4cac6a){if(_0x4cac6a){_0x55bd25=_0x4cac6a;_0x194ef5['model']=_[_0xd3d3('0x4e')](db[_0xd3d3('0xfd')][_0xd3d3('0x60')]);_0x194ef5[_0xd3d3('0x50')]=_['keys'](_0x1cf065[_0xd3d3('0x50')]);_0x194ef5[_0xd3d3('0x4f')]=_[_0xd3d3('0x62')](_0x194ef5[_0xd3d3('0x4b')],_0x194ef5[_0xd3d3('0x50')]);_0x71b4d5[_0xd3d3('0x52')]=_[_0xd3d3('0x62')](_0x194ef5['model'],qs['fields'](_0x1cf065['query'][_0xd3d3('0x51')]));_0x71b4d5['attributes']=_0x71b4d5[_0xd3d3('0x52')][_0xd3d3('0x53')]?_0x71b4d5[_0xd3d3('0x52')]:_0x194ef5[_0xd3d3('0x4b')];_0x71b4d5[_0xd3d3('0x54')]=qs[_0xd3d3('0x55')](_0x1cf065[_0xd3d3('0x50')][_0xd3d3('0x55')]);_0x71b4d5[_0xd3d3('0x56')]=qs['filters'](_['pick'](_0x1cf065[_0xd3d3('0x50')],_0x194ef5['filters']));if(_0x1cf065[_0xd3d3('0x50')][_0xd3d3('0x3f')]){_0x71b4d5['where']=_[_0xd3d3('0x58')](_0x71b4d5[_0xd3d3('0x56')],{'$or':_[_0xd3d3('0x41')](_0x71b4d5['attributes'],function(_0x8dc577){var _0x38e7a6={};_0x38e7a6[_0x8dc577]={'$like':'%'+_0x1cf065[_0xd3d3('0x50')][_0xd3d3('0x3f')]+'%'};return _0x38e7a6;})});}_0x71b4d5=_[_0xd3d3('0x58')]({},_0x71b4d5,_0x1cf065[_0xd3d3('0x64')]);return _0x55bd25[_0xd3d3('0xfc')](_0x71b4d5);}})['then'](function(_0x15d970){if(_0x15d970){_0xeb7515=_0x15d970['length'];if(!_0x1cf065[_0xd3d3('0x50')][_0xd3d3('0xb5')](_0xd3d3('0xbc'))){_0x71b4d5[_0xd3d3('0x34')]=qs[_0xd3d3('0x34')](_0x1cf065[_0xd3d3('0x50')]['limit']);_0x71b4d5['offset']=qs[_0xd3d3('0x33')](_0x1cf065['query'][_0xd3d3('0x33')]);}return _0x55bd25[_0xd3d3('0xfc')](_0x71b4d5);}})[_0xd3d3('0x22')](function(_0x31afec){if(_0x31afec){return _0x31afec?{'count':_0xeb7515,'rows':_0x31afec}:null;}})[_0xd3d3('0x22')](respondWithResult(_0x4c1095,null))[_0xd3d3('0x2d')](handleError(_0x4c1095,null));};exports[_0xd3d3('0xfe')]=function(_0x386db5,_0x34f7a1){return db[_0xd3d3('0x5c')][_0xd3d3('0x45')]({'where':{'id':_0x386db5['params']['id']}})['then'](handleEntityNotFound(_0x34f7a1,null))[_0xd3d3('0x22')](function(_0x1bf6e3){if(_0x1bf6e3){var _0xda032d=_0x1bf6e3[_0xd3d3('0x39')]({'plain':!![]});return _0x1bf6e3[_0xd3d3('0xfe')](_0x386db5[_0xd3d3('0x65')][_0xd3d3('0x9d')],_[_0xd3d3('0xff')](_0x386db5['body'],[_0xd3d3('0x9d'),'id'])||{})[_0xd3d3('0x22')](function(){for(var _0x5cb3d6=0x0;_0x5cb3d6<_0x386db5[_0xd3d3('0x65')][_0xd3d3('0x9d')][_0xd3d3('0x53')];_0x5cb3d6++){var _0x2bce95=[];db[_0xd3d3('0xfd')][_0xd3d3('0x89')]({'where':{'id':_0x386db5[_0xd3d3('0x65')][_0xd3d3('0x9d')][_0x5cb3d6]}})[_0xd3d3('0x22')](function(_0x526cd7){_0x2bce95[_0xd3d3('0xdd')](_0x526cd7[_0xd3d3('0xdc')]()[_0xd3d3('0x22')](function(_0x4891cc){for(var _0x5c6c86=0x0;_0x5c6c86<_0x4891cc[_0xd3d3('0x53')];_0x5c6c86++){_0x4891cc[_0x5c6c86][_0xd3d3('0x100')](_0xd3d3('0x93'),_0xd3d3('0x101'));}return _0x4891cc;}));_0x2bce95[_0xd3d3('0xdd')](_0x526cd7[_0xd3d3('0x102')]()[_0xd3d3('0x22')](function(_0x5ea7e9){for(var _0x3f3ab4=0x0;_0x3f3ab4<_0x5ea7e9[_0xd3d3('0x53')];_0x3f3ab4++){_0x5ea7e9[_0x3f3ab4][_0xd3d3('0x100')](_0xd3d3('0x93'),_0xd3d3('0x103'));}return _0x5ea7e9;}));_0x2bce95[_0xd3d3('0xdd')](_0x526cd7[_0xd3d3('0x104')]()[_0xd3d3('0x22')](function(_0x43769d){for(var _0x476504=0x0;_0x476504<_0x43769d[_0xd3d3('0x53')];_0x476504++){_0x43769d[_0x476504][_0xd3d3('0x100')](_0xd3d3('0x93'),_0xd3d3('0x105'));}return _0x43769d;}));_0x2bce95[_0xd3d3('0xdd')](_0x526cd7[_0xd3d3('0x106')]()[_0xd3d3('0x22')](function(_0xd93e19){for(var _0x1ea8dd=0x0;_0x1ea8dd<_0xd93e19[_0xd3d3('0x53')];_0x1ea8dd++){_0xd93e19[_0x1ea8dd][_0xd3d3('0x100')](_0xd3d3('0x93'),_0xd3d3('0x107'));}return _0xd93e19;}));_0x2bce95[_0xd3d3('0xdd')](_0x526cd7[_0xd3d3('0x108')]()[_0xd3d3('0x22')](function(_0x167942){for(var _0x46eaa1=0x0;_0x46eaa1<_0x167942[_0xd3d3('0x53')];_0x46eaa1++){_0x167942[_0x46eaa1][_0xd3d3('0x100')](_0xd3d3('0x93'),_0xd3d3('0x109'));}return _0x167942;}));_0x2bce95['push'](_0x526cd7[_0xd3d3('0x10a')]()[_0xd3d3('0x22')](function(_0x54eede){for(var _0x1784a5=0x0;_0x1784a5<_0x54eede[_0xd3d3('0x53')];_0x1784a5++){_0x54eede[_0x1784a5][_0xd3d3('0x100')](_0xd3d3('0x93'),_0xd3d3('0x10b'));}return _0x54eede;}));return BPromise[_0xd3d3('0xe1')](_0x2bce95);})[_0xd3d3('0x22')](function(_0xfd1a30){var _0x655219=_[_0xd3d3('0x10c')](_0xfd1a30);_0x2bce95=[];return db[_0xd3d3('0x5a')][_0xd3d3('0x10d')](function(_0x464a20){for(var _0x5ddc05=0x0;_0x5ddc05<_0x655219[_0xd3d3('0x53')];_0x5ddc05++){_0x2bce95[_0xd3d3('0xdd')](_0x655219[_0x5ddc05][_0xd3d3('0x10e')](_0xda032d['id']),{'transaction':_0x464a20});}return BPromise['all'](_0x2bce95)[_0xd3d3('0x22')](function(){if(_0xda032d[_0xd3d3('0x94')]){return BPromise[_0xd3d3('0xde')](_['filter'](_0x655219,function(_0x4b9fd9){return _0x4b9fd9[_0xd3d3('0x10f')]('channel')===_0xd3d3('0x101');}),function(_0x5e8988){return db[_0xd3d3('0xda')][_0xd3d3('0xa5')]({'membername':_0xda032d[_0xd3d3('0x46')],'UserId':_0xda032d['id'],'queue_name':_0x5e8988[_0xd3d3('0x46')],'VoiceQueueId':_0x5e8988['id'],'interface':_['isNil'](_0xda032d[_0xd3d3('0x97')])?util['format']('SIP/%s',_0xda032d[_0xd3d3('0x46')]):_0xda032d[_0xd3d3('0x97')],'paused':_0xda032d['voicePause']||![],'penalty':_0xda032d['penalty']},{'transaction':_0x464a20});});}else{return;}})[_0xd3d3('0x22')](function(){for(var _0x2fbeb6=0x0;_0x2fbeb6<_0x655219[_0xd3d3('0x53')];_0x2fbeb6++){var _0x65b788=_0x655219[_0x2fbeb6]['getDataValue'](_0xd3d3('0x93'));var _0x13f40c=_0x65b788+_0xd3d3('0xa9');socket[_0xd3d3('0x9e')]('user'+_0x65b788+_0xd3d3('0x9f'),{'UserId':_0xda032d['id'],['queueField']:_0x655219[_0x2fbeb6]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x34f7a1,null))[_0xd3d3('0x2d')](handleError(_0x34f7a1,null));};exports[_0xd3d3('0x110')]=function(_0x164df9,_0x507fb7){return db[_0xd3d3('0x5c')]['findOne']({'where':{'id':_0x164df9[_0xd3d3('0x5f')]['id']}})['then'](handleEntityNotFound(_0x507fb7,null))[_0xd3d3('0x22')](function(_0x1c7585){if(_0x1c7585){var _0x5427ae=_0x1c7585['get']({'plain':!![]});var _0x3cff5e=_0x164df9[_0xd3d3('0x50')]['ids'];return _0x1c7585[_0xd3d3('0x110')](_0x3cff5e)[_0xd3d3('0x22')](function(){for(var _0x1a6ff5=0x0;_0x1a6ff5<_0x3cff5e[_0xd3d3('0x53')];_0x1a6ff5++){var _0x20d947=[];db['Team'][_0xd3d3('0x89')]({'where':{'id':_0x3cff5e[_0x1a6ff5]}})[_0xd3d3('0x22')](function(_0x1ef71a){_0x20d947[_0xd3d3('0xdd')](_0x1ef71a['getVoiceQueues']()[_0xd3d3('0x22')](function(_0x16829f){for(var _0x2ad0ef=0x0;_0x2ad0ef<_0x16829f[_0xd3d3('0x53')];_0x2ad0ef++){_0x16829f[_0x2ad0ef][_0xd3d3('0x100')](_0xd3d3('0x93'),_0xd3d3('0x101'));}return _0x16829f;}));_0x20d947[_0xd3d3('0xdd')](_0x1ef71a[_0xd3d3('0x102')]()[_0xd3d3('0x22')](function(_0x29dc4f){for(var _0x49b36d=0x0;_0x49b36d<_0x29dc4f['length'];_0x49b36d++){_0x29dc4f[_0x49b36d]['setDataValue'](_0xd3d3('0x93'),_0xd3d3('0x103'));}return _0x29dc4f;}));_0x20d947[_0xd3d3('0xdd')](_0x1ef71a[_0xd3d3('0x104')]()[_0xd3d3('0x22')](function(_0x13455d){for(var _0x2bcdca=0x0;_0x2bcdca<_0x13455d['length'];_0x2bcdca++){_0x13455d[_0x2bcdca][_0xd3d3('0x100')](_0xd3d3('0x93'),'Mail');}return _0x13455d;}));_0x20d947[_0xd3d3('0xdd')](_0x1ef71a[_0xd3d3('0x106')]()[_0xd3d3('0x22')](function(_0x5aaec6){for(var _0x25caa6=0x0;_0x25caa6<_0x5aaec6[_0xd3d3('0x53')];_0x25caa6++){_0x5aaec6[_0x25caa6]['setDataValue']('channel',_0xd3d3('0x107'));}return _0x5aaec6;}));_0x20d947[_0xd3d3('0xdd')](_0x1ef71a[_0xd3d3('0x108')]()['then'](function(_0x1656de){for(var _0xa66efa=0x0;_0xa66efa<_0x1656de[_0xd3d3('0x53')];_0xa66efa++){_0x1656de[_0xa66efa][_0xd3d3('0x100')](_0xd3d3('0x93'),_0xd3d3('0x109'));}return _0x1656de;}));_0x20d947[_0xd3d3('0xdd')](_0x1ef71a[_0xd3d3('0x10a')]()[_0xd3d3('0x22')](function(_0x4de8aa){for(var _0x212bcc=0x0;_0x212bcc<_0x4de8aa[_0xd3d3('0x53')];_0x212bcc++){_0x4de8aa[_0x212bcc]['setDataValue'](_0xd3d3('0x93'),_0xd3d3('0x10b'));}return _0x4de8aa;}));return BPromise[_0xd3d3('0xe1')](_0x20d947);})[_0xd3d3('0x22')](function(_0x14a59a){var _0x3dd07b=_[_0xd3d3('0x10c')](_0x14a59a);_0x20d947=[];return db[_0xd3d3('0x5a')]['transaction'](function(_0x14b5a7){for(var _0x3eb535=0x0;_0x3eb535<_0x3dd07b[_0xd3d3('0x53')];_0x3eb535++){_0x20d947[_0xd3d3('0xdd')](_0x3dd07b[_0x3eb535]['removeAgent'](_0x5427ae['id']),{'transaction':_0x14b5a7});}return BPromise[_0xd3d3('0xe1')](_0x20d947)[_0xd3d3('0x22')](function(){if(_0x5427ae[_0xd3d3('0x94')]){return BPromise[_0xd3d3('0xde')](_[_0xd3d3('0x3f')](_0x3dd07b,function(_0x22ce6d){return _0x22ce6d[_0xd3d3('0x10f')]('channel')==='Voice';}),function(_0x137da7){return db[_0xd3d3('0xda')][_0xd3d3('0x38')]({'where':{'VoiceQueueId':_0x137da7['id'],'UserId':_0x5427ae['id']},'transaction':_0x14b5a7});});}else{return;}})[_0xd3d3('0x22')](function(){for(var _0x8234d7=0x0;_0x8234d7<_0x3dd07b[_0xd3d3('0x53')];_0x8234d7++){var _0x58fe8d=_0x3dd07b[_0x8234d7][_0xd3d3('0x10f')]('channel');var _0x1118a9=_0x58fe8d+_0xd3d3('0xa9');socket[_0xd3d3('0x9e')]('user'+_0x58fe8d+'Queue:remove',{'UserId':_0x5427ae['id'],['queueField']:_0x3dd07b[_0x8234d7]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x507fb7,null))[_0xd3d3('0x2d')](handleError(_0x507fb7,null));};exports[_0xd3d3('0x111')]=function(_0x233424,_0x30e925,_0x5347f3){var _0x115b60={};var _0x5bb951={};var _0x50e187;var _0x2682a8;return db[_0xd3d3('0x5c')][_0xd3d3('0x89')]({'where':{'id':_0x233424[_0xd3d3('0x5f')]['id']}})[_0xd3d3('0x22')](handleEntityNotFound(_0x30e925,null))[_0xd3d3('0x22')](function(_0x1c61c9){if(_0x1c61c9){_0x50e187=_0x1c61c9;_0x5bb951[_0xd3d3('0x4b')]=_[_0xd3d3('0x4e')](db[_0xd3d3('0xb6')]['rawAttributes']);_0x5bb951[_0xd3d3('0x50')]=_[_0xd3d3('0x4e')](_0x233424[_0xd3d3('0x50')]);_0x5bb951[_0xd3d3('0x4f')]=_[_0xd3d3('0x62')](_0x5bb951['model'],_0x5bb951[_0xd3d3('0x50')]);_0x115b60[_0xd3d3('0x52')]=_[_0xd3d3('0x62')](_0x5bb951['model'],qs[_0xd3d3('0x51')](_0x233424[_0xd3d3('0x50')]['fields']));_0x115b60[_0xd3d3('0x52')]=_0x115b60[_0xd3d3('0x52')][_0xd3d3('0x53')]?_0x115b60['attributes']:_0x5bb951[_0xd3d3('0x4b')];_0x115b60[_0xd3d3('0x54')]=qs['sort'](_0x233424[_0xd3d3('0x50')][_0xd3d3('0x55')]);_0x115b60[_0xd3d3('0x56')]=qs[_0xd3d3('0x4f')](_[_0xd3d3('0x57')](_0x233424[_0xd3d3('0x50')],_0x5bb951[_0xd3d3('0x4f')]));if(_0x233424[_0xd3d3('0x50')][_0xd3d3('0x3f')]){_0x115b60['where']=_[_0xd3d3('0x58')](_0x115b60['where'],{'$or':_[_0xd3d3('0x41')](_0x115b60['attributes'],function(_0x2f449f){var _0x588a8e={};_0x588a8e[_0x2f449f]={'$like':'%'+_0x233424[_0xd3d3('0x50')]['filter']+'%'};return _0x588a8e;})});}_0x115b60=_['merge']({},_0x115b60,_0x233424[_0xd3d3('0x64')]);return _0x50e187[_0xd3d3('0x111')](_0x115b60);}})[_0xd3d3('0x22')](function(_0x4b31a5){if(_0x4b31a5){_0x2682a8=_0x4b31a5[_0xd3d3('0x53')];if(!_0x233424[_0xd3d3('0x50')][_0xd3d3('0xb5')](_0xd3d3('0xbc'))){_0x115b60['limit']=qs[_0xd3d3('0x34')](_0x233424[_0xd3d3('0x50')]['limit']);_0x115b60[_0xd3d3('0x33')]=qs[_0xd3d3('0x33')](_0x233424[_0xd3d3('0x50')][_0xd3d3('0x33')]);}return _0x50e187[_0xd3d3('0x111')](_0x115b60);}})['then'](function(_0x443e3b){if(_0x443e3b){return _0x443e3b?{'count':_0x2682a8,'rows':_0x443e3b}:null;}})['then'](respondWithResult(_0x30e925,null))['catch'](handleError(_0x30e925,null));};exports['getAgents']=function(_0x2503a6,_0x4305a7,_0x320ad8){var _0x1a0163={};var _0xe0a03a={};var _0x443090;var _0x30c13a;return db[_0xd3d3('0x5c')]['findOne']({'where':{'id':_0x2503a6[_0xd3d3('0x5f')]['id']}})[_0xd3d3('0x22')](handleEntityNotFound(_0x4305a7,null))['then'](function(_0x3f3bec){if(_0x3f3bec){_0x443090=_0x3f3bec;_0xe0a03a[_0xd3d3('0x4b')]=_[_0xd3d3('0x4e')](db[_0xd3d3('0x5c')]['rawAttributes']);_0xe0a03a['query']=_[_0xd3d3('0x4e')](_0x2503a6[_0xd3d3('0x50')]);_0xe0a03a[_0xd3d3('0x4f')]=_[_0xd3d3('0x62')](_0xe0a03a[_0xd3d3('0x4b')],_0xe0a03a[_0xd3d3('0x50')]);_0x1a0163[_0xd3d3('0x52')]=_[_0xd3d3('0x62')](_0xe0a03a[_0xd3d3('0x4b')],qs[_0xd3d3('0x51')](_0x2503a6[_0xd3d3('0x50')][_0xd3d3('0x51')]));_0x1a0163[_0xd3d3('0x52')]=_0x1a0163['attributes'][_0xd3d3('0x53')]?_0x1a0163[_0xd3d3('0x52')]:_0xe0a03a['model'];_0x1a0163[_0xd3d3('0x54')]=qs['sort'](_0x2503a6['query'][_0xd3d3('0x55')]);_0x1a0163['where']=qs[_0xd3d3('0x4f')](_[_0xd3d3('0x57')](_0x2503a6[_0xd3d3('0x50')],_0xe0a03a[_0xd3d3('0x4f')]));if(_0x2503a6['query']['filter']){_0x1a0163[_0xd3d3('0x56')]=_[_0xd3d3('0x58')](_0x1a0163['where'],{'$or':_[_0xd3d3('0x41')](_0x1a0163[_0xd3d3('0x52')],function(_0x14d1e0){var _0xd9a521={};_0xd9a521[_0x14d1e0]={'$like':'%'+_0x2503a6['query'][_0xd3d3('0x3f')]+'%'};return _0xd9a521;})});}_0x1a0163['model']=db['User'];_0x1a0163['as']='Agents';_0x1a0163=_[_0xd3d3('0x58')]({},_0x1a0163,_0x2503a6[_0xd3d3('0x64')]);return _0x443090[_0xd3d3('0xdc')]({'include':[_0x1a0163]});}})[_0xd3d3('0x22')](function(_0x588a1a){if(_0x588a1a){var _0x4f4526={},_0x333468=[],_0x5c57a7=0x0;for(var _0x447ad4=0x0;_0x447ad4<_0x588a1a[_0xd3d3('0x53')];_0x447ad4+=0x1){for(var _0x1e7f89=0x0,_0xb19b8a;_0x1e7f89<_0x588a1a[_0x447ad4][_0xd3d3('0x3b')]['length'];_0x1e7f89+=0x1){_0xb19b8a=_0x588a1a[_0x447ad4]['Agents'][_0x1e7f89]['get']({'plain':!![]});_0x4f4526[_0xb19b8a['id']]=_0xb19b8a;}}_0x4f4526=_[_0xd3d3('0x112')](_0x4f4526);for(var _0x3d9f34=qs[_0xd3d3('0x33')](_0x2503a6['query'][_0xd3d3('0x33')]);_0x3d9f34<_0x4f4526[_0xd3d3('0x53')]&&_0x333468['length']=_0x16a965[_0xdfa4('0x4d')]){throw new Error(_0xdfa4('0x4e'));}})[_0xdfa4('0x10')](function(){if(_0x40cf1a){return db[_0xdfa4('0x2b')][_0xdfa4('0x46')]({'where':{'membername':_0x40cf1a[_0xdfa4('0x27')]},'individualHooks':!![]});}})['then'](function(){if(_0x40cf1a){return _0x40cf1a['getVoiceQueues']({'raw':!![]});}})[_0xdfa4('0x10')](function(_0x3e6f06){if(_0x40cf1a){if(_0x3e6f06){var _0x4a6f8e=[];_0x5caabe=_0x3e6f06;if(_0x5caabe[_0xdfa4('0x2e')]){for(var _0x4a675a=0x0;_0x4a675a<_0x5caabe[_0xdfa4('0x2e')];_0x4a675a++){_0x4a6f8e[_0xdfa4('0x33')](db[_0xdfa4('0x2b')][_0xdfa4('0x4f')]({'membername':_0x40cf1a[_0xdfa4('0x27')],'UserId':_0x40cf1a['id'],'queue_name':_0x5caabe[_0x4a675a][_0xdfa4('0x27')],'VoiceQueueId':_0x5caabe[_0x4a675a]['id'],'interface':_0x42f509,'paused':_0x40cf1a[_0xdfa4('0x50')]||![],'penalty':_0x5caabe[_0x4a675a][_0xdfa4('0x51')]||0x0}));}return BPromise['all'](_0x4a6f8e);}}}})[_0xdfa4('0x10')](function(){if(_0x40cf1a){return db[_0xdfa4('0x2d')][_0xdfa4('0x1b')]({'where':{'membername':_0x40cf1a[_0xdfa4('0x27')],'exitAt':null}});}})[_0xdfa4('0x10')](function(_0x2e284b){if(_0x40cf1a){if(_0x2e284b&&_0x2e284b['length']){var _0x46d401=[];_0x2e284b[_0xdfa4('0x44')](function(_0x294956){_0x46d401['push'](_0x294956[_0xdfa4('0x2c')]({'exitAt':moment()[_0xdfa4('0x2f')](_0xdfa4('0x30'))}));});return BPromise[_0xdfa4('0x45')](_0x46d401);}}})[_0xdfa4('0x10')](function(_0x393c5a){if(_0x40cf1a){var _0x40c87c=[];var _0x25fde0=[];var _0xa068aa=utils[_0xdfa4('0x32')]();var _0x38046c={'membername':_0x40cf1a[_0xdfa4('0x27')],'interface':_0x42f509,'enterAt':moment()['format'](_0xdfa4('0x30')),'role':_0x40cf1a[_0xdfa4('0x28')],'internal':_0x40cf1a[_0xdfa4('0x29')]};_0xa068aa['forEach'](function(_0x2dd718){_0x40c87c[_0xdfa4('0x33')](_['merge']({'channel':_0x2dd718,'type':'LOGIN','data1':'callysquare','data2':_0x42f509},_0x38046c));if(_0x40cf1a[_0xdfa4('0x50')]){_0x25fde0[_0xdfa4('0x33')](_[_0xdfa4('0x52')]({'channel':_0x2dd718,'type':_0xdfa4('0x3f'),'data1':_0xdfa4('0x53')},_0x38046c));}});return db[_0xdfa4('0x2d')][_0xdfa4('0x39')](_0x40c87c['concat'](_0x25fde0),{'individualHooks':!![]});}})[_0xdfa4('0x10')](function(){if(_0x40cf1a){return _0x40cf1a[_0xdfa4('0x2c')]({'online':!![],'lastLoginAt':moment()[_0xdfa4('0x2f')](_0xdfa4('0x30')),'voicePause':_0x40cf1a[_0xdfa4('0x50')]||![],'mailPause':_0x40cf1a[_0xdfa4('0x50')]||![],'chatPause':_0x40cf1a[_0xdfa4('0x50')]||![],'faxPause':_0x40cf1a[_0xdfa4('0x50')]||![],'smsPause':_0x40cf1a[_0xdfa4('0x50')]||![],'openchannelPause':_0x40cf1a[_0xdfa4('0x50')]||![],'pauseType':_0x40cf1a[_0xdfa4('0x50')]?_0xdfa4('0x53'):null,'lastPauseAt':moment()[_0xdfa4('0x2f')](_0xdfa4('0x30')),'interface':_0x42f509});}})[_0xdfa4('0x10')](function(_0x132210){_0x55bb0b(_0x132210);})[_0xdfa4('0x18')](function(_0x5c01d2){_0x178a72(_0x264733['error'](0x1f4,_0x5c01d2[_0xdfa4('0x16')]));});});}; \ No newline at end of file +var _0x6290=['phone','loginInPause','SIP/%s','count','../../config/license/util','getLicense','agents','destroy','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','LOGIN','callysquare','LOGININPAUSE','moment','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./user.socket','request','then','info','User,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','GetUser','User','findAll','options','raw','where','attributes','include','map','model','ShowUser','PauseUser','find','name','role','interface','UserVoiceQueueRt','update','MemberReport','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','getChannels','forEach','push','isNil','body','type','internal','uniqueid','bulkCreate','UnpauseUser','channel','Unknown\x20channel','voice','system','mail','fax','sms','openchannel','set','Pause','all','LogoutUser','findOne','LoginUser','mobile'];(function(_0x44c296,_0x54ca5){var _0x32d2a7=function(_0x24144f){while(--_0x24144f){_0x44c296['push'](_0x44c296['shift']());}};_0x32d2a7(++_0x54ca5);}(_0x6290,0x1b8));var _0x0629=function(_0xb0d533,_0x21a63a){_0xb0d533=_0xb0d533-0x0;var _0x295122=_0x6290[_0xb0d533];return _0x295122;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0629('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0629('0x1'));var db=require(_0x0629('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x0629('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0629('0x4'));var client=jayson[_0x0629('0x5')]['http']({'port':0x232a});config[_0x0629('0x6')]=_[_0x0629('0x7')](config['redis'],{'host':_0x0629('0x8'),'port':0x18eb});var socket=require(_0x0629('0x9'))(new Redis(config[_0x0629('0x6')]));require(_0x0629('0xa'))['register'](socket);function respondWithRpcPromise(_0x23b04e,_0x48263e,_0x16c27c){return new BPromise(function(_0x444f72,_0x8acdea){return client[_0x0629('0xb')](_0x23b04e,_0x16c27c)[_0x0629('0xc')](function(_0x514e0c){logger[_0x0629('0xd')](_0x0629('0xe'),_0x48263e,'request\x20sent');logger[_0x0629('0xf')]('User,\x20%s,\x20%s,\x20%s',_0x48263e,_0x0629('0x10'),JSON[_0x0629('0x11')](_0x514e0c));if(_0x514e0c['error']){if(_0x514e0c[_0x0629('0x12')][_0x0629('0x13')]===0x1f4){logger[_0x0629('0x12')](_0x0629('0xe'),_0x48263e,_0x514e0c[_0x0629('0x12')][_0x0629('0x14')]);return _0x8acdea(_0x514e0c[_0x0629('0x12')]['message']);}logger[_0x0629('0x12')](_0x0629('0xe'),_0x48263e,_0x514e0c[_0x0629('0x12')][_0x0629('0x14')]);return _0x444f72(_0x514e0c['error'][_0x0629('0x14')]);}else{logger[_0x0629('0xd')](_0x0629('0xe'),_0x48263e,_0x0629('0x10'));_0x444f72(_0x514e0c['result'][_0x0629('0x14')]);}})[_0x0629('0x15')](function(_0x540482){logger[_0x0629('0x12')]('User,\x20%s,\x20%s',_0x48263e,_0x540482);_0x8acdea(_0x540482);});});}exports[_0x0629('0x16')]=function(_0x54e842){var _0x2c825a=this;return new Promise(function(_0x471461,_0x11c598){return db[_0x0629('0x17')][_0x0629('0x18')]({'raw':_0x54e842[_0x0629('0x19')]?_0x54e842[_0x0629('0x19')][_0x0629('0x1a')]===undefined?!![]:![]:!![],'where':_0x54e842[_0x0629('0x19')]?_0x54e842[_0x0629('0x19')][_0x0629('0x1b')]||null:null,'attributes':_0x54e842[_0x0629('0x19')]?_0x54e842[_0x0629('0x19')][_0x0629('0x1c')]||null:null,'limit':_0x54e842['options']?_0x54e842[_0x0629('0x19')]['limit']||null:null,'include':_0x54e842['options']?_0x54e842[_0x0629('0x19')][_0x0629('0x1d')]?_[_0x0629('0x1e')](_0x54e842['options'][_0x0629('0x1d')],function(_0x120dc4){return{'model':db[_0x120dc4[_0x0629('0x1f')]],'as':_0x120dc4['as'],'attributes':_0x120dc4[_0x0629('0x1c')],'include':_0x120dc4[_0x0629('0x1d')]?_['map'](_0x120dc4[_0x0629('0x1d')],function(_0x1730ae){return{'model':db[_0x1730ae['model']],'as':_0x1730ae['as'],'attributes':_0x1730ae[_0x0629('0x1c')],'include':_0x1730ae['include']?_[_0x0629('0x1e')](_0x1730ae[_0x0629('0x1d')],function(_0x28ddb8){return{'model':db[_0x28ddb8[_0x0629('0x1f')]],'as':_0x28ddb8['as'],'attributes':_0x28ddb8['attributes']};}):[]};}):[]};}):[]:[]})[_0x0629('0xc')](function(_0x4bf65c){logger['info'](_0x0629('0x16'),_0x54e842);logger[_0x0629('0xf')]('GetUser',_0x54e842,JSON[_0x0629('0x11')](_0x4bf65c));_0x471461(_0x4bf65c);})[_0x0629('0x15')](function(_0x27a51e){logger[_0x0629('0x12')](_0x0629('0x16'),_0x27a51e[_0x0629('0x14')],_0x54e842);_0x11c598(_0x2c825a[_0x0629('0x12')](0x1f4,_0x27a51e[_0x0629('0x14')]));});});};exports['ShowUser']=function(_0x385a6b){var _0x21072b=this;return new Promise(function(_0x2cbfd6,_0x42cf74){return db[_0x0629('0x17')]['find']({'raw':_0x385a6b['options']?_0x385a6b[_0x0629('0x19')][_0x0629('0x1a')]===undefined?!![]:![]:!![],'where':_0x385a6b[_0x0629('0x19')]?_0x385a6b['options'][_0x0629('0x1b')]||null:null,'attributes':_0x385a6b[_0x0629('0x19')]?_0x385a6b[_0x0629('0x19')][_0x0629('0x1c')]||null:null,'include':_0x385a6b['options']?_0x385a6b[_0x0629('0x19')][_0x0629('0x1d')]?_[_0x0629('0x1e')](_0x385a6b['options']['include'],function(_0x1fb50f){return{'model':db[_0x1fb50f[_0x0629('0x1f')]],'as':_0x1fb50f['as'],'attributes':_0x1fb50f[_0x0629('0x1c')],'include':_0x1fb50f[_0x0629('0x1d')]?_['map'](_0x1fb50f['include'],function(_0x4eb679){return{'model':db[_0x4eb679[_0x0629('0x1f')]],'as':_0x4eb679['as'],'attributes':_0x4eb679[_0x0629('0x1c')],'include':_0x4eb679[_0x0629('0x1d')]?_[_0x0629('0x1e')](_0x4eb679[_0x0629('0x1d')],function(_0x185bd2){return{'model':db[_0x185bd2[_0x0629('0x1f')]],'as':_0x185bd2['as'],'attributes':_0x185bd2[_0x0629('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0629('0xc')](function(_0x153349){logger[_0x0629('0xd')](_0x0629('0x20'),_0x385a6b);logger[_0x0629('0xf')](_0x0629('0x20'),_0x385a6b,JSON[_0x0629('0x11')](_0x153349));_0x2cbfd6(_0x153349);})[_0x0629('0x15')](function(_0x2f3f1c){logger[_0x0629('0x12')](_0x0629('0x20'),_0x2f3f1c['message'],_0x385a6b);_0x42cf74(_0x21072b['error'](0x1f4,_0x2f3f1c[_0x0629('0x14')]));});});};exports[_0x0629('0x21')]=function(_0x5a33eb){var _0x54639c=this;return new Promise(function(_0xef26ee,_0x35e824){var _0x1533fe;return db['User'][_0x0629('0x22')]({'where':_0x5a33eb[_0x0629('0x19')][_0x0629('0x1b')]||{},'attributes':['id',_0x0629('0x23'),_0x0629('0x24'),'internal',_0x0629('0x25')]})[_0x0629('0xc')](function(_0x4691ac){if(_0x4691ac){_0x1533fe=_0x4691ac;return db[_0x0629('0x26')][_0x0629('0x27')]({'paused':0x1},{'where':{'UserId':_0x1533fe['id']},'individualHooks':!![]});}})[_0x0629('0xc')](function(){if(_0x1533fe){return db[_0x0629('0x28')][_0x0629('0x18')]({'where':{'membername':_0x1533fe[_0x0629('0x23')],'type':_0x0629('0x29'),'exitAt':null}});}})[_0x0629('0xc')](function(_0x51b4cb){if(_0x1533fe){if(_0x51b4cb&&_0x51b4cb[_0x0629('0x2a')]){var _0x373955=moment()[_0x0629('0x2b')](_0x0629('0x2c'));for(var _0x1ca58d=0x0,_0x518992=_0x51b4cb[_0x0629('0x2a')];_0x1ca58d<_0x518992;_0x1ca58d++){_0x51b4cb[_0x1ca58d]['updateAttributes']({'exitAt':_0x373955});}}}})[_0x0629('0xc')](function(){if(_0x1533fe){var _0x4b46e1=[];var _0x37a186=utils[_0x0629('0x2d')]();_0x37a186[_0x0629('0x2e')](function(_0x24ea27){_0x4b46e1[_0x0629('0x2f')]({'channel':_0x24ea27,'membername':_0x1533fe['name'],'interface':_[_0x0629('0x30')](_0x1533fe[_0x0629('0x25')])?util['format']('SIP/%s',_0x1533fe[_0x0629('0x23')]):_0x1533fe[_0x0629('0x25')],'type':_0x0629('0x29'),'enterAt':moment()['format'](_0x0629('0x2c')),'data1':_0x5a33eb[_0x0629('0x31')][_0x0629('0x32')]||'DEFAULT\x20PAUSE','role':_0x1533fe[_0x0629('0x24')],'internal':_0x1533fe[_0x0629('0x33')],'uniqueid':_0x5a33eb[_0x0629('0x31')][_0x0629('0x34')]||null});});return db[_0x0629('0x28')][_0x0629('0x35')](_0x4b46e1,{'individualHooks':!![]});}})[_0x0629('0xc')](function(){if(_0x1533fe){return _0x1533fe[_0x0629('0x27')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x5a33eb['body'][_0x0629('0x32')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x0629('0x2b')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x0629('0xc')](function(_0x4677eb){_0xef26ee(_0x4677eb);})['catch'](function(_0x2526ec){_0x35e824(_0x54639c[_0x0629('0x12')](0x1f4,_0x2526ec['message']));});});};exports[_0x0629('0x36')]=function(_0x586376){var _0x2bbe6b=this;return new Promise(function(_0x2c70a6,_0x38e5eb){var _0x2a2f01;return db['User']['findOne']({'where':_0x586376[_0x0629('0x19')]['where']||{},'attributes':['id',_0x0629('0x23')]})[_0x0629('0xc')](function(_0x483ab9){if(_0x483ab9){_0x2a2f01=_0x483ab9;if(_0x586376[_0x0629('0x31')][_0x0629('0x37')]&&!utils['isValidChannel'](_0x586376[_0x0629('0x31')]['channel'])){throw new Error(_0x0629('0x38'));}switch(_0x586376[_0x0629('0x31')][_0x0629('0x37')]){case _0x0629('0x39'):return db['UserVoiceQueueRt'][_0x0629('0x27')]({'paused':0x0},{'where':{'UserId':_0x2a2f01['id']}})[_0x0629('0xc')](function(){return db[_0x0629('0x28')][_0x0629('0x22')]({'where':{'channel':_0x586376['body'][_0x0629('0x37')],'membername':_0x2a2f01[_0x0629('0x23')],'type':_0x0629('0x29'),'exitAt':null}});})[_0x0629('0xc')](function(_0x5cd6bf){if(_0x5cd6bf){return _0x5cd6bf[_0x0629('0x27')]({'exitAt':moment()['format'](_0x0629('0x2c')),'data2':_0x0629('0x3a')},{'individualHooks':!![]});}return null;})[_0x0629('0xc')](function(){return _0x2a2f01[_0x0629('0x27')]({'voicePause':![]});});case _0x0629('0x3b'):case'chat':case _0x0629('0x3c'):case _0x0629('0x3d'):case _0x0629('0x3e'):return db['MemberReport'][_0x0629('0x22')]({'where':{'channel':_0x586376[_0x0629('0x31')][_0x0629('0x37')],'membername':_0x2a2f01[_0x0629('0x23')],'type':_0x0629('0x29'),'exitAt':null}})[_0x0629('0xc')](function(_0x141756){return _0x141756[_0x0629('0x27')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':'system'},{'individualHooks':!![]});})[_0x0629('0xc')](function(){var _0x41f7c7={};_[_0x0629('0x3f')](_0x41f7c7,util[_0x0629('0x2b')]('%s%s',_0x586376[_0x0629('0x31')][_0x0629('0x37')],_0x0629('0x40')),![]);return _0x2a2f01['update'](_0x41f7c7);});default:return db[_0x0629('0x26')]['update']({'paused':0x0},{'where':{'UserId':_0x2a2f01['id']}})[_0x0629('0xc')](function(){return db[_0x0629('0x28')][_0x0629('0x18')]({'where':{'membername':_0x2a2f01['name'],'type':_0x0629('0x29'),'exitAt':null}});})[_0x0629('0xc')](function(_0x32ea1b){var _0x17f98e=[];_0x32ea1b['forEach'](function(_0x43ecf0){_0x17f98e[_0x0629('0x2f')](_0x43ecf0[_0x0629('0x27')]({'exitAt':moment()[_0x0629('0x2b')](_0x0629('0x2c')),'data2':_0x0629('0x3a')}));});return BPromise[_0x0629('0x41')](_0x17f98e);})[_0x0629('0xc')](function(){return _0x2a2f01[_0x0629('0x27')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0x0629('0xc')](function(_0x11dd21){_0x2c70a6(_0x11dd21);})[_0x0629('0x15')](function(_0xcb2b60){_0x38e5eb(_0x2bbe6b['error'](0x1f4,_0xcb2b60[_0x0629('0x14')]));});});};exports[_0x0629('0x42')]=function(_0x23b42b){var _0x3e20a6=this;return new Promise(function(_0x4ffa6d,_0x1b2d2b){var _0x2dc4b2;return db[_0x0629('0x17')][_0x0629('0x43')]({'where':_0x23b42b[_0x0629('0x19')][_0x0629('0x1b')]||{},'attributes':['id',_0x0629('0x23')]})[_0x0629('0xc')](function(_0x2ee409){if(_0x2ee409){_0x2dc4b2=_0x2ee409;return db[_0x0629('0x26')]['destroy']({'where':{'membername':_0x2dc4b2[_0x0629('0x23')]},'individualHooks':!![]});}})['then'](function(){if(_0x2dc4b2){return db['MemberReport'][_0x0629('0x18')]({'where':{'membername':_0x2dc4b2[_0x0629('0x23')],'exitAt':null}});}})['then'](function(_0xa9839e){if(_0x2dc4b2){if(_0xa9839e&&_0xa9839e['length']){var _0x55333c=[];_0xa9839e[_0x0629('0x2e')](function(_0x33e09f){_0x55333c[_0x0629('0x2f')](_0x33e09f[_0x0629('0x27')]({'exitAt':moment()[_0x0629('0x2b')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x0629('0x41')](_0x55333c);}}})[_0x0629('0xc')](function(){if(_0x2dc4b2){return _0x2dc4b2[_0x0629('0x27')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x230c00){_0x4ffa6d(_0x230c00);})[_0x0629('0x15')](function(_0x3f49e2){_0x1b2d2b(_0x3e20a6[_0x0629('0x12')](0x1f4,_0x3f49e2[_0x0629('0x14')]));});});};exports[_0x0629('0x44')]=function(_0x12e06b){var _0x464f33=this;return new Promise(function(_0x436b58,_0x218516){var _0x381b90;var _0x3934e5;var _0xaf20a6;var _0x2c0ee3;return db[_0x0629('0x17')][_0x0629('0x43')]({'where':_0x12e06b[_0x0629('0x19')][_0x0629('0x1b')]||{},'attributes':['id',_0x0629('0x23'),_0x0629('0x24'),_0x0629('0x45'),_0x0629('0x46'),_0x0629('0x33'),_0x0629('0x47'),'interface']})[_0x0629('0xc')](function(_0x5d7fe6){if(_0x5d7fe6){_0x381b90=_0x5d7fe6;_0x2c0ee3=_0x12e06b[_0x0629('0x31')][_0x0629('0x25')]?_0x12e06b[_0x0629('0x31')]['interface']:util['format'](_0x0629('0x48'),_0x381b90['name']);return db[_0x0629('0x17')][_0x0629('0x49')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x381b90['id']}}});}})[_0x0629('0xc')](function(_0x39c915){if(_0x39c915){_0xaf20a6=_0x39c915;return require(_0x0629('0x4a'))[_0x0629('0x4b')]();}})['then'](function(_0x3dbce3){if(_0x3dbce3&&_0x3dbce3[_0x0629('0x4c')]&&_0xaf20a6>=_0x3dbce3['agents']){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x0629('0xc')](function(){if(_0x381b90){return db['UserVoiceQueueRt'][_0x0629('0x4d')]({'where':{'membername':_0x381b90[_0x0629('0x23')]},'individualHooks':!![]});}})[_0x0629('0xc')](function(){if(_0x381b90){return _0x381b90[_0x0629('0x4e')]({'raw':!![]});}})[_0x0629('0xc')](function(_0x3ec59d){if(_0x381b90){if(_0x3ec59d){var _0x3d2425=[];_0x3934e5=_0x3ec59d;if(_0x3934e5[_0x0629('0x2a')]){for(var _0x2c8f33=0x0;_0x2c8f33<_0x3934e5[_0x0629('0x2a')];_0x2c8f33++){_0x3d2425[_0x0629('0x2f')](db['UserVoiceQueueRt'][_0x0629('0x4f')]({'membername':_0x381b90[_0x0629('0x23')],'UserId':_0x381b90['id'],'queue_name':_0x3934e5[_0x2c8f33][_0x0629('0x23')],'VoiceQueueId':_0x3934e5[_0x2c8f33]['id'],'interface':_0x2c0ee3,'paused':_0x381b90[_0x0629('0x47')]||![],'penalty':_0x3934e5[_0x2c8f33][_0x0629('0x50')]||0x0}));}return BPromise[_0x0629('0x41')](_0x3d2425);}}}})[_0x0629('0xc')](function(){if(_0x381b90){return db[_0x0629('0x28')][_0x0629('0x18')]({'where':{'membername':_0x381b90[_0x0629('0x23')],'exitAt':null}});}})[_0x0629('0xc')](function(_0x1dc845){if(_0x381b90){if(_0x1dc845&&_0x1dc845[_0x0629('0x2a')]){var _0x500a61=[];_0x1dc845[_0x0629('0x2e')](function(_0x4c4375){_0x500a61[_0x0629('0x2f')](_0x4c4375[_0x0629('0x27')]({'exitAt':moment()[_0x0629('0x2b')](_0x0629('0x2c'))}));});return BPromise[_0x0629('0x41')](_0x500a61);}}})[_0x0629('0xc')](function(_0x5ee97f){if(_0x381b90){var _0x181414=[];var _0x35a3a4=[];var _0x1e8060=utils[_0x0629('0x2d')]();var _0xab006c={'membername':_0x381b90[_0x0629('0x23')],'interface':_0x2c0ee3,'enterAt':moment()[_0x0629('0x2b')](_0x0629('0x2c')),'role':_0x381b90[_0x0629('0x24')],'internal':_0x381b90[_0x0629('0x33')]};_0x1e8060['forEach'](function(_0x2a810b){_0x181414[_0x0629('0x2f')](_[_0x0629('0x51')]({'channel':_0x2a810b,'type':_0x0629('0x52'),'data1':_0x0629('0x53'),'data2':_0x2c0ee3},_0xab006c));if(_0x381b90[_0x0629('0x47')]){_0x35a3a4[_0x0629('0x2f')](_[_0x0629('0x51')]({'channel':_0x2a810b,'type':_0x0629('0x29'),'data1':_0x0629('0x54')},_0xab006c));}});return db['MemberReport']['bulkCreate'](_0x181414['concat'](_0x35a3a4),{'individualHooks':!![]});}})[_0x0629('0xc')](function(){if(_0x381b90){return _0x381b90[_0x0629('0x27')]({'online':!![],'lastLoginAt':moment()[_0x0629('0x2b')](_0x0629('0x2c')),'voicePause':_0x381b90[_0x0629('0x47')]||![],'mailPause':_0x381b90[_0x0629('0x47')]||![],'chatPause':_0x381b90[_0x0629('0x47')]||![],'faxPause':_0x381b90['loginInPause']||![],'smsPause':_0x381b90['loginInPause']||![],'openchannelPause':_0x381b90[_0x0629('0x47')]||![],'pauseType':_0x381b90[_0x0629('0x47')]?_0x0629('0x54'):null,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x2c0ee3});}})[_0x0629('0xc')](function(_0x5b40bd){_0x436b58(_0x5b40bd);})[_0x0629('0x15')](function(_0x3c24ce){_0x218516(_0x464f33[_0x0629('0x12')](0x1f4,_0x3c24ce[_0x0629('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 778eb5b..22eee47 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 _0x187e=['removeListener','register','length','user:','./user.events','save','remove','update','emit'];(function(_0x39d38e,_0x3da1f7){var _0x18e737=function(_0x373eef){while(--_0x373eef){_0x39d38e['push'](_0x39d38e['shift']());}};_0x18e737(++_0x3da1f7);}(_0x187e,0x15a));var _0xe187=function(_0x44f718,_0xceccdd){_0x44f718=_0x44f718-0x0;var _0x518542=_0x187e[_0x44f718];return _0x518542;};'use strict';var UserEvents=require(_0xe187('0x0'));var events=[_0xe187('0x1'),_0xe187('0x2'),_0xe187('0x3')];function createListener(_0x475af6,_0x3178e8){return function(_0x360b98){_0x3178e8[_0xe187('0x4')](_0x475af6,_0x360b98);};}function removeListener(_0x12493a,_0x3110a3){return function(){UserEvents[_0xe187('0x5')](_0x12493a,_0x3110a3);};}exports[_0xe187('0x6')]=function(_0x1dbfc2){for(var _0x22acc5=0x0,_0x5e901c=events[_0xe187('0x7')];_0x22acc5<_0x5e901c;_0x22acc5++){var _0x2974c6=events[_0x22acc5];var _0x35ed08=createListener(_0xe187('0x8')+_0x2974c6,_0x1dbfc2);UserEvents['on'](_0x2974c6,_0x35ed08);}}; \ No newline at end of file +var _0x015e=['user:','./user.events','save','remove','emit','removeListener','length'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x015e,0x127));var _0xe015=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0x015e[_0x2d34d6];return _0x1d3d12;};'use strict';var UserEvents=require(_0xe015('0x0'));var events=[_0xe015('0x1'),_0xe015('0x2'),'update'];function createListener(_0xc35641,_0x5af052){return function(_0x4c96ee){_0x5af052[_0xe015('0x3')](_0xc35641,_0x4c96ee);};}function removeListener(_0x332da3,_0x2ddec6){return function(){UserEvents[_0xe015('0x4')](_0x332da3,_0x2ddec6);};}exports['register']=function(_0x364307){for(var _0x14c774=0x0,_0x4a3f99=events[_0xe015('0x5')];_0x14c774<_0x4a3f99;_0x14c774++){var _0x685191=events[_0x14c774];var _0x178b8b=createListener(_0xe015('0x6')+_0x685191,_0x364307);UserEvents['on'](_0x685191,_0x178b8b);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 053bba1..5efe1a5 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 _0xfeb3=['exports','util','path','connect-timeout','../../components/interaction/service','../../config/environment'];(function(_0x3f9491,_0x308bba){var _0x48e50f=function(_0xfe7a4c){while(--_0xfe7a4c){_0x3f9491['push'](_0x3f9491['shift']());}};_0x48e50f(++_0x308bba);}(_0xfeb3,0x16f));var _0x3feb=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xfeb3[_0x122ef9];return _0x42fba0;};'use strict';var multer=require('multer');var util=require(_0x3feb('0x0'));var path=require(_0x3feb('0x1'));var timeout=require(_0x3feb('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x3feb('0x3'));var config=require(_0x3feb('0x4'));module[_0x3feb('0x5')]=router; \ No newline at end of file +var _0x1801=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','connect-timeout','express'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0x1801,0x18c));var _0x1180=function(_0x429835,_0x5e7133){_0x429835=_0x429835-0x0;var _0x33cfa9=_0x1801[_0x429835];return _0x33cfa9;};'use strict';var multer=require(_0x1180('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1180('0x1'));var express=require(_0x1180('0x2'));var router=express['Router']();var auth=require(_0x1180('0x3'));var interaction=require(_0x1180('0x4'));var config=require(_0x1180('0x5'));module[_0x1180('0x6')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index e8c5df9..5a105f1 100644 --- a/server/api/userChatQueue/userChatQueue.attributes.js +++ b/server/api/userChatQueue/userChatQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['exports','INTEGER'];(function(_0x27d10a,_0x35ff44){var _0x63302e=function(_0x302156){while(--_0x302156){_0x27d10a['push'](_0x27d10a['shift']());}};_0x63302e(++_0x35ff44);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x26df48,_0x22aa50){var _0x209047=function(_0x1d068b){while(--_0x1d068b){_0x26df48['push'](_0x26df48['shift']());}};_0x209047(++_0x22aa50);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index abf30ba..0fa96ff 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 _0xff6f=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','UserChatQueue','user_has_chat_queues'];(function(_0x4a2953,_0x1e2481){var _0x37f3a2=function(_0x2619d8){while(--_0x2619d8){_0x4a2953['push'](_0x4a2953['shift']());}};_0x37f3a2(++_0x1e2481);}(_0xff6f,0x11e));var _0xfff6=function(_0x1ca69d,_0x39d8bf){_0x1ca69d=_0x1ca69d-0x0;var _0x3f8b7b=_0xff6f[_0x1ca69d];return _0x3f8b7b;};'use strict';var _=require(_0xfff6('0x0'));var util=require(_0xfff6('0x1'));var logger=require(_0xfff6('0x2'))(_0xfff6('0x3'));var moment=require(_0xfff6('0x4'));var BPromise=require(_0xfff6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfff6('0x6'));var rimraf=require(_0xfff6('0x7'));var config=require(_0xfff6('0x8'));var attributes=require('./userChatQueue.attributes');module[_0xfff6('0x9')]=function(_0x57e2b3,_0x25382c){return _0x57e2b3[_0xfff6('0xa')](_0xfff6('0xb'),attributes,{'tableName':_0xfff6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0fcf=['UserChatQueue','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports'];(function(_0x1ebe2f,_0x523227){var _0xdeb06f=function(_0x2a6051){while(--_0x2a6051){_0x1ebe2f['push'](_0x1ebe2f['shift']());}};_0xdeb06f(++_0x523227);}(_0x0fcf,0x145));var _0xf0fc=function(_0x17fa7f,_0x2edf0b){_0x17fa7f=_0x17fa7f-0x0;var _0x5f5b88=_0x0fcf[_0x17fa7f];return _0x5f5b88;};'use strict';var _=require(_0xf0fc('0x0'));var util=require('util');var logger=require(_0xf0fc('0x1'))(_0xf0fc('0x2'));var moment=require(_0xf0fc('0x3'));var BPromise=require(_0xf0fc('0x4'));var rp=require(_0xf0fc('0x5'));var fs=require('fs');var path=require(_0xf0fc('0x6'));var rimraf=require(_0xf0fc('0x7'));var config=require(_0xf0fc('0x8'));var attributes=require(_0xf0fc('0x9'));module[_0xf0fc('0xa')]=function(_0x24ec4c,_0x4d44c9){return _0x24ec4c['define'](_0xf0fc('0xb'),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 ce8e620..ff2c37d 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 _0x3c5a=['request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','info','UserChatQueue,\x20%s,\x20%s'];(function(_0x111acd,_0x46e493){var _0x294496=function(_0x2583b7){while(--_0x2583b7){_0x111acd['push'](_0x111acd['shift']());}};_0x294496(++_0x46e493);}(_0x3c5a,0x1a8));var _0xa3c5=function(_0x33c1b1,_0x2355fb){_0x33c1b1=_0x33c1b1-0x0;var _0x2c2037=_0x3c5a[_0x33c1b1];return _0x2c2037;};'use strict';var _=require('lodash');var util=require(_0xa3c5('0x0'));var moment=require(_0xa3c5('0x1'));var BPromise=require(_0xa3c5('0x2'));var rs=require(_0xa3c5('0x3'));var fs=require('fs');var Redis=require(_0xa3c5('0x4'));var db=require(_0xa3c5('0x5'))['db'];var utils=require(_0xa3c5('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xa3c5('0x7'));var client=jayson[_0xa3c5('0x8')][_0xa3c5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48d852,_0x1bfbc5,_0x1a1e11){return new BPromise(function(_0x18a32a,_0x272a2a){return client[_0xa3c5('0xa')](_0x48d852,_0x1a1e11)['then'](function(_0x46335e){logger[_0xa3c5('0xb')](_0xa3c5('0xc'),_0x1bfbc5,_0xa3c5('0xd'));logger['debug'](_0xa3c5('0xe'),_0x1bfbc5,_0xa3c5('0xd'),JSON[_0xa3c5('0xf')](_0x46335e));if(_0x46335e[_0xa3c5('0x10')]){if(_0x46335e[_0xa3c5('0x10')][_0xa3c5('0x11')]===0x1f4){logger[_0xa3c5('0x10')](_0xa3c5('0xc'),_0x1bfbc5,_0x46335e[_0xa3c5('0x10')]['message']);return _0x272a2a(_0x46335e[_0xa3c5('0x10')]['message']);}logger['error'](_0xa3c5('0xc'),_0x1bfbc5,_0x46335e[_0xa3c5('0x10')]['message']);return _0x18a32a(_0x46335e[_0xa3c5('0x10')]['message']);}else{logger[_0xa3c5('0xb')](_0xa3c5('0xc'),_0x1bfbc5,_0xa3c5('0xd'));_0x18a32a(_0x46335e['result']['message']);}})[_0xa3c5('0x12')](function(_0x4175c4){logger[_0xa3c5('0x10')](_0xa3c5('0xc'),_0x1bfbc5,_0x4175c4);_0x272a2a(_0x4175c4);});});} \ No newline at end of file +var _0xa2fc=['code','UserChatQueue,\x20%s,\x20%s','message','catch','lodash','util','randomstring','../../config/utils','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4599b6,_0x40c254){var _0x2e014c=function(_0x3c4d90){while(--_0x3c4d90){_0x4599b6['push'](_0x4599b6['shift']());}};_0x2e014c(++_0x40c254);}(_0xa2fc,0xc2));var _0xca2f=function(_0x403fc7,_0x32931a){_0x403fc7=_0x403fc7-0x0;var _0x5d0827=_0xa2fc[_0x403fc7];return _0x5d0827;};'use strict';var _=require(_0xca2f('0x0'));var util=require(_0xca2f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xca2f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xca2f('0x3'));var logger=require('../../config/logger')(_0xca2f('0x4'));var config=require('../../config/environment');var jayson=require(_0xca2f('0x5'));var client=jayson[_0xca2f('0x6')][_0xca2f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x79dc8c,_0x31665c,_0x2ef044){return new BPromise(function(_0x1faf13,_0x249891){return client[_0xca2f('0x8')](_0x79dc8c,_0x2ef044)['then'](function(_0xe03432){logger[_0xca2f('0x9')]('UserChatQueue,\x20%s,\x20%s',_0x31665c,_0xca2f('0xa'));logger[_0xca2f('0xb')](_0xca2f('0xc'),_0x31665c,'request\x20sent',JSON[_0xca2f('0xd')](_0xe03432));if(_0xe03432['error']){if(_0xe03432[_0xca2f('0xe')][_0xca2f('0xf')]===0x1f4){logger['error'](_0xca2f('0x10'),_0x31665c,_0xe03432[_0xca2f('0xe')][_0xca2f('0x11')]);return _0x249891(_0xe03432[_0xca2f('0xe')][_0xca2f('0x11')]);}logger[_0xca2f('0xe')](_0xca2f('0x10'),_0x31665c,_0xe03432[_0xca2f('0xe')][_0xca2f('0x11')]);return _0x1faf13(_0xe03432[_0xca2f('0xe')]['message']);}else{logger['info']('UserChatQueue,\x20%s,\x20%s',_0x31665c,_0xca2f('0xa'));_0x1faf13(_0xe03432['result'][_0xca2f('0x11')]);}})[_0xca2f('0x12')](function(_0x3a0195){logger[_0xca2f('0xe')]('UserChatQueue,\x20%s,\x20%s',_0x31665c,_0x3a0195);_0x249891(_0x3a0195);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 2c24dd2..eb132f8 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 _0xa87f=['connect-timeout','express','../../components/interaction/service','exports','util'];(function(_0x1c653d,_0x39bc19){var _0x2c7be9=function(_0x12a0d5){while(--_0x12a0d5){_0x1c653d['push'](_0x1c653d['shift']());}};_0x2c7be9(++_0x39bc19);}(_0xa87f,0xae));var _0xfa87=function(_0x2b5f37,_0x5c1838){_0x2b5f37=_0x2b5f37-0x0;var _0x54165e=_0xa87f[_0x2b5f37];return _0x54165e;};'use strict';var multer=require('multer');var util=require(_0xfa87('0x0'));var path=require('path');var timeout=require(_0xfa87('0x1'));var express=require(_0xfa87('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xfa87('0x3'));var config=require('../../config/environment');module[_0xfa87('0x4')]=router; \ No newline at end of file +var _0x9f79=['exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1657b0,_0x31213a){var _0x27d905=function(_0x50502e){while(--_0x50502e){_0x1657b0['push'](_0x1657b0['shift']());}};_0x27d905(++_0x31213a);}(_0x9f79,0xd9));var _0x99f7=function(_0x29bbcc,_0x443f4e){_0x29bbcc=_0x29bbcc-0x0;var _0x4d2113=_0x9f79[_0x29bbcc];return _0x4d2113;};'use strict';var multer=require('multer');var util=require(_0x99f7('0x0'));var path=require(_0x99f7('0x1'));var timeout=require(_0x99f7('0x2'));var express=require('express');var router=express[_0x99f7('0x3')]();var auth=require(_0x99f7('0x4'));var interaction=require(_0x99f7('0x5'));var config=require(_0x99f7('0x6'));module[_0x99f7('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 6681f9b..f56aae5 100644 --- a/server/api/userFaxQueue/userFaxQueue.attributes.js +++ b/server/api/userFaxQueue/userFaxQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdd4f=['sequelize','STRING'];(function(_0x58aa22,_0x88644){var _0x140034=function(_0x3d58aa){while(--_0x3d58aa){_0x58aa22['push'](_0x58aa22['shift']());}};_0x140034(++_0x88644);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x4eba60,_0x46be16){_0x4eba60=_0x4eba60-0x0;var _0x3ec621=_0xdd4f[_0x4eba60];return _0x3ec621;};'use strict';var Sequelize=require(_0xfdd4('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xfdd4('0x1')]}}; \ No newline at end of file +var _0x3423=['INTEGER','STRING'];(function(_0x3fd462,_0x1edf7c){var _0x3a0e07=function(_0x4eca3a){while(--_0x4eca3a){_0x3fd462['push'](_0x3fd462['shift']());}};_0x3a0e07(++_0x1edf7c);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x3342('0x0')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x3342('0x0')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x3342('0x1')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 6284679..a04b8b0 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 _0x87e1=['request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','bluebird'];(function(_0x289f94,_0x1b53d9){var _0x1d7aba=function(_0x4afae7){while(--_0x4afae7){_0x289f94['push'](_0x289f94['shift']());}};_0x1d7aba(++_0x1b53d9);}(_0x87e1,0xb1));var _0x187e=function(_0x3546eb,_0x440f3f){_0x3546eb=_0x3546eb-0x0;var _0xe660bf=_0x87e1[_0x3546eb];return _0xe660bf;};'use strict';var _=require(_0x187e('0x0'));var util=require(_0x187e('0x1'));var logger=require(_0x187e('0x2'))(_0x187e('0x3'));var moment=require('moment');var BPromise=require(_0x187e('0x4'));var rp=require(_0x187e('0x5'));var fs=require('fs');var path=require(_0x187e('0x6'));var rimraf=require(_0x187e('0x7'));var config=require(_0x187e('0x8'));var attributes=require(_0x187e('0x9'));module[_0x187e('0xa')]=function(_0x22f398,_0x4e17ad){return _0x22f398[_0x187e('0xb')](_0x187e('0xc'),attributes,{'tableName':_0x187e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd6f=['./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','api','bluebird','path','rimraf'];(function(_0x8aec06,_0x3d5724){var _0x4c3613=function(_0x3c85da){while(--_0x3c85da){_0x8aec06['push'](_0x8aec06['shift']());}};_0x4c3613(++_0x3d5724);}(_0xcd6f,0x73));var _0xfcd6=function(_0x5b79fe,_0x3dad90){_0x5b79fe=_0x5b79fe-0x0;var _0x17d865=_0xcd6f[_0x5b79fe];return _0x17d865;};'use strict';var _=require(_0xfcd6('0x0'));var util=require(_0xfcd6('0x1'));var logger=require('../../config/logger')(_0xfcd6('0x2'));var moment=require('moment');var BPromise=require(_0xfcd6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfcd6('0x4'));var rimraf=require(_0xfcd6('0x5'));var config=require('../../config/environment');var attributes=require(_0xfcd6('0x6'));module[_0xfcd6('0x7')]=function(_0x52ad4c,_0x38e3b1){return _0x52ad4c[_0xfcd6('0x8')](_0xfcd6('0x9'),attributes,{'tableName':_0xfcd6('0xa'),'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 ad8ec97..dfe4130 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 _0x7dbc=['error','message','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xc3a6e5,_0xd127d7){var _0x3cc63c=function(_0x10280d){while(--_0x10280d){_0xc3a6e5['push'](_0xc3a6e5['shift']());}};_0x3cc63c(++_0xd127d7);}(_0x7dbc,0xe0));var _0xc7db=function(_0x4b25f4,_0x50ecc2){_0x4b25f4=_0x4b25f4-0x0;var _0xe7740d=_0x7dbc[_0x4b25f4];return _0xe7740d;};'use strict';var _=require(_0xc7db('0x0'));var util=require(_0xc7db('0x1'));var moment=require(_0xc7db('0x2'));var BPromise=require('bluebird');var rs=require(_0xc7db('0x3'));var fs=require('fs');var Redis=require(_0xc7db('0x4'));var db=require(_0xc7db('0x5'))['db'];var utils=require(_0xc7db('0x6'));var logger=require('../../config/logger')(_0xc7db('0x7'));var config=require(_0xc7db('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc7db('0x9')][_0xc7db('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x385922,_0x25c524,_0xab22e){return new BPromise(function(_0xd44058,_0x192457){return client['request'](_0x385922,_0xab22e)['then'](function(_0x268160){logger['info'](_0xc7db('0xb'),_0x25c524,_0xc7db('0xc'));logger[_0xc7db('0xd')](_0xc7db('0xe'),_0x25c524,_0xc7db('0xc'),JSON[_0xc7db('0xf')](_0x268160));if(_0x268160[_0xc7db('0x10')]){if(_0x268160['error']['code']===0x1f4){logger[_0xc7db('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x25c524,_0x268160[_0xc7db('0x10')][_0xc7db('0x11')]);return _0x192457(_0x268160[_0xc7db('0x10')]['message']);}logger[_0xc7db('0x10')](_0xc7db('0xb'),_0x25c524,_0x268160[_0xc7db('0x10')]['message']);return _0xd44058(_0x268160[_0xc7db('0x10')][_0xc7db('0x11')]);}else{logger[_0xc7db('0x12')](_0xc7db('0xb'),_0x25c524,_0xc7db('0xc'));_0xd44058(_0x268160['result'][_0xc7db('0x11')]);}})[_0xc7db('0x13')](function(_0x4f95f3){logger[_0xc7db('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x25c524,_0x4f95f3);_0x192457(_0x4f95f3);});});} \ No newline at end of file +var _0x9999=['../../config/logger','rpc','../../config/environment','http','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','UserFaxQueue,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x169d44,_0x2ab72b){var _0x28e91a=function(_0x944404){while(--_0x944404){_0x169d44['push'](_0x169d44['shift']());}};_0x28e91a(++_0x2ab72b);}(_0x9999,0xaf));var _0x9999=function(_0x54734a,_0x461676){_0x54734a=_0x54734a-0x0;var _0x3e1e93=_0x9999[_0x54734a];return _0x3e1e93;};'use strict';var _=require(_0x9999('0x0'));var util=require(_0x9999('0x1'));var moment=require('moment');var BPromise=require(_0x9999('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9999('0x3'));var db=require(_0x9999('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9999('0x5'))(_0x9999('0x6'));var config=require(_0x9999('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9999('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x16d823,_0x5207ac,_0x12c713){return new BPromise(function(_0x1caca1,_0x5c4d58){return client['request'](_0x16d823,_0x12c713)['then'](function(_0x5cde71){logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x5207ac,'request\x20sent');logger['debug'](_0x9999('0x9'),_0x5207ac,_0x9999('0xa'),JSON['stringify'](_0x5cde71));if(_0x5cde71['error']){if(_0x5cde71[_0x9999('0xb')][_0x9999('0xc')]===0x1f4){logger[_0x9999('0xb')](_0x9999('0xd'),_0x5207ac,_0x5cde71[_0x9999('0xb')][_0x9999('0xe')]);return _0x5c4d58(_0x5cde71[_0x9999('0xb')][_0x9999('0xe')]);}logger[_0x9999('0xb')](_0x9999('0xd'),_0x5207ac,_0x5cde71[_0x9999('0xb')][_0x9999('0xe')]);return _0x1caca1(_0x5cde71[_0x9999('0xb')][_0x9999('0xe')]);}else{logger[_0x9999('0xf')](_0x9999('0xd'),_0x5207ac,_0x9999('0xa'));_0x1caca1(_0x5cde71[_0x9999('0x10')][_0x9999('0xe')]);}})[_0x9999('0x11')](function(_0x2693a2){logger[_0x9999('0xb')](_0x9999('0xd'),_0x5207ac,_0x2693a2);_0x5c4d58(_0x2693a2);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 7385f5e..dec34f0 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 _0xd477=['../../components/interaction/service','../../config/environment','exports','multer','path','express','Router','../../components/auth/service'];(function(_0x4efb70,_0x53b9e1){var _0x529d05=function(_0xa44c8b){while(--_0xa44c8b){_0x4efb70['push'](_0x4efb70['shift']());}};_0x529d05(++_0x53b9e1);}(_0xd477,0x1bb));var _0x7d47=function(_0x34bbd5,_0x3c810a){_0x34bbd5=_0x34bbd5-0x0;var _0x46244f=_0xd477[_0x34bbd5];return _0x46244f;};'use strict';var multer=require(_0x7d47('0x0'));var util=require('util');var path=require(_0x7d47('0x1'));var timeout=require('connect-timeout');var express=require(_0x7d47('0x2'));var router=express[_0x7d47('0x3')]();var auth=require(_0x7d47('0x4'));var interaction=require(_0x7d47('0x5'));var config=require(_0x7d47('0x6'));module[_0x7d47('0x7')]=router; \ No newline at end of file +var _0x71d1=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','exports','multer'];(function(_0x4c4079,_0x32376e){var _0x2d8bcf=function(_0x314713){while(--_0x314713){_0x4c4079['push'](_0x4c4079['shift']());}};_0x2d8bcf(++_0x32376e);}(_0x71d1,0x98));var _0x171d=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x71d1[_0x4b2863];return _0x567d67;};'use strict';var multer=require(_0x171d('0x0'));var util=require(_0x171d('0x1'));var path=require(_0x171d('0x2'));var timeout=require(_0x171d('0x3'));var express=require(_0x171d('0x4'));var router=express[_0x171d('0x5')]();var auth=require(_0x171d('0x6'));var interaction=require(_0x171d('0x7'));var config=require('../../config/environment');module[_0x171d('0x8')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 7a40326..72577b9 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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x51e070,_0x4d157b){var _0x16772c=function(_0x4f4e1a){while(--_0x4f4e1a){_0x51e070['push'](_0x51e070['shift']());}};_0x16772c(++_0x4d157b);}(_0xe706,0xa3));var _0x6e70=function(_0x11bb60,_0x3dc734){_0x11bb60=_0x11bb60-0x0;var _0x37357e=_0xe706[_0x11bb60];return _0x37357e;};'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(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 36aed68..e4411e2 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 _0xd8b0=['define','user_has_mail_queues','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x254f29,_0x4c3a72){var _0x12783f=function(_0x371dbb){while(--_0x371dbb){_0x254f29['push'](_0x254f29['shift']());}};_0x12783f(++_0x4c3a72);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./userMailQueue.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('UserMailQueue',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['moment','bluebird','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','../../config/logger','api'];(function(_0x44ae6c,_0x3fccae){var _0x59e7c0=function(_0x332692){while(--_0x332692){_0x44ae6c['push'](_0x44ae6c['shift']());}};_0x59e7c0(++_0x3fccae);}(_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/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 73b48f7..1fd4243 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 _0xe984=['UserMailQueue,\x20%s,\x20%s','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x438dc5,_0x41922c){var _0x27a0a1=function(_0x1d49ba){while(--_0x1d49ba){_0x438dc5['push'](_0x438dc5['shift']());}};_0x27a0a1(++_0x41922c);}(_0xe984,0xe2));var _0x4e98=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0xe984[_0x2642cb];return _0xe6e41;};'use strict';var _=require('lodash');var util=require(_0x4e98('0x0'));var moment=require(_0x4e98('0x1'));var BPromise=require(_0x4e98('0x2'));var rs=require(_0x4e98('0x3'));var fs=require('fs');var Redis=require(_0x4e98('0x4'));var db=require(_0x4e98('0x5'))['db'];var utils=require(_0x4e98('0x6'));var logger=require(_0x4e98('0x7'))(_0x4e98('0x8'));var config=require(_0x4e98('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4e98('0xa')][_0x4e98('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29d7a7,_0xf7f079,_0x54e926){return new BPromise(function(_0x45998,_0x402bdf){return client[_0x4e98('0xc')](_0x29d7a7,_0x54e926)[_0x4e98('0xd')](function(_0x156056){logger['info'](_0x4e98('0xe'),_0xf7f079,'request\x20sent');logger[_0x4e98('0xf')](_0x4e98('0x10'),_0xf7f079,_0x4e98('0x11'),JSON[_0x4e98('0x12')](_0x156056));if(_0x156056[_0x4e98('0x13')]){if(_0x156056['error'][_0x4e98('0x14')]===0x1f4){logger[_0x4e98('0x13')](_0x4e98('0xe'),_0xf7f079,_0x156056['error'][_0x4e98('0x15')]);return _0x402bdf(_0x156056['error'][_0x4e98('0x15')]);}logger[_0x4e98('0x13')](_0x4e98('0xe'),_0xf7f079,_0x156056[_0x4e98('0x13')]['message']);return _0x45998(_0x156056[_0x4e98('0x13')][_0x4e98('0x15')]);}else{logger[_0x4e98('0x16')](_0x4e98('0xe'),_0xf7f079,_0x4e98('0x11'));_0x45998(_0x156056['result'][_0x4e98('0x15')]);}})[_0x4e98('0x17')](function(_0x26b60a){logger[_0x4e98('0x13')](_0x4e98('0xe'),_0xf7f079,_0x26b60a);_0x402bdf(_0x26b60a);});});} \ No newline at end of file +var _0x07d7=['result','catch','UserMailQueue,\x20%s,\x20%s','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x11fc41,_0x5409e3){var _0x252d5a=function(_0x1a20df){while(--_0x1a20df){_0x11fc41['push'](_0x11fc41['shift']());}};_0x252d5a(++_0x5409e3);}(_0x07d7,0x85));var _0x707d=function(_0x2ca616,_0x384ec8){_0x2ca616=_0x2ca616-0x0;var _0x53155f=_0x07d7[_0x2ca616];return _0x53155f;};'use strict';var _=require(_0x707d('0x0'));var util=require(_0x707d('0x1'));var moment=require(_0x707d('0x2'));var BPromise=require(_0x707d('0x3'));var rs=require(_0x707d('0x4'));var fs=require('fs');var Redis=require(_0x707d('0x5'));var db=require(_0x707d('0x6'))['db'];var utils=require(_0x707d('0x7'));var logger=require(_0x707d('0x8'))(_0x707d('0x9'));var config=require(_0x707d('0xa'));var jayson=require(_0x707d('0xb'));var client=jayson[_0x707d('0xc')][_0x707d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1bdf46,_0x13df54,_0x50de20){return new BPromise(function(_0x4c9e57,_0x5fe2d4){return client[_0x707d('0xe')](_0x1bdf46,_0x50de20)[_0x707d('0xf')](function(_0x2cc0c1){logger[_0x707d('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x13df54,_0x707d('0x11'));logger[_0x707d('0x12')](_0x707d('0x13'),_0x13df54,'request\x20sent',JSON[_0x707d('0x14')](_0x2cc0c1));if(_0x2cc0c1[_0x707d('0x15')]){if(_0x2cc0c1[_0x707d('0x15')]['code']===0x1f4){logger['error']('UserMailQueue,\x20%s,\x20%s',_0x13df54,_0x2cc0c1[_0x707d('0x15')][_0x707d('0x16')]);return _0x5fe2d4(_0x2cc0c1[_0x707d('0x15')]['message']);}logger[_0x707d('0x15')]('UserMailQueue,\x20%s,\x20%s',_0x13df54,_0x2cc0c1[_0x707d('0x15')][_0x707d('0x16')]);return _0x4c9e57(_0x2cc0c1['error']['message']);}else{logger[_0x707d('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x13df54,_0x707d('0x11'));_0x4c9e57(_0x2cc0c1[_0x707d('0x17')][_0x707d('0x16')]);}})[_0x707d('0x18')](function(_0x148d08){logger[_0x707d('0x15')](_0x707d('0x19'),_0x13df54,_0x148d08);_0x5fe2d4(_0x148d08);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index fc73ad3..abca962 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 _0xf91a=['express','Router','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout'];(function(_0x15472b,_0x2f0c29){var _0x34194c=function(_0x3a80f6){while(--_0x3a80f6){_0x15472b['push'](_0x15472b['shift']());}};_0x34194c(++_0x2f0c29);}(_0xf91a,0x1b5));var _0xaf91=function(_0x427ed8,_0x2cf5b4){_0x427ed8=_0x427ed8-0x0;var _0x556b1b=_0xf91a[_0x427ed8];return _0x556b1b;};'use strict';var multer=require(_0xaf91('0x0'));var util=require(_0xaf91('0x1'));var path=require(_0xaf91('0x2'));var timeout=require(_0xaf91('0x3'));var express=require(_0xaf91('0x4'));var router=express[_0xaf91('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xaf91('0x6'));var config=require(_0xaf91('0x7'));module[_0xaf91('0x8')]=router; \ No newline at end of file +var _0xea6c=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','util','path','connect-timeout','express'];(function(_0x6aad74,_0x32ecf4){var _0x5b1c38=function(_0x567477){while(--_0x567477){_0x6aad74['push'](_0x6aad74['shift']());}};_0x5b1c38(++_0x32ecf4);}(_0xea6c,0x164));var _0xcea6=function(_0x16d369,_0xbbaa52){_0x16d369=_0x16d369-0x0;var _0x53c1ca=_0xea6c[_0x16d369];return _0x53c1ca;};'use strict';var multer=require('multer');var util=require(_0xcea6('0x0'));var path=require(_0xcea6('0x1'));var timeout=require(_0xcea6('0x2'));var express=require(_0xcea6('0x3'));var router=express[_0xcea6('0x4')]();var auth=require(_0xcea6('0x5'));var interaction=require(_0xcea6('0x6'));var config=require(_0xcea6('0x7'));module[_0xcea6('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 4dd06de..7db9a8f 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(_0x3b53b0,_0x23dc58){var _0x4eddc6=function(_0x46254f){while(--_0x46254f){_0x3b53b0['push'](_0x3b53b0['shift']());}};_0x4eddc6(++_0x23dc58);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x325673,_0x13c10b){var _0x741c5b=function(_0x33eeb2){while(--_0x33eeb2){_0x325673['push'](_0x325673['shift']());}};_0x741c5b(++_0x13c10b);}(_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/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 5277f4f..046ef4d 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 _0xb8a1=['moment','bluebird','request-promise','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','../../config/logger'];(function(_0xd2f4ac,_0x5aa8e5){var _0x9757b2=function(_0x442ced){while(--_0x442ced){_0xd2f4ac['push'](_0xd2f4ac['shift']());}};_0x9757b2(++_0x5aa8e5);}(_0xb8a1,0x1d2));var _0x1b8a=function(_0x5dc28e,_0x2d1c95){_0x5dc28e=_0x5dc28e-0x0;var _0x1b262d=_0xb8a1[_0x5dc28e];return _0x1b262d;};'use strict';var _=require(_0x1b8a('0x0'));var util=require('util');var logger=require(_0x1b8a('0x1'))('api');var moment=require(_0x1b8a('0x2'));var BPromise=require(_0x1b8a('0x3'));var rp=require(_0x1b8a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1b8a('0x5'));var config=require(_0x1b8a('0x6'));var attributes=require(_0x1b8a('0x7'));module[_0x1b8a('0x8')]=function(_0x216fc2,_0x44be62){return _0x216fc2[_0x1b8a('0x9')](_0x1b8a('0xa'),attributes,{'tableName':_0x1b8a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdbad=['user_has_openchannel_queues','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue'];(function(_0x2171b0,_0x5c47a2){var _0x5f4031=function(_0x87f628){while(--_0x87f628){_0x2171b0['push'](_0x2171b0['shift']());}};_0x5f4031(++_0x5c47a2);}(_0xdbad,0xf1));var _0xddba=function(_0x20f382,_0x573c9e){_0x20f382=_0x20f382-0x0;var _0x3f45d2=_0xdbad[_0x20f382];return _0x3f45d2;};'use strict';var _=require(_0xddba('0x0'));var util=require('util');var logger=require(_0xddba('0x1'))(_0xddba('0x2'));var moment=require('moment');var BPromise=require(_0xddba('0x3'));var rp=require(_0xddba('0x4'));var fs=require('fs');var path=require(_0xddba('0x5'));var rimraf=require(_0xddba('0x6'));var config=require('../../config/environment');var attributes=require(_0xddba('0x7'));module[_0xddba('0x8')]=function(_0x1ea9ef,_0x7503c3){return _0x1ea9ef[_0xddba('0x9')](_0xddba('0xa'),attributes,{'tableName':_0xddba('0xb'),'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 ef6b5ab..8095a63 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 _0xabe4=['stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x23bcd4,_0xd3deb0){var _0x4cb792=function(_0x48d4c8){while(--_0x48d4c8){_0x23bcd4['push'](_0x23bcd4['shift']());}};_0x4cb792(++_0xd3deb0);}(_0xabe4,0xb6));var _0x4abe=function(_0x538a20,_0x5c14d6){_0x538a20=_0x538a20-0x0;var _0xec72f5=_0xabe4[_0x538a20];return _0xec72f5;};'use strict';var _=require(_0x4abe('0x0'));var util=require('util');var moment=require(_0x4abe('0x1'));var BPromise=require(_0x4abe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4abe('0x3'));var db=require(_0x4abe('0x4'))['db'];var utils=require(_0x4abe('0x5'));var logger=require(_0x4abe('0x6'))('rpc');var config=require(_0x4abe('0x7'));var jayson=require(_0x4abe('0x8'));var client=jayson[_0x4abe('0x9')][_0x4abe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19ac36,_0x4e37ff,_0x2bb39a){return new BPromise(function(_0x5981b1,_0x4d85e1){return client[_0x4abe('0xb')](_0x19ac36,_0x2bb39a)[_0x4abe('0xc')](function(_0x529a8b){logger['info'](_0x4abe('0xd'),_0x4e37ff,_0x4abe('0xe'));logger[_0x4abe('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x4e37ff,_0x4abe('0xe'),JSON[_0x4abe('0x10')](_0x529a8b));if(_0x529a8b[_0x4abe('0x11')]){if(_0x529a8b['error'][_0x4abe('0x12')]===0x1f4){logger[_0x4abe('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4e37ff,_0x529a8b[_0x4abe('0x11')][_0x4abe('0x13')]);return _0x4d85e1(_0x529a8b[_0x4abe('0x11')][_0x4abe('0x13')]);}logger[_0x4abe('0x11')](_0x4abe('0xd'),_0x4e37ff,_0x529a8b[_0x4abe('0x11')]['message']);return _0x5981b1(_0x529a8b[_0x4abe('0x11')]['message']);}else{logger['info'](_0x4abe('0xd'),_0x4e37ff,'request\x20sent');_0x5981b1(_0x529a8b[_0x4abe('0x14')][_0x4abe('0x13')]);}})[_0x4abe('0x15')](function(_0x3b729c){logger[_0x4abe('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4e37ff,_0x3b729c);_0x4d85e1(_0x3b729c);});});} \ No newline at end of file +var _0x5675=['http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x59237a,_0x4a3a15){var _0x5148ae=function(_0x254407){while(--_0x254407){_0x59237a['push'](_0x59237a['shift']());}};_0x5148ae(++_0x4a3a15);}(_0x5675,0xae));var _0x5567=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0x5675[_0x58afd5];return _0x3e503b;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5567('0x0'));var db=require(_0x5567('0x1'))['db'];var utils=require(_0x5567('0x2'));var logger=require('../../config/logger')(_0x5567('0x3'));var config=require(_0x5567('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x5567('0x5')][_0x5567('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x32fe4f,_0x5fad55,_0x184c46){return new BPromise(function(_0x47481e,_0x5bfe9c){return client[_0x5567('0x7')](_0x32fe4f,_0x184c46)[_0x5567('0x8')](function(_0x2b22bd){logger[_0x5567('0x9')](_0x5567('0xa'),_0x5fad55,'request\x20sent');logger['debug'](_0x5567('0xb'),_0x5fad55,_0x5567('0xc'),JSON['stringify'](_0x2b22bd));if(_0x2b22bd[_0x5567('0xd')]){if(_0x2b22bd[_0x5567('0xd')][_0x5567('0xe')]===0x1f4){logger[_0x5567('0xd')](_0x5567('0xa'),_0x5fad55,_0x2b22bd['error'][_0x5567('0xf')]);return _0x5bfe9c(_0x2b22bd[_0x5567('0xd')][_0x5567('0xf')]);}logger[_0x5567('0xd')](_0x5567('0xa'),_0x5fad55,_0x2b22bd['error']['message']);return _0x47481e(_0x2b22bd['error'][_0x5567('0xf')]);}else{logger[_0x5567('0x9')](_0x5567('0xa'),_0x5fad55,'request\x20sent');_0x47481e(_0x2b22bd[_0x5567('0x10')][_0x5567('0xf')]);}})[_0x5567('0x11')](function(_0x16127d){logger[_0x5567('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x5fad55,_0x16127d);_0x5bfe9c(_0x16127d);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 0edded1..13ac6e9 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 _0x107a=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','describe','/:id','show','/:id/sections','/:id/resources','getResources','create','/:id/clone','post','addResources','put','update','delete','destroy','removeSections','exports','multer'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x107a,0x19f));var _0xa107=function(_0x32e455,_0x424d87){_0x32e455=_0x32e455-0x0;var _0x4c65cc=_0x107a[_0x32e455];return _0x4c65cc;};'use strict';var multer=require(_0xa107('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa107('0x1'));var express=require(_0xa107('0x2'));var router=express[_0xa107('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xa107('0x4'));var config=require(_0xa107('0x5'));var controller=require(_0xa107('0x6'));router[_0xa107('0x7')]('/',auth[_0xa107('0x8')](),controller[_0xa107('0x9')]);router[_0xa107('0x7')]('/describe',auth[_0xa107('0x8')](),controller[_0xa107('0xa')]);router[_0xa107('0x7')](_0xa107('0xb'),auth[_0xa107('0x8')](),controller[_0xa107('0xc')]);router[_0xa107('0x7')](_0xa107('0xd'),auth[_0xa107('0x8')](),controller['getSections']);router['get'](_0xa107('0xe'),auth['isAuthenticated'](),controller[_0xa107('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa107('0x10')]);router['post'](_0xa107('0x11'),auth['isAuthenticated'](),controller['clone']);router[_0xa107('0x12')]('/:id/sections',auth[_0xa107('0x8')](),controller['addSections']);router['post']('/:id/resources',auth[_0xa107('0x8')](),controller[_0xa107('0x13')]);router[_0xa107('0x14')](_0xa107('0xb'),auth[_0xa107('0x8')](),controller[_0xa107('0x15')]);router[_0xa107('0x16')](_0xa107('0xb'),auth[_0xa107('0x8')](),controller[_0xa107('0x17')]);router['delete'](_0xa107('0xd'),auth['isAuthenticated'](),controller[_0xa107('0x18')]);router['delete']('/:id/resources',auth[_0xa107('0x8')](),controller['removeResources']);module[_0xa107('0x19')]=router; \ No newline at end of file +var _0xe05d=['exports','multer','connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated','/describe','describe','/:id','show','/:id/sections','/:id/resources','getResources','post','create','/:id/clone','clone','addSections','update','delete','removeSections','removeResources'];(function(_0x1e14df,_0x4a9c80){var _0x3a32ca=function(_0x2d2d71){while(--_0x2d2d71){_0x1e14df['push'](_0x1e14df['shift']());}};_0x3a32ca(++_0x4a9c80);}(_0xe05d,0xf1));var _0xde05=function(_0x3b6780,_0xa8fbe4){_0x3b6780=_0x3b6780-0x0;var _0x4fe37b=_0xe05d[_0x3b6780];return _0x4fe37b;};'use strict';var multer=require(_0xde05('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xde05('0x1'));var express=require(_0xde05('0x2'));var router=express[_0xde05('0x3')]();var auth=require(_0xde05('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./userProfile.controller');router[_0xde05('0x5')]('/',auth[_0xde05('0x6')](),controller['index']);router[_0xde05('0x5')](_0xde05('0x7'),auth[_0xde05('0x6')](),controller[_0xde05('0x8')]);router[_0xde05('0x5')](_0xde05('0x9'),auth[_0xde05('0x6')](),controller[_0xde05('0xa')]);router[_0xde05('0x5')](_0xde05('0xb'),auth[_0xde05('0x6')](),controller['getSections']);router[_0xde05('0x5')](_0xde05('0xc'),auth[_0xde05('0x6')](),controller[_0xde05('0xd')]);router[_0xde05('0xe')]('/',auth['isAuthenticated'](),controller[_0xde05('0xf')]);router[_0xde05('0xe')](_0xde05('0x10'),auth[_0xde05('0x6')](),controller[_0xde05('0x11')]);router[_0xde05('0xe')]('/:id/sections',auth[_0xde05('0x6')](),controller[_0xde05('0x12')]);router[_0xde05('0xe')](_0xde05('0xc'),auth[_0xde05('0x6')](),controller['addResources']);router['put'](_0xde05('0x9'),auth[_0xde05('0x6')](),controller[_0xde05('0x13')]);router[_0xde05('0x14')](_0xde05('0x9'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0xde05('0xb'),auth[_0xde05('0x6')](),controller[_0xde05('0x15')]);router['delete']('/:id/resources',auth[_0xde05('0x6')](),controller[_0xde05('0x16')]);module[_0xde05('0x17')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 635085b..071a662 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 _0xeec0=['setDataValue','crudPermissions','join','getDataValue','split','exports','STRING'];(function(_0x3b5dcf,_0x1a6d96){var _0xb3ed7b=function(_0x1206fe){while(--_0x1206fe){_0x3b5dcf['push'](_0x3b5dcf['shift']());}};_0xb3ed7b(++_0x1a6d96);}(_0xeec0,0x98));var _0x0eec=function(_0x37e714,_0x117142){_0x37e714=_0x37e714-0x0;var _0x16c12e=_0xeec0[_0x37e714];return _0x16c12e;};'use strict';var Sequelize=require('sequelize');module[_0x0eec('0x0')]={'name':{'type':Sequelize[_0x0eec('0x1')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x1e4bcb){this[_0x0eec('0x2')](_0x0eec('0x3'),_0x1e4bcb?_0x1e4bcb[_0x0eec('0x4')](''):[]);},'get':function(){return this[_0x0eec('0x5')]('crudPermissions')?this[_0x0eec('0x5')]('crudPermissions')[_0x0eec('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x0eec('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x412a=['STRING','name','setDataValue','crudPermissions','join','sequelize','exports'];(function(_0x248706,_0x5bc444){var _0x42191b=function(_0x302fd6){while(--_0x302fd6){_0x248706['push'](_0x248706['shift']());}};_0x42191b(++_0x5bc444);}(_0x412a,0x17f));var _0xa412=function(_0x28857,_0x59c671){_0x28857=_0x28857-0x0;var _0x1c98b8=_0x412a[_0x28857];return _0x1c98b8;};'use strict';var Sequelize=require(_0xa412('0x0'));module[_0xa412('0x1')]={'name':{'type':Sequelize[_0xa412('0x2')],'allowNull':![],'unique':_0xa412('0x3')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x16593b){this[_0xa412('0x4')](_0xa412('0x5'),_0x16593b?_0x16593b[_0xa412('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0xa412('0x5'))?this['getDataValue']('crudPermissions')['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index f22bd57..391ac86 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 _0x19d1=['omit','updatedAt','crudPermissions','createdAt','findAll','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','UserProfileSection','describe','addSections','ids','getSections','enabled','isEmpty','subsections','includes','push','findOne','Dashboard','forEach','resourceId','sequelize','bulkCreate','removeResources','getResources','section','undefined','Sequelize','Unknown\x20section','mergeResources','childModel','all','ignore','union','hasOwnProperty','order','VIRTUAL','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','reportId','rows','CmContact','Tag','Tags','color','ThroughTags','tag','value','squareprojects','SquareProject','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','Lists','lists','companies','CmCompany','chatqueues','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','internalroutes','outboundroutes','VoiceExtension','contexts','voicemails','VoiceMail','voicerecordings','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','SmsQueue','smsaccounts','SmsAccount','teams','queuecampaigns','users','agents','telephones','Users','admin','user','Agents','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','Disposition','customdashboards','intervals','Interval','pauses','Pause','scheduler','Schedule','tags','templates','triggers','Variable','plugins','Plugin','extractedreports','Reports','AnalyticMetric','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','update','destroy','then','name','send','index','map','UserProfile','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','type','options','includeAll','include','catch','show','params','find','create','body','clone','get'];(function(_0x5adad8,_0x22944c){var _0x4e3988=function(_0x50bc70){while(--_0x50bc70){_0x5adad8['push'](_0x5adad8['shift']());}};_0x4e3988(++_0x22944c);}(_0x19d1,0x99));var _0x119d=function(_0x3b765c,_0x3f4296){_0x3b765c=_0x3b765c-0x0;var _0x2c862e=_0x19d1[_0x3b765c];return _0x2c862e;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x119d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x119d('0x1'));var rp=require(_0x119d('0x2'));var moment=require(_0x119d('0x3'));var BPromise=require(_0x119d('0x4'));var Mustache=require(_0x119d('0x5'));var util=require('util');var path=require('path');var sox=require(_0x119d('0x6'));var csv=require(_0x119d('0x7'));var ejs=require(_0x119d('0x8'));var fs=require('fs');var _=require(_0x119d('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x119d('0xa'));var deskjs=require(_0x119d('0xb'));var toCsv=require('to-csv');var querystring=require(_0x119d('0xc'));var Papa=require(_0x119d('0xd'));var Redis=require(_0x119d('0xe'));var authService=require(_0x119d('0xf'));var qs=require(_0x119d('0x10'));var as=require(_0x119d('0x11'));var hardwareService=require(_0x119d('0x12'));var logger=require(_0x119d('0x13'))('api');var utils=require(_0x119d('0x14'));var config=require(_0x119d('0x15'));var db=require(_0x119d('0x16'))['db'];config[_0x119d('0x17')]=_[_0x119d('0x18')](config[_0x119d('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x119d('0x19'))(new Redis(config[_0x119d('0x17')]));require('./userProfile.socket')[_0x119d('0x1a')](socket);function respondWithStatusCode(_0x37dfd8,_0x338d88){_0x338d88=_0x338d88||0xcc;return function(_0x271229){if(_0x271229){return _0x37dfd8[_0x119d('0x1b')](_0x338d88);}return _0x37dfd8['status'](_0x338d88)[_0x119d('0x1c')]();};}function respondWithResult(_0x3878ac,_0x4eb73e){_0x4eb73e=_0x4eb73e||0xc8;return function(_0x21fd54){if(_0x21fd54){return _0x3878ac[_0x119d('0x1d')](_0x4eb73e)[_0x119d('0x1e')](_0x21fd54);}};}function respondWithFilteredResult(_0xffbde7,_0x200620){return function(_0x22a607){if(_0x22a607){var _0x597ad6=_0x22a607[_0x119d('0x1f')],_0x257341=_0x200620['offset'],_0x15d710=_0x200620[_0x119d('0x20')]+_0x200620[_0x119d('0x21')],_0x1fcebd;if(_0x15d710>=_0x597ad6){_0x15d710=_0x597ad6;_0x1fcebd=0xc8;}else{_0x1fcebd=0xce;}_0xffbde7['status'](_0x1fcebd);return _0xffbde7['set'](_0x119d('0x22'),_0x257341+'-'+_0x15d710+'/'+_0x597ad6)[_0x119d('0x1e')](_0x22a607);}return null;};}function patchUpdates(_0x200dc0){return function(_0x1e9e79){try{jsonpatch[_0x119d('0x23')](_0x1e9e79,_0x200dc0,!![]);}catch(_0x4206e5){return BPromise['reject'](_0x4206e5);}return _0x1e9e79['save']();};}function saveUpdates(_0x30c8dc,_0x4ef9ca){return function(_0x2d6d18){if(_0x2d6d18){return _0x2d6d18[_0x119d('0x24')](_0x30c8dc)['then'](function(_0x2dcd6e){return _0x2dcd6e;});}return null;};}function removeEntity(_0x60351b,_0x40a7f6){return function(_0x9f0135){if(_0x9f0135){return _0x9f0135[_0x119d('0x25')]()[_0x119d('0x26')](function(){_0x60351b[_0x119d('0x1d')](0xcc)[_0x119d('0x1c')]();});}};}function handleEntityNotFound(_0x317140,_0x14dc2c){return function(_0x532e3f){if(!_0x532e3f){_0x317140[_0x119d('0x1b')](0x194);}return _0x532e3f;};}function handleError(_0x371376,_0x106066){_0x106066=_0x106066||0x1f4;return function(_0x416d98){logger['error'](_0x416d98['stack']);if(_0x416d98[_0x119d('0x27')]){delete _0x416d98[_0x119d('0x27')];}_0x371376[_0x119d('0x1d')](_0x106066)[_0x119d('0x28')](_0x416d98);};}exports[_0x119d('0x29')]=function(_0x547c6b,_0x219c6a){var _0x1670e5={},_0x49330b={},_0x50e3c8={'count':0x0,'rows':[]};var _0x2bc25f=_[_0x119d('0x2a')](db[_0x119d('0x2b')][_0x119d('0x2c')],function(_0x755f55){return{'name':_0x755f55[_0x119d('0x2d')],'type':_0x755f55['type'][_0x119d('0x2e')]};});_0x49330b[_0x119d('0x2f')]=_['map'](_0x2bc25f,'name');_0x49330b[_0x119d('0x30')]=_[_0x119d('0x31')](_0x547c6b['query']);_0x49330b[_0x119d('0x32')]=_[_0x119d('0x33')](_0x49330b[_0x119d('0x2f')],_0x49330b[_0x119d('0x30')]);_0x1670e5['attributes']=_[_0x119d('0x33')](_0x49330b[_0x119d('0x2f')],qs[_0x119d('0x34')](_0x547c6b[_0x119d('0x30')][_0x119d('0x34')]));_0x1670e5[_0x119d('0x35')]=_0x1670e5['attributes'][_0x119d('0x36')]?_0x1670e5[_0x119d('0x35')]:_0x49330b['model'];if(!_0x547c6b[_0x119d('0x30')]['hasOwnProperty'](_0x119d('0x37'))){_0x1670e5[_0x119d('0x21')]=qs[_0x119d('0x21')](_0x547c6b[_0x119d('0x30')]['limit']);_0x1670e5['offset']=qs[_0x119d('0x20')](_0x547c6b['query'][_0x119d('0x20')]);}_0x1670e5['order']=qs[_0x119d('0x38')](_0x547c6b[_0x119d('0x30')][_0x119d('0x38')]);_0x1670e5[_0x119d('0x39')]=qs[_0x119d('0x32')](_[_0x119d('0x3a')](_0x547c6b[_0x119d('0x30')],_0x49330b[_0x119d('0x32')]));if(_0x547c6b['query'][_0x119d('0x3b')]){_0x1670e5[_0x119d('0x39')]=_[_0x119d('0x3c')](_0x1670e5[_0x119d('0x39')],{'$or':_[_0x119d('0x2a')](_0x2bc25f,function(_0x395e2d){if(_0x395e2d[_0x119d('0x3d')]!=='VIRTUAL'){var _0x4e262f={};_0x4e262f[_0x395e2d[_0x119d('0x27')]]={'$like':'%'+_0x547c6b[_0x119d('0x30')][_0x119d('0x3b')]+'%'};return _0x4e262f;}})});}_0x1670e5=_[_0x119d('0x3c')]({},_0x1670e5,_0x547c6b[_0x119d('0x3e')]);var _0x3ab7be={'where':_0x1670e5[_0x119d('0x39')]};return db[_0x119d('0x2b')]['count'](_0x3ab7be)[_0x119d('0x26')](function(_0x3753e5){_0x50e3c8['count']=_0x3753e5;if(_0x547c6b[_0x119d('0x30')][_0x119d('0x3f')]){_0x1670e5[_0x119d('0x40')]=[{'all':!![]}];}return db[_0x119d('0x2b')]['findAll'](_0x1670e5);})['then'](function(_0x3235c7){_0x50e3c8['rows']=_0x3235c7;return _0x50e3c8;})[_0x119d('0x26')](respondWithFilteredResult(_0x219c6a,_0x1670e5))[_0x119d('0x41')](handleError(_0x219c6a,null));};exports[_0x119d('0x42')]=function(_0x49bc3e,_0x3e613d){var _0x2b75dc={'raw':![],'where':{'id':_0x49bc3e[_0x119d('0x43')]['id']}},_0x53d7e5={};_0x53d7e5[_0x119d('0x2f')]=_['keys'](db['UserProfile'][_0x119d('0x2c')]);_0x53d7e5[_0x119d('0x30')]=_['keys'](_0x49bc3e[_0x119d('0x30')]);_0x53d7e5[_0x119d('0x32')]=_['intersection'](_0x53d7e5['model'],_0x53d7e5[_0x119d('0x30')]);_0x2b75dc[_0x119d('0x35')]=_['intersection'](_0x53d7e5[_0x119d('0x2f')],qs[_0x119d('0x34')](_0x49bc3e[_0x119d('0x30')]['fields']));_0x2b75dc[_0x119d('0x35')]=_0x2b75dc[_0x119d('0x35')][_0x119d('0x36')]?_0x2b75dc[_0x119d('0x35')]:_0x53d7e5[_0x119d('0x2f')];if(_0x49bc3e[_0x119d('0x30')][_0x119d('0x3f')]){_0x2b75dc['include']=[{'all':!![]}];}_0x2b75dc=_['merge']({},_0x2b75dc,_0x49bc3e[_0x119d('0x3e')]);return db[_0x119d('0x2b')][_0x119d('0x44')](_0x2b75dc)[_0x119d('0x26')](handleEntityNotFound(_0x3e613d,null))[_0x119d('0x26')](respondWithResult(_0x3e613d,null))['catch'](handleError(_0x3e613d,null));};exports[_0x119d('0x45')]=function(_0x1043a1,_0x3ac617){return db['UserProfile'][_0x119d('0x45')](_0x1043a1[_0x119d('0x46')],{})[_0x119d('0x26')](respondWithResult(_0x3ac617,0xc9))['catch'](handleError(_0x3ac617,null));};exports[_0x119d('0x47')]=function(_0xac2749,_0x3c2450){var _0x3a9a10={'where':{'id':_0xac2749[_0x119d('0x43')]['id']}},_0x5a6217={};_0x5a6217[_0x119d('0x2f')]=_['keys'](db[_0x119d('0x2b')][_0x119d('0x2c')]);_0x3a9a10[_0x119d('0x35')]=_[_0x119d('0x33')](_0x5a6217[_0x119d('0x2f')],qs[_0x119d('0x34')](_0xac2749[_0x119d('0x30')][_0x119d('0x34')]));_0x3a9a10[_0x119d('0x35')]=_0x3a9a10['attributes'][_0x119d('0x36')]?_0x3a9a10[_0x119d('0x35')]:_0x5a6217[_0x119d('0x2f')];if(_0xac2749[_0x119d('0x30')]['includeAll']){_0x3a9a10[_0x119d('0x40')]=[{'all':!![]}];}_0x3a9a10=_[_0x119d('0x3c')]({},_0x3a9a10,_0xac2749[_0x119d('0x3e')]);return db[_0x119d('0x2b')][_0x119d('0x44')](_0x3a9a10)['then'](handleEntityNotFound(_0x3c2450,null))[_0x119d('0x26')](function(_0x198cb1){if(_0x198cb1){var _0x11b252=_0x198cb1[_0x119d('0x48')]({'plain':!![]});_0x11b252=qs[_0x119d('0x49')](_0x11b252,['id','createdAt',_0x119d('0x4a'),_0x119d('0x4b')]);_0xac2749[_0x119d('0x46')]=_[_0x119d('0x49')](_0xac2749[_0x119d('0x46')],['id',_0x119d('0x4c'),_0x119d('0x4a')]);return db['sequelize']['transaction'](function(_0x5db58a){return db['UserProfile'][_0x119d('0x45')](_['merge'](_0x11b252,_0xac2749[_0x119d('0x46')]),{'include':_0xac2749[_0x119d('0x30')][_0x119d('0x3f')]?[{'all':!![]}]:undefined,'transaction':_0x5db58a})[_0x119d('0x26')](function(_0x1ba9d3){var _0x552360=_0x1ba9d3[_0x119d('0x48')]({'plain':!![]});return db['UserProfileSection'][_0x119d('0x4d')]({'where':{'userProfileId':_0xac2749[_0x119d('0x43')]['id']},'raw':!![]})[_0x119d('0x26')](function(_0x5bcfe5){if(_0x5bcfe5){return BPromise[_0x119d('0x4e')](_0x5bcfe5,function(_0x9b20e3){return new BPromise(function(_0xcbecd8,_0xa4bc7){if(_0x9b20e3[_0x119d('0x4f')]===null||_0x9b20e3[_0x119d('0x4f')]===0x1)_0xcbecd8(null);return db[_0x119d('0x50')][_0x119d('0x4d')]({'where':{'sectionId':_0x9b20e3['id']},'raw':!![]})[_0x119d('0x26')](function(_0x27cab1){var _0x4bbcbf=_[_0x119d('0x2a')](_0x27cab1,function(_0xd78346){return qs[_0x119d('0x49')](_0xd78346,['id',_0x119d('0x4c'),_0x119d('0x4a'),_0x119d('0x51')]);});_0xcbecd8(_0x4bbcbf);})[_0x119d('0x41')](function(_0x105ad2){_0xa4bc7(_0x105ad2);});})[_0x119d('0x26')](function(_0x41b721){var _0x3498d9=qs[_0x119d('0x49')](_0x9b20e3,['id',_0x119d('0x4c'),_0x119d('0x4a')]);_0x3498d9[_0x119d('0x52')]=_0x552360['id'];if(_0x41b721)_0x3498d9[_0x119d('0x53')]=_0x41b721;return _0x3498d9;})['then'](function(_0x3e5fc4){return db[_0x119d('0x54')][_0x119d('0x45')](_0x3e5fc4,{'include':[{'model':db[_0x119d('0x50')],'as':_0x119d('0x53')}],'raw':!![],'transaction':_0x5db58a});});})[_0x119d('0x26')](function(){return _0x552360;});}});});});}})[_0x119d('0x26')](respondWithResult(_0x3c2450,0xc9))[_0x119d('0x41')](handleError(_0x3c2450,null));};exports[_0x119d('0x24')]=function(_0x562398,_0x304b86){if(_0x562398[_0x119d('0x46')]['id']){delete _0x562398[_0x119d('0x46')]['id'];}return db[_0x119d('0x2b')][_0x119d('0x44')]({'where':{'id':_0x562398['params']['id']}})[_0x119d('0x26')](handleEntityNotFound(_0x304b86,null))[_0x119d('0x26')](saveUpdates(_0x562398[_0x119d('0x46')],null))[_0x119d('0x26')](respondWithResult(_0x304b86,null))[_0x119d('0x41')](handleError(_0x304b86,null));};exports[_0x119d('0x25')]=function(_0x3260b0,_0x94285f){return db[_0x119d('0x2b')]['find']({'where':{'id':_0x3260b0[_0x119d('0x43')]['id']}})[_0x119d('0x26')](handleEntityNotFound(_0x94285f,null))[_0x119d('0x26')](removeEntity(_0x94285f,null))[_0x119d('0x41')](handleError(_0x94285f,null));};exports[_0x119d('0x55')]=function(_0x4510e4,_0x434bb2){return db[_0x119d('0x2b')][_0x119d('0x55')]()[_0x119d('0x26')](respondWithResult(_0x434bb2,null))[_0x119d('0x41')](handleError(_0x434bb2,null));};exports[_0x119d('0x56')]=function(_0x149b3d,_0x14ad23){var _0x1cfe26=_0x149b3d[_0x119d('0x46')];return db[_0x119d('0x2b')]['find']({'where':{'id':_0x149b3d[_0x119d('0x43')]['id']}})[_0x119d('0x26')](handleEntityNotFound(_0x14ad23,null))[_0x119d('0x26')](function(_0xa6498a){if(_0xa6498a){return db['sequelize']['transaction'](function(_0x3d1779){return db[_0x119d('0x54')][_0x119d('0x25')]({'where':{'userProfileId':_0x149b3d['params']['id'],'sectionId':_['map'](_0x1cfe26,function(_0x359b48){return _0x359b48[_0x119d('0x51')];})},'transaction':_0x3d1779})['then'](function(){var _0x315f9d=_[_0x119d('0x2a')](_0x1cfe26,function(_0x37bbbc){_0x37bbbc['userProfileId']=_0x149b3d['params']['id'];return _0x37bbbc;});var _0x283d29=[];return BPromise[_0x119d('0x4e')](_0x315f9d,function(_0x24fd66){return db['UserProfileSection'][_0x119d('0x45')](_0x24fd66,{'include':[{'model':db[_0x119d('0x50')],'as':_0x119d('0x53')}],'raw':!![],'transaction':_0x3d1779})['then'](function(_0x59cc5f){_0x283d29['push'](_0x59cc5f['get']({'plain':!![]}));});})['then'](function(){return _0x283d29;});});});}})[_0x119d('0x26')](function(_0x5832c9){return _0x5832c9;})[_0x119d('0x26')](respondWithResult(_0x14ad23,null))[_0x119d('0x41')](handleError(_0x14ad23,null));};exports['removeSections']=function(_0x209181,_0x549124){var _0x1f575f;return db[_0x119d('0x2b')]['find']({'where':{'id':_0x209181[_0x119d('0x43')]['id']},'attributes':['id','name']})[_0x119d('0x26')](handleEntityNotFound(_0x549124,null))['then'](function(_0x4a5a16){if(_0x4a5a16){_0x1f575f=_0x4a5a16;return db[_0x119d('0x54')][_0x119d('0x25')]({'where':{'userProfileId':_0x209181['params']['id'],'sectionId':_0x209181['query'][_0x119d('0x57')]}});}})[_0x119d('0x26')](function(){return _0x1f575f;})['then'](respondWithStatusCode(_0x549124,null))['catch'](handleError(_0x549124,null));};exports[_0x119d('0x58')]=function(_0x4def5f,_0x31e5b1){var _0x3fe917=[];var _0xb78443=[];return db[_0x119d('0x54')][_0x119d('0x4d')]({'where':{'userProfileId':_0x4def5f[_0x119d('0x43')]['id']},'raw':!![]})[_0x119d('0x26')](function(_0x48094a){_0x3fe917=_[_0x119d('0x3b')](_0x48094a,function(_0x99e7d2){return _0x99e7d2[_0x119d('0x59')]===0x1||_['includes']([0x3eb,0x709],_0x99e7d2[_0x119d('0x51')]);});if(!_[_0x119d('0x5a')](_0x3fe917)){return _[_0x119d('0x2a')](_0x3fe917,function(_0x4031e6){return _0x4031e6[_0x119d('0x51')];});}else{return;}})[_0x119d('0x26')](function(_0x8313f4){if(_0x8313f4)_0xb78443=_0x8313f4;if(_['includes'](_0xb78443,0x64)){var _0x3089a0=_[_0x119d('0x44')](_0x3fe917,{'sectionId':0x64});return hasDefaultDashboard(_0x3089a0)['then'](function(_0x8dab69){return _[_0x119d('0x2a')](_0x3fe917,function(_0x1f5ad4){if(_0x1f5ad4[_0x119d('0x51')]===0x64){_0x1f5ad4[_0x119d('0x5b')]=_0x8dab69;}return _0x1f5ad4;});});}else{return;}})['then'](function(_0x58df77){if(_0x58df77)_0x3fe917=_0x58df77;if(_[_0x119d('0x5c')](_0xb78443,0x3eb)){var _0x5ca44d=_[_0x119d('0x44')](_0x3fe917,{'sectionId':0x3eb});return getCustomDashboards(_0x5ca44d)[_0x119d('0x26')](function(_0x582780){return _[_0x119d('0x2a')](_0x3fe917,function(_0x445b03){if(_0x5ca44d[_0x119d('0x59')]){if(_0x445b03[_0x119d('0x51')]===0x3eb){_0x445b03[_0x119d('0x5b')]=_0x582780;}}else{if(_0x445b03[_0x119d('0x51')]===0x64){_0x445b03['subsections']=_0x582780;}}return _0x445b03;});});}else{return;}})[_0x119d('0x26')](function(_0x2e757b){if(_0x2e757b)_0x3fe917=_0x2e757b;if(_[_0x119d('0x5c')](_0xb78443,0x709)){var _0x5a8286=_[_0x119d('0x44')](_0x3fe917,{'sectionId':0x709});return getPlugins(_0x5a8286)['then'](function(_0x5a8fc4){if(_0x5a8286[_0x119d('0x59')]){return _['map'](_0x3fe917,function(_0x237319){if(_0x237319['sectionId']===0x709){_0x237319[_0x119d('0x5b')]=_0x5a8fc4;}return _0x237319;});}else{var _0x3e2990={'sectionId':0x76c,'enabled':0x1,'subsections':_0x5a8fc4};var _0x476298=_[_0x119d('0x2a')](_0x3fe917);_0x476298[_0x119d('0x5d')](_0x3e2990);return _0x476298;}});}else{return;}})['then'](function(_0x45626c){if(_0x45626c)_0x3fe917=_0x45626c;return _[_0x119d('0x3b')](_0x3fe917,[_0x119d('0x59'),0x1]);})[_0x119d('0x26')](respondWithResult(_0x31e5b1,null))['catch'](handleError(_0x31e5b1,null));};function hasDefaultDashboard(_0x434fa6){var _0x436428=[0x65];return new BPromise(function(_0x1703bb,_0x4307e5){try{if(_0x434fa6[_0x119d('0x4f')]){_0x1703bb(_0x436428);}else{return db[_0x119d('0x50')][_0x119d('0x5e')]({'where':{'sectionId':_0x434fa6['id']},'raw':!![]})[_0x119d('0x26')](function(_0x5f5734){_0x5f5734?_0x1703bb(_0x436428):_0x1703bb();});}}catch(_0x1ee4f6){_0x4307e5(_0x1ee4f6);}});}function getCustomDashboards(_0x3479a3){var _0x3ca29d=[];return new BPromise(function(_0x456998,_0x1df199){try{if(_0x3479a3['autoAssociation']){return db[_0x119d('0x5f')][_0x119d('0x4d')]({'raw':!![]})[_0x119d('0x26')](function(_0x5398af){_0x5398af[_0x119d('0x60')](function(_0x48f63a){_0x3ca29d[_0x119d('0x5d')](_0x48f63a['id']+0x1869f);});_0x456998(_0x3ca29d);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x3479a3['id']},'raw':!![]})['then'](function(_0xca49fb){_0xca49fb['forEach'](function(_0x3b4277){_0x3ca29d[_0x119d('0x5d')](_0x3b4277[_0x119d('0x61')]+0x1869f);});_0x456998(_0x3ca29d);});}}catch(_0x33c25f){_0x1df199(_0x33c25f);}});}function getPlugins(_0x497824){var _0x3c5bd3=[];return new BPromise(function(_0x35de1a,_0x24ec96){try{if(_0x497824[_0x119d('0x4f')]){return db['Plugin'][_0x119d('0x4d')]({'raw':!![]})[_0x119d('0x26')](function(_0x7d74e6){_0x7d74e6[_0x119d('0x60')](function(_0x2c15e7){_0x3c5bd3[_0x119d('0x5d')](_0x2c15e7['id']+0x15b38);});_0x35de1a(_0x3c5bd3);});}else{return db['UserProfileResource'][_0x119d('0x4d')]({'where':{'sectionId':_0x497824['id']},'raw':!![]})['then'](function(_0x8d260b){_0x8d260b['forEach'](function(_0x270a9d){_0x3c5bd3['push'](_0x270a9d[_0x119d('0x61')]+0x15b38);});_0x35de1a(_0x3c5bd3);});}}catch(_0xa1277c){_0x24ec96(_0xa1277c);}});}exports['addResources']=function(_0x29d5dc,_0x5ecad8){return db[_0x119d('0x2b')][_0x119d('0x44')]({'where':{'id':_0x29d5dc['params']['id']}})[_0x119d('0x26')](handleEntityNotFound(_0x5ecad8,null))['then'](function(_0x18fe3e){if(_0x18fe3e){return db[_0x119d('0x62')]['transaction'](function(_0x4a79aa){return db[_0x119d('0x54')]['findAll']({'where':{'userProfileId':_0x29d5dc[_0x119d('0x43')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x2bcb9e){if(_0x2bcb9e){return db[_0x119d('0x54')]['destroy']({'where':{'userProfileId':_0x29d5dc[_0x119d('0x43')]['id'],'id':_[_0x119d('0x2a')](_0x2bcb9e,function(_0x1dd0fc){return _0x1dd0fc['id'];})},'transaction':_0x4a79aa});}})[_0x119d('0x26')](function(_0x4e7502){var _0x5cc785=_[_0x119d('0x2a')](_0x29d5dc[_0x119d('0x46')],function(_0x395f3f){_0x395f3f[_0x119d('0x52')]=_0x29d5dc[_0x119d('0x43')]['id'];return _0x395f3f;});return db[_0x119d('0x54')][_0x119d('0x63')](_0x5cc785,{'raw':!![],'transaction':_0x4a79aa});})['then'](function(_0x2efaa3){var _0x503700=_[_0x119d('0x3b')](_[_0x119d('0x2a')](_0x2efaa3,function(_0x317be6){return _0x317be6[_0x119d('0x48')]({'plain':!![]});}),{'includeAll':![]});if(_0x503700){return db[_0x119d('0x54')][_0x119d('0x4d')]({'where':{'userProfileId':_0x29d5dc[_0x119d('0x43')]['id'],'sectionId':_[_0x119d('0x2a')](_0x503700,function(_0x40abc3){return _0x40abc3[_0x119d('0x51')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x119d('0x26')](function(_0xc247a4){var _0x2bea10=_[_0x119d('0x2a')](_0x29d5dc['body'],function(_0x395687){_0x395687[_0x119d('0x52')]=_0x29d5dc[_0x119d('0x43')]['id'];return _0x395687;});return db[_0x119d('0x50')][_0x119d('0x63')](_0x2bea10,{'raw':!![],'transaction':_0x4a79aa});});}})[_0x119d('0x41')](handleError(_0x5ecad8,null));});}})[_0x119d('0x26')](function(_0x2639ee){var _0xcc784b=_['map'](_0x2639ee,function(_0x3876b2){return _0x3876b2[_0x119d('0x48')]({'plain':!![]});});})[_0x119d('0x26')](respondWithResult(_0x5ecad8,null))[_0x119d('0x41')](handleError(_0x5ecad8,null));};exports[_0x119d('0x64')]=function(_0x1480fc,_0x147b71,_0x4cf5ae){return db['UserProfile'][_0x119d('0x44')]({'where':{'id':_0x1480fc[_0x119d('0x43')]['id']}})[_0x119d('0x26')](handleEntityNotFound(_0x147b71,null))['then'](function(_0x12a222){if(_0x12a222){return _0x12a222['removeResources'](_0x1480fc[_0x119d('0x30')][_0x119d('0x57')]);}})[_0x119d('0x26')](respondWithStatusCode(_0x147b71,null))[_0x119d('0x41')](handleError(_0x147b71,null));};exports[_0x119d('0x65')]=function(_0x11d35c,_0x35b14c){var _0x1302cb={'raw':![],'where':{}};var _0x372aed={};var _0x32c591={'count':0x0,'rows':[]};var _0x4ad9f8=_0x11d35c[_0x119d('0x30')][_0x119d('0x66')];if(typeof _0x4ad9f8===_0x119d('0x67')){throw new db[(_0x119d('0x68'))]['ValidationError'](_0x119d('0x69'));}var _0x2d9fcd=_0x11d35c[_0x119d('0x30')][_0x119d('0x6a')]||![];var _0x3265df=getQueryModels(_0x4ad9f8,_0x2d9fcd);if(typeof _0x3265df[_0x119d('0x6b')]==='undefined'){throw new db['Sequelize']['ValidationError']('Invalid\x20section\x20\x27'+_0x4ad9f8+'\x27');}var _0x32b430=[];if(!_[_0x119d('0x5a')](_0x3265df['parentSections'])){_0x32b430=_0x3265df['parentSections'];}else{_0x32b430=[{'name':_0x4ad9f8}];}return db[_0x119d('0x2b')][_0x119d('0x5e')]({'where':{'id':_0x11d35c[_0x119d('0x43')]['id']}})[_0x119d('0x26')](handleEntityNotFound(_0x35b14c,null))[_0x119d('0x26')](function(_0x1fbb01){if(_0x1fbb01){var _0x175102=[];for(var _0x38019e=0x0;_0x38019e<_0x32b430['length'];_0x38019e++){_0x175102[_0x119d('0x5d')](db[_0x119d('0x54')][_0x119d('0x5e')]({'where':{'userProfileId':_0x1fbb01['id'],'name':_0x32b430[_0x38019e]['name']},'raw':!![]}));}return BPromise[_0x119d('0x6c')](_0x175102);}})[_0x119d('0x26')](function(_0x5c2e01){var _0x205d93=_[_0x119d('0x3b')](_0x5c2e01,function(_0x1aed48){return _0x1aed48?_0x1aed48:undefined;});var _0x750e5e=_['filter'](_0x32b430,[_0x119d('0x6d'),!![]]);var _0x2222a1=_[_0x119d('0x5a')](_0x205d93)&&_['isEmpty'](_0x750e5e)?null:_[_0x119d('0x6e')](_0x750e5e,_0x205d93);if(_0x2222a1){var _0x5287c6=[];for(var _0x1759bb=0x0;_0x1759bb<_0x2222a1['length'];_0x1759bb++){var _0x440c84=_[_0x119d('0x44')](_0x32b430,function(_0x1f2cc3){return _0x2222a1[_0x1759bb]?_0x1f2cc3[_0x119d('0x27')]===_0x2222a1[_0x1759bb][_0x119d('0x27')]:null;});if(_0x440c84){if(_0x2222a1[_0x1759bb][_0x119d('0x6d')]){_0x5287c6[_0x119d('0x5d')](getAllResources(_0x3265df['childModel'],_0x2222a1[_0x1759bb]));}else{if(!_0x2222a1[_0x1759bb][_0x119d('0x4f')]){_0x5287c6[_0x119d('0x5d')](getAllowedResources(_0x440c84,_0x2222a1[_0x1759bb],_0x3265df[_0x119d('0x6b')]));}else{if(_0x440c84[_0x119d('0x2f')]){_0x5287c6[_0x119d('0x5d')](getAllFilteredResources(_0x440c84,_0x2222a1[_0x1759bb]));}}}}}return BPromise[_0x119d('0x6c')](_0x5287c6);}else{return null;}})[_0x119d('0x26')](function(_0x4c20e5){var _0x1a7406=_0x4c20e5;var _0x4d721b=null;if(_0x1a7406){_0x4d721b=_0x1a7406[_0x119d('0x36')]===0x1?_0x1a7406[0x0]:null;}if(_0x4d721b||_0x1a7406){var _0xba72e9=db[_0x3265df[_0x119d('0x6b')]][_0x119d('0x2c')];_0x372aed[_0x119d('0x2f')]=_[_0x119d('0x31')](_0xba72e9);_0x372aed[_0x119d('0x30')]=_[_0x119d('0x31')](_0x11d35c[_0x119d('0x30')]);_0x372aed['filters']=_[_0x119d('0x33')](_0x372aed[_0x119d('0x2f')],_0x372aed[_0x119d('0x30')]);_0x1302cb[_0x119d('0x35')]=_[_0x119d('0x33')](_0x372aed[_0x119d('0x2f')],qs[_0x119d('0x34')](_0x11d35c['query']['fields']));_0x1302cb[_0x119d('0x35')]=_0x1302cb[_0x119d('0x35')]['length']?_0x1302cb[_0x119d('0x35')]:_0x372aed['model'];if(!_0x11d35c[_0x119d('0x30')][_0x119d('0x6f')]('nolimit')){_0x1302cb[_0x119d('0x21')]=qs[_0x119d('0x21')](_0x11d35c['query'][_0x119d('0x21')]);_0x1302cb[_0x119d('0x20')]=qs[_0x119d('0x20')](_0x11d35c['query'][_0x119d('0x20')]);}_0x1302cb[_0x119d('0x70')]=qs[_0x119d('0x38')](_0x11d35c[_0x119d('0x30')]['sort']);_0x1302cb['where']=qs[_0x119d('0x32')](_['pick'](_0x11d35c[_0x119d('0x30')],_0x372aed['filters']));if(_0x11d35c['query'][_0x119d('0x3b')]){_0x1302cb[_0x119d('0x39')]=_['merge'](_0x1302cb['where'],{'$or':_[_0x119d('0x2a')](_0xba72e9,function(_0x546346){if(_0x546346['type'][_0x119d('0x2e')]!==_0x119d('0x71')){var _0x1566d3={};_0x1566d3[_0x546346[_0x119d('0x72')]]={'$like':'%'+_0x11d35c['query'][_0x119d('0x3b')]+'%'};return _0x1566d3;}})});}var _0x180982=[];if(_0x4d721b){var _0x1ded00=_[_0x119d('0x44')](_0x32b430,['name',_0x4d721b[_0x119d('0x27')]]);if(_0x1ded00['field']){var _0x5b8142={};if(_0x3265df[_0x119d('0x6b')]===_0x119d('0x73')){_0x5b8142[_0x1ded00[_0x119d('0x74')]]=_['map'](_0x4d721b[_0x119d('0x75')],'id');}else{_0x5b8142[_0x1ded00[_0x119d('0x74')]]=_0x4d721b[_0x119d('0x75')];}_0x180982[_0x119d('0x5d')](_0x5b8142);}else{_0x1302cb[_0x119d('0x39')]['id']=_0x4d721b[_0x119d('0x75')];}}else{for(var _0xe9ab4c=0x0;_0xe9ab4c<_0x1a7406['length'];_0xe9ab4c++){var _0x1ded00=_[_0x119d('0x44')](_0x32b430,['name',_0x1a7406[_0xe9ab4c][_0x119d('0x27')]]);if(_0x1ded00[_0x119d('0x72')]){var _0x5b8142={};_0x5b8142[_0x1ded00['foreignKey']]=_0x1a7406[_0xe9ab4c][_0x119d('0x75')];_0x180982[_0x119d('0x5d')](_0x5b8142);}else{if(!_0x1302cb[_0x119d('0x39')]['id'])_0x1302cb['where']['id']=[];_0x1a7406[_0xe9ab4c]['associatedResources'][_0x119d('0x60')](function(_0x3ac986){_0x1302cb[_0x119d('0x39')]['id'][_0x119d('0x5d')](_0x3ac986);});}}}if(!_['isEmpty'](_0x180982)){_0x1302cb['where']=_[_0x119d('0x3c')](_0x1302cb['where'],{'$and':{'$or':_0x180982}});}_0x1302cb=_[_0x119d('0x3c')]({},_0x1302cb,_0x11d35c[_0x119d('0x3e')]);if(_0x4d721b&&!_0x4d721b[_0x119d('0x4f')]&&_0x3265df[_0x119d('0x6b')]===_0x119d('0x73')){if(_0x11d35c[_0x119d('0x30')]['includeAll']){_0x1302cb[_0x119d('0x40')]=[{'all':!![]}];}return db[_0x3265df[_0x119d('0x6b')]]['findAll'](_0x1302cb)[_0x119d('0x26')](function(_0x3dd762){var _0x4d227e=[];_0x3dd762['forEach'](function(_0x597434){var _0x3d2532;switch(_0x597434[_0x119d('0x76')]){case'default':_0x3d2532=_[_0x119d('0x44')](_0x4d721b[_0x119d('0x75')],function(_0x4e8a03){return _0x4e8a03['id']===_0x597434['reportId']&&_0x4e8a03[_0x119d('0x3d')]==='DefaultReports';});break;case'custom':_0x3d2532=_[_0x119d('0x44')](_0x4d721b[_0x119d('0x75')],function(_0xb4a4ac){return _0xb4a4ac['id']===_0x597434[_0x119d('0x77')]&&_0xb4a4ac[_0x119d('0x3d')]==='CustomReports';});break;}if(_0x3d2532)_0x4d227e[_0x119d('0x5d')](_0x597434);});_0x32c591['count']=_0x4d227e['length'];_0x32c591[_0x119d('0x78')]=_0x4d227e;return _0x32c591;});}else{return db[_0x3265df['childModel']][_0x119d('0x1f')]({'where':_0x1302cb[_0x119d('0x39')]})[_0x119d('0x26')](function(_0x9858f0){_0x32c591[_0x119d('0x1f')]=_0x9858f0;if(_0x11d35c['query']['includeAll']){if(_0x3265df['childModel']===_0x119d('0x79')){_0x1302cb['include']=[{'model':db[_0x119d('0x7a')],'as':_0x119d('0x7b'),'attributes':['id',_0x119d('0x27'),_0x119d('0x7c')],'required':_0x11d35c[_0x119d('0x30')]['tag']?!![]:![]},{'model':db[_0x119d('0x7a')],'as':_0x119d('0x7d'),'attributes':['id',_0x119d('0x27'),'color'],'through':_0x11d35c[_0x119d('0x30')]['tag']?{'attributes':[],'where':{'TagId':_0x11d35c[_0x119d('0x30')][_0x119d('0x7e')]||undefined}}:{},'required':_0x11d35c[_0x119d('0x30')][_0x119d('0x7e')]?!![]:![]}];}else{_0x1302cb[_0x119d('0x40')]=[{'all':!![]}];}}return db[_0x3265df[_0x119d('0x6b')]][_0x119d('0x4d')](_0x1302cb);})[_0x119d('0x26')](function(_0x48fee1){_0x32c591[_0x119d('0x78')]=_0x48fee1;return _0x32c591;});}}else{return _0x32c591;}})[_0x119d('0x26')](respondWithFilteredResult(_0x35b14c,_0x1302cb))[_0x119d('0x41')](handleError(_0x35b14c,null));};function getAllResources(_0x7a82d1,_0x566fed){return new BPromise(function(_0x122666,_0x776df2){if(_0x566fed){var _0x24f606=_0x566fed['filter']?{[_0x566fed[_0x119d('0x3b')][_0x119d('0x72')]]:_0x566fed[_0x119d('0x3b')]['value']}:undefined;return db[_0x7a82d1][_0x119d('0x4d')]({'where':_0x24f606,'raw':!![]})[_0x119d('0x26')](function(_0x2a4639){_0x566fed[_0x119d('0x75')]=_[_0x119d('0x2a')](_0x2a4639,'id');_0x122666(_0x566fed);})[_0x119d('0x41')](function(_0x19504a){_0x776df2(_0x19504a);});}else{_0x122666(null);}});}function getAllFilteredResources(_0x2ec58f,_0x36be04){return new BPromise(function(_0x152b2a,_0x5b2211){var _0x46b016=_0x2ec58f[_0x119d('0x3b')]?{[_0x2ec58f[_0x119d('0x3b')]['field']]:_0x2ec58f[_0x119d('0x3b')][_0x119d('0x7f')]}:undefined;return db[_0x2ec58f['model']][_0x119d('0x4d')]({'where':_0x46b016,'raw':!![]})[_0x119d('0x26')](function(_0x47ea11){_0x36be04[_0x119d('0x75')]=_[_0x119d('0x2a')](_0x47ea11,function(_0x4c7faa){return _0x4c7faa['name'];});_0x152b2a(_0x36be04);})[_0x119d('0x41')](function(_0x931e40){_0x5b2211(_0x931e40);});});}function getAllowedResources(_0x38f40d,_0x3879fd,_0x2d8491){return new BPromise(function(_0x364fdb,_0x58bde1){if(_0x3879fd){return db[_0x119d('0x50')][_0x119d('0x4d')]({'where':{'sectionId':_0x3879fd['id']},'raw':!![]})[_0x119d('0x26')](function(_0x5b5a6d){if(_0x38f40d[_0x119d('0x72')]&&_0x38f40d[_0x119d('0x72')]!=='id'){_0x3879fd['associatedResources']=_[_0x119d('0x2a')](_0x5b5a6d,function(_0x45a171){return _0x45a171[_0x38f40d[_0x119d('0x72')]];});}else{if(_0x2d8491===_0x119d('0x73')){_0x3879fd[_0x119d('0x75')]=_[_0x119d('0x2a')](_0x5b5a6d,function(_0x20b5aa){return{'id':_0x20b5aa[_0x119d('0x61')],'type':_0x20b5aa['type']};});}else{_0x3879fd[_0x119d('0x75')]=_[_0x119d('0x2a')](_0x5b5a6d,function(_0xa0e772){return _0xa0e772[_0x119d('0x61')];});}}_0x364fdb(_0x3879fd);})[_0x119d('0x41')](function(_0x36cee0){_0x58bde1(_0x36cee0);});}else{_0x364fdb(null);}});}function getQueryModels(_0x189747,_0x465220){var _0xa7e7d3=_0x189747['toLowerCase']();var _0x5bfd53={'childModel':undefined,'parentSections':[]};switch(_0xa7e7d3){case _0x119d('0x80'):_0x5bfd53['childModel']=_0x119d('0x81');break;case'odbc':_0x5bfd53[_0x119d('0x6b')]='SquareOdbc';break;case _0x119d('0x82'):_0x5bfd53['childModel']=_0x119d('0x83');_0x5bfd53[_0x119d('0x84')]=[{'name':_0x119d('0x85'),'field':_0x119d('0x27'),'foreignKey':_0x119d('0x86')}];break;case _0x119d('0x87'):_0x5bfd53['childModel']=_0x119d('0x88');break;case _0x119d('0x89'):_0x5bfd53[_0x119d('0x6b')]=_0x119d('0x79');_0x5bfd53['parentSections']=[{'name':_0x119d('0x8a'),'field':'id','foreignKey':'ListId'}];break;case _0x119d('0x8b'):_0x5bfd53['childModel']='CmList';break;case _0x119d('0x8c'):_0x5bfd53[_0x119d('0x6b')]=_0x119d('0x8d');break;case'globalcustomfields':_0x5bfd53[_0x119d('0x6b')]='CmCustomField';break;case _0x119d('0x8e'):_0x5bfd53[_0x119d('0x6b')]='ChatQueue';break;case _0x119d('0x8f'):_0x5bfd53[_0x119d('0x6b')]=_0x119d('0x90');break;case _0x119d('0x91'):_0x5bfd53[_0x119d('0x6b')]=_0x119d('0x92');break;case _0x119d('0x93'):_0x5bfd53[_0x119d('0x6b')]='FaxAccount';break;case'inboundroutes':case _0x119d('0x94'):case _0x119d('0x95'):_0x5bfd53[_0x119d('0x6b')]=_0x119d('0x96');break;case _0x119d('0x97'):_0x5bfd53[_0x119d('0x6b')]='VoiceContext';break;case _0x119d('0x98'):_0x5bfd53['childModel']=_0x119d('0x99');break;case _0x119d('0x9a'):_0x5bfd53[_0x119d('0x6b')]='VoiceRecording';_0x5bfd53[_0x119d('0x84')]=[{'name':'Agents','field':_0x119d('0x27'),'foreignKey':_0x119d('0x9b'),'model':_0x119d('0x9c'),'filter':{'field':_0x119d('0x9d'),'value':[_0x119d('0x9e')]}},{'name':_0x119d('0x9f'),'field':_0x119d('0x27'),'foreignKey':_0x119d('0x9b'),'model':_0x119d('0x9c'),'filter':{'field':_0x119d('0x9d'),'value':[_0x119d('0xa0')]}},{'name':_0x119d('0xa1'),'field':_0x119d('0x27'),'foreignKey':_0x119d('0xa2'),'model':_0x119d('0xa3'),'filter':{'field':_0x119d('0x3d'),'value':[_0x119d('0xa4')]}},{'name':_0x119d('0xa5'),'field':_0x119d('0x27'),'foreignKey':_0x119d('0xa2'),'model':'VoiceQueue','filter':{'field':_0x119d('0x3d'),'value':[_0x119d('0xa6')]}}];break;case _0x119d('0xa7'):_0x5bfd53['childModel']=_0x119d('0xa8');break;case _0x119d('0xa9'):_0x5bfd53['childModel']=_0x119d('0xaa');break;case _0x119d('0xab'):_0x5bfd53['childModel']=_0x119d('0xac');break;case _0x119d('0xad'):_0x5bfd53[_0x119d('0x6b')]=_0x119d('0xae');break;case _0x119d('0xaf'):_0x5bfd53['childModel']='MailQueue';break;case _0x119d('0xb0'):_0x5bfd53[_0x119d('0x6b')]=_0x119d('0xb1');break;case _0x119d('0xb2'):_0x5bfd53[_0x119d('0x6b')]=_0x119d('0xb3');break;case _0x119d('0xb4'):_0x5bfd53[_0x119d('0x6b')]=_0x119d('0xb5');break;case _0x119d('0xb6'):_0x5bfd53[_0x119d('0x6b')]=_0x119d('0xb7');break;case'smsqueues':_0x5bfd53[_0x119d('0x6b')]=_0x119d('0xb8');break;case _0x119d('0xb9'):_0x5bfd53[_0x119d('0x6b')]=_0x119d('0xba');break;case _0x119d('0xbb'):_0x5bfd53['childModel']='Team';break;case'voicequeues':case _0x119d('0xbc'):_0x5bfd53[_0x119d('0x6b')]='VoiceQueue';if(_0x465220){_0x5bfd53[_0x119d('0x84')]=[{'name':'VoiceQueues'},{'name':_0x119d('0xa5')}];}break;case _0x119d('0xbd'):case _0x119d('0xbe'):case _0x119d('0xbf'):_0x5bfd53[_0x119d('0x6b')]='User';if(_0x465220){_0x5bfd53[_0x119d('0x84')]=[{'name':_0x119d('0xc0'),'filter':{'field':_0x119d('0x9d'),'value':[_0x119d('0xc1'),_0x119d('0xc2')]},'ignore':!![]},{'name':_0x119d('0xc3')},{'name':_0x119d('0x9f')}];}break;case _0x119d('0xc4'):_0x5bfd53['childModel']=_0x119d('0xc5');break;case _0x119d('0xc6'):_0x5bfd53[_0x119d('0x6b')]=_0x119d('0xc7');break;case _0x119d('0xc8'):_0x5bfd53[_0x119d('0x6b')]='FreshdeskAccount';break;case _0x119d('0xc9'):_0x5bfd53[_0x119d('0x6b')]=_0x119d('0xca');break;case _0x119d('0xcb'):_0x5bfd53['childModel']=_0x119d('0xcc');break;case _0x119d('0xcd'):_0x5bfd53['childModel']=_0x119d('0xce');break;case _0x119d('0xcf'):_0x5bfd53[_0x119d('0x6b')]=_0x119d('0x9c');break;case _0x119d('0xd0'):_0x5bfd53[_0x119d('0x6b')]='CannedAnswer';break;case'dispositions':_0x5bfd53['childModel']=_0x119d('0xd1');break;case _0x119d('0xd2'):_0x5bfd53[_0x119d('0x6b')]='Dashboard';break;case _0x119d('0xd3'):_0x5bfd53[_0x119d('0x6b')]=_0x119d('0xd4');break;case _0x119d('0xd5'):_0x5bfd53[_0x119d('0x6b')]=_0x119d('0xd6');break;case _0x119d('0xd7'):_0x5bfd53[_0x119d('0x6b')]=_0x119d('0xd8');break;case'sounds':_0x5bfd53[_0x119d('0x6b')]='Sound';break;case _0x119d('0xd9'):_0x5bfd53[_0x119d('0x6b')]=_0x119d('0x7a');break;case _0x119d('0xda'):_0x5bfd53['childModel']='Template';break;case _0x119d('0xdb'):_0x5bfd53[_0x119d('0x6b')]='Trigger';break;case'trunks':_0x5bfd53[_0x119d('0x6b')]='Trunk';break;case'variables':_0x5bfd53[_0x119d('0x6b')]=_0x119d('0xdc');break;case _0x119d('0xdd'):_0x5bfd53[_0x119d('0x6b')]=_0x119d('0xde');break;case _0x119d('0xdf'):_0x5bfd53[_0x119d('0x6b')]=_0x119d('0x73');_0x5bfd53[_0x119d('0x84')]=[{'name':_0x119d('0xe0'),'field':'id','foreignKey':_0x119d('0x77')}];break;case'metrics':_0x5bfd53[_0x119d('0x6b')]=_0x119d('0xe1');break;default:return _0x5bfd53;}return _0x5bfd53;} \ No newline at end of file +var _0xae07=['QueueCampaigns','users','telephones','Users','admin','user','zendeskaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','templates','Template','triggers','trunks','Trunk','variables','plugins','extractedreports','Reports','metrics','AnalyticMetric','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','UserProfile','fieldName','type','key','query','keys','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','rawAttributes','intersection','find','catch','body','clone','get','createdAt','updatedAt','crudPermissions','sequelize','transaction','includeAll','UserProfileSection','each','autoAssociation','UserProfileResource','omit','sectionId','userProfileId','create','Resources','describe','removeSections','ids','includes','isEmpty','subsections','enabled','findOne','Dashboard','forEach','push','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','undefined','Sequelize','ValidationError','Unknown\x20section','mergeResources','Invalid\x20section\x20\x27','parentSections','all','ignore','union','childModel','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','reportId','Tag','Tags','color','ThroughTags','tag','value','toLowerCase','squareprojects','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','projectName','projects','JscriptyProject','contacts','ListId','lists','CmList','companies','globalcustomfields','CmCustomField','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','contexts','VoiceContext','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','role','agent','Telephones','User','telephone','VoiceQueues','queue','VoiceQueue','inbound','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','mailqueues','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','SmsQueue','SmsAccount','voicequeues','queuecampaigns'];(function(_0x494848,_0x5a2d8f){var _0x1a3fe6=function(_0x3365e1){while(--_0x3365e1){_0x494848['push'](_0x494848['shift']());}};_0x1a3fe6(++_0x5a2d8f);}(_0xae07,0x11b));var _0x7ae0=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xae07[_0x13ea00];return _0x1f7347;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7ae0('0x0'));var rimraf=require(_0x7ae0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7ae0('0x2'));var rp=require(_0x7ae0('0x3'));var moment=require(_0x7ae0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7ae0('0x5'));var util=require(_0x7ae0('0x6'));var path=require(_0x7ae0('0x7'));var sox=require(_0x7ae0('0x8'));var csv=require(_0x7ae0('0x9'));var ejs=require(_0x7ae0('0xa'));var fs=require('fs');var _=require(_0x7ae0('0xb'));var squel=require('squel');var crypto=require(_0x7ae0('0xc'));var jsforce=require(_0x7ae0('0xd'));var deskjs=require(_0x7ae0('0xe'));var toCsv=require(_0x7ae0('0x9'));var querystring=require(_0x7ae0('0xf'));var Papa=require('papaparse');var Redis=require(_0x7ae0('0x10'));var authService=require(_0x7ae0('0x11'));var qs=require(_0x7ae0('0x12'));var as=require(_0x7ae0('0x13'));var hardwareService=require(_0x7ae0('0x14'));var logger=require(_0x7ae0('0x15'))('api');var utils=require(_0x7ae0('0x16'));var config=require('../../config/environment');var db=require(_0x7ae0('0x17'))['db'];config[_0x7ae0('0x18')]=_[_0x7ae0('0x19')](config['redis'],{'host':_0x7ae0('0x1a'),'port':0x18eb});var socket=require(_0x7ae0('0x1b'))(new Redis(config[_0x7ae0('0x18')]));require(_0x7ae0('0x1c'))[_0x7ae0('0x1d')](socket);function respondWithStatusCode(_0x399968,_0x3f7509){_0x3f7509=_0x3f7509||0xcc;return function(_0x543ab7){if(_0x543ab7){return _0x399968[_0x7ae0('0x1e')](_0x3f7509);}return _0x399968[_0x7ae0('0x1f')](_0x3f7509)[_0x7ae0('0x20')]();};}function respondWithResult(_0x42a85e,_0xd62cc4){_0xd62cc4=_0xd62cc4||0xc8;return function(_0x1cdfbd){if(_0x1cdfbd){return _0x42a85e[_0x7ae0('0x1f')](_0xd62cc4)[_0x7ae0('0x21')](_0x1cdfbd);}};}function respondWithFilteredResult(_0x4fc4a7,_0x5b029c){return function(_0x49f1e9){if(_0x49f1e9){var _0x59f3af=_0x49f1e9[_0x7ae0('0x22')],_0x44b9cc=_0x5b029c[_0x7ae0('0x23')],_0x1ad4ba=_0x5b029c[_0x7ae0('0x23')]+_0x5b029c[_0x7ae0('0x24')],_0x47dc77;if(_0x1ad4ba>=_0x59f3af){_0x1ad4ba=_0x59f3af;_0x47dc77=0xc8;}else{_0x47dc77=0xce;}_0x4fc4a7[_0x7ae0('0x1f')](_0x47dc77);return _0x4fc4a7[_0x7ae0('0x25')](_0x7ae0('0x26'),_0x44b9cc+'-'+_0x1ad4ba+'/'+_0x59f3af)[_0x7ae0('0x21')](_0x49f1e9);}return null;};}function patchUpdates(_0x6e87ef){return function(_0x1bf49b){try{jsonpatch[_0x7ae0('0x27')](_0x1bf49b,_0x6e87ef,!![]);}catch(_0x566ca2){return BPromise[_0x7ae0('0x28')](_0x566ca2);}return _0x1bf49b[_0x7ae0('0x29')]();};}function saveUpdates(_0x54d306,_0x4b13b9){return function(_0x931cbc){if(_0x931cbc){return _0x931cbc[_0x7ae0('0x2a')](_0x54d306)[_0x7ae0('0x2b')](function(_0x240337){return _0x240337;});}return null;};}function removeEntity(_0x255ace,_0x2a39a2){return function(_0x320ddd){if(_0x320ddd){return _0x320ddd[_0x7ae0('0x2c')]()[_0x7ae0('0x2b')](function(){_0x255ace[_0x7ae0('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5797ac,_0x6e43bf){return function(_0x599e95){if(!_0x599e95){_0x5797ac[_0x7ae0('0x1e')](0x194);}return _0x599e95;};}function handleError(_0x934eac,_0x4de1e5){_0x4de1e5=_0x4de1e5||0x1f4;return function(_0x2a433f){logger[_0x7ae0('0x2d')](_0x2a433f['stack']);if(_0x2a433f[_0x7ae0('0x2e')]){delete _0x2a433f[_0x7ae0('0x2e')];}_0x934eac['status'](_0x4de1e5)[_0x7ae0('0x2f')](_0x2a433f);};}exports[_0x7ae0('0x30')]=function(_0x44f87a,_0x180c36){var _0xae1c6d={},_0x74a977={},_0x4ead9d={'count':0x0,'rows':[]};var _0x379870=_[_0x7ae0('0x31')](db[_0x7ae0('0x32')]['rawAttributes'],function(_0x723e1d){return{'name':_0x723e1d[_0x7ae0('0x33')],'type':_0x723e1d[_0x7ae0('0x34')][_0x7ae0('0x35')]};});_0x74a977['model']=_[_0x7ae0('0x31')](_0x379870,_0x7ae0('0x2e'));_0x74a977[_0x7ae0('0x36')]=_[_0x7ae0('0x37')](_0x44f87a[_0x7ae0('0x36')]);_0x74a977['filters']=_['intersection'](_0x74a977[_0x7ae0('0x38')],_0x74a977['query']);_0xae1c6d[_0x7ae0('0x39')]=_['intersection'](_0x74a977[_0x7ae0('0x38')],qs[_0x7ae0('0x3a')](_0x44f87a['query'][_0x7ae0('0x3a')]));_0xae1c6d[_0x7ae0('0x39')]=_0xae1c6d['attributes'][_0x7ae0('0x3b')]?_0xae1c6d['attributes']:_0x74a977[_0x7ae0('0x38')];if(!_0x44f87a[_0x7ae0('0x36')][_0x7ae0('0x3c')](_0x7ae0('0x3d'))){_0xae1c6d['limit']=qs[_0x7ae0('0x24')](_0x44f87a['query']['limit']);_0xae1c6d['offset']=qs[_0x7ae0('0x23')](_0x44f87a[_0x7ae0('0x36')][_0x7ae0('0x23')]);}_0xae1c6d[_0x7ae0('0x3e')]=qs[_0x7ae0('0x3f')](_0x44f87a['query']['sort']);_0xae1c6d[_0x7ae0('0x40')]=qs[_0x7ae0('0x41')](_[_0x7ae0('0x42')](_0x44f87a[_0x7ae0('0x36')],_0x74a977[_0x7ae0('0x41')]));if(_0x44f87a[_0x7ae0('0x36')][_0x7ae0('0x43')]){_0xae1c6d[_0x7ae0('0x40')]=_[_0x7ae0('0x44')](_0xae1c6d[_0x7ae0('0x40')],{'$or':_[_0x7ae0('0x31')](_0x379870,function(_0x2081a2){if(_0x2081a2[_0x7ae0('0x34')]!==_0x7ae0('0x45')){var _0x4f43b0={};_0x4f43b0[_0x2081a2[_0x7ae0('0x2e')]]={'$like':'%'+_0x44f87a['query']['filter']+'%'};return _0x4f43b0;}})});}_0xae1c6d=_['merge']({},_0xae1c6d,_0x44f87a[_0x7ae0('0x46')]);var _0x458467={'where':_0xae1c6d['where']};return db[_0x7ae0('0x32')][_0x7ae0('0x22')](_0x458467)[_0x7ae0('0x2b')](function(_0x2e51bd){_0x4ead9d[_0x7ae0('0x22')]=_0x2e51bd;if(_0x44f87a['query']['includeAll']){_0xae1c6d[_0x7ae0('0x47')]=[{'all':!![]}];}return db['UserProfile'][_0x7ae0('0x48')](_0xae1c6d);})[_0x7ae0('0x2b')](function(_0x24399f){_0x4ead9d[_0x7ae0('0x49')]=_0x24399f;return _0x4ead9d;})[_0x7ae0('0x2b')](respondWithFilteredResult(_0x180c36,_0xae1c6d))['catch'](handleError(_0x180c36,null));};exports['show']=function(_0x5bda28,_0x489499){var _0x3d67be={'raw':![],'where':{'id':_0x5bda28[_0x7ae0('0x4a')]['id']}},_0x35e29d={};_0x35e29d[_0x7ae0('0x38')]=_[_0x7ae0('0x37')](db[_0x7ae0('0x32')][_0x7ae0('0x4b')]);_0x35e29d[_0x7ae0('0x36')]=_[_0x7ae0('0x37')](_0x5bda28['query']);_0x35e29d['filters']=_[_0x7ae0('0x4c')](_0x35e29d[_0x7ae0('0x38')],_0x35e29d['query']);_0x3d67be[_0x7ae0('0x39')]=_[_0x7ae0('0x4c')](_0x35e29d['model'],qs[_0x7ae0('0x3a')](_0x5bda28[_0x7ae0('0x36')]['fields']));_0x3d67be[_0x7ae0('0x39')]=_0x3d67be[_0x7ae0('0x39')][_0x7ae0('0x3b')]?_0x3d67be[_0x7ae0('0x39')]:_0x35e29d['model'];if(_0x5bda28['query']['includeAll']){_0x3d67be[_0x7ae0('0x47')]=[{'all':!![]}];}_0x3d67be=_[_0x7ae0('0x44')]({},_0x3d67be,_0x5bda28[_0x7ae0('0x46')]);return db[_0x7ae0('0x32')][_0x7ae0('0x4d')](_0x3d67be)[_0x7ae0('0x2b')](handleEntityNotFound(_0x489499,null))[_0x7ae0('0x2b')](respondWithResult(_0x489499,null))[_0x7ae0('0x4e')](handleError(_0x489499,null));};exports['create']=function(_0x575208,_0x4e00cc){return db[_0x7ae0('0x32')]['create'](_0x575208[_0x7ae0('0x4f')],{})[_0x7ae0('0x2b')](respondWithResult(_0x4e00cc,0xc9))[_0x7ae0('0x4e')](handleError(_0x4e00cc,null));};exports[_0x7ae0('0x50')]=function(_0x4c92af,_0x7dc8cf){var _0x242deb={'where':{'id':_0x4c92af[_0x7ae0('0x4a')]['id']}},_0x3adf95={};_0x3adf95[_0x7ae0('0x38')]=_[_0x7ae0('0x37')](db[_0x7ae0('0x32')][_0x7ae0('0x4b')]);_0x242deb[_0x7ae0('0x39')]=_[_0x7ae0('0x4c')](_0x3adf95[_0x7ae0('0x38')],qs['fields'](_0x4c92af['query'][_0x7ae0('0x3a')]));_0x242deb[_0x7ae0('0x39')]=_0x242deb[_0x7ae0('0x39')][_0x7ae0('0x3b')]?_0x242deb[_0x7ae0('0x39')]:_0x3adf95[_0x7ae0('0x38')];if(_0x4c92af[_0x7ae0('0x36')]['includeAll']){_0x242deb[_0x7ae0('0x47')]=[{'all':!![]}];}_0x242deb=_[_0x7ae0('0x44')]({},_0x242deb,_0x4c92af['options']);return db[_0x7ae0('0x32')][_0x7ae0('0x4d')](_0x242deb)[_0x7ae0('0x2b')](handleEntityNotFound(_0x7dc8cf,null))['then'](function(_0x35c1){if(_0x35c1){var _0x5f5d4b=_0x35c1[_0x7ae0('0x51')]({'plain':!![]});_0x5f5d4b=qs['omit'](_0x5f5d4b,['id',_0x7ae0('0x52'),_0x7ae0('0x53'),_0x7ae0('0x54')]);_0x4c92af[_0x7ae0('0x4f')]=_['omit'](_0x4c92af[_0x7ae0('0x4f')],['id','createdAt','updatedAt']);return db[_0x7ae0('0x55')][_0x7ae0('0x56')](function(_0x4fc655){return db[_0x7ae0('0x32')]['create'](_[_0x7ae0('0x44')](_0x5f5d4b,_0x4c92af[_0x7ae0('0x4f')]),{'include':_0x4c92af[_0x7ae0('0x36')][_0x7ae0('0x57')]?[{'all':!![]}]:undefined,'transaction':_0x4fc655})[_0x7ae0('0x2b')](function(_0x14d2a2){var _0xf67049=_0x14d2a2[_0x7ae0('0x51')]({'plain':!![]});return db[_0x7ae0('0x58')][_0x7ae0('0x48')]({'where':{'userProfileId':_0x4c92af[_0x7ae0('0x4a')]['id']},'raw':!![]})[_0x7ae0('0x2b')](function(_0x472e32){if(_0x472e32){return BPromise[_0x7ae0('0x59')](_0x472e32,function(_0x101094){return new BPromise(function(_0x44d2a2,_0x17d600){if(_0x101094[_0x7ae0('0x5a')]===null||_0x101094[_0x7ae0('0x5a')]===0x1)_0x44d2a2(null);return db[_0x7ae0('0x5b')][_0x7ae0('0x48')]({'where':{'sectionId':_0x101094['id']},'raw':!![]})[_0x7ae0('0x2b')](function(_0x33bc8f){var _0x4db79d=_[_0x7ae0('0x31')](_0x33bc8f,function(_0xbb0480){return qs[_0x7ae0('0x5c')](_0xbb0480,['id',_0x7ae0('0x52'),'updatedAt',_0x7ae0('0x5d')]);});_0x44d2a2(_0x4db79d);})[_0x7ae0('0x4e')](function(_0x38c409){_0x17d600(_0x38c409);});})['then'](function(_0x46cb47){var _0x495e95=qs['omit'](_0x101094,['id',_0x7ae0('0x52'),'updatedAt']);_0x495e95[_0x7ae0('0x5e')]=_0xf67049['id'];if(_0x46cb47)_0x495e95['Resources']=_0x46cb47;return _0x495e95;})[_0x7ae0('0x2b')](function(_0x21b86d){return db[_0x7ae0('0x58')][_0x7ae0('0x5f')](_0x21b86d,{'include':[{'model':db['UserProfileResource'],'as':_0x7ae0('0x60')}],'raw':!![],'transaction':_0x4fc655});});})[_0x7ae0('0x2b')](function(){return _0xf67049;});}});});});}})[_0x7ae0('0x2b')](respondWithResult(_0x7dc8cf,0xc9))[_0x7ae0('0x4e')](handleError(_0x7dc8cf,null));};exports['update']=function(_0x5495a6,_0xfcc4f2){if(_0x5495a6[_0x7ae0('0x4f')]['id']){delete _0x5495a6[_0x7ae0('0x4f')]['id'];}return db[_0x7ae0('0x32')][_0x7ae0('0x4d')]({'where':{'id':_0x5495a6[_0x7ae0('0x4a')]['id']}})[_0x7ae0('0x2b')](handleEntityNotFound(_0xfcc4f2,null))[_0x7ae0('0x2b')](saveUpdates(_0x5495a6[_0x7ae0('0x4f')],null))[_0x7ae0('0x2b')](respondWithResult(_0xfcc4f2,null))['catch'](handleError(_0xfcc4f2,null));};exports[_0x7ae0('0x2c')]=function(_0x11db0c,_0x1144e6){return db[_0x7ae0('0x32')]['find']({'where':{'id':_0x11db0c[_0x7ae0('0x4a')]['id']}})[_0x7ae0('0x2b')](handleEntityNotFound(_0x1144e6,null))[_0x7ae0('0x2b')](removeEntity(_0x1144e6,null))[_0x7ae0('0x4e')](handleError(_0x1144e6,null));};exports[_0x7ae0('0x61')]=function(_0x51eff4,_0x41f8dd){return db[_0x7ae0('0x32')][_0x7ae0('0x61')]()[_0x7ae0('0x2b')](respondWithResult(_0x41f8dd,null))[_0x7ae0('0x4e')](handleError(_0x41f8dd,null));};exports['addSections']=function(_0x5274d0,_0x5aa0d8){var _0xbd7dd0=_0x5274d0['body'];return db[_0x7ae0('0x32')][_0x7ae0('0x4d')]({'where':{'id':_0x5274d0[_0x7ae0('0x4a')]['id']}})[_0x7ae0('0x2b')](handleEntityNotFound(_0x5aa0d8,null))['then'](function(_0x2be4bf){if(_0x2be4bf){return db[_0x7ae0('0x55')][_0x7ae0('0x56')](function(_0x45202f){return db[_0x7ae0('0x58')][_0x7ae0('0x2c')]({'where':{'userProfileId':_0x5274d0['params']['id'],'sectionId':_[_0x7ae0('0x31')](_0xbd7dd0,function(_0x2dd48b){return _0x2dd48b['sectionId'];})},'transaction':_0x45202f})['then'](function(){var _0x4d2332=_['map'](_0xbd7dd0,function(_0x59bc61){_0x59bc61[_0x7ae0('0x5e')]=_0x5274d0[_0x7ae0('0x4a')]['id'];return _0x59bc61;});var _0x1f54da=[];return BPromise[_0x7ae0('0x59')](_0x4d2332,function(_0x49ea7e){return db['UserProfileSection']['create'](_0x49ea7e,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x45202f})['then'](function(_0x175241){_0x1f54da['push'](_0x175241[_0x7ae0('0x51')]({'plain':!![]}));});})[_0x7ae0('0x2b')](function(){return _0x1f54da;});});});}})[_0x7ae0('0x2b')](function(_0x54263d){return _0x54263d;})['then'](respondWithResult(_0x5aa0d8,null))['catch'](handleError(_0x5aa0d8,null));};exports[_0x7ae0('0x62')]=function(_0x15abdf,_0x190c6c){var _0x3f71ea;return db[_0x7ae0('0x32')][_0x7ae0('0x4d')]({'where':{'id':_0x15abdf['params']['id']},'attributes':['id',_0x7ae0('0x2e')]})[_0x7ae0('0x2b')](handleEntityNotFound(_0x190c6c,null))[_0x7ae0('0x2b')](function(_0x53582f){if(_0x53582f){_0x3f71ea=_0x53582f;return db['UserProfileSection'][_0x7ae0('0x2c')]({'where':{'userProfileId':_0x15abdf[_0x7ae0('0x4a')]['id'],'sectionId':_0x15abdf[_0x7ae0('0x36')][_0x7ae0('0x63')]}});}})[_0x7ae0('0x2b')](function(){return _0x3f71ea;})[_0x7ae0('0x2b')](respondWithStatusCode(_0x190c6c,null))[_0x7ae0('0x4e')](handleError(_0x190c6c,null));};exports['getSections']=function(_0x259c6a,_0x55108f){var _0x247703=[];var _0x364f92=[];return db[_0x7ae0('0x58')][_0x7ae0('0x48')]({'where':{'userProfileId':_0x259c6a[_0x7ae0('0x4a')]['id']},'raw':!![]})['then'](function(_0x9ab2f2){_0x247703=_[_0x7ae0('0x43')](_0x9ab2f2,function(_0x160418){return _0x160418['enabled']===0x1||_[_0x7ae0('0x64')]([0x3eb,0x709],_0x160418[_0x7ae0('0x5d')]);});if(!_[_0x7ae0('0x65')](_0x247703)){return _[_0x7ae0('0x31')](_0x247703,function(_0x4634cf){return _0x4634cf['sectionId'];});}else{return;}})['then'](function(_0x4b891b){if(_0x4b891b)_0x364f92=_0x4b891b;if(_['includes'](_0x364f92,0x64)){var _0x3a2621=_[_0x7ae0('0x4d')](_0x247703,{'sectionId':0x64});return hasDefaultDashboard(_0x3a2621)[_0x7ae0('0x2b')](function(_0x32d8d2){return _[_0x7ae0('0x31')](_0x247703,function(_0x58dd44){if(_0x58dd44[_0x7ae0('0x5d')]===0x64){_0x58dd44[_0x7ae0('0x66')]=_0x32d8d2;}return _0x58dd44;});});}else{return;}})[_0x7ae0('0x2b')](function(_0x321640){if(_0x321640)_0x247703=_0x321640;if(_[_0x7ae0('0x64')](_0x364f92,0x3eb)){var _0x5b99ec=_['find'](_0x247703,{'sectionId':0x3eb});return getCustomDashboards(_0x5b99ec)[_0x7ae0('0x2b')](function(_0x7c0159){return _[_0x7ae0('0x31')](_0x247703,function(_0xd11cfa){if(_0x5b99ec['enabled']){if(_0xd11cfa[_0x7ae0('0x5d')]===0x3eb){_0xd11cfa[_0x7ae0('0x66')]=_0x7c0159;}}else{if(_0xd11cfa[_0x7ae0('0x5d')]===0x64){_0xd11cfa[_0x7ae0('0x66')]=_0x7c0159;}}return _0xd11cfa;});});}else{return;}})[_0x7ae0('0x2b')](function(_0x338bcd){if(_0x338bcd)_0x247703=_0x338bcd;if(_[_0x7ae0('0x64')](_0x364f92,0x709)){var _0x437153=_['find'](_0x247703,{'sectionId':0x709});return getPlugins(_0x437153)[_0x7ae0('0x2b')](function(_0x254170){if(_0x437153['enabled']){return _[_0x7ae0('0x31')](_0x247703,function(_0x3fea38){if(_0x3fea38[_0x7ae0('0x5d')]===0x709){_0x3fea38['subsections']=_0x254170;}return _0x3fea38;});}else{var _0x597a58={'sectionId':0x76c,'enabled':0x1,'subsections':_0x254170};var _0x5418da=_['map'](_0x247703);_0x5418da['push'](_0x597a58);return _0x5418da;}});}else{return;}})[_0x7ae0('0x2b')](function(_0x552962){if(_0x552962)_0x247703=_0x552962;return _[_0x7ae0('0x43')](_0x247703,[_0x7ae0('0x67'),0x1]);})[_0x7ae0('0x2b')](respondWithResult(_0x55108f,null))[_0x7ae0('0x4e')](handleError(_0x55108f,null));};function hasDefaultDashboard(_0x61c398){var _0x3293a7=[0x65];return new BPromise(function(_0x1866e7,_0x28f77d){try{if(_0x61c398[_0x7ae0('0x5a')]){_0x1866e7(_0x3293a7);}else{return db[_0x7ae0('0x5b')][_0x7ae0('0x68')]({'where':{'sectionId':_0x61c398['id']},'raw':!![]})['then'](function(_0x5d4cca){_0x5d4cca?_0x1866e7(_0x3293a7):_0x1866e7();});}}catch(_0x3cef3e){_0x28f77d(_0x3cef3e);}});}function getCustomDashboards(_0x52dcf5){var _0x4a6f41=[];return new BPromise(function(_0x2b0039,_0x40a9fb){try{if(_0x52dcf5['autoAssociation']){return db[_0x7ae0('0x69')][_0x7ae0('0x48')]({'raw':!![]})['then'](function(_0x2c5b0f){_0x2c5b0f[_0x7ae0('0x6a')](function(_0x24c6eb){_0x4a6f41[_0x7ae0('0x6b')](_0x24c6eb['id']+0x1869f);});_0x2b0039(_0x4a6f41);});}else{return db[_0x7ae0('0x5b')][_0x7ae0('0x48')]({'where':{'sectionId':_0x52dcf5['id']},'raw':!![]})[_0x7ae0('0x2b')](function(_0x1312c0){_0x1312c0[_0x7ae0('0x6a')](function(_0xe88a5){_0x4a6f41['push'](_0xe88a5[_0x7ae0('0x6c')]+0x1869f);});_0x2b0039(_0x4a6f41);});}}catch(_0x5cb43f){_0x40a9fb(_0x5cb43f);}});}function getPlugins(_0x17e9e6){var _0x267cd1=[];return new BPromise(function(_0x1b0fda,_0x3dede4){try{if(_0x17e9e6[_0x7ae0('0x5a')]){return db[_0x7ae0('0x6d')][_0x7ae0('0x48')]({'raw':!![]})['then'](function(_0x28790f){_0x28790f['forEach'](function(_0x43dea6){_0x267cd1['push'](_0x43dea6['id']+0x15b38);});_0x1b0fda(_0x267cd1);});}else{return db[_0x7ae0('0x5b')]['findAll']({'where':{'sectionId':_0x17e9e6['id']},'raw':!![]})['then'](function(_0x27206d){_0x27206d[_0x7ae0('0x6a')](function(_0x20a965){_0x267cd1[_0x7ae0('0x6b')](_0x20a965[_0x7ae0('0x6c')]+0x15b38);});_0x1b0fda(_0x267cd1);});}}catch(_0x152242){_0x3dede4(_0x152242);}});}exports[_0x7ae0('0x6e')]=function(_0x54231e,_0x45c3a7){return db['UserProfile'][_0x7ae0('0x4d')]({'where':{'id':_0x54231e[_0x7ae0('0x4a')]['id']}})[_0x7ae0('0x2b')](handleEntityNotFound(_0x45c3a7,null))['then'](function(_0x37b64d){if(_0x37b64d){return db[_0x7ae0('0x55')][_0x7ae0('0x56')](function(_0x3b800b){return db[_0x7ae0('0x58')][_0x7ae0('0x48')]({'where':{'userProfileId':_0x54231e[_0x7ae0('0x4a')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x43ac7d){if(_0x43ac7d){return db[_0x7ae0('0x58')]['destroy']({'where':{'userProfileId':_0x54231e[_0x7ae0('0x4a')]['id'],'id':_[_0x7ae0('0x31')](_0x43ac7d,function(_0x4e9c6e){return _0x4e9c6e['id'];})},'transaction':_0x3b800b});}})['then'](function(_0x84b9ee){var _0x18c686=_[_0x7ae0('0x31')](_0x54231e[_0x7ae0('0x4f')],function(_0xb5bbd5){_0xb5bbd5['userProfileId']=_0x54231e[_0x7ae0('0x4a')]['id'];return _0xb5bbd5;});return db[_0x7ae0('0x58')][_0x7ae0('0x6f')](_0x18c686,{'raw':!![],'transaction':_0x3b800b});})[_0x7ae0('0x2b')](function(_0x17fd52){var _0x532f9f=_[_0x7ae0('0x43')](_['map'](_0x17fd52,function(_0x55d49b){return _0x55d49b['get']({'plain':!![]});}),{'includeAll':![]});if(_0x532f9f){return db[_0x7ae0('0x58')]['findAll']({'where':{'userProfileId':_0x54231e[_0x7ae0('0x4a')]['id'],'sectionId':_[_0x7ae0('0x31')](_0x532f9f,function(_0x28b81c){return _0x28b81c[_0x7ae0('0x5d')];})},'attributes':['id',_0x7ae0('0x5d')],'raw':!![]})[_0x7ae0('0x2b')](function(_0x8b9a37){var _0x457e2e=_['map'](_0x54231e[_0x7ae0('0x4f')],function(_0x937c97){_0x937c97[_0x7ae0('0x5e')]=_0x54231e['params']['id'];return _0x937c97;});return db[_0x7ae0('0x5b')][_0x7ae0('0x6f')](_0x457e2e,{'raw':!![],'transaction':_0x3b800b});});}})[_0x7ae0('0x4e')](handleError(_0x45c3a7,null));});}})[_0x7ae0('0x2b')](function(_0x4b16f0){var _0x536e9f=_[_0x7ae0('0x31')](_0x4b16f0,function(_0x413415){return _0x413415[_0x7ae0('0x51')]({'plain':!![]});});})[_0x7ae0('0x2b')](respondWithResult(_0x45c3a7,null))[_0x7ae0('0x4e')](handleError(_0x45c3a7,null));};exports[_0x7ae0('0x70')]=function(_0x749aaa,_0x2a8015,_0x295fec){return db[_0x7ae0('0x32')]['find']({'where':{'id':_0x749aaa[_0x7ae0('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2a8015,null))['then'](function(_0x4e19c1){if(_0x4e19c1){return _0x4e19c1[_0x7ae0('0x70')](_0x749aaa['query']['ids']);}})[_0x7ae0('0x2b')](respondWithStatusCode(_0x2a8015,null))[_0x7ae0('0x4e')](handleError(_0x2a8015,null));};exports[_0x7ae0('0x71')]=function(_0x1433f7,_0x582635){var _0x1877db={'raw':![],'where':{}};var _0x549238={};var _0x2b85a4={'count':0x0,'rows':[]};var _0x4cc350=_0x1433f7[_0x7ae0('0x36')][_0x7ae0('0x72')];if(typeof _0x4cc350===_0x7ae0('0x73')){throw new db[(_0x7ae0('0x74'))][(_0x7ae0('0x75'))](_0x7ae0('0x76'));}var _0x5e5df8=_0x1433f7[_0x7ae0('0x36')][_0x7ae0('0x77')]||![];var _0x1f3e5d=getQueryModels(_0x4cc350,_0x5e5df8);if(typeof _0x1f3e5d['childModel']===_0x7ae0('0x73')){throw new db['Sequelize']['ValidationError'](_0x7ae0('0x78')+_0x4cc350+'\x27');}var _0x1e05bd=[];if(!_[_0x7ae0('0x65')](_0x1f3e5d[_0x7ae0('0x79')])){_0x1e05bd=_0x1f3e5d[_0x7ae0('0x79')];}else{_0x1e05bd=[{'name':_0x4cc350}];}return db[_0x7ae0('0x32')]['findOne']({'where':{'id':_0x1433f7[_0x7ae0('0x4a')]['id']}})[_0x7ae0('0x2b')](handleEntityNotFound(_0x582635,null))['then'](function(_0x3d4eb0){if(_0x3d4eb0){var _0x1d2bc0=[];for(var _0x165075=0x0;_0x165075<_0x1e05bd['length'];_0x165075++){_0x1d2bc0[_0x7ae0('0x6b')](db[_0x7ae0('0x58')]['findOne']({'where':{'userProfileId':_0x3d4eb0['id'],'name':_0x1e05bd[_0x165075][_0x7ae0('0x2e')]},'raw':!![]}));}return BPromise[_0x7ae0('0x7a')](_0x1d2bc0);}})[_0x7ae0('0x2b')](function(_0x3f7673){var _0x40b3b1=_[_0x7ae0('0x43')](_0x3f7673,function(_0x4f70dd){return _0x4f70dd?_0x4f70dd:undefined;});var _0x4ed1be=_[_0x7ae0('0x43')](_0x1e05bd,[_0x7ae0('0x7b'),!![]]);var _0x12a5e8=_['isEmpty'](_0x40b3b1)&&_['isEmpty'](_0x4ed1be)?null:_[_0x7ae0('0x7c')](_0x4ed1be,_0x40b3b1);if(_0x12a5e8){var _0x36deef=[];for(var _0xb759fa=0x0;_0xb759fa<_0x12a5e8[_0x7ae0('0x3b')];_0xb759fa++){var _0x5b23b9=_['find'](_0x1e05bd,function(_0x3b59aa){return _0x12a5e8[_0xb759fa]?_0x3b59aa['name']===_0x12a5e8[_0xb759fa][_0x7ae0('0x2e')]:null;});if(_0x5b23b9){if(_0x12a5e8[_0xb759fa]['ignore']){_0x36deef[_0x7ae0('0x6b')](getAllResources(_0x1f3e5d[_0x7ae0('0x7d')],_0x12a5e8[_0xb759fa]));}else{if(!_0x12a5e8[_0xb759fa][_0x7ae0('0x5a')]){_0x36deef[_0x7ae0('0x6b')](getAllowedResources(_0x5b23b9,_0x12a5e8[_0xb759fa],_0x1f3e5d[_0x7ae0('0x7d')]));}else{if(_0x5b23b9[_0x7ae0('0x38')]){_0x36deef[_0x7ae0('0x6b')](getAllFilteredResources(_0x5b23b9,_0x12a5e8[_0xb759fa]));}}}}}return BPromise[_0x7ae0('0x7a')](_0x36deef);}else{return null;}})[_0x7ae0('0x2b')](function(_0x52c2b6){var _0x397c21=_0x52c2b6;var _0x134dc4=null;if(_0x397c21){_0x134dc4=_0x397c21['length']===0x1?_0x397c21[0x0]:null;}if(_0x134dc4||_0x397c21){var _0x2fceb2=db[_0x1f3e5d[_0x7ae0('0x7d')]][_0x7ae0('0x4b')];_0x549238[_0x7ae0('0x38')]=_[_0x7ae0('0x37')](_0x2fceb2);_0x549238[_0x7ae0('0x36')]=_[_0x7ae0('0x37')](_0x1433f7[_0x7ae0('0x36')]);_0x549238[_0x7ae0('0x41')]=_[_0x7ae0('0x4c')](_0x549238[_0x7ae0('0x38')],_0x549238[_0x7ae0('0x36')]);_0x1877db[_0x7ae0('0x39')]=_[_0x7ae0('0x4c')](_0x549238[_0x7ae0('0x38')],qs[_0x7ae0('0x3a')](_0x1433f7[_0x7ae0('0x36')][_0x7ae0('0x3a')]));_0x1877db['attributes']=_0x1877db[_0x7ae0('0x39')][_0x7ae0('0x3b')]?_0x1877db[_0x7ae0('0x39')]:_0x549238['model'];if(!_0x1433f7[_0x7ae0('0x36')][_0x7ae0('0x3c')]('nolimit')){_0x1877db[_0x7ae0('0x24')]=qs[_0x7ae0('0x24')](_0x1433f7['query'][_0x7ae0('0x24')]);_0x1877db[_0x7ae0('0x23')]=qs[_0x7ae0('0x23')](_0x1433f7[_0x7ae0('0x36')][_0x7ae0('0x23')]);}_0x1877db[_0x7ae0('0x3e')]=qs[_0x7ae0('0x3f')](_0x1433f7['query'][_0x7ae0('0x3f')]);_0x1877db['where']=qs[_0x7ae0('0x41')](_[_0x7ae0('0x42')](_0x1433f7[_0x7ae0('0x36')],_0x549238[_0x7ae0('0x41')]));if(_0x1433f7[_0x7ae0('0x36')][_0x7ae0('0x43')]){_0x1877db[_0x7ae0('0x40')]=_[_0x7ae0('0x44')](_0x1877db[_0x7ae0('0x40')],{'$or':_[_0x7ae0('0x31')](_0x2fceb2,function(_0x279d35){if(_0x279d35[_0x7ae0('0x34')][_0x7ae0('0x35')]!==_0x7ae0('0x45')){var _0x3f8f9c={};_0x3f8f9c[_0x279d35[_0x7ae0('0x7e')]]={'$like':'%'+_0x1433f7[_0x7ae0('0x36')]['filter']+'%'};return _0x3f8f9c;}})});}var _0x1210f4=[];if(_0x134dc4){var _0xe06397=_['find'](_0x1e05bd,[_0x7ae0('0x2e'),_0x134dc4[_0x7ae0('0x2e')]]);if(_0xe06397[_0x7ae0('0x7e')]){var _0x31223a={};if(_0x1f3e5d['childModel']===_0x7ae0('0x7f')){_0x31223a[_0xe06397[_0x7ae0('0x80')]]=_[_0x7ae0('0x31')](_0x134dc4[_0x7ae0('0x81')],'id');}else{_0x31223a[_0xe06397[_0x7ae0('0x80')]]=_0x134dc4['associatedResources'];}_0x1210f4[_0x7ae0('0x6b')](_0x31223a);}else{_0x1877db[_0x7ae0('0x40')]['id']=_0x134dc4['associatedResources'];}}else{for(var _0x32c77d=0x0;_0x32c77d<_0x397c21['length'];_0x32c77d++){var _0xe06397=_[_0x7ae0('0x4d')](_0x1e05bd,[_0x7ae0('0x2e'),_0x397c21[_0x32c77d][_0x7ae0('0x2e')]]);if(_0xe06397[_0x7ae0('0x7e')]){var _0x31223a={};_0x31223a[_0xe06397[_0x7ae0('0x80')]]=_0x397c21[_0x32c77d]['associatedResources'];_0x1210f4[_0x7ae0('0x6b')](_0x31223a);}else{if(!_0x1877db[_0x7ae0('0x40')]['id'])_0x1877db[_0x7ae0('0x40')]['id']=[];_0x397c21[_0x32c77d]['associatedResources'][_0x7ae0('0x6a')](function(_0x494f1a){_0x1877db[_0x7ae0('0x40')]['id'][_0x7ae0('0x6b')](_0x494f1a);});}}}if(!_[_0x7ae0('0x65')](_0x1210f4)){_0x1877db[_0x7ae0('0x40')]=_[_0x7ae0('0x44')](_0x1877db[_0x7ae0('0x40')],{'$and':{'$or':_0x1210f4}});}_0x1877db=_[_0x7ae0('0x44')]({},_0x1877db,_0x1433f7[_0x7ae0('0x46')]);if(_0x134dc4&&!_0x134dc4[_0x7ae0('0x5a')]&&_0x1f3e5d[_0x7ae0('0x7d')]===_0x7ae0('0x7f')){if(_0x1433f7[_0x7ae0('0x36')][_0x7ae0('0x57')]){_0x1877db[_0x7ae0('0x47')]=[{'all':!![]}];}return db[_0x1f3e5d[_0x7ae0('0x7d')]][_0x7ae0('0x48')](_0x1877db)['then'](function(_0x4928d3){var _0x40f821=[];_0x4928d3[_0x7ae0('0x6a')](function(_0x1f8324){var _0x1560b0;switch(_0x1f8324[_0x7ae0('0x82')]){case _0x7ae0('0x83'):_0x1560b0=_[_0x7ae0('0x4d')](_0x134dc4['associatedResources'],function(_0xe27fb){return _0xe27fb['id']===_0x1f8324[_0x7ae0('0x84')]&&_0xe27fb[_0x7ae0('0x34')]==='DefaultReports';});break;case'custom':_0x1560b0=_[_0x7ae0('0x4d')](_0x134dc4['associatedResources'],function(_0x4ce7bf){return _0x4ce7bf['id']===_0x1f8324[_0x7ae0('0x84')]&&_0x4ce7bf[_0x7ae0('0x34')]==='CustomReports';});break;}if(_0x1560b0)_0x40f821[_0x7ae0('0x6b')](_0x1f8324);});_0x2b85a4[_0x7ae0('0x22')]=_0x40f821[_0x7ae0('0x3b')];_0x2b85a4[_0x7ae0('0x49')]=_0x40f821;return _0x2b85a4;});}else{return db[_0x1f3e5d[_0x7ae0('0x7d')]][_0x7ae0('0x22')]({'where':_0x1877db['where']})[_0x7ae0('0x2b')](function(_0x52e5af){_0x2b85a4[_0x7ae0('0x22')]=_0x52e5af;if(_0x1433f7[_0x7ae0('0x36')][_0x7ae0('0x57')]){if(_0x1f3e5d[_0x7ae0('0x7d')]==='CmContact'){_0x1877db['include']=[{'model':db[_0x7ae0('0x85')],'as':_0x7ae0('0x86'),'attributes':['id','name',_0x7ae0('0x87')],'required':_0x1433f7['query']['tag']?!![]:![]},{'model':db[_0x7ae0('0x85')],'as':_0x7ae0('0x88'),'attributes':['id',_0x7ae0('0x2e'),_0x7ae0('0x87')],'through':_0x1433f7['query'][_0x7ae0('0x89')]?{'attributes':[],'where':{'TagId':_0x1433f7['query']['tag']||undefined}}:{},'required':_0x1433f7[_0x7ae0('0x36')][_0x7ae0('0x89')]?!![]:![]}];}else{_0x1877db['include']=[{'all':!![]}];}}return db[_0x1f3e5d[_0x7ae0('0x7d')]][_0x7ae0('0x48')](_0x1877db);})[_0x7ae0('0x2b')](function(_0x4a4071){_0x2b85a4[_0x7ae0('0x49')]=_0x4a4071;return _0x2b85a4;});}}else{return _0x2b85a4;}})[_0x7ae0('0x2b')](respondWithFilteredResult(_0x582635,_0x1877db))['catch'](handleError(_0x582635,null));};function getAllResources(_0x542b0d,_0x5bfa6a){return new BPromise(function(_0x2adc38,_0x5b4527){if(_0x5bfa6a){var _0x4392ff=_0x5bfa6a['filter']?{[_0x5bfa6a[_0x7ae0('0x43')][_0x7ae0('0x7e')]]:_0x5bfa6a[_0x7ae0('0x43')][_0x7ae0('0x8a')]}:undefined;return db[_0x542b0d]['findAll']({'where':_0x4392ff,'raw':!![]})[_0x7ae0('0x2b')](function(_0x23c30e){_0x5bfa6a['associatedResources']=_[_0x7ae0('0x31')](_0x23c30e,'id');_0x2adc38(_0x5bfa6a);})[_0x7ae0('0x4e')](function(_0x517281){_0x5b4527(_0x517281);});}else{_0x2adc38(null);}});}function getAllFilteredResources(_0x4c9903,_0x3cefca){return new BPromise(function(_0x125e04,_0x3932e4){var _0x422822=_0x4c9903[_0x7ae0('0x43')]?{[_0x4c9903[_0x7ae0('0x43')][_0x7ae0('0x7e')]]:_0x4c9903['filter'][_0x7ae0('0x8a')]}:undefined;return db[_0x4c9903[_0x7ae0('0x38')]][_0x7ae0('0x48')]({'where':_0x422822,'raw':!![]})[_0x7ae0('0x2b')](function(_0xde61f4){_0x3cefca[_0x7ae0('0x81')]=_[_0x7ae0('0x31')](_0xde61f4,function(_0x182bbe){return _0x182bbe['name'];});_0x125e04(_0x3cefca);})[_0x7ae0('0x4e')](function(_0x39f675){_0x3932e4(_0x39f675);});});}function getAllowedResources(_0x2c0fad,_0x5184e3,_0x525d62){return new BPromise(function(_0x13fca2,_0x39217c){if(_0x5184e3){return db[_0x7ae0('0x5b')][_0x7ae0('0x48')]({'where':{'sectionId':_0x5184e3['id']},'raw':!![]})[_0x7ae0('0x2b')](function(_0x5c8cca){if(_0x2c0fad[_0x7ae0('0x7e')]&&_0x2c0fad['field']!=='id'){_0x5184e3[_0x7ae0('0x81')]=_[_0x7ae0('0x31')](_0x5c8cca,function(_0x5806dc){return _0x5806dc[_0x2c0fad[_0x7ae0('0x7e')]];});}else{if(_0x525d62===_0x7ae0('0x7f')){_0x5184e3[_0x7ae0('0x81')]=_[_0x7ae0('0x31')](_0x5c8cca,function(_0x22818b){return{'id':_0x22818b[_0x7ae0('0x6c')],'type':_0x22818b[_0x7ae0('0x34')]};});}else{_0x5184e3[_0x7ae0('0x81')]=_[_0x7ae0('0x31')](_0x5c8cca,function(_0x140095){return _0x140095[_0x7ae0('0x6c')];});}}_0x13fca2(_0x5184e3);})[_0x7ae0('0x4e')](function(_0x22f8fe){_0x39217c(_0x22f8fe);});}else{_0x13fca2(null);}});}function getQueryModels(_0xc22276,_0x4646af){var _0x3159e5=_0xc22276[_0x7ae0('0x8b')]();var _0x4d2b13={'childModel':undefined,'parentSections':[]};switch(_0x3159e5){case _0x7ae0('0x8c'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0x8d');break;case _0x7ae0('0x8e'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0x8f');break;case _0x7ae0('0x90'):_0x4d2b13['childModel']=_0x7ae0('0x91');_0x4d2b13[_0x7ae0('0x79')]=[{'name':'SquareProjects','field':_0x7ae0('0x2e'),'foreignKey':_0x7ae0('0x92')}];break;case _0x7ae0('0x93'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0x94');break;case _0x7ae0('0x95'):_0x4d2b13[_0x7ae0('0x7d')]='CmContact';_0x4d2b13[_0x7ae0('0x79')]=[{'name':'Lists','field':'id','foreignKey':_0x7ae0('0x96')}];break;case _0x7ae0('0x97'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0x98');break;case _0x7ae0('0x99'):_0x4d2b13[_0x7ae0('0x7d')]='CmCompany';break;case _0x7ae0('0x9a'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0x9b');break;case'chatqueues':_0x4d2b13[_0x7ae0('0x7d')]='ChatQueue';break;case'chatwebsites':_0x4d2b13['childModel']=_0x7ae0('0x9c');break;case _0x7ae0('0x9d'):_0x4d2b13['childModel']=_0x7ae0('0x9e');break;case _0x7ae0('0x9f'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xa0');break;case _0x7ae0('0xa1'):case _0x7ae0('0xa2'):case _0x7ae0('0xa3'):_0x4d2b13[_0x7ae0('0x7d')]='VoiceExtension';break;case _0x7ae0('0xa4'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xa5');break;case'voicemails':_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xa6');break;case _0x7ae0('0xa7'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xa8');_0x4d2b13['parentSections']=[{'name':_0x7ae0('0xa9'),'field':_0x7ae0('0x2e'),'foreignKey':_0x7ae0('0xaa'),'model':'User','filter':{'field':_0x7ae0('0xab'),'value':[_0x7ae0('0xac')]}},{'name':_0x7ae0('0xad'),'field':'name','foreignKey':'membername','model':_0x7ae0('0xae'),'filter':{'field':'role','value':[_0x7ae0('0xaf')]}},{'name':_0x7ae0('0xb0'),'field':_0x7ae0('0x2e'),'foreignKey':_0x7ae0('0xb1'),'model':_0x7ae0('0xb2'),'filter':{'field':_0x7ae0('0x34'),'value':[_0x7ae0('0xb3')]}},{'name':'QueueCampaigns','field':'name','foreignKey':_0x7ae0('0xb1'),'model':_0x7ae0('0xb2'),'filter':{'field':_0x7ae0('0x34'),'value':[_0x7ae0('0xb4')]}}];break;case _0x7ae0('0xb5'):_0x4d2b13['childModel']=_0x7ae0('0xb6');break;case _0x7ae0('0xb7'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xb8');break;case _0x7ae0('0xb9'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xba');break;case'ivrcampaigns':_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xbb');break;case _0x7ae0('0xbc'):_0x4d2b13[_0x7ae0('0x7d')]='MailQueue';break;case _0x7ae0('0xbd'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xbe');break;case _0x7ae0('0xbf'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xc0');break;case _0x7ae0('0xc1'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xc2');break;case _0x7ae0('0xc3'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xc4');break;case'smsqueues':_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xc5');break;case'smsaccounts':_0x4d2b13['childModel']=_0x7ae0('0xc6');break;case'teams':_0x4d2b13[_0x7ae0('0x7d')]='Team';break;case _0x7ae0('0xc7'):case _0x7ae0('0xc8'):_0x4d2b13['childModel']=_0x7ae0('0xb2');if(_0x4646af){_0x4d2b13['parentSections']=[{'name':_0x7ae0('0xb0')},{'name':_0x7ae0('0xc9')}];}break;case _0x7ae0('0xca'):case'agents':case _0x7ae0('0xcb'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xae');if(_0x4646af){_0x4d2b13['parentSections']=[{'name':_0x7ae0('0xcc'),'filter':{'field':_0x7ae0('0xab'),'value':[_0x7ae0('0xcd'),_0x7ae0('0xce')]},'ignore':!![]},{'name':_0x7ae0('0xa9')},{'name':_0x7ae0('0xad')}];}break;case _0x7ae0('0xcf'):_0x4d2b13['childModel']='ZendeskAccount';break;case'salesforceaccounts':_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xd0');break;case _0x7ae0('0xd1'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xd2');break;case _0x7ae0('0xd3'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xd4');break;case _0x7ae0('0xd5'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xd6');break;case _0x7ae0('0xd7'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xd8');break;case'vtigeraccounts':_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xae');break;case _0x7ae0('0xd9'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xda');break;case _0x7ae0('0xdb'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xdc');break;case _0x7ae0('0xdd'):_0x4d2b13['childModel']=_0x7ae0('0x69');break;case _0x7ae0('0xde'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xdf');break;case _0x7ae0('0xe0'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xe1');break;case _0x7ae0('0xe2'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xe3');break;case _0x7ae0('0xe4'):_0x4d2b13['childModel']=_0x7ae0('0xe5');break;case _0x7ae0('0xe6'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0x85');break;case _0x7ae0('0xe7'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xe8');break;case _0x7ae0('0xe9'):_0x4d2b13[_0x7ae0('0x7d')]='Trigger';break;case _0x7ae0('0xea'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xeb');break;case _0x7ae0('0xec'):_0x4d2b13['childModel']='Variable';break;case _0x7ae0('0xed'):_0x4d2b13['childModel']=_0x7ae0('0x6d');break;case _0x7ae0('0xee'):_0x4d2b13['childModel']=_0x7ae0('0x7f');_0x4d2b13[_0x7ae0('0x79')]=[{'name':_0x7ae0('0xef'),'field':'id','foreignKey':_0x7ae0('0x84')}];break;case _0x7ae0('0xf0'):_0x4d2b13[_0x7ae0('0x7d')]=_0x7ae0('0xf1');break;default:return _0x4d2b13;}return _0x4d2b13;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 9822970..058df89 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 _0x2344=['exports','events','UserProfile','save','update','remove','emit','hasOwnProperty'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2344,0x1c9));var _0x4234=function(_0x36824b,_0x14ffb8){_0x36824b=_0x36824b-0x0;var _0x30789c=_0x2344[_0x36824b];return _0x30789c;};'use strict';var EventEmitter=require(_0x4234('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x4234('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4234('0x2'),'afterUpdate':_0x4234('0x3'),'afterDestroy':_0x4234('0x4')};function emitEvent(_0x3b4dcf){return function(_0x3b114a,_0x42e00f,_0x5ac7ef){UserProfileEvents[_0x4234('0x5')](_0x3b4dcf+':'+_0x3b114a['id'],_0x3b114a);UserProfileEvents['emit'](_0x3b4dcf,_0x3b114a);_0x5ac7ef(null);};}for(var e in events){if(events[_0x4234('0x6')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x4234('0x7')]=UserProfileEvents; \ No newline at end of file +var _0x0f89=['hasOwnProperty','hook','exports','../../mysqldb','UserProfile','setMaxListeners','save','update','emit'];(function(_0x3d37f0,_0x213bec){var _0x3d6791=function(_0x4e59bf){while(--_0x4e59bf){_0x3d37f0['push'](_0x3d37f0['shift']());}};_0x3d6791(++_0x213bec);}(_0x0f89,0x1a1));var _0x90f8=function(_0x487826,_0x53f224){_0x487826=_0x487826-0x0;var _0x4d13b5=_0x0f89[_0x487826];return _0x4d13b5;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x90f8('0x0'))['db'][_0x90f8('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x90f8('0x2')](0x0);var events={'afterCreate':_0x90f8('0x3'),'afterUpdate':_0x90f8('0x4'),'afterDestroy':'remove'};function emitEvent(_0x53e972){return function(_0x191012,_0x241aba,_0x3b2996){UserProfileEvents[_0x90f8('0x5')](_0x53e972+':'+_0x191012['id'],_0x191012);UserProfileEvents[_0x90f8('0x5')](_0x53e972,_0x191012);_0x3b2996(null);};}for(var e in events){if(events[_0x90f8('0x6')](e)){var event=events[e];UserProfile[_0x90f8('0x7')](e,emitEvent(event));}}module[_0x90f8('0x8')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 627e64e..ee7264a 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 _0xac7f=['lodash','util','../../config/logger','bluebird','request-promise','../../config/environment','./userProfile.attributes','exports','define','user_profiles'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xac7f,0xa0));var _0xfac7=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xac7f[_0xefd519];return _0x4bb882;};'use strict';var _=require(_0xfac7('0x0'));var util=require(_0xfac7('0x1'));var logger=require(_0xfac7('0x2'))('api');var moment=require('moment');var BPromise=require(_0xfac7('0x3'));var rp=require(_0xfac7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfac7('0x5'));var attributes=require(_0xfac7('0x6'));module[_0xfac7('0x7')]=function(_0x4b5722,_0x593b7d){return _0x4b5722[_0xfac7('0x8')]('UserProfile',attributes,{'tableName':_0xfac7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x285e=['../../config/logger','moment','request-promise','path','rimraf','./userProfile.attributes','exports','define','user_profiles','util'];(function(_0x2cc0b3,_0x120bf1){var _0x1667ef=function(_0x3abcb4){while(--_0x3abcb4){_0x2cc0b3['push'](_0x2cc0b3['shift']());}};_0x1667ef(++_0x120bf1);}(_0x285e,0xc7));var _0xe285=function(_0x29db36,_0x410ae9){_0x29db36=_0x29db36-0x0;var _0x234e87=_0x285e[_0x29db36];return _0x234e87;};'use strict';var _=require('lodash');var util=require(_0xe285('0x0'));var logger=require(_0xe285('0x1'))('api');var moment=require(_0xe285('0x2'));var BPromise=require('bluebird');var rp=require(_0xe285('0x3'));var fs=require('fs');var path=require(_0xe285('0x4'));var rimraf=require(_0xe285('0x5'));var config=require('../../config/environment');var attributes=require(_0xe285('0x6'));module[_0xe285('0x7')]=function(_0x120dd3,_0x114a03){return _0x120dd3[_0xe285('0x8')]('UserProfile',attributes,{'tableName':_0xe285('0x9'),'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 13ff76a..1db5e23 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 _0x8958=['UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./userProfile.socket','register','request','info'];(function(_0x2674a2,_0x19491d){var _0x455e64=function(_0x528e41){while(--_0x528e41){_0x2674a2['push'](_0x2674a2['shift']());}};_0x455e64(++_0x19491d);}(_0x8958,0x93));var _0x8895=function(_0x337607,_0x4dc6d8){_0x337607=_0x337607-0x0;var _0x5a5816=_0x8958[_0x337607];return _0x5a5816;};'use strict';var _=require('lodash');var util=require(_0x8895('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8895('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x8895('0x2'))(_0x8895('0x3'));var config=require(_0x8895('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x8895('0x5')][_0x8895('0x6')]({'port':0x232a});config[_0x8895('0x7')]=_[_0x8895('0x8')](config[_0x8895('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x8895('0x9'))(new Redis(config[_0x8895('0x7')]));require(_0x8895('0xa'))[_0x8895('0xb')](socket);function respondWithRpcPromise(_0x6eab1e,_0x29c126,_0x22a12b){return new BPromise(function(_0xdb3d59,_0x46c467){return client[_0x8895('0xc')](_0x6eab1e,_0x22a12b)['then'](function(_0x1cf600){logger[_0x8895('0xd')](_0x8895('0xe'),_0x29c126,_0x8895('0xf'));logger[_0x8895('0x10')](_0x8895('0x11'),_0x29c126,'request\x20sent',JSON[_0x8895('0x12')](_0x1cf600));if(_0x1cf600[_0x8895('0x13')]){if(_0x1cf600[_0x8895('0x13')]['code']===0x1f4){logger['error'](_0x8895('0xe'),_0x29c126,_0x1cf600['error'][_0x8895('0x14')]);return _0x46c467(_0x1cf600[_0x8895('0x13')][_0x8895('0x14')]);}logger[_0x8895('0x13')](_0x8895('0xe'),_0x29c126,_0x1cf600['error'][_0x8895('0x14')]);return _0xdb3d59(_0x1cf600[_0x8895('0x13')][_0x8895('0x14')]);}else{logger[_0x8895('0xd')](_0x8895('0xe'),_0x29c126,_0x8895('0xf'));_0xdb3d59(_0x1cf600[_0x8895('0x15')][_0x8895('0x14')]);}})[_0x8895('0x16')](function(_0x2da618){logger[_0x8895('0x13')](_0x8895('0xe'),_0x29c126,_0x2da618);_0x46c467(_0x2da618);});});} \ No newline at end of file +var _0x1883=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','then','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserProfile,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3b5f39,_0x16870e){var _0x4df97c=function(_0x5624bf){while(--_0x5624bf){_0x3b5f39['push'](_0x3b5f39['shift']());}};_0x4df97c(++_0x16870e);}(_0x1883,0xab));var _0x3188=function(_0x2d9412,_0x47f181){_0x2d9412=_0x2d9412-0x0;var _0x437fe2=_0x1883[_0x2d9412];return _0x437fe2;};'use strict';var _=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var moment=require(_0x3188('0x2'));var BPromise=require(_0x3188('0x3'));var rs=require(_0x3188('0x4'));var fs=require('fs');var Redis=require(_0x3188('0x5'));var db=require(_0x3188('0x6'))['db'];var utils=require(_0x3188('0x7'));var logger=require(_0x3188('0x8'))(_0x3188('0x9'));var config=require(_0x3188('0xa'));var jayson=require(_0x3188('0xb'));var client=jayson[_0x3188('0xc')][_0x3188('0xd')]({'port':0x232a});config[_0x3188('0xe')]=_[_0x3188('0xf')](config[_0x3188('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x3188('0x10'))(new Redis(config[_0x3188('0xe')]));require('./userProfile.socket')[_0x3188('0x11')](socket);function respondWithRpcPromise(_0x5b7f47,_0xc6040,_0x34fc82){return new BPromise(function(_0x209e31,_0x43b69){return client['request'](_0x5b7f47,_0x34fc82)[_0x3188('0x12')](function(_0x2cdcb2){logger['info']('UserProfile,\x20%s,\x20%s',_0xc6040,_0x3188('0x13'));logger[_0x3188('0x14')](_0x3188('0x15'),_0xc6040,_0x3188('0x13'),JSON[_0x3188('0x16')](_0x2cdcb2));if(_0x2cdcb2[_0x3188('0x17')]){if(_0x2cdcb2['error'][_0x3188('0x18')]===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0xc6040,_0x2cdcb2[_0x3188('0x17')]['message']);return _0x43b69(_0x2cdcb2['error'][_0x3188('0x19')]);}logger[_0x3188('0x17')](_0x3188('0x1a'),_0xc6040,_0x2cdcb2[_0x3188('0x17')][_0x3188('0x19')]);return _0x209e31(_0x2cdcb2[_0x3188('0x17')]['message']);}else{logger[_0x3188('0x1b')](_0x3188('0x1a'),_0xc6040,_0x3188('0x13'));_0x209e31(_0x2cdcb2[_0x3188('0x1c')][_0x3188('0x19')]);}})[_0x3188('0x1d')](function(_0xac7f48){logger[_0x3188('0x17')]('UserProfile,\x20%s,\x20%s',_0xc6040,_0xac7f48);_0x43b69(_0xac7f48);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 97f5d8f..8252deb 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 _0xa713=['remove','update','emit','removeListener','length','userProfile:','./userProfile.events','save'];(function(_0x3ba801,_0x1461f7){var _0xf4999a=function(_0x1ebd06){while(--_0x1ebd06){_0x3ba801['push'](_0x3ba801['shift']());}};_0xf4999a(++_0x1461f7);}(_0xa713,0x1ce));var _0x3a71=function(_0x4f350b,_0xd6d913){_0x4f350b=_0x4f350b-0x0;var _0x4dcf9d=_0xa713[_0x4f350b];return _0x4dcf9d;};'use strict';var UserProfileEvents=require(_0x3a71('0x0'));var events=[_0x3a71('0x1'),_0x3a71('0x2'),_0x3a71('0x3')];function createListener(_0x20d83b,_0x95d61f){return function(_0x1d0007){_0x95d61f[_0x3a71('0x4')](_0x20d83b,_0x1d0007);};}function removeListener(_0x603cfe,_0x547743){return function(){UserProfileEvents[_0x3a71('0x5')](_0x603cfe,_0x547743);};}exports['register']=function(_0x5cebc9){for(var _0xc9d067=0x0,_0x5dfe60=events[_0x3a71('0x6')];_0xc9d067<_0x5dfe60;_0xc9d067++){var _0x213a32=events[_0xc9d067];var _0x3722b5=createListener(_0x3a71('0x7')+_0x213a32,_0x5cebc9);UserProfileEvents['on'](_0x213a32,_0x3722b5);}}; \ No newline at end of file +var _0x315f=['save','remove','update','removeListener','length','./userProfile.events'];(function(_0xb510a2,_0x3f25ab){var _0x54e721=function(_0xb2e87f){while(--_0xb2e87f){_0xb510a2['push'](_0xb510a2['shift']());}};_0x54e721(++_0x3f25ab);}(_0x315f,0xdd));var _0xf315=function(_0x671369,_0x433da5){_0x671369=_0x671369-0x0;var _0x33f2b4=_0x315f[_0x671369];return _0x33f2b4;};'use strict';var UserProfileEvents=require(_0xf315('0x0'));var events=[_0xf315('0x1'),_0xf315('0x2'),_0xf315('0x3')];function createListener(_0x3897ba,_0x2e6d33){return function(_0x23a746){_0x2e6d33['emit'](_0x3897ba,_0x23a746);};}function removeListener(_0x15cd66,_0x536edd){return function(){UserProfileEvents[_0xf315('0x4')](_0x15cd66,_0x536edd);};}exports['register']=function(_0x4951b6){for(var _0x5e793a=0x0,_0x4f9300=events[_0xf315('0x5')];_0x5e793a<_0x4f9300;_0x5e793a++){var _0x595122=events[_0x5e793a];var _0x4efd0f=createListener('userProfile:'+_0x595122,_0x4951b6);UserProfileEvents['on'](_0x595122,_0x4efd0f);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 690a067..e9d6576 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 _0xa0df=['create','put','update','delete','destroy','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','/describe','describe','/:id','show','post'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa0df,0x11d));var _0xfa0d=function(_0x153488,_0x46257d){_0x153488=_0x153488-0x0;var _0x4e3004=_0xa0df[_0x153488];return _0x4e3004;};'use strict';var multer=require(_0xfa0d('0x0'));var util=require(_0xfa0d('0x1'));var path=require('path');var timeout=require(_0xfa0d('0x2'));var express=require(_0xfa0d('0x3'));var router=express['Router']();var auth=require(_0xfa0d('0x4'));var interaction=require(_0xfa0d('0x5'));var config=require(_0xfa0d('0x6'));var controller=require(_0xfa0d('0x7'));router[_0xfa0d('0x8')]('/',auth[_0xfa0d('0x9')](),controller['index']);router[_0xfa0d('0x8')](_0xfa0d('0xa'),auth['isAuthenticated'](),controller[_0xfa0d('0xb')]);router[_0xfa0d('0x8')](_0xfa0d('0xc'),auth['isAuthenticated'](),controller[_0xfa0d('0xd')]);router[_0xfa0d('0xe')]('/',auth['isAuthenticated'](),controller[_0xfa0d('0xf')]);router[_0xfa0d('0x10')]('/:id',auth[_0xfa0d('0x9')](),controller[_0xfa0d('0x11')]);router[_0xfa0d('0x12')](_0xfa0d('0xc'),auth['isAuthenticated'](),controller[_0xfa0d('0x13')]);module['exports']=router; \ No newline at end of file +var _0x3d2f=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','isAuthenticated','index','get','/describe','/:id','show','create','put','update','exports'];(function(_0x3a274e,_0x25411b){var _0x526a06=function(_0x103c0f){while(--_0x103c0f){_0x3a274e['push'](_0x3a274e['shift']());}};_0x526a06(++_0x25411b);}(_0x3d2f,0x18f));var _0xf3d2=function(_0x3e0583,_0x4f0c7d){_0x3e0583=_0x3e0583-0x0;var _0x4f5045=_0x3d2f[_0x3e0583];return _0x4f5045;};'use strict';var multer=require(_0xf3d2('0x0'));var util=require(_0xf3d2('0x1'));var path=require('path');var timeout=require(_0xf3d2('0x2'));var express=require(_0xf3d2('0x3'));var router=express[_0xf3d2('0x4')]();var auth=require(_0xf3d2('0x5'));var interaction=require(_0xf3d2('0x6'));var config=require(_0xf3d2('0x7'));var controller=require(_0xf3d2('0x8'));router['get']('/',auth[_0xf3d2('0x9')](),controller[_0xf3d2('0xa')]);router[_0xf3d2('0xb')](_0xf3d2('0xc'),auth[_0xf3d2('0x9')](),controller['describe']);router[_0xf3d2('0xb')](_0xf3d2('0xd'),auth['isAuthenticated'](),controller[_0xf3d2('0xe')]);router['post']('/',auth[_0xf3d2('0x9')](),controller[_0xf3d2('0xf')]);router[_0xf3d2('0x10')](_0xf3d2('0xd'),auth[_0xf3d2('0x9')](),controller[_0xf3d2('0x11')]);router['delete'](_0xf3d2('0xd'),auth[_0xf3d2('0x9')](),controller['destroy']);module[_0xf3d2('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 2418ba6..346e449 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 _0x524c=['exports','STRING','INTEGER','sequelize'];(function(_0x40f758,_0x3cf9ff){var _0x143c90=function(_0x54cad6){while(--_0x54cad6){_0x40f758['push'](_0x40f758['shift']());}};_0x143c90(++_0x3cf9ff);}(_0x524c,0x177));var _0xc524=function(_0x48f401,_0x83c260){_0x48f401=_0x48f401-0x0;var _0x14636f=_0x524c[_0x48f401];return _0x14636f;};'use strict';var Sequelize=require(_0xc524('0x0'));module[_0xc524('0x1')]={'name':{'type':Sequelize[_0xc524('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xc524('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc524('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x12c9=['STRING','INTEGER','exports'];(function(_0x108a38,_0x945325){var _0x49aeef=function(_0x1dd31d){while(--_0x1dd31d){_0x108a38['push'](_0x108a38['shift']());}};_0x49aeef(++_0x945325);}(_0x12c9,0x13a));var _0x912c=function(_0x36ed67,_0x202027){_0x36ed67=_0x36ed67-0x0;var _0x1f6ce1=_0x12c9[_0x36ed67];return _0x1f6ce1;};'use strict';var Sequelize=require('sequelize');module[_0x912c('0x0')]={'name':{'type':Sequelize[_0x912c('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x912c('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 3985535..1f8b922 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 _0x2a40=['describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','end','json','count','offset','limit','status','Content-Range','apply','reject','update','destroy','sendStatus','error','stack','name','send','index','map','UserProfileResource','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','then','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2a40,0x139));var _0x02a4=function(_0xc40b9f,_0x17ec1f){_0xc40b9f=_0xc40b9f-0x0;var _0x535b9c=_0x2a40[_0xc40b9f];return _0x535b9c;};'use strict';var pdf=require(_0x02a4('0x0'));var emlformat=require(_0x02a4('0x1'));var rimraf=require(_0x02a4('0x2'));var zipdir=require(_0x02a4('0x3'));var jsonpatch=require(_0x02a4('0x4'));var rp=require(_0x02a4('0x5'));var moment=require('moment');var BPromise=require(_0x02a4('0x6'));var Mustache=require(_0x02a4('0x7'));var util=require(_0x02a4('0x8'));var path=require(_0x02a4('0x9'));var sox=require('sox');var csv=require(_0x02a4('0xa'));var ejs=require(_0x02a4('0xb'));var fs=require('fs');var _=require(_0x02a4('0xc'));var squel=require(_0x02a4('0xd'));var crypto=require(_0x02a4('0xe'));var jsforce=require(_0x02a4('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x02a4('0xa'));var querystring=require(_0x02a4('0x10'));var Papa=require(_0x02a4('0x11'));var Redis=require('ioredis');var authService=require(_0x02a4('0x12'));var qs=require(_0x02a4('0x13'));var as=require(_0x02a4('0x14'));var hardwareService=require(_0x02a4('0x15'));var logger=require('../../config/logger')(_0x02a4('0x16'));var utils=require(_0x02a4('0x17'));var config=require(_0x02a4('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a6985,_0x22e258){_0x22e258=_0x22e258||0xcc;return function(_0x47800d){if(_0x47800d){return _0x3a6985['sendStatus'](_0x22e258);}return _0x3a6985['status'](_0x22e258)[_0x02a4('0x19')]();};}function respondWithResult(_0x580d95,_0x10e582){_0x10e582=_0x10e582||0xc8;return function(_0x33e71a){if(_0x33e71a){return _0x580d95['status'](_0x10e582)[_0x02a4('0x1a')](_0x33e71a);}};}function respondWithFilteredResult(_0x992628,_0x263619){return function(_0x1de338){if(_0x1de338){var _0x49c749=_0x1de338[_0x02a4('0x1b')],_0x5d9400=_0x263619['offset'],_0x2d4b3f=_0x263619[_0x02a4('0x1c')]+_0x263619[_0x02a4('0x1d')],_0x3c2470;if(_0x2d4b3f>=_0x49c749){_0x2d4b3f=_0x49c749;_0x3c2470=0xc8;}else{_0x3c2470=0xce;}_0x992628[_0x02a4('0x1e')](_0x3c2470);return _0x992628['set'](_0x02a4('0x1f'),_0x5d9400+'-'+_0x2d4b3f+'/'+_0x49c749)[_0x02a4('0x1a')](_0x1de338);}return null;};}function patchUpdates(_0x361a20){return function(_0x3fe0bf){try{jsonpatch[_0x02a4('0x20')](_0x3fe0bf,_0x361a20,!![]);}catch(_0x97bea0){return BPromise[_0x02a4('0x21')](_0x97bea0);}return _0x3fe0bf['save']();};}function saveUpdates(_0x6bcc74,_0x244e9a){return function(_0x1fc8b7){if(_0x1fc8b7){return _0x1fc8b7[_0x02a4('0x22')](_0x6bcc74)['then'](function(_0x5a0098){return _0x5a0098;});}return null;};}function removeEntity(_0x7168b7,_0x292fd1){return function(_0x434063){if(_0x434063){return _0x434063[_0x02a4('0x23')]()['then'](function(){_0x7168b7[_0x02a4('0x1e')](0xcc)[_0x02a4('0x19')]();});}};}function handleEntityNotFound(_0x15db03,_0x5543ca){return function(_0xb58af0){if(!_0xb58af0){_0x15db03[_0x02a4('0x24')](0x194);}return _0xb58af0;};}function handleError(_0x9012c9,_0x1f3bc7){_0x1f3bc7=_0x1f3bc7||0x1f4;return function(_0x24c007){logger[_0x02a4('0x25')](_0x24c007[_0x02a4('0x26')]);if(_0x24c007[_0x02a4('0x27')]){delete _0x24c007[_0x02a4('0x27')];}_0x9012c9[_0x02a4('0x1e')](_0x1f3bc7)[_0x02a4('0x28')](_0x24c007);};}exports[_0x02a4('0x29')]=function(_0x2e3b95,_0x241f13){var _0x5829b4={},_0x41f953={},_0x1c5f20={'count':0x0,'rows':[]};var _0x144bff=_[_0x02a4('0x2a')](db[_0x02a4('0x2b')]['rawAttributes'],function(_0x42b219){return{'name':_0x42b219[_0x02a4('0x2c')],'type':_0x42b219[_0x02a4('0x2d')][_0x02a4('0x2e')]};});_0x41f953[_0x02a4('0x2f')]=_[_0x02a4('0x2a')](_0x144bff,_0x02a4('0x27'));_0x41f953['query']=_[_0x02a4('0x30')](_0x2e3b95['query']);_0x41f953[_0x02a4('0x31')]=_[_0x02a4('0x32')](_0x41f953[_0x02a4('0x2f')],_0x41f953[_0x02a4('0x33')]);_0x5829b4[_0x02a4('0x34')]=_['intersection'](_0x41f953[_0x02a4('0x2f')],qs[_0x02a4('0x35')](_0x2e3b95[_0x02a4('0x33')][_0x02a4('0x35')]));_0x5829b4[_0x02a4('0x34')]=_0x5829b4[_0x02a4('0x34')][_0x02a4('0x36')]?_0x5829b4['attributes']:_0x41f953[_0x02a4('0x2f')];if(!_0x2e3b95[_0x02a4('0x33')][_0x02a4('0x37')](_0x02a4('0x38'))){_0x5829b4[_0x02a4('0x1d')]=qs[_0x02a4('0x1d')](_0x2e3b95[_0x02a4('0x33')][_0x02a4('0x1d')]);_0x5829b4['offset']=qs[_0x02a4('0x1c')](_0x2e3b95['query'][_0x02a4('0x1c')]);}_0x5829b4[_0x02a4('0x39')]=qs[_0x02a4('0x3a')](_0x2e3b95[_0x02a4('0x33')][_0x02a4('0x3a')]);_0x5829b4[_0x02a4('0x3b')]=qs[_0x02a4('0x31')](_[_0x02a4('0x3c')](_0x2e3b95['query'],_0x41f953['filters']));if(_0x2e3b95[_0x02a4('0x33')]['filter']){_0x5829b4[_0x02a4('0x3b')]=_['merge'](_0x5829b4[_0x02a4('0x3b')],{'$or':_[_0x02a4('0x2a')](_0x144bff,function(_0x42bc6a){if(_0x42bc6a[_0x02a4('0x2d')]!==_0x02a4('0x3d')){var _0x304f14={};_0x304f14[_0x42bc6a[_0x02a4('0x27')]]={'$like':'%'+_0x2e3b95[_0x02a4('0x33')][_0x02a4('0x3e')]+'%'};return _0x304f14;}})});}_0x5829b4=_[_0x02a4('0x3f')]({},_0x5829b4,_0x2e3b95[_0x02a4('0x40')]);var _0x2cbb3d={'where':_0x5829b4['where']};return db[_0x02a4('0x2b')][_0x02a4('0x1b')](_0x2cbb3d)[_0x02a4('0x41')](function(_0x42fd25){_0x1c5f20[_0x02a4('0x1b')]=_0x42fd25;if(_0x2e3b95[_0x02a4('0x33')][_0x02a4('0x42')]){_0x5829b4['include']=[{'all':!![]}];}return db[_0x02a4('0x2b')][_0x02a4('0x43')](_0x5829b4);})[_0x02a4('0x41')](function(_0x5a070b){_0x1c5f20[_0x02a4('0x44')]=_0x5a070b;return _0x1c5f20;})[_0x02a4('0x41')](respondWithFilteredResult(_0x241f13,_0x5829b4))[_0x02a4('0x45')](handleError(_0x241f13,null));};exports[_0x02a4('0x46')]=function(_0x5bc6c1,_0x4d0f0f){var _0x5164f6={'raw':![],'where':{'id':_0x5bc6c1[_0x02a4('0x47')]['id']}},_0x55ad35={};_0x55ad35['model']=_[_0x02a4('0x30')](db[_0x02a4('0x2b')][_0x02a4('0x48')]);_0x55ad35['query']=_['keys'](_0x5bc6c1[_0x02a4('0x33')]);_0x55ad35[_0x02a4('0x31')]=_['intersection'](_0x55ad35[_0x02a4('0x2f')],_0x55ad35[_0x02a4('0x33')]);_0x5164f6[_0x02a4('0x34')]=_[_0x02a4('0x32')](_0x55ad35[_0x02a4('0x2f')],qs['fields'](_0x5bc6c1[_0x02a4('0x33')][_0x02a4('0x35')]));_0x5164f6[_0x02a4('0x34')]=_0x5164f6[_0x02a4('0x34')][_0x02a4('0x36')]?_0x5164f6['attributes']:_0x55ad35[_0x02a4('0x2f')];if(_0x5bc6c1[_0x02a4('0x33')][_0x02a4('0x42')]){_0x5164f6[_0x02a4('0x49')]=[{'all':!![]}];}_0x5164f6=_[_0x02a4('0x3f')]({},_0x5164f6,_0x5bc6c1[_0x02a4('0x40')]);return db[_0x02a4('0x2b')][_0x02a4('0x4a')](_0x5164f6)[_0x02a4('0x41')](handleEntityNotFound(_0x4d0f0f,null))['then'](respondWithResult(_0x4d0f0f,null))[_0x02a4('0x45')](handleError(_0x4d0f0f,null));};exports['create']=function(_0x1e7603,_0xbd749b){return db['UserProfileResource'][_0x02a4('0x4b')](_0x1e7603[_0x02a4('0x4c')],{})[_0x02a4('0x41')](respondWithResult(_0xbd749b,0xc9))[_0x02a4('0x45')](handleError(_0xbd749b,null));};exports['update']=function(_0x4196b3,_0x467557){if(_0x4196b3[_0x02a4('0x4c')]['id']){delete _0x4196b3[_0x02a4('0x4c')]['id'];}return db[_0x02a4('0x2b')][_0x02a4('0x4a')]({'where':{'id':_0x4196b3[_0x02a4('0x47')]['id']}})[_0x02a4('0x41')](handleEntityNotFound(_0x467557,null))[_0x02a4('0x41')](saveUpdates(_0x4196b3[_0x02a4('0x4c')],null))['then'](respondWithResult(_0x467557,null))[_0x02a4('0x45')](handleError(_0x467557,null));};exports[_0x02a4('0x23')]=function(_0x542ca0,_0x28e07f){return db['UserProfileResource'][_0x02a4('0x4a')]({'where':{'id':_0x542ca0[_0x02a4('0x47')]['id']}})['then'](handleEntityNotFound(_0x28e07f,null))[_0x02a4('0x41')](removeEntity(_0x28e07f,null))[_0x02a4('0x45')](handleError(_0x28e07f,null));};exports['describe']=function(_0x5d89bd,_0x60376b){return db[_0x02a4('0x2b')][_0x02a4('0x4d')]()[_0x02a4('0x41')](respondWithResult(_0x60376b,null))['catch'](handleError(_0x60376b,null));}; \ No newline at end of file +var _0xf180=['../../config/logger','../../config/environment','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','name','send','map','UserProfileResource','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','update','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf180,0x116));var _0x0f18=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xf180[_0x13ea00];return _0x1f7347;};'use strict';var pdf=require(_0x0f18('0x0'));var emlformat=require(_0x0f18('0x1'));var rimraf=require(_0x0f18('0x2'));var zipdir=require(_0x0f18('0x3'));var jsonpatch=require(_0x0f18('0x4'));var rp=require('request-promise');var moment=require(_0x0f18('0x5'));var BPromise=require(_0x0f18('0x6'));var Mustache=require(_0x0f18('0x7'));var util=require(_0x0f18('0x8'));var path=require('path');var sox=require(_0x0f18('0x9'));var csv=require('to-csv');var ejs=require(_0x0f18('0xa'));var fs=require('fs');var _=require(_0x0f18('0xb'));var squel=require('squel');var crypto=require(_0x0f18('0xc'));var jsforce=require(_0x0f18('0xd'));var deskjs=require(_0x0f18('0xe'));var toCsv=require(_0x0f18('0xf'));var querystring=require(_0x0f18('0x10'));var Papa=require(_0x0f18('0x11'));var Redis=require(_0x0f18('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x0f18('0x13'));var as=require(_0x0f18('0x14'));var hardwareService=require(_0x0f18('0x15'));var logger=require(_0x0f18('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x0f18('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a8e5b,_0x1189ae){_0x1189ae=_0x1189ae||0xcc;return function(_0x52f5bf){if(_0x52f5bf){return _0x3a8e5b['sendStatus'](_0x1189ae);}return _0x3a8e5b['status'](_0x1189ae)[_0x0f18('0x18')]();};}function respondWithResult(_0x160590,_0x2b804f){_0x2b804f=_0x2b804f||0xc8;return function(_0x21a86a){if(_0x21a86a){return _0x160590[_0x0f18('0x19')](_0x2b804f)[_0x0f18('0x1a')](_0x21a86a);}};}function respondWithFilteredResult(_0x3fc0a5,_0x5c212f){return function(_0x2f2e01){if(_0x2f2e01){var _0x5039dc=_0x2f2e01[_0x0f18('0x1b')],_0x25c8b1=_0x5c212f[_0x0f18('0x1c')],_0x1a3a60=_0x5c212f['offset']+_0x5c212f[_0x0f18('0x1d')],_0x5ec54e;if(_0x1a3a60>=_0x5039dc){_0x1a3a60=_0x5039dc;_0x5ec54e=0xc8;}else{_0x5ec54e=0xce;}_0x3fc0a5[_0x0f18('0x19')](_0x5ec54e);return _0x3fc0a5[_0x0f18('0x1e')](_0x0f18('0x1f'),_0x25c8b1+'-'+_0x1a3a60+'/'+_0x5039dc)[_0x0f18('0x1a')](_0x2f2e01);}return null;};}function patchUpdates(_0x3fe1e9){return function(_0x99d515){try{jsonpatch[_0x0f18('0x20')](_0x99d515,_0x3fe1e9,!![]);}catch(_0x3176d2){return BPromise[_0x0f18('0x21')](_0x3176d2);}return _0x99d515[_0x0f18('0x22')]();};}function saveUpdates(_0x5206b1,_0x2793ef){return function(_0x11bbdf){if(_0x11bbdf){return _0x11bbdf['update'](_0x5206b1)[_0x0f18('0x23')](function(_0x2393c2){return _0x2393c2;});}return null;};}function removeEntity(_0x31baae,_0xb4e513){return function(_0xfc96cb){if(_0xfc96cb){return _0xfc96cb[_0x0f18('0x24')]()[_0x0f18('0x23')](function(){_0x31baae[_0x0f18('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x188677,_0x53b56c){return function(_0x5cd021){if(!_0x5cd021){_0x188677[_0x0f18('0x25')](0x194);}return _0x5cd021;};}function handleError(_0x58bde9,_0x2ff371){_0x2ff371=_0x2ff371||0x1f4;return function(_0xfa49b4){logger[_0x0f18('0x26')](_0xfa49b4['stack']);if(_0xfa49b4[_0x0f18('0x27')]){delete _0xfa49b4[_0x0f18('0x27')];}_0x58bde9['status'](_0x2ff371)[_0x0f18('0x28')](_0xfa49b4);};}exports['index']=function(_0x4e9cc7,_0x1863f6){var _0x225abb={},_0x511766={},_0x2c095e={'count':0x0,'rows':[]};var _0x1ec9be=_[_0x0f18('0x29')](db[_0x0f18('0x2a')][_0x0f18('0x2b')],function(_0x555ceb){return{'name':_0x555ceb['fieldName'],'type':_0x555ceb[_0x0f18('0x2c')][_0x0f18('0x2d')]};});_0x511766[_0x0f18('0x2e')]=_['map'](_0x1ec9be,'name');_0x511766[_0x0f18('0x2f')]=_[_0x0f18('0x30')](_0x4e9cc7[_0x0f18('0x2f')]);_0x511766[_0x0f18('0x31')]=_['intersection'](_0x511766['model'],_0x511766[_0x0f18('0x2f')]);_0x225abb['attributes']=_[_0x0f18('0x32')](_0x511766[_0x0f18('0x2e')],qs[_0x0f18('0x33')](_0x4e9cc7['query'][_0x0f18('0x33')]));_0x225abb[_0x0f18('0x34')]=_0x225abb['attributes'][_0x0f18('0x35')]?_0x225abb[_0x0f18('0x34')]:_0x511766[_0x0f18('0x2e')];if(!_0x4e9cc7[_0x0f18('0x2f')][_0x0f18('0x36')](_0x0f18('0x37'))){_0x225abb[_0x0f18('0x1d')]=qs[_0x0f18('0x1d')](_0x4e9cc7[_0x0f18('0x2f')][_0x0f18('0x1d')]);_0x225abb[_0x0f18('0x1c')]=qs[_0x0f18('0x1c')](_0x4e9cc7['query'][_0x0f18('0x1c')]);}_0x225abb[_0x0f18('0x38')]=qs['sort'](_0x4e9cc7['query'][_0x0f18('0x39')]);_0x225abb[_0x0f18('0x3a')]=qs[_0x0f18('0x31')](_['pick'](_0x4e9cc7[_0x0f18('0x2f')],_0x511766[_0x0f18('0x31')]));if(_0x4e9cc7[_0x0f18('0x2f')][_0x0f18('0x3b')]){_0x225abb[_0x0f18('0x3a')]=_[_0x0f18('0x3c')](_0x225abb[_0x0f18('0x3a')],{'$or':_[_0x0f18('0x29')](_0x1ec9be,function(_0x4cab4f){if(_0x4cab4f[_0x0f18('0x2c')]!==_0x0f18('0x3d')){var _0xf2579d={};_0xf2579d[_0x4cab4f[_0x0f18('0x27')]]={'$like':'%'+_0x4e9cc7[_0x0f18('0x2f')][_0x0f18('0x3b')]+'%'};return _0xf2579d;}})});}_0x225abb=_[_0x0f18('0x3c')]({},_0x225abb,_0x4e9cc7[_0x0f18('0x3e')]);var _0x2412fa={'where':_0x225abb['where']};return db[_0x0f18('0x2a')]['count'](_0x2412fa)[_0x0f18('0x23')](function(_0x2409ea){_0x2c095e[_0x0f18('0x1b')]=_0x2409ea;if(_0x4e9cc7['query'][_0x0f18('0x3f')]){_0x225abb[_0x0f18('0x40')]=[{'all':!![]}];}return db['UserProfileResource'][_0x0f18('0x41')](_0x225abb);})[_0x0f18('0x23')](function(_0x2be77d){_0x2c095e[_0x0f18('0x42')]=_0x2be77d;return _0x2c095e;})['then'](respondWithFilteredResult(_0x1863f6,_0x225abb))[_0x0f18('0x43')](handleError(_0x1863f6,null));};exports[_0x0f18('0x44')]=function(_0x3015d2,_0x482a5d){var _0x5f3263={'raw':![],'where':{'id':_0x3015d2['params']['id']}},_0x5d41b4={};_0x5d41b4[_0x0f18('0x2e')]=_[_0x0f18('0x30')](db[_0x0f18('0x2a')]['rawAttributes']);_0x5d41b4[_0x0f18('0x2f')]=_['keys'](_0x3015d2[_0x0f18('0x2f')]);_0x5d41b4[_0x0f18('0x31')]=_[_0x0f18('0x32')](_0x5d41b4[_0x0f18('0x2e')],_0x5d41b4[_0x0f18('0x2f')]);_0x5f3263['attributes']=_[_0x0f18('0x32')](_0x5d41b4[_0x0f18('0x2e')],qs[_0x0f18('0x33')](_0x3015d2[_0x0f18('0x2f')][_0x0f18('0x33')]));_0x5f3263[_0x0f18('0x34')]=_0x5f3263[_0x0f18('0x34')]['length']?_0x5f3263[_0x0f18('0x34')]:_0x5d41b4[_0x0f18('0x2e')];if(_0x3015d2[_0x0f18('0x2f')][_0x0f18('0x3f')]){_0x5f3263[_0x0f18('0x40')]=[{'all':!![]}];}_0x5f3263=_['merge']({},_0x5f3263,_0x3015d2['options']);return db[_0x0f18('0x2a')][_0x0f18('0x45')](_0x5f3263)[_0x0f18('0x23')](handleEntityNotFound(_0x482a5d,null))[_0x0f18('0x23')](respondWithResult(_0x482a5d,null))[_0x0f18('0x43')](handleError(_0x482a5d,null));};exports[_0x0f18('0x46')]=function(_0x38c02d,_0x4cd9b5){return db['UserProfileResource'][_0x0f18('0x46')](_0x38c02d['body'],{})[_0x0f18('0x23')](respondWithResult(_0x4cd9b5,0xc9))[_0x0f18('0x43')](handleError(_0x4cd9b5,null));};exports[_0x0f18('0x47')]=function(_0x39acad,_0x122721){if(_0x39acad[_0x0f18('0x48')]['id']){delete _0x39acad[_0x0f18('0x48')]['id'];}return db[_0x0f18('0x2a')][_0x0f18('0x45')]({'where':{'id':_0x39acad[_0x0f18('0x49')]['id']}})[_0x0f18('0x23')](handleEntityNotFound(_0x122721,null))[_0x0f18('0x23')](saveUpdates(_0x39acad['body'],null))[_0x0f18('0x23')](respondWithResult(_0x122721,null))[_0x0f18('0x43')](handleError(_0x122721,null));};exports[_0x0f18('0x24')]=function(_0x4f4b6b,_0x2261e9){return db[_0x0f18('0x2a')][_0x0f18('0x45')]({'where':{'id':_0x4f4b6b['params']['id']}})[_0x0f18('0x23')](handleEntityNotFound(_0x2261e9,null))['then'](removeEntity(_0x2261e9,null))[_0x0f18('0x43')](handleError(_0x2261e9,null));};exports[_0x0f18('0x4a')]=function(_0x2fad5a,_0x46eba9){return db['UserProfileResource']['describe']()[_0x0f18('0x23')](respondWithResult(_0x46eba9,null))[_0x0f18('0x43')](handleError(_0x46eba9,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 12193d2..954dd9c 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 _0xcae1=['compositeIndex','resourceId','sectionId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','define','UserProfileResource','user_profile_has_resources'];(function(_0x3a4c02,_0x120520){var _0x14b161=function(_0x283b86){while(--_0x283b86){_0x3a4c02['push'](_0x3a4c02['shift']());}};_0x14b161(++_0x120520);}(_0xcae1,0x1d3));var _0x1cae=function(_0x299ecf,_0x5e642b){_0x299ecf=_0x299ecf-0x0;var _0x4813c9=_0xcae1[_0x299ecf];return _0x4813c9;};'use strict';var _=require(_0x1cae('0x0'));var util=require(_0x1cae('0x1'));var logger=require('../../config/logger')(_0x1cae('0x2'));var moment=require(_0x1cae('0x3'));var BPromise=require(_0x1cae('0x4'));var rp=require(_0x1cae('0x5'));var fs=require('fs');var path=require(_0x1cae('0x6'));var rimraf=require(_0x1cae('0x7'));var config=require(_0x1cae('0x8'));var attributes=require(_0x1cae('0x9'));module['exports']=function(_0x49bde4,_0xa43dc7){return _0x49bde4[_0x1cae('0xa')](_0x1cae('0xb'),attributes,{'tableName':_0x1cae('0xc'),'paranoid':![],'indexes':[{'name':_0x1cae('0xd'),'fields':[_0x1cae('0xe'),_0x1cae('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x570d=['sectionId','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','user_profile_has_resources','resourceId'];(function(_0x3eed3f,_0x5253b5){var _0xd68fd8=function(_0x3395c4){while(--_0x3395c4){_0x3eed3f['push'](_0x3eed3f['shift']());}};_0xd68fd8(++_0x5253b5);}(_0x570d,0x143));var _0xd570=function(_0x2e0ce0,_0x1f23eb){_0x2e0ce0=_0x2e0ce0-0x0;var _0x2f3dd7=_0x570d[_0x2e0ce0];return _0x2f3dd7;};'use strict';var _=require(_0xd570('0x0'));var util=require('util');var logger=require(_0xd570('0x1'))(_0xd570('0x2'));var moment=require(_0xd570('0x3'));var BPromise=require(_0xd570('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd570('0x5'));var rimraf=require(_0xd570('0x6'));var config=require(_0xd570('0x7'));var attributes=require(_0xd570('0x8'));module[_0xd570('0x9')]=function(_0x507c95,_0x3160a1){return _0x507c95[_0xd570('0xa')]('UserProfileResource',attributes,{'tableName':_0xd570('0xb'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xd570('0xc'),_0xd570('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index a2573d6..97d334f 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 _0x886f=['message','result','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3a0a5f,_0x8d340b){var _0xf18104=function(_0x5ead79){while(--_0x5ead79){_0x3a0a5f['push'](_0x3a0a5f['shift']());}};_0xf18104(++_0x8d340b);}(_0x886f,0x152));var _0xf886=function(_0x281860,_0x93e585){_0x281860=_0x281860-0x0;var _0x1884bb=_0x886f[_0x281860];return _0x1884bb;};'use strict';var _=require(_0xf886('0x0'));var util=require(_0xf886('0x1'));var moment=require(_0xf886('0x2'));var BPromise=require('bluebird');var rs=require(_0xf886('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf886('0x4'));var logger=require(_0xf886('0x5'))(_0xf886('0x6'));var config=require(_0xf886('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf886('0x8')][_0xf886('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x432357,_0x59f2dd,_0x887e2e){return new BPromise(function(_0x4e5057,_0x3c4601){return client[_0xf886('0xa')](_0x432357,_0x887e2e)[_0xf886('0xb')](function(_0x3ee287){logger[_0xf886('0xc')](_0xf886('0xd'),_0x59f2dd,_0xf886('0xe'));logger[_0xf886('0xf')](_0xf886('0x10'),_0x59f2dd,'request\x20sent',JSON[_0xf886('0x11')](_0x3ee287));if(_0x3ee287[_0xf886('0x12')]){if(_0x3ee287[_0xf886('0x12')]['code']===0x1f4){logger['error'](_0xf886('0xd'),_0x59f2dd,_0x3ee287[_0xf886('0x12')][_0xf886('0x13')]);return _0x3c4601(_0x3ee287[_0xf886('0x12')]['message']);}logger[_0xf886('0x12')](_0xf886('0xd'),_0x59f2dd,_0x3ee287['error'][_0xf886('0x13')]);return _0x4e5057(_0x3ee287[_0xf886('0x12')][_0xf886('0x13')]);}else{logger[_0xf886('0xc')](_0xf886('0xd'),_0x59f2dd,'request\x20sent');_0x4e5057(_0x3ee287[_0xf886('0x14')][_0xf886('0x13')]);}})['catch'](function(_0x4198ec){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x59f2dd,_0x4198ec);_0x3c4601(_0x4198ec);});});} \ No newline at end of file +var _0xbf6f=['jayson/promise','client','request','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xbf6f,0x175));var _0xfbf6=function(_0x522cba,_0x3cb8be){_0x522cba=_0x522cba-0x0;var _0x4a0876=_0xbf6f[_0x522cba];return _0x4a0876;};'use strict';var _=require(_0xfbf6('0x0'));var util=require(_0xfbf6('0x1'));var moment=require(_0xfbf6('0x2'));var BPromise=require(_0xfbf6('0x3'));var rs=require(_0xfbf6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfbf6('0x5'))(_0xfbf6('0x6'));var config=require('../../config/environment');var jayson=require(_0xfbf6('0x7'));var client=jayson[_0xfbf6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45f521,_0x4b6ce7,_0x3cebdc){return new BPromise(function(_0x5cdd71,_0x119600){return client[_0xfbf6('0x9')](_0x45f521,_0x3cebdc)['then'](function(_0x27a659){logger['info'](_0xfbf6('0xa'),_0x4b6ce7,'request\x20sent');logger[_0xfbf6('0xb')](_0xfbf6('0xc'),_0x4b6ce7,_0xfbf6('0xd'),JSON[_0xfbf6('0xe')](_0x27a659));if(_0x27a659[_0xfbf6('0xf')]){if(_0x27a659['error'][_0xfbf6('0x10')]===0x1f4){logger[_0xfbf6('0xf')](_0xfbf6('0xa'),_0x4b6ce7,_0x27a659[_0xfbf6('0xf')][_0xfbf6('0x11')]);return _0x119600(_0x27a659[_0xfbf6('0xf')][_0xfbf6('0x11')]);}logger['error']('UserProfileResource,\x20%s,\x20%s',_0x4b6ce7,_0x27a659['error'][_0xfbf6('0x11')]);return _0x5cdd71(_0x27a659[_0xfbf6('0xf')]['message']);}else{logger[_0xfbf6('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x4b6ce7,_0xfbf6('0xd'));_0x5cdd71(_0x27a659['result']['message']);}})['catch'](function(_0x2d5a89){logger[_0xfbf6('0xf')]('UserProfileResource,\x20%s,\x20%s',_0x4b6ce7,_0x2d5a89);_0x119600(_0x2d5a89);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 40b1ca8..292ca2d 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 _0xdfee=['put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','post'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xdfee,0xa8));var _0xedfe=function(_0x36a8eb,_0xd1888c){_0x36a8eb=_0x36a8eb-0x0;var _0xd38480=_0xdfee[_0x36a8eb];return _0xd38480;};'use strict';var multer=require(_0xedfe('0x0'));var util=require(_0xedfe('0x1'));var path=require(_0xedfe('0x2'));var timeout=require(_0xedfe('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xedfe('0x4'));var interaction=require(_0xedfe('0x5'));var config=require(_0xedfe('0x6'));var controller=require('./userProfileSection.controller');router[_0xedfe('0x7')]('/',auth[_0xedfe('0x8')](),controller[_0xedfe('0x9')]);router[_0xedfe('0x7')](_0xedfe('0xa'),auth[_0xedfe('0x8')](),controller['describe']);router[_0xedfe('0x7')]('/:id',auth[_0xedfe('0x8')](),controller['show']);router[_0xedfe('0xb')]('/',auth[_0xedfe('0x8')](),controller['create']);router[_0xedfe('0xc')](_0xedfe('0xd'),auth[_0xedfe('0x8')](),controller[_0xedfe('0xe')]);router[_0xedfe('0xf')]('/:id',auth[_0xedfe('0x8')](),controller[_0xedfe('0x10')]);module[_0xedfe('0x11')]=router; \ No newline at end of file +var _0x11ab=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update'];(function(_0x2509f1,_0x5c9f8c){var _0x410842=function(_0x1b1eeb){while(--_0x1b1eeb){_0x2509f1['push'](_0x2509f1['shift']());}};_0x410842(++_0x5c9f8c);}(_0x11ab,0xf5));var _0xb11a=function(_0x1c7554,_0x526015){_0x1c7554=_0x1c7554-0x0;var _0xbe335c=_0x11ab[_0x1c7554];return _0xbe335c;};'use strict';var multer=require(_0xb11a('0x0'));var util=require(_0xb11a('0x1'));var path=require(_0xb11a('0x2'));var timeout=require(_0xb11a('0x3'));var express=require(_0xb11a('0x4'));var router=express[_0xb11a('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb11a('0x6'));var config=require(_0xb11a('0x7'));var controller=require(_0xb11a('0x8'));router[_0xb11a('0x9')]('/',auth[_0xb11a('0xa')](),controller[_0xb11a('0xb')]);router[_0xb11a('0x9')](_0xb11a('0xc'),auth[_0xb11a('0xa')](),controller[_0xb11a('0xd')]);router[_0xb11a('0x9')](_0xb11a('0xe'),auth[_0xb11a('0xa')](),controller[_0xb11a('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb11a('0x10')]);router[_0xb11a('0x11')]('/:id',auth[_0xb11a('0xa')](),controller[_0xb11a('0x12')]);router[_0xb11a('0x13')](_0xb11a('0xe'),auth['isAuthenticated'](),controller[_0xb11a('0x14')]);module[_0xb11a('0x15')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 0c20dae..a21d4b5 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 _0xfd7b=['STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','exports'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0xfd7b,0x1df));var _0xbfd7=function(_0x50f392,_0x1d8441){_0x50f392=_0x50f392-0x0;var _0x5926f2=_0xfd7b[_0x50f392];return _0x5926f2;};'use strict';var Sequelize=require('sequelize');module[_0xbfd7('0x0')]={'name':{'type':Sequelize[_0xbfd7('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0xbfd7('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xbfd7('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0xbfd7('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xbfd7('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xbfd7('0x1')],'set':function(_0x221ad1){this[_0xbfd7('0x4')](_0xbfd7('0x5'),_0x221ad1?_0x221ad1[_0xbfd7('0x6')](''):[]);},'get':function(){return this[_0xbfd7('0x7')](_0xbfd7('0x5'))?this['getDataValue'](_0xbfd7('0x5'))['split'](''):[];}}}; \ No newline at end of file +var _0xe920=['sequelize','exports','STRING','INTEGER','BOOLEAN','setDataValue','join','crudPermissions','getDataValue','split'];(function(_0x320c55,_0x43ce58){var _0x42471b=function(_0x4b1777){while(--_0x4b1777){_0x320c55['push'](_0x320c55['shift']());}};_0x42471b(++_0x43ce58);}(_0xe920,0xbe));var _0x0e92=function(_0x52b7b9,_0x43ed4b){_0x52b7b9=_0x52b7b9-0x0;var _0x5b5d30=_0xe920[_0x52b7b9];return _0x5b5d30;};'use strict';var Sequelize=require(_0x0e92('0x0'));module[_0x0e92('0x1')]={'name':{'type':Sequelize[_0x0e92('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x0e92('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x0e92('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x0e92('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x0e92('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x0e92('0x2')],'set':function(_0xfaa87e){this[_0x0e92('0x5')]('crudPermissions',_0xfaa87e?_0xfaa87e[_0x0e92('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0x0e92('0x7'))?this[_0x0e92('0x8')](_0x0e92('0x7'))[_0x0e92('0x9')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 1d1fae4..c8348af 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 _0xc674=['Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','UserProfileSection','fieldName','type','key','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','findAll','rows','params','rawAttributes','include','find','catch','create','body','describe','rimraf','zip-dir','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/logger','api','../../config/utils','sendStatus','status','json','offset','limit','set'];(function(_0x1ac3f9,_0x5f2f2f){var _0x28a739=function(_0x2ff3d0){while(--_0x2ff3d0){_0x1ac3f9['push'](_0x1ac3f9['shift']());}};_0x28a739(++_0x5f2f2f);}(_0xc674,0xc6));var _0x4c67=function(_0x556927,_0x34b53f){_0x556927=_0x556927-0x0;var _0x5f1235=_0xc674[_0x556927];return _0x5f1235;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x4c67('0x0'));var zipdir=require(_0x4c67('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4c67('0x2'));var moment=require(_0x4c67('0x3'));var BPromise=require(_0x4c67('0x4'));var Mustache=require(_0x4c67('0x5'));var util=require(_0x4c67('0x6'));var path=require(_0x4c67('0x7'));var sox=require(_0x4c67('0x8'));var csv=require('to-csv');var ejs=require(_0x4c67('0x9'));var fs=require('fs');var _=require(_0x4c67('0xa'));var squel=require(_0x4c67('0xb'));var crypto=require('crypto');var jsforce=require(_0x4c67('0xc'));var deskjs=require(_0x4c67('0xd'));var toCsv=require(_0x4c67('0xe'));var querystring=require(_0x4c67('0xf'));var Papa=require(_0x4c67('0x10'));var Redis=require(_0x4c67('0x11'));var authService=require(_0x4c67('0x12'));var qs=require(_0x4c67('0x13'));var as=require(_0x4c67('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4c67('0x15'))(_0x4c67('0x16'));var utils=require(_0x4c67('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3042b8,_0x4ffccf){_0x4ffccf=_0x4ffccf||0xcc;return function(_0x496c30){if(_0x496c30){return _0x3042b8[_0x4c67('0x18')](_0x4ffccf);}return _0x3042b8[_0x4c67('0x19')](_0x4ffccf)['end']();};}function respondWithResult(_0x4cd3f6,_0x4290b9){_0x4290b9=_0x4290b9||0xc8;return function(_0x1675e7){if(_0x1675e7){return _0x4cd3f6[_0x4c67('0x19')](_0x4290b9)[_0x4c67('0x1a')](_0x1675e7);}};}function respondWithFilteredResult(_0xb09801,_0x18fe14){return function(_0x38fc59){if(_0x38fc59){var _0x2fc6d2=_0x38fc59['count'],_0x3d4edd=_0x18fe14[_0x4c67('0x1b')],_0x24857d=_0x18fe14['offset']+_0x18fe14[_0x4c67('0x1c')],_0x120141;if(_0x24857d>=_0x2fc6d2){_0x24857d=_0x2fc6d2;_0x120141=0xc8;}else{_0x120141=0xce;}_0xb09801[_0x4c67('0x19')](_0x120141);return _0xb09801[_0x4c67('0x1d')](_0x4c67('0x1e'),_0x3d4edd+'-'+_0x24857d+'/'+_0x2fc6d2)[_0x4c67('0x1a')](_0x38fc59);}return null;};}function patchUpdates(_0x3df371){return function(_0x1b77eb){try{jsonpatch['apply'](_0x1b77eb,_0x3df371,!![]);}catch(_0x4cad92){return BPromise[_0x4c67('0x1f')](_0x4cad92);}return _0x1b77eb['save']();};}function saveUpdates(_0x3fb180,_0x393634){return function(_0x448127){if(_0x448127){return _0x448127[_0x4c67('0x20')](_0x3fb180)[_0x4c67('0x21')](function(_0x87b65d){return _0x87b65d;});}return null;};}function removeEntity(_0x9f735c,_0x29a123){return function(_0x385aea){if(_0x385aea){return _0x385aea[_0x4c67('0x22')]()[_0x4c67('0x21')](function(){_0x9f735c[_0x4c67('0x19')](0xcc)[_0x4c67('0x23')]();});}};}function handleEntityNotFound(_0x1bd434,_0x81dfbe){return function(_0x205109){if(!_0x205109){_0x1bd434[_0x4c67('0x18')](0x194);}return _0x205109;};}function handleError(_0x526ebf,_0x4f51f2){_0x4f51f2=_0x4f51f2||0x1f4;return function(_0x11153d){logger[_0x4c67('0x24')](_0x11153d[_0x4c67('0x25')]);if(_0x11153d[_0x4c67('0x26')]){delete _0x11153d[_0x4c67('0x26')];}_0x526ebf['status'](_0x4f51f2)[_0x4c67('0x27')](_0x11153d);};}exports[_0x4c67('0x28')]=function(_0x208618,_0x7f6948){var _0x3e9a71={},_0x55c92a={},_0x13e586={'count':0x0,'rows':[]};var _0x2fbc5e=_['map'](db[_0x4c67('0x29')]['rawAttributes'],function(_0x17fbac){return{'name':_0x17fbac[_0x4c67('0x2a')],'type':_0x17fbac[_0x4c67('0x2b')][_0x4c67('0x2c')]};});_0x55c92a[_0x4c67('0x2d')]=_[_0x4c67('0x2e')](_0x2fbc5e,_0x4c67('0x26'));_0x55c92a['query']=_[_0x4c67('0x2f')](_0x208618[_0x4c67('0x30')]);_0x55c92a[_0x4c67('0x31')]=_['intersection'](_0x55c92a['model'],_0x55c92a[_0x4c67('0x30')]);_0x3e9a71[_0x4c67('0x32')]=_[_0x4c67('0x33')](_0x55c92a[_0x4c67('0x2d')],qs[_0x4c67('0x34')](_0x208618[_0x4c67('0x30')][_0x4c67('0x34')]));_0x3e9a71[_0x4c67('0x32')]=_0x3e9a71[_0x4c67('0x32')][_0x4c67('0x35')]?_0x3e9a71[_0x4c67('0x32')]:_0x55c92a[_0x4c67('0x2d')];if(!_0x208618[_0x4c67('0x30')][_0x4c67('0x36')](_0x4c67('0x37'))){_0x3e9a71[_0x4c67('0x1c')]=qs[_0x4c67('0x1c')](_0x208618['query'][_0x4c67('0x1c')]);_0x3e9a71[_0x4c67('0x1b')]=qs[_0x4c67('0x1b')](_0x208618[_0x4c67('0x30')][_0x4c67('0x1b')]);}_0x3e9a71[_0x4c67('0x38')]=qs[_0x4c67('0x39')](_0x208618[_0x4c67('0x30')][_0x4c67('0x39')]);_0x3e9a71[_0x4c67('0x3a')]=qs[_0x4c67('0x31')](_[_0x4c67('0x3b')](_0x208618[_0x4c67('0x30')],_0x55c92a[_0x4c67('0x31')]));if(_0x208618['query'][_0x4c67('0x3c')]){_0x3e9a71[_0x4c67('0x3a')]=_['merge'](_0x3e9a71[_0x4c67('0x3a')],{'$or':_[_0x4c67('0x2e')](_0x2fbc5e,function(_0x3cf97c){if(_0x3cf97c[_0x4c67('0x2b')]!==_0x4c67('0x3d')){var _0x91928f={};_0x91928f[_0x3cf97c[_0x4c67('0x26')]]={'$like':'%'+_0x208618[_0x4c67('0x30')][_0x4c67('0x3c')]+'%'};return _0x91928f;}})});}_0x3e9a71=_[_0x4c67('0x3e')]({},_0x3e9a71,_0x208618[_0x4c67('0x3f')]);var _0x44f6b2={'where':_0x3e9a71[_0x4c67('0x3a')]};return db[_0x4c67('0x29')][_0x4c67('0x40')](_0x44f6b2)[_0x4c67('0x21')](function(_0x3c3e3e){_0x13e586[_0x4c67('0x40')]=_0x3c3e3e;if(_0x208618[_0x4c67('0x30')][_0x4c67('0x41')]){_0x3e9a71['include']=[{'all':!![]}];}return db[_0x4c67('0x29')][_0x4c67('0x42')](_0x3e9a71);})['then'](function(_0x1abfd8){_0x13e586[_0x4c67('0x43')]=_0x1abfd8;return _0x13e586;})['then'](respondWithFilteredResult(_0x7f6948,_0x3e9a71))['catch'](handleError(_0x7f6948,null));};exports['show']=function(_0x35b9e1,_0x14a778){var _0x43d57e={'raw':![],'where':{'id':_0x35b9e1[_0x4c67('0x44')]['id']}},_0x1495d2={};_0x1495d2[_0x4c67('0x2d')]=_[_0x4c67('0x2f')](db[_0x4c67('0x29')][_0x4c67('0x45')]);_0x1495d2[_0x4c67('0x30')]=_[_0x4c67('0x2f')](_0x35b9e1[_0x4c67('0x30')]);_0x1495d2['filters']=_[_0x4c67('0x33')](_0x1495d2[_0x4c67('0x2d')],_0x1495d2['query']);_0x43d57e['attributes']=_[_0x4c67('0x33')](_0x1495d2[_0x4c67('0x2d')],qs[_0x4c67('0x34')](_0x35b9e1['query']['fields']));_0x43d57e[_0x4c67('0x32')]=_0x43d57e[_0x4c67('0x32')]['length']?_0x43d57e[_0x4c67('0x32')]:_0x1495d2['model'];if(_0x35b9e1[_0x4c67('0x30')][_0x4c67('0x41')]){_0x43d57e[_0x4c67('0x46')]=[{'all':!![]}];}_0x43d57e=_['merge']({},_0x43d57e,_0x35b9e1[_0x4c67('0x3f')]);return db['UserProfileSection'][_0x4c67('0x47')](_0x43d57e)[_0x4c67('0x21')](handleEntityNotFound(_0x14a778,null))['then'](respondWithResult(_0x14a778,null))[_0x4c67('0x48')](handleError(_0x14a778,null));};exports[_0x4c67('0x49')]=function(_0x11fd5f,_0x11727b){return db['UserProfileSection'][_0x4c67('0x49')](_0x11fd5f[_0x4c67('0x4a')],{})['then'](respondWithResult(_0x11727b,0xc9))[_0x4c67('0x48')](handleError(_0x11727b,null));};exports[_0x4c67('0x20')]=function(_0xc5c17f,_0x1211c3){if(_0xc5c17f[_0x4c67('0x4a')]['id']){delete _0xc5c17f[_0x4c67('0x4a')]['id'];}return db[_0x4c67('0x29')][_0x4c67('0x47')]({'where':{'id':_0xc5c17f[_0x4c67('0x44')]['id']}})['then'](handleEntityNotFound(_0x1211c3,null))[_0x4c67('0x21')](saveUpdates(_0xc5c17f[_0x4c67('0x4a')],null))[_0x4c67('0x21')](respondWithResult(_0x1211c3,null))['catch'](handleError(_0x1211c3,null));};exports[_0x4c67('0x22')]=function(_0x251da7,_0x5bb021){return db[_0x4c67('0x29')][_0x4c67('0x47')]({'where':{'id':_0x251da7[_0x4c67('0x44')]['id']}})['then'](handleEntityNotFound(_0x5bb021,null))[_0x4c67('0x21')](removeEntity(_0x5bb021,null))[_0x4c67('0x48')](handleError(_0x5bb021,null));};exports['describe']=function(_0x4db185,_0x4ff66c){return db['UserProfileSection'][_0x4c67('0x4b')]()['then'](respondWithResult(_0x4ff66c,null))['catch'](handleError(_0x4ff66c,null));}; \ No newline at end of file +var _0x05a0=['send','map','UserProfileSection','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','length','include','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','then','error','stack','name'];(function(_0x585f97,_0x19bc7f){var _0x18e83c=function(_0x4df44d){while(--_0x4df44d){_0x585f97['push'](_0x585f97['shift']());}};_0x18e83c(++_0x19bc7f);}(_0x05a0,0xb5));var _0x005a=function(_0x11e3c3,_0x12dacb){_0x11e3c3=_0x11e3c3-0x0;var _0x232d60=_0x05a0[_0x11e3c3];return _0x232d60;};'use strict';var pdf=require(_0x005a('0x0'));var emlformat=require(_0x005a('0x1'));var rimraf=require(_0x005a('0x2'));var zipdir=require(_0x005a('0x3'));var jsonpatch=require(_0x005a('0x4'));var rp=require(_0x005a('0x5'));var moment=require('moment');var BPromise=require(_0x005a('0x6'));var Mustache=require(_0x005a('0x7'));var util=require('util');var path=require('path');var sox=require(_0x005a('0x8'));var csv=require(_0x005a('0x9'));var ejs=require(_0x005a('0xa'));var fs=require('fs');var _=require(_0x005a('0xb'));var squel=require(_0x005a('0xc'));var crypto=require(_0x005a('0xd'));var jsforce=require(_0x005a('0xe'));var deskjs=require(_0x005a('0xf'));var toCsv=require(_0x005a('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x005a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x005a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x005a('0x12'))(_0x005a('0x13'));var utils=require(_0x005a('0x14'));var config=require(_0x005a('0x15'));var db=require(_0x005a('0x16'))['db'];function respondWithStatusCode(_0x41c755,_0x245b1d){_0x245b1d=_0x245b1d||0xcc;return function(_0x12d374){if(_0x12d374){return _0x41c755[_0x005a('0x17')](_0x245b1d);}return _0x41c755[_0x005a('0x18')](_0x245b1d)[_0x005a('0x19')]();};}function respondWithResult(_0x167ef2,_0x2cdbb9){_0x2cdbb9=_0x2cdbb9||0xc8;return function(_0x2684a5){if(_0x2684a5){return _0x167ef2[_0x005a('0x18')](_0x2cdbb9)[_0x005a('0x1a')](_0x2684a5);}};}function respondWithFilteredResult(_0x248061,_0xe23c30){return function(_0x39fbdf){if(_0x39fbdf){var _0x25dc00=_0x39fbdf['count'],_0x5e9d8a=_0xe23c30[_0x005a('0x1b')],_0x174866=_0xe23c30['offset']+_0xe23c30[_0x005a('0x1c')],_0x123b08;if(_0x174866>=_0x25dc00){_0x174866=_0x25dc00;_0x123b08=0xc8;}else{_0x123b08=0xce;}_0x248061[_0x005a('0x18')](_0x123b08);return _0x248061[_0x005a('0x1d')](_0x005a('0x1e'),_0x5e9d8a+'-'+_0x174866+'/'+_0x25dc00)['json'](_0x39fbdf);}return null;};}function patchUpdates(_0x23c439){return function(_0x376bf9){try{jsonpatch['apply'](_0x376bf9,_0x23c439,!![]);}catch(_0x487cc2){return BPromise[_0x005a('0x1f')](_0x487cc2);}return _0x376bf9[_0x005a('0x20')]();};}function saveUpdates(_0xa5a6b,_0x3b7577){return function(_0x4c09c5){if(_0x4c09c5){return _0x4c09c5[_0x005a('0x21')](_0xa5a6b)[_0x005a('0x22')](function(_0x169f7f){return _0x169f7f;});}return null;};}function removeEntity(_0x262dff,_0x204d44){return function(_0x5156d2){if(_0x5156d2){return _0x5156d2['destroy']()[_0x005a('0x22')](function(){_0x262dff[_0x005a('0x18')](0xcc)[_0x005a('0x19')]();});}};}function handleEntityNotFound(_0xf5143,_0x5d512c){return function(_0x395ff6){if(!_0x395ff6){_0xf5143[_0x005a('0x17')](0x194);}return _0x395ff6;};}function handleError(_0x31e3e0,_0x36ab20){_0x36ab20=_0x36ab20||0x1f4;return function(_0x4ca46f){logger[_0x005a('0x23')](_0x4ca46f[_0x005a('0x24')]);if(_0x4ca46f[_0x005a('0x25')]){delete _0x4ca46f[_0x005a('0x25')];}_0x31e3e0[_0x005a('0x18')](_0x36ab20)[_0x005a('0x26')](_0x4ca46f);};}exports['index']=function(_0x4a22e3,_0x54b7f4){var _0x40ef35={},_0xbc3a47={},_0xb6dcf0={'count':0x0,'rows':[]};var _0x2df0c0=_[_0x005a('0x27')](db[_0x005a('0x28')]['rawAttributes'],function(_0xc77c7c){return{'name':_0xc77c7c[_0x005a('0x29')],'type':_0xc77c7c[_0x005a('0x2a')][_0x005a('0x2b')]};});_0xbc3a47[_0x005a('0x2c')]=_[_0x005a('0x27')](_0x2df0c0,_0x005a('0x25'));_0xbc3a47[_0x005a('0x2d')]=_['keys'](_0x4a22e3[_0x005a('0x2d')]);_0xbc3a47['filters']=_[_0x005a('0x2e')](_0xbc3a47[_0x005a('0x2c')],_0xbc3a47[_0x005a('0x2d')]);_0x40ef35['attributes']=_[_0x005a('0x2e')](_0xbc3a47['model'],qs[_0x005a('0x2f')](_0x4a22e3[_0x005a('0x2d')][_0x005a('0x2f')]));_0x40ef35[_0x005a('0x30')]=_0x40ef35[_0x005a('0x30')]['length']?_0x40ef35['attributes']:_0xbc3a47['model'];if(!_0x4a22e3[_0x005a('0x2d')][_0x005a('0x31')]('nolimit')){_0x40ef35['limit']=qs[_0x005a('0x1c')](_0x4a22e3[_0x005a('0x2d')][_0x005a('0x1c')]);_0x40ef35[_0x005a('0x1b')]=qs[_0x005a('0x1b')](_0x4a22e3[_0x005a('0x2d')][_0x005a('0x1b')]);}_0x40ef35[_0x005a('0x32')]=qs[_0x005a('0x33')](_0x4a22e3[_0x005a('0x2d')][_0x005a('0x33')]);_0x40ef35[_0x005a('0x34')]=qs[_0x005a('0x35')](_[_0x005a('0x36')](_0x4a22e3[_0x005a('0x2d')],_0xbc3a47[_0x005a('0x35')]));if(_0x4a22e3[_0x005a('0x2d')][_0x005a('0x37')]){_0x40ef35[_0x005a('0x34')]=_[_0x005a('0x38')](_0x40ef35[_0x005a('0x34')],{'$or':_[_0x005a('0x27')](_0x2df0c0,function(_0x551f94){if(_0x551f94[_0x005a('0x2a')]!==_0x005a('0x39')){var _0x2c6b07={};_0x2c6b07[_0x551f94[_0x005a('0x25')]]={'$like':'%'+_0x4a22e3[_0x005a('0x2d')][_0x005a('0x37')]+'%'};return _0x2c6b07;}})});}_0x40ef35=_[_0x005a('0x38')]({},_0x40ef35,_0x4a22e3[_0x005a('0x3a')]);var _0x28c657={'where':_0x40ef35[_0x005a('0x34')]};return db['UserProfileSection']['count'](_0x28c657)['then'](function(_0x349847){_0xb6dcf0['count']=_0x349847;if(_0x4a22e3['query'][_0x005a('0x3b')]){_0x40ef35['include']=[{'all':!![]}];}return db[_0x005a('0x28')][_0x005a('0x3c')](_0x40ef35);})[_0x005a('0x22')](function(_0x74e86f){_0xb6dcf0[_0x005a('0x3d')]=_0x74e86f;return _0xb6dcf0;})[_0x005a('0x22')](respondWithFilteredResult(_0x54b7f4,_0x40ef35))[_0x005a('0x3e')](handleError(_0x54b7f4,null));};exports[_0x005a('0x3f')]=function(_0x39ad73,_0x3af6d6){var _0x2f1386={'raw':![],'where':{'id':_0x39ad73[_0x005a('0x40')]['id']}},_0x4acd8a={};_0x4acd8a[_0x005a('0x2c')]=_[_0x005a('0x41')](db[_0x005a('0x28')]['rawAttributes']);_0x4acd8a[_0x005a('0x2d')]=_['keys'](_0x39ad73['query']);_0x4acd8a[_0x005a('0x35')]=_[_0x005a('0x2e')](_0x4acd8a[_0x005a('0x2c')],_0x4acd8a[_0x005a('0x2d')]);_0x2f1386[_0x005a('0x30')]=_['intersection'](_0x4acd8a[_0x005a('0x2c')],qs[_0x005a('0x2f')](_0x39ad73[_0x005a('0x2d')][_0x005a('0x2f')]));_0x2f1386[_0x005a('0x30')]=_0x2f1386['attributes'][_0x005a('0x42')]?_0x2f1386['attributes']:_0x4acd8a[_0x005a('0x2c')];if(_0x39ad73[_0x005a('0x2d')]['includeAll']){_0x2f1386[_0x005a('0x43')]=[{'all':!![]}];}_0x2f1386=_[_0x005a('0x38')]({},_0x2f1386,_0x39ad73[_0x005a('0x3a')]);return db[_0x005a('0x28')][_0x005a('0x44')](_0x2f1386)[_0x005a('0x22')](handleEntityNotFound(_0x3af6d6,null))[_0x005a('0x22')](respondWithResult(_0x3af6d6,null))[_0x005a('0x3e')](handleError(_0x3af6d6,null));};exports[_0x005a('0x45')]=function(_0x45500d,_0x244920){return db[_0x005a('0x28')][_0x005a('0x45')](_0x45500d[_0x005a('0x46')],{})[_0x005a('0x22')](respondWithResult(_0x244920,0xc9))[_0x005a('0x3e')](handleError(_0x244920,null));};exports[_0x005a('0x21')]=function(_0x4c10e4,_0x2adcee){if(_0x4c10e4[_0x005a('0x46')]['id']){delete _0x4c10e4[_0x005a('0x46')]['id'];}return db[_0x005a('0x28')][_0x005a('0x44')]({'where':{'id':_0x4c10e4[_0x005a('0x40')]['id']}})['then'](handleEntityNotFound(_0x2adcee,null))[_0x005a('0x22')](saveUpdates(_0x4c10e4['body'],null))[_0x005a('0x22')](respondWithResult(_0x2adcee,null))[_0x005a('0x3e')](handleError(_0x2adcee,null));};exports[_0x005a('0x47')]=function(_0xf00122,_0x6d4f80){return db[_0x005a('0x28')][_0x005a('0x44')]({'where':{'id':_0xf00122['params']['id']}})[_0x005a('0x22')](handleEntityNotFound(_0x6d4f80,null))[_0x005a('0x22')](removeEntity(_0x6d4f80,null))[_0x005a('0x3e')](handleError(_0x6d4f80,null));};exports[_0x005a('0x48')]=function(_0x4de8ab,_0x2c5979){return db['UserProfileSection']['describe']()['then'](respondWithResult(_0x2c5979,null))['catch'](handleError(_0x2c5979,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index b1aa2dc..afbc4a8 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 _0x101a=['rimraf','exports','UserProfileSection','compositeIndex','sectionId','userProfileId','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1ede6d,_0x382a0e){var _0x569d20=function(_0x3188a9){while(--_0x3188a9){_0x1ede6d['push'](_0x1ede6d['shift']());}};_0x569d20(++_0x382a0e);}(_0x101a,0x11a));var _0xa101=function(_0x4c5b0e,_0x513ecc){_0x4c5b0e=_0x4c5b0e-0x0;var _0x1c8d55=_0x101a[_0x4c5b0e];return _0x1c8d55;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa101('0x0'))(_0xa101('0x1'));var moment=require(_0xa101('0x2'));var BPromise=require(_0xa101('0x3'));var rp=require(_0xa101('0x4'));var fs=require('fs');var path=require(_0xa101('0x5'));var rimraf=require(_0xa101('0x6'));var config=require('../../config/environment');var attributes=require('./userProfileSection.attributes');module[_0xa101('0x7')]=function(_0x298894,_0x3e791c){return _0x298894['define'](_0xa101('0x8'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0xa101('0x9'),'fields':[_0xa101('0xa'),_0xa101('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4e5a=['../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','userProfileId','lodash','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x55fd40,_0x225b77){var _0x7979f1=function(_0x1d21c1){while(--_0x1d21c1){_0x55fd40['push'](_0x55fd40['shift']());}};_0x7979f1(++_0x225b77);}(_0x4e5a,0x143));var _0xa4e5=function(_0x1c33dc,_0x177c7e){_0x1c33dc=_0x1c33dc-0x0;var _0x405580=_0x4e5a[_0x1c33dc];return _0x405580;};'use strict';var _=require(_0xa4e5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa4e5('0x1'));var moment=require(_0xa4e5('0x2'));var BPromise=require(_0xa4e5('0x3'));var rp=require(_0xa4e5('0x4'));var fs=require('fs');var path=require(_0xa4e5('0x5'));var rimraf=require(_0xa4e5('0x6'));var config=require(_0xa4e5('0x7'));var attributes=require(_0xa4e5('0x8'));module[_0xa4e5('0x9')]=function(_0x334291,_0x39799b){return _0x334291[_0xa4e5('0xa')](_0xa4e5('0xb'),attributes,{'tableName':_0xa4e5('0xc'),'paranoid':![],'indexes':[{'name':_0xa4e5('0xd'),'fields':['sectionId',_0xa4e5('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index cc4e1ff..bc0cc55 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 _0x82d8=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','code','UserProfileSection,\x20%s,\x20%s','message','result','catch','util','moment'];(function(_0x154983,_0xc29edf){var _0x3d1243=function(_0x5cb7a4){while(--_0x5cb7a4){_0x154983['push'](_0x154983['shift']());}};_0x3d1243(++_0xc29edf);}(_0x82d8,0x16e));var _0x882d=function(_0x255554,_0x1183fc){_0x255554=_0x255554-0x0;var _0x13165a=_0x82d8[_0x255554];return _0x13165a;};'use strict';var _=require('lodash');var util=require(_0x882d('0x0'));var moment=require(_0x882d('0x1'));var BPromise=require(_0x882d('0x2'));var rs=require(_0x882d('0x3'));var fs=require('fs');var Redis=require(_0x882d('0x4'));var db=require(_0x882d('0x5'))['db'];var utils=require(_0x882d('0x6'));var logger=require('../../config/logger')(_0x882d('0x7'));var config=require(_0x882d('0x8'));var jayson=require(_0x882d('0x9'));var client=jayson[_0x882d('0xa')][_0x882d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3de68e,_0x2a7df8,_0x1f62a9){return new BPromise(function(_0x144208,_0x230613){return client[_0x882d('0xc')](_0x3de68e,_0x1f62a9)[_0x882d('0xd')](function(_0x19ee22){logger[_0x882d('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x2a7df8,_0x882d('0xf'));logger[_0x882d('0x10')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x2a7df8,_0x882d('0xf'),JSON['stringify'](_0x19ee22));if(_0x19ee22['error']){if(_0x19ee22[_0x882d('0x11')][_0x882d('0x12')]===0x1f4){logger[_0x882d('0x11')](_0x882d('0x13'),_0x2a7df8,_0x19ee22['error'][_0x882d('0x14')]);return _0x230613(_0x19ee22['error'][_0x882d('0x14')]);}logger[_0x882d('0x11')](_0x882d('0x13'),_0x2a7df8,_0x19ee22['error'][_0x882d('0x14')]);return _0x144208(_0x19ee22['error'][_0x882d('0x14')]);}else{logger['info'](_0x882d('0x13'),_0x2a7df8,'request\x20sent');_0x144208(_0x19ee22[_0x882d('0x15')]['message']);}})[_0x882d('0x16')](function(_0xa91595){logger[_0x882d('0x11')](_0x882d('0x13'),_0x2a7df8,_0xa91595);_0x230613(_0xa91595);});});} \ No newline at end of file +var _0xf338=['error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','code'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xf338,0x87));var _0x8f33=function(_0x406a7f,_0x26fafc){_0x406a7f=_0x406a7f-0x0;var _0x2d0e8f=_0xf338[_0x406a7f];return _0x2d0e8f;};'use strict';var _=require(_0x8f33('0x0'));var util=require(_0x8f33('0x1'));var moment=require(_0x8f33('0x2'));var BPromise=require(_0x8f33('0x3'));var rs=require(_0x8f33('0x4'));var fs=require('fs');var Redis=require(_0x8f33('0x5'));var db=require(_0x8f33('0x6'))['db'];var utils=require(_0x8f33('0x7'));var logger=require(_0x8f33('0x8'))(_0x8f33('0x9'));var config=require('../../config/environment');var jayson=require(_0x8f33('0xa'));var client=jayson[_0x8f33('0xb')][_0x8f33('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4f86d4,_0x1da6de,_0x5b31fc){return new BPromise(function(_0x579e37,_0x4effcf){return client['request'](_0x4f86d4,_0x5b31fc)['then'](function(_0x16b767){logger[_0x8f33('0xd')](_0x8f33('0xe'),_0x1da6de,_0x8f33('0xf'));logger[_0x8f33('0x10')](_0x8f33('0x11'),_0x1da6de,_0x8f33('0xf'),JSON['stringify'](_0x16b767));if(_0x16b767['error']){if(_0x16b767['error'][_0x8f33('0x12')]===0x1f4){logger[_0x8f33('0x13')](_0x8f33('0xe'),_0x1da6de,_0x16b767['error'][_0x8f33('0x14')]);return _0x4effcf(_0x16b767['error'][_0x8f33('0x14')]);}logger[_0x8f33('0x13')]('UserProfileSection,\x20%s,\x20%s',_0x1da6de,_0x16b767[_0x8f33('0x13')][_0x8f33('0x14')]);return _0x579e37(_0x16b767[_0x8f33('0x13')][_0x8f33('0x14')]);}else{logger['info'](_0x8f33('0xe'),_0x1da6de,_0x8f33('0xf'));_0x579e37(_0x16b767[_0x8f33('0x15')][_0x8f33('0x14')]);}})['catch'](function(_0x25a38d){logger[_0x8f33('0x13')]('UserProfileSection,\x20%s,\x20%s',_0x1da6de,_0x25a38d);_0x4effcf(_0x25a38d);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index f6b7854..36815e9 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 _0x1e46=['connect-timeout','Router','../../components/interaction/service','../../config/environment','exports','util','path'];(function(_0x519a04,_0x38408e){var _0x210a84=function(_0x2158f3){while(--_0x2158f3){_0x519a04['push'](_0x519a04['shift']());}};_0x210a84(++_0x38408e);}(_0x1e46,0x75));var _0x61e4=function(_0x211f9a,_0x67a371){_0x211f9a=_0x211f9a-0x0;var _0x4e2fb8=_0x1e46[_0x211f9a];return _0x4e2fb8;};'use strict';var multer=require('multer');var util=require(_0x61e4('0x0'));var path=require(_0x61e4('0x1'));var timeout=require(_0x61e4('0x2'));var express=require('express');var router=express[_0x61e4('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x61e4('0x4'));var config=require(_0x61e4('0x5'));module[_0x61e4('0x6')]=router; \ No newline at end of file +var _0x98f8=['../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x38bca5,_0x5992a0){var _0x33001c=function(_0x55389f){while(--_0x55389f){_0x38bca5['push'](_0x38bca5['shift']());}};_0x33001c(++_0x5992a0);}(_0x98f8,0x111));var _0x898f=function(_0x58e420,_0x4b9bea){_0x58e420=_0x58e420-0x0;var _0x4e1432=_0x98f8[_0x58e420];return _0x4e1432;};'use strict';var multer=require(_0x898f('0x0'));var util=require(_0x898f('0x1'));var path=require(_0x898f('0x2'));var timeout=require(_0x898f('0x3'));var express=require(_0x898f('0x4'));var router=express[_0x898f('0x5')]();var auth=require(_0x898f('0x6'));var interaction=require(_0x898f('0x7'));var config=require(_0x898f('0x8'));module[_0x898f('0x9')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index de55800..c90bf79 100644 --- a/server/api/userSmsQueue/userSmsQueue.attributes.js +++ b/server/api/userSmsQueue/userSmsQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['INTEGER','sequelize','exports'];(function(_0x1af746,_0x23d173){var _0x13c883=function(_0x2246fb){while(--_0x2246fb){_0x1af746['push'](_0x1af746['shift']());}};_0x13c883(++_0x23d173);}(_0xe706,0xa3));var _0x6e70=function(_0x508abe,_0x37d20c){_0x508abe=_0x508abe-0x0;var _0x23d357=_0xe706[_0x508abe];return _0x23d357;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x1cd1b4,_0x367e20){var _0x170d0f=function(_0x441f21){while(--_0x441f21){_0x1cd1b4['push'](_0x1cd1b4['shift']());}};_0x170d0f(++_0x367e20);}(_0xe706,0xa3));var _0x6e70=function(_0x4c912e,_0x27299d){_0x4c912e=_0x4c912e-0x0;var _0x2fa424=_0xe706[_0x4c912e];return _0x2fa424;};'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 93974b8..c720746 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 _0xca68=['lodash','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./userSmsQueue.attributes','define','UserSmsQueue','user_has_sms_queues'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xca68,0x1b8));var _0x8ca6=function(_0x43a5ac,_0x4b70ec){_0x43a5ac=_0x43a5ac-0x0;var _0x3707b6=_0xca68[_0x43a5ac];return _0x3707b6;};'use strict';var _=require(_0x8ca6('0x0'));var util=require('util');var logger=require(_0x8ca6('0x1'))('api');var moment=require('moment');var BPromise=require(_0x8ca6('0x2'));var rp=require(_0x8ca6('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8ca6('0x4'));var config=require(_0x8ca6('0x5'));var attributes=require(_0x8ca6('0x6'));module['exports']=function(_0x188111,_0x4949d1){return _0x188111[_0x8ca6('0x7')](_0x8ca6('0x8'),attributes,{'tableName':_0x8ca6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3bfe=['request-promise','path','rimraf','../../config/environment','exports','define','UserSmsQueue','user_has_sms_queues','lodash','moment','bluebird'];(function(_0x24b955,_0x2f1211){var _0x590b1a=function(_0x5181e7){while(--_0x5181e7){_0x24b955['push'](_0x24b955['shift']());}};_0x590b1a(++_0x2f1211);}(_0x3bfe,0xce));var _0xe3bf=function(_0x44c0c2,_0x29d866){_0x44c0c2=_0x44c0c2-0x0;var _0x5b2eb8=_0x3bfe[_0x44c0c2];return _0x5b2eb8;};'use strict';var _=require(_0xe3bf('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xe3bf('0x1'));var BPromise=require(_0xe3bf('0x2'));var rp=require(_0xe3bf('0x3'));var fs=require('fs');var path=require(_0xe3bf('0x4'));var rimraf=require(_0xe3bf('0x5'));var config=require(_0xe3bf('0x6'));var attributes=require('./userSmsQueue.attributes');module[_0xe3bf('0x7')]=function(_0x2dea21,_0x4de65a){return _0x2dea21[_0xe3bf('0x8')](_0xe3bf('0x9'),attributes,{'tableName':_0xe3bf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 12cc9de..8c046fd 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 _0x5c9c=['error','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s'];(function(_0x429a0f,_0x19b709){var _0x3b4d45=function(_0x5ef991){while(--_0x5ef991){_0x429a0f['push'](_0x429a0f['shift']());}};_0x3b4d45(++_0x19b709);}(_0x5c9c,0xf6));var _0xc5c9=function(_0x427410,_0x56756d){_0x427410=_0x427410-0x0;var _0x411b9b=_0x5c9c[_0x427410];return _0x411b9b;};'use strict';var _=require(_0xc5c9('0x0'));var util=require(_0xc5c9('0x1'));var moment=require(_0xc5c9('0x2'));var BPromise=require(_0xc5c9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc5c9('0x4'))['db'];var utils=require(_0xc5c9('0x5'));var logger=require('../../config/logger')(_0xc5c9('0x6'));var config=require(_0xc5c9('0x7'));var jayson=require(_0xc5c9('0x8'));var client=jayson[_0xc5c9('0x9')][_0xc5c9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x205b10,_0xa0d357,_0x9c0352){return new BPromise(function(_0x3ad5bf,_0x113e94){return client[_0xc5c9('0xb')](_0x205b10,_0x9c0352)[_0xc5c9('0xc')](function(_0xbdfdb2){logger[_0xc5c9('0xd')](_0xc5c9('0xe'),_0xa0d357,_0xc5c9('0xf'));logger[_0xc5c9('0x10')](_0xc5c9('0x11'),_0xa0d357,_0xc5c9('0xf'),JSON['stringify'](_0xbdfdb2));if(_0xbdfdb2[_0xc5c9('0x12')]){if(_0xbdfdb2['error']['code']===0x1f4){logger[_0xc5c9('0x12')](_0xc5c9('0xe'),_0xa0d357,_0xbdfdb2['error'][_0xc5c9('0x13')]);return _0x113e94(_0xbdfdb2[_0xc5c9('0x12')][_0xc5c9('0x13')]);}logger['error'](_0xc5c9('0xe'),_0xa0d357,_0xbdfdb2['error'][_0xc5c9('0x13')]);return _0x3ad5bf(_0xbdfdb2[_0xc5c9('0x12')][_0xc5c9('0x13')]);}else{logger[_0xc5c9('0xd')](_0xc5c9('0xe'),_0xa0d357,_0xc5c9('0xf'));_0x3ad5bf(_0xbdfdb2[_0xc5c9('0x14')]['message']);}})[_0xc5c9('0x15')](function(_0xdaad28){logger[_0xc5c9('0x12')](_0xc5c9('0xe'),_0xa0d357,_0xdaad28);_0x113e94(_0xdaad28);});});} \ No newline at end of file +var _0xd51c=['result','catch','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','UserSmsQueue,\x20%s,\x20%s'];(function(_0x31c742,_0x42d706){var _0x1570be=function(_0x1efe1b){while(--_0x1efe1b){_0x31c742['push'](_0x31c742['shift']());}};_0x1570be(++_0x42d706);}(_0xd51c,0x12e));var _0xcd51=function(_0x538052,_0x5ee581){_0x538052=_0x538052-0x0;var _0xb32d32=_0xd51c[_0x538052];return _0xb32d32;};'use strict';var _=require('lodash');var util=require(_0xcd51('0x0'));var moment=require(_0xcd51('0x1'));var BPromise=require(_0xcd51('0x2'));var rs=require(_0xcd51('0x3'));var fs=require('fs');var Redis=require(_0xcd51('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcd51('0x5'));var config=require(_0xcd51('0x6'));var jayson=require(_0xcd51('0x7'));var client=jayson[_0xcd51('0x8')][_0xcd51('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b10b3,_0x73626e,_0x345375){return new BPromise(function(_0x1dab0e,_0x1c049d){return client[_0xcd51('0xa')](_0x2b10b3,_0x345375)['then'](function(_0x4335f6){logger[_0xcd51('0xb')]('UserSmsQueue,\x20%s,\x20%s',_0x73626e,'request\x20sent');logger[_0xcd51('0xc')](_0xcd51('0xd'),_0x73626e,'request\x20sent',JSON[_0xcd51('0xe')](_0x4335f6));if(_0x4335f6[_0xcd51('0xf')]){if(_0x4335f6[_0xcd51('0xf')]['code']===0x1f4){logger[_0xcd51('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x73626e,_0x4335f6[_0xcd51('0xf')][_0xcd51('0x10')]);return _0x1c049d(_0x4335f6[_0xcd51('0xf')]['message']);}logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x73626e,_0x4335f6[_0xcd51('0xf')]['message']);return _0x1dab0e(_0x4335f6['error']['message']);}else{logger[_0xcd51('0xb')](_0xcd51('0x11'),_0x73626e,'request\x20sent');_0x1dab0e(_0x4335f6[_0xcd51('0x12')]['message']);}})[_0xcd51('0x13')](function(_0x5c3202){logger['error'](_0xcd51('0x11'),_0x73626e,_0x5c3202);_0x1c049d(_0x5c3202);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 6dd8e35..1436b15 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 _0x4293=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','express'];(function(_0x5a2927,_0x58e4f0){var _0x5be216=function(_0x243228){while(--_0x243228){_0x5a2927['push'](_0x5a2927['shift']());}};_0x5be216(++_0x58e4f0);}(_0x4293,0x140));var _0x3429=function(_0x4f39ca,_0x59101c){_0x4f39ca=_0x4f39ca-0x0;var _0x5475ab=_0x4293[_0x4f39ca];return _0x5475ab;};'use strict';var multer=require(_0x3429('0x0'));var util=require(_0x3429('0x1'));var path=require(_0x3429('0x2'));var timeout=require('connect-timeout');var express=require(_0x3429('0x3'));var router=express[_0x3429('0x4')]();var auth=require(_0x3429('0x5'));var interaction=require(_0x3429('0x6'));var config=require(_0x3429('0x7'));module[_0x3429('0x8')]=router; \ No newline at end of file +var _0x6923=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','util','path','connect-timeout'];(function(_0x55af36,_0x1b4c04){var _0x25d888=function(_0x284b9f){while(--_0x284b9f){_0x55af36['push'](_0x55af36['shift']());}};_0x25d888(++_0x1b4c04);}(_0x6923,0x165));var _0x3692=function(_0x5dea7d,_0x23364a){_0x5dea7d=_0x5dea7d-0x0;var _0xd904eb=_0x6923[_0x5dea7d];return _0xd904eb;};'use strict';var multer=require('multer');var util=require(_0x3692('0x0'));var path=require(_0x3692('0x1'));var timeout=require(_0x3692('0x2'));var express=require(_0x3692('0x3'));var router=express[_0x3692('0x4')]();var auth=require(_0x3692('0x5'));var interaction=require(_0x3692('0x6'));var config=require(_0x3692('0x7'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index f0001b0..0581a56 100644 --- a/server/api/userVoiceQueue/userVoiceQueue.attributes.js +++ b/server/api/userVoiceQueue/userVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['exports','INTEGER'];(function(_0x507c81,_0x3e1b56){var _0x368a25=function(_0x1e7519){while(--_0x1e7519){_0x507c81['push'](_0x507c81['shift']());}};_0x368a25(++_0x3e1b56);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x2bc400,_0x27208f){var _0x36ab53=function(_0x257660){while(--_0x257660){_0x2bc400['push'](_0x2bc400['shift']());}};_0x36ab53(++_0x27208f);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 2cd943b..dacefa5 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 _0xb821=['rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','util','../../config/logger','bluebird'];(function(_0x12af5b,_0x5b29d0){var _0x19eaf1=function(_0x285c88){while(--_0x285c88){_0x12af5b['push'](_0x12af5b['shift']());}};_0x19eaf1(++_0x5b29d0);}(_0xb821,0xa7));var _0x1b82=function(_0x401167,_0x388bfa){_0x401167=_0x401167-0x0;var _0x2a8dd6=_0xb821[_0x401167];return _0x2a8dd6;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var logger=require(_0x1b82('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1b82('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1b82('0x3'));var config=require(_0x1b82('0x4'));var attributes=require(_0x1b82('0x5'));module[_0x1b82('0x6')]=function(_0x597ca7,_0x3e27c4){return _0x597ca7[_0x1b82('0x7')](_0x1b82('0x8'),attributes,{'tableName':_0x1b82('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xadb8=['UserVoiceQueue','user_has_voice_queues','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','define'];(function(_0xe03bdc,_0x2cda10){var _0x27cf91=function(_0x127cf2){while(--_0x127cf2){_0xe03bdc['push'](_0xe03bdc['shift']());}};_0x27cf91(++_0x2cda10);}(_0xadb8,0x1d0));var _0x8adb=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xadb8[_0x13e741];return _0x3f8bb3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8adb('0x0'))('api');var moment=require(_0x8adb('0x1'));var BPromise=require(_0x8adb('0x2'));var rp=require(_0x8adb('0x3'));var fs=require('fs');var path=require(_0x8adb('0x4'));var rimraf=require(_0x8adb('0x5'));var config=require(_0x8adb('0x6'));var attributes=require(_0x8adb('0x7'));module['exports']=function(_0x15bc63,_0x1a5f36){return _0x15bc63[_0x8adb('0x8')](_0x8adb('0x9'),attributes,{'tableName':_0x8adb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 5e05614..510478c 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 _0xb3c2=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserVoiceQueue,\x20%s,\x20%s','result','catch'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0xb3c2,0x78));var _0x2b3c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb3c2[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x2b3c('0x0'));var util=require('util');var moment=require(_0x2b3c('0x1'));var BPromise=require(_0x2b3c('0x2'));var rs=require(_0x2b3c('0x3'));var fs=require('fs');var Redis=require(_0x2b3c('0x4'));var db=require(_0x2b3c('0x5'))['db'];var utils=require(_0x2b3c('0x6'));var logger=require(_0x2b3c('0x7'))(_0x2b3c('0x8'));var config=require('../../config/environment');var jayson=require(_0x2b3c('0x9'));var client=jayson[_0x2b3c('0xa')][_0x2b3c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4cfe89,_0x40be27,_0x4e71cd){return new BPromise(function(_0x2e7d7f,_0x5568cd){return client['request'](_0x4cfe89,_0x4e71cd)[_0x2b3c('0xc')](function(_0x340f03){logger[_0x2b3c('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x40be27,_0x2b3c('0xe'));logger[_0x2b3c('0xf')](_0x2b3c('0x10'),_0x40be27,_0x2b3c('0xe'),JSON[_0x2b3c('0x11')](_0x340f03));if(_0x340f03['error']){if(_0x340f03[_0x2b3c('0x12')][_0x2b3c('0x13')]===0x1f4){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x40be27,_0x340f03[_0x2b3c('0x12')][_0x2b3c('0x14')]);return _0x5568cd(_0x340f03[_0x2b3c('0x12')][_0x2b3c('0x14')]);}logger[_0x2b3c('0x12')](_0x2b3c('0x15'),_0x40be27,_0x340f03[_0x2b3c('0x12')][_0x2b3c('0x14')]);return _0x2e7d7f(_0x340f03[_0x2b3c('0x12')]['message']);}else{logger['info'](_0x2b3c('0x15'),_0x40be27,_0x2b3c('0xe'));_0x2e7d7f(_0x340f03[_0x2b3c('0x16')][_0x2b3c('0x14')]);}})[_0x2b3c('0x17')](function(_0x2a3308){logger['error'](_0x2b3c('0x15'),_0x40be27,_0x2a3308);_0x5568cd(_0x2a3308);});});} \ No newline at end of file +var _0xea5b=['lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch'];(function(_0x42696e,_0x11aa1c){var _0x4bab20=function(_0x136ec1){while(--_0x136ec1){_0x42696e['push'](_0x42696e['shift']());}};_0x4bab20(++_0x11aa1c);}(_0xea5b,0x1b9));var _0xbea5=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xea5b[_0x36884e];return _0x1cc367;};'use strict';var _=require(_0xbea5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xbea5('0x1'));var rs=require(_0xbea5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbea5('0x3'));var logger=require(_0xbea5('0x4'))(_0xbea5('0x5'));var config=require(_0xbea5('0x6'));var jayson=require(_0xbea5('0x7'));var client=jayson[_0xbea5('0x8')][_0xbea5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19f838,_0x8fd13a,_0xa849e2){return new BPromise(function(_0x55caa0,_0x3969cc){return client[_0xbea5('0xa')](_0x19f838,_0xa849e2)[_0xbea5('0xb')](function(_0x38ffab){logger['info'](_0xbea5('0xc'),_0x8fd13a,_0xbea5('0xd'));logger[_0xbea5('0xe')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x8fd13a,_0xbea5('0xd'),JSON[_0xbea5('0xf')](_0x38ffab));if(_0x38ffab[_0xbea5('0x10')]){if(_0x38ffab[_0xbea5('0x10')]['code']===0x1f4){logger[_0xbea5('0x10')]('UserVoiceQueue,\x20%s,\x20%s',_0x8fd13a,_0x38ffab[_0xbea5('0x10')]['message']);return _0x3969cc(_0x38ffab[_0xbea5('0x10')][_0xbea5('0x11')]);}logger[_0xbea5('0x10')](_0xbea5('0xc'),_0x8fd13a,_0x38ffab[_0xbea5('0x10')][_0xbea5('0x11')]);return _0x55caa0(_0x38ffab[_0xbea5('0x10')]['message']);}else{logger[_0xbea5('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x8fd13a,_0xbea5('0xd'));_0x55caa0(_0x38ffab[_0xbea5('0x13')][_0xbea5('0x11')]);}})[_0xbea5('0x14')](function(_0x23e001){logger[_0xbea5('0x10')](_0xbea5('0xc'),_0x8fd13a,_0x23e001);_0x3969cc(_0x23e001);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 8ee6b10..d9b9657 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 _0x875c=['../../config/environment','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x4046c3,_0x23ec82){var _0x5a4e0b=function(_0x440742){while(--_0x440742){_0x4046c3['push'](_0x4046c3['shift']());}};_0x5a4e0b(++_0x23ec82);}(_0x875c,0x1e4));var _0xc875=function(_0x1866b1,_0x45bb4b){_0x1866b1=_0x1866b1-0x0;var _0x398d33=_0x875c[_0x1866b1];return _0x398d33;};'use strict';var multer=require('multer');var util=require(_0xc875('0x0'));var path=require(_0xc875('0x1'));var timeout=require(_0xc875('0x2'));var express=require(_0xc875('0x3'));var router=express[_0xc875('0x4')]();var auth=require(_0xc875('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc875('0x6'));module['exports']=router; \ No newline at end of file +var _0x294b=['Router','../../components/auth/service','../../components/interaction/service','multer','path','connect-timeout','express'];(function(_0x4bae1a,_0x5b0916){var _0x27f6d2=function(_0x2204b2){while(--_0x2204b2){_0x4bae1a['push'](_0x4bae1a['shift']());}};_0x27f6d2(++_0x5b0916);}(_0x294b,0xea));var _0xb294=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x294b[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xb294('0x0'));var util=require('util');var path=require(_0xb294('0x1'));var timeout=require(_0xb294('0x2'));var express=require(_0xb294('0x3'));var router=express[_0xb294('0x4')]();var auth=require(_0xb294('0x5'));var interaction=require(_0xb294('0x6'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index ab22fd3..e6dd996 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 _0xc615=['STRING','INTEGER','queue_interface','sequelize','Required\x20by\x20Asterisk'];(function(_0x30fdb2,_0x55f880){var _0x8627d3=function(_0x497c87){while(--_0x497c87){_0x30fdb2['push'](_0x30fdb2['shift']());}};_0x8627d3(++_0x55f880);}(_0xc615,0x7b));var _0x5c61=function(_0x56f6c0,_0x37c097){_0x56f6c0=_0x56f6c0-0x0;var _0x249342=_0xc615[_0x56f6c0];return _0x249342;};'use strict';var Sequelize=require(_0x5c61('0x0'));module['exports']={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x5c61('0x1')},'membername':{'type':Sequelize[_0x5c61('0x2')],'allowNull':![],'comment':_0x5c61('0x1')},'UserId':{'type':Sequelize[_0x5c61('0x3')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x5c61('0x2')],'allowNull':![],'unique':_0x5c61('0x4'),'comment':_0x5c61('0x1')},'VoiceQueueId':{'type':Sequelize[_0x5c61('0x3')],'allowNull':![]},'interface':{'type':Sequelize[_0x5c61('0x2')],'allowNull':![],'unique':_0x5c61('0x4'),'comment':_0x5c61('0x1')},'penalty':{'type':Sequelize[_0x5c61('0x3')](0xb),'defaultValue':0x0,'comment':_0x5c61('0x1')},'paused':{'type':Sequelize[_0x5c61('0x3')](0xb),'defaultValue':0x0,'comment':_0x5c61('0x1')}}; \ No newline at end of file +var _0x3a70=['Required\x20by\x20Asterisk','STRING','queue_interface','exports','INTEGER'];(function(_0x8584c,_0x21d8d3){var _0x17fd46=function(_0x27e6d5){while(--_0x27e6d5){_0x8584c['push'](_0x8584c['shift']());}};_0x17fd46(++_0x21d8d3);}(_0x3a70,0x14d));var _0x03a7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3a70[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x03a7('0x0')]={'uniqueid':{'type':Sequelize[_0x03a7('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x03a7('0x2')},'membername':{'type':Sequelize[_0x03a7('0x3')],'allowNull':![],'comment':_0x03a7('0x2')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x03a7('0x3')],'allowNull':![],'unique':_0x03a7('0x4'),'comment':_0x03a7('0x2')},'VoiceQueueId':{'type':Sequelize[_0x03a7('0x1')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x03a7('0x4'),'comment':_0x03a7('0x2')},'penalty':{'type':Sequelize[_0x03a7('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x03a7('0x1')](0xb),'defaultValue':0x0,'comment':_0x03a7('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 72c682e..9edc51c 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 _0x7050=['hook','events','../../mysqldb','setMaxListeners','update','emit'];(function(_0x2b7e28,_0x29310e){var _0x4b1a34=function(_0x44acda){while(--_0x44acda){_0x2b7e28['push'](_0x2b7e28['shift']());}};_0x4b1a34(++_0x29310e);}(_0x7050,0x7f));var _0x0705=function(_0x1e06f1,_0x59d7e1){_0x1e06f1=_0x1e06f1-0x0;var _0x34f77e=_0x7050[_0x1e06f1];return _0x34f77e;};'use strict';var EventEmitter=require(_0x0705('0x0'));var UserVoiceQueueRt=require(_0x0705('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x0705('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0705('0x3'),'afterDestroy':'remove'};function emitEvent(_0x30227b){return function(_0x49dc55,_0x5c14b8,_0x261a45){UserVoiceQueueRtEvents['emit'](_0x30227b+':'+_0x49dc55['id'],_0x49dc55);UserVoiceQueueRtEvents[_0x0705('0x4')](_0x30227b,_0x49dc55);_0x261a45(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x0705('0x5')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xf147=['setMaxListeners','remove','emit','hasOwnProperty','hook','UserVoiceQueueRt'];(function(_0x19a581,_0x8ac5eb){var _0x32a50b=function(_0x15e43e){while(--_0x15e43e){_0x19a581['push'](_0x19a581['shift']());}};_0x32a50b(++_0x8ac5eb);}(_0xf147,0x197));var _0x7f14=function(_0x22c02c,_0x263758){_0x22c02c=_0x22c02c-0x0;var _0x5c86ea=_0xf147[_0x22c02c];return _0x5c86ea;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x7f14('0x0')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x7f14('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x7f14('0x2')};function emitEvent(_0x3ffde){return function(_0xe59d9a,_0x4c6f05,_0x307745){UserVoiceQueueRtEvents['emit'](_0x3ffde+':'+_0xe59d9a['id'],_0xe59d9a);UserVoiceQueueRtEvents[_0x7f14('0x3')](_0x3ffde,_0xe59d9a);_0x307745(null);};}for(var e in events){if(events[_0x7f14('0x4')](e)){var event=events[e];UserVoiceQueueRt[_0x7f14('0x5')](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 08f892a..de1d361 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 _0x7c3f=['../../config/environment','./userVoiceQueueRt.attributes','UserVoiceQueueRt','user_has_voice_queues_rt','util','../../config/logger','api','path'];(function(_0x2b5445,_0x1daa9){var _0x466a85=function(_0x223ce9){while(--_0x223ce9){_0x2b5445['push'](_0x2b5445['shift']());}};_0x466a85(++_0x1daa9);}(_0x7c3f,0xec));var _0xf7c3=function(_0x31766c,_0x1cd917){_0x31766c=_0x31766c-0x0;var _0x4a19c5=_0x7c3f[_0x31766c];return _0x4a19c5;};'use strict';var _=require('lodash');var util=require(_0xf7c3('0x0'));var logger=require(_0xf7c3('0x1'))(_0xf7c3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf7c3('0x3'));var rimraf=require('rimraf');var config=require(_0xf7c3('0x4'));var attributes=require(_0xf7c3('0x5'));module['exports']=function(_0x152fd1,_0x14ea92){return _0x152fd1['define'](_0xf7c3('0x6'),attributes,{'tableName':_0xf7c3('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a63=['../../config/environment','./userVoiceQueueRt.attributes','exports','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x5a63,0x155));var _0x35a6=function(_0x3b6f89,_0x48a7b0){_0x3b6f89=_0x3b6f89-0x0;var _0x4b0dde=_0x5a63[_0x3b6f89];return _0x4b0dde;};'use strict';var _=require(_0x35a6('0x0'));var util=require(_0x35a6('0x1'));var logger=require(_0x35a6('0x2'))(_0x35a6('0x3'));var moment=require(_0x35a6('0x4'));var BPromise=require(_0x35a6('0x5'));var rp=require(_0x35a6('0x6'));var fs=require('fs');var path=require(_0x35a6('0x7'));var rimraf=require(_0x35a6('0x8'));var config=require(_0x35a6('0x9'));var attributes=require(_0x35a6('0xa'));module[_0x35a6('0xb')]=function(_0x32180f,_0x51d70e){return _0x32180f['define'](_0x35a6('0xc'),attributes,{'tableName':_0x35a6('0xd'),'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 369139b..46dabe8 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 _0xf670=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','./userVoiceQueueRt.socket','register','request','info','UserVoiceQueueRt,\x20%s,\x20%s','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceQueueRtPauses','options','where','sequelize','COUNT','literal','outboundQueuePauses','debug','stringify','util','moment'];(function(_0x24a84a,_0x20f756){var _0xeddd46=function(_0x12e155){while(--_0x12e155){_0x24a84a['push'](_0x24a84a['shift']());}};_0xeddd46(++_0x20f756);}(_0xf670,0xec));var _0x0f67=function(_0x364471,_0x302e8a){_0x364471=_0x364471-0x0;var _0x59236f=_0xf670[_0x364471];return _0x59236f;};'use strict';var _=require('lodash');var util=require(_0x0f67('0x0'));var moment=require(_0x0f67('0x1'));var BPromise=require(_0x0f67('0x2'));var rs=require(_0x0f67('0x3'));var fs=require('fs');var Redis=require(_0x0f67('0x4'));var db=require(_0x0f67('0x5'))['db'];var utils=require(_0x0f67('0x6'));var logger=require(_0x0f67('0x7'))('rpc');var config=require(_0x0f67('0x8'));var jayson=require(_0x0f67('0x9'));var client=jayson[_0x0f67('0xa')]['http']({'port':0x232a});config[_0x0f67('0xb')]=_[_0x0f67('0xc')](config[_0x0f67('0xb')],{'host':_0x0f67('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0f67('0xb')]));require(_0x0f67('0xe'))[_0x0f67('0xf')](socket);function respondWithRpcPromise(_0x3a5ecb,_0x309f02,_0x215414){return new BPromise(function(_0x297c28,_0x2f9ae8){return client[_0x0f67('0x10')](_0x3a5ecb,_0x215414)['then'](function(_0x324b52){logger[_0x0f67('0x11')](_0x0f67('0x12'),_0x309f02,'request\x20sent');logger['debug'](_0x0f67('0x13'),_0x309f02,'request\x20sent',JSON['stringify'](_0x324b52));if(_0x324b52[_0x0f67('0x14')]){if(_0x324b52[_0x0f67('0x14')][_0x0f67('0x15')]===0x1f4){logger[_0x0f67('0x14')](_0x0f67('0x12'),_0x309f02,_0x324b52[_0x0f67('0x14')][_0x0f67('0x16')]);return _0x2f9ae8(_0x324b52[_0x0f67('0x14')][_0x0f67('0x16')]);}logger[_0x0f67('0x14')](_0x0f67('0x12'),_0x309f02,_0x324b52['error']['message']);return _0x297c28(_0x324b52['error'][_0x0f67('0x16')]);}else{logger['info'](_0x0f67('0x12'),_0x309f02,'request\x20sent');_0x297c28(_0x324b52[_0x0f67('0x17')][_0x0f67('0x16')]);}})[_0x0f67('0x18')](function(_0x17f461){logger[_0x0f67('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x309f02,_0x17f461);_0x2f9ae8(_0x17f461);});});}exports[_0x0f67('0x19')]=function(_0x16d365){var _0x57ff75=this;return new Promise(function(_0x3f18a3,_0x21b86c){return db['UserVoiceQueueRt']['findAll']({'raw':_0x16d365[_0x0f67('0x1a')]?_0x16d365[_0x0f67('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x16d365[_0x0f67('0x1a')]?_0x16d365[_0x0f67('0x1a')][_0x0f67('0x1b')]||null:null,'attributes':[[db[_0x0f67('0x1c')]['fn'](_0x0f67('0x1d'),db[_0x0f67('0x1c')]['fn']('IF',db['sequelize'][_0x0f67('0x1e')]('`paused`\x20=\x201,\x201,\x20null'))),_0x0f67('0x1f')]]})['then'](function(_0x432400){logger['info']('GetVoiceQueueRtPauses',_0x16d365);logger[_0x0f67('0x20')](_0x0f67('0x19'),_0x16d365,JSON[_0x0f67('0x21')](_0x432400));_0x3f18a3(_0x432400);})[_0x0f67('0x18')](function(_0x4d7ea8){logger[_0x0f67('0x14')](_0x0f67('0x19'),_0x4d7ea8[_0x0f67('0x16')],_0x16d365);_0x21b86c(_0x57ff75[_0x0f67('0x14')](0x1f4,_0x4d7ea8['message']));});});}; \ No newline at end of file +var _0xced1=['localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','then','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','info','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','outboundQueuePauses','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','redis','defaults'];(function(_0x25700a,_0x2c5dd4){var _0x23639a=function(_0x555a9d){while(--_0x555a9d){_0x25700a['push'](_0x25700a['shift']());}};_0x23639a(++_0x2c5dd4);}(_0xced1,0x165));var _0x1ced=function(_0x4de586,_0x183427){_0x4de586=_0x4de586-0x0;var _0x46baf5=_0xced1[_0x4de586];return _0x46baf5;};'use strict';var _=require(_0x1ced('0x0'));var util=require(_0x1ced('0x1'));var moment=require(_0x1ced('0x2'));var BPromise=require(_0x1ced('0x3'));var rs=require(_0x1ced('0x4'));var fs=require('fs');var Redis=require(_0x1ced('0x5'));var db=require(_0x1ced('0x6'))['db'];var utils=require(_0x1ced('0x7'));var logger=require('../../config/logger')(_0x1ced('0x8'));var config=require(_0x1ced('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1ced('0xa')]({'port':0x232a});config[_0x1ced('0xb')]=_[_0x1ced('0xc')](config[_0x1ced('0xb')],{'host':_0x1ced('0xd'),'port':0x18eb});var socket=require(_0x1ced('0xe'))(new Redis(config[_0x1ced('0xb')]));require(_0x1ced('0xf'))[_0x1ced('0x10')](socket);function respondWithRpcPromise(_0x391e03,_0x542de9,_0x176b33){return new BPromise(function(_0x3d9a0c,_0x708c3b){return client['request'](_0x391e03,_0x176b33)[_0x1ced('0x11')](function(_0x2a1cb9){logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x542de9,_0x1ced('0x12'));logger[_0x1ced('0x13')](_0x1ced('0x14'),_0x542de9,_0x1ced('0x12'),JSON[_0x1ced('0x15')](_0x2a1cb9));if(_0x2a1cb9[_0x1ced('0x16')]){if(_0x2a1cb9[_0x1ced('0x16')][_0x1ced('0x17')]===0x1f4){logger[_0x1ced('0x16')](_0x1ced('0x18'),_0x542de9,_0x2a1cb9[_0x1ced('0x16')][_0x1ced('0x19')]);return _0x708c3b(_0x2a1cb9[_0x1ced('0x16')]['message']);}logger[_0x1ced('0x16')](_0x1ced('0x18'),_0x542de9,_0x2a1cb9[_0x1ced('0x16')][_0x1ced('0x19')]);return _0x3d9a0c(_0x2a1cb9[_0x1ced('0x16')]['message']);}else{logger[_0x1ced('0x1a')](_0x1ced('0x18'),_0x542de9,_0x1ced('0x12'));_0x3d9a0c(_0x2a1cb9['result']['message']);}})[_0x1ced('0x1b')](function(_0x507136){logger[_0x1ced('0x16')](_0x1ced('0x18'),_0x542de9,_0x507136);_0x708c3b(_0x507136);});});}exports[_0x1ced('0x1c')]=function(_0x4d249a){var _0x3b69ec=this;return new Promise(function(_0x54b9ff,_0x491a93){return db[_0x1ced('0x1d')][_0x1ced('0x1e')]({'raw':_0x4d249a[_0x1ced('0x1f')]?_0x4d249a[_0x1ced('0x1f')][_0x1ced('0x20')]===undefined?!![]:![]:!![],'where':_0x4d249a[_0x1ced('0x1f')]?_0x4d249a[_0x1ced('0x1f')][_0x1ced('0x21')]||null:null,'attributes':[[db[_0x1ced('0x22')]['fn'](_0x1ced('0x23'),db[_0x1ced('0x22')]['fn']('IF',db[_0x1ced('0x22')]['literal']('`paused`\x20=\x201,\x201,\x20null'))),_0x1ced('0x24')]]})[_0x1ced('0x11')](function(_0x1b9714){logger[_0x1ced('0x1a')]('GetVoiceQueueRtPauses',_0x4d249a);logger[_0x1ced('0x13')](_0x1ced('0x1c'),_0x4d249a,JSON['stringify'](_0x1b9714));_0x54b9ff(_0x1b9714);})['catch'](function(_0x42fed0){logger[_0x1ced('0x16')](_0x1ced('0x1c'),_0x42fed0[_0x1ced('0x19')],_0x4d249a);_0x491a93(_0x3b69ec['error'](0x1f4,_0x42fed0['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 6a5b04a..5dddea7 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 _0x2a70=['emit','register','length','./userVoiceQueueRt.events','remove','update'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x2a70,0x12f));var _0x02a7=function(_0x436642,_0x59d3b7){_0x436642=_0x436642-0x0;var _0x8be476=_0x2a70[_0x436642];return _0x8be476;};'use strict';var UserVoiceQueueRtEvents=require(_0x02a7('0x0'));var events=['save',_0x02a7('0x1'),_0x02a7('0x2')];function createListener(_0x1f0966,_0x317227){return function(_0x4f6c19){_0x317227[_0x02a7('0x3')](_0x1f0966,_0x4f6c19);};}function removeListener(_0x50b949,_0x45abe1){return function(){UserVoiceQueueRtEvents['removeListener'](_0x50b949,_0x45abe1);};}exports[_0x02a7('0x4')]=function(_0x5bcf39){for(var _0x513257=0x0,_0x45b279=events[_0x02a7('0x5')];_0x513257<_0x45b279;_0x513257++){var _0x283c93=events[_0x513257];var _0x5cbbd4=createListener('userVoiceQueueRt:'+_0x283c93,_0x5bcf39);UserVoiceQueueRtEvents['on'](_0x283c93,_0x5cbbd4);}}; \ No newline at end of file +var _0x52b0=['emit','removeListener','userVoiceQueueRt:','./userVoiceQueueRt.events','save','update'];(function(_0x453744,_0x389564){var _0x148bb6=function(_0x43d65a){while(--_0x43d65a){_0x453744['push'](_0x453744['shift']());}};_0x148bb6(++_0x389564);}(_0x52b0,0xc9));var _0x052b=function(_0x137295,_0x26078f){_0x137295=_0x137295-0x0;var _0x59e59f=_0x52b0[_0x137295];return _0x59e59f;};'use strict';var UserVoiceQueueRtEvents=require(_0x052b('0x0'));var events=[_0x052b('0x1'),'remove',_0x052b('0x2')];function createListener(_0x46f514,_0x1435a5){return function(_0x437b99){_0x1435a5[_0x052b('0x3')](_0x46f514,_0x437b99);};}function removeListener(_0xddd1f4,_0x1122ad){return function(){UserVoiceQueueRtEvents[_0x052b('0x4')](_0xddd1f4,_0x1122ad);};}exports['register']=function(_0x2eb66e){for(var _0x4823bf=0x0,_0x8222ab=events['length'];_0x4823bf<_0x8222ab;_0x4823bf++){var _0x1f2090=events[_0x4823bf];var _0x4f96e5=createListener(_0x052b('0x5')+_0x1f2090,_0x2eb66e);UserVoiceQueueRtEvents['on'](_0x1f2090,_0x4f96e5);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 68cb21d..bd3f038 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 _0xd803=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x46c2a4,_0xfe8728){var _0x251483=function(_0x458570){while(--_0x458570){_0x46c2a4['push'](_0x46c2a4['shift']());}};_0x251483(++_0xfe8728);}(_0xd803,0xbf));var _0x3d80=function(_0x312b41,_0x1d37a8){_0x312b41=_0x312b41-0x0;var _0x53d40a=_0xd803[_0x312b41];return _0x53d40a;};'use strict';var multer=require(_0x3d80('0x0'));var util=require(_0x3d80('0x1'));var path=require(_0x3d80('0x2'));var timeout=require(_0x3d80('0x3'));var express=require(_0x3d80('0x4'));var router=express[_0x3d80('0x5')]();var auth=require(_0x3d80('0x6'));var interaction=require(_0x3d80('0x7'));var config=require(_0x3d80('0x8'));module[_0x3d80('0x9')]=router; \ No newline at end of file +var _0x95fb=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util'];(function(_0x319920,_0x1aeb65){var _0x354056=function(_0x3154b1){while(--_0x3154b1){_0x319920['push'](_0x319920['shift']());}};_0x354056(++_0x1aeb65);}(_0x95fb,0x13e));var _0xb95f=function(_0x366901,_0x368a5c){_0x366901=_0x366901-0x0;var _0x175090=_0x95fb[_0x366901];return _0x175090;};'use strict';var multer=require(_0xb95f('0x0'));var util=require(_0xb95f('0x1'));var path=require(_0xb95f('0x2'));var timeout=require(_0xb95f('0x3'));var express=require(_0xb95f('0x4'));var router=express[_0xb95f('0x5')]();var auth=require(_0xb95f('0x6'));var interaction=require(_0xb95f('0x7'));var config=require(_0xb95f('0x8'));module[_0xb95f('0x9')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 880569b..9480ce7 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x1dd185,_0xb2aaec){var _0x35ffe0=function(_0x5807f8){while(--_0x5807f8){_0x1dd185['push'](_0x1dd185['shift']());}};_0x35ffe0(++_0xb2aaec);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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(_0x4fdd37,_0x6ddb6){var _0x46d6d1=function(_0x48ad38){while(--_0x48ad38){_0x4fdd37['push'](_0x4fdd37['shift']());}};_0x46d6d1(++_0x6ddb6);}(_0xe706,0xa3));var _0x6e70=function(_0x5229a1,_0x5349f8){_0x5229a1=_0x5229a1-0x0;var _0xc4cb55=_0xe706[_0x5229a1];return _0xc4cb55;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index af3eb5c..cdd4e4b 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 _0xdb94=['lodash','util','../../config/logger','api','moment','request-promise','path','./userWhatsappQueue.attributes','UserWhatsappQueue'];(function(_0x2a3e7c,_0x43d6a4){var _0x1318a7=function(_0x48829d){while(--_0x48829d){_0x2a3e7c['push'](_0x2a3e7c['shift']());}};_0x1318a7(++_0x43d6a4);}(_0xdb94,0xab));var _0x4db9=function(_0x590a3a,_0xd9db9){_0x590a3a=_0x590a3a-0x0;var _0x49017f=_0xdb94[_0x590a3a];return _0x49017f;};'use strict';var _=require(_0x4db9('0x0'));var util=require(_0x4db9('0x1'));var logger=require(_0x4db9('0x2'))(_0x4db9('0x3'));var moment=require(_0x4db9('0x4'));var BPromise=require('bluebird');var rp=require(_0x4db9('0x5'));var fs=require('fs');var path=require(_0x4db9('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4db9('0x7'));module['exports']=function(_0x47a3f5,_0x31dd9f){return _0x47a3f5['define'](_0x4db9('0x8'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4024=['define','user_has_whatsapp_queues','lodash','util','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x19da8c,_0x5b8a14){var _0x5b482a=function(_0x4f9ba8){while(--_0x4f9ba8){_0x19da8c['push'](_0x19da8c['shift']());}};_0x5b482a(++_0x5b8a14);}(_0x4024,0x89));var _0x4402=function(_0x51eaf3,_0x37f3f3){_0x51eaf3=_0x51eaf3-0x0;var _0x217c6c=_0x4024[_0x51eaf3];return _0x217c6c;};'use strict';var _=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var logger=require('../../config/logger')(_0x4402('0x2'));var moment=require(_0x4402('0x3'));var BPromise=require('bluebird');var rp=require(_0x4402('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4402('0x5'));var config=require(_0x4402('0x6'));var attributes=require('./userWhatsappQueue.attributes');module['exports']=function(_0x17699b,_0x346ddc){return _0x17699b[_0x4402('0x7')]('UserWhatsappQueue',attributes,{'tableName':_0x4402('0x8'),'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 e72e309..3bcdad6 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(_0x17dd69,_0x1aefd2){var _0x277a88=function(_0x572ef4){while(--_0x572ef4){_0x17dd69['push'](_0x17dd69['shift']());}};_0x277a88(++_0x1aefd2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ 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(_0x6e7277,_0x1f347b){var _0x3d117c=function(_0x2d706d){while(--_0x2d706d){_0x6e7277['push'](_0x6e7277['shift']());}};_0x3d117c(++_0x1f347b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index e341a54..9c5da06 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 _0x3514=['../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','create','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service'];(function(_0x141579,_0x385051){var _0x41c428=function(_0x13c0ba){while(--_0x13c0ba){_0x141579['push'](_0x141579['shift']());}};_0x41c428(++_0x385051);}(_0x3514,0xb6));var _0x4351=function(_0x36fb98,_0x43439a){_0x36fb98=_0x36fb98-0x0;var _0xe2d0fc=_0x3514[_0x36fb98];return _0xe2d0fc;};'use strict';var multer=require(_0x4351('0x0'));var util=require(_0x4351('0x1'));var path=require('path');var timeout=require(_0x4351('0x2'));var express=require('express');var router=express[_0x4351('0x3')]();var auth=require(_0x4351('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4351('0x5'));var controller=require(_0x4351('0x6'));router[_0x4351('0x7')]('/',auth[_0x4351('0x8')](),controller[_0x4351('0x9')]);router[_0x4351('0x7')](_0x4351('0xa'),auth[_0x4351('0x8')](),controller[_0x4351('0xb')]);router['post']('/',auth[_0x4351('0x8')](),controller[_0x4351('0xc')]);router['put'](_0x4351('0xa'),auth['isAuthenticated'](),controller[_0x4351('0xd')]);router[_0x4351('0xe')](_0x4351('0xa'),auth[_0x4351('0x8')](),controller[_0x4351('0xf')]);module[_0x4351('0x10')]=router; \ No newline at end of file +var _0x5265=['Router','../../components/auth/service','../../components/interaction/service','./variable.controller','isAuthenticated','index','get','show','post','/:id','update','delete','multer','util','path','connect-timeout','express'];(function(_0x46eb54,_0x4f1eac){var _0x3902b2=function(_0x3ac68b){while(--_0x3ac68b){_0x46eb54['push'](_0x46eb54['shift']());}};_0x3902b2(++_0x4f1eac);}(_0x5265,0x182));var _0x5526=function(_0x28c0d5,_0x24e8e7){_0x28c0d5=_0x28c0d5-0x0;var _0x1ceb27=_0x5265[_0x28c0d5];return _0x1ceb27;};'use strict';var multer=require(_0x5526('0x0'));var util=require(_0x5526('0x1'));var path=require(_0x5526('0x2'));var timeout=require(_0x5526('0x3'));var express=require(_0x5526('0x4'));var router=express[_0x5526('0x5')]();var auth=require(_0x5526('0x6'));var interaction=require(_0x5526('0x7'));var config=require('../../config/environment');var controller=require(_0x5526('0x8'));router['get']('/',auth[_0x5526('0x9')](),controller[_0x5526('0xa')]);router[_0x5526('0xb')]('/:id',auth[_0x5526('0x9')](),controller[_0x5526('0xc')]);router[_0x5526('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x5526('0xe'),auth['isAuthenticated'](),controller[_0x5526('0xf')]);router[_0x5526('0x10')]('/:id',auth[_0x5526('0x9')](),controller['destroy']);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 08cbcab..a9c3e00 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 _0x9bed=['exports'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x9bed,0xe0));var _0xd9be=function(_0x2143da,_0x531b29){_0x2143da=_0x2143da-0x0;var _0x45d6ae=_0x9bed[_0x2143da];return _0x45d6ae;};'use strict';var Sequelize=require('sequelize');module[_0xd9be('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4838=['exports','name','sequelize'];(function(_0x34e7b1,_0x1cd673){var _0x26d731=function(_0x31f034){while(--_0x31f034){_0x34e7b1['push'](_0x34e7b1['shift']());}};_0x26d731(++_0x1cd673);}(_0x4838,0x1be));var _0x8483=function(_0x2d9ca9,_0x4d7d98){_0x2d9ca9=_0x2d9ca9-0x0;var _0x5626d9=_0x4838[_0x2d9ca9];return _0x5626d9;};'use strict';var Sequelize=require(_0x8483('0x0'));module[_0x8483('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x8483('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 5696ce5..4b10d79 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 _0x54b2=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','count','include','findAll','rows','catch','show','params','keys','includeAll','merge','options','find','create','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','Content-Range','apply','update','then','destroy','get','Variables','UserProfileResource','error','stack','name','send','index','Variable','rawAttributes','key','model','map','query','filters','intersection','fields','attributes'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x54b2,0x6e));var _0x254b=function(_0x11668a,_0x1bd766){_0x11668a=_0x11668a-0x0;var _0x1bf887=_0x54b2[_0x11668a];return _0x1bf887;};'use strict';var pdf=require(_0x254b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x254b('0x1'));var zipdir=require(_0x254b('0x2'));var jsonpatch=require(_0x254b('0x3'));var rp=require(_0x254b('0x4'));var moment=require(_0x254b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x254b('0x6'));var util=require(_0x254b('0x7'));var path=require(_0x254b('0x8'));var sox=require(_0x254b('0x9'));var csv=require(_0x254b('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x254b('0xb'));var squel=require(_0x254b('0xc'));var crypto=require(_0x254b('0xd'));var jsforce=require(_0x254b('0xe'));var deskjs=require(_0x254b('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x254b('0x10'));var Redis=require(_0x254b('0x11'));var authService=require(_0x254b('0x12'));var qs=require(_0x254b('0x13'));var as=require(_0x254b('0x14'));var hardwareService=require(_0x254b('0x15'));var logger=require('../../config/logger')(_0x254b('0x16'));var utils=require('../../config/utils');var config=require(_0x254b('0x17'));var db=require(_0x254b('0x18'))['db'];function respondWithStatusCode(_0x3daaf6,_0x552f1e){_0x552f1e=_0x552f1e||0xcc;return function(_0x78f36b){if(_0x78f36b){return _0x3daaf6[_0x254b('0x19')](_0x552f1e);}return _0x3daaf6['status'](_0x552f1e)[_0x254b('0x1a')]();};}function respondWithResult(_0x4fdd27,_0x55e117){_0x55e117=_0x55e117||0xc8;return function(_0x271eae){if(_0x271eae){return _0x4fdd27[_0x254b('0x1b')](_0x55e117)[_0x254b('0x1c')](_0x271eae);}};}function respondWithFilteredResult(_0x3524ad,_0x6968d3){return function(_0x988b0a){if(_0x988b0a){var _0x3be85b=_0x988b0a['count'],_0x59ab73=_0x6968d3[_0x254b('0x1d')],_0x20c142=_0x6968d3[_0x254b('0x1d')]+_0x6968d3[_0x254b('0x1e')],_0x3b8d10;if(_0x20c142>=_0x3be85b){_0x20c142=_0x3be85b;_0x3b8d10=0xc8;}else{_0x3b8d10=0xce;}_0x3524ad[_0x254b('0x1b')](_0x3b8d10);return _0x3524ad['set'](_0x254b('0x1f'),_0x59ab73+'-'+_0x20c142+'/'+_0x3be85b)[_0x254b('0x1c')](_0x988b0a);}return null;};}function patchUpdates(_0x8855b6){return function(_0x1c9e4d){try{jsonpatch[_0x254b('0x20')](_0x1c9e4d,_0x8855b6,!![]);}catch(_0x458990){return BPromise['reject'](_0x458990);}return _0x1c9e4d['save']();};}function saveUpdates(_0x5df5a5,_0x1fca60){return function(_0x1b05ef){if(_0x1b05ef){return _0x1b05ef[_0x254b('0x21')](_0x5df5a5)[_0x254b('0x22')](function(_0x441de7){return _0x441de7;});}return null;};}function removeEntity(_0x280483,_0x41954d){return function(_0x1aed36){if(_0x1aed36){return _0x1aed36[_0x254b('0x23')]()['then'](function(){var _0x4ca79f=_0x1aed36[_0x254b('0x24')]({'plain':!![]});var _0x5f55f0=_0x254b('0x25');return db[_0x254b('0x26')]['destroy']({'where':{'type':_0x5f55f0,'resourceId':_0x4ca79f['id']}})[_0x254b('0x22')](function(){return _0x1aed36;});})['then'](function(){_0x280483[_0x254b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x424958,_0xfd96a3){return function(_0x22f2fb){if(!_0x22f2fb){_0x424958[_0x254b('0x19')](0x194);}return _0x22f2fb;};}function handleError(_0xca3d5d,_0x50a689){_0x50a689=_0x50a689||0x1f4;return function(_0x4c682c){logger[_0x254b('0x27')](_0x4c682c[_0x254b('0x28')]);if(_0x4c682c[_0x254b('0x29')]){delete _0x4c682c[_0x254b('0x29')];}_0xca3d5d[_0x254b('0x1b')](_0x50a689)[_0x254b('0x2a')](_0x4c682c);};}exports[_0x254b('0x2b')]=function(_0x1c553d,_0x4e6bdb){var _0x463f1d={},_0x3c500e={},_0x38db48={'count':0x0,'rows':[]};var _0x2bc935=_['map'](db[_0x254b('0x2c')][_0x254b('0x2d')],function(_0x535b5e){return{'name':_0x535b5e['fieldName'],'type':_0x535b5e['type'][_0x254b('0x2e')]};});_0x3c500e[_0x254b('0x2f')]=_[_0x254b('0x30')](_0x2bc935,'name');_0x3c500e[_0x254b('0x31')]=_['keys'](_0x1c553d[_0x254b('0x31')]);_0x3c500e[_0x254b('0x32')]=_[_0x254b('0x33')](_0x3c500e[_0x254b('0x2f')],_0x3c500e[_0x254b('0x31')]);_0x463f1d['attributes']=_[_0x254b('0x33')](_0x3c500e[_0x254b('0x2f')],qs[_0x254b('0x34')](_0x1c553d[_0x254b('0x31')][_0x254b('0x34')]));_0x463f1d[_0x254b('0x35')]=_0x463f1d[_0x254b('0x35')][_0x254b('0x36')]?_0x463f1d[_0x254b('0x35')]:_0x3c500e[_0x254b('0x2f')];if(!_0x1c553d['query'][_0x254b('0x37')](_0x254b('0x38'))){_0x463f1d['limit']=qs[_0x254b('0x1e')](_0x1c553d[_0x254b('0x31')][_0x254b('0x1e')]);_0x463f1d[_0x254b('0x1d')]=qs['offset'](_0x1c553d[_0x254b('0x31')][_0x254b('0x1d')]);}_0x463f1d[_0x254b('0x39')]=qs[_0x254b('0x3a')](_0x1c553d[_0x254b('0x31')][_0x254b('0x3a')]);_0x463f1d[_0x254b('0x3b')]=qs['filters'](_[_0x254b('0x3c')](_0x1c553d[_0x254b('0x31')],_0x3c500e[_0x254b('0x32')]));if(_0x1c553d[_0x254b('0x31')][_0x254b('0x3d')]){_0x463f1d[_0x254b('0x3b')]=_['merge'](_0x463f1d['where'],{'$or':_[_0x254b('0x30')](_0x2bc935,function(_0x4b24bf){if(_0x4b24bf[_0x254b('0x3e')]!==_0x254b('0x3f')){var _0x451d7={};_0x451d7[_0x4b24bf[_0x254b('0x29')]]={'$like':'%'+_0x1c553d['query']['filter']+'%'};return _0x451d7;}})});}_0x463f1d=_['merge']({},_0x463f1d,_0x1c553d['options']);var _0x4e8d81={'where':_0x463f1d[_0x254b('0x3b')]};return db[_0x254b('0x2c')][_0x254b('0x40')](_0x4e8d81)[_0x254b('0x22')](function(_0x4f94fa){_0x38db48[_0x254b('0x40')]=_0x4f94fa;if(_0x1c553d[_0x254b('0x31')]['includeAll']){_0x463f1d[_0x254b('0x41')]=[{'all':!![]}];}return db['Variable'][_0x254b('0x42')](_0x463f1d);})[_0x254b('0x22')](function(_0x455573){_0x38db48[_0x254b('0x43')]=_0x455573;return _0x38db48;})['then'](respondWithFilteredResult(_0x4e6bdb,_0x463f1d))[_0x254b('0x44')](handleError(_0x4e6bdb,null));};exports[_0x254b('0x45')]=function(_0x5bef96,_0x3b0123){var _0x4c7bc8={'raw':!![],'where':{'id':_0x5bef96[_0x254b('0x46')]['id']}},_0x4a9a7e={};_0x4a9a7e[_0x254b('0x2f')]=_['keys'](db['Variable'][_0x254b('0x2d')]);_0x4a9a7e['query']=_[_0x254b('0x47')](_0x5bef96[_0x254b('0x31')]);_0x4a9a7e['filters']=_[_0x254b('0x33')](_0x4a9a7e[_0x254b('0x2f')],_0x4a9a7e[_0x254b('0x31')]);_0x4c7bc8[_0x254b('0x35')]=_[_0x254b('0x33')](_0x4a9a7e['model'],qs['fields'](_0x5bef96[_0x254b('0x31')][_0x254b('0x34')]));_0x4c7bc8[_0x254b('0x35')]=_0x4c7bc8[_0x254b('0x35')]['length']?_0x4c7bc8[_0x254b('0x35')]:_0x4a9a7e['model'];if(_0x5bef96[_0x254b('0x31')][_0x254b('0x48')]){_0x4c7bc8[_0x254b('0x41')]=[{'all':!![]}];}_0x4c7bc8=_[_0x254b('0x49')]({},_0x4c7bc8,_0x5bef96[_0x254b('0x4a')]);return db['Variable'][_0x254b('0x4b')](_0x4c7bc8)['then'](handleEntityNotFound(_0x3b0123,null))[_0x254b('0x22')](respondWithResult(_0x3b0123,null))[_0x254b('0x44')](handleError(_0x3b0123,null));};exports[_0x254b('0x4c')]=function(_0x3c1b81,_0x1ea22b){return db[_0x254b('0x2c')][_0x254b('0x4c')](_0x3c1b81['body'],{})['then'](function(_0x557290){var _0x3da189=_0x3c1b81[_0x254b('0x4d')][_0x254b('0x24')]({'plain':!![]});if(!_0x3da189)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3da189[_0x254b('0x4e')]===_0x254b('0x4d')){var _0x1bf832=_0x557290[_0x254b('0x24')]({'plain':!![]});var _0x5b066b=_0x254b('0x25');return db[_0x254b('0x4f')][_0x254b('0x4b')]({'where':{'name':_0x5b066b,'userProfileId':_0x3da189['userProfileId']},'raw':!![]})['then'](function(_0x21f3be){if(_0x21f3be&&_0x21f3be[_0x254b('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x1bf832[_0x254b('0x29')],'resourceId':_0x1bf832['id'],'type':_0x21f3be[_0x254b('0x29')],'sectionId':_0x21f3be['id']},{})[_0x254b('0x22')](function(){return _0x557290;});}else{return _0x557290;}})[_0x254b('0x44')](function(_0x1d7282){logger[_0x254b('0x27')](_0x254b('0x51'),_0x1d7282);throw _0x1d7282;});}return _0x557290;})[_0x254b('0x22')](respondWithResult(_0x1ea22b,0xc9))['catch'](handleError(_0x1ea22b,null));};exports[_0x254b('0x21')]=function(_0x132c09,_0x45b958){if(_0x132c09['body']['id']){delete _0x132c09['body']['id'];}return db[_0x254b('0x2c')][_0x254b('0x4b')]({'where':{'id':_0x132c09[_0x254b('0x46')]['id']}})[_0x254b('0x22')](handleEntityNotFound(_0x45b958,null))[_0x254b('0x22')](saveUpdates(_0x132c09['body'],null))[_0x254b('0x22')](respondWithResult(_0x45b958,null))['catch'](handleError(_0x45b958,null));};exports[_0x254b('0x23')]=function(_0x39d542,_0x29160a){return db['Variable']['find']({'where':{'id':_0x39d542[_0x254b('0x46')]['id']}})[_0x254b('0x22')](handleEntityNotFound(_0x29160a,null))[_0x254b('0x22')](removeEntity(_0x29160a,null))[_0x254b('0x44')](handleError(_0x29160a,null));}; \ No newline at end of file +var _0x84c9=['count','offset','limit','set','Content-Range','save','update','then','destroy','get','UserProfileResource','end','sendStatus','error','stack','name','send','index','Variable','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','intersection','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json'];(function(_0x872b02,_0x4f4458){var _0x1a6b24=function(_0x1dfb4e){while(--_0x1dfb4e){_0x872b02['push'](_0x872b02['shift']());}};_0x1a6b24(++_0x4f4458);}(_0x84c9,0x124));var _0x984c=function(_0xe4428d,_0x203156){_0xe4428d=_0xe4428d-0x0;var _0x24ca18=_0x84c9[_0xe4428d];return _0x24ca18;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x984c('0x0'));var rp=require(_0x984c('0x1'));var moment=require(_0x984c('0x2'));var BPromise=require(_0x984c('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x984c('0x4'));var sox=require(_0x984c('0x5'));var csv=require(_0x984c('0x6'));var ejs=require(_0x984c('0x7'));var fs=require('fs');var _=require(_0x984c('0x8'));var squel=require(_0x984c('0x9'));var crypto=require(_0x984c('0xa'));var jsforce=require(_0x984c('0xb'));var deskjs=require(_0x984c('0xc'));var toCsv=require(_0x984c('0x6'));var querystring=require(_0x984c('0xd'));var Papa=require('papaparse');var Redis=require(_0x984c('0xe'));var authService=require(_0x984c('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x984c('0x10'));var logger=require(_0x984c('0x11'))(_0x984c('0x12'));var utils=require(_0x984c('0x13'));var config=require(_0x984c('0x14'));var db=require(_0x984c('0x15'))['db'];function respondWithStatusCode(_0x1fca70,_0x3ce7a1){_0x3ce7a1=_0x3ce7a1||0xcc;return function(_0x32c845){if(_0x32c845){return _0x1fca70['sendStatus'](_0x3ce7a1);}return _0x1fca70[_0x984c('0x16')](_0x3ce7a1)['end']();};}function respondWithResult(_0x21d672,_0x4a95e6){_0x4a95e6=_0x4a95e6||0xc8;return function(_0x3e5d56){if(_0x3e5d56){return _0x21d672[_0x984c('0x16')](_0x4a95e6)[_0x984c('0x17')](_0x3e5d56);}};}function respondWithFilteredResult(_0x3dadb1,_0x47d4d1){return function(_0x1a8f17){if(_0x1a8f17){var _0x204171=_0x1a8f17[_0x984c('0x18')],_0x510b91=_0x47d4d1[_0x984c('0x19')],_0x106c1f=_0x47d4d1[_0x984c('0x19')]+_0x47d4d1[_0x984c('0x1a')],_0x241068;if(_0x106c1f>=_0x204171){_0x106c1f=_0x204171;_0x241068=0xc8;}else{_0x241068=0xce;}_0x3dadb1[_0x984c('0x16')](_0x241068);return _0x3dadb1[_0x984c('0x1b')](_0x984c('0x1c'),_0x510b91+'-'+_0x106c1f+'/'+_0x204171)[_0x984c('0x17')](_0x1a8f17);}return null;};}function patchUpdates(_0x3bed78){return function(_0x463fe3){try{jsonpatch['apply'](_0x463fe3,_0x3bed78,!![]);}catch(_0x8abd37){return BPromise['reject'](_0x8abd37);}return _0x463fe3[_0x984c('0x1d')]();};}function saveUpdates(_0x2a8a55,_0x12f464){return function(_0x2a4678){if(_0x2a4678){return _0x2a4678[_0x984c('0x1e')](_0x2a8a55)[_0x984c('0x1f')](function(_0x5c9ed3){return _0x5c9ed3;});}return null;};}function removeEntity(_0x5afdae,_0x2370fa){return function(_0x71b1d3){if(_0x71b1d3){return _0x71b1d3[_0x984c('0x20')]()[_0x984c('0x1f')](function(){var _0x2aae8e=_0x71b1d3[_0x984c('0x21')]({'plain':!![]});var _0xdf882b='Variables';return db[_0x984c('0x22')][_0x984c('0x20')]({'where':{'type':_0xdf882b,'resourceId':_0x2aae8e['id']}})['then'](function(){return _0x71b1d3;});})['then'](function(){_0x5afdae[_0x984c('0x16')](0xcc)[_0x984c('0x23')]();});}};}function handleEntityNotFound(_0x2c7696,_0x587bfd){return function(_0x1c6193){if(!_0x1c6193){_0x2c7696[_0x984c('0x24')](0x194);}return _0x1c6193;};}function handleError(_0x362d9c,_0x2014d5){_0x2014d5=_0x2014d5||0x1f4;return function(_0x3fe24f){logger[_0x984c('0x25')](_0x3fe24f[_0x984c('0x26')]);if(_0x3fe24f[_0x984c('0x27')]){delete _0x3fe24f['name'];}_0x362d9c[_0x984c('0x16')](_0x2014d5)[_0x984c('0x28')](_0x3fe24f);};}exports[_0x984c('0x29')]=function(_0x35e51c,_0x20223c){var _0xc588f6={},_0x54164a={},_0xa66130={'count':0x0,'rows':[]};var _0x421eb2=_['map'](db[_0x984c('0x2a')][_0x984c('0x2b')],function(_0x24bcf5){return{'name':_0x24bcf5[_0x984c('0x2c')],'type':_0x24bcf5[_0x984c('0x2d')]['key']};});_0x54164a[_0x984c('0x2e')]=_[_0x984c('0x2f')](_0x421eb2,_0x984c('0x27'));_0x54164a[_0x984c('0x30')]=_[_0x984c('0x31')](_0x35e51c[_0x984c('0x30')]);_0x54164a[_0x984c('0x32')]=_['intersection'](_0x54164a[_0x984c('0x2e')],_0x54164a[_0x984c('0x30')]);_0xc588f6[_0x984c('0x33')]=_['intersection'](_0x54164a['model'],qs['fields'](_0x35e51c['query'][_0x984c('0x34')]));_0xc588f6[_0x984c('0x33')]=_0xc588f6[_0x984c('0x33')][_0x984c('0x35')]?_0xc588f6['attributes']:_0x54164a[_0x984c('0x2e')];if(!_0x35e51c[_0x984c('0x30')][_0x984c('0x36')](_0x984c('0x37'))){_0xc588f6['limit']=qs[_0x984c('0x1a')](_0x35e51c[_0x984c('0x30')][_0x984c('0x1a')]);_0xc588f6[_0x984c('0x19')]=qs[_0x984c('0x19')](_0x35e51c[_0x984c('0x30')][_0x984c('0x19')]);}_0xc588f6['order']=qs['sort'](_0x35e51c[_0x984c('0x30')][_0x984c('0x38')]);_0xc588f6[_0x984c('0x39')]=qs[_0x984c('0x32')](_[_0x984c('0x3a')](_0x35e51c[_0x984c('0x30')],_0x54164a['filters']));if(_0x35e51c[_0x984c('0x30')][_0x984c('0x3b')]){_0xc588f6[_0x984c('0x39')]=_['merge'](_0xc588f6[_0x984c('0x39')],{'$or':_['map'](_0x421eb2,function(_0x345cf0){if(_0x345cf0[_0x984c('0x2d')]!==_0x984c('0x3c')){var _0x10712c={};_0x10712c[_0x345cf0[_0x984c('0x27')]]={'$like':'%'+_0x35e51c[_0x984c('0x30')]['filter']+'%'};return _0x10712c;}})});}_0xc588f6=_['merge']({},_0xc588f6,_0x35e51c['options']);var _0x51e14d={'where':_0xc588f6[_0x984c('0x39')]};return db[_0x984c('0x2a')][_0x984c('0x18')](_0x51e14d)[_0x984c('0x1f')](function(_0x76873c){_0xa66130['count']=_0x76873c;if(_0x35e51c[_0x984c('0x30')][_0x984c('0x3d')]){_0xc588f6[_0x984c('0x3e')]=[{'all':!![]}];}return db[_0x984c('0x2a')][_0x984c('0x3f')](_0xc588f6);})[_0x984c('0x1f')](function(_0x9dae2b){_0xa66130[_0x984c('0x40')]=_0x9dae2b;return _0xa66130;})[_0x984c('0x1f')](respondWithFilteredResult(_0x20223c,_0xc588f6))[_0x984c('0x41')](handleError(_0x20223c,null));};exports[_0x984c('0x42')]=function(_0x2d5ec7,_0x437f4a){var _0x34bba5={'raw':!![],'where':{'id':_0x2d5ec7[_0x984c('0x43')]['id']}},_0x318696={};_0x318696[_0x984c('0x2e')]=_[_0x984c('0x31')](db[_0x984c('0x2a')][_0x984c('0x2b')]);_0x318696[_0x984c('0x30')]=_[_0x984c('0x31')](_0x2d5ec7[_0x984c('0x30')]);_0x318696[_0x984c('0x32')]=_['intersection'](_0x318696[_0x984c('0x2e')],_0x318696[_0x984c('0x30')]);_0x34bba5[_0x984c('0x33')]=_[_0x984c('0x44')](_0x318696['model'],qs[_0x984c('0x34')](_0x2d5ec7[_0x984c('0x30')][_0x984c('0x34')]));_0x34bba5[_0x984c('0x33')]=_0x34bba5[_0x984c('0x33')][_0x984c('0x35')]?_0x34bba5[_0x984c('0x33')]:_0x318696[_0x984c('0x2e')];if(_0x2d5ec7[_0x984c('0x30')][_0x984c('0x3d')]){_0x34bba5[_0x984c('0x3e')]=[{'all':!![]}];}_0x34bba5=_[_0x984c('0x45')]({},_0x34bba5,_0x2d5ec7['options']);return db['Variable']['find'](_0x34bba5)[_0x984c('0x1f')](handleEntityNotFound(_0x437f4a,null))[_0x984c('0x1f')](respondWithResult(_0x437f4a,null))['catch'](handleError(_0x437f4a,null));};exports['create']=function(_0x31de83,_0x49923f){return db[_0x984c('0x2a')][_0x984c('0x46')](_0x31de83[_0x984c('0x47')],{})[_0x984c('0x1f')](function(_0x414525){var _0x12ad17=_0x31de83[_0x984c('0x48')][_0x984c('0x21')]({'plain':!![]});if(!_0x12ad17)throw new Error(_0x984c('0x49'));if(_0x12ad17[_0x984c('0x4a')]===_0x984c('0x48')){var _0x4bfc06=_0x414525[_0x984c('0x21')]({'plain':!![]});var _0x1482ab='Variables';return db[_0x984c('0x4b')]['find']({'where':{'name':_0x1482ab,'userProfileId':_0x12ad17[_0x984c('0x4c')]},'raw':!![]})[_0x984c('0x1f')](function(_0x573e67){if(_0x573e67&&_0x573e67[_0x984c('0x4d')]===0x0){return db[_0x984c('0x22')]['create']({'name':_0x4bfc06[_0x984c('0x27')],'resourceId':_0x4bfc06['id'],'type':_0x573e67[_0x984c('0x27')],'sectionId':_0x573e67['id']},{})[_0x984c('0x1f')](function(){return _0x414525;});}else{return _0x414525;}})['catch'](function(_0x235058){logger[_0x984c('0x25')](_0x984c('0x4e'),_0x235058);throw _0x235058;});}return _0x414525;})['then'](respondWithResult(_0x49923f,0xc9))['catch'](handleError(_0x49923f,null));};exports[_0x984c('0x1e')]=function(_0x2180ae,_0x12a3b0){if(_0x2180ae[_0x984c('0x47')]['id']){delete _0x2180ae[_0x984c('0x47')]['id'];}return db[_0x984c('0x2a')]['find']({'where':{'id':_0x2180ae[_0x984c('0x43')]['id']}})[_0x984c('0x1f')](handleEntityNotFound(_0x12a3b0,null))[_0x984c('0x1f')](saveUpdates(_0x2180ae[_0x984c('0x47')],null))[_0x984c('0x1f')](respondWithResult(_0x12a3b0,null))[_0x984c('0x41')](handleError(_0x12a3b0,null));};exports[_0x984c('0x20')]=function(_0x5d4b22,_0x21843b){return db[_0x984c('0x2a')]['find']({'where':{'id':_0x5d4b22[_0x984c('0x43')]['id']}})[_0x984c('0x1f')](handleEntityNotFound(_0x21843b,null))[_0x984c('0x1f')](removeEntity(_0x21843b,null))['catch'](handleError(_0x21843b,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 2b666b6..a5d9599 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 _0xdbae=['path','rimraf','../../config/environment','./variable.attributes','exports','define','Variable','tools_variables','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xdbae,0x116));var _0xedba=function(_0x27990c,_0xe4288a){_0x27990c=_0x27990c-0x0;var _0x349f03=_0xdbae[_0x27990c];return _0x349f03;};'use strict';var _=require(_0xedba('0x0'));var util=require(_0xedba('0x1'));var logger=require(_0xedba('0x2'))(_0xedba('0x3'));var moment=require(_0xedba('0x4'));var BPromise=require(_0xedba('0x5'));var rp=require(_0xedba('0x6'));var fs=require('fs');var path=require(_0xedba('0x7'));var rimraf=require(_0xedba('0x8'));var config=require(_0xedba('0x9'));var attributes=require(_0xedba('0xa'));module[_0xedba('0xb')]=function(_0x5bf1b9,_0x1fae2c){return _0x5bf1b9[_0xedba('0xc')](_0xedba('0xd'),attributes,{'tableName':_0xedba('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe563=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Variable','tools_variables','lodash'];(function(_0x18150c,_0x107d6d){var _0x2b4160=function(_0x3a04ec){while(--_0x3a04ec){_0x18150c['push'](_0x18150c['shift']());}};_0x2b4160(++_0x107d6d);}(_0xe563,0x125));var _0x3e56=function(_0x5d244b,_0x37b8f3){_0x5d244b=_0x5d244b-0x0;var _0x26ba4b=_0xe563[_0x5d244b];return _0x26ba4b;};'use strict';var _=require(_0x3e56('0x0'));var util=require(_0x3e56('0x1'));var logger=require(_0x3e56('0x2'))(_0x3e56('0x3'));var moment=require(_0x3e56('0x4'));var BPromise=require(_0x3e56('0x5'));var rp=require(_0x3e56('0x6'));var fs=require('fs');var path=require(_0x3e56('0x7'));var rimraf=require(_0x3e56('0x8'));var config=require(_0x3e56('0x9'));var attributes=require('./variable.attributes');module[_0x3e56('0xa')]=function(_0x5cb14b,_0x1d6057){return _0x5cb14b[_0x3e56('0xb')](_0x3e56('0xc'),attributes,{'tableName':_0x3e56('0xd'),'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 4d7bf99..6562a29 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 _0x4770=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','error','code','message','ShowVariable','Variable','find','options','raw','where','attributes','include','map','model','stringify'];(function(_0x51d7e6,_0x41ab6a){var _0x151554=function(_0x3dc2e1){while(--_0x3dc2e1){_0x51d7e6['push'](_0x51d7e6['shift']());}};_0x151554(++_0x41ab6a);}(_0x4770,0x109));var _0x0477=function(_0x18547f,_0xac3a51){_0x18547f=_0x18547f-0x0;var _0x2e2a7e=_0x4770[_0x18547f];return _0x2e2a7e;};'use strict';var _=require(_0x0477('0x0'));var util=require(_0x0477('0x1'));var moment=require(_0x0477('0x2'));var BPromise=require(_0x0477('0x3'));var rs=require(_0x0477('0x4'));var fs=require('fs');var Redis=require(_0x0477('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0477('0x6'));var logger=require(_0x0477('0x7'))(_0x0477('0x8'));var config=require(_0x0477('0x9'));var jayson=require(_0x0477('0xa'));var client=jayson[_0x0477('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x443122,_0x11435e,_0x5c08ca){return new BPromise(function(_0x4a3d09,_0x1d49b5){return client[_0x0477('0xc')](_0x443122,_0x5c08ca)[_0x0477('0xd')](function(_0x57bd4c){logger[_0x0477('0xe')](_0x0477('0xf'),_0x11435e,_0x0477('0x10'));logger[_0x0477('0x11')]('Variable,\x20%s,\x20%s,\x20%s',_0x11435e,_0x0477('0x10'),JSON['stringify'](_0x57bd4c));if(_0x57bd4c[_0x0477('0x12')]){if(_0x57bd4c[_0x0477('0x12')][_0x0477('0x13')]===0x1f4){logger['error'](_0x0477('0xf'),_0x11435e,_0x57bd4c[_0x0477('0x12')]['message']);return _0x1d49b5(_0x57bd4c[_0x0477('0x12')]['message']);}logger[_0x0477('0x12')](_0x0477('0xf'),_0x11435e,_0x57bd4c[_0x0477('0x12')][_0x0477('0x14')]);return _0x4a3d09(_0x57bd4c[_0x0477('0x12')][_0x0477('0x14')]);}else{logger[_0x0477('0xe')](_0x0477('0xf'),_0x11435e,_0x0477('0x10'));_0x4a3d09(_0x57bd4c['result'][_0x0477('0x14')]);}})['catch'](function(_0x459e51){logger['error'](_0x0477('0xf'),_0x11435e,_0x459e51);_0x1d49b5(_0x459e51);});});}exports[_0x0477('0x15')]=function(_0x41acd9){var _0x104111=this;return new Promise(function(_0x5293ac,_0x476beb){return db[_0x0477('0x16')][_0x0477('0x17')]({'raw':_0x41acd9[_0x0477('0x18')]?_0x41acd9[_0x0477('0x18')][_0x0477('0x19')]===undefined?!![]:![]:!![],'where':_0x41acd9['options']?_0x41acd9[_0x0477('0x18')][_0x0477('0x1a')]||null:null,'attributes':_0x41acd9[_0x0477('0x18')]?_0x41acd9[_0x0477('0x18')][_0x0477('0x1b')]||null:null,'include':_0x41acd9[_0x0477('0x18')]?_0x41acd9[_0x0477('0x18')][_0x0477('0x1c')]?_[_0x0477('0x1d')](_0x41acd9[_0x0477('0x18')]['include'],function(_0x25c635){return{'model':db[_0x25c635['model']],'as':_0x25c635['as'],'attributes':_0x25c635[_0x0477('0x1b')],'include':_0x25c635[_0x0477('0x1c')]?_[_0x0477('0x1d')](_0x25c635[_0x0477('0x1c')],function(_0x258dfd){return{'model':db[_0x258dfd[_0x0477('0x1e')]],'as':_0x258dfd['as'],'attributes':_0x258dfd[_0x0477('0x1b')],'include':_0x258dfd[_0x0477('0x1c')]?_['map'](_0x258dfd[_0x0477('0x1c')],function(_0x26e074){return{'model':db[_0x26e074[_0x0477('0x1e')]],'as':_0x26e074['as'],'attributes':_0x26e074[_0x0477('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x21a4ed){logger[_0x0477('0xe')](_0x0477('0x15'),_0x41acd9);logger[_0x0477('0x11')](_0x0477('0x15'),_0x41acd9,JSON[_0x0477('0x1f')](_0x21a4ed));_0x5293ac(_0x21a4ed);})[_0x0477('0x20')](function(_0x35970e){logger['error'](_0x0477('0x15'),_0x35970e[_0x0477('0x14')],_0x41acd9);_0x476beb(_0x104111['error'](0x1f4,_0x35970e[_0x0477('0x14')]));});});}; \ No newline at end of file +var _0x2ca7=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','info','Variable,\x20%s,\x20%s','request\x20sent','Variable,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowVariable','find','options','raw','where','attributes','map','include','model','debug','stringify','lodash','util','moment'];(function(_0x51c082,_0x5ac6b2){var _0xb21207=function(_0x373603){while(--_0x373603){_0x51c082['push'](_0x51c082['shift']());}};_0xb21207(++_0x5ac6b2);}(_0x2ca7,0x1ed));var _0x72ca=function(_0x456e2b,_0x560dd9){_0x456e2b=_0x456e2b-0x0;var _0x3a432c=_0x2ca7[_0x456e2b];return _0x3a432c;};'use strict';var _=require(_0x72ca('0x0'));var util=require(_0x72ca('0x1'));var moment=require(_0x72ca('0x2'));var BPromise=require('bluebird');var rs=require(_0x72ca('0x3'));var fs=require('fs');var Redis=require(_0x72ca('0x4'));var db=require(_0x72ca('0x5'))['db'];var utils=require(_0x72ca('0x6'));var logger=require(_0x72ca('0x7'))('rpc');var config=require(_0x72ca('0x8'));var jayson=require(_0x72ca('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x135f09,_0x45e022,_0x9dfed8){return new BPromise(function(_0x171143,_0x38650e){return client[_0x72ca('0xa')](_0x135f09,_0x9dfed8)['then'](function(_0x506cce){logger[_0x72ca('0xb')](_0x72ca('0xc'),_0x45e022,_0x72ca('0xd'));logger['debug'](_0x72ca('0xe'),_0x45e022,'request\x20sent',JSON['stringify'](_0x506cce));if(_0x506cce[_0x72ca('0xf')]){if(_0x506cce[_0x72ca('0xf')][_0x72ca('0x10')]===0x1f4){logger['error']('Variable,\x20%s,\x20%s',_0x45e022,_0x506cce['error'][_0x72ca('0x11')]);return _0x38650e(_0x506cce[_0x72ca('0xf')][_0x72ca('0x11')]);}logger['error'](_0x72ca('0xc'),_0x45e022,_0x506cce[_0x72ca('0xf')][_0x72ca('0x11')]);return _0x171143(_0x506cce[_0x72ca('0xf')][_0x72ca('0x11')]);}else{logger[_0x72ca('0xb')](_0x72ca('0xc'),_0x45e022,_0x72ca('0xd'));_0x171143(_0x506cce[_0x72ca('0x12')]['message']);}})[_0x72ca('0x13')](function(_0x2b61f1){logger['error'](_0x72ca('0xc'),_0x45e022,_0x2b61f1);_0x38650e(_0x2b61f1);});});}exports[_0x72ca('0x14')]=function(_0x789461){var _0x5b23be=this;return new Promise(function(_0x243269,_0x445408){return db['Variable'][_0x72ca('0x15')]({'raw':_0x789461[_0x72ca('0x16')]?_0x789461['options'][_0x72ca('0x17')]===undefined?!![]:![]:!![],'where':_0x789461[_0x72ca('0x16')]?_0x789461[_0x72ca('0x16')][_0x72ca('0x18')]||null:null,'attributes':_0x789461[_0x72ca('0x16')]?_0x789461[_0x72ca('0x16')][_0x72ca('0x19')]||null:null,'include':_0x789461['options']?_0x789461[_0x72ca('0x16')]['include']?_[_0x72ca('0x1a')](_0x789461[_0x72ca('0x16')][_0x72ca('0x1b')],function(_0x2d848c){return{'model':db[_0x2d848c['model']],'as':_0x2d848c['as'],'attributes':_0x2d848c[_0x72ca('0x19')],'include':_0x2d848c[_0x72ca('0x1b')]?_[_0x72ca('0x1a')](_0x2d848c[_0x72ca('0x1b')],function(_0x3949e2){return{'model':db[_0x3949e2['model']],'as':_0x3949e2['as'],'attributes':_0x3949e2[_0x72ca('0x19')],'include':_0x3949e2['include']?_[_0x72ca('0x1a')](_0x3949e2[_0x72ca('0x1b')],function(_0x160dcb){return{'model':db[_0x160dcb[_0x72ca('0x1c')]],'as':_0x160dcb['as'],'attributes':_0x160dcb['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x42f0b3){logger['info']('ShowVariable',_0x789461);logger[_0x72ca('0x1d')](_0x72ca('0x14'),_0x789461,JSON[_0x72ca('0x1e')](_0x42f0b3));_0x243269(_0x42f0b3);})['catch'](function(_0x373e17){logger[_0x72ca('0xf')](_0x72ca('0x14'),_0x373e17[_0x72ca('0x11')],_0x789461);_0x445408(_0x5b23be[_0x72ca('0xf')](0x1f4,_0x373e17['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index e169c8f..73015b5 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 _0x2a23=['/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull','restart','migrations','exports','express','Router','get','index'];(function(_0x1a12c8,_0x2df4dc){var _0x305109=function(_0x438bfb){while(--_0x438bfb){_0x1a12c8['push'](_0x1a12c8['shift']());}};_0x305109(++_0x2df4dc);}(_0x2a23,0x65));var _0x32a2=function(_0x5f58f4,_0x3bea9a){_0x5f58f4=_0x5f58f4-0x0;var _0x4165a3=_0x2a23[_0x5f58f4];return _0x4165a3;};'use strict';var express=require(_0x32a2('0x0'));var router=express[_0x32a2('0x1')]();var auth=require('../../components/auth/service');var controller=require('./version.controller');router[_0x32a2('0x2')]('/',controller[_0x32a2('0x3')]);router[_0x32a2('0x2')](_0x32a2('0x4'),auth[_0x32a2('0x5')](),auth[_0x32a2('0x6')](),controller[_0x32a2('0x7')]);router['get'](_0x32a2('0x8'),auth[_0x32a2('0x5')](),auth[_0x32a2('0x6')](),controller[_0x32a2('0x9')]);router[_0x32a2('0x2')](_0x32a2('0xa'),auth[_0x32a2('0x5')](),auth['canUpdate'](),controller[_0x32a2('0xb')]);router[_0x32a2('0x2')]('/restart',auth['isAuthenticated'](),controller[_0x32a2('0xc')]);router[_0x32a2('0x2')]('/migrations',controller[_0x32a2('0xd')]);module[_0x32a2('0xe')]=router; \ No newline at end of file +var _0x1c3d=['pull','/restart','/migrations','migrations','express','../../components/auth/service','get','/fetch','canUpdate','fetch','isAuthenticated','reset','/pull'];(function(_0x584497,_0x52e264){var _0x2e5d3e=function(_0x2e5fec){while(--_0x2e5fec){_0x584497['push'](_0x584497['shift']());}};_0x2e5d3e(++_0x52e264);}(_0x1c3d,0x12f));var _0xd1c3=function(_0x90e597,_0x5e2cb2){_0x90e597=_0x90e597-0x0;var _0x530763=_0x1c3d[_0x90e597];return _0x530763;};'use strict';var express=require(_0xd1c3('0x0'));var router=express['Router']();var auth=require(_0xd1c3('0x1'));var controller=require('./version.controller');router[_0xd1c3('0x2')]('/',controller['index']);router['get'](_0xd1c3('0x3'),auth['isAuthenticated'](),auth[_0xd1c3('0x4')](),controller[_0xd1c3('0x5')]);router[_0xd1c3('0x2')]('/reset',auth[_0xd1c3('0x6')](),auth[_0xd1c3('0x4')](),controller[_0xd1c3('0x7')]);router[_0xd1c3('0x2')](_0xd1c3('0x8'),auth[_0xd1c3('0x6')](),auth[_0xd1c3('0x4')](),controller[_0xd1c3('0x9')]);router[_0xd1c3('0x2')](_0xd1c3('0xa'),auth[_0xd1c3('0x6')](),controller['restart']);router[_0xd1c3('0x2')](_0xd1c3('0xb'),controller[_0xd1c3('0xc')]);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 7cc1abf..6a1fe66 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 _0x404d=['exports','sort','Migration','sequelize','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/pm2','../../config/logger','simple-git','root','query','latest','fetch','2.0.0','status','json','origin','master','error','info','git\x20fetch','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','length','.js'];(function(_0x2b75b4,_0x85c44f){var _0x2cf83e=function(_0x512bba){while(--_0x512bba){_0x2b75b4['push'](_0x2b75b4['shift']());}};_0x2cf83e(++_0x85c44f);}(_0x404d,0x1e9));var _0xd404=function(_0x4799bc,_0x494ffd){_0x4799bc=_0x4799bc-0x0;var _0x8f91fc=_0x404d[_0x4799bc];return _0x8f91fc;};'use strict';var Umzug=require(_0xd404('0x0'));var path=require(_0xd404('0x1'));var fs=require('fs');var _=require(_0xd404('0x2'));var pkginfo=require(_0xd404('0x3'))(module,_0xd404('0x4'));var compareVersions=require(_0xd404('0x5'));var exec=require(_0xd404('0x6'))[_0xd404('0x7')];var db=require(_0xd404('0x8'))['db'];var config=require('../../config/environment');var pm2=require(_0xd404('0x9'));var logger=require(_0xd404('0xa'))('update');var git=require(_0xd404('0xb'))(config[_0xd404('0xc')]);exports['index']=function(_0x5c335f,_0x10021a){var _0x3d7e8a={'current':module['exports']['version'],'phonebar':0x2};if(_0x5c335f[_0xd404('0xd')]&&_0x5c335f[_0xd404('0xd')][_0xd404('0xe')]){return git[_0xd404('0xf')]()['tags'](function(_0x4b60f2,_0x3b0ee1){_0x3d7e8a[_0xd404('0xe')]=(_0x4b60f2?module['exports'][_0xd404('0x4')]:_0x3b0ee1[_0xd404('0xe')])||_0xd404('0x10');return _0x10021a[_0xd404('0x11')](0xc8)[_0xd404('0x12')](_0x3d7e8a);});}else{return _0x10021a[_0xd404('0x11')](0xc8)[_0xd404('0x12')](_0x3d7e8a);}};exports[_0xd404('0xf')]=function(_0x1b0dcd,_0x31c8f8){return git[_0xd404('0xf')]([_0xd404('0x13'),_0xd404('0x14')],function(_0x6d79a4){if(_0x6d79a4){logger[_0xd404('0x15')](_0x6d79a4);return _0x31c8f8[_0xd404('0x11')](0x1f4)[_0xd404('0x12')](_0x6d79a4);}logger[_0xd404('0x16')](_0xd404('0x17'));return _0x31c8f8[_0xd404('0x11')](0xc8)[_0xd404('0x12')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0xd404('0x18')]=function(_0x8bdcd1,_0x5e19e4){return git[_0xd404('0x18')]([_0xd404('0x19'),'FETCH_HEAD'],function(_0x209a6b){if(_0x209a6b){logger[_0xd404('0x15')](_0x209a6b);return _0x5e19e4[_0xd404('0x11')](0x1f4)['json'](_0x209a6b);}logger[_0xd404('0x16')](_0xd404('0x1a'));return _0x5e19e4[_0xd404('0x11')](0xc8)[_0xd404('0x12')]({'output':_0xd404('0x1b')});});};exports[_0xd404('0x1c')]=function(_0x458f6e,_0x5c0264){exec(_0xd404('0x1d'),function(_0xcc7bf1,_0x50c0e2,_0x17d0e6){logger['info'](_0x50c0e2);logger['info'](_0x17d0e6);if(_0xcc7bf1){logger[_0xd404('0x15')](_0xcc7bf1);return _0x5c0264[_0xd404('0x11')](0x1f4)[_0xd404('0x12')](_0xcc7bf1);}return _0x5c0264[_0xd404('0x11')](0xc8)['json']({'output':_0x50c0e2});});};exports[_0xd404('0x1e')]=function(_0x2a5d84,_0x13af69){return pm2['restart']('motion2')[_0xd404('0x1f')](function(_0xaccaa8){logger[_0xd404('0x16')](_0xd404('0x20'),_0xaccaa8);return _0x13af69[_0xd404('0x11')](0xc8)[_0xd404('0x12')]({'output':_0xd404('0x21')});})[_0xd404('0x22')](function(_0x586b97){logger['error'](_0x586b97);return _0x13af69[_0xd404('0x11')](0x1f4)['json'](_0x586b97);});};exports[_0xd404('0x23')]=function(_0x4f210c,_0x23525b){var _0x1e6341=fs[_0xd404('0x24')](path[_0xd404('0x25')](config[_0xd404('0xc')],_0xd404('0x26'),_0xd404('0x23')));var _0x4ece21=[];for(var _0x585b67=0x0;_0x585b67<_0x1e6341[_0xd404('0x27')];_0x585b67++){var _0x541c78=_0x1e6341[_0x585b67]['replace'](_0xd404('0x28'),'');if(compareVersions(module[_0xd404('0x29')][_0xd404('0x4')],_0x541c78)===-0x1){_0x4ece21['push'](_0x541c78);}}if(_0x4ece21[_0xd404('0x27')]){var _0x54f0c5=_0x4ece21[_0xd404('0x2a')](compareVersions);var _0x1de7b9=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0xd404('0x2b')],'modelName':_0xd404('0x2b'),'columnName':_0xd404('0x4')},'migrations':{'params':[db[_0xd404('0x2c')][_0xd404('0x2d')](),db['sequelize'][_0xd404('0x2e')],function(){throw new Error(_0xd404('0x2f'));}],'path':path[_0xd404('0x25')](config['root'],_0xd404('0x26'),_0xd404('0x23')),'pattern':/\.js$/}});_0x1de7b9['up']({'migrations':_[_0xd404('0x30')](_0x54f0c5,function(_0x296331){return _0x296331+'.js';})})['then'](function(){return _0x23525b[_0xd404('0x11')](0xc8)[_0xd404('0x12')]({'output':_0xd404('0x31')+module[_0xd404('0x29')][_0xd404('0x4')]+_0xd404('0x32')+_['last'](_0x54f0c5),'migrations':_[_0xd404('0x25')](_0x54f0c5)});})[_0xd404('0x22')](function(_0x1f5675){if(_0x1f5675 instanceof db['sequelize'][_0xd404('0x33')]){return _0x23525b[_0xd404('0x11')](0xc8)[_0xd404('0x12')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x23525b[_0xd404('0x11')](0x1f4)[_0xd404('0x12')](_0x1f5675);}});}else{return _0x23525b[_0xd404('0x11')](0xc8)['json']({'output':_0xd404('0x34')});}}; \ No newline at end of file +var _0xb4d9=['../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','query','latest','fetch','tags','2.0.0','status','json','origin','error','info','git\x20fetch','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','motion2','then','catch','readdirSync','server','migrations','length','replace','.js','push','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','map','last','Database\x20already\x20up-to-date','umzug','path','pkginfo','version','compare-versions','exec'];(function(_0x5bb8c4,_0x5bf924){var _0x32150e=function(_0xb233e6){while(--_0xb233e6){_0x5bb8c4['push'](_0x5bb8c4['shift']());}};_0x32150e(++_0x5bf924);}(_0xb4d9,0xce));var _0x9b4d=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0xb4d9[_0x1beef3];return _0x5af964;};'use strict';var Umzug=require(_0x9b4d('0x0'));var path=require(_0x9b4d('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x9b4d('0x2'))(module,_0x9b4d('0x3'));var compareVersions=require(_0x9b4d('0x4'));var exec=require('child_process')[_0x9b4d('0x5')];var db=require(_0x9b4d('0x6'))['db'];var config=require(_0x9b4d('0x7'));var pm2=require(_0x9b4d('0x8'));var logger=require(_0x9b4d('0x9'))(_0x9b4d('0xa'));var git=require(_0x9b4d('0xb'))(config[_0x9b4d('0xc')]);exports[_0x9b4d('0xd')]=function(_0x14cb0b,_0x156c68){var _0x48832a={'current':module[_0x9b4d('0xe')]['version'],'phonebar':0x2};if(_0x14cb0b[_0x9b4d('0xf')]&&_0x14cb0b['query'][_0x9b4d('0x10')]){return git[_0x9b4d('0x11')]()[_0x9b4d('0x12')](function(_0x18173c,_0x176759){_0x48832a[_0x9b4d('0x10')]=(_0x18173c?module[_0x9b4d('0xe')][_0x9b4d('0x3')]:_0x176759[_0x9b4d('0x10')])||_0x9b4d('0x13');return _0x156c68[_0x9b4d('0x14')](0xc8)[_0x9b4d('0x15')](_0x48832a);});}else{return _0x156c68['status'](0xc8)[_0x9b4d('0x15')](_0x48832a);}};exports[_0x9b4d('0x11')]=function(_0x256486,_0x3c4ae0){return git['fetch']([_0x9b4d('0x16'),'master'],function(_0x5d857b){if(_0x5d857b){logger[_0x9b4d('0x17')](_0x5d857b);return _0x3c4ae0[_0x9b4d('0x14')](0x1f4)[_0x9b4d('0x15')](_0x5d857b);}logger[_0x9b4d('0x18')](_0x9b4d('0x19'));return _0x3c4ae0[_0x9b4d('0x14')](0xc8)['json']({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x9b4d('0x1a')]=function(_0x2ef351,_0x15e808){return git[_0x9b4d('0x1a')]([_0x9b4d('0x1b'),_0x9b4d('0x1c')],function(_0x1c277d){if(_0x1c277d){logger[_0x9b4d('0x17')](_0x1c277d);return _0x15e808[_0x9b4d('0x14')](0x1f4)[_0x9b4d('0x15')](_0x1c277d);}logger[_0x9b4d('0x18')](_0x9b4d('0x1d'));return _0x15e808[_0x9b4d('0x14')](0xc8)[_0x9b4d('0x15')]({'output':_0x9b4d('0x1e')});});};exports[_0x9b4d('0x1f')]=function(_0x2c5d05,_0x2a9d1a){exec(_0x9b4d('0x20'),function(_0x35a282,_0x5ea613,_0x3a698f){logger[_0x9b4d('0x18')](_0x5ea613);logger[_0x9b4d('0x18')](_0x3a698f);if(_0x35a282){logger['error'](_0x35a282);return _0x2a9d1a[_0x9b4d('0x14')](0x1f4)['json'](_0x35a282);}return _0x2a9d1a['status'](0xc8)[_0x9b4d('0x15')]({'output':_0x5ea613});});};exports['restart']=function(_0x450972,_0x39c2bb){return pm2['restart'](_0x9b4d('0x21'))[_0x9b4d('0x22')](function(_0x3a2f5f){logger['info']('pm2\x20restart\x20motion\x20%s',_0x3a2f5f);return _0x39c2bb[_0x9b4d('0x14')](0xc8)[_0x9b4d('0x15')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x9b4d('0x23')](function(_0x5d639b){logger[_0x9b4d('0x17')](_0x5d639b);return _0x39c2bb['status'](0x1f4)[_0x9b4d('0x15')](_0x5d639b);});};exports['migrations']=function(_0x2fdd31,_0xf006aa){var _0x5e9d1b=fs[_0x9b4d('0x24')](path['join'](config['root'],_0x9b4d('0x25'),_0x9b4d('0x26')));var _0x4f9382=[];for(var _0x51459b=0x0;_0x51459b<_0x5e9d1b[_0x9b4d('0x27')];_0x51459b++){var _0x3b1954=_0x5e9d1b[_0x51459b][_0x9b4d('0x28')](_0x9b4d('0x29'),'');if(compareVersions(module[_0x9b4d('0xe')][_0x9b4d('0x3')],_0x3b1954)===-0x1){_0x4f9382[_0x9b4d('0x2a')](_0x3b1954);}}if(_0x4f9382[_0x9b4d('0x27')]){var _0x37fc10=_0x4f9382[_0x9b4d('0x2b')](compareVersions);var _0x27d10c=new Umzug({'storage':_0x9b4d('0x2c'),'storageOptions':{'model':db[_0x9b4d('0x2d')],'modelName':_0x9b4d('0x2d'),'columnName':_0x9b4d('0x3')},'migrations':{'params':[db['sequelize'][_0x9b4d('0x2e')](),db['sequelize'][_0x9b4d('0x2f')],function(){throw new Error(_0x9b4d('0x30'));}],'path':path[_0x9b4d('0x31')](config[_0x9b4d('0xc')],_0x9b4d('0x25'),_0x9b4d('0x26')),'pattern':/\.js$/}});_0x27d10c['up']({'migrations':_[_0x9b4d('0x32')](_0x37fc10,function(_0x50a3fb){return _0x50a3fb+_0x9b4d('0x29');})})[_0x9b4d('0x22')](function(){return _0xf006aa[_0x9b4d('0x14')](0xc8)['json']({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x9b4d('0xe')]['version']+'\x20to\x20'+_[_0x9b4d('0x33')](_0x37fc10),'migrations':_[_0x9b4d('0x31')](_0x37fc10)});})[_0x9b4d('0x23')](function(_0x40310f){if(_0x40310f instanceof db[_0x9b4d('0x2c')]['UniqueConstraintError']){return _0xf006aa[_0x9b4d('0x14')](0xc8)[_0x9b4d('0x15')]({'output':'Database\x20already\x20up-to-date'});}else{return _0xf006aa[_0x9b4d('0x14')](0x1f4)[_0x9b4d('0x15')](_0x40310f);}});}else{return _0xf006aa[_0x9b4d('0x14')](0xc8)[_0x9b4d('0x15')]({'output':_0x9b4d('0x34')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 2b12b85..dd80fdd 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 _0x8897=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','post','/:id','update','delete','destroy','exports','multer','util','path','express'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0x8897,0x74));var _0x7889=function(_0x4b458f,_0x1c9b9d){_0x4b458f=_0x4b458f-0x0;var _0x854ebf=_0x8897[_0x4b458f];return _0x854ebf;};'use strict';var multer=require(_0x7889('0x0'));var util=require(_0x7889('0x1'));var path=require(_0x7889('0x2'));var timeout=require('connect-timeout');var express=require(_0x7889('0x3'));var router=express[_0x7889('0x4')]();var auth=require(_0x7889('0x5'));var interaction=require(_0x7889('0x6'));var config=require(_0x7889('0x7'));var controller=require('./voiceAgentReport.controller');router[_0x7889('0x8')]('/',auth[_0x7889('0x9')](),controller[_0x7889('0xa')]);router[_0x7889('0x8')](_0x7889('0xb'),auth[_0x7889('0x9')](),controller[_0x7889('0xc')]);router[_0x7889('0x8')]('/:id',auth[_0x7889('0x9')](),controller[_0x7889('0xd')]);router[_0x7889('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x7889('0xf'),auth[_0x7889('0x9')](),controller[_0x7889('0x10')]);router[_0x7889('0x11')](_0x7889('0xf'),auth[_0x7889('0x9')](),controller[_0x7889('0x12')]);module[_0x7889('0x13')]=router; \ No newline at end of file +var _0x94a4=['describe','post','create','put','isAuthenticated','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','index','get','/describe'];(function(_0x421d61,_0x44a00f){var _0x43e814=function(_0x284ddc){while(--_0x284ddc){_0x421d61['push'](_0x421d61['shift']());}};_0x43e814(++_0x44a00f);}(_0x94a4,0x1e2));var _0x494a=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0x94a4[_0x39e283];return _0x7de89f;};'use strict';var multer=require(_0x494a('0x0'));var util=require(_0x494a('0x1'));var path=require(_0x494a('0x2'));var timeout=require('connect-timeout');var express=require(_0x494a('0x3'));var router=express[_0x494a('0x4')]();var auth=require(_0x494a('0x5'));var interaction=require(_0x494a('0x6'));var config=require(_0x494a('0x7'));var controller=require(_0x494a('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x494a('0x9')]);router[_0x494a('0xa')](_0x494a('0xb'),auth['isAuthenticated'](),controller[_0x494a('0xc')]);router[_0x494a('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x494a('0xd')]('/',auth['isAuthenticated'](),controller[_0x494a('0xe')]);router[_0x494a('0xf')]('/:id',auth[_0x494a('0x10')](),controller['update']);router[_0x494a('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x494a('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 7240ffa..7804a01 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 _0x6f47=['FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x5ce5a5,_0x260eca){var _0x22f043=function(_0x5563a0){while(--_0x5563a0){_0x5ce5a5['push'](_0x5ce5a5['shift']());}};_0x22f043(++_0x260eca);}(_0x6f47,0xc7));var _0x76f4=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x6f47[_0x126558];return _0x1f6d14;};'use strict';var Sequelize=require('sequelize');module[_0x76f4('0x0')]={'type':{'type':Sequelize[_0x76f4('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x76f4('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x76f4('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x76f4('0x1')]},'agentcalledAt':{'type':Sequelize[_0x76f4('0x2')]},'agentconnectAt':{'type':Sequelize[_0x76f4('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x76f4('0x2')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x76f4('0x2')]},'holdtime':{'type':Sequelize[_0x76f4('0x3')]},'agentcomplete':{'type':Sequelize[_0x76f4('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x76f4('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x76f4('0x3')]},'agentacw':{'type':Sequelize[_0x76f4('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x76f4('0x3')]},'reason':{'type':Sequelize[_0x76f4('0x1')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x76f4('0x3')]},'channelstatedesc':{'type':Sequelize[_0x76f4('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x76f4('0x1')]},'accountcode':{'type':Sequelize[_0x76f4('0x1')]},'context':{'type':Sequelize[_0x76f4('0x1')]},'exten':{'type':Sequelize[_0x76f4('0x1')]},'priority':{'type':Sequelize[_0x76f4('0x1')]},'destchannel':{'type':Sequelize[_0x76f4('0x1')]},'destchannelstate':{'type':Sequelize[_0x76f4('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x76f4('0x1')]},'destcalleridnum':{'type':Sequelize[_0x76f4('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x76f4('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x76f4('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x76f4('0x1')]},'destpriority':{'type':Sequelize[_0x76f4('0x1')]},'destuniqueid':{'type':Sequelize[_0x76f4('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x76f4('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x76f4('0x1')]},'transfer':{'type':Sequelize[_0x76f4('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x76f4('0x1')],'comment':_0x76f4('0x5')},'transferexten':{'type':Sequelize[_0x76f4('0x1')]},'transferuniqueid':{'type':Sequelize[_0x76f4('0x1')]},'agententerreason':{'type':Sequelize[_0x76f4('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5075=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE'];(function(_0x273c66,_0x346773){var _0x4a574e=function(_0x460d09){while(--_0x460d09){_0x273c66['push'](_0x273c66['shift']());}};_0x4a574e(++_0x346773);}(_0x5075,0x73));var _0x5507=function(_0x470f63,_0x48d80b){_0x470f63=_0x470f63-0x0;var _0x4f09e2=_0x5075[_0x470f63];return _0x4f09e2;};'use strict';var Sequelize=require(_0x5507('0x0'));module[_0x5507('0x1')]={'type':{'type':Sequelize[_0x5507('0x2')]},'uniqueid':{'type':Sequelize[_0x5507('0x2')]},'calleridnum':{'type':Sequelize[_0x5507('0x2')]},'calleridname':{'type':Sequelize[_0x5507('0x2')]},'queue':{'type':Sequelize[_0x5507('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x5507('0x2')]},'agentcalledAt':{'type':Sequelize[_0x5507('0x3')]},'agentconnectAt':{'type':Sequelize[_0x5507('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x5507('0x3')]},'holdtime':{'type':Sequelize[_0x5507('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x5507('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x5507('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x5507('0x4')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x5507('0x2')]},'lastevent':{'type':Sequelize[_0x5507('0x2')]},'channel':{'type':Sequelize[_0x5507('0x2')]},'channelstate':{'type':Sequelize[_0x5507('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x5507('0x2')]},'connectedlinename':{'type':Sequelize[_0x5507('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x5507('0x2')]},'context':{'type':Sequelize[_0x5507('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x5507('0x2')]},'destchannel':{'type':Sequelize[_0x5507('0x2')]},'destchannelstate':{'type':Sequelize[_0x5507('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x5507('0x2')]},'destcalleridnum':{'type':Sequelize[_0x5507('0x2')]},'destcalleridname':{'type':Sequelize[_0x5507('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x5507('0x2')]},'destlanguage':{'type':Sequelize[_0x5507('0x2')]},'destaccountcode':{'type':Sequelize[_0x5507('0x2')]},'destcontext':{'type':Sequelize[_0x5507('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x5507('0x2')]},'destuniqueid':{'type':Sequelize[_0x5507('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x5507('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x5507('0x2')]},'transfer':{'type':Sequelize[_0x5507('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x5507('0x2')],'comment':_0x5507('0x6')},'transferexten':{'type':Sequelize[_0x5507('0x2')]},'transferuniqueid':{'type':Sequelize[_0x5507('0x2')]},'agententerreason':{'type':Sequelize[_0x5507('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 55edbcc..564ec8d 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 _0x9b70=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','index','map','VoiceAgentReport','fieldName','type','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','params','rawAttributes','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x5b9e59,_0x56a31b){var _0x300560=function(_0x1b5b43){while(--_0x1b5b43){_0x5b9e59['push'](_0x5b9e59['shift']());}};_0x300560(++_0x56a31b);}(_0x9b70,0xc8));var _0x09b7=function(_0x18b344,_0x271f68){_0x18b344=_0x18b344-0x0;var _0x5ef6bb=_0x9b70[_0x18b344];return _0x5ef6bb;};'use strict';var pdf=require(_0x09b7('0x0'));var emlformat=require(_0x09b7('0x1'));var rimraf=require(_0x09b7('0x2'));var zipdir=require(_0x09b7('0x3'));var jsonpatch=require(_0x09b7('0x4'));var rp=require(_0x09b7('0x5'));var moment=require(_0x09b7('0x6'));var BPromise=require(_0x09b7('0x7'));var Mustache=require('mustache');var util=require(_0x09b7('0x8'));var path=require(_0x09b7('0x9'));var sox=require(_0x09b7('0xa'));var csv=require(_0x09b7('0xb'));var ejs=require(_0x09b7('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x09b7('0xd'));var jsforce=require(_0x09b7('0xe'));var deskjs=require(_0x09b7('0xf'));var toCsv=require(_0x09b7('0xb'));var querystring=require(_0x09b7('0x10'));var Papa=require(_0x09b7('0x11'));var Redis=require(_0x09b7('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x09b7('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x09b7('0x14'));var logger=require(_0x09b7('0x15'))(_0x09b7('0x16'));var utils=require(_0x09b7('0x17'));var config=require(_0x09b7('0x18'));var db=require(_0x09b7('0x19'))['db'];function respondWithStatusCode(_0x4b5e0e,_0x472d3d){_0x472d3d=_0x472d3d||0xcc;return function(_0x508d18){if(_0x508d18){return _0x4b5e0e[_0x09b7('0x1a')](_0x472d3d);}return _0x4b5e0e[_0x09b7('0x1b')](_0x472d3d)[_0x09b7('0x1c')]();};}function respondWithResult(_0x193fb5,_0x2e962e){_0x2e962e=_0x2e962e||0xc8;return function(_0x4785c4){if(_0x4785c4){return _0x193fb5['status'](_0x2e962e)['json'](_0x4785c4);}};}function respondWithFilteredResult(_0x362f9e,_0x2cd81c){return function(_0x3d64a6){if(_0x3d64a6){var _0x305e57=_0x3d64a6[_0x09b7('0x1d')],_0xa0a930=_0x2cd81c[_0x09b7('0x1e')],_0x3850a9=_0x2cd81c[_0x09b7('0x1e')]+_0x2cd81c[_0x09b7('0x1f')],_0x2959db;if(_0x3850a9>=_0x305e57){_0x3850a9=_0x305e57;_0x2959db=0xc8;}else{_0x2959db=0xce;}_0x362f9e[_0x09b7('0x1b')](_0x2959db);return _0x362f9e[_0x09b7('0x20')](_0x09b7('0x21'),_0xa0a930+'-'+_0x3850a9+'/'+_0x305e57)[_0x09b7('0x22')](_0x3d64a6);}return null;};}function patchUpdates(_0x4597f7){return function(_0x5da7db){try{jsonpatch[_0x09b7('0x23')](_0x5da7db,_0x4597f7,!![]);}catch(_0x56aae5){return BPromise[_0x09b7('0x24')](_0x56aae5);}return _0x5da7db['save']();};}function saveUpdates(_0xa39d83,_0x48841b){return function(_0x51f39f){if(_0x51f39f){return _0x51f39f[_0x09b7('0x25')](_0xa39d83)[_0x09b7('0x26')](function(_0x9add1f){return _0x9add1f;});}return null;};}function removeEntity(_0x21305a,_0x5348dc){return function(_0x2f084e){if(_0x2f084e){return _0x2f084e[_0x09b7('0x27')]()[_0x09b7('0x26')](function(){_0x21305a['status'](0xcc)[_0x09b7('0x1c')]();});}};}function handleEntityNotFound(_0x298adb,_0x29212a){return function(_0x181cc2){if(!_0x181cc2){_0x298adb[_0x09b7('0x1a')](0x194);}return _0x181cc2;};}function handleError(_0x1d8ab9,_0x5ca602){_0x5ca602=_0x5ca602||0x1f4;return function(_0x1ac825){logger[_0x09b7('0x28')](_0x1ac825[_0x09b7('0x29')]);if(_0x1ac825[_0x09b7('0x2a')]){delete _0x1ac825[_0x09b7('0x2a')];}_0x1d8ab9['status'](_0x5ca602)['send'](_0x1ac825);};}exports[_0x09b7('0x2b')]=function(_0x6041a3,_0x1c3b93){var _0x580101={},_0x2ff96b={},_0x182bd4={'count':0x0,'rows':[]};var _0x1dc2ff=_[_0x09b7('0x2c')](db[_0x09b7('0x2d')]['rawAttributes'],function(_0x17449c){return{'name':_0x17449c[_0x09b7('0x2e')],'type':_0x17449c[_0x09b7('0x2f')][_0x09b7('0x30')]};});_0x2ff96b['model']=_['map'](_0x1dc2ff,'name');_0x2ff96b[_0x09b7('0x31')]=_[_0x09b7('0x32')](_0x6041a3[_0x09b7('0x31')]);_0x2ff96b[_0x09b7('0x33')]=_[_0x09b7('0x34')](_0x2ff96b['model'],_0x2ff96b[_0x09b7('0x31')]);_0x580101[_0x09b7('0x35')]=_[_0x09b7('0x34')](_0x2ff96b['model'],qs[_0x09b7('0x36')](_0x6041a3[_0x09b7('0x31')]['fields']));_0x580101[_0x09b7('0x35')]=_0x580101[_0x09b7('0x35')][_0x09b7('0x37')]?_0x580101[_0x09b7('0x35')]:_0x2ff96b[_0x09b7('0x38')];if(!_0x6041a3[_0x09b7('0x31')][_0x09b7('0x39')]('nolimit')){_0x580101['limit']=qs['limit'](_0x6041a3['query'][_0x09b7('0x1f')]);_0x580101[_0x09b7('0x1e')]=qs[_0x09b7('0x1e')](_0x6041a3[_0x09b7('0x31')][_0x09b7('0x1e')]);}_0x580101['order']=qs[_0x09b7('0x3a')](_0x6041a3['query'][_0x09b7('0x3a')]);_0x580101[_0x09b7('0x3b')]=qs[_0x09b7('0x33')](_[_0x09b7('0x3c')](_0x6041a3[_0x09b7('0x31')],_0x2ff96b[_0x09b7('0x33')]));if(_0x6041a3[_0x09b7('0x31')][_0x09b7('0x3d')]){_0x580101['where']=_[_0x09b7('0x3e')](_0x580101[_0x09b7('0x3b')],{'$or':_[_0x09b7('0x2c')](_0x1dc2ff,function(_0x304a2d){if(_0x304a2d[_0x09b7('0x2f')]!==_0x09b7('0x3f')){var _0x477d2d={};_0x477d2d[_0x304a2d['name']]={'$like':'%'+_0x6041a3['query'][_0x09b7('0x3d')]+'%'};return _0x477d2d;}})});}_0x580101=_[_0x09b7('0x3e')]({},_0x580101,_0x6041a3[_0x09b7('0x40')]);var _0x41ccfd={'where':_0x580101[_0x09b7('0x3b')]};return db[_0x09b7('0x2d')][_0x09b7('0x1d')](_0x41ccfd)[_0x09b7('0x26')](function(_0x3c4bc0){_0x182bd4[_0x09b7('0x1d')]=_0x3c4bc0;if(_0x6041a3['query'][_0x09b7('0x41')]){_0x580101[_0x09b7('0x42')]=[{'all':!![]}];}return db[_0x09b7('0x2d')][_0x09b7('0x43')](_0x580101);})[_0x09b7('0x26')](function(_0x33f549){_0x182bd4['rows']=_0x33f549;return _0x182bd4;})[_0x09b7('0x26')](respondWithFilteredResult(_0x1c3b93,_0x580101))['catch'](handleError(_0x1c3b93,null));};exports['show']=function(_0x3136e3,_0x36b76f){var _0x40ecd7={'raw':![],'where':{'id':_0x3136e3[_0x09b7('0x44')]['id']}},_0x5882ab={};_0x5882ab[_0x09b7('0x38')]=_[_0x09b7('0x32')](db[_0x09b7('0x2d')][_0x09b7('0x45')]);_0x5882ab[_0x09b7('0x31')]=_[_0x09b7('0x32')](_0x3136e3['query']);_0x5882ab[_0x09b7('0x33')]=_[_0x09b7('0x34')](_0x5882ab[_0x09b7('0x38')],_0x5882ab[_0x09b7('0x31')]);_0x40ecd7[_0x09b7('0x35')]=_[_0x09b7('0x34')](_0x5882ab[_0x09b7('0x38')],qs['fields'](_0x3136e3[_0x09b7('0x31')][_0x09b7('0x36')]));_0x40ecd7[_0x09b7('0x35')]=_0x40ecd7['attributes'][_0x09b7('0x37')]?_0x40ecd7['attributes']:_0x5882ab[_0x09b7('0x38')];if(_0x3136e3[_0x09b7('0x31')][_0x09b7('0x41')]){_0x40ecd7[_0x09b7('0x42')]=[{'all':!![]}];}_0x40ecd7=_[_0x09b7('0x3e')]({},_0x40ecd7,_0x3136e3[_0x09b7('0x40')]);return db['VoiceAgentReport'][_0x09b7('0x46')](_0x40ecd7)[_0x09b7('0x26')](handleEntityNotFound(_0x36b76f,null))[_0x09b7('0x26')](respondWithResult(_0x36b76f,null))[_0x09b7('0x47')](handleError(_0x36b76f,null));};exports[_0x09b7('0x48')]=function(_0x11613d,_0x13dd20){return db[_0x09b7('0x2d')]['create'](_0x11613d[_0x09b7('0x49')],{})[_0x09b7('0x26')](respondWithResult(_0x13dd20,0xc9))[_0x09b7('0x47')](handleError(_0x13dd20,null));};exports['update']=function(_0x590aa2,_0x252e42){if(_0x590aa2[_0x09b7('0x49')]['id']){delete _0x590aa2[_0x09b7('0x49')]['id'];}return db[_0x09b7('0x2d')][_0x09b7('0x46')]({'where':{'id':_0x590aa2[_0x09b7('0x44')]['id']}})[_0x09b7('0x26')](handleEntityNotFound(_0x252e42,null))['then'](saveUpdates(_0x590aa2[_0x09b7('0x49')],null))[_0x09b7('0x26')](respondWithResult(_0x252e42,null))[_0x09b7('0x47')](handleError(_0x252e42,null));};exports['destroy']=function(_0x3e3688,_0xf0a577){return db[_0x09b7('0x2d')][_0x09b7('0x46')]({'where':{'id':_0x3e3688[_0x09b7('0x44')]['id']}})[_0x09b7('0x26')](handleEntityNotFound(_0xf0a577,null))[_0x09b7('0x26')](removeEntity(_0xf0a577,null))[_0x09b7('0x47')](handleError(_0xf0a577,null));};exports['describe']=function(_0x6f1061,_0x16fbe6){return db[_0x09b7('0x2d')]['describe']()[_0x09b7('0x26')](respondWithResult(_0x16fbe6,null))['catch'](handleError(_0x16fbe6,null));}; \ No newline at end of file +var _0x2f8c=['update','then','destroy','end','error','stack','name','send','map','VoiceAgentReport','rawAttributes','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','catch','show','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','apply','reject'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x2f8c,0x1e3));var _0xc2f8=function(_0x41ac26,_0x172b68){_0x41ac26=_0x41ac26-0x0;var _0x18a037=_0x2f8c[_0x41ac26];return _0x18a037;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc2f8('0x0'));var rimraf=require(_0xc2f8('0x1'));var zipdir=require(_0xc2f8('0x2'));var jsonpatch=require(_0xc2f8('0x3'));var rp=require(_0xc2f8('0x4'));var moment=require(_0xc2f8('0x5'));var BPromise=require(_0xc2f8('0x6'));var Mustache=require(_0xc2f8('0x7'));var util=require(_0xc2f8('0x8'));var path=require('path');var sox=require(_0xc2f8('0x9'));var csv=require(_0xc2f8('0xa'));var ejs=require(_0xc2f8('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc2f8('0xc'));var crypto=require(_0xc2f8('0xd'));var jsforce=require(_0xc2f8('0xe'));var deskjs=require(_0xc2f8('0xf'));var toCsv=require(_0xc2f8('0xa'));var querystring=require(_0xc2f8('0x10'));var Papa=require('papaparse');var Redis=require(_0xc2f8('0x11'));var authService=require(_0xc2f8('0x12'));var qs=require(_0xc2f8('0x13'));var as=require(_0xc2f8('0x14'));var hardwareService=require(_0xc2f8('0x15'));var logger=require('../../config/logger')(_0xc2f8('0x16'));var utils=require(_0xc2f8('0x17'));var config=require(_0xc2f8('0x18'));var db=require(_0xc2f8('0x19'))['db'];function respondWithStatusCode(_0x5e07bd,_0x4c55e4){_0x4c55e4=_0x4c55e4||0xcc;return function(_0x4faf03){if(_0x4faf03){return _0x5e07bd[_0xc2f8('0x1a')](_0x4c55e4);}return _0x5e07bd[_0xc2f8('0x1b')](_0x4c55e4)['end']();};}function respondWithResult(_0x5a68eb,_0xa99b0c){_0xa99b0c=_0xa99b0c||0xc8;return function(_0x45255b){if(_0x45255b){return _0x5a68eb[_0xc2f8('0x1b')](_0xa99b0c)['json'](_0x45255b);}};}function respondWithFilteredResult(_0x102cbe,_0x1af66f){return function(_0x3e6ea5){if(_0x3e6ea5){var _0x336e82=_0x3e6ea5[_0xc2f8('0x1c')],_0x290395=_0x1af66f[_0xc2f8('0x1d')],_0x3eac1d=_0x1af66f[_0xc2f8('0x1d')]+_0x1af66f[_0xc2f8('0x1e')],_0x4c51fa;if(_0x3eac1d>=_0x336e82){_0x3eac1d=_0x336e82;_0x4c51fa=0xc8;}else{_0x4c51fa=0xce;}_0x102cbe[_0xc2f8('0x1b')](_0x4c51fa);return _0x102cbe[_0xc2f8('0x1f')](_0xc2f8('0x20'),_0x290395+'-'+_0x3eac1d+'/'+_0x336e82)['json'](_0x3e6ea5);}return null;};}function patchUpdates(_0x10d0dc){return function(_0x4fca7e){try{jsonpatch[_0xc2f8('0x21')](_0x4fca7e,_0x10d0dc,!![]);}catch(_0x16db24){return BPromise[_0xc2f8('0x22')](_0x16db24);}return _0x4fca7e['save']();};}function saveUpdates(_0x2c1762,_0x274bae){return function(_0x152ce1){if(_0x152ce1){return _0x152ce1[_0xc2f8('0x23')](_0x2c1762)[_0xc2f8('0x24')](function(_0xef042b){return _0xef042b;});}return null;};}function removeEntity(_0x2c4044,_0x1884db){return function(_0x3f54e0){if(_0x3f54e0){return _0x3f54e0[_0xc2f8('0x25')]()[_0xc2f8('0x24')](function(){_0x2c4044[_0xc2f8('0x1b')](0xcc)[_0xc2f8('0x26')]();});}};}function handleEntityNotFound(_0x304aa4,_0x24c941){return function(_0x3be3aa){if(!_0x3be3aa){_0x304aa4[_0xc2f8('0x1a')](0x194);}return _0x3be3aa;};}function handleError(_0x1a56ff,_0x286cbb){_0x286cbb=_0x286cbb||0x1f4;return function(_0x2687ae){logger[_0xc2f8('0x27')](_0x2687ae[_0xc2f8('0x28')]);if(_0x2687ae[_0xc2f8('0x29')]){delete _0x2687ae[_0xc2f8('0x29')];}_0x1a56ff[_0xc2f8('0x1b')](_0x286cbb)[_0xc2f8('0x2a')](_0x2687ae);};}exports['index']=function(_0x550790,_0x2377fd){var _0x5f0fa9={},_0x5212a6={},_0x581662={'count':0x0,'rows':[]};var _0x6e10f1=_[_0xc2f8('0x2b')](db[_0xc2f8('0x2c')][_0xc2f8('0x2d')],function(_0x149c99){return{'name':_0x149c99['fieldName'],'type':_0x149c99[_0xc2f8('0x2e')]['key']};});_0x5212a6['model']=_[_0xc2f8('0x2b')](_0x6e10f1,_0xc2f8('0x29'));_0x5212a6[_0xc2f8('0x2f')]=_[_0xc2f8('0x30')](_0x550790[_0xc2f8('0x2f')]);_0x5212a6[_0xc2f8('0x31')]=_[_0xc2f8('0x32')](_0x5212a6[_0xc2f8('0x33')],_0x5212a6[_0xc2f8('0x2f')]);_0x5f0fa9['attributes']=_[_0xc2f8('0x32')](_0x5212a6[_0xc2f8('0x33')],qs[_0xc2f8('0x34')](_0x550790[_0xc2f8('0x2f')][_0xc2f8('0x34')]));_0x5f0fa9[_0xc2f8('0x35')]=_0x5f0fa9[_0xc2f8('0x35')][_0xc2f8('0x36')]?_0x5f0fa9[_0xc2f8('0x35')]:_0x5212a6[_0xc2f8('0x33')];if(!_0x550790['query'][_0xc2f8('0x37')](_0xc2f8('0x38'))){_0x5f0fa9['limit']=qs['limit'](_0x550790[_0xc2f8('0x2f')]['limit']);_0x5f0fa9[_0xc2f8('0x1d')]=qs[_0xc2f8('0x1d')](_0x550790['query'][_0xc2f8('0x1d')]);}_0x5f0fa9['order']=qs[_0xc2f8('0x39')](_0x550790[_0xc2f8('0x2f')][_0xc2f8('0x39')]);_0x5f0fa9[_0xc2f8('0x3a')]=qs[_0xc2f8('0x31')](_[_0xc2f8('0x3b')](_0x550790[_0xc2f8('0x2f')],_0x5212a6[_0xc2f8('0x31')]));if(_0x550790[_0xc2f8('0x2f')]['filter']){_0x5f0fa9[_0xc2f8('0x3a')]=_[_0xc2f8('0x3c')](_0x5f0fa9[_0xc2f8('0x3a')],{'$or':_[_0xc2f8('0x2b')](_0x6e10f1,function(_0x2258d5){if(_0x2258d5[_0xc2f8('0x2e')]!==_0xc2f8('0x3d')){var _0x15ce40={};_0x15ce40[_0x2258d5[_0xc2f8('0x29')]]={'$like':'%'+_0x550790[_0xc2f8('0x2f')][_0xc2f8('0x3e')]+'%'};return _0x15ce40;}})});}_0x5f0fa9=_[_0xc2f8('0x3c')]({},_0x5f0fa9,_0x550790['options']);var _0x19e52f={'where':_0x5f0fa9['where']};return db[_0xc2f8('0x2c')][_0xc2f8('0x1c')](_0x19e52f)[_0xc2f8('0x24')](function(_0x4f6f66){_0x581662[_0xc2f8('0x1c')]=_0x4f6f66;if(_0x550790[_0xc2f8('0x2f')][_0xc2f8('0x3f')]){_0x5f0fa9[_0xc2f8('0x40')]=[{'all':!![]}];}return db[_0xc2f8('0x2c')][_0xc2f8('0x41')](_0x5f0fa9);})[_0xc2f8('0x24')](function(_0x297974){_0x581662['rows']=_0x297974;return _0x581662;})['then'](respondWithFilteredResult(_0x2377fd,_0x5f0fa9))[_0xc2f8('0x42')](handleError(_0x2377fd,null));};exports[_0xc2f8('0x43')]=function(_0x39e78c,_0x4772c4){var _0x396ed3={'raw':![],'where':{'id':_0x39e78c['params']['id']}},_0x1327cd={};_0x1327cd[_0xc2f8('0x33')]=_['keys'](db[_0xc2f8('0x2c')][_0xc2f8('0x2d')]);_0x1327cd[_0xc2f8('0x2f')]=_['keys'](_0x39e78c[_0xc2f8('0x2f')]);_0x1327cd[_0xc2f8('0x31')]=_[_0xc2f8('0x32')](_0x1327cd[_0xc2f8('0x33')],_0x1327cd[_0xc2f8('0x2f')]);_0x396ed3['attributes']=_[_0xc2f8('0x32')](_0x1327cd['model'],qs[_0xc2f8('0x34')](_0x39e78c['query']['fields']));_0x396ed3['attributes']=_0x396ed3[_0xc2f8('0x35')]['length']?_0x396ed3[_0xc2f8('0x35')]:_0x1327cd[_0xc2f8('0x33')];if(_0x39e78c[_0xc2f8('0x2f')][_0xc2f8('0x3f')]){_0x396ed3[_0xc2f8('0x40')]=[{'all':!![]}];}_0x396ed3=_[_0xc2f8('0x3c')]({},_0x396ed3,_0x39e78c[_0xc2f8('0x44')]);return db[_0xc2f8('0x2c')][_0xc2f8('0x45')](_0x396ed3)[_0xc2f8('0x24')](handleEntityNotFound(_0x4772c4,null))[_0xc2f8('0x24')](respondWithResult(_0x4772c4,null))['catch'](handleError(_0x4772c4,null));};exports['create']=function(_0xa07dd,_0x73cd61){return db['VoiceAgentReport'][_0xc2f8('0x46')](_0xa07dd[_0xc2f8('0x47')],{})[_0xc2f8('0x24')](respondWithResult(_0x73cd61,0xc9))['catch'](handleError(_0x73cd61,null));};exports[_0xc2f8('0x23')]=function(_0x1c1813,_0x5bce7f){if(_0x1c1813[_0xc2f8('0x47')]['id']){delete _0x1c1813[_0xc2f8('0x47')]['id'];}return db[_0xc2f8('0x2c')][_0xc2f8('0x45')]({'where':{'id':_0x1c1813[_0xc2f8('0x48')]['id']}})[_0xc2f8('0x24')](handleEntityNotFound(_0x5bce7f,null))[_0xc2f8('0x24')](saveUpdates(_0x1c1813[_0xc2f8('0x47')],null))['then'](respondWithResult(_0x5bce7f,null))[_0xc2f8('0x42')](handleError(_0x5bce7f,null));};exports[_0xc2f8('0x25')]=function(_0x101f40,_0x4ef639){return db[_0xc2f8('0x2c')][_0xc2f8('0x45')]({'where':{'id':_0x101f40[_0xc2f8('0x48')]['id']}})[_0xc2f8('0x24')](handleEntityNotFound(_0x4ef639,null))[_0xc2f8('0x24')](removeEntity(_0x4ef639,null))[_0xc2f8('0x42')](handleError(_0x4ef639,null));};exports[_0xc2f8('0x49')]=function(_0x115a31,_0x1d9148){return db[_0xc2f8('0x2c')]['describe']()[_0xc2f8('0x24')](respondWithResult(_0x1d9148,null))[_0xc2f8('0x42')](handleError(_0x1d9148,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index b8570c3..f3c31a3 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 _0xf576=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','VoiceAgentReport','report_agent','uniqueid','lodash'];(function(_0x420cf1,_0x592d5c){var _0x35ae3d=function(_0x256b02){while(--_0x256b02){_0x420cf1['push'](_0x420cf1['shift']());}};_0x35ae3d(++_0x592d5c);}(_0xf576,0xef));var _0x6f57=function(_0x2d956e,_0x37b857){_0x2d956e=_0x2d956e-0x0;var _0x5da717=_0xf576[_0x2d956e];return _0x5da717;};'use strict';var _=require(_0x6f57('0x0'));var util=require(_0x6f57('0x1'));var logger=require(_0x6f57('0x2'))(_0x6f57('0x3'));var moment=require(_0x6f57('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f57('0x5'));var rimraf=require(_0x6f57('0x6'));var config=require(_0x6f57('0x7'));var attributes=require('./voiceAgentReport.attributes');module[_0x6f57('0x8')]=function(_0x455a27,_0x50edc1){return _0x455a27['define'](_0x6f57('0x9'),attributes,{'tableName':_0x6f57('0xa'),'paranoid':![],'indexes':[{'fields':[_0x6f57('0xb'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x51b2=['./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','destuniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x447ab3,_0x4fbd8d){var _0x51ce19=function(_0x359516){while(--_0x359516){_0x447ab3['push'](_0x447ab3['shift']());}};_0x51ce19(++_0x4fbd8d);}(_0x51b2,0x150));var _0x251b=function(_0x4cebcc,_0x56253e){_0x4cebcc=_0x4cebcc-0x0;var _0x4d1669=_0x51b2[_0x4cebcc];return _0x4d1669;};'use strict';var _=require('lodash');var util=require(_0x251b('0x0'));var logger=require(_0x251b('0x1'))(_0x251b('0x2'));var moment=require(_0x251b('0x3'));var BPromise=require(_0x251b('0x4'));var rp=require(_0x251b('0x5'));var fs=require('fs');var path=require(_0x251b('0x6'));var rimraf=require(_0x251b('0x7'));var config=require(_0x251b('0x8'));var attributes=require(_0x251b('0x9'));module[_0x251b('0xa')]=function(_0x222cb8,_0x324845){return _0x222cb8[_0x251b('0xb')](_0x251b('0xc'),attributes,{'tableName':_0x251b('0xd'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0x251b('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 3fb5a42..211a366 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 _0xa091=['result','CreateVoiceAgentReport','body','options','raw','stringify','UpdateVoiceAgentReport','VoiceAgentReport','update','where','limit','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','client','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x36b0f8,_0x4adf3f){var _0x215735=function(_0x23a69c){while(--_0x23a69c){_0x36b0f8['push'](_0x36b0f8['shift']());}};_0x215735(++_0x4adf3f);}(_0xa091,0x11a));var _0x1a09=function(_0x1e644b,_0x2c32f0){_0x1e644b=_0x1e644b-0x0;var _0x23207b=_0xa091[_0x1e644b];return _0x23207b;};'use strict';var _=require(_0x1a09('0x0'));var util=require(_0x1a09('0x1'));var moment=require(_0x1a09('0x2'));var BPromise=require(_0x1a09('0x3'));var rs=require(_0x1a09('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1a09('0x5'))['db'];var utils=require(_0x1a09('0x6'));var logger=require('../../config/logger')(_0x1a09('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1a09('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26ab34,_0x24749f,_0x185054){return new BPromise(function(_0xe8fa68,_0x3b8ac9){return client[_0x1a09('0x9')](_0x26ab34,_0x185054)[_0x1a09('0xa')](function(_0x35fc20){logger[_0x1a09('0xb')](_0x1a09('0xc'),_0x24749f,_0x1a09('0xd'));logger[_0x1a09('0xe')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x24749f,_0x1a09('0xd'),JSON['stringify'](_0x35fc20));if(_0x35fc20[_0x1a09('0xf')]){if(_0x35fc20[_0x1a09('0xf')][_0x1a09('0x10')]===0x1f4){logger['error'](_0x1a09('0xc'),_0x24749f,_0x35fc20[_0x1a09('0xf')][_0x1a09('0x11')]);return _0x3b8ac9(_0x35fc20[_0x1a09('0xf')]['message']);}logger[_0x1a09('0xf')](_0x1a09('0xc'),_0x24749f,_0x35fc20[_0x1a09('0xf')]['message']);return _0xe8fa68(_0x35fc20[_0x1a09('0xf')][_0x1a09('0x11')]);}else{logger[_0x1a09('0xb')](_0x1a09('0xc'),_0x24749f,_0x1a09('0xd'));_0xe8fa68(_0x35fc20[_0x1a09('0x12')]['message']);}})['catch'](function(_0x28f748){logger[_0x1a09('0xf')](_0x1a09('0xc'),_0x24749f,_0x28f748);_0x3b8ac9(_0x28f748);});});}exports[_0x1a09('0x13')]=function(_0x424c21){var _0x3e93a8=this;return new Promise(function(_0x27b09e,_0x23f1a8){return db['VoiceAgentReport']['create'](_0x424c21[_0x1a09('0x14')],{'raw':_0x424c21[_0x1a09('0x15')]?_0x424c21['options'][_0x1a09('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x12c8be){logger['info'](_0x1a09('0x13'),_0x424c21);logger['debug']('CreateVoiceAgentReport',_0x424c21,JSON[_0x1a09('0x17')](_0x12c8be));_0x27b09e(_0x12c8be);})['catch'](function(_0x530c72){logger[_0x1a09('0xf')](_0x1a09('0x13'),_0x530c72[_0x1a09('0x11')],_0x424c21);_0x23f1a8(_0x3e93a8[_0x1a09('0xf')](0x1f4,_0x530c72[_0x1a09('0x11')]));});});};exports[_0x1a09('0x18')]=function(_0x14779a){var _0x35c1f8=this;return new Promise(function(_0x5d4fb9,_0x174a2d){return db[_0x1a09('0x19')][_0x1a09('0x1a')](_0x14779a[_0x1a09('0x14')],{'raw':_0x14779a['options']?_0x14779a[_0x1a09('0x15')][_0x1a09('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14779a[_0x1a09('0x15')]?_0x14779a[_0x1a09('0x15')][_0x1a09('0x1b')]||null:null,'attributes':_0x14779a[_0x1a09('0x15')]?_0x14779a['options']['attributes']||null:null,'limit':_0x14779a[_0x1a09('0x15')]?_0x14779a[_0x1a09('0x15')][_0x1a09('0x1c')]||null:null})[_0x1a09('0xa')](function(_0x1c40fd){logger[_0x1a09('0xb')]('UpdateVoiceAgentReport',_0x14779a);logger['debug']('UpdateVoiceAgentReport',_0x14779a,JSON[_0x1a09('0x17')](_0x1c40fd));_0x5d4fb9(_0x1c40fd);})[_0x1a09('0x1d')](function(_0x2663ea){logger[_0x1a09('0xf')]('UpdateVoiceAgentReport',_0x2663ea[_0x1a09('0x11')],_0x14779a);_0x174a2d(_0x35c1f8[_0x1a09('0xf')](0x1f4,_0x2663ea[_0x1a09('0x11')]));});});}; \ No newline at end of file +var _0x8044=['limit','UpdateVoiceAgentReport','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateVoiceAgentReport','create','body','options','raw','VoiceAgentReport','update','where','attributes'];(function(_0x3d93df,_0xe52f8d){var _0x5d09b8=function(_0x3bf1c0){while(--_0x3bf1c0){_0x3d93df['push'](_0x3d93df['shift']());}};_0x5d09b8(++_0xe52f8d);}(_0x8044,0x12b));var _0x4804=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0x8044[_0x39e84d];return _0x1991bc;};'use strict';var _=require('lodash');var util=require(_0x4804('0x0'));var moment=require('moment');var BPromise=require(_0x4804('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4804('0x2'));var db=require(_0x4804('0x3'))['db'];var utils=require(_0x4804('0x4'));var logger=require('../../config/logger')(_0x4804('0x5'));var config=require(_0x4804('0x6'));var jayson=require(_0x4804('0x7'));var client=jayson[_0x4804('0x8')][_0x4804('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x125691,_0x46d0ec,_0x2c724d){return new BPromise(function(_0x2a6b25,_0xb0337b){return client[_0x4804('0xa')](_0x125691,_0x2c724d)[_0x4804('0xb')](function(_0x2f777e){logger[_0x4804('0xc')](_0x4804('0xd'),_0x46d0ec,_0x4804('0xe'));logger[_0x4804('0xf')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x46d0ec,_0x4804('0xe'),JSON[_0x4804('0x10')](_0x2f777e));if(_0x2f777e['error']){if(_0x2f777e[_0x4804('0x11')][_0x4804('0x12')]===0x1f4){logger[_0x4804('0x11')](_0x4804('0xd'),_0x46d0ec,_0x2f777e['error']['message']);return _0xb0337b(_0x2f777e[_0x4804('0x11')][_0x4804('0x13')]);}logger[_0x4804('0x11')](_0x4804('0xd'),_0x46d0ec,_0x2f777e[_0x4804('0x11')][_0x4804('0x13')]);return _0x2a6b25(_0x2f777e[_0x4804('0x11')][_0x4804('0x13')]);}else{logger[_0x4804('0xc')](_0x4804('0xd'),_0x46d0ec,_0x4804('0xe'));_0x2a6b25(_0x2f777e[_0x4804('0x14')][_0x4804('0x13')]);}})[_0x4804('0x15')](function(_0x26da1d){logger[_0x4804('0x11')](_0x4804('0xd'),_0x46d0ec,_0x26da1d);_0xb0337b(_0x26da1d);});});}exports[_0x4804('0x16')]=function(_0x11a892){var _0x1b4695=this;return new Promise(function(_0x45c932,_0x68eb98){return db['VoiceAgentReport'][_0x4804('0x17')](_0x11a892[_0x4804('0x18')],{'raw':_0x11a892[_0x4804('0x19')]?_0x11a892[_0x4804('0x19')][_0x4804('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x43ffa7){logger[_0x4804('0xc')]('CreateVoiceAgentReport',_0x11a892);logger['debug'](_0x4804('0x16'),_0x11a892,JSON[_0x4804('0x10')](_0x43ffa7));_0x45c932(_0x43ffa7);})[_0x4804('0x15')](function(_0x2bf4c0){logger[_0x4804('0x11')]('CreateVoiceAgentReport',_0x2bf4c0[_0x4804('0x13')],_0x11a892);_0x68eb98(_0x1b4695[_0x4804('0x11')](0x1f4,_0x2bf4c0[_0x4804('0x13')]));});});};exports['UpdateVoiceAgentReport']=function(_0x3c8a99){var _0x5c117d=this;return new Promise(function(_0x449e61,_0xdee80e){return db[_0x4804('0x1b')][_0x4804('0x1c')](_0x3c8a99['body'],{'raw':_0x3c8a99['options']?_0x3c8a99[_0x4804('0x19')][_0x4804('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c8a99['options']?_0x3c8a99['options'][_0x4804('0x1d')]||null:null,'attributes':_0x3c8a99[_0x4804('0x19')]?_0x3c8a99[_0x4804('0x19')][_0x4804('0x1e')]||null:null,'limit':_0x3c8a99[_0x4804('0x19')]?_0x3c8a99[_0x4804('0x19')][_0x4804('0x1f')]||null:null})['then'](function(_0x33011d){logger[_0x4804('0xc')]('UpdateVoiceAgentReport',_0x3c8a99);logger[_0x4804('0xf')]('UpdateVoiceAgentReport',_0x3c8a99,JSON['stringify'](_0x33011d));_0x449e61(_0x33011d);})[_0x4804('0x15')](function(_0x34cebe){logger['error'](_0x4804('0x20'),_0x34cebe[_0x4804('0x13')],_0x3c8a99);_0xdee80e(_0x5c117d['error'](0x1f4,_0x34cebe[_0x4804('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 8ac4d8d..ca2df2c 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 _0xb2b7=['Router','../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','get','isAuthenticated','/:id','show','create','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x5ad803,_0x2017f2){var _0x5daa5c=function(_0x59c986){while(--_0x59c986){_0x5ad803['push'](_0x5ad803['shift']());}};_0x5daa5c(++_0x2017f2);}(_0xb2b7,0x14e));var _0x7b2b=function(_0x417a1c,_0x3288f4){_0x417a1c=_0x417a1c-0x0;var _0x492052=_0xb2b7[_0x417a1c];return _0x492052;};'use strict';var multer=require('multer');var util=require(_0x7b2b('0x0'));var path=require('path');var timeout=require(_0x7b2b('0x1'));var express=require('express');var router=express[_0x7b2b('0x2')]();var auth=require(_0x7b2b('0x3'));var interaction=require(_0x7b2b('0x4'));var config=require('../../config/environment');var controller=require(_0x7b2b('0x5'));router[_0x7b2b('0x6')]('/',auth[_0x7b2b('0x7')](),controller['index']);router[_0x7b2b('0x6')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x7b2b('0x6')](_0x7b2b('0x8'),auth[_0x7b2b('0x7')](),controller[_0x7b2b('0x9')]);router['post']('/',auth[_0x7b2b('0x7')](),controller[_0x7b2b('0xa')]);router[_0x7b2b('0xb')]('/:id',auth[_0x7b2b('0x7')](),controller[_0x7b2b('0xc')]);router[_0x7b2b('0xd')]('/:id',auth[_0x7b2b('0x7')](),controller[_0x7b2b('0xe')]);module[_0x7b2b('0xf')]=router; \ No newline at end of file +var _0xb969=['create','put','update','delete','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb969,0x9d));var _0x9b96=function(_0x4704a1,_0x1b6d27){_0x4704a1=_0x4704a1-0x0;var _0xe33c73=_0xb969[_0x4704a1];return _0xe33c73;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9b96('0x0'));var timeout=require(_0x9b96('0x1'));var express=require(_0x9b96('0x2'));var router=express[_0x9b96('0x3')]();var auth=require(_0x9b96('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9b96('0x5'));var controller=require('./voiceCallReport.controller');router[_0x9b96('0x6')]('/',auth[_0x9b96('0x7')](),controller['index']);router[_0x9b96('0x6')](_0x9b96('0x8'),auth[_0x9b96('0x7')](),controller[_0x9b96('0x9')]);router[_0x9b96('0x6')](_0x9b96('0xa'),auth[_0x9b96('0x7')](),controller[_0x9b96('0xb')]);router[_0x9b96('0xc')]('/',auth[_0x9b96('0x7')](),controller[_0x9b96('0xd')]);router[_0x9b96('0xe')](_0x9b96('0xa'),auth[_0x9b96('0x7')](),controller[_0x9b96('0xf')]);router[_0x9b96('0x10')](_0x9b96('0xa'),auth[_0x9b96('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 56bede4..65ec901 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(_0x3b0661,_0x5ee1ca){var _0x52ea55=function(_0x49ce00){while(--_0x49ce00){_0x3b0661['push'](_0x3b0661['shift']());}};_0x52ea55(++_0x5ee1ca);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')]},'type':{'type':Sequelize[_0x7995('0x3')]('inbound',_0x7995('0x4'),_0x7995('0x5'),_0x7995('0x6'),_0x7995('0x7'),'dialer')},'tag':{'type':Sequelize[_0x7995('0x2')]},'accountcode':{'type':Sequelize[_0x7995('0x2')]},'source':{'type':Sequelize[_0x7995('0x2')]},'destination':{'type':Sequelize[_0x7995('0x2')]},'destinationcontext':{'type':Sequelize[_0x7995('0x2')]},'callerid':{'type':Sequelize[_0x7995('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x7995('0x2')]},'lastapplication':{'type':Sequelize[_0x7995('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x7995('0x8')]},'systemanswertime':{'type':Sequelize[_0x7995('0x8')]},'answertime':{'type':Sequelize[_0x7995('0x8')]},'endtime':{'type':Sequelize[_0x7995('0x8')]},'duration':{'type':Sequelize[_0x7995('0x9')]},'billableseconds':{'type':Sequelize[_0x7995('0x9')]},'mohtime':{'type':Sequelize[_0x7995('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x7995('0x2')]},'userfield':{'type':Sequelize[_0x7995('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7995('0x2')]},'prefix':{'type':Sequelize[_0x7995('0x2')]},'routeid':{'type':Sequelize[_0x7995('0x9')]},'sipcallid':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x9957=['ENUM','internal','outbound','inbound-fax','outbound-fax','DATE','INTEGER','sequelize','exports','STRING'];(function(_0x1fc59b,_0x35cfad){var _0x1910d3=function(_0x280b1e){while(--_0x280b1e){_0x1fc59b['push'](_0x1fc59b['shift']());}};_0x1910d3(++_0x35cfad);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')]},'type':{'type':Sequelize[_0x7995('0x3')]('inbound',_0x7995('0x4'),_0x7995('0x5'),_0x7995('0x6'),_0x7995('0x7'),'dialer')},'tag':{'type':Sequelize[_0x7995('0x2')]},'accountcode':{'type':Sequelize[_0x7995('0x2')]},'source':{'type':Sequelize[_0x7995('0x2')]},'destination':{'type':Sequelize[_0x7995('0x2')]},'destinationcontext':{'type':Sequelize[_0x7995('0x2')]},'callerid':{'type':Sequelize[_0x7995('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x7995('0x2')]},'lastapplication':{'type':Sequelize[_0x7995('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x7995('0x8')]},'systemanswertime':{'type':Sequelize[_0x7995('0x8')]},'answertime':{'type':Sequelize[_0x7995('0x8')]},'endtime':{'type':Sequelize[_0x7995('0x8')]},'duration':{'type':Sequelize[_0x7995('0x9')]},'billableseconds':{'type':Sequelize[_0x7995('0x9')]},'mohtime':{'type':Sequelize[_0x7995('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x7995('0x2')]},'userfield':{'type':Sequelize[_0x7995('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7995('0x2')]},'prefix':{'type':Sequelize[_0x7995('0x2')]},'routeid':{'type':Sequelize[_0x7995('0x9')]},'sipcallid':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 8818e60..f886f40 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 _0x5e18=['then','destroy','error','stack','name','send','index','fieldName','key','model','map','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','VoiceCallReport','includeAll','fullname','alias','User','rows','show','params','keys','rawAttributes','find','catch','create','body','describe','update','uniqueid','user','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save'];(function(_0x490b7b,_0x599c24){var _0x385399=function(_0xdfc744){while(--_0xdfc744){_0x490b7b['push'](_0x490b7b['shift']());}};_0x385399(++_0x599c24);}(_0x5e18,0x80));var _0x85e1=function(_0x2aaa00,_0x45ccd8){_0x2aaa00=_0x2aaa00-0x0;var _0x1dcea8=_0x5e18[_0x2aaa00];return _0x1dcea8;};'use strict';var pdf=require(_0x85e1('0x0'));var emlformat=require(_0x85e1('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x85e1('0x2'));var jsonpatch=require(_0x85e1('0x3'));var rp=require(_0x85e1('0x4'));var moment=require('moment');var BPromise=require(_0x85e1('0x5'));var Mustache=require(_0x85e1('0x6'));var util=require(_0x85e1('0x7'));var path=require(_0x85e1('0x8'));var sox=require(_0x85e1('0x9'));var csv=require(_0x85e1('0xa'));var ejs=require(_0x85e1('0xb'));var fs=require('fs');var _=require(_0x85e1('0xc'));var squel=require(_0x85e1('0xd'));var crypto=require('crypto');var jsforce=require(_0x85e1('0xe'));var deskjs=require(_0x85e1('0xf'));var toCsv=require(_0x85e1('0xa'));var querystring=require(_0x85e1('0x10'));var Papa=require(_0x85e1('0x11'));var Redis=require(_0x85e1('0x12'));var authService=require(_0x85e1('0x13'));var qs=require(_0x85e1('0x14'));var as=require(_0x85e1('0x15'));var hardwareService=require(_0x85e1('0x16'));var logger=require('../../config/logger')(_0x85e1('0x17'));var utils=require(_0x85e1('0x18'));var config=require(_0x85e1('0x19'));var db=require(_0x85e1('0x1a'))['db'];function respondWithStatusCode(_0x1063de,_0x432069){_0x432069=_0x432069||0xcc;return function(_0x333531){if(_0x333531){return _0x1063de[_0x85e1('0x1b')](_0x432069);}return _0x1063de[_0x85e1('0x1c')](_0x432069)[_0x85e1('0x1d')]();};}function respondWithResult(_0x587edb,_0x4d315a){_0x4d315a=_0x4d315a||0xc8;return function(_0xcea0ce){if(_0xcea0ce){return _0x587edb[_0x85e1('0x1c')](_0x4d315a)[_0x85e1('0x1e')](_0xcea0ce);}};}function respondWithFilteredResult(_0x1b36a3,_0x24eb93){return function(_0x11c956){if(_0x11c956){var _0x38f586=_0x11c956[_0x85e1('0x1f')],_0x26b156=_0x24eb93[_0x85e1('0x20')],_0x193045=_0x24eb93[_0x85e1('0x20')]+_0x24eb93[_0x85e1('0x21')],_0x43a385;if(_0x193045>=_0x38f586){_0x193045=_0x38f586;_0x43a385=0xc8;}else{_0x43a385=0xce;}_0x1b36a3['status'](_0x43a385);return _0x1b36a3['set'](_0x85e1('0x22'),_0x26b156+'-'+_0x193045+'/'+_0x38f586)[_0x85e1('0x1e')](_0x11c956);}return null;};}function patchUpdates(_0x13e45f){return function(_0x46a093){try{jsonpatch[_0x85e1('0x23')](_0x46a093,_0x13e45f,!![]);}catch(_0x3051df){return BPromise[_0x85e1('0x24')](_0x3051df);}return _0x46a093[_0x85e1('0x25')]();};}function saveUpdates(_0x418d3f,_0x2933e0){return function(_0x1435d5){if(_0x1435d5){return _0x1435d5['update'](_0x418d3f)[_0x85e1('0x26')](function(_0x4c0c76){return _0x4c0c76;});}return null;};}function removeEntity(_0x288e24,_0x2aea60){return function(_0x1f351c){if(_0x1f351c){return _0x1f351c[_0x85e1('0x27')]()['then'](function(){_0x288e24['status'](0xcc)[_0x85e1('0x1d')]();});}};}function handleEntityNotFound(_0x5c54d3,_0x36bf89){return function(_0x4a3b59){if(!_0x4a3b59){_0x5c54d3[_0x85e1('0x1b')](0x194);}return _0x4a3b59;};}function handleError(_0x5a828e,_0x333c98){_0x333c98=_0x333c98||0x1f4;return function(_0x27e3b2){logger[_0x85e1('0x28')](_0x27e3b2[_0x85e1('0x29')]);if(_0x27e3b2[_0x85e1('0x2a')]){delete _0x27e3b2[_0x85e1('0x2a')];}_0x5a828e[_0x85e1('0x1c')](_0x333c98)[_0x85e1('0x2b')](_0x27e3b2);};}exports[_0x85e1('0x2c')]=function(_0x371cc9,_0x59a354){var _0x270f9d={},_0x1116b0={},_0x2f1b82={'count':0x0,'rows':[]};var _0x5421c0=_['map'](db['VoiceCallReport']['rawAttributes'],function(_0x37c16e){return{'name':_0x37c16e[_0x85e1('0x2d')],'type':_0x37c16e['type'][_0x85e1('0x2e')]};});_0x1116b0[_0x85e1('0x2f')]=_[_0x85e1('0x30')](_0x5421c0,_0x85e1('0x2a'));_0x1116b0['query']=_['keys'](_0x371cc9['query']);_0x1116b0[_0x85e1('0x31')]=_[_0x85e1('0x32')](_0x1116b0[_0x85e1('0x2f')],_0x1116b0[_0x85e1('0x33')]);_0x270f9d[_0x85e1('0x34')]=_[_0x85e1('0x32')](_0x1116b0[_0x85e1('0x2f')],qs['fields'](_0x371cc9[_0x85e1('0x33')][_0x85e1('0x35')]));_0x270f9d['attributes']=_0x270f9d[_0x85e1('0x34')][_0x85e1('0x36')]?_0x270f9d[_0x85e1('0x34')]:_0x1116b0[_0x85e1('0x2f')];if(!_0x371cc9[_0x85e1('0x33')][_0x85e1('0x37')](_0x85e1('0x38'))){_0x270f9d[_0x85e1('0x21')]=qs[_0x85e1('0x21')](_0x371cc9['query']['limit']);_0x270f9d['offset']=qs['offset'](_0x371cc9[_0x85e1('0x33')][_0x85e1('0x20')]);}_0x270f9d['order']=qs[_0x85e1('0x39')](_0x371cc9['query'][_0x85e1('0x39')]);_0x270f9d[_0x85e1('0x3a')]=qs['filters'](_[_0x85e1('0x3b')](_0x371cc9[_0x85e1('0x33')],_0x1116b0[_0x85e1('0x31')]));if(_0x371cc9[_0x85e1('0x33')][_0x85e1('0x3c')]){_0x270f9d[_0x85e1('0x3a')]=_[_0x85e1('0x3d')](_0x270f9d[_0x85e1('0x3a')],{'$or':_[_0x85e1('0x30')](_0x5421c0,function(_0x16e7c8){if(_0x16e7c8[_0x85e1('0x3e')]!==_0x85e1('0x3f')){var _0x3a509a={};_0x3a509a[_0x16e7c8['name']]={'$like':'%'+_0x371cc9[_0x85e1('0x33')][_0x85e1('0x3c')]+'%'};return _0x3a509a;}})});}_0x270f9d=_[_0x85e1('0x3d')]({},_0x270f9d,_0x371cc9[_0x85e1('0x40')]);var _0x51c574={'where':_0x270f9d[_0x85e1('0x3a')]};return db[_0x85e1('0x41')][_0x85e1('0x1f')](_0x51c574)[_0x85e1('0x26')](function(_0x385be4){_0x2f1b82[_0x85e1('0x1f')]=_0x385be4;if(_0x371cc9[_0x85e1('0x33')][_0x85e1('0x42')]){_0x270f9d['include']=[{'attributes':['id',_0x85e1('0x2a'),_0x85e1('0x43'),_0x85e1('0x44')],'model':db[_0x85e1('0x45')],'as':_0x85e1('0x45')}];}return db[_0x85e1('0x41')]['findAll'](_0x270f9d);})[_0x85e1('0x26')](function(_0x20f850){_0x2f1b82[_0x85e1('0x46')]=_0x20f850;return _0x2f1b82;})[_0x85e1('0x26')](respondWithFilteredResult(_0x59a354,_0x270f9d))['catch'](handleError(_0x59a354,null));};exports[_0x85e1('0x47')]=function(_0x3a5b0b,_0x3c4a9c){var _0x361354={'raw':!![],'where':{'id':_0x3a5b0b[_0x85e1('0x48')]['id']}},_0x1edd4d={};_0x1edd4d['model']=_[_0x85e1('0x49')](db[_0x85e1('0x41')][_0x85e1('0x4a')]);_0x1edd4d[_0x85e1('0x33')]=_[_0x85e1('0x49')](_0x3a5b0b[_0x85e1('0x33')]);_0x1edd4d[_0x85e1('0x31')]=_['intersection'](_0x1edd4d[_0x85e1('0x2f')],_0x1edd4d[_0x85e1('0x33')]);_0x361354[_0x85e1('0x34')]=_[_0x85e1('0x32')](_0x1edd4d[_0x85e1('0x2f')],qs['fields'](_0x3a5b0b[_0x85e1('0x33')][_0x85e1('0x35')]));_0x361354['attributes']=_0x361354['attributes']['length']?_0x361354[_0x85e1('0x34')]:_0x1edd4d[_0x85e1('0x2f')];if(_0x3a5b0b['query'][_0x85e1('0x42')]){_0x361354['include']=[{'all':!![]}];}_0x361354=_['merge']({},_0x361354,_0x3a5b0b[_0x85e1('0x40')]);return db[_0x85e1('0x41')][_0x85e1('0x4b')](_0x361354)[_0x85e1('0x26')](handleEntityNotFound(_0x3c4a9c,null))['then'](respondWithResult(_0x3c4a9c,null))[_0x85e1('0x4c')](handleError(_0x3c4a9c,null));};exports[_0x85e1('0x4d')]=function(_0x25885c,_0x6f4b1c){return db[_0x85e1('0x41')][_0x85e1('0x4d')](_0x25885c[_0x85e1('0x4e')],{})[_0x85e1('0x26')](respondWithResult(_0x6f4b1c,0xc9))[_0x85e1('0x4c')](handleError(_0x6f4b1c,null));};exports[_0x85e1('0x27')]=function(_0x1a0b2c,_0x53de79){return db['VoiceCallReport']['find']({'where':{'id':_0x1a0b2c['params']['id']}})[_0x85e1('0x26')](handleEntityNotFound(_0x53de79,null))['then'](removeEntity(_0x53de79,null))['catch'](handleError(_0x53de79,null));};exports[_0x85e1('0x4f')]=function(_0x5009c2,_0x389f1f){return db[_0x85e1('0x41')][_0x85e1('0x4f')]()[_0x85e1('0x26')](respondWithResult(_0x389f1f,null))[_0x85e1('0x4c')](handleError(_0x389f1f,null));};exports[_0x85e1('0x50')]=function(_0x7481bb,_0x4db668){if(_0x7481bb[_0x85e1('0x4e')][_0x85e1('0x51')]){delete _0x7481bb['body'][_0x85e1('0x51')];}return db[_0x85e1('0x41')][_0x85e1('0x4b')]({'where':{'uniqueid':_0x7481bb[_0x85e1('0x48')]['id'],'UserId':{'$or':[null,_0x7481bb[_0x85e1('0x52')]['id']]}}})[_0x85e1('0x26')](handleEntityNotFound(_0x4db668,null))[_0x85e1('0x26')](saveUpdates(_0x7481bb[_0x85e1('0x4e')],null))['then'](respondWithResult(_0x4db668,null))[_0x85e1('0x4c')](handleError(_0x4db668,null));}; \ No newline at end of file +var _0xd39d=['map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','order','sort','pick','filter','where','merge','VIRTUAL','VoiceCallReport','includeAll','include','fullname','alias','User','findAll','rows','catch','show','params','options','find','create','describe','body','uniqueid','user','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','update','then','stack','name','send','index'];(function(_0x3c487b,_0x44c5e2){var _0x1d65f6=function(_0x135e6d){while(--_0x135e6d){_0x3c487b['push'](_0x3c487b['shift']());}};_0x1d65f6(++_0x44c5e2);}(_0xd39d,0x10c));var _0xdd39=function(_0x3018eb,_0x570c63){_0x3018eb=_0x3018eb-0x0;var _0x23131f=_0xd39d[_0x3018eb];return _0x23131f;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xdd39('0x0'));var zipdir=require(_0xdd39('0x1'));var jsonpatch=require(_0xdd39('0x2'));var rp=require('request-promise');var moment=require(_0xdd39('0x3'));var BPromise=require(_0xdd39('0x4'));var Mustache=require(_0xdd39('0x5'));var util=require(_0xdd39('0x6'));var path=require(_0xdd39('0x7'));var sox=require(_0xdd39('0x8'));var csv=require(_0xdd39('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdd39('0xa'));var squel=require(_0xdd39('0xb'));var crypto=require(_0xdd39('0xc'));var jsforce=require(_0xdd39('0xd'));var deskjs=require(_0xdd39('0xe'));var toCsv=require(_0xdd39('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xdd39('0xf'));var authService=require(_0xdd39('0x10'));var qs=require(_0xdd39('0x11'));var as=require(_0xdd39('0x12'));var hardwareService=require(_0xdd39('0x13'));var logger=require(_0xdd39('0x14'))(_0xdd39('0x15'));var utils=require('../../config/utils');var config=require(_0xdd39('0x16'));var db=require(_0xdd39('0x17'))['db'];function respondWithStatusCode(_0x57670e,_0x2167fe){_0x2167fe=_0x2167fe||0xcc;return function(_0x3a6708){if(_0x3a6708){return _0x57670e[_0xdd39('0x18')](_0x2167fe);}return _0x57670e['status'](_0x2167fe)[_0xdd39('0x19')]();};}function respondWithResult(_0xd2001f,_0x5318ba){_0x5318ba=_0x5318ba||0xc8;return function(_0xb0d59a){if(_0xb0d59a){return _0xd2001f[_0xdd39('0x1a')](_0x5318ba)[_0xdd39('0x1b')](_0xb0d59a);}};}function respondWithFilteredResult(_0x2aae33,_0x250b1c){return function(_0x70fdf0){if(_0x70fdf0){var _0x4a1e7b=_0x70fdf0[_0xdd39('0x1c')],_0x121f23=_0x250b1c['offset'],_0x4e707b=_0x250b1c[_0xdd39('0x1d')]+_0x250b1c[_0xdd39('0x1e')],_0x5868c6;if(_0x4e707b>=_0x4a1e7b){_0x4e707b=_0x4a1e7b;_0x5868c6=0xc8;}else{_0x5868c6=0xce;}_0x2aae33[_0xdd39('0x1a')](_0x5868c6);return _0x2aae33['set'](_0xdd39('0x1f'),_0x121f23+'-'+_0x4e707b+'/'+_0x4a1e7b)[_0xdd39('0x1b')](_0x70fdf0);}return null;};}function patchUpdates(_0x28bb36){return function(_0x2b77cf){try{jsonpatch[_0xdd39('0x20')](_0x2b77cf,_0x28bb36,!![]);}catch(_0x57924f){return BPromise[_0xdd39('0x21')](_0x57924f);}return _0x2b77cf['save']();};}function saveUpdates(_0x46174d,_0xe1f7b9){return function(_0x3a3479){if(_0x3a3479){return _0x3a3479[_0xdd39('0x22')](_0x46174d)['then'](function(_0x5f41ba){return _0x5f41ba;});}return null;};}function removeEntity(_0x195a3c,_0x598706){return function(_0x51570a){if(_0x51570a){return _0x51570a['destroy']()[_0xdd39('0x23')](function(){_0x195a3c[_0xdd39('0x1a')](0xcc)[_0xdd39('0x19')]();});}};}function handleEntityNotFound(_0x1d8c6c,_0x293569){return function(_0x497b4a){if(!_0x497b4a){_0x1d8c6c[_0xdd39('0x18')](0x194);}return _0x497b4a;};}function handleError(_0x453d03,_0x27fee8){_0x27fee8=_0x27fee8||0x1f4;return function(_0x38f907){logger['error'](_0x38f907[_0xdd39('0x24')]);if(_0x38f907['name']){delete _0x38f907[_0xdd39('0x25')];}_0x453d03[_0xdd39('0x1a')](_0x27fee8)[_0xdd39('0x26')](_0x38f907);};}exports[_0xdd39('0x27')]=function(_0x1c7933,_0x13ae25){var _0x3cc30d={},_0x30871a={},_0x4d200d={'count':0x0,'rows':[]};var _0x5453a5=_[_0xdd39('0x28')](db['VoiceCallReport'][_0xdd39('0x29')],function(_0x15f116){return{'name':_0x15f116[_0xdd39('0x2a')],'type':_0x15f116[_0xdd39('0x2b')]['key']};});_0x30871a[_0xdd39('0x2c')]=_[_0xdd39('0x28')](_0x5453a5,_0xdd39('0x25'));_0x30871a[_0xdd39('0x2d')]=_[_0xdd39('0x2e')](_0x1c7933['query']);_0x30871a[_0xdd39('0x2f')]=_[_0xdd39('0x30')](_0x30871a[_0xdd39('0x2c')],_0x30871a[_0xdd39('0x2d')]);_0x3cc30d[_0xdd39('0x31')]=_[_0xdd39('0x30')](_0x30871a['model'],qs['fields'](_0x1c7933[_0xdd39('0x2d')][_0xdd39('0x32')]));_0x3cc30d['attributes']=_0x3cc30d[_0xdd39('0x31')][_0xdd39('0x33')]?_0x3cc30d['attributes']:_0x30871a[_0xdd39('0x2c')];if(!_0x1c7933['query']['hasOwnProperty']('nolimit')){_0x3cc30d['limit']=qs[_0xdd39('0x1e')](_0x1c7933['query'][_0xdd39('0x1e')]);_0x3cc30d['offset']=qs[_0xdd39('0x1d')](_0x1c7933[_0xdd39('0x2d')][_0xdd39('0x1d')]);}_0x3cc30d[_0xdd39('0x34')]=qs['sort'](_0x1c7933[_0xdd39('0x2d')][_0xdd39('0x35')]);_0x3cc30d['where']=qs[_0xdd39('0x2f')](_[_0xdd39('0x36')](_0x1c7933[_0xdd39('0x2d')],_0x30871a[_0xdd39('0x2f')]));if(_0x1c7933[_0xdd39('0x2d')][_0xdd39('0x37')]){_0x3cc30d[_0xdd39('0x38')]=_[_0xdd39('0x39')](_0x3cc30d[_0xdd39('0x38')],{'$or':_['map'](_0x5453a5,function(_0x1f996e){if(_0x1f996e[_0xdd39('0x2b')]!==_0xdd39('0x3a')){var _0x3dd810={};_0x3dd810[_0x1f996e[_0xdd39('0x25')]]={'$like':'%'+_0x1c7933[_0xdd39('0x2d')][_0xdd39('0x37')]+'%'};return _0x3dd810;}})});}_0x3cc30d=_['merge']({},_0x3cc30d,_0x1c7933['options']);var _0x4b3d7d={'where':_0x3cc30d[_0xdd39('0x38')]};return db[_0xdd39('0x3b')][_0xdd39('0x1c')](_0x4b3d7d)[_0xdd39('0x23')](function(_0x11729b){_0x4d200d[_0xdd39('0x1c')]=_0x11729b;if(_0x1c7933['query'][_0xdd39('0x3c')]){_0x3cc30d[_0xdd39('0x3d')]=[{'attributes':['id',_0xdd39('0x25'),_0xdd39('0x3e'),_0xdd39('0x3f')],'model':db['User'],'as':_0xdd39('0x40')}];}return db[_0xdd39('0x3b')][_0xdd39('0x41')](_0x3cc30d);})[_0xdd39('0x23')](function(_0x498a61){_0x4d200d[_0xdd39('0x42')]=_0x498a61;return _0x4d200d;})[_0xdd39('0x23')](respondWithFilteredResult(_0x13ae25,_0x3cc30d))[_0xdd39('0x43')](handleError(_0x13ae25,null));};exports[_0xdd39('0x44')]=function(_0x439ed5,_0x3960e0){var _0x33bde4={'raw':!![],'where':{'id':_0x439ed5[_0xdd39('0x45')]['id']}},_0x4dd478={};_0x4dd478[_0xdd39('0x2c')]=_[_0xdd39('0x2e')](db[_0xdd39('0x3b')][_0xdd39('0x29')]);_0x4dd478[_0xdd39('0x2d')]=_[_0xdd39('0x2e')](_0x439ed5[_0xdd39('0x2d')]);_0x4dd478[_0xdd39('0x2f')]=_['intersection'](_0x4dd478[_0xdd39('0x2c')],_0x4dd478[_0xdd39('0x2d')]);_0x33bde4[_0xdd39('0x31')]=_[_0xdd39('0x30')](_0x4dd478[_0xdd39('0x2c')],qs[_0xdd39('0x32')](_0x439ed5[_0xdd39('0x2d')][_0xdd39('0x32')]));_0x33bde4[_0xdd39('0x31')]=_0x33bde4['attributes'][_0xdd39('0x33')]?_0x33bde4['attributes']:_0x4dd478[_0xdd39('0x2c')];if(_0x439ed5[_0xdd39('0x2d')][_0xdd39('0x3c')]){_0x33bde4['include']=[{'all':!![]}];}_0x33bde4=_[_0xdd39('0x39')]({},_0x33bde4,_0x439ed5[_0xdd39('0x46')]);return db['VoiceCallReport'][_0xdd39('0x47')](_0x33bde4)[_0xdd39('0x23')](handleEntityNotFound(_0x3960e0,null))[_0xdd39('0x23')](respondWithResult(_0x3960e0,null))['catch'](handleError(_0x3960e0,null));};exports[_0xdd39('0x48')]=function(_0xef7567,_0x10de2f){return db[_0xdd39('0x3b')][_0xdd39('0x48')](_0xef7567['body'],{})['then'](respondWithResult(_0x10de2f,0xc9))[_0xdd39('0x43')](handleError(_0x10de2f,null));};exports['destroy']=function(_0x3676d2,_0x5a6060){return db[_0xdd39('0x3b')][_0xdd39('0x47')]({'where':{'id':_0x3676d2[_0xdd39('0x45')]['id']}})[_0xdd39('0x23')](handleEntityNotFound(_0x5a6060,null))[_0xdd39('0x23')](removeEntity(_0x5a6060,null))[_0xdd39('0x43')](handleError(_0x5a6060,null));};exports[_0xdd39('0x49')]=function(_0x245ba3,_0x52dd27){return db[_0xdd39('0x3b')][_0xdd39('0x49')]()[_0xdd39('0x23')](respondWithResult(_0x52dd27,null))[_0xdd39('0x43')](handleError(_0x52dd27,null));};exports[_0xdd39('0x22')]=function(_0x403861,_0x3f0837){if(_0x403861[_0xdd39('0x4a')][_0xdd39('0x4b')]){delete _0x403861['body'][_0xdd39('0x4b')];}return db[_0xdd39('0x3b')]['find']({'where':{'uniqueid':_0x403861[_0xdd39('0x45')]['id'],'UserId':{'$or':[null,_0x403861[_0xdd39('0x4c')]['id']]}}})[_0xdd39('0x23')](handleEntityNotFound(_0x3f0837,null))['then'](saveUpdates(_0x403861[_0xdd39('0x4a')],null))['then'](respondWithResult(_0x3f0837,null))['catch'](handleError(_0x3f0837,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index eb02730..3b9f3c3 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 _0x0862=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','lodash'];(function(_0x1e8f79,_0x1760cd){var _0x5c0802=function(_0x5488c5){while(--_0x5488c5){_0x1e8f79['push'](_0x1e8f79['shift']());}};_0x5c0802(++_0x1760cd);}(_0x0862,0x8b));var _0x2086=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x0862[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x2086('0x0'));var util=require(_0x2086('0x1'));var logger=require(_0x2086('0x2'))(_0x2086('0x3'));var moment=require(_0x2086('0x4'));var BPromise=require('bluebird');var rp=require(_0x2086('0x5'));var fs=require('fs');var path=require(_0x2086('0x6'));var rimraf=require(_0x2086('0x7'));var config=require(_0x2086('0x8'));var attributes=require(_0x2086('0x9'));module[_0x2086('0xa')]=function(_0x1e4aac,_0x5284b4){return _0x1e4aac[_0x2086('0xb')](_0x2086('0xc'),attributes,{'tableName':_0x2086('0xd'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7aae=['exports','define','VoiceCallReport','report_call','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x1f0d60,_0x58a2c2){var _0x148a20=function(_0x96e0a3){while(--_0x96e0a3){_0x1f0d60['push'](_0x1f0d60['shift']());}};_0x148a20(++_0x58a2c2);}(_0x7aae,0x157));var _0xe7aa=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x7aae[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xe7aa('0x0'));var util=require(_0xe7aa('0x1'));var logger=require('../../config/logger')(_0xe7aa('0x2'));var moment=require(_0xe7aa('0x3'));var BPromise=require(_0xe7aa('0x4'));var rp=require(_0xe7aa('0x5'));var fs=require('fs');var path=require(_0xe7aa('0x6'));var rimraf=require('rimraf');var config=require(_0xe7aa('0x7'));var attributes=require('./voiceCallReport.attributes');module[_0xe7aa('0x8')]=function(_0x447a1b,_0x328767){return _0x447a1b[_0xe7aa('0x9')](_0xe7aa('0xa'),attributes,{'tableName':_0xe7aa('0xb'),'paranoid':![],'indexes':[{'fields':[_0xe7aa('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index ae7e88e..17d75fc 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 _0x8f2c=['attributes','limit','map','include','model','GetVoiceCallReport','stringify','CreateVoiceCallReport','create','UpdateVoiceCallReport','update','body','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','VoiceCallReport','findAll','options','raw','where'];(function(_0x5ce432,_0xaa12b5){var _0x3e7e77=function(_0x74c2a2){while(--_0x74c2a2){_0x5ce432['push'](_0x5ce432['shift']());}};_0x3e7e77(++_0xaa12b5);}(_0x8f2c,0x16b));var _0xc8f2=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x8f2c[_0x29d94e];return _0x106237;};'use strict';var _=require(_0xc8f2('0x0'));var util=require(_0xc8f2('0x1'));var moment=require('moment');var BPromise=require(_0xc8f2('0x2'));var rs=require(_0xc8f2('0x3'));var fs=require('fs');var Redis=require(_0xc8f2('0x4'));var db=require(_0xc8f2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc8f2('0x6'))('rpc');var config=require(_0xc8f2('0x7'));var jayson=require(_0xc8f2('0x8'));var client=jayson[_0xc8f2('0x9')][_0xc8f2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35c6bf,_0x567cce,_0x2229b6){return new BPromise(function(_0x559f7b,_0x113c57){return client['request'](_0x35c6bf,_0x2229b6)[_0xc8f2('0xb')](function(_0x496c03){logger[_0xc8f2('0xc')](_0xc8f2('0xd'),_0x567cce,_0xc8f2('0xe'));logger[_0xc8f2('0xf')](_0xc8f2('0x10'),_0x567cce,_0xc8f2('0xe'),JSON['stringify'](_0x496c03));if(_0x496c03[_0xc8f2('0x11')]){if(_0x496c03[_0xc8f2('0x11')][_0xc8f2('0x12')]===0x1f4){logger[_0xc8f2('0x11')](_0xc8f2('0xd'),_0x567cce,_0x496c03[_0xc8f2('0x11')][_0xc8f2('0x13')]);return _0x113c57(_0x496c03['error'][_0xc8f2('0x13')]);}logger[_0xc8f2('0x11')](_0xc8f2('0xd'),_0x567cce,_0x496c03[_0xc8f2('0x11')][_0xc8f2('0x13')]);return _0x559f7b(_0x496c03[_0xc8f2('0x11')][_0xc8f2('0x13')]);}else{logger['info'](_0xc8f2('0xd'),_0x567cce,_0xc8f2('0xe'));_0x559f7b(_0x496c03[_0xc8f2('0x14')][_0xc8f2('0x13')]);}})[_0xc8f2('0x15')](function(_0x3e2e2a){logger[_0xc8f2('0x11')](_0xc8f2('0xd'),_0x567cce,_0x3e2e2a);_0x113c57(_0x3e2e2a);});});}exports['GetVoiceCallReport']=function(_0x1d91cd){var _0x43e6bd=this;return new Promise(function(_0x55ad03,_0xebe733){return db[_0xc8f2('0x16')][_0xc8f2('0x17')]({'raw':_0x1d91cd['options']?_0x1d91cd[_0xc8f2('0x18')][_0xc8f2('0x19')]===undefined?!![]:![]:!![],'where':_0x1d91cd['options']?_0x1d91cd[_0xc8f2('0x18')][_0xc8f2('0x1a')]||null:null,'attributes':_0x1d91cd[_0xc8f2('0x18')]?_0x1d91cd[_0xc8f2('0x18')][_0xc8f2('0x1b')]||null:null,'limit':_0x1d91cd[_0xc8f2('0x18')]?_0x1d91cd[_0xc8f2('0x18')][_0xc8f2('0x1c')]||null:null,'include':_0x1d91cd[_0xc8f2('0x18')]?_0x1d91cd[_0xc8f2('0x18')]['include']?_[_0xc8f2('0x1d')](_0x1d91cd[_0xc8f2('0x18')][_0xc8f2('0x1e')],function(_0x441c40){return{'model':db[_0x441c40['model']],'as':_0x441c40['as'],'attributes':_0x441c40[_0xc8f2('0x1b')],'include':_0x441c40['include']?_[_0xc8f2('0x1d')](_0x441c40[_0xc8f2('0x1e')],function(_0x2bbc15){return{'model':db[_0x2bbc15[_0xc8f2('0x1f')]],'as':_0x2bbc15['as'],'attributes':_0x2bbc15[_0xc8f2('0x1b')],'include':_0x2bbc15['include']?_['map'](_0x2bbc15[_0xc8f2('0x1e')],function(_0x4b8bbe){return{'model':db[_0x4b8bbe[_0xc8f2('0x1f')]],'as':_0x4b8bbe['as'],'attributes':_0x4b8bbe[_0xc8f2('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc8f2('0xb')](function(_0x274aa0){logger[_0xc8f2('0xc')](_0xc8f2('0x20'),_0x1d91cd);logger['debug'](_0xc8f2('0x20'),_0x1d91cd,JSON[_0xc8f2('0x21')](_0x274aa0));_0x55ad03(_0x274aa0);})[_0xc8f2('0x15')](function(_0x3b912d){logger[_0xc8f2('0x11')]('GetVoiceCallReport',_0x3b912d[_0xc8f2('0x13')],_0x1d91cd);_0xebe733(_0x43e6bd[_0xc8f2('0x11')](0x1f4,_0x3b912d[_0xc8f2('0x13')]));});});};exports[_0xc8f2('0x22')]=function(_0x11d7d2){var _0x252b63=this;return new Promise(function(_0x49d533,_0x2e8ec6){return db['VoiceCallReport'][_0xc8f2('0x23')](_0x11d7d2['body'],{'raw':_0x11d7d2['options']?_0x11d7d2['options'][_0xc8f2('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x46c823){logger['info'](_0xc8f2('0x22'),_0x11d7d2);logger['debug']('CreateVoiceCallReport',_0x11d7d2,JSON[_0xc8f2('0x21')](_0x46c823));_0x49d533(_0x46c823);})[_0xc8f2('0x15')](function(_0x381c8f){logger[_0xc8f2('0x11')]('CreateVoiceCallReport',_0x381c8f[_0xc8f2('0x13')],_0x11d7d2);_0x2e8ec6(_0x252b63[_0xc8f2('0x11')](0x1f4,_0x381c8f[_0xc8f2('0x13')]));});});};exports[_0xc8f2('0x24')]=function(_0x4cdcb4){var _0x3ae922=this;return new Promise(function(_0x47ff3a,_0x257a90){return db[_0xc8f2('0x16')][_0xc8f2('0x25')](_0x4cdcb4[_0xc8f2('0x26')],{'raw':_0x4cdcb4[_0xc8f2('0x18')]?_0x4cdcb4[_0xc8f2('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4cdcb4[_0xc8f2('0x18')]?_0x4cdcb4[_0xc8f2('0x18')][_0xc8f2('0x1a')]||null:null,'attributes':_0x4cdcb4[_0xc8f2('0x18')]?_0x4cdcb4['options']['attributes']||null:null,'limit':_0x4cdcb4[_0xc8f2('0x18')]?_0x4cdcb4[_0xc8f2('0x18')][_0xc8f2('0x1c')]||null:null})['then'](function(_0x4fa8aa){logger[_0xc8f2('0xc')](_0xc8f2('0x24'),_0x4cdcb4);logger[_0xc8f2('0xf')]('UpdateVoiceCallReport',_0x4cdcb4,JSON[_0xc8f2('0x21')](_0x4fa8aa));_0x47ff3a(_0x4fa8aa);})[_0xc8f2('0x15')](function(_0xc396e7){logger[_0xc8f2('0x11')]('UpdateVoiceCallReport',_0xc396e7[_0xc8f2('0x13')],_0x4cdcb4);_0x257a90(_0x3ae922['error'](0x1f4,_0xc396e7[_0xc8f2('0x13')]));});});}; \ No newline at end of file +var _0xadfc=['VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetVoiceCallReport','options','raw','where','limit','include','attributes','map','model','CreateVoiceCallReport','VoiceCallReport','create','UpdateVoiceCallReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x2f1c7d,_0x48cdc1){var _0x15855e=function(_0x52e960){while(--_0x52e960){_0x2f1c7d['push'](_0x2f1c7d['shift']());}};_0x15855e(++_0x48cdc1);}(_0xadfc,0x65));var _0xcadf=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xadfc[_0x5b561d];return _0x431060;};'use strict';var _=require(_0xcadf('0x0'));var util=require(_0xcadf('0x1'));var moment=require(_0xcadf('0x2'));var BPromise=require(_0xcadf('0x3'));var rs=require(_0xcadf('0x4'));var fs=require('fs');var Redis=require(_0xcadf('0x5'));var db=require(_0xcadf('0x6'))['db'];var utils=require(_0xcadf('0x7'));var logger=require(_0xcadf('0x8'))(_0xcadf('0x9'));var config=require('../../config/environment');var jayson=require(_0xcadf('0xa'));var client=jayson[_0xcadf('0xb')][_0xcadf('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5739dd,_0x2ef36a,_0x6c63a7){return new BPromise(function(_0x226a3e,_0x17f120){return client[_0xcadf('0xd')](_0x5739dd,_0x6c63a7)[_0xcadf('0xe')](function(_0x107faa){logger[_0xcadf('0xf')](_0xcadf('0x10'),_0x2ef36a,'request\x20sent');logger[_0xcadf('0x11')](_0xcadf('0x12'),_0x2ef36a,_0xcadf('0x13'),JSON[_0xcadf('0x14')](_0x107faa));if(_0x107faa[_0xcadf('0x15')]){if(_0x107faa[_0xcadf('0x15')]['code']===0x1f4){logger[_0xcadf('0x15')](_0xcadf('0x10'),_0x2ef36a,_0x107faa[_0xcadf('0x15')][_0xcadf('0x16')]);return _0x17f120(_0x107faa['error'][_0xcadf('0x16')]);}logger[_0xcadf('0x15')](_0xcadf('0x10'),_0x2ef36a,_0x107faa[_0xcadf('0x15')][_0xcadf('0x16')]);return _0x226a3e(_0x107faa[_0xcadf('0x15')][_0xcadf('0x16')]);}else{logger[_0xcadf('0xf')](_0xcadf('0x10'),_0x2ef36a,'request\x20sent');_0x226a3e(_0x107faa[_0xcadf('0x17')][_0xcadf('0x16')]);}})[_0xcadf('0x18')](function(_0xb7c5ae){logger[_0xcadf('0x15')](_0xcadf('0x10'),_0x2ef36a,_0xb7c5ae);_0x17f120(_0xb7c5ae);});});}exports[_0xcadf('0x19')]=function(_0x151b09){var _0x8b5741=this;return new Promise(function(_0x5e0bdb,_0x24e661){return db['VoiceCallReport']['findAll']({'raw':_0x151b09[_0xcadf('0x1a')]?_0x151b09[_0xcadf('0x1a')][_0xcadf('0x1b')]===undefined?!![]:![]:!![],'where':_0x151b09[_0xcadf('0x1a')]?_0x151b09[_0xcadf('0x1a')][_0xcadf('0x1c')]||null:null,'attributes':_0x151b09[_0xcadf('0x1a')]?_0x151b09[_0xcadf('0x1a')]['attributes']||null:null,'limit':_0x151b09[_0xcadf('0x1a')]?_0x151b09['options'][_0xcadf('0x1d')]||null:null,'include':_0x151b09[_0xcadf('0x1a')]?_0x151b09[_0xcadf('0x1a')][_0xcadf('0x1e')]?_['map'](_0x151b09['options'][_0xcadf('0x1e')],function(_0x2c7961){return{'model':db[_0x2c7961['model']],'as':_0x2c7961['as'],'attributes':_0x2c7961[_0xcadf('0x1f')],'include':_0x2c7961['include']?_[_0xcadf('0x20')](_0x2c7961[_0xcadf('0x1e')],function(_0x859517){return{'model':db[_0x859517[_0xcadf('0x21')]],'as':_0x859517['as'],'attributes':_0x859517[_0xcadf('0x1f')],'include':_0x859517['include']?_[_0xcadf('0x20')](_0x859517[_0xcadf('0x1e')],function(_0x1279bc){return{'model':db[_0x1279bc['model']],'as':_0x1279bc['as'],'attributes':_0x1279bc[_0xcadf('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xae03d4){logger['info'](_0xcadf('0x19'),_0x151b09);logger['debug'](_0xcadf('0x19'),_0x151b09,JSON[_0xcadf('0x14')](_0xae03d4));_0x5e0bdb(_0xae03d4);})['catch'](function(_0xa8a01e){logger[_0xcadf('0x15')](_0xcadf('0x19'),_0xa8a01e[_0xcadf('0x16')],_0x151b09);_0x24e661(_0x8b5741[_0xcadf('0x15')](0x1f4,_0xa8a01e[_0xcadf('0x16')]));});});};exports[_0xcadf('0x22')]=function(_0x34602c){var _0x4de15d=this;return new Promise(function(_0x4cdf44,_0x408925){return db[_0xcadf('0x23')][_0xcadf('0x24')](_0x34602c['body'],{'raw':_0x34602c[_0xcadf('0x1a')]?_0x34602c[_0xcadf('0x1a')][_0xcadf('0x1b')]===undefined?!![]:![]:!![]})[_0xcadf('0xe')](function(_0x51f210){logger[_0xcadf('0xf')](_0xcadf('0x22'),_0x34602c);logger[_0xcadf('0x11')]('CreateVoiceCallReport',_0x34602c,JSON[_0xcadf('0x14')](_0x51f210));_0x4cdf44(_0x51f210);})['catch'](function(_0x2d68b8){logger[_0xcadf('0x15')](_0xcadf('0x22'),_0x2d68b8[_0xcadf('0x16')],_0x34602c);_0x408925(_0x4de15d[_0xcadf('0x15')](0x1f4,_0x2d68b8[_0xcadf('0x16')]));});});};exports[_0xcadf('0x25')]=function(_0x2a0f9a){var _0x35a0cb=this;return new Promise(function(_0x85b30a,_0x3b81b8){return db[_0xcadf('0x23')][_0xcadf('0x26')](_0x2a0f9a['body'],{'raw':_0x2a0f9a[_0xcadf('0x1a')]?_0x2a0f9a[_0xcadf('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a0f9a[_0xcadf('0x1a')]?_0x2a0f9a[_0xcadf('0x1a')][_0xcadf('0x1c')]||null:null,'attributes':_0x2a0f9a[_0xcadf('0x1a')]?_0x2a0f9a['options'][_0xcadf('0x1f')]||null:null,'limit':_0x2a0f9a[_0xcadf('0x1a')]?_0x2a0f9a[_0xcadf('0x1a')][_0xcadf('0x1d')]||null:null})[_0xcadf('0xe')](function(_0x27513a){logger[_0xcadf('0xf')]('UpdateVoiceCallReport',_0x2a0f9a);logger[_0xcadf('0x11')]('UpdateVoiceCallReport',_0x2a0f9a,JSON['stringify'](_0x27513a));_0x85b30a(_0x27513a);})[_0xcadf('0x18')](function(_0x297ef0){logger[_0xcadf('0x15')]('UpdateVoiceCallReport',_0x297ef0[_0xcadf('0x16')],_0x2a0f9a);_0x3b81b8(_0x35a0cb[_0xcadf('0x15')](0x1f4,_0x297ef0[_0xcadf('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 5201f79..06bf199 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 _0xd68d=['index','post','create','put','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','./voiceChanSpy.controller','get','isAuthenticated'];(function(_0xb25124,_0x593b91){var _0x53cf6d=function(_0x3f62de){while(--_0x3f62de){_0xb25124['push'](_0xb25124['shift']());}};_0x53cf6d(++_0x593b91);}(_0xd68d,0x7f));var _0xdd68=function(_0x5efebc,_0x3fd4ae){_0x5efebc=_0x5efebc-0x0;var _0x370f59=_0xd68d[_0x5efebc];return _0x370f59;};'use strict';var multer=require(_0xdd68('0x0'));var util=require(_0xdd68('0x1'));var path=require('path');var timeout=require(_0xdd68('0x2'));var express=require(_0xdd68('0x3'));var router=express[_0xdd68('0x4')]();var auth=require(_0xdd68('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdd68('0x6'));router[_0xdd68('0x7')]('/',auth[_0xdd68('0x8')](),controller[_0xdd68('0x9')]);router[_0xdd68('0x7')]('/:id',auth[_0xdd68('0x8')](),controller['show']);router[_0xdd68('0xa')]('/',auth[_0xdd68('0x8')](),controller[_0xdd68('0xb')]);router[_0xdd68('0xc')](_0xdd68('0xd'),auth[_0xdd68('0x8')](),controller[_0xdd68('0xe')]);router[_0xdd68('0xf')](_0xdd68('0xd'),auth[_0xdd68('0x8')](),controller['destroy']);module[_0xdd68('0x10')]=router; \ No newline at end of file +var _0x88df=['../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','create','put','destroy','exports','multer','util','path','../../components/auth/service'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x88df,0x10c));var _0xf88d=function(_0x457771,_0x5a7007){_0x457771=_0x457771-0x0;var _0x5f104e=_0x88df[_0x457771];return _0x5f104e;};'use strict';var multer=require(_0xf88d('0x0'));var util=require(_0xf88d('0x1'));var path=require(_0xf88d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xf88d('0x3'));var interaction=require(_0xf88d('0x4'));var config=require(_0xf88d('0x5'));var controller=require(_0xf88d('0x6'));router[_0xf88d('0x7')]('/',auth[_0xf88d('0x8')](),controller[_0xf88d('0x9')]);router[_0xf88d('0x7')](_0xf88d('0xa'),auth[_0xf88d('0x8')](),controller[_0xf88d('0xb')]);router[_0xf88d('0xc')]('/',auth['isAuthenticated'](),controller[_0xf88d('0xd')]);router[_0xf88d('0xe')](_0xf88d('0xa'),auth[_0xf88d('0x8')](),controller['update']);router['delete'](_0xf88d('0xa'),auth[_0xf88d('0x8')](),controller[_0xf88d('0xf')]);module[_0xf88d('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 52f3bb1..206e3b1 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 _0x5ddb=['join','getDataValue','split','BOOLEAN','STRING','name','setDataValue','options'];(function(_0x32cd88,_0x43c826){var _0x47cfde=function(_0x542b73){while(--_0x542b73){_0x32cd88['push'](_0x32cd88['shift']());}};_0x47cfde(++_0x43c826);}(_0x5ddb,0xec));var _0xb5dd=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x5ddb[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb5dd('0x0')]},'prefix':{'type':Sequelize[_0xb5dd('0x0')],'unique':_0xb5dd('0x1'),'allowNull':![]},'options':{'type':Sequelize[_0xb5dd('0x0')],'set':function(_0x59f766){this[_0xb5dd('0x2')](_0xb5dd('0x3'),_0x59f766?_0x59f766[_0xb5dd('0x4')](''):[]);},'get':function(){return this[_0xb5dd('0x5')]('options')?this[_0xb5dd('0x5')]('options')[_0xb5dd('0x6')](''):[];}},'auth':{'type':Sequelize[_0xb5dd('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0xb5dd('0x0')]},'record':{'type':Sequelize[_0xb5dd('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xb5dd('0x0')]},'description':{'type':Sequelize[_0xb5dd('0x0')]}}; \ No newline at end of file +var _0x9134=['exports','STRING','name','setDataValue','options','join','getDataValue','split','BOOLEAN'];(function(_0x31d0c1,_0x58ce88){var _0x549610=function(_0x2d4240){while(--_0x2d4240){_0x31d0c1['push'](_0x31d0c1['shift']());}};_0x549610(++_0x58ce88);}(_0x9134,0x87));var _0x4913=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9134[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require('sequelize');module[_0x4913('0x0')]={'name':{'type':Sequelize[_0x4913('0x1')]},'prefix':{'type':Sequelize[_0x4913('0x1')],'unique':_0x4913('0x2'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x4d4f31){this[_0x4913('0x3')](_0x4913('0x4'),_0x4d4f31?_0x4d4f31[_0x4913('0x5')](''):[]);},'get':function(){return this[_0x4913('0x6')](_0x4913('0x4'))?this[_0x4913('0x6')]('options')[_0x4913('0x7')](''):[];}},'auth':{'type':Sequelize[_0x4913('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x4913('0x1')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x4913('0x1')]},'description':{'type':Sequelize[_0x4913('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 15e4059..23a5fc7 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 _0x4e24=['limit','set','Content-Range','apply','update','destroy','then','UserProfileResource','error','stack','name','map','VoiceChanSpy','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','count','include','findAll','rows','catch','params','includeAll','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset'];(function(_0xa2029c,_0x590021){var _0x49b2f6=function(_0x1c34d8){while(--_0x1c34d8){_0xa2029c['push'](_0xa2029c['shift']());}};_0x49b2f6(++_0x590021);}(_0x4e24,0x119));var _0x44e2=function(_0x2d06d9,_0x404966){_0x2d06d9=_0x2d06d9-0x0;var _0xc349f9=_0x4e24[_0x2d06d9];return _0xc349f9;};'use strict';var pdf=require(_0x44e2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x44e2('0x1'));var zipdir=require(_0x44e2('0x2'));var jsonpatch=require(_0x44e2('0x3'));var rp=require(_0x44e2('0x4'));var moment=require(_0x44e2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x44e2('0x6'));var util=require(_0x44e2('0x7'));var path=require(_0x44e2('0x8'));var sox=require(_0x44e2('0x9'));var csv=require(_0x44e2('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x44e2('0xb'));var squel=require(_0x44e2('0xc'));var crypto=require(_0x44e2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x44e2('0xe'));var toCsv=require(_0x44e2('0xa'));var querystring=require(_0x44e2('0xf'));var Papa=require(_0x44e2('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x44e2('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x44e2('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x44e2('0x13'));var config=require(_0x44e2('0x14'));var db=require(_0x44e2('0x15'))['db'];function respondWithStatusCode(_0x335302,_0x399633){_0x399633=_0x399633||0xcc;return function(_0xc60d73){if(_0xc60d73){return _0x335302[_0x44e2('0x16')](_0x399633);}return _0x335302['status'](_0x399633)[_0x44e2('0x17')]();};}function respondWithResult(_0x23d4d3,_0x2e77c4){_0x2e77c4=_0x2e77c4||0xc8;return function(_0x39261e){if(_0x39261e){return _0x23d4d3[_0x44e2('0x18')](_0x2e77c4)[_0x44e2('0x19')](_0x39261e);}};}function respondWithFilteredResult(_0x3cfedc,_0x24bca8){return function(_0x38adf3){if(_0x38adf3){var _0x212d68=_0x38adf3['count'],_0x404d57=_0x24bca8[_0x44e2('0x1a')],_0x38588b=_0x24bca8[_0x44e2('0x1a')]+_0x24bca8[_0x44e2('0x1b')],_0x1d63ef;if(_0x38588b>=_0x212d68){_0x38588b=_0x212d68;_0x1d63ef=0xc8;}else{_0x1d63ef=0xce;}_0x3cfedc[_0x44e2('0x18')](_0x1d63ef);return _0x3cfedc[_0x44e2('0x1c')](_0x44e2('0x1d'),_0x404d57+'-'+_0x38588b+'/'+_0x212d68)[_0x44e2('0x19')](_0x38adf3);}return null;};}function patchUpdates(_0x4693ec){return function(_0x26d9b1){try{jsonpatch[_0x44e2('0x1e')](_0x26d9b1,_0x4693ec,!![]);}catch(_0x5c98f2){return BPromise['reject'](_0x5c98f2);}return _0x26d9b1['save']();};}function saveUpdates(_0x3fe862,_0x52b791){return function(_0x432f51){if(_0x432f51){return _0x432f51[_0x44e2('0x1f')](_0x3fe862)['then'](function(_0x26fef6){return _0x26fef6;});}return null;};}function removeEntity(_0x112fa3,_0x4d9762){return function(_0x3f2810){if(_0x3f2810){return _0x3f2810[_0x44e2('0x20')]()[_0x44e2('0x21')](function(){var _0x32a8c2=_0x3f2810['get']({'plain':!![]});var _0x178c59='ChanSpies';return db[_0x44e2('0x22')][_0x44e2('0x20')]({'where':{'type':_0x178c59,'resourceId':_0x32a8c2['id']}})[_0x44e2('0x21')](function(){return _0x3f2810;});})[_0x44e2('0x21')](function(){_0x112fa3[_0x44e2('0x18')](0xcc)[_0x44e2('0x17')]();});}};}function handleEntityNotFound(_0x4328a6,_0x1ffd9d){return function(_0x946477){if(!_0x946477){_0x4328a6['sendStatus'](0x194);}return _0x946477;};}function handleError(_0x253fd9,_0x577f4f){_0x577f4f=_0x577f4f||0x1f4;return function(_0x4189e3){logger[_0x44e2('0x23')](_0x4189e3[_0x44e2('0x24')]);if(_0x4189e3[_0x44e2('0x25')]){delete _0x4189e3[_0x44e2('0x25')];}_0x253fd9['status'](_0x577f4f)['send'](_0x4189e3);};}exports['index']=function(_0xaed27,_0x3cae09){var _0x771b62={},_0x41e53a={},_0x51e258={'count':0x0,'rows':[]};var _0x315284=_[_0x44e2('0x26')](db[_0x44e2('0x27')][_0x44e2('0x28')],function(_0x27bbd2){return{'name':_0x27bbd2[_0x44e2('0x29')],'type':_0x27bbd2[_0x44e2('0x2a')]['key']};});_0x41e53a[_0x44e2('0x2b')]=_[_0x44e2('0x26')](_0x315284,_0x44e2('0x25'));_0x41e53a[_0x44e2('0x2c')]=_[_0x44e2('0x2d')](_0xaed27['query']);_0x41e53a[_0x44e2('0x2e')]=_[_0x44e2('0x2f')](_0x41e53a[_0x44e2('0x2b')],_0x41e53a[_0x44e2('0x2c')]);_0x771b62[_0x44e2('0x30')]=_[_0x44e2('0x2f')](_0x41e53a[_0x44e2('0x2b')],qs[_0x44e2('0x31')](_0xaed27[_0x44e2('0x2c')]['fields']));_0x771b62['attributes']=_0x771b62[_0x44e2('0x30')]['length']?_0x771b62[_0x44e2('0x30')]:_0x41e53a[_0x44e2('0x2b')];if(!_0xaed27[_0x44e2('0x2c')]['hasOwnProperty'](_0x44e2('0x32'))){_0x771b62[_0x44e2('0x1b')]=qs[_0x44e2('0x1b')](_0xaed27[_0x44e2('0x2c')]['limit']);_0x771b62[_0x44e2('0x1a')]=qs[_0x44e2('0x1a')](_0xaed27[_0x44e2('0x2c')][_0x44e2('0x1a')]);}_0x771b62['order']=qs['sort'](_0xaed27['query'][_0x44e2('0x33')]);_0x771b62[_0x44e2('0x34')]=qs[_0x44e2('0x2e')](_[_0x44e2('0x35')](_0xaed27[_0x44e2('0x2c')],_0x41e53a[_0x44e2('0x2e')]));if(_0xaed27['query'][_0x44e2('0x36')]){_0x771b62['where']=_['merge'](_0x771b62[_0x44e2('0x34')],{'$or':_['map'](_0x315284,function(_0x2b425b){if(_0x2b425b[_0x44e2('0x2a')]!==_0x44e2('0x37')){var _0xfae73e={};_0xfae73e[_0x2b425b[_0x44e2('0x25')]]={'$like':'%'+_0xaed27[_0x44e2('0x2c')][_0x44e2('0x36')]+'%'};return _0xfae73e;}})});}_0x771b62=_[_0x44e2('0x38')]({},_0x771b62,_0xaed27[_0x44e2('0x39')]);var _0x1a6313={'where':_0x771b62[_0x44e2('0x34')]};return db[_0x44e2('0x27')][_0x44e2('0x3a')](_0x1a6313)[_0x44e2('0x21')](function(_0x651f7b){_0x51e258[_0x44e2('0x3a')]=_0x651f7b;if(_0xaed27[_0x44e2('0x2c')]['includeAll']){_0x771b62[_0x44e2('0x3b')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x44e2('0x3c')](_0x771b62);})[_0x44e2('0x21')](function(_0x4e99bf){_0x51e258[_0x44e2('0x3d')]=_0x4e99bf;return _0x51e258;})[_0x44e2('0x21')](respondWithFilteredResult(_0x3cae09,_0x771b62))[_0x44e2('0x3e')](handleError(_0x3cae09,null));};exports['show']=function(_0x211215,_0x46ab92){var _0x52cccb={'raw':![],'where':{'id':_0x211215[_0x44e2('0x3f')]['id']}},_0x2147a4={};_0x2147a4['model']=_[_0x44e2('0x2d')](db[_0x44e2('0x27')][_0x44e2('0x28')]);_0x2147a4[_0x44e2('0x2c')]=_[_0x44e2('0x2d')](_0x211215[_0x44e2('0x2c')]);_0x2147a4['filters']=_['intersection'](_0x2147a4['model'],_0x2147a4[_0x44e2('0x2c')]);_0x52cccb[_0x44e2('0x30')]=_[_0x44e2('0x2f')](_0x2147a4[_0x44e2('0x2b')],qs[_0x44e2('0x31')](_0x211215[_0x44e2('0x2c')]['fields']));_0x52cccb[_0x44e2('0x30')]=_0x52cccb[_0x44e2('0x30')]['length']?_0x52cccb[_0x44e2('0x30')]:_0x2147a4[_0x44e2('0x2b')];if(_0x211215[_0x44e2('0x2c')][_0x44e2('0x40')]){_0x52cccb[_0x44e2('0x3b')]=[{'all':!![]}];}_0x52cccb=_[_0x44e2('0x38')]({},_0x52cccb,_0x211215[_0x44e2('0x39')]);return db['VoiceChanSpy'][_0x44e2('0x41')](_0x52cccb)['then'](handleEntityNotFound(_0x46ab92,null))[_0x44e2('0x21')](respondWithResult(_0x46ab92,null))['catch'](handleError(_0x46ab92,null));};exports['create']=function(_0x5ade58,_0xf6f9f){return db[_0x44e2('0x27')][_0x44e2('0x42')](_0x5ade58['body'],{})[_0x44e2('0x21')](function(_0x10d224){var _0x593553=_0x5ade58[_0x44e2('0x43')][_0x44e2('0x44')]({'plain':!![]});if(!_0x593553)throw new Error(_0x44e2('0x45'));if(_0x593553[_0x44e2('0x46')]===_0x44e2('0x43')){var _0x1813a1=_0x10d224['get']({'plain':!![]});var _0x25b2ae=_0x44e2('0x47');return db[_0x44e2('0x48')][_0x44e2('0x41')]({'where':{'name':_0x25b2ae,'userProfileId':_0x593553[_0x44e2('0x49')]},'raw':!![]})['then'](function(_0xb858ec){if(_0xb858ec&&_0xb858ec[_0x44e2('0x4a')]===0x0){return db[_0x44e2('0x22')][_0x44e2('0x42')]({'name':_0x1813a1[_0x44e2('0x25')],'resourceId':_0x1813a1['id'],'type':_0xb858ec[_0x44e2('0x25')],'sectionId':_0xb858ec['id']},{})['then'](function(){return _0x10d224;});}else{return _0x10d224;}})[_0x44e2('0x3e')](function(_0x40dc57){logger[_0x44e2('0x23')](_0x44e2('0x4b'),_0x40dc57);throw _0x40dc57;});}return _0x10d224;})[_0x44e2('0x21')](respondWithResult(_0xf6f9f,0xc9))[_0x44e2('0x3e')](handleError(_0xf6f9f,null));};exports['update']=function(_0x52b724,_0x3d0914){if(_0x52b724[_0x44e2('0x4c')]['id']){delete _0x52b724[_0x44e2('0x4c')]['id'];}return db[_0x44e2('0x27')][_0x44e2('0x41')]({'where':{'id':_0x52b724[_0x44e2('0x3f')]['id']}})[_0x44e2('0x21')](handleEntityNotFound(_0x3d0914,null))[_0x44e2('0x21')](saveUpdates(_0x52b724['body'],null))[_0x44e2('0x21')](respondWithResult(_0x3d0914,null))[_0x44e2('0x3e')](handleError(_0x3d0914,null));};exports['destroy']=function(_0x426384,_0x3d63df){return db[_0x44e2('0x27')][_0x44e2('0x41')]({'where':{'id':_0x426384['params']['id']}})[_0x44e2('0x21')](handleEntityNotFound(_0x3d63df,null))[_0x44e2('0x21')](removeEntity(_0x3d63df,null))['catch'](handleError(_0x3d63df,null));}; \ No newline at end of file +var _0x7dc6=['find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','get','ChanSpies','UserProfileResource','error','name','send','index','map','VoiceChanSpy','key','query','keys','filters','intersection','model','attributes','fields','nolimit','order','where','pick','filter','type','merge','options','includeAll','findAll','rows','params','rawAttributes'];(function(_0x285957,_0x56620b){var _0x2c9d9a=function(_0x494d1c){while(--_0x494d1c){_0x285957['push'](_0x285957['shift']());}};_0x2c9d9a(++_0x56620b);}(_0x7dc6,0xed));var _0x67dc=function(_0x291ae6,_0x416d09){_0x291ae6=_0x291ae6-0x0;var _0x1222dc=_0x7dc6[_0x291ae6];return _0x1222dc;};'use strict';var pdf=require(_0x67dc('0x0'));var emlformat=require(_0x67dc('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x67dc('0x2'));var jsonpatch=require(_0x67dc('0x3'));var rp=require('request-promise');var moment=require(_0x67dc('0x4'));var BPromise=require(_0x67dc('0x5'));var Mustache=require(_0x67dc('0x6'));var util=require(_0x67dc('0x7'));var path=require(_0x67dc('0x8'));var sox=require(_0x67dc('0x9'));var csv=require(_0x67dc('0xa'));var ejs=require(_0x67dc('0xb'));var fs=require('fs');var _=require(_0x67dc('0xc'));var squel=require(_0x67dc('0xd'));var crypto=require(_0x67dc('0xe'));var jsforce=require(_0x67dc('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x67dc('0xa'));var querystring=require(_0x67dc('0x10'));var Papa=require(_0x67dc('0x11'));var Redis=require('ioredis');var authService=require(_0x67dc('0x12'));var qs=require(_0x67dc('0x13'));var as=require(_0x67dc('0x14'));var hardwareService=require(_0x67dc('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x67dc('0x16'));var config=require('../../config/environment');var db=require(_0x67dc('0x17'))['db'];function respondWithStatusCode(_0x1e63e9,_0x4bde84){_0x4bde84=_0x4bde84||0xcc;return function(_0x5d9b87){if(_0x5d9b87){return _0x1e63e9[_0x67dc('0x18')](_0x4bde84);}return _0x1e63e9['status'](_0x4bde84)['end']();};}function respondWithResult(_0x141366,_0x2d5d1d){_0x2d5d1d=_0x2d5d1d||0xc8;return function(_0x4c1f51){if(_0x4c1f51){return _0x141366[_0x67dc('0x19')](_0x2d5d1d)[_0x67dc('0x1a')](_0x4c1f51);}};}function respondWithFilteredResult(_0x199289,_0x26e2ef){return function(_0x1ff29b){if(_0x1ff29b){var _0x25fb65=_0x1ff29b[_0x67dc('0x1b')],_0x2da064=_0x26e2ef[_0x67dc('0x1c')],_0x12a0a1=_0x26e2ef[_0x67dc('0x1c')]+_0x26e2ef[_0x67dc('0x1d')],_0x394b90;if(_0x12a0a1>=_0x25fb65){_0x12a0a1=_0x25fb65;_0x394b90=0xc8;}else{_0x394b90=0xce;}_0x199289['status'](_0x394b90);return _0x199289[_0x67dc('0x1e')]('Content-Range',_0x2da064+'-'+_0x12a0a1+'/'+_0x25fb65)[_0x67dc('0x1a')](_0x1ff29b);}return null;};}function patchUpdates(_0x549ce8){return function(_0x42ce12){try{jsonpatch[_0x67dc('0x1f')](_0x42ce12,_0x549ce8,!![]);}catch(_0x356643){return BPromise[_0x67dc('0x20')](_0x356643);}return _0x42ce12[_0x67dc('0x21')]();};}function saveUpdates(_0x520d27,_0x59983a){return function(_0x4aee97){if(_0x4aee97){return _0x4aee97[_0x67dc('0x22')](_0x520d27)[_0x67dc('0x23')](function(_0x1669ad){return _0x1669ad;});}return null;};}function removeEntity(_0x37d131,_0x3129fd){return function(_0x8c0a6f){if(_0x8c0a6f){return _0x8c0a6f[_0x67dc('0x24')]()[_0x67dc('0x23')](function(){var _0x14ea6a=_0x8c0a6f[_0x67dc('0x25')]({'plain':!![]});var _0x1d5011=_0x67dc('0x26');return db[_0x67dc('0x27')]['destroy']({'where':{'type':_0x1d5011,'resourceId':_0x14ea6a['id']}})[_0x67dc('0x23')](function(){return _0x8c0a6f;});})[_0x67dc('0x23')](function(){_0x37d131['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fe774,_0x397019){return function(_0x3e8752){if(!_0x3e8752){_0x4fe774['sendStatus'](0x194);}return _0x3e8752;};}function handleError(_0x8652e3,_0x5d7563){_0x5d7563=_0x5d7563||0x1f4;return function(_0x23b65f){logger[_0x67dc('0x28')](_0x23b65f['stack']);if(_0x23b65f[_0x67dc('0x29')]){delete _0x23b65f[_0x67dc('0x29')];}_0x8652e3[_0x67dc('0x19')](_0x5d7563)[_0x67dc('0x2a')](_0x23b65f);};}exports[_0x67dc('0x2b')]=function(_0x5ce4b2,_0x12fe6c){var _0x1e2fcd={},_0x3f3dc0={},_0x295682={'count':0x0,'rows':[]};var _0x23ea74=_[_0x67dc('0x2c')](db[_0x67dc('0x2d')]['rawAttributes'],function(_0x542087){return{'name':_0x542087['fieldName'],'type':_0x542087['type'][_0x67dc('0x2e')]};});_0x3f3dc0['model']=_[_0x67dc('0x2c')](_0x23ea74,_0x67dc('0x29'));_0x3f3dc0[_0x67dc('0x2f')]=_[_0x67dc('0x30')](_0x5ce4b2['query']);_0x3f3dc0[_0x67dc('0x31')]=_[_0x67dc('0x32')](_0x3f3dc0[_0x67dc('0x33')],_0x3f3dc0[_0x67dc('0x2f')]);_0x1e2fcd[_0x67dc('0x34')]=_[_0x67dc('0x32')](_0x3f3dc0['model'],qs[_0x67dc('0x35')](_0x5ce4b2[_0x67dc('0x2f')][_0x67dc('0x35')]));_0x1e2fcd[_0x67dc('0x34')]=_0x1e2fcd[_0x67dc('0x34')]['length']?_0x1e2fcd[_0x67dc('0x34')]:_0x3f3dc0[_0x67dc('0x33')];if(!_0x5ce4b2[_0x67dc('0x2f')]['hasOwnProperty'](_0x67dc('0x36'))){_0x1e2fcd[_0x67dc('0x1d')]=qs['limit'](_0x5ce4b2[_0x67dc('0x2f')][_0x67dc('0x1d')]);_0x1e2fcd[_0x67dc('0x1c')]=qs[_0x67dc('0x1c')](_0x5ce4b2[_0x67dc('0x2f')][_0x67dc('0x1c')]);}_0x1e2fcd[_0x67dc('0x37')]=qs['sort'](_0x5ce4b2[_0x67dc('0x2f')]['sort']);_0x1e2fcd[_0x67dc('0x38')]=qs['filters'](_[_0x67dc('0x39')](_0x5ce4b2[_0x67dc('0x2f')],_0x3f3dc0[_0x67dc('0x31')]));if(_0x5ce4b2[_0x67dc('0x2f')][_0x67dc('0x3a')]){_0x1e2fcd[_0x67dc('0x38')]=_['merge'](_0x1e2fcd['where'],{'$or':_[_0x67dc('0x2c')](_0x23ea74,function(_0x179d64){if(_0x179d64[_0x67dc('0x3b')]!=='VIRTUAL'){var _0x1b638f={};_0x1b638f[_0x179d64['name']]={'$like':'%'+_0x5ce4b2[_0x67dc('0x2f')][_0x67dc('0x3a')]+'%'};return _0x1b638f;}})});}_0x1e2fcd=_[_0x67dc('0x3c')]({},_0x1e2fcd,_0x5ce4b2[_0x67dc('0x3d')]);var _0x39b925={'where':_0x1e2fcd['where']};return db[_0x67dc('0x2d')][_0x67dc('0x1b')](_0x39b925)[_0x67dc('0x23')](function(_0x2cbfed){_0x295682[_0x67dc('0x1b')]=_0x2cbfed;if(_0x5ce4b2['query'][_0x67dc('0x3e')]){_0x1e2fcd['include']=[{'all':!![]}];}return db['VoiceChanSpy'][_0x67dc('0x3f')](_0x1e2fcd);})['then'](function(_0x594789){_0x295682[_0x67dc('0x40')]=_0x594789;return _0x295682;})[_0x67dc('0x23')](respondWithFilteredResult(_0x12fe6c,_0x1e2fcd))['catch'](handleError(_0x12fe6c,null));};exports['show']=function(_0x1f9cd1,_0x5355eb){var _0x275106={'raw':![],'where':{'id':_0x1f9cd1[_0x67dc('0x41')]['id']}},_0x11b2ca={};_0x11b2ca[_0x67dc('0x33')]=_['keys'](db[_0x67dc('0x2d')][_0x67dc('0x42')]);_0x11b2ca['query']=_['keys'](_0x1f9cd1['query']);_0x11b2ca[_0x67dc('0x31')]=_[_0x67dc('0x32')](_0x11b2ca[_0x67dc('0x33')],_0x11b2ca[_0x67dc('0x2f')]);_0x275106[_0x67dc('0x34')]=_['intersection'](_0x11b2ca[_0x67dc('0x33')],qs[_0x67dc('0x35')](_0x1f9cd1['query']['fields']));_0x275106[_0x67dc('0x34')]=_0x275106['attributes']['length']?_0x275106['attributes']:_0x11b2ca[_0x67dc('0x33')];if(_0x1f9cd1[_0x67dc('0x2f')][_0x67dc('0x3e')]){_0x275106['include']=[{'all':!![]}];}_0x275106=_['merge']({},_0x275106,_0x1f9cd1[_0x67dc('0x3d')]);return db['VoiceChanSpy'][_0x67dc('0x43')](_0x275106)[_0x67dc('0x23')](handleEntityNotFound(_0x5355eb,null))['then'](respondWithResult(_0x5355eb,null))[_0x67dc('0x44')](handleError(_0x5355eb,null));};exports['create']=function(_0x368685,_0x14373c){return db['VoiceChanSpy'][_0x67dc('0x45')](_0x368685[_0x67dc('0x46')],{})[_0x67dc('0x23')](function(_0x321ee5){var _0x4f27a2=_0x368685[_0x67dc('0x47')][_0x67dc('0x25')]({'plain':!![]});if(!_0x4f27a2)throw new Error(_0x67dc('0x48'));if(_0x4f27a2[_0x67dc('0x49')]===_0x67dc('0x47')){var _0x1a0d5d=_0x321ee5[_0x67dc('0x25')]({'plain':!![]});var _0x1eaa4d='ChanSpies';return db[_0x67dc('0x4a')][_0x67dc('0x43')]({'where':{'name':_0x1eaa4d,'userProfileId':_0x4f27a2[_0x67dc('0x4b')]},'raw':!![]})[_0x67dc('0x23')](function(_0x4ccf4d){if(_0x4ccf4d&&_0x4ccf4d['autoAssociation']===0x0){return db[_0x67dc('0x27')][_0x67dc('0x45')]({'name':_0x1a0d5d[_0x67dc('0x29')],'resourceId':_0x1a0d5d['id'],'type':_0x4ccf4d[_0x67dc('0x29')],'sectionId':_0x4ccf4d['id']},{})[_0x67dc('0x23')](function(){return _0x321ee5;});}else{return _0x321ee5;}})[_0x67dc('0x44')](function(_0x3473cf){logger[_0x67dc('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3473cf);throw _0x3473cf;});}return _0x321ee5;})[_0x67dc('0x23')](respondWithResult(_0x14373c,0xc9))[_0x67dc('0x44')](handleError(_0x14373c,null));};exports[_0x67dc('0x22')]=function(_0x67f2ec,_0x5df8cd){if(_0x67f2ec[_0x67dc('0x46')]['id']){delete _0x67f2ec['body']['id'];}return db[_0x67dc('0x2d')][_0x67dc('0x43')]({'where':{'id':_0x67f2ec[_0x67dc('0x41')]['id']}})[_0x67dc('0x23')](handleEntityNotFound(_0x5df8cd,null))[_0x67dc('0x23')](saveUpdates(_0x67f2ec['body'],null))[_0x67dc('0x23')](respondWithResult(_0x5df8cd,null))[_0x67dc('0x44')](handleError(_0x5df8cd,null));};exports[_0x67dc('0x24')]=function(_0x2fc27b,_0x4a4d75){return db[_0x67dc('0x2d')][_0x67dc('0x43')]({'where':{'id':_0x2fc27b[_0x67dc('0x41')]['id']}})[_0x67dc('0x23')](handleEntityNotFound(_0x4a4d75,null))[_0x67dc('0x23')](removeEntity(_0x4a4d75,null))['catch'](handleError(_0x4a4d75,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 599492b..c945205 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 _0xa67b=['define','VoiceChanSpy','destroy','VoiceExtension','bulkCreate','lodash','util','bluebird','./voiceChanSpy.attributes','from-sip','%s%s','prefix','push','merge','format','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,ab','recordingFormat','auth','Authenticate','password','SIP/%s,%s','name','options','join','StopMixMonitor','length','internal','concat','User','findAll','agent','then','catch','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa67b,0xc3));var _0xba67=function(_0xefa124,_0x30d71a){_0xefa124=_0xefa124-0x0;var _0x1517f9=_0xa67b[_0xefa124];return _0x1517f9;};'use strict';var _=require(_0xba67('0x0'));var util=require(_0xba67('0x1'));var BPromise=require(_0xba67('0x2'));var attributes=require(_0xba67('0x3'));var getUserApplications=function(_0x4ecd1c,_0xc0abe4,_0x33ba3a){var _0x529dcd=0x1;var _0xda05e3=[];var _0x348d54={'context':_0xc0abe4['context']||_0xba67('0x4'),'exten':util['format'](_0xba67('0x5'),_0x4ecd1c[_0xba67('0x6')],_0x33ba3a),'type':'system','isApp':![],'ChanSpyId':_0x4ecd1c['id'],'UserId':_0xc0abe4['id']};_0xda05e3[_0xba67('0x7')](_[_0xba67('0x8')]({'app':'Set','appdata':util[_0xba67('0x9')](_0xba67('0xa'),_0xba67('0xb')),'priority':_0x529dcd++},_0x348d54));if(_0x4ecd1c[_0xba67('0xc')]){_0xda05e3[_0xba67('0x7')](_[_0xba67('0x8')]({'app':_0xba67('0xd'),'appdata':util['format'](_0xba67('0xe'),_0x4ecd1c[_0xba67('0xf')]),'priority':_0x529dcd++},_0x348d54));}if(_0x4ecd1c[_0xba67('0x10')]){_0xda05e3[_0xba67('0x7')](_[_0xba67('0x8')]({'app':_0xba67('0x11'),'appdata':_0x4ecd1c[_0xba67('0x12')],'priority':_0x529dcd++},_0x348d54));}_0xda05e3[_0xba67('0x7')](_[_0xba67('0x8')]({'app':'ChanSpy','appdata':util['format'](_0xba67('0x13'),_0xc0abe4[_0xba67('0x14')],_0x4ecd1c[_0xba67('0x15')]?_0x4ecd1c[_0xba67('0x15')][_0xba67('0x16')](''):''),'priority':_0x529dcd++},_0x348d54));if(_0x4ecd1c['record']){_0xda05e3[_0xba67('0x7')](_[_0xba67('0x8')]({'app':_0xba67('0x17'),'priority':_0x529dcd++},_0x348d54));}return _0xda05e3;};var getChanSpyApplications=function(_0x209442,_0x55f40a){var _0x22e847=[];for(var _0x53e4ef=0x0,_0x3d9767=0x1;_0x53e4ef<_0x55f40a[_0xba67('0x18')];_0x53e4ef++,_0x3d9767=0x1){_0x22e847=_0x22e847['concat'](getUserApplications(_0x209442,_0x55f40a[_0x53e4ef],_0x55f40a[_0x53e4ef][_0xba67('0x19')]));if(_0x55f40a[_0x53e4ef]['internal']!=_0x55f40a[_0x53e4ef][_0xba67('0x14')]){_0x22e847=_0x22e847[_0xba67('0x1a')](getUserApplications(_0x209442,_0x55f40a[_0x53e4ef],_0x55f40a[_0x53e4ef][_0xba67('0x14')]));}}return _0x22e847;};var getChanSpyPromise=function(_0x3c44a7,_0x3e275a){return new BPromise(function(_0x27e15d,_0x232916){return _0x3c44a7[_0xba67('0x1b')][_0xba67('0x1c')]({'attributes':['id',_0xba67('0x14'),_0xba67('0x19')],'where':{'role':_0xba67('0x1d'),'chanspy':!![]},'raw':!![]})[_0xba67('0x1e')](function(_0x480b82){if(_0x480b82){return _0x27e15d(getChanSpyApplications(_0x3e275a,_0x480b82));}return _0x27e15d([]);})[_0xba67('0x1f')](function(_0x40b57f){_0x232916(_0x40b57f);});});};module[_0xba67('0x20')]=function(_0xcb82b7,_0xa58a0a){var _0x4ca116=_0xcb82b7['models'];return _0xcb82b7[_0xba67('0x21')](_0xba67('0x22'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x333b6d,_0x117a49,_0x125c00){return getChanSpyPromise(_0x4ca116,_0x333b6d)[_0xba67('0x1e')](function(_0x1f4cdf){if(_0x1f4cdf&&_0x1f4cdf[_0xba67('0x18')]){return _0x4ca116['VoiceExtension']['bulkCreate'](_0x1f4cdf);}})[_0xba67('0x1e')](function(){_0x125c00();})[_0xba67('0x1f')](function(_0x208f07){_0x125c00(_0x208f07);});},'afterUpdate':function(_0x65275c,_0x4e2cdd,_0x5842e3){return _0x4ca116['VoiceExtension'][_0xba67('0x23')]({'where':{'ChanSpyId':_0x65275c['id']}})[_0xba67('0x1e')](function(){return getChanSpyPromise(_0x4ca116,_0x65275c);})[_0xba67('0x1e')](function(_0x4c6241){if(_0x4c6241&&_0x4c6241[_0xba67('0x18')]){return _0x4ca116[_0xba67('0x24')][_0xba67('0x25')](_0x4c6241);}})[_0xba67('0x1e')](function(){_0x5842e3();})['catch'](function(_0x121dd4){_0x5842e3(_0x121dd4);});},'afterDestroy':function(_0x16a04f,_0x53afce,_0x11907a){return _0x4ca116[_0xba67('0x24')][_0xba67('0x23')]({'where':{'ChanSpyId':_0x16a04f['id']}})[_0xba67('0x1e')](function(){_0x11907a();})[_0xba67('0x1f')](function(_0x74d8){_0x11907a(_0x74d8);});}}});}; \ No newline at end of file +var _0x5ebb=['MixMonitor','recordingFormat','auth','password','ChanSpy','SIP/%s,%s','options','join','length','concat','internal','name','findAll','catch','exports','models','define','VoiceChanSpy','voice_chanspy','then','bulkCreate','VoiceExtension','destroy','lodash','util','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','push','merge','Set','chanspy','record'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5ebb,0xf5));var _0xb5eb=function(_0x317412,_0xd00b08){_0x317412=_0x317412-0x0;var _0x904316=_0x5ebb[_0x317412];return _0x904316;};'use strict';var _=require(_0xb5eb('0x0'));var util=require(_0xb5eb('0x1'));var BPromise=require('bluebird');var attributes=require(_0xb5eb('0x2'));var getUserApplications=function(_0x2cd629,_0x325332,_0x3bdfb6){var _0x5f5342=0x1;var _0x518cc4=[];var _0x5d1dd1={'context':_0x325332[_0xb5eb('0x3')]||_0xb5eb('0x4'),'exten':util[_0xb5eb('0x5')](_0xb5eb('0x6'),_0x2cd629[_0xb5eb('0x7')],_0x3bdfb6),'type':_0xb5eb('0x8'),'isApp':![],'ChanSpyId':_0x2cd629['id'],'UserId':_0x325332['id']};_0x518cc4[_0xb5eb('0x9')](_[_0xb5eb('0xa')]({'app':_0xb5eb('0xb'),'appdata':util[_0xb5eb('0x5')]('CDR(type)=%s',_0xb5eb('0xc')),'priority':_0x5f5342++},_0x5d1dd1));if(_0x2cd629[_0xb5eb('0xd')]){_0x518cc4['push'](_[_0xb5eb('0xa')]({'app':_0xb5eb('0xe'),'appdata':util[_0xb5eb('0x5')]('${UNIQUEID}.%s,ab',_0x2cd629[_0xb5eb('0xf')]),'priority':_0x5f5342++},_0x5d1dd1));}if(_0x2cd629[_0xb5eb('0x10')]){_0x518cc4[_0xb5eb('0x9')](_[_0xb5eb('0xa')]({'app':'Authenticate','appdata':_0x2cd629[_0xb5eb('0x11')],'priority':_0x5f5342++},_0x5d1dd1));}_0x518cc4[_0xb5eb('0x9')](_['merge']({'app':_0xb5eb('0x12'),'appdata':util[_0xb5eb('0x5')](_0xb5eb('0x13'),_0x325332['name'],_0x2cd629[_0xb5eb('0x14')]?_0x2cd629['options'][_0xb5eb('0x15')](''):''),'priority':_0x5f5342++},_0x5d1dd1));if(_0x2cd629[_0xb5eb('0xd')]){_0x518cc4['push'](_[_0xb5eb('0xa')]({'app':'StopMixMonitor','priority':_0x5f5342++},_0x5d1dd1));}return _0x518cc4;};var getChanSpyApplications=function(_0x495cfb,_0x2b00d8){var _0x438e6b=[];for(var _0x4e2aee=0x0,_0x57981f=0x1;_0x4e2aee<_0x2b00d8[_0xb5eb('0x16')];_0x4e2aee++,_0x57981f=0x1){_0x438e6b=_0x438e6b[_0xb5eb('0x17')](getUserApplications(_0x495cfb,_0x2b00d8[_0x4e2aee],_0x2b00d8[_0x4e2aee][_0xb5eb('0x18')]));if(_0x2b00d8[_0x4e2aee][_0xb5eb('0x18')]!=_0x2b00d8[_0x4e2aee][_0xb5eb('0x19')]){_0x438e6b=_0x438e6b[_0xb5eb('0x17')](getUserApplications(_0x495cfb,_0x2b00d8[_0x4e2aee],_0x2b00d8[_0x4e2aee][_0xb5eb('0x19')]));}}return _0x438e6b;};var getChanSpyPromise=function(_0xc4e814,_0x1db3bd){return new BPromise(function(_0x592df9,_0x17edb0){return _0xc4e814['User'][_0xb5eb('0x1a')]({'attributes':['id',_0xb5eb('0x19'),_0xb5eb('0x18')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})['then'](function(_0xa4774d){if(_0xa4774d){return _0x592df9(getChanSpyApplications(_0x1db3bd,_0xa4774d));}return _0x592df9([]);})[_0xb5eb('0x1b')](function(_0x4326f4){_0x17edb0(_0x4326f4);});});};module[_0xb5eb('0x1c')]=function(_0x13f85d,_0x306b18){var _0x43cb78=_0x13f85d[_0xb5eb('0x1d')];return _0x13f85d[_0xb5eb('0x1e')](_0xb5eb('0x1f'),attributes,{'tableName':_0xb5eb('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3f807a,_0x742f8a,_0x1a9361){return getChanSpyPromise(_0x43cb78,_0x3f807a)[_0xb5eb('0x21')](function(_0x2782a1){if(_0x2782a1&&_0x2782a1[_0xb5eb('0x16')]){return _0x43cb78['VoiceExtension'][_0xb5eb('0x22')](_0x2782a1);}})[_0xb5eb('0x21')](function(){_0x1a9361();})[_0xb5eb('0x1b')](function(_0x457846){_0x1a9361(_0x457846);});},'afterUpdate':function(_0x5138d3,_0x58614f,_0x388a14){return _0x43cb78['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x5138d3['id']}})[_0xb5eb('0x21')](function(){return getChanSpyPromise(_0x43cb78,_0x5138d3);})[_0xb5eb('0x21')](function(_0x464cec){if(_0x464cec&&_0x464cec[_0xb5eb('0x16')]){return _0x43cb78['VoiceExtension'][_0xb5eb('0x22')](_0x464cec);}})[_0xb5eb('0x21')](function(){_0x388a14();})[_0xb5eb('0x1b')](function(_0x2e7c23){_0x388a14(_0x2e7c23);});},'afterDestroy':function(_0x5ec359,_0x59b376,_0x30b1fe){return _0x43cb78[_0xb5eb('0x23')][_0xb5eb('0x24')]({'where':{'ChanSpyId':_0x5ec359['id']}})[_0xb5eb('0x21')](function(){_0x30b1fe();})['catch'](function(_0x1280be){_0x30b1fe(_0x1280be);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index eea6188..10d7f6b 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 _0x01de=['../../config/utils','rpc','../../config/environment','client','http','request','then','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x503019,_0x5e5987){var _0x430190=function(_0x4cfac2){while(--_0x4cfac2){_0x503019['push'](_0x503019['shift']());}};_0x430190(++_0x5e5987);}(_0x01de,0x19f));var _0xe01d=function(_0x1a80db,_0x39be26){_0x1a80db=_0x1a80db-0x0;var _0x143503=_0x01de[_0x1a80db];return _0x143503;};'use strict';var _=require('lodash');var util=require(_0xe01d('0x0'));var moment=require(_0xe01d('0x1'));var BPromise=require(_0xe01d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe01d('0x3'));var db=require(_0xe01d('0x4'))['db'];var utils=require(_0xe01d('0x5'));var logger=require('../../config/logger')(_0xe01d('0x6'));var config=require(_0xe01d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe01d('0x8')][_0xe01d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x532f94,_0x3e7df8,_0x55f87a){return new BPromise(function(_0x5699bf,_0x2334f1){return client[_0xe01d('0xa')](_0x532f94,_0x55f87a)[_0xe01d('0xb')](function(_0x1c85f1){logger['info'](_0xe01d('0xc'),_0x3e7df8,_0xe01d('0xd'));logger['debug'](_0xe01d('0xe'),_0x3e7df8,_0xe01d('0xd'),JSON[_0xe01d('0xf')](_0x1c85f1));if(_0x1c85f1['error']){if(_0x1c85f1[_0xe01d('0x10')][_0xe01d('0x11')]===0x1f4){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x3e7df8,_0x1c85f1[_0xe01d('0x10')][_0xe01d('0x12')]);return _0x2334f1(_0x1c85f1[_0xe01d('0x10')][_0xe01d('0x12')]);}logger['error'](_0xe01d('0xc'),_0x3e7df8,_0x1c85f1['error']['message']);return _0x5699bf(_0x1c85f1[_0xe01d('0x10')][_0xe01d('0x12')]);}else{logger[_0xe01d('0x13')](_0xe01d('0xc'),_0x3e7df8,_0xe01d('0xd'));_0x5699bf(_0x1c85f1['result'][_0xe01d('0x12')]);}})[_0xe01d('0x14')](function(_0x4b9a2f){logger[_0xe01d('0x10')](_0xe01d('0xc'),_0x3e7df8,_0x4b9a2f);_0x2334f1(_0x4b9a2f);});});} \ No newline at end of file +var _0x17ff=['VoiceChanSpy,\x20%s,\x20%s,\x20%s','VoiceChanSpy,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','request\x20sent','debug'];(function(_0x3879f5,_0x5b4fe8){var _0x27ee90=function(_0x46484a){while(--_0x46484a){_0x3879f5['push'](_0x3879f5['shift']());}};_0x27ee90(++_0x5b4fe8);}(_0x17ff,0x1e9));var _0xf17f=function(_0x16aa09,_0xbadd28){_0x16aa09=_0x16aa09-0x0;var _0x55f174=_0x17ff[_0x16aa09];return _0x55f174;};'use strict';var _=require(_0xf17f('0x0'));var util=require(_0xf17f('0x1'));var moment=require(_0xf17f('0x2'));var BPromise=require(_0xf17f('0x3'));var rs=require(_0xf17f('0x4'));var fs=require('fs');var Redis=require(_0xf17f('0x5'));var db=require(_0xf17f('0x6'))['db'];var utils=require(_0xf17f('0x7'));var logger=require(_0xf17f('0x8'))('rpc');var config=require(_0xf17f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf17f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e750c,_0x459c53,_0x47d438){return new BPromise(function(_0x103784,_0x15fa00){return client[_0xf17f('0xb')](_0x2e750c,_0x47d438)[_0xf17f('0xc')](function(_0x563f4a){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x459c53,_0xf17f('0xd'));logger[_0xf17f('0xe')](_0xf17f('0xf'),_0x459c53,_0xf17f('0xd'),JSON['stringify'](_0x563f4a));if(_0x563f4a['error']){if(_0x563f4a['error']['code']===0x1f4){logger['error'](_0xf17f('0x10'),_0x459c53,_0x563f4a[_0xf17f('0x11')][_0xf17f('0x12')]);return _0x15fa00(_0x563f4a['error'][_0xf17f('0x12')]);}logger[_0xf17f('0x11')](_0xf17f('0x10'),_0x459c53,_0x563f4a[_0xf17f('0x11')][_0xf17f('0x12')]);return _0x103784(_0x563f4a[_0xf17f('0x11')]['message']);}else{logger['info'](_0xf17f('0x10'),_0x459c53,_0xf17f('0xd'));_0x103784(_0x563f4a[_0xf17f('0x13')][_0xf17f('0x12')]);}})[_0xf17f('0x14')](function(_0x2987ec){logger[_0xf17f('0x11')](_0xf17f('0x10'),_0x459c53,_0x2987ec);_0x15fa00(_0x2987ec);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index ffa4828..b0d5eef 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 _0x7e0a=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put','update','delete','exports','multer','util','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7e0a,0xc3));var _0xa7e0=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x7e0a[_0x422905];return _0x33dc6c;};'use strict';var multer=require(_0xa7e0('0x0'));var util=require(_0xa7e0('0x1'));var path=require('path');var timeout=require(_0xa7e0('0x2'));var express=require(_0xa7e0('0x3'));var router=express[_0xa7e0('0x4')]();var auth=require(_0xa7e0('0x5'));var interaction=require(_0xa7e0('0x6'));var config=require(_0xa7e0('0x7'));var controller=require('./voiceContext.controller');router[_0xa7e0('0x8')]('/',auth[_0xa7e0('0x9')](),controller[_0xa7e0('0xa')]);router[_0xa7e0('0x8')](_0xa7e0('0xb'),auth[_0xa7e0('0x9')](),controller[_0xa7e0('0xc')]);router['post']('/',auth[_0xa7e0('0x9')](),controller[_0xa7e0('0xd')]);router[_0xa7e0('0xe')](_0xa7e0('0xb'),auth[_0xa7e0('0x9')](),controller[_0xa7e0('0xf')]);router[_0xa7e0('0x10')]('/:id',auth[_0xa7e0('0x9')](),controller['destroy']);module[_0xa7e0('0x11')]=router; \ No newline at end of file +var _0xb6b1=['isAuthenticated','create','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','index','get','/:id','post'];(function(_0x19da73,_0x29136c){var _0xfeef3e=function(_0x3f6fd){while(--_0x3f6fd){_0x19da73['push'](_0x19da73['shift']());}};_0xfeef3e(++_0x29136c);}(_0xb6b1,0x195));var _0x1b6b=function(_0x4bacb6,_0x2b299d){_0x4bacb6=_0x4bacb6-0x0;var _0x58c029=_0xb6b1[_0x4bacb6];return _0x58c029;};'use strict';var multer=require('multer');var util=require(_0x1b6b('0x0'));var path=require(_0x1b6b('0x1'));var timeout=require(_0x1b6b('0x2'));var express=require(_0x1b6b('0x3'));var router=express[_0x1b6b('0x4')]();var auth=require(_0x1b6b('0x5'));var interaction=require(_0x1b6b('0x6'));var config=require(_0x1b6b('0x7'));var controller=require(_0x1b6b('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x1b6b('0x9')]);router[_0x1b6b('0xa')](_0x1b6b('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1b6b('0xc')]('/',auth[_0x1b6b('0xd')](),controller[_0x1b6b('0xe')]);router[_0x1b6b('0xf')](_0x1b6b('0xb'),auth[_0x1b6b('0xd')](),controller[_0x1b6b('0x10')]);router[_0x1b6b('0x11')](_0x1b6b('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x1b6b('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index c688e68..2f3c428 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 _0x34e8=['sequelize','exports','STRING','name','BOOLEAN'];(function(_0x33668a,_0x42fe58){var _0x412ae1=function(_0x1f0c7c){while(--_0x1f0c7c){_0x33668a['push'](_0x33668a['shift']());}};_0x412ae1(++_0x42fe58);}(_0x34e8,0x12c));var _0x834e=function(_0x15c882,_0x381ae5){_0x15c882=_0x15c882-0x0;var _0x2de3e5=_0x34e8[_0x15c882];return _0x2de3e5;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'name':{'type':Sequelize[_0x834e('0x2')],'unique':_0x834e('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x834e('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3e74=['name','sequelize','STRING'];(function(_0x2532fc,_0xf8cd6){var _0x2a7bff=function(_0x4cfd80){while(--_0x4cfd80){_0x2532fc['push'](_0x2532fc['shift']());}};_0x2a7bff(++_0xf8cd6);}(_0x3e74,0x175));var _0x43e7=function(_0x40aa1b,_0x2c4e52){_0x40aa1b=_0x40aa1b-0x0;var _0x3515d2=_0x3e74[_0x40aa1b];return _0x3515d2;};'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 87f243b..1ad6d14 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 _0x0df6=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','error','code','VoiceContext,\x20%s,\x20%s','message','catch','sendStatus','status','json','offset','limit','set','Content-Range','apply','update','destroy','get','Contexts','UserProfileResource','end','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','count','includeAll','include','findAll','rows','show','params','keys','options','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','role','user','UserProfileSection','userProfileId','chan_sip.so','html-pdf','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse'];(function(_0x31be63,_0x4430c7){var _0x3834fd=function(_0x44b0cd){while(--_0x44b0cd){_0x31be63['push'](_0x31be63['shift']());}};_0x3834fd(++_0x4430c7);}(_0x0df6,0x197));var _0x60df=function(_0x1f5a54,_0x1ad4ee){_0x1f5a54=_0x1f5a54-0x0;var _0x546903=_0x0df6[_0x1f5a54];return _0x546903;};'use strict';var pdf=require(_0x60df('0x0'));var emlformat=require(_0x60df('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x60df('0x2'));var rp=require(_0x60df('0x3'));var moment=require(_0x60df('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x60df('0x5'));var util=require(_0x60df('0x6'));var path=require(_0x60df('0x7'));var sox=require(_0x60df('0x8'));var csv=require('to-csv');var ejs=require(_0x60df('0x9'));var fs=require('fs');var _=require(_0x60df('0xa'));var squel=require(_0x60df('0xb'));var crypto=require(_0x60df('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x60df('0xd'));var toCsv=require(_0x60df('0xe'));var querystring=require(_0x60df('0xf'));var Papa=require(_0x60df('0x10'));var Redis=require(_0x60df('0x11'));var authService=require(_0x60df('0x12'));var qs=require(_0x60df('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x60df('0x14'));var logger=require(_0x60df('0x15'))(_0x60df('0x16'));var utils=require(_0x60df('0x17'));var config=require(_0x60df('0x18'));var db=require(_0x60df('0x19'))['db'];var jayson=require(_0x60df('0x1a'));var client=jayson[_0x60df('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x233b74,_0xbd4a9c,_0x4a0c32){if(_0x4a0c32){var _0x39ada8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x39ada8[_0x60df('0x1c')](_0xbd4a9c)){return _0x233b74;}else{throw new db[(_0x60df('0x1d'))]['ValidationError'](_0x60df('0x1e'));}}else{return _0x233b74;}}function respondWithRpcPromise(_0x31c1eb,_0xddc049,_0x451e7a,_0x2882a9){return new BPromise(function(_0x40075f,_0xa8b1dc){var _0x591579=_0x2882a9||client;return _0x591579[_0x60df('0x1f')](_0x31c1eb,_0x451e7a)[_0x60df('0x20')](function(_0x1b2853){logger[_0x60df('0x21')]('VoiceContext,\x20%s,\x20%s',_0xddc049,_0x60df('0x22'));logger[_0x60df('0x23')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0xddc049,'request\x20sent',JSON['stringify'](_0x1b2853));if(_0x1b2853[_0x60df('0x24')]){if(_0x1b2853['error'][_0x60df('0x25')]===0x1f4){logger[_0x60df('0x24')](_0x60df('0x26'),_0xddc049,_0x1b2853[_0x60df('0x24')][_0x60df('0x27')]);return _0xa8b1dc(_0x1b2853['error'][_0x60df('0x27')]);}logger[_0x60df('0x24')](_0x60df('0x26'),_0xddc049,_0x1b2853['error'][_0x60df('0x27')]);return _0x40075f(_0x1b2853[_0x60df('0x24')][_0x60df('0x27')]);}else{logger[_0x60df('0x21')]('VoiceContext,\x20%s,\x20%s',_0xddc049,_0x60df('0x22'));_0x40075f(_0x1b2853['result'][_0x60df('0x27')]);}})[_0x60df('0x28')](function(_0x4c5b59){logger[_0x60df('0x24')](_0x60df('0x26'),_0xddc049,_0x4c5b59);_0xa8b1dc(_0x4c5b59);});});}function respondWithStatusCode(_0x3c48ba,_0x141d4b){_0x141d4b=_0x141d4b||0xcc;return function(_0x335257){if(_0x335257){return _0x3c48ba[_0x60df('0x29')](_0x141d4b);}return _0x3c48ba[_0x60df('0x2a')](_0x141d4b)['end']();};}function respondWithResult(_0x33850c,_0x32d3d6){_0x32d3d6=_0x32d3d6||0xc8;return function(_0x25a5f5){if(_0x25a5f5){return _0x33850c['status'](_0x32d3d6)[_0x60df('0x2b')](_0x25a5f5);}};}function respondWithFilteredResult(_0x455337,_0x4fc76e){return function(_0x29abf2){if(_0x29abf2){var _0x4adc43=_0x29abf2['count'],_0x88368e=_0x4fc76e[_0x60df('0x2c')],_0x53ddbe=_0x4fc76e[_0x60df('0x2c')]+_0x4fc76e[_0x60df('0x2d')],_0x38e441;if(_0x53ddbe>=_0x4adc43){_0x53ddbe=_0x4adc43;_0x38e441=0xc8;}else{_0x38e441=0xce;}_0x455337[_0x60df('0x2a')](_0x38e441);return _0x455337[_0x60df('0x2e')](_0x60df('0x2f'),_0x88368e+'-'+_0x53ddbe+'/'+_0x4adc43)[_0x60df('0x2b')](_0x29abf2);}return null;};}function patchUpdates(_0xfcd698){return function(_0x25de85){try{jsonpatch[_0x60df('0x30')](_0x25de85,_0xfcd698,!![]);}catch(_0x297c52){return BPromise['reject'](_0x297c52);}return _0x25de85['save']();};}function saveUpdates(_0x3a40e7,_0x5335a7){return function(_0x180ffd){if(_0x180ffd){return _0x180ffd[_0x60df('0x31')](_0x3a40e7)[_0x60df('0x20')](function(_0x2280a7){return _0x2280a7;});}return null;};}function removeEntity(_0x3d2def,_0x31eb67){return function(_0x9f3626){if(_0x9f3626){return _0x9f3626[_0x60df('0x32')]()[_0x60df('0x20')](function(){var _0xf29584=_0x9f3626[_0x60df('0x33')]({'plain':!![]});var _0x58d8a7=_0x60df('0x34');return db[_0x60df('0x35')][_0x60df('0x32')]({'where':{'type':_0x58d8a7,'resourceId':_0xf29584['id']}})[_0x60df('0x20')](function(){return _0x9f3626;});})[_0x60df('0x20')](function(){_0x3d2def[_0x60df('0x2a')](0xcc)[_0x60df('0x36')]();});}};}function handleEntityNotFound(_0xff8aef,_0xed86cf){return function(_0x23642d){if(!_0x23642d){_0xff8aef['sendStatus'](0x194);}return _0x23642d;};}function handleError(_0x479f5e,_0x3c2265){_0x3c2265=_0x3c2265||0x1f4;return function(_0xf483c5){logger[_0x60df('0x24')](_0xf483c5[_0x60df('0x37')]);if(_0xf483c5['name']){delete _0xf483c5[_0x60df('0x38')];}_0x479f5e[_0x60df('0x2a')](_0x3c2265)[_0x60df('0x39')](_0xf483c5);};}exports[_0x60df('0x3a')]=function(_0x29b02c,_0x1d1309){var _0x30e199={},_0x2d0240={},_0x5b7f0a={'count':0x0,'rows':[]};var _0x39f6f5=_[_0x60df('0x3b')](db[_0x60df('0x3c')][_0x60df('0x3d')],function(_0x141dd9){return{'name':_0x141dd9[_0x60df('0x3e')],'type':_0x141dd9[_0x60df('0x3f')][_0x60df('0x40')]};});_0x2d0240[_0x60df('0x41')]=_['map'](_0x39f6f5,'name');_0x2d0240[_0x60df('0x42')]=_['keys'](_0x29b02c[_0x60df('0x42')]);_0x2d0240['filters']=_[_0x60df('0x43')](_0x2d0240['model'],_0x2d0240[_0x60df('0x42')]);_0x30e199['attributes']=_[_0x60df('0x43')](_0x2d0240[_0x60df('0x41')],qs['fields'](_0x29b02c[_0x60df('0x42')][_0x60df('0x44')]));_0x30e199[_0x60df('0x45')]=_0x30e199[_0x60df('0x45')][_0x60df('0x46')]?_0x30e199[_0x60df('0x45')]:_0x2d0240[_0x60df('0x41')];if(!_0x29b02c[_0x60df('0x42')][_0x60df('0x47')](_0x60df('0x48'))){_0x30e199[_0x60df('0x2d')]=qs[_0x60df('0x2d')](_0x29b02c['query'][_0x60df('0x2d')]);_0x30e199[_0x60df('0x2c')]=qs[_0x60df('0x2c')](_0x29b02c[_0x60df('0x42')]['offset']);}_0x30e199[_0x60df('0x49')]=qs[_0x60df('0x4a')](_0x29b02c[_0x60df('0x42')][_0x60df('0x4a')]);_0x30e199[_0x60df('0x4b')]=qs[_0x60df('0x4c')](_[_0x60df('0x4d')](_0x29b02c[_0x60df('0x42')],_0x2d0240[_0x60df('0x4c')]));if(_0x29b02c['query'][_0x60df('0x4e')]){_0x30e199[_0x60df('0x4b')]=_['merge'](_0x30e199[_0x60df('0x4b')],{'$or':_['map'](_0x39f6f5,function(_0x125cf2){if(_0x125cf2[_0x60df('0x3f')]!=='VIRTUAL'){var _0x19cd9e={};_0x19cd9e[_0x125cf2[_0x60df('0x38')]]={'$like':'%'+_0x29b02c[_0x60df('0x42')][_0x60df('0x4e')]+'%'};return _0x19cd9e;}})});}_0x30e199=_[_0x60df('0x4f')]({},_0x30e199,_0x29b02c['options']);var _0xbda0d8={'where':_0x30e199[_0x60df('0x4b')]};return db[_0x60df('0x3c')][_0x60df('0x50')](_0xbda0d8)[_0x60df('0x20')](function(_0x35583a){_0x5b7f0a[_0x60df('0x50')]=_0x35583a;if(_0x29b02c[_0x60df('0x42')][_0x60df('0x51')]){_0x30e199[_0x60df('0x52')]=[{'all':!![]}];}return db[_0x60df('0x3c')][_0x60df('0x53')](_0x30e199);})[_0x60df('0x20')](function(_0x391d0c){_0x5b7f0a[_0x60df('0x54')]=_0x391d0c;return _0x5b7f0a;})[_0x60df('0x20')](respondWithFilteredResult(_0x1d1309,_0x30e199))[_0x60df('0x28')](handleError(_0x1d1309,null));};exports[_0x60df('0x55')]=function(_0x308628,_0x1997b9){var _0x52888a={'raw':![],'where':{'id':_0x308628[_0x60df('0x56')]['id']}},_0x457abc={};_0x457abc[_0x60df('0x41')]=_[_0x60df('0x57')](db['VoiceContext'][_0x60df('0x3d')]);_0x457abc[_0x60df('0x42')]=_['keys'](_0x308628['query']);_0x457abc[_0x60df('0x4c')]=_[_0x60df('0x43')](_0x457abc[_0x60df('0x41')],_0x457abc[_0x60df('0x42')]);_0x52888a[_0x60df('0x45')]=_['intersection'](_0x457abc[_0x60df('0x41')],qs['fields'](_0x308628[_0x60df('0x42')][_0x60df('0x44')]));_0x52888a[_0x60df('0x45')]=_0x52888a[_0x60df('0x45')][_0x60df('0x46')]?_0x52888a[_0x60df('0x45')]:_0x457abc[_0x60df('0x41')];if(_0x308628['query'][_0x60df('0x51')]){_0x52888a['include']=[{'all':!![]}];}_0x52888a=_['merge']({},_0x52888a,_0x308628[_0x60df('0x58')]);return db[_0x60df('0x3c')][_0x60df('0x59')](_0x52888a)[_0x60df('0x20')](handleEntityNotFound(_0x1997b9,null))[_0x60df('0x20')](respondWithResult(_0x1997b9,null))[_0x60df('0x28')](handleError(_0x1997b9,null));};exports['create']=function(_0x1f1bf8,_0x4015a1,_0x1573d0){var _0x3c3d6c;return db[_0x60df('0x3c')][_0x60df('0x5a')](_0x1f1bf8[_0x60df('0x5b')],{'raw':!![]})['then'](function(_0x80ba64){_0x3c3d6c=_0x80ba64;return db[_0x60df('0x3c')][_0x60df('0x53')]({'raw':!![]});})[_0x60df('0x20')](function(_0x1dbbd7){var _0x3bc7bb=fs[_0x60df('0x5c')](path[_0x60df('0x5d')](config[_0x60df('0x5e')],_0x60df('0x5f')),_0x60df('0x60'));var _0x57ddc3=ejs[_0x60df('0x61')](_0x3bc7bb,{'contexts':_0x1dbbd7||[]});fs[_0x60df('0x62')](_0x60df('0x63'),_0x57ddc3);})[_0x60df('0x20')](function(){return respondWithRpcPromise(_0x60df('0x64'),_0x60df('0x5a'),{'module':'chan_sip.so'});})['then'](function(){var _0x1620d1=_0x1f1bf8['user'][_0x60df('0x33')]({'plain':!![]});if(!_0x1620d1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1620d1[_0x60df('0x65')]===_0x60df('0x66')){var _0x281f9c=_0x3c3d6c[_0x60df('0x33')]({'plain':!![]});return db[_0x60df('0x67')][_0x60df('0x59')]({'where':{'name':_0x60df('0x34'),'userProfileId':_0x1620d1[_0x60df('0x68')]},'raw':!![]})[_0x60df('0x20')](function(_0x28431f){if(_0x28431f&&_0x28431f['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x281f9c[_0x60df('0x38')],'resourceId':_0x281f9c['id'],'type':_0x28431f[_0x60df('0x38')],'sectionId':_0x28431f['id']},{})[_0x60df('0x20')](function(){return _0x3c3d6c;});}else{return _0x3c3d6c;}})[_0x60df('0x28')](function(_0x26992c){logger[_0x60df('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x26992c);throw _0x26992c;});}return _0x3c3d6c;})[_0x60df('0x20')](respondWithResult(_0x4015a1,0xc9))[_0x60df('0x28')](handleError(_0x4015a1,null));};exports[_0x60df('0x31')]=function(_0x13d670,_0x395eeb,_0x263f46){var _0x36e79a;return db[_0x60df('0x3c')]['find']({'where':{'id':_0x13d670[_0x60df('0x56')]['id']}})[_0x60df('0x20')](handleEntityNotFound(_0x395eeb,null))[_0x60df('0x20')](saveUpdates(_0x13d670['body'],null))[_0x60df('0x20')](function(_0x419df7){if(_0x419df7){_0x36e79a=_0x419df7;return db[_0x60df('0x3c')]['findAll']({'raw':!![]});}})[_0x60df('0x20')](function(_0x217910){var _0x2dcda8=fs['readFileSync'](path[_0x60df('0x5d')](config[_0x60df('0x5e')],'server/files/templates/context.ejs'),_0x60df('0x60'));var _0x3f4ab0=ejs[_0x60df('0x61')](_0x2dcda8,{'contexts':_0x217910||[]});fs[_0x60df('0x62')](_0x60df('0x63'),_0x3f4ab0);})[_0x60df('0x20')](function(){return respondWithRpcPromise(_0x60df('0x64'),_0x60df('0x31'),{'module':_0x60df('0x69')});})[_0x60df('0x20')](function(){return _0x36e79a;})[_0x60df('0x20')](respondWithResult(_0x395eeb,null))[_0x60df('0x28')](handleError(_0x395eeb,null));};exports[_0x60df('0x32')]=function(_0x5b5cfd,_0x39856b,_0x46caec){var _0x364131;return db[_0x60df('0x3c')][_0x60df('0x59')]({'where':{'id':_0x5b5cfd['params']['id']}})['then'](handleEntityNotFound(_0x39856b,null))['then'](removeEntity(_0x39856b,null))['then'](function(){return db['VoiceContext'][_0x60df('0x53')]({'raw':!![]});})[_0x60df('0x20')](function(_0x2b8410){var _0x456790=fs[_0x60df('0x5c')](path[_0x60df('0x5d')](config[_0x60df('0x5e')],'server/files/templates/context.ejs'),_0x60df('0x60'));var _0x34d54f=ejs[_0x60df('0x61')](_0x456790,{'contexts':_0x2b8410});fs[_0x60df('0x62')](_0x60df('0x63'),_0x34d54f);return respondWithRpcPromise(_0x60df('0x64'),_0x60df('0x32'),{'module':'chan_sip.so'});})[_0x60df('0x28')](handleError(_0x39856b,null));}; \ No newline at end of file +var _0xe176=['../../mysqldb','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','Contexts','UserProfileResource','name','send','index','VoiceContext','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','include','findAll','params','options','find','create','body','join','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','Reload','root','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x3a13aa,_0x99bc22){var _0x226ec6=function(_0x1eaadd){while(--_0x1eaadd){_0x3a13aa['push'](_0x3a13aa['shift']());}};_0x226ec6(++_0x99bc22);}(_0xe176,0x194));var _0x6e17=function(_0x334651,_0x6e99f6){_0x334651=_0x334651-0x0;var _0x29657c=_0xe176[_0x334651];return _0x29657c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6e17('0x0'));var rimraf=require(_0x6e17('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6e17('0x2'));var rp=require(_0x6e17('0x3'));var moment=require(_0x6e17('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6e17('0x5'));var util=require(_0x6e17('0x6'));var path=require('path');var sox=require(_0x6e17('0x7'));var csv=require(_0x6e17('0x8'));var ejs=require(_0x6e17('0x9'));var fs=require('fs');var _=require(_0x6e17('0xa'));var squel=require(_0x6e17('0xb'));var crypto=require(_0x6e17('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6e17('0xd'));var toCsv=require(_0x6e17('0x8'));var querystring=require(_0x6e17('0xe'));var Papa=require(_0x6e17('0xf'));var Redis=require(_0x6e17('0x10'));var authService=require(_0x6e17('0x11'));var qs=require(_0x6e17('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6e17('0x13'));var logger=require(_0x6e17('0x14'))(_0x6e17('0x15'));var utils=require(_0x6e17('0x16'));var config=require(_0x6e17('0x17'));var db=require(_0x6e17('0x18'))['db'];var jayson=require(_0x6e17('0x19'));var client=jayson[_0x6e17('0x1a')]['http']({'port':0x232a});function checkPasswordPattern(_0x406ec2,_0x63bcec,_0x438604){if(_0x438604){var _0x1b461c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1b461c[_0x6e17('0x1b')](_0x63bcec)){return _0x406ec2;}else{throw new db[(_0x6e17('0x1c'))][(_0x6e17('0x1d'))](_0x6e17('0x1e'));}}else{return _0x406ec2;}}function respondWithRpcPromise(_0x198022,_0x3d992,_0x4f9c18,_0xb3feae){return new BPromise(function(_0x45587e,_0x304950){var _0x4ff3e3=_0xb3feae||client;return _0x4ff3e3[_0x6e17('0x1f')](_0x198022,_0x4f9c18)[_0x6e17('0x20')](function(_0x2f97a5){logger[_0x6e17('0x21')](_0x6e17('0x22'),_0x3d992,_0x6e17('0x23'));logger[_0x6e17('0x24')](_0x6e17('0x25'),_0x3d992,_0x6e17('0x23'),JSON[_0x6e17('0x26')](_0x2f97a5));if(_0x2f97a5['error']){if(_0x2f97a5[_0x6e17('0x27')][_0x6e17('0x28')]===0x1f4){logger[_0x6e17('0x27')](_0x6e17('0x22'),_0x3d992,_0x2f97a5[_0x6e17('0x27')][_0x6e17('0x29')]);return _0x304950(_0x2f97a5[_0x6e17('0x27')][_0x6e17('0x29')]);}logger[_0x6e17('0x27')](_0x6e17('0x22'),_0x3d992,_0x2f97a5[_0x6e17('0x27')]['message']);return _0x45587e(_0x2f97a5[_0x6e17('0x27')]['message']);}else{logger[_0x6e17('0x21')](_0x6e17('0x22'),_0x3d992,_0x6e17('0x23'));_0x45587e(_0x2f97a5[_0x6e17('0x2a')][_0x6e17('0x29')]);}})[_0x6e17('0x2b')](function(_0x1a41ce){logger[_0x6e17('0x27')](_0x6e17('0x22'),_0x3d992,_0x1a41ce);_0x304950(_0x1a41ce);});});}function respondWithStatusCode(_0x40ca98,_0x1782ca){_0x1782ca=_0x1782ca||0xcc;return function(_0x4b3389){if(_0x4b3389){return _0x40ca98[_0x6e17('0x2c')](_0x1782ca);}return _0x40ca98[_0x6e17('0x2d')](_0x1782ca)[_0x6e17('0x2e')]();};}function respondWithResult(_0x17394f,_0x55aeb4){_0x55aeb4=_0x55aeb4||0xc8;return function(_0x73e546){if(_0x73e546){return _0x17394f['status'](_0x55aeb4)[_0x6e17('0x2f')](_0x73e546);}};}function respondWithFilteredResult(_0x16b8a0,_0x41b53e){return function(_0x22a52e){if(_0x22a52e){var _0x347fef=_0x22a52e[_0x6e17('0x30')],_0x316527=_0x41b53e[_0x6e17('0x31')],_0x28dd77=_0x41b53e[_0x6e17('0x31')]+_0x41b53e[_0x6e17('0x32')],_0x4f0aaa;if(_0x28dd77>=_0x347fef){_0x28dd77=_0x347fef;_0x4f0aaa=0xc8;}else{_0x4f0aaa=0xce;}_0x16b8a0[_0x6e17('0x2d')](_0x4f0aaa);return _0x16b8a0[_0x6e17('0x33')](_0x6e17('0x34'),_0x316527+'-'+_0x28dd77+'/'+_0x347fef)[_0x6e17('0x2f')](_0x22a52e);}return null;};}function patchUpdates(_0x5d50d8){return function(_0x50c141){try{jsonpatch[_0x6e17('0x35')](_0x50c141,_0x5d50d8,!![]);}catch(_0x59914a){return BPromise[_0x6e17('0x36')](_0x59914a);}return _0x50c141[_0x6e17('0x37')]();};}function saveUpdates(_0x34dbfa,_0x3a6b4f){return function(_0x271f8e){if(_0x271f8e){return _0x271f8e[_0x6e17('0x38')](_0x34dbfa)[_0x6e17('0x20')](function(_0x36ad32){return _0x36ad32;});}return null;};}function removeEntity(_0xfdb518,_0x4d7929){return function(_0x22ba3c){if(_0x22ba3c){return _0x22ba3c[_0x6e17('0x39')]()['then'](function(){var _0x2fc07a=_0x22ba3c['get']({'plain':!![]});var _0x37b01a=_0x6e17('0x3a');return db[_0x6e17('0x3b')][_0x6e17('0x39')]({'where':{'type':_0x37b01a,'resourceId':_0x2fc07a['id']}})[_0x6e17('0x20')](function(){return _0x22ba3c;});})[_0x6e17('0x20')](function(){_0xfdb518['status'](0xcc)[_0x6e17('0x2e')]();});}};}function handleEntityNotFound(_0x1392c2,_0x55c42f){return function(_0x1a0fd2){if(!_0x1a0fd2){_0x1392c2[_0x6e17('0x2c')](0x194);}return _0x1a0fd2;};}function handleError(_0x24db22,_0x1a11b3){_0x1a11b3=_0x1a11b3||0x1f4;return function(_0x295aca){logger[_0x6e17('0x27')](_0x295aca['stack']);if(_0x295aca[_0x6e17('0x3c')]){delete _0x295aca[_0x6e17('0x3c')];}_0x24db22['status'](_0x1a11b3)[_0x6e17('0x3d')](_0x295aca);};}exports[_0x6e17('0x3e')]=function(_0x4fd38d,_0x1bee42){var _0x504272={},_0x30a7fd={},_0x552a84={'count':0x0,'rows':[]};var _0xafd7d0=_['map'](db[_0x6e17('0x3f')][_0x6e17('0x40')],function(_0x51c4b0){return{'name':_0x51c4b0['fieldName'],'type':_0x51c4b0[_0x6e17('0x41')][_0x6e17('0x42')]};});_0x30a7fd[_0x6e17('0x43')]=_[_0x6e17('0x44')](_0xafd7d0,_0x6e17('0x3c'));_0x30a7fd[_0x6e17('0x45')]=_[_0x6e17('0x46')](_0x4fd38d[_0x6e17('0x45')]);_0x30a7fd[_0x6e17('0x47')]=_[_0x6e17('0x48')](_0x30a7fd[_0x6e17('0x43')],_0x30a7fd['query']);_0x504272[_0x6e17('0x49')]=_[_0x6e17('0x48')](_0x30a7fd['model'],qs['fields'](_0x4fd38d[_0x6e17('0x45')][_0x6e17('0x4a')]));_0x504272[_0x6e17('0x49')]=_0x504272[_0x6e17('0x49')]['length']?_0x504272['attributes']:_0x30a7fd['model'];if(!_0x4fd38d['query'][_0x6e17('0x4b')](_0x6e17('0x4c'))){_0x504272[_0x6e17('0x32')]=qs[_0x6e17('0x32')](_0x4fd38d['query'][_0x6e17('0x32')]);_0x504272[_0x6e17('0x31')]=qs[_0x6e17('0x31')](_0x4fd38d['query'][_0x6e17('0x31')]);}_0x504272[_0x6e17('0x4d')]=qs[_0x6e17('0x4e')](_0x4fd38d[_0x6e17('0x45')]['sort']);_0x504272[_0x6e17('0x4f')]=qs['filters'](_['pick'](_0x4fd38d[_0x6e17('0x45')],_0x30a7fd[_0x6e17('0x47')]));if(_0x4fd38d[_0x6e17('0x45')][_0x6e17('0x50')]){_0x504272[_0x6e17('0x4f')]=_[_0x6e17('0x51')](_0x504272[_0x6e17('0x4f')],{'$or':_['map'](_0xafd7d0,function(_0x42e01e){if(_0x42e01e['type']!=='VIRTUAL'){var _0x4e206b={};_0x4e206b[_0x42e01e[_0x6e17('0x3c')]]={'$like':'%'+_0x4fd38d['query'][_0x6e17('0x50')]+'%'};return _0x4e206b;}})});}_0x504272=_[_0x6e17('0x51')]({},_0x504272,_0x4fd38d['options']);var _0x367153={'where':_0x504272[_0x6e17('0x4f')]};return db['VoiceContext'][_0x6e17('0x30')](_0x367153)[_0x6e17('0x20')](function(_0x103560){_0x552a84[_0x6e17('0x30')]=_0x103560;if(_0x4fd38d['query'][_0x6e17('0x52')]){_0x504272[_0x6e17('0x53')]=[{'all':!![]}];}return db[_0x6e17('0x3f')][_0x6e17('0x54')](_0x504272);})[_0x6e17('0x20')](function(_0x280bdd){_0x552a84['rows']=_0x280bdd;return _0x552a84;})[_0x6e17('0x20')](respondWithFilteredResult(_0x1bee42,_0x504272))[_0x6e17('0x2b')](handleError(_0x1bee42,null));};exports['show']=function(_0x356834,_0x159e26){var _0x1807d8={'raw':![],'where':{'id':_0x356834[_0x6e17('0x55')]['id']}},_0x165066={};_0x165066[_0x6e17('0x43')]=_['keys'](db[_0x6e17('0x3f')]['rawAttributes']);_0x165066[_0x6e17('0x45')]=_[_0x6e17('0x46')](_0x356834[_0x6e17('0x45')]);_0x165066[_0x6e17('0x47')]=_[_0x6e17('0x48')](_0x165066['model'],_0x165066['query']);_0x1807d8[_0x6e17('0x49')]=_[_0x6e17('0x48')](_0x165066['model'],qs[_0x6e17('0x4a')](_0x356834[_0x6e17('0x45')][_0x6e17('0x4a')]));_0x1807d8[_0x6e17('0x49')]=_0x1807d8[_0x6e17('0x49')]['length']?_0x1807d8[_0x6e17('0x49')]:_0x165066['model'];if(_0x356834[_0x6e17('0x45')][_0x6e17('0x52')]){_0x1807d8[_0x6e17('0x53')]=[{'all':!![]}];}_0x1807d8=_['merge']({},_0x1807d8,_0x356834[_0x6e17('0x56')]);return db['VoiceContext'][_0x6e17('0x57')](_0x1807d8)[_0x6e17('0x20')](handleEntityNotFound(_0x159e26,null))[_0x6e17('0x20')](respondWithResult(_0x159e26,null))[_0x6e17('0x2b')](handleError(_0x159e26,null));};exports[_0x6e17('0x58')]=function(_0x51aee8,_0xfb2e25,_0x2a935e){var _0x10778;return db[_0x6e17('0x3f')]['create'](_0x51aee8[_0x6e17('0x59')],{'raw':!![]})[_0x6e17('0x20')](function(_0x4f9d8e){_0x10778=_0x4f9d8e;return db[_0x6e17('0x3f')][_0x6e17('0x54')]({'raw':!![]});})[_0x6e17('0x20')](function(_0x639b5f){var _0x12ce3d=fs['readFileSync'](path[_0x6e17('0x5a')](config['root'],_0x6e17('0x5b')),_0x6e17('0x5c'));var _0x524822=ejs[_0x6e17('0x5d')](_0x12ce3d,{'contexts':_0x639b5f||[]});fs[_0x6e17('0x5e')](_0x6e17('0x5f'),_0x524822);})['then'](function(){return respondWithRpcPromise('Reload',_0x6e17('0x58'),{'module':_0x6e17('0x60')});})[_0x6e17('0x20')](function(){var _0x17a777=_0x51aee8[_0x6e17('0x61')][_0x6e17('0x62')]({'plain':!![]});if(!_0x17a777)throw new Error(_0x6e17('0x63'));if(_0x17a777[_0x6e17('0x64')]==='user'){var _0x5dfb97=_0x10778['get']({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':'Contexts','userProfileId':_0x17a777[_0x6e17('0x65')]},'raw':!![]})[_0x6e17('0x20')](function(_0xde155a){if(_0xde155a&&_0xde155a[_0x6e17('0x66')]===0x0){return db[_0x6e17('0x3b')][_0x6e17('0x58')]({'name':_0x5dfb97[_0x6e17('0x3c')],'resourceId':_0x5dfb97['id'],'type':_0xde155a['name'],'sectionId':_0xde155a['id']},{})[_0x6e17('0x20')](function(){return _0x10778;});}else{return _0x10778;}})[_0x6e17('0x2b')](function(_0x4750a5){logger[_0x6e17('0x27')](_0x6e17('0x67'),_0x4750a5);throw _0x4750a5;});}return _0x10778;})['then'](respondWithResult(_0xfb2e25,0xc9))[_0x6e17('0x2b')](handleError(_0xfb2e25,null));};exports['update']=function(_0x1ee022,_0x51d9d6,_0x5159b6){var _0x113f2a;return db['VoiceContext']['find']({'where':{'id':_0x1ee022[_0x6e17('0x55')]['id']}})['then'](handleEntityNotFound(_0x51d9d6,null))[_0x6e17('0x20')](saveUpdates(_0x1ee022[_0x6e17('0x59')],null))[_0x6e17('0x20')](function(_0x5a20d8){if(_0x5a20d8){_0x113f2a=_0x5a20d8;return db[_0x6e17('0x3f')][_0x6e17('0x54')]({'raw':!![]});}})[_0x6e17('0x20')](function(_0x2e9903){var _0x543c3c=fs[_0x6e17('0x68')](path[_0x6e17('0x5a')](config['root'],_0x6e17('0x5b')),_0x6e17('0x5c'));var _0x331db2=ejs[_0x6e17('0x5d')](_0x543c3c,{'contexts':_0x2e9903||[]});fs[_0x6e17('0x5e')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x331db2);})[_0x6e17('0x20')](function(){return respondWithRpcPromise(_0x6e17('0x69'),_0x6e17('0x38'),{'module':_0x6e17('0x60')});})['then'](function(){return _0x113f2a;})[_0x6e17('0x20')](respondWithResult(_0x51d9d6,null))['catch'](handleError(_0x51d9d6,null));};exports[_0x6e17('0x39')]=function(_0x27f1cd,_0x46c112,_0x4e1d00){var _0x101bf1;return db[_0x6e17('0x3f')][_0x6e17('0x57')]({'where':{'id':_0x27f1cd[_0x6e17('0x55')]['id']}})[_0x6e17('0x20')](handleEntityNotFound(_0x46c112,null))[_0x6e17('0x20')](removeEntity(_0x46c112,null))['then'](function(){return db[_0x6e17('0x3f')][_0x6e17('0x54')]({'raw':!![]});})['then'](function(_0x343098){var _0x2b52b7=fs[_0x6e17('0x68')](path['join'](config[_0x6e17('0x6a')],_0x6e17('0x5b')),_0x6e17('0x5c'));var _0x3b4eeb=ejs[_0x6e17('0x5d')](_0x2b52b7,{'contexts':_0x343098});fs[_0x6e17('0x5e')](_0x6e17('0x5f'),_0x3b4eeb);return respondWithRpcPromise(_0x6e17('0x69'),'destroy',{'module':_0x6e17('0x60')});})[_0x6e17('0x2b')](handleError(_0x46c112,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 98cb87e..95856f5 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 _0xf462=['voice_contexts','util','api','moment','bluebird','request-promise','../../config/environment','./voiceContext.attributes','exports','define'];(function(_0x5eab44,_0x1e2e1e){var _0x5bb117=function(_0x30a75a){while(--_0x30a75a){_0x5eab44['push'](_0x5eab44['shift']());}};_0x5bb117(++_0x1e2e1e);}(_0xf462,0x97));var _0x2f46=function(_0xd816e2,_0x5edac2){_0xd816e2=_0xd816e2-0x0;var _0x1f5924=_0xf462[_0xd816e2];return _0x1f5924;};'use strict';var _=require('lodash');var util=require(_0x2f46('0x0'));var logger=require('../../config/logger')(_0x2f46('0x1'));var moment=require(_0x2f46('0x2'));var BPromise=require(_0x2f46('0x3'));var rp=require(_0x2f46('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2f46('0x5'));var attributes=require(_0x2f46('0x6'));module[_0x2f46('0x7')]=function(_0xb4abbc,_0x1c90c8){return _0xb4abbc[_0x2f46('0x8')]('VoiceContext',attributes,{'tableName':_0x2f46('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa260=['define','VoiceContext','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0xa260,0x1ba));var _0x0a26=function(_0xcb5a06,_0x1f3428){_0xcb5a06=_0xcb5a06-0x0;var _0x4aac6e=_0xa260[_0xcb5a06];return _0x4aac6e;};'use strict';var _=require('lodash');var util=require(_0x0a26('0x0'));var logger=require(_0x0a26('0x1'))(_0x0a26('0x2'));var moment=require('moment');var BPromise=require(_0x0a26('0x3'));var rp=require(_0x0a26('0x4'));var fs=require('fs');var path=require(_0x0a26('0x5'));var rimraf=require(_0x0a26('0x6'));var config=require(_0x0a26('0x7'));var attributes=require(_0x0a26('0x8'));module['exports']=function(_0x2d4bb2,_0x5d4e00){return _0x2d4bb2[_0x0a26('0x9')](_0x0a26('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 ecdb554..0a034c5 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 _0x33bc=['request','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x33bc,0x1e5));var _0xc33b=function(_0x5ca5cb,_0x35c5b0){_0x5ca5cb=_0x5ca5cb-0x0;var _0x2ae967=_0x33bc[_0x5ca5cb];return _0x2ae967;};'use strict';var _=require(_0xc33b('0x0'));var util=require(_0xc33b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc33b('0x2'));var fs=require('fs');var Redis=require(_0xc33b('0x3'));var db=require(_0xc33b('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc33b('0x5'));var config=require(_0xc33b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc33b('0x7')][_0xc33b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x38483c,_0x10bbaa,_0x30a5e6){return new BPromise(function(_0x26542e,_0x2f1f06){return client[_0xc33b('0x9')](_0x38483c,_0x30a5e6)['then'](function(_0xfd9b0f){logger['info'](_0xc33b('0xa'),_0x10bbaa,_0xc33b('0xb'));logger[_0xc33b('0xc')](_0xc33b('0xd'),_0x10bbaa,_0xc33b('0xb'),JSON[_0xc33b('0xe')](_0xfd9b0f));if(_0xfd9b0f[_0xc33b('0xf')]){if(_0xfd9b0f[_0xc33b('0xf')][_0xc33b('0x10')]===0x1f4){logger[_0xc33b('0xf')](_0xc33b('0xa'),_0x10bbaa,_0xfd9b0f[_0xc33b('0xf')][_0xc33b('0x11')]);return _0x2f1f06(_0xfd9b0f[_0xc33b('0xf')][_0xc33b('0x11')]);}logger[_0xc33b('0xf')](_0xc33b('0xa'),_0x10bbaa,_0xfd9b0f[_0xc33b('0xf')]['message']);return _0x26542e(_0xfd9b0f['error'][_0xc33b('0x11')]);}else{logger['info'](_0xc33b('0xa'),_0x10bbaa,'request\x20sent');_0x26542e(_0xfd9b0f['result']['message']);}})[_0xc33b('0x12')](function(_0x2ec8ef){logger[_0xc33b('0xf')]('VoiceContext,\x20%s,\x20%s',_0x10bbaa,_0x2ec8ef);_0x2f1f06(_0x2ec8ef);});});} \ No newline at end of file +var _0xa3a3=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x4264bf,_0x39db0f){var _0x515e5f=function(_0x130168){while(--_0x130168){_0x4264bf['push'](_0x4264bf['shift']());}};_0x515e5f(++_0x39db0f);}(_0xa3a3,0x95));var _0x3a3a=function(_0x2fc3ea,_0xc459b3){_0x2fc3ea=_0x2fc3ea-0x0;var _0x2603bb=_0xa3a3[_0x2fc3ea];return _0x2603bb;};'use strict';var _=require('lodash');var util=require(_0x3a3a('0x0'));var moment=require(_0x3a3a('0x1'));var BPromise=require(_0x3a3a('0x2'));var rs=require(_0x3a3a('0x3'));var fs=require('fs');var Redis=require(_0x3a3a('0x4'));var db=require(_0x3a3a('0x5'))['db'];var utils=require(_0x3a3a('0x6'));var logger=require(_0x3a3a('0x7'))(_0x3a3a('0x8'));var config=require(_0x3a3a('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3a3a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4cd860,_0x5d330b,_0x50843e){return new BPromise(function(_0x4d167c,_0x139e08){return client['request'](_0x4cd860,_0x50843e)['then'](function(_0x32d37f){logger[_0x3a3a('0xb')](_0x3a3a('0xc'),_0x5d330b,_0x3a3a('0xd'));logger[_0x3a3a('0xe')](_0x3a3a('0xf'),_0x5d330b,'request\x20sent',JSON[_0x3a3a('0x10')](_0x32d37f));if(_0x32d37f[_0x3a3a('0x11')]){if(_0x32d37f['error'][_0x3a3a('0x12')]===0x1f4){logger[_0x3a3a('0x11')]('VoiceContext,\x20%s,\x20%s',_0x5d330b,_0x32d37f[_0x3a3a('0x11')][_0x3a3a('0x13')]);return _0x139e08(_0x32d37f[_0x3a3a('0x11')]['message']);}logger[_0x3a3a('0x11')](_0x3a3a('0xc'),_0x5d330b,_0x32d37f[_0x3a3a('0x11')]['message']);return _0x4d167c(_0x32d37f['error'][_0x3a3a('0x13')]);}else{logger[_0x3a3a('0xb')]('VoiceContext,\x20%s,\x20%s',_0x5d330b,_0x3a3a('0xd'));_0x4d167c(_0x32d37f[_0x3a3a('0x14')]['message']);}})[_0x3a3a('0x15')](function(_0x5ce010){logger['error'](_0x3a3a('0xc'),_0x5d330b,_0x5ce010);_0x139e08(_0x5ce010);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index e140adb..a3a574b 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 _0xd970=['describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','get','isAuthenticated','index'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0xd970,0x82));var _0x0d97=function(_0x2ae662,_0x31931e){_0x2ae662=_0x2ae662-0x0;var _0x1181b7=_0xd970[_0x2ae662];return _0x1181b7;};'use strict';var multer=require(_0x0d97('0x0'));var util=require('util');var path=require(_0x0d97('0x1'));var timeout=require(_0x0d97('0x2'));var express=require(_0x0d97('0x3'));var router=express['Router']();var auth=require(_0x0d97('0x4'));var interaction=require(_0x0d97('0x5'));var config=require('../../config/environment');var controller=require(_0x0d97('0x6'));router[_0x0d97('0x7')]('/',auth[_0x0d97('0x8')](),controller[_0x0d97('0x9')]);router[_0x0d97('0x7')]('/describe',auth[_0x0d97('0x8')](),controller[_0x0d97('0xa')]);router[_0x0d97('0x7')](_0x0d97('0xb'),auth[_0x0d97('0x8')](),controller[_0x0d97('0xc')]);router[_0x0d97('0xd')]('/',auth[_0x0d97('0x8')](),controller[_0x0d97('0xe')]);router[_0x0d97('0xf')](_0x0d97('0xb'),auth[_0x0d97('0x8')](),controller[_0x0d97('0x10')]);router[_0x0d97('0x11')]('/:id',auth[_0x0d97('0x8')](),controller[_0x0d97('0x12')]);module[_0x0d97('0x13')]=router; \ No newline at end of file +var _0xf4f2=['exports','util','path','Router','../../components/auth/service','../../config/environment','index','/describe','isAuthenticated','describe','get','/:id','show','post','create','put','update','delete','destroy'];(function(_0x3bc01c,_0x1fac30){var _0x8ef9bd=function(_0x540251){while(--_0x540251){_0x3bc01c['push'](_0x3bc01c['shift']());}};_0x8ef9bd(++_0x1fac30);}(_0xf4f2,0x10b));var _0x2f4f=function(_0x30a638,_0x3d1696){_0x30a638=_0x30a638-0x0;var _0x5d9a95=_0xf4f2[_0x30a638];return _0x5d9a95;};'use strict';var multer=require('multer');var util=require(_0x2f4f('0x0'));var path=require(_0x2f4f('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2f4f('0x2')]();var auth=require(_0x2f4f('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x2f4f('0x4'));var controller=require('./voiceDialReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x2f4f('0x5')]);router['get'](_0x2f4f('0x6'),auth[_0x2f4f('0x7')](),controller[_0x2f4f('0x8')]);router[_0x2f4f('0x9')](_0x2f4f('0xa'),auth['isAuthenticated'](),controller[_0x2f4f('0xb')]);router[_0x2f4f('0xc')]('/',auth['isAuthenticated'](),controller[_0x2f4f('0xd')]);router[_0x2f4f('0xe')]('/:id',auth[_0x2f4f('0x7')](),controller[_0x2f4f('0xf')]);router[_0x2f4f('0x10')]('/:id',auth[_0x2f4f('0x7')](),controller[_0x2f4f('0x11')]);module[_0x2f4f('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 6c1bb34..f51e84f 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 _0x4454=['INTEGER','DATE','sequelize','exports','STRING'];(function(_0x280fa0,_0x16af25){var _0x4fbb48=function(_0x4fb494){while(--_0x4fb494){_0x280fa0['push'](_0x280fa0['shift']());}};_0x4fbb48(++_0x16af25);}(_0x4454,0x1ab));var _0x4445=function(_0x326736,_0x56952d){_0x326736=_0x326736-0x0;var _0x147679=_0x4454[_0x326736];return _0x147679;};'use strict';var Sequelize=require(_0x4445('0x0'));module[_0x4445('0x1')]={'privilege':{'type':Sequelize[_0x4445('0x2')]},'channel':{'type':Sequelize[_0x4445('0x2')]},'channelstate':{'type':Sequelize[_0x4445('0x3')]},'channelstatedesc':{'type':Sequelize[_0x4445('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4445('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x4445('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x4445('0x2')]},'context':{'type':Sequelize[_0x4445('0x2')]},'exten':{'type':Sequelize[_0x4445('0x2')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x4445('0x2')]},'linkedid':{'type':Sequelize[_0x4445('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x4445('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x4445('0x2')]},'destcalleridnum':{'type':Sequelize[_0x4445('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x4445('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x4445('0x2')]},'destlanguage':{'type':Sequelize[_0x4445('0x2')]},'destaccountcode':{'type':Sequelize[_0x4445('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0x4445('0x2')]},'destlinkedid':{'type':Sequelize[_0x4445('0x2')]},'dialstring':{'type':Sequelize[_0x4445('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x4445('0x4')]},'answertime':{'type':Sequelize[_0x4445('0x4')]},'endtime':{'type':Sequelize[_0x4445('0x4')]},'lastevent':{'type':Sequelize[_0x4445('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x4445('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x4445('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x08fa=['sequelize','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x452968,_0x31e391){var _0xb6f9ae=function(_0x263987){while(--_0x263987){_0x452968['push'](_0x452968['shift']());}};_0xb6f9ae(++_0x31e391);}(_0x08fa,0x122));var _0xa08f=function(_0x2a5dd8,_0x24ef13){_0x2a5dd8=_0x2a5dd8-0x0;var _0x4f06d5=_0x08fa[_0x2a5dd8];return _0x4f06d5;};'use strict';var Sequelize=require(_0xa08f('0x0'));module['exports']={'privilege':{'type':Sequelize[_0xa08f('0x1')]},'channel':{'type':Sequelize[_0xa08f('0x1')]},'channelstate':{'type':Sequelize[_0xa08f('0x2')]},'channelstatedesc':{'type':Sequelize[_0xa08f('0x1')]},'calleridnum':{'type':Sequelize[_0xa08f('0x1')]},'calleridname':{'type':Sequelize[_0xa08f('0x1')]},'connectedlinenum':{'type':Sequelize[_0xa08f('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xa08f('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xa08f('0x1')]},'exten':{'type':Sequelize[_0xa08f('0x1')]},'priority':{'type':Sequelize[_0xa08f('0x2')]},'uniqueid':{'type':Sequelize[_0xa08f('0x1')]},'linkedid':{'type':Sequelize[_0xa08f('0x1')]},'destchannel':{'type':Sequelize[_0xa08f('0x1')]},'destchannelstate':{'type':Sequelize[_0xa08f('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xa08f('0x1')]},'destcalleridnum':{'type':Sequelize[_0xa08f('0x1')]},'destcalleridname':{'type':Sequelize[_0xa08f('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xa08f('0x1')]},'destaccountcode':{'type':Sequelize[_0xa08f('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xa08f('0x2')]},'destuniqueid':{'type':Sequelize[_0xa08f('0x1')]},'destlinkedid':{'type':Sequelize[_0xa08f('0x1')]},'dialstring':{'type':Sequelize[_0xa08f('0x1')]},'dialstatus':{'type':Sequelize[_0xa08f('0x1')]},'starttime':{'type':Sequelize[_0xa08f('0x3')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xa08f('0x3')]},'lastevent':{'type':Sequelize[_0xa08f('0x1')],'comment':_0xa08f('0x4')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0xa08f('0x2')]},'holdtime':{'type':Sequelize[_0xa08f('0x2')]},'billableseconds':{'type':Sequelize[_0xa08f('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 99edd85..1f26bbd 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 _0xd168=['fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','keys','length','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','apply','reject','save','update','destroy','then','end','stack','name','index','map','VoiceDialReport','rawAttributes','fieldName','type','model','query','intersection'];(function(_0x5d8b05,_0x3fe969){var _0x24b9b5=function(_0x1b5d9f){while(--_0x1b5d9f){_0x5d8b05['push'](_0x5d8b05['shift']());}};_0x24b9b5(++_0x3fe969);}(_0xd168,0xf1));var _0x8d16=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0xd168[_0x24061a];return _0x82054e;};'use strict';var pdf=require(_0x8d16('0x0'));var emlformat=require(_0x8d16('0x1'));var rimraf=require(_0x8d16('0x2'));var zipdir=require(_0x8d16('0x3'));var jsonpatch=require(_0x8d16('0x4'));var rp=require(_0x8d16('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8d16('0x6'));var path=require('path');var sox=require(_0x8d16('0x7'));var csv=require(_0x8d16('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8d16('0x9'));var squel=require(_0x8d16('0xa'));var crypto=require(_0x8d16('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8d16('0xc'));var toCsv=require(_0x8d16('0x8'));var querystring=require(_0x8d16('0xd'));var Papa=require(_0x8d16('0xe'));var Redis=require(_0x8d16('0xf'));var authService=require(_0x8d16('0x10'));var qs=require(_0x8d16('0x11'));var as=require(_0x8d16('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8d16('0x13'));var utils=require(_0x8d16('0x14'));var config=require(_0x8d16('0x15'));var db=require(_0x8d16('0x16'))['db'];function respondWithStatusCode(_0x50df69,_0x1657fe){_0x1657fe=_0x1657fe||0xcc;return function(_0x2e0797){if(_0x2e0797){return _0x50df69['sendStatus'](_0x1657fe);}return _0x50df69[_0x8d16('0x17')](_0x1657fe)['end']();};}function respondWithResult(_0x52b6f2,_0x1cebd7){_0x1cebd7=_0x1cebd7||0xc8;return function(_0x1b2b67){if(_0x1b2b67){return _0x52b6f2[_0x8d16('0x17')](_0x1cebd7)[_0x8d16('0x18')](_0x1b2b67);}};}function respondWithFilteredResult(_0x2f0a8a,_0x42e001){return function(_0x41b6d5){if(_0x41b6d5){var _0x60293d=_0x41b6d5[_0x8d16('0x19')],_0x124d83=_0x42e001[_0x8d16('0x1a')],_0x3057bf=_0x42e001[_0x8d16('0x1a')]+_0x42e001[_0x8d16('0x1b')],_0x2c5dc2;if(_0x3057bf>=_0x60293d){_0x3057bf=_0x60293d;_0x2c5dc2=0xc8;}else{_0x2c5dc2=0xce;}_0x2f0a8a['status'](_0x2c5dc2);return _0x2f0a8a[_0x8d16('0x1c')]('Content-Range',_0x124d83+'-'+_0x3057bf+'/'+_0x60293d)[_0x8d16('0x18')](_0x41b6d5);}return null;};}function patchUpdates(_0x2bd7cd){return function(_0x1a1d5f){try{jsonpatch[_0x8d16('0x1d')](_0x1a1d5f,_0x2bd7cd,!![]);}catch(_0x4b72f7){return BPromise[_0x8d16('0x1e')](_0x4b72f7);}return _0x1a1d5f[_0x8d16('0x1f')]();};}function saveUpdates(_0x5229db,_0x4029ac){return function(_0x59fbf3){if(_0x59fbf3){return _0x59fbf3[_0x8d16('0x20')](_0x5229db)['then'](function(_0x2088b4){return _0x2088b4;});}return null;};}function removeEntity(_0xc8fd4f,_0x4312d4){return function(_0x492272){if(_0x492272){return _0x492272[_0x8d16('0x21')]()[_0x8d16('0x22')](function(){_0xc8fd4f['status'](0xcc)[_0x8d16('0x23')]();});}};}function handleEntityNotFound(_0x527faf,_0x47c610){return function(_0x306dd7){if(!_0x306dd7){_0x527faf['sendStatus'](0x194);}return _0x306dd7;};}function handleError(_0x49ef1c,_0x59fb59){_0x59fb59=_0x59fb59||0x1f4;return function(_0x7d5237){logger['error'](_0x7d5237[_0x8d16('0x24')]);if(_0x7d5237[_0x8d16('0x25')]){delete _0x7d5237['name'];}_0x49ef1c['status'](_0x59fb59)['send'](_0x7d5237);};}exports[_0x8d16('0x26')]=function(_0xa43ce8,_0x12358f){var _0x3f570d={},_0x2ff5fd={},_0x256798={'count':0x0,'rows':[]};var _0x2fc692=_[_0x8d16('0x27')](db[_0x8d16('0x28')][_0x8d16('0x29')],function(_0x2d4c82){return{'name':_0x2d4c82[_0x8d16('0x2a')],'type':_0x2d4c82[_0x8d16('0x2b')]['key']};});_0x2ff5fd[_0x8d16('0x2c')]=_[_0x8d16('0x27')](_0x2fc692,'name');_0x2ff5fd[_0x8d16('0x2d')]=_['keys'](_0xa43ce8[_0x8d16('0x2d')]);_0x2ff5fd['filters']=_[_0x8d16('0x2e')](_0x2ff5fd[_0x8d16('0x2c')],_0x2ff5fd['query']);_0x3f570d['attributes']=_[_0x8d16('0x2e')](_0x2ff5fd[_0x8d16('0x2c')],qs[_0x8d16('0x2f')](_0xa43ce8[_0x8d16('0x2d')][_0x8d16('0x2f')]));_0x3f570d[_0x8d16('0x30')]=_0x3f570d['attributes']['length']?_0x3f570d[_0x8d16('0x30')]:_0x2ff5fd[_0x8d16('0x2c')];if(!_0xa43ce8[_0x8d16('0x2d')][_0x8d16('0x31')](_0x8d16('0x32'))){_0x3f570d[_0x8d16('0x1b')]=qs['limit'](_0xa43ce8[_0x8d16('0x2d')]['limit']);_0x3f570d['offset']=qs['offset'](_0xa43ce8[_0x8d16('0x2d')][_0x8d16('0x1a')]);}_0x3f570d[_0x8d16('0x33')]=qs[_0x8d16('0x34')](_0xa43ce8['query']['sort']);_0x3f570d['where']=qs[_0x8d16('0x35')](_[_0x8d16('0x36')](_0xa43ce8['query'],_0x2ff5fd[_0x8d16('0x35')]));if(_0xa43ce8[_0x8d16('0x2d')][_0x8d16('0x37')]){_0x3f570d[_0x8d16('0x38')]=_['merge'](_0x3f570d[_0x8d16('0x38')],{'$or':_['map'](_0x2fc692,function(_0x2512de){if(_0x2512de[_0x8d16('0x2b')]!==_0x8d16('0x39')){var _0xceb463={};_0xceb463[_0x2512de[_0x8d16('0x25')]]={'$like':'%'+_0xa43ce8['query'][_0x8d16('0x37')]+'%'};return _0xceb463;}})});}_0x3f570d=_[_0x8d16('0x3a')]({},_0x3f570d,_0xa43ce8[_0x8d16('0x3b')]);var _0x49b90a={'where':_0x3f570d['where']};return db['VoiceDialReport'][_0x8d16('0x19')](_0x49b90a)[_0x8d16('0x22')](function(_0x5bd698){_0x256798[_0x8d16('0x19')]=_0x5bd698;if(_0xa43ce8[_0x8d16('0x2d')][_0x8d16('0x3c')]){_0x3f570d[_0x8d16('0x3d')]=[{'all':!![]}];}return db['VoiceDialReport']['findAll'](_0x3f570d);})[_0x8d16('0x22')](function(_0x5181c5){_0x256798[_0x8d16('0x3e')]=_0x5181c5;return _0x256798;})['then'](respondWithFilteredResult(_0x12358f,_0x3f570d))[_0x8d16('0x3f')](handleError(_0x12358f,null));};exports[_0x8d16('0x40')]=function(_0x5e83fc,_0x4d7ccb){var _0x41007b={'raw':!![],'where':{'id':_0x5e83fc[_0x8d16('0x41')]['id']}},_0x3d6036={};_0x3d6036[_0x8d16('0x2c')]=_[_0x8d16('0x42')](db[_0x8d16('0x28')][_0x8d16('0x29')]);_0x3d6036[_0x8d16('0x2d')]=_[_0x8d16('0x42')](_0x5e83fc[_0x8d16('0x2d')]);_0x3d6036['filters']=_['intersection'](_0x3d6036['model'],_0x3d6036['query']);_0x41007b[_0x8d16('0x30')]=_[_0x8d16('0x2e')](_0x3d6036[_0x8d16('0x2c')],qs[_0x8d16('0x2f')](_0x5e83fc[_0x8d16('0x2d')][_0x8d16('0x2f')]));_0x41007b[_0x8d16('0x30')]=_0x41007b['attributes'][_0x8d16('0x43')]?_0x41007b[_0x8d16('0x30')]:_0x3d6036['model'];if(_0x5e83fc[_0x8d16('0x2d')][_0x8d16('0x3c')]){_0x41007b['include']=[{'all':!![]}];}_0x41007b=_[_0x8d16('0x3a')]({},_0x41007b,_0x5e83fc[_0x8d16('0x3b')]);return db[_0x8d16('0x28')][_0x8d16('0x44')](_0x41007b)[_0x8d16('0x22')](handleEntityNotFound(_0x4d7ccb,null))['then'](respondWithResult(_0x4d7ccb,null))[_0x8d16('0x3f')](handleError(_0x4d7ccb,null));};exports[_0x8d16('0x45')]=function(_0x2d343f,_0xb4a118){return db['VoiceDialReport'][_0x8d16('0x45')](_0x2d343f[_0x8d16('0x46')],{})[_0x8d16('0x22')](respondWithResult(_0xb4a118,0xc9))['catch'](handleError(_0xb4a118,null));};exports[_0x8d16('0x20')]=function(_0x55c0fc,_0x2a2351){if(_0x55c0fc[_0x8d16('0x46')]['id']){delete _0x55c0fc['body']['id'];}return db['VoiceDialReport'][_0x8d16('0x44')]({'where':{'id':_0x55c0fc['params']['id']}})[_0x8d16('0x22')](handleEntityNotFound(_0x2a2351,null))[_0x8d16('0x22')](saveUpdates(_0x55c0fc['body'],null))['then'](respondWithResult(_0x2a2351,null))[_0x8d16('0x3f')](handleError(_0x2a2351,null));};exports['destroy']=function(_0x498540,_0x4b65bd){return db['VoiceDialReport'][_0x8d16('0x44')]({'where':{'id':_0x498540[_0x8d16('0x41')]['id']}})['then'](handleEntityNotFound(_0x4b65bd,null))[_0x8d16('0x22')](removeEntity(_0x4b65bd,null))[_0x8d16('0x3f')](handleError(_0x4b65bd,null));};exports[_0x8d16('0x47')]=function(_0x122eb6,_0x38b6ac){return db[_0x8d16('0x28')][_0x8d16('0x47')]()[_0x8d16('0x22')](respondWithResult(_0x38b6ac,null))['catch'](handleError(_0x38b6ac,null));}; \ No newline at end of file +var _0xbf7d=['fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','status','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','find','create','body','update','params','html-pdf','eml-format','zip-dir'];(function(_0x2d982d,_0x121028){var _0x4f36b0=function(_0x11f3a9){while(--_0x11f3a9){_0x2d982d['push'](_0x2d982d['shift']());}};_0x4f36b0(++_0x121028);}(_0xbf7d,0x97));var _0xdbf7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbf7d[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xdbf7('0x0'));var emlformat=require(_0xdbf7('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xdbf7('0x2'));var jsonpatch=require(_0xdbf7('0x3'));var rp=require(_0xdbf7('0x4'));var moment=require(_0xdbf7('0x5'));var BPromise=require(_0xdbf7('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdbf7('0x7'));var sox=require(_0xdbf7('0x8'));var csv=require(_0xdbf7('0x9'));var ejs=require(_0xdbf7('0xa'));var fs=require('fs');var _=require(_0xdbf7('0xb'));var squel=require(_0xdbf7('0xc'));var crypto=require(_0xdbf7('0xd'));var jsforce=require(_0xdbf7('0xe'));var deskjs=require(_0xdbf7('0xf'));var toCsv=require('to-csv');var querystring=require(_0xdbf7('0x10'));var Papa=require(_0xdbf7('0x11'));var Redis=require(_0xdbf7('0x12'));var authService=require(_0xdbf7('0x13'));var qs=require(_0xdbf7('0x14'));var as=require(_0xdbf7('0x15'));var hardwareService=require(_0xdbf7('0x16'));var logger=require(_0xdbf7('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xdbf7('0x18'));var db=require(_0xdbf7('0x19'))['db'];function respondWithStatusCode(_0x26accc,_0x2d26a8){_0x2d26a8=_0x2d26a8||0xcc;return function(_0x4a5aa9){if(_0x4a5aa9){return _0x26accc[_0xdbf7('0x1a')](_0x2d26a8);}return _0x26accc['status'](_0x2d26a8)[_0xdbf7('0x1b')]();};}function respondWithResult(_0x54a431,_0x300bbf){_0x300bbf=_0x300bbf||0xc8;return function(_0x45ac47){if(_0x45ac47){return _0x54a431[_0xdbf7('0x1c')](_0x300bbf)['json'](_0x45ac47);}};}function respondWithFilteredResult(_0x4bd010,_0x500487){return function(_0x5e41d6){if(_0x5e41d6){var _0x3d249f=_0x5e41d6['count'],_0x39bb91=_0x500487[_0xdbf7('0x1d')],_0x1a6c1f=_0x500487[_0xdbf7('0x1d')]+_0x500487[_0xdbf7('0x1e')],_0x929ad4;if(_0x1a6c1f>=_0x3d249f){_0x1a6c1f=_0x3d249f;_0x929ad4=0xc8;}else{_0x929ad4=0xce;}_0x4bd010['status'](_0x929ad4);return _0x4bd010[_0xdbf7('0x1f')](_0xdbf7('0x20'),_0x39bb91+'-'+_0x1a6c1f+'/'+_0x3d249f)[_0xdbf7('0x21')](_0x5e41d6);}return null;};}function patchUpdates(_0x959bd2){return function(_0x50af15){try{jsonpatch[_0xdbf7('0x22')](_0x50af15,_0x959bd2,!![]);}catch(_0x34a1f3){return BPromise[_0xdbf7('0x23')](_0x34a1f3);}return _0x50af15[_0xdbf7('0x24')]();};}function saveUpdates(_0x3618f2,_0x3328e3){return function(_0x1776b8){if(_0x1776b8){return _0x1776b8['update'](_0x3618f2)[_0xdbf7('0x25')](function(_0x52e941){return _0x52e941;});}return null;};}function removeEntity(_0x40d22d,_0x112340){return function(_0x2f4404){if(_0x2f4404){return _0x2f4404[_0xdbf7('0x26')]()[_0xdbf7('0x25')](function(){_0x40d22d['status'](0xcc)[_0xdbf7('0x1b')]();});}};}function handleEntityNotFound(_0xde94fc,_0x1358c3){return function(_0x3015c2){if(!_0x3015c2){_0xde94fc[_0xdbf7('0x1a')](0x194);}return _0x3015c2;};}function handleError(_0xe354fd,_0x4f967a){_0x4f967a=_0x4f967a||0x1f4;return function(_0x299d8e){logger[_0xdbf7('0x27')](_0x299d8e[_0xdbf7('0x28')]);if(_0x299d8e[_0xdbf7('0x29')]){delete _0x299d8e[_0xdbf7('0x29')];}_0xe354fd[_0xdbf7('0x1c')](_0x4f967a)[_0xdbf7('0x2a')](_0x299d8e);};}exports[_0xdbf7('0x2b')]=function(_0x1d8d3a,_0x31797b){var _0x2ee52b={},_0x20e03a={},_0x496db7={'count':0x0,'rows':[]};var _0x58d67e=_[_0xdbf7('0x2c')](db[_0xdbf7('0x2d')][_0xdbf7('0x2e')],function(_0x392bc3){return{'name':_0x392bc3['fieldName'],'type':_0x392bc3[_0xdbf7('0x2f')]['key']};});_0x20e03a[_0xdbf7('0x30')]=_[_0xdbf7('0x2c')](_0x58d67e,'name');_0x20e03a[_0xdbf7('0x31')]=_[_0xdbf7('0x32')](_0x1d8d3a[_0xdbf7('0x31')]);_0x20e03a[_0xdbf7('0x33')]=_[_0xdbf7('0x34')](_0x20e03a[_0xdbf7('0x30')],_0x20e03a[_0xdbf7('0x31')]);_0x2ee52b[_0xdbf7('0x35')]=_[_0xdbf7('0x34')](_0x20e03a[_0xdbf7('0x30')],qs[_0xdbf7('0x36')](_0x1d8d3a[_0xdbf7('0x31')][_0xdbf7('0x36')]));_0x2ee52b[_0xdbf7('0x35')]=_0x2ee52b[_0xdbf7('0x35')][_0xdbf7('0x37')]?_0x2ee52b[_0xdbf7('0x35')]:_0x20e03a['model'];if(!_0x1d8d3a[_0xdbf7('0x31')][_0xdbf7('0x38')](_0xdbf7('0x39'))){_0x2ee52b[_0xdbf7('0x1e')]=qs[_0xdbf7('0x1e')](_0x1d8d3a[_0xdbf7('0x31')]['limit']);_0x2ee52b[_0xdbf7('0x1d')]=qs[_0xdbf7('0x1d')](_0x1d8d3a[_0xdbf7('0x31')][_0xdbf7('0x1d')]);}_0x2ee52b['order']=qs[_0xdbf7('0x3a')](_0x1d8d3a[_0xdbf7('0x31')][_0xdbf7('0x3a')]);_0x2ee52b['where']=qs[_0xdbf7('0x33')](_[_0xdbf7('0x3b')](_0x1d8d3a[_0xdbf7('0x31')],_0x20e03a['filters']));if(_0x1d8d3a[_0xdbf7('0x31')][_0xdbf7('0x3c')]){_0x2ee52b[_0xdbf7('0x3d')]=_[_0xdbf7('0x3e')](_0x2ee52b[_0xdbf7('0x3d')],{'$or':_[_0xdbf7('0x2c')](_0x58d67e,function(_0x44b03a){if(_0x44b03a[_0xdbf7('0x2f')]!==_0xdbf7('0x3f')){var _0x5692f9={};_0x5692f9[_0x44b03a[_0xdbf7('0x29')]]={'$like':'%'+_0x1d8d3a[_0xdbf7('0x31')]['filter']+'%'};return _0x5692f9;}})});}_0x2ee52b=_[_0xdbf7('0x3e')]({},_0x2ee52b,_0x1d8d3a[_0xdbf7('0x40')]);var _0x279aaf={'where':_0x2ee52b['where']};return db[_0xdbf7('0x2d')]['count'](_0x279aaf)[_0xdbf7('0x25')](function(_0x2c6d29){_0x496db7[_0xdbf7('0x41')]=_0x2c6d29;if(_0x1d8d3a['query'][_0xdbf7('0x42')]){_0x2ee52b[_0xdbf7('0x43')]=[{'all':!![]}];}return db[_0xdbf7('0x2d')][_0xdbf7('0x44')](_0x2ee52b);})[_0xdbf7('0x25')](function(_0x49b256){_0x496db7[_0xdbf7('0x45')]=_0x49b256;return _0x496db7;})[_0xdbf7('0x25')](respondWithFilteredResult(_0x31797b,_0x2ee52b))[_0xdbf7('0x46')](handleError(_0x31797b,null));};exports[_0xdbf7('0x47')]=function(_0x5a137b,_0xdd7c79){var _0x39f08b={'raw':!![],'where':{'id':_0x5a137b['params']['id']}},_0x2064aa={};_0x2064aa[_0xdbf7('0x30')]=_[_0xdbf7('0x32')](db[_0xdbf7('0x2d')]['rawAttributes']);_0x2064aa['query']=_['keys'](_0x5a137b[_0xdbf7('0x31')]);_0x2064aa[_0xdbf7('0x33')]=_['intersection'](_0x2064aa[_0xdbf7('0x30')],_0x2064aa[_0xdbf7('0x31')]);_0x39f08b['attributes']=_['intersection'](_0x2064aa['model'],qs[_0xdbf7('0x36')](_0x5a137b[_0xdbf7('0x31')][_0xdbf7('0x36')]));_0x39f08b[_0xdbf7('0x35')]=_0x39f08b[_0xdbf7('0x35')]['length']?_0x39f08b[_0xdbf7('0x35')]:_0x2064aa[_0xdbf7('0x30')];if(_0x5a137b['query']['includeAll']){_0x39f08b[_0xdbf7('0x43')]=[{'all':!![]}];}_0x39f08b=_[_0xdbf7('0x3e')]({},_0x39f08b,_0x5a137b['options']);return db['VoiceDialReport'][_0xdbf7('0x48')](_0x39f08b)['then'](handleEntityNotFound(_0xdd7c79,null))[_0xdbf7('0x25')](respondWithResult(_0xdd7c79,null))[_0xdbf7('0x46')](handleError(_0xdd7c79,null));};exports[_0xdbf7('0x49')]=function(_0x306380,_0x39a237){return db[_0xdbf7('0x2d')][_0xdbf7('0x49')](_0x306380[_0xdbf7('0x4a')],{})[_0xdbf7('0x25')](respondWithResult(_0x39a237,0xc9))['catch'](handleError(_0x39a237,null));};exports[_0xdbf7('0x4b')]=function(_0x413221,_0x4e0a62){if(_0x413221['body']['id']){delete _0x413221[_0xdbf7('0x4a')]['id'];}return db[_0xdbf7('0x2d')][_0xdbf7('0x48')]({'where':{'id':_0x413221[_0xdbf7('0x4c')]['id']}})[_0xdbf7('0x25')](handleEntityNotFound(_0x4e0a62,null))[_0xdbf7('0x25')](saveUpdates(_0x413221['body'],null))[_0xdbf7('0x25')](respondWithResult(_0x4e0a62,null))['catch'](handleError(_0x4e0a62,null));};exports[_0xdbf7('0x26')]=function(_0x13e28d,_0x5ce09f){return db[_0xdbf7('0x2d')][_0xdbf7('0x48')]({'where':{'id':_0x13e28d[_0xdbf7('0x4c')]['id']}})[_0xdbf7('0x25')](handleEntityNotFound(_0x5ce09f,null))[_0xdbf7('0x25')](removeEntity(_0x5ce09f,null))[_0xdbf7('0x46')](handleError(_0x5ce09f,null));};exports['describe']=function(_0x52d18d,_0x11bdef){return db[_0xdbf7('0x2d')]['describe']()['then'](respondWithResult(_0x11bdef,null))[_0xdbf7('0x46')](handleError(_0x11bdef,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index f211ab2..82fa55c 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 _0x41ea=['VoiceDialReport','report_dial','uniqueid','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x1ce3c0,_0x32b456){var _0x2b37e4=function(_0x29eced){while(--_0x29eced){_0x1ce3c0['push'](_0x1ce3c0['shift']());}};_0x2b37e4(++_0x32b456);}(_0x41ea,0x17c));var _0xa41e=function(_0x848500,_0x5409c4){_0x848500=_0x848500-0x0;var _0x3afd1a=_0x41ea[_0x848500];return _0x3afd1a;};'use strict';var _=require(_0xa41e('0x0'));var util=require('util');var logger=require(_0xa41e('0x1'))(_0xa41e('0x2'));var moment=require(_0xa41e('0x3'));var BPromise=require('bluebird');var rp=require(_0xa41e('0x4'));var fs=require('fs');var path=require(_0xa41e('0x5'));var rimraf=require(_0xa41e('0x6'));var config=require(_0xa41e('0x7'));var attributes=require('./voiceDialReport.attributes');module[_0xa41e('0x8')]=function(_0x4b83a3,_0x42d01a){return _0x4b83a3[_0xa41e('0x9')](_0xa41e('0xa'),attributes,{'tableName':_0xa41e('0xb'),'paranoid':![],'indexes':[{'fields':[_0xa41e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1e61=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','uniqueid','util','../../config/logger','api'];(function(_0x2c944e,_0x26f659){var _0x2cc529=function(_0x3fbc4b){while(--_0x3fbc4b){_0x2c944e['push'](_0x2c944e['shift']());}};_0x2cc529(++_0x26f659);}(_0x1e61,0x105));var _0x11e6=function(_0x50c913,_0x59ee71){_0x50c913=_0x50c913-0x0;var _0x2635db=_0x1e61[_0x50c913];return _0x2635db;};'use strict';var _=require('lodash');var util=require(_0x11e6('0x0'));var logger=require(_0x11e6('0x1'))(_0x11e6('0x2'));var moment=require(_0x11e6('0x3'));var BPromise=require(_0x11e6('0x4'));var rp=require(_0x11e6('0x5'));var fs=require('fs');var path=require(_0x11e6('0x6'));var rimraf=require(_0x11e6('0x7'));var config=require(_0x11e6('0x8'));var attributes=require(_0x11e6('0x9'));module['exports']=function(_0x4f2bb7,_0x299e5c){return _0x4f2bb7['define']('VoiceDialReport',attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x11e6('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index c3875cf..d46465a 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 _0x495e=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateVoiceDialReport','VoiceDialReport','create','options','raw','debug','catch','update','body','attributes','UpdateVoiceDialReport','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x495e,0xfb));var _0xe495=function(_0x460150,_0x232949){_0x460150=_0x460150-0x0;var _0x340677=_0x495e[_0x460150];return _0x340677;};'use strict';var _=require(_0xe495('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe495('0x1'));var rs=require(_0xe495('0x2'));var fs=require('fs');var Redis=require(_0xe495('0x3'));var db=require(_0xe495('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe495('0x5'))(_0xe495('0x6'));var config=require(_0xe495('0x7'));var jayson=require(_0xe495('0x8'));var client=jayson[_0xe495('0x9')][_0xe495('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x101a7e,_0x5745e3,_0x599ab4){return new BPromise(function(_0x5c17d0,_0x16f146){return client['request'](_0x101a7e,_0x599ab4)[_0xe495('0xb')](function(_0x3a9a00){logger[_0xe495('0xc')](_0xe495('0xd'),_0x5745e3,_0xe495('0xe'));logger['debug'](_0xe495('0xf'),_0x5745e3,_0xe495('0xe'),JSON[_0xe495('0x10')](_0x3a9a00));if(_0x3a9a00['error']){if(_0x3a9a00[_0xe495('0x11')][_0xe495('0x12')]===0x1f4){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x5745e3,_0x3a9a00[_0xe495('0x11')][_0xe495('0x13')]);return _0x16f146(_0x3a9a00['error'][_0xe495('0x13')]);}logger[_0xe495('0x11')](_0xe495('0xd'),_0x5745e3,_0x3a9a00[_0xe495('0x11')][_0xe495('0x13')]);return _0x5c17d0(_0x3a9a00['error'][_0xe495('0x13')]);}else{logger[_0xe495('0xc')](_0xe495('0xd'),_0x5745e3,_0xe495('0xe'));_0x5c17d0(_0x3a9a00[_0xe495('0x14')]['message']);}})['catch'](function(_0x4de730){logger[_0xe495('0x11')](_0xe495('0xd'),_0x5745e3,_0x4de730);_0x16f146(_0x4de730);});});}exports[_0xe495('0x15')]=function(_0x577fb7){var _0x1e602c=this;return new Promise(function(_0x302ca0,_0x3ba8cc){return db[_0xe495('0x16')][_0xe495('0x17')](_0x577fb7['body'],{'raw':_0x577fb7['options']?_0x577fb7[_0xe495('0x18')][_0xe495('0x19')]===undefined?!![]:![]:!![]})[_0xe495('0xb')](function(_0x169bd2){logger['info'](_0xe495('0x15'),_0x577fb7);logger[_0xe495('0x1a')](_0xe495('0x15'),_0x577fb7,JSON['stringify'](_0x169bd2));_0x302ca0(_0x169bd2);})[_0xe495('0x1b')](function(_0x17d13f){logger[_0xe495('0x11')](_0xe495('0x15'),_0x17d13f[_0xe495('0x13')],_0x577fb7);_0x3ba8cc(_0x1e602c['error'](0x1f4,_0x17d13f[_0xe495('0x13')]));});});};exports['UpdateVoiceDialReport']=function(_0x181ead){var _0x39cff4=this;return new Promise(function(_0x3a3f89,_0x5d095f){return db[_0xe495('0x16')][_0xe495('0x1c')](_0x181ead[_0xe495('0x1d')],{'raw':_0x181ead[_0xe495('0x18')]?_0x181ead[_0xe495('0x18')][_0xe495('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x181ead[_0xe495('0x18')]?_0x181ead['options']['where']||null:null,'attributes':_0x181ead[_0xe495('0x18')]?_0x181ead['options'][_0xe495('0x1e')]||null:null,'limit':_0x181ead[_0xe495('0x18')]?_0x181ead['options']['limit']||null:null})[_0xe495('0xb')](function(_0x620f00){logger[_0xe495('0xc')](_0xe495('0x1f'),_0x181ead);logger[_0xe495('0x1a')](_0xe495('0x1f'),_0x181ead,JSON[_0xe495('0x10')](_0x620f00));_0x3a3f89(_0x620f00);})[_0xe495('0x1b')](function(_0x535d23){logger['error'](_0xe495('0x1f'),_0x535d23[_0xe495('0x13')],_0x181ead);_0x5d095f(_0x39cff4[_0xe495('0x11')](0x1f4,_0x535d23[_0xe495('0x13')]));});});}; \ No newline at end of file +var _0x9ade=['options','raw','update','where','attributes','limit','UpdateVoiceDialReport','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body'];(function(_0x55c97d,_0x228ffc){var _0x1d5112=function(_0x2ab908){while(--_0x2ab908){_0x55c97d['push'](_0x55c97d['shift']());}};_0x1d5112(++_0x228ffc);}(_0x9ade,0x107));var _0xe9ad=function(_0x35197d,_0x33eda7){_0x35197d=_0x35197d-0x0;var _0x157a26=_0x9ade[_0x35197d];return _0x157a26;};'use strict';var _=require(_0xe9ad('0x0'));var util=require(_0xe9ad('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe9ad('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe9ad('0x3'))['db'];var utils=require(_0xe9ad('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xe9ad('0x5'));var jayson=require(_0xe9ad('0x6'));var client=jayson[_0xe9ad('0x7')][_0xe9ad('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x308564,_0x6ede7f,_0xb4b663){return new BPromise(function(_0x1a297b,_0x4b16b5){return client[_0xe9ad('0x9')](_0x308564,_0xb4b663)[_0xe9ad('0xa')](function(_0x32d7d0){logger[_0xe9ad('0xb')](_0xe9ad('0xc'),_0x6ede7f,_0xe9ad('0xd'));logger[_0xe9ad('0xe')](_0xe9ad('0xf'),_0x6ede7f,_0xe9ad('0xd'),JSON[_0xe9ad('0x10')](_0x32d7d0));if(_0x32d7d0[_0xe9ad('0x11')]){if(_0x32d7d0[_0xe9ad('0x11')]['code']===0x1f4){logger[_0xe9ad('0x11')](_0xe9ad('0xc'),_0x6ede7f,_0x32d7d0[_0xe9ad('0x11')][_0xe9ad('0x12')]);return _0x4b16b5(_0x32d7d0['error'][_0xe9ad('0x12')]);}logger[_0xe9ad('0x11')](_0xe9ad('0xc'),_0x6ede7f,_0x32d7d0[_0xe9ad('0x11')]['message']);return _0x1a297b(_0x32d7d0[_0xe9ad('0x11')]['message']);}else{logger[_0xe9ad('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0x6ede7f,_0xe9ad('0xd'));_0x1a297b(_0x32d7d0[_0xe9ad('0x13')][_0xe9ad('0x12')]);}})[_0xe9ad('0x14')](function(_0x58151c){logger[_0xe9ad('0x11')](_0xe9ad('0xc'),_0x6ede7f,_0x58151c);_0x4b16b5(_0x58151c);});});}exports[_0xe9ad('0x15')]=function(_0x2b9437){var _0x2f11c9=this;return new Promise(function(_0x1a55f9,_0x59e349){return db[_0xe9ad('0x16')][_0xe9ad('0x17')](_0x2b9437[_0xe9ad('0x18')],{'raw':_0x2b9437[_0xe9ad('0x19')]?_0x2b9437[_0xe9ad('0x19')][_0xe9ad('0x1a')]===undefined?!![]:![]:!![]})[_0xe9ad('0xa')](function(_0x2ecac0){logger[_0xe9ad('0xb')]('CreateVoiceDialReport',_0x2b9437);logger[_0xe9ad('0xe')]('CreateVoiceDialReport',_0x2b9437,JSON[_0xe9ad('0x10')](_0x2ecac0));_0x1a55f9(_0x2ecac0);})['catch'](function(_0xe4ddc1){logger[_0xe9ad('0x11')](_0xe9ad('0x15'),_0xe4ddc1[_0xe9ad('0x12')],_0x2b9437);_0x59e349(_0x2f11c9[_0xe9ad('0x11')](0x1f4,_0xe4ddc1['message']));});});};exports['UpdateVoiceDialReport']=function(_0x40a6ce){var _0x2d2ef4=this;return new Promise(function(_0x281b6a,_0x465d10){return db[_0xe9ad('0x16')][_0xe9ad('0x1b')](_0x40a6ce[_0xe9ad('0x18')],{'raw':_0x40a6ce[_0xe9ad('0x19')]?_0x40a6ce['options'][_0xe9ad('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40a6ce[_0xe9ad('0x19')]?_0x40a6ce[_0xe9ad('0x19')][_0xe9ad('0x1c')]||null:null,'attributes':_0x40a6ce['options']?_0x40a6ce[_0xe9ad('0x19')][_0xe9ad('0x1d')]||null:null,'limit':_0x40a6ce[_0xe9ad('0x19')]?_0x40a6ce[_0xe9ad('0x19')][_0xe9ad('0x1e')]||null:null})[_0xe9ad('0xa')](function(_0x564be7){logger[_0xe9ad('0xb')](_0xe9ad('0x1f'),_0x40a6ce);logger[_0xe9ad('0xe')](_0xe9ad('0x1f'),_0x40a6ce,JSON['stringify'](_0x564be7));_0x281b6a(_0x564be7);})[_0xe9ad('0x14')](function(_0x319da5){logger[_0xe9ad('0x11')](_0xe9ad('0x1f'),_0x319da5[_0xe9ad('0x12')],_0x40a6ce);_0x465d10(_0x2d2ef4[_0xe9ad('0x11')](0x1f4,_0x319da5['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 8115e37..bd5d0e4 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 _0x9a4f=['index','/:id','post','create','addApplications','put','update','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./voiceExtension.controller','get','isAuthenticated'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9a4f,0x8f));var _0xf9a4=function(_0x4c6840,_0x97fe36){_0x4c6840=_0x4c6840-0x0;var _0x23e354=_0x9a4f[_0x4c6840];return _0x23e354;};'use strict';var multer=require(_0xf9a4('0x0'));var util=require(_0xf9a4('0x1'));var path=require(_0xf9a4('0x2'));var timeout=require(_0xf9a4('0x3'));var express=require('express');var router=express[_0xf9a4('0x4')]();var auth=require(_0xf9a4('0x5'));var interaction=require(_0xf9a4('0x6'));var config=require('../../config/environment');var controller=require(_0xf9a4('0x7'));router[_0xf9a4('0x8')]('/',auth[_0xf9a4('0x9')](),controller[_0xf9a4('0xa')]);router['get'](_0xf9a4('0xb'),auth[_0xf9a4('0x9')](),controller['show']);router[_0xf9a4('0xc')]('/',auth['isAuthenticated'](),controller[_0xf9a4('0xd')]);router[_0xf9a4('0xc')]('/:id/applications',auth[_0xf9a4('0x9')](),controller[_0xf9a4('0xe')]);router[_0xf9a4('0xf')]('/:id',auth[_0xf9a4('0x9')](),controller[_0xf9a4('0x10')]);router['delete'](_0xf9a4('0xb'),auth[_0xf9a4('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf0ab=['show','create','isAuthenticated','addApplications','update','delete','destroy','exports','multer','path','express','Router','../../components/interaction/service','./voiceExtension.controller','get','/:id'];(function(_0x531d15,_0x599af5){var _0x271a18=function(_0x31284d){while(--_0x31284d){_0x531d15['push'](_0x531d15['shift']());}};_0x271a18(++_0x599af5);}(_0xf0ab,0xd8));var _0xbf0a=function(_0x33defc,_0x4197a6){_0x33defc=_0x33defc-0x0;var _0x52cd4b=_0xf0ab[_0x33defc];return _0x52cd4b;};'use strict';var multer=require(_0xbf0a('0x0'));var util=require('util');var path=require(_0xbf0a('0x1'));var timeout=require('connect-timeout');var express=require(_0xbf0a('0x2'));var router=express[_0xbf0a('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xbf0a('0x4'));var config=require('../../config/environment');var controller=require(_0xbf0a('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xbf0a('0x6')](_0xbf0a('0x7'),auth['isAuthenticated'](),controller[_0xbf0a('0x8')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbf0a('0x9')]);router['post']('/:id/applications',auth[_0xbf0a('0xa')](),controller[_0xbf0a('0xb')]);router['put'](_0xbf0a('0x7'),auth[_0xbf0a('0xa')](),controller[_0xbf0a('0xc')]);router[_0xbf0a('0xd')](_0xbf0a('0x7'),auth['isAuthenticated'](),controller[_0xbf0a('0xe')]);module[_0xbf0a('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index d22054b..2072986 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(_0x4b80eb,_0x392b29){var _0x42ec95=function(_0x36d2ea){while(--_0x36d2ea){_0x4b80eb['push'](_0x4b80eb['shift']());}};_0x42ec95(++_0x392b29);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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(_0x5baa35,_0x6c437e){var _0x1cdbc6=function(_0x3a6fac){while(--_0x3a6fac){_0x5baa35['push'](_0x5baa35['shift']());}};_0x1cdbc6(++_0x6c437e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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 3893764..184389c 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 _0x557c=['fields','length','hasOwnProperty','limit','order','filters','pick','where','merge','VIRTUAL','options','VoiceExtension','includeAll','include','findAll','rows','catch','show','params','create','body','startsWith','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OutboundRoutes','InternalRoutes','UserProfileSection','update','context','recordingFormat','cutdigits','mandatoryDisposition','addApplications','sequelize','transaction','VoiceExtensionId','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','register','sendStatus','status','end','json','offset','apply','save','destroy','get','InboundRoutes','inbound','outbound','internal','filter','ignore','map','value','includes','type','find','name','then','error','send','index','rawAttributes','key','query','keys','intersection','model','attributes'];(function(_0x21d295,_0x45ad2f){var _0x224dce=function(_0x201eb2){while(--_0x201eb2){_0x21d295['push'](_0x21d295['shift']());}};_0x224dce(++_0x45ad2f);}(_0x557c,0x8e));var _0xc557=function(_0x3fac6f,_0x47130e){_0x3fac6f=_0x3fac6f-0x0;var _0x6ad8e0=_0x557c[_0x3fac6f];return _0x6ad8e0;};'use strict';var pdf=require(_0xc557('0x0'));var emlformat=require(_0xc557('0x1'));var rimraf=require(_0xc557('0x2'));var zipdir=require(_0xc557('0x3'));var jsonpatch=require(_0xc557('0x4'));var rp=require('request-promise');var moment=require(_0xc557('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc557('0x6'));var util=require(_0xc557('0x7'));var path=require('path');var sox=require(_0xc557('0x8'));var csv=require(_0xc557('0x9'));var ejs=require(_0xc557('0xa'));var fs=require('fs');var _=require(_0xc557('0xb'));var squel=require(_0xc557('0xc'));var crypto=require(_0xc557('0xd'));var jsforce=require(_0xc557('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc557('0x9'));var querystring=require(_0xc557('0xf'));var Papa=require(_0xc557('0x10'));var Redis=require(_0xc557('0x11'));var authService=require(_0xc557('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc557('0x13'));var hardwareService=require(_0xc557('0x14'));var logger=require(_0xc557('0x15'))(_0xc557('0x16'));var utils=require(_0xc557('0x17'));var config=require('../../config/environment');var db=require(_0xc557('0x18'))['db'];config[_0xc557('0x19')]=_['defaults'](config[_0xc557('0x19')],{'host':_0xc557('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc557('0x19')]));require('./voiceExtension.socket')[_0xc557('0x1b')](socket);function respondWithStatusCode(_0x4474cc,_0x2feddb){_0x2feddb=_0x2feddb||0xcc;return function(_0x476fe1){if(_0x476fe1){return _0x4474cc[_0xc557('0x1c')](_0x2feddb);}return _0x4474cc[_0xc557('0x1d')](_0x2feddb)[_0xc557('0x1e')]();};}function respondWithResult(_0x5d4387,_0x381547){_0x381547=_0x381547||0xc8;return function(_0x475400){if(_0x475400){return _0x5d4387[_0xc557('0x1d')](_0x381547)[_0xc557('0x1f')](_0x475400);}};}function respondWithFilteredResult(_0x2b28f0,_0x48cd8a){return function(_0xa4ace1){if(_0xa4ace1){var _0x574b3f=_0xa4ace1['count'],_0x1f449e=_0x48cd8a[_0xc557('0x20')],_0x3f4e9e=_0x48cd8a[_0xc557('0x20')]+_0x48cd8a['limit'],_0x29207e;if(_0x3f4e9e>=_0x574b3f){_0x3f4e9e=_0x574b3f;_0x29207e=0xc8;}else{_0x29207e=0xce;}_0x2b28f0[_0xc557('0x1d')](_0x29207e);return _0x2b28f0['set']('Content-Range',_0x1f449e+'-'+_0x3f4e9e+'/'+_0x574b3f)[_0xc557('0x1f')](_0xa4ace1);}return null;};}function patchUpdates(_0x2b6eec){return function(_0x1f2718){try{jsonpatch[_0xc557('0x21')](_0x1f2718,_0x2b6eec,!![]);}catch(_0x1508de){return BPromise['reject'](_0x1508de);}return _0x1f2718[_0xc557('0x22')]();};}function saveUpdates(_0x504703,_0x5d04a3){return function(_0x4bf359){if(_0x4bf359){return _0x4bf359['update'](_0x504703)['then'](function(_0x1387df){return _0x1387df;});}return null;};}function removeEntity(_0xc3beb0,_0x2b4954){return function(_0x1c83fb){if(_0x1c83fb){return _0x1c83fb[_0xc557('0x23')]()['then'](function(){var _0x21e5c9=_0x1c83fb[_0xc557('0x24')]({'plain':!![]});var _0x18c3d1=[{'name':_0xc557('0x25'),'value':_0xc557('0x26'),'ignore':![]},{'name':'OutboundRoutes','value':_0xc557('0x27'),'ignore':![]},{'name':'InternalRoutes','value':_0xc557('0x28'),'ignore':![]}];var _0x213785=_(_0x18c3d1)[_0xc557('0x29')](_0xc557('0x2a'))[_0xc557('0x2b')]('value')[_0xc557('0x2c')]();if(_[_0xc557('0x2d')](_0x213785,_0x21e5c9[_0xc557('0x2e')])){return;}var _0xfbcfe2=_[_0xc557('0x2f')](_0x18c3d1,[_0xc557('0x2c'),_0x21e5c9['type']])[_0xc557('0x30')];return db['UserProfileResource'][_0xc557('0x23')]({'where':{'type':_0xfbcfe2,'resourceId':_0x21e5c9['id']}})[_0xc557('0x31')](function(){return _0x1c83fb;});})[_0xc557('0x31')](function(){_0xc3beb0[_0xc557('0x1d')](0xcc)[_0xc557('0x1e')]();});}};}function handleEntityNotFound(_0x2fc069,_0x247d64){return function(_0x359ad9){if(!_0x359ad9){_0x2fc069[_0xc557('0x1c')](0x194);}return _0x359ad9;};}function handleError(_0xdf639,_0x131a1a){_0x131a1a=_0x131a1a||0x1f4;return function(_0x58686c){logger[_0xc557('0x32')](_0x58686c['stack']);if(_0x58686c['name']){delete _0x58686c[_0xc557('0x30')];}_0xdf639['status'](_0x131a1a)[_0xc557('0x33')](_0x58686c);};}exports[_0xc557('0x34')]=function(_0x251e4d,_0x464f59){var _0x536a9e={},_0xbf02c6={},_0x19c33f={'count':0x0,'rows':[]};var _0x39d9c7=_[_0xc557('0x2b')](db['VoiceExtension'][_0xc557('0x35')],function(_0x2d3ed4){return{'name':_0x2d3ed4['fieldName'],'type':_0x2d3ed4[_0xc557('0x2e')][_0xc557('0x36')]};});_0xbf02c6['model']=_[_0xc557('0x2b')](_0x39d9c7,_0xc557('0x30'));_0xbf02c6[_0xc557('0x37')]=_[_0xc557('0x38')](_0x251e4d[_0xc557('0x37')]);_0xbf02c6['filters']=_[_0xc557('0x39')](_0xbf02c6[_0xc557('0x3a')],_0xbf02c6[_0xc557('0x37')]);_0x536a9e[_0xc557('0x3b')]=_[_0xc557('0x39')](_0xbf02c6['model'],qs[_0xc557('0x3c')](_0x251e4d['query']['fields']));_0x536a9e[_0xc557('0x3b')]=_0x536a9e[_0xc557('0x3b')][_0xc557('0x3d')]?_0x536a9e[_0xc557('0x3b')]:_0xbf02c6[_0xc557('0x3a')];if(!_0x251e4d['query'][_0xc557('0x3e')]('nolimit')){_0x536a9e[_0xc557('0x3f')]=qs['limit'](_0x251e4d[_0xc557('0x37')][_0xc557('0x3f')]);_0x536a9e[_0xc557('0x20')]=qs[_0xc557('0x20')](_0x251e4d[_0xc557('0x37')][_0xc557('0x20')]);}_0x536a9e[_0xc557('0x40')]=qs['sort'](_0x251e4d[_0xc557('0x37')]['sort']);_0x536a9e['where']=qs[_0xc557('0x41')](_[_0xc557('0x42')](_0x251e4d[_0xc557('0x37')],_0xbf02c6[_0xc557('0x41')]));if(_0x251e4d[_0xc557('0x37')][_0xc557('0x29')]){_0x536a9e[_0xc557('0x43')]=_[_0xc557('0x44')](_0x536a9e[_0xc557('0x43')],{'$or':_[_0xc557('0x2b')](_0x39d9c7,function(_0x34a25e){if(_0x34a25e[_0xc557('0x2e')]!==_0xc557('0x45')){var _0x32a791={};_0x32a791[_0x34a25e[_0xc557('0x30')]]={'$like':'%'+_0x251e4d['query'][_0xc557('0x29')]+'%'};return _0x32a791;}})});}_0x536a9e=_['merge']({},_0x536a9e,_0x251e4d[_0xc557('0x46')]);var _0x40cb5c={'where':_0x536a9e[_0xc557('0x43')]};return db[_0xc557('0x47')]['count'](_0x40cb5c)[_0xc557('0x31')](function(_0x4eb4d6){_0x19c33f['count']=_0x4eb4d6;if(_0x251e4d['query'][_0xc557('0x48')]){_0x536a9e[_0xc557('0x49')]=[{'all':!![]}];}return db[_0xc557('0x47')][_0xc557('0x4a')](_0x536a9e);})[_0xc557('0x31')](function(_0xacac40){_0x19c33f[_0xc557('0x4b')]=_0xacac40;return _0x19c33f;})[_0xc557('0x31')](respondWithFilteredResult(_0x464f59,_0x536a9e))[_0xc557('0x4c')](handleError(_0x464f59,null));};exports[_0xc557('0x4d')]=function(_0x415f00,_0x793312){var _0x585701={'raw':![],'where':{'id':_0x415f00[_0xc557('0x4e')]['id']}},_0x1a812={};_0x1a812[_0xc557('0x3a')]=_[_0xc557('0x38')](db[_0xc557('0x47')][_0xc557('0x35')]);_0x1a812[_0xc557('0x37')]=_['keys'](_0x415f00[_0xc557('0x37')]);_0x1a812[_0xc557('0x41')]=_[_0xc557('0x39')](_0x1a812[_0xc557('0x3a')],_0x1a812[_0xc557('0x37')]);_0x585701[_0xc557('0x3b')]=_[_0xc557('0x39')](_0x1a812[_0xc557('0x3a')],qs[_0xc557('0x3c')](_0x415f00[_0xc557('0x37')][_0xc557('0x3c')]));_0x585701[_0xc557('0x3b')]=_0x585701[_0xc557('0x3b')][_0xc557('0x3d')]?_0x585701[_0xc557('0x3b')]:_0x1a812[_0xc557('0x3a')];if(_0x415f00[_0xc557('0x37')][_0xc557('0x48')]){_0x585701['include']=[{'all':!![]}];}_0x585701=_[_0xc557('0x44')]({},_0x585701,_0x415f00[_0xc557('0x46')]);return db[_0xc557('0x47')]['find'](_0x585701)['then'](handleEntityNotFound(_0x793312,null))[_0xc557('0x31')](respondWithResult(_0x793312,null))[_0xc557('0x4c')](handleError(_0x793312,null));};exports[_0xc557('0x23')]=function(_0x21f39a,_0x32e3b7){return db[_0xc557('0x47')][_0xc557('0x2f')]({'where':{'id':_0x21f39a[_0xc557('0x4e')]['id']}})[_0xc557('0x31')](handleEntityNotFound(_0x32e3b7,null))[_0xc557('0x31')](removeEntity(_0x32e3b7,null))[_0xc557('0x4c')](handleError(_0x32e3b7,null));};exports[_0xc557('0x4f')]=function(_0x5c9f3a,_0x47a822){if(_0x5c9f3a[_0xc557('0x50')][_0xc557('0x2e')]===_0xc557('0x27')&&!_[_0xc557('0x51')](_0x5c9f3a[_0xc557('0x50')]['exten'],'_')){_0x5c9f3a['body'][_0xc557('0x52')]='_'['concat'](_0x5c9f3a[_0xc557('0x50')][_0xc557('0x52')]);}return db[_0xc557('0x47')][_0xc557('0x4f')](_0x5c9f3a[_0xc557('0x50')],{'raw':![]})['then'](function(_0x436f9e){var _0x583281=_0x5c9f3a[_0xc557('0x53')][_0xc557('0x24')]({'plain':!![]});if(!_0x583281)throw new Error(_0xc557('0x54'));if(_0x583281[_0xc557('0x55')]===_0xc557('0x53')){var _0x33c842=_0x436f9e[_0xc557('0x24')]({'plain':!![]});var _0x3c5d0c=[{'name':'InboundRoutes','value':_0xc557('0x26')},{'name':_0xc557('0x56'),'value':_0xc557('0x27')},{'name':_0xc557('0x57'),'value':_0xc557('0x28')}];var _0xa733f2=_[_0xc557('0x2f')](_0x3c5d0c,['value',_0x33c842[_0xc557('0x2e')]])['name'];return db[_0xc557('0x58')][_0xc557('0x2f')]({'where':{'name':_0xa733f2,'userProfileId':_0x583281['userProfileId']},'raw':!![]})[_0xc557('0x31')](function(_0x340a4a){if(_0x340a4a&&_0x340a4a['autoAssociation']===0x0){return db['UserProfileResource'][_0xc557('0x4f')]({'name':_0x33c842['name'],'resourceId':_0x33c842['id'],'type':_0x340a4a['name'],'sectionId':_0x340a4a['id']},{})['then'](function(){return _0x436f9e;});}else{return _0x436f9e;}})[_0xc557('0x4c')](function(_0x2ac43b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ac43b);throw _0x2ac43b;});}return _0x436f9e;})[_0xc557('0x31')](respondWithResult(_0x47a822,0xc9))['catch'](handleError(_0x47a822,null));};exports[_0xc557('0x59')]=function(_0x4dc9cf,_0x31a2cc){if(_0x4dc9cf[_0xc557('0x50')]['id']){delete _0x4dc9cf[_0xc557('0x50')]['id'];}return db[_0xc557('0x47')][_0xc557('0x2f')]({'where':{'id':_0x4dc9cf[_0xc557('0x4e')]['id']}})['then'](handleEntityNotFound(_0x31a2cc,null))[_0xc557('0x31')](function(_0x4cedb1){if(_0x4cedb1){return db[_0xc557('0x47')][_0xc557('0x59')](_[_0xc557('0x42')](_0x4dc9cf[_0xc557('0x50')],['exten',_0xc557('0x5a'),'description',_0xc557('0x5b'),_0xc557('0x5c'),_0xc557('0x5d')]),{'where':{'context':_0x4cedb1[_0xc557('0x5a')],'exten':_0x4cedb1[_0xc557('0x52')]},'individualHooks':!![]})[_0xc557('0x31')](function(_0x5c0aa8){return _0x5c0aa8;});}return null;})[_0xc557('0x31')](respondWithStatusCode(_0x31a2cc,null))['catch'](handleError(_0x31a2cc,null));};exports[_0xc557('0x5e')]=function(_0x593300,_0x2108af,_0x26b641){return db[_0xc557('0x47')]['findOne']({'where':{'id':_0x593300[_0xc557('0x4e')]['id']}})[_0xc557('0x31')](handleEntityNotFound(_0x2108af,null))[_0xc557('0x31')](function(_0x1736b0){if(_0x1736b0){return db[_0xc557('0x5f')][_0xc557('0x60')](function(_0x258b7d){return db[_0xc557('0x47')][_0xc557('0x23')]({'where':{'VoiceExtensionId':_0x593300['params']['id']},'transaction':_0x258b7d})[_0xc557('0x31')](function(_0x576084){var _0x3d3557=_[_0xc557('0x2b')](_0x593300['body'],function(_0x289883){_0x289883[_0xc557('0x61')]=_0x593300[_0xc557('0x4e')]['id'];return _0x289883;});return db[_0xc557('0x47')][_0xc557('0x62')](_0x3d3557,{'transaction':_0x258b7d});});})[_0xc557('0x31')](function(){return db['VoiceExtension'][_0xc557('0x63')]({'where':{'isApp':!![],'VoiceExtensionId':_0x593300[_0xc557('0x4e')]['id']},'order':_0xc557('0x64')});});}})['then'](respondWithResult(_0x2108af,null))[_0xc557('0x4c')](handleError(_0x2108af,null));}; \ No newline at end of file +var _0x8742=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','recordingFormat','cutdigits','mandatoryDisposition','addApplications','findOne','sequelize','transaction','VoiceExtensionId','bulkCreate','findAndCountAll','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','includes','find','type','name','UserProfileResource','error','stack','rawAttributes','fieldName','key','query','intersection','attributes','model','fields','length','hasOwnProperty','limit','sort','where','filters','pick','merge','VIRTUAL','VoiceExtension','includeAll','include','findAll','rows','catch','params','keys','body','startsWith','exten','concat','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation'];(function(_0x7f8b61,_0x4fa837){var _0x16e761=function(_0x1872ee){while(--_0x1872ee){_0x7f8b61['push'](_0x7f8b61['shift']());}};_0x16e761(++_0x4fa837);}(_0x8742,0xe9));var _0x2874=function(_0x3ef63a,_0x20b5d7){_0x3ef63a=_0x3ef63a-0x0;var _0x168f26=_0x8742[_0x3ef63a];return _0x168f26;};'use strict';var pdf=require(_0x2874('0x0'));var emlformat=require(_0x2874('0x1'));var rimraf=require(_0x2874('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2874('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2874('0x4'));var Mustache=require(_0x2874('0x5'));var util=require(_0x2874('0x6'));var path=require(_0x2874('0x7'));var sox=require(_0x2874('0x8'));var csv=require(_0x2874('0x9'));var ejs=require(_0x2874('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2874('0xb'));var crypto=require(_0x2874('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2874('0xd'));var toCsv=require(_0x2874('0x9'));var querystring=require(_0x2874('0xe'));var Papa=require(_0x2874('0xf'));var Redis=require(_0x2874('0x10'));var authService=require(_0x2874('0x11'));var qs=require(_0x2874('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2874('0x13'));var logger=require(_0x2874('0x14'))(_0x2874('0x15'));var utils=require(_0x2874('0x16'));var config=require(_0x2874('0x17'));var db=require(_0x2874('0x18'))['db'];config[_0x2874('0x19')]=_[_0x2874('0x1a')](config[_0x2874('0x19')],{'host':_0x2874('0x1b'),'port':0x18eb});var socket=require(_0x2874('0x1c'))(new Redis(config[_0x2874('0x19')]));require(_0x2874('0x1d'))[_0x2874('0x1e')](socket);function respondWithStatusCode(_0x172ce5,_0x294249){_0x294249=_0x294249||0xcc;return function(_0x23ba93){if(_0x23ba93){return _0x172ce5[_0x2874('0x1f')](_0x294249);}return _0x172ce5[_0x2874('0x20')](_0x294249)[_0x2874('0x21')]();};}function respondWithResult(_0x59f353,_0x3ae330){_0x3ae330=_0x3ae330||0xc8;return function(_0x4b963c){if(_0x4b963c){return _0x59f353[_0x2874('0x20')](_0x3ae330)[_0x2874('0x22')](_0x4b963c);}};}function respondWithFilteredResult(_0x2723a6,_0x49712f){return function(_0x38a313){if(_0x38a313){var _0x4bdb0e=_0x38a313[_0x2874('0x23')],_0x37f415=_0x49712f['offset'],_0x531265=_0x49712f[_0x2874('0x24')]+_0x49712f['limit'],_0x2c37e9;if(_0x531265>=_0x4bdb0e){_0x531265=_0x4bdb0e;_0x2c37e9=0xc8;}else{_0x2c37e9=0xce;}_0x2723a6[_0x2874('0x20')](_0x2c37e9);return _0x2723a6[_0x2874('0x25')]('Content-Range',_0x37f415+'-'+_0x531265+'/'+_0x4bdb0e)[_0x2874('0x22')](_0x38a313);}return null;};}function patchUpdates(_0x2ddb25){return function(_0x56dd70){try{jsonpatch[_0x2874('0x26')](_0x56dd70,_0x2ddb25,!![]);}catch(_0x1b7efb){return BPromise[_0x2874('0x27')](_0x1b7efb);}return _0x56dd70[_0x2874('0x28')]();};}function saveUpdates(_0x15adbb,_0x4f0c9f){return function(_0x171fe1){if(_0x171fe1){return _0x171fe1[_0x2874('0x29')](_0x15adbb)['then'](function(_0x2a0e55){return _0x2a0e55;});}return null;};}function removeEntity(_0x44acb4,_0x801d5b){return function(_0x5dcd40){if(_0x5dcd40){return _0x5dcd40[_0x2874('0x2a')]()[_0x2874('0x2b')](function(){var _0x19cac2=_0x5dcd40[_0x2874('0x2c')]({'plain':!![]});var _0x480795=[{'name':_0x2874('0x2d'),'value':_0x2874('0x2e'),'ignore':![]},{'name':_0x2874('0x2f'),'value':_0x2874('0x30'),'ignore':![]},{'name':_0x2874('0x31'),'value':_0x2874('0x32'),'ignore':![]}];var _0x59019d=_(_0x480795)[_0x2874('0x33')](_0x2874('0x34'))[_0x2874('0x35')](_0x2874('0x36'))[_0x2874('0x36')]();if(_[_0x2874('0x37')](_0x59019d,_0x19cac2['type'])){return;}var _0x2c3a10=_[_0x2874('0x38')](_0x480795,['value',_0x19cac2[_0x2874('0x39')]])[_0x2874('0x3a')];return db[_0x2874('0x3b')][_0x2874('0x2a')]({'where':{'type':_0x2c3a10,'resourceId':_0x19cac2['id']}})[_0x2874('0x2b')](function(){return _0x5dcd40;});})[_0x2874('0x2b')](function(){_0x44acb4[_0x2874('0x20')](0xcc)[_0x2874('0x21')]();});}};}function handleEntityNotFound(_0x3c1f94,_0x4c33d6){return function(_0x34e0bf){if(!_0x34e0bf){_0x3c1f94[_0x2874('0x1f')](0x194);}return _0x34e0bf;};}function handleError(_0x143bfe,_0x8b08ce){_0x8b08ce=_0x8b08ce||0x1f4;return function(_0x2c6ec0){logger[_0x2874('0x3c')](_0x2c6ec0[_0x2874('0x3d')]);if(_0x2c6ec0[_0x2874('0x3a')]){delete _0x2c6ec0['name'];}_0x143bfe['status'](_0x8b08ce)['send'](_0x2c6ec0);};}exports['index']=function(_0x4b705f,_0x53f574){var _0x2a01e7={},_0x296dac={},_0x7996fc={'count':0x0,'rows':[]};var _0x2dcae4=_[_0x2874('0x35')](db['VoiceExtension'][_0x2874('0x3e')],function(_0x1a9722){return{'name':_0x1a9722[_0x2874('0x3f')],'type':_0x1a9722[_0x2874('0x39')][_0x2874('0x40')]};});_0x296dac['model']=_[_0x2874('0x35')](_0x2dcae4,_0x2874('0x3a'));_0x296dac[_0x2874('0x41')]=_['keys'](_0x4b705f[_0x2874('0x41')]);_0x296dac['filters']=_[_0x2874('0x42')](_0x296dac['model'],_0x296dac['query']);_0x2a01e7[_0x2874('0x43')]=_['intersection'](_0x296dac[_0x2874('0x44')],qs[_0x2874('0x45')](_0x4b705f[_0x2874('0x41')][_0x2874('0x45')]));_0x2a01e7[_0x2874('0x43')]=_0x2a01e7[_0x2874('0x43')][_0x2874('0x46')]?_0x2a01e7[_0x2874('0x43')]:_0x296dac['model'];if(!_0x4b705f['query'][_0x2874('0x47')]('nolimit')){_0x2a01e7[_0x2874('0x48')]=qs[_0x2874('0x48')](_0x4b705f[_0x2874('0x41')][_0x2874('0x48')]);_0x2a01e7[_0x2874('0x24')]=qs[_0x2874('0x24')](_0x4b705f[_0x2874('0x41')][_0x2874('0x24')]);}_0x2a01e7['order']=qs[_0x2874('0x49')](_0x4b705f[_0x2874('0x41')]['sort']);_0x2a01e7[_0x2874('0x4a')]=qs[_0x2874('0x4b')](_[_0x2874('0x4c')](_0x4b705f['query'],_0x296dac[_0x2874('0x4b')]));if(_0x4b705f[_0x2874('0x41')]['filter']){_0x2a01e7[_0x2874('0x4a')]=_[_0x2874('0x4d')](_0x2a01e7['where'],{'$or':_['map'](_0x2dcae4,function(_0x4d18f3){if(_0x4d18f3[_0x2874('0x39')]!==_0x2874('0x4e')){var _0x30721a={};_0x30721a[_0x4d18f3['name']]={'$like':'%'+_0x4b705f[_0x2874('0x41')][_0x2874('0x33')]+'%'};return _0x30721a;}})});}_0x2a01e7=_['merge']({},_0x2a01e7,_0x4b705f['options']);var _0x50d4b9={'where':_0x2a01e7[_0x2874('0x4a')]};return db[_0x2874('0x4f')][_0x2874('0x23')](_0x50d4b9)[_0x2874('0x2b')](function(_0x4e894f){_0x7996fc[_0x2874('0x23')]=_0x4e894f;if(_0x4b705f[_0x2874('0x41')][_0x2874('0x50')]){_0x2a01e7[_0x2874('0x51')]=[{'all':!![]}];}return db['VoiceExtension'][_0x2874('0x52')](_0x2a01e7);})[_0x2874('0x2b')](function(_0x803ccd){_0x7996fc[_0x2874('0x53')]=_0x803ccd;return _0x7996fc;})[_0x2874('0x2b')](respondWithFilteredResult(_0x53f574,_0x2a01e7))[_0x2874('0x54')](handleError(_0x53f574,null));};exports['show']=function(_0x59e18b,_0x5e528c){var _0x24fcdf={'raw':![],'where':{'id':_0x59e18b[_0x2874('0x55')]['id']}},_0x992b95={};_0x992b95[_0x2874('0x44')]=_['keys'](db[_0x2874('0x4f')][_0x2874('0x3e')]);_0x992b95[_0x2874('0x41')]=_[_0x2874('0x56')](_0x59e18b[_0x2874('0x41')]);_0x992b95[_0x2874('0x4b')]=_['intersection'](_0x992b95[_0x2874('0x44')],_0x992b95[_0x2874('0x41')]);_0x24fcdf[_0x2874('0x43')]=_[_0x2874('0x42')](_0x992b95[_0x2874('0x44')],qs[_0x2874('0x45')](_0x59e18b[_0x2874('0x41')]['fields']));_0x24fcdf[_0x2874('0x43')]=_0x24fcdf[_0x2874('0x43')]['length']?_0x24fcdf[_0x2874('0x43')]:_0x992b95[_0x2874('0x44')];if(_0x59e18b[_0x2874('0x41')][_0x2874('0x50')]){_0x24fcdf[_0x2874('0x51')]=[{'all':!![]}];}_0x24fcdf=_[_0x2874('0x4d')]({},_0x24fcdf,_0x59e18b['options']);return db['VoiceExtension'][_0x2874('0x38')](_0x24fcdf)[_0x2874('0x2b')](handleEntityNotFound(_0x5e528c,null))[_0x2874('0x2b')](respondWithResult(_0x5e528c,null))[_0x2874('0x54')](handleError(_0x5e528c,null));};exports[_0x2874('0x2a')]=function(_0x2d1ee6,_0x114832){return db[_0x2874('0x4f')]['find']({'where':{'id':_0x2d1ee6[_0x2874('0x55')]['id']}})['then'](handleEntityNotFound(_0x114832,null))[_0x2874('0x2b')](removeEntity(_0x114832,null))[_0x2874('0x54')](handleError(_0x114832,null));};exports['create']=function(_0x29b1c9,_0x14f855){if(_0x29b1c9[_0x2874('0x57')][_0x2874('0x39')]===_0x2874('0x30')&&!_[_0x2874('0x58')](_0x29b1c9[_0x2874('0x57')][_0x2874('0x59')],'_')){_0x29b1c9[_0x2874('0x57')][_0x2874('0x59')]='_'[_0x2874('0x5a')](_0x29b1c9['body'][_0x2874('0x59')]);}return db['VoiceExtension'][_0x2874('0x5b')](_0x29b1c9[_0x2874('0x57')],{'raw':![]})[_0x2874('0x2b')](function(_0x2cf945){var _0xd7a69c=_0x29b1c9['user'][_0x2874('0x2c')]({'plain':!![]});if(!_0xd7a69c)throw new Error(_0x2874('0x5c'));if(_0xd7a69c[_0x2874('0x5d')]===_0x2874('0x5e')){var _0x5adeab=_0x2cf945['get']({'plain':!![]});var _0x569f49=[{'name':_0x2874('0x2d'),'value':_0x2874('0x2e')},{'name':'OutboundRoutes','value':'outbound'},{'name':_0x2874('0x31'),'value':_0x2874('0x32')}];var _0x494fdd=_[_0x2874('0x38')](_0x569f49,[_0x2874('0x36'),_0x5adeab[_0x2874('0x39')]])[_0x2874('0x3a')];return db[_0x2874('0x5f')]['find']({'where':{'name':_0x494fdd,'userProfileId':_0xd7a69c['userProfileId']},'raw':!![]})[_0x2874('0x2b')](function(_0x4e3cbb){if(_0x4e3cbb&&_0x4e3cbb[_0x2874('0x60')]===0x0){return db['UserProfileResource'][_0x2874('0x5b')]({'name':_0x5adeab[_0x2874('0x3a')],'resourceId':_0x5adeab['id'],'type':_0x4e3cbb['name'],'sectionId':_0x4e3cbb['id']},{})['then'](function(){return _0x2cf945;});}else{return _0x2cf945;}})[_0x2874('0x54')](function(_0x1d2f5a){logger[_0x2874('0x3c')](_0x2874('0x61'),_0x1d2f5a);throw _0x1d2f5a;});}return _0x2cf945;})[_0x2874('0x2b')](respondWithResult(_0x14f855,0xc9))[_0x2874('0x54')](handleError(_0x14f855,null));};exports['update']=function(_0x3a96d1,_0x3d1a13){if(_0x3a96d1[_0x2874('0x57')]['id']){delete _0x3a96d1[_0x2874('0x57')]['id'];}return db[_0x2874('0x4f')]['find']({'where':{'id':_0x3a96d1[_0x2874('0x55')]['id']}})[_0x2874('0x2b')](handleEntityNotFound(_0x3d1a13,null))[_0x2874('0x2b')](function(_0x137e9f){if(_0x137e9f){return db[_0x2874('0x4f')]['update'](_['pick'](_0x3a96d1[_0x2874('0x57')],[_0x2874('0x59'),_0x2874('0x62'),_0x2874('0x63'),_0x2874('0x64'),_0x2874('0x65'),_0x2874('0x66')]),{'where':{'context':_0x137e9f['context'],'exten':_0x137e9f[_0x2874('0x59')]},'individualHooks':!![]})['then'](function(_0x2039d9){return _0x2039d9;});}return null;})[_0x2874('0x2b')](respondWithStatusCode(_0x3d1a13,null))[_0x2874('0x54')](handleError(_0x3d1a13,null));};exports[_0x2874('0x67')]=function(_0xe5978e,_0x4f5f02,_0xfede56){return db[_0x2874('0x4f')][_0x2874('0x68')]({'where':{'id':_0xe5978e[_0x2874('0x55')]['id']}})[_0x2874('0x2b')](handleEntityNotFound(_0x4f5f02,null))[_0x2874('0x2b')](function(_0x4cc191){if(_0x4cc191){return db[_0x2874('0x69')][_0x2874('0x6a')](function(_0x47a07b){return db[_0x2874('0x4f')]['destroy']({'where':{'VoiceExtensionId':_0xe5978e[_0x2874('0x55')]['id']},'transaction':_0x47a07b})[_0x2874('0x2b')](function(_0x115e40){var _0x1e50a4=_[_0x2874('0x35')](_0xe5978e[_0x2874('0x57')],function(_0x521efd){_0x521efd[_0x2874('0x6b')]=_0xe5978e['params']['id'];return _0x521efd;});return db['VoiceExtension'][_0x2874('0x6c')](_0x1e50a4,{'transaction':_0x47a07b});});})[_0x2874('0x2b')](function(){return db[_0x2874('0x4f')][_0x2874('0x6d')]({'where':{'isApp':!![],'VoiceExtensionId':_0xe5978e[_0x2874('0x55')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})[_0x2874('0x2b')](respondWithResult(_0x4f5f02,null))[_0x2874('0x54')](handleError(_0x4f5f02,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 9b21c43..345cc30 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 _0x18b3=['setMaxListeners','save','update','remove','emit','events','../../mysqldb'];(function(_0x3350bc,_0x1a78d5){var _0x4f2776=function(_0x95cca6){while(--_0x95cca6){_0x3350bc['push'](_0x3350bc['shift']());}};_0x4f2776(++_0x1a78d5);}(_0x18b3,0x140));var _0x318b=function(_0x101d63,_0x59e672){_0x101d63=_0x101d63-0x0;var _0x137bd8=_0x18b3[_0x101d63];return _0x137bd8;};'use strict';var EventEmitter=require(_0x318b('0x0'));var VoiceExtension=require(_0x318b('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x318b('0x2')](0x0);var events={'afterCreate':_0x318b('0x3'),'afterUpdate':_0x318b('0x4'),'afterDestroy':_0x318b('0x5')};function emitEvent(_0x1324cc){return function(_0x7344d5,_0x276242,_0x587c1d){VoiceExtensionEvents[_0x318b('0x6')](_0x1324cc+':'+_0x7344d5['id'],_0x7344d5);VoiceExtensionEvents[_0x318b('0x6')](_0x1324cc,_0x7344d5);_0x587c1d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0x66a5=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceExtension','setMaxListeners'];(function(_0x3f3ed7,_0x24ddf8){var _0x5cd280=function(_0x4e9232){while(--_0x4e9232){_0x3f3ed7['push'](_0x3f3ed7['shift']());}};_0x5cd280(++_0x24ddf8);}(_0x66a5,0x1e6));var _0x566a=function(_0x301148,_0x25b884){_0x301148=_0x301148-0x0;var _0x42ce24=_0x66a5[_0x301148];return _0x42ce24;};'use strict';var EventEmitter=require(_0x566a('0x0'));var VoiceExtension=require(_0x566a('0x1'))['db'][_0x566a('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x566a('0x3')](0x0);var events={'afterCreate':_0x566a('0x4'),'afterUpdate':'update','afterDestroy':_0x566a('0x5')};function emitEvent(_0x39569a){return function(_0x36c74e,_0x4fbd6f,_0x5e2fce){VoiceExtensionEvents[_0x566a('0x6')](_0x39569a+':'+_0x36c74e['id'],_0x36c74e);VoiceExtensionEvents[_0x566a('0x6')](_0x39569a,_0x36c74e);_0x5e2fce(null);};}for(var e in events){if(events[_0x566a('0x7')](e)){var event=events[e];VoiceExtension[_0x566a('0x8')](e,emitEvent(event));}}module[_0x566a('0x9')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 6bd84e4..366ce1a 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 _0xc219=['bluebird','request-promise','rimraf','../../config/environment','./voiceExtension.attributes','exports','VoiceExtension','lodash','util','api','moment'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0xc219,0x1d5));var _0x9c21=function(_0x3dfeb9,_0x1cc6e4){_0x3dfeb9=_0x3dfeb9-0x0;var _0x412314=_0xc219[_0x3dfeb9];return _0x412314;};'use strict';var _=require(_0x9c21('0x0'));var util=require(_0x9c21('0x1'));var logger=require('../../config/logger')(_0x9c21('0x2'));var moment=require(_0x9c21('0x3'));var BPromise=require(_0x9c21('0x4'));var rp=require(_0x9c21('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9c21('0x6'));var config=require(_0x9c21('0x7'));var attributes=require(_0x9c21('0x8'));module[_0x9c21('0x9')]=function(_0x2bceda,_0x4f3c11){return _0x2bceda['define'](_0x9c21('0xa'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f5a=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceExtension.attributes','voice_extensions','lodash','util'];(function(_0x3b6d21,_0x11d4c5){var _0x2b46f0=function(_0x467e64){while(--_0x467e64){_0x3b6d21['push'](_0x3b6d21['shift']());}};_0x2b46f0(++_0x11d4c5);}(_0x3f5a,0xcf));var _0xa3f5=function(_0x53b6ae,_0x3cb9f4){_0x53b6ae=_0x53b6ae-0x0;var _0x34f4b2=_0x3f5a[_0x53b6ae];return _0x34f4b2;};'use strict';var _=require(_0xa3f5('0x0'));var util=require(_0xa3f5('0x1'));var logger=require(_0xa3f5('0x2'))(_0xa3f5('0x3'));var moment=require('moment');var BPromise=require(_0xa3f5('0x4'));var rp=require(_0xa3f5('0x5'));var fs=require('fs');var path=require(_0xa3f5('0x6'));var rimraf=require(_0xa3f5('0x7'));var config=require(_0xa3f5('0x8'));var attributes=require(_0xa3f5('0x9'));module['exports']=function(_0x1313aa,_0x5374ba){return _0x1313aa['define']('VoiceExtension',attributes,{'tableName':_0xa3f5('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 4437768..f10f34e 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 _0x5141=['GetVoiceExtension','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','VoiceExtension','findAll','options','attributes','limit','include','map','model'];(function(_0x19534c,_0x34d3b2){var _0x4726ed=function(_0x1b47d0){while(--_0x1b47d0){_0x19534c['push'](_0x19534c['shift']());}};_0x4726ed(++_0x34d3b2);}(_0x5141,0xec));var _0x1514=function(_0x181fb6,_0x5e2e11){_0x181fb6=_0x181fb6-0x0;var _0x3441c1=_0x5141[_0x181fb6];return _0x3441c1;};'use strict';var _=require(_0x1514('0x0'));var util=require('util');var moment=require(_0x1514('0x1'));var BPromise=require(_0x1514('0x2'));var rs=require(_0x1514('0x3'));var fs=require('fs');var Redis=require(_0x1514('0x4'));var db=require(_0x1514('0x5'))['db'];var utils=require(_0x1514('0x6'));var logger=require(_0x1514('0x7'))(_0x1514('0x8'));var config=require(_0x1514('0x9'));var jayson=require(_0x1514('0xa'));var client=jayson[_0x1514('0xb')]['http']({'port':0x232a});config['redis']=_[_0x1514('0xc')](config[_0x1514('0xd')],{'host':_0x1514('0xe'),'port':0x18eb});var socket=require(_0x1514('0xf'))(new Redis(config[_0x1514('0xd')]));require('./voiceExtension.socket')[_0x1514('0x10')](socket);function respondWithRpcPromise(_0x1c63eb,_0x7a96a0,_0x39da4d){return new BPromise(function(_0x1387a5,_0x9f1d47){return client[_0x1514('0x11')](_0x1c63eb,_0x39da4d)[_0x1514('0x12')](function(_0x1936f5){logger[_0x1514('0x13')](_0x1514('0x14'),_0x7a96a0,_0x1514('0x15'));logger[_0x1514('0x16')](_0x1514('0x17'),_0x7a96a0,_0x1514('0x15'),JSON['stringify'](_0x1936f5));if(_0x1936f5[_0x1514('0x18')]){if(_0x1936f5[_0x1514('0x18')][_0x1514('0x19')]===0x1f4){logger[_0x1514('0x18')](_0x1514('0x14'),_0x7a96a0,_0x1936f5[_0x1514('0x18')]['message']);return _0x9f1d47(_0x1936f5['error'][_0x1514('0x1a')]);}logger[_0x1514('0x18')](_0x1514('0x14'),_0x7a96a0,_0x1936f5[_0x1514('0x18')][_0x1514('0x1a')]);return _0x1387a5(_0x1936f5[_0x1514('0x18')][_0x1514('0x1a')]);}else{logger['info']('VoiceExtension,\x20%s,\x20%s',_0x7a96a0,_0x1514('0x15'));_0x1387a5(_0x1936f5[_0x1514('0x1b')][_0x1514('0x1a')]);}})[_0x1514('0x1c')](function(_0x2ec05a){logger[_0x1514('0x18')](_0x1514('0x14'),_0x7a96a0,_0x2ec05a);_0x9f1d47(_0x2ec05a);});});}exports['GetVoiceExtension']=function(_0x2fab49){var _0x1414ef=this;return new Promise(function(_0xcee6c4,_0x24301d){return db[_0x1514('0x1d')][_0x1514('0x1e')]({'raw':_0x2fab49[_0x1514('0x1f')]?_0x2fab49[_0x1514('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x2fab49[_0x1514('0x1f')]?_0x2fab49[_0x1514('0x1f')]['where']||null:null,'attributes':_0x2fab49[_0x1514('0x1f')]?_0x2fab49[_0x1514('0x1f')][_0x1514('0x20')]||null:null,'limit':_0x2fab49[_0x1514('0x1f')]?_0x2fab49[_0x1514('0x1f')][_0x1514('0x21')]||null:null,'include':_0x2fab49[_0x1514('0x1f')]?_0x2fab49[_0x1514('0x1f')][_0x1514('0x22')]?_[_0x1514('0x23')](_0x2fab49[_0x1514('0x1f')][_0x1514('0x22')],function(_0x41c543){return{'model':db[_0x41c543[_0x1514('0x24')]],'as':_0x41c543['as'],'attributes':_0x41c543[_0x1514('0x20')],'include':_0x41c543[_0x1514('0x22')]?_[_0x1514('0x23')](_0x41c543[_0x1514('0x22')],function(_0x1ba213){return{'model':db[_0x1ba213['model']],'as':_0x1ba213['as'],'attributes':_0x1ba213['attributes'],'include':_0x1ba213[_0x1514('0x22')]?_[_0x1514('0x23')](_0x1ba213['include'],function(_0x117c33){return{'model':db[_0x117c33['model']],'as':_0x117c33['as'],'attributes':_0x117c33[_0x1514('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1514('0x12')](function(_0x281d22){logger['info']('GetVoiceExtension',_0x2fab49);logger[_0x1514('0x16')](_0x1514('0x25'),_0x2fab49,JSON[_0x1514('0x26')](_0x281d22));_0xcee6c4(_0x281d22);})[_0x1514('0x1c')](function(_0x5552be){logger[_0x1514('0x18')]('GetVoiceExtension',_0x5552be[_0x1514('0x1a')],_0x2fab49);_0x24301d(_0x1414ef[_0x1514('0x18')](0x1f4,_0x5552be['message']));});});}; \ No newline at end of file +var _0xcb9d=['VoiceExtension,\x20%s,\x20%s','message','result','VoiceExtension','options','where','attributes','limit','include','map','model','GetVoiceExtension','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','redis','./voiceExtension.socket','register','then','info','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xcb9d,0xa5));var _0xdcb9=function(_0x2ec073,_0x7f954a){_0x2ec073=_0x2ec073-0x0;var _0x257215=_0xcb9d[_0x2ec073];return _0x257215;};'use strict';var _=require(_0xdcb9('0x0'));var util=require('util');var moment=require(_0xdcb9('0x1'));var BPromise=require(_0xdcb9('0x2'));var rs=require(_0xdcb9('0x3'));var fs=require('fs');var Redis=require(_0xdcb9('0x4'));var db=require(_0xdcb9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdcb9('0x6'))(_0xdcb9('0x7'));var config=require(_0xdcb9('0x8'));var jayson=require(_0xdcb9('0x9'));var client=jayson[_0xdcb9('0xa')][_0xdcb9('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xdcb9('0xc'),'port':0x18eb});var socket=require(_0xdcb9('0xd'))(new Redis(config[_0xdcb9('0xe')]));require(_0xdcb9('0xf'))[_0xdcb9('0x10')](socket);function respondWithRpcPromise(_0x2371c7,_0x22cba2,_0x22a858){return new BPromise(function(_0x22dec7,_0x527415){return client['request'](_0x2371c7,_0x22a858)[_0xdcb9('0x11')](function(_0x2c4cab){logger[_0xdcb9('0x12')]('VoiceExtension,\x20%s,\x20%s',_0x22cba2,'request\x20sent');logger[_0xdcb9('0x13')](_0xdcb9('0x14'),_0x22cba2,_0xdcb9('0x15'),JSON[_0xdcb9('0x16')](_0x2c4cab));if(_0x2c4cab[_0xdcb9('0x17')]){if(_0x2c4cab[_0xdcb9('0x17')][_0xdcb9('0x18')]===0x1f4){logger[_0xdcb9('0x17')](_0xdcb9('0x19'),_0x22cba2,_0x2c4cab['error'][_0xdcb9('0x1a')]);return _0x527415(_0x2c4cab[_0xdcb9('0x17')][_0xdcb9('0x1a')]);}logger[_0xdcb9('0x17')](_0xdcb9('0x19'),_0x22cba2,_0x2c4cab['error']['message']);return _0x22dec7(_0x2c4cab[_0xdcb9('0x17')][_0xdcb9('0x1a')]);}else{logger[_0xdcb9('0x12')](_0xdcb9('0x19'),_0x22cba2,'request\x20sent');_0x22dec7(_0x2c4cab[_0xdcb9('0x1b')][_0xdcb9('0x1a')]);}})['catch'](function(_0x258eac){logger[_0xdcb9('0x17')]('VoiceExtension,\x20%s,\x20%s',_0x22cba2,_0x258eac);_0x527415(_0x258eac);});});}exports['GetVoiceExtension']=function(_0x1f2cd0){var _0x345f94=this;return new Promise(function(_0x34199f,_0x3b4ebb){return db[_0xdcb9('0x1c')]['findAll']({'raw':_0x1f2cd0[_0xdcb9('0x1d')]?_0x1f2cd0['options']['raw']===undefined?!![]:![]:!![],'where':_0x1f2cd0[_0xdcb9('0x1d')]?_0x1f2cd0[_0xdcb9('0x1d')][_0xdcb9('0x1e')]||null:null,'attributes':_0x1f2cd0[_0xdcb9('0x1d')]?_0x1f2cd0[_0xdcb9('0x1d')][_0xdcb9('0x1f')]||null:null,'limit':_0x1f2cd0[_0xdcb9('0x1d')]?_0x1f2cd0[_0xdcb9('0x1d')][_0xdcb9('0x20')]||null:null,'include':_0x1f2cd0[_0xdcb9('0x1d')]?_0x1f2cd0[_0xdcb9('0x1d')][_0xdcb9('0x21')]?_[_0xdcb9('0x22')](_0x1f2cd0[_0xdcb9('0x1d')][_0xdcb9('0x21')],function(_0x2156f4){return{'model':db[_0x2156f4[_0xdcb9('0x23')]],'as':_0x2156f4['as'],'attributes':_0x2156f4[_0xdcb9('0x1f')],'include':_0x2156f4[_0xdcb9('0x21')]?_[_0xdcb9('0x22')](_0x2156f4[_0xdcb9('0x21')],function(_0x539b42){return{'model':db[_0x539b42['model']],'as':_0x539b42['as'],'attributes':_0x539b42['attributes'],'include':_0x539b42[_0xdcb9('0x21')]?_[_0xdcb9('0x22')](_0x539b42[_0xdcb9('0x21')],function(_0x4caeab){return{'model':db[_0x4caeab['model']],'as':_0x4caeab['as'],'attributes':_0x4caeab[_0xdcb9('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xdcb9('0x11')](function(_0x49b463){logger[_0xdcb9('0x12')](_0xdcb9('0x24'),_0x1f2cd0);logger[_0xdcb9('0x13')](_0xdcb9('0x24'),_0x1f2cd0,JSON['stringify'](_0x49b463));_0x34199f(_0x49b463);})[_0xdcb9('0x25')](function(_0x50f17d){logger[_0xdcb9('0x17')]('GetVoiceExtension',_0x50f17d[_0xdcb9('0x1a')],_0x1f2cd0);_0x3b4ebb(_0x345f94[_0xdcb9('0x17')](0x1f4,_0x50f17d[_0xdcb9('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index be7d21a..527583b 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 _0x686e=['remove','update','emit','removeListener','register','./voiceExtension.events','save'];(function(_0x36d462,_0x143bdd){var _0x25a313=function(_0x34f576){while(--_0x34f576){_0x36d462['push'](_0x36d462['shift']());}};_0x25a313(++_0x143bdd);}(_0x686e,0x1cc));var _0xe686=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x686e[_0x3dd15e];return _0x231fd0;};'use strict';var VoiceExtensionEvents=require(_0xe686('0x0'));var events=[_0xe686('0x1'),_0xe686('0x2'),_0xe686('0x3')];function createListener(_0x2c888f,_0x5dde52){return function(_0xc74796){_0x5dde52[_0xe686('0x4')](_0x2c888f,_0xc74796);};}function removeListener(_0x4b09bb,_0x1e60e4){return function(){VoiceExtensionEvents[_0xe686('0x5')](_0x4b09bb,_0x1e60e4);};}exports[_0xe686('0x6')]=function(_0xbc160a){for(var _0x54df8a=0x0,_0x2119fa=events['length'];_0x54df8a<_0x2119fa;_0x54df8a++){var _0x46f010=events[_0x54df8a];var _0x158f85=createListener('voiceExtension:'+_0x46f010,_0xbc160a);VoiceExtensionEvents['on'](_0x46f010,_0x158f85);}}; \ No newline at end of file +var _0xf7d7=['removeListener','register','length','voiceExtension:','./voiceExtension.events','save','remove','update'];(function(_0x1a0e6a,_0x1b43de){var _0x4b3934=function(_0x81dc97){while(--_0x81dc97){_0x1a0e6a['push'](_0x1a0e6a['shift']());}};_0x4b3934(++_0x1b43de);}(_0xf7d7,0x1b4));var _0x7f7d=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0xf7d7[_0x599e60];return _0x468e19;};'use strict';var VoiceExtensionEvents=require(_0x7f7d('0x0'));var events=[_0x7f7d('0x1'),_0x7f7d('0x2'),_0x7f7d('0x3')];function createListener(_0x3a6e3a,_0x1ea541){return function(_0x3bc611){_0x1ea541['emit'](_0x3a6e3a,_0x3bc611);};}function removeListener(_0x3fdfa2,_0x92393c){return function(){VoiceExtensionEvents[_0x7f7d('0x4')](_0x3fdfa2,_0x92393c);};}exports[_0x7f7d('0x5')]=function(_0x990bd0){for(var _0x7ea1b5=0x0,_0x5aba25=events[_0x7f7d('0x6')];_0x7ea1b5<_0x5aba25;_0x7ea1b5++){var _0x55b227=events[_0x7ea1b5];var _0x48420d=createListener(_0x7f7d('0x7')+_0x55b227,_0x990bd0);VoiceExtensionEvents['on'](_0x55b227,_0x48420d);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 5b2dfba..636fb4a 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 _0xd235=['../../components/interaction/service','../../config/environment','./voiceMail.controller','get','index','isAuthenticated','/:id/messages','getMessages','post','create','put','/:id','update','delete','destroy','exports','path','Router','../../components/auth/service'];(function(_0x123a99,_0x5f0db9){var _0x3ba390=function(_0x148f3f){while(--_0x148f3f){_0x123a99['push'](_0x123a99['shift']());}};_0x3ba390(++_0x5f0db9);}(_0xd235,0x179));var _0x5d23=function(_0xcf8b0c,_0xeedcc5){_0xcf8b0c=_0xcf8b0c-0x0;var _0x8dad63=_0xd235[_0xcf8b0c];return _0x8dad63;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5d23('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5d23('0x1')]();var auth=require(_0x5d23('0x2'));var interaction=require(_0x5d23('0x3'));var config=require(_0x5d23('0x4'));var controller=require(_0x5d23('0x5'));router[_0x5d23('0x6')]('/',auth['isAuthenticated'](),controller[_0x5d23('0x7')]);router[_0x5d23('0x6')]('/:id',auth[_0x5d23('0x8')](),controller['show']);router['get'](_0x5d23('0x9'),auth['isAuthenticated'](),controller[_0x5d23('0xa')]);router[_0x5d23('0xb')]('/',auth[_0x5d23('0x8')](),controller[_0x5d23('0xc')]);router[_0x5d23('0xd')](_0x5d23('0xe'),auth[_0x5d23('0x8')](),controller[_0x5d23('0xf')]);router[_0x5d23('0x10')](_0x5d23('0xe'),auth[_0x5d23('0x8')](),controller[_0x5d23('0x11')]);module[_0x5d23('0x12')]=router; \ No newline at end of file +var _0xdee7=['get','/:id','show','getMessages','post','create','put','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdee7,0x17f));var _0x7dee=function(_0x28352f,_0x44201f){_0x28352f=_0x28352f-0x0;var _0x4c1df5=_0xdee7[_0x28352f];return _0x4c1df5;};'use strict';var multer=require(_0x7dee('0x0'));var util=require(_0x7dee('0x1'));var path=require(_0x7dee('0x2'));var timeout=require(_0x7dee('0x3'));var express=require('express');var router=express[_0x7dee('0x4')]();var auth=require(_0x7dee('0x5'));var interaction=require(_0x7dee('0x6'));var config=require('../../config/environment');var controller=require('./voiceMail.controller');router['get']('/',auth[_0x7dee('0x7')](),controller['index']);router[_0x7dee('0x8')](_0x7dee('0x9'),auth[_0x7dee('0x7')](),controller[_0x7dee('0xa')]);router[_0x7dee('0x8')]('/:id/messages',auth[_0x7dee('0x7')](),controller[_0x7dee('0xb')]);router[_0x7dee('0xc')]('/',auth[_0x7dee('0x7')](),controller[_0x7dee('0xd')]);router[_0x7dee('0xe')](_0x7dee('0x9'),auth[_0x7dee('0x7')](),controller['update']);router[_0x7dee('0xf')]('/:id',auth[_0x7dee('0x7')](),controller['destroy']);module[_0x7dee('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 0fa1296..47905e2 100644 --- a/server/api/voiceMail/voiceMail.attributes.js +++ b/server/api/voiceMail/voiceMail.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda3f=['fullname','\x20-\x20','exports','STRING','setDataValue','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue'];(function(_0x49dfcc,_0x5da5e6){var _0x37a3d4=function(_0x4bf80f){while(--_0x4bf80f){_0x49dfcc['push'](_0x49dfcc['shift']());}};_0x37a3d4(++_0x5da5e6);}(_0xda3f,0xec));var _0xfda3=function(_0x34f41c,_0x1ebe12){_0x34f41c=_0x34f41c-0x0;var _0x58561b=_0xda3f[_0x34f41c];return _0x58561b;};'use strict';var Sequelize=require('sequelize');module[_0xfda3('0x0')]={'customer_id':{'type':Sequelize[_0xfda3('0x1')]},'context':{'type':Sequelize['STRING'],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xfda3('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0xfda3('0x1')]},'fullname':{'type':Sequelize[_0xfda3('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x42bd74){this[_0xfda3('0x2')]('email',typeof _0x42bd74==='string'&&_0x42bd74[_0xfda3('0x3')]()?_0x42bd74[_0xfda3('0x3')]():null);}},'pager':{'type':Sequelize[_0xfda3('0x1')]},'tz':{'type':Sequelize[_0xfda3('0x1')],'defaultValue':_0xfda3('0x4')},'attach':{'type':Sequelize[_0xfda3('0x5')](_0xfda3('0x6'),'no'),'defaultValue':_0xfda3('0x6'),'allowNull':![]},'saycid':{'type':Sequelize[_0xfda3('0x5')](_0xfda3('0x6'),'no'),'defaultValue':_0xfda3('0x6'),'allowNull':![]},'dialout':{'type':Sequelize[_0xfda3('0x1')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0xfda3('0x5')](_0xfda3('0x6'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xfda3('0x5')](_0xfda3('0x6'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xfda3('0x5')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xfda3('0x5')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xfda3('0x7'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xfda3('0x5')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xfda3('0x5')](_0xfda3('0x6'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xfda3('0x5')](_0xfda3('0x6'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xfda3('0x5')](_0xfda3('0x6'),'no'),'defaultValue':_0xfda3('0x6'),'allowNull':![]},'stamp':{'type':_0xfda3('0x8')},'emailsubject':{'type':Sequelize[_0xfda3('0x1')]},'emailbody':{'type':Sequelize[_0xfda3('0x1')]},'maxsecs':{'type':Sequelize[_0xfda3('0x9')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xfda3('0x9')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xfda3('0xa')](_0xfda3('0xb'))+_0xfda3('0xc')+this[_0xfda3('0xa')]('mailbox');}}}; \ No newline at end of file +var _0x0713=['trim','central','ENUM','yes','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','STRING','from-voicemail','contest_mailbox','setDataValue','email','string'];(function(_0x1cfc39,_0x15adef){var _0x1ae59b=function(_0x153274){while(--_0x153274){_0x1cfc39['push'](_0x1cfc39['shift']());}};_0x1ae59b(++_0x15adef);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'customer_id':{'type':Sequelize[_0x3071('0x0')]},'context':{'type':Sequelize[_0x3071('0x0')],'defaultValue':_0x3071('0x1'),'unique':_0x3071('0x2')},'mailbox':{'type':Sequelize[_0x3071('0x0')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x3071('0x0')]},'fullname':{'type':Sequelize[_0x3071('0x0')]},'email':{'type':Sequelize[_0x3071('0x0')],'validate':{'isEmail':!![]},'set':function(_0x3137c8){this[_0x3071('0x3')](_0x3071('0x4'),typeof _0x3137c8===_0x3071('0x5')&&_0x3137c8[_0x3071('0x6')]()?_0x3137c8[_0x3071('0x6')]():null);}},'pager':{'type':Sequelize[_0x3071('0x0')]},'tz':{'type':Sequelize[_0x3071('0x0')],'defaultValue':_0x3071('0x7')},'attach':{'type':Sequelize[_0x3071('0x8')]('yes','no'),'defaultValue':_0x3071('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':_0x3071('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x3071('0x0')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x3071('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x3071('0x9'),'no'),'defaultValue':_0x3071('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':_0x3071('0x9'),'allowNull':![]},'stamp':{'type':_0x3071('0xa')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x3071('0x0')]},'maxsecs':{'type':Sequelize[_0x3071('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x3071('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x3071('0xc')],'get':function(){return this[_0x3071('0xd')](_0x3071('0xe'))+_0x3071('0xf')+this[_0x3071('0xd')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index e13b95c..f7513ae 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 _0x6ae1=['userProfileId','autoAssociation','create','update','getMessages','findOne','mailbox','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','end','status','count','offset','limit','apply','reject','save','destroy','then','Voicemails','UserProfileResource','sendStatus','error','name','index','map','VoiceMail','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','show','params','includeAll','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection'];(function(_0x20cf03,_0x1dc823){var _0x32c818=function(_0x4005b5){while(--_0x4005b5){_0x20cf03['push'](_0x20cf03['shift']());}};_0x32c818(++_0x1dc823);}(_0x6ae1,0x15f));var _0x16ae=function(_0x2400fd,_0xaf87c){_0x2400fd=_0x2400fd-0x0;var _0xb28b3f=_0x6ae1[_0x2400fd];return _0xb28b3f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x16ae('0x0'));var rimraf=require(_0x16ae('0x1'));var zipdir=require(_0x16ae('0x2'));var jsonpatch=require(_0x16ae('0x3'));var rp=require(_0x16ae('0x4'));var moment=require(_0x16ae('0x5'));var BPromise=require(_0x16ae('0x6'));var Mustache=require(_0x16ae('0x7'));var util=require(_0x16ae('0x8'));var path=require(_0x16ae('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x16ae('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x16ae('0xb'));var crypto=require(_0x16ae('0xc'));var jsforce=require(_0x16ae('0xd'));var deskjs=require(_0x16ae('0xe'));var toCsv=require(_0x16ae('0xf'));var querystring=require(_0x16ae('0x10'));var Papa=require(_0x16ae('0x11'));var Redis=require(_0x16ae('0x12'));var authService=require(_0x16ae('0x13'));var qs=require(_0x16ae('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x16ae('0x15'));var logger=require(_0x16ae('0x16'))(_0x16ae('0x17'));var utils=require('../../config/utils');var config=require(_0x16ae('0x18'));var db=require(_0x16ae('0x19'))['db'];function respondWithStatusCode(_0x545000,_0x38c19a){_0x38c19a=_0x38c19a||0xcc;return function(_0x419cfb){if(_0x419cfb){return _0x545000['sendStatus'](_0x38c19a);}return _0x545000['status'](_0x38c19a)[_0x16ae('0x1a')]();};}function respondWithResult(_0xa218ed,_0x3e897d){_0x3e897d=_0x3e897d||0xc8;return function(_0xd42159){if(_0xd42159){return _0xa218ed[_0x16ae('0x1b')](_0x3e897d)['json'](_0xd42159);}};}function respondWithFilteredResult(_0x3685ad,_0x4bae92){return function(_0x4a547f){if(_0x4a547f){var _0x4a9f19=_0x4a547f[_0x16ae('0x1c')],_0x2fb040=_0x4bae92['offset'],_0x3d3404=_0x4bae92[_0x16ae('0x1d')]+_0x4bae92[_0x16ae('0x1e')],_0x3d59e4;if(_0x3d3404>=_0x4a9f19){_0x3d3404=_0x4a9f19;_0x3d59e4=0xc8;}else{_0x3d59e4=0xce;}_0x3685ad[_0x16ae('0x1b')](_0x3d59e4);return _0x3685ad['set']('Content-Range',_0x2fb040+'-'+_0x3d3404+'/'+_0x4a9f19)['json'](_0x4a547f);}return null;};}function patchUpdates(_0x2dbf69){return function(_0x57752e){try{jsonpatch[_0x16ae('0x1f')](_0x57752e,_0x2dbf69,!![]);}catch(_0xb129d2){return BPromise[_0x16ae('0x20')](_0xb129d2);}return _0x57752e[_0x16ae('0x21')]();};}function saveUpdates(_0x49608f,_0x56b3ae){return function(_0x642258){if(_0x642258){return _0x642258['update'](_0x49608f)['then'](function(_0x37e761){return _0x37e761;});}return null;};}function removeEntity(_0x4d3397,_0x3c19da){return function(_0x5df98c){if(_0x5df98c){return _0x5df98c[_0x16ae('0x22')]()[_0x16ae('0x23')](function(){var _0x5b19db=_0x5df98c['get']({'plain':!![]});var _0x1f3942=_0x16ae('0x24');return db[_0x16ae('0x25')][_0x16ae('0x22')]({'where':{'type':_0x1f3942,'resourceId':_0x5b19db['id']}})[_0x16ae('0x23')](function(){return _0x5df98c;});})[_0x16ae('0x23')](function(){_0x4d3397['status'](0xcc)[_0x16ae('0x1a')]();});}};}function handleEntityNotFound(_0x4ded60,_0x504a67){return function(_0x547371){if(!_0x547371){_0x4ded60[_0x16ae('0x26')](0x194);}return _0x547371;};}function handleError(_0x1e35dd,_0x2e06c2){_0x2e06c2=_0x2e06c2||0x1f4;return function(_0x28fa5f){logger[_0x16ae('0x27')](_0x28fa5f['stack']);if(_0x28fa5f[_0x16ae('0x28')]){delete _0x28fa5f[_0x16ae('0x28')];}_0x1e35dd['status'](_0x2e06c2)['send'](_0x28fa5f);};}exports[_0x16ae('0x29')]=function(_0x3d0ac3,_0x549c22){var _0x577c80={},_0x34aa72={},_0x33ea4b={'count':0x0,'rows':[]};var _0x3680ea=_[_0x16ae('0x2a')](db[_0x16ae('0x2b')][_0x16ae('0x2c')],function(_0x335dba){return{'name':_0x335dba[_0x16ae('0x2d')],'type':_0x335dba[_0x16ae('0x2e')][_0x16ae('0x2f')]};});_0x34aa72['model']=_[_0x16ae('0x2a')](_0x3680ea,'name');_0x34aa72[_0x16ae('0x30')]=_[_0x16ae('0x31')](_0x3d0ac3['query']);_0x34aa72[_0x16ae('0x32')]=_[_0x16ae('0x33')](_0x34aa72[_0x16ae('0x34')],_0x34aa72[_0x16ae('0x30')]);_0x577c80[_0x16ae('0x35')]=_['intersection'](_0x34aa72[_0x16ae('0x34')],qs[_0x16ae('0x36')](_0x3d0ac3[_0x16ae('0x30')][_0x16ae('0x36')]));_0x577c80['attributes']=_0x577c80['attributes'][_0x16ae('0x37')]?_0x577c80[_0x16ae('0x35')]:_0x34aa72[_0x16ae('0x34')];if(!_0x3d0ac3[_0x16ae('0x30')][_0x16ae('0x38')](_0x16ae('0x39'))){_0x577c80[_0x16ae('0x1e')]=qs[_0x16ae('0x1e')](_0x3d0ac3[_0x16ae('0x30')][_0x16ae('0x1e')]);_0x577c80[_0x16ae('0x1d')]=qs[_0x16ae('0x1d')](_0x3d0ac3['query'][_0x16ae('0x1d')]);}_0x577c80[_0x16ae('0x3a')]=qs[_0x16ae('0x3b')](_0x3d0ac3['query']['sort']);_0x577c80[_0x16ae('0x3c')]=qs[_0x16ae('0x32')](_[_0x16ae('0x3d')](_0x3d0ac3['query'],_0x34aa72[_0x16ae('0x32')]));if(_0x3d0ac3[_0x16ae('0x30')][_0x16ae('0x3e')]){_0x577c80[_0x16ae('0x3c')]=_[_0x16ae('0x3f')](_0x577c80[_0x16ae('0x3c')],{'$or':_[_0x16ae('0x2a')](_0x3680ea,function(_0x77af5b){if(_0x77af5b[_0x16ae('0x2e')]!==_0x16ae('0x40')){var _0x2be4fc={};_0x2be4fc[_0x77af5b[_0x16ae('0x28')]]={'$like':'%'+_0x3d0ac3['query'][_0x16ae('0x3e')]+'%'};return _0x2be4fc;}})});}_0x577c80=_[_0x16ae('0x3f')]({},_0x577c80,_0x3d0ac3[_0x16ae('0x41')]);var _0x477378={'where':_0x577c80[_0x16ae('0x3c')]};return db[_0x16ae('0x2b')][_0x16ae('0x1c')](_0x477378)[_0x16ae('0x23')](function(_0x2db005){_0x33ea4b[_0x16ae('0x1c')]=_0x2db005;if(_0x3d0ac3[_0x16ae('0x30')]['includeAll']){_0x577c80[_0x16ae('0x42')]=[{'all':!![]}];}return db[_0x16ae('0x2b')]['findAll'](_0x577c80);})[_0x16ae('0x23')](function(_0x1bb1d5){_0x33ea4b[_0x16ae('0x43')]=_0x1bb1d5;return _0x33ea4b;})[_0x16ae('0x23')](respondWithFilteredResult(_0x549c22,_0x577c80))['catch'](handleError(_0x549c22,null));};exports[_0x16ae('0x44')]=function(_0x1e2fcd,_0x30a88e){var _0x254616={'raw':!![],'where':{'id':_0x1e2fcd[_0x16ae('0x45')]['id']}},_0x44bcab={};_0x44bcab[_0x16ae('0x34')]=_[_0x16ae('0x31')](db[_0x16ae('0x2b')][_0x16ae('0x2c')]);_0x44bcab[_0x16ae('0x30')]=_[_0x16ae('0x31')](_0x1e2fcd['query']);_0x44bcab[_0x16ae('0x32')]=_['intersection'](_0x44bcab[_0x16ae('0x34')],_0x44bcab[_0x16ae('0x30')]);_0x254616['attributes']=_[_0x16ae('0x33')](_0x44bcab[_0x16ae('0x34')],qs['fields'](_0x1e2fcd[_0x16ae('0x30')]['fields']));_0x254616[_0x16ae('0x35')]=_0x254616[_0x16ae('0x35')][_0x16ae('0x37')]?_0x254616[_0x16ae('0x35')]:_0x44bcab['model'];if(_0x1e2fcd['query'][_0x16ae('0x46')]){_0x254616['include']=[{'all':!![]}];}_0x254616=_['merge']({},_0x254616,_0x1e2fcd[_0x16ae('0x41')]);return db[_0x16ae('0x2b')][_0x16ae('0x47')](_0x254616)[_0x16ae('0x23')](handleEntityNotFound(_0x30a88e,null))[_0x16ae('0x23')](respondWithResult(_0x30a88e,null))[_0x16ae('0x48')](handleError(_0x30a88e,null));};exports['create']=function(_0x3967a3,_0x156d25){return db[_0x16ae('0x2b')]['create'](_0x3967a3[_0x16ae('0x49')],{})['then'](function(_0x540313){var _0x57fb23=_0x3967a3[_0x16ae('0x4a')]['get']({'plain':!![]});if(!_0x57fb23)throw new Error(_0x16ae('0x4b'));if(_0x57fb23[_0x16ae('0x4c')]===_0x16ae('0x4a')){var _0x4bd355=_0x540313[_0x16ae('0x4d')]({'plain':!![]});var _0x85ac6f=_0x16ae('0x24');return db[_0x16ae('0x4e')][_0x16ae('0x47')]({'where':{'name':_0x85ac6f,'userProfileId':_0x57fb23[_0x16ae('0x4f')]},'raw':!![]})[_0x16ae('0x23')](function(_0x4990da){if(_0x4990da&&_0x4990da[_0x16ae('0x50')]===0x0){return db[_0x16ae('0x25')][_0x16ae('0x51')]({'name':_0x4bd355[_0x16ae('0x28')],'resourceId':_0x4bd355['id'],'type':_0x4990da[_0x16ae('0x28')],'sectionId':_0x4990da['id']},{})[_0x16ae('0x23')](function(){return _0x540313;});}else{return _0x540313;}})[_0x16ae('0x48')](function(_0x31f712){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x31f712);throw _0x31f712;});}return _0x540313;})[_0x16ae('0x23')](respondWithResult(_0x156d25,0xc9))[_0x16ae('0x48')](handleError(_0x156d25,null));};exports[_0x16ae('0x52')]=function(_0x1f1be7,_0x48bf76){if(_0x1f1be7[_0x16ae('0x49')]['id']){delete _0x1f1be7[_0x16ae('0x49')]['id'];}return db[_0x16ae('0x2b')][_0x16ae('0x47')]({'where':{'id':_0x1f1be7[_0x16ae('0x45')]['id']}})[_0x16ae('0x23')](handleEntityNotFound(_0x48bf76,null))['then'](saveUpdates(_0x1f1be7[_0x16ae('0x49')],null))[_0x16ae('0x23')](respondWithResult(_0x48bf76,null))['catch'](handleError(_0x48bf76,null));};exports[_0x16ae('0x22')]=function(_0x13233e,_0x4cf3ba){return db[_0x16ae('0x2b')][_0x16ae('0x47')]({'where':{'id':_0x13233e[_0x16ae('0x45')]['id']}})[_0x16ae('0x23')](handleEntityNotFound(_0x4cf3ba,null))[_0x16ae('0x23')](removeEntity(_0x4cf3ba,null))[_0x16ae('0x48')](handleError(_0x4cf3ba,null));};exports[_0x16ae('0x53')]=function(_0x2d2e3a,_0x4c2275,_0x4d1bcf){return db['VoiceMail'][_0x16ae('0x54')]({'where':{'id':_0x2d2e3a[_0x16ae('0x45')]['id']}})[_0x16ae('0x23')](handleEntityNotFound(_0x4c2275,null))[_0x16ae('0x23')](function(_0x16e4e2){var _0x31e585;var _0x399618={},_0x559151={};_0x559151[_0x16ae('0x34')]=_[_0x16ae('0x31')](db['VoiceMailMessage'][_0x16ae('0x2c')]);_0x559151[_0x16ae('0x30')]=_[_0x16ae('0x31')](_0x2d2e3a['query']);_0x559151[_0x16ae('0x32')]=_[_0x16ae('0x33')](_0x559151[_0x16ae('0x34')],_0x559151[_0x16ae('0x30')]);_0x399618['attributes']=_[_0x16ae('0x33')](_0x559151[_0x16ae('0x34')],qs[_0x16ae('0x36')](_0x2d2e3a[_0x16ae('0x30')][_0x16ae('0x36')]));_0x399618[_0x16ae('0x35')]=_0x399618['attributes']['length']?_0x399618[_0x16ae('0x35')]:_0x559151['model'];if(!_0x2d2e3a[_0x16ae('0x30')][_0x16ae('0x38')](_0x16ae('0x39'))){_0x399618['limit']=qs[_0x16ae('0x1e')](_0x2d2e3a[_0x16ae('0x30')][_0x16ae('0x1e')]);_0x399618[_0x16ae('0x1d')]=qs[_0x16ae('0x1d')](_0x2d2e3a[_0x16ae('0x30')][_0x16ae('0x1d')]);}_0x399618['order']=qs[_0x16ae('0x3b')](_0x2d2e3a[_0x16ae('0x30')]['sort']);_0x399618[_0x16ae('0x3c')]=qs[_0x16ae('0x32')](_[_0x16ae('0x3d')](_0x2d2e3a['query'],_0x559151['filters']));if(_0x2d2e3a[_0x16ae('0x30')][_0x16ae('0x3e')]){_0x399618[_0x16ae('0x3c')]=_[_0x16ae('0x3f')](_0x399618[_0x16ae('0x3c')],{'$or':_[_0x16ae('0x2a')](_0x399618[_0x16ae('0x35')],function(_0x171662){var _0x3f269b={};_0x3f269b[_0x171662]={'$like':'%'+_0x2d2e3a[_0x16ae('0x30')][_0x16ae('0x3e')]+'%'};return _0x3f269b;})});}_0x399618[_0x16ae('0x3c')]=_['merge'](_0x399618[_0x16ae('0x3c')],{'mailboxuser':_0x16e4e2[_0x16ae('0x55')]});_0x399618=_['merge']({},_0x399618,_0x2d2e3a[_0x16ae('0x41')]);return db['VoiceMailMessage']['findAndCountAll'](_0x399618)[_0x16ae('0x23')](respondWithFilteredResult(_0x4c2275,_0x399618));})['catch'](handleError(_0x4c2275,null));}; \ No newline at end of file +var _0x1058=['../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','map','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceMail','include','findAll','rows','catch','show','params','length','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMessages','VoiceMailMessage','rawAttributes','hasOwnProperty','mailbox','findAndCountAll','html-pdf','eml-format','fast-json-patch','request-promise','util','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x1058,0x148));var _0x8105=function(_0x19ceff,_0x1ced4d){_0x19ceff=_0x19ceff-0x0;var _0x276715=_0x1058[_0x19ceff];return _0x276715;};'use strict';var pdf=require(_0x8105('0x0'));var emlformat=require(_0x8105('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8105('0x2'));var rp=require(_0x8105('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8105('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x8105('0x5'));var ejs=require(_0x8105('0x6'));var fs=require('fs');var _=require(_0x8105('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8105('0x8'));var deskjs=require(_0x8105('0x9'));var toCsv=require(_0x8105('0x5'));var querystring=require(_0x8105('0xa'));var Papa=require(_0x8105('0xb'));var Redis=require(_0x8105('0xc'));var authService=require(_0x8105('0xd'));var qs=require(_0x8105('0xe'));var as=require(_0x8105('0xf'));var hardwareService=require(_0x8105('0x10'));var logger=require('../../config/logger')(_0x8105('0x11'));var utils=require(_0x8105('0x12'));var config=require(_0x8105('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc0420,_0x3868c0){_0x3868c0=_0x3868c0||0xcc;return function(_0x14534f){if(_0x14534f){return _0xc0420[_0x8105('0x14')](_0x3868c0);}return _0xc0420[_0x8105('0x15')](_0x3868c0)[_0x8105('0x16')]();};}function respondWithResult(_0x208b0e,_0x1dba3d){_0x1dba3d=_0x1dba3d||0xc8;return function(_0x5536b7){if(_0x5536b7){return _0x208b0e[_0x8105('0x15')](_0x1dba3d)[_0x8105('0x17')](_0x5536b7);}};}function respondWithFilteredResult(_0x384153,_0x36fb50){return function(_0x1e5889){if(_0x1e5889){var _0x403bdc=_0x1e5889[_0x8105('0x18')],_0x122882=_0x36fb50[_0x8105('0x19')],_0x156c54=_0x36fb50[_0x8105('0x19')]+_0x36fb50[_0x8105('0x1a')],_0x55edf5;if(_0x156c54>=_0x403bdc){_0x156c54=_0x403bdc;_0x55edf5=0xc8;}else{_0x55edf5=0xce;}_0x384153[_0x8105('0x15')](_0x55edf5);return _0x384153[_0x8105('0x1b')](_0x8105('0x1c'),_0x122882+'-'+_0x156c54+'/'+_0x403bdc)[_0x8105('0x17')](_0x1e5889);}return null;};}function patchUpdates(_0x116561){return function(_0x55e202){try{jsonpatch[_0x8105('0x1d')](_0x55e202,_0x116561,!![]);}catch(_0x3e1a16){return BPromise[_0x8105('0x1e')](_0x3e1a16);}return _0x55e202[_0x8105('0x1f')]();};}function saveUpdates(_0x205350,_0x3639e2){return function(_0x1b8bf9){if(_0x1b8bf9){return _0x1b8bf9[_0x8105('0x20')](_0x205350)[_0x8105('0x21')](function(_0x227746){return _0x227746;});}return null;};}function removeEntity(_0x4b10d1,_0x1424d1){return function(_0x2219fa){if(_0x2219fa){return _0x2219fa[_0x8105('0x22')]()[_0x8105('0x21')](function(){var _0x4a8715=_0x2219fa['get']({'plain':!![]});var _0x4b9e0e='Voicemails';return db[_0x8105('0x23')][_0x8105('0x22')]({'where':{'type':_0x4b9e0e,'resourceId':_0x4a8715['id']}})[_0x8105('0x21')](function(){return _0x2219fa;});})[_0x8105('0x21')](function(){_0x4b10d1[_0x8105('0x15')](0xcc)[_0x8105('0x16')]();});}};}function handleEntityNotFound(_0x534bf0,_0x1ffbe0){return function(_0x18c733){if(!_0x18c733){_0x534bf0['sendStatus'](0x194);}return _0x18c733;};}function handleError(_0x4b0732,_0x40be64){_0x40be64=_0x40be64||0x1f4;return function(_0x10ce0f){logger[_0x8105('0x24')](_0x10ce0f[_0x8105('0x25')]);if(_0x10ce0f['name']){delete _0x10ce0f[_0x8105('0x26')];}_0x4b0732[_0x8105('0x15')](_0x40be64)[_0x8105('0x27')](_0x10ce0f);};}exports[_0x8105('0x28')]=function(_0x9b92b1,_0x487e96){var _0x177120={},_0x25235a={},_0x453669={'count':0x0,'rows':[]};var _0x18cbb2=_[_0x8105('0x29')](db['VoiceMail']['rawAttributes'],function(_0xab364b){return{'name':_0xab364b[_0x8105('0x2a')],'type':_0xab364b[_0x8105('0x2b')][_0x8105('0x2c')]};});_0x25235a['model']=_[_0x8105('0x29')](_0x18cbb2,'name');_0x25235a['query']=_[_0x8105('0x2d')](_0x9b92b1[_0x8105('0x2e')]);_0x25235a[_0x8105('0x2f')]=_[_0x8105('0x30')](_0x25235a[_0x8105('0x31')],_0x25235a[_0x8105('0x2e')]);_0x177120[_0x8105('0x32')]=_['intersection'](_0x25235a[_0x8105('0x31')],qs[_0x8105('0x33')](_0x9b92b1['query'][_0x8105('0x33')]));_0x177120[_0x8105('0x32')]=_0x177120[_0x8105('0x32')]['length']?_0x177120[_0x8105('0x32')]:_0x25235a['model'];if(!_0x9b92b1[_0x8105('0x2e')]['hasOwnProperty'](_0x8105('0x34'))){_0x177120[_0x8105('0x1a')]=qs['limit'](_0x9b92b1[_0x8105('0x2e')][_0x8105('0x1a')]);_0x177120['offset']=qs[_0x8105('0x19')](_0x9b92b1['query'][_0x8105('0x19')]);}_0x177120[_0x8105('0x35')]=qs[_0x8105('0x36')](_0x9b92b1[_0x8105('0x2e')][_0x8105('0x36')]);_0x177120[_0x8105('0x37')]=qs[_0x8105('0x2f')](_[_0x8105('0x38')](_0x9b92b1['query'],_0x25235a[_0x8105('0x2f')]));if(_0x9b92b1[_0x8105('0x2e')][_0x8105('0x39')]){_0x177120[_0x8105('0x37')]=_[_0x8105('0x3a')](_0x177120[_0x8105('0x37')],{'$or':_[_0x8105('0x29')](_0x18cbb2,function(_0x58486d){if(_0x58486d[_0x8105('0x2b')]!==_0x8105('0x3b')){var _0x1dee65={};_0x1dee65[_0x58486d['name']]={'$like':'%'+_0x9b92b1['query'][_0x8105('0x39')]+'%'};return _0x1dee65;}})});}_0x177120=_[_0x8105('0x3a')]({},_0x177120,_0x9b92b1[_0x8105('0x3c')]);var _0x2d69c9={'where':_0x177120[_0x8105('0x37')]};return db[_0x8105('0x3d')][_0x8105('0x18')](_0x2d69c9)[_0x8105('0x21')](function(_0x4e541f){_0x453669[_0x8105('0x18')]=_0x4e541f;if(_0x9b92b1[_0x8105('0x2e')]['includeAll']){_0x177120[_0x8105('0x3e')]=[{'all':!![]}];}return db[_0x8105('0x3d')][_0x8105('0x3f')](_0x177120);})[_0x8105('0x21')](function(_0x3ba070){_0x453669[_0x8105('0x40')]=_0x3ba070;return _0x453669;})[_0x8105('0x21')](respondWithFilteredResult(_0x487e96,_0x177120))[_0x8105('0x41')](handleError(_0x487e96,null));};exports[_0x8105('0x42')]=function(_0x2cd28d,_0x3edd63){var _0x340b6d={'raw':!![],'where':{'id':_0x2cd28d[_0x8105('0x43')]['id']}},_0x67471c={};_0x67471c['model']=_[_0x8105('0x2d')](db[_0x8105('0x3d')]['rawAttributes']);_0x67471c['query']=_[_0x8105('0x2d')](_0x2cd28d[_0x8105('0x2e')]);_0x67471c['filters']=_['intersection'](_0x67471c[_0x8105('0x31')],_0x67471c['query']);_0x340b6d['attributes']=_[_0x8105('0x30')](_0x67471c[_0x8105('0x31')],qs['fields'](_0x2cd28d[_0x8105('0x2e')][_0x8105('0x33')]));_0x340b6d[_0x8105('0x32')]=_0x340b6d['attributes'][_0x8105('0x44')]?_0x340b6d['attributes']:_0x67471c[_0x8105('0x31')];if(_0x2cd28d[_0x8105('0x2e')]['includeAll']){_0x340b6d[_0x8105('0x3e')]=[{'all':!![]}];}_0x340b6d=_[_0x8105('0x3a')]({},_0x340b6d,_0x2cd28d[_0x8105('0x3c')]);return db[_0x8105('0x3d')][_0x8105('0x45')](_0x340b6d)['then'](handleEntityNotFound(_0x3edd63,null))[_0x8105('0x21')](respondWithResult(_0x3edd63,null))[_0x8105('0x41')](handleError(_0x3edd63,null));};exports[_0x8105('0x46')]=function(_0x19ef3c,_0x3cc656){return db[_0x8105('0x3d')][_0x8105('0x46')](_0x19ef3c['body'],{})[_0x8105('0x21')](function(_0x5ded63){var _0x2d0ee2=_0x19ef3c['user'][_0x8105('0x47')]({'plain':!![]});if(!_0x2d0ee2)throw new Error(_0x8105('0x48'));if(_0x2d0ee2[_0x8105('0x49')]===_0x8105('0x4a')){var _0x33754b=_0x5ded63['get']({'plain':!![]});var _0x1e9040='Voicemails';return db[_0x8105('0x4b')][_0x8105('0x45')]({'where':{'name':_0x1e9040,'userProfileId':_0x2d0ee2[_0x8105('0x4c')]},'raw':!![]})[_0x8105('0x21')](function(_0x5ccd99){if(_0x5ccd99&&_0x5ccd99[_0x8105('0x4d')]===0x0){return db['UserProfileResource'][_0x8105('0x46')]({'name':_0x33754b[_0x8105('0x26')],'resourceId':_0x33754b['id'],'type':_0x5ccd99['name'],'sectionId':_0x5ccd99['id']},{})[_0x8105('0x21')](function(){return _0x5ded63;});}else{return _0x5ded63;}})[_0x8105('0x41')](function(_0x2573a4){logger[_0x8105('0x24')](_0x8105('0x4e'),_0x2573a4);throw _0x2573a4;});}return _0x5ded63;})[_0x8105('0x21')](respondWithResult(_0x3cc656,0xc9))[_0x8105('0x41')](handleError(_0x3cc656,null));};exports[_0x8105('0x20')]=function(_0x34cf66,_0x4e65cf){if(_0x34cf66[_0x8105('0x4f')]['id']){delete _0x34cf66[_0x8105('0x4f')]['id'];}return db[_0x8105('0x3d')][_0x8105('0x45')]({'where':{'id':_0x34cf66['params']['id']}})[_0x8105('0x21')](handleEntityNotFound(_0x4e65cf,null))[_0x8105('0x21')](saveUpdates(_0x34cf66[_0x8105('0x4f')],null))[_0x8105('0x21')](respondWithResult(_0x4e65cf,null))[_0x8105('0x41')](handleError(_0x4e65cf,null));};exports[_0x8105('0x22')]=function(_0x29b784,_0x3be397){return db[_0x8105('0x3d')][_0x8105('0x45')]({'where':{'id':_0x29b784['params']['id']}})['then'](handleEntityNotFound(_0x3be397,null))[_0x8105('0x21')](removeEntity(_0x3be397,null))['catch'](handleError(_0x3be397,null));};exports[_0x8105('0x50')]=function(_0xacdba0,_0x1bbfa4,_0x36bf7a){return db[_0x8105('0x3d')]['findOne']({'where':{'id':_0xacdba0[_0x8105('0x43')]['id']}})[_0x8105('0x21')](handleEntityNotFound(_0x1bbfa4,null))[_0x8105('0x21')](function(_0x208aa2){var _0x44b2a0;var _0x1c4008={},_0x5eacd9={};_0x5eacd9['model']=_[_0x8105('0x2d')](db[_0x8105('0x51')][_0x8105('0x52')]);_0x5eacd9[_0x8105('0x2e')]=_[_0x8105('0x2d')](_0xacdba0[_0x8105('0x2e')]);_0x5eacd9[_0x8105('0x2f')]=_[_0x8105('0x30')](_0x5eacd9['model'],_0x5eacd9[_0x8105('0x2e')]);_0x1c4008[_0x8105('0x32')]=_[_0x8105('0x30')](_0x5eacd9[_0x8105('0x31')],qs[_0x8105('0x33')](_0xacdba0[_0x8105('0x2e')]['fields']));_0x1c4008['attributes']=_0x1c4008[_0x8105('0x32')][_0x8105('0x44')]?_0x1c4008[_0x8105('0x32')]:_0x5eacd9[_0x8105('0x31')];if(!_0xacdba0[_0x8105('0x2e')][_0x8105('0x53')]('nolimit')){_0x1c4008[_0x8105('0x1a')]=qs[_0x8105('0x1a')](_0xacdba0['query']['limit']);_0x1c4008[_0x8105('0x19')]=qs[_0x8105('0x19')](_0xacdba0[_0x8105('0x2e')][_0x8105('0x19')]);}_0x1c4008['order']=qs[_0x8105('0x36')](_0xacdba0[_0x8105('0x2e')][_0x8105('0x36')]);_0x1c4008[_0x8105('0x37')]=qs['filters'](_[_0x8105('0x38')](_0xacdba0['query'],_0x5eacd9[_0x8105('0x2f')]));if(_0xacdba0[_0x8105('0x2e')][_0x8105('0x39')]){_0x1c4008[_0x8105('0x37')]=_['merge'](_0x1c4008[_0x8105('0x37')],{'$or':_[_0x8105('0x29')](_0x1c4008[_0x8105('0x32')],function(_0x41e608){var _0x3e0665={};_0x3e0665[_0x41e608]={'$like':'%'+_0xacdba0[_0x8105('0x2e')][_0x8105('0x39')]+'%'};return _0x3e0665;})});}_0x1c4008[_0x8105('0x37')]=_['merge'](_0x1c4008[_0x8105('0x37')],{'mailboxuser':_0x208aa2[_0x8105('0x54')]});_0x1c4008=_[_0x8105('0x3a')]({},_0x1c4008,_0xacdba0[_0x8105('0x3c')]);return db[_0x8105('0x51')][_0x8105('0x55')](_0x1c4008)[_0x8105('0x21')](respondWithFilteredResult(_0x1bbfa4,_0x1c4008));})[_0x8105('0x41')](handleError(_0x1bbfa4,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 0e5903e..5661f6d 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 _0x0e56=['define','VoiceMail','voice_voicemail','mailbox_context','context','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports'];(function(_0x561fdb,_0x4e443a){var _0x12638a=function(_0x5d3061){while(--_0x5d3061){_0x561fdb['push'](_0x561fdb['shift']());}};_0x12638a(++_0x4e443a);}(_0x0e56,0xf5));var _0x60e5=function(_0x2d719c,_0x59b346){_0x2d719c=_0x2d719c-0x0;var _0x16c7e8=_0x0e56[_0x2d719c];return _0x16c7e8;};'use strict';var _=require(_0x60e5('0x0'));var util=require(_0x60e5('0x1'));var logger=require('../../config/logger')(_0x60e5('0x2'));var moment=require(_0x60e5('0x3'));var BPromise=require('bluebird');var rp=require(_0x60e5('0x4'));var fs=require('fs');var path=require(_0x60e5('0x5'));var rimraf=require(_0x60e5('0x6'));var config=require(_0x60e5('0x7'));var attributes=require(_0x60e5('0x8'));module[_0x60e5('0x9')]=function(_0x25b3a4,_0x54422a){return _0x25b3a4[_0x60e5('0xa')](_0x60e5('0xb'),attributes,{'tableName':_0x60e5('0xc'),'paranoid':![],'indexes':[{'name':_0x60e5('0xd'),'fields':['mailbox',_0x60e5('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6083=['exports','VoiceMail','voice_voicemail','mailbox_context','mailbox','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceMail.attributes'];(function(_0x143798,_0x164f73){var _0x44f48b=function(_0x54de6f){while(--_0x54de6f){_0x143798['push'](_0x143798['shift']());}};_0x44f48b(++_0x164f73);}(_0x6083,0x9f));var _0x3608=function(_0x5d0a6d,_0x252fd6){_0x5d0a6d=_0x5d0a6d-0x0;var _0x28e812=_0x6083[_0x5d0a6d];return _0x28e812;};'use strict';var _=require(_0x3608('0x0'));var util=require(_0x3608('0x1'));var logger=require('../../config/logger')(_0x3608('0x2'));var moment=require(_0x3608('0x3'));var BPromise=require(_0x3608('0x4'));var rp=require(_0x3608('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3608('0x6'));var config=require(_0x3608('0x7'));var attributes=require(_0x3608('0x8'));module[_0x3608('0x9')]=function(_0x28d950,_0x1fe616){return _0x28d950['define'](_0x3608('0xa'),attributes,{'tableName':_0x3608('0xb'),'paranoid':![],'indexes':[{'name':_0x3608('0xc'),'fields':[_0x3608('0xd'),'context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 37c324f..90da3f3 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 _0x98ae=['client','request','then','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMail,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x493fc9,_0x597cf9){var _0x3a90c3=function(_0x4f9ca2){while(--_0x4f9ca2){_0x493fc9['push'](_0x493fc9['shift']());}};_0x3a90c3(++_0x597cf9);}(_0x98ae,0x1be));var _0xe98a=function(_0x2cf46c,_0x238b3a){_0x2cf46c=_0x2cf46c-0x0;var _0x15079d=_0x98ae[_0x2cf46c];return _0x15079d;};'use strict';var _=require('lodash');var util=require(_0xe98a('0x0'));var moment=require(_0xe98a('0x1'));var BPromise=require(_0xe98a('0x2'));var rs=require(_0xe98a('0x3'));var fs=require('fs');var Redis=require(_0xe98a('0x4'));var db=require(_0xe98a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe98a('0x6'))(_0xe98a('0x7'));var config=require(_0xe98a('0x8'));var jayson=require(_0xe98a('0x9'));var client=jayson[_0xe98a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x459e9e,_0x57d555,_0x5ec76b){return new BPromise(function(_0x4c61c1,_0x4480e9){return client[_0xe98a('0xb')](_0x459e9e,_0x5ec76b)[_0xe98a('0xc')](function(_0x4a545a){logger['info']('VoiceMail,\x20%s,\x20%s',_0x57d555,_0xe98a('0xd'));logger[_0xe98a('0xe')](_0xe98a('0xf'),_0x57d555,_0xe98a('0xd'),JSON[_0xe98a('0x10')](_0x4a545a));if(_0x4a545a[_0xe98a('0x11')]){if(_0x4a545a[_0xe98a('0x11')][_0xe98a('0x12')]===0x1f4){logger[_0xe98a('0x11')](_0xe98a('0x13'),_0x57d555,_0x4a545a[_0xe98a('0x11')][_0xe98a('0x14')]);return _0x4480e9(_0x4a545a[_0xe98a('0x11')]['message']);}logger['error'](_0xe98a('0x13'),_0x57d555,_0x4a545a[_0xe98a('0x11')][_0xe98a('0x14')]);return _0x4c61c1(_0x4a545a[_0xe98a('0x11')][_0xe98a('0x14')]);}else{logger[_0xe98a('0x15')](_0xe98a('0x13'),_0x57d555,_0xe98a('0xd'));_0x4c61c1(_0x4a545a[_0xe98a('0x16')][_0xe98a('0x14')]);}})[_0xe98a('0x17')](function(_0x2f54e8){logger['error'](_0xe98a('0x13'),_0x57d555,_0x2f54e8);_0x4480e9(_0x2f54e8);});});} \ No newline at end of file +var _0xfeba=['error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','http','request','then','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5439f0,_0x3ee3d9){var _0x31320d=function(_0x3c1748){while(--_0x3c1748){_0x5439f0['push'](_0x5439f0['shift']());}};_0x31320d(++_0x3ee3d9);}(_0xfeba,0xbe));var _0xafeb=function(_0x5cb703,_0x1f3119){_0x5cb703=_0x5cb703-0x0;var _0x476722=_0xfeba[_0x5cb703];return _0x476722;};'use strict';var _=require(_0xafeb('0x0'));var util=require(_0xafeb('0x1'));var moment=require(_0xafeb('0x2'));var BPromise=require(_0xafeb('0x3'));var rs=require(_0xafeb('0x4'));var fs=require('fs');var Redis=require(_0xafeb('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xafeb('0x6'));var logger=require(_0xafeb('0x7'))('rpc');var config=require(_0xafeb('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xafeb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a33ee,_0x1286cd,_0x3fdec7){return new BPromise(function(_0x256a83,_0x53fae5){return client[_0xafeb('0xa')](_0x1a33ee,_0x3fdec7)[_0xafeb('0xb')](function(_0x27fd5b){logger['info'](_0xafeb('0xc'),_0x1286cd,_0xafeb('0xd'));logger[_0xafeb('0xe')](_0xafeb('0xf'),_0x1286cd,_0xafeb('0xd'),JSON[_0xafeb('0x10')](_0x27fd5b));if(_0x27fd5b[_0xafeb('0x11')]){if(_0x27fd5b[_0xafeb('0x11')][_0xafeb('0x12')]===0x1f4){logger['error'](_0xafeb('0xc'),_0x1286cd,_0x27fd5b[_0xafeb('0x11')][_0xafeb('0x13')]);return _0x53fae5(_0x27fd5b['error'][_0xafeb('0x13')]);}logger[_0xafeb('0x11')](_0xafeb('0xc'),_0x1286cd,_0x27fd5b[_0xafeb('0x11')][_0xafeb('0x13')]);return _0x256a83(_0x27fd5b['error'][_0xafeb('0x13')]);}else{logger[_0xafeb('0x14')]('VoiceMail,\x20%s,\x20%s',_0x1286cd,_0xafeb('0xd'));_0x256a83(_0x27fd5b[_0xafeb('0x15')]['message']);}})[_0xafeb('0x16')](function(_0x226785){logger[_0xafeb('0x11')]('VoiceMail,\x20%s,\x20%s',_0x1286cd,_0x226785);_0x53fae5(_0x226785);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 563509a..732a8c8 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 _0xdbf5=['util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','delete','destroy'];(function(_0x5150c4,_0x52b08f){var _0x526f3a=function(_0xc719ba){while(--_0xc719ba){_0x5150c4['push'](_0x5150c4['shift']());}};_0x526f3a(++_0x52b08f);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x55249b,_0x3edcbd){_0x55249b=_0x55249b-0x0;var _0x3340f=_0xdbf5[_0x55249b];return _0x3340f;};'use strict';var multer=require('multer');var util=require(_0x5dbf('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5dbf('0x1'));var router=express[_0x5dbf('0x2')]();var auth=require(_0x5dbf('0x3'));var interaction=require(_0x5dbf('0x4'));var config=require(_0x5dbf('0x5'));var controller=require(_0x5dbf('0x6'));router[_0x5dbf('0x7')]('/',auth[_0x5dbf('0x8')](),controller[_0x5dbf('0x9')]);router[_0x5dbf('0x7')](_0x5dbf('0xa'),auth[_0x5dbf('0x8')](),controller[_0x5dbf('0xb')]);router['get'](_0x5dbf('0xc'),auth['isAuthenticated'](),controller[_0x5dbf('0xd')]);router[_0x5dbf('0xe')]('/',auth[_0x5dbf('0x8')](),controller[_0x5dbf('0xf')]);router['put'](_0x5dbf('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x5dbf('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x5dbf('0x11')]);module['exports']=router; \ No newline at end of file +var _0x3f8a=['download','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download'];(function(_0x33da58,_0x20befb){var _0x46a0ef=function(_0x2eb4fe){while(--_0x2eb4fe){_0x33da58['push'](_0x33da58['shift']());}};_0x46a0ef(++_0x20befb);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0xa756e8,_0x49b65f){_0xa756e8=_0xa756e8-0x0;var _0x3c57ca=_0x3f8a[_0xa756e8];return _0x3c57ca;};'use strict';var multer=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var path=require(_0xa3f8('0x2'));var timeout=require(_0xa3f8('0x3'));var express=require('express');var router=express[_0xa3f8('0x4')]();var auth=require(_0xa3f8('0x5'));var interaction=require(_0xa3f8('0x6'));var config=require(_0xa3f8('0x7'));var controller=require(_0xa3f8('0x8'));router[_0xa3f8('0x9')]('/',auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xb')]);router[_0xa3f8('0x9')](_0xa3f8('0xc'),auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xd')]);router[_0xa3f8('0x9')](_0xa3f8('0xe'),auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xf')]);router[_0xa3f8('0x10')]('/',auth['isAuthenticated'](),controller[_0xa3f8('0x11')]);router[_0xa3f8('0x12')](_0xa3f8('0xc'),auth[_0xa3f8('0xa')](),controller['update']);router[_0xa3f8('0x13')](_0xa3f8('0xc'),auth[_0xa3f8('0xa')](),controller[_0xa3f8('0x14')]);module[_0xa3f8('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 7f21f15..a6ea3ae 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 _0x54e1=['VIRTUAL','getDataValue','INTEGER','STRING','long','exports'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x54e1,0xb3));var _0x154e=function(_0x4b7858,_0x592cd6){_0x4b7858=_0x4b7858-0x0;var _0x46b3ff=_0x54e1[_0x4b7858];return _0x46b3ff;};'use strict';var Sequelize=require('sequelize');module[_0x154e('0x0')]={'name':{'type':Sequelize[_0x154e('0x1')],'get':function(_0x25a98c){return this[_0x154e('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x154e('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x154e('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x154e('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x154e('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x154e('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x154e('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x154e('0x4')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x154e('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x154e('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':'TIMESTAMP','allowNull':![]}}; \ No newline at end of file +var _0x37be=['STRING','BLOB','TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','INTEGER'];(function(_0x5ea078,_0x105d19){var _0x4a0bff=function(_0x1c4be1){while(--_0x1c4be1){_0x5ea078['push'](_0x5ea078['shift']());}};_0x4a0bff(++_0x105d19);}(_0x37be,0x11b));var _0xe37b=function(_0x84f7ee,_0x49ffb6){_0x84f7ee=_0x84f7ee-0x0;var _0x1bece1=_0x37be[_0x84f7ee];return _0x1bece1;};'use strict';var Sequelize=require(_0xe37b('0x0'));module[_0xe37b('0x1')]={'name':{'type':Sequelize[_0xe37b('0x2')],'get':function(_0x457b46){return this[_0xe37b('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xe37b('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xe37b('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0xe37b('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xe37b('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0xe37b('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0xe37b('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xe37b('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xe37b('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0xe37b('0x6')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xe37b('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xe37b('0x5')],'defaultValue':''},'stamp':{'type':_0xe37b('0x7'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index c4c8d53..5fd87da 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 _0xcca7=['merge','options','includeAll','include','catch','params','rawAttributes','intersection','length','find','create','body','destroy','download','recording','msg_id','Sequelize','ValidationError','audio/wav','attachment;\x20filename=\x22','set','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','map','VoiceMailMessage','fieldName','type','differenceBy','query','keys','model','attributes','fields','order','sort','where','filters','pick','filter','VIRTUAL'];(function(_0x2410e9,_0x6028ce){var _0x560eba=function(_0x2fac3e){while(--_0x2fac3e){_0x2410e9['push'](_0x2410e9['shift']());}};_0x560eba(++_0x6028ce);}(_0xcca7,0x1aa));var _0x7cca=function(_0x23430f,_0x413d86){_0x23430f=_0x23430f-0x0;var _0x130459=_0xcca7[_0x23430f];return _0x130459;};'use strict';var pdf=require(_0x7cca('0x0'));var emlformat=require(_0x7cca('0x1'));var rimraf=require(_0x7cca('0x2'));var zipdir=require(_0x7cca('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7cca('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7cca('0x5'));var util=require(_0x7cca('0x6'));var path=require(_0x7cca('0x7'));var sox=require(_0x7cca('0x8'));var csv=require(_0x7cca('0x9'));var ejs=require(_0x7cca('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x7cca('0xb'));var jsforce=require(_0x7cca('0xc'));var deskjs=require(_0x7cca('0xd'));var toCsv=require(_0x7cca('0x9'));var querystring=require(_0x7cca('0xe'));var Papa=require(_0x7cca('0xf'));var Redis=require(_0x7cca('0x10'));var authService=require(_0x7cca('0x11'));var qs=require(_0x7cca('0x12'));var as=require(_0x7cca('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7cca('0x14'))(_0x7cca('0x15'));var utils=require(_0x7cca('0x16'));var config=require(_0x7cca('0x17'));var db=require(_0x7cca('0x18'))['db'];function respondWithStatusCode(_0x4b7b66,_0x2a14cc){_0x2a14cc=_0x2a14cc||0xcc;return function(_0x41e0a2){if(_0x41e0a2){return _0x4b7b66[_0x7cca('0x19')](_0x2a14cc);}return _0x4b7b66['status'](_0x2a14cc)['end']();};}function respondWithResult(_0x8ea157,_0x20c1b2){_0x20c1b2=_0x20c1b2||0xc8;return function(_0x27d671){if(_0x27d671){return _0x8ea157[_0x7cca('0x1a')](_0x20c1b2)[_0x7cca('0x1b')](_0x27d671);}};}function respondWithFilteredResult(_0x3d3141,_0x45143d){return function(_0x5a357d){if(_0x5a357d){var _0x216d4b=_0x5a357d[_0x7cca('0x1c')],_0x533608=_0x45143d[_0x7cca('0x1d')],_0x5cd551=_0x45143d[_0x7cca('0x1d')]+_0x45143d[_0x7cca('0x1e')],_0x4eb7fa;if(_0x5cd551>=_0x216d4b){_0x5cd551=_0x216d4b;_0x4eb7fa=0xc8;}else{_0x4eb7fa=0xce;}_0x3d3141[_0x7cca('0x1a')](_0x4eb7fa);return _0x3d3141['set'](_0x7cca('0x1f'),_0x533608+'-'+_0x5cd551+'/'+_0x216d4b)['json'](_0x5a357d);}return null;};}function patchUpdates(_0x5d47f8){return function(_0x5d7ac6){try{jsonpatch[_0x7cca('0x20')](_0x5d7ac6,_0x5d47f8,!![]);}catch(_0x25297b){return BPromise[_0x7cca('0x21')](_0x25297b);}return _0x5d7ac6[_0x7cca('0x22')]();};}function saveUpdates(_0x36ba41,_0x45db2f){return function(_0x2e023c){if(_0x2e023c){return _0x2e023c[_0x7cca('0x23')](_0x36ba41)['then'](function(_0x31baf4){return _0x31baf4;});}return null;};}function removeEntity(_0x3154b0,_0x165d13){return function(_0x4343a3){if(_0x4343a3){return _0x4343a3['destroy']()[_0x7cca('0x24')](function(){_0x3154b0[_0x7cca('0x1a')](0xcc)[_0x7cca('0x25')]();});}};}function handleEntityNotFound(_0x119d76,_0x823d7d){return function(_0x3fc157){if(!_0x3fc157){_0x119d76[_0x7cca('0x19')](0x194);}return _0x3fc157;};}function handleError(_0xaf9264,_0x4b99b6){_0x4b99b6=_0x4b99b6||0x1f4;return function(_0xfe121c){logger[_0x7cca('0x26')](_0xfe121c[_0x7cca('0x27')]);if(_0xfe121c[_0x7cca('0x28')]){delete _0xfe121c[_0x7cca('0x28')];}_0xaf9264[_0x7cca('0x1a')](_0x4b99b6)[_0x7cca('0x29')](_0xfe121c);};}exports[_0x7cca('0x2a')]=function(_0x583846,_0x2cafe1){var _0x5c8410={},_0xc86c1b={},_0x201fbb={'count':0x0,'rows':[]};var _0x5a87d6=_[_0x7cca('0x2b')](db[_0x7cca('0x2c')]['rawAttributes'],function(_0x249442){return{'name':_0x249442[_0x7cca('0x2d')],'type':_0x249442[_0x7cca('0x2e')]['key']};});_0xc86c1b['model']=_[_0x7cca('0x2f')](_[_0x7cca('0x2b')](_0x5a87d6,_0x7cca('0x28')),[_0x7cca('0x28')]);_0xc86c1b[_0x7cca('0x30')]=_[_0x7cca('0x31')](_0x583846[_0x7cca('0x30')]);_0xc86c1b['filters']=_['intersection'](_0xc86c1b[_0x7cca('0x32')],_0xc86c1b[_0x7cca('0x30')]);_0x5c8410[_0x7cca('0x33')]=_['intersection'](_0xc86c1b[_0x7cca('0x32')],qs['fields'](_0x583846[_0x7cca('0x30')][_0x7cca('0x34')]));_0x5c8410[_0x7cca('0x33')]=_0x5c8410[_0x7cca('0x33')]['length']?_0x5c8410[_0x7cca('0x33')]:_0xc86c1b[_0x7cca('0x32')];if(!_0x583846[_0x7cca('0x30')]['hasOwnProperty']('nolimit')){_0x5c8410['limit']=qs[_0x7cca('0x1e')](_0x583846[_0x7cca('0x30')]['limit']);_0x5c8410[_0x7cca('0x1d')]=qs[_0x7cca('0x1d')](_0x583846[_0x7cca('0x30')][_0x7cca('0x1d')]);}_0x5c8410[_0x7cca('0x35')]=qs[_0x7cca('0x36')](_0x583846[_0x7cca('0x30')]['sort']);_0x5c8410[_0x7cca('0x37')]=qs[_0x7cca('0x38')](_[_0x7cca('0x39')](_0x583846[_0x7cca('0x30')],_0xc86c1b['filters']));if(_0x583846[_0x7cca('0x30')][_0x7cca('0x3a')]){_0x5c8410[_0x7cca('0x37')]=_['merge'](_0x5c8410[_0x7cca('0x37')],{'$or':_['map'](_0x5a87d6,function(_0x36ad6a){if(_0x36ad6a[_0x7cca('0x2e')]!==_0x7cca('0x3b')){var _0x333c82={};_0x333c82[_0x36ad6a[_0x7cca('0x28')]]={'$like':'%'+_0x583846[_0x7cca('0x30')][_0x7cca('0x3a')]+'%'};return _0x333c82;}})});}_0x5c8410=_[_0x7cca('0x3c')]({},_0x5c8410,_0x583846[_0x7cca('0x3d')]);var _0x4f1f11={'where':_0x5c8410['where']};return db[_0x7cca('0x2c')][_0x7cca('0x1c')](_0x4f1f11)['then'](function(_0x48d87f){_0x201fbb[_0x7cca('0x1c')]=_0x48d87f;if(_0x583846[_0x7cca('0x30')][_0x7cca('0x3e')]){_0x5c8410[_0x7cca('0x3f')]=[{'all':!![]}];}return db[_0x7cca('0x2c')]['findAll'](_0x5c8410);})[_0x7cca('0x24')](function(_0x5ee9e7){_0x201fbb['rows']=_0x5ee9e7;return _0x201fbb;})[_0x7cca('0x24')](respondWithFilteredResult(_0x2cafe1,_0x5c8410))[_0x7cca('0x40')](handleError(_0x2cafe1,null));};exports['show']=function(_0x3b120b,_0x5d1a4a){var _0x1303e0={'raw':!![],'where':{'id':_0x3b120b[_0x7cca('0x41')]['id']}},_0x3edb26={};_0x3edb26['model']=_[_0x7cca('0x31')](db[_0x7cca('0x2c')][_0x7cca('0x42')]);_0x3edb26[_0x7cca('0x30')]=_['keys'](_0x3b120b[_0x7cca('0x30')]);_0x3edb26[_0x7cca('0x38')]=_[_0x7cca('0x43')](_0x3edb26[_0x7cca('0x32')],_0x3edb26[_0x7cca('0x30')]);_0x1303e0[_0x7cca('0x33')]=_['intersection'](_0x3edb26['model'],qs['fields'](_0x3b120b['query'][_0x7cca('0x34')]));_0x1303e0['attributes']=_0x1303e0['attributes'][_0x7cca('0x44')]?_0x1303e0[_0x7cca('0x33')]:_0x3edb26[_0x7cca('0x32')];if(_0x3b120b[_0x7cca('0x30')][_0x7cca('0x3e')]){_0x1303e0['include']=[{'all':!![]}];}_0x1303e0=_[_0x7cca('0x3c')]({},_0x1303e0,_0x3b120b[_0x7cca('0x3d')]);return db[_0x7cca('0x2c')][_0x7cca('0x45')](_0x1303e0)[_0x7cca('0x24')](handleEntityNotFound(_0x5d1a4a,null))[_0x7cca('0x24')](respondWithResult(_0x5d1a4a,null))[_0x7cca('0x40')](handleError(_0x5d1a4a,null));};exports[_0x7cca('0x46')]=function(_0x20458d,_0x1e9a9a){return db[_0x7cca('0x2c')]['create'](_0x20458d['body'],{})[_0x7cca('0x24')](respondWithResult(_0x1e9a9a,0xc9))[_0x7cca('0x40')](handleError(_0x1e9a9a,null));};exports[_0x7cca('0x23')]=function(_0x41296d,_0x3cd0c4){if(_0x41296d[_0x7cca('0x47')]['id']){delete _0x41296d[_0x7cca('0x47')]['id'];}return db[_0x7cca('0x2c')][_0x7cca('0x45')]({'where':{'id':_0x41296d[_0x7cca('0x41')]['id']}})[_0x7cca('0x24')](handleEntityNotFound(_0x3cd0c4,null))[_0x7cca('0x24')](saveUpdates(_0x41296d['body'],null))[_0x7cca('0x24')](respondWithResult(_0x3cd0c4,null))[_0x7cca('0x40')](handleError(_0x3cd0c4,null));};exports[_0x7cca('0x48')]=function(_0x74d4b3,_0x182ee5){return db[_0x7cca('0x2c')][_0x7cca('0x45')]({'where':{'id':_0x74d4b3[_0x7cca('0x41')]['id']}})[_0x7cca('0x24')](handleEntityNotFound(_0x182ee5,null))[_0x7cca('0x24')](removeEntity(_0x182ee5,null))[_0x7cca('0x40')](handleError(_0x182ee5,null));};exports[_0x7cca('0x49')]=function(_0x1253d8,_0xa043c0,_0x5edb41){return db[_0x7cca('0x2c')][_0x7cca('0x45')]({'where':{'id':_0x1253d8[_0x7cca('0x41')]['id']},'attributes':['id',_0x7cca('0x4a'),_0x7cca('0x4b')]})[_0x7cca('0x24')](handleEntityNotFound(_0xa043c0,null))[_0x7cca('0x24')](function(_0xc72da3){if(_0xc72da3){if(!_0xc72da3[_0x7cca('0x4a')]){throw new db[(_0x7cca('0x4c'))][(_0x7cca('0x4d'))]('VoiceMailMessage\x20not\x20found');}var _0x17c142={'Content-Type':_0x7cca('0x4e'),'Content-Disposition':'attachment'};if(_0xc72da3['msg_id']){_0x17c142['Content-Disposition']=_0x7cca('0x4f')+_0xc72da3[_0x7cca('0x4b')]+'.wav\x22';}_0xa043c0[_0x7cca('0x50')](_0x17c142);return _0xa043c0[_0x7cca('0x29')](new Buffer(_0xc72da3['recording']));}})[_0x7cca('0x40')](handleError(_0xa043c0,null));}; \ No newline at end of file +var _0xed1f=['hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','rawAttributes','create','body','find','download','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','recording','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/advancedSearch','../../config/logger','api','../../mysqldb','end','count','offset','limit','status','apply','save','update','then','destroy','sendStatus','error','name','send','index','VoiceMailMessage','fieldName','type','key','differenceBy','map','query','keys','filters','intersection','attributes','model','fields','length'];(function(_0x54980c,_0x455c7f){var _0x4c409c=function(_0x5072b8){while(--_0x5072b8){_0x54980c['push'](_0x54980c['shift']());}};_0x4c409c(++_0x455c7f);}(_0xed1f,0x6a));var _0xfed1=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0xed1f[_0x616290];return _0x453879;};'use strict';var pdf=require(_0xfed1('0x0'));var emlformat=require(_0xfed1('0x1'));var rimraf=require(_0xfed1('0x2'));var zipdir=require(_0xfed1('0x3'));var jsonpatch=require(_0xfed1('0x4'));var rp=require(_0xfed1('0x5'));var moment=require(_0xfed1('0x6'));var BPromise=require(_0xfed1('0x7'));var Mustache=require(_0xfed1('0x8'));var util=require(_0xfed1('0x9'));var path=require(_0xfed1('0xa'));var sox=require(_0xfed1('0xb'));var csv=require(_0xfed1('0xc'));var ejs=require(_0xfed1('0xd'));var fs=require('fs');var _=require(_0xfed1('0xe'));var squel=require(_0xfed1('0xf'));var crypto=require(_0xfed1('0x10'));var jsforce=require(_0xfed1('0x11'));var deskjs=require('desk.js');var toCsv=require(_0xfed1('0xc'));var querystring=require(_0xfed1('0x12'));var Papa=require('papaparse');var Redis=require(_0xfed1('0x13'));var authService=require(_0xfed1('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xfed1('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfed1('0x16'))(_0xfed1('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xfed1('0x18'))['db'];function respondWithStatusCode(_0xe84ba6,_0x569a6e){_0x569a6e=_0x569a6e||0xcc;return function(_0x17f4fe){if(_0x17f4fe){return _0xe84ba6['sendStatus'](_0x569a6e);}return _0xe84ba6['status'](_0x569a6e)[_0xfed1('0x19')]();};}function respondWithResult(_0x397af9,_0x532537){_0x532537=_0x532537||0xc8;return function(_0x2dde3a){if(_0x2dde3a){return _0x397af9['status'](_0x532537)['json'](_0x2dde3a);}};}function respondWithFilteredResult(_0xde25db,_0x39aa0c){return function(_0x1fbb7a){if(_0x1fbb7a){var _0x123c46=_0x1fbb7a[_0xfed1('0x1a')],_0x582e67=_0x39aa0c[_0xfed1('0x1b')],_0x1a00f6=_0x39aa0c['offset']+_0x39aa0c[_0xfed1('0x1c')],_0x4af928;if(_0x1a00f6>=_0x123c46){_0x1a00f6=_0x123c46;_0x4af928=0xc8;}else{_0x4af928=0xce;}_0xde25db[_0xfed1('0x1d')](_0x4af928);return _0xde25db['set']('Content-Range',_0x582e67+'-'+_0x1a00f6+'/'+_0x123c46)['json'](_0x1fbb7a);}return null;};}function patchUpdates(_0x1e5afb){return function(_0x51f12a){try{jsonpatch[_0xfed1('0x1e')](_0x51f12a,_0x1e5afb,!![]);}catch(_0x34fa04){return BPromise['reject'](_0x34fa04);}return _0x51f12a[_0xfed1('0x1f')]();};}function saveUpdates(_0x65f14b,_0x59ee9d){return function(_0x3ce944){if(_0x3ce944){return _0x3ce944[_0xfed1('0x20')](_0x65f14b)[_0xfed1('0x21')](function(_0x92b92d){return _0x92b92d;});}return null;};}function removeEntity(_0x4bac79,_0x203cec){return function(_0x59333e){if(_0x59333e){return _0x59333e[_0xfed1('0x22')]()[_0xfed1('0x21')](function(){_0x4bac79[_0xfed1('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41d22c,_0x594917){return function(_0x460555){if(!_0x460555){_0x41d22c[_0xfed1('0x23')](0x194);}return _0x460555;};}function handleError(_0x1b7b22,_0x365bae){_0x365bae=_0x365bae||0x1f4;return function(_0x186ecc){logger[_0xfed1('0x24')](_0x186ecc['stack']);if(_0x186ecc[_0xfed1('0x25')]){delete _0x186ecc[_0xfed1('0x25')];}_0x1b7b22['status'](_0x365bae)[_0xfed1('0x26')](_0x186ecc);};}exports[_0xfed1('0x27')]=function(_0x1b871a,_0x1d62c5){var _0x3b9122={},_0x1761d1={},_0x583953={'count':0x0,'rows':[]};var _0x4607e9=_['map'](db[_0xfed1('0x28')]['rawAttributes'],function(_0x53b0c9){return{'name':_0x53b0c9[_0xfed1('0x29')],'type':_0x53b0c9[_0xfed1('0x2a')][_0xfed1('0x2b')]};});_0x1761d1['model']=_[_0xfed1('0x2c')](_[_0xfed1('0x2d')](_0x4607e9,_0xfed1('0x25')),[_0xfed1('0x25')]);_0x1761d1[_0xfed1('0x2e')]=_[_0xfed1('0x2f')](_0x1b871a['query']);_0x1761d1[_0xfed1('0x30')]=_[_0xfed1('0x31')](_0x1761d1['model'],_0x1761d1['query']);_0x3b9122[_0xfed1('0x32')]=_[_0xfed1('0x31')](_0x1761d1[_0xfed1('0x33')],qs[_0xfed1('0x34')](_0x1b871a[_0xfed1('0x2e')]['fields']));_0x3b9122[_0xfed1('0x32')]=_0x3b9122[_0xfed1('0x32')][_0xfed1('0x35')]?_0x3b9122[_0xfed1('0x32')]:_0x1761d1[_0xfed1('0x33')];if(!_0x1b871a['query'][_0xfed1('0x36')]('nolimit')){_0x3b9122[_0xfed1('0x1c')]=qs[_0xfed1('0x1c')](_0x1b871a[_0xfed1('0x2e')][_0xfed1('0x1c')]);_0x3b9122[_0xfed1('0x1b')]=qs[_0xfed1('0x1b')](_0x1b871a[_0xfed1('0x2e')][_0xfed1('0x1b')]);}_0x3b9122['order']=qs[_0xfed1('0x37')](_0x1b871a[_0xfed1('0x2e')][_0xfed1('0x37')]);_0x3b9122[_0xfed1('0x38')]=qs['filters'](_['pick'](_0x1b871a[_0xfed1('0x2e')],_0x1761d1[_0xfed1('0x30')]));if(_0x1b871a[_0xfed1('0x2e')][_0xfed1('0x39')]){_0x3b9122[_0xfed1('0x38')]=_[_0xfed1('0x3a')](_0x3b9122[_0xfed1('0x38')],{'$or':_[_0xfed1('0x2d')](_0x4607e9,function(_0x5793a4){if(_0x5793a4['type']!==_0xfed1('0x3b')){var _0x2f6250={};_0x2f6250[_0x5793a4['name']]={'$like':'%'+_0x1b871a[_0xfed1('0x2e')][_0xfed1('0x39')]+'%'};return _0x2f6250;}})});}_0x3b9122=_[_0xfed1('0x3a')]({},_0x3b9122,_0x1b871a[_0xfed1('0x3c')]);var _0x2807c={'where':_0x3b9122[_0xfed1('0x38')]};return db[_0xfed1('0x28')][_0xfed1('0x1a')](_0x2807c)[_0xfed1('0x21')](function(_0x5f3e1f){_0x583953['count']=_0x5f3e1f;if(_0x1b871a['query'][_0xfed1('0x3d')]){_0x3b9122[_0xfed1('0x3e')]=[{'all':!![]}];}return db[_0xfed1('0x28')]['findAll'](_0x3b9122);})[_0xfed1('0x21')](function(_0x4a0b04){_0x583953[_0xfed1('0x3f')]=_0x4a0b04;return _0x583953;})[_0xfed1('0x21')](respondWithFilteredResult(_0x1d62c5,_0x3b9122))[_0xfed1('0x40')](handleError(_0x1d62c5,null));};exports['show']=function(_0x20bdae,_0x6f1647){var _0x422433={'raw':!![],'where':{'id':_0x20bdae[_0xfed1('0x41')]['id']}},_0x4b4115={};_0x4b4115['model']=_[_0xfed1('0x2f')](db[_0xfed1('0x28')][_0xfed1('0x42')]);_0x4b4115[_0xfed1('0x2e')]=_[_0xfed1('0x2f')](_0x20bdae[_0xfed1('0x2e')]);_0x4b4115[_0xfed1('0x30')]=_[_0xfed1('0x31')](_0x4b4115[_0xfed1('0x33')],_0x4b4115['query']);_0x422433[_0xfed1('0x32')]=_[_0xfed1('0x31')](_0x4b4115[_0xfed1('0x33')],qs['fields'](_0x20bdae['query'][_0xfed1('0x34')]));_0x422433[_0xfed1('0x32')]=_0x422433[_0xfed1('0x32')][_0xfed1('0x35')]?_0x422433[_0xfed1('0x32')]:_0x4b4115[_0xfed1('0x33')];if(_0x20bdae[_0xfed1('0x2e')][_0xfed1('0x3d')]){_0x422433[_0xfed1('0x3e')]=[{'all':!![]}];}_0x422433=_[_0xfed1('0x3a')]({},_0x422433,_0x20bdae[_0xfed1('0x3c')]);return db[_0xfed1('0x28')]['find'](_0x422433)[_0xfed1('0x21')](handleEntityNotFound(_0x6f1647,null))[_0xfed1('0x21')](respondWithResult(_0x6f1647,null))[_0xfed1('0x40')](handleError(_0x6f1647,null));};exports[_0xfed1('0x43')]=function(_0x2b6267,_0x1e4781){return db['VoiceMailMessage'][_0xfed1('0x43')](_0x2b6267[_0xfed1('0x44')],{})[_0xfed1('0x21')](respondWithResult(_0x1e4781,0xc9))['catch'](handleError(_0x1e4781,null));};exports[_0xfed1('0x20')]=function(_0x10f98d,_0x156876){if(_0x10f98d[_0xfed1('0x44')]['id']){delete _0x10f98d['body']['id'];}return db[_0xfed1('0x28')][_0xfed1('0x45')]({'where':{'id':_0x10f98d[_0xfed1('0x41')]['id']}})[_0xfed1('0x21')](handleEntityNotFound(_0x156876,null))[_0xfed1('0x21')](saveUpdates(_0x10f98d[_0xfed1('0x44')],null))[_0xfed1('0x21')](respondWithResult(_0x156876,null))[_0xfed1('0x40')](handleError(_0x156876,null));};exports[_0xfed1('0x22')]=function(_0x326f68,_0xa0515c){return db[_0xfed1('0x28')][_0xfed1('0x45')]({'where':{'id':_0x326f68[_0xfed1('0x41')]['id']}})[_0xfed1('0x21')](handleEntityNotFound(_0xa0515c,null))[_0xfed1('0x21')](removeEntity(_0xa0515c,null))[_0xfed1('0x40')](handleError(_0xa0515c,null));};exports[_0xfed1('0x46')]=function(_0x5397c9,_0x589feb,_0x1e1a8e){return db[_0xfed1('0x28')][_0xfed1('0x45')]({'where':{'id':_0x5397c9[_0xfed1('0x41')]['id']},'attributes':['id','recording',_0xfed1('0x47')]})[_0xfed1('0x21')](handleEntityNotFound(_0x589feb,null))['then'](function(_0x4f393c){if(_0x4f393c){if(!_0x4f393c['recording']){throw new db[(_0xfed1('0x48'))][(_0xfed1('0x49'))](_0xfed1('0x4a'));}var _0x1d8ef2={'Content-Type':_0xfed1('0x4b'),'Content-Disposition':_0xfed1('0x4c')};if(_0x4f393c[_0xfed1('0x47')]){_0x1d8ef2[_0xfed1('0x4d')]=_0xfed1('0x4e')+_0x4f393c[_0xfed1('0x47')]+'.wav\x22';}_0x589feb['set'](_0x1d8ef2);return _0x589feb[_0xfed1('0x26')](new Buffer(_0x4f393c[_0xfed1('0x4f')]));}})[_0xfed1('0x40')](handleError(_0x589feb,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index e20264f..0300ce9 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 _0xfa37=['lodash','../../config/logger','api','path','rimraf','exports'];(function(_0x39d711,_0xe11eb7){var _0xee1d0c=function(_0x457e08){while(--_0x457e08){_0x39d711['push'](_0x39d711['shift']());}};_0xee1d0c(++_0xe11eb7);}(_0xfa37,0x78));var _0x7fa3=function(_0x526a90,_0x3b3fd6){_0x526a90=_0x526a90-0x0;var _0x91cd91=_0xfa37[_0x526a90];return _0x91cd91;};'use strict';var _=require(_0x7fa3('0x0'));var util=require('util');var logger=require(_0x7fa3('0x1'))(_0x7fa3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7fa3('0x3'));var rimraf=require(_0x7fa3('0x4'));var config=require('../../config/environment');var attributes=require('./voiceMailMessage.attributes');module[_0x7fa3('0x5')]=function(_0x373035,_0x11c994){return _0x373035['define']('VoiceMailMessage',attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':'dir','fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0x6a00=['rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','dir','lodash','util','api','moment','request-promise','path'];(function(_0x326f4c,_0x2d77b9){var _0x1b6260=function(_0x3af4d3){while(--_0x3af4d3){_0x326f4c['push'](_0x326f4c['shift']());}};_0x1b6260(++_0x2d77b9);}(_0x6a00,0x156));var _0x06a0=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x6a00[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require(_0x06a0('0x0'));var util=require(_0x06a0('0x1'));var logger=require('../../config/logger')(_0x06a0('0x2'));var moment=require(_0x06a0('0x3'));var BPromise=require('bluebird');var rp=require(_0x06a0('0x4'));var fs=require('fs');var path=require(_0x06a0('0x5'));var rimraf=require(_0x06a0('0x6'));var config=require(_0x06a0('0x7'));var attributes=require(_0x06a0('0x8'));module[_0x06a0('0x9')]=function(_0x6cba5b,_0x3b8340){return _0x6cba5b[_0x06a0('0xa')]('VoiceMailMessage',attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x06a0('0xb'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 8c8202b..5d4ca39 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 _0x1967=['then','info','VoiceMailMessage,\x20%s,\x20%s','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x1967,0x173));var _0x7196=function(_0x170a36,_0x2041b4){_0x170a36=_0x170a36-0x0;var _0x396261=_0x1967[_0x170a36];return _0x396261;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var BPromise=require(_0x7196('0x2'));var rs=require(_0x7196('0x3'));var fs=require('fs');var Redis=require(_0x7196('0x4'));var db=require(_0x7196('0x5'))['db'];var utils=require(_0x7196('0x6'));var logger=require(_0x7196('0x7'))(_0x7196('0x8'));var config=require(_0x7196('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7196('0xa')][_0x7196('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x194746,_0x40e0af,_0x266a6e){return new BPromise(function(_0xad78a,_0x510c72){return client[_0x7196('0xc')](_0x194746,_0x266a6e)[_0x7196('0xd')](function(_0x3f846e){logger[_0x7196('0xe')](_0x7196('0xf'),_0x40e0af,'request\x20sent');logger['debug'](_0x7196('0x10'),_0x40e0af,_0x7196('0x11'),JSON[_0x7196('0x12')](_0x3f846e));if(_0x3f846e[_0x7196('0x13')]){if(_0x3f846e[_0x7196('0x13')][_0x7196('0x14')]===0x1f4){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0x510c72(_0x3f846e[_0x7196('0x13')]['message']);}logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0xad78a(_0x3f846e['error'][_0x7196('0x15')]);}else{logger['info'](_0x7196('0xf'),_0x40e0af,_0x7196('0x11'));_0xad78a(_0x3f846e[_0x7196('0x16')][_0x7196('0x15')]);}})[_0x7196('0x17')](function(_0x2e3e0e){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x2e3e0e);_0x510c72(_0x2e3e0e);});});} \ No newline at end of file +var _0x57ca=['client','http','request','info','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','VoiceMailMessage,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x451f85,_0xc4403c){var _0x216acb=function(_0x9f69e){while(--_0x9f69e){_0x451f85['push'](_0x451f85['shift']());}};_0x216acb(++_0xc4403c);}(_0x57ca,0x108));var _0xa57c=function(_0x2e5b0b,_0x58da89){_0x2e5b0b=_0x2e5b0b-0x0;var _0x2fcdd9=_0x57ca[_0x2e5b0b];return _0x2fcdd9;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index e6e58dc..51e22ee 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 _0x7012=['/:id/sounds/:id2','removeSound','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','index','/:id/sounds','isAuthenticated','getSounds','post','addSound','update','delete','/:id','destroy'];(function(_0x30bd4d,_0x50eb60){var _0x306915=function(_0x5ae782){while(--_0x5ae782){_0x30bd4d['push'](_0x30bd4d['shift']());}};_0x306915(++_0x50eb60);}(_0x7012,0x179));var _0x2701=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x7012[_0x2064e5];return _0x21a233;};'use strict';var multer=require('multer');var util=require(_0x2701('0x0'));var path=require('path');var timeout=require(_0x2701('0x1'));var express=require(_0x2701('0x2'));var router=express[_0x2701('0x3')]();var auth=require(_0x2701('0x4'));var interaction=require(_0x2701('0x5'));var config=require(_0x2701('0x6'));var controller=require(_0x2701('0x7'));router[_0x2701('0x8')]('/',auth['isAuthenticated'](),controller[_0x2701('0x9')]);router[_0x2701('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x2701('0x8')](_0x2701('0xa'),auth[_0x2701('0xb')](),controller[_0x2701('0xc')]);router[_0x2701('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2701('0xd')](_0x2701('0xa'),auth['isAuthenticated'](),controller[_0x2701('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x2701('0xf')]);router[_0x2701('0x10')](_0x2701('0x11'),auth[_0x2701('0xb')](),controller[_0x2701('0x12')]);router[_0x2701('0x10')](_0x2701('0x13'),auth[_0x2701('0xb')](),controller[_0x2701('0x14')]);module[_0x2701('0x15')]=router; \ No newline at end of file +var _0xb263=['get','getSounds','post','create','addSound','put','update','delete','destroy','/:id/sounds/:id2','exports','util','path','express','Router','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','index','show'];(function(_0x2b9fee,_0x4baa8b){var _0x581d2f=function(_0x1ddce4){while(--_0x1ddce4){_0x2b9fee['push'](_0x2b9fee['shift']());}};_0x581d2f(++_0x4baa8b);}(_0xb263,0x1eb));var _0x3b26=function(_0x487d39,_0x44c583){_0x487d39=_0x487d39-0x0;var _0x541829=_0xb263[_0x487d39];return _0x541829;};'use strict';var multer=require('multer');var util=require(_0x3b26('0x0'));var path=require(_0x3b26('0x1'));var timeout=require('connect-timeout');var express=require(_0x3b26('0x2'));var router=express[_0x3b26('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3b26('0x4'));var controller=require(_0x3b26('0x5'));router['get']('/',auth[_0x3b26('0x6')](),controller[_0x3b26('0x7')]);router['get']('/:id',auth[_0x3b26('0x6')](),controller[_0x3b26('0x8')]);router[_0x3b26('0x9')]('/:id/sounds',auth[_0x3b26('0x6')](),controller[_0x3b26('0xa')]);router[_0x3b26('0xb')]('/',auth['isAuthenticated'](),controller[_0x3b26('0xc')]);router['post']('/:id/sounds',auth[_0x3b26('0x6')](),controller[_0x3b26('0xd')]);router[_0x3b26('0xe')]('/:id',auth[_0x3b26('0x6')](),controller[_0x3b26('0xf')]);router[_0x3b26('0x10')]('/:id',auth[_0x3b26('0x6')](),controller[_0x3b26('0x11')]);router[_0x3b26('0x10')](_0x3b26('0x12'),auth['isAuthenticated'](),controller['removeSound']);module[_0x3b26('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 01c205d..7659bbc 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 _0x82ce=['mp3nb','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','exports','STRING','name','custom','files'];(function(_0x4a0801,_0x55b298){var _0x47306d=function(_0x415a91){while(--_0x415a91){_0x4a0801['push'](_0x4a0801['shift']());}};_0x47306d(++_0x55b298);}(_0x82ce,0x11b));var _0xe82c=function(_0x2cc65c,_0x42906a){_0x2cc65c=_0x2cc65c-0x0;var _0x265c22=_0x82ce[_0x2cc65c];return _0x265c22;};'use strict';var Sequelize=require('sequelize');module[_0xe82c('0x0')]={'name':{'type':Sequelize[_0xe82c('0x1')],'allowNull':![],'unique':_0xe82c('0x2')},'mode':{'type':Sequelize['ENUM'](_0xe82c('0x3'),_0xe82c('0x4'),_0xe82c('0x5'),_0xe82c('0x6'),_0xe82c('0x7'),_0xe82c('0x8')),'allowNull':!![],'defaultValue':_0xe82c('0x4')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0xe82c('0x1')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0xe82c('0x1')],'allowNull':!![],'defaultValue':_0xe82c('0x9')},'format':{'type':Sequelize[_0xe82c('0x1')],'allowNull':!![]},'stamp':{'type':_0xe82c('0xa')},'defaultEntry':{'type':Sequelize[_0xe82c('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x62c9=['mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name','ENUM','custom','files','mp3nb','quietmp3nb','quietmp3'];(function(_0x252d1e,_0x4d28b1){var _0xee5b10=function(_0x39eac7){while(--_0x39eac7){_0x252d1e['push'](_0x252d1e['shift']());}};_0xee5b10(++_0x4d28b1);}(_0x62c9,0x11c));var _0x962c=function(_0x281136,_0x5c5eda){_0x281136=_0x281136-0x0;var _0x567310=_0x62c9[_0x281136];return _0x567310;};'use strict';var Sequelize=require(_0x962c('0x0'));module[_0x962c('0x1')]={'name':{'type':Sequelize[_0x962c('0x2')],'allowNull':![],'unique':_0x962c('0x3')},'mode':{'type':Sequelize[_0x962c('0x4')](_0x962c('0x5'),_0x962c('0x6'),_0x962c('0x7'),_0x962c('0x8'),_0x962c('0x9'),_0x962c('0xa')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x962c('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x962c('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x962c('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x962c('0x2')],'allowNull':!![],'defaultValue':_0x962c('0xb')},'format':{'type':Sequelize[_0x962c('0x2')],'allowNull':!![]},'stamp':{'type':_0x962c('0xc')},'defaultEntry':{'type':Sequelize[_0x962c('0xd')],'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 b4305ec..ed20526 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 _0x955a=['userProfileId','autoAssociation','forEach','unlinkSync','join','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','createdAt','root','server/files/sounds/converted','format','%s.%s','basename','extname','server/files/moh','converted_format','removeSound','id2','getSounds','hasOwnProperty','html-pdf','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','get','MusicOnHolds','UserProfileResource','then','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','params','merge','find','body','catch','create','sequelize','transaction','mode','files','directory','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0xd627c,_0x6e6129){var _0x54378f=function(_0x49cb14){while(--_0x49cb14){_0xd627c['push'](_0xd627c['shift']());}};_0x54378f(++_0x6e6129);}(_0x955a,0x16a));var _0xa955=function(_0x4d87bc,_0x39932f){_0x4d87bc=_0x4d87bc-0x0;var _0x564a90=_0x955a[_0x4d87bc];return _0x564a90;};'use strict';var pdf=require(_0xa955('0x0'));var emlformat=require(_0xa955('0x1'));var rimraf=require(_0xa955('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa955('0x3'));var moment=require(_0xa955('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa955('0x5'));var util=require(_0xa955('0x6'));var path=require(_0xa955('0x7'));var sox=require(_0xa955('0x8'));var csv=require('to-csv');var ejs=require(_0xa955('0x9'));var fs=require('fs');var _=require(_0xa955('0xa'));var squel=require(_0xa955('0xb'));var crypto=require('crypto');var jsforce=require(_0xa955('0xc'));var deskjs=require(_0xa955('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa955('0xe'));var Papa=require(_0xa955('0xf'));var Redis=require('ioredis');var authService=require(_0xa955('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa955('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa955('0x12'))(_0xa955('0x13'));var utils=require(_0xa955('0x14'));var config=require(_0xa955('0x15'));var db=require(_0xa955('0x16'))['db'];function respondWithStatusCode(_0xdfa8a2,_0xd6ba9a){_0xd6ba9a=_0xd6ba9a||0xcc;return function(_0x516c66){if(_0x516c66){return _0xdfa8a2[_0xa955('0x17')](_0xd6ba9a);}return _0xdfa8a2[_0xa955('0x18')](_0xd6ba9a)[_0xa955('0x19')]();};}function respondWithResult(_0x3e41e3,_0x34f749){_0x34f749=_0x34f749||0xc8;return function(_0x1b7800){if(_0x1b7800){return _0x3e41e3[_0xa955('0x18')](_0x34f749)[_0xa955('0x1a')](_0x1b7800);}};}function respondWithFilteredResult(_0x3994e5,_0x524771){return function(_0x2ce44e){if(_0x2ce44e){var _0x3f6c44=_0x2ce44e[_0xa955('0x1b')],_0xcaa0ee=_0x524771[_0xa955('0x1c')],_0x3e4db4=_0x524771[_0xa955('0x1c')]+_0x524771[_0xa955('0x1d')],_0x49276d;if(_0x3e4db4>=_0x3f6c44){_0x3e4db4=_0x3f6c44;_0x49276d=0xc8;}else{_0x49276d=0xce;}_0x3994e5[_0xa955('0x18')](_0x49276d);return _0x3994e5[_0xa955('0x1e')](_0xa955('0x1f'),_0xcaa0ee+'-'+_0x3e4db4+'/'+_0x3f6c44)[_0xa955('0x1a')](_0x2ce44e);}return null;};}function patchUpdates(_0xdd3080){return function(_0xc2b479){try{jsonpatch[_0xa955('0x20')](_0xc2b479,_0xdd3080,!![]);}catch(_0x3aa20f){return BPromise['reject'](_0x3aa20f);}return _0xc2b479[_0xa955('0x21')]();};}function saveUpdates(_0x196122,_0x556c59){return function(_0x27df9e){if(_0x27df9e){return _0x27df9e[_0xa955('0x22')](_0x196122)['then'](function(_0x334854){return _0x334854;});}return null;};}function removeEntity(_0x48ced8,_0x25fd3f){return function(_0x160021){if(_0x160021){return _0x160021[_0xa955('0x23')]()['then'](function(){var _0x18b8af=_0x160021[_0xa955('0x24')]({'plain':!![]});var _0x98c809=_0xa955('0x25');return db[_0xa955('0x26')][_0xa955('0x23')]({'where':{'type':_0x98c809,'resourceId':_0x18b8af['id']}})['then'](function(){return _0x160021;});})[_0xa955('0x27')](function(){_0x48ced8[_0xa955('0x18')](0xcc)[_0xa955('0x19')]();});}};}function handleEntityNotFound(_0x536fa7,_0x5dabba){return function(_0x2e1e44){if(!_0x2e1e44){_0x536fa7[_0xa955('0x17')](0x194);}return _0x2e1e44;};}function handleError(_0x59eec0,_0x5613eb){_0x5613eb=_0x5613eb||0x1f4;return function(_0x184df7){logger[_0xa955('0x28')](_0x184df7[_0xa955('0x29')]);if(_0x184df7['name']){delete _0x184df7[_0xa955('0x2a')];}_0x59eec0['status'](_0x5613eb)[_0xa955('0x2b')](_0x184df7);};}exports[_0xa955('0x2c')]=function(_0x14885b,_0x568fe7){var _0x395372={},_0x4e5e9e={},_0x22f6aa={'count':0x0,'rows':[]};var _0x495b7d=_[_0xa955('0x2d')](db[_0xa955('0x2e')][_0xa955('0x2f')],function(_0x374da0){return{'name':_0x374da0[_0xa955('0x30')],'type':_0x374da0[_0xa955('0x31')][_0xa955('0x32')]};});_0x4e5e9e['model']=_[_0xa955('0x2d')](_0x495b7d,'name');_0x4e5e9e[_0xa955('0x33')]=_[_0xa955('0x34')](_0x14885b['query']);_0x4e5e9e[_0xa955('0x35')]=_[_0xa955('0x36')](_0x4e5e9e[_0xa955('0x37')],_0x4e5e9e[_0xa955('0x33')]);_0x395372[_0xa955('0x38')]=_[_0xa955('0x36')](_0x4e5e9e[_0xa955('0x37')],qs[_0xa955('0x39')](_0x14885b[_0xa955('0x33')][_0xa955('0x39')]));_0x395372[_0xa955('0x38')]=_0x395372[_0xa955('0x38')][_0xa955('0x3a')]?_0x395372[_0xa955('0x38')]:_0x4e5e9e[_0xa955('0x37')];if(!_0x14885b[_0xa955('0x33')]['hasOwnProperty'](_0xa955('0x3b'))){_0x395372[_0xa955('0x1d')]=qs[_0xa955('0x1d')](_0x14885b[_0xa955('0x33')][_0xa955('0x1d')]);_0x395372['offset']=qs[_0xa955('0x1c')](_0x14885b[_0xa955('0x33')]['offset']);}_0x395372['order']=qs[_0xa955('0x3c')](_0x14885b['query'][_0xa955('0x3c')]);_0x395372[_0xa955('0x3d')]=qs[_0xa955('0x35')](_[_0xa955('0x3e')](_0x14885b['query'],_0x4e5e9e[_0xa955('0x35')]));if(_0x14885b[_0xa955('0x33')][_0xa955('0x3f')]){_0x395372['where']=_['merge'](_0x395372['where'],{'$or':_['map'](_0x495b7d,function(_0x5e3dcb){if(_0x5e3dcb['type']!==_0xa955('0x40')){var _0x1be2ea={};_0x1be2ea[_0x5e3dcb['name']]={'$like':'%'+_0x14885b['query']['filter']+'%'};return _0x1be2ea;}})});}_0x395372=_['merge']({},_0x395372,_0x14885b[_0xa955('0x41')]);var _0x31f1f4={'where':_0x395372[_0xa955('0x3d')]};return db[_0xa955('0x2e')][_0xa955('0x1b')](_0x31f1f4)[_0xa955('0x27')](function(_0x1adcc7){_0x22f6aa['count']=_0x1adcc7;if(_0x14885b[_0xa955('0x33')][_0xa955('0x42')]){_0x395372[_0xa955('0x43')]=[{'all':!![]}];}return db[_0xa955('0x2e')][_0xa955('0x44')](_0x395372);})[_0xa955('0x27')](function(_0x346c8c){_0x22f6aa[_0xa955('0x45')]=_0x346c8c;return _0x22f6aa;})['then'](respondWithFilteredResult(_0x568fe7,_0x395372))['catch'](handleError(_0x568fe7,null));};exports[_0xa955('0x46')]=function(_0x211678,_0x4a5693){var _0xf8bc69={'raw':![],'where':{'id':_0x211678[_0xa955('0x47')]['id']}},_0x16c221={};_0x16c221[_0xa955('0x37')]=_[_0xa955('0x34')](db[_0xa955('0x2e')][_0xa955('0x2f')]);_0x16c221[_0xa955('0x33')]=_[_0xa955('0x34')](_0x211678['query']);_0x16c221[_0xa955('0x35')]=_[_0xa955('0x36')](_0x16c221[_0xa955('0x37')],_0x16c221[_0xa955('0x33')]);_0xf8bc69[_0xa955('0x38')]=_[_0xa955('0x36')](_0x16c221[_0xa955('0x37')],qs['fields'](_0x211678[_0xa955('0x33')]['fields']));_0xf8bc69[_0xa955('0x38')]=_0xf8bc69[_0xa955('0x38')]['length']?_0xf8bc69[_0xa955('0x38')]:_0x16c221['model'];if(_0x211678[_0xa955('0x33')][_0xa955('0x42')]){_0xf8bc69[_0xa955('0x43')]=[{'all':!![]}];}_0xf8bc69=_[_0xa955('0x48')]({},_0xf8bc69,_0x211678[_0xa955('0x41')]);return db[_0xa955('0x2e')][_0xa955('0x49')](_0xf8bc69)[_0xa955('0x27')](handleEntityNotFound(_0x4a5693,null))[_0xa955('0x27')](respondWithResult(_0x4a5693,null))['catch'](handleError(_0x4a5693,null));};exports[_0xa955('0x22')]=function(_0x57f854,_0x4d599b){if(_0x57f854[_0xa955('0x4a')]['id']){delete _0x57f854['body']['id'];}return db[_0xa955('0x2e')][_0xa955('0x49')]({'where':{'id':_0x57f854['params']['id']}})[_0xa955('0x27')](handleEntityNotFound(_0x4d599b,null))[_0xa955('0x27')](saveUpdates(_0x57f854[_0xa955('0x4a')],null))[_0xa955('0x27')](respondWithResult(_0x4d599b,null))[_0xa955('0x4b')](handleError(_0x4d599b,null));};exports[_0xa955('0x4c')]=function(_0x2f5be8,_0x17d118,_0x5bd994){return db[_0xa955('0x4d')][_0xa955('0x4e')](function(_0x58509d){if(_0x2f5be8[_0xa955('0x4a')][_0xa955('0x4f')]===_0xa955('0x50')){_0x2f5be8['body'][_0xa955('0x51')]=path['join'](config['root'],'server/files/moh',_0x2f5be8[_0xa955('0x4a')][_0xa955('0x2a')]);}return db['VoiceMusicOnHold']['create'](_0x2f5be8[_0xa955('0x4a')],{'transaction':_0x58509d})['then'](function(_0x28c065){if(_0x2f5be8[_0xa955('0x4a')]['mode']===_0xa955('0x50')){fs[_0xa955('0x52')](_0x28c065['directory'],parseInt(_0xa955('0x53'),0x8));}var _0x1f1dbc=_0x2f5be8[_0xa955('0x54')][_0xa955('0x24')]({'plain':!![]});if(!_0x1f1dbc)throw new Error(_0xa955('0x55'));if(_0x1f1dbc['role']==='user'){var _0x30d590=_0x28c065[_0xa955('0x24')]({'plain':!![]});return db['UserProfileSection'][_0xa955('0x49')]({'where':{'name':_0xa955('0x25'),'userProfileId':_0x1f1dbc[_0xa955('0x56')]},'raw':!![]})['then'](function(_0x54382f){if(_0x54382f&&_0x54382f[_0xa955('0x57')]===0x0){return db[_0xa955('0x26')][_0xa955('0x4c')]({'name':_0x30d590[_0xa955('0x2a')],'resourceId':_0x30d590['id'],'type':_0x54382f['name'],'sectionId':_0x54382f['id']},{})[_0xa955('0x27')](function(){return _0x28c065;});}else{return _0x28c065;}})[_0xa955('0x4b')](function(_0x2922c6){logger[_0xa955('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2922c6);});}return _0x28c065;});})[_0xa955('0x27')](respondWithResult(_0x17d118,0xc9))[_0xa955('0x4b')](handleError(_0x17d118,null));};exports[_0xa955('0x23')]=function(_0x5c3290,_0x7eb7df,_0x21394b){var _0x19af00;return db[_0xa955('0x2e')][_0xa955('0x49')]({'where':{'id':_0x5c3290[_0xa955('0x47')]['id']}})[_0xa955('0x27')](function(_0x41e6ef){if(_0x41e6ef){return db['sequelize']['transaction'](function(_0x5ea4da){return _0x41e6ef[_0xa955('0x23')]({'transaction':_0x5ea4da,'raw':!![]})['then'](function(_0x200a75){if(_0x200a75[_0xa955('0x51')]){fs['readdirSync'](_0x200a75[_0xa955('0x51')])[_0xa955('0x58')](function(_0x580185){fs[_0xa955('0x59')](path[_0xa955('0x5a')](_0x200a75[_0xa955('0x51')],_0x580185));});fs[_0xa955('0x5b')](_0x200a75[_0xa955('0x51')]);}return _0x200a75;});})[_0xa955('0x4b')](function(_0x339e9c){throw new db[(_0xa955('0x5c'))][(_0xa955('0x5d'))](_0x339e9c[_0xa955('0x5e')]);});}})[_0xa955('0x27')](handleEntityNotFound(_0x7eb7df,null))['then'](removeEntity(_0x7eb7df,null))['catch'](handleError(_0x7eb7df,null));};exports[_0xa955('0x5f')]=function(_0x4bf543,_0x52a57a,_0x3f84e2){return db['sequelize'][_0xa955('0x4e')](function(_0x5cee04){var _0x2e32f8;return db[_0xa955('0x2e')][_0xa955('0x49')]({'where':{'id':_0x4bf543[_0xa955('0x47')]['id']}})[_0xa955('0x27')](function(_0x2052c0){if(_0x2052c0){_0x2e32f8=_0x2052c0;return _0x2052c0['addSound'](_0x4bf543[_0xa955('0x4a')]['id'],{'transaction':_0x5cee04});}})[_0xa955('0x27')](function(_0x530609){if(_0x530609){return db[_0xa955('0x60')][_0xa955('0x61')]({'where':{'id':_0x4bf543[_0xa955('0x4a')]['id']},'attributes':['id',_0xa955('0x2a'),_0xa955('0x62'),'converted_format',_0xa955('0x63')],'raw':!![]});}})['then'](function(_0x19f5b7){if(_0x19f5b7){var _0x3916e0=path['join'](config[_0xa955('0x64')],_0xa955('0x65'),util[_0xa955('0x66')](_0xa955('0x67'),path[_0xa955('0x68')](_0x19f5b7[_0xa955('0x62')],path[_0xa955('0x69')](_0x19f5b7[_0xa955('0x62')])),_0x19f5b7['converted_format']));var _0xa0e04d=path['join'](config[_0xa955('0x64')],_0xa955('0x6a'),_0x2e32f8[_0xa955('0x2a')],util['format'](_0xa955('0x67'),_0x19f5b7[_0xa955('0x2a')],_0x19f5b7[_0xa955('0x6b')]));fs['symlinkSync'](_0x3916e0,_0xa0e04d);return _0x19f5b7;}})[_0xa955('0x4b')](function(_0x1dffa7){throw new db[(_0xa955('0x5c'))][(_0xa955('0x5d'))](_0x1dffa7[_0xa955('0x5e')]);});})['then'](handleEntityNotFound(_0x52a57a,null))[_0xa955('0x27')](respondWithResult(_0x52a57a,0xc9))[_0xa955('0x4b')](handleError(_0x52a57a,null));};exports['removeSound']=function(_0xdd3a72,_0x39f534,_0x5c3492){return db[_0xa955('0x4d')][_0xa955('0x4e')](function(_0x44d032){var _0x30728f;return db[_0xa955('0x2e')][_0xa955('0x61')]({'where':{'id':_0xdd3a72['params']['id']}})[_0xa955('0x27')](handleEntityNotFound(_0x39f534,null))[_0xa955('0x27')](function(_0x2f19c3){if(_0x2f19c3){_0x30728f=_0x2f19c3;return _0x2f19c3[_0xa955('0x6c')](_0xdd3a72[_0xa955('0x47')][_0xa955('0x6d')]);}})[_0xa955('0x27')](function(_0x1adf5c){if(_0x1adf5c){return db['Sound']['findOne']({'where':{'id':_0xdd3a72[_0xa955('0x47')]['id2']},'attributes':['id',_0xa955('0x2a'),'save_name',_0xa955('0x6b'),'createdAt'],'raw':!![]});}})[_0xa955('0x27')](function(_0x5ae34f){if(_0x5ae34f){fs[_0xa955('0x59')](path[_0xa955('0x5a')](_0x30728f[_0xa955('0x51')],util[_0xa955('0x66')]('%s.%s',_0x5ae34f[_0xa955('0x2a')],_0x5ae34f[_0xa955('0x6b')])));return _0x5ae34f;}})[_0xa955('0x4b')](function(_0x412a7a){throw new db['Sequelize'][(_0xa955('0x5d'))](_0x412a7a['message']);});})[_0xa955('0x27')](handleEntityNotFound(_0x39f534,null))[_0xa955('0x27')](respondWithStatusCode(_0x39f534,0xcc))['catch'](handleError(_0x39f534,null));};exports[_0xa955('0x6e')]=function(_0x1cb4ce,_0x1408d3,_0xa31e1f){var _0x25e3eb={};var _0xfe396c={};var _0x440dc1;var _0x3a53ce;return db[_0xa955('0x2e')][_0xa955('0x61')]({'where':{'id':_0x1cb4ce[_0xa955('0x47')]['id']}})['then'](handleEntityNotFound(_0x1408d3,null))['then'](function(_0x7a16ef){if(_0x7a16ef){_0x440dc1=_0x7a16ef;_0xfe396c[_0xa955('0x37')]=_[_0xa955('0x34')](db[_0xa955('0x60')][_0xa955('0x2f')]);_0xfe396c['query']=_['keys'](_0x1cb4ce['query']);_0xfe396c[_0xa955('0x35')]=_[_0xa955('0x36')](_0xfe396c['model'],_0xfe396c[_0xa955('0x33')]);_0x25e3eb[_0xa955('0x38')]=_['intersection'](_0xfe396c['model'],qs[_0xa955('0x39')](_0x1cb4ce[_0xa955('0x33')][_0xa955('0x39')]));_0x25e3eb[_0xa955('0x38')]=_0x25e3eb[_0xa955('0x38')][_0xa955('0x3a')]?_0x25e3eb[_0xa955('0x38')]:_0xfe396c['model'];_0x25e3eb['order']=qs[_0xa955('0x3c')](_0x1cb4ce[_0xa955('0x33')][_0xa955('0x3c')]);_0x25e3eb[_0xa955('0x3d')]=qs[_0xa955('0x35')](_['pick'](_0x1cb4ce['query'],_0xfe396c[_0xa955('0x35')]));if(_0x1cb4ce[_0xa955('0x33')]['filter']){_0x25e3eb['where']=_[_0xa955('0x48')](_0x25e3eb[_0xa955('0x3d')],{'$or':_[_0xa955('0x2d')](_0x25e3eb[_0xa955('0x38')],function(_0x45a318){var _0x46d7e5={};_0x46d7e5[_0x45a318]={'$like':'%'+_0x1cb4ce[_0xa955('0x33')][_0xa955('0x3f')]+'%'};return _0x46d7e5;})});}_0x25e3eb=_['merge']({},_0x25e3eb,_0x1cb4ce['options']);return _0x440dc1['getSounds'](_0x25e3eb);}})[_0xa955('0x27')](function(_0x783050){if(_0x783050){_0x3a53ce=_0x783050[_0xa955('0x3a')];if(!_0x1cb4ce[_0xa955('0x33')][_0xa955('0x6f')](_0xa955('0x3b'))){_0x25e3eb[_0xa955('0x1d')]=qs[_0xa955('0x1d')](_0x1cb4ce[_0xa955('0x33')]['limit']);_0x25e3eb[_0xa955('0x1c')]=qs[_0xa955('0x1c')](_0x1cb4ce[_0xa955('0x33')]['offset']);}return _0x440dc1[_0xa955('0x6e')](_0x25e3eb);}})[_0xa955('0x27')](function(_0x3f8e87){if(_0x3f8e87){return _0x3f8e87?{'count':_0x3a53ce,'rows':_0x3f8e87}:null;}})[_0xa955('0x27')](respondWithResult(_0x1408d3,null))[_0xa955('0x4b')](handleError(_0x1408d3,null));}; \ No newline at end of file +var _0xa5d0=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','rmdirSync','ValidationError','addSound','Sound','findOne','save_name','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','Sequelize','message','id2','converted_format','createdAt','unlinkSync','getSounds','nolimit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','squel','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','sort','pick','where','VIRTUAL','filter','merge','options','VoiceMusicOnHold','includeAll','include','findAll','rows','catch','params','find','body','create','sequelize','transaction','mode','files','join','root','server/files/moh','mkdirSync','directory'];(function(_0x569caa,_0x5174ce){var _0x44cb5a=function(_0x456df4){while(--_0x456df4){_0x569caa['push'](_0x569caa['shift']());}};_0x44cb5a(++_0x5174ce);}(_0xa5d0,0x1dc));var _0x0a5d=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa5d0[_0x37bd26];return _0xe83dc4;};'use strict';var pdf=require(_0x0a5d('0x0'));var emlformat=require(_0x0a5d('0x1'));var rimraf=require(_0x0a5d('0x2'));var zipdir=require(_0x0a5d('0x3'));var jsonpatch=require(_0x0a5d('0x4'));var rp=require(_0x0a5d('0x5'));var moment=require(_0x0a5d('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0a5d('0x7'));var path=require(_0x0a5d('0x8'));var sox=require(_0x0a5d('0x9'));var csv=require('to-csv');var ejs=require(_0x0a5d('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0a5d('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a5d('0xc'));var toCsv=require(_0x0a5d('0xd'));var querystring=require(_0x0a5d('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0a5d('0xf'));var qs=require(_0x0a5d('0x10'));var as=require(_0x0a5d('0x11'));var hardwareService=require(_0x0a5d('0x12'));var logger=require(_0x0a5d('0x13'))(_0x0a5d('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a5d('0x15'))['db'];function respondWithStatusCode(_0x2f08ca,_0x1c21d6){_0x1c21d6=_0x1c21d6||0xcc;return function(_0xe1bc37){if(_0xe1bc37){return _0x2f08ca[_0x0a5d('0x16')](_0x1c21d6);}return _0x2f08ca[_0x0a5d('0x17')](_0x1c21d6)[_0x0a5d('0x18')]();};}function respondWithResult(_0x40cd83,_0x193888){_0x193888=_0x193888||0xc8;return function(_0x2c7c5b){if(_0x2c7c5b){return _0x40cd83[_0x0a5d('0x17')](_0x193888)[_0x0a5d('0x19')](_0x2c7c5b);}};}function respondWithFilteredResult(_0x2788d5,_0x4ce8f4){return function(_0xdc6ef9){if(_0xdc6ef9){var _0x531de0=_0xdc6ef9[_0x0a5d('0x1a')],_0x427a41=_0x4ce8f4['offset'],_0x4b4c7b=_0x4ce8f4[_0x0a5d('0x1b')]+_0x4ce8f4['limit'],_0x45b5fc;if(_0x4b4c7b>=_0x531de0){_0x4b4c7b=_0x531de0;_0x45b5fc=0xc8;}else{_0x45b5fc=0xce;}_0x2788d5[_0x0a5d('0x17')](_0x45b5fc);return _0x2788d5[_0x0a5d('0x1c')](_0x0a5d('0x1d'),_0x427a41+'-'+_0x4b4c7b+'/'+_0x531de0)[_0x0a5d('0x19')](_0xdc6ef9);}return null;};}function patchUpdates(_0xb91f33){return function(_0x3eeef1){try{jsonpatch[_0x0a5d('0x1e')](_0x3eeef1,_0xb91f33,!![]);}catch(_0x5733a5){return BPromise[_0x0a5d('0x1f')](_0x5733a5);}return _0x3eeef1[_0x0a5d('0x20')]();};}function saveUpdates(_0x262e55,_0x6301a8){return function(_0xcca3f0){if(_0xcca3f0){return _0xcca3f0[_0x0a5d('0x21')](_0x262e55)['then'](function(_0x2e07df){return _0x2e07df;});}return null;};}function removeEntity(_0x1dd1e4,_0x272147){return function(_0x112204){if(_0x112204){return _0x112204[_0x0a5d('0x22')]()[_0x0a5d('0x23')](function(){var _0x4fcd2b=_0x112204[_0x0a5d('0x24')]({'plain':!![]});var _0xb779b8='MusicOnHolds';return db[_0x0a5d('0x25')][_0x0a5d('0x22')]({'where':{'type':_0xb779b8,'resourceId':_0x4fcd2b['id']}})[_0x0a5d('0x23')](function(){return _0x112204;});})[_0x0a5d('0x23')](function(){_0x1dd1e4['status'](0xcc)[_0x0a5d('0x18')]();});}};}function handleEntityNotFound(_0x3a3d4b,_0x2d1749){return function(_0x5724e7){if(!_0x5724e7){_0x3a3d4b[_0x0a5d('0x16')](0x194);}return _0x5724e7;};}function handleError(_0x409556,_0x538249){_0x538249=_0x538249||0x1f4;return function(_0x3f4823){logger[_0x0a5d('0x26')](_0x3f4823[_0x0a5d('0x27')]);if(_0x3f4823[_0x0a5d('0x28')]){delete _0x3f4823[_0x0a5d('0x28')];}_0x409556['status'](_0x538249)[_0x0a5d('0x29')](_0x3f4823);};}exports[_0x0a5d('0x2a')]=function(_0x331891,_0x4dd239){var _0x46e626={},_0x4bce2d={},_0x44f067={'count':0x0,'rows':[]};var _0x445d0c=_[_0x0a5d('0x2b')](db['VoiceMusicOnHold'][_0x0a5d('0x2c')],function(_0x4b5360){return{'name':_0x4b5360[_0x0a5d('0x2d')],'type':_0x4b5360[_0x0a5d('0x2e')][_0x0a5d('0x2f')]};});_0x4bce2d[_0x0a5d('0x30')]=_[_0x0a5d('0x2b')](_0x445d0c,_0x0a5d('0x28'));_0x4bce2d[_0x0a5d('0x31')]=_[_0x0a5d('0x32')](_0x331891['query']);_0x4bce2d[_0x0a5d('0x33')]=_[_0x0a5d('0x34')](_0x4bce2d[_0x0a5d('0x30')],_0x4bce2d[_0x0a5d('0x31')]);_0x46e626['attributes']=_[_0x0a5d('0x34')](_0x4bce2d[_0x0a5d('0x30')],qs[_0x0a5d('0x35')](_0x331891[_0x0a5d('0x31')][_0x0a5d('0x35')]));_0x46e626[_0x0a5d('0x36')]=_0x46e626[_0x0a5d('0x36')][_0x0a5d('0x37')]?_0x46e626[_0x0a5d('0x36')]:_0x4bce2d['model'];if(!_0x331891[_0x0a5d('0x31')][_0x0a5d('0x38')]('nolimit')){_0x46e626[_0x0a5d('0x39')]=qs[_0x0a5d('0x39')](_0x331891[_0x0a5d('0x31')][_0x0a5d('0x39')]);_0x46e626[_0x0a5d('0x1b')]=qs['offset'](_0x331891[_0x0a5d('0x31')][_0x0a5d('0x1b')]);}_0x46e626['order']=qs[_0x0a5d('0x3a')](_0x331891[_0x0a5d('0x31')][_0x0a5d('0x3a')]);_0x46e626['where']=qs['filters'](_[_0x0a5d('0x3b')](_0x331891['query'],_0x4bce2d['filters']));if(_0x331891[_0x0a5d('0x31')]['filter']){_0x46e626[_0x0a5d('0x3c')]=_['merge'](_0x46e626['where'],{'$or':_[_0x0a5d('0x2b')](_0x445d0c,function(_0x823af9){if(_0x823af9['type']!==_0x0a5d('0x3d')){var _0x328849={};_0x328849[_0x823af9[_0x0a5d('0x28')]]={'$like':'%'+_0x331891[_0x0a5d('0x31')][_0x0a5d('0x3e')]+'%'};return _0x328849;}})});}_0x46e626=_[_0x0a5d('0x3f')]({},_0x46e626,_0x331891[_0x0a5d('0x40')]);var _0x317321={'where':_0x46e626['where']};return db[_0x0a5d('0x41')]['count'](_0x317321)['then'](function(_0x55c8df){_0x44f067[_0x0a5d('0x1a')]=_0x55c8df;if(_0x331891['query'][_0x0a5d('0x42')]){_0x46e626[_0x0a5d('0x43')]=[{'all':!![]}];}return db[_0x0a5d('0x41')][_0x0a5d('0x44')](_0x46e626);})[_0x0a5d('0x23')](function(_0x2e1f3b){_0x44f067[_0x0a5d('0x45')]=_0x2e1f3b;return _0x44f067;})[_0x0a5d('0x23')](respondWithFilteredResult(_0x4dd239,_0x46e626))[_0x0a5d('0x46')](handleError(_0x4dd239,null));};exports['show']=function(_0x5ee342,_0x19e3d7){var _0xed7ac={'raw':![],'where':{'id':_0x5ee342[_0x0a5d('0x47')]['id']}},_0x3face9={};_0x3face9[_0x0a5d('0x30')]=_[_0x0a5d('0x32')](db[_0x0a5d('0x41')][_0x0a5d('0x2c')]);_0x3face9[_0x0a5d('0x31')]=_[_0x0a5d('0x32')](_0x5ee342[_0x0a5d('0x31')]);_0x3face9[_0x0a5d('0x33')]=_['intersection'](_0x3face9[_0x0a5d('0x30')],_0x3face9['query']);_0xed7ac[_0x0a5d('0x36')]=_[_0x0a5d('0x34')](_0x3face9[_0x0a5d('0x30')],qs[_0x0a5d('0x35')](_0x5ee342['query'][_0x0a5d('0x35')]));_0xed7ac[_0x0a5d('0x36')]=_0xed7ac[_0x0a5d('0x36')]['length']?_0xed7ac[_0x0a5d('0x36')]:_0x3face9['model'];if(_0x5ee342[_0x0a5d('0x31')][_0x0a5d('0x42')]){_0xed7ac[_0x0a5d('0x43')]=[{'all':!![]}];}_0xed7ac=_[_0x0a5d('0x3f')]({},_0xed7ac,_0x5ee342[_0x0a5d('0x40')]);return db[_0x0a5d('0x41')][_0x0a5d('0x48')](_0xed7ac)[_0x0a5d('0x23')](handleEntityNotFound(_0x19e3d7,null))[_0x0a5d('0x23')](respondWithResult(_0x19e3d7,null))['catch'](handleError(_0x19e3d7,null));};exports[_0x0a5d('0x21')]=function(_0x20a8a8,_0x34c6c8){if(_0x20a8a8[_0x0a5d('0x49')]['id']){delete _0x20a8a8[_0x0a5d('0x49')]['id'];}return db[_0x0a5d('0x41')][_0x0a5d('0x48')]({'where':{'id':_0x20a8a8[_0x0a5d('0x47')]['id']}})['then'](handleEntityNotFound(_0x34c6c8,null))[_0x0a5d('0x23')](saveUpdates(_0x20a8a8[_0x0a5d('0x49')],null))[_0x0a5d('0x23')](respondWithResult(_0x34c6c8,null))[_0x0a5d('0x46')](handleError(_0x34c6c8,null));};exports[_0x0a5d('0x4a')]=function(_0x4f92db,_0x59b4b4,_0xd8bbf4){return db[_0x0a5d('0x4b')][_0x0a5d('0x4c')](function(_0x25f9f9){if(_0x4f92db[_0x0a5d('0x49')][_0x0a5d('0x4d')]===_0x0a5d('0x4e')){_0x4f92db['body']['directory']=path[_0x0a5d('0x4f')](config[_0x0a5d('0x50')],_0x0a5d('0x51'),_0x4f92db['body']['name']);}return db[_0x0a5d('0x41')]['create'](_0x4f92db['body'],{'transaction':_0x25f9f9})[_0x0a5d('0x23')](function(_0x433148){if(_0x4f92db[_0x0a5d('0x49')][_0x0a5d('0x4d')]===_0x0a5d('0x4e')){fs[_0x0a5d('0x52')](_0x433148[_0x0a5d('0x53')],parseInt('0777',0x8));}var _0x46bf35=_0x4f92db[_0x0a5d('0x54')][_0x0a5d('0x24')]({'plain':!![]});if(!_0x46bf35)throw new Error(_0x0a5d('0x55'));if(_0x46bf35[_0x0a5d('0x56')]===_0x0a5d('0x54')){var _0x179420=_0x433148['get']({'plain':!![]});return db[_0x0a5d('0x57')][_0x0a5d('0x48')]({'where':{'name':'MusicOnHolds','userProfileId':_0x46bf35[_0x0a5d('0x58')]},'raw':!![]})['then'](function(_0x398320){if(_0x398320&&_0x398320[_0x0a5d('0x59')]===0x0){return db[_0x0a5d('0x25')]['create']({'name':_0x179420['name'],'resourceId':_0x179420['id'],'type':_0x398320['name'],'sectionId':_0x398320['id']},{})[_0x0a5d('0x23')](function(){return _0x433148;});}else{return _0x433148;}})['catch'](function(_0x4071c8){logger[_0x0a5d('0x26')](_0x0a5d('0x5a'),_0x4071c8);});}return _0x433148;});})['then'](respondWithResult(_0x59b4b4,0xc9))[_0x0a5d('0x46')](handleError(_0x59b4b4,null));};exports['destroy']=function(_0x21416c,_0x4002e8,_0x1cabd5){var _0x35faab;return db[_0x0a5d('0x41')][_0x0a5d('0x48')]({'where':{'id':_0x21416c[_0x0a5d('0x47')]['id']}})[_0x0a5d('0x23')](function(_0x41d32f){if(_0x41d32f){return db['sequelize'][_0x0a5d('0x4c')](function(_0x2cd386){return _0x41d32f[_0x0a5d('0x22')]({'transaction':_0x2cd386,'raw':!![]})['then'](function(_0x4df244){if(_0x4df244['directory']){fs[_0x0a5d('0x5b')](_0x4df244['directory'])['forEach'](function(_0x457c37){fs['unlinkSync'](path[_0x0a5d('0x4f')](_0x4df244[_0x0a5d('0x53')],_0x457c37));});fs[_0x0a5d('0x5c')](_0x4df244['directory']);}return _0x4df244;});})['catch'](function(_0x4bd69d){throw new db['Sequelize'][(_0x0a5d('0x5d'))](_0x4bd69d['message']);});}})['then'](handleEntityNotFound(_0x4002e8,null))[_0x0a5d('0x23')](removeEntity(_0x4002e8,null))['catch'](handleError(_0x4002e8,null));};exports[_0x0a5d('0x5e')]=function(_0xe65440,_0x2f63f5,_0x31febf){return db[_0x0a5d('0x4b')][_0x0a5d('0x4c')](function(_0x163219){var _0x16f1b7;return db[_0x0a5d('0x41')][_0x0a5d('0x48')]({'where':{'id':_0xe65440[_0x0a5d('0x47')]['id']}})[_0x0a5d('0x23')](function(_0x57cfbe){if(_0x57cfbe){_0x16f1b7=_0x57cfbe;return _0x57cfbe['addSound'](_0xe65440[_0x0a5d('0x49')]['id'],{'transaction':_0x163219});}})[_0x0a5d('0x23')](function(_0x4e5db9){if(_0x4e5db9){return db[_0x0a5d('0x5f')][_0x0a5d('0x60')]({'where':{'id':_0xe65440['body']['id']},'attributes':['id','name',_0x0a5d('0x61'),'converted_format','createdAt'],'raw':!![]});}})[_0x0a5d('0x23')](function(_0x237738){if(_0x237738){var _0x5c4c27=path[_0x0a5d('0x4f')](config['root'],_0x0a5d('0x62'),util[_0x0a5d('0x63')](_0x0a5d('0x64'),path[_0x0a5d('0x65')](_0x237738[_0x0a5d('0x61')],path[_0x0a5d('0x66')](_0x237738[_0x0a5d('0x61')])),_0x237738['converted_format']));var _0x575ddf=path[_0x0a5d('0x4f')](config[_0x0a5d('0x50')],_0x0a5d('0x51'),_0x16f1b7[_0x0a5d('0x28')],util[_0x0a5d('0x63')](_0x0a5d('0x64'),_0x237738[_0x0a5d('0x28')],_0x237738['converted_format']));fs[_0x0a5d('0x67')](_0x5c4c27,_0x575ddf);return _0x237738;}})[_0x0a5d('0x46')](function(_0x11efd4){throw new db[(_0x0a5d('0x68'))]['ValidationError'](_0x11efd4[_0x0a5d('0x69')]);});})[_0x0a5d('0x23')](handleEntityNotFound(_0x2f63f5,null))[_0x0a5d('0x23')](respondWithResult(_0x2f63f5,0xc9))[_0x0a5d('0x46')](handleError(_0x2f63f5,null));};exports['removeSound']=function(_0x5a5aec,_0x2c14f5,_0x261bea){return db[_0x0a5d('0x4b')]['transaction'](function(_0x37d444){var _0x2b632b;return db[_0x0a5d('0x41')]['findOne']({'where':{'id':_0x5a5aec[_0x0a5d('0x47')]['id']}})['then'](handleEntityNotFound(_0x2c14f5,null))[_0x0a5d('0x23')](function(_0x1d8384){if(_0x1d8384){_0x2b632b=_0x1d8384;return _0x1d8384['removeSound'](_0x5a5aec[_0x0a5d('0x47')][_0x0a5d('0x6a')]);}})[_0x0a5d('0x23')](function(_0x91fc91){if(_0x91fc91){return db[_0x0a5d('0x5f')][_0x0a5d('0x60')]({'where':{'id':_0x5a5aec[_0x0a5d('0x47')][_0x0a5d('0x6a')]},'attributes':['id',_0x0a5d('0x28'),_0x0a5d('0x61'),_0x0a5d('0x6b'),_0x0a5d('0x6c')],'raw':!![]});}})[_0x0a5d('0x23')](function(_0x30a33d){if(_0x30a33d){fs[_0x0a5d('0x6d')](path[_0x0a5d('0x4f')](_0x2b632b[_0x0a5d('0x53')],util[_0x0a5d('0x63')](_0x0a5d('0x64'),_0x30a33d[_0x0a5d('0x28')],_0x30a33d[_0x0a5d('0x6b')])));return _0x30a33d;}})[_0x0a5d('0x46')](function(_0x186952){throw new db[(_0x0a5d('0x68'))][(_0x0a5d('0x5d'))](_0x186952[_0x0a5d('0x69')]);});})['then'](handleEntityNotFound(_0x2c14f5,null))[_0x0a5d('0x23')](respondWithStatusCode(_0x2c14f5,0xcc))[_0x0a5d('0x46')](handleError(_0x2c14f5,null));};exports[_0x0a5d('0x6e')]=function(_0x5e825c,_0x85319e,_0x30445d){var _0x437ed0={};var _0x1ea18c={};var _0x3a3883;var _0x216c42;return db[_0x0a5d('0x41')][_0x0a5d('0x60')]({'where':{'id':_0x5e825c['params']['id']}})[_0x0a5d('0x23')](handleEntityNotFound(_0x85319e,null))['then'](function(_0x2f9f6a){if(_0x2f9f6a){_0x3a3883=_0x2f9f6a;_0x1ea18c[_0x0a5d('0x30')]=_[_0x0a5d('0x32')](db[_0x0a5d('0x5f')][_0x0a5d('0x2c')]);_0x1ea18c[_0x0a5d('0x31')]=_[_0x0a5d('0x32')](_0x5e825c[_0x0a5d('0x31')]);_0x1ea18c[_0x0a5d('0x33')]=_[_0x0a5d('0x34')](_0x1ea18c[_0x0a5d('0x30')],_0x1ea18c[_0x0a5d('0x31')]);_0x437ed0[_0x0a5d('0x36')]=_['intersection'](_0x1ea18c[_0x0a5d('0x30')],qs[_0x0a5d('0x35')](_0x5e825c[_0x0a5d('0x31')]['fields']));_0x437ed0['attributes']=_0x437ed0[_0x0a5d('0x36')][_0x0a5d('0x37')]?_0x437ed0[_0x0a5d('0x36')]:_0x1ea18c[_0x0a5d('0x30')];_0x437ed0['order']=qs[_0x0a5d('0x3a')](_0x5e825c[_0x0a5d('0x31')][_0x0a5d('0x3a')]);_0x437ed0['where']=qs['filters'](_[_0x0a5d('0x3b')](_0x5e825c[_0x0a5d('0x31')],_0x1ea18c[_0x0a5d('0x33')]));if(_0x5e825c[_0x0a5d('0x31')][_0x0a5d('0x3e')]){_0x437ed0['where']=_[_0x0a5d('0x3f')](_0x437ed0[_0x0a5d('0x3c')],{'$or':_[_0x0a5d('0x2b')](_0x437ed0[_0x0a5d('0x36')],function(_0x34e736){var _0x106377={};_0x106377[_0x34e736]={'$like':'%'+_0x5e825c[_0x0a5d('0x31')][_0x0a5d('0x3e')]+'%'};return _0x106377;})});}_0x437ed0=_['merge']({},_0x437ed0,_0x5e825c['options']);return _0x3a3883[_0x0a5d('0x6e')](_0x437ed0);}})[_0x0a5d('0x23')](function(_0x1c182e){if(_0x1c182e){_0x216c42=_0x1c182e[_0x0a5d('0x37')];if(!_0x5e825c[_0x0a5d('0x31')][_0x0a5d('0x38')](_0x0a5d('0x6f'))){_0x437ed0[_0x0a5d('0x39')]=qs[_0x0a5d('0x39')](_0x5e825c[_0x0a5d('0x31')][_0x0a5d('0x39')]);_0x437ed0[_0x0a5d('0x1b')]=qs['offset'](_0x5e825c[_0x0a5d('0x31')][_0x0a5d('0x1b')]);}return _0x3a3883[_0x0a5d('0x6e')](_0x437ed0);}})[_0x0a5d('0x23')](function(_0x276051){if(_0x276051){return _0x276051?{'count':_0x216c42,'rows':_0x276051}:null;}})[_0x0a5d('0x23')](respondWithResult(_0x85319e,null))[_0x0a5d('0x46')](handleError(_0x85319e,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index ad8ae94..b9cc3f7 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 _0x1e60=['../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0xf6df82,_0xcbfd66){var _0x1dd75d=function(_0x182995){while(--_0x182995){_0xf6df82['push'](_0xf6df82['shift']());}};_0x1dd75d(++_0xcbfd66);}(_0x1e60,0x172));var _0x01e6=function(_0x5cfa35,_0x5eb7f0){_0x5cfa35=_0x5cfa35-0x0;var _0xf7dffb=_0x1e60[_0x5cfa35];return _0xf7dffb;};'use strict';var _=require(_0x01e6('0x0'));var util=require(_0x01e6('0x1'));var logger=require(_0x01e6('0x2'))(_0x01e6('0x3'));var moment=require(_0x01e6('0x4'));var BPromise=require(_0x01e6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x01e6('0x6'));var rimraf=require('rimraf');var config=require(_0x01e6('0x7'));var attributes=require(_0x01e6('0x8'));module[_0x01e6('0x9')]=function(_0x1f5363,_0xa5a375){return _0x1f5363[_0x01e6('0xa')](_0x01e6('0xb'),attributes,{'tableName':_0x01e6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x64fb=['rimraf','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x1aefde,_0x3ff306){var _0x4f48ef=function(_0x364603){while(--_0x364603){_0x1aefde['push'](_0x1aefde['shift']());}};_0x4f48ef(++_0x3ff306);}(_0x64fb,0x118));var _0xb64f=function(_0x382cbd,_0xa09c25){_0x382cbd=_0x382cbd-0x0;var _0x175a1e=_0x64fb[_0x382cbd];return _0x175a1e;};'use strict';var _=require(_0xb64f('0x0'));var util=require(_0xb64f('0x1'));var logger=require(_0xb64f('0x2'))('api');var moment=require(_0xb64f('0x3'));var BPromise=require(_0xb64f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb64f('0x5'));var rimraf=require(_0xb64f('0x6'));var config=require('../../config/environment');var attributes=require(_0xb64f('0x7'));module[_0xb64f('0x8')]=function(_0x4efef3,_0x4de713){return _0x4efef3[_0xb64f('0x9')](_0xb64f('0xa'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 27cd763..8f535ec 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 _0x44ff=['request','then','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x43c8e3,_0x4ca925){var _0x4dba22=function(_0x5a0d45){while(--_0x5a0d45){_0x43c8e3['push'](_0x43c8e3['shift']());}};_0x4dba22(++_0x4ca925);}(_0x44ff,0x1d6));var _0xf44f=function(_0x23014e,_0x27cb16){_0x23014e=_0x23014e-0x0;var _0x41fe28=_0x44ff[_0x23014e];return _0x41fe28;};'use strict';var _=require(_0xf44f('0x0'));var util=require(_0xf44f('0x1'));var moment=require(_0xf44f('0x2'));var BPromise=require(_0xf44f('0x3'));var rs=require(_0xf44f('0x4'));var fs=require('fs');var Redis=require(_0xf44f('0x5'));var db=require(_0xf44f('0x6'))['db'];var utils=require(_0xf44f('0x7'));var logger=require(_0xf44f('0x8'))('rpc');var config=require(_0xf44f('0x9'));var jayson=require(_0xf44f('0xa'));var client=jayson[_0xf44f('0xb')][_0xf44f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4ae97e,_0x10329d,_0x19bdd1){return new BPromise(function(_0x599f27,_0x19c21f){return client[_0xf44f('0xd')](_0x4ae97e,_0x19bdd1)[_0xf44f('0xe')](function(_0x3c1a82){logger['info'](_0xf44f('0xf'),_0x10329d,_0xf44f('0x10'));logger[_0xf44f('0x11')](_0xf44f('0x12'),_0x10329d,_0xf44f('0x10'),JSON[_0xf44f('0x13')](_0x3c1a82));if(_0x3c1a82[_0xf44f('0x14')]){if(_0x3c1a82[_0xf44f('0x14')][_0xf44f('0x15')]===0x1f4){logger[_0xf44f('0x14')](_0xf44f('0xf'),_0x10329d,_0x3c1a82[_0xf44f('0x14')][_0xf44f('0x16')]);return _0x19c21f(_0x3c1a82[_0xf44f('0x14')][_0xf44f('0x16')]);}logger[_0xf44f('0x14')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x10329d,_0x3c1a82['error'][_0xf44f('0x16')]);return _0x599f27(_0x3c1a82[_0xf44f('0x14')][_0xf44f('0x16')]);}else{logger['info'](_0xf44f('0xf'),_0x10329d,'request\x20sent');_0x599f27(_0x3c1a82['result'][_0xf44f('0x16')]);}})['catch'](function(_0x57033a){logger[_0xf44f('0x14')](_0xf44f('0xf'),_0x10329d,_0x57033a);_0x19c21f(_0x57033a);});});} \ No newline at end of file +var _0x243f=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','info','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','VoiceMusicOnHold,\x20%s,\x20%s','message','result'];(function(_0x364144,_0x5e32ac){var _0x4352e8=function(_0x420709){while(--_0x420709){_0x364144['push'](_0x364144['shift']());}};_0x4352e8(++_0x5e32ac);}(_0x243f,0x1ba));var _0xf243=function(_0x1646fa,_0x4e5bd7){_0x1646fa=_0x1646fa-0x0;var _0x5a47a5=_0x243f[_0x1646fa];return _0x5a47a5;};'use strict';var _=require(_0xf243('0x0'));var util=require(_0xf243('0x1'));var moment=require(_0xf243('0x2'));var BPromise=require(_0xf243('0x3'));var rs=require(_0xf243('0x4'));var fs=require('fs');var Redis=require(_0xf243('0x5'));var db=require(_0xf243('0x6'))['db'];var utils=require(_0xf243('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xf243('0x8'));var client=jayson[_0xf243('0x9')][_0xf243('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d927a,_0x4df7ea,_0xc571b9){return new BPromise(function(_0x2c2444,_0x4cdcfc){return client['request'](_0x4d927a,_0xc571b9)['then'](function(_0x13d044){logger[_0xf243('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x4df7ea,_0xf243('0xc'));logger[_0xf243('0xd')](_0xf243('0xe'),_0x4df7ea,'request\x20sent',JSON[_0xf243('0xf')](_0x13d044));if(_0x13d044[_0xf243('0x10')]){if(_0x13d044['error']['code']===0x1f4){logger[_0xf243('0x10')](_0xf243('0x11'),_0x4df7ea,_0x13d044[_0xf243('0x10')]['message']);return _0x4cdcfc(_0x13d044[_0xf243('0x10')]['message']);}logger[_0xf243('0x10')](_0xf243('0x11'),_0x4df7ea,_0x13d044[_0xf243('0x10')][_0xf243('0x12')]);return _0x2c2444(_0x13d044[_0xf243('0x10')]['message']);}else{logger[_0xf243('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x4df7ea,'request\x20sent');_0x2c2444(_0x13d044[_0xf243('0x13')]['message']);}})[_0xf243('0x14')](function(_0x47e53c){logger[_0xf243('0x10')](_0xf243('0x11'),_0x4df7ea,_0x47e53c);_0x4cdcfc(_0x47e53c);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index aa7a27c..7d7c114 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 _0xce58=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/users','getAgents','post','create','put','update','delete','destroy','removeAgents','util','Router','../../components/interaction/service','../../config/environment','./voicePrefix.controller'];(function(_0x4d01f6,_0x20b3a4){var _0x41ffe3=function(_0x2737be){while(--_0x2737be){_0x4d01f6['push'](_0x4d01f6['shift']());}};_0x41ffe3(++_0x20b3a4);}(_0xce58,0x1b4));var _0x8ce5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xce58[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x8ce5('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8ce5('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0x8ce5('0x2'));var config=require(_0x8ce5('0x3'));var controller=require(_0x8ce5('0x4'));router[_0x8ce5('0x5')]('/',auth[_0x8ce5('0x6')](),controller[_0x8ce5('0x7')]);router[_0x8ce5('0x5')](_0x8ce5('0x8'),auth[_0x8ce5('0x6')](),controller[_0x8ce5('0x9')]);router[_0x8ce5('0x5')](_0x8ce5('0xa'),auth[_0x8ce5('0x6')](),controller[_0x8ce5('0xb')]);router[_0x8ce5('0x5')](_0x8ce5('0xc'),auth[_0x8ce5('0x6')](),controller[_0x8ce5('0xd')]);router[_0x8ce5('0xe')]('/',auth[_0x8ce5('0x6')](),controller[_0x8ce5('0xf')]);router['post'](_0x8ce5('0xc'),auth[_0x8ce5('0x6')](),controller['addAgents']);router[_0x8ce5('0x10')](_0x8ce5('0xa'),auth['isAuthenticated'](),controller[_0x8ce5('0x11')]);router[_0x8ce5('0x12')](_0x8ce5('0xa'),auth[_0x8ce5('0x6')](),controller[_0x8ce5('0x13')]);router[_0x8ce5('0x12')](_0x8ce5('0xc'),auth['isAuthenticated'](),controller[_0x8ce5('0x14')]);module['exports']=router; \ No newline at end of file +var _0x2aa9=['../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','/describe','describe','show','getAgents','post','create','/:id/users','update','destroy','delete','removeAgents','exports','multer','util','connect-timeout','Router','../../components/auth/service'];(function(_0x52e0ee,_0x52f7c1){var _0x32534c=function(_0x535d65){while(--_0x535d65){_0x52e0ee['push'](_0x52e0ee['shift']());}};_0x32534c(++_0x52f7c1);}(_0x2aa9,0xed));var _0x92aa=function(_0x579354,_0x3fd65b){_0x579354=_0x579354-0x0;var _0x2d1264=_0x2aa9[_0x579354];return _0x2d1264;};'use strict';var multer=require(_0x92aa('0x0'));var util=require(_0x92aa('0x1'));var path=require('path');var timeout=require(_0x92aa('0x2'));var express=require('express');var router=express[_0x92aa('0x3')]();var auth=require(_0x92aa('0x4'));var interaction=require(_0x92aa('0x5'));var config=require(_0x92aa('0x6'));var controller=require(_0x92aa('0x7'));router[_0x92aa('0x8')]('/',auth[_0x92aa('0x9')](),controller['index']);router[_0x92aa('0x8')](_0x92aa('0xa'),auth[_0x92aa('0x9')](),controller[_0x92aa('0xb')]);router[_0x92aa('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x92aa('0xc')]);router['get']('/:id/users',auth[_0x92aa('0x9')](),controller[_0x92aa('0xd')]);router[_0x92aa('0xe')]('/',auth[_0x92aa('0x9')](),controller[_0x92aa('0xf')]);router[_0x92aa('0xe')](_0x92aa('0x10'),auth[_0x92aa('0x9')](),controller['addAgents']);router['put']('/:id',auth[_0x92aa('0x9')](),controller[_0x92aa('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x92aa('0x12')]);router[_0x92aa('0x13')](_0x92aa('0x10'),auth[_0x92aa('0x9')](),controller[_0x92aa('0x14')]);module[_0x92aa('0x15')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index a6365eb..4dc3c2a 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 _0xbc7c=['exports','name','VIRTUAL','system-','getDataValue','STRING','INTEGER'];(function(_0x1b58a3,_0x3229b0){var _0x200366=function(_0x454099){while(--_0x454099){_0x1b58a3['push'](_0x1b58a3['shift']());}};_0x200366(++_0x3229b0);}(_0xbc7c,0x1a4));var _0xcbc7=function(_0x413032,_0x4f1a47){_0x413032=_0x413032-0x0;var _0x548b60=_0xbc7c[_0x413032];return _0x548b60;};'use strict';var Sequelize=require('sequelize');module[_0xcbc7('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xcbc7('0x1')},'prefix':{'type':Sequelize[_0xcbc7('0x2')],'get':function(_0x2f2c9e){return _0xcbc7('0x3')+this[_0xcbc7('0x4')](_0xcbc7('0x1'))+'-';}},'description':{'type':Sequelize[_0xcbc7('0x5')]},'callerIdAll':{'type':Sequelize[_0xcbc7('0x5')]},'VoiceExtensionId':{'type':Sequelize[_0xcbc7('0x6')]}}; \ No newline at end of file +var _0xbbec=['sequelize','STRING','VIRTUAL','system-','getDataValue','name'];(function(_0x21f72a,_0x2356cc){var _0x38a8c6=function(_0x111fd6){while(--_0x111fd6){_0x21f72a['push'](_0x21f72a['shift']());}};_0x38a8c6(++_0x2356cc);}(_0xbbec,0xd2));var _0xcbbe=function(_0x18e44a,_0x3f0d55){_0x18e44a=_0x18e44a-0x0;var _0x14db95=_0xbbec[_0x18e44a];return _0x14db95;};'use strict';var Sequelize=require(_0xcbbe('0x0'));module['exports']={'name':{'type':Sequelize[_0xcbbe('0x1')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0xcbbe('0x2')],'get':function(_0x17dd00){return _0xcbbe('0x3')+this[_0xcbbe('0x4')](_0xcbbe('0x5'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 8eb78fc..7a19c6b 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 _0x105c=['to-csv','ejs','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','defaults','redis','localhost','register','sendStatus','end','status','json','count','offset','Content-Range','apply','reject','save','update','then','get','VoicePrefixes','UserProfileResource','name','send','map','rawAttributes','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','limit','order','sort','where','filter','merge','type','VIRTUAL','options','VoicePrefix','includeAll','include','findAll','rows','catch','show','params','keys','length','find','destroy','create','sequelize','transaction','body','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','system','appdata','prefix','NoOp','Voice\x20Prefix','VoiceExtension','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','findById','addAgents','ids','emit','userVoicePrefix:save','isArray','userVoicePrefix:remove','getAgents','findOne','User','pick','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path'];(function(_0x5e4134,_0x1a1c27){var _0x529994=function(_0x40956b){while(--_0x40956b){_0x5e4134['push'](_0x5e4134['shift']());}};_0x529994(++_0x1a1c27);}(_0x105c,0x6d));var _0xc105=function(_0x56daff,_0xadca9a){_0x56daff=_0x56daff-0x0;var _0x132c82=_0x105c[_0x56daff];return _0x132c82;};'use strict';var pdf=require(_0xc105('0x0'));var emlformat=require(_0xc105('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc105('0x2'));var jsonpatch=require(_0xc105('0x3'));var rp=require(_0xc105('0x4'));var moment=require(_0xc105('0x5'));var BPromise=require(_0xc105('0x6'));var Mustache=require(_0xc105('0x7'));var util=require('util');var path=require(_0xc105('0x8'));var sox=require('sox');var csv=require(_0xc105('0x9'));var ejs=require(_0xc105('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc105('0xb'));var crypto=require(_0xc105('0xc'));var jsforce=require(_0xc105('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc105('0x9'));var querystring=require('querystring');var Papa=require(_0xc105('0xe'));var Redis=require('ioredis');var authService=require(_0xc105('0xf'));var qs=require(_0xc105('0x10'));var as=require(_0xc105('0x11'));var hardwareService=require(_0xc105('0x12'));var logger=require(_0xc105('0x13'))(_0xc105('0x14'));var utils=require('../../config/utils');var config=require(_0xc105('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xc105('0x16')](config[_0xc105('0x17')],{'host':_0xc105('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc105('0x17')]));require('./voicePrefix.socket')[_0xc105('0x19')](socket);function respondWithStatusCode(_0x105306,_0x4da158){_0x4da158=_0x4da158||0xcc;return function(_0xf74af8){if(_0xf74af8){return _0x105306[_0xc105('0x1a')](_0x4da158);}return _0x105306['status'](_0x4da158)[_0xc105('0x1b')]();};}function respondWithResult(_0x1c6b97,_0x3ec46b){_0x3ec46b=_0x3ec46b||0xc8;return function(_0x2f81e5){if(_0x2f81e5){return _0x1c6b97[_0xc105('0x1c')](_0x3ec46b)[_0xc105('0x1d')](_0x2f81e5);}};}function respondWithFilteredResult(_0x4e7394,_0x348e2a){return function(_0x1315e2){if(_0x1315e2){var _0x679087=_0x1315e2[_0xc105('0x1e')],_0x306181=_0x348e2a['offset'],_0x377b64=_0x348e2a[_0xc105('0x1f')]+_0x348e2a['limit'],_0x2d3bc3;if(_0x377b64>=_0x679087){_0x377b64=_0x679087;_0x2d3bc3=0xc8;}else{_0x2d3bc3=0xce;}_0x4e7394['status'](_0x2d3bc3);return _0x4e7394['set'](_0xc105('0x20'),_0x306181+'-'+_0x377b64+'/'+_0x679087)[_0xc105('0x1d')](_0x1315e2);}return null;};}function patchUpdates(_0x1cb9f6){return function(_0x34d1af){try{jsonpatch[_0xc105('0x21')](_0x34d1af,_0x1cb9f6,!![]);}catch(_0x3dd3bd){return BPromise[_0xc105('0x22')](_0x3dd3bd);}return _0x34d1af[_0xc105('0x23')]();};}function saveUpdates(_0x2f8fd7,_0x12d788){return function(_0x7b3285){if(_0x7b3285){return _0x7b3285[_0xc105('0x24')](_0x2f8fd7)[_0xc105('0x25')](function(_0x25fd0d){return _0x25fd0d;});}return null;};}function removeEntity(_0x434f6a,_0x211bd5){return function(_0x24abf3){if(_0x24abf3){return _0x24abf3['destroy']()[_0xc105('0x25')](function(){var _0x209e1f=_0x24abf3[_0xc105('0x26')]({'plain':!![]});var _0x59c85e=_0xc105('0x27');return db[_0xc105('0x28')]['destroy']({'where':{'type':_0x59c85e,'resourceId':_0x209e1f['id']}})[_0xc105('0x25')](function(){return _0x24abf3;});})[_0xc105('0x25')](function(){_0x434f6a[_0xc105('0x1c')](0xcc)[_0xc105('0x1b')]();});}};}function handleEntityNotFound(_0x1704c1,_0x30a9d2){return function(_0x5cff69){if(!_0x5cff69){_0x1704c1[_0xc105('0x1a')](0x194);}return _0x5cff69;};}function handleError(_0x1987b4,_0x430af9){_0x430af9=_0x430af9||0x1f4;return function(_0x193db5){logger['error'](_0x193db5['stack']);if(_0x193db5['name']){delete _0x193db5[_0xc105('0x29')];}_0x1987b4[_0xc105('0x1c')](_0x430af9)[_0xc105('0x2a')](_0x193db5);};}exports['index']=function(_0x57beb1,_0x1649f8){var _0xa7390b={},_0x2c1185={},_0x454017={'count':0x0,'rows':[]};var _0x803ba0=_[_0xc105('0x2b')](db['VoicePrefix'][_0xc105('0x2c')],function(_0x176a02){return{'name':_0x176a02['fieldName'],'type':_0x176a02['type'][_0xc105('0x2d')]};});_0x2c1185[_0xc105('0x2e')]=_[_0xc105('0x2b')](_0x803ba0,_0xc105('0x29'));_0x2c1185[_0xc105('0x2f')]=_['keys'](_0x57beb1['query']);_0x2c1185[_0xc105('0x30')]=_[_0xc105('0x31')](_0x2c1185[_0xc105('0x2e')],_0x2c1185[_0xc105('0x2f')]);_0xa7390b['attributes']=_[_0xc105('0x31')](_0x2c1185[_0xc105('0x2e')],qs['fields'](_0x57beb1[_0xc105('0x2f')][_0xc105('0x32')]));_0xa7390b['attributes']=_0xa7390b[_0xc105('0x33')]['length']?_0xa7390b[_0xc105('0x33')]:_0x2c1185[_0xc105('0x2e')];if(!_0x57beb1[_0xc105('0x2f')][_0xc105('0x34')]('nolimit')){_0xa7390b['limit']=qs[_0xc105('0x35')](_0x57beb1[_0xc105('0x2f')][_0xc105('0x35')]);_0xa7390b[_0xc105('0x1f')]=qs['offset'](_0x57beb1[_0xc105('0x2f')][_0xc105('0x1f')]);}_0xa7390b[_0xc105('0x36')]=qs[_0xc105('0x37')](_0x57beb1[_0xc105('0x2f')][_0xc105('0x37')]);_0xa7390b[_0xc105('0x38')]=qs['filters'](_['pick'](_0x57beb1[_0xc105('0x2f')],_0x2c1185[_0xc105('0x30')]));if(_0x57beb1['query'][_0xc105('0x39')]){_0xa7390b[_0xc105('0x38')]=_[_0xc105('0x3a')](_0xa7390b[_0xc105('0x38')],{'$or':_[_0xc105('0x2b')](_0x803ba0,function(_0x471c4e){if(_0x471c4e[_0xc105('0x3b')]!==_0xc105('0x3c')){var _0x20dd41={};_0x20dd41[_0x471c4e[_0xc105('0x29')]]={'$like':'%'+_0x57beb1[_0xc105('0x2f')][_0xc105('0x39')]+'%'};return _0x20dd41;}})});}_0xa7390b=_['merge']({},_0xa7390b,_0x57beb1[_0xc105('0x3d')]);var _0x2c6ed3={'where':_0xa7390b[_0xc105('0x38')]};return db[_0xc105('0x3e')]['count'](_0x2c6ed3)['then'](function(_0x4a5bd6){_0x454017['count']=_0x4a5bd6;if(_0x57beb1[_0xc105('0x2f')][_0xc105('0x3f')]){_0xa7390b[_0xc105('0x40')]=[{'all':!![]}];}return db[_0xc105('0x3e')][_0xc105('0x41')](_0xa7390b);})[_0xc105('0x25')](function(_0x34547a){_0x454017[_0xc105('0x42')]=_0x34547a;return _0x454017;})['then'](respondWithFilteredResult(_0x1649f8,_0xa7390b))[_0xc105('0x43')](handleError(_0x1649f8,null));};exports[_0xc105('0x44')]=function(_0x1e5302,_0x256b1c){var _0x3eb099={'raw':![],'where':{'id':_0x1e5302[_0xc105('0x45')]['id']}},_0x1c08c5={};_0x1c08c5[_0xc105('0x2e')]=_[_0xc105('0x46')](db['VoicePrefix'][_0xc105('0x2c')]);_0x1c08c5['query']=_[_0xc105('0x46')](_0x1e5302['query']);_0x1c08c5[_0xc105('0x30')]=_[_0xc105('0x31')](_0x1c08c5['model'],_0x1c08c5['query']);_0x3eb099[_0xc105('0x33')]=_[_0xc105('0x31')](_0x1c08c5[_0xc105('0x2e')],qs[_0xc105('0x32')](_0x1e5302[_0xc105('0x2f')]['fields']));_0x3eb099['attributes']=_0x3eb099[_0xc105('0x33')][_0xc105('0x47')]?_0x3eb099[_0xc105('0x33')]:_0x1c08c5[_0xc105('0x2e')];if(_0x1e5302['query'][_0xc105('0x3f')]){_0x3eb099[_0xc105('0x40')]=[{'all':!![]}];}_0x3eb099=_[_0xc105('0x3a')]({},_0x3eb099,_0x1e5302[_0xc105('0x3d')]);return db['VoicePrefix'][_0xc105('0x48')](_0x3eb099)[_0xc105('0x25')](handleEntityNotFound(_0x256b1c,null))[_0xc105('0x25')](respondWithResult(_0x256b1c,null))[_0xc105('0x43')](handleError(_0x256b1c,null));};exports[_0xc105('0x49')]=function(_0x4f4706,_0x14f2da){return db['VoicePrefix'][_0xc105('0x48')]({'where':{'id':_0x4f4706[_0xc105('0x45')]['id']}})[_0xc105('0x25')](handleEntityNotFound(_0x14f2da,null))['then'](removeEntity(_0x14f2da,null))[_0xc105('0x43')](handleError(_0x14f2da,null));};exports['describe']=function(_0x36bfd6,_0x8ee6f5){return db[_0xc105('0x3e')]['describe']()[_0xc105('0x25')](respondWithResult(_0x8ee6f5,null))[_0xc105('0x43')](handleError(_0x8ee6f5,null));};exports[_0xc105('0x4a')]=function(_0x922c74,_0x2142f9){var _0x28d286;return db[_0xc105('0x4b')][_0xc105('0x4c')](function(_0x1cafe7){return db[_0xc105('0x3e')]['create'](_0x922c74[_0xc105('0x4d')],{'transaction':_0x1cafe7})[_0xc105('0x25')](function(_0x2a9a08){_0x28d286=_0x2a9a08[_0xc105('0x26')]({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0x28d286[_0xc105('0x4e')]},'raw':!![]})[_0xc105('0x25')](function(_0x6d6f5){return createVoicePrefixExtensions(_0x28d286,_0x6d6f5,_0x1cafe7);});});})[_0xc105('0x25')](function(){var _0x5b69c7=_0x922c74['user']['get']({'plain':!![]});if(!_0x5b69c7)throw new Error(_0xc105('0x4f'));if(_0x5b69c7[_0xc105('0x50')]==='user'){var _0x35dbf9=_0x28d286;return db['UserProfileSection']['find']({'where':{'name':_0xc105('0x27'),'userProfileId':_0x5b69c7[_0xc105('0x51')]},'raw':!![]})[_0xc105('0x25')](function(_0x388d4d){if(_0x388d4d&&_0x388d4d[_0xc105('0x52')]===0x0){return db[_0xc105('0x28')][_0xc105('0x4a')]({'name':_0x35dbf9[_0xc105('0x29')],'resourceId':_0x35dbf9['id'],'type':_0x388d4d[_0xc105('0x29')],'sectionId':_0x388d4d['id']},{})[_0xc105('0x25')](function(){return _0x28d286;});}else{return _0x28d286;}})[_0xc105('0x43')](function(_0x57ae9f){logger['error'](_0xc105('0x53'),_0x57ae9f);throw _0x57ae9f;});}return _0x28d286;})['then'](respondWithResult(_0x2142f9,null))['catch'](handleError(_0x2142f9,null));};function Extension(_0x82123f,_0x5d5ef5,_0x5823a5,_0x3a7810){this[_0xc105('0x54')]=_0xc105('0x55');this[_0xc105('0x56')]=_0x82123f;this[_0xc105('0x57')]=_0x5823a5;this['type']=_0xc105('0x58');this['description']='Voice\x20Prefix\x20Extension';this['priority']=_0x5d5ef5;this[_0xc105('0x59')]=_0x3a7810;}function createVoicePrefixExtensions(_0x5a06b5,_0x56d3b7,_0x468cda){return new BPromise(function(_0x42847f,_0x38183a){var _0x2558af=new Extension(formatPrefixName(_0x5a06b5[_0xc105('0x5a')]),0x1,_0xc105('0x5b'),_0xc105('0x5c'));_0x2558af['VoicePrefixId']=_0x5a06b5['id'];return db[_0xc105('0x5d')][_0xc105('0x4a')](_0x2558af,{'transaction':_0x468cda})[_0xc105('0x25')](function(_0x24ca2f){var _0x23e819=_0x24ca2f[_0xc105('0x26')]({'plain':!![]});var _0x3447fe=_[_0xc105('0x2b')](addVoicePrefixExtensions(_0x5a06b5,_0x56d3b7),function(_0x437851){_0x437851['VoiceExtensionId']=_0x23e819['id'];_0x437851[_0xc105('0x5e')]=_0x5a06b5['id'];return _0x437851;});return db[_0xc105('0x5d')][_0xc105('0x5f')](_0x3447fe,{'transaction':_0x468cda})[_0xc105('0x25')](function(_0x94ef5c){if(!_0x94ef5c){return _0x38183a(_0xc105('0x60'));}else{return _0x42847f(_0x94ef5c);}})[_0xc105('0x43')](function(_0x403e3a){return _0x38183a(_0x403e3a);});});;});};function addVoicePrefixExtensions(_0x2df3f1,_0x103440){var _0xd09814=[];var _0x2232fb=formatPrefixName(_0x2df3f1[_0xc105('0x5a')]);_0xd09814[_0xc105('0x61')](new Extension(_0x2232fb,0x2,_0xc105('0x62'),_0xc105('0x63')+_0x2df3f1[_0xc105('0x29')]));if(_0x2df3f1[_0xc105('0x64')]){_0xd09814[_0xc105('0x61')](new Extension(_0x2232fb,0x3,_0xc105('0x62'),_0xc105('0x65')+_0x2df3f1['callerIdAll']));}else{_0xd09814[_0xc105('0x61')](new Extension(_0x2232fb,0x3,_0xc105('0x5b'),_0xc105('0x66')));}_0xd09814[_0xc105('0x61')](new Extension(_0x2232fb,0x4,_0xc105('0x67'),_0x103440['context']+','+_0xc105('0x68')+(0x8+_0x2df3f1[_0xc105('0x29')][_0xc105('0x47')])+'}'+','+0x1));return _0xd09814;}function formatPrefixName(_0xf5eb52){var _0x4cb127='_';for(var _0x4377ff=0x0;_0x4377ff<_0xf5eb52[_0xc105('0x47')];_0x4377ff++){if(_0xf5eb52[_0xc105('0x69')](_0x4377ff)=='-'){_0x4cb127+=_0xf5eb52['charAt'](_0x4377ff);}else{_0x4cb127+='['+_0xf5eb52[_0xc105('0x69')](_0x4377ff)+']';}}_0x4cb127+='.';return _0x4cb127;}exports['update']=function(_0x101b22,_0x4f6d1d,_0x4393e9){var _0x3389df=_0x101b22[_0xc105('0x4d')];_0x3389df['prefix']=_0xc105('0x6a')+_0x3389df['name']+'-';return db[_0xc105('0x4b')]['transaction'](function(_0x3d8b8f){return db['VoicePrefix'][_0xc105('0x24')](_0x3389df,{'where':{'id':_0x3389df['id']},'transaction':_0x3d8b8f})[_0xc105('0x25')](function(){return db[_0xc105('0x5d')][_0xc105('0x49')]({'where':{'VoicePrefixId':_0x3389df['id']},'transaction':_0x3d8b8f})[_0xc105('0x25')](function(){return db['VoiceExtension']['find']({'where':{'id':_0x3389df[_0xc105('0x4e')]},'raw':!![]})[_0xc105('0x25')](function(_0x32bd47){return createVoicePrefixExtensions(_0x3389df,_0x32bd47,_0x3d8b8f);});});});})[_0xc105('0x25')](function(){return db[_0xc105('0x3e')][_0xc105('0x6b')](_0x3389df['id']);})[_0xc105('0x25')](respondWithResult(_0x4f6d1d,null))['catch'](handleError(_0x4f6d1d,null));};exports[_0xc105('0x6c')]=function(_0xd96c39,_0x540531,_0x116023){return db[_0xc105('0x3e')][_0xc105('0x48')]({'where':{'id':_0xd96c39[_0xc105('0x45')]['id']}})['then'](handleEntityNotFound(_0x540531,null))['then'](function(_0x339ac0){if(_0x339ac0){return _0x339ac0[_0xc105('0x6c')](_0xd96c39[_0xc105('0x4d')][_0xc105('0x6d')],_['omit'](_0xd96c39[_0xc105('0x4d')],['ids','id'])||{})['spread'](function(_0x1d48b3){for(var _0x123028=0x0;_0x123028<_0xd96c39['body'][_0xc105('0x6d')]['length'];_0x123028+=0x1){socket[_0xc105('0x6e')](_0xc105('0x6f'),{'UserId':_0xd96c39[_0xc105('0x4d')][_0xc105('0x6d')][_0x123028],'VoicePrefixId':_0xd96c39[_0xc105('0x45')]['id']});}return _0x1d48b3;});}})[_0xc105('0x25')](respondWithResult(_0x540531,null))[_0xc105('0x43')](handleError(_0x540531,null));};exports['removeAgents']=function(_0x2039e3,_0x2d20f4,_0x3ece72){return db[_0xc105('0x3e')]['find']({'where':{'id':_0x2039e3[_0xc105('0x45')]['id']}})[_0xc105('0x25')](handleEntityNotFound(_0x2d20f4,null))[_0xc105('0x25')](function(_0x14dba1){if(_0x14dba1){return _0x14dba1['removeAgents'](_0x2039e3[_0xc105('0x2f')][_0xc105('0x6d')])[_0xc105('0x25')](function(){if(_[_0xc105('0x70')](_0x2039e3['query']['ids'])){for(var _0x169ccd=0x0;_0x169ccd<_0x2039e3[_0xc105('0x2f')][_0xc105('0x6d')][_0xc105('0x47')];_0x169ccd+=0x1){socket[_0xc105('0x6e')](_0xc105('0x71'),{'UserId':Number(_0x2039e3['query'][_0xc105('0x6d')][_0x169ccd]),'VoicePrefixId':Number(_0x2039e3[_0xc105('0x45')]['id'])});}}else{socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x2039e3[_0xc105('0x2f')][_0xc105('0x6d')]),'VoicePrefixId':Number(_0x2039e3[_0xc105('0x45')]['id'])});}});}})['then'](respondWithStatusCode(_0x2d20f4,null))[_0xc105('0x43')](handleError(_0x2d20f4,null));};exports[_0xc105('0x72')]=function(_0x5e9aad,_0x324840,_0x41cccb){var _0x7e0167={};var _0x2d717f={};var _0x19ccb6;var _0x4d3a73;return db[_0xc105('0x3e')][_0xc105('0x73')]({'where':{'id':_0x5e9aad[_0xc105('0x45')]['id']}})['then'](handleEntityNotFound(_0x324840,null))[_0xc105('0x25')](function(_0xa19a6d){if(_0xa19a6d){_0x19ccb6=_0xa19a6d;_0x2d717f[_0xc105('0x2e')]=_[_0xc105('0x46')](db[_0xc105('0x74')][_0xc105('0x2c')]);_0x2d717f[_0xc105('0x2f')]=_[_0xc105('0x46')](_0x5e9aad[_0xc105('0x2f')]);_0x2d717f['filters']=_['intersection'](_0x2d717f[_0xc105('0x2e')],_0x2d717f[_0xc105('0x2f')]);_0x7e0167[_0xc105('0x33')]=_[_0xc105('0x31')](_0x2d717f[_0xc105('0x2e')],qs[_0xc105('0x32')](_0x5e9aad[_0xc105('0x2f')][_0xc105('0x32')]));_0x7e0167[_0xc105('0x33')]=_0x7e0167[_0xc105('0x33')][_0xc105('0x47')]?_0x7e0167[_0xc105('0x33')]:_0x2d717f[_0xc105('0x2e')];_0x7e0167[_0xc105('0x36')]=qs[_0xc105('0x37')](_0x5e9aad[_0xc105('0x2f')][_0xc105('0x37')]);_0x7e0167[_0xc105('0x38')]=qs[_0xc105('0x30')](_[_0xc105('0x75')](_0x5e9aad[_0xc105('0x2f')],_0x2d717f['filters']));if(_0x5e9aad[_0xc105('0x2f')][_0xc105('0x39')]){_0x7e0167[_0xc105('0x38')]=_['merge'](_0x7e0167[_0xc105('0x38')],{'$or':_[_0xc105('0x2b')](_0x7e0167[_0xc105('0x33')],function(_0x187e48){var _0x5cbbd8={};_0x5cbbd8[_0x187e48]={'$like':'%'+_0x5e9aad[_0xc105('0x2f')][_0xc105('0x39')]+'%'};return _0x5cbbd8;})});}_0x7e0167=_[_0xc105('0x3a')]({},_0x7e0167,_0x5e9aad[_0xc105('0x3d')]);return _0x19ccb6[_0xc105('0x72')](_0x7e0167);}})['then'](function(_0x22908c){if(_0x22908c){_0x4d3a73=_0x22908c[_0xc105('0x47')];if(!_0x5e9aad[_0xc105('0x2f')][_0xc105('0x34')]('nolimit')){_0x7e0167[_0xc105('0x35')]=qs[_0xc105('0x35')](_0x5e9aad[_0xc105('0x2f')]['limit']);_0x7e0167['offset']=qs[_0xc105('0x1f')](_0x5e9aad[_0xc105('0x2f')][_0xc105('0x1f')]);}return _0x19ccb6[_0xc105('0x72')](_0x7e0167);}})[_0xc105('0x25')](function(_0x40a668){if(_0x40a668){return _0x40a668?{'count':_0x4d3a73,'rows':_0x40a668}:null;}})[_0xc105('0x25')](respondWithResult(_0x324840,null))[_0xc105('0x43')](handleError(_0x324840,null));}; \ No newline at end of file +var _0x9c81=['ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','socket.io-emitter','status','end','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','get','VoicePrefixes','UserProfileResource','error','stack','name','send','index','VoicePrefix','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','catch','describe','create','sequelize','transaction','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','app','priority','prefix','NoOp','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','findById','addAgents','body','ids','omit','spread','emit','removeAgents','userVoicePrefix:remove','getAgents','findOne','User','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','lodash','squel','crypto','querystring'];(function(_0x4de1b1,_0x18c64c){var _0x639f27=function(_0x635e03){while(--_0x635e03){_0x4de1b1['push'](_0x4de1b1['shift']());}};_0x639f27(++_0x18c64c);}(_0x9c81,0x14d));var _0x19c8=function(_0x5748ea,_0x1157a7){_0x5748ea=_0x5748ea-0x0;var _0x5c5ff1=_0x9c81[_0x5748ea];return _0x5c5ff1;};'use strict';var pdf=require(_0x19c8('0x0'));var emlformat=require(_0x19c8('0x1'));var rimraf=require(_0x19c8('0x2'));var zipdir=require(_0x19c8('0x3'));var jsonpatch=require(_0x19c8('0x4'));var rp=require(_0x19c8('0x5'));var moment=require(_0x19c8('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x19c8('0x7'));var util=require('util');var path=require('path');var sox=require(_0x19c8('0x8'));var csv=require(_0x19c8('0x9'));var ejs=require(_0x19c8('0xa'));var fs=require('fs');var _=require(_0x19c8('0xb'));var squel=require(_0x19c8('0xc'));var crypto=require(_0x19c8('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x19c8('0x9'));var querystring=require(_0x19c8('0xe'));var Papa=require('papaparse');var Redis=require(_0x19c8('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x19c8('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x19c8('0x11'));var logger=require(_0x19c8('0x12'))(_0x19c8('0x13'));var utils=require(_0x19c8('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x19c8('0x15')]=_['defaults'](config[_0x19c8('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x19c8('0x16'))(new Redis(config[_0x19c8('0x15')]));require('./voicePrefix.socket')['register'](socket);function respondWithStatusCode(_0x552d63,_0x48bbd4){_0x48bbd4=_0x48bbd4||0xcc;return function(_0x5fb9d4){if(_0x5fb9d4){return _0x552d63['sendStatus'](_0x48bbd4);}return _0x552d63[_0x19c8('0x17')](_0x48bbd4)[_0x19c8('0x18')]();};}function respondWithResult(_0x2d4c46,_0x4cd03c){_0x4cd03c=_0x4cd03c||0xc8;return function(_0x40dc95){if(_0x40dc95){return _0x2d4c46[_0x19c8('0x17')](_0x4cd03c)[_0x19c8('0x19')](_0x40dc95);}};}function respondWithFilteredResult(_0x7c3062,_0x4cb311){return function(_0x16fa45){if(_0x16fa45){var _0x3b7194=_0x16fa45[_0x19c8('0x1a')],_0x2845de=_0x4cb311['offset'],_0x4ff69a=_0x4cb311[_0x19c8('0x1b')]+_0x4cb311[_0x19c8('0x1c')],_0x538ab8;if(_0x4ff69a>=_0x3b7194){_0x4ff69a=_0x3b7194;_0x538ab8=0xc8;}else{_0x538ab8=0xce;}_0x7c3062[_0x19c8('0x17')](_0x538ab8);return _0x7c3062[_0x19c8('0x1d')](_0x19c8('0x1e'),_0x2845de+'-'+_0x4ff69a+'/'+_0x3b7194)[_0x19c8('0x19')](_0x16fa45);}return null;};}function patchUpdates(_0x8e9d1c){return function(_0x2bce29){try{jsonpatch[_0x19c8('0x1f')](_0x2bce29,_0x8e9d1c,!![]);}catch(_0x3d6c44){return BPromise[_0x19c8('0x20')](_0x3d6c44);}return _0x2bce29['save']();};}function saveUpdates(_0x16fdb5,_0x413244){return function(_0x37592b){if(_0x37592b){return _0x37592b['update'](_0x16fdb5)[_0x19c8('0x21')](function(_0x2b7d43){return _0x2b7d43;});}return null;};}function removeEntity(_0x2fad48,_0x45db29){return function(_0x37c8f3){if(_0x37c8f3){return _0x37c8f3[_0x19c8('0x22')]()['then'](function(){var _0x2b804e=_0x37c8f3[_0x19c8('0x23')]({'plain':!![]});var _0xcd777a=_0x19c8('0x24');return db[_0x19c8('0x25')]['destroy']({'where':{'type':_0xcd777a,'resourceId':_0x2b804e['id']}})[_0x19c8('0x21')](function(){return _0x37c8f3;});})['then'](function(){_0x2fad48[_0x19c8('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x318e01,_0x519ddf){return function(_0x5a1a2e){if(!_0x5a1a2e){_0x318e01['sendStatus'](0x194);}return _0x5a1a2e;};}function handleError(_0x122163,_0x3c1b32){_0x3c1b32=_0x3c1b32||0x1f4;return function(_0xa8d970){logger[_0x19c8('0x26')](_0xa8d970[_0x19c8('0x27')]);if(_0xa8d970[_0x19c8('0x28')]){delete _0xa8d970['name'];}_0x122163[_0x19c8('0x17')](_0x3c1b32)[_0x19c8('0x29')](_0xa8d970);};}exports[_0x19c8('0x2a')]=function(_0x38b2f8,_0x55009e){var _0x5ec6e5={},_0x37d8c5={},_0x47de91={'count':0x0,'rows':[]};var _0x10b025=_['map'](db[_0x19c8('0x2b')]['rawAttributes'],function(_0x4fa1bd){return{'name':_0x4fa1bd['fieldName'],'type':_0x4fa1bd[_0x19c8('0x2c')][_0x19c8('0x2d')]};});_0x37d8c5[_0x19c8('0x2e')]=_['map'](_0x10b025,'name');_0x37d8c5[_0x19c8('0x2f')]=_['keys'](_0x38b2f8[_0x19c8('0x2f')]);_0x37d8c5[_0x19c8('0x30')]=_['intersection'](_0x37d8c5[_0x19c8('0x2e')],_0x37d8c5[_0x19c8('0x2f')]);_0x5ec6e5['attributes']=_[_0x19c8('0x31')](_0x37d8c5[_0x19c8('0x2e')],qs[_0x19c8('0x32')](_0x38b2f8[_0x19c8('0x2f')][_0x19c8('0x32')]));_0x5ec6e5[_0x19c8('0x33')]=_0x5ec6e5[_0x19c8('0x33')][_0x19c8('0x34')]?_0x5ec6e5[_0x19c8('0x33')]:_0x37d8c5[_0x19c8('0x2e')];if(!_0x38b2f8['query'][_0x19c8('0x35')](_0x19c8('0x36'))){_0x5ec6e5[_0x19c8('0x1c')]=qs['limit'](_0x38b2f8[_0x19c8('0x2f')][_0x19c8('0x1c')]);_0x5ec6e5['offset']=qs['offset'](_0x38b2f8[_0x19c8('0x2f')][_0x19c8('0x1b')]);}_0x5ec6e5[_0x19c8('0x37')]=qs[_0x19c8('0x38')](_0x38b2f8[_0x19c8('0x2f')]['sort']);_0x5ec6e5[_0x19c8('0x39')]=qs['filters'](_[_0x19c8('0x3a')](_0x38b2f8[_0x19c8('0x2f')],_0x37d8c5['filters']));if(_0x38b2f8[_0x19c8('0x2f')][_0x19c8('0x3b')]){_0x5ec6e5[_0x19c8('0x39')]=_[_0x19c8('0x3c')](_0x5ec6e5['where'],{'$or':_[_0x19c8('0x3d')](_0x10b025,function(_0xd3bea){if(_0xd3bea[_0x19c8('0x2c')]!==_0x19c8('0x3e')){var _0x108715={};_0x108715[_0xd3bea[_0x19c8('0x28')]]={'$like':'%'+_0x38b2f8[_0x19c8('0x2f')][_0x19c8('0x3b')]+'%'};return _0x108715;}})});}_0x5ec6e5=_[_0x19c8('0x3c')]({},_0x5ec6e5,_0x38b2f8[_0x19c8('0x3f')]);var _0x331bea={'where':_0x5ec6e5[_0x19c8('0x39')]};return db[_0x19c8('0x2b')][_0x19c8('0x1a')](_0x331bea)[_0x19c8('0x21')](function(_0x2b82ce){_0x47de91[_0x19c8('0x1a')]=_0x2b82ce;if(_0x38b2f8[_0x19c8('0x2f')][_0x19c8('0x40')]){_0x5ec6e5[_0x19c8('0x41')]=[{'all':!![]}];}return db[_0x19c8('0x2b')][_0x19c8('0x42')](_0x5ec6e5);})[_0x19c8('0x21')](function(_0x40655c){_0x47de91[_0x19c8('0x43')]=_0x40655c;return _0x47de91;})[_0x19c8('0x21')](respondWithFilteredResult(_0x55009e,_0x5ec6e5))['catch'](handleError(_0x55009e,null));};exports[_0x19c8('0x44')]=function(_0x429470,_0x585b66){var _0x46f77e={'raw':![],'where':{'id':_0x429470[_0x19c8('0x45')]['id']}},_0x211251={};_0x211251[_0x19c8('0x2e')]=_[_0x19c8('0x46')](db[_0x19c8('0x2b')][_0x19c8('0x47')]);_0x211251[_0x19c8('0x2f')]=_[_0x19c8('0x46')](_0x429470[_0x19c8('0x2f')]);_0x211251['filters']=_[_0x19c8('0x31')](_0x211251[_0x19c8('0x2e')],_0x211251[_0x19c8('0x2f')]);_0x46f77e[_0x19c8('0x33')]=_['intersection'](_0x211251['model'],qs['fields'](_0x429470[_0x19c8('0x2f')][_0x19c8('0x32')]));_0x46f77e[_0x19c8('0x33')]=_0x46f77e[_0x19c8('0x33')][_0x19c8('0x34')]?_0x46f77e[_0x19c8('0x33')]:_0x211251[_0x19c8('0x2e')];if(_0x429470['query'][_0x19c8('0x40')]){_0x46f77e[_0x19c8('0x41')]=[{'all':!![]}];}_0x46f77e=_[_0x19c8('0x3c')]({},_0x46f77e,_0x429470[_0x19c8('0x3f')]);return db[_0x19c8('0x2b')][_0x19c8('0x48')](_0x46f77e)[_0x19c8('0x21')](handleEntityNotFound(_0x585b66,null))[_0x19c8('0x21')](respondWithResult(_0x585b66,null))[_0x19c8('0x49')](handleError(_0x585b66,null));};exports[_0x19c8('0x22')]=function(_0x3590e4,_0x13e992){return db[_0x19c8('0x2b')][_0x19c8('0x48')]({'where':{'id':_0x3590e4[_0x19c8('0x45')]['id']}})[_0x19c8('0x21')](handleEntityNotFound(_0x13e992,null))[_0x19c8('0x21')](removeEntity(_0x13e992,null))[_0x19c8('0x49')](handleError(_0x13e992,null));};exports[_0x19c8('0x4a')]=function(_0x5e098b,_0x54e0f4){return db[_0x19c8('0x2b')][_0x19c8('0x4a')]()[_0x19c8('0x21')](respondWithResult(_0x54e0f4,null))[_0x19c8('0x49')](handleError(_0x54e0f4,null));};exports[_0x19c8('0x4b')]=function(_0x413c38,_0x57eb24){var _0x2e650d;return db[_0x19c8('0x4c')][_0x19c8('0x4d')](function(_0x53c171){return db[_0x19c8('0x2b')][_0x19c8('0x4b')](_0x413c38['body'],{'transaction':_0x53c171})['then'](function(_0x54eafc){_0x2e650d=_0x54eafc['get']({'plain':!![]});return db[_0x19c8('0x4e')][_0x19c8('0x48')]({'where':{'id':_0x2e650d[_0x19c8('0x4f')]},'raw':!![]})[_0x19c8('0x21')](function(_0x8da7c2){return createVoicePrefixExtensions(_0x2e650d,_0x8da7c2,_0x53c171);});});})['then'](function(){var _0x32f7fb=_0x413c38[_0x19c8('0x50')][_0x19c8('0x23')]({'plain':!![]});if(!_0x32f7fb)throw new Error(_0x19c8('0x51'));if(_0x32f7fb[_0x19c8('0x52')]===_0x19c8('0x50')){var _0x4a7ca=_0x2e650d;return db[_0x19c8('0x53')][_0x19c8('0x48')]({'where':{'name':_0x19c8('0x24'),'userProfileId':_0x32f7fb[_0x19c8('0x54')]},'raw':!![]})[_0x19c8('0x21')](function(_0x23118a){if(_0x23118a&&_0x23118a['autoAssociation']===0x0){return db[_0x19c8('0x25')][_0x19c8('0x4b')]({'name':_0x4a7ca[_0x19c8('0x28')],'resourceId':_0x4a7ca['id'],'type':_0x23118a[_0x19c8('0x28')],'sectionId':_0x23118a['id']},{})[_0x19c8('0x21')](function(){return _0x2e650d;});}else{return _0x2e650d;}})[_0x19c8('0x49')](function(_0x5d73d1){logger['error'](_0x19c8('0x55'),_0x5d73d1);throw _0x5d73d1;});}return _0x2e650d;})['then'](respondWithResult(_0x57eb24,null))[_0x19c8('0x49')](handleError(_0x57eb24,null));};function Extension(_0x2e0849,_0x5da945,_0x5f1b23,_0x1fc6cd){this['context']=_0x19c8('0x56');this[_0x19c8('0x57')]=_0x2e0849;this[_0x19c8('0x58')]=_0x5f1b23;this['type']='system';this['description']='Voice\x20Prefix\x20Extension';this[_0x19c8('0x59')]=_0x5da945;this['appdata']=_0x1fc6cd;}function createVoicePrefixExtensions(_0x4c563c,_0x116974,_0x4f1294){return new BPromise(function(_0x255cbc,_0x50d083){var _0x54be48=new Extension(formatPrefixName(_0x4c563c[_0x19c8('0x5a')]),0x1,_0x19c8('0x5b'),'Voice\x20Prefix');_0x54be48[_0x19c8('0x5c')]=_0x4c563c['id'];return db[_0x19c8('0x4e')][_0x19c8('0x4b')](_0x54be48,{'transaction':_0x4f1294})[_0x19c8('0x21')](function(_0xfdc78){var _0x3da334=_0xfdc78[_0x19c8('0x23')]({'plain':!![]});var _0xa7b0c1=_['map'](addVoicePrefixExtensions(_0x4c563c,_0x116974),function(_0x43510e){_0x43510e['VoiceExtensionId']=_0x3da334['id'];_0x43510e['VoicePrefixId']=_0x4c563c['id'];return _0x43510e;});return db['VoiceExtension'][_0x19c8('0x5d')](_0xa7b0c1,{'transaction':_0x4f1294})[_0x19c8('0x21')](function(_0x59d4dc){if(!_0x59d4dc){return _0x50d083(_0x19c8('0x5e'));}else{return _0x255cbc(_0x59d4dc);}})['catch'](function(_0x3e2e80){return _0x50d083(_0x3e2e80);});});;});};function addVoicePrefixExtensions(_0x4907cb,_0x5300a4){var _0x47bc35=[];var _0x5b4e2f=formatPrefixName(_0x4907cb[_0x19c8('0x5a')]);_0x47bc35[_0x19c8('0x5f')](new Extension(_0x5b4e2f,0x2,_0x19c8('0x60'),_0x19c8('0x61')+_0x4907cb[_0x19c8('0x28')]));if(_0x4907cb[_0x19c8('0x62')]){_0x47bc35[_0x19c8('0x5f')](new Extension(_0x5b4e2f,0x3,_0x19c8('0x60'),_0x19c8('0x63')+_0x4907cb['callerIdAll']));}else{_0x47bc35[_0x19c8('0x5f')](new Extension(_0x5b4e2f,0x3,_0x19c8('0x5b'),_0x19c8('0x64')));}_0x47bc35[_0x19c8('0x5f')](new Extension(_0x5b4e2f,0x4,_0x19c8('0x65'),_0x5300a4['context']+','+_0x19c8('0x66')+(0x8+_0x4907cb[_0x19c8('0x28')][_0x19c8('0x34')])+'}'+','+0x1));return _0x47bc35;}function formatPrefixName(_0x533e2d){var _0x14a4f1='_';for(var _0x517ab3=0x0;_0x517ab3<_0x533e2d['length'];_0x517ab3++){if(_0x533e2d[_0x19c8('0x67')](_0x517ab3)=='-'){_0x14a4f1+=_0x533e2d[_0x19c8('0x67')](_0x517ab3);}else{_0x14a4f1+='['+_0x533e2d[_0x19c8('0x67')](_0x517ab3)+']';}}_0x14a4f1+='.';return _0x14a4f1;}exports['update']=function(_0x50974b,_0x5626d8,_0x1ceddc){var _0x476406=_0x50974b['body'];_0x476406[_0x19c8('0x5a')]='system-'+_0x476406[_0x19c8('0x28')]+'-';return db[_0x19c8('0x4c')][_0x19c8('0x4d')](function(_0x43f6df){return db[_0x19c8('0x2b')]['update'](_0x476406,{'where':{'id':_0x476406['id']},'transaction':_0x43f6df})['then'](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x476406['id']},'transaction':_0x43f6df})['then'](function(){return db[_0x19c8('0x4e')][_0x19c8('0x48')]({'where':{'id':_0x476406[_0x19c8('0x4f')]},'raw':!![]})[_0x19c8('0x21')](function(_0xe27b8){return createVoicePrefixExtensions(_0x476406,_0xe27b8,_0x43f6df);});});});})[_0x19c8('0x21')](function(){return db[_0x19c8('0x2b')][_0x19c8('0x68')](_0x476406['id']);})[_0x19c8('0x21')](respondWithResult(_0x5626d8,null))['catch'](handleError(_0x5626d8,null));};exports[_0x19c8('0x69')]=function(_0xcd9bc0,_0x58ecf1,_0x4d64e5){return db[_0x19c8('0x2b')][_0x19c8('0x48')]({'where':{'id':_0xcd9bc0[_0x19c8('0x45')]['id']}})['then'](handleEntityNotFound(_0x58ecf1,null))[_0x19c8('0x21')](function(_0x2f004b){if(_0x2f004b){return _0x2f004b['addAgents'](_0xcd9bc0[_0x19c8('0x6a')][_0x19c8('0x6b')],_[_0x19c8('0x6c')](_0xcd9bc0[_0x19c8('0x6a')],[_0x19c8('0x6b'),'id'])||{})[_0x19c8('0x6d')](function(_0x124ea0){for(var _0x78d0b2=0x0;_0x78d0b2<_0xcd9bc0['body'][_0x19c8('0x6b')][_0x19c8('0x34')];_0x78d0b2+=0x1){socket[_0x19c8('0x6e')]('userVoicePrefix:save',{'UserId':_0xcd9bc0[_0x19c8('0x6a')][_0x19c8('0x6b')][_0x78d0b2],'VoicePrefixId':_0xcd9bc0[_0x19c8('0x45')]['id']});}return _0x124ea0;});}})[_0x19c8('0x21')](respondWithResult(_0x58ecf1,null))[_0x19c8('0x49')](handleError(_0x58ecf1,null));};exports['removeAgents']=function(_0x5c339c,_0x1d5b94,_0x3aafb3){return db[_0x19c8('0x2b')]['find']({'where':{'id':_0x5c339c[_0x19c8('0x45')]['id']}})[_0x19c8('0x21')](handleEntityNotFound(_0x1d5b94,null))[_0x19c8('0x21')](function(_0x36c561){if(_0x36c561){return _0x36c561[_0x19c8('0x6f')](_0x5c339c[_0x19c8('0x2f')][_0x19c8('0x6b')])[_0x19c8('0x21')](function(){if(_['isArray'](_0x5c339c[_0x19c8('0x2f')]['ids'])){for(var _0xa25289=0x0;_0xa25289<_0x5c339c['query']['ids'][_0x19c8('0x34')];_0xa25289+=0x1){socket['emit'](_0x19c8('0x70'),{'UserId':Number(_0x5c339c['query'][_0x19c8('0x6b')][_0xa25289]),'VoicePrefixId':Number(_0x5c339c[_0x19c8('0x45')]['id'])});}}else{socket[_0x19c8('0x6e')](_0x19c8('0x70'),{'UserId':Number(_0x5c339c[_0x19c8('0x2f')][_0x19c8('0x6b')]),'VoicePrefixId':Number(_0x5c339c[_0x19c8('0x45')]['id'])});}});}})[_0x19c8('0x21')](respondWithStatusCode(_0x1d5b94,null))[_0x19c8('0x49')](handleError(_0x1d5b94,null));};exports[_0x19c8('0x71')]=function(_0x3e45e6,_0x4f2e3a,_0x3452ba){var _0x299beb={};var _0x575088={};var _0x2014ce;var _0x13183a;return db['VoicePrefix'][_0x19c8('0x72')]({'where':{'id':_0x3e45e6[_0x19c8('0x45')]['id']}})[_0x19c8('0x21')](handleEntityNotFound(_0x4f2e3a,null))[_0x19c8('0x21')](function(_0x15dcdf){if(_0x15dcdf){_0x2014ce=_0x15dcdf;_0x575088[_0x19c8('0x2e')]=_[_0x19c8('0x46')](db[_0x19c8('0x73')]['rawAttributes']);_0x575088[_0x19c8('0x2f')]=_[_0x19c8('0x46')](_0x3e45e6[_0x19c8('0x2f')]);_0x575088['filters']=_[_0x19c8('0x31')](_0x575088[_0x19c8('0x2e')],_0x575088['query']);_0x299beb['attributes']=_[_0x19c8('0x31')](_0x575088[_0x19c8('0x2e')],qs[_0x19c8('0x32')](_0x3e45e6[_0x19c8('0x2f')]['fields']));_0x299beb[_0x19c8('0x33')]=_0x299beb[_0x19c8('0x33')][_0x19c8('0x34')]?_0x299beb[_0x19c8('0x33')]:_0x575088[_0x19c8('0x2e')];_0x299beb[_0x19c8('0x37')]=qs[_0x19c8('0x38')](_0x3e45e6[_0x19c8('0x2f')][_0x19c8('0x38')]);_0x299beb['where']=qs[_0x19c8('0x30')](_['pick'](_0x3e45e6[_0x19c8('0x2f')],_0x575088['filters']));if(_0x3e45e6[_0x19c8('0x2f')][_0x19c8('0x3b')]){_0x299beb['where']=_[_0x19c8('0x3c')](_0x299beb[_0x19c8('0x39')],{'$or':_[_0x19c8('0x3d')](_0x299beb[_0x19c8('0x33')],function(_0x36420b){var _0x504adc={};_0x504adc[_0x36420b]={'$like':'%'+_0x3e45e6[_0x19c8('0x2f')][_0x19c8('0x3b')]+'%'};return _0x504adc;})});}_0x299beb=_[_0x19c8('0x3c')]({},_0x299beb,_0x3e45e6[_0x19c8('0x3f')]);return _0x2014ce['getAgents'](_0x299beb);}})[_0x19c8('0x21')](function(_0x1754f4){if(_0x1754f4){_0x13183a=_0x1754f4[_0x19c8('0x34')];if(!_0x3e45e6[_0x19c8('0x2f')]['hasOwnProperty'](_0x19c8('0x36'))){_0x299beb[_0x19c8('0x1c')]=qs[_0x19c8('0x1c')](_0x3e45e6[_0x19c8('0x2f')]['limit']);_0x299beb[_0x19c8('0x1b')]=qs[_0x19c8('0x1b')](_0x3e45e6[_0x19c8('0x2f')]['offset']);}return _0x2014ce[_0x19c8('0x71')](_0x299beb);}})[_0x19c8('0x21')](function(_0x1ae744){if(_0x1ae744){return _0x1ae744?{'count':_0x13183a,'rows':_0x1ae744}:null;}})[_0x19c8('0x21')](respondWithResult(_0x4f2e3a,null))['catch'](handleError(_0x4f2e3a,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 2e5ef2c..ad86e7f 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 _0x34e8=['emit','hasOwnProperty','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','update','remove'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x34e8,0x12c));var _0x834e=function(_0x1378f6,_0x194b34){_0x1378f6=_0x1378f6-0x0;var _0x2523ea=_0x34e8[_0x1378f6];return _0x2523ea;};'use strict';var EventEmitter=require(_0x834e('0x0'));var VoicePrefix=require(_0x834e('0x1'))['db'][_0x834e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x834e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x834e('0x4'),'afterDestroy':_0x834e('0x5')};function emitEvent(_0x472111){return function(_0x31bf20,_0x289ef2,_0x19a3e0){VoicePrefixEvents[_0x834e('0x6')](_0x472111+':'+_0x31bf20['id'],_0x31bf20);VoicePrefixEvents['emit'](_0x472111,_0x31bf20);_0x19a3e0(null);};}for(var e in events){if(events[_0x834e('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x834e('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0xa9e0=['hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix','update','emit'];(function(_0x725a4c,_0x102507){var _0x37b2cc=function(_0x505fc9){while(--_0x505fc9){_0x725a4c['push'](_0x725a4c['shift']());}};_0x37b2cc(++_0x102507);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'use strict';var EventEmitter=require(_0x0a9e('0x0'));var VoicePrefix=require(_0x0a9e('0x1'))['db'][_0x0a9e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0a9e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x333808){return function(_0x432180,_0x2ab90b,_0x991246){VoicePrefixEvents[_0x0a9e('0x4')](_0x333808+':'+_0x432180['id'],_0x432180);VoicePrefixEvents['emit'](_0x333808,_0x432180);_0x991246(null);};}for(var e in events){if(events[_0x0a9e('0x5')](e)){var event=events[e];VoicePrefix[_0x0a9e('0x6')](e,emitEvent(event));}}module[_0x0a9e('0x7')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 9d2934c..1f30b46 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 _0x69ed=['request-promise','path','../../config/environment','exports','define','VoicePrefix','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x121709,_0xf73b35){var _0x36bec9=function(_0xb4f100){while(--_0xb4f100){_0x121709['push'](_0x121709['shift']());}};_0x36bec9(++_0xf73b35);}(_0x69ed,0x192));var _0xd69e=function(_0x487824,_0x1799d9){_0x487824=_0x487824-0x0;var _0xfefae4=_0x69ed[_0x487824];return _0xfefae4;};'use strict';var _=require(_0xd69e('0x0'));var util=require(_0xd69e('0x1'));var logger=require(_0xd69e('0x2'))(_0xd69e('0x3'));var moment=require(_0xd69e('0x4'));var BPromise=require(_0xd69e('0x5'));var rp=require(_0xd69e('0x6'));var fs=require('fs');var path=require(_0xd69e('0x7'));var rimraf=require('rimraf');var config=require(_0xd69e('0x8'));var attributes=require('./voicePrefix.attributes');module[_0xd69e('0x9')]=function(_0x4be984,_0x5847ce){return _0x4be984[_0xd69e('0xa')](_0xd69e('0xb'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe08a=['define','VoicePrefix','voice_prefixes','util','api','moment','bluebird','request-promise','path','../../config/environment','./voicePrefix.attributes','exports'];(function(_0x2eade5,_0x5593b8){var _0x1e9966=function(_0x4c6612){while(--_0x4c6612){_0x2eade5['push'](_0x2eade5['shift']());}};_0x1e9966(++_0x5593b8);}(_0xe08a,0x18f));var _0xae08=function(_0x464bfb,_0x53f19a){_0x464bfb=_0x464bfb-0x0;var _0x57f96f=_0xe08a[_0x464bfb];return _0x57f96f;};'use strict';var _=require('lodash');var util=require(_0xae08('0x0'));var logger=require('../../config/logger')(_0xae08('0x1'));var moment=require(_0xae08('0x2'));var BPromise=require(_0xae08('0x3'));var rp=require(_0xae08('0x4'));var fs=require('fs');var path=require(_0xae08('0x5'));var rimraf=require('rimraf');var config=require(_0xae08('0x6'));var attributes=require(_0xae08('0x7'));module[_0xae08('0x8')]=function(_0x4f20dd,_0x4f480d){return _0x4f20dd[_0xae08('0x9')](_0xae08('0xa'),attributes,{'tableName':_0xae08('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 4cd0daf..da5d364 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 _0xb6cd=['lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','request','then','info','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message'];(function(_0x3363d1,_0x5e1e95){var _0x19e864=function(_0x474557){while(--_0x474557){_0x3363d1['push'](_0x3363d1['shift']());}};_0x19e864(++_0x5e1e95);}(_0xb6cd,0x144));var _0xdb6c=function(_0x1f6f10,_0xf954ea){_0x1f6f10=_0x1f6f10-0x0;var _0x138327=_0xb6cd[_0x1f6f10];return _0x138327;};'use strict';var _=require(_0xdb6c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xdb6c('0x1'));var rs=require(_0xdb6c('0x2'));var fs=require('fs');var Redis=require(_0xdb6c('0x3'));var db=require(_0xdb6c('0x4'))['db'];var utils=require(_0xdb6c('0x5'));var logger=require(_0xdb6c('0x6'))(_0xdb6c('0x7'));var config=require(_0xdb6c('0x8'));var jayson=require(_0xdb6c('0x9'));var client=jayson[_0xdb6c('0xa')]['http']({'port':0x232a});config[_0xdb6c('0xb')]=_[_0xdb6c('0xc')](config[_0xdb6c('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xdb6c('0xd'))(new Redis(config['redis']));require(_0xdb6c('0xe'))[_0xdb6c('0xf')](socket);function respondWithRpcPromise(_0x661511,_0x4d1e6a,_0x1663fa){return new BPromise(function(_0x2f505d,_0x60ca7f){return client[_0xdb6c('0x10')](_0x661511,_0x1663fa)[_0xdb6c('0x11')](function(_0xbe63b6){logger[_0xdb6c('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x4d1e6a,_0xdb6c('0x13'));logger[_0xdb6c('0x14')](_0xdb6c('0x15'),_0x4d1e6a,_0xdb6c('0x13'),JSON[_0xdb6c('0x16')](_0xbe63b6));if(_0xbe63b6[_0xdb6c('0x17')]){if(_0xbe63b6[_0xdb6c('0x17')][_0xdb6c('0x18')]===0x1f4){logger[_0xdb6c('0x17')](_0xdb6c('0x19'),_0x4d1e6a,_0xbe63b6['error'][_0xdb6c('0x1a')]);return _0x60ca7f(_0xbe63b6[_0xdb6c('0x17')][_0xdb6c('0x1a')]);}logger[_0xdb6c('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x4d1e6a,_0xbe63b6['error'][_0xdb6c('0x1a')]);return _0x2f505d(_0xbe63b6[_0xdb6c('0x17')]['message']);}else{logger[_0xdb6c('0x12')](_0xdb6c('0x19'),_0x4d1e6a,'request\x20sent');_0x2f505d(_0xbe63b6['result'][_0xdb6c('0x1a')]);}})['catch'](function(_0x2e9a8b){logger['error'](_0xdb6c('0x19'),_0x4d1e6a,_0x2e9a8b);_0x60ca7f(_0x2e9a8b);});});} \ No newline at end of file +var _0xa14a=['jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','rpc','../../config/environment'];(function(_0x567be4,_0x528383){var _0x13067b=function(_0x3afb62){while(--_0x3afb62){_0x567be4['push'](_0x567be4['shift']());}};_0x13067b(++_0x528383);}(_0xa14a,0x1b9));var _0xaa14=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0xa14a[_0x50007c];return _0x5c1ec7;};'use strict';var _=require(_0xaa14('0x0'));var util=require('util');var moment=require(_0xaa14('0x1'));var BPromise=require(_0xaa14('0x2'));var rs=require(_0xaa14('0x3'));var fs=require('fs');var Redis=require(_0xaa14('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xaa14('0x5'));var config=require(_0xaa14('0x6'));var jayson=require(_0xaa14('0x7'));var client=jayson['client'][_0xaa14('0x8')]({'port':0x232a});config[_0xaa14('0x9')]=_[_0xaa14('0xa')](config['redis'],{'host':_0xaa14('0xb'),'port':0x18eb});var socket=require(_0xaa14('0xc'))(new Redis(config[_0xaa14('0x9')]));require(_0xaa14('0xd'))[_0xaa14('0xe')](socket);function respondWithRpcPromise(_0x3ddaef,_0x1c6689,_0x454b9c){return new BPromise(function(_0x1fdd61,_0x1ca205){return client[_0xaa14('0xf')](_0x3ddaef,_0x454b9c)[_0xaa14('0x10')](function(_0x116cc4){logger[_0xaa14('0x11')]('VoicePrefix,\x20%s,\x20%s',_0x1c6689,_0xaa14('0x12'));logger[_0xaa14('0x13')](_0xaa14('0x14'),_0x1c6689,_0xaa14('0x12'),JSON[_0xaa14('0x15')](_0x116cc4));if(_0x116cc4[_0xaa14('0x16')]){if(_0x116cc4['error'][_0xaa14('0x17')]===0x1f4){logger[_0xaa14('0x16')](_0xaa14('0x18'),_0x1c6689,_0x116cc4['error']['message']);return _0x1ca205(_0x116cc4[_0xaa14('0x16')][_0xaa14('0x19')]);}logger['error'](_0xaa14('0x18'),_0x1c6689,_0x116cc4[_0xaa14('0x16')][_0xaa14('0x19')]);return _0x1fdd61(_0x116cc4['error'][_0xaa14('0x19')]);}else{logger[_0xaa14('0x11')]('VoicePrefix,\x20%s,\x20%s',_0x1c6689,'request\x20sent');_0x1fdd61(_0x116cc4[_0xaa14('0x1a')]['message']);}})[_0xaa14('0x1b')](function(_0x4579bc){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x1c6689,_0x4579bc);_0x1ca205(_0x4579bc);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 6ea89f1..2317c95 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 _0x26de=['emit','removeListener','voicePrefix:','./voicePrefix.events','save','remove','update'];(function(_0x516ffb,_0x5b5b42){var _0x319667=function(_0x250098){while(--_0x250098){_0x516ffb['push'](_0x516ffb['shift']());}};_0x319667(++_0x5b5b42);}(_0x26de,0x1d1));var _0xe26d=function(_0x36bec1,_0x715b9e){_0x36bec1=_0x36bec1-0x0;var _0x39640a=_0x26de[_0x36bec1];return _0x39640a;};'use strict';var VoicePrefixEvents=require(_0xe26d('0x0'));var events=[_0xe26d('0x1'),_0xe26d('0x2'),_0xe26d('0x3')];function createListener(_0x205fde,_0x593b2b){return function(_0xaa9948){_0x593b2b[_0xe26d('0x4')](_0x205fde,_0xaa9948);};}function removeListener(_0x35b5dc,_0x58cb67){return function(){VoicePrefixEvents[_0xe26d('0x5')](_0x35b5dc,_0x58cb67);};}exports['register']=function(_0x1c9ffe){for(var _0x1c1388=0x0,_0xe762c8=events['length'];_0x1c1388<_0xe762c8;_0x1c1388++){var _0x55b2de=events[_0x1c1388];var _0x48d8a8=createListener(_0xe26d('0x6')+_0x55b2de,_0x1c9ffe);VoicePrefixEvents['on'](_0x55b2de,_0x48d8a8);}}; \ No newline at end of file +var _0xd6ee=['removeListener','register','length','voicePrefix:','./voicePrefix.events','save','emit'];(function(_0x1d29bd,_0x29eaef){var _0x57703c=function(_0x293847){while(--_0x293847){_0x1d29bd['push'](_0x1d29bd['shift']());}};_0x57703c(++_0x29eaef);}(_0xd6ee,0x1c4));var _0xed6e=function(_0x3109f1,_0x31e90d){_0x3109f1=_0x3109f1-0x0;var _0x1b041b=_0xd6ee[_0x3109f1];return _0x1b041b;};'use strict';var VoicePrefixEvents=require(_0xed6e('0x0'));var events=[_0xed6e('0x1'),'remove','update'];function createListener(_0x12b56a,_0x2c8c78){return function(_0x52b672){_0x2c8c78[_0xed6e('0x2')](_0x12b56a,_0x52b672);};}function removeListener(_0x9b3201,_0x3cb086){return function(){VoicePrefixEvents[_0xed6e('0x3')](_0x9b3201,_0x3cb086);};}exports[_0xed6e('0x4')]=function(_0x1b33d3){for(var _0x2da644=0x0,_0x57266a=events[_0xed6e('0x5')];_0x2da644<_0x57266a;_0x2da644++){var _0x913660=events[_0x2da644];var _0x50b16e=createListener(_0xed6e('0x6')+_0x913660,_0x1b33d3);VoicePrefixEvents['on'](_0x913660,_0x50b16e);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 799fddb..a8f7233 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 _0xd4a5=['util','path','express','Router','../../components/interaction/service','get','index','/:id','isAuthenticated','show','/:id/hoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','getTeams','getAgents','/:id/members','getMembers','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','/:id/teams','addTeams','/:id/users','addAgents','/:id/lists','addLists','addBlackLists','put','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0xd4a5,0xa4));var _0x5d4a=function(_0x3c9f7b,_0x5296b7){_0x3c9f7b=_0x3c9f7b-0x0;var _0x59ea58=_0xd4a5[_0x3c9f7b];return _0x59ea58;};'use strict';var multer=require('multer');var util=require(_0x5d4a('0x0'));var path=require(_0x5d4a('0x1'));var timeout=require('connect-timeout');var express=require(_0x5d4a('0x2'));var router=express[_0x5d4a('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x5d4a('0x4'));var config=require('../../config/environment');var controller=require('./voiceQueue.controller');router[_0x5d4a('0x5')]('/',auth['isAuthenticated'](),controller[_0x5d4a('0x6')]);router[_0x5d4a('0x5')](_0x5d4a('0x7'),auth[_0x5d4a('0x8')](),controller[_0x5d4a('0x9')]);router['get'](_0x5d4a('0xa'),auth['isAuthenticated'](),controller['getHoppers']);router['get']('/:id/hopper_histories',auth[_0x5d4a('0x8')](),controller[_0x5d4a('0xb')]);router[_0x5d4a('0x5')](_0x5d4a('0xc'),auth[_0x5d4a('0x8')](),controller[_0x5d4a('0xd')]);router[_0x5d4a('0x5')](_0x5d4a('0xe'),auth[_0x5d4a('0x8')](),controller[_0x5d4a('0xf')]);router[_0x5d4a('0x5')]('/:id/teams',auth[_0x5d4a('0x8')](),controller[_0x5d4a('0x10')]);router[_0x5d4a('0x5')]('/:id/users',auth[_0x5d4a('0x8')](),controller[_0x5d4a('0x11')]);router[_0x5d4a('0x5')](_0x5d4a('0x12'),auth[_0x5d4a('0x8')](),controller[_0x5d4a('0x13')]);router[_0x5d4a('0x5')]('/:id/lists',auth['isAuthenticated'](),controller['getLists']);router[_0x5d4a('0x5')](_0x5d4a('0x14'),auth[_0x5d4a('0x8')](),controller[_0x5d4a('0x15')]);router[_0x5d4a('0x16')]('/',auth[_0x5d4a('0x8')](),controller[_0x5d4a('0x17')]);router['post'](_0x5d4a('0x18'),auth['isAuthenticated'](),controller[_0x5d4a('0x19')]);router[_0x5d4a('0x16')](_0x5d4a('0x1a'),auth['isAuthenticated'](),controller[_0x5d4a('0x1b')]);router[_0x5d4a('0x16')](_0x5d4a('0x1c'),auth[_0x5d4a('0x8')](),controller[_0x5d4a('0x1d')]);router[_0x5d4a('0x16')](_0x5d4a('0x1e'),auth[_0x5d4a('0x8')](),controller[_0x5d4a('0x1f')]);router['post'](_0x5d4a('0x14'),auth[_0x5d4a('0x8')](),controller[_0x5d4a('0x20')]);router[_0x5d4a('0x21')]('/:id',auth['isAuthenticated'](),controller[_0x5d4a('0x22')]);router[_0x5d4a('0x23')](_0x5d4a('0x7'),auth[_0x5d4a('0x8')](),controller['destroy']);router['delete'](_0x5d4a('0x1a'),auth[_0x5d4a('0x8')](),controller[_0x5d4a('0x24')]);router['delete'](_0x5d4a('0x1c'),auth['isAuthenticated'](),controller[_0x5d4a('0x25')]);router['delete'](_0x5d4a('0x1e'),auth['isAuthenticated'](),controller[_0x5d4a('0x26')]);router['delete'](_0x5d4a('0x14'),auth[_0x5d4a('0x8')](),controller[_0x5d4a('0x27')]);module[_0x5d4a('0x28')]=router; \ No newline at end of file +var _0xae79=['getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/members','getMembers','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','clone','addTeams','/:id/users','addAgents','put','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','isAuthenticated','index','/:id','show','getHoppers','getHopperHistories','/:id/hopper_finals'];(function(_0x110827,_0x87e18f){var _0x1c5411=function(_0x45d3ab){while(--_0x45d3ab){_0x110827['push'](_0x110827['shift']());}};_0x1c5411(++_0x87e18f);}(_0xae79,0x1c5));var _0x9ae7=function(_0x41b368,_0x4b3c2c){_0x41b368=_0x41b368-0x0;var _0x136076=_0xae79[_0x41b368];return _0x136076;};'use strict';var multer=require(_0x9ae7('0x0'));var util=require(_0x9ae7('0x1'));var path=require('path');var timeout=require(_0x9ae7('0x2'));var express=require(_0x9ae7('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x9ae7('0x4'));var config=require(_0x9ae7('0x5'));var controller=require(_0x9ae7('0x6'));router[_0x9ae7('0x7')]('/',auth[_0x9ae7('0x8')](),controller[_0x9ae7('0x9')]);router[_0x9ae7('0x7')](_0x9ae7('0xa'),auth['isAuthenticated'](),controller[_0x9ae7('0xb')]);router[_0x9ae7('0x7')]('/:id/hoppers',auth[_0x9ae7('0x8')](),controller[_0x9ae7('0xc')]);router[_0x9ae7('0x7')]('/:id/hopper_histories',auth[_0x9ae7('0x8')](),controller[_0x9ae7('0xd')]);router[_0x9ae7('0x7')](_0x9ae7('0xe'),auth['isAuthenticated'](),controller[_0x9ae7('0xf')]);router[_0x9ae7('0x7')](_0x9ae7('0x10'),auth[_0x9ae7('0x8')](),controller[_0x9ae7('0x11')]);router[_0x9ae7('0x7')](_0x9ae7('0x12'),auth['isAuthenticated'](),controller['getTeams']);router[_0x9ae7('0x7')]('/:id/users',auth[_0x9ae7('0x8')](),controller['getAgents']);router[_0x9ae7('0x7')](_0x9ae7('0x13'),auth['isAuthenticated'](),controller[_0x9ae7('0x14')]);router[_0x9ae7('0x7')](_0x9ae7('0x15'),auth[_0x9ae7('0x8')](),controller[_0x9ae7('0x16')]);router['get'](_0x9ae7('0x17'),auth[_0x9ae7('0x8')](),controller[_0x9ae7('0x18')]);router[_0x9ae7('0x19')]('/',auth[_0x9ae7('0x8')](),controller[_0x9ae7('0x1a')]);router[_0x9ae7('0x19')]('/:id/clone',auth[_0x9ae7('0x8')](),controller[_0x9ae7('0x1b')]);router[_0x9ae7('0x19')](_0x9ae7('0x12'),auth[_0x9ae7('0x8')](),controller[_0x9ae7('0x1c')]);router[_0x9ae7('0x19')](_0x9ae7('0x1d'),auth[_0x9ae7('0x8')](),controller[_0x9ae7('0x1e')]);router[_0x9ae7('0x19')](_0x9ae7('0x15'),auth['isAuthenticated'](),controller['addLists']);router['post']('/:id/blacklists',auth[_0x9ae7('0x8')](),controller['addBlackLists']);router[_0x9ae7('0x1f')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x9ae7('0x20')](_0x9ae7('0xa'),auth[_0x9ae7('0x8')](),controller[_0x9ae7('0x21')]);router[_0x9ae7('0x20')](_0x9ae7('0x12'),auth[_0x9ae7('0x8')](),controller[_0x9ae7('0x22')]);router[_0x9ae7('0x20')](_0x9ae7('0x1d'),auth[_0x9ae7('0x8')](),controller[_0x9ae7('0x23')]);router[_0x9ae7('0x20')](_0x9ae7('0x15'),auth[_0x9ae7('0x8')](),controller[_0x9ae7('0x24')]);router[_0x9ae7('0x20')](_0x9ae7('0x17'),auth['isAuthenticated'](),controller[_0x9ae7('0x25')]);module[_0x9ae7('0x26')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index a8b65fb..ec6fd6d 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(_0x4a281d,_0x27cde8){var _0x3033e7=function(_0x25ba1f){while(--_0x25ba1f){_0x4a281d['push'](_0x4a281d['shift']());}};_0x3033e7(++_0x27cde8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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(_0x1ffaf9,_0x3180b1){var _0x25e3a5=function(_0x3ecdb0){while(--_0x3ecdb0){_0x1ffaf9['push'](_0x1ffaf9['shift']());}};_0x25e3a5(++_0x3180b1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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 6afec88..5ae8087 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 _0x50c1=['transaction','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','voicePause','forEach','emit','removeTeams','ids','User','field','tq.TeamId','team_has_voice_queues','join','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','all','union','compact','isEmpty','removeAgents','userVoiceQueue:remove','spread','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','fromQuery','phone','scheduledAt','ContactId','select','CmListId','cm_contacts','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','COALESCE(phone,\x27\x27)','VoiceQueueId\x20=\x20?','onlyIfOpen','cm_hopper','ListId','NOW()','ListId\x20=\x20?','deletedAt\x20IS\x20NULL','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','offset','limit','apply','reject','save','destroy','then','VoiceQueues','QueueCampaigns','outbound','filter','ignore','value','includes','type','error','stack','send','index','map','VoiceQueue','key','model','name','query','keys','filters','intersection','attributes','fields','length','order','sort','where','merge','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','inbound','find','UserProfileSection','autoAssociation','clone','omit','createdAt','updatedAt','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getHoppers','findOne','CmHopper','hasOwnProperty','nolimit','pick','VoiceQueueId','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','Agents','online','interface','flatMap','penalty','sequelize'];(function(_0x350fe1,_0x53971c){var _0x8b53d6=function(_0x5c05df){while(--_0x5c05df){_0x350fe1['push'](_0x350fe1['shift']());}};_0x8b53d6(++_0x53971c);}(_0x50c1,0x1b6));var _0x150c=function(_0x3bf533,_0x298026){_0x3bf533=_0x3bf533-0x0;var _0x527209=_0x50c1[_0x3bf533];return _0x527209;};'use strict';var pdf=require(_0x150c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x150c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x150c('0x2'));var rp=require(_0x150c('0x3'));var moment=require('moment');var BPromise=require(_0x150c('0x4'));var Mustache=require(_0x150c('0x5'));var util=require(_0x150c('0x6'));var path=require(_0x150c('0x7'));var sox=require('sox');var csv=require(_0x150c('0x8'));var ejs=require(_0x150c('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x150c('0xa'));var crypto=require(_0x150c('0xb'));var jsforce=require(_0x150c('0xc'));var deskjs=require(_0x150c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x150c('0xe'));var Papa=require(_0x150c('0xf'));var Redis=require(_0x150c('0x10'));var authService=require(_0x150c('0x11'));var qs=require(_0x150c('0x12'));var as=require(_0x150c('0x13'));var hardwareService=require(_0x150c('0x14'));var logger=require('../../config/logger')(_0x150c('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x150c('0x16'))['db'];config[_0x150c('0x17')]=_[_0x150c('0x18')](config[_0x150c('0x17')],{'host':_0x150c('0x19'),'port':0x18eb});var socket=require(_0x150c('0x1a'))(new Redis(config[_0x150c('0x17')]));require(_0x150c('0x1b'))[_0x150c('0x1c')](socket);function respondWithStatusCode(_0x50c0a7,_0x5d6950){_0x5d6950=_0x5d6950||0xcc;return function(_0x5412ca){if(_0x5412ca){return _0x50c0a7[_0x150c('0x1d')](_0x5d6950);}return _0x50c0a7[_0x150c('0x1e')](_0x5d6950)[_0x150c('0x1f')]();};}function respondWithResult(_0x168e47,_0x2add86){_0x2add86=_0x2add86||0xc8;return function(_0x11ff13){if(_0x11ff13){return _0x168e47['status'](_0x2add86)[_0x150c('0x20')](_0x11ff13);}};}function respondWithFilteredResult(_0x2de72f,_0x4daf79){return function(_0x46c10e){if(_0x46c10e){var _0x1b629e=_0x46c10e['count'],_0x5bc046=_0x4daf79[_0x150c('0x21')],_0x11ca58=_0x4daf79['offset']+_0x4daf79[_0x150c('0x22')],_0x460221;if(_0x11ca58>=_0x1b629e){_0x11ca58=_0x1b629e;_0x460221=0xc8;}else{_0x460221=0xce;}_0x2de72f['status'](_0x460221);return _0x2de72f['set']('Content-Range',_0x5bc046+'-'+_0x11ca58+'/'+_0x1b629e)[_0x150c('0x20')](_0x46c10e);}return null;};}function patchUpdates(_0x2d4e47){return function(_0x256f7c){try{jsonpatch[_0x150c('0x23')](_0x256f7c,_0x2d4e47,!![]);}catch(_0x1fd1e7){return BPromise[_0x150c('0x24')](_0x1fd1e7);}return _0x256f7c[_0x150c('0x25')]();};}function saveUpdates(_0x3eff82,_0x8b1177){return function(_0xce2eca){if(_0xce2eca){return _0xce2eca['update'](_0x3eff82)['then'](function(_0x1b0c6c){return _0x1b0c6c;});}return null;};}function removeEntity(_0x3afccf,_0x4061c5){return function(_0x25e31c){if(_0x25e31c){return _0x25e31c[_0x150c('0x26')]()[_0x150c('0x27')](function(){var _0x2749ff=_0x25e31c['get']({'plain':!![]});var _0x92d995=[{'name':_0x150c('0x28'),'value':'inbound','ignore':![]},{'name':_0x150c('0x29'),'value':_0x150c('0x2a'),'ignore':![]}];var _0x42ecb1=_(_0x92d995)[_0x150c('0x2b')](_0x150c('0x2c'))['map'](_0x150c('0x2d'))[_0x150c('0x2d')]();if(_[_0x150c('0x2e')](_0x42ecb1,_0x2749ff['type'])){return;}var _0x12363e=_['find'](_0x92d995,['value',_0x2749ff[_0x150c('0x2f')]])['name'];return db['UserProfileResource'][_0x150c('0x26')]({'where':{'type':_0x12363e,'resourceId':_0x2749ff['id']}})[_0x150c('0x27')](function(){return _0x25e31c;});})[_0x150c('0x27')](function(){_0x3afccf[_0x150c('0x1e')](0xcc)[_0x150c('0x1f')]();});}};}function handleEntityNotFound(_0x2e3cc4,_0x2c894d){return function(_0x145a98){if(!_0x145a98){_0x2e3cc4['sendStatus'](0x194);}return _0x145a98;};}function handleError(_0x3d23df,_0x1daea7){_0x1daea7=_0x1daea7||0x1f4;return function(_0x5d53ab){logger[_0x150c('0x30')](_0x5d53ab[_0x150c('0x31')]);if(_0x5d53ab['name']){delete _0x5d53ab['name'];}_0x3d23df[_0x150c('0x1e')](_0x1daea7)[_0x150c('0x32')](_0x5d53ab);};}exports[_0x150c('0x33')]=function(_0x9a4e96,_0x1dc2f0){var _0x14db67={},_0x58d4fb={},_0x21a0cf={'count':0x0,'rows':[]};var _0x387fde=_[_0x150c('0x34')](db[_0x150c('0x35')]['rawAttributes'],function(_0x2258ca){return{'name':_0x2258ca['fieldName'],'type':_0x2258ca[_0x150c('0x2f')][_0x150c('0x36')]};});_0x58d4fb[_0x150c('0x37')]=_['map'](_0x387fde,_0x150c('0x38'));_0x58d4fb[_0x150c('0x39')]=_[_0x150c('0x3a')](_0x9a4e96[_0x150c('0x39')]);_0x58d4fb[_0x150c('0x3b')]=_[_0x150c('0x3c')](_0x58d4fb[_0x150c('0x37')],_0x58d4fb['query']);_0x14db67[_0x150c('0x3d')]=_[_0x150c('0x3c')](_0x58d4fb[_0x150c('0x37')],qs[_0x150c('0x3e')](_0x9a4e96['query'][_0x150c('0x3e')]));_0x14db67[_0x150c('0x3d')]=_0x14db67[_0x150c('0x3d')][_0x150c('0x3f')]?_0x14db67[_0x150c('0x3d')]:_0x58d4fb['model'];if(!_0x9a4e96[_0x150c('0x39')]['hasOwnProperty']('nolimit')){_0x14db67[_0x150c('0x22')]=qs[_0x150c('0x22')](_0x9a4e96[_0x150c('0x39')]['limit']);_0x14db67[_0x150c('0x21')]=qs[_0x150c('0x21')](_0x9a4e96[_0x150c('0x39')][_0x150c('0x21')]);}_0x14db67[_0x150c('0x40')]=qs[_0x150c('0x41')](_0x9a4e96[_0x150c('0x39')][_0x150c('0x41')]);_0x14db67[_0x150c('0x42')]=qs['filters'](_['pick'](_0x9a4e96[_0x150c('0x39')],_0x58d4fb[_0x150c('0x3b')]));if(_0x9a4e96[_0x150c('0x39')]['filter']){_0x14db67[_0x150c('0x42')]=_[_0x150c('0x43')](_0x14db67[_0x150c('0x42')],{'$or':_[_0x150c('0x34')](_0x387fde,function(_0x4d38f4){if(_0x4d38f4[_0x150c('0x2f')]!=='VIRTUAL'){var _0x4b5d21={};_0x4b5d21[_0x4d38f4[_0x150c('0x38')]]={'$like':'%'+_0x9a4e96[_0x150c('0x39')]['filter']+'%'};return _0x4b5d21;}})});}_0x14db67=_[_0x150c('0x43')]({},_0x14db67,_0x9a4e96[_0x150c('0x44')]);var _0x31c3ed={'where':_0x14db67[_0x150c('0x42')]};return db['VoiceQueue'][_0x150c('0x45')](_0x31c3ed)[_0x150c('0x27')](function(_0x418e35){_0x21a0cf[_0x150c('0x45')]=_0x418e35;if(_0x9a4e96[_0x150c('0x39')][_0x150c('0x46')]){_0x14db67[_0x150c('0x47')]=[{'all':!![]}];}return db['VoiceQueue'][_0x150c('0x48')](_0x14db67);})[_0x150c('0x27')](function(_0x47d8fd){_0x21a0cf[_0x150c('0x49')]=_0x47d8fd;return _0x21a0cf;})['then'](respondWithFilteredResult(_0x1dc2f0,_0x14db67))[_0x150c('0x4a')](handleError(_0x1dc2f0,null));};exports[_0x150c('0x4b')]=function(_0x1b7ff7,_0x1a4423){var _0x26b5a1={'raw':![],'where':{'id':_0x1b7ff7[_0x150c('0x4c')]['id']}},_0x5512ac={};_0x5512ac[_0x150c('0x37')]=_[_0x150c('0x3a')](db[_0x150c('0x35')][_0x150c('0x4d')]);_0x5512ac[_0x150c('0x39')]=_[_0x150c('0x3a')](_0x1b7ff7[_0x150c('0x39')]);_0x5512ac['filters']=_['intersection'](_0x5512ac[_0x150c('0x37')],_0x5512ac[_0x150c('0x39')]);_0x26b5a1[_0x150c('0x3d')]=_[_0x150c('0x3c')](_0x5512ac[_0x150c('0x37')],qs[_0x150c('0x3e')](_0x1b7ff7[_0x150c('0x39')]['fields']));_0x26b5a1[_0x150c('0x3d')]=_0x26b5a1[_0x150c('0x3d')][_0x150c('0x3f')]?_0x26b5a1[_0x150c('0x3d')]:_0x5512ac[_0x150c('0x37')];if(_0x1b7ff7['query'][_0x150c('0x46')]){_0x26b5a1['include']=[{'all':!![]}];}_0x26b5a1=_['merge']({},_0x26b5a1,_0x1b7ff7[_0x150c('0x44')]);return db[_0x150c('0x35')]['find'](_0x26b5a1)[_0x150c('0x27')](handleEntityNotFound(_0x1a4423,null))[_0x150c('0x27')](respondWithResult(_0x1a4423,null))[_0x150c('0x4a')](handleError(_0x1a4423,null));};exports['create']=function(_0x295157,_0x4b8b14){return db[_0x150c('0x35')][_0x150c('0x4e')](_0x295157[_0x150c('0x4f')],{})['then'](function(_0x344e81){var _0x46146d=_0x295157['user'][_0x150c('0x50')]({'plain':!![]});if(!_0x46146d)throw new Error(_0x150c('0x51'));if(_0x46146d[_0x150c('0x52')]===_0x150c('0x53')){var _0x5277fc=_0x344e81[_0x150c('0x50')]({'plain':!![]});var _0x338718=[{'name':_0x150c('0x28'),'value':_0x150c('0x54')},{'name':_0x150c('0x29'),'value':_0x150c('0x2a')}];var _0x3ab371=_[_0x150c('0x55')](_0x338718,['value',_0x5277fc[_0x150c('0x2f')]])[_0x150c('0x38')];return db[_0x150c('0x56')]['find']({'where':{'name':_0x3ab371,'userProfileId':_0x46146d['userProfileId']},'raw':!![]})[_0x150c('0x27')](function(_0x3499f6){if(_0x3499f6&&_0x3499f6[_0x150c('0x57')]===0x0){return db['UserProfileResource'][_0x150c('0x4e')]({'name':_0x5277fc[_0x150c('0x38')],'resourceId':_0x5277fc['id'],'type':_0x3499f6['name'],'sectionId':_0x3499f6['id']},{})[_0x150c('0x27')](function(){return _0x344e81;});}else{return _0x344e81;}})[_0x150c('0x4a')](function(_0x2c706a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c706a);throw _0x2c706a;});}return _0x344e81;})[_0x150c('0x27')](respondWithResult(_0x4b8b14,0xc9))[_0x150c('0x4a')](handleError(_0x4b8b14,null));};exports[_0x150c('0x58')]=function(_0x3b327d,_0x2ecfb1){var _0x2b7d36={'where':{'id':_0x3b327d['params']['id']}},_0x2997dd={};_0x2997dd[_0x150c('0x37')]=_[_0x150c('0x3a')](db[_0x150c('0x35')]['rawAttributes']);_0x2b7d36[_0x150c('0x3d')]=_[_0x150c('0x3c')](_0x2997dd[_0x150c('0x37')],qs[_0x150c('0x3e')](_0x3b327d[_0x150c('0x39')]['fields']));_0x2b7d36[_0x150c('0x3d')]=_0x2b7d36['attributes'][_0x150c('0x3f')]?_0x2b7d36['attributes']:_0x2997dd[_0x150c('0x37')];if(_0x3b327d[_0x150c('0x39')][_0x150c('0x46')]){_0x2b7d36[_0x150c('0x47')]=[{'all':!![]}];}_0x2b7d36=_[_0x150c('0x43')]({},_0x2b7d36,_0x3b327d['options']);return db[_0x150c('0x35')][_0x150c('0x55')](_0x2b7d36)['then'](handleEntityNotFound(_0x2ecfb1,null))[_0x150c('0x27')](function(_0x255223){if(_0x255223){var _0x555797=_0x255223[_0x150c('0x50')]({'plain':!![]});_0x555797=qs[_0x150c('0x59')](_0x555797,['id',_0x150c('0x5a'),_0x150c('0x5b')]);_0x3b327d[_0x150c('0x4f')]=_[_0x150c('0x59')](_0x3b327d[_0x150c('0x4f')],['id','createdAt',_0x150c('0x5b')]);return db[_0x150c('0x35')]['create'](_[_0x150c('0x43')](_0x555797,_0x3b327d[_0x150c('0x4f')]),{'include':_0x3b327d['query'][_0x150c('0x46')]?[{'all':!![]}]:undefined})[_0x150c('0x27')](function(_0x4c16f3){var _0x29f779=_0x3b327d[_0x150c('0x53')][_0x150c('0x50')]({'plain':!![]});if(!_0x29f779)throw new Error(_0x150c('0x51'));if(_0x29f779[_0x150c('0x52')]===_0x150c('0x53')){var _0x469525=_0x4c16f3[_0x150c('0x50')]({'plain':!![]});var _0x42db0f=[{'name':_0x150c('0x28'),'value':_0x150c('0x54')},{'name':_0x150c('0x29'),'value':_0x150c('0x2a')}];var _0x1a2f97=_[_0x150c('0x55')](_0x42db0f,[_0x150c('0x2d'),_0x469525[_0x150c('0x2f')]])[_0x150c('0x38')];return db[_0x150c('0x56')][_0x150c('0x55')]({'where':{'name':_0x1a2f97,'userProfileId':_0x29f779[_0x150c('0x5c')]},'raw':!![]})[_0x150c('0x27')](function(_0x18587a){if(_0x18587a&&_0x18587a['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x469525['name'],'resourceId':_0x469525['id'],'type':_0x18587a[_0x150c('0x38')],'sectionId':_0x18587a['id']},{})[_0x150c('0x27')](function(){return _0x4c16f3;});}else{return _0x4c16f3;}})[_0x150c('0x4a')](function(_0x3ccdaa){logger[_0x150c('0x30')](_0x150c('0x5d'),_0x3ccdaa);throw _0x3ccdaa;});}return _0x4c16f3;});}})['then'](respondWithResult(_0x2ecfb1,0xc9))[_0x150c('0x4a')](handleError(_0x2ecfb1,null));};exports[_0x150c('0x5e')]=function(_0x1bcc60,_0x204227){if(_0x1bcc60['body']['id']){delete _0x1bcc60[_0x150c('0x4f')]['id'];}return db[_0x150c('0x35')][_0x150c('0x55')]({'where':{'id':_0x1bcc60[_0x150c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x204227,null))[_0x150c('0x27')](saveUpdates(_0x1bcc60[_0x150c('0x4f')],null))[_0x150c('0x27')](respondWithResult(_0x204227,null))[_0x150c('0x4a')](handleError(_0x204227,null));};exports['destroy']=function(_0x278f7d,_0x231002){return db[_0x150c('0x35')][_0x150c('0x55')]({'where':{'id':_0x278f7d['params']['id']}})[_0x150c('0x27')](handleEntityNotFound(_0x231002,null))['then'](removeEntity(_0x231002,null))[_0x150c('0x4a')](handleError(_0x231002,null));};exports[_0x150c('0x5f')]=function(_0x5870d9,_0x1f23c7,_0xb85648){var _0x2c2648={'raw':![],'where':{}};var _0x190473={};var _0x137384={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x150c('0x60')]({'where':{'id':_0x5870d9[_0x150c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1f23c7,null))[_0x150c('0x27')](function(_0x1191ac){if(_0x1191ac){_0x190473[_0x150c('0x37')]=_['keys'](db[_0x150c('0x61')][_0x150c('0x4d')]);_0x190473['query']=_[_0x150c('0x3a')](_0x5870d9[_0x150c('0x39')]);_0x190473[_0x150c('0x3b')]=_[_0x150c('0x3c')](_0x190473[_0x150c('0x37')],_0x190473[_0x150c('0x39')]);_0x2c2648[_0x150c('0x3d')]=_[_0x150c('0x3c')](_0x190473[_0x150c('0x37')],qs[_0x150c('0x3e')](_0x5870d9['query'][_0x150c('0x3e')]));_0x2c2648[_0x150c('0x3d')]=_0x2c2648[_0x150c('0x3d')][_0x150c('0x3f')]?_0x2c2648['attributes']:_0x190473[_0x150c('0x37')];if(!_0x5870d9['query'][_0x150c('0x62')](_0x150c('0x63'))){_0x2c2648['limit']=qs[_0x150c('0x22')](_0x5870d9[_0x150c('0x39')][_0x150c('0x22')]);_0x2c2648['offset']=qs['offset'](_0x5870d9[_0x150c('0x39')][_0x150c('0x21')]);}_0x2c2648[_0x150c('0x40')]=qs[_0x150c('0x41')](_0x5870d9[_0x150c('0x39')][_0x150c('0x41')]);_0x2c2648[_0x150c('0x42')]=qs[_0x150c('0x3b')](_[_0x150c('0x64')](_0x5870d9[_0x150c('0x39')],_0x190473['filters']));_0x2c2648[_0x150c('0x42')][_0x150c('0x65')]=_0x1191ac['id'];if(_0x5870d9['query']['filter']){_0x2c2648['where']=_[_0x150c('0x43')](_0x2c2648[_0x150c('0x42')],{'$or':_[_0x150c('0x34')](_0x2c2648[_0x150c('0x3d')],function(_0x361526){var _0x1eee21={};_0x1eee21[_0x361526]={'$like':'%'+_0x5870d9[_0x150c('0x39')][_0x150c('0x2b')]+'%'};return _0x1eee21;})});}_0x2c2648=_[_0x150c('0x43')]({},_0x2c2648,_0x5870d9[_0x150c('0x44')]);return db[_0x150c('0x61')][_0x150c('0x45')]({'where':_0x2c2648['where']})[_0x150c('0x27')](function(_0x21c319){_0x137384[_0x150c('0x45')]=_0x21c319;if(_0x5870d9[_0x150c('0x39')][_0x150c('0x46')]){_0x2c2648[_0x150c('0x47')]=[{'all':!![]}];}return db[_0x150c('0x61')][_0x150c('0x48')](_0x2c2648);})['then'](function(_0x455594){_0x137384[_0x150c('0x49')]=_0x455594;return _0x137384;});}})['then'](respondWithFilteredResult(_0x1f23c7,_0x2c2648))[_0x150c('0x4a')](handleError(_0x1f23c7,null));};exports[_0x150c('0x66')]=function(_0x1dc488,_0x2b096e,_0xfe5848){var _0x4ac962={'raw':!![],'where':{}};var _0x30d236={};var _0x1d5cb3={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x1dc488[_0x150c('0x4c')]['id']}})[_0x150c('0x27')](handleEntityNotFound(_0x2b096e,null))[_0x150c('0x27')](function(_0x411d37){if(_0x411d37){_0x30d236['model']=_[_0x150c('0x3a')](db[_0x150c('0x67')][_0x150c('0x4d')]);_0x30d236[_0x150c('0x39')]=_[_0x150c('0x3a')](_0x1dc488['query']);_0x30d236[_0x150c('0x3b')]=_['intersection'](_0x30d236['model'],_0x30d236['query']);_0x4ac962[_0x150c('0x3d')]=_[_0x150c('0x3c')](_0x30d236[_0x150c('0x37')],qs[_0x150c('0x3e')](_0x1dc488[_0x150c('0x39')][_0x150c('0x3e')]));_0x4ac962[_0x150c('0x3d')]=_0x4ac962[_0x150c('0x3d')][_0x150c('0x3f')]?_0x4ac962[_0x150c('0x3d')]:_0x30d236[_0x150c('0x37')];if(!_0x1dc488[_0x150c('0x39')][_0x150c('0x62')](_0x150c('0x63'))){_0x4ac962[_0x150c('0x22')]=qs[_0x150c('0x22')](_0x1dc488[_0x150c('0x39')][_0x150c('0x22')]);_0x4ac962[_0x150c('0x21')]=qs[_0x150c('0x21')](_0x1dc488['query']['offset']);}_0x4ac962[_0x150c('0x40')]=qs[_0x150c('0x41')](_0x1dc488[_0x150c('0x39')][_0x150c('0x41')]);_0x4ac962[_0x150c('0x42')]=qs[_0x150c('0x3b')](_['pick'](_0x1dc488[_0x150c('0x39')],_0x30d236['filters']));_0x4ac962['where'][_0x150c('0x65')]=_0x411d37['id'];if(_0x1dc488[_0x150c('0x39')]['filter']){_0x4ac962[_0x150c('0x42')]=_[_0x150c('0x43')](_0x4ac962[_0x150c('0x42')],{'$or':_['map'](_0x4ac962[_0x150c('0x3d')],function(_0x32c586){var _0x345f5d={};_0x345f5d[_0x32c586]={'$like':'%'+_0x1dc488['query']['filter']+'%'};return _0x345f5d;})});}_0x4ac962=_[_0x150c('0x43')]({},_0x4ac962,_0x1dc488['options']);return db[_0x150c('0x67')][_0x150c('0x45')]({'where':_0x4ac962['where']})[_0x150c('0x27')](function(_0x51f05c){_0x1d5cb3[_0x150c('0x45')]=_0x51f05c;if(_0x1dc488[_0x150c('0x39')][_0x150c('0x46')]){_0x4ac962[_0x150c('0x47')]=[{'all':!![]}];}return db[_0x150c('0x67')][_0x150c('0x48')](_0x4ac962);})[_0x150c('0x27')](function(_0x26d21a){_0x1d5cb3[_0x150c('0x49')]=_0x26d21a;return _0x1d5cb3;});}})[_0x150c('0x27')](respondWithFilteredResult(_0x2b096e,_0x4ac962))[_0x150c('0x4a')](handleError(_0x2b096e,null));};exports['getHopperFinals']=function(_0x3b4c12,_0x424cb2,_0x444f7e){var _0x3461ec={'raw':!![],'where':{}};var _0x1df31d={};var _0x3ef5af={'count':0x0,'rows':[]};return db[_0x150c('0x35')][_0x150c('0x60')]({'where':{'id':_0x3b4c12[_0x150c('0x4c')]['id']}})[_0x150c('0x27')](handleEntityNotFound(_0x424cb2,null))[_0x150c('0x27')](function(_0x11aa53){if(_0x11aa53){_0x1df31d['model']=_[_0x150c('0x3a')](db[_0x150c('0x68')][_0x150c('0x4d')]);_0x1df31d[_0x150c('0x39')]=_[_0x150c('0x3a')](_0x3b4c12[_0x150c('0x39')]);_0x1df31d['filters']=_['intersection'](_0x1df31d['model'],_0x1df31d[_0x150c('0x39')]);_0x3461ec[_0x150c('0x3d')]=_['intersection'](_0x1df31d['model'],qs[_0x150c('0x3e')](_0x3b4c12[_0x150c('0x39')][_0x150c('0x3e')]));_0x3461ec[_0x150c('0x3d')]=_0x3461ec[_0x150c('0x3d')][_0x150c('0x3f')]?_0x3461ec[_0x150c('0x3d')]:_0x1df31d[_0x150c('0x37')];if(!_0x3b4c12[_0x150c('0x39')][_0x150c('0x62')]('nolimit')){_0x3461ec[_0x150c('0x22')]=qs[_0x150c('0x22')](_0x3b4c12[_0x150c('0x39')][_0x150c('0x22')]);_0x3461ec[_0x150c('0x21')]=qs[_0x150c('0x21')](_0x3b4c12[_0x150c('0x39')][_0x150c('0x21')]);}_0x3461ec[_0x150c('0x40')]=qs['sort'](_0x3b4c12['query'][_0x150c('0x41')]);_0x3461ec['where']=qs[_0x150c('0x3b')](_[_0x150c('0x64')](_0x3b4c12['query'],_0x1df31d[_0x150c('0x3b')]));_0x3461ec[_0x150c('0x42')]['VoiceQueueId']=_0x11aa53['id'];if(_0x3b4c12[_0x150c('0x39')]['filter']){_0x3461ec[_0x150c('0x42')]=_['merge'](_0x3461ec[_0x150c('0x42')],{'$or':_[_0x150c('0x34')](_0x3461ec[_0x150c('0x3d')],function(_0x4e2719){var _0x3b63b0={};_0x3b63b0[_0x4e2719]={'$like':'%'+_0x3b4c12['query'][_0x150c('0x2b')]+'%'};return _0x3b63b0;})});}_0x3461ec=_[_0x150c('0x43')]({},_0x3461ec,_0x3b4c12[_0x150c('0x44')]);return db[_0x150c('0x68')]['count']({'where':_0x3461ec['where']})[_0x150c('0x27')](function(_0xb2b981){_0x3ef5af[_0x150c('0x45')]=_0xb2b981;if(_0x3b4c12['query']['includeAll']){_0x3461ec[_0x150c('0x47')]=[{'all':!![]}];}return db[_0x150c('0x68')][_0x150c('0x48')](_0x3461ec);})[_0x150c('0x27')](function(_0x4a8b7c){_0x3ef5af[_0x150c('0x49')]=_0x4a8b7c;return _0x3ef5af;});}})['then'](respondWithFilteredResult(_0x424cb2,_0x3461ec))[_0x150c('0x4a')](handleError(_0x424cb2,null));};exports[_0x150c('0x69')]=function(_0x40184e,_0x1ae031,_0x378e82){var _0x36a5b4={'raw':!![],'where':{}};var _0x470657={};var _0x28843c={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x150c('0x60')]({'where':{'id':_0x40184e[_0x150c('0x4c')]['id']}})[_0x150c('0x27')](handleEntityNotFound(_0x1ae031,null))[_0x150c('0x27')](function(_0x24230a){if(_0x24230a){_0x470657[_0x150c('0x37')]=_[_0x150c('0x3a')](db['CmHopperBlack'][_0x150c('0x4d')]);_0x470657[_0x150c('0x39')]=_[_0x150c('0x3a')](_0x40184e[_0x150c('0x39')]);_0x470657['filters']=_[_0x150c('0x3c')](_0x470657[_0x150c('0x37')],_0x470657['query']);_0x36a5b4[_0x150c('0x3d')]=_[_0x150c('0x3c')](_0x470657[_0x150c('0x37')],qs[_0x150c('0x3e')](_0x40184e[_0x150c('0x39')][_0x150c('0x3e')]));_0x36a5b4[_0x150c('0x3d')]=_0x36a5b4[_0x150c('0x3d')]['length']?_0x36a5b4['attributes']:_0x470657[_0x150c('0x37')];if(!_0x40184e['query'][_0x150c('0x62')](_0x150c('0x63'))){_0x36a5b4[_0x150c('0x22')]=qs['limit'](_0x40184e[_0x150c('0x39')][_0x150c('0x22')]);_0x36a5b4[_0x150c('0x21')]=qs[_0x150c('0x21')](_0x40184e['query'][_0x150c('0x21')]);}_0x36a5b4['order']=qs['sort'](_0x40184e['query'][_0x150c('0x41')]);_0x36a5b4['where']=qs[_0x150c('0x3b')](_[_0x150c('0x64')](_0x40184e[_0x150c('0x39')],_0x470657[_0x150c('0x3b')]));_0x36a5b4['where']['VoiceQueueId']=_0x24230a['id'];if(_0x40184e[_0x150c('0x39')][_0x150c('0x2b')]){_0x36a5b4[_0x150c('0x42')]=_[_0x150c('0x43')](_0x36a5b4[_0x150c('0x42')],{'$or':_[_0x150c('0x34')](_0x36a5b4[_0x150c('0x3d')],function(_0xec8f21){var _0x26e7c3={};_0x26e7c3[_0xec8f21]={'$like':'%'+_0x40184e[_0x150c('0x39')][_0x150c('0x2b')]+'%'};return _0x26e7c3;})});}_0x36a5b4=_[_0x150c('0x43')]({},_0x36a5b4,_0x40184e['options']);return db[_0x150c('0x6a')]['count']({'where':_0x36a5b4[_0x150c('0x42')]})[_0x150c('0x27')](function(_0x1f4c2f){_0x28843c['count']=_0x1f4c2f;if(_0x40184e['query']['includeAll']){_0x36a5b4[_0x150c('0x47')]=[{'all':!![]}];}return db[_0x150c('0x6a')]['findAll'](_0x36a5b4);})[_0x150c('0x27')](function(_0x420f6e){_0x28843c[_0x150c('0x49')]=_0x420f6e;return _0x28843c;});}})[_0x150c('0x27')](respondWithFilteredResult(_0x1ae031,_0x36a5b4))[_0x150c('0x4a')](handleError(_0x1ae031,null));};exports[_0x150c('0x6b')]=function(_0x5e8b92,_0x530350,_0x1e3b2a){var _0x42d94d={};var _0x6358b3={};var _0x25ad49;var _0x3fdfe4;return db[_0x150c('0x35')][_0x150c('0x60')]({'where':{'id':_0x5e8b92['params']['id']}})[_0x150c('0x27')](handleEntityNotFound(_0x530350,null))['then'](function(_0x14a8b2){if(_0x14a8b2){_0x25ad49=_0x14a8b2;_0x6358b3[_0x150c('0x37')]=_[_0x150c('0x3a')](db[_0x150c('0x6c')][_0x150c('0x4d')]);_0x6358b3['query']=_[_0x150c('0x3a')](_0x5e8b92[_0x150c('0x39')]);_0x6358b3['filters']=_[_0x150c('0x3c')](_0x6358b3[_0x150c('0x37')],_0x6358b3[_0x150c('0x39')]);_0x42d94d['attributes']=_[_0x150c('0x3c')](_0x6358b3[_0x150c('0x37')],qs[_0x150c('0x3e')](_0x5e8b92[_0x150c('0x39')][_0x150c('0x3e')]));_0x42d94d[_0x150c('0x3d')]=_0x42d94d['attributes']['length']?_0x42d94d[_0x150c('0x3d')]:_0x6358b3[_0x150c('0x37')];_0x42d94d[_0x150c('0x40')]=qs[_0x150c('0x41')](_0x5e8b92[_0x150c('0x39')][_0x150c('0x41')]);_0x42d94d[_0x150c('0x42')]=qs[_0x150c('0x3b')](_['pick'](_0x5e8b92['query'],_0x6358b3[_0x150c('0x3b')]));if(_0x5e8b92[_0x150c('0x39')][_0x150c('0x2b')]){_0x42d94d[_0x150c('0x42')]=_[_0x150c('0x43')](_0x42d94d[_0x150c('0x42')],{'$or':_[_0x150c('0x34')](_0x42d94d[_0x150c('0x3d')],function(_0xa9278e){var _0x594cf0={};_0x594cf0[_0xa9278e]={'$like':'%'+_0x5e8b92[_0x150c('0x39')][_0x150c('0x2b')]+'%'};return _0x594cf0;})});}_0x42d94d=_['merge']({},_0x42d94d,_0x5e8b92[_0x150c('0x44')]);return _0x25ad49['getTeams'](_0x42d94d);}})[_0x150c('0x27')](function(_0x176c02){if(_0x176c02){_0x3fdfe4=_0x176c02[_0x150c('0x3f')];if(!_0x5e8b92['query'][_0x150c('0x62')](_0x150c('0x63'))){_0x42d94d['limit']=qs[_0x150c('0x22')](_0x5e8b92['query'][_0x150c('0x22')]);_0x42d94d[_0x150c('0x21')]=qs[_0x150c('0x21')](_0x5e8b92[_0x150c('0x39')]['offset']);}return _0x25ad49[_0x150c('0x6b')](_0x42d94d);}})['then'](function(_0x3947e9){if(_0x3947e9){return _0x3947e9?{'count':_0x3fdfe4,'rows':_0x3947e9}:null;}})['then'](respondWithResult(_0x530350,null))[_0x150c('0x4a')](handleError(_0x530350,null));};exports[_0x150c('0x6d')]=function(_0x199110,_0xf0a68c,_0x4879a4){var _0x538dfb=_0x199110[_0x150c('0x4f')][_0x150c('0x6e')];var _0x3beb94=_[_0x150c('0x34')](_0x538dfb,'id');return db[_0x150c('0x6c')][_0x150c('0x48')]({'where':{'id':_0x3beb94},'attributes':['id'],'include':[{'model':db['User'],'as':_0x150c('0x6f'),'attributes':['id','name',_0x150c('0x70'),'voicePause',_0x150c('0x71')],'raw':!![]}]})['then'](function(_0x37eef6){if(_0x37eef6){var _0x237074=_[_0x150c('0x72')](_0x37eef6,function(_0x25ded7){var _0x4e086d=_0x25ded7[_0x150c('0x50')]({'plain':!![]});_0x4e086d[_0x150c('0x6f')]['forEach'](function(_0x254398){_0x254398[_0x150c('0x73')]=_[_0x150c('0x55')](_0x538dfb,{'id':_0x4e086d['id']})[_0x150c('0x73')];});return _0x4e086d[_0x150c('0x6f')];});return db[_0x150c('0x35')]['find']({'where':{'id':_0x199110[_0x150c('0x4c')]['id']}})[_0x150c('0x27')](function(_0x268c4f){return db[_0x150c('0x74')][_0x150c('0x75')](function(_0x508988){return _0x268c4f[_0x150c('0x6d')](_0x3beb94,{'transaction':_0x508988})[_0x150c('0x27')](function(){return BPromise[_0x150c('0x76')](_0x237074,function(_0x1b4ef4){return db[_0x150c('0x77')][_0x150c('0x78')]({'where':{'UserId':_0x1b4ef4['id'],'VoiceQueueId':_0x199110[_0x150c('0x4c')]['id']},'defaults':{'penalty':_0x1b4ef4[_0x150c('0x73')]},'transaction':_0x508988});});})[_0x150c('0x27')](function(){return BPromise['each'](_[_0x150c('0x2b')](_0x237074,{'online':!![]}),function(_0x496aa5){return db[_0x150c('0x79')][_0x150c('0x7a')]({'membername':_0x496aa5[_0x150c('0x38')],'UserId':_0x496aa5['id'],'queue_name':_0x268c4f['name'],'VoiceQueueId':_0x268c4f['id'],'interface':_[_0x150c('0x7b')](_0x496aa5[_0x150c('0x71')])?util[_0x150c('0x7c')](_0x150c('0x7d'),_0x496aa5[_0x150c('0x38')]):_0x496aa5[_0x150c('0x71')],'paused':_0x496aa5[_0x150c('0x7e')]||![],'penalty':_0x496aa5[_0x150c('0x73')]},{'transaction':_0x508988});});})[_0x150c('0x27')](function(){_0x237074[_0x150c('0x7f')](function(_0x443e92){socket[_0x150c('0x80')]('userVoiceQueue:save',{'UserId':_0x443e92['id'],'VoiceQueueId':_0x268c4f['id']});});});});});}})[_0x150c('0x27')](respondWithStatusCode(_0xf0a68c,null))[_0x150c('0x4a')](handleError(_0xf0a68c,null));};exports[_0x150c('0x81')]=function(_0x41a736,_0x22f326,_0x1b1790){return db[_0x150c('0x6c')][_0x150c('0x48')]({'where':{'id':_0x41a736['query'][_0x150c('0x82')]},'attributes':['id'],'include':[{'model':db[_0x150c('0x83')],'as':_0x150c('0x6f'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x22f326,null))[_0x150c('0x27')](function(_0x39854c){var _0x13b152=_[_0x150c('0x34')](_0x39854c,'id');var _0x168f82=[];var _0x6f2c0a=[];var _0x38d4bb=squel['select']();_0x38d4bb[_0x150c('0x84')](_0x150c('0x85'))['from'](_0x150c('0x86'),'tq')[_0x150c('0x87')]('user_has_teams','ut',_0x150c('0x88'))[_0x150c('0x42')]('VoiceQueueId\x20=\x20?',_0x41a736[_0x150c('0x4c')]['id']);for(var _0x192a5b=0x0;_0x192a5b<_0x39854c[_0x150c('0x3f')];_0x192a5b+=0x1){let _0x2d7d5c=_0x39854c[_0x192a5b];for(var _0x5d8568=0x0;_0x5d8568<_0x2d7d5c[_0x150c('0x6f')][_0x150c('0x3f')];_0x5d8568+=0x1){let _0x41b3ad=_0x2d7d5c[_0x150c('0x6f')][_0x5d8568];var _0x196c1c=_0x38d4bb[_0x150c('0x58')]();_0x196c1c[_0x150c('0x42')](_0x150c('0x89'),_0x41b3ad['id']);_0x6f2c0a[_0x150c('0x8a')](db[_0x150c('0x74')][_0x150c('0x39')](_0x196c1c[_0x150c('0x8b')](),{'type':db[_0x150c('0x74')]['QueryTypes'][_0x150c('0x8c')]})[_0x150c('0x27')](function(_0x2d6d6e){if(_0x2d6d6e[_0x150c('0x3f')]===0x1){return _0x41b3ad['id'];}else{var _0x187984=_[_0x150c('0x8d')](_[_0x150c('0x34')](_0x2d6d6e,_0x150c('0x8e')),function(_0x17b2bc){return _[_0x150c('0x2e')](_0x13b152,_0x17b2bc);});if(_0x187984){return _0x41b3ad['id'];}}}));}}return BPromise[_0x150c('0x8f')](_0x6f2c0a)['then'](function(_0xc25ac9){_0x168f82=_(_0x168f82)[_0x150c('0x90')](_0xc25ac9)[_0x150c('0x91')]()['value']();return db[_0x150c('0x35')][_0x150c('0x55')]({'where':{'id':_0x41a736[_0x150c('0x4c')]['id']}})['then'](function(_0x54a7c){return db[_0x150c('0x74')][_0x150c('0x75')](function(_0x24f88e){return _0x54a7c[_0x150c('0x81')](_0x41a736[_0x150c('0x39')][_0x150c('0x82')],{'transaction':_0x24f88e})[_0x150c('0x27')](function(){if(!_[_0x150c('0x92')](_0x168f82)){return _0x54a7c[_0x150c('0x93')](_0x168f82,{'transaction':_0x24f88e})[_0x150c('0x27')](function(){return db[_0x150c('0x79')][_0x150c('0x26')]({'where':{'VoiceQueueId':_0x41a736[_0x150c('0x4c')]['id'],'UserId':_0x168f82},'transaction':_0x24f88e});});}})[_0x150c('0x27')](function(){_0x168f82['forEach'](function(_0x3b1d60){socket[_0x150c('0x80')](_0x150c('0x94'),{'UserId':_0x3b1d60,'VoiceQueueId':_0x54a7c['id']});});});});});});})[_0x150c('0x27')](respondWithStatusCode(_0x22f326,null))[_0x150c('0x4a')](handleError(_0x22f326,null));};exports['addAgents']=function(_0x54afaf,_0x1c3350,_0x483384){var _0x4e50b1,_0x1db29d;return db['VoiceQueue'][_0x150c('0x55')]({'where':{'id':_0x54afaf[_0x150c('0x4c')]['id']}})[_0x150c('0x27')](handleEntityNotFound(_0x1c3350,null))[_0x150c('0x27')](function(_0x510a40){if(_0x510a40){_0x1db29d=_0x510a40;return _0x510a40['addAgents'](_0x54afaf['body'][_0x150c('0x82')],_['omit'](_0x54afaf[_0x150c('0x4f')],[_0x150c('0x82'),'id'])||{})[_0x150c('0x95')](function(_0x2252af){for(var _0x4ab8c1=0x0;_0x4ab8c1<_0x54afaf[_0x150c('0x4f')][_0x150c('0x82')]['length'];_0x4ab8c1+=0x1){socket[_0x150c('0x80')]('userVoiceQueue:save',{'UserId':_0x54afaf[_0x150c('0x4f')][_0x150c('0x82')][_0x4ab8c1],'VoiceQueueId':_0x54afaf[_0x150c('0x4c')]['id']});}return _0x2252af;});}})[_0x150c('0x27')](function(_0x1e15da){_0x4e50b1=_0x1e15da||[];if(_0x1db29d){return db['User'][_0x150c('0x48')]({'where':{'id':_0x54afaf[_0x150c('0x4f')][_0x150c('0x82')]},'attributes':['id',_0x150c('0x38'),'online',_0x150c('0x7e'),'interface'],'raw':!![]});}})[_0x150c('0x27')](function(_0x3c0b4a){if(!_[_0x150c('0x92')](_0x3c0b4a)){var _0x52b728=[];for(var _0x975401=0x0;_0x975401<_0x3c0b4a[_0x150c('0x3f')];_0x975401++){if(_0x3c0b4a[_0x975401][_0x150c('0x70')]){_0x52b728[_0x150c('0x8a')](db[_0x150c('0x79')][_0x150c('0x7a')]({'membername':_0x3c0b4a[_0x975401][_0x150c('0x38')],'UserId':_0x3c0b4a[_0x975401]['id'],'queue_name':_0x1db29d['name'],'VoiceQueueId':_0x1db29d['id'],'interface':_[_0x150c('0x7b')](_0x3c0b4a[_0x975401]['interface'])?util[_0x150c('0x7c')]('SIP/%s',_0x3c0b4a[_0x975401][_0x150c('0x38')]):_0x3c0b4a[_0x975401]['interface'],'paused':_0x3c0b4a[_0x975401][_0x150c('0x7e')]||![],'penalty':_0x54afaf[_0x150c('0x4f')][_0x150c('0x73')]||0x0}));}}return BPromise[_0x150c('0x8f')](_0x52b728);}})[_0x150c('0x27')](function(){return _0x4e50b1;})[_0x150c('0x27')](respondWithResult(_0x1c3350,null))['catch'](handleError(_0x1c3350,null));};exports[_0x150c('0x93')]=function(_0x552d50,_0x40ba4b,_0x468aaa){return db['VoiceQueue'][_0x150c('0x55')]({'where':{'id':_0x552d50['params']['id']}})[_0x150c('0x27')](handleEntityNotFound(_0x40ba4b,null))[_0x150c('0x27')](function(_0x431e74){if(_0x431e74){return _0x431e74[_0x150c('0x93')](_0x552d50['query'][_0x150c('0x82')])[_0x150c('0x27')](function(){if(_[_0x150c('0x96')](_0x552d50['query'][_0x150c('0x82')])){for(var _0x1206fc=0x0;_0x1206fc<_0x552d50[_0x150c('0x39')][_0x150c('0x82')][_0x150c('0x3f')];_0x1206fc+=0x1){socket['emit'](_0x150c('0x94'),{'UserId':Number(_0x552d50['query']['ids'][_0x1206fc]),'VoiceQueueId':Number(_0x552d50[_0x150c('0x4c')]['id'])});}}else{socket['emit'](_0x150c('0x94'),{'UserId':Number(_0x552d50[_0x150c('0x39')][_0x150c('0x82')]),'VoiceQueueId':Number(_0x552d50[_0x150c('0x4c')]['id'])});}});}})['then'](function(_0x85097e){return db[_0x150c('0x79')]['destroy']({'where':{'VoiceQueueId':_0x552d50[_0x150c('0x4c')]['id'],'UserId':_0x552d50[_0x150c('0x39')][_0x150c('0x82')]}})[_0x150c('0x27')](function(){return _0x85097e;});})[_0x150c('0x27')](respondWithStatusCode(_0x40ba4b,null))[_0x150c('0x4a')](handleError(_0x40ba4b,null));};exports[_0x150c('0x97')]=function(_0x5ecc54,_0x3d9da3,_0x10ae6a){var _0x1eff87={};var _0x498f40={};var _0x4f4227;var _0xef4f7a;return db['VoiceQueue']['findOne']({'where':{'id':_0x5ecc54[_0x150c('0x4c')]['id']}})[_0x150c('0x27')](handleEntityNotFound(_0x3d9da3,null))[_0x150c('0x27')](function(_0x43c73c){if(_0x43c73c){_0x4f4227=_0x43c73c;_0x498f40[_0x150c('0x37')]=_[_0x150c('0x3a')](db[_0x150c('0x83')][_0x150c('0x4d')]);_0x498f40['query']=_['keys'](_0x5ecc54[_0x150c('0x39')]);_0x498f40[_0x150c('0x3b')]=_[_0x150c('0x3c')](_0x498f40[_0x150c('0x37')],_0x498f40[_0x150c('0x39')]);_0x1eff87['attributes']=_[_0x150c('0x3c')](_0x498f40[_0x150c('0x37')],qs[_0x150c('0x3e')](_0x5ecc54[_0x150c('0x39')][_0x150c('0x3e')]));_0x1eff87[_0x150c('0x3d')]=_0x1eff87[_0x150c('0x3d')][_0x150c('0x3f')]?_0x1eff87[_0x150c('0x3d')]:_0x498f40[_0x150c('0x37')];_0x1eff87[_0x150c('0x40')]=qs['sort'](_0x5ecc54[_0x150c('0x39')]['sort']);_0x1eff87[_0x150c('0x42')]=qs[_0x150c('0x3b')](_[_0x150c('0x64')](_0x5ecc54[_0x150c('0x39')],_0x498f40[_0x150c('0x3b')]));if(_0x5ecc54[_0x150c('0x39')][_0x150c('0x2b')]){_0x1eff87[_0x150c('0x42')]=_['merge'](_0x1eff87['where'],{'$or':_['map'](_0x1eff87['attributes'],function(_0x255bbd){var _0x51ccd2={};_0x51ccd2[_0x255bbd]={'$like':'%'+_0x5ecc54[_0x150c('0x39')][_0x150c('0x2b')]+'%'};return _0x51ccd2;})});}_0x1eff87=_[_0x150c('0x43')]({},_0x1eff87,_0x5ecc54[_0x150c('0x44')]);return _0x4f4227['getAgents'](_0x1eff87);}})[_0x150c('0x27')](function(_0x473028){if(_0x473028){_0xef4f7a=_0x473028[_0x150c('0x3f')];if(!_0x5ecc54[_0x150c('0x39')][_0x150c('0x62')](_0x150c('0x63'))){_0x1eff87['limit']=qs[_0x150c('0x22')](_0x5ecc54[_0x150c('0x39')][_0x150c('0x22')]);_0x1eff87[_0x150c('0x21')]=qs['offset'](_0x5ecc54['query']['offset']);}return _0x4f4227[_0x150c('0x97')](_0x1eff87);}})[_0x150c('0x27')](function(_0x3158ff){if(_0x3158ff){return _0x3158ff?{'count':_0xef4f7a,'rows':_0x3158ff}:null;}})['then'](respondWithResult(_0x3d9da3,null))[_0x150c('0x4a')](handleError(_0x3d9da3,null));};exports[_0x150c('0x98')]=function(_0x298c97,_0xa25214,_0x258f95){var _0x184159={};var _0xeca351={};var _0x42eaf1;var _0x2d5377;return db[_0x150c('0x35')][_0x150c('0x60')]({'where':{'id':_0x298c97[_0x150c('0x4c')]['id']}})[_0x150c('0x27')](handleEntityNotFound(_0xa25214,null))['then'](function(_0x53b489){if(_0x53b489){_0x42eaf1=_0x53b489;_0xeca351[_0x150c('0x37')]=_[_0x150c('0x3a')](db['UserVoiceQueueRt']['rawAttributes']);_0xeca351[_0x150c('0x39')]=_[_0x150c('0x3a')](_0x298c97[_0x150c('0x39')]);_0xeca351[_0x150c('0x3b')]=_['intersection'](_0xeca351['model'],_0xeca351[_0x150c('0x39')]);_0x184159[_0x150c('0x3d')]=_[_0x150c('0x3c')](_0xeca351[_0x150c('0x37')],qs[_0x150c('0x3e')](_0x298c97[_0x150c('0x39')][_0x150c('0x3e')]));_0x184159[_0x150c('0x3d')]=_0x184159[_0x150c('0x3d')][_0x150c('0x3f')]?_0x184159['attributes']:_0xeca351[_0x150c('0x37')];_0x184159['order']=qs['sort'](_0x298c97[_0x150c('0x39')][_0x150c('0x41')]);_0x184159[_0x150c('0x42')]=qs[_0x150c('0x3b')](_['pick'](_0x298c97['query'],_0xeca351[_0x150c('0x3b')]));if(_0x298c97[_0x150c('0x39')][_0x150c('0x2b')]){_0x184159[_0x150c('0x42')]=_[_0x150c('0x43')](_0x184159['where'],{'$or':_[_0x150c('0x34')](_0x184159[_0x150c('0x3d')],function(_0x590cf8){var _0x40e39f={};_0x40e39f[_0x590cf8]={'$like':'%'+_0x298c97[_0x150c('0x39')][_0x150c('0x2b')]+'%'};return _0x40e39f;})});}_0x184159=_['merge']({},_0x184159,_0x298c97[_0x150c('0x44')]);return _0x42eaf1[_0x150c('0x98')](_0x184159);}})[_0x150c('0x27')](function(_0x5599ed){if(_0x5599ed){_0x2d5377=_0x5599ed[_0x150c('0x3f')];if(!_0x298c97[_0x150c('0x39')][_0x150c('0x62')]('nolimit')){_0x184159['limit']=qs[_0x150c('0x22')](_0x298c97[_0x150c('0x39')][_0x150c('0x22')]);_0x184159['offset']=qs[_0x150c('0x21')](_0x298c97[_0x150c('0x39')][_0x150c('0x21')]);}return _0x42eaf1[_0x150c('0x98')](_0x184159);}})[_0x150c('0x27')](function(_0x3d3961){return _0x3d3961?{'count':_0x2d5377,'rows':_0x3d3961}:null;})[_0x150c('0x27')](respondWithResult(_0xa25214,null))['catch'](handleError(_0xa25214,null));};exports[_0x150c('0x99')]=function(_0x4c14de,_0x18d8d2,_0x5bfc1e){var _0x2514de={};var _0x1dcb5d={};var _0x38c08b;var _0x15d981;return db[_0x150c('0x35')][_0x150c('0x60')]({'where':{'id':_0x4c14de[_0x150c('0x4c')]['id']}})[_0x150c('0x27')](handleEntityNotFound(_0x18d8d2,null))[_0x150c('0x27')](function(_0x253e68){if(_0x253e68){_0x38c08b=_0x253e68;_0x1dcb5d[_0x150c('0x37')]=_[_0x150c('0x3a')](db[_0x150c('0x9a')][_0x150c('0x4d')]);_0x1dcb5d['query']=_[_0x150c('0x3a')](_0x4c14de[_0x150c('0x39')]);_0x1dcb5d['filters']=_['intersection'](_0x1dcb5d[_0x150c('0x37')],_0x1dcb5d[_0x150c('0x39')]);_0x2514de[_0x150c('0x3d')]=_[_0x150c('0x3c')](_0x1dcb5d['model'],qs[_0x150c('0x3e')](_0x4c14de[_0x150c('0x39')][_0x150c('0x3e')]));_0x2514de[_0x150c('0x3d')]=_0x2514de[_0x150c('0x3d')][_0x150c('0x3f')]?_0x2514de[_0x150c('0x3d')]:_0x1dcb5d[_0x150c('0x37')];_0x2514de[_0x150c('0x40')]=qs[_0x150c('0x41')](_0x4c14de[_0x150c('0x39')][_0x150c('0x41')]);_0x2514de[_0x150c('0x42')]=qs[_0x150c('0x3b')](_[_0x150c('0x64')](_0x4c14de['query'],_0x1dcb5d[_0x150c('0x3b')]));if(_0x4c14de['query'][_0x150c('0x2b')]){_0x2514de[_0x150c('0x42')]=_[_0x150c('0x43')](_0x2514de[_0x150c('0x42')],{'$or':_['map'](_0x2514de[_0x150c('0x3d')],function(_0x10b739){var _0x4eed22={};_0x4eed22[_0x10b739]={'$like':'%'+_0x4c14de[_0x150c('0x39')]['filter']+'%'};return _0x4eed22;})});}_0x2514de=_[_0x150c('0x43')]({},_0x2514de,_0x4c14de[_0x150c('0x44')]);return _0x38c08b['getLists'](_0x2514de);}})[_0x150c('0x27')](function(_0x3d6dcb){if(_0x3d6dcb){_0x15d981=_0x3d6dcb[_0x150c('0x3f')];if(!_0x4c14de[_0x150c('0x39')][_0x150c('0x62')]('nolimit')){_0x2514de['limit']=qs['limit'](_0x4c14de[_0x150c('0x39')]['limit']);_0x2514de[_0x150c('0x21')]=qs[_0x150c('0x21')](_0x4c14de[_0x150c('0x39')]['offset']);}return _0x38c08b[_0x150c('0x99')](_0x2514de);}})[_0x150c('0x27')](function(_0x540ed6){if(_0x540ed6){return _0x540ed6?{'count':_0x15d981,'rows':_0x540ed6}:null;}})[_0x150c('0x27')](respondWithResult(_0x18d8d2,null))[_0x150c('0x4a')](handleError(_0x18d8d2,null));};exports[_0x150c('0x9b')]=function(_0x52cf7e,_0x2cbf95,_0x5749a6){var _0x4045da,_0x5bc7fe;return db['VoiceQueue'][_0x150c('0x55')]({'where':{'id':_0x52cf7e[_0x150c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2cbf95,null))[_0x150c('0x27')](function(_0xd1abbb){if(_0xd1abbb){_0x5bc7fe=_0xd1abbb;return _0xd1abbb[_0x150c('0x9b')](_0x52cf7e[_0x150c('0x4f')][_0x150c('0x82')],_[_0x150c('0x59')](_0x52cf7e[_0x150c('0x4f')],[_0x150c('0x82'),'id'])||{});}return null;})[_0x150c('0x95')](function(_0x17f9d8){var _0x228c72;_0x4045da=_0x17f9d8||[];var _0x139b17=[];if(_0x17f9d8){for(var _0x124668=0x0;_0x124668<_0x17f9d8[_0x150c('0x3f')];_0x124668+=0x1){var _0x4c88b7=_0x17f9d8[_0x124668][_0x150c('0x50')]({'plain':!![]});_0x5bc7fe[_0x150c('0x9c')]=_0x52cf7e[_0x150c('0x4f')][_0x150c('0x9c')]?_0x52cf7e['body'][_0x150c('0x9c')]:_0x5bc7fe[_0x150c('0x9c')];switch(_0x5bc7fe[_0x150c('0x9c')]){case _0x150c('0x9d'):_0x228c72=squel[_0x150c('0x9e')]()[_0x150c('0x9f')]('cm_hopper')[_0x150c('0xa0')]([_0x150c('0xa1'),_0x150c('0xa2'),_0x150c('0xa3'),'ListId',_0x150c('0x65'),_0x150c('0x5a'),_0x150c('0x5b')],squel[_0x150c('0xa4')]()[_0x150c('0x84')](_0x150c('0xa1'),_0x150c('0xa1'))['field']('NOW()',_0x150c('0xa2'))[_0x150c('0x84')]('id','ContactId')[_0x150c('0x84')](_0x4c88b7[_0x150c('0xa5')][_0x150c('0x8b')](),'ListId')[_0x150c('0x84')](_0x52cf7e[_0x150c('0x4c')]['id'][_0x150c('0x8b')](),_0x150c('0x65'))[_0x150c('0x84')]('NOW()',_0x150c('0x5a'))[_0x150c('0x84')]('NOW()',_0x150c('0x5b'))['from'](_0x150c('0xa6'))[_0x150c('0x42')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x4c88b7[_0x150c('0xa5')][_0x150c('0x8b')]())[_0x150c('0x42')](_0x150c('0xa7'))[_0x150c('0x42')](_0x150c('0xa8'),squel['select']()[_0x150c('0x84')](_0x150c('0xa9'))[_0x150c('0xaa')](_0x150c('0xab'))['where']('VoiceQueueId\x20=\x20?',_0x52cf7e[_0x150c('0x4c')]['id'][_0x150c('0x8b')]()))[_0x150c('0x42')](_0x150c('0xa8'),squel[_0x150c('0xa4')]()['field'](_0x150c('0xac'))['from']('cm_hopper')['where'](_0x150c('0xad'),_0x52cf7e['params']['id'][_0x150c('0x8b')]())))[_0x150c('0x8b')]();break;case _0x150c('0xae'):_0x228c72=squel[_0x150c('0x9e')]()['into'](_0x150c('0xaf'))['fromQuery']([_0x150c('0xa1'),_0x150c('0xa2'),'ContactId','ListId',_0x150c('0x65'),_0x150c('0x5a'),_0x150c('0x5b')],squel['select']()[_0x150c('0x84')](_0x150c('0xa1'),'phone')[_0x150c('0x84')]('NOW()',_0x150c('0xa2'))[_0x150c('0x84')]('id',_0x150c('0xa3'))[_0x150c('0x84')](_0x4c88b7[_0x150c('0xa5')][_0x150c('0x8b')](),_0x150c('0xb0'))[_0x150c('0x84')](_0x52cf7e[_0x150c('0x4c')]['id'][_0x150c('0x8b')](),_0x150c('0x65'))[_0x150c('0x84')](_0x150c('0xb1'),_0x150c('0x5a'))[_0x150c('0x84')](_0x150c('0xb1'),_0x150c('0x5b'))[_0x150c('0xaa')]('cm_contacts')[_0x150c('0x42')]('deletedAt\x20IS\x20NULL')[_0x150c('0x42')](_0x150c('0xb2'),_0x4c88b7[_0x150c('0xa5')][_0x150c('0x8b')]())[_0x150c('0x42')](_0x150c('0xa7'))[_0x150c('0x42')](_0x150c('0xa8'),squel[_0x150c('0xa4')]()['field']('COALESCE(phone,\x27\x27)')[_0x150c('0xaa')]('cm_hopper')[_0x150c('0x42')]('VoiceQueueId\x20=\x20?',_0x52cf7e['params']['id']['toString']())))['toString']();break;default:_0x228c72=squel[_0x150c('0x9e')]()[_0x150c('0x9f')](_0x150c('0xaf'))[_0x150c('0xa0')](['phone',_0x150c('0xa2'),_0x150c('0xa3'),_0x150c('0xb0'),_0x150c('0x65'),_0x150c('0x5a'),'updatedAt'],squel[_0x150c('0xa4')]()[_0x150c('0x84')](_0x150c('0xa1'),_0x150c('0xa1'))[_0x150c('0x84')](_0x150c('0xb1'),_0x150c('0xa2'))[_0x150c('0x84')]('id',_0x150c('0xa3'))[_0x150c('0x84')](_0x4c88b7[_0x150c('0xa5')]['toString'](),_0x150c('0xb0'))[_0x150c('0x84')](_0x52cf7e['params']['id'][_0x150c('0x8b')](),_0x150c('0x65'))[_0x150c('0x84')]('NOW()',_0x150c('0x5a'))[_0x150c('0x84')](_0x150c('0xb1'),_0x150c('0x5b'))[_0x150c('0xaa')](_0x150c('0xa6'))['where'](_0x150c('0xb3'))[_0x150c('0x42')](_0x150c('0xb2'),_0x4c88b7[_0x150c('0xa5')]['toString']())['where'](_0x150c('0xa7')))['toString']();}_0x139b17[_0x150c('0x8a')](db[_0x150c('0x74')][_0x150c('0x39')](_0x228c72));}return BPromise[_0x150c('0x8f')](_0x139b17);}})[_0x150c('0x27')](function(){return _0x4045da;})['then'](respondWithResult(_0x2cbf95,null))[_0x150c('0x4a')](handleError(_0x2cbf95,null));};exports['removeLists']=function(_0x575060,_0x1a4a0e,_0x52c2c4){return db[_0x150c('0x35')][_0x150c('0x55')]({'where':{'id':_0x575060[_0x150c('0x4c')]['id']}})[_0x150c('0x27')](handleEntityNotFound(_0x1a4a0e,null))[_0x150c('0x27')](function(_0x3a57ac){if(_0x3a57ac){return _0x3a57ac[_0x150c('0xb4')](_0x575060['query']['ids']);}})['then'](function(_0x49ad2d){if(_0x49ad2d){return db[_0x150c('0x61')][_0x150c('0x26')]({'where':{'ListId':_0x575060['query'][_0x150c('0x82')],'VoiceQueueId':_0x575060[_0x150c('0x4c')]['id']}})[_0x150c('0x27')](function(){return _0x49ad2d;});}})[_0x150c('0x27')](respondWithStatusCode(_0x1a4a0e,null))[_0x150c('0x4a')](handleError(_0x1a4a0e,null));};exports[_0x150c('0xb5')]=function(_0x11dd71,_0x541f8d,_0x2e8ffb){var _0x2312e3={};var _0x466460={};var _0x109d06;var _0xb89f8b;return db['VoiceQueue'][_0x150c('0x60')]({'where':{'id':_0x11dd71[_0x150c('0x4c')]['id']}})[_0x150c('0x27')](handleEntityNotFound(_0x541f8d,null))['then'](function(_0x47fc24){if(_0x47fc24){_0x109d06=_0x47fc24;_0x466460['model']=_[_0x150c('0x3a')](db[_0x150c('0x9a')][_0x150c('0x4d')]);_0x466460[_0x150c('0x39')]=_[_0x150c('0x3a')](_0x11dd71['query']);_0x466460[_0x150c('0x3b')]=_[_0x150c('0x3c')](_0x466460[_0x150c('0x37')],_0x466460['query']);_0x2312e3[_0x150c('0x3d')]=_[_0x150c('0x3c')](_0x466460[_0x150c('0x37')],qs[_0x150c('0x3e')](_0x11dd71[_0x150c('0x39')][_0x150c('0x3e')]));_0x2312e3[_0x150c('0x3d')]=_0x2312e3[_0x150c('0x3d')][_0x150c('0x3f')]?_0x2312e3[_0x150c('0x3d')]:_0x466460[_0x150c('0x37')];_0x2312e3[_0x150c('0x40')]=qs['sort'](_0x11dd71[_0x150c('0x39')][_0x150c('0x41')]);_0x2312e3['where']=qs[_0x150c('0x3b')](_[_0x150c('0x64')](_0x11dd71['query'],_0x466460[_0x150c('0x3b')]));if(_0x11dd71['query'][_0x150c('0x2b')]){_0x2312e3[_0x150c('0x42')]=_[_0x150c('0x43')](_0x2312e3[_0x150c('0x42')],{'$or':_['map'](_0x2312e3[_0x150c('0x3d')],function(_0x269d67){var _0x2d08c8={};_0x2d08c8[_0x269d67]={'$like':'%'+_0x11dd71['query'][_0x150c('0x2b')]+'%'};return _0x2d08c8;})});}_0x2312e3=_[_0x150c('0x43')]({},_0x2312e3,_0x11dd71['options']);return _0x109d06[_0x150c('0xb5')](_0x2312e3);}})['then'](function(_0x4fc3de){if(_0x4fc3de){_0xb89f8b=_0x4fc3de['length'];if(!_0x11dd71['query'][_0x150c('0x62')](_0x150c('0x63'))){_0x2312e3[_0x150c('0x22')]=qs['limit'](_0x11dd71['query']['limit']);_0x2312e3[_0x150c('0x21')]=qs[_0x150c('0x21')](_0x11dd71[_0x150c('0x39')][_0x150c('0x21')]);}return _0x109d06[_0x150c('0xb5')](_0x2312e3);}})[_0x150c('0x27')](function(_0x2bb104){if(_0x2bb104){return _0x2bb104?{'count':_0xb89f8b,'rows':_0x2bb104}:null;}})[_0x150c('0x27')](respondWithResult(_0x541f8d,null))['catch'](handleError(_0x541f8d,null));};exports['addBlackLists']=function(_0x5397b9,_0xb9e224,_0x2c0c00){var _0xcd3f01,_0x587873;return db[_0x150c('0x35')]['find']({'where':{'id':_0x5397b9[_0x150c('0x4c')]['id']}})[_0x150c('0x27')](handleEntityNotFound(_0xb9e224,null))['then'](function(_0x21d10a){if(_0x21d10a){_0x587873=_0x21d10a;return _0x21d10a[_0x150c('0xb6')](_0x5397b9[_0x150c('0x4f')][_0x150c('0x82')],_[_0x150c('0x59')](_0x5397b9[_0x150c('0x4f')],[_0x150c('0x82'),'id'])||{});}return null;})[_0x150c('0x95')](function(_0x344635){var _0x29e0e2;_0xcd3f01=_0x344635||[];var _0x56d3b8=[];if(_0x344635){for(var _0x41af9e=0x0;_0x41af9e<_0x344635[_0x150c('0x3f')];_0x41af9e+=0x1){var _0x115c5d=_0x344635[_0x41af9e][_0x150c('0x50')]({'plain':!![]});_0x29e0e2=squel[_0x150c('0x9e')]()[_0x150c('0x9f')](_0x150c('0xb7'))['fromQuery']([_0x150c('0xa1'),'ContactId','ListId',_0x150c('0x65'),_0x150c('0x5a'),_0x150c('0x5b')],squel[_0x150c('0xa4')]()[_0x150c('0x84')]('phone',_0x150c('0xa1'))[_0x150c('0x84')]('id',_0x150c('0xa3'))[_0x150c('0x84')](_0x115c5d[_0x150c('0xa5')][_0x150c('0x8b')](),_0x150c('0xb0'))[_0x150c('0x84')](_0x5397b9[_0x150c('0x4c')]['id'][_0x150c('0x8b')](),'VoiceQueueId')['field'](_0x150c('0xb1'),_0x150c('0x5a'))[_0x150c('0x84')](_0x150c('0xb1'),_0x150c('0x5b'))['from'](_0x150c('0xa6'))[_0x150c('0x42')](_0x150c('0xb3'))[_0x150c('0x42')](_0x150c('0xb2'),_0x115c5d[_0x150c('0xa5')]['toString']())[_0x150c('0x42')](_0x150c('0xa7')))[_0x150c('0x8b')]();_0x56d3b8[_0x150c('0x8a')](db[_0x150c('0x74')][_0x150c('0x39')](_0x29e0e2));}return BPromise[_0x150c('0x8f')](_0x56d3b8);}})[_0x150c('0x27')](function(){return _0xcd3f01;})[_0x150c('0x27')](respondWithResult(_0xb9e224,null))[_0x150c('0x4a')](handleError(_0xb9e224,null));};exports[_0x150c('0xb8')]=function(_0x4fb51d,_0x15ef42,_0x32ff46){return db['VoiceQueue'][_0x150c('0x55')]({'where':{'id':_0x4fb51d[_0x150c('0x4c')]['id']}})[_0x150c('0x27')](handleEntityNotFound(_0x15ef42,null))[_0x150c('0x27')](function(_0x13eee8){if(_0x13eee8){return _0x13eee8[_0x150c('0xb8')](_0x4fb51d['query'][_0x150c('0x82')]);}})[_0x150c('0x27')](function(_0xb4b944){if(_0xb4b944){return db[_0x150c('0x6a')][_0x150c('0x26')]({'where':{'ListId':_0x4fb51d['query']['ids'],'VoiceQueueId':_0x4fb51d['params']['id']}})[_0x150c('0x27')](function(){return _0xb4b944;});}})[_0x150c('0x27')](respondWithStatusCode(_0x15ef42,null))[_0x150c('0x4a')](handleError(_0x15ef42,null));}; \ No newline at end of file +var _0x693f=['redis','localhost','./voiceQueue.socket','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','find','name','error','send','index','VoiceQueue','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','include','catch','includeAll','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','clone','params','omit','createdAt','updatedAt','user','getHoppers','CmHopper','VoiceQueueId','findAll','findOne','CmHopperHistory','rows','getHopperFinals','order','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','teams','User','Agents','online','voicePause','interface','flatMap','forEach','sequelize','transaction','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','format','removeTeams','ids','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','all','union','compact','isEmpty','removeAgents','emit','addAgents','spread','userVoiceQueue:save','isNil','SIP/%s','penalty','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','dialCheckDuplicateType','always','insert','into','fromQuery','phone','ContactId','ListId','select','field','NOW()','scheduledAt','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','VoiceQueueId\x20=\x20?','cm_hopper','onlyIfOpen','COALESCE(phone,\x27\x27)','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x1c25c7,_0x335fab){var _0x5e0173=function(_0x38f969){while(--_0x38f969){_0x1c25c7['push'](_0x1c25c7['shift']());}};_0x5e0173(++_0x335fab);}(_0x693f,0x9d));var _0xf693=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x693f[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0xf693('0x0'));var emlformat=require(_0xf693('0x1'));var rimraf=require(_0xf693('0x2'));var zipdir=require(_0xf693('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf693('0x4'));var moment=require(_0xf693('0x5'));var BPromise=require(_0xf693('0x6'));var Mustache=require(_0xf693('0x7'));var util=require(_0xf693('0x8'));var path=require(_0xf693('0x9'));var sox=require(_0xf693('0xa'));var csv=require('to-csv');var ejs=require(_0xf693('0xb'));var fs=require('fs');var _=require(_0xf693('0xc'));var squel=require('squel');var crypto=require(_0xf693('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf693('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf693('0xf'));var Papa=require(_0xf693('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf693('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf693('0x12'))(_0xf693('0x13'));var utils=require(_0xf693('0x14'));var config=require(_0xf693('0x15'));var db=require(_0xf693('0x16'))['db'];config['redis']=_['defaults'](config[_0xf693('0x17')],{'host':_0xf693('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf693('0x17')]));require(_0xf693('0x19'))['register'](socket);function respondWithStatusCode(_0x5c42f0,_0x957c3f){_0x957c3f=_0x957c3f||0xcc;return function(_0x33f03f){if(_0x33f03f){return _0x5c42f0[_0xf693('0x1a')](_0x957c3f);}return _0x5c42f0[_0xf693('0x1b')](_0x957c3f)[_0xf693('0x1c')]();};}function respondWithResult(_0x5541a7,_0x1d9278){_0x1d9278=_0x1d9278||0xc8;return function(_0x1c0dfc){if(_0x1c0dfc){return _0x5541a7[_0xf693('0x1b')](_0x1d9278)[_0xf693('0x1d')](_0x1c0dfc);}};}function respondWithFilteredResult(_0x345539,_0x19ea07){return function(_0x49fbbb){if(_0x49fbbb){var _0x5e02e0=_0x49fbbb[_0xf693('0x1e')],_0x4a5964=_0x19ea07[_0xf693('0x1f')],_0x2474d4=_0x19ea07[_0xf693('0x1f')]+_0x19ea07['limit'],_0xf4d20e;if(_0x2474d4>=_0x5e02e0){_0x2474d4=_0x5e02e0;_0xf4d20e=0xc8;}else{_0xf4d20e=0xce;}_0x345539[_0xf693('0x1b')](_0xf4d20e);return _0x345539[_0xf693('0x20')](_0xf693('0x21'),_0x4a5964+'-'+_0x2474d4+'/'+_0x5e02e0)[_0xf693('0x1d')](_0x49fbbb);}return null;};}function patchUpdates(_0x1d20fc){return function(_0x179af6){try{jsonpatch[_0xf693('0x22')](_0x179af6,_0x1d20fc,!![]);}catch(_0x38f209){return BPromise['reject'](_0x38f209);}return _0x179af6[_0xf693('0x23')]();};}function saveUpdates(_0x1188c6,_0x2e022b){return function(_0x260181){if(_0x260181){return _0x260181[_0xf693('0x24')](_0x1188c6)[_0xf693('0x25')](function(_0x200c95){return _0x200c95;});}return null;};}function removeEntity(_0x5407f5,_0x179e25){return function(_0x11ff68){if(_0x11ff68){return _0x11ff68[_0xf693('0x26')]()[_0xf693('0x25')](function(){var _0x4840e2=_0x11ff68[_0xf693('0x27')]({'plain':!![]});var _0x302e08=[{'name':_0xf693('0x28'),'value':_0xf693('0x29'),'ignore':![]},{'name':_0xf693('0x2a'),'value':_0xf693('0x2b'),'ignore':![]}];var _0x1c6ff2=_(_0x302e08)[_0xf693('0x2c')](_0xf693('0x2d'))[_0xf693('0x2e')]('value')[_0xf693('0x2f')]();if(_[_0xf693('0x30')](_0x1c6ff2,_0x4840e2[_0xf693('0x31')])){return;}var _0x405f94=_[_0xf693('0x32')](_0x302e08,[_0xf693('0x2f'),_0x4840e2[_0xf693('0x31')]])[_0xf693('0x33')];return db['UserProfileResource'][_0xf693('0x26')]({'where':{'type':_0x405f94,'resourceId':_0x4840e2['id']}})[_0xf693('0x25')](function(){return _0x11ff68;});})[_0xf693('0x25')](function(){_0x5407f5[_0xf693('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5109a7,_0x12ac0a){return function(_0x29db3d){if(!_0x29db3d){_0x5109a7['sendStatus'](0x194);}return _0x29db3d;};}function handleError(_0x46c214,_0x3f6bb5){_0x3f6bb5=_0x3f6bb5||0x1f4;return function(_0x3ab712){logger[_0xf693('0x34')](_0x3ab712['stack']);if(_0x3ab712[_0xf693('0x33')]){delete _0x3ab712[_0xf693('0x33')];}_0x46c214[_0xf693('0x1b')](_0x3f6bb5)[_0xf693('0x35')](_0x3ab712);};}exports[_0xf693('0x36')]=function(_0x34b086,_0x6c2ba4){var _0x2bf84d={},_0x57e0d6={},_0x158079={'count':0x0,'rows':[]};var _0x3c1026=_[_0xf693('0x2e')](db[_0xf693('0x37')][_0xf693('0x38')],function(_0x192f20){return{'name':_0x192f20['fieldName'],'type':_0x192f20['type'][_0xf693('0x39')]};});_0x57e0d6[_0xf693('0x3a')]=_[_0xf693('0x2e')](_0x3c1026,'name');_0x57e0d6[_0xf693('0x3b')]=_[_0xf693('0x3c')](_0x34b086[_0xf693('0x3b')]);_0x57e0d6[_0xf693('0x3d')]=_[_0xf693('0x3e')](_0x57e0d6['model'],_0x57e0d6[_0xf693('0x3b')]);_0x2bf84d[_0xf693('0x3f')]=_[_0xf693('0x3e')](_0x57e0d6['model'],qs[_0xf693('0x40')](_0x34b086['query'][_0xf693('0x40')]));_0x2bf84d[_0xf693('0x3f')]=_0x2bf84d[_0xf693('0x3f')][_0xf693('0x41')]?_0x2bf84d[_0xf693('0x3f')]:_0x57e0d6['model'];if(!_0x34b086[_0xf693('0x3b')][_0xf693('0x42')](_0xf693('0x43'))){_0x2bf84d[_0xf693('0x44')]=qs[_0xf693('0x44')](_0x34b086[_0xf693('0x3b')][_0xf693('0x44')]);_0x2bf84d[_0xf693('0x1f')]=qs[_0xf693('0x1f')](_0x34b086['query'][_0xf693('0x1f')]);}_0x2bf84d['order']=qs['sort'](_0x34b086[_0xf693('0x3b')][_0xf693('0x45')]);_0x2bf84d[_0xf693('0x46')]=qs['filters'](_[_0xf693('0x47')](_0x34b086['query'],_0x57e0d6[_0xf693('0x3d')]));if(_0x34b086['query'][_0xf693('0x2c')]){_0x2bf84d[_0xf693('0x46')]=_[_0xf693('0x48')](_0x2bf84d[_0xf693('0x46')],{'$or':_[_0xf693('0x2e')](_0x3c1026,function(_0x47bc1b){if(_0x47bc1b['type']!=='VIRTUAL'){var _0x5ba1c7={};_0x5ba1c7[_0x47bc1b[_0xf693('0x33')]]={'$like':'%'+_0x34b086[_0xf693('0x3b')]['filter']+'%'};return _0x5ba1c7;}})});}_0x2bf84d=_['merge']({},_0x2bf84d,_0x34b086['options']);var _0x29f0ac={'where':_0x2bf84d[_0xf693('0x46')]};return db[_0xf693('0x37')][_0xf693('0x1e')](_0x29f0ac)['then'](function(_0x37a106){_0x158079[_0xf693('0x1e')]=_0x37a106;if(_0x34b086[_0xf693('0x3b')]['includeAll']){_0x2bf84d[_0xf693('0x49')]=[{'all':!![]}];}return db[_0xf693('0x37')]['findAll'](_0x2bf84d);})[_0xf693('0x25')](function(_0x1c80f8){_0x158079['rows']=_0x1c80f8;return _0x158079;})[_0xf693('0x25')](respondWithFilteredResult(_0x6c2ba4,_0x2bf84d))[_0xf693('0x4a')](handleError(_0x6c2ba4,null));};exports['show']=function(_0x35de87,_0x58c15e){var _0x81ad8d={'raw':![],'where':{'id':_0x35de87['params']['id']}},_0x3dbdb1={};_0x3dbdb1[_0xf693('0x3a')]=_[_0xf693('0x3c')](db[_0xf693('0x37')][_0xf693('0x38')]);_0x3dbdb1[_0xf693('0x3b')]=_[_0xf693('0x3c')](_0x35de87['query']);_0x3dbdb1[_0xf693('0x3d')]=_[_0xf693('0x3e')](_0x3dbdb1[_0xf693('0x3a')],_0x3dbdb1[_0xf693('0x3b')]);_0x81ad8d[_0xf693('0x3f')]=_['intersection'](_0x3dbdb1[_0xf693('0x3a')],qs[_0xf693('0x40')](_0x35de87['query'][_0xf693('0x40')]));_0x81ad8d['attributes']=_0x81ad8d['attributes']['length']?_0x81ad8d[_0xf693('0x3f')]:_0x3dbdb1[_0xf693('0x3a')];if(_0x35de87[_0xf693('0x3b')][_0xf693('0x4b')]){_0x81ad8d['include']=[{'all':!![]}];}_0x81ad8d=_['merge']({},_0x81ad8d,_0x35de87[_0xf693('0x4c')]);return db['VoiceQueue'][_0xf693('0x32')](_0x81ad8d)[_0xf693('0x25')](handleEntityNotFound(_0x58c15e,null))[_0xf693('0x25')](respondWithResult(_0x58c15e,null))['catch'](handleError(_0x58c15e,null));};exports[_0xf693('0x4d')]=function(_0x3e9bf4,_0x43cf4f){return db[_0xf693('0x37')][_0xf693('0x4d')](_0x3e9bf4[_0xf693('0x4e')],{})['then'](function(_0x558657){var _0x256552=_0x3e9bf4['user']['get']({'plain':!![]});if(!_0x256552)throw new Error(_0xf693('0x4f'));if(_0x256552[_0xf693('0x50')]==='user'){var _0x272919=_0x558657[_0xf693('0x27')]({'plain':!![]});var _0x2e08d2=[{'name':_0xf693('0x28'),'value':'inbound'},{'name':'QueueCampaigns','value':_0xf693('0x2b')}];var _0x39f2c0=_[_0xf693('0x32')](_0x2e08d2,[_0xf693('0x2f'),_0x272919['type']])[_0xf693('0x33')];return db[_0xf693('0x51')]['find']({'where':{'name':_0x39f2c0,'userProfileId':_0x256552[_0xf693('0x52')]},'raw':!![]})[_0xf693('0x25')](function(_0x387635){if(_0x387635&&_0x387635[_0xf693('0x53')]===0x0){return db[_0xf693('0x54')][_0xf693('0x4d')]({'name':_0x272919[_0xf693('0x33')],'resourceId':_0x272919['id'],'type':_0x387635[_0xf693('0x33')],'sectionId':_0x387635['id']},{})[_0xf693('0x25')](function(){return _0x558657;});}else{return _0x558657;}})[_0xf693('0x4a')](function(_0xd579a0){logger[_0xf693('0x34')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xd579a0);throw _0xd579a0;});}return _0x558657;})[_0xf693('0x25')](respondWithResult(_0x43cf4f,0xc9))[_0xf693('0x4a')](handleError(_0x43cf4f,null));};exports[_0xf693('0x55')]=function(_0x3bcf6a,_0x2dc2ae){var _0x266161={'where':{'id':_0x3bcf6a[_0xf693('0x56')]['id']}},_0x2ea128={};_0x2ea128[_0xf693('0x3a')]=_[_0xf693('0x3c')](db[_0xf693('0x37')][_0xf693('0x38')]);_0x266161['attributes']=_[_0xf693('0x3e')](_0x2ea128[_0xf693('0x3a')],qs[_0xf693('0x40')](_0x3bcf6a[_0xf693('0x3b')][_0xf693('0x40')]));_0x266161[_0xf693('0x3f')]=_0x266161[_0xf693('0x3f')][_0xf693('0x41')]?_0x266161[_0xf693('0x3f')]:_0x2ea128[_0xf693('0x3a')];if(_0x3bcf6a[_0xf693('0x3b')][_0xf693('0x4b')]){_0x266161['include']=[{'all':!![]}];}_0x266161=_[_0xf693('0x48')]({},_0x266161,_0x3bcf6a[_0xf693('0x4c')]);return db[_0xf693('0x37')][_0xf693('0x32')](_0x266161)[_0xf693('0x25')](handleEntityNotFound(_0x2dc2ae,null))[_0xf693('0x25')](function(_0x581ae5){if(_0x581ae5){var _0x294469=_0x581ae5[_0xf693('0x27')]({'plain':!![]});_0x294469=qs[_0xf693('0x57')](_0x294469,['id',_0xf693('0x58'),_0xf693('0x59')]);_0x3bcf6a[_0xf693('0x4e')]=_[_0xf693('0x57')](_0x3bcf6a['body'],['id','createdAt',_0xf693('0x59')]);return db[_0xf693('0x37')][_0xf693('0x4d')](_[_0xf693('0x48')](_0x294469,_0x3bcf6a[_0xf693('0x4e')]),{'include':_0x3bcf6a[_0xf693('0x3b')][_0xf693('0x4b')]?[{'all':!![]}]:undefined})['then'](function(_0x506ac3){var _0x1261ba=_0x3bcf6a['user']['get']({'plain':!![]});if(!_0x1261ba)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1261ba[_0xf693('0x50')]===_0xf693('0x5a')){var _0x31eacb=_0x506ac3[_0xf693('0x27')]({'plain':!![]});var _0x5229fe=[{'name':_0xf693('0x28'),'value':_0xf693('0x29')},{'name':_0xf693('0x2a'),'value':_0xf693('0x2b')}];var _0x4ef82a=_[_0xf693('0x32')](_0x5229fe,[_0xf693('0x2f'),_0x31eacb[_0xf693('0x31')]])['name'];return db['UserProfileSection'][_0xf693('0x32')]({'where':{'name':_0x4ef82a,'userProfileId':_0x1261ba[_0xf693('0x52')]},'raw':!![]})[_0xf693('0x25')](function(_0x4d5ddd){if(_0x4d5ddd&&_0x4d5ddd[_0xf693('0x53')]===0x0){return db[_0xf693('0x54')]['create']({'name':_0x31eacb[_0xf693('0x33')],'resourceId':_0x31eacb['id'],'type':_0x4d5ddd[_0xf693('0x33')],'sectionId':_0x4d5ddd['id']},{})['then'](function(){return _0x506ac3;});}else{return _0x506ac3;}})[_0xf693('0x4a')](function(_0xd9923e){logger[_0xf693('0x34')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xd9923e);throw _0xd9923e;});}return _0x506ac3;});}})['then'](respondWithResult(_0x2dc2ae,0xc9))['catch'](handleError(_0x2dc2ae,null));};exports[_0xf693('0x24')]=function(_0x556ec1,_0xb40d85){if(_0x556ec1[_0xf693('0x4e')]['id']){delete _0x556ec1[_0xf693('0x4e')]['id'];}return db[_0xf693('0x37')][_0xf693('0x32')]({'where':{'id':_0x556ec1[_0xf693('0x56')]['id']}})[_0xf693('0x25')](handleEntityNotFound(_0xb40d85,null))[_0xf693('0x25')](saveUpdates(_0x556ec1[_0xf693('0x4e')],null))[_0xf693('0x25')](respondWithResult(_0xb40d85,null))[_0xf693('0x4a')](handleError(_0xb40d85,null));};exports[_0xf693('0x26')]=function(_0xd53dfa,_0x155cb9){return db[_0xf693('0x37')][_0xf693('0x32')]({'where':{'id':_0xd53dfa[_0xf693('0x56')]['id']}})[_0xf693('0x25')](handleEntityNotFound(_0x155cb9,null))[_0xf693('0x25')](removeEntity(_0x155cb9,null))[_0xf693('0x4a')](handleError(_0x155cb9,null));};exports[_0xf693('0x5b')]=function(_0x1aaea6,_0xd80579,_0x19bd51){var _0x1271b0={'raw':![],'where':{}};var _0x42c05c={};var _0xe987fe={'count':0x0,'rows':[]};return db[_0xf693('0x37')]['findOne']({'where':{'id':_0x1aaea6[_0xf693('0x56')]['id']}})['then'](handleEntityNotFound(_0xd80579,null))[_0xf693('0x25')](function(_0x4622e6){if(_0x4622e6){_0x42c05c['model']=_['keys'](db[_0xf693('0x5c')][_0xf693('0x38')]);_0x42c05c[_0xf693('0x3b')]=_[_0xf693('0x3c')](_0x1aaea6[_0xf693('0x3b')]);_0x42c05c[_0xf693('0x3d')]=_[_0xf693('0x3e')](_0x42c05c['model'],_0x42c05c['query']);_0x1271b0[_0xf693('0x3f')]=_[_0xf693('0x3e')](_0x42c05c[_0xf693('0x3a')],qs[_0xf693('0x40')](_0x1aaea6[_0xf693('0x3b')][_0xf693('0x40')]));_0x1271b0[_0xf693('0x3f')]=_0x1271b0[_0xf693('0x3f')][_0xf693('0x41')]?_0x1271b0[_0xf693('0x3f')]:_0x42c05c[_0xf693('0x3a')];if(!_0x1aaea6['query'][_0xf693('0x42')](_0xf693('0x43'))){_0x1271b0['limit']=qs[_0xf693('0x44')](_0x1aaea6[_0xf693('0x3b')][_0xf693('0x44')]);_0x1271b0[_0xf693('0x1f')]=qs['offset'](_0x1aaea6[_0xf693('0x3b')][_0xf693('0x1f')]);}_0x1271b0['order']=qs['sort'](_0x1aaea6[_0xf693('0x3b')][_0xf693('0x45')]);_0x1271b0[_0xf693('0x46')]=qs[_0xf693('0x3d')](_[_0xf693('0x47')](_0x1aaea6[_0xf693('0x3b')],_0x42c05c[_0xf693('0x3d')]));_0x1271b0[_0xf693('0x46')][_0xf693('0x5d')]=_0x4622e6['id'];if(_0x1aaea6[_0xf693('0x3b')][_0xf693('0x2c')]){_0x1271b0[_0xf693('0x46')]=_[_0xf693('0x48')](_0x1271b0[_0xf693('0x46')],{'$or':_[_0xf693('0x2e')](_0x1271b0[_0xf693('0x3f')],function(_0x213639){var _0x3324ad={};_0x3324ad[_0x213639]={'$like':'%'+_0x1aaea6['query']['filter']+'%'};return _0x3324ad;})});}_0x1271b0=_['merge']({},_0x1271b0,_0x1aaea6[_0xf693('0x4c')]);return db[_0xf693('0x5c')]['count']({'where':_0x1271b0[_0xf693('0x46')]})['then'](function(_0x1a0b92){_0xe987fe[_0xf693('0x1e')]=_0x1a0b92;if(_0x1aaea6[_0xf693('0x3b')][_0xf693('0x4b')]){_0x1271b0[_0xf693('0x49')]=[{'all':!![]}];}return db[_0xf693('0x5c')][_0xf693('0x5e')](_0x1271b0);})[_0xf693('0x25')](function(_0x298f1b){_0xe987fe['rows']=_0x298f1b;return _0xe987fe;});}})['then'](respondWithFilteredResult(_0xd80579,_0x1271b0))['catch'](handleError(_0xd80579,null));};exports['getHopperHistories']=function(_0x5db577,_0x2c6abf,_0x6d28bc){var _0x5220d1={'raw':!![],'where':{}};var _0x368d25={};var _0x135e2f={'count':0x0,'rows':[]};return db[_0xf693('0x37')][_0xf693('0x5f')]({'where':{'id':_0x5db577[_0xf693('0x56')]['id']}})[_0xf693('0x25')](handleEntityNotFound(_0x2c6abf,null))[_0xf693('0x25')](function(_0x4e0255){if(_0x4e0255){_0x368d25[_0xf693('0x3a')]=_[_0xf693('0x3c')](db[_0xf693('0x60')][_0xf693('0x38')]);_0x368d25[_0xf693('0x3b')]=_[_0xf693('0x3c')](_0x5db577[_0xf693('0x3b')]);_0x368d25[_0xf693('0x3d')]=_['intersection'](_0x368d25[_0xf693('0x3a')],_0x368d25['query']);_0x5220d1['attributes']=_[_0xf693('0x3e')](_0x368d25['model'],qs[_0xf693('0x40')](_0x5db577[_0xf693('0x3b')]['fields']));_0x5220d1[_0xf693('0x3f')]=_0x5220d1[_0xf693('0x3f')]['length']?_0x5220d1['attributes']:_0x368d25[_0xf693('0x3a')];if(!_0x5db577[_0xf693('0x3b')]['hasOwnProperty'](_0xf693('0x43'))){_0x5220d1['limit']=qs[_0xf693('0x44')](_0x5db577[_0xf693('0x3b')][_0xf693('0x44')]);_0x5220d1[_0xf693('0x1f')]=qs[_0xf693('0x1f')](_0x5db577['query']['offset']);}_0x5220d1['order']=qs[_0xf693('0x45')](_0x5db577[_0xf693('0x3b')][_0xf693('0x45')]);_0x5220d1[_0xf693('0x46')]=qs[_0xf693('0x3d')](_[_0xf693('0x47')](_0x5db577[_0xf693('0x3b')],_0x368d25[_0xf693('0x3d')]));_0x5220d1['where']['VoiceQueueId']=_0x4e0255['id'];if(_0x5db577['query'][_0xf693('0x2c')]){_0x5220d1[_0xf693('0x46')]=_[_0xf693('0x48')](_0x5220d1['where'],{'$or':_['map'](_0x5220d1['attributes'],function(_0x5a4644){var _0x4c6c13={};_0x4c6c13[_0x5a4644]={'$like':'%'+_0x5db577[_0xf693('0x3b')][_0xf693('0x2c')]+'%'};return _0x4c6c13;})});}_0x5220d1=_['merge']({},_0x5220d1,_0x5db577[_0xf693('0x4c')]);return db[_0xf693('0x60')][_0xf693('0x1e')]({'where':_0x5220d1[_0xf693('0x46')]})[_0xf693('0x25')](function(_0x1519f2){_0x135e2f[_0xf693('0x1e')]=_0x1519f2;if(_0x5db577[_0xf693('0x3b')][_0xf693('0x4b')]){_0x5220d1[_0xf693('0x49')]=[{'all':!![]}];}return db[_0xf693('0x60')][_0xf693('0x5e')](_0x5220d1);})[_0xf693('0x25')](function(_0x243584){_0x135e2f[_0xf693('0x61')]=_0x243584;return _0x135e2f;});}})[_0xf693('0x25')](respondWithFilteredResult(_0x2c6abf,_0x5220d1))[_0xf693('0x4a')](handleError(_0x2c6abf,null));};exports[_0xf693('0x62')]=function(_0x484eb1,_0x211b85,_0x33477c){var _0x3f38b8={'raw':!![],'where':{}};var _0x99918={};var _0x558ab0={'count':0x0,'rows':[]};return db[_0xf693('0x37')]['findOne']({'where':{'id':_0x484eb1[_0xf693('0x56')]['id']}})['then'](handleEntityNotFound(_0x211b85,null))[_0xf693('0x25')](function(_0xc7cb24){if(_0xc7cb24){_0x99918[_0xf693('0x3a')]=_[_0xf693('0x3c')](db['CmHopperFinal'][_0xf693('0x38')]);_0x99918[_0xf693('0x3b')]=_[_0xf693('0x3c')](_0x484eb1[_0xf693('0x3b')]);_0x99918[_0xf693('0x3d')]=_['intersection'](_0x99918[_0xf693('0x3a')],_0x99918['query']);_0x3f38b8['attributes']=_['intersection'](_0x99918['model'],qs['fields'](_0x484eb1[_0xf693('0x3b')][_0xf693('0x40')]));_0x3f38b8[_0xf693('0x3f')]=_0x3f38b8[_0xf693('0x3f')]['length']?_0x3f38b8['attributes']:_0x99918['model'];if(!_0x484eb1[_0xf693('0x3b')][_0xf693('0x42')](_0xf693('0x43'))){_0x3f38b8[_0xf693('0x44')]=qs[_0xf693('0x44')](_0x484eb1[_0xf693('0x3b')]['limit']);_0x3f38b8[_0xf693('0x1f')]=qs[_0xf693('0x1f')](_0x484eb1[_0xf693('0x3b')][_0xf693('0x1f')]);}_0x3f38b8[_0xf693('0x63')]=qs['sort'](_0x484eb1[_0xf693('0x3b')][_0xf693('0x45')]);_0x3f38b8[_0xf693('0x46')]=qs[_0xf693('0x3d')](_[_0xf693('0x47')](_0x484eb1[_0xf693('0x3b')],_0x99918[_0xf693('0x3d')]));_0x3f38b8[_0xf693('0x46')][_0xf693('0x5d')]=_0xc7cb24['id'];if(_0x484eb1['query'][_0xf693('0x2c')]){_0x3f38b8['where']=_[_0xf693('0x48')](_0x3f38b8[_0xf693('0x46')],{'$or':_[_0xf693('0x2e')](_0x3f38b8['attributes'],function(_0x573b25){var _0x274cdb={};_0x274cdb[_0x573b25]={'$like':'%'+_0x484eb1[_0xf693('0x3b')]['filter']+'%'};return _0x274cdb;})});}_0x3f38b8=_[_0xf693('0x48')]({},_0x3f38b8,_0x484eb1[_0xf693('0x4c')]);return db[_0xf693('0x64')]['count']({'where':_0x3f38b8[_0xf693('0x46')]})[_0xf693('0x25')](function(_0x1d2ce5){_0x558ab0['count']=_0x1d2ce5;if(_0x484eb1[_0xf693('0x3b')][_0xf693('0x4b')]){_0x3f38b8[_0xf693('0x49')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x3f38b8);})[_0xf693('0x25')](function(_0x5e16ab){_0x558ab0[_0xf693('0x61')]=_0x5e16ab;return _0x558ab0;});}})[_0xf693('0x25')](respondWithFilteredResult(_0x211b85,_0x3f38b8))['catch'](handleError(_0x211b85,null));};exports[_0xf693('0x65')]=function(_0x41d077,_0x1e3e6b,_0x16028d){var _0xb1f168={'raw':!![],'where':{}};var _0x5c1db6={};var _0x47d0d5={'count':0x0,'rows':[]};return db[_0xf693('0x37')]['findOne']({'where':{'id':_0x41d077[_0xf693('0x56')]['id']}})[_0xf693('0x25')](handleEntityNotFound(_0x1e3e6b,null))['then'](function(_0xd61448){if(_0xd61448){_0x5c1db6[_0xf693('0x3a')]=_[_0xf693('0x3c')](db[_0xf693('0x66')][_0xf693('0x38')]);_0x5c1db6[_0xf693('0x3b')]=_['keys'](_0x41d077['query']);_0x5c1db6['filters']=_[_0xf693('0x3e')](_0x5c1db6[_0xf693('0x3a')],_0x5c1db6[_0xf693('0x3b')]);_0xb1f168[_0xf693('0x3f')]=_[_0xf693('0x3e')](_0x5c1db6[_0xf693('0x3a')],qs[_0xf693('0x40')](_0x41d077[_0xf693('0x3b')][_0xf693('0x40')]));_0xb1f168[_0xf693('0x3f')]=_0xb1f168['attributes']['length']?_0xb1f168['attributes']:_0x5c1db6['model'];if(!_0x41d077[_0xf693('0x3b')][_0xf693('0x42')](_0xf693('0x43'))){_0xb1f168[_0xf693('0x44')]=qs[_0xf693('0x44')](_0x41d077['query'][_0xf693('0x44')]);_0xb1f168[_0xf693('0x1f')]=qs[_0xf693('0x1f')](_0x41d077['query'][_0xf693('0x1f')]);}_0xb1f168['order']=qs['sort'](_0x41d077['query'][_0xf693('0x45')]);_0xb1f168[_0xf693('0x46')]=qs[_0xf693('0x3d')](_[_0xf693('0x47')](_0x41d077[_0xf693('0x3b')],_0x5c1db6[_0xf693('0x3d')]));_0xb1f168[_0xf693('0x46')][_0xf693('0x5d')]=_0xd61448['id'];if(_0x41d077[_0xf693('0x3b')]['filter']){_0xb1f168['where']=_[_0xf693('0x48')](_0xb1f168[_0xf693('0x46')],{'$or':_[_0xf693('0x2e')](_0xb1f168[_0xf693('0x3f')],function(_0x18784b){var _0x20077c={};_0x20077c[_0x18784b]={'$like':'%'+_0x41d077[_0xf693('0x3b')][_0xf693('0x2c')]+'%'};return _0x20077c;})});}_0xb1f168=_[_0xf693('0x48')]({},_0xb1f168,_0x41d077[_0xf693('0x4c')]);return db[_0xf693('0x66')][_0xf693('0x1e')]({'where':_0xb1f168[_0xf693('0x46')]})[_0xf693('0x25')](function(_0x4d46da){_0x47d0d5[_0xf693('0x1e')]=_0x4d46da;if(_0x41d077[_0xf693('0x3b')]['includeAll']){_0xb1f168[_0xf693('0x49')]=[{'all':!![]}];}return db[_0xf693('0x66')][_0xf693('0x5e')](_0xb1f168);})['then'](function(_0x1eed63){_0x47d0d5[_0xf693('0x61')]=_0x1eed63;return _0x47d0d5;});}})[_0xf693('0x25')](respondWithFilteredResult(_0x1e3e6b,_0xb1f168))[_0xf693('0x4a')](handleError(_0x1e3e6b,null));};exports[_0xf693('0x67')]=function(_0x3173d4,_0x38cd9b,_0x2f1310){var _0x433467={};var _0x1b98f1={};var _0xf09d5;var _0x54eb28;return db[_0xf693('0x37')][_0xf693('0x5f')]({'where':{'id':_0x3173d4['params']['id']}})[_0xf693('0x25')](handleEntityNotFound(_0x38cd9b,null))['then'](function(_0x294c43){if(_0x294c43){_0xf09d5=_0x294c43;_0x1b98f1[_0xf693('0x3a')]=_[_0xf693('0x3c')](db[_0xf693('0x68')]['rawAttributes']);_0x1b98f1[_0xf693('0x3b')]=_['keys'](_0x3173d4[_0xf693('0x3b')]);_0x1b98f1['filters']=_[_0xf693('0x3e')](_0x1b98f1[_0xf693('0x3a')],_0x1b98f1[_0xf693('0x3b')]);_0x433467[_0xf693('0x3f')]=_[_0xf693('0x3e')](_0x1b98f1[_0xf693('0x3a')],qs['fields'](_0x3173d4['query'][_0xf693('0x40')]));_0x433467[_0xf693('0x3f')]=_0x433467[_0xf693('0x3f')][_0xf693('0x41')]?_0x433467[_0xf693('0x3f')]:_0x1b98f1[_0xf693('0x3a')];_0x433467['order']=qs[_0xf693('0x45')](_0x3173d4[_0xf693('0x3b')][_0xf693('0x45')]);_0x433467[_0xf693('0x46')]=qs[_0xf693('0x3d')](_[_0xf693('0x47')](_0x3173d4[_0xf693('0x3b')],_0x1b98f1[_0xf693('0x3d')]));if(_0x3173d4[_0xf693('0x3b')][_0xf693('0x2c')]){_0x433467[_0xf693('0x46')]=_['merge'](_0x433467[_0xf693('0x46')],{'$or':_[_0xf693('0x2e')](_0x433467[_0xf693('0x3f')],function(_0x37acba){var _0x2ef268={};_0x2ef268[_0x37acba]={'$like':'%'+_0x3173d4[_0xf693('0x3b')]['filter']+'%'};return _0x2ef268;})});}_0x433467=_[_0xf693('0x48')]({},_0x433467,_0x3173d4['options']);return _0xf09d5['getTeams'](_0x433467);}})[_0xf693('0x25')](function(_0x58a4e7){if(_0x58a4e7){_0x54eb28=_0x58a4e7['length'];if(!_0x3173d4[_0xf693('0x3b')][_0xf693('0x42')](_0xf693('0x43'))){_0x433467['limit']=qs[_0xf693('0x44')](_0x3173d4[_0xf693('0x3b')]['limit']);_0x433467['offset']=qs[_0xf693('0x1f')](_0x3173d4[_0xf693('0x3b')][_0xf693('0x1f')]);}return _0xf09d5['getTeams'](_0x433467);}})[_0xf693('0x25')](function(_0x5e8967){if(_0x5e8967){return _0x5e8967?{'count':_0x54eb28,'rows':_0x5e8967}:null;}})[_0xf693('0x25')](respondWithResult(_0x38cd9b,null))[_0xf693('0x4a')](handleError(_0x38cd9b,null));};exports['addTeams']=function(_0x45ab72,_0x311893,_0x141924){var _0x1702ab=_0x45ab72['body'][_0xf693('0x69')];var _0x50a4dc=_[_0xf693('0x2e')](_0x1702ab,'id');return db[_0xf693('0x68')][_0xf693('0x5e')]({'where':{'id':_0x50a4dc},'attributes':['id'],'include':[{'model':db[_0xf693('0x6a')],'as':_0xf693('0x6b'),'attributes':['id',_0xf693('0x33'),_0xf693('0x6c'),_0xf693('0x6d'),_0xf693('0x6e')],'raw':!![]}]})[_0xf693('0x25')](function(_0x317b3b){if(_0x317b3b){var _0x34dba1=_[_0xf693('0x6f')](_0x317b3b,function(_0x2dc741){var _0x185a22=_0x2dc741['get']({'plain':!![]});_0x185a22['Agents'][_0xf693('0x70')](function(_0x362cb1){_0x362cb1['penalty']=_[_0xf693('0x32')](_0x1702ab,{'id':_0x185a22['id']})['penalty'];});return _0x185a22['Agents'];});return db[_0xf693('0x37')][_0xf693('0x32')]({'where':{'id':_0x45ab72[_0xf693('0x56')]['id']}})[_0xf693('0x25')](function(_0x3273f5){return db[_0xf693('0x71')][_0xf693('0x72')](function(_0x3dcd2d){return _0x3273f5['addTeams'](_0x50a4dc,{'transaction':_0x3dcd2d})[_0xf693('0x25')](function(){return BPromise[_0xf693('0x73')](_0x34dba1,function(_0x588bc4){return db[_0xf693('0x74')][_0xf693('0x75')]({'where':{'UserId':_0x588bc4['id'],'VoiceQueueId':_0x45ab72['params']['id']},'defaults':{'penalty':_0x588bc4['penalty']},'transaction':_0x3dcd2d});});})['then'](function(){return BPromise[_0xf693('0x73')](_[_0xf693('0x2c')](_0x34dba1,{'online':!![]}),function(_0x4772e9){return db[_0xf693('0x76')][_0xf693('0x77')]({'membername':_0x4772e9[_0xf693('0x33')],'UserId':_0x4772e9['id'],'queue_name':_0x3273f5[_0xf693('0x33')],'VoiceQueueId':_0x3273f5['id'],'interface':_['isNil'](_0x4772e9[_0xf693('0x6e')])?util[_0xf693('0x78')]('SIP/%s',_0x4772e9[_0xf693('0x33')]):_0x4772e9['interface'],'paused':_0x4772e9[_0xf693('0x6d')]||![],'penalty':_0x4772e9['penalty']},{'transaction':_0x3dcd2d});});})[_0xf693('0x25')](function(){_0x34dba1[_0xf693('0x70')](function(_0x5428f9){socket['emit']('userVoiceQueue:save',{'UserId':_0x5428f9['id'],'VoiceQueueId':_0x3273f5['id']});});});});});}})[_0xf693('0x25')](respondWithStatusCode(_0x311893,null))[_0xf693('0x4a')](handleError(_0x311893,null));};exports[_0xf693('0x79')]=function(_0x50dd8b,_0x57569e,_0xae5965){return db[_0xf693('0x68')]['findAll']({'where':{'id':_0x50dd8b[_0xf693('0x3b')][_0xf693('0x7a')]},'attributes':['id'],'include':[{'model':db[_0xf693('0x6a')],'as':_0xf693('0x6b'),'attributes':['id'],'raw':!![]}]})[_0xf693('0x25')](handleEntityNotFound(_0x57569e,null))['then'](function(_0x264cbf){var _0x1b3e3e=_[_0xf693('0x2e')](_0x264cbf,'id');var _0x1894e3=[];var _0x256074=[];var _0x2352f4=squel['select']();_0x2352f4['field']('tq.TeamId')[_0xf693('0x7b')](_0xf693('0x7c'),'tq')[_0xf693('0x7d')](_0xf693('0x7e'),'ut',_0xf693('0x7f'))['where']('VoiceQueueId\x20=\x20?',_0x50dd8b[_0xf693('0x56')]['id']);for(var _0x2b7fe3=0x0;_0x2b7fe3<_0x264cbf[_0xf693('0x41')];_0x2b7fe3+=0x1){let _0x2ab2f3=_0x264cbf[_0x2b7fe3];for(var _0x248afd=0x0;_0x248afd<_0x2ab2f3[_0xf693('0x6b')][_0xf693('0x41')];_0x248afd+=0x1){let _0x8e7840=_0x2ab2f3[_0xf693('0x6b')][_0x248afd];var _0x4e091a=_0x2352f4[_0xf693('0x55')]();_0x4e091a[_0xf693('0x46')](_0xf693('0x80'),_0x8e7840['id']);_0x256074[_0xf693('0x81')](db[_0xf693('0x71')]['query'](_0x4e091a[_0xf693('0x82')](),{'type':db[_0xf693('0x71')][_0xf693('0x83')][_0xf693('0x84')]})['then'](function(_0x272ba5){if(_0x272ba5['length']===0x1){return _0x8e7840['id'];}else{var _0x1ccd1f=_[_0xf693('0x85')](_[_0xf693('0x2e')](_0x272ba5,'TeamId'),function(_0x4ac514){return _[_0xf693('0x30')](_0x1b3e3e,_0x4ac514);});if(_0x1ccd1f){return _0x8e7840['id'];}}}));}}return BPromise[_0xf693('0x86')](_0x256074)['then'](function(_0x4e25d4){_0x1894e3=_(_0x1894e3)[_0xf693('0x87')](_0x4e25d4)[_0xf693('0x88')]()[_0xf693('0x2f')]();return db['VoiceQueue'][_0xf693('0x32')]({'where':{'id':_0x50dd8b[_0xf693('0x56')]['id']}})[_0xf693('0x25')](function(_0x12d2af){return db[_0xf693('0x71')][_0xf693('0x72')](function(_0x3b1f64){return _0x12d2af[_0xf693('0x79')](_0x50dd8b[_0xf693('0x3b')]['ids'],{'transaction':_0x3b1f64})[_0xf693('0x25')](function(){if(!_[_0xf693('0x89')](_0x1894e3)){return _0x12d2af[_0xf693('0x8a')](_0x1894e3,{'transaction':_0x3b1f64})[_0xf693('0x25')](function(){return db['UserVoiceQueueRt'][_0xf693('0x26')]({'where':{'VoiceQueueId':_0x50dd8b[_0xf693('0x56')]['id'],'UserId':_0x1894e3},'transaction':_0x3b1f64});});}})[_0xf693('0x25')](function(){_0x1894e3['forEach'](function(_0x2d0376){socket[_0xf693('0x8b')]('userVoiceQueue:remove',{'UserId':_0x2d0376,'VoiceQueueId':_0x12d2af['id']});});});});});});})[_0xf693('0x25')](respondWithStatusCode(_0x57569e,null))['catch'](handleError(_0x57569e,null));};exports['addAgents']=function(_0x119a6f,_0x385a3b,_0x50dc9d){var _0xf57155,_0x24e1df;return db[_0xf693('0x37')]['find']({'where':{'id':_0x119a6f[_0xf693('0x56')]['id']}})[_0xf693('0x25')](handleEntityNotFound(_0x385a3b,null))[_0xf693('0x25')](function(_0x32fc45){if(_0x32fc45){_0x24e1df=_0x32fc45;return _0x32fc45[_0xf693('0x8c')](_0x119a6f[_0xf693('0x4e')][_0xf693('0x7a')],_[_0xf693('0x57')](_0x119a6f['body'],[_0xf693('0x7a'),'id'])||{})[_0xf693('0x8d')](function(_0x28a859){for(var _0x2528bd=0x0;_0x2528bd<_0x119a6f['body'][_0xf693('0x7a')]['length'];_0x2528bd+=0x1){socket[_0xf693('0x8b')](_0xf693('0x8e'),{'UserId':_0x119a6f['body'][_0xf693('0x7a')][_0x2528bd],'VoiceQueueId':_0x119a6f[_0xf693('0x56')]['id']});}return _0x28a859;});}})['then'](function(_0xf5eeb0){_0xf57155=_0xf5eeb0||[];if(_0x24e1df){return db['User'][_0xf693('0x5e')]({'where':{'id':_0x119a6f[_0xf693('0x4e')][_0xf693('0x7a')]},'attributes':['id','name','online',_0xf693('0x6d'),_0xf693('0x6e')],'raw':!![]});}})[_0xf693('0x25')](function(_0x366801){if(!_[_0xf693('0x89')](_0x366801)){var _0xa7b5b4=[];for(var _0x52bdb3=0x0;_0x52bdb3<_0x366801[_0xf693('0x41')];_0x52bdb3++){if(_0x366801[_0x52bdb3][_0xf693('0x6c')]){_0xa7b5b4[_0xf693('0x81')](db[_0xf693('0x76')][_0xf693('0x77')]({'membername':_0x366801[_0x52bdb3]['name'],'UserId':_0x366801[_0x52bdb3]['id'],'queue_name':_0x24e1df['name'],'VoiceQueueId':_0x24e1df['id'],'interface':_[_0xf693('0x8f')](_0x366801[_0x52bdb3][_0xf693('0x6e')])?util[_0xf693('0x78')](_0xf693('0x90'),_0x366801[_0x52bdb3]['name']):_0x366801[_0x52bdb3][_0xf693('0x6e')],'paused':_0x366801[_0x52bdb3][_0xf693('0x6d')]||![],'penalty':_0x119a6f[_0xf693('0x4e')][_0xf693('0x91')]||0x0}));}}return BPromise[_0xf693('0x86')](_0xa7b5b4);}})[_0xf693('0x25')](function(){return _0xf57155;})[_0xf693('0x25')](respondWithResult(_0x385a3b,null))[_0xf693('0x4a')](handleError(_0x385a3b,null));};exports['removeAgents']=function(_0x55c3f1,_0x1bdcff,_0x36270f){return db[_0xf693('0x37')][_0xf693('0x32')]({'where':{'id':_0x55c3f1['params']['id']}})['then'](handleEntityNotFound(_0x1bdcff,null))['then'](function(_0x2ba90a){if(_0x2ba90a){return _0x2ba90a['removeAgents'](_0x55c3f1[_0xf693('0x3b')]['ids'])['then'](function(){if(_[_0xf693('0x92')](_0x55c3f1[_0xf693('0x3b')][_0xf693('0x7a')])){for(var _0x44fe80=0x0;_0x44fe80<_0x55c3f1[_0xf693('0x3b')][_0xf693('0x7a')][_0xf693('0x41')];_0x44fe80+=0x1){socket[_0xf693('0x8b')]('userVoiceQueue:remove',{'UserId':Number(_0x55c3f1[_0xf693('0x3b')]['ids'][_0x44fe80]),'VoiceQueueId':Number(_0x55c3f1[_0xf693('0x56')]['id'])});}}else{socket[_0xf693('0x8b')](_0xf693('0x93'),{'UserId':Number(_0x55c3f1[_0xf693('0x3b')]['ids']),'VoiceQueueId':Number(_0x55c3f1[_0xf693('0x56')]['id'])});}});}})[_0xf693('0x25')](function(_0x41deb7){return db[_0xf693('0x76')][_0xf693('0x26')]({'where':{'VoiceQueueId':_0x55c3f1[_0xf693('0x56')]['id'],'UserId':_0x55c3f1['query'][_0xf693('0x7a')]}})[_0xf693('0x25')](function(){return _0x41deb7;});})[_0xf693('0x25')](respondWithStatusCode(_0x1bdcff,null))[_0xf693('0x4a')](handleError(_0x1bdcff,null));};exports[_0xf693('0x94')]=function(_0x4fff09,_0x4f5956,_0x542c12){var _0x524a76={};var _0x3affa5={};var _0x326682;var _0xc0b995;return db[_0xf693('0x37')]['findOne']({'where':{'id':_0x4fff09[_0xf693('0x56')]['id']}})['then'](handleEntityNotFound(_0x4f5956,null))[_0xf693('0x25')](function(_0x20021d){if(_0x20021d){_0x326682=_0x20021d;_0x3affa5[_0xf693('0x3a')]=_[_0xf693('0x3c')](db[_0xf693('0x6a')][_0xf693('0x38')]);_0x3affa5[_0xf693('0x3b')]=_[_0xf693('0x3c')](_0x4fff09[_0xf693('0x3b')]);_0x3affa5[_0xf693('0x3d')]=_[_0xf693('0x3e')](_0x3affa5[_0xf693('0x3a')],_0x3affa5['query']);_0x524a76[_0xf693('0x3f')]=_[_0xf693('0x3e')](_0x3affa5[_0xf693('0x3a')],qs[_0xf693('0x40')](_0x4fff09[_0xf693('0x3b')][_0xf693('0x40')]));_0x524a76['attributes']=_0x524a76[_0xf693('0x3f')][_0xf693('0x41')]?_0x524a76[_0xf693('0x3f')]:_0x3affa5['model'];_0x524a76['order']=qs['sort'](_0x4fff09[_0xf693('0x3b')][_0xf693('0x45')]);_0x524a76['where']=qs['filters'](_[_0xf693('0x47')](_0x4fff09['query'],_0x3affa5[_0xf693('0x3d')]));if(_0x4fff09[_0xf693('0x3b')][_0xf693('0x2c')]){_0x524a76[_0xf693('0x46')]=_[_0xf693('0x48')](_0x524a76[_0xf693('0x46')],{'$or':_[_0xf693('0x2e')](_0x524a76['attributes'],function(_0x14aea3){var _0x3d26e2={};_0x3d26e2[_0x14aea3]={'$like':'%'+_0x4fff09[_0xf693('0x3b')][_0xf693('0x2c')]+'%'};return _0x3d26e2;})});}_0x524a76=_[_0xf693('0x48')]({},_0x524a76,_0x4fff09[_0xf693('0x4c')]);return _0x326682[_0xf693('0x94')](_0x524a76);}})['then'](function(_0x2f1aeb){if(_0x2f1aeb){_0xc0b995=_0x2f1aeb[_0xf693('0x41')];if(!_0x4fff09[_0xf693('0x3b')][_0xf693('0x42')](_0xf693('0x43'))){_0x524a76['limit']=qs[_0xf693('0x44')](_0x4fff09['query'][_0xf693('0x44')]);_0x524a76['offset']=qs[_0xf693('0x1f')](_0x4fff09[_0xf693('0x3b')][_0xf693('0x1f')]);}return _0x326682['getAgents'](_0x524a76);}})[_0xf693('0x25')](function(_0x8e9531){if(_0x8e9531){return _0x8e9531?{'count':_0xc0b995,'rows':_0x8e9531}:null;}})[_0xf693('0x25')](respondWithResult(_0x4f5956,null))[_0xf693('0x4a')](handleError(_0x4f5956,null));};exports[_0xf693('0x95')]=function(_0x1a2a7a,_0x3e566f,_0xddc620){var _0x49040f={};var _0x1b5e40={};var _0xae7c43;var _0x265499;return db[_0xf693('0x37')][_0xf693('0x5f')]({'where':{'id':_0x1a2a7a[_0xf693('0x56')]['id']}})[_0xf693('0x25')](handleEntityNotFound(_0x3e566f,null))[_0xf693('0x25')](function(_0x3db0d3){if(_0x3db0d3){_0xae7c43=_0x3db0d3;_0x1b5e40[_0xf693('0x3a')]=_[_0xf693('0x3c')](db['UserVoiceQueueRt']['rawAttributes']);_0x1b5e40[_0xf693('0x3b')]=_[_0xf693('0x3c')](_0x1a2a7a[_0xf693('0x3b')]);_0x1b5e40[_0xf693('0x3d')]=_['intersection'](_0x1b5e40[_0xf693('0x3a')],_0x1b5e40['query']);_0x49040f[_0xf693('0x3f')]=_[_0xf693('0x3e')](_0x1b5e40[_0xf693('0x3a')],qs[_0xf693('0x40')](_0x1a2a7a[_0xf693('0x3b')][_0xf693('0x40')]));_0x49040f['attributes']=_0x49040f[_0xf693('0x3f')][_0xf693('0x41')]?_0x49040f[_0xf693('0x3f')]:_0x1b5e40['model'];_0x49040f[_0xf693('0x63')]=qs[_0xf693('0x45')](_0x1a2a7a['query'][_0xf693('0x45')]);_0x49040f[_0xf693('0x46')]=qs[_0xf693('0x3d')](_['pick'](_0x1a2a7a[_0xf693('0x3b')],_0x1b5e40[_0xf693('0x3d')]));if(_0x1a2a7a[_0xf693('0x3b')][_0xf693('0x2c')]){_0x49040f['where']=_[_0xf693('0x48')](_0x49040f['where'],{'$or':_[_0xf693('0x2e')](_0x49040f[_0xf693('0x3f')],function(_0x179d91){var _0x3b531a={};_0x3b531a[_0x179d91]={'$like':'%'+_0x1a2a7a[_0xf693('0x3b')][_0xf693('0x2c')]+'%'};return _0x3b531a;})});}_0x49040f=_['merge']({},_0x49040f,_0x1a2a7a[_0xf693('0x4c')]);return _0xae7c43[_0xf693('0x95')](_0x49040f);}})[_0xf693('0x25')](function(_0x5d6df4){if(_0x5d6df4){_0x265499=_0x5d6df4['length'];if(!_0x1a2a7a[_0xf693('0x3b')][_0xf693('0x42')]('nolimit')){_0x49040f[_0xf693('0x44')]=qs[_0xf693('0x44')](_0x1a2a7a['query']['limit']);_0x49040f[_0xf693('0x1f')]=qs[_0xf693('0x1f')](_0x1a2a7a[_0xf693('0x3b')]['offset']);}return _0xae7c43[_0xf693('0x95')](_0x49040f);}})[_0xf693('0x25')](function(_0x2dc347){return _0x2dc347?{'count':_0x265499,'rows':_0x2dc347}:null;})[_0xf693('0x25')](respondWithResult(_0x3e566f,null))[_0xf693('0x4a')](handleError(_0x3e566f,null));};exports[_0xf693('0x96')]=function(_0x1deda4,_0x2517d1,_0x59a7a4){var _0x49dcae={};var _0x33c6f7={};var _0x9db3dc;var _0x3276d4;return db[_0xf693('0x37')]['findOne']({'where':{'id':_0x1deda4['params']['id']}})[_0xf693('0x25')](handleEntityNotFound(_0x2517d1,null))[_0xf693('0x25')](function(_0x138b95){if(_0x138b95){_0x9db3dc=_0x138b95;_0x33c6f7[_0xf693('0x3a')]=_[_0xf693('0x3c')](db[_0xf693('0x97')]['rawAttributes']);_0x33c6f7[_0xf693('0x3b')]=_['keys'](_0x1deda4[_0xf693('0x3b')]);_0x33c6f7['filters']=_['intersection'](_0x33c6f7[_0xf693('0x3a')],_0x33c6f7[_0xf693('0x3b')]);_0x49dcae[_0xf693('0x3f')]=_[_0xf693('0x3e')](_0x33c6f7[_0xf693('0x3a')],qs[_0xf693('0x40')](_0x1deda4[_0xf693('0x3b')][_0xf693('0x40')]));_0x49dcae['attributes']=_0x49dcae['attributes']['length']?_0x49dcae[_0xf693('0x3f')]:_0x33c6f7[_0xf693('0x3a')];_0x49dcae[_0xf693('0x63')]=qs[_0xf693('0x45')](_0x1deda4[_0xf693('0x3b')]['sort']);_0x49dcae[_0xf693('0x46')]=qs[_0xf693('0x3d')](_[_0xf693('0x47')](_0x1deda4[_0xf693('0x3b')],_0x33c6f7[_0xf693('0x3d')]));if(_0x1deda4['query'][_0xf693('0x2c')]){_0x49dcae[_0xf693('0x46')]=_[_0xf693('0x48')](_0x49dcae[_0xf693('0x46')],{'$or':_[_0xf693('0x2e')](_0x49dcae['attributes'],function(_0x2c214e){var _0x124c4e={};_0x124c4e[_0x2c214e]={'$like':'%'+_0x1deda4[_0xf693('0x3b')][_0xf693('0x2c')]+'%'};return _0x124c4e;})});}_0x49dcae=_['merge']({},_0x49dcae,_0x1deda4[_0xf693('0x4c')]);return _0x9db3dc['getLists'](_0x49dcae);}})[_0xf693('0x25')](function(_0x2f485b){if(_0x2f485b){_0x3276d4=_0x2f485b[_0xf693('0x41')];if(!_0x1deda4[_0xf693('0x3b')][_0xf693('0x42')](_0xf693('0x43'))){_0x49dcae[_0xf693('0x44')]=qs[_0xf693('0x44')](_0x1deda4['query']['limit']);_0x49dcae[_0xf693('0x1f')]=qs['offset'](_0x1deda4['query'][_0xf693('0x1f')]);}return _0x9db3dc[_0xf693('0x96')](_0x49dcae);}})[_0xf693('0x25')](function(_0x2e7c20){if(_0x2e7c20){return _0x2e7c20?{'count':_0x3276d4,'rows':_0x2e7c20}:null;}})[_0xf693('0x25')](respondWithResult(_0x2517d1,null))['catch'](handleError(_0x2517d1,null));};exports['addLists']=function(_0x38e23c,_0x139a20,_0x303470){var _0x560c9b,_0x28f0a7;return db[_0xf693('0x37')][_0xf693('0x32')]({'where':{'id':_0x38e23c[_0xf693('0x56')]['id']}})[_0xf693('0x25')](handleEntityNotFound(_0x139a20,null))['then'](function(_0x14fb07){if(_0x14fb07){_0x28f0a7=_0x14fb07;return _0x14fb07['addLists'](_0x38e23c[_0xf693('0x4e')][_0xf693('0x7a')],_[_0xf693('0x57')](_0x38e23c['body'],[_0xf693('0x7a'),'id'])||{});}return null;})[_0xf693('0x8d')](function(_0x11c009){var _0x4e1160;_0x560c9b=_0x11c009||[];var _0x3298cb=[];if(_0x11c009){for(var _0x8b1cd1=0x0;_0x8b1cd1<_0x11c009[_0xf693('0x41')];_0x8b1cd1+=0x1){var _0x4ffb55=_0x11c009[_0x8b1cd1]['get']({'plain':!![]});_0x28f0a7['dialCheckDuplicateType']=_0x38e23c['body'][_0xf693('0x98')]?_0x38e23c['body'][_0xf693('0x98')]:_0x28f0a7['dialCheckDuplicateType'];switch(_0x28f0a7[_0xf693('0x98')]){case _0xf693('0x99'):_0x4e1160=squel[_0xf693('0x9a')]()[_0xf693('0x9b')]('cm_hopper')[_0xf693('0x9c')]([_0xf693('0x9d'),'scheduledAt',_0xf693('0x9e'),_0xf693('0x9f'),_0xf693('0x5d'),_0xf693('0x58'),'updatedAt'],squel[_0xf693('0xa0')]()[_0xf693('0xa1')](_0xf693('0x9d'),_0xf693('0x9d'))['field'](_0xf693('0xa2'),_0xf693('0xa3'))['field']('id',_0xf693('0x9e'))[_0xf693('0xa1')](_0x4ffb55['CmListId'][_0xf693('0x82')](),_0xf693('0x9f'))['field'](_0x38e23c[_0xf693('0x56')]['id'][_0xf693('0x82')](),'VoiceQueueId')[_0xf693('0xa1')](_0xf693('0xa2'),_0xf693('0x58'))['field'](_0xf693('0xa2'),'updatedAt')['from'](_0xf693('0xa4'))[_0xf693('0x46')](_0xf693('0xa5'))[_0xf693('0x46')](_0xf693('0xa6'),_0x4ffb55[_0xf693('0xa7')][_0xf693('0x82')]())[_0xf693('0x46')](_0xf693('0xa8'))[_0xf693('0x46')](_0xf693('0xa9'),squel[_0xf693('0xa0')]()['field']('COALESCE(calleridnum,\x27\x27)')[_0xf693('0x7b')](_0xf693('0xaa'))[_0xf693('0x46')](_0xf693('0xab'),_0x38e23c['params']['id'][_0xf693('0x82')]()))[_0xf693('0x46')]('phone\x20NOT\x20IN\x20(?)',squel[_0xf693('0xa0')]()[_0xf693('0xa1')]('COALESCE(phone,\x27\x27)')[_0xf693('0x7b')](_0xf693('0xac'))[_0xf693('0x46')](_0xf693('0xab'),_0x38e23c[_0xf693('0x56')]['id'][_0xf693('0x82')]())))['toString']();break;case _0xf693('0xad'):_0x4e1160=squel[_0xf693('0x9a')]()[_0xf693('0x9b')](_0xf693('0xac'))[_0xf693('0x9c')]([_0xf693('0x9d'),'scheduledAt',_0xf693('0x9e'),_0xf693('0x9f'),'VoiceQueueId','createdAt','updatedAt'],squel[_0xf693('0xa0')]()[_0xf693('0xa1')](_0xf693('0x9d'),'phone')[_0xf693('0xa1')](_0xf693('0xa2'),'scheduledAt')[_0xf693('0xa1')]('id',_0xf693('0x9e'))[_0xf693('0xa1')](_0x4ffb55[_0xf693('0xa7')][_0xf693('0x82')](),'ListId')[_0xf693('0xa1')](_0x38e23c[_0xf693('0x56')]['id'][_0xf693('0x82')](),_0xf693('0x5d'))['field'](_0xf693('0xa2'),'createdAt')[_0xf693('0xa1')]('NOW()','updatedAt')['from']('cm_contacts')[_0xf693('0x46')](_0xf693('0xa5'))[_0xf693('0x46')](_0xf693('0xa6'),_0x4ffb55['CmListId'][_0xf693('0x82')]())[_0xf693('0x46')](_0xf693('0xa8'))[_0xf693('0x46')](_0xf693('0xa9'),squel['select']()[_0xf693('0xa1')](_0xf693('0xae'))[_0xf693('0x7b')](_0xf693('0xac'))[_0xf693('0x46')](_0xf693('0xab'),_0x38e23c['params']['id'][_0xf693('0x82')]())))[_0xf693('0x82')]();break;default:_0x4e1160=squel[_0xf693('0x9a')]()['into'](_0xf693('0xac'))['fromQuery']([_0xf693('0x9d'),_0xf693('0xa3'),_0xf693('0x9e'),_0xf693('0x9f'),_0xf693('0x5d'),'createdAt',_0xf693('0x59')],squel[_0xf693('0xa0')]()[_0xf693('0xa1')]('phone',_0xf693('0x9d'))[_0xf693('0xa1')](_0xf693('0xa2'),_0xf693('0xa3'))['field']('id',_0xf693('0x9e'))[_0xf693('0xa1')](_0x4ffb55[_0xf693('0xa7')]['toString'](),_0xf693('0x9f'))['field'](_0x38e23c['params']['id'][_0xf693('0x82')](),_0xf693('0x5d'))[_0xf693('0xa1')](_0xf693('0xa2'),_0xf693('0x58'))[_0xf693('0xa1')]('NOW()',_0xf693('0x59'))['from']('cm_contacts')[_0xf693('0x46')](_0xf693('0xa5'))[_0xf693('0x46')]('ListId\x20=\x20?',_0x4ffb55[_0xf693('0xa7')][_0xf693('0x82')]())[_0xf693('0x46')]('phone\x20IS\x20NOT\x20NULL'))[_0xf693('0x82')]();}_0x3298cb['push'](db[_0xf693('0x71')][_0xf693('0x3b')](_0x4e1160));}return BPromise[_0xf693('0x86')](_0x3298cb);}})[_0xf693('0x25')](function(){return _0x560c9b;})[_0xf693('0x25')](respondWithResult(_0x139a20,null))[_0xf693('0x4a')](handleError(_0x139a20,null));};exports[_0xf693('0xaf')]=function(_0x120887,_0x170f31,_0x277aab){return db[_0xf693('0x37')][_0xf693('0x32')]({'where':{'id':_0x120887[_0xf693('0x56')]['id']}})[_0xf693('0x25')](handleEntityNotFound(_0x170f31,null))[_0xf693('0x25')](function(_0x298bf6){if(_0x298bf6){return _0x298bf6[_0xf693('0xaf')](_0x120887['query'][_0xf693('0x7a')]);}})['then'](function(_0x5374ab){if(_0x5374ab){return db[_0xf693('0x5c')][_0xf693('0x26')]({'where':{'ListId':_0x120887[_0xf693('0x3b')][_0xf693('0x7a')],'VoiceQueueId':_0x120887['params']['id']}})[_0xf693('0x25')](function(){return _0x5374ab;});}})[_0xf693('0x25')](respondWithStatusCode(_0x170f31,null))[_0xf693('0x4a')](handleError(_0x170f31,null));};exports[_0xf693('0xb0')]=function(_0x5a60af,_0xe0d9b,_0x3fc36d){var _0x3717da={};var _0x9f4d35={};var _0x404909;var _0x3e78b0;return db[_0xf693('0x37')]['findOne']({'where':{'id':_0x5a60af[_0xf693('0x56')]['id']}})['then'](handleEntityNotFound(_0xe0d9b,null))[_0xf693('0x25')](function(_0x2fda49){if(_0x2fda49){_0x404909=_0x2fda49;_0x9f4d35[_0xf693('0x3a')]=_['keys'](db[_0xf693('0x97')][_0xf693('0x38')]);_0x9f4d35[_0xf693('0x3b')]=_['keys'](_0x5a60af['query']);_0x9f4d35[_0xf693('0x3d')]=_['intersection'](_0x9f4d35[_0xf693('0x3a')],_0x9f4d35[_0xf693('0x3b')]);_0x3717da[_0xf693('0x3f')]=_[_0xf693('0x3e')](_0x9f4d35[_0xf693('0x3a')],qs[_0xf693('0x40')](_0x5a60af[_0xf693('0x3b')][_0xf693('0x40')]));_0x3717da['attributes']=_0x3717da[_0xf693('0x3f')]['length']?_0x3717da[_0xf693('0x3f')]:_0x9f4d35[_0xf693('0x3a')];_0x3717da['order']=qs[_0xf693('0x45')](_0x5a60af[_0xf693('0x3b')][_0xf693('0x45')]);_0x3717da['where']=qs[_0xf693('0x3d')](_[_0xf693('0x47')](_0x5a60af[_0xf693('0x3b')],_0x9f4d35[_0xf693('0x3d')]));if(_0x5a60af[_0xf693('0x3b')]['filter']){_0x3717da[_0xf693('0x46')]=_['merge'](_0x3717da['where'],{'$or':_[_0xf693('0x2e')](_0x3717da[_0xf693('0x3f')],function(_0x5235c0){var _0x55d4b4={};_0x55d4b4[_0x5235c0]={'$like':'%'+_0x5a60af[_0xf693('0x3b')]['filter']+'%'};return _0x55d4b4;})});}_0x3717da=_[_0xf693('0x48')]({},_0x3717da,_0x5a60af[_0xf693('0x4c')]);return _0x404909[_0xf693('0xb0')](_0x3717da);}})['then'](function(_0x55a511){if(_0x55a511){_0x3e78b0=_0x55a511[_0xf693('0x41')];if(!_0x5a60af[_0xf693('0x3b')][_0xf693('0x42')](_0xf693('0x43'))){_0x3717da[_0xf693('0x44')]=qs[_0xf693('0x44')](_0x5a60af[_0xf693('0x3b')]['limit']);_0x3717da['offset']=qs[_0xf693('0x1f')](_0x5a60af[_0xf693('0x3b')][_0xf693('0x1f')]);}return _0x404909[_0xf693('0xb0')](_0x3717da);}})[_0xf693('0x25')](function(_0x33d193){if(_0x33d193){return _0x33d193?{'count':_0x3e78b0,'rows':_0x33d193}:null;}})[_0xf693('0x25')](respondWithResult(_0xe0d9b,null))[_0xf693('0x4a')](handleError(_0xe0d9b,null));};exports['addBlackLists']=function(_0x3d4e42,_0x10ae59,_0x1134c7){var _0x31075b,_0x3a9661;return db[_0xf693('0x37')]['find']({'where':{'id':_0x3d4e42[_0xf693('0x56')]['id']}})[_0xf693('0x25')](handleEntityNotFound(_0x10ae59,null))[_0xf693('0x25')](function(_0x4bd28e){if(_0x4bd28e){_0x3a9661=_0x4bd28e;return _0x4bd28e[_0xf693('0xb1')](_0x3d4e42[_0xf693('0x4e')][_0xf693('0x7a')],_[_0xf693('0x57')](_0x3d4e42[_0xf693('0x4e')],[_0xf693('0x7a'),'id'])||{});}return null;})[_0xf693('0x8d')](function(_0x158e65){var _0x5eff9e;_0x31075b=_0x158e65||[];var _0x5be5e0=[];if(_0x158e65){for(var _0x5ad3a0=0x0;_0x5ad3a0<_0x158e65[_0xf693('0x41')];_0x5ad3a0+=0x1){var _0x2f887d=_0x158e65[_0x5ad3a0][_0xf693('0x27')]({'plain':!![]});_0x5eff9e=squel['insert']()['into'](_0xf693('0xb2'))[_0xf693('0x9c')]([_0xf693('0x9d'),_0xf693('0x9e'),_0xf693('0x9f'),_0xf693('0x5d'),'createdAt',_0xf693('0x59')],squel['select']()[_0xf693('0xa1')](_0xf693('0x9d'),'phone')[_0xf693('0xa1')]('id','ContactId')[_0xf693('0xa1')](_0x2f887d[_0xf693('0xa7')][_0xf693('0x82')](),'ListId')[_0xf693('0xa1')](_0x3d4e42[_0xf693('0x56')]['id'][_0xf693('0x82')](),'VoiceQueueId')[_0xf693('0xa1')](_0xf693('0xa2'),'createdAt')[_0xf693('0xa1')](_0xf693('0xa2'),'updatedAt')[_0xf693('0x7b')]('cm_contacts')[_0xf693('0x46')](_0xf693('0xa5'))['where']('ListId\x20=\x20?',_0x2f887d['CmListId'][_0xf693('0x82')]())['where'](_0xf693('0xa8')))[_0xf693('0x82')]();_0x5be5e0[_0xf693('0x81')](db[_0xf693('0x71')][_0xf693('0x3b')](_0x5eff9e));}return BPromise['all'](_0x5be5e0);}})[_0xf693('0x25')](function(){return _0x31075b;})[_0xf693('0x25')](respondWithResult(_0x10ae59,null))[_0xf693('0x4a')](handleError(_0x10ae59,null));};exports[_0xf693('0xb3')]=function(_0x449fdb,_0x4c7633,_0x31883e){return db[_0xf693('0x37')][_0xf693('0x32')]({'where':{'id':_0x449fdb[_0xf693('0x56')]['id']}})['then'](handleEntityNotFound(_0x4c7633,null))[_0xf693('0x25')](function(_0x1e4fa0){if(_0x1e4fa0){return _0x1e4fa0[_0xf693('0xb3')](_0x449fdb[_0xf693('0x3b')]['ids']);}})['then'](function(_0x4137d5){if(_0x4137d5){return db[_0xf693('0x66')]['destroy']({'where':{'ListId':_0x449fdb['query']['ids'],'VoiceQueueId':_0x449fdb['params']['id']}})[_0xf693('0x25')](function(){return _0x4137d5;});}})[_0xf693('0x25')](respondWithStatusCode(_0x4c7633,null))['catch'](handleError(_0x4c7633,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 48c31b8..1e27136 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 _0x30e6=['emit','hasOwnProperty','hook','exports','events','VoiceQueue','setMaxListeners','save','update','remove'];(function(_0xdfbf6e,_0x4edfb5){var _0x2e6c37=function(_0xd49d33){while(--_0xd49d33){_0xdfbf6e['push'](_0xdfbf6e['shift']());}};_0x2e6c37(++_0x4edfb5);}(_0x30e6,0x1d0));var _0x630e=function(_0x557d29,_0x488d94){_0x557d29=_0x557d29-0x0;var _0x19d714=_0x30e6[_0x557d29];return _0x19d714;};'use strict';var EventEmitter=require(_0x630e('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x630e('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x630e('0x2')](0x0);var events={'afterCreate':_0x630e('0x3'),'afterUpdate':_0x630e('0x4'),'afterDestroy':_0x630e('0x5')};function emitEvent(_0x32e08c){return function(_0x5558a1,_0x44511c,_0x14a341){VoiceQueueEvents[_0x630e('0x6')](_0x32e08c+':'+_0x5558a1['id'],_0x5558a1);VoiceQueueEvents['emit'](_0x32e08c,_0x5558a1);_0x14a341(null);};}for(var e in events){if(events[_0x630e('0x7')](e)){var event=events[e];VoiceQueue[_0x630e('0x8')](e,emitEvent(event));}}module[_0x630e('0x9')]=VoiceQueueEvents; \ No newline at end of file +var _0x6bc4=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x1f64b6,_0x47e7e0){var _0x5f441e=function(_0x20ee44){while(--_0x20ee44){_0x1f64b6['push'](_0x1f64b6['shift']());}};_0x5f441e(++_0x47e7e0);}(_0x6bc4,0x164));var _0x46bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6bc4[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x46bc('0x0'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x46bc('0x1')](0x0);var events={'afterCreate':_0x46bc('0x2'),'afterUpdate':_0x46bc('0x3'),'afterDestroy':_0x46bc('0x4')};function emitEvent(_0x1a5ab9){return function(_0x1f386d,_0x52d660,_0x3c3e4e){VoiceQueueEvents[_0x46bc('0x5')](_0x1a5ab9+':'+_0x1f386d['id'],_0x1f386d);VoiceQueueEvents['emit'](_0x1a5ab9,_0x1f386d);_0x3c3e4e(null);};}for(var e in events){if(events[_0x46bc('0x6')](e)){var event=events[e];VoiceQueue[_0x46bc('0x7')](e,emitEvent(event));}}module[_0x46bc('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 bf58bf3..28b6a53 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 _0x0886=['VoiceQueue','voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceQueue.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0886,0xaa));var _0x6088=function(_0x1918e9,_0x811533){_0x1918e9=_0x1918e9-0x0;var _0x176e45=_0x0886[_0x1918e9];return _0x176e45;};'use strict';var _=require(_0x6088('0x0'));var util=require(_0x6088('0x1'));var logger=require(_0x6088('0x2'))(_0x6088('0x3'));var moment=require(_0x6088('0x4'));var BPromise=require(_0x6088('0x5'));var rp=require(_0x6088('0x6'));var fs=require('fs');var path=require(_0x6088('0x7'));var rimraf=require('rimraf');var config=require(_0x6088('0x8'));var attributes=require(_0x6088('0x9'));module[_0x6088('0xa')]=function(_0x23803b,_0x98cdbd){return _0x23803b[_0x6088('0xb')](_0x6088('0xc'),attributes,{'tableName':_0x6088('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c57=['define','VoiceQueue','voice_queues','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x6c57,0x1b3));var _0x76c5=function(_0x51fe5f,_0x1d8632){_0x51fe5f=_0x51fe5f-0x0;var _0x4abce9=_0x6c57[_0x51fe5f];return _0x4abce9;};'use strict';var _=require('lodash');var util=require(_0x76c5('0x0'));var logger=require(_0x76c5('0x1'))('api');var moment=require(_0x76c5('0x2'));var BPromise=require(_0x76c5('0x3'));var rp=require(_0x76c5('0x4'));var fs=require('fs');var path=require(_0x76c5('0x5'));var rimraf=require(_0x76c5('0x6'));var config=require(_0x76c5('0x7'));var attributes=require('./voiceQueue.attributes');module[_0x76c5('0x8')]=function(_0x2b58e2,_0xdddebf){return _0x2b58e2[_0x76c5('0x9')](_0x76c5('0xa'),attributes,{'tableName':_0x76c5('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 a56320e..fc25724 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 _0x934e=['./voiceQueue.socket','request','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','findAll','options','raw','attributes','map','include','model','then','info','GetVoiceQueue','stringify','ShowVoiceQueue','find','where','moment','bluebird','../../mysqldb','../../config/logger','rpc','http','redis','defaults','localhost'];(function(_0x20342d,_0x250d97){var _0x562fdc=function(_0x3d9f4c){while(--_0x3d9f4c){_0x20342d['push'](_0x20342d['shift']());}};_0x562fdc(++_0x250d97);}(_0x934e,0x7f));var _0xe934=function(_0x194933,_0x3177ae){_0x194933=_0x194933-0x0;var _0x367462=_0x934e[_0x194933];return _0x367462;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe934('0x0'));var BPromise=require(_0xe934('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe934('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xe934('0x3'))(_0xe934('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xe934('0x5')]({'port':0x232a});config[_0xe934('0x6')]=_[_0xe934('0x7')](config[_0xe934('0x6')],{'host':_0xe934('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe934('0x6')]));require(_0xe934('0x9'))['register'](socket);function respondWithRpcPromise(_0x267fe4,_0xef774a,_0x4a4e93){return new BPromise(function(_0x1a70c7,_0x4efcdd){return client[_0xe934('0xa')](_0x267fe4,_0x4a4e93)['then'](function(_0x29412e){logger['info'](_0xe934('0xb'),_0xef774a,_0xe934('0xc'));logger[_0xe934('0xd')](_0xe934('0xe'),_0xef774a,_0xe934('0xc'),JSON['stringify'](_0x29412e));if(_0x29412e['error']){if(_0x29412e[_0xe934('0xf')][_0xe934('0x10')]===0x1f4){logger[_0xe934('0xf')]('VoiceQueue,\x20%s,\x20%s',_0xef774a,_0x29412e[_0xe934('0xf')]['message']);return _0x4efcdd(_0x29412e[_0xe934('0xf')][_0xe934('0x11')]);}logger['error']('VoiceQueue,\x20%s,\x20%s',_0xef774a,_0x29412e[_0xe934('0xf')][_0xe934('0x11')]);return _0x1a70c7(_0x29412e[_0xe934('0xf')][_0xe934('0x11')]);}else{logger['info']('VoiceQueue,\x20%s,\x20%s',_0xef774a,_0xe934('0xc'));_0x1a70c7(_0x29412e[_0xe934('0x12')][_0xe934('0x11')]);}})[_0xe934('0x13')](function(_0x2671c8){logger[_0xe934('0xf')](_0xe934('0xb'),_0xef774a,_0x2671c8);_0x4efcdd(_0x2671c8);});});}exports['GetVoiceQueue']=function(_0x2dfa9c){var _0x50b797=this;return new Promise(function(_0x4da631,_0x58a804){return db['VoiceQueue'][_0xe934('0x14')]({'raw':_0x2dfa9c[_0xe934('0x15')]?_0x2dfa9c[_0xe934('0x15')][_0xe934('0x16')]===undefined?!![]:![]:!![],'where':_0x2dfa9c[_0xe934('0x15')]?_0x2dfa9c[_0xe934('0x15')]['where']||null:null,'attributes':_0x2dfa9c[_0xe934('0x15')]?_0x2dfa9c[_0xe934('0x15')][_0xe934('0x17')]||null:null,'limit':_0x2dfa9c[_0xe934('0x15')]?_0x2dfa9c[_0xe934('0x15')]['limit']||null:null,'include':_0x2dfa9c[_0xe934('0x15')]?_0x2dfa9c[_0xe934('0x15')]['include']?_[_0xe934('0x18')](_0x2dfa9c[_0xe934('0x15')]['include'],function(_0x2745b4){return{'model':db[_0x2745b4['model']],'as':_0x2745b4['as'],'attributes':_0x2745b4[_0xe934('0x17')],'include':_0x2745b4['include']?_[_0xe934('0x18')](_0x2745b4[_0xe934('0x19')],function(_0x43222b){return{'model':db[_0x43222b[_0xe934('0x1a')]],'as':_0x43222b['as'],'attributes':_0x43222b[_0xe934('0x17')],'include':_0x43222b[_0xe934('0x19')]?_[_0xe934('0x18')](_0x43222b['include'],function(_0x577b57){return{'model':db[_0x577b57['model']],'as':_0x577b57['as'],'attributes':_0x577b57[_0xe934('0x17')]};}):[]};}):[]};}):[]:[]})[_0xe934('0x1b')](function(_0x52fd58){logger[_0xe934('0x1c')](_0xe934('0x1d'),_0x2dfa9c);logger['debug'](_0xe934('0x1d'),_0x2dfa9c,JSON[_0xe934('0x1e')](_0x52fd58));_0x4da631(_0x52fd58);})['catch'](function(_0x279543){logger['error'](_0xe934('0x1d'),_0x279543[_0xe934('0x11')],_0x2dfa9c);_0x58a804(_0x50b797[_0xe934('0xf')](0x1f4,_0x279543['message']));});});};exports[_0xe934('0x1f')]=function(_0x18edcc){var _0x403bdf=this;return new Promise(function(_0x17b7be,_0x1e9eb7){return db['VoiceQueue'][_0xe934('0x20')]({'raw':_0x18edcc['options']?_0x18edcc[_0xe934('0x15')][_0xe934('0x16')]===undefined?!![]:![]:!![],'where':_0x18edcc['options']?_0x18edcc[_0xe934('0x15')][_0xe934('0x21')]||null:null,'attributes':_0x18edcc[_0xe934('0x15')]?_0x18edcc[_0xe934('0x15')]['attributes']||null:null,'include':_0x18edcc[_0xe934('0x15')]?_0x18edcc[_0xe934('0x15')][_0xe934('0x19')]?_['map'](_0x18edcc[_0xe934('0x15')]['include'],function(_0x2b07c4){return{'model':db[_0x2b07c4[_0xe934('0x1a')]],'as':_0x2b07c4['as'],'attributes':_0x2b07c4[_0xe934('0x17')],'include':_0x2b07c4['include']?_[_0xe934('0x18')](_0x2b07c4[_0xe934('0x19')],function(_0x4c1758){return{'model':db[_0x4c1758['model']],'as':_0x4c1758['as'],'attributes':_0x4c1758[_0xe934('0x17')],'include':_0x4c1758[_0xe934('0x19')]?_[_0xe934('0x18')](_0x4c1758[_0xe934('0x19')],function(_0x1447b5){return{'model':db[_0x1447b5[_0xe934('0x1a')]],'as':_0x1447b5['as'],'attributes':_0x1447b5[_0xe934('0x17')]};}):[]};}):[]};}):[]:[]})[_0xe934('0x1b')](function(_0x2a707e){logger['info'](_0xe934('0x1f'),_0x18edcc);logger[_0xe934('0xd')]('ShowVoiceQueue',_0x18edcc,JSON[_0xe934('0x1e')](_0x2a707e));_0x17b7be(_0x2a707e);})[_0xe934('0x13')](function(_0x26da5a){logger[_0xe934('0xf')](_0xe934('0x1f'),_0x26da5a['message'],_0x18edcc);_0x1e9eb7(_0x403bdf['error'](0x1f4,_0x26da5a['message']));});});}; \ No newline at end of file +var _0x73e6=['map','model','debug','ShowVoiceQueue','VoiceQueue','stringify','lodash','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetVoiceQueue','findAll','options','raw','where','attributes','limit','include'];(function(_0x47a242,_0x4be1e0){var _0x27d00c=function(_0x38e7de){while(--_0x38e7de){_0x47a242['push'](_0x47a242['shift']());}};_0x27d00c(++_0x4be1e0);}(_0x73e6,0xce));var _0x673e=function(_0x1d2c65,_0x236bb9){_0x1d2c65=_0x1d2c65-0x0;var _0x1270a1=_0x73e6[_0x1d2c65];return _0x1270a1;};'use strict';var _=require(_0x673e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x673e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x673e('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x673e('0x3'));var logger=require(_0x673e('0x4'))(_0x673e('0x5'));var config=require(_0x673e('0x6'));var jayson=require(_0x673e('0x7'));var client=jayson[_0x673e('0x8')][_0x673e('0x9')]({'port':0x232a});config['redis']=_[_0x673e('0xa')](config[_0x673e('0xb')],{'host':_0x673e('0xc'),'port':0x18eb});var socket=require(_0x673e('0xd'))(new Redis(config[_0x673e('0xb')]));require(_0x673e('0xe'))[_0x673e('0xf')](socket);function respondWithRpcPromise(_0x274985,_0x4c0e48,_0x1399cb){return new BPromise(function(_0x59852f,_0x4227ac){return client[_0x673e('0x10')](_0x274985,_0x1399cb)[_0x673e('0x11')](function(_0x2f9bfe){logger[_0x673e('0x12')](_0x673e('0x13'),_0x4c0e48,_0x673e('0x14'));logger['debug']('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x4c0e48,_0x673e('0x14'),JSON['stringify'](_0x2f9bfe));if(_0x2f9bfe[_0x673e('0x15')]){if(_0x2f9bfe[_0x673e('0x15')][_0x673e('0x16')]===0x1f4){logger['error'](_0x673e('0x13'),_0x4c0e48,_0x2f9bfe[_0x673e('0x15')]['message']);return _0x4227ac(_0x2f9bfe[_0x673e('0x15')][_0x673e('0x17')]);}logger[_0x673e('0x15')](_0x673e('0x13'),_0x4c0e48,_0x2f9bfe[_0x673e('0x15')][_0x673e('0x17')]);return _0x59852f(_0x2f9bfe['error'][_0x673e('0x17')]);}else{logger[_0x673e('0x12')](_0x673e('0x13'),_0x4c0e48,_0x673e('0x14'));_0x59852f(_0x2f9bfe[_0x673e('0x18')][_0x673e('0x17')]);}})[_0x673e('0x19')](function(_0x2d088f){logger[_0x673e('0x15')](_0x673e('0x13'),_0x4c0e48,_0x2d088f);_0x4227ac(_0x2d088f);});});}exports[_0x673e('0x1a')]=function(_0x2eb41a){var _0x4a94d2=this;return new Promise(function(_0x5951aa,_0x4ccbe4){return db['VoiceQueue'][_0x673e('0x1b')]({'raw':_0x2eb41a[_0x673e('0x1c')]?_0x2eb41a['options'][_0x673e('0x1d')]===undefined?!![]:![]:!![],'where':_0x2eb41a['options']?_0x2eb41a[_0x673e('0x1c')][_0x673e('0x1e')]||null:null,'attributes':_0x2eb41a['options']?_0x2eb41a[_0x673e('0x1c')][_0x673e('0x1f')]||null:null,'limit':_0x2eb41a['options']?_0x2eb41a['options'][_0x673e('0x20')]||null:null,'include':_0x2eb41a['options']?_0x2eb41a[_0x673e('0x1c')][_0x673e('0x21')]?_[_0x673e('0x22')](_0x2eb41a[_0x673e('0x1c')][_0x673e('0x21')],function(_0x3c69fb){return{'model':db[_0x3c69fb[_0x673e('0x23')]],'as':_0x3c69fb['as'],'attributes':_0x3c69fb['attributes'],'include':_0x3c69fb[_0x673e('0x21')]?_[_0x673e('0x22')](_0x3c69fb['include'],function(_0x1e0acb){return{'model':db[_0x1e0acb[_0x673e('0x23')]],'as':_0x1e0acb['as'],'attributes':_0x1e0acb['attributes'],'include':_0x1e0acb[_0x673e('0x21')]?_[_0x673e('0x22')](_0x1e0acb[_0x673e('0x21')],function(_0x29f42d){return{'model':db[_0x29f42d[_0x673e('0x23')]],'as':_0x29f42d['as'],'attributes':_0x29f42d[_0x673e('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x673e('0x11')](function(_0x5d1b79){logger[_0x673e('0x12')](_0x673e('0x1a'),_0x2eb41a);logger[_0x673e('0x24')](_0x673e('0x1a'),_0x2eb41a,JSON['stringify'](_0x5d1b79));_0x5951aa(_0x5d1b79);})[_0x673e('0x19')](function(_0x444dee){logger[_0x673e('0x15')](_0x673e('0x1a'),_0x444dee[_0x673e('0x17')],_0x2eb41a);_0x4ccbe4(_0x4a94d2['error'](0x1f4,_0x444dee[_0x673e('0x17')]));});});};exports[_0x673e('0x25')]=function(_0x2ae873){var _0x49e3f8=this;return new Promise(function(_0x49200c,_0x19b3ac){return db[_0x673e('0x26')]['find']({'raw':_0x2ae873['options']?_0x2ae873[_0x673e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x2ae873[_0x673e('0x1c')]?_0x2ae873[_0x673e('0x1c')][_0x673e('0x1e')]||null:null,'attributes':_0x2ae873[_0x673e('0x1c')]?_0x2ae873[_0x673e('0x1c')][_0x673e('0x1f')]||null:null,'include':_0x2ae873['options']?_0x2ae873[_0x673e('0x1c')][_0x673e('0x21')]?_['map'](_0x2ae873[_0x673e('0x1c')][_0x673e('0x21')],function(_0x58a888){return{'model':db[_0x58a888[_0x673e('0x23')]],'as':_0x58a888['as'],'attributes':_0x58a888['attributes'],'include':_0x58a888['include']?_['map'](_0x58a888[_0x673e('0x21')],function(_0x44e30a){return{'model':db[_0x44e30a['model']],'as':_0x44e30a['as'],'attributes':_0x44e30a['attributes'],'include':_0x44e30a[_0x673e('0x21')]?_[_0x673e('0x22')](_0x44e30a[_0x673e('0x21')],function(_0x115056){return{'model':db[_0x115056[_0x673e('0x23')]],'as':_0x115056['as'],'attributes':_0x115056['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x46c379){logger[_0x673e('0x12')](_0x673e('0x25'),_0x2ae873);logger[_0x673e('0x24')](_0x673e('0x25'),_0x2ae873,JSON[_0x673e('0x27')](_0x46c379));_0x49200c(_0x46c379);})[_0x673e('0x19')](function(_0x566cdc){logger[_0x673e('0x15')](_0x673e('0x25'),_0x566cdc[_0x673e('0x17')],_0x2ae873);_0x19b3ac(_0x49e3f8[_0x673e('0x15')](0x1f4,_0x566cdc[_0x673e('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 0d3288e..906927c 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 _0x21c1=['voiceQueue:','remove','update','emit','removeListener','register','length'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x21c1,0xef));var _0x121c=function(_0x22447c,_0x3a9a46){_0x22447c=_0x22447c-0x0;var _0x537dc4=_0x21c1[_0x22447c];return _0x537dc4;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=['save',_0x121c('0x0'),_0x121c('0x1')];function createListener(_0x454647,_0x193241){return function(_0x46b3c4){_0x193241[_0x121c('0x2')](_0x454647,_0x46b3c4);};}function removeListener(_0x56bcff,_0x261a9d){return function(){VoiceQueueEvents[_0x121c('0x3')](_0x56bcff,_0x261a9d);};}exports[_0x121c('0x4')]=function(_0x11e1dd){for(var _0x45e905=0x0,_0x4d0928=events[_0x121c('0x5')];_0x45e905<_0x4d0928;_0x45e905++){var _0x492a00=events[_0x45e905];var _0x2ad84a=createListener(_0x121c('0x6')+_0x492a00,_0x11e1dd);VoiceQueueEvents['on'](_0x492a00,_0x2ad84a);}}; \ No newline at end of file +var _0x24e4=['remove','update','removeListener','register','length','voiceQueue:','./voiceQueue.events','save'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x24e4,0x10e));var _0x424e=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0x24e4[_0x4dc7b9];return _0x3ab114;};'use strict';var VoiceQueueEvents=require(_0x424e('0x0'));var events=[_0x424e('0x1'),_0x424e('0x2'),_0x424e('0x3')];function createListener(_0x264a8b,_0x2d17a9){return function(_0x2fe1db){_0x2d17a9['emit'](_0x264a8b,_0x2fe1db);};}function removeListener(_0x3e2598,_0x26a982){return function(){VoiceQueueEvents[_0x424e('0x4')](_0x3e2598,_0x26a982);};}exports[_0x424e('0x5')]=function(_0x267f56){for(var _0x2ae6d0=0x0,_0x1ce650=events[_0x424e('0x6')];_0x2ae6d0<_0x1ce650;_0x2ae6d0++){var _0x261964=events[_0x2ae6d0];var _0x53d6a4=createListener(_0x424e('0x7')+_0x261964,_0x267f56);VoiceQueueEvents['on'](_0x261964,_0x53d6a4);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 4db9279..74bd8b3 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 _0xdfa0=['show','create','put','update','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller','isAuthenticated','index','/describe','describe','get','/index','getVoiceQueuesReport','/:id'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xdfa0,0x69));var _0x0dfa=function(_0x4bdef5,_0x5f48a8){_0x4bdef5=_0x4bdef5-0x0;var _0x13d12b=_0xdfa0[_0x4bdef5];return _0x13d12b;};'use strict';var multer=require(_0x0dfa('0x0'));var util=require('util');var path=require(_0x0dfa('0x1'));var timeout=require(_0x0dfa('0x2'));var express=require('express');var router=express[_0x0dfa('0x3')]();var auth=require(_0x0dfa('0x4'));var interaction=require(_0x0dfa('0x5'));var config=require('../../config/environment');var controller=require(_0x0dfa('0x6'));router['get']('/',auth[_0x0dfa('0x7')](),controller[_0x0dfa('0x8')]);router['get'](_0x0dfa('0x9'),auth[_0x0dfa('0x7')](),controller[_0x0dfa('0xa')]);router[_0x0dfa('0xb')](_0x0dfa('0xc'),auth['isAuthenticated'](),controller[_0x0dfa('0xd')]);router[_0x0dfa('0xb')](_0x0dfa('0xe'),auth['isAuthenticated'](),controller[_0x0dfa('0xf')]);router['post']('/',auth[_0x0dfa('0x7')](),controller[_0x0dfa('0x10')]);router[_0x0dfa('0x11')]('/:id',auth[_0x0dfa('0x7')](),controller[_0x0dfa('0x12')]);router['delete'](_0x0dfa('0xe'),auth[_0x0dfa('0x7')](),controller['destroy']);module[_0x0dfa('0x13')]=router; \ No newline at end of file +var _0x7278=['../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7278,0x161));var _0x8727=function(_0x33fa8b,_0x29d414){_0x33fa8b=_0x33fa8b-0x0;var _0x54937d=_0x7278[_0x33fa8b];return _0x54937d;};'use strict';var multer=require(_0x8727('0x0'));var util=require(_0x8727('0x1'));var path=require(_0x8727('0x2'));var timeout=require(_0x8727('0x3'));var express=require(_0x8727('0x4'));var router=express['Router']();var auth=require(_0x8727('0x5'));var interaction=require(_0x8727('0x6'));var config=require(_0x8727('0x7'));var controller=require(_0x8727('0x8'));router[_0x8727('0x9')]('/',auth[_0x8727('0xa')](),controller[_0x8727('0xb')]);router['get'](_0x8727('0xc'),auth[_0x8727('0xa')](),controller[_0x8727('0xd')]);router[_0x8727('0x9')](_0x8727('0xe'),auth['isAuthenticated'](),controller['getVoiceQueuesReport']);router['get'](_0x8727('0xf'),auth[_0x8727('0xa')](),controller[_0x8727('0x10')]);router[_0x8727('0x11')]('/',auth[_0x8727('0xa')](),controller[_0x8727('0x12')]);router[_0x8727('0x13')](_0x8727('0xf'),auth['isAuthenticated'](),controller[_0x8727('0x14')]);router[_0x8727('0x15')](_0x8727('0xf'),auth['isAuthenticated'](),controller[_0x8727('0x16')]);module[_0x8727('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 5d3dc98..d9d72aa 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 _0x0442=['sequelize','moment','STRING','DATE','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x164eb1,_0x198a7d){var _0x73311=function(_0xde4d4a){while(--_0xde4d4a){_0x164eb1['push'](_0x164eb1['shift']());}};_0x73311(++_0x198a7d);}(_0x0442,0x1a0));var _0x2044=function(_0x47e7dd,_0x51b041){_0x47e7dd=_0x47e7dd-0x0;var _0x38501f=_0x0442[_0x47e7dd];return _0x38501f;};'use strict';var Sequelize=require(_0x2044('0x0'));var moment=require(_0x2044('0x1'));module['exports']={'type':{'type':Sequelize[_0x2044('0x2')]},'uniqueid':{'type':Sequelize[_0x2044('0x2')]},'calleridnum':{'type':Sequelize[_0x2044('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x2044('0x3')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x3b31fc){var _0x4d3861=moment(_0x3b31fc);var _0x2a4ed8=moment(this['getDataValue'](_0x2044('0x4')))[_0x2044('0x5')](_0x2044('0x6'));var _0x32d0b8=_0x4d3861['diff'](_0x2a4ed8,_0x2044('0x7'));this[_0x2044('0x8')]('queuecallerleaveAt',_0x3b31fc);this[_0x2044('0x8')]('holdtime',_0x32d0b8||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x2044('0x9')]},'queuecallerabandon':{'type':Sequelize[_0x2044('0xa')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x2044('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x2044('0xa')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x2044('0x3')]},'queuecallerexit':{'type':Sequelize[_0x2044('0xa')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x2044('0x2')],'comment':_0x2044('0xb')},'originalposition':{'type':Sequelize[_0x2044('0x9')]},'channel':{'type':Sequelize[_0x2044('0x2')]},'connectedlinenum':{'type':Sequelize[_0x2044('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x2044('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x2044('0x2')]},'priority':{'type':Sequelize[_0x2044('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x2044('0x9')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x2044('0x2')],'comment':_0x2044('0xc')},'transferexten':{'type':Sequelize[_0x2044('0x2')]},'transferuniqueid':{'type':Sequelize[_0x2044('0x2')]},'disposition':{'type':Sequelize[_0x2044('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x2044('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0x707c=['format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','moment','exports','STRING','DATE','getDataValue'];(function(_0x256ffc,_0x479116){var _0x3a8fee=function(_0x2c1fcc){while(--_0x2c1fcc){_0x256ffc['push'](_0x256ffc['shift']());}};_0x3a8fee(++_0x479116);}(_0x707c,0x6b));var _0xc707=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x707c[_0x46aff0];return _0x9d78cf;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc707('0x0'));module[_0xc707('0x1')]={'type':{'type':Sequelize[_0xc707('0x2')]},'uniqueid':{'type':Sequelize[_0xc707('0x2')]},'calleridnum':{'type':Sequelize[_0xc707('0x2')]},'calleridname':{'type':Sequelize[_0xc707('0x2')]},'queue':{'type':Sequelize[_0xc707('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0xc707('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0xc707('0x3')],'set':function(_0x9db1ee){var _0x58fa05=moment(_0x9db1ee);var _0x4f8a1e=moment(this[_0xc707('0x4')]('queuecallerjoinAt'))[_0xc707('0x5')](_0xc707('0x6'));var _0x45b824=_0x58fa05[_0xc707('0x7')](_0x4f8a1e,_0xc707('0x8'));this[_0xc707('0x9')](_0xc707('0xa'),_0x9db1ee);this[_0xc707('0x9')]('holdtime',_0x45b824||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0xc707('0xb')]},'queuecallerabandon':{'type':Sequelize[_0xc707('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xc707('0x3')]},'queuecallercomplete':{'type':Sequelize[_0xc707('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xc707('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xc707('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0xc707('0x2')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xc707('0x2')]},'connectedlinename':{'type':Sequelize[_0xc707('0x2')]},'accountcode':{'type':Sequelize[_0xc707('0x2')]},'context':{'type':Sequelize[_0xc707('0x2')]},'exten':{'type':Sequelize[_0xc707('0x2')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0xc707('0xb')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xc707('0x2')]},'transfer':{'type':Sequelize[_0xc707('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xc707('0x2')],'comment':_0xc707('0xd')},'transferexten':{'type':Sequelize[_0xc707('0x2')]},'transferuniqueid':{'type':Sequelize[_0xc707('0x2')]},'disposition':{'type':Sequelize[_0xc707('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0xc707('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 c321637..0deddcf 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 _0x66fa=['Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','VoiceQueueReport','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','merge','where','includeAll','include','findAll','rows','show','params','intersection','options','find','catch','create','body','getVoiceQueuesReport','pick','filter','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','defaults','redis','localhost','./voiceQueueReport.socket','sendStatus','status','end','json','count','offset','limit','set'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x66fa,0x117));var _0xa66f=function(_0xbef738,_0x1156e6){_0xbef738=_0xbef738-0x0;var _0x512fc9=_0x66fa[_0xbef738];return _0x512fc9;};'use strict';var pdf=require(_0xa66f('0x0'));var emlformat=require(_0xa66f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa66f('0x2'));var jsonpatch=require(_0xa66f('0x3'));var rp=require(_0xa66f('0x4'));var moment=require(_0xa66f('0x5'));var BPromise=require(_0xa66f('0x6'));var Mustache=require(_0xa66f('0x7'));var util=require(_0xa66f('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xa66f('0x9'));var ejs=require(_0xa66f('0xa'));var fs=require('fs');var _=require(_0xa66f('0xb'));var squel=require(_0xa66f('0xc'));var crypto=require(_0xa66f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa66f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa66f('0xf'));var Papa=require('papaparse');var Redis=require(_0xa66f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa66f('0x11'));var logger=require(_0xa66f('0x12'))('api');var utils=require(_0xa66f('0x13'));var config=require('../../config/environment');var db=require(_0xa66f('0x14'))['db'];config['redis']=_[_0xa66f('0x15')](config[_0xa66f('0x16')],{'host':_0xa66f('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa66f('0x18'))['register'](socket);function respondWithStatusCode(_0x528427,_0x5a7b16){_0x5a7b16=_0x5a7b16||0xcc;return function(_0x3ac0ac){if(_0x3ac0ac){return _0x528427[_0xa66f('0x19')](_0x5a7b16);}return _0x528427[_0xa66f('0x1a')](_0x5a7b16)[_0xa66f('0x1b')]();};}function respondWithResult(_0xd348f9,_0x567d4f){_0x567d4f=_0x567d4f||0xc8;return function(_0x5510dc){if(_0x5510dc){return _0xd348f9[_0xa66f('0x1a')](_0x567d4f)[_0xa66f('0x1c')](_0x5510dc);}};}function respondWithFilteredResult(_0x295acf,_0x403f4d){return function(_0x5c67f5){if(_0x5c67f5){var _0x1cbe64=_0x5c67f5[_0xa66f('0x1d')],_0x55b59d=_0x403f4d[_0xa66f('0x1e')],_0x4a28d4=_0x403f4d[_0xa66f('0x1e')]+_0x403f4d[_0xa66f('0x1f')],_0x2f9da2;if(_0x4a28d4>=_0x1cbe64){_0x4a28d4=_0x1cbe64;_0x2f9da2=0xc8;}else{_0x2f9da2=0xce;}_0x295acf[_0xa66f('0x1a')](_0x2f9da2);return _0x295acf[_0xa66f('0x20')](_0xa66f('0x21'),_0x55b59d+'-'+_0x4a28d4+'/'+_0x1cbe64)[_0xa66f('0x1c')](_0x5c67f5);}return null;};}function patchUpdates(_0x2d9602){return function(_0x235b61){try{jsonpatch[_0xa66f('0x22')](_0x235b61,_0x2d9602,!![]);}catch(_0x3c4eb1){return BPromise[_0xa66f('0x23')](_0x3c4eb1);}return _0x235b61[_0xa66f('0x24')]();};}function saveUpdates(_0x5cd613,_0x27f570){return function(_0xc5c82e){if(_0xc5c82e){return _0xc5c82e[_0xa66f('0x25')](_0x5cd613)[_0xa66f('0x26')](function(_0x5cbd82){return _0x5cbd82;});}return null;};}function removeEntity(_0x337602,_0x473822){return function(_0x209f4d){if(_0x209f4d){return _0x209f4d[_0xa66f('0x27')]()['then'](function(){_0x337602['status'](0xcc)[_0xa66f('0x1b')]();});}};}function handleEntityNotFound(_0x598942,_0x3a3e4f){return function(_0xc661f2){if(!_0xc661f2){_0x598942[_0xa66f('0x19')](0x194);}return _0xc661f2;};}function handleError(_0x57da7f,_0x4683c7){_0x4683c7=_0x4683c7||0x1f4;return function(_0x1c2903){logger[_0xa66f('0x28')](_0x1c2903[_0xa66f('0x29')]);if(_0x1c2903[_0xa66f('0x2a')]){delete _0x1c2903[_0xa66f('0x2a')];}_0x57da7f[_0xa66f('0x1a')](_0x4683c7)[_0xa66f('0x2b')](_0x1c2903);};}exports[_0xa66f('0x2c')]=function(_0x117d03,_0x45f71c){var _0x63650b={},_0x42b966={},_0xeeb22e={'count':0x0,'rows':[]};var _0x49f615=_['map'](db[_0xa66f('0x2d')][_0xa66f('0x2e')],function(_0x55f309){return{'name':_0x55f309[_0xa66f('0x2f')],'type':_0x55f309[_0xa66f('0x30')]['key']};});_0x42b966[_0xa66f('0x31')]=_[_0xa66f('0x32')](_0x49f615,_0xa66f('0x2a'));_0x42b966[_0xa66f('0x33')]=_[_0xa66f('0x34')](_0x117d03['query']);_0x42b966[_0xa66f('0x35')]=_['intersection'](_0x42b966[_0xa66f('0x31')],_0x42b966[_0xa66f('0x33')]);_0x63650b[_0xa66f('0x36')]=_['intersection'](_0x42b966[_0xa66f('0x31')],qs[_0xa66f('0x37')](_0x117d03['query'][_0xa66f('0x37')]));_0x63650b[_0xa66f('0x36')]=_0x63650b[_0xa66f('0x36')][_0xa66f('0x38')]?_0x63650b[_0xa66f('0x36')]:_0x42b966[_0xa66f('0x31')];if(!_0x117d03[_0xa66f('0x33')][_0xa66f('0x39')](_0xa66f('0x3a'))){_0x63650b[_0xa66f('0x1f')]=qs['limit'](_0x117d03[_0xa66f('0x33')]['limit']);_0x63650b[_0xa66f('0x1e')]=qs[_0xa66f('0x1e')](_0x117d03[_0xa66f('0x33')][_0xa66f('0x1e')]);}_0x63650b[_0xa66f('0x3b')]=qs[_0xa66f('0x3c')](_0x117d03[_0xa66f('0x33')][_0xa66f('0x3c')]);_0x63650b['where']=qs[_0xa66f('0x35')](_['pick'](_0x117d03[_0xa66f('0x33')],_0x42b966[_0xa66f('0x35')]));if(_0x117d03[_0xa66f('0x33')]['filter']){_0x63650b['where']=_[_0xa66f('0x3d')](_0x63650b[_0xa66f('0x3e')],{'$or':_[_0xa66f('0x32')](_0x49f615,function(_0x1f5a5f){if(_0x1f5a5f[_0xa66f('0x30')]!=='VIRTUAL'){var _0x5cb0a9={};_0x5cb0a9[_0x1f5a5f['name']]={'$like':'%'+_0x117d03[_0xa66f('0x33')]['filter']+'%'};return _0x5cb0a9;}})});}_0x63650b=_['merge']({},_0x63650b,_0x117d03['options']);var _0x5fdc3e={'where':_0x63650b['where']};return db[_0xa66f('0x2d')][_0xa66f('0x1d')](_0x5fdc3e)[_0xa66f('0x26')](function(_0x1647a0){_0xeeb22e[_0xa66f('0x1d')]=_0x1647a0;if(_0x117d03[_0xa66f('0x33')][_0xa66f('0x3f')]){_0x63650b[_0xa66f('0x40')]=[{'all':!![]}];}return db[_0xa66f('0x2d')][_0xa66f('0x41')](_0x63650b);})[_0xa66f('0x26')](function(_0x93f6ff){_0xeeb22e[_0xa66f('0x42')]=_0x93f6ff;return _0xeeb22e;})[_0xa66f('0x26')](respondWithFilteredResult(_0x45f71c,_0x63650b))['catch'](handleError(_0x45f71c,null));};exports[_0xa66f('0x43')]=function(_0x25c2cb,_0x58c1f2){var _0x248587={'raw':![],'where':{'id':_0x25c2cb[_0xa66f('0x44')]['id']}},_0x4b6e6b={};_0x4b6e6b[_0xa66f('0x31')]=_['keys'](db[_0xa66f('0x2d')][_0xa66f('0x2e')]);_0x4b6e6b[_0xa66f('0x33')]=_['keys'](_0x25c2cb[_0xa66f('0x33')]);_0x4b6e6b['filters']=_[_0xa66f('0x45')](_0x4b6e6b[_0xa66f('0x31')],_0x4b6e6b[_0xa66f('0x33')]);_0x248587[_0xa66f('0x36')]=_[_0xa66f('0x45')](_0x4b6e6b[_0xa66f('0x31')],qs[_0xa66f('0x37')](_0x25c2cb['query'][_0xa66f('0x37')]));_0x248587[_0xa66f('0x36')]=_0x248587[_0xa66f('0x36')][_0xa66f('0x38')]?_0x248587[_0xa66f('0x36')]:_0x4b6e6b['model'];if(_0x25c2cb['query'][_0xa66f('0x3f')]){_0x248587[_0xa66f('0x40')]=[{'all':!![]}];}_0x248587=_[_0xa66f('0x3d')]({},_0x248587,_0x25c2cb[_0xa66f('0x46')]);return db[_0xa66f('0x2d')][_0xa66f('0x47')](_0x248587)['then'](handleEntityNotFound(_0x58c1f2,null))[_0xa66f('0x26')](respondWithResult(_0x58c1f2,null))[_0xa66f('0x48')](handleError(_0x58c1f2,null));};exports[_0xa66f('0x49')]=function(_0x5651e9,_0x57c8a0){return db[_0xa66f('0x2d')][_0xa66f('0x49')](_0x5651e9[_0xa66f('0x4a')],{})['then'](respondWithResult(_0x57c8a0,0xc9))['catch'](handleError(_0x57c8a0,null));};exports['update']=function(_0x19e7ce,_0x35e477){if(_0x19e7ce[_0xa66f('0x4a')]['id']){delete _0x19e7ce[_0xa66f('0x4a')]['id'];}return db[_0xa66f('0x2d')][_0xa66f('0x47')]({'where':{'id':_0x19e7ce[_0xa66f('0x44')]['id']}})[_0xa66f('0x26')](handleEntityNotFound(_0x35e477,null))['then'](saveUpdates(_0x19e7ce[_0xa66f('0x4a')],null))[_0xa66f('0x26')](respondWithResult(_0x35e477,null))[_0xa66f('0x48')](handleError(_0x35e477,null));};exports[_0xa66f('0x27')]=function(_0x11597b,_0x33cdc7){return db['VoiceQueueReport'][_0xa66f('0x47')]({'where':{'id':_0x11597b[_0xa66f('0x44')]['id']}})[_0xa66f('0x26')](handleEntityNotFound(_0x33cdc7,null))[_0xa66f('0x26')](removeEntity(_0x33cdc7,null))[_0xa66f('0x48')](handleError(_0x33cdc7,null));};exports['describe']=function(_0x389b9a,_0x50e0cd){return db[_0xa66f('0x2d')]['describe']()['then'](respondWithResult(_0x50e0cd,null))[_0xa66f('0x48')](handleError(_0x50e0cd,null));};exports[_0xa66f('0x4b')]=function(_0x12271d,_0x2c79df){var _0x35ed5b={},_0xe97cf4={},_0x53a62f={'count':0x0,'rows':[]};_0xe97cf4[_0xa66f('0x31')]=_[_0xa66f('0x34')](db[_0xa66f('0x2d')][_0xa66f('0x2e')]);_0xe97cf4['query']=_[_0xa66f('0x34')](_0x12271d['query']);_0xe97cf4[_0xa66f('0x35')]=_[_0xa66f('0x45')](_0xe97cf4[_0xa66f('0x31')],_0xe97cf4[_0xa66f('0x33')]);_0x35ed5b[_0xa66f('0x36')]=_[_0xa66f('0x45')](_0xe97cf4[_0xa66f('0x31')],qs['fields'](_0x12271d[_0xa66f('0x33')][_0xa66f('0x37')]));_0x35ed5b[_0xa66f('0x36')]=_0x35ed5b[_0xa66f('0x36')][_0xa66f('0x38')]?_0x35ed5b[_0xa66f('0x36')]:_0xe97cf4[_0xa66f('0x31')];if(!_0x12271d[_0xa66f('0x33')][_0xa66f('0x39')]('nolimit')){_0x35ed5b['limit']=qs[_0xa66f('0x1f')](_0x12271d[_0xa66f('0x33')][_0xa66f('0x1f')]);_0x35ed5b[_0xa66f('0x1e')]=qs[_0xa66f('0x1e')](_0x12271d[_0xa66f('0x33')][_0xa66f('0x1e')]);}_0x35ed5b['order']=qs[_0xa66f('0x3c')](_0x12271d[_0xa66f('0x33')][_0xa66f('0x3c')]);_0x35ed5b[_0xa66f('0x3e')]=qs['filters'](_[_0xa66f('0x4c')](_0x12271d[_0xa66f('0x33')],_0xe97cf4[_0xa66f('0x35')]));if(_0x12271d[_0xa66f('0x33')][_0xa66f('0x4d')]){_0x35ed5b[_0xa66f('0x3e')]=_['merge'](_0x35ed5b['where'],{'$or':_[_0xa66f('0x32')](_0x35ed5b[_0xa66f('0x36')],function(_0x174aad){var _0x52edb3={};_0x52edb3[_0x174aad]={'$like':'%'+_0x12271d[_0xa66f('0x33')][_0xa66f('0x4d')]+'%'};return _0x52edb3;})});}_0x35ed5b=_[_0xa66f('0x3d')]({},_0x35ed5b,_0x12271d[_0xa66f('0x46')]);var _0x17b2cf={'where':_0x35ed5b[_0xa66f('0x3e')]};return db[_0xa66f('0x2d')][_0xa66f('0x1d')](_0x17b2cf)[_0xa66f('0x26')](function(_0x5d4299){_0x53a62f[_0xa66f('0x1d')]=_0x5d4299;if(_0x12271d[_0xa66f('0x33')][_0xa66f('0x3f')]){_0x35ed5b[_0xa66f('0x40')]=[{'all':!![]}];}return db[_0xa66f('0x2d')][_0xa66f('0x41')](_0x35ed5b);})[_0xa66f('0x26')](function(_0x3b38ad){_0x53a62f['rows']=_0x3b38ad;return _0x53a62f;})['then'](respondWithFilteredResult(_0x2c79df,_0x35ed5b,_0xa66f('0x4b')))[_0xa66f('0x48')](handleError(_0x2c79df,null,_0xa66f('0x4b')));}; \ No newline at end of file +var _0x1261=['includeAll','find','catch','create','body','describe','getVoiceQueuesReport','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','json','offset','set','Content-Range','reject','save','update','destroy','then','end','error','name','index','map','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','pick','filter','merge','where','type','options','VoiceQueueReport','count','include','findAll','rows','params'];(function(_0x5eed8c,_0x4cc31a){var _0x2fec4e=function(_0x523aed){while(--_0x523aed){_0x5eed8c['push'](_0x5eed8c['shift']());}};_0x2fec4e(++_0x4cc31a);}(_0x1261,0x144));var _0x1126=function(_0x49f913,_0x12ccd8){_0x49f913=_0x49f913-0x0;var _0xf48ea5=_0x1261[_0x49f913];return _0xf48ea5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1126('0x0'));var rimraf=require(_0x1126('0x1'));var zipdir=require(_0x1126('0x2'));var jsonpatch=require(_0x1126('0x3'));var rp=require(_0x1126('0x4'));var moment=require(_0x1126('0x5'));var BPromise=require(_0x1126('0x6'));var Mustache=require(_0x1126('0x7'));var util=require(_0x1126('0x8'));var path=require(_0x1126('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1126('0xa'));var fs=require('fs');var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var db=require(_0x1126('0x16'))['db'];config[_0x1126('0x17')]=_[_0x1126('0x18')](config[_0x1126('0x17')],{'host':_0x1126('0x19'),'port':0x18eb});var socket=require(_0x1126('0x1a'))(new Redis(config[_0x1126('0x17')]));require(_0x1126('0x1b'))[_0x1126('0x1c')](socket);function respondWithStatusCode(_0x53a8f0,_0x5de9a7){_0x5de9a7=_0x5de9a7||0xcc;return function(_0x1af673){if(_0x1af673){return _0x53a8f0[_0x1126('0x1d')](_0x5de9a7);}return _0x53a8f0[_0x1126('0x1e')](_0x5de9a7)['end']();};}function respondWithResult(_0x45149c,_0x4794a7){_0x4794a7=_0x4794a7||0xc8;return function(_0x35fe9f){if(_0x35fe9f){return _0x45149c[_0x1126('0x1e')](_0x4794a7)[_0x1126('0x1f')](_0x35fe9f);}};}function respondWithFilteredResult(_0x4e1c97,_0x245cd7){return function(_0x1695f6){if(_0x1695f6){var _0x4a7b49=_0x1695f6['count'],_0x4d2b38=_0x245cd7['offset'],_0x22ae0b=_0x245cd7[_0x1126('0x20')]+_0x245cd7['limit'],_0x2b2487;if(_0x22ae0b>=_0x4a7b49){_0x22ae0b=_0x4a7b49;_0x2b2487=0xc8;}else{_0x2b2487=0xce;}_0x4e1c97[_0x1126('0x1e')](_0x2b2487);return _0x4e1c97[_0x1126('0x21')](_0x1126('0x22'),_0x4d2b38+'-'+_0x22ae0b+'/'+_0x4a7b49)['json'](_0x1695f6);}return null;};}function patchUpdates(_0x2a08ba){return function(_0x49d209){try{jsonpatch['apply'](_0x49d209,_0x2a08ba,!![]);}catch(_0x30f6b3){return BPromise[_0x1126('0x23')](_0x30f6b3);}return _0x49d209[_0x1126('0x24')]();};}function saveUpdates(_0x36d254,_0x526ca1){return function(_0x29ab60){if(_0x29ab60){return _0x29ab60[_0x1126('0x25')](_0x36d254)['then'](function(_0x2175fa){return _0x2175fa;});}return null;};}function removeEntity(_0x59cd8e,_0x529dd9){return function(_0x4b57ab){if(_0x4b57ab){return _0x4b57ab[_0x1126('0x26')]()[_0x1126('0x27')](function(){_0x59cd8e[_0x1126('0x1e')](0xcc)[_0x1126('0x28')]();});}};}function handleEntityNotFound(_0x566c09,_0x1b07a7){return function(_0xea0971){if(!_0xea0971){_0x566c09[_0x1126('0x1d')](0x194);}return _0xea0971;};}function handleError(_0x589725,_0x35eec3){_0x35eec3=_0x35eec3||0x1f4;return function(_0x375e59){logger[_0x1126('0x29')](_0x375e59['stack']);if(_0x375e59['name']){delete _0x375e59[_0x1126('0x2a')];}_0x589725[_0x1126('0x1e')](_0x35eec3)['send'](_0x375e59);};}exports[_0x1126('0x2b')]=function(_0x23d2bc,_0x4a334a){var _0x3fa694={},_0x4bf807={},_0xc62460={'count':0x0,'rows':[]};var _0x4bd50b=_[_0x1126('0x2c')](db['VoiceQueueReport'][_0x1126('0x2d')],function(_0x5f2611){return{'name':_0x5f2611['fieldName'],'type':_0x5f2611['type'][_0x1126('0x2e')]};});_0x4bf807[_0x1126('0x2f')]=_[_0x1126('0x2c')](_0x4bd50b,'name');_0x4bf807[_0x1126('0x30')]=_[_0x1126('0x31')](_0x23d2bc['query']);_0x4bf807[_0x1126('0x32')]=_[_0x1126('0x33')](_0x4bf807[_0x1126('0x2f')],_0x4bf807[_0x1126('0x30')]);_0x3fa694['attributes']=_['intersection'](_0x4bf807[_0x1126('0x2f')],qs[_0x1126('0x34')](_0x23d2bc[_0x1126('0x30')][_0x1126('0x34')]));_0x3fa694['attributes']=_0x3fa694[_0x1126('0x35')][_0x1126('0x36')]?_0x3fa694[_0x1126('0x35')]:_0x4bf807[_0x1126('0x2f')];if(!_0x23d2bc[_0x1126('0x30')]['hasOwnProperty'](_0x1126('0x37'))){_0x3fa694[_0x1126('0x38')]=qs[_0x1126('0x38')](_0x23d2bc[_0x1126('0x30')]['limit']);_0x3fa694['offset']=qs[_0x1126('0x20')](_0x23d2bc[_0x1126('0x30')]['offset']);}_0x3fa694[_0x1126('0x39')]=qs[_0x1126('0x3a')](_0x23d2bc[_0x1126('0x30')]['sort']);_0x3fa694['where']=qs[_0x1126('0x32')](_[_0x1126('0x3b')](_0x23d2bc[_0x1126('0x30')],_0x4bf807[_0x1126('0x32')]));if(_0x23d2bc['query'][_0x1126('0x3c')]){_0x3fa694['where']=_[_0x1126('0x3d')](_0x3fa694[_0x1126('0x3e')],{'$or':_[_0x1126('0x2c')](_0x4bd50b,function(_0x1ea702){if(_0x1ea702[_0x1126('0x3f')]!=='VIRTUAL'){var _0x1da59f={};_0x1da59f[_0x1ea702[_0x1126('0x2a')]]={'$like':'%'+_0x23d2bc[_0x1126('0x30')][_0x1126('0x3c')]+'%'};return _0x1da59f;}})});}_0x3fa694=_[_0x1126('0x3d')]({},_0x3fa694,_0x23d2bc[_0x1126('0x40')]);var _0x3052f9={'where':_0x3fa694['where']};return db[_0x1126('0x41')][_0x1126('0x42')](_0x3052f9)[_0x1126('0x27')](function(_0xf3a0bd){_0xc62460[_0x1126('0x42')]=_0xf3a0bd;if(_0x23d2bc['query']['includeAll']){_0x3fa694[_0x1126('0x43')]=[{'all':!![]}];}return db[_0x1126('0x41')][_0x1126('0x44')](_0x3fa694);})[_0x1126('0x27')](function(_0x18b496){_0xc62460[_0x1126('0x45')]=_0x18b496;return _0xc62460;})['then'](respondWithFilteredResult(_0x4a334a,_0x3fa694))['catch'](handleError(_0x4a334a,null));};exports['show']=function(_0xb8054e,_0x5d4194){var _0xf84005={'raw':![],'where':{'id':_0xb8054e[_0x1126('0x46')]['id']}},_0x462da8={};_0x462da8[_0x1126('0x2f')]=_['keys'](db['VoiceQueueReport'][_0x1126('0x2d')]);_0x462da8[_0x1126('0x30')]=_[_0x1126('0x31')](_0xb8054e['query']);_0x462da8[_0x1126('0x32')]=_['intersection'](_0x462da8[_0x1126('0x2f')],_0x462da8['query']);_0xf84005[_0x1126('0x35')]=_[_0x1126('0x33')](_0x462da8[_0x1126('0x2f')],qs['fields'](_0xb8054e[_0x1126('0x30')][_0x1126('0x34')]));_0xf84005[_0x1126('0x35')]=_0xf84005['attributes']['length']?_0xf84005['attributes']:_0x462da8[_0x1126('0x2f')];if(_0xb8054e['query'][_0x1126('0x47')]){_0xf84005['include']=[{'all':!![]}];}_0xf84005=_[_0x1126('0x3d')]({},_0xf84005,_0xb8054e[_0x1126('0x40')]);return db[_0x1126('0x41')][_0x1126('0x48')](_0xf84005)[_0x1126('0x27')](handleEntityNotFound(_0x5d4194,null))['then'](respondWithResult(_0x5d4194,null))[_0x1126('0x49')](handleError(_0x5d4194,null));};exports[_0x1126('0x4a')]=function(_0x5111d3,_0x1a15f8){return db[_0x1126('0x41')]['create'](_0x5111d3[_0x1126('0x4b')],{})[_0x1126('0x27')](respondWithResult(_0x1a15f8,0xc9))['catch'](handleError(_0x1a15f8,null));};exports[_0x1126('0x25')]=function(_0xbdde58,_0x213a76){if(_0xbdde58['body']['id']){delete _0xbdde58[_0x1126('0x4b')]['id'];}return db[_0x1126('0x41')][_0x1126('0x48')]({'where':{'id':_0xbdde58[_0x1126('0x46')]['id']}})[_0x1126('0x27')](handleEntityNotFound(_0x213a76,null))[_0x1126('0x27')](saveUpdates(_0xbdde58[_0x1126('0x4b')],null))[_0x1126('0x27')](respondWithResult(_0x213a76,null))['catch'](handleError(_0x213a76,null));};exports[_0x1126('0x26')]=function(_0x5a2287,_0x40168e){return db[_0x1126('0x41')]['find']({'where':{'id':_0x5a2287['params']['id']}})[_0x1126('0x27')](handleEntityNotFound(_0x40168e,null))[_0x1126('0x27')](removeEntity(_0x40168e,null))[_0x1126('0x49')](handleError(_0x40168e,null));};exports['describe']=function(_0x3cb44c,_0x3506d7){return db[_0x1126('0x41')][_0x1126('0x4c')]()['then'](respondWithResult(_0x3506d7,null))[_0x1126('0x49')](handleError(_0x3506d7,null));};exports[_0x1126('0x4d')]=function(_0x5c36b9,_0x4bcc08){var _0x4abb4d={},_0x526b07={},_0x386c10={'count':0x0,'rows':[]};_0x526b07[_0x1126('0x2f')]=_['keys'](db[_0x1126('0x41')][_0x1126('0x2d')]);_0x526b07[_0x1126('0x30')]=_[_0x1126('0x31')](_0x5c36b9[_0x1126('0x30')]);_0x526b07['filters']=_[_0x1126('0x33')](_0x526b07[_0x1126('0x2f')],_0x526b07['query']);_0x4abb4d[_0x1126('0x35')]=_[_0x1126('0x33')](_0x526b07[_0x1126('0x2f')],qs[_0x1126('0x34')](_0x5c36b9[_0x1126('0x30')]['fields']));_0x4abb4d[_0x1126('0x35')]=_0x4abb4d['attributes'][_0x1126('0x36')]?_0x4abb4d[_0x1126('0x35')]:_0x526b07[_0x1126('0x2f')];if(!_0x5c36b9['query'][_0x1126('0x4e')](_0x1126('0x37'))){_0x4abb4d['limit']=qs[_0x1126('0x38')](_0x5c36b9[_0x1126('0x30')][_0x1126('0x38')]);_0x4abb4d['offset']=qs[_0x1126('0x20')](_0x5c36b9[_0x1126('0x30')][_0x1126('0x20')]);}_0x4abb4d[_0x1126('0x39')]=qs[_0x1126('0x3a')](_0x5c36b9[_0x1126('0x30')][_0x1126('0x3a')]);_0x4abb4d[_0x1126('0x3e')]=qs['filters'](_[_0x1126('0x3b')](_0x5c36b9[_0x1126('0x30')],_0x526b07[_0x1126('0x32')]));if(_0x5c36b9[_0x1126('0x30')][_0x1126('0x3c')]){_0x4abb4d['where']=_[_0x1126('0x3d')](_0x4abb4d[_0x1126('0x3e')],{'$or':_['map'](_0x4abb4d[_0x1126('0x35')],function(_0x5246aa){var _0x272274={};_0x272274[_0x5246aa]={'$like':'%'+_0x5c36b9[_0x1126('0x30')]['filter']+'%'};return _0x272274;})});}_0x4abb4d=_[_0x1126('0x3d')]({},_0x4abb4d,_0x5c36b9[_0x1126('0x40')]);var _0x375b76={'where':_0x4abb4d['where']};return db[_0x1126('0x41')]['count'](_0x375b76)['then'](function(_0xbdc58){_0x386c10[_0x1126('0x42')]=_0xbdc58;if(_0x5c36b9[_0x1126('0x30')][_0x1126('0x47')]){_0x4abb4d[_0x1126('0x43')]=[{'all':!![]}];}return db[_0x1126('0x41')][_0x1126('0x44')](_0x4abb4d);})['then'](function(_0x191307){_0x386c10[_0x1126('0x45')]=_0x191307;return _0x386c10;})[_0x1126('0x27')](respondWithFilteredResult(_0x4bcc08,_0x4abb4d,_0x1126('0x4d')))[_0x1126('0x49')](handleError(_0x4bcc08,null,_0x1126('0x4d')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index ee58866..6939862 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 _0x2d88=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueueReport'];(function(_0x36dada,_0x2f9e98){var _0x19ce12=function(_0x5b9711){while(--_0x5b9711){_0x36dada['push'](_0x36dada['shift']());}};_0x19ce12(++_0x2f9e98);}(_0x2d88,0x110));var _0x82d8=function(_0x574294,_0x28b054){_0x574294=_0x574294-0x0;var _0x272995=_0x2d88[_0x574294];return _0x272995;};'use strict';var EventEmitter=require(_0x82d8('0x0'));var VoiceQueueReport=require(_0x82d8('0x1'))['db'][_0x82d8('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x82d8('0x3')](0x0);var events={'afterCreate':_0x82d8('0x4'),'afterUpdate':_0x82d8('0x5'),'afterDestroy':_0x82d8('0x6')};function emitEvent(_0x2923d2){return function(_0x21346c,_0x4f610f,_0x38ef91){VoiceQueueReportEvents[_0x82d8('0x7')](_0x2923d2+':'+_0x21346c['id'],_0x21346c);VoiceQueueReportEvents['emit'](_0x2923d2,_0x21346c);_0x38ef91(null);};}for(var e in events){if(events[_0x82d8('0x8')](e)){var event=events[e];VoiceQueueReport[_0x82d8('0x9')](e,emitEvent(event));}}module[_0x82d8('0xa')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xac7a=['events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x953ede,_0x4f84b5){var _0x18c400=function(_0x5b57f4){while(--_0x5b57f4){_0x953ede['push'](_0x953ede['shift']());}};_0x18c400(++_0x4f84b5);}(_0xac7a,0x1f4));var _0xaac7=function(_0x4e7115,_0x273e25){_0x4e7115=_0x4e7115-0x0;var _0x4c6d76=_0xac7a[_0x4e7115];return _0x4c6d76;};'use strict';var EventEmitter=require(_0xaac7('0x0'));var VoiceQueueReport=require(_0xaac7('0x1'))['db'][_0xaac7('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xaac7('0x3')](0x0);var events={'afterCreate':_0xaac7('0x4'),'afterUpdate':_0xaac7('0x5'),'afterDestroy':_0xaac7('0x6')};function emitEvent(_0x4be515){return function(_0x379ec8,_0x5dedb7,_0x215dea){VoiceQueueReportEvents[_0xaac7('0x7')](_0x4be515+':'+_0x379ec8['id'],_0x379ec8);VoiceQueueReportEvents['emit'](_0x4be515,_0x379ec8);_0x215dea(null);};}for(var e in events){if(events[_0xaac7('0x8')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0xaac7('0x9')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index d4d55e9..8c82366 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 _0xbaf0=['define','VoiceQueueReport','report_queue','calleridnum','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueueReport.attributes','exports'];(function(_0xca0daa,_0x56dbe4){var _0x472553=function(_0x3ff875){while(--_0x3ff875){_0xca0daa['push'](_0xca0daa['shift']());}};_0x472553(++_0x56dbe4);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2032=['./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4178af,_0x388652){var _0x20f4b1=function(_0x504188){while(--_0x504188){_0x4178af['push'](_0x4178af['shift']());}};_0x20f4b1(++_0x388652);}(_0x2032,0xd9));var _0x2203=function(_0x5f2308,_0x3e611c){_0x5f2308=_0x5f2308-0x0;var _0x388ea5=_0x2032[_0x5f2308];return _0x388ea5;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var logger=require(_0x2203('0x1'))(_0x2203('0x2'));var moment=require('moment');var BPromise=require(_0x2203('0x3'));var rp=require(_0x2203('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var attributes=require(_0x2203('0x7'));module[_0x2203('0x8')]=function(_0x3f7ba1,_0x13367a){return _0x3f7ba1[_0x2203('0x9')](_0x2203('0xa'),attributes,{'tableName':_0x2203('0xb'),'paranoid':![],'indexes':[{'fields':[_0x2203('0xc')]},{'fields':[_0x2203('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index e80b82b..a2ef2c9 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 _0xea2f=['GetVoiceQueueReport','VoiceQueueReport','findAll','options','where','attributes','include','map','model','then','CreateVoiceQueueReport','create','body','raw','UpdateVoiceQueueReport','update','limit','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./voiceQueueReport.socket','register','request','info','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','result','catch'];(function(_0x580d2f,_0x156235){var _0xf1ecdb=function(_0x3a5275){while(--_0x3a5275){_0x580d2f['push'](_0x580d2f['shift']());}};_0xf1ecdb(++_0x156235);}(_0xea2f,0x6d));var _0xfea2=function(_0x480fe3,_0x453d29){_0x480fe3=_0x480fe3-0x0;var _0x5e3142=_0xea2f[_0x480fe3];return _0x5e3142;};'use strict';var _=require(_0xfea2('0x0'));var util=require('util');var moment=require(_0xfea2('0x1'));var BPromise=require(_0xfea2('0x2'));var rs=require(_0xfea2('0x3'));var fs=require('fs');var Redis=require(_0xfea2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfea2('0x5'));var logger=require(_0xfea2('0x6'))('rpc');var config=require(_0xfea2('0x7'));var jayson=require(_0xfea2('0x8'));var client=jayson[_0xfea2('0x9')][_0xfea2('0xa')]({'port':0x232a});config['redis']=_[_0xfea2('0xb')](config['redis'],{'host':_0xfea2('0xc'),'port':0x18eb});var socket=require(_0xfea2('0xd'))(new Redis(config[_0xfea2('0xe')]));require(_0xfea2('0xf'))[_0xfea2('0x10')](socket);function respondWithRpcPromise(_0x307cb9,_0x341a78,_0x286ba4){return new BPromise(function(_0x231bf3,_0x531220){return client[_0xfea2('0x11')](_0x307cb9,_0x286ba4)['then'](function(_0x22fde8){logger[_0xfea2('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x341a78,'request\x20sent');logger[_0xfea2('0x13')](_0xfea2('0x14'),_0x341a78,_0xfea2('0x15'),JSON[_0xfea2('0x16')](_0x22fde8));if(_0x22fde8['error']){if(_0x22fde8[_0xfea2('0x17')][_0xfea2('0x18')]===0x1f4){logger[_0xfea2('0x17')](_0xfea2('0x19'),_0x341a78,_0x22fde8[_0xfea2('0x17')][_0xfea2('0x1a')]);return _0x531220(_0x22fde8[_0xfea2('0x17')]['message']);}logger['error'](_0xfea2('0x19'),_0x341a78,_0x22fde8['error'][_0xfea2('0x1a')]);return _0x231bf3(_0x22fde8['error'][_0xfea2('0x1a')]);}else{logger[_0xfea2('0x12')](_0xfea2('0x19'),_0x341a78,_0xfea2('0x15'));_0x231bf3(_0x22fde8[_0xfea2('0x1b')][_0xfea2('0x1a')]);}})[_0xfea2('0x1c')](function(_0x459e16){logger[_0xfea2('0x17')](_0xfea2('0x19'),_0x341a78,_0x459e16);_0x531220(_0x459e16);});});}exports[_0xfea2('0x1d')]=function(_0x17bc7e){var _0x280dee=this;return new Promise(function(_0x40672f,_0x1feb6b){return db[_0xfea2('0x1e')][_0xfea2('0x1f')]({'raw':_0x17bc7e['options']?_0x17bc7e[_0xfea2('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x17bc7e['options']?_0x17bc7e[_0xfea2('0x20')][_0xfea2('0x21')]||null:null,'attributes':_0x17bc7e['options']?_0x17bc7e[_0xfea2('0x20')][_0xfea2('0x22')]||null:null,'limit':_0x17bc7e[_0xfea2('0x20')]?_0x17bc7e['options']['limit']||null:null,'include':_0x17bc7e[_0xfea2('0x20')]?_0x17bc7e['options'][_0xfea2('0x23')]?_[_0xfea2('0x24')](_0x17bc7e['options'][_0xfea2('0x23')],function(_0x521bc9){return{'model':db[_0x521bc9[_0xfea2('0x25')]],'as':_0x521bc9['as'],'attributes':_0x521bc9[_0xfea2('0x22')],'include':_0x521bc9[_0xfea2('0x23')]?_['map'](_0x521bc9['include'],function(_0x29ffaa){return{'model':db[_0x29ffaa[_0xfea2('0x25')]],'as':_0x29ffaa['as'],'attributes':_0x29ffaa[_0xfea2('0x22')],'include':_0x29ffaa[_0xfea2('0x23')]?_['map'](_0x29ffaa[_0xfea2('0x23')],function(_0x3b61e3){return{'model':db[_0x3b61e3['model']],'as':_0x3b61e3['as'],'attributes':_0x3b61e3[_0xfea2('0x22')]};}):[]};}):[]};}):[]:[]})[_0xfea2('0x26')](function(_0x53de83){logger[_0xfea2('0x12')](_0xfea2('0x1d'),_0x17bc7e);logger[_0xfea2('0x13')](_0xfea2('0x1d'),_0x17bc7e,JSON['stringify'](_0x53de83));_0x40672f(_0x53de83);})[_0xfea2('0x1c')](function(_0x407085){logger[_0xfea2('0x17')](_0xfea2('0x1d'),_0x407085[_0xfea2('0x1a')],_0x17bc7e);_0x1feb6b(_0x280dee[_0xfea2('0x17')](0x1f4,_0x407085[_0xfea2('0x1a')]));});});};exports[_0xfea2('0x27')]=function(_0x3fffab){var _0x3d6011=this;return new Promise(function(_0x96be5f,_0x127b08){return db[_0xfea2('0x1e')][_0xfea2('0x28')](_0x3fffab[_0xfea2('0x29')],{'raw':_0x3fffab[_0xfea2('0x20')]?_0x3fffab[_0xfea2('0x20')][_0xfea2('0x2a')]===undefined?!![]:![]:!![]})[_0xfea2('0x26')](function(_0x124f72){logger[_0xfea2('0x12')]('CreateVoiceQueueReport',_0x3fffab);logger[_0xfea2('0x13')]('CreateVoiceQueueReport',_0x3fffab,JSON['stringify'](_0x124f72));_0x96be5f(_0x124f72);})[_0xfea2('0x1c')](function(_0x3061e0){logger['error'](_0xfea2('0x27'),_0x3061e0[_0xfea2('0x1a')],_0x3fffab);_0x127b08(_0x3d6011[_0xfea2('0x17')](0x1f4,_0x3061e0[_0xfea2('0x1a')]));});});};exports[_0xfea2('0x2b')]=function(_0x15305d){var _0x38b49f=this;return new Promise(function(_0x46a9d4,_0x37e9ad){return db[_0xfea2('0x1e')][_0xfea2('0x2c')](_0x15305d[_0xfea2('0x29')],{'raw':_0x15305d[_0xfea2('0x20')]?_0x15305d[_0xfea2('0x20')][_0xfea2('0x2a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15305d[_0xfea2('0x20')]?_0x15305d[_0xfea2('0x20')][_0xfea2('0x21')]||null:null,'attributes':_0x15305d[_0xfea2('0x20')]?_0x15305d[_0xfea2('0x20')][_0xfea2('0x22')]||null:null,'limit':_0x15305d[_0xfea2('0x20')]?_0x15305d[_0xfea2('0x20')][_0xfea2('0x2d')]||null:null})[_0xfea2('0x26')](function(_0x44304a){logger[_0xfea2('0x12')]('UpdateVoiceQueueReport',_0x15305d);logger[_0xfea2('0x13')](_0xfea2('0x2b'),_0x15305d,JSON[_0xfea2('0x16')](_0x44304a));_0x46a9d4(_0x44304a);})[_0xfea2('0x1c')](function(_0x40e5b2){logger[_0xfea2('0x17')]('UpdateVoiceQueueReport',_0x40e5b2[_0xfea2('0x1a')],_0x15305d);_0x37e9ad(_0x38b49f['error'](0x1f4,_0x40e5b2[_0xfea2('0x1a')]));});});}; \ No newline at end of file +var _0xecd6=['map','model','create','body','CreateVoiceQueueReport','update','info','UpdateVoiceQueueReport','catch','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voiceQueueReport.socket','then','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','VoiceQueueReport,\x20%s,\x20%s','message','result','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','attributes','limit','include'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xecd6,0x1a3));var _0x6ecd=function(_0x2d9f9b,_0x478b09){_0x2d9f9b=_0x2d9f9b-0x0;var _0x581343=_0xecd6[_0x2d9f9b];return _0x581343;};'use strict';var _=require('lodash');var util=require(_0x6ecd('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6ecd('0x1'));var fs=require('fs');var Redis=require(_0x6ecd('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x6ecd('0x3'));var logger=require(_0x6ecd('0x4'))(_0x6ecd('0x5'));var config=require(_0x6ecd('0x6'));var jayson=require(_0x6ecd('0x7'));var client=jayson[_0x6ecd('0x8')][_0x6ecd('0x9')]({'port':0x232a});config[_0x6ecd('0xa')]=_[_0x6ecd('0xb')](config[_0x6ecd('0xa')],{'host':_0x6ecd('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6ecd('0xa')]));require(_0x6ecd('0xd'))['register'](socket);function respondWithRpcPromise(_0x516db9,_0x53e8ec,_0x5dfc98){return new BPromise(function(_0x506382,_0x1b4dd1){return client['request'](_0x516db9,_0x5dfc98)[_0x6ecd('0xe')](function(_0x968709){logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x53e8ec,_0x6ecd('0xf'));logger[_0x6ecd('0x10')](_0x6ecd('0x11'),_0x53e8ec,_0x6ecd('0xf'),JSON[_0x6ecd('0x12')](_0x968709));if(_0x968709['error']){if(_0x968709['error'][_0x6ecd('0x13')]===0x1f4){logger[_0x6ecd('0x14')](_0x6ecd('0x15'),_0x53e8ec,_0x968709[_0x6ecd('0x14')]['message']);return _0x1b4dd1(_0x968709[_0x6ecd('0x14')]['message']);}logger['error'](_0x6ecd('0x15'),_0x53e8ec,_0x968709['error'][_0x6ecd('0x16')]);return _0x506382(_0x968709['error']['message']);}else{logger['info'](_0x6ecd('0x15'),_0x53e8ec,_0x6ecd('0xf'));_0x506382(_0x968709[_0x6ecd('0x17')][_0x6ecd('0x16')]);}})['catch'](function(_0x5c88c2){logger[_0x6ecd('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x53e8ec,_0x5c88c2);_0x1b4dd1(_0x5c88c2);});});}exports[_0x6ecd('0x18')]=function(_0x27840a){var _0x312ed9=this;return new Promise(function(_0x2f5cd3,_0x390c5e){return db[_0x6ecd('0x19')][_0x6ecd('0x1a')]({'raw':_0x27840a[_0x6ecd('0x1b')]?_0x27840a['options'][_0x6ecd('0x1c')]===undefined?!![]:![]:!![],'where':_0x27840a['options']?_0x27840a[_0x6ecd('0x1b')]['where']||null:null,'attributes':_0x27840a['options']?_0x27840a[_0x6ecd('0x1b')][_0x6ecd('0x1d')]||null:null,'limit':_0x27840a[_0x6ecd('0x1b')]?_0x27840a[_0x6ecd('0x1b')][_0x6ecd('0x1e')]||null:null,'include':_0x27840a[_0x6ecd('0x1b')]?_0x27840a[_0x6ecd('0x1b')][_0x6ecd('0x1f')]?_[_0x6ecd('0x20')](_0x27840a['options'][_0x6ecd('0x1f')],function(_0x5cb760){return{'model':db[_0x5cb760[_0x6ecd('0x21')]],'as':_0x5cb760['as'],'attributes':_0x5cb760[_0x6ecd('0x1d')],'include':_0x5cb760[_0x6ecd('0x1f')]?_[_0x6ecd('0x20')](_0x5cb760['include'],function(_0x5b6872){return{'model':db[_0x5b6872[_0x6ecd('0x21')]],'as':_0x5b6872['as'],'attributes':_0x5b6872[_0x6ecd('0x1d')],'include':_0x5b6872['include']?_['map'](_0x5b6872[_0x6ecd('0x1f')],function(_0x337f9a){return{'model':db[_0x337f9a[_0x6ecd('0x21')]],'as':_0x337f9a['as'],'attributes':_0x337f9a['attributes']};}):[]};}):[]};}):[]:[]})[_0x6ecd('0xe')](function(_0x3d810a){logger['info'](_0x6ecd('0x18'),_0x27840a);logger[_0x6ecd('0x10')](_0x6ecd('0x18'),_0x27840a,JSON[_0x6ecd('0x12')](_0x3d810a));_0x2f5cd3(_0x3d810a);})['catch'](function(_0x58e2a8){logger[_0x6ecd('0x14')](_0x6ecd('0x18'),_0x58e2a8[_0x6ecd('0x16')],_0x27840a);_0x390c5e(_0x312ed9[_0x6ecd('0x14')](0x1f4,_0x58e2a8[_0x6ecd('0x16')]));});});};exports['CreateVoiceQueueReport']=function(_0x15998d){var _0x2e976b=this;return new Promise(function(_0x49c6e5,_0x27eef9){return db[_0x6ecd('0x19')][_0x6ecd('0x22')](_0x15998d[_0x6ecd('0x23')],{'raw':_0x15998d[_0x6ecd('0x1b')]?_0x15998d[_0x6ecd('0x1b')][_0x6ecd('0x1c')]===undefined?!![]:![]:!![]})[_0x6ecd('0xe')](function(_0x3db865){logger['info'](_0x6ecd('0x24'),_0x15998d);logger[_0x6ecd('0x10')](_0x6ecd('0x24'),_0x15998d,JSON[_0x6ecd('0x12')](_0x3db865));_0x49c6e5(_0x3db865);})['catch'](function(_0x1f7283){logger[_0x6ecd('0x14')](_0x6ecd('0x24'),_0x1f7283['message'],_0x15998d);_0x27eef9(_0x2e976b[_0x6ecd('0x14')](0x1f4,_0x1f7283[_0x6ecd('0x16')]));});});};exports['UpdateVoiceQueueReport']=function(_0x5c5db6){var _0xe2a0d6=this;return new Promise(function(_0x353bb2,_0x420e18){return db[_0x6ecd('0x19')][_0x6ecd('0x25')](_0x5c5db6[_0x6ecd('0x23')],{'raw':_0x5c5db6['options']?_0x5c5db6[_0x6ecd('0x1b')][_0x6ecd('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c5db6[_0x6ecd('0x1b')]?_0x5c5db6[_0x6ecd('0x1b')]['where']||null:null,'attributes':_0x5c5db6['options']?_0x5c5db6[_0x6ecd('0x1b')][_0x6ecd('0x1d')]||null:null,'limit':_0x5c5db6[_0x6ecd('0x1b')]?_0x5c5db6[_0x6ecd('0x1b')][_0x6ecd('0x1e')]||null:null})['then'](function(_0x149054){logger[_0x6ecd('0x26')](_0x6ecd('0x27'),_0x5c5db6);logger[_0x6ecd('0x10')](_0x6ecd('0x27'),_0x5c5db6,JSON[_0x6ecd('0x12')](_0x149054));_0x353bb2(_0x149054);})[_0x6ecd('0x28')](function(_0x3d4940){logger[_0x6ecd('0x14')](_0x6ecd('0x27'),_0x3d4940['message'],_0x5c5db6);_0x420e18(_0xe2a0d6[_0x6ecd('0x14')](0x1f4,_0x3d4940[_0x6ecd('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 150d8d5..46e0af5 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 _0x799d=['register','length','voiceQueueReport:','./voiceQueueReport.events','save','remove','emit'];(function(_0x405aed,_0x44cc54){var _0x1e9703=function(_0x266032){while(--_0x266032){_0x405aed['push'](_0x405aed['shift']());}};_0x1e9703(++_0x44cc54);}(_0x799d,0x7a));var _0xd799=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x799d[_0x2be8c2];return _0x97f531;};'use strict';var VoiceQueueReportEvents=require(_0xd799('0x0'));var events=[_0xd799('0x1'),_0xd799('0x2'),'update'];function createListener(_0x69f406,_0x4b72be){return function(_0x58c237){_0x4b72be[_0xd799('0x3')](_0x69f406,_0x58c237);};}function removeListener(_0x5b58c0,_0x3e16b1){return function(){VoiceQueueReportEvents['removeListener'](_0x5b58c0,_0x3e16b1);};}exports[_0xd799('0x4')]=function(_0x478f06){for(var _0x376ab5=0x0,_0x3c4e7d=events[_0xd799('0x5')];_0x376ab5<_0x3c4e7d;_0x376ab5++){var _0xe32b5d=events[_0x376ab5];var _0xd05b5e=createListener(_0xd799('0x6')+_0xe32b5d,_0x478f06);VoiceQueueReportEvents['on'](_0xe32b5d,_0xd05b5e);}}; \ No newline at end of file +var _0x9611=['register','length','voiceQueueReport:','save','remove','update','emit'];(function(_0x1ee9a1,_0x5f1434){var _0x21270f=function(_0x303251){while(--_0x303251){_0x1ee9a1['push'](_0x1ee9a1['shift']());}};_0x21270f(++_0x5f1434);}(_0x9611,0xce));var _0x1961=function(_0x4494fb,_0xb58a9d){_0x4494fb=_0x4494fb-0x0;var _0x292513=_0x9611[_0x4494fb];return _0x292513;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x1961('0x0'),_0x1961('0x1'),_0x1961('0x2')];function createListener(_0x55d464,_0x1fd64a){return function(_0x1f9cc2){_0x1fd64a[_0x1961('0x3')](_0x55d464,_0x1f9cc2);};}function removeListener(_0x205653,_0x403707){return function(){VoiceQueueReportEvents['removeListener'](_0x205653,_0x403707);};}exports[_0x1961('0x4')]=function(_0x3c9ead){for(var _0xcd3860=0x0,_0x309ca4=events[_0x1961('0x5')];_0xcd3860<_0x309ca4;_0xcd3860++){var _0x5d8d63=events[_0xcd3860];var _0x4bacd5=createListener(_0x1961('0x6')+_0x5d8d63,_0x3c9ead);VoiceQueueReportEvents['on'](_0x5d8d63,_0x4bacd5);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index b654a4e..0edbb9e 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 _0xb422=['update','delete','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','index','/:id','isAuthenticated','post','create'];(function(_0x4f431d,_0xd51a3b){var _0x4f31e1=function(_0x1c688d){while(--_0x1c688d){_0x4f431d['push'](_0x4f431d['shift']());}};_0x4f31e1(++_0xd51a3b);}(_0xb422,0x179));var _0x2b42=function(_0x4d77b8,_0x208e64){_0x4d77b8=_0x4d77b8-0x0;var _0x82da62=_0xb422[_0x4d77b8];return _0x82da62;};'use strict';var multer=require(_0x2b42('0x0'));var util=require(_0x2b42('0x1'));var path=require(_0x2b42('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2b42('0x3')]();var auth=require(_0x2b42('0x4'));var interaction=require(_0x2b42('0x5'));var config=require(_0x2b42('0x6'));var controller=require(_0x2b42('0x7'));router[_0x2b42('0x8')]('/',auth['isAuthenticated'](),controller[_0x2b42('0x9')]);router[_0x2b42('0x8')](_0x2b42('0xa'),auth[_0x2b42('0xb')](),controller['show']);router[_0x2b42('0xc')]('/',auth[_0x2b42('0xb')](),controller[_0x2b42('0xd')]);router['put'](_0x2b42('0xa'),auth[_0x2b42('0xb')](),controller[_0x2b42('0xe')]);router[_0x2b42('0xf')](_0x2b42('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x2b42('0x10')]=router; \ No newline at end of file +var _0xfe54=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','update','exports','multer'];(function(_0x42314c,_0x56f7d6){var _0x4edfd9=function(_0x25037d){while(--_0x25037d){_0x42314c['push'](_0x42314c['shift']());}};_0x4edfd9(++_0x56f7d6);}(_0xfe54,0xa9));var _0x4fe5=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xfe54[_0x432682];return _0x463d05;};'use strict';var multer=require(_0x4fe5('0x0'));var util=require(_0x4fe5('0x1'));var path=require(_0x4fe5('0x2'));var timeout=require(_0x4fe5('0x3'));var express=require(_0x4fe5('0x4'));var router=express[_0x4fe5('0x5')]();var auth=require(_0x4fe5('0x6'));var interaction=require(_0x4fe5('0x7'));var config=require(_0x4fe5('0x8'));var controller=require(_0x4fe5('0x9'));router[_0x4fe5('0xa')]('/',auth[_0x4fe5('0xb')](),controller[_0x4fe5('0xc')]);router['get'](_0x4fe5('0xd'),auth['isAuthenticated'](),controller[_0x4fe5('0xe')]);router['post']('/',auth[_0x4fe5('0xb')](),controller['create']);router['put']('/:id',auth[_0x4fe5('0xb')](),controller[_0x4fe5('0xf')]);router['delete']('/:id',auth[_0x4fe5('0xb')](),controller['destroy']);module[_0x4fe5('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 73f2a9b..471320b 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 _0x34e9=['format','sequelize','moment','exports','STRING','DATE'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x34e9,0xcd));var _0x934e=function(_0x1c99fa,_0x346c4d){_0x1c99fa=_0x1c99fa-0x0;var _0x14c9a4=_0x34e9[_0x1c99fa];return _0x14c9a4;};'use strict';var Sequelize=require(_0x934e('0x0'));var moment=require(_0x934e('0x1'));module[_0x934e('0x2')]={'time':{'type':Sequelize[_0x934e('0x3')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x934e('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x934e('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x934e('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x934e('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x934e('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x934e('0x4')],'allowNull':![],'defaultValue':moment()[_0x934e('0x5')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file +var _0x82e8=['moment','exports','STRING','DATE','format'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x82e8,0xbe));var _0x882e=function(_0x3a4061,_0x57aa2a){_0x3a4061=_0x3a4061-0x0;var _0x51814c=_0x82e8[_0x3a4061];return _0x51814c;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x882e('0x0'));module[_0x882e('0x1')]={'time':{'type':Sequelize[_0x882e('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x882e('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x882e('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x882e('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x882e('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x882e('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x882e('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x882e('0x3')],'allowNull':![],'defaultValue':moment()[_0x882e('0x4')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 61f3209..82277c2 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 _0xb18b=['../../config/utils','../../config/environment','sendStatus','status','end','json','count','set','Content-Range','apply','reject','save','update','then','error','stack','send','index','map','VoiceQueuesLog','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','limit','offset','order','sort','where','pick','filter','merge','VIRTUAL','name','options','includeAll','include','findAll','rawAttributes','intersection','find','catch','create','body','params','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x5db891,_0x388e4b){var _0x45ce84=function(_0x26b4ff){while(--_0x26b4ff){_0x5db891['push'](_0x5db891['shift']());}};_0x45ce84(++_0x388e4b);}(_0xb18b,0x1dd));var _0xbb18=function(_0x25cb8a,_0x20a64a){_0x25cb8a=_0x25cb8a-0x0;var _0x30c640=_0xb18b[_0x25cb8a];return _0x30c640;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbb18('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbb18('0x1'));var rp=require(_0xbb18('0x2'));var moment=require(_0xbb18('0x3'));var BPromise=require(_0xbb18('0x4'));var Mustache=require(_0xbb18('0x5'));var util=require('util');var path=require('path');var sox=require(_0xbb18('0x6'));var csv=require(_0xbb18('0x7'));var ejs=require(_0xbb18('0x8'));var fs=require('fs');var _=require(_0xbb18('0x9'));var squel=require(_0xbb18('0xa'));var crypto=require(_0xbb18('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xbb18('0xc'));var toCsv=require(_0xbb18('0x7'));var querystring=require(_0xbb18('0xd'));var Papa=require(_0xbb18('0xe'));var Redis=require(_0xbb18('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbb18('0x10'));var hardwareService=require(_0xbb18('0x11'));var logger=require(_0xbb18('0x12'))(_0xbb18('0x13'));var utils=require(_0xbb18('0x14'));var config=require(_0xbb18('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c77b7,_0xcfee48){_0xcfee48=_0xcfee48||0xcc;return function(_0x4ecd88){if(_0x4ecd88){return _0x3c77b7[_0xbb18('0x16')](_0xcfee48);}return _0x3c77b7[_0xbb18('0x17')](_0xcfee48)[_0xbb18('0x18')]();};}function respondWithResult(_0x2bd473,_0x39d5bb){_0x39d5bb=_0x39d5bb||0xc8;return function(_0x384bf7){if(_0x384bf7){return _0x2bd473[_0xbb18('0x17')](_0x39d5bb)[_0xbb18('0x19')](_0x384bf7);}};}function respondWithFilteredResult(_0x4a07de,_0x3d113b){return function(_0x4473fe){if(_0x4473fe){var _0x330e04=_0x4473fe[_0xbb18('0x1a')],_0x5c3f5d=_0x3d113b['offset'],_0x1be62=_0x3d113b['offset']+_0x3d113b['limit'],_0x202f4b;if(_0x1be62>=_0x330e04){_0x1be62=_0x330e04;_0x202f4b=0xc8;}else{_0x202f4b=0xce;}_0x4a07de[_0xbb18('0x17')](_0x202f4b);return _0x4a07de[_0xbb18('0x1b')](_0xbb18('0x1c'),_0x5c3f5d+'-'+_0x1be62+'/'+_0x330e04)[_0xbb18('0x19')](_0x4473fe);}return null;};}function patchUpdates(_0x80144a){return function(_0x33e25d){try{jsonpatch[_0xbb18('0x1d')](_0x33e25d,_0x80144a,!![]);}catch(_0x18cf63){return BPromise[_0xbb18('0x1e')](_0x18cf63);}return _0x33e25d[_0xbb18('0x1f')]();};}function saveUpdates(_0x39013f,_0xc28f8e){return function(_0x2b8781){if(_0x2b8781){return _0x2b8781[_0xbb18('0x20')](_0x39013f)[_0xbb18('0x21')](function(_0x3eff50){return _0x3eff50;});}return null;};}function removeEntity(_0x16f763,_0xcae70c){return function(_0x22726f){if(_0x22726f){return _0x22726f['destroy']()[_0xbb18('0x21')](function(){_0x16f763[_0xbb18('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15b2e7,_0x44c96e){return function(_0x58f129){if(!_0x58f129){_0x15b2e7[_0xbb18('0x16')](0x194);}return _0x58f129;};}function handleError(_0x2320ea,_0x3ba61b){_0x3ba61b=_0x3ba61b||0x1f4;return function(_0x3debd7){logger[_0xbb18('0x22')](_0x3debd7[_0xbb18('0x23')]);if(_0x3debd7['name']){delete _0x3debd7['name'];}_0x2320ea['status'](_0x3ba61b)[_0xbb18('0x24')](_0x3debd7);};}exports[_0xbb18('0x25')]=function(_0x31b65a,_0x9f44d4){var _0x2b165b={},_0x2d6b73={},_0x1e1aa4={'count':0x0,'rows':[]};var _0x447b01=_[_0xbb18('0x26')](db[_0xbb18('0x27')]['rawAttributes'],function(_0x4eef25){return{'name':_0x4eef25['fieldName'],'type':_0x4eef25[_0xbb18('0x28')][_0xbb18('0x29')]};});_0x2d6b73[_0xbb18('0x2a')]=_[_0xbb18('0x26')](_0x447b01,'name');_0x2d6b73['query']=_[_0xbb18('0x2b')](_0x31b65a[_0xbb18('0x2c')]);_0x2d6b73[_0xbb18('0x2d')]=_['intersection'](_0x2d6b73[_0xbb18('0x2a')],_0x2d6b73[_0xbb18('0x2c')]);_0x2b165b[_0xbb18('0x2e')]=_['intersection'](_0x2d6b73[_0xbb18('0x2a')],qs[_0xbb18('0x2f')](_0x31b65a[_0xbb18('0x2c')][_0xbb18('0x2f')]));_0x2b165b[_0xbb18('0x2e')]=_0x2b165b[_0xbb18('0x2e')][_0xbb18('0x30')]?_0x2b165b['attributes']:_0x2d6b73[_0xbb18('0x2a')];if(!_0x31b65a[_0xbb18('0x2c')][_0xbb18('0x31')]('nolimit')){_0x2b165b[_0xbb18('0x32')]=qs[_0xbb18('0x32')](_0x31b65a[_0xbb18('0x2c')]['limit']);_0x2b165b['offset']=qs['offset'](_0x31b65a[_0xbb18('0x2c')][_0xbb18('0x33')]);}_0x2b165b[_0xbb18('0x34')]=qs[_0xbb18('0x35')](_0x31b65a[_0xbb18('0x2c')][_0xbb18('0x35')]);_0x2b165b[_0xbb18('0x36')]=qs['filters'](_[_0xbb18('0x37')](_0x31b65a[_0xbb18('0x2c')],_0x2d6b73['filters']));if(_0x31b65a[_0xbb18('0x2c')][_0xbb18('0x38')]){_0x2b165b[_0xbb18('0x36')]=_[_0xbb18('0x39')](_0x2b165b[_0xbb18('0x36')],{'$or':_['map'](_0x447b01,function(_0x41809e){if(_0x41809e['type']!==_0xbb18('0x3a')){var _0x4b474e={};_0x4b474e[_0x41809e[_0xbb18('0x3b')]]={'$like':'%'+_0x31b65a[_0xbb18('0x2c')][_0xbb18('0x38')]+'%'};return _0x4b474e;}})});}_0x2b165b=_[_0xbb18('0x39')]({},_0x2b165b,_0x31b65a[_0xbb18('0x3c')]);var _0x1384d8={'where':_0x2b165b['where']};return db[_0xbb18('0x27')]['count'](_0x1384d8)[_0xbb18('0x21')](function(_0x373b20){_0x1e1aa4[_0xbb18('0x1a')]=_0x373b20;if(_0x31b65a['query'][_0xbb18('0x3d')]){_0x2b165b[_0xbb18('0x3e')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0xbb18('0x3f')](_0x2b165b);})['then'](function(_0x2bfa3e){_0x1e1aa4['rows']=_0x2bfa3e;return _0x1e1aa4;})[_0xbb18('0x21')](respondWithFilteredResult(_0x9f44d4,_0x2b165b))['catch'](handleError(_0x9f44d4,null));};exports['show']=function(_0x5279dc,_0x4559bf){var _0x50829b={'raw':!![],'where':{'id':_0x5279dc['params']['id']}},_0x1236f7={};_0x1236f7['model']=_['keys'](db['VoiceQueuesLog'][_0xbb18('0x40')]);_0x1236f7[_0xbb18('0x2c')]=_['keys'](_0x5279dc[_0xbb18('0x2c')]);_0x1236f7[_0xbb18('0x2d')]=_[_0xbb18('0x41')](_0x1236f7[_0xbb18('0x2a')],_0x1236f7['query']);_0x50829b[_0xbb18('0x2e')]=_['intersection'](_0x1236f7['model'],qs[_0xbb18('0x2f')](_0x5279dc[_0xbb18('0x2c')][_0xbb18('0x2f')]));_0x50829b['attributes']=_0x50829b['attributes'][_0xbb18('0x30')]?_0x50829b[_0xbb18('0x2e')]:_0x1236f7['model'];if(_0x5279dc[_0xbb18('0x2c')][_0xbb18('0x3d')]){_0x50829b['include']=[{'all':!![]}];}_0x50829b=_[_0xbb18('0x39')]({},_0x50829b,_0x5279dc[_0xbb18('0x3c')]);return db[_0xbb18('0x27')][_0xbb18('0x42')](_0x50829b)['then'](handleEntityNotFound(_0x4559bf,null))['then'](respondWithResult(_0x4559bf,null))[_0xbb18('0x43')](handleError(_0x4559bf,null));};exports[_0xbb18('0x44')]=function(_0x2f6610,_0x324d40){return db['VoiceQueuesLog'][_0xbb18('0x44')](_0x2f6610[_0xbb18('0x45')],{})['then'](respondWithResult(_0x324d40,0xc9))[_0xbb18('0x43')](handleError(_0x324d40,null));};exports['update']=function(_0x4e5933,_0x53ad01){if(_0x4e5933[_0xbb18('0x45')]['id']){delete _0x4e5933['body']['id'];}return db[_0xbb18('0x27')][_0xbb18('0x42')]({'where':{'id':_0x4e5933[_0xbb18('0x46')]['id']}})['then'](handleEntityNotFound(_0x53ad01,null))[_0xbb18('0x21')](saveUpdates(_0x4e5933[_0xbb18('0x45')],null))[_0xbb18('0x21')](respondWithResult(_0x53ad01,null))[_0xbb18('0x43')](handleError(_0x53ad01,null));};exports['destroy']=function(_0x1fa459,_0x2e529e){return db['VoiceQueuesLog'][_0xbb18('0x42')]({'where':{'id':_0x1fa459[_0xbb18('0x46')]['id']}})[_0xbb18('0x21')](handleEntityNotFound(_0x2e529e,null))[_0xbb18('0x21')](removeEntity(_0x2e529e,null))['catch'](handleError(_0x2e529e,null));}; \ No newline at end of file +var _0xf408=['length','nolimit','limit','order','sort','where','pick','VIRTUAL','filter','merge','options','count','includeAll','findAll','catch','show','params','fields','include','find','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','offset','set','Content-Range','json','apply','reject','save','update','then','end','error','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','name','keys','query','filters','intersection','attributes','model'];(function(_0x219ce3,_0x535de0){var _0x13da3c=function(_0x8417f5){while(--_0x8417f5){_0x219ce3['push'](_0x219ce3['shift']());}};_0x13da3c(++_0x535de0);}(_0xf408,0xac));var _0x8f40=function(_0x46bb73,_0x44f394){_0x46bb73=_0x46bb73-0x0;var _0x44f271=_0xf408[_0x46bb73];return _0x44f271;};'use strict';var pdf=require(_0x8f40('0x0'));var emlformat=require(_0x8f40('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8f40('0x2'));var jsonpatch=require(_0x8f40('0x3'));var rp=require('request-promise');var moment=require(_0x8f40('0x4'));var BPromise=require(_0x8f40('0x5'));var Mustache=require('mustache');var util=require(_0x8f40('0x6'));var path=require(_0x8f40('0x7'));var sox=require(_0x8f40('0x8'));var csv=require(_0x8f40('0x9'));var ejs=require(_0x8f40('0xa'));var fs=require('fs');var _=require(_0x8f40('0xb'));var squel=require(_0x8f40('0xc'));var crypto=require(_0x8f40('0xd'));var jsforce=require(_0x8f40('0xe'));var deskjs=require(_0x8f40('0xf'));var toCsv=require(_0x8f40('0x9'));var querystring=require(_0x8f40('0x10'));var Papa=require(_0x8f40('0x11'));var Redis=require(_0x8f40('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8f40('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8f40('0x14'));var logger=require(_0x8f40('0x15'))(_0x8f40('0x16'));var utils=require(_0x8f40('0x17'));var config=require('../../config/environment');var db=require(_0x8f40('0x18'))['db'];function respondWithStatusCode(_0x5a5119,_0x424b71){_0x424b71=_0x424b71||0xcc;return function(_0x3e148a){if(_0x3e148a){return _0x5a5119[_0x8f40('0x19')](_0x424b71);}return _0x5a5119[_0x8f40('0x1a')](_0x424b71)['end']();};}function respondWithResult(_0x13b55e,_0x1b2af3){_0x1b2af3=_0x1b2af3||0xc8;return function(_0x3ea79b){if(_0x3ea79b){return _0x13b55e[_0x8f40('0x1a')](_0x1b2af3)['json'](_0x3ea79b);}};}function respondWithFilteredResult(_0x454753,_0x448e79){return function(_0x536af2){if(_0x536af2){var _0x1cdfcb=_0x536af2['count'],_0x5364aa=_0x448e79[_0x8f40('0x1b')],_0x42f700=_0x448e79['offset']+_0x448e79['limit'],_0x5c2aa9;if(_0x42f700>=_0x1cdfcb){_0x42f700=_0x1cdfcb;_0x5c2aa9=0xc8;}else{_0x5c2aa9=0xce;}_0x454753['status'](_0x5c2aa9);return _0x454753[_0x8f40('0x1c')](_0x8f40('0x1d'),_0x5364aa+'-'+_0x42f700+'/'+_0x1cdfcb)[_0x8f40('0x1e')](_0x536af2);}return null;};}function patchUpdates(_0x419690){return function(_0x49b5a4){try{jsonpatch[_0x8f40('0x1f')](_0x49b5a4,_0x419690,!![]);}catch(_0x515225){return BPromise[_0x8f40('0x20')](_0x515225);}return _0x49b5a4[_0x8f40('0x21')]();};}function saveUpdates(_0x1c6dd7,_0x4d437e){return function(_0x3df6cc){if(_0x3df6cc){return _0x3df6cc[_0x8f40('0x22')](_0x1c6dd7)[_0x8f40('0x23')](function(_0x446e38){return _0x446e38;});}return null;};}function removeEntity(_0xe468fe,_0x3de23e){return function(_0x1d1f56){if(_0x1d1f56){return _0x1d1f56['destroy']()[_0x8f40('0x23')](function(){_0xe468fe[_0x8f40('0x1a')](0xcc)[_0x8f40('0x24')]();});}};}function handleEntityNotFound(_0x448fa7,_0x44499d){return function(_0xeecf3a){if(!_0xeecf3a){_0x448fa7['sendStatus'](0x194);}return _0xeecf3a;};}function handleError(_0x345742,_0x257227){_0x257227=_0x257227||0x1f4;return function(_0x5afca1){logger[_0x8f40('0x25')](_0x5afca1['stack']);if(_0x5afca1['name']){delete _0x5afca1['name'];}_0x345742[_0x8f40('0x1a')](_0x257227)[_0x8f40('0x26')](_0x5afca1);};}exports[_0x8f40('0x27')]=function(_0x5ccdb7,_0x2d9ed5){var _0x992fd4={},_0x324004={},_0x5f2f99={'count':0x0,'rows':[]};var _0x126419=_[_0x8f40('0x28')](db[_0x8f40('0x29')][_0x8f40('0x2a')],function(_0x13a1bc){return{'name':_0x13a1bc[_0x8f40('0x2b')],'type':_0x13a1bc[_0x8f40('0x2c')][_0x8f40('0x2d')]};});_0x324004['model']=_[_0x8f40('0x28')](_0x126419,_0x8f40('0x2e'));_0x324004['query']=_[_0x8f40('0x2f')](_0x5ccdb7[_0x8f40('0x30')]);_0x324004[_0x8f40('0x31')]=_[_0x8f40('0x32')](_0x324004['model'],_0x324004[_0x8f40('0x30')]);_0x992fd4[_0x8f40('0x33')]=_[_0x8f40('0x32')](_0x324004[_0x8f40('0x34')],qs['fields'](_0x5ccdb7['query']['fields']));_0x992fd4[_0x8f40('0x33')]=_0x992fd4[_0x8f40('0x33')][_0x8f40('0x35')]?_0x992fd4[_0x8f40('0x33')]:_0x324004[_0x8f40('0x34')];if(!_0x5ccdb7[_0x8f40('0x30')]['hasOwnProperty'](_0x8f40('0x36'))){_0x992fd4[_0x8f40('0x37')]=qs[_0x8f40('0x37')](_0x5ccdb7[_0x8f40('0x30')][_0x8f40('0x37')]);_0x992fd4[_0x8f40('0x1b')]=qs[_0x8f40('0x1b')](_0x5ccdb7[_0x8f40('0x30')]['offset']);}_0x992fd4[_0x8f40('0x38')]=qs['sort'](_0x5ccdb7[_0x8f40('0x30')][_0x8f40('0x39')]);_0x992fd4[_0x8f40('0x3a')]=qs['filters'](_[_0x8f40('0x3b')](_0x5ccdb7[_0x8f40('0x30')],_0x324004[_0x8f40('0x31')]));if(_0x5ccdb7[_0x8f40('0x30')]['filter']){_0x992fd4[_0x8f40('0x3a')]=_['merge'](_0x992fd4[_0x8f40('0x3a')],{'$or':_[_0x8f40('0x28')](_0x126419,function(_0x1ae4c0){if(_0x1ae4c0[_0x8f40('0x2c')]!==_0x8f40('0x3c')){var _0x4d5447={};_0x4d5447[_0x1ae4c0[_0x8f40('0x2e')]]={'$like':'%'+_0x5ccdb7[_0x8f40('0x30')][_0x8f40('0x3d')]+'%'};return _0x4d5447;}})});}_0x992fd4=_[_0x8f40('0x3e')]({},_0x992fd4,_0x5ccdb7[_0x8f40('0x3f')]);var _0x3bed63={'where':_0x992fd4[_0x8f40('0x3a')]};return db[_0x8f40('0x29')][_0x8f40('0x40')](_0x3bed63)[_0x8f40('0x23')](function(_0x45ebcc){_0x5f2f99[_0x8f40('0x40')]=_0x45ebcc;if(_0x5ccdb7['query'][_0x8f40('0x41')]){_0x992fd4['include']=[{'all':!![]}];}return db[_0x8f40('0x29')][_0x8f40('0x42')](_0x992fd4);})[_0x8f40('0x23')](function(_0x1588a6){_0x5f2f99['rows']=_0x1588a6;return _0x5f2f99;})[_0x8f40('0x23')](respondWithFilteredResult(_0x2d9ed5,_0x992fd4))[_0x8f40('0x43')](handleError(_0x2d9ed5,null));};exports[_0x8f40('0x44')]=function(_0x3460ae,_0x14cdad){var _0x5066fc={'raw':!![],'where':{'id':_0x3460ae[_0x8f40('0x45')]['id']}},_0x37ac6f={};_0x37ac6f[_0x8f40('0x34')]=_['keys'](db[_0x8f40('0x29')]['rawAttributes']);_0x37ac6f[_0x8f40('0x30')]=_['keys'](_0x3460ae[_0x8f40('0x30')]);_0x37ac6f[_0x8f40('0x31')]=_[_0x8f40('0x32')](_0x37ac6f[_0x8f40('0x34')],_0x37ac6f[_0x8f40('0x30')]);_0x5066fc['attributes']=_[_0x8f40('0x32')](_0x37ac6f['model'],qs[_0x8f40('0x46')](_0x3460ae[_0x8f40('0x30')][_0x8f40('0x46')]));_0x5066fc[_0x8f40('0x33')]=_0x5066fc['attributes'][_0x8f40('0x35')]?_0x5066fc['attributes']:_0x37ac6f[_0x8f40('0x34')];if(_0x3460ae[_0x8f40('0x30')][_0x8f40('0x41')]){_0x5066fc[_0x8f40('0x47')]=[{'all':!![]}];}_0x5066fc=_[_0x8f40('0x3e')]({},_0x5066fc,_0x3460ae[_0x8f40('0x3f')]);return db[_0x8f40('0x29')][_0x8f40('0x48')](_0x5066fc)[_0x8f40('0x23')](handleEntityNotFound(_0x14cdad,null))[_0x8f40('0x23')](respondWithResult(_0x14cdad,null))[_0x8f40('0x43')](handleError(_0x14cdad,null));};exports['create']=function(_0x15b00f,_0x352eae){return db['VoiceQueuesLog'][_0x8f40('0x49')](_0x15b00f[_0x8f40('0x4a')],{})[_0x8f40('0x23')](respondWithResult(_0x352eae,0xc9))[_0x8f40('0x43')](handleError(_0x352eae,null));};exports[_0x8f40('0x22')]=function(_0x5c50f7,_0x98e4db){if(_0x5c50f7[_0x8f40('0x4a')]['id']){delete _0x5c50f7[_0x8f40('0x4a')]['id'];}return db['VoiceQueuesLog']['find']({'where':{'id':_0x5c50f7['params']['id']}})[_0x8f40('0x23')](handleEntityNotFound(_0x98e4db,null))[_0x8f40('0x23')](saveUpdates(_0x5c50f7['body'],null))['then'](respondWithResult(_0x98e4db,null))[_0x8f40('0x43')](handleError(_0x98e4db,null));};exports['destroy']=function(_0x332752,_0x5f1fd3){return db[_0x8f40('0x29')][_0x8f40('0x48')]({'where':{'id':_0x332752['params']['id']}})[_0x8f40('0x23')](handleEntityNotFound(_0x5f1fd3,null))['then'](removeEntity(_0x5f1fd3,null))[_0x8f40('0x43')](handleError(_0x5f1fd3,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index bc78a7e..0d8d6e8 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 _0x3c5e=['./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','dtm','../../config/logger','api','moment','request-promise','../../config/environment'];(function(_0x18cac4,_0x57a4d5){var _0x2227c6=function(_0x72934d){while(--_0x72934d){_0x18cac4['push'](_0x18cac4['shift']());}};_0x2227c6(++_0x57a4d5);}(_0x3c5e,0x171));var _0xe3c5=function(_0x3faad2,_0x361b2a){_0x3faad2=_0x3faad2-0x0;var _0x40a37c=_0x3c5e[_0x3faad2];return _0x40a37c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe3c5('0x0'))(_0xe3c5('0x1'));var moment=require(_0xe3c5('0x2'));var BPromise=require('bluebird');var rp=require(_0xe3c5('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe3c5('0x4'));var attributes=require(_0xe3c5('0x5'));module[_0xe3c5('0x6')]=function(_0x2dae7c,_0x392f72){return _0x2dae7c[_0xe3c5('0x7')](_0xe3c5('0x8'),attributes,{'tableName':_0xe3c5('0x9'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':['event',_0xe3c5('0xa')]}],'timestamps':![]});}; \ No newline at end of file +var _0xb7aa=['./voiceQueuesLog.attributes','exports','VoiceQueuesLog','voice_queues_log','event_dtm','event','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x1842be,_0x34c11d){var _0x5ccfa5=function(_0x4c0f2f){while(--_0x4c0f2f){_0x1842be['push'](_0x1842be['shift']());}};_0x5ccfa5(++_0x34c11d);}(_0xb7aa,0xd6));var _0xab7a=function(_0x50424b,_0x38b71b){_0x50424b=_0x50424b-0x0;var _0x2b67e7=_0xb7aa[_0x50424b];return _0x2b67e7;};'use strict';var _=require('lodash');var util=require(_0xab7a('0x0'));var logger=require(_0xab7a('0x1'))(_0xab7a('0x2'));var moment=require(_0xab7a('0x3'));var BPromise=require(_0xab7a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xab7a('0x5'));var config=require(_0xab7a('0x6'));var attributes=require(_0xab7a('0x7'));module[_0xab7a('0x8')]=function(_0x4e1746,_0x4d7c21){return _0x4e1746['define'](_0xab7a('0x9'),attributes,{'tableName':_0xab7a('0xa'),'paranoid':![],'indexes':[{'name':_0xab7a('0xb'),'fields':[_0xab7a('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 746fc23..371386c 100644 --- a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js +++ b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa45c=['code','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x52121e,_0x4e7ac8){var _0x2d7778=function(_0x41775c){while(--_0x41775c){_0x52121e['push'](_0x52121e['shift']());}};_0x2d7778(++_0x4e7ac8);}(_0xa45c,0x6d));var _0xca45=function(_0x466185,_0x24eaeb){_0x466185=_0x466185-0x0;var _0x4fa358=_0xa45c[_0x466185];return _0x4fa358;};'use strict';var _=require(_0xca45('0x0'));var util=require(_0xca45('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xca45('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca45('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xca45('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xca45('0x5'));var client=jayson[_0xca45('0x6')][_0xca45('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15628b,_0x578a7b,_0x1a8b9c){return new BPromise(function(_0x276897,_0x7ceab1){return client[_0xca45('0x8')](_0x15628b,_0x1a8b9c)[_0xca45('0x9')](function(_0x5c18b9){logger[_0xca45('0xa')](_0xca45('0xb'),_0x578a7b,_0xca45('0xc'));logger[_0xca45('0xd')](_0xca45('0xe'),_0x578a7b,_0xca45('0xc'),JSON[_0xca45('0xf')](_0x5c18b9));if(_0x5c18b9['error']){if(_0x5c18b9[_0xca45('0x10')][_0xca45('0x11')]===0x1f4){logger[_0xca45('0x10')](_0xca45('0xb'),_0x578a7b,_0x5c18b9['error'][_0xca45('0x12')]);return _0x7ceab1(_0x5c18b9[_0xca45('0x10')][_0xca45('0x12')]);}logger['error'](_0xca45('0xb'),_0x578a7b,_0x5c18b9['error'][_0xca45('0x12')]);return _0x276897(_0x5c18b9[_0xca45('0x10')][_0xca45('0x12')]);}else{logger[_0xca45('0xa')](_0xca45('0xb'),_0x578a7b,_0xca45('0xc'));_0x276897(_0x5c18b9[_0xca45('0x13')]['message']);}})[_0xca45('0x14')](function(_0x5b4e29){logger['error'](_0xca45('0xb'),_0x578a7b,_0x5b4e29);_0x7ceab1(_0x5b4e29);});});} \ No newline at end of file +var _0xac4a=['VoiceQueuesLog,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xac4a,0x13f));var _0xaac4=function(_0x3f7b70,_0x517e53){_0x3f7b70=_0x3f7b70-0x0;var _0xfa9843=_0xac4a[_0x3f7b70];return _0xfa9843;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('VoiceQueuesLog,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 5d0b0b8..00d51f7 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 _0x9acb=['downloads','post','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','/:id/downloads'];(function(_0x6fc0ad,_0x428839){var _0x3f894c=function(_0x12516c){while(--_0x12516c){_0x6fc0ad['push'](_0x6fc0ad['shift']());}};_0x3f894c(++_0x428839);}(_0x9acb,0xd5));var _0xb9ac=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x9acb[_0x2d7f0e];return _0x110b07;};'use strict';var multer=require(_0xb9ac('0x0'));var util=require('util');var path=require(_0xb9ac('0x1'));var timeout=require(_0xb9ac('0x2'));var express=require(_0xb9ac('0x3'));var router=express['Router']();var auth=require(_0xb9ac('0x4'));var interaction=require(_0xb9ac('0x5'));var config=require('../../config/environment');var controller=require(_0xb9ac('0x6'));router[_0xb9ac('0x7')]('/',auth[_0xb9ac('0x8')](),controller[_0xb9ac('0x9')]);router['get'](_0xb9ac('0xa'),auth[_0xb9ac('0x8')](),controller[_0xb9ac('0xb')]);router[_0xb9ac('0x7')](_0xb9ac('0xc'),auth[_0xb9ac('0x8')](),controller[_0xb9ac('0xd')]);router[_0xb9ac('0x7')](_0xb9ac('0xe'),auth[_0xb9ac('0x8')](),controller[_0xb9ac('0xf')]);router['get'](_0xb9ac('0x10'),controller[_0xb9ac('0x11')]);router[_0xb9ac('0x12')]('/',auth[_0xb9ac('0x8')](),controller['create']);router['put'](_0xb9ac('0xc'),auth[_0xb9ac('0x8')](),controller[_0xb9ac('0x13')]);router[_0xb9ac('0x14')](_0xb9ac('0xc'),auth['isAuthenticated'](),controller[_0xb9ac('0x15')]);module[_0xb9ac('0x16')]=router; \ No newline at end of file +var _0x6981=['get','isAuthenticated','index','/describe','/:id','show','/:id/download','download','/:id/downloads','downloads','post','create','put','update','delete','destroy','exports','multer','util','Router','../../components/interaction/service','../../config/environment','./voiceRecording.controller'];(function(_0x2a08bd,_0x5c9342){var _0x516ae9=function(_0x29a87b){while(--_0x29a87b){_0x2a08bd['push'](_0x2a08bd['shift']());}};_0x516ae9(++_0x5c9342);}(_0x6981,0x6d));var _0x1698=function(_0xf2c3a0,_0x1f2309){_0xf2c3a0=_0xf2c3a0-0x0;var _0x39d68b=_0x6981[_0xf2c3a0];return _0x39d68b;};'use strict';var multer=require(_0x1698('0x0'));var util=require(_0x1698('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1698('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x1698('0x3'));var config=require(_0x1698('0x4'));var controller=require(_0x1698('0x5'));router[_0x1698('0x6')]('/',auth[_0x1698('0x7')](),controller[_0x1698('0x8')]);router['get'](_0x1698('0x9'),auth[_0x1698('0x7')](),controller['describe']);router[_0x1698('0x6')](_0x1698('0xa'),auth['isAuthenticated'](),controller[_0x1698('0xb')]);router[_0x1698('0x6')](_0x1698('0xc'),auth[_0x1698('0x7')](),controller[_0x1698('0xd')]);router[_0x1698('0x6')](_0x1698('0xe'),controller[_0x1698('0xf')]);router[_0x1698('0x10')]('/',auth[_0x1698('0x7')](),controller[_0x1698('0x11')]);router[_0x1698('0x12')](_0x1698('0xa'),auth[_0x1698('0x7')](),controller[_0x1698('0x13')]);router[_0x1698('0x14')](_0x1698('0xa'),auth['isAuthenticated'](),controller[_0x1698('0x15')]);module[_0x1698('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 3c03d7f..5e22407 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 _0x108b=['STRING','setDataValue','channel','membername','createdAt','format','MM-DD-YYYY\x20HH:mm','toString','DATE','updatedAt','moment','VIRTUAL','getDataValue','value','extname'];(function(_0x178b4a,_0x26620f){var _0xd63d65=function(_0x590bf6){while(--_0x590bf6){_0x178b4a['push'](_0x178b4a['shift']());}};_0xd63d65(++_0x26620f);}(_0x108b,0x190));var _0xb108=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x108b[_0x5f09c5];return _0x426ad9;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb108('0x0'));var path=require('path');module['exports']={'format':{'type':Sequelize[_0xb108('0x1')],'get':function(){return this[_0xb108('0x2')](_0xb108('0x3'))?path[_0xb108('0x4')](this[_0xb108('0x2')](_0xb108('0x3'))):undefined;}},'uniqueid':{'type':Sequelize[_0xb108('0x5')]},'channel':{'type':Sequelize[_0xb108('0x5')],'set':function(_0x166630){if(_0x166630){this[_0xb108('0x6')](_0xb108('0x7'),_0x166630);this[_0xb108('0x6')](_0xb108('0x8'),_0x166630['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0xb108('0x5')]},'calleridnum':{'type':Sequelize[_0xb108('0x5')]},'calleridname':{'type':Sequelize[_0xb108('0x5')]},'connectedlinenum':{'type':Sequelize[_0xb108('0x5')]},'connectedlinename':{'type':Sequelize[_0xb108('0x5')]},'accountcode':{'type':Sequelize[_0xb108('0x5')]},'context':{'type':Sequelize[_0xb108('0x5')]},'exten':{'type':Sequelize[_0xb108('0x5')]},'value':{'type':Sequelize[_0xb108('0x5')]},'type':{'type':Sequelize[_0xb108('0x5')]},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xb108('0x2')](_0xb108('0x9')))[_0xb108('0xa')](_0xb108('0xb'))[_0xb108('0xc')]();}},'updatedAt':{'type':Sequelize[_0xb108('0xd')],'get':function(){return moment(this[_0xb108('0x2')](_0xb108('0xe')))[_0xb108('0xa')](_0xb108('0xb'))[_0xb108('0xc')]();}}}; \ No newline at end of file +var _0x6025=['MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','path','exports','VIRTUAL','getDataValue','value','extname','STRING','setDataValue','channel','membername','split','INTEGER','createdAt','format'];(function(_0x2b94d5,_0x3b8853){var _0x3217c0=function(_0x4720c2){while(--_0x4720c2){_0x2b94d5['push'](_0x2b94d5['shift']());}};_0x3217c0(++_0x3b8853);}(_0x6025,0x135));var _0x5602=function(_0x8daf39,_0x2eae0c){_0x8daf39=_0x8daf39-0x0;var _0x49400f=_0x6025[_0x8daf39];return _0x49400f;};'use strict';var Sequelize=require(_0x5602('0x0'));var moment=require('moment');var path=require(_0x5602('0x1'));module[_0x5602('0x2')]={'format':{'type':Sequelize[_0x5602('0x3')],'get':function(){return this[_0x5602('0x4')](_0x5602('0x5'))?path[_0x5602('0x6')](this[_0x5602('0x4')](_0x5602('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x5602('0x7')]},'channel':{'type':Sequelize['STRING'],'set':function(_0x27fd06){if(_0x27fd06){this[_0x5602('0x8')](_0x5602('0x9'),_0x27fd06);this[_0x5602('0x8')](_0x5602('0xa'),_0x27fd06[_0x5602('0xb')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x5602('0x7')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x5602('0x7')]},'connectedlinename':{'type':Sequelize[_0x5602('0x7')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x5602('0x7')]},'exten':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x5602('0x7')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize[_0x5602('0xc')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x5602('0x7')]},'userDisposition':{'type':Sequelize[_0x5602('0x7')]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x5602('0x4')](_0x5602('0xd')))[_0x5602('0xe')](_0x5602('0xf'))[_0x5602('0x10')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x5602('0x4')](_0x5602('0x11')))[_0x5602('0xe')](_0x5602('0xf'))[_0x5602('0x10')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index d57d628..31cb8fe 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 _0xe88d=['format','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','create','body','catch','find','describe','download','../../components/encryptor','uniqueid','params','value','%s.cypher','existsSync','decryptFile','secrets','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','Not\x20found','sequelize','MD5','col','push','$and','recording','Sequelize','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','html-pdf','rimraf','fast-json-patch','moment','bluebird','mustache','path','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','map','VoiceRecording','rawAttributes','fieldName','type','model','differenceBy'];(function(_0x192d61,_0x31eb7e){var _0x363975=function(_0x2c8048){while(--_0x2c8048){_0x192d61['push'](_0x192d61['shift']());}};_0x363975(++_0x31eb7e);}(_0xe88d,0xa1));var _0xde88=function(_0x11dc39,_0x491115){_0x11dc39=_0x11dc39-0x0;var _0x457277=_0xe88d[_0x11dc39];return _0x457277;};'use strict';var pdf=require(_0xde88('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xde88('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xde88('0x2'));var rp=require('request-promise');var moment=require(_0xde88('0x3'));var BPromise=require(_0xde88('0x4'));var Mustache=require(_0xde88('0x5'));var util=require('util');var path=require(_0xde88('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xde88('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xde88('0x8'));var deskjs=require('desk.js');var toCsv=require(_0xde88('0x9'));var querystring=require(_0xde88('0xa'));var Papa=require(_0xde88('0xb'));var Redis=require(_0xde88('0xc'));var authService=require(_0xde88('0xd'));var qs=require(_0xde88('0xe'));var as=require(_0xde88('0xf'));var hardwareService=require(_0xde88('0x10'));var logger=require(_0xde88('0x11'))(_0xde88('0x12'));var utils=require('../../config/utils');var config=require(_0xde88('0x13'));var db=require(_0xde88('0x14'))['db'];function respondWithStatusCode(_0x4b46f0,_0x321368){_0x321368=_0x321368||0xcc;return function(_0x2a8bcf){if(_0x2a8bcf){return _0x4b46f0[_0xde88('0x15')](_0x321368);}return _0x4b46f0[_0xde88('0x16')](_0x321368)[_0xde88('0x17')]();};}function respondWithResult(_0xbeda63,_0x48f364){_0x48f364=_0x48f364||0xc8;return function(_0x227124){if(_0x227124){return _0xbeda63[_0xde88('0x16')](_0x48f364)[_0xde88('0x18')](_0x227124);}};}function respondWithFilteredResult(_0x317cc9,_0x12dbec){return function(_0x184478){if(_0x184478){var _0x226021=_0x184478[_0xde88('0x19')],_0xd9ca4b=_0x12dbec['offset'],_0x36bf54=_0x12dbec['offset']+_0x12dbec[_0xde88('0x1a')],_0x38443b;if(_0x36bf54>=_0x226021){_0x36bf54=_0x226021;_0x38443b=0xc8;}else{_0x38443b=0xce;}_0x317cc9[_0xde88('0x16')](_0x38443b);return _0x317cc9[_0xde88('0x1b')](_0xde88('0x1c'),_0xd9ca4b+'-'+_0x36bf54+'/'+_0x226021)[_0xde88('0x18')](_0x184478);}return null;};}function patchUpdates(_0x40002e){return function(_0x10a618){try{jsonpatch[_0xde88('0x1d')](_0x10a618,_0x40002e,!![]);}catch(_0x5a36b0){return BPromise[_0xde88('0x1e')](_0x5a36b0);}return _0x10a618['save']();};}function saveUpdates(_0x24728a,_0x301ba0){return function(_0x58e335){if(_0x58e335){return _0x58e335[_0xde88('0x1f')](_0x24728a)[_0xde88('0x20')](function(_0x20bf18){return _0x20bf18;});}return null;};}function removeEntity(_0x84c193,_0x407e62){return function(_0x3928b1){if(_0x3928b1){return _0x3928b1[_0xde88('0x21')]()['then'](function(){_0x84c193['status'](0xcc)[_0xde88('0x17')]();});}};}function handleEntityNotFound(_0x1f4e69,_0x31048f){return function(_0x2d232e){if(!_0x2d232e){_0x1f4e69[_0xde88('0x15')](0x194);}return _0x2d232e;};}function handleError(_0x25b3d7,_0x4711ef){_0x4711ef=_0x4711ef||0x1f4;return function(_0x30f6e2){logger[_0xde88('0x22')](_0x30f6e2[_0xde88('0x23')]);if(_0x30f6e2[_0xde88('0x24')]){delete _0x30f6e2['name'];}_0x25b3d7[_0xde88('0x16')](_0x4711ef)[_0xde88('0x25')](_0x30f6e2);};}exports['index']=function(_0x41a888,_0x2b0e6c){var _0x17aec2={},_0x5a7f4d={},_0xcc1d91={'count':0x0,'rows':[]};var _0x591d2d=_[_0xde88('0x26')](db[_0xde88('0x27')][_0xde88('0x28')],function(_0x3d03cc){return{'name':_0x3d03cc[_0xde88('0x29')],'type':_0x3d03cc[_0xde88('0x2a')]['key']};});_0x5a7f4d[_0xde88('0x2b')]=_[_0xde88('0x2c')](_[_0xde88('0x26')](_0x591d2d,_0xde88('0x24')),[_0xde88('0x2d')]);_0x5a7f4d['query']=_[_0xde88('0x2e')](_0x41a888[_0xde88('0x2f')]);_0x5a7f4d[_0xde88('0x30')]=_['intersection'](_0x5a7f4d[_0xde88('0x2b')],_0x5a7f4d['query']);_0x17aec2[_0xde88('0x31')]=_[_0xde88('0x32')](_0x5a7f4d['model'],qs[_0xde88('0x33')](_0x41a888['query'][_0xde88('0x33')]));_0x17aec2[_0xde88('0x31')]=_0x17aec2[_0xde88('0x31')][_0xde88('0x34')]?_0x17aec2[_0xde88('0x31')]:_0x5a7f4d[_0xde88('0x2b')];if(!_0x41a888[_0xde88('0x2f')][_0xde88('0x35')](_0xde88('0x36'))){_0x17aec2['limit']=qs['limit'](_0x41a888[_0xde88('0x2f')][_0xde88('0x1a')]);_0x17aec2[_0xde88('0x37')]=qs['offset'](_0x41a888[_0xde88('0x2f')][_0xde88('0x37')]);}_0x17aec2[_0xde88('0x38')]=qs['sort'](_0x41a888[_0xde88('0x2f')][_0xde88('0x39')]);_0x17aec2[_0xde88('0x3a')]=qs[_0xde88('0x30')](_[_0xde88('0x3b')](_0x41a888[_0xde88('0x2f')],_0x5a7f4d[_0xde88('0x30')]));if(_0x41a888[_0xde88('0x2f')][_0xde88('0x3c')]){_0x17aec2[_0xde88('0x3a')]=_[_0xde88('0x3d')](_0x17aec2[_0xde88('0x3a')],{'$or':_[_0xde88('0x26')](_0x591d2d,function(_0x4e9714){if(_0x4e9714[_0xde88('0x2a')]!==_0xde88('0x3e')){var _0x115ef0={};_0x115ef0[_0x4e9714[_0xde88('0x24')]]={'$like':'%'+_0x41a888[_0xde88('0x2f')][_0xde88('0x3c')]+'%'};return _0x115ef0;}})});}_0x17aec2=_[_0xde88('0x3d')]({},_0x17aec2,_0x41a888[_0xde88('0x3f')]);var _0xf6b368={'where':_0x17aec2['where']};return db[_0xde88('0x27')]['count'](_0xf6b368)[_0xde88('0x20')](function(_0x529866){_0xcc1d91[_0xde88('0x19')]=_0x529866;if(_0x41a888['query'][_0xde88('0x40')]){_0x17aec2[_0xde88('0x41')]=[{'all':!![]}];}return db[_0xde88('0x27')][_0xde88('0x42')](_0x17aec2);})[_0xde88('0x20')](function(_0x3efaf7){_0xcc1d91[_0xde88('0x43')]=_0x3efaf7;return _0xcc1d91;})[_0xde88('0x20')](respondWithFilteredResult(_0x2b0e6c,_0x17aec2))['catch'](handleError(_0x2b0e6c,null));};exports[_0xde88('0x44')]=function(_0x590f56,_0x4eae50){var _0x3d4130={'raw':![],'where':{'id':_0x590f56['params']['id']}},_0x4d069d={};_0x4d069d[_0xde88('0x2b')]=_[_0xde88('0x2e')](db[_0xde88('0x27')][_0xde88('0x28')]);_0x4d069d[_0xde88('0x2f')]=_['keys'](_0x590f56[_0xde88('0x2f')]);_0x4d069d[_0xde88('0x30')]=_['intersection'](_0x4d069d[_0xde88('0x2b')],_0x4d069d[_0xde88('0x2f')]);_0x3d4130[_0xde88('0x31')]=_[_0xde88('0x32')](_0x4d069d[_0xde88('0x2b')],qs[_0xde88('0x33')](_0x590f56[_0xde88('0x2f')][_0xde88('0x33')]));_0x3d4130[_0xde88('0x31')]=_0x3d4130[_0xde88('0x31')][_0xde88('0x34')]?_0x3d4130[_0xde88('0x31')]:_0x4d069d[_0xde88('0x2b')];if(_0x590f56[_0xde88('0x2f')][_0xde88('0x40')]){_0x3d4130[_0xde88('0x41')]=[{'all':!![]}];}_0x3d4130=_[_0xde88('0x3d')]({},_0x3d4130,_0x590f56[_0xde88('0x3f')]);return db[_0xde88('0x27')]['find'](_0x3d4130)[_0xde88('0x20')](handleEntityNotFound(_0x4eae50,null))[_0xde88('0x20')](respondWithResult(_0x4eae50,null))['catch'](handleError(_0x4eae50,null));};exports['create']=function(_0x2bd47c,_0x38d101){return db[_0xde88('0x27')][_0xde88('0x45')](_0x2bd47c[_0xde88('0x46')],{})['then'](respondWithResult(_0x38d101,0xc9))[_0xde88('0x47')](handleError(_0x38d101,null));};exports[_0xde88('0x1f')]=function(_0x10e036,_0x5cc74b){if(_0x10e036[_0xde88('0x46')]['id']){delete _0x10e036[_0xde88('0x46')]['id'];}return db[_0xde88('0x27')][_0xde88('0x48')]({'where':{'id':_0x10e036['params']['id']}})[_0xde88('0x20')](handleEntityNotFound(_0x5cc74b,null))[_0xde88('0x20')](saveUpdates(_0x10e036[_0xde88('0x46')],null))[_0xde88('0x20')](respondWithResult(_0x5cc74b,null))[_0xde88('0x47')](handleError(_0x5cc74b,null));};exports[_0xde88('0x49')]=function(_0x34d6cb,_0x1953f4){return db[_0xde88('0x27')][_0xde88('0x49')]()[_0xde88('0x20')](respondWithResult(_0x1953f4,null))['catch'](handleError(_0x1953f4,null));};exports[_0xde88('0x4a')]=function(_0x2ef3c6,_0x119753,_0x543acc){var _0x33aa8c=require(_0xde88('0x4b'));var _0x10709f=![];var _0x414466={};if(_0x2ef3c6[_0xde88('0x2f')][_0xde88('0x2a')]&&_0x2ef3c6[_0xde88('0x2f')][_0xde88('0x2a')]===_0xde88('0x4c')){_0x414466[_0xde88('0x4c')]=_0x2ef3c6[_0xde88('0x4d')]['id'];}else{_0x414466['id']=_0x2ef3c6[_0xde88('0x4d')]['id'];}return db[_0xde88('0x27')][_0xde88('0x48')]({'where':_0x414466,'attributes':['id','value'],'raw':!![]})[_0xde88('0x20')](handleEntityNotFound(_0x119753,null))[_0xde88('0x20')](function(_0x130db5){if(_0x130db5){var _0x3e05bb=_0x130db5[_0xde88('0x4e')];var _0xe6323c=util[_0xde88('0x2d')](_0xde88('0x4f'),_0x3e05bb);if(fs[_0xde88('0x50')](_0xe6323c)){_0x10709f=!![];return _0x33aa8c[_0xde88('0x51')](_0xe6323c,_0x3e05bb,config[_0xde88('0x52')]['recording'])[_0xde88('0x20')](function(){return _0x130db5;});}return _0x130db5;}})[_0xde88('0x20')](function(_0x56b9d9){if(_0x56b9d9){var _0x279946=_0x56b9d9[_0xde88('0x4e')];if(!fs[_0xde88('0x50')](_0x279946)){throw new db['Sequelize'][(_0xde88('0x53'))](_0xde88('0x54'));}if(_0x56b9d9[_0xde88('0x55')]){return _0x119753[_0xde88('0x4a')](_0x279946,_0x56b9d9['filename']+path[_0xde88('0x56')](_0x279946),function(){if(_0x10709f){fs[_0xde88('0x57')](_0x279946);}});}else{return _0x119753[_0xde88('0x4a')](_0x279946,function(_0x2229cb){if(_0x10709f){fs[_0xde88('0x57')](_0x279946);}});}}})[_0xde88('0x47')](function(_0x1c7178){if(_0x1c7178['message']===_0xde88('0x54')){_0x119753[_0xde88('0x16')](0x194)[_0xde88('0x25')](_0xde88('0x58'));}else{return handleError(_0x119753,null);}});};exports['downloads']=function(_0x3fe6e9,_0x3d959c,_0x5df8ce){var _0xc9047d=require('../../components/encryptor');var _0x3f0f3d=![];var _0x387d94={'$and':[db[_0xde88('0x59')][_0xde88('0x3a')](db[_0xde88('0x59')]['fn'](_0xde88('0x5a'),db[_0xde88('0x59')][_0xde88('0x5b')](_0xde88('0x4c'))),_0x3fe6e9['query']['token'])]};if(_0x3fe6e9[_0xde88('0x2f')][_0xde88('0x2a')]&&_0x3fe6e9[_0xde88('0x2f')][_0xde88('0x2a')]==='uniqueid'){_0x387d94['$and'][_0xde88('0x5c')]({'uniqueid':_0x3fe6e9['params']['id']});}else{_0x387d94[_0xde88('0x5d')]['push']({'id':_0x3fe6e9['params']['id']});}return db[_0xde88('0x27')][_0xde88('0x48')]({'where':_0x387d94,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x3d959c,null))[_0xde88('0x20')](function(_0x2215e1){if(_0x2215e1){var _0x5869ff=util['format'](_0xde88('0x4f'),_0x2215e1[_0xde88('0x4e')]);if(fs[_0xde88('0x50')](_0x5869ff)){_0x3f0f3d=!![];return _0xc9047d[_0xde88('0x51')](_0x5869ff,_0x2215e1[_0xde88('0x4e')],config['secrets'][_0xde88('0x5e')])[_0xde88('0x20')](function(){return _0x2215e1;});}return _0x2215e1;}})[_0xde88('0x20')](function(_0x5e7137){if(_0x5e7137){if(!fs[_0xde88('0x50')](_0x5e7137[_0xde88('0x4e')])){throw new db[(_0xde88('0x5f'))][(_0xde88('0x53'))](_0xde88('0x54'));}if(_0x5e7137[_0xde88('0x55')]){return _0x3d959c[_0xde88('0x4a')](_0x5e7137[_0xde88('0x4e')],_0x5e7137[_0xde88('0x55')]+path['extname'](_0x5e7137['value']),function(){if(_0x3f0f3d){fs[_0xde88('0x57')](_0x5e7137['value']);}});}else{return _0x3d959c[_0xde88('0x4a')](_0x5e7137[_0xde88('0x4e')],function(_0x2c6fdc){if(_0x3f0f3d){fs['unlink'](_0x5e7137[_0xde88('0x4e')]);}});}}})[_0xde88('0x47')](handleError(_0x3d959c,null));};exports[_0xde88('0x21')]=function(_0x2dd4e3,_0x44865e){return db['VoiceRecording'][_0xde88('0x48')]({'where':{'id':_0x2dd4e3[_0xde88('0x4d')]['id']}})['then'](function(_0x34b2b3){if(!_0x34b2b3)throw new ReferenceError(_0xde88('0x60'));return _0x34b2b3;})[_0xde88('0x20')](function(_0x48b905){var _0x537fa9=_0x48b905[_0xde88('0x4e')];logger[_0xde88('0x61')](_0xde88('0x62'),_0x537fa9);if(!_[_0xde88('0x63')](_0x48b905['value'])&&fs['existsSync'](_0x537fa9)){logger[_0xde88('0x61')](_0xde88('0x64')+_0x537fa9+_0xde88('0x65'));fs[_0xde88('0x66')](_0x537fa9);}_0x537fa9=_0x537fa9+'.cypher';if(!_[_0xde88('0x63')](_0x48b905['value'])&&fs['existsSync'](_0x537fa9)){logger[_0xde88('0x61')](_0xde88('0x64')+_0x537fa9+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xde88('0x66')](_0x537fa9);}return _0x48b905;})[_0xde88('0x20')](function(_0x197432){if(!_0x197432)throw new InternalError();return _0x197432[_0xde88('0x21')]();})['then'](function(){_0x44865e['status'](0xcc)[_0xde88('0x17')]();})['catch'](handleError(_0x44865e,null));}; \ No newline at end of file +var _0x63c6=['options','find','create','body','describe','download','../../components/encryptor','uniqueid','params','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','VoiceRecording\x20not\x20found','filename','unlink','message','Not\x20found','sequelize','MD5','col','token','push','$and','extname','info','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','set','Content-Range','json','apply','reject','save','then','destroy','error','name','send','map','VoiceRecording','rawAttributes','fieldName','type','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','count','includeAll','include','findAll','catch','show'];(function(_0x3330d2,_0xcb3851){var _0x386202=function(_0x448f96){while(--_0x448f96){_0x3330d2['push'](_0x3330d2['shift']());}};_0x386202(++_0xcb3851);}(_0x63c6,0xee));var _0x663c=function(_0x30b926,_0x26954a){_0x30b926=_0x30b926-0x0;var _0x244712=_0x63c6[_0x30b926];return _0x244712;};'use strict';var pdf=require(_0x663c('0x0'));var emlformat=require(_0x663c('0x1'));var rimraf=require(_0x663c('0x2'));var zipdir=require(_0x663c('0x3'));var jsonpatch=require(_0x663c('0x4'));var rp=require('request-promise');var moment=require(_0x663c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x663c('0x6'));var util=require('util');var path=require(_0x663c('0x7'));var sox=require('sox');var csv=require(_0x663c('0x8'));var ejs=require(_0x663c('0x9'));var fs=require('fs');var _=require(_0x663c('0xa'));var squel=require(_0x663c('0xb'));var crypto=require(_0x663c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x663c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x663c('0xe'));var Papa=require(_0x663c('0xf'));var Redis=require(_0x663c('0x10'));var authService=require(_0x663c('0x11'));var qs=require('../../components/parsers/qs');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(_0x663c('0x17'))['db'];function respondWithStatusCode(_0x1c6cd2,_0x1efab0){_0x1efab0=_0x1efab0||0xcc;return function(_0x379fd1){if(_0x379fd1){return _0x1c6cd2[_0x663c('0x18')](_0x1efab0);}return _0x1c6cd2[_0x663c('0x19')](_0x1efab0)[_0x663c('0x1a')]();};}function respondWithResult(_0x5ae8e7,_0x2a53b2){_0x2a53b2=_0x2a53b2||0xc8;return function(_0x28dbae){if(_0x28dbae){return _0x5ae8e7['status'](_0x2a53b2)['json'](_0x28dbae);}};}function respondWithFilteredResult(_0x15e2fa,_0x591684){return function(_0x3067c3){if(_0x3067c3){var _0x357309=_0x3067c3['count'],_0x4568b9=_0x591684[_0x663c('0x1b')],_0x339d22=_0x591684[_0x663c('0x1b')]+_0x591684['limit'],_0x4bc8bc;if(_0x339d22>=_0x357309){_0x339d22=_0x357309;_0x4bc8bc=0xc8;}else{_0x4bc8bc=0xce;}_0x15e2fa[_0x663c('0x19')](_0x4bc8bc);return _0x15e2fa[_0x663c('0x1c')](_0x663c('0x1d'),_0x4568b9+'-'+_0x339d22+'/'+_0x357309)[_0x663c('0x1e')](_0x3067c3);}return null;};}function patchUpdates(_0x4f8007){return function(_0x269133){try{jsonpatch[_0x663c('0x1f')](_0x269133,_0x4f8007,!![]);}catch(_0x29ee65){return BPromise[_0x663c('0x20')](_0x29ee65);}return _0x269133[_0x663c('0x21')]();};}function saveUpdates(_0x3bf90b,_0xd52137){return function(_0x40dd9b){if(_0x40dd9b){return _0x40dd9b['update'](_0x3bf90b)[_0x663c('0x22')](function(_0xe7f561){return _0xe7f561;});}return null;};}function removeEntity(_0x4ffa60,_0x2f00b5){return function(_0x31eaf4){if(_0x31eaf4){return _0x31eaf4[_0x663c('0x23')]()['then'](function(){_0x4ffa60['status'](0xcc)[_0x663c('0x1a')]();});}};}function handleEntityNotFound(_0x227e27,_0x1b8991){return function(_0x8e4708){if(!_0x8e4708){_0x227e27[_0x663c('0x18')](0x194);}return _0x8e4708;};}function handleError(_0x1d2d9b,_0x235b59){_0x235b59=_0x235b59||0x1f4;return function(_0x117161){logger[_0x663c('0x24')](_0x117161['stack']);if(_0x117161[_0x663c('0x25')]){delete _0x117161[_0x663c('0x25')];}_0x1d2d9b[_0x663c('0x19')](_0x235b59)[_0x663c('0x26')](_0x117161);};}exports['index']=function(_0x15383a,_0x50d5c8){var _0x3548c6={},_0x198c8c={},_0x9d4082={'count':0x0,'rows':[]};var _0x3a25ee=_[_0x663c('0x27')](db[_0x663c('0x28')][_0x663c('0x29')],function(_0x218b98){return{'name':_0x218b98[_0x663c('0x2a')],'type':_0x218b98[_0x663c('0x2b')]['key']};});_0x198c8c['model']=_[_0x663c('0x2c')](_[_0x663c('0x27')](_0x3a25ee,_0x663c('0x25')),[_0x663c('0x2d')]);_0x198c8c[_0x663c('0x2e')]=_[_0x663c('0x2f')](_0x15383a[_0x663c('0x2e')]);_0x198c8c[_0x663c('0x30')]=_[_0x663c('0x31')](_0x198c8c['model'],_0x198c8c['query']);_0x3548c6[_0x663c('0x32')]=_['intersection'](_0x198c8c['model'],qs['fields'](_0x15383a[_0x663c('0x2e')][_0x663c('0x33')]));_0x3548c6[_0x663c('0x32')]=_0x3548c6[_0x663c('0x32')][_0x663c('0x34')]?_0x3548c6['attributes']:_0x198c8c[_0x663c('0x35')];if(!_0x15383a[_0x663c('0x2e')][_0x663c('0x36')](_0x663c('0x37'))){_0x3548c6[_0x663c('0x38')]=qs[_0x663c('0x38')](_0x15383a[_0x663c('0x2e')]['limit']);_0x3548c6[_0x663c('0x1b')]=qs[_0x663c('0x1b')](_0x15383a[_0x663c('0x2e')][_0x663c('0x1b')]);}_0x3548c6[_0x663c('0x39')]=qs[_0x663c('0x3a')](_0x15383a[_0x663c('0x2e')][_0x663c('0x3a')]);_0x3548c6['where']=qs[_0x663c('0x30')](_['pick'](_0x15383a['query'],_0x198c8c[_0x663c('0x30')]));if(_0x15383a['query'][_0x663c('0x3b')]){_0x3548c6[_0x663c('0x3c')]=_[_0x663c('0x3d')](_0x3548c6[_0x663c('0x3c')],{'$or':_[_0x663c('0x27')](_0x3a25ee,function(_0x1619b8){if(_0x1619b8[_0x663c('0x2b')]!=='VIRTUAL'){var _0x23e3e7={};_0x23e3e7[_0x1619b8[_0x663c('0x25')]]={'$like':'%'+_0x15383a[_0x663c('0x2e')]['filter']+'%'};return _0x23e3e7;}})});}_0x3548c6=_[_0x663c('0x3d')]({},_0x3548c6,_0x15383a['options']);var _0x26b091={'where':_0x3548c6[_0x663c('0x3c')]};return db['VoiceRecording'][_0x663c('0x3e')](_0x26b091)['then'](function(_0x3642b5){_0x9d4082[_0x663c('0x3e')]=_0x3642b5;if(_0x15383a[_0x663c('0x2e')][_0x663c('0x3f')]){_0x3548c6[_0x663c('0x40')]=[{'all':!![]}];}return db[_0x663c('0x28')][_0x663c('0x41')](_0x3548c6);})[_0x663c('0x22')](function(_0x443bcf){_0x9d4082['rows']=_0x443bcf;return _0x9d4082;})['then'](respondWithFilteredResult(_0x50d5c8,_0x3548c6))[_0x663c('0x42')](handleError(_0x50d5c8,null));};exports[_0x663c('0x43')]=function(_0x13802e,_0x5b2fc3){var _0x1526c4={'raw':![],'where':{'id':_0x13802e['params']['id']}},_0x2b2277={};_0x2b2277[_0x663c('0x35')]=_[_0x663c('0x2f')](db['VoiceRecording'][_0x663c('0x29')]);_0x2b2277[_0x663c('0x2e')]=_['keys'](_0x13802e['query']);_0x2b2277[_0x663c('0x30')]=_[_0x663c('0x31')](_0x2b2277[_0x663c('0x35')],_0x2b2277['query']);_0x1526c4[_0x663c('0x32')]=_[_0x663c('0x31')](_0x2b2277[_0x663c('0x35')],qs[_0x663c('0x33')](_0x13802e['query'][_0x663c('0x33')]));_0x1526c4['attributes']=_0x1526c4[_0x663c('0x32')][_0x663c('0x34')]?_0x1526c4[_0x663c('0x32')]:_0x2b2277['model'];if(_0x13802e[_0x663c('0x2e')][_0x663c('0x3f')]){_0x1526c4['include']=[{'all':!![]}];}_0x1526c4=_[_0x663c('0x3d')]({},_0x1526c4,_0x13802e[_0x663c('0x44')]);return db[_0x663c('0x28')][_0x663c('0x45')](_0x1526c4)['then'](handleEntityNotFound(_0x5b2fc3,null))[_0x663c('0x22')](respondWithResult(_0x5b2fc3,null))['catch'](handleError(_0x5b2fc3,null));};exports[_0x663c('0x46')]=function(_0x3e011d,_0x3cf80e){return db['VoiceRecording'][_0x663c('0x46')](_0x3e011d[_0x663c('0x47')],{})[_0x663c('0x22')](respondWithResult(_0x3cf80e,0xc9))[_0x663c('0x42')](handleError(_0x3cf80e,null));};exports['update']=function(_0x13f490,_0x1ccb9f){if(_0x13f490[_0x663c('0x47')]['id']){delete _0x13f490[_0x663c('0x47')]['id'];}return db[_0x663c('0x28')][_0x663c('0x45')]({'where':{'id':_0x13f490['params']['id']}})[_0x663c('0x22')](handleEntityNotFound(_0x1ccb9f,null))[_0x663c('0x22')](saveUpdates(_0x13f490[_0x663c('0x47')],null))['then'](respondWithResult(_0x1ccb9f,null))[_0x663c('0x42')](handleError(_0x1ccb9f,null));};exports[_0x663c('0x48')]=function(_0x33e41a,_0x2caa9d){return db[_0x663c('0x28')][_0x663c('0x48')]()[_0x663c('0x22')](respondWithResult(_0x2caa9d,null))['catch'](handleError(_0x2caa9d,null));};exports[_0x663c('0x49')]=function(_0x4dc67d,_0x1d13d5,_0xa791ae){var _0x3340b8=require(_0x663c('0x4a'));var _0x326aa5=![];var _0x10d6fe={};if(_0x4dc67d[_0x663c('0x2e')][_0x663c('0x2b')]&&_0x4dc67d['query']['type']===_0x663c('0x4b')){_0x10d6fe[_0x663c('0x4b')]=_0x4dc67d['params']['id'];}else{_0x10d6fe['id']=_0x4dc67d[_0x663c('0x4c')]['id'];}return db[_0x663c('0x28')][_0x663c('0x45')]({'where':_0x10d6fe,'attributes':['id',_0x663c('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0x1d13d5,null))[_0x663c('0x22')](function(_0x5d198f){if(_0x5d198f){var _0x5f060b=_0x5d198f[_0x663c('0x4d')];var _0x1663de=util[_0x663c('0x2d')](_0x663c('0x4e'),_0x5f060b);if(fs[_0x663c('0x4f')](_0x1663de)){_0x326aa5=!![];return _0x3340b8[_0x663c('0x50')](_0x1663de,_0x5f060b,config[_0x663c('0x51')][_0x663c('0x52')])[_0x663c('0x22')](function(){return _0x5d198f;});}return _0x5d198f;}})[_0x663c('0x22')](function(_0x1e5793){if(_0x1e5793){var _0x2a93e4=_0x1e5793[_0x663c('0x4d')];if(!fs[_0x663c('0x4f')](_0x2a93e4)){throw new db[(_0x663c('0x53'))]['ValidationError'](_0x663c('0x54'));}if(_0x1e5793[_0x663c('0x55')]){return _0x1d13d5[_0x663c('0x49')](_0x2a93e4,_0x1e5793[_0x663c('0x55')]+path['extname'](_0x2a93e4),function(){if(_0x326aa5){fs['unlink'](_0x2a93e4);}});}else{return _0x1d13d5['download'](_0x2a93e4,function(_0xfb63ed){if(_0x326aa5){fs[_0x663c('0x56')](_0x2a93e4);}});}}})['catch'](function(_0x55b4ae){if(_0x55b4ae[_0x663c('0x57')]==='VoiceRecording\x20not\x20found'){_0x1d13d5[_0x663c('0x19')](0x194)[_0x663c('0x26')](_0x663c('0x58'));}else{return handleError(_0x1d13d5,null);}});};exports['downloads']=function(_0x6c35c5,_0x5c6c3d,_0x409235){var _0xf429fe=require(_0x663c('0x4a'));var _0x360db2=![];var _0xd5bb68={'$and':[db[_0x663c('0x59')][_0x663c('0x3c')](db['sequelize']['fn'](_0x663c('0x5a'),db[_0x663c('0x59')][_0x663c('0x5b')](_0x663c('0x4b'))),_0x6c35c5['query'][_0x663c('0x5c')])]};if(_0x6c35c5[_0x663c('0x2e')][_0x663c('0x2b')]&&_0x6c35c5[_0x663c('0x2e')][_0x663c('0x2b')]===_0x663c('0x4b')){_0xd5bb68['$and'][_0x663c('0x5d')]({'uniqueid':_0x6c35c5[_0x663c('0x4c')]['id']});}else{_0xd5bb68[_0x663c('0x5e')][_0x663c('0x5d')]({'id':_0x6c35c5[_0x663c('0x4c')]['id']});}return db['VoiceRecording'][_0x663c('0x45')]({'where':_0xd5bb68,'attributes':['id','value'],'raw':!![]})[_0x663c('0x22')](handleEntityNotFound(_0x5c6c3d,null))[_0x663c('0x22')](function(_0x13fb87){if(_0x13fb87){var _0x12e9df=util[_0x663c('0x2d')](_0x663c('0x4e'),_0x13fb87[_0x663c('0x4d')]);if(fs[_0x663c('0x4f')](_0x12e9df)){_0x360db2=!![];return _0xf429fe[_0x663c('0x50')](_0x12e9df,_0x13fb87[_0x663c('0x4d')],config[_0x663c('0x51')]['recording'])[_0x663c('0x22')](function(){return _0x13fb87;});}return _0x13fb87;}})[_0x663c('0x22')](function(_0x2307ed){if(_0x2307ed){if(!fs['existsSync'](_0x2307ed['value'])){throw new db[(_0x663c('0x53'))]['ValidationError'](_0x663c('0x54'));}if(_0x2307ed['filename']){return _0x5c6c3d[_0x663c('0x49')](_0x2307ed[_0x663c('0x4d')],_0x2307ed[_0x663c('0x55')]+path[_0x663c('0x5f')](_0x2307ed[_0x663c('0x4d')]),function(){if(_0x360db2){fs[_0x663c('0x56')](_0x2307ed[_0x663c('0x4d')]);}});}else{return _0x5c6c3d['download'](_0x2307ed[_0x663c('0x4d')],function(_0x5a1665){if(_0x360db2){fs[_0x663c('0x56')](_0x2307ed['value']);}});}}})[_0x663c('0x42')](handleError(_0x5c6c3d,null));};exports['destroy']=function(_0x470a49,_0x395a00){return db[_0x663c('0x28')]['find']({'where':{'id':_0x470a49[_0x663c('0x4c')]['id']}})[_0x663c('0x22')](function(_0x445343){if(!_0x445343)throw new ReferenceError('Entity\x20not\x20found');return _0x445343;})[_0x663c('0x22')](function(_0x591890){var _0x2e8e56=_0x591890[_0x663c('0x4d')];logger[_0x663c('0x60')]('cancellazione\x20fisica\x20documento\x20%s',_0x2e8e56);if(!_[_0x663c('0x61')](_0x591890['value'])&&fs[_0x663c('0x4f')](_0x2e8e56)){logger['info'](_0x663c('0x62')+_0x2e8e56+_0x663c('0x63'));fs[_0x663c('0x64')](_0x2e8e56);}_0x2e8e56=_0x2e8e56+_0x663c('0x65');if(!_[_0x663c('0x61')](_0x591890[_0x663c('0x4d')])&&fs[_0x663c('0x4f')](_0x2e8e56)){logger[_0x663c('0x60')](_0x663c('0x62')+_0x2e8e56+_0x663c('0x63'));fs['unlinkSync'](_0x2e8e56);}return _0x591890;})[_0x663c('0x22')](function(_0x11cf15){if(!_0x11cf15)throw new InternalError();return _0x11cf15[_0x663c('0x23')]();})['then'](function(){_0x395a00[_0x663c('0x19')](0xcc)[_0x663c('0x1a')]();})[_0x663c('0x42')](handleError(_0x395a00,null));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index edc4191..00bc50d 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 _0x05f3=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceRecording','uniqueid','lodash','util','../../config/logger'];(function(_0x47ede9,_0x267314){var _0x37a0de=function(_0x1b5d98){while(--_0x1b5d98){_0x47ede9['push'](_0x47ede9['shift']());}};_0x37a0de(++_0x267314);}(_0x05f3,0x1c4));var _0x305f=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x05f3[_0x1ddedd];return _0xa3e1ac;};'use strict';var _=require(_0x305f('0x0'));var util=require(_0x305f('0x1'));var logger=require(_0x305f('0x2'))('api');var moment=require(_0x305f('0x3'));var BPromise=require(_0x305f('0x4'));var rp=require(_0x305f('0x5'));var fs=require('fs');var path=require(_0x305f('0x6'));var rimraf=require(_0x305f('0x7'));var config=require(_0x305f('0x8'));var attributes=require('./voiceRecording.attributes');module[_0x305f('0x9')]=function(_0x444199,_0x5cddce){return _0x444199[_0x305f('0xa')](_0x305f('0xb'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x305f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x941a=['moment','bluebird','request-promise','./voiceRecording.attributes','voice_recordings','uniqueid','../../config/logger','api'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x941a,0x186));var _0xa941=function(_0x5c6abe,_0x269ea6){_0x5c6abe=_0x5c6abe-0x0;var _0x480473=_0x941a[_0x5c6abe];return _0x480473;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa941('0x0'))(_0xa941('0x1'));var moment=require(_0xa941('0x2'));var BPromise=require(_0xa941('0x3'));var rp=require(_0xa941('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa941('0x5'));module['exports']=function(_0x15ea83,_0x1e5b1a){return _0x15ea83['define']('VoiceRecording',attributes,{'tableName':_0xa941('0x6'),'paranoid':![],'indexes':[{'name':_0xa941('0x7'),'fields':[_0xa941('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index d75956d..f882087 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(_0xbae21b,_0x449cfb){var _0x10f16f=function(_0x4ae469){while(--_0x4ae469){_0xbae21b['push'](_0xbae21b['shift']());}};_0x10f16f(++_0x449cfb);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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(_0x4eec9b,_0x4aea09){var _0x2e3849=function(_0x24c06d){while(--_0x24c06d){_0x4eec9b['push'](_0x4eec9b['shift']());}};_0x2e3849(++_0x4aea09);}(_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);});});}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 5366b52..901efb5 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 _0x3f8a=['index','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated'];(function(_0x2bc09e,_0x1ae747){var _0x3f7c75=function(_0x49bed4){while(--_0x49bed4){_0x2bc09e['push'](_0x2bc09e['shift']());}};_0x3f7c75(++_0x1ae747);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x20344b,_0x41d19f){_0x20344b=_0x20344b-0x0;var _0x1a47ec=_0x3f8a[_0x20344b];return _0x1a47ec;};'use strict';var multer=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var path=require(_0xa3f8('0x2'));var timeout=require(_0xa3f8('0x3'));var express=require('express');var router=express[_0xa3f8('0x4')]();var auth=require(_0xa3f8('0x5'));var interaction=require(_0xa3f8('0x6'));var config=require(_0xa3f8('0x7'));var controller=require(_0xa3f8('0x8'));router[_0xa3f8('0x9')]('/',auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xb')]);router[_0xa3f8('0x9')](_0xa3f8('0xc'),auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xd')]);router[_0xa3f8('0xe')]('/',auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xf')]);router[_0xa3f8('0x10')](_0xa3f8('0xc'),auth['isAuthenticated'](),controller[_0xa3f8('0x11')]);router[_0xa3f8('0x12')](_0xa3f8('0xc'),auth[_0xa3f8('0xa')](),controller['destroy']);module[_0xa3f8('0x13')]=router; \ No newline at end of file +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(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x326f,0xd1));var _0xf326=function(_0x50fb0a,_0x1ffe68){_0x50fb0a=_0x50fb0a-0x0;var _0x1b5ed9=_0x326f[_0x50fb0a];return _0x1b5ed9;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var auth=require(_0xf326('0x4'));var interaction=require(_0xf326('0x5'));var config=require(_0xf326('0x6'));var controller=require(_0xf326('0x7'));router[_0xf326('0x8')]('/',auth[_0xf326('0x9')](),controller[_0xf326('0xa')]);router['get'](_0xf326('0xb'),auth[_0xf326('0x9')](),controller[_0xf326('0xc')]);router[_0xf326('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xf326('0xb'),auth[_0xf326('0x9')](),controller[_0xf326('0xe')]);router[_0xf326('0xf')](_0xf326('0xb'),auth['isAuthenticated'](),controller[_0xf326('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 600e67c..96f2c79 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 _0x832e=['STRING','Yes','sequelize','ENUM','blind','attended'];(function(_0x4ecea4,_0xc431a6){var _0x528e8a=function(_0x2baa56){while(--_0x2baa56){_0x4ecea4['push'](_0x4ecea4['shift']());}};_0x528e8a(++_0xc431a6);}(_0x832e,0x1e2));var _0xe832=function(_0x375d45,_0x188671){_0x375d45=_0x375d45-0x0;var _0x44d098=_0x832e[_0x375d45];return _0x44d098;};'use strict';var Sequelize=require(_0xe832('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0xe832('0x1')](_0xe832('0x2'),_0xe832('0x3'))},'result':{'type':Sequelize[_0xe832('0x4')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0xe832('0x4')]},'transferercalleridname':{'type':Sequelize[_0xe832('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0xe832('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0xe832('0x4')]},'transfereraccountcode':{'type':Sequelize[_0xe832('0x4')]},'transferercontext':{'type':Sequelize[_0xe832('0x4')]},'transfererexten':{'type':Sequelize[_0xe832('0x4')]},'transfererlinkedid':{'type':Sequelize[_0xe832('0x4')]},'transfereechannel':{'type':Sequelize[_0xe832('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0xe832('0x4')]},'transfereecalleridname':{'type':Sequelize[_0xe832('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xe832('0x4')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0xe832('0x4')]},'transfereecontext':{'type':Sequelize[_0xe832('0x4')]},'transfereeexten':{'type':Sequelize[_0xe832('0x4')]},'transfereelinkedid':{'type':Sequelize[_0xe832('0x4')]},'isexternal':{'type':Sequelize[_0xe832('0x1')](_0xe832('0x5'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x32b8=['STRING','sequelize','moment','exports','ENUM','blind','attended'];(function(_0x5e28c2,_0x1e48ab){var _0x1a8cc6=function(_0x1218bf){while(--_0x1218bf){_0x5e28c2['push'](_0x5e28c2['shift']());}};_0x1a8cc6(++_0x1e48ab);}(_0x32b8,0xcc));var _0x832b=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x32b8[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x832b('0x0'));var moment=require(_0x832b('0x1'));module[_0x832b('0x2')]={'type':{'type':Sequelize[_0x832b('0x3')](_0x832b('0x4'),_0x832b('0x5'))},'result':{'type':Sequelize[_0x832b('0x6')]},'transfererchannel':{'type':Sequelize[_0x832b('0x6')]},'transferercalleridnum':{'type':Sequelize[_0x832b('0x6')]},'transferercalleridname':{'type':Sequelize[_0x832b('0x6')]},'transfererconnectedlinenum':{'type':Sequelize[_0x832b('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0x832b('0x6')]},'transfereraccountcode':{'type':Sequelize[_0x832b('0x6')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x832b('0x6')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x832b('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x832b('0x6')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x832b('0x6')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x832b('0x6')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x832b('0x3')]('Yes','No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index eeef07d..fe908e1 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 _0x5c00=['catch','show','params','rawAttributes','create','body','find','html-pdf','eml-format','rimraf','fast-json-patch','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','api','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','stack','name','send','index','map','VoiceTransferReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x5c00,0x17e));var _0x05c0=function(_0x2388be,_0x43ebae){_0x2388be=_0x2388be-0x0;var _0x13ac52=_0x5c00[_0x2388be];return _0x13ac52;};'use strict';var pdf=require(_0x05c0('0x0'));var emlformat=require(_0x05c0('0x1'));var rimraf=require(_0x05c0('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x05c0('0x3'));var rp=require('request-promise');var moment=require(_0x05c0('0x4'));var BPromise=require(_0x05c0('0x5'));var Mustache=require(_0x05c0('0x6'));var util=require(_0x05c0('0x7'));var path=require('path');var sox=require(_0x05c0('0x8'));var csv=require(_0x05c0('0x9'));var ejs=require(_0x05c0('0xa'));var fs=require('fs');var _=require(_0x05c0('0xb'));var squel=require('squel');var crypto=require(_0x05c0('0xc'));var jsforce=require(_0x05c0('0xd'));var deskjs=require(_0x05c0('0xe'));var toCsv=require('to-csv');var querystring=require(_0x05c0('0xf'));var Papa=require(_0x05c0('0x10'));var Redis=require(_0x05c0('0x11'));var authService=require(_0x05c0('0x12'));var qs=require(_0x05c0('0x13'));var as=require(_0x05c0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x05c0('0x15'));var utils=require('../../config/utils');var config=require(_0x05c0('0x16'));var db=require(_0x05c0('0x17'))['db'];function respondWithStatusCode(_0xa50678,_0x5a3e65){_0x5a3e65=_0x5a3e65||0xcc;return function(_0x4e39d4){if(_0x4e39d4){return _0xa50678['sendStatus'](_0x5a3e65);}return _0xa50678[_0x05c0('0x18')](_0x5a3e65)[_0x05c0('0x19')]();};}function respondWithResult(_0x20ff48,_0x12deeb){_0x12deeb=_0x12deeb||0xc8;return function(_0x25764b){if(_0x25764b){return _0x20ff48[_0x05c0('0x18')](_0x12deeb)[_0x05c0('0x1a')](_0x25764b);}};}function respondWithFilteredResult(_0xd7b487,_0x4c3e54){return function(_0x238e25){if(_0x238e25){var _0x161a5f=_0x238e25[_0x05c0('0x1b')],_0x4bb164=_0x4c3e54[_0x05c0('0x1c')],_0x29e6b0=_0x4c3e54[_0x05c0('0x1c')]+_0x4c3e54[_0x05c0('0x1d')],_0x27c7bd;if(_0x29e6b0>=_0x161a5f){_0x29e6b0=_0x161a5f;_0x27c7bd=0xc8;}else{_0x27c7bd=0xce;}_0xd7b487['status'](_0x27c7bd);return _0xd7b487[_0x05c0('0x1e')](_0x05c0('0x1f'),_0x4bb164+'-'+_0x29e6b0+'/'+_0x161a5f)[_0x05c0('0x1a')](_0x238e25);}return null;};}function patchUpdates(_0x54fef0){return function(_0x40d905){try{jsonpatch[_0x05c0('0x20')](_0x40d905,_0x54fef0,!![]);}catch(_0x10685b){return BPromise[_0x05c0('0x21')](_0x10685b);}return _0x40d905[_0x05c0('0x22')]();};}function saveUpdates(_0x5e4742,_0x407c1f){return function(_0x1014ef){if(_0x1014ef){return _0x1014ef['update'](_0x5e4742)['then'](function(_0x5e4b80){return _0x5e4b80;});}return null;};}function removeEntity(_0x1c448b,_0x2055a3){return function(_0x83f29){if(_0x83f29){return _0x83f29[_0x05c0('0x23')]()[_0x05c0('0x24')](function(){_0x1c448b[_0x05c0('0x18')](0xcc)[_0x05c0('0x19')]();});}};}function handleEntityNotFound(_0x5b4eef,_0x9b4930){return function(_0x1abbf3){if(!_0x1abbf3){_0x5b4eef['sendStatus'](0x194);}return _0x1abbf3;};}function handleError(_0x530966,_0x4da6d6){_0x4da6d6=_0x4da6d6||0x1f4;return function(_0x5dc2b7){logger['error'](_0x5dc2b7[_0x05c0('0x25')]);if(_0x5dc2b7[_0x05c0('0x26')]){delete _0x5dc2b7['name'];}_0x530966[_0x05c0('0x18')](_0x4da6d6)[_0x05c0('0x27')](_0x5dc2b7);};}exports[_0x05c0('0x28')]=function(_0x889c75,_0x58769a){var _0x7d5ccd={},_0x1c14b1={},_0x2ceaed={'count':0x0,'rows':[]};var _0x200e80=_[_0x05c0('0x29')](db[_0x05c0('0x2a')]['rawAttributes'],function(_0x56ba64){return{'name':_0x56ba64[_0x05c0('0x2b')],'type':_0x56ba64[_0x05c0('0x2c')][_0x05c0('0x2d')]};});_0x1c14b1[_0x05c0('0x2e')]=_[_0x05c0('0x29')](_0x200e80,_0x05c0('0x26'));_0x1c14b1[_0x05c0('0x2f')]=_[_0x05c0('0x30')](_0x889c75[_0x05c0('0x2f')]);_0x1c14b1[_0x05c0('0x31')]=_[_0x05c0('0x32')](_0x1c14b1[_0x05c0('0x2e')],_0x1c14b1['query']);_0x7d5ccd['attributes']=_[_0x05c0('0x32')](_0x1c14b1[_0x05c0('0x2e')],qs[_0x05c0('0x33')](_0x889c75['query'][_0x05c0('0x33')]));_0x7d5ccd[_0x05c0('0x34')]=_0x7d5ccd['attributes'][_0x05c0('0x35')]?_0x7d5ccd['attributes']:_0x1c14b1[_0x05c0('0x2e')];if(!_0x889c75[_0x05c0('0x2f')][_0x05c0('0x36')](_0x05c0('0x37'))){_0x7d5ccd[_0x05c0('0x1d')]=qs[_0x05c0('0x1d')](_0x889c75[_0x05c0('0x2f')][_0x05c0('0x1d')]);_0x7d5ccd[_0x05c0('0x1c')]=qs[_0x05c0('0x1c')](_0x889c75[_0x05c0('0x2f')][_0x05c0('0x1c')]);}_0x7d5ccd[_0x05c0('0x38')]=qs[_0x05c0('0x39')](_0x889c75[_0x05c0('0x2f')][_0x05c0('0x39')]);_0x7d5ccd[_0x05c0('0x3a')]=qs[_0x05c0('0x31')](_[_0x05c0('0x3b')](_0x889c75[_0x05c0('0x2f')],_0x1c14b1[_0x05c0('0x31')]));if(_0x889c75[_0x05c0('0x2f')][_0x05c0('0x3c')]){_0x7d5ccd[_0x05c0('0x3a')]=_[_0x05c0('0x3d')](_0x7d5ccd[_0x05c0('0x3a')],{'$or':_[_0x05c0('0x29')](_0x200e80,function(_0x3bc6cc){if(_0x3bc6cc[_0x05c0('0x2c')]!==_0x05c0('0x3e')){var _0x1f493c={};_0x1f493c[_0x3bc6cc[_0x05c0('0x26')]]={'$like':'%'+_0x889c75[_0x05c0('0x2f')]['filter']+'%'};return _0x1f493c;}})});}_0x7d5ccd=_[_0x05c0('0x3d')]({},_0x7d5ccd,_0x889c75[_0x05c0('0x3f')]);var _0x41fa50={'where':_0x7d5ccd[_0x05c0('0x3a')]};return db['VoiceTransferReport']['count'](_0x41fa50)[_0x05c0('0x24')](function(_0x2540db){_0x2ceaed[_0x05c0('0x1b')]=_0x2540db;if(_0x889c75['query'][_0x05c0('0x40')]){_0x7d5ccd[_0x05c0('0x41')]=[{'all':!![]}];}return db[_0x05c0('0x2a')][_0x05c0('0x42')](_0x7d5ccd);})['then'](function(_0x152c6a){_0x2ceaed[_0x05c0('0x43')]=_0x152c6a;return _0x2ceaed;})['then'](respondWithFilteredResult(_0x58769a,_0x7d5ccd))[_0x05c0('0x44')](handleError(_0x58769a,null));};exports[_0x05c0('0x45')]=function(_0x4557db,_0xcbd98){var _0x164e3a={'raw':!![],'where':{'id':_0x4557db[_0x05c0('0x46')]['id']}},_0x398a6e={};_0x398a6e['model']=_['keys'](db[_0x05c0('0x2a')][_0x05c0('0x47')]);_0x398a6e[_0x05c0('0x2f')]=_[_0x05c0('0x30')](_0x4557db[_0x05c0('0x2f')]);_0x398a6e['filters']=_[_0x05c0('0x32')](_0x398a6e[_0x05c0('0x2e')],_0x398a6e[_0x05c0('0x2f')]);_0x164e3a[_0x05c0('0x34')]=_[_0x05c0('0x32')](_0x398a6e[_0x05c0('0x2e')],qs[_0x05c0('0x33')](_0x4557db['query'][_0x05c0('0x33')]));_0x164e3a[_0x05c0('0x34')]=_0x164e3a[_0x05c0('0x34')][_0x05c0('0x35')]?_0x164e3a[_0x05c0('0x34')]:_0x398a6e[_0x05c0('0x2e')];if(_0x4557db[_0x05c0('0x2f')][_0x05c0('0x40')]){_0x164e3a[_0x05c0('0x41')]=[{'all':!![]}];}_0x164e3a=_[_0x05c0('0x3d')]({},_0x164e3a,_0x4557db[_0x05c0('0x3f')]);return db['VoiceTransferReport']['find'](_0x164e3a)[_0x05c0('0x24')](handleEntityNotFound(_0xcbd98,null))[_0x05c0('0x24')](respondWithResult(_0xcbd98,null))[_0x05c0('0x44')](handleError(_0xcbd98,null));};exports[_0x05c0('0x48')]=function(_0x2a1339,_0x856372){return db['VoiceTransferReport'][_0x05c0('0x48')](_0x2a1339[_0x05c0('0x49')],{})[_0x05c0('0x24')](respondWithResult(_0x856372,0xc9))[_0x05c0('0x44')](handleError(_0x856372,null));};exports['update']=function(_0x34e94e,_0x2440e8){if(_0x34e94e[_0x05c0('0x49')]['id']){delete _0x34e94e[_0x05c0('0x49')]['id'];}return db['VoiceTransferReport'][_0x05c0('0x4a')]({'where':{'id':_0x34e94e[_0x05c0('0x46')]['id']}})[_0x05c0('0x24')](handleEntityNotFound(_0x2440e8,null))[_0x05c0('0x24')](saveUpdates(_0x34e94e['body'],null))[_0x05c0('0x24')](respondWithResult(_0x2440e8,null))[_0x05c0('0x44')](handleError(_0x2440e8,null));};exports['destroy']=function(_0x27f69e,_0x57f979){return db['VoiceTransferReport'][_0x05c0('0x4a')]({'where':{'id':_0x27f69e['params']['id']}})[_0x05c0('0x24')](handleEntityNotFound(_0x57f979,null))[_0x05c0('0x24')](removeEntity(_0x57f979,null))[_0x05c0('0x44')](handleError(_0x57f979,null));}; \ No newline at end of file +var _0xb7e7=['ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','name','send','index','VoiceTransferReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','length','find','create','body','html-pdf','rimraf','fast-json-patch','moment','mustache','util','path'];(function(_0x2a1bbe,_0x29347c){var _0x563923=function(_0x10fa66){while(--_0x10fa66){_0x2a1bbe['push'](_0x2a1bbe['shift']());}};_0x563923(++_0x29347c);}(_0xb7e7,0x121));var _0x7b7e=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0xb7e7[_0x34843e];return _0x598f7f;};'use strict';var pdf=require(_0x7b7e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7b7e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7b7e('0x2'));var rp=require('request-promise');var moment=require(_0x7b7e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7b7e('0x4'));var util=require(_0x7b7e('0x5'));var path=require(_0x7b7e('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7b7e('0x7'));var fs=require('fs');var _=require(_0x7b7e('0x8'));var squel=require(_0x7b7e('0x9'));var crypto=require('crypto');var jsforce=require(_0x7b7e('0xa'));var deskjs=require(_0x7b7e('0xb'));var toCsv=require(_0x7b7e('0xc'));var querystring=require(_0x7b7e('0xd'));var Papa=require(_0x7b7e('0xe'));var Redis=require(_0x7b7e('0xf'));var authService=require(_0x7b7e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7b7e('0x11'));var hardwareService=require(_0x7b7e('0x12'));var logger=require(_0x7b7e('0x13'))(_0x7b7e('0x14'));var utils=require(_0x7b7e('0x15'));var config=require(_0x7b7e('0x16'));var db=require(_0x7b7e('0x17'))['db'];function respondWithStatusCode(_0x55620b,_0xaadda){_0xaadda=_0xaadda||0xcc;return function(_0x54d8ce){if(_0x54d8ce){return _0x55620b[_0x7b7e('0x18')](_0xaadda);}return _0x55620b[_0x7b7e('0x19')](_0xaadda)['end']();};}function respondWithResult(_0x422d3a,_0x5976ac){_0x5976ac=_0x5976ac||0xc8;return function(_0x4c6011){if(_0x4c6011){return _0x422d3a[_0x7b7e('0x19')](_0x5976ac)[_0x7b7e('0x1a')](_0x4c6011);}};}function respondWithFilteredResult(_0xf067da,_0x457ec5){return function(_0x3d2fb2){if(_0x3d2fb2){var _0x5703fd=_0x3d2fb2[_0x7b7e('0x1b')],_0x51baf6=_0x457ec5[_0x7b7e('0x1c')],_0xc7f087=_0x457ec5[_0x7b7e('0x1c')]+_0x457ec5[_0x7b7e('0x1d')],_0x36444d;if(_0xc7f087>=_0x5703fd){_0xc7f087=_0x5703fd;_0x36444d=0xc8;}else{_0x36444d=0xce;}_0xf067da[_0x7b7e('0x19')](_0x36444d);return _0xf067da[_0x7b7e('0x1e')](_0x7b7e('0x1f'),_0x51baf6+'-'+_0xc7f087+'/'+_0x5703fd)[_0x7b7e('0x1a')](_0x3d2fb2);}return null;};}function patchUpdates(_0x12e8e9){return function(_0x14f4fe){try{jsonpatch[_0x7b7e('0x20')](_0x14f4fe,_0x12e8e9,!![]);}catch(_0x3bec7d){return BPromise[_0x7b7e('0x21')](_0x3bec7d);}return _0x14f4fe[_0x7b7e('0x22')]();};}function saveUpdates(_0x3a7b8b,_0x49eddb){return function(_0x69262b){if(_0x69262b){return _0x69262b[_0x7b7e('0x23')](_0x3a7b8b)[_0x7b7e('0x24')](function(_0x4c0647){return _0x4c0647;});}return null;};}function removeEntity(_0x313122,_0xbf0cb3){return function(_0x14243b){if(_0x14243b){return _0x14243b[_0x7b7e('0x25')]()[_0x7b7e('0x24')](function(){_0x313122[_0x7b7e('0x19')](0xcc)[_0x7b7e('0x26')]();});}};}function handleEntityNotFound(_0x10a66a,_0x53bbb3){return function(_0x5d6215){if(!_0x5d6215){_0x10a66a['sendStatus'](0x194);}return _0x5d6215;};}function handleError(_0x26ee14,_0x22598e){_0x22598e=_0x22598e||0x1f4;return function(_0x23bfa3){logger['error'](_0x23bfa3['stack']);if(_0x23bfa3['name']){delete _0x23bfa3[_0x7b7e('0x27')];}_0x26ee14[_0x7b7e('0x19')](_0x22598e)[_0x7b7e('0x28')](_0x23bfa3);};}exports[_0x7b7e('0x29')]=function(_0x3ceaf5,_0x48fad1){var _0x6a1e71={},_0x21a15={},_0x4c46b8={'count':0x0,'rows':[]};var _0x57b9da=_['map'](db[_0x7b7e('0x2a')][_0x7b7e('0x2b')],function(_0x503625){return{'name':_0x503625[_0x7b7e('0x2c')],'type':_0x503625['type'][_0x7b7e('0x2d')]};});_0x21a15[_0x7b7e('0x2e')]=_[_0x7b7e('0x2f')](_0x57b9da,'name');_0x21a15[_0x7b7e('0x30')]=_[_0x7b7e('0x31')](_0x3ceaf5[_0x7b7e('0x30')]);_0x21a15[_0x7b7e('0x32')]=_[_0x7b7e('0x33')](_0x21a15['model'],_0x21a15[_0x7b7e('0x30')]);_0x6a1e71['attributes']=_[_0x7b7e('0x33')](_0x21a15[_0x7b7e('0x2e')],qs[_0x7b7e('0x34')](_0x3ceaf5[_0x7b7e('0x30')][_0x7b7e('0x34')]));_0x6a1e71[_0x7b7e('0x35')]=_0x6a1e71[_0x7b7e('0x35')]['length']?_0x6a1e71['attributes']:_0x21a15[_0x7b7e('0x2e')];if(!_0x3ceaf5[_0x7b7e('0x30')]['hasOwnProperty'](_0x7b7e('0x36'))){_0x6a1e71[_0x7b7e('0x1d')]=qs[_0x7b7e('0x1d')](_0x3ceaf5['query'][_0x7b7e('0x1d')]);_0x6a1e71[_0x7b7e('0x1c')]=qs[_0x7b7e('0x1c')](_0x3ceaf5[_0x7b7e('0x30')][_0x7b7e('0x1c')]);}_0x6a1e71[_0x7b7e('0x37')]=qs[_0x7b7e('0x38')](_0x3ceaf5[_0x7b7e('0x30')][_0x7b7e('0x38')]);_0x6a1e71[_0x7b7e('0x39')]=qs[_0x7b7e('0x32')](_[_0x7b7e('0x3a')](_0x3ceaf5[_0x7b7e('0x30')],_0x21a15[_0x7b7e('0x32')]));if(_0x3ceaf5[_0x7b7e('0x30')][_0x7b7e('0x3b')]){_0x6a1e71['where']=_[_0x7b7e('0x3c')](_0x6a1e71[_0x7b7e('0x39')],{'$or':_[_0x7b7e('0x2f')](_0x57b9da,function(_0x242609){if(_0x242609[_0x7b7e('0x3d')]!==_0x7b7e('0x3e')){var _0x7f15={};_0x7f15[_0x242609[_0x7b7e('0x27')]]={'$like':'%'+_0x3ceaf5[_0x7b7e('0x30')][_0x7b7e('0x3b')]+'%'};return _0x7f15;}})});}_0x6a1e71=_['merge']({},_0x6a1e71,_0x3ceaf5[_0x7b7e('0x3f')]);var _0x1fa75b={'where':_0x6a1e71[_0x7b7e('0x39')]};return db[_0x7b7e('0x2a')]['count'](_0x1fa75b)[_0x7b7e('0x24')](function(_0x35b31a){_0x4c46b8[_0x7b7e('0x1b')]=_0x35b31a;if(_0x3ceaf5['query']['includeAll']){_0x6a1e71[_0x7b7e('0x40')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0x7b7e('0x41')](_0x6a1e71);})[_0x7b7e('0x24')](function(_0x4de331){_0x4c46b8[_0x7b7e('0x42')]=_0x4de331;return _0x4c46b8;})[_0x7b7e('0x24')](respondWithFilteredResult(_0x48fad1,_0x6a1e71))[_0x7b7e('0x43')](handleError(_0x48fad1,null));};exports[_0x7b7e('0x44')]=function(_0x38d32f,_0x435de5){var _0xc888e4={'raw':!![],'where':{'id':_0x38d32f[_0x7b7e('0x45')]['id']}},_0x1d9bb9={};_0x1d9bb9['model']=_['keys'](db[_0x7b7e('0x2a')]['rawAttributes']);_0x1d9bb9[_0x7b7e('0x30')]=_['keys'](_0x38d32f['query']);_0x1d9bb9[_0x7b7e('0x32')]=_['intersection'](_0x1d9bb9[_0x7b7e('0x2e')],_0x1d9bb9['query']);_0xc888e4[_0x7b7e('0x35')]=_[_0x7b7e('0x33')](_0x1d9bb9[_0x7b7e('0x2e')],qs[_0x7b7e('0x34')](_0x38d32f['query'][_0x7b7e('0x34')]));_0xc888e4[_0x7b7e('0x35')]=_0xc888e4[_0x7b7e('0x35')][_0x7b7e('0x46')]?_0xc888e4[_0x7b7e('0x35')]:_0x1d9bb9[_0x7b7e('0x2e')];if(_0x38d32f['query']['includeAll']){_0xc888e4['include']=[{'all':!![]}];}_0xc888e4=_[_0x7b7e('0x3c')]({},_0xc888e4,_0x38d32f[_0x7b7e('0x3f')]);return db[_0x7b7e('0x2a')][_0x7b7e('0x47')](_0xc888e4)[_0x7b7e('0x24')](handleEntityNotFound(_0x435de5,null))[_0x7b7e('0x24')](respondWithResult(_0x435de5,null))['catch'](handleError(_0x435de5,null));};exports[_0x7b7e('0x48')]=function(_0x42e560,_0x5a0832){return db['VoiceTransferReport'][_0x7b7e('0x48')](_0x42e560[_0x7b7e('0x49')],{})[_0x7b7e('0x24')](respondWithResult(_0x5a0832,0xc9))[_0x7b7e('0x43')](handleError(_0x5a0832,null));};exports[_0x7b7e('0x23')]=function(_0xb46776,_0x590154){if(_0xb46776[_0x7b7e('0x49')]['id']){delete _0xb46776['body']['id'];}return db[_0x7b7e('0x2a')][_0x7b7e('0x47')]({'where':{'id':_0xb46776[_0x7b7e('0x45')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x590154,null))['then'](saveUpdates(_0xb46776[_0x7b7e('0x49')],null))[_0x7b7e('0x24')](respondWithResult(_0x590154,null))[_0x7b7e('0x43')](handleError(_0x590154,null));};exports[_0x7b7e('0x25')]=function(_0x1f9d0f,_0x5cce7c){return db[_0x7b7e('0x2a')][_0x7b7e('0x47')]({'where':{'id':_0x1f9d0f[_0x7b7e('0x45')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x5cce7c,null))[_0x7b7e('0x24')](removeEntity(_0x5cce7c,null))['catch'](handleError(_0x5cce7c,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index d38c441..d35cb46 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 _0x9195=['lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','define','VoiceTransferReport','report_call_transfer'];(function(_0x27d941,_0x3eb7cb){var _0x15c52d=function(_0x4e7537){while(--_0x4e7537){_0x27d941['push'](_0x27d941['shift']());}};_0x15c52d(++_0x3eb7cb);}(_0x9195,0x129));var _0x5919=function(_0x2b7795,_0x37340c){_0x2b7795=_0x2b7795-0x0;var _0x23e929=_0x9195[_0x2b7795];return _0x23e929;};'use strict';var _=require(_0x5919('0x0'));var util=require(_0x5919('0x1'));var logger=require(_0x5919('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5919('0x3'));var rp=require(_0x5919('0x4'));var fs=require('fs');var path=require(_0x5919('0x5'));var rimraf=require(_0x5919('0x6'));var config=require(_0x5919('0x7'));var attributes=require('./voiceTransferReport.attributes');module['exports']=function(_0x191b9,_0x540103){return _0x191b9[_0x5919('0x8')](_0x5919('0x9'),attributes,{'tableName':_0x5919('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf4bb=['lodash','util','api','bluebird','path','rimraf','../../config/environment','exports','define','report_call_transfer'];(function(_0xa5f0c4,_0x1b042d){var _0x16b08a=function(_0x428263){while(--_0x428263){_0xa5f0c4['push'](_0xa5f0c4['shift']());}};_0x16b08a(++_0x1b042d);}(_0xf4bb,0x118));var _0xbf4b=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0xf4bb[_0x58afd5];return _0x3e503b;};'use strict';var _=require(_0xbf4b('0x0'));var util=require(_0xbf4b('0x1'));var logger=require('../../config/logger')(_0xbf4b('0x2'));var moment=require('moment');var BPromise=require(_0xbf4b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbf4b('0x4'));var rimraf=require(_0xbf4b('0x5'));var config=require(_0xbf4b('0x6'));var attributes=require('./voiceTransferReport.attributes');module[_0xbf4b('0x7')]=function(_0x5927c0,_0x495075){return _0x5927c0[_0xbf4b('0x8')]('VoiceTransferReport',attributes,{'tableName':_0xbf4b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index a9dba90..494834f 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 _0x7240=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceTransferReport,\x20%s,\x20%s','message','CreateVoiceTransferReport','create','options','raw','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x7bfc45,_0x2640ff){var _0x5cce89=function(_0x5561c9){while(--_0x5561c9){_0x7bfc45['push'](_0x7bfc45['shift']());}};_0x5cce89(++_0x2640ff);}(_0x7240,0xe4));var _0x0724=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x7240[_0x173441];return _0x2423a8;};'use strict';var _=require('lodash');var util=require(_0x0724('0x0'));var moment=require(_0x0724('0x1'));var BPromise=require(_0x0724('0x2'));var rs=require(_0x0724('0x3'));var fs=require('fs');var Redis=require(_0x0724('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0724('0x5'));var logger=require(_0x0724('0x6'))(_0x0724('0x7'));var config=require(_0x0724('0x8'));var jayson=require(_0x0724('0x9'));var client=jayson[_0x0724('0xa')][_0x0724('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2c039f,_0x4d1194,_0x53a157){return new BPromise(function(_0x4146b6,_0x5c237e){return client[_0x0724('0xc')](_0x2c039f,_0x53a157)['then'](function(_0xd9c289){logger[_0x0724('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x4d1194,_0x0724('0xe'));logger[_0x0724('0xf')](_0x0724('0x10'),_0x4d1194,_0x0724('0xe'),JSON[_0x0724('0x11')](_0xd9c289));if(_0xd9c289[_0x0724('0x12')]){if(_0xd9c289[_0x0724('0x12')]['code']===0x1f4){logger['error'](_0x0724('0x13'),_0x4d1194,_0xd9c289[_0x0724('0x12')][_0x0724('0x14')]);return _0x5c237e(_0xd9c289['error'][_0x0724('0x14')]);}logger[_0x0724('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x4d1194,_0xd9c289[_0x0724('0x12')][_0x0724('0x14')]);return _0x4146b6(_0xd9c289[_0x0724('0x12')]['message']);}else{logger[_0x0724('0xd')](_0x0724('0x13'),_0x4d1194,_0x0724('0xe'));_0x4146b6(_0xd9c289['result']['message']);}})['catch'](function(_0xab0435){logger['error'](_0x0724('0x13'),_0x4d1194,_0xab0435);_0x5c237e(_0xab0435);});});}exports[_0x0724('0x15')]=function(_0x15ea18){var _0x178f34=this;return new Promise(function(_0x5dad92,_0x3c55ef){return db['VoiceTransferReport'][_0x0724('0x16')](_0x15ea18['body'],{'raw':_0x15ea18[_0x0724('0x17')]?_0x15ea18[_0x0724('0x17')][_0x0724('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x5d3981){logger[_0x0724('0xd')]('CreateVoiceTransferReport',_0x15ea18);logger[_0x0724('0xf')](_0x0724('0x15'),_0x15ea18,JSON[_0x0724('0x11')](_0x5d3981));_0x5dad92(_0x5d3981);})[_0x0724('0x19')](function(_0x488f5c){logger[_0x0724('0x12')](_0x0724('0x15'),_0x488f5c[_0x0724('0x14')],_0x15ea18);_0x3c55ef(_0x178f34['error'](0x1f4,_0x488f5c[_0x0724('0x14')]));});});}; \ No newline at end of file +var _0xee3a=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x22c2db,_0x3534e6){var _0x254a57=function(_0x16f415){while(--_0x16f415){_0x22c2db['push'](_0x22c2db['shift']());}};_0x254a57(++_0x3534e6);}(_0xee3a,0x6e));var _0xaee3=function(_0xf0be81,_0xc0293b){_0xf0be81=_0xf0be81-0x0;var _0x596b4d=_0xee3a[_0xf0be81];return _0x596b4d;};'use strict';var _=require(_0xaee3('0x0'));var util=require(_0xaee3('0x1'));var moment=require(_0xaee3('0x2'));var BPromise=require(_0xaee3('0x3'));var rs=require(_0xaee3('0x4'));var fs=require('fs');var Redis=require(_0xaee3('0x5'));var db=require(_0xaee3('0x6'))['db'];var utils=require(_0xaee3('0x7'));var logger=require('../../config/logger')(_0xaee3('0x8'));var config=require('../../config/environment');var jayson=require(_0xaee3('0x9'));var client=jayson[_0xaee3('0xa')][_0xaee3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ae899,_0x17f118,_0x353ba6){return new BPromise(function(_0xa5ead1,_0x4d0f31){return client[_0xaee3('0xc')](_0x5ae899,_0x353ba6)[_0xaee3('0xd')](function(_0x4fc095){logger[_0xaee3('0xe')](_0xaee3('0xf'),_0x17f118,_0xaee3('0x10'));logger[_0xaee3('0x11')](_0xaee3('0x12'),_0x17f118,_0xaee3('0x10'),JSON[_0xaee3('0x13')](_0x4fc095));if(_0x4fc095['error']){if(_0x4fc095[_0xaee3('0x14')][_0xaee3('0x15')]===0x1f4){logger[_0xaee3('0x14')]('VoiceTransferReport,\x20%s,\x20%s',_0x17f118,_0x4fc095['error']['message']);return _0x4d0f31(_0x4fc095['error'][_0xaee3('0x16')]);}logger['error'](_0xaee3('0xf'),_0x17f118,_0x4fc095[_0xaee3('0x14')][_0xaee3('0x16')]);return _0xa5ead1(_0x4fc095[_0xaee3('0x14')][_0xaee3('0x16')]);}else{logger[_0xaee3('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x17f118,_0xaee3('0x10'));_0xa5ead1(_0x4fc095[_0xaee3('0x17')][_0xaee3('0x16')]);}})['catch'](function(_0x3073b4){logger[_0xaee3('0x14')](_0xaee3('0xf'),_0x17f118,_0x3073b4);_0x4d0f31(_0x3073b4);});});}exports[_0xaee3('0x18')]=function(_0x20532e){var _0xdcf404=this;return new Promise(function(_0xdc2b91,_0xdcc897){return db[_0xaee3('0x19')][_0xaee3('0x1a')](_0x20532e[_0xaee3('0x1b')],{'raw':_0x20532e[_0xaee3('0x1c')]?_0x20532e[_0xaee3('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0xc60c2){logger[_0xaee3('0xe')](_0xaee3('0x18'),_0x20532e);logger[_0xaee3('0x11')](_0xaee3('0x18'),_0x20532e,JSON[_0xaee3('0x13')](_0xc60c2));_0xdc2b91(_0xc60c2);})['catch'](function(_0x7eb7cd){logger[_0xaee3('0x14')]('CreateVoiceTransferReport',_0x7eb7cd[_0xaee3('0x16')],_0x20532e);_0xdcc897(_0xdcf404['error'](0x1f4,_0x7eb7cd[_0xaee3('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 7c33475..48a3461 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 _0x0434=['isAuthenticated','/answer','answer','/hold','hold','/unhold','unhold','/calls','calls','/transfer','exports','express','Router','../../components/auth/service','./webbar.controller','post','canUpdate','originate','/hangup'];(function(_0xd3c565,_0x4110a6){var _0x3a06c2=function(_0xd16839){while(--_0xd16839){_0xd3c565['push'](_0xd3c565['shift']());}};_0x3a06c2(++_0x4110a6);}(_0x0434,0x1ad));var _0x4043=function(_0x4164f2,_0x38669f){_0x4164f2=_0x4164f2-0x0;var _0x2575c7=_0x0434[_0x4164f2];return _0x2575c7;};'use strict';var express=require(_0x4043('0x0'));var router=express[_0x4043('0x1')]();var auth=require(_0x4043('0x2'));var controller=require(_0x4043('0x3'));router[_0x4043('0x4')]('/originate',auth['isAuthenticated'](),auth[_0x4043('0x5')](),controller[_0x4043('0x6')]);router[_0x4043('0x4')](_0x4043('0x7'),auth[_0x4043('0x8')](),auth[_0x4043('0x5')](),controller['hangup']);router[_0x4043('0x4')](_0x4043('0x9'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x4043('0xa')]);router[_0x4043('0x4')](_0x4043('0xb'),auth[_0x4043('0x8')](),auth[_0x4043('0x5')](),controller[_0x4043('0xc')]);router[_0x4043('0x4')](_0x4043('0xd'),auth['isAuthenticated'](),auth[_0x4043('0x5')](),controller[_0x4043('0xe')]);router[_0x4043('0x4')](_0x4043('0xf'),auth[_0x4043('0x8')](),auth['canUpdate'](),controller[_0x4043('0x10')]);router[_0x4043('0x4')](_0x4043('0x11'),auth[_0x4043('0x8')](),auth[_0x4043('0x5')](),controller['transfer']);module[_0x4043('0x12')]=router; \ No newline at end of file +var _0x630e=['../../components/auth/service','/originate','isAuthenticated','canUpdate','post','/hangup','hangup','/answer','answer','/hold','/unhold','unhold','/calls','calls','/transfer','transfer','exports','express'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x630e,0x1af));var _0xe630=function(_0x2952d6,_0x514d66){_0x2952d6=_0x2952d6-0x0;var _0x5245ef=_0x630e[_0x2952d6];return _0x5245ef;};'use strict';var express=require(_0xe630('0x0'));var router=express['Router']();var auth=require(_0xe630('0x1'));var controller=require('./webbar.controller');router['post'](_0xe630('0x2'),auth[_0xe630('0x3')](),auth[_0xe630('0x4')](),controller['originate']);router[_0xe630('0x5')](_0xe630('0x6'),auth[_0xe630('0x3')](),auth[_0xe630('0x4')](),controller[_0xe630('0x7')]);router['post'](_0xe630('0x8'),auth[_0xe630('0x3')](),auth['canUpdate'](),controller[_0xe630('0x9')]);router['post'](_0xe630('0xa'),auth[_0xe630('0x3')](),auth[_0xe630('0x4')](),controller['hold']);router['post'](_0xe630('0xb'),auth[_0xe630('0x3')](),auth[_0xe630('0x4')](),controller[_0xe630('0xc')]);router['post'](_0xe630('0xd'),auth[_0xe630('0x3')](),auth[_0xe630('0x4')](),controller[_0xe630('0xe')]);router[_0xe630('0x5')](_0xe630('0xf'),auth[_0xe630('0x3')](),auth[_0xe630('0x4')](),controller[_0xe630('0x10')]);module[_0xe630('0x11')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index bd2f528..8eff076 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 _0xa9e0=['name','status','send','NotFound','request','then','code','message','result','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','callNumber','callerId','entityFound:','format','webbar:originate','hangup','hangup\x20fired:','sessionId','webbar:hangup','hangup\x20executed!','catch','answer\x20fired:','userId','user:%s','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','webbar:unhold','calls','calls\x20fired:','conference','conference\x20fired:','conference\x20executed!','transfer','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','bluebird','client','http','../../config/logger','webbarapi','ioredis','defaults','redis','localhost','validate','string','callNumber\x20is\x20required','number','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','emit','log','handleError:','error','stack'];(function(_0x568cb0,_0x1cbc08){var _0x2ae280=function(_0x4e3800){while(--_0x4e3800){_0x568cb0['push'](_0x568cb0['shift']());}};_0x2ae280(++_0x1cbc08);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'use strict';var path=require(_0x0a9e('0x0'));var fs=require('fs');var _=require(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];var config=require('../../config/environment');var util=require('util');var BPromise=require(_0x0a9e('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0x0a9e('0x4')][_0x0a9e('0x5')]({'port':0x232a});var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var Redis=require(_0x0a9e('0x8'));config['redis']=_[_0x0a9e('0x9')](config[_0x0a9e('0xa')],{'host':_0x0a9e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Schema=require(_0x0a9e('0xc'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x0a9e('0xd'),'required':[!![],_0x0a9e('0xe')]},'callerId':{'type':_0x0a9e('0xd')},'callbackUrl':{'type':_0x0a9e('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0x0a9e('0xf'),'required':[!![],_0x0a9e('0x10')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x0a9e('0xf'),'required':[!![],_0x0a9e('0x10')]},'sessionId':{'type':_0x0a9e('0xd'),'required':[!![],_0x0a9e('0x11')]},'transferNumber':{'type':_0x0a9e('0xd'),'required':[!![],_0x0a9e('0x12')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x0a9e('0x10')]},'sessionId':{'type':_0x0a9e('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x0a9e('0xf'),'required':[!![],_0x0a9e('0x10')]},'sessionId':{'type':_0x0a9e('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x0a9e('0xf'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x0a9e('0xf'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x1985b6,_0x519dfd,_0x16033c){logger[_0x0a9e('0x13')](_0x1985b6,_0x519dfd,JSON['stringify'](_0x16033c));io['to'](_0x1985b6)[_0x0a9e('0x14')](_0x519dfd,_0x16033c);}function handleError(_0x5a0a06){return function(_0x459eb1){console[_0x0a9e('0x15')](_0x0a9e('0x16'),_0x459eb1,_0x459eb1 instanceof RangeError);logger[_0x0a9e('0x17')](_0x459eb1[_0x0a9e('0x18')]);if(_0x459eb1 instanceof RangeError){if(_0x459eb1[_0x0a9e('0x19')]){delete _0x459eb1[_0x0a9e('0x19')];}_0x5a0a06[_0x0a9e('0x1a')](0x194)[_0x0a9e('0x1b')](_0x459eb1);}else{if(_0x459eb1[_0x0a9e('0x19')]){delete _0x459eb1[_0x0a9e('0x19')];}_0x5a0a06[_0x0a9e('0x1a')](0x1f4)['send'](_0x459eb1);}};}function checkError(){return function(_0x2c3407){if(!_0x2c3407){throw new RangeError(_0x0a9e('0x1c'));}return _0x2c3407;};}function respondWithRpcPromise(_0x53682f,_0x20f109){return new BPromise(function(_0x5a09ef,_0x588269){var _0x3a02e1=amiClient;return _0x3a02e1[_0x0a9e('0x1d')](_0x53682f,_0x20f109)[_0x0a9e('0x1e')](function(_0x30bae6){if(_0x30bae6['error']){if(_0x30bae6[_0x0a9e('0x17')][_0x0a9e('0x1f')]===0x1f4){return _0x588269(_0x30bae6[_0x0a9e('0x17')][_0x0a9e('0x20')]);}return _0x5a09ef(_0x30bae6[_0x0a9e('0x17')][_0x0a9e('0x20')]);}else{_0x5a09ef(_0x30bae6[_0x0a9e('0x21')]);}})['catch'](function(_0x59181e){_0x588269(_0x59181e);});});}function getAgent(_0x197ec0){return db[_0x0a9e('0x22')][_0x0a9e('0x23')]({'where':{'id':_0x197ec0,'role':_0x0a9e('0x24')}})['then'](checkError());}function getAgentCheckSession(_0x384319,_0x479bc4){return new BPromise(function(_0x45a1e7,_0x5bfb33){var _0x1dc186=respondWithRpcPromise(_0x0a9e('0x25'));var _0x25fba9=getAgent(_0x384319);Promise[_0x0a9e('0x26')]([_0x1dc186,_0x25fba9])[_0x0a9e('0x1e')](function(_0x1538a4){var _0x11c3b6=_0x1538a4[0x0];var _0x14de77=_0x1538a4[0x1];var _0x5a101a=_[_0x0a9e('0x27')](_0x11c3b6[_0x0a9e('0x28')],function(_0x2b1f27){return _0x2b1f27[_0x0a9e('0x29')]==_0x14de77['id']&&_0x2b1f27['sessionId']==_0x479bc4;});if(_0x5a101a[_0x0a9e('0x2a')]==0x1){_0x45a1e7(_0x14de77);}else{_0x5bfb33(new RangeError(_0x0a9e('0x2b')+_0x479bc4+_0x0a9e('0x2c')));}});});}exports[_0x0a9e('0x2d')]=function(_0x58b06f,_0x563b45){logger[_0x0a9e('0x13')](_0x0a9e('0x2e'),_0x58b06f[_0x0a9e('0x2f')]);var _0x540530=originateValidation[_0x0a9e('0xc')](_0x58b06f['body']);if(_0x540530[_0x0a9e('0x2a')]>0x0){return _0x563b45[_0x0a9e('0x1a')](0x190)[_0x0a9e('0x30')](_0x540530);}var _0x33bdb7=_0x58b06f[_0x0a9e('0x2f')]['userId'];var _0x66c1d2=_0x58b06f[_0x0a9e('0x2f')][_0x0a9e('0x31')];var _0x2da5c0=_0x58b06f[_0x0a9e('0x2f')][_0x0a9e('0x32')];var _0x332d35=_0x58b06f[_0x0a9e('0x2f')]['callbackUrl'];return getAgent(_0x33bdb7)[_0x0a9e('0x1e')](function(_0x5e7238){logger[_0x0a9e('0x13')](_0x0a9e('0x33'),_0x5e7238[_0x0a9e('0x19')]);emit(util[_0x0a9e('0x34')]('user:%s',_0x5e7238[_0x0a9e('0x19')]),_0x0a9e('0x35'),{'callNumber':_0x66c1d2,'callerId':_0x2da5c0,'callbackUrl':_0x332d35});return _0x563b45[_0x0a9e('0x1a')](0xc8)[_0x0a9e('0x30')]({'error':![],'message':'originate\x20executed!'});})['catch'](handleError(_0x563b45));};exports[_0x0a9e('0x36')]=function(_0x5640eb,_0x24936a){logger[_0x0a9e('0x13')](_0x0a9e('0x37'),_0x5640eb[_0x0a9e('0x2f')]);var _0x4f41ae=hangupValidation[_0x0a9e('0xc')](_0x5640eb[_0x0a9e('0x2f')]);if(_0x4f41ae[_0x0a9e('0x2a')]>0x0){return _0x24936a['status'](0x190)[_0x0a9e('0x30')](_0x4f41ae);}var _0x1a180b=_0x5640eb[_0x0a9e('0x2f')]['userId'];var _0x546ef8=_0x5640eb[_0x0a9e('0x2f')][_0x0a9e('0x38')];return getAgent(_0x1a180b)['then'](function(_0x2b814e){logger[_0x0a9e('0x13')](_0x0a9e('0x33'),_0x2b814e[_0x0a9e('0x19')]);emit(util['format']('user:%s',_0x2b814e[_0x0a9e('0x19')]),_0x0a9e('0x39'),{'sessionId':_0x546ef8});return _0x24936a['status'](0xc8)[_0x0a9e('0x30')]({'error':![],'message':_0x0a9e('0x3a')});})[_0x0a9e('0x3b')](handleError(_0x24936a));};exports['answer']=function(_0x316c8f,_0x2cfea9){logger[_0x0a9e('0x13')](_0x0a9e('0x3c'),_0x316c8f[_0x0a9e('0x2f')]);var _0xeaa5e5=answerValidation[_0x0a9e('0xc')](_0x316c8f[_0x0a9e('0x2f')]);if(_0xeaa5e5[_0x0a9e('0x2a')]>0x0){return _0x2cfea9[_0x0a9e('0x1a')](0x190)[_0x0a9e('0x30')](_0xeaa5e5);}var _0x148007=_0x316c8f[_0x0a9e('0x2f')][_0x0a9e('0x3d')];var _0x37f6cc=_0x316c8f['body']['sessionId'];return getAgent(_0x148007)[_0x0a9e('0x1e')](function(_0xb3795a){logger[_0x0a9e('0x13')](_0x0a9e('0x33'),_0xb3795a[_0x0a9e('0x19')]);emit(util[_0x0a9e('0x34')](_0x0a9e('0x3e'),_0xb3795a[_0x0a9e('0x19')]),_0x0a9e('0x3f'),{'sessionId':_0x37f6cc});return _0x2cfea9[_0x0a9e('0x1a')](0xc8)[_0x0a9e('0x30')]({'error':![],'message':_0x0a9e('0x40')});})['catch'](handleError(_0x2cfea9));};exports[_0x0a9e('0x41')]=function(_0x138b8b,_0xdd268f){logger[_0x0a9e('0x13')](_0x0a9e('0x42'),_0x138b8b[_0x0a9e('0x2f')]);var _0x21eb86=holdValidation[_0x0a9e('0xc')](_0x138b8b['body']);if(_0x21eb86[_0x0a9e('0x2a')]>0x0){return _0xdd268f['status'](0x190)[_0x0a9e('0x30')](_0x21eb86);}var _0x476688=_0x138b8b[_0x0a9e('0x2f')]['userId'];var _0x14bec2=_0x138b8b[_0x0a9e('0x2f')][_0x0a9e('0x38')];return getAgent(_0x476688)[_0x0a9e('0x1e')](function(_0x45c845){logger[_0x0a9e('0x13')](_0x0a9e('0x33'),_0x45c845['name']);emit(util[_0x0a9e('0x34')](_0x0a9e('0x3e'),_0x45c845[_0x0a9e('0x19')]),_0x0a9e('0x43'),{'sessionId':_0x14bec2});return _0xdd268f[_0x0a9e('0x1a')](0xc8)[_0x0a9e('0x30')]({'error':![],'message':_0x0a9e('0x44')});})[_0x0a9e('0x3b')](handleError(_0xdd268f));};exports[_0x0a9e('0x45')]=function(_0x58a5c2,_0xe401a){logger[_0x0a9e('0x13')]('unhold\x20fired:',_0x58a5c2['body']);var _0x5ddf84=unholdValidation[_0x0a9e('0xc')](_0x58a5c2[_0x0a9e('0x2f')]);if(_0x5ddf84[_0x0a9e('0x2a')]>0x0){return _0xe401a[_0x0a9e('0x1a')](0x190)[_0x0a9e('0x30')](_0x5ddf84);}var _0x30decb=_0x58a5c2[_0x0a9e('0x2f')][_0x0a9e('0x3d')];var _0x5d38ae=_0x58a5c2['body']['sessionId'];return getAgent(_0x30decb)[_0x0a9e('0x1e')](function(_0x204173){logger[_0x0a9e('0x13')]('entityFound:',_0x204173[_0x0a9e('0x19')]);emit(util[_0x0a9e('0x34')]('user:%s',_0x204173['name']),_0x0a9e('0x46'),{'sessionId':_0x5d38ae});return _0xe401a['status'](0xc8)[_0x0a9e('0x30')]({'error':![],'message':'unhold\x20executed!'});})[_0x0a9e('0x3b')](handleError(_0xe401a));};exports[_0x0a9e('0x47')]=function(_0x439340,_0x53613a){logger[_0x0a9e('0x13')](_0x0a9e('0x48'),_0x53613a['body']);var _0x50f687=callsValidation[_0x0a9e('0xc')](_0x439340[_0x0a9e('0x2f')]);if(_0x50f687['length']>0x0){return _0x53613a[_0x0a9e('0x1a')](0x190)['json'](_0x50f687);}var _0x211ef9=_0x439340['body'][_0x0a9e('0x3d')];var _0x4a6deb=respondWithRpcPromise('VoiceChannels');var _0x5df0ad=getAgent(_0x211ef9);return Promise[_0x0a9e('0x26')]([_0x4a6deb,_0x5df0ad])['then'](function(_0x2f7092){var _0x65432=_0x2f7092[0x0];var _0x3cfd00=_0x2f7092[0x1];var _0x19b4df=_[_0x0a9e('0x27')](_0x65432[_0x0a9e('0x28')],function(_0xd10662){return _0xd10662[_0x0a9e('0x29')]==_0x3cfd00['id'];});return _0x53613a['status'](0xc8)[_0x0a9e('0x30')]({'count':_0x19b4df[_0x0a9e('0x2a')],'rows':_0x19b4df});})[_0x0a9e('0x3b')](handleError(_0x53613a));};exports[_0x0a9e('0x49')]=function(_0xb83dfd,_0x156662){logger['info'](_0x0a9e('0x4a'),_0xb83dfd[_0x0a9e('0x2f')]);var _0x5239ef=conferenceValidation[_0x0a9e('0xc')](_0xb83dfd['body']);if(_0x5239ef[_0x0a9e('0x2a')]>0x0){return _0x156662['status'](0x190)['json'](_0x5239ef);}var _0x5674ee=_0xb83dfd[_0x0a9e('0x2f')]['userId'];return getAgent(_0x5674ee)[_0x0a9e('0x1e')](function(_0x1fc70e){logger[_0x0a9e('0x13')](_0x0a9e('0x33'),_0x1fc70e[_0x0a9e('0x19')]);emit(util[_0x0a9e('0x34')]('user:%s',_0x1fc70e[_0x0a9e('0x19')]),'webbar:conference');return _0x156662[_0x0a9e('0x1a')](0xc8)[_0x0a9e('0x30')]({'error':![],'message':_0x0a9e('0x4b')});})['catch'](handleError(_0x156662));};exports[_0x0a9e('0x4c')]=function(_0x156f1c,_0x119677){logger[_0x0a9e('0x13')]('transfer\x20fired:',_0x156f1c[_0x0a9e('0x2f')]);var _0xe05a5a=transferValidation['validate'](_0x156f1c[_0x0a9e('0x2f')]);if(_0xe05a5a[_0x0a9e('0x2a')]>0x0){return _0x119677[_0x0a9e('0x1a')](0x190)[_0x0a9e('0x30')](_0xe05a5a);}var _0x401837=_0x156f1c['body'][_0x0a9e('0x3d')];var _0x2937e0=_0x156f1c[_0x0a9e('0x2f')]['sessionId'];var _0x3528b7=_0x156f1c['body']['transferNumber'];return getAgent(_0x401837)[_0x0a9e('0x1e')](function(_0x4556c5){logger[_0x0a9e('0x13')](_0x0a9e('0x33'),_0x4556c5[_0x0a9e('0x19')]);emit(util[_0x0a9e('0x34')](_0x0a9e('0x3e'),_0x4556c5[_0x0a9e('0x19')]),_0x0a9e('0x4d'),{'sessionId':_0x2937e0,'transferNumber':_0x3528b7});return _0x119677[_0x0a9e('0x1a')](0xc8)[_0x0a9e('0x30')]({'error':![],'message':_0x0a9e('0x4e')});})[_0x0a9e('0x3b')](handleError(_0x119677));}; \ No newline at end of file +var _0xcb26=['hangup\x20fired:','webbar:hangup','answer','answer\x20fired:','webbar:answer','answer\x20executed!','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference\x20fired:','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','lodash','../../mysqldb','../../config/environment','util','bluebird','client','../../config/logger','webbarapi','ioredis','redis','defaults','validate','number','userId\x20is\x20required','callNumber\x20is\x20required','string','transferNumber\x20is\x20required','stringify','emit','log','handleError:','error','name','status','send','NotFound','request','then','code','message','result','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','originate','info','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','catch','hangup'];(function(_0x389136,_0x5d2bc4){var _0x12e31e=function(_0x2c531f){while(--_0x2c531f){_0x389136['push'](_0x389136['shift']());}};_0x12e31e(++_0x5d2bc4);}(_0xcb26,0x14c));var _0x6cb2=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0xcb26[_0x28aea5];return _0x6a55f9;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x6cb2('0x0'));var db=require(_0x6cb2('0x1'))['db'];var config=require(_0x6cb2('0x2'));var util=require(_0x6cb2('0x3'));var BPromise=require(_0x6cb2('0x4'));var jayson=require('jayson/promise');var amiClient=jayson[_0x6cb2('0x5')]['http']({'port':0x232a});var logger=require(_0x6cb2('0x6'))(_0x6cb2('0x7'));var Redis=require(_0x6cb2('0x8'));config[_0x6cb2('0x9')]=_[_0x6cb2('0xa')](config[_0x6cb2('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6cb2('0x9')]));var Schema=require(_0x6cb2('0xb'));var originateValidation=new Schema({'userId':{'type':_0x6cb2('0xc'),'required':[!![],_0x6cb2('0xd')]},'callNumber':{'type':'string','required':[!![],_0x6cb2('0xe')]},'callerId':{'type':_0x6cb2('0xf')},'callbackUrl':{'type':_0x6cb2('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0x6cb2('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x6cb2('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x6cb2('0xc'),'required':[!![],_0x6cb2('0xd')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x6cb2('0xd')]},'sessionId':{'type':_0x6cb2('0xf'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':'string','required':[!![],_0x6cb2('0x10')]}});var holdValidation=new Schema({'userId':{'type':_0x6cb2('0xc'),'required':[!![],_0x6cb2('0xd')]},'sessionId':{'type':_0x6cb2('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x6cb2('0xd')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x6cb2('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x6cb2('0xd')]}});function emit(_0x57e27a,_0x21cb1a,_0x46c802){logger['info'](_0x57e27a,_0x21cb1a,JSON[_0x6cb2('0x11')](_0x46c802));io['to'](_0x57e27a)[_0x6cb2('0x12')](_0x21cb1a,_0x46c802);}function handleError(_0x42ab4d){return function(_0x39b1b7){console[_0x6cb2('0x13')](_0x6cb2('0x14'),_0x39b1b7,_0x39b1b7 instanceof RangeError);logger[_0x6cb2('0x15')](_0x39b1b7['stack']);if(_0x39b1b7 instanceof RangeError){if(_0x39b1b7[_0x6cb2('0x16')]){delete _0x39b1b7[_0x6cb2('0x16')];}_0x42ab4d[_0x6cb2('0x17')](0x194)[_0x6cb2('0x18')](_0x39b1b7);}else{if(_0x39b1b7[_0x6cb2('0x16')]){delete _0x39b1b7[_0x6cb2('0x16')];}_0x42ab4d[_0x6cb2('0x17')](0x1f4)[_0x6cb2('0x18')](_0x39b1b7);}};}function checkError(){return function(_0x4a2e67){if(!_0x4a2e67){throw new RangeError(_0x6cb2('0x19'));}return _0x4a2e67;};}function respondWithRpcPromise(_0x4d1dd6,_0x6c3eff){return new BPromise(function(_0x4c3bba,_0x413f1d){var _0x3be26d=amiClient;return _0x3be26d[_0x6cb2('0x1a')](_0x4d1dd6,_0x6c3eff)[_0x6cb2('0x1b')](function(_0x43f972){if(_0x43f972[_0x6cb2('0x15')]){if(_0x43f972[_0x6cb2('0x15')][_0x6cb2('0x1c')]===0x1f4){return _0x413f1d(_0x43f972[_0x6cb2('0x15')][_0x6cb2('0x1d')]);}return _0x4c3bba(_0x43f972['error'][_0x6cb2('0x1d')]);}else{_0x4c3bba(_0x43f972[_0x6cb2('0x1e')]);}})['catch'](function(_0x375833){_0x413f1d(_0x375833);});});}function getAgent(_0x4b3bf7){return db[_0x6cb2('0x1f')][_0x6cb2('0x20')]({'where':{'id':_0x4b3bf7,'role':_0x6cb2('0x21')}})[_0x6cb2('0x1b')](checkError());}function getAgentCheckSession(_0x5b21a4,_0x29860f){return new BPromise(function(_0x5253da,_0x50c5c6){var _0x2319a6=respondWithRpcPromise(_0x6cb2('0x22'));var _0x499b33=getAgent(_0x5b21a4);Promise[_0x6cb2('0x23')]([_0x2319a6,_0x499b33])['then'](function(_0x3abbe5){var _0x1b5111=_0x3abbe5[0x0];var _0x5cc052=_0x3abbe5[0x1];var _0xb69f97=_[_0x6cb2('0x24')](_0x1b5111[_0x6cb2('0x25')],function(_0x5ce14e){return _0x5ce14e[_0x6cb2('0x26')]==_0x5cc052['id']&&_0x5ce14e[_0x6cb2('0x27')]==_0x29860f;});if(_0xb69f97[_0x6cb2('0x28')]==0x1){_0x5253da(_0x5cc052);}else{_0x50c5c6(new RangeError(_0x6cb2('0x29')+_0x29860f+'\x20not\x20found!'));}});});}exports[_0x6cb2('0x2a')]=function(_0x4f4092,_0x298331){logger[_0x6cb2('0x2b')](_0x6cb2('0x2c'),_0x4f4092[_0x6cb2('0x2d')]);var _0x4068df=originateValidation[_0x6cb2('0xb')](_0x4f4092[_0x6cb2('0x2d')]);if(_0x4068df[_0x6cb2('0x28')]>0x0){return _0x298331[_0x6cb2('0x17')](0x190)[_0x6cb2('0x2e')](_0x4068df);}var _0x525c6a=_0x4f4092[_0x6cb2('0x2d')][_0x6cb2('0x2f')];var _0x14764a=_0x4f4092[_0x6cb2('0x2d')][_0x6cb2('0x30')];var _0x2e2844=_0x4f4092[_0x6cb2('0x2d')][_0x6cb2('0x31')];var _0x46aa45=_0x4f4092[_0x6cb2('0x2d')][_0x6cb2('0x32')];return getAgent(_0x525c6a)[_0x6cb2('0x1b')](function(_0x11f848){logger['info'](_0x6cb2('0x33'),_0x11f848[_0x6cb2('0x16')]);emit(util[_0x6cb2('0x34')](_0x6cb2('0x35'),_0x11f848[_0x6cb2('0x16')]),_0x6cb2('0x36'),{'callNumber':_0x14764a,'callerId':_0x2e2844,'callbackUrl':_0x46aa45});return _0x298331[_0x6cb2('0x17')](0xc8)[_0x6cb2('0x2e')]({'error':![],'message':_0x6cb2('0x37')});})[_0x6cb2('0x38')](handleError(_0x298331));};exports[_0x6cb2('0x39')]=function(_0xca6a9e,_0x5a2ca1){logger[_0x6cb2('0x2b')](_0x6cb2('0x3a'),_0xca6a9e[_0x6cb2('0x2d')]);var _0x5e20f7=hangupValidation[_0x6cb2('0xb')](_0xca6a9e[_0x6cb2('0x2d')]);if(_0x5e20f7['length']>0x0){return _0x5a2ca1[_0x6cb2('0x17')](0x190)[_0x6cb2('0x2e')](_0x5e20f7);}var _0x37eaa1=_0xca6a9e[_0x6cb2('0x2d')]['userId'];var _0x418403=_0xca6a9e['body'][_0x6cb2('0x27')];return getAgent(_0x37eaa1)['then'](function(_0xc2bf30){logger[_0x6cb2('0x2b')]('entityFound:',_0xc2bf30[_0x6cb2('0x16')]);emit(util['format'](_0x6cb2('0x35'),_0xc2bf30['name']),_0x6cb2('0x3b'),{'sessionId':_0x418403});return _0x5a2ca1[_0x6cb2('0x17')](0xc8)[_0x6cb2('0x2e')]({'error':![],'message':'hangup\x20executed!'});})[_0x6cb2('0x38')](handleError(_0x5a2ca1));};exports[_0x6cb2('0x3c')]=function(_0x120419,_0x716bdd){logger[_0x6cb2('0x2b')](_0x6cb2('0x3d'),_0x120419[_0x6cb2('0x2d')]);var _0x518e80=answerValidation[_0x6cb2('0xb')](_0x120419[_0x6cb2('0x2d')]);if(_0x518e80[_0x6cb2('0x28')]>0x0){return _0x716bdd['status'](0x190)[_0x6cb2('0x2e')](_0x518e80);}var _0x2a4d84=_0x120419[_0x6cb2('0x2d')][_0x6cb2('0x2f')];var _0x2fbf5b=_0x120419[_0x6cb2('0x2d')][_0x6cb2('0x27')];return getAgent(_0x2a4d84)[_0x6cb2('0x1b')](function(_0x3eb34f){logger['info'](_0x6cb2('0x33'),_0x3eb34f[_0x6cb2('0x16')]);emit(util[_0x6cb2('0x34')](_0x6cb2('0x35'),_0x3eb34f[_0x6cb2('0x16')]),_0x6cb2('0x3e'),{'sessionId':_0x2fbf5b});return _0x716bdd[_0x6cb2('0x17')](0xc8)['json']({'error':![],'message':_0x6cb2('0x3f')});})[_0x6cb2('0x38')](handleError(_0x716bdd));};exports['hold']=function(_0x3e960d,_0x15948c){logger[_0x6cb2('0x2b')]('hold\x20fired:',_0x3e960d['body']);var _0x45a8d5=holdValidation[_0x6cb2('0xb')](_0x3e960d[_0x6cb2('0x2d')]);if(_0x45a8d5[_0x6cb2('0x28')]>0x0){return _0x15948c['status'](0x190)[_0x6cb2('0x2e')](_0x45a8d5);}var _0x2d57c8=_0x3e960d[_0x6cb2('0x2d')][_0x6cb2('0x2f')];var _0x303036=_0x3e960d[_0x6cb2('0x2d')][_0x6cb2('0x27')];return getAgent(_0x2d57c8)[_0x6cb2('0x1b')](function(_0x588140){logger[_0x6cb2('0x2b')](_0x6cb2('0x33'),_0x588140[_0x6cb2('0x16')]);emit(util['format'](_0x6cb2('0x35'),_0x588140[_0x6cb2('0x16')]),_0x6cb2('0x40'),{'sessionId':_0x303036});return _0x15948c[_0x6cb2('0x17')](0xc8)[_0x6cb2('0x2e')]({'error':![],'message':_0x6cb2('0x41')});})[_0x6cb2('0x38')](handleError(_0x15948c));};exports[_0x6cb2('0x42')]=function(_0x21aab3,_0x2b7c32){logger[_0x6cb2('0x2b')](_0x6cb2('0x43'),_0x21aab3[_0x6cb2('0x2d')]);var _0xe58b3b=unholdValidation[_0x6cb2('0xb')](_0x21aab3[_0x6cb2('0x2d')]);if(_0xe58b3b['length']>0x0){return _0x2b7c32[_0x6cb2('0x17')](0x190)[_0x6cb2('0x2e')](_0xe58b3b);}var _0x27d166=_0x21aab3[_0x6cb2('0x2d')][_0x6cb2('0x2f')];var _0x18a346=_0x21aab3[_0x6cb2('0x2d')][_0x6cb2('0x27')];return getAgent(_0x27d166)['then'](function(_0x24b82b){logger[_0x6cb2('0x2b')](_0x6cb2('0x33'),_0x24b82b['name']);emit(util['format'](_0x6cb2('0x35'),_0x24b82b['name']),_0x6cb2('0x44'),{'sessionId':_0x18a346});return _0x2b7c32[_0x6cb2('0x17')](0xc8)[_0x6cb2('0x2e')]({'error':![],'message':_0x6cb2('0x45')});})['catch'](handleError(_0x2b7c32));};exports[_0x6cb2('0x46')]=function(_0x5def58,_0x4b9d09){logger[_0x6cb2('0x2b')](_0x6cb2('0x47'),_0x4b9d09[_0x6cb2('0x2d')]);var _0x25292e=callsValidation['validate'](_0x5def58[_0x6cb2('0x2d')]);if(_0x25292e[_0x6cb2('0x28')]>0x0){return _0x4b9d09[_0x6cb2('0x17')](0x190)[_0x6cb2('0x2e')](_0x25292e);}var _0x2e9649=_0x5def58[_0x6cb2('0x2d')][_0x6cb2('0x2f')];var _0x510626=respondWithRpcPromise(_0x6cb2('0x22'));var _0x2f8cf0=getAgent(_0x2e9649);return Promise[_0x6cb2('0x23')]([_0x510626,_0x2f8cf0])['then'](function(_0x40ab96){var _0x455416=_0x40ab96[0x0];var _0x136552=_0x40ab96[0x1];var _0x116c29=_[_0x6cb2('0x24')](_0x455416[_0x6cb2('0x25')],function(_0x50351f){return _0x50351f['UserId']==_0x136552['id'];});return _0x4b9d09[_0x6cb2('0x17')](0xc8)[_0x6cb2('0x2e')]({'count':_0x116c29[_0x6cb2('0x28')],'rows':_0x116c29});})[_0x6cb2('0x38')](handleError(_0x4b9d09));};exports['conference']=function(_0x54c4d4,_0x11847d){logger['info'](_0x6cb2('0x48'),_0x54c4d4[_0x6cb2('0x2d')]);var _0x98d3d4=conferenceValidation[_0x6cb2('0xb')](_0x54c4d4['body']);if(_0x98d3d4[_0x6cb2('0x28')]>0x0){return _0x11847d[_0x6cb2('0x17')](0x190)['json'](_0x98d3d4);}var _0x4ab620=_0x54c4d4['body']['userId'];return getAgent(_0x4ab620)[_0x6cb2('0x1b')](function(_0x3f79e9){logger[_0x6cb2('0x2b')](_0x6cb2('0x33'),_0x3f79e9[_0x6cb2('0x16')]);emit(util[_0x6cb2('0x34')](_0x6cb2('0x35'),_0x3f79e9[_0x6cb2('0x16')]),'webbar:conference');return _0x11847d[_0x6cb2('0x17')](0xc8)[_0x6cb2('0x2e')]({'error':![],'message':'conference\x20executed!'});})[_0x6cb2('0x38')](handleError(_0x11847d));};exports[_0x6cb2('0x49')]=function(_0x1804c1,_0x2d7de2){logger[_0x6cb2('0x2b')](_0x6cb2('0x4a'),_0x1804c1[_0x6cb2('0x2d')]);var _0x3b39d7=transferValidation['validate'](_0x1804c1[_0x6cb2('0x2d')]);if(_0x3b39d7[_0x6cb2('0x28')]>0x0){return _0x2d7de2[_0x6cb2('0x17')](0x190)[_0x6cb2('0x2e')](_0x3b39d7);}var _0x26e142=_0x1804c1[_0x6cb2('0x2d')][_0x6cb2('0x2f')];var _0x21cc87=_0x1804c1[_0x6cb2('0x2d')]['sessionId'];var _0x3a496b=_0x1804c1['body'][_0x6cb2('0x4b')];return getAgent(_0x26e142)[_0x6cb2('0x1b')](function(_0x392535){logger['info'](_0x6cb2('0x33'),_0x392535['name']);emit(util[_0x6cb2('0x34')](_0x6cb2('0x35'),_0x392535['name']),_0x6cb2('0x4c'),{'sessionId':_0x21cc87,'transferNumber':_0x3a496b});return _0x2d7de2[_0x6cb2('0x17')](0xc8)[_0x6cb2('0x2e')]({'error':![],'message':_0x6cb2('0x4d')});})[_0x6cb2('0x38')](handleError(_0x2d7de2));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 567c64a..672ea17 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 _0x85fc=['getAgents','post','addAnswer','addAgents','addApplications','/:id/notify','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','index','/describe','/:id','/:id/dispositions','isAuthenticated','/:id/canned_answers','getAnswers','/:id/users'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x85fc,0xfd));var _0xc85f=function(_0x1e6a2c,_0x3c3e90){_0x1e6a2c=_0x1e6a2c-0x0;var _0xdab7f3=_0x85fc[_0x1e6a2c];return _0xdab7f3;};'use strict';var multer=require('multer');var util=require(_0xc85f('0x0'));var path=require('path');var timeout=require(_0xc85f('0x1'));var express=require(_0xc85f('0x2'));var router=express[_0xc85f('0x3')]();var auth=require(_0xc85f('0x4'));var interaction=require(_0xc85f('0x5'));var config=require(_0xc85f('0x6'));var controller=require(_0xc85f('0x7'));router[_0xc85f('0x8')]('/',auth['isAuthenticated'](),controller[_0xc85f('0x9')]);router['get'](_0xc85f('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xc85f('0x8')](_0xc85f('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xc85f('0x8')](_0xc85f('0xc'),auth[_0xc85f('0xd')](),controller['getDispositions']);router[_0xc85f('0x8')](_0xc85f('0xe'),auth['isAuthenticated'](),controller[_0xc85f('0xf')]);router[_0xc85f('0x8')](_0xc85f('0x10'),auth[_0xc85f('0xd')](),controller[_0xc85f('0x11')]);router['get']('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router['post']('/',auth[_0xc85f('0xd')](),controller['create']);router[_0xc85f('0x12')](_0xc85f('0xc'),auth[_0xc85f('0xd')](),controller['addDisposition']);router['post'](_0xc85f('0xe'),auth[_0xc85f('0xd')](),controller[_0xc85f('0x13')]);router['post'](_0xc85f('0x10'),auth['isAuthenticated'](),controller[_0xc85f('0x14')]);router['post']('/:id/applications',auth[_0xc85f('0xd')](),controller[_0xc85f('0x15')]);router['post'](_0xc85f('0x16'),controller['notify']);router[_0xc85f('0x12')]('/:id/send',auth['isAuthenticated'](),controller['send']);router[_0xc85f('0x17')](_0xc85f('0xb'),auth[_0xc85f('0xd')](),controller['update']);router[_0xc85f('0x18')](_0xc85f('0xb'),auth[_0xc85f('0xd')](),controller[_0xc85f('0x19')]);router[_0xc85f('0x18')](_0xc85f('0xc'),auth[_0xc85f('0xd')](),controller[_0xc85f('0x1a')]);router[_0xc85f('0x18')](_0xc85f('0xe'),auth[_0xc85f('0xd')](),controller[_0xc85f('0x1b')]);router[_0xc85f('0x18')](_0xc85f('0x10'),auth[_0xc85f('0xd')](),controller[_0xc85f('0x1c')]);module[_0xc85f('0x1d')]=router; \ No newline at end of file +var _0xfc72=['destroy','removeAnswers','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','isAuthenticated','index','/describe','describe','get','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/users','getAgents','getApplications','create','addAnswer','addAgents','post','/:id/applications','/:id/notify','/:id/send','send','put','/:id','update','delete'];(function(_0x8d9399,_0x490955){var _0x5a0645=function(_0x404d19){while(--_0x404d19){_0x8d9399['push'](_0x8d9399['shift']());}};_0x5a0645(++_0x490955);}(_0xfc72,0xff));var _0x2fc7=function(_0x16fe01,_0x5039e1){_0x16fe01=_0x16fe01-0x0;var _0x56c48a=_0xfc72[_0x16fe01];return _0x56c48a;};'use strict';var multer=require('multer');var util=require(_0x2fc7('0x0'));var path=require(_0x2fc7('0x1'));var timeout=require(_0x2fc7('0x2'));var express=require(_0x2fc7('0x3'));var router=express[_0x2fc7('0x4')]();var auth=require(_0x2fc7('0x5'));var interaction=require(_0x2fc7('0x6'));var config=require(_0x2fc7('0x7'));var controller=require(_0x2fc7('0x8'));router['get']('/',auth[_0x2fc7('0x9')](),controller[_0x2fc7('0xa')]);router['get'](_0x2fc7('0xb'),auth[_0x2fc7('0x9')](),controller[_0x2fc7('0xc')]);router[_0x2fc7('0xd')]('/:id',auth[_0x2fc7('0x9')](),controller[_0x2fc7('0xe')]);router[_0x2fc7('0xd')](_0x2fc7('0xf'),auth[_0x2fc7('0x9')](),controller[_0x2fc7('0x10')]);router[_0x2fc7('0xd')](_0x2fc7('0x11'),auth[_0x2fc7('0x9')](),controller['getAnswers']);router[_0x2fc7('0xd')](_0x2fc7('0x12'),auth[_0x2fc7('0x9')](),controller[_0x2fc7('0x13')]);router[_0x2fc7('0xd')]('/:id/applications',auth[_0x2fc7('0x9')](),controller[_0x2fc7('0x14')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2fc7('0x15')]);router['post']('/:id/dispositions',auth[_0x2fc7('0x9')](),controller['addDisposition']);router['post']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x2fc7('0x16')]);router['post'](_0x2fc7('0x12'),auth[_0x2fc7('0x9')](),controller[_0x2fc7('0x17')]);router[_0x2fc7('0x18')](_0x2fc7('0x19'),auth['isAuthenticated'](),controller['addApplications']);router['post'](_0x2fc7('0x1a'),controller['notify']);router[_0x2fc7('0x18')](_0x2fc7('0x1b'),auth['isAuthenticated'](),controller[_0x2fc7('0x1c')]);router[_0x2fc7('0x1d')](_0x2fc7('0x1e'),auth[_0x2fc7('0x9')](),controller[_0x2fc7('0x1f')]);router[_0x2fc7('0x20')](_0x2fc7('0x1e'),auth[_0x2fc7('0x9')](),controller[_0x2fc7('0x21')]);router[_0x2fc7('0x20')](_0x2fc7('0xf'),auth[_0x2fc7('0x9')](),controller['removeDispositions']);router[_0x2fc7('0x20')](_0x2fc7('0x11'),auth[_0x2fc7('0x9')](),controller[_0x2fc7('0x22')]);router['delete'](_0x2fc7('0x12'),auth[_0x2fc7('0x9')](),controller['removeAgents']);module[_0x2fc7('0x23')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 5e9a693..eff2087 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 _0xb7c7=['randomstring','exports','STRING','name','generate','twilio','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb7c7,0xb5));var _0x7b7c=function(_0xd050c6,_0x58ffb4){_0xd050c6=_0xd050c6-0x0;var _0x7278a=_0xb7c7[_0xd050c6];return _0x7278a;};'use strict';var Sequelize=require(_0x7b7c('0x0'));var rs=require(_0x7b7c('0x1'));module[_0x7b7c('0x2')]={'name':{'type':Sequelize[_0x7b7c('0x3')],'unique':_0x7b7c('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x7b7c('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x7b7c('0x3')],'defaultValue':function(){return rs[_0x7b7c('0x5')]();}},'phone':{'type':Sequelize[_0x7b7c('0x3')]},'type':{'type':Sequelize['ENUM'](_0x7b7c('0x6'))},'accountSid':{'type':Sequelize[_0x7b7c('0x3')]},'authToken':{'type':Sequelize[_0x7b7c('0x3')]},'notificationTemplate':{'type':Sequelize[_0x7b7c('0x7')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x7b7c('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x7b7c('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7b7c('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7b7c('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7b7c('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7b7c('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7b7c('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7b7c('0x9')],'comment':_0x7b7c('0xa')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x7b7c('0xb'),'set':function(_0xc44ae8){if(!_0xc44ae8){this[_0x7b7c('0xc')]('mandatoryDispositionPauseId',null);}this['setDataValue'](_0x7b7c('0xd'),_0xc44ae8);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x988e=['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','sequelize','randomstring','exports','STRING','name'];(function(_0x2bda27,_0x35e70d){var _0xd16c7a=function(_0x2be861){while(--_0x2be861){_0x2bda27['push'](_0x2bda27['shift']());}};_0xd16c7a(++_0x35e70d);}(_0x988e,0x19b));var _0xe988=function(_0xa50bc0,_0xe82b89){_0xa50bc0=_0xa50bc0-0x0;var _0x1adb25=_0x988e[_0xa50bc0];return _0x1adb25;};'use strict';var Sequelize=require(_0xe988('0x0'));var rs=require(_0xe988('0x1'));module[_0xe988('0x2')]={'name':{'type':Sequelize[_0xe988('0x3')],'unique':_0xe988('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xe988('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xe988('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xe988('0x3')]},'type':{'type':Sequelize['ENUM']('twilio')},'accountSid':{'type':Sequelize[_0xe988('0x3')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xe988('0x5')],'defaultValue':function(){return _0xe988('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xe988('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe988('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe988('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe988('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe988('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe988('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xe988('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xe988('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x72a270){if(!_0x72a270){this[_0xe988('0xa')](_0xe988('0xb'),null);}this['setDataValue'](_0xe988('0xc'),_0x72a270);}},'description':{'type':Sequelize[_0xe988('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 6447a2c..c3d6cca 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 _0xc368=['mandatoryDispositionPause','WhatsappAccount','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','include','findAll','show','params','length','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','WhatsappAccountId','Disposition','findOne','map','options','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','addApplications','sequelize','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','Applications','account','applications','orderBy','describe','no\x20available\x20attributes','createdAt','difference','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','Body','messageId','MessageSid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','DESC','list','Contacts','contact','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','ContactId','UserId','User','unshift','waitForTheAssignedAgent','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','out','WhatsappMessage','Messages','dataValues','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','get','WhatsappAccounts','UserProfileResource','destroy','end','stack','name','send','index','Pause'];(function(_0x313dcd,_0x3aae8d){var _0x144dcb=function(_0x359eaf){while(--_0x359eaf){_0x313dcd['push'](_0x313dcd['shift']());}};_0x144dcb(++_0x3aae8d);}(_0xc368,0x7b));var _0x8c36=function(_0x37204a,_0x25a67e){_0x37204a=_0x37204a-0x0;var _0x296e2c=_0xc368[_0x37204a];return _0x296e2c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8c36('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8c36('0x1'));var jsonpatch=require(_0x8c36('0x2'));var rp=require(_0x8c36('0x3'));var moment=require(_0x8c36('0x4'));var BPromise=require(_0x8c36('0x5'));var Mustache=require('mustache');var util=require(_0x8c36('0x6'));var path=require(_0x8c36('0x7'));var sox=require(_0x8c36('0x8'));var csv=require(_0x8c36('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x8c36('0xa'));var crypto=require(_0x8c36('0xb'));var jsforce=require(_0x8c36('0xc'));var deskjs=require(_0x8c36('0xd'));var toCsv=require(_0x8c36('0x9'));var querystring=require(_0x8c36('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8c36('0xf'));var as=require(_0x8c36('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8c36('0x11'))(_0x8c36('0x12'));var utils=require(_0x8c36('0x13'));var config=require(_0x8c36('0x14'));var db=require(_0x8c36('0x15'))['db'];config[_0x8c36('0x16')]=_[_0x8c36('0x17')](config[_0x8c36('0x16')],{'host':_0x8c36('0x18'),'port':0x18eb});var socket=require(_0x8c36('0x19'))(new Redis(config[_0x8c36('0x16')]));require(_0x8c36('0x1a'))[_0x8c36('0x1b')](socket);var jayson=require(_0x8c36('0x1c'));var client=jayson['client'][_0x8c36('0x1d')]({'port':0x232c});function checkPasswordPattern(_0x5e32ad,_0xea7509,_0x3f83aa){if(_0x3f83aa){var _0x29e791=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x29e791[_0x8c36('0x1e')](_0xea7509)){return _0x5e32ad;}else{throw new db[(_0x8c36('0x1f'))][(_0x8c36('0x20'))](_0x8c36('0x21'));}}else{return _0x5e32ad;}}function respondWithRpcPromise(_0x40cecf,_0x30229e,_0x49cafe,_0x2be9b0){return new BPromise(function(_0x46ae6e,_0x47832a){var _0x2d5e5b=_0x2be9b0||client;return _0x2d5e5b[_0x8c36('0x22')](_0x40cecf,_0x49cafe)['then'](function(_0x15100f){logger[_0x8c36('0x23')](_0x8c36('0x24'),_0x30229e,_0x8c36('0x25'));logger[_0x8c36('0x26')](_0x8c36('0x27'),_0x30229e,_0x8c36('0x25'),JSON[_0x8c36('0x28')](_0x15100f));if(_0x15100f[_0x8c36('0x29')]){if(_0x15100f[_0x8c36('0x29')][_0x8c36('0x2a')]===0x1f4){logger[_0x8c36('0x29')](_0x8c36('0x24'),_0x30229e,_0x15100f['error']['message']);return _0x47832a(_0x15100f['error']['message']);}logger[_0x8c36('0x29')](_0x8c36('0x24'),_0x30229e,_0x15100f[_0x8c36('0x29')][_0x8c36('0x2b')]);return _0x46ae6e(_0x15100f[_0x8c36('0x29')][_0x8c36('0x2b')]);}else{logger['info'](_0x8c36('0x24'),_0x30229e,'request\x20sent');_0x46ae6e(_0x15100f[_0x8c36('0x2c')]['message']);}})[_0x8c36('0x2d')](function(_0x1afee4){logger[_0x8c36('0x29')](_0x8c36('0x24'),_0x30229e,_0x1afee4);_0x47832a(_0x1afee4);});});}function respondWithStatusCode(_0x50aa48,_0x55cbfb){_0x55cbfb=_0x55cbfb||0xcc;return function(_0x7e7e56){if(_0x7e7e56){return _0x50aa48[_0x8c36('0x2e')](_0x55cbfb);}return _0x50aa48['status'](_0x55cbfb)['end']();};}function respondWithResult(_0x418663,_0x2b5a8c){_0x2b5a8c=_0x2b5a8c||0xc8;return function(_0x502fa3){if(_0x502fa3){return _0x418663[_0x8c36('0x2f')](_0x2b5a8c)[_0x8c36('0x30')](_0x502fa3);}};}function respondWithFilteredResult(_0x3ca98e,_0x4bc057){return function(_0x49b737){if(_0x49b737){var _0x46b72f=_0x49b737[_0x8c36('0x31')],_0x1531fc=_0x4bc057[_0x8c36('0x32')],_0x3d7056=_0x4bc057[_0x8c36('0x32')]+_0x4bc057[_0x8c36('0x33')],_0x192ce3;if(_0x3d7056>=_0x46b72f){_0x3d7056=_0x46b72f;_0x192ce3=0xc8;}else{_0x192ce3=0xce;}_0x3ca98e[_0x8c36('0x2f')](_0x192ce3);return _0x3ca98e[_0x8c36('0x34')](_0x8c36('0x35'),_0x1531fc+'-'+_0x3d7056+'/'+_0x46b72f)[_0x8c36('0x30')](_0x49b737);}return null;};}function patchUpdates(_0x3d6b69){return function(_0x178fe5){try{jsonpatch[_0x8c36('0x36')](_0x178fe5,_0x3d6b69,!![]);}catch(_0x239fa3){return BPromise[_0x8c36('0x37')](_0x239fa3);}return _0x178fe5['save']();};}function saveUpdates(_0x4e8d12,_0x5c110d){return function(_0x5fe665){if(_0x5fe665){return _0x5fe665[_0x8c36('0x38')](_0x4e8d12)[_0x8c36('0x39')](function(_0x2fedd6){return _0x2fedd6;});}return null;};}function removeEntity(_0x11a328,_0x2de1e8){return function(_0xc3f5b4){if(_0xc3f5b4){return _0xc3f5b4['destroy']()[_0x8c36('0x39')](function(){var _0x59a4e6=_0xc3f5b4[_0x8c36('0x3a')]({'plain':!![]});var _0x5c743b=_0x8c36('0x3b');return db[_0x8c36('0x3c')][_0x8c36('0x3d')]({'where':{'type':_0x5c743b,'resourceId':_0x59a4e6['id']}})['then'](function(){return _0xc3f5b4;});})[_0x8c36('0x39')](function(){_0x11a328[_0x8c36('0x2f')](0xcc)[_0x8c36('0x3e')]();});}};}function handleEntityNotFound(_0xabdc0f,_0x3d548f){return function(_0x12421b){if(!_0x12421b){_0xabdc0f[_0x8c36('0x2e')](0x194);}return _0x12421b;};}function handleError(_0x334b02,_0x75b797){_0x75b797=_0x75b797||0x1f4;return function(_0x3fc603){logger[_0x8c36('0x29')](_0x3fc603[_0x8c36('0x3f')]);if(_0x3fc603[_0x8c36('0x40')]){delete _0x3fc603[_0x8c36('0x40')];}_0x334b02[_0x8c36('0x2f')](_0x75b797)[_0x8c36('0x41')](_0x3fc603);};}exports[_0x8c36('0x42')]=function(_0x5109c2,_0x318d7f){var _0x5ee15b={'include':[{'model':db[_0x8c36('0x43')],'as':_0x8c36('0x44')}]},_0x51960e={},_0x3c34a4={'count':0x0,'rows':[]};var _0x4da574=_['map'](db[_0x8c36('0x45')][_0x8c36('0x46')],function(_0x3bb18d){return{'name':_0x3bb18d['fieldName'],'type':_0x3bb18d['type'][_0x8c36('0x47')]};});_0x51960e['model']=_['map'](_0x4da574,_0x8c36('0x40'));_0x51960e[_0x8c36('0x48')]=_[_0x8c36('0x49')](_0x5109c2[_0x8c36('0x48')]);_0x51960e[_0x8c36('0x4a')]=_[_0x8c36('0x4b')](_0x51960e[_0x8c36('0x4c')],_0x51960e[_0x8c36('0x48')]);_0x5ee15b[_0x8c36('0x4d')]=_[_0x8c36('0x4b')](_0x51960e['model'],qs[_0x8c36('0x4e')](_0x5109c2[_0x8c36('0x48')][_0x8c36('0x4e')]));_0x5ee15b[_0x8c36('0x4d')]=_0x5ee15b[_0x8c36('0x4d')]['length']?_0x5ee15b[_0x8c36('0x4d')]:_0x51960e[_0x8c36('0x4c')];if(!_0x5109c2[_0x8c36('0x48')][_0x8c36('0x4f')](_0x8c36('0x50'))){_0x5ee15b[_0x8c36('0x33')]=qs['limit'](_0x5109c2[_0x8c36('0x48')][_0x8c36('0x33')]);_0x5ee15b[_0x8c36('0x32')]=qs[_0x8c36('0x32')](_0x5109c2[_0x8c36('0x48')][_0x8c36('0x32')]);}_0x5ee15b[_0x8c36('0x51')]=qs['sort'](_0x5109c2[_0x8c36('0x48')][_0x8c36('0x52')]);_0x5ee15b[_0x8c36('0x53')]=qs[_0x8c36('0x4a')](_[_0x8c36('0x54')](_0x5109c2[_0x8c36('0x48')],_0x51960e[_0x8c36('0x4a')]),_0x4da574);if(_0x5109c2[_0x8c36('0x48')][_0x8c36('0x55')]){_0x5ee15b[_0x8c36('0x53')]=_[_0x8c36('0x56')](_0x5ee15b[_0x8c36('0x53')],{'$or':_['map'](_0x4da574,function(_0x497e80){if(_0x497e80[_0x8c36('0x57')]!==_0x8c36('0x58')){var _0xd46608={};_0xd46608[_0x497e80[_0x8c36('0x40')]]={'$like':'%'+_0x5109c2['query'][_0x8c36('0x55')]+'%'};return _0xd46608;}})});}_0x5ee15b=_[_0x8c36('0x56')]({},_0x5ee15b,_0x5109c2['options']);var _0x5e2b4f={'where':_0x5ee15b['where']};return db[_0x8c36('0x45')][_0x8c36('0x31')](_0x5e2b4f)[_0x8c36('0x39')](function(_0x197d11){_0x3c34a4[_0x8c36('0x31')]=_0x197d11;if(_0x5109c2[_0x8c36('0x48')]['includeAll']){_0x5ee15b[_0x8c36('0x59')]=[{'all':!![]}];}return db[_0x8c36('0x45')][_0x8c36('0x5a')](_0x5ee15b);})[_0x8c36('0x39')](function(_0x579bef){_0x3c34a4['rows']=_0x579bef;return _0x3c34a4;})['then'](respondWithFilteredResult(_0x318d7f,_0x5ee15b))[_0x8c36('0x2d')](handleError(_0x318d7f,null));};exports[_0x8c36('0x5b')]=function(_0x2fc48b,_0x19b11c){var _0x24f3f9={'raw':![],'where':{'id':_0x2fc48b[_0x8c36('0x5c')]['id']},'include':[{'model':db[_0x8c36('0x43')],'as':_0x8c36('0x44')}]},_0x3d5e0d={};_0x3d5e0d['model']=_['keys'](db[_0x8c36('0x45')]['rawAttributes']);_0x3d5e0d['query']=_[_0x8c36('0x49')](_0x2fc48b['query']);_0x3d5e0d[_0x8c36('0x4a')]=_[_0x8c36('0x4b')](_0x3d5e0d['model'],_0x3d5e0d[_0x8c36('0x48')]);_0x24f3f9['attributes']=_[_0x8c36('0x4b')](_0x3d5e0d[_0x8c36('0x4c')],qs[_0x8c36('0x4e')](_0x2fc48b['query'][_0x8c36('0x4e')]));_0x24f3f9[_0x8c36('0x4d')]=_0x24f3f9[_0x8c36('0x4d')][_0x8c36('0x5d')]?_0x24f3f9[_0x8c36('0x4d')]:_0x3d5e0d[_0x8c36('0x4c')];if(_0x2fc48b[_0x8c36('0x48')][_0x8c36('0x5e')]){_0x24f3f9[_0x8c36('0x59')]=[{'all':!![]}];}_0x24f3f9=_['merge']({},_0x24f3f9,_0x2fc48b['options']);return db['WhatsappAccount'][_0x8c36('0x5f')](_0x24f3f9)['then'](handleEntityNotFound(_0x19b11c,null))['then'](respondWithResult(_0x19b11c,null))[_0x8c36('0x2d')](handleError(_0x19b11c,null));};exports[_0x8c36('0x60')]=function(_0x366f0c,_0x444c36){return db[_0x8c36('0x45')]['create'](_0x366f0c['body'],{})['then'](function(_0x1edc3b){var _0x243c1a=_0x366f0c['user'][_0x8c36('0x3a')]({'plain':!![]});if(!_0x243c1a)throw new Error(_0x8c36('0x61'));if(_0x243c1a[_0x8c36('0x62')]===_0x8c36('0x63')){var _0x32871e=_0x1edc3b[_0x8c36('0x3a')]({'plain':!![]});var _0x1c0669=_0x8c36('0x3b');return db[_0x8c36('0x64')]['find']({'where':{'name':_0x1c0669,'userProfileId':_0x243c1a['userProfileId']},'raw':!![]})['then'](function(_0x2c82c0){if(_0x2c82c0&&_0x2c82c0[_0x8c36('0x65')]===0x0){return db[_0x8c36('0x3c')][_0x8c36('0x60')]({'name':_0x32871e[_0x8c36('0x40')],'resourceId':_0x32871e['id'],'type':_0x2c82c0[_0x8c36('0x40')],'sectionId':_0x2c82c0['id']},{})['then'](function(){return _0x1edc3b;});}else{return _0x1edc3b;}})[_0x8c36('0x2d')](function(_0x5b2406){logger[_0x8c36('0x29')](_0x8c36('0x66'),_0x5b2406);throw _0x5b2406;});}return _0x1edc3b;})[_0x8c36('0x39')](respondWithResult(_0x444c36,0xc9))['catch'](handleError(_0x444c36,null));};exports[_0x8c36('0x38')]=function(_0x51c797,_0x11acb3){if(_0x51c797[_0x8c36('0x67')]['id']){delete _0x51c797[_0x8c36('0x67')]['id'];}return db[_0x8c36('0x45')][_0x8c36('0x5f')]({'where':{'id':_0x51c797['params']['id']},'include':[{'model':db[_0x8c36('0x43')],'as':'mandatoryDispositionPause'}]})[_0x8c36('0x39')](handleEntityNotFound(_0x11acb3,null))[_0x8c36('0x39')](saveUpdates(_0x51c797['body'],null))[_0x8c36('0x39')](respondWithResult(_0x11acb3,null))[_0x8c36('0x2d')](handleError(_0x11acb3,null));};exports[_0x8c36('0x3d')]=function(_0x4eabc6,_0x244634){return db[_0x8c36('0x45')][_0x8c36('0x5f')]({'where':{'id':_0x4eabc6[_0x8c36('0x5c')]['id']}})['then'](handleEntityNotFound(_0x244634,null))[_0x8c36('0x39')](removeEntity(_0x244634,null))[_0x8c36('0x2d')](handleError(_0x244634,null));};exports['describe']=function(_0xff22f0,_0x1bfe8c){return db[_0x8c36('0x45')]['describe']()[_0x8c36('0x39')](respondWithResult(_0x1bfe8c,null))[_0x8c36('0x2d')](handleError(_0x1bfe8c,null));};exports['addDisposition']=function(_0x2f851f,_0x251a43,_0x120520){if(_0x2f851f[_0x8c36('0x67')]['id']){delete _0x2f851f['body']['id'];}return db[_0x8c36('0x45')]['find']({'where':{'id':_0x2f851f[_0x8c36('0x5c')]['id']}})[_0x8c36('0x39')](handleEntityNotFound(_0x251a43,null))['then'](function(_0x27b88d){if(_0x27b88d){_0x2f851f[_0x8c36('0x67')][_0x8c36('0x68')]=_0x27b88d['id'];return db[_0x8c36('0x69')][_0x8c36('0x60')](_0x2f851f[_0x8c36('0x67')]);}})[_0x8c36('0x39')](respondWithResult(_0x251a43,null))[_0x8c36('0x2d')](handleError(_0x251a43,null));};exports['getDispositions']=function(_0x274216,_0x1d9cca,_0x223c3b){var _0x5d623b={'raw':![],'where':{}};var _0x481920={};var _0x3bbb1c={'count':0x0,'rows':[]};return db[_0x8c36('0x45')][_0x8c36('0x6a')]({'where':{'id':_0x274216[_0x8c36('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1d9cca,null))[_0x8c36('0x39')](function(_0x25c124){if(_0x25c124){_0x481920[_0x8c36('0x4c')]=_['keys'](db[_0x8c36('0x69')][_0x8c36('0x46')]);_0x481920[_0x8c36('0x48')]=_[_0x8c36('0x49')](_0x274216[_0x8c36('0x48')]);_0x481920['filters']=_[_0x8c36('0x4b')](_0x481920[_0x8c36('0x4c')],_0x481920[_0x8c36('0x48')]);_0x5d623b['attributes']=_[_0x8c36('0x4b')](_0x481920[_0x8c36('0x4c')],qs[_0x8c36('0x4e')](_0x274216[_0x8c36('0x48')][_0x8c36('0x4e')]));_0x5d623b[_0x8c36('0x4d')]=_0x5d623b[_0x8c36('0x4d')]['length']?_0x5d623b['attributes']:_0x481920['model'];if(!_0x274216[_0x8c36('0x48')][_0x8c36('0x4f')](_0x8c36('0x50'))){_0x5d623b[_0x8c36('0x33')]=qs[_0x8c36('0x33')](_0x274216[_0x8c36('0x48')][_0x8c36('0x33')]);_0x5d623b[_0x8c36('0x32')]=qs[_0x8c36('0x32')](_0x274216[_0x8c36('0x48')][_0x8c36('0x32')]);}_0x5d623b[_0x8c36('0x51')]=qs[_0x8c36('0x52')](_0x274216[_0x8c36('0x48')][_0x8c36('0x52')]);_0x5d623b[_0x8c36('0x53')]=qs[_0x8c36('0x4a')](_[_0x8c36('0x54')](_0x274216['query'],_0x481920[_0x8c36('0x4a')]));_0x5d623b['where']['WhatsappAccountId']=_0x25c124['id'];if(_0x274216[_0x8c36('0x48')]['filter']){_0x5d623b[_0x8c36('0x53')]=_[_0x8c36('0x56')](_0x5d623b[_0x8c36('0x53')],{'$or':_[_0x8c36('0x6b')](_0x5d623b[_0x8c36('0x4d')],function(_0x438224){var _0xf6760b={};_0xf6760b[_0x438224]={'$like':'%'+_0x274216['query']['filter']+'%'};return _0xf6760b;})});}_0x5d623b=_[_0x8c36('0x56')]({},_0x5d623b,_0x274216[_0x8c36('0x6c')]);return db['Disposition'][_0x8c36('0x31')]({'where':_0x5d623b[_0x8c36('0x53')]})[_0x8c36('0x39')](function(_0x1fb78e){_0x3bbb1c['count']=_0x1fb78e;if(_0x274216[_0x8c36('0x48')][_0x8c36('0x5e')]){_0x5d623b[_0x8c36('0x59')]=[{'all':!![]}];}return db[_0x8c36('0x69')][_0x8c36('0x5a')](_0x5d623b);})[_0x8c36('0x39')](function(_0x57141f){_0x3bbb1c[_0x8c36('0x6d')]=_0x57141f;return _0x3bbb1c;});}})[_0x8c36('0x39')](respondWithFilteredResult(_0x1d9cca,_0x5d623b))[_0x8c36('0x2d')](handleError(_0x1d9cca,null));};exports[_0x8c36('0x6e')]=function(_0x744bdb,_0x279e37,_0x257c2a){return db[_0x8c36('0x45')][_0x8c36('0x5f')]({'where':{'id':_0x744bdb[_0x8c36('0x5c')]['id']}})['then'](handleEntityNotFound(_0x279e37,null))['then'](function(_0x24bfcb){if(_0x24bfcb){return _0x24bfcb['removeDispositions'](_0x744bdb['query'][_0x8c36('0x6f')]);}})[_0x8c36('0x39')](respondWithStatusCode(_0x279e37,null))['catch'](handleError(_0x279e37,null));};exports[_0x8c36('0x70')]=function(_0x276be8,_0x2ea797,_0x3a16b4){if(_0x276be8[_0x8c36('0x67')]['id']){delete _0x276be8[_0x8c36('0x67')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x276be8[_0x8c36('0x5c')]['id']}})[_0x8c36('0x39')](handleEntityNotFound(_0x2ea797,null))['then'](function(_0x1164f8){if(_0x1164f8){_0x276be8[_0x8c36('0x67')][_0x8c36('0x68')]=_0x1164f8['id'];return db[_0x8c36('0x71')][_0x8c36('0x60')](_0x276be8[_0x8c36('0x67')]);}})['then'](respondWithResult(_0x2ea797,null))[_0x8c36('0x2d')](handleError(_0x2ea797,null));};exports[_0x8c36('0x72')]=function(_0x3c3f51,_0x290bc9,_0x1deca3){var _0x375155={'raw':![],'where':{}};var _0x5f17c4={};var _0x4822cb={'count':0x0,'rows':[]};return db[_0x8c36('0x45')][_0x8c36('0x6a')]({'where':{'id':_0x3c3f51[_0x8c36('0x5c')]['id']}})[_0x8c36('0x39')](handleEntityNotFound(_0x290bc9,null))[_0x8c36('0x39')](function(_0x523dbb){if(_0x523dbb){_0x5f17c4['model']=_[_0x8c36('0x49')](db[_0x8c36('0x71')][_0x8c36('0x46')]);_0x5f17c4['query']=_[_0x8c36('0x49')](_0x3c3f51[_0x8c36('0x48')]);_0x5f17c4[_0x8c36('0x4a')]=_[_0x8c36('0x4b')](_0x5f17c4[_0x8c36('0x4c')],_0x5f17c4[_0x8c36('0x48')]);_0x375155[_0x8c36('0x4d')]=_[_0x8c36('0x4b')](_0x5f17c4[_0x8c36('0x4c')],qs[_0x8c36('0x4e')](_0x3c3f51[_0x8c36('0x48')][_0x8c36('0x4e')]));_0x375155['attributes']=_0x375155[_0x8c36('0x4d')][_0x8c36('0x5d')]?_0x375155['attributes']:_0x5f17c4['model'];if(!_0x3c3f51[_0x8c36('0x48')][_0x8c36('0x4f')](_0x8c36('0x50'))){_0x375155['limit']=qs[_0x8c36('0x33')](_0x3c3f51[_0x8c36('0x48')][_0x8c36('0x33')]);_0x375155[_0x8c36('0x32')]=qs['offset'](_0x3c3f51[_0x8c36('0x48')][_0x8c36('0x32')]);}_0x375155['order']=qs[_0x8c36('0x52')](_0x3c3f51[_0x8c36('0x48')]['sort']);_0x375155[_0x8c36('0x53')]=qs[_0x8c36('0x4a')](_[_0x8c36('0x54')](_0x3c3f51[_0x8c36('0x48')],_0x5f17c4[_0x8c36('0x4a')]));_0x375155[_0x8c36('0x53')][_0x8c36('0x68')]=_0x523dbb['id'];if(_0x3c3f51['query']['filter']){_0x375155['where']=_[_0x8c36('0x56')](_0x375155[_0x8c36('0x53')],{'$or':_[_0x8c36('0x6b')](_0x375155[_0x8c36('0x4d')],function(_0x1cfbc3){var _0x35196a={};_0x35196a[_0x1cfbc3]={'$like':'%'+_0x3c3f51['query'][_0x8c36('0x55')]+'%'};return _0x35196a;})});}_0x375155=_[_0x8c36('0x56')]({},_0x375155,_0x3c3f51[_0x8c36('0x6c')]);return db[_0x8c36('0x71')]['count']({'where':_0x375155['where']})[_0x8c36('0x39')](function(_0x2a737e){_0x4822cb[_0x8c36('0x31')]=_0x2a737e;if(_0x3c3f51['query'][_0x8c36('0x5e')]){_0x375155[_0x8c36('0x59')]=[{'all':!![]}];}return db[_0x8c36('0x71')]['findAll'](_0x375155);})[_0x8c36('0x39')](function(_0x59d969){_0x4822cb[_0x8c36('0x6d')]=_0x59d969;return _0x4822cb;});}})[_0x8c36('0x39')](respondWithFilteredResult(_0x290bc9,_0x375155))['catch'](handleError(_0x290bc9,null));};exports[_0x8c36('0x73')]=function(_0xbd0d83,_0x363065,_0x312b13){return db[_0x8c36('0x45')][_0x8c36('0x5f')]({'where':{'id':_0xbd0d83[_0x8c36('0x5c')]['id']}})[_0x8c36('0x39')](handleEntityNotFound(_0x363065,null))['then'](function(_0x5d9aa9){if(_0x5d9aa9){return _0x5d9aa9[_0x8c36('0x73')](_0xbd0d83[_0x8c36('0x48')][_0x8c36('0x6f')]);}})['then'](respondWithStatusCode(_0x363065,null))[_0x8c36('0x2d')](handleError(_0x363065,null));};exports[_0x8c36('0x74')]=function(_0x50c9d7,_0x5a2f2a,_0x38410b){return db[_0x8c36('0x45')]['find']({'where':{'id':_0x50c9d7[_0x8c36('0x5c')]['id']}})[_0x8c36('0x39')](handleEntityNotFound(_0x5a2f2a,null))[_0x8c36('0x39')](function(_0x2e800a){if(_0x2e800a){return _0x2e800a['addAgents'](_0x50c9d7[_0x8c36('0x67')][_0x8c36('0x6f')],_[_0x8c36('0x75')](_0x50c9d7[_0x8c36('0x67')],['ids','id'])||{})[_0x8c36('0x76')](function(_0x14e96b){for(var _0x40a276=0x0;_0x40a276<_0x50c9d7[_0x8c36('0x67')][_0x8c36('0x6f')]['length'];_0x40a276+=0x1){socket[_0x8c36('0x77')](_0x8c36('0x78'),{'UserId':_0x50c9d7[_0x8c36('0x67')]['ids'][_0x40a276],'WhatsappAccountId':_0x50c9d7[_0x8c36('0x5c')]['id']});}return _0x14e96b;});}})[_0x8c36('0x39')](respondWithResult(_0x5a2f2a,null))[_0x8c36('0x2d')](handleError(_0x5a2f2a,null));};exports['removeAgents']=function(_0x4be6a3,_0x52ae44,_0x5ba123){return db[_0x8c36('0x45')]['find']({'where':{'id':_0x4be6a3['params']['id']}})[_0x8c36('0x39')](handleEntityNotFound(_0x52ae44,null))['then'](function(_0x691af){if(_0x691af){return _0x691af[_0x8c36('0x79')](_0x4be6a3[_0x8c36('0x48')][_0x8c36('0x6f')])['then'](function(){if(_[_0x8c36('0x7a')](_0x4be6a3[_0x8c36('0x48')][_0x8c36('0x6f')])){for(var _0x4a308f=0x0;_0x4a308f<_0x4be6a3[_0x8c36('0x48')][_0x8c36('0x6f')][_0x8c36('0x5d')];_0x4a308f+=0x1){socket[_0x8c36('0x77')](_0x8c36('0x7b'),{'UserId':Number(_0x4be6a3[_0x8c36('0x48')][_0x8c36('0x6f')][_0x4a308f]),'WhatsappAccountId':Number(_0x4be6a3['params']['id'])});}}else{socket[_0x8c36('0x77')](_0x8c36('0x7b'),{'UserId':Number(_0x4be6a3[_0x8c36('0x48')][_0x8c36('0x6f')]),'WhatsappAccountId':Number(_0x4be6a3[_0x8c36('0x5c')]['id'])});}});}})[_0x8c36('0x39')](respondWithStatusCode(_0x52ae44,null))[_0x8c36('0x2d')](handleError(_0x52ae44,null));};exports[_0x8c36('0x7c')]=function(_0x198105,_0x6dbf6,_0x1fccee){var _0x434847={};var _0x5ab835={};var _0x486579;var _0x13a1b5;return db[_0x8c36('0x45')][_0x8c36('0x6a')]({'where':{'id':_0x198105[_0x8c36('0x5c')]['id']}})[_0x8c36('0x39')](handleEntityNotFound(_0x6dbf6,null))[_0x8c36('0x39')](function(_0x1c0ed4){if(_0x1c0ed4){_0x486579=_0x1c0ed4;_0x5ab835['model']=_['keys'](db['User'][_0x8c36('0x46')]);_0x5ab835[_0x8c36('0x48')]=_[_0x8c36('0x49')](_0x198105[_0x8c36('0x48')]);_0x5ab835['filters']=_[_0x8c36('0x4b')](_0x5ab835[_0x8c36('0x4c')],_0x5ab835[_0x8c36('0x48')]);_0x434847[_0x8c36('0x4d')]=_[_0x8c36('0x4b')](_0x5ab835[_0x8c36('0x4c')],qs[_0x8c36('0x4e')](_0x198105['query'][_0x8c36('0x4e')]));_0x434847[_0x8c36('0x4d')]=_0x434847[_0x8c36('0x4d')][_0x8c36('0x5d')]?_0x434847[_0x8c36('0x4d')]:_0x5ab835[_0x8c36('0x4c')];_0x434847[_0x8c36('0x51')]=qs[_0x8c36('0x52')](_0x198105['query'][_0x8c36('0x52')]);_0x434847[_0x8c36('0x53')]=qs[_0x8c36('0x4a')](_[_0x8c36('0x54')](_0x198105[_0x8c36('0x48')],_0x5ab835['filters']));if(_0x198105[_0x8c36('0x48')][_0x8c36('0x55')]){_0x434847[_0x8c36('0x53')]=_[_0x8c36('0x56')](_0x434847[_0x8c36('0x53')],{'$or':_[_0x8c36('0x6b')](_0x434847[_0x8c36('0x4d')],function(_0xded0f){var _0x56c11f={};_0x56c11f[_0xded0f]={'$like':'%'+_0x198105[_0x8c36('0x48')]['filter']+'%'};return _0x56c11f;})});}_0x434847=_['merge']({},_0x434847,_0x198105['options']);return _0x486579[_0x8c36('0x7c')](_0x434847);}})[_0x8c36('0x39')](function(_0x36e76b){if(_0x36e76b){_0x13a1b5=_0x36e76b['length'];if(!_0x198105[_0x8c36('0x48')][_0x8c36('0x4f')](_0x8c36('0x50'))){_0x434847['limit']=qs['limit'](_0x198105[_0x8c36('0x48')]['limit']);_0x434847[_0x8c36('0x32')]=qs[_0x8c36('0x32')](_0x198105[_0x8c36('0x48')]['offset']);}return _0x486579[_0x8c36('0x7c')](_0x434847);}})[_0x8c36('0x39')](function(_0x24ac58){if(_0x24ac58){return _0x24ac58?{'count':_0x13a1b5,'rows':_0x24ac58}:null;}})['then'](respondWithResult(_0x6dbf6,null))[_0x8c36('0x2d')](handleError(_0x6dbf6,null));};exports[_0x8c36('0x7d')]=function(_0xb38f74,_0x2da99c,_0x445894){return db[_0x8c36('0x45')]['findOne']({'where':{'id':_0xb38f74[_0x8c36('0x5c')]['id']}})[_0x8c36('0x39')](handleEntityNotFound(_0x2da99c,null))[_0x8c36('0x39')](function(_0x4204bd){if(_0x4204bd){return db[_0x8c36('0x7e')]['transaction'](function(_0x47ca24){return db['WhatsappApplication']['destroy']({'where':{'WhatsappAccountId':_0xb38f74[_0x8c36('0x5c')]['id']},'transaction':_0x47ca24})['then'](function(_0x3249b6){var _0x43e8b9=_[_0x8c36('0x6b')](_0xb38f74['body'],function(_0x10ed2c){_0x10ed2c['WhatsappAccountId']=_0xb38f74[_0x8c36('0x5c')]['id'];return _0x10ed2c;});return db[_0x8c36('0x7f')][_0x8c36('0x80')](_0x43e8b9,{'transaction':_0x47ca24});});})[_0x8c36('0x39')](function(){return db[_0x8c36('0x7f')][_0x8c36('0x81')]({'where':{'WhatsappAccountId':_0xb38f74[_0x8c36('0x5c')]['id']},'order':_0x8c36('0x82')});});}})['then'](respondWithResult(_0x2da99c,null))[_0x8c36('0x2d')](handleError(_0x2da99c,null));};exports['getApplications']=function(_0x386e3e,_0x4c287d,_0x47f57c){var _0x4c0052={};var _0x1e280a={};var _0x4d322c;var _0x226f4b;return db['WhatsappAccount'][_0x8c36('0x6a')]({'where':{'id':_0x386e3e[_0x8c36('0x5c')]['id']}})[_0x8c36('0x39')](handleEntityNotFound(_0x4c287d,null))[_0x8c36('0x39')](function(_0x2cc362){if(_0x2cc362){_0x4d322c=_0x2cc362;_0x1e280a[_0x8c36('0x4c')]=_[_0x8c36('0x49')](db['WhatsappApplication']['rawAttributes']);_0x1e280a[_0x8c36('0x48')]=_[_0x8c36('0x49')](_0x386e3e[_0x8c36('0x48')]);_0x1e280a[_0x8c36('0x4a')]=_[_0x8c36('0x4b')](_0x1e280a['model'],_0x1e280a['query']);_0x4c0052[_0x8c36('0x4d')]=_['intersection'](_0x1e280a[_0x8c36('0x4c')],qs[_0x8c36('0x4e')](_0x386e3e[_0x8c36('0x48')][_0x8c36('0x4e')]));_0x4c0052['attributes']=_0x4c0052[_0x8c36('0x4d')][_0x8c36('0x5d')]?_0x4c0052[_0x8c36('0x4d')]:_0x1e280a[_0x8c36('0x4c')];_0x4c0052[_0x8c36('0x51')]=qs['sort'](_0x386e3e[_0x8c36('0x48')][_0x8c36('0x52')]);_0x4c0052['where']=qs[_0x8c36('0x4a')](_[_0x8c36('0x54')](_0x386e3e[_0x8c36('0x48')],_0x1e280a[_0x8c36('0x4a')]));if(_0x386e3e[_0x8c36('0x48')][_0x8c36('0x55')]){_0x4c0052[_0x8c36('0x53')]=_[_0x8c36('0x56')](_0x4c0052[_0x8c36('0x53')],{'$or':_[_0x8c36('0x6b')](_0x4c0052[_0x8c36('0x4d')],function(_0x2adead){var _0x388b34={};_0x388b34[_0x2adead]={'$like':'%'+_0x386e3e['query']['filter']+'%'};return _0x388b34;})});}_0x4c0052=_['merge']({},_0x4c0052,_0x386e3e['options']);return _0x4d322c[_0x8c36('0x83')](_0x4c0052);}})[_0x8c36('0x39')](function(_0x211bdc){if(_0x211bdc){_0x226f4b=_0x211bdc['length'];if(!_0x386e3e[_0x8c36('0x48')][_0x8c36('0x4f')](_0x8c36('0x50'))){_0x4c0052['limit']=qs[_0x8c36('0x33')](_0x386e3e[_0x8c36('0x48')][_0x8c36('0x33')]);_0x4c0052[_0x8c36('0x32')]=qs[_0x8c36('0x32')](_0x386e3e[_0x8c36('0x48')]['offset']);}return _0x4d322c[_0x8c36('0x83')](_0x4c0052);}})[_0x8c36('0x39')](function(_0x4d56d1){if(_0x4d56d1){return _0x4d56d1?{'count':_0x226f4b,'rows':_0x4d56d1}:null;}})[_0x8c36('0x39')](respondWithResult(_0x4c287d,null))[_0x8c36('0x2d')](handleError(_0x4c287d,null));};exports[_0x8c36('0x84')]=function(_0x180b8b,_0x30b834,_0xb358f9){var _0x38ecc8={'channel':'whatsapp'};var _0x3d746e=[];var _0x345e2a=[];var _0x4b4060={};return db[_0x8c36('0x45')]['find']({'where':{'id':_0x180b8b[_0x8c36('0x5c')]['id']},'include':[{'model':db[_0x8c36('0x7f')],'as':_0x8c36('0x85')}]})[_0x8c36('0x39')](handleEntityNotFound(_0x30b834,null))[_0x8c36('0x39')](function(_0x266601){_0x38ecc8[_0x8c36('0x86')]=_0x266601;_0x38ecc8[_0x8c36('0x87')]=_[_0x8c36('0x88')](_0x266601[_0x8c36('0x85')],[_0x8c36('0x82')],['asc']);if(_0x38ecc8['account'][_0x8c36('0x85')]){delete _0x38ecc8[_0x8c36('0x86')][_0x8c36('0x85')];}return db['CmContact'][_0x8c36('0x89')]();})[_0x8c36('0x39')](function(_0x4eb530){if(!_0x4eb530){throw new db[(_0x8c36('0x1f'))]['ValidationError'](_0x8c36('0x8a'));}_0x3d746e=_['difference'](_[_0x8c36('0x49')](_0x4eb530),[_0x8c36('0x8b'),'updatedAt']);_0x345e2a=_[_0x8c36('0x8c')](_[_0x8c36('0x49')](_0x4eb530),[_0x8c36('0x8b'),_0x8c36('0x8d'),_0x8c36('0x8e'),_0x8c36('0x8f')]);_0x38ecc8['body']={'mapKey':_0x8c36('0x90')};if(_0x38ecc8['account'][_0x8c36('0x57')]&&_0x38ecc8['account'][_0x8c36('0x57')]===_0x8c36('0x91')){_0x38ecc8['body'][_0x8c36('0x92')]=_0x180b8b['body'][_0x8c36('0x93')][_0x8c36('0x94')]('whatsapp:','');_0x38ecc8[_0x8c36('0x67')][_0x8c36('0x67')]=_0x180b8b[_0x8c36('0x67')][_0x8c36('0x95')];_0x38ecc8[_0x8c36('0x67')][_0x8c36('0x96')]=_0x180b8b[_0x8c36('0x67')][_0x8c36('0x97')];}if(_0x38ecc8[_0x8c36('0x67')]['id']){delete _0x38ecc8[_0x8c36('0x67')]['id'];}if(_[_0x8c36('0x98')](_0x38ecc8['body']['from'])){throw new db[(_0x8c36('0x1f'))][(_0x8c36('0x20'))](_0x8c36('0x99'));}if(_[_0x8c36('0x98')](_0x38ecc8['body'][_0x8c36('0x67')])||_0x38ecc8[_0x8c36('0x67')]['body']===''){throw new db[(_0x8c36('0x1f'))]['ValidationError'](_0x8c36('0x9a'));}if(_[_0x8c36('0x98')](_0x38ecc8[_0x8c36('0x67')][_0x8c36('0x9b')])){throw new db['Sequelize'][(_0x8c36('0x20'))](_0x8c36('0x9c')+_0x345e2a);}if(!_[_0x8c36('0x9d')](_0x345e2a,_0x38ecc8[_0x8c36('0x67')][_0x8c36('0x9b')])){throw new db[(_0x8c36('0x1f'))]['ValidationError'](_0x8c36('0x9e')+_0x345e2a);}_0x4b4060[_0x38ecc8[_0x8c36('0x67')][_0x8c36('0x9b')]]=_0x38ecc8['body'][_0x8c36('0x92')];return db[_0x8c36('0x9f')]['find']({'where':{'id':_0x38ecc8[_0x8c36('0x86')][_0x8c36('0x8f')]},'include':[{'model':db[_0x8c36('0xa0')],'as':'Contacts','where':_0x4b4060,'limit':0x1,'order':[['updatedAt',_0x8c36('0xa1')]]}]});})[_0x8c36('0x39')](handleEntityNotFound(_0x30b834,null))[_0x8c36('0x39')](function(_0x28b34c){if(_0x28b34c){_0x38ecc8[_0x8c36('0xa2')]=_['omit'](_0x28b34c,[_0x8c36('0xa3')]);if(_0x28b34c[_0x8c36('0xa3')][_0x8c36('0x5d')]){return _0x28b34c['Contacts'][0x0];}var _0x3dd44a=_[_0x8c36('0x17')](_0x38ecc8['body'],{'firstName':_0x38ecc8['body']['from'],'ListId':_0x28b34c['id']});_0x3dd44a[_0x38ecc8['body'][_0x8c36('0x9b')]]=_0x38ecc8['body'][_0x8c36('0x92')];return db[_0x8c36('0xa0')]['create'](_0x3dd44a,{'fields':_0x3d746e,'raw':!![]});}})[_0x8c36('0x39')](handleEntityNotFound(_0x30b834,null))[_0x8c36('0x39')](function(_0xbac0c0){if(_0xbac0c0){_0x38ecc8[_0x8c36('0xa4')]=_0xbac0c0;var _0x3004e3={'ContactId':_0xbac0c0['id'],'phone':_0x38ecc8[_0x8c36('0x67')]['from'],'WhatsappAccountId':_0x180b8b[_0x8c36('0x5c')]['id']};var _0x553f9c={'ContactId':_0xbac0c0['id'],'WhatsappAccountId':_0x180b8b['params']['id'],'closed':![]};return db[_0x8c36('0xa5')][_0x8c36('0x5f')]({'where':_0x553f9c})[_0x8c36('0x39')](function(_0x568b2e){if(_0x568b2e){return[_0x568b2e,![]];}return db[_0x8c36('0xa5')][_0x8c36('0x60')](_0x3004e3)['then'](function(_0x4b07f9){return[_0x4b07f9,!![]];});});}})['spread'](function(_0x2a8ef5,_0x1689a8){_0x38ecc8[_0x8c36('0xa6')]=_0x2a8ef5['get']({'plain':!![]});_0x38ecc8[_0x8c36('0xa6')][_0x8c36('0xa7')]=![];if(_0x1689a8){if(_0x38ecc8['account'][_0x8c36('0xa8')]){_0x38ecc8[_0x8c36('0x87')][_0x8c36('0xa9')]({'id':0x0,'priority':_0x38ecc8['applications'][_0x8c36('0x5d')]+0x1,'app':_0x8c36('0xaa'),'appdata':_0x8c36('0xab'),'interval':'*,*,*,*'});}_0x38ecc8[_0x8c36('0xa6')]['created']=!![];}return db['WhatsappMessage'][_0x8c36('0x60')]({'phone':_0x38ecc8['body']['from'],'messageId':_0x38ecc8[_0x8c36('0x67')]['messageId'],'body':_0x38ecc8['body'][_0x8c36('0x67')],'WhatsappAccountId':_0x180b8b[_0x8c36('0x5c')]['id'],'WhatsappInteractionId':_0x2a8ef5['id'],'direction':'in','ContactId':_0x2a8ef5[_0x8c36('0xac')],'AttachmentId':_0x38ecc8[_0x8c36('0x67')]['AttachmentId']});})[_0x8c36('0x39')](function(_0x3bf055){_0x38ecc8[_0x8c36('0x2b')]=_0x3bf055;if(_0x38ecc8['interaction'][_0x8c36('0xad')]){return db[_0x8c36('0xae')][_0x8c36('0x5f')]({'attributes':['id',_0x8c36('0x40')],'where':{'id':_0x38ecc8['interaction']['UserId']}})[_0x8c36('0x39')](function(_0x17bead){if(_0x17bead){_0x38ecc8['applications'][_0x8c36('0xaf')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x17bead[_0x8c36('0x40')]+','+(_0x38ecc8[_0x8c36('0x86')][_0x8c36('0xb0')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x8c36('0xb1'),_0x8c36('0xb2'),_0x38ecc8);});}return respondWithRpcPromise(_0x8c36('0xb1'),_0x8c36('0xb2'),_0x38ecc8);})['then'](function(_0x47d89e){if(_0x47d89e){var _0x471f12=0xc8;var _0x12ed64=_0x8c36('0xb3');logger[_0x8c36('0x23')](_0x8c36('0x27'),_0x12ed64,_0x471f12,'entity\x20found');logger[_0x8c36('0x26')](_0x8c36('0xb4'),_0x12ed64,_0x471f12,_0x8c36('0xb5'),JSON[_0x8c36('0x28')](_0x47d89e));if(_0x38ecc8[_0x8c36('0x86')][_0x8c36('0x57')]===_0x8c36('0x91')){return _0x30b834[_0x8c36('0x2f')](_0x471f12)['set'](_0x8c36('0xb6'),_0x8c36('0xb7'))[_0x8c36('0x41')](_0x8c36('0xb8'));}else{return _0x30b834[_0x8c36('0x2f')](_0x471f12)[_0x8c36('0x30')](_0x47d89e);}}})[_0x8c36('0x2d')](handleError(_0x30b834,null));};exports[_0x8c36('0x41')]=function(_0x248269,_0x4c6789,_0x3fce62){var _0x2bb286,_0xfaf9be,_0x331fb5;if(_[_0x8c36('0x98')](_0x248269[_0x8c36('0x67')][_0x8c36('0x67')])||_0x248269['body'][_0x8c36('0x67')]===''){throw new db['Sequelize']['ValidationError'](_0x8c36('0x9a'));}if(_[_0x8c36('0x98')](_0x248269[_0x8c36('0x67')]['to'])){throw new db[(_0x8c36('0x1f'))]['ValidationError'](_0x8c36('0xb9'));}_0x2bb286=_0x248269[_0x8c36('0x67')]['to'];return db[_0x8c36('0x45')][_0x8c36('0x5f')]({'where':{'id':_0x248269[_0x8c36('0x5c')]['id']},'include':[{'model':db['CmList'],'as':_0x8c36('0xba'),'include':[{'model':db[_0x8c36('0xa0')],'as':_0x8c36('0xa3'),'where':{'mobile':_0x2bb286},'limit':0x1,'order':[[_0x8c36('0x8d'),_0x8c36('0xa1')]]}]}]})['then'](handleEntityNotFound(_0x4c6789,null))[_0x8c36('0x39')](function(_0x5b5b24){if(_0x5b5b24&&_0x5b5b24[_0x8c36('0xba')]){_0xfaf9be=_0x5b5b24[_0x8c36('0x3a')]({'plain':!![]});if(_0xfaf9be[_0x8c36('0xba')]&&_0xfaf9be[_0x8c36('0xba')][_0x8c36('0xa3')][_0x8c36('0x5d')]){return _0xfaf9be['List']['Contacts'][0x0];}return db['CmContact']['create'](_['defaults'](_0x248269[_0x8c36('0x67')],{'firstName':_0x2bb286,'mobile':_0x2bb286,'phone':_0x2bb286,'ListId':_0xfaf9be['ListId']}));}})[_0x8c36('0x39')](handleEntityNotFound(_0x4c6789,null))[_0x8c36('0x39')](function(_0x127e4e){if(_0x127e4e){_0x331fb5=_0x127e4e;return db[_0x8c36('0xa5')][_0x8c36('0x5f')]({'where':{'ContactId':_0x331fb5['id'],'closed':![],'WhatsappAccountId':_0xfaf9be['id']}})['then'](function(_0x4f52f3){if(_0x4f52f3){return[_0x4f52f3,![]];}return db[_0x8c36('0xa5')][_0x8c36('0x60')]({'UserId':_0x248269[_0x8c36('0x63')]['id'],'ContactId':_0x331fb5['id'],'WhatsappAccountId':_0xfaf9be['id'],'phone':_0x2bb286,'firstMsgDirection':_0x8c36('0xbb'),'Messages':[_[_0x8c36('0x56')](_0x248269[_0x8c36('0x67')],{'read':![],'body':_0x248269[_0x8c36('0x67')][_0x8c36('0x67')],'phone':_0x2bb286,'WhatsappAccountId':_0xfaf9be['id'],'UserId':_0x248269[_0x8c36('0x63')]['id'],'ContactId':_0x331fb5['id']})]},{'include':[{'model':db[_0x8c36('0xbc')],'as':_0x8c36('0xbd')}]})[_0x8c36('0x39')](function(_0x32a2a4){return[_0x32a2a4,!![]];});});}})[_0x8c36('0x76')](function(_0xac1e8f,_0x1b8bcd){if(_0x1b8bcd){return _0xac1e8f;}return db['WhatsappMessage'][_0x8c36('0x60')](_[_0x8c36('0x56')](_0x248269[_0x8c36('0x67')],{'read':![],'body':_0x248269['body'][_0x8c36('0x67')],'phone':_0x2bb286,'WhatsappAccountId':_0xfaf9be['id'],'WhatsappInteractionId':_0xac1e8f['id'],'UserId':_0x248269[_0x8c36('0x63')]['id'],'ContactId':_0x331fb5['id']}))['then'](function(_0xba9cfa){_0xac1e8f['dataValues'][_0x8c36('0xbd')]=[];_0xac1e8f[_0x8c36('0xbe')][_0x8c36('0xbd')]['push'](_0xba9cfa['dataValues']);return _0xac1e8f;});})[_0x8c36('0x39')](respondWithResult(_0x4c6789,null))[_0x8c36('0x2d')](handleError(_0x4c6789,null));}; \ No newline at end of file +var _0xb9a7=['includeAll','include','rows','params','keys','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappAccounts','UserProfileSection','userProfileId','describe','WhatsappAccountId','Disposition','getDispositions','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','User','getAgents','transaction','bulkCreate','WhatsappApplication','priority','getApplications','notify','whatsapp','Applications','account','applications','orderBy','asc','CmContact','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','list','defaults','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','WhatsappMessage','ContactId','UserId','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','DESC','List','user','out','dataValues','Messages','eml-format','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','localhost','./whatsappAccount.socket','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','count','offset','set','Content-Range','json','apply','save','update','destroy','get','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','filters','pick','where','VIRTUAL','filter','merge','options','WhatsappAccount'];(function(_0x2b3e04,_0x5c1d3b){var _0x231a4c=function(_0x4d3a5f){while(--_0x4d3a5f){_0x2b3e04['push'](_0x2b3e04['shift']());}};_0x231a4c(++_0x5c1d3b);}(_0xb9a7,0x112));var _0x7b9a=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xb9a7[_0x3ab51d];return _0x29a04e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7b9a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7b9a('0x1'));var moment=require('moment');var BPromise=require(_0x7b9a('0x2'));var Mustache=require(_0x7b9a('0x3'));var util=require(_0x7b9a('0x4'));var path=require(_0x7b9a('0x5'));var sox=require(_0x7b9a('0x6'));var csv=require(_0x7b9a('0x7'));var ejs=require(_0x7b9a('0x8'));var fs=require('fs');var _=require(_0x7b9a('0x9'));var squel=require(_0x7b9a('0xa'));var crypto=require(_0x7b9a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7b9a('0xc'));var toCsv=require(_0x7b9a('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7b9a('0xd'));var qs=require(_0x7b9a('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7b9a('0xf'));var logger=require('../../config/logger')(_0x7b9a('0x10'));var utils=require('../../config/utils');var config=require(_0x7b9a('0x11'));var db=require(_0x7b9a('0x12'))['db'];config[_0x7b9a('0x13')]=_['defaults'](config[_0x7b9a('0x13')],{'host':_0x7b9a('0x14'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7b9a('0x13')]));require(_0x7b9a('0x15'))['register'](socket);var jayson=require(_0x7b9a('0x16'));var client=jayson[_0x7b9a('0x17')][_0x7b9a('0x18')]({'port':0x232c});function checkPasswordPattern(_0x2853f2,_0x344fa7,_0x346daa){if(_0x346daa){var _0x22a7e4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x22a7e4[_0x7b9a('0x19')](_0x344fa7)){return _0x2853f2;}else{throw new db[(_0x7b9a('0x1a'))]['ValidationError'](_0x7b9a('0x1b'));}}else{return _0x2853f2;}}function respondWithRpcPromise(_0x4e8524,_0x123921,_0xa217cb,_0x271263){return new BPromise(function(_0x169d16,_0x44a232){var _0x180a67=_0x271263||client;return _0x180a67[_0x7b9a('0x1c')](_0x4e8524,_0xa217cb)[_0x7b9a('0x1d')](function(_0x2064a0){logger[_0x7b9a('0x1e')](_0x7b9a('0x1f'),_0x123921,_0x7b9a('0x20'));logger[_0x7b9a('0x21')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x123921,_0x7b9a('0x20'),JSON['stringify'](_0x2064a0));if(_0x2064a0[_0x7b9a('0x22')]){if(_0x2064a0['error'][_0x7b9a('0x23')]===0x1f4){logger[_0x7b9a('0x22')](_0x7b9a('0x1f'),_0x123921,_0x2064a0['error'][_0x7b9a('0x24')]);return _0x44a232(_0x2064a0[_0x7b9a('0x22')]['message']);}logger[_0x7b9a('0x22')](_0x7b9a('0x1f'),_0x123921,_0x2064a0[_0x7b9a('0x22')][_0x7b9a('0x24')]);return _0x169d16(_0x2064a0[_0x7b9a('0x22')]['message']);}else{logger[_0x7b9a('0x1e')](_0x7b9a('0x1f'),_0x123921,'request\x20sent');_0x169d16(_0x2064a0[_0x7b9a('0x25')]['message']);}})[_0x7b9a('0x26')](function(_0x3091ab){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x123921,_0x3091ab);_0x44a232(_0x3091ab);});});}function respondWithStatusCode(_0x24d886,_0x55301c){_0x55301c=_0x55301c||0xcc;return function(_0x54df8a){if(_0x54df8a){return _0x24d886[_0x7b9a('0x27')](_0x55301c);}return _0x24d886['status'](_0x55301c)['end']();};}function respondWithResult(_0x3847b4,_0x4d5880){_0x4d5880=_0x4d5880||0xc8;return function(_0x5c89b6){if(_0x5c89b6){return _0x3847b4[_0x7b9a('0x28')](_0x4d5880)['json'](_0x5c89b6);}};}function respondWithFilteredResult(_0x1553ae,_0x2e6144){return function(_0xd35ce7){if(_0xd35ce7){var _0x5b64d7=_0xd35ce7[_0x7b9a('0x29')],_0x45ccf5=_0x2e6144[_0x7b9a('0x2a')],_0x2ce78b=_0x2e6144[_0x7b9a('0x2a')]+_0x2e6144['limit'],_0x181e9c;if(_0x2ce78b>=_0x5b64d7){_0x2ce78b=_0x5b64d7;_0x181e9c=0xc8;}else{_0x181e9c=0xce;}_0x1553ae['status'](_0x181e9c);return _0x1553ae[_0x7b9a('0x2b')](_0x7b9a('0x2c'),_0x45ccf5+'-'+_0x2ce78b+'/'+_0x5b64d7)[_0x7b9a('0x2d')](_0xd35ce7);}return null;};}function patchUpdates(_0x4c639d){return function(_0x2b199b){try{jsonpatch[_0x7b9a('0x2e')](_0x2b199b,_0x4c639d,!![]);}catch(_0x4d5223){return BPromise['reject'](_0x4d5223);}return _0x2b199b[_0x7b9a('0x2f')]();};}function saveUpdates(_0x306a02,_0x5cc24e){return function(_0x255ee2){if(_0x255ee2){return _0x255ee2[_0x7b9a('0x30')](_0x306a02)[_0x7b9a('0x1d')](function(_0x18db2f){return _0x18db2f;});}return null;};}function removeEntity(_0x277236,_0x4e8da6){return function(_0x46bcd0){if(_0x46bcd0){return _0x46bcd0[_0x7b9a('0x31')]()[_0x7b9a('0x1d')](function(){var _0x7070dd=_0x46bcd0[_0x7b9a('0x32')]({'plain':!![]});var _0x225d1f='WhatsappAccounts';return db['UserProfileResource'][_0x7b9a('0x31')]({'where':{'type':_0x225d1f,'resourceId':_0x7070dd['id']}})[_0x7b9a('0x1d')](function(){return _0x46bcd0;});})['then'](function(){_0x277236[_0x7b9a('0x28')](0xcc)[_0x7b9a('0x33')]();});}};}function handleEntityNotFound(_0xf58dca,_0x5841e4){return function(_0x2c3949){if(!_0x2c3949){_0xf58dca[_0x7b9a('0x27')](0x194);}return _0x2c3949;};}function handleError(_0x58cf08,_0x47cc15){_0x47cc15=_0x47cc15||0x1f4;return function(_0x326f06){logger[_0x7b9a('0x22')](_0x326f06[_0x7b9a('0x34')]);if(_0x326f06[_0x7b9a('0x35')]){delete _0x326f06[_0x7b9a('0x35')];}_0x58cf08[_0x7b9a('0x28')](_0x47cc15)[_0x7b9a('0x36')](_0x326f06);};}exports[_0x7b9a('0x37')]=function(_0x4af212,_0x366b62){var _0x5ac175={'include':[{'model':db[_0x7b9a('0x38')],'as':_0x7b9a('0x39')}]},_0x213370={},_0x157ca8={'count':0x0,'rows':[]};var _0x3fa4cd=_[_0x7b9a('0x3a')](db['WhatsappAccount'][_0x7b9a('0x3b')],function(_0x2a6ed6){return{'name':_0x2a6ed6[_0x7b9a('0x3c')],'type':_0x2a6ed6[_0x7b9a('0x3d')]['key']};});_0x213370[_0x7b9a('0x3e')]=_[_0x7b9a('0x3a')](_0x3fa4cd,_0x7b9a('0x35'));_0x213370[_0x7b9a('0x3f')]=_['keys'](_0x4af212[_0x7b9a('0x3f')]);_0x213370['filters']=_[_0x7b9a('0x40')](_0x213370[_0x7b9a('0x3e')],_0x213370[_0x7b9a('0x3f')]);_0x5ac175[_0x7b9a('0x41')]=_[_0x7b9a('0x40')](_0x213370[_0x7b9a('0x3e')],qs['fields'](_0x4af212[_0x7b9a('0x3f')][_0x7b9a('0x42')]));_0x5ac175[_0x7b9a('0x41')]=_0x5ac175['attributes']['length']?_0x5ac175[_0x7b9a('0x41')]:_0x213370[_0x7b9a('0x3e')];if(!_0x4af212[_0x7b9a('0x3f')][_0x7b9a('0x43')](_0x7b9a('0x44'))){_0x5ac175[_0x7b9a('0x45')]=qs['limit'](_0x4af212['query']['limit']);_0x5ac175[_0x7b9a('0x2a')]=qs[_0x7b9a('0x2a')](_0x4af212['query'][_0x7b9a('0x2a')]);}_0x5ac175[_0x7b9a('0x46')]=qs[_0x7b9a('0x47')](_0x4af212['query'][_0x7b9a('0x47')]);_0x5ac175['where']=qs[_0x7b9a('0x48')](_[_0x7b9a('0x49')](_0x4af212[_0x7b9a('0x3f')],_0x213370[_0x7b9a('0x48')]),_0x3fa4cd);if(_0x4af212[_0x7b9a('0x3f')]['filter']){_0x5ac175[_0x7b9a('0x4a')]=_['merge'](_0x5ac175[_0x7b9a('0x4a')],{'$or':_['map'](_0x3fa4cd,function(_0x4f1b2e){if(_0x4f1b2e[_0x7b9a('0x3d')]!==_0x7b9a('0x4b')){var _0x717d08={};_0x717d08[_0x4f1b2e[_0x7b9a('0x35')]]={'$like':'%'+_0x4af212[_0x7b9a('0x3f')][_0x7b9a('0x4c')]+'%'};return _0x717d08;}})});}_0x5ac175=_[_0x7b9a('0x4d')]({},_0x5ac175,_0x4af212[_0x7b9a('0x4e')]);var _0x1d034b={'where':_0x5ac175['where']};return db[_0x7b9a('0x4f')][_0x7b9a('0x29')](_0x1d034b)['then'](function(_0x576421){_0x157ca8['count']=_0x576421;if(_0x4af212[_0x7b9a('0x3f')][_0x7b9a('0x50')]){_0x5ac175[_0x7b9a('0x51')]=[{'all':!![]}];}return db[_0x7b9a('0x4f')]['findAll'](_0x5ac175);})[_0x7b9a('0x1d')](function(_0x2fe247){_0x157ca8[_0x7b9a('0x52')]=_0x2fe247;return _0x157ca8;})[_0x7b9a('0x1d')](respondWithFilteredResult(_0x366b62,_0x5ac175))[_0x7b9a('0x26')](handleError(_0x366b62,null));};exports['show']=function(_0x22aea9,_0x54eb5f){var _0x99b054={'raw':![],'where':{'id':_0x22aea9[_0x7b9a('0x53')]['id']},'include':[{'model':db[_0x7b9a('0x38')],'as':'mandatoryDispositionPause'}]},_0x23c173={};_0x23c173[_0x7b9a('0x3e')]=_[_0x7b9a('0x54')](db[_0x7b9a('0x4f')][_0x7b9a('0x3b')]);_0x23c173[_0x7b9a('0x3f')]=_[_0x7b9a('0x54')](_0x22aea9[_0x7b9a('0x3f')]);_0x23c173['filters']=_['intersection'](_0x23c173['model'],_0x23c173[_0x7b9a('0x3f')]);_0x99b054[_0x7b9a('0x41')]=_['intersection'](_0x23c173['model'],qs['fields'](_0x22aea9['query'][_0x7b9a('0x42')]));_0x99b054[_0x7b9a('0x41')]=_0x99b054[_0x7b9a('0x41')][_0x7b9a('0x55')]?_0x99b054[_0x7b9a('0x41')]:_0x23c173[_0x7b9a('0x3e')];if(_0x22aea9[_0x7b9a('0x3f')][_0x7b9a('0x50')]){_0x99b054['include']=[{'all':!![]}];}_0x99b054=_[_0x7b9a('0x4d')]({},_0x99b054,_0x22aea9['options']);return db[_0x7b9a('0x4f')][_0x7b9a('0x56')](_0x99b054)[_0x7b9a('0x1d')](handleEntityNotFound(_0x54eb5f,null))[_0x7b9a('0x1d')](respondWithResult(_0x54eb5f,null))[_0x7b9a('0x26')](handleError(_0x54eb5f,null));};exports['create']=function(_0x25ec82,_0x491804){return db[_0x7b9a('0x4f')][_0x7b9a('0x57')](_0x25ec82[_0x7b9a('0x58')],{})['then'](function(_0x50c289){var _0x5f5302=_0x25ec82['user'][_0x7b9a('0x32')]({'plain':!![]});if(!_0x5f5302)throw new Error(_0x7b9a('0x59'));if(_0x5f5302[_0x7b9a('0x5a')]==='user'){var _0x2f9b44=_0x50c289[_0x7b9a('0x32')]({'plain':!![]});var _0x466a9d=_0x7b9a('0x5b');return db[_0x7b9a('0x5c')]['find']({'where':{'name':_0x466a9d,'userProfileId':_0x5f5302[_0x7b9a('0x5d')]},'raw':!![]})[_0x7b9a('0x1d')](function(_0x19770f){if(_0x19770f&&_0x19770f['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x2f9b44[_0x7b9a('0x35')],'resourceId':_0x2f9b44['id'],'type':_0x19770f[_0x7b9a('0x35')],'sectionId':_0x19770f['id']},{})[_0x7b9a('0x1d')](function(){return _0x50c289;});}else{return _0x50c289;}})['catch'](function(_0x39c048){logger[_0x7b9a('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x39c048);throw _0x39c048;});}return _0x50c289;})[_0x7b9a('0x1d')](respondWithResult(_0x491804,0xc9))['catch'](handleError(_0x491804,null));};exports[_0x7b9a('0x30')]=function(_0x565b10,_0x11660c){if(_0x565b10[_0x7b9a('0x58')]['id']){delete _0x565b10[_0x7b9a('0x58')]['id'];}return db[_0x7b9a('0x4f')]['find']({'where':{'id':_0x565b10[_0x7b9a('0x53')]['id']},'include':[{'model':db[_0x7b9a('0x38')],'as':_0x7b9a('0x39')}]})[_0x7b9a('0x1d')](handleEntityNotFound(_0x11660c,null))['then'](saveUpdates(_0x565b10[_0x7b9a('0x58')],null))['then'](respondWithResult(_0x11660c,null))[_0x7b9a('0x26')](handleError(_0x11660c,null));};exports['destroy']=function(_0x1df025,_0x5f223a){return db['WhatsappAccount']['find']({'where':{'id':_0x1df025['params']['id']}})[_0x7b9a('0x1d')](handleEntityNotFound(_0x5f223a,null))[_0x7b9a('0x1d')](removeEntity(_0x5f223a,null))[_0x7b9a('0x26')](handleError(_0x5f223a,null));};exports[_0x7b9a('0x5e')]=function(_0x4ac9f9,_0x6dfa77){return db['WhatsappAccount']['describe']()[_0x7b9a('0x1d')](respondWithResult(_0x6dfa77,null))['catch'](handleError(_0x6dfa77,null));};exports['addDisposition']=function(_0x7ad607,_0x262fd2,_0x5524c0){if(_0x7ad607[_0x7b9a('0x58')]['id']){delete _0x7ad607['body']['id'];}return db[_0x7b9a('0x4f')][_0x7b9a('0x56')]({'where':{'id':_0x7ad607[_0x7b9a('0x53')]['id']}})['then'](handleEntityNotFound(_0x262fd2,null))['then'](function(_0x5049f8){if(_0x5049f8){_0x7ad607['body'][_0x7b9a('0x5f')]=_0x5049f8['id'];return db[_0x7b9a('0x60')][_0x7b9a('0x57')](_0x7ad607[_0x7b9a('0x58')]);}})[_0x7b9a('0x1d')](respondWithResult(_0x262fd2,null))[_0x7b9a('0x26')](handleError(_0x262fd2,null));};exports[_0x7b9a('0x61')]=function(_0x4b736e,_0xdd42ba,_0x37951e){var _0x4f312a={'raw':![],'where':{}};var _0x959992={};var _0x3f01dc={'count':0x0,'rows':[]};return db[_0x7b9a('0x4f')]['findOne']({'where':{'id':_0x4b736e['params']['id']}})[_0x7b9a('0x1d')](handleEntityNotFound(_0xdd42ba,null))[_0x7b9a('0x1d')](function(_0x5299e3){if(_0x5299e3){_0x959992[_0x7b9a('0x3e')]=_['keys'](db[_0x7b9a('0x60')][_0x7b9a('0x3b')]);_0x959992[_0x7b9a('0x3f')]=_['keys'](_0x4b736e[_0x7b9a('0x3f')]);_0x959992[_0x7b9a('0x48')]=_[_0x7b9a('0x40')](_0x959992[_0x7b9a('0x3e')],_0x959992[_0x7b9a('0x3f')]);_0x4f312a['attributes']=_['intersection'](_0x959992[_0x7b9a('0x3e')],qs[_0x7b9a('0x42')](_0x4b736e['query'][_0x7b9a('0x42')]));_0x4f312a[_0x7b9a('0x41')]=_0x4f312a[_0x7b9a('0x41')]['length']?_0x4f312a['attributes']:_0x959992[_0x7b9a('0x3e')];if(!_0x4b736e[_0x7b9a('0x3f')][_0x7b9a('0x43')](_0x7b9a('0x44'))){_0x4f312a['limit']=qs[_0x7b9a('0x45')](_0x4b736e[_0x7b9a('0x3f')][_0x7b9a('0x45')]);_0x4f312a['offset']=qs['offset'](_0x4b736e[_0x7b9a('0x3f')][_0x7b9a('0x2a')]);}_0x4f312a[_0x7b9a('0x46')]=qs[_0x7b9a('0x47')](_0x4b736e['query'][_0x7b9a('0x47')]);_0x4f312a[_0x7b9a('0x4a')]=qs['filters'](_[_0x7b9a('0x49')](_0x4b736e[_0x7b9a('0x3f')],_0x959992[_0x7b9a('0x48')]));_0x4f312a[_0x7b9a('0x4a')][_0x7b9a('0x5f')]=_0x5299e3['id'];if(_0x4b736e[_0x7b9a('0x3f')][_0x7b9a('0x4c')]){_0x4f312a[_0x7b9a('0x4a')]=_[_0x7b9a('0x4d')](_0x4f312a[_0x7b9a('0x4a')],{'$or':_[_0x7b9a('0x3a')](_0x4f312a['attributes'],function(_0x5df9f4){var _0x7dd008={};_0x7dd008[_0x5df9f4]={'$like':'%'+_0x4b736e[_0x7b9a('0x3f')]['filter']+'%'};return _0x7dd008;})});}_0x4f312a=_[_0x7b9a('0x4d')]({},_0x4f312a,_0x4b736e[_0x7b9a('0x4e')]);return db['Disposition'][_0x7b9a('0x29')]({'where':_0x4f312a[_0x7b9a('0x4a')]})[_0x7b9a('0x1d')](function(_0x20c427){_0x3f01dc[_0x7b9a('0x29')]=_0x20c427;if(_0x4b736e[_0x7b9a('0x3f')][_0x7b9a('0x50')]){_0x4f312a[_0x7b9a('0x51')]=[{'all':!![]}];}return db[_0x7b9a('0x60')]['findAll'](_0x4f312a);})[_0x7b9a('0x1d')](function(_0x141340){_0x3f01dc[_0x7b9a('0x52')]=_0x141340;return _0x3f01dc;});}})[_0x7b9a('0x1d')](respondWithFilteredResult(_0xdd42ba,_0x4f312a))[_0x7b9a('0x26')](handleError(_0xdd42ba,null));};exports[_0x7b9a('0x62')]=function(_0x398d96,_0x477f41,_0x5d522b){return db[_0x7b9a('0x4f')][_0x7b9a('0x56')]({'where':{'id':_0x398d96[_0x7b9a('0x53')]['id']}})['then'](handleEntityNotFound(_0x477f41,null))[_0x7b9a('0x1d')](function(_0x37ab0e){if(_0x37ab0e){return _0x37ab0e[_0x7b9a('0x62')](_0x398d96[_0x7b9a('0x3f')][_0x7b9a('0x63')]);}})[_0x7b9a('0x1d')](respondWithStatusCode(_0x477f41,null))[_0x7b9a('0x26')](handleError(_0x477f41,null));};exports[_0x7b9a('0x64')]=function(_0x4b7f79,_0x5260ca,_0x178ebc){if(_0x4b7f79[_0x7b9a('0x58')]['id']){delete _0x4b7f79[_0x7b9a('0x58')]['id'];}return db[_0x7b9a('0x4f')][_0x7b9a('0x56')]({'where':{'id':_0x4b7f79[_0x7b9a('0x53')]['id']}})[_0x7b9a('0x1d')](handleEntityNotFound(_0x5260ca,null))[_0x7b9a('0x1d')](function(_0x368d16){if(_0x368d16){_0x4b7f79[_0x7b9a('0x58')]['WhatsappAccountId']=_0x368d16['id'];return db[_0x7b9a('0x65')][_0x7b9a('0x57')](_0x4b7f79[_0x7b9a('0x58')]);}})['then'](respondWithResult(_0x5260ca,null))[_0x7b9a('0x26')](handleError(_0x5260ca,null));};exports[_0x7b9a('0x66')]=function(_0xf50854,_0x10b702,_0x4ab6eb){var _0x2671b4={'raw':![],'where':{}};var _0x4a7292={};var _0x54bf4b={'count':0x0,'rows':[]};return db[_0x7b9a('0x4f')][_0x7b9a('0x67')]({'where':{'id':_0xf50854[_0x7b9a('0x53')]['id']}})[_0x7b9a('0x1d')](handleEntityNotFound(_0x10b702,null))[_0x7b9a('0x1d')](function(_0x449dd6){if(_0x449dd6){_0x4a7292['model']=_['keys'](db[_0x7b9a('0x65')][_0x7b9a('0x3b')]);_0x4a7292[_0x7b9a('0x3f')]=_[_0x7b9a('0x54')](_0xf50854['query']);_0x4a7292[_0x7b9a('0x48')]=_[_0x7b9a('0x40')](_0x4a7292[_0x7b9a('0x3e')],_0x4a7292['query']);_0x2671b4[_0x7b9a('0x41')]=_[_0x7b9a('0x40')](_0x4a7292[_0x7b9a('0x3e')],qs[_0x7b9a('0x42')](_0xf50854[_0x7b9a('0x3f')]['fields']));_0x2671b4[_0x7b9a('0x41')]=_0x2671b4[_0x7b9a('0x41')][_0x7b9a('0x55')]?_0x2671b4[_0x7b9a('0x41')]:_0x4a7292[_0x7b9a('0x3e')];if(!_0xf50854[_0x7b9a('0x3f')][_0x7b9a('0x43')]('nolimit')){_0x2671b4[_0x7b9a('0x45')]=qs[_0x7b9a('0x45')](_0xf50854[_0x7b9a('0x3f')][_0x7b9a('0x45')]);_0x2671b4[_0x7b9a('0x2a')]=qs[_0x7b9a('0x2a')](_0xf50854[_0x7b9a('0x3f')][_0x7b9a('0x2a')]);}_0x2671b4['order']=qs[_0x7b9a('0x47')](_0xf50854['query'][_0x7b9a('0x47')]);_0x2671b4[_0x7b9a('0x4a')]=qs[_0x7b9a('0x48')](_[_0x7b9a('0x49')](_0xf50854[_0x7b9a('0x3f')],_0x4a7292[_0x7b9a('0x48')]));_0x2671b4[_0x7b9a('0x4a')][_0x7b9a('0x5f')]=_0x449dd6['id'];if(_0xf50854[_0x7b9a('0x3f')]['filter']){_0x2671b4[_0x7b9a('0x4a')]=_['merge'](_0x2671b4[_0x7b9a('0x4a')],{'$or':_['map'](_0x2671b4[_0x7b9a('0x41')],function(_0xb83db4){var _0x2cc937={};_0x2cc937[_0xb83db4]={'$like':'%'+_0xf50854['query']['filter']+'%'};return _0x2cc937;})});}_0x2671b4=_[_0x7b9a('0x4d')]({},_0x2671b4,_0xf50854[_0x7b9a('0x4e')]);return db['CannedAnswer'][_0x7b9a('0x29')]({'where':_0x2671b4[_0x7b9a('0x4a')]})[_0x7b9a('0x1d')](function(_0x203f39){_0x54bf4b[_0x7b9a('0x29')]=_0x203f39;if(_0xf50854[_0x7b9a('0x3f')][_0x7b9a('0x50')]){_0x2671b4[_0x7b9a('0x51')]=[{'all':!![]}];}return db[_0x7b9a('0x65')]['findAll'](_0x2671b4);})[_0x7b9a('0x1d')](function(_0x4b78db){_0x54bf4b[_0x7b9a('0x52')]=_0x4b78db;return _0x54bf4b;});}})[_0x7b9a('0x1d')](respondWithFilteredResult(_0x10b702,_0x2671b4))[_0x7b9a('0x26')](handleError(_0x10b702,null));};exports[_0x7b9a('0x68')]=function(_0x2a6e60,_0x5c63f7,_0x35ddc6){return db['WhatsappAccount'][_0x7b9a('0x56')]({'where':{'id':_0x2a6e60[_0x7b9a('0x53')]['id']}})[_0x7b9a('0x1d')](handleEntityNotFound(_0x5c63f7,null))['then'](function(_0xf527ec){if(_0xf527ec){return _0xf527ec[_0x7b9a('0x68')](_0x2a6e60[_0x7b9a('0x3f')][_0x7b9a('0x63')]);}})[_0x7b9a('0x1d')](respondWithStatusCode(_0x5c63f7,null))[_0x7b9a('0x26')](handleError(_0x5c63f7,null));};exports[_0x7b9a('0x69')]=function(_0x400e80,_0x3ecfa6,_0x317116){return db[_0x7b9a('0x4f')][_0x7b9a('0x56')]({'where':{'id':_0x400e80[_0x7b9a('0x53')]['id']}})[_0x7b9a('0x1d')](handleEntityNotFound(_0x3ecfa6,null))[_0x7b9a('0x1d')](function(_0x1ecad3){if(_0x1ecad3){return _0x1ecad3['addAgents'](_0x400e80[_0x7b9a('0x58')][_0x7b9a('0x63')],_[_0x7b9a('0x6a')](_0x400e80[_0x7b9a('0x58')],[_0x7b9a('0x63'),'id'])||{})[_0x7b9a('0x6b')](function(_0x19ae53){for(var _0x2c3a1d=0x0;_0x2c3a1d<_0x400e80[_0x7b9a('0x58')]['ids'][_0x7b9a('0x55')];_0x2c3a1d+=0x1){socket[_0x7b9a('0x6c')](_0x7b9a('0x6d'),{'UserId':_0x400e80['body']['ids'][_0x2c3a1d],'WhatsappAccountId':_0x400e80[_0x7b9a('0x53')]['id']});}return _0x19ae53;});}})[_0x7b9a('0x1d')](respondWithResult(_0x3ecfa6,null))[_0x7b9a('0x26')](handleError(_0x3ecfa6,null));};exports[_0x7b9a('0x6e')]=function(_0x168485,_0xf8274f,_0x3f48c5){return db[_0x7b9a('0x4f')]['find']({'where':{'id':_0x168485[_0x7b9a('0x53')]['id']}})[_0x7b9a('0x1d')](handleEntityNotFound(_0xf8274f,null))[_0x7b9a('0x1d')](function(_0x343c13){if(_0x343c13){return _0x343c13[_0x7b9a('0x6e')](_0x168485[_0x7b9a('0x3f')][_0x7b9a('0x63')])[_0x7b9a('0x1d')](function(){if(_['isArray'](_0x168485[_0x7b9a('0x3f')][_0x7b9a('0x63')])){for(var _0x40d63f=0x0;_0x40d63f<_0x168485[_0x7b9a('0x3f')][_0x7b9a('0x63')][_0x7b9a('0x55')];_0x40d63f+=0x1){socket[_0x7b9a('0x6c')]('userWhatsappAccount:remove',{'UserId':Number(_0x168485[_0x7b9a('0x3f')]['ids'][_0x40d63f]),'WhatsappAccountId':Number(_0x168485[_0x7b9a('0x53')]['id'])});}}else{socket[_0x7b9a('0x6c')](_0x7b9a('0x6f'),{'UserId':Number(_0x168485[_0x7b9a('0x3f')]['ids']),'WhatsappAccountId':Number(_0x168485[_0x7b9a('0x53')]['id'])});}});}})['then'](respondWithStatusCode(_0xf8274f,null))['catch'](handleError(_0xf8274f,null));};exports['getAgents']=function(_0x4ea20d,_0x3a0e4a,_0x27c411){var _0xf4e5a8={};var _0x56ed34={};var _0x19ac27;var _0x57bcc7;return db[_0x7b9a('0x4f')][_0x7b9a('0x67')]({'where':{'id':_0x4ea20d[_0x7b9a('0x53')]['id']}})[_0x7b9a('0x1d')](handleEntityNotFound(_0x3a0e4a,null))['then'](function(_0x4b3e54){if(_0x4b3e54){_0x19ac27=_0x4b3e54;_0x56ed34['model']=_[_0x7b9a('0x54')](db[_0x7b9a('0x70')][_0x7b9a('0x3b')]);_0x56ed34[_0x7b9a('0x3f')]=_[_0x7b9a('0x54')](_0x4ea20d[_0x7b9a('0x3f')]);_0x56ed34[_0x7b9a('0x48')]=_['intersection'](_0x56ed34[_0x7b9a('0x3e')],_0x56ed34[_0x7b9a('0x3f')]);_0xf4e5a8['attributes']=_[_0x7b9a('0x40')](_0x56ed34[_0x7b9a('0x3e')],qs[_0x7b9a('0x42')](_0x4ea20d[_0x7b9a('0x3f')]['fields']));_0xf4e5a8[_0x7b9a('0x41')]=_0xf4e5a8[_0x7b9a('0x41')][_0x7b9a('0x55')]?_0xf4e5a8[_0x7b9a('0x41')]:_0x56ed34[_0x7b9a('0x3e')];_0xf4e5a8[_0x7b9a('0x46')]=qs['sort'](_0x4ea20d['query'][_0x7b9a('0x47')]);_0xf4e5a8[_0x7b9a('0x4a')]=qs[_0x7b9a('0x48')](_[_0x7b9a('0x49')](_0x4ea20d[_0x7b9a('0x3f')],_0x56ed34[_0x7b9a('0x48')]));if(_0x4ea20d[_0x7b9a('0x3f')][_0x7b9a('0x4c')]){_0xf4e5a8[_0x7b9a('0x4a')]=_[_0x7b9a('0x4d')](_0xf4e5a8['where'],{'$or':_['map'](_0xf4e5a8[_0x7b9a('0x41')],function(_0x459391){var _0xcab1e7={};_0xcab1e7[_0x459391]={'$like':'%'+_0x4ea20d[_0x7b9a('0x3f')][_0x7b9a('0x4c')]+'%'};return _0xcab1e7;})});}_0xf4e5a8=_[_0x7b9a('0x4d')]({},_0xf4e5a8,_0x4ea20d['options']);return _0x19ac27[_0x7b9a('0x71')](_0xf4e5a8);}})[_0x7b9a('0x1d')](function(_0x4557c4){if(_0x4557c4){_0x57bcc7=_0x4557c4[_0x7b9a('0x55')];if(!_0x4ea20d['query'][_0x7b9a('0x43')](_0x7b9a('0x44'))){_0xf4e5a8['limit']=qs['limit'](_0x4ea20d[_0x7b9a('0x3f')][_0x7b9a('0x45')]);_0xf4e5a8['offset']=qs['offset'](_0x4ea20d[_0x7b9a('0x3f')][_0x7b9a('0x2a')]);}return _0x19ac27[_0x7b9a('0x71')](_0xf4e5a8);}})['then'](function(_0x1d85f5){if(_0x1d85f5){return _0x1d85f5?{'count':_0x57bcc7,'rows':_0x1d85f5}:null;}})[_0x7b9a('0x1d')](respondWithResult(_0x3a0e4a,null))[_0x7b9a('0x26')](handleError(_0x3a0e4a,null));};exports['addApplications']=function(_0x4885d6,_0x1d51af,_0x9c655b){return db[_0x7b9a('0x4f')][_0x7b9a('0x67')]({'where':{'id':_0x4885d6[_0x7b9a('0x53')]['id']}})[_0x7b9a('0x1d')](handleEntityNotFound(_0x1d51af,null))[_0x7b9a('0x1d')](function(_0x1e30aa){if(_0x1e30aa){return db['sequelize'][_0x7b9a('0x72')](function(_0x468db6){return db['WhatsappApplication'][_0x7b9a('0x31')]({'where':{'WhatsappAccountId':_0x4885d6[_0x7b9a('0x53')]['id']},'transaction':_0x468db6})[_0x7b9a('0x1d')](function(_0x4ba112){var _0x5f0dc1=_['map'](_0x4885d6[_0x7b9a('0x58')],function(_0x4599f8){_0x4599f8[_0x7b9a('0x5f')]=_0x4885d6[_0x7b9a('0x53')]['id'];return _0x4599f8;});return db['WhatsappApplication'][_0x7b9a('0x73')](_0x5f0dc1,{'transaction':_0x468db6});});})[_0x7b9a('0x1d')](function(){return db[_0x7b9a('0x74')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x4885d6[_0x7b9a('0x53')]['id']},'order':_0x7b9a('0x75')});});}})[_0x7b9a('0x1d')](respondWithResult(_0x1d51af,null))[_0x7b9a('0x26')](handleError(_0x1d51af,null));};exports[_0x7b9a('0x76')]=function(_0x2d7478,_0x36f94b,_0x53bf3d){var _0x13e5e7={};var _0x209a42={};var _0xb138bd;var _0x562d9b;return db[_0x7b9a('0x4f')]['findOne']({'where':{'id':_0x2d7478['params']['id']}})[_0x7b9a('0x1d')](handleEntityNotFound(_0x36f94b,null))[_0x7b9a('0x1d')](function(_0x14c6da){if(_0x14c6da){_0xb138bd=_0x14c6da;_0x209a42[_0x7b9a('0x3e')]=_['keys'](db[_0x7b9a('0x74')]['rawAttributes']);_0x209a42[_0x7b9a('0x3f')]=_['keys'](_0x2d7478['query']);_0x209a42[_0x7b9a('0x48')]=_[_0x7b9a('0x40')](_0x209a42['model'],_0x209a42['query']);_0x13e5e7[_0x7b9a('0x41')]=_[_0x7b9a('0x40')](_0x209a42[_0x7b9a('0x3e')],qs['fields'](_0x2d7478[_0x7b9a('0x3f')]['fields']));_0x13e5e7['attributes']=_0x13e5e7[_0x7b9a('0x41')][_0x7b9a('0x55')]?_0x13e5e7[_0x7b9a('0x41')]:_0x209a42['model'];_0x13e5e7[_0x7b9a('0x46')]=qs['sort'](_0x2d7478[_0x7b9a('0x3f')][_0x7b9a('0x47')]);_0x13e5e7[_0x7b9a('0x4a')]=qs[_0x7b9a('0x48')](_['pick'](_0x2d7478['query'],_0x209a42[_0x7b9a('0x48')]));if(_0x2d7478[_0x7b9a('0x3f')][_0x7b9a('0x4c')]){_0x13e5e7[_0x7b9a('0x4a')]=_[_0x7b9a('0x4d')](_0x13e5e7[_0x7b9a('0x4a')],{'$or':_['map'](_0x13e5e7[_0x7b9a('0x41')],function(_0x59d8d7){var _0x4f2507={};_0x4f2507[_0x59d8d7]={'$like':'%'+_0x2d7478[_0x7b9a('0x3f')][_0x7b9a('0x4c')]+'%'};return _0x4f2507;})});}_0x13e5e7=_[_0x7b9a('0x4d')]({},_0x13e5e7,_0x2d7478[_0x7b9a('0x4e')]);return _0xb138bd[_0x7b9a('0x76')](_0x13e5e7);}})[_0x7b9a('0x1d')](function(_0x525a95){if(_0x525a95){_0x562d9b=_0x525a95[_0x7b9a('0x55')];if(!_0x2d7478['query'][_0x7b9a('0x43')](_0x7b9a('0x44'))){_0x13e5e7[_0x7b9a('0x45')]=qs[_0x7b9a('0x45')](_0x2d7478[_0x7b9a('0x3f')]['limit']);_0x13e5e7['offset']=qs['offset'](_0x2d7478[_0x7b9a('0x3f')]['offset']);}return _0xb138bd[_0x7b9a('0x76')](_0x13e5e7);}})[_0x7b9a('0x1d')](function(_0x7b8cb3){if(_0x7b8cb3){return _0x7b8cb3?{'count':_0x562d9b,'rows':_0x7b8cb3}:null;}})[_0x7b9a('0x1d')](respondWithResult(_0x36f94b,null))['catch'](handleError(_0x36f94b,null));};exports[_0x7b9a('0x77')]=function(_0x1b155c,_0x18b836,_0x158bf9){var _0x4fd45a={'channel':_0x7b9a('0x78')};var _0x56fe61=[];var _0x5bb68e=[];var _0x270306={};return db[_0x7b9a('0x4f')]['find']({'where':{'id':_0x1b155c[_0x7b9a('0x53')]['id']},'include':[{'model':db[_0x7b9a('0x74')],'as':_0x7b9a('0x79')}]})[_0x7b9a('0x1d')](handleEntityNotFound(_0x18b836,null))[_0x7b9a('0x1d')](function(_0x1e4b63){_0x4fd45a[_0x7b9a('0x7a')]=_0x1e4b63;_0x4fd45a[_0x7b9a('0x7b')]=_[_0x7b9a('0x7c')](_0x1e4b63[_0x7b9a('0x79')],[_0x7b9a('0x75')],[_0x7b9a('0x7d')]);if(_0x4fd45a[_0x7b9a('0x7a')]['Applications']){delete _0x4fd45a[_0x7b9a('0x7a')][_0x7b9a('0x79')];}return db[_0x7b9a('0x7e')][_0x7b9a('0x5e')]();})[_0x7b9a('0x1d')](function(_0x1a0c9f){if(!_0x1a0c9f){throw new db[(_0x7b9a('0x1a'))][(_0x7b9a('0x7f'))]('no\x20available\x20attributes');}_0x56fe61=_[_0x7b9a('0x80')](_[_0x7b9a('0x54')](_0x1a0c9f),[_0x7b9a('0x81'),'updatedAt']);_0x5bb68e=_[_0x7b9a('0x80')](_['keys'](_0x1a0c9f),[_0x7b9a('0x81'),_0x7b9a('0x82'),_0x7b9a('0x83'),_0x7b9a('0x84')]);_0x4fd45a[_0x7b9a('0x58')]={'mapKey':_0x7b9a('0x85')};if(_0x4fd45a[_0x7b9a('0x7a')][_0x7b9a('0x3d')]&&_0x4fd45a[_0x7b9a('0x7a')][_0x7b9a('0x3d')]===_0x7b9a('0x86')){_0x4fd45a[_0x7b9a('0x58')][_0x7b9a('0x87')]=_0x1b155c[_0x7b9a('0x58')][_0x7b9a('0x88')][_0x7b9a('0x89')](_0x7b9a('0x8a'),'');_0x4fd45a['body']['body']=_0x1b155c[_0x7b9a('0x58')][_0x7b9a('0x8b')];_0x4fd45a[_0x7b9a('0x58')][_0x7b9a('0x8c')]=_0x1b155c[_0x7b9a('0x58')][_0x7b9a('0x8d')];}if(_0x4fd45a[_0x7b9a('0x58')]['id']){delete _0x4fd45a[_0x7b9a('0x58')]['id'];}if(_[_0x7b9a('0x8e')](_0x4fd45a[_0x7b9a('0x58')]['from'])){throw new db[(_0x7b9a('0x1a'))][(_0x7b9a('0x7f'))](_0x7b9a('0x8f'));}if(_['isNil'](_0x4fd45a[_0x7b9a('0x58')][_0x7b9a('0x58')])||_0x4fd45a['body'][_0x7b9a('0x58')]===''){throw new db['Sequelize'][(_0x7b9a('0x7f'))](_0x7b9a('0x90'));}if(_[_0x7b9a('0x8e')](_0x4fd45a[_0x7b9a('0x58')][_0x7b9a('0x91')])){throw new db[(_0x7b9a('0x1a'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5bb68e);}if(!_['includes'](_0x5bb68e,_0x4fd45a[_0x7b9a('0x58')]['mapKey'])){throw new db[(_0x7b9a('0x1a'))][(_0x7b9a('0x7f'))](_0x7b9a('0x92')+_0x5bb68e);}_0x270306[_0x4fd45a[_0x7b9a('0x58')][_0x7b9a('0x91')]]=_0x4fd45a[_0x7b9a('0x58')]['from'];return db[_0x7b9a('0x93')][_0x7b9a('0x56')]({'where':{'id':_0x4fd45a[_0x7b9a('0x7a')][_0x7b9a('0x84')]},'include':[{'model':db[_0x7b9a('0x7e')],'as':_0x7b9a('0x94'),'where':_0x270306,'limit':0x1,'order':[[_0x7b9a('0x82'),'DESC']]}]});})['then'](handleEntityNotFound(_0x18b836,null))['then'](function(_0x2d4926){if(_0x2d4926){_0x4fd45a[_0x7b9a('0x95')]=_[_0x7b9a('0x6a')](_0x2d4926,[_0x7b9a('0x94')]);if(_0x2d4926[_0x7b9a('0x94')][_0x7b9a('0x55')]){return _0x2d4926['Contacts'][0x0];}var _0x769ff4=_[_0x7b9a('0x96')](_0x4fd45a[_0x7b9a('0x58')],{'firstName':_0x4fd45a[_0x7b9a('0x58')][_0x7b9a('0x87')],'ListId':_0x2d4926['id']});_0x769ff4[_0x4fd45a[_0x7b9a('0x58')][_0x7b9a('0x91')]]=_0x4fd45a['body'][_0x7b9a('0x87')];return db[_0x7b9a('0x7e')]['create'](_0x769ff4,{'fields':_0x56fe61,'raw':!![]});}})[_0x7b9a('0x1d')](handleEntityNotFound(_0x18b836,null))[_0x7b9a('0x1d')](function(_0x48f02e){if(_0x48f02e){_0x4fd45a['contact']=_0x48f02e;var _0x1354eb={'ContactId':_0x48f02e['id'],'phone':_0x4fd45a[_0x7b9a('0x58')][_0x7b9a('0x87')],'WhatsappAccountId':_0x1b155c[_0x7b9a('0x53')]['id']};var _0x360f2e={'ContactId':_0x48f02e['id'],'WhatsappAccountId':_0x1b155c['params']['id'],'closed':![]};return db['WhatsappInteraction'][_0x7b9a('0x56')]({'where':_0x360f2e})[_0x7b9a('0x1d')](function(_0x19dac6){if(_0x19dac6){return[_0x19dac6,![]];}return db[_0x7b9a('0x97')]['create'](_0x1354eb)[_0x7b9a('0x1d')](function(_0x2e8975){return[_0x2e8975,!![]];});});}})[_0x7b9a('0x6b')](function(_0xeb037b,_0x2370ab){_0x4fd45a[_0x7b9a('0x98')]=_0xeb037b[_0x7b9a('0x32')]({'plain':!![]});_0x4fd45a['interaction'][_0x7b9a('0x99')]=![];if(_0x2370ab){if(_0x4fd45a[_0x7b9a('0x7a')][_0x7b9a('0x9a')]){_0x4fd45a[_0x7b9a('0x7b')][_0x7b9a('0x9b')]({'id':0x0,'priority':_0x4fd45a['applications'][_0x7b9a('0x55')]+0x1,'app':_0x7b9a('0x9c'),'appdata':_0x7b9a('0x9d'),'interval':_0x7b9a('0x9e')});}_0x4fd45a[_0x7b9a('0x98')][_0x7b9a('0x99')]=!![];}return db[_0x7b9a('0x9f')]['create']({'phone':_0x4fd45a[_0x7b9a('0x58')][_0x7b9a('0x87')],'messageId':_0x4fd45a[_0x7b9a('0x58')]['messageId'],'body':_0x4fd45a[_0x7b9a('0x58')][_0x7b9a('0x58')],'WhatsappAccountId':_0x1b155c[_0x7b9a('0x53')]['id'],'WhatsappInteractionId':_0xeb037b['id'],'direction':'in','ContactId':_0xeb037b[_0x7b9a('0xa0')],'AttachmentId':_0x4fd45a[_0x7b9a('0x58')]['AttachmentId']});})['then'](function(_0x4236f7){_0x4fd45a[_0x7b9a('0x24')]=_0x4236f7;if(_0x4fd45a[_0x7b9a('0x98')][_0x7b9a('0xa1')]){return db['User'][_0x7b9a('0x56')]({'attributes':['id','name'],'where':{'id':_0x4fd45a['interaction']['UserId']}})['then'](function(_0x273429){if(_0x273429){_0x4fd45a[_0x7b9a('0x7b')]['unshift']({'id':0x0,'priority':0x0,'app':_0x7b9a('0xa2'),'appdata':_0x273429['name']+','+(_0x4fd45a['account'][_0x7b9a('0xa3')]||0xa),'interval':_0x7b9a('0x9e')});}return respondWithRpcPromise(_0x7b9a('0xa4'),_0x7b9a('0xa5'),_0x4fd45a);});}return respondWithRpcPromise(_0x7b9a('0xa4'),_0x7b9a('0xa5'),_0x4fd45a);})[_0x7b9a('0x1d')](function(_0x2ac8f4){if(_0x2ac8f4){var _0x474aea=0xc8;var _0xb950d3=_0x7b9a('0xa6');logger[_0x7b9a('0x1e')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xb950d3,_0x474aea,_0x7b9a('0xa7'));logger[_0x7b9a('0x21')](_0x7b9a('0xa8'),_0xb950d3,_0x474aea,_0x7b9a('0xa7'),JSON[_0x7b9a('0xa9')](_0x2ac8f4));if(_0x4fd45a[_0x7b9a('0x7a')][_0x7b9a('0x3d')]===_0x7b9a('0x86')){return _0x18b836[_0x7b9a('0x28')](_0x474aea)[_0x7b9a('0x2b')](_0x7b9a('0xaa'),'text/xml')[_0x7b9a('0x36')]('\x0a');}else{return _0x18b836['status'](_0x474aea)[_0x7b9a('0x2d')](_0x2ac8f4);}}})['catch'](handleError(_0x18b836,null));};exports['send']=function(_0x5b3db3,_0xe923ef,_0x3bf262){var _0x231f70,_0x12f650,_0x672901;if(_[_0x7b9a('0x8e')](_0x5b3db3[_0x7b9a('0x58')][_0x7b9a('0x58')])||_0x5b3db3[_0x7b9a('0x58')][_0x7b9a('0x58')]===''){throw new db['Sequelize'][(_0x7b9a('0x7f'))](_0x7b9a('0x90'));}if(_[_0x7b9a('0x8e')](_0x5b3db3[_0x7b9a('0x58')]['to'])){throw new db[(_0x7b9a('0x1a'))][(_0x7b9a('0x7f'))]('to\x20is\x20mandatory');}_0x231f70=_0x5b3db3[_0x7b9a('0x58')]['to'];return db[_0x7b9a('0x4f')][_0x7b9a('0x56')]({'where':{'id':_0x5b3db3[_0x7b9a('0x53')]['id']},'include':[{'model':db[_0x7b9a('0x93')],'as':'List','include':[{'model':db[_0x7b9a('0x7e')],'as':'Contacts','where':{'mobile':_0x231f70},'limit':0x1,'order':[[_0x7b9a('0x82'),_0x7b9a('0xab')]]}]}]})['then'](handleEntityNotFound(_0xe923ef,null))[_0x7b9a('0x1d')](function(_0x456290){if(_0x456290&&_0x456290['List']){_0x12f650=_0x456290[_0x7b9a('0x32')]({'plain':!![]});if(_0x12f650[_0x7b9a('0xac')]&&_0x12f650[_0x7b9a('0xac')][_0x7b9a('0x94')]['length']){return _0x12f650[_0x7b9a('0xac')]['Contacts'][0x0];}return db[_0x7b9a('0x7e')][_0x7b9a('0x57')](_[_0x7b9a('0x96')](_0x5b3db3[_0x7b9a('0x58')],{'firstName':_0x231f70,'mobile':_0x231f70,'phone':_0x231f70,'ListId':_0x12f650[_0x7b9a('0x84')]}));}})[_0x7b9a('0x1d')](handleEntityNotFound(_0xe923ef,null))[_0x7b9a('0x1d')](function(_0x30e950){if(_0x30e950){_0x672901=_0x30e950;return db[_0x7b9a('0x97')][_0x7b9a('0x56')]({'where':{'ContactId':_0x672901['id'],'closed':![],'WhatsappAccountId':_0x12f650['id']}})[_0x7b9a('0x1d')](function(_0x1e1f1c){if(_0x1e1f1c){return[_0x1e1f1c,![]];}return db[_0x7b9a('0x97')][_0x7b9a('0x57')]({'UserId':_0x5b3db3[_0x7b9a('0xad')]['id'],'ContactId':_0x672901['id'],'WhatsappAccountId':_0x12f650['id'],'phone':_0x231f70,'firstMsgDirection':_0x7b9a('0xae'),'Messages':[_[_0x7b9a('0x4d')](_0x5b3db3[_0x7b9a('0x58')],{'read':![],'body':_0x5b3db3[_0x7b9a('0x58')][_0x7b9a('0x58')],'phone':_0x231f70,'WhatsappAccountId':_0x12f650['id'],'UserId':_0x5b3db3['user']['id'],'ContactId':_0x672901['id']})]},{'include':[{'model':db[_0x7b9a('0x9f')],'as':'Messages'}]})[_0x7b9a('0x1d')](function(_0x5de5bf){return[_0x5de5bf,!![]];});});}})['spread'](function(_0x1cab0c,_0x15bed2){if(_0x15bed2){return _0x1cab0c;}return db[_0x7b9a('0x9f')]['create'](_['merge'](_0x5b3db3[_0x7b9a('0x58')],{'read':![],'body':_0x5b3db3['body'][_0x7b9a('0x58')],'phone':_0x231f70,'WhatsappAccountId':_0x12f650['id'],'WhatsappInteractionId':_0x1cab0c['id'],'UserId':_0x5b3db3[_0x7b9a('0xad')]['id'],'ContactId':_0x672901['id']}))[_0x7b9a('0x1d')](function(_0x13df9a){_0x1cab0c[_0x7b9a('0xaf')][_0x7b9a('0xb0')]=[];_0x1cab0c[_0x7b9a('0xaf')][_0x7b9a('0xb0')]['push'](_0x13df9a[_0x7b9a('0xaf')]);return _0x1cab0c;});})[_0x7b9a('0x1d')](respondWithResult(_0xe923ef,null))[_0x7b9a('0x26')](handleError(_0xe923ef,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index aa0d2ca..b20e206 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 _0x4bd3=['events','WhatsappAccount','setMaxListeners','emit','hook','exports'];(function(_0x5591f2,_0x34e7ef){var _0x2a21e8=function(_0x35bda5){while(--_0x35bda5){_0x5591f2['push'](_0x5591f2['shift']());}};_0x2a21e8(++_0x34e7ef);}(_0x4bd3,0x174));var _0x34bd=function(_0x5ac162,_0x58e97e){_0x5ac162=_0x5ac162-0x0;var _0x3b93e7=_0x4bd3[_0x5ac162];return _0x3b93e7;};'use strict';var EventEmitter=require(_0x34bd('0x0'));var WhatsappAccount=require('../../mysqldb')['db'][_0x34bd('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x34bd('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x22b921){return function(_0x44854a,_0x1fc8eb,_0x5846f3){WhatsappAccountEvents[_0x34bd('0x3')](_0x22b921+':'+_0x44854a['id'],_0x44854a);WhatsappAccountEvents[_0x34bd('0x3')](_0x22b921,_0x44854a);_0x5846f3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x34bd('0x4')](e,emitEvent(event));}}module[_0x34bd('0x5')]=WhatsappAccountEvents; \ No newline at end of file +var _0xafc4=['update','remove','emit','hasOwnProperty','hook','exports','events','WhatsappAccount','save'];(function(_0x188a93,_0xaf57db){var _0x23b40d=function(_0x599f63){while(--_0x599f63){_0x188a93['push'](_0x188a93['shift']());}};_0x23b40d(++_0xaf57db);}(_0xafc4,0x69));var _0x4afc=function(_0x2c68a3,_0x3d11e3){_0x2c68a3=_0x2c68a3-0x0;var _0x5385fb=_0xafc4[_0x2c68a3];return _0x5385fb;};'use strict';var EventEmitter=require(_0x4afc('0x0'));var WhatsappAccount=require('../../mysqldb')['db'][_0x4afc('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4afc('0x2'),'afterUpdate':_0x4afc('0x3'),'afterDestroy':_0x4afc('0x4')};function emitEvent(_0x237ea0){return function(_0x4d9dbd,_0x49f417,_0x5378e5){WhatsappAccountEvents[_0x4afc('0x5')](_0x237ea0+':'+_0x4d9dbd['id'],_0x4d9dbd);WhatsappAccountEvents[_0x4afc('0x5')](_0x237ea0,_0x4d9dbd);_0x5378e5(null);};}for(var e in events){if(events[_0x4afc('0x6')](e)){var event=events[e];WhatsappAccount[_0x4afc('0x7')](e,emitEvent(event));}}module[_0x4afc('0x8')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 3704b0b..9e4d299 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 _0x271a=['path','../../config/environment','./whatsappAccount.attributes','whatsapp_accounts','api','bluebird','request-promise'];(function(_0x33080e,_0x1c600a){var _0x407395=function(_0x5b62fd){while(--_0x5b62fd){_0x33080e['push'](_0x33080e['shift']());}};_0x407395(++_0x1c600a);}(_0x271a,0x18c));var _0xa271=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x271a[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xa271('0x0'));var moment=require('moment');var BPromise=require(_0xa271('0x1'));var rp=require(_0xa271('0x2'));var fs=require('fs');var path=require(_0xa271('0x3'));var rimraf=require('rimraf');var config=require(_0xa271('0x4'));var attributes=require(_0xa271('0x5'));module['exports']=function(_0x4a9df1,_0xd61df2){return _0x4a9df1['define']('WhatsappAccount',attributes,{'tableName':_0xa271('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a9b=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./whatsappAccount.attributes','define','WhatsappAccount','whatsapp_accounts','lodash','util'];(function(_0x3d4b52,_0x54acd2){var _0x100db5=function(_0x5f1c2a){while(--_0x5f1c2a){_0x3d4b52['push'](_0x3d4b52['shift']());}};_0x100db5(++_0x54acd2);}(_0x1a9b,0x73));var _0xb1a9=function(_0x26acc5,_0x42e1e0){_0x26acc5=_0x26acc5-0x0;var _0x4267f7=_0x1a9b[_0x26acc5];return _0x4267f7;};'use strict';var _=require(_0xb1a9('0x0'));var util=require(_0xb1a9('0x1'));var logger=require(_0xb1a9('0x2'))(_0xb1a9('0x3'));var moment=require(_0xb1a9('0x4'));var BPromise=require(_0xb1a9('0x5'));var rp=require(_0xb1a9('0x6'));var fs=require('fs');var path=require(_0xb1a9('0x7'));var rimraf=require(_0xb1a9('0x8'));var config=require('../../config/environment');var attributes=require(_0xb1a9('0x9'));module['exports']=function(_0x2f8fe0,_0x2e2a99){return _0x2f8fe0[_0xb1a9('0xa')](_0xb1a9('0xb'),attributes,{'tableName':_0xb1a9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 5a23801..969820d 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 _0x6aec=['WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','map','model','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','then','info','WhatsappAccount,\x20%s,\x20%s','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6aec,0x10e));var _0xc6ae=function(_0x47b3dc,_0x189328){_0x47b3dc=_0x47b3dc-0x0;var _0x1e3cc4=_0x6aec[_0x47b3dc];return _0x1e3cc4;};'use strict';var _=require(_0xc6ae('0x0'));var util=require('util');var moment=require(_0xc6ae('0x1'));var BPromise=require(_0xc6ae('0x2'));var rs=require(_0xc6ae('0x3'));var fs=require('fs');var Redis=require(_0xc6ae('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc6ae('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc6ae('0x6'));var client=jayson[_0xc6ae('0x7')][_0xc6ae('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0xc6ae('0x9')],{'host':_0xc6ae('0xa'),'port':0x18eb});var socket=require(_0xc6ae('0xb'))(new Redis(config[_0xc6ae('0x9')]));require(_0xc6ae('0xc'))[_0xc6ae('0xd')](socket);function respondWithRpcPromise(_0xbb43f7,_0x3d446a,_0x68da0){return new BPromise(function(_0x4ac284,_0x4af0ac){return client['request'](_0xbb43f7,_0x68da0)[_0xc6ae('0xe')](function(_0x3cbee0){logger[_0xc6ae('0xf')](_0xc6ae('0x10'),_0x3d446a,'request\x20sent');logger[_0xc6ae('0x11')](_0xc6ae('0x12'),_0x3d446a,_0xc6ae('0x13'),JSON[_0xc6ae('0x14')](_0x3cbee0));if(_0x3cbee0[_0xc6ae('0x15')]){if(_0x3cbee0['error'][_0xc6ae('0x16')]===0x1f4){logger[_0xc6ae('0x15')](_0xc6ae('0x10'),_0x3d446a,_0x3cbee0[_0xc6ae('0x15')][_0xc6ae('0x17')]);return _0x4af0ac(_0x3cbee0['error'][_0xc6ae('0x17')]);}logger[_0xc6ae('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x3d446a,_0x3cbee0[_0xc6ae('0x15')][_0xc6ae('0x17')]);return _0x4ac284(_0x3cbee0[_0xc6ae('0x15')][_0xc6ae('0x17')]);}else{logger[_0xc6ae('0xf')](_0xc6ae('0x10'),_0x3d446a,_0xc6ae('0x13'));_0x4ac284(_0x3cbee0[_0xc6ae('0x18')][_0xc6ae('0x17')]);}})[_0xc6ae('0x19')](function(_0x37d281){logger[_0xc6ae('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x3d446a,_0x37d281);_0x4af0ac(_0x37d281);});});}exports[_0xc6ae('0x1a')]=function(_0x47316f){var _0x2a50d3=this;return new Promise(function(_0x518679,_0x5d7417){return db[_0xc6ae('0x1b')][_0xc6ae('0x1c')]({'raw':_0x47316f[_0xc6ae('0x1d')]?_0x47316f[_0xc6ae('0x1d')][_0xc6ae('0x1e')]===undefined?!![]:![]:!![],'where':_0x47316f['options']?_0x47316f[_0xc6ae('0x1d')][_0xc6ae('0x1f')]||null:null,'attributes':_0x47316f[_0xc6ae('0x1d')]?_0x47316f[_0xc6ae('0x1d')][_0xc6ae('0x20')]||null:null,'include':_0x47316f[_0xc6ae('0x1d')]?_0x47316f[_0xc6ae('0x1d')][_0xc6ae('0x21')]?_[_0xc6ae('0x22')](_0x47316f[_0xc6ae('0x1d')]['include'],function(_0x288b00){return{'model':db[_0x288b00[_0xc6ae('0x23')]],'as':_0x288b00['as'],'attributes':_0x288b00['attributes'],'include':_0x288b00[_0xc6ae('0x21')]?_[_0xc6ae('0x22')](_0x288b00[_0xc6ae('0x21')],function(_0x325092){return{'model':db[_0x325092[_0xc6ae('0x23')]],'as':_0x325092['as'],'attributes':_0x325092[_0xc6ae('0x20')],'include':_0x325092['include']?_['map'](_0x325092[_0xc6ae('0x21')],function(_0x288324){return{'model':db[_0x288324[_0xc6ae('0x23')]],'as':_0x288324['as'],'attributes':_0x288324[_0xc6ae('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a0cbc){logger[_0xc6ae('0xf')](_0xc6ae('0x1a'),_0x47316f);logger['debug'](_0xc6ae('0x1a'),_0x47316f,JSON[_0xc6ae('0x14')](_0x3a0cbc));_0x518679(_0x3a0cbc);})[_0xc6ae('0x19')](function(_0xba7ca5){logger[_0xc6ae('0x15')](_0xc6ae('0x1a'),_0xba7ca5[_0xc6ae('0x17')],_0x47316f);_0x5d7417(_0x2a50d3['error'](0x1f4,_0xba7ca5[_0xc6ae('0x17')]));});});}; \ No newline at end of file +var _0xb0db=['rpc','../../config/environment','jayson/promise','client','http','socket.io-emitter','redis','./whatsappAccount.socket','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','model','include','map','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xb0db,0xa3));var _0xbb0d=function(_0x221680,_0xa42e09){_0x221680=_0x221680-0x0;var _0xa5fe1c=_0xb0db[_0x221680];return _0xa5fe1c;};'use strict';var _=require('lodash');var util=require(_0xbb0d('0x0'));var moment=require(_0xbb0d('0x1'));var BPromise=require(_0xbb0d('0x2'));var rs=require(_0xbb0d('0x3'));var fs=require('fs');var Redis=require(_0xbb0d('0x4'));var db=require(_0xbb0d('0x5'))['db'];var utils=require(_0xbb0d('0x6'));var logger=require('../../config/logger')(_0xbb0d('0x7'));var config=require(_0xbb0d('0x8'));var jayson=require(_0xbb0d('0x9'));var client=jayson[_0xbb0d('0xa')][_0xbb0d('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xbb0d('0xc'))(new Redis(config[_0xbb0d('0xd')]));require(_0xbb0d('0xe'))['register'](socket);function respondWithRpcPromise(_0x214dfd,_0x54ad65,_0x513c95){return new BPromise(function(_0x17d5ae,_0xcaebec){return client['request'](_0x214dfd,_0x513c95)[_0xbb0d('0xf')](function(_0x1d4603){logger[_0xbb0d('0x10')](_0xbb0d('0x11'),_0x54ad65,_0xbb0d('0x12'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x54ad65,'request\x20sent',JSON[_0xbb0d('0x13')](_0x1d4603));if(_0x1d4603['error']){if(_0x1d4603[_0xbb0d('0x14')]['code']===0x1f4){logger[_0xbb0d('0x14')]('WhatsappAccount,\x20%s,\x20%s',_0x54ad65,_0x1d4603['error'][_0xbb0d('0x15')]);return _0xcaebec(_0x1d4603[_0xbb0d('0x14')][_0xbb0d('0x15')]);}logger[_0xbb0d('0x14')](_0xbb0d('0x11'),_0x54ad65,_0x1d4603[_0xbb0d('0x14')][_0xbb0d('0x15')]);return _0x17d5ae(_0x1d4603[_0xbb0d('0x14')]['message']);}else{logger['info'](_0xbb0d('0x11'),_0x54ad65,_0xbb0d('0x12'));_0x17d5ae(_0x1d4603['result'][_0xbb0d('0x15')]);}})[_0xbb0d('0x16')](function(_0x9b463f){logger[_0xbb0d('0x14')]('WhatsappAccount,\x20%s,\x20%s',_0x54ad65,_0x9b463f);_0xcaebec(_0x9b463f);});});}exports[_0xbb0d('0x17')]=function(_0x389a74){var _0x9c13a=this;return new Promise(function(_0x337dd3,_0x270169){return db[_0xbb0d('0x18')][_0xbb0d('0x19')]({'raw':_0x389a74['options']?_0x389a74[_0xbb0d('0x1a')][_0xbb0d('0x1b')]===undefined?!![]:![]:!![],'where':_0x389a74['options']?_0x389a74[_0xbb0d('0x1a')][_0xbb0d('0x1c')]||null:null,'attributes':_0x389a74[_0xbb0d('0x1a')]?_0x389a74[_0xbb0d('0x1a')][_0xbb0d('0x1d')]||null:null,'include':_0x389a74[_0xbb0d('0x1a')]?_0x389a74['options']['include']?_['map'](_0x389a74[_0xbb0d('0x1a')]['include'],function(_0x593481){return{'model':db[_0x593481[_0xbb0d('0x1e')]],'as':_0x593481['as'],'attributes':_0x593481[_0xbb0d('0x1d')],'include':_0x593481[_0xbb0d('0x1f')]?_['map'](_0x593481[_0xbb0d('0x1f')],function(_0x5d9961){return{'model':db[_0x5d9961[_0xbb0d('0x1e')]],'as':_0x5d9961['as'],'attributes':_0x5d9961[_0xbb0d('0x1d')],'include':_0x5d9961[_0xbb0d('0x1f')]?_[_0xbb0d('0x20')](_0x5d9961[_0xbb0d('0x1f')],function(_0x2a2c65){return{'model':db[_0x2a2c65[_0xbb0d('0x1e')]],'as':_0x2a2c65['as'],'attributes':_0x2a2c65[_0xbb0d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xbb0d('0xf')](function(_0x2e3705){logger[_0xbb0d('0x10')](_0xbb0d('0x17'),_0x389a74);logger[_0xbb0d('0x21')](_0xbb0d('0x17'),_0x389a74,JSON['stringify'](_0x2e3705));_0x337dd3(_0x2e3705);})['catch'](function(_0x26593b){logger[_0xbb0d('0x14')](_0xbb0d('0x17'),_0x26593b['message'],_0x389a74);_0x270169(_0x9c13a['error'](0x1f4,_0x26593b[_0xbb0d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 1a3199a..86cf762 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 _0x4d9d=['length','whatsappAccount:','./whatsappAccount.events','save','remove','update','emit','register'];(function(_0x368467,_0x4f4c1e){var _0x1c8f4d=function(_0x2dcb6f){while(--_0x2dcb6f){_0x368467['push'](_0x368467['shift']());}};_0x1c8f4d(++_0x4f4c1e);}(_0x4d9d,0xfa));var _0xd4d9=function(_0x53a167,_0x4bf6c7){_0x53a167=_0x53a167-0x0;var _0x150263=_0x4d9d[_0x53a167];return _0x150263;};'use strict';var WhatsappAccountEvents=require(_0xd4d9('0x0'));var events=[_0xd4d9('0x1'),_0xd4d9('0x2'),_0xd4d9('0x3')];function createListener(_0x18571c,_0x404551){return function(_0x5f01c6){_0x404551[_0xd4d9('0x4')](_0x18571c,_0x5f01c6);};}function removeListener(_0x36ae79,_0x46a39d){return function(){WhatsappAccountEvents['removeListener'](_0x36ae79,_0x46a39d);};}exports[_0xd4d9('0x5')]=function(_0x5ac0f1){for(var _0x4b572b=0x0,_0x51347b=events[_0xd4d9('0x6')];_0x4b572b<_0x51347b;_0x4b572b++){var _0x5939ae=events[_0x4b572b];var _0x2b820c=createListener(_0xd4d9('0x7')+_0x5939ae,_0x5ac0f1);WhatsappAccountEvents['on'](_0x5939ae,_0x2b820c);}}; \ No newline at end of file +var _0xd83c=['update','emit','removeListener','register','whatsappAccount:','./whatsappAccount.events','save','remove'];(function(_0x325654,_0x4e6fe1){var _0x994fc7=function(_0x3a0d47){while(--_0x3a0d47){_0x325654['push'](_0x325654['shift']());}};_0x994fc7(++_0x4e6fe1);}(_0xd83c,0xed));var _0xcd83=function(_0x211087,_0x354fdd){_0x211087=_0x211087-0x0;var _0x2a581f=_0xd83c[_0x211087];return _0x2a581f;};'use strict';var WhatsappAccountEvents=require(_0xcd83('0x0'));var events=[_0xcd83('0x1'),_0xcd83('0x2'),_0xcd83('0x3')];function createListener(_0x574a51,_0x20e296){return function(_0x30349c){_0x20e296[_0xcd83('0x4')](_0x574a51,_0x30349c);};}function removeListener(_0x2539c9,_0x67f083){return function(){WhatsappAccountEvents[_0xcd83('0x5')](_0x2539c9,_0x67f083);};}exports[_0xcd83('0x6')]=function(_0x284880){for(var _0x51c94e=0x0,_0x5570f0=events['length'];_0x51c94e<_0x5570f0;_0x51c94e++){var _0x4bed08=events[_0x51c94e];var _0x2dd8f4=createListener(_0xcd83('0x7')+_0x4bed08,_0x284880);WhatsappAccountEvents['on'](_0x4bed08,_0x2dd8f4);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index f5a1bb4..5904725 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 _0xe7e4=['destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','create','update','delete'];(function(_0x39a6a0,_0x3534c5){var _0xc56e3d=function(_0x4fcbf9){while(--_0x4fcbf9){_0x39a6a0['push'](_0x39a6a0['shift']());}};_0xc56e3d(++_0x3534c5);}(_0xe7e4,0x1d6));var _0x4e7e=function(_0x57acbb,_0x129826){_0x57acbb=_0x57acbb-0x0;var _0x58ebe5=_0xe7e4[_0x57acbb];return _0x58ebe5;};'use strict';var multer=require('multer');var util=require(_0x4e7e('0x0'));var path=require(_0x4e7e('0x1'));var timeout=require(_0x4e7e('0x2'));var express=require(_0x4e7e('0x3'));var router=express[_0x4e7e('0x4')]();var auth=require(_0x4e7e('0x5'));var interaction=require(_0x4e7e('0x6'));var config=require(_0x4e7e('0x7'));var controller=require(_0x4e7e('0x8'));router[_0x4e7e('0x9')]('/',auth[_0x4e7e('0xa')](),controller[_0x4e7e('0xb')]);router['get'](_0x4e7e('0xc'),auth[_0x4e7e('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x4e7e('0xd')]);router['put'](_0x4e7e('0xc'),auth[_0x4e7e('0xa')](),controller[_0x4e7e('0xe')]);router[_0x4e7e('0xf')]('/:id',auth[_0x4e7e('0xa')](),controller[_0x4e7e('0x10')]);module[_0x4e7e('0x11')]=router; \ No newline at end of file +var _0xd9f8=['destroy','exports','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','post','create','delete'];(function(_0x401c21,_0x2e16d5){var _0x1a320e=function(_0x48065e){while(--_0x48065e){_0x401c21['push'](_0x401c21['shift']());}};_0x1a320e(++_0x2e16d5);}(_0xd9f8,0x92));var _0x8d9f=function(_0x42d193,_0x3607d7){_0x42d193=_0x42d193-0x0;var _0x25dc4e=_0xd9f8[_0x42d193];return _0x25dc4e;};'use strict';var multer=require(_0x8d9f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8d9f('0x1'));var express=require(_0x8d9f('0x2'));var router=express[_0x8d9f('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x8d9f('0x4'));var config=require(_0x8d9f('0x5'));var controller=require(_0x8d9f('0x6'));router[_0x8d9f('0x7')]('/',auth[_0x8d9f('0x8')](),controller[_0x8d9f('0x9')]);router[_0x8d9f('0x7')](_0x8d9f('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x8d9f('0xb')]('/',auth[_0x8d9f('0x8')](),controller[_0x8d9f('0xc')]);router['put'](_0x8d9f('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x8d9f('0xd')](_0x8d9f('0xa'),auth['isAuthenticated'](),controller[_0x8d9f('0xe')]);module[_0x8d9f('0xf')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 6d5e99a..854bd4f 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 _0x0a74=['STRING','noop','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x4b18ea,_0x2c070a){var _0x28ec1c=function(_0x251208){while(--_0x251208){_0x4b18ea['push'](_0x4b18ea['shift']());}};_0x28ec1c(++_0x2c070a);}(_0x0a74,0x195));var _0x40a7=function(_0x22ebae,_0x3e6eae){_0x22ebae=_0x22ebae-0x0;var _0x397803=_0x0a74[_0x22ebae];return _0x397803;};'use strict';var Sequelize=require(_0x40a7('0x0'));module[_0x40a7('0x1')]={'priority':{'type':Sequelize[_0x40a7('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x40a7('0x3')],'allowNull':![],'defaultValue':_0x40a7('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x40a7('0x3')],'defaultValue':_0x40a7('0x5')}}; \ No newline at end of file +var _0xadd1=['*,*,*,*','sequelize','INTEGER','STRING','noop'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xadd1,0x105));var _0x1add=function(_0x1ed912,_0x59cbf8){_0x1ed912=_0x1ed912-0x0;var _0x1c60ce=_0xadd1[_0x1ed912];return _0x1c60ce;};'use strict';var Sequelize=require(_0x1add('0x0'));module['exports']={'priority':{'type':Sequelize[_0x1add('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x1add('0x2')],'allowNull':![],'defaultValue':_0x1add('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x1add('0x2')]},'interval':{'type':Sequelize[_0x1add('0x2')],'defaultValue':_0x1add('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index eda6deb..7806f99 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 _0x3992=['options','find','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','set','apply','save','destroy','then','status','error','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys'];(function(_0x50975b,_0x1128a5){var _0x264ef5=function(_0x1992ca){while(--_0x1992ca){_0x50975b['push'](_0x50975b['shift']());}};_0x264ef5(++_0x1128a5);}(_0x3992,0x167));var _0x2399=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x3992[_0x4154a6];return _0x3b2786;};'use strict';var pdf=require(_0x2399('0x0'));var emlformat=require(_0x2399('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2399('0x2'));var jsonpatch=require(_0x2399('0x3'));var rp=require('request-promise');var moment=require(_0x2399('0x4'));var BPromise=require(_0x2399('0x5'));var Mustache=require(_0x2399('0x6'));var util=require('util');var path=require(_0x2399('0x7'));var sox=require('sox');var csv=require(_0x2399('0x8'));var ejs=require(_0x2399('0x9'));var fs=require('fs');var _=require(_0x2399('0xa'));var squel=require(_0x2399('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2399('0xc'));var toCsv=require(_0x2399('0x8'));var querystring=require(_0x2399('0xd'));var Papa=require(_0x2399('0xe'));var Redis=require(_0x2399('0xf'));var authService=require(_0x2399('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2399('0x11'));var utils=require(_0x2399('0x12'));var config=require(_0x2399('0x13'));var db=require(_0x2399('0x14'))['db'];function respondWithStatusCode(_0x5670be,_0x3d6ed8){_0x3d6ed8=_0x3d6ed8||0xcc;return function(_0x119dda){if(_0x119dda){return _0x5670be[_0x2399('0x15')](_0x3d6ed8);}return _0x5670be['status'](_0x3d6ed8)[_0x2399('0x16')]();};}function respondWithResult(_0x1d057e,_0x567030){_0x567030=_0x567030||0xc8;return function(_0x209f26){if(_0x209f26){return _0x1d057e['status'](_0x567030)[_0x2399('0x17')](_0x209f26);}};}function respondWithFilteredResult(_0x27fcf8,_0x1783bd){return function(_0x55e7f7){if(_0x55e7f7){var _0x50e068=_0x55e7f7[_0x2399('0x18')],_0x233d75=_0x1783bd[_0x2399('0x19')],_0x111359=_0x1783bd['offset']+_0x1783bd[_0x2399('0x1a')],_0x402a0d;if(_0x111359>=_0x50e068){_0x111359=_0x50e068;_0x402a0d=0xc8;}else{_0x402a0d=0xce;}_0x27fcf8['status'](_0x402a0d);return _0x27fcf8[_0x2399('0x1b')]('Content-Range',_0x233d75+'-'+_0x111359+'/'+_0x50e068)[_0x2399('0x17')](_0x55e7f7);}return null;};}function patchUpdates(_0x5e67f4){return function(_0x389336){try{jsonpatch[_0x2399('0x1c')](_0x389336,_0x5e67f4,!![]);}catch(_0x2ea17e){return BPromise['reject'](_0x2ea17e);}return _0x389336[_0x2399('0x1d')]();};}function saveUpdates(_0x5310f5,_0x188c28){return function(_0x44a1bc){if(_0x44a1bc){return _0x44a1bc['update'](_0x5310f5)['then'](function(_0x475a30){return _0x475a30;});}return null;};}function removeEntity(_0x585c17,_0x2178cf){return function(_0x597bd7){if(_0x597bd7){return _0x597bd7[_0x2399('0x1e')]()[_0x2399('0x1f')](function(){_0x585c17[_0x2399('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39ad2f,_0x9fd360){return function(_0x44bcc0){if(!_0x44bcc0){_0x39ad2f[_0x2399('0x15')](0x194);}return _0x44bcc0;};}function handleError(_0x5266ff,_0x10da7d){_0x10da7d=_0x10da7d||0x1f4;return function(_0x125ef4){logger[_0x2399('0x21')](_0x125ef4['stack']);if(_0x125ef4[_0x2399('0x22')]){delete _0x125ef4[_0x2399('0x22')];}_0x5266ff[_0x2399('0x20')](_0x10da7d)[_0x2399('0x23')](_0x125ef4);};}exports[_0x2399('0x24')]=function(_0x2d0162,_0x49f600){var _0x177258={},_0x26dc9b={},_0x33c92c={'count':0x0,'rows':[]};var _0x268726=_[_0x2399('0x25')](db[_0x2399('0x26')][_0x2399('0x27')],function(_0x259100){return{'name':_0x259100[_0x2399('0x28')],'type':_0x259100[_0x2399('0x29')][_0x2399('0x2a')]};});_0x26dc9b[_0x2399('0x2b')]=_[_0x2399('0x25')](_0x268726,_0x2399('0x22'));_0x26dc9b[_0x2399('0x2c')]=_['keys'](_0x2d0162['query']);_0x26dc9b[_0x2399('0x2d')]=_[_0x2399('0x2e')](_0x26dc9b[_0x2399('0x2b')],_0x26dc9b['query']);_0x177258[_0x2399('0x2f')]=_['intersection'](_0x26dc9b[_0x2399('0x2b')],qs['fields'](_0x2d0162[_0x2399('0x2c')][_0x2399('0x30')]));_0x177258[_0x2399('0x2f')]=_0x177258[_0x2399('0x2f')][_0x2399('0x31')]?_0x177258[_0x2399('0x2f')]:_0x26dc9b[_0x2399('0x2b')];if(!_0x2d0162[_0x2399('0x2c')][_0x2399('0x32')](_0x2399('0x33'))){_0x177258[_0x2399('0x1a')]=qs[_0x2399('0x1a')](_0x2d0162['query'][_0x2399('0x1a')]);_0x177258[_0x2399('0x19')]=qs[_0x2399('0x19')](_0x2d0162[_0x2399('0x2c')][_0x2399('0x19')]);}_0x177258[_0x2399('0x34')]=qs['sort'](_0x2d0162[_0x2399('0x2c')][_0x2399('0x35')]);_0x177258[_0x2399('0x36')]=qs[_0x2399('0x2d')](_[_0x2399('0x37')](_0x2d0162[_0x2399('0x2c')],_0x26dc9b['filters']),_0x268726);if(_0x2d0162[_0x2399('0x2c')]['filter']){_0x177258[_0x2399('0x36')]=_['merge'](_0x177258[_0x2399('0x36')],{'$or':_[_0x2399('0x25')](_0x268726,function(_0x464c53){if(_0x464c53['type']!==_0x2399('0x38')){var _0x550c3a={};_0x550c3a[_0x464c53[_0x2399('0x22')]]={'$like':'%'+_0x2d0162[_0x2399('0x2c')][_0x2399('0x39')]+'%'};return _0x550c3a;}})});}_0x177258=_[_0x2399('0x3a')]({},_0x177258,_0x2d0162['options']);var _0xb758f1={'where':_0x177258[_0x2399('0x36')]};return db['WhatsappApplication'][_0x2399('0x18')](_0xb758f1)[_0x2399('0x1f')](function(_0x25a726){_0x33c92c[_0x2399('0x18')]=_0x25a726;if(_0x2d0162[_0x2399('0x2c')][_0x2399('0x3b')]){_0x177258[_0x2399('0x3c')]=[{'all':!![]}];}return db['WhatsappApplication'][_0x2399('0x3d')](_0x177258);})['then'](function(_0x63471f){_0x33c92c[_0x2399('0x3e')]=_0x63471f;return _0x33c92c;})[_0x2399('0x1f')](respondWithFilteredResult(_0x49f600,_0x177258))[_0x2399('0x3f')](handleError(_0x49f600,null));};exports[_0x2399('0x40')]=function(_0x17abf7,_0x411d68){var _0x2c9e1f={'raw':!![],'where':{'id':_0x17abf7[_0x2399('0x41')]['id']}},_0x3493c4={};_0x3493c4[_0x2399('0x2b')]=_[_0x2399('0x42')](db[_0x2399('0x26')][_0x2399('0x27')]);_0x3493c4[_0x2399('0x2c')]=_[_0x2399('0x42')](_0x17abf7[_0x2399('0x2c')]);_0x3493c4[_0x2399('0x2d')]=_[_0x2399('0x2e')](_0x3493c4[_0x2399('0x2b')],_0x3493c4['query']);_0x2c9e1f['attributes']=_[_0x2399('0x2e')](_0x3493c4[_0x2399('0x2b')],qs['fields'](_0x17abf7[_0x2399('0x2c')]['fields']));_0x2c9e1f[_0x2399('0x2f')]=_0x2c9e1f['attributes'][_0x2399('0x31')]?_0x2c9e1f[_0x2399('0x2f')]:_0x3493c4[_0x2399('0x2b')];if(_0x17abf7[_0x2399('0x2c')][_0x2399('0x3b')]){_0x2c9e1f['include']=[{'all':!![]}];}_0x2c9e1f=_[_0x2399('0x3a')]({},_0x2c9e1f,_0x17abf7[_0x2399('0x43')]);return db[_0x2399('0x26')][_0x2399('0x44')](_0x2c9e1f)[_0x2399('0x1f')](handleEntityNotFound(_0x411d68,null))[_0x2399('0x1f')](respondWithResult(_0x411d68,null))[_0x2399('0x3f')](handleError(_0x411d68,null));};exports[_0x2399('0x45')]=function(_0x26279c,_0x2dbb37){return db[_0x2399('0x26')][_0x2399('0x45')](_0x26279c['body'],{})[_0x2399('0x1f')](respondWithResult(_0x2dbb37,0xc9))[_0x2399('0x3f')](handleError(_0x2dbb37,null));};exports['update']=function(_0x3da2d1,_0x575656){if(_0x3da2d1[_0x2399('0x46')]['id']){delete _0x3da2d1[_0x2399('0x46')]['id'];}return db[_0x2399('0x26')]['find']({'where':{'id':_0x3da2d1['params']['id']}})[_0x2399('0x1f')](handleEntityNotFound(_0x575656,null))[_0x2399('0x1f')](saveUpdates(_0x3da2d1['body'],null))[_0x2399('0x1f')](respondWithResult(_0x575656,null))[_0x2399('0x3f')](handleError(_0x575656,null));};exports['destroy']=function(_0x39ac3a,_0x1bbc65){return db['WhatsappApplication'][_0x2399('0x44')]({'where':{'id':_0x39ac3a[_0x2399('0x41')]['id']}})[_0x2399('0x1f')](handleEntityNotFound(_0x1bbc65,null))[_0x2399('0x1f')](removeEntity(_0x1bbc65,null))[_0x2399('0x3f')](handleError(_0x1bbc65,null));}; \ No newline at end of file +var _0xc031=['end','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','error','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','update','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status'];(function(_0x1222a0,_0x243516){var _0x55b3c9=function(_0x3f84d6){while(--_0x3f84d6){_0x1222a0['push'](_0x1222a0['shift']());}};_0x55b3c9(++_0x243516);}(_0xc031,0x114));var _0x1c03=function(_0x4f74a5,_0x1fd979){_0x4f74a5=_0x4f74a5-0x0;var _0x5be8b2=_0xc031[_0x4f74a5];return _0x5be8b2;};'use strict';var pdf=require(_0x1c03('0x0'));var emlformat=require(_0x1c03('0x1'));var rimraf=require(_0x1c03('0x2'));var zipdir=require(_0x1c03('0x3'));var jsonpatch=require(_0x1c03('0x4'));var rp=require(_0x1c03('0x5'));var moment=require(_0x1c03('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x1c03('0x7'));var util=require(_0x1c03('0x8'));var path=require(_0x1c03('0x9'));var sox=require(_0x1c03('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x1c03('0xb'));var squel=require('squel');var crypto=require(_0x1c03('0xc'));var jsforce=require(_0x1c03('0xd'));var deskjs=require(_0x1c03('0xe'));var toCsv=require(_0x1c03('0xf'));var querystring=require(_0x1c03('0x10'));var Papa=require(_0x1c03('0x11'));var Redis=require(_0x1c03('0x12'));var authService=require(_0x1c03('0x13'));var qs=require(_0x1c03('0x14'));var as=require(_0x1c03('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1c03('0x16'))(_0x1c03('0x17'));var utils=require(_0x1c03('0x18'));var config=require(_0x1c03('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15da89,_0x443ec6){_0x443ec6=_0x443ec6||0xcc;return function(_0x4e6246){if(_0x4e6246){return _0x15da89[_0x1c03('0x1a')](_0x443ec6);}return _0x15da89[_0x1c03('0x1b')](_0x443ec6)[_0x1c03('0x1c')]();};}function respondWithResult(_0x1a1c74,_0x16a8e8){_0x16a8e8=_0x16a8e8||0xc8;return function(_0x431673){if(_0x431673){return _0x1a1c74[_0x1c03('0x1b')](_0x16a8e8)[_0x1c03('0x1d')](_0x431673);}};}function respondWithFilteredResult(_0x19001b,_0x4414d8){return function(_0x5bed30){if(_0x5bed30){var _0xa9e9d7=_0x5bed30[_0x1c03('0x1e')],_0x346ff1=_0x4414d8[_0x1c03('0x1f')],_0x530504=_0x4414d8[_0x1c03('0x1f')]+_0x4414d8[_0x1c03('0x20')],_0x56beb9;if(_0x530504>=_0xa9e9d7){_0x530504=_0xa9e9d7;_0x56beb9=0xc8;}else{_0x56beb9=0xce;}_0x19001b[_0x1c03('0x1b')](_0x56beb9);return _0x19001b[_0x1c03('0x21')](_0x1c03('0x22'),_0x346ff1+'-'+_0x530504+'/'+_0xa9e9d7)[_0x1c03('0x1d')](_0x5bed30);}return null;};}function patchUpdates(_0x29e5c5){return function(_0x485e67){try{jsonpatch[_0x1c03('0x23')](_0x485e67,_0x29e5c5,!![]);}catch(_0x3fc22f){return BPromise[_0x1c03('0x24')](_0x3fc22f);}return _0x485e67['save']();};}function saveUpdates(_0xa17878,_0x40da69){return function(_0xa336fa){if(_0xa336fa){return _0xa336fa['update'](_0xa17878)[_0x1c03('0x25')](function(_0x31a3e1){return _0x31a3e1;});}return null;};}function removeEntity(_0x5caa63,_0x4c4282){return function(_0x22b6ad){if(_0x22b6ad){return _0x22b6ad[_0x1c03('0x26')]()[_0x1c03('0x25')](function(){_0x5caa63['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a8477,_0x466d86){return function(_0x55ebf){if(!_0x55ebf){_0x1a8477['sendStatus'](0x194);}return _0x55ebf;};}function handleError(_0x400eea,_0x351ea1){_0x351ea1=_0x351ea1||0x1f4;return function(_0x417410){logger[_0x1c03('0x27')](_0x417410['stack']);if(_0x417410['name']){delete _0x417410[_0x1c03('0x28')];}_0x400eea[_0x1c03('0x1b')](_0x351ea1)[_0x1c03('0x29')](_0x417410);};}exports[_0x1c03('0x2a')]=function(_0x15b276,_0x3628bd){var _0x20deee={},_0x3a75fb={},_0x3c3a44={'count':0x0,'rows':[]};var _0x450ce1=_[_0x1c03('0x2b')](db[_0x1c03('0x2c')][_0x1c03('0x2d')],function(_0x3ba6cf){return{'name':_0x3ba6cf[_0x1c03('0x2e')],'type':_0x3ba6cf['type'][_0x1c03('0x2f')]};});_0x3a75fb[_0x1c03('0x30')]=_['map'](_0x450ce1,_0x1c03('0x28'));_0x3a75fb[_0x1c03('0x31')]=_[_0x1c03('0x32')](_0x15b276[_0x1c03('0x31')]);_0x3a75fb['filters']=_[_0x1c03('0x33')](_0x3a75fb[_0x1c03('0x30')],_0x3a75fb[_0x1c03('0x31')]);_0x20deee['attributes']=_['intersection'](_0x3a75fb['model'],qs[_0x1c03('0x34')](_0x15b276['query'][_0x1c03('0x34')]));_0x20deee['attributes']=_0x20deee['attributes']['length']?_0x20deee[_0x1c03('0x35')]:_0x3a75fb['model'];if(!_0x15b276[_0x1c03('0x31')][_0x1c03('0x36')](_0x1c03('0x37'))){_0x20deee[_0x1c03('0x20')]=qs['limit'](_0x15b276[_0x1c03('0x31')][_0x1c03('0x20')]);_0x20deee[_0x1c03('0x1f')]=qs['offset'](_0x15b276['query'][_0x1c03('0x1f')]);}_0x20deee[_0x1c03('0x38')]=qs['sort'](_0x15b276['query']['sort']);_0x20deee[_0x1c03('0x39')]=qs[_0x1c03('0x3a')](_['pick'](_0x15b276['query'],_0x3a75fb[_0x1c03('0x3a')]),_0x450ce1);if(_0x15b276['query'][_0x1c03('0x3b')]){_0x20deee['where']=_[_0x1c03('0x3c')](_0x20deee[_0x1c03('0x39')],{'$or':_[_0x1c03('0x2b')](_0x450ce1,function(_0x416a0b){if(_0x416a0b[_0x1c03('0x3d')]!==_0x1c03('0x3e')){var _0x50c7a9={};_0x50c7a9[_0x416a0b[_0x1c03('0x28')]]={'$like':'%'+_0x15b276[_0x1c03('0x31')][_0x1c03('0x3b')]+'%'};return _0x50c7a9;}})});}_0x20deee=_['merge']({},_0x20deee,_0x15b276[_0x1c03('0x3f')]);var _0x107869={'where':_0x20deee[_0x1c03('0x39')]};return db[_0x1c03('0x2c')][_0x1c03('0x1e')](_0x107869)['then'](function(_0x4d7b19){_0x3c3a44[_0x1c03('0x1e')]=_0x4d7b19;if(_0x15b276[_0x1c03('0x31')][_0x1c03('0x40')]){_0x20deee[_0x1c03('0x41')]=[{'all':!![]}];}return db[_0x1c03('0x2c')][_0x1c03('0x42')](_0x20deee);})[_0x1c03('0x25')](function(_0xc412c4){_0x3c3a44[_0x1c03('0x43')]=_0xc412c4;return _0x3c3a44;})[_0x1c03('0x25')](respondWithFilteredResult(_0x3628bd,_0x20deee))[_0x1c03('0x44')](handleError(_0x3628bd,null));};exports[_0x1c03('0x45')]=function(_0x143346,_0x407e01){var _0x96d9d1={'raw':!![],'where':{'id':_0x143346[_0x1c03('0x46')]['id']}},_0x45ee35={};_0x45ee35[_0x1c03('0x30')]=_[_0x1c03('0x32')](db['WhatsappApplication']['rawAttributes']);_0x45ee35[_0x1c03('0x31')]=_[_0x1c03('0x32')](_0x143346[_0x1c03('0x31')]);_0x45ee35[_0x1c03('0x3a')]=_[_0x1c03('0x33')](_0x45ee35[_0x1c03('0x30')],_0x45ee35[_0x1c03('0x31')]);_0x96d9d1[_0x1c03('0x35')]=_[_0x1c03('0x33')](_0x45ee35[_0x1c03('0x30')],qs['fields'](_0x143346[_0x1c03('0x31')][_0x1c03('0x34')]));_0x96d9d1[_0x1c03('0x35')]=_0x96d9d1[_0x1c03('0x35')][_0x1c03('0x47')]?_0x96d9d1[_0x1c03('0x35')]:_0x45ee35[_0x1c03('0x30')];if(_0x143346[_0x1c03('0x31')][_0x1c03('0x40')]){_0x96d9d1[_0x1c03('0x41')]=[{'all':!![]}];}_0x96d9d1=_[_0x1c03('0x3c')]({},_0x96d9d1,_0x143346['options']);return db[_0x1c03('0x2c')]['find'](_0x96d9d1)['then'](handleEntityNotFound(_0x407e01,null))[_0x1c03('0x25')](respondWithResult(_0x407e01,null))['catch'](handleError(_0x407e01,null));};exports['create']=function(_0x33d278,_0x5759cc){return db['WhatsappApplication'][_0x1c03('0x48')](_0x33d278[_0x1c03('0x49')],{})[_0x1c03('0x25')](respondWithResult(_0x5759cc,0xc9))[_0x1c03('0x44')](handleError(_0x5759cc,null));};exports[_0x1c03('0x4a')]=function(_0x1d4e49,_0x2a3d0a){if(_0x1d4e49[_0x1c03('0x49')]['id']){delete _0x1d4e49[_0x1c03('0x49')]['id'];}return db[_0x1c03('0x2c')][_0x1c03('0x4b')]({'where':{'id':_0x1d4e49[_0x1c03('0x46')]['id']}})[_0x1c03('0x25')](handleEntityNotFound(_0x2a3d0a,null))[_0x1c03('0x25')](saveUpdates(_0x1d4e49['body'],null))[_0x1c03('0x25')](respondWithResult(_0x2a3d0a,null))[_0x1c03('0x44')](handleError(_0x2a3d0a,null));};exports[_0x1c03('0x26')]=function(_0x1bcb18,_0x540d2f){return db[_0x1c03('0x2c')]['find']({'where':{'id':_0x1bcb18['params']['id']}})[_0x1c03('0x25')](handleEntityNotFound(_0x540d2f,null))[_0x1c03('0x25')](removeEntity(_0x540d2f,null))[_0x1c03('0x44')](handleError(_0x540d2f,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 7de46d2..fb09880 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 _0x7b81=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','./whatsappApplication.attributes','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x1679cc,_0x242c53){var _0x4aaec8=function(_0x303c5f){while(--_0x303c5f){_0x1679cc['push'](_0x1679cc['shift']());}};_0x4aaec8(++_0x242c53);}(_0x7b81,0x8c));var _0x17b8=function(_0x18ff35,_0x3307c){_0x18ff35=_0x18ff35-0x0;var _0x1355fe=_0x7b81[_0x18ff35];return _0x1355fe;};'use strict';var _=require(_0x17b8('0x0'));var util=require(_0x17b8('0x1'));var logger=require('../../config/logger')(_0x17b8('0x2'));var moment=require(_0x17b8('0x3'));var BPromise=require(_0x17b8('0x4'));var rp=require(_0x17b8('0x5'));var fs=require('fs');var path=require(_0x17b8('0x6'));var rimraf=require(_0x17b8('0x7'));var config=require('../../config/environment');var attributes=require(_0x17b8('0x8'));module['exports']=function(_0x4eab54,_0xaf2fff){return _0x4eab54[_0x17b8('0x9')](_0x17b8('0xa'),attributes,{'tableName':_0x17b8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x17b8('0xc'),'collate':_0x17b8('0xd')});}; \ No newline at end of file +var _0x4184=['WhatsappApplication','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','rimraf','../../config/environment','./whatsappApplication.attributes','define'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0x4184,0x1e7));var _0x4418=function(_0x1ec022,_0x2cf53e){_0x1ec022=_0x1ec022-0x0;var _0x12bd2a=_0x4184[_0x1ec022];return _0x12bd2a;};'use strict';var _=require(_0x4418('0x0'));var util=require('util');var logger=require(_0x4418('0x1'))(_0x4418('0x2'));var moment=require(_0x4418('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4418('0x4'));var config=require(_0x4418('0x5'));var attributes=require(_0x4418('0x6'));module['exports']=function(_0x458304,_0x41526e){return _0x458304[_0x4418('0x7')](_0x4418('0x8'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4418('0x9'),'collate':_0x4418('0xa')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 293e947..b60a7f5 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 _0x6379=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x4629cc,_0x29ecf8){var _0x4297f5=function(_0x4f49d8){while(--_0x4f49d8){_0x4629cc['push'](_0x4629cc['shift']());}};_0x4297f5(++_0x29ecf8);}(_0x6379,0x84));var _0x9637=function(_0x432514,_0x3f7a3a){_0x432514=_0x432514-0x0;var _0x3b781b=_0x6379[_0x432514];return _0x3b781b;};'use strict';var _=require(_0x9637('0x0'));var util=require(_0x9637('0x1'));var moment=require(_0x9637('0x2'));var BPromise=require(_0x9637('0x3'));var rs=require(_0x9637('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9637('0x5'))['db'];var utils=require(_0x9637('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x9637('0x7'));var jayson=require(_0x9637('0x8'));var client=jayson[_0x9637('0x9')][_0x9637('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf0db9f,_0x5ce1a4,_0x515a84){return new BPromise(function(_0x21d91b,_0x42eda1){return client[_0x9637('0xb')](_0xf0db9f,_0x515a84)[_0x9637('0xc')](function(_0x5e66ee){logger[_0x9637('0xd')](_0x9637('0xe'),_0x5ce1a4,_0x9637('0xf'));logger[_0x9637('0x10')](_0x9637('0x11'),_0x5ce1a4,_0x9637('0xf'),JSON[_0x9637('0x12')](_0x5e66ee));if(_0x5e66ee[_0x9637('0x13')]){if(_0x5e66ee[_0x9637('0x13')]['code']===0x1f4){logger[_0x9637('0x13')]('WhatsappApplication,\x20%s,\x20%s',_0x5ce1a4,_0x5e66ee[_0x9637('0x13')][_0x9637('0x14')]);return _0x42eda1(_0x5e66ee['error'][_0x9637('0x14')]);}logger[_0x9637('0x13')](_0x9637('0xe'),_0x5ce1a4,_0x5e66ee[_0x9637('0x13')]['message']);return _0x21d91b(_0x5e66ee[_0x9637('0x13')][_0x9637('0x14')]);}else{logger[_0x9637('0xd')](_0x9637('0xe'),_0x5ce1a4,_0x9637('0xf'));_0x21d91b(_0x5e66ee['result'][_0x9637('0x14')]);}})[_0x9637('0x15')](function(_0x1eb774){logger[_0x9637('0x13')](_0x9637('0xe'),_0x5ce1a4,_0x1eb774);_0x42eda1(_0x1eb774);});});} \ No newline at end of file +var _0x5ff9=['debug','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','http','then','WhatsappApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x1c7f0d,_0x27ce58){var _0x2b1781=function(_0x321a5a){while(--_0x321a5a){_0x1c7f0d['push'](_0x1c7f0d['shift']());}};_0x2b1781(++_0x27ce58);}(_0x5ff9,0xa0));var _0x95ff=function(_0x3ed22c,_0x222ecb){_0x3ed22c=_0x3ed22c-0x0;var _0x456c3f=_0x5ff9[_0x3ed22c];return _0x456c3f;};'use strict';var _=require(_0x95ff('0x0'));var util=require(_0x95ff('0x1'));var moment=require('moment');var BPromise=require(_0x95ff('0x2'));var rs=require(_0x95ff('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x95ff('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x95ff('0x5'));var jayson=require(_0x95ff('0x6'));var client=jayson['client'][_0x95ff('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4fd45b,_0x34ace2,_0x384657){return new BPromise(function(_0x491610,_0x2fb3f5){return client['request'](_0x4fd45b,_0x384657)[_0x95ff('0x8')](function(_0x300166){logger['info'](_0x95ff('0x9'),_0x34ace2,_0x95ff('0xa'));logger[_0x95ff('0xb')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x34ace2,_0x95ff('0xa'),JSON[_0x95ff('0xc')](_0x300166));if(_0x300166[_0x95ff('0xd')]){if(_0x300166[_0x95ff('0xd')][_0x95ff('0xe')]===0x1f4){logger[_0x95ff('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x34ace2,_0x300166['error'][_0x95ff('0xf')]);return _0x2fb3f5(_0x300166[_0x95ff('0xd')][_0x95ff('0xf')]);}logger[_0x95ff('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x34ace2,_0x300166[_0x95ff('0xd')][_0x95ff('0xf')]);return _0x491610(_0x300166['error'][_0x95ff('0xf')]);}else{logger[_0x95ff('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x34ace2,'request\x20sent');_0x491610(_0x300166[_0x95ff('0x11')][_0x95ff('0xf')]);}})[_0x95ff('0x12')](function(_0x5d5350){logger[_0x95ff('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x34ace2,_0x5d5350);_0x2fb3f5(_0x5d5350);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index a2d8375..e2c0a24 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 _0x21de=['connect-timeout','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/messages','getMessages','download','post','addMessage','/:id/tags','tracked','whatsapp','addTags','put','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','util','path'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x21de,0x103));var _0xe21d=function(_0x1a9a72,_0x3724d3){_0x1a9a72=_0x1a9a72-0x0;var _0x384c5b=_0x21de[_0x1a9a72];return _0x384c5b;};'use strict';var multer=require('multer');var util=require(_0xe21d('0x0'));var path=require(_0xe21d('0x1'));var timeout=require(_0xe21d('0x2'));var express=require(_0xe21d('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xe21d('0x4'));var config=require(_0xe21d('0x5'));var controller=require('./whatsappInteraction.controller');router[_0xe21d('0x6')]('/',auth[_0xe21d('0x7')](),controller[_0xe21d('0x8')]);router[_0xe21d('0x6')]('/describe',auth[_0xe21d('0x7')](),controller[_0xe21d('0x9')]);router[_0xe21d('0x6')](_0xe21d('0xa'),auth[_0xe21d('0x7')](),controller[_0xe21d('0xb')]);router[_0xe21d('0x6')](_0xe21d('0xc'),auth[_0xe21d('0x7')](),controller[_0xe21d('0xd')]);router[_0xe21d('0x6')]('/:id/download',auth[_0xe21d('0x7')](),controller[_0xe21d('0xe')]);router[_0xe21d('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe21d('0xf')]('/:id/messages',auth['isAuthenticated'](),controller[_0xe21d('0x10')]);router[_0xe21d('0xf')](_0xe21d('0x11'),auth[_0xe21d('0x7')](),interaction[_0xe21d('0x12')](_0xe21d('0x13'),'whatsappinteraction:addtags'),controller[_0xe21d('0x14')]);router[_0xe21d('0x15')](_0xe21d('0xa'),auth[_0xe21d('0x7')](),interaction[_0xe21d('0x12')](_0xe21d('0x13'),_0xe21d('0x16')),controller[_0xe21d('0x17')]);router[_0xe21d('0x18')](_0xe21d('0xa'),auth[_0xe21d('0x7')](),interaction['tracked'](_0xe21d('0x13'),_0xe21d('0x19')),controller[_0xe21d('0x1a')]);router['delete']('/:id/tags',auth[_0xe21d('0x7')](),controller[_0xe21d('0x1b')]);module[_0xe21d('0x1c')]=router; \ No newline at end of file +var _0xcc56=['./whatsappInteraction.controller','get','index','isAuthenticated','describe','show','/:id/messages','/:id/download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','/:id','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4e5752,_0x6ca923){var _0x82582b=function(_0x4cf7c3){while(--_0x4cf7c3){_0x4e5752['push'](_0x4e5752['shift']());}};_0x82582b(++_0x6ca923);}(_0xcc56,0x76));var _0x6cc5=function(_0x175401,_0x281048){_0x175401=_0x175401-0x0;var _0x4d7689=_0xcc56[_0x175401];return _0x4d7689;};'use strict';var multer=require('multer');var util=require(_0x6cc5('0x0'));var path=require('path');var timeout=require(_0x6cc5('0x1'));var express=require(_0x6cc5('0x2'));var router=express['Router']();var auth=require(_0x6cc5('0x3'));var interaction=require(_0x6cc5('0x4'));var config=require(_0x6cc5('0x5'));var controller=require(_0x6cc5('0x6'));router[_0x6cc5('0x7')]('/',auth['isAuthenticated'](),controller[_0x6cc5('0x8')]);router[_0x6cc5('0x7')]('/describe',auth[_0x6cc5('0x9')](),controller[_0x6cc5('0xa')]);router[_0x6cc5('0x7')]('/:id',auth[_0x6cc5('0x9')](),controller[_0x6cc5('0xb')]);router[_0x6cc5('0x7')](_0x6cc5('0xc'),auth[_0x6cc5('0x9')](),controller['getMessages']);router[_0x6cc5('0x7')](_0x6cc5('0xd'),auth[_0x6cc5('0x9')](),controller['download']);router[_0x6cc5('0xe')]('/',auth[_0x6cc5('0x9')](),controller[_0x6cc5('0xf')]);router[_0x6cc5('0xe')]('/:id/messages',auth[_0x6cc5('0x9')](),controller[_0x6cc5('0x10')]);router['post'](_0x6cc5('0x11'),auth[_0x6cc5('0x9')](),interaction[_0x6cc5('0x12')](_0x6cc5('0x13'),_0x6cc5('0x14')),controller[_0x6cc5('0x15')]);router[_0x6cc5('0x16')](_0x6cc5('0x17'),auth[_0x6cc5('0x9')](),interaction[_0x6cc5('0x12')](_0x6cc5('0x13'),_0x6cc5('0x18')),controller[_0x6cc5('0x19')]);router[_0x6cc5('0x1a')](_0x6cc5('0x17'),auth[_0x6cc5('0x9')](),interaction['tracked'](_0x6cc5('0x13'),_0x6cc5('0x1b')),controller[_0x6cc5('0x1c')]);router[_0x6cc5('0x1a')]('/:id/tags',auth[_0x6cc5('0x9')](),controller[_0x6cc5('0x1d')]);module[_0x6cc5('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index e98fc3e..6293644 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 _0x2bf8=['DATE','ENUM','out','moment','BOOLEAN','STRING'];(function(_0x491468,_0x42f169){var _0x5b8c22=function(_0x407a9b){while(--_0x407a9b){_0x491468['push'](_0x491468['shift']());}};_0x5b8c22(++_0x42f169);}(_0x2bf8,0xbd));var _0x82bf=function(_0x165f14,_0x37c6c1){_0x165f14=_0x165f14-0x0;var _0x217195=_0x2bf8[_0x165f14];return _0x217195;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x82bf('0x0'));module['exports']={'closed':{'type':Sequelize[_0x82bf('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x82bf('0x2')]},'note':{'type':Sequelize[_0x82bf('0x2')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x82bf('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x82bf('0x4')]('in',_0x82bf('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x82bf('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x82bf('0x4')]('in',_0x82bf('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x85a2=['ENUM','sequelize','moment','exports','BOOLEAN','DATE','STRING','out'];(function(_0x5da479,_0x26d96e){var _0x2e6b71=function(_0x175676){while(--_0x175676){_0x5da479['push'](_0x5da479['shift']());}};_0x2e6b71(++_0x26d96e);}(_0x85a2,0x139));var _0x285a=function(_0x129caf,_0x59ac07){_0x129caf=_0x129caf-0x0;var _0x3a5106=_0x85a2[_0x129caf];return _0x3a5106;};'use strict';var Sequelize=require(_0x285a('0x0'));var moment=require(_0x285a('0x1'));module[_0x285a('0x2')]={'closed':{'type':Sequelize[_0x285a('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x285a('0x4')]},'disposition':{'type':Sequelize[_0x285a('0x5')]},'note':{'type':Sequelize[_0x285a('0x5')]},'phone':{'type':Sequelize[_0x285a('0x5')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x285a('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x285a('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x285a('0x7')]('in','out'),'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 b29b8d9..9b878bb 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(_0x23e2cb,_0x4ef4fc){var _0x8db1ae=function(_0x5a512c){while(--_0x5a512c){_0x23e2cb['push'](_0x23e2cb['shift']());}};_0x8db1ae(++_0x4ef4fc);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xc4aa[_0x4d613c];return _0x301fe3;};'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 _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(_0x446648,_0x3d0a08){var _0x4da5d6=function(_0x5db0fe){while(--_0x5db0fe){_0x446648['push'](_0x446648['shift']());}};_0x4da5d6(++_0x3d0a08);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xc4aa[_0x5d6456];return _0x4d66c1;};'use strict';var pdf=require(_0xac4a('0x0'));var emlformat=require(_0xac4a('0x1'));var rimraf=require(_0xac4a('0x2'));var zipdir=require(_0xac4a('0x3'));var jsonpatch=require(_0xac4a('0x4'));var rp=require(_0xac4a('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xac4a('0x6'));var path=require(_0xac4a('0x7'));var sox=require(_0xac4a('0x8'));var csv=require(_0xac4a('0x9'));var ejs=require(_0xac4a('0xa'));var fs=require('fs');var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x9'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var db=require(_0xac4a('0x15'))['db'];config[_0xac4a('0x16')]=_[_0xac4a('0x17')](config['redis'],{'host':_0xac4a('0x18'),'port':0x18eb});var socket=require(_0xac4a('0x19'))(new Redis(config[_0xac4a('0x16')]));require(_0xac4a('0x1a'))[_0xac4a('0x1b')](socket);function respondWithStatusCode(_0x3b71c0,_0x34bc01){_0x34bc01=_0x34bc01||0xcc;return function(_0x33c287){if(_0x33c287){return _0x3b71c0[_0xac4a('0x1c')](_0x34bc01);}return _0x3b71c0[_0xac4a('0x1d')](_0x34bc01)[_0xac4a('0x1e')]();};}function respondWithResult(_0x26dbb8,_0x4a2119){_0x4a2119=_0x4a2119||0xc8;return function(_0x402fff){if(_0x402fff){return _0x26dbb8[_0xac4a('0x1d')](_0x4a2119)[_0xac4a('0x1f')](_0x402fff);}};}function respondWithFilteredResult(_0x144553,_0x3e88e3){return function(_0x387a54){if(_0x387a54){var _0x28e304=_0x387a54[_0xac4a('0x20')],_0x44ec59=_0x3e88e3[_0xac4a('0x21')],_0x546c5d=_0x3e88e3[_0xac4a('0x21')]+_0x3e88e3['limit'],_0x5ac21e;if(_0x546c5d>=_0x28e304){_0x546c5d=_0x28e304;_0x5ac21e=0xc8;}else{_0x5ac21e=0xce;}_0x144553[_0xac4a('0x1d')](_0x5ac21e);return _0x144553[_0xac4a('0x22')](_0xac4a('0x23'),_0x44ec59+'-'+_0x546c5d+'/'+_0x28e304)[_0xac4a('0x1f')](_0x387a54);}return null;};}function patchUpdates(_0x123694){return function(_0x3e829c){try{jsonpatch[_0xac4a('0x24')](_0x3e829c,_0x123694,!![]);}catch(_0x3ca790){return BPromise['reject'](_0x3ca790);}return _0x3e829c[_0xac4a('0x25')]();};}function saveUpdates(_0x3204ad,_0x599787){return function(_0x3d7ce0){if(_0x3d7ce0){return _0x3d7ce0[_0xac4a('0x26')](_0x3204ad)[_0xac4a('0x27')](function(_0x947d8e){return _0x947d8e;});}return null;};}function removeEntity(_0x4d2d6c,_0x1b7998){return function(_0x2503d8){if(_0x2503d8){return _0x2503d8[_0xac4a('0x28')]()[_0xac4a('0x27')](function(){_0x4d2d6c[_0xac4a('0x1d')](0xcc)[_0xac4a('0x1e')]();});}};}function handleEntityNotFound(_0x222507,_0x36054a){return function(_0x3e2c69){if(!_0x3e2c69){_0x222507[_0xac4a('0x1c')](0x194);}return _0x3e2c69;};}function handleError(_0x1d0539,_0x215a31){_0x215a31=_0x215a31||0x1f4;return function(_0x14832b){logger[_0xac4a('0x29')](_0x14832b[_0xac4a('0x2a')]);if(_0x14832b[_0xac4a('0x2b')]){delete _0x14832b['name'];}_0x1d0539[_0xac4a('0x1d')](_0x215a31)[_0xac4a('0x2c')](_0x14832b);};}function getInteractionUsers(_0x42a33c,_0x2772fe){return new BPromise(function(_0x116700,_0x4a5a9e){try{if(_0x2772fe[_0x42a33c['id']]){_0x42a33c['Users']=_[_0xac4a('0x2d')](_0x2772fe[_0x42a33c['id']],function(_0x7a948b){return{'id':_0x7a948b['id'],'fullname':_0x7a948b[_0xac4a('0x2e')]};});}}catch(_0x546b65){_0x4a5a9e(_0x546b65);}_0x116700(_0x42a33c);});}function getInteractionTags(_0x4bda1f,_0x355755){return new BPromise(function(_0x2896bc,_0x228629){try{if(_0x4bda1f[_0xac4a('0x2f')]){_0x4bda1f[_0xac4a('0x30')]=[];_0x4bda1f['TagIds'][_0xac4a('0x31')](',')['forEach'](function(_0x30364b){_0x4bda1f['Tags'][_0xac4a('0x32')](_0x355755[_0x30364b]);});}delete _0x4bda1f[_0xac4a('0x2f')];}catch(_0x31501b){_0x228629(_0x31501b);}_0x2896bc(_0x4bda1f);});}function updateWhatsappInteraction(_0x228aa7,_0x34577f,_0x61e552){return new BPromise(function(_0xbd4591,_0x1f13f3){return getInteractionUsers(_0x228aa7,_0x61e552)[_0xac4a('0x27')](function(_0xfd7c16){return getInteractionTags(_0xfd7c16,_0x34577f);})[_0xac4a('0x27')](function(_0x1634df){_0xbd4591(_0x1634df);})[_0xac4a('0x33')](function(_0x1a9d4e){_0x1f13f3(_0x1a9d4e);});});}exports['index']=function(_0x30442d,_0x1c41fb){var _0x5a4e2b={},_0x2a5419={},_0x1af1c1={'count':0x0,'rows':[]};var _0x565164=_['map'](db[_0xac4a('0x34')][_0xac4a('0x35')],function(_0x1b42b6){return{'name':_0x1b42b6[_0xac4a('0x36')],'type':_0x1b42b6['type'][_0xac4a('0x37')]};});_0x2a5419[_0xac4a('0x38')]=_['map'](_0x565164,_0xac4a('0x2b'));_0x2a5419[_0xac4a('0x39')]=_[_0xac4a('0x3a')](_0x30442d['query']);_0x2a5419[_0xac4a('0x3b')]=_[_0xac4a('0x3c')](_0x2a5419[_0xac4a('0x38')],_0x2a5419['query']);_0x5a4e2b[_0xac4a('0x3d')]=_[_0xac4a('0x3c')](_0x2a5419['model'],qs['fields'](_0x30442d[_0xac4a('0x39')]['fields']));_0x5a4e2b['attributes']=_0x5a4e2b['attributes']['length']?_0x5a4e2b[_0xac4a('0x3d')]:_0x2a5419[_0xac4a('0x38')];if(!_0x30442d[_0xac4a('0x39')][_0xac4a('0x3e')](_0xac4a('0x3f'))){_0x5a4e2b[_0xac4a('0x40')]=qs[_0xac4a('0x40')](_0x30442d[_0xac4a('0x39')][_0xac4a('0x40')]);_0x5a4e2b[_0xac4a('0x21')]=qs[_0xac4a('0x21')](_0x30442d[_0xac4a('0x39')]['offset']);}_0x5a4e2b['order']=qs['sort'](_0x30442d[_0xac4a('0x39')][_0xac4a('0x41')]);_0x5a4e2b[_0xac4a('0x42')]=qs[_0xac4a('0x3b')](_[_0xac4a('0x43')](_0x30442d[_0xac4a('0x39')],_0x2a5419[_0xac4a('0x3b')]),_0x565164);var _0x3441f2=[];var _0x3e9973=squel[_0xac4a('0x44')]()['field']('id')[_0xac4a('0x45')](_0xac4a('0x2b'))[_0xac4a('0x45')](_0xac4a('0x46'))[_0xac4a('0x47')]('tools_tags');var _0x8700b4=squel[_0xac4a('0x44')]()['field'](_0xac4a('0x48'))['field'](_0xac4a('0x49'))[_0xac4a('0x45')](_0xac4a('0x4a'))[_0xac4a('0x47')](_0xac4a('0x4b'),'ui')[_0xac4a('0x4c')](_0xac4a('0x4d'),'u',_0xac4a('0x4e'));var _0x98e0c4=squel[_0xac4a('0x44')]()[_0xac4a('0x47')](_0xac4a('0x4f'),'i')['left_join'](_0xac4a('0x50'),'c',_0xac4a('0x51'))[_0xac4a('0x4c')]('users','o',_0xac4a('0x52'))[_0xac4a('0x4c')]('whatsapp_accounts','a',_0xac4a('0x53'))['left_join'](_0xac4a('0x54'),'me',_0xac4a('0x55'))[_0xac4a('0x4c')]('whatsapp_interaction_has_tags','it','it.WhatsappInteractionId\x20=\x20i.id')[_0xac4a('0x4c')]('tools_tags','t',_0xac4a('0x56'));var _0x566258=squel[_0xac4a('0x57')]();var _0x530bbb=[];var _0x3be103=squel[_0xac4a('0x57')]();var _0x424f9b;if(_0x30442d[_0xac4a('0x39')]['search']){_0x424f9b=as[_0xac4a('0x58')](_0x30442d[_0xac4a('0x39')][_0xac4a('0x59')]);var _0x1ee454=_0x424f9b[_0xac4a('0x5a')];for(var _0x138876=0x0;_0x138876<_0x424f9b[_0xac4a('0x5b')]['length'];_0x138876++){var _0x35dee5=_0x424f9b[_0xac4a('0x5b')][_0x138876];var _0x4828e3='i';var _0x16afbe=_[_0xac4a('0x5c')](_0x565164,[_0xac4a('0x2b'),_0x35dee5[_0xac4a('0x45')]]);if(!_0x16afbe){switch(_0x35dee5['field']){case _0xac4a('0x5d'):if(_0x35dee5[_0xac4a('0x5e')]==0x1){_0x98e0c4[_0xac4a('0x5f')]('`'+_0x35dee5[_0xac4a('0x45')]+_0xac4a('0x60'));}else{_0x98e0c4['having']('`'+_0x35dee5[_0xac4a('0x45')]+'`\x20>\x200');}break;case _0xac4a('0x61'):if(_0x35dee5[_0xac4a('0x62')]==='$substring'){if(_0x35dee5['value'][_0xac4a('0x31')]('\x20')[_0xac4a('0x63')]>0x1){_0x566258[_0x1ee454]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xac4a('0x64')](_0x35dee5[_0xac4a('0x5e')]),null);}else{var _0x26b582='%'+_0x35dee5[_0xac4a('0x5e')]+'%';_0x566258[_0x1ee454]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x26b582,_0x26b582,_0x26b582);}}else{_0x16afbe=_[_0xac4a('0x5c')](_0x565164,[_0xac4a('0x2b'),_0xac4a('0x65')]);_0x35dee5[_0xac4a('0x45')]=_0xac4a('0x65');_0x19ce2c=as[_0xac4a('0x66')](_0x4828e3,_0x16afbe[_0xac4a('0x67')],_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c['text'],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x68')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x1e')]);}break;case _0xac4a('0x69'):var _0x2ac1e9=_0x35dee5[_0xac4a('0x5e')][_0xac4a('0x31')](',')[_0xac4a('0x2d')](function(_0x786d9){return Number(_0x786d9);});_0x2ac1e9[_0xac4a('0x6a')](function(_0x38dd4f){_0x3be103['or'](_0xac4a('0x6b'),'%,'+_0x38dd4f+',%');});_0x530bbb=_[_0xac4a('0x6c')](_0x530bbb,_0x2ac1e9);break;case _0xac4a('0x6d'):if(_0x35dee5[_0xac4a('0x62')]==='$substring'){_0x566258[_0x1ee454](_0xac4a('0x6e'),'%'+_0x35dee5['value']+'%',null);}else{_0x16afbe=_[_0xac4a('0x5c')](_0x565164,['name',_0xac4a('0x6f')]);_0x35dee5['field']=_0xac4a('0x6f');_0x19ce2c=as['buildExpression'](_0x4828e3,_0x16afbe['type'],_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c[_0xac4a('0x70')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x68')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x1e')]);}break;case _0xac4a('0x71'):_0x19ce2c=as['buildExpression']('me',null,_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c[_0xac4a('0x70')],_0x19ce2c['value'][_0xac4a('0x68')],_0x19ce2c['value'][_0xac4a('0x1e')]);break;}}else{var _0x19ce2c=as[_0xac4a('0x66')](_0x4828e3,_0x16afbe[_0xac4a('0x67')],_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c[_0xac4a('0x70')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x68')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x1e')]);}}}else{var _0x430dd0=_(_0x30442d[_0xac4a('0x39')])[_0xac4a('0x3a')]()[_0xac4a('0x2d')](function(_0x2cc410){return _[_0xac4a('0x72')](_0x565164,[_0xac4a('0x2b'),_0x2cc410])?_0x2cc410:undefined;})[_0xac4a('0x73')]()['value']();if(!_[_0xac4a('0x74')](_0x430dd0)){_0x430dd0[_0xac4a('0x6a')](function(_0x4fb812){if(_0x4fb812===_0xac4a('0x75')){_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x76'),[][_0xac4a('0x77')](_0x30442d[_0xac4a('0x39')][_0x4fb812]));}else if(_0x4fb812==='createdAt'){var _0x47c6d8=JSON[_0xac4a('0x78')](_0x30442d[_0xac4a('0x39')][_0x4fb812])[_0xac4a('0x79')];var _0x148288=JSON[_0xac4a('0x78')](_0x30442d[_0xac4a('0x39')][_0x4fb812])[_0xac4a('0x7a')];_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x7b'),_0x47c6d8,_0x148288);}else{if(_0x30442d[_0xac4a('0x39')][_0x4fb812]===_0xac4a('0x7c')){_0x98e0c4['where']('i.'+_0x4fb812+'\x20IS\x20NULL');}else{_0x98e0c4[_0xac4a('0x42')]('i.'+_0x4fb812+_0xac4a('0x7d'),_0x30442d[_0xac4a('0x39')][_0x4fb812]);}}});}if(_0x30442d[_0xac4a('0x39')][_0xac4a('0x7e')]){if(_0x30442d[_0xac4a('0x39')][_0xac4a('0x7e')]==0x1){_0x98e0c4[_0xac4a('0x5f')](_0xac4a('0x7f'));}else{_0x98e0c4[_0xac4a('0x5f')](_0xac4a('0x80'));}}if(_0x30442d[_0xac4a('0x39')]['tag']){_0x530bbb=_[_0xac4a('0x81')](_0x30442d[_0xac4a('0x39')][_0xac4a('0x82')])?_0x30442d[_0xac4a('0x39')]['tag']:new Array(_0x30442d[_0xac4a('0x39')]['tag']);_0x530bbb[_0xac4a('0x6a')](function(_0x3af39a){_0x3be103['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3af39a+',%');});}if(_0x30442d['query'][_0xac4a('0x83')]){var _0x3b8974=_0x30442d[_0xac4a('0x39')]['filter'][_0xac4a('0x84')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0xac4a('0x85'));if(qs['isNumeric'](_0x3b8974)){_0x566258['or']('i.id\x20LIKE\x20?',_0x3b8974+'%')['or'](_0xac4a('0x86'),_0x3b8974+'%');}else{_0x566258['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xac4a('0x64')](_0x3b8974))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x3b8974+'%');}}}_0x98e0c4[_0xac4a('0x42')](_0x566258);_0x98e0c4[_0xac4a('0x87')]('i.id');var _0x3980ae={'type':db['Sequelize'][_0xac4a('0x88')][_0xac4a('0x89')],'raw':!![]};var _0x522949=_0x98e0c4[_0xac4a('0x8a')]();_0x522949['field']('i.id');_0x522949[_0xac4a('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xac4a('0x5d'));if(_0x5a4e2b['order']){_0x5a4e2b['order'][_0xac4a('0x6a')](function(_0x4065c0){_0x98e0c4[_0xac4a('0x8b')]('i.'+_0x4065c0[0x0],_0x4065c0[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x530bbb)){_0x98e0c4[_0xac4a('0x5f')](_0x3be103);_0x522949[_0xac4a('0x42')]('t.id\x20IN\x20?',_0x530bbb);}BPromise['resolve']()[_0xac4a('0x27')](function(){if(!_0x424f9b){if(_0x30442d[_0xac4a('0x39')][_0xac4a('0x75')]||_0x30442d[_0xac4a('0x39')][_0xac4a('0x8c')])return;_0x522949[_0xac4a('0x42')](_0xac4a('0x8d'));_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x8d'));return;}return _0x30442d['user'][_0xac4a('0x8e')]({'attributes':['id'],'raw':!![]})[_0xac4a('0x27')](function(_0x3ba61e){if(_['isEmpty'](_0x3ba61e)){_0x522949[_0xac4a('0x42')](_0xac4a('0x8f'));_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x8f'));}else{_0x522949[_0xac4a('0x42')]('i.WhatsappAccountId\x20IN\x20?',_[_0xac4a('0x2d')](_0x3ba61e,'id'));_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x76'),_[_0xac4a('0x2d')](_0x3ba61e,'id'));}});})[_0xac4a('0x27')](function(){db[_0xac4a('0x90')][_0xac4a('0x39')](_0x522949['toString'](),_0x3980ae)[_0xac4a('0x27')](function(_0x2be178){_0x1af1c1[_0xac4a('0x20')]=_0x2be178[_0xac4a('0x63')];if(_0x1af1c1[_0xac4a('0x20')]===0x0)return[];return db[_0xac4a('0x90')]['query'](_0x3e9973[_0xac4a('0x91')](),_0x3980ae)[_0xac4a('0x27')](function(_0x1b9a33){_0x3441f2=_[_0xac4a('0x92')](_0x1b9a33,'id');_0x3980ae=_['merge'](_0x3980ae,{'model':db[_0xac4a('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x30442d['query'][_0xac4a('0x93')]){_0x5a4e2b[_0xac4a('0x3d')]['forEach'](function(_0x5b95ab){_0x98e0c4[_0xac4a('0x45')]('i.'+_0x5b95ab);});}else{_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x94'),'unreadMessages');_0x98e0c4[_0xac4a('0x45')]('a.key',_0xac4a('0x95'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x96'),_0xac4a('0x97'));_0x98e0c4[_0xac4a('0x45')]('i.*');_0x98e0c4['field'](_0xac4a('0x98'),_0xac4a('0x99'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x9a'),_0xac4a('0x9b'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x9c'),_0xac4a('0x9d'));_0x98e0c4['field']('c.phone',_0xac4a('0x9e'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x9f'),_0xac4a('0xa0'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0xa1'),_0xac4a('0xa2'));_0x98e0c4[_0xac4a('0x45')]('o.fullname','Owner.fullname');_0x98e0c4[_0xac4a('0x45')](_0xac4a('0xa3'),_0xac4a('0xa4'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0xa5'),_0xac4a('0x2f'));}if(_0x5a4e2b[_0xac4a('0x40')])_0x98e0c4['limit'](_0x5a4e2b[_0xac4a('0x40')]);if(_0x5a4e2b[_0xac4a('0x21')])_0x98e0c4[_0xac4a('0x21')](_0x5a4e2b['offset']);return db[_0xac4a('0x90')][_0xac4a('0x39')](_0x98e0c4[_0xac4a('0x91')](),_0x3980ae);})[_0xac4a('0x27')](function(_0x1a7448){_0x8700b4[_0xac4a('0x42')](_0xac4a('0xa6'),_[_0xac4a('0x2d')](_0x1a7448,'id'));return db[_0xac4a('0x90')]['query'](_0x8700b4[_0xac4a('0x91')](),_0x3980ae)['then'](function(_0x203321){var _0x1199f6=_[_0xac4a('0xa7')](_0x203321,_0xac4a('0xa8'));var _0x840fec=[];_0x1a7448[_0xac4a('0x6a')](function(_0x19766a){_0x840fec['push'](updateWhatsappInteraction(_0x19766a,_0x3441f2,_0x1199f6));});return BPromise[_0xac4a('0xa9')](_0x840fec);});});})[_0xac4a('0x27')](function(_0x279f9b){_0x1af1c1[_0xac4a('0xaa')]=_0x279f9b;return _0x1af1c1;})[_0xac4a('0x27')](respondWithFilteredResult(_0x1c41fb,_0x5a4e2b));})['catch'](handleError(_0x1c41fb,null));};exports[_0xac4a('0xab')]=function(_0x360d4f,_0x4f2b19){var _0x55af32={'raw':![],'where':{'id':_0x360d4f[_0xac4a('0xac')]['id']}},_0x386d6d={};_0x386d6d['model']=_[_0xac4a('0x3a')](db[_0xac4a('0x34')][_0xac4a('0x35')]);_0x386d6d[_0xac4a('0x39')]=_[_0xac4a('0x3a')](_0x360d4f[_0xac4a('0x39')]);_0x386d6d['filters']=_[_0xac4a('0x3c')](_0x386d6d[_0xac4a('0x38')],_0x386d6d[_0xac4a('0x39')]);_0x55af32['attributes']=_[_0xac4a('0x3c')](_0x386d6d[_0xac4a('0x38')],qs[_0xac4a('0x93')](_0x360d4f[_0xac4a('0x39')][_0xac4a('0x93')]));_0x55af32[_0xac4a('0x3d')]=_0x55af32['attributes'][_0xac4a('0x63')]?_0x55af32[_0xac4a('0x3d')]:_0x386d6d['model'];if(_0x360d4f[_0xac4a('0x39')]['includeAll']){_0x55af32[_0xac4a('0xad')]=[{'all':!![]}];}_0x55af32=_[_0xac4a('0xae')]({},_0x55af32,_0x360d4f['options']);return db[_0xac4a('0x34')]['find'](_0x55af32)[_0xac4a('0x27')](handleEntityNotFound(_0x4f2b19,null))['then'](respondWithResult(_0x4f2b19,null))[_0xac4a('0x33')](handleError(_0x4f2b19,null));};exports[_0xac4a('0xaf')]=function(_0x24f464,_0xfe8977){return db[_0xac4a('0x34')][_0xac4a('0xaf')](_0x24f464[_0xac4a('0x71')],{})[_0xac4a('0x27')](respondWithResult(_0xfe8977,0xc9))[_0xac4a('0x33')](handleError(_0xfe8977,null));};exports[_0xac4a('0x26')]=function(_0x3a0163,_0x455eb7){if(_0x3a0163[_0xac4a('0x71')]['id']){delete _0x3a0163[_0xac4a('0x71')]['id'];}return db['WhatsappInteraction'][_0xac4a('0x5c')]({'where':{'id':_0x3a0163[_0xac4a('0xac')]['id']}})['then'](handleEntityNotFound(_0x455eb7,null))[_0xac4a('0x27')](saveUpdates(_0x3a0163[_0xac4a('0x71')],null))[_0xac4a('0x27')](respondWithResult(_0x455eb7,null))[_0xac4a('0x33')](handleError(_0x455eb7,null));};exports[_0xac4a('0x28')]=function(_0x5d5bb3,_0x101137){return db['WhatsappInteraction'][_0xac4a('0x5c')]({'where':{'id':_0x5d5bb3[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0x101137,null))[_0xac4a('0x27')](removeEntity(_0x101137,null))['catch'](handleError(_0x101137,null));};exports[_0xac4a('0xb0')]=function(_0x55866d,_0x277fd1){return db[_0xac4a('0x34')][_0xac4a('0xb0')]()['then'](respondWithResult(_0x277fd1,null))[_0xac4a('0x33')](handleError(_0x277fd1,null));};exports[_0xac4a('0xb1')]=function(_0x127ede,_0x52f3f2,_0x2da95f){return db[_0xac4a('0xb2')][_0xac4a('0x5c')]({'where':{'id':_0x127ede[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0x52f3f2,null))[_0xac4a('0x27')](function(_0x3b4183){if(_0x3b4183){return _0x3b4183[_0xac4a('0xb1')](_0x127ede['body'][_0xac4a('0xb3')],_['omit'](_0x127ede['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x52f3f2,null))['catch'](handleError(_0x52f3f2,null));};exports[_0xac4a('0xb4')]=function(_0x58fcb0,_0xc014a6,_0x377444){var _0x2132b2={'raw':![],'where':{}};var _0x525d50={};var _0x9ea4d1={'count':0x0,'rows':[]};return db[_0xac4a('0x34')][_0xac4a('0xb5')]({'where':{'id':_0x58fcb0[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0xc014a6,null))[_0xac4a('0x27')](function(_0x7a1b25){if(_0x7a1b25){_0x525d50[_0xac4a('0x38')]=_['keys'](db[_0xac4a('0xb2')][_0xac4a('0x35')]);_0x525d50[_0xac4a('0x39')]=_[_0xac4a('0x3a')](_0x58fcb0[_0xac4a('0x39')]);_0x525d50[_0xac4a('0x3b')]=_[_0xac4a('0x3c')](_0x525d50['model'],_0x525d50['query']);_0x2132b2[_0xac4a('0x3d')]=_[_0xac4a('0x3c')](_0x525d50['model'],qs[_0xac4a('0x93')](_0x58fcb0[_0xac4a('0x39')]['fields']));_0x2132b2['attributes']=_0x2132b2[_0xac4a('0x3d')][_0xac4a('0x63')]?_0x2132b2[_0xac4a('0x3d')]:_0x525d50[_0xac4a('0x38')];if(!_0x58fcb0[_0xac4a('0x39')]['hasOwnProperty'](_0xac4a('0x3f'))){_0x2132b2['limit']=qs['limit'](_0x58fcb0['query'][_0xac4a('0x40')]);_0x2132b2[_0xac4a('0x21')]=qs[_0xac4a('0x21')](_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x21')]);}_0x2132b2[_0xac4a('0x8b')]=qs[_0xac4a('0x41')](_0x58fcb0[_0xac4a('0x39')]['sort']);_0x2132b2['where']=qs['filters'](_[_0xac4a('0x43')](_0x58fcb0[_0xac4a('0x39')],_0x525d50[_0xac4a('0x3b')]));_0x2132b2[_0xac4a('0x42')][_0xac4a('0xa8')]=_0x7a1b25['id'];if(_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x83')]){_0x2132b2[_0xac4a('0x42')]=_[_0xac4a('0xae')](_0x2132b2[_0xac4a('0x42')],{'$or':_[_0xac4a('0x2d')](_0x2132b2[_0xac4a('0x3d')],function(_0xe0fd57){var _0x32b013={};_0x32b013[_0xe0fd57]={'$like':'%'+_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x83')]+'%'};return _0x32b013;})});}if(_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x79')]){var _0x41cdb5=_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x79')][_0xac4a('0x31')](',');var _0x3e2575={};_0x3e2575[_0x41cdb5[0x0]]={'$gte':moment(_0x41cdb5[0x1])['format'](_0xac4a('0xb6'))};_0x2132b2[_0xac4a('0x42')]=_[_0xac4a('0xae')](_0x2132b2[_0xac4a('0x42')],_0x3e2575);}_0x2132b2=_[_0xac4a('0xae')]({},_0x2132b2,_0x58fcb0[_0xac4a('0xb7')]);return db[_0xac4a('0xb2')][_0xac4a('0x20')]({'where':_0x2132b2['where']})['then'](function(_0x113f80){_0x9ea4d1[_0xac4a('0x20')]=_0x113f80;if(_0x58fcb0[_0xac4a('0x39')]['includeAll']){_0x2132b2['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0xac4a('0xb8')](_0x2132b2);})['then'](function(_0x59e82c){_0x9ea4d1[_0xac4a('0xaa')]=_0x59e82c;return _0x9ea4d1;});}})['then'](respondWithFilteredResult(_0xc014a6,_0x2132b2))[_0xac4a('0x33')](handleError(_0xc014a6,null));};exports['addTags']=function(_0x3f95a4,_0x2b4f28,_0x413f5f){return db[_0xac4a('0x34')][_0xac4a('0x5c')]({'where':{'id':_0x3f95a4[_0xac4a('0xac')]['id']}})['then'](handleEntityNotFound(_0x2b4f28,null))[_0xac4a('0x27')](function(_0x34b6d7){if(_0x34b6d7){return _0x34b6d7[_0xac4a('0xb9')](_0x3f95a4['body'][_0xac4a('0xb3')],_[_0xac4a('0xba')](_0x3f95a4[_0xac4a('0x71')],[_0xac4a('0xb3'),'id'])||{})['spread'](function(){return db[_0xac4a('0x69')][_0xac4a('0xb8')]({'attributes':['id',_0xac4a('0x2b'),_0xac4a('0x46')],'where':{'id':_0x3f95a4[_0xac4a('0x71')][_0xac4a('0xb3')]}});})['then'](function(_0x57d3cd){socket[_0xac4a('0xbb')](_0xac4a('0xbc'),{'id':Number(_0x3f95a4[_0xac4a('0xac')]['id']),'tags':_0x57d3cd||[]});return{'id':Number(_0x3f95a4[_0xac4a('0xac')]['id']),'tags':_0x57d3cd||[]};});}})[_0xac4a('0x27')](respondWithResult(_0x2b4f28,null))[_0xac4a('0x33')](handleError(_0x2b4f28,null));};exports['removeTags']=function(_0x21a6f6,_0x580c9b,_0xe4165d){return db['WhatsappInteraction'][_0xac4a('0x5c')]({'where':{'id':_0x21a6f6[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0x580c9b,null))[_0xac4a('0x27')](function(_0x5650ce){if(_0x5650ce){return _0x5650ce[_0xac4a('0xbd')](_0x21a6f6[_0xac4a('0x39')][_0xac4a('0xb3')]);}})[_0xac4a('0x27')](respondWithStatusCode(_0x580c9b,null))[_0xac4a('0x33')](handleError(_0x580c9b,null));};exports['download']=function(_0x3dd60a,_0xbe1958){var _0x462964=moment()[_0xac4a('0xbe')]()[_0xac4a('0x91')]();var _0x5e5eb1=path[_0xac4a('0xbf')](config[_0xac4a('0xc0')],_0xac4a('0xc1'),_0xac4a('0xc2'),_0xac4a('0xc3'));var _0x55ccc3=path['join'](config['root'],'server',_0xac4a('0xc2'),_0xac4a('0xc4'));var _0x17f815=path[_0xac4a('0xbf')](_0x5e5eb1,_0x462964);var _0xa8b5bb=util['format'](_0xac4a('0xc5'),_0x3dd60a[_0xac4a('0xac')]['id'],_0x462964);var _0x5aad90=path[_0xac4a('0xbf')](_0x5e5eb1,_0xa8b5bb);var _0x14b425=[];_0x14b425[_0xac4a('0x32')]({'model':db['User'],'as':_0xac4a('0x6d'),'attributes':['id',_0xac4a('0x2e')],'raw':!![]});_0x14b425[_0xac4a('0x32')]({'model':db[_0xac4a('0xc6')],'as':_0xac4a('0x61'),'attributes':['id',_0xac4a('0xc7'),_0xac4a('0xc8')],'raw':!![]});if(_0x3dd60a[_0xac4a('0x39')][_0xac4a('0xc4')]){_0x14b425['push']({'model':db[_0xac4a('0xc9')],'as':_0xac4a('0xc9'),'raw':!![]});}var _0x579181=[{'model':db[_0xac4a('0xb2')],'as':'Messages','attributes':['id',_0xac4a('0x71'),_0xac4a('0xca'),'direction',_0xac4a('0xcb'),_0xac4a('0x7e')],'include':_0x14b425}];_0x579181[_0xac4a('0x32')]({'model':db[_0xac4a('0xcc')],'as':_0xac4a('0xcd'),'attributes':['id',_0xac4a('0x2b')]});_0x579181[_0xac4a('0x32')]({'model':db[_0xac4a('0x6d')],'as':'Owner','attributes':['id','fullname']});return db[_0xac4a('0x34')]['find']({'where':{'id':_0x3dd60a['params']['id']},'include':_0x579181})[_0xac4a('0x27')](handleEntityNotFound(_0xbe1958,null))[_0xac4a('0x27')](function(_0x3254c3){if(_0x3254c3){var _0x516225=_0x3254c3[_0xac4a('0xce')]({'plain':!![]});fs[_0xac4a('0xcf')](_0x17f815);var _0x5a2abf={'format':'A4','border':'10px','header':{'height':_0xac4a('0xd0'),'contents':{'first':_0xac4a('0xd1')}},'footer':{'height':_0xac4a('0xd2'),'contents':{'default':util[_0xac4a('0xd3')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0xac4a('0xd3')](_0xac4a('0xd4'),_0xac4a('0xd5'),_0x516225['id']),moment()['format'](_0xac4a('0xd6'))[_0xac4a('0x91')]())}}};var _0x15b97a={'channel':_0xac4a('0xd5'),'account':_0x516225[_0xac4a('0xcd')]['name'],'agent':_0x516225['Owner']?_0x516225[_0xac4a('0xd7')][_0xac4a('0x2e')]:_0xac4a('0xd8'),'createdAt':moment(_0x516225[_0xac4a('0xca')])[_0xac4a('0xd3')](_0xac4a('0xb6'))[_0xac4a('0x91')](),'closedAt':_0x516225[_0xac4a('0xd9')]?moment(_0x516225[_0xac4a('0xda')])[_0xac4a('0xd3')](_0xac4a('0xb6'))[_0xac4a('0x91')]():'','disposition':_0x516225[_0xac4a('0xdb')],'messages':_(_0x516225['Messages'])[_0xac4a('0x83')]({'secret':![]})['map'](function(_0x4ec2c3){if(_0x4ec2c3[_0xac4a('0xc9')]){var _0x27833a=path[_0xac4a('0xbf')](_0x55ccc3,_0x4ec2c3[_0xac4a('0xc9')][_0xac4a('0xdc')]);if(fs[_0xac4a('0xdd')](_0x27833a)){fs[_0xac4a('0xde')](_0x27833a)[_0xac4a('0xdf')](fs[_0xac4a('0xe0')](path['join'](_0x17f815,_0x4ec2c3[_0xac4a('0xc9')][_0xac4a('0xdc')])));}}return{'date':moment(_0x4ec2c3[_0xac4a('0xca')])[_0xac4a('0xd3')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x4ec2c3[_0xac4a('0xe1')]===_0xac4a('0xe2')?_0x4ec2c3[_0xac4a('0x6d')]?_0x4ec2c3[_0xac4a('0x6d')][_0xac4a('0x2e')]:_0xac4a('0xe3'):_0x4ec2c3[_0xac4a('0x61')][_0xac4a('0xc7')]+(_0x4ec2c3[_0xac4a('0x61')]['lastName']?'\x20'+_0x4ec2c3[_0xac4a('0x61')][_0xac4a('0xc8')]:''),'body':_0x4ec2c3[_0xac4a('0xc9')]?_0x4ec2c3[_0xac4a('0xc9')][_0xac4a('0xdc')]:_0x4ec2c3[_0xac4a('0x71')],'direction':_0x4ec2c3['direction']==='out'?'A':'C','secret':_0x4ec2c3['secret'],'read':_0x4ec2c3[_0xac4a('0x7e')],'attachment':_0x4ec2c3[_0xac4a('0xc9')]};})['value']()};return ejs['renderFile'](path[_0xac4a('0xbf')](config['root'],_0xac4a('0xc1'),'views',_0xac4a('0xe4')),{'interaction':_0x15b97a})[_0xac4a('0x27')](function(_0x1888c3){return new BPromise(function(_0x4a04c3,_0x14435d){pdf[_0xac4a('0xaf')](_0x1888c3,_0x5a2abf)['toFile'](path[_0xac4a('0xbf')](_0x17f815,_0xac4a('0xe5')+_0x516225['id']+'-'+_0x462964+'.pdf'),function(_0x48a75c,_0x4514a5){if(_0x48a75c)return _0x14435d(_0x48a75c);_0x4a04c3(_0x4514a5);});});})[_0xac4a('0x27')](function(){return new BPromise(function(_0x43df37,_0x45e45b){zipdir(_0x17f815,{'saveTo':_0x5aad90},function(_0x367254,_0x22cc71){if(_0x367254)return _0x45e45b(_0x367254);return _0x43df37(_0x22cc71);});})[_0xac4a('0x27')](function(){return new BPromise(function(_0x1ea4ef,_0x156b67){rimraf(_0x17f815,function(_0x330070){if(_0x330070)_0x156b67(_0x330070);return _0x1ea4ef();});});})[_0xac4a('0x27')](function(){return _0xbe1958[_0xac4a('0xe6')](_0x5aad90,_0xa8b5bb,function(_0x2d755c){if(_0x2d755c){console[_0xac4a('0xe7')](_0xac4a('0xe8'),_0x2d755c);}else{fs[_0xac4a('0xe9')](_0x5aad90);}});});});}else{return _0xbe1958[_0xac4a('0x1c')](0xc8);}})['catch'](handleError(_0xbe1958,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 66157ed..7d12b03 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 _0x6d25=['getUsers','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','save','update'];(function(_0x21ca0d,_0x4528dc){var _0x1ec200=function(_0x549018){while(--_0x549018){_0x21ca0d['push'](_0x21ca0d['shift']());}};_0x1ec200(++_0x4528dc);}(_0x6d25,0x15a));var _0x56d2=function(_0x27a023,_0x51a0cd){_0x27a023=_0x27a023-0x0;var _0x321313=_0x6d25[_0x27a023];return _0x321313;};'use strict';var EventEmitter=require(_0x56d2('0x0'));var WhatsappInteraction=require(_0x56d2('0x1'))['db'][_0x56d2('0x2')];var WhatsappMessage=require(_0x56d2('0x1'))['db'][_0x56d2('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x56d2('0x4'),'afterUpdate':_0x56d2('0x5'),'afterDestroy':'remove'};function emitEvent(_0x332f35){return function(_0x3e8f47,_0x435186,_0x44e7ee){_0x3e8f47[_0x56d2('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x330e7e){_0x3e8f47[_0x56d2('0x7')](_0x56d2('0x8'),_0x330e7e[_0x56d2('0x9')](function(_0x4a4bcd){return{'id':_0x4a4bcd['id']};}));return WhatsappMessage[_0x56d2('0xa')]({'where':{'WhatsappInteractionId':_0x3e8f47['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3c6163){_0x3e8f47[_0x56d2('0x7')]('unreadMessages',_0x3c6163[_0x56d2('0xb')]);WhatsappInteractionEvents[_0x56d2('0xc')](_0x332f35+':'+_0x3e8f47['id'],_0x3e8f47);WhatsappInteractionEvents[_0x56d2('0xc')](_0x332f35,_0x3e8f47);_0x44e7ee(null);})[_0x56d2('0xd')](_0x44e7ee(null));};}for(var e in events){if(events[_0x56d2('0xe')](e)){var event=events[e];WhatsappInteraction[_0x56d2('0xf')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0x686c=['hasOwnProperty','exports','events','WhatsappInteraction','../../mysqldb','save','getUsers','then','setDataValue','Users','map','unreadMessages','emit','catch'];(function(_0x4c321c,_0x3e9da0){var _0x25accb=function(_0x21bf7a){while(--_0x21bf7a){_0x4c321c['push'](_0x4c321c['shift']());}};_0x25accb(++_0x3e9da0);}(_0x686c,0x1de));var _0xc686=function(_0x128006,_0x3068c8){_0x128006=_0x128006-0x0;var _0x2279df=_0x686c[_0x128006];return _0x2279df;};'use strict';var EventEmitter=require(_0xc686('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0xc686('0x1')];var WhatsappMessage=require(_0xc686('0x2'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc686('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x58d145){return function(_0x85f306,_0x440e98,_0x4caa2){_0x85f306[_0xc686('0x4')]({'attributes':['id'],'raw':!![]})[_0xc686('0x5')](function(_0x3ec3fc){_0x85f306[_0xc686('0x6')](_0xc686('0x7'),_0x3ec3fc[_0xc686('0x8')](function(_0x1b9f2a){return{'id':_0x1b9f2a['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x85f306['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc686('0x5')](function(_0x27281a){_0x85f306[_0xc686('0x6')](_0xc686('0x9'),_0x27281a['length']);WhatsappInteractionEvents[_0xc686('0xa')](_0x58d145+':'+_0x85f306['id'],_0x85f306);WhatsappInteractionEvents[_0xc686('0xa')](_0x58d145,_0x85f306);_0x4caa2(null);})[_0xc686('0xb')](_0x4caa2(null));};}for(var e in events){if(events[_0xc686('0xc')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xc686('0xd')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 7b4095c..eacaac1 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 _0x8eec=['lodash','util','api','moment','request-promise','path','rimraf','exports','define','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x55e58c,_0x5278e9){var _0x32ce31=function(_0x4098d2){while(--_0x4098d2){_0x55e58c['push'](_0x55e58c['shift']());}};_0x32ce31(++_0x5278e9);}(_0x8eec,0x12b));var _0xc8ee=function(_0x581f94,_0x51913c){_0x581f94=_0x581f94-0x0;var _0x1f7f3c=_0x8eec[_0x581f94];return _0x1f7f3c;};'use strict';var _=require(_0xc8ee('0x0'));var util=require(_0xc8ee('0x1'));var logger=require('../../config/logger')(_0xc8ee('0x2'));var moment=require(_0xc8ee('0x3'));var BPromise=require('bluebird');var rp=require(_0xc8ee('0x4'));var fs=require('fs');var path=require(_0xc8ee('0x5'));var rimraf=require(_0xc8ee('0x6'));var config=require('../../config/environment');var attributes=require('./whatsappInteraction.attributes');module[_0xc8ee('0x7')]=function(_0x2a0ebd,_0x19a4f7){return _0x2a0ebd[_0xc8ee('0x8')]('WhatsappInteraction',attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1fe68f,_0xc679fa,_0x438cfa){if(_0x1fe68f[_0xc8ee('0x9')](_0xc8ee('0xa'))){_0x1fe68f['closedAt']=moment()[_0xc8ee('0xb')](_0xc8ee('0xc'));}_0x438cfa(null,_0x1fe68f);}}});}; \ No newline at end of file +var _0x99dc=['changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction'];(function(_0x230b43,_0x144f5e){var _0x57ee16=function(_0x543c00){while(--_0x543c00){_0x230b43['push'](_0x230b43['shift']());}};_0x57ee16(++_0x144f5e);}(_0x99dc,0x114));var _0xc99d=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x99dc[_0x4e9628];return _0x27bc8c;};'use strict';var _=require(_0xc99d('0x0'));var util=require(_0xc99d('0x1'));var logger=require('../../config/logger')(_0xc99d('0x2'));var moment=require(_0xc99d('0x3'));var BPromise=require(_0xc99d('0x4'));var rp=require(_0xc99d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc99d('0x6'));var config=require(_0xc99d('0x7'));var attributes=require(_0xc99d('0x8'));module[_0xc99d('0x9')]=function(_0x415bd6,_0x1fe93b){return _0x415bd6[_0xc99d('0xa')](_0xc99d('0xb'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1c9edf,_0x5d6150,_0x383348){if(_0x1c9edf[_0xc99d('0xc')]('closed')){_0x1c9edf[_0xc99d('0xd')]=moment()[_0xc99d('0xe')](_0xc99d('0xf'));}_0x383348(null,_0x1c9edf);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 5384d87..d80b7f2 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 _0xed76=['then','info','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','WhatsappInteraction,\x20%s,\x20%s','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','limit','debug','AddTagsToWhatsappInteraction','where','ids','omit','AddTags','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register'];(function(_0x37d767,_0x1a6590){var _0x2bd99d=function(_0x1933e9){while(--_0x1933e9){_0x37d767['push'](_0x37d767['shift']());}};_0x2bd99d(++_0x1a6590);}(_0xed76,0x16d));var _0x6ed7=function(_0x1ab96f,_0x2120f1){_0x1ab96f=_0x1ab96f-0x0;var _0x5efbe2=_0xed76[_0x1ab96f];return _0x5efbe2;};'use strict';var _=require(_0x6ed7('0x0'));var util=require('util');var moment=require(_0x6ed7('0x1'));var BPromise=require(_0x6ed7('0x2'));var rs=require(_0x6ed7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6ed7('0x4'))['db'];var utils=require(_0x6ed7('0x5'));var logger=require(_0x6ed7('0x6'))('rpc');var config=require(_0x6ed7('0x7'));var jayson=require(_0x6ed7('0x8'));var client=jayson['client'][_0x6ed7('0x9')]({'port':0x232a});config[_0x6ed7('0xa')]=_['defaults'](config[_0x6ed7('0xa')],{'host':_0x6ed7('0xb'),'port':0x18eb});var socket=require(_0x6ed7('0xc'))(new Redis(config['redis']));require(_0x6ed7('0xd'))[_0x6ed7('0xe')](socket);function respondWithRpcPromise(_0x4318e5,_0x4566f1,_0x2c248c){return new BPromise(function(_0x59632b,_0x151a0b){return client['request'](_0x4318e5,_0x2c248c)[_0x6ed7('0xf')](function(_0x4c7631){logger[_0x6ed7('0x10')]('WhatsappInteraction,\x20%s,\x20%s',_0x4566f1,'request\x20sent');logger['debug'](_0x6ed7('0x11'),_0x4566f1,_0x6ed7('0x12'),JSON[_0x6ed7('0x13')](_0x4c7631));if(_0x4c7631[_0x6ed7('0x14')]){if(_0x4c7631[_0x6ed7('0x14')]['code']===0x1f4){logger[_0x6ed7('0x14')](_0x6ed7('0x15'),_0x4566f1,_0x4c7631[_0x6ed7('0x14')]['message']);return _0x151a0b(_0x4c7631['error'][_0x6ed7('0x16')]);}logger[_0x6ed7('0x14')](_0x6ed7('0x15'),_0x4566f1,_0x4c7631[_0x6ed7('0x14')][_0x6ed7('0x16')]);return _0x59632b(_0x4c7631[_0x6ed7('0x14')][_0x6ed7('0x16')]);}else{logger[_0x6ed7('0x10')](_0x6ed7('0x15'),_0x4566f1,'request\x20sent');_0x59632b(_0x4c7631[_0x6ed7('0x17')][_0x6ed7('0x16')]);}})[_0x6ed7('0x18')](function(_0x49eaed){logger[_0x6ed7('0x14')](_0x6ed7('0x15'),_0x4566f1,_0x49eaed);_0x151a0b(_0x49eaed);});});}exports[_0x6ed7('0x19')]=function(_0x529a9f){var _0x3c1df4=this;return new Promise(function(_0x156bbf,_0x34cc4c){return db[_0x6ed7('0x1a')][_0x6ed7('0x1b')](_0x529a9f[_0x6ed7('0x1c')],{'raw':_0x529a9f[_0x6ed7('0x1d')]?_0x529a9f[_0x6ed7('0x1d')][_0x6ed7('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x529a9f['options']?_0x529a9f[_0x6ed7('0x1d')]['where']||null:null,'attributes':_0x529a9f[_0x6ed7('0x1d')]?_0x529a9f['options']['attributes']||null:null,'limit':_0x529a9f['options']?_0x529a9f[_0x6ed7('0x1d')][_0x6ed7('0x1f')]||null:null})[_0x6ed7('0xf')](function(_0x2211cc){logger[_0x6ed7('0x10')](_0x6ed7('0x19'),_0x529a9f);logger[_0x6ed7('0x20')](_0x6ed7('0x19'),_0x529a9f,JSON[_0x6ed7('0x13')](_0x2211cc));_0x156bbf(_0x2211cc);})[_0x6ed7('0x18')](function(_0x5bfc2a){logger[_0x6ed7('0x14')]('UpdateWhatsappInteraction',_0x5bfc2a[_0x6ed7('0x16')],_0x529a9f);_0x34cc4c(_0x3c1df4['error'](0x1f4,_0x5bfc2a[_0x6ed7('0x16')]));});});};exports[_0x6ed7('0x21')]=function(_0x180b16){return new Promise(function(_0xf08ae4,_0x2146a1){return db[_0x6ed7('0x1a')]['find']({'where':_0x180b16[_0x6ed7('0x1d')]?_0x180b16[_0x6ed7('0x1d')][_0x6ed7('0x22')]||null:null})[_0x6ed7('0xf')](function(_0x3efac8){if(_0x3efac8){return _0x3efac8['addTags'](_0x180b16['body'][_0x6ed7('0x23')],_[_0x6ed7('0x24')](_0x180b16[_0x6ed7('0x1c')],[_0x6ed7('0x23'),'id'])||{});}})['spread'](function(_0x6cc1a0){logger[_0x6ed7('0x10')](_0x6ed7('0x25'),_0x180b16);logger['debug']('AddTags',_0x180b16,JSON[_0x6ed7('0x13')](_0x6cc1a0));_0xf08ae4(_0x6cc1a0);})['catch'](function(_0x591f43){logger[_0x6ed7('0x14')](_0x6ed7('0x25'),_0x591f43['message'],_0x180b16);_0x2146a1(_this[_0x6ed7('0x14')](0x1f4,_0x591f43[_0x6ed7('0x16')]));});});}; \ No newline at end of file +var _0x8069=['message','catch','UpdateWhatsappInteraction','WhatsappInteraction','options','attributes','limit','AddTagsToWhatsappInteraction','find','where','addTags','body','omit','ids','spread','info','AddTags','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','redis','localhost','then','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x4651d2,_0x144909){var _0x48aa49=function(_0x178185){while(--_0x178185){_0x4651d2['push'](_0x4651d2['shift']());}};_0x48aa49(++_0x144909);}(_0x8069,0x114));var _0x9806=function(_0x24c918,_0x4a8aa8){_0x24c918=_0x24c918-0x0;var _0x5678e6=_0x8069[_0x24c918];return _0x5678e6;};'use strict';var _=require(_0x9806('0x0'));var util=require(_0x9806('0x1'));var moment=require(_0x9806('0x2'));var BPromise=require(_0x9806('0x3'));var rs=require(_0x9806('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9806('0x5'));var logger=require(_0x9806('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9806('0x7'));var client=jayson[_0x9806('0x8')][_0x9806('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x9806('0xa')],{'host':_0x9806('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x5a93b4,_0x363af0,_0x281ef7){return new BPromise(function(_0x657e27,_0xab1e6f){return client['request'](_0x5a93b4,_0x281ef7)[_0x9806('0xc')](function(_0x4821b8){logger['info'](_0x9806('0xd'),_0x363af0,_0x9806('0xe'));logger[_0x9806('0xf')](_0x9806('0x10'),_0x363af0,'request\x20sent',JSON[_0x9806('0x11')](_0x4821b8));if(_0x4821b8['error']){if(_0x4821b8['error'][_0x9806('0x12')]===0x1f4){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x363af0,_0x4821b8[_0x9806('0x13')]['message']);return _0xab1e6f(_0x4821b8[_0x9806('0x13')][_0x9806('0x14')]);}logger[_0x9806('0x13')](_0x9806('0xd'),_0x363af0,_0x4821b8[_0x9806('0x13')]['message']);return _0x657e27(_0x4821b8[_0x9806('0x13')][_0x9806('0x14')]);}else{logger['info'](_0x9806('0xd'),_0x363af0,_0x9806('0xe'));_0x657e27(_0x4821b8['result'][_0x9806('0x14')]);}})[_0x9806('0x15')](function(_0x5e324b){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x363af0,_0x5e324b);_0xab1e6f(_0x5e324b);});});}exports[_0x9806('0x16')]=function(_0x126831){var _0x30e049=this;return new Promise(function(_0x1b2e47,_0x462355){return db[_0x9806('0x17')]['update'](_0x126831['body'],{'raw':_0x126831[_0x9806('0x18')]?_0x126831[_0x9806('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x126831[_0x9806('0x18')]?_0x126831[_0x9806('0x18')]['where']||null:null,'attributes':_0x126831[_0x9806('0x18')]?_0x126831[_0x9806('0x18')][_0x9806('0x19')]||null:null,'limit':_0x126831[_0x9806('0x18')]?_0x126831['options'][_0x9806('0x1a')]||null:null})[_0x9806('0xc')](function(_0x478126){logger['info']('UpdateWhatsappInteraction',_0x126831);logger['debug'](_0x9806('0x16'),_0x126831,JSON[_0x9806('0x11')](_0x478126));_0x1b2e47(_0x478126);})[_0x9806('0x15')](function(_0x4d1d1c){logger[_0x9806('0x13')](_0x9806('0x16'),_0x4d1d1c[_0x9806('0x14')],_0x126831);_0x462355(_0x30e049[_0x9806('0x13')](0x1f4,_0x4d1d1c[_0x9806('0x14')]));});});};exports[_0x9806('0x1b')]=function(_0x34b147){return new Promise(function(_0x1d232b,_0x47b54c){return db['WhatsappInteraction'][_0x9806('0x1c')]({'where':_0x34b147[_0x9806('0x18')]?_0x34b147[_0x9806('0x18')][_0x9806('0x1d')]||null:null})[_0x9806('0xc')](function(_0x14e43b){if(_0x14e43b){return _0x14e43b[_0x9806('0x1e')](_0x34b147[_0x9806('0x1f')]['ids'],_[_0x9806('0x20')](_0x34b147[_0x9806('0x1f')],[_0x9806('0x21'),'id'])||{});}})[_0x9806('0x22')](function(_0x598fb7){logger[_0x9806('0x23')](_0x9806('0x24'),_0x34b147);logger['debug'](_0x9806('0x24'),_0x34b147,JSON[_0x9806('0x11')](_0x598fb7));_0x1d232b(_0x598fb7);})[_0x9806('0x15')](function(_0x51d73f){logger[_0x9806('0x13')](_0x9806('0x24'),_0x51d73f[_0x9806('0x14')],_0x34b147);_0x47b54c(_this[_0x9806('0x13')](0x1f4,_0x51d73f[_0x9806('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 702bbcd..ead3985 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 _0xfbac=['./whatsappInteraction.events','save','emit','removeListener','register','length','whatsappInteraction:'];(function(_0x512978,_0xf18ee){var _0x28b88b=function(_0x342b9f){while(--_0x342b9f){_0x512978['push'](_0x512978['shift']());}};_0x28b88b(++_0xf18ee);}(_0xfbac,0xa1));var _0xcfba=function(_0x27d700,_0x36c6a9){_0x27d700=_0x27d700-0x0;var _0xd72d05=_0xfbac[_0x27d700];return _0xd72d05;};'use strict';var WhatsappInteractionEvents=require(_0xcfba('0x0'));var events=[_0xcfba('0x1'),'remove','update'];function createListener(_0x17af4d,_0x4e0d52){return function(_0x562a91){_0x4e0d52[_0xcfba('0x2')](_0x17af4d,_0x562a91);};}function removeListener(_0x13c556,_0x5a8bb7){return function(){WhatsappInteractionEvents[_0xcfba('0x3')](_0x13c556,_0x5a8bb7);};}exports[_0xcfba('0x4')]=function(_0x460cd3){for(var _0x431e1a=0x0,_0x386c45=events[_0xcfba('0x5')];_0x431e1a<_0x386c45;_0x431e1a++){var _0x291721=events[_0x431e1a];var _0x16cb5f=createListener(_0xcfba('0x6')+_0x291721,_0x460cd3);WhatsappInteractionEvents['on'](_0x291721,_0x16cb5f);}}; \ No newline at end of file +var _0xb57c=['update','emit','removeListener','register','length','remove'];(function(_0x116482,_0x2438c5){var _0x23c467=function(_0x18c6c8){while(--_0x18c6c8){_0x116482['push'](_0x116482['shift']());}};_0x23c467(++_0x2438c5);}(_0xb57c,0x1c7));var _0xcb57=function(_0x5f40c2,_0xdecacf){_0x5f40c2=_0x5f40c2-0x0;var _0x70a2ea=_0xb57c[_0x5f40c2];return _0x70a2ea;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=['save',_0xcb57('0x0'),_0xcb57('0x1')];function createListener(_0x16298b,_0x53fd27){return function(_0x5d0f53){_0x53fd27[_0xcb57('0x2')](_0x16298b,_0x5d0f53);};}function removeListener(_0x2570b5,_0x4d341b){return function(){WhatsappInteractionEvents[_0xcb57('0x3')](_0x2570b5,_0x4d341b);};}exports[_0xcb57('0x4')]=function(_0x5765a9){for(var _0x27d69d=0x0,_0x13812a=events[_0xcb57('0x5')];_0x27d69d<_0x13812a;_0x27d69d++){var _0x146d90=events[_0x27d69d];var _0x5186af=createListener('whatsappInteraction:'+_0x146d90,_0x5765a9);WhatsappInteractionEvents['on'](_0x146d90,_0x5186af);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 8588013..9ab8508 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 _0xf55b=['tracked','whatsappmessage:create','create','/:id/status','update','put','/:id/accept','/:id/reject','reject','delete','destroy','multer','connect-timeout','express','../../components/auth/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x33543c,_0x39744e){var _0x50e5cd=function(_0x49a167){while(--_0x49a167){_0x33543c['push'](_0x33543c['shift']());}};_0x50e5cd(++_0x39744e);}(_0xf55b,0x150));var _0xbf55=function(_0x25b30b,_0x3ab46d){_0x25b30b=_0x25b30b-0x0;var _0x1ef6cf=_0xf55b[_0x25b30b];return _0x1ef6cf;};'use strict';var multer=require(_0xbf55('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xbf55('0x1'));var express=require(_0xbf55('0x2'));var router=express['Router']();var auth=require(_0xbf55('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xbf55('0x4'));var controller=require(_0xbf55('0x5'));router[_0xbf55('0x6')]('/',auth[_0xbf55('0x7')](),controller[_0xbf55('0x8')]);router['get'](_0xbf55('0x9'),auth[_0xbf55('0x7')](),controller[_0xbf55('0xa')]);router[_0xbf55('0x6')](_0xbf55('0xb'),auth['isAuthenticated'](),controller[_0xbf55('0xc')]);router[_0xbf55('0xd')]('/',auth[_0xbf55('0x7')](),interaction[_0xbf55('0xe')]('whatsapp',_0xbf55('0xf')),controller[_0xbf55('0x10')]);router[_0xbf55('0xd')](_0xbf55('0x11'),controller['status']);router['put'](_0xbf55('0xb'),auth[_0xbf55('0x7')](),controller[_0xbf55('0x12')]);router[_0xbf55('0x13')](_0xbf55('0x14'),auth[_0xbf55('0x7')](),controller['accept']);router[_0xbf55('0x13')](_0xbf55('0x15'),auth['isAuthenticated'](),controller[_0xbf55('0x16')]);router[_0xbf55('0x17')](_0xbf55('0xb'),auth[_0xbf55('0x7')](),controller[_0xbf55('0x18')]);module['exports']=router; \ No newline at end of file +var _0x1d99=['./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','whatsapp','status','update','put','reject','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4fd68d,_0x33a726){var _0x4643c4=function(_0x59520d){while(--_0x59520d){_0x4fd68d['push'](_0x4fd68d['shift']());}};_0x4643c4(++_0x33a726);}(_0x1d99,0xbf));var _0x91d9=function(_0x5b52a4,_0x4de1de){_0x5b52a4=_0x5b52a4-0x0;var _0x2bc99e=_0x1d99[_0x5b52a4];return _0x2bc99e;};'use strict';var multer=require(_0x91d9('0x0'));var util=require('util');var path=require(_0x91d9('0x1'));var timeout=require(_0x91d9('0x2'));var express=require('express');var router=express[_0x91d9('0x3')]();var auth=require(_0x91d9('0x4'));var interaction=require(_0x91d9('0x5'));var config=require(_0x91d9('0x6'));var controller=require(_0x91d9('0x7'));router[_0x91d9('0x8')]('/',auth[_0x91d9('0x9')](),controller[_0x91d9('0xa')]);router['get'](_0x91d9('0xb'),auth[_0x91d9('0x9')](),controller[_0x91d9('0xc')]);router[_0x91d9('0x8')](_0x91d9('0xd'),auth[_0x91d9('0x9')](),controller['show']);router[_0x91d9('0xe')]('/',auth[_0x91d9('0x9')](),interaction[_0x91d9('0xf')](_0x91d9('0x10'),'whatsappmessage:create'),controller['create']);router[_0x91d9('0xe')]('/:id/status',controller[_0x91d9('0x11')]);router['put'](_0x91d9('0xd'),auth[_0x91d9('0x9')](),controller[_0x91d9('0x12')]);router['put']('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x91d9('0x13')]('/:id/reject',auth[_0x91d9('0x9')](),controller[_0x91d9('0x14')]);router['delete'](_0x91d9('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x91d9('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 975c8b8..b7f7cd2 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 _0x23d2=['STRING','DATE','sequelize','exports','medium','BOOLEAN','out'];(function(_0x269bfc,_0x3ba834){var _0x5d4676=function(_0x552ec2){while(--_0x552ec2){_0x269bfc['push'](_0x269bfc['shift']());}};_0x5d4676(++_0x3ba834);}(_0x23d2,0x18a));var _0x223d=function(_0x255c65,_0x3444b8){_0x255c65=_0x255c65-0x0;var _0x23e230=_0x23d2[_0x255c65];return _0x23e230;};'use strict';var Sequelize=require(_0x223d('0x0'));module[_0x223d('0x1')]={'body':{'type':Sequelize['TEXT'](_0x223d('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x223d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x223d('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x223d('0x5')](0xbe)},'phone':{'type':Sequelize[_0x223d('0x5')]},'readAt':{'type':Sequelize[_0x223d('0x6')]},'secret':{'type':Sequelize[_0x223d('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x0ad6=['TEXT','BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports'];(function(_0x2fbd0e,_0x3460a9){var _0x481c9f=function(_0x4bc402){while(--_0x4bc402){_0x2fbd0e['push'](_0x2fbd0e['shift']());}};_0x481c9f(++_0x3460a9);}(_0x0ad6,0x7e));var _0x60ad=function(_0x400294,_0x4317c6){_0x400294=_0x400294-0x0;var _0x5e7681=_0x0ad6[_0x400294];return _0x5e7681;};'use strict';var Sequelize=require(_0x60ad('0x0'));module[_0x60ad('0x1')]={'body':{'type':Sequelize[_0x60ad('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x60ad('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x60ad('0x4')]('in',_0x60ad('0x5')),'defaultValue':_0x60ad('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x60ad('0x6')](0xbe)},'phone':{'type':Sequelize[_0x60ad('0x6')]},'readAt':{'type':Sequelize[_0x60ad('0x7')]},'secret':{'type':Sequelize[_0x60ad('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 ebb38da..14b008d 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 _0x19d9=['include','findAll','show','params','includeAll','options','find','create','body','destroy','describe','accept','whatsapp','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','WhatsappInteractionId','update','isNil','read1stAt','format','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','MessageStatus','twilio','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','redis','defaults','localhost','./whatsappMessage.socket','register','jayson/promise','client','http','ValidationError','request','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','code','WhatsappMessage,\x20%s,\x20%s','error','message','result','catch','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','stack','name','map','WhatsappMessage','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','type','VIRTUAL','merge'];(function(_0x4b5813,_0x5769de){var _0x423465=function(_0x18071f){while(--_0x18071f){_0x4b5813['push'](_0x4b5813['shift']());}};_0x423465(++_0x5769de);}(_0x19d9,0x1bd));var _0x919d=function(_0x50225f,_0x1148fa){_0x50225f=_0x50225f-0x0;var _0x2a5625=_0x19d9[_0x50225f];return _0x2a5625;};'use strict';var pdf=require(_0x919d('0x0'));var emlformat=require(_0x919d('0x1'));var rimraf=require(_0x919d('0x2'));var zipdir=require(_0x919d('0x3'));var jsonpatch=require(_0x919d('0x4'));var rp=require(_0x919d('0x5'));var moment=require(_0x919d('0x6'));var BPromise=require(_0x919d('0x7'));var Mustache=require(_0x919d('0x8'));var util=require(_0x919d('0x9'));var path=require(_0x919d('0xa'));var sox=require(_0x919d('0xb'));var csv=require(_0x919d('0xc'));var ejs=require(_0x919d('0xd'));var fs=require('fs');var _=require(_0x919d('0xe'));var squel=require(_0x919d('0xf'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x919d('0x10'));var toCsv=require(_0x919d('0xc'));var querystring=require(_0x919d('0x11'));var Papa=require(_0x919d('0x12'));var Redis=require(_0x919d('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x919d('0x14'));var as=require(_0x919d('0x15'));var hardwareService=require(_0x919d('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x919d('0x17'));var config=require('../../config/environment');var db=require(_0x919d('0x18'))['db'];config[_0x919d('0x19')]=_[_0x919d('0x1a')](config[_0x919d('0x19')],{'host':_0x919d('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x919d('0x1c'))[_0x919d('0x1d')](socket);var jayson=require(_0x919d('0x1e'));var client=jayson[_0x919d('0x1f')][_0x919d('0x20')]({'port':0x232c});var client9002=jayson['client'][_0x919d('0x20')]({'port':0x232a});function checkPasswordPattern(_0x5403ce,_0x58a35f,_0x3b4816){if(_0x3b4816){var _0x3173af=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3173af['test'](_0x58a35f)){return _0x5403ce;}else{throw new db['Sequelize'][(_0x919d('0x21'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x5403ce;}}function respondWithRpcPromise(_0x14e100,_0x18ad6d,_0x23a0f1,_0x4df0cc){return new BPromise(function(_0xd1f53e,_0x268227){var _0x4536bc=_0x4df0cc||client;return _0x4536bc[_0x919d('0x22')](_0x14e100,_0x23a0f1)[_0x919d('0x23')](function(_0x2fcc6b){logger[_0x919d('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0x18ad6d,_0x919d('0x25'));logger[_0x919d('0x26')](_0x919d('0x27'),_0x18ad6d,_0x919d('0x25'),JSON[_0x919d('0x28')](_0x2fcc6b));if(_0x2fcc6b['error']){if(_0x2fcc6b['error'][_0x919d('0x29')]===0x1f4){logger['error'](_0x919d('0x2a'),_0x18ad6d,_0x2fcc6b[_0x919d('0x2b')][_0x919d('0x2c')]);return _0x268227(_0x2fcc6b['error'][_0x919d('0x2c')]);}logger['error'](_0x919d('0x2a'),_0x18ad6d,_0x2fcc6b[_0x919d('0x2b')][_0x919d('0x2c')]);return _0xd1f53e(_0x2fcc6b[_0x919d('0x2b')]['message']);}else{logger[_0x919d('0x24')](_0x919d('0x2a'),_0x18ad6d,_0x919d('0x25'));_0xd1f53e(_0x2fcc6b[_0x919d('0x2d')][_0x919d('0x2c')]);}})[_0x919d('0x2e')](function(_0xc2bd37){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x18ad6d,_0xc2bd37);_0x268227(_0xc2bd37);});});}function respondWithStatusCode(_0x1ca487,_0x10870d){_0x10870d=_0x10870d||0xcc;return function(_0x3e1c5a){if(_0x3e1c5a){return _0x1ca487['sendStatus'](_0x10870d);}return _0x1ca487['status'](_0x10870d)[_0x919d('0x2f')]();};}function respondWithResult(_0x4ddf39,_0x5b20d6){_0x5b20d6=_0x5b20d6||0xc8;return function(_0x403da6){if(_0x403da6){return _0x4ddf39[_0x919d('0x30')](_0x5b20d6)[_0x919d('0x31')](_0x403da6);}};}function respondWithFilteredResult(_0x126ba6,_0x18e56b){return function(_0xd517ad){if(_0xd517ad){var _0x322216=_0xd517ad[_0x919d('0x32')],_0x41c6af=_0x18e56b[_0x919d('0x33')],_0x438770=_0x18e56b[_0x919d('0x33')]+_0x18e56b[_0x919d('0x34')],_0x5b3b0d;if(_0x438770>=_0x322216){_0x438770=_0x322216;_0x5b3b0d=0xc8;}else{_0x5b3b0d=0xce;}_0x126ba6['status'](_0x5b3b0d);return _0x126ba6[_0x919d('0x35')](_0x919d('0x36'),_0x41c6af+'-'+_0x438770+'/'+_0x322216)['json'](_0xd517ad);}return null;};}function patchUpdates(_0x2c29a1){return function(_0x2ed1bf){try{jsonpatch[_0x919d('0x37')](_0x2ed1bf,_0x2c29a1,!![]);}catch(_0x49f41d){return BPromise[_0x919d('0x38')](_0x49f41d);}return _0x2ed1bf[_0x919d('0x39')]();};}function saveUpdates(_0x212b9c,_0x2f9053){return function(_0x20ecf5){if(_0x20ecf5){return _0x20ecf5['update'](_0x212b9c)['then'](function(_0x10dd29){return _0x10dd29;});}return null;};}function removeEntity(_0x1d9aea,_0x12feb7){return function(_0x4ea4ac){if(_0x4ea4ac){return _0x4ea4ac['destroy']()[_0x919d('0x23')](function(){_0x1d9aea[_0x919d('0x30')](0xcc)[_0x919d('0x2f')]();});}};}function handleEntityNotFound(_0x10753e,_0x28b68d){return function(_0x4f9204){if(!_0x4f9204){_0x10753e['sendStatus'](0x194);}return _0x4f9204;};}function handleError(_0x39a008,_0xe3fbd5){_0xe3fbd5=_0xe3fbd5||0x1f4;return function(_0x2eb497){logger[_0x919d('0x2b')](_0x2eb497[_0x919d('0x3a')]);if(_0x2eb497[_0x919d('0x3b')]){delete _0x2eb497['name'];}_0x39a008['status'](_0xe3fbd5)['send'](_0x2eb497);};}exports['index']=function(_0x349f70,_0x4934ee){var _0x17e90f={},_0x68e84e={},_0x1e4efe={'count':0x0,'rows':[]};var _0xd4bc95=_[_0x919d('0x3c')](db[_0x919d('0x3d')][_0x919d('0x3e')],function(_0xecc464){return{'name':_0xecc464[_0x919d('0x3f')],'type':_0xecc464['type']['key']};});_0x68e84e[_0x919d('0x40')]=_[_0x919d('0x3c')](_0xd4bc95,_0x919d('0x3b'));_0x68e84e[_0x919d('0x41')]=_[_0x919d('0x42')](_0x349f70['query']);_0x68e84e[_0x919d('0x43')]=_[_0x919d('0x44')](_0x68e84e[_0x919d('0x40')],_0x68e84e[_0x919d('0x41')]);_0x17e90f[_0x919d('0x45')]=_[_0x919d('0x44')](_0x68e84e['model'],qs[_0x919d('0x46')](_0x349f70[_0x919d('0x41')]['fields']));_0x17e90f[_0x919d('0x45')]=_0x17e90f[_0x919d('0x45')][_0x919d('0x47')]?_0x17e90f['attributes']:_0x68e84e[_0x919d('0x40')];if(!_0x349f70['query'][_0x919d('0x48')]('nolimit')){_0x17e90f[_0x919d('0x34')]=qs[_0x919d('0x34')](_0x349f70[_0x919d('0x41')][_0x919d('0x34')]);_0x17e90f[_0x919d('0x33')]=qs[_0x919d('0x33')](_0x349f70[_0x919d('0x41')][_0x919d('0x33')]);}_0x17e90f['order']=qs[_0x919d('0x49')](_0x349f70[_0x919d('0x41')]['sort']);_0x17e90f[_0x919d('0x4a')]=qs[_0x919d('0x43')](_[_0x919d('0x4b')](_0x349f70[_0x919d('0x41')],_0x68e84e[_0x919d('0x43')]),_0xd4bc95);if(_0x349f70[_0x919d('0x41')]['filter']){_0x17e90f[_0x919d('0x4a')]=_['merge'](_0x17e90f[_0x919d('0x4a')],{'$or':_['map'](_0xd4bc95,function(_0x4c21db){if(_0x4c21db[_0x919d('0x4c')]!==_0x919d('0x4d')){var _0x5c1765={};_0x5c1765[_0x4c21db[_0x919d('0x3b')]]={'$like':'%'+_0x349f70[_0x919d('0x41')]['filter']+'%'};return _0x5c1765;}})});}_0x17e90f=_[_0x919d('0x4e')]({},_0x17e90f,_0x349f70['options']);var _0xa53430={'where':_0x17e90f[_0x919d('0x4a')]};return db[_0x919d('0x3d')][_0x919d('0x32')](_0xa53430)[_0x919d('0x23')](function(_0x5e6b34){_0x1e4efe[_0x919d('0x32')]=_0x5e6b34;if(_0x349f70[_0x919d('0x41')]['includeAll']){_0x17e90f[_0x919d('0x4f')]=[{'all':!![]}];}return db[_0x919d('0x3d')][_0x919d('0x50')](_0x17e90f);})[_0x919d('0x23')](function(_0x3513bd){_0x1e4efe['rows']=_0x3513bd;return _0x1e4efe;})[_0x919d('0x23')](respondWithFilteredResult(_0x4934ee,_0x17e90f))[_0x919d('0x2e')](handleError(_0x4934ee,null));};exports[_0x919d('0x51')]=function(_0x4a2b61,_0x1cbf38){var _0x57a695={'raw':!![],'where':{'id':_0x4a2b61[_0x919d('0x52')]['id']}},_0x514979={};_0x514979[_0x919d('0x40')]=_[_0x919d('0x42')](db[_0x919d('0x3d')][_0x919d('0x3e')]);_0x514979['query']=_['keys'](_0x4a2b61[_0x919d('0x41')]);_0x514979[_0x919d('0x43')]=_[_0x919d('0x44')](_0x514979[_0x919d('0x40')],_0x514979[_0x919d('0x41')]);_0x57a695[_0x919d('0x45')]=_[_0x919d('0x44')](_0x514979[_0x919d('0x40')],qs['fields'](_0x4a2b61[_0x919d('0x41')][_0x919d('0x46')]));_0x57a695[_0x919d('0x45')]=_0x57a695['attributes']['length']?_0x57a695[_0x919d('0x45')]:_0x514979['model'];if(_0x4a2b61[_0x919d('0x41')][_0x919d('0x53')]){_0x57a695[_0x919d('0x4f')]=[{'all':!![]}];}_0x57a695=_['merge']({},_0x57a695,_0x4a2b61[_0x919d('0x54')]);return db[_0x919d('0x3d')][_0x919d('0x55')](_0x57a695)[_0x919d('0x23')](handleEntityNotFound(_0x1cbf38,null))[_0x919d('0x23')](respondWithResult(_0x1cbf38,null))[_0x919d('0x2e')](handleError(_0x1cbf38,null));};exports[_0x919d('0x56')]=function(_0x334eb0,_0x146cc6){return db[_0x919d('0x3d')][_0x919d('0x56')](_0x334eb0[_0x919d('0x57')],{})['then'](respondWithResult(_0x146cc6,0xc9))[_0x919d('0x2e')](handleError(_0x146cc6,null));};exports['update']=function(_0x456671,_0x564d2c){if(_0x456671[_0x919d('0x57')]['id']){delete _0x456671[_0x919d('0x57')]['id'];}return db[_0x919d('0x3d')]['find']({'where':{'id':_0x456671[_0x919d('0x52')]['id']}})[_0x919d('0x23')](handleEntityNotFound(_0x564d2c,null))[_0x919d('0x23')](saveUpdates(_0x456671[_0x919d('0x57')],null))[_0x919d('0x23')](respondWithResult(_0x564d2c,null))[_0x919d('0x2e')](handleError(_0x564d2c,null));};exports[_0x919d('0x58')]=function(_0x175c2e,_0x40b984){return db[_0x919d('0x3d')]['find']({'where':{'id':_0x175c2e[_0x919d('0x52')]['id']}})[_0x919d('0x23')](handleEntityNotFound(_0x40b984,null))[_0x919d('0x23')](removeEntity(_0x40b984,null))[_0x919d('0x2e')](handleError(_0x40b984,null));};exports[_0x919d('0x59')]=function(_0x1b1732,_0x15fe92){return db[_0x919d('0x3d')][_0x919d('0x59')]()[_0x919d('0x23')](respondWithResult(_0x15fe92,null))['catch'](handleError(_0x15fe92,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports[_0x919d('0x5a')]=function(_0x231041,_0x3f899e,_0x6d8e84){var _0x1109dc={'channel':_0x919d('0x5b')};if(_0x231041[_0x919d('0x57')]['id']){delete _0x231041['body']['id'];}_0x231041[_0x919d('0x57')][_0x919d('0x5c')]=!![];_0x231041[_0x919d('0x57')][_0x919d('0x5d')]=moment()['format'](_0x919d('0x5e'));_0x231041['body'][_0x919d('0x5f')]=_0x231041['body'][_0x919d('0x5f')]||_0x231041[_0x919d('0x60')]['id'];return db['WhatsappMessage']['find']({'where':{'id':_0x231041['params']['id'],'UserId':null},'include':[{'model':db[_0x919d('0x61')],'as':_0x919d('0x62')}]})[_0x919d('0x23')](handleEntityNotFound(_0x3f899e,null))[_0x919d('0x23')](saveUpdates(_0x231041[_0x919d('0x57')],null))[_0x919d('0x23')](function(_0x403a00){if(_0x403a00){_0x1109dc[_0x919d('0x2c')]=_0x403a00[_0x919d('0x63')]({'plain':!![]});return db['WhatsappInteraction'][_0x919d('0x55')]({'where':{'id':_0x403a00[_0x919d('0x64')]}});}return null;})[_0x919d('0x23')](handleEntityNotFound(_0x3f899e,null))['then'](function(_0x1bf103){if(_0x1bf103){return _0x1bf103[_0x919d('0x65')]({'UserId':_0x231041[_0x919d('0x57')][_0x919d('0x5f')],'read1stAt':_[_0x919d('0x66')](_0x1bf103[_0x919d('0x67')])?moment()[_0x919d('0x68')](_0x919d('0x5e')):undefined});}return null;})[_0x919d('0x23')](function(_0x4e8b16){if(_0x4e8b16){_0x1109dc[_0x919d('0x69')]=_0x4e8b16[_0x919d('0x63')]({'plain':!![]});interaction_log[_0x919d('0x24')](_0x919d('0x6a'),_0x231041[_0x919d('0x60')]['id'],_0x231041[_0x919d('0x60')][_0x919d('0x3b')],_0x231041[_0x919d('0x60')]['role'],_0x1109dc[_0x919d('0x69')]['id'],_0x231041['body']?JSON['stringify'](_0x231041['body']):_0x919d('0x6b'));return respondWithRpcPromise('AcceptMessage',_0x919d('0x6c'),_0x1109dc);}return null;})[_0x919d('0x23')](function(_0x10a97a){if(_0x10a97a){if(_0x231041['body'][_0x919d('0x6d')]){_0x1109dc['message'][_0x919d('0x6e')]=util[_0x919d('0x68')](_0x919d('0x6f'),_0x231041[_0x919d('0x60')][_0x919d('0x3b')]);_0x1109dc[_0x919d('0x2c')][_0x919d('0x70')]=_0x1109dc[_0x919d('0x70')];_0x1109dc['message'][_0x919d('0x71')]=_0x919d('0x5a');return respondWithRpcPromise(_0x919d('0x72'),_0x919d('0x72'),{'event':_0x919d('0x73'),'message':_0x1109dc[_0x919d('0x2c')]},client9002)['then'](function(){return _0x1109dc;});}return _0x1109dc;}return null;})[_0x919d('0x23')](respondWithResult(_0x3f899e,null))['catch'](handleError(_0x3f899e,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports[_0x919d('0x38')]=function(_0x12d9f2,_0x1a0140,_0x5950db){var _0x2a2042={'agent':{},'channel':_0x919d('0x5b')};if(_0x12d9f2['body']['id']){delete _0x12d9f2[_0x919d('0x57')]['id'];}_0x12d9f2['body'][_0x919d('0x5f')]=_0x12d9f2[_0x919d('0x57')][_0x919d('0x5f')]||_0x12d9f2[_0x919d('0x60')]['id'];_0x2a2042['agent']['id']=_0x12d9f2['body'][_0x919d('0x5f')];return db['WhatsappMessage']['find']({'where':{'id':_0x12d9f2['params']['id'],'UserId':null}})[_0x919d('0x23')](handleEntityNotFound(_0x1a0140,null))[_0x919d('0x23')](function(_0x2c15bb){if(_0x2c15bb){_0x2a2042[_0x919d('0x2c')]=_0x2c15bb['get']({'plain':!![]});return db[_0x919d('0x74')][_0x919d('0x55')]({'where':{'id':_0x2c15bb[_0x919d('0x64')]}});}return null;})[_0x919d('0x23')](handleEntityNotFound(_0x1a0140,null))['then'](function(_0x288f05){if(_0x288f05){_0x2a2042[_0x919d('0x69')]=_0x288f05['get']({'plain':!![]});interaction_log['info'](_0x919d('0x75'),_0x12d9f2[_0x919d('0x60')]['id'],_0x12d9f2[_0x919d('0x60')]['name'],_0x12d9f2[_0x919d('0x60')][_0x919d('0x76')],_0x2a2042[_0x919d('0x69')]['id'],_0x12d9f2[_0x919d('0x57')]?JSON[_0x919d('0x28')](_0x12d9f2[_0x919d('0x57')]):_0x919d('0x6b'));return respondWithRpcPromise(_0x919d('0x77'),_0x919d('0x78'),_0x2a2042);}return null;})[_0x919d('0x23')](function(_0x191753){if(_0x191753){_0x191753[_0x919d('0x2c')]['interface']=util[_0x919d('0x68')](_0x919d('0x6f'),_0x12d9f2['user'][_0x919d('0x3b')]);_0x191753[_0x919d('0x2c')][_0x919d('0x70')]=_0x2a2042['channel'];_0x191753[_0x919d('0x2c')][_0x919d('0x71')]='reject';respondWithRpcPromise(_0x919d('0x72'),_0x919d('0x72'),{'event':_0x919d('0x79'),'message':_0x191753[_0x919d('0x2c')]},client9002);return _0x2a2042;}return null;})[_0x919d('0x23')](respondWithResult(_0x1a0140,null))[_0x919d('0x2e')](handleError(_0x1a0140,null));};exports[_0x919d('0x30')]=function(_0x4e2ee0,_0x479cb1,_0x1da91f){if(_0x4e2ee0[_0x919d('0x57')]['id']){delete _0x4e2ee0['body']['id'];}var _0x4ed54d;return db[_0x919d('0x3d')][_0x919d('0x55')]({'where':{'id':_0x4e2ee0[_0x919d('0x52')]['id']}})[_0x919d('0x23')](handleEntityNotFound(_0x479cb1,null))['then'](function(_0x588f00){if(_0x588f00){_0x4ed54d=_0x588f00;return db[_0x919d('0x7a')]['find']({'where':{'id':_0x588f00[_0x919d('0x7b')]}});}})[_0x919d('0x23')](handleEntityNotFound(_0x479cb1,null))[_0x919d('0x23')](function(_0x307d43){if(_0x307d43){logger['debug'](_0x919d('0x7c'),_0x919d('0x30'),_0x919d('0x7d'),_0x307d43['type'],util[_0x919d('0x7e')](_0x4e2ee0['body'],{'showHidden':![],'depth':null}));switch(_0x307d43[_0x919d('0x4c')]){case'twilio':if(_0x4e2ee0[_0x919d('0x57')][_0x919d('0x7f')]&&_0x4e2ee0[_0x919d('0x57')]['MessageSid']===_0x4ed54d[_0x919d('0x80')]&&_0x4e2ee0[_0x919d('0x57')]['MessageStatus']&&_0x4e2ee0[_0x919d('0x57')][_0x919d('0x81')]===_0x919d('0x5c')){return _0x4ed54d['update']({'read':!![]});}else{logger[_0x919d('0x2b')]('WhatsappAccount,\x20%s,\x20%s,\x20%s','status',_0x919d('0x82'),util[_0x919d('0x7e')](_0x4e2ee0[_0x919d('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x4ed54d;}})['then'](respondWithResult(_0x479cb1,null))[_0x919d('0x2e')](handleError(_0x479cb1,null));}; \ No newline at end of file +var _0x218b=['api','../../config/utils','../../config/environment','redis','defaults','localhost','./whatsappMessage.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','limit','sort','where','filters','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','keys','find','create','body','describe','whatsapp-interactions','whatsapp','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','WhatsappInteraction','WhatsappInteractionId','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','interface','SIP/%s','channel','accept','EventManager','acceptmessage','agent','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','event','rejectmessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x186dfb,_0x4b092d){var _0x3ed8fc=function(_0x1d87e7){while(--_0x1d87e7){_0x186dfb['push'](_0x186dfb['shift']());}};_0x3ed8fc(++_0x4b092d);}(_0x218b,0x71));var _0xb218=function(_0x590b48,_0xa7d395){_0x590b48=_0x590b48-0x0;var _0x37e186=_0x218b[_0x590b48];return _0x37e186;};'use strict';var pdf=require(_0xb218('0x0'));var emlformat=require(_0xb218('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb218('0x2'));var jsonpatch=require(_0xb218('0x3'));var rp=require(_0xb218('0x4'));var moment=require(_0xb218('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb218('0x6'));var path=require(_0xb218('0x7'));var sox=require(_0xb218('0x8'));var csv=require(_0xb218('0x9'));var ejs=require(_0xb218('0xa'));var fs=require('fs');var _=require(_0xb218('0xb'));var squel=require(_0xb218('0xc'));var crypto=require(_0xb218('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb218('0x9'));var querystring=require('querystring');var Papa=require(_0xb218('0xe'));var Redis=require('ioredis');var authService=require(_0xb218('0xf'));var qs=require(_0xb218('0x10'));var as=require(_0xb218('0x11'));var hardwareService=require(_0xb218('0x12'));var logger=require(_0xb218('0x13'))(_0xb218('0x14'));var utils=require(_0xb218('0x15'));var config=require(_0xb218('0x16'));var db=require('../../mysqldb')['db'];config[_0xb218('0x17')]=_[_0xb218('0x18')](config['redis'],{'host':_0xb218('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb218('0x17')]));require(_0xb218('0x1a'))[_0xb218('0x1b')](socket);var jayson=require(_0xb218('0x1c'));var client=jayson[_0xb218('0x1d')][_0xb218('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0xb218('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x4f27bc,_0x11fa56,_0x345a7f){if(_0x345a7f){var _0x1c97cb=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1c97cb[_0xb218('0x1f')](_0x11fa56)){return _0x4f27bc;}else{throw new db[(_0xb218('0x20'))][(_0xb218('0x21'))](_0xb218('0x22'));}}else{return _0x4f27bc;}}function respondWithRpcPromise(_0xf94ae1,_0x5b16b4,_0x3ce32f,_0x4f95f4){return new BPromise(function(_0xb1b101,_0x16fb0d){var _0x1afbef=_0x4f95f4||client;return _0x1afbef[_0xb218('0x23')](_0xf94ae1,_0x3ce32f)[_0xb218('0x24')](function(_0x5b7651){logger[_0xb218('0x25')](_0xb218('0x26'),_0x5b16b4,_0xb218('0x27'));logger[_0xb218('0x28')](_0xb218('0x29'),_0x5b16b4,_0xb218('0x27'),JSON[_0xb218('0x2a')](_0x5b7651));if(_0x5b7651[_0xb218('0x2b')]){if(_0x5b7651[_0xb218('0x2b')][_0xb218('0x2c')]===0x1f4){logger[_0xb218('0x2b')](_0xb218('0x26'),_0x5b16b4,_0x5b7651[_0xb218('0x2b')]['message']);return _0x16fb0d(_0x5b7651[_0xb218('0x2b')][_0xb218('0x2d')]);}logger[_0xb218('0x2b')](_0xb218('0x26'),_0x5b16b4,_0x5b7651[_0xb218('0x2b')][_0xb218('0x2d')]);return _0xb1b101(_0x5b7651['error'][_0xb218('0x2d')]);}else{logger[_0xb218('0x25')]('WhatsappMessage,\x20%s,\x20%s',_0x5b16b4,'request\x20sent');_0xb1b101(_0x5b7651[_0xb218('0x2e')]['message']);}})[_0xb218('0x2f')](function(_0x80176){logger[_0xb218('0x2b')]('WhatsappMessage,\x20%s,\x20%s',_0x5b16b4,_0x80176);_0x16fb0d(_0x80176);});});}function respondWithStatusCode(_0x4ea69f,_0x43c445){_0x43c445=_0x43c445||0xcc;return function(_0x177aad){if(_0x177aad){return _0x4ea69f[_0xb218('0x30')](_0x43c445);}return _0x4ea69f[_0xb218('0x31')](_0x43c445)[_0xb218('0x32')]();};}function respondWithResult(_0x1a51d0,_0x246b80){_0x246b80=_0x246b80||0xc8;return function(_0x4a4647){if(_0x4a4647){return _0x1a51d0[_0xb218('0x31')](_0x246b80)[_0xb218('0x33')](_0x4a4647);}};}function respondWithFilteredResult(_0x35357a,_0x5a42c4){return function(_0x1b6866){if(_0x1b6866){var _0x2de297=_0x1b6866[_0xb218('0x34')],_0x815dd4=_0x5a42c4[_0xb218('0x35')],_0x571f48=_0x5a42c4[_0xb218('0x35')]+_0x5a42c4['limit'],_0x4f4947;if(_0x571f48>=_0x2de297){_0x571f48=_0x2de297;_0x4f4947=0xc8;}else{_0x4f4947=0xce;}_0x35357a[_0xb218('0x31')](_0x4f4947);return _0x35357a[_0xb218('0x36')](_0xb218('0x37'),_0x815dd4+'-'+_0x571f48+'/'+_0x2de297)[_0xb218('0x33')](_0x1b6866);}return null;};}function patchUpdates(_0xf1fd87){return function(_0xb2f01){try{jsonpatch[_0xb218('0x38')](_0xb2f01,_0xf1fd87,!![]);}catch(_0x3059eb){return BPromise[_0xb218('0x39')](_0x3059eb);}return _0xb2f01['save']();};}function saveUpdates(_0x4b740e,_0x53f6be){return function(_0x18ddc9){if(_0x18ddc9){return _0x18ddc9[_0xb218('0x3a')](_0x4b740e)[_0xb218('0x24')](function(_0x234693){return _0x234693;});}return null;};}function removeEntity(_0x19ef17,_0x486f6){return function(_0x5a07e7){if(_0x5a07e7){return _0x5a07e7[_0xb218('0x3b')]()[_0xb218('0x24')](function(){_0x19ef17['status'](0xcc)[_0xb218('0x32')]();});}};}function handleEntityNotFound(_0x374628,_0x4d80c2){return function(_0x147063){if(!_0x147063){_0x374628[_0xb218('0x30')](0x194);}return _0x147063;};}function handleError(_0x472050,_0x493919){_0x493919=_0x493919||0x1f4;return function(_0x3b7c33){logger[_0xb218('0x2b')](_0x3b7c33[_0xb218('0x3c')]);if(_0x3b7c33[_0xb218('0x3d')]){delete _0x3b7c33['name'];}_0x472050['status'](_0x493919)[_0xb218('0x3e')](_0x3b7c33);};}exports[_0xb218('0x3f')]=function(_0x5ebd2b,_0x1c1ab7){var _0xa407cc={},_0x12c247={},_0x39f9d0={'count':0x0,'rows':[]};var _0x11cf26=_[_0xb218('0x40')](db[_0xb218('0x41')][_0xb218('0x42')],function(_0x187927){return{'name':_0x187927[_0xb218('0x43')],'type':_0x187927[_0xb218('0x44')][_0xb218('0x45')]};});_0x12c247[_0xb218('0x46')]=_[_0xb218('0x40')](_0x11cf26,'name');_0x12c247['query']=_['keys'](_0x5ebd2b[_0xb218('0x47')]);_0x12c247['filters']=_[_0xb218('0x48')](_0x12c247[_0xb218('0x46')],_0x12c247[_0xb218('0x47')]);_0xa407cc[_0xb218('0x49')]=_[_0xb218('0x48')](_0x12c247['model'],qs[_0xb218('0x4a')](_0x5ebd2b['query'][_0xb218('0x4a')]));_0xa407cc[_0xb218('0x49')]=_0xa407cc[_0xb218('0x49')][_0xb218('0x4b')]?_0xa407cc['attributes']:_0x12c247[_0xb218('0x46')];if(!_0x5ebd2b[_0xb218('0x47')]['hasOwnProperty'](_0xb218('0x4c'))){_0xa407cc[_0xb218('0x4d')]=qs[_0xb218('0x4d')](_0x5ebd2b[_0xb218('0x47')][_0xb218('0x4d')]);_0xa407cc[_0xb218('0x35')]=qs[_0xb218('0x35')](_0x5ebd2b[_0xb218('0x47')][_0xb218('0x35')]);}_0xa407cc['order']=qs[_0xb218('0x4e')](_0x5ebd2b[_0xb218('0x47')]['sort']);_0xa407cc[_0xb218('0x4f')]=qs['filters'](_['pick'](_0x5ebd2b[_0xb218('0x47')],_0x12c247[_0xb218('0x50')]),_0x11cf26);if(_0x5ebd2b['query']['filter']){_0xa407cc[_0xb218('0x4f')]=_[_0xb218('0x51')](_0xa407cc['where'],{'$or':_[_0xb218('0x40')](_0x11cf26,function(_0x1f7ac7){if(_0x1f7ac7[_0xb218('0x44')]!==_0xb218('0x52')){var _0x150eab={};_0x150eab[_0x1f7ac7[_0xb218('0x3d')]]={'$like':'%'+_0x5ebd2b[_0xb218('0x47')][_0xb218('0x53')]+'%'};return _0x150eab;}})});}_0xa407cc=_[_0xb218('0x51')]({},_0xa407cc,_0x5ebd2b['options']);var _0xa4ea4e={'where':_0xa407cc['where']};return db[_0xb218('0x41')][_0xb218('0x34')](_0xa4ea4e)[_0xb218('0x24')](function(_0x132dbb){_0x39f9d0[_0xb218('0x34')]=_0x132dbb;if(_0x5ebd2b[_0xb218('0x47')][_0xb218('0x54')]){_0xa407cc[_0xb218('0x55')]=[{'all':!![]}];}return db[_0xb218('0x41')][_0xb218('0x56')](_0xa407cc);})[_0xb218('0x24')](function(_0x3b128){_0x39f9d0[_0xb218('0x57')]=_0x3b128;return _0x39f9d0;})[_0xb218('0x24')](respondWithFilteredResult(_0x1c1ab7,_0xa407cc))[_0xb218('0x2f')](handleError(_0x1c1ab7,null));};exports[_0xb218('0x58')]=function(_0xad07ee,_0x981493){var _0x126c2e={'raw':!![],'where':{'id':_0xad07ee[_0xb218('0x59')]['id']}},_0x4c111f={};_0x4c111f[_0xb218('0x46')]=_[_0xb218('0x5a')](db[_0xb218('0x41')][_0xb218('0x42')]);_0x4c111f['query']=_[_0xb218('0x5a')](_0xad07ee['query']);_0x4c111f['filters']=_[_0xb218('0x48')](_0x4c111f['model'],_0x4c111f['query']);_0x126c2e['attributes']=_['intersection'](_0x4c111f[_0xb218('0x46')],qs[_0xb218('0x4a')](_0xad07ee['query'][_0xb218('0x4a')]));_0x126c2e[_0xb218('0x49')]=_0x126c2e[_0xb218('0x49')][_0xb218('0x4b')]?_0x126c2e[_0xb218('0x49')]:_0x4c111f[_0xb218('0x46')];if(_0xad07ee[_0xb218('0x47')][_0xb218('0x54')]){_0x126c2e[_0xb218('0x55')]=[{'all':!![]}];}_0x126c2e=_[_0xb218('0x51')]({},_0x126c2e,_0xad07ee['options']);return db[_0xb218('0x41')][_0xb218('0x5b')](_0x126c2e)[_0xb218('0x24')](handleEntityNotFound(_0x981493,null))['then'](respondWithResult(_0x981493,null))[_0xb218('0x2f')](handleError(_0x981493,null));};exports[_0xb218('0x5c')]=function(_0x5b87cd,_0x25a81d){return db[_0xb218('0x41')][_0xb218('0x5c')](_0x5b87cd[_0xb218('0x5d')],{})[_0xb218('0x24')](respondWithResult(_0x25a81d,0xc9))[_0xb218('0x2f')](handleError(_0x25a81d,null));};exports['update']=function(_0x5c4450,_0x5b17dc){if(_0x5c4450[_0xb218('0x5d')]['id']){delete _0x5c4450['body']['id'];}return db[_0xb218('0x41')][_0xb218('0x5b')]({'where':{'id':_0x5c4450[_0xb218('0x59')]['id']}})[_0xb218('0x24')](handleEntityNotFound(_0x5b17dc,null))[_0xb218('0x24')](saveUpdates(_0x5c4450['body'],null))[_0xb218('0x24')](respondWithResult(_0x5b17dc,null))[_0xb218('0x2f')](handleError(_0x5b17dc,null));};exports['destroy']=function(_0x427114,_0x317c46){return db['WhatsappMessage']['find']({'where':{'id':_0x427114[_0xb218('0x59')]['id']}})[_0xb218('0x24')](handleEntityNotFound(_0x317c46,null))[_0xb218('0x24')](removeEntity(_0x317c46,null))[_0xb218('0x2f')](handleError(_0x317c46,null));};exports[_0xb218('0x5e')]=function(_0x4d4bf0,_0x13541f){return db['WhatsappMessage'][_0xb218('0x5e')]()[_0xb218('0x24')](respondWithResult(_0x13541f,null))[_0xb218('0x2f')](handleError(_0x13541f,null));};var interaction_log=require(_0xb218('0x13'))(_0xb218('0x5f'));exports['accept']=function(_0x5dbb6e,_0x4db002,_0x196640){var _0x1fea34={'channel':_0xb218('0x60')};if(_0x5dbb6e[_0xb218('0x5d')]['id']){delete _0x5dbb6e[_0xb218('0x5d')]['id'];}_0x5dbb6e[_0xb218('0x5d')]['read']=!![];_0x5dbb6e[_0xb218('0x5d')][_0xb218('0x61')]=moment()[_0xb218('0x62')](_0xb218('0x63'));_0x5dbb6e[_0xb218('0x5d')][_0xb218('0x64')]=_0x5dbb6e['body']['UserId']||_0x5dbb6e[_0xb218('0x65')]['id'];return db['WhatsappMessage'][_0xb218('0x5b')]({'where':{'id':_0x5dbb6e['params']['id'],'UserId':null},'include':[{'model':db[_0xb218('0x66')],'as':_0xb218('0x67')}]})[_0xb218('0x24')](handleEntityNotFound(_0x4db002,null))['then'](saveUpdates(_0x5dbb6e[_0xb218('0x5d')],null))['then'](function(_0x298002){if(_0x298002){_0x1fea34['message']=_0x298002[_0xb218('0x68')]({'plain':!![]});return db[_0xb218('0x69')]['find']({'where':{'id':_0x298002[_0xb218('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x4db002,null))['then'](function(_0x5b4783){if(_0x5b4783){return _0x5b4783[_0xb218('0x3a')]({'UserId':_0x5dbb6e['body'][_0xb218('0x64')],'read1stAt':_['isNil'](_0x5b4783[_0xb218('0x6b')])?moment()[_0xb218('0x62')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xb218('0x24')](function(_0x120d89){if(_0x120d89){_0x1fea34[_0xb218('0x6c')]=_0x120d89[_0xb218('0x68')]({'plain':!![]});interaction_log[_0xb218('0x25')](_0xb218('0x6d'),_0x5dbb6e[_0xb218('0x65')]['id'],_0x5dbb6e[_0xb218('0x65')][_0xb218('0x3d')],_0x5dbb6e[_0xb218('0x65')][_0xb218('0x6e')],_0x1fea34[_0xb218('0x6c')]['id'],_0x5dbb6e['body']?JSON[_0xb218('0x2a')](_0x5dbb6e[_0xb218('0x5d')]):_0xb218('0x6f'));return respondWithRpcPromise(_0xb218('0x70'),_0xb218('0x71'),_0x1fea34);}return null;})['then'](function(_0x218c24){if(_0x218c24){if(_0x5dbb6e[_0xb218('0x5d')]['manual']){_0x1fea34[_0xb218('0x2d')][_0xb218('0x72')]=util[_0xb218('0x62')](_0xb218('0x73'),_0x5dbb6e['user'][_0xb218('0x3d')]);_0x1fea34[_0xb218('0x2d')][_0xb218('0x74')]=_0x1fea34[_0xb218('0x74')];_0x1fea34[_0xb218('0x2d')]['event']=_0xb218('0x75');return respondWithRpcPromise(_0xb218('0x76'),_0xb218('0x76'),{'event':_0xb218('0x77'),'message':_0x1fea34['message']},client9002)[_0xb218('0x24')](function(){return _0x1fea34;});}return _0x1fea34;}return null;})[_0xb218('0x24')](respondWithResult(_0x4db002,null))['catch'](handleError(_0x4db002,null));};var interaction_log=require(_0xb218('0x13'))('whatsapp-interactions');exports[_0xb218('0x39')]=function(_0x4c0a3c,_0x32494f,_0x5b5640){var _0x40552b={'agent':{},'channel':_0xb218('0x60')};if(_0x4c0a3c['body']['id']){delete _0x4c0a3c[_0xb218('0x5d')]['id'];}_0x4c0a3c['body'][_0xb218('0x64')]=_0x4c0a3c['body'][_0xb218('0x64')]||_0x4c0a3c[_0xb218('0x65')]['id'];_0x40552b[_0xb218('0x78')]['id']=_0x4c0a3c[_0xb218('0x5d')][_0xb218('0x64')];return db[_0xb218('0x41')][_0xb218('0x5b')]({'where':{'id':_0x4c0a3c['params']['id'],'UserId':null}})[_0xb218('0x24')](handleEntityNotFound(_0x32494f,null))['then'](function(_0x3f3c91){if(_0x3f3c91){_0x40552b['message']=_0x3f3c91[_0xb218('0x68')]({'plain':!![]});return db[_0xb218('0x69')]['find']({'where':{'id':_0x3f3c91[_0xb218('0x6a')]}});}return null;})[_0xb218('0x24')](handleEntityNotFound(_0x32494f,null))[_0xb218('0x24')](function(_0x5d3446){if(_0x5d3446){_0x40552b[_0xb218('0x6c')]=_0x5d3446[_0xb218('0x68')]({'plain':!![]});interaction_log['info'](_0xb218('0x79'),_0x4c0a3c[_0xb218('0x65')]['id'],_0x4c0a3c[_0xb218('0x65')][_0xb218('0x3d')],_0x4c0a3c[_0xb218('0x65')][_0xb218('0x6e')],_0x40552b['interaction']['id'],_0x4c0a3c[_0xb218('0x5d')]?JSON['stringify'](_0x4c0a3c[_0xb218('0x5d')]):'null');return respondWithRpcPromise('RejectMessage',_0xb218('0x7a'),_0x40552b);}return null;})[_0xb218('0x24')](function(_0xcac250){if(_0xcac250){_0xcac250[_0xb218('0x2d')]['interface']=util[_0xb218('0x62')]('SIP/%s',_0x4c0a3c[_0xb218('0x65')][_0xb218('0x3d')]);_0xcac250[_0xb218('0x2d')]['channel']=_0x40552b['channel'];_0xcac250[_0xb218('0x2d')][_0xb218('0x7b')]=_0xb218('0x39');respondWithRpcPromise(_0xb218('0x76'),_0xb218('0x76'),{'event':_0xb218('0x7c'),'message':_0xcac250[_0xb218('0x2d')]},client9002);return _0x40552b;}return null;})[_0xb218('0x24')](respondWithResult(_0x32494f,null))[_0xb218('0x2f')](handleError(_0x32494f,null));};exports['status']=function(_0x32b5ef,_0x54d8b4,_0x906b28){if(_0x32b5ef[_0xb218('0x5d')]['id']){delete _0x32b5ef[_0xb218('0x5d')]['id'];}var _0x9a3d53;return db[_0xb218('0x41')]['find']({'where':{'id':_0x32b5ef[_0xb218('0x59')]['id']}})[_0xb218('0x24')](handleEntityNotFound(_0x54d8b4,null))[_0xb218('0x24')](function(_0x1268ac){if(_0x1268ac){_0x9a3d53=_0x1268ac;return db['WhatsappAccount'][_0xb218('0x5b')]({'where':{'id':_0x1268ac[_0xb218('0x7d')]}});}})[_0xb218('0x24')](handleEntityNotFound(_0x54d8b4,null))[_0xb218('0x24')](function(_0x5f15e9){if(_0x5f15e9){logger[_0xb218('0x28')](_0xb218('0x7e'),_0xb218('0x31'),_0xb218('0x7f'),_0x5f15e9[_0xb218('0x44')],util[_0xb218('0x80')](_0x32b5ef[_0xb218('0x5d')],{'showHidden':![],'depth':null}));switch(_0x5f15e9[_0xb218('0x44')]){case'twilio':if(_0x32b5ef[_0xb218('0x5d')][_0xb218('0x81')]&&_0x32b5ef[_0xb218('0x5d')][_0xb218('0x81')]===_0x9a3d53[_0xb218('0x82')]&&_0x32b5ef['body']['MessageStatus']&&_0x32b5ef[_0xb218('0x5d')]['MessageStatus']==='read'){return _0x9a3d53['update']({'read':!![]});}else{logger[_0xb218('0x2b')](_0xb218('0x83'),'status',_0xb218('0x84'),util[_0xb218('0x80')](_0x32b5ef[_0xb218('0x5d')],{'showHidden':![],'depth':null}));}break;}return _0x9a3d53;}})[_0xb218('0x24')](respondWithResult(_0x54d8b4,null))['catch'](handleError(_0x54d8b4,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 001ef99..24780bf 100644 --- a/server/api/whatsappMessage/whatsappMessage.events.js +++ b/server/api/whatsappMessage/whatsappMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x37aace,_0x1eb5a7){var _0x49f09f=function(_0x425e71){while(--_0x425e71){_0x37aace['push'](_0x37aace['shift']());}};_0x49f09f(++_0x1eb5a7);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2ef5e6,_0x437ce9){_0x2ef5e6=_0x2ef5e6-0x0;var _0x5283ff=_0x5f2f[_0x2ef5e6];return _0x5283ff;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var WhatsappMessage=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];WhatsappMessage[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=WhatsappMessageEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x114dd9,_0x2f7df1){var _0x208af5=function(_0x45c550){while(--_0x45c550){_0x114dd9['push'](_0x114dd9['shift']());}};_0x208af5(++_0x2f7df1);}(_0x5f2f,0x73));var _0xf5f2=function(_0x116415,_0x28c819){_0x116415=_0x116415-0x0;var _0x10f8ef=_0x5f2f[_0x116415];return _0x10f8ef;};'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 8f7b922..6fbddfe 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 _0x7451=['afterCreate','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','body','FULLTEXT','models','get','toLowerCase','out','secret','UserId','WhatsappInteraction','findOne','then','update','createdAt','catch','error','direction','WhatsappAccount','find','type','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','twilio','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s'];(function(_0x518de3,_0x57bc8d){var _0x465401=function(_0x2811e5){while(--_0x2811e5){_0x518de3['push'](_0x518de3['shift']());}};_0x465401(++_0x57bc8d);}(_0x7451,0x9c));var _0x1745=function(_0x1ccd9d,_0x24d8a4){_0x1ccd9d=_0x1ccd9d-0x0;var _0x331046=_0x7451[_0x1ccd9d];return _0x331046;};'use strict';var _=require(_0x1745('0x0'));var util=require(_0x1745('0x1'));var logger=require(_0x1745('0x2'))(_0x1745('0x3'));var moment=require(_0x1745('0x4'));var BPromise=require(_0x1745('0x5'));var rp=require(_0x1745('0x6'));var fs=require('fs');var path=require(_0x1745('0x7'));var rimraf=require('rimraf');var config=require(_0x1745('0x8'));var attributes=require(_0x1745('0x9'));module[_0x1745('0xa')]=function(_0xc52668,_0x48888f){return _0xc52668[_0x1745('0xb')](_0x1745('0xc'),attributes,{'tableName':_0x1745('0xd'),'paranoid':![],'indexes':[{'name':_0x1745('0xe'),'fields':['messageId']},{'name':'fti_whatsapp_messages','fields':[_0x1745('0xf')],'type':_0x1745('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x484155,_0x4f6a66,_0x23a49e){var _0x27f49b=_0xc52668[_0x1745('0x11')];var _0x304a90=_0x484155[_0x1745('0x12')]({'plain':!![]});if(_0x304a90['direction'][_0x1745('0x13')]()==='in'||_0x304a90['direction'][_0x1745('0x13')]()===_0x1745('0x14')&&!_0x304a90[_0x1745('0x15')]&&!_['isNil'](_0x304a90[_0x1745('0x16')])){_0x27f49b[_0x1745('0x17')][_0x1745('0x18')]({'where':{'id':_0x304a90['WhatsappInteractionId']}})[_0x1745('0x19')](function(_0x4863dd){if(_0x4863dd){_0x4863dd[_0x1745('0x1a')]({'lastMsgAt':_0x304a90[_0x1745('0x1b')],'lastMsgDirection':_0x304a90['direction'][_0x1745('0x13')]()});}})[_0x1745('0x1c')](function(_0x2fc3ea){console[_0x1745('0x1d')](_0x2fc3ea);});}if(_0x304a90[_0x1745('0x1e')]===_0x1745('0x14')&&!_0x304a90['secret']){var _0x27975a;_0x27f49b[_0x1745('0x1f')][_0x1745('0x20')]({'where':{'id':_0x304a90['WhatsappAccountId']},'raw':!![]})[_0x1745('0x19')](function(_0x2e9a7f){_0x27975a=_0x2e9a7f;if(_0x27975a&&_0x27975a['type']){switch(_0x27975a[_0x1745('0x21')]){case'twilio':var _0x10ac07=require('twilio');if(_0x27975a[_0x1745('0x22')]&&_0x27975a[_0x1745('0x23')]&&_0x27975a[_0x1745('0x24')]){var _0x5825ec=new _0x10ac07(_0x27975a[_0x1745('0x22')],_0x27975a['authToken']);_0x5825ec[_0x1745('0x25')][_0x1745('0x26')]({'body':_0x304a90[_0x1745('0xf')],'to':'whatsapp:'+_0x304a90[_0x1745('0x24')],'from':_0x1745('0x27')+_0x27975a[_0x1745('0x24')],'statusCallback':_0x27975a[_0x1745('0x28')]+_0x1745('0x29')+_0x304a90['id']+_0x1745('0x2a')+_0x27975a[_0x1745('0x2b')]})[_0x1745('0x19')](function(_0x5248f3){if(_0x5248f3['sid']){return _0x484155[_0x1745('0x1a')]({'messageId':_0x5248f3[_0x1745('0x2c')]});}})[_0x1745('0x1c')](function(_0x97d329){logger[_0x1745('0x1d')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x1745('0x2d'),util[_0x1745('0x2e')](_0x97d329,{'showHidden':![],'depth':null}));});}else{logger[_0x1745('0x1d')](_0x1745('0x2f'),_0x1745('0x30'),_0x1745('0x2d'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})['finally'](function(){_0x23a49e();});}else{_0x23a49e();}}},'charset':_0x1745('0x31'),'collate':_0x1745('0x32')});}; \ No newline at end of file +var _0x2485=['find','WhatsappAccountId','type','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','sid','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio','inspect','finally','utf8mb4','utf8mb4_unicode_ci','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','messageId','body','FULLTEXT','get','direction','toLowerCase','secret','isNil','findOne','WhatsappInteractionId','then','update','error','WhatsappAccount'];(function(_0x235544,_0x4d7f6b){var _0x409f7c=function(_0x3ffc8c){while(--_0x3ffc8c){_0x235544['push'](_0x235544['shift']());}};_0x409f7c(++_0x4d7f6b);}(_0x2485,0x150));var _0x5248=function(_0x15acfe,_0x6ccd90){_0x15acfe=_0x15acfe-0x0;var _0x292bb3=_0x2485[_0x15acfe];return _0x292bb3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5248('0x0'))('api');var moment=require('moment');var BPromise=require(_0x5248('0x1'));var rp=require(_0x5248('0x2'));var fs=require('fs');var path=require(_0x5248('0x3'));var rimraf=require(_0x5248('0x4'));var config=require(_0x5248('0x5'));var attributes=require(_0x5248('0x6'));module[_0x5248('0x7')]=function(_0x4fbc36,_0x418c33){return _0x4fbc36[_0x5248('0x8')](_0x5248('0x9'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0x5248('0xa'),'fields':[_0x5248('0xa')]},{'name':'fti_whatsapp_messages','fields':[_0x5248('0xb')],'type':_0x5248('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x338329,_0xa3298,_0x3848fd){var _0x47601c=_0x4fbc36['models'];var _0x28ce93=_0x338329[_0x5248('0xd')]({'plain':!![]});if(_0x28ce93[_0x5248('0xe')][_0x5248('0xf')]()==='in'||_0x28ce93[_0x5248('0xe')]['toLowerCase']()==='out'&&!_0x28ce93[_0x5248('0x10')]&&!_[_0x5248('0x11')](_0x28ce93['UserId'])){_0x47601c['WhatsappInteraction'][_0x5248('0x12')]({'where':{'id':_0x28ce93[_0x5248('0x13')]}})[_0x5248('0x14')](function(_0x29e15e){if(_0x29e15e){_0x29e15e[_0x5248('0x15')]({'lastMsgAt':_0x28ce93['createdAt'],'lastMsgDirection':_0x28ce93[_0x5248('0xe')][_0x5248('0xf')]()});}})['catch'](function(_0x75fcb7){console[_0x5248('0x16')](_0x75fcb7);});}if(_0x28ce93[_0x5248('0xe')]==='out'&&!_0x28ce93[_0x5248('0x10')]){var _0x3aee5c;_0x47601c[_0x5248('0x17')][_0x5248('0x18')]({'where':{'id':_0x28ce93[_0x5248('0x19')]},'raw':!![]})[_0x5248('0x14')](function(_0x4dc4bc){_0x3aee5c=_0x4dc4bc;if(_0x3aee5c&&_0x3aee5c[_0x5248('0x1a')]){switch(_0x3aee5c[_0x5248('0x1a')]){case'twilio':var _0x1c6826=require('twilio');if(_0x3aee5c[_0x5248('0x1b')]&&_0x3aee5c[_0x5248('0x1c')]&&_0x3aee5c[_0x5248('0x1d')]){var _0x35536a=new _0x1c6826(_0x3aee5c[_0x5248('0x1b')],_0x3aee5c[_0x5248('0x1c')]);_0x35536a[_0x5248('0x1e')][_0x5248('0x1f')]({'body':_0x28ce93[_0x5248('0xb')],'to':'whatsapp:'+_0x28ce93['phone'],'from':_0x5248('0x20')+_0x3aee5c[_0x5248('0x1d')],'statusCallback':_0x3aee5c[_0x5248('0x21')]+_0x5248('0x22')+_0x28ce93['id']+_0x5248('0x23')+_0x3aee5c['token']})['then'](function(_0x88c44f){if(_0x88c44f[_0x5248('0x24')]){return _0x338329[_0x5248('0x15')]({'messageId':_0x88c44f['sid']});}})[_0x5248('0x25')](function(_0x55c9ce){logger[_0x5248('0x16')](_0x5248('0x26'),_0x5248('0x27'),_0x5248('0x28'),util[_0x5248('0x29')](_0x55c9ce,{'showHidden':![],'depth':null}));});}else{logger[_0x5248('0x16')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x5248('0x28'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})[_0x5248('0x2a')](function(){_0x3848fd();});}else{_0x3848fd();}}},'charset':_0x5248('0x2b'),'collate':_0x5248('0x2c')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 3310263..e0c069d 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 _0x4fd3=['create','body','options','raw','then','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','register','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage'];(function(_0x129c38,_0x2c0475){var _0x906b27=function(_0x19b550){while(--_0x19b550){_0x129c38['push'](_0x129c38['shift']());}};_0x906b27(++_0x2c0475);}(_0x4fd3,0xe5));var _0x34fd=function(_0x4bb149,_0x398231){_0x4bb149=_0x4bb149-0x0;var _0x552b31=_0x4fd3[_0x4bb149];return _0x552b31;};'use strict';var _=require(_0x34fd('0x0'));var util=require(_0x34fd('0x1'));var moment=require('moment');var BPromise=require(_0x34fd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x34fd('0x3'))['db'];var utils=require(_0x34fd('0x4'));var logger=require(_0x34fd('0x5'))(_0x34fd('0x6'));var config=require('../../config/environment');var jayson=require(_0x34fd('0x7'));var client=jayson[_0x34fd('0x8')][_0x34fd('0x9')]({'port':0x232a});config['redis']=_[_0x34fd('0xa')](config[_0x34fd('0xb')],{'host':_0x34fd('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x34fd('0xb')]));require('./whatsappMessage.socket')[_0x34fd('0xd')](socket);function respondWithRpcPromise(_0x418336,_0x57e141,_0xda84d9){return new BPromise(function(_0x4ee269,_0x3b376c){return client[_0x34fd('0xe')](_0x418336,_0xda84d9)['then'](function(_0x16b5f9){logger[_0x34fd('0xf')](_0x34fd('0x10'),_0x57e141,_0x34fd('0x11'));logger[_0x34fd('0x12')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x57e141,_0x34fd('0x11'),JSON[_0x34fd('0x13')](_0x16b5f9));if(_0x16b5f9[_0x34fd('0x14')]){if(_0x16b5f9[_0x34fd('0x14')][_0x34fd('0x15')]===0x1f4){logger[_0x34fd('0x14')](_0x34fd('0x10'),_0x57e141,_0x16b5f9[_0x34fd('0x14')]['message']);return _0x3b376c(_0x16b5f9[_0x34fd('0x14')][_0x34fd('0x16')]);}logger[_0x34fd('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0x57e141,_0x16b5f9[_0x34fd('0x14')][_0x34fd('0x16')]);return _0x4ee269(_0x16b5f9[_0x34fd('0x14')][_0x34fd('0x16')]);}else{logger[_0x34fd('0xf')](_0x34fd('0x10'),_0x57e141,'request\x20sent');_0x4ee269(_0x16b5f9[_0x34fd('0x17')][_0x34fd('0x16')]);}})[_0x34fd('0x18')](function(_0x1e40c2){logger[_0x34fd('0x14')](_0x34fd('0x10'),_0x57e141,_0x1e40c2);_0x3b376c(_0x1e40c2);});});}exports[_0x34fd('0x19')]=function(_0x229510){var _0x11422d=this;return new Promise(function(_0x511b25,_0x344513){return db[_0x34fd('0x1a')][_0x34fd('0x1b')](_0x229510[_0x34fd('0x1c')],{'raw':_0x229510[_0x34fd('0x1d')]?_0x229510[_0x34fd('0x1d')][_0x34fd('0x1e')]===undefined?!![]:![]:!![]})[_0x34fd('0x1f')](function(_0x2fffaf){logger[_0x34fd('0xf')](_0x34fd('0x19'),_0x229510);logger[_0x34fd('0x12')](_0x34fd('0x19'),_0x229510,JSON[_0x34fd('0x13')](_0x2fffaf));_0x511b25(_0x2fffaf);})['catch'](function(_0x4968ec){logger['error'](_0x34fd('0x19'),_0x4968ec['message'],_0x229510);_0x344513(_0x11422d[_0x34fd('0x14')](0x1f4,_0x4968ec['message']));});});}; \ No newline at end of file +var _0x1a13=['body','options','raw','then','info','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','request','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','WhatsappMessage,\x20%s,\x20%s','message','result','catch','CreateWhatsappMessage','WhatsappMessage'];(function(_0xbf3d8c,_0x50805e){var _0x248096=function(_0x1e3b68){while(--_0x1e3b68){_0xbf3d8c['push'](_0xbf3d8c['shift']());}};_0x248096(++_0x50805e);}(_0x1a13,0x7a));var _0x31a1=function(_0x407132,_0x349b53){_0x407132=_0x407132-0x0;var _0x1dd167=_0x1a13[_0x407132];return _0x1dd167;};'use strict';var _=require(_0x31a1('0x0'));var util=require(_0x31a1('0x1'));var moment=require('moment');var BPromise=require(_0x31a1('0x2'));var rs=require(_0x31a1('0x3'));var fs=require('fs');var Redis=require(_0x31a1('0x4'));var db=require(_0x31a1('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x31a1('0x6'));var config=require(_0x31a1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x31a1('0x8')]['http']({'port':0x232a});config[_0x31a1('0x9')]=_[_0x31a1('0xa')](config[_0x31a1('0x9')],{'host':_0x31a1('0xb'),'port':0x18eb});var socket=require(_0x31a1('0xc'))(new Redis(config[_0x31a1('0x9')]));require('./whatsappMessage.socket')['register'](socket);function respondWithRpcPromise(_0x5bd593,_0x4bc621,_0x54b458){return new BPromise(function(_0x26e52a,_0x391762){return client[_0x31a1('0xd')](_0x5bd593,_0x54b458)['then'](function(_0x299465){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x4bc621,'request\x20sent');logger[_0x31a1('0xe')](_0x31a1('0xf'),_0x4bc621,'request\x20sent',JSON['stringify'](_0x299465));if(_0x299465[_0x31a1('0x10')]){if(_0x299465[_0x31a1('0x10')]['code']===0x1f4){logger[_0x31a1('0x10')](_0x31a1('0x11'),_0x4bc621,_0x299465['error'][_0x31a1('0x12')]);return _0x391762(_0x299465[_0x31a1('0x10')][_0x31a1('0x12')]);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x4bc621,_0x299465[_0x31a1('0x10')][_0x31a1('0x12')]);return _0x26e52a(_0x299465[_0x31a1('0x10')][_0x31a1('0x12')]);}else{logger['info'](_0x31a1('0x11'),_0x4bc621,'request\x20sent');_0x26e52a(_0x299465[_0x31a1('0x13')]['message']);}})[_0x31a1('0x14')](function(_0x9d3916){logger[_0x31a1('0x10')]('WhatsappMessage,\x20%s,\x20%s',_0x4bc621,_0x9d3916);_0x391762(_0x9d3916);});});}exports[_0x31a1('0x15')]=function(_0x3ba07d){var _0x3423d9=this;return new Promise(function(_0x443a40,_0x361dd0){return db[_0x31a1('0x16')]['create'](_0x3ba07d[_0x31a1('0x17')],{'raw':_0x3ba07d[_0x31a1('0x18')]?_0x3ba07d[_0x31a1('0x18')][_0x31a1('0x19')]===undefined?!![]:![]:!![]})[_0x31a1('0x1a')](function(_0x272546){logger[_0x31a1('0x1b')](_0x31a1('0x15'),_0x3ba07d);logger['debug']('CreateWhatsappMessage',_0x3ba07d,JSON[_0x31a1('0x1c')](_0x272546));_0x443a40(_0x272546);})[_0x31a1('0x14')](function(_0x2d556b){logger[_0x31a1('0x10')](_0x31a1('0x15'),_0x2d556b[_0x31a1('0x12')],_0x3ba07d);_0x361dd0(_0x3423d9['error'](0x1f4,_0x2d556b[_0x31a1('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 8645aff..185c5f7 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 _0xc479=['whatsappMessage:','./whatsappMessage.events','save','remove','update','emit','removeListener','register','length'];(function(_0x46a003,_0x12d65e){var _0x11c836=function(_0x18c2b7){while(--_0x18c2b7){_0x46a003['push'](_0x46a003['shift']());}};_0x11c836(++_0x12d65e);}(_0xc479,0xc7));var _0x9c47=function(_0x1dc812,_0x3918ea){_0x1dc812=_0x1dc812-0x0;var _0x413a1c=_0xc479[_0x1dc812];return _0x413a1c;};'use strict';var WhatsappMessageEvents=require(_0x9c47('0x0'));var events=[_0x9c47('0x1'),_0x9c47('0x2'),_0x9c47('0x3')];function createListener(_0x4aba99,_0x75e810){return function(_0x28464b){_0x75e810[_0x9c47('0x4')](_0x4aba99,_0x28464b);};}function removeListener(_0x265fdd,_0x4cffc1){return function(){WhatsappMessageEvents[_0x9c47('0x5')](_0x265fdd,_0x4cffc1);};}exports[_0x9c47('0x6')]=function(_0x2b63f8){for(var _0x27fe81=0x0,_0x4afc60=events[_0x9c47('0x7')];_0x27fe81<_0x4afc60;_0x27fe81++){var _0x3edddb=events[_0x27fe81];var _0xef238e=createListener(_0x9c47('0x8')+_0x3edddb,_0x2b63f8);WhatsappMessageEvents['on'](_0x3edddb,_0xef238e);}}; \ No newline at end of file +var _0x5bec=['remove','update','emit','removeListener','register','length','whatsappMessage:','./whatsappMessage.events','save'];(function(_0x4419e0,_0x34f758){var _0x32dfd5=function(_0x2c16a7){while(--_0x2c16a7){_0x4419e0['push'](_0x4419e0['shift']());}};_0x32dfd5(++_0x34f758);}(_0x5bec,0x85));var _0xc5be=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x5bec[_0x29d915];return _0x160f86;};'use strict';var WhatsappMessageEvents=require(_0xc5be('0x0'));var events=[_0xc5be('0x1'),_0xc5be('0x2'),_0xc5be('0x3')];function createListener(_0x364a57,_0x53298c){return function(_0x54e503){_0x53298c[_0xc5be('0x4')](_0x364a57,_0x54e503);};}function removeListener(_0x8b48e5,_0x4d039a){return function(){WhatsappMessageEvents[_0xc5be('0x5')](_0x8b48e5,_0x4d039a);};}exports[_0xc5be('0x6')]=function(_0x5f4128){for(var _0x999618=0x0,_0x1de100=events[_0xc5be('0x7')];_0x999618<_0x1de100;_0x999618++){var _0x171be4=events[_0x999618];var _0x4204d7=createListener(_0xc5be('0x8')+_0x171be4,_0x5f4128);WhatsappMessageEvents['on'](_0x171be4,_0x4204d7);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 8261531..9e47565 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 _0xa91e=['removeTeams','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./whatsappQueue.controller','index','get','/describe','describe','/:id','isAuthenticated','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','delete'];(function(_0x32bb6b,_0x1a5fbe){var _0x58dcb4=function(_0x402ee2){while(--_0x402ee2){_0x32bb6b['push'](_0x32bb6b['shift']());}};_0x58dcb4(++_0x1a5fbe);}(_0xa91e,0x1c2));var _0xea91=function(_0x3c30d9,_0x2662cf){_0x3c30d9=_0x3c30d9-0x0;var _0x2ac0b9=_0xa91e[_0x3c30d9];return _0x2ac0b9;};'use strict';var multer=require(_0xea91('0x0'));var util=require(_0xea91('0x1'));var path=require(_0xea91('0x2'));var timeout=require(_0xea91('0x3'));var express=require(_0xea91('0x4'));var router=express[_0xea91('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xea91('0x6'));var controller=require(_0xea91('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xea91('0x8')]);router[_0xea91('0x9')](_0xea91('0xa'),auth['isAuthenticated'](),controller[_0xea91('0xb')]);router[_0xea91('0x9')](_0xea91('0xc'),auth[_0xea91('0xd')](),controller[_0xea91('0xe')]);router[_0xea91('0x9')](_0xea91('0xf'),auth[_0xea91('0xd')](),controller['getMembers']);router[_0xea91('0x9')](_0xea91('0x10'),auth[_0xea91('0xd')](),controller[_0xea91('0x11')]);router[_0xea91('0x9')](_0xea91('0x12'),auth[_0xea91('0xd')](),controller[_0xea91('0x13')]);router[_0xea91('0x14')]('/',auth[_0xea91('0xd')](),controller[_0xea91('0x15')]);router[_0xea91('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0xea91('0x16')]);router['post'](_0xea91('0x12'),auth[_0xea91('0xd')](),controller[_0xea91('0x17')]);router[_0xea91('0x18')](_0xea91('0xc'),auth[_0xea91('0xd')](),controller['update']);router[_0xea91('0x19')]('/:id',auth[_0xea91('0xd')](),controller['destroy']);router[_0xea91('0x19')](_0xea91('0x10'),auth[_0xea91('0xd')](),controller[_0xea91('0x1a')]);router[_0xea91('0x19')]('/:id/users',auth[_0xea91('0xd')](),controller['removeAgents']);module[_0xea91('0x1b')]=router; \ No newline at end of file +var _0xb739=['getAgents','post','create','addTeams','addAgents','put','delete','destroy','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users'];(function(_0x4b8887,_0x39338d){var _0x320153=function(_0xf3496d){while(--_0xf3496d){_0x4b8887['push'](_0x4b8887['shift']());}};_0x320153(++_0x39338d);}(_0xb739,0x82));var _0x9b73=function(_0x521c76,_0x2d48f9){_0x521c76=_0x521c76-0x0;var _0x7fcf5f=_0xb739[_0x521c76];return _0x7fcf5f;};'use strict';var multer=require(_0x9b73('0x0'));var util=require('util');var path=require(_0x9b73('0x1'));var timeout=require(_0x9b73('0x2'));var express=require(_0x9b73('0x3'));var router=express[_0x9b73('0x4')]();var auth=require(_0x9b73('0x5'));var interaction=require(_0x9b73('0x6'));var config=require(_0x9b73('0x7'));var controller=require(_0x9b73('0x8'));router[_0x9b73('0x9')]('/',auth[_0x9b73('0xa')](),controller['index']);router[_0x9b73('0x9')](_0x9b73('0xb'),auth[_0x9b73('0xa')](),controller[_0x9b73('0xc')]);router[_0x9b73('0x9')](_0x9b73('0xd'),auth[_0x9b73('0xa')](),controller[_0x9b73('0xe')]);router[_0x9b73('0x9')](_0x9b73('0xf'),auth['isAuthenticated'](),controller[_0x9b73('0x10')]);router[_0x9b73('0x9')](_0x9b73('0x11'),auth[_0x9b73('0xa')](),controller[_0x9b73('0x12')]);router[_0x9b73('0x9')](_0x9b73('0x13'),auth[_0x9b73('0xa')](),controller[_0x9b73('0x14')]);router[_0x9b73('0x15')]('/',auth[_0x9b73('0xa')](),controller[_0x9b73('0x16')]);router[_0x9b73('0x15')](_0x9b73('0x11'),auth[_0x9b73('0xa')](),controller[_0x9b73('0x17')]);router['post'](_0x9b73('0x13'),auth[_0x9b73('0xa')](),controller[_0x9b73('0x18')]);router[_0x9b73('0x19')](_0x9b73('0xd'),auth[_0x9b73('0xa')](),controller['update']);router[_0x9b73('0x1a')]('/:id',auth[_0x9b73('0xa')](),controller[_0x9b73('0x1b')]);router[_0x9b73('0x1a')](_0x9b73('0x11'),auth[_0x9b73('0xa')](),controller['removeTeams']);router[_0x9b73('0x1a')](_0x9b73('0x13'),auth[_0x9b73('0xa')](),controller[_0x9b73('0x1c')]);module[_0x9b73('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index fab5812..f312840 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 _0x34f8=['ENUM','beepall','roundrobin','STRING','sequelize','exports','name','INTEGER'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x34f8,0xbc));var _0x834f=function(_0x235108,_0x4f6816){_0x235108=_0x235108-0x0;var _0x188b27=_0x34f8[_0x235108];return _0x188b27;};'use strict';var Sequelize=require(_0x834f('0x0'));module[_0x834f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x834f('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x834f('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x834f('0x4')]('rrmemory',_0x834f('0x5'),_0x834f('0x6'))},'description':{'type':Sequelize[_0x834f('0x7')]}}; \ No newline at end of file +var _0xebda=['ENUM','roundrobin','exports','STRING','name'];(function(_0x4d9d1e,_0x3c2d20){var _0x1b9d54=function(_0x373c21){while(--_0x373c21){_0x4d9d1e['push'](_0x4d9d1e['shift']());}};_0x1b9d54(++_0x3c2d20);}(_0xebda,0x84));var _0xaebd=function(_0x3aaf0a,_0x450970){_0x3aaf0a=_0x3aaf0a-0x0;var _0x33e6bc=_0xebda[_0x3aaf0a];return _0x33e6bc;};'use strict';var Sequelize=require('sequelize');module[_0xaebd('0x0')]={'name':{'type':Sequelize[_0xaebd('0x1')],'unique':_0xaebd('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xaebd('0x3')]('rrmemory','beepall',_0xaebd('0x4'))},'description':{'type':Sequelize[_0xaebd('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 07adc8e..dcd0ef5 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 _0xc3f0=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','then','get','WhatsappQueues','UserProfileResource','destroy','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','model','filters','intersection','query','attributes','fields','length','order','sort','where','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','keys','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','find','describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','nolimit','pick','WhatsappQueueId','findAll','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','voicePause','interface','findOrCreate','emit','userWhatsappQueue:save','removeTeams','Agents','select','tq.TeamId','from','join','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','includes','all','union','transaction','isEmpty','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x56437f,_0x4737e3){var _0xdf3f8c=function(_0x4a0c43){while(--_0x4a0c43){_0x56437f['push'](_0x56437f['shift']());}};_0xdf3f8c(++_0x4737e3);}(_0xc3f0,0x18c));var _0x0c3f=function(_0x7ff6f8,_0x1bf423){_0x7ff6f8=_0x7ff6f8-0x0;var _0x40be34=_0xc3f0[_0x7ff6f8];return _0x40be34;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0c3f('0x0'));var rimraf=require(_0x0c3f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0c3f('0x2'));var rp=require(_0x0c3f('0x3'));var moment=require('moment');var BPromise=require(_0x0c3f('0x4'));var Mustache=require(_0x0c3f('0x5'));var util=require(_0x0c3f('0x6'));var path=require(_0x0c3f('0x7'));var sox=require('sox');var csv=require(_0x0c3f('0x8'));var ejs=require(_0x0c3f('0x9'));var fs=require('fs');var _=require(_0x0c3f('0xa'));var squel=require(_0x0c3f('0xb'));var crypto=require(_0x0c3f('0xc'));var jsforce=require(_0x0c3f('0xd'));var deskjs=require(_0x0c3f('0xe'));var toCsv=require(_0x0c3f('0x8'));var querystring=require(_0x0c3f('0xf'));var Papa=require(_0x0c3f('0x10'));var Redis=require('ioredis');var authService=require(_0x0c3f('0x11'));var qs=require(_0x0c3f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0c3f('0x13'));var logger=require(_0x0c3f('0x14'))('api');var utils=require(_0x0c3f('0x15'));var config=require(_0x0c3f('0x16'));var db=require('../../mysqldb')['db'];config[_0x0c3f('0x17')]=_[_0x0c3f('0x18')](config[_0x0c3f('0x17')],{'host':_0x0c3f('0x19'),'port':0x18eb});var socket=require(_0x0c3f('0x1a'))(new Redis(config[_0x0c3f('0x17')]));require(_0x0c3f('0x1b'))[_0x0c3f('0x1c')](socket);function respondWithStatusCode(_0xce398a,_0x3d5b7a){_0x3d5b7a=_0x3d5b7a||0xcc;return function(_0x476b03){if(_0x476b03){return _0xce398a[_0x0c3f('0x1d')](_0x3d5b7a);}return _0xce398a[_0x0c3f('0x1e')](_0x3d5b7a)[_0x0c3f('0x1f')]();};}function respondWithResult(_0x31f713,_0x4ee645){_0x4ee645=_0x4ee645||0xc8;return function(_0x1d1630){if(_0x1d1630){return _0x31f713['status'](_0x4ee645)[_0x0c3f('0x20')](_0x1d1630);}};}function respondWithFilteredResult(_0x3ff1ba,_0x34849a){return function(_0x4723ae){if(_0x4723ae){var _0x399606=_0x4723ae[_0x0c3f('0x21')],_0x10aa81=_0x34849a[_0x0c3f('0x22')],_0x4cc8df=_0x34849a[_0x0c3f('0x22')]+_0x34849a[_0x0c3f('0x23')],_0x26c46e;if(_0x4cc8df>=_0x399606){_0x4cc8df=_0x399606;_0x26c46e=0xc8;}else{_0x26c46e=0xce;}_0x3ff1ba[_0x0c3f('0x1e')](_0x26c46e);return _0x3ff1ba[_0x0c3f('0x24')](_0x0c3f('0x25'),_0x10aa81+'-'+_0x4cc8df+'/'+_0x399606)[_0x0c3f('0x20')](_0x4723ae);}return null;};}function patchUpdates(_0x5f6676){return function(_0x54d4d8){try{jsonpatch[_0x0c3f('0x26')](_0x54d4d8,_0x5f6676,!![]);}catch(_0x204b7f){return BPromise['reject'](_0x204b7f);}return _0x54d4d8[_0x0c3f('0x27')]();};}function saveUpdates(_0xefa8de,_0x35e166){return function(_0x434b08){if(_0x434b08){return _0x434b08['update'](_0xefa8de)['then'](function(_0x2977d1){return _0x2977d1;});}return null;};}function removeEntity(_0x36ca1f,_0x58dd84){return function(_0x4c7f13){if(_0x4c7f13){return _0x4c7f13['destroy']()[_0x0c3f('0x28')](function(){var _0x198ac6=_0x4c7f13[_0x0c3f('0x29')]({'plain':!![]});var _0x4ca8bb=_0x0c3f('0x2a');return db[_0x0c3f('0x2b')][_0x0c3f('0x2c')]({'where':{'type':_0x4ca8bb,'resourceId':_0x198ac6['id']}})[_0x0c3f('0x28')](function(){return _0x4c7f13;});})[_0x0c3f('0x28')](function(){_0x36ca1f[_0x0c3f('0x1e')](0xcc)[_0x0c3f('0x1f')]();});}};}function handleEntityNotFound(_0x4a711c,_0x5e1b9f){return function(_0x35c7eb){if(!_0x35c7eb){_0x4a711c[_0x0c3f('0x1d')](0x194);}return _0x35c7eb;};}function handleError(_0x26b3a6,_0x4a9a1a){_0x4a9a1a=_0x4a9a1a||0x1f4;return function(_0x3c746c){logger['error'](_0x3c746c['stack']);if(_0x3c746c['name']){delete _0x3c746c[_0x0c3f('0x2d')];}_0x26b3a6[_0x0c3f('0x1e')](_0x4a9a1a)[_0x0c3f('0x2e')](_0x3c746c);};}exports[_0x0c3f('0x2f')]=function(_0x2ba99f,_0x2c7e7f){var _0x432090={},_0x5e9ffe={},_0x49b592={'count':0x0,'rows':[]};var _0x4f2ab5=_[_0x0c3f('0x30')](db[_0x0c3f('0x31')][_0x0c3f('0x32')],function(_0x36aab2){return{'name':_0x36aab2[_0x0c3f('0x33')],'type':_0x36aab2[_0x0c3f('0x34')]['key']};});_0x5e9ffe[_0x0c3f('0x35')]=_[_0x0c3f('0x30')](_0x4f2ab5,_0x0c3f('0x2d'));_0x5e9ffe['query']=_['keys'](_0x2ba99f['query']);_0x5e9ffe[_0x0c3f('0x36')]=_[_0x0c3f('0x37')](_0x5e9ffe['model'],_0x5e9ffe[_0x0c3f('0x38')]);_0x432090[_0x0c3f('0x39')]=_[_0x0c3f('0x37')](_0x5e9ffe['model'],qs['fields'](_0x2ba99f[_0x0c3f('0x38')][_0x0c3f('0x3a')]));_0x432090[_0x0c3f('0x39')]=_0x432090[_0x0c3f('0x39')][_0x0c3f('0x3b')]?_0x432090['attributes']:_0x5e9ffe[_0x0c3f('0x35')];if(!_0x2ba99f[_0x0c3f('0x38')]['hasOwnProperty']('nolimit')){_0x432090[_0x0c3f('0x23')]=qs[_0x0c3f('0x23')](_0x2ba99f[_0x0c3f('0x38')][_0x0c3f('0x23')]);_0x432090[_0x0c3f('0x22')]=qs[_0x0c3f('0x22')](_0x2ba99f[_0x0c3f('0x38')][_0x0c3f('0x22')]);}_0x432090[_0x0c3f('0x3c')]=qs[_0x0c3f('0x3d')](_0x2ba99f[_0x0c3f('0x38')]['sort']);_0x432090[_0x0c3f('0x3e')]=qs[_0x0c3f('0x36')](_['pick'](_0x2ba99f[_0x0c3f('0x38')],_0x5e9ffe['filters']),_0x4f2ab5);if(_0x2ba99f[_0x0c3f('0x38')][_0x0c3f('0x3f')]){_0x432090[_0x0c3f('0x3e')]=_[_0x0c3f('0x40')](_0x432090[_0x0c3f('0x3e')],{'$or':_[_0x0c3f('0x30')](_0x4f2ab5,function(_0x494ff3){if(_0x494ff3[_0x0c3f('0x34')]!==_0x0c3f('0x41')){var _0x16f002={};_0x16f002[_0x494ff3[_0x0c3f('0x2d')]]={'$like':'%'+_0x2ba99f[_0x0c3f('0x38')][_0x0c3f('0x3f')]+'%'};return _0x16f002;}})});}_0x432090=_[_0x0c3f('0x40')]({},_0x432090,_0x2ba99f['options']);var _0x16b214={'where':_0x432090[_0x0c3f('0x3e')]};return db['WhatsappQueue'][_0x0c3f('0x21')](_0x16b214)[_0x0c3f('0x28')](function(_0x3a4393){_0x49b592[_0x0c3f('0x21')]=_0x3a4393;if(_0x2ba99f[_0x0c3f('0x38')][_0x0c3f('0x42')]){_0x432090[_0x0c3f('0x43')]=[{'all':!![]}];}return db['WhatsappQueue']['findAll'](_0x432090);})[_0x0c3f('0x28')](function(_0x5dc1ca){_0x49b592[_0x0c3f('0x44')]=_0x5dc1ca;return _0x49b592;})[_0x0c3f('0x28')](respondWithFilteredResult(_0x2c7e7f,_0x432090))[_0x0c3f('0x45')](handleError(_0x2c7e7f,null));};exports[_0x0c3f('0x46')]=function(_0xf27552,_0x2b0071){var _0x1d5ade={'raw':!![],'where':{'id':_0xf27552['params']['id']}},_0x5c5b32={};_0x5c5b32[_0x0c3f('0x35')]=_[_0x0c3f('0x47')](db[_0x0c3f('0x31')][_0x0c3f('0x32')]);_0x5c5b32[_0x0c3f('0x38')]=_[_0x0c3f('0x47')](_0xf27552[_0x0c3f('0x38')]);_0x5c5b32[_0x0c3f('0x36')]=_[_0x0c3f('0x37')](_0x5c5b32[_0x0c3f('0x35')],_0x5c5b32['query']);_0x1d5ade['attributes']=_[_0x0c3f('0x37')](_0x5c5b32[_0x0c3f('0x35')],qs['fields'](_0xf27552['query'][_0x0c3f('0x3a')]));_0x1d5ade[_0x0c3f('0x39')]=_0x1d5ade[_0x0c3f('0x39')]['length']?_0x1d5ade[_0x0c3f('0x39')]:_0x5c5b32['model'];if(_0xf27552[_0x0c3f('0x38')][_0x0c3f('0x42')]){_0x1d5ade[_0x0c3f('0x43')]=[{'all':!![]}];}_0x1d5ade=_[_0x0c3f('0x40')]({},_0x1d5ade,_0xf27552[_0x0c3f('0x48')]);return db[_0x0c3f('0x31')]['find'](_0x1d5ade)['then'](handleEntityNotFound(_0x2b0071,null))[_0x0c3f('0x28')](respondWithResult(_0x2b0071,null))['catch'](handleError(_0x2b0071,null));};exports[_0x0c3f('0x49')]=function(_0x581f3d,_0x291dbc){return db[_0x0c3f('0x31')]['create'](_0x581f3d['body'],{})[_0x0c3f('0x28')](function(_0x45d8bf){var _0x22b4e5=_0x581f3d[_0x0c3f('0x4a')][_0x0c3f('0x29')]({'plain':!![]});if(!_0x22b4e5)throw new Error(_0x0c3f('0x4b'));if(_0x22b4e5[_0x0c3f('0x4c')]===_0x0c3f('0x4a')){var _0x3b9d9b=_0x45d8bf[_0x0c3f('0x29')]({'plain':!![]});var _0x5eed47=_0x0c3f('0x2a');return db[_0x0c3f('0x4d')]['find']({'where':{'name':_0x5eed47,'userProfileId':_0x22b4e5['userProfileId']},'raw':!![]})['then'](function(_0x2352c7){if(_0x2352c7&&_0x2352c7[_0x0c3f('0x4e')]===0x0){return db[_0x0c3f('0x2b')][_0x0c3f('0x49')]({'name':_0x3b9d9b['name'],'resourceId':_0x3b9d9b['id'],'type':_0x2352c7[_0x0c3f('0x2d')],'sectionId':_0x2352c7['id']},{})[_0x0c3f('0x28')](function(){return _0x45d8bf;});}else{return _0x45d8bf;}})['catch'](function(_0x56dd59){logger[_0x0c3f('0x4f')](_0x0c3f('0x50'),_0x56dd59);throw _0x56dd59;});}return _0x45d8bf;})['then'](respondWithResult(_0x291dbc,0xc9))['catch'](handleError(_0x291dbc,null));};exports['update']=function(_0x3f0120,_0x4ae5e6){if(_0x3f0120[_0x0c3f('0x51')]['id']){delete _0x3f0120[_0x0c3f('0x51')]['id'];}return db['WhatsappQueue']['find']({'where':{'id':_0x3f0120[_0x0c3f('0x52')]['id']}})[_0x0c3f('0x28')](handleEntityNotFound(_0x4ae5e6,null))[_0x0c3f('0x28')](saveUpdates(_0x3f0120[_0x0c3f('0x51')],null))[_0x0c3f('0x28')](respondWithResult(_0x4ae5e6,null))[_0x0c3f('0x45')](handleError(_0x4ae5e6,null));};exports[_0x0c3f('0x2c')]=function(_0x541e05,_0x4c06b1){return db[_0x0c3f('0x31')][_0x0c3f('0x53')]({'where':{'id':_0x541e05[_0x0c3f('0x52')]['id']}})[_0x0c3f('0x28')](handleEntityNotFound(_0x4c06b1,null))[_0x0c3f('0x28')](removeEntity(_0x4c06b1,null))[_0x0c3f('0x45')](handleError(_0x4c06b1,null));};exports[_0x0c3f('0x54')]=function(_0x34d33e,_0xa5f729){return db['WhatsappQueue'][_0x0c3f('0x54')]()[_0x0c3f('0x28')](respondWithResult(_0xa5f729,null))['catch'](handleError(_0xa5f729,null));};exports[_0x0c3f('0x55')]=function(_0x6859d1,_0x4bd0a3,_0x407216){var _0x3f9faa={'raw':!![],'where':{}},_0x2e4f99={},_0x262640;return db[_0x0c3f('0x31')][_0x0c3f('0x56')]({'where':{'id':_0x6859d1[_0x0c3f('0x52')]['id']}})[_0x0c3f('0x28')](handleEntityNotFound(_0x4bd0a3,null))['then'](function(_0xe5e294){if(_0xe5e294){_0x262640=_0xe5e294[_0x0c3f('0x29')]({'plain':!![]});_0x2e4f99[_0x0c3f('0x35')]=_[_0x0c3f('0x47')](db[_0x0c3f('0x57')][_0x0c3f('0x32')]);_0x2e4f99[_0x0c3f('0x38')]=_[_0x0c3f('0x47')](_0x6859d1['query']);_0x2e4f99[_0x0c3f('0x36')]=_['intersection'](_0x2e4f99[_0x0c3f('0x35')],_0x2e4f99[_0x0c3f('0x38')]);_0x3f9faa[_0x0c3f('0x39')]=_[_0x0c3f('0x37')](_0x2e4f99[_0x0c3f('0x35')],qs[_0x0c3f('0x3a')](_0x6859d1['query']['fields']));_0x3f9faa[_0x0c3f('0x39')]=_0x3f9faa[_0x0c3f('0x39')][_0x0c3f('0x3b')]?_0x3f9faa[_0x0c3f('0x39')]:_0x2e4f99[_0x0c3f('0x35')];if(!_0x6859d1['query'][_0x0c3f('0x58')](_0x0c3f('0x59'))){_0x3f9faa[_0x0c3f('0x23')]=qs[_0x0c3f('0x23')](_0x6859d1[_0x0c3f('0x38')]['limit']);_0x3f9faa[_0x0c3f('0x22')]=qs[_0x0c3f('0x22')](_0x6859d1[_0x0c3f('0x38')]['offset']);}_0x3f9faa[_0x0c3f('0x3c')]=qs[_0x0c3f('0x3d')](_0x6859d1[_0x0c3f('0x38')][_0x0c3f('0x3d')]);_0x3f9faa[_0x0c3f('0x3e')]=qs[_0x0c3f('0x36')](_[_0x0c3f('0x5a')](_0x6859d1['query'],_0x2e4f99[_0x0c3f('0x36')]));_0x3f9faa[_0x0c3f('0x3e')][_0x0c3f('0x5b')]=_0xe5e294['id'];if(_0x6859d1[_0x0c3f('0x38')]['filter']){_0x3f9faa['where']=_[_0x0c3f('0x40')](_0x3f9faa[_0x0c3f('0x3e')],{'$or':_['map'](_0x3f9faa[_0x0c3f('0x39')],function(_0x11139e){var _0x59f589={};_0x59f589[_0x11139e]={'$like':'%'+_0x6859d1[_0x0c3f('0x38')][_0x0c3f('0x3f')]+'%'};return _0x59f589;})});}_0x3f9faa=_[_0x0c3f('0x40')]({},_0x3f9faa,_0x6859d1[_0x0c3f('0x48')]);return db['UserWhatsappQueue'][_0x0c3f('0x5c')](_0x3f9faa);}})[_0x0c3f('0x28')](function(_0x56d3e4){if(_0x56d3e4){return db[_0x0c3f('0x5d')][_0x0c3f('0x5e')]({'where':{'id':_[_0x0c3f('0x30')](_0x56d3e4,_0x0c3f('0x5f')),'role':_0x0c3f('0x60')},'attributes':['id',_0x0c3f('0x2d'),_0x0c3f('0x61'),_0x0c3f('0x62'),_0x0c3f('0x63')]});}})[_0x0c3f('0x28')](function(_0x25207c){if(_0x25207c){return{'count':_0x25207c[_0x0c3f('0x21')],'rows':_[_0x0c3f('0x30')](_0x25207c[_0x0c3f('0x44')],function(_0x588e64){return{'membername':_0x588e64[_0x0c3f('0x2d')],'UserId':_0x588e64['id'],'queue_name':_0x262640['name'],'WhatsappQueueId':_0x262640['id'],'interface':util[_0x0c3f('0x64')](_0x0c3f('0x65'),_0x0c3f('0x66'),_0x588e64[_0x0c3f('0x2d')]),'penalty':0x0,'paused':_0x588e64[_0x0c3f('0x61')],'createdAt':_0x588e64[_0x0c3f('0x63')],'updatedAt':_0x588e64[_0x0c3f('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0c3f('0x28')](respondWithFilteredResult(_0x4bd0a3,_0x3f9faa))[_0x0c3f('0x45')](handleError(_0x4bd0a3,null));};exports[_0x0c3f('0x67')]=function(_0x5db989,_0x2a7469,_0x4fc137){var _0x6a1928={};var _0x14462f={};var _0x29f811;var _0x503f4a;return db['WhatsappQueue'][_0x0c3f('0x56')]({'where':{'id':_0x5db989['params']['id']}})[_0x0c3f('0x28')](handleEntityNotFound(_0x2a7469,null))[_0x0c3f('0x28')](function(_0x357650){if(_0x357650){_0x29f811=_0x357650;_0x14462f[_0x0c3f('0x35')]=_['keys'](db[_0x0c3f('0x68')][_0x0c3f('0x32')]);_0x14462f['query']=_[_0x0c3f('0x47')](_0x5db989['query']);_0x14462f[_0x0c3f('0x36')]=_['intersection'](_0x14462f[_0x0c3f('0x35')],_0x14462f['query']);_0x6a1928['attributes']=_[_0x0c3f('0x37')](_0x14462f['model'],qs[_0x0c3f('0x3a')](_0x5db989[_0x0c3f('0x38')][_0x0c3f('0x3a')]));_0x6a1928[_0x0c3f('0x39')]=_0x6a1928['attributes'][_0x0c3f('0x3b')]?_0x6a1928['attributes']:_0x14462f[_0x0c3f('0x35')];_0x6a1928[_0x0c3f('0x3c')]=qs[_0x0c3f('0x3d')](_0x5db989['query']['sort']);_0x6a1928[_0x0c3f('0x3e')]=qs['filters'](_['pick'](_0x5db989[_0x0c3f('0x38')],_0x14462f['filters']));if(_0x5db989[_0x0c3f('0x38')]['filter']){_0x6a1928[_0x0c3f('0x3e')]=_[_0x0c3f('0x40')](_0x6a1928[_0x0c3f('0x3e')],{'$or':_[_0x0c3f('0x30')](_0x6a1928['attributes'],function(_0x1c72ee){var _0x2449c4={};_0x2449c4[_0x1c72ee]={'$like':'%'+_0x5db989['query'][_0x0c3f('0x3f')]+'%'};return _0x2449c4;})});}_0x6a1928=_[_0x0c3f('0x40')]({},_0x6a1928,_0x5db989[_0x0c3f('0x48')]);return _0x29f811[_0x0c3f('0x67')](_0x6a1928);}})['then'](function(_0x3d2b4c){if(_0x3d2b4c){_0x503f4a=_0x3d2b4c[_0x0c3f('0x3b')];if(!_0x5db989[_0x0c3f('0x38')][_0x0c3f('0x58')](_0x0c3f('0x59'))){_0x6a1928[_0x0c3f('0x23')]=qs[_0x0c3f('0x23')](_0x5db989[_0x0c3f('0x38')][_0x0c3f('0x23')]);_0x6a1928[_0x0c3f('0x22')]=qs['offset'](_0x5db989[_0x0c3f('0x38')]['offset']);}return _0x29f811[_0x0c3f('0x67')](_0x6a1928);}})[_0x0c3f('0x28')](function(_0x23e61b){if(_0x23e61b){return _0x23e61b?{'count':_0x503f4a,'rows':_0x23e61b}:null;}})[_0x0c3f('0x28')](respondWithResult(_0x2a7469,null))[_0x0c3f('0x45')](handleError(_0x2a7469,null));};exports[_0x0c3f('0x69')]=function(_0x40c2e1,_0xdfe3ec,_0x5751e1){var _0xfede2c=_0x40c2e1[_0x0c3f('0x51')][_0x0c3f('0x6a')];return db[_0x0c3f('0x68')][_0x0c3f('0x5c')]({'where':{'id':_0xfede2c},'attributes':['id'],'include':[{'model':db[_0x0c3f('0x5d')],'as':'Agents','attributes':['id',_0x0c3f('0x2d'),'online',_0x0c3f('0x6b'),_0x0c3f('0x6c')],'raw':!![]}]})[_0x0c3f('0x28')](function(_0x50b561){if(_0x50b561){var _0x3d4046=_['flatMap'](_0x50b561,function(_0x5527ba){var _0x466e8e=_0x5527ba[_0x0c3f('0x29')]({'plain':!![]});return _0x466e8e['Agents'];});return db[_0x0c3f('0x31')][_0x0c3f('0x53')]({'where':{'id':_0x40c2e1[_0x0c3f('0x52')]['id']}})['then'](function(_0x36e75c){return db['sequelize']['transaction'](function(_0x555691){return _0x36e75c[_0x0c3f('0x69')](_0xfede2c,{'transaction':_0x555691})[_0x0c3f('0x28')](function(){return BPromise['each'](_0x3d4046,function(_0x36b2f3){return db[_0x0c3f('0x57')][_0x0c3f('0x6d')]({'where':{'UserId':_0x36b2f3['id'],'WhatsappQueueId':_0x40c2e1['params']['id']},'transaction':_0x555691});});})[_0x0c3f('0x28')](function(){_0x3d4046['forEach'](function(_0x2fa672){socket[_0x0c3f('0x6e')](_0x0c3f('0x6f'),{'UserId':_0x2fa672['id'],'WhatsappQueueId':_0x36e75c['id']});});});});});}})[_0x0c3f('0x28')](respondWithStatusCode(_0xdfe3ec,null))[_0x0c3f('0x45')](handleError(_0xdfe3ec,null));};exports[_0x0c3f('0x70')]=function(_0x19f84d,_0x151de5,_0x2cd398){return db[_0x0c3f('0x68')][_0x0c3f('0x5c')]({'where':{'id':_0x19f84d['query'][_0x0c3f('0x6a')]},'attributes':['id'],'include':[{'model':db[_0x0c3f('0x5d')],'as':_0x0c3f('0x71'),'attributes':['id'],'raw':!![]}]})[_0x0c3f('0x28')](handleEntityNotFound(_0x151de5,null))[_0x0c3f('0x28')](function(_0x254a74){var _0x48e2d7=_['map'](_0x254a74,'id');var _0xf3c093=[];var _0x15b1c8=[];var _0x2069e0=squel[_0x0c3f('0x72')]();_0x2069e0['field'](_0x0c3f('0x73'))[_0x0c3f('0x74')]('team_has_whatsapp_queues','tq')[_0x0c3f('0x75')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x0c3f('0x3e')]('WhatsappQueueId\x20=\x20?',_0x19f84d['params']['id']);for(var _0x5c25b0=0x0;_0x5c25b0<_0x254a74[_0x0c3f('0x3b')];_0x5c25b0+=0x1){let _0x21ad8a=_0x254a74[_0x5c25b0];for(var _0x28e0a8=0x0;_0x28e0a8<_0x21ad8a[_0x0c3f('0x71')][_0x0c3f('0x3b')];_0x28e0a8+=0x1){let _0x3efdf1=_0x21ad8a['Agents'][_0x28e0a8];var _0x2a74d9=_0x2069e0[_0x0c3f('0x76')]();_0x2a74d9['where'](_0x0c3f('0x77'),_0x3efdf1['id']);_0x15b1c8[_0x0c3f('0x78')](db[_0x0c3f('0x79')][_0x0c3f('0x38')](_0x2a74d9['toString'](),{'type':db['sequelize'][_0x0c3f('0x7a')][_0x0c3f('0x7b')]})[_0x0c3f('0x28')](function(_0x3416b2){if(_0x3416b2[_0x0c3f('0x3b')]===0x1){return _0x3efdf1['id'];}else{var _0x12d66e=_['every'](_['map'](_0x3416b2,'TeamId'),function(_0x1fc9e1){return _[_0x0c3f('0x7c')](_0x48e2d7,_0x1fc9e1);});if(_0x12d66e){return _0x3efdf1['id'];}}}));}}return BPromise[_0x0c3f('0x7d')](_0x15b1c8)[_0x0c3f('0x28')](function(_0x503f2e){_0xf3c093=_(_0xf3c093)[_0x0c3f('0x7e')](_0x503f2e)['compact']()['value']();return db[_0x0c3f('0x31')][_0x0c3f('0x53')]({'where':{'id':_0x19f84d[_0x0c3f('0x52')]['id']}})['then'](function(_0x5c8308){return db['sequelize'][_0x0c3f('0x7f')](function(_0x51e44b){return _0x5c8308[_0x0c3f('0x70')](_0x19f84d['query'][_0x0c3f('0x6a')],{'transaction':_0x51e44b})['then'](function(){if(!_[_0x0c3f('0x80')](_0xf3c093)){return _0x5c8308[_0x0c3f('0x81')](_0xf3c093,{'transaction':_0x51e44b});}})[_0x0c3f('0x28')](function(){_0xf3c093[_0x0c3f('0x82')](function(_0x100638){socket[_0x0c3f('0x6e')](_0x0c3f('0x83'),{'UserId':_0x100638,'WhatsappQueueId':_0x5c8308['id']});});});});});});})['then'](respondWithStatusCode(_0x151de5,null))[_0x0c3f('0x45')](handleError(_0x151de5,null));};exports['addAgents']=function(_0x1070c4,_0x40bbcc,_0x5ac69a){return db[_0x0c3f('0x31')][_0x0c3f('0x53')]({'where':{'id':_0x1070c4['params']['id']}})[_0x0c3f('0x28')](handleEntityNotFound(_0x40bbcc,null))['then'](function(_0x2ea651){if(_0x2ea651){return _0x2ea651[_0x0c3f('0x84')](_0x1070c4[_0x0c3f('0x51')][_0x0c3f('0x6a')],_[_0x0c3f('0x85')](_0x1070c4[_0x0c3f('0x51')],[_0x0c3f('0x6a'),'id'])||{})[_0x0c3f('0x86')](function(_0x5d9992){for(var _0x46b185=0x0;_0x46b185<_0x1070c4[_0x0c3f('0x51')][_0x0c3f('0x6a')][_0x0c3f('0x3b')];_0x46b185+=0x1){socket[_0x0c3f('0x6e')](_0x0c3f('0x6f'),{'UserId':_0x1070c4[_0x0c3f('0x51')][_0x0c3f('0x6a')][_0x46b185],'WhatsappQueueId':_0x1070c4['params']['id']});}return _0x5d9992;});}})['then'](respondWithResult(_0x40bbcc,null))[_0x0c3f('0x45')](handleError(_0x40bbcc,null));};exports['removeAgents']=function(_0x268a5d,_0x24bbcf,_0x20bd09){return db[_0x0c3f('0x31')]['find']({'where':{'id':_0x268a5d['params']['id']}})[_0x0c3f('0x28')](handleEntityNotFound(_0x24bbcf,null))['then'](function(_0x2dcb56){if(_0x2dcb56){return _0x2dcb56[_0x0c3f('0x81')](_0x268a5d['query'][_0x0c3f('0x6a')])[_0x0c3f('0x28')](function(){if(_[_0x0c3f('0x87')](_0x268a5d[_0x0c3f('0x38')][_0x0c3f('0x6a')])){for(var _0x6763=0x0;_0x6763<_0x268a5d[_0x0c3f('0x38')][_0x0c3f('0x6a')]['length'];_0x6763+=0x1){socket['emit'](_0x0c3f('0x83'),{'UserId':Number(_0x268a5d[_0x0c3f('0x38')][_0x0c3f('0x6a')][_0x6763]),'WhatsappQueueId':Number(_0x268a5d[_0x0c3f('0x52')]['id'])});}}else{socket[_0x0c3f('0x6e')](_0x0c3f('0x83'),{'UserId':Number(_0x268a5d[_0x0c3f('0x38')]['ids']),'WhatsappQueueId':Number(_0x268a5d[_0x0c3f('0x52')]['id'])});}});}})['then'](respondWithStatusCode(_0x24bbcf,null))[_0x0c3f('0x45')](handleError(_0x24bbcf,null));};exports['getAgents']=function(_0x46fba5,_0x3468a6,_0x2b607e){var _0x5497df={};var _0x5bed31={};var _0x29a5d5;var _0x322a66;return db[_0x0c3f('0x31')][_0x0c3f('0x56')]({'where':{'id':_0x46fba5[_0x0c3f('0x52')]['id']}})['then'](handleEntityNotFound(_0x3468a6,null))['then'](function(_0x4875c4){if(_0x4875c4){_0x29a5d5=_0x4875c4;_0x5bed31[_0x0c3f('0x35')]=_[_0x0c3f('0x47')](db[_0x0c3f('0x5d')][_0x0c3f('0x32')]);_0x5bed31[_0x0c3f('0x38')]=_[_0x0c3f('0x47')](_0x46fba5[_0x0c3f('0x38')]);_0x5bed31[_0x0c3f('0x36')]=_['intersection'](_0x5bed31['model'],_0x5bed31[_0x0c3f('0x38')]);_0x5497df[_0x0c3f('0x39')]=_[_0x0c3f('0x37')](_0x5bed31['model'],qs[_0x0c3f('0x3a')](_0x46fba5[_0x0c3f('0x38')][_0x0c3f('0x3a')]));_0x5497df[_0x0c3f('0x39')]=_0x5497df[_0x0c3f('0x39')]['length']?_0x5497df[_0x0c3f('0x39')]:_0x5bed31['model'];_0x5497df[_0x0c3f('0x3c')]=qs[_0x0c3f('0x3d')](_0x46fba5['query']['sort']);_0x5497df[_0x0c3f('0x3e')]=qs['filters'](_[_0x0c3f('0x5a')](_0x46fba5[_0x0c3f('0x38')],_0x5bed31['filters']));if(_0x46fba5[_0x0c3f('0x38')][_0x0c3f('0x3f')]){_0x5497df[_0x0c3f('0x3e')]=_[_0x0c3f('0x40')](_0x5497df['where'],{'$or':_[_0x0c3f('0x30')](_0x5497df[_0x0c3f('0x39')],function(_0x44b8bd){var _0x3e771b={};_0x3e771b[_0x44b8bd]={'$like':'%'+_0x46fba5['query']['filter']+'%'};return _0x3e771b;})});}_0x5497df=_[_0x0c3f('0x40')]({},_0x5497df,_0x46fba5['options']);return _0x29a5d5[_0x0c3f('0x88')](_0x5497df);}})[_0x0c3f('0x28')](function(_0x717fc0){if(_0x717fc0){_0x322a66=_0x717fc0[_0x0c3f('0x3b')];if(!_0x46fba5[_0x0c3f('0x38')][_0x0c3f('0x58')](_0x0c3f('0x59'))){_0x5497df[_0x0c3f('0x23')]=qs[_0x0c3f('0x23')](_0x46fba5[_0x0c3f('0x38')][_0x0c3f('0x23')]);_0x5497df[_0x0c3f('0x22')]=qs['offset'](_0x46fba5[_0x0c3f('0x38')]['offset']);}return _0x29a5d5[_0x0c3f('0x88')](_0x5497df);}})[_0x0c3f('0x28')](function(_0x42432b){if(_0x42432b){return _0x42432b?{'count':_0x322a66,'rows':_0x42432b}:null;}})[_0x0c3f('0x28')](respondWithResult(_0x3468a6,null))[_0x0c3f('0x45')](handleError(_0x3468a6,null));}; \ No newline at end of file +var _0xfee3=['zip-dir','bluebird','path','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','update','then','destroy','get','UserProfileResource','error','name','send','index','map','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','WhatsappQueue','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappQueues','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','WhatsappQueueId','User','findAndCountAll','agent','whatsappPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','length','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userWhatsappQueue:save','select','field','tq.TeamId','from','team_has_whatsapp_queues','user_has_teams','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','emit','addAgents','omit','spread','isArray','userWhatsappQueue:remove','getAgents','html-pdf','eml-format','rimraf'];(function(_0x4bc182,_0x4b96fd){var _0x426132=function(_0xf433e1){while(--_0xf433e1){_0x4bc182['push'](_0x4bc182['shift']());}};_0x426132(++_0x4b96fd);}(_0xfee3,0x111));var _0x3fee=function(_0x31a576,_0x424419){_0x31a576=_0x31a576-0x0;var _0x30b1d3=_0xfee3[_0x31a576];return _0x30b1d3;};'use strict';var pdf=require(_0x3fee('0x0'));var emlformat=require(_0x3fee('0x1'));var rimraf=require(_0x3fee('0x2'));var zipdir=require(_0x3fee('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3fee('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3fee('0x5'));var sox=require('sox');var csv=require(_0x3fee('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3fee('0x7'));var squel=require(_0x3fee('0x8'));var crypto=require(_0x3fee('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x3fee('0xa'));var toCsv=require(_0x3fee('0x6'));var querystring=require(_0x3fee('0xb'));var Papa=require(_0x3fee('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3fee('0xd'));var as=require(_0x3fee('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3fee('0xf'));var utils=require('../../config/utils');var config=require(_0x3fee('0x10'));var db=require(_0x3fee('0x11'))['db'];config['redis']=_[_0x3fee('0x12')](config[_0x3fee('0x13')],{'host':_0x3fee('0x14'),'port':0x18eb});var socket=require(_0x3fee('0x15'))(new Redis(config[_0x3fee('0x13')]));require(_0x3fee('0x16'))['register'](socket);function respondWithStatusCode(_0x27c578,_0x57f359){_0x57f359=_0x57f359||0xcc;return function(_0x37b57d){if(_0x37b57d){return _0x27c578[_0x3fee('0x17')](_0x57f359);}return _0x27c578[_0x3fee('0x18')](_0x57f359)[_0x3fee('0x19')]();};}function respondWithResult(_0x4f6edb,_0x2376d7){_0x2376d7=_0x2376d7||0xc8;return function(_0x54decf){if(_0x54decf){return _0x4f6edb[_0x3fee('0x18')](_0x2376d7)['json'](_0x54decf);}};}function respondWithFilteredResult(_0x3b56e7,_0x51a48b){return function(_0x24eebd){if(_0x24eebd){var _0x3d5269=_0x24eebd[_0x3fee('0x1a')],_0x1b34f9=_0x51a48b[_0x3fee('0x1b')],_0x10caa6=_0x51a48b[_0x3fee('0x1b')]+_0x51a48b[_0x3fee('0x1c')],_0x19fb42;if(_0x10caa6>=_0x3d5269){_0x10caa6=_0x3d5269;_0x19fb42=0xc8;}else{_0x19fb42=0xce;}_0x3b56e7[_0x3fee('0x18')](_0x19fb42);return _0x3b56e7['set'](_0x3fee('0x1d'),_0x1b34f9+'-'+_0x10caa6+'/'+_0x3d5269)[_0x3fee('0x1e')](_0x24eebd);}return null;};}function patchUpdates(_0xf5e32b){return function(_0x5880cb){try{jsonpatch[_0x3fee('0x1f')](_0x5880cb,_0xf5e32b,!![]);}catch(_0x3b7d0b){return BPromise['reject'](_0x3b7d0b);}return _0x5880cb['save']();};}function saveUpdates(_0x4c3208,_0xc35e71){return function(_0x6035dc){if(_0x6035dc){return _0x6035dc[_0x3fee('0x20')](_0x4c3208)[_0x3fee('0x21')](function(_0x4209a9){return _0x4209a9;});}return null;};}function removeEntity(_0x50eefc,_0x5ae041){return function(_0x388d09){if(_0x388d09){return _0x388d09[_0x3fee('0x22')]()[_0x3fee('0x21')](function(){var _0x2a7ced=_0x388d09[_0x3fee('0x23')]({'plain':!![]});var _0x1f359c='WhatsappQueues';return db[_0x3fee('0x24')]['destroy']({'where':{'type':_0x1f359c,'resourceId':_0x2a7ced['id']}})[_0x3fee('0x21')](function(){return _0x388d09;});})[_0x3fee('0x21')](function(){_0x50eefc[_0x3fee('0x18')](0xcc)[_0x3fee('0x19')]();});}};}function handleEntityNotFound(_0x5a60be,_0x21d98e){return function(_0x56220a){if(!_0x56220a){_0x5a60be['sendStatus'](0x194);}return _0x56220a;};}function handleError(_0x349d79,_0x3cbf32){_0x3cbf32=_0x3cbf32||0x1f4;return function(_0x429938){logger[_0x3fee('0x25')](_0x429938['stack']);if(_0x429938[_0x3fee('0x26')]){delete _0x429938[_0x3fee('0x26')];}_0x349d79[_0x3fee('0x18')](_0x3cbf32)[_0x3fee('0x27')](_0x429938);};}exports[_0x3fee('0x28')]=function(_0x312995,_0x50ac95){var _0x1b0690={},_0x52f1a2={},_0x22ec7e={'count':0x0,'rows':[]};var _0x2bf803=_[_0x3fee('0x29')](db['WhatsappQueue']['rawAttributes'],function(_0x2f43c8){return{'name':_0x2f43c8['fieldName'],'type':_0x2f43c8[_0x3fee('0x2a')][_0x3fee('0x2b')]};});_0x52f1a2[_0x3fee('0x2c')]=_['map'](_0x2bf803,_0x3fee('0x26'));_0x52f1a2[_0x3fee('0x2d')]=_[_0x3fee('0x2e')](_0x312995[_0x3fee('0x2d')]);_0x52f1a2[_0x3fee('0x2f')]=_['intersection'](_0x52f1a2[_0x3fee('0x2c')],_0x52f1a2[_0x3fee('0x2d')]);_0x1b0690['attributes']=_[_0x3fee('0x30')](_0x52f1a2[_0x3fee('0x2c')],qs[_0x3fee('0x31')](_0x312995[_0x3fee('0x2d')][_0x3fee('0x31')]));_0x1b0690[_0x3fee('0x32')]=_0x1b0690[_0x3fee('0x32')]['length']?_0x1b0690[_0x3fee('0x32')]:_0x52f1a2[_0x3fee('0x2c')];if(!_0x312995[_0x3fee('0x2d')][_0x3fee('0x33')](_0x3fee('0x34'))){_0x1b0690[_0x3fee('0x1c')]=qs[_0x3fee('0x1c')](_0x312995[_0x3fee('0x2d')][_0x3fee('0x1c')]);_0x1b0690[_0x3fee('0x1b')]=qs[_0x3fee('0x1b')](_0x312995['query']['offset']);}_0x1b0690[_0x3fee('0x35')]=qs[_0x3fee('0x36')](_0x312995['query'][_0x3fee('0x36')]);_0x1b0690['where']=qs[_0x3fee('0x2f')](_[_0x3fee('0x37')](_0x312995[_0x3fee('0x2d')],_0x52f1a2[_0x3fee('0x2f')]),_0x2bf803);if(_0x312995[_0x3fee('0x2d')]['filter']){_0x1b0690[_0x3fee('0x38')]=_[_0x3fee('0x39')](_0x1b0690[_0x3fee('0x38')],{'$or':_[_0x3fee('0x29')](_0x2bf803,function(_0x3ac4e2){if(_0x3ac4e2[_0x3fee('0x2a')]!==_0x3fee('0x3a')){var _0x4c7045={};_0x4c7045[_0x3ac4e2[_0x3fee('0x26')]]={'$like':'%'+_0x312995[_0x3fee('0x2d')][_0x3fee('0x3b')]+'%'};return _0x4c7045;}})});}_0x1b0690=_[_0x3fee('0x39')]({},_0x1b0690,_0x312995[_0x3fee('0x3c')]);var _0xdbdfcf={'where':_0x1b0690[_0x3fee('0x38')]};return db[_0x3fee('0x3d')][_0x3fee('0x1a')](_0xdbdfcf)[_0x3fee('0x21')](function(_0x5325dc){_0x22ec7e[_0x3fee('0x1a')]=_0x5325dc;if(_0x312995[_0x3fee('0x2d')][_0x3fee('0x3e')]){_0x1b0690[_0x3fee('0x3f')]=[{'all':!![]}];}return db['WhatsappQueue'][_0x3fee('0x40')](_0x1b0690);})['then'](function(_0x4a0fb4){_0x22ec7e[_0x3fee('0x41')]=_0x4a0fb4;return _0x22ec7e;})[_0x3fee('0x21')](respondWithFilteredResult(_0x50ac95,_0x1b0690))[_0x3fee('0x42')](handleError(_0x50ac95,null));};exports[_0x3fee('0x43')]=function(_0xe83dc8,_0x5efe19){var _0xb00b6f={'raw':!![],'where':{'id':_0xe83dc8[_0x3fee('0x44')]['id']}},_0x1019b9={};_0x1019b9[_0x3fee('0x2c')]=_[_0x3fee('0x2e')](db[_0x3fee('0x3d')][_0x3fee('0x45')]);_0x1019b9['query']=_[_0x3fee('0x2e')](_0xe83dc8[_0x3fee('0x2d')]);_0x1019b9[_0x3fee('0x2f')]=_[_0x3fee('0x30')](_0x1019b9[_0x3fee('0x2c')],_0x1019b9[_0x3fee('0x2d')]);_0xb00b6f['attributes']=_[_0x3fee('0x30')](_0x1019b9[_0x3fee('0x2c')],qs[_0x3fee('0x31')](_0xe83dc8[_0x3fee('0x2d')][_0x3fee('0x31')]));_0xb00b6f[_0x3fee('0x32')]=_0xb00b6f[_0x3fee('0x32')]['length']?_0xb00b6f[_0x3fee('0x32')]:_0x1019b9[_0x3fee('0x2c')];if(_0xe83dc8[_0x3fee('0x2d')][_0x3fee('0x3e')]){_0xb00b6f[_0x3fee('0x3f')]=[{'all':!![]}];}_0xb00b6f=_[_0x3fee('0x39')]({},_0xb00b6f,_0xe83dc8[_0x3fee('0x3c')]);return db[_0x3fee('0x3d')][_0x3fee('0x46')](_0xb00b6f)[_0x3fee('0x21')](handleEntityNotFound(_0x5efe19,null))[_0x3fee('0x21')](respondWithResult(_0x5efe19,null))['catch'](handleError(_0x5efe19,null));};exports[_0x3fee('0x47')]=function(_0x1d2d54,_0x264805){return db[_0x3fee('0x3d')][_0x3fee('0x47')](_0x1d2d54[_0x3fee('0x48')],{})['then'](function(_0x57b709){var _0x2ece71=_0x1d2d54[_0x3fee('0x49')][_0x3fee('0x23')]({'plain':!![]});if(!_0x2ece71)throw new Error(_0x3fee('0x4a'));if(_0x2ece71[_0x3fee('0x4b')]===_0x3fee('0x49')){var _0x41c841=_0x57b709['get']({'plain':!![]});var _0x5bcaea=_0x3fee('0x4c');return db[_0x3fee('0x4d')][_0x3fee('0x46')]({'where':{'name':_0x5bcaea,'userProfileId':_0x2ece71['userProfileId']},'raw':!![]})[_0x3fee('0x21')](function(_0x591858){if(_0x591858&&_0x591858['autoAssociation']===0x0){return db['UserProfileResource'][_0x3fee('0x47')]({'name':_0x41c841['name'],'resourceId':_0x41c841['id'],'type':_0x591858['name'],'sectionId':_0x591858['id']},{})['then'](function(){return _0x57b709;});}else{return _0x57b709;}})[_0x3fee('0x42')](function(_0x343668){logger['error'](_0x3fee('0x4e'),_0x343668);throw _0x343668;});}return _0x57b709;})[_0x3fee('0x21')](respondWithResult(_0x264805,0xc9))['catch'](handleError(_0x264805,null));};exports[_0x3fee('0x20')]=function(_0x8d978e,_0x516380){if(_0x8d978e[_0x3fee('0x48')]['id']){delete _0x8d978e[_0x3fee('0x48')]['id'];}return db['WhatsappQueue'][_0x3fee('0x46')]({'where':{'id':_0x8d978e[_0x3fee('0x44')]['id']}})[_0x3fee('0x21')](handleEntityNotFound(_0x516380,null))[_0x3fee('0x21')](saveUpdates(_0x8d978e[_0x3fee('0x48')],null))['then'](respondWithResult(_0x516380,null))[_0x3fee('0x42')](handleError(_0x516380,null));};exports[_0x3fee('0x22')]=function(_0x59e11b,_0x20a726){return db['WhatsappQueue'][_0x3fee('0x46')]({'where':{'id':_0x59e11b[_0x3fee('0x44')]['id']}})[_0x3fee('0x21')](handleEntityNotFound(_0x20a726,null))[_0x3fee('0x21')](removeEntity(_0x20a726,null))[_0x3fee('0x42')](handleError(_0x20a726,null));};exports[_0x3fee('0x4f')]=function(_0x1ae93e,_0x4631b8){return db[_0x3fee('0x3d')]['describe']()[_0x3fee('0x21')](respondWithResult(_0x4631b8,null))[_0x3fee('0x42')](handleError(_0x4631b8,null));};exports[_0x3fee('0x50')]=function(_0x3791c8,_0x1b1634,_0x1b25db){var _0x22a9fa={'raw':!![],'where':{}},_0x33dfab={},_0xac8bc2;return db[_0x3fee('0x3d')][_0x3fee('0x51')]({'where':{'id':_0x3791c8[_0x3fee('0x44')]['id']}})[_0x3fee('0x21')](handleEntityNotFound(_0x1b1634,null))[_0x3fee('0x21')](function(_0x3347cd){if(_0x3347cd){_0xac8bc2=_0x3347cd[_0x3fee('0x23')]({'plain':!![]});_0x33dfab[_0x3fee('0x2c')]=_['keys'](db[_0x3fee('0x52')][_0x3fee('0x45')]);_0x33dfab['query']=_['keys'](_0x3791c8['query']);_0x33dfab[_0x3fee('0x2f')]=_[_0x3fee('0x30')](_0x33dfab[_0x3fee('0x2c')],_0x33dfab[_0x3fee('0x2d')]);_0x22a9fa[_0x3fee('0x32')]=_['intersection'](_0x33dfab['model'],qs[_0x3fee('0x31')](_0x3791c8['query'][_0x3fee('0x31')]));_0x22a9fa['attributes']=_0x22a9fa[_0x3fee('0x32')]['length']?_0x22a9fa['attributes']:_0x33dfab['model'];if(!_0x3791c8['query'][_0x3fee('0x33')]('nolimit')){_0x22a9fa[_0x3fee('0x1c')]=qs[_0x3fee('0x1c')](_0x3791c8[_0x3fee('0x2d')]['limit']);_0x22a9fa[_0x3fee('0x1b')]=qs[_0x3fee('0x1b')](_0x3791c8[_0x3fee('0x2d')]['offset']);}_0x22a9fa['order']=qs['sort'](_0x3791c8['query'][_0x3fee('0x36')]);_0x22a9fa[_0x3fee('0x38')]=qs[_0x3fee('0x2f')](_[_0x3fee('0x37')](_0x3791c8[_0x3fee('0x2d')],_0x33dfab[_0x3fee('0x2f')]));_0x22a9fa[_0x3fee('0x38')][_0x3fee('0x53')]=_0x3347cd['id'];if(_0x3791c8[_0x3fee('0x2d')][_0x3fee('0x3b')]){_0x22a9fa[_0x3fee('0x38')]=_[_0x3fee('0x39')](_0x22a9fa[_0x3fee('0x38')],{'$or':_[_0x3fee('0x29')](_0x22a9fa[_0x3fee('0x32')],function(_0x48b079){var _0x1bb0cb={};_0x1bb0cb[_0x48b079]={'$like':'%'+_0x3791c8[_0x3fee('0x2d')][_0x3fee('0x3b')]+'%'};return _0x1bb0cb;})});}_0x22a9fa=_[_0x3fee('0x39')]({},_0x22a9fa,_0x3791c8['options']);return db[_0x3fee('0x52')]['findAll'](_0x22a9fa);}})['then'](function(_0x37b5bb){if(_0x37b5bb){return db[_0x3fee('0x54')][_0x3fee('0x55')]({'where':{'id':_['map'](_0x37b5bb,'UserId'),'role':_0x3fee('0x56')},'attributes':['id',_0x3fee('0x26'),_0x3fee('0x57'),_0x3fee('0x58'),'createdAt']});}})[_0x3fee('0x21')](function(_0x55b198){if(_0x55b198){return{'count':_0x55b198[_0x3fee('0x1a')],'rows':_[_0x3fee('0x29')](_0x55b198[_0x3fee('0x41')],function(_0x36bc42){return{'membername':_0x36bc42['name'],'UserId':_0x36bc42['id'],'queue_name':_0xac8bc2[_0x3fee('0x26')],'WhatsappQueueId':_0xac8bc2['id'],'interface':util[_0x3fee('0x59')](_0x3fee('0x5a'),_0x3fee('0x5b'),_0x36bc42[_0x3fee('0x26')]),'penalty':0x0,'paused':_0x36bc42[_0x3fee('0x57')],'createdAt':_0x36bc42[_0x3fee('0x5c')],'updatedAt':_0x36bc42['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x3fee('0x21')](respondWithFilteredResult(_0x1b1634,_0x22a9fa))[_0x3fee('0x42')](handleError(_0x1b1634,null));};exports[_0x3fee('0x5d')]=function(_0x3cc204,_0x37bc31,_0x1a3609){var _0x49ac76={};var _0x23f834={};var _0x3dbb0d;var _0x35da5d;return db[_0x3fee('0x3d')][_0x3fee('0x51')]({'where':{'id':_0x3cc204[_0x3fee('0x44')]['id']}})[_0x3fee('0x21')](handleEntityNotFound(_0x37bc31,null))['then'](function(_0x55d0e3){if(_0x55d0e3){_0x3dbb0d=_0x55d0e3;_0x23f834[_0x3fee('0x2c')]=_[_0x3fee('0x2e')](db[_0x3fee('0x5e')][_0x3fee('0x45')]);_0x23f834[_0x3fee('0x2d')]=_['keys'](_0x3cc204[_0x3fee('0x2d')]);_0x23f834[_0x3fee('0x2f')]=_[_0x3fee('0x30')](_0x23f834[_0x3fee('0x2c')],_0x23f834[_0x3fee('0x2d')]);_0x49ac76[_0x3fee('0x32')]=_[_0x3fee('0x30')](_0x23f834[_0x3fee('0x2c')],qs[_0x3fee('0x31')](_0x3cc204[_0x3fee('0x2d')]['fields']));_0x49ac76[_0x3fee('0x32')]=_0x49ac76[_0x3fee('0x32')][_0x3fee('0x5f')]?_0x49ac76['attributes']:_0x23f834['model'];_0x49ac76[_0x3fee('0x35')]=qs[_0x3fee('0x36')](_0x3cc204[_0x3fee('0x2d')][_0x3fee('0x36')]);_0x49ac76['where']=qs[_0x3fee('0x2f')](_[_0x3fee('0x37')](_0x3cc204[_0x3fee('0x2d')],_0x23f834[_0x3fee('0x2f')]));if(_0x3cc204['query'][_0x3fee('0x3b')]){_0x49ac76[_0x3fee('0x38')]=_[_0x3fee('0x39')](_0x49ac76['where'],{'$or':_[_0x3fee('0x29')](_0x49ac76[_0x3fee('0x32')],function(_0x348dd1){var _0x1388bc={};_0x1388bc[_0x348dd1]={'$like':'%'+_0x3cc204[_0x3fee('0x2d')][_0x3fee('0x3b')]+'%'};return _0x1388bc;})});}_0x49ac76=_[_0x3fee('0x39')]({},_0x49ac76,_0x3cc204['options']);return _0x3dbb0d[_0x3fee('0x5d')](_0x49ac76);}})[_0x3fee('0x21')](function(_0x38f5db){if(_0x38f5db){_0x35da5d=_0x38f5db['length'];if(!_0x3cc204[_0x3fee('0x2d')]['hasOwnProperty'](_0x3fee('0x34'))){_0x49ac76[_0x3fee('0x1c')]=qs['limit'](_0x3cc204[_0x3fee('0x2d')][_0x3fee('0x1c')]);_0x49ac76[_0x3fee('0x1b')]=qs[_0x3fee('0x1b')](_0x3cc204['query'][_0x3fee('0x1b')]);}return _0x3dbb0d[_0x3fee('0x5d')](_0x49ac76);}})[_0x3fee('0x21')](function(_0x4448ae){if(_0x4448ae){return _0x4448ae?{'count':_0x35da5d,'rows':_0x4448ae}:null;}})['then'](respondWithResult(_0x37bc31,null))[_0x3fee('0x42')](handleError(_0x37bc31,null));};exports[_0x3fee('0x60')]=function(_0x827b3f,_0x510d19,_0x1e5fc0){var _0x330fbe=_0x827b3f['body'][_0x3fee('0x61')];return db['Team'][_0x3fee('0x40')]({'where':{'id':_0x330fbe},'attributes':['id'],'include':[{'model':db[_0x3fee('0x54')],'as':_0x3fee('0x62'),'attributes':['id',_0x3fee('0x26'),_0x3fee('0x63'),_0x3fee('0x64'),_0x3fee('0x65')],'raw':!![]}]})[_0x3fee('0x21')](function(_0x443b33){if(_0x443b33){var _0x3d156b=_[_0x3fee('0x66')](_0x443b33,function(_0x385d0f){var _0x563735=_0x385d0f[_0x3fee('0x23')]({'plain':!![]});return _0x563735[_0x3fee('0x62')];});return db[_0x3fee('0x3d')][_0x3fee('0x46')]({'where':{'id':_0x827b3f['params']['id']}})[_0x3fee('0x21')](function(_0x298188){return db[_0x3fee('0x67')][_0x3fee('0x68')](function(_0x3e8dfe){return _0x298188[_0x3fee('0x60')](_0x330fbe,{'transaction':_0x3e8dfe})[_0x3fee('0x21')](function(){return BPromise[_0x3fee('0x69')](_0x3d156b,function(_0x47d3ad){return db[_0x3fee('0x52')][_0x3fee('0x6a')]({'where':{'UserId':_0x47d3ad['id'],'WhatsappQueueId':_0x827b3f[_0x3fee('0x44')]['id']},'transaction':_0x3e8dfe});});})[_0x3fee('0x21')](function(){_0x3d156b[_0x3fee('0x6b')](function(_0x10827d){socket['emit'](_0x3fee('0x6c'),{'UserId':_0x10827d['id'],'WhatsappQueueId':_0x298188['id']});});});});});}})[_0x3fee('0x21')](respondWithStatusCode(_0x510d19,null))[_0x3fee('0x42')](handleError(_0x510d19,null));};exports['removeTeams']=function(_0x5ac8cc,_0x5b19d3,_0x3bde43){return db[_0x3fee('0x5e')][_0x3fee('0x40')]({'where':{'id':_0x5ac8cc[_0x3fee('0x2d')]['ids']},'attributes':['id'],'include':[{'model':db[_0x3fee('0x54')],'as':_0x3fee('0x62'),'attributes':['id'],'raw':!![]}]})[_0x3fee('0x21')](handleEntityNotFound(_0x5b19d3,null))[_0x3fee('0x21')](function(_0x44065c){var _0x22f465=_[_0x3fee('0x29')](_0x44065c,'id');var _0x35da36=[];var _0x2e44f3=[];var _0xc2981=squel[_0x3fee('0x6d')]();_0xc2981[_0x3fee('0x6e')](_0x3fee('0x6f'))[_0x3fee('0x70')](_0x3fee('0x71'),'tq')['join'](_0x3fee('0x72'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x3fee('0x73'),_0x5ac8cc['params']['id']);for(var _0x465f4e=0x0;_0x465f4e<_0x44065c[_0x3fee('0x5f')];_0x465f4e+=0x1){let _0x3105ec=_0x44065c[_0x465f4e];for(var _0x14bcb4=0x0;_0x14bcb4<_0x3105ec[_0x3fee('0x62')][_0x3fee('0x5f')];_0x14bcb4+=0x1){let _0x5a02f6=_0x3105ec[_0x3fee('0x62')][_0x14bcb4];var _0x16eb75=_0xc2981[_0x3fee('0x74')]();_0x16eb75['where'](_0x3fee('0x75'),_0x5a02f6['id']);_0x2e44f3[_0x3fee('0x76')](db[_0x3fee('0x67')][_0x3fee('0x2d')](_0x16eb75[_0x3fee('0x77')](),{'type':db[_0x3fee('0x67')][_0x3fee('0x78')][_0x3fee('0x79')]})[_0x3fee('0x21')](function(_0x44859f){if(_0x44859f['length']===0x1){return _0x5a02f6['id'];}else{var _0x229019=_['every'](_[_0x3fee('0x29')](_0x44859f,_0x3fee('0x7a')),function(_0x56b222){return _[_0x3fee('0x7b')](_0x22f465,_0x56b222);});if(_0x229019){return _0x5a02f6['id'];}}}));}}return BPromise[_0x3fee('0x7c')](_0x2e44f3)[_0x3fee('0x21')](function(_0x448788){_0x35da36=_(_0x35da36)[_0x3fee('0x7d')](_0x448788)[_0x3fee('0x7e')]()[_0x3fee('0x7f')]();return db[_0x3fee('0x3d')][_0x3fee('0x46')]({'where':{'id':_0x5ac8cc[_0x3fee('0x44')]['id']}})[_0x3fee('0x21')](function(_0xec448){return db[_0x3fee('0x67')][_0x3fee('0x68')](function(_0x32d926){return _0xec448[_0x3fee('0x80')](_0x5ac8cc['query'][_0x3fee('0x61')],{'transaction':_0x32d926})['then'](function(){if(!_[_0x3fee('0x81')](_0x35da36)){return _0xec448[_0x3fee('0x82')](_0x35da36,{'transaction':_0x32d926});}})['then'](function(){_0x35da36[_0x3fee('0x6b')](function(_0x5ba76e){socket[_0x3fee('0x83')]('userWhatsappQueue:remove',{'UserId':_0x5ba76e,'WhatsappQueueId':_0xec448['id']});});});});});});})[_0x3fee('0x21')](respondWithStatusCode(_0x5b19d3,null))['catch'](handleError(_0x5b19d3,null));};exports[_0x3fee('0x84')]=function(_0x4d352b,_0x592cc6,_0x3251b6){return db[_0x3fee('0x3d')][_0x3fee('0x46')]({'where':{'id':_0x4d352b[_0x3fee('0x44')]['id']}})[_0x3fee('0x21')](handleEntityNotFound(_0x592cc6,null))[_0x3fee('0x21')](function(_0x4de7f5){if(_0x4de7f5){return _0x4de7f5['addAgents'](_0x4d352b[_0x3fee('0x48')][_0x3fee('0x61')],_[_0x3fee('0x85')](_0x4d352b['body'],[_0x3fee('0x61'),'id'])||{})[_0x3fee('0x86')](function(_0x571cf1){for(var _0x487e6b=0x0;_0x487e6b<_0x4d352b[_0x3fee('0x48')][_0x3fee('0x61')][_0x3fee('0x5f')];_0x487e6b+=0x1){socket[_0x3fee('0x83')](_0x3fee('0x6c'),{'UserId':_0x4d352b['body']['ids'][_0x487e6b],'WhatsappQueueId':_0x4d352b[_0x3fee('0x44')]['id']});}return _0x571cf1;});}})[_0x3fee('0x21')](respondWithResult(_0x592cc6,null))[_0x3fee('0x42')](handleError(_0x592cc6,null));};exports['removeAgents']=function(_0x5201a5,_0x32edaa,_0x1aef09){return db[_0x3fee('0x3d')][_0x3fee('0x46')]({'where':{'id':_0x5201a5[_0x3fee('0x44')]['id']}})[_0x3fee('0x21')](handleEntityNotFound(_0x32edaa,null))[_0x3fee('0x21')](function(_0x1edfb6){if(_0x1edfb6){return _0x1edfb6[_0x3fee('0x82')](_0x5201a5[_0x3fee('0x2d')]['ids'])[_0x3fee('0x21')](function(){if(_[_0x3fee('0x87')](_0x5201a5[_0x3fee('0x2d')]['ids'])){for(var _0x260fa0=0x0;_0x260fa0<_0x5201a5[_0x3fee('0x2d')][_0x3fee('0x61')]['length'];_0x260fa0+=0x1){socket[_0x3fee('0x83')](_0x3fee('0x88'),{'UserId':Number(_0x5201a5['query'][_0x3fee('0x61')][_0x260fa0]),'WhatsappQueueId':Number(_0x5201a5['params']['id'])});}}else{socket[_0x3fee('0x83')](_0x3fee('0x88'),{'UserId':Number(_0x5201a5[_0x3fee('0x2d')][_0x3fee('0x61')]),'WhatsappQueueId':Number(_0x5201a5[_0x3fee('0x44')]['id'])});}});}})['then'](respondWithStatusCode(_0x32edaa,null))['catch'](handleError(_0x32edaa,null));};exports[_0x3fee('0x89')]=function(_0x3707f8,_0xd29903,_0x143dac){var _0x1c6ded={};var _0x410ed3={};var _0x40b1e8;var _0x51ccda;return db[_0x3fee('0x3d')]['findOne']({'where':{'id':_0x3707f8[_0x3fee('0x44')]['id']}})[_0x3fee('0x21')](handleEntityNotFound(_0xd29903,null))['then'](function(_0x4ac78e){if(_0x4ac78e){_0x40b1e8=_0x4ac78e;_0x410ed3[_0x3fee('0x2c')]=_['keys'](db[_0x3fee('0x54')][_0x3fee('0x45')]);_0x410ed3['query']=_[_0x3fee('0x2e')](_0x3707f8[_0x3fee('0x2d')]);_0x410ed3[_0x3fee('0x2f')]=_[_0x3fee('0x30')](_0x410ed3[_0x3fee('0x2c')],_0x410ed3[_0x3fee('0x2d')]);_0x1c6ded[_0x3fee('0x32')]=_[_0x3fee('0x30')](_0x410ed3[_0x3fee('0x2c')],qs[_0x3fee('0x31')](_0x3707f8[_0x3fee('0x2d')][_0x3fee('0x31')]));_0x1c6ded[_0x3fee('0x32')]=_0x1c6ded[_0x3fee('0x32')][_0x3fee('0x5f')]?_0x1c6ded[_0x3fee('0x32')]:_0x410ed3[_0x3fee('0x2c')];_0x1c6ded[_0x3fee('0x35')]=qs[_0x3fee('0x36')](_0x3707f8[_0x3fee('0x2d')]['sort']);_0x1c6ded[_0x3fee('0x38')]=qs[_0x3fee('0x2f')](_['pick'](_0x3707f8[_0x3fee('0x2d')],_0x410ed3[_0x3fee('0x2f')]));if(_0x3707f8[_0x3fee('0x2d')][_0x3fee('0x3b')]){_0x1c6ded[_0x3fee('0x38')]=_[_0x3fee('0x39')](_0x1c6ded[_0x3fee('0x38')],{'$or':_[_0x3fee('0x29')](_0x1c6ded[_0x3fee('0x32')],function(_0xf8d184){var _0x332118={};_0x332118[_0xf8d184]={'$like':'%'+_0x3707f8[_0x3fee('0x2d')][_0x3fee('0x3b')]+'%'};return _0x332118;})});}_0x1c6ded=_[_0x3fee('0x39')]({},_0x1c6ded,_0x3707f8[_0x3fee('0x3c')]);return _0x40b1e8[_0x3fee('0x89')](_0x1c6ded);}})[_0x3fee('0x21')](function(_0x372875){if(_0x372875){_0x51ccda=_0x372875[_0x3fee('0x5f')];if(!_0x3707f8[_0x3fee('0x2d')]['hasOwnProperty']('nolimit')){_0x1c6ded[_0x3fee('0x1c')]=qs[_0x3fee('0x1c')](_0x3707f8['query'][_0x3fee('0x1c')]);_0x1c6ded[_0x3fee('0x1b')]=qs[_0x3fee('0x1b')](_0x3707f8[_0x3fee('0x2d')][_0x3fee('0x1b')]);}return _0x40b1e8['getAgents'](_0x1c6ded);}})[_0x3fee('0x21')](function(_0x5398da){if(_0x5398da){return _0x5398da?{'count':_0x51ccda,'rows':_0x5398da}:null;}})[_0x3fee('0x21')](respondWithResult(_0xd29903,null))[_0x3fee('0x42')](handleError(_0xd29903,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 9adadd1..efd73c6 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 _0x1276=['events','../../mysqldb','WhatsappQueue','setMaxListeners','save','emit','hasOwnProperty','hook','exports'];(function(_0x107113,_0x1587ff){var _0x5996aa=function(_0x530644){while(--_0x530644){_0x107113['push'](_0x107113['shift']());}};_0x5996aa(++_0x1587ff);}(_0x1276,0x195));var _0x6127=function(_0x1870dd,_0x186efa){_0x1870dd=_0x1870dd-0x0;var _0x1d5b86=_0x1276[_0x1870dd];return _0x1d5b86;};'use strict';var EventEmitter=require(_0x6127('0x0'));var WhatsappQueue=require(_0x6127('0x1'))['db'][_0x6127('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x6127('0x3')](0x0);var events={'afterCreate':_0x6127('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xe94cd6){return function(_0x2e96c6,_0x4b3c0d,_0x41dde8){WhatsappQueueEvents[_0x6127('0x5')](_0xe94cd6+':'+_0x2e96c6['id'],_0x2e96c6);WhatsappQueueEvents[_0x6127('0x5')](_0xe94cd6,_0x2e96c6);_0x41dde8(null);};}for(var e in events){if(events[_0x6127('0x6')](e)){var event=events[e];WhatsappQueue[_0x6127('0x7')](e,emitEvent(event));}}module[_0x6127('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0x2d5b=['WhatsappQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x838813,_0x448f0f){var _0x2bd32d=function(_0x57b589){while(--_0x57b589){_0x838813['push'](_0x838813['shift']());}};_0x2bd32d(++_0x448f0f);}(_0x2d5b,0xc6));var _0xb2d5=function(_0x136628,_0xdd3206){_0x136628=_0x136628-0x0;var _0x35aad7=_0x2d5b[_0x136628];return _0x35aad7;};'use strict';var EventEmitter=require(_0xb2d5('0x0'));var WhatsappQueue=require(_0xb2d5('0x1'))['db'][_0xb2d5('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xb2d5('0x3')](0x0);var events={'afterCreate':_0xb2d5('0x4'),'afterUpdate':_0xb2d5('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3b18e3){return function(_0x46d513,_0x186af8,_0x5530f9){WhatsappQueueEvents['emit'](_0x3b18e3+':'+_0x46d513['id'],_0x46d513);WhatsappQueueEvents[_0xb2d5('0x6')](_0x3b18e3,_0x46d513);_0x5530f9(null);};}for(var e in events){if(events[_0xb2d5('0x7')](e)){var event=events[e];WhatsappQueue[_0xb2d5('0x8')](e,emitEvent(event));}}module[_0xb2d5('0x9')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index c89801c..0163226 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 _0x9c1f=['WhatsappQueue','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x1bed20,_0x5a3d6b){var _0x74a149=function(_0x4a4e66){while(--_0x4a4e66){_0x1bed20['push'](_0x1bed20['shift']());}};_0x74a149(++_0x5a3d6b);}(_0x9c1f,0x85));var _0xf9c1=function(_0x53aec3,_0x2b8af8){_0x53aec3=_0x53aec3-0x0;var _0x503f42=_0x9c1f[_0x53aec3];return _0x503f42;};'use strict';var _=require(_0xf9c1('0x0'));var util=require(_0xf9c1('0x1'));var logger=require(_0xf9c1('0x2'))(_0xf9c1('0x3'));var moment=require(_0xf9c1('0x4'));var BPromise=require(_0xf9c1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf9c1('0x6'));var rimraf=require(_0xf9c1('0x7'));var config=require(_0xf9c1('0x8'));var attributes=require('./whatsappQueue.attributes');module[_0xf9c1('0x9')]=function(_0x848575,_0x4870fd){return _0x848575[_0xf9c1('0xa')](_0xf9c1('0xb'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfab0=['../../config/logger','bluebird','request-promise','path','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash','util'];(function(_0x4da2b2,_0x58b589){var _0x3f2ecb=function(_0x12f06a){while(--_0x12f06a){_0x4da2b2['push'](_0x4da2b2['shift']());}};_0x3f2ecb(++_0x58b589);}(_0xfab0,0x18a));var _0x0fab=function(_0xf4d05,_0x5e601f){_0xf4d05=_0xf4d05-0x0;var _0x47c971=_0xfab0[_0xf4d05];return _0x47c971;};'use strict';var _=require(_0x0fab('0x0'));var util=require(_0x0fab('0x1'));var logger=require(_0x0fab('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0fab('0x3'));var rp=require(_0x0fab('0x4'));var fs=require('fs');var path=require(_0x0fab('0x5'));var rimraf=require('rimraf');var config=require(_0x0fab('0x6'));var attributes=require(_0x0fab('0x7'));module[_0x0fab('0x8')]=function(_0x464448,_0x42cf74){return _0x464448[_0x0fab('0x9')](_0x0fab('0xa'),attributes,{'tableName':_0x0fab('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 43120a4..53a065f 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 _0x6626=['limit','include','model','map','GetWhatsappQueue','ShowWhatsappQueue','where','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','WhatsappQueue','findAll','options','raw','attributes'];(function(_0x12e3e3,_0x501eaf){var _0x26602e=function(_0x427882){while(--_0x427882){_0x12e3e3['push'](_0x12e3e3['shift']());}};_0x26602e(++_0x501eaf);}(_0x6626,0x1ca));var _0x6662=function(_0x2f9387,_0x353c54){_0x2f9387=_0x2f9387-0x0;var _0x5472e3=_0x6626[_0x2f9387];return _0x5472e3;};'use strict';var _=require(_0x6662('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6662('0x1'));var rs=require(_0x6662('0x2'));var fs=require('fs');var Redis=require(_0x6662('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6662('0x4'));var logger=require(_0x6662('0x5'))(_0x6662('0x6'));var config=require(_0x6662('0x7'));var jayson=require(_0x6662('0x8'));var client=jayson[_0x6662('0x9')][_0x6662('0xa')]({'port':0x232a});config[_0x6662('0xb')]=_[_0x6662('0xc')](config[_0x6662('0xb')],{'host':_0x6662('0xd'),'port':0x18eb});var socket=require(_0x6662('0xe'))(new Redis(config['redis']));require(_0x6662('0xf'))[_0x6662('0x10')](socket);function respondWithRpcPromise(_0x5aacf8,_0x1d1f05,_0x38055c){return new BPromise(function(_0x1dcfd3,_0x317701){return client[_0x6662('0x11')](_0x5aacf8,_0x38055c)[_0x6662('0x12')](function(_0x960bfa){logger[_0x6662('0x13')](_0x6662('0x14'),_0x1d1f05,_0x6662('0x15'));logger[_0x6662('0x16')](_0x6662('0x17'),_0x1d1f05,_0x6662('0x15'),JSON[_0x6662('0x18')](_0x960bfa));if(_0x960bfa[_0x6662('0x19')]){if(_0x960bfa[_0x6662('0x19')][_0x6662('0x1a')]===0x1f4){logger[_0x6662('0x19')](_0x6662('0x14'),_0x1d1f05,_0x960bfa['error'][_0x6662('0x1b')]);return _0x317701(_0x960bfa[_0x6662('0x19')][_0x6662('0x1b')]);}logger[_0x6662('0x19')](_0x6662('0x14'),_0x1d1f05,_0x960bfa[_0x6662('0x19')][_0x6662('0x1b')]);return _0x1dcfd3(_0x960bfa[_0x6662('0x19')][_0x6662('0x1b')]);}else{logger['info'](_0x6662('0x14'),_0x1d1f05,_0x6662('0x15'));_0x1dcfd3(_0x960bfa['result'][_0x6662('0x1b')]);}})[_0x6662('0x1c')](function(_0x5c34d2){logger[_0x6662('0x19')](_0x6662('0x14'),_0x1d1f05,_0x5c34d2);_0x317701(_0x5c34d2);});});}exports['GetWhatsappQueue']=function(_0x4a3cee){var _0x44ddf6=this;return new Promise(function(_0xbe8cd2,_0x202e66){return db[_0x6662('0x1d')][_0x6662('0x1e')]({'raw':_0x4a3cee[_0x6662('0x1f')]?_0x4a3cee[_0x6662('0x1f')][_0x6662('0x20')]===undefined?!![]:![]:!![],'where':_0x4a3cee['options']?_0x4a3cee[_0x6662('0x1f')]['where']||null:null,'attributes':_0x4a3cee[_0x6662('0x1f')]?_0x4a3cee[_0x6662('0x1f')][_0x6662('0x21')]||null:null,'limit':_0x4a3cee[_0x6662('0x1f')]?_0x4a3cee[_0x6662('0x1f')][_0x6662('0x22')]||null:null,'include':_0x4a3cee[_0x6662('0x1f')]?_0x4a3cee[_0x6662('0x1f')][_0x6662('0x23')]?_['map'](_0x4a3cee[_0x6662('0x1f')][_0x6662('0x23')],function(_0x185403){return{'model':db[_0x185403[_0x6662('0x24')]],'as':_0x185403['as'],'attributes':_0x185403[_0x6662('0x21')],'include':_0x185403[_0x6662('0x23')]?_[_0x6662('0x25')](_0x185403[_0x6662('0x23')],function(_0x166598){return{'model':db[_0x166598[_0x6662('0x24')]],'as':_0x166598['as'],'attributes':_0x166598[_0x6662('0x21')],'include':_0x166598['include']?_['map'](_0x166598[_0x6662('0x23')],function(_0x2e64b1){return{'model':db[_0x2e64b1[_0x6662('0x24')]],'as':_0x2e64b1['as'],'attributes':_0x2e64b1[_0x6662('0x21')]};}):[]};}):[]};}):[]:[]})[_0x6662('0x12')](function(_0x372468){logger[_0x6662('0x13')](_0x6662('0x26'),_0x4a3cee);logger[_0x6662('0x16')](_0x6662('0x26'),_0x4a3cee,JSON[_0x6662('0x18')](_0x372468));_0xbe8cd2(_0x372468);})[_0x6662('0x1c')](function(_0x534119){logger[_0x6662('0x19')](_0x6662('0x26'),_0x534119['message'],_0x4a3cee);_0x202e66(_0x44ddf6['error'](0x1f4,_0x534119[_0x6662('0x1b')]));});});};exports[_0x6662('0x27')]=function(_0x28ce2b){var _0x19074a=this;return new Promise(function(_0x2a9aaa,_0x43d763){return db[_0x6662('0x1d')]['find']({'raw':_0x28ce2b[_0x6662('0x1f')]?_0x28ce2b['options'][_0x6662('0x20')]===undefined?!![]:![]:!![],'where':_0x28ce2b[_0x6662('0x1f')]?_0x28ce2b[_0x6662('0x1f')][_0x6662('0x28')]||null:null,'attributes':_0x28ce2b[_0x6662('0x1f')]?_0x28ce2b[_0x6662('0x1f')][_0x6662('0x21')]||null:null,'include':_0x28ce2b[_0x6662('0x1f')]?_0x28ce2b[_0x6662('0x1f')][_0x6662('0x23')]?_['map'](_0x28ce2b[_0x6662('0x1f')][_0x6662('0x23')],function(_0x41464d){return{'model':db[_0x41464d['model']],'as':_0x41464d['as'],'attributes':_0x41464d[_0x6662('0x21')],'include':_0x41464d['include']?_[_0x6662('0x25')](_0x41464d[_0x6662('0x23')],function(_0x5d7c7e){return{'model':db[_0x5d7c7e[_0x6662('0x24')]],'as':_0x5d7c7e['as'],'attributes':_0x5d7c7e['attributes'],'include':_0x5d7c7e[_0x6662('0x23')]?_[_0x6662('0x25')](_0x5d7c7e[_0x6662('0x23')],function(_0x2d1e88){return{'model':db[_0x2d1e88[_0x6662('0x24')]],'as':_0x2d1e88['as'],'attributes':_0x2d1e88[_0x6662('0x21')]};}):[]};}):[]};}):[]:[]})[_0x6662('0x12')](function(_0x5dcf51){logger[_0x6662('0x13')](_0x6662('0x27'),_0x28ce2b);logger[_0x6662('0x16')]('ShowWhatsappQueue',_0x28ce2b,JSON['stringify'](_0x5dcf51));_0x2a9aaa(_0x5dcf51);})[_0x6662('0x1c')](function(_0x56df05){logger[_0x6662('0x19')](_0x6662('0x27'),_0x56df05[_0x6662('0x1b')],_0x28ce2b);_0x43d763(_0x19074a[_0x6662('0x19')](0x1f4,_0x56df05[_0x6662('0x1b')]));});});}; \ No newline at end of file +var _0xdd12=['WhatsappQueue,\x20%s,\x20%s','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','map','model','include','then','debug','stringify','ShowWhatsappQueue','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','request'];(function(_0x13ea5f,_0x5c9bc8){var _0x1ee36a=function(_0x4fc656){while(--_0x4fc656){_0x13ea5f['push'](_0x13ea5f['shift']());}};_0x1ee36a(++_0x5c9bc8);}(_0xdd12,0x10e));var _0x2dd1=function(_0x4755ee,_0x251c5b){_0x4755ee=_0x4755ee-0x0;var _0x19a5af=_0xdd12[_0x4755ee];return _0x19a5af;};'use strict';var _=require(_0x2dd1('0x0'));var util=require(_0x2dd1('0x1'));var moment=require(_0x2dd1('0x2'));var BPromise=require(_0x2dd1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2dd1('0x4'));var db=require(_0x2dd1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2dd1('0x6'))(_0x2dd1('0x7'));var config=require(_0x2dd1('0x8'));var jayson=require(_0x2dd1('0x9'));var client=jayson['client'][_0x2dd1('0xa')]({'port':0x232a});config[_0x2dd1('0xb')]=_['defaults'](config[_0x2dd1('0xb')],{'host':_0x2dd1('0xc'),'port':0x18eb});var socket=require(_0x2dd1('0xd'))(new Redis(config[_0x2dd1('0xb')]));require(_0x2dd1('0xe'))[_0x2dd1('0xf')](socket);function respondWithRpcPromise(_0x32d5e4,_0x164f3d,_0x23c9de){return new BPromise(function(_0xf028f5,_0xe5c709){return client[_0x2dd1('0x10')](_0x32d5e4,_0x23c9de)['then'](function(_0xdeb114){logger['info'](_0x2dd1('0x11'),_0x164f3d,'request\x20sent');logger['debug'](_0x2dd1('0x12'),_0x164f3d,_0x2dd1('0x13'),JSON['stringify'](_0xdeb114));if(_0xdeb114[_0x2dd1('0x14')]){if(_0xdeb114[_0x2dd1('0x14')][_0x2dd1('0x15')]===0x1f4){logger['error'](_0x2dd1('0x11'),_0x164f3d,_0xdeb114[_0x2dd1('0x14')][_0x2dd1('0x16')]);return _0xe5c709(_0xdeb114[_0x2dd1('0x14')][_0x2dd1('0x16')]);}logger[_0x2dd1('0x14')](_0x2dd1('0x11'),_0x164f3d,_0xdeb114['error'][_0x2dd1('0x16')]);return _0xf028f5(_0xdeb114[_0x2dd1('0x14')]['message']);}else{logger[_0x2dd1('0x17')](_0x2dd1('0x11'),_0x164f3d,'request\x20sent');_0xf028f5(_0xdeb114[_0x2dd1('0x18')][_0x2dd1('0x16')]);}})[_0x2dd1('0x19')](function(_0x303581){logger[_0x2dd1('0x14')](_0x2dd1('0x11'),_0x164f3d,_0x303581);_0xe5c709(_0x303581);});});}exports[_0x2dd1('0x1a')]=function(_0xb092b2){var _0x35be56=this;return new Promise(function(_0x1b0bf3,_0x2daa0b){return db[_0x2dd1('0x1b')][_0x2dd1('0x1c')]({'raw':_0xb092b2[_0x2dd1('0x1d')]?_0xb092b2[_0x2dd1('0x1d')][_0x2dd1('0x1e')]===undefined?!![]:![]:!![],'where':_0xb092b2[_0x2dd1('0x1d')]?_0xb092b2[_0x2dd1('0x1d')][_0x2dd1('0x1f')]||null:null,'attributes':_0xb092b2[_0x2dd1('0x1d')]?_0xb092b2['options'][_0x2dd1('0x20')]||null:null,'limit':_0xb092b2[_0x2dd1('0x1d')]?_0xb092b2[_0x2dd1('0x1d')]['limit']||null:null,'include':_0xb092b2[_0x2dd1('0x1d')]?_0xb092b2[_0x2dd1('0x1d')]['include']?_[_0x2dd1('0x21')](_0xb092b2[_0x2dd1('0x1d')]['include'],function(_0x1a7e8d){return{'model':db[_0x1a7e8d[_0x2dd1('0x22')]],'as':_0x1a7e8d['as'],'attributes':_0x1a7e8d[_0x2dd1('0x20')],'include':_0x1a7e8d[_0x2dd1('0x23')]?_['map'](_0x1a7e8d['include'],function(_0x2af364){return{'model':db[_0x2af364[_0x2dd1('0x22')]],'as':_0x2af364['as'],'attributes':_0x2af364['attributes'],'include':_0x2af364[_0x2dd1('0x23')]?_[_0x2dd1('0x21')](_0x2af364[_0x2dd1('0x23')],function(_0x21d0ac){return{'model':db[_0x21d0ac['model']],'as':_0x21d0ac['as'],'attributes':_0x21d0ac[_0x2dd1('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2dd1('0x24')](function(_0xcf4753){logger['info']('GetWhatsappQueue',_0xb092b2);logger[_0x2dd1('0x25')](_0x2dd1('0x1a'),_0xb092b2,JSON[_0x2dd1('0x26')](_0xcf4753));_0x1b0bf3(_0xcf4753);})[_0x2dd1('0x19')](function(_0x11de77){logger['error'](_0x2dd1('0x1a'),_0x11de77['message'],_0xb092b2);_0x2daa0b(_0x35be56[_0x2dd1('0x14')](0x1f4,_0x11de77[_0x2dd1('0x16')]));});});};exports[_0x2dd1('0x27')]=function(_0x4e5ea1){var _0x5a992=this;return new Promise(function(_0x1bb5df,_0x26fce2){return db[_0x2dd1('0x1b')][_0x2dd1('0x28')]({'raw':_0x4e5ea1[_0x2dd1('0x1d')]?_0x4e5ea1[_0x2dd1('0x1d')][_0x2dd1('0x1e')]===undefined?!![]:![]:!![],'where':_0x4e5ea1['options']?_0x4e5ea1[_0x2dd1('0x1d')][_0x2dd1('0x1f')]||null:null,'attributes':_0x4e5ea1[_0x2dd1('0x1d')]?_0x4e5ea1['options'][_0x2dd1('0x20')]||null:null,'include':_0x4e5ea1[_0x2dd1('0x1d')]?_0x4e5ea1[_0x2dd1('0x1d')][_0x2dd1('0x23')]?_['map'](_0x4e5ea1[_0x2dd1('0x1d')][_0x2dd1('0x23')],function(_0x1718f7){return{'model':db[_0x1718f7['model']],'as':_0x1718f7['as'],'attributes':_0x1718f7[_0x2dd1('0x20')],'include':_0x1718f7['include']?_[_0x2dd1('0x21')](_0x1718f7[_0x2dd1('0x23')],function(_0x7065d1){return{'model':db[_0x7065d1['model']],'as':_0x7065d1['as'],'attributes':_0x7065d1[_0x2dd1('0x20')],'include':_0x7065d1[_0x2dd1('0x23')]?_[_0x2dd1('0x21')](_0x7065d1[_0x2dd1('0x23')],function(_0x3eb83b){return{'model':db[_0x3eb83b[_0x2dd1('0x22')]],'as':_0x3eb83b['as'],'attributes':_0x3eb83b[_0x2dd1('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2dd1('0x24')](function(_0x2e8f83){logger[_0x2dd1('0x17')](_0x2dd1('0x27'),_0x4e5ea1);logger[_0x2dd1('0x25')](_0x2dd1('0x27'),_0x4e5ea1,JSON[_0x2dd1('0x26')](_0x2e8f83));_0x1bb5df(_0x2e8f83);})[_0x2dd1('0x19')](function(_0x83d4ba){logger[_0x2dd1('0x14')]('ShowWhatsappQueue',_0x83d4ba[_0x2dd1('0x16')],_0x4e5ea1);_0x26fce2(_0x5a992['error'](0x1f4,_0x83d4ba[_0x2dd1('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 77684f4..18a49df 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 _0x5a04=['save','remove','update','removeListener','length','whatsappQueue:','./whatsappQueue.events'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x5a04,0xfb));var _0x45a0=function(_0x33c47a,_0x588e4f){_0x33c47a=_0x33c47a-0x0;var _0x172085=_0x5a04[_0x33c47a];return _0x172085;};'use strict';var WhatsappQueueEvents=require(_0x45a0('0x0'));var events=[_0x45a0('0x1'),_0x45a0('0x2'),_0x45a0('0x3')];function createListener(_0x3cf4d8,_0x2cc086){return function(_0x17d002){_0x2cc086['emit'](_0x3cf4d8,_0x17d002);};}function removeListener(_0x50b1ed,_0x47657d){return function(){WhatsappQueueEvents[_0x45a0('0x4')](_0x50b1ed,_0x47657d);};}exports['register']=function(_0x3e19b6){for(var _0x19b36d=0x0,_0x46c9c0=events[_0x45a0('0x5')];_0x19b36d<_0x46c9c0;_0x19b36d++){var _0x3a7c10=events[_0x19b36d];var _0x5efc48=createListener(_0x45a0('0x6')+_0x3a7c10,_0x3e19b6);WhatsappQueueEvents['on'](_0x3a7c10,_0x5efc48);}}; \ No newline at end of file +var _0x7edc=['./whatsappQueue.events','update','removeListener','register','length','whatsappQueue:'];(function(_0x3c8517,_0x3f3f13){var _0xc1268f=function(_0x18895e){while(--_0x18895e){_0x3c8517['push'](_0x3c8517['shift']());}};_0xc1268f(++_0x3f3f13);}(_0x7edc,0x7e));var _0xc7ed=function(_0x2e913b,_0x4b7071){_0x2e913b=_0x2e913b-0x0;var _0x173899=_0x7edc[_0x2e913b];return _0x173899;};'use strict';var WhatsappQueueEvents=require(_0xc7ed('0x0'));var events=['save','remove',_0xc7ed('0x1')];function createListener(_0x2ec458,_0x3ac993){return function(_0x54dc8e){_0x3ac993['emit'](_0x2ec458,_0x54dc8e);};}function removeListener(_0x45872e,_0x2c540d){return function(){WhatsappQueueEvents[_0xc7ed('0x2')](_0x45872e,_0x2c540d);};}exports[_0xc7ed('0x3')]=function(_0x1ffefd){for(var _0x2f0144=0x0,_0x413c79=events[_0xc7ed('0x4')];_0x2f0144<_0x413c79;_0x2f0144++){var _0x4006ed=events[_0x2f0144];var _0x5f0ce0=createListener(_0xc7ed('0x5')+_0x4006ed,_0x1ffefd);WhatsappQueueEvents['on'](_0x4006ed,_0x5f0ce0);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 0a661e4..3edbb15 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 _0xca83=['update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/interaction/service','./whatsappQueueReport.controller','get','index','isAuthenticated','/:id','put'];(function(_0x34e5ef,_0x2df43f){var _0xa28403=function(_0x2afa83){while(--_0x2afa83){_0x34e5ef['push'](_0x34e5ef['shift']());}};_0xa28403(++_0x2df43f);}(_0xca83,0x99));var _0x3ca8=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0xca83[_0x368fb9];return _0x4892fb;};'use strict';var multer=require(_0x3ca8('0x0'));var util=require('util');var path=require(_0x3ca8('0x1'));var timeout=require(_0x3ca8('0x2'));var express=require(_0x3ca8('0x3'));var router=express[_0x3ca8('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x3ca8('0x5'));var config=require('../../config/environment');var controller=require(_0x3ca8('0x6'));router[_0x3ca8('0x7')]('/',auth['isAuthenticated'](),controller[_0x3ca8('0x8')]);router[_0x3ca8('0x7')]('/describe',auth[_0x3ca8('0x9')](),controller['describe']);router[_0x3ca8('0x7')](_0x3ca8('0xa'),auth[_0x3ca8('0x9')](),controller['show']);router['post']('/',auth[_0x3ca8('0x9')](),controller['create']);router[_0x3ca8('0xb')](_0x3ca8('0xa'),auth[_0x3ca8('0x9')](),controller[_0x3ca8('0xc')]);router[_0x3ca8('0xd')](_0x3ca8('0xa'),auth[_0x3ca8('0x9')](),controller[_0x3ca8('0xe')]);module['exports']=router; \ No newline at end of file +var _0xced6=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','/:id','isAuthenticated','post','create','put','delete','exports','multer','path','connect-timeout','express','Router'];(function(_0x5d0bd2,_0x3bb5b7){var _0x175ae9=function(_0x33020a){while(--_0x33020a){_0x5d0bd2['push'](_0x5d0bd2['shift']());}};_0x175ae9(++_0x3bb5b7);}(_0xced6,0x1b5));var _0x6ced=function(_0x29cd50,_0x516360){_0x29cd50=_0x29cd50-0x0;var _0x2ab171=_0xced6[_0x29cd50];return _0x2ab171;};'use strict';var multer=require(_0x6ced('0x0'));var util=require('util');var path=require(_0x6ced('0x1'));var timeout=require(_0x6ced('0x2'));var express=require(_0x6ced('0x3'));var router=express[_0x6ced('0x4')]();var auth=require(_0x6ced('0x5'));var interaction=require(_0x6ced('0x6'));var config=require(_0x6ced('0x7'));var controller=require('./whatsappQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x6ced('0x8')](_0x6ced('0x9'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x6ced('0xa'),auth[_0x6ced('0xb')](),controller['show']);router[_0x6ced('0xc')]('/',auth[_0x6ced('0xb')](),controller[_0x6ced('0xd')]);router[_0x6ced('0xe')](_0x6ced('0xa'),auth[_0x6ced('0xb')](),controller['update']);router[_0x6ced('0xf')]('/:id',auth[_0x6ced('0xb')](),controller['destroy']);module[_0x6ced('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 92df00e..9b93721 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 _0x55ca=['DATE','STRING','sequelize','exports'];(function(_0x2a2706,_0x2596a0){var _0x328a93=function(_0xa92f26){while(--_0xa92f26){_0x2a2706['push'](_0x2a2706['shift']());}};_0x328a93(++_0x2596a0);}(_0x55ca,0x126));var _0xa55c=function(_0x514038,_0x450ef3){_0x514038=_0x514038-0x0;var _0x589720=_0x55ca[_0x514038];return _0x589720;};'use strict';var Sequelize=require(_0xa55c('0x0'));module[_0xa55c('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xa55c('0x2')]},'acceptAt':{'type':Sequelize[_0xa55c('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xa55c('0x3')]}}; \ No newline at end of file +var _0x00bb=['sequelize','exports','STRING','DATE'];(function(_0x1561d2,_0x1529fa){var _0x3e5cbc=function(_0x23b265){while(--_0x23b265){_0x1561d2['push'](_0x1561d2['shift']());}};_0x3e5cbc(++_0x1529fa);}(_0x00bb,0x1d8));var _0xb00b=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x00bb[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0xb00b('0x0'));module[_0xb00b('0x1')]={'uniqueid':{'type':Sequelize[_0xb00b('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xb00b('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xb00b('0x3')]},'exitAt':{'type':Sequelize[_0xb00b('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 59ed382..18803b0 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 _0xa30a=['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','WhatsappQueueReport','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','body','find','describe','html-pdf'];(function(_0x6f2ce5,_0x4231eb){var _0x28a54a=function(_0x1bc980){while(--_0x1bc980){_0x6f2ce5['push'](_0x6f2ce5['shift']());}};_0x28a54a(++_0x4231eb);}(_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['WhatsappQueueReport'][_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));};exports[_0xaa30('0x47')]=function(_0x17868d,_0x4531b7){return db['WhatsappQueueReport']['describe']()['then'](respondWithResult(_0x4531b7,null))['catch'](handleError(_0x4531b7,null));}; \ No newline at end of file +var _0xbaf7=['nolimit','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','name','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x459211,_0x176acb){var _0x4c5c22=function(_0x1c72f1){while(--_0x1c72f1){_0x459211['push'](_0x459211['shift']());}};_0x4c5c22(++_0x176acb);}(_0xbaf7,0x137));var _0x7baf=function(_0x357654,_0x2d8331){_0x357654=_0x357654-0x0;var _0x4cd7dd=_0xbaf7[_0x357654];return _0x4cd7dd;};'use strict';var pdf=require(_0x7baf('0x0'));var emlformat=require(_0x7baf('0x1'));var rimraf=require(_0x7baf('0x2'));var zipdir=require(_0x7baf('0x3'));var jsonpatch=require(_0x7baf('0x4'));var rp=require('request-promise');var moment=require(_0x7baf('0x5'));var BPromise=require(_0x7baf('0x6'));var Mustache=require(_0x7baf('0x7'));var util=require(_0x7baf('0x8'));var path=require(_0x7baf('0x9'));var sox=require(_0x7baf('0xa'));var csv=require(_0x7baf('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7baf('0xc'));var squel=require(_0x7baf('0xd'));var crypto=require(_0x7baf('0xe'));var jsforce=require(_0x7baf('0xf'));var deskjs=require(_0x7baf('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7baf('0x11'));var Redis=require('ioredis');var authService=require(_0x7baf('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7baf('0x13'));var logger=require(_0x7baf('0x14'))(_0x7baf('0x15'));var utils=require('../../config/utils');var config=require(_0x7baf('0x16'));var db=require(_0x7baf('0x17'))['db'];function respondWithStatusCode(_0x12ab62,_0x20ad01){_0x20ad01=_0x20ad01||0xcc;return function(_0x1f8322){if(_0x1f8322){return _0x12ab62[_0x7baf('0x18')](_0x20ad01);}return _0x12ab62[_0x7baf('0x19')](_0x20ad01)[_0x7baf('0x1a')]();};}function respondWithResult(_0x47f9a3,_0xb61350){_0xb61350=_0xb61350||0xc8;return function(_0x4b9af0){if(_0x4b9af0){return _0x47f9a3[_0x7baf('0x19')](_0xb61350)[_0x7baf('0x1b')](_0x4b9af0);}};}function respondWithFilteredResult(_0x218c48,_0x5f03f4){return function(_0x2ed6ac){if(_0x2ed6ac){var _0x264265=_0x2ed6ac[_0x7baf('0x1c')],_0x2bacad=_0x5f03f4[_0x7baf('0x1d')],_0x3b70fd=_0x5f03f4[_0x7baf('0x1d')]+_0x5f03f4[_0x7baf('0x1e')],_0x4748ca;if(_0x3b70fd>=_0x264265){_0x3b70fd=_0x264265;_0x4748ca=0xc8;}else{_0x4748ca=0xce;}_0x218c48[_0x7baf('0x19')](_0x4748ca);return _0x218c48[_0x7baf('0x1f')](_0x7baf('0x20'),_0x2bacad+'-'+_0x3b70fd+'/'+_0x264265)[_0x7baf('0x1b')](_0x2ed6ac);}return null;};}function patchUpdates(_0x3a9350){return function(_0x9932f4){try{jsonpatch[_0x7baf('0x21')](_0x9932f4,_0x3a9350,!![]);}catch(_0x33c58e){return BPromise[_0x7baf('0x22')](_0x33c58e);}return _0x9932f4['save']();};}function saveUpdates(_0x9a8f82,_0x4cb942){return function(_0x4800c4){if(_0x4800c4){return _0x4800c4[_0x7baf('0x23')](_0x9a8f82)[_0x7baf('0x24')](function(_0x1e8a3b){return _0x1e8a3b;});}return null;};}function removeEntity(_0xaca134,_0xe0295e){return function(_0xd324a){if(_0xd324a){return _0xd324a[_0x7baf('0x25')]()[_0x7baf('0x24')](function(){_0xaca134[_0x7baf('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x549a1c,_0xabf63e){return function(_0x485171){if(!_0x485171){_0x549a1c[_0x7baf('0x18')](0x194);}return _0x485171;};}function handleError(_0x116224,_0xa4bfad){_0xa4bfad=_0xa4bfad||0x1f4;return function(_0x594094){logger[_0x7baf('0x26')](_0x594094['stack']);if(_0x594094[_0x7baf('0x27')]){delete _0x594094['name'];}_0x116224[_0x7baf('0x19')](_0xa4bfad)['send'](_0x594094);};}exports['index']=function(_0x3ccb36,_0x5b9c9c){var _0x357d1f={},_0x1971b9={},_0x107736={'count':0x0,'rows':[]};var _0x1cf5be=_[_0x7baf('0x28')](db[_0x7baf('0x29')][_0x7baf('0x2a')],function(_0x4b0b3b){return{'name':_0x4b0b3b[_0x7baf('0x2b')],'type':_0x4b0b3b[_0x7baf('0x2c')][_0x7baf('0x2d')]};});_0x1971b9[_0x7baf('0x2e')]=_[_0x7baf('0x28')](_0x1cf5be,_0x7baf('0x27'));_0x1971b9[_0x7baf('0x2f')]=_[_0x7baf('0x30')](_0x3ccb36[_0x7baf('0x2f')]);_0x1971b9['filters']=_[_0x7baf('0x31')](_0x1971b9[_0x7baf('0x2e')],_0x1971b9[_0x7baf('0x2f')]);_0x357d1f[_0x7baf('0x32')]=_[_0x7baf('0x31')](_0x1971b9[_0x7baf('0x2e')],qs['fields'](_0x3ccb36[_0x7baf('0x2f')][_0x7baf('0x33')]));_0x357d1f['attributes']=_0x357d1f[_0x7baf('0x32')][_0x7baf('0x34')]?_0x357d1f[_0x7baf('0x32')]:_0x1971b9[_0x7baf('0x2e')];if(!_0x3ccb36['query'][_0x7baf('0x35')](_0x7baf('0x36'))){_0x357d1f[_0x7baf('0x1e')]=qs[_0x7baf('0x1e')](_0x3ccb36['query'][_0x7baf('0x1e')]);_0x357d1f['offset']=qs[_0x7baf('0x1d')](_0x3ccb36[_0x7baf('0x2f')][_0x7baf('0x1d')]);}_0x357d1f['order']=qs[_0x7baf('0x37')](_0x3ccb36['query'][_0x7baf('0x37')]);_0x357d1f['where']=qs[_0x7baf('0x38')](_[_0x7baf('0x39')](_0x3ccb36[_0x7baf('0x2f')],_0x1971b9[_0x7baf('0x38')]),_0x1cf5be);if(_0x3ccb36[_0x7baf('0x2f')][_0x7baf('0x3a')]){_0x357d1f[_0x7baf('0x3b')]=_['merge'](_0x357d1f[_0x7baf('0x3b')],{'$or':_['map'](_0x1cf5be,function(_0x172094){if(_0x172094['type']!==_0x7baf('0x3c')){var _0x13b3a9={};_0x13b3a9[_0x172094[_0x7baf('0x27')]]={'$like':'%'+_0x3ccb36[_0x7baf('0x2f')]['filter']+'%'};return _0x13b3a9;}})});}_0x357d1f=_[_0x7baf('0x3d')]({},_0x357d1f,_0x3ccb36[_0x7baf('0x3e')]);var _0x254ec5={'where':_0x357d1f[_0x7baf('0x3b')]};return db[_0x7baf('0x29')]['count'](_0x254ec5)[_0x7baf('0x24')](function(_0x8719c3){_0x107736[_0x7baf('0x1c')]=_0x8719c3;if(_0x3ccb36[_0x7baf('0x2f')][_0x7baf('0x3f')]){_0x357d1f[_0x7baf('0x40')]=[{'all':!![]}];}return db['WhatsappQueueReport']['findAll'](_0x357d1f);})['then'](function(_0x43bbab){_0x107736[_0x7baf('0x41')]=_0x43bbab;return _0x107736;})[_0x7baf('0x24')](respondWithFilteredResult(_0x5b9c9c,_0x357d1f))[_0x7baf('0x42')](handleError(_0x5b9c9c,null));};exports[_0x7baf('0x43')]=function(_0x431fe7,_0xe7711){var _0x52bcee={'raw':!![],'where':{'id':_0x431fe7['params']['id']}},_0x3e7236={};_0x3e7236[_0x7baf('0x2e')]=_[_0x7baf('0x30')](db[_0x7baf('0x29')]['rawAttributes']);_0x3e7236['query']=_[_0x7baf('0x30')](_0x431fe7[_0x7baf('0x2f')]);_0x3e7236['filters']=_['intersection'](_0x3e7236['model'],_0x3e7236['query']);_0x52bcee[_0x7baf('0x32')]=_[_0x7baf('0x31')](_0x3e7236['model'],qs[_0x7baf('0x33')](_0x431fe7[_0x7baf('0x2f')]['fields']));_0x52bcee['attributes']=_0x52bcee['attributes'][_0x7baf('0x34')]?_0x52bcee[_0x7baf('0x32')]:_0x3e7236[_0x7baf('0x2e')];if(_0x431fe7['query'][_0x7baf('0x3f')]){_0x52bcee['include']=[{'all':!![]}];}_0x52bcee=_[_0x7baf('0x3d')]({},_0x52bcee,_0x431fe7['options']);return db[_0x7baf('0x29')][_0x7baf('0x44')](_0x52bcee)['then'](handleEntityNotFound(_0xe7711,null))[_0x7baf('0x24')](respondWithResult(_0xe7711,null))[_0x7baf('0x42')](handleError(_0xe7711,null));};exports[_0x7baf('0x45')]=function(_0x518a05,_0x1013ca){return db['WhatsappQueueReport']['create'](_0x518a05[_0x7baf('0x46')],{})['then'](respondWithResult(_0x1013ca,0xc9))[_0x7baf('0x42')](handleError(_0x1013ca,null));};exports[_0x7baf('0x23')]=function(_0x3e72fa,_0x2ee243){if(_0x3e72fa[_0x7baf('0x46')]['id']){delete _0x3e72fa['body']['id'];}return db[_0x7baf('0x29')]['find']({'where':{'id':_0x3e72fa[_0x7baf('0x47')]['id']}})[_0x7baf('0x24')](handleEntityNotFound(_0x2ee243,null))[_0x7baf('0x24')](saveUpdates(_0x3e72fa[_0x7baf('0x46')],null))[_0x7baf('0x24')](respondWithResult(_0x2ee243,null))['catch'](handleError(_0x2ee243,null));};exports[_0x7baf('0x25')]=function(_0xd69a15,_0x14d749){return db['WhatsappQueueReport'][_0x7baf('0x44')]({'where':{'id':_0xd69a15[_0x7baf('0x47')]['id']}})['then'](handleEntityNotFound(_0x14d749,null))[_0x7baf('0x24')](removeEntity(_0x14d749,null))[_0x7baf('0x42')](handleError(_0x14d749,null));};exports['describe']=function(_0x529420,_0x323abe){return db[_0x7baf('0x29')][_0x7baf('0x48')]()[_0x7baf('0x24')](respondWithResult(_0x323abe,null))['catch'](handleError(_0x323abe,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 794d586..9b738ea 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 _0x9877=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','uniqueid','lodash','util','../../config/logger'];(function(_0x30d558,_0x1982b5){var _0x2f0491=function(_0xf0ce3c){while(--_0xf0ce3c){_0x30d558['push'](_0x30d558['shift']());}};_0x2f0491(++_0x1982b5);}(_0x9877,0xcf));var _0x7987=function(_0x29022d,_0x1170d2){_0x29022d=_0x29022d-0x0;var _0x448906=_0x9877[_0x29022d];return _0x448906;};'use strict';var _=require(_0x7987('0x0'));var util=require(_0x7987('0x1'));var logger=require(_0x7987('0x2'))(_0x7987('0x3'));var moment=require(_0x7987('0x4'));var BPromise=require(_0x7987('0x5'));var rp=require(_0x7987('0x6'));var fs=require('fs');var path=require(_0x7987('0x7'));var rimraf=require(_0x7987('0x8'));var config=require(_0x7987('0x9'));var attributes=require(_0x7987('0xa'));module[_0x7987('0xb')]=function(_0x3d218f,_0xd263b5){return _0x3d218f[_0x7987('0xc')](_0x7987('0xd'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x7987('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x75ef=['uniqueid','util','api','bluebird','request-promise','path','rimraf','./whatsappQueueReport.attributes','define','report_whatsapp_queue'];(function(_0x4994c8,_0x32fa56){var _0x382859=function(_0x4887b9){while(--_0x4887b9){_0x4994c8['push'](_0x4994c8['shift']());}};_0x382859(++_0x32fa56);}(_0x75ef,0xbf));var _0xf75e=function(_0x5eacb7,_0x1e4558){_0x5eacb7=_0x5eacb7-0x0;var _0x1576c6=_0x75ef[_0x5eacb7];return _0x1576c6;};'use strict';var _=require('lodash');var util=require(_0xf75e('0x0'));var logger=require('../../config/logger')(_0xf75e('0x1'));var moment=require('moment');var BPromise=require(_0xf75e('0x2'));var rp=require(_0xf75e('0x3'));var fs=require('fs');var path=require(_0xf75e('0x4'));var rimraf=require(_0xf75e('0x5'));var config=require('../../config/environment');var attributes=require(_0xf75e('0x6'));module['exports']=function(_0x5da844,_0x17277e){return _0x5da844[_0xf75e('0x7')]('WhatsappQueueReport',attributes,{'tableName':_0xf75e('0x8'),'paranoid':![],'indexes':[{'name':_0xf75e('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index d124726..2c8fa6b 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 _0x6bdb=['CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','UpdateWhatsappQueueReport','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x522071,_0x436117){var _0x187be3=function(_0x617cf4){while(--_0x617cf4){_0x522071['push'](_0x522071['shift']());}};_0x187be3(++_0x436117);}(_0x6bdb,0x88));var _0xb6bd=function(_0x4530cd,_0x118462){_0x4530cd=_0x4530cd-0x0;var _0x8b2222=_0x6bdb[_0x4530cd];return _0x8b2222;};'use strict';var _=require(_0xb6bd('0x0'));var util=require(_0xb6bd('0x1'));var moment=require(_0xb6bd('0x2'));var BPromise=require(_0xb6bd('0x3'));var rs=require(_0xb6bd('0x4'));var fs=require('fs');var Redis=require(_0xb6bd('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb6bd('0x6'));var logger=require('../../config/logger')(_0xb6bd('0x7'));var config=require(_0xb6bd('0x8'));var jayson=require(_0xb6bd('0x9'));var client=jayson[_0xb6bd('0xa')][_0xb6bd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x986fcc,_0x1249fa,_0x206de7){return new BPromise(function(_0xea548e,_0x1715a5){return client['request'](_0x986fcc,_0x206de7)[_0xb6bd('0xc')](function(_0x293c54){logger[_0xb6bd('0xd')](_0xb6bd('0xe'),_0x1249fa,_0xb6bd('0xf'));logger[_0xb6bd('0x10')](_0xb6bd('0x11'),_0x1249fa,_0xb6bd('0xf'),JSON[_0xb6bd('0x12')](_0x293c54));if(_0x293c54[_0xb6bd('0x13')]){if(_0x293c54[_0xb6bd('0x13')][_0xb6bd('0x14')]===0x1f4){logger[_0xb6bd('0x13')](_0xb6bd('0xe'),_0x1249fa,_0x293c54[_0xb6bd('0x13')][_0xb6bd('0x15')]);return _0x1715a5(_0x293c54['error'][_0xb6bd('0x15')]);}logger[_0xb6bd('0x13')](_0xb6bd('0xe'),_0x1249fa,_0x293c54[_0xb6bd('0x13')][_0xb6bd('0x15')]);return _0xea548e(_0x293c54[_0xb6bd('0x13')][_0xb6bd('0x15')]);}else{logger[_0xb6bd('0xd')](_0xb6bd('0xe'),_0x1249fa,_0xb6bd('0xf'));_0xea548e(_0x293c54[_0xb6bd('0x16')][_0xb6bd('0x15')]);}})[_0xb6bd('0x17')](function(_0x16ed64){logger[_0xb6bd('0x13')](_0xb6bd('0xe'),_0x1249fa,_0x16ed64);_0x1715a5(_0x16ed64);});});}exports[_0xb6bd('0x18')]=function(_0x3599d1){var _0x2ca6d0=this;return new Promise(function(_0x5e392c,_0x492baf){return db[_0xb6bd('0x19')][_0xb6bd('0x1a')](_0x3599d1[_0xb6bd('0x1b')],{'raw':_0x3599d1[_0xb6bd('0x1c')]?_0x3599d1[_0xb6bd('0x1c')][_0xb6bd('0x1d')]===undefined?!![]:![]:!![]})[_0xb6bd('0xc')](function(_0x288dc9){logger['info'](_0xb6bd('0x18'),_0x3599d1);logger['debug'](_0xb6bd('0x18'),_0x3599d1,JSON['stringify'](_0x288dc9));_0x5e392c(_0x288dc9);})[_0xb6bd('0x17')](function(_0x15044a){logger[_0xb6bd('0x13')](_0xb6bd('0x18'),_0x15044a[_0xb6bd('0x15')],_0x3599d1);_0x492baf(_0x2ca6d0[_0xb6bd('0x13')](0x1f4,_0x15044a[_0xb6bd('0x15')]));});});};exports[_0xb6bd('0x1e')]=function(_0x3c23a7){var _0x15fbad=this;return new Promise(function(_0xccdce,_0x506eed){return db[_0xb6bd('0x19')]['update'](_0x3c23a7[_0xb6bd('0x1b')],{'raw':_0x3c23a7['options']?_0x3c23a7['options'][_0xb6bd('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c23a7[_0xb6bd('0x1c')]?_0x3c23a7[_0xb6bd('0x1c')]['where']||null:null,'attributes':_0x3c23a7['options']?_0x3c23a7['options'][_0xb6bd('0x1f')]||null:null,'limit':_0x3c23a7['options']?_0x3c23a7[_0xb6bd('0x1c')]['limit']||null:null})[_0xb6bd('0xc')](function(_0x220713){logger[_0xb6bd('0xd')](_0xb6bd('0x1e'),_0x3c23a7);logger[_0xb6bd('0x10')](_0xb6bd('0x1e'),_0x3c23a7,JSON[_0xb6bd('0x12')](_0x220713));_0xccdce(_0x220713);})[_0xb6bd('0x17')](function(_0x2519c4){logger['error'](_0xb6bd('0x1e'),_0x2519c4[_0xb6bd('0x15')],_0x3c23a7);_0x506eed(_0x15fbad[_0xb6bd('0x13')](0x1f4,_0x2519c4[_0xb6bd('0x15')]));});});}; \ No newline at end of file +var _0x208c=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','result','catch','WhatsappQueueReport','create','body','options','raw','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','update','limit','lodash'];(function(_0x24a5c8,_0x5a2f2f){var _0x475e86=function(_0x180311){while(--_0x180311){_0x24a5c8['push'](_0x24a5c8['shift']());}};_0x475e86(++_0x5a2f2f);}(_0x208c,0x16a));var _0xc208=function(_0x40d4ca,_0x19d421){_0x40d4ca=_0x40d4ca-0x0;var _0x5ea824=_0x208c[_0x40d4ca];return _0x5ea824;};'use strict';var _=require(_0xc208('0x0'));var util=require('util');var moment=require(_0xc208('0x1'));var BPromise=require(_0xc208('0x2'));var rs=require(_0xc208('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc208('0x4'))['db'];var utils=require(_0xc208('0x5'));var logger=require('../../config/logger')(_0xc208('0x6'));var config=require(_0xc208('0x7'));var jayson=require(_0xc208('0x8'));var client=jayson[_0xc208('0x9')][_0xc208('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4cefe6,_0x33383e,_0x473701){return new BPromise(function(_0x4be98a,_0x949b54){return client[_0xc208('0xb')](_0x4cefe6,_0x473701)[_0xc208('0xc')](function(_0x34002a){logger[_0xc208('0xd')]('WhatsappQueueReport,\x20%s,\x20%s',_0x33383e,'request\x20sent');logger[_0xc208('0xe')](_0xc208('0xf'),_0x33383e,_0xc208('0x10'),JSON[_0xc208('0x11')](_0x34002a));if(_0x34002a['error']){if(_0x34002a[_0xc208('0x12')][_0xc208('0x13')]===0x1f4){logger['error'](_0xc208('0x14'),_0x33383e,_0x34002a[_0xc208('0x12')][_0xc208('0x15')]);return _0x949b54(_0x34002a[_0xc208('0x12')][_0xc208('0x15')]);}logger[_0xc208('0x12')](_0xc208('0x14'),_0x33383e,_0x34002a[_0xc208('0x12')][_0xc208('0x15')]);return _0x4be98a(_0x34002a[_0xc208('0x12')]['message']);}else{logger[_0xc208('0xd')](_0xc208('0x14'),_0x33383e,_0xc208('0x10'));_0x4be98a(_0x34002a[_0xc208('0x16')]['message']);}})[_0xc208('0x17')](function(_0x44b67b){logger['error'](_0xc208('0x14'),_0x33383e,_0x44b67b);_0x949b54(_0x44b67b);});});}exports['CreateWhatsappQueueReport']=function(_0x284f4c){var _0x447b6e=this;return new Promise(function(_0x8a224f,_0x23a3b9){return db[_0xc208('0x18')][_0xc208('0x19')](_0x284f4c[_0xc208('0x1a')],{'raw':_0x284f4c['options']?_0x284f4c[_0xc208('0x1b')][_0xc208('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x460634){logger[_0xc208('0xd')]('CreateWhatsappQueueReport',_0x284f4c);logger['debug'](_0xc208('0x1d'),_0x284f4c,JSON[_0xc208('0x11')](_0x460634));_0x8a224f(_0x460634);})[_0xc208('0x17')](function(_0x47cd89){logger['error'](_0xc208('0x1d'),_0x47cd89['message'],_0x284f4c);_0x23a3b9(_0x447b6e['error'](0x1f4,_0x47cd89[_0xc208('0x15')]));});});};exports[_0xc208('0x1e')]=function(_0x48ec12){var _0x52fe01=this;return new Promise(function(_0x39fb93,_0x33d55d){return db['WhatsappQueueReport'][_0xc208('0x1f')](_0x48ec12[_0xc208('0x1a')],{'raw':_0x48ec12[_0xc208('0x1b')]?_0x48ec12[_0xc208('0x1b')][_0xc208('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48ec12[_0xc208('0x1b')]?_0x48ec12[_0xc208('0x1b')]['where']||null:null,'attributes':_0x48ec12['options']?_0x48ec12['options']['attributes']||null:null,'limit':_0x48ec12[_0xc208('0x1b')]?_0x48ec12[_0xc208('0x1b')][_0xc208('0x20')]||null:null})[_0xc208('0xc')](function(_0x4b3666){logger[_0xc208('0xd')]('UpdateWhatsappQueueReport',_0x48ec12);logger['debug'](_0xc208('0x1e'),_0x48ec12,JSON['stringify'](_0x4b3666));_0x39fb93(_0x4b3666);})[_0xc208('0x17')](function(_0x299c4b){logger['error'](_0xc208('0x1e'),_0x299c4b[_0xc208('0x15')],_0x48ec12);_0x33d55d(_0x52fe01[_0xc208('0x12')](0x1f4,_0x299c4b[_0xc208('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 0304cbf..30a5caa 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 _0x8555=['isAuthenticated','index','/describe','describe','/:id','show','post','create','delete','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','get'];(function(_0x20db46,_0x516437){var _0x4457a9=function(_0x2b6a84){while(--_0x2b6a84){_0x20db46['push'](_0x20db46['shift']());}};_0x4457a9(++_0x516437);}(_0x8555,0x13c));var _0x5855=function(_0x1a4071,_0x32b6b2){_0x1a4071=_0x1a4071-0x0;var _0x51ff0d=_0x8555[_0x1a4071];return _0x51ff0d;};'use strict';var multer=require(_0x5855('0x0'));var util=require('util');var path=require(_0x5855('0x1'));var timeout=require(_0x5855('0x2'));var express=require('express');var router=express[_0x5855('0x3')]();var auth=require(_0x5855('0x4'));var interaction=require(_0x5855('0x5'));var config=require('../../config/environment');var controller=require(_0x5855('0x6'));router[_0x5855('0x7')]('/',auth[_0x5855('0x8')](),controller[_0x5855('0x9')]);router[_0x5855('0x7')](_0x5855('0xa'),auth[_0x5855('0x8')](),controller[_0x5855('0xb')]);router[_0x5855('0x7')](_0x5855('0xc'),auth[_0x5855('0x8')](),controller[_0x5855('0xd')]);router[_0x5855('0xe')]('/',auth[_0x5855('0x8')](),controller[_0x5855('0xf')]);router['put']('/:id',auth[_0x5855('0x8')](),controller['update']);router[_0x5855('0x10')](_0x5855('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x5855('0x11')]=router; \ No newline at end of file +var _0x16c8=['post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','describe','/:id','show'];(function(_0x104da6,_0x395486){var _0x218923=function(_0x5984af){while(--_0x5984af){_0x104da6['push'](_0x104da6['shift']());}};_0x218923(++_0x395486);}(_0x16c8,0x1eb));var _0x816c=function(_0x2a5a60,_0x4c5793){_0x2a5a60=_0x2a5a60-0x0;var _0x12b247=_0x16c8[_0x2a5a60];return _0x12b247;};'use strict';var multer=require('multer');var util=require(_0x816c('0x0'));var path=require(_0x816c('0x1'));var timeout=require(_0x816c('0x2'));var express=require(_0x816c('0x3'));var router=express[_0x816c('0x4')]();var auth=require(_0x816c('0x5'));var interaction=require(_0x816c('0x6'));var config=require(_0x816c('0x7'));var controller=require(_0x816c('0x8'));router[_0x816c('0x9')]('/',auth[_0x816c('0xa')](),controller[_0x816c('0xb')]);router[_0x816c('0x9')]('/describe',auth[_0x816c('0xa')](),controller[_0x816c('0xc')]);router[_0x816c('0x9')](_0x816c('0xd'),auth[_0x816c('0xa')](),controller[_0x816c('0xe')]);router[_0x816c('0xf')]('/',auth[_0x816c('0xa')](),controller[_0x816c('0x10')]);router[_0x816c('0x11')]('/:id',auth[_0x816c('0xa')](),controller[_0x816c('0x12')]);router[_0x816c('0x13')](_0x816c('0xd'),auth['isAuthenticated'](),controller[_0x816c('0x14')]);module[_0x816c('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 32e64e8..2b40fc5 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 _0x0b0e=['DATE','sequelize','STRING','account','agent','queue'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1b5080,_0x3e7cc9){_0x1b5080=_0x1b5080-0x0;var _0x195c87=_0x0b0e[_0x1b5080];return _0x195c87;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe0b0('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xe0b0('0x5')]}}; \ No newline at end of file +var _0xb7e7=['queue','sequelize','STRING','account'];(function(_0x559d27,_0x342015){var _0x215210=function(_0x536223){while(--_0x536223){_0x559d27['push'](_0x559d27['shift']());}};_0x215210(++_0x342015);}(_0xb7e7,0x121));var _0x7b7e=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0xb7e7[_0x174ef5];return _0x1cc379;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x7b7e('0x2'),'agent',_0x7b7e('0x3')),'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 c2863dc..4c6ca00 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 _0x1e50=['index','map','WhatsappTransferReport','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','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/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','offset','limit','Content-Range','reject','save','update','destroy','then','sendStatus','stack','name','send'];(function(_0x2619a1,_0x394c41){var _0x35ceeb=function(_0x17dc35){while(--_0x17dc35){_0x2619a1['push'](_0x2619a1['shift']());}};_0x35ceeb(++_0x394c41);}(_0x1e50,0x14f));var _0x01e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1e50[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x01e5('0x0'));var emlformat=require(_0x01e5('0x1'));var rimraf=require(_0x01e5('0x2'));var zipdir=require(_0x01e5('0x3'));var jsonpatch=require(_0x01e5('0x4'));var rp=require(_0x01e5('0x5'));var moment=require('moment');var BPromise=require(_0x01e5('0x6'));var Mustache=require(_0x01e5('0x7'));var util=require(_0x01e5('0x8'));var path=require(_0x01e5('0x9'));var sox=require(_0x01e5('0xa'));var csv=require(_0x01e5('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x01e5('0xc'));var squel=require(_0x01e5('0xd'));var crypto=require(_0x01e5('0xe'));var jsforce=require(_0x01e5('0xf'));var deskjs=require(_0x01e5('0x10'));var toCsv=require(_0x01e5('0xb'));var querystring=require(_0x01e5('0x11'));var Papa=require('papaparse');var Redis=require(_0x01e5('0x12'));var authService=require(_0x01e5('0x13'));var qs=require(_0x01e5('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x01e5('0x15'));var logger=require(_0x01e5('0x16'))(_0x01e5('0x17'));var utils=require(_0x01e5('0x18'));var config=require(_0x01e5('0x19'));var db=require(_0x01e5('0x1a'))['db'];function respondWithStatusCode(_0x3f33f9,_0x170f22){_0x170f22=_0x170f22||0xcc;return function(_0x131c9a){if(_0x131c9a){return _0x3f33f9['sendStatus'](_0x170f22);}return _0x3f33f9[_0x01e5('0x1b')](_0x170f22)['end']();};}function respondWithResult(_0x4befdb,_0x45aced){_0x45aced=_0x45aced||0xc8;return function(_0x4ac892){if(_0x4ac892){return _0x4befdb['status'](_0x45aced)['json'](_0x4ac892);}};}function respondWithFilteredResult(_0x25477f,_0x337cbb){return function(_0x1c9ece){if(_0x1c9ece){var _0x1a1095=_0x1c9ece['count'],_0x27da35=_0x337cbb[_0x01e5('0x1c')],_0x4638d2=_0x337cbb[_0x01e5('0x1c')]+_0x337cbb[_0x01e5('0x1d')],_0x39bcc9;if(_0x4638d2>=_0x1a1095){_0x4638d2=_0x1a1095;_0x39bcc9=0xc8;}else{_0x39bcc9=0xce;}_0x25477f[_0x01e5('0x1b')](_0x39bcc9);return _0x25477f['set'](_0x01e5('0x1e'),_0x27da35+'-'+_0x4638d2+'/'+_0x1a1095)['json'](_0x1c9ece);}return null;};}function patchUpdates(_0x3dfff9){return function(_0xd5ea8b){try{jsonpatch['apply'](_0xd5ea8b,_0x3dfff9,!![]);}catch(_0x32cb57){return BPromise[_0x01e5('0x1f')](_0x32cb57);}return _0xd5ea8b[_0x01e5('0x20')]();};}function saveUpdates(_0x5e868e,_0x289192){return function(_0x4145c5){if(_0x4145c5){return _0x4145c5[_0x01e5('0x21')](_0x5e868e)['then'](function(_0x37729a){return _0x37729a;});}return null;};}function removeEntity(_0x4e2adb,_0x5897ac){return function(_0x3928a4){if(_0x3928a4){return _0x3928a4[_0x01e5('0x22')]()[_0x01e5('0x23')](function(){_0x4e2adb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2339b1,_0x34d4de){return function(_0xb3ce1a){if(!_0xb3ce1a){_0x2339b1[_0x01e5('0x24')](0x194);}return _0xb3ce1a;};}function handleError(_0x444a8e,_0x1e2ed3){_0x1e2ed3=_0x1e2ed3||0x1f4;return function(_0x279190){logger['error'](_0x279190[_0x01e5('0x25')]);if(_0x279190[_0x01e5('0x26')]){delete _0x279190['name'];}_0x444a8e[_0x01e5('0x1b')](_0x1e2ed3)[_0x01e5('0x27')](_0x279190);};}exports[_0x01e5('0x28')]=function(_0x3fa759,_0xeb4249){var _0x1332ed={},_0x4c82e7={},_0x31fee0={'count':0x0,'rows':[]};var _0x191c44=_[_0x01e5('0x29')](db[_0x01e5('0x2a')]['rawAttributes'],function(_0x8afe88){return{'name':_0x8afe88[_0x01e5('0x2b')],'type':_0x8afe88[_0x01e5('0x2c')][_0x01e5('0x2d')]};});_0x4c82e7[_0x01e5('0x2e')]=_[_0x01e5('0x29')](_0x191c44,_0x01e5('0x26'));_0x4c82e7[_0x01e5('0x2f')]=_[_0x01e5('0x30')](_0x3fa759[_0x01e5('0x2f')]);_0x4c82e7[_0x01e5('0x31')]=_['intersection'](_0x4c82e7['model'],_0x4c82e7['query']);_0x1332ed[_0x01e5('0x32')]=_[_0x01e5('0x33')](_0x4c82e7['model'],qs[_0x01e5('0x34')](_0x3fa759['query']['fields']));_0x1332ed[_0x01e5('0x32')]=_0x1332ed[_0x01e5('0x32')][_0x01e5('0x35')]?_0x1332ed[_0x01e5('0x32')]:_0x4c82e7[_0x01e5('0x2e')];if(!_0x3fa759[_0x01e5('0x2f')][_0x01e5('0x36')](_0x01e5('0x37'))){_0x1332ed[_0x01e5('0x1d')]=qs[_0x01e5('0x1d')](_0x3fa759[_0x01e5('0x2f')][_0x01e5('0x1d')]);_0x1332ed[_0x01e5('0x1c')]=qs['offset'](_0x3fa759[_0x01e5('0x2f')][_0x01e5('0x1c')]);}_0x1332ed['order']=qs[_0x01e5('0x38')](_0x3fa759[_0x01e5('0x2f')][_0x01e5('0x38')]);_0x1332ed[_0x01e5('0x39')]=qs[_0x01e5('0x31')](_[_0x01e5('0x3a')](_0x3fa759[_0x01e5('0x2f')],_0x4c82e7[_0x01e5('0x31')]),_0x191c44);if(_0x3fa759[_0x01e5('0x2f')][_0x01e5('0x3b')]){_0x1332ed[_0x01e5('0x39')]=_[_0x01e5('0x3c')](_0x1332ed[_0x01e5('0x39')],{'$or':_[_0x01e5('0x29')](_0x191c44,function(_0x3e6349){if(_0x3e6349[_0x01e5('0x2c')]!==_0x01e5('0x3d')){var _0x569b3f={};_0x569b3f[_0x3e6349[_0x01e5('0x26')]]={'$like':'%'+_0x3fa759[_0x01e5('0x2f')][_0x01e5('0x3b')]+'%'};return _0x569b3f;}})});}_0x1332ed=_[_0x01e5('0x3c')]({},_0x1332ed,_0x3fa759[_0x01e5('0x3e')]);var _0x2c7b08={'where':_0x1332ed[_0x01e5('0x39')]};return db[_0x01e5('0x2a')]['count'](_0x2c7b08)[_0x01e5('0x23')](function(_0x1cbd54){_0x31fee0[_0x01e5('0x3f')]=_0x1cbd54;if(_0x3fa759['query']['includeAll']){_0x1332ed[_0x01e5('0x40')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x01e5('0x41')](_0x1332ed);})['then'](function(_0x30d9e1){_0x31fee0[_0x01e5('0x42')]=_0x30d9e1;return _0x31fee0;})['then'](respondWithFilteredResult(_0xeb4249,_0x1332ed))[_0x01e5('0x43')](handleError(_0xeb4249,null));};exports[_0x01e5('0x44')]=function(_0x8b9905,_0x3bcdad){var _0x1e39db={'raw':!![],'where':{'id':_0x8b9905[_0x01e5('0x45')]['id']}},_0x5a177b={};_0x5a177b[_0x01e5('0x2e')]=_[_0x01e5('0x30')](db['WhatsappTransferReport']['rawAttributes']);_0x5a177b[_0x01e5('0x2f')]=_['keys'](_0x8b9905[_0x01e5('0x2f')]);_0x5a177b[_0x01e5('0x31')]=_[_0x01e5('0x33')](_0x5a177b[_0x01e5('0x2e')],_0x5a177b['query']);_0x1e39db[_0x01e5('0x32')]=_['intersection'](_0x5a177b[_0x01e5('0x2e')],qs['fields'](_0x8b9905[_0x01e5('0x2f')][_0x01e5('0x34')]));_0x1e39db['attributes']=_0x1e39db[_0x01e5('0x32')][_0x01e5('0x35')]?_0x1e39db[_0x01e5('0x32')]:_0x5a177b[_0x01e5('0x2e')];if(_0x8b9905['query'][_0x01e5('0x46')]){_0x1e39db['include']=[{'all':!![]}];}_0x1e39db=_[_0x01e5('0x3c')]({},_0x1e39db,_0x8b9905['options']);return db[_0x01e5('0x2a')][_0x01e5('0x47')](_0x1e39db)[_0x01e5('0x23')](handleEntityNotFound(_0x3bcdad,null))[_0x01e5('0x23')](respondWithResult(_0x3bcdad,null))[_0x01e5('0x43')](handleError(_0x3bcdad,null));};exports['create']=function(_0x1f48d3,_0x413fb0){return db[_0x01e5('0x2a')][_0x01e5('0x48')](_0x1f48d3[_0x01e5('0x49')],{})[_0x01e5('0x23')](respondWithResult(_0x413fb0,0xc9))[_0x01e5('0x43')](handleError(_0x413fb0,null));};exports[_0x01e5('0x21')]=function(_0x3d75c5,_0x4e34f2){if(_0x3d75c5[_0x01e5('0x49')]['id']){delete _0x3d75c5[_0x01e5('0x49')]['id'];}return db[_0x01e5('0x2a')]['find']({'where':{'id':_0x3d75c5[_0x01e5('0x45')]['id']}})['then'](handleEntityNotFound(_0x4e34f2,null))[_0x01e5('0x23')](saveUpdates(_0x3d75c5['body'],null))['then'](respondWithResult(_0x4e34f2,null))[_0x01e5('0x43')](handleError(_0x4e34f2,null));};exports['destroy']=function(_0x2bb910,_0x954ee){return db[_0x01e5('0x2a')][_0x01e5('0x47')]({'where':{'id':_0x2bb910[_0x01e5('0x45')]['id']}})[_0x01e5('0x23')](handleEntityNotFound(_0x954ee,null))[_0x01e5('0x23')](removeEntity(_0x954ee,null))[_0x01e5('0x43')](handleError(_0x954ee,null));};exports[_0x01e5('0x4a')]=function(_0x59f777,_0x501941){return db['WhatsappTransferReport']['describe']()['then'](respondWithResult(_0x501941,null))[_0x01e5('0x43')](handleError(_0x501941,null));}; \ No newline at end of file +var _0x3f26=['index','WhatsappTransferReport','rawAttributes','map','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filters','filter','VIRTUAL','options','includeAll','include','rows','catch','show','params','merge','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send'];(function(_0x5d61b4,_0x4f7b91){var _0x183fc5=function(_0x5ecf92){while(--_0x5ecf92){_0x5d61b4['push'](_0x5d61b4['shift']());}};_0x183fc5(++_0x4f7b91);}(_0x3f26,0xb0));var _0x63f2=function(_0x3884f7,_0x46d3a3){_0x3884f7=_0x3884f7-0x0;var _0x53c5fc=_0x3f26[_0x3884f7];return _0x53c5fc;};'use strict';var pdf=require(_0x63f2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x63f2('0x1'));var zipdir=require(_0x63f2('0x2'));var jsonpatch=require(_0x63f2('0x3'));var rp=require(_0x63f2('0x4'));var moment=require(_0x63f2('0x5'));var BPromise=require(_0x63f2('0x6'));var Mustache=require('mustache');var util=require(_0x63f2('0x7'));var path=require('path');var sox=require(_0x63f2('0x8'));var csv=require('to-csv');var ejs=require(_0x63f2('0x9'));var fs=require('fs');var _=require(_0x63f2('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x63f2('0xb'));var deskjs=require(_0x63f2('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x63f2('0xd'));var Redis=require(_0x63f2('0xe'));var authService=require(_0x63f2('0xf'));var qs=require(_0x63f2('0x10'));var as=require(_0x63f2('0x11'));var hardwareService=require(_0x63f2('0x12'));var logger=require('../../config/logger')(_0x63f2('0x13'));var utils=require(_0x63f2('0x14'));var config=require(_0x63f2('0x15'));var db=require(_0x63f2('0x16'))['db'];function respondWithStatusCode(_0x27781,_0x191e7e){_0x191e7e=_0x191e7e||0xcc;return function(_0xb997b8){if(_0xb997b8){return _0x27781[_0x63f2('0x17')](_0x191e7e);}return _0x27781[_0x63f2('0x18')](_0x191e7e)[_0x63f2('0x19')]();};}function respondWithResult(_0x28f76e,_0x2ff76f){_0x2ff76f=_0x2ff76f||0xc8;return function(_0x1f5deb){if(_0x1f5deb){return _0x28f76e[_0x63f2('0x18')](_0x2ff76f)[_0x63f2('0x1a')](_0x1f5deb);}};}function respondWithFilteredResult(_0x557e94,_0x14e3a3){return function(_0x5c4c21){if(_0x5c4c21){var _0xd6812b=_0x5c4c21[_0x63f2('0x1b')],_0x122c49=_0x14e3a3[_0x63f2('0x1c')],_0x5b258c=_0x14e3a3['offset']+_0x14e3a3['limit'],_0x32779b;if(_0x5b258c>=_0xd6812b){_0x5b258c=_0xd6812b;_0x32779b=0xc8;}else{_0x32779b=0xce;}_0x557e94[_0x63f2('0x18')](_0x32779b);return _0x557e94[_0x63f2('0x1d')](_0x63f2('0x1e'),_0x122c49+'-'+_0x5b258c+'/'+_0xd6812b)['json'](_0x5c4c21);}return null;};}function patchUpdates(_0x5edf0f){return function(_0x54c065){try{jsonpatch[_0x63f2('0x1f')](_0x54c065,_0x5edf0f,!![]);}catch(_0x1db048){return BPromise[_0x63f2('0x20')](_0x1db048);}return _0x54c065[_0x63f2('0x21')]();};}function saveUpdates(_0x14e701,_0x36e293){return function(_0xe3628e){if(_0xe3628e){return _0xe3628e[_0x63f2('0x22')](_0x14e701)[_0x63f2('0x23')](function(_0x32ab84){return _0x32ab84;});}return null;};}function removeEntity(_0x57b450,_0x46235b){return function(_0x89c83){if(_0x89c83){return _0x89c83[_0x63f2('0x24')]()['then'](function(){_0x57b450[_0x63f2('0x18')](0xcc)[_0x63f2('0x19')]();});}};}function handleEntityNotFound(_0x28790f,_0x25ad69){return function(_0x2f4740){if(!_0x2f4740){_0x28790f[_0x63f2('0x17')](0x194);}return _0x2f4740;};}function handleError(_0x5115c4,_0x5704de){_0x5704de=_0x5704de||0x1f4;return function(_0x4138ec){logger[_0x63f2('0x25')](_0x4138ec['stack']);if(_0x4138ec[_0x63f2('0x26')]){delete _0x4138ec[_0x63f2('0x26')];}_0x5115c4[_0x63f2('0x18')](_0x5704de)[_0x63f2('0x27')](_0x4138ec);};}exports[_0x63f2('0x28')]=function(_0x10d92d,_0x28c479){var _0x3afc2a={},_0x5a8b5a={},_0x19d684={'count':0x0,'rows':[]};var _0x5a209e=_['map'](db[_0x63f2('0x29')][_0x63f2('0x2a')],function(_0x613266){return{'name':_0x613266['fieldName'],'type':_0x613266['type']['key']};});_0x5a8b5a['model']=_[_0x63f2('0x2b')](_0x5a209e,_0x63f2('0x26'));_0x5a8b5a[_0x63f2('0x2c')]=_[_0x63f2('0x2d')](_0x10d92d[_0x63f2('0x2c')]);_0x5a8b5a['filters']=_[_0x63f2('0x2e')](_0x5a8b5a[_0x63f2('0x2f')],_0x5a8b5a[_0x63f2('0x2c')]);_0x3afc2a['attributes']=_[_0x63f2('0x2e')](_0x5a8b5a[_0x63f2('0x2f')],qs['fields'](_0x10d92d[_0x63f2('0x2c')][_0x63f2('0x30')]));_0x3afc2a['attributes']=_0x3afc2a[_0x63f2('0x31')][_0x63f2('0x32')]?_0x3afc2a[_0x63f2('0x31')]:_0x5a8b5a[_0x63f2('0x2f')];if(!_0x10d92d['query'][_0x63f2('0x33')]('nolimit')){_0x3afc2a[_0x63f2('0x34')]=qs[_0x63f2('0x34')](_0x10d92d['query']['limit']);_0x3afc2a[_0x63f2('0x1c')]=qs['offset'](_0x10d92d['query'][_0x63f2('0x1c')]);}_0x3afc2a[_0x63f2('0x35')]=qs['sort'](_0x10d92d[_0x63f2('0x2c')][_0x63f2('0x36')]);_0x3afc2a[_0x63f2('0x37')]=qs['filters'](_[_0x63f2('0x38')](_0x10d92d[_0x63f2('0x2c')],_0x5a8b5a[_0x63f2('0x39')]),_0x5a209e);if(_0x10d92d['query'][_0x63f2('0x3a')]){_0x3afc2a[_0x63f2('0x37')]=_['merge'](_0x3afc2a[_0x63f2('0x37')],{'$or':_[_0x63f2('0x2b')](_0x5a209e,function(_0x1c762e){if(_0x1c762e['type']!==_0x63f2('0x3b')){var _0x30b7fa={};_0x30b7fa[_0x1c762e['name']]={'$like':'%'+_0x10d92d[_0x63f2('0x2c')]['filter']+'%'};return _0x30b7fa;}})});}_0x3afc2a=_['merge']({},_0x3afc2a,_0x10d92d[_0x63f2('0x3c')]);var _0x35794e={'where':_0x3afc2a[_0x63f2('0x37')]};return db[_0x63f2('0x29')][_0x63f2('0x1b')](_0x35794e)['then'](function(_0x1378ec){_0x19d684[_0x63f2('0x1b')]=_0x1378ec;if(_0x10d92d[_0x63f2('0x2c')][_0x63f2('0x3d')]){_0x3afc2a[_0x63f2('0x3e')]=[{'all':!![]}];}return db[_0x63f2('0x29')]['findAll'](_0x3afc2a);})[_0x63f2('0x23')](function(_0x3f9fc){_0x19d684[_0x63f2('0x3f')]=_0x3f9fc;return _0x19d684;})[_0x63f2('0x23')](respondWithFilteredResult(_0x28c479,_0x3afc2a))[_0x63f2('0x40')](handleError(_0x28c479,null));};exports[_0x63f2('0x41')]=function(_0x320ccb,_0x20432f){var _0xc1c6cc={'raw':!![],'where':{'id':_0x320ccb[_0x63f2('0x42')]['id']}},_0x49e6b0={};_0x49e6b0[_0x63f2('0x2f')]=_['keys'](db[_0x63f2('0x29')][_0x63f2('0x2a')]);_0x49e6b0[_0x63f2('0x2c')]=_[_0x63f2('0x2d')](_0x320ccb[_0x63f2('0x2c')]);_0x49e6b0[_0x63f2('0x39')]=_[_0x63f2('0x2e')](_0x49e6b0[_0x63f2('0x2f')],_0x49e6b0[_0x63f2('0x2c')]);_0xc1c6cc[_0x63f2('0x31')]=_[_0x63f2('0x2e')](_0x49e6b0[_0x63f2('0x2f')],qs[_0x63f2('0x30')](_0x320ccb[_0x63f2('0x2c')][_0x63f2('0x30')]));_0xc1c6cc[_0x63f2('0x31')]=_0xc1c6cc['attributes'][_0x63f2('0x32')]?_0xc1c6cc[_0x63f2('0x31')]:_0x49e6b0[_0x63f2('0x2f')];if(_0x320ccb[_0x63f2('0x2c')]['includeAll']){_0xc1c6cc[_0x63f2('0x3e')]=[{'all':!![]}];}_0xc1c6cc=_[_0x63f2('0x43')]({},_0xc1c6cc,_0x320ccb[_0x63f2('0x3c')]);return db[_0x63f2('0x29')][_0x63f2('0x44')](_0xc1c6cc)[_0x63f2('0x23')](handleEntityNotFound(_0x20432f,null))[_0x63f2('0x23')](respondWithResult(_0x20432f,null))[_0x63f2('0x40')](handleError(_0x20432f,null));};exports['create']=function(_0xe4263,_0x3b7cbd){return db[_0x63f2('0x29')][_0x63f2('0x45')](_0xe4263[_0x63f2('0x46')],{})[_0x63f2('0x23')](respondWithResult(_0x3b7cbd,0xc9))[_0x63f2('0x40')](handleError(_0x3b7cbd,null));};exports[_0x63f2('0x22')]=function(_0xf4839e,_0x56857c){if(_0xf4839e['body']['id']){delete _0xf4839e['body']['id'];}return db['WhatsappTransferReport']['find']({'where':{'id':_0xf4839e[_0x63f2('0x42')]['id']}})[_0x63f2('0x23')](handleEntityNotFound(_0x56857c,null))[_0x63f2('0x23')](saveUpdates(_0xf4839e[_0x63f2('0x46')],null))[_0x63f2('0x23')](respondWithResult(_0x56857c,null))[_0x63f2('0x40')](handleError(_0x56857c,null));};exports['destroy']=function(_0x344eb6,_0x516278){return db[_0x63f2('0x29')][_0x63f2('0x44')]({'where':{'id':_0x344eb6[_0x63f2('0x42')]['id']}})['then'](handleEntityNotFound(_0x516278,null))[_0x63f2('0x23')](removeEntity(_0x516278,null))[_0x63f2('0x40')](handleError(_0x516278,null));};exports[_0x63f2('0x47')]=function(_0x1e4775,_0x214439){return db[_0x63f2('0x29')][_0x63f2('0x47')]()['then'](respondWithResult(_0x214439,null))['catch'](handleError(_0x214439,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 797e561..00e6deb 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 _0x1a74=['../../config/environment','./whatsappTransferReport.attributes','exports','report_whatsapp_transfer','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x266bb6,_0x1bb886){var _0x328f95=function(_0xae983c){while(--_0xae983c){_0x266bb6['push'](_0x266bb6['shift']());}};_0x328f95(++_0x1bb886);}(_0x1a74,0x19c));var _0x41a7=function(_0x1393d0,_0xb2ac4){_0x1393d0=_0x1393d0-0x0;var _0x1b67b5=_0x1a74[_0x1393d0];return _0x1b67b5;};'use strict';var _=require(_0x41a7('0x0'));var util=require('util');var logger=require(_0x41a7('0x1'))(_0x41a7('0x2'));var moment=require(_0x41a7('0x3'));var BPromise=require(_0x41a7('0x4'));var rp=require(_0x41a7('0x5'));var fs=require('fs');var path=require(_0x41a7('0x6'));var rimraf=require(_0x41a7('0x7'));var config=require(_0x41a7('0x8'));var attributes=require(_0x41a7('0x9'));module[_0x41a7('0xa')]=function(_0x4658e3,_0x53b9b8){return _0x4658e3['define']('WhatsappTransferReport',attributes,{'tableName':_0x41a7('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc33e=['rimraf','../../config/environment','./whatsappTransferReport.attributes','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','api','bluebird','request-promise','path'];(function(_0x4c0a9a,_0x945975){var _0x230777=function(_0xe3be5b){while(--_0xe3be5b){_0x4c0a9a['push'](_0x4c0a9a['shift']());}};_0x230777(++_0x945975);}(_0xc33e,0x18d));var _0xec33=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc33e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xec33('0x0'));var util=require(_0xec33('0x1'));var logger=require('../../config/logger')(_0xec33('0x2'));var moment=require('moment');var BPromise=require(_0xec33('0x3'));var rp=require(_0xec33('0x4'));var fs=require('fs');var path=require(_0xec33('0x5'));var rimraf=require(_0xec33('0x6'));var config=require(_0xec33('0x7'));var attributes=require(_0xec33('0x8'));module['exports']=function(_0x2ee5ce,_0x31c902){return _0x2ee5ce[_0xec33('0x9')](_0xec33('0xa'),attributes,{'tableName':_0xec33('0xb'),'paranoid':![],'indexes':[{'name':_0xec33('0xc'),'fields':[_0xec33('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 67c1e9a..ee715da 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(_0x58c95d,_0x3b28df){var _0xc12ea9=function(_0x4c7499){while(--_0x4c7499){_0x58c95d['push'](_0x58c95d['shift']());}};_0xc12ea9(++_0x3b28df);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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(_0x165a20,_0x5570c5){var _0x188b15=function(_0x1e4a54){while(--_0x1e4a54){_0x165a20['push'](_0x165a20['shift']());}};_0x188b15(++_0x5570c5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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 60f0f00..5c38080 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1c26=['./rpc','./config/environment','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','sequelize','then','listen','info','start','Online\x20apps:','filter','online','name','join','map','None','seedDB','./config/seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1c26,0x1a2));var _0x61c2=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x1c26[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x61c2('0x0'));var mysqldb=require(_0x61c2('0x1'));var rpc=require(_0x61c2('0x2'));var config=require(_0x61c2('0x3'));var logger=require(_0x61c2('0x4'))('app');var pm2=require(_0x61c2('0x5'));var pm2Config=require(_0x61c2('0x6'));var schedule=require(_0x61c2('0x7'));var chat=require(_0x61c2('0x8'));function main(){return mysqldb['db'][_0x61c2('0x9')]['sync']()[_0x61c2('0xa')](function(){return rpc[_0x61c2('0xb')]();})[_0x61c2('0xa')](function(_0x1a9073){logger[_0x61c2('0xc')](_0x1a9073);return chat[_0x61c2('0xd')]();})[_0x61c2('0xa')](function(){return schedule[_0x61c2('0xd')]();})['then'](function(_0x3501d9){logger[_0x61c2('0xc')](_0x3501d9);return pm2[_0x61c2('0xd')](pm2Config);})[_0x61c2('0xa')](function(_0x3f3ec7){logger['info'](_0x61c2('0xe'),_['map'](_[_0x61c2('0xf')](_0x3f3ec7,{'status':_0x61c2('0x10')}),_0x61c2('0x11'))[_0x61c2('0x12')]());logger[_0x61c2('0xc')]('Offline\x20apps:',_[_0x61c2('0x13')](_[_0x61c2('0xf')](_0x3f3ec7,function(_0x232c80){return _0x232c80['status']!==_0x61c2('0x10');}),_0x61c2('0x11'))['join']()||_0x61c2('0x14'));config[_0x61c2('0x15')]&&require(_0x61c2('0x16'))[_0x61c2('0x17')]();require(_0x61c2('0x18'))[_0x61c2('0x17')]();})[_0x61c2('0x19')](function(_0x58e571){logger[_0x61c2('0x1a')](_0x61c2('0x1b'),_0x58e571);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x12e8=['./config/pm2/config','./config/schedule/chat','sequelize','then','listen','info','start','Online\x20apps:','map','online','name','join','Offline\x20apps:','status','seedDB','./config/seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./rpc','./config/environment','./config/pm2'];(function(_0x1c510a,_0x1413a9){var _0x23cedd=function(_0x3f3e43){while(--_0x3f3e43){_0x1c510a['push'](_0x1c510a['shift']());}};_0x23cedd(++_0x1413a9);}(_0x12e8,0x168));var _0x812e=function(_0x149fd5,_0xdb2b83){_0x149fd5=_0x149fd5-0x0;var _0x17bd0c=_0x12e8[_0x149fd5];return _0x17bd0c;};'use strict';var _=require(_0x812e('0x0'));var mysqldb=require('./mysqldb');var rpc=require(_0x812e('0x1'));var config=require(_0x812e('0x2'));var logger=require('./config/logger')('app');var pm2=require(_0x812e('0x3'));var pm2Config=require(_0x812e('0x4'));var schedule=require('./config/schedule');var chat=require(_0x812e('0x5'));function main(){return mysqldb['db'][_0x812e('0x6')]['sync']()[_0x812e('0x7')](function(){return rpc[_0x812e('0x8')]();})[_0x812e('0x7')](function(_0x23dbf3){logger[_0x812e('0x9')](_0x23dbf3);return chat['start']();})[_0x812e('0x7')](function(){return schedule[_0x812e('0xa')]();})[_0x812e('0x7')](function(_0x4a8506){logger[_0x812e('0x9')](_0x4a8506);return pm2[_0x812e('0xa')](pm2Config);})[_0x812e('0x7')](function(_0x2fa125){logger[_0x812e('0x9')](_0x812e('0xb'),_[_0x812e('0xc')](_['filter'](_0x2fa125,{'status':_0x812e('0xd')}),_0x812e('0xe'))[_0x812e('0xf')]());logger[_0x812e('0x9')](_0x812e('0x10'),_[_0x812e('0xc')](_['filter'](_0x2fa125,function(_0x463b2a){return _0x463b2a[_0x812e('0x11')]!==_0x812e('0xd');}),_0x812e('0xe'))[_0x812e('0xf')]()||'None');config[_0x812e('0x12')]&&require(_0x812e('0x13'))[_0x812e('0x14')]();require(_0x812e('0x15'))['default']();})[_0x812e('0x16')](function(_0x544b0){logger[_0x812e('0x17')](_0x812e('0x18'),_0x544b0);process[_0x812e('0x19')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 37b40f9..806a66b 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 _0x1a85=['crypto','bluebird','session','fullname','internal','email','permissions','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','hotdesk','userProfileId','isChatInteractionAuthorized','isAuthenticated','use','ChatInteraction','findOne','params','closed','disposition','then','status','unmanaged','json','Unmanaged.','catch','startsWith','authorization','Basic','User','find','name','pass','Wrong\x20credentials.','user','headers','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','query','sub','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','User\x20not\x20found.','canUpdate','../../config/license/util','getLicense','update','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','/dashboards/general','send','retrieveApiKey','isNil','generateApiKey','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','promisify','sign','secrets','payload','options','hex','now','toString','HS512','../../config/license/hardware','lodash','jsonwebtoken','basic-auth'];(function(_0x4d2cd0,_0x3ee716){var _0x4bc98e=function(_0x3aff06){while(--_0x3aff06){_0x4d2cd0['push'](_0x4d2cd0['shift']());}};_0x4bc98e(++_0x3ee716);}(_0x1a85,0x178));var _0x51a8=function(_0x1e73fc,_0x533750){_0x1e73fc=_0x1e73fc-0x0;var _0xeceac4=_0x1a85[_0x1e73fc];return _0xeceac4;};'use strict';var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var hardwareConf=require(_0x51a8('0x0'));var _=require(_0x51a8('0x1'));var jwt=require(_0x51a8('0x2'));var expressJwt=require('express-jwt');var compose=require('composable-middleware');var basicAuth=require(_0x51a8('0x3'));var crypto=require(_0x51a8('0x4'));var BPromise=require(_0x51a8('0x5'));var validateJwt=expressJwt({'secret':config['secrets'][_0x51a8('0x6')]});var userAttributes=['id','role',_0x51a8('0x7'),'name',_0x51a8('0x8'),_0x51a8('0x9'),'userpic',_0x51a8('0xa'),'md5secret','voicePause',_0x51a8('0xb'),_0x51a8('0xc'),_0x51a8('0xd'),_0x51a8('0xe'),_0x51a8('0xf'),_0x51a8('0x10'),_0x51a8('0x11'),_0x51a8('0x12'),_0x51a8('0x13'),_0x51a8('0x14'),_0x51a8('0x15'),_0x51a8('0x16'),_0x51a8('0x17'),_0x51a8('0x18'),_0x51a8('0x19'),_0x51a8('0x1a'),_0x51a8('0x1b'),'phoneBarEnableSettings',_0x51a8('0x1c'),_0x51a8('0x1d'),_0x51a8('0x1e'),'phoneBarRemoteControlPort',_0x51a8('0x1f'),'interface',_0x51a8('0x20')];exports[_0x51a8('0x21')]=function(){return this[_0x51a8('0x22')](!![])[_0x51a8('0x23')](function(_0x3fbd02,_0x3e0603,_0x1f49ee){if(_0x3fbd02['user']){_0x1f49ee();}else{return db[_0x51a8('0x24')][_0x51a8('0x25')]({'where':{'id':_0x3fbd02[_0x51a8('0x26')]['id']},'attributes':['id',_0x51a8('0x27'),_0x51a8('0x28')],'raw':!![]})[_0x51a8('0x29')](function(_0x5f3acf){if(_0x5f3acf&&_0x5f3acf[_0x51a8('0x27')]){return _0x3e0603[_0x51a8('0x2a')](_0x5f3acf[_0x51a8('0x28')]===_0x51a8('0x2b')?0x195:0x193)[_0x51a8('0x2c')]({'message':_0x5f3acf[_0x51a8('0x28')]===_0x51a8('0x2b')?_0x51a8('0x2d'):'Forbidden.'});}else{_0x1f49ee();}})[_0x51a8('0x2e')](function(_0x53438c){_0x1f49ee(_0x53438c);});}});};exports[_0x51a8('0x22')]=function isAuthenticated(_0x12c029){return compose()[_0x51a8('0x23')](function(_0x3759d6,_0x51f737,_0xae3588){if(_0x3759d6['headers']['authorization']){if(_[_0x51a8('0x2f')](_0x3759d6['headers'][_0x51a8('0x30')],_0x51a8('0x31'))){var _0x20ef8b=basicAuth(_0x3759d6);db[_0x51a8('0x32')][_0x51a8('0x33')]({'where':{'name':_0x20ef8b[_0x51a8('0x34')]}})[_0x51a8('0x29')](function(_0x1326a2){if(!_0x1326a2||!_0x1326a2['authenticate'](_0x20ef8b[_0x51a8('0x35')])){return _0x51f737[_0x51a8('0x2a')](0x191)[_0x51a8('0x2c')]({'message':_0x51a8('0x36')});}_0x3759d6[_0x51a8('0x37')]={'id':_0x1326a2['id']};_0xae3588();})[_0x51a8('0x2e')](function(_0x1a886f){_0xae3588(_0x1a886f);});}else if(_[_0x51a8('0x2f')](_0x3759d6[_0x51a8('0x38')][_0x51a8('0x30')],_0x51a8('0x39'))){validateJwt(_0x3759d6,_0x51f737,_0xae3588);}else{if(_0x12c029){_0xae3588();}else{return _0x51f737[_0x51a8('0x2a')](0x193)['json']({'message':_0x51a8('0x3a')});}}}else if(_0x3759d6['query'][_0x51a8('0x3b')]){try{var _0x3bc19a={'audience':hardwareConf[_0x51a8('0x3c')](),'issuer':hardwareConf[_0x51a8('0x3c')]()};verifyJwt(_0x3759d6[_0x51a8('0x3d')]['apikey'],_0x3bc19a)[_0x51a8('0x29')](function(_0x4c67ff){return db[_0x51a8('0x32')][_0x51a8('0x33')]({'where':{'id':_0x4c67ff[_0x51a8('0x3e')]}})['then'](function(_0x2080a1){if(!_0x2080a1||!_['isEqual'](_0x2080a1[_0x51a8('0x3f')],_0x4c67ff[_0x51a8('0x40')])){return _0x51f737[_0x51a8('0x2a')](0x191)[_0x51a8('0x2c')]({'message':_0x51a8('0x41')});}_0x3759d6['user']={'id':_0x2080a1['id']};_0xae3588();});})[_0x51a8('0x2e')](function(){return _0x51f737['status'](0x191)[_0x51a8('0x2c')]({'message':_0x51a8('0x42')});});}catch(_0x41561a){_0xae3588(_0x41561a);}}else if(_0x12c029){_0xae3588();}else{return _0x51f737['status'](0x193)[_0x51a8('0x2c')]({'message':_0x51a8('0x3a')});}})[_0x51a8('0x23')](function(_0x2429f8,_0x41c020,_0x49ab37){if(_0x2429f8['user']){db['User'][_0x51a8('0x33')]({'where':{'id':_0x2429f8[_0x51a8('0x37')]['id']},'attributes':userAttributes})['then'](function(_0x35d7a1){if(!_0x35d7a1){return _0x41c020['status'](0x194)[_0x51a8('0x2c')]({'message':_0x51a8('0x43')});}_0x2429f8[_0x51a8('0x37')]=_0x35d7a1;_0x49ab37();})[_0x51a8('0x2e')](function(_0x256cda){_0x49ab37(_0x256cda);});}else if(_0x12c029){_0x49ab37();}else{return _0x41c020[_0x51a8('0x2a')](0x194)['json']({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x51a8('0x44')]=function canUpdate(){return compose()['use'](function(_0x5d7214,_0x5df144,_0x1d775e){return require(_0x51a8('0x45'))[_0x51a8('0x46')]()['then'](function(_0x728638){if(_0x728638[_0x51a8('0x47')]){_0x1d775e();}else{return _0x5df144[_0x51a8('0x2a')](0x193)[_0x51a8('0x2c')]({'message':'Forbidden'});}})[_0x51a8('0x2e')](function(_0xe6a86a){_0x1d775e(_0xe6a86a);});});};exports[_0x51a8('0x48')]=function(_0x4dcbfb,_0xb96200,_0x51d7bd){_0x4dcbfb[_0x51a8('0x48')]=!![];return _0x51d7bd();};exports[_0x51a8('0x49')]=function signToken(_0x2a98bd){return signJwt(_0x2a98bd);};exports[_0x51a8('0x4a')]=function(_0x5c44a9,_0x8e248){if(!_0x5c44a9[_0x51a8('0x37')]){return _0x8e248[_0x51a8('0x2a')](0x194)[_0x51a8('0x2c')]({'message':_0x51a8('0x4b')});}var _0x35c1c9={'payload':{'id':_0x5c44a9[_0x51a8('0x37')]['id'],'role':_0x5c44a9[_0x51a8('0x37')][_0x51a8('0x4c')]},'options':{'expiresIn':0x15180}};return signJwt(_0x35c1c9)['then'](function(_0x22e6e6){_0x8e248[_0x51a8('0x4d')]('motion.token',_0x22e6e6);_0x8e248['redirect'](_0x51a8('0x4e'));})[_0x51a8('0x2e')](function(_0x2b8af2){return _0x8e248[_0x51a8('0x2a')](0x1f4)[_0x51a8('0x4f')](_0x2b8af2);});};exports[_0x51a8('0x50')]=function(_0x28f5b3){if(_[_0x51a8('0x51')](_0x28f5b3[_0x51a8('0x3f')])||_[_0x51a8('0x51')](_0x28f5b3['apiKeyIat'])){return null;}else{return createJwt(_0x28f5b3);}};exports[_0x51a8('0x52')]=function(_0x218ae0){_0x218ae0[_0x51a8('0x3f')]=generateNonce();_0x218ae0[_0x51a8('0x53')]=generateIssuedAt();return createJwt(_0x218ae0);};exports[_0x51a8('0x54')]=function(_0x22ff0e,_0x579411){var _0x9104bf=_0x22ff0e['query'][_0x51a8('0x3b')];if(_0x9104bf){var _0x3a33f3={'nonce':_0x579411[_0x51a8('0x3f')],'iat':_0x579411[_0x51a8('0x53')],'audience':hardwareConf[_0x51a8('0x3c')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x9104bf,_0x3a33f3)['then'](function(){return generateApiKey(_0x579411);});}else{throw{'message':_0x51a8('0x55')};}};function signJwt(_0x3ce04e){var _0x41cfda=BPromise[_0x51a8('0x56')](jwt[_0x51a8('0x57')],{'context':jwt});var _0x570b11=_0x3ce04e['secret']||config[_0x51a8('0x58')][_0x51a8('0x6')];return new BPromise(function(_0x24b205,_0x419863){_0x41cfda(_0x3ce04e[_0x51a8('0x59')],_0x570b11,_0x3ce04e[_0x51a8('0x5a')])[_0x51a8('0x29')](function(_0x1103a3){_0x24b205(_0x1103a3);})[_0x51a8('0x2e')](function(_0x4d29ab){_0x419863(_0x4d29ab);});});}function verifyJwt(_0x5cb2cf,_0x5db030,_0x3e2d6c){var _0x279cb1=BPromise[_0x51a8('0x56')](jwt['verify'],{'context':jwt});var _0x3bd492=_0x3e2d6c||config[_0x51a8('0x58')]['session'];return new BPromise(function(_0x15cb42,_0x4fb93c){_0x279cb1(_0x5cb2cf,_0x3bd492,_0x5db030)['then'](function(_0xbf828b){_0x15cb42(_0xbf828b);})[_0x51a8('0x2e')](function(_0x41dd1f){_0x4fb93c(_0x41dd1f);});});}function generateNonce(){return crypto['randomBytes'](0x10)['toString'](_0x51a8('0x5b'));}function generateIssuedAt(){return Math['floor'](Date[_0x51a8('0x5c')]()/0x3e8)[_0x51a8('0x5d')]();}function createJwt(_0x3623d4){var _0x1ace5b={'payload':{'iat':_0x3623d4[_0x51a8('0x53')],'nonce':_0x3623d4[_0x51a8('0x3f')]},'options':{'algorithm':_0x51a8('0x5e'),'subject':_0x3623d4['id'][_0x51a8('0x5d')](),'issuer':hardwareConf[_0x51a8('0x3c')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x1ace5b)[_0x51a8('0x29')](function(_0xe4518d){return{'iat':_0x3623d4[_0x51a8('0x53')],'nonce':_0x3623d4[_0x51a8('0x3f')],'token':_0xe4518d};});} \ No newline at end of file +var _0xc2c7=['retrieveApiKey','isNil','apiKeyIat','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','promisify','secret','secrets','payload','options','verify','hex','now','toString','HS512','../../config/environment','../../config/license/hardware','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','session','role','fullname','userpic','permissions','md5secret','voicePause','chatPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','userProfileId','isChatInteractionAuthorized','use','user','ChatInteraction','findOne','params','closed','disposition','then','status','unmanaged','Forbidden.','catch','isAuthenticated','authorization','headers','Basic','find','name','authenticate','pass','Wrong\x20credentials.','startsWith','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','User','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','json','Invalid\x20API\x20access\x20key','User\x20object\x20not\x20found.','canUpdate','../../config/license/util','getLicense','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','/dashboards/general','send'];(function(_0x44f9f0,_0x565827){var _0x28e1ff=function(_0x528f54){while(--_0x528f54){_0x44f9f0['push'](_0x44f9f0['shift']());}};_0x28e1ff(++_0x565827);}(_0xc2c7,0x134));var _0x7c2c=function(_0x2f6f4d,_0x36f77d){_0x2f6f4d=_0x2f6f4d-0x0;var _0x585f1b=_0xc2c7[_0x2f6f4d];return _0x585f1b;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x7c2c('0x0'));var hardwareConf=require(_0x7c2c('0x1'));var _=require(_0x7c2c('0x2'));var jwt=require(_0x7c2c('0x3'));var expressJwt=require(_0x7c2c('0x4'));var compose=require(_0x7c2c('0x5'));var basicAuth=require(_0x7c2c('0x6'));var crypto=require(_0x7c2c('0x7'));var BPromise=require('bluebird');var validateJwt=expressJwt({'secret':config['secrets'][_0x7c2c('0x8')]});var userAttributes=['id',_0x7c2c('0x9'),_0x7c2c('0xa'),'name','internal','email',_0x7c2c('0xb'),_0x7c2c('0xc'),_0x7c2c('0xd'),_0x7c2c('0xe'),_0x7c2c('0xf'),'mailPause',_0x7c2c('0x10'),_0x7c2c('0x11'),_0x7c2c('0x12'),_0x7c2c('0x13'),_0x7c2c('0x14'),_0x7c2c('0x15'),_0x7c2c('0x16'),_0x7c2c('0x17'),_0x7c2c('0x18'),_0x7c2c('0x19'),_0x7c2c('0x1a'),_0x7c2c('0x1b'),_0x7c2c('0x1c'),_0x7c2c('0x1d'),_0x7c2c('0x1e'),_0x7c2c('0x1f'),'phoneBarExpires','phoneBarPrefixRequired',_0x7c2c('0x20'),_0x7c2c('0x21'),_0x7c2c('0x22'),'interface',_0x7c2c('0x23')];exports[_0x7c2c('0x24')]=function(){return this['isAuthenticated'](!![])[_0x7c2c('0x25')](function(_0x5a5fe2,_0x1aa355,_0x51b73c){if(_0x5a5fe2[_0x7c2c('0x26')]){_0x51b73c();}else{return db[_0x7c2c('0x27')][_0x7c2c('0x28')]({'where':{'id':_0x5a5fe2[_0x7c2c('0x29')]['id']},'attributes':['id',_0x7c2c('0x2a'),_0x7c2c('0x2b')],'raw':!![]})[_0x7c2c('0x2c')](function(_0x1ce7e1){if(_0x1ce7e1&&_0x1ce7e1[_0x7c2c('0x2a')]){return _0x1aa355[_0x7c2c('0x2d')](_0x1ce7e1[_0x7c2c('0x2b')]===_0x7c2c('0x2e')?0x195:0x193)['json']({'message':_0x1ce7e1[_0x7c2c('0x2b')]==='unmanaged'?'Unmanaged.':_0x7c2c('0x2f')});}else{_0x51b73c();}})[_0x7c2c('0x30')](function(_0x2a9ae2){_0x51b73c(_0x2a9ae2);});}});};exports[_0x7c2c('0x31')]=function isAuthenticated(_0x41552f){return compose()[_0x7c2c('0x25')](function(_0xa84620,_0x541368,_0x10c356){if(_0xa84620['headers'][_0x7c2c('0x32')]){if(_['startsWith'](_0xa84620[_0x7c2c('0x33')][_0x7c2c('0x32')],_0x7c2c('0x34'))){var _0x481867=basicAuth(_0xa84620);db['User'][_0x7c2c('0x35')]({'where':{'name':_0x481867[_0x7c2c('0x36')]}})[_0x7c2c('0x2c')](function(_0x150690){if(!_0x150690||!_0x150690[_0x7c2c('0x37')](_0x481867[_0x7c2c('0x38')])){return _0x541368[_0x7c2c('0x2d')](0x191)['json']({'message':_0x7c2c('0x39')});}_0xa84620[_0x7c2c('0x26')]={'id':_0x150690['id']};_0x10c356();})[_0x7c2c('0x30')](function(_0x22d03f){_0x10c356(_0x22d03f);});}else if(_[_0x7c2c('0x3a')](_0xa84620[_0x7c2c('0x33')][_0x7c2c('0x32')],_0x7c2c('0x3b'))){validateJwt(_0xa84620,_0x541368,_0x10c356);}else{if(_0x41552f){_0x10c356();}else{return _0x541368[_0x7c2c('0x2d')](0x193)['json']({'message':_0x7c2c('0x3c')});}}}else if(_0xa84620[_0x7c2c('0x3d')][_0x7c2c('0x3e')]){try{var _0x720667={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x7c2c('0x3f')]()};verifyJwt(_0xa84620[_0x7c2c('0x3d')][_0x7c2c('0x3e')],_0x720667)[_0x7c2c('0x2c')](function(_0x1859c2){return db[_0x7c2c('0x40')][_0x7c2c('0x35')]({'where':{'id':_0x1859c2['sub']}})[_0x7c2c('0x2c')](function(_0x1acf75){if(!_0x1acf75||!_[_0x7c2c('0x41')](_0x1acf75[_0x7c2c('0x42')],_0x1859c2[_0x7c2c('0x43')])){return _0x541368['status'](0x191)['json']({'message':_0x7c2c('0x44')});}_0xa84620['user']={'id':_0x1acf75['id']};_0x10c356();});})['catch'](function(){return _0x541368[_0x7c2c('0x2d')](0x191)[_0x7c2c('0x45')]({'message':_0x7c2c('0x46')});});}catch(_0x156c03){_0x10c356(_0x156c03);}}else if(_0x41552f){_0x10c356();}else{return _0x541368['status'](0x193)[_0x7c2c('0x45')]({'message':_0x7c2c('0x3c')});}})[_0x7c2c('0x25')](function(_0x19783d,_0x204968,_0x6ef8c4){if(_0x19783d[_0x7c2c('0x26')]){db[_0x7c2c('0x40')][_0x7c2c('0x35')]({'where':{'id':_0x19783d[_0x7c2c('0x26')]['id']},'attributes':userAttributes})[_0x7c2c('0x2c')](function(_0x442510){if(!_0x442510){return _0x204968[_0x7c2c('0x2d')](0x194)['json']({'message':'User\x20not\x20found.'});}_0x19783d[_0x7c2c('0x26')]=_0x442510;_0x6ef8c4();})['catch'](function(_0x4c421c){_0x6ef8c4(_0x4c421c);});}else if(_0x41552f){_0x6ef8c4();}else{return _0x204968['status'](0x194)[_0x7c2c('0x45')]({'message':_0x7c2c('0x47')});}});};exports[_0x7c2c('0x48')]=function canUpdate(){return compose()[_0x7c2c('0x25')](function(_0x1cf51e,_0x151eb2,_0x1f8d75){return require(_0x7c2c('0x49'))[_0x7c2c('0x4a')]()[_0x7c2c('0x2c')](function(_0x6a9b35){if(_0x6a9b35['update']){_0x1f8d75();}else{return _0x151eb2['status'](0x193)[_0x7c2c('0x45')]({'message':_0x7c2c('0x4b')});}})[_0x7c2c('0x30')](function(_0x57bead){_0x1f8d75(_0x57bead);});});};exports['isMiddleware']=function(_0x10512a,_0x19c3fb,_0x93e2a8){_0x10512a[_0x7c2c('0x4c')]=!![];return _0x93e2a8();};exports[_0x7c2c('0x4d')]=function signToken(_0x8b0dc9){return signJwt(_0x8b0dc9);};exports[_0x7c2c('0x4e')]=function(_0x2e4093,_0xe55c39){if(!_0x2e4093['user']){return _0xe55c39[_0x7c2c('0x2d')](0x194)['json']({'message':_0x7c2c('0x4f')});}var _0x322704={'payload':{'id':_0x2e4093['user']['id'],'role':_0x2e4093[_0x7c2c('0x26')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x322704)[_0x7c2c('0x2c')](function(_0x33b2be){_0xe55c39[_0x7c2c('0x50')](_0x7c2c('0x51'),_0x33b2be);_0xe55c39['redirect'](_0x7c2c('0x52'));})['catch'](function(_0x5235c0){return _0xe55c39[_0x7c2c('0x2d')](0x1f4)[_0x7c2c('0x53')](_0x5235c0);});};exports[_0x7c2c('0x54')]=function(_0x4c239b){if(_[_0x7c2c('0x55')](_0x4c239b[_0x7c2c('0x42')])||_['isNil'](_0x4c239b[_0x7c2c('0x56')])){return null;}else{return createJwt(_0x4c239b);}};exports['generateApiKey']=function(_0xf739a8){_0xf739a8[_0x7c2c('0x42')]=generateNonce();_0xf739a8['apiKeyIat']=generateIssuedAt();return createJwt(_0xf739a8);};exports['regenerateApiKey']=function(_0x41413a,_0x1c7c2b){var _0x578b7b=_0x41413a[_0x7c2c('0x3d')]['apikey'];if(_0x578b7b){var _0x51e3b7={'nonce':_0x1c7c2b[_0x7c2c('0x42')],'iat':_0x1c7c2b[_0x7c2c('0x56')],'audience':hardwareConf[_0x7c2c('0x3f')](),'issuer':hardwareConf[_0x7c2c('0x3f')]()};return verifyJwt(_0x578b7b,_0x51e3b7)[_0x7c2c('0x2c')](function(){return generateApiKey(_0x1c7c2b);});}else{throw{'message':_0x7c2c('0x57')};}};function signJwt(_0x2b0781){var _0x20f7d9=BPromise[_0x7c2c('0x58')](jwt['sign'],{'context':jwt});var _0x57eaf8=_0x2b0781[_0x7c2c('0x59')]||config[_0x7c2c('0x5a')][_0x7c2c('0x8')];return new BPromise(function(_0x4f95a1,_0x59bdc7){_0x20f7d9(_0x2b0781[_0x7c2c('0x5b')],_0x57eaf8,_0x2b0781[_0x7c2c('0x5c')])[_0x7c2c('0x2c')](function(_0x2b79d5){_0x4f95a1(_0x2b79d5);})['catch'](function(_0x4f958d){_0x59bdc7(_0x4f958d);});});}function verifyJwt(_0x587667,_0xd71ef8,_0x36184a){var _0x1d0140=BPromise[_0x7c2c('0x58')](jwt[_0x7c2c('0x5d')],{'context':jwt});var _0x563913=_0x36184a||config[_0x7c2c('0x5a')][_0x7c2c('0x8')];return new BPromise(function(_0x50663c,_0x19621a){_0x1d0140(_0x587667,_0x563913,_0xd71ef8)['then'](function(_0xfba6a7){_0x50663c(_0xfba6a7);})[_0x7c2c('0x30')](function(_0x3427fc){_0x19621a(_0x3427fc);});});}function generateNonce(){return crypto['randomBytes'](0x10)['toString'](_0x7c2c('0x5e'));}function generateIssuedAt(){return Math['floor'](Date[_0x7c2c('0x5f')]()/0x3e8)[_0x7c2c('0x60')]();}function createJwt(_0x5a8d98){var _0x101205={'payload':{'iat':_0x5a8d98[_0x7c2c('0x56')],'nonce':_0x5a8d98['apiKeyNonce']},'options':{'algorithm':_0x7c2c('0x61'),'subject':_0x5a8d98['id'][_0x7c2c('0x60')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0x7c2c('0x3f')]()}};return signJwt(_0x101205)[_0x7c2c('0x2c')](function(_0x2901a5){return{'iat':_0x5a8d98['apiKeyIat'],'nonce':_0x5a8d98[_0x7c2c('0x42')],'token':_0x2901a5};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index e718e3d..618183b 100644 --- a/server/components/encryptor/index.js +++ b/server/components/encryptor/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['unlink','crypto','bluebird','aes192','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','algorithm','data','update','end','final','binary','write','close','createDecipher'];(function(_0x726624,_0x21f598){var _0x14fb9f=function(_0x11b31a){while(--_0x11b31a){_0x726624['push'](_0x726624['shift']());}};_0x14fb9f(++_0x21f598);}(_0xe706,0xa3));var _0x6e70=function(_0x1f75a4,_0x220814){_0x1f75a4=_0x1f75a4-0x0;var _0x3e3309=_0xe706[_0x1f75a4];return _0x3e3309;};'use strict';var crypto=require(_0x6e70('0x0'));var fs=require('fs');var BPromise=require(_0x6e70('0x1'));var defaultOptions={'algorithm':_0x6e70('0x2')};function combineOptions(_0x5e8446){var _0x2cae77={};for(var _0x315629 in defaultOptions){if(defaultOptions[_0x6e70('0x3')](_0x315629)){_0x2cae77[_0x315629]=defaultOptions[_0x315629];}}if(_0x5e8446){for(var _0x7dfbc3 in _0x5e8446){if(_0x5e8446[_0x6e70('0x3')](_0x7dfbc3)){_0x2cae77[_0x7dfbc3]=_0x5e8446[_0x7dfbc3];}}}return _0x2cae77;}exports[_0x6e70('0x4')]=function(_0x376a8d,_0x506db9,_0x1b0389,_0x4381d1){return new BPromise(function(_0x36357b,_0x293ce7){_0x4381d1=combineOptions(_0x4381d1);var _0x45a2d4=new Buffer(_0x1b0389);var _0x188ed3=fs[_0x6e70('0x5')](_0x376a8d);var _0x449b48=fs[_0x6e70('0x6')](_0x506db9);var _0x25e61c=crypto[_0x6e70('0x7')](_0x4381d1[_0x6e70('0x8')],_0x45a2d4);_0x188ed3['on'](_0x6e70('0x9'),function(_0x3f474a){var _0x37b3e0=new Buffer(_0x25e61c[_0x6e70('0xa')](_0x3f474a),'binary');_0x449b48['write'](_0x37b3e0);});_0x188ed3['on'](_0x6e70('0xb'),function(){try{var _0x15a1a5=new Buffer(_0x25e61c[_0x6e70('0xc')](_0x6e70('0xd')),_0x6e70('0xd'));_0x449b48[_0x6e70('0xe')](_0x15a1a5);_0x449b48[_0x6e70('0xb')]();_0x449b48['on'](_0x6e70('0xf'),function(){return _0x36357b(_0x506db9);});}catch(_0x5dfbaa){fs['unlink'](_0x506db9);return _0x293ce7(_0x5dfbaa);}});});};exports['decryptFile']=function(_0x257e81,_0x5a37a6,_0x53aed0,_0x304716){return new BPromise(function(_0x22c50c,_0x5d9263){_0x304716=combineOptions(_0x304716);var _0x24f3ac=new Buffer(_0x53aed0);var _0x5c3fe7=fs[_0x6e70('0x5')](_0x257e81);var _0x161f23=fs['createWriteStream'](_0x5a37a6);var _0x49029f=crypto[_0x6e70('0x10')](_0x304716['algorithm'],_0x24f3ac);_0x5c3fe7['on'](_0x6e70('0x9'),function(_0x173afe){var _0x53acdc=new Buffer(_0x49029f['update'](_0x173afe),_0x6e70('0xd'));_0x161f23[_0x6e70('0xe')](_0x53acdc);});_0x5c3fe7['on'](_0x6e70('0xb'),function(){try{var _0x3a9978=new Buffer(_0x49029f[_0x6e70('0xc')](_0x6e70('0xd')),_0x6e70('0xd'));_0x161f23[_0x6e70('0xe')](_0x3a9978);_0x161f23[_0x6e70('0xb')]();_0x161f23['on'](_0x6e70('0xf'),function(){return _0x22c50c(_0x5a37a6);});}catch(_0x4a0cfe){fs[_0x6e70('0x11')](_0x5a37a6);return _0x5d9263(_0x4a0cfe);}});});}; \ No newline at end of file +var _0xd8b0=['data','binary','end','final','write','close','unlink','decryptFile','createReadStream','createDecipher','update','crypto','bluebird','hasOwnProperty','encryptFile','createWriteStream','createCipher','algorithm'];(function(_0x184b18,_0x36391d){var _0x13f527=function(_0x46d205){while(--_0x46d205){_0x184b18['push'](_0x184b18['shift']());}};_0x13f527(++_0x36391d);}(_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 diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 91df5d9..4e6bf5a 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 _0x5b02=['SELECT','length','num','push','dirname','.csv','existsSync','each','join','%s%d.%s','csv','writeFileSync','%s.%s','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','lodash','to-csv','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5b02,0xe9));var _0x25b0=function(_0x275e7f,_0x1fe23d){_0x275e7f=_0x275e7f-0x0;var _0x4fe1f3=_0x5b02[_0x275e7f];return _0x4fe1f3;};'use strict';var util=require(_0x25b0('0x0'));var path=require(_0x25b0('0x1'));var _=require(_0x25b0('0x2'));var csv=require(_0x25b0('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0x25b0('0x4'));var db=require('../../mysqldb')['db'];var dbH=require(_0x25b0('0x5'))[_0x25b0('0x6')];var logger=require(_0x25b0('0x7'))(_0x25b0('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x25b0('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x25b0('0x9')][0x4];function analyticExtractedReport(_0xd8276d,_0x49ef3a){var _0x412954={'status':_0xd8276d};var _0x4d3e71={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x49ef3a){_0x412954['savename']=_0x49ef3a;}return db[_0x25b0('0xa')][_0x25b0('0xb')](_0x412954,_0x4d3e71);}function main(){var _0x358af0=0x1388;var _0x575918;logger[_0x25b0('0xc')](util[_0x25b0('0xd')](_0x25b0('0xe'),EXTRACTED_REPORT_ID,_0x25b0('0xf')));return db[_0x25b0('0x10')][_0x25b0('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x25b0('0x12'),_0x25b0('0x13')]})[_0x25b0('0x14')](function(_0x1d3178){if(_0x1d3178){_0x575918=_0x1d3178;_0x358af0=_0x575918[_0x25b0('0x13')]||0x1388;}})[_0x25b0('0x14')](function(){return dbH[_0x25b0('0x15')][_0x25b0('0x16')](util[_0x25b0('0xd')](_0x25b0('0x17'),QUERY),{'type':dbH[_0x25b0('0x15')][_0x25b0('0x18')][_0x25b0('0x19')]});})[_0x25b0('0x14')](function(_0x40071c){if(!_0x40071c[0x0]['num']){return analyticExtractedReport('Empty');}var _0xfe1ea6=[];var _0x4b2357=0x0;var _0xa8280a=!![];if(_0x40071c&&_0x40071c[_0x25b0('0x1a')]){var _0x1c67a8=_0x40071c[0x0][_0x25b0('0x1b')]%(_0x4b2357+_0x358af0);if(_0x575918['split']){for(;_0xa8280a;_0x4b2357+=_0x358af0,_0x1c67a8=_0x40071c[0x0][_0x25b0('0x1b')]%(_0x4b2357+_0x358af0)){if(_0x1c67a8==0x0||_0x1c67a8==_0x40071c[0x0][_0x25b0('0x1b')]){_0xa8280a=![];}_0xfe1ea6[_0x25b0('0x1c')](dbH[_0x25b0('0x15')][_0x25b0('0x16')](util[_0x25b0('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x358af0,_0x4b2357),{'type':dbH[_0x25b0('0x15')][_0x25b0('0x18')][_0x25b0('0x19')]}));}}else{_0xfe1ea6[_0x25b0('0x1c')](dbH[_0x25b0('0x15')][_0x25b0('0x16')](QUERY,{'type':dbH[_0x25b0('0x15')][_0x25b0('0x18')][_0x25b0('0x19')]}));}}var _0x35939f=path[_0x25b0('0x1d')](PATH);var _0x3ce1da=path['basename'](PATH,_0x25b0('0x1e'));var _0x16623c=_0x575918['split']&&_0xfe1ea6[_0x25b0('0x1a')]>0x1;var _0x2023d8=[];if(!fs[_0x25b0('0x1f')](path['join'](_0x35939f,_0x3ce1da))&&_0x16623c){fs['mkdirSync'](path['join'](_0x35939f,_0x3ce1da));}return BPromise[_0x25b0('0x20')](_0xfe1ea6,function(_0x433085){_0x2023d8[_0x25b0('0x1c')](_0x433085);})[_0x25b0('0x14')](function(){for(var _0xdbb459=0x0;_0xdbb459<_0x2023d8[_0x25b0('0x1a')];_0xdbb459+=0x1){var _0x40268a;var _0x75ce7a=_0x2023d8[_0xdbb459];if(_0x16623c){_0x40268a=path[_0x25b0('0x21')](_0x35939f,_0x3ce1da,util['format'](_0x25b0('0x22'),_0x3ce1da,_0xdbb459,_0x25b0('0x23')));}else{_0x40268a=path['join'](_0x35939f,util['format']('%s.%s',_0x3ce1da,_0x25b0('0x23')));}fs[_0x25b0('0x24')](_0x40268a,csv(_0x75ce7a));}})[_0x25b0('0x14')](function(){if(_0x16623c){zipdir(path[_0x25b0('0x21')](_0x35939f,_0x3ce1da),{'saveTo':path[_0x25b0('0x21')](_0x35939f,util[_0x25b0('0xd')](_0x25b0('0x25'),_0x3ce1da,_0x25b0('0x26')))},function(_0x36b81d,_0x285a2b){});rimraf(path[_0x25b0('0x21')](_0x35939f,_0x3ce1da),function(){});}})[_0x25b0('0x14')](function(){logger[_0x25b0('0xc')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x25b0('0xf')));return analyticExtractedReport('Completed',_0x16623c?util['format'](_0x25b0('0x25'),_0x3ce1da,_0x16623c?_0x25b0('0x26'):_0x25b0('0x23')):null);});})[_0x25b0('0x27')](function(_0xb68653){logger['info'](util[_0x25b0('0xd')](_0x25b0('0x28'),EXTRACTED_REPORT_ID,'CSV'),util[_0x25b0('0x29')](_0xb68653,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x25b0('0x2a'));});}main(); \ No newline at end of file +var _0xee5b=['rimraf','../../mysqldb','analytics','argv','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','Empty','length','num','push','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','basename','.csv','existsSync','join','csv','%s.%s','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','lodash','to-csv','zip-dir'];(function(_0x45b1ad,_0x215b03){var _0x3d5696=function(_0x4d9e73){while(--_0x4d9e73){_0x45b1ad['push'](_0x45b1ad['shift']());}};_0x3d5696(++_0x215b03);}(_0xee5b,0x1f4));var _0xbee5=function(_0x3165be,_0x5f11ca){_0x3165be=_0x3165be-0x0;var _0x3b8150=_0xee5b[_0x3165be];return _0x3b8150;};'use strict';var util=require(_0xbee5('0x0'));var path=require('path');var _=require(_0xbee5('0x1'));var csv=require(_0xbee5('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xbee5('0x3'));var rimraf=require(_0xbee5('0x4'));var db=require(_0xbee5('0x5'))['db'];var dbH=require(_0xbee5('0x5'))['dbH'];var logger=require('../../config/logger')(_0xbee5('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0xbee5('0x7')][0x2]);var QUERY=process[_0xbee5('0x7')][0x3];var PATH=process[_0xbee5('0x7')][0x4];function analyticExtractedReport(_0x4f5065,_0x5505e3){var _0x53d5b9={'status':_0x4f5065};var _0x5baf5c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5505e3){_0x53d5b9['savename']=_0x5505e3;}return db[_0xbee5('0x8')][_0xbee5('0x9')](_0x53d5b9,_0x5baf5c);}function main(){var _0x45c2c7=0x1388;var _0x20f717;logger['info'](util[_0xbee5('0xa')](_0xbee5('0xb'),EXTRACTED_REPORT_ID,_0xbee5('0xc')));return db[_0xbee5('0xd')][_0xbee5('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbee5('0xf'),_0xbee5('0x10')]})[_0xbee5('0x11')](function(_0xcef158){if(_0xcef158){_0x20f717=_0xcef158;_0x45c2c7=_0x20f717['splitSizeCsv']||0x1388;}})[_0xbee5('0x11')](function(){return dbH['sequelize'][_0xbee5('0x12')](util[_0xbee5('0xa')](_0xbee5('0x13'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0xbee5('0x14')]});})['then'](function(_0x40afcb){if(!_0x40afcb[0x0]['num']){return analyticExtractedReport(_0xbee5('0x15'));}var _0x141878=[];var _0xf676b1=0x0;var _0x53b269=!![];if(_0x40afcb&&_0x40afcb[_0xbee5('0x16')]){var _0x662d2c=_0x40afcb[0x0]['num']%(_0xf676b1+_0x45c2c7);if(_0x20f717[_0xbee5('0xf')]){for(;_0x53b269;_0xf676b1+=_0x45c2c7,_0x662d2c=_0x40afcb[0x0][_0xbee5('0x17')]%(_0xf676b1+_0x45c2c7)){if(_0x662d2c==0x0||_0x662d2c==_0x40afcb[0x0][_0xbee5('0x17')]){_0x53b269=![];}_0x141878[_0xbee5('0x18')](dbH[_0xbee5('0x19')][_0xbee5('0x12')](util[_0xbee5('0xa')](_0xbee5('0x1a'),QUERY,_0x45c2c7,_0xf676b1),{'type':dbH[_0xbee5('0x19')][_0xbee5('0x1b')][_0xbee5('0x14')]}));}}else{_0x141878[_0xbee5('0x18')](dbH[_0xbee5('0x19')][_0xbee5('0x12')](QUERY,{'type':dbH[_0xbee5('0x19')]['QueryTypes']['SELECT']}));}}var _0x469a7a=path['dirname'](PATH);var _0x205491=path[_0xbee5('0x1c')](PATH,_0xbee5('0x1d'));var _0x2bfb0f=_0x20f717[_0xbee5('0xf')]&&_0x141878[_0xbee5('0x16')]>0x1;var _0x359ccf=[];if(!fs[_0xbee5('0x1e')](path[_0xbee5('0x1f')](_0x469a7a,_0x205491))&&_0x2bfb0f){fs['mkdirSync'](path['join'](_0x469a7a,_0x205491));}return BPromise['each'](_0x141878,function(_0x519473){_0x359ccf['push'](_0x519473);})[_0xbee5('0x11')](function(){for(var _0x18d7f4=0x0;_0x18d7f4<_0x359ccf[_0xbee5('0x16')];_0x18d7f4+=0x1){var _0x28c74d;var _0x169042=_0x359ccf[_0x18d7f4];if(_0x2bfb0f){_0x28c74d=path[_0xbee5('0x1f')](_0x469a7a,_0x205491,util[_0xbee5('0xa')]('%s%d.%s',_0x205491,_0x18d7f4,_0xbee5('0x20')));}else{_0x28c74d=path[_0xbee5('0x1f')](_0x469a7a,util[_0xbee5('0xa')](_0xbee5('0x21'),_0x205491,_0xbee5('0x20')));}fs['writeFileSync'](_0x28c74d,csv(_0x169042));}})[_0xbee5('0x11')](function(){if(_0x2bfb0f){zipdir(path[_0xbee5('0x1f')](_0x469a7a,_0x205491),{'saveTo':path[_0xbee5('0x1f')](_0x469a7a,util[_0xbee5('0xa')](_0xbee5('0x21'),_0x205491,_0xbee5('0x22')))},function(_0x34b7df,_0x36e8bb){});rimraf(path[_0xbee5('0x1f')](_0x469a7a,_0x205491),function(){});}})['then'](function(){logger[_0xbee5('0x23')](util['format'](_0xbee5('0x24'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xbee5('0x25'),_0x2bfb0f?util['format'](_0xbee5('0x21'),_0x205491,_0x2bfb0f?'zip':_0xbee5('0x20')):null);});})[_0xbee5('0x26')](function(_0x36eb70){logger[_0xbee5('0x23')](util['format'](_0xbee5('0x27'),EXTRACTED_REPORT_ID,_0xbee5('0xc')),util[_0xbee5('0x28')](_0x36eb70,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbee5('0x29'));});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 03efceb..0c6d5b9 100644 --- a/server/components/export/pdf.js +++ b/server/components/export/pdf.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','SELECT','existsSync','join','mkdirSync','each','name','startDate','endDate','landscape','black','body','content','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','pdf','%s.%s','pipe','createWriteStream','finish','log','err','end','zip','info','Completed','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','lodash','util','path','moment','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','then','splitSizePdf','length','sequelize'];(function(_0x49753b,_0x55f4b4){var _0x2025cf=function(_0x31a908){while(--_0x31a908){_0x49753b['push'](_0x49753b['shift']());}};_0x2025cf(++_0x55f4b4);}(_0xb10b,0x12a));var _0xbb10=function(_0x2aaeac,_0x30bda5){_0x2aaeac=_0x2aaeac-0x0;var _0x757741=_0xb10b[_0x2aaeac];return _0x757741;};'use strict';var _=require(_0xbb10('0x0'));var fs=require('fs');var BPromise=require('bluebird');var util=require(_0xbb10('0x1'));var path=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xbb10('0x4'));var rimraf=require(_0xbb10('0x5'));var db=require(_0xbb10('0x6'))['db'];var dbH=require(_0xbb10('0x6'))[_0xbb10('0x7')];var logger=require(_0xbb10('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xbb10('0x9')][0x2]);var QUERY=process[_0xbb10('0x9')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xbb10('0x9')][0x5];var FORMAT=_0xbb10('0xa');var _extractedReport;function analyticExtractedReport(_0x21370f,_0x1c3ee5){var _0x2353ef={'status':_0x21370f};var _0x1ce33e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c3ee5){_0x2353ef[_0xbb10('0xb')]=_0x1c3ee5;}return db[_0xbb10('0xc')]['update'](_0x2353ef,_0x1ce33e);}function getHeader(_0x4e47f8){var _0x20bd61=[];for(var _0x118a74 in _0x4e47f8){if(_0x4e47f8[_0xbb10('0xd')](_0x118a74)){_0x20bd61['push']({'text':_0x118a74,'style':_0xbb10('0xe')});}}return _0x20bd61;}function extractReport(_0x5be7e0){var _0x44fb19=0x1388;var _0x916a32;if(!_0x5be7e0[0x0][_0xbb10('0xf')]){return analyticExtractedReport(_0xbb10('0x10'));}var _0x442548=[];var _0x147230=0x0;var _0x58a612=!![];var _0x26e021=path[_0xbb10('0x11')](PATH);var _0x45b9d6=path[_0xbb10('0x12')](PATH,_0xbb10('0x13'));var _0x2f2ebf=![];var _0x24a57b=[];return db[_0xbb10('0x14')][_0xbb10('0x15')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbb10('0x16'),'splitSizePdf']})[_0xbb10('0x17')](function(_0x1145f1){if(_0x1145f1){_0x916a32=_0x1145f1;_0x44fb19=_0x916a32[_0xbb10('0x18')]||0x3e8;}})[_0xbb10('0x17')](function(){if(_0x5be7e0&&_0x5be7e0[_0xbb10('0x19')]){var _0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19);if(_0x916a32[_0xbb10('0x16')]){for(;_0x58a612;_0x147230+=_0x44fb19,_0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19)){if(_0x1682a4==0x0||_0x1682a4==_0x5be7e0[0x0][_0xbb10('0xf')]){_0x58a612=![];}_0x442548['push'](dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util[_0xbb10('0x1c')](_0xbb10('0x1d'),QUERY,_0x44fb19,_0x147230),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')]['SELECT']}));}}else{_0x442548[_0xbb10('0x1f')](dbH[_0xbb10('0x1a')]['query'](QUERY,{'type':dbH['sequelize'][_0xbb10('0x1e')][_0xbb10('0x20')]}));}}_0x2f2ebf=_0x916a32[_0xbb10('0x16')]&&_0x442548[_0xbb10('0x19')]>0x1;if(!fs[_0xbb10('0x21')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6))&&_0x2f2ebf){fs[_0xbb10('0x23')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6));}return BPromise[_0xbb10('0x24')](_0x442548,function(_0x395404){_0x24a57b[_0xbb10('0x1f')](_0x395404);});})[_0xbb10('0x17')](function(){return BPromise['each'](_0x442548,function(_0x4fedac,_0x4fb5e0){var _0xc93a04;var _0x3c5ae7=util[_0xbb10('0x1c')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,_extractedReport[_0xbb10('0x25')],moment(_extractedReport[_0xbb10('0x26')])[_0xbb10('0x1c')](FORMAT),moment(_extractedReport[_0xbb10('0x27')])[_0xbb10('0x1c')](FORMAT));var _0x20d946={'pageSize':'A4','pageOrientation':_0xbb10('0x28'),'content':[{'text':_0x3c5ae7,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xbb10('0x29')}}};var _0x21ac54={'headerRows':0x1,'body':[]};_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](getHeader(_0x4fedac[0x0]));var _0x1d30aa;for(var _0x2ff4c1=0x0;_0x2ff4c1<_0x4fedac['length'];_0x2ff4c1+=0x1){_0x1d30aa=[];for(var _0x221624 in _0x4fedac[_0x2ff4c1]){if(_0x4fedac[_0x2ff4c1]['hasOwnProperty'](_0x221624)){_0x1d30aa[_0xbb10('0x1f')](_0x4fedac[_0x2ff4c1][_0x221624]?_['toString'](_0x4fedac[_0x2ff4c1][_0x221624]):'');}}_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](_0x1d30aa);}_0x20d946[_0xbb10('0x2b')]['push']({'table':_0x21ac54});return new BPromise(function(_0x518d47,_0x4c3744){var _0x34f65e=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0xbb10('0x2c'),'italics':__dirname+_0xbb10('0x2d'),'bolditalics':__dirname+_0xbb10('0x2e')}});var _0x1c0b57=_0x34f65e[_0xbb10('0x2f')](_0x20d946);if(_0x2f2ebf){_0xc93a04=path[_0xbb10('0x22')](_0x26e021,_0x45b9d6,util[_0xbb10('0x1c')]('%s%d.%s',_0x45b9d6,_0x4fb5e0,_0xbb10('0x30')));}else{_0xc93a04=path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x30')));}var _0x9de708=_0x1c0b57[_0xbb10('0x32')](fs[_0xbb10('0x33')](_0xc93a04));_0x9de708['on'](_0xbb10('0x34'),function(){_0x518d47();});_0x9de708['on']('error',function(_0x2b5352){console[_0xbb10('0x35')](_0xbb10('0x36'),_0x2b5352);_0x4c3744(_0x2b5352);});_0x1c0b57[_0xbb10('0x37')]();});});})['then'](function(){if(_0x2f2ebf){return new BPromise(function(_0x111762,_0x5de37b){zipdir(path['join'](_0x26e021,_0x45b9d6),{'saveTo':path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x38')))},function(_0x15d895){if(_0x15d895){_0x5de37b(_0x15d895);}else{_0x111762();}});});}})[_0xbb10('0x17')](function(){if(_0x2f2ebf){rimraf(path['join'](_0x26e021,_0x45b9d6),function(){});}})[_0xbb10('0x17')](function(){logger[_0xbb10('0x39')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xbb10('0x3a'),_0x2f2ebf?util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0x2f2ebf?'zip':_0xbb10('0x30')):null);});}function main(){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xbb10('0x3b')));return db[_0xbb10('0xc')][_0xbb10('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xbb10('0x17')](function(_0x4f1cdd){_extractedReport=_0x4f1cdd;return dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util['format'](_0xbb10('0x3d'),QUERY),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')][_0xbb10('0x20')]});})[_0xbb10('0x17')](extractReport)[_0xbb10('0x3e')](function(_0x5f3d67){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')](_0xbb10('0x3f'),EXTRACTED_REPORT_ID,_0xbb10('0x3b')),util['inspect'](_0x5f3d67,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbb10('0x40'));});}main(); \ No newline at end of file +var _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(_0x55c3d7,_0x869445){var _0x6a357b=function(_0x2d4961){while(--_0x2d4961){_0x55c3d7['push'](_0x55c3d7['shift']());}};_0x6a357b(++_0x869445);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'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 diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index ed442ac..457dfba 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 _0x598a=['zip-dir','../../mysqldb','../../config/logger','argv','savename','AnalyticExtractedReport','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','split','splitSizeXlsx','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','then','num','Empty','length','push','SELECT','QueryTypes','basename','.xlsx','existsSync','join','xlsx','%s.%s','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','util','path','lodash','json2xls','bluebird'];(function(_0x4285d0,_0x3b41e7){var _0x5bfa9c=function(_0x2f6b28){while(--_0x2f6b28){_0x4285d0['push'](_0x4285d0['shift']());}};_0x5bfa9c(++_0x3b41e7);}(_0x598a,0x1c9));var _0xa598=function(_0x28c06a,_0x37f542){_0x28c06a=_0x28c06a-0x0;var _0x4a7c5c=_0x598a[_0x28c06a];return _0x4a7c5c;};'use strict';var util=require(_0xa598('0x0'));var path=require(_0xa598('0x1'));var _=require(_0xa598('0x2'));var fs=require('fs');var json2xls=require(_0xa598('0x3'));var BPromise=require(_0xa598('0x4'));var zipdir=require(_0xa598('0x5'));var rimraf=require('rimraf');var db=require(_0xa598('0x6'))['db'];var dbH=require(_0xa598('0x6'))['dbH'];var logger=require(_0xa598('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xa598('0x8')][0x2]);var QUERY=process[_0xa598('0x8')][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0x16e4a7,_0x35aa05){var _0x3ba3e7={'status':_0x16e4a7};var _0x1462cc={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x35aa05){_0x3ba3e7[_0xa598('0x9')]=_0x35aa05;}return db[_0xa598('0xa')]['update'](_0x3ba3e7,_0x1462cc);}function main(){var _0x126e55=0x1388;var _0x21b817;logger[_0xa598('0xb')](util['format'](_0xa598('0xc'),EXTRACTED_REPORT_ID,_0xa598('0xd')));return db[_0xa598('0xe')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa598('0xf'),'splitSizeXlsx']})['then'](function(_0x206e39){if(_0x206e39){_0x21b817=_0x206e39;_0x126e55=_0x21b817[_0xa598('0x10')]||0x1388;}})['then'](function(){return dbH[_0xa598('0x11')][_0xa598('0x12')](util[_0xa598('0x13')](_0xa598('0x14'),QUERY),{'type':dbH[_0xa598('0x11')]['QueryTypes']['SELECT']});})[_0xa598('0x15')](function(_0x58be3b){if(!_0x58be3b[0x0][_0xa598('0x16')]){return analyticExtractedReport(_0xa598('0x17'));}var _0x36e4d1=[];var _0x76368b=0x0;var _0x5f27f2=!![];if(_0x21b817[_0xa598('0xf')]){if(_0x58be3b&&_0x58be3b[_0xa598('0x18')]){var _0x455d02=_0x58be3b[0x0][_0xa598('0x16')]%(_0x76368b+_0x126e55);for(;_0x5f27f2;_0x76368b+=_0x126e55,_0x455d02=_0x58be3b[0x0]['num']%(_0x76368b+_0x126e55)){if(_0x455d02==0x0||_0x455d02==_0x58be3b[0x0]['num']){_0x5f27f2=![];}_0x36e4d1[_0xa598('0x19')](dbH[_0xa598('0x11')][_0xa598('0x12')](util[_0xa598('0x13')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x126e55,_0x76368b),{'type':dbH['sequelize']['QueryTypes'][_0xa598('0x1a')]}));}}}else{_0x36e4d1[_0xa598('0x19')](dbH[_0xa598('0x11')][_0xa598('0x12')](QUERY,{'type':dbH[_0xa598('0x11')][_0xa598('0x1b')][_0xa598('0x1a')]}));}var _0x23f731=path['dirname'](PATH);var _0x3ed0d8=path[_0xa598('0x1c')](PATH,_0xa598('0x1d'));var _0x138aa4=_0x21b817[_0xa598('0xf')]&&_0x36e4d1['length']>0x1;var _0x1a70fb=[];if(!fs[_0xa598('0x1e')](path['join'](_0x23f731,_0x3ed0d8))&&_0x138aa4){fs['mkdirSync'](path['join'](_0x23f731,_0x3ed0d8));}return BPromise['each'](_0x36e4d1,function(_0x31be8f){_0x1a70fb[_0xa598('0x19')](_0x31be8f);})[_0xa598('0x15')](function(){for(var _0x254792=0x0;_0x254792<_0x1a70fb[_0xa598('0x18')];_0x254792+=0x1){var _0x130fcd;var _0x15d26b=_0x1a70fb[_0x254792];if(_0x138aa4){_0x130fcd=path[_0xa598('0x1f')](_0x23f731,_0x3ed0d8,util['format']('%s%d.%s',_0x3ed0d8,_0x254792,_0xa598('0x20')));}else{_0x130fcd=path['join'](_0x23f731,util[_0xa598('0x13')](_0xa598('0x21'),_0x3ed0d8,_0xa598('0x20')));}fs[_0xa598('0x22')](_0x130fcd,json2xls(_0x15d26b),_0xa598('0x23'));}})[_0xa598('0x15')](function(){if(_0x138aa4){zipdir(path[_0xa598('0x1f')](_0x23f731,_0x3ed0d8),{'saveTo':path[_0xa598('0x1f')](_0x23f731,util['format'](_0xa598('0x21'),_0x3ed0d8,_0xa598('0x24')))},function(_0x1963ad,_0x124123){});rimraf(path['join'](_0x23f731,_0x3ed0d8),function(){});}})[_0xa598('0x15')](function(){logger['info'](util[_0xa598('0x13')](_0xa598('0x25'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0xa598('0x26'),_0x138aa4?util[_0xa598('0x13')]('%s.%s',_0x3ed0d8,_0x138aa4?_0xa598('0x24'):'xlsx'):null);});})[_0xa598('0x27')](function(_0x41ffaf){logger['info'](util[_0xa598('0x13')](_0xa598('0x28'),EXTRACTED_REPORT_ID,_0xa598('0xd')),util['inspect'](_0x41ffaf,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xa598('0x29'));});}main(); \ No newline at end of file +var _0xbdde=['savename','AnalyticExtractedReport','update','info','format','XLSX','Setting','find','split','splitSizeXlsx','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','num','Empty','length','%s\x20limit\x20%d\x20OFFSET\x20%d','push','QueryTypes','SELECT','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','%s.%s','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','xlsx','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','bluebird','rimraf','../../mysqldb','../../config/logger','analytics','argv'];(function(_0x4a660a,_0x29426a){var _0x7c11ae=function(_0xe68e47){while(--_0xe68e47){_0x4a660a['push'](_0x4a660a['shift']());}};_0x7c11ae(++_0x29426a);}(_0xbdde,0x12e));var _0xebdd=function(_0x1ebb10,_0x156b3e){_0x1ebb10=_0x1ebb10-0x0;var _0x20d709=_0xbdde[_0x1ebb10];return _0x20d709;};'use strict';var util=require('util');var path=require('path');var _=require('lodash');var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0xebdd('0x0'));var zipdir=require('zip-dir');var rimraf=require(_0xebdd('0x1'));var db=require(_0xebdd('0x2'))['db'];var dbH=require(_0xebdd('0x2'))['dbH'];var logger=require(_0xebdd('0x3'))(_0xebdd('0x4'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xebdd('0x5')][0x3];var PATH=process[_0xebdd('0x5')][0x4];function analyticExtractedReport(_0x23ae90,_0x4f7f1a){var _0x654a82={'status':_0x23ae90};var _0x534021={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4f7f1a){_0x654a82[_0xebdd('0x6')]=_0x4f7f1a;}return db[_0xebdd('0x7')][_0xebdd('0x8')](_0x654a82,_0x534021);}function main(){var _0x341ca5=0x1388;var _0x5e1cbf;logger[_0xebdd('0x9')](util[_0xebdd('0xa')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xebdd('0xb')));return db[_0xebdd('0xc')][_0xebdd('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xebdd('0xe'),_0xebdd('0xf')]})['then'](function(_0x7e35ac){if(_0x7e35ac){_0x5e1cbf=_0x7e35ac;_0x341ca5=_0x5e1cbf[_0xebdd('0xf')]||0x1388;}})[_0xebdd('0x10')](function(){return dbH['sequelize'][_0xebdd('0x11')](util['format'](_0xebdd('0x12'),QUERY),{'type':dbH[_0xebdd('0x13')]['QueryTypes']['SELECT']});})['then'](function(_0x1bc740){if(!_0x1bc740[0x0][_0xebdd('0x14')]){return analyticExtractedReport(_0xebdd('0x15'));}var _0x747cb5=[];var _0x40bd6e=0x0;var _0x53ce12=!![];if(_0x5e1cbf['split']){if(_0x1bc740&&_0x1bc740[_0xebdd('0x16')]){var _0x37b220=_0x1bc740[0x0]['num']%(_0x40bd6e+_0x341ca5);for(;_0x53ce12;_0x40bd6e+=_0x341ca5,_0x37b220=_0x1bc740[0x0][_0xebdd('0x14')]%(_0x40bd6e+_0x341ca5)){if(_0x37b220==0x0||_0x37b220==_0x1bc740[0x0][_0xebdd('0x14')]){_0x53ce12=![];}_0x747cb5['push'](dbH[_0xebdd('0x13')][_0xebdd('0x11')](util[_0xebdd('0xa')](_0xebdd('0x17'),QUERY,_0x341ca5,_0x40bd6e),{'type':dbH[_0xebdd('0x13')]['QueryTypes']['SELECT']}));}}}else{_0x747cb5[_0xebdd('0x18')](dbH[_0xebdd('0x13')]['query'](QUERY,{'type':dbH[_0xebdd('0x13')][_0xebdd('0x19')][_0xebdd('0x1a')]}));}var _0xc6edab=path[_0xebdd('0x1b')](PATH);var _0x295d51=path[_0xebdd('0x1c')](PATH,_0xebdd('0x1d'));var _0x35b898=_0x5e1cbf[_0xebdd('0xe')]&&_0x747cb5[_0xebdd('0x16')]>0x1;var _0x4ac289=[];if(!fs[_0xebdd('0x1e')](path[_0xebdd('0x1f')](_0xc6edab,_0x295d51))&&_0x35b898){fs[_0xebdd('0x20')](path['join'](_0xc6edab,_0x295d51));}return BPromise[_0xebdd('0x21')](_0x747cb5,function(_0x33d18c){_0x4ac289[_0xebdd('0x18')](_0x33d18c);})['then'](function(){for(var _0x3b3fcd=0x0;_0x3b3fcd<_0x4ac289[_0xebdd('0x16')];_0x3b3fcd+=0x1){var _0x26045f;var _0x32c075=_0x4ac289[_0x3b3fcd];if(_0x35b898){_0x26045f=path[_0xebdd('0x1f')](_0xc6edab,_0x295d51,util['format'](_0xebdd('0x22'),_0x295d51,_0x3b3fcd,'xlsx'));}else{_0x26045f=path[_0xebdd('0x1f')](_0xc6edab,util[_0xebdd('0xa')](_0xebdd('0x23'),_0x295d51,'xlsx'));}fs['writeFileSync'](_0x26045f,json2xls(_0x32c075),_0xebdd('0x24'));}})['then'](function(){if(_0x35b898){zipdir(path['join'](_0xc6edab,_0x295d51),{'saveTo':path['join'](_0xc6edab,util[_0xebdd('0xa')](_0xebdd('0x23'),_0x295d51,_0xebdd('0x25')))},function(_0x785744,_0x246a4c){});rimraf(path[_0xebdd('0x1f')](_0xc6edab,_0x295d51),function(){});}})['then'](function(){logger['info'](util['format'](_0xebdd('0x26'),EXTRACTED_REPORT_ID,_0xebdd('0xb')));return analyticExtractedReport('Completed',_0x35b898?util[_0xebdd('0xa')](_0xebdd('0x23'),_0x295d51,_0x35b898?'zip':_0xebdd('0x27')):null);});})[_0xebdd('0x28')](function(_0x290cf2){logger[_0xebdd('0x9')](util[_0xebdd('0xa')](_0xebdd('0x29'),EXTRACTED_REPORT_ID,_0xebdd('0xb')),util[_0xebdd('0x2a')](_0x290cf2,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xebdd('0x2b'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 8c2ee7b..7d0f6fe 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 _0x7990=['updatedAt','interval','*,*,*,*','IntervalId','tag','CDR(tag)=','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','app','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','GotoIfTime',',${EXTEN},','last','concat','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','findAll','intervals','VoiceExtension','then','uniq','map','exten','filter','groupBy','queue','playback','extensions','find','push','type','Set','format','CDR(type)=%s','VoiceExtensionId','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','context','priority','CDR(routeid)=','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','extension','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt'];(function(_0x166554,_0x275afa){var _0x1f1e10=function(_0x1544c0){while(--_0x1544c0){_0x166554['push'](_0x166554['shift']());}};_0x1f1e10(++_0x275afa);}(_0x7990,0xe3));var _0x0799=function(_0x1b4daf,_0x313f68){_0x1b4daf=_0x1b4daf-0x0;var _0x26cd7f=_0x7990[_0x1b4daf];return _0x26cd7f;};'use strict';var _=require(_0x0799('0x0'));var util=require(_0x0799('0x1'));function rewrite(_0x3b9cf1,_0x205841){var _0x1386cf=this;return _0x3b9cf1[_0x0799('0x2')]['Interval'][_0x0799('0x3')]({'raw':!![]})['then'](function(_0x14005c){_0x1386cf[_0x0799('0x4')]=_0x14005c;return _0x3b9cf1['models'][_0x0799('0x5')][_0x0799('0x3')]({'where':{'IntervalId':_0x205841['IntervalId']},'raw':!![]});})[_0x0799('0x6')](function(_0x32ce07){return _0x3b9cf1['models'][_0x0799('0x5')][_0x0799('0x3')]({'where':{'exten':{'$in':_[_0x0799('0x7')](_[_0x0799('0x8')](_0x32ce07,_0x0799('0x9')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x0799('0x6')](function(_0x1d98cd){var _0x329685=_['filter'](_0x1d98cd,{'priority':'1'});var _0x82cf61=_[_0x0799('0xa')](_0x1d98cd,{'isApp':0x1});var _0x3b394c=_[_0x0799('0xb')](_0x82cf61,_0x0799('0x9'));var _0x4a6383=[_0x0799('0xc'),_0x0799('0xd')];var _0x489de0=[];var _0x4b91de=[];for(var _0x54de53 in _0x3b394c){if(_0x3b394c['hasOwnProperty'](_0x54de53)){_0x1386cf['priority']=0x2;_0x1386cf[_0x0799('0xe')]=[];_0x1386cf['extension']=_[_0x0799('0xf')](_0x329685,{'exten':_0x3b394c[_0x54de53][0x0][_0x0799('0x9')]});_0x1386cf['extensions'][_0x0799('0x10')]({'type':_0x3b394c[_0x54de53][0x0][_0x0799('0x11')],'app':_0x0799('0x12'),'appdata':util[_0x0799('0x13')](_0x0799('0x14'),_0x3b394c[_0x54de53][0x0][_0x0799('0x11')]),'context':_0x3b394c[_0x54de53][0x0]['context'],'exten':_0x3b394c[_0x54de53][0x0][_0x0799('0x9')],'priority':_0x1386cf['priority']++,'VoiceExtensionId':_0x3b394c[_0x54de53][0x0][_0x0799('0x15')]});if(_0x3b394c[_0x54de53][0x0][_0x0799('0x11')]===_0x0799('0x16')){if(_0x1386cf['extension']){_0x1386cf[_0x0799('0xe')][_0x0799('0x10')]({'type':_0x3b394c[_0x54de53][0x0][_0x0799('0x11')],'app':'Set','appdata':_0x0799('0x17')+(_0x1386cf['extension'][_0x0799('0x18')]?_0x0799('0x19')+_0x1386cf['extension'][_0x0799('0x18')]+'}':_0x0799('0x1a')),'context':_0x3b394c[_0x54de53][0x0][_0x0799('0x1b')],'exten':_0x3b394c[_0x54de53][0x0][_0x0799('0x9')],'priority':_0x1386cf[_0x0799('0x1c')]++,'VoiceExtensionId':_0x3b394c[_0x54de53][0x0][_0x0799('0x15')]});}_0x1386cf[_0x0799('0xe')]['push']({'type':_0x3b394c[_0x54de53][0x0][_0x0799('0x11')],'app':_0x0799('0x12'),'appdata':_0x0799('0x1d')+_0x3b394c[_0x54de53][0x0][_0x0799('0x15')],'context':_0x3b394c[_0x54de53][0x0][_0x0799('0x1b')],'exten':_0x3b394c[_0x54de53][0x0][_0x0799('0x9')],'priority':_0x1386cf['priority']++,'VoiceExtensionId':_0x3b394c[_0x54de53][0x0][_0x0799('0x15')]});var _0x3b03a9=_0x1386cf[_0x0799('0x1c')]++;_0x1386cf[_0x0799('0xe')][_0x0799('0x10')]({'type':_0x3b394c[_0x54de53][0x0][_0x0799('0x11')],'app':'ExecIf','appdata':_0x0799('0x1e')+(_0x3b03a9+0x2)+_0x0799('0x1f')+(_0x3b03a9+0x1)+')','context':_0x3b394c[_0x54de53][0x0]['context'],'exten':_0x3b394c[_0x54de53][0x0][_0x0799('0x9')],'priority':_0x3b03a9,'VoiceExtensionId':_0x3b394c[_0x54de53][0x0][_0x0799('0x15')]});if(_0x1386cf['extension']){_0x1386cf[_0x0799('0xe')]['push']({'type':_0x3b394c[_0x54de53][0x0]['type'],'app':_0x0799('0x12'),'appdata':_0x1386cf['extension'][_0x0799('0x18')]?_0x0799('0x20')+_0x1386cf['extension'][_0x0799('0x18')]+'}':_0x0799('0x21'),'context':_0x3b394c[_0x54de53][0x0]['context'],'exten':_0x3b394c[_0x54de53][0x0][_0x0799('0x9')],'priority':_0x1386cf[_0x0799('0x1c')]++,'VoiceExtensionId':_0x3b394c[_0x54de53][0x0]['VoiceExtensionId']});}_0x1386cf['extensions']['push']({'type':_0x3b394c[_0x54de53][0x0][_0x0799('0x11')],'app':_0x0799('0x12'),'appdata':'outboundrouteid='+_0x3b394c[_0x54de53][0x0][_0x0799('0x15')],'context':_0x3b394c[_0x54de53][0x0][_0x0799('0x1b')],'exten':_0x3b394c[_0x54de53][0x0][_0x0799('0x9')],'priority':_0x1386cf[_0x0799('0x1c')]++,'VoiceExtensionId':_0x3b394c[_0x54de53][0x0][_0x0799('0x15')]});if(_0x1386cf[_0x0799('0x22')]&&_0x1386cf[_0x0799('0x22')][_0x0799('0x23')](_0x0799('0x24'))&&_0x1386cf[_0x0799('0x22')]['recordingFormat']!==_0x0799('0x25')){_0x1386cf[_0x0799('0xe')][_0x0799('0x10')]({'type':_0x3b394c[_0x54de53][0x0]['type'],'app':_0x0799('0x12'),'appdata':_0x0799('0x26'),'context':_0x3b394c[_0x54de53][0x0][_0x0799('0x1b')],'exten':_0x3b394c[_0x54de53][0x0][_0x0799('0x9')],'priority':_0x1386cf[_0x0799('0x1c')]++,'VoiceExtensionId':_0x3b394c[_0x54de53][0x0][_0x0799('0x15')]});_0x1386cf[_0x0799('0xe')][_0x0799('0x10')]({'type':_0x3b394c[_0x54de53][0x0][_0x0799('0x11')],'app':_0x0799('0x12'),'appdata':_0x0799('0x27')+_0x1386cf[_0x0799('0x22')][_0x0799('0x24')]||'wav','context':_0x3b394c[_0x54de53][0x0]['context'],'exten':_0x3b394c[_0x54de53][0x0][_0x0799('0x9')],'priority':_0x1386cf[_0x0799('0x1c')]++,'VoiceExtensionId':_0x3b394c[_0x54de53][0x0][_0x0799('0x15')]});}}_0x1386cf[_0x0799('0xe')][_0x0799('0x10')]({'type':_0x3b394c[_0x54de53][0x0][_0x0799('0x11')],'app':_0x0799('0x12'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x3b394c[_0x54de53][0x0]['context'],'exten':_0x3b394c[_0x54de53][0x0][_0x0799('0x9')],'priority':_0x1386cf['priority']++,'VoiceExtensionId':_0x3b394c[_0x54de53][0x0][_0x0799('0x15')]});_0x1386cf[_0x0799('0xe')]['push']({'type':_0x3b394c[_0x54de53][0x0][_0x0799('0x11')],'app':'Set','appdata':_0x0799('0x28'),'context':_0x3b394c[_0x54de53][0x0]['context'],'exten':_0x3b394c[_0x54de53][0x0]['exten'],'priority':_0x1386cf[_0x0799('0x1c')]++,'VoiceExtensionId':_0x3b394c[_0x54de53][0x0][_0x0799('0x15')]});_0x1386cf[_0x0799('0xe')]['push']({'type':_0x3b394c[_0x54de53][0x0]['type'],'app':_0x0799('0x12'),'appdata':_0x0799('0x29'),'context':_0x3b394c[_0x54de53][0x0][_0x0799('0x1b')],'exten':_0x3b394c[_0x54de53][0x0][_0x0799('0x9')],'priority':_0x1386cf[_0x0799('0x1c')]++,'VoiceExtensionId':_0x3b394c[_0x54de53][0x0][_0x0799('0x15')]});for(var _0x1967c0=0x0,_0x4fe41c=0x0;_0x1967c0<_0x3b394c[_0x54de53][_0x0799('0x2a')];_0x1967c0+=0x1,_0x4fe41c=0x0){var _0x8ecd48=_0x3b394c[_0x54de53][_0x1967c0];if(_0x8ecd48[_0x0799('0x11')]){_0x8ecd48[_0x0799('0x11')]=_0x8ecd48[_0x0799('0x11')][_0x0799('0x2b')]();}var _0x2b7157=[];var _0x1ad0f4=[];delete _0x8ecd48['id'];delete _0x8ecd48[_0x0799('0x2c')];delete _0x8ecd48[_0x0799('0x2d')];var _0x298482=_0x8ecd48[_0x0799('0x2e')]!==_0x0799('0x2f')?[_0x8ecd48[_0x0799('0x2e')]]:_0x8ecd48[_0x0799('0x30')]?_[_0x0799('0x8')](_[_0x0799('0xa')](_0x1386cf[_0x0799('0x4')],{'IntervalId':_0x8ecd48[_0x0799('0x30')]}),_0x0799('0x2e')):[];if(_0x8ecd48[_0x0799('0x23')]('tag')){if(_0x8ecd48[_0x0799('0x31')]&&_0x8ecd48[_0x0799('0x31')]!=='--'){_0x2b7157['push']({'type':_0x8ecd48['type'],'app':_0x0799('0x12'),'appdata':_0x0799('0x32')+_0x8ecd48[_0x0799('0x31')],'context':_0x8ecd48[_0x0799('0x1b')],'exten':_0x8ecd48[_0x0799('0x9')],'priority':_0x298482[_0x0799('0x2a')]+_0x1386cf[_0x0799('0x1c')]+_0x4fe41c++,'VoiceExtensionId':_0x8ecd48[_0x0799('0x15')]});}}if(_0x8ecd48[_0x0799('0x11')]==='outbound'&&_0x8ecd48['hasOwnProperty'](_0x0799('0x33'))){if(_0x8ecd48[_0x0799('0x33')]){_0x2b7157[_0x0799('0x10')]({'type':_0x8ecd48[_0x0799('0x11')],'app':_0x0799('0x34'),'appdata':_0x0799('0x35')+_0x8ecd48[_0x0799('0x33')]+')','context':_0x8ecd48[_0x0799('0x1b')],'exten':_0x8ecd48['exten'],'priority':_0x298482[_0x0799('0x2a')]+_0x1386cf['priority']+_0x4fe41c++,'VoiceExtensionId':_0x8ecd48['VoiceExtensionId']});}else{_0x2b7157[_0x0799('0x10')]({'type':_0x8ecd48[_0x0799('0x11')],'app':_0x0799('0x34'),'appdata':_0x0799('0x36'),'context':_0x8ecd48[_0x0799('0x1b')],'exten':_0x8ecd48[_0x0799('0x9')],'priority':_0x298482[_0x0799('0x2a')]+_0x1386cf[_0x0799('0x1c')]+_0x4fe41c++,'VoiceExtensionId':_0x8ecd48[_0x0799('0x15')]});}}if(_0x8ecd48[_0x0799('0x23')]('answer')){if(_0x4a6383['indexOf'](_0x8ecd48[_0x0799('0x37')][_0x0799('0x2b')]())>=0x0&&_0x8ecd48['appType']!=='custom'){if(_0x8ecd48[_0x0799('0x38')]){_0x2b7157[_0x0799('0x10')]({'type':_0x8ecd48[_0x0799('0x11')],'app':'ExecIf','appdata':_0x0799('0x39'),'context':_0x8ecd48[_0x0799('0x1b')],'exten':_0x8ecd48['exten'],'priority':_0x298482[_0x0799('0x2a')]+_0x1386cf[_0x0799('0x1c')]+_0x4fe41c++,'VoiceExtensionId':_0x8ecd48[_0x0799('0x15')]});_0x2b7157[_0x0799('0x10')]({'type':_0x8ecd48['type'],'app':_0x0799('0x12'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x8ecd48[_0x0799('0x1b')],'exten':_0x8ecd48[_0x0799('0x9')],'priority':_0x298482[_0x0799('0x2a')]+_0x1386cf[_0x0799('0x1c')]+_0x4fe41c++,'VoiceExtensionId':_0x8ecd48[_0x0799('0x15')]});}else{_0x2b7157['push']({'type':_0x8ecd48['type'],'app':_0x0799('0x34'),'appdata':_0x0799('0x3a'),'context':_0x8ecd48[_0x0799('0x1b')],'exten':_0x8ecd48['exten'],'priority':_0x298482['length']+_0x1386cf['priority']+_0x4fe41c++,'VoiceExtensionId':_0x8ecd48[_0x0799('0x15')]});_0x2b7157[_0x0799('0x10')]({'type':_0x8ecd48['type'],'app':_0x0799('0x12'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x8ecd48[_0x0799('0x1b')],'exten':_0x8ecd48[_0x0799('0x9')],'priority':_0x298482[_0x0799('0x2a')]+_0x1386cf[_0x0799('0x1c')]+_0x4fe41c++,'VoiceExtensionId':_0x8ecd48[_0x0799('0x15')]});}}}for(var _0x52b053=0x0;_0x52b053<_0x298482[_0x0799('0x2a')];_0x52b053+=0x1){var _0x59cf5f=_0x1386cf[_0x0799('0x1c')]+_0x298482['length'];var _0x44889c=_0x52b053===_0x298482[_0x0799('0x2a')]-0x1?_0x1386cf[_0x0799('0x1c')]+_0x2b7157[_0x0799('0x2a')]+_0x1ad0f4[_0x0799('0x2a')]+0x2:_0x1386cf['priority']+_0x52b053+0x1;_0x2b7157['splice'](_0x52b053,0x0,{'type':_0x8ecd48[_0x0799('0x11')],'app':_0x0799('0x3b'),'appdata':_0x298482[_0x52b053]+'?'+_0x8ecd48[_0x0799('0x1b')]+_0x0799('0x3c')+_0x59cf5f+':'+_0x8ecd48[_0x0799('0x1b')]+_0x0799('0x3c')+_0x44889c,'exten':_0x8ecd48[_0x0799('0x9')],'context':_0x8ecd48[_0x0799('0x1b')],'priority':_0x1386cf['priority']+_0x52b053,'VoiceExtensionId':_0x3b394c[_0x54de53][0x0][_0x0799('0x15')]});}_0x8ecd48['priority']=_0x2b7157[_0x0799('0x2a')]?_[_0x0799('0x3d')](_0x2b7157)[_0x0799('0x1c')]+0x1:_0x1386cf[_0x0799('0x1c')];_0x1386cf[_0x0799('0x1c')]=(_0x1ad0f4[_0x0799('0x2a')]?_['last'](_0x1ad0f4)['priority']:_0x8ecd48['priority'])+0x1;_0x1386cf[_0x0799('0xe')]=_[_0x0799('0x3e')](_0x1386cf[_0x0799('0xe')],_0x2b7157,[_0x8ecd48],_0x1ad0f4);}_0x1386cf['extensions'][_0x0799('0x10')]({'type':_0x3b394c[_0x54de53][0x0][_0x0799('0x11')],'app':'Hangup','exten':_0x3b394c[_0x54de53][0x0][_0x0799('0x9')],'context':_0x3b394c[_0x54de53][0x0][_0x0799('0x1b')],'priority':_0x1386cf[_0x0799('0x1c')],'VoiceExtensionId':_0x3b394c[_0x54de53][0x0][_0x0799('0x15')]});_0x489de0['push'](_0x3b394c[_0x54de53][0x0][_0x0799('0x15')]);_0x4b91de=_['concat'](_0x4b91de,_0x1386cf[_0x0799('0xe')]);}}return _0x3b9cf1['transaction'](function(_0x599cee){return _0x3b9cf1['models'][_0x0799('0x5')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x489de0}},'transaction':_0x599cee})[_0x0799('0x6')](function(_0x460e54){return _0x3b9cf1[_0x0799('0x2')][_0x0799('0x5')][_0x0799('0x3f')](_[_0x0799('0x40')](_0x4b91de,'priority'),{'transaction':_0x599cee});});});})[_0x0799('0x41')](function(_0x404e5d){console[_0x0799('0x42')](_0x404e5d);});}exports[_0x0799('0x43')]=rewrite; \ No newline at end of file +var _0x0e6b=['updatedAt','interval','*,*,*,*','intervals','tag','CDR(tag)=','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','appType','custom','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','Hangup','transaction','bulkCreate','sortBy','catch','rewrite','lodash','models','Interval','findAll','then','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','hasOwnProperty','priority','extensions','extension','find','push','Set','format','CDR(type)=%s','type','context','VoiceExtensionId','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt'];(function(_0x5017c0,_0x1a6afd){var _0x58962d=function(_0x328195){while(--_0x328195){_0x5017c0['push'](_0x5017c0['shift']());}};_0x58962d(++_0x1a6afd);}(_0x0e6b,0x17d));var _0xb0e6=function(_0x1139d0,_0x41e5f8){_0x1139d0=_0x1139d0-0x0;var _0xcc01a6=_0x0e6b[_0x1139d0];return _0xcc01a6;};'use strict';var _=require(_0xb0e6('0x0'));var util=require('util');function rewrite(_0x2288f7,_0x5077db){var _0xa90122=this;return _0x2288f7[_0xb0e6('0x1')][_0xb0e6('0x2')][_0xb0e6('0x3')]({'raw':!![]})[_0xb0e6('0x4')](function(_0x34bbe0){_0xa90122['intervals']=_0x34bbe0;return _0x2288f7[_0xb0e6('0x1')][_0xb0e6('0x5')][_0xb0e6('0x3')]({'where':{'IntervalId':_0x5077db[_0xb0e6('0x6')]},'raw':!![]});})['then'](function(_0x1844be){return _0x2288f7['models'][_0xb0e6('0x5')][_0xb0e6('0x3')]({'where':{'exten':{'$in':_[_0xb0e6('0x7')](_[_0xb0e6('0x8')](_0x1844be,_0xb0e6('0x9')))}},'order':[{'raw':_0xb0e6('0xa')}],'raw':!![]});})['then'](function(_0x457081){var _0x4c66a3=_[_0xb0e6('0xb')](_0x457081,{'priority':'1'});var _0x1f83cf=_[_0xb0e6('0xb')](_0x457081,{'isApp':0x1});var _0x34f365=_[_0xb0e6('0xc')](_0x1f83cf,_0xb0e6('0x9'));var _0x48f67b=[_0xb0e6('0xd'),'playback'];var _0x1e69ab=[];var _0x2bf322=[];for(var _0x4e5577 in _0x34f365){if(_0x34f365[_0xb0e6('0xe')](_0x4e5577)){_0xa90122[_0xb0e6('0xf')]=0x2;_0xa90122[_0xb0e6('0x10')]=[];_0xa90122[_0xb0e6('0x11')]=_[_0xb0e6('0x12')](_0x4c66a3,{'exten':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x9')]});_0xa90122[_0xb0e6('0x10')][_0xb0e6('0x13')]({'type':_0x34f365[_0x4e5577][0x0]['type'],'app':_0xb0e6('0x14'),'appdata':util[_0xb0e6('0x15')](_0xb0e6('0x16'),_0x34f365[_0x4e5577][0x0][_0xb0e6('0x17')]),'context':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x18')],'exten':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x9')],'priority':_0xa90122['priority']++,'VoiceExtensionId':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x19')]});if(_0x34f365[_0x4e5577][0x0][_0xb0e6('0x17')]===_0xb0e6('0x1a')){if(_0xa90122['extension']){_0xa90122[_0xb0e6('0x10')][_0xb0e6('0x13')]({'type':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x17')],'app':_0xb0e6('0x14'),'appdata':_0xb0e6('0x1b')+(_0xa90122[_0xb0e6('0x11')][_0xb0e6('0x1c')]?_0xb0e6('0x1d')+_0xa90122[_0xb0e6('0x11')]['cutdigits']+'}':_0xb0e6('0x1e')),'context':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x18')],'exten':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x9')],'priority':_0xa90122[_0xb0e6('0xf')]++,'VoiceExtensionId':_0x34f365[_0x4e5577][0x0]['VoiceExtensionId']});}_0xa90122[_0xb0e6('0x10')][_0xb0e6('0x13')]({'type':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x17')],'app':_0xb0e6('0x14'),'appdata':_0xb0e6('0x1f')+_0x34f365[_0x4e5577][0x0][_0xb0e6('0x19')],'context':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x18')],'exten':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x9')],'priority':_0xa90122['priority']++,'VoiceExtensionId':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x19')]});var _0x5d1f05=_0xa90122[_0xb0e6('0xf')]++;_0xa90122['extensions'][_0xb0e6('0x13')]({'type':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x17')],'app':'ExecIf','appdata':_0xb0e6('0x20')+(_0x5d1f05+0x2)+'):Goto('+(_0x5d1f05+0x1)+')','context':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x18')],'exten':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x9')],'priority':_0x5d1f05,'VoiceExtensionId':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x19')]});if(_0xa90122[_0xb0e6('0x11')]){_0xa90122[_0xb0e6('0x10')][_0xb0e6('0x13')]({'type':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x17')],'app':_0xb0e6('0x14'),'appdata':_0xa90122[_0xb0e6('0x11')][_0xb0e6('0x1c')]?_0xb0e6('0x21')+_0xa90122[_0xb0e6('0x11')][_0xb0e6('0x1c')]+'}':_0xb0e6('0x22'),'context':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x18')],'exten':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x9')],'priority':_0xa90122[_0xb0e6('0xf')]++,'VoiceExtensionId':_0x34f365[_0x4e5577][0x0]['VoiceExtensionId']});}_0xa90122[_0xb0e6('0x10')][_0xb0e6('0x13')]({'type':_0x34f365[_0x4e5577][0x0]['type'],'app':_0xb0e6('0x14'),'appdata':'outboundrouteid='+_0x34f365[_0x4e5577][0x0]['VoiceExtensionId'],'context':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x18')],'exten':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x9')],'priority':_0xa90122[_0xb0e6('0xf')]++,'VoiceExtensionId':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x19')]});if(_0xa90122['extension']&&_0xa90122['extension'][_0xb0e6('0xe')](_0xb0e6('0x23'))&&_0xa90122[_0xb0e6('0x11')][_0xb0e6('0x23')]!=='none'){_0xa90122[_0xb0e6('0x10')][_0xb0e6('0x13')]({'type':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x17')],'app':_0xb0e6('0x14'),'appdata':_0xb0e6('0x24'),'context':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x18')],'exten':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x9')],'priority':_0xa90122[_0xb0e6('0xf')]++,'VoiceExtensionId':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x19')]});_0xa90122[_0xb0e6('0x10')]['push']({'type':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x17')],'app':_0xb0e6('0x14'),'appdata':_0xb0e6('0x25')+_0xa90122[_0xb0e6('0x11')]['recordingFormat']||_0xb0e6('0x26'),'context':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x18')],'exten':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x9')],'priority':_0xa90122[_0xb0e6('0xf')]++,'VoiceExtensionId':_0x34f365[_0x4e5577][0x0]['VoiceExtensionId']});}}_0xa90122['extensions']['push']({'type':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x17')],'app':_0xb0e6('0x14'),'appdata':_0xb0e6('0x27'),'context':_0x34f365[_0x4e5577][0x0]['context'],'exten':_0x34f365[_0x4e5577][0x0]['exten'],'priority':_0xa90122[_0xb0e6('0xf')]++,'VoiceExtensionId':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x19')]});_0xa90122[_0xb0e6('0x10')][_0xb0e6('0x13')]({'type':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x17')],'app':_0xb0e6('0x14'),'appdata':_0xb0e6('0x28'),'context':_0x34f365[_0x4e5577][0x0]['context'],'exten':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x9')],'priority':_0xa90122['priority']++,'VoiceExtensionId':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x19')]});_0xa90122[_0xb0e6('0x10')]['push']({'type':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x17')],'app':'Set','appdata':_0xb0e6('0x29'),'context':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x18')],'exten':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x9')],'priority':_0xa90122[_0xb0e6('0xf')]++,'VoiceExtensionId':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x19')]});for(var _0x3e5e9d=0x0,_0x4c165d=0x0;_0x3e5e9d<_0x34f365[_0x4e5577][_0xb0e6('0x2a')];_0x3e5e9d+=0x1,_0x4c165d=0x0){var _0x4e597a=_0x34f365[_0x4e5577][_0x3e5e9d];if(_0x4e597a[_0xb0e6('0x17')]){_0x4e597a[_0xb0e6('0x17')]=_0x4e597a[_0xb0e6('0x17')][_0xb0e6('0x2b')]();}var _0x5bfca1=[];var _0x3a4113=[];delete _0x4e597a['id'];delete _0x4e597a[_0xb0e6('0x2c')];delete _0x4e597a[_0xb0e6('0x2d')];var _0x5630c9=_0x4e597a[_0xb0e6('0x2e')]!==_0xb0e6('0x2f')?[_0x4e597a[_0xb0e6('0x2e')]]:_0x4e597a[_0xb0e6('0x6')]?_[_0xb0e6('0x8')](_[_0xb0e6('0xb')](_0xa90122[_0xb0e6('0x30')],{'IntervalId':_0x4e597a[_0xb0e6('0x6')]}),_0xb0e6('0x2e')):[];if(_0x4e597a[_0xb0e6('0xe')](_0xb0e6('0x31'))){if(_0x4e597a['tag']&&_0x4e597a[_0xb0e6('0x31')]!=='--'){_0x5bfca1[_0xb0e6('0x13')]({'type':_0x4e597a['type'],'app':_0xb0e6('0x14'),'appdata':_0xb0e6('0x32')+_0x4e597a['tag'],'context':_0x4e597a[_0xb0e6('0x18')],'exten':_0x4e597a[_0xb0e6('0x9')],'priority':_0x5630c9[_0xb0e6('0x2a')]+_0xa90122[_0xb0e6('0xf')]+_0x4c165d++,'VoiceExtensionId':_0x4e597a[_0xb0e6('0x19')]});}}if(_0x4e597a[_0xb0e6('0x17')]===_0xb0e6('0x1a')&&_0x4e597a[_0xb0e6('0xe')](_0xb0e6('0x33'))){if(_0x4e597a[_0xb0e6('0x33')]){_0x5bfca1[_0xb0e6('0x13')]({'type':_0x4e597a['type'],'app':_0xb0e6('0x34'),'appdata':_0xb0e6('0x35')+_0x4e597a[_0xb0e6('0x33')]+')','context':_0x4e597a[_0xb0e6('0x18')],'exten':_0x4e597a['exten'],'priority':_0x5630c9[_0xb0e6('0x2a')]+_0xa90122[_0xb0e6('0xf')]+_0x4c165d++,'VoiceExtensionId':_0x4e597a[_0xb0e6('0x19')]});}else{_0x5bfca1[_0xb0e6('0x13')]({'type':_0x4e597a['type'],'app':_0xb0e6('0x34'),'appdata':_0xb0e6('0x36'),'context':_0x4e597a['context'],'exten':_0x4e597a[_0xb0e6('0x9')],'priority':_0x5630c9[_0xb0e6('0x2a')]+_0xa90122['priority']+_0x4c165d++,'VoiceExtensionId':_0x4e597a[_0xb0e6('0x19')]});}}if(_0x4e597a[_0xb0e6('0xe')](_0xb0e6('0x37'))){if(_0x48f67b[_0xb0e6('0x38')](_0x4e597a['app'][_0xb0e6('0x2b')]())>=0x0&&_0x4e597a[_0xb0e6('0x39')]!==_0xb0e6('0x3a')){if(_0x4e597a[_0xb0e6('0x37')]){_0x5bfca1[_0xb0e6('0x13')]({'type':_0x4e597a[_0xb0e6('0x17')],'app':_0xb0e6('0x34'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x4e597a['context'],'exten':_0x4e597a[_0xb0e6('0x9')],'priority':_0x5630c9[_0xb0e6('0x2a')]+_0xa90122[_0xb0e6('0xf')]+_0x4c165d++,'VoiceExtensionId':_0x4e597a[_0xb0e6('0x19')]});_0x5bfca1[_0xb0e6('0x13')]({'type':_0x4e597a[_0xb0e6('0x17')],'app':_0xb0e6('0x14'),'appdata':_0xb0e6('0x3b'),'context':_0x4e597a[_0xb0e6('0x18')],'exten':_0x4e597a[_0xb0e6('0x9')],'priority':_0x5630c9['length']+_0xa90122[_0xb0e6('0xf')]+_0x4c165d++,'VoiceExtensionId':_0x4e597a[_0xb0e6('0x19')]});}else{_0x5bfca1['push']({'type':_0x4e597a[_0xb0e6('0x17')],'app':_0xb0e6('0x34'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x4e597a[_0xb0e6('0x18')],'exten':_0x4e597a[_0xb0e6('0x9')],'priority':_0x5630c9['length']+_0xa90122['priority']+_0x4c165d++,'VoiceExtensionId':_0x4e597a[_0xb0e6('0x19')]});_0x5bfca1['push']({'type':_0x4e597a[_0xb0e6('0x17')],'app':_0xb0e6('0x14'),'appdata':_0xb0e6('0x3c'),'context':_0x4e597a[_0xb0e6('0x18')],'exten':_0x4e597a[_0xb0e6('0x9')],'priority':_0x5630c9['length']+_0xa90122[_0xb0e6('0xf')]+_0x4c165d++,'VoiceExtensionId':_0x4e597a[_0xb0e6('0x19')]});}}}for(var _0x2cd377=0x0;_0x2cd377<_0x5630c9[_0xb0e6('0x2a')];_0x2cd377+=0x1){var _0x33d182=_0xa90122['priority']+_0x5630c9[_0xb0e6('0x2a')];var _0x441ed9=_0x2cd377===_0x5630c9[_0xb0e6('0x2a')]-0x1?_0xa90122['priority']+_0x5bfca1['length']+_0x3a4113['length']+0x2:_0xa90122['priority']+_0x2cd377+0x1;_0x5bfca1[_0xb0e6('0x3d')](_0x2cd377,0x0,{'type':_0x4e597a[_0xb0e6('0x17')],'app':'GotoIfTime','appdata':_0x5630c9[_0x2cd377]+'?'+_0x4e597a['context']+_0xb0e6('0x3e')+_0x33d182+':'+_0x4e597a['context']+',${EXTEN},'+_0x441ed9,'exten':_0x4e597a[_0xb0e6('0x9')],'context':_0x4e597a[_0xb0e6('0x18')],'priority':_0xa90122[_0xb0e6('0xf')]+_0x2cd377,'VoiceExtensionId':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x19')]});}_0x4e597a[_0xb0e6('0xf')]=_0x5bfca1[_0xb0e6('0x2a')]?_['last'](_0x5bfca1)[_0xb0e6('0xf')]+0x1:_0xa90122[_0xb0e6('0xf')];_0xa90122[_0xb0e6('0xf')]=(_0x3a4113[_0xb0e6('0x2a')]?_[_0xb0e6('0x3f')](_0x3a4113)[_0xb0e6('0xf')]:_0x4e597a[_0xb0e6('0xf')])+0x1;_0xa90122['extensions']=_[_0xb0e6('0x40')](_0xa90122['extensions'],_0x5bfca1,[_0x4e597a],_0x3a4113);}_0xa90122[_0xb0e6('0x10')]['push']({'type':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x17')],'app':_0xb0e6('0x41'),'exten':_0x34f365[_0x4e5577][0x0]['exten'],'context':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x18')],'priority':_0xa90122[_0xb0e6('0xf')],'VoiceExtensionId':_0x34f365[_0x4e5577][0x0][_0xb0e6('0x19')]});_0x1e69ab['push'](_0x34f365[_0x4e5577][0x0][_0xb0e6('0x19')]);_0x2bf322=_['concat'](_0x2bf322,_0xa90122['extensions']);}}return _0x2288f7[_0xb0e6('0x42')](function(_0x286fd9){return _0x2288f7[_0xb0e6('0x1')][_0xb0e6('0x5')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x1e69ab}},'transaction':_0x286fd9})[_0xb0e6('0x4')](function(_0x320633){return _0x2288f7[_0xb0e6('0x1')][_0xb0e6('0x5')][_0xb0e6('0x43')](_[_0xb0e6('0x44')](_0x2bf322,_0xb0e6('0xf')),{'transaction':_0x286fd9});});});})[_0xb0e6('0x45')](function(_0x5dde52){console['error'](_0x5dde52);});}exports[_0xb0e6('0x46')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index c545047..0e09fae 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 _0x70e0=['insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','updatedAt','select','field','toString','NOW()','cm_contacts','where','deletedAt\x20IS\x20NULL','phone\x20NOT\x20IN\x20(?)','from','createdAt','ListId\x20=\x20?','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','\x20=\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','CmList','get','dialCheckDuplicateType','always','sequelize','VoiceQueueId','catch','query','BlackLists','all','Campaign','Lists','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','CmContact','createReadStream','parse','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','length','map','errors','message','hasOwnProperty','data','firstName','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','duplicate','Duplicate\x20Contact','keys','then','push','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect'];(function(_0x3b1702,_0x562e65){var _0x42f09b=function(_0x190e5b){while(--_0x190e5b){_0x3b1702['push'](_0x3b1702['shift']());}};_0x42f09b(++_0x562e65);}(_0x70e0,0x17b));var _0x070e=function(_0x3516a3,_0xb71901){_0x3516a3=_0x3516a3-0x0;var _0x639a6a=_0x70e0[_0x3516a3];return _0x639a6a;};'use strict';var BPromise=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var _=require(_0x070e('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var config=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('api');config[_0x070e('0x7')]=_['defaults'](config[_0x070e('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x070e('0x8'))[_0x070e('0x9')](socket);try{if(!process[_0x070e('0xa')][0x2]||process[_0x070e('0xa')][0x2]===_0x070e('0xb')||process[_0x070e('0xa')][0x2]===_0x070e('0xc')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process['argv'][0x2];if(!process[_0x070e('0xa')][0x3]||process[_0x070e('0xa')][0x3]===_0x070e('0xb')||process[_0x070e('0xa')][0x3]===_0x070e('0xc')||!process[_0x070e('0xa')][0x4]||process[_0x070e('0xa')][0x4]===_0x070e('0xb')||process[_0x070e('0xa')][0x4]===_0x070e('0xc')){throw new Error(_0x070e('0xd'));}var FIELDS=_['zipObject'](process['argv'][0x3][_0x070e('0xe')](','),process['argv'][0x4]['split'](','));if(!process['argv'][0x5]||process[_0x070e('0xa')][0x5]===_0x070e('0xb')||process['argv'][0x5]==='null'){throw new Error(_0x070e('0xf'));}var LISTID=process[_0x070e('0xa')][0x5];var COMPANYID=process[_0x070e('0xa')][0x6]&&process[_0x070e('0xa')][0x6]!=='undefined'&&process['argv'][0x6]!==_0x070e('0xc')?process[_0x070e('0xa')][0x6]:null;var DUPLICATES=process[_0x070e('0xa')][0x7]&&process[_0x070e('0xa')][0x7]!==_0x070e('0xb')&&process['argv'][0x7]!==_0x070e('0xc')?process[_0x070e('0xa')][0x7]:null;if(!process[_0x070e('0xa')][0x8]||process[_0x070e('0xa')][0x8]===_0x070e('0xb')||process['argv'][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x070e('0xa')][0x8];}catch(_0x3004f0){logger[_0x070e('0x10')](_0x3004f0);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x4be0d7,_0x5b184,_0x5dc5d2,_0xf8dd5d){var _0x3f6985={'message':_0x5b184};_0x3f6985[_0x4be0d7]=!![];if(_0x5dc5d2){_0x3f6985[_0x070e('0x11')]=_0x5dc5d2;}if(_0xf8dd5d){_0x3f6985[_0x070e('0x12')]=_0xf8dd5d;}return _0x3f6985;}function isEmail(_0x28a1c3){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x070e('0x13')](_0x28a1c3);}function checkRow(_0xe405e,_0x164cdf,_0x595c7e){return new BPromise(function(_0x2f8055,_0x270061){if(_[_0x070e('0x14')](_0xe405e)){return _0x270061(handleCheckRowError('error',_0x070e('0x15'),null,_0x595c7e));}if(_0xe405e['errors']&&_0xe405e['errors'][_0x070e('0x16')]){var _0x25f6e=_[_0x070e('0x17')](_0xe405e[_0x070e('0x18')],_0x070e('0x19'))['join'](';');return _0x270061(handleCheckRowError(_0x070e('0x10'),_0x25f6e,null,_0x595c7e));}var _0x219e48={};for(var _0x1d72d6 in FIELDS){if(FIELDS[_0x070e('0x1a')](_0x1d72d6)&&FIELDS[_0x1d72d6]){_0x219e48[_0x1d72d6]=_0xe405e[_0x070e('0x1b')][0x0][FIELDS[_0x1d72d6]]||_0xe405e[_0x070e('0x1b')][0x0]['\ufeff'+FIELDS[_0x1d72d6]];}}if(!_0x219e48[_0x070e('0x1c')]){return _0x270061(handleCheckRowError(_0x070e('0x10'),'firstName\x20not\x20specified!',null,_0x595c7e));}if(!_0x219e48[_0x070e('0x1d')]){return _0x270061(handleCheckRowError(_0x070e('0x10'),_0x070e('0x1e'),null,_0x595c7e));}if(_0x219e48['birthDate']){var _0x5c5f0d=moment(_0x219e48[_0x070e('0x1f')],_0x070e('0x20'));if(!_0x5c5f0d[_0x070e('0x21')]()){return _0x270061(handleCheckRowError('error',_0x070e('0x22'),null,_0x595c7e));}}if(_0x219e48[_0x070e('0x23')]){if(!isEmail(_0x219e48[_0x070e('0x23')])){return _0x270061(handleCheckRowError(_0x070e('0x10'),'email\x20format\x20is\x20not\x20valid!',null,_0x595c7e));}}_0x219e48['ListId']=LISTID;_0x219e48['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x164cdf){var _0xdf8945={};for(var _0x4e0a7d=0x0,_0x1dff97=DUPLICATES[_0x070e('0x16')];_0x4e0a7d<_0x1dff97;_0x4e0a7d+=0x1){_0xdf8945[DUPLICATES[_0x4e0a7d]]=_0x219e48[DUPLICATES[_0x4e0a7d]];}var _0x4f8130=_['find'](_0x164cdf,_0xdf8945);if(_0x4f8130){return _0x270061(handleCheckRowError(_0x070e('0x24'),_0x070e('0x25'),_0x4f8130,_0x595c7e));}}return db['CmContact']['create'](_0x219e48,{'raw':!![],'hooks':![],'fields':_[_0x070e('0x26')](_0x219e48)})[_0x070e('0x27')](function(_0x444d02){if(DUPLICATES&&DUPLICATES[_0x070e('0x16')]&&_0x164cdf){_0x164cdf[_0x070e('0x28')](_['pick'](_0x219e48,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x444d02['id'];return _0x2f8055();})['catch'](function(_0x24d17d){return _0x270061(handleCheckRowError(_0x070e('0x10'),_0x070e('0x29')+(_0x24d17d[_0x070e('0x19')]||JSON[_0x070e('0x2a')](_0x24d17d)),null,_0x595c7e));});});}function checkHopper(){function _0x4deaf8(){return function(_0x22f3a9){logger[_0x070e('0x10')]('cmContact',_0x070e('0x2b'),util[_0x070e('0x2c')](_0x22f3a9,{'showHidden':![],'depth':null}));};}var _0x4ba6f0=function(_0x4d4ee8,_0x5ddbe9){var _0x363bff=squel[_0x070e('0x2d')]()[_0x070e('0x2e')](_0x070e('0x2f'))[_0x070e('0x30')](['phone',_0x070e('0x31'),_0x070e('0x32'),_0x070e('0x33'),_0x5ddbe9,'createdAt',_0x070e('0x34')],squel[_0x070e('0x35')]()[_0x070e('0x36')]('phone',_0x070e('0x1d'))[_0x070e('0x36')]('NOW()',_0x070e('0x31'))['field']('id',_0x070e('0x32'))[_0x070e('0x36')](LISTID[_0x070e('0x37')](),_0x070e('0x33'))[_0x070e('0x36')](_0x4d4ee8['id']['toString'](),_0x5ddbe9)[_0x070e('0x36')]('NOW()','createdAt')[_0x070e('0x36')](_0x070e('0x38'),_0x070e('0x34'))['from'](_0x070e('0x39'))[_0x070e('0x3a')](_0x070e('0x3b'))[_0x070e('0x3a')]('ListId\x20=\x20?',LISTID[_0x070e('0x37')]())['where']('phone\x20IS\x20NOT\x20NULL')['where'](_0x070e('0x3c'),squel[_0x070e('0x35')]()[_0x070e('0x36')](_0x070e('0x1d'))[_0x070e('0x3d')]('cm_hopper')[_0x070e('0x3a')](_0x5ddbe9+'\x20=\x20?',_0x4d4ee8['id'][_0x070e('0x37')]())))[_0x070e('0x37')]();return _0x363bff;};var _0xff760c=function(_0x52fcea,_0x54285a){var _0x261a27=squel['insert']()[_0x070e('0x2e')](_0x070e('0x2f'))[_0x070e('0x30')](['phone',_0x070e('0x31'),_0x070e('0x32'),'ListId',_0x54285a,'createdAt',_0x070e('0x34')],squel[_0x070e('0x35')]()[_0x070e('0x36')](_0x070e('0x1d'),_0x070e('0x1d'))['field'](_0x070e('0x38'),_0x070e('0x31'))[_0x070e('0x36')]('id',_0x070e('0x32'))[_0x070e('0x36')](LISTID[_0x070e('0x37')](),_0x070e('0x33'))[_0x070e('0x36')](_0x52fcea['id'][_0x070e('0x37')](),_0x54285a)[_0x070e('0x36')](_0x070e('0x38'),_0x070e('0x3e'))[_0x070e('0x36')](_0x070e('0x38'),_0x070e('0x34'))['from'](_0x070e('0x39'))[_0x070e('0x3a')](_0x070e('0x3b'))[_0x070e('0x3a')](_0x070e('0x3f'),LISTID[_0x070e('0x37')]())[_0x070e('0x3a')](_0x070e('0x40'),squel[_0x070e('0x41')](hopperContacts))['where'](_0x070e('0x42'))['where'](_0x070e('0x3c'),squel[_0x070e('0x35')]()['field'](_0x070e('0x43'))[_0x070e('0x3d')](_0x070e('0x44'))[_0x070e('0x3a')](_0x54285a+_0x070e('0x45'),_0x52fcea['id'][_0x070e('0x37')]()))[_0x070e('0x3a')]('phone\x20NOT\x20IN\x20(?)',squel[_0x070e('0x35')]()['field']('phone')[_0x070e('0x3d')](_0x070e('0x2f'))[_0x070e('0x3a')](_0x54285a+_0x070e('0x45'),_0x52fcea['id'][_0x070e('0x37')]())))[_0x070e('0x37')]();return _0x261a27;};function _0x440fa1(_0x343785,_0x53bea1){var _0x477e69=squel['insert']()['into'](_0x070e('0x2f'))[_0x070e('0x30')](['phone',_0x070e('0x31'),_0x070e('0x32'),_0x070e('0x33'),_0x53bea1,_0x070e('0x3e'),_0x070e('0x34')],squel[_0x070e('0x35')]()[_0x070e('0x36')]('phone','phone')['field'](_0x070e('0x38'),_0x070e('0x31'))[_0x070e('0x36')]('id',_0x070e('0x32'))['field'](LISTID[_0x070e('0x37')](),'ListId')[_0x070e('0x36')](_0x343785['id'][_0x070e('0x37')](),_0x53bea1)[_0x070e('0x36')](_0x070e('0x38'),_0x070e('0x3e'))[_0x070e('0x36')]('NOW()',_0x070e('0x34'))[_0x070e('0x3d')](_0x070e('0x39'))['where'](_0x070e('0x3b'))[_0x070e('0x3a')]('ListId\x20=\x20?',LISTID[_0x070e('0x37')]())['where'](_0x070e('0x40'),squel['str'](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x070e('0x37')]();return _0x477e69;}function _0x1ae5cb(_0x1100d8,_0x122198){var _0x3cb9ee=squel[_0x070e('0x2d')]()['into'](_0x070e('0x46'))['fromQuery']([_0x070e('0x1d'),'ContactId',_0x070e('0x33'),_0x122198,_0x070e('0x3e'),'updatedAt'],squel[_0x070e('0x35')]()['field'](_0x070e('0x1d'),_0x070e('0x1d'))[_0x070e('0x36')]('id',_0x070e('0x32'))[_0x070e('0x36')](LISTID[_0x070e('0x37')](),_0x070e('0x33'))[_0x070e('0x36')](_0x1100d8['id'][_0x070e('0x37')](),_0x122198)[_0x070e('0x36')](_0x070e('0x38'),_0x070e('0x3e'))[_0x070e('0x36')](_0x070e('0x38'),'updatedAt')[_0x070e('0x3d')](_0x070e('0x39'))[_0x070e('0x3a')](_0x070e('0x3b'))['where'](_0x070e('0x3f'),LISTID[_0x070e('0x37')]())[_0x070e('0x3a')](_0x070e('0x40'),squel[_0x070e('0x41')](hopperContacts))[_0x070e('0x3a')]('phone\x20IS\x20NOT\x20NULL'))[_0x070e('0x37')]();return _0x3cb9ee;}return db[_0x070e('0x47')][_0x070e('0x48')]({'where':{'type':_0x070e('0x49')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x070e('0x4a')],'as':'Lists','where':{'id':LISTID}}]})[_0x070e('0x27')](function(_0x36373d){var _0x3a1ad2=[];if(_0x36373d){var _0x150bf6;for(var _0x2a20d4=0x0,_0x50ef9f;_0x2a20d4<_0x36373d[_0x070e('0x16')];_0x2a20d4+=0x1){_0x50ef9f=_0x36373d[_0x2a20d4][_0x070e('0x4b')]({'plain':!![]});switch(_0x50ef9f[_0x070e('0x4c')]){case _0x070e('0x4d'):_0x3a1ad2['push'](db[_0x070e('0x4e')]['query'](_0xff760c(_0x50ef9f,_0x070e('0x4f')))[_0x070e('0x27')](function(){})[_0x070e('0x50')](_0x4deaf8()));break;case'onlyIfOpen':_0x3a1ad2[_0x070e('0x28')](db['sequelize'][_0x070e('0x51')](_0x4ba6f0(_0x50ef9f,'VoiceQueueId'))[_0x070e('0x27')](function(){})[_0x070e('0x50')](_0x4deaf8()));break;default:_0x3a1ad2['push'](db[_0x070e('0x4e')]['query'](_0x440fa1(_0x50ef9f,_0x070e('0x4f')))[_0x070e('0x27')](function(){})['catch'](_0x4deaf8()));}}}return _0x3a1ad2;})['all']()[_0x070e('0x27')](function(){return db[_0x070e('0x47')][_0x070e('0x48')]({'where':{'type':_0x070e('0x49')},'attributes':['id'],'include':[{'model':db[_0x070e('0x4a')],'as':_0x070e('0x52'),'where':{'id':LISTID}}]})[_0x070e('0x27')](function(_0x332c8a){var _0x25b599=[];if(_0x332c8a){var _0x1d1f44;for(var _0x72077d=0x0,_0x25670e;_0x72077d<_0x332c8a[_0x070e('0x16')];_0x72077d+=0x1){_0x25670e=_0x332c8a[_0x72077d]['get']({'plain':!![]});_0x25b599[_0x070e('0x28')](db[_0x070e('0x4e')]['query'](_0x1ae5cb(_0x25670e,'VoiceQueueId'))[_0x070e('0x27')](function(){})[_0x070e('0x50')](_0x4deaf8()));}}return _0x25b599;})[_0x070e('0x53')]();})[_0x070e('0x27')](function(){return db[_0x070e('0x54')][_0x070e('0x48')]({'attributes':['id',_0x070e('0x4c')],'include':[{'model':db[_0x070e('0x4a')],'as':_0x070e('0x55'),'where':{'id':LISTID}}]})[_0x070e('0x27')](function(_0x62800d){var _0x2084a1=[];if(_0x62800d){for(var _0x46ec49=0x0,_0x595e2e;_0x46ec49<_0x62800d['length'];_0x46ec49+=0x1){_0x595e2e=_0x62800d[_0x46ec49]['get']({'plain':!![]});switch(_0x595e2e[_0x070e('0x4c')]){case _0x070e('0x4d'):_0x2084a1[_0x070e('0x28')](db[_0x070e('0x4e')]['query'](_0xff760c(_0x595e2e,_0x070e('0x56')))[_0x070e('0x27')](function(){})[_0x070e('0x50')](_0x4deaf8()));break;case _0x070e('0x57'):_0x2084a1[_0x070e('0x28')](db[_0x070e('0x4e')]['query'](_0x4ba6f0(_0x595e2e,_0x070e('0x56')))['then'](function(){})[_0x070e('0x50')](_0x4deaf8()));break;default:_0x2084a1[_0x070e('0x28')](db[_0x070e('0x4e')][_0x070e('0x51')](_0x440fa1(_0x595e2e,_0x070e('0x56')))['then'](function(){})[_0x070e('0x50')](_0x4deaf8()));}}}return _0x2084a1;})[_0x070e('0x53')]();})['then'](function(){return db[_0x070e('0x54')][_0x070e('0x48')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x070e('0x52'),'where':{'id':LISTID}}]})[_0x070e('0x27')](function(_0xf0aef8){var _0x4da906=[];if(_0xf0aef8){for(var _0x40d7e6=0x0,_0xe8c476;_0x40d7e6<_0xf0aef8[_0x070e('0x16')];_0x40d7e6+=0x1){_0xe8c476=_0xf0aef8[_0x40d7e6][_0x070e('0x4b')]({'plain':!![]});_0x4da906[_0x070e('0x28')](db[_0x070e('0x4e')][_0x070e('0x51')](_0x1ae5cb(_0xe8c476,_0x070e('0x56')))[_0x070e('0x27')](function(){})[_0x070e('0x50')](_0x4deaf8()));}}return _0x4da906;})[_0x070e('0x53')]();})[_0x070e('0x50')](function(_0x18c27a){logger['error'](_0x070e('0x58'),_0x070e('0x59'),_0x18c27a[_0x070e('0x19')]);});}var processPromises=function(_0x1b71dd){return BPromise[_0x070e('0x53')](promises)[_0x070e('0x27')](function(_0x5c4352){})['catch'](function(_0x4a8563){logger[_0x070e('0x10')](_0x070e('0x5a'),JSON[_0x070e('0x2a')](_0x4a8563));})[_0x070e('0x5b')](function(){socket['emit'](_0x070e('0x5c')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x1b71dd){return _0x1b71dd[_0x070e('0x5d')]();}});};var endCsv=function(){return BPromise[_0x070e('0x5e')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x070e('0x27')](function(){socket['emit'](_0x070e('0x5c')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x070e('0x5f')](FILEPATH);}catch(_0x59e6e5){logger['error'](_0x070e('0x60'),JSON[_0x070e('0x2a')](_0x59e6e5));}finally{process['exit'](0x0);}});};process['on'](_0x070e('0x61'),function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0x070e('0x27')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x070e('0xe')](',');return db[_0x070e('0x62')][_0x070e('0x48')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x070e('0x27')](function(_0x341756){var _0x2a12a1=fs[_0x070e('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x070e('0x64')](_0x2a12a1,{'header':!![],'skipEmptyLines':!![],'step':function(_0xdcc60a,_0x4e0f6e){total+=0x1;var _0x1306e6=total;promises[_0x070e('0x28')](checkRow(_0xdcc60a,_0x341756,_0x1306e6)[_0x070e('0x27')](function(){success+=0x1;})[_0x070e('0x50')](function(_0x3f2bb5){if(_0x3f2bb5[_0x070e('0x10')]){errors+=0x1;delete _0x3f2bb5[_0x070e('0x10')];}else if(_0x3f2bb5[_0x070e('0x24')]){duplicates+=0x1;delete _0x3f2bb5[_0x070e('0x24')];}rows[_0x070e('0x28')](_0x3f2bb5);}));if(total%0xc8===0x0){_0x4e0f6e[_0x070e('0x65')]();return processPromises(_0x4e0f6e);}},'complete':function(){return processPromises()['then'](function(){logger[_0x070e('0x66')](_0x070e('0x67'));endCsv();});},'error':function(_0x449337,_0xe50b1b){logger['info'](_0x070e('0x68'),JSON[_0x070e('0x2a')](_0x449337));endCsv();}});})[_0x070e('0x50')](function(_0x2bad43){logger[_0x070e('0x10')](_0x070e('0x69'),JSON['stringify'](_0x2bad43));});}main(); \ No newline at end of file +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(_0x4c0569,_0x4b230d){var _0x4d5516=function(_0x3f025d){while(--_0x3f025d){_0x4c0569['push'](_0x4c0569['shift']());}};_0x4d5516(++_0x4b230d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'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 12864eb..6c18e6e 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 _0x1e14=['.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','\x22always\x22','toString','into','cm_hopper_black','cm_contacts.ListId\x20=\x20','ListId\x20=\x20?','\x20=\x20?','concat','keys',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','group','error','message','exit','push','code','sequelize','query','spread','send','start','binding','server/files/tmp','.csv','info','header','writeFileSync','parse','createReadStream','data','length','errors','hasOwnProperty','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNumber','includes','email','email\x20wrong\x20format','YYYY-MM-DD','\x20not\x20specified','SystemRow','appendFileSync','rows','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','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','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','campaigns_has_cm_lists','CampaignId','campaigns_has_cm_blacklists','campaigns','each','then','finish','affectedRows','emit','unlink','catch','argv','arguments\x20\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','bluebird','moment','ioredis','import','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','join','\x20=\x20','where','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','UserId','fields','from','cm_contacts','.CmListId'];(function(_0x444bd0,_0x283898){var _0x1f3fb7=function(_0x5cb609){while(--_0x5cb609){_0x444bd0['push'](_0x444bd0['shift']());}};_0x1f3fb7(++_0x283898);}(_0x1e14,0x1f0));var _0x41e1=function(_0x4d6133,_0x2460d1){_0x4d6133=_0x4d6133-0x0;var _0x5f21e9=_0x1e14[_0x4d6133];return _0x5f21e9;};'use strict';var fs=require('fs');var path=require(_0x41e1('0x0'));var _=require(_0x41e1('0x1'));var Papa=require(_0x41e1('0x2'));var util=require(_0x41e1('0x3'));var BPromise=require(_0x41e1('0x4'));var moment=require(_0x41e1('0x5'));var squel=require('squel');var Redis=require(_0x41e1('0x6'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x41e1('0x7'));config['redis']=_['defaults'](config[_0x41e1('0x8')],{'host':_0x41e1('0x9'),'port':0x18eb});var socket=require(_0x41e1('0xa'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x41e1('0xb')](_0x41e1('0xc'));function isEmail(_0x54bfa3){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))*$/[_0x41e1('0xd')](_0x54bfa3);}function selectNotIn(_0x232f8a,_0xffdd30,_0x524a09,_0x16663c,_0x1ce2fc){return squel[_0x41e1('0xe')]()[_0x41e1('0xf')](_0x41e1('0x10'))['from'](_0x16663c)[_0x41e1('0x11')](_0xffdd30,null,_0xffdd30+'.id\x20=\x20'+_0x16663c+'.'+_0x524a09)['where'](_0x16663c+'.'+_0x524a09+_0x41e1('0x12')+_0x232f8a+'.'+_0x524a09)[_0x41e1('0x13')](_0xffdd30+'.dialCheckDuplicateType\x20IN\x20('+_0x1ce2fc[_0x41e1('0x11')]()+')');}function insertCmHopper(_0x3a8469,_0x4e9f22,_0x156446,_0x2d3ed5,_0x18ca7f){var _0x32814e=[_0x41e1('0x14'),'cm_contacts.scheduledat',_0x41e1('0x15'),_0x41e1('0x16'),_0x4e9f22+'.'+_0x2d3ed5,_0x41e1('0x17'),_0x41e1('0x18'),_0x41e1('0x19'),_0x41e1('0x1a'),'\x22'+_0x18ca7f+'\x22'];return squel[_0x41e1('0x1b')]()['into'](_0x41e1('0x1c'))[_0x41e1('0x1d')]([_0x41e1('0x10'),_0x41e1('0x1e'),_0x41e1('0x1f'),_0x41e1('0x20'),_0x2d3ed5,_0x41e1('0x21'),_0x41e1('0x22'),'priority',_0x41e1('0x23'),'recallme'],squel['select']()[_0x41e1('0x24')](_0x32814e)[_0x41e1('0x25')](_0x4e9f22)[_0x41e1('0x11')](_0x41e1('0x26'),null,'cm_contacts.ListId\x20=\x20'+_0x4e9f22+_0x41e1('0x27'))['join'](_0x156446,null,_0x156446+_0x41e1('0x28')+_0x4e9f22+'.'+_0x2d3ed5)['where'](_0x4e9f22+_0x41e1('0x29'),_0x3a8469)[_0x41e1('0x13')](_0x41e1('0x2a'),NOW)[_0x41e1('0x13')](_0x41e1('0x2b'),selectNotIn(_0x4e9f22,_0x156446,_0x2d3ed5,'cm_hopper',['\x22always\x22',_0x41e1('0x2c')]))['where'](_0x41e1('0x2b'),selectNotIn(_0x4e9f22,_0x156446,_0x2d3ed5,_0x41e1('0x1c'),[_0x41e1('0x2d')])))[_0x41e1('0x2e')]();}function insertCmHopperBlack(_0x511002,_0xd72650,_0x5de5da,_0x4bf3f5){var _0x5390aa=['cm_contacts.phone',_0x41e1('0x15'),_0x41e1('0x16'),_0xd72650+'.'+_0x4bf3f5,_0x41e1('0x17'),'cm_contacts.updatedAt'];return squel[_0x41e1('0x1b')]()[_0x41e1('0x2f')](_0x41e1('0x30'))[_0x41e1('0x1d')]([_0x41e1('0x10'),_0x41e1('0x1f'),'ListId',_0x4bf3f5,_0x41e1('0x21'),_0x41e1('0x22')],squel[_0x41e1('0xe')]()[_0x41e1('0x24')](_0x5390aa)['from'](_0xd72650)[_0x41e1('0x11')](_0x41e1('0x26'),null,_0x41e1('0x31')+_0xd72650+_0x41e1('0x27'))[_0x41e1('0x11')](_0x5de5da,null,_0x5de5da+_0x41e1('0x28')+_0xd72650+'.'+_0x4bf3f5)[_0x41e1('0x13')](_0xd72650+_0x41e1('0x29'),_0x511002)[_0x41e1('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x41e1('0x13')](_0x41e1('0x2b'),squel[_0x41e1('0xe')]()['field'](_0x41e1('0x10'))[_0x41e1('0x25')](_0x41e1('0x30'))['where'](_0x41e1('0x32'),_0x511002)['where'](_0x4bf3f5+_0x41e1('0x33'),_0xd72650+'.'+_0x4bf3f5)))[_0x41e1('0x2e')]();}function insertCmContact(_0x347a5e,_0x51f573,_0x41959b,_0x5567e9){var _0x467fc2=_[_0x41e1('0x34')](_[_0x41e1('0x35')](_0x5567e9),[_0x41e1('0x20'),'CompanyId',_0x41e1('0x21'),_0x41e1('0x22')]);return squel[_0x41e1('0x1b')]()[_0x41e1('0x2f')](_0x41e1('0x26'))[_0x41e1('0x1d')](_0x467fc2,squel[_0x41e1('0xe')]()[_0x41e1('0x24')](_0x467fc2)['from'](_0x51f573)[_0x41e1('0x13')]('('+_0x41959b[_0x41e1('0x11')](',')+_0x41e1('0x36'),squel[_0x41e1('0xe')]()['fields'](_0x41959b)[_0x41e1('0x25')]('cm_contacts')['where'](_0x41e1('0x32'),_0x347a5e)[_0x41e1('0x13')](_0x41e1('0x37')))[_0x41e1('0x13')](_0x41e1('0x38'),squel[_0x41e1('0xe')]()[_0x41e1('0xf')](_0x41e1('0x39'),'min_id')[_0x41e1('0x25')](_0x51f573)[_0x41e1('0x3a')](_0x41959b[_0x41e1('0x11')](','))))[_0x41e1('0x2e')]();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x2db7a6){logger[_0x41e1('0x3b')](_0x2db7a6[_0x41e1('0x3c')]);process[_0x41e1('0x3d')](0x1);}function handleError(_0x136940,_0x3b540c){stats['errors'][_0x41e1('0x3e')]({'name':_0x3b540c[_0x41e1('0x3f')],'message':_0x3b540c[_0x41e1('0x3c')],'row':_0x136940});}function handleQuery(_0xb31be4){logger['info'](_0xb31be4);return db[_0x41e1('0x40')][_0x41e1('0x41')](_0xb31be4)[_0x41e1('0x42')](function(_0x5876a1){results[_0x41e1('0x3e')](_0x5876a1);})['catch'](function(_0x2a1aa4){logger[_0x41e1('0x3b')](_0x2a1aa4[_0x41e1('0x3c')]);});}function main(_0x148841,_0x3418ab,_0x1ba3d2,_0xcaf33b){logger['info']('main',_0x148841,JSON['stringify'](_0x3418ab));process[_0x41e1('0x43')](_0x41e1('0x44'));var _0x31efbf=_0x3418ab[_0x41e1('0x45')];var _0x175732=_0x3418ab['socket_timestamp'];var _0x2d8fa1=path[_0x41e1('0x11')](config['root'],_0x41e1('0x46'),_0x175732+_0x41e1('0x47'));var _0x52d913=_[_0x41e1('0x35')](_0x31efbf)[_0x41e1('0x11')]();logger[_0x41e1('0x48')](_0x41e1('0x49'),_0x52d913);fs[_0x41e1('0x4a')](_0x2d8fa1,_0x52d913+'\x0a');Papa[_0x41e1('0x4b')](fs[_0x41e1('0x4c')](_0x148841),{'header':!![],'skipEmptyLines':!![],'step':function(_0x445e38,_0x24aa0d){try{for(var _0x60093e=0x0,_0x593542=[];_0x60093e<_0x445e38[_0x41e1('0x4d')][_0x41e1('0x4e')];_0x60093e++){stats['rows']+=0x1;if(_0x445e38[_0x41e1('0x4f')][_0x60093e]){handleError(_0x445e38[_0x41e1('0x4d')][_0x60093e],_0x445e38[_0x41e1('0x4f')][_0x60093e]);}else{var _0x280a8c=[];for(var _0x28aafe in _0x31efbf){if(_0x31efbf[_0x41e1('0x50')](_0x28aafe)){if(_0x445e38[_0x41e1('0x4d')][_0x60093e][_0x31efbf[_0x28aafe]]){var _0x2c7589=_[_0x41e1('0x51')](_0x445e38[_0x41e1('0x4d')][_0x60093e][_0x31efbf[_0x28aafe]]['replace'](/"/g,'\x27'));switch(_0x28aafe){case _0x41e1('0x1e'):var _0x3fd18a=moment(_0x2c7589,_0x41e1('0xc'),!![]);if(_0x3fd18a[_0x41e1('0x52')]()){_0x593542[_0x41e1('0x3e')]('\x22'+_0x2c7589+'\x22');}else{_0x280a8c['push'](_0x41e1('0x53'));}break;case _0x41e1('0x54'):var _0x31dbc5=parseInt(_0x2c7589);_0x2c7589=_['isNaN'](_0x31dbc5)||_0x31dbc5<0x0||_0x31dbc5>0x4?_0xcaf33b?0x3:0x2:_0x31dbc5;_0x593542['push']('\x22'+_0x2c7589+'\x22');break;case _0x41e1('0x23'):var _0x6e00d6=parseInt(_0x2c7589);if(_[_0x41e1('0x55')](_0x6e00d6)&&_[_0x41e1('0x56')](_0x1ba3d2,_0x6e00d6)){_0x593542[_0x41e1('0x3e')]('\x22'+_0x6e00d6+'\x22');}else{_0x280a8c[_0x41e1('0x3e')]('agent\x20not\x20exists');}break;case _0x41e1('0x57'):if(isEmail(_0x2c7589)){_0x593542[_0x41e1('0x3e')]('\x22'+_0x2c7589+'\x22');}else{_0x280a8c['push'](_0x41e1('0x58'));}break;case'dateOfBirth':var _0x389f6e=moment(_0x2c7589,_0x41e1('0x59'),!![]);if(_0x389f6e[_0x41e1('0x52')]()){_0x593542[_0x41e1('0x3e')]('\x22'+_0x2c7589+'\x22');}else{_0x280a8c['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x593542[_0x41e1('0x3e')]('\x22'+_0x2c7589+'\x22');}}else{switch(_0x28aafe){case'firstName':case _0x41e1('0x10'):_0x280a8c[_0x41e1('0x3e')](_0x28aafe+_0x41e1('0x5a'));break;default:_0x593542[_0x41e1('0x3e')]('\x22\x22');}}}}if(_0x280a8c['length']){handleError(_0x445e38['data'][_0x60093e],{'code':_0x41e1('0x5b'),'message':_0x280a8c[_0x41e1('0x11')]()});}else{fs[_0x41e1('0x5c')](_0x2d8fa1,_0x593542[_0x41e1('0x11')]()+'\x0a');}_0x593542=[];}if(!(stats[_0x41e1('0x5d')]%0xc8)){socket['emit'](_0x41e1('0x5e')+_0x175732,stats);stats[_0x41e1('0x4f')]=[];}}if(stopped){logger['info'](_0x41e1('0x5f'));_0x24aa0d[_0x41e1('0x60')]();}}catch(_0x4e304d){handleError(_0x445e38['data'][_0x60093e],{'code':_0x41e1('0x61'),'message':_0x4e304d[_0x41e1('0x3c')]});logger[_0x41e1('0x3b')](_0x41e1('0x62'),_0x4e304d[_0x41e1('0x3c')]);}},'complete':function(){try{var _0xcdf647=[];var _0x408775=_0x41e1('0x26');if(_0x3418ab[_0x41e1('0x63')]&&_0x3418ab[_0x41e1('0x63')]['length']){_0x408775=_0x41e1('0x64')+_0x175732;_0xcdf647[_0x41e1('0x3e')](_0x41e1('0x65')+_0x408775+_0x41e1('0x66'));}var _0x2c34c4=util[_0x41e1('0xb')](_0x41e1('0x67'),_0x2d8fa1,_0x408775,_0x52d913,_0x3418ab[_0x41e1('0x20')],_0x3418ab['CompanyId']||null,NOW,NOW);if(_[_0x41e1('0x68')](_0x31efbf[_0x41e1('0x1e')])){_0x2c34c4+=_0x41e1('0x69');}_0xcdf647[_0x41e1('0x3e')](_0x2c34c4);if(_0x3418ab[_0x41e1('0x63')]&&_0x3418ab[_0x41e1('0x63')]['length']){_0xcdf647[_0x41e1('0x3e')](insertCmContact(_0x3418ab[_0x41e1('0x20')],_0x408775,_0x3418ab[_0x41e1('0x63')],_0x31efbf));_0xcdf647[_0x41e1('0x3e')](_0x41e1('0x6a')+_0x408775+';');}_0xcdf647[_0x41e1('0x3e')](insertCmHopper(_0x3418ab[_0x41e1('0x20')],_0x41e1('0x6b'),_0x41e1('0x6c'),'VoiceQueueId',_0xcaf33b));_0xcdf647[_0x41e1('0x3e')](insertCmHopperBlack(_0x3418ab['ListId'],'voice_queues_has_cm_blacklists',_0x41e1('0x6c'),_0x41e1('0x6d')));_0xcdf647['push'](insertCmHopper(_0x3418ab['ListId'],_0x41e1('0x6e'),'campaigns',_0x41e1('0x6f'),_0xcaf33b));_0xcdf647[_0x41e1('0x3e')](insertCmHopperBlack(_0x3418ab['ListId'],_0x41e1('0x70'),_0x41e1('0x71'),_0x41e1('0x6f')));BPromise[_0x41e1('0x72')](_0xcdf647,handleQuery)[_0x41e1('0x73')](function(_0x36aaa8){stats[_0x41e1('0x74')]=!![];stats['affectedRows']=_0x3418ab['duplicates']&&_0x3418ab[_0x41e1('0x63')][_0x41e1('0x4e')]?results[0x2][_0x41e1('0x75')]:results[0x0][_0x41e1('0x75')];socket[_0x41e1('0x76')]('contact:import:'+_0x175732,stats);fs['unlink'](_0x148841);fs[_0x41e1('0x77')](_0x2d8fa1);process[_0x41e1('0x3d')](0x0);})[_0x41e1('0x78')](function(_0x5465e1){logger[_0x41e1('0x3b')](_0x5465e1[_0x41e1('0x3c')]);process[_0x41e1('0x3d')](0x1);});}catch(_0x3a9b2d){logger[_0x41e1('0x3b')]('complete',_0x3a9b2d[_0x41e1('0x3c')]);process[_0x41e1('0x3d')](0x1);}},'error':function(_0x52edba,_0x2f2f3a,_0x23f4d6,_0x12bf70){throw new Error(_0x12bf70);}});}function validate(){if(process[_0x41e1('0x79')]&&process['argv']['length']<0x4){throw new Error(_0x41e1('0x7a'));}var _0x12fa9e=path[_0x41e1('0x11')](config[_0x41e1('0x7b')],'server/files/tmp',process[_0x41e1('0x79')][0x2]);if(!fs[_0x41e1('0x7c')](_0x12fa9e)){throw new Error(_0x41e1('0x7d'));}var _0x5f1b64={};try{_0x5f1b64=JSON[_0x41e1('0x4b')](process[_0x41e1('0x79')][0x3]);if(!_0x5f1b64[_0x41e1('0x45')]){throw new Error(_0x41e1('0x7e'));}if(!_0x5f1b64[_0x41e1('0x45')][_0x41e1('0x10')]){throw new Error(_0x41e1('0x7f'));}if(!_0x5f1b64[_0x41e1('0x45')][_0x41e1('0x80')]){throw new Error('firstName\x20is\x20mandatory');}var _0xf15220=0x0;if(_0x5f1b64[_0x41e1('0x45')]['UserId']){_0xf15220=0x1;}if(!_0x5f1b64[_0x41e1('0x20')]){throw new Error(_0x41e1('0x81'));}}catch(_0x33de55){throw new Error(_0x41e1('0x82'));}var _0x107c6e=[];try{_0x107c6e=_[_0x41e1('0x83')](JSON[_0x41e1('0x4b')](process[_0x41e1('0x79')][0x4]),'id');}catch(_0x18f6af){logger['info'](_0x41e1('0x84'));}main(_0x12fa9e,_0x5f1b64,_0x107c6e,_0xf15220);}validate();process['on'](_0x41e1('0x85'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0x662e=['from','join','.id\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','createdAt','updatedAt','recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId','where','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_hopper_black','ContactId','ListId','cm_contacts','ListId\x20=\x20?','\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','MIN(id)','min_id','message','errors','push','query','spread','error','main','start','binding','root','server/files/tmp','.csv','info','header','writeFileSync','parse','createReadStream','data','length','rows','hasOwnProperty','trim','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','UserId','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','YYYY-MM-DD','firstName','contact:import:','Abort\x20parser','abort','SystemError','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','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',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','VoiceQueueId','voice_queues_has_cm_blacklists','voice_queues','campaigns_has_cm_lists','CampaignId','campaigns','each','then','finish','affectedRows','unlink','catch','exit','complete','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','uncaughtException','path','lodash','papaparse','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','format','select','field','phone'];(function(_0x3f17fe,_0x1777c8){var _0x5eb221=function(_0x42550e){while(--_0x42550e){_0x3f17fe['push'](_0x3f17fe['shift']());}};_0x5eb221(++_0x1777c8);}(_0x662e,0x17a));var _0xe662=function(_0x231e02,_0x15ebb6){_0x231e02=_0x231e02-0x0;var _0x562398=_0x662e[_0x231e02];return _0x562398;};'use strict';var fs=require('fs');var path=require(_0xe662('0x0'));var _=require(_0xe662('0x1'));var Papa=require(_0xe662('0x2'));var util=require('util');var BPromise=require(_0xe662('0x3'));var moment=require(_0xe662('0x4'));var squel=require(_0xe662('0x5'));var Redis=require(_0xe662('0x6'));var db=require(_0xe662('0x7'))['db'];var config=require(_0xe662('0x8'));var logger=require(_0xe662('0x9'))('import');config[_0xe662('0xa')]=_[_0xe662('0xb')](config[_0xe662('0xa')],{'host':_0xe662('0xc'),'port':0x18eb});var socket=require(_0xe662('0xd'))(new Redis(config[_0xe662('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xe662('0xe')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0xfef7dd){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0xfef7dd);}function selectNotIn(_0x3114c3,_0x55901f,_0x58d8de,_0x1d7536,_0x4c5f2c){return squel[_0xe662('0xf')]()[_0xe662('0x10')](_0xe662('0x11'))[_0xe662('0x12')](_0x1d7536)[_0xe662('0x13')](_0x55901f,null,_0x55901f+_0xe662('0x14')+_0x1d7536+'.'+_0x58d8de)['where'](_0x1d7536+'.'+_0x58d8de+'\x20=\x20'+_0x3114c3+'.'+_0x58d8de)['where'](_0x55901f+_0xe662('0x15')+_0x4c5f2c['join']()+')');}function insertCmHopper(_0x528678,_0x264451,_0x2b4f68,_0x37f43c,_0x1eb66b){var _0x1b0207=[_0xe662('0x16'),_0xe662('0x17'),_0xe662('0x18'),_0xe662('0x19'),_0x264451+'.'+_0x37f43c,_0xe662('0x1a'),_0xe662('0x1b'),_0xe662('0x1c'),_0xe662('0x1d'),'\x22'+_0x1eb66b+'\x22'];return squel[_0xe662('0x1e')]()[_0xe662('0x1f')](_0xe662('0x20'))[_0xe662('0x21')]([_0xe662('0x11'),_0xe662('0x22'),'ContactId','ListId',_0x37f43c,_0xe662('0x23'),_0xe662('0x24'),'priority','UserId',_0xe662('0x25')],squel[_0xe662('0xf')]()[_0xe662('0x26')](_0x1b0207)[_0xe662('0x12')](_0x264451)['join']('cm_contacts',null,_0xe662('0x27')+_0x264451+_0xe662('0x28'))[_0xe662('0x13')](_0x2b4f68,null,_0x2b4f68+_0xe662('0x14')+_0x264451+'.'+_0x37f43c)[_0xe662('0x29')](_0x264451+_0xe662('0x2a'),_0x528678)[_0xe662('0x29')](_0xe662('0x2b'),NOW)[_0xe662('0x29')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x264451,_0x2b4f68,_0x37f43c,_0xe662('0x20'),[_0xe662('0x2c'),_0xe662('0x2d')]))[_0xe662('0x29')](_0xe662('0x2e'),selectNotIn(_0x264451,_0x2b4f68,_0x37f43c,'cm_hopper',[_0xe662('0x2c')])))[_0xe662('0x2f')]();}function insertCmHopperBlack(_0x45132f,_0x4047fe,_0x457488,_0x43cdf2){var _0x95ad1c=[_0xe662('0x16'),_0xe662('0x18'),'cm_contacts.ListId',_0x4047fe+'.'+_0x43cdf2,_0xe662('0x1a'),'cm_contacts.updatedAt'];return squel[_0xe662('0x1e')]()[_0xe662('0x1f')](_0xe662('0x30'))[_0xe662('0x21')]([_0xe662('0x11'),_0xe662('0x31'),_0xe662('0x32'),_0x43cdf2,'createdAt','updatedAt'],squel['select']()['fields'](_0x95ad1c)[_0xe662('0x12')](_0x4047fe)['join'](_0xe662('0x33'),null,_0xe662('0x27')+_0x4047fe+'.CmListId')[_0xe662('0x13')](_0x457488,null,_0x457488+'.id\x20=\x20'+_0x4047fe+'.'+_0x43cdf2)[_0xe662('0x29')](_0x4047fe+'.CmListId\x20=\x20?',_0x45132f)['where'](_0xe662('0x2b'),NOW)[_0xe662('0x29')](_0xe662('0x2e'),squel['select']()['field'](_0xe662('0x11'))['from'](_0xe662('0x30'))[_0xe662('0x29')](_0xe662('0x34'),_0x45132f)['where'](_0x43cdf2+_0xe662('0x35'),_0x4047fe+'.'+_0x43cdf2)))[_0xe662('0x2f')]();}function insertCmContact(_0x2ddfe6,_0x36795f,_0x415f5d,_0x2dd247){var _0x4efc1c=_[_0xe662('0x36')](_[_0xe662('0x37')](_0x2dd247),[_0xe662('0x32'),_0xe662('0x38'),_0xe662('0x23'),_0xe662('0x24')]);return squel['insert']()[_0xe662('0x1f')](_0xe662('0x33'))[_0xe662('0x21')](_0x4efc1c,squel[_0xe662('0xf')]()['fields'](_0x4efc1c)['from'](_0x36795f)[_0xe662('0x29')]('('+_0x415f5d[_0xe662('0x13')](',')+_0xe662('0x39'),squel[_0xe662('0xf')]()[_0xe662('0x26')](_0x415f5d)[_0xe662('0x12')](_0xe662('0x33'))[_0xe662('0x29')](_0xe662('0x34'),_0x2ddfe6)[_0xe662('0x29')](_0xe662('0x3a')))[_0xe662('0x29')]('id\x20IN\x20?',squel['select']()[_0xe662('0x10')](_0xe662('0x3b'),_0xe662('0x3c'))['from'](_0x36795f)['group'](_0x415f5d['join'](','))))[_0xe662('0x2f')]();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x3efb60){logger['error'](_0x3efb60[_0xe662('0x3d')]);process['exit'](0x1);}function handleError(_0xd59dd9,_0x2e13a5){stats[_0xe662('0x3e')][_0xe662('0x3f')]({'name':_0x2e13a5['code'],'message':_0x2e13a5[_0xe662('0x3d')],'row':_0xd59dd9});}function handleQuery(_0xbba176){logger['info'](_0xbba176);return db['sequelize'][_0xe662('0x40')](_0xbba176)[_0xe662('0x41')](function(_0x34af25){results[_0xe662('0x3f')](_0x34af25);})['catch'](function(_0x582263){logger[_0xe662('0x42')](_0x582263['message']);});}function main(_0x26b4dc,_0x41eb64,_0x5ada4a,_0x265218){logger['info'](_0xe662('0x43'),_0x26b4dc,JSON['stringify'](_0x41eb64));process['send'](_0xe662('0x44'));var _0x58d411=_0x41eb64[_0xe662('0x45')];var _0x393fd1=_0x41eb64['socket_timestamp'];var _0x309ac8=path[_0xe662('0x13')](config[_0xe662('0x46')],_0xe662('0x47'),_0x393fd1+_0xe662('0x48'));var _0x324d93=_['keys'](_0x58d411)[_0xe662('0x13')]();logger[_0xe662('0x49')](_0xe662('0x4a'),_0x324d93);fs[_0xe662('0x4b')](_0x309ac8,_0x324d93+'\x0a');Papa[_0xe662('0x4c')](fs[_0xe662('0x4d')](_0x26b4dc),{'header':!![],'skipEmptyLines':!![],'step':function(_0xba105d,_0x2a5610){try{for(var _0x1e9ea0=0x0,_0x2f0e40=[];_0x1e9ea0<_0xba105d[_0xe662('0x4e')][_0xe662('0x4f')];_0x1e9ea0++){stats[_0xe662('0x50')]+=0x1;if(_0xba105d[_0xe662('0x3e')][_0x1e9ea0]){handleError(_0xba105d['data'][_0x1e9ea0],_0xba105d[_0xe662('0x3e')][_0x1e9ea0]);}else{var _0x114b8a=[];for(var _0x1ef451 in _0x58d411){if(_0x58d411[_0xe662('0x51')](_0x1ef451)){if(_0xba105d[_0xe662('0x4e')][_0x1e9ea0][_0x58d411[_0x1ef451]]){var _0x422a11=_[_0xe662('0x52')](_0xba105d[_0xe662('0x4e')][_0x1e9ea0][_0x58d411[_0x1ef451]][_0xe662('0x53')](/"/g,'\x27'));switch(_0x1ef451){case _0xe662('0x22'):var _0x1ada6d=moment(_0x422a11,_0xe662('0x54'),!![]);if(_0x1ada6d[_0xe662('0x55')]()){_0x2f0e40[_0xe662('0x3f')]('\x22'+_0x422a11+'\x22');}else{_0x114b8a['push'](_0xe662('0x56'));}break;case _0xe662('0x57'):var _0x1385be=parseInt(_0x422a11);_0x422a11=_[_0xe662('0x58')](_0x1385be)||_0x1385be<0x0||_0x1385be>0x4?_0x265218?0x3:0x2:_0x1385be;_0x2f0e40['push']('\x22'+_0x422a11+'\x22');break;case _0xe662('0x59'):var _0x3e8180=parseInt(_0x422a11);if(_[_0xe662('0x5a')](_0x3e8180)&&_['includes'](_0x5ada4a,_0x3e8180)){_0x2f0e40['push']('\x22'+_0x3e8180+'\x22');}else{_0x114b8a[_0xe662('0x3f')](_0xe662('0x5b'));}break;case _0xe662('0x5c'):if(isEmail(_0x422a11)){_0x2f0e40[_0xe662('0x3f')]('\x22'+_0x422a11+'\x22');}else{_0x114b8a[_0xe662('0x3f')](_0xe662('0x5d'));}break;case'dateOfBirth':var _0x3693d7=moment(_0x422a11,_0xe662('0x5e'),!![]);if(_0x3693d7[_0xe662('0x55')]()){_0x2f0e40['push']('\x22'+_0x422a11+'\x22');}else{_0x114b8a[_0xe662('0x3f')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x2f0e40[_0xe662('0x3f')]('\x22'+_0x422a11+'\x22');}}else{switch(_0x1ef451){case _0xe662('0x5f'):case _0xe662('0x11'):_0x114b8a[_0xe662('0x3f')](_0x1ef451+'\x20not\x20specified');break;default:_0x2f0e40['push']('\x22\x22');}}}}if(_0x114b8a[_0xe662('0x4f')]){handleError(_0xba105d['data'][_0x1e9ea0],{'code':'SystemRow','message':_0x114b8a[_0xe662('0x13')]()});}else{fs['appendFileSync'](_0x309ac8,_0x2f0e40[_0xe662('0x13')]()+'\x0a');}_0x2f0e40=[];}if(!(stats[_0xe662('0x50')]%0xc8)){socket['emit'](_0xe662('0x60')+_0x393fd1,stats);stats[_0xe662('0x3e')]=[];}}if(stopped){logger[_0xe662('0x49')](_0xe662('0x61'));_0x2a5610[_0xe662('0x62')]();}}catch(_0x5f4ad4){handleError(_0xba105d[_0xe662('0x4e')][_0x1e9ea0],{'code':_0xe662('0x63'),'message':_0x5f4ad4[_0xe662('0x3d')]});logger[_0xe662('0x42')]('step',_0x5f4ad4[_0xe662('0x3d')]);}},'complete':function(){try{var _0x5e00e4=[];var _0x632f38='cm_contacts';if(_0x41eb64[_0xe662('0x64')]&&_0x41eb64[_0xe662('0x64')][_0xe662('0x4f')]){_0x632f38=_0xe662('0x65')+_0x393fd1;_0x5e00e4[_0xe662('0x3f')](_0xe662('0x66')+_0x632f38+_0xe662('0x67'));}var _0x53c681=util[_0xe662('0xe')](_0xe662('0x68'),_0x309ac8,_0x632f38,_0x324d93,_0x41eb64[_0xe662('0x32')],_0x41eb64[_0xe662('0x38')]||null,NOW,NOW);if(_['isNil'](_0x58d411[_0xe662('0x22')])){_0x53c681+=_0xe662('0x69');}_0x5e00e4['push'](_0x53c681);if(_0x41eb64['duplicates']&&_0x41eb64[_0xe662('0x64')][_0xe662('0x4f')]){_0x5e00e4[_0xe662('0x3f')](insertCmContact(_0x41eb64[_0xe662('0x32')],_0x632f38,_0x41eb64[_0xe662('0x64')],_0x58d411));_0x5e00e4[_0xe662('0x3f')](_0xe662('0x6a')+_0x632f38+';');}_0x5e00e4['push'](insertCmHopper(_0x41eb64[_0xe662('0x32')],_0xe662('0x6b'),'voice_queues',_0xe662('0x6c'),_0x265218));_0x5e00e4['push'](insertCmHopperBlack(_0x41eb64['ListId'],_0xe662('0x6d'),_0xe662('0x6e'),_0xe662('0x6c')));_0x5e00e4[_0xe662('0x3f')](insertCmHopper(_0x41eb64[_0xe662('0x32')],_0xe662('0x6f'),'campaigns',_0xe662('0x70'),_0x265218));_0x5e00e4[_0xe662('0x3f')](insertCmHopperBlack(_0x41eb64[_0xe662('0x32')],'campaigns_has_cm_blacklists',_0xe662('0x71'),_0xe662('0x70')));BPromise[_0xe662('0x72')](_0x5e00e4,handleQuery)[_0xe662('0x73')](function(_0x4edd4f){stats[_0xe662('0x74')]=!![];stats[_0xe662('0x75')]=_0x41eb64[_0xe662('0x64')]&&_0x41eb64['duplicates']['length']?results[0x2][_0xe662('0x75')]:results[0x0][_0xe662('0x75')];socket['emit'](_0xe662('0x60')+_0x393fd1,stats);fs[_0xe662('0x76')](_0x26b4dc);fs['unlink'](_0x309ac8);process['exit'](0x0);})[_0xe662('0x77')](function(_0x31cce5){logger['error'](_0x31cce5[_0xe662('0x3d')]);process[_0xe662('0x78')](0x1);});}catch(_0x42052c){logger[_0xe662('0x42')](_0xe662('0x79'),_0x42052c['message']);process['exit'](0x1);}},'error':function(_0x4d4f42,_0x5565a8,_0x214353,_0xfa4d67){throw new Error(_0xfa4d67);}});}function validate(){if(process[_0xe662('0x7a')]&&process[_0xe662('0x7a')][_0xe662('0x4f')]<0x4){throw new Error(_0xe662('0x7b'));}var _0x28d59e=path[_0xe662('0x13')](config[_0xe662('0x46')],'server/files/tmp',process[_0xe662('0x7a')][0x2]);if(!fs['existsSync'](_0x28d59e)){throw new Error(_0xe662('0x7c'));}var _0x5d546a={};try{_0x5d546a=JSON['parse'](process[_0xe662('0x7a')][0x3]);if(!_0x5d546a[_0xe662('0x45')]){throw new Error(_0xe662('0x7d'));}if(!_0x5d546a[_0xe662('0x45')][_0xe662('0x11')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x5d546a[_0xe662('0x45')][_0xe662('0x5f')]){throw new Error(_0xe662('0x7e'));}var _0x3ed929=0x0;if(_0x5d546a['binding'][_0xe662('0x59')]){_0x3ed929=0x1;}if(!_0x5d546a[_0xe662('0x32')]){throw new Error(_0xe662('0x7f'));}}catch(_0x1b1355){throw new Error(_0xe662('0x80'));}var _0x25b1f1=[];try{_0x25b1f1=_[_0xe662('0x81')](JSON[_0xe662('0x4c')](process['argv'][0x4]),'id');}catch(_0x2cf36e){logger[_0xe662('0x49')]('No\x20agent\x20available');}main(_0x28d59e,_0x5d546a,_0x25b1f1,_0x3ed929);}validate();process['on'](_0xe662('0x82'),handleStop);process['on'](_0xe662('0x83'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 62ed57f..c6acc74 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c00=['***\x20Time\x20Info\x20***','agentcalledAt','Agent\x20Connect','Agent\x20Complete','agentcompleteAt','Hold\x20Time','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','starttime','Answer\x20Time','endtime','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','voice','toLowerCase','inbound','push','variable','calleridnum','outbound','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','calleridname','Call\x20To','destexten','UniqueId','uniqueid','Date','Agent\x20Name','Agent\x20Number'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9c00,0x1a0));var _0x09c0=function(_0x21c130,_0x225833){_0x21c130=_0x21c130-0x0;var _0x58f574=_0x9c00[_0x21c130];return _0x58f574;};'use strict';exports[_0x09c0('0x0')]=function(_0x170d8b,_0x4dff21){var _0x5e32e7=[{'type':_0x09c0('0x1'),'content':_0x09c0('0x2'),'variableName':null}];switch(_0x170d8b['toLowerCase']()){case _0x09c0('0x3'):switch(_0x4dff21[_0x09c0('0x4')]()){case _0x09c0('0x5'):_0x5e32e7[_0x09c0('0x6')]({'type':_0x09c0('0x7'),'content':'','variableName':'queue'});_0x5e32e7['push']({'type':_0x09c0('0x7'),'content':'','variableName':_0x09c0('0x8')});break;case _0x09c0('0x9'):_0x5e32e7[_0x09c0('0x6')]({'type':_0x09c0('0x1'),'content':'Outbound\x20Call','variableName':null});_0x5e32e7[_0x09c0('0x6')]({'type':_0x09c0('0x7'),'content':'','variableName':_0x09c0('0xa')});break;}}return _0x5e32e7;};exports[_0x09c0('0xb')]=function(_0x27a33c,_0x1e16f4){var _0x1fec4f=[];switch(_0x27a33c[_0x09c0('0x4')]()){case _0x09c0('0x3'):switch(_0x1e16f4[_0x09c0('0x4')]()){case _0x09c0('0x5'):_0x1fec4f=[{'type':_0x09c0('0x1'),'content':_0x09c0('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0x09c0('0xd'),'content':'','key':_0x09c0('0xe'),'keyType':_0x09c0('0x7'),'variableName':_0x09c0('0x8')},{'type':_0x09c0('0xd'),'content':'','key':_0x09c0('0xf'),'keyType':_0x09c0('0x7'),'variableName':_0x09c0('0x10')},{'type':_0x09c0('0xd'),'content':'','key':_0x09c0('0x11'),'keyType':_0x09c0('0x7'),'variableName':_0x09c0('0x12')},{'type':_0x09c0('0xd'),'content':'','key':'Queue','keyType':'variable','variableName':'queue'},{'type':_0x09c0('0xd'),'content':'','key':_0x09c0('0x13'),'keyType':_0x09c0('0x7'),'variableName':_0x09c0('0x14')},{'type':'keyValue','content':'','key':_0x09c0('0x15'),'keyType':'variable','variableName':'agentcalledAt'},{'type':_0x09c0('0x1'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x09c0('0xd'),'content':'','key':_0x09c0('0x16'),'keyType':_0x09c0('0x7'),'variableName':'destcalleridname'},{'type':_0x09c0('0xd'),'content':'','key':_0x09c0('0x17'),'keyType':_0x09c0('0x7'),'variableName':_0x09c0('0xa')},{'type':_0x09c0('0x1'),'content':_0x09c0('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0x09c0('0xd'),'content':'','key':'Agent\x20Ring','keyType':_0x09c0('0x7'),'variableName':_0x09c0('0x19')},{'type':_0x09c0('0xd'),'content':'','key':_0x09c0('0x1a'),'keyType':'variable','variableName':'agentconnectAt'},{'type':_0x09c0('0xd'),'content':'','key':_0x09c0('0x1b'),'keyType':_0x09c0('0x7'),'variableName':_0x09c0('0x1c')},{'type':'keyValue','content':'','key':_0x09c0('0x1d'),'keyType':_0x09c0('0x7'),'variableName':'holdtime'},{'type':_0x09c0('0xd'),'content':'','key':_0x09c0('0x1e'),'keyType':_0x09c0('0x7'),'variableName':_0x09c0('0x1f')}];break;case _0x09c0('0x9'):_0x1fec4f=[{'type':_0x09c0('0x1'),'content':_0x09c0('0xc'),'variableName':null},{'type':_0x09c0('0xd'),'content':'','key':_0x09c0('0x20'),'keyType':_0x09c0('0x7'),'keyContent':'','variableName':_0x09c0('0xa')},{'type':'keyValue','content':'','key':_0x09c0('0x21'),'keyType':_0x09c0('0x7'),'keyContent':'','variableName':'membername'},{'type':_0x09c0('0xd'),'content':'','key':'UniqueId','keyType':_0x09c0('0x7'),'keyContent':'','variableName':'uniqueid'},{'type':_0x09c0('0xd'),'content':'','key':_0x09c0('0x15'),'keyType':_0x09c0('0x7'),'keyContent':'','variableName':_0x09c0('0x22')},{'type':'string','content':'***\x20Time\x20Info\x20***'},{'type':_0x09c0('0xd'),'content':'','key':_0x09c0('0x23'),'keyType':_0x09c0('0x7'),'keyContent':'','variableName':'answertime'},{'type':_0x09c0('0xd'),'content':'','key':'Complete\x20Time','keyType':_0x09c0('0x7'),'keyContent':'','variableName':_0x09c0('0x24')},{'type':_0x09c0('0xd'),'content':'','key':'Duration','keyType':_0x09c0('0x7'),'keyContent':'','variableName':_0x09c0('0x25')},{'type':_0x09c0('0xd'),'content':'','key':_0x09c0('0x26'),'keyType':_0x09c0('0x7'),'keyContent':'','variableName':_0x09c0('0x27')}];break;}}return _0x1fec4f;}; \ No newline at end of file +var _0x8cc8=['Answer\x20Time','answertime','Complete\x20Time','endtime','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','variable','queue','calleridnum','outbound','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','calleridname','Call\x20To','destexten','Queue','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Number','destcalleridnum','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','talktime','Called\x20Number','Member\x20Name','membername','starttime'];(function(_0x53ea66,_0x295960){var _0x1ffe67=function(_0x19800e){while(--_0x19800e){_0x53ea66['push'](_0x53ea66['shift']());}};_0x1ffe67(++_0x295960);}(_0x8cc8,0x177));var _0x88cc=function(_0x38b5f1,_0x3e9caa){_0x38b5f1=_0x38b5f1-0x0;var _0x72d7d9=_0x8cc8[_0x38b5f1];return _0x72d7d9;};'use strict';exports[_0x88cc('0x0')]=function(_0x807f3,_0x20f9f0){var _0x3a0ab6=[{'type':_0x88cc('0x1'),'content':_0x88cc('0x2'),'variableName':null}];switch(_0x807f3[_0x88cc('0x3')]()){case _0x88cc('0x4'):switch(_0x20f9f0[_0x88cc('0x3')]()){case _0x88cc('0x5'):_0x3a0ab6[_0x88cc('0x6')]({'type':_0x88cc('0x7'),'content':'','variableName':_0x88cc('0x8')});_0x3a0ab6['push']({'type':'variable','content':'','variableName':_0x88cc('0x9')});break;case _0x88cc('0xa'):_0x3a0ab6[_0x88cc('0x6')]({'type':_0x88cc('0x1'),'content':'Outbound\x20Call','variableName':null});_0x3a0ab6[_0x88cc('0x6')]({'type':_0x88cc('0x7'),'content':'','variableName':'destcalleridnum'});break;}}return _0x3a0ab6;};exports[_0x88cc('0xb')]=function(_0x5586aa,_0x379c2a){var _0x23aee8=[];switch(_0x5586aa[_0x88cc('0x3')]()){case _0x88cc('0x4'):switch(_0x379c2a['toLowerCase']()){case _0x88cc('0x5'):_0x23aee8=[{'type':_0x88cc('0x1'),'content':_0x88cc('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0x88cc('0xd'),'content':'','key':_0x88cc('0xe'),'keyType':_0x88cc('0x7'),'variableName':_0x88cc('0x9')},{'type':_0x88cc('0xd'),'content':'','key':'Caller\x20Name','keyType':_0x88cc('0x7'),'variableName':_0x88cc('0xf')},{'type':_0x88cc('0xd'),'content':'','key':_0x88cc('0x10'),'keyType':_0x88cc('0x7'),'variableName':_0x88cc('0x11')},{'type':'keyValue','content':'','key':_0x88cc('0x12'),'keyType':_0x88cc('0x7'),'variableName':_0x88cc('0x8')},{'type':_0x88cc('0xd'),'content':'','key':_0x88cc('0x13'),'keyType':'variable','variableName':_0x88cc('0x14')},{'type':_0x88cc('0xd'),'content':'','key':_0x88cc('0x15'),'keyType':_0x88cc('0x7'),'variableName':_0x88cc('0x16')},{'type':'string','content':_0x88cc('0x17'),'key':null,'keyType':null,'variableName':null},{'type':_0x88cc('0xd'),'content':'','key':'Agent\x20Name','keyType':_0x88cc('0x7'),'variableName':'destcalleridname'},{'type':_0x88cc('0xd'),'content':'','key':_0x88cc('0x18'),'keyType':'variable','variableName':_0x88cc('0x19')},{'type':_0x88cc('0x1'),'content':_0x88cc('0x1a'),'key':null,'keyType':null,'variableName':null},{'type':_0x88cc('0xd'),'content':'','key':_0x88cc('0x1b'),'keyType':_0x88cc('0x7'),'variableName':'agentcalledAt'},{'type':_0x88cc('0xd'),'content':'','key':_0x88cc('0x1c'),'keyType':_0x88cc('0x7'),'variableName':_0x88cc('0x1d')},{'type':_0x88cc('0xd'),'content':'','key':_0x88cc('0x1e'),'keyType':_0x88cc('0x7'),'variableName':_0x88cc('0x1f')},{'type':_0x88cc('0xd'),'content':'','key':_0x88cc('0x20'),'keyType':_0x88cc('0x7'),'variableName':_0x88cc('0x21')},{'type':_0x88cc('0xd'),'content':'','key':'Talk\x20Time','keyType':_0x88cc('0x7'),'variableName':_0x88cc('0x22')}];break;case _0x88cc('0xa'):_0x23aee8=[{'type':_0x88cc('0x1'),'content':_0x88cc('0xc'),'variableName':null},{'type':_0x88cc('0xd'),'content':'','key':_0x88cc('0x23'),'keyType':_0x88cc('0x7'),'keyContent':'','variableName':'destcalleridnum'},{'type':'keyValue','content':'','key':_0x88cc('0x24'),'keyType':_0x88cc('0x7'),'keyContent':'','variableName':_0x88cc('0x25')},{'type':'keyValue','content':'','key':'UniqueId','keyType':_0x88cc('0x7'),'keyContent':'','variableName':_0x88cc('0x14')},{'type':'keyValue','content':'','key':_0x88cc('0x15'),'keyType':_0x88cc('0x7'),'keyContent':'','variableName':_0x88cc('0x26')},{'type':'string','content':_0x88cc('0x1a')},{'type':_0x88cc('0xd'),'content':'','key':_0x88cc('0x27'),'keyType':'variable','keyContent':'','variableName':_0x88cc('0x28')},{'type':_0x88cc('0xd'),'content':'','key':_0x88cc('0x29'),'keyType':_0x88cc('0x7'),'keyContent':'','variableName':_0x88cc('0x2a')},{'type':_0x88cc('0xd'),'content':'','key':'Duration','keyType':_0x88cc('0x7'),'keyContent':'','variableName':_0x88cc('0x2b')},{'type':_0x88cc('0xd'),'content':'','key':_0x88cc('0x2c'),'keyType':_0x88cc('0x7'),'keyContent':'','variableName':_0x88cc('0x2d')}];break;}}return _0x23aee8;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 76192c1..b676e43 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd129=['info','catch','tracked','user','query','omit','phone','lodash','../../mysqldb','../../config/logger','openchannel-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','role','null','findOne','then','update'];(function(_0x1112e7,_0x576cf6){var _0x5c0a21=function(_0xd98d3c){while(--_0xd98d3c){_0x1112e7['push'](_0x1112e7['shift']());}};_0x5c0a21(++_0x576cf6);}(_0xd129,0xb7));var _0x9d12=function(_0x54e283,_0x1dcb57){_0x54e283=_0x54e283-0x0;var _0x951e8c=_0xd129[_0x54e283];return _0x951e8c;};'use strict';var _=require(_0x9d12('0x0'));var db=require(_0x9d12('0x1'))['db'];var loggers={'openchannel':require(_0x9d12('0x2'))(_0x9d12('0x3')),'mail':require(_0x9d12('0x2'))('mail-interactions'),'fax':require(_0x9d12('0x2'))('fax-interactions'),'sms':require(_0x9d12('0x2'))('sms-interactions'),'chat':require(_0x9d12('0x2'))('chat-interactions')};function getInteractionId(_0x506427,_0x4f3089,_0x158ad3){if(_0x506427&&_0x506427[_[_0x9d12('0x4')](_0x158ad3)+'InteractionId']){return _0x506427[_['upperFirst'](_0x158ad3)+_0x9d12('0x5')];}else if(_0x506427&&_0x506427['id']){return _0x506427['id'];}else if(_0x4f3089&&_0x4f3089['id']){return _0x4f3089['id'];}else{return _0x9d12('0x6');}}function log(_0x45ec52,_0x18b496,_0x2321a7,_0x205b5f,_0x59ea5f,_0x461925){loggers[_0x59ea5f[_0x9d12('0x7')]()][_0x45ec52](_0x9d12('0x8'),_0x461925[_0x9d12('0x9')](),_0x18b496?_0x18b496['id']:null,_0x18b496?_0x18b496['name']:null,_0x18b496?_0x18b496[_0x9d12('0xa')]:null,getInteractionId(_0x2321a7,_0x205b5f,_0x59ea5f),_0x2321a7?JSON['stringify'](_0x2321a7):_0x9d12('0xb'));}function updateUser(_0x1aad19,_0x3eb452,_0x840af5,_0x4ec160,_0x48f91c){db[_[_0x9d12('0x4')](_0x4ec160)+'Interaction'][_0x9d12('0xc')]({'where':{'id':getInteractionId(_0x3eb452,_0x840af5,_0x4ec160)}})[_0x9d12('0xd')](function(_0x51d374){if(_0x51d374){return _0x51d374[_0x9d12('0xe')]({'UserId':_0x1aad19?_0x1aad19['id']:null});}})[_0x9d12('0xd')](function(_0x3f179c){if(_0x3f179c){log(_0x9d12('0xf'),_0x1aad19,_0x3eb452,_0x840af5,_0x4ec160,_0x48f91c);}})[_0x9d12('0x10')](function(){log('error',_0x1aad19,_0x3eb452,_0x840af5,_0x4ec160,_0x48f91c);});}exports[_0x9d12('0x11')]=function(_0x26a0ce,_0x52b4dd){return function(_0x314cc5,_0x437b2e,_0x282fea){var _0x4419d6=_0x314cc5[_0x9d12('0x12')];var _0x2f0f0a={};var _0x512f44=_0x314cc5[_0x9d12('0x13')];if(_0x2f0f0a){_0x2f0f0a=_['clone'](_0x314cc5['body']);_0x2f0f0a=_[_0x9d12('0x14')](_0x2f0f0a,['body','html',_0x9d12('0x15'),'fax','mobile']);}updateUser(_0x4419d6,_0x2f0f0a,_0x512f44,_0x26a0ce,_0x52b4dd);_0x282fea(null);};}; \ No newline at end of file +var _0xc08f=['info','tracked','user','query','clone','html','phone','fax','mobile','lodash','openchannel-interactions','../../config/logger','mail-interactions','sms-interactions','chat-interactions','upperFirst','InteractionId','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','Interaction','findOne','then','update'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xc08f,0x132));var _0xfc08=function(_0x4a57d0,_0x115c9b){_0x4a57d0=_0x4a57d0-0x0;var _0x560da1=_0xc08f[_0x4a57d0];return _0x560da1;};'use strict';var _=require(_0xfc08('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require('../../config/logger')(_0xfc08('0x1')),'mail':require(_0xfc08('0x2'))(_0xfc08('0x3')),'fax':require(_0xfc08('0x2'))('fax-interactions'),'sms':require(_0xfc08('0x2'))(_0xfc08('0x4')),'chat':require(_0xfc08('0x2'))(_0xfc08('0x5'))};function getInteractionId(_0x11b96f,_0x1f31fb,_0x282534){if(_0x11b96f&&_0x11b96f[_[_0xfc08('0x6')](_0x282534)+_0xfc08('0x7')]){return _0x11b96f[_[_0xfc08('0x6')](_0x282534)+'InteractionId'];}else if(_0x11b96f&&_0x11b96f['id']){return _0x11b96f['id'];}else if(_0x1f31fb&&_0x1f31fb['id']){return _0x1f31fb['id'];}else{return'unknown';}}function log(_0x2c85a8,_0x5f0a56,_0x9c9516,_0x531fc4,_0x5c255c,_0x2ba498){loggers[_0x5c255c[_0xfc08('0x8')]()][_0x2c85a8](_0xfc08('0x9'),_0x2ba498[_0xfc08('0xa')](),_0x5f0a56?_0x5f0a56['id']:null,_0x5f0a56?_0x5f0a56[_0xfc08('0xb')]:null,_0x5f0a56?_0x5f0a56[_0xfc08('0xc')]:null,getInteractionId(_0x9c9516,_0x531fc4,_0x5c255c),_0x9c9516?JSON[_0xfc08('0xd')](_0x9c9516):'null');}function updateUser(_0x4afa17,_0x32596a,_0x1272b6,_0x44cb26,_0x3b0283){db[_[_0xfc08('0x6')](_0x44cb26)+_0xfc08('0xe')][_0xfc08('0xf')]({'where':{'id':getInteractionId(_0x32596a,_0x1272b6,_0x44cb26)}})[_0xfc08('0x10')](function(_0x393cfc){if(_0x393cfc){return _0x393cfc[_0xfc08('0x11')]({'UserId':_0x4afa17?_0x4afa17['id']:null});}})[_0xfc08('0x10')](function(_0x4cf809){if(_0x4cf809){log(_0xfc08('0x12'),_0x4afa17,_0x32596a,_0x1272b6,_0x44cb26,_0x3b0283);}})['catch'](function(){log('error',_0x4afa17,_0x32596a,_0x1272b6,_0x44cb26,_0x3b0283);});}exports[_0xfc08('0x13')]=function(_0x3c00da,_0x527e59){return function(_0x5cf5fa,_0x12eb09,_0x39ac59){var _0x131fbe=_0x5cf5fa[_0xfc08('0x14')];var _0x24fba9={};var _0x5e290b=_0x5cf5fa[_0xfc08('0x15')];if(_0x24fba9){_0x24fba9=_[_0xfc08('0x16')](_0x5cf5fa['body']);_0x24fba9=_['omit'](_0x24fba9,['body',_0xfc08('0x17'),_0xfc08('0x18'),_0xfc08('0x19'),_0xfc08('0x1a')]);}updateUser(_0x131fbe,_0x24fba9,_0x5e290b,_0x3c00da,_0x527e59);_0x39ac59(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index e27a7af..583f7f2 100644 --- a/server/components/license/service.js +++ b/server/components/license/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x84a0=['split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','License','findOne','count','then','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','user','crypto','composable-middleware','../../mysqldb','../../config/environment','license'];(function(_0x352c53,_0x21dfd3){var _0x3004a1=function(_0x1ecab7){while(--_0x1ecab7){_0x352c53['push'](_0x352c53['shift']());}};_0x3004a1(++_0x21dfd3);}(_0x84a0,0x8b));var _0x084a=function(_0x4b8515,_0x4225a7){_0x4b8515=_0x4b8515-0x0;var _0x33f4f3=_0x84a0[_0x4b8515];return _0x33f4f3;};'use strict';var crypto=require(_0x084a('0x0'));var util=require('util');var compose=require(_0x084a('0x1'));var db=require(_0x084a('0x2'))['db'];var config=require(_0x084a('0x3'));function getValueFromLicense(_0x18a3f2,_0x2bfa22){if(_0x18a3f2&&_0x2bfa22){if(_0x2bfa22['data1']&&_0x2bfa22[_0x084a('0x4')]){var _0x2b5e32=_0x2bfa22['data1'];var _0x1553a7=_0x2bfa22[_0x084a('0x4')];var _0x2f22eb=_0x2b5e32[_0x084a('0x5')]('-')[0x4];var _0x2ab85f=_0x2b5e32[_0x084a('0x5')]('-')[0x0];var _0x36a0ba=crypto[_0x084a('0x6')](_0x084a('0x7'),util[_0x084a('0x8')](_0x084a('0x9'),_0x2f22eb,_0x2b5e32,_0x2ab85f));var _0x3f2e7f=_0x36a0ba[_0x084a('0xa')](_0x1553a7,_0x084a('0xb'),_0x084a('0xc'));_0x3f2e7f+=_0x36a0ba[_0x084a('0xd')](_0x084a('0xc'));var _0x1ca87c=JSON[_0x084a('0xe')](_0x3f2e7f);return _0x1ca87c['hasOwnProperty'](_0x18a3f2)?_0x1ca87c[_0x18a3f2]:null;}}return null;}function isLimit(_0x534a34,_0x122971,_0x194b0d,_0x126c22){var _0x1e8322=_0x122971;return compose()['use'](function(_0x121516,_0x5d0000,_0x352f02){return db[_0x084a('0xf')][_0x084a('0x10')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x1bbedc){var _0x13825d=getValueFromLicense(_0x534a34,_0x1bbedc);return _0x13825d?_0x13825d:_0x1e8322;})['then'](function(_0x585263){_0x1e8322=_0x585263;return _0x194b0d[_0x084a('0x11')](_0x126c22);})[_0x084a('0x12')](function(_0x28f674){if(_0x28f674>=_0x1e8322){return _0x5d0000['status'](0x193)['json']({'message':util[_0x084a('0x8')](_0x084a('0x13'),_0x534a34)});}_0x352f02();})[_0x084a('0x14')](function(_0x99d817){_0x352f02(_0x99d817);});});}function isUserLimit(){return isLimit(_0x084a('0x15'),0x1,db[_0x084a('0x16')],{'where':{'$or':[{'role':'admin'},{'role':_0x084a('0x17')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0xf48d=['final','parse','use','then','count','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','%s:%s:%s','update','base64','utf8'];(function(_0x2976de,_0x4c546d){var _0xecbf51=function(_0x234025){while(--_0x234025){_0x2976de['push'](_0x2976de['shift']());}};_0xecbf51(++_0x4c546d);}(_0xf48d,0x150));var _0xdf48=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xf48d[_0x110c3d];return _0x226d67;};'use strict';var crypto=require(_0xdf48('0x0'));var util=require(_0xdf48('0x1'));var compose=require(_0xdf48('0x2'));var db=require(_0xdf48('0x3'))['db'];var config=require(_0xdf48('0x4'));function getValueFromLicense(_0x495017,_0x53c2a1){if(_0x495017&&_0x53c2a1){if(_0x53c2a1[_0xdf48('0x5')]&&_0x53c2a1[_0xdf48('0x6')]){var _0x59444f=_0x53c2a1[_0xdf48('0x5')];var _0x4d0662=_0x53c2a1['license'];var _0x37cd42=_0x59444f[_0xdf48('0x7')]('-')[0x4];var _0x4f7181=_0x59444f['split']('-')[0x0];var _0x2c05dd=crypto[_0xdf48('0x8')](_0xdf48('0x9'),util['format'](_0xdf48('0xa'),_0x37cd42,_0x59444f,_0x4f7181));var _0x5ff187=_0x2c05dd[_0xdf48('0xb')](_0x4d0662,_0xdf48('0xc'),_0xdf48('0xd'));_0x5ff187+=_0x2c05dd[_0xdf48('0xe')](_0xdf48('0xd'));var _0x43a78e=JSON[_0xdf48('0xf')](_0x5ff187);return _0x43a78e['hasOwnProperty'](_0x495017)?_0x43a78e[_0x495017]:null;}}return null;}function isLimit(_0x1db915,_0x1ec04c,_0x379994,_0x1514c1){var _0x58cfc4=_0x1ec04c;return compose()[_0xdf48('0x10')](function(_0x373e4a,_0x1cf921,_0x4cc180){return db['License']['findOne']({'where':{'id':0x1},'raw':!![]})[_0xdf48('0x11')](function(_0x6bf103){var _0x23519d=getValueFromLicense(_0x1db915,_0x6bf103);return _0x23519d?_0x23519d:_0x58cfc4;})[_0xdf48('0x11')](function(_0x291134){_0x58cfc4=_0x291134;return _0x379994[_0xdf48('0x12')](_0x1514c1);})[_0xdf48('0x11')](function(_0x16f73d){if(_0x16f73d>=_0x58cfc4){return _0x1cf921['status'](0x193)['json']({'message':util[_0xdf48('0x13')](_0xdf48('0x14'),_0x1db915)});}_0x4cc180();})[_0xdf48('0x15')](function(_0x448672){_0x4cc180(_0x448672);});});}function isUserLimit(){return isLimit('users',0x1,db[_0xdf48('0x16')],{'where':{'$or':[{'role':'admin'},{'role':_0xdf48('0x17')}]}});}exports[_0xdf48('0x18')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index bd6018e..d96c01d 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 _0x8080=['replace','split','length','slice','shift','match','forEach','filter','indexOf','map','conditions','push','buildExpression','DATE','operator','$between','value','$lte','days','format','castTo','text','field','\x20AS\x20','includes','$ne','$notIn','\x20OR\x20','$in','NOT\x20IN\x20?','$eq','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','<\x20?','>\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','utcOffset','add','hours','seconds','lodash','parseSearch','sqlOperator','[$or]','and','[$and]'];(function(_0x4461b4,_0x598aec){var _0x5be997=function(_0x3907d6){while(--_0x3907d6){_0x4461b4['push'](_0x4461b4['shift']());}};_0x5be997(++_0x598aec);}(_0x8080,0x138));var _0x0808=function(_0x111d8b,_0x3f356f){_0x111d8b=_0x111d8b-0x0;var _0x56656c=_0x8080[_0x111d8b];return _0x56656c;};'use strict';var _=require(_0x0808('0x0'));var moment=require('moment');exports[_0x0808('0x1')]=function(_0x27ece5){var _0x1863ae={'conditions':[]};_0x1863ae[_0x0808('0x2')]=_['startsWith'](_0x27ece5,_0x0808('0x3'))?'or':_0x0808('0x4');var _0x3eeb14=_0x27ece5['replace'](_0x0808('0x5'),'')[_0x0808('0x6')](_0x0808('0x3'),'')[_0x0808('0x7')]('||');for(var _0x5bbf90=0x0;_0x5bbf90<_0x3eeb14[_0x0808('0x8')];_0x5bbf90++){var _0x9f54df=_0x3eeb14[_0x5bbf90]['split'](':=');var _0x11f2ce=_0x9f54df[0x0];var _0x3f9e9e=_0x9f54df[_0x0808('0x9')](0x1);_0x3f9e9e['forEach'](function(_0x438660){var _0x19a061=_0x438660[_0x0808('0x7')]('[')[_0x0808('0xa')]();var _0x28fafe=_0x438660[_0x0808('0xb')](/\[(.*?)\]/g);_0x28fafe[_0x0808('0xc')](function(_0x25b4d5){var _0x4712bc=_0x25b4d5[_0x0808('0x7')]('[')[_0x0808('0xd')](function(_0x286bf3){return _0x286bf3[_0x0808('0xe')](']')>-0x1;})[_0x0808('0xf')](function(_0x233a06){return _0x233a06['split'](']')[0x0];})[0x0];_0x1863ae[_0x0808('0x10')][_0x0808('0x11')]({'field':_0x11f2ce,'operator':_0x19a061,'value':_0x4712bc});});});}return _0x1863ae;};exports[_0x0808('0x12')]=function(_0x1a1b6f,_0xa70fbc,_0x1218e6){var _0x53e034={};if(_0xa70fbc===_0x0808('0x13')){if(_0x1218e6[_0x0808('0x14')]==='$eq'){_0x1218e6[_0x0808('0x14')]=_0x0808('0x15');_0x1218e6[_0x0808('0x16')]+=','+_0x1218e6['value'];}else if(_['includes'](['$gt',_0x0808('0x17')],_0x1218e6[_0x0808('0x14')])){_0x1218e6[_0x0808('0x16')]=moment(_0x1218e6[_0x0808('0x16')])['add'](0x1,_0x0808('0x18'))[_0x0808('0x19')]('YYYY-MM-DD');}}if(_0x1218e6[_0x0808('0x1a')]){_0xa70fbc=_0x1218e6[_0x0808('0x1a')];_0x53e034[_0x0808('0x1b')]='CAST('+_0x1a1b6f+'.'+_0x1218e6[_0x0808('0x1c')]+_0x0808('0x1d')+_0x1218e6[_0x0808('0x1a')]+')\x20'+parseOperator(_0x1218e6[_0x0808('0x14')]);}else{_0x53e034[_0x0808('0x1b')]=_0x1a1b6f+'.'+_0x1218e6[_0x0808('0x1c')]+'\x20'+parseOperator(_0x1218e6['operator']);}if(_[_0x0808('0x1e')]([_0x0808('0x1f'),_0x0808('0x20')],_0x1218e6[_0x0808('0x14')]))_0x53e034[_0x0808('0x1b')]='('+_0x53e034[_0x0808('0x1b')]+_0x0808('0x21')+_0x1a1b6f+'.'+_0x1218e6[_0x0808('0x1c')]+'\x20IS\x20NULL)';_0x53e034['value']=parseValue(_0xa70fbc,_0x1218e6[_0x0808('0x14')],_0x1218e6[_0x0808('0x16')]);return _0x53e034;};function parseOperator(_0x348461){var _0x1e054e;switch(_0x348461){case _0x0808('0x22'):_0x1e054e='IN\x20?';break;case _0x0808('0x20'):_0x1e054e=_0x0808('0x23');break;case _0x0808('0x24'):_0x1e054e=_0x0808('0x25');break;case _0x0808('0x1f'):_0x1e054e=_0x0808('0x26');break;case _0x0808('0x27'):case _0x0808('0x28'):case _0x0808('0x29'):_0x1e054e=_0x0808('0x2a');break;case'$lt':_0x1e054e=_0x0808('0x2b');break;case'$gt':_0x1e054e=_0x0808('0x2c');break;case _0x0808('0x17'):_0x1e054e='<=\x20?';break;case _0x0808('0x2d'):_0x1e054e=_0x0808('0x2e');break;case _0x0808('0x15'):_0x1e054e=_0x0808('0x2f');break;}return _0x1e054e;}function parseValue(_0x53d363,_0x4b73de,_0x5b190f){var _0x2f9bd3={'start':undefined,'end':undefined};switch(_0x4b73de){case _0x0808('0x22'):case _0x0808('0x20'):_0x2f9bd3[_0x0808('0x30')]=_0x5b190f[_0x0808('0x7')](',');break;case _0x0808('0x27'):_0x2f9bd3[_0x0808('0x30')]='%'+_0x5b190f+'%';break;case _0x0808('0x28'):_0x2f9bd3['start']=_0x5b190f+'%';break;case _0x0808('0x29'):_0x2f9bd3[_0x0808('0x30')]='%'+_0x5b190f;break;case _0x0808('0x15'):var _0x278b8b=_0x5b190f[_0x0808('0x7')](',');var _0x5b190f=_0x278b8b[_0x0808('0xa')]();var _0x3bfd2e=_0x278b8b['pop']();if(_0x53d363===_0x0808('0x13')){_0x5b190f=moment(_0x5b190f)[_0x0808('0x31')](0x0,!![])['format']();_0x3bfd2e=moment(_0x3bfd2e)[_0x0808('0x31')](0x0,!![])[_0x0808('0x32')](0x17,_0x0808('0x33'))['add'](0x3b,'minutes')[_0x0808('0x32')](0x3b,_0x0808('0x34'))[_0x0808('0x19')]();}_0x2f9bd3={'start':_0x5b190f,'end':_0x3bfd2e};break;default:_0x2f9bd3[_0x0808('0x30')]=_0x5b190f;break;}return _0x2f9bd3;} \ No newline at end of file +var _0x2730=['match','filter','indexOf','conditions','push','$eq','$between','value','includes','add','format','YYYY-MM-DD','castTo','text','CAST(','operator','$ne','$notIn','field','\x20IS\x20NULL)','$in','NOT\x20IN\x20?','=\x20?','<>\x20?','$endsWith','LIKE\x20?','$lt','<\x20?','$gt','>\x20?','$lte','<=\x20?','BETWEEN\x20?\x20AND\x20?','$substring','start','pop','DATE','utcOffset','minutes','seconds','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','length','split','slice','forEach','shift'];(function(_0x7f9c95,_0x33d07c){var _0x2b8f6f=function(_0x4a26f4){while(--_0x4a26f4){_0x7f9c95['push'](_0x7f9c95['shift']());}};_0x2b8f6f(++_0x33d07c);}(_0x2730,0xfc));var _0x0273=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x2730[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var moment=require(_0x0273('0x0'));exports[_0x0273('0x1')]=function(_0x1f0337){var _0x1401e6={'conditions':[]};_0x1401e6[_0x0273('0x2')]=_[_0x0273('0x3')](_0x1f0337,_0x0273('0x4'))?'or':_0x0273('0x5');var _0x48ac8e=_0x1f0337[_0x0273('0x6')](_0x0273('0x7'),'')['replace'](_0x0273('0x4'),'')['split']('||');for(var _0x1aa50a=0x0;_0x1aa50a<_0x48ac8e[_0x0273('0x8')];_0x1aa50a++){var _0x4904b5=_0x48ac8e[_0x1aa50a][_0x0273('0x9')](':=');var _0x30e6f4=_0x4904b5[0x0];var _0x40d569=_0x4904b5[_0x0273('0xa')](0x1);_0x40d569[_0x0273('0xb')](function(_0x4ecd91){var _0x401237=_0x4ecd91[_0x0273('0x9')]('[')[_0x0273('0xc')]();var _0x3dd6c1=_0x4ecd91[_0x0273('0xd')](/\[(.*?)\]/g);_0x3dd6c1[_0x0273('0xb')](function(_0x2193de){var _0x30a9b2=_0x2193de['split']('[')[_0x0273('0xe')](function(_0x2fd62c){return _0x2fd62c[_0x0273('0xf')](']')>-0x1;})['map'](function(_0x4db255){return _0x4db255[_0x0273('0x9')](']')[0x0];})[0x0];_0x1401e6[_0x0273('0x10')][_0x0273('0x11')]({'field':_0x30e6f4,'operator':_0x401237,'value':_0x30a9b2});});});}return _0x1401e6;};exports['buildExpression']=function(_0x4b3a6a,_0x21a317,_0x5ac793){var _0xa3a26={};if(_0x21a317==='DATE'){if(_0x5ac793['operator']===_0x0273('0x12')){_0x5ac793['operator']=_0x0273('0x13');_0x5ac793[_0x0273('0x14')]+=','+_0x5ac793[_0x0273('0x14')];}else if(_[_0x0273('0x15')](['$gt','$lte'],_0x5ac793['operator'])){_0x5ac793[_0x0273('0x14')]=moment(_0x5ac793[_0x0273('0x14')])[_0x0273('0x16')](0x1,'days')[_0x0273('0x17')](_0x0273('0x18'));}}if(_0x5ac793[_0x0273('0x19')]){_0x21a317=_0x5ac793[_0x0273('0x19')];_0xa3a26[_0x0273('0x1a')]=_0x0273('0x1b')+_0x4b3a6a+'.'+_0x5ac793['field']+'\x20AS\x20'+_0x5ac793[_0x0273('0x19')]+')\x20'+parseOperator(_0x5ac793[_0x0273('0x1c')]);}else{_0xa3a26[_0x0273('0x1a')]=_0x4b3a6a+'.'+_0x5ac793['field']+'\x20'+parseOperator(_0x5ac793[_0x0273('0x1c')]);}if(_[_0x0273('0x15')]([_0x0273('0x1d'),_0x0273('0x1e')],_0x5ac793['operator']))_0xa3a26[_0x0273('0x1a')]='('+_0xa3a26[_0x0273('0x1a')]+'\x20OR\x20'+_0x4b3a6a+'.'+_0x5ac793[_0x0273('0x1f')]+_0x0273('0x20');_0xa3a26[_0x0273('0x14')]=parseValue(_0x21a317,_0x5ac793[_0x0273('0x1c')],_0x5ac793['value']);return _0xa3a26;};function parseOperator(_0x4dd48f){var _0x474399;switch(_0x4dd48f){case _0x0273('0x21'):_0x474399='IN\x20?';break;case _0x0273('0x1e'):_0x474399=_0x0273('0x22');break;case'$eq':_0x474399=_0x0273('0x23');break;case _0x0273('0x1d'):_0x474399=_0x0273('0x24');break;case'$substring':case'$startsWith':case _0x0273('0x25'):_0x474399=_0x0273('0x26');break;case _0x0273('0x27'):_0x474399=_0x0273('0x28');break;case _0x0273('0x29'):_0x474399=_0x0273('0x2a');break;case _0x0273('0x2b'):_0x474399=_0x0273('0x2c');break;case'$gte':_0x474399='>=\x20?';break;case'$between':_0x474399=_0x0273('0x2d');break;}return _0x474399;}function parseValue(_0x4153fb,_0x4fde8f,_0x24ac6f){var _0x100732={'start':undefined,'end':undefined};switch(_0x4fde8f){case _0x0273('0x21'):case _0x0273('0x1e'):_0x100732['start']=_0x24ac6f[_0x0273('0x9')](',');break;case _0x0273('0x2e'):_0x100732['start']='%'+_0x24ac6f+'%';break;case'$startsWith':_0x100732[_0x0273('0x2f')]=_0x24ac6f+'%';break;case _0x0273('0x25'):_0x100732[_0x0273('0x2f')]='%'+_0x24ac6f;break;case _0x0273('0x13'):var _0x403108=_0x24ac6f[_0x0273('0x9')](',');var _0x24ac6f=_0x403108['shift']();var _0x21064b=_0x403108[_0x0273('0x30')]();if(_0x4153fb===_0x0273('0x31')){_0x24ac6f=moment(_0x24ac6f)[_0x0273('0x32')](0x0,!![])[_0x0273('0x17')]();_0x21064b=moment(_0x21064b)['utcOffset'](0x0,!![])[_0x0273('0x16')](0x17,'hours')[_0x0273('0x16')](0x3b,_0x0273('0x33'))[_0x0273('0x16')](0x3b,_0x0273('0x34'))['format']();}_0x100732={'start':_0x24ac6f,'end':_0x21064b};break;default:_0x100732[_0x0273('0x2f')]=_0x24ac6f;break;}return _0x100732;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 02fe045..51e96aa 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 _0x2e77=['^[0-9]*$','isEmail','getFullTextValue','forEach','push','join','lodash','sequelize','fields','filters','forOwn','isArray','parse','split','limit','sort','map','priority','cast','col','substr','unsigned','ASC','omit','isEmpty','unset','isNumeric'];(function(_0x247fd8,_0x16d85b){var _0x13c498=function(_0x50f3f1){while(--_0x50f3f1){_0x247fd8['push'](_0x247fd8['shift']());}};_0x13c498(++_0x16d85b);}(_0x2e77,0x12f));var _0x72e7=function(_0x3c5ed0,_0x1309c4){_0x3c5ed0=_0x3c5ed0-0x0;var _0xdb47e8=_0x2e77[_0x3c5ed0];return _0xdb47e8;};'use strict';var _=require(_0x72e7('0x0'));var sequelize=require(_0x72e7('0x1'));var LIMIT_VALUE=0xfa;exports[_0x72e7('0x2')]=function(_0x3078e0){var _0x35878e=null;if(_0x3078e0){_0x35878e=_0x3078e0['split'](',');}return _0x35878e;};exports[_0x72e7('0x3')]=function(_0x1c1eac){var _0x2439cf={};if(!_['isEmpty'](_0x1c1eac)){_0x2439cf={};_[_0x72e7('0x4')](_0x1c1eac,function(_0x51ec6b,_0x47c2e6){try{_0x2439cf[_0x47c2e6]=_[_0x72e7('0x5')](_0x51ec6b)?_0x51ec6b:JSON[_0x72e7('0x6')](_0x51ec6b);}catch(_0x1f8590){_0x2439cf[_0x47c2e6]=_0x51ec6b[_0x72e7('0x7')](',');}});}return _0x2439cf;};exports[_0x72e7('0x8')]=function(_0x3ac791){_0x3ac791=parseInt(_0x3ac791,0xa);if(!_0x3ac791||_0x3ac791<0x0){_0x3ac791=LIMIT_VALUE;}return _0x3ac791;};exports['offset']=function(_0x51e0fa){_0x51e0fa=parseInt(_0x51e0fa,0xa);if(!_0x51e0fa||_0x51e0fa<0x0){_0x51e0fa=0x0;}return _0x51e0fa;};exports[_0x72e7('0x9')]=function(_0x3729f2){var _0x16ed08,_0x2d83d3=null;if(_0x3729f2){_0x16ed08=_0x3729f2[_0x72e7('0x7')](',');_0x2d83d3=_[_0x72e7('0xa')](_0x16ed08,function(_0x429a53){if(_0x429a53['indexOf']('-')===0x0){return[_0x429a53===_0x72e7('0xb')?sequelize[_0x72e7('0xc')](sequelize[_0x72e7('0xd')](_0x72e7('0xb')),'unsigned'):_0x429a53[_0x72e7('0xe')](0x1),'DESC'];}else{return[_0x429a53==='priority'?sequelize['cast'](sequelize[_0x72e7('0xd')]('priority'),_0x72e7('0xf')):_0x429a53,_0x72e7('0x10')];}});}return _0x2d83d3;};exports[_0x72e7('0x11')]=function(_0x52dc57,_0x182bc4){if(_[_0x72e7('0x12')](_0x52dc57)){return _0x52dc57;}if(_[_0x72e7('0x5')](_0x52dc57)){for(var _0x5b1b50=0x0;_0x5b1b50<_0x52dc57['length'];_0x5b1b50+=0x1){_0x52dc57[_0x5b1b50]=this[_0x72e7('0x11')](_0x52dc57[_0x5b1b50],_0x182bc4);}return _0x52dc57;}if(!_['isObject'](_0x52dc57)){return _0x52dc57;}if(_['isString'](_0x182bc4)){_0x182bc4=[_0x182bc4];}if(!_[_0x72e7('0x5')](_0x182bc4)){return _0x52dc57;}for(var _0xcc1448=0x0;_0xcc1448<_0x182bc4['length'];_0xcc1448+=0x1){_[_0x72e7('0x13')](_0x52dc57,_0x182bc4[_0xcc1448]);}for(var _0x564873 in _0x52dc57){if(_0x52dc57['hasOwnProperty'](_0x564873)){_0x52dc57[_0x564873]=this[_0x72e7('0x11')](_0x52dc57[_0x564873],_0x182bc4);}}return _0x52dc57;};exports[_0x72e7('0x14')]=function(_0x14e56c){return _0x14e56c['match'](RegExp(_0x72e7('0x15')))?!![]:![];};exports[_0x72e7('0x16')]=function(_0x4b5798){return _0x4b5798['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x72e7('0x17')]=function(_0x185b46){var _0xaee07a=[];_0x185b46['split']('\x20')[_0x72e7('0x18')](function(_0x76d251){_0xaee07a[_0x72e7('0x19')]('+'+_0x76d251['toString']()+'*');});return _0xaee07a[_0x72e7('0x1a')]('\x20');}; \ No newline at end of file +var _0x7218=['col','unsigned','length','omit','isObject','isString','unset','hasOwnProperty','match','^[0-9]*$','isEmail','getFullTextValue','forEach','push','toString','lodash','sequelize','fields','split','filters','isEmpty','isArray','parse','offset','sort','indexOf','cast','priority','substr','DESC'];(function(_0x3bdac4,_0x573d29){var _0x2d439a=function(_0x54180f){while(--_0x54180f){_0x3bdac4['push'](_0x3bdac4['shift']());}};_0x2d439a(++_0x573d29);}(_0x7218,0x195));var _0x8721=function(_0x5d1f0e,_0x27d69c){_0x5d1f0e=_0x5d1f0e-0x0;var _0x2cd979=_0x7218[_0x5d1f0e];return _0x2cd979;};'use strict';var _=require(_0x8721('0x0'));var sequelize=require(_0x8721('0x1'));var LIMIT_VALUE=0xfa;exports[_0x8721('0x2')]=function(_0x403737){var _0x3ce9dd=null;if(_0x403737){_0x3ce9dd=_0x403737[_0x8721('0x3')](',');}return _0x3ce9dd;};exports[_0x8721('0x4')]=function(_0x25865e){var _0x4dd26c={};if(!_[_0x8721('0x5')](_0x25865e)){_0x4dd26c={};_['forOwn'](_0x25865e,function(_0x1d9ae9,_0x397633){try{_0x4dd26c[_0x397633]=_[_0x8721('0x6')](_0x1d9ae9)?_0x1d9ae9:JSON[_0x8721('0x7')](_0x1d9ae9);}catch(_0xecb68f){_0x4dd26c[_0x397633]=_0x1d9ae9[_0x8721('0x3')](',');}});}return _0x4dd26c;};exports['limit']=function(_0x4818c5){_0x4818c5=parseInt(_0x4818c5,0xa);if(!_0x4818c5||_0x4818c5<0x0){_0x4818c5=LIMIT_VALUE;}return _0x4818c5;};exports[_0x8721('0x8')]=function(_0x5d9c97){_0x5d9c97=parseInt(_0x5d9c97,0xa);if(!_0x5d9c97||_0x5d9c97<0x0){_0x5d9c97=0x0;}return _0x5d9c97;};exports[_0x8721('0x9')]=function(_0x31287e){var _0x55780f,_0x307990=null;if(_0x31287e){_0x55780f=_0x31287e[_0x8721('0x3')](',');_0x307990=_['map'](_0x55780f,function(_0x2b1534){if(_0x2b1534[_0x8721('0xa')]('-')===0x0){return[_0x2b1534==='priority'?sequelize[_0x8721('0xb')](sequelize['col'](_0x8721('0xc')),'unsigned'):_0x2b1534[_0x8721('0xd')](0x1),_0x8721('0xe')];}else{return[_0x2b1534===_0x8721('0xc')?sequelize['cast'](sequelize[_0x8721('0xf')](_0x8721('0xc')),_0x8721('0x10')):_0x2b1534,'ASC'];}});}return _0x307990;};exports['omit']=function(_0x5d66e3,_0x2e691c){if(_['isEmpty'](_0x5d66e3)){return _0x5d66e3;}if(_['isArray'](_0x5d66e3)){for(var _0x44a153=0x0;_0x44a153<_0x5d66e3[_0x8721('0x11')];_0x44a153+=0x1){_0x5d66e3[_0x44a153]=this[_0x8721('0x12')](_0x5d66e3[_0x44a153],_0x2e691c);}return _0x5d66e3;}if(!_[_0x8721('0x13')](_0x5d66e3)){return _0x5d66e3;}if(_[_0x8721('0x14')](_0x2e691c)){_0x2e691c=[_0x2e691c];}if(!_[_0x8721('0x6')](_0x2e691c)){return _0x5d66e3;}for(var _0x3fbabd=0x0;_0x3fbabd<_0x2e691c[_0x8721('0x11')];_0x3fbabd+=0x1){_[_0x8721('0x15')](_0x5d66e3,_0x2e691c[_0x3fbabd]);}for(var _0x4ae020 in _0x5d66e3){if(_0x5d66e3[_0x8721('0x16')](_0x4ae020)){_0x5d66e3[_0x4ae020]=this['omit'](_0x5d66e3[_0x4ae020],_0x2e691c);}}return _0x5d66e3;};exports['isNumeric']=function(_0x3fe95f){return _0x3fe95f[_0x8721('0x17')](RegExp(_0x8721('0x18')))?!![]:![];};exports[_0x8721('0x19')]=function(_0x16ca9a){return _0x16ca9a[_0x8721('0x17')](/^\S+@\S+$/)?!![]:![];};exports[_0x8721('0x1a')]=function(_0x445ef4){var _0x13aa28=[];_0x445ef4['split']('\x20')[_0x8721('0x1b')](function(_0x448d39){_0x13aa28[_0x8721('0x1c')]('+'+_0x448d39[_0x8721('0x1d')]()+'*');});return _0x13aa28['join']('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 6bce038..1e73289 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdc3c=['client','toISOString','split','use','views','/server/views','ejs','view\x20engine','html','50mb','initialize','express','serve-favicon','body-parser','method-override','cookie-parser','errorhandler','path','passport','cors','moment','./environment','../mysqldb','default','get','env','production','appPath','public','development','test','set','join','root'];(function(_0x91ec40,_0xa1ec3b){var _0x428c7a=function(_0x196f25){while(--_0x196f25){_0x91ec40['push'](_0x91ec40['shift']());}};_0x428c7a(++_0xa1ec3b);}(_0xdc3c,0x1a3));var _0xcdc3=function(_0x23fd45,_0x173ba6){_0x23fd45=_0x23fd45-0x0;var _0x2dd24e=_0xdc3c[_0x23fd45];return _0x2dd24e;};'use strict';var express=require(_0xcdc3('0x0'));var favicon=require(_0xcdc3('0x1'));var bodyParser=require(_0xcdc3('0x2'));var methodOverride=require(_0xcdc3('0x3'));var cookieParser=require(_0xcdc3('0x4'));var errorHandler=require(_0xcdc3('0x5'));var path=require(_0xcdc3('0x6'));var passport=require(_0xcdc3('0x7'));var cors=require(_0xcdc3('0x8'));var moment=require(_0xcdc3('0x9'));var config=require(_0xcdc3('0xa'));var db=require(_0xcdc3('0xb'))['db'];exports[_0xcdc3('0xc')]=function(_0x5a21bb){var _0x19bb67=_0x5a21bb[_0xcdc3('0xd')](_0xcdc3('0xe'));if(_0x19bb67===_0xcdc3('0xf')){_0x5a21bb['set'](_0xcdc3('0x10'),path['join'](config['root'],_0xcdc3('0x11')));}if(_0x19bb67===_0xcdc3('0x12')||_0x19bb67===_0xcdc3('0x13')){_0x5a21bb[_0xcdc3('0x14')](_0xcdc3('0x10'),path[_0xcdc3('0x15')](config[_0xcdc3('0x16')],_0xcdc3('0x17')));_0x5a21bb['use'](errorHandler());}_0x5a21bb[_0xcdc3('0x14')]('json\x20replacer',function(_0xe6b15e,_0x4be425){if(this[_0xe6b15e]instanceof Date){_0x4be425=this[_0xe6b15e][_0xcdc3('0x18')]()[_0xcdc3('0x19')]('.')[0x0]+'Z';}return _0x4be425;});_0x5a21bb[_0xcdc3('0x1a')](express['static'](_0x5a21bb[_0xcdc3('0xd')](_0xcdc3('0x10'))));_0x5a21bb[_0xcdc3('0x14')](_0xcdc3('0x1b'),config[_0xcdc3('0x16')]+_0xcdc3('0x1c'));_0x5a21bb['engine']('html',require(_0xcdc3('0x1d'))['renderFile']);_0x5a21bb[_0xcdc3('0x14')](_0xcdc3('0x1e'),_0xcdc3('0x1f'));_0x5a21bb[_0xcdc3('0x1a')](bodyParser['urlencoded']({'limit':_0xcdc3('0x20'),'extended':!![]}));_0x5a21bb[_0xcdc3('0x1a')](bodyParser['json']({'limit':'50mb'}));_0x5a21bb['use'](cors());_0x5a21bb[_0xcdc3('0x1a')](methodOverride());_0x5a21bb['use'](cookieParser());_0x5a21bb[_0xcdc3('0x1a')](passport[_0xcdc3('0x21')]());}; \ No newline at end of file +var _0x77a2=['../mysqldb','default','get','env','production','set','appPath','join','root','public','test','client','use','toISOString','static','views','/server/views','engine','ejs','renderFile','html','50mb','initialize','express','serve-favicon','body-parser','method-override','cookie-parser','errorhandler','moment'];(function(_0x2c4a82,_0x12ece1){var _0x6434da=function(_0x530467){while(--_0x530467){_0x2c4a82['push'](_0x2c4a82['shift']());}};_0x6434da(++_0x12ece1);}(_0x77a2,0x1bb));var _0x277a=function(_0x2f88dc,_0x1fdeae){_0x2f88dc=_0x2f88dc-0x0;var _0xe6e447=_0x77a2[_0x2f88dc];return _0xe6e447;};'use strict';var express=require(_0x277a('0x0'));var favicon=require(_0x277a('0x1'));var bodyParser=require(_0x277a('0x2'));var methodOverride=require(_0x277a('0x3'));var cookieParser=require(_0x277a('0x4'));var errorHandler=require(_0x277a('0x5'));var path=require('path');var passport=require('passport');var cors=require('cors');var moment=require(_0x277a('0x6'));var config=require('./environment');var db=require(_0x277a('0x7'))['db'];exports[_0x277a('0x8')]=function(_0x37b206){var _0x2d258e=_0x37b206[_0x277a('0x9')](_0x277a('0xa'));if(_0x2d258e===_0x277a('0xb')){_0x37b206[_0x277a('0xc')](_0x277a('0xd'),path[_0x277a('0xe')](config[_0x277a('0xf')],_0x277a('0x10')));}if(_0x2d258e==='development'||_0x2d258e===_0x277a('0x11')){_0x37b206[_0x277a('0xc')](_0x277a('0xd'),path['join'](config[_0x277a('0xf')],_0x277a('0x12')));_0x37b206[_0x277a('0x13')](errorHandler());}_0x37b206[_0x277a('0xc')]('json\x20replacer',function(_0x46a040,_0x3ea859){if(this[_0x46a040]instanceof Date){_0x3ea859=this[_0x46a040][_0x277a('0x14')]()['split']('.')[0x0]+'Z';}return _0x3ea859;});_0x37b206[_0x277a('0x13')](express[_0x277a('0x15')](_0x37b206['get']('appPath')));_0x37b206[_0x277a('0xc')](_0x277a('0x16'),config['root']+_0x277a('0x17'));_0x37b206[_0x277a('0x18')]('html',require(_0x277a('0x19'))[_0x277a('0x1a')]);_0x37b206['set']('view\x20engine',_0x277a('0x1b'));_0x37b206[_0x277a('0x13')](bodyParser['urlencoded']({'limit':_0x277a('0x1c'),'extended':!![]}));_0x37b206[_0x277a('0x13')](bodyParser['json']({'limit':_0x277a('0x1c')}));_0x37b206['use'](cors());_0x37b206[_0x277a('0x13')](methodOverride());_0x37b206[_0x277a('0x13')](cookieParser());_0x37b206[_0x277a('0x13')](passport[_0x277a('0x1d')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 7a66e48..2180fb2 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 _0x741c=['concat','head','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','orderBy','model','join','createHash','md5','update','hex','getUuid','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','ipAddress','digest','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','keys','length','filter','family','internal'];(function(_0x5411cb,_0x1cd69d){var _0x32727a=function(_0x22a762){while(--_0x22a762){_0x5411cb['push'](_0x5411cb['shift']());}};_0x32727a(++_0x1cd69d);}(_0x741c,0x196));var _0xc741=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x741c[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xc741('0x0'));var os=require('os');var crypto=require(_0xc741('0x1'));var machine=require(_0xc741('0x2'));var exec=require(_0xc741('0x3'))[_0xc741('0x4')];function getInterfaces(){var _0x31de60=[];var _0x5c8d3b=os['networkInterfaces']();var _0x4089bf=_['orderBy'](_[_0xc741('0x5')](_0x5c8d3b));for(var _0x1935b4=0x0;_0x1935b4<_0x4089bf[_0xc741('0x6')];_0x1935b4++){var _0x133bc4=_0x5c8d3b[_0x4089bf[_0x1935b4]][_0xc741('0x7')](function(_0x216e60){return _0x216e60[_0xc741('0x8')]==='IPv4'&&_0x216e60[_0xc741('0x9')]===![];});_0x31de60=_0x31de60[_0xc741('0xa')](_0x133bc4);}return _0x31de60;}function getFirstInterface(){var _0x47e0c0=_[_0xc741('0xb')](getInterfaces());return{'macAddress':_0x47e0c0&&_0x47e0c0['mac']?_0x47e0c0['mac']:_0xc741('0xc'),'ipAddress':_0x47e0c0&&_0x47e0c0[_0xc741('0xd')]?_0x47e0c0[_0xc741('0xd')]:_0xc741('0xe')};}exports[_0xc741('0xf')]=getFirstInterface;function getCPUhash(){var _0x29920b=_[_0xc741('0x10')](os['cpus']()['map'](function(_0x51bc33){return _0x51bc33[_0xc741('0x11')];}))[_0xc741('0x12')](':');return crypto[_0xc741('0x13')](_0xc741('0x14'))[_0xc741('0x15')](_0x29920b)['digest'](_0xc741('0x16'));}exports[_0xc741('0x17')]=function(){switch(os['platform']()){case _0xc741('0x18'):return exec(_0xc741('0x19'),{'encoding':_0xc741('0x1a')})[_0xc741('0x1b')]('\x0d\x0a','');default:var _0x21514e=getFirstInterface();var _0x5bbe86=getCPUhash();var _0x4dcf16=_0x5bbe86+'|'+os[_0xc741('0x1c')]()+'|'+_0x21514e['macAddress']+'|'+_0x21514e[_0xc741('0x1d')];var _0x3903c6=crypto['createHash']('md5')[_0xc741('0x15')](_0x4dcf16)[_0xc741('0x1e')](_0xc741('0x16'));return _0x3903c6['substring'](0x0,0x8)+'-'+_0x3903c6[_0xc741('0x1f')](0x8,0xc)+'-'+_0x3903c6[_0xc741('0x1f')](0xc,0x10)+'-'+_0x3903c6[_0xc741('0x1f')](0x10,0x14)+'-'+_0x3903c6[_0xc741('0x1f')](0x14);}}; \ No newline at end of file +var _0x26d1=['getUuid','platform','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','ipAddress','digest','substring','lodash','bimedia-machine-uuid','child_process','execSync','keys','length','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','orderBy','map','model','createHash','md5','update'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0x26d1,0x8e));var _0x126d=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x26d1[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x126d('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0x126d('0x1'));var exec=require(_0x126d('0x2'))[_0x126d('0x3')];function getInterfaces(){var _0x2a20fc=[];var _0x59d0a0=os['networkInterfaces']();var _0x3a3fb4=_['orderBy'](_[_0x126d('0x4')](_0x59d0a0));for(var _0x7f89d4=0x0;_0x7f89d4<_0x3a3fb4[_0x126d('0x5')];_0x7f89d4++){var _0x449ed0=_0x59d0a0[_0x3a3fb4[_0x7f89d4]][_0x126d('0x6')](function(_0x4e5e87){return _0x4e5e87[_0x126d('0x7')]===_0x126d('0x8')&&_0x4e5e87[_0x126d('0x9')]===![];});_0x2a20fc=_0x2a20fc[_0x126d('0xa')](_0x449ed0);}return _0x2a20fc;}function getFirstInterface(){var _0x2cbbdc=_[_0x126d('0xb')](getInterfaces());return{'macAddress':_0x2cbbdc&&_0x2cbbdc[_0x126d('0xc')]?_0x2cbbdc['mac']:_0x126d('0xd'),'ipAddress':_0x2cbbdc&&_0x2cbbdc[_0x126d('0xe')]?_0x2cbbdc[_0x126d('0xe')]:_0x126d('0xf')};}exports[_0x126d('0x10')]=getFirstInterface;function getCPUhash(){var _0x521ab7=_[_0x126d('0x11')](os['cpus']()[_0x126d('0x12')](function(_0x2b755f){return _0x2b755f[_0x126d('0x13')];}))['join'](':');return crypto[_0x126d('0x14')](_0x126d('0x15'))[_0x126d('0x16')](_0x521ab7)['digest']('hex');}exports[_0x126d('0x17')]=function(){switch(os[_0x126d('0x18')]()){case _0x126d('0x19'):return exec(_0x126d('0x1a'),{'encoding':_0x126d('0x1b')})[_0x126d('0x1c')]('\x0d\x0a','');default:var _0x517b88=getFirstInterface();var _0x1f1fce=getCPUhash();var _0x58b39c=_0x1f1fce+'|'+os[_0x126d('0x1d')]()+'|'+_0x517b88['macAddress']+'|'+_0x517b88[_0x126d('0x1e')];var _0x1be025=crypto['createHash'](_0x126d('0x15'))['update'](_0x58b39c)[_0x126d('0x1f')]('hex');return _0x1be025['substring'](0x0,0x8)+'-'+_0x1be025['substring'](0x8,0xc)+'-'+_0x1be025[_0x126d('0x20')](0xc,0x10)+'-'+_0x1be025[_0x126d('0x20')](0x10,0x14)+'-'+_0x1be025[_0x126d('0x20')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 2cefafd..a15246e 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 _0x5430=['toUpperCase','YYYY-MM-DD\x20HH:mm','diff','days','DEMO\x20START\x20AT\x20%s','finally','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','util','crypto','moment','request-promise','bluebird','pkginfo','../environment','license','../../api/jira/jira.controller','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','version','GET','then','catch','createCipher','aes-256-ctr','secrets','session','utf8','base64','createDecipher','update','final','User','findOne','admin','email','|reason|','|machineUuid|','|name|','fullname','|email|','ipAddress','openIssue','MOTLICENSE','Motion\x20License\x20Alert','Alert','get','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','data1','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s'];(function(_0x69a451,_0x49fd37){var _0x3d6ef5=function(_0x27ebf4){while(--_0x27ebf4){_0x69a451['push'](_0x69a451['shift']());}};_0x3d6ef5(++_0x49fd37);}(_0x5430,0x10c));var _0x0543=function(_0x4d79e0,_0x1a804d){_0x4d79e0=_0x4d79e0-0x0;var _0x19b8a2=_0x5430[_0x4d79e0];return _0x19b8a2;};'use strict';var util=require(_0x0543('0x0'));var crypto=require(_0x0543('0x1'));var moment=require(_0x0543('0x2'));var rp=require(_0x0543('0x3'));var BPromise=require(_0x0543('0x4'));var pkginfo=require(_0x0543('0x5'))(module,'version');var db=require('../../mysqldb')['db'];var config=require(_0x0543('0x6'));var hardware=require('./hardware');var logger=require('../logger')(_0x0543('0x7'));var jira=require(_0x0543('0x8'));var HOST=_0x0543('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x319568){return new BPromise(function(_0x46bca7,_0x5ac352){var _0x372974=util[_0x0543('0xa')](_0x0543('0xb'),HOST,_0x319568,module[_0x0543('0xc')][_0x0543('0xd')]);if(oldToken){_0x372974=util[_0x0543('0xa')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x319568,module[_0x0543('0xc')][_0x0543('0xd')],oldToken);}var _0x52c9b7={'uri':_0x372974,'method':_0x0543('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x52c9b7)[_0x0543('0xf')](function(_0x2bb810){_0x46bca7(_0x2bb810);})[_0x0543('0x10')](function(_0x3f74f8){_0x5ac352(_0x3f74f8);});});}function encryptDate(_0x3ed28d){var _0x30c54e=crypto[_0x0543('0x11')](_0x0543('0x12'),config[_0x0543('0x13')][_0x0543('0x14')]);var _0x509afa=_0x30c54e['update'](_0x3ed28d,_0x0543('0x15'),_0x0543('0x16'));_0x509afa+=_0x30c54e['final']('base64');return _0x509afa;}function decryptDate(_0xcb09df){var _0x40fb03=crypto[_0x0543('0x17')](_0x0543('0x12'),config[_0x0543('0x13')]['session']);var _0xe69a3d=_0x40fb03[_0x0543('0x18')](_0xcb09df,_0x0543('0x16'),_0x0543('0x15'));_0xe69a3d+=_0x40fb03[_0x0543('0x19')](_0x0543('0x15'));return _0xe69a3d;}function sendJiraAlert(_0x577cf0,_0x5eb03e,_0x37b084){var _0x5362cb='||FIELD||VALUE||\x0a';return db[_0x0543('0x1a')][_0x0543('0x1b')]({'where':{'role':_0x0543('0x1c')},'attributes':['fullname',_0x0543('0x1d')],'raw':!![]})['then'](function(_0x401da5){ADMIN=_0x401da5;_0x5362cb+=_0x0543('0x1e')+_0x37b084+'|\x0a';_0x5362cb+='|uuid|'+_0x577cf0+'|\x0a';_0x5362cb+=_0x0543('0x1f')+_0x5eb03e+'|\x0a';_0x5362cb+=_0x0543('0x20')+ADMIN[_0x0543('0x21')]+'|\x0a';_0x5362cb+=_0x0543('0x22')+ADMIN[_0x0543('0x1d')]+'|\x0a';return _0x5362cb;})[_0x0543('0xf')](function(_0x4adba7){var _0x5979d2=hardware['getFirstInterface']()[_0x0543('0x23')];return jira[_0x0543('0x24')]({'key':_0x0543('0x25'),'summary':_0x0543('0x26'),'description':_0x4adba7,'issuetype':_0x0543('0x27'),'oldToken':_0x577cf0,'newToken':_0x5eb03e,'email':ADMIN[_0x0543('0x1d')],'name':ADMIN[_0x0543('0x21')],'reason':GRAY_PERIOD_REASON,'ip':_0x5979d2});});}function manageLicense(_0x17a3de,_0x1fca8a){var _0xf1eccf=_0x1fca8a[_0x0543('0x28')]({'plain':!![]});httpRequest(_0x17a3de)[_0x0543('0xf')](function(_0x547a88){if(oldToken){oldToken=undefined;}if(_0x547a88[_0x0543('0x29')]){if(!_0xf1eccf[_0x0543('0x7')]&&_0xf1eccf[_0x0543('0x7')]!=_0x547a88['license']||_0xf1eccf[_0x0543('0x7')]&&_0xf1eccf[_0x0543('0x2a')]){logger[_0x0543('0x2b')](_0x0543('0x2c'));}if(_0xf1eccf['license']&&!_0xf1eccf[_0x0543('0x2a')]&&_0xf1eccf[_0x0543('0x7')]!=_0x547a88['license']){logger['info'](_0x0543('0x2d'));}if(_0xf1eccf[_0x0543('0x7')]&&!_0xf1eccf['data2']&&_0xf1eccf[_0x0543('0x7')]==_0x547a88[_0x0543('0x7')]){return _0x1fca8a;}return _0x1fca8a[_0x0543('0x18')]({'data1':_0x17a3de,'data2':null,'license':_0x547a88[_0x0543('0x7')]});}else{if(_0x547a88[_0x0543('0x7')]||_0xf1eccf[_0x0543('0x7')]){if(!_0xf1eccf[_0x0543('0x2a')]){if(_0xf1eccf['data1']==_0x17a3de){GRAY_PERIOD_REASON=_0x0543('0x2e');logger['info'](_0x0543('0x2f'));}else{GRAY_PERIOD_REASON=_0x0543('0x30');oldToken=_0xf1eccf[_0x0543('0x31')];logger[_0x0543('0x2b')](_0x0543('0x32'),_0xf1eccf['data1'],_0x17a3de);}sendJiraAlert(_0xf1eccf[_0x0543('0x31')],_0x547a88['uuid'],GRAY_PERIOD_REASON);logger[_0x0543('0x2b')](_0x0543('0x33'),GRAY_PERIOD_REASON[_0x0543('0x34')](),moment()[_0x0543('0xa')]('YYYY-MM-DD\x20HH:mm'));return _0x1fca8a[_0x0543('0x18')]({'data2':encryptDate(moment()['format'](_0x0543('0x35')))});}else{if(moment()[_0x0543('0x36')](decryptDate(_0xf1eccf[_0x0543('0x2a')]),_0x0543('0x37'))>DAYS){logger[_0x0543('0x2b')](_0x0543('0x38'),moment()[_0x0543('0xa')](_0x0543('0x35')));return _0x1fca8a[_0x0543('0x18')]({'data1':_0x17a3de,'data2':null,'license':null});}}}else{if(_0xf1eccf[_0x0543('0x31')]!=_0x17a3de){logger['info'](_0x0543('0x32'),_0xf1eccf[_0x0543('0x31')],_0x17a3de);return _0x1fca8a['update']({'data1':_0x17a3de,'data2':null,'license':null});}}}return _0x1fca8a;})[_0x0543('0xf')](function(_0x4b9c1f){_0x1fca8a=_0x4b9c1f;})[_0x0543('0x10')](function(_0x2ce7b9){logger['error'](_0x2ce7b9['message']);})[_0x0543('0x39')](function(){setTimeout(function(){manageLicense(hardware[_0x0543('0x3a')](),_0x1fca8a);},TIME);});}function defaultLicense(){var _0x4ca572=hardware[_0x0543('0x3a')]();if(_0x4ca572){return db[_0x0543('0x3b')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x4ca572}})[_0x0543('0x3c')](function(_0x2896b9,_0x3ecd70){logger[_0x0543('0x2b')](_0x0543('0x3d'),_0x4ca572);manageLicense(_0x4ca572,_0x2896b9);})['catch'](function(_0x572dd7){logger['error'](_0x572dd7[_0x0543('0x3e')]);});}}exports[_0x0543('0x3f')]=defaultLicense; \ No newline at end of file +var _0xdb28=['data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1','Disabled','Changed','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','message','finally','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','crypto','moment','request-promise','pkginfo','version','../../mysqldb','../environment','./hardware','license','../../api/jira/jira.controller','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','createCipher','session','update','utf8','base64','final','createDecipher','secrets','||FIELD||VALUE||\x0a','User','findOne','fullname','email','|reason|','|machineUuid|','|name|','|email|','getFirstInterface','Alert','active'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xdb28,0x106));var _0x8db2=function(_0x2a53a4,_0x2d66fd){_0x2a53a4=_0x2a53a4-0x0;var _0x3d44bc=_0xdb28[_0x2a53a4];return _0x3d44bc;};'use strict';var util=require(_0x8db2('0x0'));var crypto=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var rp=require(_0x8db2('0x3'));var BPromise=require('bluebird');var pkginfo=require(_0x8db2('0x4'))(module,_0x8db2('0x5'));var db=require(_0x8db2('0x6'))['db'];var config=require(_0x8db2('0x7'));var hardware=require(_0x8db2('0x8'));var logger=require('../logger')(_0x8db2('0x9'));var jira=require(_0x8db2('0xa'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x494b40){return new BPromise(function(_0x477f50,_0x46932f){var _0x131537=util[_0x8db2('0xb')](_0x8db2('0xc'),HOST,_0x494b40,module[_0x8db2('0xd')][_0x8db2('0x5')]);if(oldToken){_0x131537=util['format'](_0x8db2('0xe'),HOST,_0x494b40,module[_0x8db2('0xd')][_0x8db2('0x5')],oldToken);}var _0x57015f={'uri':_0x131537,'method':_0x8db2('0xf'),'timeout':0xea60,'json':!![]};return rp(_0x57015f)[_0x8db2('0x10')](function(_0x576475){_0x477f50(_0x576475);})[_0x8db2('0x11')](function(_0x3b2faa){_0x46932f(_0x3b2faa);});});}function encryptDate(_0x1349f6){var _0x204f49=crypto[_0x8db2('0x12')]('aes-256-ctr',config['secrets'][_0x8db2('0x13')]);var _0x15e87c=_0x204f49[_0x8db2('0x14')](_0x1349f6,_0x8db2('0x15'),_0x8db2('0x16'));_0x15e87c+=_0x204f49[_0x8db2('0x17')](_0x8db2('0x16'));return _0x15e87c;}function decryptDate(_0x3c96a7){var _0x131252=crypto[_0x8db2('0x18')]('aes-256-ctr',config[_0x8db2('0x19')][_0x8db2('0x13')]);var _0x48101e=_0x131252[_0x8db2('0x14')](_0x3c96a7,_0x8db2('0x16'),_0x8db2('0x15'));_0x48101e+=_0x131252[_0x8db2('0x17')](_0x8db2('0x15'));return _0x48101e;}function sendJiraAlert(_0x46ce14,_0x51d60d,_0x5df464){var _0x77789=_0x8db2('0x1a');return db[_0x8db2('0x1b')][_0x8db2('0x1c')]({'where':{'role':'admin'},'attributes':[_0x8db2('0x1d'),_0x8db2('0x1e')],'raw':!![]})[_0x8db2('0x10')](function(_0x297ba3){ADMIN=_0x297ba3;_0x77789+=_0x8db2('0x1f')+_0x5df464+'|\x0a';_0x77789+='|uuid|'+_0x46ce14+'|\x0a';_0x77789+=_0x8db2('0x20')+_0x51d60d+'|\x0a';_0x77789+=_0x8db2('0x21')+ADMIN[_0x8db2('0x1d')]+'|\x0a';_0x77789+=_0x8db2('0x22')+ADMIN[_0x8db2('0x1e')]+'|\x0a';return _0x77789;})[_0x8db2('0x10')](function(_0x796ec1){var _0x5c6614=hardware[_0x8db2('0x23')]()['ipAddress'];return jira['openIssue']({'key':'MOTLICENSE','summary':'Motion\x20License\x20Alert','description':_0x796ec1,'issuetype':_0x8db2('0x24'),'oldToken':_0x46ce14,'newToken':_0x51d60d,'email':ADMIN[_0x8db2('0x1e')],'name':ADMIN[_0x8db2('0x1d')],'reason':GRAY_PERIOD_REASON,'ip':_0x5c6614});});}function manageLicense(_0x2baed0,_0x145328){var _0x8d4f54=_0x145328['get']({'plain':!![]});httpRequest(_0x2baed0)[_0x8db2('0x10')](function(_0x372311){if(oldToken){oldToken=undefined;}if(_0x372311[_0x8db2('0x25')]){if(!_0x8d4f54[_0x8db2('0x9')]&&_0x8d4f54['license']!=_0x372311[_0x8db2('0x9')]||_0x8d4f54[_0x8db2('0x9')]&&_0x8d4f54[_0x8db2('0x26')]){logger[_0x8db2('0x27')](_0x8db2('0x28'));}if(_0x8d4f54[_0x8db2('0x9')]&&!_0x8d4f54[_0x8db2('0x26')]&&_0x8d4f54[_0x8db2('0x9')]!=_0x372311[_0x8db2('0x9')]){logger['info'](_0x8db2('0x29'));}if(_0x8d4f54['license']&&!_0x8d4f54['data2']&&_0x8d4f54[_0x8db2('0x9')]==_0x372311[_0x8db2('0x9')]){return _0x145328;}return _0x145328[_0x8db2('0x14')]({'data1':_0x2baed0,'data2':null,'license':_0x372311['license']});}else{if(_0x372311[_0x8db2('0x9')]||_0x8d4f54['license']){if(!_0x8d4f54[_0x8db2('0x26')]){if(_0x8d4f54[_0x8db2('0x2a')]==_0x2baed0){GRAY_PERIOD_REASON=_0x8db2('0x2b');logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x8db2('0x2c');oldToken=_0x8d4f54[_0x8db2('0x2a')];logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x8d4f54[_0x8db2('0x2a')],_0x2baed0);}sendJiraAlert(_0x8d4f54[_0x8db2('0x2a')],_0x372311[_0x8db2('0x2d')],GRAY_PERIOD_REASON);logger[_0x8db2('0x27')](_0x8db2('0x2e'),GRAY_PERIOD_REASON[_0x8db2('0x2f')](),moment()[_0x8db2('0xb')](_0x8db2('0x30')));return _0x145328[_0x8db2('0x14')]({'data2':encryptDate(moment()[_0x8db2('0xb')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x8db2('0x31')](decryptDate(_0x8d4f54[_0x8db2('0x26')]),'days')>DAYS){logger[_0x8db2('0x27')](_0x8db2('0x32'),moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0x145328[_0x8db2('0x14')]({'data1':_0x2baed0,'data2':null,'license':null});}}}else{if(_0x8d4f54['data1']!=_0x2baed0){logger[_0x8db2('0x27')](_0x8db2('0x33'),_0x8d4f54[_0x8db2('0x2a')],_0x2baed0);return _0x145328[_0x8db2('0x14')]({'data1':_0x2baed0,'data2':null,'license':null});}}}return _0x145328;})['then'](function(_0x2d3e98){_0x145328=_0x2d3e98;})['catch'](function(_0x227a08){logger[_0x8db2('0x34')](_0x227a08[_0x8db2('0x35')]);})[_0x8db2('0x36')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x145328);},TIME);});}function defaultLicense(){var _0x50ee17=hardware[_0x8db2('0x37')]();if(_0x50ee17){return db[_0x8db2('0x38')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x50ee17}})[_0x8db2('0x39')](function(_0x24bcfe,_0x656dd2){logger['info'](_0x8db2('0x3a'),_0x50ee17);manageLicense(_0x50ee17,_0x24bcfe);})[_0x8db2('0x11')](function(_0x953349){logger[_0x8db2('0x34')](_0x953349[_0x8db2('0x35')]);});}}exports[_0x8db2('0x3b')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index f4e307b..878e425 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 _0xcbfd=['parse','uuid','machineUuid','getUuid','createDecipher','secrets','session','gray','deadline','add','days','format','grayReason','disabled','2027-01-01T00:00:00.000Z','Breaking\x20license','Demo\x20license','License','find','then','crypto','lodash','./hardware','../../mysqldb','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','aes-256-ctr','%s:%s:%s','update','base64','utf8','final'];(function(_0x9be9da,_0x13da6e){var _0x5b7bea=function(_0x24d8d5){while(--_0x24d8d5){_0x9be9da['push'](_0x9be9da['shift']());}};_0x5b7bea(++_0x13da6e);}(_0xcbfd,0x110));var _0xdcbf=function(_0x57167a,_0x3aec92){_0x57167a=_0x57167a-0x0;var _0x436eef=_0xcbfd[_0x57167a];return _0x436eef;};'use strict';var crypto=require(_0xdcbf('0x0'));var util=require('util');var _=require(_0xdcbf('0x1'));var moment=require('moment');var hardware=require(_0xdcbf('0x2'));var config=require('../environment');var db=require(_0xdcbf('0x3'))['db'];function checkLicense(_0xd79575,_0x2e719c){if(_0xd79575){try{var _0x783662=_0x2e719c||_0xd79575[_0xdcbf('0x4')];if(_[_0xdcbf('0x5')](_0x783662)){throw new Error(_0xdcbf('0x6'));}var _0x718c8d=_0xd79575[_0xdcbf('0x7')];var _0x1b715e=_0xd79575[_0xdcbf('0x8')];var _0x485a72=_0x718c8d[_0xdcbf('0x9')]('-')[0x4];var _0x2f48c4=_0x718c8d[_0xdcbf('0x9')]('-')[0x0];var _0x3c3a60=crypto['createDecipher'](_0xdcbf('0xa'),util['format'](_0xdcbf('0xb'),_0x485a72,_0x718c8d,_0x2f48c4));var _0x21a4df=_0x3c3a60[_0xdcbf('0xc')](_0x783662,_0xdcbf('0xd'),_0xdcbf('0xe'));_0x21a4df+=_0x3c3a60[_0xdcbf('0xf')](_0xdcbf('0xe'));var _0xc3e47=JSON[_0xdcbf('0x10')](_0x21a4df);_0xc3e47['demo']=![];_0xc3e47[_0xdcbf('0x11')]=_0x718c8d;_0xc3e47[_0xdcbf('0x12')]=hardware[_0xdcbf('0x13')]();if(_0x1b715e){var _0x5db851=crypto[_0xdcbf('0x14')](_0xdcbf('0xa'),config[_0xdcbf('0x15')][_0xdcbf('0x16')]);var _0x1319b8=_0x5db851[_0xdcbf('0xc')](_0x1b715e,_0xdcbf('0xd'),_0xdcbf('0xe'));_0x1319b8+=_0x5db851['final'](_0xdcbf('0xe'));_0xc3e47[_0xdcbf('0x17')]=_0x1319b8;_0xc3e47[_0xdcbf('0x18')]=moment(_0x1319b8)[_0xdcbf('0x19')](0x7,_0xdcbf('0x1a'))[_0xdcbf('0x1b')]();_0xc3e47[_0xdcbf('0x1c')]=_0xc3e47[_0xdcbf('0x11')]!=_0xc3e47[_0xdcbf('0x12')]?'changed':_0xdcbf('0x1d');}return _0xc3e47;}catch(_0x5ea080){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xdcbf('0x1e'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xdcbf('0x1f'),'uuid':_0xd79575[_0xdcbf('0x7')],'machineUuid':hardware[_0xdcbf('0x13')](),'message':_0x5ea080['message'],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xdcbf('0x1e'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xdcbf('0x20'),'uuid':_0xd79575[_0xdcbf('0x7')],'machineUuid':hardware[_0xdcbf('0x13')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![]};}exports['getLicense']=function(_0x186f90){return db[_0xdcbf('0x21')][_0xdcbf('0x22')](_['defaults'](_0x186f90,{'raw':!![],'where':{'id':0x1}}))[_0xdcbf('0x23')](function(_0x28958e){return checkLicense(_0x28958e,null);});};exports['checkLicense']=checkLicense; \ No newline at end of file +var _0x453b=['disabled','2027-01-01T00:00:00.000Z','message','getLicense','License','find','defaults','then','checkLicense','crypto','util','moment','./hardware','../environment','../../mysqldb','license','isEmpty','data1','data2','split','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','demo','getUuid','secrets','session','gray','deadline','add','days','grayReason'];(function(_0x7b341f,_0x11e481){var _0x46d0a1=function(_0x6f779d){while(--_0x6f779d){_0x7b341f['push'](_0x7b341f['shift']());}};_0x46d0a1(++_0x11e481);}(_0x453b,0x156));var _0xb453=function(_0x7633c,_0x1e45bf){_0x7633c=_0x7633c-0x0;var _0x1b77e2=_0x453b[_0x7633c];return _0x1b77e2;};'use strict';var crypto=require(_0xb453('0x0'));var util=require(_0xb453('0x1'));var _=require('lodash');var moment=require(_0xb453('0x2'));var hardware=require(_0xb453('0x3'));var config=require(_0xb453('0x4'));var db=require(_0xb453('0x5'))['db'];function checkLicense(_0x5b3a4c,_0x517c36){if(_0x5b3a4c){try{var _0x53813f=_0x517c36||_0x5b3a4c[_0xb453('0x6')];if(_[_0xb453('0x7')](_0x53813f)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x543218=_0x5b3a4c[_0xb453('0x8')];var _0x5e7c2a=_0x5b3a4c[_0xb453('0x9')];var _0x52e80a=_0x543218[_0xb453('0xa')]('-')[0x4];var _0x5e4fe6=_0x543218[_0xb453('0xa')]('-')[0x0];var _0x4b0524=crypto['createDecipher'](_0xb453('0xb'),util[_0xb453('0xc')](_0xb453('0xd'),_0x52e80a,_0x543218,_0x5e4fe6));var _0x516d85=_0x4b0524[_0xb453('0xe')](_0x53813f,_0xb453('0xf'),_0xb453('0x10'));_0x516d85+=_0x4b0524[_0xb453('0x11')](_0xb453('0x10'));var _0x111efe=JSON[_0xb453('0x12')](_0x516d85);_0x111efe[_0xb453('0x13')]=![];_0x111efe['uuid']=_0x543218;_0x111efe['machineUuid']=hardware[_0xb453('0x14')]();if(_0x5e7c2a){var _0x3d5ead=crypto['createDecipher']('aes-256-ctr',config[_0xb453('0x15')][_0xb453('0x16')]);var _0x17d96a=_0x3d5ead[_0xb453('0xe')](_0x5e7c2a,_0xb453('0xf'),'utf8');_0x17d96a+=_0x3d5ead[_0xb453('0x11')](_0xb453('0x10'));_0x111efe[_0xb453('0x17')]=_0x17d96a;_0x111efe[_0xb453('0x18')]=moment(_0x17d96a)[_0xb453('0x19')](0x7,_0xb453('0x1a'))[_0xb453('0xc')]();_0x111efe[_0xb453('0x1b')]=_0x111efe['uuid']!=_0x111efe['machineUuid']?'changed':_0xb453('0x1c');}return _0x111efe;}catch(_0x55053c){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xb453('0x1d'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','uuid':_0x5b3a4c['data1'],'machineUuid':hardware[_0xb453('0x14')](),'message':_0x55053c[_0xb453('0x1e')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xb453('0x1d'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','uuid':_0x5b3a4c[_0xb453('0x8')],'machineUuid':hardware[_0xb453('0x14')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![]};}exports[_0xb453('0x1f')]=function(_0x15edea){return db[_0xb453('0x20')][_0xb453('0x21')](_[_0xb453('0x22')](_0x15edea,{'raw':!![],'where':{'id':0x1}}))[_0xb453('0x23')](function(_0x396a2e){return checkLicense(_0x396a2e,null);});};exports[_0xb453('0x24')]=checkLicense; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index f996069..2f0163b 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 _0xaa65=['http://localhost:9000','myappanuglar-secret','app-id','exports'];(function(_0x7baa76,_0x518ffc){var _0x8f5bc4=function(_0xb78f43){while(--_0xb78f43){_0x7baa76['push'](_0x7baa76['shift']());}};_0x8f5bc4(++_0x518ffc);}(_0xaa65,0x14b));var _0x5aa6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaa65[_0x3dd15e];return _0x231fd0;};'use strict';module[_0x5aa6('0x0')]={'DOMAIN':_0x5aa6('0x1'),'SESSION_SECRET':_0x5aa6('0x2'),'GOOGLE_ID':_0x5aa6('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0xb058=['exports','http://localhost:9000','myappanuglar-secret','app-id','secret'];(function(_0x4c184d,_0x4278ab){var _0x23d997=function(_0x22d068){while(--_0x22d068){_0x4c184d['push'](_0x4c184d['shift']());}};_0x23d997(++_0x4278ab);}(_0xb058,0x69));var _0x8b05=function(_0x37756b,_0x24db76){_0x37756b=_0x37756b-0x0;var _0x46efec=_0xb058[_0x37756b];return _0x46efec;};'use strict';module[_0x8b05('0x0')]={'DOMAIN':_0x8b05('0x1'),'SESSION_SECRET':_0x8b05('0x2'),'GOOGLE_ID':_0x8b05('0x3'),'GOOGLE_SECRET':_0x8b05('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 624ebb5..3662bc2 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x432d=['info','env','debugLevel','moment','path','INFO','join','log','format','%s-%s.log','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','message','exports','Logger','transports','File','%s-%s','error'];(function(_0x24b245,_0x1b3508){var _0x56f828=function(_0x21752a){while(--_0x21752a){_0x24b245['push'](_0x24b245['shift']());}};_0x56f828(++_0x1b3508);}(_0x432d,0x96));var _0xd432=function(_0x19a11f,_0x6d8be7){_0x19a11f=_0x19a11f-0x0;var _0x51485f=_0x432d[_0x19a11f];return _0x51485f;};'use strict';var moment=require(_0xd432('0x0'));var winston=require('winston');var util=require('util');var path=require(_0xd432('0x1'));var debugLevel=_0xd432('0x2');function filename(_0x5177a9,_0x165800){return path[_0xd432('0x3')]('/var',_0xd432('0x4'),'xcally',util[_0xd432('0x5')](_0xd432('0x6'),_0x5177a9,_0x165800));}function formatter(_0x43a39e,_0x3891db){return util[_0xd432('0x5')](_0xd432('0x7'),moment()[_0xd432('0x5')](_0xd432('0x8')),_0x3891db[_0xd432('0x9')][_0xd432('0xa')](),_0x43a39e,_0x3891db[_0xd432('0xb')]);}module[_0xd432('0xc')]=function(_0x595629){return new winston[(_0xd432('0xd'))]({'transports':[new winston[(_0xd432('0xe'))][(_0xd432('0xf'))]({'name':util[_0xd432('0x5')](_0xd432('0x10'),_0x595629,_0xd432('0x11')),'filename':filename(_0x595629,_0xd432('0x11')),'level':_0xd432('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5567a5){return formatter(_0x595629,_0x5567a5);}}),new winston[(_0xd432('0xe'))][(_0xd432('0xf'))]({'name':util['format'](_0xd432('0x10'),_0x595629,_0xd432('0x12')),'filename':filename(_0x595629,_0xd432('0x12')),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4fafb7){return formatter(_0x595629,_0x4fafb7);}}),new winston[(_0xd432('0xe'))]['Console']({'level':process[_0xd432('0x13')][_0xd432('0x14')]||debugLevel,'json':![],'formatter':function(_0x38cbb8){return formatter(_0x595629,_0x38cbb8);}})]});}; \ No newline at end of file +var _0x0877=['[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','Logger','transports','File','%s-%s','info','Console','env','debugLevel','moment','winston','util','path','INFO','join','/var','log','xcally','%s-%s.log','format'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x0877,0xbb));var _0x7087=function(_0x4dfecb,_0x8d2259){_0x4dfecb=_0x4dfecb-0x0;var _0x4fc85c=_0x0877[_0x4dfecb];return _0x4fc85c;};'use strict';var moment=require(_0x7087('0x0'));var winston=require(_0x7087('0x1'));var util=require(_0x7087('0x2'));var path=require(_0x7087('0x3'));var debugLevel=_0x7087('0x4');function filename(_0x25d125,_0x1853af){return path[_0x7087('0x5')](_0x7087('0x6'),_0x7087('0x7'),_0x7087('0x8'),util['format'](_0x7087('0x9'),_0x25d125,_0x1853af));}function formatter(_0x32eaa2,_0x3cb1ab){return util[_0x7087('0xa')](_0x7087('0xb'),moment()[_0x7087('0xa')](_0x7087('0xc')),_0x3cb1ab[_0x7087('0xd')]['toUpperCase'](),_0x32eaa2,_0x3cb1ab['message']);}module['exports']=function(_0x58ebf9){return new winston[(_0x7087('0xe'))]({'transports':[new winston[(_0x7087('0xf'))][(_0x7087('0x10'))]({'name':util[_0x7087('0xa')](_0x7087('0x11'),_0x58ebf9,'error'),'filename':filename(_0x58ebf9,'error'),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3542b0){return formatter(_0x58ebf9,_0x3542b0);}}),new winston[(_0x7087('0xf'))][(_0x7087('0x10'))]({'name':util[_0x7087('0xa')](_0x7087('0x11'),_0x58ebf9,_0x7087('0x12')),'filename':filename(_0x58ebf9,_0x7087('0x12')),'level':_0x7087('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x116ce1){return formatter(_0x58ebf9,_0x116ce1);}}),new winston[(_0x7087('0xf'))][(_0x7087('0x13'))]({'level':process[_0x7087('0x14')][_0x7087('0x15')]||debugLevel,'json':![],'formatter':function(_0x2ab23d){return formatter(_0x58ebf9,_0x2ab23d);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index a94b1c7..a3e36fc 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 _0x0a9f=['xdr','../../services/xdr/index.js','exports','path','express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','routing','../../services/routing/index.js'];(function(_0x4cdd5a,_0x57e480){var _0x4133d9=function(_0x3c3f4b){while(--_0x3c3f4b){_0x4cdd5a['push'](_0x4cdd5a['shift']());}};_0x4133d9(++_0x57e480);}(_0x0a9f,0x1b5));var _0xf0a9=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0x0a9f[_0x119d5a];return _0x15bff4;};'use strict';var path=require(_0xf0a9('0x0'));var os=require('os');var config={'apps':[{'name':_0xf0a9('0x1'),'script':path[_0xf0a9('0x2')](__dirname,_0xf0a9('0x3'))},{'name':_0xf0a9('0x4'),'script':path[_0xf0a9('0x2')](__dirname,_0xf0a9('0x5'))},{'name':_0xf0a9('0x6'),'script':path[_0xf0a9('0x2')](__dirname,_0xf0a9('0x7'))},{'name':_0xf0a9('0x8'),'script':path[_0xf0a9('0x2')](__dirname,'../../services/email/index.js')},{'name':_0xf0a9('0x9'),'script':path['join'](__dirname,_0xf0a9('0xa'))},{'name':_0xf0a9('0xb'),'script':path['join'](__dirname,_0xf0a9('0xc'))}]};module[_0xf0a9('0xd')]=config; \ No newline at end of file +var _0xb088=['../../services/routing/index.js','../../services/xdr/index.js','exports','path','express','join','../../services/express/index.js','ami','../../services/ami/index.js','../../services/agi/index.js','email','routing'];(function(_0x936ddb,_0x2ba1c9){var _0xda4e39=function(_0x54492c){while(--_0x54492c){_0x936ddb['push'](_0x936ddb['shift']());}};_0xda4e39(++_0x2ba1c9);}(_0xb088,0x7b));var _0x8b08=function(_0x476089,_0x2f2e30){_0x476089=_0x476089-0x0;var _0xd96f6b=_0xb088[_0x476089];return _0xd96f6b;};'use strict';var path=require(_0x8b08('0x0'));var os=require('os');var config={'apps':[{'name':_0x8b08('0x1'),'script':path[_0x8b08('0x2')](__dirname,_0x8b08('0x3'))},{'name':_0x8b08('0x4'),'script':path['join'](__dirname,_0x8b08('0x5'))},{'name':'agi','script':path[_0x8b08('0x2')](__dirname,_0x8b08('0x6'))},{'name':_0x8b08('0x7'),'script':path[_0x8b08('0x2')](__dirname,'../../services/email/index.js')},{'name':_0x8b08('0x8'),'script':path[_0x8b08('0x2')](__dirname,_0x8b08('0x9'))},{'name':'xdr','script':path[_0x8b08('0x2')](__dirname,_0x8b08('0xa'))}]};module[_0x8b08('0xb')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 6d87437..7e91557 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 _0x548b=['./config','connect','start','then','disconnect','stop','restart','describe','delete','dump','saved','pm2'];(function(_0x2ede2a,_0x1cf3ab){var _0x515f70=function(_0x47d2f5){while(--_0x47d2f5){_0x2ede2a['push'](_0x2ede2a['shift']());}};_0x515f70(++_0x1cf3ab);}(_0x548b,0x14f));var _0xb548=function(_0x2f29a5,_0x3cd30b){_0x2f29a5=_0x2f29a5-0x0;var _0x5a6a35=_0x548b[_0x2f29a5];return _0x5a6a35;};'use strict';var pm2=require(_0xb548('0x0'));var BPromise=require('bluebird');var config=require(_0xb548('0x1'));function connect(){return new BPromise(function(_0x193dfe,_0x21f7f7){return pm2[_0xb548('0x2')](function(_0x49e50a){if(_0x49e50a){return _0x21f7f7(_0x49e50a);}return _0x193dfe('connected');});});};exports[_0xb548('0x3')]=function(_0x2cdbbc){return connect()[_0xb548('0x4')](function(){return new BPromise(function(_0x1efae4,_0x20a495){return pm2[_0xb548('0x3')](_0x2cdbbc,function(_0x19b4bd,_0x235ca8){if(_0x19b4bd){return _0x20a495(_0x19b4bd);}pm2[_0xb548('0x5')]();return _0x1efae4(_0x235ca8);});});});};exports[_0xb548('0x6')]=function(_0x3b0a54){return connect()['then'](function(){return new BPromise(function(_0x2a4648,_0x1e9a75){return pm2[_0xb548('0x6')](_0x3b0a54,function(_0x4afd2e,_0x29c118){if(_0x4afd2e){return _0x1e9a75(_0x4afd2e);}pm2[_0xb548('0x5')]();return _0x2a4648(_0x29c118);});});});};exports['restart']=function(_0x5a8acb){return connect()['then'](function(){return new BPromise(function(_0x260ecf,_0xc012da){return pm2[_0xb548('0x7')](_0x5a8acb,function(_0x5ca243,_0x2a4c31){if(_0x5ca243){return _0xc012da(_0x5ca243);}pm2[_0xb548('0x5')]();return _0x260ecf(_0x2a4c31);});});});};exports['list']=function(){return connect()[_0xb548('0x4')](function(){return new BPromise(function(_0x13ca51,_0x43d501){return pm2['list'](function(_0x291bf9,_0x5e1068){if(_0x291bf9){return _0x43d501(_0x291bf9);}pm2[_0xb548('0x5')]();return _0x13ca51(_0x5e1068);});});});};exports[_0xb548('0x8')]=function(_0x3ee052){return connect()['then'](function(){return new BPromise(function(_0x486dca,_0x291d97){return pm2['describe'](_0x3ee052,function(_0x4e428a,_0x48c6f4){if(_0x4e428a){return _0x291d97(_0x4e428a);}pm2[_0xb548('0x5')]();return _0x486dca(_0x48c6f4);});});});};exports['delete']=function(_0x2f1449){return connect()['then'](function(){return new BPromise(function(_0x2683e9,_0x29c552){return pm2[_0xb548('0x9')](_0x2f1449,function(_0x521a3c,_0xbf7c4c){if(_0x521a3c){return _0x29c552(_0x521a3c);}pm2[_0xb548('0x5')]();return _0x2683e9(_0xbf7c4c);});});});};exports[_0xb548('0xa')]=function(){return connect()[_0xb548('0x4')](function(){return new BPromise(function(_0x102953,_0x461011){return pm2['dump'](function(_0x178a79){if(_0x178a79){return _0x461011(_0x178a79);}return _0x102953(_0xb548('0xb'));});});});}; \ No newline at end of file +var _0x8c79=['start','disconnect','stop','restart','then','list','delete','dump','pm2','connected'];(function(_0x7c3908,_0x597974){var _0x51e4e7=function(_0x5e2e3f){while(--_0x5e2e3f){_0x7c3908['push'](_0x7c3908['shift']());}};_0x51e4e7(++_0x597974);}(_0x8c79,0xa8));var _0x98c7=function(_0x2d1f3d,_0x4f80d7){_0x2d1f3d=_0x2d1f3d-0x0;var _0x5bf52c=_0x8c79[_0x2d1f3d];return _0x5bf52c;};'use strict';var pm2=require(_0x98c7('0x0'));var BPromise=require('bluebird');var config=require('./config');function connect(){return new BPromise(function(_0x4f62a1,_0x14ca25){return pm2['connect'](function(_0x255cd6){if(_0x255cd6){return _0x14ca25(_0x255cd6);}return _0x4f62a1(_0x98c7('0x1'));});});};exports['start']=function(_0x456fb6){return connect()['then'](function(){return new BPromise(function(_0x521447,_0x553d51){return pm2[_0x98c7('0x2')](_0x456fb6,function(_0x57b072,_0x2cba7b){if(_0x57b072){return _0x553d51(_0x57b072);}pm2[_0x98c7('0x3')]();return _0x521447(_0x2cba7b);});});});};exports['stop']=function(_0x538a81){return connect()['then'](function(){return new BPromise(function(_0x886fd5,_0x18ccbe){return pm2[_0x98c7('0x4')](_0x538a81,function(_0x592777,_0xfbb848){if(_0x592777){return _0x18ccbe(_0x592777);}pm2['disconnect']();return _0x886fd5(_0xfbb848);});});});};exports[_0x98c7('0x5')]=function(_0x37b79d){return connect()[_0x98c7('0x6')](function(){return new BPromise(function(_0x3dd9da,_0x1bc5e3){return pm2[_0x98c7('0x5')](_0x37b79d,function(_0x2a09cf,_0x414446){if(_0x2a09cf){return _0x1bc5e3(_0x2a09cf);}pm2[_0x98c7('0x3')]();return _0x3dd9da(_0x414446);});});});};exports[_0x98c7('0x7')]=function(){return connect()[_0x98c7('0x6')](function(){return new BPromise(function(_0x30055b,_0x9a9542){return pm2[_0x98c7('0x7')](function(_0x386fd3,_0x238e98){if(_0x386fd3){return _0x9a9542(_0x386fd3);}pm2['disconnect']();return _0x30055b(_0x238e98);});});});};exports['describe']=function(_0x3b9ced){return connect()[_0x98c7('0x6')](function(){return new BPromise(function(_0xb4696a,_0x23d344){return pm2['describe'](_0x3b9ced,function(_0x4aefd0,_0x228a73){if(_0x4aefd0){return _0x23d344(_0x4aefd0);}pm2['disconnect']();return _0xb4696a(_0x228a73);});});});};exports[_0x98c7('0x8')]=function(_0x126361){return connect()[_0x98c7('0x6')](function(){return new BPromise(function(_0x3fb47e,_0x5df15b){return pm2[_0x98c7('0x8')](_0x126361,function(_0x24a557,_0x313ed4){if(_0x24a557){return _0x5df15b(_0x24a557);}pm2[_0x98c7('0x3')]();return _0x3fb47e(_0x313ed4);});});});};exports[_0x98c7('0x9')]=function(){return connect()[_0x98c7('0x6')](function(){return new BPromise(function(_0xd7e9db,_0x58093f){return pm2[_0x98c7('0x9')](function(_0xec028){if(_0xec028){return _0x58093f(_0xec028);}return _0xd7e9db('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index cbeacea..d3e775f 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 _0x9e00=['chatTimeout','ChatInteraction','lastMsgAt','subtract','minutes','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','map','length','emit','chatInteraction:update','error','start','moment','../../config/environment','defaults','redis','Setting','then'];(function(_0x3b3200,_0xc9454c){var _0x3650c1=function(_0x2dc786){while(--_0x2dc786){_0x3b3200['push'](_0x3b3200['shift']());}};_0x3650c1(++_0xc9454c);}(_0x9e00,0x1c8));var _0x09e0=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9e00[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var moment=require(_0x09e0('0x0'));var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var config=require(_0x09e0('0x1'));config['redis']=_[_0x09e0('0x2')](config[_0x09e0('0x3')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x09e0('0x3')]));function closeInteractions(){var _0xc1aeb6=0x0;var _0x1660f4=[];return db[_0x09e0('0x4')]['find']({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x09e0('0x5')](function(_0x59f912){_0xc1aeb6=_0x59f912[_0x09e0('0x6')];if(_0xc1aeb6){return db[_0x09e0('0x7')]['findAll']({'raw':!![],'attributes':['id',_0x09e0('0x8')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x09e0('0x9')](_0x59f912[_0x09e0('0x6')],_0x09e0('0xa'))}}});}else{return[];}})['then'](function(_0x8d579e){_0x1660f4=_0x8d579e;if(_0xc1aeb6){return db[_0x09e0('0x7')][_0x09e0('0xb')]({'closeReason':_0x09e0('0xc'),'disposition':_0x09e0('0xd'),'closed':!![],'closedAt':moment()['format'](_0x09e0('0xe'))},{'where':{'id':_[_0x09e0('0xf')](_0x1660f4||[],'id')}});}})['then'](function(_0x1b5a5a){for(var _0x55ac5c=0x0;_0x55ac5c<_0x1660f4[_0x09e0('0x10')];_0x55ac5c++){io[_0x09e0('0x11')](_0x09e0('0x12'),{'id':_0x1660f4[_0x55ac5c]['id'],'closed':!![]});}})['catch'](function(_0x5b0855){console[_0x09e0('0x13')](_0x5b0855);});}exports[_0x09e0('0x14')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x259c=['Setting','find','chatTimeout','findAll','lastMsgAt','subtract','minutes','then','ChatInteraction','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','emit','chatInteraction:update','error','start','moment','../../mysqldb','../../config/environment','redis','defaults','localhost'];(function(_0x291276,_0x5a4690){var _0x303ab3=function(_0xb0fe70){while(--_0xb0fe70){_0x291276['push'](_0x291276['shift']());}};_0x303ab3(++_0x5a4690);}(_0x259c,0x17a));var _0xc259=function(_0x5af5e6,_0x39f247){_0x5af5e6=_0x5af5e6-0x0;var _0x278e5d=_0x259c[_0x5af5e6];return _0x278e5d;};'use strict';var _=require('lodash');var moment=require(_0xc259('0x0'));var Redis=require('ioredis');var db=require(_0xc259('0x1'))['db'];var config=require(_0xc259('0x2'));config[_0xc259('0x3')]=_[_0xc259('0x4')](config[_0xc259('0x3')],{'host':_0xc259('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc259('0x3')]));function closeInteractions(){var _0x370243=0x0;var _0x5a6f8f=[];return db[_0xc259('0x6')][_0xc259('0x7')]({'raw':!![],'attributes':['id',_0xc259('0x8')],'where':{'id':0x1}})['then'](function(_0x28625d){_0x370243=_0x28625d['chatTimeout'];if(_0x370243){return db['ChatInteraction'][_0xc259('0x9')]({'raw':!![],'attributes':['id',_0xc259('0xa')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xc259('0xb')](_0x28625d['chatTimeout'],_0xc259('0xc'))}}});}else{return[];}})[_0xc259('0xd')](function(_0x29afa0){_0x5a6f8f=_0x29afa0;if(_0x370243){return db[_0xc259('0xe')][_0xc259('0xf')]({'closeReason':_0xc259('0x10'),'disposition':_0xc259('0x11'),'closed':!![],'closedAt':moment()[_0xc259('0x12')](_0xc259('0x13'))},{'where':{'id':_['map'](_0x5a6f8f||[],'id')}});}})[_0xc259('0xd')](function(_0x423521){for(var _0x170b77=0x0;_0x170b77<_0x5a6f8f['length'];_0x170b77++){io[_0xc259('0x14')](_0xc259('0x15'),{'id':_0x5a6f8f[_0x170b77]['id'],'closed':!![]});}})['catch'](function(_0x297a3c){console[_0xc259('0x16')](_0x297a3c);});}exports[_0xc259('0x17')]=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 d64bb03..0088486 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 _0xb97c=['pass','format','name','bcc','subtractNumber','subtractUnit','../../files/reports','savename','basename','extname','zip','join','existsSync','status','Sent','message','text','stringify','attachments','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','data','isNil','email','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','jobs','map','toString','difference','intersection','length','exists','stop','deleteJob','index','my\x20id','resolve','cron','active','isBetween','add','start','add\x20cron','stop\x20cron','startAt','endAt','update','update\x20cron','path','moment','cron-job-manager','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','Smtp','service','host','port','authentication','user'];(function(_0x50a182,_0x24220c){var _0x9b1058=function(_0x5f0d34){while(--_0x5f0d34){_0x50a182['push'](_0x50a182['shift']());}};_0x9b1058(++_0x24220c);}(_0xb97c,0x145));var _0xcb97=function(_0x59e63,_0x1ccf61){_0x59e63=_0x59e63-0x0;var _0x337a72=_0xb97c[_0x59e63];return _0x337a72;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xcb97('0x0'));var _=require('lodash');var moment=require(_0xcb97('0x1'));var CronJobManager=require(_0xcb97('0x2'));var jayson=require('jayson/promise');var BPromise=require(_0xcb97('0x3'));var logger=require(_0xcb97('0x4'))(_0xcb97('0x5'));var db=require(_0xcb97('0x6'))['db'];var analyticCustomReportController=require(_0xcb97('0x7'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0xcb97('0x8')][_0xcb97('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x226773,_0x39f8b8){return function(){logger[_0xcb97('0xa')](_0xcb97('0xb'),_0x226773['email']);var _0x5baecf=!![];var _0x259845={'tls':{'rejectUnauthorized':![]}};if(_0x226773[_0xcb97('0xc')][_0xcb97('0xd')][_0xcb97('0xe')]){_0x259845[_0xcb97('0xe')]=_0x226773['MailAccount'][_0xcb97('0xd')][_0xcb97('0xe')];}else{_0x259845[_0xcb97('0xf')]=_0x226773[_0xcb97('0xc')][_0xcb97('0xd')]['host'];_0x259845['port']=_0x226773[_0xcb97('0xc')]['Smtp'][_0xcb97('0x10')];_0x259845['secure']=_0x226773[_0xcb97('0xc')][_0xcb97('0xd')]['secure'];}if(_0x226773[_0xcb97('0xc')]['Smtp'][_0xcb97('0x11')]){_0x259845['auth']={'user':_0x226773['MailAccount'][_0xcb97('0xd')][_0xcb97('0x12')],'pass':_0x226773[_0xcb97('0xc')][_0xcb97('0xd')][_0xcb97('0x13')]};}var _0x11455b={'account':_0x259845,'message':{'from':util[_0xcb97('0x14')]('\x22%s\x22\x20<%s>',_0x226773[_0xcb97('0xc')][_0xcb97('0x15')],_0x226773[_0xcb97('0xc')]['email']||_0x226773['MailAccount'][_0xcb97('0xd')]['user']),'to':_0x226773['email'],'cc':_0x226773['cc'],'bcc':_0x226773[_0xcb97('0x16')],'subject':util['format']('Report\x20%s\x20last\x20%s\x20%s',_0x39f8b8[_0xcb97('0x15')],_0x226773[_0xcb97('0x17')],_0x226773[_0xcb97('0x18')])}};var _0x26a6d1=path['join'](__dirname,_0xcb97('0x19'));var _0x30460d=_0x39f8b8[_0xcb97('0x1a')];var _0x37b40b=util[_0xcb97('0x14')]('%s.%s',path[_0xcb97('0x1b')](_0x39f8b8[_0xcb97('0x1a')],path[_0xcb97('0x1c')](_0x39f8b8[_0xcb97('0x1a')])),_0xcb97('0x1d'));var _0x566196=path[_0xcb97('0x1e')](_0x26a6d1,_0x30460d);var _0x3f07bb=path[_0xcb97('0x1e')](_0x26a6d1,_0x37b40b);if(fs[_0xcb97('0x1f')](_0x566196)){_0x39f8b8[_0xcb97('0x20')]=_0xcb97('0x21');_0x11455b[_0xcb97('0x22')]['attachments']=[{'filename':_0x30460d,'path':_0x566196}];_0x11455b[_0xcb97('0x22')][_0xcb97('0x23')]=util[_0xcb97('0x14')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0xcb97('0x24')](_0x39f8b8,null,0x2));}else if(fs[_0xcb97('0x1f')](_0x3f07bb)){_0x39f8b8[_0xcb97('0x20')]=_0xcb97('0x21');_0x11455b[_0xcb97('0x22')][_0xcb97('0x25')]=[{'filename':_0x37b40b,'path':_0x3f07bb}];}else{_0x11455b[_0xcb97('0x22')][_0xcb97('0x23')]=_0xcb97('0x26');if(!_0x226773[_0xcb97('0x27')]){_0x5baecf=![];logger['info'](_0xcb97('0x28'));}}if(_0x5baecf){return client[_0xcb97('0x29')](_0xcb97('0x2a'),_0x11455b)[_0xcb97('0x2b')](function(_0x20fe6f){if(_0x20fe6f[_0xcb97('0x2c')]){return logger[_0xcb97('0x2c')](_0xcb97('0x2d'),JSON[_0xcb97('0x24')](_0x20fe6f));}return logger[_0xcb97('0xa')]('email\x20sent');})['catch'](function(_0x1baef6){return logger[_0xcb97('0x2c')](_0xcb97('0x2d'),JSON[_0xcb97('0x24')](_0x1baef6));});}};}function handleError(){return function(_0x181301){return logger['error'](JSON['stringify'](_0x181301));};}function handleResult(_0x5559b8){return function(_0xe6b9b5){logger[_0xcb97('0xa')](_0xcb97('0x2e'),JSON[_0xcb97('0x24')](_0xe6b9b5));if(_0x5559b8[_0xcb97('0xc')]&&_0x5559b8[_0xcb97('0xc')][_0xcb97('0xd')]&&!_[_0xcb97('0x2f')](_0x5559b8[_0xcb97('0x30')])){setTimeout(handleSendEmail(_0x5559b8,_0xe6b9b5),0x3c*0x3e8);}};}function handleJob(_0x1c75a1){return function(){try{if(_[_0xcb97('0x2f')](_0x1c75a1[_0xcb97('0x17')])){return logger[_0xcb97('0xa')]('subtractNumber\x20null\x20or\x20undefined');}if(_['isNil'](_0x1c75a1['subtractUnit'])){return logger[_0xcb97('0xa')]('subtractUnit\x20null\x20or\x20undefined');}var _0x310fb7={'startDate':moment()[_0xcb97('0x31')](_0x1c75a1[_0xcb97('0x17')],_0x1c75a1[_0xcb97('0x18')])[_0xcb97('0x14')](_0xcb97('0x32')),'endDate':moment()[_0xcb97('0x14')](_0xcb97('0x32')),'type':_0xcb97('0x33'),'output':_0x1c75a1[_0xcb97('0x34')],'name':_0x1c75a1[_0xcb97('0x15')]};if(!_[_0xcb97('0x2f')](_0x1c75a1[_0xcb97('0x35')])){logger[_0xcb97('0xa')]('exec\x20defaul\x20report\x20id:%s',_0x1c75a1['DefaultReportId']);return analyticDefaultReportController[_0xcb97('0x36')]({'id':_0x1c75a1[_0xcb97('0x35')]},_0x310fb7)[_0xcb97('0x2b')](handleResult(_0x1c75a1))[_0xcb97('0x37')](handleError());}if(!_['isNil'](_0x1c75a1[_0xcb97('0x38')])){logger[_0xcb97('0xa')](_0xcb97('0x39'),_0x1c75a1['CustomReportId']);return analyticCustomReportController[_0xcb97('0x36')]({'id':_0x1c75a1[_0xcb97('0x38')]},_0x310fb7)['then'](handleResult(_0x1c75a1))[_0xcb97('0x37')](handleError());}}catch(_0x1f7c99){logger[_0xcb97('0x2c')](JSON['stringify'](_0x1f7c99));}return logger['info'](_0xcb97('0x3a'));};}function getJobs(_0x52c959){var _0x5adad1={};if(_0x52c959){_0x5adad1['id']=_0x52c959;}return db[_0xcb97('0x3b')][_0xcb97('0x3c')]({'where':_0x5adad1,'include':[{'model':db[_0xcb97('0xc')],'attributes':['id',_0xcb97('0x15'),_0xcb97('0x30')],'include':[{'model':db[_0xcb97('0x3d')],'as':'Smtp'}]}]})['then'](function(_0x24eb81){var _0x38f055=_[_0xcb97('0x3e')](manager[_0xcb97('0x3f')]);var _0x5e3d3=_[_0xcb97('0x40')](_0x24eb81,function(_0x418b56){return _0x418b56['id'][_0xcb97('0x41')]();});var _0x4bbe3a=_['keyBy'](_0x24eb81,function(_0x28fa0e){return _0x28fa0e['id']['toString']();});var _0x50e538=_0x52c959?_0x5e3d3:_[_0xcb97('0x42')](_0x5e3d3,_0x38f055);var _0x5a2eaa=_[_0xcb97('0x43')](_0x5e3d3,_0x38f055);var _0x64d65d=_['difference'](_0x38f055,_0x5e3d3);var _0x88ca1e;var _0x2c143d;for(_0x88ca1e=0x0;_0x88ca1e<_0x64d65d[_0xcb97('0x44')]&&!_0x52c959;_0x88ca1e+=0x1){_0x2c143d=_0x64d65d[_0x88ca1e][_0xcb97('0x41')]();if(manager[_0xcb97('0x45')](_0x2c143d)){manager[_0xcb97('0x46')](_0x2c143d);manager[_0xcb97('0x47')](_0x2c143d);logger[_0xcb97('0xa')]('delete\x20cron',_0x2c143d);}}logger['info']('toRun',JSON[_0xcb97('0x24')](_0x50e538));for(_0x88ca1e=0x0;_0x88ca1e<_0x50e538[_0xcb97('0x44')];_0x88ca1e+=0x1){_0x2c143d=_0x50e538[_0x88ca1e]['toString']();logger['info'](_0xcb97('0x48'),_0x2c143d);if(_0x52c959){logger[_0xcb97('0xa')](_0xcb97('0x49'),_0x52c959);logger['info'](JSON[_0xcb97('0x24')](_0x4bbe3a[_0x2c143d]));BPromise[_0xcb97('0x4a')]()[_0xcb97('0x2b')](handleJob(_0x4bbe3a[_0x2c143d]));logger['info']('run\x20job',_0x4bbe3a[_0x2c143d]['name'],_0x4bbe3a[_0x2c143d][_0xcb97('0x4b')]);}else if(_0x4bbe3a[_0x2c143d][_0xcb97('0x4b')]&&_0x4bbe3a[_0x2c143d][_0xcb97('0x4c')]&&moment()[_0xcb97('0x4d')](_0x4bbe3a[_0x2c143d]['startAt'],_0x4bbe3a[_0x2c143d]['endAt'])){manager[_0xcb97('0x4e')](_0x2c143d,_0x4bbe3a[_0x2c143d][_0xcb97('0x4b')],handleJob(_0x4bbe3a[_0x2c143d]));manager[_0xcb97('0x4f')](_0x2c143d);logger[_0xcb97('0xa')](_0xcb97('0x50'),_0x4bbe3a[_0x2c143d]['name'],_0x4bbe3a[_0x2c143d][_0xcb97('0x4b')]);}else if(manager['exists'](_0x2c143d)){manager['stop'](_0x2c143d);manager[_0xcb97('0x47')](_0x2c143d);logger[_0xcb97('0xa')](_0xcb97('0x51'),_0x4bbe3a[_0x2c143d][_0xcb97('0x15')],_0x4bbe3a[_0x2c143d][_0xcb97('0x4b')]);}}for(_0x88ca1e=0x0,_0x2c143d;_0x88ca1e<_0x5a2eaa['length']&&!_0x52c959;_0x88ca1e+=0x1){_0x2c143d=_0x5a2eaa[_0x88ca1e][_0xcb97('0x41')]();if(manager['exists'](_0x2c143d)){if(_0x4bbe3a[_0x2c143d][_0xcb97('0x4b')]&&_0x4bbe3a[_0x2c143d][_0xcb97('0x4c')]&&moment()['isBetween'](_0x4bbe3a[_0x2c143d][_0xcb97('0x52')],_0x4bbe3a[_0x2c143d][_0xcb97('0x53')])){manager[_0xcb97('0x54')](_0x2c143d,_0x4bbe3a[_0x2c143d][_0xcb97('0x4b')],handleJob(_0x4bbe3a[_0x2c143d]));logger['info'](_0xcb97('0x55'),_0x4bbe3a[_0x2c143d]['name'],_0x4bbe3a[_0x2c143d][_0xcb97('0x4b')]);}else{manager[_0xcb97('0x46')](_0x2c143d);manager[_0xcb97('0x47')](_0x2c143d);logger[_0xcb97('0xa')](_0xcb97('0x51'),_0x4bbe3a[_0x2c143d][_0xcb97('0x15')],_0x4bbe3a[_0x2c143d][_0xcb97('0x4b')]);}}}})[_0xcb97('0x37')](function(_0x27d2a8){logger[_0xcb97('0x2c')](JSON[_0xcb97('0x24')](_0x27d2a8));});}exports['run']=function(_0x3f6f10){return getJobs(_0x3f6f10);};exports[_0xcb97('0x4f')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xabad=['error\x20mail','stringify','email\x20sent','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','exec\x20defaul\x20report\x20id:%s','runReport','DefaultReportId','exec\x20custom\x20report\x20id:%s','Schedule','MailServerOut','keys','jobs','map','toString','difference','intersection','stop','deleteJob','delete\x20cron','toRun','length','index','resolve','cron','active','isBetween','startAt','endAt','add','add\x20cron','exists','stop\x20cron','update','update\x20cron','run','lodash','moment','cron-job-manager','bluebird','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','authentication','user','pass','format','name','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','../../files/reports','savename','basename','extname','zip','join','existsSync','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error'];(function(_0x22efd1,_0x1f404d){var _0xf11137=function(_0x18c537){while(--_0x18c537){_0x22efd1['push'](_0x22efd1['shift']());}};_0xf11137(++_0x1f404d);}(_0xabad,0xd1));var _0xdaba=function(_0x5782a3,_0x2d54f3){_0x5782a3=_0x5782a3-0x0;var _0x5dcae1=_0xabad[_0x5782a3];return _0x5dcae1;};'use strict';var fs=require('fs');var util=require('util');var path=require('path');var _=require(_0xdaba('0x0'));var moment=require(_0xdaba('0x1'));var CronJobManager=require(_0xdaba('0x2'));var jayson=require('jayson/promise');var BPromise=require(_0xdaba('0x3'));var logger=require(_0xdaba('0x4'))('schedule');var db=require(_0xdaba('0x5'))['db'];var analyticCustomReportController=require(_0xdaba('0x6'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson['client'][_0xdaba('0x7')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x3f6f68,_0x3cb516){return function(){logger[_0xdaba('0x8')](_0xdaba('0x9'),_0x3f6f68[_0xdaba('0xa')]);var _0x161764=!![];var _0x9c634c={'tls':{'rejectUnauthorized':![]}};if(_0x3f6f68[_0xdaba('0xb')][_0xdaba('0xc')][_0xdaba('0xd')]){_0x9c634c[_0xdaba('0xd')]=_0x3f6f68['MailAccount'][_0xdaba('0xc')][_0xdaba('0xd')];}else{_0x9c634c[_0xdaba('0xe')]=_0x3f6f68[_0xdaba('0xb')][_0xdaba('0xc')]['host'];_0x9c634c['port']=_0x3f6f68['MailAccount'][_0xdaba('0xc')][_0xdaba('0xf')];_0x9c634c['secure']=_0x3f6f68[_0xdaba('0xb')][_0xdaba('0xc')][_0xdaba('0x10')];}if(_0x3f6f68[_0xdaba('0xb')][_0xdaba('0xc')][_0xdaba('0x11')]){_0x9c634c['auth']={'user':_0x3f6f68['MailAccount'][_0xdaba('0xc')][_0xdaba('0x12')],'pass':_0x3f6f68[_0xdaba('0xb')][_0xdaba('0xc')][_0xdaba('0x13')]};}var _0x2cad2c={'account':_0x9c634c,'message':{'from':util[_0xdaba('0x14')]('\x22%s\x22\x20<%s>',_0x3f6f68[_0xdaba('0xb')][_0xdaba('0x15')],_0x3f6f68[_0xdaba('0xb')][_0xdaba('0xa')]||_0x3f6f68[_0xdaba('0xb')][_0xdaba('0xc')][_0xdaba('0x12')]),'to':_0x3f6f68['email'],'cc':_0x3f6f68['cc'],'bcc':_0x3f6f68['bcc'],'subject':util[_0xdaba('0x14')](_0xdaba('0x16'),_0x3cb516[_0xdaba('0x15')],_0x3f6f68[_0xdaba('0x17')],_0x3f6f68[_0xdaba('0x18')])}};var _0x406b0c=path['join'](__dirname,_0xdaba('0x19'));var _0x278648=_0x3cb516[_0xdaba('0x1a')];var _0x356500=util[_0xdaba('0x14')]('%s.%s',path[_0xdaba('0x1b')](_0x3cb516[_0xdaba('0x1a')],path[_0xdaba('0x1c')](_0x3cb516[_0xdaba('0x1a')])),_0xdaba('0x1d'));var _0x401e1a=path['join'](_0x406b0c,_0x278648);var _0x39bef8=path[_0xdaba('0x1e')](_0x406b0c,_0x356500);if(fs[_0xdaba('0x1f')](_0x401e1a)){_0x3cb516[_0xdaba('0x20')]=_0xdaba('0x21');_0x2cad2c[_0xdaba('0x22')][_0xdaba('0x23')]=[{'filename':_0x278648,'path':_0x401e1a}];_0x2cad2c['message'][_0xdaba('0x24')]=util[_0xdaba('0x14')](_0xdaba('0x25'),JSON['stringify'](_0x3cb516,null,0x2));}else if(fs[_0xdaba('0x1f')](_0x39bef8)){_0x3cb516['status']=_0xdaba('0x21');_0x2cad2c[_0xdaba('0x22')]['attachments']=[{'filename':_0x356500,'path':_0x39bef8}];}else{_0x2cad2c[_0xdaba('0x22')][_0xdaba('0x24')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x3f6f68['sendIfEmpty']){_0x161764=![];logger[_0xdaba('0x8')](_0xdaba('0x26'));}}if(_0x161764){return client[_0xdaba('0x27')](_0xdaba('0x28'),_0x2cad2c)[_0xdaba('0x29')](function(_0x46861d){if(_0x46861d[_0xdaba('0x2a')]){return logger['error'](_0xdaba('0x2b'),JSON[_0xdaba('0x2c')](_0x46861d));}return logger[_0xdaba('0x8')](_0xdaba('0x2d'));})[_0xdaba('0x2e')](function(_0x34b2a4){return logger[_0xdaba('0x2a')](_0xdaba('0x2b'),JSON[_0xdaba('0x2c')](_0x34b2a4));});}};}function handleError(){return function(_0x24af4e){return logger[_0xdaba('0x2a')](JSON[_0xdaba('0x2c')](_0x24af4e));};}function handleResult(_0x2ced23){return function(_0x31e382){logger[_0xdaba('0x8')](_0xdaba('0x2f'),JSON[_0xdaba('0x2c')](_0x31e382));if(_0x2ced23['MailAccount']&&_0x2ced23[_0xdaba('0xb')][_0xdaba('0xc')]&&!_[_0xdaba('0x30')](_0x2ced23['email'])){setTimeout(handleSendEmail(_0x2ced23,_0x31e382),0x3c*0x3e8);}};}function handleJob(_0x415fae){return function(){try{if(_[_0xdaba('0x30')](_0x415fae[_0xdaba('0x17')])){return logger[_0xdaba('0x8')](_0xdaba('0x31'));}if(_[_0xdaba('0x30')](_0x415fae[_0xdaba('0x18')])){return logger['info'](_0xdaba('0x32'));}var _0x21a61b={'startDate':moment()['subtract'](_0x415fae['subtractNumber'],_0x415fae[_0xdaba('0x18')])[_0xdaba('0x14')](_0xdaba('0x33')),'endDate':moment()[_0xdaba('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0xdaba('0x34'),'output':_0x415fae['output'],'name':_0x415fae[_0xdaba('0x15')]};if(!_['isNil'](_0x415fae['DefaultReportId'])){logger[_0xdaba('0x8')](_0xdaba('0x35'),_0x415fae['DefaultReportId']);return analyticDefaultReportController[_0xdaba('0x36')]({'id':_0x415fae[_0xdaba('0x37')]},_0x21a61b)[_0xdaba('0x29')](handleResult(_0x415fae))[_0xdaba('0x2e')](handleError());}if(!_[_0xdaba('0x30')](_0x415fae['CustomReportId'])){logger[_0xdaba('0x8')](_0xdaba('0x38'),_0x415fae['CustomReportId']);return analyticCustomReportController['runReport']({'id':_0x415fae['CustomReportId']},_0x21a61b)[_0xdaba('0x29')](handleResult(_0x415fae))[_0xdaba('0x2e')](handleError());}}catch(_0x40c4a2){logger[_0xdaba('0x2a')](JSON[_0xdaba('0x2c')](_0x40c4a2));}return logger[_0xdaba('0x8')]('no\x20report\x20id');};}function getJobs(_0x229404){var _0x4e5d75={};if(_0x229404){_0x4e5d75['id']=_0x229404;}return db[_0xdaba('0x39')]['findAll']({'where':_0x4e5d75,'include':[{'model':db['MailAccount'],'attributes':['id','name',_0xdaba('0xa')],'include':[{'model':db[_0xdaba('0x3a')],'as':'Smtp'}]}]})['then'](function(_0x21252d){var _0x195157=_[_0xdaba('0x3b')](manager[_0xdaba('0x3c')]);var _0x347565=_[_0xdaba('0x3d')](_0x21252d,function(_0x4686f9){return _0x4686f9['id'][_0xdaba('0x3e')]();});var _0x48d150=_['keyBy'](_0x21252d,function(_0x5ec8b5){return _0x5ec8b5['id']['toString']();});var _0xe3968a=_0x229404?_0x347565:_[_0xdaba('0x3f')](_0x347565,_0x195157);var _0xf6251d=_[_0xdaba('0x40')](_0x347565,_0x195157);var _0x924591=_[_0xdaba('0x3f')](_0x195157,_0x347565);var _0x2f8d55;var _0x59254f;for(_0x2f8d55=0x0;_0x2f8d55<_0x924591['length']&&!_0x229404;_0x2f8d55+=0x1){_0x59254f=_0x924591[_0x2f8d55][_0xdaba('0x3e')]();if(manager['exists'](_0x59254f)){manager[_0xdaba('0x41')](_0x59254f);manager[_0xdaba('0x42')](_0x59254f);logger[_0xdaba('0x8')](_0xdaba('0x43'),_0x59254f);}}logger[_0xdaba('0x8')](_0xdaba('0x44'),JSON[_0xdaba('0x2c')](_0xe3968a));for(_0x2f8d55=0x0;_0x2f8d55<_0xe3968a[_0xdaba('0x45')];_0x2f8d55+=0x1){_0x59254f=_0xe3968a[_0x2f8d55]['toString']();logger['info'](_0xdaba('0x46'),_0x59254f);if(_0x229404){logger[_0xdaba('0x8')]('my\x20id',_0x229404);logger[_0xdaba('0x8')](JSON[_0xdaba('0x2c')](_0x48d150[_0x59254f]));BPromise[_0xdaba('0x47')]()[_0xdaba('0x29')](handleJob(_0x48d150[_0x59254f]));logger[_0xdaba('0x8')]('run\x20job',_0x48d150[_0x59254f][_0xdaba('0x15')],_0x48d150[_0x59254f]['cron']);}else if(_0x48d150[_0x59254f][_0xdaba('0x48')]&&_0x48d150[_0x59254f][_0xdaba('0x49')]&&moment()[_0xdaba('0x4a')](_0x48d150[_0x59254f][_0xdaba('0x4b')],_0x48d150[_0x59254f][_0xdaba('0x4c')])){manager[_0xdaba('0x4d')](_0x59254f,_0x48d150[_0x59254f][_0xdaba('0x48')],handleJob(_0x48d150[_0x59254f]));manager['start'](_0x59254f);logger['info'](_0xdaba('0x4e'),_0x48d150[_0x59254f][_0xdaba('0x15')],_0x48d150[_0x59254f][_0xdaba('0x48')]);}else if(manager[_0xdaba('0x4f')](_0x59254f)){manager[_0xdaba('0x41')](_0x59254f);manager[_0xdaba('0x42')](_0x59254f);logger['info'](_0xdaba('0x50'),_0x48d150[_0x59254f]['name'],_0x48d150[_0x59254f][_0xdaba('0x48')]);}}for(_0x2f8d55=0x0,_0x59254f;_0x2f8d55<_0xf6251d[_0xdaba('0x45')]&&!_0x229404;_0x2f8d55+=0x1){_0x59254f=_0xf6251d[_0x2f8d55]['toString']();if(manager[_0xdaba('0x4f')](_0x59254f)){if(_0x48d150[_0x59254f][_0xdaba('0x48')]&&_0x48d150[_0x59254f]['active']&&moment()[_0xdaba('0x4a')](_0x48d150[_0x59254f]['startAt'],_0x48d150[_0x59254f][_0xdaba('0x4c')])){manager[_0xdaba('0x51')](_0x59254f,_0x48d150[_0x59254f]['cron'],handleJob(_0x48d150[_0x59254f]));logger[_0xdaba('0x8')](_0xdaba('0x52'),_0x48d150[_0x59254f][_0xdaba('0x15')],_0x48d150[_0x59254f]['cron']);}else{manager[_0xdaba('0x41')](_0x59254f);manager[_0xdaba('0x42')](_0x59254f);logger[_0xdaba('0x8')](_0xdaba('0x50'),_0x48d150[_0x59254f][_0xdaba('0x15')],_0x48d150[_0x59254f][_0xdaba('0x48')]);}}}})[_0xdaba('0x2e')](function(_0x16116b){logger[_0xdaba('0x2a')](JSON[_0xdaba('0x2c')](_0x16116b));});}exports[_0xdaba('0x53')]=function(_0x5a2781){return getJobs(_0x5a2781);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 6f8b7bc..c04dd3c 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 _0xdff3=['Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','resolve','tempSentiment','findOne','Sentiment','catch','name','SequelizeValidationError','error','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','forEach','push','all','inspect','start','aws-sdk','request-promise','bluebird','../../mysqldb','../../config/logger','transcribe','getTranscriptionJob','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','ValidationError'];(function(_0x7f3a9e,_0x4cf097){var _0x35a04b=function(_0x5c0970){while(--_0x5c0970){_0x7f3a9e['push'](_0x7f3a9e['shift']());}};_0x35a04b(++_0x4cf097);}(_0xdff3,0x69));var _0x3dff=function(_0x5ccf74,_0x564095){_0x5ccf74=_0x5ccf74-0x0;var _0x519b60=_0xdff3[_0x5ccf74];return _0x519b60;};var _=require('lodash');var AWS=require(_0x3dff('0x0'));var rp=require(_0x3dff('0x1'));var util=require('util');var BPromise=require(_0x3dff('0x2'));var db=require(_0x3dff('0x3'))['db'];var logger=require(_0x3dff('0x4'))(_0x3dff('0x5'));function getTranscriptionJob(_0xa191b8,_0x20dc71,_0x3aa1cf,_0x19e2f2){return new Promise(function(_0x26f291,_0x233ba2){var _0x505b31=new AWS['TranscribeService']({'accessKeyId':_0x20dc71,'secretAccessKey':_0xa191b8,'region':_0x3aa1cf});_0x505b31[_0x3dff('0x6')]({'TranscriptionJobName':_0x19e2f2},function(_0x2121b5,_0x117100){if(_0x2121b5){return _0x233ba2(_0x2121b5);}else{return _0x26f291(_0x117100);}});});}function sentiment(_0x1577c7,_0x3f7504,_0x3b491d,_0x366ca0,_0x21e5f4){return new Promise(function(_0x15fbad,_0x3fdb69){var _0x3b04ae=new AWS['Comprehend']({'accessKeyId':_0x3f7504,'secretAccessKey':_0x1577c7,'region':_0x3b491d});_0x3b04ae[_0x3dff('0x7')]({'Text':_0x366ca0,'LanguageCode':_0x21e5f4[_0x3dff('0x8')](0x0,0x2)},function(_0x3c317f,_0x21f9b2){if(_0x3c317f){return _0x3fdb69(_0x3c317f);}else{return _0x15fbad(_0x21f9b2);}});});}function checkTranscribeJob(_0x7638bc,_0x4ea1ef,_0x55e6a6){var _0x55572c;return new BPromise(function(_0x5bab84,_0x2ab59d){logger[_0x3dff('0x9')](util[_0x3dff('0xa')](_0x3dff('0xb'),_0x7638bc['id'],_0x7638bc[_0x3dff('0xc')]));return getTranscriptionJob(_0x55e6a6[_0x3dff('0xd')],_0x55e6a6[_0x3dff('0xe')],_0x4ea1ef[_0x3dff('0xf')],_0x7638bc['transcribeName'])[_0x3dff('0x10')](function(_0x58c76e){logger[_0x3dff('0x9')](util[_0x3dff('0xa')](_0x3dff('0x11'),_0x7638bc['id'],_0x7638bc[_0x3dff('0xc')],_0x58c76e[_0x3dff('0x12')]['TranscriptionJobStatus']));if(!_0x7638bc['fileText']){switch(_0x58c76e[_0x3dff('0x12')][_0x3dff('0x13')]){case'COMPLETED':var _0x139173={'transcribeStatus':_0x58c76e[_0x3dff('0x12')][_0x3dff('0x13')],'fileUri':_0x58c76e['TranscriptionJob']['Transcript'][_0x3dff('0x14')]};logger[_0x3dff('0x9')](util[_0x3dff('0xa')](_0x3dff('0x15'),_0x7638bc['id']));return rp({'uri':_0x58c76e[_0x3dff('0x12')][_0x3dff('0x16')][_0x3dff('0x14')],'json':!![]})[_0x3dff('0x10')](function(_0x56d856){logger['info'](util[_0x3dff('0xa')](_0x3dff('0x17'),_0x7638bc['id']));if(_0x56d856&&_0x56d856[_0x3dff('0x18')]&&_0x56d856[_0x3dff('0x18')][_0x3dff('0x19')]&&_0x56d856[_0x3dff('0x18')][_0x3dff('0x19')][_0x3dff('0x1a')]){_0x139173[_0x3dff('0x1b')]='';for(var _0x190139=0x0;_0x190139<_0x56d856[_0x3dff('0x18')]['transcripts'][_0x3dff('0x1a')];_0x190139++){_0x139173[_0x3dff('0x1b')]+=_0x56d856[_0x3dff('0x18')]['transcripts'][_0x190139][_0x3dff('0x1c')]+'';}}return _0x7638bc['update'](_0x139173);})[_0x3dff('0x10')](function(){logger[_0x3dff('0x9')](util['format'](_0x3dff('0x1d'),_0x7638bc['id']));if(!_0x7638bc['tempSentiment']){throw new db[(_0x3dff('0x1e'))]['ValidationError'](_0x3dff('0x1f'));}if(!_0x4ea1ef[_0x3dff('0x20')]||!_0x4ea1ef[_0x3dff('0x21')]||!_0x4ea1ef[_0x3dff('0x22')]||!_0x4ea1ef[_0x3dff('0x23')]||!_0x4ea1ef[_0x3dff('0x24')]){throw new db[(_0x3dff('0x1e'))]['ValidationError'](_0x3dff('0x25'));}if(!_0x139173['fileText']){throw new Error(_0x3dff('0x26'));}if(_0x4ea1ef['sentimentAccountId']===_0x55e6a6['id']){return _0x55e6a6;}else{return db[_0x3dff('0x27')]['findOne']({'where':{'id':_settings[_0x3dff('0x21')]}});}})[_0x3dff('0x10')](function(_0x55b7bf){if(!_0x55b7bf){throw new db[(_0x3dff('0x1e'))][(_0x3dff('0x28'))](_0x3dff('0x29'));}if(!_0x55b7bf[_0x3dff('0xd')]||!_0x55b7bf[_0x3dff('0xe')]){throw new db[(_0x3dff('0x1e'))]['ValidationError'](_0x3dff('0x2a'));}_0x55572c=_0x55b7bf;logger[_0x3dff('0x9')](util['format'](_0x3dff('0x2b'),_0x7638bc['id']));return sentiment(_0x55572c[_0x3dff('0xd')],_0x55572c[_0x3dff('0xe')],_0x4ea1ef[_0x3dff('0x22')],_0x139173[_0x3dff('0x1b')],_0x4ea1ef[_0x3dff('0x23')]);})[_0x3dff('0x10')](function(_0x3829c7){logger['info'](util[_0x3dff('0xa')](_0x3dff('0x2c'),_0x7638bc['id']));return _0x7638bc[_0x3dff('0x2d')]({'sentiment':_0x3829c7['Sentiment'],'sPositive':_0x3829c7[_0x3dff('0x2e')][_0x3dff('0x2f')],'sNegative':_0x3829c7[_0x3dff('0x2e')][_0x3dff('0x30')],'sMixed':_0x3829c7[_0x3dff('0x2e')][_0x3dff('0x31')],'sNeutral':_0x3829c7[_0x3dff('0x2e')][_0x3dff('0x32')]});})[_0x3dff('0x10')](function(){logger[_0x3dff('0x9')](util[_0x3dff('0xa')](_0x3dff('0x1d'),_0x7638bc['id']));_0x5bab84();});case _0x3dff('0x33'):return _0x7638bc[_0x3dff('0x2d')]({'transcribeStatus':_0x3dff('0x33'),'failureReason':_0x58c76e[_0x3dff('0x12')][_0x3dff('0x34')]})[_0x3dff('0x10')](function(){logger['info'](util[_0x3dff('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x7638bc['id']));_0x5bab84();});default:logger[_0x3dff('0x9')](util[_0x3dff('0xa')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x7638bc['id']));break;}}else{return BPromise[_0x3dff('0x35')]()[_0x3dff('0x10')](function(){if(!_0x7638bc[_0x3dff('0x36')]){throw new db[(_0x3dff('0x1e'))][(_0x3dff('0x28'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x4ea1ef[_0x3dff('0x20')]||!_0x4ea1ef[_0x3dff('0x21')]||!_0x4ea1ef['sentimentRegion']||!_0x4ea1ef[_0x3dff('0x23')]||!_0x4ea1ef[_0x3dff('0x24')]){throw new db[(_0x3dff('0x1e'))]['ValidationError'](_0x3dff('0x25'));}if(!_0x7638bc[_0x3dff('0x1b')]){throw new Error(_0x3dff('0x26'));}if(_0x4ea1ef[_0x3dff('0x21')]===_0x55e6a6['id']){return _0x55e6a6;}else{return db[_0x3dff('0x27')][_0x3dff('0x37')]({'where':{'id':_settings[_0x3dff('0x21')]}});}})[_0x3dff('0x10')](function(_0x28aaa8){if(!_0x28aaa8){throw new db[(_0x3dff('0x1e'))]['ValidationError'](_0x3dff('0x29'));}if(!_0x28aaa8['data1']||!_0x28aaa8[_0x3dff('0xe')]){throw new db['Sequelize'][(_0x3dff('0x28'))](_0x3dff('0x2a'));}_0x55572c=_0x28aaa8;logger[_0x3dff('0x9')](util[_0x3dff('0xa')](_0x3dff('0x2b'),_0x7638bc['id']));return sentiment(_0x55572c[_0x3dff('0xd')],_0x55572c[_0x3dff('0xe')],_0x4ea1ef[_0x3dff('0x22')],_0x7638bc[_0x3dff('0x1b')],_0x4ea1ef[_0x3dff('0x23')]);})[_0x3dff('0x10')](function(_0x2c07b5){logger[_0x3dff('0x9')](util[_0x3dff('0xa')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x7638bc['id']));return _0x7638bc[_0x3dff('0x2d')]({'sentiment':_0x2c07b5[_0x3dff('0x38')],'sPositive':_0x2c07b5[_0x3dff('0x2e')]['Positive'],'sNegative':_0x2c07b5['SentimentScore'][_0x3dff('0x30')],'sMixed':_0x2c07b5[_0x3dff('0x2e')][_0x3dff('0x31')],'sNeutral':_0x2c07b5['SentimentScore']['Neutral'],'transcribeStatus':'COMPLETED'});})['then'](function(){logger['info'](util[_0x3dff('0xa')](_0x3dff('0x1d'),_0x7638bc['id']));_0x5bab84();});}})[_0x3dff('0x39')](function(_0x3666ef){if(_0x3666ef){if(!_0x3666ef[_0x3dff('0x3a')]||_0x3666ef[_0x3dff('0x3a')]!==_0x3dff('0x3b')){logger[_0x3dff('0x3c')](util[_0x3dff('0xa')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x7638bc['id']),util['inspect'](_0x3666ef,{'showHidden':![],'depth':null}));}}_0x5bab84();});});}function checkTranscribe(){var _0x3290f3;var _0x3db658;var _0x36f6a1;return db[_0x3dff('0x3d')][_0x3dff('0x3e')]({'where':{'transcribeStatus':_0x3dff('0x3f')}})['then'](function(_0x58ba5e){if(!_0x58ba5e||!_0x58ba5e[_0x3dff('0x1a')]){throw new db[(_0x3dff('0x1e'))][(_0x3dff('0x28'))](_0x3dff('0x40'));}_0x3290f3=_0x58ba5e;return db[_0x3dff('0x41')][_0x3dff('0x37')]({'where':{'id':0x1}});})['then'](function(_0x4680cb){if(!_0x4680cb){throw new db[(_0x3dff('0x1e'))][(_0x3dff('0x28'))](_0x3dff('0x42'));}_0x3db658=_0x4680cb;if(!_0x3db658[_0x3dff('0x5')]||!_0x3db658['transcribeAccountId']||!_0x3db658[_0x3dff('0xf')]||!_0x3db658[_0x3dff('0x23')]||!_0x3db658['bucket']){throw new db[(_0x3dff('0x1e'))][(_0x3dff('0x28'))]('Transcribe\x20not\x20configured');}return db['CloudProvider'][_0x3dff('0x37')]({'where':{'id':_0x3db658[_0x3dff('0x43')]}});})[_0x3dff('0x10')](function(_0x543fd6){if(!_0x543fd6){throw new db[(_0x3dff('0x1e'))][(_0x3dff('0x28'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x543fd6[_0x3dff('0xd')]||!_0x543fd6[_0x3dff('0xe')]){throw new db['Sequelize'][(_0x3dff('0x28'))]('Cloud\x20Provider\x20not\x20configured');}_0x36f6a1=_0x543fd6;var _0x2b3d6c=[];_0x3290f3[_0x3dff('0x44')](function(_0x6660bb){_0x2b3d6c[_0x3dff('0x45')](checkTranscribeJob(_0x6660bb,_0x3db658,_0x36f6a1));});return BPromise[_0x3dff('0x46')](_0x2b3d6c);})[_0x3dff('0x39')](function(_0x4ddbb9){if(_0x4ddbb9){if(!_0x4ddbb9[_0x3dff('0x3a')]||_0x4ddbb9['name']!=='SequelizeValidationError'){logger['error'](util[_0x3dff('0x47')](_0x4ddbb9,{'showHidden':![],'depth':null}));}}});}exports[_0x3dff('0x48')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xbc14=['Positive','Neutral','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','Setting','Settings\x20not\x20available','bucket','Transcribe\x20not\x20configured','transcribeAccountId','forEach','push','start','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','getTranscriptionJob','Comprehend','detectSentiment','substring','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','info','format','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','fileText','length','update','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','data2','Cloud\x20Provider\x20not\x20configured','Sentiment','SentimentScore','Negative','Mixed','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','resolve','sentiment','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available'];(function(_0x5ed54b,_0x3a2827){var _0x4b58c7=function(_0x19d3b6){while(--_0x19d3b6){_0x5ed54b['push'](_0x5ed54b['shift']());}};_0x4b58c7(++_0x3a2827);}(_0xbc14,0xa1));var _0x4bc1=function(_0x46361e,_0x243aaf){_0x46361e=_0x46361e-0x0;var _0x14e302=_0xbc14[_0x46361e];return _0x14e302;};var _=require(_0x4bc1('0x0'));var AWS=require(_0x4bc1('0x1'));var rp=require(_0x4bc1('0x2'));var util=require(_0x4bc1('0x3'));var BPromise=require(_0x4bc1('0x4'));var db=require(_0x4bc1('0x5'))['db'];var logger=require(_0x4bc1('0x6'))(_0x4bc1('0x7'));function getTranscriptionJob(_0x35f9e4,_0x3b1df2,_0x1df87f,_0x5e42a1){return new Promise(function(_0x540e3a,_0x13870c){var _0x101c22=new AWS['TranscribeService']({'accessKeyId':_0x3b1df2,'secretAccessKey':_0x35f9e4,'region':_0x1df87f});_0x101c22[_0x4bc1('0x8')]({'TranscriptionJobName':_0x5e42a1},function(_0x48e717,_0x16d0bb){if(_0x48e717){return _0x13870c(_0x48e717);}else{return _0x540e3a(_0x16d0bb);}});});}function sentiment(_0x43b974,_0x2f2287,_0x56115e,_0x3b7924,_0x61e932){return new Promise(function(_0x422819,_0x1ec38b){var _0x36396e=new AWS[(_0x4bc1('0x9'))]({'accessKeyId':_0x2f2287,'secretAccessKey':_0x43b974,'region':_0x56115e});_0x36396e[_0x4bc1('0xa')]({'Text':_0x3b7924,'LanguageCode':_0x61e932[_0x4bc1('0xb')](0x0,0x2)},function(_0xb48431,_0xef78ca){if(_0xb48431){return _0x1ec38b(_0xb48431);}else{return _0x422819(_0xef78ca);}});});}function checkTranscribeJob(_0x2c37d5,_0x3ea557,_0x2ddd20){var _0x385f25;return new BPromise(function(_0x1d8c5e,_0x1ebc84){logger['info'](util['format'](_0x4bc1('0xc'),_0x2c37d5['id'],_0x2c37d5[_0x4bc1('0xd')]));return getTranscriptionJob(_0x2ddd20[_0x4bc1('0xe')],_0x2ddd20['data2'],_0x3ea557[_0x4bc1('0xf')],_0x2c37d5[_0x4bc1('0xd')])[_0x4bc1('0x10')](function(_0x12fc09){logger['info'](util['format'](_0x4bc1('0x11'),_0x2c37d5['id'],_0x2c37d5[_0x4bc1('0xd')],_0x12fc09[_0x4bc1('0x12')][_0x4bc1('0x13')]));if(!_0x2c37d5['fileText']){switch(_0x12fc09[_0x4bc1('0x12')][_0x4bc1('0x13')]){case _0x4bc1('0x14'):var _0x1a743a={'transcribeStatus':_0x12fc09[_0x4bc1('0x12')]['TranscriptionJobStatus'],'fileUri':_0x12fc09[_0x4bc1('0x12')][_0x4bc1('0x15')][_0x4bc1('0x16')]};logger[_0x4bc1('0x17')](util['format']('[RECORDING:%d]\x20Get\x20transcript',_0x2c37d5['id']));return rp({'uri':_0x12fc09[_0x4bc1('0x12')][_0x4bc1('0x15')][_0x4bc1('0x16')],'json':!![]})['then'](function(_0x58809f){logger['info'](util[_0x4bc1('0x18')](_0x4bc1('0x19'),_0x2c37d5['id']));if(_0x58809f&&_0x58809f['results']&&_0x58809f[_0x4bc1('0x1a')][_0x4bc1('0x1b')]&&_0x58809f[_0x4bc1('0x1a')][_0x4bc1('0x1b')]['length']){_0x1a743a[_0x4bc1('0x1c')]='';for(var _0x448695=0x0;_0x448695<_0x58809f[_0x4bc1('0x1a')][_0x4bc1('0x1b')][_0x4bc1('0x1d')];_0x448695++){_0x1a743a[_0x4bc1('0x1c')]+=_0x58809f[_0x4bc1('0x1a')][_0x4bc1('0x1b')][_0x448695]['transcript']+'';}}return _0x2c37d5[_0x4bc1('0x1e')](_0x1a743a);})['then'](function(){logger[_0x4bc1('0x17')](util[_0x4bc1('0x18')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x2c37d5['id']));if(!_0x2c37d5['tempSentiment']){throw new db[(_0x4bc1('0x1f'))][(_0x4bc1('0x20'))](_0x4bc1('0x21'));}if(!_0x3ea557['sentiment']||!_0x3ea557[_0x4bc1('0x22')]||!_0x3ea557[_0x4bc1('0x23')]||!_0x3ea557[_0x4bc1('0x24')]||!_0x3ea557['bucket']){throw new db[(_0x4bc1('0x1f'))][(_0x4bc1('0x20'))](_0x4bc1('0x25'));}if(!_0x1a743a[_0x4bc1('0x1c')]){throw new Error(_0x4bc1('0x26'));}if(_0x3ea557[_0x4bc1('0x22')]===_0x2ddd20['id']){return _0x2ddd20;}else{return db[_0x4bc1('0x27')][_0x4bc1('0x28')]({'where':{'id':_settings[_0x4bc1('0x22')]}});}})['then'](function(_0x2a56dc){if(!_0x2a56dc){throw new db[(_0x4bc1('0x1f'))][(_0x4bc1('0x20'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x2a56dc[_0x4bc1('0xe')]||!_0x2a56dc[_0x4bc1('0x29')]){throw new db['Sequelize']['ValidationError'](_0x4bc1('0x2a'));}_0x385f25=_0x2a56dc;logger['info'](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x2c37d5['id']));return sentiment(_0x385f25[_0x4bc1('0xe')],_0x385f25['data2'],_0x3ea557[_0x4bc1('0x23')],_0x1a743a[_0x4bc1('0x1c')],_0x3ea557['language']);})[_0x4bc1('0x10')](function(_0x376e49){logger[_0x4bc1('0x17')](util[_0x4bc1('0x18')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x2c37d5['id']));return _0x2c37d5[_0x4bc1('0x1e')]({'sentiment':_0x376e49[_0x4bc1('0x2b')],'sPositive':_0x376e49[_0x4bc1('0x2c')]['Positive'],'sNegative':_0x376e49[_0x4bc1('0x2c')][_0x4bc1('0x2d')],'sMixed':_0x376e49[_0x4bc1('0x2c')][_0x4bc1('0x2e')],'sNeutral':_0x376e49[_0x4bc1('0x2c')]['Neutral']});})[_0x4bc1('0x10')](function(){logger['info'](util[_0x4bc1('0x18')](_0x4bc1('0x2f'),_0x2c37d5['id']));_0x1d8c5e();});case _0x4bc1('0x30'):return _0x2c37d5[_0x4bc1('0x1e')]({'transcribeStatus':_0x4bc1('0x30'),'failureReason':_0x12fc09[_0x4bc1('0x12')][_0x4bc1('0x31')]})[_0x4bc1('0x10')](function(){logger[_0x4bc1('0x17')](util[_0x4bc1('0x18')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x2c37d5['id']));_0x1d8c5e();});default:logger[_0x4bc1('0x17')](util['format']('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x2c37d5['id']));break;}}else{return BPromise[_0x4bc1('0x32')]()[_0x4bc1('0x10')](function(){if(!_0x2c37d5['tempSentiment']){throw new db[(_0x4bc1('0x1f'))][(_0x4bc1('0x20'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x3ea557[_0x4bc1('0x33')]||!_0x3ea557['sentimentAccountId']||!_0x3ea557[_0x4bc1('0x23')]||!_0x3ea557[_0x4bc1('0x24')]||!_0x3ea557['bucket']){throw new db[(_0x4bc1('0x1f'))][(_0x4bc1('0x20'))](_0x4bc1('0x25'));}if(!_0x2c37d5[_0x4bc1('0x1c')]){throw new Error(_0x4bc1('0x26'));}if(_0x3ea557['sentimentAccountId']===_0x2ddd20['id']){return _0x2ddd20;}else{return db[_0x4bc1('0x27')]['findOne']({'where':{'id':_settings[_0x4bc1('0x22')]}});}})[_0x4bc1('0x10')](function(_0x534f62){if(!_0x534f62){throw new db[(_0x4bc1('0x1f'))][(_0x4bc1('0x20'))](_0x4bc1('0x34'));}if(!_0x534f62[_0x4bc1('0xe')]||!_0x534f62[_0x4bc1('0x29')]){throw new db[(_0x4bc1('0x1f'))]['ValidationError'](_0x4bc1('0x2a'));}_0x385f25=_0x534f62;logger[_0x4bc1('0x17')](util[_0x4bc1('0x18')](_0x4bc1('0x35'),_0x2c37d5['id']));return sentiment(_0x385f25['data1'],_0x385f25[_0x4bc1('0x29')],_0x3ea557[_0x4bc1('0x23')],_0x2c37d5['fileText'],_0x3ea557[_0x4bc1('0x24')]);})[_0x4bc1('0x10')](function(_0xc0f66a){logger['info'](util[_0x4bc1('0x18')](_0x4bc1('0x36'),_0x2c37d5['id']));return _0x2c37d5[_0x4bc1('0x1e')]({'sentiment':_0xc0f66a[_0x4bc1('0x2b')],'sPositive':_0xc0f66a[_0x4bc1('0x2c')][_0x4bc1('0x37')],'sNegative':_0xc0f66a['SentimentScore'][_0x4bc1('0x2d')],'sMixed':_0xc0f66a['SentimentScore']['Mixed'],'sNeutral':_0xc0f66a[_0x4bc1('0x2c')][_0x4bc1('0x38')],'transcribeStatus':'COMPLETED'});})['then'](function(){logger[_0x4bc1('0x17')](util[_0x4bc1('0x18')](_0x4bc1('0x2f'),_0x2c37d5['id']));_0x1d8c5e();});}})[_0x4bc1('0x39')](function(_0x1afc09){if(_0x1afc09){if(!_0x1afc09[_0x4bc1('0x3a')]||_0x1afc09['name']!==_0x4bc1('0x3b')){logger[_0x4bc1('0x3c')](util[_0x4bc1('0x18')](_0x4bc1('0x3d'),_0x2c37d5['id']),util[_0x4bc1('0x3e')](_0x1afc09,{'showHidden':![],'depth':null}));}}_0x1d8c5e();});});}function checkTranscribe(){var _0x495879;var _0x20d179;var _0x46c2ba;return db['VoiceRecording'][_0x4bc1('0x3f')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x4bc1('0x10')](function(_0x193f40){if(!_0x193f40||!_0x193f40[_0x4bc1('0x1d')]){throw new db['Sequelize'][(_0x4bc1('0x20'))]('No\x20transcribe\x20job\x20to\x20check');}_0x495879=_0x193f40;return db[_0x4bc1('0x40')]['findOne']({'where':{'id':0x1}});})[_0x4bc1('0x10')](function(_0x27b07d){if(!_0x27b07d){throw new db[(_0x4bc1('0x1f'))][(_0x4bc1('0x20'))](_0x4bc1('0x41'));}_0x20d179=_0x27b07d;if(!_0x20d179[_0x4bc1('0x7')]||!_0x20d179['transcribeAccountId']||!_0x20d179['transcribeRegion']||!_0x20d179['language']||!_0x20d179[_0x4bc1('0x42')]){throw new db['Sequelize']['ValidationError'](_0x4bc1('0x43'));}return db[_0x4bc1('0x27')][_0x4bc1('0x28')]({'where':{'id':_0x20d179[_0x4bc1('0x44')]}});})[_0x4bc1('0x10')](function(_0x204d1e){if(!_0x204d1e){throw new db[(_0x4bc1('0x1f'))][(_0x4bc1('0x20'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x204d1e['data1']||!_0x204d1e['data2']){throw new db[(_0x4bc1('0x1f'))][(_0x4bc1('0x20'))]('Cloud\x20Provider\x20not\x20configured');}_0x46c2ba=_0x204d1e;var _0x5b8d50=[];_0x495879[_0x4bc1('0x45')](function(_0x487670){_0x5b8d50[_0x4bc1('0x46')](checkTranscribeJob(_0x487670,_0x20d179,_0x46c2ba));});return BPromise['all'](_0x5b8d50);})[_0x4bc1('0x39')](function(_0x2ab4a7){if(_0x2ab4a7){if(!_0x2ab4a7['name']||_0x2ab4a7[_0x4bc1('0x3a')]!==_0x4bc1('0x3b')){logger[_0x4bc1('0x3c')](util['inspect'](_0x2ab4a7,{'showHidden':![],'depth':null}));}}});}exports[_0x4bc1('0x47')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index e38e00f..8556295 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x713c=['util','push','Biondo','innocenzo.biondo','now','@xcally.com','CmContact','destroy','then','log','finished\x20populating','contacts1','CmHopper','bulkCreate','contacts2','hopper2','catch'];(function(_0x52bd95,_0xdd96e6){var _0xae0ba=function(_0x56ba08){while(--_0x56ba08){_0x52bd95['push'](_0x52bd95['shift']());}};_0xae0ba(++_0xdd96e6);}(_0x713c,0x121));var _0xc713=function(_0x24dab5,_0x2d0ae0){_0x24dab5=_0x24dab5-0x0;var _0x325fce=_0x713c[_0x24dab5];return _0x325fce;};'use strict';var util=require(_0xc713('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xc713('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xc713('0x2')+i,'phone':0xf879fb460+i,'email':_0xc713('0x3')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xc713('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xc713('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xc713('0x4')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xc713('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xc713('0x2')+i,'phone':0xf879fb460+i,'email':_0xc713('0x3')+i+_0xc713('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xc713('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xc713('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xc713('0x4')](),'updatedAt':Date[_0xc713('0x4')]()});}db[_0xc713('0x6')][_0xc713('0x7')]({'where':{}})[_0xc713('0x8')](function(){return db[_0xc713('0x6')]['bulkCreate'](contacts);})[_0xc713('0x8')](function(){console[_0xc713('0x9')](_0xc713('0xa'),_0xc713('0xb'));return db[_0xc713('0xc')][_0xc713('0x7')]({'where':{}});})[_0xc713('0x8')](function(){return db[_0xc713('0xc')][_0xc713('0xd')](hopper);})['then'](function(){console['log'](_0xc713('0xa'),'hopper1');return db[_0xc713('0x6')][_0xc713('0xd')](contacts2);})[_0xc713('0x8')](function(){console['log']('finished\x20populating',_0xc713('0xe'));return db[_0xc713('0xc')][_0xc713('0xd')](hopper2);})[_0xc713('0x8')](function(){console[_0xc713('0x9')](_0xc713('0xa'),_0xc713('0xf'));})[_0xc713('0x10')](function(_0x13c5cd){console[_0xc713('0x9')](_0x13c5cd);}); \ No newline at end of file +var _0xada7=['../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','bulkCreate','then','log','finished\x20populating','CmHopper','contacts2','hopper2','catch','util'];(function(_0x577762,_0x1b0aeb){var _0x1b279a=function(_0x1a266f){while(--_0x1a266f){_0x577762['push'](_0x577762['shift']());}};_0x1b279a(++_0x1b0aeb);}(_0xada7,0x7d));var _0x7ada=function(_0x12acb8,_0x47eed8){_0x12acb8=_0x12acb8-0x0;var _0x563261=_0xada7[_0x12acb8];return _0x563261;};'use strict';var util=require(_0x7ada('0x0'));var db=require(_0x7ada('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x7ada('0x2')]({'id':i,'firstName':_0x7ada('0x3')+i,'lastName':_0x7ada('0x4')+i,'phone':0xf879fb460+i,'email':_0x7ada('0x5')+i+_0x7ada('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x7ada('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x7ada('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x7ada('0x2')]({'id':i,'firstName':_0x7ada('0x3')+i,'lastName':_0x7ada('0x4')+i,'phone':0xf879fb460+i,'email':_0x7ada('0x5')+i+_0x7ada('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x7ada('0x7')]()});}db[_0x7ada('0x8')][_0x7ada('0x9')]({'where':{}})['then'](function(){return db['CmContact'][_0x7ada('0xa')](contacts);})[_0x7ada('0xb')](function(){console[_0x7ada('0xc')](_0x7ada('0xd'),'contacts1');return db[_0x7ada('0xe')][_0x7ada('0x9')]({'where':{}});})['then'](function(){return db[_0x7ada('0xe')][_0x7ada('0xa')](hopper);})[_0x7ada('0xb')](function(){console[_0x7ada('0xc')](_0x7ada('0xd'),'hopper1');return db[_0x7ada('0x8')][_0x7ada('0xa')](contacts2);})[_0x7ada('0xb')](function(){console['log'](_0x7ada('0xd'),_0x7ada('0xf'));return db['CmHopper']['bulkCreate'](hopper2);})[_0x7ada('0xb')](function(){console[_0x7ada('0xc')](_0x7ada('0xd'),_0x7ada('0x10'));})[_0x7ada('0x11')](function(_0x1ff74d){console['log'](_0x1ff74d);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 1bc52a9..3d87002 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf817=['bulkCreate','log','add\x20user','catch','../mysqldb','push','format','%s%s','agent','password','friend','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','actpass','\x22%s\x22\x20<%s>','User'];(function(_0x1c7137,_0x4c7c26){var _0xeb4432=function(_0x26d850){while(--_0x26d850){_0x1c7137['push'](_0x1c7137['shift']());}};_0xeb4432(++_0x4c7c26);}(_0xf817,0xee));var _0x7f81=function(_0x379fb4,_0x154b16){_0x379fb4=_0x379fb4-0x0;var _0x3442f2=_0xf817[_0x379fb4];return _0x3442f2;};'use strict';var util=require('util');var db=require(_0x7f81('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x7f81('0x1')]({'name':util[_0x7f81('0x2')](_0x7f81('0x3'),_0x7f81('0x4'),i),'fullname':util[_0x7f81('0x2')](_0x7f81('0x3'),'agent',i),'email':util['format']('%s%s@xcally.com',_0x7f81('0x4'),i),'role':_0x7f81('0x4'),'password':_0x7f81('0x5'),'internal':0xfa0+i,'type':_0x7f81('0x6'),'transport':['udp','ws','wss'],'disallow':[_0x7f81('0x7')],'allow':[_0x7f81('0x8')],'defaultuser':util[_0x7f81('0x2')](_0x7f81('0x3'),_0x7f81('0x4'),i),'encryption':_0x7f81('0x9'),'avpf':_0x7f81('0x9'),'force_avp':_0x7f81('0x9'),'icesupport':_0x7f81('0x9'),'dtlsenable':_0x7f81('0x9'),'dtlsverify':'no','dtlscertfile':_0x7f81('0xa'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x7f81('0xb'),'callerid':util['format'](_0x7f81('0xc'),util[_0x7f81('0x2')](_0x7f81('0x3'),'agent',i),0xfa0+i)});}db[_0x7f81('0xd')][_0x7f81('0xe')](users)['then'](function(){console[_0x7f81('0xf')](_0x7f81('0x10'));})[_0x7f81('0x11')](function(_0x4bd8d4){console['log'](_0x4bd8d4);}); \ No newline at end of file +var _0x89c6=['%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','ulaw','yes','/etc/pki/tls/certs/motion.crt','actpass','\x22%s\x22\x20<%s>','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','push','format'];(function(_0x572cd7,_0x5bdded){var _0x388f9e=function(_0x52951d){while(--_0x52951d){_0x572cd7['push'](_0x572cd7['shift']());}};_0x388f9e(++_0x5bdded);}(_0x89c6,0x14c));var _0x689c=function(_0x44f601,_0x3a1d45){_0x44f601=_0x44f601-0x0;var _0x5570bd=_0x89c6[_0x44f601];return _0x5570bd;};'use strict';var util=require(_0x689c('0x0'));var db=require(_0x689c('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x689c('0x2')]({'name':util[_0x689c('0x3')](_0x689c('0x4'),_0x689c('0x5'),i),'fullname':util['format'](_0x689c('0x4'),_0x689c('0x5'),i),'email':util[_0x689c('0x3')](_0x689c('0x6'),_0x689c('0x5'),i),'role':_0x689c('0x5'),'password':_0x689c('0x7'),'internal':0xfa0+i,'type':_0x689c('0x8'),'transport':[_0x689c('0x9'),'ws',_0x689c('0xa')],'disallow':['all'],'allow':[_0x689c('0xb')],'defaultuser':util[_0x689c('0x3')](_0x689c('0x4'),_0x689c('0x5'),i),'encryption':'yes','avpf':'yes','force_avp':_0x689c('0xc'),'icesupport':_0x689c('0xc'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x689c('0xd'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x689c('0xe'),'callerid':util[_0x689c('0x3')](_0x689c('0xf'),util['format'](_0x689c('0x4'),_0x689c('0x5'),i),0xfa0+i)});}db['User'][_0x689c('0x10')](users)[_0x689c('0x11')](function(){console[_0x689c('0x12')](_0x689c('0x13'));})[_0x689c('0x14')](function(_0x108799){console[_0x689c('0x12')](_0x108799);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 038353b..bdfd1b9 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7109=['length','handshake','query','find','userProfileId','ChatInteraction','MailInteraction','MailInteractions','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','user:%s','voice:inbound','voice:outbound','include','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','user','VoiceQueue','Campaign','getVoiceQueues','getChatQueues','getOpenchannelQueues','all','chat','fax','sms','mail','openchannel','trunk:%s','campaign:%s:%s','leave','ChatInteractions','removeChatInteractions','user_has_chat_interactions:remove','FaxInteractions','removeFaxInteractions','emit','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','catch','log','default','connection','setMaxListeners','address','request','connectedAt','SocketIO\x20','nsp','CONNECTED','lodash','bluebird','../mysqldb','name','User','role','telephone','agent','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','Telephones','findAll','Trunks','IvrCampaigns','resourceId','map','where','type','format','%s:queue:%s','Agents'];(function(_0x5d6d10,_0x3f3f77){var _0xcf88ce=function(_0x3818e3){while(--_0x3818e3){_0x5d6d10['push'](_0x5d6d10['shift']());}};_0xcf88ce(++_0x3f3f77);}(_0x7109,0x146));var _0x9710=function(_0x2678d6,_0x4e2001){_0x2678d6=_0x2678d6-0x0;var _0x475503=_0x7109[_0x2678d6];return _0x475503;};'use strict';var _=require(_0x9710('0x0'));var util=require('util');var BPromise=require(_0x9710('0x1'));var db=require(_0x9710('0x2'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x9710('0x3')],'include':[{'as':'Agents','model':db[_0x9710('0x4')],'attributes':['id','name',_0x9710('0x5')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x9710('0x3')],'where':{'role':_0x9710('0x6')}};var queryTrunks={'raw':!![],'attributes':['id',_0x9710('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x9710('0x3')],'where':{'role':_0x9710('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x9710('0x3'),'type'],'where':{'type':_0x9710('0x8')}};function getAssociatedResources(_0x3f6114,_0x3d5692,_0x1a04a2){return db[_0x9710('0x9')][_0x9710('0xa')]({'where':{'name':_0x3f6114,'userProfileId':_0x3d5692},'raw':!![]})[_0x9710('0xb')](function(_0x1e9fd9){if(_0x1e9fd9){if(_0x1e9fd9[_0x9710('0xc')]){switch(_0x3f6114){case _0x9710('0xd'):case _0x9710('0xe'):case _0x9710('0xf'):case _0x9710('0x10'):case _0x9710('0x11'):case _0x9710('0x12'):return db[_0x1a04a2]['findAll'](queryQueues);case _0x9710('0x13'):return db[_0x1a04a2][_0x9710('0x14')](queryTelephones);case _0x9710('0x15'):return db[_0x1a04a2][_0x9710('0x14')](queryTrunks);case _0x9710('0x16'):return db[_0x1a04a2][_0x9710('0x14')](queryCampaigns);}}else{return db['UserProfileResource'][_0x9710('0x14')]({'attributes':[_0x9710('0x17')],'where':{'sectionId':_0x1e9fd9['id']},'raw':!![]})[_0x9710('0xb')](function(_0x579633){if(_0x579633){var _0x828949={'where':{'id':_[_0x9710('0x18')](_0x579633,'resourceId')},'raw':!![]};switch(_0x1a04a2){case _0x9710('0x4'):_0x828949['where'][_0x9710('0x5')]=_0x9710('0x6');break;case'Campaign':_0x828949[_0x9710('0x19')][_0x9710('0x1a')]='ivr';break;}return db[_0x1a04a2]['findAll'](_0x828949);}else{return[];}});}}else{return[];}})[_0x9710('0xb')](function(_0x453d73){return _0x453d73;});}function joinOrLeaveQueues(_0x16edf3,_0x1912e4,_0x356a7c,_0x57e7b7){_0x16edf3[_0x1912e4](util[_0x9710('0x1b')](_0x9710('0x1c'),_0x356a7c,_0x57e7b7[_0x9710('0x3')]));if(_0x57e7b7[_0x9710('0x1d')]){for(var _0x1d355c=0x0;_0x1d355c<_0x57e7b7[_0x9710('0x1d')][_0x9710('0x1e')];_0x1d355c+=0x1){_0x16edf3[_0x1912e4](util[_0x9710('0x1b')]('user:%s',_0x57e7b7['Agents'][_0x1d355c][_0x9710('0x3')]));}}}function joinOrLeave(_0x408919,_0x41a23f,_0x1e224e){var _0x229e41;if(_0x408919[_0x9710('0x1f')][_0x9710('0x20')]['id']){db['User'][_0x9710('0x21')]({'attributes':['id',_0x9710('0x3'),_0x9710('0x5'),_0x9710('0x22')],'where':{'id':_0x408919['handshake']['query']['id']},'include':[{'model':db[_0x9710('0x23')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x9710('0x24')],'as':_0x9710('0x25'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x9710('0x26')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x9710('0x27')],'as':_0x9710('0x28'),'attributes':['id'],'raw':!![]}]})[_0x9710('0xb')](function(_0x1291db){if(_0x1291db){_0x229e41=_0x1291db;_0x408919[_0x41a23f](util[_0x9710('0x1b')](_0x9710('0x29'),_0x1291db[_0x9710('0x3')]));var _0x5e47dc=[];switch(_0x1291db[_0x9710('0x5')]){case'admin':_0x408919[_0x41a23f](_0x9710('0x2a'));_0x408919[_0x41a23f](_0x9710('0x2b'));if(queryQueues['hasOwnProperty'](_0x9710('0x2c'))){delete queryQueues[_0x9710('0x2c')];}_0x5e47dc[_0x9710('0x2d')](db['VoiceQueue'][_0x9710('0x14')](queryQueues));_0x5e47dc[_0x9710('0x2d')](db[_0x9710('0x2e')][_0x9710('0x14')](queryQueues));_0x5e47dc['push'](db[_0x9710('0x2f')][_0x9710('0x14')](queryQueues));_0x5e47dc[_0x9710('0x2d')](db[_0x9710('0x30')][_0x9710('0x14')](queryQueues));_0x5e47dc[_0x9710('0x2d')](db[_0x9710('0x31')][_0x9710('0x14')](queryQueues));_0x5e47dc[_0x9710('0x2d')](db[_0x9710('0x32')][_0x9710('0x14')](queryQueues));_0x5e47dc[_0x9710('0x2d')](db[_0x9710('0x4')]['findAll'](queryTelephones));_0x5e47dc['push'](db[_0x9710('0x33')]['findAll'](queryTrunks));_0x5e47dc[_0x9710('0x2d')](db['Campaign'][_0x9710('0x14')](queryCampaigns));_0x5e47dc[_0x9710('0x2d')](db['User'][_0x9710('0x14')](queryAgents));break;case _0x9710('0x34'):_0x408919[_0x41a23f]('voice:inbound');_0x408919[_0x41a23f]('voice:outbound');_0x5e47dc['push'](getAssociatedResources('VoiceQueues',_0x1291db[_0x9710('0x22')],_0x9710('0x35')));_0x5e47dc['push'](getAssociatedResources(_0x9710('0xe'),_0x1291db['userProfileId'],_0x9710('0x2e')));_0x5e47dc[_0x9710('0x2d')](getAssociatedResources(_0x9710('0xf'),_0x1291db['userProfileId'],'FaxQueue'));_0x5e47dc[_0x9710('0x2d')](getAssociatedResources(_0x9710('0x10'),_0x1291db[_0x9710('0x22')],_0x9710('0x30')));_0x5e47dc[_0x9710('0x2d')](getAssociatedResources('MailQueues',_0x1291db[_0x9710('0x22')],_0x9710('0x31')));_0x5e47dc[_0x9710('0x2d')](getAssociatedResources(_0x9710('0x12'),_0x1291db['userProfileId'],_0x9710('0x32')));_0x5e47dc[_0x9710('0x2d')](getAssociatedResources(_0x9710('0x13'),_0x1291db[_0x9710('0x22')],'User'));_0x5e47dc[_0x9710('0x2d')](getAssociatedResources('Trunks',_0x1291db[_0x9710('0x22')],_0x9710('0x33')));_0x5e47dc['push'](getAssociatedResources(_0x9710('0x16'),_0x1291db[_0x9710('0x22')],_0x9710('0x36')));_0x5e47dc[_0x9710('0x2d')](db[_0x9710('0x4')][_0x9710('0x14')](queryAgents));break;case _0x9710('0x7'):_0x408919[_0x41a23f](_0x9710('0x2a'));_0x408919[_0x41a23f]('voice:outbound');_0x5e47dc[_0x9710('0x2d')](_0x1291db[_0x9710('0x37')]({'attributes':['id',_0x9710('0x3')]}));_0x5e47dc['push'](_0x1291db[_0x9710('0x38')]({'attributes':['id',_0x9710('0x3')]}));_0x5e47dc[_0x9710('0x2d')](_0x1291db['getFaxQueues']({'attributes':['id',_0x9710('0x3')]}));_0x5e47dc[_0x9710('0x2d')](_0x1291db['getSmsQueues']({'attributes':['id',_0x9710('0x3')]}));_0x5e47dc[_0x9710('0x2d')](_0x1291db['getMailQueues']({'attributes':['id',_0x9710('0x3')]}));_0x5e47dc[_0x9710('0x2d')](_0x1291db[_0x9710('0x39')]({'attributes':['id',_0x9710('0x3')]}));break;}return BPromise[_0x9710('0x3a')](_0x5e47dc);}})[_0x9710('0xb')](function(_0x4885f8){if(_0x4885f8&&_0x4885f8[_0x9710('0x1e')]){for(var _0x365e67=0x0;_0x365e67<_0x4885f8[_0x9710('0x1e')];_0x365e67+=0x1){for(var _0x18e800=0x0;_0x18e800<_0x4885f8[_0x365e67][_0x9710('0x1e')];_0x18e800+=0x1){switch(_0x365e67){case 0x0:joinOrLeaveQueues(_0x408919,_0x41a23f,'voice',_0x4885f8[_0x365e67][_0x18e800]);break;case 0x1:joinOrLeaveQueues(_0x408919,_0x41a23f,_0x9710('0x3b'),_0x4885f8[_0x365e67][_0x18e800]);break;case 0x2:joinOrLeaveQueues(_0x408919,_0x41a23f,_0x9710('0x3c'),_0x4885f8[_0x365e67][_0x18e800]);break;case 0x3:joinOrLeaveQueues(_0x408919,_0x41a23f,_0x9710('0x3d'),_0x4885f8[_0x365e67][_0x18e800]);break;case 0x4:joinOrLeaveQueues(_0x408919,_0x41a23f,_0x9710('0x3e'),_0x4885f8[_0x365e67][_0x18e800]);break;case 0x5:joinOrLeaveQueues(_0x408919,_0x41a23f,_0x9710('0x3f'),_0x4885f8[_0x365e67][_0x18e800]);break;case 0x6:_0x408919[_0x41a23f](util['format']('telephone:%s',_0x4885f8[_0x365e67][_0x18e800][_0x9710('0x3')]));break;case 0x7:_0x408919[_0x41a23f](util[_0x9710('0x1b')](_0x9710('0x40'),_0x4885f8[_0x365e67][_0x18e800]['name']));break;case 0x8:_0x408919[_0x41a23f](util[_0x9710('0x1b')](_0x9710('0x41'),_0x4885f8[_0x365e67][_0x18e800][_0x9710('0x1a')],_0x4885f8[_0x365e67][_0x18e800][_0x9710('0x3')]));break;case 0x9:_0x408919[_0x41a23f](util[_0x9710('0x1b')]('user:%s',_0x4885f8[_0x365e67][_0x18e800][_0x9710('0x3')]));break;}}}}})['then'](function(){if(_0x41a23f===_0x9710('0x42')){var _0x568d1b=_[_0x9710('0x18')](_0x229e41[_0x9710('0x43')],'id');return _0x229e41[_0x9710('0x44')](_0x568d1b)[_0x9710('0xb')](function(){for(var _0x362b82=0x0;_0x362b82<_0x568d1b[_0x9710('0x1e')];_0x362b82+=0x1){_0x1e224e['emit'](_0x9710('0x45'),{'ChatInteractionId':Number(_0x568d1b[_0x362b82]),'UserId':Number(_0x229e41['id'])});}});}})[_0x9710('0xb')](function(){if(_0x41a23f===_0x9710('0x42')){var _0x4a34fc=_[_0x9710('0x18')](_0x229e41[_0x9710('0x25')],'id');return _0x229e41['removeMailInteractions'](_0x4a34fc)['then'](function(){for(var _0x86b588=0x0;_0x86b588<_0x4a34fc['length'];_0x86b588+=0x1){_0x1e224e['emit']('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x4a34fc[_0x86b588]),'UserId':Number(_0x229e41['id'])});}});}})['then'](function(){if(_0x41a23f===_0x9710('0x42')){var _0x4a09ae=_[_0x9710('0x18')](_0x229e41[_0x9710('0x46')],'id');return _0x229e41[_0x9710('0x47')](_0x4a09ae)[_0x9710('0xb')](function(){for(var _0x307d52=0x0;_0x307d52<_0x4a09ae[_0x9710('0x1e')];_0x307d52+=0x1){_0x1e224e[_0x9710('0x48')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x4a09ae[_0x307d52]),'UserId':Number(_0x229e41['id'])});}});}})[_0x9710('0xb')](function(){if(_0x41a23f==='leave'){var _0x4b2407=_[_0x9710('0x18')](_0x229e41[_0x9710('0x49')],'id');return _0x229e41[_0x9710('0x4a')](_0x4b2407)[_0x9710('0xb')](function(){for(var _0x3db7d9=0x0;_0x3db7d9<_0x4b2407[_0x9710('0x1e')];_0x3db7d9+=0x1){_0x1e224e['emit'](_0x9710('0x4b'),{'SmsInteractionId':Number(_0x4b2407[_0x3db7d9]),'UserId':Number(_0x229e41['id'])});}});}})[_0x9710('0xb')](function(){if(_0x41a23f===_0x9710('0x42')){var _0x5f4b7c=_[_0x9710('0x18')](_0x229e41['OpenchannelInteractions'],'id');return _0x229e41[_0x9710('0x4c')](_0x5f4b7c)[_0x9710('0xb')](function(){for(var _0x4f7e39=0x0;_0x4f7e39<_0x5f4b7c[_0x9710('0x1e')];_0x4f7e39+=0x1){_0x1e224e[_0x9710('0x48')](_0x9710('0x4d'),{'OpenchannelInteractionId':Number(_0x5f4b7c[_0x4f7e39]),'UserId':Number(_0x229e41['id'])});}});}})[_0x9710('0x4e')](function(_0x2a304d){_0x408919[_0x9710('0x4f')](_0x2a304d);});}}function onDisconnect(_0x474bbf,_0x1d4789){joinOrLeave(_0x474bbf,_0x9710('0x42'),_0x1d4789);}function onConnect(_0x827913){joinOrLeave(_0x827913,'join');}exports[_0x9710('0x50')]=function(_0x4cf8b5){_0x4cf8b5['on'](_0x9710('0x51'),function(_0x3a6ecf){_0x3a6ecf[_0x9710('0x52')](0x0);_0x3a6ecf[_0x9710('0x53')]=_0x3a6ecf[_0x9710('0x54')]['connection']['remoteAddress']+':'+_0x3a6ecf[_0x9710('0x54')][_0x9710('0x51')]['remotePort'];_0x3a6ecf[_0x9710('0x55')]=new Date();_0x3a6ecf[_0x9710('0x4f')]=function(_0x190fd1){console[_0x9710('0x4f')](_0x9710('0x56')+_0x3a6ecf[_0x9710('0x57')][_0x9710('0x3')]+'['+_0x3a6ecf['address']+']',_0x190fd1);};_0x3a6ecf['on']('disconnect',function(){onDisconnect(_0x3a6ecf,_0x4cf8b5);_0x3a6ecf[_0x9710('0x4f')]('DISCONNECTED');});onConnect(_0x3a6ecf);_0x3a6ecf[_0x9710('0x4f')](_0x9710('0x58'));});}; \ No newline at end of file +var _0x4fd7=['Telephones','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','Campaign','type','format','%s:queue:%s','user:%s','handshake','query','ChatInteraction','ChatInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','admin','voice:inbound','voice:outbound','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','user','userProfileId','MailQueues','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','all','length','voice','chat','fax','sms','mail','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','MailInteractions','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','catch','log','join','default','connection','setMaxListeners','request','remoteAddress','nsp','address','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','User','role','agent','telephone','ivr','UserProfileSection','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues'];(function(_0x455589,_0x1cd997){var _0x3d6ebd=function(_0x5d2caf){while(--_0x5d2caf){_0x455589['push'](_0x455589['shift']());}};_0x3d6ebd(++_0x1cd997);}(_0x4fd7,0x170));var _0x74fd=function(_0x5d98f0,_0x2667b2){_0x5d98f0=_0x5d98f0-0x0;var _0x2cfc7c=_0x4fd7[_0x5d98f0];return _0x2cfc7c;};'use strict';var _=require(_0x74fd('0x0'));var util=require(_0x74fd('0x1'));var BPromise=require(_0x74fd('0x2'));var db=require(_0x74fd('0x3'))['db'];var config=require(_0x74fd('0x4'));var queryQueues={'attributes':['id',_0x74fd('0x5')],'include':[{'as':_0x74fd('0x6'),'model':db[_0x74fd('0x7')],'attributes':['id',_0x74fd('0x5'),_0x74fd('0x8')],'raw':!![],'where':{'role':_0x74fd('0x9')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x74fd('0x5')],'where':{'role':_0x74fd('0xa')}};var queryTrunks={'raw':!![],'attributes':['id',_0x74fd('0x5')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x74fd('0x9')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x74fd('0x5'),'type'],'where':{'type':_0x74fd('0xb')}};function getAssociatedResources(_0x164c35,_0x3e7e38,_0x5d3001){return db[_0x74fd('0xc')]['findOne']({'where':{'name':_0x164c35,'userProfileId':_0x3e7e38},'raw':!![]})[_0x74fd('0xd')](function(_0x169df2){if(_0x169df2){if(_0x169df2[_0x74fd('0xe')]){switch(_0x164c35){case _0x74fd('0xf'):case _0x74fd('0x10'):case _0x74fd('0x11'):case _0x74fd('0x12'):case'MailQueues':case _0x74fd('0x13'):return db[_0x5d3001]['findAll'](queryQueues);case _0x74fd('0x14'):return db[_0x5d3001][_0x74fd('0x15')](queryTelephones);case _0x74fd('0x16'):return db[_0x5d3001][_0x74fd('0x15')](queryTrunks);case _0x74fd('0x17'):return db[_0x5d3001][_0x74fd('0x15')](queryCampaigns);}}else{return db[_0x74fd('0x18')][_0x74fd('0x15')]({'attributes':[_0x74fd('0x19')],'where':{'sectionId':_0x169df2['id']},'raw':!![]})['then'](function(_0x51b604){if(_0x51b604){var _0x4be09c={'where':{'id':_[_0x74fd('0x1a')](_0x51b604,'resourceId')},'raw':!![]};switch(_0x5d3001){case'User':_0x4be09c[_0x74fd('0x1b')][_0x74fd('0x8')]=_0x74fd('0xa');break;case _0x74fd('0x1c'):_0x4be09c[_0x74fd('0x1b')][_0x74fd('0x1d')]=_0x74fd('0xb');break;}return db[_0x5d3001][_0x74fd('0x15')](_0x4be09c);}else{return[];}});}}else{return[];}})[_0x74fd('0xd')](function(_0x2624aa){return _0x2624aa;});}function joinOrLeaveQueues(_0x185066,_0x290aa1,_0x521a28,_0x1efa36){_0x185066[_0x290aa1](util[_0x74fd('0x1e')](_0x74fd('0x1f'),_0x521a28,_0x1efa36['name']));if(_0x1efa36[_0x74fd('0x6')]){for(var _0x2509ad=0x0;_0x2509ad<_0x1efa36[_0x74fd('0x6')]['length'];_0x2509ad+=0x1){_0x185066[_0x290aa1](util['format'](_0x74fd('0x20'),_0x1efa36[_0x74fd('0x6')][_0x2509ad][_0x74fd('0x5')]));}}}function joinOrLeave(_0x4272d1,_0x1106aa,_0x14a73d){var _0x329bd1;if(_0x4272d1[_0x74fd('0x21')][_0x74fd('0x22')]['id']){db[_0x74fd('0x7')]['find']({'attributes':['id','name',_0x74fd('0x8'),'userProfileId'],'where':{'id':_0x4272d1['handshake'][_0x74fd('0x22')]['id']},'include':[{'model':db[_0x74fd('0x23')],'as':_0x74fd('0x24'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x74fd('0x25')],'as':_0x74fd('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x74fd('0x27')],'as':_0x74fd('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x74fd('0x29')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]}]})[_0x74fd('0xd')](function(_0x10e7a4){if(_0x10e7a4){_0x329bd1=_0x10e7a4;_0x4272d1[_0x1106aa](util[_0x74fd('0x1e')](_0x74fd('0x20'),_0x10e7a4[_0x74fd('0x5')]));var _0x426b77=[];switch(_0x10e7a4['role']){case _0x74fd('0x2a'):_0x4272d1[_0x1106aa](_0x74fd('0x2b'));_0x4272d1[_0x1106aa](_0x74fd('0x2c'));if(queryQueues['hasOwnProperty']('include')){delete queryQueues['include'];}_0x426b77[_0x74fd('0x2d')](db[_0x74fd('0x2e')]['findAll'](queryQueues));_0x426b77[_0x74fd('0x2d')](db[_0x74fd('0x2f')]['findAll'](queryQueues));_0x426b77['push'](db[_0x74fd('0x30')][_0x74fd('0x15')](queryQueues));_0x426b77[_0x74fd('0x2d')](db[_0x74fd('0x31')]['findAll'](queryQueues));_0x426b77['push'](db[_0x74fd('0x32')][_0x74fd('0x15')](queryQueues));_0x426b77[_0x74fd('0x2d')](db[_0x74fd('0x33')]['findAll'](queryQueues));_0x426b77[_0x74fd('0x2d')](db[_0x74fd('0x7')]['findAll'](queryTelephones));_0x426b77[_0x74fd('0x2d')](db[_0x74fd('0x34')][_0x74fd('0x15')](queryTrunks));_0x426b77['push'](db['Campaign']['findAll'](queryCampaigns));_0x426b77[_0x74fd('0x2d')](db[_0x74fd('0x7')][_0x74fd('0x15')](queryAgents));break;case _0x74fd('0x35'):_0x4272d1[_0x1106aa](_0x74fd('0x2b'));_0x4272d1[_0x1106aa](_0x74fd('0x2c'));_0x426b77[_0x74fd('0x2d')](getAssociatedResources(_0x74fd('0xf'),_0x10e7a4[_0x74fd('0x36')],'VoiceQueue'));_0x426b77[_0x74fd('0x2d')](getAssociatedResources(_0x74fd('0x10'),_0x10e7a4[_0x74fd('0x36')],_0x74fd('0x2f')));_0x426b77[_0x74fd('0x2d')](getAssociatedResources(_0x74fd('0x11'),_0x10e7a4['userProfileId'],'FaxQueue'));_0x426b77[_0x74fd('0x2d')](getAssociatedResources(_0x74fd('0x12'),_0x10e7a4[_0x74fd('0x36')],'SmsQueue'));_0x426b77[_0x74fd('0x2d')](getAssociatedResources(_0x74fd('0x37'),_0x10e7a4[_0x74fd('0x36')],'MailQueue'));_0x426b77[_0x74fd('0x2d')](getAssociatedResources('OpenchannelQueues',_0x10e7a4[_0x74fd('0x36')],_0x74fd('0x33')));_0x426b77[_0x74fd('0x2d')](getAssociatedResources('Telephones',_0x10e7a4[_0x74fd('0x36')],_0x74fd('0x7')));_0x426b77[_0x74fd('0x2d')](getAssociatedResources('Trunks',_0x10e7a4[_0x74fd('0x36')],_0x74fd('0x34')));_0x426b77[_0x74fd('0x2d')](getAssociatedResources(_0x74fd('0x17'),_0x10e7a4['userProfileId'],_0x74fd('0x1c')));_0x426b77[_0x74fd('0x2d')](db[_0x74fd('0x7')][_0x74fd('0x15')](queryAgents));break;case _0x74fd('0x9'):_0x4272d1[_0x1106aa](_0x74fd('0x2b'));_0x4272d1[_0x1106aa](_0x74fd('0x2c'));_0x426b77[_0x74fd('0x2d')](_0x10e7a4[_0x74fd('0x38')]({'attributes':['id',_0x74fd('0x5')]}));_0x426b77['push'](_0x10e7a4[_0x74fd('0x39')]({'attributes':['id',_0x74fd('0x5')]}));_0x426b77['push'](_0x10e7a4[_0x74fd('0x3a')]({'attributes':['id',_0x74fd('0x5')]}));_0x426b77['push'](_0x10e7a4[_0x74fd('0x3b')]({'attributes':['id',_0x74fd('0x5')]}));_0x426b77[_0x74fd('0x2d')](_0x10e7a4['getMailQueues']({'attributes':['id','name']}));_0x426b77['push'](_0x10e7a4[_0x74fd('0x3c')]({'attributes':['id','name']}));break;}return BPromise[_0x74fd('0x3d')](_0x426b77);}})[_0x74fd('0xd')](function(_0x3955a3){if(_0x3955a3&&_0x3955a3[_0x74fd('0x3e')]){for(var _0x330a9d=0x0;_0x330a9d<_0x3955a3['length'];_0x330a9d+=0x1){for(var _0x17b17b=0x0;_0x17b17b<_0x3955a3[_0x330a9d][_0x74fd('0x3e')];_0x17b17b+=0x1){switch(_0x330a9d){case 0x0:joinOrLeaveQueues(_0x4272d1,_0x1106aa,_0x74fd('0x3f'),_0x3955a3[_0x330a9d][_0x17b17b]);break;case 0x1:joinOrLeaveQueues(_0x4272d1,_0x1106aa,_0x74fd('0x40'),_0x3955a3[_0x330a9d][_0x17b17b]);break;case 0x2:joinOrLeaveQueues(_0x4272d1,_0x1106aa,_0x74fd('0x41'),_0x3955a3[_0x330a9d][_0x17b17b]);break;case 0x3:joinOrLeaveQueues(_0x4272d1,_0x1106aa,_0x74fd('0x42'),_0x3955a3[_0x330a9d][_0x17b17b]);break;case 0x4:joinOrLeaveQueues(_0x4272d1,_0x1106aa,_0x74fd('0x43'),_0x3955a3[_0x330a9d][_0x17b17b]);break;case 0x5:joinOrLeaveQueues(_0x4272d1,_0x1106aa,'openchannel',_0x3955a3[_0x330a9d][_0x17b17b]);break;case 0x6:_0x4272d1[_0x1106aa](util[_0x74fd('0x1e')](_0x74fd('0x44'),_0x3955a3[_0x330a9d][_0x17b17b][_0x74fd('0x5')]));break;case 0x7:_0x4272d1[_0x1106aa](util['format'](_0x74fd('0x45'),_0x3955a3[_0x330a9d][_0x17b17b][_0x74fd('0x5')]));break;case 0x8:_0x4272d1[_0x1106aa](util['format'](_0x74fd('0x46'),_0x3955a3[_0x330a9d][_0x17b17b][_0x74fd('0x1d')],_0x3955a3[_0x330a9d][_0x17b17b][_0x74fd('0x5')]));break;case 0x9:_0x4272d1[_0x1106aa](util['format']('user:%s',_0x3955a3[_0x330a9d][_0x17b17b][_0x74fd('0x5')]));break;}}}}})[_0x74fd('0xd')](function(){if(_0x1106aa===_0x74fd('0x47')){var _0x6cb346=_['map'](_0x329bd1[_0x74fd('0x24')],'id');return _0x329bd1[_0x74fd('0x48')](_0x6cb346)['then'](function(){for(var _0x119893=0x0;_0x119893<_0x6cb346[_0x74fd('0x3e')];_0x119893+=0x1){_0x14a73d[_0x74fd('0x49')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x6cb346[_0x119893]),'UserId':Number(_0x329bd1['id'])});}});}})[_0x74fd('0xd')](function(){if(_0x1106aa===_0x74fd('0x47')){var _0x123e90=_['map'](_0x329bd1[_0x74fd('0x4a')],'id');return _0x329bd1[_0x74fd('0x4b')](_0x123e90)['then'](function(){for(var _0x387d82=0x0;_0x387d82<_0x123e90[_0x74fd('0x3e')];_0x387d82+=0x1){_0x14a73d[_0x74fd('0x49')](_0x74fd('0x4c'),{'MailInteractionId':Number(_0x123e90[_0x387d82]),'UserId':Number(_0x329bd1['id'])});}});}})[_0x74fd('0xd')](function(){if(_0x1106aa===_0x74fd('0x47')){var _0xafa13f=_[_0x74fd('0x1a')](_0x329bd1[_0x74fd('0x26')],'id');return _0x329bd1[_0x74fd('0x4d')](_0xafa13f)[_0x74fd('0xd')](function(){for(var _0x183135=0x0;_0x183135<_0xafa13f[_0x74fd('0x3e')];_0x183135+=0x1){_0x14a73d[_0x74fd('0x49')](_0x74fd('0x4e'),{'FaxInteractionId':Number(_0xafa13f[_0x183135]),'UserId':Number(_0x329bd1['id'])});}});}})[_0x74fd('0xd')](function(){if(_0x1106aa===_0x74fd('0x47')){var _0x32c889=_['map'](_0x329bd1[_0x74fd('0x28')],'id');return _0x329bd1[_0x74fd('0x4f')](_0x32c889)[_0x74fd('0xd')](function(){for(var _0x2d63f3=0x0;_0x2d63f3<_0x32c889[_0x74fd('0x3e')];_0x2d63f3+=0x1){_0x14a73d[_0x74fd('0x49')](_0x74fd('0x50'),{'SmsInteractionId':Number(_0x32c889[_0x2d63f3]),'UserId':Number(_0x329bd1['id'])});}});}})['then'](function(){if(_0x1106aa==='leave'){var _0x13da9e=_['map'](_0x329bd1[_0x74fd('0x51')],'id');return _0x329bd1[_0x74fd('0x52')](_0x13da9e)[_0x74fd('0xd')](function(){for(var _0x379a5b=0x0;_0x379a5b<_0x13da9e['length'];_0x379a5b+=0x1){_0x14a73d[_0x74fd('0x49')](_0x74fd('0x53'),{'OpenchannelInteractionId':Number(_0x13da9e[_0x379a5b]),'UserId':Number(_0x329bd1['id'])});}});}})[_0x74fd('0x54')](function(_0xc3592d){_0x4272d1[_0x74fd('0x55')](_0xc3592d);});}}function onDisconnect(_0x39f0d5,_0x4ef72c){joinOrLeave(_0x39f0d5,'leave',_0x4ef72c);}function onConnect(_0x10534f){joinOrLeave(_0x10534f,_0x74fd('0x56'));}exports[_0x74fd('0x57')]=function(_0x307d93){_0x307d93['on'](_0x74fd('0x58'),function(_0x4f2f3f){_0x4f2f3f[_0x74fd('0x59')](0x0);_0x4f2f3f['address']=_0x4f2f3f[_0x74fd('0x5a')][_0x74fd('0x58')][_0x74fd('0x5b')]+':'+_0x4f2f3f[_0x74fd('0x5a')][_0x74fd('0x58')]['remotePort'];_0x4f2f3f['connectedAt']=new Date();_0x4f2f3f[_0x74fd('0x55')]=function(_0x54c3f5){console[_0x74fd('0x55')]('SocketIO\x20'+_0x4f2f3f[_0x74fd('0x5c')][_0x74fd('0x5')]+'['+_0x4f2f3f[_0x74fd('0x5d')]+']',_0x54c3f5);};_0x4f2f3f['on'](_0x74fd('0x5e'),function(){onDisconnect(_0x4f2f3f,_0x307d93);_0x4f2f3f[_0x74fd('0x55')](_0x74fd('0x5f'));});onConnect(_0x4f2f3f);_0x4f2f3f[_0x74fd('0x55')](_0x74fd('0x60'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index f0381ce..6aaa58f 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 _0x8d3e=['Fax','FaxInteraction','FaxMessage','Mail','MailMessage','newmessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','EventManager','then','error','code','Trigger,\x20%s','catch','get','event','direction','UserId','User','name','interface','format','channel','incomingmessage','outgoingmessage','changed','closed','find','SIP/%s','length','hasOwnProperty','model','hook','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','triggers','Chat','ChatInteraction','newinteraction','afterUpdate','ChatMessage','Sms','SmsInteraction','closedinteraction','SmsMessage','afterCreate'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x8d3e,0x1bc));var _0xe8d3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8d3e[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xe8d3('0x0'));var db=require(_0xe8d3('0x1'))['db'];var jayson=require(_0xe8d3('0x2'));var logger=require(_0xe8d3('0x3'))(_0xe8d3('0x4'));var client=jayson['client']['http']({'port':0x232a});var triggers=[{'channel':_0xe8d3('0x5'),'model':_0xe8d3('0x6'),'event':'afterCreate','condition':_0xe8d3('0x7'),'callback':afterCreate},{'channel':_0xe8d3('0x5'),'model':'ChatInteraction','event':_0xe8d3('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xe8d3('0x5'),'model':_0xe8d3('0x9'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0xe8d3('0xa'),'model':'SmsInteraction','event':'afterCreate','condition':_0xe8d3('0x7'),'callback':afterCreate},{'channel':_0xe8d3('0xa'),'model':_0xe8d3('0xb'),'event':_0xe8d3('0x8'),'condition':_0xe8d3('0xc'),'callback':afterUpdate},{'channel':_0xe8d3('0xa'),'model':_0xe8d3('0xd'),'event':_0xe8d3('0xe'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xe8d3('0xf'),'model':_0xe8d3('0x10'),'event':_0xe8d3('0xe'),'condition':_0xe8d3('0x7'),'callback':afterCreate},{'channel':_0xe8d3('0xf'),'model':'FaxInteraction','event':'afterUpdate','condition':_0xe8d3('0xc'),'callback':afterUpdate},{'channel':_0xe8d3('0xf'),'model':_0xe8d3('0x11'),'event':_0xe8d3('0xe'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xe8d3('0x12'),'model':'MailInteraction','event':_0xe8d3('0xe'),'condition':'newinteraction','callback':afterCreate},{'channel':'Mail','model':'MailInteraction','event':_0xe8d3('0x8'),'condition':_0xe8d3('0xc'),'callback':afterUpdate},{'channel':_0xe8d3('0x12'),'model':_0xe8d3('0x13'),'event':_0xe8d3('0xe'),'condition':_0xe8d3('0x14'),'callback':afterCreateMessage},{'channel':_0xe8d3('0x15'),'model':_0xe8d3('0x16'),'event':'afterCreate','condition':_0xe8d3('0x7'),'callback':afterCreate},{'channel':_0xe8d3('0x15'),'model':_0xe8d3('0x16'),'event':_0xe8d3('0x8'),'condition':_0xe8d3('0xc'),'callback':afterUpdate},{'channel':'Openchannel','model':_0xe8d3('0x17'),'event':_0xe8d3('0xe'),'condition':'newmessage','callback':afterCreateMessage}];function request(_0x74d584){return client['request'](_0xe8d3('0x18'),_0x74d584)[_0xe8d3('0x19')](function(_0x1e74c8){logger['info']('Trigger,\x20%s',_0xe8d3('0x18'),_0x1e74c8);if(_0x1e74c8['error']){if(_0x1e74c8[_0xe8d3('0x1a')][_0xe8d3('0x1b')]===0x1f4){logger[_0xe8d3('0x1a')](_0xe8d3('0x1c'),_0xe8d3('0x18'),_0x1e74c8[_0xe8d3('0x1a')]);}}})[_0xe8d3('0x1d')](function(_0x4dbdf6){logger[_0xe8d3('0x1a')]('Trigger,\x20%s',_0xe8d3('0x18'),_0x4dbdf6);});}function afterCreateMessage(_0x2fbd67,_0x334f34){return function(_0x51e8eb,_0x9cfa48){_0x51e8eb=_0x51e8eb[_0xe8d3('0x1e')]({'plain':!![]});_0x51e8eb['channel']=_0x2fbd67;_0x51e8eb[_0xe8d3('0x1f')]=_0x51e8eb[_0xe8d3('0x20')];if(_0x51e8eb[_0xe8d3('0x21')]){return db[_0xe8d3('0x22')]['find']({'where':{'id':_0x51e8eb[_0xe8d3('0x21')]},'attributes':['id',_0xe8d3('0x23')],'raw':!![]})[_0xe8d3('0x19')](function(_0xa8f253){_0x51e8eb[_0xe8d3('0x24')]=util[_0xe8d3('0x25')]('SIP/%s',_0xa8f253['name']);_0x51e8eb[_0xe8d3('0x26')]=_0x2fbd67;return request({'event':_0xe8d3('0x27'),'message':_0x51e8eb});})['catch'](function(_0x379073){console[_0xe8d3('0x1a')](_0x379073);});}else{return request({'event':_0xe8d3('0x28'),'message':_0x51e8eb});}};}function afterCreate(_0x29d799,_0x4faa87){return function(_0x2e9a22,_0x4a34e9){_0x2e9a22=_0x2e9a22[_0xe8d3('0x1e')]({'plain':!![]});_0x2e9a22['channel']=_0x29d799;_0x2e9a22[_0xe8d3('0x1f')]='opened';return request({'event':_0x4faa87,'message':_0x2e9a22});};}function afterUpdate(_0x51ee15,_0x528459){return function(_0x15750a,_0x33b79e){if(_0x15750a[_0xe8d3('0x29')](_0xe8d3('0x2a'))&&_0x15750a[_0xe8d3('0x2a')]){_0x15750a=_0x15750a[_0xe8d3('0x1e')]({'plain':!![]});_0x15750a[_0xe8d3('0x26')]=_0x51ee15;_0x15750a[_0xe8d3('0x1f')]=_0xe8d3('0x2a');if(_0x15750a[_0xe8d3('0x21')]){return db['User'][_0xe8d3('0x2b')]({'where':{'id':_0x15750a[_0xe8d3('0x21')]},'attributes':['id',_0xe8d3('0x23')],'raw':!![]})[_0xe8d3('0x19')](function(_0x5e93d8){_0x15750a[_0xe8d3('0x24')]=util[_0xe8d3('0x25')](_0xe8d3('0x2c'),_0x5e93d8[_0xe8d3('0x23')]);return request({'event':_0x528459,'message':_0x15750a});})[_0xe8d3('0x1d')](function(_0x1c2992){console[_0xe8d3('0x1a')](_0x1c2992);});}else{return request({'event':_0x528459,'message':_0x15750a});}}};}exports['default']=function(){for(var _0x1f6e26=0x0;_0x1f6e26=_0x1fa208[_0x55cd('0x14')]){throw Error(_0x55cd('0x15'));}_0x54aaca(_0x5ddc3c);})['catch'](function(_0x33724d){_0x42fd80(_0x33724d);});});}; \ No newline at end of file +var _0x1c92=['isValidChannel','toLowerCase','includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','role','agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','bluebird','../mysqldb','voice','chat','fax','getChannels'];(function(_0x51b236,_0x31044f){var _0x1d5261=function(_0x3278d6){while(--_0x3278d6){_0x51b236['push'](_0x51b236['shift']());}};_0x1d5261(++_0x31044f);}(_0x1c92,0xaa));var _0x21c9=function(_0xf458ea,_0x5767e5){_0xf458ea=_0xf458ea-0x0;var _0x20f763=_0x1c92[_0xf458ea];return _0x20f763;};'use strict';var _=require('lodash');var BPromise=require(_0x21c9('0x0'));var db=require(_0x21c9('0x1'))['db'];var util=require('./license/util');var channels=[_0x21c9('0x2'),'mail',_0x21c9('0x3'),_0x21c9('0x4'),'sms','openchannel'];exports[_0x21c9('0x5')]=function(){return channels;};exports[_0x21c9('0x6')]=function(_0x31339b){_0x31339b=_0x31339b[_0x21c9('0x7')]();return _[_0x21c9('0x8')](channels,_0x31339b);};exports[_0x21c9('0x9')]=function(_0x68814a,_0x2adb59,_0x1754f7,_0xa6cbd0){var _0x488a35={'loginAttempts':_0x2adb59,'blocked':_0x1754f7};if(!_[_0x21c9('0xa')](_0xa6cbd0)){_0x488a35[_0x21c9('0xb')]=_0xa6cbd0;}return _0x68814a[_0x21c9('0xc')](_0x488a35);};exports[_0x21c9('0xd')]=function(_0xb5c3dc){return new BPromise(function(_0x5e2c0b,_0x11e89e){var _0x36af65=0x0;if(_0xb5c3dc[_0x21c9('0xe')]!==_0x21c9('0xf')){_0x5e2c0b(_0xb5c3dc);}db[_0x21c9('0x10')][_0x21c9('0x11')]({'where':{'role':_0x21c9('0xf'),'online':!![],'id':{'$ne':_0xb5c3dc['id']}}})[_0x21c9('0x12')](function(_0x102307){_0x36af65=_0x102307;return util[_0x21c9('0xd')]();})[_0x21c9('0x12')](function(_0x1cf1dc){if(_0x1cf1dc&&_0x1cf1dc[_0x21c9('0x13')]&&_0x36af65>=_0x1cf1dc['agents']){throw Error(_0x21c9('0x14'));}_0x5e2c0b(_0xb5c3dc);})[_0x21c9('0x15')](function(_0x1846cd){_0x11e89e(_0x1846cd);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 3657f81..6fb49a0 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6261=['status','render','json','send','exports','404'];(function(_0xc4887a,_0x40c534){var _0x58dd04=function(_0x304942){while(--_0x304942){_0xc4887a['push'](_0xc4887a['shift']());}};_0x58dd04(++_0x40c534);}(_0x6261,0x1c0));var _0x1626=function(_0x5553e3,_0x212b22){_0x5553e3=_0x5553e3-0x0;var _0x1819d6=_0x6261[_0x5553e3];return _0x1819d6;};'use strict';module[_0x1626('0x0')][0x194]=function pageNotFound(_0x2df2eb,_0x3e61d9){var _0x3abdd6=_0x1626('0x1');var _0x25c7e1=0x194;var _0xa8374d={'status':_0x25c7e1};_0x3e61d9[_0x1626('0x2')](_0xa8374d[_0x1626('0x2')]);_0x3e61d9[_0x1626('0x3')](_0x3abdd6,{},function(_0x20d92e,_0x31d5f3){if(_0x20d92e){return _0x3e61d9[_0x1626('0x2')](_0xa8374d[_0x1626('0x2')])[_0x1626('0x4')](_0xa8374d);}_0x3e61d9[_0x1626('0x5')](_0x31d5f3);});}; \ No newline at end of file +var _0x6730=['send','404','status','render'];(function(_0x3ea81c,_0xa2f4ca){var _0x40c111=function(_0x152538){while(--_0x152538){_0x3ea81c['push'](_0x3ea81c['shift']());}};_0x40c111(++_0xa2f4ca);}(_0x6730,0x1d9));var _0x0673=function(_0x1b95a1,_0x529852){_0x1b95a1=_0x1b95a1-0x0;var _0x57aef1=_0x6730[_0x1b95a1];return _0x57aef1;};'use strict';module['exports'][0x194]=function pageNotFound(_0x311620,_0x2e9112){var _0x548314=_0x0673('0x0');var _0x32c6d0=0x194;var _0x19eea7={'status':_0x32c6d0};_0x2e9112[_0x0673('0x1')](_0x19eea7[_0x0673('0x1')]);_0x2e9112[_0x0673('0x2')](_0x548314,{},function(_0x152dda,_0x458ccf){if(_0x152dda){return _0x2e9112[_0x0673('0x1')](_0x19eea7['status'])['json'](_0x19eea7);}_0x2e9112[_0x0673('0x3')](_0x458ccf);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 8348832..4202302 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbe10=['OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/sound/sound.model','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticDefaultReport','AnalyticExtractedReport','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','FreshsalesAccount','FreshsalesConfiguration','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/integration/integration.model','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','../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','License','Campaign','../api/campaign/campaign.model','../api/migration/migration.model','Attachment','Plugin','../api/plugin/plugin.model','MailTransferReport','../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','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','../api/userProfile/userProfile.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','hasOne','cascade','hasMany','Recordings','UserId','VoiceExtension','Extensions','HopperFinals','CmHopperHistory','HopperHistory','ReportAgentPreview','OpenchannelInteractions','SmsInteractions','FaxInteractions','MailInteractions','belongsTo','UserProfile','userProfileId','Groups','chat_group_has_users','belongsToMany','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','MailInteraction','user_has_mail_interactions','user_has_chat_interactions','user_has_openchannel_interactions','UserVoiceQueue','MailQueues','ChatQueues','UserSmsQueue','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','SquareProjects','SpiedAgents','ChanSpyId','Applications','Sound','VoiceQueueId','CmHopper','HopperHistories','HopperBlacks','JscriptySessions','Trunk','TrunkId','TrunkBackup','TrunkBackupId','Interval','IntervalId','Pause','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','team_has_voice_queues','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','VoiceCallReport','uniqueid','AgentReports','Imap','Smtp','Dispositions','MailAccountId','Answers','MailApplication','List','ListId','TemplateId','team_has_mail_queues','Teams','MailMessage','MailInteractionId','Account','Contact','Owner','Tag','mail_interaction_has_tags','Tags','Interaction','restrict','TagId','Items','FaxAccountId','Interactions','FaxApplication','Exntensions','FaxInteractionId','ContactId','ThroughTags','user_has_fax_interactions','AttachmentId','FaxQueueReport','SmsAccountId','SmsApplication','SmsMessage','SmsInteractionId','Users','user_has_sms_interactions','SmsQueueId','OpenchannelAccountId','OpenchannelMessage','OpenchannelInteractionId','openchannel_interaction_has_tags','OpenchannelQueueId','team_has_openchannel_queues','ChatWebsiteId','ChatProactiveAction','ProactiveActions','ChatApplication','Agent','Queue','ChatQueueId','Website','ChatInteractionId','team_has_chat_queues','ChatGroupId','Members','Contacts','CompanyId','JscriptySessionReport','Company','cm_contact_has_tags','CampaignId','OwnerId','All','OneAll','AutomationAllId','OneAny','AutomationId','Intervals','MailApplications','AnalyticCustomReport','CustomReportId','Mohs','moh_has_sounds','sms_interaction_has_tags','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Actions','TriggerId','Fields','DefaultReportId','MetricId','Subjects','SubjectId','DescriptionId','FieldId','AccountId','Subject','Description','Field','VariableId','Configurations','Descriptions','SugarcrmAccount','DeskConfiguration','int_desk_configuration_has_tags','ZohoAccount','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowConfiguration','Dynamics365Account','Dynamics365Configuration','ChatQueueReport','ChatInternalMessage','FromId','ToId','SessionId','ProjectId','user_has_square_projects','VoiceQueues','FaxQueues','team_has_sms_queues','Hoppers','campaigns_has_cm_lists','FromMailAccountId','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromAccount','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CmCustomField','CustomFields','Queues','user_has_voice_prefixes','sectionId','path','lodash','jstz','determine','sequelize','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','username','password','options','database','User','import','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','VoiceMailMessage','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','UserOpenchannelQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','FaxQueue','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsInteraction','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model'];(function(_0x3b0e0c,_0x5e4814){var _0x3efb86=function(_0x82a918){while(--_0x82a918){_0x3b0e0c['push'](_0x3b0e0c['shift']());}};_0x3efb86(++_0x5e4814);}(_0xbe10,0x174));var _0x0be1=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xbe10[_0x57b54c];return _0x59cc19;};'use strict';var path=require(_0x0be1('0x0'));var config=require('../config/environment');var Sequelize=require('sequelize');var _=require(_0x0be1('0x1'));var jstz=require(_0x0be1('0x2'));var timezone=jstz[_0x0be1('0x3')]();config[_0x0be1('0x4')]=_[_0x0be1('0x5')](config['sequelize'],{'database':_0x0be1('0x6'),'username':_0x0be1('0x7'),'password':_0x0be1('0x8'),'options':{'host':_0x0be1('0x9'),'port':0xcea,'dialect':_0x0be1('0xa'),'dialectOptions':{'charset':_0x0be1('0xb')},'logging':![],'timezone':timezone[_0x0be1('0xc')](),'define':{'charset':_0x0be1('0xd'),'collate':_0x0be1('0xe')}}});config['sequelizeHistory']=_[_0x0be1('0x5')](config[_0x0be1('0xf')],{'database':'motion2','username':_0x0be1('0x7'),'password':_0x0be1('0x8'),'options':{'host':_0x0be1('0x9'),'port':0xcea,'dialect':_0x0be1('0xa'),'dialectOptions':{'charset':_0x0be1('0xb')},'logging':![],'timezone':timezone[_0x0be1('0xc')](),'define':{'charset':_0x0be1('0xd'),'collate':_0x0be1('0xe')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0be1('0x4')][_0x0be1('0x10')],config['sequelize'][_0x0be1('0x11')],config['sequelize'][_0x0be1('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x0be1('0xf')][_0x0be1('0x13')],config[_0x0be1('0xf')]['username'],config[_0x0be1('0xf')]['password'],config['sequelizeHistory'][_0x0be1('0x12')])};db[_0x0be1('0x14')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x16'));db['VoiceChanSpy']=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x17'));db[_0x0be1('0x18')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x19'));db['VoiceExtension']=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/voiceExtension/voiceExtension.model');db[_0x0be1('0x1a')]=db['sequelize']['import'](_0x0be1('0x1b'));db[_0x0be1('0x1c')]=db['sequelize'][_0x0be1('0x15')](_0x0be1('0x1d'));db[_0x0be1('0x1e')]=db['sequelize']['import']('../api/voiceRecording/voiceRecording.model');db[_0x0be1('0x1f')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x20'));db[_0x0be1('0x21')]=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/voiceMail/voiceMail.model');db[_0x0be1('0x22')]=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/voiceMailMessage/voiceMailMessage.model');db['VoiceCallReport']=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x23'));db[_0x0be1('0x24')]=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/voiceDialReport/voiceDialReport.model');db[_0x0be1('0x25')]=db[_0x0be1('0x4')]['import'](_0x0be1('0x26'));db[_0x0be1('0x27')]=db[_0x0be1('0x4')]['import'](_0x0be1('0x28'));db[_0x0be1('0x29')]=db[_0x0be1('0x4')]['import']('../api/memberReport/memberReport.model');db['Trunk']=db['sequelize'][_0x0be1('0x15')](_0x0be1('0x2a'));db['VoiceTransferReport']=db['sequelize']['import'](_0x0be1('0x2b'));db[_0x0be1('0x2c')]=db['sequelize'][_0x0be1('0x15')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db['UserVoiceQueue']=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0x0be1('0x2d')]=db['sequelize'][_0x0be1('0x15')](_0x0be1('0x2e'));db[_0x0be1('0x2f')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x30'));db[_0x0be1('0x31')]=db['sequelize'][_0x0be1('0x15')]('../api/userFaxQueue/userFaxQueue.model');db['UserSmsQueue']=db[_0x0be1('0x4')]['import']('../api/userSmsQueue/userSmsQueue.model');db[_0x0be1('0x32')]=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x0be1('0x33')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x34'));db[_0x0be1('0x35')]=db['sequelize'][_0x0be1('0x15')]('../api/mailServerOut/mailServerOut.model');db[_0x0be1('0x36')]=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/mailAccount/mailAccount.model');db[_0x0be1('0x37')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x38'));db[_0x0be1('0x39')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x3a'));db['MailInteraction']=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x3b'));db['MailMessage']=db['sequelize'][_0x0be1('0x15')](_0x0be1('0x3c'));db['MailApplication']=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x3d'));db[_0x0be1('0x3e')]=db['sequelize'][_0x0be1('0x15')]('../api/mailQueueReport/mailQueueReport.model');db[_0x0be1('0x3f')]=db['sequelize']['import'](_0x0be1('0x40'));db[_0x0be1('0x41')]=db['sequelize'][_0x0be1('0x15')](_0x0be1('0x42'));db[_0x0be1('0x43')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x44'));db['FaxApplication']=db['sequelize'][_0x0be1('0x15')](_0x0be1('0x45'));db[_0x0be1('0x46')]=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/faxInteraction/faxInteraction.model');db[_0x0be1('0x47')]=db['sequelize'][_0x0be1('0x15')]('../api/faxMessage/faxMessage.model');db[_0x0be1('0x48')]=db['sequelize'][_0x0be1('0x15')](_0x0be1('0x49'));db['FaxQueueReport']=db['sequelize'][_0x0be1('0x15')](_0x0be1('0x4a'));db[_0x0be1('0x4b')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x4c'));db['SmsApplication']=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/smsApplication/smsApplication.model');db[_0x0be1('0x4d')]=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/smsInteraction/smsInteraction.model');db['SmsMessage']=db[_0x0be1('0x4')]['import'](_0x0be1('0x4e'));db[_0x0be1('0x4f')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x50'));db[_0x0be1('0x51')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x52'));db[_0x0be1('0x53')]=db['sequelize'][_0x0be1('0x15')](_0x0be1('0x54'));db[_0x0be1('0x55')]=db[_0x0be1('0x4')]['import'](_0x0be1('0x56'));db['OpenchannelMessage']=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/openchannelMessage/openchannelMessage.model');db[_0x0be1('0x57')]=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/openchannelQueue/openchannelQueue.model');db[_0x0be1('0x58')]=db['sequelize']['import'](_0x0be1('0x59'));db[_0x0be1('0x5a')]=db[_0x0be1('0x4')]['import'](_0x0be1('0x5b'));db['ChatApplication']=db['sequelize'][_0x0be1('0x15')](_0x0be1('0x5c'));db[_0x0be1('0x5d')]=db['sequelize'][_0x0be1('0x15')](_0x0be1('0x5e'));db[_0x0be1('0x5f')]=db[_0x0be1('0x4')]['import']('../api/chatMessage/chatMessage.model');db[_0x0be1('0x60')]=db['sequelize'][_0x0be1('0x15')](_0x0be1('0x61'));db[_0x0be1('0x62')]=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/chatQueue/chatQueue.model');db[_0x0be1('0x63')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x64'));db['ChatProactiveAction']=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0x0be1('0x65')]=db[_0x0be1('0x4')]['import'](_0x0be1('0x66'));db[_0x0be1('0x67')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x68'));db['CmHopper']=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x69'));db[_0x0be1('0x6a')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x6b'));db[_0x0be1('0x6c')]=db[_0x0be1('0x4')]['import'](_0x0be1('0x6d'));db['CmHopperHistory']=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x6e'));db['ReportAgentPreview']=db['sequelize']['import']('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x6f'));db[_0x0be1('0x70')]=db[_0x0be1('0x4')]['import'](_0x0be1('0x71'));db[_0x0be1('0x72')]=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/automation/automation.model');db[_0x0be1('0x73')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x74'));db[_0x0be1('0x75')]=db['sequelize'][_0x0be1('0x15')](_0x0be1('0x76'));db[_0x0be1('0x77')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x78'));db['Interval']=db[_0x0be1('0x4')]['import'](_0x0be1('0x79'));db['Pause']=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x7a'));db[_0x0be1('0x7b')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x7c'));db[_0x0be1('0x7d')]=db['sequelize']['import'](_0x0be1('0x7e'));db[_0x0be1('0x7f')]=db[_0x0be1('0x4')]['import']('../api/schedule/schedule.model');db['Sound']=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x80'));db['Tag']=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x81'));db[_0x0be1('0x82')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x83'));db[_0x0be1('0x84')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x85'));db[_0x0be1('0x86')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x87'));db[_0x0be1('0x88')]=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/integration/integration.model');db[_0x0be1('0x89')]=db[_0x0be1('0x4')]['import'](_0x0be1('0x8a'));db['AnalyticCustomReport']=db['sequelize'][_0x0be1('0x15')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0x0be1('0x8b')]=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x0be1('0x8c')]=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0x0be1('0x8d')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x8e'));db[_0x0be1('0x8f')]=db['sequelize'][_0x0be1('0x15')](_0x0be1('0x90'));db[_0x0be1('0x91')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x92'));db[_0x0be1('0x93')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x94'));db[_0x0be1('0x95')]=db['sequelize']['import'](_0x0be1('0x96'));db[_0x0be1('0x97')]=db['sequelize']['import'](_0x0be1('0x98'));db['SugarcrmAccount']=db['sequelize'][_0x0be1('0x15')](_0x0be1('0x99'));db[_0x0be1('0x9a')]=db[_0x0be1('0x4')]['import'](_0x0be1('0x9b'));db[_0x0be1('0x9c')]=db['sequelize']['import']('../api/intSugarcrmField/intSugarcrmField.model');db[_0x0be1('0x9d')]=db['sequelize'][_0x0be1('0x15')](_0x0be1('0x9e'));db['DeskConfiguration']=db[_0x0be1('0x4')]['import'](_0x0be1('0x9f'));db[_0x0be1('0xa0')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0xa1'));db['ZohoAccount']=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0xa2'));db[_0x0be1('0xa3')]=db[_0x0be1('0x4')]['import'](_0x0be1('0xa4'));db[_0x0be1('0xa5')]=db['sequelize']['import'](_0x0be1('0xa6'));db[_0x0be1('0xa7')]=db['sequelize'][_0x0be1('0x15')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0x0be1('0xa8')]=db[_0x0be1('0x4')]['import'](_0x0be1('0xa9'));db[_0x0be1('0xaa')]=db['sequelize']['import'](_0x0be1('0xab'));db[_0x0be1('0xac')]=db[_0x0be1('0x4')]['import'](_0x0be1('0xad'));db[_0x0be1('0xae')]=db['sequelize'][_0x0be1('0x15')](_0x0be1('0xaf'));db[_0x0be1('0xb0')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0xb1'));db['VtigerAccount']=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0x0be1('0xb2')]=db[_0x0be1('0x4')]['import'](_0x0be1('0xb3'));db[_0x0be1('0xb4')]=db[_0x0be1('0x4')]['import'](_0x0be1('0xb5'));db[_0x0be1('0xb6')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0xb7'));db['ServicenowConfiguration']=db['sequelize']['import'](_0x0be1('0xb8'));db[_0x0be1('0xb9')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0xba'));db['Dynamics365Account']=db['sequelize'][_0x0be1('0x15')](_0x0be1('0xbb'));db['Dynamics365Configuration']=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0xbc'));db[_0x0be1('0xbd')]=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x0be1('0xbe')]=db['sequelize'][_0x0be1('0x15')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x0be1('0xbf')]=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x0be1('0xc0')]=db['sequelize'][_0x0be1('0x15')](_0x0be1('0xc1'));db[_0x0be1('0x88')]=db[_0x0be1('0x4')]['import'](_0x0be1('0xc2'));db['Network']=db['sequelize'][_0x0be1('0x15')](_0x0be1('0xc3'));db['ChatQueueReport']=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0xc4'));db['ChatInternalMessage']=db['sequelize'][_0x0be1('0x15')](_0x0be1('0xc5'));db[_0x0be1('0xc6')]=db['sequelize']['import'](_0x0be1('0xc7'));db[_0x0be1('0xc8')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0xc9'));db['JscriptySessionReport']=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x0be1('0xca')]=db['sequelize'][_0x0be1('0x15')]('../api/smsQueueReport/smsQueueReport.model');db[_0x0be1('0xcb')]=db['sequelize'][_0x0be1('0x15')](_0x0be1('0xcc'));db['SquareDetailsReport']=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0xcd'));db[_0x0be1('0xce')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0xcf'));db[_0x0be1('0xd0')]=db[_0x0be1('0x4')]['import'](_0x0be1('0xd1'));db[_0x0be1('0xd2')]=db['sequelize']['import'](_0x0be1('0xd3'));db[_0x0be1('0xd4')]=db['sequelize']['import'](_0x0be1('0xd5'));db['SquareRecording']=db[_0x0be1('0x4')]['import'](_0x0be1('0xd6'));db[_0x0be1('0xd7')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0xd8'));db[_0x0be1('0xd9')]=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/team/team.model');db[_0x0be1('0xda')]=db['sequelize']['import']('../api/license/license.model');db[_0x0be1('0xdb')]=db[_0x0be1('0x4')]['import'](_0x0be1('0xdc'));db['Migration']=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0xdd'));db[_0x0be1('0xde')]=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/attachment/attachment.model');db[_0x0be1('0xdf')]=db['sequelize'][_0x0be1('0x15')](_0x0be1('0xe0'));db[_0x0be1('0xe1')]=db[_0x0be1('0x4')]['import'](_0x0be1('0xe2'));db[_0x0be1('0xe3')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0xe4'));db[_0x0be1('0xe5')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0xe6'));db[_0x0be1('0xe7')]=db['sequelize']['import'](_0x0be1('0xe8'));db[_0x0be1('0xe9')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0xea'));db[_0x0be1('0xeb')]=db['sequelize'][_0x0be1('0x15')](_0x0be1('0xec'));db[_0x0be1('0xed')]=db[_0x0be1('0x4')]['import'](_0x0be1('0xee'));db['UserProfile']=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0xef'));db['UserProfileSection']=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/userProfileSection/userProfileSection.model');db[_0x0be1('0xf0')]=db['sequelize'][_0x0be1('0x15')](_0x0be1('0xf1'));db[_0x0be1('0x14')][_0x0be1('0xf2')](db['VoiceMail'],{'as':'VoiceMail','onDelete':_0x0be1('0xf3'),'foreignKey':'UserId'});db[_0x0be1('0x14')][_0x0be1('0xf4')](db['VoiceRecording'],{'as':_0x0be1('0xf5'),'foreignKey':_0x0be1('0xf6')});db[_0x0be1('0x14')][_0x0be1('0xf4')](db[_0x0be1('0x2c')],{'as':'VoiceQueuesRt','foreignKey':'UserId'});db[_0x0be1('0x14')]['hasMany'](db[_0x0be1('0xf7')],{'as':_0x0be1('0xf8'),'onDelete':'cascade','hooks':!![]});db[_0x0be1('0x14')][_0x0be1('0xf4')](db[_0x0be1('0x6c')],{'as':_0x0be1('0xf9'),'foreignKey':_0x0be1('0xf6')});db[_0x0be1('0x14')][_0x0be1('0xf4')](db[_0x0be1('0xfa')],{'as':_0x0be1('0xfb'),'foreignKey':_0x0be1('0xf6')});db[_0x0be1('0x14')][_0x0be1('0xf4')](db[_0x0be1('0xfc')],{'as':_0x0be1('0xfc'),'foreignKey':_0x0be1('0xf6')});db['User'][_0x0be1('0xf4')](db['OpenchannelInteraction'],{'as':_0x0be1('0xfd'),'foreignKey':_0x0be1('0xf6')});db[_0x0be1('0x14')][_0x0be1('0xf4')](db[_0x0be1('0x5d')],{'as':'ChatInteractions','foreignKey':_0x0be1('0xf6')});db[_0x0be1('0x14')][_0x0be1('0xf4')](db[_0x0be1('0x4d')],{'as':_0x0be1('0xfe'),'foreignKey':_0x0be1('0xf6')});db[_0x0be1('0x14')][_0x0be1('0xf4')](db[_0x0be1('0x46')],{'as':_0x0be1('0xff'),'foreignKey':_0x0be1('0xf6')});db[_0x0be1('0x14')][_0x0be1('0xf4')](db['MailInteraction'],{'as':_0x0be1('0x100'),'foreignKey':_0x0be1('0xf6')});db[_0x0be1('0x14')][_0x0be1('0x101')](db[_0x0be1('0x102')],{'as':'UserProfile','foreignKey':_0x0be1('0x103')});db[_0x0be1('0x14')]['belongsToMany'](db[_0x0be1('0x63')],{'as':_0x0be1('0x104'),'through':_0x0be1('0x105')});db[_0x0be1('0x14')][_0x0be1('0x106')](db[_0x0be1('0x67')],{'as':'Contacts','through':_0x0be1('0x107')});db[_0x0be1('0x14')][_0x0be1('0x106')](db[_0x0be1('0xeb')],{'as':_0x0be1('0x108'),'through':_0x0be1('0x109')});db[_0x0be1('0x14')][_0x0be1('0x106')](db[_0x0be1('0xd9')],{'through':_0x0be1('0x10a')});db[_0x0be1('0x14')][_0x0be1('0x106')](db[_0x0be1('0x10b')],{'as':_0x0be1('0x100'),'through':_0x0be1('0x10c')});db[_0x0be1('0x14')][_0x0be1('0x106')](db[_0x0be1('0x5d')],{'as':'ChatInteractions','through':_0x0be1('0x10d')});db[_0x0be1('0x14')][_0x0be1('0x106')](db[_0x0be1('0x46')],{'as':'FaxInteractions','through':'user_has_fax_interactions'});db['User'][_0x0be1('0x106')](db['SmsInteraction'],{'as':_0x0be1('0xfe'),'through':'user_has_sms_interactions'});db[_0x0be1('0x14')]['belongsToMany'](db[_0x0be1('0x55')],{'as':_0x0be1('0xfd'),'through':_0x0be1('0x10e')});db[_0x0be1('0x14')][_0x0be1('0x106')](db['VoiceQueue'],{'as':'VoiceQueues','through':_0x0be1('0x10f'),'required':![]});db[_0x0be1('0x14')][_0x0be1('0x106')](db[_0x0be1('0x37')],{'as':_0x0be1('0x110'),'through':_0x0be1('0x2f'),'required':![]});db[_0x0be1('0x14')][_0x0be1('0x106')](db[_0x0be1('0x62')],{'as':_0x0be1('0x111'),'through':_0x0be1('0x2d'),'required':![],'hooks':!![]});db[_0x0be1('0x14')][_0x0be1('0x106')](db[_0x0be1('0x48')],{'as':'FaxQueues','through':_0x0be1('0x31'),'required':![]});db['User'][_0x0be1('0x106')](db[_0x0be1('0x4f')],{'as':'SmsQueues','through':_0x0be1('0x112'),'required':![]});db[_0x0be1('0x14')][_0x0be1('0x106')](db[_0x0be1('0x57')],{'as':'OpenchannelQueues','through':'UserOpenchannelQueue','required':![]});db[_0x0be1('0x14')][_0x0be1('0x106')](db[_0x0be1('0xeb')],{'through':_0x0be1('0x109')});db[_0x0be1('0x14')][_0x0be1('0x106')](db[_0x0be1('0xed')],{'as':'VoicePrefixes','through':'user_has_voice_prefixes','required':![]});db[_0x0be1('0x14')][_0x0be1('0x106')](db[_0x0be1('0x58')],{'as':'ChatWebsites','through':_0x0be1('0x113')});db['User'][_0x0be1('0x106')](db[_0x0be1('0x43')],{'as':_0x0be1('0x114'),'through':_0x0be1('0x115')});db['User']['belongsToMany'](db['MailAccount'],{'as':_0x0be1('0x116'),'through':_0x0be1('0x117')});db['User']['belongsToMany'](db[_0x0be1('0x51')],{'as':_0x0be1('0x118'),'through':_0x0be1('0x119')});db[_0x0be1('0x14')]['belongsToMany'](db[_0x0be1('0x4b')],{'as':_0x0be1('0x11a'),'through':'user_has_sms_accounts'});db[_0x0be1('0x14')][_0x0be1('0x106')](db['SquareProject'],{'as':_0x0be1('0x11b'),'through':'user_has_square_projects'});db['VoiceChanSpy'][_0x0be1('0xf4')](db['VoiceExtension'],{'as':_0x0be1('0x11c'),'onDelete':_0x0be1('0xf3'),'foreignKey':_0x0be1('0x11d')});db[_0x0be1('0x18')]['hasMany'](db[_0x0be1('0xf7')],{'onDelete':_0x0be1('0xf3')});db['VoiceExtension']['hasMany'](db[_0x0be1('0xf7')],{'as':_0x0be1('0x11e'),'onDelete':_0x0be1('0xf3')});db[_0x0be1('0x1a')]['belongsToMany'](db[_0x0be1('0x11f')],{'as':'Sounds','through':'moh_has_sounds'});db['VoiceQueue']['hasMany'](db[_0x0be1('0x2c')],{'as':'Members','foreignKey':_0x0be1('0x120')});db[_0x0be1('0x1c')]['hasMany'](db[_0x0be1('0x121')],{'as':'Hoppers','foreignKey':_0x0be1('0x120')});db[_0x0be1('0x1c')]['hasMany'](db[_0x0be1('0x6c')],{'as':_0x0be1('0xf9'),'foreignKey':'VoiceQueueId'});db[_0x0be1('0x1c')][_0x0be1('0xf4')](db[_0x0be1('0xfa')],{'as':_0x0be1('0x122'),'foreignKey':_0x0be1('0x120')});db[_0x0be1('0x1c')][_0x0be1('0xf4')](db[_0x0be1('0xfc')],{'as':_0x0be1('0xfc'),'foreignKey':'VoiceQueueId'});db[_0x0be1('0x1c')]['hasMany'](db[_0x0be1('0x6a')],{'as':_0x0be1('0x123'),'foreignKey':_0x0be1('0x120')});db[_0x0be1('0x1c')][_0x0be1('0xf4')](db['JscriptySessionReport'],{'as':_0x0be1('0x124'),'foreignKey':_0x0be1('0x120')});db[_0x0be1('0x1c')]['belongsTo'](db[_0x0be1('0x125')],{'as':_0x0be1('0x125'),'foreignKey':_0x0be1('0x126')});db[_0x0be1('0x1c')][_0x0be1('0x101')](db[_0x0be1('0x125')],{'as':_0x0be1('0x127'),'foreignKey':_0x0be1('0x128')});db[_0x0be1('0x1c')][_0x0be1('0x101')](db[_0x0be1('0x129')],{'as':_0x0be1('0x129'),'foreignKey':_0x0be1('0x12a')});db['VoiceQueue'][_0x0be1('0x101')](db[_0x0be1('0x12b')],{'as':_0x0be1('0x12c'),'foreignKey':_0x0be1('0x12d')});db[_0x0be1('0x1c')][_0x0be1('0x106')](db['CmList'],{'as':_0x0be1('0x108'),'through':_0x0be1('0x12e')});db['VoiceQueue'][_0x0be1('0x106')](db['User'],{'as':_0x0be1('0x12f'),'through':'UserVoiceQueue'});db[_0x0be1('0x1c')][_0x0be1('0x106')](db[_0x0be1('0xd9')],{'as':'Teams','through':_0x0be1('0x130')});db['VoiceQueue'][_0x0be1('0x106')](db['CmList'],{'as':'BlackLists','through':_0x0be1('0x131')});db[_0x0be1('0x1e')][_0x0be1('0x101')](db['User'],{'as':_0x0be1('0x14'),'foreignKey':_0x0be1('0xf6')});db[_0x0be1('0x1f')][_0x0be1('0x101')](db['User'],{'as':_0x0be1('0x14'),'foreignKey':_0x0be1('0xf6')});db[_0x0be1('0x21')][_0x0be1('0xf4')](db['VoiceMailMessage'],{'as':_0x0be1('0x132'),'onDelete':_0x0be1('0xf3'),'foreignKey':_0x0be1('0x133'),'sourceKey':_0x0be1('0x134')});db[_0x0be1('0x22')][_0x0be1('0x101')](db[_0x0be1('0x21')],{'foreignKey':'mailboxuser','targetKey':_0x0be1('0x134')});db[_0x0be1('0x135')][_0x0be1('0xf4')](db[_0x0be1('0x27')],{'as':'QueueCalls','foreignKey':_0x0be1('0x136'),'constraints':![]});db[_0x0be1('0x135')][_0x0be1('0xf4')](db[_0x0be1('0x25')],{'as':_0x0be1('0x137'),'foreignKey':_0x0be1('0x136'),'constraints':![]});db[_0x0be1('0x135')]['belongsTo'](db[_0x0be1('0x14')],{'as':_0x0be1('0x14'),'foreignKey':'UserId'});db[_0x0be1('0x135')][_0x0be1('0x101')](db[_0x0be1('0x67')],{'as':'Contact','foreignKey':'ContactId'});db['MailServerIn'][_0x0be1('0x101')](db[_0x0be1('0x36')],{'as':'MailAccount','foreignKey':'MailAccountId'});db['MailServerOut'][_0x0be1('0x101')](db[_0x0be1('0x36')],{'as':_0x0be1('0x36'),'foreignKey':'MailAccountId'});db[_0x0be1('0x36')][_0x0be1('0xf2')](db['MailServerIn'],{'as':_0x0be1('0x138'),'onDelete':'cascade'});db[_0x0be1('0x36')][_0x0be1('0xf2')](db[_0x0be1('0x35')],{'as':_0x0be1('0x139'),'onDelete':_0x0be1('0xf3')});db['MailAccount'][_0x0be1('0xf4')](db[_0x0be1('0x75')],{'as':_0x0be1('0x13a'),'foreignKey':_0x0be1('0x13b')});db[_0x0be1('0x36')][_0x0be1('0xf4')](db[_0x0be1('0x73')],{'as':_0x0be1('0x13c'),'foreignKey':_0x0be1('0x13b')});db['MailAccount'][_0x0be1('0xf4')](db['MailMessage'],{'as':_0x0be1('0x132'),'foreignKey':_0x0be1('0x13b')});db[_0x0be1('0x36')][_0x0be1('0xf4')](db[_0x0be1('0x10b')],{'as':'Interactions'});db[_0x0be1('0x36')][_0x0be1('0xf4')](db[_0x0be1('0x13d')],{'as':'Applications'});db[_0x0be1('0x36')][_0x0be1('0x101')](db['CmList'],{'as':_0x0be1('0x13e'),'foreignKey':_0x0be1('0x13f')});db[_0x0be1('0x36')][_0x0be1('0x101')](db['Template'],{'as':_0x0be1('0x82'),'foreignKey':_0x0be1('0x140')});db[_0x0be1('0x36')]['belongsTo'](db[_0x0be1('0x12b')],{'as':_0x0be1('0x12c'),'foreignKey':_0x0be1('0x12d')});db['MailAccount'][_0x0be1('0x106')](db[_0x0be1('0x14')],{'as':_0x0be1('0x12f'),'through':_0x0be1('0x117')});db[_0x0be1('0x37')][_0x0be1('0x106')](db[_0x0be1('0x14')],{'as':_0x0be1('0x12f'),'through':'UserMailQueue'});db['MailQueue'][_0x0be1('0x106')](db[_0x0be1('0xd9')],{'through':_0x0be1('0x141'),'as':_0x0be1('0x142')});db['MailInteraction'][_0x0be1('0xf4')](db[_0x0be1('0x143')],{'as':_0x0be1('0x132'),'onDelete':'cascade','foreignKey':_0x0be1('0x144')});db['MailInteraction'][_0x0be1('0x101')](db['MailAccount'],{'as':_0x0be1('0x145'),'foreignKey':_0x0be1('0x13b')});db[_0x0be1('0x10b')]['belongsTo'](db[_0x0be1('0x67')],{'as':_0x0be1('0x146'),'foreignKey':'ContactId'});db[_0x0be1('0x10b')][_0x0be1('0x101')](db['User'],{'as':_0x0be1('0x147'),'foreignKey':_0x0be1('0xf6')});db[_0x0be1('0x10b')][_0x0be1('0x106')](db[_0x0be1('0x148')],{'through':_0x0be1('0x149'),'as':_0x0be1('0x14a')});db[_0x0be1('0x10b')]['belongsToMany'](db[_0x0be1('0x148')],{'through':'mail_interaction_has_tags','as':'ThroughTags'});db[_0x0be1('0x10b')][_0x0be1('0x106')](db[_0x0be1('0x14')],{'as':'Users','through':_0x0be1('0x10c'),'foreignKey':_0x0be1('0x144')});db[_0x0be1('0x143')][_0x0be1('0xf4')](db[_0x0be1('0xde')],{'as':'Attachments','onDelete':_0x0be1('0xf3')});db['MailMessage'][_0x0be1('0x101')](db[_0x0be1('0x14')],{'as':'User'});db[_0x0be1('0x143')][_0x0be1('0x101')](db[_0x0be1('0x67')],{'onDelete':_0x0be1('0xf3'),'as':'Contact'});db[_0x0be1('0x143')][_0x0be1('0x101')](db['MailInteraction'],{'as':_0x0be1('0x14b'),'foreignKey':_0x0be1('0x144')});db[_0x0be1('0x143')][_0x0be1('0x101')](db[_0x0be1('0x36')],{'as':'Account','foreignKey':_0x0be1('0x13b')});db[_0x0be1('0x13d')]['belongsTo'](db[_0x0be1('0x14')],{'onDelete':'restrict'});db[_0x0be1('0x13d')][_0x0be1('0x101')](db[_0x0be1('0x37')],{'onDelete':_0x0be1('0x14c')});db['MailApplication'][_0x0be1('0x101')](db['MailAccount'],{'onDelete':_0x0be1('0x14c')});db[_0x0be1('0x13d')]['belongsTo'](db[_0x0be1('0x129')],{'onDelete':_0x0be1('0x14c'),'foreignKey':_0x0be1('0x12a')});db[_0x0be1('0x13d')]['belongsTo'](db['Tag'],{'onDelete':_0x0be1('0x14c'),'foreignKey':_0x0be1('0x14d')});db['MailQueueReport']['belongsTo'](db[_0x0be1('0x36')],{});db['MailQueueReport'][_0x0be1('0x101')](db[_0x0be1('0xeb')],{'as':_0x0be1('0x13e'),'foreignKey':_0x0be1('0x13f')});db['MailQueueReport']['belongsTo'](db[_0x0be1('0x67')],{'as':_0x0be1('0x146'),'foreignKey':'ContactId'});db[_0x0be1('0x3e')]['belongsTo'](db['MailInteraction'],{});db[_0x0be1('0x3e')][_0x0be1('0x101')](db[_0x0be1('0x143')],{});db['MailQueueReport']['belongsTo'](db[_0x0be1('0x14')],{});db[_0x0be1('0x3e')]['belongsTo'](db['MailQueue'],{});db[_0x0be1('0x3f')][_0x0be1('0xf4')](db['DashboardItem'],{'as':_0x0be1('0x14e'),'onDelete':_0x0be1('0xf3')});db['FaxAccount'][_0x0be1('0xf4')](db[_0x0be1('0x75')],{'as':_0x0be1('0x13a'),'foreignKey':_0x0be1('0x14f')});db['FaxAccount'][_0x0be1('0xf4')](db[_0x0be1('0x73')],{'as':_0x0be1('0x13c'),'foreignKey':'FaxAccountId'});db[_0x0be1('0x43')][_0x0be1('0xf4')](db[_0x0be1('0x46')],{'as':_0x0be1('0x150')});db[_0x0be1('0x43')]['hasMany'](db[_0x0be1('0x151')],{'as':'Applications'});db[_0x0be1('0x43')]['hasMany'](db[_0x0be1('0xf7')],{'as':_0x0be1('0x152'),'onDelete':_0x0be1('0xf3')});db[_0x0be1('0x43')]['hasMany'](db[_0x0be1('0x47')],{'as':_0x0be1('0x132')});db['FaxAccount']['belongsTo'](db[_0x0be1('0x125')],{'as':'Trunk'});db[_0x0be1('0x43')][_0x0be1('0x101')](db[_0x0be1('0xeb')],{'as':_0x0be1('0x13e'),'foreignKey':_0x0be1('0x13f')});db[_0x0be1('0x43')]['belongsTo'](db[_0x0be1('0x12b')],{'as':_0x0be1('0x12c'),'foreignKey':_0x0be1('0x12d')});db[_0x0be1('0x43')][_0x0be1('0x106')](db[_0x0be1('0x14')],{'as':'Agents','through':_0x0be1('0x115')});db[_0x0be1('0x151')][_0x0be1('0x101')](db[_0x0be1('0x14')],{'onDelete':'restrict'});db['FaxApplication'][_0x0be1('0x101')](db['FaxQueue'],{'onDelete':'restrict'});db[_0x0be1('0x151')][_0x0be1('0x101')](db[_0x0be1('0x43')],{'onDelete':'restrict'});db[_0x0be1('0x151')][_0x0be1('0x101')](db[_0x0be1('0x148')],{'onDelete':_0x0be1('0x14c'),'foreignKey':_0x0be1('0x14d')});db[_0x0be1('0x46')][_0x0be1('0xf4')](db[_0x0be1('0x47')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0be1('0x153')});db[_0x0be1('0x46')][_0x0be1('0x101')](db['FaxAccount'],{'as':'Account','foreignKey':'FaxAccountId'});db[_0x0be1('0x46')]['belongsTo'](db[_0x0be1('0x67')],{'as':'Contact','foreignKey':_0x0be1('0x154')});db[_0x0be1('0x46')][_0x0be1('0x101')](db['User'],{'as':_0x0be1('0x147'),'foreignKey':'UserId'});db['FaxInteraction'][_0x0be1('0x106')](db[_0x0be1('0x148')],{'through':'fax_interaction_has_tags','as':_0x0be1('0x14a')});db['FaxInteraction'][_0x0be1('0x106')](db[_0x0be1('0x148')],{'through':'fax_interaction_has_tags','as':_0x0be1('0x155')});db[_0x0be1('0x46')][_0x0be1('0x106')](db['User'],{'as':'Users','through':_0x0be1('0x156'),'foreignKey':_0x0be1('0x153')});db[_0x0be1('0x47')][_0x0be1('0x101')](db['User'],{'onDelete':_0x0be1('0xf3'),'as':_0x0be1('0x14')});db['FaxMessage']['belongsTo'](db[_0x0be1('0x46')],{'as':_0x0be1('0x14b'),'foreignKey':_0x0be1('0x153')});db[_0x0be1('0x47')][_0x0be1('0x101')](db['CmContact'],{'onDelete':_0x0be1('0xf3'),'as':_0x0be1('0x146')});db[_0x0be1('0x47')][_0x0be1('0x101')](db[_0x0be1('0xde')],{'as':'Attachment','foreignKey':_0x0be1('0x157')});db[_0x0be1('0x47')][_0x0be1('0x101')](db['FaxAccount'],{'as':_0x0be1('0x145'),'foreignKey':'FaxAccountId'});db[_0x0be1('0x48')]['belongsToMany'](db['User'],{'as':_0x0be1('0x12f'),'through':_0x0be1('0x31')});db[_0x0be1('0x48')]['belongsToMany'](db['Team'],{'through':'team_has_fax_queues','as':'Teams'});db[_0x0be1('0x158')][_0x0be1('0x101')](db[_0x0be1('0x43')],{});db[_0x0be1('0x158')][_0x0be1('0x101')](db[_0x0be1('0xeb')],{'as':_0x0be1('0x13e'),'foreignKey':_0x0be1('0x13f')});db['FaxQueueReport']['belongsTo'](db[_0x0be1('0x67')],{'as':'Contact','foreignKey':_0x0be1('0x154')});db[_0x0be1('0x158')]['belongsTo'](db[_0x0be1('0x46')],{});db[_0x0be1('0x158')][_0x0be1('0x101')](db['FaxMessage'],{});db[_0x0be1('0x158')]['belongsTo'](db[_0x0be1('0x14')],{});db[_0x0be1('0x158')][_0x0be1('0x101')](db[_0x0be1('0x48')],{});db['SmsAccount'][_0x0be1('0xf4')](db[_0x0be1('0x75')],{'as':_0x0be1('0x13a'),'foreignKey':_0x0be1('0x159')});db[_0x0be1('0x4b')][_0x0be1('0xf4')](db[_0x0be1('0x73')],{'as':_0x0be1('0x13c'),'foreignKey':_0x0be1('0x159')});db['SmsAccount'][_0x0be1('0xf4')](db['SmsMessage'],{'as':_0x0be1('0x132'),'foreignKey':'SmsAccountId'});db[_0x0be1('0x4b')][_0x0be1('0xf4')](db[_0x0be1('0x4d')],{'as':_0x0be1('0x150')});db[_0x0be1('0x4b')][_0x0be1('0xf4')](db[_0x0be1('0x15a')],{'as':'Applications'});db[_0x0be1('0x4b')]['belongsTo'](db[_0x0be1('0xeb')],{'as':_0x0be1('0x13e'),'foreignKey':_0x0be1('0x13f')});db[_0x0be1('0x4b')][_0x0be1('0x101')](db[_0x0be1('0x12b')],{'as':_0x0be1('0x12c'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0be1('0x4b')]['belongsToMany'](db[_0x0be1('0x14')],{'as':_0x0be1('0x12f'),'through':'user_has_sms_accounts'});db[_0x0be1('0x15a')][_0x0be1('0x101')](db[_0x0be1('0x14')],{'onDelete':_0x0be1('0x14c')});db[_0x0be1('0x15a')]['belongsTo'](db['SmsQueue'],{'onDelete':_0x0be1('0x14c')});db[_0x0be1('0x15a')][_0x0be1('0x101')](db[_0x0be1('0x4b')],{'onDelete':_0x0be1('0x14c')});db[_0x0be1('0x15a')][_0x0be1('0x101')](db[_0x0be1('0x129')],{'onDelete':_0x0be1('0x14c'),'foreignKey':_0x0be1('0x12a')});db[_0x0be1('0x15a')][_0x0be1('0x101')](db['Tag'],{'onDelete':_0x0be1('0x14c'),'foreignKey':'TagId'});db[_0x0be1('0x4d')][_0x0be1('0xf4')](db[_0x0be1('0x15b')],{'as':_0x0be1('0x132'),'onDelete':_0x0be1('0xf3'),'foreignKey':_0x0be1('0x15c')});db['SmsInteraction'][_0x0be1('0x101')](db[_0x0be1('0x4b')],{'as':_0x0be1('0x145'),'foreignKey':'SmsAccountId'});db['SmsInteraction'][_0x0be1('0x101')](db[_0x0be1('0x67')],{'as':'Contact','foreignKey':_0x0be1('0x154')});db[_0x0be1('0x4d')][_0x0be1('0x101')](db['User'],{'as':_0x0be1('0x147'),'foreignKey':_0x0be1('0xf6')});db[_0x0be1('0x4d')][_0x0be1('0x106')](db['Tag'],{'through':'sms_interaction_has_tags','as':_0x0be1('0x14a')});db['SmsInteraction']['belongsToMany'](db[_0x0be1('0x148')],{'through':'sms_interaction_has_tags','as':_0x0be1('0x155')});db[_0x0be1('0x4d')][_0x0be1('0x106')](db['User'],{'as':_0x0be1('0x15d'),'through':_0x0be1('0x15e'),'foreignKey':_0x0be1('0x15c')});db[_0x0be1('0x15b')][_0x0be1('0x101')](db[_0x0be1('0x14')],{'as':_0x0be1('0x14')});db[_0x0be1('0x15b')][_0x0be1('0x101')](db['CmContact'],{'onDelete':'cascade','as':_0x0be1('0x146')});db['SmsMessage'][_0x0be1('0x101')](db['SmsInteraction'],{'onDelete':_0x0be1('0xf3'),'as':_0x0be1('0x14b'),'foreignKey':_0x0be1('0x15c')});db[_0x0be1('0x15b')]['belongsTo'](db['SmsAccount'],{'as':'Account','foreignKey':_0x0be1('0x159')});db[_0x0be1('0x4f')]['belongsToMany'](db[_0x0be1('0x14')],{'as':_0x0be1('0x12f'),'through':'UserSmsQueue','foreignKey':_0x0be1('0x15f')});db[_0x0be1('0x4f')]['belongsToMany'](db['Team'],{'through':'team_has_sms_queues','as':_0x0be1('0x142')});db[_0x0be1('0x51')][_0x0be1('0xf4')](db[_0x0be1('0x75')],{'as':_0x0be1('0x13a'),'foreignKey':_0x0be1('0x160')});db[_0x0be1('0x51')][_0x0be1('0xf4')](db[_0x0be1('0x73')],{'as':_0x0be1('0x13c'),'foreignKey':_0x0be1('0x160')});db[_0x0be1('0x51')][_0x0be1('0xf4')](db[_0x0be1('0x55')],{'as':_0x0be1('0x150'),'foreignKey':_0x0be1('0x160')});db[_0x0be1('0x51')][_0x0be1('0xf4')](db[_0x0be1('0x161')],{'as':_0x0be1('0x132'),'foreignKey':'OpenchannelAccountId'});db[_0x0be1('0x51')][_0x0be1('0xf4')](db['OpenchannelApplication'],{'as':_0x0be1('0x11e'),'foreignKey':_0x0be1('0x160')});db[_0x0be1('0x51')]['belongsTo'](db[_0x0be1('0xeb')],{'as':_0x0be1('0x13e'),'foreignKey':_0x0be1('0x13f')});db[_0x0be1('0x51')]['belongsTo'](db[_0x0be1('0x12b')],{'as':_0x0be1('0x12c'),'foreignKey':_0x0be1('0x12d')});db[_0x0be1('0x51')][_0x0be1('0x106')](db[_0x0be1('0x14')],{'as':_0x0be1('0x12f'),'through':'user_has_openchannel_accounts'});db['OpenchannelApplication']['belongsTo'](db[_0x0be1('0x14')],{'onDelete':_0x0be1('0x14c')});db[_0x0be1('0x53')][_0x0be1('0x101')](db['OpenchannelQueue'],{'onDelete':_0x0be1('0x14c'),'foreignKey':'OpenchannelQueueId'});db[_0x0be1('0x53')]['belongsTo'](db[_0x0be1('0x51')],{'onDelete':_0x0be1('0x14c'),'foreignKey':_0x0be1('0x160')});db['OpenchannelApplication'][_0x0be1('0x101')](db[_0x0be1('0x129')],{'onDelete':_0x0be1('0x14c'),'foreignKey':_0x0be1('0x12a')});db['OpenchannelApplication'][_0x0be1('0x101')](db['Tag'],{'onDelete':_0x0be1('0x14c'),'foreignKey':_0x0be1('0x14d')});db['OpenchannelInteraction'][_0x0be1('0xf4')](db[_0x0be1('0x161')],{'as':_0x0be1('0x132'),'onDelete':'cascade','foreignKey':_0x0be1('0x162')});db[_0x0be1('0x55')][_0x0be1('0x101')](db[_0x0be1('0x51')],{'as':_0x0be1('0x145'),'foreignKey':_0x0be1('0x160')});db[_0x0be1('0x55')]['belongsTo'](db[_0x0be1('0x67')],{'as':_0x0be1('0x146'),'foreignKey':'ContactId'});db['OpenchannelInteraction']['belongsTo'](db[_0x0be1('0x14')],{'as':_0x0be1('0x147'),'foreignKey':'UserId'});db[_0x0be1('0x55')]['belongsToMany'](db[_0x0be1('0x148')],{'through':_0x0be1('0x163'),'as':_0x0be1('0x14a')});db['OpenchannelInteraction'][_0x0be1('0x106')](db[_0x0be1('0x148')],{'through':_0x0be1('0x163'),'as':_0x0be1('0x155')});db[_0x0be1('0x55')][_0x0be1('0x106')](db[_0x0be1('0x14')],{'as':_0x0be1('0x15d'),'through':_0x0be1('0x10e'),'foreignKey':_0x0be1('0x162')});db[_0x0be1('0x161')]['belongsTo'](db[_0x0be1('0x14')],{'onDelete':_0x0be1('0xf3'),'as':'User'});db[_0x0be1('0x161')][_0x0be1('0x101')](db['CmContact'],{'onDelete':_0x0be1('0xf3'),'as':_0x0be1('0x146')});db[_0x0be1('0x161')][_0x0be1('0x101')](db['OpenchannelInteraction'],{'onDelete':'cascade','as':_0x0be1('0x14b'),'foreignKey':_0x0be1('0x162')});db[_0x0be1('0x161')][_0x0be1('0x101')](db[_0x0be1('0xde')],{'as':_0x0be1('0xde'),'foreignKey':_0x0be1('0x157')});db[_0x0be1('0x161')][_0x0be1('0x101')](db[_0x0be1('0x51')],{'as':'Account','foreignKey':'OpenchannelAccountId'});db[_0x0be1('0x57')][_0x0be1('0x106')](db[_0x0be1('0x14')],{'as':_0x0be1('0x12f'),'through':_0x0be1('0x32'),'foreignKey':_0x0be1('0x164')});db[_0x0be1('0x57')][_0x0be1('0x106')](db[_0x0be1('0xd9')],{'through':_0x0be1('0x165'),'as':_0x0be1('0x142')});db['ChatWebsite'][_0x0be1('0xf4')](db[_0x0be1('0x75')],{'as':_0x0be1('0x13a'),'foreignKey':_0x0be1('0x166')});db[_0x0be1('0x58')][_0x0be1('0xf4')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x0be1('0x166')});db[_0x0be1('0x58')][_0x0be1('0xf4')](db[_0x0be1('0x167')],{'as':_0x0be1('0x168')});db[_0x0be1('0x58')]['hasMany'](db['ChatInteraction'],{'as':_0x0be1('0x150')});db[_0x0be1('0x58')][_0x0be1('0xf4')](db[_0x0be1('0x169')],{'as':_0x0be1('0x11e')});db[_0x0be1('0x58')][_0x0be1('0xf4')](db['ChatMessage'],{'as':_0x0be1('0x132')});db[_0x0be1('0x58')]['belongsTo'](db[_0x0be1('0xeb')],{'as':_0x0be1('0x13e'),'foreignKey':_0x0be1('0x13f')});db['ChatWebsite'][_0x0be1('0x101')](db[_0x0be1('0x129')],{'as':_0x0be1('0x129'),'foreignKey':'IntervalId'});db[_0x0be1('0x58')][_0x0be1('0x101')](db['Pause'],{'as':_0x0be1('0x12c'),'foreignKey':_0x0be1('0x12d')});db['ChatWebsite']['belongsToMany'](db['User'],{'as':_0x0be1('0x12f'),'through':_0x0be1('0x113')});db[_0x0be1('0x5a')][_0x0be1('0x101')](db[_0x0be1('0x51')],{});db[_0x0be1('0x5a')][_0x0be1('0x101')](db[_0x0be1('0xeb')],{'as':_0x0be1('0x13e'),'foreignKey':'ListId'});db[_0x0be1('0x5a')]['belongsTo'](db[_0x0be1('0x67')],{'as':_0x0be1('0x146'),'foreignKey':_0x0be1('0x154')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0be1('0x5a')][_0x0be1('0x101')](db['OpenchannelMessage'],{});db['OpenchannelQueueReport'][_0x0be1('0x101')](db[_0x0be1('0x14')],{});db[_0x0be1('0x5a')]['belongsTo'](db[_0x0be1('0x57')],{});db[_0x0be1('0x169')][_0x0be1('0x101')](db[_0x0be1('0x14')],{'as':_0x0be1('0x16a'),'foreignKey':_0x0be1('0xf6'),'onDelete':_0x0be1('0x14c')});db['ChatApplication'][_0x0be1('0x101')](db[_0x0be1('0x62')],{'as':_0x0be1('0x16b'),'foreignKey':_0x0be1('0x16c'),'onDelete':_0x0be1('0x14c')});db['ChatApplication'][_0x0be1('0x101')](db['ChatWebsite'],{'as':_0x0be1('0x16d'),'foreignKey':_0x0be1('0x166'),'onDelete':'restrict'});db[_0x0be1('0x169')]['belongsTo'](db[_0x0be1('0x148')],{'onDelete':_0x0be1('0x14c'),'foreignKey':_0x0be1('0x14d')});db[_0x0be1('0x5d')][_0x0be1('0xf4')](db[_0x0be1('0x5f')],{'as':_0x0be1('0x132'),'onDelete':_0x0be1('0xf3'),'foreignKey':_0x0be1('0x16e')});db[_0x0be1('0x5d')][_0x0be1('0x101')](db['ChatWebsite'],{'as':_0x0be1('0x145'),'foreignKey':'ChatWebsiteId'});db[_0x0be1('0x5d')]['belongsTo'](db[_0x0be1('0x67')],{'as':'Contact','foreignKey':_0x0be1('0x154')});db[_0x0be1('0x5d')][_0x0be1('0x101')](db[_0x0be1('0x14')],{'as':_0x0be1('0x147'),'foreignKey':_0x0be1('0xf6')});db[_0x0be1('0x5d')][_0x0be1('0x106')](db[_0x0be1('0x148')],{'through':'chat_interaction_has_tags','as':_0x0be1('0x14a')});db[_0x0be1('0x5d')][_0x0be1('0x106')](db['Tag'],{'through':'chat_interaction_has_tags','as':_0x0be1('0x155')});db[_0x0be1('0x5d')][_0x0be1('0x106')](db[_0x0be1('0x14')],{'as':_0x0be1('0x15d'),'through':'user_has_chat_interactions','foreignKey':_0x0be1('0x16e')});db[_0x0be1('0x5f')]['belongsTo'](db[_0x0be1('0x14')],{'onDelete':_0x0be1('0xf3'),'as':_0x0be1('0x14')});db[_0x0be1('0x5f')][_0x0be1('0x101')](db[_0x0be1('0x67')],{'onDelete':_0x0be1('0xf3'),'as':_0x0be1('0x146'),'foreignKey':_0x0be1('0x154')});db[_0x0be1('0x5f')][_0x0be1('0x101')](db['ChatInteraction'],{'onDelete':_0x0be1('0xf3'),'as':_0x0be1('0x14b'),'foreignKey':'ChatInteractionId'});db['ChatMessage'][_0x0be1('0x101')](db[_0x0be1('0xde')],{'as':'Attachment','foreignKey':_0x0be1('0x157')});db[_0x0be1('0x5f')][_0x0be1('0x101')](db['ChatWebsite'],{'as':'Account','foreignKey':_0x0be1('0x166')});db[_0x0be1('0x60')][_0x0be1('0x101')](db['CmContact'],{'onDelete':_0x0be1('0xf3'),'as':_0x0be1('0x146'),'foreignKey':_0x0be1('0x154')});db[_0x0be1('0x60')]['belongsTo'](db[_0x0be1('0x58')],{'as':_0x0be1('0x145'),'foreignKey':_0x0be1('0x166')});db[_0x0be1('0x62')]['belongsToMany'](db['User'],{'as':_0x0be1('0x12f'),'through':_0x0be1('0x2d'),'hooks':!![]});db[_0x0be1('0x62')][_0x0be1('0x106')](db[_0x0be1('0xd9')],{'through':_0x0be1('0x16f'),'as':'Teams'});db['ChatGroup'][_0x0be1('0xf4')](db['ChatInternalMessage'],{'as':_0x0be1('0x132'),'foreignKey':_0x0be1('0x170'),'onDelete':'cascade'});db[_0x0be1('0x63')][_0x0be1('0x106')](db['User'],{'as':_0x0be1('0x171'),'through':'chat_group_has_users'});db[_0x0be1('0x167')][_0x0be1('0x101')](db['ChatWebsite'],{'as':_0x0be1('0x16d'),'foreignKey':'ChatWebsiteId'});db['CmCompany']['hasMany'](db['CmContact'],{'as':_0x0be1('0x172'),'foreignKey':_0x0be1('0x173')});db[_0x0be1('0x67')][_0x0be1('0xf4')](db['CmHopper'],{'as':'Hoppers','foreignKey':'ContactId'});db[_0x0be1('0x67')][_0x0be1('0xf4')](db['CmHopperFinal'],{'as':_0x0be1('0xf9'),'foreignKey':_0x0be1('0x154')});db[_0x0be1('0x67')][_0x0be1('0xf4')](db['CmHopperHistory'],{'as':_0x0be1('0x122'),'foreignKey':_0x0be1('0x154')});db[_0x0be1('0x67')][_0x0be1('0xf4')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0x0be1('0x154')});db[_0x0be1('0x67')][_0x0be1('0xf4')](db[_0x0be1('0x174')],{'as':_0x0be1('0x124'),'foreignKey':_0x0be1('0x154')});db[_0x0be1('0x67')][_0x0be1('0xf4')](db[_0x0be1('0x55')],{'as':_0x0be1('0xfd'),'foreignKey':_0x0be1('0x154'),'onDelete':_0x0be1('0x14c')});db[_0x0be1('0x67')][_0x0be1('0xf4')](db[_0x0be1('0x5d')],{'as':'ChatInteractions','foreignKey':'ContactId','onDelete':_0x0be1('0x14c')});db[_0x0be1('0x67')]['hasMany'](db[_0x0be1('0x4d')],{'as':'SmsInteractions','foreignKey':'ContactId','onDelete':_0x0be1('0x14c')});db[_0x0be1('0x67')][_0x0be1('0xf4')](db[_0x0be1('0x46')],{'as':_0x0be1('0xff'),'foreignKey':_0x0be1('0x154'),'onDelete':_0x0be1('0x14c')});db[_0x0be1('0x67')][_0x0be1('0xf4')](db[_0x0be1('0x10b')],{'as':_0x0be1('0x100'),'foreignKey':'ContactId','onDelete':_0x0be1('0x14c')});db[_0x0be1('0x67')]['belongsTo'](db[_0x0be1('0x65')],{'as':_0x0be1('0x175'),'foreignKey':'CompanyId'});db['CmContact'][_0x0be1('0x101')](db[_0x0be1('0xeb')],{'as':_0x0be1('0x13e'),'foreignKey':_0x0be1('0x13f'),'onDelete':_0x0be1('0xf3')});db[_0x0be1('0x67')]['belongsToMany'](db['User'],{'as':_0x0be1('0x15d'),'through':_0x0be1('0x107')});db[_0x0be1('0x67')]['belongsToMany'](db['Tag'],{'as':'Tags','through':_0x0be1('0x176')});db['CmContact'][_0x0be1('0x106')](db['Tag'],{'through':_0x0be1('0x176'),'as':_0x0be1('0x155')});db[_0x0be1('0x121')][_0x0be1('0x101')](db['CmContact'],{'as':'Contact','foreignKey':_0x0be1('0x154'),'onDelete':_0x0be1('0xf3')});db[_0x0be1('0x121')][_0x0be1('0x101')](db[_0x0be1('0xeb')],{'as':_0x0be1('0x13e'),'foreignKey':_0x0be1('0x13f'),'onDelete':_0x0be1('0xf3')});db[_0x0be1('0x121')]['belongsTo'](db[_0x0be1('0x14')],{'as':_0x0be1('0x16a'),'foreignKey':'UserId'});db[_0x0be1('0x121')][_0x0be1('0x101')](db[_0x0be1('0x1c')],{'as':_0x0be1('0x16b'),'foreignKey':'VoiceQueueId','onDelete':_0x0be1('0xf3')});db[_0x0be1('0x121')][_0x0be1('0x101')](db[_0x0be1('0xdb')],{'as':_0x0be1('0xdb'),'foreignKey':_0x0be1('0x177'),'onDelete':_0x0be1('0xf3')});db['CmHopper'][_0x0be1('0x101')](db[_0x0be1('0x14')],{'as':_0x0be1('0x147'),'foreignKey':_0x0be1('0x178')});db[_0x0be1('0x6a')][_0x0be1('0x101')](db['CmContact'],{'as':_0x0be1('0x146'),'foreignKey':_0x0be1('0x154'),'onDelete':_0x0be1('0xf3')});db[_0x0be1('0x6a')]['belongsTo'](db[_0x0be1('0xeb')],{'as':'List','foreignKey':'ListId','onDelete':_0x0be1('0xf3')});db[_0x0be1('0x6a')]['belongsTo'](db[_0x0be1('0x1c')],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':_0x0be1('0xf3')});db[_0x0be1('0x6a')][_0x0be1('0x101')](db['Campaign'],{'as':_0x0be1('0xdb'),'foreignKey':_0x0be1('0x177'),'onDelete':_0x0be1('0xf3')});db[_0x0be1('0x72')]['hasMany'](db[_0x0be1('0x77')],{'as':{'plural':_0x0be1('0x179'),'singular':_0x0be1('0x17a')},'foreignKey':_0x0be1('0x17b'),'onDelete':_0x0be1('0xf3'),'hooks':!![]});db['Automation'][_0x0be1('0xf4')](db['Condition'],{'as':{'plural':'Any','singular':_0x0be1('0x17c')},'foreignKey':'AutomationAnyId','onDelete':_0x0be1('0xf3'),'hooks':!![]});db['Automation'][_0x0be1('0xf4')](db[_0x0be1('0x70')],{'as':'Actions','foreignKey':_0x0be1('0x17d'),'onDelete':_0x0be1('0xf3'),'hooks':!![]});db[_0x0be1('0x129')]['hasMany'](db[_0x0be1('0x129')],{'as':_0x0be1('0x17e'),'foreignKey':_0x0be1('0x12a'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0x0be1('0x129')][_0x0be1('0xf4')](db['VoiceExtension'],{'as':_0x0be1('0xf8'),'foreignKey':_0x0be1('0x12a'),'onDelete':'restrict'});db[_0x0be1('0x129')][_0x0be1('0xf4')](db['MailApplication'],{'as':_0x0be1('0x17f'),'foreignKey':_0x0be1('0x12a')});db[_0x0be1('0x129')][_0x0be1('0xf4')](db[_0x0be1('0x169')],{'as':'ChatApplications','foreignKey':_0x0be1('0x12a')});db[_0x0be1('0x129')][_0x0be1('0xf4')](db[_0x0be1('0x151')],{'as':'FaxApplications','foreignKey':_0x0be1('0x12a')});db[_0x0be1('0x129')][_0x0be1('0xf4')](db['SmsApplication'],{'as':'SmsApplications','foreignKey':_0x0be1('0x12a')});db[_0x0be1('0x7f')][_0x0be1('0x101')](db[_0x0be1('0x36')],{});db[_0x0be1('0x7f')][_0x0be1('0x101')](db[_0x0be1('0x8b')],{'foreignKey':'DefaultReportId'});db[_0x0be1('0x7f')][_0x0be1('0x101')](db[_0x0be1('0x180')],{'foreignKey':_0x0be1('0x181')});db[_0x0be1('0x11f')][_0x0be1('0x106')](db[_0x0be1('0x1a')],{'as':_0x0be1('0x182'),'through':_0x0be1('0x183'),'onDelete':_0x0be1('0x14c')});db[_0x0be1('0x148')][_0x0be1('0x106')](db[_0x0be1('0x67')],{'through':'cm_contact_has_tags'});db[_0x0be1('0x148')][_0x0be1('0x106')](db['ChatInteraction'],{'through':'chat_interaction_has_tags'});db[_0x0be1('0x148')]['belongsToMany'](db['MailInteraction'],{'through':'mail_interaction_has_tags'});db[_0x0be1('0x148')][_0x0be1('0x106')](db[_0x0be1('0x4d')],{'through':_0x0be1('0x184')});db[_0x0be1('0x148')]['belongsToMany'](db['FaxInteraction'],{'through':'fax_interaction_has_tags'});db[_0x0be1('0x148')]['belongsToMany'](db[_0x0be1('0x55')],{'through':_0x0be1('0x163')});db[_0x0be1('0x84')][_0x0be1('0xf4')](db['Condition'],{'as':{'plural':'AllConditions','singular':'AllCondition'},'foreignKey':_0x0be1('0x185'),'onDelete':_0x0be1('0xf3'),'hooks':!![]});db[_0x0be1('0x84')]['hasMany'](db['Condition'],{'as':{'plural':_0x0be1('0x186'),'singular':_0x0be1('0x187')},'foreignKey':_0x0be1('0x188'),'onDelete':'cascade','hooks':!![]});db['Trigger']['hasMany'](db[_0x0be1('0x70')],{'as':_0x0be1('0x189'),'foreignKey':_0x0be1('0x18a'),'onDelete':_0x0be1('0xf3'),'hooks':!![]});db['AnalyticCustomReport']['hasMany'](db[_0x0be1('0x8f')],{'as':_0x0be1('0x18b'),'onDelete':_0x0be1('0xf3'),'foreignKey':_0x0be1('0x181'),'hooks':!![]});db[_0x0be1('0x8b')][_0x0be1('0xf4')](db['AnalyticFieldReport'],{'as':_0x0be1('0x18b'),'onDelete':_0x0be1('0xf3'),'foreignKey':_0x0be1('0x18c')});db[_0x0be1('0x8d')][_0x0be1('0xf4')](db[_0x0be1('0x8f')],{'as':_0x0be1('0x18b'),'onDelete':'cascade','foreignKey':_0x0be1('0x18d')});db['AnalyticFieldReport']['belongsTo'](db['AnalyticMetric'],{'foreignKey':_0x0be1('0x18d')});db[_0x0be1('0x93')][_0x0be1('0xf4')](db['SalesforceConfiguration'],{'as':'Configurations','onDelete':_0x0be1('0xf3'),'foreignKey':'AccountId'});db[_0x0be1('0x95')]['hasMany'](db[_0x0be1('0x97')],{'as':_0x0be1('0x18e'),'onDelete':_0x0be1('0xf3'),'foreignKey':_0x0be1('0x18f')});db['SalesforceConfiguration'][_0x0be1('0xf4')](db['SalesforceField'],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x0be1('0x190')});db['SalesforceConfiguration'][_0x0be1('0xf4')](db[_0x0be1('0x97')],{'as':_0x0be1('0x18b'),'onDelete':_0x0be1('0xf3'),'foreignKey':_0x0be1('0x191')});db[_0x0be1('0x95')][_0x0be1('0x101')](db[_0x0be1('0x93')],{'as':_0x0be1('0x145'),'foreignKey':_0x0be1('0x192')});db[_0x0be1('0x97')]['hasMany'](db[_0x0be1('0x97')],{'as':_0x0be1('0x193'),'foreignKey':'SubjectId'});db[_0x0be1('0x97')]['hasMany'](db[_0x0be1('0x97')],{'as':_0x0be1('0x194'),'foreignKey':_0x0be1('0x190')});db[_0x0be1('0x97')]['hasMany'](db[_0x0be1('0x97')],{'as':_0x0be1('0x195'),'foreignKey':_0x0be1('0x191')});db[_0x0be1('0x97')][_0x0be1('0x101')](db['Variable'],{'as':_0x0be1('0x86'),'foreignKey':_0x0be1('0x196')});db['SugarcrmAccount'][_0x0be1('0xf4')](db[_0x0be1('0x9a')],{'as':_0x0be1('0x197'),'onDelete':'cascade','foreignKey':_0x0be1('0x192')});db[_0x0be1('0x9a')][_0x0be1('0xf4')](db['SugarcrmField'],{'as':_0x0be1('0x18e'),'onDelete':_0x0be1('0xf3'),'foreignKey':'SubjectId'});db[_0x0be1('0x9a')][_0x0be1('0xf4')](db[_0x0be1('0x9c')],{'as':_0x0be1('0x198'),'onDelete':_0x0be1('0xf3'),'foreignKey':_0x0be1('0x190')});db[_0x0be1('0x9a')][_0x0be1('0xf4')](db[_0x0be1('0x9c')],{'as':'Fields','onDelete':_0x0be1('0xf3'),'foreignKey':'FieldId'});db[_0x0be1('0x9a')][_0x0be1('0x101')](db[_0x0be1('0x199')],{'as':'Account','foreignKey':_0x0be1('0x192')});db[_0x0be1('0x9c')][_0x0be1('0xf4')](db[_0x0be1('0x9c')],{'as':'Subject','foreignKey':_0x0be1('0x18f')});db[_0x0be1('0x9c')][_0x0be1('0xf4')](db[_0x0be1('0x9c')],{'as':_0x0be1('0x194'),'foreignKey':_0x0be1('0x190')});db[_0x0be1('0x9c')][_0x0be1('0xf4')](db[_0x0be1('0x9c')],{'as':_0x0be1('0x195'),'foreignKey':_0x0be1('0x191')});db[_0x0be1('0x9c')][_0x0be1('0x101')](db[_0x0be1('0x86')],{'as':_0x0be1('0x86'),'foreignKey':'VariableId'});db[_0x0be1('0x9d')][_0x0be1('0xf4')](db[_0x0be1('0x19a')],{'as':_0x0be1('0x197'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x0be1('0x19a')][_0x0be1('0xf4')](db[_0x0be1('0xa0')],{'as':_0x0be1('0x18e'),'onDelete':_0x0be1('0xf3'),'foreignKey':_0x0be1('0x18f')});db['DeskConfiguration']['hasMany'](db[_0x0be1('0xa0')],{'as':_0x0be1('0x198'),'onDelete':_0x0be1('0xf3'),'foreignKey':_0x0be1('0x190')});db[_0x0be1('0x19a')]['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0be1('0xf3'),'foreignKey':_0x0be1('0x191')});db[_0x0be1('0x19a')][_0x0be1('0x101')](db['DeskAccount'],{'as':'Account','foreignKey':_0x0be1('0x192')});db[_0x0be1('0x19a')][_0x0be1('0x106')](db[_0x0be1('0x148')],{'through':_0x0be1('0x19b')});db[_0x0be1('0xa0')][_0x0be1('0xf4')](db[_0x0be1('0xa0')],{'as':_0x0be1('0x193'),'foreignKey':_0x0be1('0x18f')});db[_0x0be1('0xa0')][_0x0be1('0xf4')](db[_0x0be1('0xa0')],{'as':_0x0be1('0x194'),'foreignKey':'DescriptionId'});db[_0x0be1('0xa0')][_0x0be1('0xf4')](db[_0x0be1('0xa0')],{'as':'Field','foreignKey':_0x0be1('0x191')});db['DeskField'][_0x0be1('0x101')](db['Variable'],{'as':_0x0be1('0x86'),'foreignKey':_0x0be1('0x196')});db[_0x0be1('0x19c')]['hasMany'](db['ZohoConfiguration'],{'as':_0x0be1('0x197'),'onDelete':_0x0be1('0xf3'),'foreignKey':'AccountId'});db[_0x0be1('0xa3')][_0x0be1('0xf4')](db[_0x0be1('0xa5')],{'as':_0x0be1('0x18e'),'onDelete':_0x0be1('0xf3'),'foreignKey':_0x0be1('0x18f')});db[_0x0be1('0xa3')][_0x0be1('0xf4')](db[_0x0be1('0xa5')],{'as':'Descriptions','onDelete':_0x0be1('0xf3'),'foreignKey':'DescriptionId'});db[_0x0be1('0xa3')][_0x0be1('0xf4')](db[_0x0be1('0xa5')],{'as':_0x0be1('0x18b'),'onDelete':_0x0be1('0xf3'),'foreignKey':_0x0be1('0x191')});db[_0x0be1('0xa3')][_0x0be1('0x101')](db['ZohoAccount'],{'as':_0x0be1('0x145'),'foreignKey':_0x0be1('0x192')});db[_0x0be1('0xa5')][_0x0be1('0xf4')](db[_0x0be1('0xa5')],{'as':_0x0be1('0x193'),'foreignKey':'SubjectId'});db[_0x0be1('0xa5')]['hasMany'](db[_0x0be1('0xa5')],{'as':_0x0be1('0x194'),'foreignKey':_0x0be1('0x190')});db[_0x0be1('0xa5')][_0x0be1('0xf4')](db[_0x0be1('0xa5')],{'as':_0x0be1('0x195'),'foreignKey':'FieldId'});db[_0x0be1('0xa5')][_0x0be1('0x101')](db[_0x0be1('0x86')],{'as':_0x0be1('0x86'),'foreignKey':_0x0be1('0x196')});db[_0x0be1('0xa7')][_0x0be1('0xf4')](db[_0x0be1('0xa8')],{'as':_0x0be1('0x197'),'onDelete':_0x0be1('0xf3'),'foreignKey':_0x0be1('0x192')});db[_0x0be1('0xa8')][_0x0be1('0xf4')](db['ZendeskField'],{'as':_0x0be1('0x18e'),'foreignKey':_0x0be1('0x18f')});db[_0x0be1('0xa8')][_0x0be1('0xf4')](db[_0x0be1('0xaa')],{'as':_0x0be1('0x198'),'foreignKey':'DescriptionId'});db[_0x0be1('0xa8')]['hasMany'](db['ZendeskField'],{'as':_0x0be1('0x18b'),'foreignKey':_0x0be1('0x191')});db['ZendeskConfiguration']['belongsTo'](db['ZendeskAccount'],{'as':_0x0be1('0x145'),'foreignKey':_0x0be1('0x192')});db[_0x0be1('0xa8')]['belongsToMany'](db[_0x0be1('0x148')],{'through':_0x0be1('0x19d')});db[_0x0be1('0xaa')][_0x0be1('0xf4')](db[_0x0be1('0xaa')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0be1('0xaa')][_0x0be1('0xf4')](db[_0x0be1('0xaa')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0be1('0xaa')]['hasMany'](db[_0x0be1('0xaa')],{'as':'Field','foreignKey':'FieldId'});db['ZendeskField']['belongsTo'](db[_0x0be1('0x86')],{'as':_0x0be1('0x86'),'foreignKey':'VariableId'});db[_0x0be1('0xac')][_0x0be1('0xf4')](db[_0x0be1('0xae')],{'as':_0x0be1('0x197'),'onDelete':_0x0be1('0xf3'),'foreignKey':_0x0be1('0x192')});db[_0x0be1('0xae')][_0x0be1('0xf4')](db[_0x0be1('0xb0')],{'as':_0x0be1('0x18e'),'onDelete':'cascade','foreignKey':_0x0be1('0x18f')});db[_0x0be1('0xae')]['hasMany'](db[_0x0be1('0xb0')],{'as':_0x0be1('0x198'),'onDelete':'cascade','foreignKey':_0x0be1('0x190')});db[_0x0be1('0xae')][_0x0be1('0xf4')](db[_0x0be1('0xb0')],{'as':_0x0be1('0x18b'),'onDelete':_0x0be1('0xf3'),'foreignKey':_0x0be1('0x191')});db[_0x0be1('0xae')]['belongsTo'](db[_0x0be1('0xac')],{'as':_0x0be1('0x145'),'foreignKey':_0x0be1('0x192')});db[_0x0be1('0xae')]['belongsToMany'](db[_0x0be1('0x148')],{'through':_0x0be1('0x19e')});db['FreshdeskField'][_0x0be1('0xf4')](db[_0x0be1('0xb0')],{'as':_0x0be1('0x193'),'foreignKey':'SubjectId'});db['FreshdeskField'][_0x0be1('0xf4')](db['FreshdeskField'],{'as':_0x0be1('0x194'),'foreignKey':'DescriptionId'});db[_0x0be1('0xb0')]['hasMany'](db[_0x0be1('0xb0')],{'as':_0x0be1('0x195'),'foreignKey':_0x0be1('0x191')});db[_0x0be1('0xb0')][_0x0be1('0x101')](db[_0x0be1('0x86')],{'as':_0x0be1('0x86'),'foreignKey':_0x0be1('0x196')});db[_0x0be1('0x19f')][_0x0be1('0xf4')](db['VtigerConfiguration'],{'as':_0x0be1('0x197'),'onDelete':_0x0be1('0xf3'),'foreignKey':'AccountId'});db[_0x0be1('0xb2')][_0x0be1('0xf4')](db[_0x0be1('0xb4')],{'as':_0x0be1('0x18e'),'foreignKey':_0x0be1('0x18f')});db[_0x0be1('0xb2')][_0x0be1('0xf4')](db[_0x0be1('0xb4')],{'as':_0x0be1('0x198'),'foreignKey':_0x0be1('0x190')});db[_0x0be1('0xb2')][_0x0be1('0xf4')](db[_0x0be1('0xb4')],{'as':_0x0be1('0x18b'),'foreignKey':_0x0be1('0x191')});db[_0x0be1('0xb2')][_0x0be1('0x101')](db['VtigerAccount'],{'as':_0x0be1('0x145'),'foreignKey':_0x0be1('0x192')});db[_0x0be1('0xb4')][_0x0be1('0xf4')](db['VtigerField'],{'as':_0x0be1('0x193'),'foreignKey':_0x0be1('0x18f')});db[_0x0be1('0xb4')][_0x0be1('0xf4')](db[_0x0be1('0xb4')],{'as':_0x0be1('0x194'),'foreignKey':'DescriptionId'});db[_0x0be1('0xb4')][_0x0be1('0xf4')](db[_0x0be1('0xb4')],{'as':_0x0be1('0x195'),'foreignKey':_0x0be1('0x191')});db['VtigerField'][_0x0be1('0x101')](db['Variable'],{'as':_0x0be1('0x86'),'foreignKey':_0x0be1('0x196')});db[_0x0be1('0xb6')][_0x0be1('0xf4')](db[_0x0be1('0x1a0')],{'as':_0x0be1('0x197'),'onDelete':_0x0be1('0xf3'),'foreignKey':_0x0be1('0x192')});db['ServicenowConfiguration'][_0x0be1('0xf4')](db[_0x0be1('0xb9')],{'as':_0x0be1('0x18e'),'foreignKey':_0x0be1('0x18f')});db[_0x0be1('0x1a0')]['hasMany'](db[_0x0be1('0xb9')],{'as':_0x0be1('0x198'),'foreignKey':_0x0be1('0x190')});db[_0x0be1('0x1a0')][_0x0be1('0xf4')](db['ServicenowField'],{'as':_0x0be1('0x18b'),'foreignKey':_0x0be1('0x191')});db[_0x0be1('0x1a0')]['belongsTo'](db[_0x0be1('0xb6')],{'as':'Account','foreignKey':_0x0be1('0x192')});db['ServicenowField'][_0x0be1('0xf4')](db['ServicenowField'],{'as':_0x0be1('0x193'),'foreignKey':_0x0be1('0x18f')});db[_0x0be1('0xb9')][_0x0be1('0xf4')](db[_0x0be1('0xb9')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0be1('0xb9')][_0x0be1('0xf4')](db[_0x0be1('0xb9')],{'as':_0x0be1('0x195'),'foreignKey':_0x0be1('0x191')});db[_0x0be1('0xb9')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0x0be1('0x196')});db[_0x0be1('0x1a1')][_0x0be1('0xf4')](db[_0x0be1('0x1a2')],{'as':'Configurations','onDelete':_0x0be1('0xf3'),'foreignKey':_0x0be1('0x192')});db[_0x0be1('0x1a2')][_0x0be1('0xf4')](db[_0x0be1('0xbd')],{'as':_0x0be1('0x18e'),'onDelete':_0x0be1('0xf3'),'foreignKey':'SubjectId'});db[_0x0be1('0x1a2')][_0x0be1('0xf4')](db[_0x0be1('0xbd')],{'as':'Descriptions','onDelete':_0x0be1('0xf3'),'foreignKey':'DescriptionId'});db[_0x0be1('0x1a2')][_0x0be1('0xf4')](db[_0x0be1('0xbd')],{'as':_0x0be1('0x18b'),'onDelete':'cascade','foreignKey':_0x0be1('0x191')});db[_0x0be1('0x1a2')][_0x0be1('0x101')](db[_0x0be1('0x1a1')],{'as':_0x0be1('0x145'),'foreignKey':_0x0be1('0x192')});db[_0x0be1('0xbd')][_0x0be1('0xf4')](db[_0x0be1('0xbd')],{'as':_0x0be1('0x193'),'foreignKey':_0x0be1('0x18f')});db[_0x0be1('0xbd')]['hasMany'](db[_0x0be1('0xbd')],{'as':_0x0be1('0x194'),'foreignKey':_0x0be1('0x190')});db[_0x0be1('0xbd')][_0x0be1('0xf4')](db['Dynamics365Field'],{'as':_0x0be1('0x195'),'foreignKey':'FieldId'});db[_0x0be1('0xbd')]['belongsTo'](db[_0x0be1('0x86')],{'as':'Variable','foreignKey':_0x0be1('0x196')});db[_0x0be1('0xbe')][_0x0be1('0xf4')](db[_0x0be1('0xbf')],{'as':_0x0be1('0x197'),'onDelete':_0x0be1('0xf3'),'foreignKey':_0x0be1('0x192')});db[_0x0be1('0xbf')][_0x0be1('0xf4')](db[_0x0be1('0xc0')],{'as':'Subjects','foreignKey':_0x0be1('0x18f')});db['FreshsalesConfiguration'][_0x0be1('0xf4')](db[_0x0be1('0xc0')],{'as':_0x0be1('0x198'),'foreignKey':_0x0be1('0x190')});db[_0x0be1('0xbf')][_0x0be1('0xf4')](db[_0x0be1('0xc0')],{'as':_0x0be1('0x18b'),'foreignKey':_0x0be1('0x191')});db['FreshsalesConfiguration'][_0x0be1('0x101')](db[_0x0be1('0xbe')],{'as':'Account','foreignKey':_0x0be1('0x192')});db[_0x0be1('0xc0')][_0x0be1('0xf4')](db[_0x0be1('0xc0')],{'as':_0x0be1('0x193'),'foreignKey':_0x0be1('0x18f')});db[_0x0be1('0xc0')]['hasMany'](db[_0x0be1('0xc0')],{'as':_0x0be1('0x194'),'foreignKey':_0x0be1('0x190')});db['FreshsalesField'][_0x0be1('0xf4')](db[_0x0be1('0xc0')],{'as':_0x0be1('0x195'),'foreignKey':_0x0be1('0x191')});db[_0x0be1('0xc0')][_0x0be1('0x101')](db[_0x0be1('0x86')],{'as':'Variable','foreignKey':_0x0be1('0x196')});db[_0x0be1('0x1a3')]['belongsTo'](db[_0x0be1('0x58')],{});db[_0x0be1('0x1a3')][_0x0be1('0x101')](db['CmList'],{'as':_0x0be1('0x13e'),'foreignKey':_0x0be1('0x13f')});db[_0x0be1('0x1a3')]['belongsTo'](db['CmContact'],{'as':_0x0be1('0x146'),'foreignKey':_0x0be1('0x154')});db[_0x0be1('0x1a3')][_0x0be1('0x101')](db[_0x0be1('0x5d')],{});db[_0x0be1('0x1a3')][_0x0be1('0x101')](db[_0x0be1('0x5f')],{});db[_0x0be1('0x1a3')][_0x0be1('0x101')](db[_0x0be1('0x14')],{});db[_0x0be1('0x1a3')][_0x0be1('0x101')](db[_0x0be1('0x62')],{});db[_0x0be1('0x1a4')][_0x0be1('0x101')](db['User'],{'onDelete':_0x0be1('0xf3'),'foreignKey':_0x0be1('0x1a5')});db[_0x0be1('0x1a4')][_0x0be1('0x101')](db[_0x0be1('0x14')],{'onDelete':'cascade','foreignKey':_0x0be1('0x1a6')});db['JscriptySessionReport'][_0x0be1('0xf4')](db[_0x0be1('0xc8')],{'foreignKey':_0x0be1('0x1a7'),'onDelete':'cascade'});db[_0x0be1('0x174')][_0x0be1('0xf4')](db['JscriptyAnswerReport'],{'foreignKey':'SessionId','onDelete':_0x0be1('0xf3')});db[_0x0be1('0xca')][_0x0be1('0x101')](db[_0x0be1('0x4b')],{});db[_0x0be1('0xca')][_0x0be1('0x101')](db[_0x0be1('0xeb')],{'as':_0x0be1('0x13e'),'foreignKey':_0x0be1('0x13f')});db['SmsQueueReport'][_0x0be1('0x101')](db[_0x0be1('0x67')],{'as':_0x0be1('0x146'),'foreignKey':_0x0be1('0x154')});db[_0x0be1('0xca')][_0x0be1('0x101')](db[_0x0be1('0x4d')],{});db[_0x0be1('0xca')][_0x0be1('0x101')](db[_0x0be1('0x15b')],{});db[_0x0be1('0xca')]['belongsTo'](db[_0x0be1('0x14')],{});db[_0x0be1('0xca')]['belongsTo'](db[_0x0be1('0x4f')],{});db['JscriptyProject']['hasMany'](db['JscriptySessionReport'],{'foreignKey':_0x0be1('0x1a8')});db[_0x0be1('0xce')][_0x0be1('0xf4')](db['JscriptyQuestionReport'],{'foreignKey':_0x0be1('0x1a8')});db[_0x0be1('0xce')][_0x0be1('0xf4')](db[_0x0be1('0xc6')],{'foreignKey':_0x0be1('0x1a8')});db['SquareProject']['belongsToMany'](db[_0x0be1('0x14')],{'as':_0x0be1('0x15d'),'through':_0x0be1('0x1a9')});db['Team'][_0x0be1('0x106')](db[_0x0be1('0x14')],{'as':_0x0be1('0x12f'),'through':_0x0be1('0x10a')});db[_0x0be1('0xd9')][_0x0be1('0x106')](db[_0x0be1('0x1c')],{'through':'team_has_voice_queues','as':_0x0be1('0x1aa')});db[_0x0be1('0xd9')][_0x0be1('0x106')](db[_0x0be1('0x37')],{'through':_0x0be1('0x141'),'as':_0x0be1('0x110')});db['Team'][_0x0be1('0x106')](db['ChatQueue'],{'through':_0x0be1('0x16f'),'as':_0x0be1('0x111')});db[_0x0be1('0xd9')][_0x0be1('0x106')](db[_0x0be1('0x48')],{'through':'team_has_fax_queues','as':_0x0be1('0x1ab')});db[_0x0be1('0xd9')][_0x0be1('0x106')](db[_0x0be1('0x4f')],{'through':_0x0be1('0x1ac'),'as':'SmsQueues'});db['Team'][_0x0be1('0x106')](db[_0x0be1('0x57')],{'through':_0x0be1('0x165'),'as':'OpenchannelQueues'});db[_0x0be1('0xdb')][_0x0be1('0xf4')](db[_0x0be1('0x121')],{'as':_0x0be1('0x1ad'),'foreignKey':_0x0be1('0x177')});db[_0x0be1('0xdb')]['hasMany'](db[_0x0be1('0x6c')],{'as':_0x0be1('0xf9'),'foreignKey':_0x0be1('0x177')});db['Campaign']['hasMany'](db[_0x0be1('0xfa')],{'as':_0x0be1('0x122'),'foreignKey':'CampaignId'});db[_0x0be1('0xdb')][_0x0be1('0xf4')](db[_0x0be1('0x6a')],{'as':_0x0be1('0x123'),'foreignKey':_0x0be1('0x177')});db[_0x0be1('0xdb')]['belongsTo'](db[_0x0be1('0x125')],{'as':_0x0be1('0x125'),'foreignKey':_0x0be1('0x126')});db[_0x0be1('0xdb')][_0x0be1('0x101')](db['Trunk'],{'as':_0x0be1('0x127'),'foreignKey':_0x0be1('0x128')});db[_0x0be1('0xdb')][_0x0be1('0x101')](db[_0x0be1('0x129')],{'as':_0x0be1('0x129'),'foreignKey':_0x0be1('0x12a')});db[_0x0be1('0xdb')][_0x0be1('0x101')](db[_0x0be1('0xd4')],{'as':_0x0be1('0xd4'),'foreignKey':'SquareProjectId'});db['Campaign'][_0x0be1('0x106')](db[_0x0be1('0xeb')],{'as':_0x0be1('0x108'),'through':_0x0be1('0x1ae')});db[_0x0be1('0xdb')][_0x0be1('0x106')](db[_0x0be1('0xeb')],{'as':'BlackLists','through':'campaigns_has_cm_blacklists'});db['MailTransferReport'][_0x0be1('0x101')](db['MailMessage'],{});db[_0x0be1('0xe1')]['belongsTo'](db[_0x0be1('0x10b')],{});db[_0x0be1('0xe1')][_0x0be1('0x101')](db[_0x0be1('0x36')],{'foreignKey':_0x0be1('0x1af'),'as':'FromAccount'});db[_0x0be1('0xe1')][_0x0be1('0x101')](db[_0x0be1('0x14')],{'foreignKey':_0x0be1('0x1b0'),'as':_0x0be1('0x1b1')});db['MailTransferReport'][_0x0be1('0x101')](db[_0x0be1('0x14')],{'foreignKey':_0x0be1('0x1b2'),'as':_0x0be1('0x1b3')});db[_0x0be1('0xe1')][_0x0be1('0x101')](db[_0x0be1('0x37')],{'foreignKey':_0x0be1('0x1b4'),'as':_0x0be1('0x1b5')});db[_0x0be1('0xe1')][_0x0be1('0x101')](db['MailAccount'],{'foreignKey':_0x0be1('0x1b6'),'as':_0x0be1('0x1b7')});db[_0x0be1('0xe3')]['belongsTo'](db[_0x0be1('0x5f')],{});db[_0x0be1('0xe3')]['belongsTo'](db[_0x0be1('0x5d')],{});db[_0x0be1('0xe3')][_0x0be1('0x101')](db['ChatWebsite'],{'foreignKey':_0x0be1('0x1b8'),'as':_0x0be1('0x1b9')});db[_0x0be1('0xe3')]['belongsTo'](db['User'],{'foreignKey':_0x0be1('0x1b0'),'as':'FromAgent'});db[_0x0be1('0xe3')][_0x0be1('0x101')](db[_0x0be1('0x14')],{'foreignKey':_0x0be1('0x1b2'),'as':_0x0be1('0x1b3')});db['ChatTransferReport'][_0x0be1('0x101')](db[_0x0be1('0x62')],{'foreignKey':_0x0be1('0x1ba'),'as':_0x0be1('0x1b5')});db['ChatTransferReport'][_0x0be1('0x101')](db[_0x0be1('0x58')],{'foreignKey':_0x0be1('0x1bb'),'as':_0x0be1('0x1b7')});db[_0x0be1('0xe5')][_0x0be1('0x101')](db['FaxMessage'],{});db[_0x0be1('0xe5')][_0x0be1('0x101')](db[_0x0be1('0x46')],{});db[_0x0be1('0xe5')]['belongsTo'](db[_0x0be1('0x43')],{'foreignKey':_0x0be1('0x1bc'),'as':'FromAccount'});db[_0x0be1('0xe5')][_0x0be1('0x101')](db['User'],{'foreignKey':_0x0be1('0x1b0'),'as':'FromAgent'});db[_0x0be1('0xe5')][_0x0be1('0x101')](db[_0x0be1('0x14')],{'foreignKey':'ToUserId','as':_0x0be1('0x1b3')});db[_0x0be1('0xe5')][_0x0be1('0x101')](db[_0x0be1('0x48')],{'foreignKey':_0x0be1('0x1bd'),'as':_0x0be1('0x1b5')});db[_0x0be1('0xe5')]['belongsTo'](db['FaxAccount'],{'foreignKey':_0x0be1('0x1be'),'as':_0x0be1('0x1b7')});db[_0x0be1('0xe7')][_0x0be1('0x101')](db[_0x0be1('0x161')],{});db[_0x0be1('0xe7')]['belongsTo'](db['OpenchannelInteraction'],{});db['OpenchannelTransferReport'][_0x0be1('0x101')](db[_0x0be1('0x51')],{'foreignKey':_0x0be1('0x1bf'),'as':_0x0be1('0x1b9')});db['OpenchannelTransferReport'][_0x0be1('0x101')](db[_0x0be1('0x14')],{'foreignKey':_0x0be1('0x1b0'),'as':_0x0be1('0x1b1')});db['OpenchannelTransferReport'][_0x0be1('0x101')](db[_0x0be1('0x14')],{'foreignKey':_0x0be1('0x1b2'),'as':'ToAgent'});db['OpenchannelTransferReport'][_0x0be1('0x101')](db[_0x0be1('0x57')],{'foreignKey':_0x0be1('0x1c0'),'as':_0x0be1('0x1b5')});db[_0x0be1('0xe7')][_0x0be1('0x101')](db[_0x0be1('0x51')],{'foreignKey':'ToOpenchannelAccountId','as':_0x0be1('0x1b7')});db[_0x0be1('0xe9')][_0x0be1('0x101')](db[_0x0be1('0x15b')],{});db[_0x0be1('0xe9')][_0x0be1('0x101')](db['SmsInteraction'],{});db[_0x0be1('0xe9')][_0x0be1('0x101')](db['SmsAccount'],{'foreignKey':_0x0be1('0x1c1'),'as':_0x0be1('0x1b9')});db[_0x0be1('0xe9')][_0x0be1('0x101')](db[_0x0be1('0x14')],{'foreignKey':_0x0be1('0x1b0'),'as':'FromAgent'});db[_0x0be1('0xe9')]['belongsTo'](db[_0x0be1('0x14')],{'foreignKey':_0x0be1('0x1b2'),'as':'ToAgent'});db[_0x0be1('0xe9')][_0x0be1('0x101')](db[_0x0be1('0x4f')],{'foreignKey':_0x0be1('0x1c2'),'as':'ToQueue'});db['SmsTransferReport']['belongsTo'](db[_0x0be1('0x4b')],{'foreignKey':_0x0be1('0x1c3'),'as':_0x0be1('0x1b7')});db[_0x0be1('0xeb')][_0x0be1('0xf4')](db[_0x0be1('0x75')],{'as':_0x0be1('0x13a'),'foreignKey':'ListId'});db[_0x0be1('0xeb')][_0x0be1('0xf4')](db[_0x0be1('0x1c4')],{'as':_0x0be1('0x1c5'),'foreignKey':_0x0be1('0x13f')});db['CmList'][_0x0be1('0xf4')](db[_0x0be1('0x67')],{'as':_0x0be1('0x172'),'onDelete':'cascade','foreignKey':'ListId'});db['CmList'][_0x0be1('0xf4')](db[_0x0be1('0x6c')],{'as':_0x0be1('0xf9'),'foreignKey':'ListId'});db[_0x0be1('0xeb')][_0x0be1('0xf4')](db['CmHopperHistory'],{'as':_0x0be1('0xfb'),'foreignKey':'ListId'});db[_0x0be1('0xeb')][_0x0be1('0xf4')](db[_0x0be1('0xfc')],{'as':_0x0be1('0xfc'),'foreignKey':_0x0be1('0x13f')});db['CmList'][_0x0be1('0x106')](db['VoiceQueue'],{'as':_0x0be1('0x1c6'),'through':'voice_queues_has_cm_lists'});db[_0x0be1('0xeb')]['belongsToMany'](db[_0x0be1('0x14')],{'as':'Agents','through':_0x0be1('0x109')});db[_0x0be1('0xed')][_0x0be1('0xf4')](db[_0x0be1('0xf7')],{'as':'Extensions','onDelete':_0x0be1('0x14c')});db['VoicePrefix'][_0x0be1('0x106')](db[_0x0be1('0x14')],{'as':'Agents','through':_0x0be1('0x1c7')});db[_0x0be1('0x102')][_0x0be1('0xf4')](db[_0x0be1('0x14')],{'as':_0x0be1('0x15d'),'foreignKey':_0x0be1('0x103')});db['UserProfile'][_0x0be1('0xf4')](db['UserProfileSection'],{'as':'UserProfileSections','foreignKey':_0x0be1('0x103'),'onDelete':_0x0be1('0xf3')});db['UserProfileSection'][_0x0be1('0xf4')](db[_0x0be1('0xf0')],{'as':'Resources','foreignKey':_0x0be1('0x1c8'),'onDelete':_0x0be1('0xf3')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x0a6d=['VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','hasOne','cascade','UserId','VoiceRecording','Recordings','VoiceQueuesRt','hasMany','Extensions','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','FaxInteractions','belongsTo','userProfileId','belongsToMany','chat_group_has_users','Contacts','Lists','Team','user_has_teams','MailInteractions','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','VoiceQueues','MailQueue','MailQueues','ChatQueues','FaxQueues','SmsQueues','UserSmsQueue','CmList','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','user_has_openchannel_accounts','user_has_square_projects','ChanSpyId','Sound','Sounds','moh_has_sounds','Members','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','Pause','mandatoryDispositionPause','voice_queues_has_cm_lists','Teams','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','QueueCalls','AgentReports','uniqueid','Contact','ContactId','MailAccount','MailAccountId','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','Applications','ListId','TemplateId','Agents','team_has_mail_queues','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachments','Interaction','restrict','TagId','List','Dashboard','Items','FaxAccountId','Exntensions','mandatoryDispositionPauseId','fax_interaction_has_tags','FaxInteractionId','team_has_fax_queues','SmsAccountId','user_has_sms_accounts','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatWebsiteId','OpenchannelQueueReport','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','AttachmentId','team_has_chat_queues','ChatGroupId','HopperFinals','Company','CompanyId','cm_user_has_contacts','cm_contact_has_tags','Agent','CampaignId','OwnerId','OneAll','OneAny','AutomationId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','AnalyticDefaultReport','DefaultReportId','Schedule','CustomReportId','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Actions','TriggerId','Fields','MetricId','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','Field','Variable','Configurations','SugarcrmConfiguration','VariableId','DeskConfiguration','int_desk_configuration_has_tags','ZendeskField','int_zendesk_configuration_has_tags','ServicenowConfiguration','FreshsalesAccount','FromId','ToId','SessionId','ProjectId','OpenchannelQueues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsAccountId','CustomFields','Queues','cm_user_has_lists','UserProfileSections','Resources','sectionId','path','../config/environment','jstz','sequelize','defaultsDeep','motion2','xcall','mysql','utf8mb4','utf8_general_ci','sequelizeHistory','xC@LL1234','127.0.0.1','name','utf8','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceDialReport','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','FaxMessage','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','Integration','../api/integration/integration.model','Network','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x0a6d,0xdb));var _0xd0a6=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x0a6d[_0x4b055c];return _0x4b62bb;};'use strict';var path=require(_0xd0a6('0x0'));var config=require(_0xd0a6('0x1'));var Sequelize=require('sequelize');var _=require('lodash');var jstz=require(_0xd0a6('0x2'));var timezone=jstz['determine']();config[_0xd0a6('0x3')]=_[_0xd0a6('0x4')](config['sequelize'],{'database':_0xd0a6('0x5'),'username':_0xd0a6('0x6'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xd0a6('0x7'),'dialectOptions':{'charset':_0xd0a6('0x8')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0xd0a6('0x9')}}});config[_0xd0a6('0xa')]=_[_0xd0a6('0x4')](config['sequelizeHistory'],{'database':'motion2','username':'xcall','password':_0xd0a6('0xb'),'options':{'host':_0xd0a6('0xc'),'port':0xcea,'dialect':_0xd0a6('0x7'),'dialectOptions':{'charset':_0xd0a6('0x8')},'logging':![],'timezone':timezone[_0xd0a6('0xd')](),'define':{'charset':_0xd0a6('0xe'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xd0a6('0x3')][_0xd0a6('0xf')],config['sequelize'][_0xd0a6('0x10')],config[_0xd0a6('0x3')][_0xd0a6('0x11')],config['sequelize'][_0xd0a6('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xd0a6('0xa')][_0xd0a6('0xf')],config['sequelizeHistory'][_0xd0a6('0x10')],config[_0xd0a6('0xa')][_0xd0a6('0x11')],config[_0xd0a6('0xa')][_0xd0a6('0x12')])};db[_0xd0a6('0x13')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x15'));db[_0xd0a6('0x16')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x17'));db[_0xd0a6('0x18')]=db[_0xd0a6('0x3')]['import'](_0xd0a6('0x19'));db[_0xd0a6('0x1a')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')]('../api/voiceExtension/voiceExtension.model');db[_0xd0a6('0x1b')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x1c'));db[_0xd0a6('0x1d')]=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0x1e'));db['VoiceRecording']=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x1f'));db[_0xd0a6('0x20')]=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0x21'));db[_0xd0a6('0x22')]=db['sequelize']['import'](_0xd0a6('0x23'));db[_0xd0a6('0x24')]=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0x25'));db[_0xd0a6('0x26')]=db[_0xd0a6('0x3')]['import']('../api/voiceCallReport/voiceCallReport.model');db[_0xd0a6('0x27')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')]('../api/voiceDialReport/voiceDialReport.model');db[_0xd0a6('0x28')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x29'));db[_0xd0a6('0x2a')]=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0x2b'));db['MemberReport']=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x2c'));db[_0xd0a6('0x2d')]=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0x2e'));db['VoiceTransferReport']=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x2f'));db[_0xd0a6('0x30')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0xd0a6('0x31')]=db[_0xd0a6('0x3')]['import'](_0xd0a6('0x32'));db[_0xd0a6('0x33')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x34'));db[_0xd0a6('0x35')]=db[_0xd0a6('0x3')]['import'](_0xd0a6('0x36'));db[_0xd0a6('0x37')]=db['sequelize']['import'](_0xd0a6('0x38'));db['UserSmsQueue']=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x39'));db[_0xd0a6('0x3a')]=db['sequelize']['import'](_0xd0a6('0x3b'));db[_0xd0a6('0x3c')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x3d'));db[_0xd0a6('0x3e')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x3f'));db['MailAccount']=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x40'));db['MailQueue']=db[_0xd0a6('0x3')][_0xd0a6('0x14')]('../api/mailQueue/mailQueue.model');db[_0xd0a6('0x41')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x42'));db[_0xd0a6('0x43')]=db[_0xd0a6('0x3')]['import'](_0xd0a6('0x44'));db[_0xd0a6('0x45')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x46'));db[_0xd0a6('0x47')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x48'));db[_0xd0a6('0x49')]=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0x4a'));db['Dashboard']=db[_0xd0a6('0x3')]['import'](_0xd0a6('0x4b'));db[_0xd0a6('0x4c')]=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0x4d'));db[_0xd0a6('0x4e')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')]('../api/faxAccount/faxAccount.model');db[_0xd0a6('0x4f')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x50'));db['FaxInteraction']=db[_0xd0a6('0x3')]['import']('../api/faxInteraction/faxInteraction.model');db[_0xd0a6('0x51')]=db['sequelize']['import']('../api/faxMessage/faxMessage.model');db[_0xd0a6('0x52')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x53'));db[_0xd0a6('0x54')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x55'));db[_0xd0a6('0x56')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x57'));db[_0xd0a6('0x58')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x59'));db[_0xd0a6('0x5a')]=db['sequelize']['import'](_0xd0a6('0x5b'));db[_0xd0a6('0x5c')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x5d'));db[_0xd0a6('0x5e')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x5f'));db[_0xd0a6('0x60')]=db['sequelize']['import'](_0xd0a6('0x61'));db[_0xd0a6('0x62')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x63'));db[_0xd0a6('0x64')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0xd0a6('0x65')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')]('../api/openchannelMessage/openchannelMessage.model');db[_0xd0a6('0x66')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x67'));db[_0xd0a6('0x68')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x69'));db['OpenchannelQueueReport']=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x6a'));db[_0xd0a6('0x6b')]=db[_0xd0a6('0x3')]['import']('../api/chatApplication/chatApplication.model');db[_0xd0a6('0x6c')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x6d'));db[_0xd0a6('0x6e')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x6f'));db[_0xd0a6('0x70')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0xd0a6('0x71')]=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0x72'));db[_0xd0a6('0x73')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x74'));db[_0xd0a6('0x75')]=db['sequelize']['import'](_0xd0a6('0x76'));db[_0xd0a6('0x77')]=db[_0xd0a6('0x3')]['import'](_0xd0a6('0x78'));db[_0xd0a6('0x79')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x7a'));db[_0xd0a6('0x7b')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x7c'));db[_0xd0a6('0x7d')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x7e'));db[_0xd0a6('0x7f')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x80'));db[_0xd0a6('0x81')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x82'));db[_0xd0a6('0x83')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0xd0a6('0x84')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x85'));db[_0xd0a6('0x86')]=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0x87'));db[_0xd0a6('0x88')]=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0x89'));db[_0xd0a6('0x8a')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x8b'));db['Disposition']=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0x8c'));db[_0xd0a6('0x8d')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x8e'));db[_0xd0a6('0x8f')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')]('../api/interval/interval.model');db['Pause']=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0x90'));db[_0xd0a6('0x91')]=db[_0xd0a6('0x3')]['import'](_0xd0a6('0x92'));db[_0xd0a6('0x93')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x94'));db['Schedule']=db['sequelize'][_0xd0a6('0x14')]('../api/schedule/schedule.model');db['Sound']=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x95'));db[_0xd0a6('0x96')]=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0x97'));db[_0xd0a6('0x98')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x99'));db[_0xd0a6('0x9a')]=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0x9b'));db['Variable']=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x9c'));db['Integration']=db[_0xd0a6('0x3')][_0xd0a6('0x14')]('../api/integration/integration.model');db[_0xd0a6('0x9d')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x9e'));db[_0xd0a6('0x9f')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')]('../api/analyticCustomReport/analyticCustomReport.model');db['AnalyticDefaultReport']=db['sequelize']['import'](_0xd0a6('0xa0'));db[_0xd0a6('0xa1')]=db['sequelize'][_0xd0a6('0x14')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0xd0a6('0xa2')]=db[_0xd0a6('0x3')]['import'](_0xd0a6('0xa3'));db[_0xd0a6('0xa4')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xa5'));db[_0xd0a6('0xa6')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0xd0a6('0xa7')]=db['sequelize']['import'](_0xd0a6('0xa8'));db[_0xd0a6('0xa9')]=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0xaa'));db[_0xd0a6('0xab')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xac'));db[_0xd0a6('0xad')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xae'));db['SugarcrmConfiguration']=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xaf'));db[_0xd0a6('0xb0')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xb1'));db[_0xd0a6('0xb2')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xb3'));db['DeskConfiguration']=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xb4'));db[_0xd0a6('0xb5')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xb6'));db[_0xd0a6('0xb7')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xb8'));db[_0xd0a6('0xb9')]=db[_0xd0a6('0x3')]['import']('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0xd0a6('0xba')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xbb'));db[_0xd0a6('0xbc')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xbd'));db[_0xd0a6('0xbe')]=db[_0xd0a6('0x3')]['import']('../api/intZendeskConfiguration/intZendeskConfiguration.model');db['ZendeskField']=db[_0xd0a6('0x3')][_0xd0a6('0x14')]('../api/intZendeskField/intZendeskField.model');db[_0xd0a6('0xbf')]=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0xc0'));db[_0xd0a6('0xc1')]=db[_0xd0a6('0x3')]['import'](_0xd0a6('0xc2'));db[_0xd0a6('0xc3')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0xd0a6('0xc4')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0xd0a6('0xc5')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xc6'));db[_0xd0a6('0xc7')]=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0xc8'));db[_0xd0a6('0xc9')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xca'));db['ServicenowConfiguration']=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xcb'));db[_0xd0a6('0xcc')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xcd'));db[_0xd0a6('0xce')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0xd0a6('0xcf')]=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0xd0'));db[_0xd0a6('0xd1')]=db[_0xd0a6('0x3')]['import']('../api/intDynamics365Field/intDynamics365Field.model');db['FreshsalesAccount']=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xd2'));db[_0xd0a6('0xd3')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xd4'));db[_0xd0a6('0xd5')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0xd0a6('0xd6')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xd7'));db[_0xd0a6('0xd8')]=db['sequelize'][_0xd0a6('0x14')]('../api/network/network.model');db[_0xd0a6('0xd9')]=db[_0xd0a6('0x3')]['import'](_0xd0a6('0xda'));db[_0xd0a6('0xdb')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0xd0a6('0xdc')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xdd'));db[_0xd0a6('0xde')]=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0xdf'));db[_0xd0a6('0xe0')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0xd0a6('0xe1')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')]('../api/smsQueueReport/smsQueueReport.model');db[_0xd0a6('0xe2')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xe3'));db[_0xd0a6('0xe4')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xe5'));db[_0xd0a6('0xe6')]=db['sequelize']['import'](_0xd0a6('0xe7'));db['Setting']=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0xe8'));db[_0xd0a6('0xe9')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xea'));db[_0xd0a6('0xeb')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xec'));db[_0xd0a6('0xed')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xee'));db[_0xd0a6('0xef')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')]('../api/squareMessage/squareMessage.model');db['Team']=db[_0xd0a6('0x3')][_0xd0a6('0x14')]('../api/team/team.model');db[_0xd0a6('0xf0')]=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0xf1'));db[_0xd0a6('0xf2')]=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0xf3'));db['Migration']=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xf4'));db[_0xd0a6('0xf5')]=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0xf6'));db['Plugin']=db[_0xd0a6('0x3')][_0xd0a6('0x14')]('../api/plugin/plugin.model');db['MailTransferReport']=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xf7'));db[_0xd0a6('0xf8')]=db[_0xd0a6('0x3')]['import']('../api/chatTransferReport/chatTransferReport.model');db[_0xd0a6('0xf9')]=db['sequelize']['import'](_0xd0a6('0xfa'));db[_0xd0a6('0xfb')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0xfc'));db[_0xd0a6('0xfd')]=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0xfe'));db['CmList']=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0xff'));db[_0xd0a6('0x100')]=db[_0xd0a6('0x3')][_0xd0a6('0x14')](_0xd0a6('0x101'));db[_0xd0a6('0x102')]=db['sequelize'][_0xd0a6('0x14')](_0xd0a6('0x103'));db[_0xd0a6('0x104')]=db[_0xd0a6('0x3')]['import'](_0xd0a6('0x105'));db[_0xd0a6('0x106')]=db['sequelize'][_0xd0a6('0x14')]('../api/userProfileResource/userProfileResource.model');db[_0xd0a6('0x13')][_0xd0a6('0x107')](db[_0xd0a6('0x22')],{'as':'VoiceMail','onDelete':_0xd0a6('0x108'),'foreignKey':_0xd0a6('0x109')});db[_0xd0a6('0x13')]['hasMany'](db[_0xd0a6('0x10a')],{'as':_0xd0a6('0x10b'),'foreignKey':'UserId'});db[_0xd0a6('0x13')]['hasMany'](db[_0xd0a6('0x30')],{'as':_0xd0a6('0x10c'),'foreignKey':_0xd0a6('0x109')});db['User'][_0xd0a6('0x10d')](db[_0xd0a6('0x1a')],{'as':_0xd0a6('0x10e'),'onDelete':'cascade','hooks':!![]});db[_0xd0a6('0x13')][_0xd0a6('0x10d')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':'UserId'});db[_0xd0a6('0x13')][_0xd0a6('0x10d')](db[_0xd0a6('0x81')],{'as':_0xd0a6('0x10f'),'foreignKey':'UserId'});db[_0xd0a6('0x13')][_0xd0a6('0x10d')](db[_0xd0a6('0x83')],{'as':_0xd0a6('0x83'),'foreignKey':_0xd0a6('0x109')});db[_0xd0a6('0x13')]['hasMany'](db['OpenchannelInteraction'],{'as':_0xd0a6('0x110'),'foreignKey':'UserId'});db['User'][_0xd0a6('0x10d')](db['ChatInteraction'],{'as':_0xd0a6('0x111'),'foreignKey':_0xd0a6('0x109')});db[_0xd0a6('0x13')]['hasMany'](db['SmsInteraction'],{'as':_0xd0a6('0x112'),'foreignKey':_0xd0a6('0x109')});db[_0xd0a6('0x13')]['hasMany'](db[_0xd0a6('0x113')],{'as':_0xd0a6('0x114'),'foreignKey':'UserId'});db['User'][_0xd0a6('0x10d')](db['MailInteraction'],{'as':'MailInteractions','foreignKey':_0xd0a6('0x109')});db['User'][_0xd0a6('0x115')](db[_0xd0a6('0x102')],{'as':_0xd0a6('0x102'),'foreignKey':_0xd0a6('0x116')});db[_0xd0a6('0x13')][_0xd0a6('0x117')](db[_0xd0a6('0x73')],{'as':'Groups','through':_0xd0a6('0x118')});db['User'][_0xd0a6('0x117')](db['CmContact'],{'as':_0xd0a6('0x119'),'through':'cm_user_has_contacts'});db['User']['belongsToMany'](db['CmList'],{'as':_0xd0a6('0x11a'),'through':'cm_user_has_lists'});db['User'][_0xd0a6('0x117')](db[_0xd0a6('0x11b')],{'through':_0xd0a6('0x11c')});db[_0xd0a6('0x13')][_0xd0a6('0x117')](db[_0xd0a6('0x43')],{'as':_0xd0a6('0x11d'),'through':_0xd0a6('0x11e')});db['User']['belongsToMany'](db[_0xd0a6('0x6c')],{'as':_0xd0a6('0x111'),'through':_0xd0a6('0x11f')});db['User']['belongsToMany'](db['FaxInteraction'],{'as':_0xd0a6('0x114'),'through':_0xd0a6('0x120')});db[_0xd0a6('0x13')][_0xd0a6('0x117')](db['SmsInteraction'],{'as':_0xd0a6('0x112'),'through':_0xd0a6('0x121')});db[_0xd0a6('0x13')][_0xd0a6('0x117')](db['OpenchannelInteraction'],{'as':_0xd0a6('0x110'),'through':_0xd0a6('0x122')});db[_0xd0a6('0x13')][_0xd0a6('0x117')](db[_0xd0a6('0x1d')],{'as':_0xd0a6('0x123'),'through':_0xd0a6('0x31'),'required':![]});db[_0xd0a6('0x13')][_0xd0a6('0x117')](db[_0xd0a6('0x124')],{'as':_0xd0a6('0x125'),'through':_0xd0a6('0x35'),'required':![]});db[_0xd0a6('0x13')][_0xd0a6('0x117')](db[_0xd0a6('0x71')],{'as':_0xd0a6('0x126'),'through':_0xd0a6('0x33'),'required':![],'hooks':!![]});db[_0xd0a6('0x13')]['belongsToMany'](db[_0xd0a6('0x52')],{'as':_0xd0a6('0x127'),'through':_0xd0a6('0x37'),'required':![]});db[_0xd0a6('0x13')]['belongsToMany'](db['SmsQueue'],{'as':_0xd0a6('0x128'),'through':_0xd0a6('0x129'),'required':![]});db['User'][_0xd0a6('0x117')](db[_0xd0a6('0x66')],{'as':'OpenchannelQueues','through':_0xd0a6('0x3a'),'required':![]});db['User']['belongsToMany'](db[_0xd0a6('0x12a')],{'through':'cm_user_has_lists'});db['User'][_0xd0a6('0x117')](db[_0xd0a6('0x100')],{'as':_0xd0a6('0x12b'),'through':_0xd0a6('0x12c'),'required':![]});db[_0xd0a6('0x13')][_0xd0a6('0x117')](db[_0xd0a6('0x68')],{'as':_0xd0a6('0x12d'),'through':_0xd0a6('0x12e')});db['User'][_0xd0a6('0x117')](db[_0xd0a6('0x4e')],{'as':_0xd0a6('0x12f'),'through':_0xd0a6('0x130')});db[_0xd0a6('0x13')][_0xd0a6('0x117')](db['MailAccount'],{'as':_0xd0a6('0x131'),'through':_0xd0a6('0x132')});db['User'][_0xd0a6('0x117')](db[_0xd0a6('0x60')],{'as':'OpenchannelAccounts','through':_0xd0a6('0x133')});db[_0xd0a6('0x13')]['belongsToMany'](db[_0xd0a6('0x56')],{'as':'SmsAccounts','through':'user_has_sms_accounts'});db[_0xd0a6('0x13')]['belongsToMany'](db['SquareProject'],{'as':'SquareProjects','through':_0xd0a6('0x134')});db['VoiceChanSpy']['hasMany'](db['VoiceExtension'],{'as':'SpiedAgents','onDelete':_0xd0a6('0x108'),'foreignKey':_0xd0a6('0x135')});db[_0xd0a6('0x18')]['hasMany'](db[_0xd0a6('0x1a')],{'onDelete':_0xd0a6('0x108')});db[_0xd0a6('0x1a')][_0xd0a6('0x10d')](db[_0xd0a6('0x1a')],{'as':'Applications','onDelete':_0xd0a6('0x108')});db[_0xd0a6('0x1b')][_0xd0a6('0x117')](db[_0xd0a6('0x136')],{'as':_0xd0a6('0x137'),'through':_0xd0a6('0x138')});db[_0xd0a6('0x1d')][_0xd0a6('0x10d')](db[_0xd0a6('0x30')],{'as':_0xd0a6('0x139'),'foreignKey':_0xd0a6('0x13a')});db['VoiceQueue']['hasMany'](db[_0xd0a6('0x7b')],{'as':'Hoppers','foreignKey':_0xd0a6('0x13a')});db[_0xd0a6('0x1d')][_0xd0a6('0x10d')](db[_0xd0a6('0x7f')],{'as':'HopperFinals','foreignKey':_0xd0a6('0x13a')});db['VoiceQueue'][_0xd0a6('0x10d')](db[_0xd0a6('0x81')],{'as':_0xd0a6('0x13b'),'foreignKey':_0xd0a6('0x13a')});db['VoiceQueue'][_0xd0a6('0x10d')](db[_0xd0a6('0x83')],{'as':_0xd0a6('0x83'),'foreignKey':_0xd0a6('0x13a')});db[_0xd0a6('0x1d')][_0xd0a6('0x10d')](db[_0xd0a6('0x7d')],{'as':_0xd0a6('0x13c'),'foreignKey':_0xd0a6('0x13a')});db[_0xd0a6('0x1d')][_0xd0a6('0x10d')](db[_0xd0a6('0xe0')],{'as':_0xd0a6('0x13d'),'foreignKey':_0xd0a6('0x13a')});db[_0xd0a6('0x1d')]['belongsTo'](db[_0xd0a6('0x2d')],{'as':_0xd0a6('0x2d'),'foreignKey':_0xd0a6('0x13e')});db['VoiceQueue'][_0xd0a6('0x115')](db[_0xd0a6('0x2d')],{'as':_0xd0a6('0x13f'),'foreignKey':_0xd0a6('0x140')});db[_0xd0a6('0x1d')][_0xd0a6('0x115')](db['Interval'],{'as':_0xd0a6('0x8f'),'foreignKey':_0xd0a6('0x141')});db[_0xd0a6('0x1d')][_0xd0a6('0x115')](db[_0xd0a6('0x142')],{'as':_0xd0a6('0x143'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xd0a6('0x1d')][_0xd0a6('0x117')](db[_0xd0a6('0x12a')],{'as':'Lists','through':_0xd0a6('0x144')});db['VoiceQueue']['belongsToMany'](db[_0xd0a6('0x13')],{'as':'Agents','through':'UserVoiceQueue'});db['VoiceQueue'][_0xd0a6('0x117')](db[_0xd0a6('0x11b')],{'as':_0xd0a6('0x145'),'through':_0xd0a6('0x146')});db[_0xd0a6('0x1d')][_0xd0a6('0x117')](db['CmList'],{'as':_0xd0a6('0x147'),'through':_0xd0a6('0x148')});db['VoiceRecording']['belongsTo'](db[_0xd0a6('0x13')],{'as':_0xd0a6('0x13'),'foreignKey':_0xd0a6('0x109')});db[_0xd0a6('0x20')]['belongsTo'](db[_0xd0a6('0x13')],{'as':'User','foreignKey':_0xd0a6('0x109')});db[_0xd0a6('0x22')]['hasMany'](db['VoiceMailMessage'],{'as':_0xd0a6('0x149'),'onDelete':_0xd0a6('0x108'),'foreignKey':_0xd0a6('0x14a'),'sourceKey':_0xd0a6('0x14b')});db[_0xd0a6('0x24')][_0xd0a6('0x115')](db['VoiceMail'],{'foreignKey':_0xd0a6('0x14a'),'targetKey':_0xd0a6('0x14b')});db[_0xd0a6('0x26')][_0xd0a6('0x10d')](db['VoiceQueueReport'],{'as':_0xd0a6('0x14c'),'foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport'][_0xd0a6('0x10d')](db['VoiceAgentReport'],{'as':_0xd0a6('0x14d'),'foreignKey':_0xd0a6('0x14e'),'constraints':![]});db[_0xd0a6('0x26')][_0xd0a6('0x115')](db[_0xd0a6('0x13')],{'as':_0xd0a6('0x13'),'foreignKey':'UserId'});db['VoiceCallReport'][_0xd0a6('0x115')](db[_0xd0a6('0x79')],{'as':_0xd0a6('0x14f'),'foreignKey':_0xd0a6('0x150')});db[_0xd0a6('0x3c')][_0xd0a6('0x115')](db[_0xd0a6('0x151')],{'as':_0xd0a6('0x151'),'foreignKey':_0xd0a6('0x152')});db['MailServerOut'][_0xd0a6('0x115')](db[_0xd0a6('0x151')],{'as':_0xd0a6('0x151'),'foreignKey':_0xd0a6('0x152')});db['MailAccount'][_0xd0a6('0x107')](db[_0xd0a6('0x3c')],{'as':_0xd0a6('0x153'),'onDelete':_0xd0a6('0x108')});db[_0xd0a6('0x151')][_0xd0a6('0x107')](db[_0xd0a6('0x3e')],{'as':_0xd0a6('0x154'),'onDelete':_0xd0a6('0x108')});db['MailAccount']['hasMany'](db[_0xd0a6('0x155')],{'as':_0xd0a6('0x156'),'foreignKey':_0xd0a6('0x152')});db['MailAccount'][_0xd0a6('0x10d')](db[_0xd0a6('0x8a')],{'as':_0xd0a6('0x157'),'foreignKey':_0xd0a6('0x152')});db[_0xd0a6('0x151')][_0xd0a6('0x10d')](db['MailMessage'],{'as':'Messages','foreignKey':_0xd0a6('0x152')});db[_0xd0a6('0x151')][_0xd0a6('0x10d')](db[_0xd0a6('0x43')],{'as':_0xd0a6('0x158')});db[_0xd0a6('0x151')]['hasMany'](db[_0xd0a6('0x47')],{'as':_0xd0a6('0x159')});db[_0xd0a6('0x151')]['belongsTo'](db[_0xd0a6('0x12a')],{'as':'List','foreignKey':_0xd0a6('0x15a')});db[_0xd0a6('0x151')][_0xd0a6('0x115')](db[_0xd0a6('0x98')],{'as':_0xd0a6('0x98'),'foreignKey':_0xd0a6('0x15b')});db[_0xd0a6('0x151')][_0xd0a6('0x115')](db['Pause'],{'as':_0xd0a6('0x143'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xd0a6('0x151')][_0xd0a6('0x117')](db[_0xd0a6('0x13')],{'as':'Agents','through':'user_has_mail_accounts'});db['MailQueue'][_0xd0a6('0x117')](db[_0xd0a6('0x13')],{'as':_0xd0a6('0x15c'),'through':_0xd0a6('0x35')});db[_0xd0a6('0x124')]['belongsToMany'](db[_0xd0a6('0x11b')],{'through':_0xd0a6('0x15d'),'as':'Teams'});db['MailInteraction'][_0xd0a6('0x10d')](db[_0xd0a6('0x45')],{'as':_0xd0a6('0x149'),'onDelete':_0xd0a6('0x108'),'foreignKey':_0xd0a6('0x15e')});db[_0xd0a6('0x43')]['belongsTo'](db[_0xd0a6('0x151')],{'as':_0xd0a6('0x15f'),'foreignKey':_0xd0a6('0x152')});db[_0xd0a6('0x43')][_0xd0a6('0x115')](db['CmContact'],{'as':_0xd0a6('0x14f'),'foreignKey':'ContactId'});db[_0xd0a6('0x43')][_0xd0a6('0x115')](db[_0xd0a6('0x13')],{'as':_0xd0a6('0x160'),'foreignKey':'UserId'});db[_0xd0a6('0x43')][_0xd0a6('0x117')](db['Tag'],{'through':_0xd0a6('0x161'),'as':_0xd0a6('0x162')});db[_0xd0a6('0x43')][_0xd0a6('0x117')](db['Tag'],{'through':'mail_interaction_has_tags','as':_0xd0a6('0x163')});db[_0xd0a6('0x43')][_0xd0a6('0x117')](db[_0xd0a6('0x13')],{'as':_0xd0a6('0x164'),'through':_0xd0a6('0x11e'),'foreignKey':_0xd0a6('0x15e')});db[_0xd0a6('0x45')]['hasMany'](db['Attachment'],{'as':_0xd0a6('0x165'),'onDelete':_0xd0a6('0x108')});db[_0xd0a6('0x45')]['belongsTo'](db[_0xd0a6('0x13')],{'as':'User'});db[_0xd0a6('0x45')][_0xd0a6('0x115')](db[_0xd0a6('0x79')],{'onDelete':_0xd0a6('0x108'),'as':_0xd0a6('0x14f')});db['MailMessage'][_0xd0a6('0x115')](db[_0xd0a6('0x43')],{'as':_0xd0a6('0x166'),'foreignKey':_0xd0a6('0x15e')});db[_0xd0a6('0x45')][_0xd0a6('0x115')](db[_0xd0a6('0x151')],{'as':_0xd0a6('0x15f'),'foreignKey':_0xd0a6('0x152')});db['MailApplication']['belongsTo'](db[_0xd0a6('0x13')],{'onDelete':'restrict'});db['MailApplication']['belongsTo'](db[_0xd0a6('0x124')],{'onDelete':_0xd0a6('0x167')});db[_0xd0a6('0x47')][_0xd0a6('0x115')](db['MailAccount'],{'onDelete':'restrict'});db['MailApplication'][_0xd0a6('0x115')](db['Interval'],{'onDelete':_0xd0a6('0x167'),'foreignKey':'IntervalId'});db['MailApplication'][_0xd0a6('0x115')](db[_0xd0a6('0x96')],{'onDelete':_0xd0a6('0x167'),'foreignKey':_0xd0a6('0x168')});db[_0xd0a6('0x49')]['belongsTo'](db['MailAccount'],{});db[_0xd0a6('0x49')][_0xd0a6('0x115')](db[_0xd0a6('0x12a')],{'as':_0xd0a6('0x169'),'foreignKey':_0xd0a6('0x15a')});db[_0xd0a6('0x49')]['belongsTo'](db[_0xd0a6('0x79')],{'as':_0xd0a6('0x14f'),'foreignKey':_0xd0a6('0x150')});db[_0xd0a6('0x49')]['belongsTo'](db[_0xd0a6('0x43')],{});db[_0xd0a6('0x49')]['belongsTo'](db[_0xd0a6('0x45')],{});db['MailQueueReport']['belongsTo'](db[_0xd0a6('0x13')],{});db[_0xd0a6('0x49')][_0xd0a6('0x115')](db['MailQueue'],{});db[_0xd0a6('0x16a')][_0xd0a6('0x10d')](db[_0xd0a6('0x4c')],{'as':_0xd0a6('0x16b'),'onDelete':_0xd0a6('0x108')});db[_0xd0a6('0x4e')][_0xd0a6('0x10d')](db[_0xd0a6('0x155')],{'as':_0xd0a6('0x156'),'foreignKey':_0xd0a6('0x16c')});db[_0xd0a6('0x4e')][_0xd0a6('0x10d')](db['CannedAnswer'],{'as':_0xd0a6('0x157'),'foreignKey':_0xd0a6('0x16c')});db[_0xd0a6('0x4e')]['hasMany'](db[_0xd0a6('0x113')],{'as':_0xd0a6('0x158')});db[_0xd0a6('0x4e')][_0xd0a6('0x10d')](db[_0xd0a6('0x4f')],{'as':_0xd0a6('0x159')});db[_0xd0a6('0x4e')]['hasMany'](db[_0xd0a6('0x1a')],{'as':_0xd0a6('0x16d'),'onDelete':_0xd0a6('0x108')});db[_0xd0a6('0x4e')][_0xd0a6('0x10d')](db[_0xd0a6('0x51')],{'as':_0xd0a6('0x149')});db[_0xd0a6('0x4e')][_0xd0a6('0x115')](db[_0xd0a6('0x2d')],{'as':'Trunk'});db[_0xd0a6('0x4e')][_0xd0a6('0x115')](db[_0xd0a6('0x12a')],{'as':'List','foreignKey':'ListId'});db[_0xd0a6('0x4e')]['belongsTo'](db[_0xd0a6('0x142')],{'as':_0xd0a6('0x143'),'foreignKey':_0xd0a6('0x16e')});db[_0xd0a6('0x4e')][_0xd0a6('0x117')](db[_0xd0a6('0x13')],{'as':'Agents','through':_0xd0a6('0x130')});db[_0xd0a6('0x4f')][_0xd0a6('0x115')](db[_0xd0a6('0x13')],{'onDelete':'restrict'});db[_0xd0a6('0x4f')]['belongsTo'](db[_0xd0a6('0x52')],{'onDelete':_0xd0a6('0x167')});db[_0xd0a6('0x4f')][_0xd0a6('0x115')](db[_0xd0a6('0x4e')],{'onDelete':_0xd0a6('0x167')});db[_0xd0a6('0x4f')][_0xd0a6('0x115')](db[_0xd0a6('0x96')],{'onDelete':_0xd0a6('0x167'),'foreignKey':'TagId'});db[_0xd0a6('0x113')]['hasMany'](db[_0xd0a6('0x51')],{'as':'Messages','onDelete':_0xd0a6('0x108'),'foreignKey':'FaxInteractionId'});db[_0xd0a6('0x113')][_0xd0a6('0x115')](db['FaxAccount'],{'as':_0xd0a6('0x15f'),'foreignKey':_0xd0a6('0x16c')});db[_0xd0a6('0x113')][_0xd0a6('0x115')](db[_0xd0a6('0x79')],{'as':_0xd0a6('0x14f'),'foreignKey':_0xd0a6('0x150')});db[_0xd0a6('0x113')][_0xd0a6('0x115')](db[_0xd0a6('0x13')],{'as':'Owner','foreignKey':_0xd0a6('0x109')});db[_0xd0a6('0x113')][_0xd0a6('0x117')](db[_0xd0a6('0x96')],{'through':'fax_interaction_has_tags','as':_0xd0a6('0x162')});db['FaxInteraction'][_0xd0a6('0x117')](db[_0xd0a6('0x96')],{'through':_0xd0a6('0x16f'),'as':_0xd0a6('0x163')});db['FaxInteraction']['belongsToMany'](db['User'],{'as':_0xd0a6('0x164'),'through':_0xd0a6('0x120'),'foreignKey':_0xd0a6('0x170')});db[_0xd0a6('0x51')][_0xd0a6('0x115')](db[_0xd0a6('0x13')],{'onDelete':_0xd0a6('0x108'),'as':_0xd0a6('0x13')});db[_0xd0a6('0x51')][_0xd0a6('0x115')](db[_0xd0a6('0x113')],{'as':_0xd0a6('0x166'),'foreignKey':'FaxInteractionId'});db[_0xd0a6('0x51')][_0xd0a6('0x115')](db['CmContact'],{'onDelete':_0xd0a6('0x108'),'as':'Contact'});db[_0xd0a6('0x51')][_0xd0a6('0x115')](db[_0xd0a6('0xf5')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0xd0a6('0x51')][_0xd0a6('0x115')](db[_0xd0a6('0x4e')],{'as':_0xd0a6('0x15f'),'foreignKey':_0xd0a6('0x16c')});db['FaxQueue'][_0xd0a6('0x117')](db[_0xd0a6('0x13')],{'as':_0xd0a6('0x15c'),'through':_0xd0a6('0x37')});db[_0xd0a6('0x52')]['belongsToMany'](db['Team'],{'through':_0xd0a6('0x171'),'as':_0xd0a6('0x145')});db[_0xd0a6('0x54')][_0xd0a6('0x115')](db[_0xd0a6('0x4e')],{});db[_0xd0a6('0x54')][_0xd0a6('0x115')](db[_0xd0a6('0x12a')],{'as':_0xd0a6('0x169'),'foreignKey':'ListId'});db['FaxQueueReport']['belongsTo'](db[_0xd0a6('0x79')],{'as':_0xd0a6('0x14f'),'foreignKey':_0xd0a6('0x150')});db[_0xd0a6('0x54')][_0xd0a6('0x115')](db['FaxInteraction'],{});db['FaxQueueReport'][_0xd0a6('0x115')](db[_0xd0a6('0x51')],{});db[_0xd0a6('0x54')][_0xd0a6('0x115')](db[_0xd0a6('0x13')],{});db[_0xd0a6('0x54')]['belongsTo'](db[_0xd0a6('0x52')],{});db[_0xd0a6('0x56')][_0xd0a6('0x10d')](db[_0xd0a6('0x155')],{'as':_0xd0a6('0x156'),'foreignKey':_0xd0a6('0x172')});db[_0xd0a6('0x56')][_0xd0a6('0x10d')](db[_0xd0a6('0x8a')],{'as':_0xd0a6('0x157'),'foreignKey':_0xd0a6('0x172')});db[_0xd0a6('0x56')][_0xd0a6('0x10d')](db[_0xd0a6('0x5c')],{'as':_0xd0a6('0x149'),'foreignKey':_0xd0a6('0x172')});db[_0xd0a6('0x56')][_0xd0a6('0x10d')](db[_0xd0a6('0x5a')],{'as':_0xd0a6('0x158')});db[_0xd0a6('0x56')][_0xd0a6('0x10d')](db[_0xd0a6('0x58')],{'as':_0xd0a6('0x159')});db[_0xd0a6('0x56')][_0xd0a6('0x115')](db[_0xd0a6('0x12a')],{'as':_0xd0a6('0x169'),'foreignKey':_0xd0a6('0x15a')});db[_0xd0a6('0x56')][_0xd0a6('0x115')](db[_0xd0a6('0x142')],{'as':_0xd0a6('0x143'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xd0a6('0x56')][_0xd0a6('0x117')](db['User'],{'as':'Agents','through':_0xd0a6('0x173')});db[_0xd0a6('0x58')][_0xd0a6('0x115')](db[_0xd0a6('0x13')],{'onDelete':_0xd0a6('0x167')});db[_0xd0a6('0x58')][_0xd0a6('0x115')](db[_0xd0a6('0x5e')],{'onDelete':_0xd0a6('0x167')});db[_0xd0a6('0x58')]['belongsTo'](db[_0xd0a6('0x56')],{'onDelete':_0xd0a6('0x167')});db[_0xd0a6('0x58')][_0xd0a6('0x115')](db[_0xd0a6('0x8f')],{'onDelete':_0xd0a6('0x167'),'foreignKey':_0xd0a6('0x141')});db[_0xd0a6('0x58')][_0xd0a6('0x115')](db['Tag'],{'onDelete':_0xd0a6('0x167'),'foreignKey':_0xd0a6('0x168')});db[_0xd0a6('0x5a')][_0xd0a6('0x10d')](db[_0xd0a6('0x5c')],{'as':_0xd0a6('0x149'),'onDelete':'cascade','foreignKey':'SmsInteractionId'});db[_0xd0a6('0x5a')][_0xd0a6('0x115')](db[_0xd0a6('0x56')],{'as':'Account','foreignKey':_0xd0a6('0x172')});db['SmsInteraction'][_0xd0a6('0x115')](db[_0xd0a6('0x79')],{'as':_0xd0a6('0x14f'),'foreignKey':_0xd0a6('0x150')});db[_0xd0a6('0x5a')]['belongsTo'](db['User'],{'as':_0xd0a6('0x160'),'foreignKey':_0xd0a6('0x109')});db[_0xd0a6('0x5a')][_0xd0a6('0x117')](db[_0xd0a6('0x96')],{'through':_0xd0a6('0x174'),'as':_0xd0a6('0x162')});db[_0xd0a6('0x5a')][_0xd0a6('0x117')](db[_0xd0a6('0x96')],{'through':'sms_interaction_has_tags','as':_0xd0a6('0x163')});db[_0xd0a6('0x5a')]['belongsToMany'](db[_0xd0a6('0x13')],{'as':'Users','through':_0xd0a6('0x121'),'foreignKey':_0xd0a6('0x175')});db[_0xd0a6('0x5c')][_0xd0a6('0x115')](db['User'],{'as':_0xd0a6('0x13')});db[_0xd0a6('0x5c')][_0xd0a6('0x115')](db[_0xd0a6('0x79')],{'onDelete':_0xd0a6('0x108'),'as':_0xd0a6('0x14f')});db[_0xd0a6('0x5c')][_0xd0a6('0x115')](db['SmsInteraction'],{'onDelete':_0xd0a6('0x108'),'as':_0xd0a6('0x166'),'foreignKey':_0xd0a6('0x175')});db[_0xd0a6('0x5c')][_0xd0a6('0x115')](db[_0xd0a6('0x56')],{'as':'Account','foreignKey':_0xd0a6('0x172')});db[_0xd0a6('0x5e')][_0xd0a6('0x117')](db[_0xd0a6('0x13')],{'as':_0xd0a6('0x15c'),'through':'UserSmsQueue','foreignKey':_0xd0a6('0x176')});db[_0xd0a6('0x5e')][_0xd0a6('0x117')](db[_0xd0a6('0x11b')],{'through':_0xd0a6('0x177'),'as':_0xd0a6('0x145')});db[_0xd0a6('0x60')][_0xd0a6('0x10d')](db[_0xd0a6('0x155')],{'as':_0xd0a6('0x156'),'foreignKey':_0xd0a6('0x178')});db[_0xd0a6('0x60')][_0xd0a6('0x10d')](db[_0xd0a6('0x8a')],{'as':'Answers','foreignKey':'OpenchannelAccountId'});db[_0xd0a6('0x60')][_0xd0a6('0x10d')](db[_0xd0a6('0x64')],{'as':'Interactions','foreignKey':_0xd0a6('0x178')});db[_0xd0a6('0x60')][_0xd0a6('0x10d')](db[_0xd0a6('0x65')],{'as':_0xd0a6('0x149'),'foreignKey':_0xd0a6('0x178')});db[_0xd0a6('0x60')][_0xd0a6('0x10d')](db[_0xd0a6('0x62')],{'as':_0xd0a6('0x159'),'foreignKey':_0xd0a6('0x178')});db['OpenchannelAccount'][_0xd0a6('0x115')](db[_0xd0a6('0x12a')],{'as':_0xd0a6('0x169'),'foreignKey':_0xd0a6('0x15a')});db[_0xd0a6('0x60')]['belongsTo'](db['Pause'],{'as':_0xd0a6('0x143'),'foreignKey':_0xd0a6('0x16e')});db[_0xd0a6('0x60')][_0xd0a6('0x117')](db['User'],{'as':_0xd0a6('0x15c'),'through':_0xd0a6('0x133')});db[_0xd0a6('0x62')][_0xd0a6('0x115')](db[_0xd0a6('0x13')],{'onDelete':_0xd0a6('0x167')});db[_0xd0a6('0x62')]['belongsTo'](db[_0xd0a6('0x66')],{'onDelete':_0xd0a6('0x167'),'foreignKey':_0xd0a6('0x179')});db[_0xd0a6('0x62')][_0xd0a6('0x115')](db[_0xd0a6('0x60')],{'onDelete':_0xd0a6('0x167'),'foreignKey':_0xd0a6('0x178')});db[_0xd0a6('0x62')][_0xd0a6('0x115')](db['Interval'],{'onDelete':_0xd0a6('0x167'),'foreignKey':_0xd0a6('0x141')});db[_0xd0a6('0x62')]['belongsTo'](db['Tag'],{'onDelete':_0xd0a6('0x167'),'foreignKey':'TagId'});db[_0xd0a6('0x64')][_0xd0a6('0x10d')](db[_0xd0a6('0x65')],{'as':_0xd0a6('0x149'),'onDelete':_0xd0a6('0x108'),'foreignKey':_0xd0a6('0x17a')});db[_0xd0a6('0x64')][_0xd0a6('0x115')](db[_0xd0a6('0x60')],{'as':_0xd0a6('0x15f'),'foreignKey':_0xd0a6('0x178')});db[_0xd0a6('0x64')][_0xd0a6('0x115')](db[_0xd0a6('0x79')],{'as':_0xd0a6('0x14f'),'foreignKey':_0xd0a6('0x150')});db[_0xd0a6('0x64')][_0xd0a6('0x115')](db['User'],{'as':'Owner','foreignKey':_0xd0a6('0x109')});db[_0xd0a6('0x64')][_0xd0a6('0x117')](db[_0xd0a6('0x96')],{'through':_0xd0a6('0x17b'),'as':_0xd0a6('0x162')});db[_0xd0a6('0x64')][_0xd0a6('0x117')](db[_0xd0a6('0x96')],{'through':_0xd0a6('0x17b'),'as':_0xd0a6('0x163')});db[_0xd0a6('0x64')]['belongsToMany'](db[_0xd0a6('0x13')],{'as':_0xd0a6('0x164'),'through':'user_has_openchannel_interactions','foreignKey':_0xd0a6('0x17a')});db['OpenchannelMessage']['belongsTo'](db[_0xd0a6('0x13')],{'onDelete':_0xd0a6('0x108'),'as':_0xd0a6('0x13')});db[_0xd0a6('0x65')]['belongsTo'](db[_0xd0a6('0x79')],{'onDelete':'cascade','as':_0xd0a6('0x14f')});db[_0xd0a6('0x65')]['belongsTo'](db['OpenchannelInteraction'],{'onDelete':_0xd0a6('0x108'),'as':_0xd0a6('0x166'),'foreignKey':_0xd0a6('0x17a')});db[_0xd0a6('0x65')][_0xd0a6('0x115')](db[_0xd0a6('0xf5')],{'as':_0xd0a6('0xf5'),'foreignKey':'AttachmentId'});db['OpenchannelMessage'][_0xd0a6('0x115')](db[_0xd0a6('0x60')],{'as':_0xd0a6('0x15f'),'foreignKey':_0xd0a6('0x178')});db[_0xd0a6('0x66')][_0xd0a6('0x117')](db['User'],{'as':_0xd0a6('0x15c'),'through':_0xd0a6('0x3a'),'foreignKey':'OpenchannelQueueId'});db[_0xd0a6('0x66')]['belongsToMany'](db[_0xd0a6('0x11b')],{'through':_0xd0a6('0x17c'),'as':'Teams'});db[_0xd0a6('0x68')][_0xd0a6('0x10d')](db['Disposition'],{'as':_0xd0a6('0x156'),'foreignKey':'ChatWebsiteId'});db['ChatWebsite'][_0xd0a6('0x10d')](db[_0xd0a6('0x8a')],{'as':_0xd0a6('0x157'),'foreignKey':_0xd0a6('0x17d')});db[_0xd0a6('0x68')][_0xd0a6('0x10d')](db[_0xd0a6('0x75')],{'as':'ProactiveActions'});db[_0xd0a6('0x68')][_0xd0a6('0x10d')](db[_0xd0a6('0x6c')],{'as':'Interactions'});db[_0xd0a6('0x68')]['hasMany'](db['ChatApplication'],{'as':_0xd0a6('0x159')});db[_0xd0a6('0x68')][_0xd0a6('0x10d')](db['ChatMessage'],{'as':_0xd0a6('0x149')});db[_0xd0a6('0x68')][_0xd0a6('0x115')](db[_0xd0a6('0x12a')],{'as':_0xd0a6('0x169'),'foreignKey':'ListId'});db[_0xd0a6('0x68')][_0xd0a6('0x115')](db[_0xd0a6('0x8f')],{'as':_0xd0a6('0x8f'),'foreignKey':_0xd0a6('0x141')});db[_0xd0a6('0x68')]['belongsTo'](db[_0xd0a6('0x142')],{'as':'mandatoryDispositionPause','foreignKey':_0xd0a6('0x16e')});db[_0xd0a6('0x68')]['belongsToMany'](db[_0xd0a6('0x13')],{'as':'Agents','through':_0xd0a6('0x12e')});db[_0xd0a6('0x17e')][_0xd0a6('0x115')](db[_0xd0a6('0x60')],{});db[_0xd0a6('0x17e')][_0xd0a6('0x115')](db[_0xd0a6('0x12a')],{'as':_0xd0a6('0x169'),'foreignKey':'ListId'});db[_0xd0a6('0x17e')][_0xd0a6('0x115')](db[_0xd0a6('0x79')],{'as':_0xd0a6('0x14f'),'foreignKey':_0xd0a6('0x150')});db['OpenchannelQueueReport'][_0xd0a6('0x115')](db[_0xd0a6('0x64')],{});db[_0xd0a6('0x17e')]['belongsTo'](db[_0xd0a6('0x65')],{});db[_0xd0a6('0x17e')][_0xd0a6('0x115')](db[_0xd0a6('0x13')],{});db[_0xd0a6('0x17e')][_0xd0a6('0x115')](db[_0xd0a6('0x66')],{});db[_0xd0a6('0x6b')][_0xd0a6('0x115')](db[_0xd0a6('0x13')],{'as':'Agent','foreignKey':_0xd0a6('0x109'),'onDelete':_0xd0a6('0x167')});db[_0xd0a6('0x6b')][_0xd0a6('0x115')](db[_0xd0a6('0x71')],{'as':_0xd0a6('0x17f'),'foreignKey':_0xd0a6('0x180'),'onDelete':_0xd0a6('0x167')});db[_0xd0a6('0x6b')][_0xd0a6('0x115')](db[_0xd0a6('0x68')],{'as':_0xd0a6('0x181'),'foreignKey':_0xd0a6('0x17d'),'onDelete':_0xd0a6('0x167')});db['ChatApplication'][_0xd0a6('0x115')](db[_0xd0a6('0x96')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0xd0a6('0x6c')][_0xd0a6('0x10d')](db[_0xd0a6('0x6e')],{'as':_0xd0a6('0x149'),'onDelete':_0xd0a6('0x108'),'foreignKey':_0xd0a6('0x182')});db[_0xd0a6('0x6c')][_0xd0a6('0x115')](db[_0xd0a6('0x68')],{'as':'Account','foreignKey':_0xd0a6('0x17d')});db['ChatInteraction'][_0xd0a6('0x115')](db[_0xd0a6('0x79')],{'as':_0xd0a6('0x14f'),'foreignKey':_0xd0a6('0x150')});db[_0xd0a6('0x6c')][_0xd0a6('0x115')](db[_0xd0a6('0x13')],{'as':_0xd0a6('0x160'),'foreignKey':_0xd0a6('0x109')});db[_0xd0a6('0x6c')][_0xd0a6('0x117')](db[_0xd0a6('0x96')],{'through':_0xd0a6('0x183'),'as':'Tags'});db[_0xd0a6('0x6c')][_0xd0a6('0x117')](db['Tag'],{'through':_0xd0a6('0x183'),'as':_0xd0a6('0x163')});db[_0xd0a6('0x6c')]['belongsToMany'](db['User'],{'as':_0xd0a6('0x164'),'through':_0xd0a6('0x11f'),'foreignKey':_0xd0a6('0x182')});db[_0xd0a6('0x6e')]['belongsTo'](db[_0xd0a6('0x13')],{'onDelete':_0xd0a6('0x108'),'as':'User'});db[_0xd0a6('0x6e')][_0xd0a6('0x115')](db['CmContact'],{'onDelete':'cascade','as':_0xd0a6('0x14f'),'foreignKey':'ContactId'});db[_0xd0a6('0x6e')][_0xd0a6('0x115')](db[_0xd0a6('0x6c')],{'onDelete':_0xd0a6('0x108'),'as':_0xd0a6('0x166'),'foreignKey':_0xd0a6('0x182')});db[_0xd0a6('0x6e')][_0xd0a6('0x115')](db['Attachment'],{'as':'Attachment','foreignKey':_0xd0a6('0x184')});db[_0xd0a6('0x6e')][_0xd0a6('0x115')](db[_0xd0a6('0x68')],{'as':_0xd0a6('0x15f'),'foreignKey':_0xd0a6('0x17d')});db[_0xd0a6('0x70')][_0xd0a6('0x115')](db[_0xd0a6('0x79')],{'onDelete':_0xd0a6('0x108'),'as':_0xd0a6('0x14f'),'foreignKey':_0xd0a6('0x150')});db['ChatOfflineMessage'][_0xd0a6('0x115')](db[_0xd0a6('0x68')],{'as':_0xd0a6('0x15f'),'foreignKey':_0xd0a6('0x17d')});db['ChatQueue'][_0xd0a6('0x117')](db[_0xd0a6('0x13')],{'as':_0xd0a6('0x15c'),'through':_0xd0a6('0x33'),'hooks':!![]});db['ChatQueue'][_0xd0a6('0x117')](db[_0xd0a6('0x11b')],{'through':_0xd0a6('0x185'),'as':_0xd0a6('0x145')});db['ChatGroup'][_0xd0a6('0x10d')](db[_0xd0a6('0xdb')],{'as':'Messages','foreignKey':_0xd0a6('0x186'),'onDelete':_0xd0a6('0x108')});db['ChatGroup'][_0xd0a6('0x117')](db[_0xd0a6('0x13')],{'as':_0xd0a6('0x139'),'through':_0xd0a6('0x118')});db[_0xd0a6('0x75')][_0xd0a6('0x115')](db['ChatWebsite'],{'as':_0xd0a6('0x181'),'foreignKey':_0xd0a6('0x17d')});db['CmCompany'][_0xd0a6('0x10d')](db[_0xd0a6('0x79')],{'as':_0xd0a6('0x119'),'foreignKey':'CompanyId'});db[_0xd0a6('0x79')][_0xd0a6('0x10d')](db['CmHopper'],{'as':'Hoppers','foreignKey':_0xd0a6('0x150')});db[_0xd0a6('0x79')][_0xd0a6('0x10d')](db['CmHopperFinal'],{'as':_0xd0a6('0x187'),'foreignKey':_0xd0a6('0x150')});db[_0xd0a6('0x79')][_0xd0a6('0x10d')](db[_0xd0a6('0x81')],{'as':_0xd0a6('0x13b'),'foreignKey':'ContactId'});db['CmContact'][_0xd0a6('0x10d')](db[_0xd0a6('0x83')],{'as':_0xd0a6('0x83'),'foreignKey':_0xd0a6('0x150')});db[_0xd0a6('0x79')]['hasMany'](db[_0xd0a6('0xe0')],{'as':_0xd0a6('0x13d'),'foreignKey':_0xd0a6('0x150')});db[_0xd0a6('0x79')][_0xd0a6('0x10d')](db[_0xd0a6('0x64')],{'as':_0xd0a6('0x110'),'foreignKey':_0xd0a6('0x150'),'onDelete':_0xd0a6('0x167')});db[_0xd0a6('0x79')]['hasMany'](db['ChatInteraction'],{'as':_0xd0a6('0x111'),'foreignKey':'ContactId','onDelete':_0xd0a6('0x167')});db['CmContact']['hasMany'](db[_0xd0a6('0x5a')],{'as':_0xd0a6('0x112'),'foreignKey':_0xd0a6('0x150'),'onDelete':_0xd0a6('0x167')});db[_0xd0a6('0x79')][_0xd0a6('0x10d')](db[_0xd0a6('0x113')],{'as':_0xd0a6('0x114'),'foreignKey':_0xd0a6('0x150'),'onDelete':_0xd0a6('0x167')});db[_0xd0a6('0x79')][_0xd0a6('0x10d')](db['MailInteraction'],{'as':_0xd0a6('0x11d'),'foreignKey':'ContactId','onDelete':_0xd0a6('0x167')});db[_0xd0a6('0x79')][_0xd0a6('0x115')](db[_0xd0a6('0x77')],{'as':_0xd0a6('0x188'),'foreignKey':_0xd0a6('0x189')});db['CmContact']['belongsTo'](db[_0xd0a6('0x12a')],{'as':_0xd0a6('0x169'),'foreignKey':_0xd0a6('0x15a'),'onDelete':_0xd0a6('0x108')});db[_0xd0a6('0x79')][_0xd0a6('0x117')](db[_0xd0a6('0x13')],{'as':_0xd0a6('0x164'),'through':_0xd0a6('0x18a')});db[_0xd0a6('0x79')][_0xd0a6('0x117')](db[_0xd0a6('0x96')],{'as':_0xd0a6('0x162'),'through':_0xd0a6('0x18b')});db[_0xd0a6('0x79')][_0xd0a6('0x117')](db[_0xd0a6('0x96')],{'through':'cm_contact_has_tags','as':_0xd0a6('0x163')});db[_0xd0a6('0x7b')][_0xd0a6('0x115')](db[_0xd0a6('0x79')],{'as':_0xd0a6('0x14f'),'foreignKey':_0xd0a6('0x150'),'onDelete':'cascade'});db['CmHopper'][_0xd0a6('0x115')](db[_0xd0a6('0x12a')],{'as':_0xd0a6('0x169'),'foreignKey':'ListId','onDelete':_0xd0a6('0x108')});db[_0xd0a6('0x7b')][_0xd0a6('0x115')](db[_0xd0a6('0x13')],{'as':_0xd0a6('0x18c'),'foreignKey':'UserId'});db[_0xd0a6('0x7b')][_0xd0a6('0x115')](db[_0xd0a6('0x1d')],{'as':_0xd0a6('0x17f'),'foreignKey':'VoiceQueueId','onDelete':_0xd0a6('0x108')});db[_0xd0a6('0x7b')][_0xd0a6('0x115')](db[_0xd0a6('0xf2')],{'as':_0xd0a6('0xf2'),'foreignKey':_0xd0a6('0x18d'),'onDelete':_0xd0a6('0x108')});db['CmHopper']['belongsTo'](db[_0xd0a6('0x13')],{'as':_0xd0a6('0x160'),'foreignKey':_0xd0a6('0x18e')});db[_0xd0a6('0x7d')]['belongsTo'](db[_0xd0a6('0x79')],{'as':'Contact','foreignKey':'ContactId','onDelete':'cascade'});db[_0xd0a6('0x7d')]['belongsTo'](db[_0xd0a6('0x12a')],{'as':_0xd0a6('0x169'),'foreignKey':'ListId','onDelete':_0xd0a6('0x108')});db[_0xd0a6('0x7d')][_0xd0a6('0x115')](db[_0xd0a6('0x1d')],{'as':_0xd0a6('0x17f'),'foreignKey':'VoiceQueueId','onDelete':_0xd0a6('0x108')});db[_0xd0a6('0x7d')]['belongsTo'](db[_0xd0a6('0xf2')],{'as':_0xd0a6('0xf2'),'foreignKey':_0xd0a6('0x18d'),'onDelete':_0xd0a6('0x108')});db[_0xd0a6('0x88')]['hasMany'](db[_0xd0a6('0x8d')],{'as':{'plural':'All','singular':_0xd0a6('0x18f')},'foreignKey':'AutomationAllId','onDelete':_0xd0a6('0x108'),'hooks':!![]});db[_0xd0a6('0x88')][_0xd0a6('0x10d')](db[_0xd0a6('0x8d')],{'as':{'plural':'Any','singular':_0xd0a6('0x190')},'foreignKey':'AutomationAnyId','onDelete':_0xd0a6('0x108'),'hooks':!![]});db[_0xd0a6('0x88')][_0xd0a6('0x10d')](db[_0xd0a6('0x86')],{'as':'Actions','foreignKey':_0xd0a6('0x191'),'onDelete':_0xd0a6('0x108'),'hooks':!![]});db[_0xd0a6('0x8f')][_0xd0a6('0x10d')](db[_0xd0a6('0x8f')],{'as':_0xd0a6('0x192'),'foreignKey':_0xd0a6('0x141'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0xd0a6('0x8f')][_0xd0a6('0x10d')](db['VoiceExtension'],{'as':_0xd0a6('0x10e'),'foreignKey':_0xd0a6('0x141'),'onDelete':_0xd0a6('0x167')});db[_0xd0a6('0x8f')][_0xd0a6('0x10d')](db[_0xd0a6('0x47')],{'as':_0xd0a6('0x193'),'foreignKey':_0xd0a6('0x141')});db[_0xd0a6('0x8f')][_0xd0a6('0x10d')](db[_0xd0a6('0x6b')],{'as':_0xd0a6('0x194'),'foreignKey':'IntervalId'});db['Interval']['hasMany'](db[_0xd0a6('0x4f')],{'as':_0xd0a6('0x195'),'foreignKey':_0xd0a6('0x141')});db[_0xd0a6('0x8f')][_0xd0a6('0x10d')](db[_0xd0a6('0x58')],{'as':_0xd0a6('0x196'),'foreignKey':'IntervalId'});db['Schedule'][_0xd0a6('0x115')](db[_0xd0a6('0x151')],{});db['Schedule'][_0xd0a6('0x115')](db[_0xd0a6('0x197')],{'foreignKey':_0xd0a6('0x198')});db[_0xd0a6('0x199')]['belongsTo'](db[_0xd0a6('0x9f')],{'foreignKey':_0xd0a6('0x19a')});db[_0xd0a6('0x136')][_0xd0a6('0x117')](db[_0xd0a6('0x1b')],{'as':'Mohs','through':_0xd0a6('0x138'),'onDelete':'restrict'});db['Tag'][_0xd0a6('0x117')](db[_0xd0a6('0x79')],{'through':_0xd0a6('0x18b')});db[_0xd0a6('0x96')][_0xd0a6('0x117')](db['ChatInteraction'],{'through':_0xd0a6('0x183')});db[_0xd0a6('0x96')][_0xd0a6('0x117')](db[_0xd0a6('0x43')],{'through':_0xd0a6('0x161')});db[_0xd0a6('0x96')][_0xd0a6('0x117')](db[_0xd0a6('0x5a')],{'through':_0xd0a6('0x174')});db[_0xd0a6('0x96')][_0xd0a6('0x117')](db[_0xd0a6('0x113')],{'through':_0xd0a6('0x16f')});db[_0xd0a6('0x96')][_0xd0a6('0x117')](db[_0xd0a6('0x64')],{'through':_0xd0a6('0x17b')});db[_0xd0a6('0x9a')]['hasMany'](db[_0xd0a6('0x8d')],{'as':{'plural':_0xd0a6('0x19b'),'singular':_0xd0a6('0x19c')},'foreignKey':_0xd0a6('0x19d'),'onDelete':_0xd0a6('0x108'),'hooks':!![]});db[_0xd0a6('0x9a')][_0xd0a6('0x10d')](db['Condition'],{'as':{'plural':_0xd0a6('0x19e'),'singular':_0xd0a6('0x19f')},'foreignKey':_0xd0a6('0x1a0'),'onDelete':_0xd0a6('0x108'),'hooks':!![]});db['Trigger']['hasMany'](db[_0xd0a6('0x86')],{'as':_0xd0a6('0x1a1'),'foreignKey':_0xd0a6('0x1a2'),'onDelete':_0xd0a6('0x108'),'hooks':!![]});db[_0xd0a6('0x9f')][_0xd0a6('0x10d')](db[_0xd0a6('0xa4')],{'as':'Fields','onDelete':'cascade','foreignKey':'CustomReportId','hooks':!![]});db[_0xd0a6('0x197')]['hasMany'](db[_0xd0a6('0xa4')],{'as':_0xd0a6('0x1a3'),'onDelete':_0xd0a6('0x108'),'foreignKey':'DefaultReportId'});db[_0xd0a6('0xa2')][_0xd0a6('0x10d')](db[_0xd0a6('0xa4')],{'as':_0xd0a6('0x1a3'),'onDelete':'cascade','foreignKey':_0xd0a6('0x1a4')});db['AnalyticFieldReport'][_0xd0a6('0x115')](db['AnalyticMetric'],{'foreignKey':_0xd0a6('0x1a4')});db[_0xd0a6('0xa7')][_0xd0a6('0x10d')](db[_0xd0a6('0xa9')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xd0a6('0x1a5')});db[_0xd0a6('0xa9')]['hasMany'](db[_0xd0a6('0xab')],{'as':_0xd0a6('0x1a6'),'onDelete':'cascade','foreignKey':_0xd0a6('0x1a7')});db[_0xd0a6('0xa9')]['hasMany'](db[_0xd0a6('0xab')],{'as':_0xd0a6('0x1a8'),'onDelete':_0xd0a6('0x108'),'foreignKey':_0xd0a6('0x1a9')});db[_0xd0a6('0xa9')][_0xd0a6('0x10d')](db[_0xd0a6('0xab')],{'as':_0xd0a6('0x1a3'),'onDelete':_0xd0a6('0x108'),'foreignKey':_0xd0a6('0x1aa')});db[_0xd0a6('0xa9')]['belongsTo'](db[_0xd0a6('0xa7')],{'as':_0xd0a6('0x15f'),'foreignKey':_0xd0a6('0x1a5')});db[_0xd0a6('0xab')][_0xd0a6('0x10d')](db[_0xd0a6('0xab')],{'as':_0xd0a6('0x1ab'),'foreignKey':_0xd0a6('0x1a7')});db[_0xd0a6('0xab')][_0xd0a6('0x10d')](db[_0xd0a6('0xab')],{'as':_0xd0a6('0x1ac'),'foreignKey':'DescriptionId'});db[_0xd0a6('0xab')][_0xd0a6('0x10d')](db[_0xd0a6('0xab')],{'as':_0xd0a6('0x1ad'),'foreignKey':'FieldId'});db[_0xd0a6('0xab')][_0xd0a6('0x115')](db['Variable'],{'as':_0xd0a6('0x1ae'),'foreignKey':'VariableId'});db[_0xd0a6('0xad')][_0xd0a6('0x10d')](db['SugarcrmConfiguration'],{'as':_0xd0a6('0x1af'),'onDelete':_0xd0a6('0x108'),'foreignKey':_0xd0a6('0x1a5')});db[_0xd0a6('0x1b0')]['hasMany'](db[_0xd0a6('0xb0')],{'as':_0xd0a6('0x1a6'),'onDelete':_0xd0a6('0x108'),'foreignKey':'SubjectId'});db[_0xd0a6('0x1b0')][_0xd0a6('0x10d')](db[_0xd0a6('0xb0')],{'as':_0xd0a6('0x1a8'),'onDelete':_0xd0a6('0x108'),'foreignKey':_0xd0a6('0x1a9')});db[_0xd0a6('0x1b0')][_0xd0a6('0x10d')](db[_0xd0a6('0xb0')],{'as':_0xd0a6('0x1a3'),'onDelete':'cascade','foreignKey':_0xd0a6('0x1aa')});db['SugarcrmConfiguration']['belongsTo'](db[_0xd0a6('0xad')],{'as':_0xd0a6('0x15f'),'foreignKey':_0xd0a6('0x1a5')});db['SugarcrmField'][_0xd0a6('0x10d')](db[_0xd0a6('0xb0')],{'as':'Subject','foreignKey':_0xd0a6('0x1a7')});db[_0xd0a6('0xb0')]['hasMany'](db[_0xd0a6('0xb0')],{'as':'Description','foreignKey':_0xd0a6('0x1a9')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0xd0a6('0x1ad'),'foreignKey':_0xd0a6('0x1aa')});db[_0xd0a6('0xb0')][_0xd0a6('0x115')](db[_0xd0a6('0x1ae')],{'as':_0xd0a6('0x1ae'),'foreignKey':_0xd0a6('0x1b1')});db[_0xd0a6('0xb2')]['hasMany'](db['DeskConfiguration'],{'as':_0xd0a6('0x1af'),'onDelete':_0xd0a6('0x108'),'foreignKey':_0xd0a6('0x1a5')});db[_0xd0a6('0x1b2')][_0xd0a6('0x10d')](db[_0xd0a6('0xb5')],{'as':_0xd0a6('0x1a6'),'onDelete':'cascade','foreignKey':'SubjectId'});db['DeskConfiguration'][_0xd0a6('0x10d')](db['DeskField'],{'as':_0xd0a6('0x1a8'),'onDelete':_0xd0a6('0x108'),'foreignKey':_0xd0a6('0x1a9')});db[_0xd0a6('0x1b2')]['hasMany'](db['DeskField'],{'as':'Fields','onDelete':'cascade','foreignKey':_0xd0a6('0x1aa')});db[_0xd0a6('0x1b2')][_0xd0a6('0x115')](db['DeskAccount'],{'as':_0xd0a6('0x15f'),'foreignKey':_0xd0a6('0x1a5')});db['DeskConfiguration'][_0xd0a6('0x117')](db[_0xd0a6('0x96')],{'through':_0xd0a6('0x1b3')});db[_0xd0a6('0xb5')][_0xd0a6('0x10d')](db[_0xd0a6('0xb5')],{'as':'Subject','foreignKey':'SubjectId'});db['DeskField'][_0xd0a6('0x10d')](db[_0xd0a6('0xb5')],{'as':_0xd0a6('0x1ac'),'foreignKey':_0xd0a6('0x1a9')});db['DeskField'][_0xd0a6('0x10d')](db[_0xd0a6('0xb5')],{'as':_0xd0a6('0x1ad'),'foreignKey':_0xd0a6('0x1aa')});db['DeskField'][_0xd0a6('0x115')](db['Variable'],{'as':_0xd0a6('0x1ae'),'foreignKey':_0xd0a6('0x1b1')});db[_0xd0a6('0xb7')]['hasMany'](db['ZohoConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xd0a6('0x1a5')});db[_0xd0a6('0xb9')][_0xd0a6('0x10d')](db['ZohoField'],{'as':'Subjects','onDelete':_0xd0a6('0x108'),'foreignKey':_0xd0a6('0x1a7')});db['ZohoConfiguration'][_0xd0a6('0x10d')](db[_0xd0a6('0xba')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0xd0a6('0x1a9')});db[_0xd0a6('0xb9')][_0xd0a6('0x10d')](db[_0xd0a6('0xba')],{'as':'Fields','onDelete':_0xd0a6('0x108'),'foreignKey':_0xd0a6('0x1aa')});db[_0xd0a6('0xb9')][_0xd0a6('0x115')](db[_0xd0a6('0xb7')],{'as':'Account','foreignKey':_0xd0a6('0x1a5')});db[_0xd0a6('0xba')]['hasMany'](db[_0xd0a6('0xba')],{'as':_0xd0a6('0x1ab'),'foreignKey':_0xd0a6('0x1a7')});db[_0xd0a6('0xba')][_0xd0a6('0x10d')](db['ZohoField'],{'as':'Description','foreignKey':_0xd0a6('0x1a9')});db[_0xd0a6('0xba')][_0xd0a6('0x10d')](db[_0xd0a6('0xba')],{'as':_0xd0a6('0x1ad'),'foreignKey':_0xd0a6('0x1aa')});db['ZohoField']['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0xd0a6('0x1b1')});db[_0xd0a6('0xbc')]['hasMany'](db['ZendeskConfiguration'],{'as':_0xd0a6('0x1af'),'onDelete':_0xd0a6('0x108'),'foreignKey':_0xd0a6('0x1a5')});db[_0xd0a6('0xbe')][_0xd0a6('0x10d')](db[_0xd0a6('0x1b4')],{'as':_0xd0a6('0x1a6'),'foreignKey':_0xd0a6('0x1a7')});db[_0xd0a6('0xbe')]['hasMany'](db[_0xd0a6('0x1b4')],{'as':'Descriptions','foreignKey':_0xd0a6('0x1a9')});db['ZendeskConfiguration']['hasMany'](db['ZendeskField'],{'as':_0xd0a6('0x1a3'),'foreignKey':_0xd0a6('0x1aa')});db['ZendeskConfiguration'][_0xd0a6('0x115')](db['ZendeskAccount'],{'as':_0xd0a6('0x15f'),'foreignKey':_0xd0a6('0x1a5')});db['ZendeskConfiguration'][_0xd0a6('0x117')](db[_0xd0a6('0x96')],{'through':_0xd0a6('0x1b5')});db[_0xd0a6('0x1b4')]['hasMany'](db[_0xd0a6('0x1b4')],{'as':_0xd0a6('0x1ab'),'foreignKey':_0xd0a6('0x1a7')});db[_0xd0a6('0x1b4')][_0xd0a6('0x10d')](db[_0xd0a6('0x1b4')],{'as':_0xd0a6('0x1ac'),'foreignKey':'DescriptionId'});db['ZendeskField']['hasMany'](db['ZendeskField'],{'as':_0xd0a6('0x1ad'),'foreignKey':_0xd0a6('0x1aa')});db[_0xd0a6('0x1b4')]['belongsTo'](db[_0xd0a6('0x1ae')],{'as':'Variable','foreignKey':_0xd0a6('0x1b1')});db[_0xd0a6('0xbf')][_0xd0a6('0x10d')](db[_0xd0a6('0xc1')],{'as':_0xd0a6('0x1af'),'onDelete':_0xd0a6('0x108'),'foreignKey':'AccountId'});db[_0xd0a6('0xc1')]['hasMany'](db[_0xd0a6('0xc3')],{'as':_0xd0a6('0x1a6'),'onDelete':_0xd0a6('0x108'),'foreignKey':_0xd0a6('0x1a7')});db[_0xd0a6('0xc1')][_0xd0a6('0x10d')](db[_0xd0a6('0xc3')],{'as':_0xd0a6('0x1a8'),'onDelete':_0xd0a6('0x108'),'foreignKey':_0xd0a6('0x1a9')});db['FreshdeskConfiguration'][_0xd0a6('0x10d')](db['FreshdeskField'],{'as':_0xd0a6('0x1a3'),'onDelete':'cascade','foreignKey':_0xd0a6('0x1aa')});db[_0xd0a6('0xc1')][_0xd0a6('0x115')](db[_0xd0a6('0xbf')],{'as':_0xd0a6('0x15f'),'foreignKey':_0xd0a6('0x1a5')});db[_0xd0a6('0xc1')][_0xd0a6('0x117')](db[_0xd0a6('0x96')],{'through':'int_freshdesk_configuration_has_tags'});db[_0xd0a6('0xc3')][_0xd0a6('0x10d')](db[_0xd0a6('0xc3')],{'as':_0xd0a6('0x1ab'),'foreignKey':_0xd0a6('0x1a7')});db[_0xd0a6('0xc3')][_0xd0a6('0x10d')](db[_0xd0a6('0xc3')],{'as':_0xd0a6('0x1ac'),'foreignKey':_0xd0a6('0x1a9')});db[_0xd0a6('0xc3')][_0xd0a6('0x10d')](db['FreshdeskField'],{'as':'Field','foreignKey':'FieldId'});db[_0xd0a6('0xc3')][_0xd0a6('0x115')](db['Variable'],{'as':'Variable','foreignKey':_0xd0a6('0x1b1')});db[_0xd0a6('0xc4')]['hasMany'](db[_0xd0a6('0xc5')],{'as':_0xd0a6('0x1af'),'onDelete':_0xd0a6('0x108'),'foreignKey':_0xd0a6('0x1a5')});db[_0xd0a6('0xc5')][_0xd0a6('0x10d')](db[_0xd0a6('0xc7')],{'as':_0xd0a6('0x1a6'),'foreignKey':_0xd0a6('0x1a7')});db['VtigerConfiguration'][_0xd0a6('0x10d')](db[_0xd0a6('0xc7')],{'as':_0xd0a6('0x1a8'),'foreignKey':_0xd0a6('0x1a9')});db[_0xd0a6('0xc5')]['hasMany'](db[_0xd0a6('0xc7')],{'as':_0xd0a6('0x1a3'),'foreignKey':_0xd0a6('0x1aa')});db['VtigerConfiguration'][_0xd0a6('0x115')](db['VtigerAccount'],{'as':_0xd0a6('0x15f'),'foreignKey':_0xd0a6('0x1a5')});db['VtigerField'][_0xd0a6('0x10d')](db[_0xd0a6('0xc7')],{'as':_0xd0a6('0x1ab'),'foreignKey':_0xd0a6('0x1a7')});db[_0xd0a6('0xc7')]['hasMany'](db[_0xd0a6('0xc7')],{'as':_0xd0a6('0x1ac'),'foreignKey':_0xd0a6('0x1a9')});db[_0xd0a6('0xc7')][_0xd0a6('0x10d')](db[_0xd0a6('0xc7')],{'as':_0xd0a6('0x1ad'),'foreignKey':'FieldId'});db[_0xd0a6('0xc7')][_0xd0a6('0x115')](db[_0xd0a6('0x1ae')],{'as':'Variable','foreignKey':_0xd0a6('0x1b1')});db['ServicenowAccount']['hasMany'](db[_0xd0a6('0x1b6')],{'as':_0xd0a6('0x1af'),'onDelete':'cascade','foreignKey':_0xd0a6('0x1a5')});db[_0xd0a6('0x1b6')][_0xd0a6('0x10d')](db[_0xd0a6('0xcc')],{'as':_0xd0a6('0x1a6'),'foreignKey':_0xd0a6('0x1a7')});db['ServicenowConfiguration'][_0xd0a6('0x10d')](db[_0xd0a6('0xcc')],{'as':_0xd0a6('0x1a8'),'foreignKey':'DescriptionId'});db[_0xd0a6('0x1b6')][_0xd0a6('0x10d')](db['ServicenowField'],{'as':_0xd0a6('0x1a3'),'foreignKey':'FieldId'});db[_0xd0a6('0x1b6')][_0xd0a6('0x115')](db[_0xd0a6('0xc9')],{'as':_0xd0a6('0x15f'),'foreignKey':_0xd0a6('0x1a5')});db['ServicenowField'][_0xd0a6('0x10d')](db['ServicenowField'],{'as':_0xd0a6('0x1ab'),'foreignKey':'SubjectId'});db['ServicenowField'][_0xd0a6('0x10d')](db[_0xd0a6('0xcc')],{'as':_0xd0a6('0x1ac'),'foreignKey':'DescriptionId'});db['ServicenowField'][_0xd0a6('0x10d')](db[_0xd0a6('0xcc')],{'as':_0xd0a6('0x1ad'),'foreignKey':_0xd0a6('0x1aa')});db[_0xd0a6('0xcc')][_0xd0a6('0x115')](db[_0xd0a6('0x1ae')],{'as':_0xd0a6('0x1ae'),'foreignKey':_0xd0a6('0x1b1')});db[_0xd0a6('0xce')][_0xd0a6('0x10d')](db['Dynamics365Configuration'],{'as':_0xd0a6('0x1af'),'onDelete':_0xd0a6('0x108'),'foreignKey':_0xd0a6('0x1a5')});db[_0xd0a6('0xcf')][_0xd0a6('0x10d')](db['Dynamics365Field'],{'as':_0xd0a6('0x1a6'),'onDelete':_0xd0a6('0x108'),'foreignKey':_0xd0a6('0x1a7')});db['Dynamics365Configuration'][_0xd0a6('0x10d')](db[_0xd0a6('0xd1')],{'as':_0xd0a6('0x1a8'),'onDelete':_0xd0a6('0x108'),'foreignKey':_0xd0a6('0x1a9')});db[_0xd0a6('0xcf')][_0xd0a6('0x10d')](db[_0xd0a6('0xd1')],{'as':_0xd0a6('0x1a3'),'onDelete':_0xd0a6('0x108'),'foreignKey':'FieldId'});db[_0xd0a6('0xcf')][_0xd0a6('0x115')](db[_0xd0a6('0xce')],{'as':_0xd0a6('0x15f'),'foreignKey':_0xd0a6('0x1a5')});db['Dynamics365Field']['hasMany'](db[_0xd0a6('0xd1')],{'as':'Subject','foreignKey':'SubjectId'});db[_0xd0a6('0xd1')][_0xd0a6('0x10d')](db[_0xd0a6('0xd1')],{'as':_0xd0a6('0x1ac'),'foreignKey':'DescriptionId'});db[_0xd0a6('0xd1')]['hasMany'](db['Dynamics365Field'],{'as':_0xd0a6('0x1ad'),'foreignKey':_0xd0a6('0x1aa')});db[_0xd0a6('0xd1')][_0xd0a6('0x115')](db[_0xd0a6('0x1ae')],{'as':_0xd0a6('0x1ae'),'foreignKey':_0xd0a6('0x1b1')});db[_0xd0a6('0x1b7')]['hasMany'](db[_0xd0a6('0xd3')],{'as':_0xd0a6('0x1af'),'onDelete':_0xd0a6('0x108'),'foreignKey':_0xd0a6('0x1a5')});db[_0xd0a6('0xd3')][_0xd0a6('0x10d')](db[_0xd0a6('0xd5')],{'as':_0xd0a6('0x1a6'),'foreignKey':_0xd0a6('0x1a7')});db[_0xd0a6('0xd3')][_0xd0a6('0x10d')](db[_0xd0a6('0xd5')],{'as':_0xd0a6('0x1a8'),'foreignKey':_0xd0a6('0x1a9')});db[_0xd0a6('0xd3')]['hasMany'](db[_0xd0a6('0xd5')],{'as':_0xd0a6('0x1a3'),'foreignKey':_0xd0a6('0x1aa')});db[_0xd0a6('0xd3')][_0xd0a6('0x115')](db[_0xd0a6('0x1b7')],{'as':_0xd0a6('0x15f'),'foreignKey':_0xd0a6('0x1a5')});db[_0xd0a6('0xd5')][_0xd0a6('0x10d')](db[_0xd0a6('0xd5')],{'as':_0xd0a6('0x1ab'),'foreignKey':_0xd0a6('0x1a7')});db[_0xd0a6('0xd5')][_0xd0a6('0x10d')](db[_0xd0a6('0xd5')],{'as':_0xd0a6('0x1ac'),'foreignKey':_0xd0a6('0x1a9')});db[_0xd0a6('0xd5')][_0xd0a6('0x10d')](db[_0xd0a6('0xd5')],{'as':_0xd0a6('0x1ad'),'foreignKey':_0xd0a6('0x1aa')});db[_0xd0a6('0xd5')]['belongsTo'](db[_0xd0a6('0x1ae')],{'as':_0xd0a6('0x1ae'),'foreignKey':_0xd0a6('0x1b1')});db['ChatQueueReport'][_0xd0a6('0x115')](db[_0xd0a6('0x68')],{});db['ChatQueueReport'][_0xd0a6('0x115')](db['CmList'],{'as':'List','foreignKey':_0xd0a6('0x15a')});db['ChatQueueReport'][_0xd0a6('0x115')](db['CmContact'],{'as':_0xd0a6('0x14f'),'foreignKey':'ContactId'});db[_0xd0a6('0xd9')][_0xd0a6('0x115')](db[_0xd0a6('0x6c')],{});db[_0xd0a6('0xd9')][_0xd0a6('0x115')](db[_0xd0a6('0x6e')],{});db[_0xd0a6('0xd9')][_0xd0a6('0x115')](db[_0xd0a6('0x13')],{});db['ChatQueueReport'][_0xd0a6('0x115')](db['ChatQueue'],{});db[_0xd0a6('0xdb')][_0xd0a6('0x115')](db[_0xd0a6('0x13')],{'onDelete':'cascade','foreignKey':_0xd0a6('0x1b8')});db[_0xd0a6('0xdb')]['belongsTo'](db['User'],{'onDelete':'cascade','foreignKey':_0xd0a6('0x1b9')});db[_0xd0a6('0xe0')][_0xd0a6('0x10d')](db['JscriptyQuestionReport'],{'foreignKey':_0xd0a6('0x1ba'),'onDelete':_0xd0a6('0x108')});db['JscriptySessionReport'][_0xd0a6('0x10d')](db[_0xd0a6('0xdc')],{'foreignKey':_0xd0a6('0x1ba'),'onDelete':_0xd0a6('0x108')});db['SmsQueueReport'][_0xd0a6('0x115')](db[_0xd0a6('0x56')],{});db[_0xd0a6('0xe1')][_0xd0a6('0x115')](db['CmList'],{'as':'List','foreignKey':_0xd0a6('0x15a')});db[_0xd0a6('0xe1')][_0xd0a6('0x115')](db['CmContact'],{'as':'Contact','foreignKey':_0xd0a6('0x150')});db[_0xd0a6('0xe1')][_0xd0a6('0x115')](db[_0xd0a6('0x5a')],{});db[_0xd0a6('0xe1')][_0xd0a6('0x115')](db[_0xd0a6('0x5c')],{});db[_0xd0a6('0xe1')][_0xd0a6('0x115')](db[_0xd0a6('0x13')],{});db['SmsQueueReport']['belongsTo'](db[_0xd0a6('0x5e')],{});db['JscriptyProject']['hasMany'](db[_0xd0a6('0xe0')],{'foreignKey':_0xd0a6('0x1bb')});db['JscriptyProject']['hasMany'](db[_0xd0a6('0xde')],{'foreignKey':_0xd0a6('0x1bb')});db['JscriptyProject'][_0xd0a6('0x10d')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0xd0a6('0xeb')]['belongsToMany'](db[_0xd0a6('0x13')],{'as':'Users','through':_0xd0a6('0x134')});db[_0xd0a6('0x11b')][_0xd0a6('0x117')](db[_0xd0a6('0x13')],{'as':_0xd0a6('0x15c'),'through':_0xd0a6('0x11c')});db['Team'][_0xd0a6('0x117')](db[_0xd0a6('0x1d')],{'through':_0xd0a6('0x146'),'as':'VoiceQueues'});db[_0xd0a6('0x11b')][_0xd0a6('0x117')](db['MailQueue'],{'through':_0xd0a6('0x15d'),'as':_0xd0a6('0x125')});db[_0xd0a6('0x11b')][_0xd0a6('0x117')](db[_0xd0a6('0x71')],{'through':_0xd0a6('0x185'),'as':_0xd0a6('0x126')});db['Team'][_0xd0a6('0x117')](db[_0xd0a6('0x52')],{'through':_0xd0a6('0x171'),'as':_0xd0a6('0x127')});db['Team']['belongsToMany'](db[_0xd0a6('0x5e')],{'through':_0xd0a6('0x177'),'as':_0xd0a6('0x128')});db[_0xd0a6('0x11b')][_0xd0a6('0x117')](db[_0xd0a6('0x66')],{'through':_0xd0a6('0x17c'),'as':_0xd0a6('0x1bc')});db[_0xd0a6('0xf2')]['hasMany'](db['CmHopper'],{'as':'Hoppers','foreignKey':_0xd0a6('0x18d')});db['Campaign'][_0xd0a6('0x10d')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0xd0a6('0x18d')});db[_0xd0a6('0xf2')][_0xd0a6('0x10d')](db[_0xd0a6('0x81')],{'as':_0xd0a6('0x13b'),'foreignKey':_0xd0a6('0x18d')});db[_0xd0a6('0xf2')][_0xd0a6('0x10d')](db[_0xd0a6('0x7d')],{'as':_0xd0a6('0x13c'),'foreignKey':_0xd0a6('0x18d')});db[_0xd0a6('0xf2')][_0xd0a6('0x115')](db[_0xd0a6('0x2d')],{'as':'Trunk','foreignKey':_0xd0a6('0x13e')});db[_0xd0a6('0xf2')][_0xd0a6('0x115')](db['Trunk'],{'as':_0xd0a6('0x13f'),'foreignKey':_0xd0a6('0x140')});db[_0xd0a6('0xf2')]['belongsTo'](db[_0xd0a6('0x8f')],{'as':'Interval','foreignKey':_0xd0a6('0x141')});db[_0xd0a6('0xf2')][_0xd0a6('0x115')](db[_0xd0a6('0xeb')],{'as':_0xd0a6('0xeb'),'foreignKey':_0xd0a6('0x1bd')});db['Campaign'][_0xd0a6('0x117')](db[_0xd0a6('0x12a')],{'as':_0xd0a6('0x11a'),'through':_0xd0a6('0x1be')});db[_0xd0a6('0xf2')][_0xd0a6('0x117')](db[_0xd0a6('0x12a')],{'as':_0xd0a6('0x147'),'through':_0xd0a6('0x1bf')});db[_0xd0a6('0x1c0')][_0xd0a6('0x115')](db[_0xd0a6('0x45')],{});db[_0xd0a6('0x1c0')][_0xd0a6('0x115')](db[_0xd0a6('0x43')],{});db['MailTransferReport']['belongsTo'](db[_0xd0a6('0x151')],{'foreignKey':_0xd0a6('0x1c1'),'as':_0xd0a6('0x1c2')});db[_0xd0a6('0x1c0')][_0xd0a6('0x115')](db[_0xd0a6('0x13')],{'foreignKey':'FromUserId','as':_0xd0a6('0x1c3')});db['MailTransferReport'][_0xd0a6('0x115')](db[_0xd0a6('0x13')],{'foreignKey':_0xd0a6('0x1c4'),'as':_0xd0a6('0x1c5')});db[_0xd0a6('0x1c0')][_0xd0a6('0x115')](db[_0xd0a6('0x124')],{'foreignKey':_0xd0a6('0x1c6'),'as':_0xd0a6('0x1c7')});db[_0xd0a6('0x1c0')]['belongsTo'](db[_0xd0a6('0x151')],{'foreignKey':_0xd0a6('0x1c8'),'as':_0xd0a6('0x1c9')});db[_0xd0a6('0xf8')]['belongsTo'](db[_0xd0a6('0x6e')],{});db['ChatTransferReport'][_0xd0a6('0x115')](db['ChatInteraction'],{});db['ChatTransferReport']['belongsTo'](db[_0xd0a6('0x68')],{'foreignKey':_0xd0a6('0x1ca'),'as':_0xd0a6('0x1c2')});db[_0xd0a6('0xf8')][_0xd0a6('0x115')](db['User'],{'foreignKey':_0xd0a6('0x1cb'),'as':_0xd0a6('0x1c3')});db['ChatTransferReport'][_0xd0a6('0x115')](db[_0xd0a6('0x13')],{'foreignKey':_0xd0a6('0x1c4'),'as':_0xd0a6('0x1c5')});db[_0xd0a6('0xf8')][_0xd0a6('0x115')](db[_0xd0a6('0x71')],{'foreignKey':_0xd0a6('0x1cc'),'as':_0xd0a6('0x1c7')});db[_0xd0a6('0xf8')][_0xd0a6('0x115')](db['ChatWebsite'],{'foreignKey':_0xd0a6('0x1cd'),'as':_0xd0a6('0x1c9')});db[_0xd0a6('0xf9')][_0xd0a6('0x115')](db[_0xd0a6('0x51')],{});db[_0xd0a6('0xf9')][_0xd0a6('0x115')](db[_0xd0a6('0x113')],{});db[_0xd0a6('0xf9')][_0xd0a6('0x115')](db['FaxAccount'],{'foreignKey':'FromFaxAccountId','as':_0xd0a6('0x1c2')});db[_0xd0a6('0xf9')]['belongsTo'](db['User'],{'foreignKey':_0xd0a6('0x1cb'),'as':'FromAgent'});db[_0xd0a6('0xf9')]['belongsTo'](db[_0xd0a6('0x13')],{'foreignKey':_0xd0a6('0x1c4'),'as':_0xd0a6('0x1c5')});db[_0xd0a6('0xf9')][_0xd0a6('0x115')](db[_0xd0a6('0x52')],{'foreignKey':_0xd0a6('0x1ce'),'as':_0xd0a6('0x1c7')});db[_0xd0a6('0xf9')]['belongsTo'](db[_0xd0a6('0x4e')],{'foreignKey':_0xd0a6('0x1cf'),'as':_0xd0a6('0x1c9')});db[_0xd0a6('0xfb')][_0xd0a6('0x115')](db[_0xd0a6('0x65')],{});db[_0xd0a6('0xfb')][_0xd0a6('0x115')](db[_0xd0a6('0x64')],{});db[_0xd0a6('0xfb')][_0xd0a6('0x115')](db[_0xd0a6('0x60')],{'foreignKey':_0xd0a6('0x1d0'),'as':_0xd0a6('0x1c2')});db[_0xd0a6('0xfb')]['belongsTo'](db[_0xd0a6('0x13')],{'foreignKey':_0xd0a6('0x1cb'),'as':_0xd0a6('0x1c3')});db['OpenchannelTransferReport'][_0xd0a6('0x115')](db[_0xd0a6('0x13')],{'foreignKey':'ToUserId','as':'ToAgent'});db['OpenchannelTransferReport'][_0xd0a6('0x115')](db['OpenchannelQueue'],{'foreignKey':_0xd0a6('0x1d1'),'as':'ToQueue'});db['OpenchannelTransferReport'][_0xd0a6('0x115')](db[_0xd0a6('0x60')],{'foreignKey':_0xd0a6('0x1d2'),'as':_0xd0a6('0x1c9')});db[_0xd0a6('0xfd')]['belongsTo'](db[_0xd0a6('0x5c')],{});db['SmsTransferReport']['belongsTo'](db[_0xd0a6('0x5a')],{});db[_0xd0a6('0xfd')][_0xd0a6('0x115')](db[_0xd0a6('0x56')],{'foreignKey':_0xd0a6('0x1d3'),'as':_0xd0a6('0x1c2')});db[_0xd0a6('0xfd')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0xd0a6('0xfd')][_0xd0a6('0x115')](db[_0xd0a6('0x13')],{'foreignKey':_0xd0a6('0x1c4'),'as':_0xd0a6('0x1c5')});db[_0xd0a6('0xfd')][_0xd0a6('0x115')](db[_0xd0a6('0x5e')],{'foreignKey':'ToSmsQueueId','as':'ToQueue'});db['SmsTransferReport'][_0xd0a6('0x115')](db[_0xd0a6('0x56')],{'foreignKey':_0xd0a6('0x1d4'),'as':'ToAccount'});db[_0xd0a6('0x12a')][_0xd0a6('0x10d')](db['Disposition'],{'as':_0xd0a6('0x156'),'foreignKey':'ListId'});db[_0xd0a6('0x12a')]['hasMany'](db[_0xd0a6('0x84')],{'as':_0xd0a6('0x1d5'),'foreignKey':'ListId'});db[_0xd0a6('0x12a')][_0xd0a6('0x10d')](db[_0xd0a6('0x79')],{'as':_0xd0a6('0x119'),'onDelete':'cascade','foreignKey':_0xd0a6('0x15a')});db[_0xd0a6('0x12a')][_0xd0a6('0x10d')](db['CmHopperFinal'],{'as':_0xd0a6('0x187'),'foreignKey':_0xd0a6('0x15a')});db[_0xd0a6('0x12a')][_0xd0a6('0x10d')](db[_0xd0a6('0x81')],{'as':_0xd0a6('0x10f'),'foreignKey':'ListId'});db[_0xd0a6('0x12a')]['hasMany'](db['ReportAgentPreview'],{'as':_0xd0a6('0x83'),'foreignKey':_0xd0a6('0x15a')});db['CmList']['belongsToMany'](db[_0xd0a6('0x1d')],{'as':_0xd0a6('0x1d6'),'through':_0xd0a6('0x144')});db[_0xd0a6('0x12a')][_0xd0a6('0x117')](db['User'],{'as':_0xd0a6('0x15c'),'through':_0xd0a6('0x1d7')});db[_0xd0a6('0x100')][_0xd0a6('0x10d')](db[_0xd0a6('0x1a')],{'as':_0xd0a6('0x10e'),'onDelete':_0xd0a6('0x167')});db[_0xd0a6('0x100')]['belongsToMany'](db['User'],{'as':_0xd0a6('0x15c'),'through':_0xd0a6('0x12c')});db[_0xd0a6('0x102')][_0xd0a6('0x10d')](db[_0xd0a6('0x13')],{'as':_0xd0a6('0x164'),'foreignKey':_0xd0a6('0x116')});db[_0xd0a6('0x102')][_0xd0a6('0x10d')](db[_0xd0a6('0x104')],{'as':_0xd0a6('0x1d8'),'foreignKey':_0xd0a6('0x116'),'onDelete':_0xd0a6('0x108')});db['UserProfileSection'][_0xd0a6('0x10d')](db[_0xd0a6('0x106')],{'as':_0xd0a6('0x1d9'),'foreignKey':_0xd0a6('0x1da'),'onDelete':_0xd0a6('0x108')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 5a02d97..0afc944 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4046=['./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','/api/auth/local','./api/authLocal','./api/authGoogle','/api/jira','./api/jira','/api/rpc','/api/version','./api/version','/api/system','/apidoc','static','join','root','/www','/demo','/snippet','1.0.16','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','/index.html','path','express-winston','util','./errors','./config/environment','./config/logger','api','auth','use','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','name','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','device','role','other','agent_id','agent_name','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceExtension','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/applications','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','./api/chatQueue','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','./api/cmContact','/api/cm/hopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','/api/intervals','./api/interval','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','/api/sounds','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage'];(function(_0x3b1e3f,_0xf8826b){var _0x3b1cd3=function(_0x26ad44){while(--_0x26ad44){_0x3b1e3f['push'](_0x3b1e3f['shift']());}};_0x3b1cd3(++_0xf8826b);}(_0x4046,0x14e));var _0x6404=function(_0x2a922e,_0x521ac2){_0x2a922e=_0x2a922e-0x0;var _0x5b4d1b=_0x4046[_0x2a922e];return _0x5b4d1b;};'use strict';var path=require(_0x6404('0x0'));var express=require('express');var ewinston=require(_0x6404('0x1'));var util=require(_0x6404('0x2'));var errors=require(_0x6404('0x3'));var config=require(_0x6404('0x4'));var logger=require(_0x6404('0x5'))(_0x6404('0x6'));var authLogger=require(_0x6404('0x5'))(_0x6404('0x7'));exports['default']=function(_0x427ca4){_0x427ca4[_0x6404('0x8')](ewinston['logger']({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0xd1f1e7,_0x2a41ad){return util[_0x6404('0x9')](_0x6404('0xa'),_0xd1f1e7[_0x6404('0xb')],_0xd1f1e7[_0x6404('0xc')][_0x6404('0xd')]?_0xd1f1e7['headers'][_0x6404('0xd')]:_0xd1f1e7[_0x6404('0xe')][_0x6404('0xf')]||_0xd1f1e7['ip'],_0xd1f1e7[_0x6404('0x10')],_0x2a41ad[_0x6404('0x11')],_0x2a41ad[_0x6404('0x12')],_0xd1f1e7[_0x6404('0x13')]?_0xd1f1e7['user']['id']:null,_0xd1f1e7['user']?_0xd1f1e7[_0x6404('0x13')][_0x6404('0x14')]:null,_0xd1f1e7[_0x6404('0x13')]?_0xd1f1e7['user']['role']:null);}}));_0x427ca4[_0x6404('0x8')](ewinston[_0x6404('0x15')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x34c8d1,_0x560bd6){var _0x3ac4ad=_0x6404('0x16');if(_0x34c8d1[_0x6404('0x17')]&&_0x34c8d1[_0x6404('0x17')][_0x6404('0x18')]&&_0x34c8d1[_0x6404('0x17')]['agent_id']){_0x3ac4ad='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x6404('0x9')](_0x3ac4ad,_0x34c8d1[_0x6404('0xb')],_0x34c8d1[_0x6404('0xc')][_0x6404('0xd')]?_0x34c8d1[_0x6404('0xc')][_0x6404('0xd')]:_0x34c8d1['connection'][_0x6404('0xf')]||_0x34c8d1['ip'],_0x34c8d1[_0x6404('0x10')],_0x560bd6[_0x6404('0x11')],_0x560bd6['responseTime'],_0x34c8d1['user']?_0x34c8d1['user']['id']:null,_0x34c8d1['user']?_0x34c8d1[_0x6404('0x13')][_0x6404('0x14')]:null,_0x34c8d1[_0x6404('0x13')]?_0x34c8d1[_0x6404('0x13')][_0x6404('0x19')]:null,_0x34c8d1[_0x6404('0x17')]&&_0x34c8d1['body']['device']?_0x34c8d1['body'][_0x6404('0x18')]:_0x6404('0x1a'),_0x34c8d1[_0x6404('0x17')]&&_0x34c8d1[_0x6404('0x17')][_0x6404('0x1b')]?_0x34c8d1[_0x6404('0x17')][_0x6404('0x1b')]:'',_0x34c8d1[_0x6404('0x17')]&&_0x34c8d1['body'][_0x6404('0x1c')]?_0x34c8d1[_0x6404('0x17')][_0x6404('0x1c')]:'');},'ignoreRoute':function(_0x46fbfb){var _0x1a725d=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1a725d['test'](_0x46fbfb[_0x6404('0x10')]);}}));_0x427ca4['use']('/api/users',require('./api/user'));_0x427ca4[_0x6404('0x8')](_0x6404('0x1d'),require(_0x6404('0x1e')));_0x427ca4[_0x6404('0x8')](_0x6404('0x1f'),require('./api/voiceContext'));_0x427ca4[_0x6404('0x8')]('/api/voice/extensions',require(_0x6404('0x20')));_0x427ca4[_0x6404('0x8')]('/api/voice/mohs',require(_0x6404('0x21')));_0x427ca4[_0x6404('0x8')]('/api/voice/queues',require(_0x6404('0x22')));_0x427ca4[_0x6404('0x8')](_0x6404('0x23'),require(_0x6404('0x24')));_0x427ca4[_0x6404('0x8')]('/api/screen/recordings',require(_0x6404('0x25')));_0x427ca4[_0x6404('0x8')](_0x6404('0x26'),require('./api/voiceMail'));_0x427ca4[_0x6404('0x8')](_0x6404('0x27'),require(_0x6404('0x28')));_0x427ca4['use'](_0x6404('0x29'),require(_0x6404('0x2a')));_0x427ca4[_0x6404('0x8')]('/api/voice/dials/reports',require('./api/voiceDialReport'));_0x427ca4['use'](_0x6404('0x2b'),require(_0x6404('0x2c')));_0x427ca4[_0x6404('0x8')](_0x6404('0x2d'),require(_0x6404('0x2e')));_0x427ca4[_0x6404('0x8')](_0x6404('0x2f'),require('./api/memberReport'));_0x427ca4['use']('/api/trunks',require('./api/trunk'));_0x427ca4[_0x6404('0x8')](_0x6404('0x30'),require(_0x6404('0x31')));_0x427ca4['use'](_0x6404('0x32'),require(_0x6404('0x33')));_0x427ca4[_0x6404('0x8')](_0x6404('0x34'),require(_0x6404('0x35')));_0x427ca4[_0x6404('0x8')](_0x6404('0x36'),require(_0x6404('0x37')));_0x427ca4[_0x6404('0x8')](_0x6404('0x38'),require('./api/mailSubstatus'));_0x427ca4[_0x6404('0x8')]('/api/mail/interactions',require(_0x6404('0x39')));_0x427ca4[_0x6404('0x8')](_0x6404('0x3a'),require(_0x6404('0x3b')));_0x427ca4[_0x6404('0x8')](_0x6404('0x3c'),require('./api/mailApplication'));_0x427ca4[_0x6404('0x8')](_0x6404('0x3d'),require(_0x6404('0x3e')));_0x427ca4['use'](_0x6404('0x3f'),require(_0x6404('0x40')));_0x427ca4[_0x6404('0x8')](_0x6404('0x41'),require(_0x6404('0x42')));_0x427ca4[_0x6404('0x8')]('/api/fax/accounts',require(_0x6404('0x43')));_0x427ca4[_0x6404('0x8')](_0x6404('0x44'),require(_0x6404('0x45')));_0x427ca4[_0x6404('0x8')](_0x6404('0x46'),require(_0x6404('0x47')));_0x427ca4[_0x6404('0x8')](_0x6404('0x48'),require(_0x6404('0x49')));_0x427ca4['use'](_0x6404('0x4a'),require('./api/faxQueue'));_0x427ca4[_0x6404('0x8')](_0x6404('0x4b'),require(_0x6404('0x4c')));_0x427ca4[_0x6404('0x8')]('/api/sms/accounts',require('./api/smsAccount'));_0x427ca4[_0x6404('0x8')](_0x6404('0x4d'),require('./api/smsApplication'));_0x427ca4[_0x6404('0x8')]('/api/sms/interactions',require(_0x6404('0x4e')));_0x427ca4[_0x6404('0x8')](_0x6404('0x4f'),require(_0x6404('0x50')));_0x427ca4[_0x6404('0x8')](_0x6404('0x51'),require(_0x6404('0x52')));_0x427ca4['use'](_0x6404('0x53'),require('./api/openchannelAccount'));_0x427ca4[_0x6404('0x8')](_0x6404('0x54'),require(_0x6404('0x55')));_0x427ca4[_0x6404('0x8')](_0x6404('0x56'),require(_0x6404('0x57')));_0x427ca4[_0x6404('0x8')]('/api/openchannel/messages',require(_0x6404('0x58')));_0x427ca4[_0x6404('0x8')](_0x6404('0x59'),require(_0x6404('0x5a')));_0x427ca4[_0x6404('0x8')](_0x6404('0x5b'),require(_0x6404('0x5c')));_0x427ca4[_0x6404('0x8')](_0x6404('0x5d'),require(_0x6404('0x5e')));_0x427ca4[_0x6404('0x8')]('/api/chat/applications',require(_0x6404('0x5f')));_0x427ca4['use'](_0x6404('0x60'),require(_0x6404('0x61')));_0x427ca4[_0x6404('0x8')]('/api/chat/messages',require('./api/chatMessage'));_0x427ca4[_0x6404('0x8')]('/api/chat/offline_messages',require('./api/chatOfflineMessage'));_0x427ca4[_0x6404('0x8')]('/api/chat/queues',require(_0x6404('0x62')));_0x427ca4[_0x6404('0x8')]('/api/chat/groups',require(_0x6404('0x63')));_0x427ca4[_0x6404('0x8')](_0x6404('0x64'),require(_0x6404('0x65')));_0x427ca4[_0x6404('0x8')](_0x6404('0x66'),require(_0x6404('0x67')));_0x427ca4['use']('/api/cm/contacts',require(_0x6404('0x68')));_0x427ca4[_0x6404('0x8')](_0x6404('0x69'),require('./api/cmHopper'));_0x427ca4[_0x6404('0x8')](_0x6404('0x6a'),require('./api/cmHopperBlack'));_0x427ca4[_0x6404('0x8')](_0x6404('0x6b'),require(_0x6404('0x6c')));_0x427ca4[_0x6404('0x8')](_0x6404('0x6d'),require(_0x6404('0x6e')));_0x427ca4[_0x6404('0x8')](_0x6404('0x6f'),require('./api/cmCustomField'));_0x427ca4[_0x6404('0x8')]('/api/actions',require('./api/action'));_0x427ca4['use']('/api/automations',require('./api/automation'));_0x427ca4[_0x6404('0x8')](_0x6404('0x70'),require(_0x6404('0x71')));_0x427ca4[_0x6404('0x8')](_0x6404('0x72'),require('./api/disposition'));_0x427ca4[_0x6404('0x8')](_0x6404('0x73'),require(_0x6404('0x74')));_0x427ca4[_0x6404('0x8')](_0x6404('0x75'),require(_0x6404('0x76')));_0x427ca4['use']('/api/pauses',require(_0x6404('0x77')));_0x427ca4['use'](_0x6404('0x78'),require(_0x6404('0x79')));_0x427ca4[_0x6404('0x8')](_0x6404('0x7a'),require(_0x6404('0x7b')));_0x427ca4[_0x6404('0x8')](_0x6404('0x7c'),require('./api/schedule'));_0x427ca4[_0x6404('0x8')](_0x6404('0x7d'),require('./api/sound'));_0x427ca4[_0x6404('0x8')](_0x6404('0x7e'),require(_0x6404('0x7f')));_0x427ca4[_0x6404('0x8')](_0x6404('0x80'),require(_0x6404('0x81')));_0x427ca4[_0x6404('0x8')](_0x6404('0x82'),require(_0x6404('0x83')));_0x427ca4[_0x6404('0x8')](_0x6404('0x84'),require('./api/variable'));_0x427ca4['use'](_0x6404('0x85'),require(_0x6404('0x86')));_0x427ca4['use'](_0x6404('0x87'),require(_0x6404('0x88')));_0x427ca4[_0x6404('0x8')](_0x6404('0x89'),require(_0x6404('0x8a')));_0x427ca4[_0x6404('0x8')](_0x6404('0x8b'),require(_0x6404('0x8c')));_0x427ca4[_0x6404('0x8')]('/api/analytics/extracted_reports',require(_0x6404('0x8d')));_0x427ca4[_0x6404('0x8')]('/api/analytics/metrics',require('./api/analyticMetric'));_0x427ca4[_0x6404('0x8')]('/api/analytics/field_reports',require(_0x6404('0x8e')));_0x427ca4['use'](_0x6404('0x8f'),require(_0x6404('0x90')));_0x427ca4[_0x6404('0x8')](_0x6404('0x91'),require(_0x6404('0x92')));_0x427ca4['use']('/api/integrations/salesforce/configurations',require(_0x6404('0x93')));_0x427ca4[_0x6404('0x8')](_0x6404('0x94'),require(_0x6404('0x95')));_0x427ca4[_0x6404('0x8')](_0x6404('0x96'),require(_0x6404('0x97')));_0x427ca4[_0x6404('0x8')](_0x6404('0x98'),require('./api/intSugarcrmConfiguration'));_0x427ca4['use']('/api/integrations/sugarcrm/fields',require(_0x6404('0x99')));_0x427ca4[_0x6404('0x8')](_0x6404('0x9a'),require(_0x6404('0x9b')));_0x427ca4[_0x6404('0x8')](_0x6404('0x9c'),require('./api/intDeskConfiguration'));_0x427ca4[_0x6404('0x8')](_0x6404('0x9d'),require(_0x6404('0x9e')));_0x427ca4[_0x6404('0x8')](_0x6404('0x9f'),require(_0x6404('0xa0')));_0x427ca4['use'](_0x6404('0xa1'),require('./api/intZohoConfiguration'));_0x427ca4['use'](_0x6404('0xa2'),require('./api/intZohoField'));_0x427ca4[_0x6404('0x8')](_0x6404('0xa3'),require(_0x6404('0xa4')));_0x427ca4[_0x6404('0x8')](_0x6404('0xa5'),require('./api/intZendeskConfiguration'));_0x427ca4['use'](_0x6404('0xa6'),require('./api/intZendeskField'));_0x427ca4[_0x6404('0x8')](_0x6404('0xa7'),require(_0x6404('0xa8')));_0x427ca4[_0x6404('0x8')](_0x6404('0xa9'),require(_0x6404('0xaa')));_0x427ca4['use'](_0x6404('0xab'),require('./api/intFreshdeskField'));_0x427ca4[_0x6404('0x8')](_0x6404('0xac'),require(_0x6404('0xad')));_0x427ca4[_0x6404('0x8')]('/api/integrations/vtiger/configurations',require(_0x6404('0xae')));_0x427ca4[_0x6404('0x8')](_0x6404('0xaf'),require(_0x6404('0xb0')));_0x427ca4[_0x6404('0x8')](_0x6404('0xb1'),require(_0x6404('0xb2')));_0x427ca4[_0x6404('0x8')](_0x6404('0xb3'),require(_0x6404('0xb4')));_0x427ca4[_0x6404('0x8')]('/api/integrations/servicenow/fields',require(_0x6404('0xb5')));_0x427ca4['use'](_0x6404('0xb6'),require(_0x6404('0xb7')));_0x427ca4[_0x6404('0x8')](_0x6404('0xb8'),require(_0x6404('0xb9')));_0x427ca4[_0x6404('0x8')](_0x6404('0xba'),require(_0x6404('0xbb')));_0x427ca4[_0x6404('0x8')](_0x6404('0xbc'),require(_0x6404('0xbd')));_0x427ca4[_0x6404('0x8')](_0x6404('0xbe'),require(_0x6404('0xbf')));_0x427ca4['use'](_0x6404('0xc0'),require(_0x6404('0xc1')));_0x427ca4[_0x6404('0x8')]('/api/networks',require(_0x6404('0xc2')));_0x427ca4['use'](_0x6404('0xc3'),require('./api/chatQueueReport'));_0x427ca4[_0x6404('0x8')](_0x6404('0xc4'),require(_0x6404('0xc5')));_0x427ca4['use']('/api/jscripty/answers/reports',require(_0x6404('0xc6')));_0x427ca4['use']('/api/jscripty/questions/reports',require(_0x6404('0xc7')));_0x427ca4[_0x6404('0x8')](_0x6404('0xc8'),require(_0x6404('0xc9')));_0x427ca4['use'](_0x6404('0xca'),require('./api/smsQueueReport'));_0x427ca4[_0x6404('0x8')](_0x6404('0xcb'),require(_0x6404('0xcc')));_0x427ca4[_0x6404('0x8')](_0x6404('0xcd'),require(_0x6404('0xce')));_0x427ca4['use'](_0x6404('0xcf'),require(_0x6404('0xd0')));_0x427ca4[_0x6404('0x8')](_0x6404('0xd1'),require(_0x6404('0xd2')));_0x427ca4[_0x6404('0x8')](_0x6404('0xd3'),require(_0x6404('0xd4')));_0x427ca4[_0x6404('0x8')](_0x6404('0xd5'),require(_0x6404('0xd6')));_0x427ca4['use'](_0x6404('0xd7'),require(_0x6404('0xd8')));_0x427ca4[_0x6404('0x8')](_0x6404('0xd9'),require(_0x6404('0xda')));_0x427ca4['use'](_0x6404('0xdb'),require('./api/team'));_0x427ca4['use'](_0x6404('0xdc'),require(_0x6404('0xdd')));_0x427ca4[_0x6404('0x8')](_0x6404('0xde'),require(_0x6404('0xdf')));_0x427ca4[_0x6404('0x8')](_0x6404('0xe0'),require(_0x6404('0xe1')));_0x427ca4[_0x6404('0x8')](_0x6404('0xe2'),require('./api/attachment'));_0x427ca4['use']('/api/plugins',require('./api/plugin'));_0x427ca4[_0x6404('0x8')](_0x6404('0xe3'),require(_0x6404('0xe4')));_0x427ca4[_0x6404('0x8')](_0x6404('0xe5'),require(_0x6404('0xe6')));_0x427ca4['use'](_0x6404('0xe7'),require(_0x6404('0xe8')));_0x427ca4['use'](_0x6404('0xe9'),require('./api/openchannelTransferReport'));_0x427ca4[_0x6404('0x8')]('/api/sms/reports/transfer',require('./api/smsTransferReport'));_0x427ca4[_0x6404('0x8')]('/api/cm/lists',require(_0x6404('0xea')));_0x427ca4[_0x6404('0x8')](_0x6404('0xeb'),require(_0x6404('0xec')));_0x427ca4['use'](_0x6404('0xed'),require(_0x6404('0xee')));_0x427ca4[_0x6404('0x8')](_0x6404('0xef'),require(_0x6404('0xf0')));_0x427ca4['use'](_0x6404('0xf1'),require('./api/userProfileResource'));_0x427ca4[_0x6404('0x8')](_0x6404('0xf2'),require(_0x6404('0xf3')));_0x427ca4[_0x6404('0x8')]('/api/auth/google',require(_0x6404('0xf4')));_0x427ca4[_0x6404('0x8')](_0x6404('0xf5'),require(_0x6404('0xf6')));_0x427ca4[_0x6404('0x8')](_0x6404('0xf7'),require('./api/rpc'));_0x427ca4[_0x6404('0x8')](_0x6404('0xf8'),require(_0x6404('0xf9')));_0x427ca4[_0x6404('0x8')](_0x6404('0xfa'),require('./api/system'));_0x427ca4[_0x6404('0x8')]('/api/pm2',require('./api/pm2'));_0x427ca4[_0x6404('0x8')](_0x6404('0xfb'),express[_0x6404('0xfc')](path[_0x6404('0xfd')](config[_0x6404('0xfe')],_0x6404('0xfb'))));_0x427ca4[_0x6404('0x8')](_0x6404('0xff'),express['static'](path[_0x6404('0xfd')](config['root'],_0x6404('0xff'))));_0x427ca4['use'](_0x6404('0x100'),express[_0x6404('0xfc')](path['join'](config[_0x6404('0xfe')],_0x6404('0x100'))));_0x427ca4[_0x6404('0x8')](_0x6404('0x101'),express['static'](path[_0x6404('0xfd')](config[_0x6404('0xfe')],'snippet',_0x6404('0x102'))));_0x427ca4['use']('/plugins',express[_0x6404('0xfc')](path['join'](config[_0x6404('0xfe')],_0x6404('0x103'))));_0x427ca4[_0x6404('0x104')](_0x6404('0x105'))[_0x6404('0x106')](errors[0x194]);_0x427ca4[_0x6404('0x104')]('/*')[_0x6404('0x106')](function(_0x5f3290,_0x37ada5){_0x37ada5[_0x6404('0x107')](path[_0x6404('0x108')](_0x427ca4[_0x6404('0x106')]('appPath')+_0x6404('0x109')));});}; \ No newline at end of file +var _0x9003=['/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','./api/openchannelMessage','./api/openchannelQueue','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','/api/chat/groups','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmHopperHistory','./api/cmCustomField','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','./api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','./api/tag','/api/templates','./api/template','/api/triggers','/api/variables','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/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/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/fax/reports/transfer','./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/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','./api/rpc','/api/version','./api/version','/api/system','/api/pm2','./api/pm2','/apidoc','static','join','root','/www','/demo','/snippet','1.0.16','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','express-winston','util','./errors','./config/environment','./config/logger','api','auth','default','use','logger','format','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','method','x-forwarded-for','connection','remoteAddress','statusCode','responseTime','user','role','body','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','headers','url','name','other','agent_name','/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/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','/api/voice/calls/reports','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/interactions','./api/mailInteraction','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount'];(function(_0x502edf,_0x2cd838){var _0x19c60b=function(_0x11723c){while(--_0x11723c){_0x502edf['push'](_0x502edf['shift']());}};_0x19c60b(++_0x2cd838);}(_0x9003,0xcd));var _0x3900=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x9003[_0xa464c9];return _0x3d73c4;};'use strict';var path=require(_0x3900('0x0'));var express=require('express');var ewinston=require(_0x3900('0x1'));var util=require(_0x3900('0x2'));var errors=require(_0x3900('0x3'));var config=require(_0x3900('0x4'));var logger=require(_0x3900('0x5'))(_0x3900('0x6'));var authLogger=require(_0x3900('0x5'))(_0x3900('0x7'));exports[_0x3900('0x8')]=function(_0x486c30){_0x486c30[_0x3900('0x9')](ewinston[_0x3900('0xa')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x50281e,_0x2b550c){return util[_0x3900('0xb')](_0x3900('0xc'),_0x50281e[_0x3900('0xd')],_0x50281e['headers']['x-forwarded-for']?_0x50281e['headers'][_0x3900('0xe')]:_0x50281e[_0x3900('0xf')][_0x3900('0x10')]||_0x50281e['ip'],_0x50281e['url'],_0x2b550c[_0x3900('0x11')],_0x2b550c[_0x3900('0x12')],_0x50281e[_0x3900('0x13')]?_0x50281e[_0x3900('0x13')]['id']:null,_0x50281e[_0x3900('0x13')]?_0x50281e[_0x3900('0x13')]['name']:null,_0x50281e[_0x3900('0x13')]?_0x50281e['user'][_0x3900('0x14')]:null);}}));_0x486c30['use'](ewinston['logger']({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x23a4d0,_0x1f2296){var _0x2bcb5e='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x23a4d0['body']&&_0x23a4d0[_0x3900('0x15')][_0x3900('0x16')]&&_0x23a4d0[_0x3900('0x15')][_0x3900('0x17')]){_0x2bcb5e=_0x3900('0x18');}return util[_0x3900('0xb')](_0x2bcb5e,_0x23a4d0[_0x3900('0xd')],_0x23a4d0[_0x3900('0x19')][_0x3900('0xe')]?_0x23a4d0['headers'][_0x3900('0xe')]:_0x23a4d0['connection']['remoteAddress']||_0x23a4d0['ip'],_0x23a4d0[_0x3900('0x1a')],_0x1f2296[_0x3900('0x11')],_0x1f2296[_0x3900('0x12')],_0x23a4d0[_0x3900('0x13')]?_0x23a4d0[_0x3900('0x13')]['id']:null,_0x23a4d0['user']?_0x23a4d0[_0x3900('0x13')][_0x3900('0x1b')]:null,_0x23a4d0[_0x3900('0x13')]?_0x23a4d0['user'][_0x3900('0x14')]:null,_0x23a4d0[_0x3900('0x15')]&&_0x23a4d0[_0x3900('0x15')][_0x3900('0x16')]?_0x23a4d0[_0x3900('0x15')][_0x3900('0x16')]:_0x3900('0x1c'),_0x23a4d0['body']&&_0x23a4d0['body'][_0x3900('0x17')]?_0x23a4d0['body']['agent_id']:'',_0x23a4d0['body']&&_0x23a4d0[_0x3900('0x15')][_0x3900('0x1d')]?_0x23a4d0[_0x3900('0x15')]['agent_name']:'');},'ignoreRoute':function(_0x149f91){var _0x328b3b=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x328b3b['test'](_0x149f91[_0x3900('0x1a')]);}}));_0x486c30['use'](_0x3900('0x1e'),require(_0x3900('0x1f')));_0x486c30[_0x3900('0x9')](_0x3900('0x20'),require('./api/voiceChanSpy'));_0x486c30[_0x3900('0x9')](_0x3900('0x21'),require(_0x3900('0x22')));_0x486c30[_0x3900('0x9')]('/api/voice/extensions',require(_0x3900('0x23')));_0x486c30[_0x3900('0x9')](_0x3900('0x24'),require(_0x3900('0x25')));_0x486c30[_0x3900('0x9')](_0x3900('0x26'),require(_0x3900('0x27')));_0x486c30[_0x3900('0x9')]('/api/voice/recordings',require(_0x3900('0x28')));_0x486c30[_0x3900('0x9')](_0x3900('0x29'),require(_0x3900('0x2a')));_0x486c30[_0x3900('0x9')](_0x3900('0x2b'),require(_0x3900('0x2c')));_0x486c30['use'](_0x3900('0x2d'),require('./api/voiceMailMessage'));_0x486c30[_0x3900('0x9')](_0x3900('0x2e'),require(_0x3900('0x2f')));_0x486c30['use']('/api/voice/dials/reports',require(_0x3900('0x30')));_0x486c30['use'](_0x3900('0x31'),require(_0x3900('0x32')));_0x486c30[_0x3900('0x9')](_0x3900('0x33'),require(_0x3900('0x34')));_0x486c30[_0x3900('0x9')](_0x3900('0x35'),require(_0x3900('0x36')));_0x486c30[_0x3900('0x9')](_0x3900('0x37'),require(_0x3900('0x38')));_0x486c30['use']('/api/voice/transfers/reports',require(_0x3900('0x39')));_0x486c30['use'](_0x3900('0x3a'),require(_0x3900('0x3b')));_0x486c30['use'](_0x3900('0x3c'),require(_0x3900('0x3d')));_0x486c30[_0x3900('0x9')]('/api/mail/queues',require('./api/mailQueue'));_0x486c30['use']('/api/mail/substatuses',require('./api/mailSubstatus'));_0x486c30[_0x3900('0x9')](_0x3900('0x3e'),require(_0x3900('0x3f')));_0x486c30[_0x3900('0x9')]('/api/mail/messages',require('./api/mailMessage'));_0x486c30[_0x3900('0x9')](_0x3900('0x40'),require(_0x3900('0x41')));_0x486c30[_0x3900('0x9')]('/api/mail/reports/queue',require(_0x3900('0x42')));_0x486c30[_0x3900('0x9')](_0x3900('0x43'),require('./api/dashboard'));_0x486c30[_0x3900('0x9')](_0x3900('0x44'),require(_0x3900('0x45')));_0x486c30['use'](_0x3900('0x46'),require(_0x3900('0x47')));_0x486c30[_0x3900('0x9')](_0x3900('0x48'),require(_0x3900('0x49')));_0x486c30[_0x3900('0x9')]('/api/fax/interactions',require(_0x3900('0x4a')));_0x486c30[_0x3900('0x9')]('/api/fax/messages',require('./api/faxMessage'));_0x486c30['use'](_0x3900('0x4b'),require(_0x3900('0x4c')));_0x486c30[_0x3900('0x9')](_0x3900('0x4d'),require(_0x3900('0x4e')));_0x486c30[_0x3900('0x9')](_0x3900('0x4f'),require('./api/smsAccount'));_0x486c30[_0x3900('0x9')]('/api/sms/applications',require(_0x3900('0x50')));_0x486c30[_0x3900('0x9')](_0x3900('0x51'),require(_0x3900('0x52')));_0x486c30[_0x3900('0x9')](_0x3900('0x53'),require(_0x3900('0x54')));_0x486c30[_0x3900('0x9')](_0x3900('0x55'),require(_0x3900('0x56')));_0x486c30[_0x3900('0x9')](_0x3900('0x57'),require(_0x3900('0x58')));_0x486c30[_0x3900('0x9')](_0x3900('0x59'),require(_0x3900('0x5a')));_0x486c30['use']('/api/openchannel/interactions',require(_0x3900('0x5b')));_0x486c30[_0x3900('0x9')]('/api/openchannel/messages',require(_0x3900('0x5c')));_0x486c30['use']('/api/openchannel/queues',require(_0x3900('0x5d')));_0x486c30['use']('/api/chat/websites',require('./api/chatWebsite'));_0x486c30[_0x3900('0x9')](_0x3900('0x5e'),require(_0x3900('0x5f')));_0x486c30[_0x3900('0x9')](_0x3900('0x60'),require('./api/chatApplication'));_0x486c30[_0x3900('0x9')]('/api/chat/interactions',require(_0x3900('0x61')));_0x486c30[_0x3900('0x9')](_0x3900('0x62'),require(_0x3900('0x63')));_0x486c30[_0x3900('0x9')](_0x3900('0x64'),require('./api/chatOfflineMessage'));_0x486c30[_0x3900('0x9')](_0x3900('0x65'),require('./api/chatQueue'));_0x486c30[_0x3900('0x9')](_0x3900('0x66'),require('./api/chatGroup'));_0x486c30['use'](_0x3900('0x67'),require(_0x3900('0x68')));_0x486c30[_0x3900('0x9')](_0x3900('0x69'),require(_0x3900('0x6a')));_0x486c30['use'](_0x3900('0x6b'),require(_0x3900('0x6c')));_0x486c30['use']('/api/cm/hopper',require(_0x3900('0x6d')));_0x486c30[_0x3900('0x9')](_0x3900('0x6e'),require(_0x3900('0x6f')));_0x486c30[_0x3900('0x9')](_0x3900('0x70'),require(_0x3900('0x71')));_0x486c30[_0x3900('0x9')]('/api/cm/hopper_history',require(_0x3900('0x72')));_0x486c30['use']('/api/cm/custom_fields',require(_0x3900('0x73')));_0x486c30[_0x3900('0x9')]('/api/actions',require(_0x3900('0x74')));_0x486c30['use'](_0x3900('0x75'),require(_0x3900('0x76')));_0x486c30['use'](_0x3900('0x77'),require(_0x3900('0x78')));_0x486c30[_0x3900('0x9')](_0x3900('0x79'),require('./api/disposition'));_0x486c30[_0x3900('0x9')](_0x3900('0x7a'),require(_0x3900('0x7b')));_0x486c30[_0x3900('0x9')](_0x3900('0x7c'),require(_0x3900('0x7d')));_0x486c30['use'](_0x3900('0x7e'),require(_0x3900('0x7f')));_0x486c30[_0x3900('0x9')]('/api/cdr',require(_0x3900('0x80')));_0x486c30[_0x3900('0x9')]('/api/voiceQueuesLog',require(_0x3900('0x81')));_0x486c30[_0x3900('0x9')](_0x3900('0x82'),require(_0x3900('0x83')));_0x486c30[_0x3900('0x9')](_0x3900('0x84'),require(_0x3900('0x85')));_0x486c30['use']('/api/tags',require(_0x3900('0x86')));_0x486c30['use'](_0x3900('0x87'),require(_0x3900('0x88')));_0x486c30[_0x3900('0x9')](_0x3900('0x89'),require('./api/trigger'));_0x486c30[_0x3900('0x9')](_0x3900('0x8a'),require('./api/variable'));_0x486c30[_0x3900('0x9')](_0x3900('0x8b'),require(_0x3900('0x8c')));_0x486c30[_0x3900('0x9')](_0x3900('0x8d'),require(_0x3900('0x8e')));_0x486c30[_0x3900('0x9')]('/api/analytics/custom_reports',require('./api/analyticCustomReport'));_0x486c30[_0x3900('0x9')](_0x3900('0x8f'),require(_0x3900('0x90')));_0x486c30[_0x3900('0x9')]('/api/analytics/extracted_reports',require(_0x3900('0x91')));_0x486c30['use'](_0x3900('0x92'),require('./api/analyticMetric'));_0x486c30['use'](_0x3900('0x93'),require(_0x3900('0x94')));_0x486c30[_0x3900('0x9')](_0x3900('0x95'),require(_0x3900('0x96')));_0x486c30[_0x3900('0x9')](_0x3900('0x97'),require(_0x3900('0x98')));_0x486c30[_0x3900('0x9')](_0x3900('0x99'),require('./api/intSalesforceConfiguration'));_0x486c30['use'](_0x3900('0x9a'),require('./api/intSalesforceField'));_0x486c30[_0x3900('0x9')](_0x3900('0x9b'),require(_0x3900('0x9c')));_0x486c30[_0x3900('0x9')]('/api/integrations/sugarcrm/configurations',require(_0x3900('0x9d')));_0x486c30[_0x3900('0x9')]('/api/integrations/sugarcrm/fields',require(_0x3900('0x9e')));_0x486c30[_0x3900('0x9')](_0x3900('0x9f'),require('./api/intDeskAccount'));_0x486c30[_0x3900('0x9')](_0x3900('0xa0'),require(_0x3900('0xa1')));_0x486c30[_0x3900('0x9')](_0x3900('0xa2'),require(_0x3900('0xa3')));_0x486c30[_0x3900('0x9')]('/api/integrations/zoho/accounts',require(_0x3900('0xa4')));_0x486c30['use'](_0x3900('0xa5'),require(_0x3900('0xa6')));_0x486c30['use']('/api/integrations/zoho/fields',require('./api/intZohoField'));_0x486c30[_0x3900('0x9')](_0x3900('0xa7'),require(_0x3900('0xa8')));_0x486c30[_0x3900('0x9')](_0x3900('0xa9'),require(_0x3900('0xaa')));_0x486c30['use'](_0x3900('0xab'),require(_0x3900('0xac')));_0x486c30[_0x3900('0x9')](_0x3900('0xad'),require(_0x3900('0xae')));_0x486c30[_0x3900('0x9')]('/api/integrations/freshdesk/configurations',require(_0x3900('0xaf')));_0x486c30[_0x3900('0x9')](_0x3900('0xb0'),require('./api/intFreshdeskField'));_0x486c30[_0x3900('0x9')](_0x3900('0xb1'),require(_0x3900('0xb2')));_0x486c30['use'](_0x3900('0xb3'),require(_0x3900('0xb4')));_0x486c30['use'](_0x3900('0xb5'),require(_0x3900('0xb6')));_0x486c30[_0x3900('0x9')](_0x3900('0xb7'),require(_0x3900('0xb8')));_0x486c30[_0x3900('0x9')](_0x3900('0xb9'),require(_0x3900('0xba')));_0x486c30[_0x3900('0x9')]('/api/integrations/servicenow/fields',require(_0x3900('0xbb')));_0x486c30[_0x3900('0x9')]('/api/integrations/dynamics365/accounts',require(_0x3900('0xbc')));_0x486c30[_0x3900('0x9')](_0x3900('0xbd'),require('./api/intDynamics365Configuration'));_0x486c30[_0x3900('0x9')](_0x3900('0xbe'),require('./api/intDynamics365Field'));_0x486c30[_0x3900('0x9')](_0x3900('0xbf'),require('./api/intFreshsalesAccount'));_0x486c30['use'](_0x3900('0xc0'),require(_0x3900('0xc1')));_0x486c30['use'](_0x3900('0xc2'),require(_0x3900('0xc3')));_0x486c30[_0x3900('0x9')]('/api/networks',require(_0x3900('0xc4')));_0x486c30['use'](_0x3900('0xc5'),require(_0x3900('0xc6')));_0x486c30['use'](_0x3900('0xc7'),require('./api/chatInternalMessage'));_0x486c30['use'](_0x3900('0xc8'),require(_0x3900('0xc9')));_0x486c30['use'](_0x3900('0xca'),require(_0x3900('0xcb')));_0x486c30[_0x3900('0x9')]('/api/jscripty/sessions/reports',require('./api/jscriptySessionReport'));_0x486c30[_0x3900('0x9')](_0x3900('0xcc'),require(_0x3900('0xcd')));_0x486c30[_0x3900('0x9')](_0x3900('0xce'),require(_0x3900('0xcf')));_0x486c30['use'](_0x3900('0xd0'),require(_0x3900('0xd1')));_0x486c30['use'](_0x3900('0xd2'),require(_0x3900('0xd3')));_0x486c30['use'](_0x3900('0xd4'),require(_0x3900('0xd5')));_0x486c30['use'](_0x3900('0xd6'),require(_0x3900('0xd7')));_0x486c30[_0x3900('0x9')]('/api/square/projects',require(_0x3900('0xd8')));_0x486c30[_0x3900('0x9')](_0x3900('0xd9'),require(_0x3900('0xda')));_0x486c30['use'](_0x3900('0xdb'),require(_0x3900('0xdc')));_0x486c30['use'](_0x3900('0xdd'),require(_0x3900('0xde')));_0x486c30[_0x3900('0x9')](_0x3900('0xdf'),require(_0x3900('0xe0')));_0x486c30[_0x3900('0x9')](_0x3900('0xe1'),require('./api/campaign'));_0x486c30['use']('/api/migrations',require(_0x3900('0xe2')));_0x486c30[_0x3900('0x9')](_0x3900('0xe3'),require(_0x3900('0xe4')));_0x486c30[_0x3900('0x9')](_0x3900('0xe5'),require(_0x3900('0xe6')));_0x486c30[_0x3900('0x9')](_0x3900('0xe7'),require(_0x3900('0xe8')));_0x486c30[_0x3900('0x9')]('/api/chat/reports/transfer',require('./api/chatTransferReport'));_0x486c30[_0x3900('0x9')](_0x3900('0xe9'),require(_0x3900('0xea')));_0x486c30[_0x3900('0x9')](_0x3900('0xeb'),require(_0x3900('0xec')));_0x486c30[_0x3900('0x9')](_0x3900('0xed'),require(_0x3900('0xee')));_0x486c30['use'](_0x3900('0xef'),require(_0x3900('0xf0')));_0x486c30['use'](_0x3900('0xf1'),require(_0x3900('0xf2')));_0x486c30[_0x3900('0x9')](_0x3900('0xf3'),require(_0x3900('0xf4')));_0x486c30[_0x3900('0x9')](_0x3900('0xf5'),require(_0x3900('0xf6')));_0x486c30[_0x3900('0x9')](_0x3900('0xf7'),require(_0x3900('0xf8')));_0x486c30[_0x3900('0x9')](_0x3900('0xf9'),require(_0x3900('0xfa')));_0x486c30[_0x3900('0x9')](_0x3900('0xfb'),require(_0x3900('0xfc')));_0x486c30[_0x3900('0x9')](_0x3900('0xfd'),require(_0x3900('0xfe')));_0x486c30[_0x3900('0x9')]('/api/rpc',require(_0x3900('0xff')));_0x486c30[_0x3900('0x9')](_0x3900('0x100'),require(_0x3900('0x101')));_0x486c30['use'](_0x3900('0x102'),require('./api/system'));_0x486c30['use'](_0x3900('0x103'),require(_0x3900('0x104')));_0x486c30[_0x3900('0x9')](_0x3900('0x105'),express[_0x3900('0x106')](path[_0x3900('0x107')](config[_0x3900('0x108')],_0x3900('0x105'))));_0x486c30[_0x3900('0x9')](_0x3900('0x109'),express[_0x3900('0x106')](path['join'](config['root'],_0x3900('0x109'))));_0x486c30[_0x3900('0x9')](_0x3900('0x10a'),express['static'](path['join'](config[_0x3900('0x108')],_0x3900('0x10a'))));_0x486c30['use'](_0x3900('0x10b'),express[_0x3900('0x106')](path[_0x3900('0x107')](config[_0x3900('0x108')],'snippet',_0x3900('0x10c'))));_0x486c30['use']('/plugins',express[_0x3900('0x106')](path['join'](config[_0x3900('0x108')],_0x3900('0x10d'))));_0x486c30[_0x3900('0x10e')](_0x3900('0x10f'))[_0x3900('0x110')](errors[0x194]);_0x486c30[_0x3900('0x10e')]('/*')[_0x3900('0x110')](function(_0x62a008,_0xb4e372){_0xb4e372[_0x3900('0x111')](path[_0x3900('0x112')](_0x486c30[_0x3900('0x110')](_0x3900('0x113'))+_0x3900('0x114')));});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 30670cf..49c31d3 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5491=['../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','http','rpc','port','localhost','error','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc'];(function(_0x275bdf,_0x5170d6){var _0x3fb2d5=function(_0x3f6e60){while(--_0x3f6e60){_0x275bdf['push'](_0x275bdf['shift']());}};_0x3fb2d5(++_0x5170d6);}(_0x5491,0xd2));var _0x1549=function(_0x551941,_0x33f48a){_0x551941=_0x551941-0x0;var _0xa94322=_0x5491[_0x551941];return _0xa94322;};'use strict';var jayson=require(_0x1549('0x0'));var BPromise=require('bluebird');var _=require(_0x1549('0x1'));var config=require(_0x1549('0x2'));exports['listen']=function(){return new BPromise(function(_0x22de5e,_0x306e12){var _0x21f8ff={};_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x4')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require('../api/voiceExtension/voiceExtension.rpc'));_0x21f8ff=_['merge'](_0x21f8ff,require(_0x1549('0x5')));_0x21f8ff=_['merge'](_0x21f8ff,require(_0x1549('0x6')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x7')));_0x21f8ff=_['merge'](_0x21f8ff,require(_0x1549('0x8')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x9')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0xa')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0xb')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0xc')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0xd')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0xe')));_0x21f8ff=_['merge'](_0x21f8ff,require(_0x1549('0xf')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require('../api/mailInteraction/mailInteraction.rpc'));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require('../api/mailMessage/mailMessage.rpc'));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x10')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x11')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x12')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x13')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require('../api/faxInteraction/faxInteraction.rpc'));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x14')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x15')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x21f8ff=_['merge'](_0x21f8ff,require(_0x1549('0x16')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x17')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x18')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x19')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x1a')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x1b')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x1c')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x1d')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x1e')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require('../api/chatInteraction/chatInteraction.rpc'));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x1f')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x20')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x21')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x22')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x23')));_0x21f8ff=_['merge'](_0x21f8ff,require(_0x1549('0x24')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x25')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x26')));_0x21f8ff=_['merge'](_0x21f8ff,require('../api/interval/interval.rpc'));_0x21f8ff=_['merge'](_0x21f8ff,require(_0x1549('0x27')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x28')));_0x21f8ff=_['merge'](_0x21f8ff,require('../api/template/template.rpc'));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x29')));_0x21f8ff=_['merge'](_0x21f8ff,require(_0x1549('0x2a')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x2b')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x2c')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x2d')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x2e')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x2f')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x30')));_0x21f8ff=_['merge'](_0x21f8ff,require(_0x1549('0x31')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x32')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x33')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x34')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x35')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require('../api/squareReport/squareReport.rpc'));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x36')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x37')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x38')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x39')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x3a')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x3b')));_0x21f8ff=_['merge'](_0x21f8ff,require(_0x1549('0x3c')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require('../api/plugin/plugin.rpc'));var _0x5e1ea7=jayson['server'](_0x21f8ff)[_0x1549('0x3d')]();var _0x3e91cc=config[_0x1549('0x3e')][_0x1549('0x3f')]||config[_0x1549('0x3f')]+0x1;var _0x365749=config[_0x1549('0x3e')]['ip']||_0x1549('0x40');_0x5e1ea7['on'](_0x1549('0x41'),function(_0x37dce3){return _0x306e12(_0x37dce3);});_0x5e1ea7[_0x1549('0x42')](_0x3e91cc,_0x365749,function(){console[_0x1549('0x43')](_0x1549('0x44'),_0x365749,_0x3e91cc);require(_0x1549('0x45'))[_0x1549('0x46')]();return _0x22de5e(_0x1549('0x47')+_0x365749+':'+_0x3e91cc);});});}; \ No newline at end of file +var _0x3ea0=['../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','http','rpc','port','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','listen','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.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/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.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'];(function(_0x4e00d4,_0xdb24a3){var _0x335d2c=function(_0x19d6eb){while(--_0x19d6eb){_0x4e00d4['push'](_0x4e00d4['shift']());}};_0x335d2c(++_0xdb24a3);}(_0x3ea0,0x1bd));var _0x03ea=function(_0x1daebd,_0x79a89){_0x1daebd=_0x1daebd-0x0;var _0x462a89=_0x3ea0[_0x1daebd];return _0x462a89;};'use strict';var jayson=require(_0x03ea('0x0'));var BPromise=require(_0x03ea('0x1'));var _=require(_0x03ea('0x2'));var config=require('../config/environment');exports[_0x03ea('0x3')]=function(){return new BPromise(function(_0x16a92c,_0xc43faa){var _0x11e061={};_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x5')));_0x11e061=_['merge'](_0x11e061,require('../api/voiceExtension/voiceExtension.rpc'));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x6')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x7')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x8')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x9')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0xa')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0xb')));_0x11e061=_['merge'](_0x11e061,require(_0x03ea('0xc')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0xd')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0xe')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0xf')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require('../api/mailAccount/mailAccount.rpc'));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x10')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x11')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require('../api/mailMessage/mailMessage.rpc'));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require('../api/mailApplication/mailApplication.rpc'));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require('../api/faxAccount/faxAccount.rpc'));_0x11e061=_['merge'](_0x11e061,require(_0x03ea('0x12')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x13')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x14')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x15')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x16')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x17')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x18')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x19')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x1a')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x11e061=_['merge'](_0x11e061,require(_0x03ea('0x1b')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x1c')));_0x11e061=_['merge'](_0x11e061,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x11e061=_['merge'](_0x11e061,require(_0x03ea('0x1d')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x1e')));_0x11e061=_['merge'](_0x11e061,require(_0x03ea('0x1f')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x20')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x21')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x22')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x23')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x24')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x25')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x26')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x27')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x28')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require('../api/template/template.rpc'));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x29')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x2a')));_0x11e061=_['merge'](_0x11e061,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x2b')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x2c')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x2d')));_0x11e061=_['merge'](_0x11e061,require(_0x03ea('0x2e')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x2f')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x30')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x31')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x32')));_0x11e061=_['merge'](_0x11e061,require(_0x03ea('0x33')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x34')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x35')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x36')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x37')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x38')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x39')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x3a')));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require('../api/attachment/attachment.rpc'));_0x11e061=_[_0x03ea('0x4')](_0x11e061,require(_0x03ea('0x3b')));var _0x52d4e5=jayson['server'](_0x11e061)[_0x03ea('0x3c')]();var _0x4dd888=config[_0x03ea('0x3d')][_0x03ea('0x3e')]||config[_0x03ea('0x3e')]+0x1;var _0xc7a124=config[_0x03ea('0x3d')]['ip']||'localhost';_0x52d4e5['on'](_0x03ea('0x3f'),function(_0x57f1dd){return _0xc43faa(_0x57f1dd);});_0x52d4e5['listen'](_0x4dd888,_0xc7a124,function(){console[_0x03ea('0x40')](_0x03ea('0x41'),_0xc7a124,_0x4dd888);require(_0x03ea('0x42'))[_0x03ea('0x43')]();return _0x16a92c(_0x03ea('0x44')+_0xc7a124+':'+_0x4dd888);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 51b238d..acd28ab 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 _0x9c44=['no\x20code','replace','result=','indexOf','substr','startsWith','length','match','error','E_AGI_SOCKET_ERROR','code','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','inherits','prototype','sendRequest','sync','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setExtension','noop','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','events','EventEmitter','./reply','./error','setEncoding','utf8','setTimeout','emit','ready','toLowerCase','hangup','substring','520\x20End\x20of\x20proper','function'];(function(_0x1e500e,_0x2c9d74){var _0x10dc5e=function(_0x354423){while(--_0x354423){_0x1e500e['push'](_0x1e500e['shift']());}};_0x10dc5e(++_0x2c9d74);}(_0x9c44,0x178));var _0x49c4=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x9c44[_0x2d7f0e];return _0x110b07;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIReply=require(_0x49c4('0x2'));var AGIError=require(_0x49c4('0x3'));function AGIChannel(_0x455700){var _0x2ad237=this,_0x4e0313=new AGIReply(),_0x4941f1=![],_0x41a183={};EventEmitter['call'](_0x2ad237);_0x455700[_0x49c4('0x4')](_0x49c4('0x5'));_0x455700[_0x49c4('0x6')](0x8*0x3c*0x3c*0x3e8);_0x4e0313[_0x49c4('0x4')](_0x49c4('0x5'));_0x4e0313['on']('headers',function(_0x11c586){for(var _0x42e4f8 in _0x11c586){_0x2ad237[_0x42e4f8]=_0x11c586[_0x42e4f8];}_0x2ad237[_0x49c4('0x7')](_0x49c4('0x8'));});_0x4e0313['on']('line',function(_0x5ab4a3){if(_0x5ab4a3[_0x49c4('0x9')]()==_0x49c4('0xa')){_0x2ad237['emit'](_0x49c4('0xa'));return;}if(_0x5ab4a3[_0x49c4('0xb')](0x0,0xb)=='520-Invalid'){_0x4941f1=!![];}if(_0x4941f1){_0x41a183['rx']+=_0x5ab4a3+'\x0a';if(_0x5ab4a3['search'](_0x49c4('0xc'))!=-0x1){_0x4941f1=![];}}else{_0x41a183['rx']=_0x5ab4a3;}if(_0x4941f1){return;}if(typeof _0x41a183['cb']==_0x49c4('0xd')){var _0x5487cd=_0x41a183['rx']['substring'](0x0,0x3),_0x7df3a9=null,_0x403bfb=null;_0x5487cd=parseInt(_0x5487cd);if(isNaN(_0x5487cd)){_0x41a183['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x49c4('0xe')});return;}if(_0x5487cd!=0xc8){_0x41a183['cb'](null,{'code':_0x5487cd,'result':-0x1,'extra':'KO'});return;}_0x7df3a9=_0x41a183['rx'][_0x49c4('0xb')](0x4)[_0x49c4('0xf')](_0x49c4('0x10'),'');if(_0x7df3a9[_0x49c4('0x11')]('\x20')!=-0x1){_0x7df3a9=_0x7df3a9[_0x49c4('0x12')](0x0,_0x7df3a9[_0x49c4('0x11')]('\x20'));}if(_[_0x49c4('0x13')](_0x7df3a9,'-1')){_0x7df3a9=parseInt(_0x7df3a9);}_0x403bfb=_0x41a183['rx']['split']('\x20');if(_0x403bfb[_0x49c4('0x14')]==0x3){_0x403bfb=_0x403bfb[0x2][_0x49c4('0xb')](0x1,_0x403bfb[0x2][_0x49c4('0x14')]-0x1);}else if(_0x403bfb[_0x49c4('0x14')]>0x3){var _0x2abc78=/\((.+)\)/;var _0x53e3a2=_0x41a183['rx'][_0x49c4('0x15')](_0x2abc78);if(_0x53e3a2){_0x403bfb=_0x53e3a2[0x1];}else{_0x403bfb=null;}}else{_0x403bfb=null;}_0x41a183['cb'](null,{'code':_0x5487cd,'result':_0x7df3a9,'extra':_0x403bfb});}});_0x455700['on'](_0x49c4('0x16'),function(_0x4c3253){_0x2ad237['emit'](_0x49c4('0x16'),new AGIError(_0x49c4('0x17'),_0x4c3253[_0x49c4('0x18')]));});_0x455700['on']('close',function(){_0x2ad237[_0x49c4('0x7')]('close',new AGIError(_0x49c4('0x19')));});_0x455700['on'](_0x49c4('0x1a'),function(){_0x2ad237[_0x49c4('0x7')](_0x49c4('0x1a'),new AGIError(_0x49c4('0x1b')));_0x455700[_0x49c4('0x1c')]();});_0x455700[_0x49c4('0x1d')](_0x4e0313);this[_0x49c4('0x1e')]=function(_0x2197d2,_0x578447){var _0x2197d2=_0x2197d2||'',_0x578447=typeof _0x578447==_0x49c4('0xd')?_0x578447:new Function();_0x41a183={'tx':_0x2197d2,'rx':'','cb':_0x578447};_0x455700['write'](_0x2197d2+'\x0a');},this['close']=function(){_0x455700[_0x49c4('0x1c')]();};}util[_0x49c4('0x1f')](AGIChannel,EventEmitter);AGIChannel[_0x49c4('0x20')][_0x49c4('0x21')]=function(_0x4811c4){return this['command'][_0x49c4('0x22')](this,_0x4811c4);};AGIChannel[_0x49c4('0x20')]['answer']=function(){return this[_0x49c4('0x21')](_0x49c4('0x23'));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x24')]=function(_0x531d92,_0x543ea2,_0x449960){_0x531d92=_0x531d92===undefined?'beep':_0x531d92;_0x543ea2=_0x543ea2===undefined?'5':_0x543ea2;_0x449960=_0x449960===undefined?'1':_0x449960;return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x26'),_0x531d92,_0x543ea2*0x3e8,_0x449960));};AGIChannel[_0x49c4('0x20')]['noop']=function(_0x889909){_0x889909=_0x889909||_0x49c4('0x27');return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x28'),_0x889909));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x29')]=function(_0x427b26,_0x17b50f){if(_[_0x49c4('0x2a')](_0x17b50f)){return this[_0x49c4('0x21')](util['format']('EXEC\x20%s\x20%s',_0x427b26,_0x17b50f['join'](',')));}return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2b'),_0x427b26,_0x17b50f));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x2c')]=function(_0x574fd3){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2d'),_0x574fd3));};AGIChannel[_0x49c4('0x20')]['setExtension']=function(_0x57a29c){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2e'),_0x57a29c));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x2f')]=function(_0x4a0c7a){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x30'),_0x4a0c7a));};AGIChannel['prototype']['hangup']=function(){return this[_0x49c4('0x21')](_0x49c4('0x31'));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x32')]=function(_0x2b45a1,_0x2cf897){var _0x1d1557=_[_0x49c4('0x33')](_0x2cf897)||_[_0x49c4('0x34')](_0x2cf897)?_0x2cf897['toString']():_0x2cf897;return this[_0x49c4('0x21')](util['format'](_0x49c4('0x35'),_0x2b45a1,_0x1d1557?_0x1d1557[_0x49c4('0x36')]()[_0x49c4('0xf')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x49c4('0x20')]['sayNumber']=function(_0x335f0c,_0x31f3ff){return this[_0x49c4('0x21')](util['format'](_0x49c4('0x37'),_0x335f0c,_0x31f3ff));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x38')]=function(_0x5e5366,_0x1ba7a0){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x39'),_0x5e5366,_0x1ba7a0));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x3a')]=function(_0x1e506a,_0x4e0663){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x3b'),_0x1e506a,_0x4e0663));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x3c')]=function(_0x29dd5d,_0x1be62d,_0xc9722b){_0x1be62d=_0x1be62d||this[_0x49c4('0x3d')];_0xc9722b=_0xc9722b||0x1;this[_0x49c4('0x2c')](_0x29dd5d);this[_0x49c4('0x3e')](_0x1be62d);this[_0x49c4('0x2f')](_0xc9722b);return this[_0x49c4('0x3f')](util['format'](_0x49c4('0x40'),_0x29dd5d,_0x1be62d,_0xc9722b));};AGIChannel['prototype'][_0x49c4('0x41')]=function(_0x4915bc){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x42'),_0x4915bc));};AGIChannel[_0x49c4('0x20')]['recordFile']=function(_0x4d628a,_0x20490b,_0x1e7bdc,_0x38349b,_0x117151,_0x490823){_0x20490b=_0x20490b||_0x49c4('0x43');_0x1e7bdc=_0x1e7bdc||'';_0x38349b=_0x38349b===undefined?-0x1:_0x38349b==='-1'?-0x1:_0x38349b*0x3e8;_0x117151=_0x117151===undefined?'':'s='+_0x117151;_0x490823=_0x490823?_0x49c4('0x44'):'';return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x45'),_0x4d628a,_0x20490b,_0x1e7bdc,_0x38349b,_0x490823,_0x117151));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x46')]=function(_0x3351c1,_0x3c4a1d){_0x3c4a1d=_0x3c4a1d||'';return this['sendRequest'](util[_0x49c4('0x25')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x3351c1,_0x3c4a1d));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x47')]=function(_0x301def){return this[_0x49c4('0x29')](_0x49c4('0x48'),_0x301def);};AGIChannel['prototype'][_0x49c4('0x49')]=function(_0x15b674){return this[_0x49c4('0x29')](_0x49c4('0x4a'),_0x15b674);};AGIChannel[_0x49c4('0x20')][_0x49c4('0x16')]=function(_0x9779ef,_0x4d89e0){this[_0x49c4('0x3f')](util['format'](_0x49c4('0x4b'),_0x9779ef['id'],_0x9779ef[_0x49c4('0x4c')],_0x4d89e0));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x49c4('0x4d')]=AGIChannel; \ No newline at end of file +var _0xe706=['wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','label','exports','util','lodash','events','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','hangup','search','520\x20End\x20of\x20proper','function','substring','no\x20code','indexOf','startsWith','split','length','error','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','inherits','command','sync','answer','sendRequest','prototype','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','join','EXEC\x20%s\x20%s','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setExtension','noop','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile'];(function(_0x20a394,_0x5c4e0c){var _0x8a454f=function(_0x26d21c){while(--_0x26d21c){_0x20a394['push'](_0x20a394['shift']());}};_0x8a454f(++_0x5c4e0c);}(_0xe706,0xa3));var _0x6e70=function(_0x40174f,_0x3a6751){_0x40174f=_0x40174f-0x0;var _0x40717c=_0xe706[_0x40174f];return _0x40717c;};'use strict';var util=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIReply=require(_0x6e70('0x3'));var AGIError=require(_0x6e70('0x4'));function AGIChannel(_0x2ca810){var _0x7dfbc3=this,_0x142c27=new AGIReply(),_0x2164a4=![],_0x376a8d={};EventEmitter[_0x6e70('0x5')](_0x7dfbc3);_0x2ca810[_0x6e70('0x6')](_0x6e70('0x7'));_0x2ca810[_0x6e70('0x8')](0x8*0x3c*0x3c*0x3e8);_0x142c27[_0x6e70('0x6')](_0x6e70('0x7'));_0x142c27['on'](_0x6e70('0x9'),function(_0x3c4843){for(var _0x449b48 in _0x3c4843){_0x7dfbc3[_0x449b48]=_0x3c4843[_0x449b48];}_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0xb'));});_0x142c27['on'](_0x6e70('0xc'),function(_0x463853){if(_0x463853[_0x6e70('0xd')]()==_0x6e70('0xe')){_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0xe'));return;}if(_0x463853['substring'](0x0,0xb)=='520-Invalid'){_0x2164a4=!![];}if(_0x2164a4){_0x376a8d['rx']+=_0x463853+'\x0a';if(_0x463853[_0x6e70('0xf')](_0x6e70('0x10'))!=-0x1){_0x2164a4=![];}}else{_0x376a8d['rx']=_0x463853;}if(_0x2164a4){return;}if(typeof _0x376a8d['cb']==_0x6e70('0x11')){var _0x27dd9b=_0x376a8d['rx'][_0x6e70('0x12')](0x0,0x3),_0x3b38f3=null,_0x310eb7=null;_0x27dd9b=parseInt(_0x27dd9b);if(isNaN(_0x27dd9b)){_0x376a8d['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x6e70('0x13')});return;}if(_0x27dd9b!=0xc8){_0x376a8d['cb'](null,{'code':_0x27dd9b,'result':-0x1,'extra':'KO'});return;}_0x3b38f3=_0x376a8d['rx']['substring'](0x4)['replace']('result=','');if(_0x3b38f3[_0x6e70('0x14')]('\x20')!=-0x1){_0x3b38f3=_0x3b38f3['substr'](0x0,_0x3b38f3['indexOf']('\x20'));}if(_[_0x6e70('0x15')](_0x3b38f3,'-1')){_0x3b38f3=parseInt(_0x3b38f3);}_0x310eb7=_0x376a8d['rx'][_0x6e70('0x16')]('\x20');if(_0x310eb7['length']==0x3){_0x310eb7=_0x310eb7[0x2][_0x6e70('0x12')](0x1,_0x310eb7[0x2]['length']-0x1);}else if(_0x310eb7[_0x6e70('0x17')]>0x3){var _0x161f23=/\((.+)\)/;var _0x4ca554=_0x376a8d['rx']['match'](_0x161f23);if(_0x4ca554){_0x310eb7=_0x4ca554[0x1];}else{_0x310eb7=null;}}else{_0x310eb7=null;}_0x376a8d['cb'](null,{'code':_0x27dd9b,'result':_0x3b38f3,'extra':_0x310eb7});}});_0x2ca810['on'](_0x6e70('0x18'),function(_0x5ea7a5){_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0x18'),new AGIError('E_AGI_SOCKET_ERROR',_0x5ea7a5['code']));});_0x2ca810['on'](_0x6e70('0x19'),function(){_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0x19'),new AGIError(_0x6e70('0x1a')));});_0x2ca810['on'](_0x6e70('0x1b'),function(){_0x7dfbc3[_0x6e70('0xa')](_0x6e70('0x1b'),new AGIError(_0x6e70('0x1c')));_0x2ca810[_0x6e70('0x1d')]();});_0x2ca810[_0x6e70('0x1e')](_0x142c27);this['command']=function(_0x228350,_0x344b65){var _0x228350=_0x228350||'',_0x344b65=typeof _0x344b65==_0x6e70('0x11')?_0x344b65:new Function();_0x376a8d={'tx':_0x228350,'rx':'','cb':_0x344b65};_0x2ca810[_0x6e70('0x1f')](_0x228350+'\x0a');},this[_0x6e70('0x19')]=function(){_0x2ca810['destroy']();};}util[_0x6e70('0x20')](AGIChannel,EventEmitter);AGIChannel['prototype']['sendRequest']=function(_0x4e97c7){return this[_0x6e70('0x21')][_0x6e70('0x22')](this,_0x4e97c7);};AGIChannel['prototype'][_0x6e70('0x23')]=function(){return this[_0x6e70('0x24')]('ANSWER');};AGIChannel[_0x6e70('0x25')][_0x6e70('0x26')]=function(_0x2bb231,_0x4a67ac,_0x54a5fe){_0x2bb231=_0x2bb231===undefined?_0x6e70('0x27'):_0x2bb231;_0x4a67ac=_0x4a67ac===undefined?'5':_0x4a67ac;_0x54a5fe=_0x54a5fe===undefined?'1':_0x54a5fe;return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x29'),_0x2bb231,_0x4a67ac*0x3e8,_0x54a5fe));};AGIChannel[_0x6e70('0x25')]['noop']=function(_0x1952ea){_0x1952ea=_0x1952ea||_0x6e70('0x2a');return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x2b'),_0x1952ea));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x2c')]=function(_0x24114a,_0x3a0821){if(_[_0x6e70('0x2d')](_0x3a0821)){return this['sendRequest'](util[_0x6e70('0x28')]('EXEC\x20%s\x20%s',_0x24114a,_0x3a0821[_0x6e70('0x2e')](',')));}return this['sendRequest'](util[_0x6e70('0x28')](_0x6e70('0x2f'),_0x24114a,_0x3a0821));};AGIChannel[_0x6e70('0x25')]['setContext']=function(_0x38c40d){return this[_0x6e70('0x24')](util['format'](_0x6e70('0x30'),_0x38c40d));};AGIChannel[_0x6e70('0x25')]['setExtension']=function(_0x10d8f6){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x31'),_0x10d8f6));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x32')]=function(_0x44b19d){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x33'),_0x44b19d));};AGIChannel['prototype'][_0x6e70('0xe')]=function(){return this['sendRequest'](_0x6e70('0x34'));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x35')]=function(_0x32d12d,_0x233a83){var _0x989b80=_[_0x6e70('0x36')](_0x233a83)||_[_0x6e70('0x37')](_0x233a83)?_0x233a83[_0x6e70('0x38')]():_0x233a83;return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x39'),_0x32d12d,_0x989b80?_0x989b80[_0x6e70('0x38')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype']['sayNumber']=function(_0x155a46,_0x3841a0){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x3a'),_0x155a46,_0x3841a0));};AGIChannel[_0x6e70('0x25')]['sayDigits']=function(_0x3b508c,_0x9e7ad2){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x3b'),_0x3b508c,_0x9e7ad2));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x3c')]=function(_0x16fc7d,_0x5be100){return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x3d'),_0x16fc7d,_0x5be100));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x3e')]=function(_0x1de947,_0x21b0e7,_0x4a8adc){_0x21b0e7=_0x21b0e7||this['extension'];_0x4a8adc=_0x4a8adc||0x1;this['setContext'](_0x1de947);this[_0x6e70('0x3f')](_0x21b0e7);this[_0x6e70('0x32')](_0x4a8adc);return this[_0x6e70('0x40')](util[_0x6e70('0x28')](_0x6e70('0x41'),_0x1de947,_0x21b0e7,_0x4a8adc));};AGIChannel['prototype'][_0x6e70('0x42')]=function(_0x2a58d7){return this[_0x6e70('0x24')](util['format']('GET\x20VARIABLE\x20\x22%s\x22',_0x2a58d7));};AGIChannel['prototype'][_0x6e70('0x43')]=function(_0x5cca5b,_0x42f49a,_0x39913a,_0x3fed21,_0x75a90d,_0x59c87d){_0x42f49a=_0x42f49a||_0x6e70('0x44');_0x39913a=_0x39913a||'';_0x3fed21=_0x3fed21===undefined?-0x1:_0x3fed21==='-1'?-0x1:_0x3fed21*0x3e8;_0x75a90d=_0x75a90d===undefined?'':'s='+_0x75a90d;_0x59c87d=_0x59c87d?'BEEP':'';return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x45'),_0x5cca5b,_0x42f49a,_0x39913a,_0x3fed21,_0x59c87d,_0x75a90d));};AGIChannel[_0x6e70('0x25')]['streamFile']=function(_0x291de6,_0x44b637){_0x44b637=_0x44b637||'';return this[_0x6e70('0x24')](util[_0x6e70('0x28')](_0x6e70('0x46'),_0x291de6,_0x44b637));};AGIChannel[_0x6e70('0x25')][_0x6e70('0x47')]=function(_0x552e7e){return this[_0x6e70('0x2c')](_0x6e70('0x48'),_0x552e7e);};AGIChannel[_0x6e70('0x25')][_0x6e70('0x49')]=function(_0x3f86cf){return this[_0x6e70('0x2c')](_0x6e70('0x4a'),_0x3f86cf);};AGIChannel['prototype'][_0x6e70('0x18')]=function(_0x50cdf1,_0x11794e){this[_0x6e70('0x40')](util['format']('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x50cdf1['id'],_0x50cdf1[_0x6e70('0x4b')],_0x11794e));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x6e70('0x4c')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index c4da9b9..05b6637 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 _0x4fef=['Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','name','util'];(function(_0x59ee28,_0x3b230d){var _0x1ba1ac=function(_0x569148){while(--_0x569148){_0x59ee28['push'](_0x59ee28['shift']());}};_0x1ba1ac(++_0x3b230d);}(_0x4fef,0x10f));var _0xf4fe=function(_0x573e92,_0xb3de94){_0x573e92=_0x573e92-0x0;var _0xc7b95a=_0x4fef[_0x573e92];return _0xc7b95a;};'use strict';var util=require(_0xf4fe('0x0'));var error={'E_AGI_UNDEFINED':_0xf4fe('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0xf4fe('0x2'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0xf4fe('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0xf4fe('0x4'),'E_AGI_SOCKET_ERROR':_0xf4fe('0x5'),'E_AGI_SOCKET_CLOSE':_0xf4fe('0x6'),'E_AGI_SOCKET_TIMEOUT':_0xf4fe('0x7'),'E_AGI_COMMAND_EMPTY':_0xf4fe('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xf4fe('0x9'),'E_AGI_IVR_ENTRY':_0xf4fe('0xa')};function AGIError(_0x522427){var _0x522427=_0x522427||null,_0x3e844d=_0x3e844d||[],_0x4805b0=0x1,_0x23b761='';if(!error[_0x522427]){_0x522427=_0xf4fe('0xb');}_0x3e844d[_0xf4fe('0xc')](error[_0x522427]);while(arguments[_0x4805b0]){_0x3e844d[_0xf4fe('0xc')](arguments[_0x4805b0]);_0x4805b0++;}_0x23b761=util[_0xf4fe('0xd')][_0xf4fe('0xe')](util,_0x3e844d);this[_0xf4fe('0xf')]=_0x23b761;this[_0xf4fe('0x10')]=_0x522427;}module['exports']=AGIError; \ No newline at end of file +var _0x0a52=['Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','message','name','exports','util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.'];(function(_0xb4bed2,_0x1ba3db){var _0x17a2a5=function(_0x3957c1){while(--_0x3957c1){_0xb4bed2['push'](_0xb4bed2['shift']());}};_0x17a2a5(++_0x1ba3db);}(_0x0a52,0xe4));var _0x20a5=function(_0x37c8f0,_0x11b8f3){_0x37c8f0=_0x37c8f0-0x0;var _0x57ead9=_0x0a52[_0x37c8f0];return _0x57ead9;};'use strict';var util=require(_0x20a5('0x0'));var error={'E_AGI_UNDEFINED':_0x20a5('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x20a5('0x2'),'E_AGI_SERVER_CLOSE':_0x20a5('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x20a5('0x4'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x20a5('0x5'),'E_AGI_SOCKET_CLOSE':_0x20a5('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x20a5('0x7'),'E_AGI_COMMAND_EMPTY':_0x20a5('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x20a5('0x9'),'E_AGI_IVR_ENTRY':_0x20a5('0xa')};function AGIError(_0x4acc66){var _0x4acc66=_0x4acc66||null,_0x39920b=_0x39920b||[],_0x1f44fd=0x1,_0x478779='';if(!error[_0x4acc66]){_0x4acc66=_0x20a5('0xb');}_0x39920b[_0x20a5('0xc')](error[_0x4acc66]);while(arguments[_0x1f44fd]){_0x39920b[_0x20a5('0xc')](arguments[_0x1f44fd]);_0x1f44fd++;}_0x478779=util[_0x20a5('0xd')]['apply'](util,_0x39920b);this[_0x20a5('0xe')]=_0x478779;this[_0x20a5('0xf')]=_0x4acc66;}module[_0x20a5('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 4202eda..db4eae5 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 _0x3070=['push','size','relations','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','vswitch','target','invalid','agicommand','default\x20on\x20switch\x20not\x20found','condition\x20not\x20found','../../../config/logger','menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype'];(function(_0x1db851,_0x5e7235){var _0x3b7aee=function(_0x47c61c){while(--_0x47c61c){_0x1db851['push'](_0x1db851['shift']());}};_0x3b7aee(++_0x5e7235);}(_0x3070,0x75));var _0x0307=function(_0x4d0266,_0x35487e){_0x4d0266=_0x4d0266-0x0;var _0x1202de=_0x3070[_0x4d0266];return _0x1202de;};'use strict';var _=require('lodash');var logger=require(_0x0307('0x0'))('agi');var verticesWithRetry=[_0x0307('0x1'),_0x0307('0x2'),_0x0307('0x3')];var Graph=function(){this[_0x0307('0x4')]={};this[_0x0307('0x5')]={};this[_0x0307('0x6')]=0x0;};Graph['prototype']['addVertex']=function(_0x413a82){this[_0x0307('0x4')][_0x413a82['id']]=_0x413a82;this[_0x0307('0x5')][_0x413a82['id']]=[];};Graph[_0x0307('0x7')]['addEdge']=function(_0x3ecfb6,_0x41e638,_0x53e6b7){this[_0x0307('0x5')][_0x3ecfb6][_0x0307('0x8')]({'target':_0x41e638,'condition':_0x53e6b7});this[_0x0307('0x6')]+=0x1;};Graph[_0x0307('0x7')][_0x0307('0x9')]=function(){return _[_0x0307('0x9')](this[_0x0307('0x4')]);};Graph[_0x0307('0x7')][_0x0307('0xa')]=function(){return this['numberOfEdges'];};Graph[_0x0307('0x7')]['getVertex']=function(_0x112958){return this[_0x0307('0x4')][_0x112958];};Graph[_0x0307('0x7')][_0x0307('0xb')]=function(_0x161f31,_0x294f83){if(!this[_0x0307('0x4')][_0x161f31]){return logger[_0x0307('0xc')](_0x0307('0xd'));}var _0x28b776=_0x294f83(this[_0x0307('0x4')][_0x161f31]);if(!_0x28b776){return logger[_0x0307('0xc')](_0x0307('0xe'));}if(this[_0x0307('0x5')][_0x161f31][_0x0307('0xf')]===0x0){return logger['info'](_0x0307('0x10'));}for(var _0xc52203=0x0,_0x286f72=[],_0x5f11a5=![];_0xc52203\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','xml2json','lodash','syncho','moment','../../config/logger','agi','./rpc','./mailRpc','defaults','127.0.0.1','nextTick','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','error','format','[%s]\x20%s','[ERROR]\x20%s','stack','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','dnid','uniqueid','arg_1','calleridname','evtHangup','toJson','mxGraphModel','agicommand','hasOwnProperty','maxRetry','retry','addVertex','omit','isArray','length','source','target','value','then','catch','createSquareReport','indexOf','substring','inspect','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','production','start','debug','root','stringify','joinAt','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','gotoc','context','extension','priority'];(function(_0x166e96,_0x55191d){var _0x553d73=function(_0x586142){while(--_0x586142){_0x166e96['push'](_0x166e96['shift']());}};_0x553d73(++_0x55191d);}(_0x00bb,0x1d8));var _0xb00b=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x00bb[_0x134c2e];return _0x2825db;};'use strict';var parser=require(_0xb00b('0x0'));var _=require(_0xb00b('0x1'));var syncho=require(_0xb00b('0x2'));var util=require('util');var moment=require(_0xb00b('0x3'));var config=require('../../config/environment');var logger=require(_0xb00b('0x4'))(_0xb00b('0x5'));var utilLicense=require('../../config/license/util');var rpc=require(_0xb00b('0x6'));var mailRpc=require(_0xb00b('0x7'));var Graph=require('./graph');var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0xb00b('0x8')](config[_0xb00b('0x5')],{'ip':_0xb00b('0x9'),'port':0x11dd});function connectionHandler(_0x37f07d){process[_0xb00b('0xa')](function(){syncho(function(){try{setChannelVariables(_0x37f07d);agiHandler(_0x37f07d);}catch(_0x3c36c5){logger['error'](_0x3c36c5['stack']);}});});}function listeningHandler(){console[_0xb00b('0xb')](_0xb00b('0xc'),config[_0xb00b('0x5')][_0xb00b('0xd')]);logger[_0xb00b('0xe')](util['format'](_0xb00b('0xf'),config['agi']['ip'],config['agi']['port']));}function errorHandler(_0x4ff792){if(_0x4ff792&&_0x4ff792[_0xb00b('0x10')]&&_0x4ff792[_0xb00b('0x11')]){logger[_0xb00b('0x12')](util[_0xb00b('0x13')](_0xb00b('0x14'),_0x4ff792['name'],_0x4ff792[_0xb00b('0x11')]));}else{logger[_0xb00b('0x12')](util['format'](_0xb00b('0x15'),_0x4ff792[_0xb00b('0x16')]));}}function closeHandler(){logger['info'](util['format'](_0xb00b('0x17'),this['arg_1'],this['calleridname'],this[_0xb00b('0x18')],this[_0xb00b('0x19')],this[_0xb00b('0x1a')]));try{createSquareReport(this);}catch(_0xbb72fc){logger['error'](_0xbb72fc[_0xb00b('0x16')]);}}function timeoutHandler(){logger['info'](util[_0xb00b('0x13')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xb00b('0x1b')],this['calleridname'],this[_0xb00b('0x18')],this[_0xb00b('0x19')],this['uniqueid']));}function hangupHandler(){logger['info'](util[_0xb00b('0x13')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xb00b('0x1b')],this[_0xb00b('0x1c')],this[_0xb00b('0x18')],this[_0xb00b('0x19')],this['uniqueid']));this[_0xb00b('0x1d')]=!![];}function getRoot(_0x4df284){return parser[_0xb00b('0x1e')](_0x4df284,{'object':!![]})[_0xb00b('0x1f')]['root'];}function addVertex(_0x231293,_0x2896d1,_0x520444){_0x2896d1[_0xb00b('0x20')]=_0x520444;if(_0x2896d1[_0xb00b('0x21')]('retry')){_0x2896d1[_0xb00b('0x22')]=parseInt(_0x2896d1[_0xb00b('0x23')],0xa);}_0x231293[_0xb00b('0x24')](_[_0xb00b('0x25')](_0x2896d1,'mxCell'));}function initGraph(_0x50be6c,_0x3785e9){var _0x490380=new Graph();for(var _0x550587 in _0x50be6c){if(_0x50be6c['hasOwnProperty'](_0x550587)){if(_[_0xb00b('0x26')](_0x50be6c[_0x550587])){for(var _0x73b6b0=0x0;_0x73b6b0<_0x50be6c[_0x550587][_0xb00b('0x27')];_0x73b6b0+=0x1){addVertex(_0x490380,_0x50be6c[_0x550587][_0x73b6b0],_0x550587);}}else{addVertex(_0x490380,_0x50be6c[_0x550587],_0x550587);}}}for(var _0x3825af=0x0;_0x3825af<_0x3785e9[_0xb00b('0x27')];_0x3825af+=0x1){if(_0x3785e9[_0x3825af][_0xb00b('0x28')]&&_0x3785e9[_0x3825af][_0xb00b('0x29')]){_0x490380['addEdge'](_0x3785e9[_0x3825af][_0xb00b('0x28')],_0x3785e9[_0x3825af]['target'],_0x3785e9[_0x3825af][_0xb00b('0x2a')]);}}return _0x490380;}function getSquareProject(_0x348165,_0x5424ca){rpc['getSquareProject'](_0x348165)[_0xb00b('0x2b')](function(_0x280ed3){_0x5424ca(null,_0x280ed3);})[_0xb00b('0x2c')](function(_0x183233){_0x5424ca(null,_0x183233);});}function createSquareReport(_0x303625,_0x2b9824){rpc[_0xb00b('0x2d')](_0x303625)[_0xb00b('0x2b')](function(_0x149c1a){if(_0x2b9824){_0x2b9824(null,_0x149c1a);}})['catch'](function(_0x2b5f41){if(_0x2b9824){_0x2b9824(null,_0x2b5f41);}});}function setChannelVariables(_0x44918d){for(var _0x49078d in _0x44918d){if(_0x44918d[_0xb00b('0x21')](_0x49078d)){if(_0x49078d[_0xb00b('0x2e')]('agi_')===0x0){_0x44918d[_0x49078d[_0xb00b('0x2f')](0x4)]=_0x44918d[_0x49078d];delete _0x44918d[_0x49078d];}}}}function getLogFromObject(_0x4d2ee5){return util[_0xb00b('0x30')](_0x4d2ee5,{'showHidden':![],'depth':null});}function agiHandler(_0x4117f2){var _0x322879,_0x1be4ba,_0x338864,_0x1436ad,_0x17f613;logger['debug']('variables',JSON['stringify'](_0x4117f2,null,0x2));logger[_0xb00b('0xe')](util[_0xb00b('0x13')](_0xb00b('0x31'),_0x4117f2[_0xb00b('0x1b')],_0x4117f2['calleridname'],_0x4117f2[_0xb00b('0x18')],_0x4117f2[_0xb00b('0x19')],_0x4117f2[_0xb00b('0x1a')]));_0x4117f2['on'](_0xb00b('0x12'),errorHandler);_0x4117f2['on'](_0xb00b('0x32'),closeHandler);_0x4117f2['on'](_0xb00b('0x33'),timeoutHandler);_0x4117f2[_0xb00b('0x1d')]=![];_0x4117f2['on'](_0xb00b('0x34'),hangupHandler);var _0x5efc18=getSquareProject['sync'](null,_0x4117f2[_0xb00b('0x1b')]);if(_0x5efc18){if(_0x5efc18['production']){_0x322879=getRoot(_0x5efc18[_0xb00b('0x35')]);if(_0x322879&&_0x322879[_0xb00b('0x36')]){logger[_0xb00b('0x37')](_0xb00b('0x38'),JSON[_0xb00b('0x39')](_0x322879,null,0x2));_0x4117f2[_0xb00b('0x3a')]=moment()[_0xb00b('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x1be4ba=initGraph(_[_0xb00b('0x25')](_0x322879,_0xb00b('0x3b')),_0x322879[_0xb00b('0x3b')]);_0x338864=new Vertices(_0x4117f2,rpc,mailRpc);logger[_0xb00b('0xe')](util[_0xb00b('0x13')](_0xb00b('0x3c'),_0x4117f2['arg_1'],_0x4117f2[_0xb00b('0x1c')],_0x4117f2[_0xb00b('0x18')],_0x4117f2['dnid'],_0x4117f2[_0xb00b('0x1a')]));_0x1be4ba[_0xb00b('0x3d')](_0x322879[_0xb00b('0x36')]['id'],function(_0x2d8620){try{_0x2d8620=_0x338864[_0xb00b('0x3e')](_0x2d8620);logger['debug'](_0xb00b('0x3f'),JSON[_0xb00b('0x39')](_0x2d8620,null,0x2));if(_0x2d8620[_0xb00b('0x20')]===_0xb00b('0x40')){logger['info']('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x4117f2[_0xb00b('0x41')]=_0x2d8620[_0xb00b('0x41')]||_0x4117f2[_0xb00b('0x41')];_0x4117f2[_0xb00b('0x42')]=_0x2d8620[_0xb00b('0x42')];_0x4117f2[_0xb00b('0x43')]=_0x2d8620[_0xb00b('0x43')]?_0x2d8620['priority']-0x1:0x1;return null;}else if(_0x2d8620&&_0x338864[_0x2d8620[_0xb00b('0x20')]]){_0x17f613=_0x338864[_0x2d8620[_0xb00b('0x20')]](_0x2d8620);logger[_0xb00b('0xe')](_0xb00b('0x44'),JSON[_0xb00b('0x39')](_0x17f613,null,0x2));if(_0x17f613&&_0x17f613[_0xb00b('0x45')]===AGI_CODE_SUCCESS&&_0x17f613[_0xb00b('0x46')]!==AGI_RESULT_ERROR&&!_0x4117f2[_0xb00b('0x1d')]){logger[_0xb00b('0x37')](_0xb00b('0x44'),getLogFromObject(_0x17f613));return _[_0xb00b('0x47')](_0x17f613[_0xb00b('0x46')])?null:_0x17f613['result'][_0xb00b('0x48')]();}else{logger[_0xb00b('0x12')](_0xb00b('0x44'),getLogFromObject(_0x17f613));return null;}}else{logger[_0xb00b('0x12')](_0xb00b('0x49'));return null;}}catch(_0x2d9174){logger[_0xb00b('0x12')](_0x2d9174[_0xb00b('0x16')]);return null;}});if(_0x322879[_0xb00b('0x4a')]){logger[_0xb00b('0xe')](util[_0xb00b('0x13')](_0xb00b('0x4b'),_0x4117f2['arg_1'],_0x4117f2['calleridname'],_0x4117f2['callerid'],_0x4117f2[_0xb00b('0x19')],_0x4117f2[_0xb00b('0x1a')]));_0x1be4ba['traverseBFS'](_0x322879[_0xb00b('0x4a')]['id'],function(_0x3c0fa){try{_0x3c0fa=_0x338864[_0xb00b('0x3e')](_0x3c0fa);logger[_0xb00b('0x37')]('vertex',JSON['stringify'](_0x3c0fa,null,0x2));if(_0x3c0fa&&_0x338864[_0x3c0fa[_0xb00b('0x20')]]){_0x17f613=_0x338864[_0x3c0fa[_0xb00b('0x20')]](_0x3c0fa);if(_0x17f613){logger['debug']('response',getLogFromObject(_0x17f613));return _[_0xb00b('0x47')](_0x17f613[_0xb00b('0x46')])?null:_0x17f613['result'][_0xb00b('0x48')]();}else{logger['error']('response',getLogFromObject(_0x17f613));return null;}}else{logger['error'](_0xb00b('0x49'));return null;}}catch(_0x481515){logger[_0xb00b('0x12')](_0x481515[_0xb00b('0x16')]);return null;}});}logger[_0xb00b('0xe')](util[_0xb00b('0x13')](_0xb00b('0x4c'),_0x4117f2[_0xb00b('0x1b')],_0x4117f2['calleridname'],_0x4117f2['callerid'],_0x4117f2[_0xb00b('0x19')],_0x4117f2[_0xb00b('0x1a')]));logger['info'](util[_0xb00b('0x13')](_0xb00b('0x4d'),_0x4117f2['context'],_0x4117f2[_0xb00b('0x42')],parseInt(_0x4117f2[_0xb00b('0x43')],0xa)+0x1));_0x4117f2[_0xb00b('0x4e')](_0x4117f2['context'],_0x4117f2['extension'],parseInt(_0x4117f2[_0xb00b('0x43')],0xa)+0x1);_0x4117f2[_0xb00b('0x32')]();}}else{logger[_0xb00b('0x12')](util[_0xb00b('0x13')]('Project\x20%s\x20not\x20published',_0x4117f2[_0xb00b('0x1b')]));_0x4117f2[_0xb00b('0x4e')](_0x4117f2['context'],_0x4117f2['extension'],parseInt(_0x4117f2[_0xb00b('0x43')],0xa)+0x1);_0x4117f2['close']();}}else{logger[_0xb00b('0x12')](util[_0xb00b('0x13')](_0xb00b('0x4f'),_0x4117f2[_0xb00b('0x1b')]));_0x4117f2[_0xb00b('0x4e')](_0x4117f2[_0xb00b('0x41')],_0x4117f2['extension'],parseInt(_0x4117f2[_0xb00b('0x43')],0xa)+0x1);_0x4117f2['close']();}}function main(){var _0x37d4d2;return utilLicense[_0xb00b('0x50')]()[_0xb00b('0x2b')](function(_0x5ac79e){if(_0x5ac79e){if(_0x5ac79e[_0xb00b('0x51')]){if(_0x5ac79e[_0xb00b('0x52')]&&_0x5ac79e[_0xb00b('0x52')]>0x0){logger['info'](util[_0xb00b('0x13')](_0xb00b('0x53'),_0x5ac79e[_0xb00b('0x52')]));_0x37d4d2=_0x5ac79e[_0xb00b('0x52')];}else{logger[_0xb00b('0xe')](_0xb00b('0x54'));}}else{logger[_0xb00b('0xe')](_0xb00b('0x55'));_0x37d4d2=-0x1;}}})['catch'](function(_0x153551){logger[_0xb00b('0x12')](_0xb00b('0x56'),_0x153551['stack']);})[_0xb00b('0x4a')](function(){var _0x24a8a2=require(_0xb00b('0x57'))(config[_0xb00b('0x5')][_0xb00b('0xd')],config['agi']['ip'],_0x37d4d2);_0x24a8a2['on'](_0xb00b('0x12'),errorHandler);_0x24a8a2['on'](_0xb00b('0x58'),listeningHandler);_0x24a8a2['on'](_0xb00b('0x59'),connectionHandler);_0x24a8a2['on'](_0xb00b('0x32'),closeHandler);});}main(); \ No newline at end of file +var _0x495e=['dnid','evtHangup','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','addVertex','omit','mxCell','isArray','length','target','addEdge','source','value','getSquareProject','catch','then','indexOf','agi_','substring','inspect','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','hangup','sync','start','debug','joinAt','YYYY-MM-DD\x20HH:mm:ss','traverseBFS','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','result','response','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','isUndefined','toString','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','xml2json','util','moment','../../config/environment','../../config/logger','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','agi','defaults','nextTick','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','port','message','[%s]\x20%s','name','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid'];(function(_0x3f316e,_0x2cdb0e){var _0x4c9718=function(_0x534e9b){while(--_0x534e9b){_0x3f316e['push'](_0x3f316e['shift']());}};_0x4c9718(++_0x2cdb0e);}(_0x495e,0xfb));var _0xe495=function(_0x3df517,_0x373364){_0x3df517=_0x3df517-0x0;var _0x25ddd5=_0x495e[_0x3df517];return _0x25ddd5;};'use strict';var parser=require(_0xe495('0x0'));var _=require('lodash');var syncho=require('syncho');var util=require(_0xe495('0x1'));var moment=require(_0xe495('0x2'));var config=require(_0xe495('0x3'));var logger=require(_0xe495('0x4'))('agi');var utilLicense=require(_0xe495('0x5'));var rpc=require(_0xe495('0x6'));var mailRpc=require(_0xe495('0x7'));var Graph=require(_0xe495('0x8'));var Vertices=require(_0xe495('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xe495('0xa')]=_[_0xe495('0xb')](config['agi'],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x5c17d0){process[_0xe495('0xc')](function(){syncho(function(){try{setChannelVariables(_0x5c17d0);agiHandler(_0x5c17d0);}catch(_0x586a6f){logger[_0xe495('0xd')](_0x586a6f[_0xe495('0xe')]);}});});}function listeningHandler(){console[_0xe495('0xf')](_0xe495('0x10'),config[_0xe495('0xa')]['port']);logger[_0xe495('0x11')](util[_0xe495('0x12')](_0xe495('0x13'),config['agi']['ip'],config[_0xe495('0xa')][_0xe495('0x14')]));}function errorHandler(_0x5cf888){if(_0x5cf888&&_0x5cf888['name']&&_0x5cf888[_0xe495('0x15')]){logger[_0xe495('0xd')](util['format'](_0xe495('0x16'),_0x5cf888[_0xe495('0x17')],_0x5cf888[_0xe495('0x15')]));}else{logger[_0xe495('0xd')](util[_0xe495('0x12')]('[ERROR]\x20%s',_0x5cf888[_0xe495('0xe')]));}}function closeHandler(){logger[_0xe495('0x11')](util[_0xe495('0x12')](_0xe495('0x18'),this[_0xe495('0x19')],this['calleridname'],this['callerid'],this['dnid'],this[_0xe495('0x1a')]));try{createSquareReport(this);}catch(_0x142978){logger[_0xe495('0xd')](_0x142978['stack']);}}function timeoutHandler(){logger[_0xe495('0x11')](util[_0xe495('0x12')](_0xe495('0x1b'),this[_0xe495('0x19')],this[_0xe495('0x1c')],this['callerid'],this['dnid'],this[_0xe495('0x1a')]));}function hangupHandler(){logger[_0xe495('0x11')](util[_0xe495('0x12')](_0xe495('0x1d'),this['arg_1'],this[_0xe495('0x1c')],this[_0xe495('0x1e')],this[_0xe495('0x1f')],this['uniqueid']));this[_0xe495('0x20')]=!![];}function getRoot(_0x17d13f){return parser[_0xe495('0x21')](_0x17d13f,{'object':!![]})[_0xe495('0x22')][_0xe495('0x23')];}function addVertex(_0x4840fa,_0x33f19,_0x4d836b){_0x33f19[_0xe495('0x24')]=_0x4d836b;if(_0x33f19[_0xe495('0x25')](_0xe495('0x26'))){_0x33f19['maxRetry']=parseInt(_0x33f19[_0xe495('0x26')],0xa);}_0x4840fa[_0xe495('0x27')](_[_0xe495('0x28')](_0x33f19,_0xe495('0x29')));}function initGraph(_0x21513b,_0x3bd472){var _0x1ffd8b=new Graph();for(var _0x48b2eb in _0x21513b){if(_0x21513b['hasOwnProperty'](_0x48b2eb)){if(_[_0xe495('0x2a')](_0x21513b[_0x48b2eb])){for(var _0x5db642=0x0;_0x5db642<_0x21513b[_0x48b2eb][_0xe495('0x2b')];_0x5db642+=0x1){addVertex(_0x1ffd8b,_0x21513b[_0x48b2eb][_0x5db642],_0x48b2eb);}}else{addVertex(_0x1ffd8b,_0x21513b[_0x48b2eb],_0x48b2eb);}}}for(var _0x3dd5df=0x0;_0x3dd5df<_0x3bd472['length'];_0x3dd5df+=0x1){if(_0x3bd472[_0x3dd5df]['source']&&_0x3bd472[_0x3dd5df][_0xe495('0x2c')]){_0x1ffd8b[_0xe495('0x2d')](_0x3bd472[_0x3dd5df][_0xe495('0x2e')],_0x3bd472[_0x3dd5df][_0xe495('0x2c')],_0x3bd472[_0x3dd5df][_0xe495('0x2f')]);}}return _0x1ffd8b;}function getSquareProject(_0x258d9c,_0x181d26){rpc[_0xe495('0x30')](_0x258d9c)['then'](function(_0x4bae72){_0x181d26(null,_0x4bae72);})[_0xe495('0x31')](function(_0x3a82ff){_0x181d26(null,_0x3a82ff);});}function createSquareReport(_0x389177,_0x40d3a3){rpc['createSquareReport'](_0x389177)[_0xe495('0x32')](function(_0x1d0c2f){if(_0x40d3a3){_0x40d3a3(null,_0x1d0c2f);}})[_0xe495('0x31')](function(_0xba78e9){if(_0x40d3a3){_0x40d3a3(null,_0xba78e9);}});}function setChannelVariables(_0xc238a){for(var _0x15fbcd in _0xc238a){if(_0xc238a[_0xe495('0x25')](_0x15fbcd)){if(_0x15fbcd[_0xe495('0x33')](_0xe495('0x34'))===0x0){_0xc238a[_0x15fbcd[_0xe495('0x35')](0x4)]=_0xc238a[_0x15fbcd];delete _0xc238a[_0x15fbcd];}}}}function getLogFromObject(_0x198b98){return util[_0xe495('0x36')](_0x198b98,{'showHidden':![],'depth':null});}function agiHandler(_0x31b515){var _0xe92feb,_0x374ed8,_0x5ee00d,_0x3fc33a,_0xcd9c3;logger['debug'](_0xe495('0x37'),JSON[_0xe495('0x38')](_0x31b515,null,0x2));logger['info'](util['format'](_0xe495('0x39'),_0x31b515[_0xe495('0x19')],_0x31b515[_0xe495('0x1c')],_0x31b515[_0xe495('0x1e')],_0x31b515['dnid'],_0x31b515[_0xe495('0x1a')]));_0x31b515['on'](_0xe495('0xd'),errorHandler);_0x31b515['on'](_0xe495('0x3a'),closeHandler);_0x31b515['on']('timeout',timeoutHandler);_0x31b515['evtHangup']=![];_0x31b515['on'](_0xe495('0x3b'),hangupHandler);var _0x5b6d05=getSquareProject[_0xe495('0x3c')](null,_0x31b515[_0xe495('0x19')]);if(_0x5b6d05){if(_0x5b6d05['production']){_0xe92feb=getRoot(_0x5b6d05['production']);if(_0xe92feb&&_0xe92feb[_0xe495('0x3d')]){logger[_0xe495('0x3e')](_0xe495('0x23'),JSON[_0xe495('0x38')](_0xe92feb,null,0x2));_0x31b515[_0xe495('0x3f')]=moment()[_0xe495('0x12')](_0xe495('0x40'));_0x374ed8=initGraph(_[_0xe495('0x28')](_0xe92feb,_0xe495('0x29')),_0xe92feb[_0xe495('0x29')]);_0x5ee00d=new Vertices(_0x31b515,rpc,mailRpc);logger[_0xe495('0x11')](util[_0xe495('0x12')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x31b515[_0xe495('0x19')],_0x31b515[_0xe495('0x1c')],_0x31b515[_0xe495('0x1e')],_0x31b515[_0xe495('0x1f')],_0x31b515['uniqueid']));_0x374ed8[_0xe495('0x41')](_0xe92feb[_0xe495('0x3d')]['id'],function(_0x553361){try{_0x553361=_0x5ee00d['clear'](_0x553361);logger['debug'](_0xe495('0x42'),JSON[_0xe495('0x38')](_0x553361,null,0x2));if(_0x553361[_0xe495('0x24')]===_0xe495('0x43')){logger[_0xe495('0x11')](_0xe495('0x44'));_0x31b515['context']=_0x553361[_0xe495('0x45')]||_0x31b515[_0xe495('0x45')];_0x31b515[_0xe495('0x46')]=_0x553361[_0xe495('0x46')];_0x31b515[_0xe495('0x47')]=_0x553361[_0xe495('0x47')]?_0x553361[_0xe495('0x47')]-0x1:0x1;return null;}else if(_0x553361&&_0x5ee00d[_0x553361[_0xe495('0x24')]]){_0xcd9c3=_0x5ee00d[_0x553361[_0xe495('0x24')]](_0x553361);logger['info']('response',JSON[_0xe495('0x38')](_0xcd9c3,null,0x2));if(_0xcd9c3&&_0xcd9c3['code']===AGI_CODE_SUCCESS&&_0xcd9c3[_0xe495('0x48')]!==AGI_RESULT_ERROR&&!_0x31b515[_0xe495('0x20')]){logger['debug'](_0xe495('0x49'),getLogFromObject(_0xcd9c3));return _['isUndefined'](_0xcd9c3['result'])?null:_0xcd9c3[_0xe495('0x48')]['toString']();}else{logger[_0xe495('0xd')]('response',getLogFromObject(_0xcd9c3));return null;}}else{logger[_0xe495('0xd')](_0xe495('0x4a'));return null;}}catch(_0x11eb47){logger[_0xe495('0xd')](_0x11eb47[_0xe495('0xe')]);return null;}});if(_0xe92feb[_0xe495('0x4b')]){logger[_0xe495('0x11')](util[_0xe495('0x12')](_0xe495('0x4c'),_0x31b515[_0xe495('0x19')],_0x31b515['calleridname'],_0x31b515[_0xe495('0x1e')],_0x31b515['dnid'],_0x31b515[_0xe495('0x1a')]));_0x374ed8[_0xe495('0x41')](_0xe92feb[_0xe495('0x4b')]['id'],function(_0x1f30f5){try{_0x1f30f5=_0x5ee00d['clear'](_0x1f30f5);logger['debug']('vertex',JSON[_0xe495('0x38')](_0x1f30f5,null,0x2));if(_0x1f30f5&&_0x5ee00d[_0x1f30f5[_0xe495('0x24')]]){_0xcd9c3=_0x5ee00d[_0x1f30f5['agicommand']](_0x1f30f5);if(_0xcd9c3){logger[_0xe495('0x3e')](_0xe495('0x49'),getLogFromObject(_0xcd9c3));return _[_0xe495('0x4d')](_0xcd9c3[_0xe495('0x48')])?null:_0xcd9c3[_0xe495('0x48')][_0xe495('0x4e')]();}else{logger[_0xe495('0xd')]('response',getLogFromObject(_0xcd9c3));return null;}}else{logger[_0xe495('0xd')](_0xe495('0x4a'));return null;}}catch(_0x455d94){logger[_0xe495('0xd')](_0x455d94[_0xe495('0xe')]);return null;}});}logger['info'](util['format'](_0xe495('0x4f'),_0x31b515[_0xe495('0x19')],_0x31b515[_0xe495('0x1c')],_0x31b515['callerid'],_0x31b515['dnid'],_0x31b515[_0xe495('0x1a')]));logger['info'](util[_0xe495('0x12')](_0xe495('0x50'),_0x31b515['context'],_0x31b515[_0xe495('0x46')],parseInt(_0x31b515[_0xe495('0x47')],0xa)+0x1));_0x31b515[_0xe495('0x51')](_0x31b515[_0xe495('0x45')],_0x31b515[_0xe495('0x46')],parseInt(_0x31b515[_0xe495('0x47')],0xa)+0x1);_0x31b515[_0xe495('0x3a')]();}}else{logger[_0xe495('0xd')](util[_0xe495('0x12')](_0xe495('0x52'),_0x31b515[_0xe495('0x19')]));_0x31b515[_0xe495('0x51')](_0x31b515['context'],_0x31b515[_0xe495('0x46')],parseInt(_0x31b515[_0xe495('0x47')],0xa)+0x1);_0x31b515[_0xe495('0x3a')]();}}else{logger[_0xe495('0xd')](util[_0xe495('0x12')](_0xe495('0x53'),_0x31b515[_0xe495('0x19')]));_0x31b515[_0xe495('0x51')](_0x31b515[_0xe495('0x45')],_0x31b515[_0xe495('0x46')],parseInt(_0x31b515['priority'],0xa)+0x1);_0x31b515['close']();}}function main(){var _0x3e3471;return utilLicense[_0xe495('0x54')]()['then'](function(_0x2cae70){if(_0x2cae70){if(_0x2cae70[_0xe495('0x55')]){if(_0x2cae70[_0xe495('0x56')]&&_0x2cae70[_0xe495('0x56')]>0x0){logger['info'](util[_0xe495('0x12')](_0xe495('0x57'),_0x2cae70[_0xe495('0x56')]));_0x3e3471=_0x2cae70[_0xe495('0x56')];}else{logger[_0xe495('0x11')](_0xe495('0x58'));}}else{logger['info'](_0xe495('0x59'));_0x3e3471=-0x1;}}})['catch'](function(_0x1a4ab2){logger['error'](_0xe495('0x5a'),_0x1a4ab2['stack']);})[_0xe495('0x4b')](function(){var _0x57c584=require(_0xe495('0x5b'))(config[_0xe495('0xa')]['port'],config[_0xe495('0xa')]['ip'],_0x3e3471);_0x57c584['on'](_0xe495('0xd'),errorHandler);_0x57c584['on'](_0xe495('0x5c'),listeningHandler);_0x57c584['on'](_0xe495('0x5d'),connectionHandler);_0x57c584['on'](_0xe495('0x3a'),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 e557337..bda7110 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 _0x814b=['bluebird','jayson/promise','client','http','request','then','error','result','catch','sendMailMessage','SendMail'];(function(_0x351927,_0x2bc1ad){var _0x853ecb=function(_0x363bed){while(--_0x363bed){_0x351927['push'](_0x351927['shift']());}};_0x853ecb(++_0x2bc1ad);}(_0x814b,0x1a2));var _0xb814=function(_0x3a7455,_0x46b004){_0x3a7455=_0x3a7455-0x0;var _0x216c72=_0x814b[_0x3a7455];return _0x216c72;};'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(_0x1a7005,_0x172e22){var _0x287a35=function(_0x28c47b){while(--_0x28c47b){_0x1a7005['push'](_0x1a7005['shift']());}};_0x287a35(++_0x172e22);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 9b22278..294ce1b 100644 --- a/server/services/agi/reply.js +++ b/server/services/agi/reply.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x127f71,_0x1e88d6){var _0x583dc4=function(_0xbb99e4){while(--_0xbb99e4){_0x127f71['push'](_0x127f71['shift']());}};_0x583dc4(++_0x1e88d6);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2b1222,_0xe66198){_0x2b1222=_0x2b1222-0x0;var _0x31b607=_0x5f2f[_0x2b1222];return _0x31b607;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply; \ No newline at end of file +var _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x32084f,_0x28fc38){var _0x187302=function(_0x481c2b){while(--_0x481c2b){_0x32084f['push'](_0x32084f['shift']());}};_0x187302(++_0x28fc38);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1abcd2,_0x5d0ca7){_0x1abcd2=_0x1abcd2-0x0;var _0x50b3b5=_0x5f2f[_0x1abcd2];return _0x50b3b5;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 24c5c1d..8b4e9ba 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 _0xa16d=['format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','phone','ListId','CreateCmContact','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','agentLogout','LogoutUser','bluebird','moment','util','jayson/promise','client','request','then','error','message','result','catch','getMailAccountById','Smtp','name','email','getSquareProjectById','ShowVoiceQueue','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowSmsAccount','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','merge','arg_1','arg_2'];(function(_0xd299c3,_0x4ba0f1){var _0x376574=function(_0xc585f){while(--_0xc585f){_0xd299c3['push'](_0xd299c3['shift']());}};_0x376574(++_0x4ba0f1);}(_0xa16d,0xaa));var _0xda16=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xa16d[_0x599f41];return _0x2e4d58;};'use strict';var BPromise=require(_0xda16('0x0'));var moment=require(_0xda16('0x1'));var _=require('lodash');var util=require(_0xda16('0x2'));var jayson=require(_0xda16('0x3'));var client=jayson[_0xda16('0x4')]['http']({'port':0x2329});function request(_0x161c17,_0x1c8baa){return new BPromise(function(_0x25f885,_0x2df775){return client[_0xda16('0x5')](_0x161c17,_0x1c8baa)[_0xda16('0x6')](function(_0x2e8afd){if(_0x2e8afd[_0xda16('0x7')]){return _0x2df775(_0x2e8afd[_0xda16('0x7')][_0xda16('0x8')]);}else{return _0x25f885(_0x2e8afd[_0xda16('0x9')]);}})[_0xda16('0xa')](function(_0x25f4c8){return _0x2df775(_0x25f4c8);});});}exports['getSquareProject']=function(_0x3b13e9){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x3b13e9},'attributes':['production']}});};exports[_0xda16('0xb')]=function(_0x54cad1){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x54cad1},'include':[{'model':'MailServerOut','as':_0xda16('0xc')}],'attributes':['id',_0xda16('0xd'),_0xda16('0xe')]}});};exports[_0xda16('0xf')]=function(_0xae1a34){return request('ShowSquareProject',{'options':{'where':{'id':_0xae1a34},'attributes':[_0xda16('0xd')]}});};exports['getVoiceQueueById']=function(_0x15f20d){return request(_0xda16('0x10'),{'options':{'where':{'id':_0x15f20d},'attributes':['name']}});};exports['getVariableById']=function(_0xc2a30e){return request('ShowVariable',{'options':{'where':{'id':_0xc2a30e},'attributes':['name']}});};exports[_0xda16('0x11')]=function(_0x209d33){return request(_0xda16('0x12'),{'options':{'where':{'id':_0x209d33},'attributes':['dsn']}});};exports[_0xda16('0x13')]=function(_0x248ee9){return request(_0xda16('0x14'),{'options':{'where':{'id':_0x248ee9},'attributes':['name']}});};exports[_0xda16('0x15')]=function(_0x189bec){return request(_0xda16('0x16'),{'options':{'where':{'id':_0x189bec},'attributes':[_0xda16('0xd')]}});};exports[_0xda16('0x17')]=function(_0x1174eb){return request(_0xda16('0x18'),{'options':{'where':{'id':_0x1174eb},'attributes':[_0xda16('0x19')]}});};exports[_0xda16('0x1a')]=function(_0x52cab9){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x52cab9},'include':[{'model':'Interval','as':'Intervals'}]}});};exports['getSmsAccountById']=function(_0x2721c1){return request(_0xda16('0x1b'),{'options':{'where':{'id':_0x2721c1},'attributes':['id',_0xda16('0xd')]}});};exports['createSmsMessage']=function(_0x2ad82f){return request(_0xda16('0x1c'),{'body':_0x2ad82f});};exports['createSquareDetailsReport']=function(_0x90bb69){return request(_0xda16('0x1d'),{'body':_0x90bb69});};exports[_0xda16('0x1e')]=function(_0x840867){return request('CreateSquareReport',{'body':_[_0xda16('0x1f')](_0x840867,{'project_name':_0x840867[_0xda16('0x20')],'prev_project_name':_0x840867[_0xda16('0x21')]||'','is_subproject':_0x840867['arg_2']?!![]:![],'leaveAt':moment()[_0xda16('0x22')](_0xda16('0x23'))})});};exports[_0xda16('0x24')]=function(_0x439d95){return request(_0xda16('0x25'),{'body':_0x439d95});};exports[_0xda16('0x26')]=function(_0x38fb11){return request(_0xda16('0x27'),{'body':_0x38fb11});};exports[_0xda16('0x28')]=function(_0x52018d){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x52018d[_0xda16('0x29')],'ListId':_0x52018d[_0xda16('0x2a')]}}})[_0xda16('0x6')](function(_0x1d537f){if(_0x1d537f){return _0x1d537f;}return request(_0xda16('0x2b'),{'body':_0x52018d});});};exports['getPauseById']=function(_0x475351){return request('ShowPause',{'options':{'where':{'id':_0x475351},'attributes':[_0xda16('0xd')]}});};exports[_0xda16('0x2c')]=function(_0x4629cd,_0x1bff78){return request(_0xda16('0x2d'),{'body':{'interface':_0x1bff78},'options':{'where':_0x4629cd}});};exports[_0xda16('0x2e')]=function(_0x1e2e01,_0x291b4a,_0x5148f9){return request(_0xda16('0x2f'),{'body':{'type':_0x291b4a,'uniqueid':_0x5148f9},'options':{'where':_0x1e2e01}});};exports[_0xda16('0x30')]=function(_0x983222){return request('UnpauseUser',{'body':{},'options':{'where':_0x983222}});};exports[_0xda16('0x31')]=function(_0x5072c3){return request(_0xda16('0x32'),{'body':{},'options':{'where':_0x5072c3}});}; \ No newline at end of file +var _0xd8a0=['message','result','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','Smtp','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ShowCmHopper','phone','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','agentUnpause','UnpauseUser','LogoutUser','bluebird','moment','lodash','client','http','request','then','error'];(function(_0x12a824,_0x11873a){var _0x4f02f2=function(_0x1ee90b){while(--_0x1ee90b){_0x12a824['push'](_0x12a824['shift']());}};_0x4f02f2(++_0x11873a);}(_0xd8a0,0x74));var _0x0d8a=function(_0x14560e,_0x55aae6){_0x14560e=_0x14560e-0x0;var _0x1f0a77=_0xd8a0[_0x14560e];return _0x1f0a77;};'use strict';var BPromise=require(_0x0d8a('0x0'));var moment=require(_0x0d8a('0x1'));var _=require(_0x0d8a('0x2'));var util=require('util');var jayson=require('jayson/promise');var client=jayson[_0x0d8a('0x3')][_0x0d8a('0x4')]({'port':0x2329});function request(_0xca194d,_0x3bb5cd){return new BPromise(function(_0x39b7c2,_0x3a919a){return client[_0x0d8a('0x5')](_0xca194d,_0x3bb5cd)[_0x0d8a('0x6')](function(_0x5d668a){if(_0x5d668a[_0x0d8a('0x7')]){return _0x3a919a(_0x5d668a[_0x0d8a('0x7')][_0x0d8a('0x8')]);}else{return _0x39b7c2(_0x5d668a[_0x0d8a('0x9')]);}})[_0x0d8a('0xa')](function(_0x863b2a){return _0x3a919a(_0x863b2a);});});}exports[_0x0d8a('0xb')]=function(_0x57a715){return request(_0x0d8a('0xc'),{'options':{'raw':![],'where':{'name':_0x57a715},'attributes':[_0x0d8a('0xd')]}});};exports[_0x0d8a('0xe')]=function(_0x40e42d){return request(_0x0d8a('0xf'),{'options':{'raw':![],'where':{'id':_0x40e42d},'include':[{'model':'MailServerOut','as':_0x0d8a('0x10')}],'attributes':['id',_0x0d8a('0x11'),_0x0d8a('0x12')]}});};exports[_0x0d8a('0x13')]=function(_0x172e54){return request(_0x0d8a('0xc'),{'options':{'where':{'id':_0x172e54},'attributes':[_0x0d8a('0x11')]}});};exports[_0x0d8a('0x14')]=function(_0x5e17c3){return request(_0x0d8a('0x15'),{'options':{'where':{'id':_0x5e17c3},'attributes':[_0x0d8a('0x11')]}});};exports[_0x0d8a('0x16')]=function(_0x5950fc){return request('ShowVariable',{'options':{'where':{'id':_0x5950fc},'attributes':[_0x0d8a('0x11')]}});};exports[_0x0d8a('0x17')]=function(_0xd49da0){return request('ShowSquareOdbc',{'options':{'where':{'id':_0xd49da0},'attributes':[_0x0d8a('0x18')]}});};exports[_0x0d8a('0x19')]=function(_0x56a167){return request(_0x0d8a('0x1a'),{'options':{'where':{'id':_0x56a167},'attributes':['name']}});};exports[_0x0d8a('0x1b')]=function(_0x45eed1){return request(_0x0d8a('0x1c'),{'options':{'where':{'id':_0x45eed1},'attributes':['name']}});};exports[_0x0d8a('0x1d')]=function(_0x589926){return request(_0x0d8a('0x1e'),{'options':{'where':{'id':_0x589926},'attributes':['save_name']}});};exports['getIntervalById']=function(_0x35bc16){return request(_0x0d8a('0x1f'),{'options':{'raw':![],'where':{'id':_0x35bc16},'include':[{'model':_0x0d8a('0x20'),'as':_0x0d8a('0x21')}]}});};exports[_0x0d8a('0x22')]=function(_0x431efe){return request(_0x0d8a('0x23'),{'options':{'where':{'id':_0x431efe},'attributes':['id',_0x0d8a('0x11')]}});};exports[_0x0d8a('0x24')]=function(_0x45d145){return request('CreateSmsMessage',{'body':_0x45d145});};exports[_0x0d8a('0x25')]=function(_0x2c9e88){return request(_0x0d8a('0x26'),{'body':_0x2c9e88});};exports[_0x0d8a('0x27')]=function(_0x2a7691){return request(_0x0d8a('0x28'),{'body':_[_0x0d8a('0x29')](_0x2a7691,{'project_name':_0x2a7691[_0x0d8a('0x2a')],'prev_project_name':_0x2a7691[_0x0d8a('0x2b')]||'','is_subproject':_0x2a7691[_0x0d8a('0x2b')]?!![]:![],'leaveAt':moment()[_0x0d8a('0x2c')](_0x0d8a('0x2d'))})});};exports[_0x0d8a('0x2e')]=function(_0x16b588){return request(_0x0d8a('0x2f'),{'body':_0x16b588});};exports[_0x0d8a('0x30')]=function(_0x45b69e){return request(_0x0d8a('0x31'),{'body':_0x45b69e});};exports['createCmContact']=function(_0x31c5cf){return request(_0x0d8a('0x32'),{'options':{'raw':![],'where':{'phone':_0x31c5cf[_0x0d8a('0x33')],'ListId':_0x31c5cf[_0x0d8a('0x34')]}}})[_0x0d8a('0x6')](function(_0xaf101b){if(_0xaf101b){return _0xaf101b;}return request(_0x0d8a('0x35'),{'body':_0x31c5cf});});};exports[_0x0d8a('0x36')]=function(_0x5d2041){return request(_0x0d8a('0x37'),{'options':{'where':{'id':_0x5d2041},'attributes':[_0x0d8a('0x11')]}});};exports[_0x0d8a('0x38')]=function(_0x351eb0,_0x441794){return request(_0x0d8a('0x39'),{'body':{'interface':_0x441794},'options':{'where':_0x351eb0}});};exports[_0x0d8a('0x3a')]=function(_0x31f02b,_0x56f5f7,_0x50b8b9){return request('PauseUser',{'body':{'type':_0x56f5f7,'uniqueid':_0x50b8b9},'options':{'where':_0x31f02b}});};exports[_0x0d8a('0x3b')]=function(_0x7db7c2){return request(_0x0d8a('0x3c'),{'body':{},'options':{'where':_0x7db7c2}});};exports['agentLogout']=function(_0x430715){return request(_0x0d8a('0x3d'),{'body':{},'options':{'where':_0x430715}});}; \ 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 5eb10fc..cb6105c 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 _0x4b84=['./polly','./lex'];(function(_0x7ba1c3,_0x3dd545){var _0x82b393=function(_0x1550ce){while(--_0x1550ce){_0x7ba1c3['push'](_0x7ba1c3['shift']());}};_0x82b393(++_0x3dd545);}(_0x4b84,0x1cc));var _0x44b8=function(_0x1ebeea,_0x2f54f4){_0x1ebeea=_0x1ebeea-0x0;var _0x576465=_0x4b84[_0x1ebeea];return _0x576465;};var polly=require(_0x44b8('0x0'));var lex=require(_0x44b8('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x207c=['./lex','exports'];(function(_0x4990d5,_0xe2c486){var _0x275e25=function(_0x4de73e){while(--_0x4de73e){_0x4990d5['push'](_0x4990d5['shift']());}};_0x275e25(++_0xe2c486);}(_0x207c,0x1e8));var _0xc207=function(_0x50c50b,_0x3a6fb3){_0x50c50b=_0x50c50b-0x0;var _0x423c29=_0x207c[_0x50c50b];return _0x423c29;};var polly=require('./polly');var lex=require(_0xc207('0x0'));module[_0xc207('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 5ff2fc8..c380047 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa8a8=['./lib/api','exports'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xa8a8,0xec));var _0x8a8a=function(_0x307e19,_0x4d90f){_0x307e19=_0x307e19-0x0;var _0x589721=_0xa8a8[_0x307e19];return _0x589721;};'use strict';var lex=require(_0x8a8a('0x0'));module[_0x8a8a('0x1')]=function(_0x1934ab,_0x2dd9b7,_0x5221bc,_0x2a2676,_0x3296a6,_0xf11a08){return lex(_0x1934ab,_0x2dd9b7,_0x5221bc,_0x2a2676,_0x3296a6,_0xf11a08);}; \ No newline at end of file +var _0xe57e=['./lib/api'];(function(_0x599eed,_0x2f0607){var _0x50a279=function(_0x3eab28){while(--_0x3eab28){_0x599eed['push'](_0x599eed['shift']());}};_0x50a279(++_0x2f0607);}(_0xe57e,0xf2));var _0xee57=function(_0x234472,_0x1c9717){_0x234472=_0x234472-0x0;var _0x3e1ad8=_0xe57e[_0x234472];return _0x3e1ad8;};'use strict';var lex=require(_0xee57('0x0'));module['exports']=function(_0xe45cd,_0xb8b97f,_0x336aaa,_0x59bb30,_0x5e53cc,_0x2dbc91){return lex(_0xe45cd,_0xb8b97f,_0x336aaa,_0x59bb30,_0x5e53cc,_0x2dbc91);}; \ 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 64ea7bc..7563c69 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 _0x0894=['LexRuntime','$LATEST','bluebird','aws-sdk','postText','slots','slot_','exports'];(function(_0x1b4ccb,_0xb73298){var _0x15a0a7=function(_0x55b86a){while(--_0x55b86a){_0x1b4ccb['push'](_0x1b4ccb['shift']());}};_0x15a0a7(++_0xb73298);}(_0x0894,0x72));var _0x4089=function(_0x518161,_0x2e7baf){_0x518161=_0x518161-0x0;var _0x18169f=_0x0894[_0x518161];return _0x18169f;};'use strict';var BPromise=require(_0x4089('0x0'));var AWS=require(_0x4089('0x1'));function lexResult(_0x5f14a5,_0x2ab946){return new BPromise(function(_0x1ebb5d,_0x17ccbe){_0x5f14a5[_0x4089('0x2')](_0x2ab946,function(_0x333da0,_0x5454be){if(_0x333da0){_0x17ccbe(_0x333da0);}if(_0x5454be[_0x4089('0x3')]){for(const _0x2271bf in _0x5454be['slots']){if(_0x5454be[_0x4089('0x3')]['hasOwnProperty'](_0x2271bf)){var _0xc28746=_0x5454be['slots'][_0x2271bf];_0x5454be[_0x4089('0x4')+_0x2271bf]=_0xc28746;}}}_0x1ebb5d(_0x5454be);});});}module[_0x4089('0x5')]=function(_0x541a9c,_0x2f7c22,_0x25f533,_0x1b43de,_0x26dd7c,_0x3beb3c){var _0x1ede7d=new AWS[(_0x4089('0x6'))]({'accessKeyId':_0x2f7c22,'secretAccessKey':_0x25f533,'region':_0x1b43de});var _0x3c8a22={'botAlias':_0x4089('0x7'),'botName':_0x3beb3c,'inputText':_0x26dd7c,'userId':_0x541a9c};return lexResult(_0x1ede7d,_0x3c8a22);}; \ No newline at end of file +var _0x1aaf=['aws-sdk','postText','slots','slot_','$LATEST'];(function(_0x18f31b,_0x5f3a69){var _0x2e1c5b=function(_0x5e5733){while(--_0x5e5733){_0x18f31b['push'](_0x18f31b['shift']());}};_0x2e1c5b(++_0x5f3a69);}(_0x1aaf,0x1bd));var _0xf1aa=function(_0x237cb1,_0x2d6441){_0x237cb1=_0x237cb1-0x0;var _0x31481e=_0x1aaf[_0x237cb1];return _0x31481e;};'use strict';var BPromise=require('bluebird');var AWS=require(_0xf1aa('0x0'));function lexResult(_0x3f030d,_0x24ee90){return new BPromise(function(_0x1c79b4,_0xbdb2fc){_0x3f030d[_0xf1aa('0x1')](_0x24ee90,function(_0x5948ce,_0x15753f){if(_0x5948ce){_0xbdb2fc(_0x5948ce);}if(_0x15753f[_0xf1aa('0x2')]){for(const _0x5ccfec in _0x15753f[_0xf1aa('0x2')]){if(_0x15753f[_0xf1aa('0x2')]['hasOwnProperty'](_0x5ccfec)){var _0xcfa59c=_0x15753f['slots'][_0x5ccfec];_0x15753f[_0xf1aa('0x3')+_0x5ccfec]=_0xcfa59c;}}}_0x1c79b4(_0x15753f);});});}module['exports']=function(_0x48e076,_0x57cce8,_0x2f3fbb,_0x5baaa3,_0x43e280,_0x50f23a){var _0x179767=new AWS['LexRuntime']({'accessKeyId':_0x57cce8,'secretAccessKey':_0x2f3fbb,'region':_0x5baaa3});var _0xe3fd84={'botAlias':_0xf1aa('0x4'),'botName':_0x50f23a,'inputText':_0x43e280,'userId':_0x48e076};return lexResult(_0x179767,_0xe3fd84);}; \ 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 5ac2e80..20a678a 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. * // * * // ************************************************************************* -'use strict';var polly=require('./lib/api');module['exports']=function(_0x149e86,_0x3dfeef,_0xbbe852,_0x3673c7,_0x319eba,_0x4c603c,_0x37d8af){return polly(_0x149e86,_0x3dfeef,_0xbbe852,_0x3673c7,_0x319eba,_0x4c603c,_0x37d8af);}; \ No newline at end of file +var _0xb7a9=['exports'];(function(_0x1113aa,_0x7ad99f){var _0x395973=function(_0x40dc50){while(--_0x40dc50){_0x1113aa['push'](_0x1113aa['shift']());}};_0x395973(++_0x7ad99f);}(_0xb7a9,0x16b));var _0x9b7a=function(_0x2a10fc,_0x13c886){_0x2a10fc=_0x2a10fc-0x0;var _0x3a3d72=_0xb7a9[_0x2a10fc];return _0x3a3d72;};'use strict';var polly=require('./lib/api');module[_0x9b7a('0x0')]=function(_0x324275,_0x41d7d9,_0x46e2a1,_0x1194ae,_0x1925d9,_0x3eed9e,_0x151a57){return polly(_0x324275,_0x41d7d9,_0x46e2a1,_0x1194ae,_0x1925d9,_0x3eed9e,_0x151a57);}; \ 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 0ff2835..9334c39 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 _0x2202=['Polly','text','path','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x35cb03,_0x578e9d){var _0x696377=function(_0x318fa3){while(--_0x318fa3){_0x35cb03['push'](_0x35cb03['shift']());}};_0x696377(++_0x578e9d);}(_0x2202,0x1e2));var _0x2220=function(_0x506596,_0x4267e0){_0x506596=_0x506596-0x0;var _0xe29932=_0x2202[_0x506596];return _0xe29932;};'use strict';var fs=require('fs');var path=require(_0x2220('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var AWS=require('aws-sdk');function pollyResult(_0x27c25a,_0x5cc4a8,_0x4584c1){return new BPromise(function(_0x46441f,_0x590bcb){_0x27c25a[_0x2220('0x1')](_0x5cc4a8,function(_0x417343,_0x48c1ab){if(_0x417343){_0x590bcb(_0x417343);}else if(_0x48c1ab){if(_0x48c1ab[_0x2220('0x2')]instanceof Buffer){fs[_0x2220('0x3')](_0x4584c1,_0x48c1ab['AudioStream'],function(_0x3d3d02){if(_0x3d3d02){_0x590bcb(_0x3d3d02);}else{_0x46441f();}});}else{_0x590bcb(new Error(_0x2220('0x4')));}}else{_0x590bcb(new Error(_0x2220('0x5')));}});});}module['exports']=function(_0x3db94b,_0x40e6bc,_0x4e1846,_0x13b41b,_0x355b71,_0x32e2b7,_0x215168){var _0x2183d0=new AWS[(_0x2220('0x6'))]({'accessKeyId':_0x3db94b,'secretAccessKey':_0x40e6bc,'region':_0x4e1846});var _0x247542={'Text':_0x355b71,'TextType':_0x32e2b7||_0x2220('0x7'),'OutputFormat':'mp3','VoiceId':_0x13b41b};return pollyResult(_0x2183d0,_0x247542,_0x215168);}; \ No newline at end of file +var _0xa484=['writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream'];(function(_0xac3328,_0x23745a){var _0x33aec4=function(_0x476d1a){while(--_0x476d1a){_0xac3328['push'](_0xac3328['shift']());}};_0x33aec4(++_0x23745a);}(_0xa484,0x1e6));var _0x4a48=function(_0x4d9c81,_0x63c739){_0x4d9c81=_0x4d9c81-0x0;var _0x16539d=_0xa484[_0x4d9c81];return _0x16539d;};'use strict';var fs=require('fs');var path=require(_0x4a48('0x0'));var BPromise=require(_0x4a48('0x1'));var rs=require(_0x4a48('0x2'));var AWS=require(_0x4a48('0x3'));function pollyResult(_0x1044e3,_0x35bb50,_0x14f8cc){return new BPromise(function(_0x27a236,_0x4418f4){_0x1044e3[_0x4a48('0x4')](_0x35bb50,function(_0x30520a,_0x521dd8){if(_0x30520a){_0x4418f4(_0x30520a);}else if(_0x521dd8){if(_0x521dd8[_0x4a48('0x5')]instanceof Buffer){fs[_0x4a48('0x6')](_0x14f8cc,_0x521dd8[_0x4a48('0x5')],function(_0x4031e4){if(_0x4031e4){_0x4418f4(_0x4031e4);}else{_0x27a236();}});}else{_0x4418f4(new Error(_0x4a48('0x7')));}}else{_0x4418f4(new Error(_0x4a48('0x8')));}});});}module[_0x4a48('0x9')]=function(_0x38ede3,_0x39bfbb,_0x255978,_0x45772e,_0x148a1b,_0x5aaa09,_0xfcdf9a){var _0x118957=new AWS[(_0x4a48('0xa'))]({'accessKeyId':_0x38ede3,'secretAccessKey':_0x39bfbb,'region':_0x255978});var _0x337fea={'Text':_0x148a1b,'TextType':_0x5aaa09||_0x4a48('0xb'),'OutputFormat':'mp3','VoiceId':_0x45772e};return pollyResult(_0x118957,_0x337fea,_0xfcdf9a);}; \ 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 2a3e5a4..987a9f0 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 _0x2a38=['exports'];(function(_0x52c558,_0x47ce58){var _0x19c919=function(_0xc65fc4){while(--_0xc65fc4){_0x52c558['push'](_0x52c558['shift']());}};_0x19c919(++_0x47ce58);}(_0x2a38,0xe4));var _0x82a3=function(_0x44e855,_0x3c6402){_0x44e855=_0x44e855-0x0;var _0x48e240=_0x2a38[_0x44e855];return _0x48e240;};'use strict';var asr=require('./lib/api');module[_0x82a3('0x0')]=function(_0x31d888,_0x34fb1a,_0x477316,_0x32ef24){return asr(_0x31d888,_0x34fb1a,_0x477316);}; \ No newline at end of file +var _0xdcec=['./lib/api'];(function(_0x4c7e43,_0x44419e){var _0x5c55a9=function(_0x565e9e){while(--_0x565e9e){_0x4c7e43['push'](_0x4c7e43['shift']());}};_0x5c55a9(++_0x44419e);}(_0xdcec,0x95));var _0xcdce=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xdcec[_0x23e7c1];return _0x1add43;};'use strict';var asr=require(_0xcdce('0x0'));module['exports']=function(_0x1d2252,_0x185fd0,_0x3cc9d2,_0xa8467b){return asr(_0x1d2252,_0x185fd0,_0x3cc9d2);}; \ 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 87eb27d..6f08846 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 _0xaf2e=['url','bluebird','https://speech.googleapis.com','exports','string','filepath\x20should\x20be\x20a\x20string','length','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xaf2e,0x14a));var _0xeaf2=function(_0x13107a,_0x46ea09){_0x13107a=_0x13107a-0x0;var _0x13cc3e=_0xaf2e[_0x13107a];return _0x13cc3e;};'use strict';var url=require(_0xeaf2('0x0'));var BPromise=require(_0xeaf2('0x1'));var fs=require('fs');var host=_0xeaf2('0x2');module[_0xeaf2('0x3')]=function(_0x25645d,_0x45bc23,_0x1c4112){return new BPromise(function(_0x304c08,_0x45ef5e){var _0x5b62e7;if(typeof _0x25645d!==_0xeaf2('0x4')||_0x25645d['length']===0x0){return _0x45ef5e(_0xeaf2('0x5'));}if(typeof _0x45bc23!=='string'||_0x45bc23['length']===0x0){return _0x45ef5e('key\x20should\x20be\x20a\x20string');}if(typeof _0x1c4112!=='undefined'&&(typeof _0x1c4112!==_0xeaf2('0x4')||_0x1c4112[_0xeaf2('0x6')]===0x0)){return _0x45ef5e(_0xeaf2('0x7'));}try{_0x5b62e7=fs[_0xeaf2('0x8')](_0x25645d)[_0xeaf2('0x9')](_0xeaf2('0xa'));}catch(_0x2f20a6){return _0x45ef5e(_0x2f20a6);}return _0x304c08({'method':_0xeaf2('0xb'),'uri':host+_0xeaf2('0xc')+_0x45bc23,'body':{'config':{'encoding':_0xeaf2('0xd'),'sampleRateHertz':_0xeaf2('0xe'),'languageCode':_0x1c4112},'audio':{'content':_0x5b62e7}},'json':!![]});});}; \ No newline at end of file +var _0x17aa=['https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird'];(function(_0x5d933e,_0x33dfa0){var _0x2eab6c=function(_0x5b3b4a){while(--_0x5b3b4a){_0x5d933e['push'](_0x5d933e['shift']());}};_0x2eab6c(++_0x33dfa0);}(_0x17aa,0x7e));var _0xa17a=function(_0x2d0fcc,_0x402049){_0x2d0fcc=_0x2d0fcc-0x0;var _0x53ce44=_0x17aa[_0x2d0fcc];return _0x53ce44;};'use strict';var url=require(_0xa17a('0x0'));var BPromise=require(_0xa17a('0x1'));var fs=require('fs');var host=_0xa17a('0x2');module[_0xa17a('0x3')]=function(_0x1cca30,_0xadf198,_0x337965){return new BPromise(function(_0x2d7b13,_0x4f4b77){var _0x2ea3a7;if(typeof _0x1cca30!==_0xa17a('0x4')||_0x1cca30[_0xa17a('0x5')]===0x0){return _0x4f4b77(_0xa17a('0x6'));}if(typeof _0xadf198!=='string'||_0xadf198[_0xa17a('0x5')]===0x0){return _0x4f4b77(_0xa17a('0x7'));}if(typeof _0x337965!==_0xa17a('0x8')&&(typeof _0x337965!==_0xa17a('0x4')||_0x337965[_0xa17a('0x5')]===0x0)){return _0x4f4b77(_0xa17a('0x9'));}try{_0x2ea3a7=fs[_0xa17a('0xa')](_0x1cca30)[_0xa17a('0xb')](_0xa17a('0xc'));}catch(_0x3715e4){return _0x4f4b77(_0x3715e4);}return _0x2d7b13({'method':'POST','uri':host+_0xa17a('0xd')+_0xadf198,'body':{'config':{'encoding':_0xa17a('0xe'),'sampleRateHertz':_0xa17a('0xf'),'languageCode':_0x337965},'audio':{'content':_0x2ea3a7}},'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 56ee3e4..f2e953c 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 _0x4458=['./asr','exports'];(function(_0x4797b0,_0x37ab30){var _0x257cf4=function(_0x3c9356){while(--_0x3c9356){_0x4797b0['push'](_0x4797b0['shift']());}};_0x257cf4(++_0x37ab30);}(_0x4458,0xe6));var _0x8445=function(_0x5541fa,_0x1ee96c){_0x5541fa=_0x5541fa-0x0;var _0x2c81d1=_0x4458[_0x5541fa];return _0x2c81d1;};var asr=require(_0x8445('0x0'));module[_0x8445('0x1')]={'asr':asr}; \ No newline at end of file +var _0x8917=['./asr','exports'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x8917,0xc8));var _0x7891=function(_0x29d861,_0xbc39a2){_0x29d861=_0x29d861-0x0;var _0x223f53=_0x8917[_0x29d861];return _0x223f53;};var asr=require(_0x7891('0x0'));module[_0x7891('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 5949fbd..01b9e5c 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 _0x633b=['chmodSync','777','split','readFileSync','?key=','ssml','input','audioConfig','text:synthesize','POST','then','.mp3','audioContent','info','googleCloudTTS\x20path','googleTTS','.wav','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','confidence','join','googleASR\x20confidence','[%s]\x20%s:%s','message','googleDialogflow','stringify','source','resolvedQuery','result','action','fulfillment','speech','score','code','metadata','endConversation','isFallbackIntent','Tilde\x20ASR\x20transcription','awsPolly','polly','awsLex','lex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','text','channelData','CustomAction','AudioFromTts','Data','audiofile','dirName','path','http','https','url','parse','bluebird','randomstring','request-promise','util','querystring','md5','./google','./aws','./tilde','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','close','unlink','download\x20error','end','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','base64'];(function(_0x9206ca,_0x4db008){var _0x343e9b=function(_0x54e51d){while(--_0x54e51d){_0x9206ca['push'](_0x9206ca['shift']());}};_0x343e9b(++_0x4db008);}(_0x633b,0x175));var _0xb633=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x633b[_0x20a584];return _0x4b41a8;};'use strict';var fs=require('fs');var path=require(_0xb633('0x0'));var http=require(_0xb633('0x1'));var https=require(_0xb633('0x2'));var urlParse=require(_0xb633('0x3'))[_0xb633('0x4')];var BPromise=require(_0xb633('0x5'));var rs=require(_0xb633('0x6'));var sox=require('sox');var rp=require(_0xb633('0x7'));var util=require(_0xb633('0x8'));var querystring=require(_0xb633('0x9'));var tts=require('google-tts-api');var apiai=require('apiai-promise');var md5=require(_0xb633('0xa'));var google=require(_0xb633('0xb'));var aws=require(_0xb633('0xc'));var tilde=require(_0xb633('0xd'));var sestek=require(_0xb633('0xe'));var logger=require(_0xb633('0xf'))(_0xb633('0x10'));var ISPEECH_API=_0xb633('0x11');function downloadFile(_0x22468d,_0xc9503c){return new BPromise(function(_0x36b436,_0xac298a){var _0x2d7b8f=urlParse(_0x22468d);var _0x121d22=_0x2d7b8f[_0xb633('0x12')]===_0xb633('0x13')?https:http;var _0x2fc224={'host':_0x2d7b8f[_0xb633('0x14')],'path':_0x2d7b8f[_0xb633('0x0')],'headers':{'user-agent':'WHAT_EVER'}};_0x121d22[_0xb633('0x15')](_0x2fc224,function(_0x1575fc){if(_0x1575fc[_0xb633('0x16')]!==0xc8){logger[_0xb633('0x17')](_0xb633('0x18')+_0x22468d+'\x20failed,\x20status\x20code\x20=\x20'+_0x1575fc['statusCode']+'\x20('+_0x1575fc['statusMessage']+')');_0xac298a(new Error('request\x20to\x20'+_0x22468d+_0xb633('0x19')+_0x1575fc[_0xb633('0x16')]+'\x20('+_0x1575fc[_0xb633('0x1a')]+')'));return;}var _0x5bd577=fs[_0xb633('0x1b')](_0xc9503c);_0x5bd577['on'](_0xb633('0x1c'),function(){logger['info']('finish\x20download\x20file');_0x5bd577[_0xb633('0x1d')](_0x36b436);});_0x5bd577['on'](_0xb633('0x17'),function(_0x26295a){fs[_0xb633('0x1e')](_0xc9503c);logger['error'](_0xb633('0x1f'),_0x26295a);_0xac298a(_0x26295a);});_0x1575fc['pipe'](_0x5bd577);})['on'](_0xb633('0x17'),function(_0x5e6ab8){logger[_0xb633('0x17')](_0x5e6ab8);_0xac298a(_0x5e6ab8);})[_0xb633('0x20')]();});}function uploadFile(_0x3b0f3c){return new BPromise(function(_0xbdbfdf,_0x30bafc){var _0x2a5085=urlParse(_0x3b0f3c);var _0x17f6df=_0x2a5085[_0xb633('0x12')]===_0xb633('0x13')?https:http;var _0x319930={'host':_0x2a5085[_0xb633('0x14')],'path':_0x2a5085[_0xb633('0x0')],'headers':{'user-agent':'WHAT_EVER'}};_0x17f6df[_0xb633('0x15')](_0x319930,function(_0x18967b){if(_0x18967b[_0xb633('0x16')]!==0xc8){_0x30bafc(new Error(_0xb633('0x18')+_0x3b0f3c+_0xb633('0x19')+_0x18967b[_0xb633('0x16')]+'\x20('+_0x18967b[_0xb633('0x1a')]+')'));return;}var _0x4923c4='';_0x18967b['on'](_0xb633('0x21'),function(_0x24758f){_0x4923c4+=_0x24758f;});_0x18967b['on']('end',function(){_0xbdbfdf(_0x4923c4);});})['on'](_0xb633('0x17'),function(_0x45b6b1){_0x30bafc(_0x45b6b1);})['end']();});}function convertFile(_0x4c9c54,_0x33d7c8){return new BPromise(function(_0x234c03,_0x4ef367){var _0x1af1b6=sox[_0xb633('0x22')](_0x4c9c54,_0x33d7c8,{'sampleRate':0x1f40,'format':_0xb633('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1af1b6['on'](_0xb633('0x17'),function(_0x1f2e32){logger[_0xb633('0x17')](_0xb633('0x24'),_0x1f2e32);_0x4ef367(_0x1f2e32);});_0x1af1b6['on'](_0xb633('0x20'),function(){logger['info'](_0xb633('0x25'));_0x234c03();});_0x1af1b6[_0xb633('0x26')]();});}function base64Decode(_0x56b96b,_0x994a6a){var _0xf708f6=path[_0xb633('0x27')](__dirname,_0xb633('0x28'),rs[_0xb633('0x29')](0x4)+'.wav');fs['writeFileSync'](_0xf708f6,_0x56b96b,_0xb633('0x2a'));return convertFile(_0xf708f6,_0x994a6a)['then'](function(){try{fs[_0xb633('0x1e')](_0xf708f6);fs[_0xb633('0x2b')](_0x994a6a,_0xb633('0x2c'));}catch(_0x5c324e){logger['error'](_0x5c324e);}return _0x994a6a[_0xb633('0x2d')]('.')[0x0];});}function base64Encode(_0x2495a6){var _0x277d00=fs[_0xb633('0x2e')](_0x2495a6);return new Buffer(_0x277d00)['toString'](_0xb633('0x2a'));}exports['googleCloudTTS']=function(_0x4aed5c,_0x5ca885,_0x5e3df7,_0xc7e424,_0x50af49,_0x2ea748){var _0x34293d,_0x5f0e2e;var _0x134a8b='https://texttospeech.googleapis.com/v1/';var _0x10aff4=_0xb633('0x2f')+_0x4aed5c;var _0x56a4d5={};if(_0x5ca885===_0xb633('0x30')){_0x56a4d5['input']={'ssml':_0x5e3df7};}else{_0x56a4d5[_0xb633('0x31')]={'text':_0x5e3df7};};_0x56a4d5['voice']={'languageCode':_0xc7e424,'ssmlGender':_0x50af49};_0x56a4d5[_0xb633('0x32')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x25e1af={'url':_0x134a8b+_0xb633('0x33')+_0x10aff4,'method':_0xb633('0x34'),'json':!![],'body':_0x56a4d5};return rp(_0x25e1af)[_0xb633('0x35')](function(_0x4456b4){return new BPromise(function(_0x1b7181,_0x284aff){_0x34293d=path['resolve'](__dirname,'tmp',rs[_0xb633('0x29')](0x4)+_0xb633('0x36'));var _0x94ddd9=Buffer['from'](_0x4456b4[_0xb633('0x37')],_0xb633('0x2a'));return fs['writeFile'](_0x34293d,_0x94ddd9,function(_0x46ea4d){_0x284aff(_0x46ea4d);},function(_0x54b4fd){fs[_0xb633('0x2b')](_0x34293d,_0xb633('0x2c'));_0x1b7181(_0x54b4fd);});});})[_0xb633('0x35')](function(_0x580503){_0x5f0e2e=path[_0xb633('0x27')](__dirname,_0xb633('0x28'),rs[_0xb633('0x29')](0x4)+'.wav');return convertFile(_0x34293d,_0x5f0e2e);})['then'](function(){try{fs['unlink'](_0x34293d);fs[_0xb633('0x2b')](_0x5f0e2e,_0xb633('0x2c'));}catch(_0x91985b){logger['error'](_0x91985b);}logger[_0xb633('0x38')](_0xb633('0x39'),_0x5f0e2e[_0xb633('0x2d')]('.')[0x0]);return _0x5f0e2e[_0xb633('0x2d')]('.')[0x0];});};exports[_0xb633('0x3a')]=function(_0x310c3f,_0xf88915){var _0x33cafa,_0x34725f;return tts(_0x310c3f,_0xf88915||'en',0x1)[_0xb633('0x35')](function(_0x433240){logger['info'](_0x433240);_0x33cafa=path['resolve'](__dirname,_0xb633('0x28'),rs[_0xb633('0x29')](0x4)+_0xb633('0x36'));return downloadFile(_0x433240,_0x33cafa);})['then'](function(){_0x34725f=path[_0xb633('0x27')](__dirname,_0xb633('0x28'),rs['generate'](0x4)+_0xb633('0x3b'));return convertFile(_0x33cafa,_0x34725f);})[_0xb633('0x35')](function(){try{fs[_0xb633('0x1e')](_0x33cafa);fs[_0xb633('0x2b')](_0x34725f,_0xb633('0x2c'));}catch(_0x116039){logger[_0xb633('0x17')](_0x116039);}logger[_0xb633('0x38')](_0xb633('0x3c'),_0x34725f[_0xb633('0x2d')]('.')[0x0]);return _0x34725f[_0xb633('0x2d')]('.')[0x0];});};exports[_0xb633('0x3d')]=function(_0xec5455,_0x12cfd5,_0x4f3dbb){return google[_0xb633('0x3e')](_0xec5455,_0x12cfd5,_0x4f3dbb)[_0xb633('0x35')](function(_0x41a94d){logger[_0xb633('0x38')](_0x41a94d[_0xb633('0x3f')]);return rp(_0x41a94d);})[_0xb633('0x35')](function(_0x4c5ce6){var _0x2dc60e='';var _0x59d271=0x0;try{fs[_0xb633('0x1e')](_0xec5455);}catch(_0x2748a4){logger[_0xb633('0x17')](_0x2748a4);}if(_0x4c5ce6&&_0x4c5ce6[_0xb633('0x40')]){_0x2dc60e=_0x4c5ce6[_0xb633('0x40')][_0xb633('0x41')](function(_0x8df60b){return _0x8df60b&&_0x8df60b[_0xb633('0x42')][0x0]&&_0x8df60b[_0xb633('0x42')][0x0][_0xb633('0x43')]?_0x8df60b[_0xb633('0x42')][0x0]['transcript']:'';})['join']('\x0a');_0x59d271=_0x4c5ce6[_0xb633('0x40')][_0xb633('0x41')](function(_0x4eda20){return _0x4eda20&&_0x4eda20['alternatives'][0x0]&&_0x4eda20[_0xb633('0x42')][0x0][_0xb633('0x44')]?_0x4eda20[_0xb633('0x42')][0x0]['confidence']:0x0;})[_0xb633('0x45')]('\x0a');}logger['info']('googleASR\x20transcription',_0x2dc60e);logger['info'](_0xb633('0x46'),_0x59d271);return{'transcript':_0x2dc60e,'confidence':_0x59d271};})['catch'](function(_0x1b4316){logger[_0xb633('0x17')](_0xb633('0x47'),_0x1b4316[_0xb633('0x16')],_0x1b4316['name'],_0x1b4316[_0xb633('0x48')]);});};exports[_0xb633('0x49')]=function(_0x3894b8,_0x580b56,_0x100e80,_0x50804e){var _0x77709a=apiai(_0x580b56,{'language':_0x50804e||'en'});return _0x77709a['textRequest'](_0x100e80,{'sessionId':md5(_0x3894b8)})['then'](function(_0x1a0350){logger[_0xb633('0x38')](JSON[_0xb633('0x4a')](_0x1a0350));return{'source':_0x1a0350['result'][_0xb633('0x4b')],'resolvedQuery':_0x1a0350['result'][_0xb633('0x4c')],'action':_0x1a0350[_0xb633('0x4d')][_0xb633('0x4e')],'actionIncomplete':_0x1a0350[_0xb633('0x4d')]['actionIncomplete'],'speech':_0x1a0350[_0xb633('0x4d')][_0xb633('0x4f')][_0xb633('0x50')],'score':_0x1a0350[_0xb633('0x4d')][_0xb633('0x51')],'statusCode':_0x1a0350['status'][_0xb633('0x52')],'endConversation':_0x1a0350['result'][_0xb633('0x53')][_0xb633('0x54')]||![],'isFallbackIntent':_0x1a0350[_0xb633('0x4d')][_0xb633('0x53')][_0xb633('0x55')]};});};exports['tildeASR']=function(_0x63a978,_0x1f635a,_0x3b2622,_0x2a7965){return tilde[_0xb633('0x3e')](_0x63a978,_0x1f635a,_0x3b2622,_0x2a7965)[_0xb633('0x35')](function(_0x22d9a3){try{fs[_0xb633('0x1e')](_0x63a978);}catch(_0x24a73d){logger[_0xb633('0x17')](_0x24a73d);}logger[_0xb633('0x38')](_0xb633('0x56'),_0x22d9a3['transcript']);logger['info']('Tilde\x20ASR\x20confidence',_0x22d9a3[_0xb633('0x44')]);return _0x22d9a3;});};exports[_0xb633('0x57')]=function(_0x40f1c2,_0x3fa3fa,_0x1fa1a8,_0x412c33,_0x33c3a4,_0x5a812a){var _0x1037a1=path[_0xb633('0x27')](__dirname,_0xb633('0x28'),rs[_0xb633('0x29')](0x4)+'.mp3');var _0x2e3ecd;return aws[_0xb633('0x58')](_0x40f1c2,_0x3fa3fa,_0x1fa1a8,_0x412c33,_0x33c3a4,_0x5a812a,_0x1037a1)[_0xb633('0x35')](function(){_0x2e3ecd=path[_0xb633('0x27')](__dirname,'tmp',rs['generate'](0x4)+_0xb633('0x3b'));return convertFile(_0x1037a1,_0x2e3ecd);})[_0xb633('0x35')](function(){try{fs[_0xb633('0x1e')](_0x1037a1);fs[_0xb633('0x2b')](_0x2e3ecd,_0xb633('0x2c'));}catch(_0x315e54){logger[_0xb633('0x17')](_0x315e54);}return _0x2e3ecd[_0xb633('0x2d')]('.')[0x0];});};exports[_0xb633('0x59')]=function(_0x3309b2,_0x995f46,_0x4b8a70,_0x31b02d,_0x3171a1,_0x5ee468){return aws[_0xb633('0x5a')](_0x3309b2,_0x995f46,_0x4b8a70,_0x31b02d,_0x3171a1,_0x5ee468)[_0xb633('0x35')](function(_0x2142c3){logger[_0xb633('0x38')](JSON[_0xb633('0x4a')](_0x2142c3));return _0x2142c3;});};exports['ispeechTTS']=function(_0xbd83e7,_0x4d50f8,_0x323397,_0x17fdb6){var _0x26761f=util[_0xb633('0x5b')](_0xb633('0x5c'),ISPEECH_API,_0xbd83e7,encodeURIComponent(_0x4d50f8),_0x323397,_0x17fdb6);var _0xc80eb0=path[_0xb633('0x27')](__dirname,_0xb633('0x28'),rs[_0xb633('0x29')](0x4)+_0xb633('0x36'));var _0x31ebfe;return downloadFile(_0x26761f,_0xc80eb0)['then'](function(){_0x31ebfe=path[_0xb633('0x27')](__dirname,_0xb633('0x28'),rs[_0xb633('0x29')](0x4)+_0xb633('0x3b'));return convertFile(_0xc80eb0,_0x31ebfe);})[_0xb633('0x35')](function(){try{fs[_0xb633('0x1e')](_0xc80eb0);fs[_0xb633('0x2b')](_0x31ebfe,'777');}catch(_0x4402cc){logger['error'](_0x4402cc);}return _0x31ebfe[_0xb633('0x2d')]('.')[0x0];});};exports['ispeechASR']=function(_0x2d002b,_0x8f1df9,_0x74e4db,_0x599ae8){var _0x3484df=util['format'](_0xb633('0x5d'),ISPEECH_API,_0x8f1df9,_0x74e4db,base64Encode(_0x2d002b),_0x599ae8?util[_0xb633('0x5b')](_0xb633('0x5e'),encodeURIComponent(_0x599ae8)):_0xb633('0x5f'));return uploadFile(_0x3484df)[_0xb633('0x35')](function(_0x2326e8){return querystring['parse'](_0x2326e8);});};exports[_0xb633('0x60')]=function(_0x2fe3e8,_0x32fc92){return sestek['nda'](_0x2fe3e8,_0x32fc92)[_0xb633('0x35')](function(_0x540d13){logger[_0xb633('0x38')](JSON[_0xb633('0x4a')](_0x540d13));var _0x44961c={'speech':_0x540d13[_0xb633('0x61')],'action':_0x540d13[_0xb633('0x62')]?_0x540d13['channelData'][_0xb633('0x63')]:undefined,'actiondata':_0x540d13[_0xb633('0x62')]?_0x540d13[_0xb633('0x62')]['CustomActionData']:undefined};if(_0x540d13[_0xb633('0x62')]&&_0x540d13[_0xb633('0x62')][_0xb633('0x64')]){return base64Decode(_0x540d13[_0xb633('0x62')][_0xb633('0x64')][_0xb633('0x65')],path['resolve'](__dirname,_0xb633('0x28'),rs[_0xb633('0x29')](0x4)+_0xb633('0x3b')))['then'](function(_0x9bb1fb){_0x44961c[_0xb633('0x66')]=_0x9bb1fb;return _0x44961c;});}return _0x44961c;});};exports[_0xb633('0x67')]=function(){return __dirname;}; \ No newline at end of file +var _0x5401=['readFileSync','toString','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','ssml','input','voice','audioConfig','MP3','POST','.mp3','from','writeFile','resolve','chmodSync','googleCloudTTS\x20path','goggleTTS\x20path','uri','results','alternatives','transcript','map','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','message','googleDialogflow','textRequest','result','source','resolvedQuery','actionIncomplete','fulfillment','score','status','code','metadata','endConversation','isFallbackIntent','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','stringify','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','parse','sestekNDA','nda','channelData','CustomAction','AudioFromTts','Data','dirName','path','http','https','url','bluebird','randomstring','request-promise','querystring','google-tts-api','apiai-promise','md5','./google','./tilde','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','get','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','info','finish\x20download\x20file','close','error','download\x20error','end','WHAT_EVER','statusCode','data','wav','error\x20convert','finish\x20to\x20convert','tmp','generate','.wav','writeFileSync','then','unlink','777','split'];(function(_0x3c4f40,_0x302e0b){var _0x12032f=function(_0x159d92){while(--_0x159d92){_0x3c4f40['push'](_0x3c4f40['shift']());}};_0x12032f(++_0x302e0b);}(_0x5401,0x1f0));var _0x1540=function(_0x4a4e87,_0x485791){_0x4a4e87=_0x4a4e87-0x0;var _0x83444f=_0x5401[_0x4a4e87];return _0x83444f;};'use strict';var fs=require('fs');var path=require(_0x1540('0x0'));var http=require(_0x1540('0x1'));var https=require(_0x1540('0x2'));var urlParse=require(_0x1540('0x3'))['parse'];var BPromise=require(_0x1540('0x4'));var rs=require(_0x1540('0x5'));var sox=require('sox');var rp=require(_0x1540('0x6'));var util=require('util');var querystring=require(_0x1540('0x7'));var tts=require(_0x1540('0x8'));var apiai=require(_0x1540('0x9'));var md5=require(_0x1540('0xa'));var google=require(_0x1540('0xb'));var aws=require('./aws');var tilde=require(_0x1540('0xc'));var sestek=require(_0x1540('0xd'));var logger=require(_0x1540('0xe'))(_0x1540('0xf'));var ISPEECH_API=_0x1540('0x10');function downloadFile(_0x17f1ca,_0x473dc0){return new BPromise(function(_0x5ded9e,_0x115804){var _0x1f680e=urlParse(_0x17f1ca);var _0x5d2ba3=_0x1f680e[_0x1540('0x11')]===_0x1540('0x12')?https:http;var _0x1b201f={'host':_0x1f680e[_0x1540('0x13')],'path':_0x1f680e[_0x1540('0x0')],'headers':{'user-agent':'WHAT_EVER'}};_0x5d2ba3[_0x1540('0x14')](_0x1b201f,function(_0x2abecf){if(_0x2abecf['statusCode']!==0xc8){logger['error'](_0x1540('0x15')+_0x17f1ca+_0x1540('0x16')+_0x2abecf['statusCode']+'\x20('+_0x2abecf[_0x1540('0x17')]+')');_0x115804(new Error(_0x1540('0x15')+_0x17f1ca+_0x1540('0x16')+_0x2abecf['statusCode']+'\x20('+_0x2abecf[_0x1540('0x17')]+')'));return;}var _0x2b55de=fs['createWriteStream'](_0x473dc0);_0x2b55de['on']('finish',function(){logger[_0x1540('0x18')](_0x1540('0x19'));_0x2b55de[_0x1540('0x1a')](_0x5ded9e);});_0x2b55de['on']('error',function(_0x2d4994){fs['unlink'](_0x473dc0);logger[_0x1540('0x1b')](_0x1540('0x1c'),_0x2d4994);_0x115804(_0x2d4994);});_0x2abecf['pipe'](_0x2b55de);})['on'](_0x1540('0x1b'),function(_0x44fa47){logger[_0x1540('0x1b')](_0x44fa47);_0x115804(_0x44fa47);})[_0x1540('0x1d')]();});}function uploadFile(_0x4f7a61){return new BPromise(function(_0x573a4c,_0x225d65){var _0x59cf8e=urlParse(_0x4f7a61);var _0x49489b=_0x59cf8e[_0x1540('0x11')]===_0x1540('0x12')?https:http;var _0x5760cb={'host':_0x59cf8e[_0x1540('0x13')],'path':_0x59cf8e[_0x1540('0x0')],'headers':{'user-agent':_0x1540('0x1e')}};_0x49489b['get'](_0x5760cb,function(_0x4fcfcf){if(_0x4fcfcf[_0x1540('0x1f')]!==0xc8){_0x225d65(new Error(_0x1540('0x15')+_0x4f7a61+_0x1540('0x16')+_0x4fcfcf['statusCode']+'\x20('+_0x4fcfcf[_0x1540('0x17')]+')'));return;}var _0x505dd3='';_0x4fcfcf['on'](_0x1540('0x20'),function(_0x2b4261){_0x505dd3+=_0x2b4261;});_0x4fcfcf['on'](_0x1540('0x1d'),function(){_0x573a4c(_0x505dd3);});})['on'](_0x1540('0x1b'),function(_0x281ce5){_0x225d65(_0x281ce5);})[_0x1540('0x1d')]();});}function convertFile(_0x16ff15,_0x477179){return new BPromise(function(_0x544e2d,_0x2caf01){var _0xbe7085=sox['transcode'](_0x16ff15,_0x477179,{'sampleRate':0x1f40,'format':_0x1540('0x21'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xbe7085['on'](_0x1540('0x1b'),function(_0x240479){logger[_0x1540('0x1b')](_0x1540('0x22'),_0x240479);_0x2caf01(_0x240479);});_0xbe7085['on'](_0x1540('0x1d'),function(){logger['info'](_0x1540('0x23'));_0x544e2d();});_0xbe7085['start']();});}function base64Decode(_0x2b5b51,_0x416dac){var _0x1106b0=path['resolve'](__dirname,_0x1540('0x24'),rs[_0x1540('0x25')](0x4)+_0x1540('0x26'));fs[_0x1540('0x27')](_0x1106b0,_0x2b5b51,'base64');return convertFile(_0x1106b0,_0x416dac)[_0x1540('0x28')](function(){try{fs[_0x1540('0x29')](_0x1106b0);fs['chmodSync'](_0x416dac,_0x1540('0x2a'));}catch(_0x5c9118){logger[_0x1540('0x1b')](_0x5c9118);}return _0x416dac[_0x1540('0x2b')]('.')[0x0];});}function base64Encode(_0x429a32){var _0xb9ce7b=fs[_0x1540('0x2c')](_0x429a32);return new Buffer(_0xb9ce7b)[_0x1540('0x2d')](_0x1540('0x2e'));}exports[_0x1540('0x2f')]=function(_0x2d79de,_0x48ea85,_0x5629de,_0x42b320,_0x16e9fc,_0x1c4dcf){var _0x21c2a1,_0x52ab2e;var _0x5a7761=_0x1540('0x30');var _0x3f525b='?key='+_0x2d79de;var _0xbe6704={};if(_0x48ea85===_0x1540('0x31')){_0xbe6704[_0x1540('0x32')]={'ssml':_0x5629de};}else{_0xbe6704[_0x1540('0x32')]={'text':_0x5629de};};_0xbe6704[_0x1540('0x33')]={'languageCode':_0x42b320,'ssmlGender':_0x16e9fc};_0xbe6704[_0x1540('0x34')]={'audioEncoding':_0x1540('0x35'),'sampleRateHertz':0x1f40};var _0x4c1d3e={'url':_0x5a7761+'text:synthesize'+_0x3f525b,'method':_0x1540('0x36'),'json':!![],'body':_0xbe6704};return rp(_0x4c1d3e)[_0x1540('0x28')](function(_0x4b503b){return new BPromise(function(_0x497b20,_0x388c6f){_0x21c2a1=path['resolve'](__dirname,_0x1540('0x24'),rs[_0x1540('0x25')](0x4)+_0x1540('0x37'));var _0x58c54a=Buffer[_0x1540('0x38')](_0x4b503b['audioContent'],'base64');return fs[_0x1540('0x39')](_0x21c2a1,_0x58c54a,function(_0xcd3817){_0x388c6f(_0xcd3817);},function(_0x41c143){fs['chmodSync'](_0x21c2a1,_0x1540('0x2a'));_0x497b20(_0x41c143);});});})['then'](function(_0x529eff){_0x52ab2e=path[_0x1540('0x3a')](__dirname,_0x1540('0x24'),rs[_0x1540('0x25')](0x4)+_0x1540('0x26'));return convertFile(_0x21c2a1,_0x52ab2e);})[_0x1540('0x28')](function(){try{fs[_0x1540('0x29')](_0x21c2a1);fs[_0x1540('0x3b')](_0x52ab2e,'777');}catch(_0x53e7c2){logger[_0x1540('0x1b')](_0x53e7c2);}logger[_0x1540('0x18')](_0x1540('0x3c'),_0x52ab2e[_0x1540('0x2b')]('.')[0x0]);return _0x52ab2e['split']('.')[0x0];});};exports['googleTTS']=function(_0x304777,_0x1316d3){var _0x414865,_0x348681;return tts(_0x304777,_0x1316d3||'en',0x1)[_0x1540('0x28')](function(_0x26aec4){logger[_0x1540('0x18')](_0x26aec4);_0x414865=path['resolve'](__dirname,_0x1540('0x24'),rs['generate'](0x4)+_0x1540('0x37'));return downloadFile(_0x26aec4,_0x414865);})['then'](function(){_0x348681=path[_0x1540('0x3a')](__dirname,_0x1540('0x24'),rs[_0x1540('0x25')](0x4)+_0x1540('0x26'));return convertFile(_0x414865,_0x348681);})['then'](function(){try{fs[_0x1540('0x29')](_0x414865);fs[_0x1540('0x3b')](_0x348681,_0x1540('0x2a'));}catch(_0x5223e2){logger[_0x1540('0x1b')](_0x5223e2);}logger['info'](_0x1540('0x3d'),_0x348681['split']('.')[0x0]);return _0x348681[_0x1540('0x2b')]('.')[0x0];});};exports['googleASR']=function(_0x58a54d,_0x2388cb,_0xc5d4e3){return google['asr'](_0x58a54d,_0x2388cb,_0xc5d4e3)[_0x1540('0x28')](function(_0x5205e9){logger[_0x1540('0x18')](_0x5205e9[_0x1540('0x3e')]);return rp(_0x5205e9);})['then'](function(_0x222bfb){var _0x343ff6='';var _0x42a251=0x0;try{fs[_0x1540('0x29')](_0x58a54d);}catch(_0x3f1e50){logger[_0x1540('0x1b')](_0x3f1e50);}if(_0x222bfb&&_0x222bfb[_0x1540('0x3f')]){_0x343ff6=_0x222bfb[_0x1540('0x3f')]['map'](function(_0x4ecaa4){return _0x4ecaa4&&_0x4ecaa4[_0x1540('0x40')][0x0]&&_0x4ecaa4[_0x1540('0x40')][0x0][_0x1540('0x41')]?_0x4ecaa4[_0x1540('0x40')][0x0][_0x1540('0x41')]:'';})['join']('\x0a');_0x42a251=_0x222bfb['results'][_0x1540('0x42')](function(_0x3954e2){return _0x3954e2&&_0x3954e2['alternatives'][0x0]&&_0x3954e2[_0x1540('0x40')][0x0]['confidence']?_0x3954e2[_0x1540('0x40')][0x0][_0x1540('0x43')]:0x0;})['join']('\x0a');}logger['info'](_0x1540('0x44'),_0x343ff6);logger[_0x1540('0x18')](_0x1540('0x45'),_0x42a251);return{'transcript':_0x343ff6,'confidence':_0x42a251};})[_0x1540('0x46')](function(_0x201bf0){logger[_0x1540('0x1b')](_0x1540('0x47'),_0x201bf0[_0x1540('0x1f')],_0x201bf0['name'],_0x201bf0[_0x1540('0x48')]);});};exports[_0x1540('0x49')]=function(_0x5188f2,_0x57529c,_0x44a8e8,_0xf50fff){var _0x3ad6f6=apiai(_0x57529c,{'language':_0xf50fff||'en'});return _0x3ad6f6[_0x1540('0x4a')](_0x44a8e8,{'sessionId':md5(_0x5188f2)})[_0x1540('0x28')](function(_0x2e737d){logger[_0x1540('0x18')](JSON['stringify'](_0x2e737d));return{'source':_0x2e737d[_0x1540('0x4b')][_0x1540('0x4c')],'resolvedQuery':_0x2e737d[_0x1540('0x4b')][_0x1540('0x4d')],'action':_0x2e737d[_0x1540('0x4b')]['action'],'actionIncomplete':_0x2e737d[_0x1540('0x4b')][_0x1540('0x4e')],'speech':_0x2e737d[_0x1540('0x4b')][_0x1540('0x4f')]['speech'],'score':_0x2e737d['result'][_0x1540('0x50')],'statusCode':_0x2e737d[_0x1540('0x51')][_0x1540('0x52')],'endConversation':_0x2e737d[_0x1540('0x4b')][_0x1540('0x53')][_0x1540('0x54')]||![],'isFallbackIntent':_0x2e737d[_0x1540('0x4b')][_0x1540('0x53')][_0x1540('0x55')]};});};exports[_0x1540('0x56')]=function(_0x956acb,_0x4a9d8a,_0x403def,_0x396590){return tilde['asr'](_0x956acb,_0x4a9d8a,_0x403def,_0x396590)[_0x1540('0x28')](function(_0x53e77b){try{fs[_0x1540('0x29')](_0x956acb);}catch(_0x258193){logger[_0x1540('0x1b')](_0x258193);}logger[_0x1540('0x18')](_0x1540('0x57'),_0x53e77b[_0x1540('0x41')]);logger[_0x1540('0x18')](_0x1540('0x58'),_0x53e77b['confidence']);return _0x53e77b;});};exports[_0x1540('0x59')]=function(_0x22393c,_0x492b0d,_0xdd2e89,_0x41b480,_0x9a1551,_0x4b477d){var _0x359082=path[_0x1540('0x3a')](__dirname,'tmp',rs[_0x1540('0x25')](0x4)+_0x1540('0x37'));var _0x441763;return aws[_0x1540('0x5a')](_0x22393c,_0x492b0d,_0xdd2e89,_0x41b480,_0x9a1551,_0x4b477d,_0x359082)[_0x1540('0x28')](function(){_0x441763=path[_0x1540('0x3a')](__dirname,'tmp',rs[_0x1540('0x25')](0x4)+_0x1540('0x26'));return convertFile(_0x359082,_0x441763);})[_0x1540('0x28')](function(){try{fs[_0x1540('0x29')](_0x359082);fs[_0x1540('0x3b')](_0x441763,_0x1540('0x2a'));}catch(_0x119f30){logger[_0x1540('0x1b')](_0x119f30);}return _0x441763[_0x1540('0x2b')]('.')[0x0];});};exports[_0x1540('0x5b')]=function(_0x312e74,_0x394137,_0x4b5211,_0x5c838f,_0x28011b,_0xcd45b7){return aws[_0x1540('0x5c')](_0x312e74,_0x394137,_0x4b5211,_0x5c838f,_0x28011b,_0xcd45b7)[_0x1540('0x28')](function(_0x4b0f63){logger[_0x1540('0x18')](JSON[_0x1540('0x5d')](_0x4b0f63));return _0x4b0f63;});};exports[_0x1540('0x5e')]=function(_0x13ca53,_0x315af7,_0x53a2da,_0x1a8dbf){var _0x3c1e80=util[_0x1540('0x5f')](_0x1540('0x60'),ISPEECH_API,_0x13ca53,encodeURIComponent(_0x315af7),_0x53a2da,_0x1a8dbf);var _0x5b2df6=path['resolve'](__dirname,_0x1540('0x24'),rs['generate'](0x4)+_0x1540('0x37'));var _0x16c6f7;return downloadFile(_0x3c1e80,_0x5b2df6)['then'](function(){_0x16c6f7=path[_0x1540('0x3a')](__dirname,'tmp',rs['generate'](0x4)+'.wav');return convertFile(_0x5b2df6,_0x16c6f7);})[_0x1540('0x28')](function(){try{fs[_0x1540('0x29')](_0x5b2df6);fs[_0x1540('0x3b')](_0x16c6f7,'777');}catch(_0x670cf9){logger['error'](_0x670cf9);}return _0x16c6f7[_0x1540('0x2b')]('.')[0x0];});};exports[_0x1540('0x61')]=function(_0x196f9c,_0x4a7898,_0xb1e0ce,_0x37d3e1){var _0x195898=util[_0x1540('0x5f')](_0x1540('0x62'),ISPEECH_API,_0x4a7898,_0xb1e0ce,base64Encode(_0x196f9c),_0x37d3e1?util[_0x1540('0x5f')]('model=%s',encodeURIComponent(_0x37d3e1)):_0x1540('0x63'));return uploadFile(_0x195898)[_0x1540('0x28')](function(_0x4a1c4a){return querystring[_0x1540('0x64')](_0x4a1c4a);});};exports[_0x1540('0x65')]=function(_0x57844e,_0x4902f3){return sestek[_0x1540('0x66')](_0x57844e,_0x4902f3)['then'](function(_0x23eb00){logger[_0x1540('0x18')](JSON['stringify'](_0x23eb00));var _0x6439f={'speech':_0x23eb00['text'],'action':_0x23eb00['channelData']?_0x23eb00[_0x1540('0x67')][_0x1540('0x68')]:undefined,'actiondata':_0x23eb00[_0x1540('0x67')]?_0x23eb00[_0x1540('0x67')]['CustomActionData']:undefined};if(_0x23eb00[_0x1540('0x67')]&&_0x23eb00[_0x1540('0x67')][_0x1540('0x69')]){return base64Decode(_0x23eb00[_0x1540('0x67')][_0x1540('0x69')][_0x1540('0x6a')],path[_0x1540('0x3a')](__dirname,_0x1540('0x24'),rs['generate'](0x4)+_0x1540('0x26')))[_0x1540('0x28')](function(_0x175c95){_0x6439f['audiofile']=_0x175c95;return _0x6439f;});}return _0x6439f;});};exports[_0x1540('0x6b')]=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 3a6b5e0..efa2c8e 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 _0x8be7=['exports'];(function(_0x4a3cce,_0x3113ce){var _0x926687=function(_0x12464d){while(--_0x12464d){_0x4a3cce['push'](_0x4a3cce['shift']());}};_0x926687(++_0x3113ce);}(_0x8be7,0x98));var _0x78be=function(_0x587b4d,_0x10aded){_0x587b4d=_0x587b4d-0x0;var _0x1b48e=_0x8be7[_0x587b4d];return _0x1b48e;};var nda=require('./nda');module[_0x78be('0x0')]={'nda':nda}; \ No newline at end of file +var _0xfd22=['./nda','exports'];(function(_0x31c27f,_0x40294c){var _0x28f9c6=function(_0x4f7f35){while(--_0x4f7f35){_0x31c27f['push'](_0x31c27f['shift']());}};_0x28f9c6(++_0x40294c);}(_0xfd22,0x196));var _0x2fd2=function(_0x2b0f42,_0x1fd64e){_0x2b0f42=_0x2b0f42-0x0;var _0x5e2b8d=_0xfd22[_0x2b0f42];return _0x5e2b8d;};var nda=require(_0x2fd2('0x0'));module[_0x2fd2('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index e482e53..ae824c8 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 _0x6936=['request-promise','../../../../../config/logger','agi','POST','resolve','ndauth_url','password','username','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda','uniqueid','dnid','extension','text','access_token','project','body','channelData','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','custom_action_data'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0x6936,0x90));var _0x6693=function(_0x1f273b,_0xa0556a){_0x1f273b=_0x1f273b-0x0;var _0x3e7b95=_0x6936[_0x1f273b];return _0x3e7b95;};'use strict';var rp=require(_0x6693('0x0'));var url=require('url');var logger=require(_0x6693('0x1'))(_0x6693('0x2'));module['exports']=function(_0x329a40,_0x446ab2){var _0x392db7={'method':_0x6693('0x3'),'uri':url[_0x6693('0x4')](_0x446ab2[_0x6693('0x5')],'/token'),'form':{'grant_type':_0x6693('0x6'),'username':_0x446ab2[_0x6693('0x7')],'password':_0x446ab2[_0x6693('0x6')]},'json':!![]};return rp(_0x392db7)['then'](function(_0x5cbe39){var _0x81e77d={'method':_0x6693('0x3'),'uri':url[_0x6693('0x4')](_0x446ab2['ndassistant_url'],_0x6693('0x8')),'body':{'type':_0x446ab2[_0x6693('0x9')]||'message','channelId':_0x6693('0xa'),'conversation':{'id':_0x329a40[_0x6693('0xb')]},'from':{'id':_0x329a40['callerid'],'name':_0x329a40['calleridname']},'recipient':{'id':_0x329a40[_0x6693('0xc')],'name':_0x329a40[_0x6693('0xd')]},'text':_0x446ab2[_0x6693('0xe')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x5cbe39[_0x6693('0xf')]},'json':!![]};if(_0x446ab2[_0x6693('0x10')]){_0x81e77d[_0x6693('0x11')][_0x6693('0x12')]['ProjectName']=_0x446ab2[_0x6693('0x10')];}if(_0x446ab2[_0x6693('0x13')]=='1'){_0x81e77d['body'][_0x6693('0x12')][_0x6693('0x14')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x6693('0x15')};}if(_0x446ab2[_0x6693('0x16')]){_0x81e77d[_0x6693('0x11')][_0x6693('0x12')]['CustomAction']=_0x446ab2[_0x6693('0x16')];if(_0x446ab2[_0x6693('0x17')]){_0x81e77d[_0x6693('0x11')][_0x6693('0x12')]['CustomActionData']=_0x446ab2[_0x6693('0x17')];}}logger['info'](JSON['stringify'](_0x81e77d));return rp(_0x81e77d);});}; \ No newline at end of file +var _0x348f=['custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','calleridname','dnid','text','access_token','project','channelData','ProjectName','ndagenerate_audio','body','AudioOutputSettings'];(function(_0x17e743,_0x568254){var _0x263c25=function(_0xd4c238){while(--_0xd4c238){_0x17e743['push'](_0x17e743['shift']());}};_0x263c25(++_0x568254);}(_0x348f,0xa6));var _0xf348=function(_0xf33fb5,_0x208265){_0xf33fb5=_0xf33fb5-0x0;var _0x53c84e=_0x348f[_0xf33fb5];return _0x53c84e;};'use strict';var rp=require(_0xf348('0x0'));var url=require(_0xf348('0x1'));var logger=require(_0xf348('0x2'))(_0xf348('0x3'));module[_0xf348('0x4')]=function(_0xf491c7,_0x3fe60b){var _0x3e0ea={'method':_0xf348('0x5'),'uri':url[_0xf348('0x6')](_0x3fe60b[_0xf348('0x7')],_0xf348('0x8')),'form':{'grant_type':_0xf348('0x9'),'username':_0x3fe60b['username'],'password':_0x3fe60b['password']},'json':!![]};return rp(_0x3e0ea)['then'](function(_0x59c289){var _0x178ec3={'method':_0xf348('0x5'),'uri':url[_0xf348('0x6')](_0x3fe60b[_0xf348('0xa')],_0xf348('0xb')),'body':{'type':_0x3fe60b[_0xf348('0xc')]||_0xf348('0xd'),'channelId':_0xf348('0xe'),'conversation':{'id':_0xf491c7[_0xf348('0xf')]},'from':{'id':_0xf491c7['callerid'],'name':_0xf491c7[_0xf348('0x10')]},'recipient':{'id':_0xf491c7[_0xf348('0x11')],'name':_0xf491c7['extension']},'text':_0x3fe60b[_0xf348('0x12')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x59c289[_0xf348('0x13')]},'json':!![]};if(_0x3fe60b[_0xf348('0x14')]){_0x178ec3['body'][_0xf348('0x15')][_0xf348('0x16')]=_0x3fe60b[_0xf348('0x14')];}if(_0x3fe60b[_0xf348('0x17')]=='1'){_0x178ec3[_0xf348('0x18')]['channelData'][_0xf348('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x3fe60b[_0xf348('0x1a')]){_0x178ec3[_0xf348('0x18')][_0xf348('0x15')][_0xf348('0x1b')]=_0x3fe60b[_0xf348('0x1a')];if(_0x3fe60b[_0xf348('0x1c')]){_0x178ec3['body'][_0xf348('0x15')][_0xf348('0x1d')]=_0x3fe60b[_0xf348('0x1c')];}}logger[_0xf348('0x1e')](JSON[_0xf348('0x1f')](_0x178ec3));return rp(_0x178ec3);});}; \ 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 e6cb810..8b1004d 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 _0x2bc9=['exports','./lib/api'];(function(_0x5420e6,_0x3dbe59){var _0x36b5a8=function(_0x196535){while(--_0x196535){_0x5420e6['push'](_0x5420e6['shift']());}};_0x36b5a8(++_0x3dbe59);}(_0x2bc9,0xb9));var _0x92bc=function(_0x33c8cb,_0x56cff2){_0x33c8cb=_0x33c8cb-0x0;var _0x2d28bb=_0x2bc9[_0x33c8cb];return _0x2d28bb;};'use strict';var asr=require(_0x92bc('0x0'));module[_0x92bc('0x1')]=function(_0x15e197,_0x34d37b,_0x1018e5,_0x3df9de){return asr(_0x15e197,_0x34d37b,_0x1018e5,_0x3df9de);}; \ No newline at end of file +var _0xde7e=['./lib/api'];(function(_0x325991,_0x5ce781){var _0x595a50=function(_0x4c305d){while(--_0x4c305d){_0x325991['push'](_0x325991['shift']());}};_0x595a50(++_0x5ce781);}(_0xde7e,0xce));var _0xede7=function(_0x351d76,_0x1e50e9){_0x351d76=_0x351d76-0x0;var _0x3aa5d4=_0xde7e[_0x351d76];return _0x3aa5d4;};'use strict';var asr=require(_0xede7('0x0'));module['exports']=function(_0x248c14,_0x2818fe,_0x30620,_0x1ca129){return asr(_0x248c14,_0x2818fe,_0x30620,_0x1ca129);}; \ 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 35a36e4..53a20ea 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 _0x3f4a=['status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','isObject','open','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','error','Tilde\x20ASR\x20send\x20error','terminate','parse'];(function(_0x3f073e,_0x237f97){var _0x492e8a=function(_0xb4bba4){while(--_0xb4bba4){_0x3f073e['push'](_0x3f073e['shift']());}};_0x492e8a(++_0x237f97);}(_0x3f4a,0x195));var _0xa3f4=function(_0xc2304f,_0x485977){_0xc2304f=_0xc2304f-0x0;var _0x4b805b=_0x3f4a[_0xc2304f];return _0x4b805b;};'use strict';var BPromise=require(_0xa3f4('0x0'));var _=require(_0xa3f4('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xa3f4('0x2'));var crypto=require(_0xa3f4('0x3'));var logger=require(_0xa3f4('0x4'))('agi');module['exports']=function(_0x1c2989,_0x7682ae,_0x5a6932,_0x5b78d8){return new BPromise(function(_0x351ad5,_0x5f5472){logger[_0xa3f4('0x5')](_0xa3f4('0x6'),_0x5b78d8||_0xa3f4('0x7'));var _0x1f3a65=new WebSocket(_0x5b78d8||_0xa3f4('0x7'),{'perMessageDeflate':![]});var _0x3ffa10='';var _0x1e4eff='0';var _0x2d1385='1';var _0x18ecd8=_0xa3f4('0x8');function _0x2eed66(_0x43761a){var _0x323d63=crypto[_0xa3f4('0x9')](_0xa3f4('0xa'));_0x323d63['update'](_0x43761a);return _0x323d63[_0xa3f4('0xb')](_0xa3f4('0xc'));}function _0x45be37(){try{logger[_0xa3f4('0x5')](_0xa3f4('0xd'));var _0x22f77d=moment()[_0xa3f4('0xe')]();var _0x20cea1=_0x2eed66(_0x22f77d+_0x7682ae+_0x5a6932);_0x1f3a65[_0xa3f4('0xf')](JSON[_0xa3f4('0x10')]({'appID':_0x7682ae,'timestamp':_0x22f77d,'appKey':_0x20cea1}));var _0x566fd6=fs[_0xa3f4('0x11')](_0x1c2989);_0x566fd6['on'](_0xa3f4('0x12'),function(_0x4517df){_0x1f3a65[_0xa3f4('0xf')](_0x4517df);});_0x566fd6['on'](_0xa3f4('0x13'),function(){_0x1f3a65[_0xa3f4('0xf')]('EOS');});}catch(_0x55c416){logger[_0xa3f4('0x14')](_0xa3f4('0x15'),JSON[_0xa3f4('0x10')](_0x55c416));_0x1f3a65[_0xa3f4('0x16')]();}}function _0x4b2f5a(_0x25db68){try{if(_0x25db68){var _0x38b478=JSON[_0xa3f4('0x17')](_0x25db68);switch(_0x38b478[_0xa3f4('0x18')]){case 0x0:if(_0x38b478[_0xa3f4('0x19')]){if(_0x38b478[_0xa3f4('0x19')][_0xa3f4('0x1a')]){logger[_0xa3f4('0x5')](_0xa3f4('0x1b'),JSON[_0xa3f4('0x10')](_0x38b478['result'][_0xa3f4('0x1c')]));_0x3ffa10=_0x38b478[_0xa3f4('0x19')][_0xa3f4('0x1c')][0x0][_0xa3f4('0x1d')];_0x1e4eff=_0x38b478[_0xa3f4('0x19')][_0xa3f4('0x1c')][0x0]['likelihood'];_0x2d1385='0';_0x18ecd8=_0xa3f4('0x1e');_0x1f3a65[_0xa3f4('0x16')]();}}break;case 0x1:logger['info'](_0xa3f4('0x8'));_0x2d1385='1';_0x18ecd8=_0xa3f4('0x8');break;case 0x2:logger[_0xa3f4('0x5')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x2d1385='2';_0x18ecd8=_0xa3f4('0x1f');break;case 0x9:logger[_0xa3f4('0x5')](_0xa3f4('0x20'));_0x2d1385='9';_0x18ecd8=_0xa3f4('0x20');break;case 0xa:logger['info'](_0xa3f4('0x21'));_0x2d1385='10';_0x18ecd8='Authentication\x20failed.';break;case 0xb:logger[_0xa3f4('0x5')](_0xa3f4('0x22'));_0x2d1385='11';_0x18ecd8=_0xa3f4('0x22');}}}catch(_0x3301ee){logger[_0xa3f4('0x14')](_0xa3f4('0x23'),JSON[_0xa3f4('0x10')](_0x3301ee));_0x1f3a65['terminate']();}}function _0x46f5e3(){logger[_0xa3f4('0x5')]('Close\x20Tilde\x20ASR\x20socket');_0x351ad5({'transcript':_0x3ffa10,'confidence':_0x1e4eff,'status':_0x2d1385,'status_message':_0x18ecd8});}function _0x678e37(_0x5ddbbd){logger[_0xa3f4('0x14')]('Error\x20Tilde\x20ASR\x20socket');if(!_['isNil'](_0x5ddbbd)){logger['error'](_[_0xa3f4('0x24')](_0x5ddbbd)?JSON[_0xa3f4('0x10')](_0x5ddbbd):_0x5ddbbd);}}_0x1f3a65['on'](_0xa3f4('0x25'),_0x45be37);_0x1f3a65['on'](_0xa3f4('0x26'),_0x4b2f5a);_0x1f3a65['on'](_0xa3f4('0x13'),_0x46f5e3);_0x1f3a65['on'](_0xa3f4('0x14'),_0x678e37);});}; \ No newline at end of file +var _0xbb32=['close','EOS','error','Tilde\x20ASR\x20send\x20error','result','final','hypotheses','transcript','likelihood','terminate','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','open','message','bluebird','lodash','crypto','../../../../../../config/logger','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','createHash','sha1','update','digest','hex','unix','send','stringify','createReadStream','data'];(function(_0x610144,_0x1be4c5){var _0x43b6e4=function(_0x9a8044){while(--_0x9a8044){_0x610144['push'](_0x610144['shift']());}};_0x43b6e4(++_0x1be4c5);}(_0xbb32,0x18f));var _0x2bb3=function(_0x425540,_0x97a491){_0x425540=_0x425540-0x0;var _0x117693=_0xbb32[_0x425540];return _0x117693;};'use strict';var BPromise=require(_0x2bb3('0x0'));var _=require(_0x2bb3('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x2bb3('0x2'));var logger=require(_0x2bb3('0x3'))(_0x2bb3('0x4'));module['exports']=function(_0x546e5b,_0x41785f,_0x422ce1,_0x39c3e9){return new BPromise(function(_0x7c0eeb,_0x11dd57){logger[_0x2bb3('0x5')](_0x2bb3('0x6'),_0x39c3e9||_0x2bb3('0x7'));var _0x4e60d1=new WebSocket(_0x39c3e9||_0x2bb3('0x7'),{'perMessageDeflate':![]});var _0x261993='';var _0x8dacdc='0';var _0xa35bea='1';var _0x5c8d07=_0x2bb3('0x8');function _0x1018a9(_0x3311c2){var _0x45ebc2=crypto[_0x2bb3('0x9')](_0x2bb3('0xa'));_0x45ebc2[_0x2bb3('0xb')](_0x3311c2);return _0x45ebc2[_0x2bb3('0xc')](_0x2bb3('0xd'));}function _0x4c1dff(){try{logger[_0x2bb3('0x5')]('Open\x20Tilde\x20ASR\x20socket');var _0xa9df7b=moment()[_0x2bb3('0xe')]();var _0x445487=_0x1018a9(_0xa9df7b+_0x41785f+_0x422ce1);_0x4e60d1[_0x2bb3('0xf')](JSON[_0x2bb3('0x10')]({'appID':_0x41785f,'timestamp':_0xa9df7b,'appKey':_0x445487}));var _0x2b81ab=fs[_0x2bb3('0x11')](_0x546e5b);_0x2b81ab['on'](_0x2bb3('0x12'),function(_0x484075){_0x4e60d1['send'](_0x484075);});_0x2b81ab['on'](_0x2bb3('0x13'),function(){_0x4e60d1[_0x2bb3('0xf')](_0x2bb3('0x14'));});}catch(_0x4e6d7f){logger[_0x2bb3('0x15')](_0x2bb3('0x16'),JSON[_0x2bb3('0x10')](_0x4e6d7f));_0x4e60d1['terminate']();}}function _0x31187e(_0x4b44f5){try{if(_0x4b44f5){var _0x451977=JSON['parse'](_0x4b44f5);switch(_0x451977['status']){case 0x0:if(_0x451977[_0x2bb3('0x17')]){if(_0x451977[_0x2bb3('0x17')][_0x2bb3('0x18')]){logger[_0x2bb3('0x5')]('Tilde\x20ASR\x20hypoteses',JSON[_0x2bb3('0x10')](_0x451977[_0x2bb3('0x17')][_0x2bb3('0x19')]));_0x261993=_0x451977[_0x2bb3('0x17')][_0x2bb3('0x19')][0x0][_0x2bb3('0x1a')];_0x8dacdc=_0x451977[_0x2bb3('0x17')][_0x2bb3('0x19')][0x0][_0x2bb3('0x1b')];_0xa35bea='0';_0x5c8d07='Success.';_0x4e60d1[_0x2bb3('0x1c')]();}}break;case 0x1:logger['info'](_0x2bb3('0x8'));_0xa35bea='1';_0x5c8d07=_0x2bb3('0x8');break;case 0x2:logger['info'](_0x2bb3('0x1d'));_0xa35bea='2';_0x5c8d07='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x2bb3('0x5')](_0x2bb3('0x1e'));_0xa35bea='9';_0x5c8d07=_0x2bb3('0x1e');break;case 0xa:logger[_0x2bb3('0x5')](_0x2bb3('0x1f'));_0xa35bea='10';_0x5c8d07=_0x2bb3('0x1f');break;case 0xb:logger[_0x2bb3('0x5')](_0x2bb3('0x20'));_0xa35bea='11';_0x5c8d07=_0x2bb3('0x20');}}}catch(_0x557e99){logger['error']('Tilde\x20ASR\x20parse\x20error',JSON[_0x2bb3('0x10')](_0x557e99));_0x4e60d1[_0x2bb3('0x1c')]();}}function _0x16d860(){logger[_0x2bb3('0x5')](_0x2bb3('0x21'));_0x7c0eeb({'transcript':_0x261993,'confidence':_0x8dacdc,'status':_0xa35bea,'status_message':_0x5c8d07});}function _0x2b46b7(_0x19547a){logger[_0x2bb3('0x15')](_0x2bb3('0x22'));if(!_[_0x2bb3('0x23')](_0x19547a)){logger[_0x2bb3('0x15')](_['isObject'](_0x19547a)?JSON[_0x2bb3('0x10')](_0x19547a):_0x19547a);}}_0x4e60d1['on'](_0x2bb3('0x24'),_0x4c1dff);_0x4e60d1['on'](_0x2bb3('0x25'),_0x31187e);_0x4e60d1['on']('close',_0x16d860);_0x4e60d1['on']('error',_0x2b46b7);});}; \ 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 a31396c..ecce199 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 _0x5780=['exports'];(function(_0x2c60de,_0x565bf9){var _0x277399=function(_0x546af2){while(--_0x546af2){_0x2c60de['push'](_0x2c60de['shift']());}};_0x277399(++_0x565bf9);}(_0x5780,0xed));var _0x0578=function(_0x5c6cb9,_0x5289f5){_0x5c6cb9=_0x5c6cb9-0x0;var _0x171aff=_0x5780[_0x5c6cb9];return _0x171aff;};var asr=require('./asr');module[_0x0578('0x0')]={'asr':asr}; \ No newline at end of file +var _0x95c8=['exports'];(function(_0x521449,_0x4f77a1){var _0x2a84af=function(_0x1a95a2){while(--_0x1a95a2){_0x521449['push'](_0x521449['shift']());}};_0x2a84af(++_0x4f77a1);}(_0x95c8,0x16a));var _0x895c=function(_0x5a457e,_0x1083a9){_0x5a457e=_0x5a457e-0x0;var _0x1cb352=_0x95c8[_0x5a457e];return _0x1cb352;};var asr=require('./asr');module[_0x895c('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 06b7c65..e2147cd 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 _0x1c42=['connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','net','events','EventEmitter','./channel','127.0.0.1','call','emit','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x144867,_0x44c871){var _0x517f7b=function(_0xbc0c01){while(--_0xbc0c01){_0x144867['push'](_0x144867['shift']());}};_0x517f7b(++_0x44c871);}(_0x1c42,0x13a));var _0x21c4=function(_0x5a4161,_0x4061e0){_0x5a4161=_0x5a4161-0x0;var _0x1354da=_0x1c42[_0x5a4161];return _0x1354da;};'use strict';var util=require('util');var net=require(_0x21c4('0x0'));var EventEmitter=require(_0x21c4('0x1'))[_0x21c4('0x2')];var AGIError=require('./error');var AGIChannel=require(_0x21c4('0x3'));var AGIServer=function(_0x40bc3e,_0x1512d2,_0xd7340){var _0x435179=this,_0x40bc3e=_0x40bc3e||0x11dd,_0x1512d2=_0x1512d2||_0x21c4('0x4'),_0x8d4312=null,_0x4fc4da=0x0;EventEmitter[_0x21c4('0x5')](_0x435179);function _0x54b2ea(){if(!_0x40bc3e){_0x435179[_0x21c4('0x6')]('error',new AGIError(_0x21c4('0x7')));return![];}_0x8d4312=net[_0x21c4('0x8')]();_0x8d4312[_0x21c4('0x9')](_0x40bc3e,_0x1512d2);_0x8d4312['on'](_0x21c4('0xa'),function(){_0x435179[_0x21c4('0x6')](_0x21c4('0xa'));});_0x8d4312['on'](_0x21c4('0xb'),function(_0x3d147a){_0x8d4312[_0x21c4('0xc')](function(_0x50fc66,_0xa58fa5){if(_0x50fc66){_0x435179['emit'](_0x21c4('0xd'),new AGIError('E_AGI_SERVER_ERROR',_0x50fc66));}else if(_0xd7340&&_0xd7340<0x0){_0x435179[_0x21c4('0x6')](_0x21c4('0xd'),new AGIError(_0x21c4('0xe')));_0x3d147a[_0x21c4('0xf')]();}else if(_0xd7340&&_0xd7340>0x0&&_0xd7340<_0xa58fa5){_0x4fc4da+=0x1;_0x435179[_0x21c4('0x6')](_0x21c4('0xd'),new AGIError(_0x21c4('0x10'),_0x4fc4da));_0x3d147a[_0x21c4('0xf')]();}else{var _0xade6a9=new AGIChannel(_0x3d147a);_0xade6a9['on'](_0x21c4('0x11'),function(){_0x435179[_0x21c4('0x6')](_0x21c4('0xb'),_0xade6a9);});}});});_0x8d4312['on'](_0x21c4('0xd'),function(_0x5ab3a1){_0x435179['emit'](_0x21c4('0xd'),new AGIError(_0x21c4('0x12'),_0x5ab3a1[_0x21c4('0x13')]));});_0x8d4312['on'](_0x21c4('0x14'),function(){_0x435179[_0x21c4('0x6')](_0x21c4('0x14'),new AGIError(_0x21c4('0x15')));});}process[_0x21c4('0x16')](function(){_0x54b2ea();});};util[_0x21c4('0x17')](AGIServer,EventEmitter);module[_0x21c4('0x18')]=function(_0x373e83,_0x122cf3,_0x2b627a){return new AGIServer(_0x373e83,_0x122cf3,_0x2b627a);}; \ No newline at end of file +var _0x330c=['net','events','EventEmitter','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listening','getConnections','E_AGI_SERVER_ERROR','destroy','ready','connection','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util'];(function(_0x5dc45d,_0x55f90f){var _0x4ce697=function(_0x4e6e21){while(--_0x4e6e21){_0x5dc45d['push'](_0x5dc45d['shift']());}};_0x4ce697(++_0x55f90f);}(_0x330c,0x186));var _0xc330=function(_0x3c8018,_0x4f3203){_0x3c8018=_0x3c8018-0x0;var _0x1ad526=_0x330c[_0x3c8018];return _0x1ad526;};'use strict';var util=require(_0xc330('0x0'));var net=require(_0xc330('0x1'));var EventEmitter=require(_0xc330('0x2'))[_0xc330('0x3')];var AGIError=require('./error');var AGIChannel=require(_0xc330('0x4'));var AGIServer=function(_0x197a49,_0x4552ee,_0x207daa){var _0x3852b2=this,_0x197a49=_0x197a49||0x11dd,_0x4552ee=_0x4552ee||_0xc330('0x5'),_0x4f49fb=null,_0x53d0ca=0x0;EventEmitter[_0xc330('0x6')](_0x3852b2);function _0x253c40(){if(!_0x197a49){_0x3852b2[_0xc330('0x7')](_0xc330('0x8'),new AGIError(_0xc330('0x9')));return![];}_0x4f49fb=net[_0xc330('0xa')]();_0x4f49fb['listen'](_0x197a49,_0x4552ee);_0x4f49fb['on'](_0xc330('0xb'),function(){_0x3852b2[_0xc330('0x7')](_0xc330('0xb'));});_0x4f49fb['on']('connection',function(_0x381660){_0x4f49fb[_0xc330('0xc')](function(_0x172de9,_0x9a5658){if(_0x172de9){_0x3852b2[_0xc330('0x7')](_0xc330('0x8'),new AGIError(_0xc330('0xd'),_0x172de9));}else if(_0x207daa&&_0x207daa<0x0){_0x3852b2[_0xc330('0x7')](_0xc330('0x8'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x381660['destroy']();}else if(_0x207daa&&_0x207daa>0x0&&_0x207daa<_0x9a5658){_0x53d0ca+=0x1;_0x3852b2[_0xc330('0x7')](_0xc330('0x8'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x53d0ca));_0x381660[_0xc330('0xe')]();}else{var _0x27fa30=new AGIChannel(_0x381660);_0x27fa30['on'](_0xc330('0xf'),function(){_0x3852b2[_0xc330('0x7')](_0xc330('0x10'),_0x27fa30);});}});});_0x4f49fb['on'](_0xc330('0x8'),function(_0xdc5b8e){_0x3852b2[_0xc330('0x7')](_0xc330('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0xdc5b8e[_0xc330('0x11')]));});_0x4f49fb['on'](_0xc330('0x12'),function(){_0x3852b2['emit'](_0xc330('0x12'),new AGIError(_0xc330('0x13')));});}process[_0xc330('0x14')](function(){_0x253c40();});};util[_0xc330('0x15')](AGIServer,EventEmitter);module[_0xc330('0x16')]=function(_0x4d2e39,_0x3b6e46,_0x4a4b30){return new AGIServer(_0x4d2e39,_0x3b6e46,_0x4a4b30);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 7485532..79e53b4 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 _0xe07d=['pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','digits','escape_digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','getMailAccount','account_id','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','Smtp','bcc','subject','service','host','port','secure','authentication','auth','user','pass','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','answer','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','util','lodash','odbc','randomstring','moment','mustache','../../config/logger','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','then','name','catch','prototype','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareOdbcById','dsn','getUserById','getTrunk','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','Intervals','interval','format','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','label','agicommand','arg_1','callerid','createSquareRecording','uniqueid','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','headers','stringify','statusCode','statusMessage','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_access_key_id','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','replaceObjectAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','isArray','isString','replaceAllVariables','saveRestApiResult','%s.%s','length','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','retry','maxRetry','agi','Enter\x20in\x20AGI\x20(%s)\x20block','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','no\x20list\x20selected','delay','minutes','noop','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','exec','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','no\x20text\x20configured','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','grammar','no\x20grammar\x20configured','RECOG_CONFIDENCE()','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','MRCPRecog','SESTEK_ASR_CONFIDENCE','RECOG_INPUT()','SESTEK_ASR_TRANSCRIPT','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','sip_id','getUser','no\x20user\x20found','DIAL','SIP/%s','opts','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','streamFile','unlink','.wav','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','getData','test','mindigit','getVariable','hiddendigitsnum','hiddendigitspos','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws\x20Polly\x20%s\x20file\x20created','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','bot','Trying\x20Amazon\x20Lex:\x20%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','%s/recordings/%s','beep','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','wav','recordFile','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','continueAt','context','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','NOBEEP','ispeech\x20%s\x20file\x20created','ispeechtts','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','Enter\x20in\x20LOGOUT\x20(%s)\x20block','failure','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','response','digit','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','no\x20find\x20by\x20configured'];(function(_0x4dd1b3,_0x2a748b){var _0x533717=function(_0x19625a){while(--_0x19625a){_0x4dd1b3['push'](_0x4dd1b3['shift']());}};_0x533717(++_0x2a748b);}(_0xe07d,0x6c));var _0xde07=function(_0x466247,_0x5d69e3){_0x466247=_0x466247-0x0;var _0x4b352e=_0xe07d[_0x466247];return _0x4b352e;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0xde07('0x0'));var _=require(_0xde07('0x1'));var sh=require('shelljs');var odbc=require(_0xde07('0x2'))();var rs=require(_0xde07('0x3'));var moment=require(_0xde07('0x4'));var Mustache=require(_0xde07('0x5'));var rp=require('request-promise');var logger=require(_0xde07('0x6'))('agi');var config=require('../../config/environment');var scripts=require(_0xde07('0x7'));var FILES_PATH=_0xde07('0x8');var recursiveMapAttributes=[_0xde07('0x9'),_0xde07('0xa')];var verticesWithRetry=[_0xde07('0xb'),_0xde07('0xc'),_0xde07('0xd')];var AGIVertices=function(_0x5b7d76,_0x1f8aad,_0x419129){this[_0xde07('0xe')]=_0x5b7d76;this[_0xde07('0xf')]=_0x1f8aad;this[_0xde07('0x10')]=_0x419129;};AGIVertices['prototype']['getVariable']=function(_0x13434b,_0x1999a1){this['rpc']['getVariableById'](_0x13434b)[_0xde07('0x11')](function(_0x4ba978){_0x1999a1(null,_0x4ba978?_0x4ba978[_0xde07('0x12')]:![]);})[_0xde07('0x13')](function(_0x12e050){_0x1999a1(_0x12e050);});};AGIVertices[_0xde07('0x14')][_0xde07('0x15')]=function(_0x2284fb,_0x5998f3){this['rpc'][_0xde07('0x16')](_0x2284fb)[_0xde07('0x11')](function(_0x25c65a){_0x5998f3(null,_0x25c65a?_0x25c65a[_0xde07('0x12')]:![]);})[_0xde07('0x13')](function(_0x26f05c){_0x5998f3(_0x26f05c);});};AGIVertices[_0xde07('0x14')][_0xde07('0x17')]=function(_0x3a5f08,_0x5dc37e){this[_0xde07('0xf')]['getSquareProjectById'](_0x3a5f08)['then'](function(_0x573b25){_0x5dc37e(null,_0x573b25?_0x573b25[_0xde07('0x12')]:![]);})[_0xde07('0x13')](function(_0x14ff36){_0x5dc37e(_0x14ff36);});};AGIVertices[_0xde07('0x14')]['getSquareOdbc']=function(_0x5d00bb,_0x3221b3){this[_0xde07('0xf')][_0xde07('0x18')](_0x5d00bb)[_0xde07('0x11')](function(_0x16ee9f){_0x3221b3(null,_0x16ee9f?_0x16ee9f[_0xde07('0x19')]:![]);})[_0xde07('0x13')](function(_0x9480a3){_0x3221b3(_0x9480a3);});};AGIVertices['prototype']['getUser']=function(_0x3f3b10,_0x16280a){this['rpc'][_0xde07('0x1a')](_0x3f3b10)[_0xde07('0x11')](function(_0x529ec2){_0x16280a(null,_0x529ec2?_0x529ec2[_0xde07('0x12')]:![]);})['catch'](function(_0x5b17dd){_0x16280a(_0x5b17dd);});};AGIVertices[_0xde07('0x14')][_0xde07('0x1b')]=function(_0x429070,_0x609bcb){this[_0xde07('0xf')][_0xde07('0x1c')](_0x429070)['then'](function(_0x3a20e2){_0x609bcb(null,_0x3a20e2?_0x3a20e2[_0xde07('0x12')]:![]);})[_0xde07('0x13')](function(_0x18becf){_0x609bcb(_0x18becf);});};AGIVertices[_0xde07('0x14')]['getSound']=function(_0xf0f608,_0x521000){var _0x2f4848=this;this[_0xde07('0xf')][_0xde07('0x1d')](_0xf0f608)[_0xde07('0x11')](function(_0x2ccddf){_0x521000(null,_0x2ccddf?_0x2f4848[_0xde07('0x1e')](_0x2ccddf[_0xde07('0x1f')]):![]);})[_0xde07('0x13')](function(_0x43fa24){_0x521000(_0x43fa24);});};AGIVertices['prototype']['getMailAccount']=function(_0x8a32f0,_0x59a875){this[_0xde07('0xf')][_0xde07('0x20')](_0x8a32f0)[_0xde07('0x11')](function(_0x2fd415){_0x59a875(null,_0x2fd415?_0x2fd415:![]);})[_0xde07('0x13')](function(_0x11f180){_0x59a875(_0x11f180);});};AGIVertices[_0xde07('0x14')][_0xde07('0x21')]=function(_0x1316b5,_0x3762b4,_0x3ff3be){this[_0xde07('0x10')][_0xde07('0x21')](_0x1316b5,_0x3762b4)['then'](function(){_0x3ff3be(null);})[_0xde07('0x13')](function(_0x147362){_0x3ff3be(_0x147362);});};AGIVertices[_0xde07('0x14')][_0xde07('0x22')]=function(_0x5a41c7,_0x5dc6f6){this[_0xde07('0xf')][_0xde07('0x23')](_0x5a41c7)[_0xde07('0x11')](function(_0x2de24f){if(_0x2de24f){if(_0x2de24f[_0xde07('0x24')]){_0x5dc6f6(null,[_0x2de24f['interval']]);}else{_0x5dc6f6(null,_['map'](_0x2de24f[_0xde07('0x25')],_0xde07('0x26')));}}else{_0x5dc6f6(null,![]);}})[_0xde07('0x13')](function(_0x1959d3){_0x5dc6f6(_0x1959d3);});};AGIVertices[_0xde07('0x14')][_0xde07('0x1e')]=function(_0x2ec90b){return util[_0xde07('0x27')]('%s/sounds/converted/%s',FILES_PATH,_0x2ec90b);};AGIVertices[_0xde07('0x14')][_0xde07('0x28')]=function(_0x2f2bec,_0x11e9b,_0x467961){odbc[_0xde07('0x29')](_0x2f2bec,function(_0x24ecde){if(_0x24ecde){logger[_0xde07('0x2a')](_0xde07('0x2b'),_0x24ecde);_0x467961(_0x24ecde);}else{logger[_0xde07('0x2c')](_0xde07('0x2d'));odbc['query'](_0x11e9b,function(_0x401f7d,_0x543e96){if(_0x401f7d){logger[_0xde07('0x2c')](_0xde07('0x2e'),_0x11e9b);_0x467961(_0x401f7d);}else{logger[_0xde07('0x2c')](_0xde07('0x2f'),_0x11e9b);odbc[_0xde07('0x30')](function(_0x2e8745){if(_0x2e8745){logger[_0xde07('0x2a')](_0xde07('0x31'),_0x2e8745);}_0x467961(null,_0x543e96);});}});}});};AGIVertices['prototype'][_0xde07('0x32')]=function(_0x2f9a3a,_0x3f5203){this[_0xde07('0xf')][_0xde07('0x33')](_0x2f9a3a)[_0xde07('0x11')](function(_0x32bdac){_0x3f5203(null,_0x32bdac?_0x32bdac:![]);})['catch'](function(_0x4a83b8){_0x3f5203(_0x4a83b8);});};AGIVertices[_0xde07('0x14')][_0xde07('0x34')]=function(_0x5b00fb,_0x2b163d){this['rpc'][_0xde07('0x34')](_0x5b00fb)[_0xde07('0x11')](function(_0x4775e2){_0x2b163d(null,_0x4775e2);})['catch'](function(_0xdae90){_0x2b163d(_0xdae90);});};AGIVertices[_0xde07('0x14')][_0xde07('0x35')]=function(_0x40b97d,_0x1b1ccc,_0x542608){this[_0xde07('0xf')][_0xde07('0x35')]({'uniqueid':this['channel']['uniqueid'],'node':_0x40b97d[_0xde07('0x36')],'application':_0x40b97d[_0xde07('0x37')],'data':_0x1b1ccc||null,'project_name':this['channel'][_0xde07('0x38')],'callerid':this[_0xde07('0xe')][_0xde07('0x39')]})['then'](function(_0x4fdcb2){if(_0x542608){_0x542608(null,_0x4fdcb2);}})['catch'](function(_0x32fd83){if(_0x542608){_0x542608(_0x32fd83);}});};AGIVertices[_0xde07('0x14')][_0xde07('0x3a')]=function(_0x532817,_0x5e878b,_0x1104bf,_0x200bc7){this[_0xde07('0xf')][_0xde07('0x3a')]({'uniqueid':this[_0xde07('0xe')][_0xde07('0x3b')],'callerid':this[_0xde07('0xe')][_0xde07('0x39')],'calleridname':this[_0xde07('0xe')]['calleridname'],'context':this[_0xde07('0xe')]['context'],'extension':this[_0xde07('0xe')][_0xde07('0x3c')],'priority':this[_0xde07('0xe')][_0xde07('0x3d')],'accountcode':this[_0xde07('0xe')][_0xde07('0x3e')],'dnid':this[_0xde07('0xe')][_0xde07('0x3f')],'projectName':this[_0xde07('0xe')]['arg_1'],'saveName':_0x5e878b,'filename':_0x532817[_0xde07('0x40')]||_0x5e878b,'savePath':_0x1104bf})[_0xde07('0x11')](function(_0x435517){_0x200bc7(null,_0x435517);})[_0xde07('0x13')](function(_0x50ee0e){_0x200bc7(_0x50ee0e);});};AGIVertices['prototype'][_0xde07('0x41')]=function(_0xf55011,_0x129072,_0x38e418){this[_0xde07('0xf')][_0xde07('0x41')]({'uniqueid':this['channel'][_0xde07('0x3b')],'body':_0xf55011,'direction':_0x129072})[_0xde07('0x11')](function(_0x2f8dc4){if(_0x38e418){_0x38e418(null,_0x2f8dc4);}})[_0xde07('0x13')](function(_0x3639ad){if(_0x38e418){_0x38e418(_0x3639ad);}});};AGIVertices[_0xde07('0x14')][_0xde07('0x42')]=function(_0x247a8b,_0x5d2c77){this[_0xde07('0xf')][_0xde07('0x42')]({'firstName':_[_0xde07('0x43')](_0x247a8b['name'])||_[_0xde07('0x44')](_0x247a8b[_0xde07('0x12')])?_0xde07('0x45')+Math['random']():_0x247a8b[_0xde07('0x12')],'lastName':_[_0xde07('0x43')](_0x247a8b[_0xde07('0x46')])||_[_0xde07('0x44')](_0x247a8b[_0xde07('0x46')])?null:_0x247a8b[_0xde07('0x46')],'phone':_0x247a8b[_0xde07('0x47')],'ListId':_0x247a8b[_0xde07('0x48')],'scheduledat':_0x247a8b[_0xde07('0x49')],'callbackUniqueid':this[_0xde07('0xe')][_0xde07('0x3b')],'tags':_0xde07('0x4a'),'description':_0xde07('0x4b')+_0x247a8b['scheduledAt']['toString'](),'priority':_0x247a8b['callback_priority']})[_0xde07('0x11')](function(_0x5c1e7a){_0x5d2c77(null,_0x5c1e7a);})['catch'](function(_0x56c8b3){_0x5d2c77(_0x56c8b3);});};AGIVertices[_0xde07('0x14')][_0xde07('0x4c')]=function(_0x12864a,_0x3b32dd){this[_0xde07('0xf')][_0xde07('0x4d')](_0x12864a)[_0xde07('0x11')](function(_0x18efa6){_0x3b32dd(null,_0x18efa6?_0x18efa6[_0xde07('0x12')]:![]);})[_0xde07('0x13')](function(_0x3545ea){_0x3b32dd(_0x3545ea);});};AGIVertices[_0xde07('0x14')][_0xde07('0x4e')]=function(_0x3116b4,_0x550bb8,_0x287024){var _0x2c3973={'role':_0xde07('0x4f')};_0x2c3973[_0x3116b4]=this[_0xde07('0xe')][_0xde07('0x39')];this[_0xde07('0xf')][_0xde07('0x4e')](_0x2c3973,_0x550bb8,this[_0xde07('0xe')]['uniqueid'])[_0xde07('0x11')](function(_0x5bba5e){_0x287024(null,_[_0xde07('0x44')](_0x5bba5e)?![]:!![]);})[_0xde07('0x13')](function(_0x47e4d0){logger[_0xde07('0x2a')](_0x47e4d0);_0x287024(null,![]);});};AGIVertices[_0xde07('0x14')][_0xde07('0x50')]=function(_0x2e1581,_0x2ce6d2){var _0x320a4c={'role':_0xde07('0x4f')};_0x320a4c[_0x2e1581]=this['channel'][_0xde07('0x39')];this[_0xde07('0xf')][_0xde07('0x50')](_0x320a4c)[_0xde07('0x11')](function(_0x48e255){_0x2ce6d2(null,_['isNil'](_0x48e255)?![]:!![]);})[_0xde07('0x13')](function(_0x2d676a){logger['error'](_0x2d676a);_0x2ce6d2(null,![]);});};AGIVertices['prototype'][_0xde07('0x51')]=function(_0x4ea0f7,_0x18cce4){var _0x3b8fce={'role':'agent'};_0x3b8fce[_0x4ea0f7]=this[_0xde07('0xe')][_0xde07('0x39')];this['rpc'][_0xde07('0x51')](_0x3b8fce)[_0xde07('0x11')](function(_0x59dc04){_0x18cce4(null,_[_0xde07('0x44')](_0x59dc04)?![]:!![]);})[_0xde07('0x13')](function(_0x58daa7){logger[_0xde07('0x2a')](_0x58daa7);_0x18cce4(null,![]);});};AGIVertices[_0xde07('0x14')][_0xde07('0x52')]=function(_0xf19348,_0x37af6c){var _0x2ea055={'role':_0xde07('0x4f')};_0x2ea055[_0xf19348]=this[_0xde07('0xe')][_0xde07('0x39')];var _0x3a7371=_0xf19348!=_0xde07('0x53')?util['format'](_0xde07('0x54'),_0xde07('0x55'),this[_0xde07('0xe')][_0xde07('0x39')]):undefined;this[_0xde07('0xf')]['agentLogin'](_0x2ea055,_0x3a7371)[_0xde07('0x11')](function(_0x37da5a){_0x37af6c(null,_[_0xde07('0x44')](_0x37da5a)?![]:!![]);})[_0xde07('0x13')](function(_0xc9e423){logger[_0xde07('0x2a')](_0xc9e423);_0x37af6c(null,![]);});};AGIVertices[_0xde07('0x14')][_0xde07('0x56')]=function(_0x39c229,_0x156ebe){sh['exec'](_[_0xde07('0x57')](_0x39c229),function(_0xc92969,_0x1b906a){var _0x2d1dfc=_0x1b906a[_0xde07('0x58')](/(\r\n|\n|\r)/gm,'');_0x156ebe(null,_0x2d1dfc);});};AGIVertices[_0xde07('0x14')][_0xde07('0x59')]=function(_0x1c01b8,_0x530397){scripts[_0xde07('0x59')](_0x1c01b8[_0xde07('0x5a')],_0x1c01b8[_0xde07('0x5b')]||_0xde07('0x5c'),_0x1c01b8[_0xde07('0x5c')],_0x1c01b8[_0xde07('0x5d')]||_0xde07('0x5e'),_0x1c01b8[_0xde07('0x5f')]||_0xde07('0x60'),_0x1c01b8[_0xde07('0x61')]||_0xde07('0x62'))['then'](function(_0x5266dd){_0x530397(null,_0x5266dd);})[_0xde07('0x13')](function(_0x25709a){_0x530397(_0x25709a);});};AGIVertices['prototype'][_0xde07('0x63')]=function(_0x4642a6,_0x3cb26b){scripts['googleTTS'](_0x4642a6['text'],_0x4642a6['google_tts_language']||'en',0x1)['then'](function(_0x8456b4){_0x3cb26b(null,_0x8456b4);})[_0xde07('0x13')](function(_0x27febf){_0x3cb26b(_0x27febf);});};AGIVertices['prototype'][_0xde07('0x64')]=function(_0x468c3b,_0x33e5d5){var _0x226c9a={'uri':_0x468c3b[_0xde07('0x65')],'method':_0x468c3b[_0xde07('0x66')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x468c3b[_0xde07('0x67')])===_0xde07('0x68')&&parseInt(_0x468c3b[_0xde07('0x67')])>=0x1?parseInt(_0x468c3b[_0xde07('0x67')])*0x3e8:0x5*0x3e8};if(_[_0xde07('0x69')]([_0xde07('0x6a'),_0xde07('0x6b')],_0x226c9a[_0xde07('0x66')][_0xde07('0x6c')]())){try{_0x226c9a[_0xde07('0x6d')]=_0x468c3b[_0xde07('0xa')]?JSON[_0xde07('0x6e')](_0x468c3b['rawBody']):{};}catch(_0x36400f){logger[_0xde07('0x2a')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x36400f);}}try{_0x226c9a['headers']=_0x468c3b['rawHeaders']?JSON[_0xde07('0x6e')](_0x468c3b[_0xde07('0x9')]):{};}catch(_0x198743){logger[_0xde07('0x2a')](_0xde07('0x6f'),_0x198743);}if(_0x468c3b[_0xde07('0x70')]){try{var _0x8ea4d5=require(_0x468c3b[_0xde07('0x70')])[_0xde07('0x71')](this,_0x226c9a);_0x226c9a[_0xde07('0x72')]=Mustache[_0xde07('0x73')](_0x468c3b[_0xde07('0x65')],_0x8ea4d5,{},['$$','$$']);if(_0x226c9a[_0xde07('0x74')]){_0x226c9a[_0xde07('0x74')]=JSON['parse'](Mustache[_0xde07('0x73')](JSON[_0xde07('0x75')](_0x226c9a[_0xde07('0x74')]),_0x8ea4d5,{},['$$','$$']));}if(_0x226c9a['body']){_0x226c9a[_0xde07('0x6d')]=JSON[_0xde07('0x6e')](Mustache[_0xde07('0x73')](JSON[_0xde07('0x75')](_0x226c9a[_0xde07('0x6d')]),_0x8ea4d5,{},['$$','$$']));}}catch(_0x44177e){logger[_0xde07('0x2a')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x44177e);}}rp(_0x226c9a)[_0xde07('0x11')](function(_0x35acff){var _0xf20551={'statusCode':_0x35acff[_0xde07('0x76')]||0xc8,'statusMessage':_0x35acff[_0xde07('0x77')]||'OK','headers':_0x35acff['headers']||{},'body':_0x35acff[_0xde07('0x6d')]||{}};_0x33e5d5(null,_0xf20551);})[_0xde07('0x13')](function(_0x1ae9d9){var _0x172255={'statusCode':_0x1ae9d9[_0xde07('0x76')]||0x1f4,'statusMessage':_0x1ae9d9['message']||_0xde07('0x78'),'headers':_0x1ae9d9[_0xde07('0x79')][_0xde07('0x74')]||{},'body':_0x1ae9d9[_0xde07('0x79')]['body']||{}};_0x33e5d5(null,_0x172255);});};AGIVertices[_0xde07('0x14')][_0xde07('0x7a')]=function(_0x38576d,_0x4a568d){scripts['googleDialogflow'](this['channel'][_0xde07('0x3b')],_0x38576d[_0xde07('0x7b')],_0x38576d[_0xde07('0x5c')],_0x38576d[_0xde07('0x7c')]||'en')[_0xde07('0x11')](function(_0x4f72e6){_0x4a568d(null,_0x4f72e6);})['catch'](function(_0x2f1c91){_0x4a568d(_0x2f1c91);});};AGIVertices[_0xde07('0x14')][_0xde07('0x7d')]=function(_0xcf0619,_0xa4591d){scripts['sestekNDA'](this['channel'],_0xcf0619)[_0xde07('0x11')](function(_0x1ced6b){_0xa4591d(null,_0x1ced6b);})[_0xde07('0x13')](function(_0x11a284){_0xa4591d(_0x11a284);});};AGIVertices[_0xde07('0x14')][_0xde07('0x7e')]=function(_0x19b107,_0x43d0df){scripts[_0xde07('0x7e')](_0x19b107[_0xde07('0x7b')],_0x19b107[_0xde07('0x5c')],_0x19b107[_0xde07('0x7f')]||_0xde07('0x5e'),_0x19b107[_0xde07('0x80')])[_0xde07('0x11')](function(_0x445480){_0x43d0df(null,_0x445480);})[_0xde07('0x13')](function(_0x43237d){_0x43d0df(_0x43237d);});};AGIVertices['prototype'][_0xde07('0x81')]=function(_0x3881ce,_0x1bc11a,_0x58011e){scripts[_0xde07('0x81')](_0x1bc11a,_0x3881ce[_0xde07('0x7b')],_0x3881ce[_0xde07('0x82')]||_0xde07('0x5e'),this[_0xde07('0x83')](_0x3881ce[_0xde07('0x84')])?_0x3881ce[_0xde07('0x84')]:undefined)[_0xde07('0x11')](function(_0x16de9a){_0x58011e(null,_0x16de9a);})[_0xde07('0x13')](function(_0x1b54a0){_0x58011e(_0x1b54a0);});};AGIVertices[_0xde07('0x14')]['awsPolly']=function(_0x1bab95,_0xbc5938){scripts[_0xde07('0x85')](_0x1bab95['aws_access_key_id'],_0x1bab95[_0xde07('0x86')],_0x1bab95[_0xde07('0x87')],_0x1bab95[_0xde07('0x88')]||_0xde07('0x89'),_0x1bab95[_0xde07('0x5c')],_0x1bab95[_0xde07('0x8a')]||_0xde07('0x5c'))[_0xde07('0x11')](function(_0x26e2a7){_0xbc5938(null,_0x26e2a7);})[_0xde07('0x13')](function(_0x1a79ce){_0xbc5938(_0x1a79ce);});};AGIVertices[_0xde07('0x14')][_0xde07('0x8b')]=function(_0x2292c2,_0x230f86){scripts[_0xde07('0x8b')](this[_0xde07('0xe')][_0xde07('0x3b')],_0x2292c2[_0xde07('0x8c')],_0x2292c2[_0xde07('0x86')],_0x2292c2[_0xde07('0x8d')],_0x2292c2['text'],_0x2292c2[_0xde07('0x8e')])[_0xde07('0x11')](function(_0x528000){_0x230f86(null,_0x528000);})[_0xde07('0x13')](function(_0x4d1775){_0x230f86(_0x4d1775);});};AGIVertices[_0xde07('0x14')][_0xde07('0x8f')]=function(_0x55c178,_0x13bee9,_0x5ee85c){scripts[_0xde07('0x8f')](_0x13bee9,_0x55c178[_0xde07('0x7b')],_0x55c178[_0xde07('0x90')]||'en-US')[_0xde07('0x11')](function(_0xdeecb5){_0x5ee85c(null,_0xdeecb5);})[_0xde07('0x13')](function(_0x59aa4){_0x5ee85c(_0x59aa4);});};AGIVertices[_0xde07('0x14')]['tildeASR']=function(_0x3016c4,_0x45eaa3,_0x9faceb){scripts[_0xde07('0x91')](_0x45eaa3,_0x3016c4[_0xde07('0x92')],_0x3016c4[_0xde07('0x93')],_0x3016c4[_0xde07('0x72')])[_0xde07('0x11')](function(_0x198840){_0x9faceb(null,_0x198840);})[_0xde07('0x13')](function(_0x450a92){_0x9faceb(_0x450a92);});};AGIVertices['prototype'][_0xde07('0x94')]=function(_0xf10ca){var _0xd45809=_[_0xde07('0x69')](verticesWithRetry,_0xf10ca[_0xde07('0x37')])?_0xf10ca:_[_0xde07('0x95')](_0xf10ca);for(var _0x1049e9 in _0xd45809){if(_0xd45809['hasOwnProperty'](_0x1049e9)){if(_0xd45809[_0x1049e9]&&_['isString'](_0xd45809[_0x1049e9])){if(_[_0xde07('0x69')](recursiveMapAttributes,_0x1049e9)){_0xd45809[_0x1049e9]=this[_0xde07('0x96')](_0xd45809[_0x1049e9]);}else{_0xd45809[_0x1049e9]=this['replaceAllVariables'](_0xd45809[_0x1049e9]);}}}}return _0xd45809;};AGIVertices[_0xde07('0x14')][_0xde07('0x97')]=function(_0x2ae0ce){for(var _0x2266c7 in _0x2ae0ce){if(_0x2ae0ce[_0xde07('0x98')](_0x2266c7)){if(_[_0xde07('0x99')](_0x2ae0ce[_0x2266c7])){this[_0xde07('0x97')](_0x2ae0ce[_0x2266c7]);}else if(_[_0xde07('0x9a')](_0x2ae0ce[_0x2266c7])){for(var _0x58be62=0x0;_0x58be62<_0x2ae0ce[_0x2266c7]['length'];_0x58be62++){this[_0xde07('0x97')](_0x2ae0ce[_0x2266c7][_0x58be62]);}}else if(_[_0xde07('0x9b')](_0x2ae0ce[_0x2266c7])){_0x2ae0ce[_0x2266c7]=this[_0xde07('0x9c')](_0x2ae0ce[_0x2266c7]);}}}};AGIVertices[_0xde07('0x14')][_0xde07('0x9d')]=function(_0x234423,_0x32143d){for(var _0x4c3f46 in _0x234423){if(_0x234423[_0xde07('0x98')](_0x4c3f46)){if(_['isPlainObject'](_0x234423[_0x4c3f46])){if(!_[_0xde07('0x43')](_0x234423[_0x4c3f46])){this[_0xde07('0x9d')](_0x234423[_0x4c3f46],util[_0xde07('0x27')](_0xde07('0x9e'),_0x32143d,_0x4c3f46));}}else if(_['isArray'](_0x234423[_0x4c3f46])){for(var _0x1f8e5f=0x0;_0x1f8e5f<_0x234423[_0x4c3f46][_0xde07('0x9f')];_0x1f8e5f++){this[_0xde07('0x9d')](_0x234423[_0x4c3f46][_0x1f8e5f],util[_0xde07('0x27')]('%s.%s',_0x32143d,_0x4c3f46+'['+_0x1f8e5f+']'));}}else{if(!_['isNil'](_0x234423[_0x4c3f46])){this[_0xde07('0xe')]['setVariable'](util['format']('%s.%s',_0x32143d,_0x4c3f46),_0x234423[_0x4c3f46]);}}}}};AGIVertices['prototype'][_0xde07('0x96')]=function(_0x13c4f2){try{var _0x3256bf=JSON[_0xde07('0x6e')](_0x13c4f2);this[_0xde07('0x97')](_0x3256bf);return JSON['stringify'](_0x3256bf);}catch(_0x2cf3cc){return this[_0xde07('0x9c')](_0x13c4f2);}};AGIVertices[_0xde07('0x14')][_0xde07('0x9c')]=function(_0x42b0e7){var _0x36817e=_0x42b0e7[_0xde07('0xa0')]('{');for(var _0x3d78ce=0x1;_0x3d78ce<_0x36817e[_0xde07('0x9f')];_0x3d78ce+=0x1){var _0x90197e=_0x36817e[_0x3d78ce][_0xde07('0xa0')]('}');if(_0x90197e[_0xde07('0x9f')]>0x1){_0x42b0e7=_0x42b0e7[_0xde07('0xa1')]('{'+_0x90197e[0x0]+'}',this[_0xde07('0xe')]['getVariable'](_0x90197e[0x0])[_0xde07('0xa2')]||_0x90197e[0x0]);}}if(_0x36817e[_0xde07('0x9f')]===0x1){return _0x42b0e7['toString']();}return this[_0xde07('0x9c')](_0x42b0e7);};AGIVertices['prototype'][_0xde07('0xa3')]=function(_0x31dd00,_0x1b15ea){var _0x7e28dc=this[_0xde07('0xe')]['getVariable'](_0x31dd00);if(_0x7e28dc[_0xde07('0xa4')]===-0x1){return _0x7e28dc;}logger[_0xde07('0x2c')](util['format'](_0xde07('0xa5'),_0x1b15ea,_0x7e28dc[_0xde07('0xa2')]));return this['channel'][_0xde07('0xa6')](_0x1b15ea,_0x7e28dc['extra']);};AGIVertices[_0xde07('0x14')][_0xde07('0x83')]=function(_0x5b2d78){return _0x5b2d78&&_0x5b2d78!=='0'&&_0x5b2d78!=='-1'&&_0x5b2d78!=='';};AGIVertices[_0xde07('0x14')]['maxRetry']=function(_0x3f32dc){this[_0xde07('0x35')]['sync'](this,_0x3f32dc,'-');_0x3f32dc[_0xde07('0xa7')]=_0x3f32dc[_0xde07('0xa8')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0xde07('0xa9')]=function(_0x17ba1b){logger['info'](util[_0xde07('0x27')](_0xde07('0xaa'),_0x17ba1b[_0xde07('0x36')]));return this['channel'][_0xde07('0xa9')]([_0x17ba1b['command'],_0x17ba1b['args']]);};AGIVertices[_0xde07('0x14')]['answer']=function(_0x395051){logger['info'](util[_0xde07('0x27')](_0xde07('0xab'),_0x395051['label']));if(this[_0xde07('0x83')](_0x395051[_0xde07('0x67')])){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0xac'),_0x395051[_0xde07('0x67')]));var _0xab21f=this['channel'][_0xde07('0xad')](_0x395051['timeout']);if(_0xab21f['result']===-0x1){return _0xab21f;}}return this[_0xde07('0xe')]['answer']();};AGIVertices[_0xde07('0x14')][_0xde07('0x4a')]=function(_0x5f101c){logger[_0xde07('0x2c')](util[_0xde07('0x27')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x5f101c[_0xde07('0x36')]));if(!this[_0xde07('0x83')](_0x5f101c['list_id'])){return this[_0xde07('0xe')]['error'](_0x5f101c,_0xde07('0xae'));}_0x5f101c[_0xde07('0x49')]=moment();if(this[_0xde07('0x83')](_0x5f101c[_0xde07('0xaf')])){_0x5f101c[_0xde07('0x49')]=moment()['add'](_0x5f101c['delay'],_0xde07('0xb0'));}if(!this[_0xde07('0x83')](_0x5f101c['callback_priority'])){_0x5f101c['callback_priority']=0x2;}this[_0xde07('0x42')][_0xde07('0x71')](this,_0x5f101c);return this['channel'][_0xde07('0xb1')](util[_0xde07('0x27')](_0xde07('0xb2'),_0x5f101c[_0xde07('0x47')],_0x5f101c[_0xde07('0x48')],_0x5f101c['scheduledAt']));};AGIVertices[_0xde07('0x14')][_0xde07('0xb3')]=function(_0x340fb1){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0xb4'),_0x340fb1[_0xde07('0x36')]));var _0x53190b=this[_0xde07('0xe')][_0xde07('0xb5')](_0x340fb1[_0xde07('0xb6')],_0x340fb1[_0xde07('0x79')]);if(_0x53190b[_0xde07('0xa4')]===-0x1){return _0x53190b;}return this[_0xde07('0xe')][_0xde07('0xb1')](util[_0xde07('0x27')](_0xde07('0xb7'),_0x340fb1[_0xde07('0xb6')],_0x340fb1[_0xde07('0x79')]));};AGIVertices[_0xde07('0x14')][_0xde07('0xb8')]=function(_0x334360){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0xb9'),_0x334360['label']));if(!this[_0xde07('0x83')](_0x334360[_0xde07('0x5c')])){return this['channel'][_0xde07('0xb1')]('no\x20text\x20configured');}var _0x1632ed='\x22'+_0x334360[_0xde07('0x5c')]+'\x22';if(this[_0xde07('0x83')](_0x334360[_0xde07('0x79')])){_0x1632ed+=','+_0x334360[_0xde07('0x79')];}var _0x4f350d=this[_0xde07('0xe')]['exec'](_0xde07('0xba'),_0x1632ed);if(_0x4f350d[_0xde07('0xa4')]===-0x1){return _0x4f350d;}return this[_0xde07('0xe')][_0xde07('0xb1')](util['format'](_0xde07('0xbb'),_0x1632ed));};AGIVertices[_0xde07('0x14')][_0xde07('0xbc')]=function(_0x1da968){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0xbd'),_0x1da968['label']));if(!this[_0xde07('0x83')](_0x1da968[_0xde07('0x5c')])){return this[_0xde07('0xe')][_0xde07('0xb1')](_0xde07('0xbe'));}var _0x291ccf='\x22'+_0x1da968[_0xde07('0x5c')]+'\x22';if(this[_0xde07('0x83')](_0x1da968[_0xde07('0x79')])){_0x291ccf+=','+_0x1da968[_0xde07('0x79')];}var _0x5c594b=this[_0xde07('0xe')][_0xde07('0xb5')](_0xde07('0xba'),_0x291ccf);if(_0x5c594b['result']===-0x1){return _0x5c594b;}return this[_0xde07('0xe')][_0xde07('0xb1')](util[_0xde07('0x27')](_0xde07('0xbb'),_0x291ccf));};AGIVertices[_0xde07('0x14')][_0xde07('0xbf')]=function(_0x4aa123){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0xc0'),_0x4aa123[_0xde07('0x36')]));if(!this['isConfigured'](_0x4aa123[_0xde07('0xc1')])){return this['channel'][_0xde07('0xb1')](_0xde07('0xc2'));}var _0x2cec41=_0x4aa123[_0xde07('0xc1')];if(this[_0xde07('0x83')](_0x4aa123[_0xde07('0x79')])){_0x2cec41+=','+_0x4aa123[_0xde07('0x79')];}var _0x38ab46=this[_0xde07('0xe')][_0xde07('0xb5')]('MRCPRecog',_0x2cec41);if(_0x38ab46['result']===-0x1){return _0x38ab46;}var _0x484663=this[_0xde07('0xa3')](_0xde07('0xc3'),'LUMENVOX_ASR_CONFIDENCE');if(_0x484663['result']===-0x1){return _0x484663;}var _0x473b35=this[_0xde07('0xa3')]('RECOG_INPUT()',_0xde07('0xc4'));if(_0x473b35['result']===-0x1){return _0x473b35;}var _0x3aa221=this[_0xde07('0xa3')](_0xde07('0xc5'),'LUMENVOX_ASR_INSTANCE');if(_0x3aa221[_0xde07('0xa4')]===-0x1){return _0x3aa221;}return this[_0xde07('0xe')]['noop'](util[_0xde07('0x27')](_0xde07('0xc6'),_0x2cec41));};AGIVertices[_0xde07('0x14')][_0xde07('0xc7')]=function(_0x2cfe57){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0xc8'),_0x2cfe57[_0xde07('0x36')]));if(!this[_0xde07('0x83')](_0x2cfe57[_0xde07('0xc1')])){return this[_0xde07('0xe')]['noop'](_0xde07('0xc2'));}var _0x3d1a02=_0x2cfe57[_0xde07('0xc1')];if(this[_0xde07('0x83')](_0x2cfe57[_0xde07('0x79')])){_0x3d1a02+=','+_0x2cfe57['options'];}var _0xa6c106=this[_0xde07('0xe')]['exec'](_0xde07('0xc9'),_0x3d1a02);if(_0xa6c106[_0xde07('0xa4')]===-0x1){return _0xa6c106;}var _0x1fb684=this[_0xde07('0xa3')](_0xde07('0xc3'),_0xde07('0xca'));if(_0x1fb684['result']===-0x1){return _0x1fb684;}var _0x1db3a3=this[_0xde07('0xa3')](_0xde07('0xcb'),_0xde07('0xcc'));if(_0x1db3a3[_0xde07('0xa4')]===-0x1){return _0x1db3a3;}var _0xb98f65=this[_0xde07('0xa3')](_0xde07('0xc5'),'SESTEK_ASR_INSTANCE');if(_0xb98f65['result']===-0x1){return _0xb98f65;}return this['channel'][_0xde07('0xb1')](util['format'](_0xde07('0xc6'),_0x3d1a02));};AGIVertices['prototype'][_0xde07('0xcd')]=function(_0x52ca65){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0xce'),_0x52ca65['label']));if(!this['isConfigured'](_0x52ca65[_0xde07('0xcf')])){return this[_0xde07('0xe')][_0xde07('0x2a')](_0x52ca65,_0xde07('0xd0'));}var _0x2a115f=this['getSquareOdbc'][_0xde07('0x71')](this,_0x52ca65[_0xde07('0xcf')]);if(!_0x2a115f){return this['channel'][_0xde07('0x2a')](_0x52ca65,_0xde07('0xd1'));}if(!this[_0xde07('0x83')](_0x52ca65[_0xde07('0xd2')])){return this['channel']['error'](_0x52ca65,_0xde07('0xd3'));}var _0x1b893d=_0x52ca65[_0xde07('0xd2')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this['channel']['noop'](util[_0xde07('0x27')](_0xde07('0xd4'),_0x1b893d));var _0x43ce2f=this[_0xde07('0x28')]['sync'](this,_0x2a115f,_0x1b893d);this[_0xde07('0x35')][_0xde07('0x71')](this,_0x52ca65,_0x1b893d);if(!this[_0xde07('0x83')](_0x52ca65['variable_id'])){return this[_0xde07('0xe')][_0xde07('0xb1')](_0xde07('0xd5'));}var _0x494bd7=this['getVariable']['sync'](this,_0x52ca65[_0xde07('0xd6')]);if(!_0x494bd7){return this[_0xde07('0xe')]['error'](_0x52ca65,_0xde07('0xd7'));}var _0x7c3c90=this;_0x43ce2f['forEach'](function(_0x13c7ab,_0x14bd1b){Object['keys'](_0x13c7ab)[_0xde07('0xd8')](function(_0x449962){_0x7c3c90[_0xde07('0xe')][_0xde07('0xa6')](util['format'](_0xde07('0xd9'),_0x494bd7,_0x14bd1b,_0x449962),_0x13c7ab[_0x449962]);});});this[_0xde07('0xe')]['setVariable'](util[_0xde07('0x27')](_0xde07('0xda'),_0x494bd7),_0x43ce2f[_0xde07('0x9f')]);return this['channel'][_0xde07('0xb1')](util[_0xde07('0x27')]('variable\x20%s\x20set',_0x494bd7));};AGIVertices[_0xde07('0x14')]['dial']=function(_0xa96ae6){logger['debug'](util[_0xde07('0x27')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0xa96ae6['label']));if(!this[_0xde07('0x83')](_0xa96ae6[_0xde07('0xdb')])){return this[_0xde07('0xe')][_0xde07('0x2a')](_0xa96ae6,'no\x20user\x20selected');}var _0x223c1b=this[_0xde07('0xdc')][_0xde07('0x71')](this,_0xa96ae6[_0xde07('0xdb')]);if(!_0x223c1b){return this[_0xde07('0xe')][_0xde07('0x2a')](_0xa96ae6,_0xde07('0xdd'));}var _0x26ca8f=this['channel'][_0xde07('0xb5')](_0xde07('0xde'),[util[_0xde07('0x27')](_0xde07('0xdf'),_0x223c1b),_0xa96ae6['timeout'],_0xa96ae6[_0xde07('0xe0')],_0xa96ae6[_0xde07('0x65')]]);if(_0x26ca8f['result']===-0x1){return _0x26ca8f;}return this[_0xde07('0xe')]['noop'](util[_0xde07('0x27')]('Executed\x20command\x20%s','DIAL'));};AGIVertices['prototype']['dialogflow']=function(_0xe6ff57){logger[_0xde07('0x2c')](util['format']('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0xe6ff57[_0xde07('0x36')]));if(!this['isConfigured'](_0xe6ff57['key'])){return this['channel'][_0xde07('0xb1')](_0xde07('0xe1'));}if(!this[_0xde07('0x83')](_0xe6ff57[_0xde07('0x5c')])){return this[_0xde07('0xe')]['noop'](_0xde07('0xbe'));}this[_0xde07('0xe')]['bot']=!![];this[_0xde07('0x35')](_0xe6ff57);this['createSquareMessage'](_0xe6ff57[_0xde07('0x5c')],'in');this[_0xde07('0xe')]['noop'](util[_0xde07('0x27')](_0xde07('0xe2'),_0xe6ff57[_0xde07('0x5c')]));var _0x1d3c5d=this['googleDialogflow'][_0xde07('0x71')](this,_0xe6ff57);if(_0x1d3c5d){for(var _0x5ee681 in _0x1d3c5d){if(_0x1d3c5d[_0xde07('0x98')](_0x5ee681)){this[_0xde07('0xe')][_0xde07('0xa6')](util[_0xde07('0x27')]('DIALOGFLOW_%s',_0x5ee681['toUpperCase']()),_0x1d3c5d[_0x5ee681]);}}this[_0xde07('0x41')](_0x1d3c5d[_0xde07('0xe3')],_0xde07('0xe4'));return this['channel'][_0xde07('0xb1')](util['format'](_0xde07('0xe5'),_0x1d3c5d[_0xde07('0xe3')]));}return this[_0xde07('0xe')][_0xde07('0x2a')](_0xe6ff57,_0xde07('0xe6'));};AGIVertices['prototype'][_0xde07('0xe7')]=function(_0x5a5740){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0xe8'),_0x5a5740[_0xde07('0x36')]));if(!this['isConfigured'](_0x5a5740[_0xde07('0xe9')])){return this['channel'][_0xde07('0xb1')](_0xde07('0xea'));}if(!this['isConfigured'](_0x5a5740[_0xde07('0xeb')])){return this[_0xde07('0xe')]['noop'](_0xde07('0xec'));}if(!this[_0xde07('0x83')](_0x5a5740['password'])){return this[_0xde07('0xe')][_0xde07('0xb1')](_0xde07('0xed'));}if(!this['isConfigured'](_0x5a5740[_0xde07('0xee')])){return this[_0xde07('0xe')][_0xde07('0xb1')](_0xde07('0xbe'));}this[_0xde07('0xe')]['bot']=!![];this['createSquareDetailsReport'](_0x5a5740);this[_0xde07('0x41')](_0x5a5740[_0xde07('0x5c')],'in');this[_0xde07('0xe')][_0xde07('0xb1')](util[_0xde07('0x27')](_0xde07('0xef'),_0x5a5740[_0xde07('0x5c')]));var _0x5d76e6=this['sestekNDA'][_0xde07('0x71')](this,_0x5a5740);if(_0x5d76e6){for(var _0x1aa65c in _0x5d76e6){if(_0x5d76e6['hasOwnProperty'](_0x1aa65c)){this[_0xde07('0xe')][_0xde07('0xa6')](util['format'](_0xde07('0xf0'),_0x1aa65c['toUpperCase']()),_0x5d76e6[_0x1aa65c]);}}this['createSquareMessage'](_0x5d76e6[_0xde07('0xe3')],_0xde07('0xe4'));if(_0x5d76e6[_0xde07('0xf1')]){this[_0xde07('0xe')][_0xde07('0xb1')](util[_0xde07('0x27')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x5d76e6[_0xde07('0xf1')]));var _0x1eb492=this['channel'][_0xde07('0xf2')](_0x5d76e6[_0xde07('0xf1')]);try{fs[_0xde07('0xf3')](_0x5d76e6[_0xde07('0xf1')]+_0xde07('0xf4'));}catch(_0xeb6f4e){logger[_0xde07('0x2a')](_0xeb6f4e);}return _0x1eb492;}else{return this['channel'][_0xde07('0xb1')](util[_0xde07('0x27')]('SestekNDA\x20Result\x20%s',_0x5d76e6[_0xde07('0xe3')]));}}return this[_0xde07('0xe')][_0xde07('0x2a')](_0x5a5740,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xde07('0x14')][_0xde07('0xf5')]=function(_0x18ed43){logger[_0xde07('0x2c')](util['format'](_0xde07('0xf6'),_0x18ed43[_0xde07('0x36')]));return this['channel'][_0xde07('0xb1')](_0xde07('0xf5'));};AGIVertices[_0xde07('0x14')][_0xde07('0xf7')]=function(_0x2534b1){logger['info'](util['format'](_0xde07('0xf8'),_0x2534b1['label']));var _0x301b93='';if(_0x2534b1[_0xde07('0xf9')]){if(!this[_0xde07('0x83')](_0x2534b1[_0xde07('0xf9')])){return this[_0xde07('0xe')][_0xde07('0x2a')](_0x2534b1,'no\x20trunk\x20selected');}else{var _0x685996=parseInt(_0x2534b1['trunk_id'],0xa);if(isNaN(_0x685996)){_0x301b93=_0x2534b1[_0xde07('0xf9')];}else{_0x301b93=this[_0xde07('0x1b')][_0xde07('0x71')](this,_0x2534b1[_0xde07('0xf9')]);if(!_0x301b93){return this[_0xde07('0xe')]['error'](_0x2534b1,_0xde07('0xfa'));}}}}else if(_0x2534b1[_0xde07('0xfb')]){_0x301b93=_0x2534b1[_0xde07('0xfb')];}else{return this[_0xde07('0xe')][_0xde07('0x2a')](_0x2534b1,_0xde07('0xfc'));}var _0x9d31bd=this[_0xde07('0xe')][_0xde07('0xb5')](_0xde07('0xde'),[util['format'](_0xde07('0xfd'),_0x301b93,_0x2534b1[_0xde07('0x47')]),_0x2534b1['timeout'],_0x2534b1['opts'],_0x2534b1['url']]);if(_0x9d31bd[_0xde07('0xa4')]===-0x1){return _0x9d31bd;}return this[_0xde07('0xe')][_0xde07('0xb1')](util['format'](_0xde07('0xfe'),'DIAL'));};AGIVertices[_0xde07('0x14')][_0xde07('0xff')]=function(_0x3f412f){logger['info'](util[_0xde07('0x27')](_0xde07('0x100'),_0x3f412f[_0xde07('0x36')]));return this[_0xde07('0xe')][_0xde07('0xb1')](_0xde07('0xff'));};AGIVertices[_0xde07('0x14')][_0xde07('0xc')]=function(_0x406c8f){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x101'),_0x406c8f[_0xde07('0x36')]));if(_0x406c8f[_0xde07('0xa7')]===0x0){return this[_0xde07('0xa8')](_0x406c8f);}_0x406c8f[_0xde07('0xa7')]-=0x1;if(!this[_0xde07('0x83')](_0x406c8f[_0xde07('0x102')])){return this[_0xde07('0xe')][_0xde07('0x2a')](_0x406c8f,_0xde07('0x103'));}var _0x179c75=this[_0xde07('0x104')][_0xde07('0x71')](this,_0x406c8f[_0xde07('0x102')]);if(!_0x179c75){return this[_0xde07('0xe')][_0xde07('0x2a')](_0x406c8f,_0xde07('0x105'));}if(!this[_0xde07('0x83')](_0x406c8f[_0xde07('0xd6')])){return this[_0xde07('0xe')][_0xde07('0x2a')](_0xde07('0xd5'));}var _0x4ea4f4=this[_0xde07('0xe')][_0xde07('0x106')](_0x179c75,_0x406c8f['response'],_0x406c8f['maxdigit']);var _0x24fdc9=_0x4ea4f4[_0xde07('0xa4')]?_0x4ea4f4['result']['toString']():'';logger['info'](_0xde07('0x107'),JSON[_0xde07('0x75')](_0x4ea4f4));if(_0x4ea4f4['result']===-0x1){this[_0xde07('0x35')][_0xde07('0x71')](this,_0x406c8f,_0x24fdc9);return _0x4ea4f4;}else if(_0x4ea4f4[_0xde07('0xa2')]===_0xde07('0x67')){_0x4ea4f4[_0xde07('0xa4')]=_0x24fdc9[_0xde07('0x9f')]>=parseInt(_0x406c8f[_0xde07('0x108')])?'x':'i';}else{_0x4ea4f4['result']=_0x24fdc9[_0xde07('0x9f')]>=parseInt(_0x406c8f['mindigit'])&&_0x24fdc9[_0xde07('0x9f')]<=parseInt(_0x406c8f['maxdigit'])?'x':'i';}var _0x19d517=this[_0xde07('0x109')]['sync'](this,_0x406c8f[_0xde07('0xd6')]);if(!_0x19d517){return this['channel'][_0xde07('0x2a')](_0x406c8f,_0xde07('0xd7'));}this[_0xde07('0xe')][_0xde07('0xa6')](_0x19d517,_0x24fdc9);if(this[_0xde07('0x83')](_0x406c8f[_0xde07('0x10a')])){var _0x424d20=parseInt(_0x406c8f[_0xde07('0x10a')],0xa);var _0x407e8e=rs['generate']({'charset':'*','length':_0x424d20});var _0x253314=_0x24fdc9[_0xde07('0x9f')];if(_0x253314>0x0){if(_0x253314>_0x424d20){this[_0xde07('0x35')][_0xde07('0x71')](this,_0x406c8f,_0x406c8f[_0xde07('0x10b')]===_0xde07('0x10c')?_0x407e8e+_0x24fdc9[_0xde07('0x10d')](_0x424d20):_0x24fdc9['substr'](0x0,_0x253314-_0x424d20)+_0x407e8e);}else{this[_0xde07('0x35')][_0xde07('0x71')](this,_0x406c8f,rs[_0xde07('0x10e')]({'charset':'*','length':_0x253314}));}}else{this[_0xde07('0x35')][_0xde07('0x71')](this,_0x406c8f,'');}}else{this['createSquareDetailsReport'][_0xde07('0x71')](this,_0x406c8f,_0x24fdc9);}return _0x4ea4f4;};AGIVertices[_0xde07('0x14')]['getsecretdigits']=function(_0x56085e){logger['info'](util[_0xde07('0x27')](_0xde07('0x10f'),_0x56085e['label']));return this[_0xde07('0xc')](_0x56085e);};AGIVertices['prototype'][_0xde07('0x110')]=function(_0xd3c279){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x111'),_0xd3c279[_0xde07('0x36')]));this[_0xde07('0x35')][_0xde07('0x71')](this,_0xd3c279,_0xd3c279[_0xde07('0x112')]);return this['channel'][_0xde07('0xb1')](util['format']('GOAL\x20%s',_0xd3c279[_0xde07('0x112')]));};AGIVertices[_0xde07('0x14')][_0xde07('0x113')]=function(_0x5506e4){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x114'),_0x5506e4[_0xde07('0x36')]));if(!this[_0xde07('0x83')](_0x5506e4[_0xde07('0x8c')])||!this[_0xde07('0x83')](_0x5506e4[_0xde07('0x86')])){return this[_0xde07('0xe')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this[_0xde07('0x83')](_0x5506e4['text'])){return this[_0xde07('0xe')][_0xde07('0xb1')](_0xde07('0xbe'));}this[_0xde07('0xe')]['noop'](util[_0xde07('0x27')]('Trying\x20aws\x20Polly\x20%s',_0x5506e4[_0xde07('0x5c')]));var _0x5c33fe=this[_0xde07('0x85')][_0xde07('0x71')](this,_0x5506e4);if(_0x5c33fe){this[_0xde07('0xe')][_0xde07('0xb1')](util['format'](_0xde07('0x115'),_0x5c33fe));var _0x264b31=this[_0xde07('0xe')][_0xde07('0xf2')](_0x5c33fe);try{fs[_0xde07('0xf3')](_0x5c33fe+_0xde07('0xf4'));}catch(_0x32a2b0){logger['error'](_0x32a2b0);}return _0x264b31;}return this[_0xde07('0xe')][_0xde07('0x2a')](_0x5506e4,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0xde07('0x14')][_0xde07('0x116')]=function(_0x59855c){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x117'),_0x59855c['label']));if(!this[_0xde07('0x83')](_0x59855c[_0xde07('0x8c')])||!this['isConfigured'](_0x59855c[_0xde07('0x86')])){return this[_0xde07('0xe')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x59855c['aws_bot_name'])){return this['channel']['noop'](_0xde07('0x118'));}if(!this[_0xde07('0x83')](_0x59855c[_0xde07('0x5c')])){return this[_0xde07('0xe')][_0xde07('0xb1')]('no\x20text\x20configured');}this[_0xde07('0xe')][_0xde07('0x119')]=!![];this[_0xde07('0x35')](_0x59855c);this[_0xde07('0x41')](_0x59855c[_0xde07('0x5c')],'in');this[_0xde07('0xe')][_0xde07('0xb1')](util[_0xde07('0x27')](_0xde07('0x11a'),_0x59855c[_0xde07('0x5c')]));var _0x15c935=this[_0xde07('0x8b')][_0xde07('0x71')](this,_0x59855c);if(_0x15c935){for(var _0x3c195a in _0x15c935){if(_0x15c935[_0xde07('0x98')](_0x3c195a)&&_[_0xde07('0x9b')](_0x15c935[_0x3c195a])){this[_0xde07('0xe')]['setVariable'](util[_0xde07('0x27')]('AWS_LEX_%s',_0x3c195a[_0xde07('0x6c')]()),_0x15c935[_0x3c195a]);}}if(_[_0xde07('0x44')](_0x15c935[_0xde07('0x11b')])){return this[_0xde07('0xe')]['noop'](_0xde07('0x11c'));}else{this['createSquareMessage'](_0x15c935[_0xde07('0x11b')],'out');return this[_0xde07('0xe')][_0xde07('0xb1')](util[_0xde07('0x27')](_0xde07('0x11d'),_0x15c935['message']));}}return this[_0xde07('0xe')]['error'](_0x59855c,_0xde07('0x11e'));};AGIVertices['prototype'][_0xde07('0x11f')]=function(_0x22506e){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x120'),_0x22506e[_0xde07('0x36')],_0x22506e['timeout']));if(!this['isConfigured'](_0x22506e['key'])){return this[_0xde07('0xe')][_0xde07('0xb1')]('no\x20key\x20configured');}var _0x55812a='wav';var _0xf1f6be=util[_0xde07('0x27')](_0xde07('0x121'),FILES_PATH,rs['generate'](0x4));var _0x180524=util['format']('%s.%s',_0xf1f6be,_0x55812a);var _0x359ed9=!![];if(_0x22506e[_0xde07('0x122')]==='NOBEEP'){_0x359ed9=![];}var _0x36ffc3=this['channel']['recordFile'](_0xf1f6be,_0x55812a,_0x22506e[_0xde07('0x123')],_0x22506e['timeout'],undefined,_0x359ed9);if(_0x36ffc3[_0xde07('0xa4')]!==-0x1){this[_0xde07('0xe')][_0xde07('0xb1')](util[_0xde07('0x27')](_0xde07('0x124'),_0x180524));var _0x33ca16=this[_0xde07('0x8f')][_0xde07('0x71')](this,_0x22506e,_0x180524);if(_0x33ca16){for(var _0x467f7c in _0x33ca16){if(_0x33ca16[_0xde07('0x98')](_0x467f7c)){this[_0xde07('0xe')]['setVariable'](util[_0xde07('0x27')](_0xde07('0x125'),_0x467f7c[_0xde07('0x6c')]()),_0x33ca16[_0x467f7c]);}}return this[_0xde07('0xe')][_0xde07('0xb1')](util[_0xde07('0x27')](_0xde07('0x126'),JSON[_0xde07('0x75')](_0x33ca16)));}}return _0x36ffc3;};AGIVertices[_0xde07('0x14')]['tildeasr']=function(_0x42ff29){logger[_0xde07('0x2c')](util['format'](_0xde07('0x127'),_0x42ff29[_0xde07('0x36')]));if(!this[_0xde07('0x83')](_0x42ff29[_0xde07('0x92')])){return this['channel'][_0xde07('0xb1')]('no\x20appid\x20configured');}if(!this[_0xde07('0x83')](_0x42ff29['appsecret'])){return this[_0xde07('0xe')][_0xde07('0xb1')]('no\x20appsecret\x20configured');}var _0x486c08=_0xde07('0x128');var _0x48b60f=util[_0xde07('0x27')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0xdd0851=util['format'](_0xde07('0x9e'),_0x48b60f,_0x486c08);var _0x51a438=!![];if(_0x42ff29[_0xde07('0x122')]==='NOBEEP'){_0x51a438=![];}var _0x4126d=this[_0xde07('0xe')][_0xde07('0x129')](_0x48b60f,_0x486c08,_0x42ff29[_0xde07('0x123')],_0x42ff29['timeout'],undefined,_0x51a438);if(_0x4126d[_0xde07('0xa4')]!==-0x1){this[_0xde07('0xe')]['noop'](util[_0xde07('0x27')](_0xde07('0x12a'),_0xdd0851));var _0x922e60=this[_0xde07('0x91')][_0xde07('0x71')](this,_0x42ff29,_0xdd0851);if(_0x922e60){for(var _0x6d1e91 in _0x922e60){if(_0x922e60['hasOwnProperty'](_0x6d1e91)){this[_0xde07('0xe')][_0xde07('0xa6')](util[_0xde07('0x27')]('TILDE_ASR_%s',_0x6d1e91['toUpperCase']()),_0x922e60[_0x6d1e91]);}}return this[_0xde07('0xe')][_0xde07('0xb1')](util[_0xde07('0x27')](_0xde07('0x12b'),JSON['stringify'](_0x922e60)));}}return _0x4126d;};AGIVertices[_0xde07('0x14')]['gotoc']=function(_0x367650){logger[_0xde07('0x2c')](util[_0xde07('0x27')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x367650[_0xde07('0x36')]));return this[_0xde07('0xe')][_0xde07('0x12c')](_0x367650[_0xde07('0x12d')],_0x367650['extension'],_0x367650[_0xde07('0x3d')]);};AGIVertices[_0xde07('0x14')]['gotoif']=function(_0x43281f){logger[_0xde07('0x2c')](util[_0xde07('0x27')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x43281f['label']));if(!this[_0xde07('0x83')](_0x43281f[_0xde07('0x12e')])){return this[_0xde07('0xe')][_0xde07('0x2a')](_0x43281f,_0xde07('0x12f'));}try{var _0x123323=eval(_0x43281f['condition'])?_0xde07('0x130'):_0xde07('0x131');this['channel']['noop'](util['format'](_0xde07('0x132'),_0x43281f[_0xde07('0x12e')],_0x123323));return{'code':0xc8,'result':_0x123323};}catch(_0x43b51a){return{'code':0xc8,'result':'false'};}};AGIVertices[_0xde07('0x14')][_0xde07('0x133')]=function(_0x5d238b){logger[_0xde07('0x2c')](util['format']('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x5d238b[_0xde07('0x36')]));if(!this[_0xde07('0x83')](_0x5d238b[_0xde07('0x134')])){return this[_0xde07('0xe')][_0xde07('0x2a')](_0x5d238b,_0xde07('0x135'));}var _0x486152=this[_0xde07('0x22')][_0xde07('0x71')](this,_0x5d238b[_0xde07('0x134')]);if(!_0x486152){return this[_0xde07('0xe')][_0xde07('0x2a')](_0x5d238b,_0xde07('0x136'));}for(var _0x1fc4a1=0x0;_0x1fc4a1<_0x486152['length'];_0x1fc4a1+=0x1){var _0x53ef7f=this[_0xde07('0xe')][_0xde07('0x109')](util[_0xde07('0x27')](_0xde07('0x137'),_0x486152[_0x1fc4a1]));if(_0x53ef7f[_0xde07('0xa4')]===-0x1){return _0x53ef7f;}logger[_0xde07('0x2c')](util['format']('IFTIME\x20%s\x20%s',_0x486152[_0x1fc4a1],_0x53ef7f[_0xde07('0xa2')]));if(_0x53ef7f[_0xde07('0xa2')]===_0xde07('0x130')){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x138'),_0x486152[_0x1fc4a1],'true'));this[_0xde07('0xe')][_0xde07('0xb1')](util['format'](_0xde07('0x138'),_0x486152[_0x1fc4a1],_0xde07('0x130')));return{'code':0xc8,'result':'true'};}else{logger[_0xde07('0x2c')](util['format']('IFTIME\x20%s\x20%s',_0x486152[_0x1fc4a1],_0xde07('0x131')));this[_0xde07('0xe')][_0xde07('0xb1')](util['format']('IFTIME\x20%s\x20%s',_0x486152[_0x1fc4a1],_0xde07('0x131')));}}return{'code':0xc8,'result':_0xde07('0x131')};};AGIVertices['prototype'][_0xde07('0x139')]=function(_0x532c47){logger['info'](util['format']('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x532c47[_0xde07('0x36')]));return this[_0xde07('0xe')]['hangup']();};AGIVertices[_0xde07('0x14')][_0xde07('0x13a')]=function(_0x5e5688){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x13b'),_0x5e5688[_0xde07('0x36')]));if(!this[_0xde07('0x83')](_0x5e5688[_0xde07('0x7b')])){return this['channel'][_0xde07('0xb1')](_0xde07('0xe1'));}var _0x5a771b=_0xde07('0x128');var _0x78b8ad=util[_0xde07('0x27')](_0xde07('0x121'),FILES_PATH,rs['generate'](0x4));var _0x2b9a16=util[_0xde07('0x27')](_0xde07('0x9e'),_0x78b8ad,_0x5a771b);var _0x57eb1d=!![];if(_0x5e5688[_0xde07('0x122')]===_0xde07('0x13c')){_0x57eb1d=![];}var _0x304f92=this[_0xde07('0xe')]['recordFile'](_0x78b8ad,_0x5a771b,_0x5e5688[_0xde07('0x123')],_0x5e5688[_0xde07('0x67')],undefined,_0x57eb1d);if(_0x304f92[_0xde07('0xa4')]!==-0x1){this[_0xde07('0xe')][_0xde07('0xb1')](util[_0xde07('0x27')](_0xde07('0x13d'),_0x2b9a16));var _0xc51f9b=this[_0xde07('0x81')]['sync'](this,_0x5e5688,_0x2b9a16);if(_0xc51f9b){for(var _0x33a470 in _0xc51f9b){if(_0xc51f9b[_0xde07('0x98')](_0x33a470)){this[_0xde07('0xe')]['setVariable'](util['format']('ISPEECH_ASR_%s',_0x33a470[_0xde07('0x6c')]()),_0xc51f9b[_0x33a470]);}}return this['channel'][_0xde07('0xb1')](util[_0xde07('0x27')]('IspeechASR\x20Result\x20%s',JSON[_0xde07('0x75')](_0xc51f9b)));}}return _0x304f92;};AGIVertices[_0xde07('0x14')][_0xde07('0x13e')]=function(_0x1d43a5){logger['info'](util[_0xde07('0x27')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x1d43a5[_0xde07('0x36')]));if(!this[_0xde07('0x83')](_0x1d43a5['key'])){return this[_0xde07('0xe')][_0xde07('0xb1')](_0xde07('0xe1'));}if(!this[_0xde07('0x83')](_0x1d43a5[_0xde07('0x5c')])){return this[_0xde07('0xe')][_0xde07('0xb1')]('no\x20text\x20configured');}this[_0xde07('0xe')][_0xde07('0xb1')](util['format']('Trying\x20ispeech\x20TTS\x20%s',_0x1d43a5[_0xde07('0x5c')]));var _0x3d6f7f=this[_0xde07('0x7e')]['sync'](this,_0x1d43a5);if(_0x3d6f7f){this[_0xde07('0xe')]['noop'](util['format']('ispeech\x20%s\x20file\x20created',_0x3d6f7f));var _0x20df0a=this[_0xde07('0xe')][_0xde07('0xf2')](_0x3d6f7f,_0x1d43a5[_0xde07('0x123')]);try{fs[_0xde07('0xf3')](_0x3d6f7f+_0xde07('0xf4'));}catch(_0x2a5ad3){logger[_0xde07('0x2a')](_0x2a5ad3);}return _0x20df0a;}return this[_0xde07('0xe')][_0xde07('0x2a')](_0x1d43a5,_0xde07('0x13f'));};AGIVertices[_0xde07('0x14')][_0xde07('0x140')]=function(_0x1e7f5c){logger['info'](util[_0xde07('0x27')](_0xde07('0x141'),_0x1e7f5c[_0xde07('0x36')]));if(!this[_0xde07('0x83')](_0x1e7f5c[_0xde07('0x142')])){return this['channel'][_0xde07('0x2a')](_0x1e7f5c,'no\x20find\x20by\x20configured');}logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x143'),this[_0xde07('0xe')][_0xde07('0x39')],_0x1e7f5c['findBy']));var _0x57de7c=this[_0xde07('0x52')]['sync'](this,_0x1e7f5c[_0xde07('0x142')]);if(_0x57de7c){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x144'),this[_0xde07('0xe')][_0xde07('0x39')],_0x1e7f5c[_0xde07('0x142')]));this[_0xde07('0xe')]['noop'](util[_0xde07('0x27')](_0xde07('0x144'),this[_0xde07('0xe')]['callerid'],_0x1e7f5c['findBy']));return{'code':0xc8,'result':_0xde07('0x145')};}else{logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x146'),this[_0xde07('0xe')]['callerid'],_0x1e7f5c['findBy']));this[_0xde07('0xe')][_0xde07('0xb1')](util['format'](_0xde07('0x146'),this[_0xde07('0xe')][_0xde07('0x39')],_0x1e7f5c[_0xde07('0x142')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xde07('0x14')]['logout']=function(_0x43a239){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x147'),_0x43a239[_0xde07('0x36')]));if(!this[_0xde07('0x83')](_0x43a239[_0xde07('0x142')])){return this[_0xde07('0xe')][_0xde07('0x2a')](_0x43a239,'no\x20find\x20by\x20configured');}logger[_0xde07('0x2c')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xde07('0xe')]['callerid'],_0x43a239[_0xde07('0x142')]));var _0x591ce8=this[_0xde07('0x51')][_0xde07('0x71')](this,_0x43a239[_0xde07('0x142')]);if(_0x591ce8){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x144'),this[_0xde07('0xe')][_0xde07('0x39')],_0x43a239['findBy']));this['channel'][_0xde07('0xb1')](util[_0xde07('0x27')](_0xde07('0x144'),this['channel'][_0xde07('0x39')],_0x43a239[_0xde07('0x142')]));return{'code':0xc8,'result':_0xde07('0x145')};}else{logger[_0xde07('0x2c')](util[_0xde07('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xde07('0xe')][_0xde07('0x39')],_0x43a239[_0xde07('0x142')]));this[_0xde07('0xe')][_0xde07('0xb1')](util[_0xde07('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xde07('0xe')][_0xde07('0x39')],_0x43a239[_0xde07('0x142')]));return{'code':0xc8,'result':_0xde07('0x148')};}};AGIVertices[_0xde07('0x14')]['math']=function(_0x275545){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x149'),_0x275545['label']));if(!this['isConfigured'](_0x275545[_0xde07('0x14a')])){return this[_0xde07('0xe')][_0xde07('0x2a')](_0x275545,_0xde07('0x14b'));}this['channel'][_0xde07('0xb1')](util['format'](_0xde07('0x14c'),_0x275545['operation']));var _0x4456ed=eval(_0x275545[_0xde07('0x14a')]);if(!this['isConfigured'](_0x275545['variable_id'])){return this['channel'][_0xde07('0xb1')](_0xde07('0xd5'));}var _0x4d9990=this[_0xde07('0x109')][_0xde07('0x71')](this,_0x275545['variable_id']);if(!_0x4d9990){return this[_0xde07('0xe')][_0xde07('0x2a')](_0x275545,_0xde07('0xd7'));}if(_[_0xde07('0x9a')](_0x4456ed)){var _0x1f5474=this;_0x4456ed['forEach'](function(_0x330097,_0x3b1792){_0x1f5474[_0xde07('0xe')][_0xde07('0xa6')](util[_0xde07('0x27')](_0xde07('0x14d'),_0x4d9990,_0x3b1792),_0x330097);});return this[_0xde07('0xe')]['noop'](util[_0xde07('0x27')](_0xde07('0x14e'),_0x4d9990));}else{return this[_0xde07('0xe')][_0xde07('0xa6')](_0x4d9990,_0x4456ed);}};AGIVertices['prototype'][_0xde07('0xb')]=function(_0x5ec8e2){logger['info'](util['format']('Enter\x20in\x20MENU\x20(%s)\x20block',_0x5ec8e2[_0xde07('0x36')]));if(_0x5ec8e2['retry']===0x0){return this['maxRetry'](_0x5ec8e2);}_0x5ec8e2['retry']-=0x1;if(!this[_0xde07('0x83')](_0x5ec8e2['file_id'])){return this[_0xde07('0xe')][_0xde07('0x2a')](_0x5ec8e2,'no\x20file\x20audio\x20selected');}var _0x3c1710=this[_0xde07('0x104')][_0xde07('0x71')](this,_0x5ec8e2[_0xde07('0x102')]);if(!_0x3c1710){return this[_0xde07('0xe')]['error'](_0x5ec8e2,_0xde07('0x105'));}var _0x2cc277=this[_0xde07('0xe')][_0xde07('0x106')](_0x3c1710,_0x5ec8e2[_0xde07('0x14f')],_0x5ec8e2[_0xde07('0x150')]);var _0x53adba=_0x2cc277[_0xde07('0xa4')];if(_0x2cc277['result']===-0x1){this[_0xde07('0x35')][_0xde07('0x71')](this,_0x5ec8e2,'-1');return _0x2cc277;}else if(_0x2cc277[_0xde07('0xa2')]==='timeout'){_0x2cc277[_0xde07('0xa4')]=_0x2cc277[_0xde07('0xa4')][_0xde07('0x9f')]>0x0?_0x2cc277[_0xde07('0xa4')]:'t';}else if(_[_0xde07('0x43')](_0x2cc277[_0xde07('0xa4')])){_0x2cc277[_0xde07('0xa4')]='#';_0x53adba='#';}if(!this[_0xde07('0x83')](_0x5ec8e2[_0xde07('0xd6')])){this[_0xde07('0xe')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x175961=this[_0xde07('0x109')][_0xde07('0x71')](this,_0x5ec8e2['variable_id']);if(!_0x175961){return this[_0xde07('0xe')][_0xde07('0x2a')](_0x5ec8e2,_0xde07('0xd7'));}this[_0xde07('0xe')]['setVariable'](_0x175961,_0x53adba);}this['createSquareDetailsReport']['sync'](this,_0x5ec8e2,_0x53adba);return _0x2cc277;};AGIVertices[_0xde07('0x14')][_0xde07('0xb1')]=function(_0x30c59a){logger[_0xde07('0x2c')](util[_0xde07('0x27')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x30c59a['label']));return this[_0xde07('0xe')][_0xde07('0xb1')](_0x30c59a[_0xde07('0x151')]||_0x30c59a[_0xde07('0x36')]);};AGIVertices[_0xde07('0x14')][_0xde07('0x152')]=function(_0x4690ce){logger['info'](util['format'](_0xde07('0x153'),_0x4690ce['label']));if(!this[_0xde07('0x83')](_0x4690ce[_0xde07('0x142')])){return this['channel'][_0xde07('0x2a')](_0x4690ce,_0xde07('0x154'));}logger['info'](util[_0xde07('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0xde07('0x39')],_0x4690ce[_0xde07('0x142')]));var _0x736bad=this[_0xde07('0x4c')][_0xde07('0x71')](this,_0x4690ce[_0xde07('0x155')]);var _0x128dce=this[_0xde07('0x4e')][_0xde07('0x71')](this,_0x4690ce[_0xde07('0x142')],_0x736bad);if(_0x128dce){logger[_0xde07('0x2c')](util['format'](_0xde07('0x144'),this[_0xde07('0xe')][_0xde07('0x39')],_0x4690ce[_0xde07('0x142')]));this[_0xde07('0xe')][_0xde07('0xb1')](util[_0xde07('0x27')](_0xde07('0x144'),this[_0xde07('0xe')][_0xde07('0x39')],_0x4690ce[_0xde07('0x142')]));return{'code':0xc8,'result':'success'};}else{logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x146'),this[_0xde07('0xe')][_0xde07('0x39')],_0x4690ce[_0xde07('0x142')]));this[_0xde07('0xe')][_0xde07('0xb1')](util[_0xde07('0x27')](_0xde07('0x144'),this[_0xde07('0xe')][_0xde07('0x39')],_0x4690ce['findBy']));return{'code':0xc8,'result':_0xde07('0x148')};}};AGIVertices[_0xde07('0x14')][_0xde07('0x156')]=function(_0x3f0fb7){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x157'),_0x3f0fb7[_0xde07('0x36')]));if(!this[_0xde07('0x83')](_0x3f0fb7[_0xde07('0x102')])){return this[_0xde07('0xe')][_0xde07('0x2a')](_0x3f0fb7,_0xde07('0x103'));}var _0x342b6c=this[_0xde07('0x104')][_0xde07('0x71')](this,_0x3f0fb7['file_id']);if(!_0x342b6c){return this[_0xde07('0xe')][_0xde07('0x2a')](_0x3f0fb7,_0xde07('0x105'));}var _0x4fa6af=this[_0xde07('0xe')][_0xde07('0xb5')](_0xde07('0x158'),[_0x342b6c,_0x3f0fb7['opts']]);if(_0x4fa6af['result']===-0x1){return _0x4fa6af;}return this[_0xde07('0xe')][_0xde07('0xb1')](util[_0xde07('0x27')]('Executed\x20command\x20%s\x20%s',_0xde07('0x158'),_0x342b6c));};AGIVertices['prototype'][_0xde07('0x159')]=function(_0x5af528){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x15a'),_0x5af528[_0xde07('0x36')]));if(!this[_0xde07('0x83')](_0x5af528['queue_id'])){return this[_0xde07('0xe')][_0xde07('0x2a')](_0x5af528,_0xde07('0x15b'));}var _0x8a45d5='';var _0x213b34=parseInt(_0x5af528['queue_id'],0xa);if(isNaN(_0x213b34)){_0x8a45d5=_0x5af528[_0xde07('0x15c')];}else{_0x8a45d5=this['getVoiceQueue'][_0xde07('0x71')](this,_0x5af528['queue_id']);if(!_0x8a45d5){return this[_0xde07('0xe')][_0xde07('0x2a')](_0x5af528,_0xde07('0x15d'));}}var _0x372eba='';if(this['isConfigured'](_0x5af528[_0xde07('0x102')])){var _0x10d5ff=this[_0xde07('0x104')][_0xde07('0x71')](this,_0x5af528['file_id']);if(_0x10d5ff){_0x372eba=_0x10d5ff;}}this[_0xde07('0x35')][_0xde07('0x71')](this,_0x5af528,_0x8a45d5);if(_0x5af528[_0xde07('0xe0')][_0xde07('0x15e')]('x')<0x0){_0x5af528[_0xde07('0xe0')]+='x';}if(_0x5af528[_0xde07('0xe0')][_0xde07('0x15e')]('X')<0x0){_0x5af528['opts']+='X';}this[_0xde07('0xe')][_0xde07('0xa6')](_0xde07('0x15f'),_0x8a45d5?_0x8a45d5[_0xde07('0x160')]():'');var _0x103565=this[_0xde07('0xe')][_0xde07('0xb5')](_0xde07('0x161'),[_0x8a45d5,_0x5af528[_0xde07('0xe0')],_0x5af528['url'],_0x372eba,_0x5af528['timeout'],_0x5af528[_0xde07('0xa9')],_0x5af528[_0xde07('0x162')],_0x5af528[_0xde07('0x163')],'',_0x5af528['position']]);if(_0x103565[_0xde07('0xa4')]===-0x1){return _0x103565;}return this['channel']['noop'](util['format'](_0xde07('0xb7'),_0xde07('0x161'),_0x8a45d5));};AGIVertices['prototype'][_0xde07('0x164')]=function(_0xe2ca52){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x165'),_0xe2ca52[_0xde07('0x36')]));var _0x37f083=_0xe2ca52[_0xde07('0x166')]||_0xde07('0x128');var _0xc5a0e9=util[_0xde07('0x27')](_0xde07('0x167'),this[_0xde07('0xe')][_0xde07('0x3b')],rs[_0xde07('0x10e')](0x5));var _0x5d6c73=util[_0xde07('0x27')]('%s/recordings/%s.%s',FILES_PATH,_0xc5a0e9,_0x37f083);var _0x27770f=util[_0xde07('0x27')](_0xde07('0x121'),FILES_PATH,_0xc5a0e9);this['createSquareRecording'][_0xde07('0x71')](this,_0xe2ca52,_0xc5a0e9,_0x5d6c73);this[_0xde07('0xe')]['setVariable'](_0xde07('0x168'),_0xc5a0e9);logger['info'](_0xde07('0x169'),_0x27770f,_0x37f083,_0xe2ca52['escape_digits'],_0xe2ca52[_0xde07('0x67')]);return this[_0xde07('0xe')]['recordFile'](_0x27770f,_0x37f083,_0xe2ca52['escape_digits'],_0xe2ca52[_0xde07('0x67')],undefined,!![]);};AGIVertices[_0xde07('0x14')]['restapi']=function(_0x188776){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x16a'),_0x188776[_0xde07('0x36')]));if(!this['isConfigured'](_0x188776[_0xde07('0x65')])){return this[_0xde07('0xe')][_0xde07('0xb1')](_0xde07('0x16b'));}var _0x4612a0=this[_0xde07('0x64')]['sync'](this,_0x188776);logger[_0xde07('0x2c')](util[_0xde07('0x27')]('Response:',util['inspect'](_0x4612a0,{'showHidden':![],'depth':null})));if(!this[_0xde07('0x83')](_0x188776['variable_id'])){return this[_0xde07('0xe')][_0xde07('0xb1')](_0xde07('0x16c'));}var _0x1f8eac=this[_0xde07('0x109')][_0xde07('0x71')](this,_0x188776[_0xde07('0xd6')]);if(!_0x1f8eac){return this[_0xde07('0xe')][_0xde07('0x2a')](_0x188776,_0xde07('0xd7'));}this['channel']['setVariable'](util[_0xde07('0x27')](_0xde07('0x16d'),_0x1f8eac),_0x4612a0[_0xde07('0x76')]?_0x4612a0['statusCode']:_0xde07('0x16e'));this[_0xde07('0xe')][_0xde07('0xa6')](util[_0xde07('0x27')](_0xde07('0x16f'),_0x1f8eac),_0x4612a0[_0xde07('0x77')]?_0x4612a0['statusMessage']:'OK');if(_0x4612a0[_0xde07('0x6d')]){try{this['saveRestApiResult'](_0x4612a0['body'],_0x1f8eac);}catch(_0x4837d1){logger['error'](util[_0xde07('0x27')](_0xde07('0x170'),_0x1f8eac));}}return this['channel'][_0xde07('0xb1')](util[_0xde07('0x27')](_0xde07('0x171'),_0x1f8eac));};AGIVertices['prototype']['saydigits']=function(_0x54bc5e){logger[_0xde07('0x2c')](util[_0xde07('0x27')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x54bc5e[_0xde07('0x36')]));return this[_0xde07('0xe')]['sayDigits'](_0x54bc5e[_0xde07('0x172')]['replace'](/\s+/g,''),_0x54bc5e[_0xde07('0x173')]);};AGIVertices[_0xde07('0x14')][_0xde07('0x174')]=function(_0x391d78){logger['info'](util['format'](_0xde07('0x175'),_0x391d78[_0xde07('0x36')]));return this[_0xde07('0xe')][_0xde07('0x176')](_0x391d78[_0xde07('0x68')][_0xde07('0x58')](/\s+/g,''),_0x391d78[_0xde07('0x173')]);};AGIVertices[_0xde07('0x14')][_0xde07('0x177')]=function(_0x1a05ae){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x178'),_0x1a05ae[_0xde07('0x36')]));return this[_0xde07('0xe')][_0xde07('0x179')](_0x1a05ae['text'],_0x1a05ae[_0xde07('0x173')]);};AGIVertices['prototype']['sendMail']=function(_0x23afc3){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x17a'),_0x23afc3['label']));if(!this['isConfigured'](_0x23afc3['account_id'])){return this[_0xde07('0xe')]['noop']('no\x20mail\x20account\x20configured');}var _0x42a045=this[_0xde07('0x17b')][_0xde07('0x71')](this,_0x23afc3[_0xde07('0x17c')]);if(!_0x42a045||!_0x42a045['Smtp']){return this['channel'][_0xde07('0x2a')](_0x23afc3,_0xde07('0x17d'));}var _0x2b517b={'from':util['format'](_0xde07('0x17e'),_0x42a045['name'],_0x42a045[_0xde07('0x17f')]||_0x42a045[_0xde07('0x180')]['user']),'to':_0x23afc3['to']||'','cc':_0x23afc3['cc']||'','bcc':_0x23afc3[_0xde07('0x181')]||'','subject':_0x23afc3[_0xde07('0x182')],'html':_0x23afc3[_0xde07('0x5c')],'text':_0x23afc3[_0xde07('0x5c')]};var _0x42f7f5={'tls':{'rejectUnauthorized':![]}};if(_0x42a045[_0xde07('0x180')]['service']){_0x42f7f5['service']=_0x42a045[_0xde07('0x180')][_0xde07('0x183')];}else{_0x42f7f5['host']=_0x42a045['Smtp'][_0xde07('0x184')];_0x42f7f5[_0xde07('0x185')]=_0x42a045[_0xde07('0x180')]['port'];_0x42f7f5[_0xde07('0x186')]=_0x42a045['Smtp']['secure'];}if(_0x42a045[_0xde07('0x180')][_0xde07('0x187')]){_0x42f7f5[_0xde07('0x188')]={'user':_0x42a045[_0xde07('0x180')][_0xde07('0x189')],'pass':_0x42a045[_0xde07('0x180')][_0xde07('0x18a')]};}if(this[_0xde07('0x83')](_0x23afc3['template_id'])){}logger[_0xde07('0x18b')](_0xde07('0x18c'),JSON[_0xde07('0x75')](_0x2b517b));this[_0xde07('0x35')][_0xde07('0x71')](this,_0x23afc3,_0x23afc3[_0xde07('0x17c')]);this[_0xde07('0xe')][_0xde07('0xb1')](util[_0xde07('0x27')](_0xde07('0x18d'),_0x42a045['name']));this[_0xde07('0x21')][_0xde07('0x71')](this,_0x42f7f5,_0x2b517b);return this[_0xde07('0xe')]['noop'](_0xde07('0x18e'));};AGIVertices[_0xde07('0x14')][_0xde07('0x18f')]=function(_0x3703fd){logger[_0xde07('0x2c')](util['format']('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x3703fd['label']));return this[_0xde07('0xe')]['noop'](_0xde07('0x190'));};AGIVertices[_0xde07('0x14')][_0xde07('0x191')]=function(_0x3e8cc4){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x192'),_0x3e8cc4[_0xde07('0x36')]));if(!this['isConfigured'](_0x3e8cc4[_0xde07('0x193')])){return this[_0xde07('0xe')][_0xde07('0xb1')](_0xde07('0x194'));}var _0x3cffd4=this['getSmsAccount'][_0xde07('0x71')](this,_0x3e8cc4[_0xde07('0x193')]);if(!_0x3cffd4){return this['channel']['error'](_0x3e8cc4,_0xde07('0x195'));}var _0x1a3415={'body':_0x3e8cc4[_0xde07('0x196')],'phone':_0x3e8cc4['to']||'','SmsAccountId':_0x3cffd4['id']};logger['debug']('sendSMS\x20message',JSON[_0xde07('0x75')](_0x1a3415));this[_0xde07('0x35')][_0xde07('0x71')](this,_0x3e8cc4,_0x3e8cc4[_0xde07('0x193')]);this[_0xde07('0xe')][_0xde07('0xb1')](util[_0xde07('0x27')](_0xde07('0x197'),_0x3cffd4[_0xde07('0x12')]));this[_0xde07('0x34')][_0xde07('0x71')](this,_0x1a3415);return this[_0xde07('0xe')][_0xde07('0xb1')](_0xde07('0x198'));};AGIVertices['prototype'][_0xde07('0x199')]=function(_0x269a28){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x19a'),_0x269a28[_0xde07('0x36')]));if(!this['isConfigured'](_0x269a28[_0xde07('0xd6')])){return this[_0xde07('0xe')][_0xde07('0x2a')](_0x269a28,_0xde07('0x19b'));}var _0x56ca39=this['getVariable']['sync'](this,_0x269a28['variable_id']);if(!_0x56ca39){return this['channel'][_0xde07('0x2a')](_0x269a28,_0xde07('0xd7'));}return this[_0xde07('0xe')][_0xde07('0xa6')](_0x56ca39,_0x269a28[_0xde07('0x19c')]);};AGIVertices[_0xde07('0x14')][_0xde07('0x19d')]=function(_0x51d2b0){logger[_0xde07('0x2c')](util['format']('Enter\x20in\x20START\x20(%s)\x20block',_0x51d2b0[_0xde07('0x36')]));this[_0xde07('0xe')]['noop']('START\x20CALLY\x20SQUARE');if(_0x51d2b0[_0xde07('0x19e')]===_0xde07('0x19f')){this['channel'][_0xde07('0xb1')](_0xde07('0x1a0'));return this['channel'][_0xde07('0x19e')]();}return this['channel'][_0xde07('0xb1')](_0xde07('0x1a1'));};AGIVertices[_0xde07('0x14')][_0xde07('0x1a2')]=function(_0x27c13c){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x1a3'),_0x27c13c['label']));if(!this[_0xde07('0x83')](_0x27c13c[_0xde07('0x1a4')])){return this[_0xde07('0xe')]['error'](_0x27c13c,_0xde07('0x1a5'));}var _0x31f9a3=this['getSquareProject'][_0xde07('0x71')](this,_0x27c13c[_0xde07('0x1a4')]);if(!this[_0xde07('0x83')](_0x31f9a3)){return this['channel'][_0xde07('0x2a')](_0x27c13c,util['format'](_0xde07('0x1a6'),_0x27c13c[_0xde07('0x1a4')]));}if(_0x31f9a3===this[_0xde07('0xe')][_0xde07('0x38')]){return this[_0xde07('0xe')][_0xde07('0x2a')](_0x27c13c,_0xde07('0x1a7'));}this[_0xde07('0x35')][_0xde07('0x71')](this,_0x27c13c,_0x31f9a3);var _0x327d37=this[_0xde07('0xe')][_0xde07('0xb5')](_0xde07('0x1a8'),util[_0xde07('0x27')](_0xde07('0x1a9'),config[_0xde07('0xa9')][_0xde07('0x184')]||_0xde07('0x1aa'),_0x31f9a3,this[_0xde07('0xe')]['arg_1']));if(_0x327d37['result']===-0x1){return _0x327d37;}return this[_0xde07('0xe')][_0xde07('0xb1')](util[_0xde07('0x27')](_0xde07('0xb7'),_0xde07('0x1a8'),_0x31f9a3));};AGIVertices[_0xde07('0x14')][_0xde07('0x1ab')]=function(_0x1b68ec){logger[_0xde07('0x2c')](util['format'](_0xde07('0x1ac'),_0x1b68ec[_0xde07('0x36')]));var _0x2b2fa6=this[_0xde07('0x56')][_0xde07('0x71')](this,_0x1b68ec[_0xde07('0x1ad')]);this['createSquareDetailsReport']['sync'](this,_0x1b68ec,_0x1b68ec[_0xde07('0x1ad')]);if(this[_0xde07('0x83')](_0x1b68ec[_0xde07('0xd6')])){var _0x1cdf65=this[_0xde07('0x109')]['sync'](this,_0x1b68ec[_0xde07('0xd6')]);if(_0x1cdf65){this[_0xde07('0xe')][_0xde07('0xa6')](_0x1cdf65,_0x2b2fa6);return this[_0xde07('0xe')]['noop'](util[_0xde07('0x27')](_0xde07('0x1ae'),_0x1b68ec[_0xde07('0x1ad')],_0x1cdf65));}}return this['channel']['noop'](util['format'](_0xde07('0x1af'),_0x1b68ec['command']));};AGIVertices[_0xde07('0x14')][_0xde07('0x1b0')]=function(_0xcba458){logger[_0xde07('0x2c')](util[_0xde07('0x27')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0xcba458[_0xde07('0x36')]));if(!this[_0xde07('0x83')](_0xcba458[_0xde07('0x5a')])){return this[_0xde07('0xe')][_0xde07('0xb1')](_0xde07('0x1b1'));}if(!this['isConfigured'](_0xcba458[_0xde07('0x5c')])){return this[_0xde07('0xe')]['noop']('no\x20text\x20configured');}this[_0xde07('0xe')][_0xde07('0xb1')](util[_0xde07('0x27')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0xcba458[_0xde07('0x5c')]));var _0x1c32a7=this[_0xde07('0x59')][_0xde07('0x71')](this,_0xcba458);if(_0x1c32a7){this['channel']['noop'](util['format'](_0xde07('0x1b2'),_0x1c32a7));var _0x4f6e13=this[_0xde07('0xe')][_0xde07('0xf2')](_0x1c32a7);try{fs[_0xde07('0xf3')](_0x1c32a7+_0xde07('0xf4'));}catch(_0x39a454){logger[_0xde07('0x2a')](_0x39a454);}return _0x4f6e13;}return this[_0xde07('0xe')][_0xde07('0x2a')](_0xcba458,_0xde07('0x1b3'));};AGIVertices['prototype'][_0xde07('0x1b4')]=function(_0x2c4dfe){logger['info'](util[_0xde07('0x27')](_0xde07('0x1b5'),_0x2c4dfe[_0xde07('0x36')]));if(!this[_0xde07('0x83')](_0x2c4dfe[_0xde07('0x5c')])){return this[_0xde07('0xe')][_0xde07('0xb1')]('no\x20text\x20configured');}this[_0xde07('0xe')][_0xde07('0xb1')](util['format'](_0xde07('0x1b6'),_0x2c4dfe[_0xde07('0x5c')]));var _0x3b8d9d=this['googleTTS'][_0xde07('0x71')](this,_0x2c4dfe);if(_0x3b8d9d){this[_0xde07('0xe')][_0xde07('0xb1')](util[_0xde07('0x27')](_0xde07('0x1b7'),_0x3b8d9d));var _0x229d6d=this['channel'][_0xde07('0xf2')](_0x3b8d9d);try{fs[_0xde07('0xf3')](_0x3b8d9d+_0xde07('0xf4'));}catch(_0x5e3fe9){logger['error'](_0x5e3fe9);}return _0x229d6d;}return this[_0xde07('0xe')]['error'](_0x2c4dfe,_0xde07('0x1b8'));};AGIVertices[_0xde07('0x14')]['unpause']=function(_0x368d27){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x1b9'),_0x368d27[_0xde07('0x36')]));if(!this[_0xde07('0x83')](_0x368d27[_0xde07('0x142')])){return this[_0xde07('0xe')][_0xde07('0x2a')](_0x368d27,_0xde07('0x154'));}logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x143'),this[_0xde07('0xe')][_0xde07('0x39')],_0x368d27['findBy']));var _0x18f8e9=this[_0xde07('0x50')]['sync'](this,_0x368d27['findBy']);if(_0x18f8e9){logger[_0xde07('0x2c')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xde07('0xe')][_0xde07('0x39')],_0x368d27[_0xde07('0x142')]));this[_0xde07('0xe')][_0xde07('0xb1')](util[_0xde07('0x27')](_0xde07('0x144'),this[_0xde07('0xe')][_0xde07('0x39')],_0x368d27[_0xde07('0x142')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util['format'](_0xde07('0x146'),this['channel'][_0xde07('0x39')],_0x368d27['findBy']));this[_0xde07('0xe')][_0xde07('0xb1')](util[_0xde07('0x27')](_0xde07('0x146'),this[_0xde07('0xe')][_0xde07('0x39')],_0x368d27['findBy']));return{'code':0xc8,'result':_0xde07('0x148')};}};AGIVertices['prototype'][_0xde07('0x1ba')]=function(_0x3e283b){logger[_0xde07('0x2c')](util['format'](_0xde07('0x1bb'),_0x3e283b[_0xde07('0x36')]));var _0x2fceef=this[_0xde07('0xe')]['exec']('VOICEMAIL',[_0x3e283b[_0xde07('0x1bc')],_0x3e283b[_0xde07('0x79')]]);if(_0x2fceef[_0xde07('0xa4')]===-0x1){return _0x2fceef;}return this[_0xde07('0xe')][_0xde07('0xb1')](util[_0xde07('0x27')](_0xde07('0xb7'),_0xde07('0x1bd'),_0x3e283b[_0xde07('0x1bc')]));};AGIVertices[_0xde07('0x14')][_0xde07('0x1be')]=function(_0x8ea44a){logger[_0xde07('0x2c')](util['format'](_0xde07('0x1bf'),_0x8ea44a[_0xde07('0x36')]));if(!this['isConfigured'](_0x8ea44a[_0xde07('0xd6')])){return this[_0xde07('0xe')]['error'](_0x8ea44a,_0xde07('0x19b'));}var _0x188378=this[_0xde07('0x109')][_0xde07('0x71')](this,_0x8ea44a[_0xde07('0xd6')]);if(!_0x188378){return this[_0xde07('0xe')]['error'](_0x8ea44a,_0xde07('0xd7'));}var _0x1a8fb3=this[_0xde07('0xe')][_0xde07('0x109')](_0x188378);return{'code':0xc8,'result':_0x1a8fb3[_0xde07('0xa2')]?_0x1a8fb3[_0xde07('0xa2')]:'-'};};String[_0xde07('0x14')]['replaceAll']=function(_0x588428,_0x2a1b17){return this[_0xde07('0xa0')](_0x588428)[_0xde07('0x1c0')](_0x2a1b17);};module['exports']=AGIVertices; \ No newline at end of file +var _0x9466=['Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','Enter\x20in\x20SWITCH\x20(%s)\x20block','replaceAll','join','exports','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','/var/opt/motion2/server/files','rawBody','getdigits','mailRpc','getVariable','name','catch','prototype','getVoiceQueue','getVoiceQueueById','then','getSquareProject','rpc','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','close','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','arg_1','createSquareRecording','callerid','calleridname','context','extension','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback','toString','callback_priority','getPause','getPauseById','agent','agentUnpause','agentLogout','internal','%s/%s@from-sip/n','LOCAL','agentLogin','shellCommand','exec','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','number','timeout','includes','PUT','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','url','headers','stringify','body','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','googleDialogflow','key','dialogflow_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','awsLex','googleASR','google_asr_language','appsecret','clear','agicommand','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','length','saveRestApiResult','%s.%s','isArray','setVariable','split','extra','maxRetry','retry','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','wait','result','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','add','minutes','noop','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','application','options','lumenvoxtts','no\x20text\x20configured','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','MRCPSynth','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','grammar','getAndSetVariable','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE','RECOG_INPUT()','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','%s[%s][%s]','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','DIAL','Executed\x20command\x20%s','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','SestekNDA\x20Result\x20%s','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','opts','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getData','maxdigit','test','mindigit','hiddendigitsnum','generate','first','substr','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','.wav','awslex','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','beep','NOBEEP','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','%s/recordings/%s','recordFile','tildeASR','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','continueAt','priority','gotoif','condition','no\x20condition\x20configured','false','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','true','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','failure','math','operation','no\x20operation\x20configured','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','response','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','no\x20find\x20by\x20configured','agentPause','success','playback','PLAYBACK','Executed\x20command\x20%s\x20%s','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_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','getMailAccount','Smtp','no\x20mail\x20account\x20found','email','bcc','service','host','port','secure','authentication','auth','pass','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','getSmsAccount','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','system'];(function(_0x10bbc6,_0x2e6d34){var _0x481e8a=function(_0x532084){while(--_0x532084){_0x10bbc6['push'](_0x10bbc6['shift']());}};_0x481e8a(++_0x2e6d34);}(_0x9466,0x1cb));var _0x6946=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x9466[_0x35885a];return _0xe86249;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x6946('0x0'));var _=require(_0x6946('0x1'));var sh=require(_0x6946('0x2'));var odbc=require(_0x6946('0x3'))();var rs=require(_0x6946('0x4'));var moment=require(_0x6946('0x5'));var Mustache=require(_0x6946('0x6'));var rp=require(_0x6946('0x7'));var logger=require(_0x6946('0x8'))(_0x6946('0x9'));var config=require(_0x6946('0xa'));var scripts=require('./scripts');var FILES_PATH=_0x6946('0xb');var recursiveMapAttributes=['rawHeaders',_0x6946('0xc')];var verticesWithRetry=['menu',_0x6946('0xd'),'getsecretdigits'];var AGIVertices=function(_0x301b38,_0x2b4eb3,_0x33dc99){this['channel']=_0x301b38;this['rpc']=_0x2b4eb3;this[_0x6946('0xe')]=_0x33dc99;};AGIVertices['prototype'][_0x6946('0xf')]=function(_0x249920,_0x440b7a){this['rpc']['getVariableById'](_0x249920)['then'](function(_0xf6fc3d){_0x440b7a(null,_0xf6fc3d?_0xf6fc3d[_0x6946('0x10')]:![]);})[_0x6946('0x11')](function(_0x164c74){_0x440b7a(_0x164c74);});};AGIVertices[_0x6946('0x12')][_0x6946('0x13')]=function(_0x3a395a,_0x6677f8){this['rpc'][_0x6946('0x14')](_0x3a395a)[_0x6946('0x15')](function(_0x197218){_0x6677f8(null,_0x197218?_0x197218[_0x6946('0x10')]:![]);})[_0x6946('0x11')](function(_0x2fb002){_0x6677f8(_0x2fb002);});};AGIVertices[_0x6946('0x12')][_0x6946('0x16')]=function(_0x124fda,_0x2ce8a7){this[_0x6946('0x17')][_0x6946('0x18')](_0x124fda)[_0x6946('0x15')](function(_0x23eefa){_0x2ce8a7(null,_0x23eefa?_0x23eefa['name']:![]);})['catch'](function(_0x289f57){_0x2ce8a7(_0x289f57);});};AGIVertices['prototype'][_0x6946('0x19')]=function(_0x4a1a0,_0x52a34f){this[_0x6946('0x17')][_0x6946('0x1a')](_0x4a1a0)['then'](function(_0x1c9d7c){_0x52a34f(null,_0x1c9d7c?_0x1c9d7c['dsn']:![]);})[_0x6946('0x11')](function(_0x14daa0){_0x52a34f(_0x14daa0);});};AGIVertices['prototype'][_0x6946('0x1b')]=function(_0x47528c,_0x3c8789){this['rpc'][_0x6946('0x1c')](_0x47528c)['then'](function(_0x3f2ca9){_0x3c8789(null,_0x3f2ca9?_0x3f2ca9[_0x6946('0x10')]:![]);})[_0x6946('0x11')](function(_0x345f37){_0x3c8789(_0x345f37);});};AGIVertices['prototype'][_0x6946('0x1d')]=function(_0x12d61a,_0x1ca606){this['rpc'][_0x6946('0x1e')](_0x12d61a)['then'](function(_0x1dfe91){_0x1ca606(null,_0x1dfe91?_0x1dfe91[_0x6946('0x10')]:![]);})[_0x6946('0x11')](function(_0x2db511){_0x1ca606(_0x2db511);});};AGIVertices[_0x6946('0x12')][_0x6946('0x1f')]=function(_0x2a6692,_0x36e7ff){var _0x1db3ce=this;this['rpc'][_0x6946('0x20')](_0x2a6692)[_0x6946('0x15')](function(_0x5d4619){_0x36e7ff(null,_0x5d4619?_0x1db3ce[_0x6946('0x21')](_0x5d4619['save_name']):![]);})[_0x6946('0x11')](function(_0x35bdf0){_0x36e7ff(_0x35bdf0);});};AGIVertices[_0x6946('0x12')]['getMailAccount']=function(_0x324581,_0x38b3ae){this[_0x6946('0x17')][_0x6946('0x22')](_0x324581)[_0x6946('0x15')](function(_0x36a25d){_0x38b3ae(null,_0x36a25d?_0x36a25d:![]);})[_0x6946('0x11')](function(_0x2b7b0e){_0x38b3ae(_0x2b7b0e);});};AGIVertices[_0x6946('0x12')][_0x6946('0x23')]=function(_0xfdc099,_0x51ca42,_0x681ae3){this[_0x6946('0xe')]['sendMailMessage'](_0xfdc099,_0x51ca42)[_0x6946('0x15')](function(){_0x681ae3(null);})[_0x6946('0x11')](function(_0xace751){_0x681ae3(_0xace751);});};AGIVertices[_0x6946('0x12')][_0x6946('0x24')]=function(_0x2a5245,_0x2b67ea){this[_0x6946('0x17')][_0x6946('0x25')](_0x2a5245)[_0x6946('0x15')](function(_0x4655fe){if(_0x4655fe){if(_0x4655fe[_0x6946('0x26')]){_0x2b67ea(null,[_0x4655fe[_0x6946('0x27')]]);}else{_0x2b67ea(null,_['map'](_0x4655fe['Intervals'],_0x6946('0x27')));}}else{_0x2b67ea(null,![]);}})[_0x6946('0x11')](function(_0x5051d6){_0x2b67ea(_0x5051d6);});};AGIVertices[_0x6946('0x12')][_0x6946('0x21')]=function(_0xff281c){return util[_0x6946('0x28')](_0x6946('0x29'),FILES_PATH,_0xff281c);};AGIVertices[_0x6946('0x12')][_0x6946('0x2a')]=function(_0x3aeedf,_0x263bca,_0x5e7e87){odbc[_0x6946('0x2b')](_0x3aeedf,function(_0x59b100){if(_0x59b100){logger[_0x6946('0x2c')](_0x6946('0x2d'),_0x59b100);_0x5e7e87(_0x59b100);}else{logger[_0x6946('0x2e')](_0x6946('0x2f'));odbc[_0x6946('0x30')](_0x263bca,function(_0x34860a,_0x4d393b){if(_0x34860a){logger[_0x6946('0x2e')]('Error\x20executing\x20query\x20%s',_0x263bca);_0x5e7e87(_0x34860a);}else{logger[_0x6946('0x2e')](_0x6946('0x31'),_0x263bca);odbc[_0x6946('0x32')](function(_0x35913d){if(_0x35913d){logger[_0x6946('0x2c')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x35913d);}_0x5e7e87(null,_0x4d393b);});}});}});};AGIVertices[_0x6946('0x12')]['getSmsAccount']=function(_0x2cc67e,_0x3b9e47){this[_0x6946('0x17')][_0x6946('0x33')](_0x2cc67e)['then'](function(_0x155152){_0x3b9e47(null,_0x155152?_0x155152:![]);})[_0x6946('0x11')](function(_0x293808){_0x3b9e47(_0x293808);});};AGIVertices[_0x6946('0x12')][_0x6946('0x34')]=function(_0x37430,_0xac212){this[_0x6946('0x17')][_0x6946('0x34')](_0x37430)[_0x6946('0x15')](function(_0x40c2c6){_0xac212(null,_0x40c2c6);})[_0x6946('0x11')](function(_0x45c67d){_0xac212(_0x45c67d);});};AGIVertices['prototype'][_0x6946('0x35')]=function(_0x442285,_0x5ada1e,_0x45f2d7){this['rpc']['createSquareDetailsReport']({'uniqueid':this[_0x6946('0x36')][_0x6946('0x37')],'node':_0x442285[_0x6946('0x38')],'application':_0x442285['agicommand'],'data':_0x5ada1e||null,'project_name':this[_0x6946('0x36')][_0x6946('0x39')],'callerid':this[_0x6946('0x36')]['callerid']})[_0x6946('0x15')](function(_0x3bcd8a){if(_0x45f2d7){_0x45f2d7(null,_0x3bcd8a);}})[_0x6946('0x11')](function(_0x2a724c){if(_0x45f2d7){_0x45f2d7(_0x2a724c);}});};AGIVertices[_0x6946('0x12')][_0x6946('0x3a')]=function(_0x22e2a3,_0x159c3d,_0x1efa27,_0x5bb9f1){this[_0x6946('0x17')][_0x6946('0x3a')]({'uniqueid':this['channel'][_0x6946('0x37')],'callerid':this[_0x6946('0x36')][_0x6946('0x3b')],'calleridname':this[_0x6946('0x36')][_0x6946('0x3c')],'context':this[_0x6946('0x36')][_0x6946('0x3d')],'extension':this[_0x6946('0x36')][_0x6946('0x3e')],'priority':this[_0x6946('0x36')]['priority'],'accountcode':this[_0x6946('0x36')]['accountcode'],'dnid':this['channel'][_0x6946('0x3f')],'projectName':this[_0x6946('0x36')]['arg_1'],'saveName':_0x159c3d,'filename':_0x22e2a3[_0x6946('0x40')]||_0x159c3d,'savePath':_0x1efa27})[_0x6946('0x15')](function(_0x57da4e){_0x5bb9f1(null,_0x57da4e);})[_0x6946('0x11')](function(_0x343230){_0x5bb9f1(_0x343230);});};AGIVertices[_0x6946('0x12')]['createSquareMessage']=function(_0x52008e,_0x5cc5a2,_0x14057d){this[_0x6946('0x17')][_0x6946('0x41')]({'uniqueid':this[_0x6946('0x36')]['uniqueid'],'body':_0x52008e,'direction':_0x5cc5a2})[_0x6946('0x15')](function(_0x24168a){if(_0x14057d){_0x14057d(null,_0x24168a);}})[_0x6946('0x11')](function(_0x39f995){if(_0x14057d){_0x14057d(_0x39f995);}});};AGIVertices[_0x6946('0x12')][_0x6946('0x42')]=function(_0x509d87,_0x4f05e9){this[_0x6946('0x17')][_0x6946('0x42')]({'firstName':_[_0x6946('0x43')](_0x509d87['name'])||_[_0x6946('0x44')](_0x509d87[_0x6946('0x10')])?_0x6946('0x45')+Math[_0x6946('0x46')]():_0x509d87['name'],'lastName':_[_0x6946('0x43')](_0x509d87['lastName'])||_[_0x6946('0x44')](_0x509d87['lastName'])?null:_0x509d87[_0x6946('0x47')],'phone':_0x509d87[_0x6946('0x48')],'ListId':_0x509d87[_0x6946('0x49')],'scheduledat':_0x509d87[_0x6946('0x4a')],'callbackUniqueid':this[_0x6946('0x36')][_0x6946('0x37')],'tags':_0x6946('0x4b'),'description':'Callback\x20scheduled\x20at\x20'+_0x509d87[_0x6946('0x4a')][_0x6946('0x4c')](),'priority':_0x509d87[_0x6946('0x4d')]})['then'](function(_0x3dcc39){_0x4f05e9(null,_0x3dcc39);})[_0x6946('0x11')](function(_0x23d60f){_0x4f05e9(_0x23d60f);});};AGIVertices[_0x6946('0x12')][_0x6946('0x4e')]=function(_0x3e41db,_0x571cd7){this[_0x6946('0x17')][_0x6946('0x4f')](_0x3e41db)[_0x6946('0x15')](function(_0xca711d){_0x571cd7(null,_0xca711d?_0xca711d[_0x6946('0x10')]:![]);})[_0x6946('0x11')](function(_0x2aa80e){_0x571cd7(_0x2aa80e);});};AGIVertices[_0x6946('0x12')]['agentPause']=function(_0x265cd7,_0x152079,_0x3aa8e8){var _0x21bc8c={'role':_0x6946('0x50')};_0x21bc8c[_0x265cd7]=this[_0x6946('0x36')][_0x6946('0x3b')];this[_0x6946('0x17')]['agentPause'](_0x21bc8c,_0x152079,this['channel'][_0x6946('0x37')])[_0x6946('0x15')](function(_0x1e0399){_0x3aa8e8(null,_['isNil'](_0x1e0399)?![]:!![]);})[_0x6946('0x11')](function(_0x47b76d){logger[_0x6946('0x2c')](_0x47b76d);_0x3aa8e8(null,![]);});};AGIVertices['prototype'][_0x6946('0x51')]=function(_0x4dd938,_0x15e3c2){var _0x52517a={'role':_0x6946('0x50')};_0x52517a[_0x4dd938]=this[_0x6946('0x36')][_0x6946('0x3b')];this[_0x6946('0x17')][_0x6946('0x51')](_0x52517a)[_0x6946('0x15')](function(_0x185e6e){_0x15e3c2(null,_['isNil'](_0x185e6e)?![]:!![]);})[_0x6946('0x11')](function(_0x20821f){logger['error'](_0x20821f);_0x15e3c2(null,![]);});};AGIVertices[_0x6946('0x12')][_0x6946('0x52')]=function(_0x24fee6,_0x378f81){var _0x3b67a8={'role':_0x6946('0x50')};_0x3b67a8[_0x24fee6]=this['channel']['callerid'];this['rpc'][_0x6946('0x52')](_0x3b67a8)['then'](function(_0x154f54){_0x378f81(null,_['isNil'](_0x154f54)?![]:!![]);})[_0x6946('0x11')](function(_0x1eda8a){logger[_0x6946('0x2c')](_0x1eda8a);_0x378f81(null,![]);});};AGIVertices[_0x6946('0x12')]['agentLogin']=function(_0x4a6c39,_0x2c335a){var _0x3f29dd={'role':_0x6946('0x50')};_0x3f29dd[_0x4a6c39]=this[_0x6946('0x36')][_0x6946('0x3b')];var _0x31f9a1=_0x4a6c39!=_0x6946('0x53')?util[_0x6946('0x28')](_0x6946('0x54'),_0x6946('0x55'),this[_0x6946('0x36')][_0x6946('0x3b')]):undefined;this[_0x6946('0x17')][_0x6946('0x56')](_0x3f29dd,_0x31f9a1)[_0x6946('0x15')](function(_0x282ee6){_0x2c335a(null,_[_0x6946('0x44')](_0x282ee6)?![]:!![]);})[_0x6946('0x11')](function(_0x3c125b){logger[_0x6946('0x2c')](_0x3c125b);_0x2c335a(null,![]);});};AGIVertices[_0x6946('0x12')][_0x6946('0x57')]=function(_0x4da526,_0x54c7f9){sh[_0x6946('0x58')](_['trim'](_0x4da526),function(_0x3a76cc,_0x1d9e3a){var _0x1c7b7c=_0x1d9e3a[_0x6946('0x59')](/(\r\n|\n|\r)/gm,'');_0x54c7f9(null,_0x1c7b7c);});};AGIVertices['prototype'][_0x6946('0x5a')]=function(_0x1e17fc,_0x4f6adf){scripts[_0x6946('0x5a')](_0x1e17fc[_0x6946('0x5b')],_0x1e17fc[_0x6946('0x5c')]||_0x6946('0x5d'),_0x1e17fc[_0x6946('0x5d')],_0x1e17fc[_0x6946('0x5e')]||_0x6946('0x5f'),_0x1e17fc[_0x6946('0x60')]||_0x6946('0x61'),_0x1e17fc[_0x6946('0x62')]||_0x6946('0x63'))[_0x6946('0x15')](function(_0x3aed10){_0x4f6adf(null,_0x3aed10);})[_0x6946('0x11')](function(_0x4360b7){_0x4f6adf(_0x4360b7);});};AGIVertices[_0x6946('0x12')][_0x6946('0x64')]=function(_0x54f691,_0x49e71f){scripts[_0x6946('0x64')](_0x54f691['text'],_0x54f691['google_tts_language']||'en',0x1)['then'](function(_0x2888a8){_0x49e71f(null,_0x2888a8);})[_0x6946('0x11')](function(_0x17e3f5){_0x49e71f(_0x17e3f5);});};AGIVertices[_0x6946('0x12')]['restAPI']=function(_0x343bec,_0x3ac48e){var _0x6ab0ba={'uri':_0x343bec['url'],'method':_0x343bec['method'],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x343bec['timeout'])===_0x6946('0x65')&&parseInt(_0x343bec['timeout'])>=0x1?parseInt(_0x343bec[_0x6946('0x66')])*0x3e8:0x5*0x3e8};if(_[_0x6946('0x67')](['POST',_0x6946('0x68')],_0x6ab0ba['method']['toUpperCase']())){try{_0x6ab0ba['body']=_0x343bec[_0x6946('0xc')]?JSON[_0x6946('0x69')](_0x343bec['rawBody']):{};}catch(_0x3ad8ec){logger[_0x6946('0x2c')](_0x6946('0x6a'),_0x3ad8ec);}}try{_0x6ab0ba['headers']=_0x343bec[_0x6946('0x6b')]?JSON[_0x6946('0x69')](_0x343bec[_0x6946('0x6b')]):{};}catch(_0x978fef){logger['error'](_0x6946('0x6c'),_0x978fef);}if(_0x343bec[_0x6946('0x6d')]){try{var _0x23ef19=require(_0x343bec['computedVariables'])[_0x6946('0x6e')](this,_0x6ab0ba);_0x6ab0ba[_0x6946('0x6f')]=Mustache[_0x6946('0x70')](_0x343bec[_0x6946('0x71')],_0x23ef19,{},['$$','$$']);if(_0x6ab0ba['headers']){_0x6ab0ba[_0x6946('0x72')]=JSON['parse'](Mustache[_0x6946('0x70')](JSON[_0x6946('0x73')](_0x6ab0ba['headers']),_0x23ef19,{},['$$','$$']));}if(_0x6ab0ba[_0x6946('0x74')]){_0x6ab0ba[_0x6946('0x74')]=JSON[_0x6946('0x69')](Mustache[_0x6946('0x70')](JSON[_0x6946('0x73')](_0x6ab0ba[_0x6946('0x74')]),_0x23ef19,{},['$$','$$']));}}catch(_0x5941a2){logger[_0x6946('0x2c')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x5941a2);}}rp(_0x6ab0ba)['then'](function(_0x11113f){var _0x3b14c8={'statusCode':_0x11113f[_0x6946('0x75')]||0xc8,'statusMessage':_0x11113f[_0x6946('0x76')]||'OK','headers':_0x11113f[_0x6946('0x72')]||{},'body':_0x11113f[_0x6946('0x74')]||{}};_0x3ac48e(null,_0x3b14c8);})[_0x6946('0x11')](function(_0xe10b11){var _0xec075f={'statusCode':_0xe10b11[_0x6946('0x75')]||0x1f4,'statusMessage':_0xe10b11[_0x6946('0x77')]||_0x6946('0x78'),'headers':_0xe10b11['options'][_0x6946('0x72')]||{},'body':_0xe10b11['options'][_0x6946('0x74')]||{}};_0x3ac48e(null,_0xec075f);});};AGIVertices['prototype']['googleDialogflow']=function(_0x4a842d,_0x3e7202){scripts[_0x6946('0x79')](this[_0x6946('0x36')][_0x6946('0x37')],_0x4a842d[_0x6946('0x7a')],_0x4a842d[_0x6946('0x5d')],_0x4a842d[_0x6946('0x7b')]||'en')[_0x6946('0x15')](function(_0x4c7743){_0x3e7202(null,_0x4c7743);})[_0x6946('0x11')](function(_0x58720d){_0x3e7202(_0x58720d);});};AGIVertices[_0x6946('0x12')][_0x6946('0x7c')]=function(_0x2e512a,_0x3dd6c8){scripts[_0x6946('0x7c')](this[_0x6946('0x36')],_0x2e512a)[_0x6946('0x15')](function(_0x2fd218){_0x3dd6c8(null,_0x2fd218);})[_0x6946('0x11')](function(_0x401268){_0x3dd6c8(_0x401268);});};AGIVertices[_0x6946('0x12')][_0x6946('0x7d')]=function(_0x350b44,_0x54c9dd){scripts['ispeechTTS'](_0x350b44[_0x6946('0x7a')],_0x350b44['text'],_0x350b44[_0x6946('0x7e')]||_0x6946('0x5f'),_0x350b44[_0x6946('0x7f')])[_0x6946('0x15')](function(_0xc6e5b3){_0x54c9dd(null,_0xc6e5b3);})[_0x6946('0x11')](function(_0xf01fe6){_0x54c9dd(_0xf01fe6);});};AGIVertices[_0x6946('0x12')][_0x6946('0x80')]=function(_0x1244ad,_0x3cc6d8,_0x15c792){scripts[_0x6946('0x80')](_0x3cc6d8,_0x1244ad['key'],_0x1244ad[_0x6946('0x81')]||_0x6946('0x5f'),this[_0x6946('0x82')](_0x1244ad['model'])?_0x1244ad[_0x6946('0x83')]:undefined)[_0x6946('0x15')](function(_0x4a6f6b){_0x15c792(null,_0x4a6f6b);})[_0x6946('0x11')](function(_0x2b2637){_0x15c792(_0x2b2637);});};AGIVertices[_0x6946('0x12')][_0x6946('0x84')]=function(_0x25aa12,_0x17a08f){scripts[_0x6946('0x84')](_0x25aa12[_0x6946('0x85')],_0x25aa12[_0x6946('0x86')],_0x25aa12[_0x6946('0x87')],_0x25aa12[_0x6946('0x88')]||'Amy',_0x25aa12[_0x6946('0x5d')],_0x25aa12['aws_text_type']||_0x6946('0x5d'))[_0x6946('0x15')](function(_0xff8aae){_0x17a08f(null,_0xff8aae);})['catch'](function(_0x8ff25d){_0x17a08f(_0x8ff25d);});};AGIVertices['prototype']['awsLex']=function(_0x20d0e9,_0x3ce5e4){scripts[_0x6946('0x89')](this[_0x6946('0x36')][_0x6946('0x37')],_0x20d0e9[_0x6946('0x85')],_0x20d0e9[_0x6946('0x86')],_0x20d0e9['aws_lex_region'],_0x20d0e9[_0x6946('0x5d')],_0x20d0e9['aws_bot_name'])[_0x6946('0x15')](function(_0xd753e8){_0x3ce5e4(null,_0xd753e8);})[_0x6946('0x11')](function(_0x594dd7){_0x3ce5e4(_0x594dd7);});};AGIVertices['prototype'][_0x6946('0x8a')]=function(_0x398c95,_0x41f62,_0x369195){scripts[_0x6946('0x8a')](_0x41f62,_0x398c95['key'],_0x398c95[_0x6946('0x8b')]||_0x6946('0x5f'))[_0x6946('0x15')](function(_0x354ebc){_0x369195(null,_0x354ebc);})[_0x6946('0x11')](function(_0xfd6875){_0x369195(_0xfd6875);});};AGIVertices['prototype']['tildeASR']=function(_0x20703f,_0x28d21c,_0x399ea){scripts['tildeASR'](_0x28d21c,_0x20703f['appid'],_0x20703f[_0x6946('0x8c')],_0x20703f['uri'])[_0x6946('0x15')](function(_0x530575){_0x399ea(null,_0x530575);})[_0x6946('0x11')](function(_0x45ec73){_0x399ea(_0x45ec73);});};AGIVertices[_0x6946('0x12')][_0x6946('0x8d')]=function(_0x37828a){var _0x52ef5c=_[_0x6946('0x67')](verticesWithRetry,_0x37828a[_0x6946('0x8e')])?_0x37828a:_['clone'](_0x37828a);for(var _0x553fed in _0x52ef5c){if(_0x52ef5c['hasOwnProperty'](_0x553fed)){if(_0x52ef5c[_0x553fed]&&_[_0x6946('0x8f')](_0x52ef5c[_0x553fed])){if(_[_0x6946('0x67')](recursiveMapAttributes,_0x553fed)){_0x52ef5c[_0x553fed]=this[_0x6946('0x90')](_0x52ef5c[_0x553fed]);}else{_0x52ef5c[_0x553fed]=this[_0x6946('0x91')](_0x52ef5c[_0x553fed]);}}}}return _0x52ef5c;};AGIVertices['prototype'][_0x6946('0x92')]=function(_0x503e9b){for(var _0x5c3f59 in _0x503e9b){if(_0x503e9b[_0x6946('0x93')](_0x5c3f59)){if(_[_0x6946('0x94')](_0x503e9b[_0x5c3f59])){this['recursiveNodeIndex'](_0x503e9b[_0x5c3f59]);}else if(_['isArray'](_0x503e9b[_0x5c3f59])){for(var _0x42cc48=0x0;_0x42cc48<_0x503e9b[_0x5c3f59][_0x6946('0x95')];_0x42cc48++){this[_0x6946('0x92')](_0x503e9b[_0x5c3f59][_0x42cc48]);}}else if(_[_0x6946('0x8f')](_0x503e9b[_0x5c3f59])){_0x503e9b[_0x5c3f59]=this['replaceAllVariables'](_0x503e9b[_0x5c3f59]);}}}};AGIVertices[_0x6946('0x12')][_0x6946('0x96')]=function(_0x518241,_0x452301){for(var _0x474869 in _0x518241){if(_0x518241[_0x6946('0x93')](_0x474869)){if(_[_0x6946('0x94')](_0x518241[_0x474869])){if(!_[_0x6946('0x43')](_0x518241[_0x474869])){this[_0x6946('0x96')](_0x518241[_0x474869],util['format'](_0x6946('0x97'),_0x452301,_0x474869));}}else if(_[_0x6946('0x98')](_0x518241[_0x474869])){for(var _0xd4970a=0x0;_0xd4970a<_0x518241[_0x474869][_0x6946('0x95')];_0xd4970a++){this[_0x6946('0x96')](_0x518241[_0x474869][_0xd4970a],util['format']('%s.%s',_0x452301,_0x474869+'['+_0xd4970a+']'));}}else{if(!_[_0x6946('0x44')](_0x518241[_0x474869])){this['channel'][_0x6946('0x99')](util[_0x6946('0x28')](_0x6946('0x97'),_0x452301,_0x474869),_0x518241[_0x474869]);}}}}};AGIVertices[_0x6946('0x12')][_0x6946('0x90')]=function(_0x48b46e){try{var _0x4ad412=JSON['parse'](_0x48b46e);this['recursiveNodeIndex'](_0x4ad412);return JSON[_0x6946('0x73')](_0x4ad412);}catch(_0x264b80){return this[_0x6946('0x91')](_0x48b46e);}};AGIVertices['prototype'][_0x6946('0x91')]=function(_0x3e7aff){var _0x398406=_0x3e7aff['split']('{');for(var _0x44f248=0x1;_0x44f248<_0x398406[_0x6946('0x95')];_0x44f248+=0x1){var _0x1d1af=_0x398406[_0x44f248][_0x6946('0x9a')]('}');if(_0x1d1af[_0x6946('0x95')]>0x1){_0x3e7aff=_0x3e7aff['replaceAll']('{'+_0x1d1af[0x0]+'}',this[_0x6946('0x36')][_0x6946('0xf')](_0x1d1af[0x0])['extra']||_0x1d1af[0x0]);}}if(_0x398406[_0x6946('0x95')]===0x1){return _0x3e7aff[_0x6946('0x4c')]();}return this['replaceAllVariables'](_0x3e7aff);};AGIVertices[_0x6946('0x12')]['getAndSetVariable']=function(_0x210f0d,_0x27046a){var _0x13966d=this[_0x6946('0x36')][_0x6946('0xf')](_0x210f0d);if(_0x13966d['result']===-0x1){return _0x13966d;}logger[_0x6946('0x2e')](util['format']('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x27046a,_0x13966d['extra']));return this['channel']['setVariable'](_0x27046a,_0x13966d[_0x6946('0x9b')]);};AGIVertices['prototype'][_0x6946('0x82')]=function(_0x5f331b){return _0x5f331b&&_0x5f331b!=='0'&&_0x5f331b!=='-1'&&_0x5f331b!=='';};AGIVertices[_0x6946('0x12')][_0x6946('0x9c')]=function(_0x54cfac){this['createSquareDetailsReport'][_0x6946('0x6e')](this,_0x54cfac,'-');_0x54cfac[_0x6946('0x9d')]=_0x54cfac[_0x6946('0x9c')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype']['agi']=function(_0x1b232f){logger[_0x6946('0x2e')](util[_0x6946('0x28')](_0x6946('0x9e'),_0x1b232f[_0x6946('0x38')]));return this[_0x6946('0x36')][_0x6946('0x9')]([_0x1b232f[_0x6946('0x9f')],_0x1b232f[_0x6946('0xa0')]]);};AGIVertices[_0x6946('0x12')]['answer']=function(_0x286d93){logger['info'](util[_0x6946('0x28')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x286d93['label']));if(this[_0x6946('0x82')](_0x286d93[_0x6946('0x66')])){logger['info'](util[_0x6946('0x28')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x286d93[_0x6946('0x66')]));var _0x50bb73=this[_0x6946('0x36')][_0x6946('0xa1')](_0x286d93['timeout']);if(_0x50bb73[_0x6946('0xa2')]===-0x1){return _0x50bb73;}}return this[_0x6946('0x36')][_0x6946('0xa3')]();};AGIVertices[_0x6946('0x12')][_0x6946('0x4b')]=function(_0x454815){logger['info'](util[_0x6946('0x28')](_0x6946('0xa4'),_0x454815[_0x6946('0x38')]));if(!this[_0x6946('0x82')](_0x454815['list_id'])){return this[_0x6946('0x36')]['error'](_0x454815,_0x6946('0xa5'));}_0x454815[_0x6946('0x4a')]=moment();if(this[_0x6946('0x82')](_0x454815['delay'])){_0x454815[_0x6946('0x4a')]=moment()[_0x6946('0xa6')](_0x454815['delay'],_0x6946('0xa7'));}if(!this['isConfigured'](_0x454815[_0x6946('0x4d')])){_0x454815[_0x6946('0x4d')]=0x2;}this[_0x6946('0x42')][_0x6946('0x6e')](this,_0x454815);return this['channel'][_0x6946('0xa8')](util[_0x6946('0x28')](_0x6946('0xa9'),_0x454815['phone'],_0x454815['list_id'],_0x454815[_0x6946('0x4a')]));};AGIVertices[_0x6946('0x12')][_0x6946('0xaa')]=function(_0xd18277){logger['info'](util[_0x6946('0x28')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0xd18277[_0x6946('0x38')]));var _0x5174d3=this[_0x6946('0x36')]['exec'](_0xd18277[_0x6946('0xab')],_0xd18277[_0x6946('0xac')]);if(_0x5174d3[_0x6946('0xa2')]===-0x1){return _0x5174d3;}return this[_0x6946('0x36')]['noop'](util['format']('Executed\x20command\x20%s\x20%s',_0xd18277[_0x6946('0xab')],_0xd18277[_0x6946('0xac')]));};AGIVertices[_0x6946('0x12')][_0x6946('0xad')]=function(_0x4b1fa5){logger[_0x6946('0x2e')](util[_0x6946('0x28')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x4b1fa5[_0x6946('0x38')]));if(!this[_0x6946('0x82')](_0x4b1fa5[_0x6946('0x5d')])){return this[_0x6946('0x36')][_0x6946('0xa8')](_0x6946('0xae'));}var _0x15e49b='\x22'+_0x4b1fa5[_0x6946('0x5d')]+'\x22';if(this['isConfigured'](_0x4b1fa5[_0x6946('0xac')])){_0x15e49b+=','+_0x4b1fa5['options'];}var _0x46f977=this[_0x6946('0x36')][_0x6946('0x58')]('MRCPSynth',_0x15e49b);if(_0x46f977[_0x6946('0xa2')]===-0x1){return _0x46f977;}return this['channel'][_0x6946('0xa8')](util[_0x6946('0x28')]('Executed\x20command\x20MRCPSynth\x20%s',_0x15e49b));};AGIVertices[_0x6946('0x12')][_0x6946('0xaf')]=function(_0x201ec1){logger[_0x6946('0x2e')](util[_0x6946('0x28')](_0x6946('0xb0'),_0x201ec1[_0x6946('0x38')]));if(!this[_0x6946('0x82')](_0x201ec1['text'])){return this[_0x6946('0x36')][_0x6946('0xa8')](_0x6946('0xae'));}var _0x24f9f6='\x22'+_0x201ec1[_0x6946('0x5d')]+'\x22';if(this[_0x6946('0x82')](_0x201ec1[_0x6946('0xac')])){_0x24f9f6+=','+_0x201ec1[_0x6946('0xac')];}var _0x388b1b=this[_0x6946('0x36')][_0x6946('0x58')](_0x6946('0xb1'),_0x24f9f6);if(_0x388b1b[_0x6946('0xa2')]===-0x1){return _0x388b1b;}return this['channel'][_0x6946('0xa8')](util[_0x6946('0x28')]('Executed\x20command\x20MRCPSynth\x20%s',_0x24f9f6));};AGIVertices[_0x6946('0x12')][_0x6946('0xb2')]=function(_0x4f0f6f){logger[_0x6946('0x2e')](util[_0x6946('0x28')](_0x6946('0xb3'),_0x4f0f6f[_0x6946('0x38')]));if(!this[_0x6946('0x82')](_0x4f0f6f['grammar'])){return this['channel'][_0x6946('0xa8')]('no\x20grammar\x20configured');}var _0x964870=_0x4f0f6f[_0x6946('0xb4')];if(this['isConfigured'](_0x4f0f6f[_0x6946('0xac')])){_0x964870+=','+_0x4f0f6f[_0x6946('0xac')];}var _0xb42771=this['channel'][_0x6946('0x58')]('MRCPRecog',_0x964870);if(_0xb42771[_0x6946('0xa2')]===-0x1){return _0xb42771;}var _0x169bf1=this[_0x6946('0xb5')]('RECOG_CONFIDENCE()',_0x6946('0xb6'));if(_0x169bf1[_0x6946('0xa2')]===-0x1){return _0x169bf1;}var _0x3fc29c=this['getAndSetVariable']('RECOG_INPUT()',_0x6946('0xb7'));if(_0x3fc29c['result']===-0x1){return _0x3fc29c;}var _0x4ca1b4=this[_0x6946('0xb5')](_0x6946('0xb8'),_0x6946('0xb9'));if(_0x4ca1b4[_0x6946('0xa2')]===-0x1){return _0x4ca1b4;}return this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')]('Executed\x20command\x20MRCPRecog\x20%s',_0x964870));};AGIVertices[_0x6946('0x12')][_0x6946('0xba')]=function(_0x1464ff){logger[_0x6946('0x2e')](util[_0x6946('0x28')](_0x6946('0xbb'),_0x1464ff[_0x6946('0x38')]));if(!this['isConfigured'](_0x1464ff[_0x6946('0xb4')])){return this[_0x6946('0x36')][_0x6946('0xa8')](_0x6946('0xbc'));}var _0x1b8e5c=_0x1464ff[_0x6946('0xb4')];if(this[_0x6946('0x82')](_0x1464ff[_0x6946('0xac')])){_0x1b8e5c+=','+_0x1464ff[_0x6946('0xac')];}var _0x1afb62=this[_0x6946('0x36')]['exec'](_0x6946('0xbd'),_0x1b8e5c);if(_0x1afb62['result']===-0x1){return _0x1afb62;}var _0x28b657=this[_0x6946('0xb5')](_0x6946('0xbe'),_0x6946('0xbf'));if(_0x28b657['result']===-0x1){return _0x28b657;}var _0x8878a4=this[_0x6946('0xb5')](_0x6946('0xc0'),_0x6946('0xc1'));if(_0x8878a4[_0x6946('0xa2')]===-0x1){return _0x8878a4;}var _0x2344b7=this[_0x6946('0xb5')](_0x6946('0xb8'),_0x6946('0xc2'));if(_0x2344b7[_0x6946('0xa2')]===-0x1){return _0x2344b7;}return this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')]('Executed\x20command\x20MRCPRecog\x20%s',_0x1b8e5c));};AGIVertices[_0x6946('0x12')][_0x6946('0xc3')]=function(_0x21c2e0){logger[_0x6946('0x2e')](util[_0x6946('0x28')](_0x6946('0xc4'),_0x21c2e0[_0x6946('0x38')]));if(!this[_0x6946('0x82')](_0x21c2e0[_0x6946('0xc5')])){return this['channel']['error'](_0x21c2e0,_0x6946('0xc6'));}var _0x413c73=this[_0x6946('0x19')]['sync'](this,_0x21c2e0[_0x6946('0xc5')]);if(!_0x413c73){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x21c2e0,_0x6946('0xc7'));}if(!this['isConfigured'](_0x21c2e0[_0x6946('0x30')])){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x21c2e0,_0x6946('0xc8'));}var _0x456c71=_0x21c2e0[_0x6946('0x30')][_0x6946('0x59')](/(\r\n|\n|\r)/gm,'\x20');this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')](_0x6946('0xc9'),_0x456c71));var _0x2cc4bf=this['getQueryOdbc'][_0x6946('0x6e')](this,_0x413c73,_0x456c71);this[_0x6946('0x35')]['sync'](this,_0x21c2e0,_0x456c71);if(!this[_0x6946('0x82')](_0x21c2e0[_0x6946('0xca')])){return this[_0x6946('0x36')][_0x6946('0xa8')](_0x6946('0xcb'));}var _0x2da2aa=this[_0x6946('0xf')][_0x6946('0x6e')](this,_0x21c2e0[_0x6946('0xca')]);if(!_0x2da2aa){return this['channel'][_0x6946('0x2c')](_0x21c2e0,_0x6946('0xcc'));}var _0x4a7fc2=this;_0x2cc4bf[_0x6946('0xcd')](function(_0x106750,_0x21a48c){Object[_0x6946('0xce')](_0x106750)[_0x6946('0xcd')](function(_0x5dd422){_0x4a7fc2[_0x6946('0x36')][_0x6946('0x99')](util['format'](_0x6946('0xcf'),_0x2da2aa,_0x21a48c,_0x5dd422),_0x106750[_0x5dd422]);});});this[_0x6946('0x36')][_0x6946('0x99')](util[_0x6946('0x28')]('%s_ROWS_COUNT',_0x2da2aa),_0x2cc4bf['length']);return this[_0x6946('0x36')]['noop'](util['format'](_0x6946('0xd0'),_0x2da2aa));};AGIVertices[_0x6946('0x12')][_0x6946('0xd1')]=function(_0x92203f){logger[_0x6946('0xd2')](util[_0x6946('0x28')](_0x6946('0xd3'),_0x92203f[_0x6946('0x38')]));if(!this[_0x6946('0x82')](_0x92203f['sip_id'])){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x92203f,'no\x20user\x20selected');}var _0x2e3418=this['getUser'][_0x6946('0x6e')](this,_0x92203f[_0x6946('0xd4')]);if(!_0x2e3418){return this['channel'][_0x6946('0x2c')](_0x92203f,_0x6946('0xd5'));}var _0x3a43b7=this[_0x6946('0x36')][_0x6946('0x58')](_0x6946('0xd6'),[util[_0x6946('0x28')]('SIP/%s',_0x2e3418),_0x92203f[_0x6946('0x66')],_0x92203f['opts'],_0x92203f[_0x6946('0x71')]]);if(_0x3a43b7[_0x6946('0xa2')]===-0x1){return _0x3a43b7;}return this['channel'][_0x6946('0xa8')](util['format'](_0x6946('0xd7'),'DIAL'));};AGIVertices['prototype']['dialogflow']=function(_0x38695d){logger[_0x6946('0x2e')](util[_0x6946('0x28')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x38695d[_0x6946('0x38')]));if(!this[_0x6946('0x82')](_0x38695d['key'])){return this['channel']['noop'](_0x6946('0xd8'));}if(!this['isConfigured'](_0x38695d[_0x6946('0x5d')])){return this[_0x6946('0x36')][_0x6946('0xa8')](_0x6946('0xae'));}this[_0x6946('0x36')][_0x6946('0xd9')]=!![];this[_0x6946('0x35')](_0x38695d);this[_0x6946('0x41')](_0x38695d[_0x6946('0x5d')],'in');this[_0x6946('0x36')][_0x6946('0xa8')](util['format'](_0x6946('0xda'),_0x38695d['text']));var _0x36b35b=this[_0x6946('0x79')][_0x6946('0x6e')](this,_0x38695d);if(_0x36b35b){for(var _0x13c17c in _0x36b35b){if(_0x36b35b[_0x6946('0x93')](_0x13c17c)){this['channel'][_0x6946('0x99')](util['format'](_0x6946('0xdb'),_0x13c17c[_0x6946('0xdc')]()),_0x36b35b[_0x13c17c]);}}this[_0x6946('0x41')](_0x36b35b[_0x6946('0xdd')],_0x6946('0xde'));return this['channel'][_0x6946('0xa8')](util[_0x6946('0x28')](_0x6946('0xdf'),_0x36b35b['speech']));}return this['channel']['error'](_0x38695d,_0x6946('0xe0'));};AGIVertices[_0x6946('0x12')][_0x6946('0xe1')]=function(_0x4e4d70){logger[_0x6946('0x2e')](util['format'](_0x6946('0xe2'),_0x4e4d70[_0x6946('0x38')]));if(!this[_0x6946('0x82')](_0x4e4d70[_0x6946('0xe3')])){return this[_0x6946('0x36')][_0x6946('0xa8')](_0x6946('0xe4'));}if(!this[_0x6946('0x82')](_0x4e4d70['username'])){return this[_0x6946('0x36')][_0x6946('0xa8')](_0x6946('0xe5'));}if(!this[_0x6946('0x82')](_0x4e4d70['password'])){return this[_0x6946('0x36')][_0x6946('0xa8')]('no\x20password\x20configured');}if(!this[_0x6946('0x82')](_0x4e4d70[_0x6946('0xe6')])){return this[_0x6946('0x36')][_0x6946('0xa8')]('no\x20text\x20configured');}this[_0x6946('0x36')][_0x6946('0xd9')]=!![];this[_0x6946('0x35')](_0x4e4d70);this['createSquareMessage'](_0x4e4d70[_0x6946('0x5d')],'in');this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')](_0x6946('0xe7'),_0x4e4d70[_0x6946('0x5d')]));var _0x42ef73=this[_0x6946('0x7c')]['sync'](this,_0x4e4d70);if(_0x42ef73){for(var _0xfab6a4 in _0x42ef73){if(_0x42ef73['hasOwnProperty'](_0xfab6a4)){this[_0x6946('0x36')][_0x6946('0x99')](util[_0x6946('0x28')](_0x6946('0xe8'),_0xfab6a4['toUpperCase']()),_0x42ef73[_0xfab6a4]);}}this[_0x6946('0x41')](_0x42ef73['speech'],'out');if(_0x42ef73[_0x6946('0xe9')]){this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')](_0x6946('0xea'),_0x42ef73['audiofile']));var _0x2840e7=this['channel'][_0x6946('0xeb')](_0x42ef73[_0x6946('0xe9')]);try{fs[_0x6946('0xec')](_0x42ef73[_0x6946('0xe9')]+'.wav');}catch(_0xcc74d5){logger[_0x6946('0x2c')](_0xcc74d5);}return _0x2840e7;}else{return this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')](_0x6946('0xed'),_0x42ef73[_0x6946('0xdd')]));}}return this[_0x6946('0x36')][_0x6946('0x2c')](_0x4e4d70,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x6946('0x12')]['end']=function(_0x11d75b){logger[_0x6946('0x2e')](util[_0x6946('0x28')](_0x6946('0xee'),_0x11d75b[_0x6946('0x38')]));return this[_0x6946('0x36')][_0x6946('0xa8')](_0x6946('0xef'));};AGIVertices[_0x6946('0x12')][_0x6946('0xf0')]=function(_0x4a9be6){logger[_0x6946('0x2e')](util[_0x6946('0x28')](_0x6946('0xf1'),_0x4a9be6[_0x6946('0x38')]));var _0x2208ca='';if(_0x4a9be6[_0x6946('0xf2')]){if(!this[_0x6946('0x82')](_0x4a9be6[_0x6946('0xf2')])){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x4a9be6,'no\x20trunk\x20selected');}else{var _0x5c7468=parseInt(_0x4a9be6[_0x6946('0xf2')],0xa);if(isNaN(_0x5c7468)){_0x2208ca=_0x4a9be6[_0x6946('0xf2')];}else{_0x2208ca=this[_0x6946('0x1d')][_0x6946('0x6e')](this,_0x4a9be6[_0x6946('0xf2')]);if(!_0x2208ca){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x4a9be6,_0x6946('0xf3'));}}}}else if(_0x4a9be6[_0x6946('0xf4')]){_0x2208ca=_0x4a9be6[_0x6946('0xf4')];}else{return this['channel'][_0x6946('0x2c')](_0x4a9be6,_0x6946('0xf5'));}var _0x5a3758=this['channel']['exec'](_0x6946('0xd6'),[util['format'](_0x6946('0xf6'),_0x2208ca,_0x4a9be6[_0x6946('0x48')]),_0x4a9be6[_0x6946('0x66')],_0x4a9be6[_0x6946('0xf7')],_0x4a9be6[_0x6946('0x71')]]);if(_0x5a3758[_0x6946('0xa2')]===-0x1){return _0x5a3758;}return this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')](_0x6946('0xd7'),_0x6946('0xd6')));};AGIVertices[_0x6946('0x12')][_0x6946('0xf8')]=function(_0x55a8f4){logger['info'](util[_0x6946('0x28')](_0x6946('0xf9'),_0x55a8f4['label']));return this[_0x6946('0x36')][_0x6946('0xa8')](_0x6946('0xf8'));};AGIVertices['prototype'][_0x6946('0xd')]=function(_0x2e3085){logger['info'](util['format'](_0x6946('0xfa'),_0x2e3085[_0x6946('0x38')]));if(_0x2e3085[_0x6946('0x9d')]===0x0){return this[_0x6946('0x9c')](_0x2e3085);}_0x2e3085[_0x6946('0x9d')]-=0x1;if(!this[_0x6946('0x82')](_0x2e3085[_0x6946('0xfb')])){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x2e3085,_0x6946('0xfc'));}var _0x5474b4=this[_0x6946('0x1f')][_0x6946('0x6e')](this,_0x2e3085[_0x6946('0xfb')]);if(!_0x5474b4){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x2e3085,'no\x20file\x20audio\x20found');}if(!this[_0x6946('0x82')](_0x2e3085[_0x6946('0xca')])){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x6946('0xcb'));}var _0xc693e=this[_0x6946('0x36')][_0x6946('0xfd')](_0x5474b4,_0x2e3085['response'],_0x2e3085[_0x6946('0xfe')]);var _0x2d8dbc=_0xc693e[_0x6946('0xa2')]?_0xc693e[_0x6946('0xa2')]['toString']():'';logger[_0x6946('0x2e')](_0x6946('0xff'),JSON[_0x6946('0x73')](_0xc693e));if(_0xc693e['result']===-0x1){this[_0x6946('0x35')][_0x6946('0x6e')](this,_0x2e3085,_0x2d8dbc);return _0xc693e;}else if(_0xc693e['extra']===_0x6946('0x66')){_0xc693e['result']=_0x2d8dbc[_0x6946('0x95')]>=parseInt(_0x2e3085[_0x6946('0x100')])?'x':'i';}else{_0xc693e['result']=_0x2d8dbc[_0x6946('0x95')]>=parseInt(_0x2e3085[_0x6946('0x100')])&&_0x2d8dbc['length']<=parseInt(_0x2e3085[_0x6946('0xfe')])?'x':'i';}var _0x23c0f2=this[_0x6946('0xf')][_0x6946('0x6e')](this,_0x2e3085['variable_id']);if(!_0x23c0f2){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x2e3085,'no\x20variable\x20found');}this[_0x6946('0x36')][_0x6946('0x99')](_0x23c0f2,_0x2d8dbc);if(this['isConfigured'](_0x2e3085[_0x6946('0x101')])){var _0x9e6ac1=parseInt(_0x2e3085[_0x6946('0x101')],0xa);var _0x3dbc92=rs[_0x6946('0x102')]({'charset':'*','length':_0x9e6ac1});var _0x330947=_0x2d8dbc[_0x6946('0x95')];if(_0x330947>0x0){if(_0x330947>_0x9e6ac1){this['createSquareDetailsReport']['sync'](this,_0x2e3085,_0x2e3085['hiddendigitspos']===_0x6946('0x103')?_0x3dbc92+_0x2d8dbc['substr'](_0x9e6ac1):_0x2d8dbc[_0x6946('0x104')](0x0,_0x330947-_0x9e6ac1)+_0x3dbc92);}else{this[_0x6946('0x35')][_0x6946('0x6e')](this,_0x2e3085,rs[_0x6946('0x102')]({'charset':'*','length':_0x330947}));}}else{this[_0x6946('0x35')][_0x6946('0x6e')](this,_0x2e3085,'');}}else{this[_0x6946('0x35')][_0x6946('0x6e')](this,_0x2e3085,_0x2d8dbc);}return _0xc693e;};AGIVertices[_0x6946('0x12')]['getsecretdigits']=function(_0x4a7cf8){logger[_0x6946('0x2e')](util[_0x6946('0x28')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x4a7cf8[_0x6946('0x38')]));return this['getdigits'](_0x4a7cf8);};AGIVertices[_0x6946('0x12')]['goal']=function(_0x31610f){logger['info'](util[_0x6946('0x28')](_0x6946('0x105'),_0x31610f[_0x6946('0x38')]));this['createSquareDetailsReport'][_0x6946('0x6e')](this,_0x31610f,_0x31610f[_0x6946('0x106')]);return this[_0x6946('0x36')]['noop'](util[_0x6946('0x28')](_0x6946('0x107'),_0x31610f[_0x6946('0x106')]));};AGIVertices[_0x6946('0x12')][_0x6946('0x108')]=function(_0x38ffb6){logger[_0x6946('0x2e')](util[_0x6946('0x28')](_0x6946('0x109'),_0x38ffb6['label']));if(!this[_0x6946('0x82')](_0x38ffb6[_0x6946('0x85')])||!this['isConfigured'](_0x38ffb6[_0x6946('0x86')])){return this['channel']['noop'](_0x6946('0x10a'));}if(!this[_0x6946('0x82')](_0x38ffb6[_0x6946('0x5d')])){return this[_0x6946('0x36')][_0x6946('0xa8')](_0x6946('0xae'));}this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')](_0x6946('0x10b'),_0x38ffb6[_0x6946('0x5d')]));var _0x131d57=this[_0x6946('0x84')][_0x6946('0x6e')](this,_0x38ffb6);if(_0x131d57){this[_0x6946('0x36')]['noop'](util[_0x6946('0x28')]('aws\x20Polly\x20%s\x20file\x20created',_0x131d57));var _0x39d4a8=this[_0x6946('0x36')]['streamFile'](_0x131d57);try{fs['unlink'](_0x131d57+_0x6946('0x10c'));}catch(_0x456f22){logger[_0x6946('0x2c')](_0x456f22);}return _0x39d4a8;}return this[_0x6946('0x36')][_0x6946('0x2c')](_0x38ffb6,'aws\x20Polly\x20is\x20unreachable');};AGIVertices['prototype'][_0x6946('0x10d')]=function(_0x5f0c84){logger[_0x6946('0x2e')](util[_0x6946('0x28')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x5f0c84['label']));if(!this[_0x6946('0x82')](_0x5f0c84[_0x6946('0x85')])||!this[_0x6946('0x82')](_0x5f0c84[_0x6946('0x86')])){return this[_0x6946('0x36')][_0x6946('0xa8')](_0x6946('0x10a'));}if(!this[_0x6946('0x82')](_0x5f0c84[_0x6946('0x10e')])){return this[_0x6946('0x36')][_0x6946('0xa8')](_0x6946('0x10f'));}if(!this[_0x6946('0x82')](_0x5f0c84[_0x6946('0x5d')])){return this[_0x6946('0x36')][_0x6946('0xa8')]('no\x20text\x20configured');}this['channel']['bot']=!![];this[_0x6946('0x35')](_0x5f0c84);this[_0x6946('0x41')](_0x5f0c84[_0x6946('0x5d')],'in');this[_0x6946('0x36')]['noop'](util[_0x6946('0x28')](_0x6946('0x110'),_0x5f0c84[_0x6946('0x5d')]));var _0x2e8da9=this[_0x6946('0x89')][_0x6946('0x6e')](this,_0x5f0c84);if(_0x2e8da9){for(var _0x30cd03 in _0x2e8da9){if(_0x2e8da9[_0x6946('0x93')](_0x30cd03)&&_[_0x6946('0x8f')](_0x2e8da9[_0x30cd03])){this[_0x6946('0x36')][_0x6946('0x99')](util[_0x6946('0x28')](_0x6946('0x111'),_0x30cd03['toUpperCase']()),_0x2e8da9[_0x30cd03]);}}if(_[_0x6946('0x44')](_0x2e8da9[_0x6946('0x77')])){return this[_0x6946('0x36')]['noop'](_0x6946('0x112'));}else{this[_0x6946('0x41')](_0x2e8da9[_0x6946('0x77')],_0x6946('0xde'));return this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')](_0x6946('0x113'),_0x2e8da9[_0x6946('0x77')]));}}return this[_0x6946('0x36')][_0x6946('0x2c')](_0x5f0c84,_0x6946('0x114'));};AGIVertices[_0x6946('0x12')][_0x6946('0x115')]=function(_0x252ec1){logger['info'](util['format'](_0x6946('0x116'),_0x252ec1['label'],_0x252ec1[_0x6946('0x66')]));if(!this[_0x6946('0x82')](_0x252ec1[_0x6946('0x7a')])){return this['channel']['noop'](_0x6946('0xd8'));}var _0x1f5dc9=_0x6946('0x117');var _0x3ddcf7=util['format']('%s/recordings/%s',FILES_PATH,rs[_0x6946('0x102')](0x4));var _0x24a23f=util[_0x6946('0x28')]('%s.%s',_0x3ddcf7,_0x1f5dc9);var _0x45ffca=!![];if(_0x252ec1[_0x6946('0x118')]===_0x6946('0x119')){_0x45ffca=![];}var _0x49f8c8=this['channel']['recordFile'](_0x3ddcf7,_0x1f5dc9,_0x252ec1[_0x6946('0x11a')],_0x252ec1[_0x6946('0x66')],undefined,_0x45ffca);if(_0x49f8c8[_0x6946('0xa2')]!==-0x1){this[_0x6946('0x36')]['noop'](util[_0x6946('0x28')](_0x6946('0x11b'),_0x24a23f));var _0x18032a=this[_0x6946('0x8a')][_0x6946('0x6e')](this,_0x252ec1,_0x24a23f);if(_0x18032a){for(var _0xd2076 in _0x18032a){if(_0x18032a[_0x6946('0x93')](_0xd2076)){this['channel'][_0x6946('0x99')](util[_0x6946('0x28')]('GOOGLE_ASR_%s',_0xd2076[_0x6946('0xdc')]()),_0x18032a[_0xd2076]);}}return this[_0x6946('0x36')]['noop'](util['format'](_0x6946('0x11c'),JSON['stringify'](_0x18032a)));}}return _0x49f8c8;};AGIVertices[_0x6946('0x12')][_0x6946('0x11d')]=function(_0x1bc6b8){logger[_0x6946('0x2e')](util[_0x6946('0x28')](_0x6946('0x11e'),_0x1bc6b8['label']));if(!this[_0x6946('0x82')](_0x1bc6b8['appid'])){return this[_0x6946('0x36')][_0x6946('0xa8')](_0x6946('0x11f'));}if(!this[_0x6946('0x82')](_0x1bc6b8[_0x6946('0x8c')])){return this[_0x6946('0x36')][_0x6946('0xa8')](_0x6946('0x120'));}var _0x3ef4a6=_0x6946('0x117');var _0x505315=util['format'](_0x6946('0x121'),FILES_PATH,rs[_0x6946('0x102')](0x4));var _0x57018f=util[_0x6946('0x28')](_0x6946('0x97'),_0x505315,_0x3ef4a6);var _0x36ee4c=!![];if(_0x1bc6b8[_0x6946('0x118')]===_0x6946('0x119')){_0x36ee4c=![];}var _0x14085c=this['channel'][_0x6946('0x122')](_0x505315,_0x3ef4a6,_0x1bc6b8[_0x6946('0x11a')],_0x1bc6b8['timeout'],undefined,_0x36ee4c);if(_0x14085c['result']!==-0x1){this[_0x6946('0x36')]['noop'](util[_0x6946('0x28')]('tilde\x20%s\x20file\x20created',_0x57018f));var _0x2586be=this[_0x6946('0x123')]['sync'](this,_0x1bc6b8,_0x57018f);if(_0x2586be){for(var _0x5e3825 in _0x2586be){if(_0x2586be[_0x6946('0x93')](_0x5e3825)){this[_0x6946('0x36')][_0x6946('0x99')](util['format'](_0x6946('0x124'),_0x5e3825[_0x6946('0xdc')]()),_0x2586be[_0x5e3825]);}}return this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')](_0x6946('0x125'),JSON[_0x6946('0x73')](_0x2586be)));}}return _0x14085c;};AGIVertices[_0x6946('0x12')][_0x6946('0x126')]=function(_0x3a9983){logger[_0x6946('0x2e')](util['format']('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x3a9983[_0x6946('0x38')]));return this[_0x6946('0x36')][_0x6946('0x127')](_0x3a9983[_0x6946('0x3d')],_0x3a9983['extension'],_0x3a9983[_0x6946('0x128')]);};AGIVertices[_0x6946('0x12')][_0x6946('0x129')]=function(_0x1025b6){logger[_0x6946('0x2e')](util[_0x6946('0x28')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x1025b6[_0x6946('0x38')]));if(!this[_0x6946('0x82')](_0x1025b6[_0x6946('0x12a')])){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x1025b6,_0x6946('0x12b'));}try{var _0x1e4ad1=eval(_0x1025b6[_0x6946('0x12a')])?'true':_0x6946('0x12c');this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')](_0x6946('0x12d'),_0x1025b6[_0x6946('0x12a')],_0x1e4ad1));return{'code':0xc8,'result':_0x1e4ad1};}catch(_0x26a7dd){return{'code':0xc8,'result':_0x6946('0x12c')};}};AGIVertices[_0x6946('0x12')]['gotoiftime']=function(_0x3a2780){logger[_0x6946('0x2e')](util['format'](_0x6946('0x12e'),_0x3a2780[_0x6946('0x38')]));if(!this[_0x6946('0x82')](_0x3a2780[_0x6946('0x12f')])){return this['channel'][_0x6946('0x2c')](_0x3a2780,'no\x20interval\x20configured');}var _0x319251=this[_0x6946('0x24')][_0x6946('0x6e')](this,_0x3a2780['interval_id']);if(!_0x319251){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x3a2780,_0x6946('0x130'));}for(var _0x57a6b3=0x0;_0x57a6b3<_0x319251[_0x6946('0x95')];_0x57a6b3+=0x1){var _0x56e0bd=this['channel'][_0x6946('0xf')](util[_0x6946('0x28')](_0x6946('0x131'),_0x319251[_0x57a6b3]));if(_0x56e0bd[_0x6946('0xa2')]===-0x1){return _0x56e0bd;}logger[_0x6946('0x2e')](util[_0x6946('0x28')]('IFTIME\x20%s\x20%s',_0x319251[_0x57a6b3],_0x56e0bd['extra']));if(_0x56e0bd[_0x6946('0x9b')]==='true'){logger[_0x6946('0x2e')](util[_0x6946('0x28')]('IFTIME\x20%s\x20%s',_0x319251[_0x57a6b3],_0x6946('0x132')));this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')](_0x6946('0x133'),_0x319251[_0x57a6b3],_0x6946('0x132')));return{'code':0xc8,'result':'true'};}else{logger[_0x6946('0x2e')](util[_0x6946('0x28')](_0x6946('0x133'),_0x319251[_0x57a6b3],_0x6946('0x12c')));this[_0x6946('0x36')]['noop'](util[_0x6946('0x28')](_0x6946('0x133'),_0x319251[_0x57a6b3],'false'));}}return{'code':0xc8,'result':_0x6946('0x12c')};};AGIVertices[_0x6946('0x12')][_0x6946('0x134')]=function(_0x139902){logger['info'](util[_0x6946('0x28')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x139902[_0x6946('0x38')]));return this[_0x6946('0x36')][_0x6946('0x134')]();};AGIVertices[_0x6946('0x12')][_0x6946('0x135')]=function(_0x4fe6d4){logger[_0x6946('0x2e')](util[_0x6946('0x28')](_0x6946('0x136'),_0x4fe6d4['label']));if(!this[_0x6946('0x82')](_0x4fe6d4[_0x6946('0x7a')])){return this[_0x6946('0x36')][_0x6946('0xa8')](_0x6946('0xd8'));}var _0x774564=_0x6946('0x117');var _0x5736e9=util[_0x6946('0x28')](_0x6946('0x121'),FILES_PATH,rs[_0x6946('0x102')](0x4));var _0x439e85=util[_0x6946('0x28')](_0x6946('0x97'),_0x5736e9,_0x774564);var _0x154ab7=!![];if(_0x4fe6d4[_0x6946('0x118')]==='NOBEEP'){_0x154ab7=![];}var _0xc85843=this['channel'][_0x6946('0x122')](_0x5736e9,_0x774564,_0x4fe6d4[_0x6946('0x11a')],_0x4fe6d4[_0x6946('0x66')],undefined,_0x154ab7);if(_0xc85843[_0x6946('0xa2')]!==-0x1){this[_0x6946('0x36')][_0x6946('0xa8')](util['format'](_0x6946('0x137'),_0x439e85));var _0x4f438a=this[_0x6946('0x80')][_0x6946('0x6e')](this,_0x4fe6d4,_0x439e85);if(_0x4f438a){for(var _0x5e0a66 in _0x4f438a){if(_0x4f438a[_0x6946('0x93')](_0x5e0a66)){this[_0x6946('0x36')][_0x6946('0x99')](util[_0x6946('0x28')](_0x6946('0x138'),_0x5e0a66['toUpperCase']()),_0x4f438a[_0x5e0a66]);}}return this[_0x6946('0x36')]['noop'](util[_0x6946('0x28')](_0x6946('0x139'),JSON[_0x6946('0x73')](_0x4f438a)));}}return _0xc85843;};AGIVertices[_0x6946('0x12')][_0x6946('0x13a')]=function(_0x43118f){logger['info'](util['format'](_0x6946('0x13b'),_0x43118f[_0x6946('0x38')]));if(!this[_0x6946('0x82')](_0x43118f['key'])){return this['channel'][_0x6946('0xa8')](_0x6946('0xd8'));}if(!this[_0x6946('0x82')](_0x43118f['text'])){return this['channel']['noop']('no\x20text\x20configured');}this['channel'][_0x6946('0xa8')](util[_0x6946('0x28')](_0x6946('0x13c'),_0x43118f['text']));var _0x416e5f=this[_0x6946('0x7d')]['sync'](this,_0x43118f);if(_0x416e5f){this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')](_0x6946('0x137'),_0x416e5f));var _0x4af08f=this[_0x6946('0x36')][_0x6946('0xeb')](_0x416e5f,_0x43118f[_0x6946('0x11a')]);try{fs[_0x6946('0xec')](_0x416e5f+_0x6946('0x10c'));}catch(_0x113d7e){logger[_0x6946('0x2c')](_0x113d7e);}return _0x4af08f;}return this[_0x6946('0x36')]['error'](_0x43118f,_0x6946('0x13d'));};AGIVertices['prototype'][_0x6946('0x13e')]=function(_0x14e2c4){logger['info'](util['format']('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x14e2c4['label']));if(!this['isConfigured'](_0x14e2c4[_0x6946('0x13f')])){return this['channel'][_0x6946('0x2c')](_0x14e2c4,'no\x20find\x20by\x20configured');}logger[_0x6946('0x2e')](util[_0x6946('0x28')](_0x6946('0x140'),this['channel']['callerid'],_0x14e2c4[_0x6946('0x13f')]));var _0x405e93=this['agentLogin'][_0x6946('0x6e')](this,_0x14e2c4['findBy']);if(_0x405e93){logger[_0x6946('0x2e')](util[_0x6946('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x6946('0x36')][_0x6946('0x3b')],_0x14e2c4[_0x6946('0x13f')]));this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')](_0x6946('0x141'),this[_0x6946('0x36')][_0x6946('0x3b')],_0x14e2c4['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x6946('0x2e')](util[_0x6946('0x28')](_0x6946('0x142'),this[_0x6946('0x36')]['callerid'],_0x14e2c4['findBy']));this[_0x6946('0x36')][_0x6946('0xa8')](util['format'](_0x6946('0x142'),this['channel']['callerid'],_0x14e2c4[_0x6946('0x13f')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x6946('0x12')][_0x6946('0x143')]=function(_0x1a0e73){logger[_0x6946('0x2e')](util['format'](_0x6946('0x144'),_0x1a0e73[_0x6946('0x38')]));if(!this[_0x6946('0x82')](_0x1a0e73['findBy'])){return this['channel'][_0x6946('0x2c')](_0x1a0e73,'no\x20find\x20by\x20configured');}logger[_0x6946('0x2e')](util[_0x6946('0x28')](_0x6946('0x140'),this[_0x6946('0x36')][_0x6946('0x3b')],_0x1a0e73['findBy']));var _0x1f128c=this[_0x6946('0x52')]['sync'](this,_0x1a0e73[_0x6946('0x13f')]);if(_0x1f128c){logger['info'](util[_0x6946('0x28')](_0x6946('0x141'),this[_0x6946('0x36')]['callerid'],_0x1a0e73[_0x6946('0x13f')]));this[_0x6946('0x36')]['noop'](util[_0x6946('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x6946('0x36')]['callerid'],_0x1a0e73[_0x6946('0x13f')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x6946('0x28')](_0x6946('0x142'),this[_0x6946('0x36')]['callerid'],_0x1a0e73['findBy']));this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')](_0x6946('0x142'),this['channel'][_0x6946('0x3b')],_0x1a0e73[_0x6946('0x13f')]));return{'code':0xc8,'result':_0x6946('0x145')};}};AGIVertices[_0x6946('0x12')][_0x6946('0x146')]=function(_0x483eb1){logger[_0x6946('0x2e')](util[_0x6946('0x28')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x483eb1['label']));if(!this[_0x6946('0x82')](_0x483eb1[_0x6946('0x147')])){return this['channel'][_0x6946('0x2c')](_0x483eb1,_0x6946('0x148'));}this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')]('math\x20%s',_0x483eb1[_0x6946('0x147')]));var _0x1bd03f=eval(_0x483eb1[_0x6946('0x147')]);if(!this[_0x6946('0x82')](_0x483eb1[_0x6946('0xca')])){return this['channel'][_0x6946('0xa8')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0xf72904=this['getVariable'][_0x6946('0x6e')](this,_0x483eb1[_0x6946('0xca')]);if(!_0xf72904){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x483eb1,'no\x20variable\x20found');}if(_[_0x6946('0x98')](_0x1bd03f)){var _0x441a73=this;_0x1bd03f[_0x6946('0xcd')](function(_0x369c64,_0x4a9461){_0x441a73['channel'][_0x6946('0x99')](util[_0x6946('0x28')]('%s[%s]',_0xf72904,_0x4a9461),_0x369c64);});return this[_0x6946('0x36')][_0x6946('0xa8')](util['format'](_0x6946('0x149'),_0xf72904));}else{return this[_0x6946('0x36')][_0x6946('0x99')](_0xf72904,_0x1bd03f);}};AGIVertices[_0x6946('0x12')][_0x6946('0x14a')]=function(_0x56f811){logger['info'](util['format'](_0x6946('0x14b'),_0x56f811[_0x6946('0x38')]));if(_0x56f811[_0x6946('0x9d')]===0x0){return this[_0x6946('0x9c')](_0x56f811);}_0x56f811['retry']-=0x1;if(!this[_0x6946('0x82')](_0x56f811['file_id'])){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x56f811,_0x6946('0xfc'));}var _0x258af4=this[_0x6946('0x1f')][_0x6946('0x6e')](this,_0x56f811[_0x6946('0xfb')]);if(!_0x258af4){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x56f811,'no\x20file\x20audio\x20found');}var _0x3e54d3=this['channel'][_0x6946('0xfd')](_0x258af4,_0x56f811[_0x6946('0x14c')],_0x56f811['digit']);var _0x3235a1=_0x3e54d3['result'];if(_0x3e54d3[_0x6946('0xa2')]===-0x1){this['createSquareDetailsReport'][_0x6946('0x6e')](this,_0x56f811,'-1');return _0x3e54d3;}else if(_0x3e54d3[_0x6946('0x9b')]===_0x6946('0x66')){_0x3e54d3[_0x6946('0xa2')]=_0x3e54d3[_0x6946('0xa2')][_0x6946('0x95')]>0x0?_0x3e54d3[_0x6946('0xa2')]:'t';}else if(_['isEmpty'](_0x3e54d3[_0x6946('0xa2')])){_0x3e54d3['result']='#';_0x3235a1='#';}if(!this['isConfigured'](_0x56f811[_0x6946('0xca')])){this[_0x6946('0x36')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x5db068=this['getVariable'][_0x6946('0x6e')](this,_0x56f811[_0x6946('0xca')]);if(!_0x5db068){return this['channel'][_0x6946('0x2c')](_0x56f811,_0x6946('0xcc'));}this[_0x6946('0x36')][_0x6946('0x99')](_0x5db068,_0x3235a1);}this[_0x6946('0x35')][_0x6946('0x6e')](this,_0x56f811,_0x3235a1);return _0x3e54d3;};AGIVertices['prototype']['noop']=function(_0x250af1){logger['info'](util[_0x6946('0x28')](_0x6946('0x14d'),_0x250af1[_0x6946('0x38')]));return this['channel'][_0x6946('0xa8')](_0x250af1[_0x6946('0x14e')]||_0x250af1['label']);};AGIVertices[_0x6946('0x12')][_0x6946('0x14f')]=function(_0x3e55f8){logger['info'](util[_0x6946('0x28')](_0x6946('0x150'),_0x3e55f8[_0x6946('0x38')]));if(!this['isConfigured'](_0x3e55f8[_0x6946('0x13f')])){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x3e55f8,_0x6946('0x151'));}logger['info'](util['format'](_0x6946('0x140'),this[_0x6946('0x36')][_0x6946('0x3b')],_0x3e55f8[_0x6946('0x13f')]));var _0x4de960=this['getPause'][_0x6946('0x6e')](this,_0x3e55f8['pause_id']);var _0x1aa725=this[_0x6946('0x152')][_0x6946('0x6e')](this,_0x3e55f8[_0x6946('0x13f')],_0x4de960);if(_0x1aa725){logger[_0x6946('0x2e')](util[_0x6946('0x28')](_0x6946('0x141'),this[_0x6946('0x36')][_0x6946('0x3b')],_0x3e55f8['findBy']));this[_0x6946('0x36')][_0x6946('0xa8')](util['format'](_0x6946('0x141'),this[_0x6946('0x36')]['callerid'],_0x3e55f8[_0x6946('0x13f')]));return{'code':0xc8,'result':_0x6946('0x153')};}else{logger[_0x6946('0x2e')](util[_0x6946('0x28')](_0x6946('0x142'),this['channel'][_0x6946('0x3b')],_0x3e55f8[_0x6946('0x13f')]));this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')](_0x6946('0x141'),this[_0x6946('0x36')]['callerid'],_0x3e55f8[_0x6946('0x13f')]));return{'code':0xc8,'result':_0x6946('0x145')};}};AGIVertices[_0x6946('0x12')][_0x6946('0x154')]=function(_0x591006){logger[_0x6946('0x2e')](util[_0x6946('0x28')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x591006[_0x6946('0x38')]));if(!this[_0x6946('0x82')](_0x591006['file_id'])){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x591006,_0x6946('0xfc'));}var _0x357027=this[_0x6946('0x1f')][_0x6946('0x6e')](this,_0x591006[_0x6946('0xfb')]);if(!_0x357027){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x591006,'no\x20file\x20audio\x20found');}var _0x2b943c=this[_0x6946('0x36')]['exec'](_0x6946('0x155'),[_0x357027,_0x591006[_0x6946('0xf7')]]);if(_0x2b943c['result']===-0x1){return _0x2b943c;}return this[_0x6946('0x36')]['noop'](util[_0x6946('0x28')](_0x6946('0x156'),_0x6946('0x155'),_0x357027));};AGIVertices['prototype']['queue']=function(_0x29b425){logger['info'](util[_0x6946('0x28')](_0x6946('0x157'),_0x29b425['label']));if(!this[_0x6946('0x82')](_0x29b425['queue_id'])){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x29b425,'no\x20queue\x20selected');}var _0x271cd5='';var _0x166cd5=parseInt(_0x29b425['queue_id'],0xa);if(isNaN(_0x166cd5)){_0x271cd5=_0x29b425[_0x6946('0x158')];}else{_0x271cd5=this[_0x6946('0x13')]['sync'](this,_0x29b425[_0x6946('0x158')]);if(!_0x271cd5){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x29b425,_0x6946('0x159'));}}var _0xe9835a='';if(this[_0x6946('0x82')](_0x29b425[_0x6946('0xfb')])){var _0x450e2f=this[_0x6946('0x1f')][_0x6946('0x6e')](this,_0x29b425[_0x6946('0xfb')]);if(_0x450e2f){_0xe9835a=_0x450e2f;}}this[_0x6946('0x35')][_0x6946('0x6e')](this,_0x29b425,_0x271cd5);if(_0x29b425['opts']['indexOf']('x')<0x0){_0x29b425[_0x6946('0xf7')]+='x';}if(_0x29b425[_0x6946('0xf7')][_0x6946('0x15a')]('X')<0x0){_0x29b425[_0x6946('0xf7')]+='X';}this[_0x6946('0x36')][_0x6946('0x99')](_0x6946('0x15b'),_0x271cd5?_0x271cd5[_0x6946('0x15c')]():'');var _0x178a1f=this[_0x6946('0x36')][_0x6946('0x58')]('QUEUE',[_0x271cd5,_0x29b425[_0x6946('0xf7')],_0x29b425[_0x6946('0x71')],_0xe9835a,_0x29b425[_0x6946('0x66')],_0x29b425[_0x6946('0x9')],_0x29b425[_0x6946('0x15d')],_0x29b425[_0x6946('0x15e')],'',_0x29b425[_0x6946('0x15f')]]);if(_0x178a1f['result']===-0x1){return _0x178a1f;}return this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')](_0x6946('0x156'),_0x6946('0x160'),_0x271cd5));};AGIVertices[_0x6946('0x12')][_0x6946('0x161')]=function(_0x3b9202){logger[_0x6946('0x2e')](util[_0x6946('0x28')](_0x6946('0x162'),_0x3b9202[_0x6946('0x38')]));var _0x1310a4=_0x3b9202[_0x6946('0x163')]||_0x6946('0x117');var _0x20892e=util[_0x6946('0x28')](_0x6946('0x164'),this['channel'][_0x6946('0x37')],rs[_0x6946('0x102')](0x5));var _0x498a83=util['format'](_0x6946('0x165'),FILES_PATH,_0x20892e,_0x1310a4);var _0x482c0a=util['format']('%s/recordings/%s',FILES_PATH,_0x20892e);this['createSquareRecording']['sync'](this,_0x3b9202,_0x20892e,_0x498a83);this[_0x6946('0x36')][_0x6946('0x99')](_0x6946('0x166'),_0x20892e);logger[_0x6946('0x2e')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x482c0a,_0x1310a4,_0x3b9202[_0x6946('0x167')],_0x3b9202[_0x6946('0x66')]);return this[_0x6946('0x36')][_0x6946('0x122')](_0x482c0a,_0x1310a4,_0x3b9202[_0x6946('0x167')],_0x3b9202['timeout'],undefined,!![]);};AGIVertices[_0x6946('0x12')][_0x6946('0x168')]=function(_0x47b9ef){logger['info'](util[_0x6946('0x28')](_0x6946('0x169'),_0x47b9ef[_0x6946('0x38')]));if(!this[_0x6946('0x82')](_0x47b9ef[_0x6946('0x71')])){return this[_0x6946('0x36')][_0x6946('0xa8')]('no\x20url\x20configured');}var _0x5379f2=this['restAPI'][_0x6946('0x6e')](this,_0x47b9ef);logger[_0x6946('0x2e')](util[_0x6946('0x28')]('Response:',util[_0x6946('0x16a')](_0x5379f2,{'showHidden':![],'depth':null})));if(!this[_0x6946('0x82')](_0x47b9ef['variable_id'])){return this[_0x6946('0x36')][_0x6946('0xa8')](_0x6946('0x16b'));}var _0x5a3dec=this[_0x6946('0xf')][_0x6946('0x6e')](this,_0x47b9ef[_0x6946('0xca')]);if(!_0x5a3dec){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x47b9ef,'no\x20variable\x20found');}this['channel']['setVariable'](util[_0x6946('0x28')](_0x6946('0x16c'),_0x5a3dec),_0x5379f2['statusCode']?_0x5379f2[_0x6946('0x75')]:_0x6946('0x16d'));this[_0x6946('0x36')]['setVariable'](util[_0x6946('0x28')](_0x6946('0x16e'),_0x5a3dec),_0x5379f2[_0x6946('0x76')]?_0x5379f2[_0x6946('0x76')]:'OK');if(_0x5379f2['body']){try{this[_0x6946('0x96')](_0x5379f2[_0x6946('0x74')],_0x5a3dec);}catch(_0x2e6d7e){logger[_0x6946('0x2c')](util[_0x6946('0x28')](_0x6946('0x16f'),_0x5a3dec));}}return this[_0x6946('0x36')]['noop'](util['format']('variable\x20%s\x20set',_0x5a3dec));};AGIVertices['prototype'][_0x6946('0x170')]=function(_0x55ab46){logger['info'](util[_0x6946('0x28')](_0x6946('0x171'),_0x55ab46[_0x6946('0x38')]));return this[_0x6946('0x36')]['sayDigits'](_0x55ab46[_0x6946('0x172')][_0x6946('0x59')](/\s+/g,''),_0x55ab46[_0x6946('0x167')]);};AGIVertices['prototype'][_0x6946('0x173')]=function(_0x1def66){logger[_0x6946('0x2e')](util['format'](_0x6946('0x174'),_0x1def66[_0x6946('0x38')]));return this['channel'][_0x6946('0x175')](_0x1def66[_0x6946('0x65')][_0x6946('0x59')](/\s+/g,''),_0x1def66['escape_digits']);};AGIVertices[_0x6946('0x12')][_0x6946('0x176')]=function(_0x2524c4){logger[_0x6946('0x2e')](util[_0x6946('0x28')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x2524c4[_0x6946('0x38')]));return this[_0x6946('0x36')][_0x6946('0x177')](_0x2524c4['text'],_0x2524c4[_0x6946('0x167')]);};AGIVertices['prototype'][_0x6946('0x178')]=function(_0x5984a5){logger[_0x6946('0x2e')](util[_0x6946('0x28')](_0x6946('0x179'),_0x5984a5['label']));if(!this['isConfigured'](_0x5984a5[_0x6946('0x17a')])){return this[_0x6946('0x36')]['noop']('no\x20mail\x20account\x20configured');}var _0x278690=this[_0x6946('0x17b')][_0x6946('0x6e')](this,_0x5984a5[_0x6946('0x17a')]);if(!_0x278690||!_0x278690[_0x6946('0x17c')]){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x5984a5,_0x6946('0x17d'));}var _0x4bbecd={'from':util[_0x6946('0x28')]('\x22%s\x22\x20<%s>',_0x278690[_0x6946('0x10')],_0x278690[_0x6946('0x17e')]||_0x278690[_0x6946('0x17c')]['user']),'to':_0x5984a5['to']||'','cc':_0x5984a5['cc']||'','bcc':_0x5984a5[_0x6946('0x17f')]||'','subject':_0x5984a5['subject'],'html':_0x5984a5[_0x6946('0x5d')],'text':_0x5984a5[_0x6946('0x5d')]};var _0x1df519={'tls':{'rejectUnauthorized':![]}};if(_0x278690['Smtp'][_0x6946('0x180')]){_0x1df519[_0x6946('0x180')]=_0x278690[_0x6946('0x17c')][_0x6946('0x180')];}else{_0x1df519['host']=_0x278690['Smtp'][_0x6946('0x181')];_0x1df519[_0x6946('0x182')]=_0x278690[_0x6946('0x17c')]['port'];_0x1df519[_0x6946('0x183')]=_0x278690[_0x6946('0x17c')][_0x6946('0x183')];}if(_0x278690[_0x6946('0x17c')][_0x6946('0x184')]){_0x1df519[_0x6946('0x185')]={'user':_0x278690[_0x6946('0x17c')]['user'],'pass':_0x278690[_0x6946('0x17c')][_0x6946('0x186')]};}if(this[_0x6946('0x82')](_0x5984a5['template_id'])){}logger[_0x6946('0xd2')](_0x6946('0x187'),JSON[_0x6946('0x73')](_0x4bbecd));this[_0x6946('0x35')][_0x6946('0x6e')](this,_0x5984a5,_0x5984a5[_0x6946('0x17a')]);this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')](_0x6946('0x188'),_0x278690[_0x6946('0x10')]));this[_0x6946('0x23')][_0x6946('0x6e')](this,_0x1df519,_0x4bbecd);return this[_0x6946('0x36')]['noop'](_0x6946('0x189'));};AGIVertices[_0x6946('0x12')][_0x6946('0x18a')]=function(_0x3c5186){logger[_0x6946('0x2e')](util['format'](_0x6946('0x18b'),_0x3c5186[_0x6946('0x38')]));return this[_0x6946('0x36')]['noop'](_0x6946('0x18c'));};AGIVertices['prototype'][_0x6946('0x18d')]=function(_0x35a531){logger[_0x6946('0x2e')](util['format'](_0x6946('0x18e'),_0x35a531[_0x6946('0x38')]));if(!this[_0x6946('0x82')](_0x35a531[_0x6946('0x18f')])){return this[_0x6946('0x36')][_0x6946('0xa8')](_0x6946('0x190'));}var _0xe7fb92=this[_0x6946('0x191')][_0x6946('0x6e')](this,_0x35a531[_0x6946('0x18f')]);if(!_0xe7fb92){return this['channel'][_0x6946('0x2c')](_0x35a531,'no\x20sms\x20account\x20found');}var _0x44ab2b={'body':_0x35a531['sms_text'],'phone':_0x35a531['to']||'','SmsAccountId':_0xe7fb92['id']};logger[_0x6946('0xd2')](_0x6946('0x192'),JSON[_0x6946('0x73')](_0x44ab2b));this['createSquareDetailsReport']['sync'](this,_0x35a531,_0x35a531[_0x6946('0x18f')]);this[_0x6946('0x36')][_0x6946('0xa8')](util['format']('Trying\x20SendSMS\x20with\x20account\x20%s',_0xe7fb92[_0x6946('0x10')]));this['createSmsMessage']['sync'](this,_0x44ab2b);return this[_0x6946('0x36')][_0x6946('0xa8')](_0x6946('0x193'));};AGIVertices['prototype'][_0x6946('0x194')]=function(_0x5d46e1){logger[_0x6946('0x2e')](util[_0x6946('0x28')](_0x6946('0x195'),_0x5d46e1['label']));if(!this['isConfigured'](_0x5d46e1[_0x6946('0xca')])){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x5d46e1,_0x6946('0x196'));}var _0x175708=this[_0x6946('0xf')][_0x6946('0x6e')](this,_0x5d46e1[_0x6946('0xca')]);if(!_0x175708){return this[_0x6946('0x36')]['error'](_0x5d46e1,_0x6946('0xcc'));}return this[_0x6946('0x36')][_0x6946('0x99')](_0x175708,_0x5d46e1[_0x6946('0x197')]);};AGIVertices[_0x6946('0x12')][_0x6946('0x198')]=function(_0x1c84ff){logger['info'](util[_0x6946('0x28')](_0x6946('0x199'),_0x1c84ff['label']));this[_0x6946('0x36')][_0x6946('0xa8')](_0x6946('0x19a'));if(_0x1c84ff['answer']===_0x6946('0x19b')){this['channel'][_0x6946('0xa8')](_0x6946('0x19c'));return this[_0x6946('0x36')]['answer']();}return this[_0x6946('0x36')][_0x6946('0xa8')]('Skipped\x20Answer');};AGIVertices[_0x6946('0x12')]['subproject']=function(_0x157180){logger['info'](util['format'](_0x6946('0x19d'),_0x157180[_0x6946('0x38')]));if(!this['isConfigured'](_0x157180[_0x6946('0x19e')])){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x157180,_0x6946('0x19f'));}var _0x2f09e3=this[_0x6946('0x16')][_0x6946('0x6e')](this,_0x157180[_0x6946('0x19e')]);if(!this[_0x6946('0x82')](_0x2f09e3)){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x157180,util['format']('no\x20subproject\x20found\x20with\x20id\x20%d',_0x157180[_0x6946('0x19e')]));}if(_0x2f09e3===this[_0x6946('0x36')]['arg_1']){return this['channel']['error'](_0x157180,_0x6946('0x1a0'));}this[_0x6946('0x35')][_0x6946('0x6e')](this,_0x157180,_0x2f09e3);var _0x15c359=this['channel'][_0x6946('0x58')]('AGI',util['format'](_0x6946('0x1a1'),config[_0x6946('0x9')][_0x6946('0x181')]||'127.0.0.1',_0x2f09e3,this[_0x6946('0x36')][_0x6946('0x39')]));if(_0x15c359[_0x6946('0xa2')]===-0x1){return _0x15c359;}return this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')](_0x6946('0x156'),'AGI',_0x2f09e3));};AGIVertices[_0x6946('0x12')][_0x6946('0x1a2')]=function(_0x2ed01c){logger[_0x6946('0x2e')](util[_0x6946('0x28')](_0x6946('0x1a3'),_0x2ed01c[_0x6946('0x38')]));var _0x52f7a8=this[_0x6946('0x57')][_0x6946('0x6e')](this,_0x2ed01c[_0x6946('0x9f')]);this[_0x6946('0x35')]['sync'](this,_0x2ed01c,_0x2ed01c[_0x6946('0x9f')]);if(this[_0x6946('0x82')](_0x2ed01c[_0x6946('0xca')])){var _0x33fd52=this[_0x6946('0xf')][_0x6946('0x6e')](this,_0x2ed01c[_0x6946('0xca')]);if(_0x33fd52){this[_0x6946('0x36')][_0x6946('0x99')](_0x33fd52,_0x52f7a8);return this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x2ed01c[_0x6946('0x9f')],_0x33fd52));}}return this['channel'][_0x6946('0xa8')](util['format'](_0x6946('0x1a4'),_0x2ed01c['command']));};AGIVertices[_0x6946('0x12')][_0x6946('0x1a5')]=function(_0x1c2f74){logger[_0x6946('0x2e')](util[_0x6946('0x28')](_0x6946('0x1a6'),_0x1c2f74[_0x6946('0x38')]));if(!this['isConfigured'](_0x1c2f74[_0x6946('0x5b')])){return this[_0x6946('0x36')][_0x6946('0xa8')]('no\x20apiKey\x20configured');}if(!this['isConfigured'](_0x1c2f74[_0x6946('0x5d')])){return this[_0x6946('0x36')][_0x6946('0xa8')](_0x6946('0xae'));}this['channel'][_0x6946('0xa8')](util[_0x6946('0x28')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x1c2f74[_0x6946('0x5d')]));var _0x50fa69=this[_0x6946('0x5a')][_0x6946('0x6e')](this,_0x1c2f74);if(_0x50fa69){this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')](_0x6946('0x1a7'),_0x50fa69));var _0x33d9e=this[_0x6946('0x36')][_0x6946('0xeb')](_0x50fa69);try{fs[_0x6946('0xec')](_0x50fa69+_0x6946('0x10c'));}catch(_0x481b9a){logger[_0x6946('0x2c')](_0x481b9a);}return _0x33d9e;}return this[_0x6946('0x36')]['error'](_0x1c2f74,_0x6946('0x1a8'));};AGIVertices[_0x6946('0x12')][_0x6946('0x1a9')]=function(_0x55150c){logger[_0x6946('0x2e')](util[_0x6946('0x28')](_0x6946('0x1aa'),_0x55150c[_0x6946('0x38')]));if(!this[_0x6946('0x82')](_0x55150c[_0x6946('0x5d')])){return this['channel']['noop'](_0x6946('0xae'));}this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')](_0x6946('0x1ab'),_0x55150c['text']));var _0xad7407=this[_0x6946('0x64')]['sync'](this,_0x55150c);if(_0xad7407){this['channel'][_0x6946('0xa8')](util['format'](_0x6946('0x1ac'),_0xad7407));var _0x66acfd=this['channel'][_0x6946('0xeb')](_0xad7407);try{fs['unlink'](_0xad7407+_0x6946('0x10c'));}catch(_0x4b938d){logger['error'](_0x4b938d);}return _0x66acfd;}return this[_0x6946('0x36')][_0x6946('0x2c')](_0x55150c,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x6946('0x12')][_0x6946('0x1ad')]=function(_0x34989e){logger['info'](util[_0x6946('0x28')](_0x6946('0x1ae'),_0x34989e[_0x6946('0x38')]));if(!this[_0x6946('0x82')](_0x34989e[_0x6946('0x13f')])){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x34989e,_0x6946('0x151'));}logger['info'](util[_0x6946('0x28')](_0x6946('0x140'),this[_0x6946('0x36')][_0x6946('0x3b')],_0x34989e[_0x6946('0x13f')]));var _0x466753=this['agentUnpause']['sync'](this,_0x34989e[_0x6946('0x13f')]);if(_0x466753){logger[_0x6946('0x2e')](util[_0x6946('0x28')](_0x6946('0x141'),this[_0x6946('0x36')][_0x6946('0x3b')],_0x34989e['findBy']));this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')](_0x6946('0x141'),this[_0x6946('0x36')]['callerid'],_0x34989e['findBy']));return{'code':0xc8,'result':_0x6946('0x153')};}else{logger[_0x6946('0x2e')](util[_0x6946('0x28')](_0x6946('0x142'),this['channel'][_0x6946('0x3b')],_0x34989e['findBy']));this[_0x6946('0x36')][_0x6946('0xa8')](util['format'](_0x6946('0x142'),this[_0x6946('0x36')][_0x6946('0x3b')],_0x34989e[_0x6946('0x13f')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x6946('0x12')][_0x6946('0x1af')]=function(_0x5262e8){logger['info'](util[_0x6946('0x28')](_0x6946('0x1b0'),_0x5262e8['label']));var _0xc207e3=this['channel'][_0x6946('0x58')]('VOICEMAIL',[_0x5262e8[_0x6946('0x1b1')],_0x5262e8['options']]);if(_0xc207e3['result']===-0x1){return _0xc207e3;}return this[_0x6946('0x36')][_0x6946('0xa8')](util[_0x6946('0x28')]('Executed\x20command\x20%s\x20%s',_0x6946('0x1b2'),_0x5262e8['mailbox']));};AGIVertices[_0x6946('0x12')]['vswitch']=function(_0x1f830b){logger[_0x6946('0x2e')](util['format'](_0x6946('0x1b3'),_0x1f830b[_0x6946('0x38')]));if(!this[_0x6946('0x82')](_0x1f830b['variable_id'])){return this[_0x6946('0x36')][_0x6946('0x2c')](_0x1f830b,'no\x20variable\x20selected');}var _0x3a5ede=this['getVariable'][_0x6946('0x6e')](this,_0x1f830b[_0x6946('0xca')]);if(!_0x3a5ede){return this[_0x6946('0x36')]['error'](_0x1f830b,_0x6946('0xcc'));}var _0x493d2f=this['channel'][_0x6946('0xf')](_0x3a5ede);return{'code':0xc8,'result':_0x493d2f[_0x6946('0x9b')]?_0x493d2f[_0x6946('0x9b')]:'-'};};String[_0x6946('0x12')][_0x6946('0x1b4')]=function(_0x253a54,_0x243e12){return this[_0x6946('0x9a')](_0x253a54)[_0x6946('0x1b5')](_0x243e12);};module[_0x6946('0x1b6')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 29393af..1a6e472 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 _0xa630=['transfertargetuniqueid','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','Auto-Pause','util','lodash','../../../config/logger','../rpc/user','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','getAgent','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','timer','update','then','[%s][UPDATE][ACWTIME:%s]','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','message','[TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','acw','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid'];(function(_0x1e691f,_0x215f5f){var _0x5b37cb=function(_0x1ffe30){while(--_0x1ffe30){_0x1e691f['push'](_0x1e691f['shift']());}};_0x5b37cb(++_0x215f5f);}(_0xa630,0xbe));var _0x0a63=function(_0x50d761,_0x1efb95){_0x50d761=_0x50d761-0x0;var _0x41105d=_0xa630[_0x50d761];return _0x41105d;};'use strict';var util=require(_0x0a63('0x0'));var _=require(_0x0a63('0x1'));var moment=require('moment');var ami=require('../ami');var logger=require(_0x0a63('0x2'))('acw');var RpcUser=require(_0x0a63('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x91a747){this[_0x0a63('0x4')]=_0x91a747[_0x0a63('0x4')];this[_0x0a63('0x5')]=_0x91a747[_0x0a63('0x5')];this['timers']=_0x91a747[_0x0a63('0x6')];this[_0x0a63('0x7')]={};ami['on'](_0x0a63('0x8'),this[_0x0a63('0x9')][_0x0a63('0xa')](this));ami['on'](_0x0a63('0xb'),this['syncHangupRequest'][_0x0a63('0xa')](this));ami['on'](_0x0a63('0xc'),this[_0x0a63('0xd')][_0x0a63('0xa')](this));ami['on'](_0x0a63('0xe'),this[_0x0a63('0xf')][_0x0a63('0xa')](this));ami['on'](_0x0a63('0x10'),this[_0x0a63('0x11')][_0x0a63('0xa')](this));ami['on']('blindtransfer',this[_0x0a63('0x12')][_0x0a63('0xa')](this));ami['on'](_0x0a63('0x13'),this[_0x0a63('0x14')]['bind'](this));}function getDiff(_0x23f655){var _0x4d68c0=moment()[_0x0a63('0x15')](0x0);var _0x19e922=moment(_0x23f655)[_0x0a63('0x15')](0x0);return _0x4d68c0[_0x0a63('0x16')](_0x19e922,_0x0a63('0x17'));}Acw[_0x0a63('0x18')][_0x0a63('0x19')]=function(_0x1e3251){try{var _0x524a98=this;var _0x47788e=this['channels'][_0x1e3251][_0x0a63('0x1a')];var _0x292170=this[_0x0a63('0x7')][_0x1e3251][_0x0a63('0x1b')];var _0x1f7481=this[_0x0a63('0x4')][_0x292170];var _0x30f292=![];var _0x374c52=_0x0a63('0x1c');if(_0x1f7481[_0x0a63('0x1d')]){if(_0x1f7481[_0x0a63('0x1e')]['name']){_0x30f292=!![];_0x374c52=_0x1f7481['mandatoryDispositionPause'][_0x0a63('0x1f')];}}ami['Action']({'action':_0x0a63('0x20'),'interface':_0x47788e,'paused':!![],'reason':_0x374c52})['then'](function(_0x58513d){if(_0x524a98[_0x0a63('0x5')][_0x47788e]){return RpcUser[_0x0a63('0x21')](_0x524a98[_0x0a63('0x5')][_0x47788e]['id'])['then'](function(_0x398a16){if(_0x398a16&&!_0x398a16['voicePause']){logger[_0x0a63('0x22')](_0x0a63('0x23'),_0x1e3251,_0x47788e,_0x292170);var _0x1bf64a=_0x524a98[_0x0a63('0x7')][_0x1e3251][_0x0a63('0x24')]&&_0x524a98[_0x0a63('0x7')][_0x1e3251][_0x0a63('0x25')]?_0x524a98[_0x0a63('0x7')][_0x1e3251]['destlinkedid']:_0x1e3251;return RpcUser['savePause'](_0x524a98['agents'][_0x47788e],_0x374c52,_0x1bf64a)['then'](function(_0xeacfc9){if(!_0x30f292){_0x524a98['timers'][_0x47788e]={};logger['info'](_0x0a63('0x26'),_0x1e3251,_0x524a98[_0x0a63('0x4')][_0x292170][_0x0a63('0x27')],_0x47788e,_0x292170);_0x524a98[_0x0a63('0x6')][_0x47788e]['timer']=setTimeout(_0x524a98[_0x0a63('0x28')][_0x0a63('0xa')](_0x524a98,_0x47788e),_0x524a98[_0x0a63('0x4')][_0x292170]['acwTimeout']*0x3e8);_0x524a98[_0x0a63('0x6')][_0x47788e][_0x0a63('0x29')]=moment()[_0x0a63('0x2a')](_0x0a63('0x2b'));_0x524a98[_0x0a63('0x6')][_0x47788e][_0x0a63('0x2c')]=_0x1e3251;_0x524a98[_0x0a63('0x6')][_0x47788e][_0x0a63('0x1b')]=_0x292170;_0x524a98['timers'][_0x47788e][_0x0a63('0x2d')]=function(){var _0x574c06=getDiff(_0x524a98[_0x0a63('0x6')][_0x47788e][_0x0a63('0x29')]);clearTimeout(_0x524a98[_0x0a63('0x6')][_0x47788e][_0x0a63('0x2e')]);_0x524a98[_0x0a63('0x6')][_0x47788e]['timer']=![];RpcVoiceAgentReport[_0x0a63('0x2f')]({'acwtime':_0x574c06},_0x524a98[_0x0a63('0x6')][_0x47788e][_0x0a63('0x2c')],_0x47788e)[_0x0a63('0x30')](function(_0x59d06c){logger[_0x0a63('0x22')](_0x0a63('0x31'),_0x1e3251,_0x574c06,_0x59d06c);})['catch'](function(_0x4a7145){logger[_0x0a63('0x32')]('[%s][UPDATE][ERRORS:%s]',_0x1e3251,_0x4a7145);});delete _0x524a98['timers'][_0x47788e];};}});}else{logger[_0x0a63('0x22')](_0x0a63('0x33'),_0x1e3251,_0x47788e,_0x292170);}});}})['catch'](function(_0xfd1e09){logger[_0x0a63('0x32')](_0x0a63('0x26'),_0x1e3251,_0x524a98[_0x0a63('0x4')][_0x292170][_0x0a63('0x27')],_0x47788e,_0x292170);})['finally'](function(){delete _0x524a98['channels'][_0x1e3251];});}catch(_0x22993d){logger[_0x0a63('0x32')](_0x0a63('0x34'),_0x22993d[_0x0a63('0x35')]);}};Acw[_0x0a63('0x18')][_0x0a63('0x28')]=function(_0x59912d){try{var _0x307fe2=this;if(_0x307fe2[_0x0a63('0x6')][_0x59912d]){_0x307fe2['timers'][_0x59912d][_0x0a63('0x2e')]=![];var _0x5b62b7=_0x307fe2['timers'][_0x59912d][_0x0a63('0x2c')];var _0x232388=_0x307fe2[_0x0a63('0x6')][_0x59912d]['queue'];var _0x209447=_0x307fe2[_0x0a63('0x4')][_0x232388][_0x0a63('0x27')];logger[_0x0a63('0x22')](_0x0a63('0x36'),_0x59912d);RpcUser[_0x0a63('0x37')](this[_0x0a63('0x5')][_0x59912d]);RpcVoiceAgentReport['update']({'acwtime':_0x209447,'agentacw':!![]},_0x5b62b7,_0x59912d)[_0x0a63('0x30')](function(_0x1c7e67){logger[_0x0a63('0x22')]('[%s][UPDATE][ACWTIME:%s]',_0x5b62b7,_0x209447,_0x1c7e67);})['catch'](function(_0x28f904){logger['error'](_0x0a63('0x38'),_0x5b62b7,_0x28f904);});}else{logger[_0x0a63('0x32')](_0x0a63('0x39'),_0x59912d);if(_0x307fe2['timers']){logger[_0x0a63('0x22')](_0x0a63('0x3a'),JSON[_0x0a63('0x3b')](_0x307fe2[_0x0a63('0x6')]));}}}catch(_0x5d94e2){logger[_0x0a63('0x32')](_0x0a63('0x3c'),_0x5d94e2[_0x0a63('0x35')]);}};Acw[_0x0a63('0x18')][_0x0a63('0x9')]=function(_0x38cfe4){try{if(this['voiceQueues'][_0x38cfe4[_0x0a63('0x1b')]]&&(this[_0x0a63('0x4')][_0x38cfe4[_0x0a63('0x1b')]][_0x0a63('0x3d')]||this[_0x0a63('0x4')][_0x38cfe4[_0x0a63('0x1b')]][_0x0a63('0x1d')])){if(this[_0x0a63('0x5')][_0x38cfe4[_0x0a63('0x1a')]]){this[_0x0a63('0x7')][_0x38cfe4[_0x0a63('0x2c')]]={'queue':_0x38cfe4[_0x0a63('0x1b')],'interface':_0x38cfe4[_0x0a63('0x1a')],'destlinkedid':_0x38cfe4[_0x0a63('0x25')]};}}}catch(_0x364a89){logger[_0x0a63('0x32')](_0x0a63('0x3e'),_0x364a89[_0x0a63('0x35')]);}};Acw['prototype'][_0x0a63('0x14')]=function(_0x5ef4e9){try{if(this['voiceQueues'][_0x5ef4e9[_0x0a63('0x1b')]]&&(this[_0x0a63('0x4')][_0x5ef4e9[_0x0a63('0x1b')]][_0x0a63('0x3d')]||this[_0x0a63('0x4')][_0x5ef4e9[_0x0a63('0x1b')]][_0x0a63('0x1d')])){if(this[_0x0a63('0x5')][_0x5ef4e9[_0x0a63('0x1a')]]){this[_0x0a63('0x7')][_0x5ef4e9[_0x0a63('0x2c')]]={'queue':_0x5ef4e9[_0x0a63('0x1b')],'interface':_0x5ef4e9[_0x0a63('0x1a')]};}}}catch(_0x27de0c){logger[_0x0a63('0x32')](_0x0a63('0x3f'),_0x27de0c[_0x0a63('0x35')]);}};Acw[_0x0a63('0x18')][_0x0a63('0x40')]=function(_0x148e0a){try{if(this['channels'][_0x148e0a[_0x0a63('0x2c')]]&&_[_0x0a63('0x41')](this['channels'][_0x148e0a['uniqueid']]['attended'])){logger['info'](_0x0a63('0x42'),_0x148e0a[_0x0a63('0x2c')]);this['startAcw'](_0x148e0a[_0x0a63('0x2c')]);}else if(this['channels'][_0x148e0a[_0x0a63('0x43')]]&&_[_0x0a63('0x41')](this['channels'][_0x148e0a['linkedid']]['attended'])){logger[_0x0a63('0x22')](_0x0a63('0x44'),_0x148e0a[_0x0a63('0x43')]);this[_0x0a63('0x19')](_0x148e0a[_0x0a63('0x43')]);}}catch(_0x4be904){logger[_0x0a63('0x32')](_0x0a63('0x45'),_0x4be904[_0x0a63('0x35')]);}};Acw[_0x0a63('0x18')][_0x0a63('0xd')]=function(_0x4a5b6e){try{if(this[_0x0a63('0x7')][_0x4a5b6e[_0x0a63('0x2c')]]&&this[_0x0a63('0x7')][_0x4a5b6e[_0x0a63('0x2c')]]['attended']){logger[_0x0a63('0x22')](_0x0a63('0x46'),_0x4a5b6e[_0x0a63('0x2c')]);this[_0x0a63('0x19')](_0x4a5b6e[_0x0a63('0x2c')]);}else if(this[_0x0a63('0x7')][_0x4a5b6e['linkedid']]&&this[_0x0a63('0x7')][_0x4a5b6e[_0x0a63('0x43')]][_0x0a63('0x24')]){logger[_0x0a63('0x22')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x4a5b6e['linkedid']);this[_0x0a63('0x19')](_0x4a5b6e[_0x0a63('0x43')]);}}catch(_0x42514e){logger[_0x0a63('0x32')](_0x0a63('0x47'),_0x42514e['message']);}};Acw['prototype']['syncAttendedTransfer']=function(_0x42c1bb){try{if(!_['isNil'](this[_0x0a63('0x7')][_0x42c1bb[_0x0a63('0x48')]])){this[_0x0a63('0x19')](_0x42c1bb['transfereeuniqueid']);if(this['channels'][_0x42c1bb[_0x0a63('0x49')]]){this[_0x0a63('0x7')][_0x42c1bb[_0x0a63('0x49')]][_0x0a63('0x24')]=!![];this[_0x0a63('0x7')][_0x42c1bb[_0x0a63('0x4a')]]=this[_0x0a63('0x7')][_0x42c1bb[_0x0a63('0x49')]];delete this[_0x0a63('0x7')][_0x42c1bb[_0x0a63('0x49')]];}}else if(!_[_0x0a63('0x4b')](this[_0x0a63('0x7')][_0x42c1bb[_0x0a63('0x4a')]])){this[_0x0a63('0x19')](_0x42c1bb['transfertargetuniqueid']);if(this['channels'][_0x42c1bb[_0x0a63('0x4c')]]){this[_0x0a63('0x7')][_0x42c1bb['origtransfereruniqueid']][_0x0a63('0x24')]=!![];this[_0x0a63('0x7')][_0x42c1bb['transfereeuniqueid']]=this[_0x0a63('0x7')][_0x42c1bb[_0x0a63('0x4c')]];delete this['channels'][_0x42c1bb['origtransfereruniqueid']];}}}catch(_0x3b395a){logger[_0x0a63('0x32')](_0x0a63('0x4d'),_0x3b395a['message']);}};Acw[_0x0a63('0x18')][_0x0a63('0x12')]=function(_0x27141e){try{if(this[_0x0a63('0x7')][_0x27141e[_0x0a63('0x4e')]]){logger['info'](_0x0a63('0x4f'),JSON[_0x0a63('0x3b')](_0x27141e[_0x0a63('0x4e')]));this[_0x0a63('0x19')](_0x27141e[_0x0a63('0x4e')]);}else if(this[_0x0a63('0x7')][_0x27141e[_0x0a63('0x50')]]){logger['info'](_0x0a63('0x51'),JSON[_0x0a63('0x3b')](_0x27141e[_0x0a63('0x50')]));this[_0x0a63('0x19')](_0x27141e[_0x0a63('0x50')]);}}catch(_0xf814c7){logger[_0x0a63('0x32')](_0x0a63('0x52'),_0xf814c7['message']);}};Acw['prototype'][_0x0a63('0xf')]=function(_0x30e5f0){try{if(this[_0x0a63('0x4')][_0x30e5f0[_0x0a63('0x1b')]]&&this[_0x0a63('0x4')][_0x30e5f0['queue']][_0x0a63('0x53')]===_0x0a63('0x54')){if(this[_0x0a63('0x5')][_0x30e5f0[_0x0a63('0x1a')]]){logger[_0x0a63('0x22')](_0x0a63('0x55'),_0x30e5f0[_0x0a63('0x2c')],_0x30e5f0[_0x0a63('0x1a')],_0x30e5f0[_0x0a63('0x1b')]);return RpcUser[_0x0a63('0x56')](this[_0x0a63('0x5')][_0x30e5f0['interface']],_0x0a63('0x57'),_0x30e5f0['uniqueid']);}}}catch(_0xfa80c2){logger[_0x0a63('0x32')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0xfa80c2['message']);}};module['exports']=Acw; \ No newline at end of file +var _0xa8a8=['blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','prototype','interface','ACW','mandatoryDisposition','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','lastPauseAt','YYYY-MM-DD\x20HH:mm:ss','queue','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','catch','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','finally','[ACW][START]\x20%s','message','uniqueid','[TIMER][STOP][AGENT:%s]','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','isNil','transfereeuniqueid','transfertargetuniqueid','secondtransfereruniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','util','lodash','moment','../ami','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','hangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer'];(function(_0x7d90af,_0x719c8c){var _0x1dbe28=function(_0x1a35d2){while(--_0x1a35d2){_0x7d90af['push'](_0x7d90af['shift']());}};_0x1dbe28(++_0x719c8c);}(_0xa8a8,0xec));var _0x8a8a=function(_0x20738a,_0x196feb){_0x20738a=_0x20738a-0x0;var _0x5246b3=_0xa8a8[_0x20738a];return _0x5246b3;};'use strict';var util=require(_0x8a8a('0x0'));var _=require(_0x8a8a('0x1'));var moment=require(_0x8a8a('0x2'));var ami=require(_0x8a8a('0x3'));var logger=require('../../../config/logger')(_0x8a8a('0x4'));var RpcUser=require(_0x8a8a('0x5'));var RpcVoiceAgentReport=require(_0x8a8a('0x6'));function Acw(_0x3ed1de){this[_0x8a8a('0x7')]=_0x3ed1de[_0x8a8a('0x7')];this[_0x8a8a('0x8')]=_0x3ed1de[_0x8a8a('0x8')];this[_0x8a8a('0x9')]=_0x3ed1de[_0x8a8a('0x9')];this[_0x8a8a('0xa')]={};ami['on'](_0x8a8a('0xb'),this[_0x8a8a('0xc')][_0x8a8a('0xd')](this));ami['on'](_0x8a8a('0xe'),this['syncHangupRequest']['bind'](this));ami['on'](_0x8a8a('0xf'),this['syncHangup'][_0x8a8a('0xd')](this));ami['on'](_0x8a8a('0x10'),this['syncAgentRingNoAnswer'][_0x8a8a('0xd')](this));ami['on'](_0x8a8a('0x11'),this[_0x8a8a('0x12')]['bind'](this));ami['on'](_0x8a8a('0x13'),this[_0x8a8a('0x14')][_0x8a8a('0xd')](this));ami['on'](_0x8a8a('0x15'),this['syncAgentConnectPreview'][_0x8a8a('0xd')](this));}function getDiff(_0x4e5d74){var _0x25e1d5=moment()[_0x8a8a('0x16')](0x0);var _0x787eec=moment(_0x4e5d74)[_0x8a8a('0x16')](0x0);return _0x25e1d5[_0x8a8a('0x17')](_0x787eec,_0x8a8a('0x18'));}Acw[_0x8a8a('0x19')]['startAcw']=function(_0x1ed3be){try{var _0x568b83=this;var _0x1f36b6=this[_0x8a8a('0xa')][_0x1ed3be][_0x8a8a('0x1a')];var _0x4291e9=this[_0x8a8a('0xa')][_0x1ed3be]['queue'];var _0x9d55f9=this[_0x8a8a('0x7')][_0x4291e9];var _0x262ca9=![];var _0x2bce13=_0x8a8a('0x1b');if(_0x9d55f9[_0x8a8a('0x1c')]){if(_0x9d55f9['mandatoryDispositionPause']['name']){_0x262ca9=!![];_0x2bce13=_0x9d55f9['mandatoryDispositionPause']['name'];}}ami['Action']({'action':_0x8a8a('0x1d'),'interface':_0x1f36b6,'paused':!![],'reason':_0x2bce13})[_0x8a8a('0x1e')](function(_0xe0f449){if(_0x568b83[_0x8a8a('0x8')][_0x1f36b6]){return RpcUser[_0x8a8a('0x1f')](_0x568b83[_0x8a8a('0x8')][_0x1f36b6]['id'])[_0x8a8a('0x1e')](function(_0xe0321c){if(_0xe0321c&&!_0xe0321c[_0x8a8a('0x20')]){logger[_0x8a8a('0x21')](_0x8a8a('0x22'),_0x1ed3be,_0x1f36b6,_0x4291e9);var _0x3aa2bb=_0x568b83[_0x8a8a('0xa')][_0x1ed3be][_0x8a8a('0x23')]&&_0x568b83[_0x8a8a('0xa')][_0x1ed3be]['destlinkedid']?_0x568b83[_0x8a8a('0xa')][_0x1ed3be][_0x8a8a('0x24')]:_0x1ed3be;return RpcUser[_0x8a8a('0x25')](_0x568b83[_0x8a8a('0x8')][_0x1f36b6],_0x2bce13,_0x3aa2bb)[_0x8a8a('0x1e')](function(_0x251315){if(!_0x262ca9){_0x568b83[_0x8a8a('0x9')][_0x1f36b6]={};logger['info'](_0x8a8a('0x26'),_0x1ed3be,_0x568b83[_0x8a8a('0x7')][_0x4291e9][_0x8a8a('0x27')],_0x1f36b6,_0x4291e9);_0x568b83['timers'][_0x1f36b6]['timer']=setTimeout(_0x568b83[_0x8a8a('0x28')][_0x8a8a('0xd')](_0x568b83,_0x1f36b6),_0x568b83['voiceQueues'][_0x4291e9]['acwTimeout']*0x3e8);_0x568b83['timers'][_0x1f36b6][_0x8a8a('0x29')]=moment()['format'](_0x8a8a('0x2a'));_0x568b83[_0x8a8a('0x9')][_0x1f36b6]['uniqueid']=_0x1ed3be;_0x568b83[_0x8a8a('0x9')][_0x1f36b6][_0x8a8a('0x2b')]=_0x4291e9;_0x568b83[_0x8a8a('0x9')][_0x1f36b6][_0x8a8a('0x2c')]=function(){var _0x41802e=getDiff(_0x568b83[_0x8a8a('0x9')][_0x1f36b6][_0x8a8a('0x29')]);clearTimeout(_0x568b83[_0x8a8a('0x9')][_0x1f36b6]['timer']);_0x568b83['timers'][_0x1f36b6]['timer']=![];RpcVoiceAgentReport[_0x8a8a('0x2d')]({'acwtime':_0x41802e},_0x568b83[_0x8a8a('0x9')][_0x1f36b6]['uniqueid'],_0x1f36b6)[_0x8a8a('0x1e')](function(_0x304e83){logger['info'](_0x8a8a('0x2e'),_0x1ed3be,_0x41802e,_0x304e83);})[_0x8a8a('0x2f')](function(_0x63b9be){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x1ed3be,_0x63b9be);});delete _0x568b83[_0x8a8a('0x9')][_0x1f36b6];};}});}else{logger['info'](_0x8a8a('0x30'),_0x1ed3be,_0x1f36b6,_0x4291e9);}});}})[_0x8a8a('0x2f')](function(_0x3ecbca){logger[_0x8a8a('0x31')](_0x8a8a('0x26'),_0x1ed3be,_0x568b83[_0x8a8a('0x7')][_0x4291e9][_0x8a8a('0x27')],_0x1f36b6,_0x4291e9);})[_0x8a8a('0x32')](function(){delete _0x568b83[_0x8a8a('0xa')][_0x1ed3be];});}catch(_0xf7d4d7){logger[_0x8a8a('0x31')](_0x8a8a('0x33'),_0xf7d4d7[_0x8a8a('0x34')]);}};Acw[_0x8a8a('0x19')][_0x8a8a('0x28')]=function(_0xac4c53){try{var _0x8e3017=this;if(_0x8e3017[_0x8a8a('0x9')][_0xac4c53]){_0x8e3017['timers'][_0xac4c53]['timer']=![];var _0x53da01=_0x8e3017[_0x8a8a('0x9')][_0xac4c53][_0x8a8a('0x35')];var _0x376de3=_0x8e3017[_0x8a8a('0x9')][_0xac4c53][_0x8a8a('0x2b')];var _0x508e67=_0x8e3017['voiceQueues'][_0x376de3][_0x8a8a('0x27')];logger['info'](_0x8a8a('0x36'),_0xac4c53);RpcUser['saveUnpause'](this['agents'][_0xac4c53]);RpcVoiceAgentReport[_0x8a8a('0x2d')]({'acwtime':_0x508e67,'agentacw':!![]},_0x53da01,_0xac4c53)[_0x8a8a('0x1e')](function(_0x285e2c){logger[_0x8a8a('0x21')](_0x8a8a('0x2e'),_0x53da01,_0x508e67,_0x285e2c);})[_0x8a8a('0x2f')](function(_0x20584a){logger['error'](_0x8a8a('0x37'),_0x53da01,_0x20584a);});}else{logger[_0x8a8a('0x31')](_0x8a8a('0x38'),_0xac4c53);if(_0x8e3017['timers']){logger[_0x8a8a('0x21')](_0x8a8a('0x39'),JSON[_0x8a8a('0x3a')](_0x8e3017['timers']));}}}catch(_0x3fda48){logger[_0x8a8a('0x31')](_0x8a8a('0x3b'),_0x3fda48[_0x8a8a('0x34')]);}};Acw[_0x8a8a('0x19')][_0x8a8a('0xc')]=function(_0x4ffdd9){try{if(this['voiceQueues'][_0x4ffdd9[_0x8a8a('0x2b')]]&&(this['voiceQueues'][_0x4ffdd9[_0x8a8a('0x2b')]][_0x8a8a('0x4')]||this['voiceQueues'][_0x4ffdd9['queue']][_0x8a8a('0x1c')])){if(this[_0x8a8a('0x8')][_0x4ffdd9[_0x8a8a('0x1a')]]){this[_0x8a8a('0xa')][_0x4ffdd9['uniqueid']]={'queue':_0x4ffdd9[_0x8a8a('0x2b')],'interface':_0x4ffdd9['interface'],'destlinkedid':_0x4ffdd9[_0x8a8a('0x24')]};}}}catch(_0x1629dc){logger['error'](_0x8a8a('0x3c'),_0x1629dc[_0x8a8a('0x34')]);}};Acw[_0x8a8a('0x19')]['syncAgentConnectPreview']=function(_0x177f89){try{if(this[_0x8a8a('0x7')][_0x177f89[_0x8a8a('0x2b')]]&&(this['voiceQueues'][_0x177f89['queue']][_0x8a8a('0x4')]||this[_0x8a8a('0x7')][_0x177f89[_0x8a8a('0x2b')]]['mandatoryDisposition'])){if(this[_0x8a8a('0x8')][_0x177f89[_0x8a8a('0x1a')]]){this[_0x8a8a('0xa')][_0x177f89[_0x8a8a('0x35')]]={'queue':_0x177f89[_0x8a8a('0x2b')],'interface':_0x177f89[_0x8a8a('0x1a')]};}}}catch(_0x13c233){logger[_0x8a8a('0x31')](_0x8a8a('0x3d'),_0x13c233[_0x8a8a('0x34')]);}};Acw[_0x8a8a('0x19')]['syncHangupRequest']=function(_0x1ad19b){try{if(this[_0x8a8a('0xa')][_0x1ad19b[_0x8a8a('0x35')]]&&_[_0x8a8a('0x3e')](this[_0x8a8a('0xa')][_0x1ad19b[_0x8a8a('0x35')]]['attended'])){logger[_0x8a8a('0x21')](_0x8a8a('0x3f'),_0x1ad19b[_0x8a8a('0x35')]);this[_0x8a8a('0x40')](_0x1ad19b['uniqueid']);}else if(this[_0x8a8a('0xa')][_0x1ad19b[_0x8a8a('0x41')]]&&_[_0x8a8a('0x3e')](this['channels'][_0x1ad19b['linkedid']][_0x8a8a('0x23')])){logger[_0x8a8a('0x21')](_0x8a8a('0x42'),_0x1ad19b[_0x8a8a('0x41')]);this[_0x8a8a('0x40')](_0x1ad19b[_0x8a8a('0x41')]);}}catch(_0x1d1b5c){logger[_0x8a8a('0x31')](_0x8a8a('0x43'),_0x1d1b5c['message']);}};Acw['prototype'][_0x8a8a('0x44')]=function(_0x10f689){try{if(this['channels'][_0x10f689['uniqueid']]&&this[_0x8a8a('0xa')][_0x10f689['uniqueid']][_0x8a8a('0x23')]){logger['info'](_0x8a8a('0x45'),_0x10f689[_0x8a8a('0x35')]);this[_0x8a8a('0x40')](_0x10f689[_0x8a8a('0x35')]);}else if(this[_0x8a8a('0xa')][_0x10f689[_0x8a8a('0x41')]]&&this[_0x8a8a('0xa')][_0x10f689[_0x8a8a('0x41')]][_0x8a8a('0x23')]){logger[_0x8a8a('0x21')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x10f689[_0x8a8a('0x41')]);this[_0x8a8a('0x40')](_0x10f689[_0x8a8a('0x41')]);}}catch(_0x1e3bf5){logger[_0x8a8a('0x31')]('[ACW][syncHangup]\x20%s',_0x1e3bf5[_0x8a8a('0x34')]);}};Acw[_0x8a8a('0x19')]['syncAttendedTransfer']=function(_0x5c5cb6){try{if(!_[_0x8a8a('0x46')](this[_0x8a8a('0xa')][_0x5c5cb6[_0x8a8a('0x47')]])){this[_0x8a8a('0x40')](_0x5c5cb6[_0x8a8a('0x47')]);if(this[_0x8a8a('0xa')][_0x5c5cb6['secondtransfereruniqueid']]){this['channels'][_0x5c5cb6['secondtransfereruniqueid']][_0x8a8a('0x23')]=!![];this['channels'][_0x5c5cb6[_0x8a8a('0x48')]]=this[_0x8a8a('0xa')][_0x5c5cb6['secondtransfereruniqueid']];delete this[_0x8a8a('0xa')][_0x5c5cb6[_0x8a8a('0x49')]];}}else if(!_[_0x8a8a('0x46')](this[_0x8a8a('0xa')][_0x5c5cb6['transfertargetuniqueid']])){this[_0x8a8a('0x40')](_0x5c5cb6['transfertargetuniqueid']);if(this[_0x8a8a('0xa')][_0x5c5cb6[_0x8a8a('0x4a')]]){this['channels'][_0x5c5cb6[_0x8a8a('0x4a')]][_0x8a8a('0x23')]=!![];this[_0x8a8a('0xa')][_0x5c5cb6[_0x8a8a('0x47')]]=this['channels'][_0x5c5cb6[_0x8a8a('0x4a')]];delete this[_0x8a8a('0xa')][_0x5c5cb6[_0x8a8a('0x4a')]];}}}catch(_0x5b029e){logger['error'](_0x8a8a('0x4b'),_0x5b029e['message']);}};Acw['prototype']['syncBlindTransfer']=function(_0x395564){try{if(this[_0x8a8a('0xa')][_0x395564['transfereruniqueid']]){logger[_0x8a8a('0x21')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON['stringify'](_0x395564[_0x8a8a('0x4c')]));this[_0x8a8a('0x40')](_0x395564['transfereruniqueid']);}else if(this[_0x8a8a('0xa')][_0x395564[_0x8a8a('0x4d')]]){logger[_0x8a8a('0x21')](_0x8a8a('0x4e'),JSON[_0x8a8a('0x3a')](_0x395564[_0x8a8a('0x4d')]));this['startAcw'](_0x395564[_0x8a8a('0x4d')]);}}catch(_0x402b5f){logger['error'](_0x8a8a('0x4f'),_0x402b5f[_0x8a8a('0x34')]);}};Acw[_0x8a8a('0x19')][_0x8a8a('0x50')]=function(_0x3c2f8d){try{if(this[_0x8a8a('0x7')][_0x3c2f8d[_0x8a8a('0x2b')]]&&this[_0x8a8a('0x7')][_0x3c2f8d[_0x8a8a('0x2b')]][_0x8a8a('0x51')]==='all'){if(this[_0x8a8a('0x8')][_0x3c2f8d[_0x8a8a('0x1a')]]){logger['info'](_0x8a8a('0x52'),_0x3c2f8d[_0x8a8a('0x35')],_0x3c2f8d[_0x8a8a('0x1a')],_0x3c2f8d[_0x8a8a('0x2b')]);return RpcUser[_0x8a8a('0x25')](this['agents'][_0x3c2f8d[_0x8a8a('0x1a')]],_0x8a8a('0x53'),_0x3c2f8d[_0x8a8a('0x35')]);}}}catch(_0x2984eb){logger[_0x8a8a('0x31')](_0x8a8a('0x54'),_0x2984eb[_0x8a8a('0x34')]);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 9c39563..1c26caf 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 _0x8555=['actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','inspect','then','log','asterisk-manager','bluebird','moment','util','lodash','ami','../../config/environment','asterisk','port','keepConnected','promisify','action','error','format','username','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','Action','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x8555,0x12d));var _0x5855=function(_0x28e308,_0x2ecc1d){_0x28e308=_0x28e308-0x0;var _0x4614b9=_0x8555[_0x28e308];return _0x4614b9;};'use strict';var Manager=require(_0x5855('0x0'));var BPromise=require(_0x5855('0x1'));var moment=require(_0x5855('0x2'));var util=require(_0x5855('0x3'));var _=require(_0x5855('0x4'));var logger=require('../../config/logger')(_0x5855('0x5'));var config=require(_0x5855('0x6'));var ami=new Manager(config[_0x5855('0x7')][_0x5855('0x8')],config[_0x5855('0x7')]['ip'],config['asterisk']['username'],config[_0x5855('0x7')]['password'],!![]);ami[_0x5855('0x9')]();ami['Action']=BPromise[_0x5855('0xa')](ami[_0x5855('0xb')]);function error(_0x485366){logger[_0x5855('0xc')](util[_0x5855('0xd')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x5855('0x7')][_0x5855('0xe')],config['asterisk']['ip'],config['asterisk']['port'],util['inspect'](_0x485366,![],null)));}function close(){logger[_0x5855('0xc')](util[_0x5855('0xd')](_0x5855('0xf'),config[_0x5855('0x7')][_0x5855('0xe')],config[_0x5855('0x7')]['ip'],config[_0x5855('0x7')][_0x5855('0x8')]));}ami[_0x5855('0x10')]=function(){return function(){return ami[_0x5855('0x11')]({'action':_0x5855('0x12')});};};ami[_0x5855('0x13')]=function(){return function(){return ami['Action']({'action':_0x5855('0x14')});};};ami[_0x5855('0x15')]=function(){return function(){return ami['Action']({'action':_0x5855('0x16')});};};ami[_0x5855('0x17')]=function(){return function(){return ami['Action']({'action':_0x5855('0x18')});};};ami[_0x5855('0x19')]=function(){return function(){return ami[_0x5855('0x11')]({'action':_0x5855('0x1a')});};};function connect(_0x423e29){logger[_0x5855('0x1b')](util[_0x5855('0xd')](_0x5855('0x1c'),config[_0x5855('0x7')][_0x5855('0xe')],config[_0x5855('0x7')]['ip'],config['asterisk'][_0x5855('0x8')]));ami[_0x5855('0x1d')](_0x5855('0xc'),error);ami[_0x5855('0x1d')](_0x5855('0x1e'),close);}ami['on'](_0x5855('0x1f'),connect);ami['on'](_0x5855('0x20'),function(_0x29699a){logger['info'](util[_0x5855('0xd')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0x5855('0xe')],config[_0x5855('0x7')]['ip'],config[_0x5855('0x7')][_0x5855('0x8')],util[_0x5855('0x21')](_0x29699a,![],null)));});ami['on']('fullybooted',function(_0x251181){logger[_0x5855('0x1b')](util[_0x5855('0xd')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config['asterisk']['username'],config[_0x5855('0x7')]['ip'],config[_0x5855('0x7')][_0x5855('0x8')]));return BPromise['resolve']()[_0x5855('0x22')](ami['actionSipShowRegistry']())[_0x5855('0x22')](ami[_0x5855('0x13')]())['then'](ami[_0x5855('0x15')]())[_0x5855('0x22')](ami[_0x5855('0x17')]())[_0x5855('0x22')](ami['actionCoreShowChannels']())['catch'](function(_0x57f8fb){console[_0x5855('0x23')](_0x57f8fb);});});ami[_0x5855('0x1d')](_0x5855('0xc'),error);ami[_0x5855('0x1d')](_0x5855('0x1e'),close);module['exports']=ami; \ No newline at end of file +var _0x77ca=['action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','actionDeviceStateList','devicestatelist','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','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','actionSipPeerStatus','catch','log','close','exports','asterisk-manager','bluebird','moment','util','lodash','asterisk','port','username','password','Action'];(function(_0x12a554,_0x3d7ef8){var _0x244ba0=function(_0x5eb5ff){while(--_0x5eb5ff){_0x12a554['push'](_0x12a554['shift']());}};_0x244ba0(++_0x3d7ef8);}(_0x77ca,0x107));var _0xa77c=function(_0x38a7b1,_0x4e6237){_0x38a7b1=_0x38a7b1-0x0;var _0x5308ec=_0x77ca[_0x38a7b1];return _0x5308ec;};'use strict';var Manager=require(_0xa77c('0x0'));var BPromise=require(_0xa77c('0x1'));var moment=require(_0xa77c('0x2'));var util=require(_0xa77c('0x3'));var _=require(_0xa77c('0x4'));var logger=require('../../config/logger')('ami');var config=require('../../config/environment');var ami=new Manager(config[_0xa77c('0x5')][_0xa77c('0x6')],config[_0xa77c('0x5')]['ip'],config[_0xa77c('0x5')][_0xa77c('0x7')],config[_0xa77c('0x5')][_0xa77c('0x8')],!![]);ami['keepConnected']();ami[_0xa77c('0x9')]=BPromise['promisify'](ami[_0xa77c('0xa')]);function error(_0xc8f1c5){logger[_0xa77c('0xb')](util[_0xa77c('0xc')](_0xa77c('0xd'),config[_0xa77c('0x5')]['username'],config[_0xa77c('0x5')]['ip'],config[_0xa77c('0x5')][_0xa77c('0x6')],util[_0xa77c('0xe')](_0xc8f1c5,![],null)));}function close(){logger['error'](util[_0xa77c('0xc')](_0xa77c('0xf'),config[_0xa77c('0x5')][_0xa77c('0x7')],config[_0xa77c('0x5')]['ip'],config['asterisk'][_0xa77c('0x6')]));}ami[_0xa77c('0x10')]=function(){return function(){return ami[_0xa77c('0x9')]({'action':'sipshowregistry'});};};ami[_0xa77c('0x11')]=function(){return function(){return ami[_0xa77c('0x9')]({'action':_0xa77c('0x12')});};};ami['actionSipPeerStatus']=function(){return function(){return ami['Action']({'action':_0xa77c('0x13')});};};ami[_0xa77c('0x14')]=function(){return function(){return ami[_0xa77c('0x9')]({'action':_0xa77c('0x15')});};};ami[_0xa77c('0x16')]=function(){return function(){return ami['Action']({'action':_0xa77c('0x17')});};};function connect(_0x1feb86){logger[_0xa77c('0x18')](util[_0xa77c('0xc')](_0xa77c('0x19'),config[_0xa77c('0x5')][_0xa77c('0x7')],config[_0xa77c('0x5')]['ip'],config['asterisk']['port']));ami[_0xa77c('0x1a')](_0xa77c('0xb'),error);ami[_0xa77c('0x1a')]('close',close);}ami['on'](_0xa77c('0x1b'),connect);ami['on'](_0xa77c('0x1c'),function(_0x495a52){logger[_0xa77c('0x18')](util[_0xa77c('0xc')](_0xa77c('0x1d'),config['asterisk']['username'],config[_0xa77c('0x5')]['ip'],config[_0xa77c('0x5')][_0xa77c('0x6')],util[_0xa77c('0xe')](_0x495a52,![],null)));});ami['on'](_0xa77c('0x1e'),function(_0x1bf496){logger[_0xa77c('0x18')](util[_0xa77c('0xc')](_0xa77c('0x1f'),config[_0xa77c('0x5')][_0xa77c('0x7')],config[_0xa77c('0x5')]['ip'],config[_0xa77c('0x5')]['port']));return BPromise[_0xa77c('0x20')]()['then'](ami[_0xa77c('0x10')]())['then'](ami[_0xa77c('0x11')]())[_0xa77c('0x21')](ami[_0xa77c('0x22')]())['then'](ami[_0xa77c('0x14')]())['then'](ami[_0xa77c('0x16')]())[_0xa77c('0x23')](function(_0x2a6b39){console[_0xa77c('0x24')](_0x2a6b39);});});ami['once']('error',error);ami[_0xa77c('0x1a')](_0xa77c('0x25'),close);module[_0xa77c('0x26')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 481a1b2..b8ac318 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 _0xa683=['message','exports','bluebird','../../config/logger','ami','client','http','Request','request','then','debug','memberReport','error','rpc'];(function(_0x498381,_0x122bfc){var _0x7e0ae8=function(_0x5b3414){while(--_0x5b3414){_0x498381['push'](_0x498381['shift']());}};_0x7e0ae8(++_0x122bfc);}(_0xa683,0x1a6));var _0x3a68=function(_0x53fbf1,_0x209ca1){_0x53fbf1=_0x53fbf1-0x0;var _0x269c6e=_0xa683[_0x53fbf1];return _0x269c6e;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x3a68('0x0'));var logger=require(_0x3a68('0x1'))(_0x3a68('0x2'));var client=jayson[_0x3a68('0x3')][_0x3a68('0x4')]({'port':0x2329});client[_0x3a68('0x5')]=function(_0x5f2e76,_0x2df154){return new BPromise(function(_0x5763d7,_0x1c32ab){return client[_0x3a68('0x6')](_0x5f2e76,_0x2df154)[_0x3a68('0x7')](function(_0x4d22b8){logger[_0x3a68('0x8')]('rpc',_0x3a68('0x9'),_0x5f2e76,_0x2df154,_0x4d22b8);if(_0x4d22b8[_0x3a68('0xa')]){logger[_0x3a68('0xa')](_0x3a68('0xb'),_0x3a68('0x9'),_0x5f2e76,_0x4d22b8[_0x3a68('0xa')]['message'],_0x2df154);return _0x1c32ab(_0x4d22b8[_0x3a68('0xa')][_0x3a68('0xc')]);}else{return _0x5763d7(_0x4d22b8['result']);}})['catch'](function(_0xb1e8f5){logger[_0x3a68('0xa')](_0x3a68('0xb'),_0x3a68('0x9'),_0x5f2e76,_0xb1e8f5,_0x2df154);return _0x1c32ab(_0xb1e8f5);});});};module[_0x3a68('0xd')]=client; \ No newline at end of file +var _0x8899=['http','Request','request','then','debug','rpc','memberReport','error','message','result','catch','jayson/promise','bluebird','../../config/logger','ami','client'];(function(_0xd93cbe,_0x11202e){var _0xe0bb40=function(_0x50f4cc){while(--_0x50f4cc){_0xd93cbe['push'](_0xd93cbe['shift']());}};_0xe0bb40(++_0x11202e);}(_0x8899,0xfb));var _0x9889=function(_0xa0cfa2,_0x57f72c){_0xa0cfa2=_0xa0cfa2-0x0;var _0x2f550e=_0x8899[_0xa0cfa2];return _0x2f550e;};'use strict';var jayson=require(_0x9889('0x0'));var BPromise=require(_0x9889('0x1'));var logger=require(_0x9889('0x2'))(_0x9889('0x3'));var client=jayson[_0x9889('0x4')][_0x9889('0x5')]({'port':0x2329});client[_0x9889('0x6')]=function(_0x50691a,_0x4638a7){return new BPromise(function(_0x5c600d,_0x4354f3){return client[_0x9889('0x7')](_0x50691a,_0x4638a7)[_0x9889('0x8')](function(_0x5f1b76){logger[_0x9889('0x9')](_0x9889('0xa'),_0x9889('0xb'),_0x50691a,_0x4638a7,_0x5f1b76);if(_0x5f1b76[_0x9889('0xc')]){logger[_0x9889('0xc')](_0x9889('0xa'),_0x9889('0xb'),_0x50691a,_0x5f1b76[_0x9889('0xc')]['message'],_0x4638a7);return _0x4354f3(_0x5f1b76['error'][_0x9889('0xd')]);}else{return _0x5c600d(_0x5f1b76[_0x9889('0xe')]);}})[_0x9889('0xf')](function(_0x9a5897){logger[_0x9889('0xc')]('rpc','memberReport',_0x50691a,_0x9a5897,_0x4638a7);return _0x4354f3(_0x9a5897);});});};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 1a3f930..53b76b5 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 _0x7a28=['getQueue','lodash','moment','isNil','string','uniqueid','name','Contact','firstName','lastName','number','phone','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','voiceQueue','substring','dialCutDigit'];(function(_0x13c32a,_0x473548){var _0x270ccd=function(_0xce9962){while(--_0xce9962){_0x13c32a['push'](_0x13c32a['shift']());}};_0x270ccd(++_0x473548);}(_0x7a28,0x1cd));var _0x87a2=function(_0x19cc3c,_0x2e721c){_0x19cc3c=_0x19cc3c-0x0;var _0x117a0f=_0x7a28[_0x19cc3c];return _0x117a0f;};'use strict';var util=require('util');var _=require(_0x87a2('0x0'));var moment=require(_0x87a2('0x1'));function checkNameSurname(_0x12c8da,_0x4c210f,_0x1a4ae1){var _0x123842='';if(!_[_0x87a2('0x2')](_0x4c210f)&&'string'===typeof _0x4c210f){_0x123842+=_0x4c210f;}if(!_[_0x87a2('0x2')](_0x1a4ae1)&&_0x87a2('0x3')===typeof _0x1a4ae1){_0x123842+='\x20'+_0x1a4ae1;}if(_0x123842!==''){return _0x123842;}return _0x12c8da;}function Action(_0x234b0f,_0x12b55a,_0x4c513b){this['voiceQueue']=_0x234b0f;this[_0x87a2('0x4')]=_0x4c513b||undefined;this[_0x87a2('0x5')]=checkNameSurname(_0x12b55a[_0x87a2('0x6')]['phone'],_0x12b55a[_0x87a2('0x6')][_0x87a2('0x7')],_0x12b55a[_0x87a2('0x6')][_0x87a2('0x8')]);this[_0x87a2('0x9')]=_0x12b55a['Contact'][_0x87a2('0xa')];this[_0x87a2('0xb')]=_0x234b0f[_0x87a2('0x5')];this['active']=_0x12b55a[_0x87a2('0xc')]||![];this[_0x87a2('0xd')]=_0x234b0f[_0x87a2('0xd')];this[_0x87a2('0xe')]=_0x234b0f['dialQueueTimeout']||0x3;this[_0x87a2('0xf')]=_0x12b55a[_0x87a2('0xf')];this[_0x87a2('0x10')]=_0x12b55a[_0x87a2('0x10')];this[_0x87a2('0x11')]=_0x12b55a[_0x87a2('0x11')];this['countnoanswerretry']=_0x12b55a[_0x87a2('0x12')];this[_0x87a2('0x13')]=_0x12b55a[_0x87a2('0x13')];this[_0x87a2('0x14')]=_0x12b55a[_0x87a2('0x14')];this['countabandonedretry']=_0x12b55a[_0x87a2('0x15')];this[_0x87a2('0x16')]=_0x12b55a['countmachineretry'];this['countagentrejectretry']=_0x12b55a[_0x87a2('0x17')];this[_0x87a2('0x18')]=_0x12b55a['ContactId'];this['ListId']=_0x12b55a[_0x87a2('0x19')];this[_0x87a2('0x1a')]=_0x12b55a[_0x87a2('0x1a')];this[_0x87a2('0x1b')]=_0x12b55a[_0x87a2('0x1b')];this[_0x87a2('0x1c')]=_0x12b55a[_0x87a2('0x1c')];this[_0x87a2('0x1d')]=_0x12b55a['id'];this[_0x87a2('0x1e')]=_0x12b55a[_0x87a2('0x6')][_0x87a2('0x7')]||'';this[_0x87a2('0x1f')]=moment()[_0x87a2('0x20')](_0x87a2('0x21'));this[_0x87a2('0x22')]=_0x12b55a[_0x87a2('0x22')];this[_0x87a2('0x23')]=_0x12b55a['callbackuniqueid'];this['callbackat']=_0x12b55a['callbackat'];this[_0x87a2('0x24')]=_0x12b55a['recallme'];this[_0x87a2('0x25')]='';this[_0x87a2('0x26')]='';}Action[_0x87a2('0x27')][_0x87a2('0x28')]=function(){return util['format'](_0x87a2('0x29'),this['name'],this[_0x87a2('0x2a')]['dialCutDigit']>0x0?this[_0x87a2('0x9')][_0x87a2('0x2b')](this[_0x87a2('0x2a')][_0x87a2('0x2c')]):this['number']);};Action['prototype'][_0x87a2('0x2d')]=function(){return this[_0x87a2('0xb')];};module['exports']=Action; \ No newline at end of file +var _0x2f3a=['callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','queue','exports','util','isNil','string','name','Contact','phone','lastName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','firstName','format','YYYY-MM-DD\x20HH:mm:ss','callback'];(function(_0x66643f,_0x3df440){var _0x57eb57=function(_0x14d66e){while(--_0x14d66e){_0x66643f['push'](_0x66643f['shift']());}};_0x57eb57(++_0x3df440);}(_0x2f3a,0xfb));var _0xa2f3=function(_0x21b432,_0x3b059d){_0x21b432=_0x21b432-0x0;var _0x16a6cb=_0x2f3a[_0x21b432];return _0x16a6cb;};'use strict';var util=require(_0xa2f3('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x18d845,_0x377db3,_0x5551cd){var _0x2b064c='';if(!_[_0xa2f3('0x1')](_0x377db3)&&_0xa2f3('0x2')===typeof _0x377db3){_0x2b064c+=_0x377db3;}if(!_['isNil'](_0x5551cd)&&_0xa2f3('0x2')===typeof _0x5551cd){_0x2b064c+='\x20'+_0x5551cd;}if(_0x2b064c!==''){return _0x2b064c;}return _0x18d845;}function Action(_0x589d0f,_0xfe0b09,_0x1ddec0){this['voiceQueue']=_0x589d0f;this['uniqueid']=_0x1ddec0||undefined;this[_0xa2f3('0x3')]=checkNameSurname(_0xfe0b09[_0xa2f3('0x4')][_0xa2f3('0x5')],_0xfe0b09[_0xa2f3('0x4')]['firstName'],_0xfe0b09[_0xa2f3('0x4')][_0xa2f3('0x6')]);this[_0xa2f3('0x7')]=_0xfe0b09[_0xa2f3('0x4')][_0xa2f3('0x5')];this['queue']=_0x589d0f[_0xa2f3('0x3')];this[_0xa2f3('0x8')]=_0xfe0b09['active']||![];this[_0xa2f3('0x9')]=_0x589d0f[_0xa2f3('0x9')];this[_0xa2f3('0xa')]=_0x589d0f['dialQueueTimeout']||0x3;this[_0xa2f3('0xb')]=_0xfe0b09[_0xa2f3('0xb')];this[_0xa2f3('0xc')]=_0xfe0b09[_0xa2f3('0xc')];this[_0xa2f3('0xd')]=_0xfe0b09[_0xa2f3('0xd')];this[_0xa2f3('0xe')]=_0xfe0b09[_0xa2f3('0xe')];this[_0xa2f3('0xf')]=_0xfe0b09['countnosuchnumberretry'];this[_0xa2f3('0x10')]=_0xfe0b09[_0xa2f3('0x10')];this[_0xa2f3('0x11')]=_0xfe0b09['countabandonedretry'];this[_0xa2f3('0x12')]=_0xfe0b09[_0xa2f3('0x12')];this['countagentrejectretry']=_0xfe0b09['countagentrejectretry'];this[_0xa2f3('0x13')]=_0xfe0b09[_0xa2f3('0x13')];this[_0xa2f3('0x14')]=_0xfe0b09[_0xa2f3('0x14')];this[_0xa2f3('0x15')]=_0xfe0b09[_0xa2f3('0x15')];this[_0xa2f3('0x16')]=_0xfe0b09[_0xa2f3('0x16')];this['CampaignId']=_0xfe0b09[_0xa2f3('0x17')];this[_0xa2f3('0x18')]=_0xfe0b09['id'];this['ContactFirstName']=_0xfe0b09['Contact'][_0xa2f3('0x19')]||'';this['starttime']=moment()[_0xa2f3('0x1a')](_0xa2f3('0x1b'));this['callback']=_0xfe0b09[_0xa2f3('0x1c')];this[_0xa2f3('0x1d')]=_0xfe0b09[_0xa2f3('0x1d')];this[_0xa2f3('0x1e')]=_0xfe0b09[_0xa2f3('0x1e')];this[_0xa2f3('0x1f')]=_0xfe0b09[_0xa2f3('0x1f')];this[_0xa2f3('0x20')]='';this['originatecalleridname']='';}Action[_0xa2f3('0x21')][_0xa2f3('0x22')]=function(){return util[_0xa2f3('0x1a')](_0xa2f3('0x23'),this[_0xa2f3('0x3')],this[_0xa2f3('0x24')][_0xa2f3('0x25')]>0x0?this['number']['substring'](this[_0xa2f3('0x24')][_0xa2f3('0x25')]):this[_0xa2f3('0x7')]);};Action[_0xa2f3('0x21')]['getQueue']=function(){return this[_0xa2f3('0x26')];};module[_0xa2f3('0x27')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 1bd7766..ec45b97 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 _0x39af=['countnosuchnumberretry','uniqueid','calleridname','number','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','answertime','endtime','membername','reason','callbackuniqueid','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','milliseconds','diff','state','statedesc','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x373b7e,_0x19a151){var _0x409f9e=function(_0x45ebfb){while(--_0x45ebfb){_0x373b7e['push'](_0x373b7e['shift']());}};_0x409f9e(++_0x19a151);}(_0x39af,0xdf));var _0xf39a=function(_0x4490fd,_0x44b20a){_0x4490fd=_0x4490fd-0x0;var _0x5002d6=_0x39af[_0x4490fd];return _0x5002d6;};'use strict';var util=require('util');var _=require(_0xf39a('0x0'));var moment=require('moment');function getSeconds(_0x115abb,_0x2fcd10){var _0x52ab2c=moment(_0x115abb)[_0xf39a('0x1')](0x0);var _0x45abc5=moment(_0x2fcd10)[_0xf39a('0x1')](0x0);return _0x52ab2c[_0xf39a('0x2')](_0x45abc5,'seconds');}function AgentComplete(_0x179e07,_0x378159){this[_0xf39a('0x3')]=0x4;this[_0xf39a('0x4')]=_0xf39a('0x5');this['scheduledat']=_0x179e07[_0xf39a('0x6')];this['type']=_0x179e07[_0xf39a('0x7')];this['campaigntype']=_0x179e07['type']===_0xf39a('0x8')?_0xf39a('0x9'):_0x179e07[_0xf39a('0x7')];this['countbusyretry']=_0x179e07[_0xf39a('0xa')];this[_0xf39a('0xb')]=_0x179e07[_0xf39a('0xb')];this[_0xf39a('0xc')]=_0x179e07[_0xf39a('0xc')];this['countglobal']=_0x179e07[_0xf39a('0xa')]+_0x179e07[_0xf39a('0xb')]+_0x179e07[_0xf39a('0xc')]+_0x179e07['countnosuchnumberretry']+_0x179e07[_0xf39a('0xd')]+_0x179e07[_0xf39a('0xe')]+_0x179e07[_0xf39a('0xf')]+_0x179e07[_0xf39a('0x10')];this[_0xf39a('0x11')]=_0x179e07[_0xf39a('0x11')];this[_0xf39a('0xd')]=_0x179e07[_0xf39a('0xd')];this[_0xf39a('0xe')]=_0x179e07[_0xf39a('0xe')];this[_0xf39a('0xf')]=_0x179e07[_0xf39a('0xf')];this['countagentrejectretry']=_0x179e07[_0xf39a('0x10')];this[_0xf39a('0x12')]=_0x378159[_0xf39a('0x12')];this[_0xf39a('0x13')]=_0x179e07['name'];this['calleridnum']=_0x179e07[_0xf39a('0x14')];this[_0xf39a('0x15')]=_0x179e07[_0xf39a('0x15')];this[_0xf39a('0x16')]=_0x179e07['responsetime'];this['answertime']=_0x179e07['answertime'];this['endtime']=moment()[_0xf39a('0x17')](_0xf39a('0x18'));this[_0xf39a('0x19')]=getSeconds(_0x179e07[_0xf39a('0x16')],_0x179e07[_0xf39a('0x15')]);this[_0xf39a('0x1a')]=getSeconds(_0x179e07[_0xf39a('0x1b')],_0x179e07['responsetime']);this['talktime']=getSeconds(this[_0xf39a('0x1c')],_0x179e07[_0xf39a('0x1b')]);this[_0xf39a('0x9')]=_0x378159['queue'];this[_0xf39a('0x1d')]=_0x378159['membername'];this[_0xf39a('0x1e')]=_0x378159[_0xf39a('0x1e')];this['callback']=_0x179e07['callback'];this[_0xf39a('0x1f')]=_0x179e07[_0xf39a('0x1f')];this['callbackat']=_0x179e07['callbackat'];this[_0xf39a('0x20')]=_0x179e07[_0xf39a('0x20')];this[_0xf39a('0x21')]=_0x179e07['ContactId'];this['ListId']=_0x179e07['ListId'];this['UserId']=_0x179e07[_0xf39a('0x22')];this[_0xf39a('0x23')]=_0x179e07[_0xf39a('0x23')];this[_0xf39a('0x24')]=_0x179e07[_0xf39a('0x24')];this[_0xf39a('0x25')]=_0x179e07[_0xf39a('0x25')]||'';this[_0xf39a('0x26')]=_0x179e07[_0xf39a('0x26')]||'';}module[_0xf39a('0x27')]=AgentComplete; \ No newline at end of file +var _0xe085=['lodash','moment','milliseconds','diff','state','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','ContactId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util'];(function(_0x325a28,_0x4fc547){var _0x2fc21e=function(_0x54628b){while(--_0x54628b){_0x325a28['push'](_0x325a28['shift']());}};_0x2fc21e(++_0x4fc547);}(_0xe085,0x1d8));var _0x5e08=function(_0x8cd7e0,_0xcbe78c){_0x8cd7e0=_0x8cd7e0-0x0;var _0xa7acc6=_0xe085[_0x8cd7e0];return _0xa7acc6;};'use strict';var util=require(_0x5e08('0x0'));var _=require(_0x5e08('0x1'));var moment=require(_0x5e08('0x2'));function getSeconds(_0x32d47d,_0x5b2078){var _0x4d837c=moment(_0x32d47d)[_0x5e08('0x3')](0x0);var _0xa9bb5d=moment(_0x5b2078)[_0x5e08('0x3')](0x0);return _0x4d837c[_0x5e08('0x4')](_0xa9bb5d,'seconds');}function AgentComplete(_0xb33098,_0x376092){this[_0x5e08('0x5')]=0x4;this['statedesc']=_0x5e08('0x6');this[_0x5e08('0x7')]=_0xb33098[_0x5e08('0x7')];this[_0x5e08('0x8')]=_0xb33098[_0x5e08('0x8')];this[_0x5e08('0x9')]=_0xb33098[_0x5e08('0x8')]===_0x5e08('0xa')?_0x5e08('0xb'):_0xb33098[_0x5e08('0x8')];this['countbusyretry']=_0xb33098[_0x5e08('0xc')];this[_0x5e08('0xd')]=_0xb33098[_0x5e08('0xd')];this[_0x5e08('0xe')]=_0xb33098[_0x5e08('0xe')];this[_0x5e08('0xf')]=_0xb33098[_0x5e08('0xc')]+_0xb33098['countcongestionretry']+_0xb33098[_0x5e08('0xe')]+_0xb33098[_0x5e08('0x10')]+_0xb33098[_0x5e08('0x11')]+_0xb33098['countabandonedretry']+_0xb33098[_0x5e08('0x12')]+_0xb33098[_0x5e08('0x13')];this[_0x5e08('0x10')]=_0xb33098['countnosuchnumberretry'];this[_0x5e08('0x11')]=_0xb33098[_0x5e08('0x11')];this[_0x5e08('0x14')]=_0xb33098[_0x5e08('0x14')];this[_0x5e08('0x12')]=_0xb33098['countmachineretry'];this[_0x5e08('0x13')]=_0xb33098[_0x5e08('0x13')];this[_0x5e08('0x15')]=_0x376092[_0x5e08('0x15')];this[_0x5e08('0x16')]=_0xb33098[_0x5e08('0x17')];this[_0x5e08('0x18')]=_0xb33098[_0x5e08('0x19')];this['starttime']=_0xb33098[_0x5e08('0x1a')];this[_0x5e08('0x1b')]=_0xb33098[_0x5e08('0x1b')];this[_0x5e08('0x1c')]=_0xb33098[_0x5e08('0x1c')];this[_0x5e08('0x1d')]=moment()[_0x5e08('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');this['ringtime']=getSeconds(_0xb33098[_0x5e08('0x1b')],_0xb33098[_0x5e08('0x1a')]);this[_0x5e08('0x1f')]=getSeconds(_0xb33098[_0x5e08('0x1c')],_0xb33098[_0x5e08('0x1b')]);this[_0x5e08('0x20')]=getSeconds(this['endtime'],_0xb33098[_0x5e08('0x1c')]);this[_0x5e08('0xb')]=_0x376092[_0x5e08('0xb')];this[_0x5e08('0x21')]=_0x376092['membername'];this[_0x5e08('0x22')]=_0x376092[_0x5e08('0x22')];this[_0x5e08('0x23')]=_0xb33098[_0x5e08('0x23')];this[_0x5e08('0x24')]=_0xb33098['callbackuniqueid'];this['callbackat']=_0xb33098[_0x5e08('0x25')];this['recallme']=_0xb33098['recallme'];this[_0x5e08('0x26')]=_0xb33098[_0x5e08('0x26')];this['ListId']=_0xb33098['ListId'];this['UserId']=_0xb33098['UserId'];this[_0x5e08('0x27')]=_0xb33098['VoiceQueueId'];this['CampaignId']=_0xb33098['CampaignId'];this[_0x5e08('0x28')]=_0xb33098['originatecalleridnum']||'';this['originatecalleridname']=_0xb33098[_0x5e08('0x29')]||'';}module[_0x5e08('0x2a')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 54b0121..e29ce1b 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 _0x4b8f=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme'];(function(_0x46667b,_0x350031){var _0x331eee=function(_0x26f1f2){while(--_0x26f1f2){_0x46667b['push'](_0x46667b['shift']());}};_0x331eee(++_0x350031);}(_0x4b8f,0x150));var _0xf4b8=function(_0x1ccd1e,_0x4abc12){_0x1ccd1e=_0x1ccd1e-0x0;var _0x307b96=_0x4b8f[_0x1ccd1e];return _0x307b96;};'use strict';var util=require(_0xf4b8('0x0'));var _=require(_0xf4b8('0x1'));var moment=require(_0xf4b8('0x2'));function getSeconds(_0x3f6708,_0x53be8c){var _0x191118=moment(_0x3f6708)[_0xf4b8('0x3')](0x0);var _0x12ac99=moment(_0x53be8c)[_0xf4b8('0x3')](0x0);return _0x191118[_0xf4b8('0x4')](_0x12ac99,_0xf4b8('0x5'));}function Final(_0x191665){this[_0xf4b8('0x6')]=_0x191665[_0xf4b8('0x6')];this['scheduledat']=_0x191665[_0xf4b8('0x7')];this['type']=_0x191665[_0xf4b8('0x8')];this[_0xf4b8('0x9')]=_0x191665[_0xf4b8('0x8')]===_0xf4b8('0xa')?_0xf4b8('0xb'):_0x191665[_0xf4b8('0x8')];this['countbusyretry']=_0x191665['countbusyretry'];this['countcongestionretry']=_0x191665[_0xf4b8('0xc')];this[_0xf4b8('0xd')]=_0x191665[_0xf4b8('0xd')];this[_0xf4b8('0xe')]=_0x191665[_0xf4b8('0xf')]+_0x191665[_0xf4b8('0xc')]+_0x191665[_0xf4b8('0xd')]+_0x191665['countnosuchnumberretry']+_0x191665[_0xf4b8('0x10')]+_0x191665[_0xf4b8('0x11')]+_0x191665['countmachineretry']+_0x191665[_0xf4b8('0x12')];this[_0xf4b8('0x13')]=_0x191665[_0xf4b8('0x13')];this[_0xf4b8('0x10')]=_0x191665[_0xf4b8('0x10')];this[_0xf4b8('0x11')]=_0x191665[_0xf4b8('0x11')];this[_0xf4b8('0x14')]=_0x191665[_0xf4b8('0x14')];this[_0xf4b8('0x12')]=_0x191665[_0xf4b8('0x12')];this['queue']=_0x191665['queue'];this[_0xf4b8('0x15')]=_0x191665[_0xf4b8('0x15')];this[_0xf4b8('0x16')]=_0x191665['calleridnum'];this[_0xf4b8('0x17')]=_0x191665['starttime'];this['responsetime']=_0x191665[_0xf4b8('0x18')];this[_0xf4b8('0x19')]=_0x191665[_0xf4b8('0x18')];this[_0xf4b8('0x1a')]=_0x191665[_0xf4b8('0x1a')]||0x0;this[_0xf4b8('0x1b')]=_0x191665[_0xf4b8('0x1b')]||0x0;this[_0xf4b8('0x1c')]=_0x191665[_0xf4b8('0x1c')]||0x0;this[_0xf4b8('0x1d')]=_0x191665[_0xf4b8('0x1d')];this[_0xf4b8('0x1e')]=_0x191665[_0xf4b8('0x1e')];this[_0xf4b8('0x1f')]=_0x191665[_0xf4b8('0x1f')];this[_0xf4b8('0x20')]=_0x191665[_0xf4b8('0x20')];this[_0xf4b8('0x21')]=_0x191665[_0xf4b8('0x21')];this[_0xf4b8('0x22')]=_0x191665['ListId'];this[_0xf4b8('0x23')]=_0x191665['UserId'];this[_0xf4b8('0x24')]=_0x191665['VoiceQueueId'];this[_0xf4b8('0x25')]=_0x191665[_0xf4b8('0x25')];this['originatecalleridnum']=_0x191665[_0xf4b8('0x26')]||'';this['originatecalleridname']=_0x191665[_0xf4b8('0x27')]||'';}module[_0xf4b8('0x28')]=Final; \ No newline at end of file +var _0xfb2e=['talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','diff','seconds','uniqueid','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime'];(function(_0x20a005,_0x3267c4){var _0x318723=function(_0x4dd1e8){while(--_0x4dd1e8){_0x20a005['push'](_0x20a005['shift']());}};_0x318723(++_0x3267c4);}(_0xfb2e,0x15a));var _0xefb2=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xfb2e[_0x4709c0];return _0x13348b;};'use strict';var util=require('util');var _=require(_0xefb2('0x0'));var moment=require(_0xefb2('0x1'));function getSeconds(_0x331ae2,_0x430ca4){var _0x1abd95=moment(_0x331ae2)['milliseconds'](0x0);var _0x186a49=moment(_0x430ca4)['milliseconds'](0x0);return _0x1abd95[_0xefb2('0x2')](_0x186a49,_0xefb2('0x3'));}function Final(_0x414a21){this[_0xefb2('0x4')]=_0x414a21[_0xefb2('0x4')];this[_0xefb2('0x5')]=_0x414a21['scheduledat'];this['type']=_0x414a21[_0xefb2('0x6')];this['campaigntype']=_0x414a21[_0xefb2('0x6')]==='outbound'?_0xefb2('0x7'):_0x414a21['type'];this[_0xefb2('0x8')]=_0x414a21['countbusyretry'];this[_0xefb2('0x9')]=_0x414a21[_0xefb2('0x9')];this[_0xefb2('0xa')]=_0x414a21[_0xefb2('0xa')];this[_0xefb2('0xb')]=_0x414a21[_0xefb2('0x8')]+_0x414a21[_0xefb2('0x9')]+_0x414a21[_0xefb2('0xa')]+_0x414a21[_0xefb2('0xc')]+_0x414a21[_0xefb2('0xd')]+_0x414a21[_0xefb2('0xe')]+_0x414a21['countmachineretry']+_0x414a21['countagentrejectretry'];this[_0xefb2('0xc')]=_0x414a21['countnosuchnumberretry'];this[_0xefb2('0xd')]=_0x414a21[_0xefb2('0xd')];this[_0xefb2('0xe')]=_0x414a21[_0xefb2('0xe')];this[_0xefb2('0xf')]=_0x414a21[_0xefb2('0xf')];this[_0xefb2('0x10')]=_0x414a21[_0xefb2('0x10')];this[_0xefb2('0x7')]=_0x414a21['queue'];this[_0xefb2('0x11')]=_0x414a21['calleridname'];this['calleridnum']=_0x414a21[_0xefb2('0x12')];this[_0xefb2('0x13')]=_0x414a21[_0xefb2('0x13')];this[_0xefb2('0x14')]=_0x414a21[_0xefb2('0x14')];this[_0xefb2('0x15')]=_0x414a21['responsetime'];this[_0xefb2('0x16')]=_0x414a21['ringtime']||0x0;this[_0xefb2('0x17')]=_0x414a21[_0xefb2('0x17')]||0x0;this[_0xefb2('0x18')]=_0x414a21[_0xefb2('0x18')]||0x0;this[_0xefb2('0x19')]=_0x414a21['callback'];this['callbackuniqueid']=_0x414a21[_0xefb2('0x1a')];this['callbackat']=_0x414a21[_0xefb2('0x1b')];this[_0xefb2('0x1c')]=_0x414a21[_0xefb2('0x1c')];this['ContactId']=_0x414a21[_0xefb2('0x1d')];this['ListId']=_0x414a21[_0xefb2('0x1e')];this[_0xefb2('0x1f')]=_0x414a21['UserId'];this[_0xefb2('0x20')]=_0x414a21[_0xefb2('0x20')];this[_0xefb2('0x21')]=_0x414a21[_0xefb2('0x21')];this[_0xefb2('0x22')]=_0x414a21[_0xefb2('0x22')]||'';this[_0xefb2('0x23')]=_0x414a21[_0xefb2('0x23')]||'';}module[_0xefb2('0x24')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 74ccf99..c2d68ff 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 _0x6f26=['number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','queue','membername','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','statedesc','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','name'];(function(_0x9e1d73,_0xcf6479){var _0x1ba603=function(_0x689c74){while(--_0x689c74){_0x9e1d73['push'](_0x9e1d73['shift']());}};_0x1ba603(++_0xcf6479);}(_0x6f26,0x1e3));var _0x66f2=function(_0x2a9eb1,_0x4b8bd7){_0x2a9eb1=_0x2a9eb1-0x0;var _0xed26a5=_0x6f26[_0x2a9eb1];return _0xed26a5;};'use strict';var util=require(_0x66f2('0x0'));var _=require(_0x66f2('0x1'));var moment=require(_0x66f2('0x2'));function getSeconds(_0x5f07d5,_0x127569){var _0x5e0ae3=moment(_0x5f07d5)[_0x66f2('0x3')](0x0);var _0x30f5a9=moment(_0x127569)['milliseconds'](0x0);return _0x5e0ae3[_0x66f2('0x4')](_0x30f5a9,_0x66f2('0x5'));}function Hangup(_0xabcac8,_0x24d77b){this['state']=0x4;this[_0x66f2('0x6')]='Answer';this[_0x66f2('0x7')]=_0xabcac8[_0x66f2('0x7')];this[_0x66f2('0x8')]=_0xabcac8[_0x66f2('0x8')];this[_0x66f2('0x9')]=_0xabcac8['type']===_0x66f2('0xa')?'queue':_0xabcac8[_0x66f2('0x8')];this['countbusyretry']=_0xabcac8[_0x66f2('0xb')];this[_0x66f2('0xc')]=_0xabcac8[_0x66f2('0xc')];this[_0x66f2('0xd')]=_0xabcac8[_0x66f2('0xd')];this['countglobal']=_0xabcac8['countbusyretry']+_0xabcac8[_0x66f2('0xc')]+_0xabcac8[_0x66f2('0xd')]+_0xabcac8[_0x66f2('0xe')]+_0xabcac8['countdropretry']+_0xabcac8[_0x66f2('0xf')]+_0xabcac8[_0x66f2('0x10')]+_0xabcac8[_0x66f2('0x11')];this[_0x66f2('0xe')]=_0xabcac8['countnosuchnumberretry'];this[_0x66f2('0x12')]=_0xabcac8[_0x66f2('0x12')];this[_0x66f2('0xf')]=_0xabcac8[_0x66f2('0xf')];this[_0x66f2('0x10')]=_0xabcac8[_0x66f2('0x10')];this[_0x66f2('0x11')]=_0xabcac8['countagentrejectretry'];this[_0x66f2('0x13')]=_0x24d77b[_0x66f2('0x13')];this['calleridname']=_0xabcac8[_0x66f2('0x14')];this['calleridnum']=_0xabcac8[_0x66f2('0x15')];this[_0x66f2('0x16')]=_0xabcac8[_0x66f2('0x16')];this[_0x66f2('0x17')]=_0xabcac8['responsetime'];this[_0x66f2('0x18')]=moment()[_0x66f2('0x19')](_0x66f2('0x1a'));this['ringtime']=getSeconds(_0xabcac8[_0x66f2('0x17')],_0xabcac8[_0x66f2('0x16')]);this[_0x66f2('0x1b')]=0x0;this['talktime']=getSeconds(this['endtime'],_0xabcac8[_0x66f2('0x17')]);this[_0x66f2('0x1c')]=_0xabcac8[_0x66f2('0x1c')];this[_0x66f2('0x1d')]=_0x66f2('0x1e');this['reason']=_0x24d77b[_0x66f2('0x1f')];this['callback']=_0xabcac8[_0x66f2('0x20')];this[_0x66f2('0x21')]=_0xabcac8[_0x66f2('0x21')];this[_0x66f2('0x22')]=_0xabcac8[_0x66f2('0x22')];this[_0x66f2('0x23')]=_0xabcac8[_0x66f2('0x23')];this[_0x66f2('0x24')]=_0xabcac8[_0x66f2('0x24')];this[_0x66f2('0x25')]=_0xabcac8[_0x66f2('0x25')];this[_0x66f2('0x26')]=_0xabcac8['UserId'];this['VoiceQueueId']=_0xabcac8[_0x66f2('0x27')];this[_0x66f2('0x28')]=_0xabcac8[_0x66f2('0x28')];}module[_0x66f2('0x29')]=Hangup; \ No newline at end of file +var _0xc9da=['responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','membername','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','milliseconds','diff','state','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime'];(function(_0x511739,_0x21ae0c){var _0x3fbbc4=function(_0xd0ee01){while(--_0xd0ee01){_0x511739['push'](_0x511739['shift']());}};_0x3fbbc4(++_0x21ae0c);}(_0xc9da,0x147));var _0xac9d=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xc9da[_0x4a747d];return _0x3a5b5c;};'use strict';var util=require(_0xac9d('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x1b40cf,_0x3a5b34){var _0x2ed5de=moment(_0x1b40cf)[_0xac9d('0x1')](0x0);var _0x1e064e=moment(_0x3a5b34)[_0xac9d('0x1')](0x0);return _0x2ed5de[_0xac9d('0x2')](_0x1e064e,'seconds');}function Hangup(_0x413de6,_0x2c4f81){this[_0xac9d('0x3')]=0x4;this[_0xac9d('0x4')]='Answer';this[_0xac9d('0x5')]=_0x413de6[_0xac9d('0x5')];this[_0xac9d('0x6')]=_0x413de6[_0xac9d('0x6')];this[_0xac9d('0x7')]=_0x413de6[_0xac9d('0x6')]===_0xac9d('0x8')?_0xac9d('0x9'):_0x413de6[_0xac9d('0x6')];this[_0xac9d('0xa')]=_0x413de6[_0xac9d('0xa')];this[_0xac9d('0xb')]=_0x413de6[_0xac9d('0xb')];this[_0xac9d('0xc')]=_0x413de6['countnoanswerretry'];this[_0xac9d('0xd')]=_0x413de6[_0xac9d('0xa')]+_0x413de6[_0xac9d('0xb')]+_0x413de6[_0xac9d('0xc')]+_0x413de6[_0xac9d('0xe')]+_0x413de6[_0xac9d('0xf')]+_0x413de6[_0xac9d('0x10')]+_0x413de6['countmachineretry']+_0x413de6[_0xac9d('0x11')];this['countnosuchnumberretry']=_0x413de6[_0xac9d('0xe')];this['countdropretry']=_0x413de6[_0xac9d('0xf')];this[_0xac9d('0x10')]=_0x413de6[_0xac9d('0x10')];this['countmachineretry']=_0x413de6[_0xac9d('0x12')];this[_0xac9d('0x11')]=_0x413de6[_0xac9d('0x11')];this[_0xac9d('0x13')]=_0x2c4f81[_0xac9d('0x13')];this[_0xac9d('0x14')]=_0x413de6[_0xac9d('0x15')];this[_0xac9d('0x16')]=_0x413de6[_0xac9d('0x17')];this[_0xac9d('0x18')]=_0x413de6[_0xac9d('0x18')];this[_0xac9d('0x19')]=_0x413de6[_0xac9d('0x19')];this[_0xac9d('0x1a')]=moment()[_0xac9d('0x1b')](_0xac9d('0x1c'));this['ringtime']=getSeconds(_0x413de6['responsetime'],_0x413de6['starttime']);this[_0xac9d('0x1d')]=0x0;this[_0xac9d('0x1e')]=getSeconds(this['endtime'],_0x413de6['responsetime']);this[_0xac9d('0x9')]=_0x413de6[_0xac9d('0x9')];this[_0xac9d('0x1f')]=_0xac9d('0x20');this[_0xac9d('0x21')]=_0x2c4f81['cause-txt'];this[_0xac9d('0x22')]=_0x413de6[_0xac9d('0x22')];this[_0xac9d('0x23')]=_0x413de6[_0xac9d('0x23')];this['callbackat']=_0x413de6[_0xac9d('0x24')];this[_0xac9d('0x25')]=_0x413de6[_0xac9d('0x25')];this[_0xac9d('0x26')]=_0x413de6['ContactId'];this[_0xac9d('0x27')]=_0x413de6['ListId'];this[_0xac9d('0x28')]=_0x413de6[_0xac9d('0x28')];this[_0xac9d('0x29')]=_0x413de6[_0xac9d('0x29')];this[_0xac9d('0x2a')]=_0x413de6[_0xac9d('0x2a')];}module[_0xac9d('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 27ad540..bce6de5 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 _0x824b=['calleridname','calleridnum','number','starttime','responsetime','endtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry'];(function(_0x2c2980,_0x34282a){var _0x2a20a9=function(_0x537b18){while(--_0x537b18){_0x2c2980['push'](_0x2c2980['shift']());}};_0x2a20a9(++_0x34282a);}(_0x824b,0x10e));var _0xb824=function(_0x33e2e7,_0x24e1b3){_0x33e2e7=_0x33e2e7-0x0;var _0x50f7c6=_0x824b[_0x33e2e7];return _0x50f7c6;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xb824('0x0'));function getSeconds(_0xa34dab,_0x2446f2){var _0x568bc=moment(_0xa34dab)[_0xb824('0x1')](0x0);var _0x165904=moment(_0x2446f2)[_0xb824('0x1')](0x0);return _0x568bc[_0xb824('0x2')](_0x165904,_0xb824('0x3'));}function History(_0x5c547b){this[_0xb824('0x4')]=_0x5c547b[_0xb824('0x4')];this['scheduledat']=_0x5c547b[_0xb824('0x5')]||undefined;this[_0xb824('0x6')]=_0x5c547b[_0xb824('0x6')];this['campaigntype']=_0x5c547b['type']===_0xb824('0x7')?_0xb824('0x8'):_0x5c547b[_0xb824('0x6')];this['countbusyretry']=_0x5c547b[_0xb824('0x9')];this[_0xb824('0xa')]=_0x5c547b['countcongestionretry'];this[_0xb824('0xb')]=_0x5c547b[_0xb824('0xb')];this[_0xb824('0xc')]=_0x5c547b[_0xb824('0x9')]+_0x5c547b['countcongestionretry']+_0x5c547b[_0xb824('0xb')]+_0x5c547b[_0xb824('0xd')]+_0x5c547b['countdropretry']+_0x5c547b[_0xb824('0xe')]+_0x5c547b[_0xb824('0xf')]+_0x5c547b[_0xb824('0x10')];this[_0xb824('0xd')]=_0x5c547b[_0xb824('0xd')];this[_0xb824('0x11')]=_0x5c547b['countdropretry'];this['countabandonedretry']=_0x5c547b[_0xb824('0xe')];this[_0xb824('0xf')]=_0x5c547b[_0xb824('0xf')];this['countagentrejectretry']=_0x5c547b[_0xb824('0x10')];this[_0xb824('0x8')]=_0x5c547b[_0xb824('0x8')];this[_0xb824('0x12')]=_0x5c547b['name'];this[_0xb824('0x13')]=_0x5c547b[_0xb824('0x14')];this[_0xb824('0x15')]=_0x5c547b[_0xb824('0x15')];this[_0xb824('0x16')]=_0x5c547b[_0xb824('0x16')];this[_0xb824('0x17')]=_0x5c547b[_0xb824('0x16')];this['ringtime']=getSeconds(_0x5c547b[_0xb824('0x16')],_0x5c547b[_0xb824('0x15')]);this['holdtime']=0x0;this['talktime']=0x0;this['callback']=_0x5c547b[_0xb824('0x18')];this[_0xb824('0x19')]=_0x5c547b[_0xb824('0x19')];this[_0xb824('0x1a')]=_0x5c547b[_0xb824('0x1a')];this['recallme']=_0x5c547b[_0xb824('0x1b')];this[_0xb824('0x1c')]=_0x5c547b[_0xb824('0x1c')];this[_0xb824('0x1d')]=_0x5c547b['ListId'];this[_0xb824('0x1e')]=_0x5c547b[_0xb824('0x1e')];this[_0xb824('0x1f')]=_0x5c547b[_0xb824('0x1f')];this['CampaignId']=_0x5c547b[_0xb824('0x20')];this[_0xb824('0x21')]=_0x5c547b['originatecalleridnum']||'';this[_0xb824('0x22')]=_0x5c547b[_0xb824('0x22')]||'';}module[_0xb824('0x23')]=History; \ No newline at end of file +var _0x8a62=['outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','exports','util','lodash','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype'];(function(_0xcac539,_0x21f8e5){var _0x23f53b=function(_0x41ca44){while(--_0x41ca44){_0xcac539['push'](_0xcac539['shift']());}};_0x23f53b(++_0x21f8e5);}(_0x8a62,0x130));var _0x28a6=function(_0x53727a,_0x1e44ee){_0x53727a=_0x53727a-0x0;var _0x4a9764=_0x8a62[_0x53727a];return _0x4a9764;};'use strict';var util=require(_0x28a6('0x0'));var _=require(_0x28a6('0x1'));var moment=require('moment');function getSeconds(_0x3bfdc7,_0x33ce9e){var _0x34b4d3=moment(_0x3bfdc7)[_0x28a6('0x2')](0x0);var _0x30393b=moment(_0x33ce9e)[_0x28a6('0x2')](0x0);return _0x34b4d3['diff'](_0x30393b,_0x28a6('0x3'));}function History(_0x1652fc){this[_0x28a6('0x4')]=_0x1652fc[_0x28a6('0x4')];this[_0x28a6('0x5')]=_0x1652fc[_0x28a6('0x5')]||undefined;this[_0x28a6('0x6')]=_0x1652fc[_0x28a6('0x6')];this[_0x28a6('0x7')]=_0x1652fc[_0x28a6('0x6')]===_0x28a6('0x8')?_0x28a6('0x9'):_0x1652fc[_0x28a6('0x6')];this[_0x28a6('0xa')]=_0x1652fc['countbusyretry'];this[_0x28a6('0xb')]=_0x1652fc['countcongestionretry'];this['countnoanswerretry']=_0x1652fc[_0x28a6('0xc')];this[_0x28a6('0xd')]=_0x1652fc[_0x28a6('0xa')]+_0x1652fc[_0x28a6('0xb')]+_0x1652fc[_0x28a6('0xc')]+_0x1652fc[_0x28a6('0xe')]+_0x1652fc[_0x28a6('0xf')]+_0x1652fc[_0x28a6('0x10')]+_0x1652fc[_0x28a6('0x11')]+_0x1652fc[_0x28a6('0x12')];this[_0x28a6('0xe')]=_0x1652fc[_0x28a6('0xe')];this[_0x28a6('0xf')]=_0x1652fc['countdropretry'];this[_0x28a6('0x10')]=_0x1652fc['countabandonedretry'];this[_0x28a6('0x11')]=_0x1652fc[_0x28a6('0x11')];this['countagentrejectretry']=_0x1652fc['countagentrejectretry'];this[_0x28a6('0x9')]=_0x1652fc[_0x28a6('0x9')];this[_0x28a6('0x13')]=_0x1652fc[_0x28a6('0x14')];this[_0x28a6('0x15')]=_0x1652fc[_0x28a6('0x16')];this[_0x28a6('0x17')]=_0x1652fc[_0x28a6('0x17')];this[_0x28a6('0x18')]=_0x1652fc[_0x28a6('0x18')];this[_0x28a6('0x19')]=_0x1652fc[_0x28a6('0x18')];this[_0x28a6('0x1a')]=getSeconds(_0x1652fc[_0x28a6('0x18')],_0x1652fc['starttime']);this['holdtime']=0x0;this[_0x28a6('0x1b')]=0x0;this[_0x28a6('0x1c')]=_0x1652fc['callback'];this[_0x28a6('0x1d')]=_0x1652fc['callbackuniqueid'];this[_0x28a6('0x1e')]=_0x1652fc[_0x28a6('0x1e')];this['recallme']=_0x1652fc[_0x28a6('0x1f')];this[_0x28a6('0x20')]=_0x1652fc[_0x28a6('0x20')];this[_0x28a6('0x21')]=_0x1652fc['ListId'];this[_0x28a6('0x22')]=_0x1652fc[_0x28a6('0x22')];this[_0x28a6('0x23')]=_0x1652fc[_0x28a6('0x23')];this[_0x28a6('0x24')]=_0x1652fc[_0x28a6('0x24')];this['originatecalleridnum']=_0x1652fc[_0x28a6('0x25')]||'';this['originatecalleridname']=_0x1652fc['originatecalleridname']||'';}module[_0x28a6('0x26')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 26fcebb..d0bc0eb 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 _0x8163=['ivrOriginated','queueBooked','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','agentcomplete','syncAgentComplete','syncNewExten','varset','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','NOT_ACTIVE','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','isEmpty','Intervals','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','type','outbound','strategy','available','loggedIn','pTalking','sumBillable','sumHoldTime','total','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','originated','erlangCalls','erlangBusyFactor','Trunk','active','format','voice_queue:save','campaign:save','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','info','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','clearing\x20variable\x20start\x20progressive','handlePredictive','ivr','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','hasOwnProperty','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','talking','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','state','endtime','prototype','clearZombieChannels','[uniqueid]','actions','isNil','status','channel','catch','No\x20such\x20channel','queue','[Dialer][checkChannel]','updateOriginated','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','saveInDb','merge','ContactId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','reachable','unmonitored','syncVarSet','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','statedesc','HangupInAMD','AMD','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','membername','amd','[syncMachine][createHistory]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AnswerAGI','[syncHangupIvr][createHistory]','cause-txt','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','YYYY-MM-DD\x20HH:mm:ss','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','Drop','dropreason','TIMEOUT','countdropretry','countglobal','add','dialDropRetryFrequency','minutes','ListId','[rescheduleContact][Drop]','starttime','calleridnum','log','CRIS\x20evt\x2010.2','CRIS\x20queueCallerAbandon\x2010.2','[syncAgentComplete][createHistory][10]','CALLEREXIT','countabandonedretry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','calleridname','CRIS\x20createHistory\x2011','actionid','locked','stateinterface','push','pick','queueStatusComplete','[booked][unlockQueueStatus]','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','finally','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','paused','unlockRR','contactAgent-idHopper:\x20','Agent:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','Action','command','iftime\x20%s,%s','interval','content','indexOf','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','Queue','method\x20not\x20recognized','launchHandleIvr','syncQueueSummary','dialGlobalInterval','dialTimezone','[syncQueueSummary]','[syncCampaigns]','\x5cw{0,','pow','replace','match','actionOriginate','object','voiceQueue\x20is\x20undefine','Contact','phone','originate','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','dialQueueOptions','NONE','dialer','ACTIVE','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-CAMPAIGNID','updatedAt','%s%s','XMD-','dialRandomLastDigitCallerIdNumber','callerid','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','[callProgressDetecting]\x20','checkRetriveMax','countbusyretry','countcongestionretry','countmachineretry','countnoanswerretry','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','countnosuchnumberretry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','countagentrejectretry','dialAgentRejectMaxRetry','callProgressDetecting','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','dialGlobalMaxRetry','stateGlobal','reason\x200\x20no\x20such\x20number....','createStateFinal','NoAnswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','Congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','AgentReject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','predictiveIntervalAvailable','round','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','[getDataPredictive]','predictiveIntervalTotalCalls','outboundQueuePauses','[CatchErlangB]','check\x20failure','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','booked','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','Agent','Contact\x20updated','[rescheduleContact][dialRecallInQueue]','RecallInQueue','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','temp','maxNumberOriginate','dialOrderByScheduledAt','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','checkContactBlack','[getContactCampaign2]','dialLimitQueue','not_inuse','Contact.phone','tryOriginatePredictive','RUNNING','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','m\x20=\x20','[abandonmentRate]','Amax\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]','interval\x20=\x20','exports','util','lodash','bluebird','uuid','moment','md5','../../../config/environment/','../../../config/logger','predictive','predictiveCalls','../ami','defaults','redis','localhost','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./final','./queueCallerAbandon','./hangup','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','enqueue','tail','sequence','preview','voiceQueues','campaigns','agents','trunks','channels','uniqueId','optionPredictive','startPredictive','startProgressive'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x8163,0x1d8));var _0x3816=function(_0x2fb704,_0x1be4fd){_0x2fb704=_0x2fb704-0x0;var _0x44c35e=_0x8163[_0x2fb704];return _0x44c35e;};'use strict';var util=require(_0x3816('0x0'));var _=require(_0x3816('0x1'));var BPromise=require(_0x3816('0x2'));var uuid=require(_0x3816('0x3'));var moment=require(_0x3816('0x4'));var rr=require('rr');var md5=require(_0x3816('0x5'));var Redis=require('ioredis');var config=require(_0x3816('0x6'));var logger=require(_0x3816('0x7'))('dialer');var loggerBooked=require(_0x3816('0x7'))('booked');var loggerPredictive=require(_0x3816('0x7'))(_0x3816('0x8'));var loggerPredictiveCalls=require(_0x3816('0x7'))(_0x3816('0x9'));var loggerSyncQueueSummary=require(_0x3816('0x7'))('syncQueueSummary');var ami=require(_0x3816('0xa'));config['redis']=_[_0x3816('0xb')](config[_0x3816('0xc')],{'host':_0x3816('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3816('0xc')]));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x3816('0xe'));var cmHopperHistory=require(_0x3816('0xf'));var cmHopperBlack=require(_0x3816('0x10'));var voiceQueueRt=require(_0x3816('0x11'));var Action=require('./action');var History=require('./history');var Final=require(_0x3816('0x12'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0x3816('0x13'));var Hangup=require(_0x3816('0x14'));var ipAgi=process['env'][_0x3816('0x15')]||_0x3816('0x16');var strategy={'rrmemory':_0x3816('0x17'),'roundrobin':_0x3816('0x18')};var Sequence=function(){};Sequence['prototype'][_0x3816('0x19')]=function(_0x232b5b){this[_0x3816('0x1a')]=this[_0x3816('0x1a')]?this[_0x3816('0x1a')]['finally'](_0x232b5b):_0x232b5b();};function Dialer(_0x427b32,_0x4a5588){this[_0x3816('0x1b')]=new Sequence();this[_0x3816('0x1c')]=_0x4a5588;this[_0x3816('0x1d')]=_0x427b32['voiceQueues'];this[_0x3816('0x1e')]=_0x427b32[_0x3816('0x1e')];this[_0x3816('0x1f')]=_0x427b32[_0x3816('0x1f')];this[_0x3816('0x20')]=_0x427b32[_0x3816('0x20')];this['maxNumberOriginate']=config['maxNumberOriginate']||0x2;this[_0x3816('0x21')]={};this['actions']={};this['contactsId']={};this[_0x3816('0x22')]={};this[_0x3816('0x23')]={};this[_0x3816('0x24')]={};this[_0x3816('0x25')]={};this[_0x3816('0x26')]={};this[_0x3816('0x27')]={};this['queueBookedRR']={};ami['on'](_0x3816('0x28'),this[_0x3816('0x29')][_0x3816('0x2a')](this));ami['on'](_0x3816('0x2b'),this[_0x3816('0x2c')][_0x3816('0x2a')](this));ami['on'](_0x3816('0x2d'),this['syncOriginateResponse'][_0x3816('0x2a')](this));ami['on'](_0x3816('0x2e'),this[_0x3816('0x2f')]['bind'](this));ami['on']('custom:queuesummary',this['syncQueueSummary'][_0x3816('0x2a')](this));ami['on']('hangup',this['syncHangup'][_0x3816('0x2a')](this));ami['on']('newexten',this[_0x3816('0x30')][_0x3816('0x2a')](this));ami['on'](_0x3816('0x31'),this['syncVarSet'][_0x3816('0x2a')](this));ami['on'](_0x3816('0x32'),this[_0x3816('0x33')][_0x3816('0x2a')](this));ami['on'](_0x3816('0x34'),this[_0x3816('0x35')]['bind'](this));this['loopCampaigns']();this[_0x3816('0x36')]();}function isNotNull(_0x46b7d6){return _0x46b7d6!==null&&!_[_0x3816('0x37')](_0x46b7d6);}function checkIsLoggedIn(_0x57f8f6,_0x29af50){return function(){if(_0x29af50<=0x0){_0x57f8f6[_0x3816('0x38')]=_0x3816('0x39');throw _0x57f8f6[_0x3816('0x3a')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x4aa45a){return _0x4aa45a;}function checkIsActive(_0x3c6c9f,_0x123030){return function(){if(!isActive(_0x123030)){_0x3c6c9f[_0x3816('0x38')]=_0x3816('0x3b');throw _0x3c6c9f[_0x3816('0x3a')]+'\x20NOT\x20Active';}};}function checkInterval(_0xcf67bd){return function(){if(!isNotNull(_0xcf67bd[_0x3816('0x3c')])){_0xcf67bd[_0x3816('0x38')]='INTERVAL_IS_NULL';throw _0xcf67bd['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0xcf67bd['Interval']['Intervals'])){_0xcf67bd['message']=_0x3816('0x3d');throw _0xcf67bd[_0x3816('0x3a')]+_0x3816('0x3e');}if(!isNotNull(_[_0x3816('0x3f')](_0xcf67bd[_0x3816('0x3c')][_0x3816('0x40')]))){_0xcf67bd[_0x3816('0x38')]=_0x3816('0x3d');throw _0xcf67bd[_0x3816('0x3a')]+_0x3816('0x3e');}};}function msgResponse(_0x979bfd,_0x21e892,_0x373c74){return{'action':_0x979bfd,'response':_0x21e892,'message':_0x373c74,'stack':_0x373c74};}function myreject(_0x41b94d){return function(_0x1f1fd3){return _0x41b94d(msgResponse(_0x3816('0x41'),_0x3816('0x42'),JSON[_0x3816('0x43')](_0x1f1fd3)));};}function getSeconds(_0x4ef95f,_0x2b5cf6){var _0x4a0c9d=moment(_0x4ef95f)[_0x3816('0x44')](0x0);var _0x32ecbe=moment(_0x2b5cf6)[_0x3816('0x44')](0x0);return _0x4a0c9d[_0x3816('0x45')](_0x32ecbe,_0x3816('0x46'));}function emit(_0x3a5b45,_0x29e2e1,_0x4d503c){io['to'](_0x3a5b45)[_0x3816('0x47')](_0x29e2e1,_0x4d503c);}function emitVoiceQueueSummary(_0x477944){if(_0x477944[_0x3816('0x48')]===_0x3816('0x49')){var _0x30b268={'id':_0x477944['id'],'name':_0x477944[_0x3816('0x3a')],'strategy':_0x477944[_0x3816('0x4a')],'answered':_0x477944['answered'],'available':_0x477944[_0x3816('0x4b')],'loggedIn':_0x477944[_0x3816('0x4c')],'pTalking':_0x477944[_0x3816('0x4d')],'sumBillable':_0x477944[_0x3816('0x4e')],'sumDuration':_0x477944['sumDuration'],'sumHoldTime':_0x477944[_0x3816('0x4f')]||0x0,'talking':_0x477944['talking'],'total':_0x477944[_0x3816('0x50')],'type':_0x477944['type'],'unmanaged':_0x477944['unmanaged'],'abandoned':_0x477944[_0x3816('0x51')],'waiting':_0x477944[_0x3816('0x52')],'loggedInDb':_0x477944[_0x3816('0x53')],'dialActive':_0x477944[_0x3816('0x54')],'dialMethod':_0x477944[_0x3816('0x55')],'dialOriginateCallerIdName':_0x477944[_0x3816('0x56')],'dialOriginateCallerIdNumber':_0x477944[_0x3816('0x57')],'dialOriginateTimeout':_0x477944[_0x3816('0x58')],'dialPrefix':_0x477944[_0x3816('0x59')],'outboundAnswerAgiCallsDay':_0x477944['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x477944[_0x3816('0x5a')],'outboundBlacklistCallsDay':_0x477944[_0x3816('0x5b')],'outboundBusyCallsDay':_0x477944[_0x3816('0x5c')],'outboundCongestionCallsDay':_0x477944[_0x3816('0x5d')],'outboundDropCallsDayACS':_0x477944['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x477944['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x477944[_0x3816('0x5e')],'outboundNoAnswerCallsDay':_0x477944[_0x3816('0x5f')],'outboundNoSuchCallsDay':_0x477944[_0x3816('0x60')],'outboundOriginateFailureCallsDay':_0x477944['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x477944[_0x3816('0x61')],'outboundRejectCallsDay':_0x477944[_0x3816('0x62')],'outboundUnknownCallsDay':_0x477944[_0x3816('0x63')],'predictiveIntervalAnsweredCalls':_0x477944[_0x3816('0x64')],'predictiveIntervalAvgHoldtime':_0x477944[_0x3816('0x65')],'predictiveIntervalAvgTalktime':_0x477944[_0x3816('0x66')],'predictiveIntervalDroppedCallsCallersExit':_0x477944[_0x3816('0x67')],'predictiveIntervalDroppedCallsTimeout':_0x477944[_0x3816('0x68')],'predictiveIntervalErlangCalls':_0x477944[_0x3816('0x69')],'predictiveIntervalErlangCallsDroppedCalls':_0x477944[_0x3816('0x6a')],'predictiveIntervalHitRate':_0x477944[_0x3816('0x6b')],'predictiveIntervalMultiplicativeFactor':_0x477944[_0x3816('0x6c')],'predictiveIntervalPauses':_0x477944[_0x3816('0x6d')],'predictiveIntervalAvailable':_0x477944['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x477944['predictiveIntervalTotalCalls'],'message':_0x477944[_0x3816('0x38')],'originated':_0x477944[_0x3816('0x6e')],'erlangCalls':_0x477944[_0x3816('0x6f')],'erlangCallToSecond':_0x477944['erlangCallToSecond'],'erlangAbandonmentRate':_0x477944['erlangAbandonmentRate'],'erlangBusyFactor':_0x477944[_0x3816('0x70')],'startPredictive':_0x477944[_0x3816('0x24')],'startProgressive':_0x477944[_0x3816('0x25')]};if(_0x477944[_0x3816('0x71')]){_0x30b268[_0x3816('0x71')]={'id':_0x477944[_0x3816('0x71')]['id'],'name':_0x477944[_0x3816('0x71')][_0x3816('0x3a')],'active':_0x477944[_0x3816('0x71')][_0x3816('0x72')],'callerid':_0x477944[_0x3816('0x71')]['callerid']};}if(_0x477944['Interval']){_0x30b268[_0x3816('0x3c')]={'id':_0x477944['Interval']['id'],'name':_0x477944[_0x3816('0x3c')][_0x3816('0x3a')]};}var _0x414ff7=md5(JSON[_0x3816('0x43')](_0x30b268));if(_0x477944[_0x3816('0x5')]!==_0x414ff7){_0x477944['md5']=_0x414ff7;emit(util[_0x3816('0x73')]('voice:queue:%s',_0x30b268[_0x3816('0x3a')]),_0x3816('0x74'),_0x30b268);}}}function emitCampaignSummary(_0x4ea558){if(_0x4ea558['type']==='ivr'){emit(util['format']('campaign:ivr:%s',_0x4ea558[_0x3816('0x3a')]),_0x3816('0x75'),_0x4ea558);}}function checkGetDataPredictive(_0x35588d){if(isNotNull(_0x35588d)){if(!_['isEmpty'](_0x35588d)){loggerPredictive['info'](_0x3816('0x76'));loggerPredictive['info'](_0x3816('0x77'),_0x35588d['predictiveIntervalTotalCalls']);loggerPredictive['info']('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x35588d[_0x3816('0x64')]);loggerPredictive[_0x3816('0x78')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x35588d[_0x3816('0x68')]);loggerPredictive[_0x3816('0x78')](_0x3816('0x79'),_0x35588d[_0x3816('0x67')]);loggerPredictive[_0x3816('0x78')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x35588d['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x3816('0x78')](_0x3816('0x7a'),_0x35588d['predictiveIntervalAvgTalktime']);loggerPredictive[_0x3816('0x78')]('---------------------------');if(_0x35588d['predictiveIntervalTotalCalls']>0x0){if(!_[_0x3816('0x37')](_0x35588d[_0x3816('0x66')])&&_0x35588d[_0x3816('0x66')]>0x0){return!![];}else{loggerPredictive[_0x3816('0x78')](_0x3816('0x7b'));}if(!_[_0x3816('0x37')](_0x35588d[_0x3816('0x65')])&&_0x35588d['predictiveIntervalAvgHoldtime']>0x0){return!![];}else{loggerPredictive[_0x3816('0x78')](_0x3816('0x7c'));}}else{loggerPredictive[_0x3816('0x78')](_0x3816('0x7d'));}}else{loggerPredictive[_0x3816('0x78')](_0x3816('0x7e'));}}else{loggerPredictive['info'](_0x3816('0x7e'));}return![];}function mergeDataErlangB(_0x8ffc43){return function(_0x5301c9){loggerPredictive['info']('---------\x20ErlangB\x20---------');loggerPredictive[_0x3816('0x78')](_0x3816('0x7f'),_0x5301c9['erlangCalls']);loggerPredictive[_0x3816('0x78')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5301c9[_0x3816('0x80')]);loggerPredictive[_0x3816('0x78')](_0x3816('0x81'),_0x5301c9['erlangAbandonmentRate']);loggerPredictive['info'](_0x3816('0x82'),_0x5301c9['erlangBusyFactor']);loggerPredictive[_0x3816('0x78')](_0x3816('0x81'),_0x5301c9[_0x3816('0x83')]);loggerPredictive[_0x3816('0x78')]('---------------------------');_['merge'](_0x8ffc43,_0x5301c9);};}function getDiff(_0xea78f0){var _0x26d789=moment()[_0x3816('0x44')](0x0);var _0x203c5d=moment(_0xea78f0)[_0x3816('0x44')](0x0);return _0x26d789[_0x3816('0x45')](_0x203c5d,_0x3816('0x46'));}function ifInterval(_0x43a6cb,_0x148c78){if(_[_0x3816('0x37')](_0x148c78)){return![];}if(getDiff(_0x148c78)<_0x43a6cb*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x3f3370){if(isNotNull(_0x3f3370)){if(!_['isUndefined'](_0x3f3370[_0x3816('0x25')])){_0x3f3370[_0x3816('0x25')]=undefined;loggerPredictive[_0x3816('0x78')](_0x3f3370['name'],_0x3816('0x84'));}if(!_['isUndefined'](_0x3f3370[_0x3816('0x24')])){_0x3f3370['startPredictive']=undefined;loggerPredictive[_0x3816('0x78')](_0x3f3370[_0x3816('0x3a')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0x3816('0x37')](_0x3f3370[_0x3816('0x85')])){clearInterval(_0x3f3370[_0x3816('0x85')]);_0x3f3370[_0x3816('0x85')]=undefined;loggerPredictive[_0x3816('0x78')](_0x3f3370[_0x3816('0x3a')],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x4c41c2,_0x3eef30){if(_0x3eef30===0x0){return 0x0;}var _0x37495a=0x1;for(var _0x42c0c2=0x1;_0x42c0c2<=_0x3eef30;_0x42c0c2+=0x1){_0x37495a=0x1+_0x37495a*_0x42c0c2/_0x4c41c2;}return 0x1/_0x37495a;}function isVoiceQueueOutbound(_0x4077d8){return _0x4077d8===_0x3816('0x49');}function isNotPreview(_0x3a75b0){return _0x3a75b0!==_0x3816('0x1c');}function isCampaignIvr(_0x50bf05){return _0x50bf05===_0x3816('0x86');}function getCallerId(_0x3ad040,_0x545185,_0x49c300){if(!_[_0x3816('0x37')](_0x49c300)&&_0x3816('0x87')===typeof _0x49c300&&!_[_0x3816('0x3f')](_0x49c300)){if(!_[_0x3816('0x37')](_0x545185)&&'string'===typeof _0x545185&&!_['isEmpty'](_0x545185)){return util['format'](_0x3816('0x88'),_0x545185,_0x49c300);}return util['format'](_0x3816('0x88'),_0x49c300,_0x49c300);}if(!_['isUndefined'](_0x3ad040)&&_0x3816('0x87')===typeof _0x3ad040&&!_['isEmpty'](_0x3ad040)){return _0x3ad040;}return _0x3816('0x89');}function loggerCatchQueueSummary(_0xdc8da9,_0x2febf6){return function(_0x495126){freeVariablesPredictive(_0x2febf6);emitVoiceQueueSummary(_0x2febf6);emitCampaignSummary(_0x2febf6);loggerSyncQueueSummary[_0x3816('0x8a')](_0xdc8da9,util[_0x3816('0x8b')](_0x495126,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x9acbb0,_0x351155){return function(_0x2460f4){loggerPredictive[_0x3816('0x8a')](_0x351155[_0x3816('0x3a')],_0x9acbb0);loggerPredictive[_0x3816('0x8a')](_0x2460f4[_0x3816('0x8c')]);freeVariablesPredictive(_0x351155);};}function loggerCatch(_0x388352){return function(_0x59c083){logger[_0x3816('0x8a')](_0x388352,util[_0x3816('0x8b')](_0x59c083,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x3485ce){return _0x3485ce&&!_[_0x3816('0x37')](_0x3485ce)&&_0x3485ce[_0x3816('0x8d')]>0x0;}function decremetOriginate(_0x3e05d6){if(!_[_0x3816('0x37')](_0x3e05d6)&&_0x3e05d6!==null){if(_0x3e05d6[_0x3816('0x8e')](_0x3816('0x6e'))){if(_0x3e05d6['originated']>0x0){_0x3e05d6[_0x3816('0x6e')]-=0x1;}else{logger['error'](_0x3816('0x8f'));}}}else{logger[_0x3816('0x8a')](_0x3816('0x90'));}}function checkContactLowerLimitOriginate(_0x60ba8e,_0x2ac293,_0x45b9a9){if(_0x2ac293>_0x45b9a9){for(var _0x54755b=0x0;_0x54755b<_0x2ac293-_0x45b9a9;_0x54755b+=0x1){decremetOriginate(_0x60ba8e);}}}function loggerGetContactDialer(_0x29f31a,_0x3274af,_0x5f2749){return function(_0x27f4b2){checkContactLowerLimitOriginate(_0x3274af,_0x5f2749,0x0);logger[_0x3816('0x8a')](_0x29f31a,util['inspect'](_0x27f4b2,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5cef66){return function(_0x495743){if(isNotNull(_0x495743)&&isNotNull(_0x495743[0x0])){if(_0x495743[0x0]['contactsRescheduled']>0x0){_0x5cef66[_0x3816('0x38')]='RESCHEDULED_CONTACTS';logger[_0x3816('0x78')](_0x3816('0x91')+_0x5cef66[_0x3816('0x3a')],_0x495743[0x0][_0x3816('0x92')],_0x3816('0x93'));}else{_0x5cef66[_0x3816('0x38')]=_0x3816('0x94');logger[_0x3816('0x78')]('[getContactDialer2][Empty]'+_0x5cef66[_0x3816('0x3a')]);}}};}function notSendMessagesQueue(_0x403558){if(_0x403558['sendMessageOneNotActive']){freeVariablesPredictive(_0x403558);if(_0x403558[_0x3816('0x6e')]===0x0&&_0x403558[_0x3816('0x95')]===0x0&&_0x403558[_0x3816('0x52')]===0x0&&(_0x403558['pTalking']||0x0)===0x0){_0x403558[_0x3816('0x96')]=![];_0x403558[_0x3816('0x4b')]=0x0;_0x403558['message']=_0x3816('0x3b');loggerSyncQueueSummary['error'](_0x3816('0x97'),_0x403558[_0x3816('0x3a')],_0x3816('0x98'));}else{_0x403558[_0x3816('0x38')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x3816('0x8a')](_0x3816('0x97'),_0x403558[_0x3816('0x3a')],'is\x20disactive');}emitVoiceQueueSummary(_0x403558);}}function notSendMessagesCampaign(_0x519566){if(_0x519566['sendMessageOneNotActive']){if(_0x519566['originated']===0x0){_0x519566[_0x3816('0x96')]=![];_0x519566[_0x3816('0x38')]='NOT_ACTIVE';loggerSyncQueueSummary['error'](_0x3816('0x99'),_0x519566[_0x3816('0x3a')],'is\x20not\x20active');}else{_0x519566['message']='IS_DISACTIVED';loggerSyncQueueSummary['error'](_0x3816('0x99'),_0x519566[_0x3816('0x3a')],_0x3816('0x9a'));}emitCampaignSummary(_0x519566);}}function createObjHistory(_0x86d5c6,_0x29d301,_0x3c29a1,_0x281564,_0x209477){_0x86d5c6[_0x3816('0x38')]=_0x3c29a1;var _0x51c0cd=new Action(_0x86d5c6,_0x29d301);var _0x1ab420=new History(_0x51c0cd);_0x1ab420[_0x3816('0x9b')]=_0x281564;_0x1ab420['statedesc']=_0x209477;_0x1ab420[_0x3816('0x9c')]=_0x51c0cd['starttime'];return _0x1ab420;}Dialer[_0x3816('0x9d')][_0x3816('0x36')]=function(){var _0x6f27ea=this;setInterval(function(){_0x6f27ea[_0x3816('0x9e')](_0x6f27ea[_0x3816('0x22')],_0x3816('0x9f'));_0x6f27ea['clearZombieChannels'](_0x6f27ea[_0x3816('0xa0')],'[actions]');},0x32c8);};Dialer['prototype'][_0x3816('0x9e')]=function(_0x5978ee,_0x1eeb42){var _0x4aca56=this;for(var _0x3f7747 in _0x5978ee){if(_0x5978ee['hasOwnProperty'](_0x3f7747)){this[_0x3816('0x1b')][_0x3816('0x19')](function(){if(!_[_0x3816('0xa1')](_0x5978ee[_0x3f7747])){return ami['Action']({'action':_0x3816('0xa2'),'channel':_0x5978ee[_0x3f7747][_0x3816('0xa3')]})[_0x3816('0xa4')](function(_0x56cd1c){if(_0x56cd1c[_0x3816('0x38')]===_0x3816('0xa5')){setTimeout(function(){if(_0x5978ee[_0x3f7747]&&_0x5978ee[_0x3f7747][_0x3816('0x48')]!==_0x3816('0x86')){_0x4aca56['updateOriginated'](_0x4aca56['voiceQueues'][_0x5978ee[_0x3f7747][_0x3816('0xa6')]]);logger[_0x3816('0x8a')](_0x3816('0xa7'),_0x1eeb42,_0x3f7747,_0x5978ee[_0x3f7747]['queue']);delete _0x5978ee[_0x3f7747];}if(_0x5978ee[_0x3f7747]&&_0x5978ee[_0x3f7747]['type']==='ivr'){_0x4aca56[_0x3816('0xa8')](_0x4aca56[_0x3816('0x1e')][_0x5978ee[_0x3f7747][_0x3816('0xa6')]]);logger['error'](_0x3816('0xa9'),_0x1eeb42,_0x3f7747,_0x5978ee[_0x3f7747][_0x3816('0xa6')]);delete _0x5978ee[_0x3f7747];}},0x2328);}});}});}}};Dialer[_0x3816('0x9d')][_0x3816('0xaa')]=function(_0x7b2bc0){return BPromise[_0x3816('0xab')]()[_0x3816('0xac')](cmHopper[_0x3816('0xaa')](_0x7b2bc0))[_0x3816('0xa4')](loggerCatch(_0x3816('0xad')));};Dialer[_0x3816('0x9d')][_0x3816('0xae')]=function(_0x5b066b){return BPromise[_0x3816('0xab')]()[_0x3816('0xac')](cmHopperBlack[_0x3816('0xae')](_0x5b066b))[_0x3816('0xa4')](loggerCatch(_0x3816('0xaf')));};Dialer[_0x3816('0x9d')]['checkIsBlackListIvr']=function(_0xab473a){return BPromise['resolve']()[_0x3816('0xac')](cmHopperBlack[_0x3816('0xb0')](_0xab473a))[_0x3816('0xa4')](loggerCatch(_0x3816('0xb1')));};Dialer[_0x3816('0x9d')][_0x3816('0xb2')]=function(_0x1a1a49){return BPromise[_0x3816('0xab')]()[_0x3816('0xac')](cmHopperHistory[_0x3816('0xb3')](_0x1a1a49))['catch'](loggerCatch(_0x3816('0xb4')));};Dialer[_0x3816('0x9d')][_0x3816('0xb5')]=function(_0x2dea29){return BPromise['resolve']()['then'](cmHopper[_0x3816('0xb5')](_0x2dea29))['catch'](loggerCatch(_0x3816('0xb6')));};Dialer['prototype'][_0x3816('0xb7')]=function(_0x231ffc,_0x3bd8d5,_0x6a87f7){return BPromise['resolve']()[_0x3816('0xac')](cmHopper[_0x3816('0xb7')](_0x231ffc,_0x3bd8d5,_0x6a87f7))[_0x3816('0xa4')](loggerCatch('[unlockContact]\x20'));};Dialer[_0x3816('0x9d')]['getContactDialer']=function(_0x45fc16,_0x420032,_0x40c833,_0x11ba79){return BPromise[_0x3816('0xab')]()[_0x3816('0xac')](cmHopper[_0x3816('0xb8')](_0x45fc16,_0x420032,_0x40c833,_0x11ba79))[_0x3816('0xa4')](loggerCatch(_0x3816('0xb9')));};Dialer['prototype'][_0x3816('0xba')]=function(_0x4cf5d6,_0x4360ee,_0x51f1b8){return BPromise[_0x3816('0xab')]()[_0x3816('0xac')](cmHopper[_0x3816('0xba')](_0x4cf5d6,_0x4360ee,_0x51f1b8))[_0x3816('0xa4')](loggerCatch(_0x3816('0xb9')));};Dialer[_0x3816('0x9d')]['getVoiceQueueRtPauses']=function(_0x4a3d81){return BPromise[_0x3816('0xab')]()[_0x3816('0xac')](voiceQueueRt[_0x3816('0xbb')](_0x4a3d81))[_0x3816('0xa4')](loggerCatch(_0x3816('0xbc')));};Dialer[_0x3816('0x9d')][_0x3816('0xbd')]=function(_0x52e68c){return BPromise[_0x3816('0xab')]()[_0x3816('0xac')](cmHopper[_0x3816('0xbd')](_0x52e68c))[_0x3816('0xa4')](loggerCatch(_0x3816('0xbe')));};Dialer[_0x3816('0x9d')][_0x3816('0xbf')]=function(_0x2dca57){return BPromise[_0x3816('0xab')]()[_0x3816('0xac')](cmHopperHistory['createHistory'](_0x2dca57))[_0x3816('0xa4')](loggerCatch('[createHistory]\x20'));};Dialer[_0x3816('0x9d')][_0x3816('0xa8')]=function(_0x59ca85){if(!_[_0x3816('0x37')](_0x59ca85)&&_0x59ca85!==null){if(_0x59ca85['hasOwnProperty'](_0x3816('0x6e'))){if(_0x59ca85['originated']>0x0){_0x59ca85['originated']-=0x1;}else{logger[_0x3816('0x8a')](_0x3816('0xc0'));}}}else{logger[_0x3816('0x8a')](_0x3816('0xc1'));}};Dialer['prototype'][_0x3816('0xc2')]=function(_0x1b1199,_0x38229d){var _0x157751=this;return function(_0x53a54b){_0x157751[_0x3816('0xa8')](_0x38229d);logger[_0x3816('0x8a')](_0x1b1199,util[_0x3816('0x8b')](_0x53a54b,{'showHidden':![],'depth':null}));};};Dialer[_0x3816('0x9d')]['emptyContact']=function(_0xe3c445,_0xaff41,_0xe283fd){var _0x3a7623={'state':0x19,'statedesc':'notFound'};this[_0x3816('0xa8')](_0xaff41);this[_0x3816('0xc3')](_[_0x3816('0xc4')](_0x3a7623,_['pick'](_0xe283fd,[_0x3816('0xc5'),'ListId',_0x3816('0xc6'),_0x3816('0xc7'),_0x3816('0xc8')])),_0x3816('0xc9'),_0x3816('0xca'));logger['error'](_0xe3c445);};Dialer[_0x3816('0x9d')][_0x3816('0xcb')]=function(_0xb1ba56){return _0xb1ba56===_0x3816('0xcc');};Dialer[_0x3816('0x9d')][_0x3816('0xcd')]=function(_0x5f36a5){return!_[_0x3816('0x37')](_0x5f36a5)&&_0x5f36a5&&!_[_0x3816('0x37')](_0x5f36a5[_0x3816('0x3a')])&&!_[_0x3816('0x37')](_0x5f36a5[_0x3816('0x72')])&&_0x5f36a5[_0x3816('0x72')]&&(this[_0x3816('0x20')][util[_0x3816('0x73')](_0x3816('0xce'),_0x5f36a5[_0x3816('0x3a')])][_0x3816('0xa2')]===_0x3816('0xcf')||this[_0x3816('0x20')][util['format']('SIP/%s',_0x5f36a5[_0x3816('0x3a')])][_0x3816('0xa2')]===_0x3816('0xd0'));};Dialer[_0x3816('0x9d')][_0x3816('0xc3')]=function(_0x41858d,_0x2d4c0f,_0x343bad){this[_0x3816('0xbf')](_0x41858d)['catch'](loggerCatch(_0x2d4c0f));this[_0x3816('0xbd')](_0x41858d)['catch'](loggerCatch(_0x343bad));};Dialer[_0x3816('0x9d')][_0x3816('0xd1')]=function(_0x527a48){var _0xb71d9e=this[_0x3816('0x22')][_0x527a48[_0x3816('0xd2')]];var _0x2ce84f;if(!_[_0x3816('0xa1')](_0x527a48)&&!_[_0x3816('0xa1')](_0x527a48['variable'])&&!_[_0x3816('0xa1')](_0x527a48[_0x3816('0xd3')][_0x3816('0xd4')])&&_0x527a48[_0x3816('0xd5')]===_0x3816('0xd6')&&_0xb71d9e){if(_0xb71d9e['type']!==_0x3816('0x86')&&this[_0x3816('0x1d')][_0xb71d9e['queue']][_0x3816('0xd7')]&&_0x527a48[_0x3816('0xd8')]===_0x3816('0xd9')){delete this[_0x3816('0x22')][_0x527a48[_0x3816('0xd2')]];this[_0x3816('0xa8')](this['voiceQueues'][_0xb71d9e[_0x3816('0xa6')]]);this[_0x3816('0x1d')][_0xb71d9e[_0x3816('0xa6')]][_0x3816('0x5a')]+=0x1;this[_0x3816('0x1d')][_0xb71d9e[_0x3816('0xa6')]][_0x3816('0xda')]+=0x1;_0x2ce84f=new Hangup(_0xb71d9e,_0x527a48);_0x2ce84f[_0x3816('0x9b')]=0x12;_0x2ce84f[_0x3816('0xdb')]=_0x3816('0xdc');_0x2ce84f['membername']=_0x3816('0xdd');this['saveInDb'](_0x2ce84f,_0x3816('0xde'),_0x3816('0xdf'));}if(_0xb71d9e[_0x3816('0x48')]!==_0x3816('0x86')&&this['voiceQueues'][_0xb71d9e[_0x3816('0xa6')]]['dialAMDActive']&&_0x527a48[_0x3816('0xd8')]===_0x3816('0xe0')){delete this[_0x3816('0x22')][_0x527a48[_0x3816('0xd2')]];this[_0x3816('0xa8')](this[_0x3816('0x1d')][_0xb71d9e[_0x3816('0xa6')]]);this['voiceQueues'][_0xb71d9e[_0x3816('0xa6')]][_0x3816('0x5a')]+=0x1;this[_0x3816('0x1d')][_0xb71d9e[_0x3816('0xa6')]][_0x3816('0xda')]+=0x1;_0x2ce84f=new Hangup(_0xb71d9e,_0x527a48);_0x2ce84f[_0x3816('0x9b')]=0x13;_0x2ce84f[_0x3816('0xdb')]='Machine';_0x2ce84f[_0x3816('0xe1')]='AMD';_0x2ce84f[_0x3816('0xe2')]=!![];this['saveInDb'](_0x2ce84f,_0x3816('0xe3'),'[syncMachine]');}if(_0xb71d9e[_0x3816('0x48')]===_0x3816('0x86')&&this[_0x3816('0x1e')][_0xb71d9e[_0x3816('0xa6')]][_0x3816('0xd7')]&&_0x527a48[_0x3816('0xd8')]==='HANGUP'){delete this[_0x3816('0x22')][_0x527a48[_0x3816('0xd2')]];this[_0x3816('0xa8')](this['campaigns'][_0xb71d9e[_0x3816('0xa6')]]);_0x2ce84f=new Hangup(_0xb71d9e,_0x527a48);_0x2ce84f[_0x3816('0x9b')]=0x12;_0x2ce84f[_0x3816('0xdb')]='HangupInAMD';_0x2ce84f[_0x3816('0xe1')]=_0x3816('0xdd');this[_0x3816('0xc3')](_0x2ce84f,_0x3816('0xe4'),_0x3816('0xe5'));}if(_0xb71d9e[_0x3816('0x48')]===_0x3816('0x86')&&this['campaigns'][_0xb71d9e[_0x3816('0xa6')]]['dialAMDActive']&&_0x527a48['value']==='MACHINE'){delete this[_0x3816('0x22')][_0x527a48[_0x3816('0xd2')]];this[_0x3816('0xa8')](this[_0x3816('0x1e')][_0xb71d9e[_0x3816('0xa6')]]);_0x2ce84f=new Hangup(_0xb71d9e,_0x527a48);_0x2ce84f[_0x3816('0x9b')]=0x13;_0x2ce84f[_0x3816('0xdb')]='Machine';_0x2ce84f[_0x3816('0xe1')]=_0x3816('0xdd');_0x2ce84f[_0x3816('0xe2')]=!![];this[_0x3816('0xc3')](_0x2ce84f,'[syncMachineIvr][createHistory]','[syncMachineIvr]');}}};Dialer[_0x3816('0x9d')]['syncHangup']=function(_0x4a5155){var _0x2e9abd=this[_0x3816('0x22')][_0x4a5155[_0x3816('0xd2')]];var _0x2f3c82=this;var _0x162ef4;if(_0x2e9abd&&_0x2e9abd[_0x3816('0x48')]===_0x3816('0x86')){delete this[_0x3816('0x22')][_0x4a5155['uniqueid']];this[_0x3816('0xa8')](this[_0x3816('0x1e')][_0x2e9abd[_0x3816('0xa6')]]);this[_0x3816('0x1e')][_0x2e9abd[_0x3816('0xa6')]][_0x3816('0xe6')]+=0x1;_0x162ef4=new Hangup(_0x2e9abd,_0x4a5155);this[_0x3816('0xbf')](_0x162ef4)[_0x3816('0xa4')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x3816('0xbd')](_0x162ef4)[_0x3816('0xa4')](loggerCatch(_0x3816('0xe7')));}if(_0x2e9abd&&_0x2e9abd[_0x3816('0x48')]!==_0x3816('0x86')&&isNotNull(this[_0x3816('0x1d')][_0x2e9abd[_0x3816('0xa6')]][_0x3816('0xe8')])){delete this[_0x3816('0x22')][_0x4a5155[_0x3816('0xd2')]];this[_0x3816('0xa8')](this['voiceQueues'][_0x2e9abd[_0x3816('0xa6')]]);this[_0x3816('0x1d')][_0x2e9abd[_0x3816('0xa6')]][_0x3816('0x5a')]+=0x1;this['voiceQueues'][_0x2e9abd[_0x3816('0xa6')]][_0x3816('0xda')]+=0x1;_0x162ef4=new Hangup(_0x2e9abd,_0x4a5155);_0x162ef4[_0x3816('0x9b')]=0x10;_0x162ef4['statedesc']=_0x3816('0xe9');_0x162ef4[_0x3816('0xe1')]='AGI';this[_0x3816('0xbf')](_0x162ef4)['catch'](loggerCatch(_0x3816('0xea')));this[_0x3816('0xbd')](_0x162ef4)['catch'](loggerCatch(_0x3816('0xe7')));}if(_0x2e9abd&&_0x2e9abd[_0x3816('0x48')]!==_0x3816('0x86')&&!isNotNull(this[_0x3816('0x1d')][_0x2e9abd[_0x3816('0xa6')]][_0x3816('0xe8')])){delete this[_0x3816('0x22')][_0x4a5155[_0x3816('0xd2')]];this['updateOriginated'](this['voiceQueues'][_0x2e9abd[_0x3816('0xa6')]]);this[_0x3816('0x1d')][_0x2e9abd['queue']][_0x3816('0x63')]+=0x1;_0x162ef4=new Hangup(_0x2e9abd,_0x4a5155);_0x162ef4[_0x3816('0x9b')]=0xc;_0x162ef4[_0x3816('0xdb')]=_0x4a5155[_0x3816('0xeb')];_0x162ef4[_0x3816('0xe1')]='Unknow';this[_0x3816('0xbf')](_0x162ef4)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0x162ef4)[_0x3816('0xa4')](loggerCatch(_0x3816('0xe7')));}};Dialer[_0x3816('0x9d')][_0x3816('0x2f')]=function(_0x494df7){var _0x8c5c9d=this['uniqueId'][_0x494df7[_0x3816('0xd2')]];var _0x3a01e5=this;if(this[_0x3816('0x1d')][_0x494df7['queue']]){if(_0x8c5c9d&&_0x8c5c9d[_0x3816('0x48')]!=='ivr'){delete this[_0x3816('0x22')][_0x494df7[_0x3816('0xd2')]];this['voiceQueues'][_0x494df7[_0x3816('0xa6')]]['outboundAnswerCallsDay']+=0x1;var _0xe756c5=new AgentComplete(_0x8c5c9d,_0x494df7);if(_0x494df7[_0x3816('0xec')]===_0x3816('0xed')){_0xe756c5[_0x3816('0xee')]=this[_0x3816('0x1d')][_0x494df7[_0x3816('0xa6')]][_0x3816('0xef')]&&this[_0x3816('0x1d')][_0x494df7[_0x3816('0xa6')]][_0x3816('0xf0')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0x3816('0xbf')](_0xe756c5)['catch'](loggerCatch(_0x3816('0xf1')));this[_0x3816('0xbd')](_0xe756c5)[_0x3816('0xa4')](loggerCatch(_0x3816('0xf2')));}}};Dialer[_0x3816('0x9d')][_0x3816('0x29')]=function(_0x5e891f){if(this['voiceQueues'][_0x5e891f['queue']]){if(this[_0x3816('0x22')][_0x5e891f[_0x3816('0xd2')]]&&this[_0x3816('0x22')][_0x5e891f[_0x3816('0xd2')]][_0x3816('0x48')]!=='ivr'){this[_0x3816('0xa8')](this['voiceQueues'][_0x5e891f[_0x3816('0xa6')]]);this[_0x3816('0x22')][_0x5e891f[_0x3816('0xd2')]][_0x3816('0xf3')]=moment()[_0x3816('0x73')](_0x3816('0xf4'));}}};Dialer['prototype'][_0x3816('0xf5')]=function(_0x4a894d){this[_0x3816('0xbf')](_0x4a894d)['catch'](loggerCatch(_0x3816('0xf1')));this[_0x3816('0xbd')](_0x4a894d)['catch'](loggerCatch(_0x3816('0xf6')));};Dialer[_0x3816('0x9d')][_0x3816('0x2c')]=function(_0x498286){var _0xcc439f=this[_0x3816('0x22')][_0x498286['uniqueid']];var _0x46be61=this;if(this[_0x3816('0x1d')][_0x498286['queue']]){if(_0xcc439f&&_0xcc439f[_0x3816('0x48')]!==_0x3816('0x86')){delete this[_0x3816('0x22')][_0x498286[_0x3816('0xd2')]];this['updateOriginated'](this[_0x3816('0x1d')][_0x498286['queue']]);_0xcc439f[_0x3816('0xf7')]=moment()[_0x3816('0x73')](_0x3816('0xf4'));var _0x5b59a1=new QueueCallerAbandon(_0xcc439f,_0x498286);if(getSeconds(_0xcc439f[_0x3816('0xf7')],_0xcc439f[_0x3816('0xf8')])>=_0xcc439f[_0x3816('0xf9')]){this[_0x3816('0x1d')][_0x498286[_0x3816('0xa6')]][_0x3816('0x68')]+=0x1;this[_0x3816('0x1d')][_0x498286[_0x3816('0xa6')]][_0x3816('0x5e')]+=0x1;this[_0x3816('0x1d')][_0x498286[_0x3816('0xa6')]][_0x3816('0x6a')]+=0x1;_0x5b59a1[_0x3816('0x9b')]=0xa;_0x5b59a1[_0x3816('0xdb')]=_0x3816('0xfa');_0x5b59a1[_0x3816('0xfb')]=_0x3816('0xfc');_0x5b59a1[_0x3816('0xee')]=this[_0x3816('0x1d')][_0x498286[_0x3816('0xa6')]][_0x3816('0xef')]?moment()[_0x3816('0x73')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x5b59a1[_0x3816('0xfd')]+=0x1;_0x5b59a1[_0x3816('0xfe')]+=0x1;if(_0x5b59a1[_0x3816('0xfd')]>=this[_0x3816('0x1d')][_0x498286[_0x3816('0xa6')]]['dialDropMaxRetry']){this[_0x3816('0xf5')](_0x5b59a1);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x5b59a1[_0x3816('0xfd')],'scheduledat':moment()[_0x3816('0xff')](this[_0x3816('0x1d')][_0x498286[_0x3816('0xa6')]][_0x3816('0x100')],_0x3816('0x101'))[_0x3816('0x73')](_0x3816('0xf4')),'ContactId':_0xcc439f['ContactId'],'ListId':_0xcc439f[_0x3816('0x102')],'VoiceQueueId':_0xcc439f[_0x3816('0xc7')]||undefined,'CampaignId':_0xcc439f[_0x3816('0xc8')]||undefined})[_0x3816('0xa4')](loggerCatch(_0x3816('0x103')));var _0x5c7595=new History(_0x5b59a1);_0x5c7595[_0x3816('0x9b')]=0xa;_0x5c7595[_0x3816('0xdb')]=_0x3816('0xfa');_0x5c7595['starttime']=moment()[_0x3816('0x73')]('YYYY-MM-DD\x20HH:mm:ss');_0x5c7595[_0x3816('0x9c')]=_0x5c7595[_0x3816('0x104')];_0x5c7595['calleridname']=_0x5b59a1['calleridname'];_0x5c7595[_0x3816('0x105')]=_0x5b59a1[_0x3816('0x105')];console[_0x3816('0x106')](_0x3816('0x107'),_0x498286);console[_0x3816('0x106')](_0x3816('0x108'),_0x5b59a1);console[_0x3816('0x106')]('CRIS\x20createHistory\x2010.2\x20',_0x5c7595);this[_0x3816('0xbf')](_0x5c7595)['catch'](loggerCatch(_0x3816('0x109')));}}else{this['voiceQueues'][_0x498286[_0x3816('0xa6')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x3816('0x1d')][_0x498286[_0x3816('0xa6')]]['outboundDropCallsDayCallersExit']+=0x1;_0x5b59a1['state']=0xb;_0x5b59a1['statedesc']='Abandoned';_0x5b59a1[_0x3816('0xfb')]=_0x3816('0x10a');_0x5b59a1[_0x3816('0x10b')]+=0x1;_0x5b59a1[_0x3816('0xfe')]+=0x1;if(_0x5b59a1[_0x3816('0x10b')]>=this[_0x3816('0x1d')][_0x498286[_0x3816('0xa6')]][_0x3816('0x10c')]){this[_0x3816('0xf5')](_0x5b59a1);}else{this[_0x3816('0xb5')]({'active':![],'countabandonedretry':_0x5b59a1[_0x3816('0x10b')],'scheduledat':moment()[_0x3816('0xff')](this[_0x3816('0x1d')][_0x498286[_0x3816('0xa6')]][_0x3816('0x10d')],'minutes')[_0x3816('0x73')](_0x3816('0xf4')),'ContactId':_0xcc439f[_0x3816('0xc5')],'ListId':_0xcc439f[_0x3816('0x102')],'VoiceQueueId':_0xcc439f[_0x3816('0xc7')]||undefined,'CampaignId':_0xcc439f[_0x3816('0xc8')]||undefined})['catch'](loggerCatch(_0x3816('0x10e')));var _0x5c7595=new History(_0x5b59a1);_0x5c7595[_0x3816('0x9b')]=0xb;_0x5c7595[_0x3816('0xdb')]='Abandoned';_0x5c7595[_0x3816('0x104')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5c7595[_0x3816('0x9c')]=_0x5c7595['starttime'];_0x5c7595[_0x3816('0x10f')]=_0x5b59a1['calleridname'];_0x5c7595[_0x3816('0x105')]=_0x5b59a1[_0x3816('0x105')];console['log'](_0x3816('0x110'),_0x5c7595);this[_0x3816('0xbf')](_0x5c7595)[_0x3816('0xa4')](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer[_0x3816('0x9d')][_0x3816('0x30')]=function(_0x3606b2){if(this[_0x3816('0xa0')][_0x3606b2[_0x3816('0xd2')]]){this['actions'][_0x3606b2[_0x3816('0xd2')]][_0x3816('0xa3')]=_0x3606b2['channel'];}if(this[_0x3816('0x22')][_0x3606b2[_0x3816('0xd2')]]){this[_0x3816('0x22')][_0x3606b2['uniqueid']][_0x3816('0xa3')]=_0x3606b2[_0x3816('0xa3')];}};Dialer[_0x3816('0x9d')][_0x3816('0x33')]=function(_0x4f243f){if(strategy[this[_0x3816('0x1d')][this[_0x3816('0xa0')][_0x4f243f[_0x3816('0x111')]][_0x3816('0xa6')]][_0x3816('0x4a')]]===_0x3816('0x18')){if(this[_0x3816('0xa0')][_0x4f243f[_0x3816('0x111')]]&&_[_0x3816('0xa1')](this[_0x3816('0xa0')][_0x4f243f[_0x3816('0x111')]][_0x3816('0x112')])&&_0x4f243f[_0x3816('0xa2')]==='1'&&_0x4f243f['paused']==='0'){if(this[_0x3816('0x1f')][_0x4f243f[_0x3816('0x113')]]){if(!this['agents'][_0x4f243f[_0x3816('0x113')]][_0x3816('0x112')]){this[_0x3816('0x1f')][_0x4f243f[_0x3816('0x113')]][_0x3816('0x112')]=!![];this['actions'][_0x4f243f[_0x3816('0x111')]]['locked']=!![];this[_0x3816('0xa0')][_0x4f243f[_0x3816('0x111')]]['stateinterface']=_0x4f243f[_0x3816('0x113')];}}}}else if((strategy[this[_0x3816('0x1d')][this[_0x3816('0xa0')][_0x4f243f[_0x3816('0x111')]][_0x3816('0xa6')]][_0x3816('0x4a')]]||_0x3816('0x17'))==='rrmemory'){if(this[_0x3816('0xa0')][_0x4f243f[_0x3816('0x111')]]){if(this[_0x3816('0x1f')][_0x4f243f[_0x3816('0x113')]]){this['actions'][_0x4f243f['actionid']][_0x3816('0x113')]=_0x4f243f[_0x3816('0x113')];if(_[_0x3816('0xa1')](this[_0x3816('0x27')][this[_0x3816('0xa0')][_0x4f243f[_0x3816('0x111')]][_0x3816('0xa6')]])){this[_0x3816('0x27')][this['actions'][_0x4f243f[_0x3816('0x111')]][_0x3816('0xa6')]]=[];}this['queueBooked'][this[_0x3816('0xa0')][_0x4f243f[_0x3816('0x111')]][_0x3816('0xa6')]][_0x3816('0x114')](_['merge'](_[_0x3816('0x115')](this[_0x3816('0xa0')][_0x4f243f['actionid']],['idHopper','stateinterface']),{'status':_0x4f243f[_0x3816('0xa2')],'paused':_0x4f243f['paused']}));}}}};function unlockQueueStatus(_0x3f07bd,_0x58a5b0){setTimeout(function(){if(_[_0x3816('0x37')](_0x3f07bd[_0x3816('0x116')])){loggerBooked[_0x3816('0x8a')]('[unlockQueueStatus][undefined]',_0x58a5b0);}_0x3f07bd[_0x3816('0x116')]=!![];loggerBooked[_0x3816('0x78')](_0x3816('0x117'),_0x58a5b0,JSON[_0x3816('0x43')](_['pick'](_0x3f07bd,['name','queueStatusComplete'])));},0x1f3);}Dialer[_0x3816('0x9d')]['syncQueueStatusComplete']=function(_0x5cb42b){var _0x3b46bf=this;var _0x2099ba=_0x3b46bf[_0x3816('0x1d')][_0x3b46bf['actions'][_0x5cb42b[_0x3816('0x111')]]['queue']];if(strategy[this['voiceQueues'][this[_0x3816('0xa0')][_0x5cb42b[_0x3816('0x111')]][_0x3816('0xa6')]]['strategy']]===_0x3816('0x18')){if(this[_0x3816('0xa0')][_0x5cb42b['actionid']]&&this[_0x3816('0xa0')][_0x5cb42b[_0x3816('0x111')]][_0x3816('0x113')]){this[_0x3816('0x1c')][_0x3816('0x118')](this['actions'][_0x5cb42b[_0x3816('0x111')]][_0x3816('0x119')],this[_0x3816('0xa0')][_0x5cb42b[_0x3816('0x111')]]['stateinterface'])[_0x3816('0xa4')](function(_0x8d29a1){logger[_0x3816('0x8a')](_0x3816('0x11a'),util[_0x3816('0x8b')](_0x8d29a1,{'showHidden':![],'depth':null}));})[_0x3816('0x11b')](function(){_0x3b46bf[_0x3816('0xa8')](_0x3b46bf[_0x3816('0x1d')][_0x3b46bf[_0x3816('0xa0')][_0x5cb42b[_0x3816('0x111')]][_0x3816('0xa6')]]);_0x3b46bf[_0x3816('0x1f')][_0x3b46bf[_0x3816('0xa0')][_0x5cb42b[_0x3816('0x111')]][_0x3816('0x113')]][_0x3816('0x112')]=![];delete _0x3b46bf[_0x3816('0xa0')][_0x5cb42b[_0x3816('0x111')]];unlockQueueStatus(_0x2099ba);});}else{this[_0x3816('0xa8')](this[_0x3816('0x1d')][this[_0x3816('0xa0')][_0x5cb42b['actionid']][_0x3816('0xa6')]]);this[_0x3816('0xb5')]({'active':![],'ContactId':this[_0x3816('0xa0')][_0x5cb42b[_0x3816('0x111')]][_0x3816('0xc5')],'ListId':this[_0x3816('0xa0')][_0x5cb42b[_0x3816('0x111')]][_0x3816('0x102')],'VoiceQueueId':this['actions'][_0x5cb42b[_0x3816('0x111')]][_0x3816('0xc7')]||undefined,'CampaignId':this[_0x3816('0xa0')][_0x5cb42b[_0x3816('0x111')]][_0x3816('0xc8')]||undefined})['catch'](loggerCatch(_0x3816('0x11c')));delete this[_0x3816('0xa0')][_0x5cb42b[_0x3816('0x111')]];unlockQueueStatus(_0x2099ba);}}else if((strategy[this['voiceQueues'][this[_0x3816('0xa0')][_0x5cb42b['actionid']]['queue']]['strategy']]||_0x3816('0x17'))===_0x3816('0x17')){var _0x3e234b;if(this[_0x3816('0xa0')][_0x5cb42b['actionid']]&&!_[_0x3816('0x3f')](this['queueBooked'][this[_0x3816('0xa0')][_0x5cb42b[_0x3816('0x111')]][_0x3816('0xa6')]])){if(this[_0x3816('0x11d')][_0x3b46bf[_0x3816('0xa0')][_0x5cb42b['actionid']]['queue']]){this[_0x3816('0x11d')][_0x3b46bf[_0x3816('0xa0')][_0x5cb42b[_0x3816('0x111')]][_0x3816('0xa6')]]=this[_0x3816('0x11d')][this[_0x3816('0xa0')][_0x5cb42b['actionid']]['queue']]?this[_0x3816('0x11d')][this['actions'][_0x5cb42b[_0x3816('0x111')]][_0x3816('0xa6')]]:this['queueBooked'][this[_0x3816('0xa0')][_0x5cb42b[_0x3816('0x111')]][_0x3816('0xa6')]]?this[_0x3816('0x27')][this[_0x3816('0xa0')][_0x5cb42b[_0x3816('0x111')]][_0x3816('0xa6')]][_0x3816('0x11e')]||0x0:0x0;}this[_0x3816('0x27')][this['actions'][_0x5cb42b['actionid']][_0x3816('0xa6')]][_0x3816('0x11e')]=this['queueBookedRR'][this['actions'][_0x5cb42b[_0x3816('0x111')]]['queue']];for(var _0x28c513=0x0;_0x28c513=0x0?!![]:![];})[_0x3816('0xa4')](myreject(_0x39b81e)));}}else{_0x4bbc1b[_0x3816('0x114')](ami[_0x3816('0x136')]({'action':_0x3816('0x137'),'command':util[_0x3816('0x73')](_0x3816('0x138'),_0x5ed2b7,!_[_0x3816('0x37')](config[_0x3816('0x132')][_0x5f1d18])?_0x5f1d18:'')})['then'](function(_0x377a9d){return _0x377a9d[_0x3816('0x13a')][_0x3816('0x13b')]('true')>=0x0?!![]:![];})['catch'](myreject(_0x39b81e)));}BPromise[_0x3816('0x13d')](_0x4bbc1b)[_0x3816('0xac')](function(_0x2a6b79){var _0x109db5=_[_0x3816('0x13e')](_0x2a6b79);if(_0x109db5){return _0x356577(_0x109db5);}else{_0x5996d1[_0x3816('0x38')]=_0x43219e?_0x3816('0x13f'):_0x3816('0x140');return _0x39b81e(msgResponse(_0x3816('0x141'),_0x3816('0x130'),_0x3816('0x142')+_0x43219e+'\x20'+_0x2ba114+_0x3816('0x143')+util[_0x3816('0x8b')](_0x5ed2b7,{'showHidden':![],'depth':null})+_0x3816('0x144')+_0x5f1d18));}})['catch'](function(_0x40c47f){return _0x39b81e(msgResponse('ifTime',_0x3816('0x130'),JSON['stringify'](_0x40c47f)));});});};Dialer['prototype'][_0x3816('0x145')]=function(_0x579e1c){var _0x17d3af=this;return function(){switch(_0x579e1c['dialMethod']){case _0x3816('0x146'):freeVariablesPredictive(_0x579e1c);_0x17d3af[_0x3816('0x147')](_0x579e1c,0x1);break;case _0x3816('0x148'):freeVariablesPredictive(_0x579e1c);_0x17d3af[_0x3816('0x147')](_0x579e1c,_0x579e1c['dialPowerLevel']);break;case'predictive':_0x17d3af[_0x3816('0x8')](_0x579e1c);break;case'booked':freeVariablesPredictive(_0x579e1c);_0x17d3af[_0x3816('0x147')](_0x579e1c,0x1);break;default:freeVariablesPredictive(_0x579e1c);logger[_0x3816('0x8a')](_0x3816('0x149'),_0x579e1c[_0x3816('0x3a')],_0x3816('0x14a'));}};};Dialer[_0x3816('0x9d')][_0x3816('0x14b')]=function(_0x5e1b34){var _0x50db87=this;return function(){_0x50db87['handleIvr'](_0x5e1b34);};};Dialer[_0x3816('0x9d')][_0x3816('0x14c')]=function(_0x24adb6){var _0x29ff28=this;if(isNotPreview(_0x24adb6[_0x3816('0x55')])){if(isVoiceQueueOutbound(_0x24adb6['type'])&&isActive(_0x24adb6[_0x3816('0x54')])){_0x24adb6['sendMessageOneNotActive']=!![];BPromise['resolve']()[_0x3816('0xac')](checkIsLoggedIn(_0x24adb6,_0x24adb6[_0x3816('0x4c')]))[_0x3816('0xac')](checkIsActive(_0x24adb6,_0x24adb6[_0x3816('0x54')]))['then'](checkInterval(_0x24adb6))[_0x3816('0xac')](_0x29ff28[_0x3816('0x129')](_0x24adb6))[_0x3816('0xac')](_0x29ff28[_0x3816('0x12d')](_0x24adb6[_0x3816('0x14d')],_0x24adb6[_0x3816('0x14e')],_0x24adb6[_0x3816('0x3a')],_0x24adb6))[_0x3816('0xac')](_0x29ff28[_0x3816('0x12f')](_0x24adb6[_0x3816('0x3c')],_0x24adb6[_0x3816('0x14e')],_0x24adb6[_0x3816('0x3a')],_0x24adb6))[_0x3816('0xac')](_0x29ff28[_0x3816('0x145')](_0x24adb6))[_0x3816('0xa4')](loggerCatchQueueSummary(_0x3816('0x14f'),_0x24adb6));}else{notSendMessagesQueue(_0x24adb6);}}else{freeVariablesPredictive(_0x24adb6);}};Dialer[_0x3816('0x9d')][_0x3816('0x128')]=function(){var _0x535174=this;var _0x108a44;for(var _0xc07e05 in this[_0x3816('0x1e')]){if(this['campaigns']['hasOwnProperty'](_0xc07e05)){_0x108a44=this[_0x3816('0x1e')][_0xc07e05];if(isCampaignIvr(_0x108a44['type'])&&isActive(_0x108a44[_0x3816('0x72')])){_0x108a44[_0x3816('0x96')]=!![];BPromise['resolve']()[_0x3816('0xac')](checkIsActive(_0x108a44,_0x108a44['active']))[_0x3816('0xac')](checkInterval(_0x108a44))['then'](_0x535174[_0x3816('0x129')](_0x108a44))[_0x3816('0xac')](_0x535174['checkIfTime'](_0x108a44[_0x3816('0x14d')],_0x108a44[_0x3816('0x14e')],_0x108a44[_0x3816('0x3a')],_0x108a44))[_0x3816('0xac')](_0x535174['checkIfTimeIntervals'](_0x108a44[_0x3816('0x3c')],_0x108a44[_0x3816('0x14e')],_0x108a44[_0x3816('0x3a')],_0x108a44))['then'](_0x535174[_0x3816('0x14b')](_0x108a44))[_0x3816('0xa4')](loggerCatchQueueSummary(_0x3816('0x150'),_0x108a44));}else{notSendMessagesCampaign(_0x108a44);}}}};function getCallerIdRandom(_0x1592ee,_0x43501b){var _0x4d9635,_0x16f799,_0x3585ee;if(_0x43501b<=0x0){_0x43501b=0x1;}_0x4d9635=new RegExp(_0x3816('0x151')+_0x43501b+'}$');_0x16f799=Math[_0x3816('0x152')](0xa,_0x43501b-0x1);_0x3585ee=Math[_0x3816('0x152')](0xa,_0x43501b)-0x1;return util[_0x3816('0x73')]('%s',_[_0x3816('0x153')](_0x1592ee,_0x4d9635,_['random'](_0x16f799,_0x3585ee)));}function extractCalleridName(_0x110246){var _0x24f0f4=_0x110246[_0x3816('0x154')](/"(.*?)"/);return _0x24f0f4?_0x24f0f4[0x1]:_0x110246;}function extractCalleridNumber(_0x25a1a3){var _0x37bfa6=_0x25a1a3[_0x3816('0x154')](/<(.*?)>/);return _0x37bfa6?_0x37bfa6[0x1]:_0x25a1a3;}Dialer[_0x3816('0x9d')][_0x3816('0x155')]=function(_0x5d8669,_0x472d19){var _0x119cf7=this;var _0x5d9e0d=uuid['v4']();this[_0x3816('0xa0')][_0x5d9e0d]=new Action(_0x5d8669,_0x472d19,_0x5d9e0d);return new BPromise(function(_0x3c0596,_0x49cc58){if(_[_0x3816('0x37')](_0x5d8669)&&_0x3816('0x156')!==typeof _0x5d8669){return _0x49cc58(msgResponse('originate',_0x3816('0x130'),_0x3816('0x157')));}if(_['isUndefined'](_0x472d19[_0x3816('0x158')][_0x3816('0x159')])||_0x472d19['Contact'][_0x3816('0x159')]===null){return _0x49cc58(msgResponse(_0x3816('0x15a'),_0x3816('0x130'),_0x3816('0x15b')));}var _0x33eb49={'XMD-CALLERID':_0x119cf7[_0x3816('0xa0')][_0x5d9e0d]['getCaller'](),'XMD-AGI':_0x5d8669[_0x3816('0xe8')]?util['format'](_0x3816('0x15c'),ipAgi,_0x5d8669[_0x3816('0xe8')]):'NONE','XMD-AGIAFTER':_0x5d8669[_0x3816('0xef')]?util[_0x3816('0x73')](_0x3816('0x15c'),ipAgi,_0x5d8669[_0x3816('0xef')]):'NONE','XMD-QUEUE':_0x5d8669[_0x3816('0x48')]==='outbound'?util[_0x3816('0x73')]('\x22%s,%s%s,,,%s\x22',_0x5d8669['name'],_0x5d8669[_0x3816('0x15d')]||'',_0x5d8669[_0x3816('0xf0')]?'c':'',_0x5d8669['dialQueueTimeout']||0x3):_0x3816('0x15e'),'XMD-CONTACTID':_0x472d19[_0x3816('0xc5')],'XMD-CDRTYPE':_0x3816('0x15f'),'CALLERID(all)':_0x119cf7[_0x3816('0xa0')][_0x5d9e0d]['getCaller'](),'XMD-AMD':_0x5d8669[_0x3816('0xd7')]?_0x3816('0x160'):_0x3816('0x15e'),'XMD-DESTINATION':_0x3816('0xd6')};if(_0x5d8669[_0x3816('0xd7')]){_0x33eb49[_0x3816('0x161')]=_0x5d8669['dialAMDInitialSilence']||0x9c4;_0x33eb49[_0x3816('0x162')]=_0x5d8669[_0x3816('0x163')]||0x5dc;_0x33eb49[_0x3816('0x164')]=_0x5d8669['dialAMDAfterGreetingSilence']||0x320;_0x33eb49['XMD-AMDTOTALANALYSISTIME']=_0x5d8669['dialAMDTotalAnalysisTime']||0x1388;_0x33eb49['XMD-AMDMINWORDLENGTH']=_0x5d8669[_0x3816('0x165')]||0x64;_0x33eb49[_0x3816('0x166')]=_0x5d8669['dialAMDBetweenWordsSilence']||0x32;_0x33eb49[_0x3816('0x167')]=_0x5d8669[_0x3816('0x168')]||0x3;_0x33eb49['XMD-AMDSILENCETHRESHOLD']=_0x5d8669[_0x3816('0x169')]||0x100;_0x33eb49[_0x3816('0x16a')]=_0x5d8669[_0x3816('0x16b')]||0x1388;}if(_0x5d8669[_0x3816('0x48')]===_0x3816('0x49')){_0x33eb49['XMD-VOICEQUEUEID']=_0x472d19[_0x3816('0xc7')];}else{_0x33eb49[_0x3816('0x16c')]=_0x472d19[_0x3816('0xc8')];}for(var _0x4669a1 in _0x472d19[_0x3816('0x158')]){if(_0x472d19[_0x3816('0x158')]['hasOwnProperty'](_0x4669a1)){if(isNotNull(_0x472d19[_0x3816('0x158')][_0x4669a1])&&_0x4669a1!=='id'&&_0x4669a1!=='tags'&&_0x4669a1!=='createdAt'&&_0x4669a1!==_0x3816('0x16d')){_0x33eb49[util[_0x3816('0x73')](_0x3816('0x16e'),_0x3816('0x16f'),_['toUpper'](_0x4669a1))]=_0x472d19[_0x3816('0x158')][_0x4669a1];}}}var _0x1cef4f=_0x119cf7[_0x3816('0xcd')](_0x5d8669[_0x3816('0x71')])?getCallerId(_0x5d8669[_0x3816('0x71')]['callerid'],_0x5d8669[_0x3816('0x56')],_0x5d8669['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x5d8669['dialOriginateCallerIdNumber'],_0x5d8669[_0x3816('0x170')]):_0x5d8669['dialOriginateCallerIdNumber']):getCallerId(_[_0x3816('0xa1')](_0x5d8669['TrunkBackup'])?_0x5d8669[_0x3816('0x71')][_0x3816('0x171')]:_0x5d8669[_0x3816('0x12a')]['callerid'],_0x5d8669[_0x3816('0x56')],_0x5d8669[_0x3816('0x170')]>0x0?getCallerIdRandom(_0x5d8669[_0x3816('0x57')],_0x5d8669[_0x3816('0x170')]):_0x5d8669[_0x3816('0x57')]);if(_0x1cef4f){_0x33eb49[_0x3816('0x172')]=_0x119cf7['actions'][_0x5d9e0d][_0x3816('0x173')]=extractCalleridName(_0x1cef4f);_0x33eb49[_0x3816('0x174')]=_0x119cf7['actions'][_0x5d9e0d][_0x3816('0x175')]=extractCalleridNumber(_0x1cef4f);}return ami[_0x3816('0x136')]({'actionid':_0x5d9e0d,'action':_0x3816('0x15a'),'channel':_0x119cf7['isTrunkReachable'](_0x5d8669[_0x3816('0x71')])?util['format'](_0x3816('0x176'),_0x5d8669[_0x3816('0x71')][_0x3816('0x3a')],isNotNull(_0x5d8669[_0x3816('0x59')])?_0x5d8669[_0x3816('0x59')][_0x3816('0x177')]()||'':'',_0x5d8669[_0x3816('0x178')]>0x0?_0x472d19[_0x3816('0x158')]['phone'][_0x3816('0x179')](_0x5d8669[_0x3816('0x178')]):_0x472d19[_0x3816('0x158')][_0x3816('0x159')]):util[_0x3816('0x73')](_0x3816('0x176'),_[_0x3816('0xa1')](_0x5d8669[_0x3816('0x12a')])?_0x5d8669[_0x3816('0x71')][_0x3816('0x3a')]:_0x5d8669[_0x3816('0x12a')][_0x3816('0x3a')],isNotNull(_0x5d8669[_0x3816('0x59')])?_0x5d8669[_0x3816('0x59')][_0x3816('0x177')]()||'':'',_0x5d8669[_0x3816('0x178')]>0x0?_0x472d19[_0x3816('0x158')][_0x3816('0x159')][_0x3816('0x179')](_0x5d8669['dialCutDigit']):_0x472d19[_0x3816('0x158')]['phone']),'callerid':_0x1cef4f,'Exten':'xcally-motion-dialer','Context':_0x3816('0x17a'),'Priority':'1','variable':_0x33eb49,'timeout':(_0x5d8669['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x5d9e0d})[_0x3816('0xac')](function(_0x2ad350){return _0x3c0596(_0x2ad350);})[_0x3816('0xa4')](function(_0x2fcaf6){_0x5d8669[_0x3816('0x17b')]+=0x1;var _0x2a8fef=new History(_0x119cf7[_0x3816('0xa0')][_0x5d9e0d]);logger[_0x3816('0x8a')](util[_0x3816('0x73')](_0x3816('0x17c'),JSON['stringify'](_0x2fcaf6)));_0x2a8fef['state']=0xe;_0x2a8fef[_0x3816('0xdb')]=_0x3816('0x17d');_0x2a8fef[_0x3816('0x104')]=moment()[_0x3816('0x73')]('YYYY-MM-DD\x20HH:mm:ss');_0x2a8fef[_0x3816('0x9c')]=_0x2a8fef['starttime'];_0x119cf7[_0x3816('0xbf')](_0x2a8fef)['catch'](loggerCatch(_0x3816('0x17e')));_0x119cf7['moveContactManagedDialer'](_0x2a8fef)[_0x3816('0xa4')](loggerCatch(_0x3816('0x17e')))[_0x3816('0x11b')](function(){delete _0x119cf7[_0x3816('0xa0')][_0x5d9e0d];return _0x49cc58(msgResponse('originate','Error',_0x3816('0x17f')));});});});};Dialer[_0x3816('0x9d')]['syncOriginateResponse']=function(_0x449a67){var _0x28e6fe=this[_0x3816('0xa0')][_0x449a67['actionid']];var _0x284b5e=this;if(_0x28e6fe){delete this[_0x3816('0xa0')][_0x449a67[_0x3816('0x111')]];_0x28e6fe['responsetime']=moment()[_0x3816('0x73')](_0x3816('0xf4'));var _0x2c078b=_0x28e6fe['type']===_0x3816('0x86')?this[_0x3816('0x1e')][_0x28e6fe[_0x3816('0xa6')]]:this[_0x3816('0x1d')][_0x28e6fe['getQueue']()];if(!this[_0x3816('0xcb')](_0x449a67['response'])){this[_0x3816('0xa8')](_0x2c078b);return this['callProgressDetecting'](_0x28e6fe,_0x2c078b,_0x449a67)[_0x3816('0xac')](function(_0x5cfd6b){})[_0x3816('0xa4')](loggerCatch(_0x3816('0x180')));}else{this[_0x3816('0x22')][_0x449a67[_0x3816('0xd2')]]=_0x28e6fe;}}};Dialer[_0x3816('0x9d')][_0x3816('0x181')]=function(_0x19a53f,_0x462fcb,_0x1c98d2){var _0x659e55=new History(_0x462fcb);if(_0x659e55[_0x3816('0x182')]+_0x659e55[_0x3816('0x183')]+_0x659e55['countnoanswerretry']+_0x659e55['countnosuchnumberretry']+_0x659e55[_0x3816('0xfd')]+_0x659e55[_0x3816('0x10b')]+_0x659e55[_0x3816('0x184')]+_0x659e55['countagentrejectretry']>=_0x1c98d2['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x19a53f){case 0x3:if(_0x659e55[_0x3816('0x185')]>=_0x1c98d2[_0x3816('0x186')]-0x1){return!![];}else{this[_0x3816('0xb5')]({'active':![],'countnoanswerretry':_0x659e55['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x3816('0xff')](_0x1c98d2['dialNoAnswerRetryFrequency'],'minutes')['format'](_0x3816('0xf4')),'ContactId':_0x659e55[_0x3816('0xc5')],'ListId':_0x659e55['ListId'],'VoiceQueueId':_0x659e55['VoiceQueueId']||undefined,'CampaignId':_0x659e55[_0x3816('0xc8')]||undefined})['catch'](loggerCatch(_0x3816('0x187')));}break;case 0x5:if(_0x659e55[_0x3816('0x182')]>=_0x1c98d2['dialBusyMaxRetry']-0x1){return!![];}else{this[_0x3816('0xb5')]({'active':![],'countbusyretry':_0x659e55[_0x3816('0x182')]+=0x1,'scheduledat':moment()[_0x3816('0xff')](_0x1c98d2[_0x3816('0x188')],_0x3816('0x101'))[_0x3816('0x73')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x659e55['ContactId'],'ListId':_0x659e55[_0x3816('0x102')],'VoiceQueueId':_0x659e55[_0x3816('0xc7')]||undefined,'CampaignId':_0x659e55['CampaignId']||undefined})['catch'](loggerCatch(_0x3816('0x189')));}break;case 0x8:if(_0x659e55['countcongestionretry']>=_0x1c98d2[_0x3816('0x18a')]-0x1){return!![];}else{this[_0x3816('0xb5')]({'active':![],'countcongestionretry':_0x659e55['countcongestionretry']+=0x1,'scheduledat':moment()[_0x3816('0xff')](_0x1c98d2[_0x3816('0x18b')],_0x3816('0x101'))[_0x3816('0x73')](_0x3816('0xf4')),'ContactId':_0x659e55[_0x3816('0xc5')],'ListId':_0x659e55[_0x3816('0x102')],'VoiceQueueId':_0x659e55['VoiceQueueId']||undefined,'CampaignId':_0x659e55[_0x3816('0xc8')]||undefined})['catch'](loggerCatch(_0x3816('0x18c')));}break;case 0x0:if(_0x659e55['countnosuchnumberretry']>=_0x1c98d2[_0x3816('0x18d')]-0x1){return!![];}else{this[_0x3816('0xb5')]({'active':![],'countnosuchnumberretry':_0x659e55[_0x3816('0x18e')]+=0x1,'scheduledat':moment()[_0x3816('0xff')](_0x1c98d2[_0x3816('0x18f')],_0x3816('0x101'))[_0x3816('0x73')](_0x3816('0xf4')),'ContactId':_0x659e55[_0x3816('0xc5')],'ListId':_0x659e55[_0x3816('0x102')],'VoiceQueueId':_0x659e55[_0x3816('0xc7')]||undefined,'CampaignId':_0x659e55[_0x3816('0xc8')]||undefined})[_0x3816('0xa4')](loggerCatch(_0x3816('0x190')));}break;case 0xa:if(_0x659e55['countdropretry']>=_0x1c98d2[_0x3816('0x191')]-0x1){return!![];}else{this[_0x3816('0xb5')]({'active':![],'countdropretry':_0x659e55[_0x3816('0xfd')]+=0x1,'scheduledat':moment()[_0x3816('0xff')](_0x1c98d2[_0x3816('0x100')],_0x3816('0x101'))['format'](_0x3816('0xf4')),'ContactId':_0x659e55['ContactId'],'ListId':_0x659e55[_0x3816('0x102')],'VoiceQueueId':_0x659e55[_0x3816('0xc7')]||undefined,'CampaignId':_0x659e55[_0x3816('0xc8')]||undefined})[_0x3816('0xa4')](loggerCatch(_0x3816('0x103')));}break;case 0xb:if(_0x659e55[_0x3816('0x10b')]>=_0x1c98d2['dialAbandonedMaxRetry']-0x1){return!![];}else{this[_0x3816('0xb5')]({'active':![],'countabandonedretry':_0x659e55[_0x3816('0x10b')]+=0x1,'scheduledat':moment()[_0x3816('0xff')](_0x1c98d2[_0x3816('0x10d')],_0x3816('0x101'))['format'](_0x3816('0xf4')),'ContactId':_0x659e55[_0x3816('0xc5')],'ListId':_0x659e55[_0x3816('0x102')],'VoiceQueueId':_0x659e55[_0x3816('0xc7')]||undefined,'CampaignId':_0x659e55[_0x3816('0xc8')]||undefined})[_0x3816('0xa4')](loggerCatch('[rescheduleContact][Abandoned]'));}break;case 0x13:if(_0x659e55['countmachineretry']>=_0x1c98d2[_0x3816('0x192')]-0x1){return!![];}else{this[_0x3816('0xb5')]({'active':![],'countmachineretry':_0x659e55[_0x3816('0x184')]+=0x1,'scheduledat':moment()[_0x3816('0xff')](_0x1c98d2[_0x3816('0x193')],_0x3816('0x101'))['format'](_0x3816('0xf4')),'ContactId':_0x659e55[_0x3816('0xc5')],'ListId':_0x659e55[_0x3816('0x102')],'VoiceQueueId':_0x659e55['VoiceQueueId']||undefined,'CampaignId':_0x659e55[_0x3816('0xc8')]||undefined})[_0x3816('0xa4')](loggerCatch('[rescheduleContact][Machine]'));}break;case 0x14:if(_0x659e55[_0x3816('0x194')]>=_0x1c98d2[_0x3816('0x195')]-0x1){return!![];}else{this[_0x3816('0xb5')]({'active':![],'countagentrejectretry':_0x659e55[_0x3816('0x194')]+=0x1,'scheduledat':moment()['add'](_0x1c98d2['dialAgentRejectRetryFrequency'],_0x3816('0x101'))['format'](_0x3816('0xf4')),'ContactId':_0x659e55[_0x3816('0xc5')],'ListId':_0x659e55[_0x3816('0x102')],'VoiceQueueId':_0x659e55[_0x3816('0xc7')]||undefined,'CampaignId':_0x659e55[_0x3816('0xc8')]||undefined})[_0x3816('0xa4')](loggerCatch('[rescheduleContact][AgentReject]'));}break;default:return!![];}};Dialer[_0x3816('0x9d')][_0x3816('0x196')]=function(_0x1b93de,_0x457924,_0x1c0a5f){var _0x73024=this;var _0x1ad2bc=new History(_0x1b93de);return new BPromise(function(_0x1a70c6,_0x2287b1){if(_['isUndefined'](_0x457924)&&_0x3816('0x156')!==typeof _0x457924){return _0x2287b1(msgResponse(_0x3816('0x197'),'Failure',_0x3816('0x198')));}if(_[_0x3816('0x37')](_0x1c0a5f)&&_0x3816('0x156')!==typeof _0x1c0a5f){return _0x2287b1(msgResponse('[callProgressDetecting]','Failure',_0x3816('0x199')));}switch(_0x1c0a5f[_0x3816('0xec')]){case'0':_0x457924[_0x3816('0x60')]+=0x1;_0x1ad2bc[_0x3816('0x9b')]=0x0;_0x1ad2bc[_0x3816('0xdb')]=_0x3816('0x19a');_0x1ad2bc[_0x3816('0x18e')]+=0x1;_0x1ad2bc['countglobal']+=0x1;_0x73024[_0x3816('0xbf')](_0x1ad2bc)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x73024[_0x3816('0x181')](0x0,_0x1b93de,_0x457924)){if(_0x1ad2bc['countbusyretry']+_0x1ad2bc[_0x3816('0x183')]+_0x1ad2bc['countnoanswerretry']+_0x1ad2bc[_0x3816('0x18e')]+_0x1ad2bc[_0x3816('0xfd')]+_0x1ad2bc['countabandonedretry']+_0x1ad2bc[_0x3816('0x184')]+_0x1ad2bc[_0x3816('0x194')]>=_0x457924[_0x3816('0x19b')]){_0x73024[_0x3816('0x19c')](_0x1ad2bc,_0x1a70c6,_0x2287b1,_0x3816('0x19d'));}else{_0x73024[_0x3816('0x19e')](_0x1ad2bc,_0x1a70c6,_0x2287b1,_0x3816('0x19d'));}}break;case'3':_0x457924[_0x3816('0x5f')]+=0x1;_0x1ad2bc['state']=0x3;_0x1ad2bc[_0x3816('0xdb')]=_0x3816('0x19f');_0x1ad2bc['countnoanswerretry']+=0x1;_0x1ad2bc[_0x3816('0xfe')]+=0x1;_0x73024['createHistory'](_0x1ad2bc)['catch'](loggerCatch(_0x3816('0x1a0')));if(_0x73024[_0x3816('0x181')](0x3,_0x1b93de,_0x457924)){if(_0x1ad2bc[_0x3816('0x185')]>=_0x457924[_0x3816('0x186')]){_0x73024['createStateFinal'](_0x1ad2bc,_0x1a70c6,_0x2287b1,'reason\x203\x20ringing\x20no\x20answer');}else{_0x73024['stateGlobal'](_0x1ad2bc,_0x1a70c6,_0x2287b1,_0x3816('0x1a1'));}}break;case'5':_0x457924['outboundBusyCallsDay']+=0x1;_0x1ad2bc[_0x3816('0x9b')]=0x5;_0x1ad2bc['statedesc']=_0x3816('0x1a2');_0x1ad2bc['countbusyretry']+=0x1;_0x1ad2bc['countglobal']+=0x1;_0x73024[_0x3816('0xbf')](_0x1ad2bc)[_0x3816('0xa4')](loggerCatch(_0x3816('0x1a3')));if(_0x73024[_0x3816('0x181')](0x5,_0x1b93de,_0x457924)){if(_0x1ad2bc['countbusyretry']>=_0x457924[_0x3816('0x1a4')]){_0x73024['createStateFinal'](_0x1ad2bc,_0x1a70c6,_0x2287b1,'reason\x205\x20busy');}else{_0x73024[_0x3816('0x19c')](_0x1ad2bc,_0x1a70c6,_0x2287b1,'reason\x205\x20busy');}}break;case'8':_0x457924[_0x3816('0x5d')]+=0x1;_0x1ad2bc['state']=0x8;_0x1ad2bc[_0x3816('0xdb')]=_0x3816('0x1a5');_0x1ad2bc['countcongestionretry']+=0x1;_0x1ad2bc[_0x3816('0xfe')]+=0x1;_0x73024[_0x3816('0xbf')](_0x1ad2bc)[_0x3816('0xa4')](loggerCatch(_0x3816('0x1a6')));if(_0x73024[_0x3816('0x181')](0x8,_0x1b93de,_0x457924)){if(_0x1ad2bc[_0x3816('0x183')]>=_0x457924[_0x3816('0x18a')]){_0x73024[_0x3816('0x19e')](_0x1ad2bc,_0x1a70c6,_0x2287b1,'reason\x208\x20congestion');}else{_0x73024[_0x3816('0x19c')](_0x1ad2bc,_0x1a70c6,_0x2287b1,_0x3816('0x1a7'));}}break;case'11':_0x457924['outboundAbandonedCallsDay']+=0x1;_0x1ad2bc[_0x3816('0x9b')]=0xb;_0x1ad2bc[_0x3816('0xdb')]='Abandoned';_0x1ad2bc['countabandonedretry']+=0x1;_0x1ad2bc['countglobal']+=0x1;_0x73024[_0x3816('0xbf')](_0x1ad2bc)['catch'](loggerCatch(_0x3816('0x1a8')));if(_0x73024['checkRetriveMax'](0xb,_0x1b93de,_0x457924)){if(_0x1ad2bc['countabandonedretry']>=_0x457924['dialAbandonedMaxRetry']){_0x73024['createStateFinal'](_0x1ad2bc,_0x1a70c6,_0x2287b1,_0x3816('0x1a9'));}else{_0x73024[_0x3816('0x19c')](_0x1ad2bc,_0x1a70c6,_0x2287b1,_0x3816('0x1a9'));}}break;case'20':_0x457924['outboundRejectCallsDay']+=0x1;_0x1ad2bc[_0x3816('0x9b')]=0x14;_0x1ad2bc[_0x3816('0xdb')]=_0x3816('0x1aa');_0x1ad2bc['countagentrejectretry']+=0x1;_0x1ad2bc['countglobal']+=0x1;_0x73024['createHistory'](_0x1ad2bc)[_0x3816('0xa4')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x73024[_0x3816('0x181')](0x14,_0x1b93de,_0x457924)){if(_0x1ad2bc['countagentrejectretry']>=_0x457924[_0x3816('0x195')]){_0x73024['createStateFinal'](_0x1ad2bc,_0x1a70c6,_0x2287b1,'reason\x2020\x20agentreject');}else{_0x73024['stateGlobal'](_0x1ad2bc,_0x1a70c6,_0x2287b1,_0x3816('0x1ab'));}}break;default:_0x457924['outboundUnknownCallsDay']+=0x1;_0x1ad2bc[_0x3816('0x9b')]=0xc;_0x1ad2bc[_0x3816('0xdb')]=_0x1c0a5f[_0x3816('0xec')];_0x73024[_0x3816('0xbf')](_0x1ad2bc)['catch'](loggerCatch(_0x3816('0x1ac')));if(_0x73024[_0x3816('0x181')](_0x1c0a5f[_0x3816('0xec')],_0x1b93de,_0x457924)){if(_0x1ad2bc[_0x3816('0x182')]+_0x1ad2bc[_0x3816('0x183')]+_0x1ad2bc['countnoanswerretry']+_0x1ad2bc[_0x3816('0x18e')]+_0x1ad2bc[_0x3816('0xfd')]+_0x1ad2bc[_0x3816('0x10b')]+_0x1ad2bc[_0x3816('0x184')]+_0x1ad2bc[_0x3816('0x194')]>=_0x457924[_0x3816('0x19b')]){_0x73024[_0x3816('0x19c')](_0x1ad2bc,_0x1a70c6,_0x2287b1,_0x1c0a5f[_0x3816('0xec')]);}else{_0x73024['createStateFinal'](_0x1ad2bc,_0x1a70c6,_0x2287b1,_0x1c0a5f[_0x3816('0xec')]);}}}});};Dialer['prototype'][_0x3816('0x19c')]=function(_0x35ef26,_0x47603d,_0x538041,_0x3ff5a8){var _0x565c85=new Final(_0x35ef26);_0x565c85[_0x3816('0x9b')]=0xf;_0x565c85[_0x3816('0xdb')]='Global';this['createStateFinal'](_0x565c85,_0x47603d,_0x538041,_0x3ff5a8);};Dialer[_0x3816('0x9d')][_0x3816('0x19e')]=function(_0x56bb2c,_0x56fbb0,_0x26425d,_0x4f8775){this[_0x3816('0xbd')](_0x56bb2c)[_0x3816('0xac')](function(_0x420f72){return _0x56fbb0(msgResponse(_0x3816('0x197'),'Success',_0x4f8775));})[_0x3816('0xa4')](function(_0x17f0e1){return _0x26425d(msgResponse(_0x3816('0x1ad'),'Failure','contact\x20not\x20moved'));});};Dialer['prototype'][_0x3816('0x8')]=function(_0x3f6026){var _0x148aab=this;var _0x39ffbd=_0x3f6026['dialPredictiveOptimizationPercentage']/0x64;var _0x4fee25=_0x3f6026[_0x3816('0x5e')]/(_0x3f6026[_0x3816('0x5e')]+_0x3f6026[_0x3816('0x5a')]);var _0x139ec3=Math['round'](_0x3f6026[_0x3816('0x1ae')]*(_0x3f6026['predictiveIntervalMaxThreshold']/0x64));var _0x2e85b6=Math[_0x3816('0x1af')](_0x3f6026[_0x3816('0x1ae')]*(_0x3f6026[_0x3816('0x1b0')]/0x64));var _0x18192b=_0x3f6026['available']+_0x3f6026[_0x3816('0x95')];var _0x110427=Math[_0x3816('0x1b1')](_0x3f6026[_0x3816('0x6f')]*_0x3f6026[_0x3816('0x83')]*_0x3f6026['predictiveIntervalHitRate']*_0x3f6026['predictiveIntervalMultiplicativeFactor']);if(_[_0x3816('0x37')](_0x3f6026[_0x3816('0x25')])){if(!_[_0x3816('0x37')](_0x3f6026[_0x3816('0x24')])){_0x3f6026[_0x3816('0x24')]=undefined;loggerPredictive[_0x3816('0x8a')](_0x3816('0x1b2'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_['isUndefined'](_0x3f6026[_0x3816('0x85')])){loggerPredictive[_0x3816('0x8a')](_0x3816('0x1b2'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x3f6026['handlePredictive']);_0x3f6026['handlePredictive']=undefined;}_0x3f6026[_0x3816('0x25')]=moment()[_0x3816('0x73')](_0x3816('0xf4'));loggerPredictive[_0x3816('0x78')](_0x3f6026[_0x3816('0x3a')],_0x3816('0x1b3'),_0x3f6026[_0x3816('0x25')]);this[_0x3816('0x147')](_0x3f6026,0x1);}else if(ifInterval(_0x3f6026[_0x3816('0x1b4')],_0x3f6026['startProgressive'])){this[_0x3816('0x147')](_0x3f6026,0x1);loggerPredictiveCalls[_0x3816('0x78')](_0x3816('0x1b5'),_0x3f6026[_0x3816('0x25')],_0x3f6026[_0x3816('0x3a')]);_0x3f6026['erlangCalls']=0x0;_0x3f6026[_0x3816('0x6a')]=0x0;}else if(_0x39ffbd<_0x4fee25&&_0x3f6026[_0x3816('0x1b6')]===_0x3816('0x1b7')){freeVariablesPredictive(_0x3f6026);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x3816('0x1b8'),_0x4fee25,_0x3816('0x25'),_0x3f6026[_0x3816('0x3a')]);}else if(_0x110427<_0x3f6026[_0x3816('0x6a')]&&_0x3f6026[_0x3816('0x1b6')]===_0x3816('0x1b7')){freeVariablesPredictive(_0x3f6026);loggerPredictive[_0x3816('0x78')](_0x3816('0x1b9'),'Max\x20Drop\x20',_0x110427,'Drop\x20in\x20this\x20interval',_0x3f6026[_0x3816('0x6a')],'startProgressive',_0x3f6026[_0x3816('0x3a')]);}else if(!ifInterval(_0x3f6026[_0x3816('0x1b4')],_0x3f6026[_0x3816('0x25')])&&_[_0x3816('0x37')](_0x3f6026[_0x3816('0x24')])&&!_['isUndefined'](_0x3f6026[_0x3816('0x25')])){_0x3f6026[_0x3816('0x24')]=moment()[_0x3816('0x73')](_0x3816('0xf4'));loggerPredictive[_0x3816('0x78')](_0x3f6026['name'],_0x3816('0x1ba'),_0x3f6026['startPredictive']);this[_0x3816('0xb2')](_0x3f6026[_0x3816('0x1b4')])[_0x3816('0xac')](this[_0x3816('0x1bb')](_0x3f6026))[_0x3816('0xac')](mergeDataErlangB(_0x3f6026))[_0x3816('0xac')](this[_0x3816('0x1bc')](_0x3f6026))[_0x3816('0xa4')](loggerCatchPredictive(_0x3816('0x1bd'),_0x3f6026));}else if(!ifInterval(_0x3f6026[_0x3816('0x1b4')],_0x3f6026[_0x3816('0x24')])){_0x3f6026[_0x3816('0x6a')]=0x0;_0x3f6026[_0x3816('0x24')]=moment()['format'](_0x3816('0xf4'));loggerPredictive['info'](_0x3f6026[_0x3816('0x3a')],'recalculate\x20predictive\x20at',_0x3f6026[_0x3816('0x24')]);clearInterval(_0x3f6026[_0x3816('0x85')]);_0x3f6026[_0x3816('0x85')]=undefined;this[_0x3816('0xb2')](_0x3f6026[_0x3816('0x1b4')])[_0x3816('0xac')](this[_0x3816('0x1bb')](_0x3f6026))[_0x3816('0xac')](mergeDataErlangB(_0x3f6026))['then'](this[_0x3816('0x1bc')](_0x3f6026))['catch'](loggerCatchPredictive(_0x3816('0x1be'),_0x3f6026));}else if(_0x3f6026[_0x3816('0x1ae')]&&_0x18192b<_0x3f6026[_0x3816('0x1ae')]-_0x2e85b6){freeVariablesPredictive(_0x3f6026);loggerPredictive['info'](_0x3f6026[_0x3816('0x3a')],_0x3816('0x1bf'),_0x18192b,')\x20are\x20less\x20than\x20threshold\x20(',_0x3f6026[_0x3816('0x1ae')],'-',_0x2e85b6,'=',_0x3f6026['predictiveIntervalAvailable']-_0x2e85b6,')');}else if(_0x3f6026[_0x3816('0x1ae')]&&_0x18192b>_0x3f6026[_0x3816('0x1ae')]+_0x139ec3){freeVariablesPredictive(_0x3f6026);loggerPredictive['info'](_0x3f6026[_0x3816('0x3a')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x18192b,_0x3816('0x1c0'),_0x3f6026['predictiveIntervalAvailable'],'+',_0x139ec3,'=',_0x3f6026[_0x3816('0x1ae')]+_0x139ec3,')');}};Dialer[_0x3816('0x9d')][_0x3816('0x1bb')]=function(_0x48419e){var _0x212fad=this;return function(_0x499f8c){return new BPromise(function(_0x2a75b5,_0x1de788){_[_0x3816('0xc4')](_0x48419e,_0x499f8c[0x0]);if(checkGetDataPredictive(_0x499f8c[0x0])){var _0x4368d3=_0x48419e[_0x3816('0x1ae')]=_0x48419e['talking']+_0x48419e[_0x3816('0x4b')];var _0x2ede0c=_0x48419e['dialPredictiveInterval']*0x3c;var _0x189fe3=_0x499f8c[0x0][_0x3816('0x66')]+_0x499f8c[0x0][_0x3816('0x65')];var _0x572634=(_0x499f8c[0x0][_0x3816('0x64')]+_0x499f8c[0x0][_0x3816('0x68')]+_0x499f8c[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x499f8c[0x0]['predictiveIntervalTotalCalls'];_0x48419e[_0x3816('0x6b')]=_0x572634>0x0?_0x572634:0x1;switch(_0x48419e['dialPredictiveOptimization']){case _0x3816('0x1b7'):var _0x779eef=_0x48419e[_0x3816('0x1c1')]/0x64;return _0x212fad[_0x3816('0x1c2')](_0x4368d3,_0x2ede0c,_0x189fe3,_0x572634,_0x779eef)[_0x3816('0xac')](function(_0x1a6584){return _0x2a75b5(_0x1a6584);});case _0x3816('0x1c3'):var _0x2bf6ca=_0x48419e[_0x3816('0x1c1')]/0x64;return _0x212fad[_0x3816('0x1c4')](_0x4368d3,_0x2ede0c,_0x189fe3,_0x572634,_0x2bf6ca)['then'](function(_0x1b987c){return _0x2a75b5(_0x1b987c);});default:return _0x1de788(msgResponse('[getDataPredictive]',_0x3816('0x130'),_0x3816('0x1c5')));}}else{return _0x1de788(msgResponse(_0x3816('0x1c6'),'Failure','check\x20failure'));}});};};Dialer[_0x3816('0x9d')]['getDataPredictiveOld']=function(_0x548997){var _0x3a8a83=this;return function(_0x36e618){return new BPromise(function(_0x350656,_0x2059e2){_[_0x3816('0xc4')](_0x548997,_0x36e618[0x0]);if(checkGetDataPredictive(_0x36e618[0x0])){loggerPredictive[_0x3816('0x78')](JSON[_0x3816('0x43')](_0x36e618[0x0]));if(_0x548997[_0x3816('0x1b6')]===_0x3816('0x1b7')){return _0x3a8a83[_0x3816('0xbb')](_0x548997['id'])[_0x3816('0xac')](function(_0x21463c){var _0x5469bf=_0x548997[_0x3816('0x4c')]-_0x21463c[0x0]['outboundQueuePauses'];var _0xe2dbe7=_0x548997[_0x3816('0x1b4')]*0x3c;var _0x5cd424=_0x36e618[0x0][_0x3816('0x66')]+_0x36e618[0x0][_0x3816('0x65')];var _0x140cee=(_0x36e618[0x0][_0x3816('0x64')]+_0x36e618[0x0][_0x3816('0x68')]+_0x36e618[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x36e618[0x0][_0x3816('0x1c7')];var _0x1eba61=_0x548997[_0x3816('0x1c1')]/0x64;_0x548997[_0x3816('0x6d')]=_0x21463c[0x0][_0x3816('0x1c8')]||0x0;_0x548997[_0x3816('0x6b')]=_0x140cee>0x0?_0x140cee:0x1;return _0x3a8a83[_0x3816('0x1c2')](_0x5469bf,_0xe2dbe7,_0x5cd424,_0x140cee,_0x1eba61);})['then'](function(_0x47094f){return _0x350656(_0x47094f);})[_0x3816('0xa4')](function(_0x397ed1){return _0x2059e2(msgResponse('[CatchErlangB]',_0x3816('0x130'),JSON['stringify'](_0x397ed1)));});}if(_0x548997['dialPredictiveOptimization']===_0x3816('0x1c3')){return _0x3a8a83[_0x3816('0xbb')](_0x548997['id'])[_0x3816('0xac')](function(_0x280991){var _0x4137d2=_0x548997[_0x3816('0x4c')]-_0x280991[0x0][_0x3816('0x1c8')];var _0x2310c7=_0x548997[_0x3816('0x1b4')]*0x3c;var _0x5510f6=_0x36e618[0x0][_0x3816('0x66')]+_0x36e618[0x0]['predictiveIntervalAvgHoldtime'];var _0x5a6a31=(_0x36e618[0x0][_0x3816('0x64')]+_0x36e618[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x36e618[0x0][_0x3816('0x67')])/_0x36e618[0x0][_0x3816('0x1c7')];var _0x3a9d37=_0x548997[_0x3816('0x1c1')]/0x64;_0x548997[_0x3816('0x6d')]=_0x280991[0x0][_0x3816('0x1c8')]||0x0;_0x548997['predictiveIntervalHitRate']=_0x5a6a31>0x0?_0x5a6a31:0x1;return _0x3a8a83[_0x3816('0x1c4')](_0x4137d2,_0x2310c7,_0x5510f6,_0x5a6a31,_0x3a9d37);})[_0x3816('0xac')](function(_0x474734){return _0x350656(_0x474734);})[_0x3816('0xa4')](function(_0x5275a9){return _0x2059e2(msgResponse(_0x3816('0x1c9'),_0x3816('0x130'),JSON[_0x3816('0x43')](_0x5275a9)));});}}else{return _0x2059e2(msgResponse(_0x3816('0x1c6'),_0x3816('0x130'),_0x3816('0x1ca')));}});};};Dialer['prototype'][_0x3816('0x1bc')]=function(_0x46e63f){var _0x5876ca=this;return function(){var _0x11dc87=0x0;var _0x544577=Math['floor'](_0x46e63f[_0x3816('0x80')]*0x3e8);if(_0x544577>0x0){_0x544577=_0x544577<0x64?0x64:_0x544577;loggerPredictive['info'](_0x46e63f[_0x3816('0x3a')],_0x3816('0x1cb'),_0x544577,_0x3816('0x44'));_0x46e63f['handlePredictive']=setInterval(function(){_0x5876ca[_0x3816('0x85')](_0x46e63f);loggerPredictiveCalls[_0x3816('0x78')]('[handlePredictive]',_0x11dc87+=0x1);},_0x544577);}else{loggerPredictive['info'](_0x46e63f['name'],_0x3816('0x1cc'));}};};Dialer[_0x3816('0x9d')]['checkContactBlack']=function(_0x37418f,_0xc61de0){var _0xd90aab=this;return function(_0x4cbaf9){if(_[_0x3816('0x3f')](_0x4cbaf9)){if(_[_0x3816('0xa1')](_0xc61de0[_0x3816('0xc6')])||!_0xc61de0['recallme']){if(_0x37418f[_0x3816('0x55')]===_0x3816('0x1cd')){_0x37418f['queueStatusComplete']=_[_0x3816('0x37')](_0x37418f[_0x3816('0x116')])?!![]:_0x37418f[_0x3816('0x116')];var _0x2c000a=uuid['v4']();_0xd90aab[_0x3816('0xa0')][_0x2c000a]=new Action(_0x37418f,_0xc61de0,_0x2c000a);loggerBooked[_0x3816('0x78')](_0x3816('0x1ce'),_0x2c000a,_0x3816('0x1cf'),JSON[_0x3816('0x43')](_0x37418f['queueStatusComplete']),_0x3816('0x1d0'),_0x37418f[_0x3816('0x3a')]);if(_0x37418f['queueStatusComplete']){_0x37418f['queueStatusComplete']=![];_0xd90aab[_0x3816('0x27')][_0xd90aab[_0x3816('0xa0')][_0x2c000a][_0x3816('0xa6')]]=[];ami[_0x3816('0x136')]({'actionid':_0x2c000a,'action':'queuestatus','queue':_0x37418f['name']})[_0x3816('0xa4')](function(_0x15acdf){_0xd90aab[_0x3816('0xa8')](_0x37418f);_0xd90aab[_0x3816('0xb5')]({'active':![],'ContactId':_0xd90aab[_0x3816('0xa0')][_0x2c000a]['ContactId'],'ListId':_0xd90aab['actions'][_0x2c000a][_0x3816('0x102')],'VoiceQueueId':_0xd90aab[_0x3816('0xa0')][_0x2c000a][_0x3816('0xc7')]||undefined,'CampaignId':_0xd90aab[_0x3816('0xa0')][_0x2c000a][_0x3816('0xc8')]||undefined})[_0x3816('0xa4')](loggerCatch(_0x3816('0x1d1')));delete _0xd90aab[_0x3816('0xa0')][_0x2c000a];});}else{loggerBooked[_0x3816('0x78')]('[booked][checkContactBlack][else]',JSON['stringify'](_0x37418f['queueStatusComplete']),'Queue:\x20',_0x37418f[_0x3816('0x3a')]);_0xd90aab['updateOriginated'](_0x37418f);_0xd90aab[_0x3816('0xb5')]({'active':![],'ContactId':_0xd90aab['actions'][_0x2c000a][_0x3816('0xc5')],'ListId':_0xd90aab[_0x3816('0xa0')][_0x2c000a][_0x3816('0x102')],'VoiceQueueId':_0xd90aab['actions'][_0x2c000a]['VoiceQueueId']||undefined,'CampaignId':_0xd90aab[_0x3816('0xa0')][_0x2c000a]['CampaignId']||undefined})[_0x3816('0xa4')](loggerCatch(_0x3816('0x1d1')));delete _0xd90aab[_0x3816('0xa0')][_0x2c000a];}}else{return _0xd90aab['actionOriginate'](_0x37418f,_0xc61de0);}}else{if(getDiff(_0xc61de0[_0x3816('0x1d2')])<_0x37418f[_0x3816('0x1d3')]*0x3c){if(_0xc61de0[_0x3816('0x1d4')]&&!_0xc61de0[_0x3816('0x1d4')]['voicePause']){_0xd90aab[_0x3816('0x1c')][_0x3816('0x118')](_0xc61de0['id'])['finally'](function(){_0xd90aab[_0x3816('0xa8')](_0x37418f);});}else{_0xd90aab['unlockContact']({'active':![]},_0xc61de0['id'],0x1)[_0x3816('0x11b')](function(){console[_0x3816('0x106')](_0x3816('0x1d5'));_0xd90aab[_0x3816('0xa8')](_0x37418f);});}}else{_0x37418f['outboundReCallsDay']+=0x1;_0xd90aab[_0x3816('0xa8')](_0x37418f);if(_0x37418f['dialRecallInQueue']){_0xd90aab[_0x3816('0xb5')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0xc61de0[_0x3816('0xc5')],'ListId':_0xc61de0[_0x3816('0x102')],'VoiceQueueId':_0xc61de0[_0x3816('0xc7')]||undefined,'CampaignId':_0xc61de0[_0x3816('0xc8')]||undefined})[_0x3816('0xa4')](loggerCatch(_0x3816('0x1d6')));_0xd90aab[_0x3816('0xbf')](createObjHistory(_0x37418f,_0xc61de0,'RECALLINQUEUE',0x17,_0x3816('0x1d7')))[_0x3816('0xa4')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0xd90aab[_0x3816('0xc3')](createObjHistory(_0x37418f,_0xc61de0,_0x3816('0x1d8'),0x16,_0x3816('0x1d9')),_0x3816('0x1da'),_0x3816('0x1db'));}}}}else{_0x37418f[_0x3816('0x5b')]+=0x1;_0xd90aab[_0x3816('0xc3')](createObjHistory(_0x37418f,_0xc61de0,_0x3816('0x1dc'),0xd,_0x3816('0x1dd')),_0x3816('0x1de'),_0x3816('0x1df'));throw _0x3816('0x1e0');}};};Dialer[_0x3816('0x9d')]['handleIvr']=function(_0x3bd90c){var _0x1e817f=this;var _0x55900d=[];var _0x45943f=_0x3bd90c['limitCalls']-_0x3bd90c['originated']-_0x3bd90c[_0x3816('0x1e1')];emitCampaignSummary(_0x3bd90c);if(_0x45943f>0x0){if(_0x45943f>this[_0x3816('0x1e2')]){_0x45943f=this['maxNumberOriginate'];}_0x3bd90c[_0x3816('0x1e1')]+=_0x45943f;this['getContactDialerIvr'](_0x3bd90c['id'],_0x45943f,_0x3bd90c[_0x3816('0x1e3')])['then'](function(_0x46e800){_0x3bd90c[_0x3816('0x1e1')]-=_0x45943f;_0x3bd90c[_0x3816('0x1e1')]=_0x3bd90c[_0x3816('0x1e1')]>0x0?_0x3bd90c[_0x3816('0x1e1')]:0x0;if(!checkContactEmpty(_0x46e800)){_0x3bd90c[_0x3816('0x38')]=_0x3816('0x94');logger[_0x3816('0x78')]('[getContactCampaign2][Empty]'+_0x3bd90c[_0x3816('0x3a')]);}else{_0x3bd90c[_0x3816('0x6e')]+=_0x46e800['length'];_0x3bd90c[_0x3816('0x38')]='RUNNING';for(var _0x5d6735=0x0;_0x5d6735<_0x46e800[_0x3816('0x8d')];_0x5d6735+=0x1){_0x3bd90c[_0x3816('0x1e4')]+=0x1;if(_[_0x3816('0xa1')](_0x46e800[_0x5d6735])||_[_0x3816('0xa1')](_0x46e800[_0x5d6735][_0x3816('0x158')])||_[_0x3816('0xa1')](_0x46e800[_0x5d6735][_0x3816('0x158')][_0x3816('0x159')])){_0x1e817f[_0x3816('0x1e5')](_0x3816('0x1e6'),_0x3bd90c,_0x46e800[_0x5d6735]);}else{_0x1e817f[_0x3816('0xb0')](_[_0x3816('0x115')](_0x46e800[_0x5d6735],[_0x3816('0xc8'),'Contact.phone']))[_0x3816('0xac')](_0x1e817f[_0x3816('0x1e7')](_0x3bd90c,_0x46e800[_0x5d6735]))[_0x3816('0xa4')](_0x1e817f[_0x3816('0xc2')]('[actionOriginateIvr]\x20',_0x3bd90c));}}}})[_0x3816('0xa4')](loggerGetContactDialer(_0x3816('0x1e8'),_0x3bd90c,_0x45943f));}};Dialer[_0x3816('0x9d')][_0x3816('0x147')]=function(_0xa839,_0xad6f66){var _0x49482f=this;var _0x1ef7c2=[];var _0x1cb200=_0xad6f66>=0x1?_0xad6f66:0x1;var _0x15ca14=[];if(_0xa839[_0x3816('0x55')]===_0x3816('0x1cd')){_0x1cb200=0x1;}var _0x33a439=Math['floor'](_0xa839['available']*_0x1cb200)-_0xa839[_0x3816('0x6e')]-_0xa839[_0x3816('0x1e1')];emitVoiceQueueSummary(_0xa839);if(_0xa839[_0x3816('0x1e9')]>0x0){var _0x5d7055=_0xa839[_0x3816('0x1e9')]-_0xa839[_0x3816('0x6e')]-_0xa839[_0x3816('0x95')]-_0xa839[_0x3816('0x1e1')]-_0xa839[_0x3816('0x4d')];if(_0x33a439>_0x5d7055){_0x33a439=_0x5d7055;}}if(_0x33a439>0x0){if(_0xa839[_0x3816('0x55')]===_0x3816('0x1cd')){_0x33a439=0x1;}if(_0x33a439>this[_0x3816('0x1e2')]){_0x33a439=this['maxNumberOriginate'];}_0xa839[_0x3816('0x1e1')]+=_0x33a439;for(var _0x531401 in this[_0x3816('0x1f')]){if(this[_0x3816('0x1f')]['hasOwnProperty'](_0x531401)){if(this[_0x3816('0x1f')][_0x531401][_0x3816('0x9b')]===_0x3816('0x1ea')&&this[_0x3816('0x1f')][_0x531401]['status']===_0x3816('0xcf')){_0x1ef7c2['push'](this['agents'][_0x531401]['id']);}}}this[_0x3816('0xb8')](_0xa839['id'],_0x1ef7c2,_0x33a439,_0xa839[_0x3816('0x1e3')])[_0x3816('0xac')](function(_0x5ebbb3){_0xa839[_0x3816('0x1e1')]-=_0x33a439;_0xa839[_0x3816('0x1e1')]=_0xa839[_0x3816('0x1e1')]>0x0?_0xa839[_0x3816('0x1e1')]:0x0;if(!checkContactEmpty(_0x5ebbb3)){_0x49482f[_0x3816('0xaa')](_0xa839)['then'](sendMessageReschedule(_0xa839))[_0x3816('0xa4')](loggerCatch(_0x3816('0xad')));}else{_0xa839[_0x3816('0x6e')]+=_0x5ebbb3[_0x3816('0x8d')];_0xa839['message']=_0xa839[_0x3816('0x55')]===_0x3816('0x1cd')?'ACTIVE':'RUNNING';for(var _0x22f628=0x0;_0x22f628<_0x5ebbb3[_0x3816('0x8d')];_0x22f628+=0x1){if(_['isNil'](_0x5ebbb3[_0x22f628])||_['isNil'](_0x5ebbb3[_0x22f628]['Contact'])||_[_0x3816('0xa1')](_0x5ebbb3[_0x22f628][_0x3816('0x158')]['phone'])){_0x49482f[_0x3816('0x1e5')](_0x3816('0x1e6'),_0xa839,_0x5ebbb3[_0x22f628]);}else{_0x49482f[_0x3816('0xae')](_[_0x3816('0x115')](_0x5ebbb3[_0x22f628],[_0x3816('0xc7'),_0x3816('0x1eb')]))['then'](_0x49482f['checkContactBlack'](_0xa839,_0x5ebbb3[_0x22f628]))[_0x3816('0xa4')](_0x49482f['loggerHandler'](_0x3816('0x1e6'),_0xa839));}}}})[_0x3816('0xa4')](loggerGetContactDialer('[getContactDialer2]',_0xa839,_0x33a439));}};Dialer['prototype'][_0x3816('0x85')]=function(_0x6caa03){var _0x4e1a7d=this;if(_0x6caa03[_0x3816('0x1e9')]>0x0){var _0x20c6f3=_0x6caa03[_0x3816('0x1e9')]-_0x6caa03['originated']-_0x6caa03[_0x3816('0x95')];if(_0x20c6f3>0x0){this[_0x3816('0x1ec')](_0x6caa03);}else{loggerPredictiveCalls[_0x3816('0x78')]('[handlePredictive][limitChannel]');}}else{this[_0x3816('0x1ec')](_0x6caa03);}};Dialer['prototype'][_0x3816('0x1ec')]=function(_0x54b6ab){var _0x49f406=this;var _0x57edb9=[];_0x54b6ab[_0x3816('0x6e')]+=0x1;for(var _0x4b5788 in this['agents']){if(this[_0x3816('0x1f')]['hasOwnProperty'](_0x4b5788)){if(this[_0x3816('0x1f')][_0x4b5788][_0x3816('0x9b')]===_0x3816('0x1ea')&&this[_0x3816('0x1f')][_0x4b5788][_0x3816('0xa2')]===_0x3816('0xcf')){_0x57edb9[_0x3816('0x114')](this[_0x3816('0x1f')][_0x4b5788]['id']);}}}this[_0x3816('0xb8')](_0x54b6ab['id'],_0x57edb9,0x1,_0x54b6ab[_0x3816('0x1e3')])['then'](function(_0x1cba35){if(!checkContactEmpty(_0x1cba35)){checkContactLowerLimitOriginate(_0x54b6ab,0x1,0x0);_0x49f406[_0x3816('0xaa')](_0x54b6ab)[_0x3816('0xac')](sendMessageReschedule(_0x54b6ab))['catch'](loggerCatch(_0x3816('0xad')));}else{_0x54b6ab['message']=_0x3816('0x1ed');if(_[_0x3816('0xa1')](_0x1cba35[0x0])||_[_0x3816('0xa1')](_0x1cba35[0x0][_0x3816('0x158')])||_[_0x3816('0xa1')](_0x1cba35[0x0][_0x3816('0x158')]['phone'])){_0x49f406[_0x3816('0x1e5')](_0x3816('0x1e6'),_0x54b6ab,_0x1cba35[0x0]);}else{_0x49f406['checkIsBlackList'](_[_0x3816('0x115')](_0x1cba35[0x0],[_0x3816('0xc7'),_0x3816('0x1eb')]))['then'](_0x49f406[_0x3816('0x1e7')](_0x54b6ab,_0x1cba35[0x0]))[_0x3816('0xa4')](_0x49f406[_0x3816('0xc2')](_0x3816('0x1ee'),_0x54b6ab));}}})[_0x3816('0xa4')](loggerGetContactDialer(_0x3816('0x1ef'),_0x54b6ab,0x1));emitVoiceQueueSummary(_0x54b6ab);};Dialer[_0x3816('0x9d')][_0x3816('0x1c2')]=function(_0x1c4cd7,_0x4d68d1,_0x4cca45,_0x24778d,_0x34b12a,_0x265e1e){loggerPredictive['info'](_0x3816('0x1f0'));loggerPredictive['info'](_0x3816('0x1f1'),_0x1c4cd7);loggerPredictive[_0x3816('0x78')](_0x3816('0x1f2'),_0x4d68d1);loggerPredictive[_0x3816('0x78')](_0x3816('0x1f3'),_0x4cca45);loggerPredictive[_0x3816('0x78')](_0x3816('0x1f4'),_0x24778d);loggerPredictive[_0x3816('0x78')](_0x3816('0x1f5'),_0x34b12a);loggerPredictive[_0x3816('0x78')](_0x3816('0x1f6'));return new BPromise(function(_0x41e3c5,_0x4874be){if(_0x1c4cd7<=0x0||isNaN(_0x1c4cd7)){return _0x4874be(msgResponse('[abandonmentRate]',_0x3816('0x42'),_0x3816('0x1f7')+_0x1c4cd7));}if(_0x4cca45<=0x0||isNaN(_0x4cca45)){return _0x4874be(msgResponse(_0x3816('0x1f8'),_0x3816('0x42'),'Ts\x20=\x20'+_0x4cca45));}if(_0x24778d<=0x0||isNaN(_0x24778d)){return _0x4874be(msgResponse('[abandonmentRate]',_0x3816('0x42'),'p\x20=\x20'+_0x24778d));}if(_0x4d68d1<=0x0||isNaN(_0x4d68d1)){return _0x4874be(msgResponse(_0x3816('0x1f8'),_0x3816('0x42'),'interval\x20=\x20'+_0x4d68d1));}if(_0x34b12a<=0x0||isNaN(_0x34b12a)){return _0x4874be(msgResponse('[abandonmentRate]',_0x3816('0x42'),_0x3816('0x1f9')+_0x34b12a));}_0x265e1e=_0x265e1e||0x0;var _0x22f665=0x1/_0x4cca45;var _0x3b289a=0x0;var _0x3e8849=0x0;var _0x8b7989=0x0;var _0x43a1e8=0x0;for(var _0xd60cf1=0x0;_0x8b7989<_0x34b12a;_0xd60cf1+=0x1){_0x3e8849=_0xd60cf1/_0x4d68d1;_0x3b289a=(_0x24778d*_0x3e8849+_0x265e1e)/_0x22f665;_0x8b7989=erlangb(_0x3b289a,_0x1c4cd7);_0x43a1e8=_0x3b289a/_0x1c4cd7*(0x1-erlangb(_0x3b289a,_0x1c4cd7));}return _0x41e3c5({'erlangCalls':_0xd60cf1,'erlangCallToSecond':_0x4d68d1/_0xd60cf1,'erlangAbandonmentRate':_0x8b7989,'erlangBusyFactor':_0x43a1e8});});};Dialer[_0x3816('0x9d')][_0x3816('0x1c4')]=function(_0x3e5179,_0x1219b7,_0x369799,_0x521301,_0x41c7bb,_0x114738){loggerPredictive[_0x3816('0x78')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x3816('0x78')]('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',_0x3e5179);loggerPredictive[_0x3816('0x78')](_0x3816('0x1f2'),_0x1219b7);loggerPredictive[_0x3816('0x78')](_0x3816('0x1f3'),_0x369799);loggerPredictive['info']('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x521301);loggerPredictive['info'](_0x3816('0x1fa'),_0x41c7bb);loggerPredictive[_0x3816('0x78')]('---------------------------');return new BPromise(function(_0x473295,_0x570bbf){if(_0x3e5179<=0x0||isNaN(_0x3e5179)){return _0x570bbf(msgResponse(_0x3816('0x1fb'),'Error',_0x3816('0x1f7')+_0x3e5179));}if(_0x369799<=0x0||isNaN(_0x369799)){return _0x570bbf(msgResponse(_0x3816('0x1fb'),_0x3816('0x42'),'Ts\x20=\x20'+_0x369799));}if(_0x521301<=0x0||isNaN(_0x521301)){return _0x570bbf(msgResponse(_0x3816('0x1fb'),'Error','p\x20=\x20'+_0x521301));}if(_0x1219b7<=0x0||isNaN(_0x1219b7)){return _0x570bbf(msgResponse('[busyFactor]',_0x3816('0x42'),_0x3816('0x1fc')+_0x1219b7));}if(_0x41c7bb<=0x0||isNaN(_0x41c7bb)){return _0x570bbf(msgResponse(_0x3816('0x1fb'),'Error','Umin\x20=\x20'+_0x41c7bb));}_0x114738=_0x114738||0x0;var _0x3f3ae9=0x1/_0x369799;var _0x5ae1ff=0x0;var _0x381e31=0x0;var _0x17abef=0x0;var _0x4f3bf2=0x0;for(var _0x4f001b=0x0;_0x4f3bf2<_0x41c7bb;_0x4f001b+=0x1){_0x381e31=_0x4f001b/_0x1219b7;_0x5ae1ff=(_0x521301*_0x381e31+_0x114738)/_0x3f3ae9;_0x17abef=erlangb(_0x5ae1ff,_0x3e5179);_0x4f3bf2=_0x5ae1ff/_0x3e5179*(0x1-erlangb(_0x5ae1ff,_0x3e5179));}return _0x473295({'erlangCalls':_0x4f001b,'erlangCallToSecond':_0x1219b7/_0x4f001b,'erlangAbandonmentRate':_0x17abef,'erlangBusyFactor':_0x4f3bf2});});};module[_0x3816('0x1fd')]=Dialer; \ No newline at end of file +var _0x9c34=['tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','optionPredictive','startPredictive','startProgressive','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','bind','originateresponse','syncOriginateResponse','syncAgentComplete','syncHangup','syncNewExten','varset','syncQueueMember','syncQueueStatusComplete','loopCampaigns','isUndefined','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','name','Interval','Intervals','message','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','type','outbound','strategy','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','Trunk','active','callerid','format','voice:queue:%s','ivr','campaign:ivr:%s','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','stack','length','hasOwnProperty','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','inspect','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','loopClearZombieChannels','clearZombieChannels','uniqueId','[actions]','isNil','channel','catch','No\x20such\x20channel','updateOriginated','[Dialer][checkChannel]','queue','countReScheduled','resolve','then','[countReScheduled]\x20','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[unlockContact]\x20','getContactDialer','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','notFound','saveInDb','pick','ContactId','ListId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','status','reachable','unmonitored','syncVarSet','variable','amdstatus','xcally-motion-dialer','value','HANGUP','uniqueid','outboundAnswerCallsDay','HangupInAMD','membername','AMD','dialAMDActive','MACHINE','amd','[syncMachine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','Machine','[syncMachineIvr]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','reason','agiafterat','dialQueueProject2','YYYY-MM-DD\x20HH:mm:ss','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','droptime','responsetime','dialQueueTimeout','dropreason','TIMEOUT','countdropretry','dialDropMaxRetry','queueCallerAbandonCreateState','add','minutes','[rescheduleContact][Drop]','Drop','starttime','calleridname','calleridnum','log','CRIS\x20evt\x2010.1','CRIS\x20queueCallerAbandon\x2010.1','CRIS\x20createHistory\x2010.1','[syncAgentComplete][createHistory][10]','predictiveIntervalDroppedCallsCallersExit','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actions','actionid','locked','paused','stateinterface','merge','queueStatusComplete','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','push','Action','iftime\x20%s,%s','interval','indexOf','true','command','content','all','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialGlobalInterval','dialTimezone','[syncQueueSummary]','[syncCampaigns]','pow','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','XMD-AMDINITIALSILENCE','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-CAMPAIGNID','createdAt','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','originatecalleridnum','dialCutDigit','substring','SIP/%s/%s%s','trim','from-sip','outboundOriginateFailureCallsDay','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','countbusyretry','countnoanswerretry','countagentrejectretry','dialGlobalMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','countcongestionretry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropRetryFrequency','countmachineretry','dialMachineRetryFrequency','[rescheduleContact][Machine]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','countglobal','[syncAgentComplete][createHistory][0]','reason\x200\x20no\x20such\x20number....','NoAnswer','[syncAgentComplete][createHistory][3]','createStateFinal','reason\x203\x20ringing\x20no\x20answer','Busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','stateGlobal','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMinThreshold','available','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','averageHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','outboundQueuePauses','[CatchErlangB]','floor','one\x20call\x20every:','[handlePredictive]','checkContactBlack','UserId','recallme','[booked][checkContactBlack]','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','voicePause','Contact\x20updated','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','BLACKLIST','[Originate][historyBlacklist]','limitCalls','temp','RUNNING','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','[abandonmentRate]','m\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\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','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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','Umin\x20=\x20','exports','util','bluebird','uuid','moment','md5','dialer','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/voiceQueueRt','./history','./agentComplete','./queueCallerAbandon','./hangup','XCALLY_IP_AGI','rrmemory','roundrobin','prototype','enqueue'];(function(_0x129307,_0x34f356){var _0x17cdb7=function(_0x344a9b){while(--_0x344a9b){_0x129307['push'](_0x129307['shift']());}};_0x17cdb7(++_0x34f356);}(_0x9c34,0x1f1));var _0x49c3=function(_0x4fa5ea,_0x4139ba){_0x4fa5ea=_0x4fa5ea-0x0;var _0x4acaa3=_0x9c34[_0x4fa5ea];return _0x4acaa3;};'use strict';var util=require(_0x49c3('0x0'));var _=require('lodash');var BPromise=require(_0x49c3('0x1'));var uuid=require(_0x49c3('0x2'));var moment=require(_0x49c3('0x3'));var rr=require('rr');var md5=require(_0x49c3('0x4'));var Redis=require('ioredis');var config=require('../../../config/environment/');var logger=require('../../../config/logger')(_0x49c3('0x5'));var loggerBooked=require(_0x49c3('0x6'))(_0x49c3('0x7'));var loggerPredictive=require('../../../config/logger')(_0x49c3('0x8'));var loggerPredictiveCalls=require(_0x49c3('0x6'))(_0x49c3('0x9'));var loggerSyncQueueSummary=require(_0x49c3('0x6'))(_0x49c3('0xa'));var ami=require('../ami');config[_0x49c3('0xb')]=_[_0x49c3('0xc')](config[_0x49c3('0xb')],{'host':_0x49c3('0xd'),'port':0x18eb});var io=require(_0x49c3('0xe'))(new Redis(config['redis']));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x49c3('0xf'));var cmHopperHistory=require(_0x49c3('0x10'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x49c3('0x11'));var Action=require('./action');var History=require(_0x49c3('0x12'));var Final=require('./final');var AgentComplete=require(_0x49c3('0x13'));var QueueCallerAbandon=require(_0x49c3('0x14'));var Hangup=require(_0x49c3('0x15'));var ipAgi=process['env'][_0x49c3('0x16')]||'127.0.0.1';var strategy={'rrmemory':_0x49c3('0x17'),'roundrobin':_0x49c3('0x18')};var Sequence=function(){};Sequence[_0x49c3('0x19')][_0x49c3('0x1a')]=function(_0x168d6e){this[_0x49c3('0x1b')]=this[_0x49c3('0x1b')]?this['tail'][_0x49c3('0x1c')](_0x168d6e):_0x168d6e();};function Dialer(_0x452a44,_0x3cbcea){this[_0x49c3('0x1d')]=new Sequence();this[_0x49c3('0x1e')]=_0x3cbcea;this[_0x49c3('0x1f')]=_0x452a44[_0x49c3('0x1f')];this[_0x49c3('0x20')]=_0x452a44[_0x49c3('0x20')];this[_0x49c3('0x21')]=_0x452a44['agents'];this['trunks']=_0x452a44[_0x49c3('0x22')];this[_0x49c3('0x23')]=config[_0x49c3('0x23')]||0x2;this[_0x49c3('0x24')]={};this['actions']={};this[_0x49c3('0x25')]={};this['uniqueId']={};this[_0x49c3('0x26')]={};this[_0x49c3('0x27')]={};this[_0x49c3('0x28')]={};this['ivrOriginated']={};this[_0x49c3('0x29')]={};this[_0x49c3('0x2a')]={};ami['on'](_0x49c3('0x2b'),this[_0x49c3('0x2c')]['bind'](this));ami['on'](_0x49c3('0x2d'),this[_0x49c3('0x2e')][_0x49c3('0x2f')](this));ami['on'](_0x49c3('0x30'),this[_0x49c3('0x31')][_0x49c3('0x2f')](this));ami['on']('agentcomplete',this[_0x49c3('0x32')][_0x49c3('0x2f')](this));ami['on']('custom:queuesummary',this[_0x49c3('0xa')][_0x49c3('0x2f')](this));ami['on']('hangup',this[_0x49c3('0x33')][_0x49c3('0x2f')](this));ami['on']('newexten',this[_0x49c3('0x34')]['bind'](this));ami['on'](_0x49c3('0x35'),this['syncVarSet'][_0x49c3('0x2f')](this));ami['on']('queuemember',this[_0x49c3('0x36')]['bind'](this));ami['on']('queuestatuscomplete',this[_0x49c3('0x37')][_0x49c3('0x2f')](this));this[_0x49c3('0x38')]();this['loopClearZombieChannels']();}function isNotNull(_0x101c6f){return _0x101c6f!==null&&!_[_0x49c3('0x39')](_0x101c6f);}function checkIsLoggedIn(_0x41b5df,_0x3a5855){return function(){if(_0x3a5855<=0x0){_0x41b5df['message']='AGENTS_NOT_LOGGED';throw _0x41b5df['name']+_0x49c3('0x3a');}};}function isActive(_0x554a7a){return _0x554a7a;}function checkIsActive(_0xac1204,_0x19c4f9){return function(){if(!isActive(_0x19c4f9)){_0xac1204['message']=_0x49c3('0x3b');throw _0xac1204[_0x49c3('0x3c')]+'\x20NOT\x20Active';}};}function checkInterval(_0x2e54b0){return function(){if(!isNotNull(_0x2e54b0[_0x49c3('0x3d')])){_0x2e54b0['message']='INTERVAL_IS_NULL';throw _0x2e54b0['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x2e54b0[_0x49c3('0x3d')][_0x49c3('0x3e')])){_0x2e54b0[_0x49c3('0x3f')]=_0x49c3('0x40');throw _0x2e54b0[_0x49c3('0x3c')]+_0x49c3('0x41');}if(!isNotNull(_[_0x49c3('0x42')](_0x2e54b0[_0x49c3('0x3d')][_0x49c3('0x3e')]))){_0x2e54b0[_0x49c3('0x3f')]=_0x49c3('0x40');throw _0x2e54b0[_0x49c3('0x3c')]+_0x49c3('0x41');}};}function msgResponse(_0x22171a,_0x3dfdb8,_0x14caf2){return{'action':_0x22171a,'response':_0x3dfdb8,'message':_0x14caf2,'stack':_0x14caf2};}function myreject(_0x5c34d2){return function(_0xf6a709){return _0x5c34d2(msgResponse(_0x49c3('0x43'),_0x49c3('0x44'),JSON[_0x49c3('0x45')](_0xf6a709)));};}function getSeconds(_0x20ca5a,_0x469cf0){var _0x1fb6c6=moment(_0x20ca5a)[_0x49c3('0x46')](0x0);var _0x5716cf=moment(_0x469cf0)['milliseconds'](0x0);return _0x1fb6c6[_0x49c3('0x47')](_0x5716cf,_0x49c3('0x48'));}function emit(_0x1c950e,_0x3641ae,_0x1ca507){io['to'](_0x1c950e)[_0x49c3('0x49')](_0x3641ae,_0x1ca507);}function emitVoiceQueueSummary(_0x4c1bd0){if(_0x4c1bd0[_0x49c3('0x4a')]===_0x49c3('0x4b')){var _0x17eea6={'id':_0x4c1bd0['id'],'name':_0x4c1bd0['name'],'strategy':_0x4c1bd0[_0x49c3('0x4c')],'answered':_0x4c1bd0['answered'],'available':_0x4c1bd0['available'],'loggedIn':_0x4c1bd0[_0x49c3('0x4d')],'pTalking':_0x4c1bd0[_0x49c3('0x4e')],'sumBillable':_0x4c1bd0[_0x49c3('0x4f')],'sumDuration':_0x4c1bd0[_0x49c3('0x50')],'sumHoldTime':_0x4c1bd0[_0x49c3('0x51')]||0x0,'talking':_0x4c1bd0[_0x49c3('0x52')],'total':_0x4c1bd0[_0x49c3('0x53')],'type':_0x4c1bd0[_0x49c3('0x4a')],'unmanaged':_0x4c1bd0['unmanaged'],'abandoned':_0x4c1bd0[_0x49c3('0x54')],'waiting':_0x4c1bd0[_0x49c3('0x55')],'loggedInDb':_0x4c1bd0['loggedInDb'],'dialActive':_0x4c1bd0[_0x49c3('0x56')],'dialMethod':_0x4c1bd0[_0x49c3('0x57')],'dialOriginateCallerIdName':_0x4c1bd0[_0x49c3('0x58')],'dialOriginateCallerIdNumber':_0x4c1bd0[_0x49c3('0x59')],'dialOriginateTimeout':_0x4c1bd0[_0x49c3('0x5a')],'dialPrefix':_0x4c1bd0[_0x49c3('0x5b')],'outboundAnswerAgiCallsDay':_0x4c1bd0[_0x49c3('0x5c')],'outboundAnswerCallsDay':_0x4c1bd0['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x4c1bd0['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x4c1bd0[_0x49c3('0x5d')],'outboundCongestionCallsDay':_0x4c1bd0[_0x49c3('0x5e')],'outboundDropCallsDayACS':_0x4c1bd0[_0x49c3('0x5f')],'outboundDropCallsDayCallersExit':_0x4c1bd0[_0x49c3('0x60')],'outboundDropCallsDayTimeout':_0x4c1bd0[_0x49c3('0x61')],'outboundNoAnswerCallsDay':_0x4c1bd0[_0x49c3('0x62')],'outboundNoSuchCallsDay':_0x4c1bd0[_0x49c3('0x63')],'outboundOriginateFailureCallsDay':_0x4c1bd0['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x4c1bd0[_0x49c3('0x64')],'outboundRejectCallsDay':_0x4c1bd0['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x4c1bd0[_0x49c3('0x65')],'predictiveIntervalAnsweredCalls':_0x4c1bd0['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x4c1bd0['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x4c1bd0[_0x49c3('0x66')],'predictiveIntervalDroppedCallsCallersExit':_0x4c1bd0['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x4c1bd0[_0x49c3('0x67')],'predictiveIntervalErlangCalls':_0x4c1bd0[_0x49c3('0x68')],'predictiveIntervalErlangCallsDroppedCalls':_0x4c1bd0[_0x49c3('0x69')],'predictiveIntervalHitRate':_0x4c1bd0[_0x49c3('0x6a')],'predictiveIntervalMultiplicativeFactor':_0x4c1bd0['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x4c1bd0[_0x49c3('0x6b')],'predictiveIntervalAvailable':_0x4c1bd0[_0x49c3('0x6c')],'predictiveIntervalTotalCalls':_0x4c1bd0[_0x49c3('0x6d')],'message':_0x4c1bd0[_0x49c3('0x3f')],'originated':_0x4c1bd0[_0x49c3('0x6e')],'erlangCalls':_0x4c1bd0[_0x49c3('0x6f')],'erlangCallToSecond':_0x4c1bd0['erlangCallToSecond'],'erlangAbandonmentRate':_0x4c1bd0[_0x49c3('0x70')],'erlangBusyFactor':_0x4c1bd0['erlangBusyFactor'],'startPredictive':_0x4c1bd0[_0x49c3('0x27')],'startProgressive':_0x4c1bd0['startProgressive']};if(_0x4c1bd0[_0x49c3('0x71')]){_0x17eea6[_0x49c3('0x71')]={'id':_0x4c1bd0[_0x49c3('0x71')]['id'],'name':_0x4c1bd0[_0x49c3('0x71')][_0x49c3('0x3c')],'active':_0x4c1bd0[_0x49c3('0x71')][_0x49c3('0x72')],'callerid':_0x4c1bd0['Trunk'][_0x49c3('0x73')]};}if(_0x4c1bd0[_0x49c3('0x3d')]){_0x17eea6['Interval']={'id':_0x4c1bd0[_0x49c3('0x3d')]['id'],'name':_0x4c1bd0[_0x49c3('0x3d')][_0x49c3('0x3c')]};}var _0x25b328=md5(JSON[_0x49c3('0x45')](_0x17eea6));if(_0x4c1bd0[_0x49c3('0x4')]!==_0x25b328){_0x4c1bd0[_0x49c3('0x4')]=_0x25b328;emit(util[_0x49c3('0x74')](_0x49c3('0x75'),_0x17eea6['name']),'voice_queue:save',_0x17eea6);}}}function emitCampaignSummary(_0x37dafa){if(_0x37dafa['type']===_0x49c3('0x76')){emit(util[_0x49c3('0x74')](_0x49c3('0x77'),_0x37dafa[_0x49c3('0x3c')]),'campaign:save',_0x37dafa);}}function checkGetDataPredictive(_0x3cce55){if(isNotNull(_0x3cce55)){if(!_[_0x49c3('0x42')](_0x3cce55)){loggerPredictive[_0x49c3('0x78')](_0x49c3('0x79'));loggerPredictive[_0x49c3('0x78')](_0x49c3('0x7a'),_0x3cce55[_0x49c3('0x6d')]);loggerPredictive['info'](_0x49c3('0x7b'),_0x3cce55[_0x49c3('0x7c')]);loggerPredictive[_0x49c3('0x78')](_0x49c3('0x7d'),_0x3cce55[_0x49c3('0x67')]);loggerPredictive[_0x49c3('0x78')](_0x49c3('0x7e'),_0x3cce55['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x49c3('0x78')](_0x49c3('0x7f'),_0x3cce55[_0x49c3('0x80')]);loggerPredictive[_0x49c3('0x78')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3cce55['predictiveIntervalAvgTalktime']);loggerPredictive['info']('---------------------------');if(_0x3cce55['predictiveIntervalTotalCalls']>0x0){if(!_[_0x49c3('0x39')](_0x3cce55['predictiveIntervalAvgTalktime'])&&_0x3cce55[_0x49c3('0x66')]>0x0){return!![];}else{loggerPredictive['info'](_0x49c3('0x81'));}if(!_[_0x49c3('0x39')](_0x3cce55['predictiveIntervalAvgHoldtime'])&&_0x3cce55[_0x49c3('0x80')]>0x0){return!![];}else{loggerPredictive[_0x49c3('0x78')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x49c3('0x78')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x49c3('0x78')]('History\x20information\x20are\x20empty');}}else{loggerPredictive[_0x49c3('0x78')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x26a1c6){return function(_0x2e60a0){loggerPredictive['info'](_0x49c3('0x82'));loggerPredictive[_0x49c3('0x78')](_0x49c3('0x83'),_0x2e60a0[_0x49c3('0x6f')]);loggerPredictive[_0x49c3('0x78')](_0x49c3('0x84'),_0x2e60a0[_0x49c3('0x85')]);loggerPredictive[_0x49c3('0x78')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2e60a0[_0x49c3('0x70')]);loggerPredictive[_0x49c3('0x78')](_0x49c3('0x86'),_0x2e60a0[_0x49c3('0x87')]);loggerPredictive[_0x49c3('0x78')](_0x49c3('0x88'),_0x2e60a0[_0x49c3('0x70')]);loggerPredictive['info']('---------------------------');_['merge'](_0x26a1c6,_0x2e60a0);};}function getDiff(_0x3395ae){var _0x3ae845=moment()[_0x49c3('0x46')](0x0);var _0x11ad1e=moment(_0x3395ae)[_0x49c3('0x46')](0x0);return _0x3ae845[_0x49c3('0x47')](_0x11ad1e,_0x49c3('0x48'));}function ifInterval(_0x196ac2,_0x4a646a){if(_[_0x49c3('0x39')](_0x4a646a)){return![];}if(getDiff(_0x4a646a)<_0x196ac2*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x47720a){if(isNotNull(_0x47720a)){if(!_['isUndefined'](_0x47720a[_0x49c3('0x28')])){_0x47720a[_0x49c3('0x28')]=undefined;loggerPredictive[_0x49c3('0x78')](_0x47720a[_0x49c3('0x3c')],'clearing\x20variable\x20start\x20progressive');}if(!_['isUndefined'](_0x47720a['startPredictive'])){_0x47720a[_0x49c3('0x27')]=undefined;loggerPredictive['info'](_0x47720a[_0x49c3('0x3c')],_0x49c3('0x89'));}if(!_[_0x49c3('0x39')](_0x47720a[_0x49c3('0x8a')])){clearInterval(_0x47720a[_0x49c3('0x8a')]);_0x47720a[_0x49c3('0x8a')]=undefined;loggerPredictive[_0x49c3('0x78')](_0x47720a[_0x49c3('0x3c')],_0x49c3('0x8b'));}}}function erlangb(_0x258d25,_0x3ea744){if(_0x3ea744===0x0){return 0x0;}var _0x3850cc=0x1;for(var _0x1632b7=0x1;_0x1632b7<=_0x3ea744;_0x1632b7+=0x1){_0x3850cc=0x1+_0x3850cc*_0x1632b7/_0x258d25;}return 0x1/_0x3850cc;}function isVoiceQueueOutbound(_0x5cb01c){return _0x5cb01c===_0x49c3('0x4b');}function isNotPreview(_0x531d9a){return _0x531d9a!==_0x49c3('0x1e');}function isCampaignIvr(_0xf043a5){return _0xf043a5===_0x49c3('0x76');}function getCallerId(_0x12ae0a,_0x4dc496,_0x310546){if(!_['isUndefined'](_0x310546)&&_0x49c3('0x8c')===typeof _0x310546&&!_[_0x49c3('0x42')](_0x310546)){if(!_[_0x49c3('0x39')](_0x4dc496)&&'string'===typeof _0x4dc496&&!_[_0x49c3('0x42')](_0x4dc496)){return util['format'](_0x49c3('0x8d'),_0x4dc496,_0x310546);}return util[_0x49c3('0x74')](_0x49c3('0x8d'),_0x310546,_0x310546);}if(!_[_0x49c3('0x39')](_0x12ae0a)&&_0x49c3('0x8c')===typeof _0x12ae0a&&!_[_0x49c3('0x42')](_0x12ae0a)){return _0x12ae0a;}return _0x49c3('0x8e');}function loggerCatchQueueSummary(_0x400d1a,_0x506108){return function(_0x237161){freeVariablesPredictive(_0x506108);emitVoiceQueueSummary(_0x506108);emitCampaignSummary(_0x506108);loggerSyncQueueSummary[_0x49c3('0x8f')](_0x400d1a,util['inspect'](_0x237161,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x418485,_0x1edb31){return function(_0x1d8714){loggerPredictive['error'](_0x1edb31[_0x49c3('0x3c')],_0x418485);loggerPredictive[_0x49c3('0x8f')](_0x1d8714[_0x49c3('0x90')]);freeVariablesPredictive(_0x1edb31);};}function loggerCatch(_0xba8680){return function(_0x326689){logger[_0x49c3('0x8f')](_0xba8680,util['inspect'](_0x326689,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x2da2dd){return _0x2da2dd&&!_[_0x49c3('0x39')](_0x2da2dd)&&_0x2da2dd[_0x49c3('0x91')]>0x0;}function decremetOriginate(_0x247718){if(!_['isUndefined'](_0x247718)&&_0x247718!==null){if(_0x247718[_0x49c3('0x92')](_0x49c3('0x6e'))){if(_0x247718['originated']>0x0){_0x247718[_0x49c3('0x6e')]-=0x1;}else{logger[_0x49c3('0x8f')](_0x49c3('0x93'));}}}else{logger[_0x49c3('0x8f')](_0x49c3('0x94'));}}function checkContactLowerLimitOriginate(_0x1a804b,_0x40168d,_0x346a18){if(_0x40168d>_0x346a18){for(var _0x59ad88=0x0;_0x59ad88<_0x40168d-_0x346a18;_0x59ad88+=0x1){decremetOriginate(_0x1a804b);}}}function loggerGetContactDialer(_0x4106c1,_0x47df48,_0x401a46){return function(_0x20edb4){checkContactLowerLimitOriginate(_0x47df48,_0x401a46,0x0);logger['error'](_0x4106c1,util[_0x49c3('0x95')](_0x20edb4,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x41e50e){return function(_0x56d4f6){if(isNotNull(_0x56d4f6)&&isNotNull(_0x56d4f6[0x0])){if(_0x56d4f6[0x0]['contactsRescheduled']>0x0){_0x41e50e[_0x49c3('0x3f')]=_0x49c3('0x96');logger[_0x49c3('0x78')](_0x49c3('0x97')+_0x41e50e['name'],_0x56d4f6[0x0][_0x49c3('0x98')],_0x49c3('0x99'));}else{_0x41e50e[_0x49c3('0x3f')]=_0x49c3('0x9a');logger['info'](_0x49c3('0x9b')+_0x41e50e[_0x49c3('0x3c')]);}}};}function notSendMessagesQueue(_0x565f94){if(_0x565f94[_0x49c3('0x9c')]){freeVariablesPredictive(_0x565f94);if(_0x565f94[_0x49c3('0x6e')]===0x0&&_0x565f94[_0x49c3('0x52')]===0x0&&_0x565f94[_0x49c3('0x55')]===0x0&&(_0x565f94[_0x49c3('0x4e')]||0x0)===0x0){_0x565f94['sendMessageOneNotActive']=![];_0x565f94['available']=0x0;_0x565f94[_0x49c3('0x3f')]=_0x49c3('0x3b');loggerSyncQueueSummary['error'](_0x49c3('0x9d'),_0x565f94['name'],'is\x20not\x20active');}else{_0x565f94[_0x49c3('0x3f')]='IS_DISACTIVED';loggerSyncQueueSummary['error'](_0x49c3('0x9d'),_0x565f94[_0x49c3('0x3c')],_0x49c3('0x9e'));}emitVoiceQueueSummary(_0x565f94);}}function notSendMessagesCampaign(_0x441a85){if(_0x441a85[_0x49c3('0x9c')]){if(_0x441a85[_0x49c3('0x6e')]===0x0){_0x441a85[_0x49c3('0x9c')]=![];_0x441a85[_0x49c3('0x3f')]=_0x49c3('0x3b');loggerSyncQueueSummary[_0x49c3('0x8f')](_0x49c3('0x9f'),_0x441a85[_0x49c3('0x3c')],'is\x20not\x20active');}else{_0x441a85[_0x49c3('0x3f')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x49c3('0x8f')](_0x49c3('0x9f'),_0x441a85[_0x49c3('0x3c')],_0x49c3('0x9e'));}emitCampaignSummary(_0x441a85);}}function createObjHistory(_0x1c1763,_0x4b3dfc,_0x54f67d,_0x322efb,_0x365779){_0x1c1763[_0x49c3('0x3f')]=_0x54f67d;var _0x1cf7db=new Action(_0x1c1763,_0x4b3dfc);var _0x5e7592=new History(_0x1cf7db);_0x5e7592[_0x49c3('0xa0')]=_0x322efb;_0x5e7592[_0x49c3('0xa1')]=_0x365779;_0x5e7592[_0x49c3('0xa2')]=_0x1cf7db['starttime'];return _0x5e7592;}Dialer[_0x49c3('0x19')][_0x49c3('0xa3')]=function(){var _0x22719a=this;setInterval(function(){_0x22719a[_0x49c3('0xa4')](_0x22719a[_0x49c3('0xa5')],'[uniqueid]');_0x22719a[_0x49c3('0xa4')](_0x22719a['actions'],_0x49c3('0xa6'));},0x32c8);};Dialer['prototype'][_0x49c3('0xa4')]=function(_0x4ca949,_0x192f1c){var _0xfe436b=this;for(var _0x326594 in _0x4ca949){if(_0x4ca949[_0x49c3('0x92')](_0x326594)){this['sequence'][_0x49c3('0x1a')](function(){if(!_[_0x49c3('0xa7')](_0x4ca949[_0x326594])){return ami['Action']({'action':'status','channel':_0x4ca949[_0x326594][_0x49c3('0xa8')]})[_0x49c3('0xa9')](function(_0x2a5126){if(_0x2a5126[_0x49c3('0x3f')]===_0x49c3('0xaa')){setTimeout(function(){if(_0x4ca949[_0x326594]&&_0x4ca949[_0x326594]['type']!=='ivr'){_0xfe436b[_0x49c3('0xab')](_0xfe436b[_0x49c3('0x1f')][_0x4ca949[_0x326594]['queue']]);logger[_0x49c3('0x8f')](_0x49c3('0xac'),_0x192f1c,_0x326594,_0x4ca949[_0x326594][_0x49c3('0xad')]);delete _0x4ca949[_0x326594];}if(_0x4ca949[_0x326594]&&_0x4ca949[_0x326594][_0x49c3('0x4a')]==='ivr'){_0xfe436b[_0x49c3('0xab')](_0xfe436b[_0x49c3('0x20')][_0x4ca949[_0x326594][_0x49c3('0xad')]]);logger[_0x49c3('0x8f')]('[Dialer][checkChannel][ivr]',_0x192f1c,_0x326594,_0x4ca949[_0x326594]['queue']);delete _0x4ca949[_0x326594];}},0x2328);}});}});}}};Dialer[_0x49c3('0x19')][_0x49c3('0xae')]=function(_0x5ae52e){return BPromise[_0x49c3('0xaf')]()[_0x49c3('0xb0')](cmHopper[_0x49c3('0xae')](_0x5ae52e))[_0x49c3('0xa9')](loggerCatch(_0x49c3('0xb1')));};Dialer[_0x49c3('0x19')]['checkIsBlackList']=function(_0x1d6946){return BPromise[_0x49c3('0xaf')]()[_0x49c3('0xb0')](cmHopperBlack['checkIsBlackList'](_0x1d6946))[_0x49c3('0xa9')](loggerCatch(_0x49c3('0xb2')));};Dialer[_0x49c3('0x19')]['checkIsBlackListIvr']=function(_0x43d1e2){return BPromise[_0x49c3('0xaf')]()[_0x49c3('0xb0')](cmHopperBlack[_0x49c3('0xb3')](_0x43d1e2))[_0x49c3('0xa9')](loggerCatch(_0x49c3('0xb4')));};Dialer[_0x49c3('0x19')]['averageHandleTime']=function(_0x481c0c){return BPromise[_0x49c3('0xaf')]()[_0x49c3('0xb0')](cmHopperHistory[_0x49c3('0xb5')](_0x481c0c))[_0x49c3('0xa9')](loggerCatch(_0x49c3('0xb6')));};Dialer[_0x49c3('0x19')][_0x49c3('0xb7')]=function(_0x88da24){return BPromise['resolve']()['then'](cmHopper[_0x49c3('0xb7')](_0x88da24))['catch'](loggerCatch('[rescheduleContact]\x20'));};Dialer['prototype']['unlockContact']=function(_0x24ac1a,_0x212db0,_0xa1644e){return BPromise['resolve']()[_0x49c3('0xb0')](cmHopper['unlockContact'](_0x24ac1a,_0x212db0,_0xa1644e))[_0x49c3('0xa9')](loggerCatch(_0x49c3('0xb8')));};Dialer['prototype'][_0x49c3('0xb9')]=function(_0xd3a4cb,_0x444129,_0x2a590e,_0x24a344){return BPromise[_0x49c3('0xaf')]()[_0x49c3('0xb0')](cmHopper[_0x49c3('0xb9')](_0xd3a4cb,_0x444129,_0x2a590e,_0x24a344))[_0x49c3('0xa9')](loggerCatch('[getContactDialer]\x20'));};Dialer[_0x49c3('0x19')][_0x49c3('0xba')]=function(_0x2c4e30,_0x119f23,_0x36906d){return BPromise[_0x49c3('0xaf')]()[_0x49c3('0xb0')](cmHopper[_0x49c3('0xba')](_0x2c4e30,_0x119f23,_0x36906d))['catch'](loggerCatch('[getContactDialer]\x20'));};Dialer[_0x49c3('0x19')][_0x49c3('0xbb')]=function(_0x3478ca){return BPromise['resolve']()['then'](voiceQueueRt['getVoiceQueueRtPauses'](_0x3478ca))[_0x49c3('0xa9')](loggerCatch(_0x49c3('0xbc')));};Dialer[_0x49c3('0x19')][_0x49c3('0xbd')]=function(_0x4e2dd4){return BPromise[_0x49c3('0xaf')]()['then'](cmHopper['moveContactManagedDialer'](_0x4e2dd4))['catch'](loggerCatch(_0x49c3('0xbe')));};Dialer['prototype'][_0x49c3('0xbf')]=function(_0x10ee07){return BPromise[_0x49c3('0xaf')]()[_0x49c3('0xb0')](cmHopperHistory[_0x49c3('0xbf')](_0x10ee07))[_0x49c3('0xa9')](loggerCatch('[createHistory]\x20'));};Dialer[_0x49c3('0x19')][_0x49c3('0xab')]=function(_0x1f95eb){if(!_['isUndefined'](_0x1f95eb)&&_0x1f95eb!==null){if(_0x1f95eb[_0x49c3('0x92')](_0x49c3('0x6e'))){if(_0x1f95eb[_0x49c3('0x6e')]>0x0){_0x1f95eb['originated']-=0x1;}else{logger['error'](_0x49c3('0xc0'));}}}else{logger[_0x49c3('0x8f')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x49c3('0x19')][_0x49c3('0xc1')]=function(_0x276e2a,_0x4362fc){var _0x50d8b4=this;return function(_0x272a8b){_0x50d8b4[_0x49c3('0xab')](_0x4362fc);logger[_0x49c3('0x8f')](_0x276e2a,util[_0x49c3('0x95')](_0x272a8b,{'showHidden':![],'depth':null}));};};Dialer[_0x49c3('0x19')][_0x49c3('0xc2')]=function(_0x4dfb9c,_0x50df95,_0x4de550){var _0x3c5ecf={'state':0x19,'statedesc':_0x49c3('0xc3')};this[_0x49c3('0xab')](_0x50df95);this[_0x49c3('0xc4')](_['merge'](_0x3c5ecf,_[_0x49c3('0xc5')](_0x4de550,[_0x49c3('0xc6'),_0x49c3('0xc7'),'UserId',_0x49c3('0xc8'),_0x49c3('0xc9')])),_0x49c3('0xca'),_0x49c3('0xcb'));logger[_0x49c3('0x8f')](_0x4dfb9c);};Dialer['prototype'][_0x49c3('0xcc')]=function(_0x4aeefd){return _0x4aeefd===_0x49c3('0xcd');};Dialer[_0x49c3('0x19')][_0x49c3('0xce')]=function(_0x52b5f7){return!_[_0x49c3('0x39')](_0x52b5f7)&&_0x52b5f7&&!_['isUndefined'](_0x52b5f7[_0x49c3('0x3c')])&&!_[_0x49c3('0x39')](_0x52b5f7[_0x49c3('0x72')])&&_0x52b5f7[_0x49c3('0x72')]&&(this[_0x49c3('0x22')][util['format'](_0x49c3('0xcf'),_0x52b5f7['name'])][_0x49c3('0xd0')]===_0x49c3('0xd1')||this[_0x49c3('0x22')][util[_0x49c3('0x74')](_0x49c3('0xcf'),_0x52b5f7['name'])][_0x49c3('0xd0')]===_0x49c3('0xd2'));};Dialer[_0x49c3('0x19')][_0x49c3('0xc4')]=function(_0x57558d,_0x48babc,_0xd6bf31){this[_0x49c3('0xbf')](_0x57558d)[_0x49c3('0xa9')](loggerCatch(_0x48babc));this[_0x49c3('0xbd')](_0x57558d)['catch'](loggerCatch(_0xd6bf31));};Dialer[_0x49c3('0x19')][_0x49c3('0xd3')]=function(_0x475c68){var _0x558340=this[_0x49c3('0xa5')][_0x475c68['uniqueid']];var _0x2b0fed;if(!_[_0x49c3('0xa7')](_0x475c68)&&!_['isNil'](_0x475c68[_0x49c3('0xd4')])&&!_[_0x49c3('0xa7')](_0x475c68[_0x49c3('0xd4')][_0x49c3('0xd5')])&&_0x475c68['exten']===_0x49c3('0xd6')&&_0x558340){if(_0x558340[_0x49c3('0x4a')]!==_0x49c3('0x76')&&this[_0x49c3('0x1f')][_0x558340[_0x49c3('0xad')]]['dialAMDActive']&&_0x475c68[_0x49c3('0xd7')]===_0x49c3('0xd8')){delete this['uniqueId'][_0x475c68[_0x49c3('0xd9')]];this[_0x49c3('0xab')](this['voiceQueues'][_0x558340[_0x49c3('0xad')]]);this[_0x49c3('0x1f')][_0x558340[_0x49c3('0xad')]][_0x49c3('0xda')]+=0x1;this[_0x49c3('0x1f')][_0x558340[_0x49c3('0xad')]][_0x49c3('0x5c')]+=0x1;_0x2b0fed=new Hangup(_0x558340,_0x475c68);_0x2b0fed[_0x49c3('0xa0')]=0x12;_0x2b0fed['statedesc']=_0x49c3('0xdb');_0x2b0fed[_0x49c3('0xdc')]=_0x49c3('0xdd');this[_0x49c3('0xc4')](_0x2b0fed,'[syncHangupInAMD][createHistory]','[syncHangupInAMD]');}if(_0x558340[_0x49c3('0x4a')]!==_0x49c3('0x76')&&this[_0x49c3('0x1f')][_0x558340[_0x49c3('0xad')]][_0x49c3('0xde')]&&_0x475c68[_0x49c3('0xd7')]===_0x49c3('0xdf')){delete this[_0x49c3('0xa5')][_0x475c68[_0x49c3('0xd9')]];this[_0x49c3('0xab')](this[_0x49c3('0x1f')][_0x558340[_0x49c3('0xad')]]);this[_0x49c3('0x1f')][_0x558340[_0x49c3('0xad')]][_0x49c3('0xda')]+=0x1;this[_0x49c3('0x1f')][_0x558340[_0x49c3('0xad')]][_0x49c3('0x5c')]+=0x1;_0x2b0fed=new Hangup(_0x558340,_0x475c68);_0x2b0fed[_0x49c3('0xa0')]=0x13;_0x2b0fed[_0x49c3('0xa1')]='Machine';_0x2b0fed[_0x49c3('0xdc')]=_0x49c3('0xdd');_0x2b0fed[_0x49c3('0xe0')]=!![];this[_0x49c3('0xc4')](_0x2b0fed,'[syncMachine][createHistory]',_0x49c3('0xe1'));}if(_0x558340[_0x49c3('0x4a')]===_0x49c3('0x76')&&this['campaigns'][_0x558340[_0x49c3('0xad')]][_0x49c3('0xde')]&&_0x475c68[_0x49c3('0xd7')]===_0x49c3('0xd8')){delete this['uniqueId'][_0x475c68[_0x49c3('0xd9')]];this['updateOriginated'](this[_0x49c3('0x20')][_0x558340[_0x49c3('0xad')]]);_0x2b0fed=new Hangup(_0x558340,_0x475c68);_0x2b0fed['state']=0x12;_0x2b0fed[_0x49c3('0xa1')]=_0x49c3('0xdb');_0x2b0fed[_0x49c3('0xdc')]=_0x49c3('0xdd');this[_0x49c3('0xc4')](_0x2b0fed,_0x49c3('0xe2'),_0x49c3('0xe3'));}if(_0x558340[_0x49c3('0x4a')]===_0x49c3('0x76')&&this[_0x49c3('0x20')][_0x558340['queue']][_0x49c3('0xde')]&&_0x475c68[_0x49c3('0xd7')]===_0x49c3('0xdf')){delete this['uniqueId'][_0x475c68[_0x49c3('0xd9')]];this['updateOriginated'](this[_0x49c3('0x20')][_0x558340[_0x49c3('0xad')]]);_0x2b0fed=new Hangup(_0x558340,_0x475c68);_0x2b0fed[_0x49c3('0xa0')]=0x13;_0x2b0fed[_0x49c3('0xa1')]=_0x49c3('0xe4');_0x2b0fed['membername']=_0x49c3('0xdd');_0x2b0fed['amd']=!![];this[_0x49c3('0xc4')](_0x2b0fed,'[syncMachineIvr][createHistory]',_0x49c3('0xe5'));}}};Dialer['prototype'][_0x49c3('0x33')]=function(_0x151bfc){var _0x392db1=this[_0x49c3('0xa5')][_0x151bfc[_0x49c3('0xd9')]];var _0x203321=this;var _0xa3622a;if(_0x392db1&&_0x392db1[_0x49c3('0x4a')]==='ivr'){delete this[_0x49c3('0xa5')][_0x151bfc[_0x49c3('0xd9')]];this['updateOriginated'](this[_0x49c3('0x20')][_0x392db1[_0x49c3('0xad')]]);this[_0x49c3('0x20')][_0x392db1[_0x49c3('0xad')]]['ivrAnswerCallsDay']+=0x1;_0xa3622a=new Hangup(_0x392db1,_0x151bfc);this[_0x49c3('0xbf')](_0xa3622a)[_0x49c3('0xa9')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x49c3('0xbd')](_0xa3622a)['catch'](loggerCatch(_0x49c3('0xe6')));}if(_0x392db1&&_0x392db1['type']!==_0x49c3('0x76')&&isNotNull(this[_0x49c3('0x1f')][_0x392db1[_0x49c3('0xad')]][_0x49c3('0xe7')])){delete this['uniqueId'][_0x151bfc['uniqueid']];this[_0x49c3('0xab')](this['voiceQueues'][_0x392db1[_0x49c3('0xad')]]);this['voiceQueues'][_0x392db1[_0x49c3('0xad')]][_0x49c3('0xda')]+=0x1;this[_0x49c3('0x1f')][_0x392db1[_0x49c3('0xad')]][_0x49c3('0x5c')]+=0x1;_0xa3622a=new Hangup(_0x392db1,_0x151bfc);_0xa3622a[_0x49c3('0xa0')]=0x10;_0xa3622a[_0x49c3('0xa1')]=_0x49c3('0xe8');_0xa3622a[_0x49c3('0xdc')]=_0x49c3('0xe9');this[_0x49c3('0xbf')](_0xa3622a)[_0x49c3('0xa9')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x49c3('0xbd')](_0xa3622a)[_0x49c3('0xa9')](loggerCatch(_0x49c3('0xe6')));}if(_0x392db1&&_0x392db1[_0x49c3('0x4a')]!=='ivr'&&!isNotNull(this[_0x49c3('0x1f')][_0x392db1[_0x49c3('0xad')]][_0x49c3('0xe7')])){delete this['uniqueId'][_0x151bfc[_0x49c3('0xd9')]];this[_0x49c3('0xab')](this[_0x49c3('0x1f')][_0x392db1[_0x49c3('0xad')]]);this[_0x49c3('0x1f')][_0x392db1[_0x49c3('0xad')]][_0x49c3('0x65')]+=0x1;_0xa3622a=new Hangup(_0x392db1,_0x151bfc);_0xa3622a[_0x49c3('0xa0')]=0xc;_0xa3622a['statedesc']=_0x151bfc[_0x49c3('0xea')];_0xa3622a[_0x49c3('0xdc')]='Unknow';this[_0x49c3('0xbf')](_0xa3622a)[_0x49c3('0xa9')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x49c3('0xbd')](_0xa3622a)['catch'](loggerCatch(_0x49c3('0xe6')));}};Dialer[_0x49c3('0x19')][_0x49c3('0x32')]=function(_0x10f2a8){var _0x3f3461=this['uniqueId'][_0x10f2a8[_0x49c3('0xd9')]];var _0x448193=this;if(this[_0x49c3('0x1f')][_0x10f2a8[_0x49c3('0xad')]]){if(_0x3f3461&&_0x3f3461[_0x49c3('0x4a')]!==_0x49c3('0x76')){delete this[_0x49c3('0xa5')][_0x10f2a8[_0x49c3('0xd9')]];this['voiceQueues'][_0x10f2a8['queue']]['outboundAnswerCallsDay']+=0x1;var _0x5c0644=new AgentComplete(_0x3f3461,_0x10f2a8);if(_0x10f2a8[_0x49c3('0xeb')]==='agent'){_0x5c0644[_0x49c3('0xec')]=this[_0x49c3('0x1f')][_0x10f2a8['queue']][_0x49c3('0xed')]&&this[_0x49c3('0x1f')][_0x10f2a8[_0x49c3('0xad')]]['dialAgiAfterHangupAgent']?moment()[_0x49c3('0x74')](_0x49c3('0xee')):undefined;}this[_0x49c3('0xbf')](_0x5c0644)[_0x49c3('0xa9')](loggerCatch(_0x49c3('0xef')));this[_0x49c3('0xbd')](_0x5c0644)[_0x49c3('0xa9')](loggerCatch(_0x49c3('0xf0')));}}};Dialer[_0x49c3('0x19')][_0x49c3('0x2c')]=function(_0x5391c8){if(this[_0x49c3('0x1f')][_0x5391c8[_0x49c3('0xad')]]){if(this['uniqueId'][_0x5391c8[_0x49c3('0xd9')]]&&this[_0x49c3('0xa5')][_0x5391c8[_0x49c3('0xd9')]][_0x49c3('0x4a')]!==_0x49c3('0x76')){this[_0x49c3('0xab')](this[_0x49c3('0x1f')][_0x5391c8[_0x49c3('0xad')]]);this['uniqueId'][_0x5391c8[_0x49c3('0xd9')]][_0x49c3('0xf1')]=moment()['format'](_0x49c3('0xee'));}}};Dialer[_0x49c3('0x19')]['queueCallerAbandonCreateState']=function(_0x2e43ce){this['createHistory'](_0x2e43ce)[_0x49c3('0xa9')](loggerCatch(_0x49c3('0xef')));this[_0x49c3('0xbd')](_0x2e43ce)['catch'](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer[_0x49c3('0x19')][_0x49c3('0x2e')]=function(_0x5c94a8){var _0x2d59e5=this[_0x49c3('0xa5')][_0x5c94a8[_0x49c3('0xd9')]];var _0x21e313=this;if(this[_0x49c3('0x1f')][_0x5c94a8[_0x49c3('0xad')]]){if(_0x2d59e5&&_0x2d59e5[_0x49c3('0x4a')]!=='ivr'){delete this['uniqueId'][_0x5c94a8[_0x49c3('0xd9')]];this[_0x49c3('0xab')](this['voiceQueues'][_0x5c94a8[_0x49c3('0xad')]]);_0x2d59e5[_0x49c3('0xf2')]=moment()['format'](_0x49c3('0xee'));var _0x50ec99=new QueueCallerAbandon(_0x2d59e5,_0x5c94a8);if(getSeconds(_0x2d59e5['droptime'],_0x2d59e5[_0x49c3('0xf3')])>=_0x2d59e5[_0x49c3('0xf4')]){this[_0x49c3('0x1f')][_0x5c94a8['queue']][_0x49c3('0x67')]+=0x1;this['voiceQueues'][_0x5c94a8[_0x49c3('0xad')]]['outboundDropCallsDayTimeout']+=0x1;this['voiceQueues'][_0x5c94a8[_0x49c3('0xad')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x50ec99[_0x49c3('0xa0')]=0xa;_0x50ec99[_0x49c3('0xa1')]='Drop';_0x50ec99[_0x49c3('0xf5')]=_0x49c3('0xf6');_0x50ec99[_0x49c3('0xec')]=this[_0x49c3('0x1f')][_0x5c94a8['queue']]['dialQueueProject2']?moment()[_0x49c3('0x74')](_0x49c3('0xee')):undefined;_0x50ec99[_0x49c3('0xf7')]+=0x1;if(_0x50ec99[_0x49c3('0xf7')]>=this[_0x49c3('0x1f')][_0x5c94a8['queue']][_0x49c3('0xf8')]){this[_0x49c3('0xf9')](_0x50ec99);}else{this[_0x49c3('0xb7')]({'active':![],'countdropretry':_0x50ec99[_0x49c3('0xf7')],'scheduledat':moment()[_0x49c3('0xfa')](this[_0x49c3('0x1f')][_0x5c94a8[_0x49c3('0xad')]]['dialDropRetryFrequency'],_0x49c3('0xfb'))[_0x49c3('0x74')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2d59e5['ContactId'],'ListId':_0x2d59e5[_0x49c3('0xc7')],'VoiceQueueId':_0x2d59e5['VoiceQueueId']||undefined,'CampaignId':_0x2d59e5[_0x49c3('0xc9')]||undefined})['catch'](loggerCatch(_0x49c3('0xfc')));var _0x1b03fd=new History(_0x50ec99);_0x1b03fd[_0x49c3('0xa0')]=0xa;_0x1b03fd[_0x49c3('0xa1')]=_0x49c3('0xfd');_0x1b03fd['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1b03fd[_0x49c3('0xa2')]=_0x1b03fd[_0x49c3('0xfe')];_0x1b03fd[_0x49c3('0xff')]=_0x50ec99[_0x49c3('0xff')];_0x1b03fd['calleridnum']=_0x50ec99[_0x49c3('0x100')];console[_0x49c3('0x101')](_0x49c3('0x102'),_0x5c94a8);console[_0x49c3('0x101')](_0x49c3('0x103'),_0x50ec99);console[_0x49c3('0x101')](_0x49c3('0x104'),_0x1b03fd);this[_0x49c3('0xbf')](_0x1b03fd)[_0x49c3('0xa9')](loggerCatch(_0x49c3('0x105')));}}else{this[_0x49c3('0x1f')][_0x5c94a8[_0x49c3('0xad')]][_0x49c3('0x106')]+=0x1;this[_0x49c3('0x1f')][_0x5c94a8[_0x49c3('0xad')]][_0x49c3('0x60')]+=0x1;_0x50ec99['state']=0xb;_0x50ec99['statedesc']=_0x49c3('0x107');_0x50ec99['dropreason']=_0x49c3('0x108');_0x50ec99[_0x49c3('0x109')]+=0x1;if(_0x50ec99['countabandonedretry']>=this[_0x49c3('0x1f')][_0x5c94a8['queue']][_0x49c3('0x10a')]){this['queueCallerAbandonCreateState'](_0x50ec99);}else{this[_0x49c3('0xb7')]({'active':![],'countabandonedretry':_0x50ec99[_0x49c3('0x109')],'scheduledat':moment()['add'](this[_0x49c3('0x1f')][_0x5c94a8[_0x49c3('0xad')]][_0x49c3('0x10b')],_0x49c3('0xfb'))[_0x49c3('0x74')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2d59e5[_0x49c3('0xc6')],'ListId':_0x2d59e5[_0x49c3('0xc7')],'VoiceQueueId':_0x2d59e5[_0x49c3('0xc8')]||undefined,'CampaignId':_0x2d59e5[_0x49c3('0xc9')]||undefined})[_0x49c3('0xa9')](loggerCatch(_0x49c3('0x10c')));var _0x1b03fd=new History(_0x50ec99);_0x1b03fd[_0x49c3('0xa0')]=0xb;_0x1b03fd[_0x49c3('0xa1')]=_0x49c3('0x107');_0x1b03fd[_0x49c3('0xfe')]=moment()[_0x49c3('0x74')](_0x49c3('0xee'));_0x1b03fd[_0x49c3('0xa2')]=_0x1b03fd['starttime'];console[_0x49c3('0x101')]('CRIS\x20createHistory\x2011',_0x1b03fd);this[_0x49c3('0xbf')](_0x1b03fd)[_0x49c3('0xa9')](loggerCatch(_0x49c3('0x10d')));}}}}};Dialer[_0x49c3('0x19')][_0x49c3('0x34')]=function(_0x5daf5c){if(this[_0x49c3('0x10e')][_0x5daf5c[_0x49c3('0xd9')]]){this[_0x49c3('0x10e')][_0x5daf5c[_0x49c3('0xd9')]][_0x49c3('0xa8')]=_0x5daf5c[_0x49c3('0xa8')];}if(this[_0x49c3('0xa5')][_0x5daf5c[_0x49c3('0xd9')]]){this[_0x49c3('0xa5')][_0x5daf5c['uniqueid']][_0x49c3('0xa8')]=_0x5daf5c[_0x49c3('0xa8')];}};Dialer['prototype'][_0x49c3('0x36')]=function(_0xd4c46f){if(strategy[this[_0x49c3('0x1f')][this['actions'][_0xd4c46f[_0x49c3('0x10f')]][_0x49c3('0xad')]][_0x49c3('0x4c')]]===_0x49c3('0x18')){if(this[_0x49c3('0x10e')][_0xd4c46f['actionid']]&&_[_0x49c3('0xa7')](this[_0x49c3('0x10e')][_0xd4c46f[_0x49c3('0x10f')]][_0x49c3('0x110')])&&_0xd4c46f[_0x49c3('0xd0')]==='1'&&_0xd4c46f[_0x49c3('0x111')]==='0'){if(this['agents'][_0xd4c46f['stateinterface']]){if(!this[_0x49c3('0x21')][_0xd4c46f[_0x49c3('0x112')]][_0x49c3('0x110')]){this[_0x49c3('0x21')][_0xd4c46f[_0x49c3('0x112')]][_0x49c3('0x110')]=!![];this['actions'][_0xd4c46f['actionid']]['locked']=!![];this['actions'][_0xd4c46f[_0x49c3('0x10f')]]['stateinterface']=_0xd4c46f[_0x49c3('0x112')];}}}}else if((strategy[this[_0x49c3('0x1f')][this[_0x49c3('0x10e')][_0xd4c46f[_0x49c3('0x10f')]][_0x49c3('0xad')]][_0x49c3('0x4c')]]||_0x49c3('0x17'))===_0x49c3('0x17')){if(this[_0x49c3('0x10e')][_0xd4c46f[_0x49c3('0x10f')]]){if(this[_0x49c3('0x21')][_0xd4c46f[_0x49c3('0x112')]]){this[_0x49c3('0x10e')][_0xd4c46f[_0x49c3('0x10f')]][_0x49c3('0x112')]=_0xd4c46f[_0x49c3('0x112')];if(_['isNil'](this['queueBooked'][this['actions'][_0xd4c46f[_0x49c3('0x10f')]][_0x49c3('0xad')]])){this[_0x49c3('0x29')][this['actions'][_0xd4c46f['actionid']][_0x49c3('0xad')]]=[];}this[_0x49c3('0x29')][this[_0x49c3('0x10e')][_0xd4c46f[_0x49c3('0x10f')]][_0x49c3('0xad')]]['push'](_[_0x49c3('0x113')](_[_0x49c3('0xc5')](this[_0x49c3('0x10e')][_0xd4c46f[_0x49c3('0x10f')]],['idHopper','stateinterface']),{'status':_0xd4c46f[_0x49c3('0xd0')],'paused':_0xd4c46f[_0x49c3('0x111')]}));}}}};function unlockQueueStatus(_0x2e8bd3,_0x50ba1d){setTimeout(function(){if(_[_0x49c3('0x39')](_0x2e8bd3[_0x49c3('0x114')])){loggerBooked[_0x49c3('0x8f')]('[unlockQueueStatus][undefined]',_0x50ba1d);}_0x2e8bd3[_0x49c3('0x114')]=!![];loggerBooked[_0x49c3('0x78')]('[booked][unlockQueueStatus]',_0x50ba1d,JSON[_0x49c3('0x45')](_['pick'](_0x2e8bd3,[_0x49c3('0x3c'),_0x49c3('0x114')])));},0x1f3);}Dialer[_0x49c3('0x19')]['syncQueueStatusComplete']=function(_0x512c5c){var _0x303847=this;var _0x4bffc9=_0x303847[_0x49c3('0x1f')][_0x303847[_0x49c3('0x10e')][_0x512c5c['actionid']][_0x49c3('0xad')]];if(strategy[this['voiceQueues'][this[_0x49c3('0x10e')][_0x512c5c['actionid']][_0x49c3('0xad')]][_0x49c3('0x4c')]]===_0x49c3('0x18')){if(this['actions'][_0x512c5c['actionid']]&&this[_0x49c3('0x10e')][_0x512c5c[_0x49c3('0x10f')]][_0x49c3('0x112')]){this[_0x49c3('0x1e')][_0x49c3('0x115')](this[_0x49c3('0x10e')][_0x512c5c['actionid']][_0x49c3('0x116')],this['actions'][_0x512c5c[_0x49c3('0x10f')]][_0x49c3('0x112')])[_0x49c3('0xa9')](function(_0x1e2109){logger[_0x49c3('0x8f')](_0x49c3('0x117'),util[_0x49c3('0x95')](_0x1e2109,{'showHidden':![],'depth':null}));})[_0x49c3('0x1c')](function(){_0x303847[_0x49c3('0xab')](_0x303847[_0x49c3('0x1f')][_0x303847[_0x49c3('0x10e')][_0x512c5c['actionid']]['queue']]);_0x303847[_0x49c3('0x21')][_0x303847[_0x49c3('0x10e')][_0x512c5c[_0x49c3('0x10f')]]['stateinterface']][_0x49c3('0x110')]=![];delete _0x303847['actions'][_0x512c5c[_0x49c3('0x10f')]];unlockQueueStatus(_0x4bffc9);});}else{this[_0x49c3('0xab')](this[_0x49c3('0x1f')][this['actions'][_0x512c5c['actionid']][_0x49c3('0xad')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0x49c3('0x10e')][_0x512c5c[_0x49c3('0x10f')]][_0x49c3('0xc6')],'ListId':this[_0x49c3('0x10e')][_0x512c5c['actionid']]['ListId'],'VoiceQueueId':this[_0x49c3('0x10e')][_0x512c5c[_0x49c3('0x10f')]]['VoiceQueueId']||undefined,'CampaignId':this[_0x49c3('0x10e')][_0x512c5c['actionid']]['CampaignId']||undefined})[_0x49c3('0xa9')](loggerCatch(_0x49c3('0x118')));delete this[_0x49c3('0x10e')][_0x512c5c[_0x49c3('0x10f')]];unlockQueueStatus(_0x4bffc9);}}else if((strategy[this[_0x49c3('0x1f')][this[_0x49c3('0x10e')][_0x512c5c[_0x49c3('0x10f')]][_0x49c3('0xad')]][_0x49c3('0x4c')]]||_0x49c3('0x17'))===_0x49c3('0x17')){var _0x253f00;if(this['actions'][_0x512c5c[_0x49c3('0x10f')]]&&!_[_0x49c3('0x42')](this[_0x49c3('0x29')][this[_0x49c3('0x10e')][_0x512c5c['actionid']][_0x49c3('0xad')]])){if(this['queueBookedRR'][_0x303847[_0x49c3('0x10e')][_0x512c5c[_0x49c3('0x10f')]][_0x49c3('0xad')]]){this[_0x49c3('0x2a')][_0x303847['actions'][_0x512c5c[_0x49c3('0x10f')]][_0x49c3('0xad')]]=this[_0x49c3('0x2a')][this['actions'][_0x512c5c[_0x49c3('0x10f')]][_0x49c3('0xad')]]?this[_0x49c3('0x2a')][this['actions'][_0x512c5c['actionid']][_0x49c3('0xad')]]:this['queueBooked'][this[_0x49c3('0x10e')][_0x512c5c[_0x49c3('0x10f')]][_0x49c3('0xad')]]?this[_0x49c3('0x29')][this[_0x49c3('0x10e')][_0x512c5c['actionid']][_0x49c3('0xad')]][_0x49c3('0x119')]||0x0:0x0;}this[_0x49c3('0x29')][this[_0x49c3('0x10e')][_0x512c5c['actionid']][_0x49c3('0xad')]]['_rr']=this['queueBookedRR'][this[_0x49c3('0x10e')][_0x512c5c[_0x49c3('0x10f')]][_0x49c3('0xad')]];for(var _0x2502b0=0x0;_0x2502b0=0x0?!![]:![];})['catch'](myreject(_0x4814a0)));}}else{_0x455a0f['push'](ami[_0x49c3('0x132')]({'action':_0x49c3('0x137'),'command':util[_0x49c3('0x74')]('iftime\x20%s,%s',_0x364c5a,!_[_0x49c3('0x39')](config['timezones'][_0x38efb2])?_0x38efb2:'')})[_0x49c3('0xb0')](function(_0x36c223){return _0x36c223[_0x49c3('0x138')][_0x49c3('0x135')](_0x49c3('0x136'))>=0x0?!![]:![];})[_0x49c3('0xa9')](myreject(_0x4814a0)));}BPromise[_0x49c3('0x139')](_0x455a0f)[_0x49c3('0xb0')](function(_0x159dc0){var _0x4ff2f9=_['some'](_0x159dc0);if(_0x4ff2f9){return _0x13fb10(_0x4ff2f9);}else{_0x32a839[_0x49c3('0x3f')]=_0x3c52e9?_0x49c3('0x13a'):'INTERVAL_IS_OVERTIME';return _0x4814a0(msgResponse(_0x49c3('0x13b'),_0x49c3('0x129'),_0x49c3('0x13c')+_0x3c52e9+'\x20'+_0x336bb2+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0x364c5a,{'showHidden':![],'depth':null})+_0x49c3('0x13d')+_0x38efb2));}})['catch'](function(_0x4b269b){return _0x4814a0(msgResponse('ifTime','Failure',JSON[_0x49c3('0x45')](_0x4b269b)));});});};Dialer['prototype'][_0x49c3('0x13e')]=function(_0x317947){var _0xa1b3bd=this;return function(){switch(_0x317947[_0x49c3('0x57')]){case _0x49c3('0x13f'):freeVariablesPredictive(_0x317947);_0xa1b3bd['handlePower'](_0x317947,0x1);break;case'power':freeVariablesPredictive(_0x317947);_0xa1b3bd[_0x49c3('0x140')](_0x317947,_0x317947[_0x49c3('0x141')]);break;case _0x49c3('0x8'):_0xa1b3bd[_0x49c3('0x8')](_0x317947);break;case'booked':freeVariablesPredictive(_0x317947);_0xa1b3bd[_0x49c3('0x140')](_0x317947,0x1);break;default:freeVariablesPredictive(_0x317947);logger[_0x49c3('0x8f')](_0x49c3('0x142'),_0x317947[_0x49c3('0x3c')],_0x49c3('0x143'));}};};Dialer['prototype'][_0x49c3('0x144')]=function(_0x322841){var _0xe2353=this;return function(){_0xe2353[_0x49c3('0x145')](_0x322841);};};Dialer[_0x49c3('0x19')]['syncQueueSummary']=function(_0x3bdd94){var _0x54e2f5=this;if(isNotPreview(_0x3bdd94[_0x49c3('0x57')])){if(isVoiceQueueOutbound(_0x3bdd94[_0x49c3('0x4a')])&&isActive(_0x3bdd94[_0x49c3('0x56')])){_0x3bdd94[_0x49c3('0x9c')]=!![];BPromise['resolve']()['then'](checkIsLoggedIn(_0x3bdd94,_0x3bdd94[_0x49c3('0x4d')]))['then'](checkIsActive(_0x3bdd94,_0x3bdd94[_0x49c3('0x56')]))['then'](checkInterval(_0x3bdd94))[_0x49c3('0xb0')](_0x54e2f5[_0x49c3('0x123')](_0x3bdd94))[_0x49c3('0xb0')](_0x54e2f5['checkIfTime'](_0x3bdd94[_0x49c3('0x146')],_0x3bdd94[_0x49c3('0x147')],_0x3bdd94[_0x49c3('0x3c')],_0x3bdd94))['then'](_0x54e2f5[_0x49c3('0x128')](_0x3bdd94[_0x49c3('0x3d')],_0x3bdd94['dialTimezone'],_0x3bdd94[_0x49c3('0x3c')],_0x3bdd94))[_0x49c3('0xb0')](_0x54e2f5[_0x49c3('0x13e')](_0x3bdd94))[_0x49c3('0xa9')](loggerCatchQueueSummary(_0x49c3('0x148'),_0x3bdd94));}else{notSendMessagesQueue(_0x3bdd94);}}else{freeVariablesPredictive(_0x3bdd94);}};Dialer[_0x49c3('0x19')][_0x49c3('0x122')]=function(){var _0x4425c9=this;var _0x2f22db;for(var _0xc6ec21 in this[_0x49c3('0x20')]){if(this[_0x49c3('0x20')][_0x49c3('0x92')](_0xc6ec21)){_0x2f22db=this[_0x49c3('0x20')][_0xc6ec21];if(isCampaignIvr(_0x2f22db[_0x49c3('0x4a')])&&isActive(_0x2f22db[_0x49c3('0x72')])){_0x2f22db[_0x49c3('0x9c')]=!![];BPromise['resolve']()[_0x49c3('0xb0')](checkIsActive(_0x2f22db,_0x2f22db[_0x49c3('0x72')]))[_0x49c3('0xb0')](checkInterval(_0x2f22db))[_0x49c3('0xb0')](_0x4425c9['checkIsTrunkReachable'](_0x2f22db))['then'](_0x4425c9[_0x49c3('0x126')](_0x2f22db['dialGlobalInterval'],_0x2f22db[_0x49c3('0x147')],_0x2f22db['name'],_0x2f22db))[_0x49c3('0xb0')](_0x4425c9['checkIfTimeIntervals'](_0x2f22db[_0x49c3('0x3d')],_0x2f22db[_0x49c3('0x147')],_0x2f22db['name'],_0x2f22db))['then'](_0x4425c9[_0x49c3('0x144')](_0x2f22db))[_0x49c3('0xa9')](loggerCatchQueueSummary(_0x49c3('0x149'),_0x2f22db));}else{notSendMessagesCampaign(_0x2f22db);}}}};function getCallerIdRandom(_0x10c219,_0x4b2b39){var _0x2950ba,_0x583456,_0x5c9fcb;if(_0x4b2b39<=0x0){_0x4b2b39=0x1;}_0x2950ba=new RegExp('\x5cw{0,'+_0x4b2b39+'}$');_0x583456=Math[_0x49c3('0x14a')](0xa,_0x4b2b39-0x1);_0x5c9fcb=Math[_0x49c3('0x14a')](0xa,_0x4b2b39)-0x1;return util[_0x49c3('0x74')]('%s',_[_0x49c3('0x14b')](_0x10c219,_0x2950ba,_[_0x49c3('0x14c')](_0x583456,_0x5c9fcb)));}function extractCalleridName(_0x25f11f){var _0x45d2e7=_0x25f11f['match'](/"(.*?)"/);return _0x45d2e7?_0x45d2e7[0x1]:_0x25f11f;}function extractCalleridNumber(_0x232d9c){var _0x18b01e=_0x232d9c[_0x49c3('0x14d')](/<(.*?)>/);return _0x18b01e?_0x18b01e[0x1]:_0x232d9c;}Dialer[_0x49c3('0x19')][_0x49c3('0x14e')]=function(_0x119938,_0x229cbd){var _0x1b5df5=this;var _0x1a9e98=uuid['v4']();this[_0x49c3('0x10e')][_0x1a9e98]=new Action(_0x119938,_0x229cbd,_0x1a9e98);return new BPromise(function(_0x4ec9e9,_0x52259d){if(_[_0x49c3('0x39')](_0x119938)&&_0x49c3('0x14f')!==typeof _0x119938){return _0x52259d(msgResponse(_0x49c3('0x150'),_0x49c3('0x129'),_0x49c3('0x151')));}if(_[_0x49c3('0x39')](_0x229cbd[_0x49c3('0x152')][_0x49c3('0x153')])||_0x229cbd[_0x49c3('0x152')]['phone']===null){return _0x52259d(msgResponse(_0x49c3('0x150'),_0x49c3('0x129'),_0x49c3('0x154')));}var _0x3e4c7e={'XMD-CALLERID':_0x1b5df5[_0x49c3('0x10e')][_0x1a9e98][_0x49c3('0x155')](),'XMD-AGI':_0x119938[_0x49c3('0xe7')]?util[_0x49c3('0x74')](_0x49c3('0x156'),ipAgi,_0x119938[_0x49c3('0xe7')]):_0x49c3('0x157'),'XMD-AGIAFTER':_0x119938[_0x49c3('0xed')]?util['format'](_0x49c3('0x156'),ipAgi,_0x119938[_0x49c3('0xed')]):'NONE','XMD-QUEUE':_0x119938[_0x49c3('0x4a')]==='outbound'?util[_0x49c3('0x74')](_0x49c3('0x158'),_0x119938[_0x49c3('0x3c')],_0x119938[_0x49c3('0x159')]||'',_0x119938[_0x49c3('0x15a')]?'c':'',_0x119938[_0x49c3('0xf4')]||0x3):_0x49c3('0x157'),'XMD-CONTACTID':_0x229cbd[_0x49c3('0xc6')],'XMD-CDRTYPE':_0x49c3('0x5'),'CALLERID(all)':_0x1b5df5['actions'][_0x1a9e98][_0x49c3('0x155')](),'XMD-AMD':_0x119938[_0x49c3('0xde')]?'ACTIVE':_0x49c3('0x157'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x119938['dialAMDActive']){_0x3e4c7e[_0x49c3('0x15b')]=_0x119938['dialAMDInitialSilence']||0x9c4;_0x3e4c7e['XMD-AMDGREETING']=_0x119938[_0x49c3('0x15c')]||0x5dc;_0x3e4c7e['XMD-AMDAFTERGREETINGSILENCE']=_0x119938[_0x49c3('0x15d')]||0x320;_0x3e4c7e[_0x49c3('0x15e')]=_0x119938[_0x49c3('0x15f')]||0x1388;_0x3e4c7e[_0x49c3('0x160')]=_0x119938[_0x49c3('0x161')]||0x64;_0x3e4c7e[_0x49c3('0x162')]=_0x119938['dialAMDBetweenWordsSilence']||0x32;_0x3e4c7e['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x119938[_0x49c3('0x163')]||0x3;_0x3e4c7e[_0x49c3('0x164')]=_0x119938[_0x49c3('0x165')]||0x100;_0x3e4c7e[_0x49c3('0x166')]=_0x119938[_0x49c3('0x167')]||0x1388;}if(_0x119938[_0x49c3('0x4a')]===_0x49c3('0x4b')){_0x3e4c7e['XMD-VOICEQUEUEID']=_0x229cbd[_0x49c3('0xc8')];}else{_0x3e4c7e[_0x49c3('0x168')]=_0x229cbd[_0x49c3('0xc9')];}for(var _0x158512 in _0x229cbd[_0x49c3('0x152')]){if(_0x229cbd['Contact'][_0x49c3('0x92')](_0x158512)){if(isNotNull(_0x229cbd['Contact'][_0x158512])&&_0x158512!=='id'&&_0x158512!=='tags'&&_0x158512!==_0x49c3('0x169')&&_0x158512!==_0x49c3('0x16a')){_0x3e4c7e[util[_0x49c3('0x74')](_0x49c3('0x16b'),_0x49c3('0x16c'),_[_0x49c3('0x16d')](_0x158512))]=_0x229cbd[_0x49c3('0x152')][_0x158512];}}}var _0xbefcd9=_0x1b5df5[_0x49c3('0xce')](_0x119938[_0x49c3('0x71')])?getCallerId(_0x119938[_0x49c3('0x71')][_0x49c3('0x73')],_0x119938[_0x49c3('0x58')],_0x119938[_0x49c3('0x16e')]>0x0?getCallerIdRandom(_0x119938[_0x49c3('0x59')],_0x119938[_0x49c3('0x16e')]):_0x119938[_0x49c3('0x59')]):getCallerId(_[_0x49c3('0xa7')](_0x119938[_0x49c3('0x16f')])?_0x119938[_0x49c3('0x71')]['callerid']:_0x119938[_0x49c3('0x16f')][_0x49c3('0x73')],_0x119938['dialOriginateCallerIdName'],_0x119938[_0x49c3('0x16e')]>0x0?getCallerIdRandom(_0x119938['dialOriginateCallerIdNumber'],_0x119938['dialRandomLastDigitCallerIdNumber']):_0x119938[_0x49c3('0x59')]);if(_0xbefcd9){_0x3e4c7e[_0x49c3('0x170')]=_0x1b5df5[_0x49c3('0x10e')][_0x1a9e98][_0x49c3('0x171')]=extractCalleridName(_0xbefcd9);_0x3e4c7e['XMD-ORIGINATECALLERIDNUM']=_0x1b5df5[_0x49c3('0x10e')][_0x1a9e98][_0x49c3('0x172')]=extractCalleridNumber(_0xbefcd9);}return ami[_0x49c3('0x132')]({'actionid':_0x1a9e98,'action':_0x49c3('0x150'),'channel':_0x1b5df5[_0x49c3('0xce')](_0x119938['Trunk'])?util[_0x49c3('0x74')]('SIP/%s/%s%s',_0x119938[_0x49c3('0x71')][_0x49c3('0x3c')],isNotNull(_0x119938[_0x49c3('0x5b')])?_0x119938[_0x49c3('0x5b')]['trim']()||'':'',_0x119938[_0x49c3('0x173')]>0x0?_0x229cbd[_0x49c3('0x152')]['phone'][_0x49c3('0x174')](_0x119938['dialCutDigit']):_0x229cbd['Contact']['phone']):util[_0x49c3('0x74')](_0x49c3('0x175'),_[_0x49c3('0xa7')](_0x119938[_0x49c3('0x16f')])?_0x119938[_0x49c3('0x71')][_0x49c3('0x3c')]:_0x119938[_0x49c3('0x16f')]['name'],isNotNull(_0x119938['dialPrefix'])?_0x119938[_0x49c3('0x5b')][_0x49c3('0x176')]()||'':'',_0x119938['dialCutDigit']>0x0?_0x229cbd['Contact'][_0x49c3('0x153')][_0x49c3('0x174')](_0x119938['dialCutDigit']):_0x229cbd[_0x49c3('0x152')][_0x49c3('0x153')]),'callerid':_0xbefcd9,'Exten':_0x49c3('0xd6'),'Context':_0x49c3('0x177'),'Priority':'1','variable':_0x3e4c7e,'timeout':(_0x119938[_0x49c3('0x5a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1a9e98})[_0x49c3('0xb0')](function(_0x4a599a){return _0x4ec9e9(_0x4a599a);})[_0x49c3('0xa9')](function(_0x4ee504){_0x119938[_0x49c3('0x178')]+=0x1;var _0x47966d=new History(_0x1b5df5[_0x49c3('0x10e')][_0x1a9e98]);logger[_0x49c3('0x8f')](util[_0x49c3('0x74')]('[originateError]:\x20%s',JSON[_0x49c3('0x45')](_0x4ee504)));_0x47966d[_0x49c3('0xa0')]=0xe;_0x47966d[_0x49c3('0xa1')]=_0x49c3('0x179');_0x47966d['starttime']=moment()[_0x49c3('0x74')](_0x49c3('0xee'));_0x47966d['endtime']=_0x47966d[_0x49c3('0xfe')];_0x1b5df5[_0x49c3('0xbf')](_0x47966d)[_0x49c3('0xa9')](loggerCatch(_0x49c3('0x17a')));_0x1b5df5[_0x49c3('0xbd')](_0x47966d)[_0x49c3('0xa9')](loggerCatch('[originate][error]'))[_0x49c3('0x1c')](function(){delete _0x1b5df5[_0x49c3('0x10e')][_0x1a9e98];return _0x52259d(msgResponse(_0x49c3('0x150'),'Error',_0x49c3('0x17b')));});});});};Dialer[_0x49c3('0x19')][_0x49c3('0x31')]=function(_0x591064){var _0x92092=this[_0x49c3('0x10e')][_0x591064[_0x49c3('0x10f')]];var _0x10bb48=this;if(_0x92092){delete this[_0x49c3('0x10e')][_0x591064['actionid']];_0x92092[_0x49c3('0xf3')]=moment()[_0x49c3('0x74')](_0x49c3('0xee'));var _0x5f3eaf=_0x92092['type']===_0x49c3('0x76')?this[_0x49c3('0x20')][_0x92092[_0x49c3('0xad')]]:this[_0x49c3('0x1f')][_0x92092[_0x49c3('0x17c')]()];if(!this[_0x49c3('0xcc')](_0x591064['response'])){this[_0x49c3('0xab')](_0x5f3eaf);return this[_0x49c3('0x17d')](_0x92092,_0x5f3eaf,_0x591064)['then'](function(_0x30da8c){})[_0x49c3('0xa9')](loggerCatch(_0x49c3('0x17e')));}else{this['uniqueId'][_0x591064[_0x49c3('0xd9')]]=_0x92092;}}};Dialer['prototype'][_0x49c3('0x17f')]=function(_0x53d1de,_0x5d8451,_0x163aaf){var _0x3953a7=new History(_0x5d8451);if(_0x3953a7[_0x49c3('0x180')]+_0x3953a7['countcongestionretry']+_0x3953a7[_0x49c3('0x181')]+_0x3953a7['countnosuchnumberretry']+_0x3953a7['countdropretry']+_0x3953a7[_0x49c3('0x109')]+_0x3953a7['countmachineretry']+_0x3953a7[_0x49c3('0x182')]>=_0x163aaf[_0x49c3('0x183')]-0x1){return!![];}switch(_0x53d1de){case 0x3:if(_0x3953a7[_0x49c3('0x181')]>=_0x163aaf[_0x49c3('0x184')]-0x1){return!![];}else{this[_0x49c3('0xb7')]({'active':![],'countnoanswerretry':_0x3953a7['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x49c3('0xfa')](_0x163aaf[_0x49c3('0x185')],_0x49c3('0xfb'))[_0x49c3('0x74')](_0x49c3('0xee')),'ContactId':_0x3953a7[_0x49c3('0xc6')],'ListId':_0x3953a7[_0x49c3('0xc7')],'VoiceQueueId':_0x3953a7[_0x49c3('0xc8')]||undefined,'CampaignId':_0x3953a7['CampaignId']||undefined})[_0x49c3('0xa9')](loggerCatch(_0x49c3('0x186')));}break;case 0x5:if(_0x3953a7[_0x49c3('0x180')]>=_0x163aaf[_0x49c3('0x187')]-0x1){return!![];}else{this[_0x49c3('0xb7')]({'active':![],'countbusyretry':_0x3953a7['countbusyretry']+=0x1,'scheduledat':moment()[_0x49c3('0xfa')](_0x163aaf[_0x49c3('0x188')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3953a7[_0x49c3('0xc6')],'ListId':_0x3953a7['ListId'],'VoiceQueueId':_0x3953a7[_0x49c3('0xc8')]||undefined,'CampaignId':_0x3953a7['CampaignId']||undefined})[_0x49c3('0xa9')](loggerCatch(_0x49c3('0x189')));}break;case 0x8:if(_0x3953a7[_0x49c3('0x18a')]>=_0x163aaf['dialCongestionMaxRetry']-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countcongestionretry':_0x3953a7[_0x49c3('0x18a')]+=0x1,'scheduledat':moment()[_0x49c3('0xfa')](_0x163aaf[_0x49c3('0x18b')],_0x49c3('0xfb'))['format'](_0x49c3('0xee')),'ContactId':_0x3953a7[_0x49c3('0xc6')],'ListId':_0x3953a7[_0x49c3('0xc7')],'VoiceQueueId':_0x3953a7[_0x49c3('0xc8')]||undefined,'CampaignId':_0x3953a7[_0x49c3('0xc9')]||undefined})[_0x49c3('0xa9')](loggerCatch(_0x49c3('0x18c')));}break;case 0x0:if(_0x3953a7[_0x49c3('0x18d')]>=_0x163aaf[_0x49c3('0x18e')]-0x1){return!![];}else{this[_0x49c3('0xb7')]({'active':![],'countnosuchnumberretry':_0x3953a7[_0x49c3('0x18d')]+=0x1,'scheduledat':moment()[_0x49c3('0xfa')](_0x163aaf[_0x49c3('0x18f')],_0x49c3('0xfb'))['format'](_0x49c3('0xee')),'ContactId':_0x3953a7[_0x49c3('0xc6')],'ListId':_0x3953a7['ListId'],'VoiceQueueId':_0x3953a7['VoiceQueueId']||undefined,'CampaignId':_0x3953a7['CampaignId']||undefined})[_0x49c3('0xa9')](loggerCatch(_0x49c3('0x190')));}break;case 0xa:if(_0x3953a7[_0x49c3('0xf7')]>=_0x163aaf['dialDropMaxRetry']-0x1){return!![];}else{this[_0x49c3('0xb7')]({'active':![],'countdropretry':_0x3953a7[_0x49c3('0xf7')]+=0x1,'scheduledat':moment()[_0x49c3('0xfa')](_0x163aaf[_0x49c3('0x191')],_0x49c3('0xfb'))[_0x49c3('0x74')](_0x49c3('0xee')),'ContactId':_0x3953a7[_0x49c3('0xc6')],'ListId':_0x3953a7[_0x49c3('0xc7')],'VoiceQueueId':_0x3953a7[_0x49c3('0xc8')]||undefined,'CampaignId':_0x3953a7[_0x49c3('0xc9')]||undefined})[_0x49c3('0xa9')](loggerCatch(_0x49c3('0xfc')));}break;case 0xb:if(_0x3953a7[_0x49c3('0x109')]>=_0x163aaf[_0x49c3('0x10a')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x3953a7[_0x49c3('0x109')]+=0x1,'scheduledat':moment()[_0x49c3('0xfa')](_0x163aaf['dialAbandonedRetryFrequency'],_0x49c3('0xfb'))[_0x49c3('0x74')](_0x49c3('0xee')),'ContactId':_0x3953a7[_0x49c3('0xc6')],'ListId':_0x3953a7[_0x49c3('0xc7')],'VoiceQueueId':_0x3953a7[_0x49c3('0xc8')]||undefined,'CampaignId':_0x3953a7[_0x49c3('0xc9')]||undefined})['catch'](loggerCatch(_0x49c3('0x10c')));}break;case 0x13:if(_0x3953a7[_0x49c3('0x192')]>=_0x163aaf['dialMachineMaxRetry']-0x1){return!![];}else{this[_0x49c3('0xb7')]({'active':![],'countmachineretry':_0x3953a7[_0x49c3('0x192')]+=0x1,'scheduledat':moment()[_0x49c3('0xfa')](_0x163aaf[_0x49c3('0x193')],'minutes')[_0x49c3('0x74')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3953a7[_0x49c3('0xc6')],'ListId':_0x3953a7['ListId'],'VoiceQueueId':_0x3953a7['VoiceQueueId']||undefined,'CampaignId':_0x3953a7[_0x49c3('0xc9')]||undefined})[_0x49c3('0xa9')](loggerCatch(_0x49c3('0x194')));}break;case 0x14:if(_0x3953a7['countagentrejectretry']>=_0x163aaf[_0x49c3('0x195')]-0x1){return!![];}else{this[_0x49c3('0xb7')]({'active':![],'countagentrejectretry':_0x3953a7[_0x49c3('0x182')]+=0x1,'scheduledat':moment()[_0x49c3('0xfa')](_0x163aaf[_0x49c3('0x196')],'minutes')[_0x49c3('0x74')](_0x49c3('0xee')),'ContactId':_0x3953a7[_0x49c3('0xc6')],'ListId':_0x3953a7['ListId'],'VoiceQueueId':_0x3953a7[_0x49c3('0xc8')]||undefined,'CampaignId':_0x3953a7['CampaignId']||undefined})['catch'](loggerCatch(_0x49c3('0x197')));}break;default:return!![];}};Dialer[_0x49c3('0x19')]['callProgressDetecting']=function(_0x2a831b,_0x5b4391,_0x200f19){var _0x456c58=this;var _0x554f82=new History(_0x2a831b);return new BPromise(function(_0x52d53f,_0x144b4a){if(_[_0x49c3('0x39')](_0x5b4391)&&_0x49c3('0x14f')!==typeof _0x5b4391){return _0x144b4a(msgResponse(_0x49c3('0x198'),_0x49c3('0x129'),_0x49c3('0x199')));}if(_[_0x49c3('0x39')](_0x200f19)&&_0x49c3('0x14f')!==typeof _0x200f19){return _0x144b4a(msgResponse('[callProgressDetecting]',_0x49c3('0x129'),_0x49c3('0x19a')));}switch(_0x200f19[_0x49c3('0xeb')]){case'0':_0x5b4391[_0x49c3('0x63')]+=0x1;_0x554f82['state']=0x0;_0x554f82['statedesc']='NoSuchNumber';_0x554f82[_0x49c3('0x18d')]+=0x1;_0x554f82[_0x49c3('0x19b')]+=0x1;_0x456c58[_0x49c3('0xbf')](_0x554f82)[_0x49c3('0xa9')](loggerCatch(_0x49c3('0x19c')));if(_0x456c58[_0x49c3('0x17f')](0x0,_0x2a831b,_0x5b4391)){if(_0x554f82[_0x49c3('0x180')]+_0x554f82[_0x49c3('0x18a')]+_0x554f82[_0x49c3('0x181')]+_0x554f82[_0x49c3('0x18d')]+_0x554f82[_0x49c3('0xf7')]+_0x554f82[_0x49c3('0x109')]+_0x554f82[_0x49c3('0x192')]+_0x554f82[_0x49c3('0x182')]>=_0x5b4391[_0x49c3('0x183')]){_0x456c58['stateGlobal'](_0x554f82,_0x52d53f,_0x144b4a,_0x49c3('0x19d'));}else{_0x456c58['createStateFinal'](_0x554f82,_0x52d53f,_0x144b4a,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x5b4391['outboundNoAnswerCallsDay']+=0x1;_0x554f82[_0x49c3('0xa0')]=0x3;_0x554f82[_0x49c3('0xa1')]=_0x49c3('0x19e');_0x554f82[_0x49c3('0x181')]+=0x1;_0x554f82['countglobal']+=0x1;_0x456c58[_0x49c3('0xbf')](_0x554f82)[_0x49c3('0xa9')](loggerCatch(_0x49c3('0x19f')));if(_0x456c58[_0x49c3('0x17f')](0x3,_0x2a831b,_0x5b4391)){if(_0x554f82[_0x49c3('0x181')]>=_0x5b4391[_0x49c3('0x184')]){_0x456c58[_0x49c3('0x1a0')](_0x554f82,_0x52d53f,_0x144b4a,_0x49c3('0x1a1'));}else{_0x456c58['stateGlobal'](_0x554f82,_0x52d53f,_0x144b4a,_0x49c3('0x1a1'));}}break;case'5':_0x5b4391[_0x49c3('0x5d')]+=0x1;_0x554f82[_0x49c3('0xa0')]=0x5;_0x554f82[_0x49c3('0xa1')]=_0x49c3('0x1a2');_0x554f82[_0x49c3('0x180')]+=0x1;_0x554f82[_0x49c3('0x19b')]+=0x1;_0x456c58[_0x49c3('0xbf')](_0x554f82)[_0x49c3('0xa9')](loggerCatch(_0x49c3('0x1a3')));if(_0x456c58[_0x49c3('0x17f')](0x5,_0x2a831b,_0x5b4391)){if(_0x554f82[_0x49c3('0x180')]>=_0x5b4391[_0x49c3('0x187')]){_0x456c58[_0x49c3('0x1a0')](_0x554f82,_0x52d53f,_0x144b4a,_0x49c3('0x1a4'));}else{_0x456c58['stateGlobal'](_0x554f82,_0x52d53f,_0x144b4a,'reason\x205\x20busy');}}break;case'8':_0x5b4391[_0x49c3('0x5e')]+=0x1;_0x554f82['state']=0x8;_0x554f82['statedesc']=_0x49c3('0x1a5');_0x554f82[_0x49c3('0x18a')]+=0x1;_0x554f82[_0x49c3('0x19b')]+=0x1;_0x456c58[_0x49c3('0xbf')](_0x554f82)[_0x49c3('0xa9')](loggerCatch(_0x49c3('0x1a6')));if(_0x456c58[_0x49c3('0x17f')](0x8,_0x2a831b,_0x5b4391)){if(_0x554f82['countcongestionretry']>=_0x5b4391[_0x49c3('0x1a7')]){_0x456c58[_0x49c3('0x1a0')](_0x554f82,_0x52d53f,_0x144b4a,_0x49c3('0x1a8'));}else{_0x456c58[_0x49c3('0x1a9')](_0x554f82,_0x52d53f,_0x144b4a,_0x49c3('0x1a8'));}}break;case'11':_0x5b4391[_0x49c3('0x1aa')]+=0x1;_0x554f82[_0x49c3('0xa0')]=0xb;_0x554f82[_0x49c3('0xa1')]='Abandoned';_0x554f82['countabandonedretry']+=0x1;_0x554f82[_0x49c3('0x19b')]+=0x1;_0x456c58[_0x49c3('0xbf')](_0x554f82)['catch'](loggerCatch(_0x49c3('0x10d')));if(_0x456c58[_0x49c3('0x17f')](0xb,_0x2a831b,_0x5b4391)){if(_0x554f82[_0x49c3('0x109')]>=_0x5b4391[_0x49c3('0x10a')]){_0x456c58['createStateFinal'](_0x554f82,_0x52d53f,_0x144b4a,_0x49c3('0x1ab'));}else{_0x456c58[_0x49c3('0x1a9')](_0x554f82,_0x52d53f,_0x144b4a,_0x49c3('0x1ab'));}}break;case'20':_0x5b4391[_0x49c3('0x1ac')]+=0x1;_0x554f82[_0x49c3('0xa0')]=0x14;_0x554f82['statedesc']=_0x49c3('0x1ad');_0x554f82[_0x49c3('0x182')]+=0x1;_0x554f82['countglobal']+=0x1;_0x456c58[_0x49c3('0xbf')](_0x554f82)[_0x49c3('0xa9')](loggerCatch(_0x49c3('0x1ae')));if(_0x456c58[_0x49c3('0x17f')](0x14,_0x2a831b,_0x5b4391)){if(_0x554f82[_0x49c3('0x182')]>=_0x5b4391[_0x49c3('0x195')]){_0x456c58[_0x49c3('0x1a0')](_0x554f82,_0x52d53f,_0x144b4a,_0x49c3('0x1af'));}else{_0x456c58[_0x49c3('0x1a9')](_0x554f82,_0x52d53f,_0x144b4a,_0x49c3('0x1af'));}}break;default:_0x5b4391[_0x49c3('0x65')]+=0x1;_0x554f82[_0x49c3('0xa0')]=0xc;_0x554f82[_0x49c3('0xa1')]=_0x200f19['reason'];_0x456c58['createHistory'](_0x554f82)['catch'](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x456c58[_0x49c3('0x17f')](_0x200f19[_0x49c3('0xeb')],_0x2a831b,_0x5b4391)){if(_0x554f82[_0x49c3('0x180')]+_0x554f82[_0x49c3('0x18a')]+_0x554f82[_0x49c3('0x181')]+_0x554f82[_0x49c3('0x18d')]+_0x554f82[_0x49c3('0xf7')]+_0x554f82[_0x49c3('0x109')]+_0x554f82[_0x49c3('0x192')]+_0x554f82['countagentrejectretry']>=_0x5b4391[_0x49c3('0x183')]){_0x456c58[_0x49c3('0x1a9')](_0x554f82,_0x52d53f,_0x144b4a,_0x200f19[_0x49c3('0xeb')]);}else{_0x456c58[_0x49c3('0x1a0')](_0x554f82,_0x52d53f,_0x144b4a,_0x200f19['reason']);}}}});};Dialer[_0x49c3('0x19')][_0x49c3('0x1a9')]=function(_0x2dc6c2,_0x504401,_0x356bc6,_0x5a65e3){var _0x4ea142=new Final(_0x2dc6c2);_0x4ea142['state']=0xf;_0x4ea142['statedesc']=_0x49c3('0x1b0');this[_0x49c3('0x1a0')](_0x4ea142,_0x504401,_0x356bc6,_0x5a65e3);};Dialer[_0x49c3('0x19')][_0x49c3('0x1a0')]=function(_0x2b0646,_0xe011ee,_0x5c558d,_0x3f5f4d){this[_0x49c3('0xbd')](_0x2b0646)['then'](function(_0x29817a){return _0xe011ee(msgResponse('[callProgressDetecting]',_0x49c3('0xcd'),_0x3f5f4d));})[_0x49c3('0xa9')](function(_0xf5800d){return _0x5c558d(msgResponse(_0x49c3('0x1b1'),_0x49c3('0x129'),_0x49c3('0x1b2')));});};Dialer['prototype'][_0x49c3('0x8')]=function(_0xd10f2b){var _0x5c272f=this;var _0x475133=_0xd10f2b[_0x49c3('0x1b3')]/0x64;var _0x3914af=_0xd10f2b[_0x49c3('0x61')]/(_0xd10f2b['outboundDropCallsDayTimeout']+_0xd10f2b['outboundAnswerCallsDay']);var _0x595f74=Math[_0x49c3('0x1b4')](_0xd10f2b[_0x49c3('0x6c')]*(_0xd10f2b['predictiveIntervalMaxThreshold']/0x64));var _0xc3f0cb=Math['round'](_0xd10f2b[_0x49c3('0x6c')]*(_0xd10f2b[_0x49c3('0x1b5')]/0x64));var _0x5d415c=_0xd10f2b[_0x49c3('0x1b6')]+_0xd10f2b[_0x49c3('0x52')];var _0x344fac=Math['floor'](_0xd10f2b[_0x49c3('0x6f')]*_0xd10f2b[_0x49c3('0x70')]*_0xd10f2b[_0x49c3('0x6a')]*_0xd10f2b[_0x49c3('0x1b7')]);if(_[_0x49c3('0x39')](_0xd10f2b[_0x49c3('0x28')])){if(!_['isUndefined'](_0xd10f2b[_0x49c3('0x27')])){_0xd10f2b[_0x49c3('0x27')]=undefined;loggerPredictive[_0x49c3('0x8f')](_0x49c3('0x1b8'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x49c3('0x39')](_0xd10f2b['handlePredictive'])){loggerPredictive[_0x49c3('0x8f')](_0x49c3('0x1b8'),_0x49c3('0x1b9'));clearInterval(_0xd10f2b[_0x49c3('0x8a')]);_0xd10f2b['handlePredictive']=undefined;}_0xd10f2b['startProgressive']=moment()[_0x49c3('0x74')](_0x49c3('0xee'));loggerPredictive['info'](_0xd10f2b[_0x49c3('0x3c')],_0x49c3('0x1ba'),_0xd10f2b['startProgressive']);this['handlePower'](_0xd10f2b,0x1);}else if(ifInterval(_0xd10f2b[_0x49c3('0x1bb')],_0xd10f2b[_0x49c3('0x28')])){this['handlePower'](_0xd10f2b,0x1);loggerPredictiveCalls[_0x49c3('0x78')]('[startMethodPredictive][StartProgressive][Loop]',_0xd10f2b[_0x49c3('0x28')],_0xd10f2b[_0x49c3('0x3c')]);_0xd10f2b[_0x49c3('0x6f')]=0x0;_0xd10f2b[_0x49c3('0x69')]=0x0;}else if(_0x475133<_0x3914af&&_0xd10f2b[_0x49c3('0x1bc')]===_0x49c3('0x1bd')){freeVariablesPredictive(_0xd10f2b);loggerPredictive['info'](_0x49c3('0x1be'),_0x49c3('0x1bf'),_0x3914af,_0x49c3('0x28'),_0xd10f2b['name']);}else if(_0x344fac<_0xd10f2b['predictiveIntervalErlangCallsDroppedCalls']&&_0xd10f2b[_0x49c3('0x1bc')]===_0x49c3('0x1bd')){freeVariablesPredictive(_0xd10f2b);loggerPredictive['info'](_0x49c3('0x1c0'),'Max\x20Drop\x20',_0x344fac,_0x49c3('0x1c1'),_0xd10f2b['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0xd10f2b[_0x49c3('0x3c')]);}else if(!ifInterval(_0xd10f2b['dialPredictiveInterval'],_0xd10f2b[_0x49c3('0x28')])&&_[_0x49c3('0x39')](_0xd10f2b[_0x49c3('0x27')])&&!_[_0x49c3('0x39')](_0xd10f2b[_0x49c3('0x28')])){_0xd10f2b[_0x49c3('0x27')]=moment()[_0x49c3('0x74')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x49c3('0x78')](_0xd10f2b[_0x49c3('0x3c')],_0x49c3('0x1c2'),_0xd10f2b[_0x49c3('0x27')]);this[_0x49c3('0x1c3')](_0xd10f2b['dialPredictiveInterval'])['then'](this[_0x49c3('0x1c4')](_0xd10f2b))['then'](mergeDataErlangB(_0xd10f2b))[_0x49c3('0xb0')](this[_0x49c3('0x1c5')](_0xd10f2b))[_0x49c3('0xa9')](loggerCatchPredictive(_0x49c3('0x1c6'),_0xd10f2b));}else if(!ifInterval(_0xd10f2b['dialPredictiveInterval'],_0xd10f2b[_0x49c3('0x27')])){_0xd10f2b[_0x49c3('0x69')]=0x0;_0xd10f2b[_0x49c3('0x27')]=moment()[_0x49c3('0x74')](_0x49c3('0xee'));loggerPredictive[_0x49c3('0x78')](_0xd10f2b[_0x49c3('0x3c')],_0x49c3('0x1c7'),_0xd10f2b[_0x49c3('0x27')]);clearInterval(_0xd10f2b[_0x49c3('0x8a')]);_0xd10f2b[_0x49c3('0x8a')]=undefined;this[_0x49c3('0x1c3')](_0xd10f2b[_0x49c3('0x1bb')])[_0x49c3('0xb0')](this[_0x49c3('0x1c4')](_0xd10f2b))[_0x49c3('0xb0')](mergeDataErlangB(_0xd10f2b))[_0x49c3('0xb0')](this[_0x49c3('0x1c5')](_0xd10f2b))['catch'](loggerCatchPredictive(_0x49c3('0x1c8'),_0xd10f2b));}else if(_0xd10f2b['predictiveIntervalAvailable']&&_0x5d415c<_0xd10f2b[_0x49c3('0x6c')]-_0xc3f0cb){freeVariablesPredictive(_0xd10f2b);loggerPredictive['info'](_0xd10f2b[_0x49c3('0x3c')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x5d415c,_0x49c3('0x1c9'),_0xd10f2b['predictiveIntervalAvailable'],'-',_0xc3f0cb,'=',_0xd10f2b[_0x49c3('0x6c')]-_0xc3f0cb,')');}else if(_0xd10f2b[_0x49c3('0x6c')]&&_0x5d415c>_0xd10f2b[_0x49c3('0x6c')]+_0x595f74){freeVariablesPredictive(_0xd10f2b);loggerPredictive['info'](_0xd10f2b[_0x49c3('0x3c')],_0x49c3('0x1ca'),_0x5d415c,_0x49c3('0x1cb'),_0xd10f2b[_0x49c3('0x6c')],'+',_0x595f74,'=',_0xd10f2b[_0x49c3('0x6c')]+_0x595f74,')');}};Dialer[_0x49c3('0x19')][_0x49c3('0x1c4')]=function(_0x4f68a6){var _0x2eedea=this;return function(_0x1df3cf){return new BPromise(function(_0xa4b82e,_0x2523df){_[_0x49c3('0x113')](_0x4f68a6,_0x1df3cf[0x0]);if(checkGetDataPredictive(_0x1df3cf[0x0])){var _0x45c23d=_0x4f68a6['predictiveIntervalAvailable']=_0x4f68a6[_0x49c3('0x52')]+_0x4f68a6[_0x49c3('0x1b6')];var _0x3990be=_0x4f68a6[_0x49c3('0x1bb')]*0x3c;var _0xaca038=_0x1df3cf[0x0][_0x49c3('0x66')]+_0x1df3cf[0x0][_0x49c3('0x80')];var _0xd90638=(_0x1df3cf[0x0][_0x49c3('0x7c')]+_0x1df3cf[0x0][_0x49c3('0x67')]+_0x1df3cf[0x0][_0x49c3('0x106')])/_0x1df3cf[0x0]['predictiveIntervalTotalCalls'];_0x4f68a6[_0x49c3('0x6a')]=_0xd90638>0x0?_0xd90638:0x1;switch(_0x4f68a6['dialPredictiveOptimization']){case'dropRate':var _0x2104f8=_0x4f68a6[_0x49c3('0x1b3')]/0x64;return _0x2eedea[_0x49c3('0x1cc')](_0x45c23d,_0x3990be,_0xaca038,_0xd90638,_0x2104f8)['then'](function(_0x323e63){return _0xa4b82e(_0x323e63);});case _0x49c3('0x1cd'):var _0x50053b=_0x4f68a6[_0x49c3('0x1b3')]/0x64;return _0x2eedea[_0x49c3('0x1ce')](_0x45c23d,_0x3990be,_0xaca038,_0xd90638,_0x50053b)[_0x49c3('0xb0')](function(_0x1cfba0){return _0xa4b82e(_0x1cfba0);});default:return _0x2523df(msgResponse(_0x49c3('0x1cf'),_0x49c3('0x129'),_0x49c3('0x1d0')));}}else{return _0x2523df(msgResponse('[getDataPredictive]','Failure',_0x49c3('0x1d1')));}});};};Dialer[_0x49c3('0x19')]['getDataPredictiveOld']=function(_0x3bb86f){var _0x495177=this;return function(_0x57d79e){return new BPromise(function(_0x3f54af,_0x581782){_[_0x49c3('0x113')](_0x3bb86f,_0x57d79e[0x0]);if(checkGetDataPredictive(_0x57d79e[0x0])){loggerPredictive['info'](JSON[_0x49c3('0x45')](_0x57d79e[0x0]));if(_0x3bb86f[_0x49c3('0x1bc')]===_0x49c3('0x1bd')){return _0x495177[_0x49c3('0xbb')](_0x3bb86f['id'])[_0x49c3('0xb0')](function(_0x106c21){var _0x46ce14=_0x3bb86f['loggedIn']-_0x106c21[0x0][_0x49c3('0x1d2')];var _0x4fd26a=_0x3bb86f[_0x49c3('0x1bb')]*0x3c;var _0x5bae34=_0x57d79e[0x0][_0x49c3('0x66')]+_0x57d79e[0x0][_0x49c3('0x80')];var _0x4af048=(_0x57d79e[0x0][_0x49c3('0x7c')]+_0x57d79e[0x0][_0x49c3('0x67')]+_0x57d79e[0x0][_0x49c3('0x106')])/_0x57d79e[0x0][_0x49c3('0x6d')];var _0x2ed732=_0x3bb86f[_0x49c3('0x1b3')]/0x64;_0x3bb86f['predictiveIntervalPauses']=_0x106c21[0x0][_0x49c3('0x1d2')]||0x0;_0x3bb86f['predictiveIntervalHitRate']=_0x4af048>0x0?_0x4af048:0x1;return _0x495177[_0x49c3('0x1cc')](_0x46ce14,_0x4fd26a,_0x5bae34,_0x4af048,_0x2ed732);})[_0x49c3('0xb0')](function(_0x2cdab0){return _0x3f54af(_0x2cdab0);})[_0x49c3('0xa9')](function(_0x43890a){return _0x581782(msgResponse(_0x49c3('0x1d3'),_0x49c3('0x129'),JSON[_0x49c3('0x45')](_0x43890a)));});}if(_0x3bb86f[_0x49c3('0x1bc')]==='agentBusyFactor'){return _0x495177['getVoiceQueueRtPauses'](_0x3bb86f['id'])['then'](function(_0x3367bf){var _0x1dc548=_0x3bb86f['loggedIn']-_0x3367bf[0x0][_0x49c3('0x1d2')];var _0x269c3a=_0x3bb86f[_0x49c3('0x1bb')]*0x3c;var _0xb76569=_0x57d79e[0x0][_0x49c3('0x66')]+_0x57d79e[0x0][_0x49c3('0x80')];var _0x8c7954=(_0x57d79e[0x0]['predictiveIntervalAnsweredCalls']+_0x57d79e[0x0][_0x49c3('0x67')]+_0x57d79e[0x0][_0x49c3('0x106')])/_0x57d79e[0x0][_0x49c3('0x6d')];var _0x4fbd93=_0x3bb86f[_0x49c3('0x1b3')]/0x64;_0x3bb86f[_0x49c3('0x6b')]=_0x3367bf[0x0][_0x49c3('0x1d2')]||0x0;_0x3bb86f[_0x49c3('0x6a')]=_0x8c7954>0x0?_0x8c7954:0x1;return _0x495177[_0x49c3('0x1ce')](_0x1dc548,_0x269c3a,_0xb76569,_0x8c7954,_0x4fbd93);})[_0x49c3('0xb0')](function(_0xae3c3e){return _0x3f54af(_0xae3c3e);})[_0x49c3('0xa9')](function(_0x3e7200){return _0x581782(msgResponse(_0x49c3('0x1d3'),_0x49c3('0x129'),JSON[_0x49c3('0x45')](_0x3e7200)));});}}else{return _0x581782(msgResponse('[getDataPredictive]','Failure',_0x49c3('0x1d1')));}});};};Dialer[_0x49c3('0x19')][_0x49c3('0x1c5')]=function(_0x2d3865){var _0x59dd20=this;return function(){var _0x152efb=0x0;var _0x393b01=Math[_0x49c3('0x1d4')](_0x2d3865['erlangCallToSecond']*0x3e8);if(_0x393b01>0x0){_0x393b01=_0x393b01<0x64?0x64:_0x393b01;loggerPredictive[_0x49c3('0x78')](_0x2d3865['name'],_0x49c3('0x1d5'),_0x393b01,'milliseconds');_0x2d3865[_0x49c3('0x8a')]=setInterval(function(){_0x59dd20[_0x49c3('0x8a')](_0x2d3865);loggerPredictiveCalls[_0x49c3('0x78')](_0x49c3('0x1d6'),_0x152efb+=0x1);},_0x393b01);}else{loggerPredictive[_0x49c3('0x78')](_0x2d3865[_0x49c3('0x3c')],'fail\x20to\x20scheduled\x20calls');}};};Dialer['prototype'][_0x49c3('0x1d7')]=function(_0x133e24,_0x30d623){var _0x551406=this;return function(_0x38993f){if(_['isEmpty'](_0x38993f)){if(_['isNil'](_0x30d623[_0x49c3('0x1d8')])||!_0x30d623[_0x49c3('0x1d9')]){if(_0x133e24[_0x49c3('0x57')]===_0x49c3('0x7')){_0x133e24[_0x49c3('0x114')]=_['isUndefined'](_0x133e24[_0x49c3('0x114')])?!![]:_0x133e24[_0x49c3('0x114')];var _0x1a5657=uuid['v4']();_0x551406[_0x49c3('0x10e')][_0x1a5657]=new Action(_0x133e24,_0x30d623,_0x1a5657);loggerBooked[_0x49c3('0x78')](_0x49c3('0x1da'),_0x1a5657,'queueStatusComplete:\x20',JSON[_0x49c3('0x45')](_0x133e24[_0x49c3('0x114')]),_0x49c3('0x1db'),_0x133e24['name']);if(_0x133e24[_0x49c3('0x114')]){_0x133e24[_0x49c3('0x114')]=![];_0x551406['queueBooked'][_0x551406['actions'][_0x1a5657][_0x49c3('0xad')]]=[];ami[_0x49c3('0x132')]({'actionid':_0x1a5657,'action':_0x49c3('0x1dc'),'queue':_0x133e24[_0x49c3('0x3c')]})['catch'](function(_0x2b4c8a){_0x551406['updateOriginated'](_0x133e24);_0x551406[_0x49c3('0xb7')]({'active':![],'ContactId':_0x551406['actions'][_0x1a5657][_0x49c3('0xc6')],'ListId':_0x551406['actions'][_0x1a5657]['ListId'],'VoiceQueueId':_0x551406[_0x49c3('0x10e')][_0x1a5657][_0x49c3('0xc8')]||undefined,'CampaignId':_0x551406[_0x49c3('0x10e')][_0x1a5657][_0x49c3('0xc9')]||undefined})[_0x49c3('0xa9')](loggerCatch(_0x49c3('0x1dd')));delete _0x551406[_0x49c3('0x10e')][_0x1a5657];});}else{loggerBooked[_0x49c3('0x78')](_0x49c3('0x1de'),JSON[_0x49c3('0x45')](_0x133e24['queueStatusComplete']),_0x49c3('0x1db'),_0x133e24[_0x49c3('0x3c')]);_0x551406[_0x49c3('0xab')](_0x133e24);_0x551406['rescheduleContact']({'active':![],'ContactId':_0x551406[_0x49c3('0x10e')][_0x1a5657][_0x49c3('0xc6')],'ListId':_0x551406[_0x49c3('0x10e')][_0x1a5657][_0x49c3('0xc7')],'VoiceQueueId':_0x551406[_0x49c3('0x10e')][_0x1a5657][_0x49c3('0xc8')]||undefined,'CampaignId':_0x551406[_0x49c3('0x10e')][_0x1a5657]['CampaignId']||undefined})[_0x49c3('0xa9')](loggerCatch(_0x49c3('0x1dd')));delete _0x551406[_0x49c3('0x10e')][_0x1a5657];}}else{return _0x551406[_0x49c3('0x14e')](_0x133e24,_0x30d623);}}else{if(getDiff(_0x30d623[_0x49c3('0x1df')])<_0x133e24[_0x49c3('0x1e0')]*0x3c){if(_0x30d623[_0x49c3('0x1e1')]&&!_0x30d623[_0x49c3('0x1e1')][_0x49c3('0x1e2')]){_0x551406[_0x49c3('0x1e')][_0x49c3('0x115')](_0x30d623['id'])[_0x49c3('0x1c')](function(){_0x551406[_0x49c3('0xab')](_0x133e24);});}else{_0x551406['unlockContact']({'active':![]},_0x30d623['id'],0x1)[_0x49c3('0x1c')](function(){console['log'](_0x49c3('0x1e3'));_0x551406['updateOriginated'](_0x133e24);});}}else{_0x133e24[_0x49c3('0x64')]+=0x1;_0x551406[_0x49c3('0xab')](_0x133e24);if(_0x133e24['dialRecallInQueue']){_0x551406['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x30d623[_0x49c3('0xc6')],'ListId':_0x30d623['ListId'],'VoiceQueueId':_0x30d623[_0x49c3('0xc8')]||undefined,'CampaignId':_0x30d623['CampaignId']||undefined})[_0x49c3('0xa9')](loggerCatch(_0x49c3('0x1e4')));_0x551406[_0x49c3('0xbf')](createObjHistory(_0x133e24,_0x30d623,_0x49c3('0x1e5'),0x17,'RecallInQueue'))['catch'](loggerCatch(_0x49c3('0x1e6')));}else{_0x551406[_0x49c3('0xc4')](createObjHistory(_0x133e24,_0x30d623,'RECALLFAILEDTIMEOUT',0x16,_0x49c3('0x1e7')),_0x49c3('0x1e8'),'[Originate][HistoryRecallClose]');}}}}else{_0x133e24[_0x49c3('0x1e9')]+=0x1;_0x551406['saveInDb'](createObjHistory(_0x133e24,_0x30d623,_0x49c3('0x1ea'),0xd,'Blacklist'),_0x49c3('0x1eb'),'[Originate][MoveBlacklist]');throw'inBlackList';}};};Dialer[_0x49c3('0x19')][_0x49c3('0x145')]=function(_0x581637){var _0x235f8b=this;var _0x58fbd4=[];var _0x40bdc5=_0x581637[_0x49c3('0x1ec')]-_0x581637[_0x49c3('0x6e')]-_0x581637['temp'];emitCampaignSummary(_0x581637);if(_0x40bdc5>0x0){if(_0x40bdc5>this[_0x49c3('0x23')]){_0x40bdc5=this['maxNumberOriginate'];}_0x581637[_0x49c3('0x1ed')]+=_0x40bdc5;this[_0x49c3('0xba')](_0x581637['id'],_0x40bdc5,_0x581637['dialOrderByScheduledAt'])[_0x49c3('0xb0')](function(_0x397b4e){_0x581637[_0x49c3('0x1ed')]-=_0x40bdc5;_0x581637['temp']=_0x581637['temp']>0x0?_0x581637[_0x49c3('0x1ed')]:0x0;if(!checkContactEmpty(_0x397b4e)){_0x581637[_0x49c3('0x3f')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x49c3('0x78')]('[getContactCampaign2][Empty]'+_0x581637[_0x49c3('0x3c')]);}else{_0x581637[_0x49c3('0x6e')]+=_0x397b4e[_0x49c3('0x91')];_0x581637[_0x49c3('0x3f')]=_0x49c3('0x1ee');for(var _0x1bc2ce=0x0;_0x1bc2ce<_0x397b4e[_0x49c3('0x91')];_0x1bc2ce+=0x1){_0x581637['ivrTotalCallsDays']+=0x1;if(_['isNil'](_0x397b4e[_0x1bc2ce])||_[_0x49c3('0xa7')](_0x397b4e[_0x1bc2ce][_0x49c3('0x152')])||_[_0x49c3('0xa7')](_0x397b4e[_0x1bc2ce][_0x49c3('0x152')][_0x49c3('0x153')])){_0x235f8b[_0x49c3('0xc2')](_0x49c3('0x1ef'),_0x581637,_0x397b4e[_0x1bc2ce]);}else{_0x235f8b[_0x49c3('0xb3')](_['pick'](_0x397b4e[_0x1bc2ce],['CampaignId',_0x49c3('0x1f0')]))['then'](_0x235f8b[_0x49c3('0x1d7')](_0x581637,_0x397b4e[_0x1bc2ce]))[_0x49c3('0xa9')](_0x235f8b[_0x49c3('0xc1')](_0x49c3('0x1f1'),_0x581637));}}}})[_0x49c3('0xa9')](loggerGetContactDialer(_0x49c3('0x1f2'),_0x581637,_0x40bdc5));}};Dialer[_0x49c3('0x19')][_0x49c3('0x140')]=function(_0x176ab3,_0x381939){var _0x120423=this;var _0x3fdff7=[];var _0x47c043=_0x381939>=0x1?_0x381939:0x1;var _0x376216=[];if(_0x176ab3[_0x49c3('0x57')]===_0x49c3('0x7')){_0x47c043=0x1;}var _0x599cac=Math['floor'](_0x176ab3[_0x49c3('0x1b6')]*_0x47c043)-_0x176ab3[_0x49c3('0x6e')]-_0x176ab3[_0x49c3('0x1ed')];emitVoiceQueueSummary(_0x176ab3);if(_0x176ab3[_0x49c3('0x1f3')]>0x0){var _0x3bc586=_0x176ab3['dialLimitQueue']-_0x176ab3[_0x49c3('0x6e')]-_0x176ab3['talking']-_0x176ab3[_0x49c3('0x1ed')]-_0x176ab3['pTalking'];if(_0x599cac>_0x3bc586){_0x599cac=_0x3bc586;}}if(_0x599cac>0x0){if(_0x176ab3[_0x49c3('0x57')]===_0x49c3('0x7')){_0x599cac=0x1;}if(_0x599cac>this[_0x49c3('0x23')]){_0x599cac=this[_0x49c3('0x23')];}_0x176ab3[_0x49c3('0x1ed')]+=_0x599cac;for(var _0x70c7ad in this['agents']){if(this[_0x49c3('0x21')]['hasOwnProperty'](_0x70c7ad)){if(this[_0x49c3('0x21')][_0x70c7ad][_0x49c3('0xa0')]===_0x49c3('0x1f4')&&this[_0x49c3('0x21')][_0x70c7ad]['status']===_0x49c3('0xd1')){_0x3fdff7[_0x49c3('0x131')](this[_0x49c3('0x21')][_0x70c7ad]['id']);}}}this['getContactDialer'](_0x176ab3['id'],_0x3fdff7,_0x599cac,_0x176ab3['dialOrderByScheduledAt'])['then'](function(_0x4422c2){_0x176ab3[_0x49c3('0x1ed')]-=_0x599cac;_0x176ab3[_0x49c3('0x1ed')]=_0x176ab3['temp']>0x0?_0x176ab3[_0x49c3('0x1ed')]:0x0;if(!checkContactEmpty(_0x4422c2)){_0x120423[_0x49c3('0xae')](_0x176ab3)[_0x49c3('0xb0')](sendMessageReschedule(_0x176ab3))[_0x49c3('0xa9')](loggerCatch(_0x49c3('0xb1')));}else{_0x176ab3[_0x49c3('0x6e')]+=_0x4422c2[_0x49c3('0x91')];_0x176ab3[_0x49c3('0x3f')]=_0x176ab3['dialMethod']===_0x49c3('0x7')?'ACTIVE':_0x49c3('0x1ee');for(var _0x3ad3ca=0x0;_0x3ad3ca<_0x4422c2[_0x49c3('0x91')];_0x3ad3ca+=0x1){if(_[_0x49c3('0xa7')](_0x4422c2[_0x3ad3ca])||_['isNil'](_0x4422c2[_0x3ad3ca][_0x49c3('0x152')])||_[_0x49c3('0xa7')](_0x4422c2[_0x3ad3ca]['Contact'][_0x49c3('0x153')])){_0x120423[_0x49c3('0xc2')](_0x49c3('0x1ef'),_0x176ab3,_0x4422c2[_0x3ad3ca]);}else{_0x120423[_0x49c3('0x1f5')](_[_0x49c3('0xc5')](_0x4422c2[_0x3ad3ca],[_0x49c3('0xc8'),_0x49c3('0x1f0')]))['then'](_0x120423[_0x49c3('0x1d7')](_0x176ab3,_0x4422c2[_0x3ad3ca]))['catch'](_0x120423[_0x49c3('0xc1')](_0x49c3('0x1ef'),_0x176ab3));}}}})[_0x49c3('0xa9')](loggerGetContactDialer(_0x49c3('0x1f6'),_0x176ab3,_0x599cac));}};Dialer['prototype']['handlePredictive']=function(_0x465920){var _0x8153d2=this;if(_0x465920[_0x49c3('0x1f3')]>0x0){var _0x495786=_0x465920[_0x49c3('0x1f3')]-_0x465920[_0x49c3('0x6e')]-_0x465920[_0x49c3('0x52')];if(_0x495786>0x0){this[_0x49c3('0x1f7')](_0x465920);}else{loggerPredictiveCalls[_0x49c3('0x78')](_0x49c3('0x1f8'));}}else{this[_0x49c3('0x1f7')](_0x465920);}};Dialer[_0x49c3('0x19')]['tryOriginatePredictive']=function(_0x1947ad){var _0x61876c=this;var _0x41b3fc=[];_0x1947ad[_0x49c3('0x6e')]+=0x1;for(var _0x57f1f1 in this['agents']){if(this['agents'][_0x49c3('0x92')](_0x57f1f1)){if(this['agents'][_0x57f1f1][_0x49c3('0xa0')]===_0x49c3('0x1f4')&&this[_0x49c3('0x21')][_0x57f1f1][_0x49c3('0xd0')]==='reachable'){_0x41b3fc[_0x49c3('0x131')](this['agents'][_0x57f1f1]['id']);}}}this['getContactDialer'](_0x1947ad['id'],_0x41b3fc,0x1,_0x1947ad['dialOrderByScheduledAt'])['then'](function(_0x378120){if(!checkContactEmpty(_0x378120)){checkContactLowerLimitOriginate(_0x1947ad,0x1,0x0);_0x61876c[_0x49c3('0xae')](_0x1947ad)['then'](sendMessageReschedule(_0x1947ad))[_0x49c3('0xa9')](loggerCatch(_0x49c3('0xb1')));}else{_0x1947ad[_0x49c3('0x3f')]=_0x49c3('0x1ee');if(_[_0x49c3('0xa7')](_0x378120[0x0])||_['isNil'](_0x378120[0x0]['Contact'])||_[_0x49c3('0xa7')](_0x378120[0x0][_0x49c3('0x152')][_0x49c3('0x153')])){_0x61876c[_0x49c3('0xc2')]('[actionOriginate]\x20',_0x1947ad,_0x378120[0x0]);}else{_0x61876c['checkIsBlackList'](_[_0x49c3('0xc5')](_0x378120[0x0],['VoiceQueueId',_0x49c3('0x1f0')]))[_0x49c3('0xb0')](_0x61876c['checkContactBlack'](_0x1947ad,_0x378120[0x0]))['catch'](_0x61876c['loggerHandler'](_0x49c3('0x1f9'),_0x1947ad));}}})[_0x49c3('0xa9')](loggerGetContactDialer('[getContactDialerPredictive]',_0x1947ad,0x1));emitVoiceQueueSummary(_0x1947ad);};Dialer[_0x49c3('0x19')]['abandonmentRate']=function(_0x48c591,_0x433c4c,_0x2ee436,_0x3900f0,_0x2ef359,_0x4dc679){loggerPredictive['info'](_0x49c3('0x1fa'));loggerPredictive[_0x49c3('0x78')]('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',_0x48c591);loggerPredictive['info'](_0x49c3('0x1fb'),_0x433c4c);loggerPredictive['info'](_0x49c3('0x1fc'),_0x2ee436);loggerPredictive[_0x49c3('0x78')]('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',_0x3900f0);loggerPredictive[_0x49c3('0x78')](_0x49c3('0x1fd'),_0x2ef359);loggerPredictive[_0x49c3('0x78')](_0x49c3('0x1fe'));return new BPromise(function(_0x36477e,_0x4d6b68){if(_0x48c591<=0x0||isNaN(_0x48c591)){return _0x4d6b68(msgResponse(_0x49c3('0x1ff'),_0x49c3('0x44'),_0x49c3('0x200')+_0x48c591));}if(_0x2ee436<=0x0||isNaN(_0x2ee436)){return _0x4d6b68(msgResponse(_0x49c3('0x1ff'),_0x49c3('0x44'),'Ts\x20=\x20'+_0x2ee436));}if(_0x3900f0<=0x0||isNaN(_0x3900f0)){return _0x4d6b68(msgResponse(_0x49c3('0x1ff'),'Error',_0x49c3('0x201')+_0x3900f0));}if(_0x433c4c<=0x0||isNaN(_0x433c4c)){return _0x4d6b68(msgResponse(_0x49c3('0x1ff'),_0x49c3('0x44'),_0x49c3('0x202')+_0x433c4c));}if(_0x2ef359<=0x0||isNaN(_0x2ef359)){return _0x4d6b68(msgResponse(_0x49c3('0x1ff'),_0x49c3('0x44'),_0x49c3('0x203')+_0x2ef359));}_0x4dc679=_0x4dc679||0x0;var _0x12a374=0x1/_0x2ee436;var _0xdbea88=0x0;var _0x1aa40c=0x0;var _0x4f537e=0x0;var _0x450bfb=0x0;for(var _0x5a477f=0x0;_0x4f537e<_0x2ef359;_0x5a477f+=0x1){_0x1aa40c=_0x5a477f/_0x433c4c;_0xdbea88=(_0x3900f0*_0x1aa40c+_0x4dc679)/_0x12a374;_0x4f537e=erlangb(_0xdbea88,_0x48c591);_0x450bfb=_0xdbea88/_0x48c591*(0x1-erlangb(_0xdbea88,_0x48c591));}return _0x36477e({'erlangCalls':_0x5a477f,'erlangCallToSecond':_0x433c4c/_0x5a477f,'erlangAbandonmentRate':_0x4f537e,'erlangBusyFactor':_0x450bfb});});};Dialer['prototype'][_0x49c3('0x1ce')]=function(_0x5b85eb,_0x307741,_0x39c5c7,_0x6f9a4,_0x2b4f03,_0xb8cdbc){loggerPredictive[_0x49c3('0x78')](_0x49c3('0x204'));loggerPredictive[_0x49c3('0x78')](_0x49c3('0x205'),_0x5b85eb);loggerPredictive[_0x49c3('0x78')](_0x49c3('0x1fb'),_0x307741);loggerPredictive[_0x49c3('0x78')](_0x49c3('0x1fc'),_0x39c5c7);loggerPredictive[_0x49c3('0x78')](_0x49c3('0x206'),_0x6f9a4);loggerPredictive[_0x49c3('0x78')](_0x49c3('0x207'),_0x2b4f03);loggerPredictive[_0x49c3('0x78')](_0x49c3('0x1fe'));return new BPromise(function(_0x4f6669,_0xb80cda){if(_0x5b85eb<=0x0||isNaN(_0x5b85eb)){return _0xb80cda(msgResponse(_0x49c3('0x208'),_0x49c3('0x44'),'m\x20=\x20'+_0x5b85eb));}if(_0x39c5c7<=0x0||isNaN(_0x39c5c7)){return _0xb80cda(msgResponse('[busyFactor]','Error',_0x49c3('0x209')+_0x39c5c7));}if(_0x6f9a4<=0x0||isNaN(_0x6f9a4)){return _0xb80cda(msgResponse(_0x49c3('0x208'),_0x49c3('0x44'),_0x49c3('0x201')+_0x6f9a4));}if(_0x307741<=0x0||isNaN(_0x307741)){return _0xb80cda(msgResponse(_0x49c3('0x208'),_0x49c3('0x44'),_0x49c3('0x202')+_0x307741));}if(_0x2b4f03<=0x0||isNaN(_0x2b4f03)){return _0xb80cda(msgResponse(_0x49c3('0x208'),'Error',_0x49c3('0x20a')+_0x2b4f03));}_0xb8cdbc=_0xb8cdbc||0x0;var _0x69b08c=0x1/_0x39c5c7;var _0x6cc54f=0x0;var _0x409553=0x0;var _0x4599d1=0x0;var _0x3e2a24=0x0;for(var _0x5f1d91=0x0;_0x3e2a24<_0x2b4f03;_0x5f1d91+=0x1){_0x409553=_0x5f1d91/_0x307741;_0x6cc54f=(_0x6f9a4*_0x409553+_0xb8cdbc)/_0x69b08c;_0x4599d1=erlangb(_0x6cc54f,_0x5b85eb);_0x3e2a24=_0x6cc54f/_0x5b85eb*(0x1-erlangb(_0x6cc54f,_0x5b85eb));}return _0x4f6669({'erlangCalls':_0x5f1d91,'erlangCallToSecond':_0x307741/_0x5f1d91,'erlangAbandonmentRate':_0x4599d1,'erlangBusyFactor':_0x3e2a24});});};module[_0x49c3('0x20b')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index eb9d059..f99eb21 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 _0xd150=['holdtime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','starttime','responsetime','droptime','ringtime'];(function(_0x400c0e,_0x2bc6e9){var _0x543713=function(_0x1cc766){while(--_0x1cc766){_0x400c0e['push'](_0x400c0e['shift']());}};_0x543713(++_0x2bc6e9);}(_0xd150,0x1ef));var _0x0d15=function(_0x3c72ec,_0x37b9a1){_0x3c72ec=_0x3c72ec-0x0;var _0x2396a6=_0xd150[_0x3c72ec];return _0x2396a6;};'use strict';var util=require(_0x0d15('0x0'));var _=require(_0x0d15('0x1'));var moment=require(_0x0d15('0x2'));function getSeconds(_0x130b05,_0x515769){var _0x3ef3bd=moment(_0x130b05)[_0x0d15('0x3')](0x0);var _0x2e0c6c=moment(_0x515769)[_0x0d15('0x3')](0x0);return _0x3ef3bd[_0x0d15('0x4')](_0x2e0c6c,_0x0d15('0x5'));}function QueueCallerAbandon(_0x3abd00,_0x50ec5c){this['scheduledat']=_0x3abd00[_0x0d15('0x6')];this[_0x0d15('0x7')]=_0x3abd00[_0x0d15('0x7')];this[_0x0d15('0x8')]=_0x3abd00[_0x0d15('0x7')]==='outbound'?_0x0d15('0x9'):_0x3abd00[_0x0d15('0x7')];this[_0x0d15('0xa')]=_0x3abd00[_0x0d15('0xa')];this[_0x0d15('0xb')]=_0x3abd00[_0x0d15('0xb')];this[_0x0d15('0xc')]=_0x3abd00[_0x0d15('0xc')];this['countglobal']=_0x3abd00[_0x0d15('0xa')]+_0x3abd00['countcongestionretry']+_0x3abd00[_0x0d15('0xc')]+_0x3abd00[_0x0d15('0xd')]+_0x3abd00[_0x0d15('0xe')]+_0x3abd00[_0x0d15('0xf')]+_0x3abd00[_0x0d15('0x10')]+_0x3abd00[_0x0d15('0x11')];this[_0x0d15('0xd')]=_0x3abd00['countnosuchnumberretry'];this[_0x0d15('0xe')]=_0x3abd00['countdropretry'];this[_0x0d15('0xf')]=_0x3abd00[_0x0d15('0xf')];this[_0x0d15('0x10')]=_0x3abd00[_0x0d15('0x10')];this['countagentrejectretry']=_0x3abd00['countagentrejectretry'];this[_0x0d15('0x12')]=_0x50ec5c[_0x0d15('0x12')];this['calleridname']=_0x3abd00['name'];this['calleridnum']=_0x3abd00['number'];this[_0x0d15('0x13')]=_0x3abd00[_0x0d15('0x13')];this[_0x0d15('0x14')]=_0x3abd00[_0x0d15('0x14')];this[_0x0d15('0x15')]=_0x3abd00[_0x0d15('0x15')];this['endtime']=this['droptime'];this[_0x0d15('0x16')]=getSeconds(_0x3abd00['responsetime'],_0x3abd00['starttime']);this[_0x0d15('0x17')]=getSeconds(this[_0x0d15('0x15')],_0x3abd00[_0x0d15('0x14')]);this['talktime']=0x0;this[_0x0d15('0x9')]=_0x50ec5c[_0x0d15('0x9')];this['membername']=_0x50ec5c[_0x0d15('0x18')];this[_0x0d15('0x19')]=_0x50ec5c['reason'];this[_0x0d15('0x1a')]=_0x3abd00[_0x0d15('0x1a')];this['callbackuniqueid']=_0x3abd00[_0x0d15('0x1b')];this['callbackat']=_0x3abd00[_0x0d15('0x1c')];this[_0x0d15('0x1d')]=_0x3abd00[_0x0d15('0x1d')];this[_0x0d15('0x1e')]=_0x3abd00[_0x0d15('0x1e')];this['ListId']=_0x3abd00[_0x0d15('0x1f')];this[_0x0d15('0x20')]=_0x3abd00[_0x0d15('0x20')];this[_0x0d15('0x21')]=_0x3abd00[_0x0d15('0x21')];this['CampaignId']=_0x3abd00['CampaignId'];this['originatecalleridnum']=_0x3abd00[_0x0d15('0x22')]||'';this[_0x0d15('0x23')]=_0x3abd00['originatecalleridname']||'';}module[_0x0d15('0x24')]=QueueCallerAbandon; \ No newline at end of file +var _0x0725=['membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','scheduledat','type','campaigntype','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','responsetime','droptime','endtime','starttime','holdtime','queue'];(function(_0x2aadcb,_0x18c38f){var _0x23d389=function(_0xfef752){while(--_0xfef752){_0x2aadcb['push'](_0x2aadcb['shift']());}};_0x23d389(++_0x18c38f);}(_0x0725,0x188));var _0x5072=function(_0xd05cb2,_0x1aad32){_0xd05cb2=_0xd05cb2-0x0;var _0x88aadc=_0x0725[_0xd05cb2];return _0x88aadc;};'use strict';var util=require(_0x5072('0x0'));var _=require(_0x5072('0x1'));var moment=require(_0x5072('0x2'));function getSeconds(_0x3ab746,_0x321918){var _0x5c1413=moment(_0x3ab746)['milliseconds'](0x0);var _0xd54858=moment(_0x321918)[_0x5072('0x3')](0x0);return _0x5c1413[_0x5072('0x4')](_0xd54858,'seconds');}function QueueCallerAbandon(_0x2b8eb,_0x232862){this[_0x5072('0x5')]=_0x2b8eb['scheduledat'];this[_0x5072('0x6')]=_0x2b8eb['type'];this[_0x5072('0x7')]=_0x2b8eb[_0x5072('0x6')]==='outbound'?'queue':_0x2b8eb[_0x5072('0x6')];this['countbusyretry']=_0x2b8eb[_0x5072('0x8')];this['countcongestionretry']=_0x2b8eb['countcongestionretry'];this[_0x5072('0x9')]=_0x2b8eb[_0x5072('0x9')];this[_0x5072('0xa')]=_0x2b8eb[_0x5072('0x8')]+_0x2b8eb[_0x5072('0xb')]+_0x2b8eb['countnoanswerretry']+_0x2b8eb[_0x5072('0xc')]+_0x2b8eb[_0x5072('0xd')]+_0x2b8eb[_0x5072('0xe')]+_0x2b8eb['countmachineretry']+_0x2b8eb[_0x5072('0xf')];this[_0x5072('0xc')]=_0x2b8eb[_0x5072('0xc')];this[_0x5072('0xd')]=_0x2b8eb['countdropretry'];this[_0x5072('0xe')]=_0x2b8eb[_0x5072('0xe')];this[_0x5072('0x10')]=_0x2b8eb['countmachineretry'];this[_0x5072('0xf')]=_0x2b8eb[_0x5072('0xf')];this[_0x5072('0x11')]=_0x232862[_0x5072('0x11')];this[_0x5072('0x12')]=_0x2b8eb[_0x5072('0x13')];this[_0x5072('0x14')]=_0x2b8eb[_0x5072('0x15')];this['starttime']=_0x2b8eb['starttime'];this[_0x5072('0x16')]=_0x2b8eb['responsetime'];this['droptime']=_0x2b8eb[_0x5072('0x17')];this[_0x5072('0x18')]=this[_0x5072('0x17')];this['ringtime']=getSeconds(_0x2b8eb['responsetime'],_0x2b8eb[_0x5072('0x19')]);this[_0x5072('0x1a')]=getSeconds(this[_0x5072('0x17')],_0x2b8eb[_0x5072('0x16')]);this['talktime']=0x0;this['queue']=_0x232862[_0x5072('0x1b')];this[_0x5072('0x1c')]=_0x232862[_0x5072('0x1d')];this[_0x5072('0x1e')]=_0x232862[_0x5072('0x1e')];this['callback']=_0x2b8eb[_0x5072('0x1f')];this[_0x5072('0x20')]=_0x2b8eb[_0x5072('0x20')];this[_0x5072('0x21')]=_0x2b8eb[_0x5072('0x21')];this[_0x5072('0x22')]=_0x2b8eb[_0x5072('0x22')];this[_0x5072('0x23')]=_0x2b8eb['ContactId'];this[_0x5072('0x24')]=_0x2b8eb[_0x5072('0x24')];this['UserId']=_0x2b8eb['UserId'];this[_0x5072('0x25')]=_0x2b8eb[_0x5072('0x25')];this[_0x5072('0x26')]=_0x2b8eb[_0x5072('0x26')];this[_0x5072('0x27')]=_0x2b8eb[_0x5072('0x27')]||'';this[_0x5072('0x28')]=_0x2b8eb[_0x5072('0x28')]||'';}module[_0x5072('0x29')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 793a9ec..71d8b2e 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 _0x60e2=['path','AttachmentId','exports','lodash','channel','format','%s/%s/%s','tech','Trunk','name','localstationid'];(function(_0x54143f,_0x1800f2){var _0x1a3282=function(_0x48931e){while(--_0x48931e){_0x54143f['push'](_0x54143f['shift']());}};_0x1a3282(++_0x1800f2);}(_0x60e2,0x158));var _0x260e=function(_0x331431,_0xf02106){_0x331431=_0x331431-0x0;var _0x22d6e2=_0x60e2[_0x331431];return _0x22d6e2;};'use strict';var util=require('util');var _=require(_0x260e('0x0'));var moment=require('moment');function Action(_0x2eaf1d,_0x134c18,_0x4d4ab1){this['uniqueid']=_0x2eaf1d||undefined;this[_0x260e('0x1')]=util[_0x260e('0x2')](_0x260e('0x3'),_0x134c18[_0x260e('0x4')],_0x134c18[_0x260e('0x5')][_0x260e('0x6')],_0x4d4ab1['fax']);this[_0x260e('0x7')]=_0x134c18['localstationid'];this['headerinfo']=_0x134c18['headerinfo'];this[_0x260e('0x8')]=_0x4d4ab1['path'];this[_0x260e('0x9')]=_0x4d4ab1['AttachmentId'];}module[_0x260e('0xa')]=Action; \ No newline at end of file +var _0xa659=['moment','uniqueid','channel','format','tech','Trunk','name','fax','localstationid','path','AttachmentId','lodash'];(function(_0x5ca353,_0x21eb37){var _0x4f2fe5=function(_0x14cd1b){while(--_0x14cd1b){_0x5ca353['push'](_0x5ca353['shift']());}};_0x4f2fe5(++_0x21eb37);}(_0xa659,0x14f));var _0x9a65=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa659[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require(_0x9a65('0x0'));var moment=require(_0x9a65('0x1'));function Action(_0x279e9b,_0x1b57fd,_0x3607a1){this[_0x9a65('0x2')]=_0x279e9b||undefined;this[_0x9a65('0x3')]=util[_0x9a65('0x4')]('%s/%s/%s',_0x1b57fd[_0x9a65('0x5')],_0x1b57fd[_0x9a65('0x6')][_0x9a65('0x7')],_0x3607a1[_0x9a65('0x8')]);this[_0x9a65('0x9')]=_0x1b57fd[_0x9a65('0x9')];this['headerinfo']=_0x1b57fd['headerinfo'];this[_0x9a65('0xa')]=_0x3607a1[_0x9a65('0xa')];this['AttachmentId']=_0x3607a1[_0x9a65('0xb')];}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 a6d5051..1d55e03 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 _0x6e59=['format','execute','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','ext','isTrunkReachable','isNil','active','SIP/%s','status','reachable','unmonitored','checkTrunk','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','Empty\x20Fax','Empty\x20path','Is\x20Valid','exports','util','bluebird','uuid','moment','path','tiff2pdf','fax','../ami','./rpcDb','./channel','../rpc/faxAccount','../rpc/attachment','faxAccounts','trunks','actions','syncNewchannel','bind','varset','syncVarSet','syncNewExten','syncFaxStatus','receivefax','hangup','syncHangup','originateresponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','parse','.pdf','application/pdf','then','notify','error','\x20notify\x20','stringify','catch','\x20receiveFax\x20','syncOriginateResponse','merge','pick','response','AttachmentId','update','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','execOriginate','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','checkAfterSend','FaxAccountId','Trunk','Trunk\x20Reachable'];(function(_0x2ec207,_0x412398){var _0x4a9b2a=function(_0x4528ea){while(--_0x4528ea){_0x2ec207['push'](_0x2ec207['shift']());}};_0x4a9b2a(++_0x412398);}(_0x6e59,0x15d));var _0x96e5=function(_0x420d70,_0x3a9318){_0x420d70=_0x420d70-0x0;var _0x2d4dfb=_0x6e59[_0x420d70];return _0x2d4dfb;};'use strict';var util=require(_0x96e5('0x0'));var _=require('lodash');var BPromise=require(_0x96e5('0x1'));var uuid=require(_0x96e5('0x2'));var moment=require(_0x96e5('0x3'));var path=require(_0x96e5('0x4'));var tiff2pdf=require(_0x96e5('0x5'));var gs=require('./util/gs');var logger=require('../../../config/logger')(_0x96e5('0x6'));var ami=require(_0x96e5('0x7'));var rpcDb=require(_0x96e5('0x8'));var Channel=require(_0x96e5('0x9'));var ut=require('./util/util');var Action=require('./action');var faxAccount=require(_0x96e5('0xa'));var attachment=require(_0x96e5('0xb'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x42b4c5){this['channels']={};this['faxAccounts']=_0x42b4c5[_0x96e5('0xc')];this[_0x96e5('0xd')]=_0x42b4c5[_0x96e5('0xd')];this[_0x96e5('0xe')]={};ami['on']('newchannel',this[_0x96e5('0xf')][_0x96e5('0x10')](this));ami['on'](_0x96e5('0x11'),this[_0x96e5('0x12')]['bind'](this));ami['on']('newstate',this['syncNewState'][_0x96e5('0x10')](this));ami['on']('newexten',this[_0x96e5('0x13')]['bind'](this));ami['on']('faxstatus',this[_0x96e5('0x14')][_0x96e5('0x10')](this));ami['on'](_0x96e5('0x15'),this['syncReceiveFax'][_0x96e5('0x10')](this));ami['on'](_0x96e5('0x16'),this[_0x96e5('0x17')][_0x96e5('0x10')](this));ami['on'](_0x96e5('0x18'),this['syncOriginateResponse'][_0x96e5('0x10')](this));}Fax[_0x96e5('0x19')][_0x96e5('0xf')]=function(_0x2df775){if(_0x2df775[_0x96e5('0x1a')]===_0x96e5('0x1b')){for(var _0x44d26a in this[_0x96e5('0xc')]){if(this['faxAccounts'][_0x96e5('0x1c')](_0x44d26a)){if(_0x2df775[_0x96e5('0x1d')]===this[_0x96e5('0xc')][_0x44d26a][_0x96e5('0x1e')]){this[_0x96e5('0x1f')][_0x2df775[_0x96e5('0x20')]]={};this[_0x96e5('0x1f')][_0x2df775['uniqueid']][_0x96e5('0x21')]=_0x2df775['channel'];this[_0x96e5('0x1f')][_0x2df775[_0x96e5('0x20')]]['id']=this[_0x96e5('0xc')][_0x44d26a]['id'];this[_0x96e5('0x1f')][_0x2df775[_0x96e5('0x20')]][_0x96e5('0x22')]=this['faxAccounts'][_0x44d26a][_0x96e5('0x22')];logger[_0x96e5('0x23')](_0x2df775[_0x96e5('0x20')],_0x96e5('0x24'));}}}}if(this['actions'][_0x2df775['uniqueid']]){this[_0x96e5('0x1f')][_0x2df775[_0x96e5('0x20')]]={};this[_0x96e5('0x1f')][_0x2df775[_0x96e5('0x20')]]['channel']=_0x2df775[_0x96e5('0x21')];logger[_0x96e5('0x23')](_0x2df775[_0x96e5('0x20')],_0x96e5('0x24'));}};Fax['prototype'][_0x96e5('0x12')]=function(_0x484748){if(this[_0x96e5('0x1f')][_0x484748[_0x96e5('0x20')]]){for(var _0x220e6d in _0x484748['variable']){if(_0x484748[_0x96e5('0x25')][_0x96e5('0x1c')](_0x220e6d)){this[_0x96e5('0x1f')][_0x484748[_0x96e5('0x20')]][_0x220e6d]=_0x484748[_0x96e5('0x26')];}}}};Fax[_0x96e5('0x19')]['syncNewState']=function(_0x441d9c){if(this[_0x96e5('0x1f')][_0x441d9c[_0x96e5('0x20')]]){this['channels'][_0x441d9c[_0x96e5('0x20')]][_0x96e5('0x27')]=_0x441d9c[_0x96e5('0x27')];this[_0x96e5('0x1f')][_0x441d9c['uniqueid']][_0x96e5('0x28')]=_0x441d9c['channelstatedesc'];}};Fax[_0x96e5('0x19')][_0x96e5('0x13')]=function(_0x7f0765){if(this[_0x96e5('0x1f')][_0x7f0765[_0x96e5('0x20')]]){for(var _0x35b9da in _0x7f0765[_0x96e5('0x25')]){if(_0x7f0765[_0x96e5('0x25')][_0x96e5('0x1c')](_0x35b9da)){this['channels'][_0x7f0765[_0x96e5('0x20')]][_0x35b9da]=_0x7f0765[_0x96e5('0x26')];}}}};Fax[_0x96e5('0x19')][_0x96e5('0x14')]=function(_0x20323c){if(this[_0x96e5('0x1f')][_0x20323c['uniqueid']]){this[_0x96e5('0x1f')][_0x20323c[_0x96e5('0x20')]][_0x96e5('0x29')]=_0x20323c[_0x96e5('0x29')];this[_0x96e5('0x1f')][_0x20323c[_0x96e5('0x20')]]['status']=_0x20323c['status'];this['channels'][_0x20323c[_0x96e5('0x20')]][_0x96e5('0x1e')]=_0x20323c[_0x96e5('0x1e')];this[_0x96e5('0x1f')][_0x20323c[_0x96e5('0x20')]][_0x96e5('0x2a')]=_0x20323c[_0x96e5('0x2a')];logger[_0x96e5('0x23')](_0x20323c['uniqueid'],_0x96e5('0x2b'));}};Fax[_0x96e5('0x19')]['syncReceiveFax']=function(_0x47d207){var _0x4f6c78=this;if(this[_0x96e5('0x1f')][_0x47d207[_0x96e5('0x20')]]){var _0x434dc0=this[_0x96e5('0x1f')][_0x47d207[_0x96e5('0x20')]]['id'];this[_0x96e5('0x1f')][_0x47d207['uniqueid']]['remotestationid']=_0x47d207[_0x96e5('0x2c')];this[_0x96e5('0x1f')][_0x47d207[_0x96e5('0x20')]][_0x96e5('0x2d')]=_0x47d207[_0x96e5('0x2d')];this[_0x96e5('0x1f')][_0x47d207[_0x96e5('0x20')]][_0x96e5('0x1e')]=_0x47d207[_0x96e5('0x1e')];this['channels'][_0x47d207['uniqueid']][_0x96e5('0x2e')]=_0x47d207['resolution'];this[_0x96e5('0x1f')][_0x47d207['uniqueid']][_0x96e5('0x2f')]=_0x47d207['transferrate'];this[_0x96e5('0x1f')][_0x47d207[_0x96e5('0x20')]][_0x96e5('0x2a')]=_0x47d207['filename'];this[_0x96e5('0x1f')][_0x47d207['uniqueid']][_0x96e5('0x30')]=_0x47d207[_0x96e5('0x30')];if(this[_0x96e5('0x1f')][_0x47d207[_0x96e5('0x20')]][_0x96e5('0x2d')]>0x0){tiff2pdf(_0x47d207[_0x96e5('0x2a')],'/var/opt/motion2/server/files/attachments/',function(_0x5efed6){logger[_0x96e5('0x23')](_0x47d207[_0x96e5('0x20')],_0x96e5('0x31'),_0x5efed6[_0x96e5('0x32')]);attachment['create']({'name':path[_0x96e5('0x33')](_0x47d207['filename'])[_0x96e5('0x22')],'basename':path[_0x96e5('0x33')](_0x47d207[_0x96e5('0x2a')])[_0x96e5('0x22')]+_0x96e5('0x34'),'type':_0x96e5('0x35')})[_0x96e5('0x36')](function(_0x1cfbee){faxAccount[_0x96e5('0x37')](_0x434dc0,{'from':_0x47d207['calleridnum'],'mapKey':_0x96e5('0x6'),'body':path[_0x96e5('0x33')](_0x47d207['filename'])[_0x96e5('0x22')]+_0x96e5('0x34'),'AttachmentId':_0x1cfbee['id']})['catch'](function(_0x5d7fa0){logger[_0x96e5('0x38')](_0x47d207[_0x96e5('0x20')],_0x96e5('0x39'),JSON[_0x96e5('0x3a')](_0x5d7fa0));});})[_0x96e5('0x3b')](function(_0x244953){logger[_0x96e5('0x38')](_0x47d207[_0x96e5('0x20')],_0x96e5('0x3c'),JSON['stringify'](_0x244953));});});}logger[_0x96e5('0x23')](_0x47d207[_0x96e5('0x20')],'\x20receiveFax\x20');}};Fax[_0x96e5('0x19')][_0x96e5('0x3d')]=function(_0x1566d6){if(this['actions'][_0x1566d6['uniqueid']]){_[_0x96e5('0x3e')](this[_0x96e5('0x1f')][_0x1566d6[_0x96e5('0x20')]],_[_0x96e5('0x3f')](_0x1566d6,[_0x96e5('0x40'),'reason']));}};function updateStatus(_0x54d800){if(_0x54d800[_0x96e5('0x41')]){faxMessage[_0x96e5('0x42')](_0x54d800[_0x96e5('0x41')],{'failMessage':_0x96e5('0x43')})[_0x96e5('0x36')](function(_0x5096b2){ut['logger'](_0x96e5('0x44'),_0x5096b2);})[_0x96e5('0x3b')](function(_0x263d47){ut[_0x96e5('0x45')](_0x96e5('0x46'),_0x263d47);});}else{ut[_0x96e5('0x45')](_0x96e5('0x47'));}}Fax[_0x96e5('0x19')][_0x96e5('0x48')]=function(_0xfd0378,_0x39412,_0x639051){var _0x513c9e=this;var _0x258e28={};if(_0x39412){_0x258e28={'read':_0x39412};}else{_0x258e28={'failMessage':_0x639051};}if(this[_0x96e5('0xe')][_0xfd0378]['AttachmentId']){faxMessage[_0x96e5('0x42')](this[_0x96e5('0xe')][_0xfd0378]['AttachmentId'],_0x258e28)[_0x96e5('0x36')](function(_0x9dff00){ut[_0x96e5('0x45')](_0x96e5('0x49'),_0x9dff00);})[_0x96e5('0x3b')](function(_0x50f59e){ut[_0x96e5('0x45')](_0x96e5('0x4a'),_0x50f59e);})['finally'](function(){delete _0x513c9e[_0x96e5('0x1f')][_0xfd0378];delete _0x513c9e[_0x96e5('0xe')][_0xfd0378];});}else{ut['logger'](_0x96e5('0x4b'));delete this['channels'][_0xfd0378];delete this[_0x96e5('0xe')][_0xfd0378];}};Fax['prototype'][_0x96e5('0x17')]=function(_0x5aa2b6){var _0x53f4fd=this;if(this['channels'][_0x5aa2b6[_0x96e5('0x20')]]){if(this['actions'][_0x5aa2b6['uniqueid']]){this[_0x96e5('0x1f')][_0x5aa2b6[_0x96e5('0x20')]]['id']=this[_0x96e5('0xe')][_0x5aa2b6[_0x96e5('0x20')]]['id'];this['channels'][_0x5aa2b6['uniqueid']]['name']=this[_0x96e5('0xe')][_0x5aa2b6[_0x96e5('0x20')]][_0x96e5('0x22')];}logger['info'](_0x5aa2b6[_0x96e5('0x20')],this[_0x96e5('0xe')][_0x5aa2b6['uniqueid']]?'\x20hangup\x20sendFile\x20':_0x96e5('0x4c'),JSON[_0x96e5('0x3a')](this[_0x96e5('0x1f')][_0x5aa2b6[_0x96e5('0x20')]]));if(this['actions'][_0x5aa2b6[_0x96e5('0x20')]]){if(this[_0x96e5('0x1f')][_0x5aa2b6['uniqueid']]['faxpages']>0x0&&this[_0x96e5('0x1f')][_0x5aa2b6[_0x96e5('0x20')]]['faxstatus']===_0x96e5('0x4d')){this[_0x96e5('0x48')](_0x5aa2b6[_0x96e5('0x20')],!![]);}else{this[_0x96e5('0x48')](_0x5aa2b6['uniqueid'],![],this[_0x96e5('0x1f')][_0x5aa2b6[_0x96e5('0x20')]][_0x96e5('0x4e')]?_0x96e5('0x4f')+this[_0x96e5('0x1f')][_0x5aa2b6['uniqueid']][_0x96e5('0x4e')]:'SENDING\x20FAILED');}}}};Fax[_0x96e5('0x19')]['send']=function(_0x2f312d){var _0x38e4aa=this;return new BPromise(function(_0x1434c4,_0x53f68f){_0x38e4aa[_0x96e5('0x50')](_0x2f312d,_0x38e4aa[_0x96e5('0xc')][_0x2f312d['FaxAccountId']])['then'](function(_0xbb465c){ut[_0x96e5('0x45')](_0x96e5('0x51'),_0xbb465c);_0x1434c4(ut['message']('Fax\x20received'));})['catch'](function(_0x468c43){ut[_0x96e5('0x45')](_0x96e5('0x52'),_0x468c43);updateStatus(_0x2f312d);_0x53f68f(ut[_0x96e5('0x32')]('Fax\x20failed'));});});};Fax['prototype'][_0x96e5('0x53')]=function(_0x4b65c1){var _0x2f5961=this;return new BPromise(function(_0x4058fd,_0x56fb1b){var _0x1d428d=_0x2f5961['checkTrunk'](_0x2f5961[_0x96e5('0xc')][_0x4b65c1[_0x96e5('0x54')]][_0x96e5('0x55')],_0x4b65c1);if(_0x1d428d['isValid']){_0x4058fd(ut[_0x96e5('0x32')](_0x96e5('0x56')));}else{_0x56fb1b(ut[_0x96e5('0x32')](_0x1d428d['message']));}});};function originate(_0x5504d9,_0x4df3d5,_0x3ce586){return new BPromise(function(_0x113c10,_0x2f1d62){if(_0x3ce586){var _0x1ffc57=util[_0x96e5('0x57')]('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0x96e5('0x33')](_0x5504d9[_0x96e5('0x4')])[_0x96e5('0x22')],_0x5504d9['path']);gs[_0x96e5('0x58')](_0x1ffc57)['then'](function(){_0x5504d9[_0x96e5('0x4')]=util[_0x96e5('0x57')]('%s/%s.tif',path[_0x96e5('0x33')](_0x5504d9['path'])[_0x96e5('0x59')],path[_0x96e5('0x33')](_0x5504d9[_0x96e5('0x4')])[_0x96e5('0x22')]);_0x4df3d5[_0x96e5('0x5a')]=_0x5504d9['path'];ut[_0x96e5('0x45')](_0x96e5('0x5b'),'');ami[_0x96e5('0x5c')](ut[_0x96e5('0x5d')](_0x5504d9,_0x4df3d5))[_0x96e5('0x36')](function(_0x15212e){_0x113c10(_0x15212e);})[_0x96e5('0x3b')](function(_0x5a9bf9){_0x2f1d62(_0x5a9bf9);});})['catch'](function(_0xcf63fa){_0x2f1d62(_0xcf63fa);});}else{ami[_0x96e5('0x5c')](ut[_0x96e5('0x5d')](_0x5504d9,_0x4df3d5))[_0x96e5('0x36')](function(_0x4c9d4e){_0x113c10(_0x4c9d4e);})['catch'](function(_0x189ac6){_0x2f1d62(_0x189ac6);});}});}Fax['prototype'][_0x96e5('0x50')]=function(_0x429f78,_0x6fc8d0){var _0x3fd211=this;return new BPromise(function(_0x124fbe,_0x246b19){var _0x192301=uuid['v4']();var _0x1ccbab=ut['addVariables'](_0x429f78,_0x6fc8d0);_0x3fd211[_0x96e5('0xe')][_0x192301]=new Action(_0x192301,_0x6fc8d0,_0x429f78);var _0x3678ed=_0x3fd211['actions'][_0x192301];if(path[_0x96e5('0x33')](_0x429f78[_0x96e5('0x4')])[_0x96e5('0x5e')]==='.pdf'){originate(_0x3678ed,_0x1ccbab,!![])[_0x96e5('0x36')](function(_0x2ae45c){_0x124fbe(_0x2ae45c);})[_0x96e5('0x3b')](function(_0x1adc1c){_0x246b19(_0x1adc1c);});}else{originate(_0x3678ed,_0x1ccbab,![])[_0x96e5('0x36')](function(_0x48e9fe){_0x124fbe(_0x48e9fe);})['catch'](function(_0x12d940){_0x246b19(_0x12d940);});}});};Fax[_0x96e5('0x19')][_0x96e5('0x5f')]=function(_0x2b5d62){return!_[_0x96e5('0x60')](_0x2b5d62)&&!_[_0x96e5('0x60')](_0x2b5d62[_0x96e5('0x22')])&&!_[_0x96e5('0x60')](_0x2b5d62[_0x96e5('0x61')])&&_0x2b5d62['active']&&!_[_0x96e5('0x60')](this[_0x96e5('0xd')][util[_0x96e5('0x57')](_0x96e5('0x62'),_0x2b5d62[_0x96e5('0x22')])])&&!_[_0x96e5('0x60')](this[_0x96e5('0xd')][util['format']('SIP/%s',_0x2b5d62[_0x96e5('0x22')])]['status'])&&(this[_0x96e5('0xd')][util['format']('SIP/%s',_0x2b5d62[_0x96e5('0x22')])][_0x96e5('0x63')]===_0x96e5('0x64')||this[_0x96e5('0xd')][util[_0x96e5('0x57')](_0x96e5('0x62'),_0x2b5d62['name'])][_0x96e5('0x63')]===_0x96e5('0x65'));};Fax[_0x96e5('0x19')][_0x96e5('0x66')]=function(_0x21ddc8,_0x275517){if(!this[_0x96e5('0x5f')](_0x21ddc8)){ut[_0x96e5('0x45')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_['isNil'](_0x21ddc8)?'':_0x21ddc8[_0x96e5('0x22')]+_0x96e5('0x67'));return{'isValid':![],'message':_0x96e5('0x68')};}if(_[_0x96e5('0x60')](_0x275517[_0x96e5('0x6')])){ut['logger']('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x96e5('0x3a')](_0x275517));return{'isValid':![],'message':_0x96e5('0x69')};}if(_['isNil'](_0x275517['path'])){ut[_0x96e5('0x45')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x96e5('0x3a')](_0x275517));return{'isValid':![],'message':_0x96e5('0x6a')};}return{'isValid':!![],'message':_0x96e5('0x6b')};};module[_0x96e5('0x6c')]=Fax; \ No newline at end of file +var _0x2826=['Fax\x20received','[Fax][execOriginate][failure]','checkTrunk','Trunk','format','execute','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','moment','path','tiff2pdf','./util/gs','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','syncVarSet','newstate','syncNewState','newexten','syncNewExten','syncFaxStatus','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','channels','uniqueid','channel','name','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','status','filename','info','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','fax','error','catch','\x20receiveFax\x20','stringify','pick','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatus','faxstatusstring','send','FaxAccountId','[Fax][execOriginate][success]'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2826,0x103));var _0x6282=function(_0x502fb0,_0x2c46eb){_0x502fb0=_0x502fb0-0x0;var _0x39e759=_0x2826[_0x502fb0];return _0x39e759;};'use strict';var util=require(_0x6282('0x0'));var _=require(_0x6282('0x1'));var BPromise=require(_0x6282('0x2'));var uuid=require('uuid');var moment=require(_0x6282('0x3'));var path=require(_0x6282('0x4'));var tiff2pdf=require(_0x6282('0x5'));var gs=require(_0x6282('0x6'));var logger=require('../../../config/logger')('fax');var ami=require(_0x6282('0x7'));var rpcDb=require(_0x6282('0x8'));var Channel=require(_0x6282('0x9'));var ut=require(_0x6282('0xa'));var Action=require(_0x6282('0xb'));var faxAccount=require(_0x6282('0xc'));var attachment=require(_0x6282('0xd'));var faxMessage=require(_0x6282('0xe'));function Fax(_0x199c31){this['channels']={};this[_0x6282('0xf')]=_0x199c31[_0x6282('0xf')];this[_0x6282('0x10')]=_0x199c31[_0x6282('0x10')];this[_0x6282('0x11')]={};ami['on'](_0x6282('0x12'),this[_0x6282('0x13')][_0x6282('0x14')](this));ami['on']('varset',this[_0x6282('0x15')][_0x6282('0x14')](this));ami['on'](_0x6282('0x16'),this[_0x6282('0x17')]['bind'](this));ami['on'](_0x6282('0x18'),this[_0x6282('0x19')][_0x6282('0x14')](this));ami['on']('faxstatus',this[_0x6282('0x1a')][_0x6282('0x14')](this));ami['on']('receivefax',this[_0x6282('0x1b')][_0x6282('0x14')](this));ami['on'](_0x6282('0x1c'),this[_0x6282('0x1d')][_0x6282('0x14')](this));ami['on'](_0x6282('0x1e'),this[_0x6282('0x1f')][_0x6282('0x14')](this));}Fax[_0x6282('0x20')]['syncNewchannel']=function(_0x55123f){if(_0x55123f[_0x6282('0x21')]===_0x6282('0x22')){for(var _0x387fe1 in this[_0x6282('0xf')]){if(this['faxAccounts'][_0x6282('0x23')](_0x387fe1)){if(_0x55123f[_0x6282('0x24')]===this[_0x6282('0xf')][_0x387fe1][_0x6282('0x25')]){this[_0x6282('0x26')][_0x55123f['uniqueid']]={};this[_0x6282('0x26')][_0x55123f[_0x6282('0x27')]][_0x6282('0x28')]=_0x55123f[_0x6282('0x28')];this[_0x6282('0x26')][_0x55123f['uniqueid']]['id']=this[_0x6282('0xf')][_0x387fe1]['id'];this[_0x6282('0x26')][_0x55123f[_0x6282('0x27')]][_0x6282('0x29')]=this['faxAccounts'][_0x387fe1][_0x6282('0x29')];logger['info'](_0x55123f[_0x6282('0x27')],_0x6282('0x2a'));}}}}if(this[_0x6282('0x11')][_0x55123f[_0x6282('0x27')]]){this['channels'][_0x55123f[_0x6282('0x27')]]={};this[_0x6282('0x26')][_0x55123f['uniqueid']]['channel']=_0x55123f[_0x6282('0x28')];logger['info'](_0x55123f[_0x6282('0x27')],'\x20syncNewchannel\x20');}};Fax['prototype']['syncVarSet']=function(_0x1493af){if(this[_0x6282('0x26')][_0x1493af[_0x6282('0x27')]]){for(var _0x111c97 in _0x1493af[_0x6282('0x2b')]){if(_0x1493af['variable'][_0x6282('0x23')](_0x111c97)){this[_0x6282('0x26')][_0x1493af[_0x6282('0x27')]][_0x111c97]=_0x1493af[_0x6282('0x2c')];}}}};Fax['prototype'][_0x6282('0x17')]=function(_0x5c4f3f){if(this[_0x6282('0x26')][_0x5c4f3f[_0x6282('0x27')]]){this['channels'][_0x5c4f3f[_0x6282('0x27')]]['channelstate']=_0x5c4f3f[_0x6282('0x2d')];this[_0x6282('0x26')][_0x5c4f3f['uniqueid']]['channelstatedesc']=_0x5c4f3f[_0x6282('0x2e')];}};Fax[_0x6282('0x20')][_0x6282('0x19')]=function(_0x25ee34){if(this['channels'][_0x25ee34[_0x6282('0x27')]]){for(var _0x55c528 in _0x25ee34[_0x6282('0x2b')]){if(_0x25ee34[_0x6282('0x2b')]['hasOwnProperty'](_0x55c528)){this['channels'][_0x25ee34[_0x6282('0x27')]][_0x55c528]=_0x25ee34[_0x6282('0x2c')];}}}};Fax[_0x6282('0x20')][_0x6282('0x1a')]=function(_0x2321a0){if(this['channels'][_0x2321a0[_0x6282('0x27')]]){this[_0x6282('0x26')][_0x2321a0[_0x6282('0x27')]][_0x6282('0x2f')]=_0x2321a0[_0x6282('0x2f')];this[_0x6282('0x26')][_0x2321a0[_0x6282('0x27')]][_0x6282('0x30')]=_0x2321a0[_0x6282('0x30')];this[_0x6282('0x26')][_0x2321a0[_0x6282('0x27')]][_0x6282('0x25')]=_0x2321a0[_0x6282('0x25')];this['channels'][_0x2321a0[_0x6282('0x27')]]['filename']=_0x2321a0[_0x6282('0x31')];logger[_0x6282('0x32')](_0x2321a0[_0x6282('0x27')],_0x6282('0x33'));}};Fax['prototype'][_0x6282('0x1b')]=function(_0x33bfe6){var _0x5533fe=this;if(this[_0x6282('0x26')][_0x33bfe6[_0x6282('0x27')]]){var _0x54a2fa=this[_0x6282('0x26')][_0x33bfe6[_0x6282('0x27')]]['id'];this['channels'][_0x33bfe6['uniqueid']][_0x6282('0x34')]=_0x33bfe6[_0x6282('0x34')];this['channels'][_0x33bfe6['uniqueid']][_0x6282('0x35')]=_0x33bfe6[_0x6282('0x35')];this['channels'][_0x33bfe6[_0x6282('0x27')]][_0x6282('0x25')]=_0x33bfe6[_0x6282('0x25')];this[_0x6282('0x26')][_0x33bfe6['uniqueid']]['resolution']=_0x33bfe6[_0x6282('0x36')];this['channels'][_0x33bfe6['uniqueid']][_0x6282('0x37')]=_0x33bfe6[_0x6282('0x37')];this[_0x6282('0x26')][_0x33bfe6['uniqueid']][_0x6282('0x31')]=_0x33bfe6[_0x6282('0x31')];this[_0x6282('0x26')][_0x33bfe6[_0x6282('0x27')]][_0x6282('0x38')]=_0x33bfe6[_0x6282('0x38')];if(this[_0x6282('0x26')][_0x33bfe6['uniqueid']][_0x6282('0x35')]>0x0){tiff2pdf(_0x33bfe6[_0x6282('0x31')],_0x6282('0x39'),function(_0x1e9c27){logger['info'](_0x33bfe6['uniqueid'],_0x6282('0x3a'),_0x1e9c27[_0x6282('0x3b')]);attachment[_0x6282('0x3c')]({'name':path[_0x6282('0x3d')](_0x33bfe6[_0x6282('0x31')])[_0x6282('0x29')],'basename':path[_0x6282('0x3d')](_0x33bfe6[_0x6282('0x31')])[_0x6282('0x29')]+_0x6282('0x3e'),'type':_0x6282('0x3f')})[_0x6282('0x40')](function(_0x497d70){faxAccount['notify'](_0x54a2fa,{'from':_0x33bfe6[_0x6282('0x38')],'mapKey':_0x6282('0x41'),'body':path[_0x6282('0x3d')](_0x33bfe6[_0x6282('0x31')])[_0x6282('0x29')]+_0x6282('0x3e'),'AttachmentId':_0x497d70['id']})['catch'](function(_0x513795){logger[_0x6282('0x42')](_0x33bfe6[_0x6282('0x27')],'\x20notify\x20',JSON['stringify'](_0x513795));});})[_0x6282('0x43')](function(_0x40dd22){logger[_0x6282('0x42')](_0x33bfe6[_0x6282('0x27')],_0x6282('0x44'),JSON[_0x6282('0x45')](_0x40dd22));});});}logger[_0x6282('0x32')](_0x33bfe6[_0x6282('0x27')],_0x6282('0x44'));}};Fax[_0x6282('0x20')]['syncOriginateResponse']=function(_0x1667cd){if(this[_0x6282('0x11')][_0x1667cd[_0x6282('0x27')]]){_['merge'](this[_0x6282('0x26')][_0x1667cd[_0x6282('0x27')]],_[_0x6282('0x46')](_0x1667cd,['response','reason']));}};function updateStatus(_0x4fb24c){if(_0x4fb24c[_0x6282('0x47')]){faxMessage[_0x6282('0x48')](_0x4fb24c[_0x6282('0x47')],{'failMessage':_0x6282('0x49')})[_0x6282('0x40')](function(_0x479018){ut[_0x6282('0x4a')](_0x6282('0x4b'),_0x479018);})[_0x6282('0x43')](function(_0x1a9251){ut[_0x6282('0x4a')](_0x6282('0x4c'),_0x1a9251);});}else{ut['logger']('[Fax][Message][Error][NoUpdate2]');}}Fax['prototype'][_0x6282('0x4d')]=function(_0x96e419,_0x38a3f7,_0x1d2ad5){var _0x53ca5a=this;var _0xe242fb={};if(_0x38a3f7){_0xe242fb={'read':_0x38a3f7};}else{_0xe242fb={'failMessage':_0x1d2ad5};}if(this[_0x6282('0x11')][_0x96e419]['AttachmentId']){faxMessage['update'](this[_0x6282('0x11')][_0x96e419][_0x6282('0x47')],_0xe242fb)['then'](function(_0x318af6){ut['logger'](_0x6282('0x4e'),_0x318af6);})[_0x6282('0x43')](function(_0x51d913){ut[_0x6282('0x4a')](_0x6282('0x4f'),_0x51d913);})['finally'](function(){delete _0x53ca5a[_0x6282('0x26')][_0x96e419];delete _0x53ca5a[_0x6282('0x11')][_0x96e419];});}else{ut[_0x6282('0x4a')](_0x6282('0x50'));delete this[_0x6282('0x26')][_0x96e419];delete this[_0x6282('0x11')][_0x96e419];}};Fax['prototype'][_0x6282('0x1d')]=function(_0x26c76f){var _0x458c54=this;if(this[_0x6282('0x26')][_0x26c76f[_0x6282('0x27')]]){if(this[_0x6282('0x11')][_0x26c76f['uniqueid']]){this[_0x6282('0x26')][_0x26c76f['uniqueid']]['id']=this[_0x6282('0x11')][_0x26c76f['uniqueid']]['id'];this['channels'][_0x26c76f[_0x6282('0x27')]][_0x6282('0x29')]=this[_0x6282('0x11')][_0x26c76f[_0x6282('0x27')]][_0x6282('0x29')];}logger['info'](_0x26c76f[_0x6282('0x27')],this[_0x6282('0x11')][_0x26c76f[_0x6282('0x27')]]?_0x6282('0x51'):_0x6282('0x52'),JSON[_0x6282('0x45')](this[_0x6282('0x26')][_0x26c76f[_0x6282('0x27')]]));if(this[_0x6282('0x11')][_0x26c76f['uniqueid']]){if(this[_0x6282('0x26')][_0x26c76f[_0x6282('0x27')]][_0x6282('0x53')]>0x0&&this[_0x6282('0x26')][_0x26c76f[_0x6282('0x27')]][_0x6282('0x54')]==='SUCCESS'){this[_0x6282('0x4d')](_0x26c76f[_0x6282('0x27')],!![]);}else{this['updateStatus'](_0x26c76f[_0x6282('0x27')],![],this[_0x6282('0x26')][_0x26c76f[_0x6282('0x27')]][_0x6282('0x55')]?'SENDING\x20FAILED:\x20'+this[_0x6282('0x26')][_0x26c76f[_0x6282('0x27')]]['faxstatusstring']:'SENDING\x20FAILED');}}}};Fax['prototype'][_0x6282('0x56')]=function(_0xefd960){var _0x263f13=this;return new BPromise(function(_0x2b5780,_0x136500){_0x263f13['execOriginate'](_0xefd960,_0x263f13[_0x6282('0xf')][_0xefd960[_0x6282('0x57')]])['then'](function(_0xc6aab7){ut[_0x6282('0x4a')](_0x6282('0x58'),_0xc6aab7);_0x2b5780(ut[_0x6282('0x3b')](_0x6282('0x59')));})[_0x6282('0x43')](function(_0x2c4764){ut[_0x6282('0x4a')](_0x6282('0x5a'),_0x2c4764);updateStatus(_0xefd960);_0x136500(ut[_0x6282('0x3b')]('Fax\x20failed'));});});};Fax['prototype']['checkAfterSend']=function(_0x55db9c){var _0x52cfaa=this;return new BPromise(function(_0x341c0f,_0x512a01){var _0x9e5dea=_0x52cfaa[_0x6282('0x5b')](_0x52cfaa['faxAccounts'][_0x55db9c['FaxAccountId']][_0x6282('0x5c')],_0x55db9c);if(_0x9e5dea['isValid']){_0x341c0f(ut[_0x6282('0x3b')]('Trunk\x20Reachable'));}else{_0x512a01(ut[_0x6282('0x3b')](_0x9e5dea[_0x6282('0x3b')]));}});};function originate(_0x446048,_0x5489ca,_0x239ecc){return new BPromise(function(_0xd96e7a,_0x5a71fe){if(_0x239ecc){var _0x1e3fb0=util[_0x6282('0x5d')]('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0x6282('0x3d')](_0x446048[_0x6282('0x4')])[_0x6282('0x29')],_0x446048[_0x6282('0x4')]);gs[_0x6282('0x5e')](_0x1e3fb0)[_0x6282('0x40')](function(){_0x446048[_0x6282('0x4')]=util[_0x6282('0x5d')](_0x6282('0x5f'),path[_0x6282('0x3d')](_0x446048[_0x6282('0x4')])['dir'],path[_0x6282('0x3d')](_0x446048[_0x6282('0x4')])[_0x6282('0x29')]);_0x5489ca[_0x6282('0x60')]=_0x446048[_0x6282('0x4')];ut[_0x6282('0x4a')](_0x6282('0x61'),'');ami[_0x6282('0x62')](ut[_0x6282('0x63')](_0x446048,_0x5489ca))[_0x6282('0x40')](function(_0x7e4156){_0xd96e7a(_0x7e4156);})[_0x6282('0x43')](function(_0x484fdf){_0x5a71fe(_0x484fdf);});})['catch'](function(_0x1c68cf){_0x5a71fe(_0x1c68cf);});}else{ami['Action'](ut[_0x6282('0x63')](_0x446048,_0x5489ca))[_0x6282('0x40')](function(_0x30cd75){_0xd96e7a(_0x30cd75);})['catch'](function(_0x5ef3df){_0x5a71fe(_0x5ef3df);});}});}Fax[_0x6282('0x20')][_0x6282('0x64')]=function(_0x14174b,_0x59c2bc){var _0x54826c=this;return new BPromise(function(_0x3d2096,_0x141943){var _0x4d9fbd=uuid['v4']();var _0x32186e=ut[_0x6282('0x65')](_0x14174b,_0x59c2bc);_0x54826c[_0x6282('0x11')][_0x4d9fbd]=new Action(_0x4d9fbd,_0x59c2bc,_0x14174b);var _0x4417e5=_0x54826c[_0x6282('0x11')][_0x4d9fbd];if(path[_0x6282('0x3d')](_0x14174b[_0x6282('0x4')])[_0x6282('0x66')]===_0x6282('0x3e')){originate(_0x4417e5,_0x32186e,!![])['then'](function(_0x128963){_0x3d2096(_0x128963);})['catch'](function(_0x1fe831){_0x141943(_0x1fe831);});}else{originate(_0x4417e5,_0x32186e,![])[_0x6282('0x40')](function(_0x21706b){_0x3d2096(_0x21706b);})[_0x6282('0x43')](function(_0x5aa39a){_0x141943(_0x5aa39a);});}});};Fax[_0x6282('0x20')][_0x6282('0x67')]=function(_0x326a1d){return!_[_0x6282('0x68')](_0x326a1d)&&!_[_0x6282('0x68')](_0x326a1d[_0x6282('0x29')])&&!_[_0x6282('0x68')](_0x326a1d[_0x6282('0x69')])&&_0x326a1d['active']&&!_['isNil'](this['trunks'][util[_0x6282('0x5d')](_0x6282('0x6a'),_0x326a1d[_0x6282('0x29')])])&&!_[_0x6282('0x68')](this[_0x6282('0x10')][util[_0x6282('0x5d')]('SIP/%s',_0x326a1d[_0x6282('0x29')])][_0x6282('0x30')])&&(this[_0x6282('0x10')][util[_0x6282('0x5d')]('SIP/%s',_0x326a1d['name'])][_0x6282('0x30')]==='reachable'||this['trunks'][util['format'](_0x6282('0x6a'),_0x326a1d[_0x6282('0x29')])][_0x6282('0x30')]===_0x6282('0x6b'));};Fax[_0x6282('0x20')][_0x6282('0x5b')]=function(_0x3da2d,_0x3131b8){if(!this[_0x6282('0x67')](_0x3da2d)){ut['logger'](_0x6282('0x6c'),_[_0x6282('0x68')](_0x3da2d)?'':_0x3da2d['name']+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x6282('0x6d')};}if(_['isNil'](_0x3131b8[_0x6282('0x41')])){ut[_0x6282('0x4a')](_0x6282('0x6e'),JSON[_0x6282('0x45')](_0x3131b8));return{'isValid':![],'message':_0x6282('0x6f')};}if(_[_0x6282('0x68')](_0x3131b8[_0x6282('0x4')])){ut[_0x6282('0x4a')](_0x6282('0x70'),JSON['stringify'](_0x3131b8));return{'isValid':![],'message':_0x6282('0x71')};}return{'isValid':!![],'message':_0x6282('0x72')};};module[_0x6282('0x73')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index ebb8a00..aa96002 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 _0xd567=['then','catch','[Notify]\x20','util','preview','lodash','error','inspect','notify','resolve'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0xd567,0x193));var _0x7d56=function(_0x1a66f6,_0xbdf8e1){_0x1a66f6=_0x1a66f6-0x0;var _0x2972ed=_0xd567[_0x1a66f6];return _0x2972ed;};'use strict';var util=require(_0x7d56('0x0'));var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0x7d56('0x1'));var _=require(_0x7d56('0x2'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x3f3176){return function(_0x389df8){logger[_0x7d56('0x3')](_0x3f3176,util[_0x7d56('0x4')](_0x389df8,{'showHidden':![],'depth':null}));};}exports[_0x7d56('0x5')]=function(_0xc21f5e,_0x194ce4){return BPromise[_0x7d56('0x6')]()[_0x7d56('0x7')](faxAccount[_0x7d56('0x5')](_0xc21f5e,_0x194ce4))[_0x7d56('0x8')](loggerCatch(_0x7d56('0x9')));}; \ No newline at end of file +var _0xaf80=['error','inspect','notify','resolve','then','catch','[Notify]\x20','util','../../../config/logger','preview','lodash'];(function(_0x2ca980,_0x2e8c30){var _0xc5c3f7=function(_0x79ec28){while(--_0x79ec28){_0x2ca980['push'](_0x2ca980['shift']());}};_0xc5c3f7(++_0x2e8c30);}(_0xaf80,0x167));var _0x0af8=function(_0x102e80,_0x5bf53b){_0x102e80=_0x102e80-0x0;var _0xc0aa0e=_0xaf80[_0x102e80];return _0xc0aa0e;};'use strict';var util=require(_0x0af8('0x0'));var BPromise=require('bluebird');var logger=require(_0x0af8('0x1'))(_0x0af8('0x2'));var _=require(_0x0af8('0x3'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x42a5fd){return function(_0x4d521c){logger[_0x0af8('0x4')](_0x42a5fd,util[_0x0af8('0x5')](_0x4d521c,{'showHidden':![],'depth':null}));};}exports[_0x0af8('0x6')]=function(_0x55d2a0,_0x36f741){return BPromise[_0x0af8('0x7')]()[_0x0af8('0x8')](faxAccount[_0x0af8('0x6')](_0x55d2a0,_0x36f741))[_0x0af8('0x9')](loggerCatch(_0x0af8('0xa')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 5d0cc51..ec918c1 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 _0x94bb=['exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','bluebird'];(function(_0x4a67ff,_0x4aec58){var _0x1c19e8=function(_0x4d0aab){while(--_0x4d0aab){_0x4a67ff['push'](_0x4a67ff['shift']());}};_0x1c19e8(++_0x4aec58);}(_0x94bb,0x180));var _0xb94b=function(_0x55c485,_0x3fe77e){_0x55c485=_0x55c485-0x0;var _0x6bb521=_0x94bb[_0x55c485];return _0x6bb521;};'use strict';var util=require(_0xb94b('0x0'));var logger=require(_0xb94b('0x1'))('fax');var BPromise=require(_0xb94b('0x2'));var exec=require('child_process')[_0xb94b('0x3')];exports[_0xb94b('0x4')]=function(_0x464304){return new BPromise(function(_0x360f96,_0x55f8f0){exec(_0x464304,function(_0x23bf24,_0x29e0ab,_0xfca70c){logger[_0xb94b('0x5')](_0xb94b('0x6'),_0x29e0ab);if(_0x23bf24){logger[_0xb94b('0x5')](_0xb94b('0x6'),_0xb94b('0x7'),util[_0xb94b('0x8')](_0x23bf24,{'showHidden':![],'depth':null}),_0x29e0ab,_0xfca70c);_0x55f8f0(_0x23bf24);}_0x360f96(_0x29e0ab);});});}; \ No newline at end of file +var _0x2519=['util','../../../../config/logger','fax','bluebird','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect'];(function(_0x4f6464,_0x19ce0b){var _0x2970c0=function(_0x30b705){while(--_0x30b705){_0x4f6464['push'](_0x4f6464['shift']());}};_0x2970c0(++_0x19ce0b);}(_0x2519,0x176));var _0x9251=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2519[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x9251('0x0'));var logger=require(_0x9251('0x1'))(_0x9251('0x2'));var BPromise=require(_0x9251('0x3'));var exec=require(_0x9251('0x4'))[_0x9251('0x5')];exports[_0x9251('0x6')]=function(_0xd52a50){return new BPromise(function(_0x37eb0c,_0x1a4adc){exec(_0xd52a50,function(_0x320935,_0x129575,_0x257ffb){logger[_0x9251('0x7')](_0x9251('0x8'),_0x129575);if(_0x320935){logger[_0x9251('0x7')](_0x9251('0x8'),_0x9251('0x9'),util[_0x9251('0xa')](_0x320935,{'showHidden':![],'depth':null}),_0x129575,_0x257ffb);_0x1a4adc(_0x320935);}_0x37eb0c(_0x129575);});});}; \ 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 fc01747..aae18e1 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 _0xb43b=['ecm','headerinfo','minrate','maxrate','\x22%s\x22','modem','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','from-sip','util','lodash','../../../../config/logger','fax','message','logger','info'];(function(_0x21e0af,_0x154d11){var _0x4421d8=function(_0x1cb2da){while(--_0x1cb2da){_0x21e0af['push'](_0x21e0af['shift']());}};_0x4421d8(++_0x154d11);}(_0xb43b,0x1b2));var _0xbb43=function(_0x4d592e,_0x5eab2b){_0x4d592e=_0x4d592e-0x0;var _0x43b95f=_0xb43b[_0x4d592e];return _0x43b95f;};'use strict';var util=require(_0xbb43('0x0'));var _=require(_0xbb43('0x1'));var moment=require('moment');var logger=require(_0xbb43('0x2'))(_0xbb43('0x3'));exports[_0xbb43('0x4')]=function(_0x4cf605){return{'message':_0x4cf605};};exports[_0xbb43('0x5')]=function(_0x41aff6,_0x351254){logger[_0xbb43('0x6')](_0x41aff6,util['inspect'](_0x351254,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x378df5,_0x553520){var _0x80fe61={'XMF-ECM':_0x553520[_0xbb43('0x7')],'XMF-HEADERINFO':_0x553520[_0xbb43('0x8')],'XMF-MINRATE':_0x553520[_0xbb43('0x9')],'XMF-MAXRATE':_0x553520[_0xbb43('0xa')],'XMF-MODEM':util['format'](_0xbb43('0xb'),_0x553520[_0xbb43('0xc')]),'XMF-GATEWAY':_0x553520['gateway'],'XMF-FAXDETECT':_0x553520[_0xbb43('0xd')],'XMF-T38TIMEOUT':_0x553520[_0xbb43('0xe')],'XMF-LOCALSTATIONID':_0x553520[_0xbb43('0xf')],'XMF-PATH':_0x378df5[_0xbb43('0x10')]};return _0x80fe61;};exports[_0xbb43('0x11')]=function(_0x2bef86,_0x480cc2){return{'actionid':_0x2bef86[_0xbb43('0x12')],'action':_0xbb43('0x13'),'channel':_0x2bef86['channel'],'Exten':'xcally-motion-fax','Context':_0xbb43('0x14'),'Priority':'1','callerid':util['format']('\x22%s\x22\x20<%s>',_0x2bef86[_0xbb43('0x8')]?_0x2bef86['headerinfo']:'',_0x2bef86[_0xbb43('0xf')]),'variable':_0x480cc2,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x2bef86[_0xbb43('0x12')]};}; \ No newline at end of file +var _0xbee3=['uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','lodash','fax','message','logger','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','modem','gateway','faxdetect','t38timeout','localstationid','path'];(function(_0x2bbb33,_0x431da6){var _0x4521e9=function(_0x3ac25e){while(--_0x3ac25e){_0x2bbb33['push'](_0x2bbb33['shift']());}};_0x4521e9(++_0x431da6);}(_0xbee3,0xd5));var _0x3bee=function(_0x14fbb1,_0x31e2b6){_0x14fbb1=_0x14fbb1-0x0;var _0x16fdf2=_0xbee3[_0x14fbb1];return _0x16fdf2;};'use strict';var util=require('util');var _=require(_0x3bee('0x0'));var moment=require('moment');var logger=require('../../../../config/logger')(_0x3bee('0x1'));exports[_0x3bee('0x2')]=function(_0x4945a7){return{'message':_0x4945a7};};exports[_0x3bee('0x3')]=function(_0x1956c1,_0x1cf379){logger['info'](_0x1956c1,util[_0x3bee('0x4')](_0x1cf379,{'showHidden':![],'depth':null}));};exports[_0x3bee('0x5')]=function(_0x4c5ef5,_0x2fdeec){var _0x28d912={'XMF-ECM':_0x2fdeec[_0x3bee('0x6')],'XMF-HEADERINFO':_0x2fdeec[_0x3bee('0x7')],'XMF-MINRATE':_0x2fdeec[_0x3bee('0x8')],'XMF-MAXRATE':_0x2fdeec[_0x3bee('0x9')],'XMF-MODEM':util[_0x3bee('0xa')]('\x22%s\x22',_0x2fdeec[_0x3bee('0xb')]),'XMF-GATEWAY':_0x2fdeec[_0x3bee('0xc')],'XMF-FAXDETECT':_0x2fdeec[_0x3bee('0xd')],'XMF-T38TIMEOUT':_0x2fdeec[_0x3bee('0xe')],'XMF-LOCALSTATIONID':_0x2fdeec[_0x3bee('0xf')],'XMF-PATH':_0x4c5ef5[_0x3bee('0x10')]};return _0x28d912;};exports['variablesAction']=function(_0x32c0b,_0x5bb283){return{'actionid':_0x32c0b[_0x3bee('0x11')],'action':_0x3bee('0x12'),'channel':_0x32c0b[_0x3bee('0x13')],'Exten':_0x3bee('0x14'),'Context':_0x3bee('0x15'),'Priority':'1','callerid':util[_0x3bee('0xa')](_0x3bee('0x16'),_0x32c0b['headerinfo']?_0x32c0b[_0x3bee('0x7')]:'',_0x32c0b[_0x3bee('0xf')]),'variable':_0x5bb283,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x32c0b[_0x3bee('0x11')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 3423ac0..767a2e2 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 _0x413c=['getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','listen','sync','bluebird','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','getTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts'];(function(_0x30e1c7,_0x52ca83){var _0xea9655=function(_0x4b2613){while(--_0x4b2613){_0x30e1c7['push'](_0x30e1c7['shift']());}};_0xea9655(++_0x52ca83);}(_0x413c,0x138));var _0xc413=function(_0x37c37d,_0x327f73){_0x37c37d=_0x37c37d-0x0;var _0x119783=_0x413c[_0x37c37d];return _0x119783;};'use strict';var BPromise=require(_0xc413('0x0'));var util=require(_0xc413('0x1'));var moment=require(_0xc413('0x2'));var server=require(_0xc413('0x3'));var Realtime=require(_0xc413('0x4'));var Report=require(_0xc413('0x5'));var Acw=require(_0xc413('0x6'));var Trigger=require(_0xc413('0x7'));var Dialer=require(_0xc413('0x8'));var Preview=require(_0xc413('0x9'));var Fax=require(_0xc413('0xa'));var user=require('./rpc/user');var voiceQueue=require(_0xc413('0xb'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0xc413('0xc'));var trunk=require(_0xc413('0xd'));var trigger=require(_0xc413('0xe'));var template=require(_0xc413('0xf'));var cmHopperHistory=require(_0xc413('0x10'));var campaign=require(_0xc413('0x11'));var voiceExtension=require(_0xc413('0x12'));var faxAccount=require(_0xc413('0x13'));var zendesk=require(_0xc413('0x14'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0xc413('0x15'));var zoho=require(_0xc413('0x16'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0xc413('0x17'));var servicenow=require(_0xc413('0x18'));var dynamics365=require(_0xc413('0x19'));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()['get'](_0xc413('0x1a'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0xc413('0x1a'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xc413('0x1b')]()[_0xc413('0x1c')](user[_0xc413('0x1d')]())[_0xc413('0x1c')](realtime[_0xc413('0x1e')]())[_0xc413('0x1c')](user[_0xc413('0x1f')]())[_0xc413('0x1c')](realtime[_0xc413('0x20')]())['then'](trunk[_0xc413('0x21')]())[_0xc413('0x1c')](realtime[_0xc413('0x22')]())['then'](voiceQueue[_0xc413('0x23')]())['then'](realtime['initVoiceQueues']())[_0xc413('0x1c')](trigger[_0xc413('0x24')]())[_0xc413('0x1c')](realtime['initTriggers']())[_0xc413('0x1c')](template[_0xc413('0x25')]())[_0xc413('0x1c')](realtime[_0xc413('0x26')]())[_0xc413('0x1c')](zendesk[_0xc413('0x27')]())[_0xc413('0x1c')](realtime[_0xc413('0x28')]())['then'](salesforce[_0xc413('0x29')]())[_0xc413('0x1c')](realtime[_0xc413('0x2a')]())[_0xc413('0x1c')](sugarcrm['getSugarcrmAccounts']())[_0xc413('0x1c')](realtime['initSugarcrmAccounts']())[_0xc413('0x1c')](freshdesk[_0xc413('0x2b')]())[_0xc413('0x1c')](realtime['initFreshdeskAccounts']())[_0xc413('0x1c')](desk[_0xc413('0x2c')]())['then'](realtime[_0xc413('0x2d')]())[_0xc413('0x1c')](zoho[_0xc413('0x2e')]())[_0xc413('0x1c')](realtime[_0xc413('0x2f')]())[_0xc413('0x1c')](vtiger[_0xc413('0x30')]())[_0xc413('0x1c')](realtime[_0xc413('0x31')]())[_0xc413('0x1c')](freshsales[_0xc413('0x32')]())[_0xc413('0x1c')](realtime[_0xc413('0x33')]())[_0xc413('0x1c')](servicenow[_0xc413('0x34')]())[_0xc413('0x1c')](realtime[_0xc413('0x35')]())['then'](dynamics365[_0xc413('0x36')]())[_0xc413('0x1c')](realtime[_0xc413('0x37')]())['then'](campaign[_0xc413('0x38')]())[_0xc413('0x1c')](realtime[_0xc413('0x39')]())[_0xc413('0x1c')](voiceExtension[_0xc413('0x3a')]())[_0xc413('0x1c')](realtime[_0xc413('0x3b')]())[_0xc413('0x1c')](faxAccount[_0xc413('0x3c')]())['then'](realtime[_0xc413('0x3d')]())['then'](function(){return realtime;});}function initParams(){return BPromise[_0xc413('0x1b')]()[_0xc413('0x1c')](voiceQueueReport['getVoiceQueueReports']())[_0xc413('0x1c')](realtime[_0xc413('0x3e')]())[_0xc413('0x1c')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0xc413('0x1c')](realtime['initVoiceQueueHopperHistory']())[_0xc413('0x1c')](cmHopperHistory[_0xc413('0x3f')]())[_0xc413('0x1c')](realtime[_0xc413('0x40')]())[_0xc413('0x1c')](voiceCallReport[_0xc413('0x41')]())[_0xc413('0x1c')](realtime[_0xc413('0x42')]())[_0xc413('0x1c')](function(_0x28e60c){})[_0xc413('0x43')](function(_0x4be970){console[_0xc413('0x44')](_0x4be970);});}function main(){return server[_0xc413('0x45')](realtime,preview,fax)['then'](function(_0x2bee16){return initRealtime();})[_0xc413('0x1c')](function(){return initParams();})[_0xc413('0x1c')](function(){report[_0xc413('0x46')]();setInterval(initRealtime,0x1388);})[_0xc413('0x43')](function(_0x17ab0d){console[_0xc413('0x44')](_0x17ab0d);});}main(); \ No newline at end of file +var _0x5e58=['moment','./server','./realtime','./report','./acw','./preview','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','hour','get','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','listen','sync','bluebird','util'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x5e58,0x1d3));var _0x85e5=function(_0x2fd93c,_0x3d8354){_0x2fd93c=_0x2fd93c-0x0;var _0x127a71=_0x5e58[_0x2fd93c];return _0x127a71;};'use strict';var BPromise=require(_0x85e5('0x0'));var util=require(_0x85e5('0x1'));var moment=require(_0x85e5('0x2'));var server=require(_0x85e5('0x3'));var Realtime=require(_0x85e5('0x4'));var Report=require(_0x85e5('0x5'));var Acw=require(_0x85e5('0x6'));var Trigger=require('./trigger');var Dialer=require('./dialer');var Preview=require(_0x85e5('0x7'));var Fax=require('./fax');var user=require('./rpc/user');var voiceQueue=require(_0x85e5('0x8'));var voiceQueueReport=require(_0x85e5('0x9'));var voiceCallReport=require(_0x85e5('0xa'));var trunk=require(_0x85e5('0xb'));var trigger=require(_0x85e5('0xc'));var template=require(_0x85e5('0xd'));var cmHopperHistory=require(_0x85e5('0xe'));var campaign=require('./rpc/campaign');var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x85e5('0xf'));var zendesk=require(_0x85e5('0x10'));var salesforce=require(_0x85e5('0x11'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x85e5('0x12'));var zoho=require(_0x85e5('0x13'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x85e5('0x14'));var servicenow=require(_0x85e5('0x15'));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()['get'](_0x85e5('0x16'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x85e5('0x17')](_0x85e5('0x16'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x85e5('0x18')]()[_0x85e5('0x19')](user[_0x85e5('0x1a')]())['then'](realtime[_0x85e5('0x1b')]())[_0x85e5('0x19')](user[_0x85e5('0x1c')]())[_0x85e5('0x19')](realtime[_0x85e5('0x1d')]())['then'](trunk['getTrunks']())[_0x85e5('0x19')](realtime['initTrunks']())[_0x85e5('0x19')](voiceQueue[_0x85e5('0x1e')]())[_0x85e5('0x19')](realtime[_0x85e5('0x1f')]())[_0x85e5('0x19')](trigger[_0x85e5('0x20')]())[_0x85e5('0x19')](realtime[_0x85e5('0x21')]())[_0x85e5('0x19')](template['getTemplates']())['then'](realtime[_0x85e5('0x22')]())['then'](zendesk[_0x85e5('0x23')]())[_0x85e5('0x19')](realtime[_0x85e5('0x24')]())[_0x85e5('0x19')](salesforce[_0x85e5('0x25')]())['then'](realtime['initSalesforceAccounts']())[_0x85e5('0x19')](sugarcrm[_0x85e5('0x26')]())['then'](realtime['initSugarcrmAccounts']())[_0x85e5('0x19')](freshdesk[_0x85e5('0x27')]())['then'](realtime[_0x85e5('0x28')]())[_0x85e5('0x19')](desk[_0x85e5('0x29')]())[_0x85e5('0x19')](realtime[_0x85e5('0x2a')]())['then'](zoho[_0x85e5('0x2b')]())[_0x85e5('0x19')](realtime[_0x85e5('0x2c')]())[_0x85e5('0x19')](vtiger[_0x85e5('0x2d')]())[_0x85e5('0x19')](realtime[_0x85e5('0x2e')]())['then'](freshsales['getFreshsalesAccounts']())['then'](realtime[_0x85e5('0x2f')]())[_0x85e5('0x19')](servicenow[_0x85e5('0x30')]())[_0x85e5('0x19')](realtime['initServicenowAccounts']())[_0x85e5('0x19')](dynamics365[_0x85e5('0x31')]())[_0x85e5('0x19')](realtime[_0x85e5('0x32')]())[_0x85e5('0x19')](campaign[_0x85e5('0x33')]())['then'](realtime[_0x85e5('0x34')]())[_0x85e5('0x19')](voiceExtension[_0x85e5('0x35')]())[_0x85e5('0x19')](realtime[_0x85e5('0x36')]())[_0x85e5('0x19')](faxAccount[_0x85e5('0x37')]())[_0x85e5('0x19')](realtime[_0x85e5('0x38')]())[_0x85e5('0x19')](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0x85e5('0x19')](voiceQueueReport[_0x85e5('0x39')]())['then'](realtime[_0x85e5('0x3a')]())['then'](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x85e5('0x19')](realtime[_0x85e5('0x3b')]())[_0x85e5('0x19')](cmHopperHistory[_0x85e5('0x3c')]())[_0x85e5('0x19')](realtime['initCampaignHopperHistory']())[_0x85e5('0x19')](voiceCallReport[_0x85e5('0x3d')]())[_0x85e5('0x19')](realtime[_0x85e5('0x3e')]())[_0x85e5('0x19')](function(_0x11253a){})[_0x85e5('0x3f')](function(_0x2439bb){console[_0x85e5('0x40')](_0x2439bb);});}function main(){return server[_0x85e5('0x41')](realtime,preview,fax)[_0x85e5('0x19')](function(_0x3bcb82){return initRealtime();})[_0x85e5('0x19')](function(){return initParams();})[_0x85e5('0x19')](function(){report[_0x85e5('0x42')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x146369){console[_0x85e5('0x40')](_0x146369);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index c8752f8..a94217e 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 _0x9af1=['toNumber','format','accountcode','status','voiceStatusTime','stringify','user:%s','emit','user:save','exports','lodash','util','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','fullname','state','address','mobile','interface','online','unknown','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','voiceStatus','statePause'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9af1,0x1d8));var _0x19af=function(_0x5c43bf,_0xfcc422){_0x5c43bf=_0x5c43bf-0x0;var _0x1cba67=_0x9af1[_0x5c43bf];return _0x1cba67;};'use strict';var _=require(_0x19af('0x0'));var util=require(_0x19af('0x1'));var moment=require(_0x19af('0x2'));var md5=require(_0x19af('0x3'));var Redis=require(_0x19af('0x4'));var config=require(_0x19af('0x5'));config[_0x19af('0x6')]=_[_0x19af('0x7')](config[_0x19af('0x6')],{'host':_0x19af('0x8'),'port':0x18eb});var io=require(_0x19af('0x9'))(new Redis(config['redis']));function Agent(_0xd685dc){this['id']=_0xd685dc['id']||0x0;this[_0x19af('0xa')]=_0xd685dc['name']||'';this[_0x19af('0xb')]=_0xd685dc['email']||'';this['accountcode']=_0xd685dc['accountcode']||'';this[_0x19af('0xc')]=_0xd685dc[_0x19af('0xc')]||'';this[_0x19af('0xd')]='unknown';this['stateTime']=0x0;this['status']='unknown';this[_0x19af('0xe')]='';this['phone']='';this[_0x19af('0xf')]='';this[_0x19af('0x10')]='';this[_0x19af('0x11')]=_0xd685dc['online']||![];this['voiceStatus']=_0x19af('0x12');this['voiceStatusTime']=0x0;this[_0x19af('0x13')]='';this[_0x19af('0x14')]='';this[_0x19af('0x15')]=![];this[_0x19af('0x16')]=![];this[_0x19af('0x3')]='';}Agent[_0x19af('0x17')][_0x19af('0x18')]=function(_0x578096){var _0x13b9ae;if(_0x578096&&_0x578096[_0x19af('0xd')]){_0x13b9ae=_0x578096[_0x19af('0xd')][_0x19af('0x19')]();switch(_0x13b9ae){case _0x19af('0x1a'):_0x13b9ae=_0x19af('0x1b');break;case _0x19af('0x1c'):_0x13b9ae=_0x19af('0x1d');break;}}if(_0x13b9ae&&this[_0x19af('0x1e')]!==_0x13b9ae||_0x578096[_0x19af('0x1f')]){this['voiceStatusTime']=_[_0x19af('0x20')](moment()[_0x19af('0x21')]('x'));}if(_0x13b9ae){this['voiceStatus']=_0x13b9ae;}var _0x1df4df={'id':this['id'],'name':this[_0x19af('0xa')],'email':this[_0x19af('0xb')],'accountcode':this[_0x19af('0x22')],'fullname':this['fullname'],'state':this[_0x19af('0xd')],'stateTime':this['stateTime'],'status':this[_0x19af('0x23')],'address':this[_0x19af('0xe')],'online':this[_0x19af('0x11')],'voiceStatus':this[_0x19af('0x1e')],'voiceStatusTime':this[_0x19af('0x24')],'voiceStatusCallerIdNumber':this[_0x19af('0x13')],'voiceStatusQueue':this[_0x19af('0x14')],'interface':this[_0x19af('0x10')],'onhold':this[_0x19af('0x15')]};var _0x5c0c81=md5(JSON[_0x19af('0x25')](_0x1df4df));if(this[_0x19af('0x3')]!==_0x5c0c81){this[_0x19af('0x3')]=_0x5c0c81;io['to'](util[_0x19af('0x21')](_0x19af('0x26'),_0x1df4df[_0x19af('0xa')]))[_0x19af('0x27')](_0x19af('0x28'),_0x1df4df);}};module[_0x19af('0x29')]=Agent; \ No newline at end of file +var _0x5e35=['statePause','toNumber','format','voiceStatusCallerIdNumber','interface','stringify','user:%s','emit','user:save','util','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','status','address','phone','mobile','online','voiceStatus','voiceStatusTime','onhold','local','prototype','updateStatusRealtime','state','toLowerCase','not_inuse','inuse','talking'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x5e35,0x1e9));var _0x55e3=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x5e35[_0x88cd7b];return _0x56fcc8;};'use strict';var _=require('lodash');var util=require(_0x55e3('0x0'));var moment=require(_0x55e3('0x1'));var md5=require(_0x55e3('0x2'));var Redis=require(_0x55e3('0x3'));var config=require(_0x55e3('0x4'));config[_0x55e3('0x5')]=_[_0x55e3('0x6')](config[_0x55e3('0x5')],{'host':_0x55e3('0x7'),'port':0x18eb});var io=require(_0x55e3('0x8'))(new Redis(config[_0x55e3('0x5')]));function Agent(_0x3eeee6){this['id']=_0x3eeee6['id']||0x0;this['name']=_0x3eeee6[_0x55e3('0x9')]||'';this[_0x55e3('0xa')]=_0x3eeee6[_0x55e3('0xa')]||'';this[_0x55e3('0xb')]=_0x3eeee6[_0x55e3('0xb')]||'';this['fullname']=_0x3eeee6[_0x55e3('0xc')]||'';this['state']=_0x55e3('0xd');this[_0x55e3('0xe')]=0x0;this[_0x55e3('0xf')]=_0x55e3('0xd');this[_0x55e3('0x10')]='';this[_0x55e3('0x11')]='';this[_0x55e3('0x12')]='';this['interface']='';this[_0x55e3('0x13')]=_0x3eeee6[_0x55e3('0x13')]||![];this[_0x55e3('0x14')]=_0x55e3('0xd');this[_0x55e3('0x15')]=0x0;this['voiceStatusCallerIdNumber']='';this['voiceStatusQueue']='';this[_0x55e3('0x16')]=![];this[_0x55e3('0x17')]=![];this[_0x55e3('0x2')]='';}Agent[_0x55e3('0x18')][_0x55e3('0x19')]=function(_0x5cb9ac){var _0x2a63e2;if(_0x5cb9ac&&_0x5cb9ac[_0x55e3('0x1a')]){_0x2a63e2=_0x5cb9ac[_0x55e3('0x1a')][_0x55e3('0x1b')]();switch(_0x2a63e2){case _0x55e3('0x1c'):_0x2a63e2='idle';break;case _0x55e3('0x1d'):_0x2a63e2=_0x55e3('0x1e');break;}}if(_0x2a63e2&&this[_0x55e3('0x14')]!==_0x2a63e2||_0x5cb9ac[_0x55e3('0x1f')]){this[_0x55e3('0x15')]=_[_0x55e3('0x20')](moment()[_0x55e3('0x21')]('x'));}if(_0x2a63e2){this['voiceStatus']=_0x2a63e2;}var _0x1f1d48={'id':this['id'],'name':this['name'],'email':this[_0x55e3('0xa')],'accountcode':this[_0x55e3('0xb')],'fullname':this['fullname'],'state':this[_0x55e3('0x1a')],'stateTime':this['stateTime'],'status':this[_0x55e3('0xf')],'address':this[_0x55e3('0x10')],'online':this['online'],'voiceStatus':this[_0x55e3('0x14')],'voiceStatusTime':this[_0x55e3('0x15')],'voiceStatusCallerIdNumber':this[_0x55e3('0x22')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x55e3('0x23')],'onhold':this[_0x55e3('0x16')]};var _0xabe917=md5(JSON[_0x55e3('0x24')](_0x1f1d48));if(this[_0x55e3('0x2')]!==_0xabe917){this[_0x55e3('0x2')]=_0xabe917;io['to'](util[_0x55e3('0x21')](_0x55e3('0x25'),_0x1f1d48[_0x55e3('0x9')]))[_0x55e3('0x26')](_0x55e3('0x27'),_0x1f1d48);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 07139ea..bf36e83 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 _0x2032=['ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','originated','ivrAnswerCallsDay'];(function(_0x458b9d,_0x4982f1){var _0x2842b5=function(_0x5b19f3){while(--_0x5b19f3){_0x458b9d['push'](_0x458b9d['shift']());}};_0x2842b5(++_0x4982f1);}(_0x2032,0xd9));var _0x2203=function(_0x10e91b,_0x437f6){_0x10e91b=_0x10e91b-0x0;var _0x18744c=_0x2032[_0x10e91b];return _0x18744c;};'use strict';function Campaign(_0x4d6c97){this['id']=_0x4d6c97['id']||0x0;this[_0x2203('0x0')]=_0x4d6c97[_0x2203('0x0')]||'';this[_0x2203('0x1')]=_0x4d6c97['type']||_0x2203('0x2');this[_0x2203('0x3')]=0x0;this['temp']=0x0;this[_0x2203('0x4')]=0x0;this[_0x2203('0x5')]=0x0;this[_0x2203('0x6')]='';this[_0x2203('0x7')]=!![];this[_0x2203('0x8')]=_0x4d6c97[_0x2203('0x8')];this[_0x2203('0x9')]=_0x4d6c97[_0x2203('0x9')];this[_0x2203('0xa')]=_0x4d6c97[_0x2203('0xa')]||null;this[_0x2203('0xb')]=_0x4d6c97['dialGlobalInterval']?_0x4d6c97['dialGlobalInterval']:null;this[_0x2203('0xc')]=_0x4d6c97['dialOriginateCallerIdName'];this[_0x2203('0xd')]=_0x4d6c97[_0x2203('0xd')];this[_0x2203('0xe')]=_0x4d6c97['dialOriginateTimeout']||0x1e;this[_0x2203('0xf')]=_0x4d6c97['dialCongestionMaxRetry'];this[_0x2203('0x10')]=_0x4d6c97['dialCongestionRetryFrequency'];this[_0x2203('0x11')]=_0x4d6c97[_0x2203('0x11')];this['dialBusyRetryFrequency']=_0x4d6c97['dialBusyRetryFrequency'];this['dialNoAnswerMaxRetry']=_0x4d6c97['dialNoAnswerMaxRetry'];this['dialNoAnswerRetryFrequency']=_0x4d6c97[_0x2203('0x12')];this['dialGlobalMaxRetry']=_0x4d6c97['dialGlobalMaxRetry'];this[_0x2203('0x13')]=_0x4d6c97[_0x2203('0x13')]||_0x2203('0x14');this[_0x2203('0x15')]=_0x4d6c97[_0x2203('0x15')]||undefined;this[_0x2203('0x16')]=_0x4d6c97[_0x2203('0x16')]||undefined;this[_0x2203('0x17')]=_0x4d6c97[_0x2203('0x17')]||undefined;this[_0x2203('0x18')]=_0x4d6c97['TrunkBackup']?_0x4d6c97[_0x2203('0x18')]:undefined;this[_0x2203('0x19')]=_0x4d6c97['Trunk']?_0x4d6c97[_0x2203('0x19')]:undefined;this[_0x2203('0x1a')]=_0x4d6c97['Interval']?_0x4d6c97[_0x2203('0x1a')]:undefined;this['SquareProject']=_0x4d6c97[_0x2203('0x1b')]?_0x4d6c97[_0x2203('0x1b')]:undefined;this[_0x2203('0x1c')]=_0x4d6c97[_0x2203('0x1b')]?_0x4d6c97[_0x2203('0x1b')][_0x2203('0x0')]:undefined;this['dialAMDActive']=_0x4d6c97[_0x2203('0x1d')]||![];this['dialAMDInitialSilence']=_0x4d6c97['dialAMDInitialSilence'];this[_0x2203('0x1e')]=_0x4d6c97['dialAMDGreeting'];this[_0x2203('0x1f')]=_0x4d6c97[_0x2203('0x1f')];this['dialAMDTotalAnalysisTime']=_0x4d6c97[_0x2203('0x20')];this['dialAMDMinWordLength']=_0x4d6c97['dialAMDMinWordLength'];this[_0x2203('0x21')]=_0x4d6c97[_0x2203('0x21')];this[_0x2203('0x22')]=_0x4d6c97[_0x2203('0x22')];this[_0x2203('0x23')]=_0x4d6c97[_0x2203('0x23')];this[_0x2203('0x24')]=_0x4d6c97[_0x2203('0x24')];}module['exports']=Campaign; \ No newline at end of file +var _0xd8b0=['dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency'];(function(_0x5caf7e,_0x52e1bc){var _0x5c3435=function(_0xb77e11){while(--_0xb77e11){_0x5caf7e['push'](_0x5caf7e['shift']());}};_0x5c3435(++_0x52e1bc);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';function Campaign(_0x5d04de){this['id']=_0x5d04de['id']||0x0;this[_0x0d8b('0x0')]=_0x5d04de['name']||'';this['type']=_0x5d04de['type']||_0x0d8b('0x1');this[_0x0d8b('0x2')]=0x0;this[_0x0d8b('0x3')]=0x0;this[_0x0d8b('0x4')]=0x0;this[_0x0d8b('0x5')]=0x0;this['message']='';this['sendMessageOneNotActive']=!![];this[_0x0d8b('0x6')]=_0x5d04de[_0x0d8b('0x6')];this[_0x0d8b('0x7')]=_0x5d04de['limitCalls'];this[_0x0d8b('0x8')]=_0x5d04de[_0x0d8b('0x8')]||null;this['dialGlobalInterval']=_0x5d04de[_0x0d8b('0x9')]?_0x5d04de[_0x0d8b('0x9')]:null;this[_0x0d8b('0xa')]=_0x5d04de[_0x0d8b('0xa')];this[_0x0d8b('0xb')]=_0x5d04de[_0x0d8b('0xb')];this[_0x0d8b('0xc')]=_0x5d04de[_0x0d8b('0xc')]||0x1e;this['dialCongestionMaxRetry']=_0x5d04de[_0x0d8b('0xd')];this['dialCongestionRetryFrequency']=_0x5d04de[_0x0d8b('0xe')];this[_0x0d8b('0xf')]=_0x5d04de[_0x0d8b('0xf')];this[_0x0d8b('0x10')]=_0x5d04de[_0x0d8b('0x10')];this[_0x0d8b('0x11')]=_0x5d04de[_0x0d8b('0x11')];this[_0x0d8b('0x12')]=_0x5d04de[_0x0d8b('0x12')];this[_0x0d8b('0x13')]=_0x5d04de[_0x0d8b('0x13')];this[_0x0d8b('0x14')]=_0x5d04de[_0x0d8b('0x14')]||_0x0d8b('0x15');this['dialPrefix']=_0x5d04de[_0x0d8b('0x16')]||undefined;this[_0x0d8b('0x17')]=_0x5d04de[_0x0d8b('0x17')]||undefined;this[_0x0d8b('0x18')]=_0x5d04de[_0x0d8b('0x18')]||undefined;this['TrunkBackup']=_0x5d04de[_0x0d8b('0x19')]?_0x5d04de[_0x0d8b('0x19')]:undefined;this[_0x0d8b('0x1a')]=_0x5d04de[_0x0d8b('0x1a')]?_0x5d04de[_0x0d8b('0x1a')]:undefined;this[_0x0d8b('0x1b')]=_0x5d04de[_0x0d8b('0x1b')]?_0x5d04de[_0x0d8b('0x1b')]:undefined;this['SquareProject']=_0x5d04de[_0x0d8b('0x1c')]?_0x5d04de[_0x0d8b('0x1c')]:undefined;this[_0x0d8b('0x1d')]=_0x5d04de[_0x0d8b('0x1c')]?_0x5d04de[_0x0d8b('0x1c')][_0x0d8b('0x0')]:undefined;this[_0x0d8b('0x1e')]=_0x5d04de[_0x0d8b('0x1e')]||![];this['dialAMDInitialSilence']=_0x5d04de['dialAMDInitialSilence'];this[_0x0d8b('0x1f')]=_0x5d04de['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x5d04de['dialAMDAfterGreetingSilence'];this[_0x0d8b('0x20')]=_0x5d04de[_0x0d8b('0x20')];this[_0x0d8b('0x21')]=_0x5d04de[_0x0d8b('0x21')];this[_0x0d8b('0x22')]=_0x5d04de[_0x0d8b('0x22')];this[_0x0d8b('0x23')]=_0x5d04de[_0x0d8b('0x23')];this[_0x0d8b('0x24')]=_0x5d04de['dialAMDSilenceThreshold'];this[_0x0d8b('0x25')]=_0x5d04de[_0x0d8b('0x25')];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index dd34330..785118c 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 _0x6f75=['disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','context','uniqueid','linkedid','endtime','unmanaged','lastapplication','billableseconds','holdtime','type','tag'];(function(_0x10c4f9,_0x100fb4){var _0x522b09=function(_0x3325e4){while(--_0x3325e4){_0x10c4f9['push'](_0x10c4f9['shift']());}};_0x522b09(++_0x100fb4);}(_0x6f75,0x71));var _0x56f7=function(_0x26d42b,_0x58bdd6){_0x26d42b=_0x26d42b-0x0;var _0x54c088=_0x6f75[_0x26d42b];return _0x54c088;};'use strict';function Channel(){this[_0x56f7('0x0')]=null;this[_0x56f7('0x1')]='';this[_0x56f7('0x2')]='';this[_0x56f7('0x3')]=0x0;this[_0x56f7('0x4')]='';this[_0x56f7('0x5')]=undefined;this[_0x56f7('0x6')]=undefined;this['accountcode']=0x0;this[_0x56f7('0x7')]='';this[_0x56f7('0x8')]=0x0;this[_0x56f7('0x9')]=0x0;this['exten']=0x0;this['answered']=![];this['answertime']=null;this[_0x56f7('0xa')]=null;this[_0x56f7('0xb')]=![];this['abandoned']=![];this[_0x56f7('0xc')]='';this['lastdata']='';this['duration']=0x0;this[_0x56f7('0xd')]=0x0;this[_0x56f7('0xe')]=0x0;this[_0x56f7('0xf')]=null;this[_0x56f7('0x10')]=null;this[_0x56f7('0x11')]=null;this[_0x56f7('0x12')]=![];this[_0x56f7('0x13')]=null;this[_0x56f7('0x14')]=null;this[_0x56f7('0x15')]=[];this[_0x56f7('0x16')]=undefined;this[_0x56f7('0x17')]=undefined;this[_0x56f7('0x18')]=0x0;}module[_0x56f7('0x19')]=Channel; \ No newline at end of file +var _0x3e2a=['accountcode','context','linkedid','answered','answertime','endtime','unmanaged','abandoned','lastdata','duration','holdtime','type','monitorFilename','queue','monitors','transferconnectedlinenum','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename'];(function(_0x28448b,_0x452375){var _0x4e86d8=function(_0x386bdc){while(--_0x386bdc){_0x28448b['push'](_0x28448b['shift']());}};_0x4e86d8(++_0x452375);}(_0x3e2a,0x10c));var _0xa3e2=function(_0x299b84,_0x5c2a71){_0x299b84=_0x299b84-0x0;var _0x1983d2=_0x3e2a[_0x299b84];return _0x1983d2;};'use strict';function Channel(){this[_0xa3e2('0x0')]=null;this[_0xa3e2('0x1')]='';this[_0xa3e2('0x2')]='';this[_0xa3e2('0x3')]=0x0;this[_0xa3e2('0x4')]='';this[_0xa3e2('0x5')]=undefined;this[_0xa3e2('0x6')]=undefined;this[_0xa3e2('0x7')]=0x0;this[_0xa3e2('0x8')]='';this['uniqueid']=0x0;this[_0xa3e2('0x9')]=0x0;this['exten']=0x0;this[_0xa3e2('0xa')]=![];this[_0xa3e2('0xb')]=null;this[_0xa3e2('0xc')]=null;this[_0xa3e2('0xd')]=![];this[_0xa3e2('0xe')]=![];this['lastapplication']='';this[_0xa3e2('0xf')]='';this[_0xa3e2('0x10')]=0x0;this['billableseconds']=0x0;this[_0xa3e2('0x11')]=0x0;this[_0xa3e2('0x12')]=null;this['tag']=null;this['disposition']=null;this['monitor']=![];this[_0xa3e2('0x13')]=null;this[_0xa3e2('0x14')]=null;this[_0xa3e2('0x15')]=[];this['transfercalleridnum']=undefined;this[_0xa3e2('0x16')]=undefined;this[_0xa3e2('0x17')]=0x0;}module[_0xa3e2('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 9c872b2..26d9c34 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 _0x6c7b=['type','serverUrl','Configurations','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret'];(function(_0x3711d9,_0x1b36b6){var _0x395e6d=function(_0x299170){while(--_0x299170){_0x3711d9['push'](_0x3711d9['shift']());}};_0x395e6d(++_0x1b36b6);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x46e44f,_0x483584){_0x46e44f=_0x46e44f-0x0;var _0x267af1=_0x6c7b[_0x46e44f];return _0x267af1;};'use strict';function DeskAccount(_0x44a00a){this['id']=_0x44a00a['id']||0x0;this['name']=_0x44a00a['name']||'';this['username']=_0x44a00a[_0xb6c7('0x0')]||'';this['remoteUri']=_0x44a00a[_0xb6c7('0x1')]||'';this[_0xb6c7('0x2')]=_0x44a00a[_0xb6c7('0x2')]||'';this['password']=_0x44a00a[_0xb6c7('0x3')]||'';this[_0xb6c7('0x4')]=_0x44a00a[_0xb6c7('0x4')]||'';this[_0xb6c7('0x5')]=_0x44a00a[_0xb6c7('0x5')]||'';this['token']=_0x44a00a[_0xb6c7('0x6')]||'';this[_0xb6c7('0x7')]=_0x44a00a[_0xb6c7('0x7')]||'';this[_0xb6c7('0x8')]=_0x44a00a[_0xb6c7('0x8')]||'';this[_0xb6c7('0x9')]=_0x44a00a[_0xb6c7('0x9')]||'';this[_0xb6c7('0xa')]=_0x44a00a['Configurations']||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0x3d6d=['type','serverUrl','exports','name','username','remoteUri','authType','password','consumerSecret','token','tokenSecret'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x3d6d,0xb3));var _0xd3d6=function(_0x296144,_0x26bbbf){_0x296144=_0x296144-0x0;var _0x5329b1=_0x3d6d[_0x296144];return _0x5329b1;};'use strict';function DeskAccount(_0x249683){this['id']=_0x249683['id']||0x0;this[_0xd3d6('0x0')]=_0x249683[_0xd3d6('0x0')]||'';this[_0xd3d6('0x1')]=_0x249683[_0xd3d6('0x1')]||'';this[_0xd3d6('0x2')]=_0x249683[_0xd3d6('0x2')]||'';this[_0xd3d6('0x3')]=_0x249683[_0xd3d6('0x3')]||'';this[_0xd3d6('0x4')]=_0x249683[_0xd3d6('0x4')]||'';this['consumerKey']=_0x249683['consumerKey']||'';this[_0xd3d6('0x5')]=_0x249683[_0xd3d6('0x5')]||'';this[_0xd3d6('0x6')]=_0x249683[_0xd3d6('0x6')]||'';this[_0xd3d6('0x7')]=_0x249683['tokenSecret']||'';this[_0xd3d6('0x8')]=_0x249683[_0xd3d6('0x8')]||'';this[_0xd3d6('0x9')]=_0x249683[_0xd3d6('0x9')]||'';this['Configurations']=_0x249683['Configurations']||{};}module[_0xd3d6('0xa')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index f14676b..35480cb 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 _0xfc73=['serverUrl','Configurations','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x5a1cc9,_0x28f54d){var _0x471761=function(_0xda51c0){while(--_0xda51c0){_0x5a1cc9['push'](_0x5a1cc9['shift']());}};_0x471761(++_0x28f54d);}(_0xfc73,0x1d9));var _0x3fc7=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xfc73[_0x4a9fb1];return _0x348672;};'use strict';function Dynamics365Account(_0x4d3c80){this['id']=_0x4d3c80['id']||0x0;this['name']=_0x4d3c80[_0x3fc7('0x0')]||'';this['username']=_0x4d3c80[_0x3fc7('0x1')]||'';this[_0x3fc7('0x2')]=_0x4d3c80[_0x3fc7('0x2')]||'';this[_0x3fc7('0x3')]=_0x4d3c80[_0x3fc7('0x3')]||'';this[_0x3fc7('0x4')]=_0x4d3c80[_0x3fc7('0x4')]||'';this['clientId']=_0x4d3c80[_0x3fc7('0x5')]||'';this[_0x3fc7('0x6')]=_0x4d3c80[_0x3fc7('0x6')]||{};this[_0x3fc7('0x7')]=_0x4d3c80[_0x3fc7('0x7')]||'';this[_0x3fc7('0x8')]=_0x4d3c80[_0x3fc7('0x8')]||{};}module[_0x3fc7('0x9')]=Dynamics365Account; \ No newline at end of file +var _0x80d3=['tenantId','clientId','clientSecret','serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x289e64,_0x5adb3c){var _0x30246c=function(_0x1bf7f6){while(--_0x1bf7f6){_0x289e64['push'](_0x289e64['shift']());}};_0x30246c(++_0x5adb3c);}(_0x80d3,0xf6));var _0x380d=function(_0x317239,_0x4e9c7f){_0x317239=_0x317239-0x0;var _0x41643f=_0x80d3[_0x317239];return _0x41643f;};'use strict';function Dynamics365Account(_0x3f410a){this['id']=_0x3f410a['id']||0x0;this[_0x380d('0x0')]=_0x3f410a['name']||'';this[_0x380d('0x1')]=_0x3f410a[_0x380d('0x1')]||'';this[_0x380d('0x2')]=_0x3f410a[_0x380d('0x2')]||'';this[_0x380d('0x3')]=_0x3f410a[_0x380d('0x3')]||'';this[_0x380d('0x4')]=_0x3f410a[_0x380d('0x4')]||'';this[_0x380d('0x5')]=_0x3f410a[_0x380d('0x5')]||'';this[_0x380d('0x6')]=_0x3f410a[_0x380d('0x6')]||{};this['serverUrl']=_0x3f410a[_0x380d('0x7')]||'';this[_0x380d('0x8')]=_0x3f410a[_0x380d('0x8')]||{};}module[_0x380d('0x9')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 2c3c85d..6d5a7b0 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 _0x529d=['headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm'];(function(_0x181c4,_0x2c89ac){var _0xfcae1a=function(_0x5a339e){while(--_0x5a339e){_0x181c4['push'](_0x181c4['shift']());}};_0xfcae1a(++_0x2c89ac);}(_0x529d,0x177));var _0xd529=function(_0x4ef483,_0x87ad36){_0x4ef483=_0x4ef483-0x0;var _0x1e334b=_0x529d[_0x4ef483];return _0x1e334b;};'use strict';function FaxAccount(_0x211e80){this['id']=_0x211e80['id']||0x0;this[_0xd529('0x0')]=_0x211e80['name']||'';this[_0xd529('0x1')]=_0x211e80[_0xd529('0x1')];this[_0xd529('0x2')]=_0x211e80[_0xd529('0x2')];this[_0xd529('0x3')]=_0x211e80[_0xd529('0x3')];this['localstationid']=_0x211e80[_0xd529('0x4')];this[_0xd529('0x5')]=_0x211e80[_0xd529('0x5')]||0x960;this['maxrate']=_0x211e80[_0xd529('0x6')]||0x3840;this[_0xd529('0x7')]=_0x211e80[_0xd529('0x7')]||_0xd529('0x8');this[_0xd529('0x9')]=_0x211e80[_0xd529('0x9')]||'no';this[_0xd529('0xa')]=_0x211e80[_0xd529('0xa')]||'no';this[_0xd529('0xb')]=_0x211e80[_0xd529('0xb')]||0x1388;this[_0xd529('0xc')]=_0x211e80['tech']||_0xd529('0xd');this[_0xd529('0xe')]=_0x211e80[_0xd529('0xe')]?_0x211e80[_0xd529('0xe')]:undefined;this[_0xd529('0xf')]=_0x211e80[_0xd529('0xf')];this[_0xd529('0x10')]=_0x211e80[_0xd529('0x10')];}module[_0xd529('0x11')]=FaxAccount; \ No newline at end of file +var _0x7d62=['faxdetect','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','maxrate','modem','v17,v27,v29','gateway'];(function(_0x56bc73,_0x43cfc6){var _0x4cd9b7=function(_0x2d6c65){while(--_0x2d6c65){_0x56bc73['push'](_0x56bc73['shift']());}};_0x4cd9b7(++_0x43cfc6);}(_0x7d62,0x123));var _0x27d6=function(_0x22b028,_0x5e2090){_0x22b028=_0x22b028-0x0;var _0x128ebd=_0x7d62[_0x22b028];return _0x128ebd;};'use strict';function FaxAccount(_0x3548e4){this['id']=_0x3548e4['id']||0x0;this[_0x27d6('0x0')]=_0x3548e4[_0x27d6('0x0')]||'';this[_0x27d6('0x1')]=_0x3548e4['description'];this['ecm']=_0x3548e4[_0x27d6('0x2')];this[_0x27d6('0x3')]=_0x3548e4[_0x27d6('0x3')];this['localstationid']=_0x3548e4[_0x27d6('0x4')];this['minrate']=_0x3548e4['minrate']||0x960;this[_0x27d6('0x5')]=_0x3548e4[_0x27d6('0x5')]||0x3840;this[_0x27d6('0x6')]=_0x3548e4[_0x27d6('0x6')]||_0x27d6('0x7');this[_0x27d6('0x8')]=_0x3548e4[_0x27d6('0x8')]||'no';this[_0x27d6('0x9')]=_0x3548e4[_0x27d6('0x9')]||'no';this['t38timeout']=_0x3548e4['t38timeout']||0x1388;this['tech']=_0x3548e4['tech']||_0x27d6('0xa');this[_0x27d6('0xb')]=_0x3548e4[_0x27d6('0xb')]?_0x3548e4[_0x27d6('0xb')]:undefined;this['ListId']=_0x3548e4[_0x27d6('0xc')];this[_0x27d6('0xd')]=_0x3548e4[_0x27d6('0xd')];}module[_0x27d6('0xe')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 844a4a7..e4a1d65 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 _0x941d=['username','apiKey','token','serverUrl','Configurations','exports','name'];(function(_0x57bfb7,_0x4af626){var _0x147a93=function(_0x124b35){while(--_0x124b35){_0x57bfb7['push'](_0x57bfb7['shift']());}};_0x147a93(++_0x4af626);}(_0x941d,0x1b8));var _0xd941=function(_0x256c49,_0x53f00a){_0x256c49=_0x256c49-0x0;var _0x280282=_0x941d[_0x256c49];return _0x280282;};'use strict';function FreshdeskAccount(_0x9c41d5){this['id']=_0x9c41d5['id']||0x0;this[_0xd941('0x0')]=_0x9c41d5[_0xd941('0x0')]||'';this[_0xd941('0x1')]=_0x9c41d5[_0xd941('0x1')]||'';this[_0xd941('0x2')]=_0x9c41d5[_0xd941('0x3')]||'';this['remoteUri']=_0x9c41d5['remoteUri']||'';this[_0xd941('0x4')]=_0x9c41d5[_0xd941('0x4')]||'';this['Configurations']=_0x9c41d5[_0xd941('0x5')]||{};}module[_0xd941('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0xb824=['exports','name','username','token','remoteUri','serverUrl','Configurations'];(function(_0x3fbebd,_0xd765b5){var _0x4aba4f=function(_0xe8a147){while(--_0xe8a147){_0x3fbebd['push'](_0x3fbebd['shift']());}};_0x4aba4f(++_0xd765b5);}(_0xb824,0xe1));var _0x4b82=function(_0x473c76,_0x54219e){_0x473c76=_0x473c76-0x0;var _0x318c90=_0xb824[_0x473c76];return _0x318c90;};'use strict';function FreshdeskAccount(_0x5bc226){this['id']=_0x5bc226['id']||0x0;this[_0x4b82('0x0')]=_0x5bc226['name']||'';this[_0x4b82('0x1')]=_0x5bc226[_0x4b82('0x1')]||'';this['apiKey']=_0x5bc226[_0x4b82('0x2')]||'';this[_0x4b82('0x3')]=_0x5bc226[_0x4b82('0x3')]||'';this['serverUrl']=_0x5bc226[_0x4b82('0x4')]||'';this[_0x4b82('0x5')]=_0x5bc226['Configurations']||{};}module[_0x4b82('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 6984877..b1330fd 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 _0xc6c4=['name','username','apiKey','remoteUri','Configurations','exports'];(function(_0x151c38,_0x3d5723){var _0x18a987=function(_0x32eb6a){while(--_0x32eb6a){_0x151c38['push'](_0x151c38['shift']());}};_0x18a987(++_0x3d5723);}(_0xc6c4,0x126));var _0x4c6c=function(_0xd5f1d3,_0x1f8db3){_0xd5f1d3=_0xd5f1d3-0x0;var _0xfbe719=_0xc6c4[_0xd5f1d3];return _0xfbe719;};'use strict';function FreshsalesAccount(_0x4080cc){this['id']=_0x4080cc['id']||0x0;this[_0x4c6c('0x0')]=_0x4080cc[_0x4c6c('0x0')]||'';this[_0x4c6c('0x1')]=_0x4080cc['username']||'';this[_0x4c6c('0x2')]=_0x4080cc['token']||'';this[_0x4c6c('0x3')]=_0x4080cc[_0x4c6c('0x3')]||'';this['serverUrl']=_0x4080cc['serverUrl']||'';this[_0x4c6c('0x4')]=_0x4080cc[_0x4c6c('0x4')]||{};}module[_0x4c6c('0x5')]=FreshsalesAccount; \ No newline at end of file +var _0x61fa=['exports','name','username','token','remoteUri','serverUrl','Configurations'];(function(_0x485599,_0x3bf1b9){var _0x2c491b=function(_0xd574f8){while(--_0xd574f8){_0x485599['push'](_0x485599['shift']());}};_0x2c491b(++_0x3bf1b9);}(_0x61fa,0x1ba));var _0xa61f=function(_0x1b338e,_0x25ac31){_0x1b338e=_0x1b338e-0x0;var _0x3ae2f4=_0x61fa[_0x1b338e];return _0x3ae2f4;};'use strict';function FreshsalesAccount(_0x2ffff7){this['id']=_0x2ffff7['id']||0x0;this[_0xa61f('0x0')]=_0x2ffff7['name']||'';this[_0xa61f('0x1')]=_0x2ffff7['username']||'';this['apiKey']=_0x2ffff7[_0xa61f('0x2')]||'';this[_0xa61f('0x3')]=_0x2ffff7[_0xa61f('0x3')]||'';this[_0xa61f('0x4')]=_0x2ffff7[_0xa61f('0x4')]||'';this[_0xa61f('0x5')]=_0x2ffff7[_0xa61f('0x5')]||{};}module[_0xa61f('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 2de33ef..afe9c96 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 _0x54fb=['accountcode','context','exten','lastAssignedTo','variables','exports','type','inbound','calleridnum','queue','position','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename'];(function(_0x4b65fc,_0x194119){var _0x2263cf=function(_0x49c125){while(--_0x49c125){_0x4b65fc['push'](_0x4b65fc['shift']());}};_0x2263cf(++_0x194119);}(_0x54fb,0xe2));var _0xb54f=function(_0x59b4a9,_0xf4624d){_0x59b4a9=_0x59b4a9-0x0;var _0x471944=_0x54fb[_0x59b4a9];return _0x471944;};'use strict';function QueueReport(){this[_0xb54f('0x0')]=_0xb54f('0x1');this['uniqueid']='';this[_0xb54f('0x2')]='';this['calleridname']='';this[_0xb54f('0x3')]='';this['queuecallerjoinAt']=null;this['queuecallerleaveAt']=null;this[_0xb54f('0x4')]=0x1;this['count']=0x1;this[_0xb54f('0x5')]=![];this[_0xb54f('0x6')]=null;this[_0xb54f('0x7')]=![];this[_0xb54f('0x8')]=null;this['queuecallerexit']=![];this[_0xb54f('0x9')]=null;this[_0xb54f('0xa')]=0x1;this[_0xb54f('0xb')]='';this[_0xb54f('0xc')]='';this[_0xb54f('0xd')]='';this[_0xb54f('0xe')]='';this[_0xb54f('0xf')]='';this[_0xb54f('0x10')]='';this['priority']='';this['holdtime']=0x0;this['assigned']=![];this[_0xb54f('0x11')]='';this['mohtime']=0x0;this[_0xb54f('0x12')]={};}module[_0xb54f('0x13')]=QueueReport; \ No newline at end of file +var _0xa5ad=['queuecallercomplete','queuecallerexitAt','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','exports','calleridname','queue','queuecallerjoinAt','position','count','queuecallerabandon','queuecallerabandonAt'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa5ad,0xe9));var _0xda5a=function(_0x1b713c,_0xf7c95c){_0x1b713c=_0x1b713c-0x0;var _0x316fcd=_0xa5ad[_0x1b713c];return _0x316fcd;};'use strict';function QueueReport(){this['type']='inbound';this['uniqueid']='';this['calleridnum']='';this[_0xda5a('0x0')]='';this[_0xda5a('0x1')]='';this[_0xda5a('0x2')]=null;this['queuecallerleaveAt']=null;this[_0xda5a('0x3')]=0x1;this[_0xda5a('0x4')]=0x1;this[_0xda5a('0x5')]=![];this[_0xda5a('0x6')]=null;this[_0xda5a('0x7')]=![];this['queuecallercompleteAt']=null;this['queuecallerexit']=![];this[_0xda5a('0x8')]=null;this['originalposition']=0x1;this[_0xda5a('0x9')]='';this[_0xda5a('0xa')]='';this[_0xda5a('0xb')]='';this[_0xda5a('0xc')]='';this[_0xda5a('0xd')]='';this[_0xda5a('0xe')]='';this[_0xda5a('0xf')]='';this[_0xda5a('0x10')]=0x0;this[_0xda5a('0x11')]=![];this[_0xda5a('0x12')]='';this['mohtime']=0x0;this['variables']={};}module[_0xda5a('0x13')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 369010b..1278cc8 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 _0x8669=['clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId'];(function(_0x70fd53,_0x2a95a6){var _0x4b71c5=function(_0x4b349d){while(--_0x4b349d){_0x70fd53['push'](_0x70fd53['shift']());}};_0x4b71c5(++_0x2a95a6);}(_0x8669,0x16f));var _0x9866=function(_0x2fd288,_0x27dc31){_0x2fd288=_0x2fd288-0x0;var _0x1be7a9=_0x8669[_0x2fd288];return _0x1be7a9;};'use strict';function SalesforceAccount(_0x5b5514){this['id']=_0x5b5514['id']||0x0;this['name']=_0x5b5514[_0x9866('0x0')]||'';this[_0x9866('0x1')]=_0x5b5514[_0x9866('0x1')]||'';this[_0x9866('0x2')]=_0x5b5514[_0x9866('0x2')]||'';this[_0x9866('0x3')]=_0x5b5514[_0x9866('0x3')]||'';this['clientId']=_0x5b5514[_0x9866('0x4')]||'';this[_0x9866('0x5')]=_0x5b5514[_0x9866('0x5')]||'';this[_0x9866('0x6')]=_0x5b5514[_0x9866('0x6')]||'';this[_0x9866('0x7')]=_0x5b5514['type']||_0x9866('0x8');this['serverUrl']=_0x5b5514[_0x9866('0x9')]||'';this['Configurations']=_0x5b5514[_0x9866('0xa')]||{};}module[_0x9866('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x80b6=['exports','name','username','remoteUri','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations'];(function(_0x56bd4b,_0x46fa99){var _0x2db689=function(_0x4d7af8){while(--_0x4d7af8){_0x56bd4b['push'](_0x56bd4b['shift']());}};_0x2db689(++_0x46fa99);}(_0x80b6,0xe8));var _0x680b=function(_0x3a0250,_0x1ce4f1){_0x3a0250=_0x3a0250-0x0;var _0x275671=_0x80b6[_0x3a0250];return _0x275671;};'use strict';function SalesforceAccount(_0x152147){this['id']=_0x152147['id']||0x0;this[_0x680b('0x0')]=_0x152147[_0x680b('0x0')]||'';this[_0x680b('0x1')]=_0x152147[_0x680b('0x1')]||'';this['remoteUri']=_0x152147[_0x680b('0x2')]||'';this['password']=_0x152147['password']||'';this[_0x680b('0x3')]=_0x152147[_0x680b('0x3')]||'';this[_0x680b('0x4')]=_0x152147[_0x680b('0x4')]||'';this[_0x680b('0x5')]=_0x152147['securityToken']||'';this['type']=_0x152147[_0x680b('0x6')]||_0x680b('0x7');this['serverUrl']=_0x152147[_0x680b('0x8')]||'';this['Configurations']=_0x152147[_0x680b('0x9')]||{};}module[_0x680b('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 72b0820..ad977a0 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 _0xdf57=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x29d9ae,_0x1c7bcc){var _0x4c48d1=function(_0x501f5e){while(--_0x501f5e){_0x29d9ae['push'](_0x29d9ae['shift']());}};_0x4c48d1(++_0x1c7bcc);}(_0xdf57,0xc1));var _0x7df5=function(_0x2ace72,_0x814809){_0x2ace72=_0x2ace72-0x0;var _0x33d102=_0xdf57[_0x2ace72];return _0x33d102;};'use strict';function ServicenowAccount(_0x3a58ed){this['id']=_0x3a58ed['id']||0x0;this['name']=_0x3a58ed[_0x7df5('0x0')]||'';this[_0x7df5('0x1')]=_0x3a58ed['username']||'';this[_0x7df5('0x2')]=_0x3a58ed['password']||'';this[_0x7df5('0x3')]=_0x3a58ed[_0x7df5('0x3')]||'';this[_0x7df5('0x4')]=_0x3a58ed[_0x7df5('0x4')]||'';this[_0x7df5('0x5')]=_0x3a58ed[_0x7df5('0x5')]||{};}module[_0x7df5('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xee70=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x43b6ba,_0x38616c){var _0x308895=function(_0x5a385b){while(--_0x5a385b){_0x43b6ba['push'](_0x43b6ba['shift']());}};_0x308895(++_0x38616c);}(_0xee70,0xc1));var _0x0ee7=function(_0x2a6b4b,_0x3d063e){_0x2a6b4b=_0x2a6b4b-0x0;var _0x47c88a=_0xee70[_0x2a6b4b];return _0x47c88a;};'use strict';function ServicenowAccount(_0x1c35ba){this['id']=_0x1c35ba['id']||0x0;this['name']=_0x1c35ba[_0x0ee7('0x0')]||'';this[_0x0ee7('0x1')]=_0x1c35ba[_0x0ee7('0x1')]||'';this[_0x0ee7('0x2')]=_0x1c35ba['password']||'';this[_0x0ee7('0x3')]=_0x1c35ba['remoteUri']||'';this[_0x0ee7('0x4')]=_0x1c35ba[_0x0ee7('0x4')]||'';this[_0x0ee7('0x5')]=_0x1c35ba[_0x0ee7('0x5')]||{};}module[_0x0ee7('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 dac76d5..2fbe09f 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 _0xb1ca=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x8b4966,_0x1f4ec3){var _0x4e3470=function(_0x3edd92){while(--_0x3edd92){_0x8b4966['push'](_0x8b4966['shift']());}};_0x4e3470(++_0x1f4ec3);}(_0xb1ca,0xcb));var _0xab1c=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xb1ca[_0x4e676e];return _0x336a3c;};'use strict';function SugarcrmAccount(_0x578017){this['id']=_0x578017['id']||0x0;this[_0xab1c('0x0')]=_0x578017['name']||'';this[_0xab1c('0x1')]=_0x578017['username']||'';this['password']=_0x578017[_0xab1c('0x2')]||'';this[_0xab1c('0x3')]=_0x578017[_0xab1c('0x3')]||'';this[_0xab1c('0x4')]=_0x578017['serverUrl']||'';this[_0xab1c('0x5')]=_0x578017[_0xab1c('0x5')]||{};}module[_0xab1c('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x1f3c=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x3f30a2,_0x18678e){var _0x4675ca=function(_0x2ef93f){while(--_0x2ef93f){_0x3f30a2['push'](_0x3f30a2['shift']());}};_0x4675ca(++_0x18678e);}(_0x1f3c,0x103));var _0xc1f3=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x1f3c[_0x47aa64];return _0x549c7a;};'use strict';function SugarcrmAccount(_0x306210){this['id']=_0x306210['id']||0x0;this['name']=_0x306210[_0xc1f3('0x0')]||'';this[_0xc1f3('0x1')]=_0x306210['username']||'';this[_0xc1f3('0x2')]=_0x306210[_0xc1f3('0x2')]||'';this[_0xc1f3('0x3')]=_0x306210[_0xc1f3('0x3')]||'';this['serverUrl']=_0x306210[_0xc1f3('0x4')]||'';this[_0xc1f3('0x5')]=_0x306210[_0xc1f3('0x5')]||{};}module[_0xc1f3('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 f76b481..374d570 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 _0x7bac=['address','name','accountcode','state','unknown','stateTime','status'];(function(_0x4249d0,_0x460973){var _0x5021cd=function(_0x20f03a){while(--_0x20f03a){_0x4249d0['push'](_0x4249d0['shift']());}};_0x5021cd(++_0x460973);}(_0x7bac,0x1e4));var _0xc7ba=function(_0x4f431d,_0xd51a3b){_0x4f431d=_0x4f431d-0x0;var _0x4f31e1=_0x7bac[_0x4f431d];return _0x4f31e1;};'use strict';function Telephone(_0xd3ad8f){this['id']=_0xd3ad8f['id']||0x0;this[_0xc7ba('0x0')]=_0xd3ad8f[_0xc7ba('0x0')]||'';this[_0xc7ba('0x1')]=_0xd3ad8f[_0xc7ba('0x1')]||'';this[_0xc7ba('0x2')]=_0xc7ba('0x3');this[_0xc7ba('0x4')]=0x0;this[_0xc7ba('0x5')]=_0xc7ba('0x3');this[_0xc7ba('0x6')]='';}module['exports']=Telephone; \ No newline at end of file +var _0xb1c1=['exports','name','accountcode','unknown','status','address'];(function(_0x524c48,_0x4468d6){var _0x292e85=function(_0xfde3a6){while(--_0xfde3a6){_0x524c48['push'](_0x524c48['shift']());}};_0x292e85(++_0x4468d6);}(_0xb1c1,0x187));var _0x1b1c=function(_0x1042c2,_0x58eecb){_0x1042c2=_0x1042c2-0x0;var _0x446de6=_0xb1c1[_0x1042c2];return _0x446de6;};'use strict';function Telephone(_0x161e4e){this['id']=_0x161e4e['id']||0x0;this[_0x1b1c('0x0')]=_0x161e4e[_0x1b1c('0x0')]||'';this[_0x1b1c('0x1')]=_0x161e4e[_0x1b1c('0x1')]||'';this['state']=_0x1b1c('0x2');this['stateTime']=0x0;this[_0x1b1c('0x3')]=_0x1b1c('0x2');this[_0x1b1c('0x4')]='';}module[_0x1b1c('0x5')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 93b6683..75a89b4 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 _0x6125=['name','exports'];(function(_0x1d8cd1,_0x5fa35e){var _0x5e7caa=function(_0x4ae460){while(--_0x4ae460){_0x1d8cd1['push'](_0x1d8cd1['shift']());}};_0x5e7caa(++_0x5fa35e);}(_0x6125,0x162));var _0x5612=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6125[_0x3dd15e];return _0x231fd0;};'use strict';function template(_0x2849a9){this['id']=_0x2849a9['id']||0x0;this[_0x5612('0x0')]=_0x2849a9[_0x5612('0x0')]||'';this['html']=_0x2849a9['html']||'';}module[_0x5612('0x1')]=template; \ No newline at end of file +var _0xade4=['html','name'];(function(_0x533132,_0xf5b6fa){var _0x1a7447=function(_0x44d580){while(--_0x44d580){_0x533132['push'](_0x533132['shift']());}};_0x1a7447(++_0xf5b6fa);}(_0xade4,0x159));var _0x4ade=function(_0x14099d,_0x46fe27){_0x14099d=_0x14099d-0x0;var _0x1cff6c=_0xade4[_0x14099d];return _0x1cff6c;};'use strict';function template(_0x3f6709){this['id']=_0x3f6709['id']||0x0;this[_0x4ade('0x0')]=_0x3f6709['name']||'';this[_0x4ade('0x1')]=_0x3f6709[_0x4ade('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 7252c89..8847246 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 _0xedd9=['name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x45c9cd,_0x282763){var _0xd815ce=function(_0x293983){while(--_0x293983){_0x45c9cd['push'](_0x45c9cd['shift']());}};_0xd815ce(++_0x282763);}(_0xedd9,0xfc));var _0x9edd=function(_0x41b1e5,_0x4fdbc0){_0x41b1e5=_0x41b1e5-0x0;var _0x5ca5a2=_0xedd9[_0x41b1e5];return _0x5ca5a2;};'use strict';function Trigger(_0x265eb8){this['id']=_0x265eb8['id']||0x0;this[_0x9edd('0x0')]=_0x265eb8[_0x9edd('0x0')]||'';this[_0x9edd('0x1')]=_0x265eb8[_0x9edd('0x1')]||_0x9edd('0x2');this[_0x9edd('0x3')]=_0x265eb8[_0x9edd('0x3')]||![];this[_0x9edd('0x4')]=_0x265eb8['AllConditions']||[];this[_0x9edd('0x5')]=_0x265eb8[_0x9edd('0x5')]||[];this[_0x9edd('0x6')]=_0x265eb8[_0x9edd('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0x9957=['AnyConditions','Actions','exports','name','channel','voice','status','AllConditions'];(function(_0x42c118,_0x197006){var _0x112ebd=function(_0x337411){while(--_0x337411){_0x42c118['push'](_0x42c118['shift']());}};_0x112ebd(++_0x197006);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';function Trigger(_0x202794){this['id']=_0x202794['id']||0x0;this[_0x7995('0x0')]=_0x202794[_0x7995('0x0')]||'';this[_0x7995('0x1')]=_0x202794['channel']||_0x7995('0x2');this[_0x7995('0x3')]=_0x202794[_0x7995('0x3')]||![];this[_0x7995('0x4')]=_0x202794['AllConditions']||[];this[_0x7995('0x5')]=_0x202794[_0x7995('0x5')]||[];this[_0x7995('0x6')]=_0x202794[_0x7995('0x6')]||[];}module[_0x7995('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 9026ae0..7c97f5f 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 _0x6ae8=['split','host','port','domain','domainport','stateRegistry','address','exports','name','unknown','stateTime','status','registry','indexOf'];(function(_0x23fd1b,_0x469cab){var _0x304e83=function(_0x5c0d6a){while(--_0x5c0d6a){_0x23fd1b['push'](_0x23fd1b['shift']());}};_0x304e83(++_0x469cab);}(_0x6ae8,0x190));var _0x86ae=function(_0x12954a,_0x304691){_0x12954a=_0x12954a-0x0;var _0x5ccde2=_0x6ae8[_0x12954a];return _0x5ccde2;};'use strict';function Trunk(_0x4dfbc1){this['id']=_0x4dfbc1['id']||0x0;this['active']=_0x4dfbc1['active']||![];this[_0x86ae('0x0')]=_0x4dfbc1[_0x86ae('0x0')]||'';this['state']=_0x86ae('0x1');this[_0x86ae('0x2')]=0x0;this[_0x86ae('0x3')]=_0x86ae('0x1');this[_0x86ae('0x4')]=_0x4dfbc1[_0x86ae('0x4')]&&_0x4dfbc1[_0x86ae('0x4')][_0x86ae('0x5')](':')?_0x4dfbc1['registry'][_0x86ae('0x6')](':')[0x0]:'';this[_0x86ae('0x7')]='';this[_0x86ae('0x8')]='';this[_0x86ae('0x9')]='';this[_0x86ae('0xa')]='';this['refresh']='';this[_0x86ae('0xb')]=_0x86ae('0x1');this['registrationtime']='';this[_0x86ae('0xc')]='';}module[_0x86ae('0xd')]=Trunk; \ No newline at end of file +var _0x0b81=['status','registry','indexOf','port','domain','domainport','refresh','stateRegistry','registrationtime','address','exports','active','name','state','unknown','stateTime'];(function(_0x387495,_0xdefebd){var _0x7a2d0f=function(_0x41d96d){while(--_0x41d96d){_0x387495['push'](_0x387495['shift']());}};_0x7a2d0f(++_0xdefebd);}(_0x0b81,0x1db));var _0x10b8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0b81[_0x3dd15e];return _0x231fd0;};'use strict';function Trunk(_0xa40cf6){this['id']=_0xa40cf6['id']||0x0;this[_0x10b8('0x0')]=_0xa40cf6[_0x10b8('0x0')]||![];this[_0x10b8('0x1')]=_0xa40cf6[_0x10b8('0x1')]||'';this[_0x10b8('0x2')]=_0x10b8('0x3');this[_0x10b8('0x4')]=0x0;this[_0x10b8('0x5')]='unknown';this['registry']=_0xa40cf6[_0x10b8('0x6')]&&_0xa40cf6[_0x10b8('0x6')][_0x10b8('0x7')](':')?_0xa40cf6[_0x10b8('0x6')]['split'](':')[0x0]:'';this['host']='';this[_0x10b8('0x8')]='';this[_0x10b8('0x9')]='';this[_0x10b8('0xa')]='';this[_0x10b8('0xb')]='';this[_0x10b8('0xc')]=_0x10b8('0x3');this[_0x10b8('0xd')]='';this[_0x10b8('0xe')]='';}module[_0x10b8('0xf')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index eabdae7..4ac0ec3 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 _0xd70b=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x209bbf,_0x2e2375){var _0x592d4b=function(_0x419947){while(--_0x419947){_0x209bbf['push'](_0x209bbf['shift']());}};_0x592d4b(++_0x2e2375);}(_0xd70b,0xb1));var _0xbd70=function(_0x58b6a8,_0x307021){_0x58b6a8=_0x58b6a8-0x0;var _0xc566dc=_0xd70b[_0x58b6a8];return _0xc566dc;};'use strict';function voiceExtension(_0x438969){this['id']=_0x438969['id']||0x0;this[_0xbd70('0x0')]=_0x438969['exten']||'';this[_0xbd70('0x1')]=_0x438969['recordingFormat']||_0xbd70('0x2');this['mandatoryDisposition']=_0x438969[_0xbd70('0x3')]||![];}module[_0xbd70('0x4')]=voiceExtension; \ No newline at end of file +var _0x61a9=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x2067a8,_0xf7e5e7){var _0x469a3e=function(_0x3182ae){while(--_0x3182ae){_0x2067a8['push'](_0x2067a8['shift']());}};_0x469a3e(++_0xf7e5e7);}(_0x61a9,0x13a));var _0x961a=function(_0x2f5818,_0x2595ee){_0x2f5818=_0x2f5818-0x0;var _0xef138a=_0x61a9[_0x2f5818];return _0xef138a;};'use strict';function voiceExtension(_0x297eb6){this['id']=_0x297eb6['id']||0x0;this[_0x961a('0x0')]=_0x297eb6[_0x961a('0x0')]||'';this[_0x961a('0x1')]=_0x297eb6[_0x961a('0x1')]||_0x961a('0x2');this[_0x961a('0x3')]=_0x297eb6[_0x961a('0x3')]||![];}module[_0x961a('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 62cecaa..d35778b 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 _0xeeee=['dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','unavailable','ringinuse','onhold','wav','wav49','gsm','rrmemory','roundrobin','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry'];(function(_0x563ab1,_0x36b8df){var _0x22eb45=function(_0x5ae5ca){while(--_0x5ae5ca){_0x563ab1['push'](_0x563ab1['shift']());}};_0x22eb45(++_0x36b8df);}(_0xeeee,0xc2));var _0xeeee=function(_0x2e8d01,_0x12fe7a){_0x2e8d01=_0x2e8d01-0x0;var _0x92efe5=_0xeeee[_0x2e8d01];return _0x92efe5;};'use strict';var statusDesc=[_0xeeee('0x0'),_0xeeee('0x1'),_0xeeee('0x2'),_0xeeee('0x3'),'invalid',_0xeeee('0x4'),'ringing',_0xeeee('0x5'),_0xeeee('0x6')];var monitorFormat={'wav':_0xeeee('0x7'),'wav49':_0xeeee('0x8'),'gsm':_0xeeee('0x9')};var strategy={'rrmemory':_0xeeee('0xa'),'roundrobin':_0xeeee('0xb')};function VoiceQueue(_0x582833){this['id']=_0x582833['id']||0x0;this['name']=_0x582833['name']||'';this['monitor_format']=_0x582833[_0xeeee('0xc')]||'';this[_0xeeee('0xd')]=_0x582833['type']||_0xeeee('0xe');this[_0xeeee('0xf')]=0x0;this[_0xeeee('0x10')]=0x0;this[_0xeeee('0x11')]=0x0;this[_0xeeee('0x12')]=0x0;this[_0xeeee('0x13')]=0x0;this[_0xeeee('0x14')]=0x0;this[_0xeeee('0x15')]=0x0;this[_0xeeee('0x16')]=0x0;this[_0xeeee('0x17')]=0x0;this[_0xeeee('0x18')]=0x0;this[_0xeeee('0x19')]=0x0;this[_0xeeee('0x1a')]=_0x582833[_0xeeee('0x1a')]||![];this[_0xeeee('0x1b')]=_0x582833['acwTimeout']||0xa;this[_0xeeee('0x1c')]=_0x582833['autopause']||'no';this[_0xeeee('0x1d')]=!![];this[_0xeeee('0x1e')]='';this[_0xeeee('0x1f')]=0x0;this[_0xeeee('0x20')]=0x0;this[_0xeeee('0x21')]=_0x582833[_0xeeee('0x21')]||null;this[_0xeeee('0x22')]=_0x582833[_0xeeee('0x22')]?_0x582833[_0xeeee('0x22')]:null;this[_0xeeee('0x23')]=_0x582833[_0xeeee('0x23')];this[_0xeeee('0x24')]=_0x582833[_0xeeee('0x24')]||_0xeeee('0x25');this[_0xeeee('0x26')]=_0x582833[_0xeeee('0x26')]||0x0;this['dialLimitQueue']=_0x582833[_0xeeee('0x27')]||0x0;this['dialPowerLevel']=_0x582833['dialPowerLevel']||0x1;this[_0xeeee('0x28')]=_0x582833[_0xeeee('0x28')]||'dropRate';this[_0xeeee('0x29')]=_0x582833[_0xeeee('0x29')]||0.03;this[_0xeeee('0x2a')]=_0x582833[_0xeeee('0x2a')]||0x258;this[_0xeeee('0x2b')]=_0x582833[_0xeeee('0x2b')]||_0xeeee('0x2c');this[_0xeeee('0x2d')]=_0x582833[_0xeeee('0x2d')]||_0xeeee('0x2c');this[_0xeeee('0x2e')]=_0x582833[_0xeeee('0x2e')]||0x1e;this['dialQueueOptions']=_0x582833[_0xeeee('0x2f')]||_0xeeee('0x30');this[_0xeeee('0x31')]=_0x582833[_0xeeee('0x31')]||0x3;this[_0xeeee('0x32')]=_0x582833[_0xeeee('0x32')]||undefined;this[_0xeeee('0x33')]=_0x582833[_0xeeee('0x33')]||0x3;this[_0xeeee('0x34')]=_0x582833[_0xeeee('0x34')]||0x96;this['dialBusyMaxRetry']=_0x582833['dialBusyMaxRetry']||0x3;this['dialBusyRetryFrequency']=_0x582833[_0xeeee('0x35')]||0x96;this[_0xeeee('0x36')]=_0x582833['dialNoAnswerMaxRetry']||0x3;this[_0xeeee('0x37')]=_0x582833['dialNoAnswerRetryFrequency']||0x96;this[_0xeeee('0x38')]=_0x582833[_0xeeee('0x38')]||0x3;this[_0xeeee('0x39')]=_0x582833[_0xeeee('0x39')]||0x96;this['dialDropMaxRetry']=_0x582833['dialDropMaxRetry']||0x3;this[_0xeeee('0x3a')]=_0x582833[_0xeeee('0x3a')]||0x96;this[_0xeeee('0x3b')]=_0x582833[_0xeeee('0x3b')]||0x3;this['dialAbandonedRetryFrequency']=_0x582833[_0xeeee('0x3c')]||0x96;this[_0xeeee('0x3d')]=_0x582833['dialMachineMaxRetry']||0x3;this[_0xeeee('0x3e')]=_0x582833[_0xeeee('0x3e')]||0x96;this[_0xeeee('0x3f')]=_0x582833[_0xeeee('0x3f')]||0x3;this[_0xeeee('0x40')]=_0x582833[_0xeeee('0x40')]||0x96;this[_0xeeee('0x41')]=_0x582833[_0xeeee('0x41')]||0x4;this[_0xeeee('0x42')]=_0x582833[_0xeeee('0x42')]?_0x582833[_0xeeee('0x42')]:undefined;this[_0xeeee('0x43')]=_0x582833['TrunkBackup']?_0x582833['TrunkBackup']:undefined;this['dialPrefix']=_0x582833[_0xeeee('0x44')]||undefined;this[_0xeeee('0x45')]=_0x582833['Interval']?_0x582833[_0xeeee('0x45')]:undefined;this['dialOrderByScheduledAt']=_0x582833[_0xeeee('0x46')]||_0xeeee('0x47');this[_0xeeee('0x48')]=_0x582833['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xeeee('0x49')]=_0x582833['dialCutDigit']||undefined;this[_0xeeee('0x4a')]=strategy[_0x582833[_0xeeee('0x4a')]]||_0xeeee('0xa');this[_0xeeee('0x4b')]=!![];this['dialAMDActive']=_0x582833[_0xeeee('0x4c')]||![];this[_0xeeee('0x4d')]=_0x582833['dialAMDInitialSilence'];this[_0xeeee('0x4e')]=_0x582833[_0xeeee('0x4e')];this['dialAMDAfterGreetingSilence']=_0x582833['dialAMDAfterGreetingSilence'];this[_0xeeee('0x4f')]=_0x582833[_0xeeee('0x4f')];this[_0xeeee('0x50')]=_0x582833[_0xeeee('0x50')];this[_0xeeee('0x51')]=_0x582833[_0xeeee('0x51')];this['dialAMDMaximumNumberOfWords']=_0x582833['dialAMDMaximumNumberOfWords'];this[_0xeeee('0x52')]=_0x582833['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x582833[_0xeeee('0x53')];this['outboundRejectCallsDay']=0x0;this[_0xeeee('0x54')]=0x0;this['timeout']=_0x582833[_0xeeee('0x55')];this[_0xeeee('0x56')]=0x0;this[_0xeeee('0x57')]=0x0;this[_0xeeee('0x58')]=0x0;this[_0xeeee('0x59')]=0x0;this[_0xeeee('0x5a')]=0x0;this[_0xeeee('0x5b')]=0x0;this[_0xeeee('0x5c')]=0x0;this[_0xeeee('0x5d')]=0x0;this[_0xeeee('0x5e')]=0x0;this[_0xeeee('0x5f')]=0x0;this[_0xeeee('0x60')]=0x0;this[_0xeeee('0x61')]=0x0;this[_0xeeee('0x62')]=0x0;this['outboundAbandonedDay']=0x0;this['startProgressive']=undefined;this['startPredictive']=undefined;this[_0xeeee('0x63')]=undefined;this[_0xeeee('0x64')]=1.05;this[_0xeeee('0x65')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0xeeee('0x66')]=0x0;this[_0xeeee('0x67')]=0x0;this[_0xeeee('0x68')]=0x0;this[_0xeeee('0x69')]=0x0;this[_0xeeee('0x6a')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0xeeee('0x6b')]=_0x582833[_0xeeee('0x6c')]||0x14;this[_0xeeee('0x6d')]=_0x582833[_0xeeee('0x6c')]||0xa;this[_0xeeee('0x6e')]=0x0;this[_0xeeee('0x6f')]=0x0;this[_0xeeee('0x70')]=0x1;this[_0xeeee('0x71')]=0x0;this[_0xeeee('0x72')]=0x0;this['erlangAbandonmentRate']=0x0;this['erlangBusyFactor']=0x0;this[_0xeeee('0x73')]=_0x582833[_0xeeee('0x73')]||0x1e;this[_0xeeee('0x74')]=_0x582833[_0xeeee('0x74')]||![];this[_0xeeee('0x75')]=_0x582833['dialQueueProject2']||undefined;this[_0xeeee('0x76')]=_0x582833[_0xeeee('0x76')]||![];this[_0xeeee('0x77')]=_0x582833[_0xeeee('0x77')]||![];this['monitor_format']=monitorFormat[_0x582833[_0xeeee('0xc')]]?monitorFormat[_0x582833['monitor_format']]:undefined;this['mandatoryDisposition']=_0x582833[_0xeeee('0x78')]||![];this[_0xeeee('0x79')]=_0x582833[_0xeeee('0x79')]?_0x582833[_0xeeee('0x79')]:undefined;}module[_0xeeee('0x7a')]=VoiceQueue; \ No newline at end of file +var _0xd104=['predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav','wav49','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime'];(function(_0x5c7ca8,_0xbbee47){var _0xbd8b39=function(_0x583ead){while(--_0x583ead){_0x5c7ca8['push'](_0x5c7ca8['shift']());}};_0xbd8b39(++_0xbbee47);}(_0xd104,0x90));var _0x4d10=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xd104[_0x397e5f];return _0x5302b8;};'use strict';var statusDesc=[_0x4d10('0x0'),'not_inuse',_0x4d10('0x1'),_0x4d10('0x2'),_0x4d10('0x3'),_0x4d10('0x4'),_0x4d10('0x5'),_0x4d10('0x6'),_0x4d10('0x7')];var monitorFormat={'wav':_0x4d10('0x8'),'wav49':_0x4d10('0x9'),'gsm':'gsm'};var strategy={'rrmemory':_0x4d10('0xa'),'roundrobin':_0x4d10('0xb')};function VoiceQueue(_0x485996){this['id']=_0x485996['id']||0x0;this[_0x4d10('0xc')]=_0x485996[_0x4d10('0xc')]||'';this[_0x4d10('0xd')]=_0x485996[_0x4d10('0xd')]||'';this[_0x4d10('0xe')]=_0x485996[_0x4d10('0xe')]||_0x4d10('0xf');this[_0x4d10('0x10')]=0x0;this[_0x4d10('0x11')]=0x0;this[_0x4d10('0x12')]=0x0;this[_0x4d10('0x13')]=0x0;this[_0x4d10('0x14')]=0x0;this[_0x4d10('0x15')]=0x0;this[_0x4d10('0x16')]=0x0;this[_0x4d10('0x17')]=0x0;this[_0x4d10('0x18')]=0x0;this[_0x4d10('0x19')]=0x0;this[_0x4d10('0x1a')]=0x0;this[_0x4d10('0x1b')]=_0x485996[_0x4d10('0x1b')]||![];this['acwTimeout']=_0x485996[_0x4d10('0x1c')]||0xa;this[_0x4d10('0x1d')]=_0x485996[_0x4d10('0x1d')]||'no';this[_0x4d10('0x1e')]=!![];this['message']='';this[_0x4d10('0x1f')]=0x0;this[_0x4d10('0x20')]=0x0;this[_0x4d10('0x21')]=_0x485996['dialTimezone']||null;this['dialGlobalInterval']=_0x485996[_0x4d10('0x22')]?_0x485996[_0x4d10('0x22')]:null;this[_0x4d10('0x23')]=_0x485996[_0x4d10('0x23')];this[_0x4d10('0x24')]=_0x485996['dialMethod']||_0x4d10('0x25');this['dialLimitChannel']=_0x485996[_0x4d10('0x26')]||0x0;this['dialLimitQueue']=_0x485996[_0x4d10('0x27')]||0x0;this['dialPowerLevel']=_0x485996['dialPowerLevel']||0x1;this[_0x4d10('0x28')]=_0x485996[_0x4d10('0x28')]||'dropRate';this[_0x4d10('0x29')]=_0x485996[_0x4d10('0x29')]||0.03;this[_0x4d10('0x2a')]=_0x485996[_0x4d10('0x2a')]||0x258;this[_0x4d10('0x2b')]=_0x485996['dialOriginateCallerIdName']||_0x4d10('0x2c');this[_0x4d10('0x2d')]=_0x485996[_0x4d10('0x2d')]||_0x4d10('0x2c');this['dialOriginateTimeout']=_0x485996[_0x4d10('0x2e')]||0x1e;this['dialQueueOptions']=_0x485996[_0x4d10('0x2f')]||_0x4d10('0x30');this['dialQueueTimeout']=_0x485996[_0x4d10('0x31')]||0x3;this['dialQueueProject']=_0x485996[_0x4d10('0x32')]||undefined;this[_0x4d10('0x33')]=_0x485996[_0x4d10('0x33')]||0x3;this[_0x4d10('0x34')]=_0x485996['dialCongestionRetryFrequency']||0x96;this[_0x4d10('0x35')]=_0x485996[_0x4d10('0x35')]||0x3;this[_0x4d10('0x36')]=_0x485996[_0x4d10('0x36')]||0x96;this['dialNoAnswerMaxRetry']=_0x485996[_0x4d10('0x37')]||0x3;this[_0x4d10('0x38')]=_0x485996['dialNoAnswerRetryFrequency']||0x96;this[_0x4d10('0x39')]=_0x485996[_0x4d10('0x39')]||0x3;this[_0x4d10('0x3a')]=_0x485996['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x485996[_0x4d10('0x3b')]||0x3;this[_0x4d10('0x3c')]=_0x485996['dialDropRetryFrequency']||0x96;this[_0x4d10('0x3d')]=_0x485996['dialAbandonedMaxRetry']||0x3;this[_0x4d10('0x3e')]=_0x485996['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x485996[_0x4d10('0x3f')]||0x3;this[_0x4d10('0x40')]=_0x485996['dialMachineRetryFrequency']||0x96;this[_0x4d10('0x41')]=_0x485996['dialAgentRejectMaxRetry']||0x3;this[_0x4d10('0x42')]=_0x485996[_0x4d10('0x42')]||0x96;this['dialGlobalMaxRetry']=_0x485996[_0x4d10('0x43')]||0x4;this[_0x4d10('0x44')]=_0x485996[_0x4d10('0x44')]?_0x485996[_0x4d10('0x44')]:undefined;this[_0x4d10('0x45')]=_0x485996[_0x4d10('0x45')]?_0x485996[_0x4d10('0x45')]:undefined;this[_0x4d10('0x46')]=_0x485996[_0x4d10('0x46')]||undefined;this[_0x4d10('0x47')]=_0x485996[_0x4d10('0x47')]?_0x485996['Interval']:undefined;this[_0x4d10('0x48')]=_0x485996[_0x4d10('0x48')]||_0x4d10('0x49');this[_0x4d10('0x4a')]=_0x485996[_0x4d10('0x4a')]||undefined;this[_0x4d10('0x4b')]=_0x485996['dialCutDigit']||undefined;this[_0x4d10('0x4c')]=strategy[_0x485996[_0x4d10('0x4c')]]||_0x4d10('0xa');this[_0x4d10('0x4d')]=!![];this['dialAMDActive']=_0x485996[_0x4d10('0x4e')]||![];this[_0x4d10('0x4f')]=_0x485996['dialAMDInitialSilence'];this[_0x4d10('0x50')]=_0x485996[_0x4d10('0x50')];this[_0x4d10('0x51')]=_0x485996['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x485996[_0x4d10('0x52')];this['dialAMDMinWordLength']=_0x485996[_0x4d10('0x53')];this[_0x4d10('0x54')]=_0x485996[_0x4d10('0x54')];this[_0x4d10('0x55')]=_0x485996[_0x4d10('0x55')];this[_0x4d10('0x56')]=_0x485996[_0x4d10('0x56')];this[_0x4d10('0x57')]=_0x485996[_0x4d10('0x57')];this[_0x4d10('0x58')]=0x0;this[_0x4d10('0x59')]=0x0;this[_0x4d10('0x5a')]=_0x485996[_0x4d10('0x5a')];this['outboundAnswerCallsDay']=0x0;this[_0x4d10('0x5b')]=0x0;this[_0x4d10('0x5c')]=0x0;this[_0x4d10('0x5d')]=0x0;this[_0x4d10('0x5e')]=0x0;this[_0x4d10('0x5f')]=0x0;this[_0x4d10('0x60')]=0x0;this[_0x4d10('0x61')]=0x0;this[_0x4d10('0x62')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x4d10('0x63')]=0x0;this['outboundDropCallsDayACS']=0x0;this['outboundReCallsDay']=0x0;this[_0x4d10('0x64')]=0x0;this[_0x4d10('0x65')]=undefined;this[_0x4d10('0x66')]=undefined;this[_0x4d10('0x67')]=undefined;this[_0x4d10('0x68')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x4d10('0x69')]=0x0;this[_0x4d10('0x6a')]=0x0;this[_0x4d10('0x6b')]=0x0;this[_0x4d10('0x6c')]=0x0;this[_0x4d10('0x6d')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x4d10('0x6e')]=_0x485996[_0x4d10('0x6f')]||0x14;this[_0x4d10('0x70')]=_0x485996[_0x4d10('0x6f')]||0xa;this[_0x4d10('0x71')]=0x0;this[_0x4d10('0x72')]=0x0;this[_0x4d10('0x73')]=0x1;this[_0x4d10('0x74')]=0x0;this[_0x4d10('0x75')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x4d10('0x76')]=0x0;this[_0x4d10('0x77')]=_0x485996['dialRecallMeTimeout']||0x1e;this[_0x4d10('0x78')]=_0x485996[_0x4d10('0x78')]||![];this['dialQueueProject2']=_0x485996['dialQueueProject2']||undefined;this[_0x4d10('0x79')]=_0x485996[_0x4d10('0x79')]||![];this[_0x4d10('0x7a')]=_0x485996[_0x4d10('0x7a')]||![];this['monitor_format']=monitorFormat[_0x485996['monitor_format']]?monitorFormat[_0x485996[_0x4d10('0xd')]]:undefined;this[_0x4d10('0x7b')]=_0x485996['mandatoryDisposition']||![];this[_0x4d10('0x7c')]=_0x485996[_0x4d10('0x7c')]?_0x485996[_0x4d10('0x7c')]:undefined;}module[_0x4d10('0x7d')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index d1b5aaa..73e8f66 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 _0xf722=['serverUrl','Configurations','exports','name','username','accessKey'];(function(_0x29a91c,_0x5ac2c5){var _0x2ab4ff=function(_0x47fee7){while(--_0x47fee7){_0x29a91c['push'](_0x29a91c['shift']());}};_0x2ab4ff(++_0x5ac2c5);}(_0xf722,0xb1));var _0x2f72=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xf722[_0x501510];return _0x1e6ee5;};'use strict';function VtigerAccount(_0x31651c){this['id']=_0x31651c['id']||0x0;this[_0x2f72('0x0')]=_0x31651c[_0x2f72('0x0')]||'';this[_0x2f72('0x1')]=_0x31651c['username']||'';this['accessKey']=_0x31651c[_0x2f72('0x2')]||'';this['remoteUri']=_0x31651c['remoteUri']||'';this[_0x2f72('0x3')]=_0x31651c['serverUrl']||'';this[_0x2f72('0x4')]=_0x31651c['Configurations']||{};}module[_0x2f72('0x5')]=VtigerAccount; \ No newline at end of file +var _0xf0cd=['accessKey','remoteUri','serverUrl','exports','name','username'];(function(_0x25c92b,_0x41b368){var _0xc59d85=function(_0x10b32d){while(--_0x10b32d){_0x25c92b['push'](_0x25c92b['shift']());}};_0xc59d85(++_0x41b368);}(_0xf0cd,0x154));var _0xdf0c=function(_0x19710b,_0x3b2c21){_0x19710b=_0x19710b-0x0;var _0x44f6c7=_0xf0cd[_0x19710b];return _0x44f6c7;};'use strict';function VtigerAccount(_0x2f047c){this['id']=_0x2f047c['id']||0x0;this[_0xdf0c('0x0')]=_0x2f047c[_0xdf0c('0x0')]||'';this[_0xdf0c('0x1')]=_0x2f047c[_0xdf0c('0x1')]||'';this[_0xdf0c('0x2')]=_0x2f047c[_0xdf0c('0x2')]||'';this[_0xdf0c('0x3')]=_0x2f047c[_0xdf0c('0x3')]||'';this[_0xdf0c('0x4')]=_0x2f047c[_0xdf0c('0x4')]||'';this['Configurations']=_0x2f047c['Configurations']||{};}module[_0xdf0c('0x5')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 0131933..3b91229 100644 --- a/server/services/ami/model/zendeskAccount.js +++ b/server/services/ami/model/zendeskAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['Configurations','exports','name','username','password','token','remoteUri','authType','integrationTab','serverUrl'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb28,0x106));var _0x8db2=function(_0x50d332,_0x1ade8d){_0x50d332=_0x50d332-0x0;var _0x12db01=_0xdb28[_0x50d332];return _0x12db01;};'use strict';function ZendeskAccount(_0x2f1285){this['id']=_0x2f1285['id']||0x0;this[_0x8db2('0x0')]=_0x2f1285[_0x8db2('0x0')]||'';this[_0x8db2('0x1')]=_0x2f1285['username']||'';this[_0x8db2('0x2')]=_0x2f1285[_0x8db2('0x2')]||'';this[_0x8db2('0x3')]=_0x2f1285[_0x8db2('0x3')]||'';this[_0x8db2('0x4')]=_0x2f1285['remoteUri']||'';this[_0x8db2('0x5')]=_0x2f1285[_0x8db2('0x5')]||'';this['type']=_0x2f1285['type']||_0x8db2('0x6');this[_0x8db2('0x7')]=_0x2f1285[_0x8db2('0x7')]||'';this[_0x8db2('0x8')]=_0x2f1285[_0x8db2('0x8')]||{};}module[_0x8db2('0x9')]=ZendeskAccount; \ No newline at end of file +var _0xadb5=['token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xadb5,0xad));var _0x5adb=function(_0xe73f8f,_0x5ea02c){_0xe73f8f=_0xe73f8f-0x0;var _0x3fb9ab=_0xadb5[_0xe73f8f];return _0x3fb9ab;};'use strict';function ZendeskAccount(_0x1f969c){this['id']=_0x1f969c['id']||0x0;this[_0x5adb('0x0')]=_0x1f969c['name']||'';this[_0x5adb('0x1')]=_0x1f969c[_0x5adb('0x1')]||'';this[_0x5adb('0x2')]=_0x1f969c['password']||'';this[_0x5adb('0x3')]=_0x1f969c[_0x5adb('0x3')]||'';this[_0x5adb('0x4')]=_0x1f969c['remoteUri']||'';this[_0x5adb('0x5')]=_0x1f969c[_0x5adb('0x5')]||'';this[_0x5adb('0x6')]=_0x1f969c[_0x5adb('0x6')]||_0x5adb('0x7');this[_0x5adb('0x8')]=_0x1f969c[_0x5adb('0x8')]||'';this[_0x5adb('0x9')]=_0x1f969c[_0x5adb('0x9')]||{};}module[_0x5adb('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 84fa2c6..a5572e1 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 _0xedf1=['host','zone','clientId','serverUrl','code','refreshToken','Configurations','exports','name','description'];(function(_0x644ecd,_0x397f36){var _0x1c66ce=function(_0x4cf42b){while(--_0x4cf42b){_0x644ecd['push'](_0x644ecd['shift']());}};_0x1c66ce(++_0x397f36);}(_0xedf1,0xb2));var _0x1edf=function(_0x15b395,_0x389bf4){_0x15b395=_0x15b395-0x0;var _0x4b650a=_0xedf1[_0x15b395];return _0x4b650a;};'use strict';function ZohoAccount(_0x2597ba){this['id']=_0x2597ba['id']||0x0;this[_0x1edf('0x0')]=_0x2597ba['name']||'';this['description']=_0x2597ba[_0x1edf('0x1')]||'';this[_0x1edf('0x2')]=_0x2597ba[_0x1edf('0x2')]||'';this['zone']=_0x2597ba[_0x1edf('0x3')]||'';this[_0x1edf('0x4')]=_0x2597ba[_0x1edf('0x4')]||'';this['clientSecret']=_0x2597ba['clientSecret']||'';this[_0x1edf('0x5')]=_0x2597ba[_0x1edf('0x5')]||'';this[_0x1edf('0x6')]=_0x2597ba[_0x1edf('0x6')]||'';this[_0x1edf('0x7')]=_0x2597ba[_0x1edf('0x7')]||'';this[_0x1edf('0x8')]=_0x2597ba[_0x1edf('0x8')]||{};}module[_0x1edf('0x9')]=ZohoAccount; \ No newline at end of file +var _0x5236=['exports','name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations'];(function(_0x1fa6dd,_0x51f867){var _0x16b1cc=function(_0x3e9a09){while(--_0x3e9a09){_0x1fa6dd['push'](_0x1fa6dd['shift']());}};_0x16b1cc(++_0x51f867);}(_0x5236,0x109));var _0x6523=function(_0x51bf59,_0x5af179){_0x51bf59=_0x51bf59-0x0;var _0x31bc5f=_0x5236[_0x51bf59];return _0x31bc5f;};'use strict';function ZohoAccount(_0x1e2507){this['id']=_0x1e2507['id']||0x0;this[_0x6523('0x0')]=_0x1e2507[_0x6523('0x0')]||'';this[_0x6523('0x1')]=_0x1e2507[_0x6523('0x1')]||'';this['host']=_0x1e2507[_0x6523('0x2')]||'';this[_0x6523('0x3')]=_0x1e2507['zone']||'';this[_0x6523('0x4')]=_0x1e2507[_0x6523('0x4')]||'';this[_0x6523('0x5')]=_0x1e2507[_0x6523('0x5')]||'';this[_0x6523('0x6')]=_0x1e2507['serverUrl']||'';this[_0x6523('0x7')]=_0x1e2507[_0x6523('0x7')]||'';this[_0x6523('0x8')]=_0x1e2507['refreshToken']||'';this[_0x6523('0x9')]=_0x1e2507[_0x6523('0x9')]||{};}module[_0x6523('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 00c9598..7959597 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 _0x0019=['queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','Contact','phone','firstName','lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0019,0x176));var _0x9001=function(_0x3a7a9c,_0x24f7d6){_0x3a7a9c=_0x3a7a9c-0x0;var _0x59156e=_0x0019[_0x3a7a9c];return _0x59156e;};'use strict';var util=require(_0x9001('0x0'));var _=require(_0x9001('0x1'));var moment=require(_0x9001('0x2'));function checkNameSurname(_0x13bfa2,_0x9a32a2,_0x2ed14b){var _0x3a948a='';if(!_[_0x9001('0x3')](_0x9a32a2)&&'string'===typeof _0x9a32a2){_0x3a948a+=_0x9a32a2;}if(!_['isNil'](_0x2ed14b)&&'string'===typeof _0x2ed14b){_0x3a948a+='\x20'+_0x2ed14b;}if(_0x3a948a!==''){return _0x3a948a;}return _0x13bfa2;}function Action(_0x12b359,_0x560e6c,_0x1d415a,_0x121644,_0x379d32){this['uniqueid']=_0x1d415a||undefined;this['idContact']=_0x12b359['id'];this[_0x9001('0x4')]=_0x560e6c[_0x9001('0x5')];this[_0x9001('0x6')]=_0x560e6c[_0x9001('0x6')];this[_0x9001('0x7')]=_0x9001('0x4');this[_0x9001('0x8')]=![];this[_0x9001('0x9')]=_[_0x9001('0x3')](_0x12b359[_0x9001('0xa')])?undefined:_0x12b359[_0x9001('0xa')][_0x9001('0x5')];this[_0x9001('0xb')]=this['membername']?util[_0x9001('0xc')](_0x9001('0xd'),this[_0x9001('0x9')]):_0x121644||undefined;this['calleridname']=checkNameSurname(_0x12b359[_0x9001('0xe')][_0x9001('0xf')],_0x12b359[_0x9001('0xe')][_0x9001('0x10')],_0x12b359[_0x9001('0xe')][_0x9001('0x11')]);this[_0x9001('0x12')]=_0x12b359[_0x9001('0x12')]||![];this['calleridnum']=_0x12b359[_0x9001('0xe')][_0x9001('0xf')];this[_0x9001('0x13')]=_0x12b359[_0x9001('0x13')];this[_0x9001('0x14')]=_0x12b359[_0x9001('0x14')]||0x0;this[_0x9001('0x15')]=_0x12b359[_0x9001('0x15')]||0x0;this[_0x9001('0x16')]=_0x12b359[_0x9001('0x16')]||0x0;this[_0x9001('0x17')]=(_0x12b359[_0x9001('0x14')]||0x0)+(_0x12b359[_0x9001('0x15')]||0x0)+(_0x12b359['countnoanswerretry']||0x0);this['countnosuchnumberretry']=_0x12b359['countnosuchnumberretry']||0x0;this['countdropretry']=_0x12b359[_0x9001('0x18')]||0x0;this[_0x9001('0x19')]=_0x12b359[_0x9001('0x19')]||0x0;this[_0x9001('0x1a')]=_0x12b359['countmachineretry']||0x0;this[_0x9001('0x1b')]=_0x12b359[_0x9001('0x1b')]||0x0;this[_0x9001('0x1c')]=_0x12b359[_0x9001('0x1c')];this[_0x9001('0x1d')]=_0x12b359[_0x9001('0x1d')];this[_0x9001('0x1e')]=_0x12b359[_0x9001('0x1e')];this[_0x9001('0x1f')]=_0x12b359[_0x9001('0x1f')];this[_0x9001('0x20')]=_0x12b359['ContactId'];this['ListId']=_0x12b359[_0x9001('0x21')];this[_0x9001('0x22')]=_[_0x9001('0x3')](_0x12b359[_0x9001('0xa')])?_0x12b359[_0x9001('0x22')]:_0x12b359['Agent']['id'];this['VoiceQueueId']=_0x12b359[_0x9001('0x23')];this[_0x9001('0x24')]='';this['originatecalleridname']='';}Action[_0x9001('0x25')][_0x9001('0x26')]=function(){return util[_0x9001('0xc')](_0x9001('0x27'),this['calleridname'],this[_0x9001('0x28')]);};module[_0x9001('0x29')]=Action; \ No newline at end of file +var _0xb09d=['calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','\x22%s\x22\x20<%s>','number','exports','lodash','moment','isNil','string','idContact','queue','name','type','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','lastName','active'];(function(_0x419d19,_0x2c1364){var _0x1f3897=function(_0x206bbe){while(--_0x206bbe){_0x419d19['push'](_0x419d19['shift']());}};_0x1f3897(++_0x2c1364);}(_0xb09d,0x1ce));var _0xdb09=function(_0x22f66e,_0x2f6220){_0x22f66e=_0x22f66e-0x0;var _0x36a52e=_0xb09d[_0x22f66e];return _0x36a52e;};'use strict';var util=require('util');var _=require(_0xdb09('0x0'));var moment=require(_0xdb09('0x1'));function checkNameSurname(_0x28da27,_0x26e05a,_0x36b585){var _0x9d988e='';if(!_[_0xdb09('0x2')](_0x26e05a)&&_0xdb09('0x3')===typeof _0x26e05a){_0x9d988e+=_0x26e05a;}if(!_[_0xdb09('0x2')](_0x36b585)&&_0xdb09('0x3')===typeof _0x36b585){_0x9d988e+='\x20'+_0x36b585;}if(_0x9d988e!==''){return _0x9d988e;}return _0x28da27;}function Action(_0x587bb9,_0x459f7d,_0x3e07d4,_0x5092b9,_0x3a73d1){this['uniqueid']=_0x3e07d4||undefined;this[_0xdb09('0x4')]=_0x587bb9['id'];this[_0xdb09('0x5')]=_0x459f7d[_0xdb09('0x6')];this[_0xdb09('0x7')]=_0x459f7d['type'];this['campaigntype']=_0xdb09('0x5');this['dialAnswer']=![];this[_0xdb09('0x8')]=_['isNil'](_0x587bb9[_0xdb09('0x9')])?undefined:_0x587bb9[_0xdb09('0x9')][_0xdb09('0x6')];this[_0xdb09('0xa')]=this[_0xdb09('0x8')]?util[_0xdb09('0xb')](_0xdb09('0xc'),this[_0xdb09('0x8')]):_0x5092b9||undefined;this[_0xdb09('0xd')]=checkNameSurname(_0x587bb9[_0xdb09('0xe')][_0xdb09('0xf')],_0x587bb9[_0xdb09('0xe')]['firstName'],_0x587bb9[_0xdb09('0xe')][_0xdb09('0x10')]);this[_0xdb09('0x11')]=_0x587bb9[_0xdb09('0x11')]||![];this[_0xdb09('0x12')]=_0x587bb9['Contact'][_0xdb09('0xf')];this[_0xdb09('0x13')]=_0x587bb9[_0xdb09('0x13')];this[_0xdb09('0x14')]=_0x587bb9[_0xdb09('0x14')]||0x0;this[_0xdb09('0x15')]=_0x587bb9['countcongestionretry']||0x0;this[_0xdb09('0x16')]=_0x587bb9[_0xdb09('0x16')]||0x0;this[_0xdb09('0x17')]=(_0x587bb9['countbusyretry']||0x0)+(_0x587bb9[_0xdb09('0x15')]||0x0)+(_0x587bb9[_0xdb09('0x16')]||0x0);this[_0xdb09('0x18')]=_0x587bb9['countnosuchnumberretry']||0x0;this[_0xdb09('0x19')]=_0x587bb9[_0xdb09('0x19')]||0x0;this[_0xdb09('0x1a')]=_0x587bb9['countabandonedretry']||0x0;this[_0xdb09('0x1b')]=_0x587bb9[_0xdb09('0x1b')]||0x0;this[_0xdb09('0x1c')]=_0x587bb9[_0xdb09('0x1c')]||0x0;this['callback']=_0x587bb9[_0xdb09('0x1d')];this[_0xdb09('0x1e')]=_0x587bb9[_0xdb09('0x1e')];this['callbackat']=_0x587bb9[_0xdb09('0x1f')];this[_0xdb09('0x20')]=_0x587bb9[_0xdb09('0x20')];this[_0xdb09('0x21')]=_0x587bb9['ContactId'];this['ListId']=_0x587bb9[_0xdb09('0x22')];this[_0xdb09('0x23')]=_[_0xdb09('0x2')](_0x587bb9[_0xdb09('0x9')])?_0x587bb9[_0xdb09('0x23')]:_0x587bb9['Agent']['id'];this[_0xdb09('0x24')]=_0x587bb9[_0xdb09('0x24')];this['originatecalleridnum']='';this['originatecalleridname']='';}Action['prototype']['getCaller']=function(){return util[_0xdb09('0xb')](_0xdb09('0x25'),this['calleridname'],this[_0xdb09('0x26')]);};module[_0xdb09('0x27')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index c3dc51d..3151ac5 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 _0x2e91=['acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','linkedid','BUSY','outboundBusyCallsDay','countbusyretry','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','scheduledAt','dialBusyRetryFrequency','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','countagentrejectretry','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','phone','VoiceQueueId','Contact\x20is\x20undefined','isEmpty','execCall','then','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','logBlacklist','createHistory','Contact\x20in\x20black\x20List','SIP/%s','unmonitored','execRun','unlockContact','disableContact','getContactPreview','recallme','validateContact','isValid','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','\x20Not\x20Active','SIP/%s/%s%s','trim','dialCutDigit','Contact','substring','getCallerIdRandom','dialRandomLastDigitCallerIdNumber','getCallerId','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variablesAction','[originated][increment]','[originateFailure][logOriginateFailure]','actionid','lookAgent','logLookAgent','isFailure','response','custom:agentringnoanswer','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','statedesc','dialQueueProject','transfer','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','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','campaignsPreview','voiceQueues','trunks','actions','agents','originateresponse','syncOriginateResponse','syncHangup','syncHangupRequest','dialend','bind','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','erlangCalls','erlangBusyFactor','startPredictive','startProgressive','Trunk','name','active','callerid','Interval','format','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice:queue:%s','voice_queue_channel:remove','sendMessageOneNotActive','originated','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','syncCampaigns','clockClearZombieChannels','booked','clearZombieChannels','hasOwnProperty','dialActive','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','pick','ListId','Action','status','channel','catch','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','size','getContactRecallMe','agentReadyId','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','dialAnswer','uniqueid','\x20Queue','custom:agentconnect','buildObj','connect'];(function(_0xd6e7f,_0x4e4c15){var _0x22ecaf=function(_0x1243dc){while(--_0x1243dc){_0xd6e7f['push'](_0xd6e7f['shift']());}};_0x22ecaf(++_0x4e4c15);}(_0x2e91,0x1c1));var _0x12e9=function(_0x19ac80,_0x4033f9){_0x19ac80=_0x19ac80-0x0;var _0x162659=_0x2e91[_0x19ac80];return _0x162659;};'use strict';var util=require(_0x12e9('0x0'));var _=require(_0x12e9('0x1'));var BPromise=require(_0x12e9('0x2'));var uuid=require(_0x12e9('0x3'));var moment=require(_0x12e9('0x4'));var md5=require(_0x12e9('0x5'));var Redis=require(_0x12e9('0x6'));var config=require(_0x12e9('0x7'));var logger=require(_0x12e9('0x8'))(_0x12e9('0x9'));var loggerAction=require('../../../config/logger')(_0x12e9('0xa'));var ami=require(_0x12e9('0xb'));var rpcDb=require(_0x12e9('0xc'));var Action=require(_0x12e9('0xd'));var ut=require('./util/util');config[_0x12e9('0xe')]=_[_0x12e9('0xf')](config[_0x12e9('0xe')],{'host':_0x12e9('0x10'),'port':0x18eb});var io=require(_0x12e9('0x11'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x12e9('0x12')][_0x12e9('0x13')]=function(_0x3ae63d){this[_0x12e9('0x14')]=this[_0x12e9('0x14')]?this[_0x12e9('0x14')][_0x12e9('0x15')](_0x3ae63d):_0x3ae63d();};function Preview(_0x1309a7){this['sequence']=new Sequence();this[_0x12e9('0x16')]=_0x1309a7[_0x12e9('0x17')];this[_0x12e9('0x18')]=_0x1309a7[_0x12e9('0x18')];this[_0x12e9('0x19')]={};this[_0x12e9('0x1a')]=_0x1309a7[_0x12e9('0x1a')];this['clockClearZombieChannels']=0x0;ami['on'](_0x12e9('0x1b'),this[_0x12e9('0x1c')]['bind'](this));ami['on']('hangup',this[_0x12e9('0x1d')]['bind'](this));ami['on']('hanguprequest',this[_0x12e9('0x1e')]['bind'](this));ami['on'](_0x12e9('0x1f'),this['syncDialEnd'][_0x12e9('0x20')](this));ami['on'](_0x12e9('0x21'),this[_0x12e9('0x22')][_0x12e9('0x20')](this));ami['on'](_0x12e9('0x23'),this[_0x12e9('0x24')][_0x12e9('0x20')](this));ami['on'](_0x12e9('0x25'),this[_0x12e9('0x26')][_0x12e9('0x20')](this));ami['on']('blindtransfer',this[_0x12e9('0x27')][_0x12e9('0x20')](this));this[_0x12e9('0x28')](this['campaignsPreview']);}function emit(_0x51c3e6,_0x362654,_0x351262){io['to'](_0x51c3e6)[_0x12e9('0x29')](_0x362654,_0x351262);}function emitCampaignPreview(_0x393ce6){if(_0x393ce6[_0x12e9('0x2a')]===_0x12e9('0x2b')){var _0x2cb75a={'id':_0x393ce6['id'],'name':_0x393ce6['name'],'strategy':_0x393ce6['strategy'],'answered':_0x393ce6[_0x12e9('0x2c')],'available':_0x393ce6[_0x12e9('0x2d')],'loggedIn':_0x393ce6[_0x12e9('0x2e')],'pTalking':_0x393ce6[_0x12e9('0x2f')],'sumBillable':_0x393ce6[_0x12e9('0x30')],'sumDuration':_0x393ce6[_0x12e9('0x31')],'sumHoldTime':_0x393ce6[_0x12e9('0x32')]||0x0,'talking':_0x393ce6[_0x12e9('0x33')],'total':_0x393ce6[_0x12e9('0x34')],'type':_0x393ce6['type'],'unmanaged':_0x393ce6[_0x12e9('0x35')],'abandoned':_0x393ce6['abandoned'],'waiting':_0x393ce6[_0x12e9('0x36')],'loggedInDb':_0x393ce6[_0x12e9('0x37')],'dialActive':_0x393ce6['dialActive'],'dialMethod':_0x393ce6[_0x12e9('0x38')],'dialOriginateCallerIdName':_0x393ce6[_0x12e9('0x39')],'dialOriginateCallerIdNumber':_0x393ce6[_0x12e9('0x3a')],'dialOriginateTimeout':_0x393ce6['dialOriginateTimeout'],'dialPrefix':_0x393ce6[_0x12e9('0x3b')],'outboundAnswerAgiCallsDay':_0x393ce6[_0x12e9('0x3c')],'outboundAnswerCallsDay':_0x393ce6[_0x12e9('0x3d')],'outboundBlacklistCallsDay':_0x393ce6[_0x12e9('0x3e')],'outboundBusyCallsDay':_0x393ce6['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x393ce6[_0x12e9('0x3f')],'outboundDropCallsDayACS':_0x393ce6['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x393ce6[_0x12e9('0x40')],'outboundDropCallsDayTimeout':_0x393ce6[_0x12e9('0x41')],'outboundNoAnswerCallsDay':_0x393ce6['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x393ce6[_0x12e9('0x42')],'outboundOriginateFailureCallsDay':_0x393ce6[_0x12e9('0x43')],'outboundReCallsDay':_0x393ce6['outboundReCallsDay'],'outboundRejectCallsDay':_0x393ce6[_0x12e9('0x44')],'outboundUnknownCallsDay':_0x393ce6[_0x12e9('0x45')],'outboundAbandonedCallsDay':_0x393ce6[_0x12e9('0x46')],'predictiveIntervalAnsweredCalls':_0x393ce6['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x393ce6[_0x12e9('0x47')],'predictiveIntervalAvgTalktime':_0x393ce6['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x393ce6[_0x12e9('0x48')],'predictiveIntervalDroppedCallsTimeout':_0x393ce6[_0x12e9('0x49')],'predictiveIntervalErlangCalls':_0x393ce6[_0x12e9('0x4a')],'predictiveIntervalErlangCallsDroppedCalls':_0x393ce6['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x393ce6[_0x12e9('0x4b')],'predictiveIntervalMultiplicativeFactor':_0x393ce6[_0x12e9('0x4c')],'predictiveIntervalPauses':_0x393ce6[_0x12e9('0x4d')],'predictiveIntervalAvailable':_0x393ce6['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x393ce6[_0x12e9('0x4e')],'message':_0x393ce6[_0x12e9('0x4f')],'originated':_0x393ce6['originated'],'erlangCalls':_0x393ce6[_0x12e9('0x50')],'erlangCallToSecond':_0x393ce6['erlangCallToSecond'],'erlangAbandonmentRate':_0x393ce6['erlangAbandonmentRate'],'erlangBusyFactor':_0x393ce6[_0x12e9('0x51')],'startPredictive':_0x393ce6[_0x12e9('0x52')],'startProgressive':_0x393ce6[_0x12e9('0x53')]};if(_0x393ce6[_0x12e9('0x54')]){_0x2cb75a[_0x12e9('0x54')]={'id':_0x393ce6[_0x12e9('0x54')]['id'],'name':_0x393ce6['Trunk'][_0x12e9('0x55')],'active':_0x393ce6[_0x12e9('0x54')][_0x12e9('0x56')],'callerid':_0x393ce6['Trunk'][_0x12e9('0x57')]};}if(_0x393ce6[_0x12e9('0x58')]){_0x2cb75a[_0x12e9('0x58')]={'id':_0x393ce6[_0x12e9('0x58')]['id'],'name':_0x393ce6[_0x12e9('0x58')][_0x12e9('0x55')]};}var _0x53d40b=md5(JSON['stringify'](_0x2cb75a));if(_0x393ce6[_0x12e9('0x5')]!==_0x53d40b){_0x393ce6[_0x12e9('0x5')]=_0x53d40b;emit(util[_0x12e9('0x59')]('voice:queue:%s',_0x2cb75a['name']),_0x12e9('0x5a'),_0x2cb75a);}}}function emitVoiceQueueChannelRemove(_0x415db1){logger[_0x12e9('0x5b')](_0x12e9('0x5c'),JSON[_0x12e9('0x5d')](_0x415db1));emit(util['format'](_0x12e9('0x5e'),_0x415db1[_0x12e9('0x55')]),_0x12e9('0x5f'),_0x415db1);}function notSendMessagesQueue(_0x374faf){if(_0x374faf[_0x12e9('0x60')]){if(_0x374faf[_0x12e9('0x61')]===0x0&&_0x374faf[_0x12e9('0x2f')]===0x0){_0x374faf['sendMessageOneNotActive']=![];_0x374faf[_0x12e9('0x2d')]=0x0;_0x374faf[_0x12e9('0x62')]=0x0;_0x374faf[_0x12e9('0x4f')]=_0x12e9('0x63');ut[_0x12e9('0x64')](_0x12e9('0x65'),_0x374faf[_0x12e9('0x55')]+'\x20is\x20not\x20active');}else{_0x374faf[_0x12e9('0x4f')]='IS_DISACTIVED';ut[_0x12e9('0x64')](_0x12e9('0x65'),_0x374faf[_0x12e9('0x55')]+_0x12e9('0x66'));}emitCampaignPreview(_0x374faf);}}Preview['prototype'][_0x12e9('0x28')]=function(){var _0x31434f=this;setInterval(function(){_0x31434f['syncCampaigns']();},0x7cf);};Preview[_0x12e9('0x12')][_0x12e9('0x67')]=function(){var _0x17fb56=this[_0x12e9('0x16')];this[_0x12e9('0x68')]+=0x1;for(var _0x453496 in _0x17fb56){if(_0x17fb56['hasOwnProperty'](_0x453496)&&(_0x17fb56[_0x453496][_0x12e9('0x38')]===_0x12e9('0x9')||_0x17fb56[_0x453496][_0x12e9('0x38')]===_0x12e9('0x69'))&&_0x17fb56[_0x453496][_0x12e9('0x2a')]===_0x12e9('0x2b')){if(this['clockClearZombieChannels']>0x7){this[_0x12e9('0x68')]=0x0;this[_0x12e9('0x6a')]();}}if(_0x17fb56[_0x12e9('0x6b')](_0x453496)&&_0x17fb56[_0x453496]['dialMethod']===_0x12e9('0x9')&&_0x17fb56[_0x453496][_0x12e9('0x2a')]===_0x12e9('0x2b')){if(_0x17fb56[_0x453496][_0x12e9('0x6c')]){this[_0x12e9('0x6d')](_0x17fb56[_0x453496]);this[_0x12e9('0x6e')](_0x17fb56[_0x453496]);}else{notSendMessagesQueue(_0x17fb56[_0x453496]);}}}};Preview[_0x12e9('0x12')][_0x12e9('0x6f')]=function(_0x4c291b){var _0xc22487=this;this['sequence']['enqueue'](function(){if(!_[_0x12e9('0x70')](_0xc22487[_0x12e9('0x19')][_0x4c291b])){loggerAction[_0x12e9('0x5b')](_0x12e9('0x71'),_0x4c291b,_0x12e9('0x72'),_0xc22487['actions'][_0x4c291b][_0x12e9('0x73')],_0x12e9('0x74'),JSON[_0x12e9('0x5d')](_0xc22487[_0x12e9('0x16')][_0xc22487['actions'][_0x4c291b][_0x12e9('0x73')]][_0x12e9('0x61')]),_0x12e9('0x75'),JSON[_0x12e9('0x5d')](_0xc22487[_0x12e9('0x16')][_0xc22487[_0x12e9('0x19')][_0x4c291b]['queue']][_0x12e9('0x2f')]),JSON[_0x12e9('0x5d')](_0xc22487[_0x12e9('0x19')][_0x4c291b]['dialAnswer']),JSON['stringify'](_[_0x12e9('0x76')](_0xc22487[_0x12e9('0x19')][_0x4c291b],['contactId','UserId','VoiceQueueId',_0x12e9('0x77')])));return ami[_0x12e9('0x78')]({'action':_0x12e9('0x79'),'channel':_0xc22487[_0x12e9('0x19')][_0x4c291b][_0x12e9('0x7a')]})[_0x12e9('0x7b')](function(_0x448cb6){if(_0x448cb6[_0x12e9('0x4f')]==='No\x20such\x20channel'){setTimeout(function(){if(_0xc22487['actions'][_0x4c291b]){ut[_0x12e9('0x7c')](_0xc22487[_0x12e9('0x16')][_0xc22487[_0x12e9('0x19')][_0x4c291b][_0x12e9('0x73')]],_0x12e9('0x7d'));if(_0xc22487[_0x12e9('0x19')][_0x4c291b]['dialAnswer']===!![]){ut[_0x12e9('0x7e')](_0xc22487['campaignsPreview'][_0xc22487[_0x12e9('0x19')][_0x4c291b][_0x12e9('0x73')]],_0x12e9('0x7d'));ut[_0x12e9('0x7f')](_0x12e9('0x80')+_0x4c291b,_0xc22487[_0x12e9('0x19')][_0x4c291b][_0x12e9('0x73')]);}ut[_0x12e9('0x7f')]('[Dialer][checkChannel][Preview]'+_0x4c291b,_0xc22487[_0x12e9('0x19')][_0x4c291b][_0x12e9('0x73')]);delete _0xc22487[_0x12e9('0x19')][_0x4c291b];}},0x2328);}});}});};Preview['prototype'][_0x12e9('0x6a')]=function(){var _0x37eca9=this;loggerAction[_0x12e9('0x5b')]('[action]',_[_0x12e9('0x81')](this[_0x12e9('0x19')]));for(var _0x3d5380 in this['actions']){if(_0x37eca9[_0x12e9('0x19')]['hasOwnProperty'](_0x3d5380)){_0x37eca9[_0x12e9('0x6f')](_0x3d5380);}}};Preview[_0x12e9('0x12')]['recallMe']=function(_0x2cdcef){var _0x483d41=this;rpcDb[_0x12e9('0x82')](_0x2cdcef['id'],ut[_0x12e9('0x83')](this[_0x12e9('0x1a')]))['then'](function(_0x56355e){if(!_['isNil'](_0x56355e)){for(var _0xf0e915=0x0;_0xf0e915<_0x56355e[_0x12e9('0x84')];_0xf0e915+=0x1){if(ut[_0x12e9('0x85')](_0x56355e[_0xf0e915][_0x12e9('0x86')])<_0x2cdcef[_0x12e9('0x87')]*0x3c){if(_0x56355e[_0xf0e915][_0x12e9('0x88')]&&!_0x56355e[_0xf0e915][_0x12e9('0x88')][_0x12e9('0x89')]){_0x483d41[_0x12e9('0x8a')](_0x56355e[_0xf0e915]['id'])['then'](ut[_0x12e9('0x8b')](_0x12e9('0x8c')))[_0x12e9('0x7b')](ut['logger2']('[RecallMe]'));}else{rpcDb['disableContact'](_0x56355e[_0xf0e915]['id']);}}else{var _0x38fe58=new Action(_0x56355e[_0xf0e915],_0x2cdcef);_0x38fe58[_0x12e9('0x8d')]=moment()[_0x12e9('0x59')](_0x12e9('0x8e'));_0x2cdcef['outboundReCallsDay']+=0x1;ut[_0x12e9('0x8f')](_0x38fe58,0x17,_0x12e9('0x90'));if(_0x2cdcef[_0x12e9('0x91')]){rpcDb[_0x12e9('0x92')](ut['createBody'](_0x56355e[_0xf0e915]));rpcDb[_0x12e9('0x93')](_0x38fe58,_0x12e9('0x94'));}else{ut[_0x12e9('0x8f')](_0x38fe58,0x16,_0x12e9('0x95'));rpcDb[_0x12e9('0x93')](_0x38fe58,_0x12e9('0x96'));rpcDb[_0x12e9('0x97')](_0x38fe58,_0x12e9('0x96'));}}}}})[_0x12e9('0x7b')](ut['logger2'](_0x12e9('0x98')));};Preview['prototype'][_0x12e9('0x6d')]=function(_0x1fbb1f){_0x1fbb1f['sendMessageOneNotActive']=!![];if(ut['IsNotLoggedIn'](_0x1fbb1f['loggedIn'])){_0x1fbb1f['message']=_0x12e9('0x99');}else if(!ut[_0x12e9('0x9a')](_0x1fbb1f[_0x12e9('0x6c')])){_0x1fbb1f['message']=_0x12e9('0x63');}else if(!this[_0x12e9('0x9b')](_0x1fbb1f[_0x12e9('0x54')])){if(!this[_0x12e9('0x9b')](_0x1fbb1f[_0x12e9('0x9c')])){_0x1fbb1f[_0x12e9('0x4f')]=_0x12e9('0x9d');}else{_0x1fbb1f['message']=_0x12e9('0x9e');}}else{_0x1fbb1f['message']=_0x12e9('0x9e');}emitCampaignPreview(_0x1fbb1f);};Preview[_0x12e9('0x12')][_0x12e9('0x9f')]=function(_0x213597,_0x5d1d71,_0x27911f){var _0x5a8590=this;var _0x1b23fd=this[_0x12e9('0x19')][_0x5d1d71];var _0x5d9fbf=this[_0x12e9('0x16')][_0x1b23fd[_0x12e9('0x73')]];var _0x2dcf17;if(_0x5d9fbf){switch(_0x27911f){case'1':_0x5d9fbf['outboundNoSuchCallsDay']+=0x1;_0x1b23fd[_0x12e9('0xa0')]+=0x1;_0x1b23fd[_0x12e9('0xa1')]=ut[_0x12e9('0xa2')](_0x1b23fd);ut[_0x12e9('0x8f')](_0x1b23fd,0x0,_0x12e9('0xa3'));rpcDb[_0x12e9('0x93')](_0x1b23fd,_0x12e9('0xa4'));if(ut['totalGlobal'](_0x1b23fd)>=_0x5d9fbf[_0x12e9('0xa5')]){_0x2dcf17=ut[_0x12e9('0xa6')](_0x1b23fd,0xf,_0x12e9('0xa7'));rpcDb['createCustomerFinal'](_0x2dcf17,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x1b23fd[_0x12e9('0xa0')]>=_0x5d9fbf['dialNoSuchNumberMaxRetry']){rpcDb['createCustomerFinal'](_0x1b23fd,_0x12e9('0xa8'));}else{rpcDb[_0x12e9('0xa9')](ut['scheduledAt'](_0x1b23fd,'countnosuchnumberretry',_0x5d9fbf[_0x12e9('0xaa')]),_0x1b23fd[_0x12e9('0xab')],_0x1b23fd[_0x12e9('0xac')]);}}delete this[_0x12e9('0x19')][_0x213597['linkedid']];break;case'ANSWER':var _0x34386e=moment()[_0x12e9('0x59')](_0x12e9('0x8e'));_0x1b23fd['responsetime']=_0x34386e;_0x1b23fd['answertime']=_0x34386e;_0x1b23fd[_0x12e9('0xad')]=!![];_0x5d9fbf['pTalking']+=0x1;logger[_0x12e9('0x5b')]('[syncHangup][talking][increment]',_0x1b23fd[_0x12e9('0xae')],_0x12e9('0xaf'),_0x5d9fbf['name'],_0x12e9('0x75'),_0x5d9fbf[_0x12e9('0x2f')]);ami[_0x12e9('0x29')](_0x12e9('0xb0'),ut[_0x12e9('0xb1')](_0x1b23fd,_0x12e9('0xb2')));if(_0x5d9fbf[_0x12e9('0xb3')]){ami[_0x12e9('0x29')](_0x12e9('0xb4'),ut[_0x12e9('0xb5')](_0x1b23fd));}break;case'16':ami['emit'](_0x12e9('0xb6'),ut[_0x12e9('0xb1')](_0x1b23fd,_0x12e9('0xb7')));emitVoiceQueueChannelRemove(ut[_0x12e9('0xb1')](_0x1b23fd,'complete'));_0x5d9fbf['outboundAnswerCallsDay']+=0x1;_0x5d9fbf[_0x12e9('0x34')]+=0x1;_0x5d9fbf[_0x12e9('0x2c')]+=0x1;ut['decrementTalkink'](_0x5d9fbf,'[16]');_0x1b23fd[_0x12e9('0xa1')]=ut['totalGlobal'](_0x1b23fd);ut[_0x12e9('0x8f')](_0x1b23fd,0x4,_0x12e9('0xb8'));rpcDb[_0x12e9('0x93')](_0x1b23fd,_0x12e9('0xb9'));rpcDb[_0x12e9('0x97')](_0x1b23fd,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x12e9('0xba')](_0x1b23fd);_0x5d9fbf[_0x12e9('0x31')]+=_0x1b23fd[_0x12e9('0xbb')];_0x5d9fbf[_0x12e9('0x30')]+=_0x1b23fd[_0x12e9('0xbb')];logger[_0x12e9('0x5b')](_0x12e9('0xbc'),_0x1b23fd[_0x12e9('0xae')],'\x20Queue',_0x5d9fbf['name'],'pTalking:\x20',_0x5d9fbf[_0x12e9('0x2f')]);delete this[_0x12e9('0x19')][_0x213597[_0x12e9('0xbd')]];break;case _0x12e9('0xbe'):_0x5d9fbf[_0x12e9('0xbf')]+=0x1;_0x1b23fd[_0x12e9('0xc0')]+=0x1;_0x1b23fd['countglobal']=ut[_0x12e9('0xa2')](_0x1b23fd);ut[_0x12e9('0x8f')](_0x1b23fd,0x5,'Busy');rpcDb[_0x12e9('0x93')](_0x1b23fd,_0x12e9('0xc1'));if(ut[_0x12e9('0xa2')](_0x1b23fd)>=_0x5d9fbf[_0x12e9('0xa5')]){_0x2dcf17=ut[_0x12e9('0xa6')](_0x1b23fd,0xf,_0x12e9('0xa7'));rpcDb[_0x12e9('0x97')](_0x2dcf17,_0x12e9('0xc2'));}else{if(_0x1b23fd[_0x12e9('0xc0')]>=_0x5d9fbf[_0x12e9('0xc3')]){rpcDb['createCustomerFinal'](_0x1b23fd,_0x12e9('0xc1'));}else{rpcDb[_0x12e9('0xa9')](ut[_0x12e9('0xc4')](_0x1b23fd,'countbusyretry',_0x5d9fbf[_0x12e9('0xc5')]),_0x1b23fd['unlockAgent'],_0x1b23fd[_0x12e9('0xac')]);}}break;case _0x12e9('0xc6'):_0x5d9fbf[_0x12e9('0xc7')]+=0x1;_0x1b23fd[_0x12e9('0xc8')]+=0x1;_0x1b23fd[_0x12e9('0xa1')]=ut['totalGlobal'](_0x1b23fd);ut['logCustomer'](_0x1b23fd,0x3,_0x12e9('0xc9'));rpcDb[_0x12e9('0x93')](_0x1b23fd,_0x12e9('0xca'));if(ut[_0x12e9('0xa2')](_0x1b23fd)>=_0x5d9fbf[_0x12e9('0xa5')]){_0x2dcf17=ut[_0x12e9('0xa6')](_0x1b23fd,0xf,'Global');rpcDb[_0x12e9('0x97')](_0x2dcf17,_0x12e9('0xcb'));}else{if(_0x1b23fd[_0x12e9('0xc8')]>=_0x5d9fbf['dialNoAnswerMaxRetry']){rpcDb[_0x12e9('0x97')](_0x1b23fd,_0x12e9('0xca'));}else{rpcDb['rescheduleContact'](ut[_0x12e9('0xc4')](_0x1b23fd,'countnoanswerretry',_0x5d9fbf[_0x12e9('0xcc')]),_0x1b23fd[_0x12e9('0xab')],_0x1b23fd[_0x12e9('0xac')]);}}break;case _0x12e9('0xcd'):_0x5d9fbf[_0x12e9('0x3f')]+=0x1;_0x1b23fd[_0x12e9('0xce')]+=0x1;_0x1b23fd[_0x12e9('0xa1')]=ut[_0x12e9('0xa2')](_0x1b23fd);ut['logCustomer'](_0x1b23fd,0x8,_0x12e9('0xcf'));rpcDb[_0x12e9('0x93')](_0x1b23fd,_0x12e9('0xd0'));if(ut[_0x12e9('0xa2')](_0x1b23fd)>=_0x5d9fbf[_0x12e9('0xa5')]){_0x2dcf17=ut[_0x12e9('0xa6')](_0x1b23fd,0xf,_0x12e9('0xa7'));rpcDb[_0x12e9('0x97')](_0x2dcf17,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x1b23fd[_0x12e9('0xce')]>=_0x5d9fbf[_0x12e9('0xd1')]){rpcDb['createCustomerFinal'](_0x1b23fd,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x12e9('0xa9')](ut[_0x12e9('0xc4')](_0x1b23fd,_0x12e9('0xce'),_0x5d9fbf['dialBusyRetryFrequency']),_0x1b23fd[_0x12e9('0xab')],_0x1b23fd['activeContact']);}}break;case'CANCEL':_0x5d9fbf[_0x12e9('0x44')]+=0x1;_0x1b23fd[_0x12e9('0xd2')]+=0x1;_0x1b23fd['countglobal']=ut[_0x12e9('0xa2')](_0x1b23fd);ut['logCustomer'](_0x1b23fd,0x14,'AgentReject');rpcDb[_0x12e9('0x93')](_0x1b23fd,'[syncHangupRequest][logAgentReject]');if(ut['totalGlobal'](_0x1b23fd)>=_0x5d9fbf[_0x12e9('0xa5')]){_0x2dcf17=ut['cloneAction'](_0x1b23fd,0x14,'AgentReject');rpcDb[_0x12e9('0x97')](_0x2dcf17,_0x12e9('0xd3'));}else{if(_0x1b23fd[_0x12e9('0xd2')]>=_0x5d9fbf[_0x12e9('0xd4')]){rpcDb[_0x12e9('0x97')](_0x1b23fd,_0x12e9('0xd3'));}else{rpcDb[_0x12e9('0xa9')](ut['scheduledAt'](_0x1b23fd,_0x12e9('0xd2'),_0x5d9fbf[_0x12e9('0xd5')]),_0x1b23fd[_0x12e9('0xab')],_0x1b23fd['activeContact']);}}break;case _0x12e9('0xd6'):_0x5d9fbf[_0x12e9('0x46')]+=0x1;_0x1b23fd[_0x12e9('0xd7')]+=0x1;_0x1b23fd[_0x12e9('0xa1')]=ut[_0x12e9('0xa2')](_0x1b23fd);ut[_0x12e9('0x8f')](_0x1b23fd,0xb,_0x12e9('0xd8'));rpcDb['createCustomerHistory'](_0x1b23fd,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0x12e9('0xa2')](_0x1b23fd)>=_0x5d9fbf[_0x12e9('0xa5')]){_0x2dcf17=ut['cloneAction'](_0x1b23fd,0xf,_0x12e9('0xa7'));rpcDb[_0x12e9('0x97')](_0x2dcf17,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x1b23fd[_0x12e9('0xd9')]>=_0x5d9fbf[_0x12e9('0xda')]){rpcDb[_0x12e9('0x97')](_0x1b23fd,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0x12e9('0xa9')](ut['scheduledAt'](_0x1b23fd,_0x12e9('0xd7'),_0x5d9fbf[_0x12e9('0xdb')]),_0x1b23fd[_0x12e9('0xab')],_0x1b23fd['activeContact']);}}break;default:if(_0x1b23fd[_0x12e9('0xad')]){ut[_0x12e9('0x7e')](_0x5d9fbf,'[default]');ut[_0x12e9('0x7f')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x5d9fbf[_0x12e9('0x55')],_0x213597);}_0x5d9fbf[_0x12e9('0x45')]+=0x1;_0x1b23fd[_0x12e9('0xa1')]=ut[_0x12e9('0xa2')](_0x1b23fd);ut[_0x12e9('0x8f')](_0x1b23fd,0xc,_0x213597[_0x12e9('0xdc')]||_0x213597[_0x12e9('0xdd')]);rpcDb[_0x12e9('0x93')](_0x1b23fd,'[callProgressDetectingCustomer][logUnknown]');if(ut['totalGlobal'](_0x1b23fd)>=_0x5d9fbf[_0x12e9('0xa5')]){_0x2dcf17=ut['cloneAction'](_0x1b23fd,0xf,_0x12e9('0xa7'));rpcDb['createCustomerFinal'](_0x2dcf17,_0x12e9('0xde'));}else{rpcDb[_0x12e9('0x97')](_0x1b23fd,_0x12e9('0xde'));}delete this[_0x12e9('0x19')][_0x213597[_0x12e9('0xbd')]];}if(!(_0x1b23fd[_0x12e9('0xad')]&&_0x27911f==='16')){ut[_0x12e9('0x7c')](_0x5d9fbf,_0x12e9('0xdf'));logger['info'](_0x12e9('0xe0'),_0x1b23fd[_0x12e9('0xae')],_0x12e9('0xaf'),_0x5d9fbf[_0x12e9('0x55')],'originated:\x20',_0x5d9fbf[_0x12e9('0x61')]);}if(_0x27911f!=='ANSWER'){delete this[_0x12e9('0x19')][_0x213597[_0x12e9('0xbd')]];delete this[_0x12e9('0x19')][_0x213597[_0x12e9('0xe1')]];}}};Preview[_0x12e9('0x12')]['callProgressDetectingAgent']=function(_0xc3ce96,_0x558f00,_0x34e225){if(_['isUndefined'](_0x558f00)&&'object'!==typeof _0x558f00){return;}if(_[_0x12e9('0xe2')](_0x34e225)&&_0x12e9('0xe3')!==typeof _0x34e225){return;}switch(_0x34e225[_0x12e9('0xe4')]){case'0':ut[_0x12e9('0xe5')](_0xc3ce96,0x0,_0x12e9('0xa3'));rpcDb[_0x12e9('0xe6')](_0xc3ce96,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut['logAgent'](_0xc3ce96,0x3,_0x12e9('0xc9'));rpcDb[_0x12e9('0xe6')](_0xc3ce96,_0x12e9('0xe7'));break;case'5':ut[_0x12e9('0xe5')](_0xc3ce96,0x5,'Busy');rpcDb[_0x12e9('0xe6')](_0xc3ce96,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0x12e9('0xe5')](_0xc3ce96,0x8,'Congestion');rpcDb['createAgentHistory'](_0xc3ce96,_0x12e9('0xe8'));break;case'22':ut[_0x12e9('0xe5')](_0xc3ce96,0x16,'AnswerAGI');rpcDb[_0x12e9('0xe6')](_0xc3ce96,_0x12e9('0xe9'));break;default:ut[_0x12e9('0xe5')](_0xc3ce96,0xc,_0x34e225[_0x12e9('0xe4')]);rpcDb[_0x12e9('0xe6')](_0xc3ce96,'[callProgressDetectingAgent][logCongestion]');}ut['updateOriginated'](_0x558f00,_0x12e9('0xea'));logger['info'](_0x12e9('0xeb'),_0xc3ce96[_0x12e9('0xae')],_0x12e9('0xaf'),_0x558f00[_0x12e9('0x55')],_0x12e9('0x74'),_0x558f00[_0x12e9('0x61')]);delete this[_0x12e9('0x19')][_0xc3ce96[_0x12e9('0xae')]];};Preview[_0x12e9('0x12')][_0x12e9('0xec')]=function(_0x99224d,_0x12e31a,_0x1b8262,_0x36ba18,_0xa7248f){var _0x3f5f75=this;return new BPromise(function(_0x185aec,_0xa65547){if(_['isNil'](_0x12e31a)||_[_0x12e9('0x70')](_0x12e31a['Contact'])||_[_0x12e9('0x70')](_0x12e31a['Contact'][_0x12e9('0xed')])||_[_0x12e9('0x70')](_0x12e31a[_0x12e9('0xee')])){_0xa65547(ut[_0x12e9('0x4f')](_0x12e9('0xef'),_0x36ba18,_0xa7248f));return;}var _0x1df2b6=uuid['v4']();var _0x34bd52=_0x3f5f75[_0x12e9('0x16')][_0x12e31a[_0x12e9('0x72')]['name']];var _0x5b3d32=_0x1b8262?_0x3f5f75[_0x12e9('0x1a')][_0x1b8262]['id']:undefined;_0x3f5f75['actions'][_0x1df2b6]=new Action(_0x12e31a,_0x34bd52,_0x1df2b6,_0x1b8262,_0x5b3d32);var _0x134269=_0x3f5f75[_0x12e9('0x19')][_0x1df2b6];_0x134269[_0x12e9('0xab')]=_0x36ba18;_0x134269[_0x12e9('0xac')]=_0xa7248f;_0x134269['lookAgent']=_0x1b8262;if(_[_0x12e9('0xf0')](_0x99224d)){_0x3f5f75[_0x12e9('0xf1')](_0x134269,_0x34bd52,_0x12e31a,_0x1b8262)[_0x12e9('0xf2')](function(_0x56bef2){logger['info']('[Preview][execCall][success]',_0x12e9('0xf3')+_0x134269[_0x12e9('0x73')]+_0x12e9('0xf4')+_0x134269[_0x12e9('0xf5')],JSON['stringify'](_0x56bef2));ami[_0x12e9('0x29')](_0x12e9('0xf6'),ut[_0x12e9('0xb1')](_0x134269,_0x12e9('0xf7')));_0x185aec(ut[_0x12e9('0x4f')](_0x12e9('0xf8')));})[_0x12e9('0x7b')](function(_0x4650ff){ut[_0x12e9('0x64')](_0x12e9('0xf9'),_0x4650ff);_0xa65547(ut['message']('Call\x20failed',_0x36ba18,_0xa7248f));});}else{_0x34bd52[_0x12e9('0x3e')]+=0x1;ut[_0x12e9('0xfa')](_0x134269);rpcDb[_0x12e9('0xfb')](_0x134269,'[Blacklist][error]');delete _0x3f5f75[_0x12e9('0x19')][_0x1df2b6];_0xa65547(ut['message'](_0x12e9('0xfc'),_0x36ba18,_0xa7248f));}});};Preview[_0x12e9('0x12')][_0x12e9('0x9b')]=function(_0x2a4d1a){return!_[_0x12e9('0x70')](_0x2a4d1a)&&!_[_0x12e9('0x70')](_0x2a4d1a[_0x12e9('0x55')])&&!_['isNil'](_0x2a4d1a[_0x12e9('0x56')])&&_0x2a4d1a[_0x12e9('0x56')]&&!_['isNil'](this[_0x12e9('0x18')][util['format'](_0x12e9('0xfd'),_0x2a4d1a[_0x12e9('0x55')])])&&!_[_0x12e9('0x70')](this['trunks'][util[_0x12e9('0x59')]('SIP/%s',_0x2a4d1a[_0x12e9('0x55')])]['status'])&&(this[_0x12e9('0x18')][util[_0x12e9('0x59')](_0x12e9('0xfd'),_0x2a4d1a['name'])][_0x12e9('0x79')]==='reachable'||this[_0x12e9('0x18')][util[_0x12e9('0x59')](_0x12e9('0xfd'),_0x2a4d1a[_0x12e9('0x55')])][_0x12e9('0x79')]===_0x12e9('0xfe'));};Preview[_0x12e9('0x12')]['run']=function(_0x1357f7,_0x20a846){var _0xae93d9=this;return new BPromise(function(_0x1b6e70,_0x2fbf24){_0xae93d9[_0x12e9('0xff')](_0x1357f7,_0x20a846)[_0x12e9('0xf2')](function(_0x12337b){_0x1b6e70(_[_0x12e9('0x76')](_0x12337b,[_0x12e9('0x4f')]));})[_0x12e9('0x7b')](function(_0x449a9e){if(_0x449a9e['unlock']){rpcDb[_0x12e9('0x100')](_0x1357f7);}if(_0x449a9e[_0x12e9('0x56')]){rpcDb[_0x12e9('0x101')](_0x1357f7);}_0x2fbf24(_[_0x12e9('0x76')](_0x449a9e,[_0x12e9('0x4f')]));});});};Preview['prototype'][_0x12e9('0xff')]=function(_0x4eb0be,_0x1d321a){var _0x1c97dd=this;return new BPromise(function(_0x27bcdf,_0xd197e0){var _0x512789,_0x954682;rpcDb[_0x12e9('0x102')](_0x4eb0be)[_0x12e9('0xf2')](function(_0x5b4d53){if(!_[_0x12e9('0x70')](_0x5b4d53[0x0])){_0x954682=_0x5b4d53[0x0][_0x12e9('0x103')]?![]:!![];_0x512789=_0x5b4d53[0x0]['recallme']?!![]:![];_0x512789=_0x1d321a?!![]:_0x512789;}var _0x30c2fb=_0x1c97dd[_0x12e9('0x104')](_0x5b4d53);if(_0x30c2fb[_0x12e9('0x105')]){rpcDb['checkIsBlackList'](_[_0x12e9('0x76')](_0x5b4d53[0x0],[_0x12e9('0xee'),_0x12e9('0x106')]))['then'](function(_0x51576c){_0x1c97dd['checkInBlack'](_0x51576c,_0x5b4d53[0x0],_0x1d321a,_0x954682,_0x512789)[_0x12e9('0xf2')](function(_0x44e7d5){_0x27bcdf(_0x44e7d5);})[_0x12e9('0x7b')](function(_0x3c23f9){_0xd197e0(_0x3c23f9);});})[_0x12e9('0x7b')](function(_0x793e1c){ut[_0x12e9('0x64')](_0x12e9('0x107'),_0x793e1c);_0xd197e0(ut[_0x12e9('0x4f')](_0x12e9('0x108'),_0x954682,_0x512789));});}else{_0xd197e0(ut[_0x12e9('0x4f')](_0x30c2fb['message'],_0x954682,_0x512789));}})[_0x12e9('0x7b')](function(_0x55cf6e){ut[_0x12e9('0x64')](_0x12e9('0x109'),_0x55cf6e);_0xd197e0(ut[_0x12e9('0x4f')](_0x12e9('0x108'),![],!![]));});});};Preview[_0x12e9('0x12')][_0x12e9('0x104')]=function(_0x1b4ac4){if(_[_0x12e9('0x70')](_0x1b4ac4)||_[_0x12e9('0xf0')](_0x1b4ac4)||!_[_0x12e9('0x70')](_0x1b4ac4[0x0][_0x12e9('0x88')])&&_[_0x12e9('0x70')](_0x1b4ac4[0x0][_0x12e9('0x88')][_0x12e9('0x55')])){ut['logger']('[Preview][validateContact][Empty\x20Contact]',_0x1b4ac4);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x2e545b=this['campaignsPreview'][_0x1b4ac4[0x0][_0x12e9('0x72')]['name']];_0x2e545b['message']=_0x12e9('0x9e');if(_[_0x12e9('0x70')](_0x2e545b)){ut[_0x12e9('0x64')]('[Preview][validateContact][Empty\x20Campaign]',_0x2e545b);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this['isTrunkReachable'](_0x2e545b['Trunk'])){ut['logger'](_0x12e9('0x10a'),_0x12e9('0x10b')+_0x2e545b[_0x12e9('0x55')]+_0x12e9('0x10c'));if(!this['isTrunkReachable'](_0x2e545b[_0x12e9('0x9c')])){ut['logger'](_0x12e9('0x10a'),_0x2e545b['name']+_0x12e9('0x10d'));return{'isValid':![],'message':_0x12e9('0x10e')};}}if(!ut[_0x12e9('0x9a')](_0x2e545b[_0x12e9('0x6c')])){ut[_0x12e9('0x64')]('[Preview][validateContact][Campaign\x20Active]',_0x2e545b[_0x12e9('0x55')]+_0x12e9('0x10f'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x2e545b[_0x12e9('0x55')]+_0x12e9('0x10f')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x12e9('0x12')][_0x12e9('0xf1')]=function(_0x18aaff,_0x1f79fa,_0x703d87,_0x264863){var _0x3ec9cf=this;return new BPromise(function(_0x1e922a,_0x1aebb4){var _0xfd4f8b=_0x18aaff[_0x12e9('0xae')];var _0x269420=_0x3ec9cf[_0x12e9('0x9b')](_0x1f79fa['Trunk'])?util[_0x12e9('0x59')](_0x12e9('0x110'),_0x1f79fa['Trunk'][_0x12e9('0x55')],_[_0x12e9('0x70')](_0x1f79fa['dialPrefix'])?'':_0x1f79fa['dialPrefix'][_0x12e9('0x111')]()||'',_0x1f79fa[_0x12e9('0x112')]>0x0?_0x703d87[_0x12e9('0x113')][_0x12e9('0xed')][_0x12e9('0x114')](_0x1f79fa[_0x12e9('0x112')]):_0x703d87[_0x12e9('0x113')][_0x12e9('0xed')]):util[_0x12e9('0x59')](_0x12e9('0x110'),_[_0x12e9('0x70')](_0x1f79fa['TrunkBackup'])?_0x1f79fa['Trunk'][_0x12e9('0x55')]:_0x1f79fa[_0x12e9('0x9c')][_0x12e9('0x55')],_[_0x12e9('0x70')](_0x1f79fa[_0x12e9('0x3b')])?'':_0x1f79fa[_0x12e9('0x3b')][_0x12e9('0x111')]()||'',_0x1f79fa[_0x12e9('0x112')]>0x0?_0x703d87['Contact'][_0x12e9('0xed')]['substring'](_0x1f79fa[_0x12e9('0x112')]):_0x703d87[_0x12e9('0x113')][_0x12e9('0xed')]);var _0x3cc2db=_0x3ec9cf[_0x12e9('0x9b')](_0x1f79fa[_0x12e9('0x54')])?ut['getCallerId'](_0x1f79fa[_0x12e9('0x54')]['callerid'],_0x1f79fa[_0x12e9('0x39')],_0x1f79fa['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x12e9('0x115')](_0x1f79fa[_0x12e9('0x3a')],_0x1f79fa[_0x12e9('0x116')]):_0x1f79fa['dialOriginateCallerIdNumber']):ut[_0x12e9('0x117')](_['isNil'](_0x1f79fa[_0x12e9('0x9c')])?_0x1f79fa[_0x12e9('0x54')][_0x12e9('0x57')]:_0x1f79fa[_0x12e9('0x9c')][_0x12e9('0x57')],_0x1f79fa[_0x12e9('0x39')],_0x1f79fa[_0x12e9('0x116')]>0x0?ut[_0x12e9('0x115')](_0x1f79fa['dialOriginateCallerIdNumber'],_0x1f79fa[_0x12e9('0x116')]):_0x1f79fa[_0x12e9('0x3a')]);if(_0x3cc2db){_0x18aaff[_0x12e9('0x118')]=ut[_0x12e9('0x119')](_0x3cc2db);_0x18aaff[_0x12e9('0x11a')]=ut[_0x12e9('0x11b')](_0x3cc2db);}var _0x23912f=ut[_0x12e9('0x11c')](_0x1f79fa,_0x703d87,_0x269420,_0x3cc2db,_0xfd4f8b,_0x18aaff);_[_0x12e9('0x11d')](_0x18aaff,ut[_0x12e9('0x11e')](_0x23912f));_0x18aaff[_0x12e9('0x8d')]=moment()[_0x12e9('0x59')](_0x12e9('0x8e'));ami[_0x12e9('0x78')](ut[_0x12e9('0x11f')](_0x18aaff,_0x1f79fa,_0x23912f,_0x18aaff[_0x12e9('0xac')],_0x264863))[_0x12e9('0xf2')](function(_0xc631d){_0x1f79fa['originated']+=0x1;logger[_0x12e9('0x5b')](_0x12e9('0x120'),_0xfd4f8b,_0x12e9('0xaf'),_0x1f79fa[_0x12e9('0x55')],_0x12e9('0x74'),_0x1f79fa[_0x12e9('0x61')]);_0x1e922a(_0xc631d);})[_0x12e9('0x7b')](function(_0x5234a1){ut[_0x12e9('0xe5')](_0x18aaff,0xe,'OriginateError');rpcDb['createAgentHistory'](_0x18aaff,_0x12e9('0x121'));_0x1aebb4(_0x5234a1);});});};Preview['prototype'][_0x12e9('0x22')]=function(_0x100080){if(this[_0x12e9('0x19')][_0x100080[_0x12e9('0xbd')]]){this[_0x12e9('0x19')][_0x100080['linkedid']][_0x12e9('0x7a')]=_0x100080['channel'];}};Preview['prototype'][_0x12e9('0x1c')]=function(_0x1f295c){var _0x342c90=this;var _0xf1f0ce=this[_0x12e9('0x19')][_0x1f295c[_0x12e9('0x122')]];if(_0xf1f0ce){if(_0xf1f0ce[_0x12e9('0x123')]&&this[_0x12e9('0x1a')][_0xf1f0ce[_0x12e9('0x123')]]){ut[_0x12e9('0x124')](_0xf1f0ce,this[_0x12e9('0x1a')][_0xf1f0ce[_0x12e9('0x123')]]['name'],this[_0x12e9('0x1a')][_0xf1f0ce[_0x12e9('0x123')]]['id']);}var _0xecba07=_['clone'](_0xf1f0ce);_0xecba07['responsetime']=moment()[_0x12e9('0x59')](_0x12e9('0x8e'));var _0x549fcc=_0x342c90[_0x12e9('0x16')][_0xf1f0ce[_0x12e9('0x73')]];if(ut[_0x12e9('0x125')](_0x1f295c[_0x12e9('0x126')])){if(_0xf1f0ce[_0x12e9('0xab')]){rpcDb[_0x12e9('0x100')](_0xf1f0ce[_0x12e9('0xf5')]);}if(_0xf1f0ce['activeContact']){rpcDb[_0x12e9('0x101')](_0xf1f0ce['idContact']);}ami[_0x12e9('0x29')](_0x12e9('0x127'),ut[_0x12e9('0xb1')](_0xf1f0ce,'rejected'));this[_0x12e9('0x128')](_0xecba07,_0x549fcc,_0x1f295c);}else{_0xf1f0ce['starttime']=moment()['format'](_0x12e9('0x8e'));ut[_0x12e9('0xe5')](_0xecba07,0x4,_0x12e9('0xb8'));rpcDb[_0x12e9('0xe6')](_0xecba07,_0x12e9('0x129'));}}};Preview[_0x12e9('0x12')][_0x12e9('0x1d')]=function(_0x3258e4){var _0x1aaa9e=this;var _0x4d441e=this[_0x12e9('0x19')][_0x3258e4['linkedid']];var _0x4e75e1;if(_0x4d441e){_0x4e75e1=this[_0x12e9('0x16')][_0x4d441e['queue']];logger[_0x12e9('0x5b')](_0x12e9('0x12a'),_0x3258e4[_0x12e9('0xbd')],_0x12e9('0xaf'),_0x4e75e1[_0x12e9('0x55')],_0x12e9('0x75'),_0x4e75e1[_0x12e9('0x2f')]);}if(this['actions'][_0x3258e4[_0x12e9('0xbd')]]&&_0x3258e4[_0x12e9('0xbd')]!==_0x3258e4[_0x12e9('0xae')]){if(_0x3258e4[_0x12e9('0x12b')]==='16'&&this[_0x12e9('0x19')][_0x3258e4[_0x12e9('0xbd')]][_0x12e9('0xad')]){this['callProgressDetectingCustomer'](_0x3258e4,_0x3258e4[_0x12e9('0xbd')],_0x3258e4['cause']);}else if(this['actions'][_0x3258e4['linkedid']][_0x12e9('0xad')]){logger['info']('[syncHangup][talking][cause]',_0x3258e4[_0x12e9('0xbd')],_0x3258e4[_0x12e9('0x12b')],_0x12e9('0xaf'),_0x4e75e1[_0x12e9('0x55')],_0x12e9('0x75'),_0x4e75e1['pTalking']);this[_0x12e9('0x9f')](_0x3258e4,_0x3258e4['linkedid'],_0x3258e4['cause']);}}else if(_0x4d441e&&_['isNil'](_0x4d441e[_0x12e9('0x12c')])&&_0x4e75e1[_0x12e9('0x12d')]&&_0x3258e4['linkedid']===_0x3258e4[_0x12e9('0xae')]&&_[_0x12e9('0x70')](_0x3258e4[_0x12e9('0xe4')])&&_0x3258e4[_0x12e9('0x12b')]==='16'&&_0x3258e4['channelstate']==='6'&&_[_0x12e9('0xe2')](_0x4d441e[_0x12e9('0x12e')])){if(_0x4d441e[_0x12e9('0xab')]){rpcDb[_0x12e9('0x100')](_0x4d441e['idContact']);}if(_0x4d441e[_0x12e9('0xac')]){rpcDb['disableContact'](_0x4d441e['idContact']);}_0x3258e4[_0x12e9('0xe4')]='22';this[_0x12e9('0x128')](_0x4d441e,_0x4e75e1,_0x3258e4);}else if(_0x4d441e&&_0x4d441e[_0x12e9('0x12e')]){if(_0x3258e4['cause']==='16'&&this[_0x12e9('0x19')][_0x3258e4['linkedid']]['dialAnswer']){logger['info']('[syncHangup][talking][transfer]',_0x3258e4[_0x12e9('0xbd')],_0x3258e4[_0x12e9('0x12b')],_0x12e9('0xaf'),_0x4e75e1[_0x12e9('0x55')],'pTalking:\x20',_0x4e75e1[_0x12e9('0x2f')]);this[_0x12e9('0x9f')](_0x3258e4,_0x3258e4[_0x12e9('0xbd')],_0x3258e4['cause']);}else if(this[_0x12e9('0x19')][_0x3258e4[_0x12e9('0xbd')]][_0x12e9('0xad')]){logger[_0x12e9('0x5b')]('[syncHangup][talking][cause]',_0x3258e4[_0x12e9('0xbd')],_0x3258e4[_0x12e9('0x12b')],'\x20Queue',_0x4e75e1[_0x12e9('0x55')],'pTalking:\x20',_0x4e75e1[_0x12e9('0x2f')]);this[_0x12e9('0x9f')](_0x3258e4,_0x3258e4[_0x12e9('0xbd')],_0x3258e4['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x252ea8){if(this['actions'][_0x252ea8['destlinkedid']]&&_0x252ea8['destlinkedid']!==_0x252ea8['destuniqueid']){this['callProgressDetectingCustomer'](_0x252ea8,_0x252ea8[_0x12e9('0xe1')],_0x252ea8[_0x12e9('0xdd')]);}};Preview[_0x12e9('0x12')][_0x12e9('0x1e')]=function(_0x40c4d5){if(this[_0x12e9('0x19')][_0x40c4d5['linkedid']]&&_0x40c4d5[_0x12e9('0xbd')]!==_0x40c4d5[_0x12e9('0xae')]&&!this[_0x12e9('0x19')][_0x40c4d5[_0x12e9('0xbd')]][_0x12e9('0xad')]){if(_0x40c4d5[_0x12e9('0x12b')]==='1'){this[_0x12e9('0x9f')](_0x40c4d5,_0x40c4d5[_0x12e9('0xbd')],_0x40c4d5[_0x12e9('0x12b')]);}}};Preview[_0x12e9('0x12')][_0x12e9('0x12f')]=function(_0x1b190c,_0x400571,_0x502617){if(this[_0x12e9('0x19')][_0x1b190c]){if(_['isNil'](this[_0x12e9('0x19')][_0x1b190c][_0x12e9('0x130')])){this['actions'][_0x1b190c][_0x12e9('0x130')]={};}this[_0x12e9('0x19')][_0x1b190c]['variables'][_0x400571]=_0x502617;}};Preview[_0x12e9('0x12')][_0x12e9('0x24')]=function(_0x43e176){try{if(!_['isNil'](_0x43e176)){if(ut[_0x12e9('0x131')](_[_0x12e9('0x132')](_0x43e176[_0x12e9('0x133')])[0x0])){this[_0x12e9('0x12f')](_0x43e176[_0x12e9('0xae')],_['keys'](_0x43e176[_0x12e9('0x133')])[0x0],_0x43e176[_0x12e9('0x134')]);}}}catch(_0x229368){logger[_0x12e9('0x135')](_0x12e9('0x136'),util[_0x12e9('0x137')](_0x229368,{'showHidden':![],'depth':null}));}};Preview[_0x12e9('0x12')][_0x12e9('0x26')]=function(_0x593d56){if(_0x593d56){if(this['actions'][_0x593d56['transfertargetlinkedid']]){this[_0x12e9('0x19')][_0x593d56[_0x12e9('0x138')]]['transfer']=!![];}}};Preview[_0x12e9('0x12')][_0x12e9('0x27')]=function(_0x4aa92e){if(_0x4aa92e){if(this['actions'][_0x4aa92e['transfererlinkedid']]){this[_0x12e9('0x19')][_0x4aa92e[_0x12e9('0x139')]]['transfer']=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0xda70=['\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','substring','dialCutDigit','trim','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','merge','toLowerVariables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','channel','actionid','logLookAgent','clone','isFailure','response','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','statedesc','channelstate','transfer','[syncHangup][talking][cause]','destuniqueid','addVariable','variables','keys','variable','value','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','campaignsPreview','trunks','actions','agents','originateresponse','syncOriginateResponse','hangup','syncHangup','hanguprequest','syncHangupRequest','bind','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','emit','type','name','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','total','unmanaged','abandoned','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','callerid','Interval','stringify','format','voice_queue:save','info','voice:queue:%s','voice_queue_channel:remove','sendMessageOneNotActive','pTalking','paused','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','\x20is\x20disactive','loopCampaigns','syncCampaigns','hasOwnProperty','booked','clockClearZombieChannels','clearZombieChannels','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','dialAnswer','pick','contactId','ListId','Action','status','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','size','getContactRecallMe','length','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','then','[RecallMe]','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','RecallFailedTimeout','createCustomerFinal','[HistoryRecallClose]','[getContactRecallMe]','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','linkedid','ANSWER','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','pTalking:\x20','custom:agentconnect','buildObj','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','decrementTalkink','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','Busy','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','unlockAgent','activeContact','NOANSWER','outboundNoAnswerCallsDay','NoAnswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','countabandonedetry','dialAbandonedMaxRety','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedRetryFrequency','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','execRun','unlockContact','recallme','validateContact','VoiceQueueId','Contact.phone','Call\x20unsuccessful','[Preview][getContactPreview]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','campaign\x20Name:\x20'];(function(_0x5e590b,_0x45a5b5){var _0x5bb18e=function(_0x2dec92){while(--_0x2dec92){_0x5e590b['push'](_0x5e590b['shift']());}};_0x5bb18e(++_0x45a5b5);}(_0xda70,0x183));var _0x0da7=function(_0x3c6125,_0x3b2a9c){_0x3c6125=_0x3c6125-0x0;var _0x2f47b8=_0xda70[_0x3c6125];return _0x2f47b8;};'use strict';var util=require(_0x0da7('0x0'));var _=require(_0x0da7('0x1'));var BPromise=require('bluebird');var uuid=require(_0x0da7('0x2'));var moment=require(_0x0da7('0x3'));var md5=require(_0x0da7('0x4'));var Redis=require(_0x0da7('0x5'));var config=require(_0x0da7('0x6'));var logger=require(_0x0da7('0x7'))(_0x0da7('0x8'));var loggerAction=require(_0x0da7('0x7'))(_0x0da7('0x9'));var ami=require(_0x0da7('0xa'));var rpcDb=require(_0x0da7('0xb'));var Action=require(_0x0da7('0xc'));var ut=require(_0x0da7('0xd'));config[_0x0da7('0xe')]=_[_0x0da7('0xf')](config[_0x0da7('0xe')],{'host':_0x0da7('0x10'),'port':0x18eb});var io=require(_0x0da7('0x11'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x0da7('0x12')][_0x0da7('0x13')]=function(_0xdbf6bf){this[_0x0da7('0x14')]=this[_0x0da7('0x14')]?this['tail'][_0x0da7('0x15')](_0xdbf6bf):_0xdbf6bf();};function Preview(_0x400cac){this['sequence']=new Sequence();this[_0x0da7('0x16')]=_0x400cac['voiceQueues'];this[_0x0da7('0x17')]=_0x400cac[_0x0da7('0x17')];this[_0x0da7('0x18')]={};this[_0x0da7('0x19')]=_0x400cac['agents'];this['clockClearZombieChannels']=0x0;ami['on'](_0x0da7('0x1a'),this[_0x0da7('0x1b')]['bind'](this));ami['on'](_0x0da7('0x1c'),this[_0x0da7('0x1d')]['bind'](this));ami['on'](_0x0da7('0x1e'),this[_0x0da7('0x1f')][_0x0da7('0x20')](this));ami['on'](_0x0da7('0x21'),this[_0x0da7('0x22')][_0x0da7('0x20')](this));ami['on'](_0x0da7('0x23'),this[_0x0da7('0x24')][_0x0da7('0x20')](this));ami['on'](_0x0da7('0x25'),this[_0x0da7('0x26')][_0x0da7('0x20')](this));ami['on'](_0x0da7('0x27'),this[_0x0da7('0x28')][_0x0da7('0x20')](this));ami['on']('blindtransfer',this[_0x0da7('0x29')][_0x0da7('0x20')](this));this['loopCampaigns'](this[_0x0da7('0x16')]);}function emit(_0x3066f5,_0x20106f,_0x3ec36c){io['to'](_0x3066f5)[_0x0da7('0x2a')](_0x20106f,_0x3ec36c);}function emitCampaignPreview(_0x435c77){if(_0x435c77[_0x0da7('0x2b')]==='outbound'){var _0x3bebc4={'id':_0x435c77['id'],'name':_0x435c77[_0x0da7('0x2c')],'strategy':_0x435c77['strategy'],'answered':_0x435c77[_0x0da7('0x2d')],'available':_0x435c77[_0x0da7('0x2e')],'loggedIn':_0x435c77[_0x0da7('0x2f')],'pTalking':_0x435c77['pTalking'],'sumBillable':_0x435c77[_0x0da7('0x30')],'sumDuration':_0x435c77[_0x0da7('0x31')],'sumHoldTime':_0x435c77[_0x0da7('0x32')]||0x0,'talking':_0x435c77['talking'],'total':_0x435c77[_0x0da7('0x33')],'type':_0x435c77[_0x0da7('0x2b')],'unmanaged':_0x435c77[_0x0da7('0x34')],'abandoned':_0x435c77[_0x0da7('0x35')],'waiting':_0x435c77[_0x0da7('0x36')],'loggedInDb':_0x435c77[_0x0da7('0x37')],'dialActive':_0x435c77['dialActive'],'dialMethod':_0x435c77[_0x0da7('0x38')],'dialOriginateCallerIdName':_0x435c77[_0x0da7('0x39')],'dialOriginateCallerIdNumber':_0x435c77[_0x0da7('0x3a')],'dialOriginateTimeout':_0x435c77[_0x0da7('0x3b')],'dialPrefix':_0x435c77[_0x0da7('0x3c')],'outboundAnswerAgiCallsDay':_0x435c77[_0x0da7('0x3d')],'outboundAnswerCallsDay':_0x435c77[_0x0da7('0x3e')],'outboundBlacklistCallsDay':_0x435c77[_0x0da7('0x3f')],'outboundBusyCallsDay':_0x435c77[_0x0da7('0x40')],'outboundCongestionCallsDay':_0x435c77[_0x0da7('0x41')],'outboundDropCallsDayACS':_0x435c77['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x435c77[_0x0da7('0x42')],'outboundDropCallsDayTimeout':_0x435c77[_0x0da7('0x43')],'outboundNoAnswerCallsDay':_0x435c77['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x435c77[_0x0da7('0x44')],'outboundOriginateFailureCallsDay':_0x435c77[_0x0da7('0x45')],'outboundReCallsDay':_0x435c77[_0x0da7('0x46')],'outboundRejectCallsDay':_0x435c77[_0x0da7('0x47')],'outboundUnknownCallsDay':_0x435c77[_0x0da7('0x48')],'outboundAbandonedCallsDay':_0x435c77[_0x0da7('0x49')],'predictiveIntervalAnsweredCalls':_0x435c77[_0x0da7('0x4a')],'predictiveIntervalAvgHoldtime':_0x435c77['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x435c77[_0x0da7('0x4b')],'predictiveIntervalDroppedCallsCallersExit':_0x435c77[_0x0da7('0x4c')],'predictiveIntervalDroppedCallsTimeout':_0x435c77[_0x0da7('0x4d')],'predictiveIntervalErlangCalls':_0x435c77[_0x0da7('0x4e')],'predictiveIntervalErlangCallsDroppedCalls':_0x435c77[_0x0da7('0x4f')],'predictiveIntervalHitRate':_0x435c77[_0x0da7('0x50')],'predictiveIntervalMultiplicativeFactor':_0x435c77[_0x0da7('0x51')],'predictiveIntervalPauses':_0x435c77[_0x0da7('0x52')],'predictiveIntervalAvailable':_0x435c77[_0x0da7('0x53')],'predictiveIntervalTotalCalls':_0x435c77[_0x0da7('0x54')],'message':_0x435c77[_0x0da7('0x55')],'originated':_0x435c77[_0x0da7('0x56')],'erlangCalls':_0x435c77[_0x0da7('0x57')],'erlangCallToSecond':_0x435c77[_0x0da7('0x58')],'erlangAbandonmentRate':_0x435c77[_0x0da7('0x59')],'erlangBusyFactor':_0x435c77[_0x0da7('0x5a')],'startPredictive':_0x435c77['startPredictive'],'startProgressive':_0x435c77['startProgressive']};if(_0x435c77[_0x0da7('0x5b')]){_0x3bebc4[_0x0da7('0x5b')]={'id':_0x435c77[_0x0da7('0x5b')]['id'],'name':_0x435c77[_0x0da7('0x5b')]['name'],'active':_0x435c77['Trunk']['active'],'callerid':_0x435c77[_0x0da7('0x5b')][_0x0da7('0x5c')]};}if(_0x435c77['Interval']){_0x3bebc4[_0x0da7('0x5d')]={'id':_0x435c77[_0x0da7('0x5d')]['id'],'name':_0x435c77[_0x0da7('0x5d')][_0x0da7('0x2c')]};}var _0x451ae8=md5(JSON[_0x0da7('0x5e')](_0x3bebc4));if(_0x435c77[_0x0da7('0x4')]!==_0x451ae8){_0x435c77[_0x0da7('0x4')]=_0x451ae8;emit(util[_0x0da7('0x5f')]('voice:queue:%s',_0x3bebc4[_0x0da7('0x2c')]),_0x0da7('0x60'),_0x3bebc4);}}}function emitVoiceQueueChannelRemove(_0x4cc4f1){logger[_0x0da7('0x61')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x0da7('0x5e')](_0x4cc4f1));emit(util[_0x0da7('0x5f')](_0x0da7('0x62'),_0x4cc4f1[_0x0da7('0x2c')]),_0x0da7('0x63'),_0x4cc4f1);}function notSendMessagesQueue(_0x49dc5d){if(_0x49dc5d[_0x0da7('0x64')]){if(_0x49dc5d[_0x0da7('0x56')]===0x0&&_0x49dc5d[_0x0da7('0x65')]===0x0){_0x49dc5d[_0x0da7('0x64')]=![];_0x49dc5d[_0x0da7('0x2e')]=0x0;_0x49dc5d[_0x0da7('0x66')]=0x0;_0x49dc5d[_0x0da7('0x55')]='NOT_ACTIVE';ut[_0x0da7('0x67')](_0x0da7('0x68'),_0x49dc5d['name']+'\x20is\x20not\x20active');}else{_0x49dc5d[_0x0da7('0x55')]=_0x0da7('0x69');ut[_0x0da7('0x67')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x49dc5d[_0x0da7('0x2c')]+_0x0da7('0x6a'));}emitCampaignPreview(_0x49dc5d);}}Preview[_0x0da7('0x12')][_0x0da7('0x6b')]=function(){var _0x50a36e=this;setInterval(function(){_0x50a36e[_0x0da7('0x6c')]();},0x7cf);};Preview['prototype'][_0x0da7('0x6c')]=function(){var _0x1a1641=this['campaignsPreview'];this['clockClearZombieChannels']+=0x1;for(var _0x345469 in _0x1a1641){if(_0x1a1641[_0x0da7('0x6d')](_0x345469)&&(_0x1a1641[_0x345469][_0x0da7('0x38')]===_0x0da7('0x8')||_0x1a1641[_0x345469][_0x0da7('0x38')]===_0x0da7('0x6e'))&&_0x1a1641[_0x345469][_0x0da7('0x2b')]==='outbound'){if(this[_0x0da7('0x6f')]>0x7){this[_0x0da7('0x6f')]=0x0;this[_0x0da7('0x70')]();}}if(_0x1a1641[_0x0da7('0x6d')](_0x345469)&&_0x1a1641[_0x345469][_0x0da7('0x38')]===_0x0da7('0x8')&&_0x1a1641[_0x345469][_0x0da7('0x2b')]===_0x0da7('0x71')){if(_0x1a1641[_0x345469][_0x0da7('0x72')]){this[_0x0da7('0x73')](_0x1a1641[_0x345469]);this[_0x0da7('0x74')](_0x1a1641[_0x345469]);}else{notSendMessagesQueue(_0x1a1641[_0x345469]);}}}};Preview['prototype'][_0x0da7('0x75')]=function(_0x51ee1c){var _0x2f86bb=this;this[_0x0da7('0x76')]['enqueue'](function(){if(!_[_0x0da7('0x77')](_0x2f86bb[_0x0da7('0x18')][_0x51ee1c])){loggerAction[_0x0da7('0x61')]('[clearZombieChannels][talking]',_0x51ee1c,_0x0da7('0x78'),_0x2f86bb['actions'][_0x51ee1c][_0x0da7('0x79')],_0x0da7('0x7a'),JSON['stringify'](_0x2f86bb[_0x0da7('0x16')][_0x2f86bb[_0x0da7('0x18')][_0x51ee1c][_0x0da7('0x79')]][_0x0da7('0x56')]),'pTalking:\x20',JSON['stringify'](_0x2f86bb['campaignsPreview'][_0x2f86bb[_0x0da7('0x18')][_0x51ee1c][_0x0da7('0x79')]][_0x0da7('0x65')]),JSON[_0x0da7('0x5e')](_0x2f86bb[_0x0da7('0x18')][_0x51ee1c][_0x0da7('0x7b')]),JSON[_0x0da7('0x5e')](_[_0x0da7('0x7c')](_0x2f86bb[_0x0da7('0x18')][_0x51ee1c],[_0x0da7('0x7d'),'UserId','VoiceQueueId',_0x0da7('0x7e')])));return ami[_0x0da7('0x7f')]({'action':_0x0da7('0x80'),'channel':_0x2f86bb[_0x0da7('0x18')][_0x51ee1c]['channel']})[_0x0da7('0x81')](function(_0x51b165){if(_0x51b165[_0x0da7('0x55')]===_0x0da7('0x82')){setTimeout(function(){if(_0x2f86bb['actions'][_0x51ee1c]){ut[_0x0da7('0x83')](_0x2f86bb[_0x0da7('0x16')][_0x2f86bb[_0x0da7('0x18')][_0x51ee1c][_0x0da7('0x79')]],_0x0da7('0x84'));if(_0x2f86bb['actions'][_0x51ee1c][_0x0da7('0x7b')]===!![]){ut['decrementTalkink'](_0x2f86bb['campaignsPreview'][_0x2f86bb[_0x0da7('0x18')][_0x51ee1c]['queue']],_0x0da7('0x84'));ut[_0x0da7('0x85')](_0x0da7('0x86')+_0x51ee1c,_0x2f86bb[_0x0da7('0x18')][_0x51ee1c]['queue']);}ut[_0x0da7('0x85')](_0x0da7('0x87')+_0x51ee1c,_0x2f86bb['actions'][_0x51ee1c][_0x0da7('0x79')]);delete _0x2f86bb[_0x0da7('0x18')][_0x51ee1c];}},0x2328);}});}});};Preview['prototype']['clearZombieChannels']=function(){var _0x16e0cb=this;loggerAction['info']('[action]',_[_0x0da7('0x88')](this[_0x0da7('0x18')]));for(var _0x2c2977 in this['actions']){if(_0x16e0cb[_0x0da7('0x18')][_0x0da7('0x6d')](_0x2c2977)){_0x16e0cb[_0x0da7('0x75')](_0x2c2977);}}};Preview[_0x0da7('0x12')]['recallMe']=function(_0x223b7f){var _0x2487f9=this;rpcDb[_0x0da7('0x89')](_0x223b7f['id'],ut['agentReadyId'](this['agents']))['then'](function(_0x469a1a){if(!_[_0x0da7('0x77')](_0x469a1a)){for(var _0x3f4ea6=0x0;_0x3f4ea6<_0x469a1a[_0x0da7('0x8a')];_0x3f4ea6+=0x1){if(ut['getDiff'](_0x469a1a[_0x3f4ea6][_0x0da7('0x8b')])<_0x223b7f[_0x0da7('0x8c')]*0x3c){if(_0x469a1a[_0x3f4ea6]['Agent']&&!_0x469a1a[_0x3f4ea6][_0x0da7('0x8d')][_0x0da7('0x8e')]){_0x2487f9[_0x0da7('0x8f')](_0x469a1a[_0x3f4ea6]['id'])[_0x0da7('0x90')](ut['logger2'](_0x0da7('0x91')))['catch'](ut[_0x0da7('0x92')]('[RecallMe]'));}else{rpcDb[_0x0da7('0x93')](_0x469a1a[_0x3f4ea6]['id']);}}else{var _0x28e6c7=new Action(_0x469a1a[_0x3f4ea6],_0x223b7f);_0x28e6c7[_0x0da7('0x94')]=moment()['format'](_0x0da7('0x95'));_0x223b7f[_0x0da7('0x46')]+=0x1;ut[_0x0da7('0x96')](_0x28e6c7,0x17,_0x0da7('0x97'));if(_0x223b7f[_0x0da7('0x98')]){rpcDb[_0x0da7('0x99')](ut[_0x0da7('0x9a')](_0x469a1a[_0x3f4ea6]));rpcDb[_0x0da7('0x9b')](_0x28e6c7,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x0da7('0x96')](_0x28e6c7,0x16,_0x0da7('0x9c'));rpcDb[_0x0da7('0x9b')](_0x28e6c7,'[HistoryRecallClose]');rpcDb[_0x0da7('0x9d')](_0x28e6c7,_0x0da7('0x9e'));}}}}})[_0x0da7('0x81')](ut[_0x0da7('0x92')](_0x0da7('0x9f')));};Preview['prototype'][_0x0da7('0x73')]=function(_0x5ae3e4){_0x5ae3e4[_0x0da7('0x64')]=!![];if(ut['IsNotLoggedIn'](_0x5ae3e4[_0x0da7('0x2f')])){_0x5ae3e4[_0x0da7('0x55')]=_0x0da7('0xa0');}else if(!ut[_0x0da7('0xa1')](_0x5ae3e4['dialActive'])){_0x5ae3e4[_0x0da7('0x55')]='NOT_ACTIVE';}else if(!this[_0x0da7('0xa2')](_0x5ae3e4[_0x0da7('0x5b')])){if(!this[_0x0da7('0xa2')](_0x5ae3e4[_0x0da7('0xa3')])){_0x5ae3e4[_0x0da7('0x55')]=_0x0da7('0xa4');}else{_0x5ae3e4[_0x0da7('0x55')]=_0x0da7('0xa5');}}else{_0x5ae3e4['message']=_0x0da7('0xa5');}emitCampaignPreview(_0x5ae3e4);};Preview[_0x0da7('0x12')][_0x0da7('0xa6')]=function(_0x129c95,_0x209225,_0x447a5f){var _0xe06095=this;var _0x1e1003=this[_0x0da7('0x18')][_0x209225];var _0x3486a5=this['campaignsPreview'][_0x1e1003[_0x0da7('0x79')]];var _0x5da448;if(_0x3486a5){switch(_0x447a5f){case'1':_0x3486a5[_0x0da7('0x44')]+=0x1;_0x1e1003[_0x0da7('0xa7')]+=0x1;_0x1e1003[_0x0da7('0xa8')]=ut[_0x0da7('0xa9')](_0x1e1003);ut[_0x0da7('0x96')](_0x1e1003,0x0,'NoSuchNumber');rpcDb[_0x0da7('0x9b')](_0x1e1003,_0x0da7('0xaa'));if(ut[_0x0da7('0xa9')](_0x1e1003)>=_0x3486a5[_0x0da7('0xab')]){_0x5da448=ut['cloneAction'](_0x1e1003,0xf,_0x0da7('0xac'));rpcDb[_0x0da7('0x9d')](_0x5da448,_0x0da7('0xad'));}else{if(_0x1e1003[_0x0da7('0xa7')]>=_0x3486a5[_0x0da7('0xae')]){rpcDb['createCustomerFinal'](_0x1e1003,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0x0da7('0xaf')](ut[_0x0da7('0xb0')](_0x1e1003,_0x0da7('0xa7'),_0x3486a5[_0x0da7('0xb1')]),_0x1e1003['unlockAgent'],_0x1e1003['activeContact']);}}delete this['actions'][_0x129c95[_0x0da7('0xb2')]];break;case _0x0da7('0xb3'):var _0x4860e4=moment()[_0x0da7('0x5f')](_0x0da7('0x95'));_0x1e1003['responsetime']=_0x4860e4;_0x1e1003[_0x0da7('0xb4')]=_0x4860e4;_0x1e1003['dialAnswer']=!![];_0x3486a5[_0x0da7('0x65')]+=0x1;logger[_0x0da7('0x61')](_0x0da7('0xb5'),_0x1e1003[_0x0da7('0xb6')],_0x0da7('0xb7'),_0x3486a5['name'],_0x0da7('0xb8'),_0x3486a5[_0x0da7('0x65')]);ami['emit'](_0x0da7('0xb9'),ut[_0x0da7('0xba')](_0x1e1003,_0x0da7('0xbb')));if(_0x3486a5[_0x0da7('0xbc')]){ami['emit'](_0x0da7('0xbd'),ut[_0x0da7('0xbe')](_0x1e1003));}break;case'16':ami['emit'](_0x0da7('0xbf'),ut['buildObj'](_0x1e1003,_0x0da7('0xc0')));emitVoiceQueueChannelRemove(ut[_0x0da7('0xba')](_0x1e1003,_0x0da7('0xc0')));_0x3486a5[_0x0da7('0x3e')]+=0x1;_0x3486a5[_0x0da7('0x33')]+=0x1;_0x3486a5[_0x0da7('0x2d')]+=0x1;ut[_0x0da7('0xc1')](_0x3486a5,_0x0da7('0xc2'));_0x1e1003['countglobal']=ut[_0x0da7('0xa9')](_0x1e1003);ut['logCustomer'](_0x1e1003,0x4,_0x0da7('0xc3'));rpcDb[_0x0da7('0x9b')](_0x1e1003,_0x0da7('0xc4'));rpcDb['createCustomerFinal'](_0x1e1003,_0x0da7('0xc5'));rpcDb[_0x0da7('0xc6')](_0x1e1003);_0x3486a5[_0x0da7('0x31')]+=_0x1e1003[_0x0da7('0xc7')];_0x3486a5[_0x0da7('0x30')]+=_0x1e1003[_0x0da7('0xc7')];logger[_0x0da7('0x61')](_0x0da7('0xc8'),_0x1e1003[_0x0da7('0xb6')],_0x0da7('0xb7'),_0x3486a5[_0x0da7('0x2c')],_0x0da7('0xb8'),_0x3486a5['pTalking']);delete this[_0x0da7('0x18')][_0x129c95[_0x0da7('0xb2')]];break;case _0x0da7('0xc9'):_0x3486a5['outboundBusyCallsDay']+=0x1;_0x1e1003[_0x0da7('0xca')]+=0x1;_0x1e1003[_0x0da7('0xa8')]=ut[_0x0da7('0xa9')](_0x1e1003);ut[_0x0da7('0x96')](_0x1e1003,0x5,_0x0da7('0xcb'));rpcDb[_0x0da7('0x9b')](_0x1e1003,'[callProgressDetectingCustomer][logBusy]');if(ut['totalGlobal'](_0x1e1003)>=_0x3486a5['dialGlobalMaxRetry']){_0x5da448=ut[_0x0da7('0xcc')](_0x1e1003,0xf,_0x0da7('0xac'));rpcDb[_0x0da7('0x9d')](_0x5da448,_0x0da7('0xcd'));}else{if(_0x1e1003[_0x0da7('0xca')]>=_0x3486a5[_0x0da7('0xce')]){rpcDb[_0x0da7('0x9d')](_0x1e1003,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x0da7('0xaf')](ut[_0x0da7('0xb0')](_0x1e1003,_0x0da7('0xca'),_0x3486a5[_0x0da7('0xcf')]),_0x1e1003[_0x0da7('0xd0')],_0x1e1003[_0x0da7('0xd1')]);}}break;case _0x0da7('0xd2'):_0x3486a5[_0x0da7('0xd3')]+=0x1;_0x1e1003['countnoanswerretry']+=0x1;_0x1e1003[_0x0da7('0xa8')]=ut['totalGlobal'](_0x1e1003);ut[_0x0da7('0x96')](_0x1e1003,0x3,_0x0da7('0xd4'));rpcDb[_0x0da7('0x9b')](_0x1e1003,_0x0da7('0xd5'));if(ut[_0x0da7('0xa9')](_0x1e1003)>=_0x3486a5[_0x0da7('0xab')]){_0x5da448=ut['cloneAction'](_0x1e1003,0xf,_0x0da7('0xac'));rpcDb[_0x0da7('0x9d')](_0x5da448,_0x0da7('0xd6'));}else{if(_0x1e1003[_0x0da7('0xd7')]>=_0x3486a5[_0x0da7('0xd8')]){rpcDb[_0x0da7('0x9d')](_0x1e1003,_0x0da7('0xd5'));}else{rpcDb[_0x0da7('0xaf')](ut['scheduledAt'](_0x1e1003,'countnoanswerretry',_0x3486a5[_0x0da7('0xd9')]),_0x1e1003[_0x0da7('0xd0')],_0x1e1003[_0x0da7('0xd1')]);}}break;case _0x0da7('0xda'):_0x3486a5[_0x0da7('0x41')]+=0x1;_0x1e1003[_0x0da7('0xdb')]+=0x1;_0x1e1003[_0x0da7('0xa8')]=ut['totalGlobal'](_0x1e1003);ut[_0x0da7('0x96')](_0x1e1003,0x8,_0x0da7('0xdc'));rpcDb[_0x0da7('0x9b')](_0x1e1003,_0x0da7('0xdd'));if(ut['totalGlobal'](_0x1e1003)>=_0x3486a5[_0x0da7('0xab')]){_0x5da448=ut['cloneAction'](_0x1e1003,0xf,_0x0da7('0xac'));rpcDb[_0x0da7('0x9d')](_0x5da448,_0x0da7('0xde'));}else{if(_0x1e1003[_0x0da7('0xdb')]>=_0x3486a5[_0x0da7('0xdf')]){rpcDb[_0x0da7('0x9d')](_0x1e1003,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x0da7('0xaf')](ut[_0x0da7('0xb0')](_0x1e1003,_0x0da7('0xdb'),_0x3486a5['dialBusyRetryFrequency']),_0x1e1003['unlockAgent'],_0x1e1003['activeContact']);}}break;case _0x0da7('0xe0'):_0x3486a5[_0x0da7('0x47')]+=0x1;_0x1e1003[_0x0da7('0xe1')]+=0x1;_0x1e1003[_0x0da7('0xa8')]=ut[_0x0da7('0xa9')](_0x1e1003);ut[_0x0da7('0x96')](_0x1e1003,0x14,_0x0da7('0xe2'));rpcDb[_0x0da7('0x9b')](_0x1e1003,'[syncHangupRequest][logAgentReject]');if(ut['totalGlobal'](_0x1e1003)>=_0x3486a5[_0x0da7('0xab')]){_0x5da448=ut[_0x0da7('0xcc')](_0x1e1003,0x14,'AgentReject');rpcDb[_0x0da7('0x9d')](_0x5da448,_0x0da7('0xe3'));}else{if(_0x1e1003['countagentrejectretry']>=_0x3486a5[_0x0da7('0xe4')]){rpcDb['createCustomerFinal'](_0x1e1003,_0x0da7('0xe3'));}else{rpcDb[_0x0da7('0xaf')](ut['scheduledAt'](_0x1e1003,_0x0da7('0xe1'),_0x3486a5[_0x0da7('0xe5')]),_0x1e1003['unlockAgent'],_0x1e1003[_0x0da7('0xd1')]);}}break;case _0x0da7('0xe6'):_0x3486a5['outboundAbandonedCallsDay']+=0x1;_0x1e1003[_0x0da7('0xe7')]+=0x1;_0x1e1003[_0x0da7('0xa8')]=ut[_0x0da7('0xa9')](_0x1e1003);ut[_0x0da7('0x96')](_0x1e1003,0xb,_0x0da7('0xe8'));rpcDb['createCustomerHistory'](_0x1e1003,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0x0da7('0xa9')](_0x1e1003)>=_0x3486a5[_0x0da7('0xab')]){_0x5da448=ut[_0x0da7('0xcc')](_0x1e1003,0xf,'Global');rpcDb[_0x0da7('0x9d')](_0x5da448,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x1e1003[_0x0da7('0xe9')]>=_0x3486a5[_0x0da7('0xea')]){rpcDb[_0x0da7('0x9d')](_0x1e1003,_0x0da7('0xeb'));}else{rpcDb[_0x0da7('0xaf')](ut[_0x0da7('0xb0')](_0x1e1003,_0x0da7('0xe7'),_0x3486a5[_0x0da7('0xec')]),_0x1e1003[_0x0da7('0xd0')],_0x1e1003[_0x0da7('0xd1')]);}}break;default:if(_0x1e1003['dialAnswer']){ut[_0x0da7('0xc1')](_0x3486a5,_0x0da7('0xed'));ut[_0x0da7('0x85')](_0x0da7('0xee')+_0x3486a5[_0x0da7('0x2c')],_0x129c95);}_0x3486a5[_0x0da7('0x48')]+=0x1;_0x1e1003['countglobal']=ut['totalGlobal'](_0x1e1003);ut['logCustomer'](_0x1e1003,0xc,_0x129c95[_0x0da7('0xef')]||_0x129c95['dialstatus']);rpcDb[_0x0da7('0x9b')](_0x1e1003,_0x0da7('0xf0'));if(ut[_0x0da7('0xa9')](_0x1e1003)>=_0x3486a5[_0x0da7('0xab')]){_0x5da448=ut[_0x0da7('0xcc')](_0x1e1003,0xf,'Global');rpcDb[_0x0da7('0x9d')](_0x5da448,_0x0da7('0xf1'));}else{rpcDb[_0x0da7('0x9d')](_0x1e1003,_0x0da7('0xf1'));}delete this[_0x0da7('0x18')][_0x129c95[_0x0da7('0xb2')]];}if(!(_0x1e1003['dialAnswer']&&_0x447a5f==='16')){ut['updateOriginated'](_0x3486a5,_0x0da7('0xf2'));logger[_0x0da7('0x61')]('[originated][decrement][callProgressDetectingCustomer]',_0x1e1003['uniqueid'],_0x0da7('0xb7'),_0x3486a5['name'],_0x0da7('0x7a'),_0x3486a5['originated']);}if(_0x447a5f!==_0x0da7('0xb3')){delete this[_0x0da7('0x18')][_0x129c95['linkedid']];delete this[_0x0da7('0x18')][_0x129c95[_0x0da7('0xf3')]];}}};Preview['prototype'][_0x0da7('0xf4')]=function(_0x529f8f,_0x360f34,_0x2acc5f){if(_[_0x0da7('0xf5')](_0x360f34)&&_0x0da7('0xf6')!==typeof _0x360f34){return;}if(_[_0x0da7('0xf5')](_0x2acc5f)&&_0x0da7('0xf6')!==typeof _0x2acc5f){return;}switch(_0x2acc5f['reason']){case'0':ut[_0x0da7('0xf7')](_0x529f8f,0x0,_0x0da7('0xf8'));rpcDb[_0x0da7('0xf9')](_0x529f8f,_0x0da7('0xfa'));break;case'3':ut[_0x0da7('0xf7')](_0x529f8f,0x3,_0x0da7('0xd4'));rpcDb[_0x0da7('0xf9')](_0x529f8f,_0x0da7('0xfb'));break;case'5':ut[_0x0da7('0xf7')](_0x529f8f,0x5,'Busy');rpcDb['createAgentHistory'](_0x529f8f,_0x0da7('0xfc'));break;case'8':ut[_0x0da7('0xf7')](_0x529f8f,0x8,_0x0da7('0xdc'));rpcDb['createAgentHistory'](_0x529f8f,_0x0da7('0xfd'));break;case'22':ut[_0x0da7('0xf7')](_0x529f8f,0x16,_0x0da7('0xfe'));rpcDb[_0x0da7('0xf9')](_0x529f8f,_0x0da7('0xff'));break;default:ut[_0x0da7('0xf7')](_0x529f8f,0xc,_0x2acc5f[_0x0da7('0x100')]);rpcDb[_0x0da7('0xf9')](_0x529f8f,_0x0da7('0xfd'));}ut[_0x0da7('0x83')](_0x360f34,_0x0da7('0x101'));logger[_0x0da7('0x61')](_0x0da7('0x102'),_0x529f8f[_0x0da7('0xb6')],'\x20Queue',_0x360f34['name'],_0x0da7('0x7a'),_0x360f34[_0x0da7('0x56')]);delete this[_0x0da7('0x18')][_0x529f8f[_0x0da7('0xb6')]];};Preview[_0x0da7('0x12')][_0x0da7('0x103')]=function(_0x6de383,_0x13b8f1,_0x4aecc1,_0xcb016b,_0x119fcd){var _0x1fb544=this;return new BPromise(function(_0x230588,_0x516b03){if(_[_0x0da7('0x77')](_0x13b8f1)||_[_0x0da7('0x77')](_0x13b8f1[_0x0da7('0x104')])||_[_0x0da7('0x77')](_0x13b8f1[_0x0da7('0x104')][_0x0da7('0x105')])||_['isNil'](_0x13b8f1['VoiceQueueId'])){_0x516b03(ut[_0x0da7('0x55')](_0x0da7('0x106'),_0xcb016b,_0x119fcd));return;}var _0x50f3a6=uuid['v4']();var _0x6e5475=_0x1fb544[_0x0da7('0x16')][_0x13b8f1[_0x0da7('0x78')][_0x0da7('0x2c')]];var _0x322617=_0x4aecc1?_0x1fb544[_0x0da7('0x19')][_0x4aecc1]['id']:undefined;_0x1fb544[_0x0da7('0x18')][_0x50f3a6]=new Action(_0x13b8f1,_0x6e5475,_0x50f3a6,_0x4aecc1,_0x322617);var _0x5d0ab6=_0x1fb544[_0x0da7('0x18')][_0x50f3a6];_0x5d0ab6['unlockAgent']=_0xcb016b;_0x5d0ab6[_0x0da7('0xd1')]=_0x119fcd;_0x5d0ab6[_0x0da7('0x107')]=_0x4aecc1;if(_[_0x0da7('0x108')](_0x6de383)){_0x1fb544[_0x0da7('0x109')](_0x5d0ab6,_0x6e5475,_0x13b8f1,_0x4aecc1)['then'](function(_0x5df8b2){logger[_0x0da7('0x61')](_0x0da7('0x10a'),_0x0da7('0x10b')+_0x5d0ab6[_0x0da7('0x79')]+_0x0da7('0x10c')+_0x5d0ab6[_0x0da7('0x10d')],JSON[_0x0da7('0x5e')](_0x5df8b2));ami[_0x0da7('0x2a')](_0x0da7('0x10e'),ut['buildObj'](_0x5d0ab6,_0x0da7('0x10f')));_0x230588(ut[_0x0da7('0x55')](_0x0da7('0x110')));})[_0x0da7('0x81')](function(_0xfffce4){ut['logger'](_0x0da7('0x111'),_0xfffce4);_0x516b03(ut[_0x0da7('0x55')](_0x0da7('0x112'),_0xcb016b,_0x119fcd));});}else{_0x6e5475['outboundBlacklistCallsDay']+=0x1;ut[_0x0da7('0x113')](_0x5d0ab6);rpcDb[_0x0da7('0x114')](_0x5d0ab6,_0x0da7('0x115'));delete _0x1fb544[_0x0da7('0x18')][_0x50f3a6];_0x516b03(ut[_0x0da7('0x55')](_0x0da7('0x116'),_0xcb016b,_0x119fcd));}});};Preview[_0x0da7('0x12')][_0x0da7('0xa2')]=function(_0x497885){return!_[_0x0da7('0x77')](_0x497885)&&!_[_0x0da7('0x77')](_0x497885[_0x0da7('0x2c')])&&!_[_0x0da7('0x77')](_0x497885[_0x0da7('0x117')])&&_0x497885[_0x0da7('0x117')]&&!_['isNil'](this[_0x0da7('0x17')][util['format'](_0x0da7('0x118'),_0x497885[_0x0da7('0x2c')])])&&!_[_0x0da7('0x77')](this[_0x0da7('0x17')][util[_0x0da7('0x5f')]('SIP/%s',_0x497885[_0x0da7('0x2c')])][_0x0da7('0x80')])&&(this['trunks'][util[_0x0da7('0x5f')](_0x0da7('0x118'),_0x497885[_0x0da7('0x2c')])][_0x0da7('0x80')]===_0x0da7('0x119')||this['trunks'][util[_0x0da7('0x5f')]('SIP/%s',_0x497885[_0x0da7('0x2c')])][_0x0da7('0x80')]===_0x0da7('0x11a'));};Preview['prototype']['run']=function(_0x120461,_0x260310){var _0x21e237=this;return new BPromise(function(_0x3a7b61,_0x49b7a5){_0x21e237[_0x0da7('0x11b')](_0x120461,_0x260310)['then'](function(_0x584b0a){_0x3a7b61(_[_0x0da7('0x7c')](_0x584b0a,['message']));})[_0x0da7('0x81')](function(_0x529697){if(_0x529697['unlock']){rpcDb[_0x0da7('0x11c')](_0x120461);}if(_0x529697[_0x0da7('0x117')]){rpcDb[_0x0da7('0x93')](_0x120461);}_0x49b7a5(_[_0x0da7('0x7c')](_0x529697,[_0x0da7('0x55')]));});});};Preview[_0x0da7('0x12')][_0x0da7('0x11b')]=function(_0x36ed36,_0x3e6ce4){var _0x496f00=this;return new BPromise(function(_0x8c7cef,_0x11992e){var _0x57a8ab,_0x57032d;rpcDb['getContactPreview'](_0x36ed36)[_0x0da7('0x90')](function(_0x3f5767){if(!_[_0x0da7('0x77')](_0x3f5767[0x0])){_0x57032d=_0x3f5767[0x0][_0x0da7('0x11d')]?![]:!![];_0x57a8ab=_0x3f5767[0x0][_0x0da7('0x11d')]?!![]:![];_0x57a8ab=_0x3e6ce4?!![]:_0x57a8ab;}var _0x2d7058=_0x496f00[_0x0da7('0x11e')](_0x3f5767);if(_0x2d7058['isValid']){rpcDb['checkIsBlackList'](_[_0x0da7('0x7c')](_0x3f5767[0x0],[_0x0da7('0x11f'),_0x0da7('0x120')]))[_0x0da7('0x90')](function(_0x31511b){_0x496f00[_0x0da7('0x103')](_0x31511b,_0x3f5767[0x0],_0x3e6ce4,_0x57032d,_0x57a8ab)[_0x0da7('0x90')](function(_0x5367ba){_0x8c7cef(_0x5367ba);})[_0x0da7('0x81')](function(_0x3117c8){_0x11992e(_0x3117c8);});})[_0x0da7('0x81')](function(_0x53e01b){ut[_0x0da7('0x67')]('[Preview][checkIsBlackList]',_0x53e01b);_0x11992e(ut[_0x0da7('0x55')](_0x0da7('0x121'),_0x57032d,_0x57a8ab));});}else{_0x11992e(ut['message'](_0x2d7058[_0x0da7('0x55')],_0x57032d,_0x57a8ab));}})[_0x0da7('0x81')](function(_0x4755da){ut[_0x0da7('0x67')](_0x0da7('0x122'),_0x4755da);_0x11992e(ut[_0x0da7('0x55')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0x0da7('0x12')][_0x0da7('0x11e')]=function(_0x45335f){if(_[_0x0da7('0x77')](_0x45335f)||_[_0x0da7('0x108')](_0x45335f)||!_['isNil'](_0x45335f[0x0][_0x0da7('0x8d')])&&_[_0x0da7('0x77')](_0x45335f[0x0][_0x0da7('0x8d')]['name'])){ut['logger']('[Preview][validateContact][Empty\x20Contact]',_0x45335f);return{'isValid':![],'message':_0x0da7('0x123')};}var _0x71c12=this[_0x0da7('0x16')][_0x45335f[0x0][_0x0da7('0x78')][_0x0da7('0x2c')]];_0x71c12[_0x0da7('0x55')]=_0x0da7('0xa5');if(_[_0x0da7('0x77')](_0x71c12)){ut['logger'](_0x0da7('0x124'),_0x71c12);return{'isValid':![],'message':_0x0da7('0x125')};}if(!this['isTrunkReachable'](_0x71c12[_0x0da7('0x5b')])){ut[_0x0da7('0x67')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x0da7('0x126')+_0x71c12[_0x0da7('0x2c')]+_0x0da7('0x127'));if(!this[_0x0da7('0xa2')](_0x71c12[_0x0da7('0xa3')])){ut[_0x0da7('0x67')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x71c12[_0x0da7('0x2c')]+_0x0da7('0x128'));return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut['isActive'](_0x71c12[_0x0da7('0x72')])){ut[_0x0da7('0x67')](_0x0da7('0x129'),_0x71c12[_0x0da7('0x2c')]+_0x0da7('0x12a'));return{'isValid':![],'message':_0x0da7('0x126')+_0x71c12[_0x0da7('0x2c')]+_0x0da7('0x12a')};}return{'isValid':!![],'message':_0x0da7('0x12b')};};Preview[_0x0da7('0x12')][_0x0da7('0x109')]=function(_0x9c837c,_0x4f44c4,_0x540fc4,_0x55537d){var _0x3977da=this;return new BPromise(function(_0x366ad4,_0x1db13){var _0x589841=_0x9c837c[_0x0da7('0xb6')];var _0x567d16=_0x3977da['isTrunkReachable'](_0x4f44c4['Trunk'])?util[_0x0da7('0x5f')](_0x0da7('0x12c'),_0x4f44c4[_0x0da7('0x5b')][_0x0da7('0x2c')],_[_0x0da7('0x77')](_0x4f44c4[_0x0da7('0x3c')])?'':_0x4f44c4[_0x0da7('0x3c')]['trim']()||'',_0x4f44c4['dialCutDigit']>0x0?_0x540fc4[_0x0da7('0x104')][_0x0da7('0x105')][_0x0da7('0x12d')](_0x4f44c4[_0x0da7('0x12e')]):_0x540fc4[_0x0da7('0x104')]['phone']):util[_0x0da7('0x5f')]('SIP/%s/%s%s',_[_0x0da7('0x77')](_0x4f44c4[_0x0da7('0xa3')])?_0x4f44c4[_0x0da7('0x5b')]['name']:_0x4f44c4[_0x0da7('0xa3')]['name'],_['isNil'](_0x4f44c4[_0x0da7('0x3c')])?'':_0x4f44c4['dialPrefix'][_0x0da7('0x12f')]()||'',_0x4f44c4[_0x0da7('0x12e')]>0x0?_0x540fc4[_0x0da7('0x104')][_0x0da7('0x105')][_0x0da7('0x12d')](_0x4f44c4[_0x0da7('0x12e')]):_0x540fc4[_0x0da7('0x104')]['phone']);var _0x55dcbd=_0x3977da['isTrunkReachable'](_0x4f44c4[_0x0da7('0x5b')])?ut[_0x0da7('0x130')](_0x4f44c4[_0x0da7('0x5b')][_0x0da7('0x5c')],_0x4f44c4[_0x0da7('0x39')],_0x4f44c4[_0x0da7('0x131')]>0x0?ut[_0x0da7('0x132')](_0x4f44c4['dialOriginateCallerIdNumber'],_0x4f44c4[_0x0da7('0x131')]):_0x4f44c4[_0x0da7('0x3a')]):ut[_0x0da7('0x130')](_[_0x0da7('0x77')](_0x4f44c4[_0x0da7('0xa3')])?_0x4f44c4[_0x0da7('0x5b')][_0x0da7('0x5c')]:_0x4f44c4['TrunkBackup'][_0x0da7('0x5c')],_0x4f44c4[_0x0da7('0x39')],_0x4f44c4[_0x0da7('0x131')]>0x0?ut[_0x0da7('0x132')](_0x4f44c4[_0x0da7('0x3a')],_0x4f44c4[_0x0da7('0x131')]):_0x4f44c4['dialOriginateCallerIdNumber']);if(_0x55dcbd){_0x9c837c[_0x0da7('0x133')]=ut[_0x0da7('0x134')](_0x55dcbd);_0x9c837c[_0x0da7('0x135')]=ut[_0x0da7('0x136')](_0x55dcbd);}var _0x7f2274=ut['addVariables'](_0x4f44c4,_0x540fc4,_0x567d16,_0x55dcbd,_0x589841,_0x9c837c);_[_0x0da7('0x137')](_0x9c837c,ut[_0x0da7('0x138')](_0x7f2274));_0x9c837c['starttime']=moment()['format'](_0x0da7('0x95'));ami[_0x0da7('0x7f')](ut[_0x0da7('0x139')](_0x9c837c,_0x4f44c4,_0x7f2274,_0x9c837c[_0x0da7('0xd1')],_0x55537d))[_0x0da7('0x90')](function(_0x4f3e51){_0x4f44c4['originated']+=0x1;logger[_0x0da7('0x61')](_0x0da7('0x13a'),_0x589841,_0x0da7('0xb7'),_0x4f44c4[_0x0da7('0x2c')],'originated:\x20',_0x4f44c4[_0x0da7('0x56')]);_0x366ad4(_0x4f3e51);})[_0x0da7('0x81')](function(_0x12c491){ut[_0x0da7('0xf7')](_0x9c837c,0xe,_0x0da7('0x13b'));rpcDb[_0x0da7('0xf9')](_0x9c837c,_0x0da7('0x13c'));_0x1db13(_0x12c491);});});};Preview[_0x0da7('0x12')][_0x0da7('0x24')]=function(_0x1b0b25){if(this[_0x0da7('0x18')][_0x1b0b25[_0x0da7('0xb2')]]){this[_0x0da7('0x18')][_0x1b0b25[_0x0da7('0xb2')]][_0x0da7('0x13d')]=_0x1b0b25['channel'];}};Preview[_0x0da7('0x12')][_0x0da7('0x1b')]=function(_0x76fad){var _0x5c513e=this;var _0x3026cc=this[_0x0da7('0x18')][_0x76fad[_0x0da7('0x13e')]];if(_0x3026cc){if(_0x3026cc[_0x0da7('0x107')]&&this[_0x0da7('0x19')][_0x3026cc['lookAgent']]){ut[_0x0da7('0x13f')](_0x3026cc,this[_0x0da7('0x19')][_0x3026cc[_0x0da7('0x107')]][_0x0da7('0x2c')],this[_0x0da7('0x19')][_0x3026cc[_0x0da7('0x107')]]['id']);}var _0x5755c7=_[_0x0da7('0x140')](_0x3026cc);_0x5755c7['responsetime']=moment()[_0x0da7('0x5f')](_0x0da7('0x95'));var _0x444333=_0x5c513e[_0x0da7('0x16')][_0x3026cc[_0x0da7('0x79')]];if(ut[_0x0da7('0x141')](_0x76fad[_0x0da7('0x142')])){if(_0x3026cc[_0x0da7('0xd0')]){rpcDb[_0x0da7('0x11c')](_0x3026cc[_0x0da7('0x10d')]);}if(_0x3026cc[_0x0da7('0xd1')]){rpcDb[_0x0da7('0x93')](_0x3026cc['idContact']);}ami[_0x0da7('0x2a')]('custom:agentringnoanswer',ut['buildObj'](_0x3026cc,_0x0da7('0x143')));this[_0x0da7('0xf4')](_0x5755c7,_0x444333,_0x76fad);}else{_0x3026cc['starttime']=moment()[_0x0da7('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0x0da7('0xf7')](_0x5755c7,0x4,_0x0da7('0xc3'));rpcDb[_0x0da7('0xf9')](_0x5755c7,_0x0da7('0x144'));}}};Preview[_0x0da7('0x12')]['syncHangup']=function(_0x3396a0){var _0x5eb9c8=this;var _0x87a065=this[_0x0da7('0x18')][_0x3396a0[_0x0da7('0xb2')]];var _0x50b2e3;if(_0x87a065){_0x50b2e3=this[_0x0da7('0x16')][_0x87a065[_0x0da7('0x79')]];logger[_0x0da7('0x61')](_0x0da7('0x145'),_0x3396a0['linkedid'],_0x0da7('0xb7'),_0x50b2e3[_0x0da7('0x2c')],_0x0da7('0xb8'),_0x50b2e3['pTalking']);}if(this[_0x0da7('0x18')][_0x3396a0['linkedid']]&&_0x3396a0[_0x0da7('0xb2')]!==_0x3396a0['uniqueid']){if(_0x3396a0[_0x0da7('0x146')]==='16'&&this[_0x0da7('0x18')][_0x3396a0['linkedid']][_0x0da7('0x7b')]){this[_0x0da7('0xa6')](_0x3396a0,_0x3396a0[_0x0da7('0xb2')],_0x3396a0['cause']);}else if(this['actions'][_0x3396a0[_0x0da7('0xb2')]][_0x0da7('0x7b')]){logger['info']('[syncHangup][talking][cause]',_0x3396a0['linkedid'],_0x3396a0['cause'],_0x0da7('0xb7'),_0x50b2e3[_0x0da7('0x2c')],'pTalking:\x20',_0x50b2e3[_0x0da7('0x65')]);this[_0x0da7('0xa6')](_0x3396a0,_0x3396a0[_0x0da7('0xb2')],_0x3396a0['cause']);}}else if(_0x87a065&&_['isNil'](_0x87a065[_0x0da7('0x147')])&&_0x50b2e3['dialQueueProject']&&_0x3396a0[_0x0da7('0xb2')]===_0x3396a0[_0x0da7('0xb6')]&&_[_0x0da7('0x77')](_0x3396a0[_0x0da7('0x100')])&&_0x3396a0[_0x0da7('0x146')]==='16'&&_0x3396a0[_0x0da7('0x148')]==='6'&&_[_0x0da7('0xf5')](_0x87a065[_0x0da7('0x149')])){if(_0x87a065[_0x0da7('0xd0')]){rpcDb['unlockContact'](_0x87a065['idContact']);}if(_0x87a065[_0x0da7('0xd1')]){rpcDb[_0x0da7('0x93')](_0x87a065[_0x0da7('0x10d')]);}_0x3396a0[_0x0da7('0x100')]='22';this[_0x0da7('0xf4')](_0x87a065,_0x50b2e3,_0x3396a0);}else if(_0x87a065&&_0x87a065[_0x0da7('0x149')]){if(_0x3396a0[_0x0da7('0x146')]==='16'&&this[_0x0da7('0x18')][_0x3396a0[_0x0da7('0xb2')]][_0x0da7('0x7b')]){logger['info']('[syncHangup][talking][transfer]',_0x3396a0['linkedid'],_0x3396a0[_0x0da7('0x146')],_0x0da7('0xb7'),_0x50b2e3[_0x0da7('0x2c')],'pTalking:\x20',_0x50b2e3['pTalking']);this['callProgressDetectingCustomer'](_0x3396a0,_0x3396a0[_0x0da7('0xb2')],_0x3396a0[_0x0da7('0x146')]);}else if(this[_0x0da7('0x18')][_0x3396a0['linkedid']][_0x0da7('0x7b')]){logger[_0x0da7('0x61')](_0x0da7('0x14a'),_0x3396a0[_0x0da7('0xb2')],_0x3396a0[_0x0da7('0x146')],_0x0da7('0xb7'),_0x50b2e3['name'],_0x0da7('0xb8'),_0x50b2e3[_0x0da7('0x65')]);this[_0x0da7('0xa6')](_0x3396a0,_0x3396a0[_0x0da7('0xb2')],_0x3396a0[_0x0da7('0x146')]);}}};Preview[_0x0da7('0x12')][_0x0da7('0x22')]=function(_0x394a0a){if(this[_0x0da7('0x18')][_0x394a0a[_0x0da7('0xf3')]]&&_0x394a0a['destlinkedid']!==_0x394a0a[_0x0da7('0x14b')]){this[_0x0da7('0xa6')](_0x394a0a,_0x394a0a['destlinkedid'],_0x394a0a['dialstatus']);}};Preview['prototype']['syncHangupRequest']=function(_0x417963){if(this[_0x0da7('0x18')][_0x417963[_0x0da7('0xb2')]]&&_0x417963[_0x0da7('0xb2')]!==_0x417963[_0x0da7('0xb6')]&&!this[_0x0da7('0x18')][_0x417963[_0x0da7('0xb2')]][_0x0da7('0x7b')]){if(_0x417963['cause']==='1'){this['callProgressDetectingCustomer'](_0x417963,_0x417963[_0x0da7('0xb2')],_0x417963[_0x0da7('0x146')]);}}};Preview[_0x0da7('0x12')][_0x0da7('0x14c')]=function(_0x5d10d5,_0x30f15e,_0x2d0e84){if(this[_0x0da7('0x18')][_0x5d10d5]){if(_[_0x0da7('0x77')](this['actions'][_0x5d10d5][_0x0da7('0x14d')])){this[_0x0da7('0x18')][_0x5d10d5][_0x0da7('0x14d')]={};}this[_0x0da7('0x18')][_0x5d10d5][_0x0da7('0x14d')][_0x30f15e]=_0x2d0e84;}};Preview[_0x0da7('0x12')][_0x0da7('0x26')]=function(_0x40c739){try{if(!_['isNil'](_0x40c739)){if(ut['filterKey'](_[_0x0da7('0x14e')](_0x40c739[_0x0da7('0x14f')])[0x0])){this['addVariable'](_0x40c739[_0x0da7('0xb6')],_[_0x0da7('0x14e')](_0x40c739['variable'])[0x0],_0x40c739[_0x0da7('0x150')]);}}}catch(_0x219c08){logger['error']('[syncVarSet][Preview]',util[_0x0da7('0x151')](_0x219c08,{'showHidden':![],'depth':null}));}};Preview[_0x0da7('0x12')][_0x0da7('0x28')]=function(_0x1b7bf9){if(_0x1b7bf9){if(this[_0x0da7('0x18')][_0x1b7bf9[_0x0da7('0x152')]]){this[_0x0da7('0x18')][_0x1b7bf9['transfertargetlinkedid']][_0x0da7('0x149')]=!![];}}};Preview[_0x0da7('0x12')][_0x0da7('0x29')]=function(_0x50aa33){if(_0x50aa33){if(this[_0x0da7('0x18')][_0x50aa33[_0x0da7('0x153')]]){this[_0x0da7('0x18')][_0x50aa33['transfererlinkedid']][_0x0da7('0x149')]=!![];}}};module[_0x0da7('0x154')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index fa6472f..7077324 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 _0xeff8=['preview','lodash','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','connectedlinename','membername','context','from-sip','xcally-motion-preview','holdtime','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird'];(function(_0x59cda2,_0x52a700){var _0x3d1007=function(_0x20f37e){while(--_0x20f37e){_0x59cda2['push'](_0x59cda2['shift']());}};_0x3d1007(++_0x52a700);}(_0xeff8,0x186));var _0x8eff=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xeff8[_0x13ea00];return _0x1f7347;};'use strict';var util=require(_0x8eff('0x0'));var BPromise=require(_0x8eff('0x1'));var logger=require('../../../config/logger')(_0x8eff('0x2'));var _=require(_0x8eff('0x3'));var cmHopper=require(_0x8eff('0x4'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x8eff('0x5'));var cmHopperBlack=require(_0x8eff('0x6'));var voiceQueueRt=require(_0x8eff('0x7'));var agentReportPreview=require(_0x8eff('0x8'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x469641){return function(_0xb54063){logger[_0x8eff('0x9')](_0x469641,util[_0x8eff('0xa')](_0xb54063,{'showHidden':![],'depth':null}));};}function create(_0x491f01){return BPromise[_0x8eff('0xb')]()[_0x8eff('0xc')](cmHopperHistory[_0x8eff('0xd')](_0x491f01))[_0x8eff('0xe')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x56f120){return BPromise[_0x8eff('0xb')]()[_0x8eff('0xc')](agentReportPreview[_0x8eff('0xd')](_0x56f120))['catch'](loggerCatch(_0x8eff('0xf')));}function moveContact(_0x369b5d){return BPromise['resolve']()[_0x8eff('0xc')](cmHopper[_0x8eff('0x10')](_0x369b5d,!![]))['catch'](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x8eff('0x11')]=function(_0x43c914){return BPromise[_0x8eff('0xb')]()[_0x8eff('0xc')](cmHopperBlack[_0x8eff('0x11')](_0x43c914))['catch'](loggerCatch(_0x8eff('0x12')));};exports[_0x8eff('0x13')]=function(_0x372ee8){return BPromise[_0x8eff('0xb')]()[_0x8eff('0xc')](cmHopper[_0x8eff('0x13')](_0x372ee8))[_0x8eff('0xe')](loggerCatch(_0x8eff('0x14')));};exports[_0x8eff('0xd')]=function(_0x427902,_0x137344){create(_0x427902)['catch'](loggerCatch(_0x137344));moveContact(_0x427902)[_0x8eff('0xe')](loggerCatch(_0x137344));};exports[_0x8eff('0x15')]=function(_0x3cd1dc,_0x20ec2a){createAgent(_0x3cd1dc)[_0x8eff('0xe')](loggerCatch(_0x20ec2a));};exports[_0x8eff('0x16')]=function(_0x38f5ee,_0x399d96){create(_0x38f5ee)[_0x8eff('0xe')](loggerCatch(_0x399d96));};exports[_0x8eff('0x17')]=function(_0x453c7a,_0x1b65f9){moveContact(_0x453c7a)[_0x8eff('0xe')](loggerCatch(_0x1b65f9));};exports[_0x8eff('0x18')]=function(_0xdbb7b5,_0x183a53,_0x5e157c){if(_0x183a53){_0xdbb7b5[_0x8eff('0x19')]=null;}if(_0x5e157c){_0xdbb7b5[_0x8eff('0x1a')]=![];}return BPromise['resolve']()[_0x8eff('0xc')](cmHopper['rescheduleContact'](_0xdbb7b5))[_0x8eff('0xe')](loggerCatch(_0x8eff('0x1b')));};exports[_0x8eff('0x1c')]=function(_0x59cc32){return BPromise[_0x8eff('0xb')]()['then'](cmHopper[_0x8eff('0x1c')](_0x59cc32))[_0x8eff('0xe')](loggerCatch('[countReScheduled]\x20'));};exports[_0x8eff('0x1d')]=function(_0x5ec3d7){return BPromise[_0x8eff('0xb')]()[_0x8eff('0xc')](cmHopper[_0x8eff('0x1d')]({'UserId':null},_0x5ec3d7,0x1))[_0x8eff('0xe')](loggerCatch(_0x8eff('0x1e')));};exports[_0x8eff('0x1f')]=function(_0x516173){return BPromise[_0x8eff('0xb')]()[_0x8eff('0xc')](cmHopper[_0x8eff('0x1d')]({'active':![]},_0x516173,0x1))[_0x8eff('0xe')](loggerCatch(_0x8eff('0x20')));};exports[_0x8eff('0x21')]=function(_0x4cc146){var _0x4ed3b8={};_0x4ed3b8[_0x8eff('0x22')]=_0x4cc146[_0x8eff('0x22')];_0x4ed3b8[_0x8eff('0x23')]=_0x4cc146['uniqueid'];_0x4ed3b8[_0x8eff('0x24')]=_0x4cc146[_0x8eff('0x24')];_0x4ed3b8[_0x8eff('0x25')]=_0x4cc146[_0x8eff('0x25')];_0x4ed3b8[_0x8eff('0x26')]=_0x4cc146[_0x8eff('0x26')];_0x4ed3b8[_0x8eff('0x27')]=_0x4cc146[_0x8eff('0x28')];_0x4ed3b8[_0x8eff('0x29')]=_0x4cc146[_0x8eff('0x28')];_0x4ed3b8[_0x8eff('0x2a')]=0x1;_0x4ed3b8[_0x8eff('0x2b')]=_0x4cc146['endtime'];_0x4ed3b8[_0x8eff('0x2c')]=_0x4cc146[_0x8eff('0x2d')];_0x4ed3b8[_0x8eff('0x2e')]=_0x8eff('0x2f');_0x4ed3b8['exten']=_0x8eff('0x30');_0x4ed3b8[_0x8eff('0x31')]=0x0;_0x4ed3b8['assigned']=0x1;_0x4ed3b8['lastAssignedTo']=_0x4cc146[_0x8eff('0x2d')];_0x4ed3b8[_0x8eff('0x32')]='COMPLETED';return BPromise['resolve']()['then'](voiceQueueReport[_0x8eff('0x33')](_0x4ed3b8))['catch'](loggerCatch(_0x8eff('0x34')));};exports['getContactRecallMe']=function(_0x2bb00f,_0x3f7002){return BPromise[_0x8eff('0xb')]()[_0x8eff('0xc')](cmHopper[_0x8eff('0x35')](_0x2bb00f,_0x3f7002))[_0x8eff('0xe')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x8eff('0x36')]=function(_0x5907e0){return BPromise[_0x8eff('0xb')]()['then'](cmHopper[_0x8eff('0x18')](_0x5907e0,!![],!![]))[_0x8eff('0xe')](loggerCatch(_0x8eff('0x37')));}; \ No newline at end of file +var _0xe14b=['xcally-motion-preview','assigned','lastAssignedTo','[voiceQueueReport]\x20','getContactRecallMe','[rescheduleContactInQueue]\x20','util','bluebird','lodash','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','catch','[createHistory]\x20','resolve','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','active','countReScheduled','unlockContact','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','context'];(function(_0x49a57c,_0x2eb02c){var _0x4e0316=function(_0x37e2e5){while(--_0x37e2e5){_0x49a57c['push'](_0x49a57c['shift']());}};_0x4e0316(++_0x2eb02c);}(_0xe14b,0x93));var _0xbe14=function(_0xb7a459,_0xc13228){_0xb7a459=_0xb7a459-0x0;var _0x104ab5=_0xe14b[_0xb7a459];return _0x104ab5;};'use strict';var util=require(_0xbe14('0x0'));var BPromise=require(_0xbe14('0x1'));var logger=require('../../../config/logger')('preview');var _=require(_0xbe14('0x2'));var cmHopper=require(_0xbe14('0x3'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0xbe14('0x4'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0xbe14('0x5'));var voiceQueueReport=require(_0xbe14('0x6'));function loggerCatch(_0x1fe204){return function(_0x1ff100){logger[_0xbe14('0x7')](_0x1fe204,util[_0xbe14('0x8')](_0x1ff100,{'showHidden':![],'depth':null}));};}function create(_0x196fca){return BPromise['resolve']()['then'](cmHopperHistory['createHistory'](_0x196fca))[_0xbe14('0x9')](loggerCatch(_0xbe14('0xa')));}function createAgent(_0xd68cd7){return BPromise[_0xbe14('0xb')]()['then'](agentReportPreview['createHistory'](_0xd68cd7))[_0xbe14('0x9')](loggerCatch(_0xbe14('0xa')));}function moveContact(_0x4935cc){return BPromise[_0xbe14('0xb')]()[_0xbe14('0xc')](cmHopper[_0xbe14('0xd')](_0x4935cc,!![]))[_0xbe14('0x9')](loggerCatch(_0xbe14('0xe')));}exports[_0xbe14('0xf')]=function(_0x23a730){return BPromise[_0xbe14('0xb')]()[_0xbe14('0xc')](cmHopperBlack[_0xbe14('0xf')](_0x23a730))[_0xbe14('0x9')](loggerCatch(_0xbe14('0x10')));};exports[_0xbe14('0x11')]=function(_0x530538){return BPromise['resolve']()[_0xbe14('0xc')](cmHopper[_0xbe14('0x11')](_0x530538))[_0xbe14('0x9')](loggerCatch(_0xbe14('0x12')));};exports['createHistory']=function(_0x21c789,_0xe9c3ec){create(_0x21c789)[_0xbe14('0x9')](loggerCatch(_0xe9c3ec));moveContact(_0x21c789)[_0xbe14('0x9')](loggerCatch(_0xe9c3ec));};exports[_0xbe14('0x13')]=function(_0x29ab73,_0x17ae86){createAgent(_0x29ab73)['catch'](loggerCatch(_0x17ae86));};exports[_0xbe14('0x14')]=function(_0x456ca8,_0x329588){create(_0x456ca8)[_0xbe14('0x9')](loggerCatch(_0x329588));};exports[_0xbe14('0x15')]=function(_0x37e4c1,_0x59a9e3){moveContact(_0x37e4c1)[_0xbe14('0x9')](loggerCatch(_0x59a9e3));};exports[_0xbe14('0x16')]=function(_0x417c8d,_0xc12977,_0x188ec4){if(_0xc12977){_0x417c8d['UserId']=null;}if(_0x188ec4){_0x417c8d[_0xbe14('0x17')]=![];}return BPromise['resolve']()[_0xbe14('0xc')](cmHopper['rescheduleContact'](_0x417c8d))[_0xbe14('0x9')](loggerCatch('[rescheduleContact]\x20'));};exports[_0xbe14('0x18')]=function(_0x3d3608){return BPromise['resolve']()[_0xbe14('0xc')](cmHopper['countReScheduled'](_0x3d3608))[_0xbe14('0x9')](loggerCatch('[countReScheduled]\x20'));};exports[_0xbe14('0x19')]=function(_0x5fa043){return BPromise[_0xbe14('0xb')]()[_0xbe14('0xc')](cmHopper[_0xbe14('0x19')]({'UserId':null},_0x5fa043,0x1))[_0xbe14('0x9')](loggerCatch('[unlockContact]\x20'));};exports[_0xbe14('0x1a')]=function(_0x1ba46a){return BPromise[_0xbe14('0xb')]()[_0xbe14('0xc')](cmHopper['unlockContact']({'active':![]},_0x1ba46a,0x1))[_0xbe14('0x9')](loggerCatch(_0xbe14('0x1b')));};exports['crateCustomerReportQueue']=function(_0x3c3613){var _0x3b3e84={};_0x3b3e84[_0xbe14('0x1c')]=_0x3c3613[_0xbe14('0x1c')];_0x3b3e84[_0xbe14('0x1d')]=_0x3c3613[_0xbe14('0x1d')];_0x3b3e84[_0xbe14('0x1e')]=_0x3c3613[_0xbe14('0x1e')];_0x3b3e84[_0xbe14('0x1f')]=_0x3c3613[_0xbe14('0x1f')];_0x3b3e84[_0xbe14('0x20')]=_0x3c3613[_0xbe14('0x20')];_0x3b3e84[_0xbe14('0x21')]=_0x3c3613[_0xbe14('0x22')];_0x3b3e84[_0xbe14('0x23')]=_0x3c3613[_0xbe14('0x22')];_0x3b3e84[_0xbe14('0x24')]=0x1;_0x3b3e84[_0xbe14('0x25')]=_0x3c3613[_0xbe14('0x26')];_0x3b3e84[_0xbe14('0x27')]=_0x3c3613['membername'];_0x3b3e84[_0xbe14('0x28')]='from-sip';_0x3b3e84['exten']=_0xbe14('0x29');_0x3b3e84['holdtime']=0x0;_0x3b3e84[_0xbe14('0x2a')]=0x1;_0x3b3e84[_0xbe14('0x2b')]=_0x3c3613['membername'];_0x3b3e84['queuecallerexitreason']='COMPLETED';return BPromise[_0xbe14('0xb')]()[_0xbe14('0xc')](voiceQueueReport['create'](_0x3b3e84))[_0xbe14('0x9')](loggerCatch(_0xbe14('0x2c')));};exports[_0xbe14('0x2d')]=function(_0x1aa849,_0x29c23e){return BPromise['resolve']()['then'](cmHopper[_0xbe14('0x2d')](_0x1aa849,_0x29c23e))['catch'](loggerCatch('[GetContactRecallMe]\x20'));};exports['rescheduleContactInQueue']=function(_0x163ef7){return BPromise[_0xbe14('0xb')]()[_0xbe14('0xc')](cmHopper[_0xbe14('0x16')](_0x163ef7,!![],!![]))[_0xbe14('0x9')](loggerCatch(_0xbe14('0x2e')));}; \ 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 722ba9f..311c92a 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 _0x6fc3=['env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','logger','info','inspect','loggerError','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','dialer','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','Contact','hasOwnProperty','tags','createdAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','responsetime','logAgent','starttime','logLookAgent','UserId','logCustomer','endtime','ringtime','talktime','answertime','isFailure','variablesAction','RECALL','BOOKED','uniqueid','originate','timeout','countbusyretry','countnoanswerretry','cloneAction','clone','Global','active','add','minutes','ContactId','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','channelAgent','interface','not_inuse','status','push','CampaignId','filterKey','idContact','type','campaigntype','membername','countcongestionretry','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','preview'];(function(_0x3e23c1,_0xb0c332){var _0x393fea=function(_0x2dbe0c){while(--_0x2dbe0c){_0x3e23c1['push'](_0x3e23c1['shift']());}};_0x393fea(++_0xb0c332);}(_0x6fc3,0x117));var _0x36fc=function(_0x1c9863,_0x30d176){_0x1c9863=_0x1c9863-0x0;var _0x2f810c=_0x6fc3[_0x1c9863];return _0x2f810c;};'use strict';var util=require(_0x36fc('0x0'));var _=require(_0x36fc('0x1'));var moment=require(_0x36fc('0x2'));var logger=require(_0x36fc('0x3'))(_0x36fc('0x4'));var ipAgi=process[_0x36fc('0x5')][_0x36fc('0x6')]||_0x36fc('0x7');function getSeconds(_0x4394e0,_0x4c9289){var _0x5416f1=moment(_0x4394e0)[_0x36fc('0x8')](0x0);var _0x1fb46a=moment(_0x4c9289)[_0x36fc('0x8')](0x0);return _0x5416f1[_0x36fc('0x9')](_0x1fb46a,_0x36fc('0xa'));}exports[_0x36fc('0xb')]=function(_0x4ce22c){return function(_0x1ce5db){logger[_0x36fc('0xc')](_0x4ce22c,util['inspect'](_0x1ce5db,{'showHidden':![],'depth':null}));};};exports[_0x36fc('0xd')]=function(_0x81f8e1,_0x1a4bea){logger[_0x36fc('0xe')](_0x81f8e1,util[_0x36fc('0xf')](_0x1a4bea,{'showHidden':![],'depth':null}));};exports[_0x36fc('0x10')]=function(_0x3ff634,_0x53e526){logger[_0x36fc('0xc')](_0x3ff634,util[_0x36fc('0xf')](_0x53e526,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x1cfd00){return function(_0x5a4653){logger[_0x36fc('0xe')](_0x1cfd00,util[_0x36fc('0xf')](_0x5a4653,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x4a8f6a,_0x407ca1,_0x292ce4){return{'message':_0x4a8f6a,'unlock':_0x407ca1,'active':_0x292ce4};};exports[_0x36fc('0x11')]=function(_0x75abcd,_0x14fc70,_0x273078){if(!_[_0x36fc('0x12')](_0x273078)&&_0x36fc('0x13')===typeof _0x273078&&!_[_0x36fc('0x14')](_0x273078)){if(!_[_0x36fc('0x12')](_0x14fc70)&&'string'===typeof _0x14fc70&&!_[_0x36fc('0x14')](_0x14fc70)){return util[_0x36fc('0x15')](_0x36fc('0x16'),_0x14fc70,_0x273078);}return util['format'](_0x36fc('0x16'),_0x273078,_0x273078);}if(!_['isUndefined'](_0x75abcd)&&'string'===typeof _0x75abcd&&!_['isEmpty'](_0x75abcd)){return _0x75abcd;}return _0x36fc('0x17');};exports[_0x36fc('0x18')]=function(_0x1d7d85){if(_[_0x36fc('0x19')](_0x1d7d85)){return![];}return _0x1d7d85;};exports[_0x36fc('0x1a')]=function(_0xa6f550,_0x42991e,_0x35dc72,_0x62db5e,_0x311176,_0x2ac1cd){var _0x402a10={'XMD-QUEUE':_0x42991e[_0x36fc('0x1b')]?_0x42991e[_0x36fc('0x1b')][_0x36fc('0x1c')]:'','XMD-CALLERID':_0x62db5e,'XMD-CALLERID-PREVIEW':_0x2ac1cd?util[_0x36fc('0x15')](_0x36fc('0x16'),_0x2ac1cd[_0x36fc('0x1d')],_0x2ac1cd[_0x36fc('0x1e')]):_0x62db5e,'XMD-DIALID':_0x311176,'XMD-CONTACTID':_0x42991e['ContactId'],'XMD-CDRTYPE':_0x36fc('0x1f'),'CALLERID(all)':_0x62db5e,'XMD-VOICEQUEUEID':_0x42991e['VoiceQueueId'],'XMD-DIALCHANNEL':_0x35dc72,'XMD-DIALTIMEOUT':_0xa6f550[_0x36fc('0x20')]||0x1e,'XMD-DIALOPTIONS':util[_0x36fc('0x15')](_0x36fc('0x21'),_0xa6f550[_0x36fc('0x22')]?'g':'',_['isEmpty'](_0xa6f550[_0x36fc('0x23')])?'':_0x36fc('0x24')),'XMD-DIALURL':_0xa6f550[_0x36fc('0x25')]||'','XMD-AGI':_0xa6f550[_0x36fc('0x26')]?util[_0x36fc('0x15')](_0x36fc('0x27'),ipAgi,_0xa6f550['dialQueueProject']):_0x36fc('0x28'),'XMD-AGIAFTER':_0xa6f550[_0x36fc('0x22')]?util[_0x36fc('0x15')](_0x36fc('0x27'),ipAgi,_0xa6f550[_0x36fc('0x22')]):_0x36fc('0x28'),'XMD-ORIGINATECALLERIDNUM':_0x2ac1cd?_0x2ac1cd[_0x36fc('0x29')]:'','XMD-ORIGINATECALLERIDNAME':_0x2ac1cd?_0x2ac1cd[_0x36fc('0x2a')]:'','XMD-DESTINATION':_0x36fc('0x2b')};if(!_[_0x36fc('0x14')](_0xa6f550[_0x36fc('0x23')])){_0x402a10[util[_0x36fc('0x15')]('%s',_0x36fc('0x2c'))]=_0xa6f550[_0x36fc('0x23')];_0x402a10[util[_0x36fc('0x15')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x311176;}if(_0x42991e&&_0x42991e[_0x36fc('0x2d')]){for(var _0xcfc665 in _0x42991e[_0x36fc('0x2d')]){if(_0x42991e[_0x36fc('0x2d')][_0x36fc('0x2e')](_0xcfc665)){if(!_['isNil'](_0x42991e[_0x36fc('0x2d')][_0xcfc665])&&_0xcfc665!=='id'&&_0xcfc665!==_0x36fc('0x2f')&&_0xcfc665!==_0x36fc('0x30')&&_0xcfc665!=='updatedAt'){_0x402a10[util[_0x36fc('0x15')](_0x36fc('0x31'),_0x36fc('0x32'),_[_0x36fc('0x33')](_0xcfc665))]=_0x42991e[_0x36fc('0x2d')][_0xcfc665];}}}}return _0x402a10;};exports[_0x36fc('0x34')]=function(_0xeac05b){var _0x106f39={};for(var _0x59e7ee in _0xeac05b){if(_0xeac05b['hasOwnProperty'](_0x59e7ee)){_0x106f39[util[_0x36fc('0x15')]('%s',_[_0x36fc('0x35')](_0x59e7ee))]=_0xeac05b[_0x59e7ee];}}return{'variables':_0x106f39};};exports[_0x36fc('0x36')]=function(_0x240e9c,_0x3091db){if(!_[_0x36fc('0x19')](_0x240e9c)){if(_0x240e9c['hasOwnProperty']('originated')){if(_0x240e9c['originated']>0x0){_0x240e9c[_0x36fc('0x37')]-=0x1;}else{logger[_0x36fc('0xc')](_0x36fc('0x38'),_0x3091db);}}}else{logger['error'](_0x36fc('0x39'),_0x3091db);}};exports['logBlacklist']=function(_0x4b15e0){var _0x6698ae=moment()[_0x36fc('0x15')](_0x36fc('0x3a'));_0x4b15e0[_0x36fc('0x3b')]=0xd;_0x4b15e0[_0x36fc('0x3c')]=_0x36fc('0x3d');_0x4b15e0['starttime']=_0x6698ae;_0x4b15e0[_0x36fc('0x3e')]=_0x6698ae;_0x4b15e0['endtime']=_0x6698ae;};exports[_0x36fc('0x3f')]=function(_0x2a91b2,_0x11819e,_0x215482){var _0x5ea398=moment()[_0x36fc('0x15')]('YYYY-MM-DD\x20HH:mm:ss');_0x2a91b2[_0x36fc('0x3b')]=_0x11819e;_0x2a91b2['statedesc']=_0x215482;_0x2a91b2['responsetime']=_0x5ea398;_0x2a91b2['ringtime']=getSeconds(_0x2a91b2['responsetime'],_0x2a91b2[_0x36fc('0x40')]);};exports[_0x36fc('0x41')]=function(_0x3fabe2,_0x4e22b2,_0x33f294){_0x3fabe2['membername']=_0x4e22b2;_0x3fabe2[_0x36fc('0x42')]=_0x33f294;};exports[_0x36fc('0x43')]=function(_0x591c5d,_0x6001dd,_0x48ec26){var _0x54f133=moment()['format'](_0x36fc('0x3a'));_0x591c5d[_0x36fc('0x3b')]=_0x6001dd;_0x591c5d['statedesc']=_0x48ec26;_0x591c5d[_0x36fc('0x3e')]=_0x591c5d[_0x36fc('0x3e')]?_0x591c5d[_0x36fc('0x3e')]:_0x54f133;_0x591c5d[_0x36fc('0x44')]=_0x591c5d[_0x36fc('0x44')]?_0x591c5d['endtime']:_0x54f133;_0x591c5d[_0x36fc('0x45')]=getSeconds(_0x591c5d[_0x36fc('0x3e')]||0x0,_0x591c5d[_0x36fc('0x40')]||0x0);_0x591c5d[_0x36fc('0x46')]=_0x591c5d[_0x36fc('0x47')]?getSeconds(_0x591c5d[_0x36fc('0x44')],_0x591c5d[_0x36fc('0x47')]):0x0;};exports[_0x36fc('0x48')]=function(_0x23d989){return _0x23d989==='Failure';};exports[_0x36fc('0x49')]=function(_0x5e7e6c,_0x8cec41,_0x56a8a1,_0x34cc11,_0x209d48){var _0x5d00f8=_0x34cc11?_0x36fc('0x4a'):_0x5e7e6c[_0x36fc('0x1d')];_0x5d00f8=_0x209d48?_0x36fc('0x4b'):_0x5d00f8;return{'actionid':_0x5e7e6c[_0x36fc('0x4c')],'action':_0x36fc('0x4d'),'channel':_0x5e7e6c['channelAgent'],'callerid':util[_0x36fc('0x15')]('\x22%s\x22\x20<%s>',_0x5d00f8,_0x5e7e6c[_0x36fc('0x1e')]),'Exten':_0x36fc('0x2b'),'Context':'from-sip','Priority':'1','variable':_0x56a8a1,'timeout':(_0x8cec41[_0x36fc('0x4e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5e7e6c[_0x36fc('0x4c')]};};exports['totalGlobal']=function(_0x22f9d4){return _0x22f9d4[_0x36fc('0x4f')]+_0x22f9d4['countcongestionretry']+_0x22f9d4[_0x36fc('0x50')];};exports[_0x36fc('0x51')]=function(_0x3ecc47){var _0x5dfc6c=_[_0x36fc('0x52')](_0x3ecc47);_0x5dfc6c[_0x36fc('0x3b')]=0xf;_0x5dfc6c[_0x36fc('0x3c')]=_0x36fc('0x53');return _0x5dfc6c;};exports['scheduledAt']=function(_0x3bbefa,_0x40f937,_0x1617dc){var _0x57bd76={};_0x57bd76[_0x40f937]=_0x3bbefa[_0x40f937];_0x57bd76[_0x36fc('0x54')]=![];_0x57bd76['scheduledat']=moment()[_0x36fc('0x55')](_0x1617dc,_0x36fc('0x56'))[_0x36fc('0x15')](_0x36fc('0x3a'));_0x57bd76[_0x36fc('0x57')]=_0x3bbefa[_0x36fc('0x57')];_0x57bd76['ListId']=_0x3bbefa[_0x36fc('0x58')];_0x57bd76[_0x36fc('0x59')]=_0x3bbefa[_0x36fc('0x59')]||undefined;return _0x57bd76;};exports[_0x36fc('0x5a')]=function(_0x291730,_0x1c06d1){if(!_[_0x36fc('0x19')](_0x291730)){if(_0x291730['pTalking']>0x0){_0x291730[_0x36fc('0x5b')]-=0x1;}else{logger[_0x36fc('0xc')](_0x1c06d1,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x36fc('0xc')](_0x1c06d1,_0x36fc('0x5c'));}};exports[_0x36fc('0x5d')]=function(_0x5099f2){if(_0x5099f2<=0x0){return!![];}return![];};exports[_0x36fc('0x5e')]=function(_0x3407c2,_0x48fefb){_0x3407c2[_0x36fc('0x5f')]=_0x48fefb;_0x3407c2[_0x36fc('0x1c')]=_0x3407c2[_0x36fc('0x60')];_0x3407c2['interface']=_0x3407c2[_0x36fc('0x61')];return _0x3407c2;};exports['buildAcw']=function(_0x454916){var _0x1bf182={};_0x1bf182['queue']=_0x454916[_0x36fc('0x60')];_0x1bf182[_0x36fc('0x62')]=_0x454916['channelAgent'];_0x1bf182[_0x36fc('0x4c')]=_0x454916[_0x36fc('0x4c')];return _0x1bf182;};exports['agentReadyId']=function(_0x5d222f){var _0x31d5ba=[];for(var _0x5da683 in _0x5d222f){if(_0x5d222f[_0x36fc('0x2e')](_0x5da683)){if(!_['isNil'](_0x5d222f[_0x5da683])&&_0x5d222f[_0x5da683][_0x36fc('0x3b')]===_0x36fc('0x63')&&_0x5d222f[_0x5da683][_0x36fc('0x64')]==='reachable'){_0x31d5ba[_0x36fc('0x65')](_0x5d222f[_0x5da683]['id']);}}}return _0x31d5ba;};exports['getDiff']=function(_0xa23d52){var _0x1d1648=moment()[_0x36fc('0x8')](0x0);var _0xd188ed=moment(_0xa23d52)[_0x36fc('0x8')](0x0);return _0x1d1648['diff'](_0xd188ed,_0x36fc('0xa'));};exports['createBody']=function(_0x5186e3){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x5186e3[_0x36fc('0x57')],'ListId':_0x5186e3[_0x36fc('0x58')],'VoiceQueueId':_0x5186e3[_0x36fc('0x59')]||undefined,'CampaignId':_0x5186e3[_0x36fc('0x66')]||undefined};};exports[_0x36fc('0x67')]=function(_0x4e7de4){if(_0x4e7de4==='uniqueid'||_0x4e7de4===_0x36fc('0x68')||_0x4e7de4===_0x36fc('0x60')||_0x4e7de4===_0x36fc('0x69')||_0x4e7de4===_0x36fc('0x6a')||_0x4e7de4==='dialAnswer'||_0x4e7de4===_0x36fc('0x6b')||_0x4e7de4===_0x36fc('0x61')||_0x4e7de4===_0x36fc('0x1d')||_0x4e7de4===_0x36fc('0x54')||_0x4e7de4===_0x36fc('0x1e')||_0x4e7de4==='scheduledat'||_0x4e7de4===_0x36fc('0x4f')||_0x4e7de4===_0x36fc('0x6c')||_0x4e7de4===_0x36fc('0x50')||_0x4e7de4===_0x36fc('0x6d')||_0x4e7de4===_0x36fc('0x6e')||_0x4e7de4===_0x36fc('0x6f')||_0x4e7de4===_0x36fc('0x70')||_0x4e7de4===_0x36fc('0x71')||_0x4e7de4===_0x36fc('0x57')||_0x4e7de4==='ListId'||_0x4e7de4==='UserId'||_0x4e7de4===_0x36fc('0x59')||_0x4e7de4===_0x36fc('0x72')||_0x4e7de4===_0x36fc('0x73')||_0x4e7de4===_0x36fc('0x74')||_0x4e7de4===_0x36fc('0x75')||_0x4e7de4==='xmd-listid'||_0x4e7de4===_0x36fc('0x76')||_0x4e7de4===_0x36fc('0x77')||_0x4e7de4===_0x36fc('0x78')||_0x4e7de4===_0x36fc('0x79')||_0x4e7de4===_0x36fc('0x7a')||_0x4e7de4===_0x36fc('0x7b')||_0x4e7de4===_0x36fc('0x7c')||_0x4e7de4==='xmd-callerid'||_0x4e7de4==='xmd-agiafter'||_0x4e7de4===_0x36fc('0x7d')||_0x4e7de4===_0x36fc('0x7e')||_0x4e7de4==='rtpaudioqosbridged'||_0x4e7de4===_0x36fc('0x7f')||_0x4e7de4==='rtpaudioqosjitterbridged'||_0x4e7de4===_0x36fc('0x80')||_0x4e7de4==='rtpaudioqoslossbridged'||_0x4e7de4===_0x36fc('0x81')||_0x4e7de4==='rtpaudioqosrttbridged'||_0x4e7de4===_0x36fc('0x7e')||_0x4e7de4===_0x36fc('0x82')||_0x4e7de4===_0x36fc('0x7f')||_0x4e7de4==='rtpaudioqosjitterbridged'||_0x4e7de4==='rtpaudioqosloss'||_0x4e7de4===_0x36fc('0x83')||_0x4e7de4===_0x36fc('0x81')||_0x4e7de4===_0x36fc('0x84')||_0x4e7de4===_0x36fc('0x85')||_0x4e7de4==='bridgepvtcallid'||_0x4e7de4==='state'||_0x4e7de4===_0x36fc('0x3c')){return![];}return!![];};exports[_0x36fc('0x86')]=function(_0x17d6ec,_0x263fb2){var _0x1245e0,_0x5332cf,_0x54a0e1;if(_0x263fb2<=0x0){_0x263fb2=0x1;}_0x1245e0=new RegExp(_0x36fc('0x87')+_0x263fb2+'}$');_0x5332cf=Math[_0x36fc('0x88')](0xa,_0x263fb2-0x1);_0x54a0e1=Math[_0x36fc('0x88')](0xa,_0x263fb2)-0x1;return util['format']('%s',_[_0x36fc('0x89')](_0x17d6ec,_0x1245e0,_[_0x36fc('0x8a')](_0x5332cf,_0x54a0e1)));};exports[_0x36fc('0x8b')]=function(_0x4aee0e){var _0x4625dc=_0x4aee0e[_0x36fc('0x8c')](/"(.*?)"/);return _0x4625dc?_0x4625dc[0x1]:_0x4aee0e;};exports[_0x36fc('0x8d')]=function(_0x3733f4){var _0x39a813=_0x3733f4['match'](/<(.*?)>/);return _0x39a813?_0x39a813[0x1]:_0x3733f4;}; \ No newline at end of file +var _0x5ad3=['variablesAction','RECALL','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countcongestionretry','countnoanswerretry','cloneAction','Global','scheduledAt','active','scheduledat','add','ListId','VoiceQueueId','isNil','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','buildAcw','agentReadyId','status','reachable','push','getDiff','seconds','createBody','CampaignId','filterKey','idContact','type','campaigntype','countbusyretry','countglobal','callbackuniqueid','callbackat','recallme','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','loggerCatch','inspect','info','loggerError','logger2','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','isActive','Queue','name','calleridname','calleridnum','ContactId','dialer','dialOriginateTimeout','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_UNIQUEID','hasOwnProperty','tags','updatedAt','%s%s','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','error','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','ringtime','logLookAgent','membername','UserId','talktime','answertime','isFailure'];(function(_0xf405ad,_0x1afcdf){var _0x45c5a7=function(_0x4d32df){while(--_0x4d32df){_0xf405ad['push'](_0xf405ad['shift']());}};_0x45c5a7(++_0x1afcdf);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x4c8c4d,_0x170fc3){_0x4c8c4d=_0x4c8c4d-0x0;var _0x7c72d2=_0x5ad3[_0x4c8c4d];return _0x7c72d2;};'use strict';var util=require(_0x35ad('0x0'));var _=require(_0x35ad('0x1'));var moment=require(_0x35ad('0x2'));var logger=require(_0x35ad('0x3'))('preview');var ipAgi=process[_0x35ad('0x4')][_0x35ad('0x5')]||_0x35ad('0x6');function getSeconds(_0x69a0b3,_0x450f55){var _0x1fed0d=moment(_0x69a0b3)[_0x35ad('0x7')](0x0);var _0x436dcb=moment(_0x450f55)[_0x35ad('0x7')](0x0);return _0x1fed0d[_0x35ad('0x8')](_0x436dcb,'seconds');}exports[_0x35ad('0x9')]=function(_0x3cec3e){return function(_0x3f1f55){logger['error'](_0x3cec3e,util[_0x35ad('0xa')](_0x3f1f55,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x5a29e3,_0x2efae0){logger[_0x35ad('0xb')](_0x5a29e3,util['inspect'](_0x2efae0,{'showHidden':![],'depth':null}));};exports[_0x35ad('0xc')]=function(_0x3a70a9,_0x4ad760){logger['error'](_0x3a70a9,util[_0x35ad('0xa')](_0x4ad760,{'showHidden':![],'depth':null}));};exports[_0x35ad('0xd')]=function(_0x4cf6bd){return function(_0x3c4dd5){logger[_0x35ad('0xb')](_0x4cf6bd,util['inspect'](_0x3c4dd5,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x5ba1aa,_0x2e81c8,_0x3cda5e){return{'message':_0x5ba1aa,'unlock':_0x2e81c8,'active':_0x3cda5e};};exports['getCallerId']=function(_0x3e2676,_0x2ebceb,_0x591917){if(!_[_0x35ad('0xe')](_0x591917)&&'string'===typeof _0x591917&&!_['isEmpty'](_0x591917)){if(!_[_0x35ad('0xe')](_0x2ebceb)&&_0x35ad('0xf')===typeof _0x2ebceb&&!_[_0x35ad('0x10')](_0x2ebceb)){return util['format'](_0x35ad('0x11'),_0x2ebceb,_0x591917);}return util[_0x35ad('0x12')](_0x35ad('0x11'),_0x591917,_0x591917);}if(!_[_0x35ad('0xe')](_0x3e2676)&&_0x35ad('0xf')===typeof _0x3e2676&&!_[_0x35ad('0x10')](_0x3e2676)){return _0x3e2676;}return'\x22\x22\x20<>';};exports[_0x35ad('0x13')]=function(_0x2876ad){if(_['isNil'](_0x2876ad)){return![];}return _0x2876ad;};exports['addVariables']=function(_0x3251d9,_0x398853,_0x578b1b,_0x21f611,_0x32735e,_0x496620){var _0x37c03d={'XMD-QUEUE':_0x398853[_0x35ad('0x14')]?_0x398853[_0x35ad('0x14')][_0x35ad('0x15')]:'','XMD-CALLERID':_0x21f611,'XMD-CALLERID-PREVIEW':_0x496620?util[_0x35ad('0x12')](_0x35ad('0x11'),_0x496620[_0x35ad('0x16')],_0x496620[_0x35ad('0x17')]):_0x21f611,'XMD-DIALID':_0x32735e,'XMD-CONTACTID':_0x398853[_0x35ad('0x18')],'XMD-CDRTYPE':_0x35ad('0x19'),'CALLERID(all)':_0x21f611,'XMD-VOICEQUEUEID':_0x398853['VoiceQueueId'],'XMD-DIALCHANNEL':_0x578b1b,'XMD-DIALTIMEOUT':_0x3251d9[_0x35ad('0x1a')]||0x1e,'XMD-DIALOPTIONS':util[_0x35ad('0x12')]('\x22rtTxX%s%s\x22',_0x3251d9[_0x35ad('0x1b')]?'g':'',_[_0x35ad('0x10')](_0x3251d9[_0x35ad('0x1c')])?'':_0x35ad('0x1d')),'XMD-DIALURL':_0x3251d9[_0x35ad('0x1e')]||'','XMD-AGI':_0x3251d9['dialQueueProject']?util[_0x35ad('0x12')](_0x35ad('0x1f'),ipAgi,_0x3251d9[_0x35ad('0x20')]):_0x35ad('0x21'),'XMD-AGIAFTER':_0x3251d9[_0x35ad('0x1b')]?util[_0x35ad('0x12')](_0x35ad('0x1f'),ipAgi,_0x3251d9[_0x35ad('0x1b')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x496620?_0x496620[_0x35ad('0x22')]:'','XMD-ORIGINATECALLERIDNAME':_0x496620?_0x496620[_0x35ad('0x23')]:'','XMD-DESTINATION':_0x35ad('0x24')};if(!_[_0x35ad('0x10')](_0x3251d9[_0x35ad('0x1c')])){_0x37c03d[util['format']('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x3251d9[_0x35ad('0x1c')];_0x37c03d[util['format']('%s',_0x35ad('0x25'))]=_0x32735e;}if(_0x398853&&_0x398853['Contact']){for(var _0x53603f in _0x398853['Contact']){if(_0x398853['Contact'][_0x35ad('0x26')](_0x53603f)){if(!_['isNil'](_0x398853['Contact'][_0x53603f])&&_0x53603f!=='id'&&_0x53603f!==_0x35ad('0x27')&&_0x53603f!=='createdAt'&&_0x53603f!==_0x35ad('0x28')){_0x37c03d[util['format'](_0x35ad('0x29'),'XMD-',_[_0x35ad('0x2a')](_0x53603f))]=_0x398853['Contact'][_0x53603f];}}}}return _0x37c03d;};exports[_0x35ad('0x2b')]=function(_0x2766dd){var _0x899f83={};for(var _0x4b6ec2 in _0x2766dd){if(_0x2766dd[_0x35ad('0x26')](_0x4b6ec2)){_0x899f83[util[_0x35ad('0x12')]('%s',_[_0x35ad('0x2c')](_0x4b6ec2))]=_0x2766dd[_0x4b6ec2];}}return{'variables':_0x899f83};};exports[_0x35ad('0x2d')]=function(_0x3cb239,_0x5cba25){if(!_['isNil'](_0x3cb239)){if(_0x3cb239[_0x35ad('0x26')](_0x35ad('0x2e'))){if(_0x3cb239[_0x35ad('0x2e')]>0x0){_0x3cb239[_0x35ad('0x2e')]-=0x1;}else{logger['error'](_0x35ad('0x2f'),_0x5cba25);}}}else{logger[_0x35ad('0x30')](_0x35ad('0x31'),_0x5cba25);}};exports[_0x35ad('0x32')]=function(_0x264135){var _0x3b7b52=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x264135[_0x35ad('0x33')]=0xd;_0x264135[_0x35ad('0x34')]=_0x35ad('0x35');_0x264135[_0x35ad('0x36')]=_0x3b7b52;_0x264135[_0x35ad('0x37')]=_0x3b7b52;_0x264135[_0x35ad('0x38')]=_0x3b7b52;};exports[_0x35ad('0x39')]=function(_0x2288f3,_0x4625dd,_0x549231){var _0x459d2f=moment()['format'](_0x35ad('0x3a'));_0x2288f3[_0x35ad('0x33')]=_0x4625dd;_0x2288f3[_0x35ad('0x34')]=_0x549231;_0x2288f3[_0x35ad('0x37')]=_0x459d2f;_0x2288f3[_0x35ad('0x3b')]=getSeconds(_0x2288f3[_0x35ad('0x37')],_0x2288f3[_0x35ad('0x36')]);};exports[_0x35ad('0x3c')]=function(_0x15894b,_0x5dd327,_0x200e4d){_0x15894b[_0x35ad('0x3d')]=_0x5dd327;_0x15894b[_0x35ad('0x3e')]=_0x200e4d;};exports['logCustomer']=function(_0x19d82d,_0x3c7cb7,_0x9ffec4){var _0x5e137e=moment()[_0x35ad('0x12')](_0x35ad('0x3a'));_0x19d82d[_0x35ad('0x33')]=_0x3c7cb7;_0x19d82d[_0x35ad('0x34')]=_0x9ffec4;_0x19d82d[_0x35ad('0x37')]=_0x19d82d[_0x35ad('0x37')]?_0x19d82d[_0x35ad('0x37')]:_0x5e137e;_0x19d82d['endtime']=_0x19d82d[_0x35ad('0x38')]?_0x19d82d['endtime']:_0x5e137e;_0x19d82d[_0x35ad('0x3b')]=getSeconds(_0x19d82d[_0x35ad('0x37')]||0x0,_0x19d82d[_0x35ad('0x36')]||0x0);_0x19d82d[_0x35ad('0x3f')]=_0x19d82d[_0x35ad('0x40')]?getSeconds(_0x19d82d[_0x35ad('0x38')],_0x19d82d[_0x35ad('0x40')]):0x0;};exports[_0x35ad('0x41')]=function(_0x1f44ec){return _0x1f44ec==='Failure';};exports[_0x35ad('0x42')]=function(_0x253d02,_0xd184f7,_0x4786fc,_0xb087aa,_0x5a5509){var _0x331cd5=_0xb087aa?_0x35ad('0x43'):_0x253d02['calleridname'];_0x331cd5=_0x5a5509?'BOOKED':_0x331cd5;return{'actionid':_0x253d02[_0x35ad('0x44')],'action':_0x35ad('0x45'),'channel':_0x253d02[_0x35ad('0x46')],'callerid':util[_0x35ad('0x12')]('\x22%s\x22\x20<%s>',_0x331cd5,_0x253d02[_0x35ad('0x17')]),'Exten':_0x35ad('0x24'),'Context':_0x35ad('0x47'),'Priority':'1','variable':_0x4786fc,'timeout':(_0xd184f7[_0x35ad('0x48')]||0x1e)*0x3e8,'async':!![],'channelid':_0x253d02[_0x35ad('0x44')]};};exports[_0x35ad('0x49')]=function(_0x3ea556){return _0x3ea556['countbusyretry']+_0x3ea556[_0x35ad('0x4a')]+_0x3ea556[_0x35ad('0x4b')];};exports[_0x35ad('0x4c')]=function(_0x5733d9){var _0x5e3f96=_['clone'](_0x5733d9);_0x5e3f96[_0x35ad('0x33')]=0xf;_0x5e3f96[_0x35ad('0x34')]=_0x35ad('0x4d');return _0x5e3f96;};exports[_0x35ad('0x4e')]=function(_0x4f8058,_0x29e4c7,_0x46c462){var _0x3583ca={};_0x3583ca[_0x29e4c7]=_0x4f8058[_0x29e4c7];_0x3583ca[_0x35ad('0x4f')]=![];_0x3583ca[_0x35ad('0x50')]=moment()[_0x35ad('0x51')](_0x46c462,'minutes')['format'](_0x35ad('0x3a'));_0x3583ca[_0x35ad('0x18')]=_0x4f8058['ContactId'];_0x3583ca['ListId']=_0x4f8058[_0x35ad('0x52')];_0x3583ca[_0x35ad('0x53')]=_0x4f8058[_0x35ad('0x53')]||undefined;return _0x3583ca;};exports['decrementTalkink']=function(_0x486a11,_0xa35ee4){if(!_[_0x35ad('0x54')](_0x486a11)){if(_0x486a11[_0x35ad('0x55')]>0x0){_0x486a11['pTalking']-=0x1;}else{logger[_0x35ad('0x30')](_0xa35ee4,_0x35ad('0x56'));}}else{logger[_0x35ad('0x30')](_0xa35ee4,_0x35ad('0x57'));}};exports[_0x35ad('0x58')]=function(_0x46def2){if(_0x46def2<=0x0){return!![];}return![];};exports['buildObj']=function(_0x119b99,_0x22415d){_0x119b99[_0x35ad('0x59')]=_0x22415d;_0x119b99['name']=_0x119b99[_0x35ad('0x5a')];_0x119b99[_0x35ad('0x5b')]=_0x119b99[_0x35ad('0x46')];return _0x119b99;};exports[_0x35ad('0x5c')]=function(_0x564a01){var _0x53496d={};_0x53496d[_0x35ad('0x5a')]=_0x564a01[_0x35ad('0x5a')];_0x53496d[_0x35ad('0x5b')]=_0x564a01[_0x35ad('0x46')];_0x53496d[_0x35ad('0x44')]=_0x564a01['uniqueid'];return _0x53496d;};exports[_0x35ad('0x5d')]=function(_0x39fa94){var _0x45a7e2=[];for(var _0xae2c85 in _0x39fa94){if(_0x39fa94[_0x35ad('0x26')](_0xae2c85)){if(!_[_0x35ad('0x54')](_0x39fa94[_0xae2c85])&&_0x39fa94[_0xae2c85]['state']==='not_inuse'&&_0x39fa94[_0xae2c85][_0x35ad('0x5e')]===_0x35ad('0x5f')){_0x45a7e2[_0x35ad('0x60')](_0x39fa94[_0xae2c85]['id']);}}}return _0x45a7e2;};exports[_0x35ad('0x61')]=function(_0x1043cd){var _0x12774d=moment()[_0x35ad('0x7')](0x0);var _0x5cef35=moment(_0x1043cd)[_0x35ad('0x7')](0x0);return _0x12774d[_0x35ad('0x8')](_0x5cef35,_0x35ad('0x62'));};exports[_0x35ad('0x63')]=function(_0x522054){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x522054[_0x35ad('0x18')],'ListId':_0x522054[_0x35ad('0x52')],'VoiceQueueId':_0x522054['VoiceQueueId']||undefined,'CampaignId':_0x522054[_0x35ad('0x64')]||undefined};};exports[_0x35ad('0x65')]=function(_0x1da9ca){if(_0x1da9ca===_0x35ad('0x44')||_0x1da9ca===_0x35ad('0x66')||_0x1da9ca===_0x35ad('0x5a')||_0x1da9ca===_0x35ad('0x67')||_0x1da9ca===_0x35ad('0x68')||_0x1da9ca==='dialAnswer'||_0x1da9ca===_0x35ad('0x3d')||_0x1da9ca===_0x35ad('0x46')||_0x1da9ca===_0x35ad('0x16')||_0x1da9ca==='active'||_0x1da9ca===_0x35ad('0x17')||_0x1da9ca==='scheduledat'||_0x1da9ca===_0x35ad('0x69')||_0x1da9ca===_0x35ad('0x4a')||_0x1da9ca===_0x35ad('0x4b')||_0x1da9ca===_0x35ad('0x6a')||_0x1da9ca==='callback'||_0x1da9ca===_0x35ad('0x6b')||_0x1da9ca===_0x35ad('0x6c')||_0x1da9ca===_0x35ad('0x6d')||_0x1da9ca===_0x35ad('0x18')||_0x1da9ca===_0x35ad('0x52')||_0x1da9ca==='UserId'||_0x1da9ca===_0x35ad('0x53')||_0x1da9ca==='sipcallid'||_0x1da9ca===_0x35ad('0x6e')||_0x1da9ca===_0x35ad('0x6f')||_0x1da9ca==='xmd-phone'||_0x1da9ca===_0x35ad('0x70')||_0x1da9ca==='xmd-dialurl'||_0x1da9ca===_0x35ad('0x71')||_0x1da9ca===_0x35ad('0x72')||_0x1da9ca==='xmd-dialid'||_0x1da9ca===_0x35ad('0x73')||_0x1da9ca===_0x35ad('0x74')||_0x1da9ca===_0x35ad('0x75')||_0x1da9ca===_0x35ad('0x76')||_0x1da9ca===_0x35ad('0x77')||_0x1da9ca===_0x35ad('0x78')||_0x1da9ca===_0x35ad('0x79')||_0x1da9ca==='rtpaudioqosbridged'||_0x1da9ca===_0x35ad('0x7a')||_0x1da9ca===_0x35ad('0x7b')||_0x1da9ca===_0x35ad('0x7c')||_0x1da9ca===_0x35ad('0x7d')||_0x1da9ca===_0x35ad('0x7e')||_0x1da9ca===_0x35ad('0x7f')||_0x1da9ca===_0x35ad('0x79')||_0x1da9ca==='rtpaudioqosbridged'||_0x1da9ca===_0x35ad('0x7a')||_0x1da9ca===_0x35ad('0x7b')||_0x1da9ca===_0x35ad('0x7c')||_0x1da9ca===_0x35ad('0x7d')||_0x1da9ca===_0x35ad('0x7e')||_0x1da9ca==='rtpaudioqosrttbridged'||_0x1da9ca===_0x35ad('0x80')||_0x1da9ca===_0x35ad('0x81')||_0x1da9ca==='state'||_0x1da9ca===_0x35ad('0x34')){return![];}return!![];};exports[_0x35ad('0x82')]=function(_0x891ab4,_0x286543){var _0x4bd652,_0x351f14,_0x59fb4e;if(_0x286543<=0x0){_0x286543=0x1;}_0x4bd652=new RegExp(_0x35ad('0x83')+_0x286543+'}$');_0x351f14=Math[_0x35ad('0x84')](0xa,_0x286543-0x1);_0x59fb4e=Math[_0x35ad('0x84')](0xa,_0x286543)-0x1;return util['format']('%s',_[_0x35ad('0x85')](_0x891ab4,_0x4bd652,_['random'](_0x351f14,_0x59fb4e)));};exports[_0x35ad('0x86')]=function(_0x554ca4){var _0x5ad236=_0x554ca4[_0x35ad('0x87')](/"(.*?)"/);return _0x5ad236?_0x5ad236[0x1]:_0x554ca4;};exports[_0x35ad('0x88')]=function(_0x58fed1){var _0x29337b=_0x58fed1[_0x35ad('0x87')](/<(.*?)>/);return _0x29337b?_0x29337b[0x1]:_0x58fed1;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index a30b4ba..0cf2259 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(_0x2c003b,_0x4b0db4){var _0x36f476=function(_0x1a41ae){while(--_0x1a41ae){_0x2c003b['push'](_0x2c003b['shift']());}};_0x36f476(++_0x4b0db4);}(_0x7a54,0x106));var _0x47a5=function(_0x6cdf08,_0x3080a8){_0x6cdf08=_0x6cdf08-0x0;var _0x6f823c=_0x7a54[_0x6cdf08];return _0x6f823c;};'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 _0x7a54=['number','boolean','queuepause','reload','voicequeuechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x2f7e5e,_0x50028b){var _0x3db059=function(_0x10e211){while(--_0x10e211){_0x2f7e5e['push'](_0x2f7e5e['shift']());}};_0x3db059(++_0x50028b);}(_0x7a54,0x106));var _0x47a5=function(_0x6dbb26,_0x5b1081){_0x6dbb26=_0x6dbb26-0x0;var _0x3e98a0=_0x7a54[_0x6dbb26];return _0x3e98a0;};'use strict';exports[_0x47a5('0x0')]={'queue':{'type':_0x47a5('0x1'),'required':!![]},'interface':{'type':_0x47a5('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x47a5('0x2'),'required':![]},'paused':{'type':_0x47a5('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0x47a5('0x1'),'required':!![]},'interface':{'type':_0x47a5('0x1'),'required':!![]}};exports[_0x47a5('0x4')]={'interface':{'type':_0x47a5('0x1'),'required':!![]},'paused':{'type':_0x47a5('0x3')},'reason':{'type':'string','required':![]}};exports[_0x47a5('0x5')]={'module':{'type':'string','required':![]}};exports[_0x47a5('0x6')]={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':'string'},'mixmonitorid':{'type':'string'}};exports[_0x47a5('0x7')]={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index c14288f..2dd216f 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 _0x07d0=['dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','SIP/%s','isNil','interface','format','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','total','abandoned','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','prototype','name','isUndefined','initTelephones','length','mergeFromDatabase','initTrunks','initVoiceQueues','voiceQueues','initTriggers','initZendeskAccounts','zendeskAccounts','initFreshdeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initDynamics365Accounts','initVoiceQueueReports','groupBy','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','queuecallercompleteAt','queuecallerexitAt','diff','queuecallercomplete','seconds','initVoiceCallReports','outbound','duration','disposition','billableseconds','initCampaigns','initVoiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','bluebird','util','lodash','../model/agent','../model/telephone','../model/voiceQueue','../model/template','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','triggers','campaigns','templates','voiceExtensions','channels','outboundChannels','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts'];(function(_0x2ecd91,_0x1f21e8){var _0x3bf737=function(_0x1563d7){while(--_0x1563d7){_0x2ecd91['push'](_0x2ecd91['shift']());}};_0x3bf737(++_0x1f21e8);}(_0x07d0,0x1ce));var _0x007d=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0x07d0[_0x1b6186];return _0x186121;};'use strict';var BPromise=require(_0x007d('0x0'));var util=require(_0x007d('0x1'));var _=require(_0x007d('0x2'));var moment=require('moment');var Agent=require(_0x007d('0x3'));var Telephone=require(_0x007d('0x4'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0x007d('0x5'));var Trigger=require('../model/trigger');var Template=require(_0x007d('0x6'));var Campaign=require('../model/campaign');var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0x007d('0x7'));var FreshdeskAccount=require(_0x007d('0x8'));var SugarcrmAccount=require(_0x007d('0x9'));var ZohoAccount=require(_0x007d('0xa'));var DeskAccount=require(_0x007d('0xb'));var VtigerAccount=require(_0x007d('0xc'));var ServicenowAccount=require(_0x007d('0xd'));var Dynamics365Account=require(_0x007d('0xe'));var FreshsalesAccount=require(_0x007d('0xf'));var FaxAccount=require(_0x007d('0x10'));var Realtime=function(){this[_0x007d('0x11')]={};this[_0x007d('0x12')]={};this[_0x007d('0x13')]={};this['voiceQueues']={};this[_0x007d('0x14')]={};this[_0x007d('0x15')]={};this[_0x007d('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x007d('0x17')]={};this[_0x007d('0x18')]={};this['queueChannels']={};this[_0x007d('0x19')]={};this['timers']={};this['zendeskAccounts']={};this[_0x007d('0x1a')]={};this[_0x007d('0x1b')]={};this[_0x007d('0x1c')]={};this[_0x007d('0x1d')]={};this[_0x007d('0x1e')]={};this[_0x007d('0x1f')]={};this[_0x007d('0x20')]={};this[_0x007d('0x21')]={};this[_0x007d('0x22')]={};this[_0x007d('0x23')]={};};function freeIsNotKey(_0x314341,_0x13b02f,_0x58dc3f){var _0x3a2b03=_[_0x007d('0x24')](_0x314341,function(_0x2866be,_0x2adc7a){return _0x2866be[_0x58dc3f];});for(var _0x541506 in _0x13b02f){if(_0x13b02f[_0x007d('0x25')](_0x541506)){if(!_0x3a2b03[_0x541506]){delete _0x13b02f[_0x541506];}}}}function freeIsNotKeySip(_0x264bac,_0x400403){var _0x11e4cc=_[_0x007d('0x24')](_0x264bac,function(_0x4f55c5,_0x22537d){return util['format'](_0x007d('0x26'),_0x4f55c5['name']);});for(var _0x126b86 in _0x400403){if(_0x400403['hasOwnProperty'](_0x126b86)){if(!_0x11e4cc[_0x126b86]){delete _0x400403[_0x126b86];}}}}function freeIsNotKeyAgent(_0x5503b5,_0x22df36){var _0x588e74=_[_0x007d('0x24')](_0x5503b5,function(_0x4403ab,_0x1753e5){var _0x594e6a=_[_0x007d('0x27')](_0x4403ab[_0x007d('0x28')])?util[_0x007d('0x29')](_0x007d('0x26'),_0x4403ab['name']):_0x4403ab['interface'];return _0x594e6a;});for(var _0x4e82f2 in _0x22df36){if(_0x22df36[_0x007d('0x25')](_0x4e82f2)){if(!_0x588e74[_0x4e82f2]){delete _0x22df36[_0x4e82f2];}}}}function clearVoiceCallReports(_0x186b3b){_0x186b3b['total']=0x0;_0x186b3b[_0x007d('0x2a')]=0x0;_0x186b3b[_0x007d('0x2b')]=0x0;_0x186b3b[_0x007d('0x2c')]=0x0;_0x186b3b[_0x007d('0x2d')]=0x0;}function clearCampaigns(_0x46f422){if(!_[_0x007d('0x2e')](_0x46f422)){for(var _0xa8192e in _0x46f422){if(_0x46f422[_0x007d('0x25')](_0xa8192e)){_0x46f422[_0xa8192e]['ivrTotalCallsDays']=0x0;_0x46f422[_0xa8192e][_0x007d('0x2f')]=0x0;}}}}function clearVoiceQueues(_0xd2e715){if(!_[_0x007d('0x2e')](_0xd2e715)){for(var _0x4efa61 in _0xd2e715){if(_0xd2e715[_0x007d('0x25')](_0x4efa61)){_0xd2e715[_0x4efa61][_0x007d('0x30')]=0x0;_0xd2e715[_0x4efa61][_0x007d('0x2a')]=0x0;_0xd2e715[_0x4efa61]['unmanaged']=0x0;_0xd2e715[_0x4efa61][_0x007d('0x31')]=0x0;_0xd2e715[_0x4efa61]['sumHoldTime']=0x0;_0xd2e715[_0x4efa61]['sumDuration']=0x0;_0xd2e715[_0x4efa61]['sumBillable']=0x0;_0xd2e715[_0x4efa61][_0x007d('0x32')]=0x0;_0xd2e715[_0x4efa61]['outboundNoAnswerCallsDay']=0x0;_0xd2e715[_0x4efa61][_0x007d('0x33')]=0x0;_0xd2e715[_0x4efa61]['outboundCongestionCallsDay']=0x0;_0xd2e715[_0x4efa61][_0x007d('0x34')]=0x0;_0xd2e715[_0x4efa61][_0x007d('0x35')]=0x0;_0xd2e715[_0x4efa61][_0x007d('0x36')]=0x0;_0xd2e715[_0x4efa61][_0x007d('0x37')]=0x0;_0xd2e715[_0x4efa61][_0x007d('0x38')]=0x0;_0xd2e715[_0x4efa61][_0x007d('0x39')]=0x0;_0xd2e715[_0x4efa61][_0x007d('0x3a')]=0x0;_0xd2e715[_0x4efa61][_0x007d('0x3b')]=0x0;_0xd2e715[_0x4efa61][_0x007d('0x32')]=0x0;_0xd2e715[_0x4efa61][_0x007d('0x3c')]=0x0;_0xd2e715[_0x4efa61]['queueStatusComplete']=!![];}}}}Realtime[_0x007d('0x3d')]['mergeFromDatabase']=function(_0x1a0261,_0x193d83){for(var _0x4f6a64 in _0x193d83){if(_0x1a0261[_0x007d('0x25')](_0x4f6a64)){_0x1a0261[_0x4f6a64]=_0x193d83[_0x4f6a64];}}};Realtime[_0x007d('0x3d')]['initAgents']=function(){var _0x106d79=this;return function(_0x26c91a){if(_0x26c91a){freeIsNotKeyAgent(_0x26c91a,_0x106d79[_0x007d('0x11')]);for(var _0x247908=0x0,_0x439e63={},_0x20871f={};_0x247908<_0x26c91a['length'];_0x247908+=0x1){_0x439e63=_0x26c91a[_0x247908];var _0xecd774=_['isNil'](_0x439e63[_0x007d('0x28')])?util[_0x007d('0x29')](_0x007d('0x26'),_0x439e63[_0x007d('0x3e')]):_0x439e63[_0x007d('0x28')];if(_[_0x007d('0x3f')](_0x106d79[_0x007d('0x11')][_0xecd774])){_0x106d79[_0x007d('0x11')][_0xecd774]=new Agent(_0x439e63);}else{_0x106d79['mergeFromDatabase'](_0x106d79[_0x007d('0x11')][_0xecd774],_0x439e63);}}}return _0x106d79[_0x007d('0x11')];};};Realtime[_0x007d('0x3d')][_0x007d('0x40')]=function(){var _0x30be5a=this;return function(_0x2e0bc5){if(_0x2e0bc5){freeIsNotKeySip(_0x2e0bc5,_0x30be5a['telephones']);for(var _0x302cba=0x0,_0x296db5={},_0x4dadbf={};_0x302cba<_0x2e0bc5[_0x007d('0x41')];_0x302cba+=0x1){_0x296db5=_0x2e0bc5[_0x302cba];if(_[_0x007d('0x3f')](_0x30be5a[_0x007d('0x12')][util[_0x007d('0x29')](_0x007d('0x26'),_0x296db5[_0x007d('0x3e')])])){_0x30be5a[_0x007d('0x12')][util[_0x007d('0x29')]('SIP/%s',_0x296db5[_0x007d('0x3e')])]=new Telephone(_0x296db5);}else{_0x30be5a[_0x007d('0x42')](_0x30be5a[_0x007d('0x12')][util[_0x007d('0x29')](_0x007d('0x26'),_0x296db5[_0x007d('0x3e')])],_0x296db5);}}}return _0x30be5a[_0x007d('0x12')];};};Realtime['prototype'][_0x007d('0x43')]=function(){var _0x17412e=this;return function(_0x2427dc){if(_0x2427dc){freeIsNotKeySip(_0x2427dc,_0x17412e['trunks']);for(var _0x5f5763=0x0,_0x2345e6={},_0xde89f3={};_0x5f5763<_0x2427dc[_0x007d('0x41')];_0x5f5763+=0x1){_0x2345e6=_0x2427dc[_0x5f5763];if(_[_0x007d('0x3f')](_0x17412e['trunks'][util[_0x007d('0x29')](_0x007d('0x26'),_0x2345e6['name'])])){_0x17412e[_0x007d('0x13')][util[_0x007d('0x29')](_0x007d('0x26'),_0x2345e6['name'])]=new Trunk(_0x2345e6);}else{_0x17412e[_0x007d('0x42')](_0x17412e[_0x007d('0x13')][util[_0x007d('0x29')]('SIP/%s',_0x2345e6[_0x007d('0x3e')])],_0x2345e6);}}}return _0x17412e['trunks'];};};Realtime[_0x007d('0x3d')][_0x007d('0x44')]=function(){var _0x463920=this;return function(_0x1b937a){if(_0x1b937a){freeIsNotKey(_0x1b937a,_0x463920[_0x007d('0x45')],_0x007d('0x3e'));for(var _0xb2872d=0x0,_0x542de7={},_0x3a755e={};_0xb2872d<_0x1b937a[_0x007d('0x41')];_0xb2872d+=0x1){_0x542de7=_0x1b937a[_0xb2872d];if(_['isUndefined'](_0x463920[_0x007d('0x45')][_0x542de7['name']])){_0x463920[_0x007d('0x45')][_0x542de7['name']]=new VoiceQueue(_0x542de7);}else{_0x463920[_0x007d('0x42')](_0x463920[_0x007d('0x45')][_0x542de7[_0x007d('0x3e')]],_0x542de7);}}}return _0x463920[_0x007d('0x45')];};};Realtime[_0x007d('0x3d')][_0x007d('0x46')]=function(){var _0x2fa851=this;return function(_0x55e7ca){if(_0x55e7ca){freeIsNotKey(_0x55e7ca,_0x2fa851['triggers'],'id');for(var _0x2dee52=0x0,_0x10420a={},_0x629d0={};_0x2dee52<_0x55e7ca[_0x007d('0x41')];_0x2dee52+=0x1){_0x10420a=_0x55e7ca[_0x2dee52];if(_[_0x007d('0x3f')](_0x2fa851[_0x007d('0x14')][_0x10420a['id']])){_0x2fa851[_0x007d('0x14')][_0x10420a['id']]=new Trigger(_0x10420a);}else{_0x2fa851['mergeFromDatabase'](_0x2fa851['triggers'][_0x10420a['id']],_0x10420a);}}}return _0x2fa851['triggers'];};};Realtime[_0x007d('0x3d')]['initTemplates']=function(){var _0x492f91=this;return function(_0x34c44c){if(_0x34c44c){freeIsNotKey(_0x34c44c,_0x492f91[_0x007d('0x16')],'id');for(var _0x6189ed=0x0,_0x1247d0={},_0x10065e={};_0x6189ed<_0x34c44c[_0x007d('0x41')];_0x6189ed+=0x1){_0x1247d0=_0x34c44c[_0x6189ed];if(_[_0x007d('0x3f')](_0x492f91[_0x007d('0x16')][_0x1247d0['id']])){_0x492f91[_0x007d('0x16')][_0x1247d0['id']]=new Template(_0x1247d0);}else{_0x492f91['mergeFromDatabase'](_0x492f91['templates'][_0x1247d0['id']],_0x1247d0);}}}return _0x492f91[_0x007d('0x16')];};};Realtime['prototype'][_0x007d('0x47')]=function(){var _0x3bd785=this;return function(_0x172b5a){if(_0x172b5a){freeIsNotKey(_0x172b5a,_0x3bd785[_0x007d('0x48')],'id');for(var _0x496d4f=0x0,_0x3ef663={},_0x21be59={};_0x496d4f<_0x172b5a[_0x007d('0x41')];_0x496d4f+=0x1){_0x3ef663=_0x172b5a[_0x496d4f];if(_[_0x007d('0x3f')](_0x3bd785[_0x007d('0x48')][_0x3ef663['id']])){_0x3bd785[_0x007d('0x48')][_0x3ef663['id']]=new ZendeskAccount(_0x3ef663);}else{_0x3bd785[_0x007d('0x42')](_0x3bd785[_0x007d('0x48')][_0x3ef663['id']],_0x3ef663);}}}return _0x3bd785[_0x007d('0x48')];};};Realtime['prototype']['initSalesforceAccounts']=function(){var _0x5e36e9=this;return function(_0x244d6a){if(_0x244d6a){freeIsNotKey(_0x244d6a,_0x5e36e9[_0x007d('0x1a')],'id');for(var _0x47fe61=0x0,_0x5efcb0={},_0x17efc0={};_0x47fe61<_0x244d6a[_0x007d('0x41')];_0x47fe61+=0x1){_0x5efcb0=_0x244d6a[_0x47fe61];if(_['isUndefined'](_0x5e36e9['salesforceAccounts'][_0x5efcb0['id']])){_0x5e36e9['salesforceAccounts'][_0x5efcb0['id']]=new SalesforceAccount(_0x5efcb0);}else{_0x5e36e9['mergeFromDatabase'](_0x5e36e9['salesforceAccounts'][_0x5efcb0['id']],_0x5efcb0);}}}return _0x5e36e9[_0x007d('0x1a')];};};Realtime[_0x007d('0x3d')][_0x007d('0x49')]=function(){var _0x1eb0b3=this;return function(_0x4684a5){if(_0x4684a5){freeIsNotKey(_0x4684a5,_0x1eb0b3[_0x007d('0x1c')],'id');for(var _0x56003a=0x0,_0x3450de={},_0x10be15={};_0x56003a<_0x4684a5['length'];_0x56003a+=0x1){_0x3450de=_0x4684a5[_0x56003a];if(_[_0x007d('0x3f')](_0x1eb0b3['freshdeskAccounts'][_0x3450de['id']])){_0x1eb0b3['freshdeskAccounts'][_0x3450de['id']]=new FreshdeskAccount(_0x3450de);}else{_0x1eb0b3[_0x007d('0x42')](_0x1eb0b3[_0x007d('0x1c')][_0x3450de['id']],_0x3450de);}}}return _0x1eb0b3['freshdeskAccounts'];};};Realtime[_0x007d('0x3d')]['initZohoAccounts']=function(){var _0x383b65=this;return function(_0x4d7e2e){if(_0x4d7e2e){freeIsNotKey(_0x4d7e2e,_0x383b65[_0x007d('0x1d')],'id');for(var _0x408e13=0x0,_0x5d01cb={},_0x3c8d5e={};_0x408e13<_0x4d7e2e[_0x007d('0x41')];_0x408e13+=0x1){_0x5d01cb=_0x4d7e2e[_0x408e13];if(_[_0x007d('0x3f')](_0x383b65[_0x007d('0x1d')][_0x5d01cb['id']])){_0x383b65[_0x007d('0x1d')][_0x5d01cb['id']]=new ZohoAccount(_0x5d01cb);}else{_0x383b65['mergeFromDatabase'](_0x383b65[_0x007d('0x1d')][_0x5d01cb['id']],_0x5d01cb);}}}return _0x383b65[_0x007d('0x1d')];};};Realtime[_0x007d('0x3d')]['initDeskAccounts']=function(){var _0x5ba5e5=this;return function(_0x143dc6){if(_0x143dc6){freeIsNotKey(_0x143dc6,_0x5ba5e5[_0x007d('0x1e')],'id');for(var _0x1cb679=0x0,_0x3f4ead={},_0x5a34e4={};_0x1cb679<_0x143dc6[_0x007d('0x41')];_0x1cb679+=0x1){_0x3f4ead=_0x143dc6[_0x1cb679];if(_[_0x007d('0x3f')](_0x5ba5e5[_0x007d('0x1e')][_0x3f4ead['id']])){_0x5ba5e5['deskAccounts'][_0x3f4ead['id']]=new DeskAccount(_0x3f4ead);}else{_0x5ba5e5[_0x007d('0x42')](_0x5ba5e5['deskAccounts'][_0x3f4ead['id']],_0x3f4ead);}}}return _0x5ba5e5[_0x007d('0x1e')];};};Realtime['prototype'][_0x007d('0x4a')]=function(){var _0x262d75=this;return function(_0x459722){if(_0x459722){freeIsNotKey(_0x459722,_0x262d75[_0x007d('0x1b')],'id');for(var _0x44c846=0x0,_0x56b5f1={},_0x521d52={};_0x44c846<_0x459722[_0x007d('0x41')];_0x44c846+=0x1){_0x56b5f1=_0x459722[_0x44c846];if(_[_0x007d('0x3f')](_0x262d75[_0x007d('0x1b')][_0x56b5f1['id']])){_0x262d75[_0x007d('0x1b')][_0x56b5f1['id']]=new SugarcrmAccount(_0x56b5f1);}else{_0x262d75['mergeFromDatabase'](_0x262d75[_0x007d('0x1b')][_0x56b5f1['id']],_0x56b5f1);}}}return _0x262d75['sugarcrmAccounts'];};};Realtime[_0x007d('0x3d')][_0x007d('0x4b')]=function(){var _0x4b1c00=this;return function(_0x156fe5){if(_0x156fe5){freeIsNotKey(_0x156fe5,_0x4b1c00[_0x007d('0x1f')],'id');for(var _0x241ac2=0x0,_0x5058aa={},_0x3d4e5c={};_0x241ac2<_0x156fe5[_0x007d('0x41')];_0x241ac2+=0x1){_0x5058aa=_0x156fe5[_0x241ac2];if(_['isUndefined'](_0x4b1c00[_0x007d('0x1f')][_0x5058aa['id']])){_0x4b1c00[_0x007d('0x1f')][_0x5058aa['id']]=new VtigerAccount(_0x5058aa);}else{_0x4b1c00[_0x007d('0x42')](_0x4b1c00[_0x007d('0x1f')][_0x5058aa['id']],_0x5058aa);}}}return _0x4b1c00[_0x007d('0x1f')];};};Realtime[_0x007d('0x3d')]['initServicenowAccounts']=function(){var _0xb93742=this;return function(_0x1698c3){if(_0x1698c3){freeIsNotKey(_0x1698c3,_0xb93742[_0x007d('0x20')],'id');for(var _0x58ec41=0x0,_0x577cf6={},_0x47e026={};_0x58ec41<_0x1698c3[_0x007d('0x41')];_0x58ec41+=0x1){_0x577cf6=_0x1698c3[_0x58ec41];if(_[_0x007d('0x3f')](_0xb93742[_0x007d('0x20')][_0x577cf6['id']])){_0xb93742[_0x007d('0x20')][_0x577cf6['id']]=new ServicenowAccount(_0x577cf6);}else{_0xb93742[_0x007d('0x42')](_0xb93742[_0x007d('0x20')][_0x577cf6['id']],_0x577cf6);}}}return _0xb93742[_0x007d('0x20')];};};Realtime[_0x007d('0x3d')][_0x007d('0x4c')]=function(){var _0x28c070=this;return function(_0x5b316f){if(_0x5b316f){freeIsNotKey(_0x5b316f,_0x28c070[_0x007d('0x21')],'id');for(var _0x1f2f56=0x0,_0x296ac9={},_0x401b39={};_0x1f2f56<_0x5b316f[_0x007d('0x41')];_0x1f2f56+=0x1){_0x296ac9=_0x5b316f[_0x1f2f56];if(_[_0x007d('0x3f')](_0x28c070['dynamics365Accounts'][_0x296ac9['id']])){_0x28c070[_0x007d('0x21')][_0x296ac9['id']]=new Dynamics365Account(_0x296ac9);}else{_0x28c070[_0x007d('0x42')](_0x28c070['dynamics365Accounts'][_0x296ac9['id']],_0x296ac9);}}}return _0x28c070[_0x007d('0x21')];};};Realtime[_0x007d('0x3d')]['initFreshsalesAccounts']=function(){var _0x4d6603=this;return function(_0x408d0a){if(_0x408d0a){freeIsNotKey(_0x408d0a,_0x4d6603['freshsalesAccounts'],'id');for(var _0x1424d3=0x0,_0xe4e7af={},_0x4c221d={};_0x1424d3<_0x408d0a[_0x007d('0x41')];_0x1424d3+=0x1){_0xe4e7af=_0x408d0a[_0x1424d3];if(_['isUndefined'](_0x4d6603[_0x007d('0x22')][_0xe4e7af['id']])){_0x4d6603[_0x007d('0x22')][_0xe4e7af['id']]=new FreshsalesAccount(_0xe4e7af);}else{_0x4d6603[_0x007d('0x42')](_0x4d6603[_0x007d('0x22')][_0xe4e7af['id']],_0xe4e7af);}}}return _0x4d6603[_0x007d('0x22')];};};Realtime['prototype']['initVoiceQueueHopperHistory']=function(){var _0x5abfc0=this;return function(_0xb8ab2e){for(var _0x29a768=0x0;_0x29a768<_0xb8ab2e[_0x007d('0x41')];_0x29a768+=0x1){_['merge'](_0x5abfc0['voiceQueues'][_0xb8ab2e[_0x29a768][_0x007d('0x3e')]],_0xb8ab2e[_0x29a768]);}return _0x5abfc0[_0x007d('0x45')];};};Realtime[_0x007d('0x3d')][_0x007d('0x4d')]=function(){var _0x2d714a=this;return function(_0x25bb02){clearVoiceQueues(_0x2d714a[_0x007d('0x45')]);if(_0x25bb02){_0x25bb02=_[_0x007d('0x4e')](_0x25bb02,'uniqueid');for(var _0x4587ac in _0x25bb02){if(_0x25bb02[_0x007d('0x25')](_0x4587ac)){var _0x44aac6={};for(var _0x3ed53e=0x0;_0x3ed53e<_0x25bb02[_0x4587ac][_0x007d('0x41')];_0x3ed53e+=0x1){var _0xe9ce91=_0x25bb02[_0x4587ac][_0x3ed53e][_0x007d('0x4f')];if(_0x2d714a['voiceQueues'][_0xe9ce91]){if(_0x25bb02[_0x4587ac][_0x3ed53e][_0x007d('0x50')]){_0x2d714a[_0x007d('0x45')][_0xe9ce91]['unmanaged']+=0x1;}if(_0x25bb02[_0x4587ac][_0x3ed53e][_0x007d('0x51')]){_0x2d714a['voiceQueues'][_0xe9ce91]['abandoned']+=0x1;}_0x2d714a['voiceQueues'][_0xe9ce91][_0x007d('0x2b')]+=moment(_0x25bb02[_0x4587ac][_0x3ed53e][_0x007d('0x52')])['diff'](moment(_0x25bb02[_0x4587ac][_0x3ed53e][_0x007d('0x53')]),'seconds')||0x0;if(_0x3ed53e===_0x25bb02[_0x4587ac][_0x007d('0x41')]-0x1){_0x2d714a[_0x007d('0x45')][_0xe9ce91][_0x007d('0x2c')]+=moment(_0x25bb02[_0x4587ac][_0x3ed53e][_0x007d('0x54')]||_0x25bb02[_0x4587ac][_0x3ed53e]['queuecallerabandonAt']||_0x25bb02[_0x4587ac][_0x3ed53e][_0x007d('0x55')])[_0x007d('0x56')](moment(_0x25bb02[_0x4587ac][_0x3ed53e][_0x007d('0x53')]),'seconds')||0x0;_0x2d714a[_0x007d('0x45')][_0xe9ce91][_0x007d('0x30')]+=0x1;if(_0x25bb02[_0x4587ac][_0x3ed53e][_0x007d('0x57')]){_0x2d714a[_0x007d('0x45')][_0xe9ce91]['answered']+=0x1;_0x2d714a[_0x007d('0x45')][_0xe9ce91][_0x007d('0x2d')]+=moment(_0x25bb02[_0x4587ac][_0x3ed53e][_0x007d('0x54')])['diff'](moment(_0x25bb02[_0x4587ac][_0x3ed53e][_0x007d('0x52')]),_0x007d('0x58'))||0x0;}}else{_0x2d714a[_0x007d('0x45')][_0xe9ce91][_0x007d('0x2c')]+=_0x2d714a[_0x007d('0x45')][_0xe9ce91][_0x007d('0x2b')]||0x0;}}}}}}return _0x2d714a[_0x007d('0x45')];};};Realtime['prototype'][_0x007d('0x59')]=function(){var _0x2fb0c0=this;return function(_0x38a297){clearVoiceCallReports(_0x2fb0c0[_0x007d('0x5a')]);if(_0x38a297){for(var _0x4871c9=0x0;_0x4871c9<_0x38a297['length'];_0x4871c9+=0x1){_0x2fb0c0[_0x007d('0x5a')][_0x007d('0x30')]+=0x1;_0x2fb0c0['outbound']['sumDuration']+=_0x38a297[_0x4871c9][_0x007d('0x5b')];if(_0x38a297[_0x4871c9][_0x007d('0x5c')]==='ANSWERED'){_0x2fb0c0[_0x007d('0x5a')][_0x007d('0x2a')]+=0x1;_0x2fb0c0[_0x007d('0x5a')]['sumHoldTime']+=_0x38a297[_0x4871c9][_0x007d('0x5b')]-_0x38a297[_0x4871c9][_0x007d('0x5d')]||0x0;_0x2fb0c0['outbound']['sumBillable']+=_0x38a297[_0x4871c9]['billableseconds'];}}}return _0x2fb0c0['outbound'];};};Realtime['prototype'][_0x007d('0x5e')]=function(){var _0x1d1f3a=this;return function(_0x115fa1){if(_0x115fa1){freeIsNotKey(_0x115fa1,_0x1d1f3a['campaigns'],_0x007d('0x3e'));for(var _0x2b04eb=0x0,_0x5c94c7={};_0x2b04eb<_0x115fa1[_0x007d('0x41')];_0x2b04eb+=0x1){_0x5c94c7=_0x115fa1[_0x2b04eb];if(_[_0x007d('0x3f')](_0x1d1f3a['campaigns'][_0x5c94c7[_0x007d('0x3e')]])){_0x1d1f3a[_0x007d('0x15')][_0x5c94c7['name']]=new Campaign(_0x5c94c7);}else{_0x1d1f3a[_0x007d('0x42')](_0x1d1f3a['campaigns'][_0x5c94c7[_0x007d('0x3e')]],_0x5c94c7);}}}return _0x1d1f3a[_0x007d('0x15')];};};Realtime[_0x007d('0x3d')][_0x007d('0x5f')]=function(){var _0x3995a6=this;return function(_0x52926e){if(_0x52926e){freeIsNotKey(_0x52926e,_0x3995a6[_0x007d('0x17')],'id');for(var _0xae1f41=0x0,_0x2698c3={};_0xae1f41<_0x52926e[_0x007d('0x41')];_0xae1f41+=0x1){_0x2698c3=_0x52926e[_0xae1f41];if(_[_0x007d('0x3f')](_0x3995a6['voiceExtensions'][_0x2698c3['id']])){_0x3995a6['voiceExtensions'][_0x2698c3['id']]=new VoiceExtension(_0x2698c3);}else{_0x3995a6[_0x007d('0x42')](_0x3995a6['voiceExtensions'][_0x2698c3['id']],_0x2698c3);}}}return _0x3995a6[_0x007d('0x17')];};};Realtime['prototype'][_0x007d('0x60')]=function(){var _0x4c8ff7=this;return function(_0x3ede9c){clearCampaigns(_0x4c8ff7[_0x007d('0x15')]);for(var _0x47826f=0x0;_0x47826f<_0x3ede9c[_0x007d('0x41')];_0x47826f+=0x1){_[_0x007d('0x61')](_0x4c8ff7[_0x007d('0x15')][_0x3ede9c[_0x47826f][_0x007d('0x3e')]],_0x3ede9c[_0x47826f]);}return _0x4c8ff7[_0x007d('0x15')];};};Realtime[_0x007d('0x3d')][_0x007d('0x62')]=function(){var _0x8e5ab4=this;return function(_0x1f4083){if(_0x1f4083){freeIsNotKey(_0x1f4083,_0x8e5ab4[_0x007d('0x23')],'id');for(var _0x16e4e5=0x0,_0x586cb4={},_0x17334d={};_0x16e4e5<_0x1f4083[_0x007d('0x41')];_0x16e4e5+=0x1){_0x586cb4=_0x1f4083[_0x16e4e5];if(_[_0x007d('0x3f')](_0x8e5ab4[_0x007d('0x23')][_0x586cb4['id']])){_0x8e5ab4[_0x007d('0x23')][_0x586cb4['id']]=new FaxAccount(_0x586cb4);}else{_0x8e5ab4[_0x007d('0x42')](_0x8e5ab4[_0x007d('0x23')][_0x586cb4['id']],_0x586cb4);}}}return _0x8e5ab4[_0x007d('0x23')];};};module['exports']=Realtime; \ No newline at end of file +var _0xf112=['isUndefined','initTelephones','name','initTrunks','initTriggers','initTemplates','templates','zendeskAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initDynamics365Accounts','merge','initVoiceQueueReports','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','seconds','queuecallercomplete','initVoiceCallReports','duration','disposition','billableseconds','initCampaigns','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','util','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','outbound','channels','outboundChannels','timers','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','hasOwnProperty','mapKeys','format','SIP/%s','isNil','interface','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','unmanaged','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length'];(function(_0x2db179,_0x322e47){var _0x3272cd=function(_0x35d24e){while(--_0x35d24e){_0x2db179['push'](_0x2db179['shift']());}};_0x3272cd(++_0x322e47);}(_0xf112,0x1ac));var _0x2f11=function(_0x15876a,_0x15383d){_0x15876a=_0x15876a-0x0;var _0xbd900f=_0xf112[_0x15876a];return _0xbd900f;};'use strict';var BPromise=require(_0x2f11('0x0'));var util=require(_0x2f11('0x1'));var _=require('lodash');var moment=require('moment');var Agent=require(_0x2f11('0x2'));var Telephone=require(_0x2f11('0x3'));var Trunk=require(_0x2f11('0x4'));var VoiceQueue=require(_0x2f11('0x5'));var Trigger=require('../model/trigger');var Template=require(_0x2f11('0x6'));var Campaign=require(_0x2f11('0x7'));var VoiceExtension=require(_0x2f11('0x8'));var ZendeskAccount=require(_0x2f11('0x9'));var SalesforceAccount=require(_0x2f11('0xa'));var FreshdeskAccount=require(_0x2f11('0xb'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x2f11('0xc'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0x2f11('0xd'));var ServicenowAccount=require(_0x2f11('0xe'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0x2f11('0xf'));var Realtime=function(){this[_0x2f11('0x10')]={};this[_0x2f11('0x11')]={};this[_0x2f11('0x12')]={};this[_0x2f11('0x13')]={};this[_0x2f11('0x14')]={};this[_0x2f11('0x15')]={};this['templates']={};this[_0x2f11('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x2f11('0x17')]={};this['queueChannels']={};this[_0x2f11('0x18')]={};this[_0x2f11('0x19')]={};this['zendeskAccounts']={};this[_0x2f11('0x1a')]={};this[_0x2f11('0x1b')]={};this[_0x2f11('0x1c')]={};this[_0x2f11('0x1d')]={};this[_0x2f11('0x1e')]={};this[_0x2f11('0x1f')]={};this[_0x2f11('0x20')]={};this[_0x2f11('0x21')]={};this[_0x2f11('0x22')]={};this[_0x2f11('0x23')]={};};function freeIsNotKey(_0x491dea,_0x470c95,_0x3549dc){var _0x3169e9=_['mapKeys'](_0x491dea,function(_0x39ccef,_0x40d6f0){return _0x39ccef[_0x3549dc];});for(var _0x2e8bb7 in _0x470c95){if(_0x470c95[_0x2f11('0x24')](_0x2e8bb7)){if(!_0x3169e9[_0x2e8bb7]){delete _0x470c95[_0x2e8bb7];}}}}function freeIsNotKeySip(_0x1e4f17,_0x5bc359){var _0x279062=_[_0x2f11('0x25')](_0x1e4f17,function(_0x274e53,_0x48d1d2){return util[_0x2f11('0x26')](_0x2f11('0x27'),_0x274e53['name']);});for(var _0x4a761d in _0x5bc359){if(_0x5bc359[_0x2f11('0x24')](_0x4a761d)){if(!_0x279062[_0x4a761d]){delete _0x5bc359[_0x4a761d];}}}}function freeIsNotKeyAgent(_0x2d2466,_0x25b9fc){var _0xe4db95=_['mapKeys'](_0x2d2466,function(_0x3f5073,_0x25a6b0){var _0x5cba58=_[_0x2f11('0x28')](_0x3f5073[_0x2f11('0x29')])?util[_0x2f11('0x26')](_0x2f11('0x27'),_0x3f5073['name']):_0x3f5073[_0x2f11('0x29')];return _0x5cba58;});for(var _0x269746 in _0x25b9fc){if(_0x25b9fc[_0x2f11('0x24')](_0x269746)){if(!_0xe4db95[_0x269746]){delete _0x25b9fc[_0x269746];}}}}function clearVoiceCallReports(_0x118411){_0x118411[_0x2f11('0x2a')]=0x0;_0x118411[_0x2f11('0x2b')]=0x0;_0x118411[_0x2f11('0x2c')]=0x0;_0x118411[_0x2f11('0x2d')]=0x0;_0x118411[_0x2f11('0x2e')]=0x0;}function clearCampaigns(_0x2cfa65){if(!_[_0x2f11('0x2f')](_0x2cfa65)){for(var _0x46b452 in _0x2cfa65){if(_0x2cfa65[_0x2f11('0x24')](_0x46b452)){_0x2cfa65[_0x46b452][_0x2f11('0x30')]=0x0;_0x2cfa65[_0x46b452]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x3a5b17){if(!_[_0x2f11('0x2f')](_0x3a5b17)){for(var _0x182aa6 in _0x3a5b17){if(_0x3a5b17[_0x2f11('0x24')](_0x182aa6)){_0x3a5b17[_0x182aa6][_0x2f11('0x2a')]=0x0;_0x3a5b17[_0x182aa6][_0x2f11('0x2b')]=0x0;_0x3a5b17[_0x182aa6][_0x2f11('0x31')]=0x0;_0x3a5b17[_0x182aa6]['abandoned']=0x0;_0x3a5b17[_0x182aa6][_0x2f11('0x2c')]=0x0;_0x3a5b17[_0x182aa6][_0x2f11('0x2d')]=0x0;_0x3a5b17[_0x182aa6][_0x2f11('0x2e')]=0x0;_0x3a5b17[_0x182aa6][_0x2f11('0x32')]=0x0;_0x3a5b17[_0x182aa6][_0x2f11('0x33')]=0x0;_0x3a5b17[_0x182aa6]['outboundBusyCallsDay']=0x0;_0x3a5b17[_0x182aa6]['outboundCongestionCallsDay']=0x0;_0x3a5b17[_0x182aa6]['outboundNoSuchCallsDay']=0x0;_0x3a5b17[_0x182aa6]['outboundUnknownCallsDay']=0x0;_0x3a5b17[_0x182aa6]['outboundDropCallsDayTimeout']=0x0;_0x3a5b17[_0x182aa6][_0x2f11('0x34')]=0x0;_0x3a5b17[_0x182aa6][_0x2f11('0x35')]=0x0;_0x3a5b17[_0x182aa6]['outboundOriginateFailureCallsDay']=0x0;_0x3a5b17[_0x182aa6][_0x2f11('0x36')]=0x0;_0x3a5b17[_0x182aa6][_0x2f11('0x37')]=0x0;_0x3a5b17[_0x182aa6]['outboundAnswerAgiCallsDay']=0x0;_0x3a5b17[_0x182aa6][_0x2f11('0x38')]=0x0;_0x3a5b17[_0x182aa6][_0x2f11('0x39')]=!![];}}}}Realtime[_0x2f11('0x3a')][_0x2f11('0x3b')]=function(_0x574209,_0x2d2710){for(var _0x25cd77 in _0x2d2710){if(_0x574209[_0x2f11('0x24')](_0x25cd77)){_0x574209[_0x25cd77]=_0x2d2710[_0x25cd77];}}};Realtime[_0x2f11('0x3a')][_0x2f11('0x3c')]=function(){var _0x209f90=this;return function(_0x1494af){if(_0x1494af){freeIsNotKeyAgent(_0x1494af,_0x209f90['agents']);for(var _0x19225b=0x0,_0x4c6fb8={},_0x1b0f56={};_0x19225b<_0x1494af[_0x2f11('0x3d')];_0x19225b+=0x1){_0x4c6fb8=_0x1494af[_0x19225b];var _0x559476=_[_0x2f11('0x28')](_0x4c6fb8[_0x2f11('0x29')])?util[_0x2f11('0x26')](_0x2f11('0x27'),_0x4c6fb8['name']):_0x4c6fb8[_0x2f11('0x29')];if(_[_0x2f11('0x3e')](_0x209f90[_0x2f11('0x10')][_0x559476])){_0x209f90['agents'][_0x559476]=new Agent(_0x4c6fb8);}else{_0x209f90[_0x2f11('0x3b')](_0x209f90[_0x2f11('0x10')][_0x559476],_0x4c6fb8);}}}return _0x209f90[_0x2f11('0x10')];};};Realtime[_0x2f11('0x3a')][_0x2f11('0x3f')]=function(){var _0xa9ed37=this;return function(_0x465810){if(_0x465810){freeIsNotKeySip(_0x465810,_0xa9ed37['telephones']);for(var _0x1cef86=0x0,_0x116546={},_0x120702={};_0x1cef86<_0x465810[_0x2f11('0x3d')];_0x1cef86+=0x1){_0x116546=_0x465810[_0x1cef86];if(_[_0x2f11('0x3e')](_0xa9ed37[_0x2f11('0x11')][util[_0x2f11('0x26')](_0x2f11('0x27'),_0x116546[_0x2f11('0x40')])])){_0xa9ed37[_0x2f11('0x11')][util[_0x2f11('0x26')](_0x2f11('0x27'),_0x116546['name'])]=new Telephone(_0x116546);}else{_0xa9ed37[_0x2f11('0x3b')](_0xa9ed37[_0x2f11('0x11')][util[_0x2f11('0x26')](_0x2f11('0x27'),_0x116546[_0x2f11('0x40')])],_0x116546);}}}return _0xa9ed37[_0x2f11('0x11')];};};Realtime[_0x2f11('0x3a')][_0x2f11('0x41')]=function(){var _0x2e09c3=this;return function(_0x52c4cd){if(_0x52c4cd){freeIsNotKeySip(_0x52c4cd,_0x2e09c3[_0x2f11('0x12')]);for(var _0x136ede=0x0,_0x208eec={},_0x113c2c={};_0x136ede<_0x52c4cd[_0x2f11('0x3d')];_0x136ede+=0x1){_0x208eec=_0x52c4cd[_0x136ede];if(_[_0x2f11('0x3e')](_0x2e09c3[_0x2f11('0x12')][util[_0x2f11('0x26')](_0x2f11('0x27'),_0x208eec[_0x2f11('0x40')])])){_0x2e09c3['trunks'][util[_0x2f11('0x26')](_0x2f11('0x27'),_0x208eec[_0x2f11('0x40')])]=new Trunk(_0x208eec);}else{_0x2e09c3[_0x2f11('0x3b')](_0x2e09c3[_0x2f11('0x12')][util[_0x2f11('0x26')]('SIP/%s',_0x208eec[_0x2f11('0x40')])],_0x208eec);}}}return _0x2e09c3[_0x2f11('0x12')];};};Realtime[_0x2f11('0x3a')]['initVoiceQueues']=function(){var _0x824436=this;return function(_0x39c616){if(_0x39c616){freeIsNotKey(_0x39c616,_0x824436[_0x2f11('0x13')],_0x2f11('0x40'));for(var _0x40875a=0x0,_0x5c2b79={},_0x3ae1b9={};_0x40875a<_0x39c616[_0x2f11('0x3d')];_0x40875a+=0x1){_0x5c2b79=_0x39c616[_0x40875a];if(_[_0x2f11('0x3e')](_0x824436['voiceQueues'][_0x5c2b79[_0x2f11('0x40')]])){_0x824436[_0x2f11('0x13')][_0x5c2b79[_0x2f11('0x40')]]=new VoiceQueue(_0x5c2b79);}else{_0x824436[_0x2f11('0x3b')](_0x824436[_0x2f11('0x13')][_0x5c2b79[_0x2f11('0x40')]],_0x5c2b79);}}}return _0x824436[_0x2f11('0x13')];};};Realtime[_0x2f11('0x3a')][_0x2f11('0x42')]=function(){var _0x2db3ec=this;return function(_0x3089d6){if(_0x3089d6){freeIsNotKey(_0x3089d6,_0x2db3ec[_0x2f11('0x14')],'id');for(var _0x46554d=0x0,_0x30451d={},_0x5a680b={};_0x46554d<_0x3089d6['length'];_0x46554d+=0x1){_0x30451d=_0x3089d6[_0x46554d];if(_['isUndefined'](_0x2db3ec['triggers'][_0x30451d['id']])){_0x2db3ec[_0x2f11('0x14')][_0x30451d['id']]=new Trigger(_0x30451d);}else{_0x2db3ec['mergeFromDatabase'](_0x2db3ec[_0x2f11('0x14')][_0x30451d['id']],_0x30451d);}}}return _0x2db3ec[_0x2f11('0x14')];};};Realtime[_0x2f11('0x3a')][_0x2f11('0x43')]=function(){var _0x2508b6=this;return function(_0x17813f){if(_0x17813f){freeIsNotKey(_0x17813f,_0x2508b6[_0x2f11('0x44')],'id');for(var _0x3bdfe6=0x0,_0x28f374={},_0xcf9494={};_0x3bdfe6<_0x17813f[_0x2f11('0x3d')];_0x3bdfe6+=0x1){_0x28f374=_0x17813f[_0x3bdfe6];if(_[_0x2f11('0x3e')](_0x2508b6[_0x2f11('0x44')][_0x28f374['id']])){_0x2508b6[_0x2f11('0x44')][_0x28f374['id']]=new Template(_0x28f374);}else{_0x2508b6['mergeFromDatabase'](_0x2508b6[_0x2f11('0x44')][_0x28f374['id']],_0x28f374);}}}return _0x2508b6[_0x2f11('0x44')];};};Realtime['prototype']['initZendeskAccounts']=function(){var _0x27da48=this;return function(_0x300f23){if(_0x300f23){freeIsNotKey(_0x300f23,_0x27da48[_0x2f11('0x45')],'id');for(var _0xd4bc35=0x0,_0xf749ef={},_0x5c7529={};_0xd4bc35<_0x300f23[_0x2f11('0x3d')];_0xd4bc35+=0x1){_0xf749ef=_0x300f23[_0xd4bc35];if(_[_0x2f11('0x3e')](_0x27da48[_0x2f11('0x45')][_0xf749ef['id']])){_0x27da48[_0x2f11('0x45')][_0xf749ef['id']]=new ZendeskAccount(_0xf749ef);}else{_0x27da48[_0x2f11('0x3b')](_0x27da48['zendeskAccounts'][_0xf749ef['id']],_0xf749ef);}}}return _0x27da48[_0x2f11('0x45')];};};Realtime[_0x2f11('0x3a')]['initSalesforceAccounts']=function(){var _0x25f78d=this;return function(_0x12000e){if(_0x12000e){freeIsNotKey(_0x12000e,_0x25f78d[_0x2f11('0x1a')],'id');for(var _0x1a4a08=0x0,_0x4f82e5={},_0x35e0ff={};_0x1a4a08<_0x12000e['length'];_0x1a4a08+=0x1){_0x4f82e5=_0x12000e[_0x1a4a08];if(_[_0x2f11('0x3e')](_0x25f78d['salesforceAccounts'][_0x4f82e5['id']])){_0x25f78d[_0x2f11('0x1a')][_0x4f82e5['id']]=new SalesforceAccount(_0x4f82e5);}else{_0x25f78d[_0x2f11('0x3b')](_0x25f78d[_0x2f11('0x1a')][_0x4f82e5['id']],_0x4f82e5);}}}return _0x25f78d[_0x2f11('0x1a')];};};Realtime[_0x2f11('0x3a')][_0x2f11('0x46')]=function(){var _0x23c343=this;return function(_0x493435){if(_0x493435){freeIsNotKey(_0x493435,_0x23c343[_0x2f11('0x1c')],'id');for(var _0x43a687=0x0,_0x5f56bb={},_0x57293c={};_0x43a687<_0x493435[_0x2f11('0x3d')];_0x43a687+=0x1){_0x5f56bb=_0x493435[_0x43a687];if(_[_0x2f11('0x3e')](_0x23c343['freshdeskAccounts'][_0x5f56bb['id']])){_0x23c343[_0x2f11('0x1c')][_0x5f56bb['id']]=new FreshdeskAccount(_0x5f56bb);}else{_0x23c343['mergeFromDatabase'](_0x23c343[_0x2f11('0x1c')][_0x5f56bb['id']],_0x5f56bb);}}}return _0x23c343['freshdeskAccounts'];};};Realtime[_0x2f11('0x3a')][_0x2f11('0x47')]=function(){var _0x1d027f=this;return function(_0x1aa0d8){if(_0x1aa0d8){freeIsNotKey(_0x1aa0d8,_0x1d027f[_0x2f11('0x1d')],'id');for(var _0x16257f=0x0,_0x524184={},_0xa924ca={};_0x16257f<_0x1aa0d8[_0x2f11('0x3d')];_0x16257f+=0x1){_0x524184=_0x1aa0d8[_0x16257f];if(_[_0x2f11('0x3e')](_0x1d027f['zohoAccounts'][_0x524184['id']])){_0x1d027f['zohoAccounts'][_0x524184['id']]=new ZohoAccount(_0x524184);}else{_0x1d027f['mergeFromDatabase'](_0x1d027f[_0x2f11('0x1d')][_0x524184['id']],_0x524184);}}}return _0x1d027f[_0x2f11('0x1d')];};};Realtime[_0x2f11('0x3a')][_0x2f11('0x48')]=function(){var _0x147b0f=this;return function(_0x5a20c8){if(_0x5a20c8){freeIsNotKey(_0x5a20c8,_0x147b0f['deskAccounts'],'id');for(var _0x4ce4b9=0x0,_0x15db8d={},_0x2d2240={};_0x4ce4b9<_0x5a20c8['length'];_0x4ce4b9+=0x1){_0x15db8d=_0x5a20c8[_0x4ce4b9];if(_['isUndefined'](_0x147b0f[_0x2f11('0x1e')][_0x15db8d['id']])){_0x147b0f[_0x2f11('0x1e')][_0x15db8d['id']]=new DeskAccount(_0x15db8d);}else{_0x147b0f[_0x2f11('0x3b')](_0x147b0f['deskAccounts'][_0x15db8d['id']],_0x15db8d);}}}return _0x147b0f['deskAccounts'];};};Realtime[_0x2f11('0x3a')][_0x2f11('0x49')]=function(){var _0x5d645d=this;return function(_0x1d6fdd){if(_0x1d6fdd){freeIsNotKey(_0x1d6fdd,_0x5d645d[_0x2f11('0x1b')],'id');for(var _0x29b978=0x0,_0x4fb660={},_0x1c30b1={};_0x29b978<_0x1d6fdd[_0x2f11('0x3d')];_0x29b978+=0x1){_0x4fb660=_0x1d6fdd[_0x29b978];if(_[_0x2f11('0x3e')](_0x5d645d[_0x2f11('0x1b')][_0x4fb660['id']])){_0x5d645d[_0x2f11('0x1b')][_0x4fb660['id']]=new SugarcrmAccount(_0x4fb660);}else{_0x5d645d['mergeFromDatabase'](_0x5d645d['sugarcrmAccounts'][_0x4fb660['id']],_0x4fb660);}}}return _0x5d645d['sugarcrmAccounts'];};};Realtime[_0x2f11('0x3a')][_0x2f11('0x4a')]=function(){var _0x9f7dfc=this;return function(_0x4c68b2){if(_0x4c68b2){freeIsNotKey(_0x4c68b2,_0x9f7dfc[_0x2f11('0x1f')],'id');for(var _0x2f3e42=0x0,_0x3c909b={},_0x9277dc={};_0x2f3e42<_0x4c68b2[_0x2f11('0x3d')];_0x2f3e42+=0x1){_0x3c909b=_0x4c68b2[_0x2f3e42];if(_[_0x2f11('0x3e')](_0x9f7dfc[_0x2f11('0x1f')][_0x3c909b['id']])){_0x9f7dfc[_0x2f11('0x1f')][_0x3c909b['id']]=new VtigerAccount(_0x3c909b);}else{_0x9f7dfc['mergeFromDatabase'](_0x9f7dfc[_0x2f11('0x1f')][_0x3c909b['id']],_0x3c909b);}}}return _0x9f7dfc[_0x2f11('0x1f')];};};Realtime['prototype']['initServicenowAccounts']=function(){var _0x12db7b=this;return function(_0x3532bb){if(_0x3532bb){freeIsNotKey(_0x3532bb,_0x12db7b[_0x2f11('0x20')],'id');for(var _0x28cbc2=0x0,_0x2d0657={},_0x1e9e25={};_0x28cbc2<_0x3532bb[_0x2f11('0x3d')];_0x28cbc2+=0x1){_0x2d0657=_0x3532bb[_0x28cbc2];if(_[_0x2f11('0x3e')](_0x12db7b[_0x2f11('0x20')][_0x2d0657['id']])){_0x12db7b[_0x2f11('0x20')][_0x2d0657['id']]=new ServicenowAccount(_0x2d0657);}else{_0x12db7b[_0x2f11('0x3b')](_0x12db7b[_0x2f11('0x20')][_0x2d0657['id']],_0x2d0657);}}}return _0x12db7b[_0x2f11('0x20')];};};Realtime[_0x2f11('0x3a')][_0x2f11('0x4b')]=function(){var _0x483959=this;return function(_0x20cfde){if(_0x20cfde){freeIsNotKey(_0x20cfde,_0x483959['dynamics365Accounts'],'id');for(var _0x59522d=0x0,_0xc17c23={},_0x47a427={};_0x59522d<_0x20cfde['length'];_0x59522d+=0x1){_0xc17c23=_0x20cfde[_0x59522d];if(_[_0x2f11('0x3e')](_0x483959[_0x2f11('0x21')][_0xc17c23['id']])){_0x483959[_0x2f11('0x21')][_0xc17c23['id']]=new Dynamics365Account(_0xc17c23);}else{_0x483959['mergeFromDatabase'](_0x483959[_0x2f11('0x21')][_0xc17c23['id']],_0xc17c23);}}}return _0x483959[_0x2f11('0x21')];};};Realtime[_0x2f11('0x3a')]['initFreshsalesAccounts']=function(){var _0x2356a2=this;return function(_0x1292be){if(_0x1292be){freeIsNotKey(_0x1292be,_0x2356a2['freshsalesAccounts'],'id');for(var _0x2b9afa=0x0,_0x159813={},_0x3bfd2e={};_0x2b9afa<_0x1292be[_0x2f11('0x3d')];_0x2b9afa+=0x1){_0x159813=_0x1292be[_0x2b9afa];if(_[_0x2f11('0x3e')](_0x2356a2[_0x2f11('0x22')][_0x159813['id']])){_0x2356a2[_0x2f11('0x22')][_0x159813['id']]=new FreshsalesAccount(_0x159813);}else{_0x2356a2['mergeFromDatabase'](_0x2356a2['freshsalesAccounts'][_0x159813['id']],_0x159813);}}}return _0x2356a2[_0x2f11('0x22')];};};Realtime['prototype']['initVoiceQueueHopperHistory']=function(){var _0x1d7229=this;return function(_0x508569){for(var _0x4b8cbb=0x0;_0x4b8cbb<_0x508569[_0x2f11('0x3d')];_0x4b8cbb+=0x1){_[_0x2f11('0x4c')](_0x1d7229[_0x2f11('0x13')][_0x508569[_0x4b8cbb][_0x2f11('0x40')]],_0x508569[_0x4b8cbb]);}return _0x1d7229[_0x2f11('0x13')];};};Realtime[_0x2f11('0x3a')][_0x2f11('0x4d')]=function(){var _0x5bce5b=this;return function(_0x4aa94d){clearVoiceQueues(_0x5bce5b['voiceQueues']);if(_0x4aa94d){_0x4aa94d=_['groupBy'](_0x4aa94d,'uniqueid');for(var _0x2ee93d in _0x4aa94d){if(_0x4aa94d[_0x2f11('0x24')](_0x2ee93d)){var _0x41595d={};for(var _0x551fc5=0x0;_0x551fc5<_0x4aa94d[_0x2ee93d]['length'];_0x551fc5+=0x1){var _0x19e035=_0x4aa94d[_0x2ee93d][_0x551fc5]['queue'];if(_0x5bce5b['voiceQueues'][_0x19e035]){if(_0x4aa94d[_0x2ee93d][_0x551fc5][_0x2f11('0x4e')]){_0x5bce5b['voiceQueues'][_0x19e035][_0x2f11('0x31')]+=0x1;}if(_0x4aa94d[_0x2ee93d][_0x551fc5][_0x2f11('0x4f')]){_0x5bce5b[_0x2f11('0x13')][_0x19e035]['abandoned']+=0x1;}_0x5bce5b[_0x2f11('0x13')][_0x19e035][_0x2f11('0x2c')]+=moment(_0x4aa94d[_0x2ee93d][_0x551fc5][_0x2f11('0x50')])[_0x2f11('0x51')](moment(_0x4aa94d[_0x2ee93d][_0x551fc5][_0x2f11('0x52')]),'seconds')||0x0;if(_0x551fc5===_0x4aa94d[_0x2ee93d][_0x2f11('0x3d')]-0x1){_0x5bce5b[_0x2f11('0x13')][_0x19e035][_0x2f11('0x2d')]+=moment(_0x4aa94d[_0x2ee93d][_0x551fc5][_0x2f11('0x53')]||_0x4aa94d[_0x2ee93d][_0x551fc5][_0x2f11('0x54')]||_0x4aa94d[_0x2ee93d][_0x551fc5][_0x2f11('0x55')])[_0x2f11('0x51')](moment(_0x4aa94d[_0x2ee93d][_0x551fc5]['queuecallerjoinAt']),_0x2f11('0x56'))||0x0;_0x5bce5b[_0x2f11('0x13')][_0x19e035][_0x2f11('0x2a')]+=0x1;if(_0x4aa94d[_0x2ee93d][_0x551fc5][_0x2f11('0x57')]){_0x5bce5b[_0x2f11('0x13')][_0x19e035]['answered']+=0x1;_0x5bce5b[_0x2f11('0x13')][_0x19e035][_0x2f11('0x2e')]+=moment(_0x4aa94d[_0x2ee93d][_0x551fc5][_0x2f11('0x53')])[_0x2f11('0x51')](moment(_0x4aa94d[_0x2ee93d][_0x551fc5][_0x2f11('0x50')]),_0x2f11('0x56'))||0x0;}}else{_0x5bce5b['voiceQueues'][_0x19e035]['sumDuration']+=_0x5bce5b[_0x2f11('0x13')][_0x19e035]['sumHoldTime']||0x0;}}}}}}return _0x5bce5b['voiceQueues'];};};Realtime[_0x2f11('0x3a')][_0x2f11('0x58')]=function(){var _0x23562f=this;return function(_0x345ea8){clearVoiceCallReports(_0x23562f[_0x2f11('0x16')]);if(_0x345ea8){for(var _0x305b27=0x0;_0x305b27<_0x345ea8['length'];_0x305b27+=0x1){_0x23562f[_0x2f11('0x16')]['total']+=0x1;_0x23562f['outbound'][_0x2f11('0x2d')]+=_0x345ea8[_0x305b27][_0x2f11('0x59')];if(_0x345ea8[_0x305b27][_0x2f11('0x5a')]==='ANSWERED'){_0x23562f['outbound'][_0x2f11('0x2b')]+=0x1;_0x23562f[_0x2f11('0x16')]['sumHoldTime']+=_0x345ea8[_0x305b27][_0x2f11('0x59')]-_0x345ea8[_0x305b27][_0x2f11('0x5b')]||0x0;_0x23562f[_0x2f11('0x16')]['sumBillable']+=_0x345ea8[_0x305b27][_0x2f11('0x5b')];}}}return _0x23562f[_0x2f11('0x16')];};};Realtime[_0x2f11('0x3a')][_0x2f11('0x5c')]=function(){var _0x38dc1f=this;return function(_0x5ee1c7){if(_0x5ee1c7){freeIsNotKey(_0x5ee1c7,_0x38dc1f['campaigns'],_0x2f11('0x40'));for(var _0x1b32b0=0x0,_0x453900={};_0x1b32b0<_0x5ee1c7[_0x2f11('0x3d')];_0x1b32b0+=0x1){_0x453900=_0x5ee1c7[_0x1b32b0];if(_['isUndefined'](_0x38dc1f['campaigns'][_0x453900[_0x2f11('0x40')]])){_0x38dc1f['campaigns'][_0x453900[_0x2f11('0x40')]]=new Campaign(_0x453900);}else{_0x38dc1f[_0x2f11('0x3b')](_0x38dc1f['campaigns'][_0x453900['name']],_0x453900);}}}return _0x38dc1f[_0x2f11('0x15')];};};Realtime[_0x2f11('0x3a')][_0x2f11('0x5d')]=function(){var _0x3389=this;return function(_0x191f30){if(_0x191f30){freeIsNotKey(_0x191f30,_0x3389['voiceExtensions'],'id');for(var _0x48b2a8=0x0,_0x588522={};_0x48b2a8<_0x191f30[_0x2f11('0x3d')];_0x48b2a8+=0x1){_0x588522=_0x191f30[_0x48b2a8];if(_[_0x2f11('0x3e')](_0x3389[_0x2f11('0x5e')][_0x588522['id']])){_0x3389[_0x2f11('0x5e')][_0x588522['id']]=new VoiceExtension(_0x588522);}else{_0x3389[_0x2f11('0x3b')](_0x3389[_0x2f11('0x5e')][_0x588522['id']],_0x588522);}}}return _0x3389[_0x2f11('0x5e')];};};Realtime['prototype'][_0x2f11('0x5f')]=function(){var _0x594f11=this;return function(_0x848982){clearCampaigns(_0x594f11[_0x2f11('0x15')]);for(var _0x117db2=0x0;_0x117db2<_0x848982[_0x2f11('0x3d')];_0x117db2+=0x1){_['merge'](_0x594f11[_0x2f11('0x15')][_0x848982[_0x117db2]['name']],_0x848982[_0x117db2]);}return _0x594f11['campaigns'];};};Realtime['prototype'][_0x2f11('0x60')]=function(){var _0x30704e=this;return function(_0x305ddb){if(_0x305ddb){freeIsNotKey(_0x305ddb,_0x30704e[_0x2f11('0x23')],'id');for(var _0x5449f5=0x0,_0x15cdbc={},_0x266adf={};_0x5449f5<_0x305ddb[_0x2f11('0x3d')];_0x5449f5+=0x1){_0x15cdbc=_0x305ddb[_0x5449f5];if(_[_0x2f11('0x3e')](_0x30704e['faxAccounts'][_0x15cdbc['id']])){_0x30704e[_0x2f11('0x23')][_0x15cdbc['id']]=new FaxAccount(_0x15cdbc);}else{_0x30704e['mergeFromDatabase'](_0x30704e[_0x2f11('0x23')][_0x15cdbc['id']],_0x15cdbc);}}}return _0x30704e[_0x2f11('0x23')];};};module[_0x2f11('0x61')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 6e2ee22..08ae02c 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 _0xd28b=['destination','exten','type','lastapplication','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','calleridnum','destinationchannel','channel','calleridname','create','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','xcally-motion-dialer','forEach','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','membername','exports','bluebird','lodash','moment','../../../config/environment','../../../config/logger','ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','agents','telephones','prototype','realtime','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','find','name','isNil','accountcode','interface','format','length','findAgent','connectedlinenum','assigned','lastAssignedTo','SIP/%s','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','match'];(function(_0x206f64,_0x43e3d1){var _0xfb2f91=function(_0x241ab5){while(--_0x241ab5){_0x206f64['push'](_0x206f64['shift']());}};_0xfb2f91(++_0x43e3d1);}(_0xd28b,0x182));var _0xbd28=function(_0x2089b3,_0x31fbde){_0x2089b3=_0x2089b3-0x0;var _0x181087=_0xd28b[_0x2089b3];return _0x181087;};'use strict';var BPromise=require(_0xbd28('0x0'));var _=require(_0xbd28('0x1'));var moment=require(_0xbd28('0x2'));var util=require('util');var config=require(_0xbd28('0x3'));var logger=require(_0xbd28('0x4'))(_0xbd28('0x5'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0xbd28('0x6'));var RpcVoiceCallReport=require(_0xbd28('0x7'));var RpcVoiceDialReport=require(_0xbd28('0x8'));var RpcMemberReport=require(_0xbd28('0x9'));var RpcVoiceQueueReport=require(_0xbd28('0xa'));var RpcVoiceRecording=require(_0xbd28('0xb'));var RpcVoiceTransferReport=require(_0xbd28('0xc'));var VoiceQueueReport=require(_0xbd28('0xd'));var VoiceCallReport=require(_0xbd28('0xe'));var VoiceAgentReport=require(_0xbd28('0xf'));var VoiceDialReport=require(_0xbd28('0x10'));var UserReport=require(_0xbd28('0x11'));function Report(_0x196c57){this['realtime']=_0x196c57;this[_0xbd28('0x12')]=_0x196c57[_0xbd28('0x12')];this[_0xbd28('0x13')]=_0x196c57['telephones'];}Report[_0xbd28('0x14')]['sync']=function(_0x1425c4){var _0x17cd28=new VoiceQueueReport(this[_0xbd28('0x15')]);var _0xdf4bab=new VoiceAgentReport(this[_0xbd28('0x15')]);var _0x40291b=new VoiceDialReport(this['realtime']);var _0x2d69af=new VoiceCallReport(this[_0xbd28('0x15')]);var _0x174b81=new UserReport(this[_0xbd28('0x15')]);if(config[_0xbd28('0x16')]&&config['xdr'][_0xbd28('0x17')]){ami['on'](_0xbd28('0x18'),this[_0xbd28('0x19')][_0xbd28('0x1a')](this));ami['on'](_0xbd28('0x1b'),this[_0xbd28('0x1c')][_0xbd28('0x1a')](this));ami['on'](_0xbd28('0x1d'),this[_0xbd28('0x1e')][_0xbd28('0x1a')](this));ami['on'](_0xbd28('0x1f'),this[_0xbd28('0x20')][_0xbd28('0x1a')](this));ami['on'](_0xbd28('0x21'),this[_0xbd28('0x22')]['bind'](this));ami['on'](_0xbd28('0x23'),this[_0xbd28('0x24')]['bind'](this));}};Report[_0xbd28('0x14')]['findAgent']=function(_0x2a49d1){var _0x48f13a=undefined;_0x48f13a=_[_0xbd28('0x25')](this[_0xbd28('0x12')],function(_0x57ec8b){return _0x57ec8b['accountcode']==_0x2a49d1||_0x57ec8b[_0xbd28('0x26')]==_0x2a49d1;});if(_[_0xbd28('0x27')](_0x48f13a)){var _0x165523=_[_0xbd28('0x25')](this[_0xbd28('0x13')],function(_0x5344b9){return _0x5344b9[_0xbd28('0x28')]==_0x2a49d1||_0x5344b9[_0xbd28('0x26')]==_0x2a49d1;});if(_0x165523){_0x48f13a=_[_0xbd28('0x25')](this[_0xbd28('0x12')],function(_0xedd4bb){return _0xedd4bb[_0xbd28('0x29')]==util[_0xbd28('0x2a')]('SIP/%s',_0x165523['name']);});}}return _0x48f13a;};Report[_0xbd28('0x14')][_0xbd28('0x19')]=function(_0x2d3d67){for(var _0x55146f=0x0;_0x55146f<_0x2d3d67[_0xbd28('0x2b')];_0x55146f+=0x1){var _0x3bfb72=this[_0xbd28('0x2c')](_0x2d3d67[_0x55146f][_0xbd28('0x2d')]);if(_0x3bfb72){_0x2d3d67[_0x55146f][_0xbd28('0x28')]=_0x3bfb72[_0xbd28('0x28')];_0x2d3d67[_0x55146f][_0xbd28('0x2e')]=!![];_0x2d3d67[_0x55146f][_0xbd28('0x2f')]=_0x3bfb72['name'];_0x2d3d67[_0x55146f][_0xbd28('0x29')]=_[_0xbd28('0x27')](_0x3bfb72[_0xbd28('0x29')])?util[_0xbd28('0x2a')](_0xbd28('0x30'),_0x3bfb72['name']):_0x3bfb72['interface'];if(_0x2d3d67[_0x55146f][_0xbd28('0x31')]){_0x2d3d67[_0x55146f][_0xbd28('0x32')]=moment()[_0xbd28('0x2a')](_0xbd28('0x33'));}if(_0x2d3d67[_0x55146f][_0xbd28('0x34')]){_0x2d3d67[_0x55146f]['queuecallerexitAt']=moment()['format'](_0xbd28('0x33'));}RpcMemberReport['voiceQueueReport'](_0x2d3d67[_0x55146f]);}RpcVoiceQueueReport['create'](_0x2d3d67[_0x55146f]);}};function extractCalleridNumber(_0x23aefc){var _0x521d06=_0x23aefc[_0xbd28('0x35')](/<(.*?)>/);return _0x521d06?_0x521d06[0x1]:_0x23aefc;}Report[_0xbd28('0x14')][_0xbd28('0x1c')]=function(_0x5e0fbe){_0x5e0fbe[_0xbd28('0x36')]=_0x5e0fbe['destination']||_0x5e0fbe[_0xbd28('0x37')];if(_0x5e0fbe[_0xbd28('0x38')]=='dialer'){_0x5e0fbe[_0xbd28('0x39')]=_0xbd28('0x3a');_0x5e0fbe[_0xbd28('0x3b')]=_0x5e0fbe[_0xbd28('0x3a')];if(_0x5e0fbe[_0xbd28('0x3c')]==_0xbd28('0x3d')){_0x5e0fbe['accountcode']='';_0x5e0fbe['destination']=extractCalleridNumber(_0x5e0fbe[_0xbd28('0x3e')]);}else if(_0x5e0fbe['context']==_0xbd28('0x3f')){if(_0x5e0fbe['destination']==_0xbd28('0x40')){_0x5e0fbe[_0xbd28('0x36')]=extractCalleridNumber(_0x5e0fbe[_0xbd28('0x41')]);_0x5e0fbe[_0xbd28('0x42')]=_0x5e0fbe['originatecalleridnum'];_0x5e0fbe[_0xbd28('0x43')]=[_0x5e0fbe[_0xbd28('0x44')],_0x5e0fbe[_0xbd28('0x44')]=_0x5e0fbe['destinationchannel']][0x0];_0x5e0fbe[_0xbd28('0x3e')]=_0x5e0fbe[_0xbd28('0x41')];}else{_0x5e0fbe[_0xbd28('0x36')]=_0x5e0fbe[_0xbd28('0x42')];_0x5e0fbe['calleridnum']=_0x5e0fbe['originatecalleridnum'];if(_0x5e0fbe['disposition']=='ANSWERED'){_0x5e0fbe[_0xbd28('0x28')]=_0x5e0fbe[_0xbd28('0x2d')];}else{_0x5e0fbe[_0xbd28('0x28')]='';}}}}else{_0x5e0fbe[_0xbd28('0x3e')]=util['format']('\x22%s\x22\x20<%s>',_0x5e0fbe[_0xbd28('0x45')],_0x5e0fbe[_0xbd28('0x42')]);}RpcVoiceCallReport[_0xbd28('0x46')](_0x5e0fbe);if(_0x5e0fbe[_0xbd28('0x47')]){for(var _0x5545b6=0x0;_0x5545b6<_0x5e0fbe[_0xbd28('0x48')][_0xbd28('0x2b')];_0x5545b6+=0x1){_0x5e0fbe[_0xbd28('0x49')]=_0x5e0fbe[_0xbd28('0x48')][_0x5545b6][_0xbd28('0x4a')];_0x5e0fbe[_0xbd28('0x4b')]=_0x5e0fbe[_0xbd28('0x48')][_0x5545b6][_0xbd28('0x4b')];if(_0x5e0fbe[_0xbd28('0x37')]==_0xbd28('0x40')){_0x5e0fbe[_0xbd28('0x42')]=_0x5e0fbe[_0xbd28('0x2d')];_0x5e0fbe[_0xbd28('0x45')]=_0x5e0fbe[_0xbd28('0x4c')];_0x5e0fbe['connectedlinenum']=_0x5e0fbe[_0xbd28('0x28')];_0x5e0fbe['connectedlinename']=_0x5e0fbe['membername'];_0x5e0fbe['exten']=_0x5e0fbe['originatecalleridnum'];}else if(_0x5e0fbe[_0xbd28('0x37')]==_0xbd28('0x4d')){_0x5e0fbe[_0xbd28('0x42')]=_0x5e0fbe[_0xbd28('0x36')];_0x5e0fbe[_0xbd28('0x37')]=_0x5e0fbe['originatecalleridnum'];}RpcVoiceRecording[_0xbd28('0x46')](_0x5e0fbe);}}};Report[_0xbd28('0x14')][_0xbd28('0x1e')]=function(_0x52e7ac){if(_['isArray'](_0x52e7ac)){_0x52e7ac[_0xbd28('0x4e')](function(_0x1d764e){RpcVoiceAgentReport[_0xbd28('0x46')](_0x1d764e);});}else{RpcVoiceAgentReport[_0xbd28('0x46')](_0x52e7ac);}};Report[_0xbd28('0x14')][_0xbd28('0x20')]=function(_0x2e7b6a){RpcVoiceDialReport[_0xbd28('0x46')](_0x2e7b6a);var _0x17841d=undefined;var _0x4a3327=_0x2e7b6a['channel'];if(_[_0xbd28('0x4f')](_0x4a3327,_0xbd28('0x50'))){var _0x20f9bf=_0x4a3327[_0xbd28('0x51')](_0x4a3327[_0xbd28('0x52')]('/')+0x1,_0x4a3327[_0xbd28('0x52')]('@'));_0x17841d=_[_0xbd28('0x25')](this[_0xbd28('0x12')],function(_0x314491){return _0x314491[_0xbd28('0x53')]==_0x20f9bf||_0x314491[_0xbd28('0x54')]==_0x20f9bf||_0x314491[_0xbd28('0x28')]==_0x20f9bf;});}else{var _0x20f9bf=_0x4a3327[_0xbd28('0x51')](_0x4a3327[_0xbd28('0x52')]('/')+0x1,_0x4a3327[_0xbd28('0x55')]('-'));_0x17841d=this[_0xbd28('0x2c')](_0x20f9bf);}if(_0x17841d){_0x2e7b6a['interface']=_[_0xbd28('0x27')](_0x17841d[_0xbd28('0x29')])?util[_0xbd28('0x2a')](_0xbd28('0x30'),_0x17841d['name']):_0x17841d[_0xbd28('0x29')];_0x2e7b6a[_0xbd28('0x56')]=_0x17841d[_0xbd28('0x26')];_0x2e7b6a[_0xbd28('0x28')]=_0x17841d[_0xbd28('0x28')];RpcMemberReport['voiceDialReport'](_0x2e7b6a);}};Report[_0xbd28('0x14')]['blindTransfer']=function(_0x176edb){RpcVoiceTransferReport[_0xbd28('0x22')](_0x176edb);};Report[_0xbd28('0x14')]['attendedTransfer']=function(_0x5ca625){RpcVoiceTransferReport[_0xbd28('0x24')](_0x5ca625);};module[_0xbd28('0x57')]=Report; \ No newline at end of file +var _0xcd4e=['lastapplication','lastdata','context','from-voip-provider','calleridpreview','calleridnum','destinationchannel','channel','callerid','originatecalleridnum','disposition','calleridname','monitors','monitorFilename','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','mobile','phone','indexOf','lastIndexOf','attendedTransfer','exports','bluebird','lodash','moment','util','../../../config/logger','../ami','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','./userReport','agents','telephones','prototype','sync','realtime','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','findAgent','accountcode','name','isNil','find','interface','format','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','queuecallerexit','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','create','destination','exten','type'];(function(_0x374edc,_0x31d6de){var _0x5e6d3b=function(_0x112358){while(--_0x112358){_0x374edc['push'](_0x374edc['shift']());}};_0x5e6d3b(++_0x31d6de);}(_0xcd4e,0x1f0));var _0xecd4=function(_0x29140f,_0x46a216){_0x29140f=_0x29140f-0x0;var _0x3ceecd=_0xcd4e[_0x29140f];return _0x3ceecd;};'use strict';var BPromise=require(_0xecd4('0x0'));var _=require(_0xecd4('0x1'));var moment=require(_0xecd4('0x2'));var util=require(_0xecd4('0x3'));var config=require('../../../config/environment');var logger=require(_0xecd4('0x4'))('ami');var ami=require(_0xecd4('0x5'));var RpcVoiceAgentReport=require(_0xecd4('0x6'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0xecd4('0x7'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0xecd4('0x8'));var RpcVoiceRecording=require(_0xecd4('0x9'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0xecd4('0xa'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0xecd4('0xb'));var VoiceDialReport=require(_0xecd4('0xc'));var UserReport=require(_0xecd4('0xd'));function Report(_0x1b6e68){this['realtime']=_0x1b6e68;this[_0xecd4('0xe')]=_0x1b6e68['agents'];this[_0xecd4('0xf')]=_0x1b6e68[_0xecd4('0xf')];}Report[_0xecd4('0x10')][_0xecd4('0x11')]=function(_0x4118b0){var _0x176a8f=new VoiceQueueReport(this['realtime']);var _0x43e003=new VoiceAgentReport(this[_0xecd4('0x12')]);var _0x31de12=new VoiceDialReport(this[_0xecd4('0x12')]);var _0x4dc40b=new VoiceCallReport(this[_0xecd4('0x12')]);var _0x28c0a8=new UserReport(this[_0xecd4('0x12')]);if(config[_0xecd4('0x13')]&&config[_0xecd4('0x13')][_0xecd4('0x14')]){ami['on'](_0xecd4('0x15'),this[_0xecd4('0x16')][_0xecd4('0x17')](this));ami['on'](_0xecd4('0x18'),this[_0xecd4('0x19')][_0xecd4('0x17')](this));ami['on']('custom:voiceAgentReport',this[_0xecd4('0x1a')][_0xecd4('0x17')](this));ami['on']('custom:voiceDialReport',this[_0xecd4('0x1b')][_0xecd4('0x17')](this));ami['on'](_0xecd4('0x1c'),this[_0xecd4('0x1d')]['bind'](this));ami['on'](_0xecd4('0x1e'),this['attendedTransfer'][_0xecd4('0x17')](this));}};Report[_0xecd4('0x10')][_0xecd4('0x1f')]=function(_0x192e97){var _0x23fb27=undefined;_0x23fb27=_['find'](this['agents'],function(_0x5cbb53){return _0x5cbb53[_0xecd4('0x20')]==_0x192e97||_0x5cbb53[_0xecd4('0x21')]==_0x192e97;});if(_[_0xecd4('0x22')](_0x23fb27)){var _0x1a534c=_[_0xecd4('0x23')](this[_0xecd4('0xf')],function(_0xc6f906){return _0xc6f906[_0xecd4('0x20')]==_0x192e97||_0xc6f906[_0xecd4('0x21')]==_0x192e97;});if(_0x1a534c){_0x23fb27=_[_0xecd4('0x23')](this[_0xecd4('0xe')],function(_0x456eb0){return _0x456eb0[_0xecd4('0x24')]==util[_0xecd4('0x25')](_0xecd4('0x26'),_0x1a534c[_0xecd4('0x21')]);});}}return _0x23fb27;};Report[_0xecd4('0x10')][_0xecd4('0x16')]=function(_0x38fcc9){for(var _0x50a520=0x0;_0x50a520<_0x38fcc9[_0xecd4('0x27')];_0x50a520+=0x1){var _0x5aa62a=this[_0xecd4('0x1f')](_0x38fcc9[_0x50a520][_0xecd4('0x28')]);if(_0x5aa62a){_0x38fcc9[_0x50a520]['accountcode']=_0x5aa62a['accountcode'];_0x38fcc9[_0x50a520][_0xecd4('0x29')]=!![];_0x38fcc9[_0x50a520][_0xecd4('0x2a')]=_0x5aa62a['name'];_0x38fcc9[_0x50a520][_0xecd4('0x24')]=_[_0xecd4('0x22')](_0x5aa62a['interface'])?util[_0xecd4('0x25')](_0xecd4('0x26'),_0x5aa62a[_0xecd4('0x21')]):_0x5aa62a['interface'];if(_0x38fcc9[_0x50a520]['queuecallercomplete']){_0x38fcc9[_0x50a520]['queuecallercompleteAt']=moment()[_0xecd4('0x25')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x38fcc9[_0x50a520][_0xecd4('0x2b')]){_0x38fcc9[_0x50a520][_0xecd4('0x2c')]=moment()[_0xecd4('0x25')](_0xecd4('0x2d'));}RpcMemberReport[_0xecd4('0x16')](_0x38fcc9[_0x50a520]);}RpcVoiceQueueReport[_0xecd4('0x2e')](_0x38fcc9[_0x50a520]);}};function extractCalleridNumber(_0x219a29){var _0x5c5298=_0x219a29['match'](/<(.*?)>/);return _0x5c5298?_0x5c5298[0x1]:_0x219a29;}Report[_0xecd4('0x10')][_0xecd4('0x19')]=function(_0x4f76b3){_0x4f76b3[_0xecd4('0x2f')]=_0x4f76b3[_0xecd4('0x2f')]||_0x4f76b3[_0xecd4('0x30')];if(_0x4f76b3[_0xecd4('0x31')]=='dialer'){_0x4f76b3[_0xecd4('0x32')]='queue';_0x4f76b3[_0xecd4('0x33')]=_0x4f76b3['queue'];if(_0x4f76b3[_0xecd4('0x34')]==_0xecd4('0x35')){_0x4f76b3[_0xecd4('0x20')]='';_0x4f76b3[_0xecd4('0x2f')]=extractCalleridNumber(_0x4f76b3['callerid']);}else if(_0x4f76b3[_0xecd4('0x34')]=='from-sip'){if(_0x4f76b3[_0xecd4('0x2f')]=='xcally-motion-preview'){_0x4f76b3[_0xecd4('0x2f')]=extractCalleridNumber(_0x4f76b3[_0xecd4('0x36')]);_0x4f76b3[_0xecd4('0x37')]=_0x4f76b3['originatecalleridnum'];_0x4f76b3[_0xecd4('0x38')]=[_0x4f76b3[_0xecd4('0x39')],_0x4f76b3[_0xecd4('0x39')]=_0x4f76b3[_0xecd4('0x38')]][0x0];_0x4f76b3[_0xecd4('0x3a')]=_0x4f76b3[_0xecd4('0x36')];}else{_0x4f76b3[_0xecd4('0x2f')]=_0x4f76b3[_0xecd4('0x37')];_0x4f76b3['calleridnum']=_0x4f76b3[_0xecd4('0x3b')];if(_0x4f76b3[_0xecd4('0x3c')]=='ANSWERED'){_0x4f76b3[_0xecd4('0x20')]=_0x4f76b3[_0xecd4('0x28')];}else{_0x4f76b3[_0xecd4('0x20')]='';}}}}else{_0x4f76b3['callerid']=util[_0xecd4('0x25')]('\x22%s\x22\x20<%s>',_0x4f76b3[_0xecd4('0x3d')],_0x4f76b3[_0xecd4('0x37')]);}RpcVoiceCallReport['create'](_0x4f76b3);if(_0x4f76b3['monitor']){for(var _0x3af776=0x0;_0x3af776<_0x4f76b3[_0xecd4('0x3e')]['length'];_0x3af776+=0x1){_0x4f76b3[_0xecd4('0x3f')]=_0x4f76b3[_0xecd4('0x3e')][_0x3af776]['filename'];_0x4f76b3['createdAt']=_0x4f76b3[_0xecd4('0x3e')][_0x3af776]['createdAt'];if(_0x4f76b3[_0xecd4('0x30')]=='xcally-motion-preview'){_0x4f76b3[_0xecd4('0x37')]=_0x4f76b3[_0xecd4('0x28')];_0x4f76b3[_0xecd4('0x3d')]=_0x4f76b3[_0xecd4('0x40')];_0x4f76b3[_0xecd4('0x28')]=_0x4f76b3[_0xecd4('0x20')];_0x4f76b3[_0xecd4('0x40')]=_0x4f76b3[_0xecd4('0x41')];_0x4f76b3['exten']=_0x4f76b3[_0xecd4('0x3b')];}else if(_0x4f76b3[_0xecd4('0x30')]==_0xecd4('0x42')){_0x4f76b3[_0xecd4('0x37')]=_0x4f76b3[_0xecd4('0x2f')];_0x4f76b3['exten']=_0x4f76b3[_0xecd4('0x3b')];}RpcVoiceRecording[_0xecd4('0x2e')](_0x4f76b3);}}};Report['prototype'][_0xecd4('0x1a')]=function(_0x5355b5){if(_[_0xecd4('0x43')](_0x5355b5)){_0x5355b5[_0xecd4('0x44')](function(_0x34000e){RpcVoiceAgentReport[_0xecd4('0x2e')](_0x34000e);});}else{RpcVoiceAgentReport[_0xecd4('0x2e')](_0x5355b5);}};Report['prototype'][_0xecd4('0x1b')]=function(_0x26c6bc){RpcVoiceDialReport['create'](_0x26c6bc);var _0x18f362=undefined;var _0x7817bf=_0x26c6bc[_0xecd4('0x39')];if(_[_0xecd4('0x45')](_0x7817bf,_0xecd4('0x46'))){var _0x3ad545=_0x7817bf[_0xecd4('0x47')](_0x7817bf['indexOf']('/')+0x1,_0x7817bf['indexOf']('@'));_0x18f362=_[_0xecd4('0x23')](this[_0xecd4('0xe')],function(_0x40e867){return _0x40e867[_0xecd4('0x48')]==_0x3ad545||_0x40e867[_0xecd4('0x49')]==_0x3ad545||_0x40e867[_0xecd4('0x20')]==_0x3ad545;});}else{var _0x3ad545=_0x7817bf[_0xecd4('0x47')](_0x7817bf[_0xecd4('0x4a')]('/')+0x1,_0x7817bf[_0xecd4('0x4b')]('-'));_0x18f362=this[_0xecd4('0x1f')](_0x3ad545);}if(_0x18f362){_0x26c6bc[_0xecd4('0x24')]=_[_0xecd4('0x22')](_0x18f362['interface'])?util[_0xecd4('0x25')](_0xecd4('0x26'),_0x18f362[_0xecd4('0x21')]):_0x18f362[_0xecd4('0x24')];_0x26c6bc[_0xecd4('0x41')]=_0x18f362[_0xecd4('0x21')];_0x26c6bc['accountcode']=_0x18f362['accountcode'];RpcMemberReport[_0xecd4('0x1b')](_0x26c6bc);}};Report[_0xecd4('0x10')]['blindTransfer']=function(_0x567759){RpcVoiceTransferReport[_0xecd4('0x1d')](_0x567759);};Report['prototype'][_0xecd4('0x4c')]=function(_0x441ddb){RpcVoiceTransferReport['attendedTransfer'](_0x441ddb);};module[_0xecd4('0x4d')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 82b90cb..e70ff0e 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 _0xd838=['exports','bluebird','util','ioredis','../../../config/logger','ami','../ami','redis','defaults','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','syncDeviceState','peerstatus','loopSyncRealTimeShow','resolve','then','actionSipShowRegistry','actionDeviceStateList','actionSipPeerStatus','catch','inspect','[loopSyncRealTimeShow]','isNotNull','isUndefined','prototype','emit','username','stateRegistry','state','omit','actionid','format','name','trunk:save','error','device','toLowerCase','local','stateTime','toNumber','updateStatusRealtime','telephone:%s','telephone:save','trunk:%s','startsWith','Queue','Local','substring','find','mobile','phone','accountcode','[syncDeviceState][UserReport]','peer','registered','status','address','[syncPeerStatus][UserReport]'];(function(_0x3449ea,_0x2d5c1a){var _0x281cb3=function(_0x3e931d){while(--_0x3e931d){_0x3449ea['push'](_0x3449ea['shift']());}};_0x281cb3(++_0x2d5c1a);}(_0xd838,0x101));var _0x8d83=function(_0x381e5c,_0x1e25fa){_0x381e5c=_0x381e5c-0x0;var _0x56dc88=_0xd838[_0x381e5c];return _0x56dc88;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0x8d83('0x0'));var util=require(_0x8d83('0x1'));var Redis=require(_0x8d83('0x2'));var config=require('../../../config/environment');var logger=require(_0x8d83('0x3'))(_0x8d83('0x4'));var ami=require(_0x8d83('0x5'));config[_0x8d83('0x6')]=_[_0x8d83('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x8d83('0x8'))(new Redis(config[_0x8d83('0x6')]));function UserReport(_0x7ab5c7){this[_0x8d83('0x9')]=_0x7ab5c7[_0x8d83('0x9')];this[_0x8d83('0xa')]=_0x7ab5c7[_0x8d83('0xa')];this[_0x8d83('0xb')]=_0x7ab5c7['telephones'];ami['on'](_0x8d83('0xc'),this[_0x8d83('0xd')][_0x8d83('0xe')](this));ami['on'](_0x8d83('0xf'),this['syncRegistry'][_0x8d83('0xe')](this));ami['on']('devicestatechange',this[_0x8d83('0x10')][_0x8d83('0xe')](this));ami['on'](_0x8d83('0x11'),this['syncPeerStatus'][_0x8d83('0xe')](this));this[_0x8d83('0x12')]();return BPromise[_0x8d83('0x13')]()[_0x8d83('0x14')](ami[_0x8d83('0x15')]())[_0x8d83('0x14')](ami[_0x8d83('0x16')]())['then'](ami[_0x8d83('0x17')]())[_0x8d83('0x18')](loggerCatch('[loopSyncRealTimeShow]'));}function loggerCatch(_0x3a18b7){return function(_0x6b8baa){logger['error'](_0x3a18b7,util[_0x8d83('0x19')](_0x6b8baa,{'showHidden':![],'depth':null}));};}UserReport['prototype'][_0x8d83('0x12')]=function(){setInterval(function(){BPromise['resolve']()[_0x8d83('0x14')](ami[_0x8d83('0x15')]())[_0x8d83('0x14')](ami[_0x8d83('0x16')]())[_0x8d83('0x14')](ami[_0x8d83('0x17')]())[_0x8d83('0x18')](loggerCatch(_0x8d83('0x1a')));},0x32c8);};UserReport['prototype'][_0x8d83('0x1b')]=function(_0x7f5e21){return _0x7f5e21!==null&&!_[_0x8d83('0x1c')](_0x7f5e21);};UserReport[_0x8d83('0x1d')][_0x8d83('0x1e')]=function(_0x518366,_0x40abf7,_0x15461a){io['to'](_0x518366)['emit'](_0x40abf7,_0x15461a);};UserReport[_0x8d83('0x1d')][_0x8d83('0xd')]=function(_0x57fe3c){try{if(this['isNotNull'](_0x57fe3c)){var _0x360a01=_['find'](this[_0x8d83('0x9')],{'registry':_0x57fe3c[_0x8d83('0x1f')]});if(_0x360a01){_0x57fe3c[_0x8d83('0x20')]=_0x57fe3c[_0x8d83('0x21')];_['merge'](_0x360a01,_[_0x8d83('0x22')](_0x57fe3c,['event',_0x8d83('0x23'),_0x8d83('0x1f'),_0x8d83('0x21')]));this[_0x8d83('0x1e')](util[_0x8d83('0x24')]('trunk:%s',_0x360a01[_0x8d83('0x25')]),_0x8d83('0x26'),_0x360a01);}}}catch(_0x97995f){logger[_0x8d83('0x27')]('[syncRegistry][UserReport]',util[_0x8d83('0x19')](_0x97995f,{'showHidden':![],'depth':null}));}};UserReport[_0x8d83('0x1d')][_0x8d83('0x10')]=function(_0x5d6416){try{if(this[_0x8d83('0x1b')](_0x5d6416)){if(this[_0x8d83('0xa')][_0x5d6416[_0x8d83('0x28')]]){if(!this[_0x8d83('0xa')][_0x5d6416[_0x8d83('0x28')]]['local']||_0x5d6416[_0x8d83('0x21')][_0x8d83('0x29')]()=='inuse'){this[_0x8d83('0xa')][_0x5d6416[_0x8d83('0x28')]][_0x8d83('0x2a')]=![];if(this['agents'][_0x5d6416[_0x8d83('0x28')]]['state']!==_0x5d6416[_0x8d83('0x21')]['toLowerCase']()){this['agents'][_0x5d6416[_0x8d83('0x28')]][_0x8d83('0x2b')]=_[_0x8d83('0x2c')](moment()[_0x8d83('0x24')]('x'));}this[_0x8d83('0xa')][_0x5d6416[_0x8d83('0x28')]][_0x8d83('0x21')]=_0x5d6416[_0x8d83('0x21')]['toLowerCase']();this[_0x8d83('0xa')][_0x5d6416[_0x8d83('0x28')]][_0x8d83('0x2d')](_0x5d6416);}}else if(this[_0x8d83('0xb')][_0x5d6416[_0x8d83('0x28')]]){if(this['telephones'][_0x5d6416[_0x8d83('0x28')]]['state']!==_0x5d6416[_0x8d83('0x21')]['toLowerCase']()){this[_0x8d83('0xb')][_0x5d6416[_0x8d83('0x28')]][_0x8d83('0x2b')]=_[_0x8d83('0x2c')](moment()[_0x8d83('0x24')]('x'));}this['telephones'][_0x5d6416[_0x8d83('0x28')]][_0x8d83('0x21')]=_0x5d6416[_0x8d83('0x21')]['toLowerCase']();this[_0x8d83('0x1e')](util['format'](_0x8d83('0x2e'),this[_0x8d83('0xb')][_0x5d6416['device']][_0x8d83('0x25')]),_0x8d83('0x2f'),this['telephones'][_0x5d6416[_0x8d83('0x28')]]);}else if(this[_0x8d83('0x9')][_0x5d6416[_0x8d83('0x28')]]){if(this[_0x8d83('0x9')][_0x5d6416[_0x8d83('0x28')]][_0x8d83('0x21')]!==_0x5d6416[_0x8d83('0x21')][_0x8d83('0x29')]()){this[_0x8d83('0x9')][_0x5d6416[_0x8d83('0x28')]][_0x8d83('0x2b')]=_['toNumber'](moment()[_0x8d83('0x24')]('x'));}this[_0x8d83('0x9')][_0x5d6416[_0x8d83('0x28')]][_0x8d83('0x21')]=_0x5d6416[_0x8d83('0x21')][_0x8d83('0x29')]();this[_0x8d83('0x1e')](util[_0x8d83('0x24')](_0x8d83('0x30'),this['trunks'][_0x5d6416[_0x8d83('0x28')]]['name']),_0x8d83('0x26'),this[_0x8d83('0x9')][_0x5d6416[_0x8d83('0x28')]]);}else if(_[_0x8d83('0x31')](_0x5d6416[_0x8d83('0x28')],_0x8d83('0x32'))){}else if(_[_0x8d83('0x31')](_0x5d6416[_0x8d83('0x28')],_0x8d83('0x33'))){var _0x4256ac=_0x5d6416[_0x8d83('0x28')];var _0x9c13e7=_0x4256ac[_0x8d83('0x34')](_0x4256ac['indexOf']('/')+0x1,_0x4256ac['indexOf']('@'));var _0x525531=_[_0x8d83('0x35')](this[_0x8d83('0xa')],function(_0x49ed67){return _0x49ed67[_0x8d83('0x36')]==_0x9c13e7||_0x49ed67[_0x8d83('0x37')]==_0x9c13e7||_0x49ed67[_0x8d83('0x38')]==_0x9c13e7;});if(_0x525531){if(_0x525531[_0x8d83('0x21')]!==_0x5d6416['state'][_0x8d83('0x29')]()){_0x525531[_0x8d83('0x2b')]=_[_0x8d83('0x2c')](moment()[_0x8d83('0x24')]('x'));}_0x525531[_0x8d83('0x21')]=_0x5d6416[_0x8d83('0x21')][_0x8d83('0x29')]();_0x525531[_0x8d83('0x2a')]=!![];_0x525531[_0x8d83('0x2d')](_0x5d6416);}}else{}}}catch(_0x57ed7e){logger['error'](_0x8d83('0x39'),util['inspect'](_0x57ed7e,{'showHidden':![],'depth':null}));}};UserReport[_0x8d83('0x1d')]['syncPeerStatus']=function(_0x404e90){try{if(this[_0x8d83('0x1b')](_0x404e90)&&this['isNotNull'](_0x404e90[_0x8d83('0x11')])){if(this['agents'][_0x404e90[_0x8d83('0x3a')]]){if(!this[_0x8d83('0xa')][_0x404e90[_0x8d83('0x3a')]][_0x8d83('0x2a')]||_0x404e90[_0x8d83('0x11')]['toLowerCase']()==_0x8d83('0x3b')){this[_0x8d83('0xa')][_0x404e90[_0x8d83('0x3a')]][_0x8d83('0x2a')]=![];this[_0x8d83('0xa')][_0x404e90[_0x8d83('0x3a')]][_0x8d83('0x3c')]=_0x404e90['peerstatus'][_0x8d83('0x29')]();this[_0x8d83('0xa')][_0x404e90[_0x8d83('0x3a')]][_0x8d83('0x3d')]=_0x404e90['address'];this[_0x8d83('0xa')][_0x404e90[_0x8d83('0x3a')]][_0x8d83('0x2d')](_0x404e90);}}else if(this[_0x8d83('0xb')][_0x404e90[_0x8d83('0x3a')]]){this['telephones'][_0x404e90[_0x8d83('0x3a')]][_0x8d83('0x3c')]=_0x404e90[_0x8d83('0x11')][_0x8d83('0x29')]();this[_0x8d83('0xb')][_0x404e90[_0x8d83('0x3a')]][_0x8d83('0x3d')]=_0x404e90['address'];this[_0x8d83('0x1e')](util[_0x8d83('0x24')](_0x8d83('0x2e'),this[_0x8d83('0xb')][_0x404e90[_0x8d83('0x3a')]][_0x8d83('0x25')]),_0x8d83('0x2f'),this[_0x8d83('0xb')][_0x404e90[_0x8d83('0x3a')]]);}else if(this['trunks'][_0x404e90['peer']]){this[_0x8d83('0x9')][_0x404e90['peer']][_0x8d83('0x3c')]=_0x404e90[_0x8d83('0x11')][_0x8d83('0x29')]();this[_0x8d83('0x9')][_0x404e90['peer']][_0x8d83('0x3d')]=_0x404e90[_0x8d83('0x3d')];this[_0x8d83('0x1e')](util[_0x8d83('0x24')](_0x8d83('0x30'),this[_0x8d83('0x9')][_0x404e90[_0x8d83('0x3a')]][_0x8d83('0x25')]),_0x8d83('0x26'),this['trunks'][_0x404e90['peer']]);}else{}}}catch(_0x1f5ecb){logger['error'](_0x8d83('0x3e'),util[_0x8d83('0x19')](_0x1f5ecb,{'showHidden':![],'depth':null}));}};module[_0x8d83('0x3f')]=UserReport; \ No newline at end of file +var _0x8671=['indexOf','mobile','[syncDeviceState][UserReport]','peer','registered','status','address','[syncPeerStatus][UserReport]','exports','lodash','util','ioredis','../../../config/logger','ami','../ami','redis','defaults','localhost','trunks','agents','telephones','syncRegistry','bind','registry','devicestatechange','peerstatus','syncPeerStatus','loopSyncRealTimeShow','resolve','actionSipShowRegistry','then','actionDeviceStateList','actionSipPeerStatus','catch','[loopSyncRealTimeShow]','error','prototype','isNotNull','isUndefined','emit','find','username','stateRegistry','omit','event','state','format','trunk:%s','name','trunk:save','[syncRegistry][UserReport]','inspect','syncDeviceState','device','local','toLowerCase','inuse','stateTime','toNumber','updateStatusRealtime','telephone:%s','telephone:save','startsWith','Queue','Local','substring'];(function(_0x6bb690,_0x380370){var _0x1a8f02=function(_0x2f8e9a){while(--_0x2f8e9a){_0x6bb690['push'](_0x6bb690['shift']());}};_0x1a8f02(++_0x380370);}(_0x8671,0x195));var _0x1867=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x8671[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x1867('0x0'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x1867('0x1'));var Redis=require(_0x1867('0x2'));var config=require('../../../config/environment');var logger=require(_0x1867('0x3'))(_0x1867('0x4'));var ami=require(_0x1867('0x5'));config[_0x1867('0x6')]=_[_0x1867('0x7')](config[_0x1867('0x6')],{'host':_0x1867('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1867('0x6')]));function UserReport(_0x11dd9a){this['trunks']=_0x11dd9a[_0x1867('0x9')];this[_0x1867('0xa')]=_0x11dd9a[_0x1867('0xa')];this[_0x1867('0xb')]=_0x11dd9a[_0x1867('0xb')];ami['on']('registryentry',this[_0x1867('0xc')][_0x1867('0xd')](this));ami['on'](_0x1867('0xe'),this['syncRegistry'][_0x1867('0xd')](this));ami['on'](_0x1867('0xf'),this['syncDeviceState'][_0x1867('0xd')](this));ami['on'](_0x1867('0x10'),this[_0x1867('0x11')][_0x1867('0xd')](this));this[_0x1867('0x12')]();return BPromise[_0x1867('0x13')]()['then'](ami[_0x1867('0x14')]())[_0x1867('0x15')](ami[_0x1867('0x16')]())[_0x1867('0x15')](ami[_0x1867('0x17')]())[_0x1867('0x18')](loggerCatch(_0x1867('0x19')));}function loggerCatch(_0x284b77){return function(_0x199fc9){logger[_0x1867('0x1a')](_0x284b77,util['inspect'](_0x199fc9,{'showHidden':![],'depth':null}));};}UserReport[_0x1867('0x1b')][_0x1867('0x12')]=function(){setInterval(function(){BPromise[_0x1867('0x13')]()['then'](ami[_0x1867('0x14')]())['then'](ami[_0x1867('0x16')]())['then'](ami[_0x1867('0x17')]())[_0x1867('0x18')](loggerCatch('[loopSyncRealTimeShow]'));},0x32c8);};UserReport['prototype'][_0x1867('0x1c')]=function(_0x1cb0b3){return _0x1cb0b3!==null&&!_[_0x1867('0x1d')](_0x1cb0b3);};UserReport[_0x1867('0x1b')]['emit']=function(_0x5e8f52,_0x48a733,_0x2a26d3){io['to'](_0x5e8f52)[_0x1867('0x1e')](_0x48a733,_0x2a26d3);};UserReport[_0x1867('0x1b')][_0x1867('0xc')]=function(_0xe812a3){try{if(this[_0x1867('0x1c')](_0xe812a3)){var _0x17166d=_[_0x1867('0x1f')](this[_0x1867('0x9')],{'registry':_0xe812a3[_0x1867('0x20')]});if(_0x17166d){_0xe812a3[_0x1867('0x21')]=_0xe812a3['state'];_['merge'](_0x17166d,_[_0x1867('0x22')](_0xe812a3,[_0x1867('0x23'),'actionid',_0x1867('0x20'),_0x1867('0x24')]));this[_0x1867('0x1e')](util[_0x1867('0x25')](_0x1867('0x26'),_0x17166d[_0x1867('0x27')]),_0x1867('0x28'),_0x17166d);}}}catch(_0x5afebe){logger[_0x1867('0x1a')](_0x1867('0x29'),util[_0x1867('0x2a')](_0x5afebe,{'showHidden':![],'depth':null}));}};UserReport[_0x1867('0x1b')][_0x1867('0x2b')]=function(_0x401079){try{if(this[_0x1867('0x1c')](_0x401079)){if(this[_0x1867('0xa')][_0x401079[_0x1867('0x2c')]]){if(!this[_0x1867('0xa')][_0x401079['device']][_0x1867('0x2d')]||_0x401079[_0x1867('0x24')][_0x1867('0x2e')]()==_0x1867('0x2f')){this[_0x1867('0xa')][_0x401079[_0x1867('0x2c')]][_0x1867('0x2d')]=![];if(this[_0x1867('0xa')][_0x401079['device']][_0x1867('0x24')]!==_0x401079['state'][_0x1867('0x2e')]()){this[_0x1867('0xa')][_0x401079[_0x1867('0x2c')]][_0x1867('0x30')]=_[_0x1867('0x31')](moment()[_0x1867('0x25')]('x'));}this['agents'][_0x401079[_0x1867('0x2c')]][_0x1867('0x24')]=_0x401079[_0x1867('0x24')][_0x1867('0x2e')]();this[_0x1867('0xa')][_0x401079['device']][_0x1867('0x32')](_0x401079);}}else if(this[_0x1867('0xb')][_0x401079[_0x1867('0x2c')]]){if(this[_0x1867('0xb')][_0x401079[_0x1867('0x2c')]]['state']!==_0x401079[_0x1867('0x24')][_0x1867('0x2e')]()){this['telephones'][_0x401079[_0x1867('0x2c')]][_0x1867('0x30')]=_[_0x1867('0x31')](moment()[_0x1867('0x25')]('x'));}this['telephones'][_0x401079[_0x1867('0x2c')]][_0x1867('0x24')]=_0x401079[_0x1867('0x24')][_0x1867('0x2e')]();this[_0x1867('0x1e')](util[_0x1867('0x25')](_0x1867('0x33'),this['telephones'][_0x401079[_0x1867('0x2c')]][_0x1867('0x27')]),_0x1867('0x34'),this['telephones'][_0x401079[_0x1867('0x2c')]]);}else if(this[_0x1867('0x9')][_0x401079[_0x1867('0x2c')]]){if(this[_0x1867('0x9')][_0x401079['device']][_0x1867('0x24')]!==_0x401079[_0x1867('0x24')][_0x1867('0x2e')]()){this[_0x1867('0x9')][_0x401079['device']][_0x1867('0x30')]=_[_0x1867('0x31')](moment()['format']('x'));}this[_0x1867('0x9')][_0x401079[_0x1867('0x2c')]][_0x1867('0x24')]=_0x401079['state']['toLowerCase']();this[_0x1867('0x1e')](util['format'](_0x1867('0x26'),this['trunks'][_0x401079[_0x1867('0x2c')]][_0x1867('0x27')]),_0x1867('0x28'),this[_0x1867('0x9')][_0x401079['device']]);}else if(_[_0x1867('0x35')](_0x401079[_0x1867('0x2c')],_0x1867('0x36'))){}else if(_[_0x1867('0x35')](_0x401079['device'],_0x1867('0x37'))){var _0x1cc8a6=_0x401079[_0x1867('0x2c')];var _0x1c4472=_0x1cc8a6[_0x1867('0x38')](_0x1cc8a6[_0x1867('0x39')]('/')+0x1,_0x1cc8a6['indexOf']('@'));var _0x2565ac=_[_0x1867('0x1f')](this['agents'],function(_0x464fda){return _0x464fda[_0x1867('0x3a')]==_0x1c4472||_0x464fda['phone']==_0x1c4472||_0x464fda['accountcode']==_0x1c4472;});if(_0x2565ac){if(_0x2565ac[_0x1867('0x24')]!==_0x401079['state'][_0x1867('0x2e')]()){_0x2565ac['stateTime']=_[_0x1867('0x31')](moment()[_0x1867('0x25')]('x'));}_0x2565ac['state']=_0x401079['state'][_0x1867('0x2e')]();_0x2565ac[_0x1867('0x2d')]=!![];_0x2565ac[_0x1867('0x32')](_0x401079);}}else{}}}catch(_0xd9cb94){logger['error'](_0x1867('0x3b'),util[_0x1867('0x2a')](_0xd9cb94,{'showHidden':![],'depth':null}));}};UserReport[_0x1867('0x1b')][_0x1867('0x11')]=function(_0x2a56dd){try{if(this[_0x1867('0x1c')](_0x2a56dd)&&this[_0x1867('0x1c')](_0x2a56dd[_0x1867('0x10')])){if(this[_0x1867('0xa')][_0x2a56dd[_0x1867('0x3c')]]){if(!this[_0x1867('0xa')][_0x2a56dd[_0x1867('0x3c')]][_0x1867('0x2d')]||_0x2a56dd[_0x1867('0x10')][_0x1867('0x2e')]()==_0x1867('0x3d')){this['agents'][_0x2a56dd[_0x1867('0x3c')]][_0x1867('0x2d')]=![];this['agents'][_0x2a56dd[_0x1867('0x3c')]][_0x1867('0x3e')]=_0x2a56dd['peerstatus']['toLowerCase']();this[_0x1867('0xa')][_0x2a56dd[_0x1867('0x3c')]][_0x1867('0x3f')]=_0x2a56dd[_0x1867('0x3f')];this[_0x1867('0xa')][_0x2a56dd[_0x1867('0x3c')]][_0x1867('0x32')](_0x2a56dd);}}else if(this[_0x1867('0xb')][_0x2a56dd[_0x1867('0x3c')]]){this['telephones'][_0x2a56dd[_0x1867('0x3c')]][_0x1867('0x3e')]=_0x2a56dd[_0x1867('0x10')][_0x1867('0x2e')]();this[_0x1867('0xb')][_0x2a56dd[_0x1867('0x3c')]]['address']=_0x2a56dd[_0x1867('0x3f')];this[_0x1867('0x1e')](util[_0x1867('0x25')](_0x1867('0x33'),this[_0x1867('0xb')][_0x2a56dd[_0x1867('0x3c')]]['name']),_0x1867('0x34'),this[_0x1867('0xb')][_0x2a56dd[_0x1867('0x3c')]]);}else if(this[_0x1867('0x9')][_0x2a56dd['peer']]){this[_0x1867('0x9')][_0x2a56dd[_0x1867('0x3c')]][_0x1867('0x3e')]=_0x2a56dd[_0x1867('0x10')]['toLowerCase']();this[_0x1867('0x9')][_0x2a56dd[_0x1867('0x3c')]][_0x1867('0x3f')]=_0x2a56dd[_0x1867('0x3f')];this[_0x1867('0x1e')](util['format']('trunk:%s',this[_0x1867('0x9')][_0x2a56dd[_0x1867('0x3c')]]['name']),_0x1867('0x28'),this[_0x1867('0x9')][_0x2a56dd[_0x1867('0x3c')]]);}else{}}}catch(_0x11e79a){logger['error'](_0x1867('0x40'),util['inspect'](_0x11e79a,{'showHidden':![],'depth':null}));}};module[_0x1867('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 dc7876e..da8fdd0 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 _0x6943=['membercalls','memberdynamic','memberlastcall','memberpenalty','memberrealtime','includes','custom:voiceAgentReport','values','transfereeuniqueid','origtransfereruniqueid','diff','seconds','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','syncBlindTransfer','transfereruniqueid','[syncBlindTransfer][VoiceAgentReport]','channel','substring','lastIndexOf','onhold','[syncMusicOnHoldStart][VoiceAgentReport]','[syncMusicOnHoldStop][VoiceAgentReport]','lodash','util','ioredis','../../../config/environment','../../../config/logger','ami','redis','defaults','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','emit','prototype','isNotNull','isUndefined','uniqueid','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','type','inbound','merge','omit','event','privilege','custom:agentcalled','membername','user:called','error','[syncAgentCalled][VoiceAgentReport]','inspect','hasOwnProperty','agentconnectAt','lastevent','connect','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','pick','destconnectedlinenum','user:%s','user:agentconnect','agentringnoanswerAt','reason','answered_elsewhere','answeredelsewheremembername','custom:agentansweredelsewhere','rejected','[syncAgentRingNoAnswer][VoiceAgentReport]','abandoned','custom:agentqueuecallerabandon','agentcompleteAt','complete','talktime','transfer','acw','acwtime','interface','user:agentcomplete','[syncAgentComplete][VoiceAgentReport]','addVariable','keys','variable','[syncVarSet][VoiceAgentReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x6943,0x95));var _0x3694=function(_0x56a616,_0x5a3c7c){_0x56a616=_0x56a616-0x0;var _0xe94844=_0x6943[_0x56a616];return _0xe94844;};'use strict';var _=require(_0x3694('0x0'));var moment=require('moment');var util=require(_0x3694('0x1'));var Redis=require(_0x3694('0x2'));var config=require(_0x3694('0x3'));var logger=require(_0x3694('0x4'))(_0x3694('0x5'));var ami=require('../ami');config[_0x3694('0x6')]=_[_0x3694('0x7')](config['redis'],{'host':_0x3694('0x8'),'port':0x18eb});var io=require(_0x3694('0x9'))(new Redis(config['redis']));function VoiceAgentReport(_0x2b6562){this[_0x3694('0xa')]={};this[_0x3694('0xb')]=_0x2b6562[_0x3694('0xb')];this[_0x3694('0xc')]=_0x2b6562[_0x3694('0xc')];this[_0x3694('0xd')]={};ami['on'](_0x3694('0xe'),this[_0x3694('0xf')][_0x3694('0x10')](this));ami['on'](_0x3694('0x11'),this[_0x3694('0x12')][_0x3694('0x10')](this));ami['on'](_0x3694('0x13'),this[_0x3694('0x14')]['bind'](this));ami['on'](_0x3694('0x15'),this[_0x3694('0x16')][_0x3694('0x10')](this));ami['on'](_0x3694('0x17'),this[_0x3694('0x18')][_0x3694('0x10')](this));ami['on'](_0x3694('0x19'),this[_0x3694('0x1a')]['bind'](this));ami['on'](_0x3694('0x1b'),this[_0x3694('0x1c')]['bind'](this));ami['on'](_0x3694('0x1d'),this[_0x3694('0x1e')][_0x3694('0x10')](this));ami['on']('musiconholdstop',this[_0x3694('0x1f')][_0x3694('0x10')](this));ami['on'](_0x3694('0x20'),this[_0x3694('0x21')][_0x3694('0x10')](this));ami['on'](_0x3694('0x22'),this['syncBlindTransfer']['bind'](this));}VoiceAgentReport['prototype'][_0x3694('0x23')]=function(_0x5a93f1,_0x171db2,_0x4a9bb3){io['to'](_0x5a93f1)[_0x3694('0x23')](_0x171db2,_0x4a9bb3);};VoiceAgentReport[_0x3694('0x24')][_0x3694('0x25')]=function(_0x16b9de){return _0x16b9de!==null&&!_[_0x3694('0x26')](_0x16b9de);};VoiceAgentReport[_0x3694('0x24')][_0x3694('0xf')]=function(_0x52801b){try{if(this[_0x3694('0x25')](_0x52801b)){if(_[_0x3694('0x26')](this[_0x3694('0xa')][_0x52801b[_0x3694('0x27')]])){this[_0x3694('0xa')][_0x52801b[_0x3694('0x27')]]={};}if(_[_0x3694('0x26')](this[_0x3694('0xa')][_0x52801b[_0x3694('0x27')]][_0x52801b['destuniqueid']])){this[_0x3694('0xa')][_0x52801b['uniqueid']][_0x52801b[_0x3694('0x28')]]={'agentcalledAt':moment()[_0x3694('0x29')](_0x3694('0x2a')),'lastevent':_0x3694('0x2b'),'variables':this['variables'][_0x52801b[_0x3694('0x27')]],'type':this[_0x3694('0xb')][_0x52801b[_0x3694('0x2c')]]?this[_0x3694('0xb')][_0x52801b[_0x3694('0x2c')]][_0x3694('0x2d')]||_0x3694('0x2e'):_0x3694('0x2e')};}_[_0x3694('0x2f')](this[_0x3694('0xa')][_0x52801b[_0x3694('0x27')]][_0x52801b['destuniqueid']],_[_0x3694('0x30')](_0x52801b,[_0x3694('0x31'),_0x3694('0x32')]));ami[_0x3694('0x23')](_0x3694('0x33'),this[_0x3694('0xa')][_0x52801b[_0x3694('0x27')]][_0x52801b['destuniqueid']]);this[_0x3694('0x23')](util[_0x3694('0x29')]('user:%s',_0x52801b[_0x3694('0x34')]),_0x3694('0x35'),this[_0x3694('0xa')][_0x52801b[_0x3694('0x27')]][_0x52801b['destuniqueid']]);}}catch(_0x2e3d51){logger[_0x3694('0x36')](_0x3694('0x37'),util[_0x3694('0x38')](_0x2e3d51,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3694('0x24')][_0x3694('0x12')]=function(_0x2a5393){try{if(this[_0x3694('0x25')](_0x2a5393)){if(this[_0x3694('0xa')][_0x2a5393['uniqueid']]){for(var _0x1af25c in this[_0x3694('0xa')][_0x2a5393['uniqueid']]){if(this[_0x3694('0xa')][_0x2a5393[_0x3694('0x27')]][_0x3694('0x39')](_0x1af25c)){if(_0x2a5393[_0x3694('0x28')]===_0x1af25c){this[_0x3694('0xa')][_0x2a5393['uniqueid']][_0x1af25c][_0x3694('0x3a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x3694('0xa')][_0x2a5393[_0x3694('0x27')]][_0x1af25c][_0x3694('0x3b')]=_0x3694('0x3c');this[_0x3694('0xa')][_0x2a5393['uniqueid']][_0x1af25c][_0x3694('0x3d')]=_0x2a5393[_0x3694('0x3d')];this['channels'][_0x2a5393['uniqueid']][_0x1af25c][_0x3694('0x3e')]=_0x2a5393[_0x3694('0x3e')];this[_0x3694('0xa')][_0x2a5393[_0x3694('0x27')]][_0x1af25c][_0x3694('0x3f')]=_0x2a5393[_0x3694('0x3f')];this[_0x3694('0xa')][_0x2a5393['uniqueid']][_0x1af25c]['destchannelstate']=_0x2a5393[_0x3694('0x40')];this['channels'][_0x2a5393[_0x3694('0x27')]][_0x1af25c]['destchannelstatedesc']=_0x2a5393[_0x3694('0x41')];_[_0x3694('0x2f')](this[_0x3694('0xc')][_0x2a5393['interface']],_[_0x3694('0x42')](_0x2a5393,['queue',_0x3694('0x43')]));this['emit'](util['format'](_0x3694('0x44'),_0x2a5393[_0x3694('0x34')]),_0x3694('0x45'),this[_0x3694('0xa')][_0x2a5393['uniqueid']][_0x2a5393[_0x3694('0x28')]]);ami['emit']('custom:agentconnect',this[_0x3694('0xa')][_0x2a5393[_0x3694('0x27')]][_0x1af25c]);}else if(!this['channels'][_0x2a5393[_0x3694('0x27')]][_0x1af25c][_0x3694('0x13')]&&!this[_0x3694('0xa')][_0x2a5393['uniqueid']][_0x1af25c]['agentcomplete']){this[_0x3694('0xa')][_0x2a5393[_0x3694('0x27')]][_0x1af25c][_0x3694('0x13')]=!![];this[_0x3694('0xa')][_0x2a5393[_0x3694('0x27')]][_0x1af25c][_0x3694('0x46')]=moment()['format'](_0x3694('0x2a'));this['channels'][_0x2a5393[_0x3694('0x27')]][_0x1af25c][_0x3694('0x47')]=_0x3694('0x48');this[_0x3694('0xa')][_0x2a5393[_0x3694('0x27')]][_0x1af25c][_0x3694('0x3b')]=_0x3694('0x48');this[_0x3694('0xa')][_0x2a5393[_0x3694('0x27')]][_0x1af25c]['answeredelsewheredestinationuniqueid']=_0x2a5393[_0x3694('0x28')];this[_0x3694('0xa')][_0x2a5393[_0x3694('0x27')]][_0x1af25c][_0x3694('0x49')]=_0x2a5393[_0x3694('0x34')];ami[_0x3694('0x23')](_0x3694('0x4a'),this['channels'][_0x2a5393[_0x3694('0x27')]][_0x1af25c]);}}}}}}catch(_0x59ba4e){logger[_0x3694('0x36')]('[syncAgentConnect][VoiceAgentReport]',util['inspect'](_0x59ba4e,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x3694('0x14')]=function(_0x22c15d){try{if(this[_0x3694('0x25')](_0x22c15d)){if(this[_0x3694('0xa')][_0x22c15d['uniqueid']]&&this['channels'][_0x22c15d['uniqueid']][_0x22c15d[_0x3694('0x28')]]){this[_0x3694('0xa')][_0x22c15d['uniqueid']][_0x22c15d[_0x3694('0x28')]]['agentringnoanswer']=!![];this[_0x3694('0xa')][_0x22c15d[_0x3694('0x27')]][_0x22c15d[_0x3694('0x28')]]['agentringnoanswerAt']=moment()[_0x3694('0x29')](_0x3694('0x2a'));this['channels'][_0x22c15d[_0x3694('0x27')]][_0x22c15d[_0x3694('0x28')]][_0x3694('0x47')]=_0x3694('0x4b');this[_0x3694('0xa')][_0x22c15d[_0x3694('0x27')]][_0x22c15d[_0x3694('0x28')]][_0x3694('0x3b')]=_0x3694('0x4b');ami[_0x3694('0x23')]('custom:agentringnoanswer',this[_0x3694('0xa')][_0x22c15d[_0x3694('0x27')]][_0x22c15d[_0x3694('0x28')]]);}}}catch(_0x540479){logger['error'](_0x3694('0x4c'),util['inspect'](_0x540479,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3694('0x24')][_0x3694('0x16')]=function(_0x42448a){try{if(this['isNotNull'](_0x42448a)){if(this[_0x3694('0xa')][_0x42448a['uniqueid']]){for(var _0x4a22dc in this[_0x3694('0xa')][_0x42448a[_0x3694('0x27')]]){if(this[_0x3694('0xa')][_0x42448a['uniqueid']][_0x3694('0x39')](_0x4a22dc)&&!this['channels'][_0x42448a[_0x3694('0x27')]][_0x4a22dc][_0x3694('0x13')]&&!this[_0x3694('0xa')][_0x42448a[_0x3694('0x27')]][_0x4a22dc]['agentcomplete']){this[_0x3694('0xa')][_0x42448a[_0x3694('0x27')]][_0x4a22dc]['agentringnoanswer']=!![];this['channels'][_0x42448a['uniqueid']][_0x4a22dc][_0x3694('0x46')]=moment()[_0x3694('0x29')](_0x3694('0x2a'));this[_0x3694('0xa')][_0x42448a[_0x3694('0x27')]][_0x4a22dc]['reason']=_0x3694('0x4d');this[_0x3694('0xa')][_0x42448a[_0x3694('0x27')]][_0x4a22dc][_0x3694('0x3b')]=_0x3694('0x4d');ami['emit'](_0x3694('0x4e'),this[_0x3694('0xa')][_0x42448a[_0x3694('0x27')]][_0x4a22dc]);}}}}}catch(_0x3ca639){logger[_0x3694('0x36')]('[syncQueueCallerAbandon][VoiceAgentReport]',util[_0x3694('0x38')](_0x3ca639,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3694('0x24')][_0x3694('0x18')]=function(_0x2977d3){try{if(this['isNotNull'](_0x2977d3)){if(this[_0x3694('0xa')][_0x2977d3[_0x3694('0x27')]]){for(var _0x39a6aa in this[_0x3694('0xa')][_0x2977d3[_0x3694('0x27')]]){if(this['channels'][_0x2977d3['uniqueid']][_0x3694('0x39')](_0x39a6aa)){if(this[_0x3694('0xa')][_0x2977d3[_0x3694('0x27')]][_0x39a6aa][_0x3694('0x3a')]&&!this[_0x3694('0xa')][_0x2977d3[_0x3694('0x27')]][_0x39a6aa][_0x3694('0x17')]){this[_0x3694('0xa')][_0x2977d3[_0x3694('0x27')]][_0x39a6aa][_0x3694('0x17')]=!![];this[_0x3694('0xa')][_0x2977d3['uniqueid']][_0x39a6aa][_0x3694('0x4f')]=moment()[_0x3694('0x29')](_0x3694('0x2a'));this[_0x3694('0xa')][_0x2977d3[_0x3694('0x27')]][_0x39a6aa][_0x3694('0x3b')]=_0x3694('0x50');this[_0x3694('0xa')][_0x2977d3[_0x3694('0x27')]][_0x39a6aa][_0x3694('0x51')]=_0x2977d3[_0x3694('0x51')];this[_0x3694('0xa')][_0x2977d3['uniqueid']][_0x39a6aa][_0x3694('0x47')]=_0x2977d3[_0x3694('0x47')]==_0x3694('0x52')?'agent':_0x2977d3[_0x3694('0x47')];if(this['voiceQueues'][_0x2977d3[_0x3694('0x2c')]]&&this[_0x3694('0xb')][_0x2977d3['queue']][_0x3694('0x53')]){this[_0x3694('0xa')][_0x2977d3[_0x3694('0x27')]][_0x39a6aa]['agentacw']=!![];this[_0x3694('0xa')][_0x2977d3['uniqueid']][_0x39a6aa][_0x3694('0x54')]=this[_0x3694('0xb')][_0x2977d3[_0x3694('0x2c')]]['acwTimeout'];}this[_0x3694('0xc')][_0x2977d3[_0x3694('0x55')]]=_['omit'](this['agents'][_0x2977d3[_0x3694('0x55')]],[_0x3694('0x2c'),_0x3694('0x43')]);this['emit'](util[_0x3694('0x29')]('user:%s',_0x2977d3[_0x3694('0x34')]),_0x3694('0x56'),this[_0x3694('0xa')][_0x2977d3['uniqueid']][_0x39a6aa]);ami[_0x3694('0x23')]('custom:agentcomplete',this['channels'][_0x2977d3['uniqueid']][_0x39a6aa]);}}}}}}catch(_0x5b7d61){logger[_0x3694('0x36')](_0x3694('0x57'),util[_0x3694('0x38')](_0x5b7d61,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3694('0x24')][_0x3694('0x1a')]=function(_0x315310){try{if(this[_0x3694('0x25')](_0x315310)){this[_0x3694('0x58')](_0x315310['uniqueid'],_[_0x3694('0x59')](_0x315310[_0x3694('0x5a')])[0x0],_0x315310['value']);if(this[_0x3694('0xa')][_0x315310['uniqueid']]){for(var _0xc523c in this[_0x3694('0xa')][_0x315310[_0x3694('0x27')]]){if(this[_0x3694('0xa')][_0x315310[_0x3694('0x27')]][_0x3694('0x39')](_0xc523c)){if(_[_0x3694('0x26')](this[_0x3694('0xa')][_0x315310[_0x3694('0x27')]][_0xc523c][_0x3694('0xd')])){this[_0x3694('0xa')][_0x315310[_0x3694('0x27')]][_0xc523c][_0x3694('0xd')]={};}this[_0x3694('0xa')][_0x315310[_0x3694('0x27')]][_0xc523c][_0x3694('0xd')]=this[_0x3694('0xd')][_0x315310[_0x3694('0x27')]];}}}}}catch(_0x8040f9){logger['error'](_0x3694('0x5b'),util['inspect'](_0x8040f9,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3694('0x24')][_0x3694('0x58')]=function(_0x4a72d9,_0x1fda9e,_0x480885){var _0x48caf8=[_0x3694('0x5c'),_0x3694('0x5d'),_0x3694('0x5e'),_0x3694('0x5f'),_0x3694('0x60'),_0x3694('0x61'),_0x3694('0x62'),'rtpaudioqosrttbridged',_0x3694('0x63'),_0x3694('0x64'),_0x3694('0x65'),_0x3694('0x66'),_0x3694('0x67'),_0x3694('0x68'),'memberinterface',_0x3694('0x69'),_0x3694('0x34'),_0x3694('0x6a'),_0x3694('0x6b')];if(!_['isNil'](_0x1fda9e)&&!_[_0x3694('0x6c')](_0x48caf8,_0x1fda9e)){if(_[_0x3694('0x26')](this[_0x3694('0xd')][_0x4a72d9])){this[_0x3694('0xd')][_0x4a72d9]={};}this[_0x3694('0xd')][_0x4a72d9][_0x1fda9e]=_0x480885;}};VoiceAgentReport[_0x3694('0x24')][_0x3694('0x1c')]=function(_0x26353e){try{if(this['isNotNull'](_0x26353e)){if(this[_0x3694('0xa')][_0x26353e[_0x3694('0x27')]]){for(var _0x3064d7 in this[_0x3694('0xa')][_0x26353e[_0x3694('0x27')]]){if(this[_0x3694('0xa')][_0x26353e['uniqueid']][_0x3694('0x39')](_0x3064d7)){if(this[_0x3694('0xa')][_0x26353e[_0x3694('0x27')]][_0x3064d7][_0x3694('0x47')]==_0x3694('0x52')&&this[_0x3694('0xa')][_0x26353e[_0x3694('0x27')]][_0x3064d7][_0x3694('0x17')]){this['channels'][_0x26353e['uniqueid']][_0x3064d7][_0x3694('0x4f')]=moment()[_0x3694('0x29')](_0x3694('0x2a'));}}}ami[_0x3694('0x23')](_0x3694('0x6d'),_[_0x3694('0x6e')](this[_0x3694('0xa')][_0x26353e[_0x3694('0x27')]]));delete this['channels'][_0x26353e['uniqueid']];}if(this['variables'][_0x26353e[_0x3694('0x27')]]){delete this[_0x3694('0xd')][_0x26353e[_0x3694('0x27')]];}}}catch(_0x1ac03e){logger[_0x3694('0x36')]('[syncHangup][VoiceAgentReport]',util[_0x3694('0x38')](_0x1ac03e,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAttendedTransfer']=function(_0x1c4af0){try{if(this['isNotNull'](_0x1c4af0)){if(this[_0x3694('0xa')][_0x1c4af0[_0x3694('0x6f')]]){for(var _0x447dd5 in this[_0x3694('0xa')][_0x1c4af0[_0x3694('0x6f')]]){if(this[_0x3694('0xa')][_0x1c4af0[_0x3694('0x6f')]]['hasOwnProperty'](_0x447dd5)){if(_0x1c4af0[_0x3694('0x70')]===_0x447dd5){var _0x596726=moment();this['channels'][_0x1c4af0[_0x3694('0x6f')]][_0x447dd5][_0x3694('0x17')]=!![];this[_0x3694('0xa')][_0x1c4af0[_0x3694('0x6f')]][_0x447dd5][_0x3694('0x4f')]=moment()[_0x3694('0x29')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x3694('0xa')][_0x1c4af0[_0x3694('0x6f')]][_0x447dd5][_0x3694('0x47')]=_0x3694('0x52');this[_0x3694('0xa')][_0x1c4af0[_0x3694('0x6f')]][_0x447dd5][_0x3694('0x3b')]=_0x3694('0x50');this[_0x3694('0xa')][_0x1c4af0[_0x3694('0x6f')]][_0x447dd5][_0x3694('0x51')]=_0x596726[_0x3694('0x71')](this[_0x3694('0xa')][_0x1c4af0[_0x3694('0x6f')]][_0x447dd5]['agentconnectAt'],_0x3694('0x72'));}}}}if(this[_0x3694('0xa')][_0x1c4af0['secondtransfereruniqueid']]){var _0x160c58=this[_0x3694('0xa')][_0x1c4af0[_0x3694('0x73')]];this[_0x3694('0xa')][_0x1c4af0['secondtransfereruniqueid']]=this[_0x3694('0xa')][_0x1c4af0['transfereeuniqueid']];this[_0x3694('0xa')][_0x1c4af0[_0x3694('0x6f')]]=_0x160c58;}}}catch(_0x59d91b){logger[_0x3694('0x36')](_0x3694('0x74'),util[_0x3694('0x38')](_0x59d91b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3694('0x24')][_0x3694('0x75')]=function(_0x423459){try{if(this['isNotNull'](_0x423459)){if(this[_0x3694('0xa')][_0x423459[_0x3694('0x6f')]]){for(var _0x5d9617 in this[_0x3694('0xa')][_0x423459['transfereeuniqueid']]){if(this[_0x3694('0xa')][_0x423459[_0x3694('0x6f')]][_0x3694('0x39')](_0x5d9617)){if(_0x423459[_0x3694('0x76')]===_0x5d9617){var _0xc9765f=moment();this[_0x3694('0xa')][_0x423459['transfereeuniqueid']][_0x5d9617]['agentcomplete']=!![];this[_0x3694('0xa')][_0x423459[_0x3694('0x6f')]][_0x5d9617][_0x3694('0x4f')]=_0xc9765f;this[_0x3694('0xa')][_0x423459[_0x3694('0x6f')]][_0x5d9617][_0x3694('0x47')]=_0x3694('0x52');this['channels'][_0x423459['transfereeuniqueid']][_0x5d9617]['lastevent']='complete';this[_0x3694('0xa')][_0x423459[_0x3694('0x6f')]][_0x5d9617][_0x3694('0x51')]=_0xc9765f[_0x3694('0x71')](this['channels'][_0x423459[_0x3694('0x6f')]][_0x5d9617][_0x3694('0x3a')],_0x3694('0x72'));}}}}}}catch(_0xc3e461){logger['error'](_0x3694('0x77'),util[_0x3694('0x38')](_0xc3e461,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3694('0x24')]['syncMusicOnHoldStart']=function(_0x202dab){var _0x1a635b='';try{if(this[_0x3694('0x25')](_0x202dab)){if(_0x202dab[_0x3694('0x78')]){_0x1a635b=_0x202dab[_0x3694('0x78')][_0x3694('0x79')](0x0,_0x202dab[_0x3694('0x78')][_0x3694('0x7a')]('-'));if(this[_0x3694('0xc')][_0x1a635b]){this[_0x3694('0xc')][_0x1a635b][_0x3694('0x7b')]=!![];}}}}catch(_0x3a5d63){logger['error'](_0x3694('0x7c'),util['inspect'](_0x3a5d63,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x3694('0x1f')]=function(_0x59ec83){var _0x56db11='';try{if(this[_0x3694('0x25')](_0x59ec83)){if(_0x59ec83['channel']){_0x56db11=_0x59ec83[_0x3694('0x78')]['substring'](0x0,_0x59ec83[_0x3694('0x78')][_0x3694('0x7a')]('-'));if(this[_0x3694('0xc')][_0x56db11]){this[_0x3694('0xc')][_0x56db11][_0x3694('0x7b')]=![];}}}}catch(_0x225bb4){logger[_0x3694('0x36')](_0x3694('0x7d'),util[_0x3694('0x38')](_0x225bb4,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0x62b0=['destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','type','inbound','omit','event','user:%s','error','[syncAgentCalled][VoiceAgentReport]','inspect','hasOwnProperty','agentconnectAt','lastevent','connect','holdtime','connectedlinenum','connectedlinename','destchannelstatedesc','interface','pick','membername','user:agentconnect','custom:agentconnect','agentcomplete','agentringnoanswerAt','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','custom:agentringnoanswer','[syncAgentRingNoAnswer][VoiceAgentReport]','reason','abandoned','custom:agentqueuecallerabandon','complete','talktime','transfer','agent','acw','acwTimeout','destconnectedlinenum','user:agentcomplete','[syncAgentComplete][VoiceAgentReport]','addVariable','keys','variable','[syncVarSet][VoiceAgentReport]','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','custom:voiceAgentReport','values','[syncHangup][VoiceAgentReport]','transfereeuniqueid','origtransfereruniqueid','diff','seconds','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','agentcompleteAt','[syncBlindTransfer][VoiceAgentReport]','channel','lastIndexOf','[syncMusicOnHoldStart][VoiceAgentReport]','substring','[syncMusicOnHoldStop][VoiceAgentReport]','exports','lodash','moment','util','ioredis','../../../config/logger','ami','../ami','redis','defaults','channels','voiceQueues','agents','variables','agentcalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','prototype','isNotNull','isUndefined','uniqueid'];(function(_0x3f3eec,_0x1dd43f){var _0x53ca01=function(_0x18717a){while(--_0x18717a){_0x3f3eec['push'](_0x3f3eec['shift']());}};_0x53ca01(++_0x1dd43f);}(_0x62b0,0xcc));var _0x062b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x62b0[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x062b('0x0'));var moment=require(_0x062b('0x1'));var util=require(_0x062b('0x2'));var Redis=require(_0x062b('0x3'));var config=require('../../../config/environment');var logger=require(_0x062b('0x4'))(_0x062b('0x5'));var ami=require(_0x062b('0x6'));config[_0x062b('0x7')]=_[_0x062b('0x8')](config[_0x062b('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceAgentReport(_0x38c776){this[_0x062b('0x9')]={};this[_0x062b('0xa')]=_0x38c776[_0x062b('0xa')];this[_0x062b('0xb')]=_0x38c776[_0x062b('0xb')];this[_0x062b('0xc')]={};ami['on'](_0x062b('0xd'),this['syncAgentCalled'][_0x062b('0xe')](this));ami['on'](_0x062b('0xf'),this[_0x062b('0x10')]['bind'](this));ami['on'](_0x062b('0x11'),this[_0x062b('0x12')][_0x062b('0xe')](this));ami['on'](_0x062b('0x13'),this[_0x062b('0x14')]['bind'](this));ami['on']('agentcomplete',this[_0x062b('0x15')][_0x062b('0xe')](this));ami['on'](_0x062b('0x16'),this[_0x062b('0x17')][_0x062b('0xe')](this));ami['on'](_0x062b('0x18'),this[_0x062b('0x19')][_0x062b('0xe')](this));ami['on'](_0x062b('0x1a'),this[_0x062b('0x1b')]['bind'](this));ami['on'](_0x062b('0x1c'),this[_0x062b('0x1d')]['bind'](this));ami['on']('attendedtransfer',this[_0x062b('0x1e')][_0x062b('0xe')](this));ami['on'](_0x062b('0x1f'),this[_0x062b('0x20')][_0x062b('0xe')](this));}VoiceAgentReport['prototype'][_0x062b('0x21')]=function(_0x5c83dc,_0x4ddf26,_0x14f92b){io['to'](_0x5c83dc)[_0x062b('0x21')](_0x4ddf26,_0x14f92b);};VoiceAgentReport[_0x062b('0x22')][_0x062b('0x23')]=function(_0x5bcf12){return _0x5bcf12!==null&&!_[_0x062b('0x24')](_0x5bcf12);};VoiceAgentReport[_0x062b('0x22')]['syncAgentCalled']=function(_0x132efb){try{if(this['isNotNull'](_0x132efb)){if(_[_0x062b('0x24')](this['channels'][_0x132efb['uniqueid']])){this['channels'][_0x132efb[_0x062b('0x25')]]={};}if(_[_0x062b('0x24')](this['channels'][_0x132efb[_0x062b('0x25')]][_0x132efb[_0x062b('0x26')]])){this[_0x062b('0x9')][_0x132efb[_0x062b('0x25')]][_0x132efb[_0x062b('0x26')]]={'agentcalledAt':moment()[_0x062b('0x27')](_0x062b('0x28')),'lastevent':_0x062b('0x29'),'variables':this[_0x062b('0xc')][_0x132efb['uniqueid']],'type':this[_0x062b('0xa')][_0x132efb[_0x062b('0x2a')]]?this[_0x062b('0xa')][_0x132efb[_0x062b('0x2a')]][_0x062b('0x2b')]||_0x062b('0x2c'):_0x062b('0x2c')};}_['merge'](this['channels'][_0x132efb['uniqueid']][_0x132efb[_0x062b('0x26')]],_[_0x062b('0x2d')](_0x132efb,[_0x062b('0x2e'),'privilege']));ami['emit']('custom:agentcalled',this['channels'][_0x132efb[_0x062b('0x25')]][_0x132efb[_0x062b('0x26')]]);this[_0x062b('0x21')](util[_0x062b('0x27')](_0x062b('0x2f'),_0x132efb['membername']),'user:called',this['channels'][_0x132efb[_0x062b('0x25')]][_0x132efb['destuniqueid']]);}}catch(_0x4d8223){logger[_0x062b('0x30')](_0x062b('0x31'),util[_0x062b('0x32')](_0x4d8223,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x062b('0x22')][_0x062b('0x10')]=function(_0x3e3225){try{if(this[_0x062b('0x23')](_0x3e3225)){if(this[_0x062b('0x9')][_0x3e3225[_0x062b('0x25')]]){for(var _0x37023e in this['channels'][_0x3e3225[_0x062b('0x25')]]){if(this[_0x062b('0x9')][_0x3e3225[_0x062b('0x25')]][_0x062b('0x33')](_0x37023e)){if(_0x3e3225[_0x062b('0x26')]===_0x37023e){this[_0x062b('0x9')][_0x3e3225[_0x062b('0x25')]][_0x37023e][_0x062b('0x34')]=moment()[_0x062b('0x27')](_0x062b('0x28'));this[_0x062b('0x9')][_0x3e3225[_0x062b('0x25')]][_0x37023e][_0x062b('0x35')]=_0x062b('0x36');this[_0x062b('0x9')][_0x3e3225[_0x062b('0x25')]][_0x37023e][_0x062b('0x37')]=_0x3e3225['holdtime'];this['channels'][_0x3e3225[_0x062b('0x25')]][_0x37023e][_0x062b('0x38')]=_0x3e3225[_0x062b('0x38')];this[_0x062b('0x9')][_0x3e3225[_0x062b('0x25')]][_0x37023e][_0x062b('0x39')]=_0x3e3225['connectedlinename'];this[_0x062b('0x9')][_0x3e3225['uniqueid']][_0x37023e]['destchannelstate']=_0x3e3225['destchannelstate'];this['channels'][_0x3e3225['uniqueid']][_0x37023e][_0x062b('0x3a')]=_0x3e3225[_0x062b('0x3a')];_['merge'](this[_0x062b('0xb')][_0x3e3225[_0x062b('0x3b')]],_[_0x062b('0x3c')](_0x3e3225,['queue','destconnectedlinenum']));this[_0x062b('0x21')](util[_0x062b('0x27')]('user:%s',_0x3e3225[_0x062b('0x3d')]),_0x062b('0x3e'),this[_0x062b('0x9')][_0x3e3225['uniqueid']][_0x3e3225[_0x062b('0x26')]]);ami[_0x062b('0x21')](_0x062b('0x3f'),this[_0x062b('0x9')][_0x3e3225['uniqueid']][_0x37023e]);}else if(!this[_0x062b('0x9')][_0x3e3225['uniqueid']][_0x37023e][_0x062b('0x11')]&&!this[_0x062b('0x9')][_0x3e3225[_0x062b('0x25')]][_0x37023e][_0x062b('0x40')]){this[_0x062b('0x9')][_0x3e3225[_0x062b('0x25')]][_0x37023e]['agentringnoanswer']=!![];this['channels'][_0x3e3225[_0x062b('0x25')]][_0x37023e][_0x062b('0x41')]=moment()[_0x062b('0x27')](_0x062b('0x28'));this['channels'][_0x3e3225[_0x062b('0x25')]][_0x37023e]['reason']='answered_elsewhere';this['channels'][_0x3e3225[_0x062b('0x25')]][_0x37023e][_0x062b('0x35')]=_0x062b('0x42');this['channels'][_0x3e3225['uniqueid']][_0x37023e][_0x062b('0x43')]=_0x3e3225[_0x062b('0x26')];this[_0x062b('0x9')][_0x3e3225['uniqueid']][_0x37023e][_0x062b('0x44')]=_0x3e3225[_0x062b('0x3d')];ami[_0x062b('0x21')]('custom:agentansweredelsewhere',this[_0x062b('0x9')][_0x3e3225[_0x062b('0x25')]][_0x37023e]);}}}}}}catch(_0x16c28a){logger[_0x062b('0x30')]('[syncAgentConnect][VoiceAgentReport]',util[_0x062b('0x32')](_0x16c28a,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x062b('0x12')]=function(_0x31c68f){try{if(this[_0x062b('0x23')](_0x31c68f)){if(this['channels'][_0x31c68f[_0x062b('0x25')]]&&this[_0x062b('0x9')][_0x31c68f[_0x062b('0x25')]][_0x31c68f['destuniqueid']]){this[_0x062b('0x9')][_0x31c68f[_0x062b('0x25')]][_0x31c68f[_0x062b('0x26')]][_0x062b('0x11')]=!![];this[_0x062b('0x9')][_0x31c68f[_0x062b('0x25')]][_0x31c68f[_0x062b('0x26')]]['agentringnoanswerAt']=moment()[_0x062b('0x27')](_0x062b('0x28'));this[_0x062b('0x9')][_0x31c68f[_0x062b('0x25')]][_0x31c68f[_0x062b('0x26')]]['reason']='rejected';this[_0x062b('0x9')][_0x31c68f['uniqueid']][_0x31c68f['destuniqueid']][_0x062b('0x35')]='rejected';ami[_0x062b('0x21')](_0x062b('0x45'),this['channels'][_0x31c68f[_0x062b('0x25')]][_0x31c68f[_0x062b('0x26')]]);}}}catch(_0xf3fc51){logger[_0x062b('0x30')](_0x062b('0x46'),util['inspect'](_0xf3fc51,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x062b('0x14')]=function(_0x5dc285){try{if(this[_0x062b('0x23')](_0x5dc285)){if(this[_0x062b('0x9')][_0x5dc285['uniqueid']]){for(var _0x54d1ee in this[_0x062b('0x9')][_0x5dc285[_0x062b('0x25')]]){if(this['channels'][_0x5dc285['uniqueid']]['hasOwnProperty'](_0x54d1ee)&&!this['channels'][_0x5dc285[_0x062b('0x25')]][_0x54d1ee][_0x062b('0x11')]&&!this[_0x062b('0x9')][_0x5dc285[_0x062b('0x25')]][_0x54d1ee][_0x062b('0x40')]){this['channels'][_0x5dc285['uniqueid']][_0x54d1ee][_0x062b('0x11')]=!![];this[_0x062b('0x9')][_0x5dc285[_0x062b('0x25')]][_0x54d1ee][_0x062b('0x41')]=moment()[_0x062b('0x27')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x5dc285[_0x062b('0x25')]][_0x54d1ee][_0x062b('0x47')]=_0x062b('0x48');this[_0x062b('0x9')][_0x5dc285[_0x062b('0x25')]][_0x54d1ee]['lastevent']=_0x062b('0x48');ami[_0x062b('0x21')](_0x062b('0x49'),this[_0x062b('0x9')][_0x5dc285[_0x062b('0x25')]][_0x54d1ee]);}}}}}catch(_0x29cefc){logger[_0x062b('0x30')]('[syncQueueCallerAbandon][VoiceAgentReport]',util['inspect'](_0x29cefc,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x062b('0x15')]=function(_0x15abac){try{if(this[_0x062b('0x23')](_0x15abac)){if(this['channels'][_0x15abac[_0x062b('0x25')]]){for(var _0xeffa6c in this[_0x062b('0x9')][_0x15abac[_0x062b('0x25')]]){if(this[_0x062b('0x9')][_0x15abac[_0x062b('0x25')]][_0x062b('0x33')](_0xeffa6c)){if(this[_0x062b('0x9')][_0x15abac['uniqueid']][_0xeffa6c][_0x062b('0x34')]&&!this[_0x062b('0x9')][_0x15abac[_0x062b('0x25')]][_0xeffa6c]['agentcomplete']){this[_0x062b('0x9')][_0x15abac[_0x062b('0x25')]][_0xeffa6c]['agentcomplete']=!![];this[_0x062b('0x9')][_0x15abac[_0x062b('0x25')]][_0xeffa6c]['agentcompleteAt']=moment()[_0x062b('0x27')](_0x062b('0x28'));this[_0x062b('0x9')][_0x15abac[_0x062b('0x25')]][_0xeffa6c][_0x062b('0x35')]=_0x062b('0x4a');this[_0x062b('0x9')][_0x15abac[_0x062b('0x25')]][_0xeffa6c][_0x062b('0x4b')]=_0x15abac['talktime'];this[_0x062b('0x9')][_0x15abac[_0x062b('0x25')]][_0xeffa6c]['reason']=_0x15abac[_0x062b('0x47')]==_0x062b('0x4c')?_0x062b('0x4d'):_0x15abac[_0x062b('0x47')];if(this[_0x062b('0xa')][_0x15abac[_0x062b('0x2a')]]&&this['voiceQueues'][_0x15abac[_0x062b('0x2a')]][_0x062b('0x4e')]){this[_0x062b('0x9')][_0x15abac['uniqueid']][_0xeffa6c]['agentacw']=!![];this[_0x062b('0x9')][_0x15abac[_0x062b('0x25')]][_0xeffa6c]['acwtime']=this[_0x062b('0xa')][_0x15abac['queue']][_0x062b('0x4f')];}this[_0x062b('0xb')][_0x15abac[_0x062b('0x3b')]]=_[_0x062b('0x2d')](this['agents'][_0x15abac[_0x062b('0x3b')]],[_0x062b('0x2a'),_0x062b('0x50')]);this[_0x062b('0x21')](util[_0x062b('0x27')](_0x062b('0x2f'),_0x15abac[_0x062b('0x3d')]),_0x062b('0x51'),this['channels'][_0x15abac[_0x062b('0x25')]][_0xeffa6c]);ami[_0x062b('0x21')]('custom:agentcomplete',this['channels'][_0x15abac[_0x062b('0x25')]][_0xeffa6c]);}}}}}}catch(_0x17fe61){logger[_0x062b('0x30')](_0x062b('0x52'),util[_0x062b('0x32')](_0x17fe61,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x062b('0x17')]=function(_0x245598){try{if(this['isNotNull'](_0x245598)){this[_0x062b('0x53')](_0x245598['uniqueid'],_[_0x062b('0x54')](_0x245598[_0x062b('0x55')])[0x0],_0x245598['value']);if(this[_0x062b('0x9')][_0x245598[_0x062b('0x25')]]){for(var _0x3e99bc in this[_0x062b('0x9')][_0x245598[_0x062b('0x25')]]){if(this[_0x062b('0x9')][_0x245598[_0x062b('0x25')]]['hasOwnProperty'](_0x3e99bc)){if(_[_0x062b('0x24')](this[_0x062b('0x9')][_0x245598[_0x062b('0x25')]][_0x3e99bc]['variables'])){this[_0x062b('0x9')][_0x245598[_0x062b('0x25')]][_0x3e99bc][_0x062b('0xc')]={};}this[_0x062b('0x9')][_0x245598[_0x062b('0x25')]][_0x3e99bc][_0x062b('0xc')]=this[_0x062b('0xc')][_0x245598['uniqueid']];}}}}}catch(_0x2b2cb9){logger[_0x062b('0x30')](_0x062b('0x56'),util[_0x062b('0x32')](_0x2b2cb9,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x062b('0x53')]=function(_0x2d7599,_0x4847d4,_0x568353){var _0x4e0bd3=[_0x062b('0x57'),'rtpaudioqosbridged',_0x062b('0x58'),_0x062b('0x59'),'rtpaudioqosloss',_0x062b('0x5a'),'rtpaudioqosrtt',_0x062b('0x5b'),_0x062b('0x5c'),_0x062b('0x5d'),_0x062b('0x5e'),_0x062b('0x5f'),_0x062b('0x60'),_0x062b('0x61'),_0x062b('0x62'),_0x062b('0x63'),_0x062b('0x3d'),_0x062b('0x64'),_0x062b('0x65')];if(!_[_0x062b('0x66')](_0x4847d4)&&!_[_0x062b('0x67')](_0x4e0bd3,_0x4847d4)){if(_[_0x062b('0x24')](this[_0x062b('0xc')][_0x2d7599])){this['variables'][_0x2d7599]={};}this[_0x062b('0xc')][_0x2d7599][_0x4847d4]=_0x568353;}};VoiceAgentReport[_0x062b('0x22')][_0x062b('0x19')]=function(_0x5e25b7){try{if(this['isNotNull'](_0x5e25b7)){if(this[_0x062b('0x9')][_0x5e25b7['uniqueid']]){for(var _0x2fe191 in this[_0x062b('0x9')][_0x5e25b7[_0x062b('0x25')]]){if(this[_0x062b('0x9')][_0x5e25b7[_0x062b('0x25')]][_0x062b('0x33')](_0x2fe191)){if(this['channels'][_0x5e25b7[_0x062b('0x25')]][_0x2fe191][_0x062b('0x47')]==_0x062b('0x4c')&&this[_0x062b('0x9')][_0x5e25b7['uniqueid']][_0x2fe191][_0x062b('0x40')]){this[_0x062b('0x9')][_0x5e25b7[_0x062b('0x25')]][_0x2fe191]['agentcompleteAt']=moment()[_0x062b('0x27')](_0x062b('0x28'));}}}ami['emit'](_0x062b('0x68'),_[_0x062b('0x69')](this['channels'][_0x5e25b7['uniqueid']]));delete this[_0x062b('0x9')][_0x5e25b7['uniqueid']];}if(this[_0x062b('0xc')][_0x5e25b7[_0x062b('0x25')]]){delete this[_0x062b('0xc')][_0x5e25b7['uniqueid']];}}}catch(_0x3698e8){logger[_0x062b('0x30')](_0x062b('0x6a'),util[_0x062b('0x32')](_0x3698e8,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x062b('0x22')][_0x062b('0x1e')]=function(_0x299b70){try{if(this[_0x062b('0x23')](_0x299b70)){if(this[_0x062b('0x9')][_0x299b70[_0x062b('0x6b')]]){for(var _0x274a9e in this['channels'][_0x299b70['transfereeuniqueid']]){if(this[_0x062b('0x9')][_0x299b70['transfereeuniqueid']]['hasOwnProperty'](_0x274a9e)){if(_0x299b70[_0x062b('0x6c')]===_0x274a9e){var _0x1f34f8=moment();this[_0x062b('0x9')][_0x299b70[_0x062b('0x6b')]][_0x274a9e][_0x062b('0x40')]=!![];this[_0x062b('0x9')][_0x299b70['transfereeuniqueid']][_0x274a9e]['agentcompleteAt']=moment()['format'](_0x062b('0x28'));this[_0x062b('0x9')][_0x299b70[_0x062b('0x6b')]][_0x274a9e][_0x062b('0x47')]=_0x062b('0x4c');this[_0x062b('0x9')][_0x299b70[_0x062b('0x6b')]][_0x274a9e][_0x062b('0x35')]=_0x062b('0x4a');this['channels'][_0x299b70[_0x062b('0x6b')]][_0x274a9e][_0x062b('0x4b')]=_0x1f34f8[_0x062b('0x6d')](this['channels'][_0x299b70[_0x062b('0x6b')]][_0x274a9e]['agentconnectAt'],_0x062b('0x6e'));}}}}if(this['channels'][_0x299b70[_0x062b('0x6f')]]){var _0x47ca89=this[_0x062b('0x9')][_0x299b70[_0x062b('0x6f')]];this[_0x062b('0x9')][_0x299b70['secondtransfereruniqueid']]=this['channels'][_0x299b70[_0x062b('0x6b')]];this[_0x062b('0x9')][_0x299b70[_0x062b('0x6b')]]=_0x47ca89;}}}catch(_0x3b95d9){logger[_0x062b('0x30')](_0x062b('0x70'),util[_0x062b('0x32')](_0x3b95d9,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x062b('0x20')]=function(_0x36c8f3){try{if(this[_0x062b('0x23')](_0x36c8f3)){if(this[_0x062b('0x9')][_0x36c8f3[_0x062b('0x6b')]]){for(var _0x5ba513 in this[_0x062b('0x9')][_0x36c8f3['transfereeuniqueid']]){if(this[_0x062b('0x9')][_0x36c8f3['transfereeuniqueid']][_0x062b('0x33')](_0x5ba513)){if(_0x36c8f3['transfereruniqueid']===_0x5ba513){var _0x396ea7=moment();this[_0x062b('0x9')][_0x36c8f3[_0x062b('0x6b')]][_0x5ba513][_0x062b('0x40')]=!![];this[_0x062b('0x9')][_0x36c8f3[_0x062b('0x6b')]][_0x5ba513][_0x062b('0x71')]=_0x396ea7;this[_0x062b('0x9')][_0x36c8f3['transfereeuniqueid']][_0x5ba513][_0x062b('0x47')]=_0x062b('0x4c');this[_0x062b('0x9')][_0x36c8f3[_0x062b('0x6b')]][_0x5ba513][_0x062b('0x35')]=_0x062b('0x4a');this[_0x062b('0x9')][_0x36c8f3['transfereeuniqueid']][_0x5ba513][_0x062b('0x4b')]=_0x396ea7[_0x062b('0x6d')](this[_0x062b('0x9')][_0x36c8f3[_0x062b('0x6b')]][_0x5ba513]['agentconnectAt'],'seconds');}}}}}}catch(_0x377707){logger[_0x062b('0x30')](_0x062b('0x72'),util[_0x062b('0x32')](_0x377707,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x062b('0x22')][_0x062b('0x1b')]=function(_0x4104c7){var _0x2cef35='';try{if(this[_0x062b('0x23')](_0x4104c7)){if(_0x4104c7[_0x062b('0x73')]){_0x2cef35=_0x4104c7['channel']['substring'](0x0,_0x4104c7[_0x062b('0x73')][_0x062b('0x74')]('-'));if(this['agents'][_0x2cef35]){this['agents'][_0x2cef35]['onhold']=!![];}}}}catch(_0x3d46a0){logger['error'](_0x062b('0x75'),util[_0x062b('0x32')](_0x3d46a0,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x062b('0x22')][_0x062b('0x1d')]=function(_0x4a7d50){var _0x3b0589='';try{if(this['isNotNull'](_0x4a7d50)){if(_0x4a7d50[_0x062b('0x73')]){_0x3b0589=_0x4a7d50[_0x062b('0x73')][_0x062b('0x76')](0x0,_0x4a7d50[_0x062b('0x73')][_0x062b('0x74')]('-'));if(this[_0x062b('0xb')][_0x3b0589]){this[_0x062b('0xb')][_0x3b0589]['onhold']=![];}}}}catch(_0x44ff48){logger['error'](_0x062b('0x77'),util[_0x062b('0x32')](_0x44ff48,{'showHidden':![],'depth':null}));}};module[_0x062b('0x78')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 9d2e623..a388e80 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 _0xcb66=['blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','resolve','then','actionCoreShowChannels','catch','log','prototype','isNotNull','isUndefined','emit','uniqueid','merge','channels','pick','keys','error','[syncNewCallerId][VoiceCallReport]','linkedid','channel','OutgoingSpoolFailed','starttime','format','YYYY-MM-DD\x20HH:mm:ss','toNumber','channelstate','context','agents','split','destconnectedlinenum','user:%s','user:agentconnect','accountcode','exten','[syncNewChannel][VoiceCallReport]','toLowerCase','applicationdata','subtract','duration','seconds','includes','application','lastapplication','lastdata','cdr(','match','syncNewState','answered','answertime','holdtime','calleridnum','xcally-motion-preview','connectedlinenum','connectedlinename','disposition','membername','UserId','name','inspect','syncMixMonitorFilename','monitor','.wav49','.WAV','find','isNil','monitors','rec','syncVarSet','variable','value','xmd-phone','xmd-callerid','callerid','xmd-cdrtype','type','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','calleridpreview','sipcallid','mixmonitor_filename','parse','sipcalllinkedid','[syncVarSet][VoiceCallReport]','endtime','diff','billableseconds','from-sip','omit','user:agentcomplete','custom:voiceCallReport','[syncHangup][VoiceCallReport]','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','transfereecalleridnum','BlindTransfer','transfererchannel','[syncBlindTransfer][VoiceCallReport]','mohstarttime','milliseconds','lodash','moment','util','path','ioredis','../../../config/logger','ami','../ami','../model/channel','unknown','busy','invalid','unavailable','ringing','ringinuse','onhold','set','queue','agi','dial','playback','voicemail','NO\x20ANSWER','ANSWERED','BUSY','FAILED','redis','localhost','coreshowchannel','syncNewExten','bind','newexten','syncNewChannel','hangup','syncHangup','newcallerid','syncNewCallerId','syncAttendedTransfer'];(function(_0x4b3337,_0x31d955){var _0x3195f1=function(_0x4d526f){while(--_0x4d526f){_0x4b3337['push'](_0x4b3337['shift']());}};_0x3195f1(++_0x31d955);}(_0xcb66,0x19f));var _0x6cb6=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xcb66[_0x57b54c];return _0x59cc19;};'use strict';var BPromise=require('bluebird');var _=require(_0x6cb6('0x0'));var moment=require(_0x6cb6('0x1'));var util=require(_0x6cb6('0x2'));var path=require(_0x6cb6('0x3'));var Redis=require(_0x6cb6('0x4'));var config=require('../../../config/environment');var logger=require(_0x6cb6('0x5'))(_0x6cb6('0x6'));var ami=require(_0x6cb6('0x7'));var Channel=require(_0x6cb6('0x8'));var statusDesc=[_0x6cb6('0x9'),'not_inuse','inuse',_0x6cb6('0xa'),_0x6cb6('0xb'),_0x6cb6('0xc'),_0x6cb6('0xd'),_0x6cb6('0xe'),_0x6cb6('0xf')];var applications=[_0x6cb6('0x10'),_0x6cb6('0x11'),_0x6cb6('0x12'),_0x6cb6('0x13'),_0x6cb6('0x14'),_0x6cb6('0x15')];var dispositions=[_0x6cb6('0x16'),'FAILED','FAILED','NO\x20ANSWER','NO\x20ANSWER',_0x6cb6('0x16'),_0x6cb6('0x17'),_0x6cb6('0x18'),_0x6cb6('0x19'),'FAILED',_0x6cb6('0x19')];var actions={};config[_0x6cb6('0x1a')]=_['defaults'](config[_0x6cb6('0x1a')],{'host':_0x6cb6('0x1b'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6cb6('0x1a')]));function VoiceCallReport(_0x26b46b){this['channels']=_0x26b46b['channels'];this['agents']=_0x26b46b['agents'];ami['on'](_0x6cb6('0x1c'),this[_0x6cb6('0x1d')][_0x6cb6('0x1e')](this));ami['on'](_0x6cb6('0x1f'),this[_0x6cb6('0x1d')][_0x6cb6('0x1e')](this));ami['on']('newchannel',this[_0x6cb6('0x20')][_0x6cb6('0x1e')](this));ami['on']('newstate',this['syncNewState']['bind'](this));ami['on']('varset',this['syncVarSet']['bind'](this));ami['on'](_0x6cb6('0x21'),this[_0x6cb6('0x22')][_0x6cb6('0x1e')](this));ami['on'](_0x6cb6('0x23'),this[_0x6cb6('0x24')]['bind'](this));ami['on']('attendedtransfer',this[_0x6cb6('0x25')][_0x6cb6('0x1e')](this));ami['on'](_0x6cb6('0x26'),this[_0x6cb6('0x27')]['bind'](this));ami['on'](_0x6cb6('0x28'),this[_0x6cb6('0x29')]['bind'](this));ami['on']('musiconholdstop',this[_0x6cb6('0x2a')]['bind'](this));return BPromise[_0x6cb6('0x2b')]()[_0x6cb6('0x2c')](ami[_0x6cb6('0x2d')]())[_0x6cb6('0x2e')](function(_0x299830){console[_0x6cb6('0x2f')](_0x299830);});}VoiceCallReport[_0x6cb6('0x30')][_0x6cb6('0x31')]=function(_0x1cc1ed){return _0x1cc1ed!==null&&!_[_0x6cb6('0x32')](_0x1cc1ed);};VoiceCallReport['prototype']['emit']=function(_0x4ea573,_0x2dc6c9,_0x462dbf){io['to'](_0x4ea573)[_0x6cb6('0x33')](_0x2dc6c9,_0x462dbf);};VoiceCallReport[_0x6cb6('0x30')][_0x6cb6('0x24')]=function(_0x3b62e6){try{if(this['isNotNull'](_0x3b62e6)){if(_0x3b62e6[_0x6cb6('0x34')]===_0x3b62e6['linkedid']){if(!_[_0x6cb6('0x32')](this['channels'][_0x3b62e6[_0x6cb6('0x34')]])){_[_0x6cb6('0x35')](this[_0x6cb6('0x36')][_0x3b62e6['uniqueid']],_[_0x6cb6('0x37')](_0x3b62e6,_[_0x6cb6('0x38')](this[_0x6cb6('0x36')][_0x3b62e6['uniqueid']])));}}}}catch(_0x1c4942){logger[_0x6cb6('0x39')](_0x6cb6('0x3a'),util['inspect'](_0x1c4942,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6cb6('0x30')][_0x6cb6('0x20')]=function(_0x4e94a3){try{if(this[_0x6cb6('0x31')](_0x4e94a3)){if(_0x4e94a3[_0x6cb6('0x34')]===_0x4e94a3[_0x6cb6('0x3b')]&&_0x4e94a3[_0x6cb6('0x3c')]!=_0x6cb6('0x3d')){if(_[_0x6cb6('0x32')](this[_0x6cb6('0x36')][_0x4e94a3[_0x6cb6('0x34')]])){this[_0x6cb6('0x36')][_0x4e94a3[_0x6cb6('0x34')]]=new Channel();this['channels'][_0x4e94a3[_0x6cb6('0x34')]][_0x6cb6('0x3e')]=moment()[_0x6cb6('0x3f')](_0x6cb6('0x40'));this['channels'][_0x4e94a3['uniqueid']]['disposition']=dispositions[_[_0x6cb6('0x41')](_0x4e94a3[_0x6cb6('0x42')])];_[_0x6cb6('0x35')](this[_0x6cb6('0x36')][_0x4e94a3[_0x6cb6('0x34')]],_[_0x6cb6('0x37')](_0x4e94a3,_[_0x6cb6('0x38')](this[_0x6cb6('0x36')][_0x4e94a3['uniqueid']])));if(_0x4e94a3[_0x6cb6('0x43')]==='from-sip'){if(this[_0x6cb6('0x44')][_0x4e94a3[_0x6cb6('0x3c')][_0x6cb6('0x45')]('-')[0x0]]){this[_0x6cb6('0x44')][_0x4e94a3[_0x6cb6('0x3c')][_0x6cb6('0x45')]('-')[0x0]][_0x6cb6('0x46')]=_0x4e94a3['exten'];this[_0x6cb6('0x33')](util['format'](_0x6cb6('0x47'),this[_0x6cb6('0x44')][_0x4e94a3[_0x6cb6('0x3c')]['split']('-')[0x0]]['name']),_0x6cb6('0x48'),{'destaccountcode':this['agents'][_0x4e94a3[_0x6cb6('0x3c')][_0x6cb6('0x45')]('-')[0x0]][_0x6cb6('0x49')],'destconnectedlinenum':_0x4e94a3[_0x6cb6('0x4a')]});}}}}}}catch(_0x267c95){logger[_0x6cb6('0x39')](_0x6cb6('0x4b'),util['inspect'](_0x267c95,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6cb6('0x30')][_0x6cb6('0x1d')]=function(_0x4d380e){try{if(this[_0x6cb6('0x31')](_0x4d380e)){if(_0x4d380e[_0x6cb6('0x34')]===_0x4d380e[_0x6cb6('0x3b')]&&_0x4d380e[_0x6cb6('0x4a')]!='h'&&_0x4d380e[_0x6cb6('0x3c')]!=_0x6cb6('0x3d')){_0x4d380e['application']=_0x4d380e['application'][_0x6cb6('0x4c')]();_0x4d380e['applicationdata']=(_0x4d380e['appdata']||_0x4d380e[_0x6cb6('0x4d')])['toLowerCase']();if(_[_0x6cb6('0x32')](this[_0x6cb6('0x36')][_0x4d380e['uniqueid']])){this['channels'][_0x4d380e[_0x6cb6('0x34')]]=new Channel();this['channels'][_0x4d380e[_0x6cb6('0x34')]][_0x6cb6('0x3e')]=_0x4d380e['duration']?moment()[_0x6cb6('0x4e')](moment[_0x6cb6('0x4f')](_0x4d380e['duration'])[_0x6cb6('0x50')](),'seconds')[_0x6cb6('0x3f')](_0x6cb6('0x40')):moment()['format'](_0x6cb6('0x40'));this[_0x6cb6('0x36')][_0x4d380e['uniqueid']]['disposition']=_0x6cb6('0x16');}_[_0x6cb6('0x35')](this[_0x6cb6('0x36')][_0x4d380e['uniqueid']],_[_0x6cb6('0x37')](_0x4d380e,_[_0x6cb6('0x38')](this['channels'][_0x4d380e[_0x6cb6('0x34')]])));if(_[_0x6cb6('0x51')](applications,_0x4d380e[_0x6cb6('0x52')])){this['channels'][_0x4d380e[_0x6cb6('0x34')]][_0x6cb6('0x53')]=_0x4d380e[_0x6cb6('0x52')];this[_0x6cb6('0x36')][_0x4d380e[_0x6cb6('0x34')]][_0x6cb6('0x54')]=_0x4d380e['applicationdata'];if(_0x4d380e[_0x6cb6('0x52')]==='set'&&_['startsWith'](_0x4d380e[_0x6cb6('0x4d')],_0x6cb6('0x55'))){var _0x4b4137=_0x4d380e[_0x6cb6('0x4d')]['split']('=');var _0x17b229=_0x4b4137[0x0][_0x6cb6('0x56')](/cdr\((.*)\)/);if(_0x17b229){this[_0x6cb6('0x36')][_0x4d380e['uniqueid']][_0x17b229[0x1]]=_0x4b4137[0x1];}}else if(_0x4d380e[_0x6cb6('0x52')]===_0x6cb6('0x11')){this[_0x6cb6('0x36')][_0x4d380e['uniqueid']][_0x6cb6('0x11')]=_0x4d380e['applicationdata'][_0x6cb6('0x45')](',')[0x0];}}}}}catch(_0x2684bb){logger[_0x6cb6('0x39')]('[syncNewExten][VoiceCallReport]',util['inspect'](_0x2684bb,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6cb6('0x30')][_0x6cb6('0x57')]=function(_0x1d12da){try{if(this['isNotNull'](_0x1d12da)){if(_0x1d12da[_0x6cb6('0x34')]!==_0x1d12da[_0x6cb6('0x3b')]){if(this[_0x6cb6('0x36')][_0x1d12da['linkedid']]){if(_0x1d12da[_0x6cb6('0x42')]==='6'){if(!this[_0x6cb6('0x36')][_0x1d12da[_0x6cb6('0x3b')]]['answered']){var _0x3f011f=moment();this[_0x6cb6('0x36')][_0x1d12da[_0x6cb6('0x3b')]][_0x6cb6('0x58')]=!![];this[_0x6cb6('0x36')][_0x1d12da[_0x6cb6('0x3b')]][_0x6cb6('0x59')]=_0x3f011f[_0x6cb6('0x3f')](_0x6cb6('0x40'));if(this[_0x6cb6('0x36')][_0x1d12da[_0x6cb6('0x3b')]][_0x6cb6('0x3e')]){this['channels'][_0x1d12da[_0x6cb6('0x3b')]][_0x6cb6('0x5a')]=_0x3f011f['diff'](this[_0x6cb6('0x36')][_0x1d12da[_0x6cb6('0x3b')]]['starttime'],_0x6cb6('0x50'));}}this[_0x6cb6('0x36')][_0x1d12da[_0x6cb6('0x3b')]]['linkedid']=_0x1d12da[_0x6cb6('0x34')];if(_0x1d12da[_0x6cb6('0x5b')]!==_0x6cb6('0x5c')){this[_0x6cb6('0x36')][_0x1d12da[_0x6cb6('0x3b')]][_0x6cb6('0x5d')]=_0x1d12da[_0x6cb6('0x5b')];}this[_0x6cb6('0x36')][_0x1d12da[_0x6cb6('0x3b')]][_0x6cb6('0x5e')]=_0x1d12da['calleridname'];this[_0x6cb6('0x36')][_0x1d12da[_0x6cb6('0x3b')]]['destinationchannel']=_0x1d12da[_0x6cb6('0x3c')];this['channels'][_0x1d12da['linkedid']][_0x6cb6('0x5f')]=dispositions[_[_0x6cb6('0x41')](_0x1d12da[_0x6cb6('0x42')])];if(this[_0x6cb6('0x44')][_0x1d12da[_0x6cb6('0x3c')]['split']('-')[0x0]]){this[_0x6cb6('0x36')][_0x1d12da[_0x6cb6('0x3b')]]['UserId']=this[_0x6cb6('0x44')][_0x1d12da[_0x6cb6('0x3c')][_0x6cb6('0x45')]('-')[0x0]]['id'];this['channels'][_0x1d12da[_0x6cb6('0x3b')]][_0x6cb6('0x60')]=this[_0x6cb6('0x44')][_0x1d12da[_0x6cb6('0x3c')][_0x6cb6('0x45')]('-')[0x0]]['name'];}}}}else{if(this[_0x6cb6('0x36')][_0x1d12da['uniqueid']]){if(_0x1d12da[_0x6cb6('0x42')]==='6'){if(this['agents'][_0x1d12da[_0x6cb6('0x3c')][_0x6cb6('0x45')]('-')[0x0]]){this[_0x6cb6('0x36')][_0x1d12da[_0x6cb6('0x34')]][_0x6cb6('0x61')]=this['agents'][_0x1d12da[_0x6cb6('0x3c')][_0x6cb6('0x45')]('-')[0x0]]['id'];this[_0x6cb6('0x36')][_0x1d12da[_0x6cb6('0x34')]][_0x6cb6('0x60')]=this[_0x6cb6('0x44')][_0x1d12da['channel']['split']('-')[0x0]][_0x6cb6('0x62')];}}}}}}catch(_0x1aec61){logger[_0x6cb6('0x39')]('[syncNewState][VoiceCallReport]',util[_0x6cb6('0x63')](_0x1aec61,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6cb6('0x30')][_0x6cb6('0x64')]=function(_0x51d1bd,_0x558e39){if(this[_0x6cb6('0x36')][_0x51d1bd]){this[_0x6cb6('0x36')][_0x51d1bd][_0x6cb6('0x65')]=!![];if(_['endsWith'](_0x558e39,_0x6cb6('0x66'))){_0x558e39=_0x558e39['replace'](_0x6cb6('0x66'),_0x6cb6('0x67'));}this[_0x6cb6('0x36')][_0x51d1bd]['monitorFilename']=_0x558e39;var _0x4d9517=_[_0x6cb6('0x68')](this[_0x6cb6('0x36')][_0x51d1bd]['monitors'],{'filename':_0x558e39});if(_[_0x6cb6('0x69')](_0x4d9517)){this['channels'][_0x51d1bd][_0x6cb6('0x6a')]['push']({'filename':_0x558e39,'createdAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0x6cb6('0x6b')});}}};VoiceCallReport[_0x6cb6('0x30')][_0x6cb6('0x6c')]=function(_0x3556da){try{if(this['isNotNull'](_0x3556da)){if(this['channels'][_0x3556da[_0x6cb6('0x34')]]&&_0x3556da['channel']!='OutgoingSpoolFailed'){if(this[_0x6cb6('0x31')](_0x3556da[_0x6cb6('0x6d')])){if(this[_0x6cb6('0x31')](_0x3556da[_0x6cb6('0x6d')]['mixmonitor_filename'])){this[_0x6cb6('0x64')](_0x3556da[_0x6cb6('0x34')],_0x3556da[_0x6cb6('0x6e')]);}else if(this['isNotNull'](_0x3556da['variable'][_0x6cb6('0x6f')])){this['channels'][_0x3556da[_0x6cb6('0x34')]]['calleridnum']=_0x3556da['value'];}else if(this[_0x6cb6('0x31')](_0x3556da[_0x6cb6('0x6d')][_0x6cb6('0x70')])){this[_0x6cb6('0x36')][_0x3556da[_0x6cb6('0x34')]][_0x6cb6('0x71')]=_0x3556da[_0x6cb6('0x6e')];}else if(this[_0x6cb6('0x31')](_0x3556da['variable'][_0x6cb6('0x72')])){this[_0x6cb6('0x36')][_0x3556da[_0x6cb6('0x34')]][_0x6cb6('0x73')]=_0x3556da[_0x6cb6('0x6e')];}else if(this[_0x6cb6('0x31')](_0x3556da[_0x6cb6('0x6d')][_0x6cb6('0x74')])){this[_0x6cb6('0x36')][_0x3556da['uniqueid']]['queue']=_0x3556da['value']['split'](',')[0x0];}else if(this[_0x6cb6('0x31')](_0x3556da['variable'][_0x6cb6('0x75')])){this[_0x6cb6('0x36')][_0x3556da[_0x6cb6('0x34')]][_0x6cb6('0x76')]=_0x3556da[_0x6cb6('0x6e')];}else if(this[_0x6cb6('0x31')](_0x3556da[_0x6cb6('0x6d')][_0x6cb6('0x77')])){this[_0x6cb6('0x36')][_0x3556da[_0x6cb6('0x34')]][_0x6cb6('0x78')]=_0x3556da['value'];}else if(this['isNotNull'](_0x3556da[_0x6cb6('0x6d')][_0x6cb6('0x79')])){this[_0x6cb6('0x36')][_0x3556da[_0x6cb6('0x34')]][_0x6cb6('0x7a')]=_0x3556da[_0x6cb6('0x6e')];}else if(this['isNotNull'](_0x3556da[_0x6cb6('0x6d')]['xmcs-queue'])){this[_0x6cb6('0x36')][_0x3556da[_0x6cb6('0x34')]][_0x6cb6('0x11')]=_0x3556da[_0x6cb6('0x6e')];}else if(this[_0x6cb6('0x31')](_0x3556da[_0x6cb6('0x6d')][_0x6cb6('0x7b')])){this['channels'][_0x3556da['uniqueid']]['sipcalluniqueid']=_0x3556da[_0x6cb6('0x6e')];}}}else if(this[_0x6cb6('0x31')](_0x3556da[_0x6cb6('0x6d')][_0x6cb6('0x7c')])){if(_0x3556da[_0x6cb6('0x6e')]){var _0x1e8c05=path[_0x6cb6('0x7d')](_0x3556da[_0x6cb6('0x6e')])[_0x6cb6('0x62')];this['syncMixMonitorFilename'](_0x1e8c05,_0x3556da[_0x6cb6('0x6e')]);}}else if(this[_0x6cb6('0x36')][_0x3556da[_0x6cb6('0x3b')]]){if(this[_0x6cb6('0x31')](_0x3556da[_0x6cb6('0x6d')])){if(this[_0x6cb6('0x31')](_0x3556da[_0x6cb6('0x6d')]['sipcallid'])){this[_0x6cb6('0x36')][_0x3556da[_0x6cb6('0x3b')]][_0x6cb6('0x7e')]=_0x3556da[_0x6cb6('0x6e')];}}}}}catch(_0x23f39d){logger['error'](_0x6cb6('0x7f'),util[_0x6cb6('0x63')](_0x23f39d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6cb6('0x30')][_0x6cb6('0x22')]=function(_0x208f7b){try{if(this['isNotNull'](_0x208f7b)){if(this[_0x6cb6('0x36')][_0x208f7b[_0x6cb6('0x34')]]){var _0x266be9=moment();this[_0x6cb6('0x36')][_0x208f7b[_0x6cb6('0x34')]][_0x6cb6('0x80')]=_0x266be9[_0x6cb6('0x3f')](_0x6cb6('0x40'));this[_0x6cb6('0x36')][_0x208f7b[_0x6cb6('0x34')]][_0x6cb6('0x4f')]=_0x266be9[_0x6cb6('0x81')](this['channels'][_0x208f7b[_0x6cb6('0x34')]]['starttime'],'seconds');if(this['channels'][_0x208f7b[_0x6cb6('0x34')]]['answered']){this[_0x6cb6('0x36')][_0x208f7b[_0x6cb6('0x34')]][_0x6cb6('0x82')]=_0x266be9[_0x6cb6('0x81')](this[_0x6cb6('0x36')][_0x208f7b[_0x6cb6('0x34')]][_0x6cb6('0x59')],_0x6cb6('0x50'));this[_0x6cb6('0x36')][_0x208f7b[_0x6cb6('0x34')]]['holdtime']=this[_0x6cb6('0x36')][_0x208f7b[_0x6cb6('0x34')]]['duration']-this[_0x6cb6('0x36')][_0x208f7b['uniqueid']][_0x6cb6('0x82')];}if(_0x208f7b[_0x6cb6('0x43')]===_0x6cb6('0x83')){if(this[_0x6cb6('0x44')][_0x208f7b[_0x6cb6('0x3c')][_0x6cb6('0x45')]('-')[0x0]]){this[_0x6cb6('0x44')][_0x208f7b['channel'][_0x6cb6('0x45')]('-')[0x0]]=_[_0x6cb6('0x84')](this['agents'][_0x208f7b[_0x6cb6('0x3c')]['split']('-')[0x0]],[_0x6cb6('0x46')]);this[_0x6cb6('0x33')](util['format'](_0x6cb6('0x47'),this[_0x6cb6('0x44')][_0x208f7b[_0x6cb6('0x3c')][_0x6cb6('0x45')]('-')[0x0]][_0x6cb6('0x62')]),_0x6cb6('0x85'),{'destaccountcode':this['agents'][_0x208f7b[_0x6cb6('0x3c')][_0x6cb6('0x45')]('-')[0x0]][_0x6cb6('0x49')]});}}ami[_0x6cb6('0x33')](_0x6cb6('0x86'),this[_0x6cb6('0x36')][_0x208f7b['uniqueid']]);delete this[_0x6cb6('0x36')][_0x208f7b['uniqueid']];}}}catch(_0x5a5446){logger[_0x6cb6('0x39')](_0x6cb6('0x87'),util['inspect'](_0x5a5446,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6cb6('0x30')][_0x6cb6('0x25')]=function(_0x4d9702){try{if(this[_0x6cb6('0x31')](_0x4d9702)){if(this[_0x6cb6('0x36')][_0x4d9702[_0x6cb6('0x88')]]){this['channels'][_0x4d9702['transfereeuniqueid']][_0x6cb6('0x89')]=_0x4d9702[_0x6cb6('0x8a')];this[_0x6cb6('0x36')][_0x4d9702[_0x6cb6('0x88')]][_0x6cb6('0x8b')]=_0x4d9702[_0x6cb6('0x8c')];if(this[_0x6cb6('0x36')][_0x4d9702[_0x6cb6('0x8d')]]){var _0x3ae477=this[_0x6cb6('0x36')][_0x4d9702[_0x6cb6('0x8d')]];this['channels'][_0x4d9702[_0x6cb6('0x8d')]]=this[_0x6cb6('0x36')][_0x4d9702[_0x6cb6('0x88')]];this[_0x6cb6('0x36')][_0x4d9702[_0x6cb6('0x88')]]=_0x3ae477;}}else if(this[_0x6cb6('0x36')][_0x4d9702['transfertargetuniqueid']]){this[_0x6cb6('0x36')][_0x4d9702[_0x6cb6('0x8e')]][_0x6cb6('0x89')]=_0x4d9702['origtransferercalleridnum'];this[_0x6cb6('0x36')][_0x4d9702[_0x6cb6('0x8e')]]['transferconnectedlinenum']=_0x4d9702['transfertargetcalleridnum'];if(this[_0x6cb6('0x36')][_0x4d9702['origtransfereruniqueid']]){var _0x3ae477=this[_0x6cb6('0x36')][_0x4d9702['origtransfereruniqueid']];this[_0x6cb6('0x36')][_0x4d9702[_0x6cb6('0x8f')]]=this[_0x6cb6('0x36')][_0x4d9702[_0x6cb6('0x8e')]];this[_0x6cb6('0x36')][_0x4d9702[_0x6cb6('0x8e')]]=_0x3ae477;}}}}catch(_0x40130a){logger[_0x6cb6('0x39')](_0x6cb6('0x90'),util[_0x6cb6('0x63')](_0x40130a,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x6cb6('0x27')]=function(_0x10b2f4){try{if(this[_0x6cb6('0x31')](_0x10b2f4)){if(this[_0x6cb6('0x36')][_0x10b2f4[_0x6cb6('0x88')]]){this['channels'][_0x10b2f4['transfereeuniqueid']]['transfercalleridnum']=_0x10b2f4[_0x6cb6('0x91')];this[_0x6cb6('0x36')][_0x10b2f4[_0x6cb6('0x88')]][_0x6cb6('0x8b')]=_0x10b2f4['extension'];this[_0x6cb6('0x22')]({'event':_0x6cb6('0x92'),'uniqueid':_0x10b2f4[_0x6cb6('0x88')],'context':_0x10b2f4[_0x6cb6('0x43')],'channel':_0x10b2f4[_0x6cb6('0x93')]});}}}catch(_0x49e78f){logger[_0x6cb6('0x39')](_0x6cb6('0x94'),util[_0x6cb6('0x63')](_0x49e78f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6cb6('0x30')][_0x6cb6('0x29')]=function(_0x1c6ac8){try{if(this[_0x6cb6('0x31')](_0x1c6ac8)){if(this[_0x6cb6('0x36')][_0x1c6ac8[_0x6cb6('0x34')]]){if(!_[_0x6cb6('0x69')](this[_0x6cb6('0x36')][_0x1c6ac8[_0x6cb6('0x34')]][_0x6cb6('0x59')])){this['channels'][_0x1c6ac8[_0x6cb6('0x34')]][_0x6cb6('0x95')]=moment()[_0x6cb6('0x3f')](_0x6cb6('0x40'));}}}}catch(_0xf5437){logger[_0x6cb6('0x39')]('[syncMusicOnHoldStart][VoiceCallReport]',util[_0x6cb6('0x63')](_0xf5437,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x6cb6('0x2a')]=function(_0x76cca1){try{if(this[_0x6cb6('0x31')](_0x76cca1)){if(this[_0x6cb6('0x36')][_0x76cca1[_0x6cb6('0x34')]]){if(!_[_0x6cb6('0x69')](this[_0x6cb6('0x36')][_0x76cca1['uniqueid']]['mohstarttime'])){this[_0x6cb6('0x36')][_0x76cca1[_0x6cb6('0x34')]]['mohtime']+=moment()[_0x6cb6('0x96')](0x0)[_0x6cb6('0x81')](this['channels'][_0x76cca1['uniqueid']]['mohstarttime'],_0x6cb6('0x50'));delete this[_0x6cb6('0x36')][_0x76cca1['uniqueid']][_0x6cb6('0x95')];}}}}catch(_0x32906c){logger[_0x6cb6('0x39')]('[syncMusicOnHoldStop][VoiceCallReport]',util[_0x6cb6('0x63')](_0x32906c,{'showHidden':![],'depth':null}));}};module['exports']=VoiceCallReport; \ No newline at end of file +var _0x1159=['YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','context','from-sip','channel','split','exten','user:%s','user:agentconnect','accountcode','application','toLowerCase','applicationdata','isUndefined','starttime','subtract','duration','seconds','format','includes','lastapplication','lastdata','startsWith','cdr(','match','[syncNewExten][VoiceCallReport]','answered','answertime','holdtime','diff','calleridnum','xcally-motion-preview','connectedlinenum','connectedlinename','destinationchannel','name','UserId','membername','inspect','syncMixMonitorFilename','.wav49','.WAV','monitorFilename','monitors','isNil','push','rec','value','variable','xmd-callerid','callerid','xmd-cdrtype','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','xmd-callerid-preview','xmcs-queue','sipcallid','sipcalluniqueid','parse','sipcalllinkedid','[syncVarSet][VoiceCallReport]','endtime','billableseconds','omit','destconnectedlinenum','emit','user:agentcomplete','custom:voiceCallReport','[syncHangup][VoiceCallReport]','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereecalleridnum','extension','BlindTransfer','transfererchannel','[syncBlindTransfer][VoiceCallReport]','mohstarttime','[syncMusicOnHoldStart][VoiceCallReport]','mohtime','[syncMusicOnHoldStop][VoiceCallReport]','exports','bluebird','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','set','queue','playback','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','socket.io-emitter','channels','agents','syncNewExten','bind','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','resolve','then','actionCoreShowChannels','catch','log','prototype','isNotNull','uniqueid','linkedid','merge','pick','keys','error','[syncNewCallerId][VoiceCallReport]','OutgoingSpoolFailed'];(function(_0x30cb8a,_0x413da8){var _0x28f4f5=function(_0x1baa88){while(--_0x1baa88){_0x30cb8a['push'](_0x30cb8a['shift']());}};_0x28f4f5(++_0x413da8);}(_0x1159,0xf3));var _0x9115=function(_0x2a4ae6,_0x5f4ad5){_0x2a4ae6=_0x2a4ae6-0x0;var _0x4102f9=_0x1159[_0x2a4ae6];return _0x4102f9;};'use strict';var BPromise=require(_0x9115('0x0'));var _=require('lodash');var moment=require('moment');var util=require(_0x9115('0x1'));var path=require(_0x9115('0x2'));var Redis=require(_0x9115('0x3'));var config=require(_0x9115('0x4'));var logger=require(_0x9115('0x5'))(_0x9115('0x6'));var ami=require(_0x9115('0x7'));var Channel=require(_0x9115('0x8'));var statusDesc=['unknown',_0x9115('0x9'),_0x9115('0xa'),_0x9115('0xb'),_0x9115('0xc'),_0x9115('0xd'),_0x9115('0xe'),_0x9115('0xf'),'onhold'];var applications=[_0x9115('0x10'),_0x9115('0x11'),'agi','dial',_0x9115('0x12'),'voicemail'];var dispositions=[_0x9115('0x13'),_0x9115('0x14'),_0x9115('0x14'),_0x9115('0x13'),'NO\x20ANSWER',_0x9115('0x13'),_0x9115('0x15'),_0x9115('0x16'),_0x9115('0x14'),_0x9115('0x14'),_0x9115('0x14')];var actions={};config[_0x9115('0x17')]=_[_0x9115('0x18')](config[_0x9115('0x17')],{'host':'localhost','port':0x18eb});var io=require(_0x9115('0x19'))(new Redis(config['redis']));function VoiceCallReport(_0x1bfd8c){this['channels']=_0x1bfd8c[_0x9115('0x1a')];this[_0x9115('0x1b')]=_0x1bfd8c[_0x9115('0x1b')];ami['on']('coreshowchannel',this['syncNewExten']['bind'](this));ami['on']('newexten',this[_0x9115('0x1c')][_0x9115('0x1d')](this));ami['on'](_0x9115('0x1e'),this[_0x9115('0x1f')]['bind'](this));ami['on'](_0x9115('0x20'),this[_0x9115('0x21')][_0x9115('0x1d')](this));ami['on'](_0x9115('0x22'),this[_0x9115('0x23')][_0x9115('0x1d')](this));ami['on'](_0x9115('0x24'),this[_0x9115('0x25')][_0x9115('0x1d')](this));ami['on'](_0x9115('0x26'),this[_0x9115('0x27')]['bind'](this));ami['on'](_0x9115('0x28'),this[_0x9115('0x29')][_0x9115('0x1d')](this));ami['on'](_0x9115('0x2a'),this[_0x9115('0x2b')][_0x9115('0x1d')](this));ami['on'](_0x9115('0x2c'),this[_0x9115('0x2d')][_0x9115('0x1d')](this));ami['on'](_0x9115('0x2e'),this[_0x9115('0x2f')][_0x9115('0x1d')](this));return BPromise[_0x9115('0x30')]()[_0x9115('0x31')](ami[_0x9115('0x32')]())[_0x9115('0x33')](function(_0x3ffd2d){console[_0x9115('0x34')](_0x3ffd2d);});}VoiceCallReport[_0x9115('0x35')][_0x9115('0x36')]=function(_0x470666){return _0x470666!==null&&!_['isUndefined'](_0x470666);};VoiceCallReport[_0x9115('0x35')]['emit']=function(_0x2eae39,_0x1940a1,_0x27644c){io['to'](_0x2eae39)['emit'](_0x1940a1,_0x27644c);};VoiceCallReport[_0x9115('0x35')][_0x9115('0x27')]=function(_0x511ef){try{if(this['isNotNull'](_0x511ef)){if(_0x511ef[_0x9115('0x37')]===_0x511ef[_0x9115('0x38')]){if(!_['isUndefined'](this[_0x9115('0x1a')][_0x511ef['uniqueid']])){_[_0x9115('0x39')](this[_0x9115('0x1a')][_0x511ef[_0x9115('0x37')]],_[_0x9115('0x3a')](_0x511ef,_[_0x9115('0x3b')](this[_0x9115('0x1a')][_0x511ef[_0x9115('0x37')]])));}}}}catch(_0x418d21){logger[_0x9115('0x3c')](_0x9115('0x3d'),util['inspect'](_0x418d21,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x9115('0x35')][_0x9115('0x1f')]=function(_0x1f134c){try{if(this[_0x9115('0x36')](_0x1f134c)){if(_0x1f134c[_0x9115('0x37')]===_0x1f134c[_0x9115('0x38')]&&_0x1f134c['channel']!=_0x9115('0x3e')){if(_['isUndefined'](this[_0x9115('0x1a')][_0x1f134c[_0x9115('0x37')]])){this[_0x9115('0x1a')][_0x1f134c[_0x9115('0x37')]]=new Channel();this[_0x9115('0x1a')][_0x1f134c[_0x9115('0x37')]]['starttime']=moment()['format'](_0x9115('0x3f'));this[_0x9115('0x1a')][_0x1f134c[_0x9115('0x37')]][_0x9115('0x40')]=dispositions[_[_0x9115('0x41')](_0x1f134c[_0x9115('0x42')])];_[_0x9115('0x39')](this[_0x9115('0x1a')][_0x1f134c[_0x9115('0x37')]],_[_0x9115('0x3a')](_0x1f134c,_[_0x9115('0x3b')](this[_0x9115('0x1a')][_0x1f134c[_0x9115('0x37')]])));if(_0x1f134c[_0x9115('0x43')]===_0x9115('0x44')){if(this['agents'][_0x1f134c[_0x9115('0x45')][_0x9115('0x46')]('-')[0x0]]){this[_0x9115('0x1b')][_0x1f134c[_0x9115('0x45')]['split']('-')[0x0]]['destconnectedlinenum']=_0x1f134c[_0x9115('0x47')];this['emit'](util['format'](_0x9115('0x48'),this[_0x9115('0x1b')][_0x1f134c[_0x9115('0x45')][_0x9115('0x46')]('-')[0x0]]['name']),_0x9115('0x49'),{'destaccountcode':this[_0x9115('0x1b')][_0x1f134c['channel'][_0x9115('0x46')]('-')[0x0]][_0x9115('0x4a')],'destconnectedlinenum':_0x1f134c[_0x9115('0x47')]});}}}}}}catch(_0x5f0a0d){logger[_0x9115('0x3c')]('[syncNewChannel][VoiceCallReport]',util['inspect'](_0x5f0a0d,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x9115('0x1c')]=function(_0x45d7d8){try{if(this[_0x9115('0x36')](_0x45d7d8)){if(_0x45d7d8[_0x9115('0x37')]===_0x45d7d8[_0x9115('0x38')]&&_0x45d7d8['exten']!='h'&&_0x45d7d8['channel']!=_0x9115('0x3e')){_0x45d7d8[_0x9115('0x4b')]=_0x45d7d8[_0x9115('0x4b')][_0x9115('0x4c')]();_0x45d7d8[_0x9115('0x4d')]=(_0x45d7d8['appdata']||_0x45d7d8['applicationdata'])[_0x9115('0x4c')]();if(_[_0x9115('0x4e')](this['channels'][_0x45d7d8[_0x9115('0x37')]])){this[_0x9115('0x1a')][_0x45d7d8[_0x9115('0x37')]]=new Channel();this[_0x9115('0x1a')][_0x45d7d8[_0x9115('0x37')]][_0x9115('0x4f')]=_0x45d7d8['duration']?moment()[_0x9115('0x50')](moment[_0x9115('0x51')](_0x45d7d8[_0x9115('0x51')])[_0x9115('0x52')](),'seconds')[_0x9115('0x53')](_0x9115('0x3f')):moment()[_0x9115('0x53')](_0x9115('0x3f'));this['channels'][_0x45d7d8['uniqueid']]['disposition']=_0x9115('0x13');}_[_0x9115('0x39')](this[_0x9115('0x1a')][_0x45d7d8[_0x9115('0x37')]],_['pick'](_0x45d7d8,_[_0x9115('0x3b')](this[_0x9115('0x1a')][_0x45d7d8[_0x9115('0x37')]])));if(_[_0x9115('0x54')](applications,_0x45d7d8[_0x9115('0x4b')])){this['channels'][_0x45d7d8[_0x9115('0x37')]][_0x9115('0x55')]=_0x45d7d8[_0x9115('0x4b')];this[_0x9115('0x1a')][_0x45d7d8[_0x9115('0x37')]][_0x9115('0x56')]=_0x45d7d8[_0x9115('0x4d')];if(_0x45d7d8[_0x9115('0x4b')]==='set'&&_[_0x9115('0x57')](_0x45d7d8[_0x9115('0x4d')],_0x9115('0x58'))){var _0x97543c=_0x45d7d8[_0x9115('0x4d')]['split']('=');var _0x1e30dc=_0x97543c[0x0][_0x9115('0x59')](/cdr\((.*)\)/);if(_0x1e30dc){this[_0x9115('0x1a')][_0x45d7d8['uniqueid']][_0x1e30dc[0x1]]=_0x97543c[0x1];}}else if(_0x45d7d8[_0x9115('0x4b')]===_0x9115('0x11')){this[_0x9115('0x1a')][_0x45d7d8[_0x9115('0x37')]][_0x9115('0x11')]=_0x45d7d8[_0x9115('0x4d')][_0x9115('0x46')](',')[0x0];}}}}}catch(_0x50a631){logger[_0x9115('0x3c')](_0x9115('0x5a'),util['inspect'](_0x50a631,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x9115('0x35')][_0x9115('0x21')]=function(_0x520326){try{if(this[_0x9115('0x36')](_0x520326)){if(_0x520326[_0x9115('0x37')]!==_0x520326['linkedid']){if(this[_0x9115('0x1a')][_0x520326['linkedid']]){if(_0x520326['channelstate']==='6'){if(!this['channels'][_0x520326[_0x9115('0x38')]]['answered']){var _0x5e2e9f=moment();this['channels'][_0x520326[_0x9115('0x38')]][_0x9115('0x5b')]=!![];this[_0x9115('0x1a')][_0x520326[_0x9115('0x38')]][_0x9115('0x5c')]=_0x5e2e9f[_0x9115('0x53')](_0x9115('0x3f'));if(this[_0x9115('0x1a')][_0x520326[_0x9115('0x38')]][_0x9115('0x4f')]){this[_0x9115('0x1a')][_0x520326[_0x9115('0x38')]][_0x9115('0x5d')]=_0x5e2e9f[_0x9115('0x5e')](this[_0x9115('0x1a')][_0x520326[_0x9115('0x38')]]['starttime'],_0x9115('0x52'));}}this[_0x9115('0x1a')][_0x520326[_0x9115('0x38')]]['linkedid']=_0x520326['uniqueid'];if(_0x520326[_0x9115('0x5f')]!==_0x9115('0x60')){this[_0x9115('0x1a')][_0x520326[_0x9115('0x38')]][_0x9115('0x61')]=_0x520326[_0x9115('0x5f')];}this[_0x9115('0x1a')][_0x520326[_0x9115('0x38')]][_0x9115('0x62')]=_0x520326['calleridname'];this['channels'][_0x520326[_0x9115('0x38')]][_0x9115('0x63')]=_0x520326[_0x9115('0x45')];this[_0x9115('0x1a')][_0x520326['linkedid']][_0x9115('0x40')]=dispositions[_[_0x9115('0x41')](_0x520326[_0x9115('0x42')])];if(this['agents'][_0x520326[_0x9115('0x45')]['split']('-')[0x0]]){this[_0x9115('0x1a')][_0x520326[_0x9115('0x38')]]['UserId']=this[_0x9115('0x1b')][_0x520326[_0x9115('0x45')]['split']('-')[0x0]]['id'];this[_0x9115('0x1a')][_0x520326['linkedid']]['membername']=this[_0x9115('0x1b')][_0x520326[_0x9115('0x45')]['split']('-')[0x0]][_0x9115('0x64')];}}}}else{if(this[_0x9115('0x1a')][_0x520326[_0x9115('0x37')]]){if(_0x520326[_0x9115('0x42')]==='6'){if(this[_0x9115('0x1b')][_0x520326[_0x9115('0x45')]['split']('-')[0x0]]){this[_0x9115('0x1a')][_0x520326[_0x9115('0x37')]][_0x9115('0x65')]=this['agents'][_0x520326[_0x9115('0x45')]['split']('-')[0x0]]['id'];this['channels'][_0x520326[_0x9115('0x37')]][_0x9115('0x66')]=this['agents'][_0x520326[_0x9115('0x45')][_0x9115('0x46')]('-')[0x0]]['name'];}}}}}}catch(_0x1bee44){logger[_0x9115('0x3c')]('[syncNewState][VoiceCallReport]',util[_0x9115('0x67')](_0x1bee44,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x9115('0x35')][_0x9115('0x68')]=function(_0x314606,_0xd0c22a){if(this[_0x9115('0x1a')][_0x314606]){this[_0x9115('0x1a')][_0x314606]['monitor']=!![];if(_['endsWith'](_0xd0c22a,_0x9115('0x69'))){_0xd0c22a=_0xd0c22a['replace'](_0x9115('0x69'),_0x9115('0x6a'));}this['channels'][_0x314606][_0x9115('0x6b')]=_0xd0c22a;var _0x40671c=_['find'](this[_0x9115('0x1a')][_0x314606][_0x9115('0x6c')],{'filename':_0xd0c22a});if(_[_0x9115('0x6d')](_0x40671c)){this[_0x9115('0x1a')][_0x314606][_0x9115('0x6c')][_0x9115('0x6e')]({'filename':_0xd0c22a,'createdAt':moment()[_0x9115('0x53')](_0x9115('0x3f')),'mixmonitorid':'','status':_0x9115('0x6f')});}}};VoiceCallReport[_0x9115('0x35')]['syncVarSet']=function(_0x29298c){try{if(this[_0x9115('0x36')](_0x29298c)){if(this[_0x9115('0x1a')][_0x29298c[_0x9115('0x37')]]&&_0x29298c['channel']!=_0x9115('0x3e')){if(this[_0x9115('0x36')](_0x29298c['variable'])){if(this[_0x9115('0x36')](_0x29298c['variable']['mixmonitor_filename'])){this[_0x9115('0x68')](_0x29298c[_0x9115('0x37')],_0x29298c[_0x9115('0x70')]);}else if(this[_0x9115('0x36')](_0x29298c[_0x9115('0x71')]['xmd-phone'])){this[_0x9115('0x1a')][_0x29298c[_0x9115('0x37')]][_0x9115('0x5f')]=_0x29298c[_0x9115('0x70')];}else if(this[_0x9115('0x36')](_0x29298c[_0x9115('0x71')][_0x9115('0x72')])){this[_0x9115('0x1a')][_0x29298c['uniqueid']][_0x9115('0x73')]=_0x29298c[_0x9115('0x70')];}else if(this[_0x9115('0x36')](_0x29298c[_0x9115('0x71')][_0x9115('0x74')])){this[_0x9115('0x1a')][_0x29298c[_0x9115('0x37')]]['type']=_0x29298c['value'];}else if(this[_0x9115('0x36')](_0x29298c['variable'][_0x9115('0x75')])){this[_0x9115('0x1a')][_0x29298c['uniqueid']][_0x9115('0x11')]=_0x29298c['value'][_0x9115('0x46')](',')[0x0];}else if(this['isNotNull'](_0x29298c['variable'][_0x9115('0x76')])){this[_0x9115('0x1a')][_0x29298c['uniqueid']][_0x9115('0x77')]=_0x29298c[_0x9115('0x70')];}else if(this[_0x9115('0x36')](_0x29298c[_0x9115('0x71')][_0x9115('0x78')])){this[_0x9115('0x1a')][_0x29298c[_0x9115('0x37')]]['destination']=_0x29298c['value'];}else if(this['isNotNull'](_0x29298c[_0x9115('0x71')][_0x9115('0x79')])){this[_0x9115('0x1a')][_0x29298c[_0x9115('0x37')]]['calleridpreview']=_0x29298c[_0x9115('0x70')];}else if(this['isNotNull'](_0x29298c[_0x9115('0x71')][_0x9115('0x7a')])){this['channels'][_0x29298c[_0x9115('0x37')]][_0x9115('0x11')]=_0x29298c[_0x9115('0x70')];}else if(this[_0x9115('0x36')](_0x29298c['variable'][_0x9115('0x7b')])){this[_0x9115('0x1a')][_0x29298c[_0x9115('0x37')]][_0x9115('0x7c')]=_0x29298c[_0x9115('0x70')];}}}else if(this[_0x9115('0x36')](_0x29298c[_0x9115('0x71')]['mixmonitor_filename'])){if(_0x29298c[_0x9115('0x70')]){var _0xc812ae=path[_0x9115('0x7d')](_0x29298c[_0x9115('0x70')])[_0x9115('0x64')];this[_0x9115('0x68')](_0xc812ae,_0x29298c[_0x9115('0x70')]);}}else if(this[_0x9115('0x1a')][_0x29298c[_0x9115('0x38')]]){if(this[_0x9115('0x36')](_0x29298c[_0x9115('0x71')])){if(this[_0x9115('0x36')](_0x29298c[_0x9115('0x71')][_0x9115('0x7b')])){this[_0x9115('0x1a')][_0x29298c['linkedid']][_0x9115('0x7e')]=_0x29298c[_0x9115('0x70')];}}}}}catch(_0x505b1a){logger['error'](_0x9115('0x7f'),util['inspect'](_0x505b1a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x9115('0x35')][_0x9115('0x25')]=function(_0x1c34d6){try{if(this[_0x9115('0x36')](_0x1c34d6)){if(this[_0x9115('0x1a')][_0x1c34d6[_0x9115('0x37')]]){var _0x3462be=moment();this[_0x9115('0x1a')][_0x1c34d6[_0x9115('0x37')]][_0x9115('0x80')]=_0x3462be[_0x9115('0x53')](_0x9115('0x3f'));this['channels'][_0x1c34d6[_0x9115('0x37')]]['duration']=_0x3462be[_0x9115('0x5e')](this['channels'][_0x1c34d6[_0x9115('0x37')]][_0x9115('0x4f')],_0x9115('0x52'));if(this['channels'][_0x1c34d6[_0x9115('0x37')]][_0x9115('0x5b')]){this['channels'][_0x1c34d6[_0x9115('0x37')]]['billableseconds']=_0x3462be[_0x9115('0x5e')](this[_0x9115('0x1a')][_0x1c34d6[_0x9115('0x37')]][_0x9115('0x5c')],_0x9115('0x52'));this[_0x9115('0x1a')][_0x1c34d6[_0x9115('0x37')]]['holdtime']=this[_0x9115('0x1a')][_0x1c34d6['uniqueid']][_0x9115('0x51')]-this[_0x9115('0x1a')][_0x1c34d6['uniqueid']][_0x9115('0x81')];}if(_0x1c34d6[_0x9115('0x43')]==='from-sip'){if(this['agents'][_0x1c34d6[_0x9115('0x45')][_0x9115('0x46')]('-')[0x0]]){this[_0x9115('0x1b')][_0x1c34d6[_0x9115('0x45')][_0x9115('0x46')]('-')[0x0]]=_[_0x9115('0x82')](this[_0x9115('0x1b')][_0x1c34d6['channel'][_0x9115('0x46')]('-')[0x0]],[_0x9115('0x83')]);this[_0x9115('0x84')](util[_0x9115('0x53')](_0x9115('0x48'),this[_0x9115('0x1b')][_0x1c34d6[_0x9115('0x45')][_0x9115('0x46')]('-')[0x0]][_0x9115('0x64')]),_0x9115('0x85'),{'destaccountcode':this['agents'][_0x1c34d6[_0x9115('0x45')][_0x9115('0x46')]('-')[0x0]][_0x9115('0x4a')]});}}ami[_0x9115('0x84')](_0x9115('0x86'),this[_0x9115('0x1a')][_0x1c34d6[_0x9115('0x37')]]);delete this[_0x9115('0x1a')][_0x1c34d6[_0x9115('0x37')]];}}}catch(_0xa81a81){logger['error'](_0x9115('0x87'),util['inspect'](_0xa81a81,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x9115('0x35')][_0x9115('0x29')]=function(_0x652503){try{if(this[_0x9115('0x36')](_0x652503)){if(this['channels'][_0x652503[_0x9115('0x88')]]){this['channels'][_0x652503[_0x9115('0x88')]][_0x9115('0x89')]=_0x652503['origtransferercalleridnum'];this[_0x9115('0x1a')][_0x652503[_0x9115('0x88')]][_0x9115('0x8a')]=_0x652503[_0x9115('0x8b')];if(this['channels'][_0x652503['secondtransfereruniqueid']]){var _0x3592ca=this[_0x9115('0x1a')][_0x652503[_0x9115('0x8c')]];this[_0x9115('0x1a')][_0x652503[_0x9115('0x8c')]]=this[_0x9115('0x1a')][_0x652503[_0x9115('0x88')]];this['channels'][_0x652503[_0x9115('0x88')]]=_0x3592ca;}}else if(this[_0x9115('0x1a')][_0x652503[_0x9115('0x8d')]]){this[_0x9115('0x1a')][_0x652503['transfertargetuniqueid']][_0x9115('0x89')]=_0x652503['origtransferercalleridnum'];this['channels'][_0x652503[_0x9115('0x8d')]][_0x9115('0x8a')]=_0x652503[_0x9115('0x8b')];if(this['channels'][_0x652503[_0x9115('0x8e')]]){var _0x3592ca=this[_0x9115('0x1a')][_0x652503[_0x9115('0x8e')]];this['channels'][_0x652503['origtransfereruniqueid']]=this['channels'][_0x652503['transfertargetuniqueid']];this['channels'][_0x652503[_0x9115('0x8d')]]=_0x3592ca;}}}}catch(_0x138f3b){logger[_0x9115('0x3c')]('[syncAttendedTransfer][VoiceCallReport]',util['inspect'](_0x138f3b,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x9115('0x2b')]=function(_0x4f2ded){try{if(this['isNotNull'](_0x4f2ded)){if(this['channels'][_0x4f2ded[_0x9115('0x88')]]){this['channels'][_0x4f2ded[_0x9115('0x88')]][_0x9115('0x89')]=_0x4f2ded[_0x9115('0x8f')];this[_0x9115('0x1a')][_0x4f2ded[_0x9115('0x88')]]['transferconnectedlinenum']=_0x4f2ded[_0x9115('0x90')];this[_0x9115('0x25')]({'event':_0x9115('0x91'),'uniqueid':_0x4f2ded[_0x9115('0x88')],'context':_0x4f2ded['context'],'channel':_0x4f2ded[_0x9115('0x92')]});}}}catch(_0x3ce84d){logger['error'](_0x9115('0x93'),util['inspect'](_0x3ce84d,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x9115('0x2d')]=function(_0x2d3128){try{if(this[_0x9115('0x36')](_0x2d3128)){if(this['channels'][_0x2d3128[_0x9115('0x37')]]){if(!_[_0x9115('0x6d')](this[_0x9115('0x1a')][_0x2d3128[_0x9115('0x37')]]['answertime'])){this[_0x9115('0x1a')][_0x2d3128[_0x9115('0x37')]][_0x9115('0x94')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}}}catch(_0x56e811){logger[_0x9115('0x3c')](_0x9115('0x95'),util[_0x9115('0x67')](_0x56e811,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x9115('0x35')][_0x9115('0x2f')]=function(_0x37641b){try{if(this[_0x9115('0x36')](_0x37641b)){if(this[_0x9115('0x1a')][_0x37641b[_0x9115('0x37')]]){if(!_['isNil'](this[_0x9115('0x1a')][_0x37641b['uniqueid']][_0x9115('0x94')])){this[_0x9115('0x1a')][_0x37641b['uniqueid']][_0x9115('0x96')]+=moment()['milliseconds'](0x0)[_0x9115('0x5e')](this[_0x9115('0x1a')][_0x37641b[_0x9115('0x37')]]['mohstarttime'],_0x9115('0x52'));delete this[_0x9115('0x1a')][_0x37641b[_0x9115('0x37')]][_0x9115('0x94')];}}}}catch(_0x423914){logger['error'](_0x9115('0x97'),util[_0x9115('0x67')](_0x423914,{'showHidden':![],'depth':null}));}};module[_0x9115('0x98')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 77abad2..12cd7e8 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 _0x5dd1=['isNotNull','isUndefined','emit','merge','uniqueid','format','YYYY-MM-DD\x20HH:mm:ss','channel','lastIndexOf','event','privilege','custom:dialbegin','[syncDialBegin][VoiceDialReport]','inspect','dialstatus','connectedlinenum','connectedlinename','answertime','lastevent','custom:dialconnect','voice:outbound','error','[syncDialEnd][VoiceDialReport]','addVariable','keys','variable','value','outboundrouteid','voice_outbound_channel:save','[syncVarSet][VoiceDialReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','variables','syncHangup','endtime','duration','diff','starttime','seconds','complete','answered','billableseconds','holdtime','sumDuration','custom:voiceDialReport','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','voice_outbound_channel:remove','[syncHangup][VoiceDialReport]','exports','lodash','moment','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','outbound','syncDialBegin','bind','dialend','syncDialEnd','varset','syncVarSet','hangup','prototype'];(function(_0x57db49,_0x288094){var _0xd0636f=function(_0x227787){while(--_0x227787){_0x57db49['push'](_0x57db49['shift']());}};_0xd0636f(++_0x288094);}(_0x5dd1,0xed));var _0x15dd=function(_0x738e24,_0x1e5e92){_0x738e24=_0x738e24-0x0;var _0x24a00a=_0x5dd1[_0x738e24];return _0x24a00a;};'use strict';var _=require(_0x15dd('0x0'));var moment=require(_0x15dd('0x1'));var util=require('util');var Redis=require(_0x15dd('0x2'));var config=require(_0x15dd('0x3'));var logger=require(_0x15dd('0x4'))(_0x15dd('0x5'));var ami=require(_0x15dd('0x6'));config[_0x15dd('0x7')]=_[_0x15dd('0x8')](config[_0x15dd('0x7')],{'host':_0x15dd('0x9'),'port':0x18eb});var io=require(_0x15dd('0xa'))(new Redis(config[_0x15dd('0x7')]));function VoiceDialReport(_0x339baf){this[_0x15dd('0xb')]=_0x339baf['outboundChannels'];this[_0x15dd('0xc')]=_0x339baf[_0x15dd('0xc')];this['variables']={};ami['on']('dialbegin',this[_0x15dd('0xd')][_0x15dd('0xe')](this));ami['on'](_0x15dd('0xf'),this[_0x15dd('0x10')][_0x15dd('0xe')](this));ami['on'](_0x15dd('0x11'),this[_0x15dd('0x12')]['bind'](this));ami['on'](_0x15dd('0x13'),this['syncHangup']['bind'](this));}VoiceDialReport[_0x15dd('0x14')][_0x15dd('0x15')]=function(_0x1ef43d){return _0x1ef43d!==null&&!_[_0x15dd('0x16')](_0x1ef43d);};VoiceDialReport['prototype'][_0x15dd('0x17')]=function(_0xdd7284,_0x28b9be,_0x26541a){io['to'](_0xdd7284)['emit'](_0x28b9be,_0x26541a);};VoiceDialReport['prototype'][_0x15dd('0xd')]=function(_0x26e0e8){try{if(this['isNotNull'](_0x26e0e8)){if(this[_0x15dd('0xb')][_0x26e0e8['uniqueid']]){_[_0x15dd('0x18')](this[_0x15dd('0xb')][_0x26e0e8[_0x15dd('0x19')]],{'starttime':moment()[_0x15dd('0x1a')](_0x15dd('0x1b')),'lastevent':'called','interface':_0x26e0e8[_0x15dd('0x1c')]['substring'](0x0,_0x26e0e8[_0x15dd('0x1c')][_0x15dd('0x1d')]('-')),'membername':_0x26e0e8[_0x15dd('0x1c')]['substring'](_0x26e0e8[_0x15dd('0x1c')]['lastIndexOf']('/')+0x1,_0x26e0e8[_0x15dd('0x1c')][_0x15dd('0x1d')]('-'))},_['omit'](_0x26e0e8,[_0x15dd('0x1e'),_0x15dd('0x1f')]));this[_0x15dd('0x17')]('voice:outbound','voice_outbound_channel:save',this[_0x15dd('0xb')][_0x26e0e8[_0x15dd('0x19')]]);ami[_0x15dd('0x17')](_0x15dd('0x20'),this[_0x15dd('0xb')][_0x26e0e8['uniqueid']]);}}}catch(_0x3dc7d8){logger['error'](_0x15dd('0x21'),util[_0x15dd('0x22')](_0x3dc7d8,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['syncDialEnd']=function(_0x394aca){try{if(this[_0x15dd('0x15')](_0x394aca)){if(this[_0x15dd('0xb')][_0x394aca['uniqueid']]){this[_0x15dd('0xb')][_0x394aca[_0x15dd('0x19')]][_0x15dd('0x23')]=_0x394aca[_0x15dd('0x23')];if(_0x394aca[_0x15dd('0x23')]==='ANSWER'){this['channels'][_0x394aca['uniqueid']][_0x15dd('0x24')]=_0x394aca[_0x15dd('0x24')];this['channels'][_0x394aca['uniqueid']][_0x15dd('0x25')]=_0x394aca[_0x15dd('0x25')];this['channels'][_0x394aca[_0x15dd('0x19')]][_0x15dd('0x26')]=moment()[_0x15dd('0x1a')](_0x15dd('0x1b'));this[_0x15dd('0xb')][_0x394aca[_0x15dd('0x19')]][_0x15dd('0x27')]='connect';ami[_0x15dd('0x17')](_0x15dd('0x28'),this['channels'][_0x394aca[_0x15dd('0x19')]]);}this['emit'](_0x15dd('0x29'),'voice_outbound_channel:save',this['channels'][_0x394aca[_0x15dd('0x19')]]);}}}catch(_0x147140){logger[_0x15dd('0x2a')](_0x15dd('0x2b'),util[_0x15dd('0x22')](_0x147140,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x15dd('0x14')][_0x15dd('0x12')]=function(_0xad760e){try{if(this[_0x15dd('0x15')](_0xad760e)){this[_0x15dd('0x2c')](_0xad760e[_0x15dd('0x19')],_[_0x15dd('0x2d')](_0xad760e[_0x15dd('0x2e')])[0x0],_0xad760e[_0x15dd('0x2f')]);if(this[_0x15dd('0x15')](_0xad760e[_0x15dd('0x2e')])&&this[_0x15dd('0x15')](_0xad760e['variable'][_0x15dd('0x30')])){if(_[_0x15dd('0x16')](this['channels'][_0xad760e['uniqueid']])){this[_0x15dd('0xb')][_0xad760e[_0x15dd('0x19')]]={'routeId':_0xad760e['value'],'variables':this['variables'][_0xad760e[_0x15dd('0x19')]]};this[_0x15dd('0x17')]('voice:outbound',_0x15dd('0x31'),this[_0x15dd('0xb')][_0xad760e[_0x15dd('0x19')]]);}}}}catch(_0x186160){logger[_0x15dd('0x2a')](_0x15dd('0x32'),util[_0x15dd('0x22')](_0x186160,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x15dd('0x14')][_0x15dd('0x2c')]=function(_0x52b4fa,_0x3592cc,_0x47aaab){var _0x276043=[_0x15dd('0x33'),_0x15dd('0x34'),'rtpaudioqosjitter',_0x15dd('0x35'),_0x15dd('0x36'),'rtpaudioqoslossbridged','rtpaudioqosrtt',_0x15dd('0x37'),_0x15dd('0x38'),_0x15dd('0x39'),_0x15dd('0x3a'),_0x15dd('0x3b'),_0x15dd('0x3c'),_0x15dd('0x3d'),_0x15dd('0x3e'),_0x15dd('0x3f'),'membername',_0x15dd('0x40'),_0x15dd('0x41')];if(!_[_0x15dd('0x42')](_0x3592cc)&&!_['includes'](_0x276043,_0x3592cc)){if(_[_0x15dd('0x16')](this[_0x15dd('0x43')][_0x52b4fa])){this[_0x15dd('0x43')][_0x52b4fa]={};}this[_0x15dd('0x43')][_0x52b4fa][_0x3592cc]=_0x47aaab;}};VoiceDialReport[_0x15dd('0x14')][_0x15dd('0x44')]=function(_0x107ef0){try{if(this[_0x15dd('0x15')](_0x107ef0)){if(this[_0x15dd('0xb')][_0x107ef0['uniqueid']]){this[_0x15dd('0xb')][_0x107ef0[_0x15dd('0x19')]][_0x15dd('0x45')]=moment()['format'](_0x15dd('0x1b'));this[_0x15dd('0xb')][_0x107ef0['uniqueid']][_0x15dd('0x46')]=moment(this[_0x15dd('0xb')][_0x107ef0[_0x15dd('0x19')]]['endtime'])[_0x15dd('0x47')](this[_0x15dd('0xb')][_0x107ef0[_0x15dd('0x19')]][_0x15dd('0x48')],_0x15dd('0x49'));this[_0x15dd('0xb')][_0x107ef0[_0x15dd('0x19')]]['lastevent']=_0x15dd('0x4a');this['outbound']['total']+=0x1;if(this['channels'][_0x107ef0['uniqueid']]['answertime']){this['outbound'][_0x15dd('0x4b')]+=0x1;this['channels'][_0x107ef0[_0x15dd('0x19')]]['holdtime']=moment(this['channels'][_0x107ef0[_0x15dd('0x19')]][_0x15dd('0x26')])[_0x15dd('0x47')](this[_0x15dd('0xb')][_0x107ef0[_0x15dd('0x19')]][_0x15dd('0x48')],'seconds');this[_0x15dd('0xb')][_0x107ef0[_0x15dd('0x19')]][_0x15dd('0x4c')]=moment(this[_0x15dd('0xb')][_0x107ef0[_0x15dd('0x19')]][_0x15dd('0x45')])['diff'](this[_0x15dd('0xb')][_0x107ef0[_0x15dd('0x19')]][_0x15dd('0x26')],'seconds');this[_0x15dd('0xc')]['sumHoldTime']+=this[_0x15dd('0xb')][_0x107ef0[_0x15dd('0x19')]][_0x15dd('0x4d')]||0x0;this[_0x15dd('0xc')]['sumBillable']+=this[_0x15dd('0xb')][_0x107ef0[_0x15dd('0x19')]]['billableseconds'];}this['outbound'][_0x15dd('0x4e')]+=this[_0x15dd('0xb')][_0x107ef0[_0x15dd('0x19')]][_0x15dd('0x46')];ami[_0x15dd('0x17')](_0x15dd('0x4f'),this[_0x15dd('0xb')][_0x107ef0[_0x15dd('0x19')]]);ami['emit']('custom:dialend',this['channels'][_0x107ef0[_0x15dd('0x19')]]);this[_0x15dd('0x17')](_0x15dd('0x29'),_0x15dd('0x50'),this[_0x15dd('0xc')]);logger['info'](_0x15dd('0x51'),JSON[_0x15dd('0x52')](this['channels'][_0x107ef0[_0x15dd('0x19')]]));this[_0x15dd('0x17')]('voice:outbound',_0x15dd('0x53'),this[_0x15dd('0xb')][_0x107ef0[_0x15dd('0x19')]]);delete this[_0x15dd('0xb')][_0x107ef0[_0x15dd('0x19')]];}if(this['variables'][_0x107ef0[_0x15dd('0x19')]]){delete this[_0x15dd('0x43')][_0x107ef0[_0x15dd('0x19')]];}}}catch(_0x56c348){logger[_0x15dd('0x2a')](_0x15dd('0x54'),util[_0x15dd('0x22')](_0x56c348,{'showHidden':![],'depth':null}));}};module[_0x15dd('0x55')]=VoiceDialReport; \ No newline at end of file +var _0x9b2e=['connect','[syncDialEnd][VoiceDialReport]','addVariable','keys','variable','value','[syncVarSet][VoiceDialReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','sipuri','bridgepeer','membercalls','memberdynamic','memberinterface','membername','memberpenalty','memberrealtime','isNil','variables','duration','endtime','seconds','complete','answered','diff','starttime','billableseconds','sumHoldTime','holdtime','sumBillable','sumDuration','custom:voiceDialReport','custom:dialend','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','voice_outbound_channel:remove','[syncHangup][VoiceDialReport]','exports','moment','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','localhost','channels','outbound','dialbegin','syncDialBegin','dialend','syncDialEnd','bind','syncVarSet','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','uniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','lastIndexOf','omit','voice:outbound','voice_outbound_channel:save','custom:dialbegin','error','[syncDialBegin][VoiceDialReport]','inspect','dialstatus','connectedlinenum','connectedlinename','answertime','lastevent'];(function(_0x52aba0,_0x5d8055){var _0x5200c3=function(_0x1a28a8){while(--_0x1a28a8){_0x52aba0['push'](_0x52aba0['shift']());}};_0x5200c3(++_0x5d8055);}(_0x9b2e,0x7c));var _0xe9b2=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9b2e[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var moment=require(_0xe9b2('0x0'));var util=require('util');var Redis=require(_0xe9b2('0x1'));var config=require(_0xe9b2('0x2'));var logger=require(_0xe9b2('0x3'))(_0xe9b2('0x4'));var ami=require(_0xe9b2('0x5'));config['redis']=_['defaults'](config[_0xe9b2('0x6')],{'host':_0xe9b2('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe9b2('0x6')]));function VoiceDialReport(_0x3fbae5){this[_0xe9b2('0x8')]=_0x3fbae5['outboundChannels'];this['outbound']=_0x3fbae5[_0xe9b2('0x9')];this['variables']={};ami['on'](_0xe9b2('0xa'),this[_0xe9b2('0xb')]['bind'](this));ami['on'](_0xe9b2('0xc'),this[_0xe9b2('0xd')][_0xe9b2('0xe')](this));ami['on']('varset',this[_0xe9b2('0xf')][_0xe9b2('0xe')](this));ami['on'](_0xe9b2('0x10'),this[_0xe9b2('0x11')]['bind'](this));}VoiceDialReport[_0xe9b2('0x12')][_0xe9b2('0x13')]=function(_0x4a39a3){return _0x4a39a3!==null&&!_[_0xe9b2('0x14')](_0x4a39a3);};VoiceDialReport[_0xe9b2('0x12')][_0xe9b2('0x15')]=function(_0x2ed13e,_0x384b02,_0x38ce94){io['to'](_0x2ed13e)[_0xe9b2('0x15')](_0x384b02,_0x38ce94);};VoiceDialReport[_0xe9b2('0x12')][_0xe9b2('0xb')]=function(_0x5c32ed){try{if(this[_0xe9b2('0x13')](_0x5c32ed)){if(this[_0xe9b2('0x8')][_0x5c32ed['uniqueid']]){_['merge'](this['channels'][_0x5c32ed[_0xe9b2('0x16')]],{'starttime':moment()[_0xe9b2('0x17')](_0xe9b2('0x18')),'lastevent':_0xe9b2('0x19'),'interface':_0x5c32ed[_0xe9b2('0x1a')]['substring'](0x0,_0x5c32ed['channel'][_0xe9b2('0x1b')]('-')),'membername':_0x5c32ed['channel']['substring'](_0x5c32ed['channel'][_0xe9b2('0x1b')]('/')+0x1,_0x5c32ed[_0xe9b2('0x1a')][_0xe9b2('0x1b')]('-'))},_[_0xe9b2('0x1c')](_0x5c32ed,['event','privilege']));this[_0xe9b2('0x15')](_0xe9b2('0x1d'),_0xe9b2('0x1e'),this[_0xe9b2('0x8')][_0x5c32ed[_0xe9b2('0x16')]]);ami['emit'](_0xe9b2('0x1f'),this['channels'][_0x5c32ed[_0xe9b2('0x16')]]);}}}catch(_0x3b0807){logger[_0xe9b2('0x20')](_0xe9b2('0x21'),util[_0xe9b2('0x22')](_0x3b0807,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xe9b2('0x12')][_0xe9b2('0xd')]=function(_0xa968f9){try{if(this['isNotNull'](_0xa968f9)){if(this[_0xe9b2('0x8')][_0xa968f9['uniqueid']]){this[_0xe9b2('0x8')][_0xa968f9[_0xe9b2('0x16')]][_0xe9b2('0x23')]=_0xa968f9['dialstatus'];if(_0xa968f9['dialstatus']==='ANSWER'){this[_0xe9b2('0x8')][_0xa968f9[_0xe9b2('0x16')]][_0xe9b2('0x24')]=_0xa968f9[_0xe9b2('0x24')];this[_0xe9b2('0x8')][_0xa968f9[_0xe9b2('0x16')]]['connectedlinename']=_0xa968f9[_0xe9b2('0x25')];this[_0xe9b2('0x8')][_0xa968f9[_0xe9b2('0x16')]][_0xe9b2('0x26')]=moment()[_0xe9b2('0x17')](_0xe9b2('0x18'));this['channels'][_0xa968f9[_0xe9b2('0x16')]][_0xe9b2('0x27')]=_0xe9b2('0x28');ami[_0xe9b2('0x15')]('custom:dialconnect',this['channels'][_0xa968f9[_0xe9b2('0x16')]]);}this[_0xe9b2('0x15')](_0xe9b2('0x1d'),_0xe9b2('0x1e'),this[_0xe9b2('0x8')][_0xa968f9[_0xe9b2('0x16')]]);}}}catch(_0x370c9a){logger[_0xe9b2('0x20')](_0xe9b2('0x29'),util[_0xe9b2('0x22')](_0x370c9a,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xe9b2('0x12')]['syncVarSet']=function(_0x5a71be){try{if(this[_0xe9b2('0x13')](_0x5a71be)){this[_0xe9b2('0x2a')](_0x5a71be[_0xe9b2('0x16')],_[_0xe9b2('0x2b')](_0x5a71be[_0xe9b2('0x2c')])[0x0],_0x5a71be[_0xe9b2('0x2d')]);if(this[_0xe9b2('0x13')](_0x5a71be['variable'])&&this[_0xe9b2('0x13')](_0x5a71be[_0xe9b2('0x2c')]['outboundrouteid'])){if(_[_0xe9b2('0x14')](this[_0xe9b2('0x8')][_0x5a71be[_0xe9b2('0x16')]])){this[_0xe9b2('0x8')][_0x5a71be['uniqueid']]={'routeId':_0x5a71be[_0xe9b2('0x2d')],'variables':this['variables'][_0x5a71be[_0xe9b2('0x16')]]};this['emit']('voice:outbound',_0xe9b2('0x1e'),this[_0xe9b2('0x8')][_0x5a71be[_0xe9b2('0x16')]]);}}}}catch(_0x3f8bb7){logger[_0xe9b2('0x20')](_0xe9b2('0x2e'),util['inspect'](_0x3f8bb7,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xe9b2('0x12')][_0xe9b2('0x2a')]=function(_0x658338,_0x53b589,_0x4aae9d){var _0x20e4aa=[_0xe9b2('0x2f'),_0xe9b2('0x30'),'rtpaudioqosjitter',_0xe9b2('0x31'),_0xe9b2('0x32'),_0xe9b2('0x33'),'rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid',_0xe9b2('0x34'),_0xe9b2('0x35'),'bridgepvtcallid',_0xe9b2('0x36'),_0xe9b2('0x37'),_0xe9b2('0x38'),'memberlastcall',_0xe9b2('0x39'),_0xe9b2('0x3a'),_0xe9b2('0x3b')];if(!_[_0xe9b2('0x3c')](_0x53b589)&&!_['includes'](_0x20e4aa,_0x53b589)){if(_[_0xe9b2('0x14')](this[_0xe9b2('0x3d')][_0x658338])){this['variables'][_0x658338]={};}this[_0xe9b2('0x3d')][_0x658338][_0x53b589]=_0x4aae9d;}};VoiceDialReport[_0xe9b2('0x12')][_0xe9b2('0x11')]=function(_0x48f4f6){try{if(this[_0xe9b2('0x13')](_0x48f4f6)){if(this['channels'][_0x48f4f6[_0xe9b2('0x16')]]){this[_0xe9b2('0x8')][_0x48f4f6[_0xe9b2('0x16')]]['endtime']=moment()['format'](_0xe9b2('0x18'));this[_0xe9b2('0x8')][_0x48f4f6[_0xe9b2('0x16')]][_0xe9b2('0x3e')]=moment(this['channels'][_0x48f4f6['uniqueid']][_0xe9b2('0x3f')])['diff'](this[_0xe9b2('0x8')][_0x48f4f6['uniqueid']]['starttime'],_0xe9b2('0x40'));this[_0xe9b2('0x8')][_0x48f4f6[_0xe9b2('0x16')]]['lastevent']=_0xe9b2('0x41');this[_0xe9b2('0x9')]['total']+=0x1;if(this['channels'][_0x48f4f6[_0xe9b2('0x16')]]['answertime']){this[_0xe9b2('0x9')][_0xe9b2('0x42')]+=0x1;this[_0xe9b2('0x8')][_0x48f4f6[_0xe9b2('0x16')]]['holdtime']=moment(this[_0xe9b2('0x8')][_0x48f4f6[_0xe9b2('0x16')]]['answertime'])[_0xe9b2('0x43')](this[_0xe9b2('0x8')][_0x48f4f6[_0xe9b2('0x16')]][_0xe9b2('0x44')],_0xe9b2('0x40'));this[_0xe9b2('0x8')][_0x48f4f6[_0xe9b2('0x16')]][_0xe9b2('0x45')]=moment(this[_0xe9b2('0x8')][_0x48f4f6[_0xe9b2('0x16')]][_0xe9b2('0x3f')])[_0xe9b2('0x43')](this[_0xe9b2('0x8')][_0x48f4f6[_0xe9b2('0x16')]][_0xe9b2('0x26')],_0xe9b2('0x40'));this[_0xe9b2('0x9')][_0xe9b2('0x46')]+=this[_0xe9b2('0x8')][_0x48f4f6[_0xe9b2('0x16')]][_0xe9b2('0x47')]||0x0;this['outbound'][_0xe9b2('0x48')]+=this[_0xe9b2('0x8')][_0x48f4f6['uniqueid']][_0xe9b2('0x45')];}this[_0xe9b2('0x9')][_0xe9b2('0x49')]+=this[_0xe9b2('0x8')][_0x48f4f6[_0xe9b2('0x16')]][_0xe9b2('0x3e')];ami[_0xe9b2('0x15')](_0xe9b2('0x4a'),this[_0xe9b2('0x8')][_0x48f4f6[_0xe9b2('0x16')]]);ami[_0xe9b2('0x15')](_0xe9b2('0x4b'),this[_0xe9b2('0x8')][_0x48f4f6[_0xe9b2('0x16')]]);this[_0xe9b2('0x15')]('voice:outbound',_0xe9b2('0x4c'),this[_0xe9b2('0x9')]);logger['info'](_0xe9b2('0x4d'),JSON[_0xe9b2('0x4e')](this[_0xe9b2('0x8')][_0x48f4f6['uniqueid']]));this[_0xe9b2('0x15')](_0xe9b2('0x1d'),_0xe9b2('0x4f'),this[_0xe9b2('0x8')][_0x48f4f6[_0xe9b2('0x16')]]);delete this[_0xe9b2('0x8')][_0x48f4f6[_0xe9b2('0x16')]];}if(this[_0xe9b2('0x3d')][_0x48f4f6['uniqueid']]){delete this[_0xe9b2('0x3d')][_0x48f4f6['uniqueid']];}}}catch(_0x44358e){logger[_0xe9b2('0x20')](_0xe9b2('0x50'),util[_0xe9b2('0x22')](_0x44358e,{'showHidden':![],'depth':null}));}};module[_0xe9b2('0x51')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 7cd83d2..01a6d1e 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 _0x983f=['info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','emitVoiceQueueSummary','name','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','total','type','unmanaged','abandoned','Trunk','callerid','Interval','voice_queue:save','isNotNull','[queues]','flagQueueSummary','[queuesummary]','queue','countBy','callers','toNumber','loggedin','custom:queuesummary','syncNewExten','uniqueid','inbound','queuecallerjoinAt','position','count','push','emitVoiceQueueChannelSave','[syncQueueCallerJoin][VoiceQueueReport]','inspect','last','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitreason','ABANDONED','lastAssignedTo','[syncQueueCallerAbandon][VoiceQueueReport]','queuecallerleaveAt','connectedlinenum','connectedlinename','[syncQueueCallerLeave][VoiceQueueReport]','COMPLETEDBYAGENT','[syncAgentConnect][VoiceQueueReport]','assigned','membername','queuecallercomplete','queuecallerexit','queuecallerexitAt','transfer','reason','COMPLETED','startsWith','local/','linkedid','add','seconds','FORWARD','destexten','transferuniqueid','toUpperCase','[syncAgentComplete][VoiceQueueReport]','addVariable','keys','variable','value','queueposition','EXITWITHKEY','[syncVarSet][VoiceQueueReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','sipcallid','sipuri','bridgepeer','membercalls','memberdynamic','memberrealtime','includes','length','diff','milliseconds','lastevent','custom:queuecallerunmanaged','custom:queuecallerabandon','custom:voiceQueueReport','transfereeuniqueid','transferexten','secondtransfererexten','secondtransfereruniqueid','ATTENDEDTRANSFER','transfertype','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','[syncAttendedTransfer][VoiceQueueReport]','extension','BlindTransfer','context','transfererchannel','[syncBlindTransfer][VoiceQueueReport]','syncMusicOnHoldStart','mohstarttime','[syncMusicOnHoldStart][VoiceQueueReport]','[syncMusicOnHoldStop][VoiceQueueReport]','exports','lodash','moment','bluebird','util','md5','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','enqueue','tail','finally','sequence','queueReports','agents','channels','queueChannels','voiceQueues','campaigns','syncQueueSummary','bind','syncQueueSummaryComplete','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','syncQueueCallerLeave','syncAgentComplete','syncAgentConnect','varset','syncVarSet','hangup','syncHangup','fullybooted','syncFullyBooted','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isUndefined','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','queueStatusComplete','unlockRR','clearZombieChannels','switch','isNil','Action','channel','catch','message','No\x20such\x20channel','error','[voiceQueueReport][checkChannel]','variables','prototype','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','emit','format','voice:queue:%s','voice_queue_channel:save'];(function(_0x2ce6d5,_0x333e0c){var _0x32d272=function(_0x399f0b){while(--_0x399f0b){_0x2ce6d5['push'](_0x2ce6d5['shift']());}};_0x32d272(++_0x333e0c);}(_0x983f,0x137));var _0xf983=function(_0x17ec0a,_0x363e0b){_0x17ec0a=_0x17ec0a-0x0;var _0x3edff2=_0x983f[_0x17ec0a];return _0x3edff2;};'use strict';var _=require(_0xf983('0x0'));var moment=require(_0xf983('0x1'));var BPromise=require(_0xf983('0x2'));var util=require(_0xf983('0x3'));var md5=require(_0xf983('0x4'));var Redis=require(_0xf983('0x5'));var config=require(_0xf983('0x6'));var logger=require(_0xf983('0x7'))('ami');var ami=require('../ami');var QueueReport=require('../model/queueReport');config[_0xf983('0x8')]=_[_0xf983('0x9')](config[_0xf983('0x8')],{'host':_0xf983('0xa'),'port':0x18eb});var io=require(_0xf983('0xb'))(new Redis(config[_0xf983('0x8')]));var Sequence=function(){};Sequence['prototype'][_0xf983('0xc')]=function(_0x3dcc44){this['tail']=this[_0xf983('0xd')]?this[_0xf983('0xd')][_0xf983('0xe')](_0x3dcc44):_0x3dcc44();};function VoiceQueueReport(_0x425905){this[_0xf983('0xf')]=new Sequence();this[_0xf983('0x10')]={};this['agents']=_0x425905[_0xf983('0x11')];this[_0xf983('0x12')]=_0x425905[_0xf983('0x13')];this[_0xf983('0x14')]=_0x425905['voiceQueues'];this['flagQueueSummary']=!![];this[_0xf983('0x15')]=_0x425905[_0xf983('0x15')];this['variables']={};ami['on']('queuesummary',this[_0xf983('0x16')][_0xf983('0x17')](this));ami['on']('queuesummarycomplete',this[_0xf983('0x18')][_0xf983('0x17')](this));ami['on']('queuecallerjoin',this[_0xf983('0x19')][_0xf983('0x17')](this));ami['on'](_0xf983('0x1a'),this[_0xf983('0x1b')][_0xf983('0x17')](this));ami['on']('queuecallerleave',this[_0xf983('0x1c')]['bind'](this));ami['on']('agentcomplete',this[_0xf983('0x1d')][_0xf983('0x17')](this));ami['on']('agentconnect',this[_0xf983('0x1e')][_0xf983('0x17')](this));ami['on'](_0xf983('0x1f'),this[_0xf983('0x20')][_0xf983('0x17')](this));ami['on'](_0xf983('0x21'),this[_0xf983('0x22')][_0xf983('0x17')](this));ami['on'](_0xf983('0x23'),this[_0xf983('0x24')][_0xf983('0x17')](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart']['bind'](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop'][_0xf983('0x17')](this));ami['on'](_0xf983('0x25'),this[_0xf983('0x26')][_0xf983('0x17')](this));ami['on'](_0xf983('0x27'),this[_0xf983('0x28')][_0xf983('0x17')](this));this[_0xf983('0x29')]();this[_0xf983('0x2a')]();}function isNotNull(_0x3c1b5c){return _0x3c1b5c!==null&&!_[_0xf983('0x2b')](_0x3c1b5c);}function clearChannels(_0x2bf00b){if(!_[_0xf983('0x2c')](_0x2bf00b)){for(var _0x24ef36 in _0x2bf00b){if(_0x2bf00b[_0xf983('0x2d')](_0x24ef36)){delete _0x2bf00b[_0x24ef36];}}}}function clearCampaigns(_0x500f3f){if(!_['isEmpty'](_0x500f3f)){for(var _0x1621b1 in _0x500f3f){if(_0x500f3f[_0xf983('0x2d')](_0x1621b1)){_0x500f3f[_0x1621b1][_0xf983('0x2e')]=0x0;}}}}function clearVoiceQueues(_0x217706){if(!_['isEmpty'](_0x217706)){for(var _0x210462 in _0x217706){if(_0x217706['hasOwnProperty'](_0x210462)){_0x217706[_0x210462][_0xf983('0x2e')]=0x0;_0x217706[_0x210462][_0xf983('0x2f')]=0x0;_0x217706[_0x210462][_0xf983('0x30')]=0x0;_0x217706[_0x210462][_0xf983('0x31')]=0x0;_0x217706[_0x210462][_0xf983('0x32')]=!![];}}}}function clearAgentBooked(_0x8c92d){if(!_[_0xf983('0x2c')](_0x8c92d)){for(var _0x1bb7a9 in _0x8c92d){if(_0x8c92d[_0xf983('0x2d')](_0x1bb7a9)){_0x8c92d[_0x1bb7a9][_0xf983('0x33')]=!![];}}}}VoiceQueueReport['prototype'][_0xf983('0x34')]=function(){var _0x4f08a0=this;for(var _0x3f4437 in this[_0xf983('0x12')]){if(this['channels'][_0xf983('0x2d')](_0x3f4437)&&!this[_0xf983('0x12')][_0x3f4437][_0xf983('0x35')]){this['sequence']['enqueue'](function(){if(!_[_0xf983('0x36')](_0x4f08a0[_0xf983('0x12')][_0x3f4437])){return ami[_0xf983('0x37')]({'action':'status','channel':_0x4f08a0[_0xf983('0x12')][_0x3f4437][_0xf983('0x38')]})[_0xf983('0x39')](function(_0x37b9c1){if(_0x37b9c1[_0xf983('0x3a')]===_0xf983('0x3b')){setTimeout(function(){if(_0x4f08a0[_0xf983('0x12')][_0x3f4437]){delete _0x4f08a0['channels'][_0x3f4437];logger[_0xf983('0x3c')](_0xf983('0x3d'),_0x3f4437);}if(_0x4f08a0[_0xf983('0x10')][_0x3f4437]){delete _0x4f08a0[_0xf983('0x10')][_0x3f4437];logger[_0xf983('0x3c')]('[voiceQueueReport][checkQueueReport]',_0x3f4437);}if(_0x4f08a0[_0xf983('0x3e')][_0x3f4437]){delete _0x4f08a0['variables'][_0x3f4437];logger[_0xf983('0x3c')]('[voiceQueueReport][checkVariables]',_0x3f4437);}},0x1f40);}});}});}}};VoiceQueueReport[_0xf983('0x3f')][_0xf983('0x24')]=function(){logger[_0xf983('0x3c')](_0xf983('0x40'));clearChannels(this[_0xf983('0x12')]);this[_0xf983('0x41')](this[_0xf983('0x10')]);clearAgentBooked(this['agents']);clearVoiceQueues(this[_0xf983('0x14')]);clearCampaigns(this[_0xf983('0x15')]);};VoiceQueueReport[_0xf983('0x3f')][_0xf983('0x41')]=function(_0x6f05ea){var _0x24067d=this;if(!_[_0xf983('0x2c')](_0x6f05ea)){for(var _0x44522b in _0x6f05ea){if(_0x6f05ea[_0xf983('0x2d')](_0x44522b)){_0x24067d[_0xf983('0x42')](_0x6f05ea[_0x44522b]);delete _0x6f05ea[_0x44522b];}}}};function loggerCatch(_0x155445){return function(_0x551135){logger['error'](_0x155445,util['inspect'](_0x551135,{'showHidden':![],'depth':null}));};}VoiceQueueReport[_0xf983('0x3f')][_0xf983('0x43')]=function(_0x4e06ce,_0x26cf4d,_0x3960a1){io['to'](_0x4e06ce)[_0xf983('0x43')](_0x26cf4d,_0x3960a1);};VoiceQueueReport['prototype']['emitVoiceQueueChannelSave']=function(_0xeaa01){this[_0xf983('0x43')](util[_0xf983('0x44')](_0xf983('0x45'),_0xeaa01['name']),_0xf983('0x46'),_0xeaa01);};VoiceQueueReport['prototype'][_0xf983('0x42')]=function(_0x11a406){logger[_0xf983('0x47')](_0xf983('0x48'),JSON[_0xf983('0x49')](_0x11a406));this[_0xf983('0x43')](util[_0xf983('0x44')](_0xf983('0x45'),_0x11a406['name']),'voice_queue_channel:remove',_0x11a406);};VoiceQueueReport['prototype'][_0xf983('0x4a')]=function(_0x4bcf72){if(_0x4bcf72['type']==='inbound'){var _0xdde4a2={'id':_0x4bcf72['id'],'name':_0x4bcf72[_0xf983('0x4b')],'strategy':_0x4bcf72['strategy'],'answered':_0x4bcf72[_0xf983('0x4c')],'available':_0x4bcf72[_0xf983('0x4d')],'loggedIn':_0x4bcf72[_0xf983('0x4e')],'pTalking':_0x4bcf72[_0xf983('0x30')],'sumBillable':_0x4bcf72[_0xf983('0x4f')],'sumDuration':_0x4bcf72[_0xf983('0x50')],'sumHoldTime':_0x4bcf72[_0xf983('0x51')]||0x0,'talking':_0x4bcf72[_0xf983('0x2f')],'total':_0x4bcf72[_0xf983('0x52')],'type':_0x4bcf72[_0xf983('0x53')],'unmanaged':_0x4bcf72[_0xf983('0x54')],'abandoned':_0x4bcf72[_0xf983('0x55')],'waiting':_0x4bcf72[_0xf983('0x31')]};if(_0x4bcf72[_0xf983('0x56')]){_0xdde4a2['Trunk']={'id':_0x4bcf72['Trunk']['id'],'name':_0x4bcf72['Trunk'][_0xf983('0x4b')],'active':_0x4bcf72['Trunk']['active'],'callerid':_0x4bcf72[_0xf983('0x56')][_0xf983('0x57')]};}if(_0x4bcf72[_0xf983('0x58')]){_0xdde4a2['Interval']={'id':_0x4bcf72['Interval']['id'],'name':_0x4bcf72['Interval'][_0xf983('0x4b')]};}var _0x2f52ca=md5(JSON[_0xf983('0x49')](_0xdde4a2));if(_0x4bcf72[_0xf983('0x4')]!==_0x2f52ca){_0x4bcf72[_0xf983('0x4')]=_0x2f52ca;this['emit'](util[_0xf983('0x44')]('voice:queue:%s',_0xdde4a2[_0xf983('0x4b')]),_0xf983('0x59'),_0xdde4a2);}}};VoiceQueueReport['prototype'][_0xf983('0x5a')]=function(_0x1a5848){return _0x1a5848!==null&&!_[_0xf983('0x2b')](_0x1a5848);};VoiceQueueReport['prototype'][_0xf983('0x2a')]=function(){var _0x51d903=this;setInterval(function(){_0x51d903[_0xf983('0x34')]();ami[_0xf983('0x37')]({'action':'queues'})[_0xf983('0x39')](loggerCatch(_0xf983('0x5b')));},0x2710);};VoiceQueueReport[_0xf983('0x3f')][_0xf983('0x29')]=function(){var _0x17e427=this;setInterval(function(){if(_0x17e427[_0xf983('0x5c')]){return ami['Action']({'action':'queuesummary'})['then'](function(_0x453b0c){_0x17e427[_0xf983('0x5c')]=![];})['catch'](loggerCatch(_0xf983('0x5d')));}},0x3e8);};VoiceQueueReport[_0xf983('0x3f')]['syncQueueSummary']=function(_0x35e633){try{if(this[_0xf983('0x5a')](_0x35e633)&&this[_0xf983('0x5a')](_0x35e633['queue'])){if(this[_0xf983('0x14')][_0x35e633[_0xf983('0x5e')]]){var _0x1e99fa=_[_0xf983('0x5f')](this[_0xf983('0x12')],_0xf983('0x5e'))[_0x35e633[_0xf983('0x5e')]]||0x0;var _0x22538f=_0x1e99fa-_0x35e633[_0xf983('0x60')];if(this[_0xf983('0x14')][_0x35e633[_0xf983('0x5e')]]['waiting']!==_[_0xf983('0x61')](_0x35e633[_0xf983('0x60')])||this[_0xf983('0x14')][_0x35e633['queue']][_0xf983('0x4e')]!==_[_0xf983('0x61')](_0x35e633[_0xf983('0x62')])||this[_0xf983('0x14')][_0x35e633[_0xf983('0x5e')]]['available']!==_[_0xf983('0x61')](_0x35e633['available'])||this[_0xf983('0x14')][_0x35e633['queue']][_0xf983('0x2f')]!==_0x22538f){this[_0xf983('0x14')][_0x35e633[_0xf983('0x5e')]]['waiting']=_[_0xf983('0x61')](_0x35e633[_0xf983('0x60')]);this[_0xf983('0x14')][_0x35e633[_0xf983('0x5e')]][_0xf983('0x4e')]=_[_0xf983('0x61')](_0x35e633[_0xf983('0x62')]);this[_0xf983('0x14')][_0x35e633['queue']][_0xf983('0x4d')]=_['toNumber'](_0x35e633[_0xf983('0x4d')]);this[_0xf983('0x14')][_0x35e633[_0xf983('0x5e')]]['talking']=_0x22538f>0x0?_0x22538f:0x0;this[_0xf983('0x14')][_0x35e633[_0xf983('0x5e')]][_0xf983('0x2f')]=this[_0xf983('0x14')][_0x35e633[_0xf983('0x5e')]][_0xf983('0x2f')]>_[_0xf983('0x61')](_0x35e633[_0xf983('0x62')])?_[_0xf983('0x61')](_0x35e633[_0xf983('0x62')]):this['voiceQueues'][_0x35e633['queue']][_0xf983('0x2f')];this['emitVoiceQueueSummary'](this['voiceQueues'][_0x35e633['queue']]);}ami[_0xf983('0x43')](_0xf983('0x63'),this['voiceQueues'][_0x35e633['queue']]);}}}catch(_0x21aaea){logger[_0xf983('0x3c')]('[syncQueueSummary][VoiceQueueReport]',util['inspect'](_0x21aaea,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf983('0x3f')][_0xf983('0x18')]=function(_0x5958cc){this[_0xf983('0x5c')]=!![];};VoiceQueueReport[_0xf983('0x3f')][_0xf983('0x64')]=function(_0x23493f){};VoiceQueueReport['prototype'][_0xf983('0x19')]=function(_0x9390bb){try{if(this[_0xf983('0x5a')](_0x9390bb)){if(_[_0xf983('0x2b')](this[_0xf983('0x10')][_0x9390bb[_0xf983('0x65')]])){this['queueReports'][_0x9390bb[_0xf983('0x65')]]=[];this['channels'][_0x9390bb[_0xf983('0x65')]]={};}var _0x2c33e8=new QueueReport();_0x2c33e8['name']=_0x9390bb[_0xf983('0x5e')];_0x2c33e8[_0xf983('0x53')]=this[_0xf983('0x14')][_0x2c33e8['name']]&&this[_0xf983('0x14')][_0x2c33e8[_0xf983('0x4b')]]['type']?this['voiceQueues'][_0x2c33e8['name']]['type']||_0xf983('0x66'):_0xf983('0x66');_0x2c33e8[_0xf983('0x5e')]=_0x9390bb[_0xf983('0x5e')];_0x2c33e8[_0xf983('0x67')]=moment()[_0xf983('0x44')]('YYYY-MM-DD\x20HH:mm:ss');_0x2c33e8[_0xf983('0x68')]=_0x9390bb[_0xf983('0x68')];_0x2c33e8[_0xf983('0x69')]=_0x9390bb[_0xf983('0x69')];_['merge'](_0x2c33e8,_['pick'](_0x9390bb,_['keys'](_0x2c33e8)));this[_0xf983('0x10')][_0x9390bb[_0xf983('0x65')]][_0xf983('0x6a')](_0x2c33e8);this['channels'][_0x9390bb[_0xf983('0x65')]]=_0x2c33e8;this[_0xf983('0x6b')](_0x2c33e8);}}catch(_0xaa1d04){logger[_0xf983('0x3c')](_0xf983('0x6c'),util[_0xf983('0x6d')](_0xaa1d04,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf983('0x3f')][_0xf983('0x1b')]=function(_0x327848){try{if(this[_0xf983('0x5a')](_0x327848)){if(this[_0xf983('0x10')][_0x327848['uniqueid']]){var _0x12564f=_[_0xf983('0x6e')](this[_0xf983('0x10')][_0x327848[_0xf983('0x65')]]);_0x12564f['queuecallercomplete']=![];_0x12564f[_0xf983('0x6f')]=null;_0x12564f[_0xf983('0x70')]=_0x327848[_0xf983('0x70')];_0x12564f[_0xf983('0x71')]=_0x327848['originalposition'];_0x12564f[_0xf983('0x1a')]=!![];_0x12564f[_0xf983('0x72')]=moment()[_0xf983('0x44')](_0xf983('0x73'));_0x12564f[_0xf983('0x74')]=_0xf983('0x75');_0x12564f[_0xf983('0x76')]=null;this[_0xf983('0x12')][_0x327848[_0xf983('0x65')]]=_0x12564f;this[_0xf983('0x42')](_0x12564f);}}}catch(_0x3d93c7){logger['error'](_0xf983('0x77'),util[_0xf983('0x6d')](_0x3d93c7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf983('0x3f')][_0xf983('0x1c')]=function(_0x462408){try{if(this[_0xf983('0x5a')](_0x462408)){if(this['queueReports'][_0x462408[_0xf983('0x65')]]){var _0x7ee92e=_['last'](this[_0xf983('0x10')][_0x462408[_0xf983('0x65')]]);_0x7ee92e[_0xf983('0x78')]=moment()[_0xf983('0x44')](_0xf983('0x73'));_0x7ee92e['connectedlinenum']=_0x462408[_0xf983('0x79')];_0x7ee92e[_0xf983('0x7a')]=_0x462408[_0xf983('0x7a')];this[_0xf983('0x12')][_0x462408[_0xf983('0x65')]]=_0x7ee92e;this[_0xf983('0x6b')](_0x7ee92e);}}}catch(_0x3ce511){logger[_0xf983('0x3c')](_0xf983('0x7b'),util[_0xf983('0x6d')](_0x3ce511,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf983('0x3f')][_0xf983('0x1e')]=function(_0x20c67d){try{if(this[_0xf983('0x5a')](_0x20c67d)){if(this[_0xf983('0x10')][_0x20c67d['uniqueid']]){var _0x327a9a=_[_0xf983('0x6e')](this[_0xf983('0x10')][_0x20c67d[_0xf983('0x65')]]);_0x327a9a['queuecallercomplete']=!![];_0x327a9a[_0xf983('0x74')]=_0xf983('0x7c');}}}catch(_0x34c32a){logger[_0xf983('0x3c')](_0xf983('0x7d'),util[_0xf983('0x6d')](_0x34c32a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf983('0x3f')][_0xf983('0x1d')]=function(_0x2bf5b1){try{if(this[_0xf983('0x5a')](_0x2bf5b1)){if(this[_0xf983('0x10')][_0x2bf5b1[_0xf983('0x65')]]){var _0x1e3353=_[_0xf983('0x6e')](this[_0xf983('0x10')][_0x2bf5b1[_0xf983('0x65')]]);_0x1e3353[_0xf983('0x1a')]=![];_0x1e3353['queuecallerabandonAt']=null;_0x1e3353[_0xf983('0x7e')]=!![];_0x1e3353['lastAssignedTo']=_0x2bf5b1[_0xf983('0x7f')];_0x1e3353[_0xf983('0x70')]=_0x2bf5b1['holdtime'];_0x1e3353[_0xf983('0x80')]=!![];_0x1e3353[_0xf983('0x81')]=![];_0x1e3353[_0xf983('0x82')]=null;if(!_0x1e3353[_0xf983('0x83')]){if(_0x2bf5b1[_0xf983('0x84')]==_0xf983('0x83')){_0x1e3353[_0xf983('0x74')]=_0xf983('0x85');}else{if(_[_0xf983('0x86')](_0x2bf5b1[_0xf983('0x38')]['toLowerCase'](),_0xf983('0x87'))){if(this[_0xf983('0x10')][_0x2bf5b1[_0xf983('0x88')]]){var _0x1adae8=_['last'](this['queueReports'][_0x2bf5b1[_0xf983('0x88')]]);_0x1adae8[_0xf983('0x80')]=![];_0x1adae8['queuecallerexit']=!![];_0x1adae8[_0xf983('0x82')]=moment(_0x1e3353[_0xf983('0x67')])[_0xf983('0x89')](_0x2bf5b1[_0xf983('0x70')],_0xf983('0x8a'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1adae8['queuecallerexitreason']='FORWARDTRANSFER';_0x1adae8[_0xf983('0x83')]=!![];_0x1adae8['transfertype']=_0xf983('0x8b');_0x1adae8['transferexten']=_0x2bf5b1[_0xf983('0x8c')];_0x1adae8[_0xf983('0x8d')]=_0x2bf5b1[_0xf983('0x65')];var _0xc1ff5f=this['queueReports'][_0x2bf5b1[_0xf983('0x88')]];this[_0xf983('0x10')][_0x2bf5b1[_0xf983('0x88')]]=this[_0xf983('0x10')][_0x2bf5b1[_0xf983('0x65')]];this[_0xf983('0x10')][_0x2bf5b1[_0xf983('0x65')]]=_0xc1ff5f;}}else{_0x1e3353[_0xf983('0x74')]='COMPLETEDBY'+_0x2bf5b1[_0xf983('0x84')][_0xf983('0x8e')]();}}}this[_0xf983('0x12')][_0x2bf5b1[_0xf983('0x65')]]=_0x1e3353;this[_0xf983('0x42')](_0x1e3353);}}}catch(_0x39833c){logger[_0xf983('0x3c')](_0xf983('0x8f'),util[_0xf983('0x6d')](_0x39833c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf983('0x3f')][_0xf983('0x20')]=function(_0x1941c6){try{if(this[_0xf983('0x5a')](_0x1941c6)){this[_0xf983('0x90')](_0x1941c6[_0xf983('0x65')],_[_0xf983('0x91')](_0x1941c6[_0xf983('0x92')])[0x0],_0x1941c6[_0xf983('0x93')]);if(this[_0xf983('0x10')][_0x1941c6[_0xf983('0x65')]]){var _0x5104b=_[_0xf983('0x6e')](this[_0xf983('0x10')][_0x1941c6[_0xf983('0x65')]]);if(_0x5104b){if(this[_0xf983('0x5a')](_0x1941c6[_0xf983('0x92')])&&this[_0xf983('0x5a')](_0x1941c6['variable']['queuestatus'])){switch(_0x1941c6[_0xf983('0x93')]){case'CONTINUE':_0x5104b['queuecallerexit']=![];_0x5104b['queuecallerexitAt']=null;break;default:_0x5104b[_0xf983('0x81')]=!![];_0x5104b['queuecallerexitAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5104b[_0xf983('0x78')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x5104b[_0xf983('0x1a')]=![];_0x5104b[_0xf983('0x72')]=null;_0x5104b['queuecallerexitreason']=_0x1941c6[_0xf983('0x93')];this[_0xf983('0x12')][_0x1941c6[_0xf983('0x65')]]=_0x5104b;this[_0xf983('0x42')](_0x5104b);}else if(this['isNotNull'](_0x1941c6[_0xf983('0x92')])&&this[_0xf983('0x5a')](_0x1941c6[_0xf983('0x92')][_0xf983('0x94')])){if(!_0x5104b['queuecallerabandon']){_0x5104b[_0xf983('0x81')]=!![];_0x5104b[_0xf983('0x82')]=moment()[_0xf983('0x44')](_0xf983('0x73'));_0x5104b[_0xf983('0x74')]=_0xf983('0x95');_0x5104b[_0xf983('0x78')]=moment()['format'](_0xf983('0x73'));this[_0xf983('0x12')][_0x1941c6[_0xf983('0x65')]]=_0x5104b;}}_0x5104b[_0xf983('0x3e')]=this[_0xf983('0x3e')][_0x1941c6[_0xf983('0x65')]];}}}}catch(_0x3d0d46){logger[_0xf983('0x3c')](_0xf983('0x96'),util['inspect'](_0x3d0d46,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf983('0x3f')]['addVariable']=function(_0x834d6b,_0x2fe3ca,_0x3a12db){var _0x392a3f=[_0xf983('0x97'),_0xf983('0x98'),_0xf983('0x99'),_0xf983('0x9a'),_0xf983('0x9b'),_0xf983('0x9c'),'rtpaudioqosrtt','rtpaudioqosrttbridged',_0xf983('0x9d'),_0xf983('0x9e'),_0xf983('0x9f'),'bridgepvtcallid',_0xf983('0xa0'),_0xf983('0xa1'),'memberinterface','memberlastcall','membername','memberpenalty',_0xf983('0xa2')];if(!_[_0xf983('0x36')](_0x2fe3ca)&&!_[_0xf983('0xa3')](_0x392a3f,_0x2fe3ca)){if(_[_0xf983('0x2b')](this[_0xf983('0x3e')][_0x834d6b])){this[_0xf983('0x3e')][_0x834d6b]={};}this[_0xf983('0x3e')][_0x834d6b][_0x2fe3ca]=_0x3a12db;}};VoiceQueueReport[_0xf983('0x3f')]['syncHangup']=function(_0x50aadf){try{if(this[_0xf983('0x5a')](_0x50aadf)){if(this['queueReports'][_0x50aadf['uniqueid']]){for(var _0x29964b=0x0,_0x2ec0e2={};_0x29964b0x0?_0x4b0d58:0x0;this[_0xbe26('0x43')][_0x2c63ae['queue']][_0xbe26('0x33')]=this['voiceQueues'][_0x2c63ae['queue']][_0xbe26('0x33')]>_[_0xbe26('0x67')](_0x2c63ae[_0xbe26('0x68')])?_[_0xbe26('0x67')](_0x2c63ae['loggedin']):this[_0xbe26('0x43')][_0x2c63ae['queue']][_0xbe26('0x33')];this[_0xbe26('0x50')](this['voiceQueues'][_0x2c63ae[_0xbe26('0x64')]]);}ami[_0xbe26('0x47')](_0xbe26('0x69'),this[_0xbe26('0x43')][_0x2c63ae['queue']]);}}}catch(_0x5ebd42){logger[_0xbe26('0x3c')](_0xbe26('0x6a'),util[_0xbe26('0x46')](_0x5ebd42,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbe26('0xe')][_0xbe26('0x1c')]=function(_0x14f9ca){this[_0xbe26('0x16')]=!![];};VoiceQueueReport['prototype'][_0xbe26('0x6b')]=function(_0x3db0a3){};VoiceQueueReport[_0xbe26('0xe')]['syncQueueCallerJoin']=function(_0x59d459){try{if(this[_0xbe26('0x63')](_0x59d459)){if(_[_0xbe26('0x2f')](this[_0xbe26('0x12')][_0x59d459[_0xbe26('0x6c')]])){this[_0xbe26('0x12')][_0x59d459[_0xbe26('0x6c')]]=[];this[_0xbe26('0x14')][_0x59d459['uniqueid']]={};}var _0xc8e5da=new QueueReport();_0xc8e5da[_0xbe26('0x4a')]=_0x59d459[_0xbe26('0x64')];_0xc8e5da[_0xbe26('0x51')]=this[_0xbe26('0x43')][_0xc8e5da['name']]&&this[_0xbe26('0x43')][_0xc8e5da['name']][_0xbe26('0x51')]?this[_0xbe26('0x43')][_0xc8e5da['name']][_0xbe26('0x51')]||'inbound':_0xbe26('0x6d');_0xc8e5da['queue']=_0x59d459[_0xbe26('0x64')];_0xc8e5da[_0xbe26('0x6e')]=moment()[_0xbe26('0x4e')](_0xbe26('0x6f'));_0xc8e5da['position']=_0x59d459[_0xbe26('0x70')];_0xc8e5da['count']=_0x59d459[_0xbe26('0x71')];_[_0xbe26('0x72')](_0xc8e5da,_[_0xbe26('0x73')](_0x59d459,_[_0xbe26('0x74')](_0xc8e5da)));this[_0xbe26('0x12')][_0x59d459[_0xbe26('0x6c')]][_0xbe26('0x75')](_0xc8e5da);this[_0xbe26('0x14')][_0x59d459[_0xbe26('0x6c')]]=_0xc8e5da;this['emitVoiceQueueChannelSave'](_0xc8e5da);}}catch(_0x1bfba6){logger[_0xbe26('0x3c')](_0xbe26('0x76'),util['inspect'](_0x1bfba6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbe26('0xe')]['syncQueueCallerAbandon']=function(_0x1bcadf){try{if(this[_0xbe26('0x63')](_0x1bcadf)){if(this[_0xbe26('0x12')][_0x1bcadf['uniqueid']]){var _0x3efaa2=_[_0xbe26('0x77')](this[_0xbe26('0x12')][_0x1bcadf[_0xbe26('0x6c')]]);_0x3efaa2[_0xbe26('0x78')]=![];_0x3efaa2['queuecallercompleteAt']=null;_0x3efaa2['holdtime']=_0x1bcadf[_0xbe26('0x79')];_0x3efaa2[_0xbe26('0x7a')]=_0x1bcadf[_0xbe26('0x7a')];_0x3efaa2['queuecallerabandon']=!![];_0x3efaa2['queuecallerabandonAt']=moment()[_0xbe26('0x4e')](_0xbe26('0x6f'));_0x3efaa2[_0xbe26('0x7b')]='ABANDONED';_0x3efaa2[_0xbe26('0x7c')]=null;this[_0xbe26('0x14')][_0x1bcadf[_0xbe26('0x6c')]]=_0x3efaa2;this[_0xbe26('0x45')](_0x3efaa2);}}}catch(_0x579484){logger['error']('[syncQueueCallerAbandon][VoiceQueueReport]',util[_0xbe26('0x46')](_0x579484,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbe26('0xe')][_0xbe26('0x22')]=function(_0x57429c){try{if(this[_0xbe26('0x63')](_0x57429c)){if(this['queueReports'][_0x57429c[_0xbe26('0x6c')]]){var _0x48677f=_['last'](this[_0xbe26('0x12')][_0x57429c[_0xbe26('0x6c')]]);_0x48677f[_0xbe26('0x7d')]=moment()['format'](_0xbe26('0x6f'));_0x48677f[_0xbe26('0x7e')]=_0x57429c[_0xbe26('0x7e')];_0x48677f[_0xbe26('0x7f')]=_0x57429c[_0xbe26('0x7f')];this[_0xbe26('0x14')][_0x57429c[_0xbe26('0x6c')]]=_0x48677f;this[_0xbe26('0x48')](_0x48677f);}}}catch(_0x3a944b){logger['error'](_0xbe26('0x80'),util[_0xbe26('0x46')](_0x3a944b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbe26('0xe')]['syncAgentConnect']=function(_0x413089){try{if(this[_0xbe26('0x63')](_0x413089)){if(this[_0xbe26('0x12')][_0x413089['uniqueid']]){var _0x4ba21b=_[_0xbe26('0x77')](this[_0xbe26('0x12')][_0x413089['uniqueid']]);_0x4ba21b['queuecallercomplete']=!![];_0x4ba21b['queuecallerexitreason']=_0xbe26('0x81');}}}catch(_0x3991c6){logger[_0xbe26('0x3c')](_0xbe26('0x82'),util[_0xbe26('0x46')](_0x3991c6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbe26('0xe')]['syncAgentComplete']=function(_0x83578c){try{if(this[_0xbe26('0x63')](_0x83578c)){if(this[_0xbe26('0x12')][_0x83578c[_0xbe26('0x6c')]]){var _0x480b41=_[_0xbe26('0x77')](this[_0xbe26('0x12')][_0x83578c[_0xbe26('0x6c')]]);_0x480b41[_0xbe26('0x1f')]=![];_0x480b41[_0xbe26('0x83')]=null;_0x480b41[_0xbe26('0x84')]=!![];_0x480b41[_0xbe26('0x7c')]=_0x83578c[_0xbe26('0x85')];_0x480b41[_0xbe26('0x79')]=_0x83578c[_0xbe26('0x79')];_0x480b41[_0xbe26('0x78')]=!![];_0x480b41[_0xbe26('0x86')]=![];_0x480b41[_0xbe26('0x87')]=null;if(!_0x480b41[_0xbe26('0x88')]){if(_0x83578c[_0xbe26('0x89')]==_0xbe26('0x88')){_0x480b41[_0xbe26('0x7b')]=_0xbe26('0x8a');}else{if(_[_0xbe26('0x8b')](_0x83578c[_0xbe26('0x38')][_0xbe26('0x8c')](),_0xbe26('0x8d'))){if(this[_0xbe26('0x12')][_0x83578c[_0xbe26('0x8e')]]){var _0x11db24=_[_0xbe26('0x77')](this[_0xbe26('0x12')][_0x83578c[_0xbe26('0x8e')]]);_0x11db24[_0xbe26('0x78')]=![];_0x11db24[_0xbe26('0x86')]=!![];_0x11db24[_0xbe26('0x87')]=moment(_0x480b41[_0xbe26('0x6e')])['add'](_0x83578c['holdtime'],_0xbe26('0x8f'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x11db24[_0xbe26('0x7b')]=_0xbe26('0x90');_0x11db24[_0xbe26('0x88')]=!![];_0x11db24[_0xbe26('0x91')]=_0xbe26('0x92');_0x11db24['transferexten']=_0x83578c[_0xbe26('0x93')];_0x11db24[_0xbe26('0x94')]=_0x83578c[_0xbe26('0x6c')];var _0x5a8384=this['queueReports'][_0x83578c[_0xbe26('0x8e')]];this[_0xbe26('0x12')][_0x83578c[_0xbe26('0x8e')]]=this['queueReports'][_0x83578c[_0xbe26('0x6c')]];this[_0xbe26('0x12')][_0x83578c[_0xbe26('0x6c')]]=_0x5a8384;}}else{_0x480b41[_0xbe26('0x7b')]=_0xbe26('0x95')+_0x83578c[_0xbe26('0x89')][_0xbe26('0x96')]();}}}this['channels'][_0x83578c[_0xbe26('0x6c')]]=_0x480b41;this[_0xbe26('0x45')](_0x480b41);}}}catch(_0x59f1e7){logger['error'](_0xbe26('0x97'),util[_0xbe26('0x46')](_0x59f1e7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbe26('0xe')][_0xbe26('0x27')]=function(_0xaa7c2c){try{if(this[_0xbe26('0x63')](_0xaa7c2c)){this[_0xbe26('0x98')](_0xaa7c2c[_0xbe26('0x6c')],_['keys'](_0xaa7c2c[_0xbe26('0x99')])[0x0],_0xaa7c2c[_0xbe26('0x9a')]);if(this[_0xbe26('0x12')][_0xaa7c2c['uniqueid']]){var _0x1e8172=_[_0xbe26('0x77')](this[_0xbe26('0x12')][_0xaa7c2c['uniqueid']]);if(_0x1e8172){if(this['isNotNull'](_0xaa7c2c[_0xbe26('0x99')])&&this[_0xbe26('0x63')](_0xaa7c2c[_0xbe26('0x99')][_0xbe26('0x9b')])){switch(_0xaa7c2c[_0xbe26('0x9a')]){case'CONTINUE':_0x1e8172[_0xbe26('0x86')]=![];_0x1e8172[_0xbe26('0x87')]=null;break;default:_0x1e8172[_0xbe26('0x86')]=!![];_0x1e8172[_0xbe26('0x87')]=moment()[_0xbe26('0x4e')](_0xbe26('0x6f'));_0x1e8172[_0xbe26('0x7d')]=moment()[_0xbe26('0x4e')](_0xbe26('0x6f'));}_0x1e8172[_0xbe26('0x1f')]=![];_0x1e8172[_0xbe26('0x83')]=null;_0x1e8172['queuecallerexitreason']=_0xaa7c2c[_0xbe26('0x9a')];this[_0xbe26('0x14')][_0xaa7c2c[_0xbe26('0x6c')]]=_0x1e8172;this['emitVoiceQueueChannelRemove'](_0x1e8172);}else if(this[_0xbe26('0x63')](_0xaa7c2c['variable'])&&this[_0xbe26('0x63')](_0xaa7c2c[_0xbe26('0x99')][_0xbe26('0x9c')])){if(!_0x1e8172['queuecallerabandon']){_0x1e8172[_0xbe26('0x86')]=!![];_0x1e8172[_0xbe26('0x87')]=moment()[_0xbe26('0x4e')](_0xbe26('0x6f'));_0x1e8172['queuecallerexitreason']='EXITWITHKEY';_0x1e8172[_0xbe26('0x7d')]=moment()[_0xbe26('0x4e')](_0xbe26('0x6f'));this['channels'][_0xaa7c2c['uniqueid']]=_0x1e8172;}}_0x1e8172[_0xbe26('0x17')]=this[_0xbe26('0x17')][_0xaa7c2c[_0xbe26('0x6c')]];}}}}catch(_0x511c1c){logger['error']('[syncVarSet][VoiceQueueReport]',util['inspect'](_0x511c1c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbe26('0xe')][_0xbe26('0x98')]=function(_0x4dcad6,_0x2bd6c1,_0x42a81f){var _0x86c680=[_0xbe26('0x9d'),'rtpaudioqosbridged',_0xbe26('0x9e'),_0xbe26('0x9f'),_0xbe26('0xa0'),_0xbe26('0xa1'),_0xbe26('0xa2'),_0xbe26('0xa3'),_0xbe26('0xa4'),_0xbe26('0xa5'),_0xbe26('0xa6'),_0xbe26('0xa7'),_0xbe26('0xa8'),_0xbe26('0xa9'),_0xbe26('0xaa'),'memberlastcall',_0xbe26('0x85'),_0xbe26('0xab'),'memberrealtime'];if(!_[_0xbe26('0x37')](_0x2bd6c1)&&!_[_0xbe26('0xac')](_0x86c680,_0x2bd6c1)){if(_[_0xbe26('0x2f')](this[_0xbe26('0x17')][_0x4dcad6])){this['variables'][_0x4dcad6]={};}this[_0xbe26('0x17')][_0x4dcad6][_0x2bd6c1]=_0x42a81f;}};VoiceQueueReport[_0xbe26('0xe')][_0xbe26('0x29')]=function(_0x278925){try{if(this[_0xbe26('0x63')](_0x278925)){if(this[_0xbe26('0x12')][_0x278925['uniqueid']]){for(var _0x59bd4e=0x0,_0x328a9e={};_0x59bd4e=0x0?moment(_0x5728ef['endtime'])[_0x4cd6('0xc')](_0x5728ef[_0x4cd6('0x18')],_0x4cd6('0x19')):null,'data1':'outbound','data2':_0x5728ef[_0x4cd6('0x11')],'data3':_0x5728ef['exten'],'data4':_0x5728ef[_0x4cd6('0x1a')]||null,'role':_0x4cd6('0x10'),'internal':_0x5728ef[_0x4cd6('0x11')]?_[_0x4cd6('0x12')](_0x5728ef[_0x4cd6('0x11')]):undefined,'uniqueid':_0x5728ef[_0x4cd6('0x13')]},'log':_0x4cd6('0x16')});}; \ No newline at end of file +var _0xbd8b=['format','SIP/%s','queuecallerleaveAt','calleridnum','queue','agent','accountcode','toNumber','membername','TALKING','starttime','endtime','diff','seconds','outbound','exten','dialstring','uniqueid','moment','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','isNil','interface'];(function(_0xa2413,_0x341b39){var _0x329ce7=function(_0xed206a){while(--_0xed206a){_0xa2413['push'](_0xa2413['shift']());}};_0x329ce7(++_0x341b39);}(_0xbd8b,0xeb));var _0xbbd8=function(_0x34bc74,_0x324371){_0x34bc74=_0x34bc74-0x0;var _0x5945dd=_0xbd8b[_0x34bc74];return _0x5945dd;};'use strict';var moment=require(_0xbbd8('0x0'));var _=require(_0xbbd8('0x1'));var util=require(_0xbbd8('0x2'));var client=require(_0xbbd8('0x3'));exports[_0xbbd8('0x4')]=function(_0x3530f0){var _0x1e1f8e=_0x3530f0[_0xbbd8('0x5')]||_0x3530f0[_0xbbd8('0x6')];return client[_0xbbd8('0x7')](_0xbbd8('0x8'),{'body':{'channel':_0xbbd8('0x9'),'membername':_0x3530f0[_0xbbd8('0xa')],'interface':_[_0xbbd8('0xb')](_0x3530f0[_0xbbd8('0xc')])?util[_0xbbd8('0xd')](_0xbbd8('0xe'),_0x3530f0['lastAssignedTo']):_0x3530f0[_0xbbd8('0xc')],'type':'TALKING','enterAt':_0x3530f0[_0xbbd8('0xf')],'exitAt':_0x1e1f8e,'duration':moment(_0x1e1f8e)['diff'](_0x3530f0[_0xbbd8('0xf')],'seconds'),'data1':'inbound','data2':_0x3530f0[_0xbbd8('0x10')],'data3':_0x3530f0['exten'],'data4':null,'data5':_0x3530f0[_0xbbd8('0x11')],'role':_0xbbd8('0x12'),'internal':_0x3530f0[_0xbbd8('0x13')]?_[_0xbbd8('0x14')](_0x3530f0[_0xbbd8('0x13')]):undefined,'uniqueid':_0x3530f0['uniqueid']},'log':_0xbbd8('0x8')});};exports['voiceDialReport']=function(_0xfce6a5){return client[_0xbbd8('0x7')](_0xbbd8('0x8'),{'body':{'channel':'voice','membername':_0xfce6a5[_0xbbd8('0x15')],'interface':_0xfce6a5[_0xbbd8('0xc')],'type':_0xbbd8('0x16'),'enterAt':_0xfce6a5[_0xbbd8('0x17')],'exitAt':_0xfce6a5[_0xbbd8('0x18')],'duration':moment(_0xfce6a5[_0xbbd8('0x18')])[_0xbbd8('0x19')](_0xfce6a5['starttime'],_0xbbd8('0x1a'))>=0x0?moment(_0xfce6a5[_0xbbd8('0x18')])[_0xbbd8('0x19')](_0xfce6a5[_0xbbd8('0x17')],'seconds'):null,'data1':_0xbbd8('0x1b'),'data2':_0xfce6a5[_0xbbd8('0x13')],'data3':_0xfce6a5[_0xbbd8('0x1c')],'data4':_0xfce6a5[_0xbbd8('0x1d')]||null,'role':_0xbbd8('0x12'),'internal':_0xfce6a5[_0xbbd8('0x13')]?_[_0xbbd8('0x14')](_0xfce6a5['accountcode']):undefined,'uniqueid':_0xfce6a5[_0xbbd8('0x1e')]},'log':_0xbbd8('0x8')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 2495d87..cb8edd4 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 _0x6b20=['getTemplates','GetTemplate','name','html','../client'];(function(_0x4022a4,_0x6600e4){var _0x297d12=function(_0x4cb8a1){while(--_0x4cb8a1){_0x4022a4['push'](_0x4022a4['shift']());}};_0x297d12(++_0x6600e4);}(_0x6b20,0xd1));var _0x06b2=function(_0x1c5bdd,_0x88e54f){_0x1c5bdd=_0x1c5bdd-0x0;var _0x5af61b=_0x6b20[_0x1c5bdd];return _0x5af61b;};'use strict';var client=require(_0x06b2('0x0'));exports[_0x06b2('0x1')]=function(_0x52753b){return function(_0x2d5e24){return client['Request'](_0x06b2('0x2'),{'options':{'raw':!![],'attributes':['id',_0x06b2('0x3'),_0x06b2('0x4')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0xd64b=['GetTemplate','name','html','../client','Request'];(function(_0x222ac3,_0x36ee56){var _0x27bc3c=function(_0x2a80d0){while(--_0x2a80d0){_0x222ac3['push'](_0x222ac3['shift']());}};_0x27bc3c(++_0x36ee56);}(_0xd64b,0xc1));var _0xbd64=function(_0x3ccc5f,_0x17ba72){_0x3ccc5f=_0x3ccc5f-0x0;var _0x15de37=_0xd64b[_0x3ccc5f];return _0x15de37;};'use strict';var client=require(_0xbd64('0x0'));exports['getTemplates']=function(_0xf0de04){return function(_0x4bfb7c){return client[_0xbd64('0x1')](_0xbd64('0x2'),{'options':{'raw':!![],'attributes':['id',_0xbd64('0x3'),_0xbd64('0x4')]},'log':_0xbd64('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 4d2b4fc..98efe0e 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 _0x5bbc=['../client','Request','GetTrigger','name','status','Condition','AllConditions','field','operator','value','AnyConditions','Action','Actions','data1','data2','data4','data5','data6'];(function(_0x2b94f7,_0x347a9b){var _0x4930a9=function(_0x2e1a9a){while(--_0x2e1a9a){_0x2b94f7['push'](_0x2b94f7['shift']());}};_0x4930a9(++_0x347a9b);}(_0x5bbc,0x1d4));var _0xc5bb=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x5bbc[_0x501510];return _0x1e6ee5;};'use strict';var client=require(_0xc5bb('0x0'));exports['getTriggers']=function(_0x5ad028){return function(_0x28bdad){return client[_0xc5bb('0x1')](_0xc5bb('0x2'),{'options':{'raw':![],'attributes':['id',_0xc5bb('0x3'),'channel',_0xc5bb('0x4')],'include':[{'model':_0xc5bb('0x5'),'as':_0xc5bb('0x6'),'attributes':['id',_0xc5bb('0x7'),_0xc5bb('0x8'),_0xc5bb('0x9')]},{'model':_0xc5bb('0x5'),'as':_0xc5bb('0xa'),'attributes':['id',_0xc5bb('0x7'),'operator',_0xc5bb('0x9')]},{'model':_0xc5bb('0xb'),'as':_0xc5bb('0xc'),'attributes':['id','action',_0xc5bb('0xd'),_0xc5bb('0xe'),'data3',_0xc5bb('0xf'),_0xc5bb('0x10'),_0xc5bb('0x11'),'data7']}]},'log':_0xc5bb('0x2')});};}; \ No newline at end of file +var _0x6180=['data4','data5','data6','data7','../client','getTriggers','Request','GetTrigger','channel','status','Condition','AllConditions','field','operator','value','AnyConditions','Action','action','data2','data3'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x6180,0x1d0));var _0x0618=function(_0x37d225,_0x2ed664){_0x37d225=_0x37d225-0x0;var _0x26834b=_0x6180[_0x37d225];return _0x26834b;};'use strict';var client=require(_0x0618('0x0'));exports[_0x0618('0x1')]=function(_0x2f2fec){return function(_0x1256ce){return client[_0x0618('0x2')](_0x0618('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x0618('0x4'),_0x0618('0x5')],'include':[{'model':_0x0618('0x6'),'as':_0x0618('0x7'),'attributes':['id',_0x0618('0x8'),_0x0618('0x9'),_0x0618('0xa')]},{'model':'Condition','as':_0x0618('0xb'),'attributes':['id',_0x0618('0x8'),_0x0618('0x9'),_0x0618('0xa')]},{'model':_0x0618('0xc'),'as':'Actions','attributes':['id',_0x0618('0xd'),'data1',_0x0618('0xe'),_0x0618('0xf'),_0x0618('0x10'),_0x0618('0x11'),_0x0618('0x12'),_0x0618('0x13')]}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 94edc54..3303f52 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 _0x8c40=['GetTrunk','name','registry','../client','getTrunks','Request'];(function(_0x213e4a,_0x1aa010){var _0x51edce=function(_0x2830c2){while(--_0x2830c2){_0x213e4a['push'](_0x213e4a['shift']());}};_0x51edce(++_0x1aa010);}(_0x8c40,0x171));var _0x08c4=function(_0x46ec71,_0x31a856){_0x46ec71=_0x46ec71-0x0;var _0xbfd10=_0x8c40[_0x46ec71];return _0xbfd10;};'use strict';var client=require(_0x08c4('0x0'));exports[_0x08c4('0x1')]=function(_0x115f78){return function(_0x10ad91){return client[_0x08c4('0x2')](_0x08c4('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x08c4('0x4'),_0x08c4('0x5')]},'log':_0x08c4('0x3')});};}; \ No newline at end of file +var _0x6c28=['registry','../client','GetTrunk','name'];(function(_0x3926a5,_0x3fd455){var _0x443596=function(_0x3d316e){while(--_0x3d316e){_0x3926a5['push'](_0x3926a5['shift']());}};_0x443596(++_0x3fd455);}(_0x6c28,0x109));var _0x86c2=function(_0xf82956,_0x32f267){_0xf82956=_0xf82956-0x0;var _0x4d98f1=_0x6c28[_0xf82956];return _0x4d98f1;};'use strict';var client=require(_0x86c2('0x0'));exports['getTrunks']=function(_0x16960b){return function(_0x4cd952){return client['Request'](_0x86c2('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x86c2('0x2'),_0x86c2('0x3')]},'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 f0b540a..948125b 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 _0x32de=['online','lastLoginAt','pauseType','voicePause','phone','mobile','getAgents','name','accountcode','savePause','PauseUser','saveUnpause','getAgent','ShowUser','agent','interface','../client','Request','GetUser','email','fullname'];(function(_0x2306df,_0x168598){var _0x5c433a=function(_0x43cd4d){while(--_0x43cd4d){_0x2306df['push'](_0x2306df['shift']());}};_0x5c433a(++_0x168598);}(_0x32de,0x1f3));var _0xe32d=function(_0x1f2f61,_0x586f2f){_0x1f2f61=_0x1f2f61-0x0;var _0x10dabc=_0x32de[_0x1f2f61];return _0x10dabc;};'use strict';var client=require(_0xe32d('0x0'));exports['getAgents']=function(){return function(){return client[_0xe32d('0x1')](_0xe32d('0x2'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id','name',_0xe32d('0x3'),'accountcode',_0xe32d('0x4'),_0xe32d('0x5'),_0xe32d('0x6'),_0xe32d('0x7'),'lastPauseAt',_0xe32d('0x8'),_0xe32d('0x9'),_0xe32d('0xa'),'interface']},'log':_0xe32d('0xb')});};};exports['getTelephones']=function(){return function(){return client['Request'](_0xe32d('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0xe32d('0xc'),_0xe32d('0xd'),'internal']},'log':'getTelephones'});};};exports[_0xe32d('0xe')]=function(_0x3354e4,_0x1a04da,_0xc581bc){return client['Request'](_0xe32d('0xf'),{'body':{'type':_0x1a04da,'uniqueid':_0xc581bc},'options':{'where':{'id':_0x3354e4['id']}},'log':_0xe32d('0xe')});};exports[_0xe32d('0x10')]=function(_0xc3f5b7){return client[_0xe32d('0x1')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0xc3f5b7['id']}},'log':_0xe32d('0xe')});};exports[_0xe32d('0x11')]=function(_0x1d96d9){return client[_0xe32d('0x1')](_0xe32d('0x12'),{'options':{'raw':![],'where':{'role':_0xe32d('0x13'),'id':_0x1d96d9},'attributes':['id',_0xe32d('0xc'),_0xe32d('0x3'),_0xe32d('0xd'),_0xe32d('0x4'),'online',_0xe32d('0x6'),'pauseType','lastPauseAt',_0xe32d('0x8'),_0xe32d('0x14')]},'log':_0xe32d('0x11')});}; \ No newline at end of file +var _0x6947=['name','email','accountcode','fullname','online','pauseType','lastPauseAt','phone','mobile','interface','telephone','getTelephones','savePause','Request','saveUnpause','getAgent','ShowUser','voicePause','../client','getAgents','GetUser','agent'];(function(_0xd8b84c,_0x2e6222){var _0x5b9c23=function(_0x2d26b4){while(--_0x2d26b4){_0xd8b84c['push'](_0xd8b84c['shift']());}};_0x5b9c23(++_0x2e6222);}(_0x6947,0x80));var _0x7694=function(_0x523e52,_0x3279cb){_0x523e52=_0x523e52-0x0;var _0x4e6de1=_0x6947[_0x523e52];return _0x4e6de1;};'use strict';var client=require(_0x7694('0x0'));exports[_0x7694('0x1')]=function(){return function(){return client['Request'](_0x7694('0x2'),{'options':{'raw':![],'where':{'role':_0x7694('0x3')},'attributes':['id',_0x7694('0x4'),_0x7694('0x5'),_0x7694('0x6'),_0x7694('0x7'),_0x7694('0x8'),'lastLoginAt',_0x7694('0x9'),_0x7694('0xa'),'voicePause',_0x7694('0xb'),_0x7694('0xc'),_0x7694('0xd')]},'log':_0x7694('0x1')});};};exports['getTelephones']=function(){return function(){return client['Request'](_0x7694('0x2'),{'options':{'raw':!![],'where':{'role':_0x7694('0xe')},'attributes':['id',_0x7694('0x4'),_0x7694('0x6'),'internal']},'log':_0x7694('0xf')});};};exports[_0x7694('0x10')]=function(_0x3bb1f1,_0x587084,_0x5aa8cd){return client[_0x7694('0x11')]('PauseUser',{'body':{'type':_0x587084,'uniqueid':_0x5aa8cd},'options':{'where':{'id':_0x3bb1f1['id']}},'log':_0x7694('0x10')});};exports[_0x7694('0x12')]=function(_0xdaf2c8){return client['Request']('UnpauseUser',{'body':{},'options':{'where':{'id':_0xdaf2c8['id']}},'log':_0x7694('0x10')});};exports[_0x7694('0x13')]=function(_0x5be173){return client['Request'](_0x7694('0x14'),{'options':{'raw':![],'where':{'role':_0x7694('0x3'),'id':_0x5be173},'attributes':['id',_0x7694('0x4'),_0x7694('0x5'),_0x7694('0x6'),'fullname',_0x7694('0x8'),'lastLoginAt',_0x7694('0x9'),_0x7694('0xa'),_0x7694('0x15'),'interface']},'log':_0x7694('0x13')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 3eb9580..560c277 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 _0x32d3=['create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client'];(function(_0x4dbdda,_0x11f07c){var _0x1acbf1=function(_0x1a9fc8){while(--_0x1a9fc8){_0x4dbdda['push'](_0x4dbdda['shift']());}};_0x1acbf1(++_0x11f07c);}(_0x32d3,0xbf));var _0x332d=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x32d3[_0x3b380d];return _0x54502b;};'use strict';var client=require(_0x332d('0x0'));exports[_0x332d('0x1')]=function(_0x5c1330){return client[_0x332d('0x2')](_0x332d('0x3'),{'body':_0x5c1330,'log':_0x332d('0x3')});};exports[_0x332d('0x4')]=function(_0x2cd22b,_0x395ac6,_0x323ac0){return client[_0x332d('0x2')](_0x332d('0x5'),{'body':_0x2cd22b,'options':{'where':{'uniqueid':_0x395ac6,'interface':_0x323ac0,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0x2af4=['CreateVoiceAgentReport','update','Request','UpdateVoiceAgentReport','create'];(function(_0x585e40,_0xf069b9){var _0x3a6999=function(_0x51dff2){while(--_0x51dff2){_0x585e40['push'](_0x585e40['shift']());}};_0x3a6999(++_0xf069b9);}(_0x2af4,0x1e4));var _0x42af=function(_0x5dab66,_0x3f5096){_0x5dab66=_0x5dab66-0x0;var _0x2aeaff=_0x2af4[_0x5dab66];return _0x2aeaff;};'use strict';var client=require('../client');exports[_0x42af('0x0')]=function(_0x2eb5a1){return client['Request'](_0x42af('0x1'),{'body':_0x2eb5a1,'log':'CreateVoiceAgentReport'});};exports[_0x42af('0x2')]=function(_0x2e8431,_0x528486,_0x5b7bcd){return client[_0x42af('0x3')](_0x42af('0x4'),{'body':_0x2e8431,'options':{'where':{'uniqueid':_0x528486,'interface':_0x5b7bcd,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index ca04265..c5cc3db 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 _0xad25=['GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','GetVoiceCallReports','moment','util','lodash','CreateVoiceCallReport','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','Request'];(function(_0x3f83ca,_0x387f48){var _0x3efad9=function(_0x53f5ab){while(--_0x53f5ab){_0x3f83ca['push'](_0x3f83ca['shift']());}};_0x3efad9(++_0x387f48);}(_0xad25,0x6e));var _0x5ad2=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xad25[_0x4c12ec];return _0x3ae42c;};'use strict';var moment=require(_0x5ad2('0x0'));var util=require(_0x5ad2('0x1'));var _=require(_0x5ad2('0x2'));var client=require('../client');exports['create']=function(_0x246487){return client['Request'](_0x5ad2('0x3'),{'body':_['merge'](_0x246487,{'source':_0x246487[_0x5ad2('0x4')],'destinationcontext':_0x246487[_0x5ad2('0x5')],'callerid':_0x246487[_0x5ad2('0x6')],'amaflags':_0x5ad2('0x7')}),'log':_0x5ad2('0x3')});};exports[_0x5ad2('0x8')]=function(){return function(){return client[_0x5ad2('0x9')](_0x5ad2('0xa'),{'options':{'where':{'type':[_0x5ad2('0xb')],'createdAt':{'$between':[moment()[_0x5ad2('0xc')](_0x5ad2('0xd'))[_0x5ad2('0xe')](_0x5ad2('0xf')),moment()['endOf'](_0x5ad2('0xd'))[_0x5ad2('0xe')](_0x5ad2('0xf'))]}},'attributes':[_0x5ad2('0x10'),_0x5ad2('0x11'),_0x5ad2('0x12'),'billableseconds']},'log':_0x5ad2('0x13')});};}; \ No newline at end of file +var _0x5219=['GetVoiceCallReport','outbound','startOf','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','type','duration','billableseconds','GetVoiceCallReports','moment','util','../client','create','Request','CreateVoiceCallReport','merge','DOCUMENTATION','getVoiceCallReports'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x5219,0x14b));var _0x9521=function(_0xa74c56,_0x5cacb0){_0xa74c56=_0xa74c56-0x0;var _0x275cf1=_0x5219[_0xa74c56];return _0x275cf1;};'use strict';var moment=require(_0x9521('0x0'));var util=require(_0x9521('0x1'));var _=require('lodash');var client=require(_0x9521('0x2'));exports[_0x9521('0x3')]=function(_0x4cd3ef){return client[_0x9521('0x4')](_0x9521('0x5'),{'body':_[_0x9521('0x6')](_0x4cd3ef,{'source':_0x4cd3ef['calleridnum'],'destinationcontext':_0x4cd3ef['context'],'callerid':_0x4cd3ef['callerid'],'amaflags':_0x9521('0x7')}),'log':_0x9521('0x5')});};exports[_0x9521('0x8')]=function(){return function(){return client[_0x9521('0x4')](_0x9521('0x9'),{'options':{'where':{'type':[_0x9521('0xa')],'createdAt':{'$between':[moment()[_0x9521('0xb')](_0x9521('0xc'))[_0x9521('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x9521('0xe')]('day')['format'](_0x9521('0xf'))]}},'attributes':[_0x9521('0x10'),'disposition',_0x9521('0x11'),_0x9521('0x12')]},'log':_0x9521('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 293b3b5..5eb7581 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 _0xf876=['create','Request','CreateVoiceDialReport','../client'];(function(_0x46bdee,_0x3c3738){var _0x5a3fae=function(_0x255ed8){while(--_0x255ed8){_0x46bdee['push'](_0x46bdee['shift']());}};_0x5a3fae(++_0x3c3738);}(_0xf876,0x15b));var _0x6f87=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xf876[_0x36dfbd];return _0x4ecad9;};'use strict';var client=require(_0x6f87('0x0'));exports[_0x6f87('0x1')]=function(_0x47758e){return client[_0x6f87('0x2')](_0x6f87('0x3'),{'body':_0x47758e,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0xf83e=['Request','CreateVoiceDialReport','../client','create'];(function(_0x349dc1,_0x76e8c5){var _0x16732d=function(_0x46bf85){while(--_0x46bf85){_0x349dc1['push'](_0x349dc1['shift']());}};_0x16732d(++_0x76e8c5);}(_0xf83e,0x196));var _0xef83=function(_0x4517cf,_0x3aaaca){_0x4517cf=_0x4517cf-0x0;var _0x408bf4=_0xf83e[_0x4517cf];return _0x408bf4;};'use strict';var client=require(_0xef83('0x0'));exports[_0xef83('0x1')]=function(_0x53cf0d){return client[_0xef83('0x2')]('CreateVoiceDialReport',{'body':_0x53cf0d,'log':_0xef83('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index a40bd53..f3c528a 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 _0x6268=['exten','recordingFormat','getVoiceExtensions','../client','Request'];(function(_0x2c2980,_0x34282a){var _0x2a20a9=function(_0x537b18){while(--_0x537b18){_0x2c2980['push'](_0x2c2980['shift']());}};_0x2a20a9(++_0x34282a);}(_0x6268,0x193));var _0x8626=function(_0x504f1b,_0xa7c15f){_0x504f1b=_0x504f1b-0x0;var _0x49ce80=_0x6268[_0x504f1b];return _0x49ce80;};'use strict';var client=require(_0x8626('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0x8626('0x1')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x8626('0x2'),_0x8626('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x8626('0x4')});};}; \ No newline at end of file +var _0xf1a7=['GetVoiceExtension','exten','recordingFormat','getVoiceExtensions'];(function(_0x3a9fdb,_0x205d53){var _0x18fc17=function(_0x489f1d){while(--_0x489f1d){_0x3a9fdb['push'](_0x3a9fdb['shift']());}};_0x18fc17(++_0x205d53);}(_0xf1a7,0x8f));var _0x7f1a=function(_0xd12079,_0x353401){_0xd12079=_0xd12079-0x0;var _0x18ca2a=_0xf1a7[_0xd12079];return _0x18ca2a;};'use strict';var client=require('../client');exports[_0x7f1a('0x0')]=function(){return function(){return client['Request'](_0x7f1a('0x1'),{'options':{'raw':!![],'attributes':['id',_0x7f1a('0x2'),_0x7f1a('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x7f1a('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index b10d7df..3e8f63c 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 _0x99c6=['dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','interval','../client','getVoiceQueues','Request','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout'];(function(_0x283104,_0x378ece){var _0x1f5844=function(_0x24e91a){while(--_0x24e91a){_0x283104['push'](_0x283104['shift']());}};_0x1f5844(++_0x378ece);}(_0x99c6,0x109));var _0x699c=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x99c6[_0x2d2c16];return _0x53f2fb;};'use strict';var client=require(_0x699c('0x0'));exports[_0x699c('0x1')]=function(){return function(){return client[_0x699c('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x699c('0x3'),_0x699c('0x4'),_0x699c('0x5'),_0x699c('0x6'),_0x699c('0x7'),_0x699c('0x8'),_0x699c('0x9'),_0x699c('0xa'),'dialLimitChannel',_0x699c('0xb'),_0x699c('0xc'),_0x699c('0xd'),_0x699c('0xe'),_0x699c('0xf'),_0x699c('0x10'),_0x699c('0x11'),_0x699c('0x12'),_0x699c('0x13'),'dialQueueTimeout',_0x699c('0x14'),_0x699c('0x15'),_0x699c('0x16'),_0x699c('0x17'),_0x699c('0x18'),_0x699c('0x19'),_0x699c('0x1a'),_0x699c('0x1b'),_0x699c('0x1c'),_0x699c('0x1d'),_0x699c('0x1e'),_0x699c('0x1f'),'dialAMDActive',_0x699c('0x20'),_0x699c('0x21'),_0x699c('0x22'),_0x699c('0x23'),'dialAMDMinWordLength','dialAMDBetweenWordsSilence',_0x699c('0x24'),_0x699c('0x25'),_0x699c('0x26'),_0x699c('0x27'),_0x699c('0x28'),_0x699c('0x29'),'dialOrderByScheduledAt',_0x699c('0x2a'),'dialAgiAfterHangupClient',_0x699c('0x2b'),'monitor_format','strategy',_0x699c('0x2c'),'dialCutDigit','dialNoSuchNumberMaxRetry',_0x699c('0x2d'),_0x699c('0x2e'),_0x699c('0x2f'),'dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency',_0x699c('0x30'),_0x699c('0x31'),_0x699c('0x32'),_0x699c('0x33'),_0x699c('0x34')],'include':[{'model':_0x699c('0x35'),'as':'Trunk','attributes':['id','name',_0x699c('0x36'),_0x699c('0x37')]},{'model':_0x699c('0x38'),'as':_0x699c('0x39'),'attributes':['id',_0x699c('0x3')]},{'model':_0x699c('0x35'),'as':_0x699c('0x3a'),'attributes':['id',_0x699c('0x3'),'callerid',_0x699c('0x37')]},{'model':_0x699c('0x3b'),'as':_0x699c('0x3b'),'attributes':['id','name'],'include':[{'model':_0x699c('0x3b'),'as':'Intervals','attributes':['id',_0x699c('0x3'),_0x699c('0x3c')]}]}]},'log':_0x699c('0x1')});};}; \ No newline at end of file +var _0x42ca=['Interval','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acwTimeout','autopause','monitor_format','type','dialActive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','Trunk','callerid','active','Pause','TrunkBackup'];(function(_0x4c906a,_0x196f4d){var _0x346df7=function(_0x418b03){while(--_0x418b03){_0x4c906a['push'](_0x4c906a['shift']());}};_0x346df7(++_0x196f4d);}(_0x42ca,0xbc));var _0xa42c=function(_0x2384bb,_0x39682f){_0x2384bb=_0x2384bb-0x0;var _0x299201=_0x42ca[_0x2384bb];return _0x299201;};'use strict';var client=require(_0xa42c('0x0'));exports[_0xa42c('0x1')]=function(){return function(){return client[_0xa42c('0x2')](_0xa42c('0x3'),{'options':{'raw':![],'attributes':['id',_0xa42c('0x4'),'acw',_0xa42c('0x5'),_0xa42c('0x6'),_0xa42c('0x7'),_0xa42c('0x8'),_0xa42c('0x9'),'dialMethod',_0xa42c('0xa'),_0xa42c('0xb'),_0xa42c('0xc'),_0xa42c('0xd'),_0xa42c('0xe'),_0xa42c('0xf'),_0xa42c('0x10'),_0xa42c('0x11'),_0xa42c('0x12'),_0xa42c('0x13'),_0xa42c('0x14'),_0xa42c('0x15'),'dialCongestionMaxRetry',_0xa42c('0x16'),_0xa42c('0x17'),_0xa42c('0x18'),_0xa42c('0x19'),_0xa42c('0x1a'),_0xa42c('0x1b'),'dialTimezone',_0xa42c('0x1c'),_0xa42c('0x1d'),'dialCheckDuplicateType',_0xa42c('0x1e'),'dialAMDInitialSilence','dialAMDGreeting',_0xa42c('0x1f'),_0xa42c('0x20'),_0xa42c('0x21'),_0xa42c('0x22'),_0xa42c('0x23'),_0xa42c('0x24'),_0xa42c('0x25'),_0xa42c('0x26'),_0xa42c('0x27'),_0xa42c('0x28'),_0xa42c('0x29'),_0xa42c('0x2a'),_0xa42c('0x2b'),'dialQueueProject2',_0xa42c('0x7'),_0xa42c('0x2c'),_0xa42c('0x2d'),_0xa42c('0x2e'),'dialNoSuchNumberMaxRetry',_0xa42c('0x2f'),_0xa42c('0x30'),_0xa42c('0x31'),'dialAbandonedMaxRetry',_0xa42c('0x32'),'dialMachineMaxRetry',_0xa42c('0x33'),'dialAgentRejectMaxRetry',_0xa42c('0x34'),_0xa42c('0x35'),_0xa42c('0x36'),'dialPredictiveIntervalMinThreshold'],'include':[{'model':_0xa42c('0x37'),'as':_0xa42c('0x37'),'attributes':['id',_0xa42c('0x4'),_0xa42c('0x38'),_0xa42c('0x39')]},{'model':_0xa42c('0x3a'),'as':'mandatoryDispositionPause','attributes':['id',_0xa42c('0x4')]},{'model':_0xa42c('0x37'),'as':_0xa42c('0x3b'),'attributes':['id',_0xa42c('0x4'),_0xa42c('0x38'),_0xa42c('0x39')]},{'model':'Interval','as':_0xa42c('0x3c'),'attributes':['id',_0xa42c('0x4')],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0xa42c('0x4'),_0xa42c('0x3d')]}]}]},'log':_0xa42c('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index f8dc3b8..1b8b1b0 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 _0x9b49=['queuecallerjoinAt','queuecallerleaveAt','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','moment','lodash','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','queue'];(function(_0xfaccef,_0x147839){var _0x2dcc8a=function(_0x52248d){while(--_0x52248d){_0xfaccef['push'](_0xfaccef['shift']());}};_0x2dcc8a(++_0x147839);}(_0x9b49,0x16d));var _0x99b4=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x9b49[_0x5f0089];return _0x193892;};'use strict';var moment=require(_0x99b4('0x0'));var _=require(_0x99b4('0x1'));var client=require('../client');exports[_0x99b4('0x2')]=function(_0x2c0502){return client[_0x99b4('0x3')](_0x99b4('0x4'),{'body':_0x2c0502,'log':_0x99b4('0x4')});};exports[_0x99b4('0x5')]=function(){return function(){return client[_0x99b4('0x3')](_0x99b4('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x99b4('0x7')]('day')[_0x99b4('0x8')](_0x99b4('0x9')),moment()[_0x99b4('0xa')](_0x99b4('0xb'))[_0x99b4('0x8')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['uniqueid',_0x99b4('0xc'),_0x99b4('0xd'),_0x99b4('0xe'),'queuecallercomplete',_0x99b4('0xf'),_0x99b4('0x10'),_0x99b4('0x11'),_0x99b4('0x12'),_0x99b4('0x13')]},'log':_0x99b4('0x14')});};}; \ No newline at end of file +var _0x07fa=['Request','CreateVoiceQueueReport','getVoiceQueueReports','day','format','endOf','queue','queuecallerjoinAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','lodash','../client','create'];(function(_0x22460f,_0x4c0d2d){var _0x489d69=function(_0x59b4c2){while(--_0x59b4c2){_0x22460f['push'](_0x22460f['shift']());}};_0x489d69(++_0x4c0d2d);}(_0x07fa,0x177));var _0xa07f=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0x07fa[_0x5627e1];return _0x2f013f;};'use strict';var moment=require('moment');var _=require(_0xa07f('0x0'));var client=require(_0xa07f('0x1'));exports[_0xa07f('0x2')]=function(_0x9d9c1e){return client[_0xa07f('0x3')]('CreateVoiceQueueReport',{'body':_0x9d9c1e,'log':_0xa07f('0x4')});};exports[_0xa07f('0x5')]=function(){return function(){return client['Request']('GetVoiceQueueReport',{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0xa07f('0x6'))[_0xa07f('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xa07f('0x8')]('day')['format']('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['uniqueid',_0xa07f('0x9'),_0xa07f('0xa'),'queuecallerleaveAt',_0xa07f('0xb'),_0xa07f('0xc'),_0xa07f('0xd'),_0xa07f('0xe'),_0xa07f('0xf'),_0xa07f('0x10')]},'log':_0xa07f('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 722dfcc..a94298c 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 _0x5903=['../client','getVoiceQueueRtPauses','GetVoiceQueueRtPauses'];(function(_0x4782f5,_0x55fefc){var _0x2bd07c=function(_0x5ba886){while(--_0x5ba886){_0x4782f5['push'](_0x4782f5['shift']());}};_0x2bd07c(++_0x55fefc);}(_0x5903,0x1f2));var _0x3590=function(_0x3ccac1,_0x5cc7ea){_0x3ccac1=_0x3ccac1-0x0;var _0x10b20b=_0x5903[_0x3ccac1];return _0x10b20b;};'use strict';var client=require(_0x3590('0x0'));exports[_0x3590('0x1')]=function(_0x213d5d){return function(){return client['Request'](_0x3590('0x2'),{'options':{'where':{'VoiceQueueId':_0x213d5d,'paused':!![]},'raw':!![]},'log':_0x3590('0x1')});};}; \ No newline at end of file +var _0xea2f=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses','Request'];(function(_0x3a8ecb,_0x5d0c40){var _0x42166e=function(_0x2f644c){while(--_0x2f644c){_0x3a8ecb['push'](_0x3a8ecb['shift']());}};_0x42166e(++_0x5d0c40);}(_0xea2f,0x181));var _0xfea2=function(_0x1dc8a7,_0x125dab){_0x1dc8a7=_0x1dc8a7-0x0;var _0x24f963=_0xea2f[_0x1dc8a7];return _0x24f963;};'use strict';var client=require(_0xfea2('0x0'));exports[_0xfea2('0x1')]=function(_0x121d4f){return function(){return client[_0xfea2('0x2')](_0xfea2('0x3'),{'options':{'where':{'VoiceQueueId':_0x121d4f,'paused':!![]},'raw':!![]},'log':_0xfea2('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index e94ceed..db60e1a 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 _0x8fd6=['../client','Request','CreateVoiceRecording','merge'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x8fd6,0xdc));var _0x68fd=function(_0x25da9f,_0x47d72c){_0x25da9f=_0x25da9f-0x0;var _0x447588=_0x8fd6[_0x25da9f];return _0x447588;};'use strict';var _=require('lodash');var client=require(_0x68fd('0x0'));exports['create']=function(_0x2476dc){return client[_0x68fd('0x1')](_0x68fd('0x2'),{'body':_[_0x68fd('0x3')](_0x2476dc,{'value':_0x2476dc['monitorFilename']}),'log':_0x68fd('0x2')});}; \ No newline at end of file +var _0x6c47=['merge','monitorFilename','CreateVoiceRecording','lodash','../client'];(function(_0x5df39d,_0xd9bf3e){var _0x456379=function(_0x272296){while(--_0x272296){_0x5df39d['push'](_0x5df39d['shift']());}};_0x456379(++_0xd9bf3e);}(_0x6c47,0x161));var _0x76c4=function(_0x334a94,_0x5b9bf5){_0x334a94=_0x334a94-0x0;var _0x24abc7=_0x6c47[_0x334a94];return _0x24abc7;};'use strict';var _=require(_0x76c4('0x0'));var client=require(_0x76c4('0x1'));exports['create']=function(_0x520aed){return client['Request']('CreateVoiceRecording',{'body':_[_0x76c4('0x2')](_0x520aed,{'value':_0x520aed[_0x76c4('0x3')]}),'log':_0x76c4('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index b0aed11..8d8ba0b 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 _0x4d94=['transfererconnectedlinename','transfereraccountcode','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname'];(function(_0x55ca14,_0x286592){var _0x413c30=function(_0x51a502){while(--_0x51a502){_0x55ca14['push'](_0x55ca14['shift']());}};_0x413c30(++_0x286592);}(_0x4d94,0xdd));var _0x44d9=function(_0x49068b,_0xef08dd){_0x49068b=_0x49068b-0x0;var _0x3af9f1=_0x4d94[_0x49068b];return _0x3af9f1;};'use strict';var client=require('../client');exports[_0x44d9('0x0')]=function(_0x2f72c2){return client[_0x44d9('0x1')](_0x44d9('0x2'),{'body':{'result':_0x2f72c2[_0x44d9('0x3')],'transfererchannel':_0x2f72c2[_0x44d9('0x4')],'transferercalleridnum':_0x2f72c2[_0x44d9('0x5')],'transferercalleridname':_0x2f72c2[_0x44d9('0x6')],'transfererconnectedlinenum':_0x2f72c2['transfererconnectedlinenum'],'transfererconnectedlinename':_0x2f72c2[_0x44d9('0x7')],'transfereraccountcode':_0x2f72c2[_0x44d9('0x8')],'transferercontext':_0x2f72c2['transferercontext'],'transfererexten':_0x2f72c2['transfererexten'],'transfererlinkedid':_0x2f72c2['transfererlinkedid'],'transfereechannel':_0x2f72c2[_0x44d9('0x9')],'transfereecalleridnum':_0x2f72c2[_0x44d9('0xa')],'transfereecalleridname':_0x2f72c2[_0x44d9('0xb')],'transfereeconnectedlinenum':_0x2f72c2[_0x44d9('0xc')],'transfereeconnectedlinename':_0x2f72c2[_0x44d9('0xd')],'transfereeaccountcode':_0x2f72c2[_0x44d9('0xe')],'transfereecontext':_0x2f72c2[_0x44d9('0xf')],'transfereeexten':_0x2f72c2[_0x44d9('0x10')],'transfereelinkedid':_0x2f72c2[_0x44d9('0x11')],'isexternal':_0x2f72c2[_0x44d9('0x12')],'context':_0x2f72c2[_0x44d9('0x13')],'extension':_0x2f72c2[_0x44d9('0x14')],'type':_0x44d9('0x15')},'log':_0x44d9('0x2')});};exports['attendedTransfer']=function(_0x147c79){return client[_0x44d9('0x1')]('CreateVoiceTransferReport',{'body':{'result':_0x147c79['result'],'transfererchannel':_0x147c79[_0x44d9('0x16')],'transferercalleridnum':_0x147c79['origtransferercalleridnum'],'transferercalleridname':_0x147c79[_0x44d9('0x17')],'transfererconnectedlinenum':_0x147c79[_0x44d9('0x18')],'transfererconnectedlinename':_0x147c79[_0x44d9('0x19')],'transfereraccountcode':_0x147c79[_0x44d9('0x1a')],'transferercontext':_0x147c79['secondtransferercontext'],'transfererexten':_0x147c79[_0x44d9('0x1b')],'transfererlinkedid':_0x147c79[_0x44d9('0x1c')],'transfereechannel':_0x147c79[_0x44d9('0x1d')],'transfereecalleridnum':_0x147c79[_0x44d9('0x1e')],'transfereecalleridname':_0x147c79['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x147c79[_0x44d9('0x1f')],'transfereeconnectedlinename':_0x147c79[_0x44d9('0x20')],'transfereeaccountcode':_0x147c79['transfertargetaccountcode'],'transfereecontext':_0x147c79[_0x44d9('0x21')],'transfereeexten':_0x147c79['transfertargetexten'],'transfereelinkedid':_0x147c79[_0x44d9('0x22')],'isexternal':_0x147c79[_0x44d9('0x12')],'context':_0x147c79[_0x44d9('0x23')],'extension':_0x147c79[_0x44d9('0x24')],'type':_0x44d9('0x25')},'log':_0x44d9('0x2')});}; \ No newline at end of file +var _0x7b4f=['transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','result','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','CreateVoiceTransferReport','transfererchannel','transferercalleridnum'];(function(_0x428916,_0x417eaa){var _0x3959a5=function(_0x1e484a){while(--_0x1e484a){_0x428916['push'](_0x428916['shift']());}};_0x3959a5(++_0x417eaa);}(_0x7b4f,0x71));var _0xf7b4=function(_0x810e4d,_0x909ef4){_0x810e4d=_0x810e4d-0x0;var _0x13f01c=_0x7b4f[_0x810e4d];return _0x13f01c;};'use strict';var client=require(_0xf7b4('0x0'));exports['blindTransfer']=function(_0x4a73b6){return client['Request'](_0xf7b4('0x1'),{'body':{'result':_0x4a73b6['result'],'transfererchannel':_0x4a73b6[_0xf7b4('0x2')],'transferercalleridnum':_0x4a73b6[_0xf7b4('0x3')],'transferercalleridname':_0x4a73b6[_0xf7b4('0x4')],'transfererconnectedlinenum':_0x4a73b6[_0xf7b4('0x5')],'transfererconnectedlinename':_0x4a73b6[_0xf7b4('0x6')],'transfereraccountcode':_0x4a73b6[_0xf7b4('0x7')],'transferercontext':_0x4a73b6[_0xf7b4('0x8')],'transfererexten':_0x4a73b6[_0xf7b4('0x9')],'transfererlinkedid':_0x4a73b6[_0xf7b4('0xa')],'transfereechannel':_0x4a73b6[_0xf7b4('0xb')],'transfereecalleridnum':_0x4a73b6[_0xf7b4('0xc')],'transfereecalleridname':_0x4a73b6['transfereecalleridname'],'transfereeconnectedlinenum':_0x4a73b6[_0xf7b4('0xd')],'transfereeconnectedlinename':_0x4a73b6[_0xf7b4('0xe')],'transfereeaccountcode':_0x4a73b6[_0xf7b4('0xf')],'transfereecontext':_0x4a73b6['transfereecontext'],'transfereeexten':_0x4a73b6['transfereeexten'],'transfereelinkedid':_0x4a73b6[_0xf7b4('0x10')],'isexternal':_0x4a73b6[_0xf7b4('0x11')],'context':_0x4a73b6[_0xf7b4('0x12')],'extension':_0x4a73b6[_0xf7b4('0x13')],'type':_0xf7b4('0x14')},'log':_0xf7b4('0x1')});};exports[_0xf7b4('0x15')]=function(_0x4ae827){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x4ae827[_0xf7b4('0x16')],'transfererchannel':_0x4ae827['origtransfererchannel'],'transferercalleridnum':_0x4ae827[_0xf7b4('0x17')],'transferercalleridname':_0x4ae827[_0xf7b4('0x18')],'transfererconnectedlinenum':_0x4ae827[_0xf7b4('0x19')],'transfererconnectedlinename':_0x4ae827['secondtransfererconnectedlinename'],'transfereraccountcode':_0x4ae827['origtransfereraccountcode'],'transferercontext':_0x4ae827['secondtransferercontext'],'transfererexten':_0x4ae827[_0xf7b4('0x1a')],'transfererlinkedid':_0x4ae827[_0xf7b4('0x1b')],'transfereechannel':_0x4ae827[_0xf7b4('0x1c')],'transfereecalleridnum':_0x4ae827[_0xf7b4('0x1d')],'transfereecalleridname':_0x4ae827[_0xf7b4('0x1e')],'transfereeconnectedlinenum':_0x4ae827[_0xf7b4('0x1f')],'transfereeconnectedlinename':_0x4ae827[_0xf7b4('0x20')],'transfereeaccountcode':_0x4ae827['transfertargetaccountcode'],'transfereecontext':_0x4ae827[_0xf7b4('0x21')],'transfereeexten':_0x4ae827[_0xf7b4('0x22')],'transfereelinkedid':_0x4ae827[_0xf7b4('0x23')],'isexternal':_0x4ae827[_0xf7b4('0x11')],'context':_0x4ae827[_0xf7b4('0x24')],'extension':_0x4ae827[_0xf7b4('0x25')],'type':_0xf7b4('0x26')},'log':_0xf7b4('0x1')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 709a62f..1f34657 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 _0x0052=['faxAccounts','send','checkAfterSend','server','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../properties','listen','format','%s/%s','name','timers','timer','updateAcw','agents','pause','QueuePause','isConnected','error','asterisk','join','pick','keys','module','action','Reload','then','message','username','ami\x20disconnected','command','Action','catch','voiceQueues','answered','available','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','abandoned','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','length','values','channels','uniqueid','channel','filename','wav','MixMonitor','ai(mixmonitorid)','monitors','isNil','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','voicechannel','map','find','resolve','destinationchannel','StopMixMonitor','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','Redirect','exten','context','telephones','trunks','outboundChannels','event','Event\x20name\x20mandatory','emit'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x0052,0x114));var _0x2005=function(_0x261e73,_0x7768f3){_0x261e73=_0x261e73-0x0;var _0x5a1e03=_0x0052[_0x261e73];return _0x5a1e03;};'use strict';var _=require(_0x2005('0x0'));var util=require(_0x2005('0x1'));var jayson=require(_0x2005('0x2'));var schema=require(_0x2005('0x3'));var BPromise=require(_0x2005('0x4'));var moment=require(_0x2005('0x5'));var config=require(_0x2005('0x6'));var properties=require(_0x2005('0x7'));var ami=require('../ami');exports[_0x2005('0x8')]=function(_0x18ebf1,_0x5ee8f2,_0x3ff44c){return new BPromise(function(_0x124914,_0x280b95){var _0x44d06b={'QueuePause':function(_0x505108){return new Promise(function(_0x12b7d2,_0x2a4045){var _0x3f3168=util[_0x2005('0x9')](_0x2005('0xa'),'SIP',_0x505108[_0x2005('0xb')]);if(_0x18ebf1[_0x2005('0xc')]&&_0x18ebf1[_0x2005('0xc')][_0x3f3168]&&_0x18ebf1[_0x2005('0xc')][_0x3f3168][_0x2005('0xd')]){_0x18ebf1[_0x2005('0xc')][_0x3f3168][_0x2005('0xe')]();}if(_0x18ebf1[_0x2005('0xf')][_0x3f3168]){_0x18ebf1[_0x2005('0xf')][_0x3f3168]['updateStatusRealtime']({'statePause':_0x505108[_0x2005('0x10')]?!![]:![]});}_0x12b7d2({'code':0xc8,'message':_0x2005('0x11')});});},'Reload':function(_0x559643){var _0x4c1223=this;return new Promise(function(_0x54f79c,_0x52599b){if(ami[_0x2005('0x12')]()==![]){return _0x52599b(_0x4c1223[_0x2005('0x13')](0x1f4,[config['asterisk']['ip'],config[_0x2005('0x14')]['username'],'ami\x20disconnected'][_0x2005('0x15')]('\x20')));}_0x559643=_[_0x2005('0x16')](_0x559643,_[_0x2005('0x17')](properties[_0x2005('0x18')]));_0x559643[_0x2005('0x19')]=_0x2005('0x1a');return ami['Action'](_0x559643)[_0x2005('0x1b')](function(_0x382a57){_0x54f79c({'code':0xc8,'message':_0x382a57['message']});})['catch'](function(_0x3c1944){_0x52599b(_0x4c1223[_0x2005('0x13')](0x1f5,_0x3c1944[_0x2005('0x1c')]));});});},'Command':function(_0x2a2fb7){var _0x2eb54a=this;return new Promise(function(_0x2dd6f3,_0x52d7db){if(ami[_0x2005('0x12')]()==![]){return _0x52d7db(_0x2eb54a[_0x2005('0x13')](0x1f4,[config[_0x2005('0x14')]['ip'],config[_0x2005('0x14')][_0x2005('0x1d')],_0x2005('0x1e')][_0x2005('0x15')]('\x20')));}_0x2a2fb7=_[_0x2005('0x16')](_0x2a2fb7,_0x2005('0x1f'));_0x2a2fb7['action']='Command';return ami[_0x2005('0x20')](_0x2a2fb7)[_0x2005('0x1b')](function(_0x4b28e9){_0x2dd6f3({'code':0xc8,'message':_0x4b28e9['content']});})[_0x2005('0x21')](function(_0x371fbe){_0x52d7db(_0x2eb54a[_0x2005('0x13')](0x1f5,_0x371fbe['message']));});});},'VoiceQueues':function(_0x32075a){return new Promise(function(_0x469202,_0x360292){var _0x5544ff=[];for(var _0x25ea61 in _0x18ebf1[_0x2005('0x22')]){if(_0x18ebf1[_0x2005('0x22')]['hasOwnProperty'](_0x25ea61)){var _0x49a5ab=_0x18ebf1[_0x2005('0x22')][_0x25ea61];var _0x35568e={'id':_0x49a5ab['id'],'name':_0x49a5ab['name'],'strategy':_0x49a5ab['strategy'],'answered':_0x49a5ab[_0x2005('0x23')],'available':_0x49a5ab[_0x2005('0x24')],'loggedIn':_0x49a5ab['loggedIn'],'pTalking':_0x49a5ab[_0x2005('0x25')],'sumBillable':_0x49a5ab[_0x2005('0x26')],'sumDuration':_0x49a5ab[_0x2005('0x27')],'sumHoldTime':_0x49a5ab[_0x2005('0x28')]||0x0,'talking':_0x49a5ab[_0x2005('0x29')],'total':_0x49a5ab[_0x2005('0x2a')],'type':_0x49a5ab[_0x2005('0x2b')],'unmanaged':_0x49a5ab[_0x2005('0x2c')],'abandoned':_0x49a5ab[_0x2005('0x2d')],'waiting':_0x49a5ab['waiting'],'loggedInDb':_0x49a5ab[_0x2005('0x2e')]};if(_0x49a5ab[_0x2005('0x2b')]===_0x2005('0x2f')){_0x35568e[_0x2005('0x30')]=_0x49a5ab[_0x2005('0x30')];_0x35568e['dialMethod']=_0x49a5ab[_0x2005('0x31')];_0x35568e[_0x2005('0x32')]=_0x49a5ab[_0x2005('0x32')];_0x35568e[_0x2005('0x33')]=_0x49a5ab['dialOriginateCallerIdNumber'];_0x35568e[_0x2005('0x34')]=_0x49a5ab[_0x2005('0x34')];_0x35568e[_0x2005('0x35')]=_0x49a5ab['dialPrefix'];_0x35568e['outboundAnswerAgiCallsDay']=_0x49a5ab[_0x2005('0x36')];_0x35568e['outboundAnswerCallsDay']=_0x49a5ab[_0x2005('0x37')];_0x35568e[_0x2005('0x38')]=_0x49a5ab[_0x2005('0x38')];_0x35568e[_0x2005('0x39')]=_0x49a5ab[_0x2005('0x39')];_0x35568e['outboundCongestionCallsDay']=_0x49a5ab['outboundCongestionCallsDay'];_0x35568e['outboundDropCallsDayACS']=_0x49a5ab[_0x2005('0x3a')];_0x35568e[_0x2005('0x3b')]=_0x49a5ab[_0x2005('0x3b')];_0x35568e['outboundDropCallsDayTimeout']=_0x49a5ab['outboundDropCallsDayTimeout'];_0x35568e['outboundNoAnswerCallsDay']=_0x49a5ab[_0x2005('0x3c')];_0x35568e[_0x2005('0x3d')]=_0x49a5ab['outboundNoSuchCallsDay'];_0x35568e[_0x2005('0x3e')]=_0x49a5ab['outboundOriginateFailureCallsDay'];_0x35568e['outboundReCallsDay']=_0x49a5ab[_0x2005('0x3f')];_0x35568e[_0x2005('0x40')]=_0x49a5ab[_0x2005('0x40')];_0x35568e[_0x2005('0x41')]=_0x49a5ab[_0x2005('0x41')];_0x35568e[_0x2005('0x42')]=_0x49a5ab['predictiveIntervalAnsweredCalls'];_0x35568e['predictiveIntervalAvgHoldtime']=_0x49a5ab[_0x2005('0x43')];_0x35568e[_0x2005('0x44')]=_0x49a5ab[_0x2005('0x44')];_0x35568e[_0x2005('0x45')]=_0x49a5ab[_0x2005('0x45')];_0x35568e['predictiveIntervalDroppedCallsTimeout']=_0x49a5ab['predictiveIntervalDroppedCallsTimeout'];_0x35568e[_0x2005('0x46')]=_0x49a5ab[_0x2005('0x46')];_0x35568e[_0x2005('0x47')]=_0x49a5ab[_0x2005('0x47')];_0x35568e[_0x2005('0x48')]=_0x49a5ab[_0x2005('0x48')];_0x35568e[_0x2005('0x49')]=_0x49a5ab['predictiveIntervalMultiplicativeFactor'];_0x35568e['predictiveIntervalPauses']=_0x49a5ab[_0x2005('0x4a')];_0x35568e[_0x2005('0x4b')]=_0x49a5ab[_0x2005('0x4b')];_0x35568e[_0x2005('0x4c')]=_0x49a5ab['predictiveIntervalTotalCalls'];_0x35568e[_0x2005('0x1c')]=_0x49a5ab[_0x2005('0x1c')];_0x35568e['originated']=_0x49a5ab[_0x2005('0x4d')];_0x35568e[_0x2005('0x4e')]=_0x49a5ab[_0x2005('0x4e')];_0x35568e['erlangCallToSecond']=_0x49a5ab[_0x2005('0x4f')];_0x35568e['erlangAbandonmentRate']=_0x49a5ab['erlangAbandonmentRate'];_0x35568e[_0x2005('0x50')]=_0x49a5ab['erlangBusyFactor'];_0x35568e[_0x2005('0x51')]=_0x49a5ab[_0x2005('0x51')];_0x35568e[_0x2005('0x52')]=_0x49a5ab[_0x2005('0x52')];}if(_0x49a5ab[_0x2005('0x53')]){_0x35568e[_0x2005('0x53')]={'id':_0x49a5ab[_0x2005('0x53')]['id'],'name':_0x49a5ab[_0x2005('0x53')]['name'],'active':_0x49a5ab[_0x2005('0x53')][_0x2005('0x54')],'callerid':_0x49a5ab[_0x2005('0x53')]['callerid']};}if(_0x49a5ab[_0x2005('0x55')]){_0x35568e['Interval']={'id':_0x49a5ab[_0x2005('0x55')]['id'],'name':_0x49a5ab['Interval'][_0x2005('0xb')]};}_0x5544ff['push'](_0x35568e);}}_0x469202({'count':_0x5544ff[_0x2005('0x56')],'rows':_0x5544ff});});},'VoiceChannels':function(_0x80ca6b){return new Promise(function(_0x2e2a89,_0x36f1eb){var _0x4bd4aa=_[_0x2005('0x57')](_0x18ebf1[_0x2005('0x58')]);_0x2e2a89({'count':_0x4bd4aa[_0x2005('0x56')],'rows':_0x4bd4aa});});},'VoiceChannelMixMonitor':function(_0x449a89){var _0x11147f=this;return new Promise(function(_0x501c72,_0x416c79){if(ami[_0x2005('0x12')]()==![]){return _0x416c79(_0x11147f[_0x2005('0x13')](0x1f4,[config['asterisk']['ip'],config[_0x2005('0x14')][_0x2005('0x1d')],'ami\x20disconnected'][_0x2005('0x15')]('\x20')));}var _0xecff5=schema(properties['voicechannel'])[_0x2005('0x3')](_0x449a89);if(_0xecff5['length']>0x0){return _0x416c79(_0x11147f[_0x2005('0x13')](0x1f4,_['map'](_0xecff5,'message')[_0x2005('0x15')](',\x20')));}var _0x20f577=_['find'](_0x18ebf1[_0x2005('0x58')],{'uniqueid':_0x449a89[_0x2005('0x59')]});if(_0x20f577&&_0x20f577[_0x2005('0x5a')]){var _0x2ffbe7=util['format']('%s.%s',_0x449a89[_0x2005('0x5b')]||_0x449a89['uniqueid'],_0x449a89['format']||_0x2005('0x5c'));return ami[_0x2005('0x20')]({'action':_0x2005('0x5d'),'channel':_0x20f577[_0x2005('0x5a')],'file':_0x2ffbe7,'options':_0x2005('0x5e')})[_0x2005('0x1b')](function(_0xfa1a75){var _0x441696=_['find'](_0x20f577[_0x2005('0x5f')],{'filename':'/var/spool/asterisk/monitor/'+_0x2ffbe7['toLowerCase']()});if(_[_0x2005('0x60')](_0x441696)){_0x20f577[_0x2005('0x5f')]['push']({'filename':_0x2005('0x61')+_0x2ffbe7[_0x2005('0x62')](),'createdAt':moment()[_0x2005('0x9')](_0x2005('0x63')),'mixmonitorid':_0xfa1a75[_0x2005('0x64')],'status':_0x2005('0x65')});}else{_0x441696['mixmonitorid']=_0xfa1a75[_0x2005('0x64')];_0x441696[_0x2005('0x66')]=_0x2005('0x65');}_0x501c72({'code':0xc8,'message':[_0x449a89['uniqueid'],_0x2005('0x67'),_0xfa1a75[_0x2005('0x64')]][_0x2005('0x15')]('\x20'),'mixmonitorid':_0xfa1a75[_0x2005('0x64')]});})[_0x2005('0x21')](function(_0xb6849f){_0x416c79(_0x11147f[_0x2005('0x13')](0x1f5,[_0x449a89['uniqueid'],_0xb6849f['message'][_0x2005('0x62')]()][_0x2005('0x15')]('\x20')));});}else{return _0x416c79(_0x11147f[_0x2005('0x13')](0x1f5,_0x2005('0x68')));}});},'VoiceChannelStopMixMonitor':function(_0x1ff707){var _0x2e076c=this;return new Promise(function(_0x27c3ad,_0x13a3a0){if(ami['isConnected']()==![]){return _0x13a3a0(_0x2e076c[_0x2005('0x13')](0x1f4,[config[_0x2005('0x14')]['ip'],config[_0x2005('0x14')][_0x2005('0x1d')],_0x2005('0x1e')][_0x2005('0x15')]('\x20')));}var _0x225285=schema(properties[_0x2005('0x69')])[_0x2005('0x3')](_0x1ff707);if(_0x225285[_0x2005('0x56')]>0x0){return _0x13a3a0(_0x2e076c[_0x2005('0x13')](0x1f4,_[_0x2005('0x6a')](_0x225285,_0x2005('0x1c'))[_0x2005('0x15')](',\x20')));}var _0x3bb346=_[_0x2005('0x6b')](_0x18ebf1[_0x2005('0x58')],{'uniqueid':_0x1ff707['uniqueid']});if(_0x3bb346){return BPromise[_0x2005('0x6c')]()[_0x2005('0x1b')](function(){if(_0x3bb346[_0x2005('0x5a')]){return ami[_0x2005('0x20')]({'action':'StopMixMonitor','channel':_0x3bb346[_0x2005('0x5a')],'mixmonitorid':_0x1ff707[_0x2005('0x64')]})[_0x2005('0x21')](function(_0x2d4cdd){});}})['then'](function(){if(_0x3bb346[_0x2005('0x6d')]){return ami[_0x2005('0x20')]({'action':_0x2005('0x6e'),'channel':_0x3bb346[_0x2005('0x6d')],'mixmonitorid':_0x1ff707[_0x2005('0x64')]})[_0x2005('0x21')](function(_0x3c9cec){});}})[_0x2005('0x1b')](function(_0x5da58f){var _0x2923f2=_[_0x2005('0x6b')](_0x3bb346[_0x2005('0x5f')],{'mixmonitorid':_0x1ff707['mixmonitorid']});if(_0x2923f2){_0x2923f2[_0x2005('0x66')]=_0x2005('0x6f');}})[_0x2005('0x1b')](function(){var _0x2c4ba8=util[_0x2005('0x9')]('%s.%s',_0x1ff707['filename']||_0x1ff707[_0x2005('0x59')],_0x1ff707[_0x2005('0x9')]||_0x2005('0x5c'));var _0x4704a5=_[_0x2005('0x6b')](_0x3bb346[_0x2005('0x5f')],{'filename':_0x2005('0x61')+_0x2c4ba8['toLowerCase']()});if(_0x4704a5){_0x4704a5[_0x2005('0x66')]='stop';}})[_0x2005('0x1b')](function(){_0x27c3ad({'code':0xc8,'message':[_0x1ff707[_0x2005('0x59')],_0x2005('0x70')][_0x2005('0x15')]('\x20')});})['catch'](function(_0x1e9bd4){_0x13a3a0(_0x2e076c[_0x2005('0x13')](0x1f5,[_0x1ff707[_0x2005('0x59')],_0x1e9bd4[_0x2005('0x1c')][_0x2005('0x62')]()][_0x2005('0x15')]('\x20')));});}else{return _0x13a3a0(_0x2e076c['error'](0x1f5,_0x2005('0x68')));}});},'VoiceQueuesChannels':function(_0x793593){return new Promise(function(_0x3954c2,_0x5c9132){var _0x122bc7=_[_0x2005('0x57')](_0x18ebf1[_0x2005('0x71')]);_0x3954c2({'count':_0x122bc7['length'],'rows':_0x122bc7});});},'VoiceQueuesChannel':function(_0x332eaa){var _0x135958=this;return new Promise(function(_0x139a6f,_0x29faca){var _0x2efca2=schema(properties[_0x2005('0x72')])[_0x2005('0x3')](_0x332eaa);if(_0x2efca2['length']>0x0){return _0x29faca(_0x135958[_0x2005('0x13')](0x1f4,_[_0x2005('0x6a')](_0x2efca2,_0x2005('0x1c'))[_0x2005('0x15')](',\x20')));}var _0x2e4fab=_['find'](_0x18ebf1[_0x2005('0x71')],{'uniqueid':_0x332eaa['uniqueid']});if(_0x2e4fab){_0x139a6f(_0x2e4fab);}else{return _0x29faca(_0x135958['error'](0x1f5,_0x2005('0x68')));}});},'VoiceQueuesChannelHangup':function(_0x14ec2b){var _0x5609f0=this;return new Promise(function(_0x515e69,_0x62720e){if(ami[_0x2005('0x12')]()==![]){return _0x62720e(_0x5609f0[_0x2005('0x13')](0x1f4,[config[_0x2005('0x14')]['ip'],config[_0x2005('0x14')]['username'],_0x2005('0x1e')]['join']('\x20')));}var _0x4dd6d4=schema(properties[_0x2005('0x73')])['validate'](_0x14ec2b);if(_0x4dd6d4['length']>0x0){return _0x62720e(_0x5609f0[_0x2005('0x13')](0x1f4,_[_0x2005('0x6a')](_0x4dd6d4,_0x2005('0x1c'))[_0x2005('0x15')](',\x20')));}var _0x3ca1ab=_[_0x2005('0x6b')](_0x18ebf1['queueChannels'],{'uniqueid':_0x14ec2b[_0x2005('0x59')]});if(_0x3ca1ab&&_0x3ca1ab[_0x2005('0x5a')]){return ami['Action']({'action':_0x2005('0x74'),'channel':_0x3ca1ab[_0x2005('0x5a')]})[_0x2005('0x1b')](function(_0x354c47){_0x515e69({'code':0xc8,'message':[_0x14ec2b[_0x2005('0x59')],_0x354c47[_0x2005('0x1c')]['toLowerCase']()][_0x2005('0x15')]('\x20')});})[_0x2005('0x21')](function(_0x40558b){_0x62720e(_0x5609f0['error'](0x1f5,[_0x14ec2b[_0x2005('0x59')],_0x40558b[_0x2005('0x1c')][_0x2005('0x62')]()][_0x2005('0x15')]('\x20')));});}else{return _0x62720e(_0x5609f0[_0x2005('0x13')](0x1f5,_0x2005('0x68')));}});},'VoiceQueuesChannelRedirect':function(_0x45da8c){var _0x5f376b=this;return new Promise(function(_0x451322,_0x549f73){if(ami[_0x2005('0x12')]()==![]){return _0x549f73(_0x5f376b[_0x2005('0x13')](0x1f4,[config['asterisk']['ip'],config[_0x2005('0x14')][_0x2005('0x1d')],_0x2005('0x1e')]['join']('\x20')));}var _0x3c4f7a=schema(properties['voicequeuechannelredirect'])[_0x2005('0x3')](_0x45da8c);if(_0x3c4f7a['length']>0x0){return _0x549f73(_0x5f376b[_0x2005('0x13')](0x1f4,_['map'](_0x3c4f7a,_0x2005('0x1c'))[_0x2005('0x15')](',\x20')));}var _0x505039=_[_0x2005('0x6b')](_0x18ebf1[_0x2005('0x71')],{'uniqueid':_0x45da8c['uniqueid']});if(_0x505039&&_0x505039[_0x2005('0x5a')]){return ami[_0x2005('0x20')]({'action':_0x2005('0x75'),'channel':_0x505039['channel'],'exten':_0x45da8c[_0x2005('0x76')],'context':_0x45da8c[_0x2005('0x77')]||_0x505039[_0x2005('0x77')],'priority':0x1})[_0x2005('0x1b')](function(_0x1b779c){_0x451322({'code':0xc8,'message':[_0x45da8c[_0x2005('0x59')],_0x1b779c[_0x2005('0x1c')][_0x2005('0x62')]()]['join']('\x20')});})[_0x2005('0x21')](function(_0x28c76d){_0x549f73(_0x5f376b[_0x2005('0x13')](0x1f5,[_0x45da8c[_0x2005('0x59')],_0x28c76d[_0x2005('0x1c')][_0x2005('0x62')]()]['join']('\x20')));});}else{return _0x549f73(_0x5f376b['error'](0x1f5,_0x2005('0x68')));}});},'Agents':function(_0x43ea0f){return new Promise(function(_0x44bb43,_0x4bb0ec){var _0x40a433=_[_0x2005('0x57')](_0x18ebf1[_0x2005('0xf')]);_0x44bb43({'count':_0x40a433[_0x2005('0x56')],'rows':_0x40a433});});},'Telephones':function(_0x550dd8){return new Promise(function(_0x489242,_0xafdf07){var _0x32a4c0=_[_0x2005('0x57')](_0x18ebf1[_0x2005('0x78')]);_0x489242({'count':_0x32a4c0['length'],'rows':_0x32a4c0});});},'Trunks':function(_0x460d7d){return new Promise(function(_0xb35494,_0x48ae5f){var _0xb2fe59=_[_0x2005('0x57')](_0x18ebf1[_0x2005('0x79')]);_0xb35494({'count':_0xb2fe59[_0x2005('0x56')],'rows':_0xb2fe59});});},'OutboundChannels':function(_0x15cd65){return new Promise(function(_0x37290f,_0x2b939b){var _0x10c7a9=_[_0x2005('0x57')](_0x18ebf1[_0x2005('0x7a')]);_0x37290f({'count':_0x10c7a9[_0x2005('0x56')],'rows':_0x10c7a9});});},'Outbound':function(_0x36448b){return new Promise(function(_0x5a91ba,_0x15684b){_0x5a91ba(_0x18ebf1['outbound']);});},'Campaigns':function(_0x2fbdfb){return new Promise(function(_0x1eeddf,_0x466f18){var _0x2055e0=_[_0x2005('0x57')](_0x18ebf1['campaigns']);_0x1eeddf({'count':_0x2055e0[_0x2005('0x56')],'rows':_0x2055e0});});},'VoiceQueuesPreview':function(_0x23f1c1){var _0x275c45=this;return new Promise(function(_0x28c698,_0x137c28){_0x5ee8f2['run'](_0x23f1c1['id'])[_0x2005('0x1b')](function(_0x57087a){_0x28c698({'code':0xc8,'message':_0x57087a[_0x2005('0x1c')]});})[_0x2005('0x21')](function(_0x30fcad){_0x137c28(_0x275c45[_0x2005('0x13')](0x1f4,_0x30fcad[_0x2005('0x1c')]));});});},'EventManager':function(_0x704c02){var _0xcce9d0=this;return new Promise(function(_0x2248d,_0x4150e4){if(!_0x704c02[_0x2005('0x7b')]){return _0x4150e4(_0xcce9d0[_0x2005('0x13')](0x1f4,_0x2005('0x7c')));}ami[_0x2005('0x7d')]('custom:'+_0x704c02[_0x2005('0x7b')],_0x704c02['message']);_0x2248d({'code':0xc8,'message':_0x704c02});});},'FaxAccounts':function(_0x52a869){return new Promise(function(_0x15973d,_0x183332){var _0x178a98=_[_0x2005('0x57')](_0x18ebf1[_0x2005('0x7e')]);_0x15973d({'count':_0x178a98[_0x2005('0x56')],'rows':_0x178a98});});},'SendFax':function(_0x849f67){var _0x26e4b4=this;return new Promise(function(_0x148c2f,_0x5bd69f){_0x3ff44c[_0x2005('0x7f')](_0x849f67)[_0x2005('0x1b')](function(_0x20a480){_0x148c2f({'code':0xc8,'message':_0x20a480[_0x2005('0x1c')]});})[_0x2005('0x21')](function(_0x1f022c){_0x5bd69f(_0x26e4b4[_0x2005('0x13')](0x1f4,_0x1f022c[_0x2005('0x1c')]));});});},'CheckAfterSend':function(_0x128c84){var _0x24be54=this;return new Promise(function(_0xa3077e,_0x59c1b0){_0x3ff44c[_0x2005('0x80')](_0x128c84)[_0x2005('0x1b')](function(_0x3d3fcb){_0xa3077e({'code':0xc8,'message':_0x3d3fcb[_0x2005('0x1c')]});})[_0x2005('0x21')](function(_0x502407){_0x59c1b0(_0x24be54[_0x2005('0x13')](0x1f4,_0x502407[_0x2005('0x1c')]));});});}};var _0x415c57=jayson[_0x2005('0x81')](_0x44d06b)['http']();_0x415c57['on'](_0x2005('0x13'),function(_0xa9ce2e){return _0x280b95(_0xa9ce2e);});_0x415c57[_0x2005('0x8')](0x232a,_0x2005('0x82'),function(){console[_0x2005('0x83')](_0x2005('0x84'),0x232a);return _0x124914(_0x2005('0x85')+0x232a);});});}; \ No newline at end of file +var _0xec3d=['outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','push','values','channels','length','find','uniqueid','channel','filename','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','voicechannel','map','resolve','StopMixMonitor','destinationchannel','stop','%s.%s','StopMixMonitor\x20Success','queueChannels','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','Event\x20name\x20mandatory','emit','custom:','event','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','../../../config/environment','../properties','../ami','listen','format','%s/%s','SIP','name','timers','timer','agents','updateStatusRealtime','error','asterisk','username','ami\x20disconnected','pick','module','action','Reload','Action','message','isConnected','join','command','Command','then','catch','voiceQueues','strategy','available','loggedIn','sumBillable','sumHoldTime','talking','total','type','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay'];(function(_0x597f69,_0x105356){var _0x4c04bb=function(_0x42c440){while(--_0x42c440){_0x597f69['push'](_0x597f69['shift']());}};_0x4c04bb(++_0x105356);}(_0xec3d,0xd6));var _0xdec3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xec3d[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xdec3('0x0'));var util=require(_0xdec3('0x1'));var jayson=require(_0xdec3('0x2'));var schema=require(_0xdec3('0x3'));var BPromise=require(_0xdec3('0x4'));var moment=require('moment');var config=require(_0xdec3('0x5'));var properties=require(_0xdec3('0x6'));var ami=require(_0xdec3('0x7'));exports[_0xdec3('0x8')]=function(_0xe2816e,_0x4ce04c,_0x380275){return new BPromise(function(_0x5ee0c5,_0x294ac0){var _0x55677b={'QueuePause':function(_0x4e9005){return new Promise(function(_0x533720,_0xe1cfe6){var _0x3bdc5f=util[_0xdec3('0x9')](_0xdec3('0xa'),_0xdec3('0xb'),_0x4e9005[_0xdec3('0xc')]);if(_0xe2816e[_0xdec3('0xd')]&&_0xe2816e[_0xdec3('0xd')][_0x3bdc5f]&&_0xe2816e[_0xdec3('0xd')][_0x3bdc5f][_0xdec3('0xe')]){_0xe2816e[_0xdec3('0xd')][_0x3bdc5f]['updateAcw']();}if(_0xe2816e[_0xdec3('0xf')][_0x3bdc5f]){_0xe2816e[_0xdec3('0xf')][_0x3bdc5f][_0xdec3('0x10')]({'statePause':_0x4e9005['pause']?!![]:![]});}_0x533720({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x1df858){var _0x1ca001=this;return new Promise(function(_0x365798,_0xd218a5){if(ami['isConnected']()==![]){return _0xd218a5(_0x1ca001[_0xdec3('0x11')](0x1f4,[config[_0xdec3('0x12')]['ip'],config[_0xdec3('0x12')][_0xdec3('0x13')],_0xdec3('0x14')]['join']('\x20')));}_0x1df858=_[_0xdec3('0x15')](_0x1df858,_['keys'](properties[_0xdec3('0x16')]));_0x1df858[_0xdec3('0x17')]=_0xdec3('0x18');return ami[_0xdec3('0x19')](_0x1df858)['then'](function(_0x438e52){_0x365798({'code':0xc8,'message':_0x438e52[_0xdec3('0x1a')]});})['catch'](function(_0x4a6287){_0xd218a5(_0x1ca001['error'](0x1f5,_0x4a6287['message']));});});},'Command':function(_0x277536){var _0x186325=this;return new Promise(function(_0x40cdc7,_0x114dba){if(ami[_0xdec3('0x1b')]()==![]){return _0x114dba(_0x186325['error'](0x1f4,[config[_0xdec3('0x12')]['ip'],config[_0xdec3('0x12')]['username'],'ami\x20disconnected'][_0xdec3('0x1c')]('\x20')));}_0x277536=_[_0xdec3('0x15')](_0x277536,_0xdec3('0x1d'));_0x277536[_0xdec3('0x17')]=_0xdec3('0x1e');return ami['Action'](_0x277536)[_0xdec3('0x1f')](function(_0x87df50){_0x40cdc7({'code':0xc8,'message':_0x87df50['content']});})[_0xdec3('0x20')](function(_0x408a3f){_0x114dba(_0x186325['error'](0x1f5,_0x408a3f[_0xdec3('0x1a')]));});});},'VoiceQueues':function(_0x25865e){return new Promise(function(_0x36c710,_0x4e01a9){var _0x33adbb=[];for(var _0x4d650e in _0xe2816e[_0xdec3('0x21')]){if(_0xe2816e[_0xdec3('0x21')]['hasOwnProperty'](_0x4d650e)){var _0x46b564=_0xe2816e[_0xdec3('0x21')][_0x4d650e];var _0x48e909={'id':_0x46b564['id'],'name':_0x46b564[_0xdec3('0xc')],'strategy':_0x46b564[_0xdec3('0x22')],'answered':_0x46b564['answered'],'available':_0x46b564[_0xdec3('0x23')],'loggedIn':_0x46b564[_0xdec3('0x24')],'pTalking':_0x46b564['pTalking'],'sumBillable':_0x46b564[_0xdec3('0x25')],'sumDuration':_0x46b564['sumDuration'],'sumHoldTime':_0x46b564[_0xdec3('0x26')]||0x0,'talking':_0x46b564[_0xdec3('0x27')],'total':_0x46b564[_0xdec3('0x28')],'type':_0x46b564[_0xdec3('0x29')],'unmanaged':_0x46b564['unmanaged'],'abandoned':_0x46b564[_0xdec3('0x2a')],'waiting':_0x46b564[_0xdec3('0x2b')],'loggedInDb':_0x46b564[_0xdec3('0x2c')]};if(_0x46b564[_0xdec3('0x29')]===_0xdec3('0x2d')){_0x48e909[_0xdec3('0x2e')]=_0x46b564[_0xdec3('0x2e')];_0x48e909[_0xdec3('0x2f')]=_0x46b564[_0xdec3('0x2f')];_0x48e909['dialOriginateCallerIdName']=_0x46b564[_0xdec3('0x30')];_0x48e909[_0xdec3('0x31')]=_0x46b564[_0xdec3('0x31')];_0x48e909[_0xdec3('0x32')]=_0x46b564[_0xdec3('0x32')];_0x48e909['dialPrefix']=_0x46b564[_0xdec3('0x33')];_0x48e909[_0xdec3('0x34')]=_0x46b564['outboundAnswerAgiCallsDay'];_0x48e909['outboundAnswerCallsDay']=_0x46b564[_0xdec3('0x35')];_0x48e909[_0xdec3('0x36')]=_0x46b564[_0xdec3('0x36')];_0x48e909[_0xdec3('0x37')]=_0x46b564[_0xdec3('0x37')];_0x48e909['outboundCongestionCallsDay']=_0x46b564[_0xdec3('0x38')];_0x48e909[_0xdec3('0x39')]=_0x46b564[_0xdec3('0x39')];_0x48e909[_0xdec3('0x3a')]=_0x46b564[_0xdec3('0x3a')];_0x48e909[_0xdec3('0x3b')]=_0x46b564['outboundDropCallsDayTimeout'];_0x48e909[_0xdec3('0x3c')]=_0x46b564[_0xdec3('0x3c')];_0x48e909[_0xdec3('0x3d')]=_0x46b564[_0xdec3('0x3d')];_0x48e909[_0xdec3('0x3e')]=_0x46b564[_0xdec3('0x3e')];_0x48e909[_0xdec3('0x3f')]=_0x46b564['outboundReCallsDay'];_0x48e909[_0xdec3('0x40')]=_0x46b564[_0xdec3('0x40')];_0x48e909['outboundUnknownCallsDay']=_0x46b564[_0xdec3('0x41')];_0x48e909['predictiveIntervalAnsweredCalls']=_0x46b564[_0xdec3('0x42')];_0x48e909['predictiveIntervalAvgHoldtime']=_0x46b564[_0xdec3('0x43')];_0x48e909[_0xdec3('0x44')]=_0x46b564[_0xdec3('0x44')];_0x48e909[_0xdec3('0x45')]=_0x46b564[_0xdec3('0x45')];_0x48e909[_0xdec3('0x46')]=_0x46b564[_0xdec3('0x46')];_0x48e909['predictiveIntervalErlangCalls']=_0x46b564[_0xdec3('0x47')];_0x48e909[_0xdec3('0x48')]=_0x46b564['predictiveIntervalErlangCallsDroppedCalls'];_0x48e909[_0xdec3('0x49')]=_0x46b564[_0xdec3('0x49')];_0x48e909[_0xdec3('0x4a')]=_0x46b564[_0xdec3('0x4a')];_0x48e909[_0xdec3('0x4b')]=_0x46b564[_0xdec3('0x4b')];_0x48e909[_0xdec3('0x4c')]=_0x46b564[_0xdec3('0x4c')];_0x48e909[_0xdec3('0x4d')]=_0x46b564[_0xdec3('0x4d')];_0x48e909['message']=_0x46b564[_0xdec3('0x1a')];_0x48e909[_0xdec3('0x4e')]=_0x46b564['originated'];_0x48e909[_0xdec3('0x4f')]=_0x46b564[_0xdec3('0x4f')];_0x48e909[_0xdec3('0x50')]=_0x46b564[_0xdec3('0x50')];_0x48e909[_0xdec3('0x51')]=_0x46b564[_0xdec3('0x51')];_0x48e909[_0xdec3('0x52')]=_0x46b564[_0xdec3('0x52')];_0x48e909[_0xdec3('0x53')]=_0x46b564[_0xdec3('0x53')];_0x48e909[_0xdec3('0x54')]=_0x46b564[_0xdec3('0x54')];}if(_0x46b564[_0xdec3('0x55')]){_0x48e909[_0xdec3('0x55')]={'id':_0x46b564['Trunk']['id'],'name':_0x46b564[_0xdec3('0x55')][_0xdec3('0xc')],'active':_0x46b564[_0xdec3('0x55')]['active'],'callerid':_0x46b564[_0xdec3('0x55')][_0xdec3('0x56')]};}if(_0x46b564['Interval']){_0x48e909['Interval']={'id':_0x46b564[_0xdec3('0x57')]['id'],'name':_0x46b564[_0xdec3('0x57')][_0xdec3('0xc')]};}_0x33adbb[_0xdec3('0x58')](_0x48e909);}}_0x36c710({'count':_0x33adbb['length'],'rows':_0x33adbb});});},'VoiceChannels':function(_0x15049d){return new Promise(function(_0x182295,_0x44d2e7){var _0x214bb7=_[_0xdec3('0x59')](_0xe2816e[_0xdec3('0x5a')]);_0x182295({'count':_0x214bb7[_0xdec3('0x5b')],'rows':_0x214bb7});});},'VoiceChannelMixMonitor':function(_0x4ed92e){var _0x5db583=this;return new Promise(function(_0x42c7a2,_0x143c19){if(ami[_0xdec3('0x1b')]()==![]){return _0x143c19(_0x5db583['error'](0x1f4,[config[_0xdec3('0x12')]['ip'],config[_0xdec3('0x12')][_0xdec3('0x13')],_0xdec3('0x14')][_0xdec3('0x1c')]('\x20')));}var _0x2e9621=schema(properties['voicechannel'])['validate'](_0x4ed92e);if(_0x2e9621[_0xdec3('0x5b')]>0x0){return _0x143c19(_0x5db583[_0xdec3('0x11')](0x1f4,_['map'](_0x2e9621,_0xdec3('0x1a'))[_0xdec3('0x1c')](',\x20')));}var _0x339f89=_[_0xdec3('0x5c')](_0xe2816e[_0xdec3('0x5a')],{'uniqueid':_0x4ed92e[_0xdec3('0x5d')]});if(_0x339f89&&_0x339f89[_0xdec3('0x5e')]){var _0x1f51f9=util['format']('%s.%s',_0x4ed92e[_0xdec3('0x5f')]||_0x4ed92e['uniqueid'],_0x4ed92e[_0xdec3('0x9')]||_0xdec3('0x60'));return ami['Action']({'action':_0xdec3('0x61'),'channel':_0x339f89[_0xdec3('0x5e')],'file':_0x1f51f9,'options':_0xdec3('0x62')})[_0xdec3('0x1f')](function(_0x43dfa6){var _0x1f937e=_[_0xdec3('0x5c')](_0x339f89[_0xdec3('0x63')],{'filename':_0xdec3('0x64')+_0x1f51f9[_0xdec3('0x65')]()});if(_[_0xdec3('0x66')](_0x1f937e)){_0x339f89['monitors'][_0xdec3('0x58')]({'filename':_0xdec3('0x64')+_0x1f51f9[_0xdec3('0x65')](),'createdAt':moment()['format'](_0xdec3('0x67')),'mixmonitorid':_0x43dfa6[_0xdec3('0x68')],'status':_0xdec3('0x69')});}else{_0x1f937e[_0xdec3('0x68')]=_0x43dfa6[_0xdec3('0x68')];_0x1f937e[_0xdec3('0x6a')]='rec';}_0x42c7a2({'code':0xc8,'message':[_0x4ed92e[_0xdec3('0x5d')],_0xdec3('0x6b'),_0x43dfa6[_0xdec3('0x68')]]['join']('\x20'),'mixmonitorid':_0x43dfa6['mixmonitorid']});})['catch'](function(_0x20d85d){_0x143c19(_0x5db583[_0xdec3('0x11')](0x1f5,[_0x4ed92e[_0xdec3('0x5d')],_0x20d85d['message'][_0xdec3('0x65')]()][_0xdec3('0x1c')]('\x20')));});}else{return _0x143c19(_0x5db583[_0xdec3('0x11')](0x1f5,_0xdec3('0x6c')));}});},'VoiceChannelStopMixMonitor':function(_0x5b5078){var _0x5c5353=this;return new Promise(function(_0x2e9438,_0x4cd5c6){if(ami[_0xdec3('0x1b')]()==![]){return _0x4cd5c6(_0x5c5353[_0xdec3('0x11')](0x1f4,[config[_0xdec3('0x12')]['ip'],config[_0xdec3('0x12')][_0xdec3('0x13')],_0xdec3('0x14')]['join']('\x20')));}var _0x32ca3f=schema(properties[_0xdec3('0x6d')])[_0xdec3('0x3')](_0x5b5078);if(_0x32ca3f[_0xdec3('0x5b')]>0x0){return _0x4cd5c6(_0x5c5353[_0xdec3('0x11')](0x1f4,_[_0xdec3('0x6e')](_0x32ca3f,_0xdec3('0x1a'))[_0xdec3('0x1c')](',\x20')));}var _0x5deb34=_[_0xdec3('0x5c')](_0xe2816e['channels'],{'uniqueid':_0x5b5078['uniqueid']});if(_0x5deb34){return BPromise[_0xdec3('0x6f')]()[_0xdec3('0x1f')](function(){if(_0x5deb34[_0xdec3('0x5e')]){return ami[_0xdec3('0x19')]({'action':_0xdec3('0x70'),'channel':_0x5deb34['channel'],'mixmonitorid':_0x5b5078[_0xdec3('0x68')]})[_0xdec3('0x20')](function(_0x153e0d){});}})[_0xdec3('0x1f')](function(){if(_0x5deb34[_0xdec3('0x71')]){return ami[_0xdec3('0x19')]({'action':_0xdec3('0x70'),'channel':_0x5deb34[_0xdec3('0x71')],'mixmonitorid':_0x5b5078[_0xdec3('0x68')]})[_0xdec3('0x20')](function(_0x53e822){});}})[_0xdec3('0x1f')](function(_0x353abc){var _0x22d6b7=_[_0xdec3('0x5c')](_0x5deb34['monitors'],{'mixmonitorid':_0x5b5078['mixmonitorid']});if(_0x22d6b7){_0x22d6b7['status']=_0xdec3('0x72');}})[_0xdec3('0x1f')](function(){var _0x7459a5=util[_0xdec3('0x9')](_0xdec3('0x73'),_0x5b5078[_0xdec3('0x5f')]||_0x5b5078[_0xdec3('0x5d')],_0x5b5078[_0xdec3('0x9')]||_0xdec3('0x60'));var _0x175f0e=_[_0xdec3('0x5c')](_0x5deb34['monitors'],{'filename':_0xdec3('0x64')+_0x7459a5[_0xdec3('0x65')]()});if(_0x175f0e){_0x175f0e[_0xdec3('0x6a')]=_0xdec3('0x72');}})[_0xdec3('0x1f')](function(){_0x2e9438({'code':0xc8,'message':[_0x5b5078['uniqueid'],_0xdec3('0x74')][_0xdec3('0x1c')]('\x20')});})[_0xdec3('0x20')](function(_0x3de675){_0x4cd5c6(_0x5c5353[_0xdec3('0x11')](0x1f5,[_0x5b5078['uniqueid'],_0x3de675[_0xdec3('0x1a')][_0xdec3('0x65')]()][_0xdec3('0x1c')]('\x20')));});}else{return _0x4cd5c6(_0x5c5353[_0xdec3('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x54185c){return new Promise(function(_0x1cfc28,_0x46f885){var _0x30be1b=_['values'](_0xe2816e['queueChannels']);_0x1cfc28({'count':_0x30be1b[_0xdec3('0x5b')],'rows':_0x30be1b});});},'VoiceQueuesChannel':function(_0x41eeba){var _0x5860d8=this;return new Promise(function(_0x5f05ff,_0xb2a528){var _0x4cbbe1=schema(properties['voicequeuechannel'])[_0xdec3('0x3')](_0x41eeba);if(_0x4cbbe1[_0xdec3('0x5b')]>0x0){return _0xb2a528(_0x5860d8['error'](0x1f4,_[_0xdec3('0x6e')](_0x4cbbe1,_0xdec3('0x1a'))[_0xdec3('0x1c')](',\x20')));}var _0x40632d=_[_0xdec3('0x5c')](_0xe2816e[_0xdec3('0x75')],{'uniqueid':_0x41eeba['uniqueid']});if(_0x40632d){_0x5f05ff(_0x40632d);}else{return _0xb2a528(_0x5860d8[_0xdec3('0x11')](0x1f5,_0xdec3('0x6c')));}});},'VoiceQueuesChannelHangup':function(_0x52e5c0){var _0x45884b=this;return new Promise(function(_0x21d9c7,_0x204575){if(ami['isConnected']()==![]){return _0x204575(_0x45884b['error'](0x1f4,[config[_0xdec3('0x12')]['ip'],config[_0xdec3('0x12')][_0xdec3('0x13')],'ami\x20disconnected'][_0xdec3('0x1c')]('\x20')));}var _0x5c393e=schema(properties[_0xdec3('0x76')])[_0xdec3('0x3')](_0x52e5c0);if(_0x5c393e['length']>0x0){return _0x204575(_0x45884b[_0xdec3('0x11')](0x1f4,_[_0xdec3('0x6e')](_0x5c393e,_0xdec3('0x1a'))['join'](',\x20')));}var _0x4e96c1=_[_0xdec3('0x5c')](_0xe2816e[_0xdec3('0x75')],{'uniqueid':_0x52e5c0[_0xdec3('0x5d')]});if(_0x4e96c1&&_0x4e96c1['channel']){return ami['Action']({'action':_0xdec3('0x77'),'channel':_0x4e96c1[_0xdec3('0x5e')]})[_0xdec3('0x1f')](function(_0x157da7){_0x21d9c7({'code':0xc8,'message':[_0x52e5c0[_0xdec3('0x5d')],_0x157da7['message']['toLowerCase']()][_0xdec3('0x1c')]('\x20')});})[_0xdec3('0x20')](function(_0x42a05e){_0x204575(_0x45884b[_0xdec3('0x11')](0x1f5,[_0x52e5c0[_0xdec3('0x5d')],_0x42a05e[_0xdec3('0x1a')][_0xdec3('0x65')]()][_0xdec3('0x1c')]('\x20')));});}else{return _0x204575(_0x45884b[_0xdec3('0x11')](0x1f5,_0xdec3('0x6c')));}});},'VoiceQueuesChannelRedirect':function(_0xe49a50){var _0xa604bc=this;return new Promise(function(_0x182fc3,_0x4d5fef){if(ami[_0xdec3('0x1b')]()==![]){return _0x4d5fef(_0xa604bc[_0xdec3('0x11')](0x1f4,[config[_0xdec3('0x12')]['ip'],config['asterisk'][_0xdec3('0x13')],'ami\x20disconnected'][_0xdec3('0x1c')]('\x20')));}var _0x465275=schema(properties[_0xdec3('0x78')])['validate'](_0xe49a50);if(_0x465275[_0xdec3('0x5b')]>0x0){return _0x4d5fef(_0xa604bc[_0xdec3('0x11')](0x1f4,_[_0xdec3('0x6e')](_0x465275,_0xdec3('0x1a'))[_0xdec3('0x1c')](',\x20')));}var _0x3e00d9=_['find'](_0xe2816e['queueChannels'],{'uniqueid':_0xe49a50[_0xdec3('0x5d')]});if(_0x3e00d9&&_0x3e00d9[_0xdec3('0x5e')]){return ami[_0xdec3('0x19')]({'action':_0xdec3('0x79'),'channel':_0x3e00d9[_0xdec3('0x5e')],'exten':_0xe49a50[_0xdec3('0x7a')],'context':_0xe49a50[_0xdec3('0x7b')]||_0x3e00d9[_0xdec3('0x7b')],'priority':0x1})[_0xdec3('0x1f')](function(_0x168365){_0x182fc3({'code':0xc8,'message':[_0xe49a50[_0xdec3('0x5d')],_0x168365[_0xdec3('0x1a')]['toLowerCase']()][_0xdec3('0x1c')]('\x20')});})[_0xdec3('0x20')](function(_0x5a5a87){_0x4d5fef(_0xa604bc[_0xdec3('0x11')](0x1f5,[_0xe49a50[_0xdec3('0x5d')],_0x5a5a87[_0xdec3('0x1a')]['toLowerCase']()][_0xdec3('0x1c')]('\x20')));});}else{return _0x4d5fef(_0xa604bc['error'](0x1f5,_0xdec3('0x6c')));}});},'Agents':function(_0x4330ce){return new Promise(function(_0x54c6fd,_0x565113){var _0x511f5c=_[_0xdec3('0x59')](_0xe2816e[_0xdec3('0xf')]);_0x54c6fd({'count':_0x511f5c['length'],'rows':_0x511f5c});});},'Telephones':function(_0x136a6d){return new Promise(function(_0x7c9b48,_0x5b4fa3){var _0xf26c0f=_[_0xdec3('0x59')](_0xe2816e[_0xdec3('0x7c')]);_0x7c9b48({'count':_0xf26c0f[_0xdec3('0x5b')],'rows':_0xf26c0f});});},'Trunks':function(_0x20c8c8){return new Promise(function(_0x45ea96,_0x17c199){var _0x269c64=_[_0xdec3('0x59')](_0xe2816e[_0xdec3('0x7d')]);_0x45ea96({'count':_0x269c64[_0xdec3('0x5b')],'rows':_0x269c64});});},'OutboundChannels':function(_0x47c546){return new Promise(function(_0x2c32eb,_0x3a56ad){var _0x5dd6bb=_['values'](_0xe2816e[_0xdec3('0x7e')]);_0x2c32eb({'count':_0x5dd6bb[_0xdec3('0x5b')],'rows':_0x5dd6bb});});},'Outbound':function(_0x1dc5c6){return new Promise(function(_0xeb02ad,_0xd982bc){_0xeb02ad(_0xe2816e[_0xdec3('0x2d')]);});},'Campaigns':function(_0x175439){return new Promise(function(_0x48b75e,_0x437e3e){var _0x196d86=_['values'](_0xe2816e[_0xdec3('0x7f')]);_0x48b75e({'count':_0x196d86[_0xdec3('0x5b')],'rows':_0x196d86});});},'VoiceQueuesPreview':function(_0x38903f){var _0x763cff=this;return new Promise(function(_0x15ae84,_0x57fe29){_0x4ce04c['run'](_0x38903f['id'])['then'](function(_0x44ed8a){_0x15ae84({'code':0xc8,'message':_0x44ed8a[_0xdec3('0x1a')]});})[_0xdec3('0x20')](function(_0x549eab){_0x57fe29(_0x763cff['error'](0x1f4,_0x549eab[_0xdec3('0x1a')]));});});},'EventManager':function(_0x4bf115){var _0x5c2eb1=this;return new Promise(function(_0x579a82,_0x2807d2){if(!_0x4bf115['event']){return _0x2807d2(_0x5c2eb1[_0xdec3('0x11')](0x1f4,_0xdec3('0x80')));}ami[_0xdec3('0x81')](_0xdec3('0x82')+_0x4bf115[_0xdec3('0x83')],_0x4bf115[_0xdec3('0x1a')]);_0x579a82({'code':0xc8,'message':_0x4bf115});});},'FaxAccounts':function(_0x4f3fef){return new Promise(function(_0x4d5d31,_0x309747){var _0x43111c=_['values'](_0xe2816e[_0xdec3('0x84')]);_0x4d5d31({'count':_0x43111c[_0xdec3('0x5b')],'rows':_0x43111c});});},'SendFax':function(_0x5f339a){var _0x277286=this;return new Promise(function(_0x9a8037,_0x578a14){_0x380275[_0xdec3('0x85')](_0x5f339a)[_0xdec3('0x1f')](function(_0x3e3b1a){_0x9a8037({'code':0xc8,'message':_0x3e3b1a[_0xdec3('0x1a')]});})[_0xdec3('0x20')](function(_0x15afa4){_0x578a14(_0x277286['error'](0x1f4,_0x15afa4[_0xdec3('0x1a')]));});});},'CheckAfterSend':function(_0x1141f0){var _0xee189b=this;return new Promise(function(_0x393181,_0xbf5782){_0x380275[_0xdec3('0x86')](_0x1141f0)['then'](function(_0x126fd4){_0x393181({'code':0xc8,'message':_0x126fd4[_0xdec3('0x1a')]});})['catch'](function(_0x4198b7){_0xbf5782(_0xee189b[_0xdec3('0x11')](0x1f4,_0x4198b7[_0xdec3('0x1a')]));});});}};var _0x1eb3c5=jayson[_0xdec3('0x87')](_0x55677b)[_0xdec3('0x88')]();_0x1eb3c5['on'](_0xdec3('0x11'),function(_0xb0dfcd){return _0x294ac0(_0xb0dfcd);});_0x1eb3c5['listen'](0x232a,_0xdec3('0x89'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x5ee0c5(_0xdec3('0x8a')+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 369cde3..636b2bc 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 _0xac41=['toLowerCase','createContact','trigger:%s','error','Error\x20creating\x20contact','merge','bluebird','util','lodash','ioredis','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','defaults','redis','localhost','socket.io-emitter','info','stringify','emit','exec','autoCreate','data2','data1','calleridnum','routeId','firstName','calleridname','uniqueid','destcalleridname','','phone','destcalleridnum','resolve','then','showContact','omit','xmd-contactid2','format','user:%s','name','action'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xac41,0xdd));var _0x1ac4=function(_0x242a9d,_0x145834){_0x242a9d=_0x242a9d-0x0;var _0x344ba7=_0xac41[_0x242a9d];return _0x344ba7;};'use strict';var BPromise=require(_0x1ac4('0x0'));var util=require(_0x1ac4('0x1'));var _=require(_0x1ac4('0x2'));var Redis=require(_0x1ac4('0x3'));var config=require(_0x1ac4('0x4'));var logger=require(_0x1ac4('0x5'))(_0x1ac4('0x6'));var cmContactRpc=require(_0x1ac4('0x7'));config['redis']=_[_0x1ac4('0x8')](config[_0x1ac4('0x9')],{'host':_0x1ac4('0xa'),'port':0x18eb});var io=require(_0x1ac4('0xb'))(new Redis(config[_0x1ac4('0x9')]));function emit(_0x2ad173,_0x18703d,_0x1c9bed){logger[_0x1ac4('0xc')](_0x2ad173,_0x18703d,JSON[_0x1ac4('0xd')](_0x1c9bed));io['to'](_0x2ad173)[_0x1ac4('0xe')](_0x18703d,_0x1c9bed);}exports[_0x1ac4('0xf')]=function(_0x454972,_0x4590a1,_0x3a8514){_0x3a8514[_0x1ac4('0x10')]=0x0;if(_0x4590a1['data2']&&parseInt(_0x4590a1[_0x1ac4('0x11')],0xa)){var _0x550dc0={'ListId':parseInt(_0x4590a1[_0x1ac4('0x12')],0xa),'phone':_0x3a8514[_0x1ac4('0x13')]};if(_['isNil'](_0x3a8514[_0x1ac4('0x14')])){_0x550dc0[_0x1ac4('0x15')]=_0x3a8514['calleridname']&&_0x3a8514[_0x1ac4('0x16')]!==''?_0x3a8514['calleridname']:_0x3a8514['calleridnum']||_0x3a8514[_0x1ac4('0x17')];}else{_0x550dc0[_0x1ac4('0x15')]=_0x3a8514[_0x1ac4('0x18')]&&_0x3a8514[_0x1ac4('0x18')]!==_0x1ac4('0x19')?_0x3a8514[_0x1ac4('0x18')]:_0x3a8514['destcalleridnum']||_0x3a8514['uniqueid'];_0x550dc0[_0x1ac4('0x1a')]=_0x3a8514[_0x1ac4('0x18')]&&_0x3a8514[_0x1ac4('0x18')]!==''?_0x3a8514[_0x1ac4('0x18')]:_0x3a8514[_0x1ac4('0x1b')]||_0x3a8514[_0x1ac4('0x17')];}BPromise[_0x1ac4('0x1c')]()[_0x1ac4('0x1d')](cmContactRpc[_0x1ac4('0x1e')]({'where':_[_0x1ac4('0x1f')](_0x550dc0,['firstName'])}))['then'](function(_0x9c8678){if(_0x9c8678){_0x3a8514[_0x1ac4('0x20')]=_0x9c8678['id'];emit(util[_0x1ac4('0x21')](_0x1ac4('0x22'),_0x454972[_0x1ac4('0x23')]),util['format']('trigger:%s',_0x4590a1[_0x1ac4('0x24')][_0x1ac4('0x25')]()),_['merge'](_0x3a8514,{'ListId':parseInt(_0x4590a1[_0x1ac4('0x12')],0xa)}));return;}else{return BPromise[_0x1ac4('0x1c')]()[_0x1ac4('0x1d')](cmContactRpc[_0x1ac4('0x26')](_0x550dc0));}})['then'](function(_0x2f1f67){if(_0x2f1f67){_0x3a8514[_0x1ac4('0x20')]=_0x2f1f67['id'];emit(util['format'](_0x1ac4('0x22'),_0x454972['name']),util[_0x1ac4('0x21')](_0x1ac4('0x27'),_0x4590a1[_0x1ac4('0x24')][_0x1ac4('0x25')]()),_['merge'](_0x3a8514,{'ListId':parseInt(_0x4590a1[_0x1ac4('0x12')],0xa)}));}})['catch'](function(_0x289579){logger[_0x1ac4('0x28')](_0x1ac4('0x29'),JSON[_0x1ac4('0xd')](_0x289579));});}else{if(_0x454972){emit(util[_0x1ac4('0x21')](_0x1ac4('0x22'),_0x454972[_0x1ac4('0x23')]),util[_0x1ac4('0x21')](_0x1ac4('0x27'),_0x4590a1[_0x1ac4('0x24')][_0x1ac4('0x25')]()),_[_0x1ac4('0x2a')]({'ListId':parseInt(_0x4590a1[_0x1ac4('0x12')],0xa)},_0x3a8514));}}}; \ No newline at end of file +var _0x6bab=['xmd-contactid2','format','user:%s','name','trigger:%s','action','toLowerCase','merge','resolve','createContact','error','bluebird','util','lodash','ioredis','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','info','stringify','emit','exec','data1','calleridnum','routeId','firstName','calleridname','','uniqueid','destcalleridname','destcalleridnum','phone','then','showContact'];(function(_0x5c0ff6,_0x22cdd2){var _0x1135cd=function(_0x55d5b0){while(--_0x55d5b0){_0x5c0ff6['push'](_0x5c0ff6['shift']());}};_0x1135cd(++_0x22cdd2);}(_0x6bab,0x1c7));var _0xb6ba=function(_0x5ce3c8,_0x2503bd){_0x5ce3c8=_0x5ce3c8-0x0;var _0xa76867=_0x6bab[_0x5ce3c8];return _0xa76867;};'use strict';var BPromise=require(_0xb6ba('0x0'));var util=require(_0xb6ba('0x1'));var _=require(_0xb6ba('0x2'));var Redis=require(_0xb6ba('0x3'));var config=require('../../../../config/environment');var logger=require(_0xb6ba('0x4'))(_0xb6ba('0x5'));var cmContactRpc=require(_0xb6ba('0x6'));config[_0xb6ba('0x7')]=_[_0xb6ba('0x8')](config['redis'],{'host':_0xb6ba('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb6ba('0x7')]));function emit(_0x389a0d,_0x3fd283,_0xbce6f){logger[_0xb6ba('0xa')](_0x389a0d,_0x3fd283,JSON[_0xb6ba('0xb')](_0xbce6f));io['to'](_0x389a0d)[_0xb6ba('0xc')](_0x3fd283,_0xbce6f);}exports[_0xb6ba('0xd')]=function(_0x36bdc2,_0x5ae28b,_0x16cb3a){_0x16cb3a['autoCreate']=0x0;if(_0x5ae28b['data2']&&parseInt(_0x5ae28b['data2'],0xa)){var _0x31e74b={'ListId':parseInt(_0x5ae28b[_0xb6ba('0xe')],0xa),'phone':_0x16cb3a[_0xb6ba('0xf')]};if(_['isNil'](_0x16cb3a[_0xb6ba('0x10')])){_0x31e74b[_0xb6ba('0x11')]=_0x16cb3a[_0xb6ba('0x12')]&&_0x16cb3a[_0xb6ba('0x12')]!==_0xb6ba('0x13')?_0x16cb3a[_0xb6ba('0x12')]:_0x16cb3a[_0xb6ba('0xf')]||_0x16cb3a[_0xb6ba('0x14')];}else{_0x31e74b[_0xb6ba('0x11')]=_0x16cb3a[_0xb6ba('0x15')]&&_0x16cb3a[_0xb6ba('0x15')]!==_0xb6ba('0x13')?_0x16cb3a[_0xb6ba('0x15')]:_0x16cb3a[_0xb6ba('0x16')]||_0x16cb3a[_0xb6ba('0x14')];_0x31e74b[_0xb6ba('0x17')]=_0x16cb3a[_0xb6ba('0x15')]&&_0x16cb3a[_0xb6ba('0x15')]!==_0xb6ba('0x13')?_0x16cb3a['destcalleridname']:_0x16cb3a[_0xb6ba('0x16')]||_0x16cb3a['uniqueid'];}BPromise['resolve']()[_0xb6ba('0x18')](cmContactRpc[_0xb6ba('0x19')]({'where':_['omit'](_0x31e74b,[_0xb6ba('0x11')])}))[_0xb6ba('0x18')](function(_0x53b217){if(_0x53b217){_0x16cb3a[_0xb6ba('0x1a')]=_0x53b217['id'];emit(util[_0xb6ba('0x1b')](_0xb6ba('0x1c'),_0x36bdc2[_0xb6ba('0x1d')]),util[_0xb6ba('0x1b')](_0xb6ba('0x1e'),_0x5ae28b[_0xb6ba('0x1f')][_0xb6ba('0x20')]()),_[_0xb6ba('0x21')](_0x16cb3a,{'ListId':parseInt(_0x5ae28b[_0xb6ba('0xe')],0xa)}));return;}else{return BPromise[_0xb6ba('0x22')]()[_0xb6ba('0x18')](cmContactRpc[_0xb6ba('0x23')](_0x31e74b));}})[_0xb6ba('0x18')](function(_0x164bd2){if(_0x164bd2){_0x16cb3a[_0xb6ba('0x1a')]=_0x164bd2['id'];emit(util['format']('user:%s',_0x36bdc2[_0xb6ba('0x1d')]),util['format'](_0xb6ba('0x1e'),_0x5ae28b[_0xb6ba('0x1f')][_0xb6ba('0x20')]()),_[_0xb6ba('0x21')](_0x16cb3a,{'ListId':parseInt(_0x5ae28b[_0xb6ba('0xe')],0xa)}));}})['catch'](function(_0x5ce5d7){logger[_0xb6ba('0x24')]('Error\x20creating\x20contact',JSON[_0xb6ba('0xb')](_0x5ce5d7));});}else{if(_0x36bdc2){emit(util[_0xb6ba('0x1b')](_0xb6ba('0x1c'),_0x36bdc2[_0xb6ba('0x1d')]),util[_0xb6ba('0x1b')](_0xb6ba('0x1e'),_0x5ae28b[_0xb6ba('0x1f')][_0xb6ba('0x20')]()),_['merge']({'ListId':parseInt(_0x5ae28b[_0xb6ba('0xe')],0xa)},_0x16cb3a));}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 3d5aa1d..e1fcd92 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 _0x5039=['custom:rejectmessage','prototype','emit','info','stringify','checkTriggers','status','checkTrigger','merge','variables','length','Actions','interface','toLowerCase','contactmanager','motionbar','data1','TemplateId','data2','html','render','template\x20not\x20found','uri','buildUri','isNil','data4','location','uriLocation','windowWidth','data5','800','windowHeight','600','data6','winapp','winApplication','winArguments','data3','format','user:%s','name','trigger:%s:%s','action','jscripty','trigger:%s','exec','integration','voiceQueues','queue','routeId','script','parse','query','search','replace','AllConditions','every','channel','AnyConditions','some','checkConditions','field','account','chat','operator','ChatWebsiteId','upperFirst','AccountId','message','value','event','membername','lastevent','exports','util','lodash','url','mustache','ioredis','./urlforward','./integration','./cmContact','./script','../rpc/cmContact','../../../config/environment','trigger','../ami','redis','socket.io-emitter','popup','triggers','agents','templates','voiceExtensions','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:queuecallerabandon','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:outgoingmessage','custom:acceptmessage'];(function(_0x4d73e2,_0x1c9c59){var _0x28d8e5=function(_0x15cf71){while(--_0x15cf71){_0x4d73e2['push'](_0x4d73e2['shift']());}};_0x28d8e5(++_0x1c9c59);}(_0x5039,0x136));var _0x9503=function(_0x531e48,_0x4bb96b){_0x531e48=_0x531e48-0x0;var _0x202971=_0x5039[_0x531e48];return _0x202971;};'use strict';var util=require(_0x9503('0x0'));var _=require(_0x9503('0x1'));var url=require(_0x9503('0x2'));var Mustache=require(_0x9503('0x3'));var Redis=require(_0x9503('0x4'));var urlforward=require(_0x9503('0x5'));var integration=require(_0x9503('0x6'));var cmContact=require(_0x9503('0x7'));var script=require(_0x9503('0x8'));var cmContactRpc=require(_0x9503('0x9'));var config=require(_0x9503('0xa'));var logger=require('../../../config/logger')(_0x9503('0xb'));var ami=require(_0x9503('0xc'));config[_0x9503('0xd')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x9503('0xe'))(new Redis(config[_0x9503('0xd')]));var operators={'equals':function(_0x3454d8,_0x44f1b4){return _0x3454d8==_0x44f1b4;},'not_equals':function(_0xf1e8d,_0x274fdf){return _0xf1e8d!=_0x274fdf;}};var barAndWebActions=[_0x9503('0xf'),_0x9503('0x2'),'winapp'];function Trigger(_0x10ac09){this[_0x9503('0x10')]=_0x10ac09['triggers'];this['agents']=_0x10ac09[_0x9503('0x11')];this['voiceQueues']=_0x10ac09['voiceQueues'];this[_0x9503('0x12')]=_0x10ac09[_0x9503('0x12')];this[_0x9503('0x13')]=_0x10ac09['voiceExtensions'];this[_0x9503('0x14')]=_0x10ac09[_0x9503('0x14')];this['freshdeskAccounts']=_0x10ac09['freshdeskAccounts'];this[_0x9503('0x15')]=_0x10ac09['salesforceAccounts'];this['sugarcrmAccounts']=_0x10ac09[_0x9503('0x16')];this[_0x9503('0x17')]=_0x10ac09[_0x9503('0x17')];this['deskAccounts']=_0x10ac09[_0x9503('0x18')];this[_0x9503('0x19')]=_0x10ac09[_0x9503('0x19')];this[_0x9503('0x1a')]=_0x10ac09[_0x9503('0x1a')];this[_0x9503('0x1b')]=_0x10ac09[_0x9503('0x1b')];this[_0x9503('0x1c')]=_0x10ac09[_0x9503('0x1c')];this[_0x9503('0x1d')]={'zendesk':this[_0x9503('0x14')],'salesforce':this[_0x9503('0x15')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0x9503('0x16')],'zoho':this['zohoAccounts'],'desk':this[_0x9503('0x18')],'vtiger':this[_0x9503('0x19')],'dynamics365':this[_0x9503('0x1b')],'freshsales':this[_0x9503('0x1c')],'servicenow':this[_0x9503('0x1a')]};ami['on'](_0x9503('0x1e'),this[_0x9503('0x1f')][_0x9503('0x20')](this));ami['on'](_0x9503('0x21'),this[_0x9503('0x1f')][_0x9503('0x20')](this));ami['on'](_0x9503('0x22'),this[_0x9503('0x1f')][_0x9503('0x20')](this));ami['on'](_0x9503('0x23'),this[_0x9503('0x1f')][_0x9503('0x20')](this));ami['on'](_0x9503('0x24'),this[_0x9503('0x1f')]['bind'](this));ami['on']('custom:dialbegin',this[_0x9503('0x25')][_0x9503('0x20')](this));ami['on'](_0x9503('0x26'),this['syncAgentDial'][_0x9503('0x20')](this));ami['on'](_0x9503('0x27'),this[_0x9503('0x25')][_0x9503('0x20')](this));ami['on'](_0x9503('0x28'),this[_0x9503('0x1f')][_0x9503('0x20')](this));ami['on'](_0x9503('0x29'),this[_0x9503('0x1f')]['bind'](this));ami['on']('custom:incomingmessage',this['syncCustomEvent']['bind'](this));ami['on'](_0x9503('0x2a'),this[_0x9503('0x1f')][_0x9503('0x20')](this));ami['on'](_0x9503('0x2b'),this[_0x9503('0x1f')][_0x9503('0x20')](this));ami['on'](_0x9503('0x2c'),this[_0x9503('0x1f')][_0x9503('0x20')](this));}Trigger[_0x9503('0x2d')][_0x9503('0x2e')]=function(_0x3ab42e,_0x233370,_0x313eae){logger[_0x9503('0x2f')](_0x3ab42e,_0x233370,JSON[_0x9503('0x30')](_0x313eae));io['to'](_0x3ab42e)[_0x9503('0x2e')](_0x233370,_0x313eae);};Trigger[_0x9503('0x2d')]['syncCustomEvent']=function(_0x469a36){var _0x3e35b1=_['clone'](_0x469a36);this[_0x9503('0x31')](_0x3e35b1);};Trigger['prototype'][_0x9503('0x25')]=function(_0x3aa838){if(this[_0x9503('0x11')][_0x3aa838['interface']]){this[_0x9503('0x1f')](_0x3aa838);}};Trigger[_0x9503('0x2d')]['checkTriggers']=function(_0x5526a1){var _0x5f0403;for(var _0x288262 in this[_0x9503('0x10')]){if(this[_0x9503('0x10')]['hasOwnProperty'](_0x288262)){if(this[_0x9503('0x10')][_0x288262][_0x9503('0x32')]){_0x5f0403=this[_0x9503('0x33')](this[_0x9503('0x10')][_0x288262],_0x5526a1);if(_0x5f0403){_[_0x9503('0x34')](_0x5526a1,_0x5526a1[_0x9503('0x35')]);for(var _0x2a416d=0x0,_0xb3a836,_0x48434e,_0x41d635;_0x2a416d0x0){_0x429fd8=_[_0xc3f8('0x27')](_0x394629,_0x238ff5);}return _0x429fd8;}function getCustomFields(_0x2909f8,_0x218029){var _0x5bf6e2=[];var _0x151bba={'custom_fields':{}};if(_0x2909f8['length']>0x0){_[_0xc3f8('0x28')](_0x2909f8,function(_0x32343e){if(_0x32343e['type']==='string'&&_0x32343e[_0xc3f8('0x29')]&&!_0x32343e[_0xc3f8('0x2a')]){_0x151bba[_0x32343e[_0xc3f8('0x29')][_0xc3f8('0x2b')]()]=_0x32343e[_0xc3f8('0x2c')][_0xc3f8('0x1f')]();}else if(_0x32343e[_0xc3f8('0x2d')]===_0xc3f8('0x2e')&&_0x32343e[_0xc3f8('0x2f')]&&_0x32343e[_0xc3f8('0x2a')]){_0x151bba['custom_fields'][_0x32343e[_0xc3f8('0x2f')]]=_0x32343e[_0xc3f8('0x2c')][_0xc3f8('0x1f')]();}else if(_0x32343e[_0xc3f8('0x2d')]===_0xc3f8('0x30')&&_0x32343e['variableName']&&_0x32343e['idField']&&_0x32343e[_0xc3f8('0x2a')]){_0x218029[_0x32343e[_0xc3f8('0x31')]]&&(_0x151bba[_0xc3f8('0x32')][_0x32343e[_0xc3f8('0x2f')]]=_0x218029[_0x32343e[_0xc3f8('0x31')]]['toString']());}else if(_0x32343e[_0xc3f8('0x2d')]===_0xc3f8('0x33')&&_0x32343e[_0xc3f8('0x34')]&&_0x32343e['Variable'][_0xc3f8('0x35')]&&_0x32343e[_0xc3f8('0x2f')]&&_0x32343e[_0xc3f8('0x2a')]){_0x218029[_0x32343e['Variable'][_0xc3f8('0x35')][_0xc3f8('0x2b')]()]&&(_0x151bba['custom_fields'][_0x32343e[_0xc3f8('0x2f')]]=_0x218029[_0x32343e[_0xc3f8('0x34')][_0xc3f8('0x35')][_0xc3f8('0x2b')]()][_0xc3f8('0x1f')]());}});}if(_0x151bba[_0xc3f8('0x36')]){_0x151bba['priority']=Number(_0x151bba[_0xc3f8('0x36')]);}return _0x151bba;}function getTicket(_0x2e4880,_0x2d3129,_0x2f589d,_0x17aff0,_0x502293){logger[_0xc3f8('0xa')](_0xc3f8('0x37'));var _0xaa4c98=_['merge']({'subject':intUtil[_0xc3f8('0x38')](_0x17aff0[_0xc3f8('0x39')],_0x502293,'\x20'),'type':_0xc3f8('0x3a'),'status':_0xc3f8('0x3b'),'labels':['xCALLY',_0xc3f8('0x3c'),_0xc3f8('0x3d')][_0xc3f8('0x3e')](getTags(_0x17aff0[_0xc3f8('0x3f')],'name')),'description':intUtil[_0xc3f8('0x38')](_0x17aff0['Descriptions'],_0x502293,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xc3f8('0x40'),_0x2d3129['id']),'class':_0xc3f8('0x41')}},'message':{'direction':'in','body':intUtil[_0xc3f8('0x38')](_0x17aff0[_0xc3f8('0x42')],_0x502293,'\x0a')}},getCustomFields(_0x17aff0['Fields'],_0x502293));return request({'uri':util['format'](_0xc3f8('0x43'),_0x2e4880[_0xc3f8('0xd')],_0x2f589d['id']),'method':_0xc3f8('0x25'),'body':_0xaa4c98});}exports[_0xc3f8('0x44')]=function(_0x3e98b2,_0x465547,_0x3113b4,_0x45e6ea,_0x13d8dc,_0x34bccd){var _0x51dd7f,_0x5f4809;_0x34bccd[_0xc3f8('0xd')]=intUtil[_0xc3f8('0x45')](_0x34bccd['remoteUri']);_0x34bccd[_0xc3f8('0x46')]=intUtil[_0xc3f8('0x45')](_0x34bccd['serverUrl']);if(_0x13d8dc&&_0x13d8dc[_0xc3f8('0x47')]){logger[_0xc3f8('0xa')](_0xc3f8('0x48'),_0xc3f8('0x49'));_0x465547[_0xc3f8('0x4a')]=util[_0xc3f8('0xb')](_0xc3f8('0x4b'),_0x34bccd[_0xc3f8('0x46')],_0x465547[_0xc3f8('0x4c')],md5(_0x465547[_0xc3f8('0x4c')]));}else{_0x465547[_0xc3f8('0x4a')]='';}headers['Authorization']=getAuth(_0x34bccd);return getUser(_0x34bccd,_0x45e6ea[_0xc3f8('0x4d')])[_0xc3f8('0xe')](function(_0x589bb5){_0x51dd7f=_0x589bb5;logger[_0xc3f8('0xa')](_0xc3f8('0x4e'),_0x51dd7f['id']);return getEndUser(_0x34bccd,_0x465547[_0xc3f8('0x4f')],_0x465547[_0xc3f8('0x50')]);})['then'](function(_0x4d80e4){_0x5f4809=_0x4d80e4;logger[_0xc3f8('0xa')](_0xc3f8('0x51'),_0x5f4809['id']);return getTicket(_0x34bccd,_0x51dd7f,_0x5f4809,_0x3113b4,_0x465547);})[_0xc3f8('0xe')](function(_0x5c08a9){if(_0x5c08a9){logger[_0xc3f8('0xa')](_0xc3f8('0x52'));logger[_0xc3f8('0xa')](_0xc3f8('0x53'),_0x5c08a9['id']);switch(_0x34bccd[_0xc3f8('0x2d')]){case'integrationTab':logger[_0xc3f8('0xa')](_0xc3f8('0x48'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xc3f8('0xb')](_0xc3f8('0x54'),_0x45e6ea[_0xc3f8('0x35')]),_0xc3f8('0x55'),{'recordId':_0x5c08a9['id']});break;case _0xc3f8('0x56'):logger[_0xc3f8('0xa')](_0xc3f8('0x48'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xc3f8('0xb')](_0xc3f8('0x54'),_0x45e6ea['name']),_0xc3f8('0x57'),{'uri':util[_0xc3f8('0xb')](_0xc3f8('0x58'),_0x5c08a9['id'])});break;default:logger[_0xc3f8('0x59')](_0xc3f8('0x48'),_0xc3f8('0x5a'));}}})[_0xc3f8('0x5b')](function(_0x4d58b2){console[_0xc3f8('0x59')](_0x4d58b2);logger[_0xc3f8('0x59')](_0xc3f8('0x48'),JSON[_0xc3f8('0x5c')](_0x4d58b2));});};exports[_0xc3f8('0x5d')]=function(_0x3d752a,_0x97a88e,_0x920f4b,_0x4fc02c,_0x51249a,_0x30cec2,_0x206a57){var _0x47fa71,_0x544947;_0x30cec2[_0xc3f8('0xd')]=intUtil['stripTrailingSlash'](_0x30cec2[_0xc3f8('0xd')]);_0x30cec2[_0xc3f8('0x46')]=intUtil[_0xc3f8('0x45')](_0x30cec2['serverUrl']);if(_0x206a57&&_0x206a57[_0xc3f8('0x5e')]&&_0x206a57['recordingFormat']!=='none'){logger[_0xc3f8('0xa')]('[OUTBOUND]',_0xc3f8('0x49'));_0x97a88e[_0xc3f8('0x4a')]=util[_0xc3f8('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x30cec2[_0xc3f8('0x46')],_0x97a88e[_0xc3f8('0x4c')],md5(_0x97a88e[_0xc3f8('0x4c')]));}headers[_0xc3f8('0x5f')]=getAuth(_0x30cec2);return getUser(_0x30cec2,_0x4fc02c[_0xc3f8('0x4d')])['then'](function(_0x5ced29){_0x47fa71=_0x5ced29;logger[_0xc3f8('0xa')](_0xc3f8('0x4e'),_0x47fa71['id']);return getEndUser(_0x30cec2,_0x97a88e[_0xc3f8('0x60')],_0x97a88e[_0xc3f8('0x61')]);})[_0xc3f8('0xe')](function(_0x5ef0f1){_0x544947=_0x5ef0f1;logger[_0xc3f8('0xa')]('The\x20Enduser\x20ID\x20is:',_0x544947['id']);return getTicket(_0x30cec2,_0x47fa71,_0x544947,_0x920f4b,_0x97a88e);})[_0xc3f8('0xe')](function(_0x337029){if(_0x337029){logger[_0xc3f8('0xa')](_0xc3f8('0x52'));logger['info'](_0xc3f8('0x53'),_0x337029['id']);switch(_0x30cec2['type']){case'integrationTab':logger['info']('[QUEUE]',_0xc3f8('0x62'));emit(util[_0xc3f8('0xb')](_0xc3f8('0x54'),_0x4fc02c[_0xc3f8('0x35')]),_0xc3f8('0x55'),{'recordId':_0x337029['id']});break;case _0xc3f8('0x56'):logger[_0xc3f8('0xa')](_0xc3f8('0x48'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xc3f8('0xb')](_0xc3f8('0x54'),_0x4fc02c[_0xc3f8('0x35')]),_0xc3f8('0x57'),{'uri':util[_0xc3f8('0xb')]('%s/agent/tickets/%s',_0x30cec2[_0xc3f8('0xd')],_0x337029['id'])});break;default:logger[_0xc3f8('0x59')](_0xc3f8('0x63'),_0xc3f8('0x5a'));}}})[_0xc3f8('0x5b')](function(_0x55ed7a){logger[_0xc3f8('0x59')](_0xc3f8('0x63'),JSON[_0xc3f8('0x5c')](_0x55ed7a));});};exports[_0xc3f8('0x64')]=function(_0x3a7702,_0x284216,_0x56fd61,_0x2f199d,_0x4ca426,_0x9c7956){var _0x5e3f96,_0x20cebe;_0x9c7956[_0xc3f8('0xd')]=intUtil['stripTrailingSlash'](_0x9c7956['remoteUri']);_0x9c7956[_0xc3f8('0x46')]=intUtil[_0xc3f8('0x45')](_0x9c7956['serverUrl']);if(_0x4ca426&&_0x4ca426[_0xc3f8('0x47')]){logger[_0xc3f8('0xa')](_0xc3f8('0x65'),_0xc3f8('0x49'));_0x284216[_0xc3f8('0x4a')]=util[_0xc3f8('0xb')](_0xc3f8('0x4b'),_0x9c7956[_0xc3f8('0x46')],_0x284216['uniqueid'],md5(_0x284216['uniqueid']));}else{_0x284216[_0xc3f8('0x4a')]='';}headers['Authorization']=getAuth(_0x9c7956);return getUser(_0x9c7956)['then'](function(_0x4a8a41){_0x5e3f96=_0x4a8a41;logger['info']('The\x20User\x20ID\x20is:',_0x5e3f96['id']);return getEndUser(_0x9c7956,_0x284216[_0xc3f8('0x4f')],_0x284216[_0xc3f8('0x50')]);})[_0xc3f8('0xe')](function(_0x1a34fd){_0x20cebe=_0x1a34fd;logger['info'](_0xc3f8('0x51'),_0x20cebe['id']);return getTicket(_0x9c7956,_0x5e3f96,_0x20cebe,_0x56fd61,_0x284216);})[_0xc3f8('0xe')](function(_0x5d6208){if(_0x5d6208){logger[_0xc3f8('0xa')](_0xc3f8('0x52'));logger[_0xc3f8('0xa')]('The\x20Ticket\x20ID\x20is:',_0x5d6208['id']);}})[_0xc3f8('0x5b')](function(_0x5e3125){logger['error']('[ABANDONED]',JSON[_0xc3f8('0x5c')](_0x5e3125));});}; \ No newline at end of file +var _0x282b=['Subjects','new','Motion','CTI','Tags','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','uniqueid','Authorization','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','trigger:browser:url','catch','[OUTBOUND]','[ABANDONED]','calleridnum','The\x20Enduser\x20ID\x20is:','lodash','request-promise','md5','util','ioredis','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','application/json','validateEmail','format','%s/users','remoteUri','then','_embedded','entries','info','%s/users/me','debug','stringify','GET','%s:%s','password','authType','token','%s/token:%s','Basic\x20%s','base64','%s/customers/search','total_entries','Enduser\x20found!','%s/customers','POST','work','length','map','type','string','nameField','customField','toLowerCase','toString','idField','content','variable','variableName','name','Variable','custom_fields','priority','merge','getString'];(function(_0x38014c,_0x2124a5){var _0x235133=function(_0x2d8714){while(--_0x2d8714){_0x38014c['push'](_0x38014c['shift']());}};_0x235133(++_0x2124a5);}(_0x282b,0xec));var _0xb282=function(_0x4ff00d,_0x214a0f){_0x4ff00d=_0x4ff00d-0x0;var _0x7b89b7=_0x282b[_0x4ff00d];return _0x7b89b7;};'use strict';var _=require(_0xb282('0x0'));var rp=require(_0xb282('0x1'));var md5=require(_0xb282('0x2'));var util=require(_0xb282('0x3'));var Redis=require(_0xb282('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xb282('0x5'))('desk');config[_0xb282('0x6')]=_[_0xb282('0x7')](config[_0xb282('0x6')],{'host':_0xb282('0x8'),'port':0x18eb});var io=require(_0xb282('0x9'))(new Redis(config[_0xb282('0x6')]));function emit(_0x4f0410,_0x4a0d28,_0x17fba1){io['to'](_0x4f0410)[_0xb282('0xa')](_0x4a0d28,_0x17fba1);}var headers={'Content-Type':'application/json','Accept':_0xb282('0xb')};function getUser(_0x20f517,_0x3435fc){if(intUtil[_0xb282('0xc')](_0x3435fc)===!![]){logger['info']('Getting\x20agent\x20with\x20email',_0x3435fc);return request({'uri':util[_0xb282('0xd')](_0xb282('0xe'),_0x20f517[_0xb282('0xf')])})[_0xb282('0x10')](function(_0x8c4621){if(_0x8c4621['total_entries']){return _['find'](_0x8c4621[_0xb282('0x11')][_0xb282('0x12')],{'email':_0x3435fc});}})[_0xb282('0x10')](function(_0x9e9072){if(_0x9e9072){logger[_0xb282('0x13')]('Agent\x20found!');return _0x9e9072;}else{logger[_0xb282('0x13')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xb282('0xd')](_0xb282('0x14'),_0x20f517['remoteUri'])});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xb282('0xd')](_0xb282('0x14'),_0x20f517[_0xb282('0xf')])});}}function request(_0xbb182){logger[_0xb282('0x15')]('[HTTP]',JSON[_0xb282('0x16')](_0xbb182));return rp(_[_0xb282('0x7')](_0xbb182,{'method':_0xb282('0x17'),'headers':headers,'json':!![]}));}function getAuth(_0x45b070){var _0x3f8a3f;if(_0x45b070['authType']==='basic'){_0x3f8a3f=util[_0xb282('0xd')](_0xb282('0x18'),_0x45b070['username'],_0x45b070[_0xb282('0x19')]);}else if(_0x45b070[_0xb282('0x1a')]===_0xb282('0x1b')){_0x3f8a3f=util[_0xb282('0xd')](_0xb282('0x1c'),_0x45b070['username'],_0x45b070[_0xb282('0x1b')]);}return util[_0xb282('0xd')](_0xb282('0x1d'),new Buffer(_0x3f8a3f)['toString'](_0xb282('0x1e')));}function getEndUser(_0x2a7ef8,_0x3c55ad,_0x26f9ca){logger[_0xb282('0x13')]('Searching\x20enduser\x20with\x20phone',_0x26f9ca);return request({'uri':util['format'](_0xb282('0x1f'),_0x2a7ef8[_0xb282('0xf')]),'qs':{'phone':_0x26f9ca}})['then'](function(_0x5e828e){if(_0x5e828e[_0xb282('0x20')]){logger[_0xb282('0x13')](_0xb282('0x21'));return _0x5e828e[_0xb282('0x11')][_0xb282('0x12')][0x0];}else{logger[_0xb282('0x13')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xb282('0xd')](_0xb282('0x22'),_0x2a7ef8['remoteUri']),'method':_0xb282('0x23'),'body':{'first_name':_0x3c55ad,'title':_0x3c55ad,'phone_numbers':[{'type':_0xb282('0x24'),'value':_0x26f9ca}]}});}});}function getTags(_0x2a4491,_0x280940){var _0x59644e=[];if(_0x2a4491&&_0x2a4491[_0xb282('0x25')]>0x0){_0x59644e=_[_0xb282('0x26')](_0x2a4491,_0x280940);}return _0x59644e;}function getCustomFields(_0xe337b8,_0x433ad5){var _0x4cee93=[];var _0xfddd2e={'custom_fields':{}};if(_0xe337b8[_0xb282('0x25')]>0x0){_['forEach'](_0xe337b8,function(_0x1b15b5){if(_0x1b15b5[_0xb282('0x27')]===_0xb282('0x28')&&_0x1b15b5[_0xb282('0x29')]&&!_0x1b15b5[_0xb282('0x2a')]){_0xfddd2e[_0x1b15b5['nameField'][_0xb282('0x2b')]()]=_0x1b15b5['content'][_0xb282('0x2c')]();}else if(_0x1b15b5[_0xb282('0x27')]===_0xb282('0x28')&&_0x1b15b5['idField']&&_0x1b15b5[_0xb282('0x2a')]){_0xfddd2e['custom_fields'][_0x1b15b5[_0xb282('0x2d')]]=_0x1b15b5[_0xb282('0x2e')][_0xb282('0x2c')]();}else if(_0x1b15b5[_0xb282('0x27')]===_0xb282('0x2f')&&_0x1b15b5[_0xb282('0x30')]&&_0x1b15b5['idField']&&_0x1b15b5[_0xb282('0x2a')]){_0x433ad5[_0x1b15b5[_0xb282('0x30')]]&&(_0xfddd2e['custom_fields'][_0x1b15b5['idField']]=_0x433ad5[_0x1b15b5[_0xb282('0x30')]][_0xb282('0x2c')]());}else if(_0x1b15b5[_0xb282('0x27')]==='customVariable'&&_0x1b15b5['Variable']&&_0x1b15b5['Variable'][_0xb282('0x31')]&&_0x1b15b5[_0xb282('0x2d')]&&_0x1b15b5[_0xb282('0x2a')]){_0x433ad5[_0x1b15b5[_0xb282('0x32')][_0xb282('0x31')][_0xb282('0x2b')]()]&&(_0xfddd2e[_0xb282('0x33')][_0x1b15b5['idField']]=_0x433ad5[_0x1b15b5[_0xb282('0x32')]['name'][_0xb282('0x2b')]()][_0xb282('0x2c')]());}});}if(_0xfddd2e[_0xb282('0x34')]){_0xfddd2e['priority']=Number(_0xfddd2e[_0xb282('0x34')]);}return _0xfddd2e;}function getTicket(_0x4beef2,_0x3bd325,_0x13eb0f,_0x1deac2,_0x246c85){logger['info']('Creating\x20new\x20ticket...');var _0x397fa1=_[_0xb282('0x35')]({'subject':intUtil[_0xb282('0x36')](_0x1deac2[_0xb282('0x37')],_0x246c85,'\x20'),'type':'phone','status':_0xb282('0x38'),'labels':['xCALLY',_0xb282('0x39'),_0xb282('0x3a')]['concat'](getTags(_0x1deac2[_0xb282('0x3b')],_0xb282('0x31'))),'description':intUtil[_0xb282('0x36')](_0x1deac2[_0xb282('0x3c')],_0x246c85,'\x0a'),'_links':{'assigned_user':{'href':util[_0xb282('0xd')](_0xb282('0x3d'),_0x3bd325['id']),'class':_0xb282('0x3e')}},'message':{'direction':'in','body':intUtil[_0xb282('0x36')](_0x1deac2[_0xb282('0x3c')],_0x246c85,'\x0a')}},getCustomFields(_0x1deac2[_0xb282('0x3f')],_0x246c85));return request({'uri':util[_0xb282('0xd')](_0xb282('0x40'),_0x4beef2[_0xb282('0xf')],_0x13eb0f['id']),'method':_0xb282('0x23'),'body':_0x397fa1});}exports[_0xb282('0x41')]=function(_0x182f87,_0x2416a4,_0x7332d2,_0x573da7,_0x310ad1,_0x58109a){var _0x3053a3,_0x2997dc;_0x58109a[_0xb282('0xf')]=intUtil[_0xb282('0x42')](_0x58109a[_0xb282('0xf')]);_0x58109a[_0xb282('0x43')]=intUtil['stripTrailingSlash'](_0x58109a['serverUrl']);if(_0x310ad1&&_0x310ad1[_0xb282('0x44')]){logger['info'](_0xb282('0x45'),_0xb282('0x46'));_0x2416a4['recordingURL']=util[_0xb282('0xd')](_0xb282('0x47'),_0x58109a[_0xb282('0x43')],_0x2416a4['uniqueid'],md5(_0x2416a4['uniqueid']));}else{_0x2416a4[_0xb282('0x48')]='';}headers['Authorization']=getAuth(_0x58109a);return getUser(_0x58109a,_0x573da7[_0xb282('0x49')])[_0xb282('0x10')](function(_0x76255){_0x3053a3=_0x76255;logger[_0xb282('0x13')](_0xb282('0x4a'),_0x3053a3['id']);return getEndUser(_0x58109a,_0x2416a4[_0xb282('0x4b')],_0x2416a4['calleridnum']);})[_0xb282('0x10')](function(_0xb0cf81){_0x2997dc=_0xb0cf81;logger[_0xb282('0x13')]('The\x20Enduser\x20ID\x20is:',_0x2997dc['id']);return getTicket(_0x58109a,_0x3053a3,_0x2997dc,_0x7332d2,_0x2416a4);})[_0xb282('0x10')](function(_0x48e5e2){if(_0x48e5e2){logger[_0xb282('0x13')]('Ticket\x20created!');logger[_0xb282('0x13')]('The\x20Ticket\x20ID\x20is:',_0x48e5e2['id']);switch(_0x58109a['type']){case'integrationTab':logger[_0xb282('0x13')](_0xb282('0x45'),_0xb282('0x4c'));emit(util[_0xb282('0xd')]('user:%s',_0x573da7['name']),'trigger:desk:display',{'recordId':_0x48e5e2['id']});break;case _0xb282('0x4d'):logger[_0xb282('0x13')](_0xb282('0x45'),_0xb282('0x4e'));emit(util['format'](_0xb282('0x4f'),_0x573da7[_0xb282('0x31')]),'trigger:browser:url',{'uri':util[_0xb282('0xd')](_0xb282('0x50'),_0x48e5e2['id'])});break;default:logger[_0xb282('0x51')](_0xb282('0x45'),_0xb282('0x52'));}}})['catch'](function(_0x6a295c){console[_0xb282('0x51')](_0x6a295c);logger[_0xb282('0x51')](_0xb282('0x45'),JSON[_0xb282('0x16')](_0x6a295c));});};exports[_0xb282('0x53')]=function(_0x4cde65,_0x87d777,_0x574653,_0x4554f1,_0x1e6ade,_0x5ca27b,_0x33b658){var _0x3dd8cb,_0x5380fe;_0x5ca27b['remoteUri']=intUtil['stripTrailingSlash'](_0x5ca27b[_0xb282('0xf')]);_0x5ca27b[_0xb282('0x43')]=intUtil[_0xb282('0x42')](_0x5ca27b['serverUrl']);if(_0x33b658&&_0x33b658[_0xb282('0x54')]&&_0x33b658['recordingFormat']!==_0xb282('0x55')){logger[_0xb282('0x13')]('[OUTBOUND]',_0xb282('0x46'));_0x87d777['recordingURL']=util[_0xb282('0xd')](_0xb282('0x47'),_0x5ca27b[_0xb282('0x43')],_0x87d777[_0xb282('0x56')],md5(_0x87d777[_0xb282('0x56')]));}headers[_0xb282('0x57')]=getAuth(_0x5ca27b);return getUser(_0x5ca27b,_0x4554f1['email'])[_0xb282('0x10')](function(_0x595387){_0x3dd8cb=_0x595387;logger[_0xb282('0x13')](_0xb282('0x4a'),_0x3dd8cb['id']);return getEndUser(_0x5ca27b,_0x87d777['destcalleridname'],_0x87d777['destcalleridnum']);})[_0xb282('0x10')](function(_0x20a0b6){_0x5380fe=_0x20a0b6;logger[_0xb282('0x13')]('The\x20Enduser\x20ID\x20is:',_0x5380fe['id']);return getTicket(_0x5ca27b,_0x3dd8cb,_0x5380fe,_0x574653,_0x87d777);})['then'](function(_0x40ae87){if(_0x40ae87){logger[_0xb282('0x13')](_0xb282('0x58'));logger['info'](_0xb282('0x59'),_0x40ae87['id']);switch(_0x5ca27b['type']){case _0xb282('0x5a'):logger[_0xb282('0x13')](_0xb282('0x45'),_0xb282('0x4c'));emit(util[_0xb282('0xd')](_0xb282('0x4f'),_0x4554f1[_0xb282('0x31')]),'trigger:desk:display',{'recordId':_0x40ae87['id']});break;case _0xb282('0x4d'):logger[_0xb282('0x13')](_0xb282('0x45'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xb282('0x4f'),_0x4554f1[_0xb282('0x31')]),_0xb282('0x5b'),{'uri':util['format']('%s/agent/tickets/%s',_0x5ca27b[_0xb282('0xf')],_0x40ae87['id'])});break;default:logger[_0xb282('0x51')]('[OUTBOUND]',_0xb282('0x52'));}}})[_0xb282('0x5c')](function(_0x15c7b7){logger['error'](_0xb282('0x5d'),JSON[_0xb282('0x16')](_0x15c7b7));});};exports['abandoned']=function(_0x214052,_0x20e01e,_0x33b5ec,_0x26c9a6,_0x4ea7a6,_0x4a129d){var _0xfdf710,_0x3c88ff;_0x4a129d['remoteUri']=intUtil[_0xb282('0x42')](_0x4a129d[_0xb282('0xf')]);_0x4a129d[_0xb282('0x43')]=intUtil[_0xb282('0x42')](_0x4a129d[_0xb282('0x43')]);if(_0x4ea7a6&&_0x4ea7a6[_0xb282('0x44')]){logger[_0xb282('0x13')](_0xb282('0x5e'),'Recording\x20is\x20enabled!');_0x20e01e[_0xb282('0x48')]=util[_0xb282('0xd')](_0xb282('0x47'),_0x4a129d['serverUrl'],_0x20e01e[_0xb282('0x56')],md5(_0x20e01e[_0xb282('0x56')]));}else{_0x20e01e['recordingURL']='';}headers['Authorization']=getAuth(_0x4a129d);return getUser(_0x4a129d)[_0xb282('0x10')](function(_0x1ef276){_0xfdf710=_0x1ef276;logger[_0xb282('0x13')](_0xb282('0x4a'),_0xfdf710['id']);return getEndUser(_0x4a129d,_0x20e01e[_0xb282('0x4b')],_0x20e01e[_0xb282('0x5f')]);})[_0xb282('0x10')](function(_0xbb4060){_0x3c88ff=_0xbb4060;logger[_0xb282('0x13')](_0xb282('0x60'),_0x3c88ff['id']);return getTicket(_0x4a129d,_0xfdf710,_0x3c88ff,_0x33b5ec,_0x20e01e);})[_0xb282('0x10')](function(_0x3a6712){if(_0x3a6712){logger[_0xb282('0x13')](_0xb282('0x58'));logger[_0xb282('0x13')](_0xb282('0x59'),_0x3a6712['id']);}})['catch'](function(_0x2cffa2){logger[_0xb282('0x51')](_0xb282('0x5e'),JSON[_0xb282('0x16')](_0x2cffa2));});}; \ 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 a76a104..14d4554 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 _0xafa2=['length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','outbound','destcalleridnum','calleridnum','contacts','odata-entityid','substring','lastIndexOf','enduserId','contacts?$select=telephone1','toLowerCase','contactid',']\x20Enduser\x20Created!','forEach','type','string','customField','idField','indexOf','ticketType','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','phonecall','/systemusers(','callDirection','queue','headers','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','remoteUri','stripTrailingSlash','serverUrl','abandoned','format','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId','name','lodash','request-promise','util','./util','ioredis','../../../../config/logger','../../../../config/environment','redis','defaults','localhost','POST','clientId','username','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail'];(function(_0x386f75,_0x3037ff){var _0x1d6561=function(_0x320eaa){while(--_0x320eaa){_0x386f75['push'](_0x386f75['shift']());}};_0x1d6561(++_0x3037ff);}(_0xafa2,0xfb));var _0x2afa=function(_0x2d7a10,_0x3af428){_0x2d7a10=_0x2d7a10-0x0;var _0x469308=_0xafa2[_0x2d7a10];return _0x469308;};'use strict';var _=require(_0x2afa('0x0'));var BPromise=require('bluebird');var rp=require(_0x2afa('0x1'));var util=require(_0x2afa('0x2'));var intUtil=require(_0x2afa('0x3'));var md5=require('md5');var Redis=require(_0x2afa('0x4'));var logger=require(_0x2afa('0x5'))('dynamics365');var config=require(_0x2afa('0x6'));config[_0x2afa('0x7')]=_[_0x2afa('0x8')](config[_0x2afa('0x7')],{'host':_0x2afa('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2afa('0x7')]));function getAuthToken(_0x46c546,_0x3d467c,_0x11e70c){var _0x3c12b2={'method':_0x2afa('0xa'),'uri':_0x3d467c,'form':{'client_id':_0x46c546[_0x2afa('0xb')],'resource':_0x46c546['remoteUri'],'username':_0x46c546[_0x2afa('0xc')],'password':_0x46c546[_0x2afa('0xd')],'grant_type':'password','client_secret':_0x46c546[_0x2afa('0xe')]},'json':!![]};return rp(_0x3c12b2)[_0x2afa('0xf')](function(_0x58bb03){return _0x58bb03[_0x2afa('0x10')];})[_0x2afa('0x11')](function(_0x467bcc){logger[_0x2afa('0x12')]('['+[_0x11e70c[_0x2afa('0x13')]()]+_0x2afa('0x14'));return _0x467bcc[_0x2afa('0x15')];});}function getUser(_0xc8c402,_0x25a645,_0x52d3cf,_0x4cafb4,_0x51d93a,_0x1193fc){return new BPromise(function(_0x2a549a,_0x1e38e7){return getAuthToken(_0x25a645,_0x4cafb4,_0x1193fc)[_0x2afa('0xf')](function(_0x6cc9ee){var _0x52d3c3={'method':_0x2afa('0x16'),'uri':_0x51d93a+_0x2afa('0x17'),'headers':{'Authorization':_0x2afa('0x18')+_0x6cc9ee,'OData-Version':_0x2afa('0x19')},'json':!![]};return rp(_0x52d3c3);})[_0x2afa('0xf')](function(_0x3f99dc){var _0x10c682=_0x3f99dc[_0x2afa('0x1a')];var _0x7a5d9=![];var _0x2d317e=null;if(!_[_0x2afa('0x1b')](_0x52d3cf)){if(intUtil[_0x2afa('0x1c')](_0x52d3cf[_0x2afa('0x1d')])){_0xc8c402[_0x2afa('0x1e')]=_0x52d3cf[_0x2afa('0x1d')];for(_0x2d317e=0x0;_0x2d317e<_0x10c682[_0x2afa('0x1f')];_0x2d317e++){if(_0x10c682[_0x2d317e][_0x2afa('0x20')]===_0x52d3cf[_0x2afa('0x1d')]&&!_0x10c682[_0x2d317e][_0x2afa('0x21')]){_0x7a5d9=!![];logger[_0x2afa('0x22')]('['+[_0x1193fc['toUpperCase']()]+_0x2afa('0x23')+_0x10c682[_0x2d317e][_0x2afa('0x24')]+'!');_0xc8c402[_0x2afa('0x25')]=_0x10c682[_0x2d317e][_0x2afa('0x24')];}}}}if(!_0x7a5d9){logger[_0x2afa('0x22')]('['+[_0x1193fc[_0x2afa('0x13')]()]+_0x2afa('0x26'));_0xc8c402[_0x2afa('0x1e')]=_0x25a645['username'];for(_0x2d317e=0x0;_0x2d317e<_0x10c682[_0x2afa('0x1f')];_0x2d317e++){if(_0x10c682[_0x2d317e][_0x2afa('0x20')]===_0x25a645['username']){_0xc8c402['userId']=_0x10c682[_0x2d317e][_0x2afa('0x24')];}}}_0x2a549a(_0xc8c402);})['catch'](function(_0x50a0a4){_0x1e38e7(_0x50a0a4['message']);});});}function createEndUser(_0x29b66a,_0x3e7a9a,_0x3c0b27,_0x19de16,_0x4bb529,_0x5c14fa){return new BPromise(function(_0x287ade,_0x13a8c2){return getAuthToken(_0x3e7a9a,_0x3c0b27,_0x5c14fa)[_0x2afa('0xf')](function(_0xb15a46){var _0x1f3f56=_0x5c14fa['toLowerCase']()===_0x2afa('0x27')?_0x4bb529[_0x2afa('0x28')]:_0x4bb529[_0x2afa('0x29')];var _0x53343e={'method':'POST','uri':_0x19de16+_0x2afa('0x2a'),'body':{'telephone1':_0x1f3f56,'fullname':_0x1f3f56,'firstname':_0x1f3f56,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x29b66a[_0x2afa('0x25')]+')'},'headers':{'Authorization':_0x2afa('0x18')+_0xb15a46,'OData-Version':_0x2afa('0x19')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x53343e);})[_0x2afa('0xf')](function(_0x4b2363){var _0x5b6263=_0x4b2363['headers'][_0x2afa('0x2b')];var _0x873831=_0x5b6263[_0x2afa('0x2c')](_0x5b6263[_0x2afa('0x2d')]('(')+0x1,_0x5b6263[_0x2afa('0x2d')](')'));_0x29b66a[_0x2afa('0x2e')]=_0x873831;_0x287ade(_0x29b66a);})['catch'](function(_0x1e1ea5){_0x13a8c2(_0x1e1ea5[_0x2afa('0x15')]);});});}function getEndUser(_0x2c24bd,_0x1ca864,_0xb5b56b,_0x1dc66f,_0x12924b,_0x1ee618){return new BPromise(function(_0x4ec60d,_0x313892){return getAuthToken(_0x1ca864,_0xb5b56b,_0x1ee618)[_0x2afa('0xf')](function(_0x1a3b77){var _0x227f46={'method':_0x2afa('0x16'),'uri':_0x1dc66f+_0x2afa('0x2f'),'headers':{'Authorization':'Bearer\x20'+_0x1a3b77,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x227f46);})[_0x2afa('0xf')](function(_0x23d860){var _0x49d843=null;if(_0x23d860){var _0x4bf0f4=_0x23d860[_0x2afa('0x1a')];var _0x142fa1=![];for(_0x49d843=0x0;_0x49d843<_0x4bf0f4[_0x2afa('0x1f')];_0x49d843++){var _0x35ecdd=_0x1ee618[_0x2afa('0x30')]()===_0x2afa('0x27')?_0x12924b[_0x2afa('0x28')]:_0x12924b[_0x2afa('0x29')];if(_0x4bf0f4[_0x49d843]['telephone1']===_0x35ecdd){_0x142fa1=!![];_0x2c24bd[_0x2afa('0x2e')]=_0x4bf0f4[_0x49d843][_0x2afa('0x31')];}}if(_0x142fa1){_0x4ec60d(_0x2c24bd);}else{return createEndUser(_0x2c24bd,_0x1ca864,_0xb5b56b,_0x1dc66f,_0x12924b,_0x1ee618)['then'](function(_0x29c0bd){logger['info']('['+[_0x1ee618['toUpperCase']()]+']\x20Enduser\x20created!',_0x29c0bd[_0x2afa('0x2e')]);_0x4ec60d(_0x29c0bd);});}}else{return createEndUser(_0x2c24bd,_0x1ca864,_0xb5b56b,_0x1dc66f,_0x12924b,_0x1ee618)['then'](function(_0x34bbdd){logger[_0x2afa('0x22')]('['+[_0x1ee618[_0x2afa('0x13')]()]+_0x2afa('0x32'),_0x34bbdd[_0x2afa('0x2e')]);_0x4ec60d(_0x34bbdd);});}});});}function getCustomFields(_0xbb8844,_0x2cc934,_0x45d6f4){var _0x1805d9={};if(_0xbb8844[_0x2afa('0x1f')]>0x0){_[_0x2afa('0x33')](_0xbb8844,function(_0xfd6ff0){if(_0xfd6ff0[_0x2afa('0x34')]===_0x2afa('0x35')&&_0xfd6ff0['nameField']&&!_0xfd6ff0[_0x2afa('0x36')]){var _0x28326d=_0xfd6ff0[_0x2afa('0x37')][_0x2afa('0x30')]();var _0x3b7f63=_0x28326d['substring'](0x0,_0x28326d['indexOf']('_'));var _0x783792=_0x28326d[_0x2afa('0x2c')](_0x28326d[_0x2afa('0x38')]('_')+0x1);if(_0x3b7f63===_0x45d6f4){_0x1805d9[_0x783792]=_0xfd6ff0['content'];}}});}return _0x1805d9;}function getTicket(_0x108fef,_0x55190d,_0x5597bc,_0xfd730,_0x208850,_0x37eb08,_0x422e11){return new BPromise(function(_0x4bec4a,_0x2763a){var _0x258299;return getAuthToken(_0x55190d,_0x5597bc,_0x422e11)[_0x2afa('0xf')](function(_0x266f5b){if(_0x37eb08[_0x2afa('0x39')]==='incident'){_0x258299={'method':_0x2afa('0xa'),'uri':_0xfd730+_0x2afa('0x3a'),'body':Object[_0x2afa('0x3b')]({},{'title':intUtil[_0x2afa('0x3c')](_0x37eb08[_0x2afa('0x3d')],_0x208850,'\x20'),'description':intUtil[_0x2afa('0x3c')](_0x37eb08[_0x2afa('0x3e')],_0x208850,'\x0a'),'customerid_contact@odata.bind':_0x2afa('0x3f')+_0x108fef[_0x2afa('0x2e')]+')','ownerid@odata.bind':'/systemusers('+_0x108fef[_0x2afa('0x25')]+')','caseorigincode':'1'},getCustomFields(_0x37eb08[_0x2afa('0x40')],_0x208850,_0x37eb08[_0x2afa('0x39')])),'headers':{'Authorization':'Bearer\x20'+_0x266f5b,'OData-Version':_0x2afa('0x19')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x37eb08[_0x2afa('0x39')]===_0x2afa('0x41')){_0x258299={'method':_0x2afa('0xa'),'uri':_0xfd730+'phonecalls','body':Object['assign']({},{'subject':intUtil[_0x2afa('0x3c')](_0x37eb08[_0x2afa('0x3d')],_0x208850,'\x20'),'phonenumber':String(_0x208850['calleridnum']),'description':intUtil[_0x2afa('0x3c')](_0x37eb08[_0x2afa('0x3e')],_0x208850,'\x0a'),'regardingobjectid_contact@odata.bind':_0x2afa('0x3f')+_0x108fef[_0x2afa('0x2e')]+')','ownerid@odata.bind':_0x2afa('0x42')+_0x108fef[_0x2afa('0x25')]+')','directioncode':_0x108fef[_0x2afa('0x43')]===_0x2afa('0x44')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0x108fef[_0x2afa('0x25')]+')','participationtypemask':_0x108fef[_0x2afa('0x43')]===_0x2afa('0x44')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x108fef['enduserId']+')','participationtypemask':_0x108fef[_0x2afa('0x43')]===_0x2afa('0x44')?0x1:0x2}]},getCustomFields(_0x37eb08[_0x2afa('0x40')],_0x208850,_0x37eb08[_0x2afa('0x39')])),'headers':{'Authorization':_0x2afa('0x18')+_0x266f5b,'OData-Version':_0x2afa('0x19')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x258299);})[_0x2afa('0xf')](function(_0x545362){var _0x94f995=_0x545362[_0x2afa('0x45')]['odata-entityid'];var _0x2c9f8b=_0x94f995['substring'](_0x94f995[_0x2afa('0x2d')]('(')+0x1,_0x94f995['lastIndexOf'](')'));_0x108fef['ticketId']=_0x2c9f8b;_0x4bec4a(_0x108fef);})[_0x2afa('0x11')](function(_0x2384cc){_0x2763a(_0x2384cc[_0x2afa('0x15')]);});});}function emit(_0x289839,_0x413a30,_0x32eb9e,_0x51d0e4){var _0x589bcd={'uri':util['format'](_0x2afa('0x46'),_0x289839,_0x32eb9e,_0x51d0e4)};io['to'](util['format'](_0x2afa('0x47'),_0x413a30))[_0x2afa('0x48')](_0x2afa('0x49'),_0x589bcd);}exports['cs']=function(_0x3f6dab,_0x3b95fd,_0x46edf3,_0x2411df,_0x391058,_0x3084f9,_0x4f2691,_0x290572){var _0x21f656={};_0x3084f9[_0x2afa('0x4a')]=intUtil[_0x2afa('0x4b')](_0x3084f9[_0x2afa('0x4a')]);_0x3084f9[_0x2afa('0x4c')]=intUtil[_0x2afa('0x4b')](_0x3084f9['serverUrl']);_0x21f656[_0x2afa('0x43')]=_0x290572===_0x2afa('0x44')||_0x290572===_0x2afa('0x4d')?'queue':'outbound';var _0x3c7c64=util[_0x2afa('0x4e')]('%s/api/data/v9.0/',_0x3084f9[_0x2afa('0x4a')]);var _0x31bebe=util[_0x2afa('0x4e')](_0x2afa('0x4f'),_0x3084f9['tenantId']);var _0x6f1b21=util['format'](_0x2afa('0x50'),_0x3084f9[_0x2afa('0x4c')],_0x3b95fd[_0x2afa('0x51')],md5(_0x3b95fd[_0x2afa('0x51')]));if(_0x391058&&_0x391058[_0x2afa('0x52')]){logger[_0x2afa('0x22')](_0x2afa('0x53'),_0x2afa('0x54'));_0x3b95fd[_0x2afa('0x55')]=_0x6f1b21;}else if(_0x4f2691&&_0x4f2691[_0x2afa('0x56')]&&_0x4f2691[_0x2afa('0x56')]!==_0x2afa('0x57')){logger[_0x2afa('0x22')](_0x2afa('0x58'),_0x2afa('0x54'));_0x3b95fd['recordingURL']=_0x6f1b21;}else{_0x3b95fd[_0x2afa('0x55')]='';}return getUser(_0x21f656,_0x3084f9,_0x2411df,_0x31bebe,_0x3c7c64,_0x290572)[_0x2afa('0xf')](function(_0x2dab84){logger[_0x2afa('0x22')]('['+_0x290572[_0x2afa('0x13')]()+']\x20The\x20User\x20ID\x20is:',_0x2dab84['userId']);logger[_0x2afa('0x22')]('['+_0x290572[_0x2afa('0x13')]()+_0x2afa('0x59'),_0x2dab84[_0x2afa('0x1e')]);return getEndUser(_0x2dab84,_0x3084f9,_0x31bebe,_0x3c7c64,_0x3b95fd,_0x290572);})[_0x2afa('0xf')](function(_0xd0d464){logger[_0x2afa('0x22')]('['+_0x290572[_0x2afa('0x13')]()+_0x2afa('0x5a'),_0xd0d464[_0x2afa('0x2e')]);logger[_0x2afa('0x22')]('['+_0x290572[_0x2afa('0x13')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x3b95fd[_0x2afa('0x29')]);return getTicket(_0xd0d464,_0x3084f9,_0x31bebe,_0x3c7c64,_0x3b95fd,_0x46edf3,_0x290572);})[_0x2afa('0xf')](function(_0x32f9ae){logger[_0x2afa('0x22')](util['format']('['+_0x290572[_0x2afa('0x13')]()+_0x2afa('0x5b'),_0x46edf3[_0x2afa('0x39')],_0x32f9ae[_0x2afa('0x5c')]));logger['info'](util[_0x2afa('0x4e')]('['+_0x290572['toUpperCase']()+']\x20Call\x20direction:\x20%s',_0x290572));if(_0x290572!==_0x2afa('0x4d')){logger[_0x2afa('0x22')]('['+_0x290572[_0x2afa('0x13')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x3084f9[_0x2afa('0x4a')],_0x2411df[_0x2afa('0x5d')],_0x46edf3[_0x2afa('0x39')],_0x32f9ae[_0x2afa('0x5c')]);}})['catch'](function(_0x47e5d6){logger['error']('['+_0x290572[_0x2afa('0x13')]()+']\x20Error\x20running\x20Dynamics365\x20integration',util['inspect'](_0x47e5d6,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x0e2d=['isdisabled','info','userId','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','length','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','headers','substring','lastIndexOf','enduserId','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','string','nameField','customField','idField','indexOf','ticketType','incidents','Descriptions','/systemusers(','Fields','phonecall','phonecalls','getString','Subjects','/contacts(','callDirection','queue','odata-entityid','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','stripTrailingSlash','serverUrl','abandoned','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','util','./util','ioredis','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','POST','clientId','remoteUri','username','clientSecret','then','access_token','catch','error','toUpperCase','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','internalemailaddress'];(function(_0x519756,_0x288785){var _0x37047e=function(_0x3d64a7){while(--_0x3d64a7){_0x519756['push'](_0x519756['shift']());}};_0x37047e(++_0x288785);}(_0x0e2d,0x9a));var _0xd0e2=function(_0x2fe6b0,_0x18aa5b){_0x2fe6b0=_0x2fe6b0-0x0;var _0x1ad640=_0x0e2d[_0x2fe6b0];return _0x1ad640;};'use strict';var _=require(_0xd0e2('0x0'));var BPromise=require(_0xd0e2('0x1'));var rp=require(_0xd0e2('0x2'));var util=require(_0xd0e2('0x3'));var intUtil=require(_0xd0e2('0x4'));var md5=require('md5');var Redis=require(_0xd0e2('0x5'));var logger=require('../../../../config/logger')(_0xd0e2('0x6'));var config=require(_0xd0e2('0x7'));config[_0xd0e2('0x8')]=_[_0xd0e2('0x9')](config[_0xd0e2('0x8')],{'host':_0xd0e2('0xa'),'port':0x18eb});var io=require(_0xd0e2('0xb'))(new Redis(config[_0xd0e2('0x8')]));function getAuthToken(_0x2e771e,_0x4adea8,_0x148714){var _0x293396={'method':_0xd0e2('0xc'),'uri':_0x4adea8,'form':{'client_id':_0x2e771e[_0xd0e2('0xd')],'resource':_0x2e771e[_0xd0e2('0xe')],'username':_0x2e771e[_0xd0e2('0xf')],'password':_0x2e771e['password'],'grant_type':'password','client_secret':_0x2e771e[_0xd0e2('0x10')]},'json':!![]};return rp(_0x293396)[_0xd0e2('0x11')](function(_0x243a4f){return _0x243a4f[_0xd0e2('0x12')];})[_0xd0e2('0x13')](function(_0x957800){logger[_0xd0e2('0x14')]('['+[_0x148714[_0xd0e2('0x15')]()]+']\x20Wrong\x20credentials!');return _0x957800[_0xd0e2('0x16')];});}function getUser(_0x57f423,_0x13e03,_0x5843f0,_0x117d42,_0x26e66e,_0x4ae584){return new BPromise(function(_0xd973a,_0x9b58ba){return getAuthToken(_0x13e03,_0x117d42,_0x4ae584)[_0xd0e2('0x11')](function(_0x3071e3){var _0xc9ef78={'method':_0xd0e2('0x17'),'uri':_0x26e66e+_0xd0e2('0x18'),'headers':{'Authorization':_0xd0e2('0x19')+_0x3071e3,'OData-Version':_0xd0e2('0x1a')},'json':!![]};return rp(_0xc9ef78);})[_0xd0e2('0x11')](function(_0x4bec64){var _0x44bc11=_0x4bec64[_0xd0e2('0x1b')];var _0x28d284=![];var _0x387d2c=null;if(!_[_0xd0e2('0x1c')](_0x5843f0)){if(intUtil[_0xd0e2('0x1d')](_0x5843f0[_0xd0e2('0x1e')])){_0x57f423['userEmail']=_0x5843f0['email'];for(_0x387d2c=0x0;_0x387d2c<_0x44bc11['length'];_0x387d2c++){if(_0x44bc11[_0x387d2c][_0xd0e2('0x1f')]===_0x5843f0[_0xd0e2('0x1e')]&&!_0x44bc11[_0x387d2c][_0xd0e2('0x20')]){_0x28d284=!![];logger[_0xd0e2('0x21')]('['+[_0x4ae584[_0xd0e2('0x15')]()]+']\x20Agent\x20found\x20'+_0x44bc11[_0x387d2c]['systemuserid']+'!');_0x57f423[_0xd0e2('0x22')]=_0x44bc11[_0x387d2c][_0xd0e2('0x23')];}}}}if(!_0x28d284){logger[_0xd0e2('0x21')]('['+[_0x4ae584[_0xd0e2('0x15')]()]+_0xd0e2('0x24'));_0x57f423['userEmail']=_0x13e03[_0xd0e2('0xf')];for(_0x387d2c=0x0;_0x387d2c<_0x44bc11[_0xd0e2('0x25')];_0x387d2c++){if(_0x44bc11[_0x387d2c]['internalemailaddress']===_0x13e03['username']){_0x57f423['userId']=_0x44bc11[_0x387d2c][_0xd0e2('0x23')];}}}_0xd973a(_0x57f423);})[_0xd0e2('0x13')](function(_0x9ea23e){_0x9b58ba(_0x9ea23e['message']);});});}function createEndUser(_0x70e6ae,_0x388dca,_0x58512b,_0x3497c3,_0x4e4289,_0x1a5ecc){return new BPromise(function(_0x589234,_0x3a4abd){return getAuthToken(_0x388dca,_0x58512b,_0x1a5ecc)[_0xd0e2('0x11')](function(_0x82219b){var _0x2ed32f=_0x1a5ecc[_0xd0e2('0x26')]()===_0xd0e2('0x27')?_0x4e4289[_0xd0e2('0x28')]:_0x4e4289[_0xd0e2('0x29')];var _0x1f8a85={'method':'POST','uri':_0x3497c3+_0xd0e2('0x2a'),'body':{'telephone1':_0x2ed32f,'fullname':_0x2ed32f,'firstname':_0x2ed32f,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x70e6ae[_0xd0e2('0x22')]+')'},'headers':{'Authorization':_0xd0e2('0x19')+_0x82219b,'OData-Version':_0xd0e2('0x1a')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x1f8a85);})[_0xd0e2('0x11')](function(_0x538218){var _0x1140b2=_0x538218[_0xd0e2('0x2b')]['odata-entityid'];var _0x105536=_0x1140b2[_0xd0e2('0x2c')](_0x1140b2['lastIndexOf']('(')+0x1,_0x1140b2[_0xd0e2('0x2d')](')'));_0x70e6ae[_0xd0e2('0x2e')]=_0x105536;_0x589234(_0x70e6ae);})['catch'](function(_0x21c29c){_0x3a4abd(_0x21c29c[_0xd0e2('0x16')]);});});}function getEndUser(_0x1376d4,_0x18ebc8,_0x10d8bf,_0x468433,_0x316ff2,_0x4c1260){return new BPromise(function(_0x2499f2,_0x2999ac){return getAuthToken(_0x18ebc8,_0x10d8bf,_0x4c1260)[_0xd0e2('0x11')](function(_0x57c5b1){var _0x2e73da={'method':'GET','uri':_0x468433+'contacts?$select=telephone1','headers':{'Authorization':_0xd0e2('0x19')+_0x57c5b1,'If-None-Match':null,'OData-Version':_0xd0e2('0x1a')},'json':!![]};return rp(_0x2e73da);})[_0xd0e2('0x11')](function(_0x2171b1){var _0x56073f=null;if(_0x2171b1){var _0x2e555e=_0x2171b1[_0xd0e2('0x1b')];var _0x4b0995=![];for(_0x56073f=0x0;_0x56073f<_0x2e555e[_0xd0e2('0x25')];_0x56073f++){var _0x26ecf6=_0x4c1260[_0xd0e2('0x26')]()===_0xd0e2('0x27')?_0x316ff2[_0xd0e2('0x28')]:_0x316ff2[_0xd0e2('0x29')];if(_0x2e555e[_0x56073f][_0xd0e2('0x2f')]===_0x26ecf6){_0x4b0995=!![];_0x1376d4[_0xd0e2('0x2e')]=_0x2e555e[_0x56073f][_0xd0e2('0x30')];}}if(_0x4b0995){_0x2499f2(_0x1376d4);}else{return createEndUser(_0x1376d4,_0x18ebc8,_0x10d8bf,_0x468433,_0x316ff2,_0x4c1260)[_0xd0e2('0x11')](function(_0x1047bb){logger[_0xd0e2('0x21')]('['+[_0x4c1260[_0xd0e2('0x15')]()]+_0xd0e2('0x31'),_0x1047bb['enduserId']);_0x2499f2(_0x1047bb);});}}else{return createEndUser(_0x1376d4,_0x18ebc8,_0x10d8bf,_0x468433,_0x316ff2,_0x4c1260)[_0xd0e2('0x11')](function(_0x23d48a){logger[_0xd0e2('0x21')]('['+[_0x4c1260[_0xd0e2('0x15')]()]+_0xd0e2('0x32'),_0x23d48a['enduserId']);_0x2499f2(_0x23d48a);});}});});}function getCustomFields(_0x1960c2,_0x3a8b0f,_0x12d297){var _0x5ef554={};if(_0x1960c2['length']>0x0){_[_0xd0e2('0x33')](_0x1960c2,function(_0x1017ab){if(_0x1017ab['type']===_0xd0e2('0x34')&&_0x1017ab[_0xd0e2('0x35')]&&!_0x1017ab[_0xd0e2('0x36')]){var _0xe8d1d3=_0x1017ab[_0xd0e2('0x37')][_0xd0e2('0x26')]();var _0x2482ad=_0xe8d1d3[_0xd0e2('0x2c')](0x0,_0xe8d1d3[_0xd0e2('0x38')]('_'));var _0x5ca292=_0xe8d1d3[_0xd0e2('0x2c')](_0xe8d1d3['indexOf']('_')+0x1);if(_0x2482ad===_0x12d297){_0x5ef554[_0x5ca292]=_0x1017ab['content'];}}});}return _0x5ef554;}function getTicket(_0x78dafc,_0x24d3a6,_0x194e5b,_0x232d2b,_0x350913,_0x153488,_0x3d4ee0){return new BPromise(function(_0x25bdcb,_0x2ee7b9){var _0x558709;return getAuthToken(_0x24d3a6,_0x194e5b,_0x3d4ee0)[_0xd0e2('0x11')](function(_0x4e17ef){if(_0x153488[_0xd0e2('0x39')]==='incident'){_0x558709={'method':_0xd0e2('0xc'),'uri':_0x232d2b+_0xd0e2('0x3a'),'body':Object['assign']({},{'title':intUtil['getString'](_0x153488['Subjects'],_0x350913,'\x20'),'description':intUtil['getString'](_0x153488[_0xd0e2('0x3b')],_0x350913,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x78dafc[_0xd0e2('0x2e')]+')','ownerid@odata.bind':_0xd0e2('0x3c')+_0x78dafc[_0xd0e2('0x22')]+')','caseorigincode':'1'},getCustomFields(_0x153488[_0xd0e2('0x3d')],_0x350913,_0x153488[_0xd0e2('0x39')])),'headers':{'Authorization':_0xd0e2('0x19')+_0x4e17ef,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x153488[_0xd0e2('0x39')]===_0xd0e2('0x3e')){_0x558709={'method':_0xd0e2('0xc'),'uri':_0x232d2b+_0xd0e2('0x3f'),'body':Object['assign']({},{'subject':intUtil[_0xd0e2('0x40')](_0x153488[_0xd0e2('0x41')],_0x350913,'\x20'),'phonenumber':String(_0x350913[_0xd0e2('0x29')]),'description':intUtil['getString'](_0x153488[_0xd0e2('0x3b')],_0x350913,'\x0a'),'regardingobjectid_contact@odata.bind':_0xd0e2('0x42')+_0x78dafc['enduserId']+')','ownerid@odata.bind':_0xd0e2('0x3c')+_0x78dafc['userId']+')','directioncode':_0x78dafc[_0xd0e2('0x43')]===_0xd0e2('0x44')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0x78dafc[_0xd0e2('0x22')]+')','participationtypemask':_0x78dafc[_0xd0e2('0x43')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0xd0e2('0x42')+_0x78dafc[_0xd0e2('0x2e')]+')','participationtypemask':_0x78dafc[_0xd0e2('0x43')]===_0xd0e2('0x44')?0x1:0x2}]},getCustomFields(_0x153488[_0xd0e2('0x3d')],_0x350913,_0x153488[_0xd0e2('0x39')])),'headers':{'Authorization':_0xd0e2('0x19')+_0x4e17ef,'OData-Version':_0xd0e2('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x558709);})['then'](function(_0x220924){var _0x3ff315=_0x220924[_0xd0e2('0x2b')][_0xd0e2('0x45')];var _0x116042=_0x3ff315[_0xd0e2('0x2c')](_0x3ff315[_0xd0e2('0x2d')]('(')+0x1,_0x3ff315[_0xd0e2('0x2d')](')'));_0x78dafc[_0xd0e2('0x46')]=_0x116042;_0x25bdcb(_0x78dafc);})[_0xd0e2('0x13')](function(_0x523187){_0x2ee7b9(_0x523187[_0xd0e2('0x16')]);});});}function emit(_0x50edb3,_0x11c984,_0x4261cb,_0x1fb98a){var _0x35112a={'uri':util[_0xd0e2('0x47')](_0xd0e2('0x48'),_0x50edb3,_0x4261cb,_0x1fb98a)};io['to'](util[_0xd0e2('0x47')](_0xd0e2('0x49'),_0x11c984))['emit'](_0xd0e2('0x4a'),_0x35112a);}exports['cs']=function(_0x5e9b9c,_0x227a10,_0x43306d,_0x241974,_0x43e9b5,_0x5d882c,_0x497f3d,_0x5cd037){var _0x53c6b2={};_0x5d882c['remoteUri']=intUtil[_0xd0e2('0x4b')](_0x5d882c['remoteUri']);_0x5d882c[_0xd0e2('0x4c')]=intUtil[_0xd0e2('0x4b')](_0x5d882c[_0xd0e2('0x4c')]);_0x53c6b2[_0xd0e2('0x43')]=_0x5cd037===_0xd0e2('0x44')||_0x5cd037===_0xd0e2('0x4d')?_0xd0e2('0x44'):_0xd0e2('0x27');var _0xf703b=util[_0xd0e2('0x47')]('%s/api/data/v9.0/',_0x5d882c[_0xd0e2('0xe')]);var _0xded09=util[_0xd0e2('0x47')]('https://login.microsoftonline.com/%s/oauth2/token',_0x5d882c[_0xd0e2('0x4e')]);var _0x4a04e9=util[_0xd0e2('0x47')](_0xd0e2('0x4f'),_0x5d882c[_0xd0e2('0x4c')],_0x227a10['uniqueid'],md5(_0x227a10[_0xd0e2('0x50')]));if(_0x43e9b5&&_0x43e9b5[_0xd0e2('0x51')]){logger[_0xd0e2('0x21')](_0xd0e2('0x52'),_0xd0e2('0x53'));_0x227a10[_0xd0e2('0x54')]=_0x4a04e9;}else if(_0x497f3d&&_0x497f3d[_0xd0e2('0x55')]&&_0x497f3d['recordingFormat']!=='none'){logger[_0xd0e2('0x21')](_0xd0e2('0x56'),_0xd0e2('0x53'));_0x227a10[_0xd0e2('0x54')]=_0x4a04e9;}else{_0x227a10[_0xd0e2('0x54')]='';}return getUser(_0x53c6b2,_0x5d882c,_0x241974,_0xded09,_0xf703b,_0x5cd037)[_0xd0e2('0x11')](function(_0x48ebe2){logger['info']('['+_0x5cd037[_0xd0e2('0x15')]()+']\x20The\x20User\x20ID\x20is:',_0x48ebe2['userId']);logger[_0xd0e2('0x21')]('['+_0x5cd037['toUpperCase']()+_0xd0e2('0x57'),_0x48ebe2['userEmail']);return getEndUser(_0x48ebe2,_0x5d882c,_0xded09,_0xf703b,_0x227a10,_0x5cd037);})[_0xd0e2('0x11')](function(_0xf1734a){logger[_0xd0e2('0x21')]('['+_0x5cd037[_0xd0e2('0x15')]()+_0xd0e2('0x58'),_0xf1734a[_0xd0e2('0x2e')]);logger['info']('['+_0x5cd037[_0xd0e2('0x15')]()+_0xd0e2('0x59'),_0x227a10[_0xd0e2('0x29')]);return getTicket(_0xf1734a,_0x5d882c,_0xded09,_0xf703b,_0x227a10,_0x43306d,_0x5cd037);})[_0xd0e2('0x11')](function(_0xccc1c7){logger['info'](util[_0xd0e2('0x47')]('['+_0x5cd037[_0xd0e2('0x15')]()+_0xd0e2('0x5a'),_0x43306d[_0xd0e2('0x39')],_0xccc1c7[_0xd0e2('0x46')]));logger[_0xd0e2('0x21')](util['format']('['+_0x5cd037[_0xd0e2('0x15')]()+']\x20Call\x20direction:\x20%s',_0x5cd037));if(_0x5cd037!=='abandoned'){logger[_0xd0e2('0x21')]('['+_0x5cd037['toUpperCase']()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x5d882c[_0xd0e2('0xe')],_0x241974['name'],_0x43306d[_0xd0e2('0x39')],_0xccc1c7[_0xd0e2('0x46')]);}})[_0xd0e2('0x13')](function(_0x36915d){logger['error']('['+_0x5cd037[_0xd0e2('0x15')]()+_0xd0e2('0x5b'),util[_0xd0e2('0x5c')](_0x36915d,{'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 bbfb3d8..7e895b3 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 _0xb9a9=['error','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','trigger:browser:url','catch','stringify','abandoned','[ABANDONED]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','lodash','request-promise','util','ioredis','./util','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','merge','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','value','format','%s/api/v2/tickets','remoteUri','POST','then','info','validateEmail','Agent\x20found!','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','apiKey','toString','base64','debug','length','forEach','nameField','customField','toLowerCase','content','type','idField','push','variable','variableName','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/helpdesk/tickets/%d'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0xb9a9,0x118));var _0x9b9a=function(_0x1d5f21,_0x22e120){_0x1d5f21=_0x1d5f21-0x0;var _0x1b73ca=_0xb9a9[_0x1d5f21];return _0x1b73ca;};'use strict';var _=require(_0x9b9a('0x0'));var rp=require(_0x9b9a('0x1'));var md5=require('md5');var util=require(_0x9b9a('0x2'));var Redis=require(_0x9b9a('0x3'));var intUtil=require(_0x9b9a('0x4'));var config=require('../../../../config/environment');var logger=require(_0x9b9a('0x5'))(_0x9b9a('0x6'));config[_0x9b9a('0x7')]=_[_0x9b9a('0x8')](config[_0x9b9a('0x7')],{'host':_0x9b9a('0x9'),'port':0x18eb});var io=require(_0x9b9a('0xa'))(new Redis(config['redis']));var headers={'Content-Type':_0x9b9a('0xb'),'Accept':_0x9b9a('0xb')};function emit(_0x103020,_0x383346,_0xdee1e0){io['to'](_0x103020)[_0x9b9a('0xc')](_0x383346,_0xdee1e0);}function getTicket(_0xff3e36,_0x184468,_0x4f4412,_0x1a2f62,_0x36679d){logger['info']('Creating\x20new\x20ticket...');var _0x3a5791=_[_0x9b9a('0xd')]({'responder_id':_0x184468['id'],'requester_id':_0x4f4412['id'],'name':util['format'](_0x9b9a('0xe'),_0x36679d[_0x9b9a('0xf')]),'phone':_0x36679d[_0x9b9a('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x9b9a('0x11')](_0x1a2f62[_0x9b9a('0x12')],_0x36679d,'\x20'),'description':intUtil['getString'](_0x1a2f62[_0x9b9a('0x13')],_0x36679d,_0x9b9a('0x14')),'tags':getTags(_0x1a2f62[_0x9b9a('0x15')],_0x9b9a('0x16'))},getCustomFields(_0x1a2f62[_0x9b9a('0x17')],_0x36679d));_0x3a5791[_0x9b9a('0x18')]=_[_0x9b9a('0x19')](_['keyBy'](_0x3a5791[_0x9b9a('0x18')],'id'),_0x9b9a('0x1a'));return request({'uri':util[_0x9b9a('0x1b')](_0x9b9a('0x1c'),_0xff3e36[_0x9b9a('0x1d')]),'method':_0x9b9a('0x1e'),'body':_0x3a5791})[_0x9b9a('0x1f')](function(_0x12c9d6){logger[_0x9b9a('0x20')]('Ticket\x20created!');return _0x12c9d6;});}function getUser(_0xc30d97,_0x8fa7ed){if(intUtil[_0x9b9a('0x21')](_0x8fa7ed)){return request({'uri':util[_0x9b9a('0x1b')]('%s/api/v2/agents',_0xc30d97[_0x9b9a('0x1d')]),'qs':{'email':_0x8fa7ed}})['then'](function(_0x23007b){if(_0x23007b['length']){logger[_0x9b9a('0x20')](_0x9b9a('0x22'));return _['find'](_0x23007b,function(_0x1ec829){return _0x1ec829[_0x9b9a('0x23')][_0x9b9a('0x24')]===_0x8fa7ed;});}else{logger[_0x9b9a('0x20')](_0x9b9a('0x25'));return request({'uri':util[_0x9b9a('0x1b')](_0x9b9a('0x26'),_0xc30d97[_0x9b9a('0x1d')])})[_0x9b9a('0x1f')](function(_0x1ddd71){logger['info'](_0x9b9a('0x27'));return _0x1ddd71;});}});}else{logger[_0x9b9a('0x20')](_0x9b9a('0x28'));return request({'uri':util[_0x9b9a('0x1b')](_0x9b9a('0x26'),_0xc30d97[_0x9b9a('0x1d')])})[_0x9b9a('0x1f')](function(_0x58a611){logger[_0x9b9a('0x20')](_0x9b9a('0x27'));return _0x58a611;});}}function getEndUser(_0x3aa6cc,_0x20468b,_0x3cdc32){logger[_0x9b9a('0x20')](_0x9b9a('0x29'),_0x3cdc32);return request({'uri':util['format']('%s/api/v2/contacts',_0x3aa6cc['remoteUri']),'qs':{'phone':_0x3cdc32}})[_0x9b9a('0x1f')](function(_0x3474f4){if(_0x3474f4['length']){logger[_0x9b9a('0x20')]('Enduser\x20found!');return _[_0x9b9a('0x2a')](_0x3474f4,{'phone':_0x3cdc32});}else{logger[_0x9b9a('0x20')](_0x9b9a('0x2b'));return request({'uri':util[_0x9b9a('0x1b')]('%s/api/v2/contacts',_0x3aa6cc[_0x9b9a('0x1d')]),'method':_0x9b9a('0x1e'),'body':{'name':_0x20468b,'phone':_0x3cdc32}})[_0x9b9a('0x1f')](function(_0x40a0dc){logger[_0x9b9a('0x20')](_0x9b9a('0x2c'));return _0x40a0dc;});}});}function getAuth(_0x98aebb){return util['format']('Basic\x20%s',new Buffer(_0x98aebb[_0x9b9a('0x2d')]+':X')[_0x9b9a('0x2e')](_0x9b9a('0x2f')));}function request(_0x4689e0){logger[_0x9b9a('0x30')]('[HTTP]',JSON['stringify'](_0x4689e0));return rp(_[_0x9b9a('0x8')](_0x4689e0,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x272d1d,_0x5291a7){var _0x10e012=[];if(_0x272d1d&&_0x272d1d['length']>0x0){_0x10e012=_['map'](_0x272d1d,_0x5291a7);}return _0x10e012;}function getCustomFields(_0x31fa77,_0x1b4e43){var _0x32a59d=[];var _0xc16a6b={'custom_fields':[]};if(_0x31fa77[_0x9b9a('0x31')]>0x0){_[_0x9b9a('0x32')](_0x31fa77,function(_0x56273e){if(_0x56273e['type']==='string'&&_0x56273e[_0x9b9a('0x33')]&&!_0x56273e[_0x9b9a('0x34')]){_0xc16a6b[_0x56273e['nameField'][_0x9b9a('0x35')]()]=_0x56273e[_0x9b9a('0x36')][_0x9b9a('0x2e')]();}else if(_0x56273e[_0x9b9a('0x37')]==='string'&&_0x56273e[_0x9b9a('0x38')]&&_0x56273e[_0x9b9a('0x34')]){_0xc16a6b[_0x9b9a('0x18')][_0x9b9a('0x39')]({'id':_0x56273e[_0x9b9a('0x38')],'value':_0x56273e['content'][_0x9b9a('0x2e')]()});}else if(_0x56273e[_0x9b9a('0x37')]===_0x9b9a('0x3a')&&_0x56273e[_0x9b9a('0x3b')]&&_0x56273e[_0x9b9a('0x38')]&&_0x56273e['customField']){_0x1b4e43[_0x56273e[_0x9b9a('0x3b')]]&&_0xc16a6b['custom_fields']['push']({'id':_0x56273e[_0x9b9a('0x38')],'value':_0x1b4e43[_0x56273e[_0x9b9a('0x3b')]]['toString']()});}else if(_0x56273e['type']==='customVariable'&&_0x56273e[_0x9b9a('0x3c')]&&_0x56273e[_0x9b9a('0x3c')][_0x9b9a('0x16')]&&_0x56273e['idField']&&_0x56273e[_0x9b9a('0x34')]){_0x1b4e43[_0x56273e['Variable'][_0x9b9a('0x16')][_0x9b9a('0x35')]()]&&_0xc16a6b[_0x9b9a('0x18')][_0x9b9a('0x39')]({'id':_0x56273e[_0x9b9a('0x38')],'value':_0x1b4e43[_0x56273e[_0x9b9a('0x3c')][_0x9b9a('0x16')]['toLowerCase']()][_0x9b9a('0x2e')]()});}});}return _0xc16a6b;}exports[_0x9b9a('0x3d')]=function(_0x3095d2,_0x21e716,_0x226f0b,_0x48f118,_0x1579b,_0x3836a2){var _0x52d163,_0x4330d7;_0x3836a2['remoteUri']=intUtil[_0x9b9a('0x3e')](_0x3836a2['remoteUri']);_0x3836a2[_0x9b9a('0x3f')]=intUtil[_0x9b9a('0x3e')](_0x3836a2['serverUrl']);if(_0x1579b&&_0x1579b[_0x9b9a('0x40')]){logger['info'](_0x9b9a('0x41'),_0x9b9a('0x42'));_0x21e716[_0x9b9a('0x43')]=util[_0x9b9a('0x1b')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3836a2['serverUrl'],_0x21e716['uniqueid'],md5(_0x21e716['uniqueid']));}else{_0x21e716['recordingURL']='';}headers[_0x9b9a('0x44')]=getAuth(_0x3836a2);return getUser(_0x3836a2,_0x48f118[_0x9b9a('0x24')])[_0x9b9a('0x1f')](function(_0x158fbb){_0x52d163=_0x158fbb;logger[_0x9b9a('0x20')](_0x9b9a('0x45'),_0x52d163['id']);return getEndUser(_0x3836a2,_0x21e716[_0x9b9a('0xf')],_0x21e716[_0x9b9a('0x10')]);})['then'](function(_0x27c757){_0x4330d7=_0x27c757;logger[_0x9b9a('0x20')](_0x9b9a('0x46'),_0x4330d7['id']);return getTicket(_0x3836a2,_0x52d163,_0x4330d7,_0x226f0b,_0x21e716);})[_0x9b9a('0x1f')](function(_0x4acbe8){if(_0x4acbe8&&_0x4acbe8['id']){logger[_0x9b9a('0x20')](_0x9b9a('0x47'));logger[_0x9b9a('0x20')](_0x9b9a('0x48'),_0x4acbe8['id']);logger['info'](_0x9b9a('0x41'),_0x9b9a('0x49'));emit(util[_0x9b9a('0x1b')](_0x9b9a('0x4a'),_0x48f118[_0x9b9a('0x16')]),'trigger:browser:url',{'uri':util[_0x9b9a('0x1b')](_0x9b9a('0x4b'),_0x3836a2[_0x9b9a('0x1d')],_0x4acbe8['id'])});}})['catch'](function(_0x2724f9){logger[_0x9b9a('0x4c')](_0x9b9a('0x41'),JSON['stringify'](_0x2724f9));});};exports[_0x9b9a('0x4d')]=function(_0x1427c4,_0x271be0,_0x191e1c,_0x4642d4,_0x1e268c,_0x31673f,_0xdf5c0f){var _0x4c2d41,_0x268eea;_0x31673f[_0x9b9a('0x1d')]=intUtil[_0x9b9a('0x3e')](_0x31673f[_0x9b9a('0x1d')]);_0x31673f[_0x9b9a('0x3f')]=intUtil['stripTrailingSlash'](_0x31673f['serverUrl']);if(_0xdf5c0f&&_0xdf5c0f[_0x9b9a('0x4e')]&&_0xdf5c0f[_0x9b9a('0x4e')]!==_0x9b9a('0x4f')){logger[_0x9b9a('0x20')](_0x9b9a('0x50'),'Recording\x20is\x20enabled!');_0x271be0[_0x9b9a('0x43')]=util[_0x9b9a('0x1b')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x31673f[_0x9b9a('0x3f')],_0x271be0[_0x9b9a('0x51')],md5(_0x271be0[_0x9b9a('0x51')]));}headers[_0x9b9a('0x44')]=getAuth(_0x31673f);return getUser(_0x31673f,_0x4642d4[_0x9b9a('0x24')])['then'](function(_0x3bd7e0){_0x4c2d41=_0x3bd7e0;logger[_0x9b9a('0x20')]('The\x20User\x20ID\x20is:',_0x4c2d41['id']);return getEndUser(_0x31673f,_0x271be0[_0x9b9a('0x52')],_0x271be0['destcalleridnum']);})['then'](function(_0x5cb5b0){_0x268eea=_0x5cb5b0;logger[_0x9b9a('0x20')](_0x9b9a('0x46'),_0x268eea['id']);return getTicket(_0x31673f,_0x4c2d41,_0x268eea,_0x191e1c,_0x271be0);})[_0x9b9a('0x1f')](function(_0x1b5107){if(_0x1b5107&&_0x1b5107['id']){logger[_0x9b9a('0x20')](_0x9b9a('0x47'));logger[_0x9b9a('0x20')](_0x9b9a('0x48'),_0x1b5107['id']);logger['info']('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x9b9a('0x4a'),_0x4642d4['name']),_0x9b9a('0x53'),{'uri':util[_0x9b9a('0x1b')]('%s/helpdesk/tickets/%d',_0x31673f['remoteUri'],_0x1b5107['id'])});}})[_0x9b9a('0x54')](function(_0x1a50be){logger['error'](_0x9b9a('0x50'),JSON[_0x9b9a('0x55')](_0x1a50be));});};exports[_0x9b9a('0x56')]=function(_0x475abe,_0xf22ba,_0x495e62,_0xb67ef5,_0x2512dd,_0x276ebc){var _0x442381,_0x5cb7d4;_0x276ebc[_0x9b9a('0x1d')]=intUtil[_0x9b9a('0x3e')](_0x276ebc[_0x9b9a('0x1d')]);_0x276ebc['serverUrl']=intUtil[_0x9b9a('0x3e')](_0x276ebc[_0x9b9a('0x3f')]);if(_0x2512dd&&_0x2512dd['monitor_format']){logger[_0x9b9a('0x20')](_0x9b9a('0x57'),_0x9b9a('0x42'));_0xf22ba[_0x9b9a('0x43')]=util['format'](_0x9b9a('0x58'),_0x276ebc['serverUrl'],_0xf22ba[_0x9b9a('0x51')],md5(_0xf22ba['uniqueid']));}else{_0xf22ba[_0x9b9a('0x43')]='';}headers['Authorization']=getAuth(_0x276ebc);return getUser(_0x276ebc,'')[_0x9b9a('0x1f')](function(_0x376492){_0x442381=_0x376492;logger[_0x9b9a('0x20')]('The\x20User\x20ID\x20is:',_0x442381['id']);return getEndUser(_0x276ebc,_0xf22ba[_0x9b9a('0xf')],_0xf22ba[_0x9b9a('0x10')]);})[_0x9b9a('0x1f')](function(_0x499c91){_0x5cb7d4=_0x499c91;logger[_0x9b9a('0x20')](_0x9b9a('0x46'),_0x5cb7d4['id']);return getTicket(_0x276ebc,_0x442381,_0x5cb7d4,_0x495e62,_0xf22ba);})[_0x9b9a('0x1f')](function(_0x19463e){if(_0x19463e){logger[_0x9b9a('0x20')](_0x9b9a('0x47'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x19463e['id']);}})[_0x9b9a('0x54')](function(_0x32c588){logger[_0x9b9a('0x4c')](_0x9b9a('0x57'),JSON['stringify'](_0x32c588));});}; \ No newline at end of file +var _0x70a4=['Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','Tags','name','Fields','custom_fields','mapValues','value','%s/api/v2/tickets','POST','Ticket\x20created!','validateEmail','%s/api/v2/agents','remoteUri','then','length','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20created.','Basic\x20%s','apiKey','toString','[HTTP]','stringify','GET','map','forEach','type','string','nameField','customField','content','idField','push','variable','variableName','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','outbound','recordingFormat','none','Authorization','destcalleridnum','The\x20Enduser\x20ID\x20is:','[OUTBOUND]','error','abandoned','[ABANDONED]','lodash','request-promise','util','ioredis','../../../../config/environment','../../../../config/logger','freshdesk','defaults','redis','localhost','socket.io-emitter','application/json','info','merge','format'];(function(_0x229285,_0x269d79){var _0x15f03a=function(_0x4fd78a){while(--_0x4fd78a){_0x229285['push'](_0x229285['shift']());}};_0x15f03a(++_0x269d79);}(_0x70a4,0x159));var _0x470a=function(_0x3bbe4f,_0xc01772){_0x3bbe4f=_0x3bbe4f-0x0;var _0xebea9f=_0x70a4[_0x3bbe4f];return _0xebea9f;};'use strict';var _=require(_0x470a('0x0'));var rp=require(_0x470a('0x1'));var md5=require('md5');var util=require(_0x470a('0x2'));var Redis=require(_0x470a('0x3'));var intUtil=require('./util');var config=require(_0x470a('0x4'));var logger=require(_0x470a('0x5'))(_0x470a('0x6'));config['redis']=_[_0x470a('0x7')](config[_0x470a('0x8')],{'host':_0x470a('0x9'),'port':0x18eb});var io=require(_0x470a('0xa'))(new Redis(config[_0x470a('0x8')]));var headers={'Content-Type':'application/json','Accept':_0x470a('0xb')};function emit(_0x457b1f,_0x1c018f,_0x18d9df){io['to'](_0x457b1f)['emit'](_0x1c018f,_0x18d9df);}function getTicket(_0x5e53bc,_0x3f59c7,_0x54019f,_0x2a6140,_0x53fb3c){logger[_0x470a('0xc')]('Creating\x20new\x20ticket...');var _0x5b2e2d=_[_0x470a('0xd')]({'responder_id':_0x3f59c7['id'],'requester_id':_0x54019f['id'],'name':util[_0x470a('0xe')](_0x470a('0xf'),_0x53fb3c[_0x470a('0x10')]),'phone':_0x53fb3c[_0x470a('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x470a('0x12')](_0x2a6140[_0x470a('0x13')],_0x53fb3c,'\x20'),'description':intUtil[_0x470a('0x12')](_0x2a6140[_0x470a('0x14')],_0x53fb3c,'
'),'tags':getTags(_0x2a6140[_0x470a('0x15')],_0x470a('0x16'))},getCustomFields(_0x2a6140[_0x470a('0x17')],_0x53fb3c));_0x5b2e2d[_0x470a('0x18')]=_[_0x470a('0x19')](_['keyBy'](_0x5b2e2d[_0x470a('0x18')],'id'),_0x470a('0x1a'));return request({'uri':util[_0x470a('0xe')](_0x470a('0x1b'),_0x5e53bc['remoteUri']),'method':_0x470a('0x1c'),'body':_0x5b2e2d})['then'](function(_0x27745f){logger['info'](_0x470a('0x1d'));return _0x27745f;});}function getUser(_0x50c1cd,_0x50bfaa){if(intUtil[_0x470a('0x1e')](_0x50bfaa)){return request({'uri':util['format'](_0x470a('0x1f'),_0x50c1cd[_0x470a('0x20')]),'qs':{'email':_0x50bfaa}})[_0x470a('0x21')](function(_0x40c8de){if(_0x40c8de[_0x470a('0x22')]){logger[_0x470a('0xc')]('Agent\x20found!');return _[_0x470a('0x23')](_0x40c8de,function(_0x28c22d){return _0x28c22d[_0x470a('0x24')][_0x470a('0x25')]===_0x50bfaa;});}else{logger[_0x470a('0xc')](_0x470a('0x26'));return request({'uri':util[_0x470a('0xe')]('%s/api/v2/agents/me',_0x50c1cd['remoteUri'])})['then'](function(_0x1a03e9){logger[_0x470a('0xc')](_0x470a('0x27'));return _0x1a03e9;});}});}else{logger[_0x470a('0xc')](_0x470a('0x28'));return request({'uri':util['format'](_0x470a('0x29'),_0x50c1cd[_0x470a('0x20')])})['then'](function(_0x1c23ca){logger[_0x470a('0xc')](_0x470a('0x27'));return _0x1c23ca;});}}function getEndUser(_0x5cdda8,_0x3f6ea5,_0x2f53b1){logger['info'](_0x470a('0x2a'),_0x2f53b1);return request({'uri':util[_0x470a('0xe')]('%s/api/v2/contacts',_0x5cdda8[_0x470a('0x20')]),'qs':{'phone':_0x2f53b1}})[_0x470a('0x21')](function(_0x49c3bb){if(_0x49c3bb[_0x470a('0x22')]){logger['info']('Enduser\x20found!');return _[_0x470a('0x23')](_0x49c3bb,{'phone':_0x2f53b1});}else{logger[_0x470a('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x470a('0xe')](_0x470a('0x2b'),_0x5cdda8['remoteUri']),'method':_0x470a('0x1c'),'body':{'name':_0x3f6ea5,'phone':_0x2f53b1}})['then'](function(_0x252f46){logger['info'](_0x470a('0x2c'));return _0x252f46;});}});}function getAuth(_0x40c655){return util['format'](_0x470a('0x2d'),new Buffer(_0x40c655[_0x470a('0x2e')]+':X')[_0x470a('0x2f')]('base64'));}function request(_0x37bf1a){logger['debug'](_0x470a('0x30'),JSON[_0x470a('0x31')](_0x37bf1a));return rp(_[_0x470a('0x7')](_0x37bf1a,{'method':_0x470a('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x1f0c62,_0x3fbd35){var _0x121954=[];if(_0x1f0c62&&_0x1f0c62[_0x470a('0x22')]>0x0){_0x121954=_[_0x470a('0x33')](_0x1f0c62,_0x3fbd35);}return _0x121954;}function getCustomFields(_0x4062a6,_0x550c9f){var _0x45e461=[];var _0x6bc16={'custom_fields':[]};if(_0x4062a6[_0x470a('0x22')]>0x0){_[_0x470a('0x34')](_0x4062a6,function(_0x5f771d){if(_0x5f771d[_0x470a('0x35')]===_0x470a('0x36')&&_0x5f771d[_0x470a('0x37')]&&!_0x5f771d[_0x470a('0x38')]){_0x6bc16[_0x5f771d['nameField']['toLowerCase']()]=_0x5f771d[_0x470a('0x39')][_0x470a('0x2f')]();}else if(_0x5f771d['type']===_0x470a('0x36')&&_0x5f771d[_0x470a('0x3a')]&&_0x5f771d[_0x470a('0x38')]){_0x6bc16[_0x470a('0x18')][_0x470a('0x3b')]({'id':_0x5f771d[_0x470a('0x3a')],'value':_0x5f771d[_0x470a('0x39')][_0x470a('0x2f')]()});}else if(_0x5f771d['type']===_0x470a('0x3c')&&_0x5f771d[_0x470a('0x3d')]&&_0x5f771d[_0x470a('0x3a')]&&_0x5f771d['customField']){_0x550c9f[_0x5f771d[_0x470a('0x3d')]]&&_0x6bc16[_0x470a('0x18')][_0x470a('0x3b')]({'id':_0x5f771d[_0x470a('0x3a')],'value':_0x550c9f[_0x5f771d['variableName']][_0x470a('0x2f')]()});}else if(_0x5f771d[_0x470a('0x35')]===_0x470a('0x3e')&&_0x5f771d[_0x470a('0x3f')]&&_0x5f771d[_0x470a('0x3f')][_0x470a('0x16')]&&_0x5f771d[_0x470a('0x3a')]&&_0x5f771d['customField']){_0x550c9f[_0x5f771d['Variable'][_0x470a('0x16')][_0x470a('0x40')]()]&&_0x6bc16['custom_fields']['push']({'id':_0x5f771d[_0x470a('0x3a')],'value':_0x550c9f[_0x5f771d[_0x470a('0x3f')][_0x470a('0x16')][_0x470a('0x40')]()][_0x470a('0x2f')]()});}});}return _0x6bc16;}exports[_0x470a('0x41')]=function(_0x1a7d0c,_0x555981,_0x59a63c,_0x5cedec,_0x50c639,_0x388f89){var _0x356fab,_0x4e4da2;_0x388f89['remoteUri']=intUtil[_0x470a('0x42')](_0x388f89['remoteUri']);_0x388f89[_0x470a('0x43')]=intUtil['stripTrailingSlash'](_0x388f89[_0x470a('0x43')]);if(_0x50c639&&_0x50c639[_0x470a('0x44')]){logger['info']('[QUEUE]',_0x470a('0x45'));_0x555981[_0x470a('0x46')]=util[_0x470a('0xe')](_0x470a('0x47'),_0x388f89[_0x470a('0x43')],_0x555981[_0x470a('0x48')],md5(_0x555981['uniqueid']));}else{_0x555981[_0x470a('0x46')]='';}headers['Authorization']=getAuth(_0x388f89);return getUser(_0x388f89,_0x5cedec[_0x470a('0x25')])['then'](function(_0x1af084){_0x356fab=_0x1af084;logger[_0x470a('0xc')](_0x470a('0x49'),_0x356fab['id']);return getEndUser(_0x388f89,_0x555981['calleridname'],_0x555981[_0x470a('0x11')]);})[_0x470a('0x21')](function(_0x230bd4){_0x4e4da2=_0x230bd4;logger[_0x470a('0xc')]('The\x20Enduser\x20ID\x20is:',_0x4e4da2['id']);return getTicket(_0x388f89,_0x356fab,_0x4e4da2,_0x59a63c,_0x555981);})['then'](function(_0xbcda35){if(_0xbcda35&&_0xbcda35['id']){logger[_0x470a('0xc')](_0x470a('0x1d'));logger[_0x470a('0xc')](_0x470a('0x4a'),_0xbcda35['id']);logger[_0x470a('0xc')]('[QUEUE]',_0x470a('0x4b'));emit(util[_0x470a('0xe')](_0x470a('0x4c'),_0x5cedec['name']),_0x470a('0x4d'),{'uri':util[_0x470a('0xe')](_0x470a('0x4e'),_0x388f89[_0x470a('0x20')],_0xbcda35['id'])});}})[_0x470a('0x4f')](function(_0x29a20b){logger['error']('[QUEUE]',JSON[_0x470a('0x31')](_0x29a20b));});};exports[_0x470a('0x50')]=function(_0x2a0b33,_0xbdc535,_0x4e565e,_0x3ce225,_0x1d7f2e,_0xb93e2f,_0x3d8bcb){var _0x3e7be5,_0x15469d;_0xb93e2f['remoteUri']=intUtil[_0x470a('0x42')](_0xb93e2f['remoteUri']);_0xb93e2f[_0x470a('0x43')]=intUtil[_0x470a('0x42')](_0xb93e2f[_0x470a('0x43')]);if(_0x3d8bcb&&_0x3d8bcb[_0x470a('0x51')]&&_0x3d8bcb[_0x470a('0x51')]!==_0x470a('0x52')){logger[_0x470a('0xc')]('[OUTBOUND]',_0x470a('0x45'));_0xbdc535[_0x470a('0x46')]=util[_0x470a('0xe')](_0x470a('0x47'),_0xb93e2f[_0x470a('0x43')],_0xbdc535[_0x470a('0x48')],md5(_0xbdc535[_0x470a('0x48')]));}headers[_0x470a('0x53')]=getAuth(_0xb93e2f);return getUser(_0xb93e2f,_0x3ce225[_0x470a('0x25')])[_0x470a('0x21')](function(_0x27ccdb){_0x3e7be5=_0x27ccdb;logger['info'](_0x470a('0x49'),_0x3e7be5['id']);return getEndUser(_0xb93e2f,_0xbdc535['destcalleridname'],_0xbdc535[_0x470a('0x54')]);})[_0x470a('0x21')](function(_0x43a80a){_0x15469d=_0x43a80a;logger[_0x470a('0xc')](_0x470a('0x55'),_0x15469d['id']);return getTicket(_0xb93e2f,_0x3e7be5,_0x15469d,_0x4e565e,_0xbdc535);})[_0x470a('0x21')](function(_0x5cc9aa){if(_0x5cc9aa&&_0x5cc9aa['id']){logger[_0x470a('0xc')](_0x470a('0x1d'));logger[_0x470a('0xc')](_0x470a('0x4a'),_0x5cc9aa['id']);logger[_0x470a('0xc')](_0x470a('0x56'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x3ce225[_0x470a('0x16')]),_0x470a('0x4d'),{'uri':util[_0x470a('0xe')]('%s/helpdesk/tickets/%d',_0xb93e2f[_0x470a('0x20')],_0x5cc9aa['id'])});}})['catch'](function(_0xf36252){logger[_0x470a('0x57')](_0x470a('0x56'),JSON[_0x470a('0x31')](_0xf36252));});};exports[_0x470a('0x58')]=function(_0x363d5a,_0x2595fe,_0x240dec,_0x4c2e2e,_0x3625ec,_0x21e1d5){var _0x1c9b59,_0x44767b;_0x21e1d5[_0x470a('0x20')]=intUtil['stripTrailingSlash'](_0x21e1d5[_0x470a('0x20')]);_0x21e1d5[_0x470a('0x43')]=intUtil[_0x470a('0x42')](_0x21e1d5[_0x470a('0x43')]);if(_0x3625ec&&_0x3625ec[_0x470a('0x44')]){logger['info'](_0x470a('0x59'),_0x470a('0x45'));_0x2595fe['recordingURL']=util['format'](_0x470a('0x47'),_0x21e1d5[_0x470a('0x43')],_0x2595fe[_0x470a('0x48')],md5(_0x2595fe[_0x470a('0x48')]));}else{_0x2595fe[_0x470a('0x46')]='';}headers['Authorization']=getAuth(_0x21e1d5);return getUser(_0x21e1d5,'')[_0x470a('0x21')](function(_0x3ed9ab){_0x1c9b59=_0x3ed9ab;logger['info'](_0x470a('0x49'),_0x1c9b59['id']);return getEndUser(_0x21e1d5,_0x2595fe[_0x470a('0x10')],_0x2595fe[_0x470a('0x11')]);})[_0x470a('0x21')](function(_0x171bdb){_0x44767b=_0x171bdb;logger[_0x470a('0xc')](_0x470a('0x55'),_0x44767b['id']);return getTicket(_0x21e1d5,_0x1c9b59,_0x44767b,_0x240dec,_0x2595fe);})['then'](function(_0x16a65f){if(_0x16a65f){logger['info']('Ticket\x20created!');logger[_0x470a('0xc')]('The\x20Ticket\x20ID\x20is:',_0x16a65f['id']);}})[_0x470a('0x4f')](function(_0x30c92e){logger[_0x470a('0x57')]('[ABANDONED]',JSON[_0x470a('0x31')](_0x30c92e));});}; \ 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 3df1243..3e72cdc 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 _0xab7c=['lodash','request-promise','md5','moment','bluebird','ioredis','./util','../../../../config/logger','freshsales','redis','defaults','socket.io-emitter','/api/selector/owners','headers','then','users','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','toUpperCase','message','GET','info','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','length','email','userId','User\x20found:','Getting\x20contacts\x20filter','filters','forEach','name','All\x20Contacts','/api/contacts/view/','Searching\x20contact\x20with\x20phone','contacts','find','work_number','contactNumber','mobile_number','endUserId','Contact\x20found:','Contact\x20created:','catch','POST','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','error','Creating\x20new\x20task','/api/tasks','getString','Subjects','Contact','task','Task\x20created:','ticketId','/contacts/','user:%s','emit','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','destcalleridnum','calleridnum','abandoned','queue','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect'];(function(_0x1b9a20,_0x38575a){var _0x491922=function(_0x329122){while(--_0x329122){_0x1b9a20['push'](_0x1b9a20['shift']());}};_0x491922(++_0x38575a);}(_0xab7c,0x15c));var _0xcab7=function(_0x8ce7d8,_0x67e33b){_0x8ce7d8=_0x8ce7d8-0x0;var _0x337ce2=_0xab7c[_0x8ce7d8];return _0x337ce2;};'use strict';var _=require(_0xcab7('0x0'));var rp=require(_0xcab7('0x1'));var md5=require(_0xcab7('0x2'));var util=require('util');var moment=require(_0xcab7('0x3'));var Promise=require(_0xcab7('0x4'));var Redis=require(_0xcab7('0x5'));var intUtil=require(_0xcab7('0x6'));var config=require('../../../../config/environment');var logger=require(_0xcab7('0x7'))(_0xcab7('0x8'));config[_0xcab7('0x9')]=_[_0xcab7('0xa')](config[_0xcab7('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xcab7('0xb'))(new Redis(config[_0xcab7('0x9')]));function getAdminId(_0x44f0eb,_0x22c07c,_0x34d07d,_0x565783){return new Promise(function(_0x1014ef,_0x4ffe36){var _0x246e6d=![];var _0x548f0c={'method':'GET','uri':_0x565783+_0xcab7('0xc'),'json':!![]};_0x548f0c[_0xcab7('0xd')]=_0x34d07d;logger['info']('Getting\x20admin\x20information');return rp(_0x548f0c)[_0xcab7('0xe')](function(_0x164f37){if(_0x164f37){var _0x346155=_0x164f37[_0xcab7('0xf')];var _0x311fee=null;for(_0x311fee=0x0;_0x311fee<_0x346155['length'];_0x311fee++){if(_0x346155[_0x311fee]['email']===_0x44f0eb[_0xcab7('0x10')]){_0x44f0eb[_0xcab7('0x11')]=_0x346155[_0x311fee]['id'];_0x246e6d=!![];}}if(_0x246e6d){logger['info'](_0xcab7('0x12'),_0x44f0eb['adminId']);_0x1014ef(_0x44f0eb);}else{_0x4ffe36({'statusCode':0x194,'message':_0xcab7('0x13')});}}else{_0x4ffe36({'statusCode':0x194,'message':_0xcab7('0x13')});}})['catch'](function(_0x32e2d3){logger['error']('['+[_0x22c07c[_0xcab7('0x14')]()]+']',_0x32e2d3[_0xcab7('0x15')]);_0x4ffe36(_0x32e2d3);});});}function getUser(_0x5d7c7e,_0x39197b,_0x1efdb9){return function(_0x3919f7){return new Promise(function(_0xacbb8f,_0x45928c){var _0x586a89={'method':_0xcab7('0x16'),'uri':_0x1efdb9+_0xcab7('0xc'),'json':!![]};_0x586a89[_0xcab7('0xd')]=_0x39197b;logger[_0xcab7('0x17')](_0xcab7('0x18'));return rp(_0x586a89)['then'](function(_0x3710ea){if(_0x3710ea){var _0x1bf622=_0x3710ea[_0xcab7('0xf')];var _0x8e91d5=![];var _0x347df2=null;if(_0x3919f7[_0xcab7('0x19')]!==null){logger[_0xcab7('0x17')](_0xcab7('0x1a'),_0x3919f7[_0xcab7('0x19')]);_0x3919f7[_0xcab7('0x1b')]=_0x3919f7['agentEmail'];for(_0x347df2=0x0;_0x347df2<_0x1bf622[_0xcab7('0x1c')];_0x347df2++){if(_0x1bf622[_0x347df2][_0xcab7('0x1d')]===_0x3919f7[_0xcab7('0x19')]){_0x8e91d5=!![];_0x3919f7[_0xcab7('0x1e')]=_0x1bf622[_0x347df2]['id'];logger[_0xcab7('0x17')](_0xcab7('0x1f'),_0x3919f7[_0xcab7('0x1e')]);}}}if(!_0x8e91d5){logger[_0xcab7('0x17')]('Admin\x20selected');_0x3919f7[_0xcab7('0x1b')]=_0x3919f7[_0xcab7('0x10')];_0x3919f7[_0xcab7('0x1e')]=_0x3919f7[_0xcab7('0x11')];_0x8e91d5=!![];}if(_0x8e91d5){_0xacbb8f(_0x3919f7);}else{_0x45928c({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x45928c({'statusCode':0x194,'message':_0xcab7('0x13')});}})['catch'](function(_0x4e2800){logger['error']('['+[_0x5d7c7e[_0xcab7('0x14')]()]+']',_0x4e2800[_0xcab7('0x15')]);_0x45928c(_0x4e2800);});});};}function getEndUser(_0x111a1c,_0x1c9f20,_0x59be7d){return function(_0x1dc6bd){return new Promise(function(_0x4a2890,_0x56a735){var _0x461e10=0x0;var _0x333f6a={'method':_0xcab7('0x16'),'uri':_0x59be7d+'/api/contacts/filters','json':!![]};_0x333f6a['headers']=_0x1c9f20;logger['info'](_0xcab7('0x20'));return rp(_0x333f6a)[_0xcab7('0xe')](function(_0x241230){_0x241230[_0xcab7('0x21')][_0xcab7('0x22')](function(_0xee0a4){if(_0xee0a4[_0xcab7('0x23')]===_0xcab7('0x24')){_0x461e10=_0xee0a4['id'];}});})[_0xcab7('0xe')](function(){logger[_0xcab7('0x17')]('Getting\x20contact\x20list');var _0xbafdc2={'method':'GET','uri':_0x59be7d+_0xcab7('0x25')+_0x461e10,'json':!![]};_0xbafdc2[_0xcab7('0xd')]=_0x1c9f20;return rp(_0xbafdc2);})['then'](function(_0x707362){logger[_0xcab7('0x17')](_0xcab7('0x26'),_0x1dc6bd['contactNumber']);if(_0x707362[_0xcab7('0x27')]['length']>0x0){var _0x179394=_[_0xcab7('0x28')](_0x707362[_0xcab7('0x27')],function(_0x4b8717){if(_0x4b8717[_0xcab7('0x29')]===_0x1dc6bd[_0xcab7('0x2a')]||_0x4b8717[_0xcab7('0x2b')]===_0x1dc6bd['contactNumber']){return _0x4b8717;}});if(_0x179394){_0x1dc6bd[_0xcab7('0x2c')]=_0x179394['id'];logger[_0xcab7('0x17')](_0xcab7('0x2d'),_0x1dc6bd[_0xcab7('0x2c')]);_0x4a2890(_0x1dc6bd);}else{return createEndUser(_0x1dc6bd,_0x111a1c,_0x1c9f20,_0x59be7d)['then'](function(_0x12ab64){logger[_0xcab7('0x17')](_0xcab7('0x2e'),_0x1dc6bd[_0xcab7('0x2c')]);_0x4a2890(_0x12ab64);});}}else{return createEndUser(_0x1dc6bd,_0x111a1c,_0x1c9f20,_0x59be7d)[_0xcab7('0xe')](function(_0x44a138){logger[_0xcab7('0x17')]('Contact\x20created:',_0x1dc6bd[_0xcab7('0x2c')]);_0x4a2890(_0x44a138);});}})[_0xcab7('0x2f')](function(_0x1e92f1){throw new Error(_0x1e92f1[_0xcab7('0x15')]);});});};}function createEndUser(_0x51d24a,_0x1cdc63,_0x515f6c,_0x5dc40e){return new Promise(function(_0x240907,_0x2f1ac6){var _0x146164=moment();var _0x538451={'method':_0xcab7('0x30'),'uri':_0x5dc40e+'/api/contacts','body':{'contact':{'last_name':_0x51d24a[_0xcab7('0x2a')],'work_number':_0x51d24a[_0xcab7('0x2a')],'mobile_number':_0x51d24a['contactNumber'],'owner_id':_0x51d24a[_0xcab7('0x1e')],'created_at':_0x146164[_0xcab7('0x31')](_0xcab7('0x32'))}},'json':!![]};_0x538451[_0xcab7('0xd')]=_0x515f6c;logger['info'](_0xcab7('0x33'));return rp(_0x538451)[_0xcab7('0xe')](function(_0x2d9b7c){_0x51d24a['endUserId']=_0x2d9b7c['contact']['id'];_0x240907(_0x51d24a);})[_0xcab7('0x2f')](function(_0x2425d6){logger[_0xcab7('0x34')]('['+[_0x1cdc63['toUpperCase']()]+']',_0x2425d6['message']);_0x2f1ac6(_0x2425d6['message']);});});}function getTicket(_0x500b35,_0x126638,_0x2ae758,_0x4b4e66,_0x2472bb){return function(_0x13d36e){logger[_0xcab7('0x17')](_0xcab7('0x35'));return new Promise(function(_0xfc6ac7,_0x52dd3a){var _0x4d39fc=moment();var _0x3dfa4e={'method':_0xcab7('0x30'),'uri':_0x2ae758+_0xcab7('0x36'),'body':{'title':intUtil[_0xcab7('0x37')](_0x4b4e66[_0xcab7('0x38')],_0x2472bb,'\x20'),'description':intUtil['getString'](_0x4b4e66['Descriptions'],_0x2472bb,'\x0a'),'owner_id':_0x13d36e[_0xcab7('0x1e')],'creater_id':_0x13d36e[_0xcab7('0x11')],'targetable_id':_0x13d36e['endUserId'],'targetable_type':_0xcab7('0x39'),'created_at':_0x4d39fc[_0xcab7('0x31')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x4d39fc['add'](0x1e,'m')[_0xcab7('0x31')](_0xcab7('0x32'))},'json':!![]};_0x3dfa4e[_0xcab7('0xd')]=_0x126638;return rp(_0x3dfa4e)['then'](function(_0x3e52ab){_0x13d36e['ticketId']=_0x3e52ab[_0xcab7('0x3a')]['id'];logger[_0xcab7('0x17')](_0xcab7('0x3b'),_0x13d36e[_0xcab7('0x3c')]);_0xfc6ac7(_0x13d36e);})['catch'](function(_0x5eb208){logger['error']('['+[_0x500b35['toUpperCase']()]+']',_0x5eb208['message']);_0x52dd3a(_0x5eb208[_0xcab7('0x15')]);});});};}function emit(_0x1b1779,_0x18bae1,_0x1d51df){var _0x25f8ad={'uri':_0x1b1779+_0xcab7('0x3d')+_0x1d51df};io['to'](util[_0xcab7('0x31')](_0xcab7('0x3e'),_0x18bae1))[_0xcab7('0x3f')]('trigger:browser:url',_0x25f8ad);}exports['cs']=function(_0x5d8bb0,_0x20043f,_0x23c1a5,_0x38f454,_0x3a8503,_0x1e2d43,_0x5dc720,_0x2dfa1d){var _0x4cae20={};var _0x4a96e3={'Authorization':_0xcab7('0x40')+_0x1e2d43[_0xcab7('0x41')]};_0x1e2d43[_0xcab7('0x42')]=intUtil[_0xcab7('0x43')](_0x1e2d43[_0xcab7('0x42')]);_0x1e2d43[_0xcab7('0x44')]=intUtil['stripTrailingSlash'](_0x1e2d43['serverUrl']);var _0x4984b9=_0x1e2d43[_0xcab7('0x42')];_0x4cae20[_0xcab7('0x10')]=_0x1e2d43[_0xcab7('0x45')];_0x4cae20[_0xcab7('0x2a')]=_0x2dfa1d[_0xcab7('0x46')]()==='outbound'?_0x20043f[_0xcab7('0x47')]:_0x20043f[_0xcab7('0x48')];_0x4cae20['callDirection']=_0x2dfa1d==='queue'||_0x2dfa1d===_0xcab7('0x49')?_0xcab7('0x4a'):_0xcab7('0x4b');if(_0x38f454){_0x4cae20[_0xcab7('0x19')]=_0x38f454[_0xcab7('0x1d')];}var _0x581c70=util['format'](_0xcab7('0x4c'),_0x1e2d43[_0xcab7('0x44')],_0x20043f[_0xcab7('0x4d')],md5(_0x20043f[_0xcab7('0x4d')]));if(_0x3a8503&&_0x3a8503[_0xcab7('0x4e')]){logger[_0xcab7('0x17')](_0xcab7('0x4f'),_0xcab7('0x50'));_0x20043f[_0xcab7('0x51')]=_0x581c70;}else if(_0x5dc720&&_0x5dc720[_0xcab7('0x52')]&&_0x5dc720[_0xcab7('0x52')]!==_0xcab7('0x53')){logger[_0xcab7('0x17')]('[OUTBOUND]',_0xcab7('0x50'));_0x20043f[_0xcab7('0x51')]=_0x581c70;}else{_0x20043f[_0xcab7('0x51')]='';}return getAdminId(_0x4cae20,_0x2dfa1d,_0x4a96e3,_0x4984b9)['then'](getUser(_0x2dfa1d,_0x4a96e3,_0x4984b9))[_0xcab7('0xe')](getEndUser(_0x2dfa1d,_0x4a96e3,_0x4984b9))[_0xcab7('0xe')](getTicket(_0x2dfa1d,_0x4a96e3,_0x4984b9,_0x23c1a5,_0x20043f))[_0xcab7('0xe')](function(_0x1fc35a){logger['info'](util[_0xcab7('0x31')]('The\x20ticket\x20ID\x20is:\x20%s',_0x1fc35a[_0xcab7('0x3c')]));if(_0x2dfa1d!==_0xcab7('0x49')){logger['info']('['+[_0x2dfa1d[_0xcab7('0x14')]()]+']',_0xcab7('0x54'));emit(_0x4984b9,_0x38f454[_0xcab7('0x23')],_0x1fc35a['endUserId']);}})[_0xcab7('0x2f')](function(_0x5502b6){logger[_0xcab7('0x34')]('['+[_0x2dfa1d[_0xcab7('0x14')]()]+_0xcab7('0x55'),util[_0xcab7('0x56')](_0x5502b6,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x94bc=['apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','calleridnum','callDirection','abandoned','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','users','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','Getting\x20user\x20list','then','agentEmail','userEmail','length','userId','User\x20found:','Admin\x20selected','error','message','/api/contacts/filters','filters','Getting\x20contact\x20list','/api/contacts/view/','Searching\x20contact\x20with\x20phone','contactNumber','contacts','mobile_number','endUserId','Contact\x20created:','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','toUpperCase','Creating\x20new\x20task','/api/tasks','Subjects','getString','Descriptions','Contact','add','Task\x20created:','ticketId','/contacts/','user:%s','trigger:browser:url','Token\x20token='];(function(_0x2ceea8,_0x542b4f){var _0x44f71a=function(_0x5035df){while(--_0x5035df){_0x2ceea8['push'](_0x2ceea8['shift']());}};_0x44f71a(++_0x542b4f);}(_0x94bc,0x17a));var _0xc94b=function(_0x332251,_0x3c134f){_0x332251=_0x332251-0x0;var _0x592e7d=_0x94bc[_0x332251];return _0x592e7d;};'use strict';var _=require(_0xc94b('0x0'));var rp=require(_0xc94b('0x1'));var md5=require(_0xc94b('0x2'));var util=require(_0xc94b('0x3'));var moment=require(_0xc94b('0x4'));var Promise=require(_0xc94b('0x5'));var Redis=require(_0xc94b('0x6'));var intUtil=require(_0xc94b('0x7'));var config=require(_0xc94b('0x8'));var logger=require(_0xc94b('0x9'))(_0xc94b('0xa'));config[_0xc94b('0xb')]=_[_0xc94b('0xc')](config[_0xc94b('0xb')],{'host':_0xc94b('0xd'),'port':0x18eb});var io=require(_0xc94b('0xe'))(new Redis(config['redis']));function getAdminId(_0xc1598d,_0x15a735,_0x129c0d,_0x361008){return new Promise(function(_0x1ff8a9,_0x494ed2){var _0x219523=![];var _0x1966fc={'method':_0xc94b('0xf'),'uri':_0x361008+_0xc94b('0x10'),'json':!![]};_0x1966fc[_0xc94b('0x11')]=_0x129c0d;logger[_0xc94b('0x12')](_0xc94b('0x13'));return rp(_0x1966fc)['then'](function(_0x5630c8){if(_0x5630c8){var _0x13cb40=_0x5630c8[_0xc94b('0x14')];var _0x1421cc=null;for(_0x1421cc=0x0;_0x1421cc<_0x13cb40['length'];_0x1421cc++){if(_0x13cb40[_0x1421cc][_0xc94b('0x15')]===_0xc1598d[_0xc94b('0x16')]){_0xc1598d[_0xc94b('0x17')]=_0x13cb40[_0x1421cc]['id'];_0x219523=!![];}}if(_0x219523){logger[_0xc94b('0x12')](_0xc94b('0x18'),_0xc1598d['adminId']);_0x1ff8a9(_0xc1598d);}else{_0x494ed2({'statusCode':0x194,'message':_0xc94b('0x19')});}}else{_0x494ed2({'statusCode':0x194,'message':_0xc94b('0x19')});}})[_0xc94b('0x1a')](function(_0x1ecec1){logger['error']('['+[_0x15a735['toUpperCase']()]+']',_0x1ecec1['message']);_0x494ed2(_0x1ecec1);});});}function getUser(_0x2f64c9,_0x370edf,_0x20a1b6){return function(_0x12f0fa){return new Promise(function(_0x3d55f6,_0xe3b68a){var _0x3913c3={'method':_0xc94b('0xf'),'uri':_0x20a1b6+_0xc94b('0x10'),'json':!![]};_0x3913c3[_0xc94b('0x11')]=_0x370edf;logger['info'](_0xc94b('0x1b'));return rp(_0x3913c3)[_0xc94b('0x1c')](function(_0x5ae265){if(_0x5ae265){var _0x843c33=_0x5ae265[_0xc94b('0x14')];var _0x1d6159=![];var _0x2da786=null;if(_0x12f0fa[_0xc94b('0x1d')]!==null){logger[_0xc94b('0x12')]('Getting\x20user\x20with\x20email',_0x12f0fa['agentEmail']);_0x12f0fa[_0xc94b('0x1e')]=_0x12f0fa['agentEmail'];for(_0x2da786=0x0;_0x2da786<_0x843c33[_0xc94b('0x1f')];_0x2da786++){if(_0x843c33[_0x2da786]['email']===_0x12f0fa[_0xc94b('0x1d')]){_0x1d6159=!![];_0x12f0fa[_0xc94b('0x20')]=_0x843c33[_0x2da786]['id'];logger[_0xc94b('0x12')](_0xc94b('0x21'),_0x12f0fa['userId']);}}}if(!_0x1d6159){logger[_0xc94b('0x12')](_0xc94b('0x22'));_0x12f0fa[_0xc94b('0x1e')]=_0x12f0fa[_0xc94b('0x16')];_0x12f0fa[_0xc94b('0x20')]=_0x12f0fa[_0xc94b('0x17')];_0x1d6159=!![];}if(_0x1d6159){_0x3d55f6(_0x12f0fa);}else{_0xe3b68a({'statusCode':0x194,'message':_0xc94b('0x19')});}}else{_0xe3b68a({'statusCode':0x194,'message':_0xc94b('0x19')});}})[_0xc94b('0x1a')](function(_0x1819a5){logger[_0xc94b('0x23')]('['+[_0x2f64c9['toUpperCase']()]+']',_0x1819a5[_0xc94b('0x24')]);_0xe3b68a(_0x1819a5);});});};}function getEndUser(_0x2ec91e,_0x5be882,_0x4cd6ee){return function(_0x4075b8){return new Promise(function(_0x1cbe6b,_0x5e0add){var _0x562094=0x0;var _0x273713={'method':_0xc94b('0xf'),'uri':_0x4cd6ee+_0xc94b('0x25'),'json':!![]};_0x273713['headers']=_0x5be882;logger[_0xc94b('0x12')]('Getting\x20contacts\x20filter');return rp(_0x273713)['then'](function(_0x5eece7){_0x5eece7[_0xc94b('0x26')]['forEach'](function(_0x39422a){if(_0x39422a['name']==='All\x20Contacts'){_0x562094=_0x39422a['id'];}});})[_0xc94b('0x1c')](function(){logger[_0xc94b('0x12')](_0xc94b('0x27'));var _0x54ce36={'method':_0xc94b('0xf'),'uri':_0x4cd6ee+_0xc94b('0x28')+_0x562094,'json':!![]};_0x54ce36['headers']=_0x5be882;return rp(_0x54ce36);})[_0xc94b('0x1c')](function(_0x3f5126){logger[_0xc94b('0x12')](_0xc94b('0x29'),_0x4075b8[_0xc94b('0x2a')]);if(_0x3f5126['contacts'][_0xc94b('0x1f')]>0x0){var _0x3a8a86=_['find'](_0x3f5126[_0xc94b('0x2b')],function(_0x54746e){if(_0x54746e['work_number']===_0x4075b8[_0xc94b('0x2a')]||_0x54746e[_0xc94b('0x2c')]===_0x4075b8[_0xc94b('0x2a')]){return _0x54746e;}});if(_0x3a8a86){_0x4075b8[_0xc94b('0x2d')]=_0x3a8a86['id'];logger['info']('Contact\x20found:',_0x4075b8['endUserId']);_0x1cbe6b(_0x4075b8);}else{return createEndUser(_0x4075b8,_0x2ec91e,_0x5be882,_0x4cd6ee)[_0xc94b('0x1c')](function(_0x3c3de3){logger[_0xc94b('0x12')](_0xc94b('0x2e'),_0x4075b8['endUserId']);_0x1cbe6b(_0x3c3de3);});}}else{return createEndUser(_0x4075b8,_0x2ec91e,_0x5be882,_0x4cd6ee)[_0xc94b('0x1c')](function(_0x272712){logger[_0xc94b('0x12')](_0xc94b('0x2e'),_0x4075b8[_0xc94b('0x2d')]);_0x1cbe6b(_0x272712);});}})[_0xc94b('0x1a')](function(_0x3dabea){throw new Error(_0x3dabea[_0xc94b('0x24')]);});});};}function createEndUser(_0x277633,_0x13b866,_0x1a16e3,_0x28f2e5){return new Promise(function(_0x3ead41,_0x209f01){var _0x5c1f69=moment();var _0x3642a0={'method':_0xc94b('0x2f'),'uri':_0x28f2e5+_0xc94b('0x30'),'body':{'contact':{'last_name':_0x277633[_0xc94b('0x2a')],'work_number':_0x277633[_0xc94b('0x2a')],'mobile_number':_0x277633['contactNumber'],'owner_id':_0x277633[_0xc94b('0x20')],'created_at':_0x5c1f69[_0xc94b('0x31')](_0xc94b('0x32'))}},'json':!![]};_0x3642a0[_0xc94b('0x11')]=_0x1a16e3;logger[_0xc94b('0x12')](_0xc94b('0x33'));return rp(_0x3642a0)[_0xc94b('0x1c')](function(_0x1d406c){_0x277633[_0xc94b('0x2d')]=_0x1d406c[_0xc94b('0x34')]['id'];_0x3ead41(_0x277633);})[_0xc94b('0x1a')](function(_0x4af70a){logger[_0xc94b('0x23')]('['+[_0x13b866[_0xc94b('0x35')]()]+']',_0x4af70a[_0xc94b('0x24')]);_0x209f01(_0x4af70a['message']);});});}function getTicket(_0x522f7f,_0x3a3803,_0x53f9af,_0x41dd55,_0x3baf60){return function(_0xb07bf0){logger[_0xc94b('0x12')](_0xc94b('0x36'));return new Promise(function(_0x4b6b48,_0x3e057f){var _0x59d40c=moment();var _0x4c59d7={'method':_0xc94b('0x2f'),'uri':_0x53f9af+_0xc94b('0x37'),'body':{'title':intUtil['getString'](_0x41dd55[_0xc94b('0x38')],_0x3baf60,'\x20'),'description':intUtil[_0xc94b('0x39')](_0x41dd55[_0xc94b('0x3a')],_0x3baf60,'\x0a'),'owner_id':_0xb07bf0[_0xc94b('0x20')],'creater_id':_0xb07bf0[_0xc94b('0x17')],'targetable_id':_0xb07bf0[_0xc94b('0x2d')],'targetable_type':_0xc94b('0x3b'),'created_at':_0x59d40c[_0xc94b('0x31')](_0xc94b('0x32')),'due_date':_0x59d40c[_0xc94b('0x3c')](0x1e,'m')[_0xc94b('0x31')](_0xc94b('0x32'))},'json':!![]};_0x4c59d7['headers']=_0x3a3803;return rp(_0x4c59d7)['then'](function(_0x299395){_0xb07bf0['ticketId']=_0x299395['task']['id'];logger[_0xc94b('0x12')](_0xc94b('0x3d'),_0xb07bf0[_0xc94b('0x3e')]);_0x4b6b48(_0xb07bf0);})[_0xc94b('0x1a')](function(_0x53b5a2){logger[_0xc94b('0x23')]('['+[_0x522f7f['toUpperCase']()]+']',_0x53b5a2['message']);_0x3e057f(_0x53b5a2[_0xc94b('0x24')]);});});};}function emit(_0xd909c,_0x483965,_0x35471d){var _0x264805={'uri':_0xd909c+_0xc94b('0x3f')+_0x35471d};io['to'](util['format'](_0xc94b('0x40'),_0x483965))['emit'](_0xc94b('0x41'),_0x264805);}exports['cs']=function(_0x59e431,_0x54a37f,_0x4ce0b2,_0x3995a6,_0x5443fb,_0x58e9be,_0x1d8ade,_0x2182e3){var _0x1c2a19={};var _0x1e159b={'Authorization':_0xc94b('0x42')+_0x58e9be[_0xc94b('0x43')]};_0x58e9be[_0xc94b('0x44')]=intUtil[_0xc94b('0x45')](_0x58e9be[_0xc94b('0x44')]);_0x58e9be['serverUrl']=intUtil['stripTrailingSlash'](_0x58e9be[_0xc94b('0x46')]);var _0x43db20=_0x58e9be[_0xc94b('0x44')];_0x1c2a19[_0xc94b('0x16')]=_0x58e9be[_0xc94b('0x47')];_0x1c2a19[_0xc94b('0x2a')]=_0x2182e3[_0xc94b('0x48')]()===_0xc94b('0x49')?_0x54a37f['destcalleridnum']:_0x54a37f[_0xc94b('0x4a')];_0x1c2a19[_0xc94b('0x4b')]=_0x2182e3==='queue'||_0x2182e3===_0xc94b('0x4c')?_0xc94b('0x4d'):_0xc94b('0x49');if(_0x3995a6){_0x1c2a19[_0xc94b('0x1d')]=_0x3995a6[_0xc94b('0x15')];}var _0x17a4b8=util['format'](_0xc94b('0x4e'),_0x58e9be[_0xc94b('0x46')],_0x54a37f[_0xc94b('0x4f')],md5(_0x54a37f['uniqueid']));if(_0x5443fb&&_0x5443fb[_0xc94b('0x50')]){logger[_0xc94b('0x12')]('[QUEUE]',_0xc94b('0x51'));_0x54a37f[_0xc94b('0x52')]=_0x17a4b8;}else if(_0x1d8ade&&_0x1d8ade[_0xc94b('0x53')]&&_0x1d8ade[_0xc94b('0x53')]!==_0xc94b('0x54')){logger['info'](_0xc94b('0x55'),'Recording\x20is\x20enabled!');_0x54a37f['recordingURL']=_0x17a4b8;}else{_0x54a37f['recordingURL']='';}return getAdminId(_0x1c2a19,_0x2182e3,_0x1e159b,_0x43db20)[_0xc94b('0x1c')](getUser(_0x2182e3,_0x1e159b,_0x43db20))[_0xc94b('0x1c')](getEndUser(_0x2182e3,_0x1e159b,_0x43db20))[_0xc94b('0x1c')](getTicket(_0x2182e3,_0x1e159b,_0x43db20,_0x4ce0b2,_0x54a37f))[_0xc94b('0x1c')](function(_0x178c73){logger[_0xc94b('0x12')](util['format'](_0xc94b('0x56'),_0x178c73[_0xc94b('0x3e')]));if(_0x2182e3!==_0xc94b('0x4c')){logger[_0xc94b('0x12')]('['+[_0x2182e3[_0xc94b('0x35')]()]+']',_0xc94b('0x57'));emit(_0x43db20,_0x3995a6['name'],_0x178c73[_0xc94b('0x2d')]);}})['catch'](function(_0x252c02){logger[_0xc94b('0x23')]('['+[_0x2182e3[_0xc94b('0x35')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0xc94b('0x58')](_0x252c02,{'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 9474352..7c3a080 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 _0xa9e0=['./vtiger','./servicenow','./dynamics365','./freshsales','salesforce','sugarcrm','freshdesk','vtiger','servicenow','exec','toLowerCase','data1','data2','find','Configurations','data3','queue','routeId','log','abandoned','zendesk','zoho','desk','freshsales','dynamics365','unknown\x20integration','../../../../config/logger','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','format','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./freshdesk','./desk'];(function(_0x314a3f,_0x1a6f01){var _0x9295c=function(_0x344715){while(--_0x344715){_0x314a3f['push'](_0x314a3f['shift']());}};_0x9295c(++_0x1a6f01);}(_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 zendesk=require(_0x0a9e('0x2'));var salesforce=require('./salesforce');var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x0a9e('0x3'));var zoho=require('./zoho');var desk=require(_0x0a9e('0x4'));var vtiger=require(_0x0a9e('0x5'));var servicenow=require(_0x0a9e('0x6'));var dynamics365=require(_0x0a9e('0x7'));var freshsales=require(_0x0a9e('0x8'));var integrations=['zendesk',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'zoho','desk',_0x0a9e('0xc'),'dynamics365','freshsales',_0x0a9e('0xd')];exports[_0x0a9e('0xe')]=function(_0x307b3e,_0x3ab53f,_0xfeb75b,_0xbd1168,_0x4a4c56,_0x50dfb2){if(_0xfeb75b){if(_['includes'](integrations,_0x307b3e['data1'][_0x0a9e('0xf')]())){try{var _0x36471c=null;var _0xd5b662='';var _0x26d672=_0xfeb75b[_0x307b3e[_0x0a9e('0x10')][_0x0a9e('0xf')]()];if(_0x26d672){var _0x5db4b0=_0x26d672[_0x307b3e[_0x0a9e('0x11')]];if(_0x5db4b0){var _0x239b12=_[_0x0a9e('0x12')](_0x5db4b0[_0x0a9e('0x13')],{'id':parseInt(_0x307b3e[_0x0a9e('0x14')],0xa)});if(_0x239b12){if(_0xbd1168){if(_0x4a4c56&&_0x3ab53f[_0x0a9e('0x15')]){_0xd5b662='queue';}else if(_0x3ab53f[_0x0a9e('0x16')]){_0xd5b662='outbound';}else{console[_0x0a9e('0x17')]('EVENT\x20UNKNOWN',_0x3ab53f);}}else{_0xd5b662=_0x0a9e('0x18');}switch(_0x307b3e[_0x0a9e('0x10')]['toLowerCase']()){case _0x0a9e('0x19'):zendesk[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case'salesforce':salesforce[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0xa'):sugarcrm[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0xb'):freshdesk[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0x1a'):zoho[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0x1b'):desk[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0xc'):vtiger[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0x1c'):freshsales['cs'](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2,_0xd5b662);case _0x0a9e('0xd'):servicenow['cs'](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2,_0xd5b662);break;case _0x0a9e('0x1d'):dynamics365['cs'](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2,_0xd5b662);break;default:console[_0x0a9e('0x17')](_0x0a9e('0x1e'));}}else{_0x36471c=require(_0x0a9e('0x1f'))(_0x307b3e[_0x0a9e('0x10')]['toLowerCase']());_0x36471c[_0x0a9e('0x20')](_0x0a9e('0x21'),util['format'](_0x0a9e('0x22'),_0x307b3e['data1']['toLowerCase'](),_0x307b3e[_0x0a9e('0x14')]));}}else{_0x36471c=require(_0x0a9e('0x1f'))(_0x307b3e[_0x0a9e('0x10')][_0x0a9e('0xf')]());_0x36471c['error'](_0x0a9e('0x21'),util[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x307b3e[_0x0a9e('0x10')][_0x0a9e('0xf')](),_0x307b3e[_0x0a9e('0x11')]));}}else{}}catch(_0x16b1ca){console['error'](_0x16b1ca);}}}}; \ No newline at end of file +var _0xa9e0=['./vtiger','./servicenow','./dynamics365','./freshsales','salesforce','sugarcrm','freshdesk','vtiger','servicenow','exec','toLowerCase','data1','data2','find','Configurations','data3','queue','routeId','log','abandoned','zendesk','zoho','desk','freshsales','dynamics365','unknown\x20integration','../../../../config/logger','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','format','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./freshdesk','./desk'];(function(_0x281b6a,_0x35dc06){var _0xe5b1b7=function(_0x20f3dd){while(--_0x20f3dd){_0x281b6a['push'](_0x281b6a['shift']());}};_0xe5b1b7(++_0x35dc06);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var zendesk=require(_0x0a9e('0x2'));var salesforce=require('./salesforce');var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x0a9e('0x3'));var zoho=require('./zoho');var desk=require(_0x0a9e('0x4'));var vtiger=require(_0x0a9e('0x5'));var servicenow=require(_0x0a9e('0x6'));var dynamics365=require(_0x0a9e('0x7'));var freshsales=require(_0x0a9e('0x8'));var integrations=['zendesk',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'zoho','desk',_0x0a9e('0xc'),'dynamics365','freshsales',_0x0a9e('0xd')];exports[_0x0a9e('0xe')]=function(_0x307b3e,_0x3ab53f,_0xfeb75b,_0xbd1168,_0x4a4c56,_0x50dfb2){if(_0xfeb75b){if(_['includes'](integrations,_0x307b3e['data1'][_0x0a9e('0xf')]())){try{var _0x36471c=null;var _0xd5b662='';var _0x26d672=_0xfeb75b[_0x307b3e[_0x0a9e('0x10')][_0x0a9e('0xf')]()];if(_0x26d672){var _0x5db4b0=_0x26d672[_0x307b3e[_0x0a9e('0x11')]];if(_0x5db4b0){var _0x239b12=_[_0x0a9e('0x12')](_0x5db4b0[_0x0a9e('0x13')],{'id':parseInt(_0x307b3e[_0x0a9e('0x14')],0xa)});if(_0x239b12){if(_0xbd1168){if(_0x4a4c56&&_0x3ab53f[_0x0a9e('0x15')]){_0xd5b662='queue';}else if(_0x3ab53f[_0x0a9e('0x16')]){_0xd5b662='outbound';}else{console[_0x0a9e('0x17')]('EVENT\x20UNKNOWN',_0x3ab53f);}}else{_0xd5b662=_0x0a9e('0x18');}switch(_0x307b3e[_0x0a9e('0x10')]['toLowerCase']()){case _0x0a9e('0x19'):zendesk[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case'salesforce':salesforce[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0xa'):sugarcrm[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0xb'):freshdesk[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0x1a'):zoho[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0x1b'):desk[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0xc'):vtiger[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0x1c'):freshsales['cs'](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2,_0xd5b662);case _0x0a9e('0xd'):servicenow['cs'](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2,_0xd5b662);break;case _0x0a9e('0x1d'):dynamics365['cs'](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2,_0xd5b662);break;default:console[_0x0a9e('0x17')](_0x0a9e('0x1e'));}}else{_0x36471c=require(_0x0a9e('0x1f'))(_0x307b3e[_0x0a9e('0x10')]['toLowerCase']());_0x36471c[_0x0a9e('0x20')](_0x0a9e('0x21'),util['format'](_0x0a9e('0x22'),_0x307b3e['data1']['toLowerCase'](),_0x307b3e[_0x0a9e('0x14')]));}}else{_0x36471c=require(_0x0a9e('0x1f'))(_0x307b3e[_0x0a9e('0x10')][_0x0a9e('0xf')]());_0x36471c['error'](_0x0a9e('0x21'),util[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x307b3e[_0x0a9e('0x10')][_0x0a9e('0xf')](),_0x307b3e[_0x0a9e('0x11')]));}}else{}}catch(_0x16b1ca){console['error'](_0x16b1ca);}}}}; \ 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 3ade36d..cc8b6bb 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 _0x0483=['[ABANDONED]\x20Ticket\x20%s\x20created.','[ABANDONED]\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','localhost','emit','ticketType','Task','assign','getString','Subjects','Descriptions','WhoId','ContactId','sobject','isNil','validateEmail','User','execute','length','find','Email','Agent\x20%s\x20found.','resolve','Name','info','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','then','user_id','identity','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','Contact','Lead','contact','lead','Case','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','format','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','create','forEach','type','string','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','password','concat','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','username','Connection\x20established.','queue','serverUrl','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','calleridname','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','newTab','user:%s','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','[QUEUE]','stringify','outbound','stripTrailingSlash','recordingFormat','Recording\x20is\x20enabled!','uniqueid','destcalleridname','[OUTBOUND]\x20Ticket\x20%s\x20created.','integrationTab','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','catch','abandoned','[ABANDONED]','recordingURL','calleridnum'];(function(_0x207203,_0x368c97){var _0x250337=function(_0x4559ab){while(--_0x4559ab){_0x207203['push'](_0x207203['shift']());}};_0x250337(++_0x368c97);}(_0x0483,0xda));var _0x3048=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0x0483[_0x4a3898];return _0x25ceb0;};'use strict';var _=require(_0x3048('0x0'));var rp=require(_0x3048('0x1'));var moment=require('moment');var BPromise=require(_0x3048('0x2'));var md5=require(_0x3048('0x3'));var jsforce=require('jsforce');var util=require('util');var Redis=require(_0x3048('0x4'));var intUtil=require(_0x3048('0x5'));var config=require(_0x3048('0x6'));var logger=require(_0x3048('0x7'))(_0x3048('0x8'));config[_0x3048('0x9')]=_['defaults'](config[_0x3048('0x9')],{'host':_0x3048('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x3956fd,_0x4f6cf6,_0x121f3a){io['to'](_0x3956fd)[_0x3048('0xb')](_0x4f6cf6,_0x121f3a);}function getTicket(_0xb2e9ef,_0x23dec7,_0x214356,_0x32b0d0,_0x5d7000,_0x2fb96b,_0x546999,_0x398657){var _0x3caae1={};if(_0x32b0d0[_0x3048('0xc')]===_0x3048('0xd')){_0x3caae1=Object[_0x3048('0xe')]({},{'OwnerId':_0x23dec7['id'],'ActivityDate':moment['utc'](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x3048('0xf')](_0x32b0d0[_0x3048('0x10')],_0x5d7000,'\x20'),'Description':intUtil[_0x3048('0xf')](_0x32b0d0[_0x3048('0x11')],_0x5d7000,'\x0a')},getCustomFields(_0x2fb96b,_0x5d7000));if(_0x214356){_0x3caae1[_0x3048('0x12')]=_0x214356['id'];}}else if(_0x32b0d0['ticketType']==='Case'){_0x3caae1=Object[_0x3048('0xe')]({},{'OwnerId':_0x23dec7['id'],'Subject':intUtil['getString'](_0x32b0d0['Subjects'],_0x5d7000,'\x20'),'Description':intUtil[_0x3048('0xf')](_0x32b0d0[_0x3048('0x11')],_0x5d7000,'\x0a')},getCustomFields(_0x2fb96b,_0x5d7000));if(_0x214356){_0x3caae1[_0x3048('0x13')]=_0x214356['id'];}}return _0x546999[_0x3048('0x14')](_0x32b0d0['ticketType'])['create'](_0x3caae1);}function getUser(_0x59b824,_0x1779b4,_0x264f17){if(!_[_0x3048('0x15')](_0x1779b4)&&intUtil[_0x3048('0x16')](_0x1779b4)){var _0x33508d={'Email':_0x1779b4};var _0x2d4e58={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x264f17['sobject'](_0x3048('0x17'))['find'](_0x33508d,_0x2d4e58)[_0x3048('0x18')]()['then'](function(_0x4b69cd){if(_0x4b69cd[_0x3048('0x19')]){var _0x260ab5=_[_0x3048('0x1a')](_0x4b69cd,function(_0x1bde99){return _0x1bde99[_0x3048('0x1b')]===_0x1779b4;});if(_0x260ab5){logger['info'](_0x3048('0x1c'),_0x1779b4);return BPromise[_0x3048('0x1d')]({'id':_0x260ab5['Id'],'name':_0x260ab5[_0x3048('0x1e')]});}}else{logger[_0x3048('0x1f')](_0x3048('0x20'),_0x1779b4);return _0x264f17['identity']()[_0x3048('0x21')](function(_0x107909){return BPromise[_0x3048('0x1d')]({'id':_0x107909[_0x3048('0x22')],'name':_0x107909['display_name']});});}});}else{logger[_0x3048('0x1f')](_0x3048('0x20'),_0x1779b4);return _0x264f17[_0x3048('0x23')]()[_0x3048('0x21')](function(_0xa449ac){return BPromise[_0x3048('0x1d')]({'id':_0xa449ac[_0x3048('0x22')],'name':_0xa449ac['display_name']});});}}function getEndUser(_0x53d634,_0x1ea96f,_0x5155f9,_0x164525,_0x135a74){var _0xba10e={'Phone':_0x164525};var _0x5191f7={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x3048('0x1d')]()[_0x3048('0x21')](function(){if(_0x1ea96f[_0x3048('0xc')]===_0x3048('0xd')){logger[_0x3048('0x1f')](_0x3048('0x24'),_0x164525,_0x1ea96f[_0x3048('0x25')]);switch(_0x1ea96f['moduleSearch']){case'contact_lead':return _0x135a74[_0x3048('0x14')](_0x3048('0x26'))[_0x3048('0x1a')](_0xba10e,_0x5191f7)[_0x3048('0x18')]()[_0x3048('0x21')](function(_0x1de7a0){if(_0x1de7a0&&_0x1de7a0[_0x3048('0x19')]){return _0x1de7a0;}else{return _0x135a74[_0x3048('0x14')](_0x3048('0x27'))[_0x3048('0x1a')](_0xba10e,_0x5191f7);}});case _0x3048('0x28'):return _0x135a74['sobject'](_0x3048('0x26'))[_0x3048('0x1a')](_0xba10e,_0x5191f7)[_0x3048('0x18')]();case _0x3048('0x29'):return _0x135a74[_0x3048('0x14')](_0x3048('0x27'))[_0x3048('0x1a')](_0xba10e,_0x5191f7);default:return null;}}else if(_0x1ea96f[_0x3048('0xc')]===_0x3048('0x2a')){logger[_0x3048('0x1f')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x164525,_0x3048('0x28'));return _0x135a74[_0x3048('0x14')]('Contact')[_0x3048('0x1a')](_0xba10e,_0x5191f7)['execute']();}})[_0x3048('0x21')](function(_0x9ec5f4){if(_0x9ec5f4&&_0x9ec5f4[_0x3048('0x19')]){var _0x5f3f74=_[_0x3048('0x1a')](_0x9ec5f4,function(_0x4976fd){return _0x4976fd[_0x3048('0x2b')]===_0x164525;});if(_0x5f3f74){return BPromise[_0x3048('0x1d')]({'id':_0x5f3f74['Id'],'name':_0x5f3f74[_0x3048('0x1e')],'phone':_0x5f3f74['Phone']});}}})[_0x3048('0x21')](function(_0x660441){if(_0x660441){logger[_0x3048('0x1f')](_0x3048('0x2c'),_0x164525);return BPromise[_0x3048('0x1d')](_0x660441);}else{logger[_0x3048('0x1f')](_0x3048('0x2d'),_0x164525);var _0x262ed6={'LastName':_0x5155f9!==''?_0x5155f9:util[_0x3048('0x2e')]('Caller\x20-\x20%s',_0x164525),'Phone':_0x164525};if(_0x1ea96f[_0x3048('0x2f')]){if(_0x1ea96f[_0x3048('0x2f')]===_0x3048('0x28')){logger['info'](_0x3048('0x30'),_0x164525,_0x1ea96f['moduleCreate']);}else if(_0x1ea96f[_0x3048('0x2f')]===_0x3048('0x29')&&_0x1ea96f[_0x3048('0xc')]===_0x3048('0xd')){logger[_0x3048('0x1f')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x164525,_0x1ea96f[_0x3048('0x2f')]);_0x262ed6[_0x3048('0x31')]=_0x3048('0x32');}else{return null;}}return _0x135a74[_0x3048('0x14')](_['upperFirst'](_0x1ea96f[_0x3048('0x2f')]))[_0x3048('0x33')](_0x262ed6);}});}function getCustomFields(_0x56da85,_0xc0c00d){var _0x546e96={};if(_0x56da85[_0x3048('0x19')]>0x0){_[_0x3048('0x34')](_0x56da85,function(_0x4117fc){if(_0x4117fc[_0x3048('0x35')]===_0x3048('0x36')&&_0x4117fc[_0x3048('0x37')]){_0x546e96[_0x4117fc[_0x3048('0x37')]]=_0x4117fc[_0x3048('0x38')][_0x3048('0x39')]();}else if(_0x4117fc[_0x3048('0x35')]===_0x3048('0x3a')&&_0x4117fc[_0x3048('0x3b')]&&_0x4117fc[_0x3048('0x37')]){_0xc0c00d[_0x4117fc[_0x3048('0x3b')]]&&(_0x546e96[_0x4117fc[_0x3048('0x37')]]=_0xc0c00d[_0x4117fc[_0x3048('0x3b')]]['toString']());}else if(_0x4117fc[_0x3048('0x35')]===_0x3048('0x3c')&&_0x4117fc[_0x3048('0x3d')]&&_0x4117fc[_0x3048('0x3d')][_0x3048('0x3e')]&&_0x4117fc[_0x3048('0x37')]){_0xc0c00d[_0x4117fc[_0x3048('0x3d')][_0x3048('0x3e')][_0x3048('0x3f')]()]&&(_0x546e96[_0x4117fc[_0x3048('0x37')]]=_0xc0c00d[_0x4117fc['Variable']['name']['toLowerCase']()][_0x3048('0x39')]());}});}return _0x546e96;}function getConnection(_0x230ed1){var _0x1fcd58=_0x230ed1[_0x3048('0x40')][_0x3048('0x41')](_0x230ed1['securityToken']);var _0x485d85=new jsforce[(_0x3048('0x42'))]({'oauth2':{'loginUrl':_0x230ed1[_0x3048('0x43')]||_0x3048('0x44'),'clientId':_0x230ed1[_0x3048('0x45')],'clientSecret':_0x230ed1[_0x3048('0x46')]}});return _0x485d85['login'](_0x230ed1[_0x3048('0x47')],_0x1fcd58)[_0x3048('0x21')](function(){logger['info'](_0x3048('0x48'));return _0x485d85;});}exports[_0x3048('0x49')]=function(_0x42c0e9,_0xfd12ae,_0x958485,_0x2cc8ca,_0x5aabd6,_0x169151){var _0x3e114c,_0x5667fc,_0x17795b,_0x8a749;_0x169151[_0x3048('0x4a')]=intUtil['stripTrailingSlash'](_0x169151[_0x3048('0x4a')]);_0x169151[_0x3048('0x43')]=intUtil['stripTrailingSlash'](_0x169151[_0x3048('0x43')]);if(_0x5aabd6&&_0x5aabd6[_0x3048('0x4b')]){logger[_0x3048('0x1f')]('[QUEUE]','Recording\x20is\x20enabled!');_0xfd12ae['recordingURL']=util[_0x3048('0x2e')](_0x3048('0x4c'),_0x169151[_0x3048('0x4a')],_0xfd12ae['uniqueid'],md5(_0xfd12ae['uniqueid']));}else{_0xfd12ae['recordingURL']='';}return getConnection(_0x169151)[_0x3048('0x21')](function(_0x38f54c){_0x8a749=_0x38f54c;return getUser(_0x169151,_0x2cc8ca[_0x3048('0x4d')],_0x8a749);})[_0x3048('0x21')](function(_0xbeecc){_0x3e114c=_0xbeecc;return getEndUser(_0x169151,_0x958485,_0xfd12ae[_0x3048('0x4e')],_0xfd12ae['calleridnum'],_0x8a749);})[_0x3048('0x21')](function(_0x23f345){_0x5667fc=_0x23f345;return getTicket(_0x169151,_0x3e114c,_0x5667fc,_0x958485,_0xfd12ae,_0x958485[_0x3048('0x4f')],_0x8a749,_0x3048('0x49'));})[_0x3048('0x21')](function(_0x3077ca){_0x17795b=_0x3077ca;logger[_0x3048('0x1f')](_0x3048('0x50'),_0x17795b['id']);logger['info'](_0x3048('0x51'),_0x17795b['id'],_0x2cc8ca[_0x3048('0x3e')],_0x169151[_0x3048('0x35')]);switch(_0x169151[_0x3048('0x35')]){case'integrationTab':emit(util['format']('user:%s',_0x2cc8ca[_0x3048('0x3e')]),_0x3048('0x52'),{'recordId':_0x17795b['id']});break;case _0x3048('0x53'):emit(util['format'](_0x3048('0x54'),_0x2cc8ca[_0x3048('0x3e')]),'trigger:browser:url',{'uri':util[_0x3048('0x2e')](_0x3048('0x55'),_0x8a749[_0x3048('0x56')],_0x17795b['id'])});break;default:logger[_0x3048('0x57')](_0x3048('0x58'));}})['catch'](function(_0x18e2b7){logger[_0x3048('0x57')](_0x3048('0x59'),JSON[_0x3048('0x5a')](_0x18e2b7));});};exports[_0x3048('0x5b')]=function(_0x49aa9a,_0x31070d,_0x23ba07,_0x9aacc1,_0x4aaadf,_0x12dc52,_0x127912){var _0x54b555,_0x43f76c,_0x3a91cb,_0x406761;_0x12dc52['serverUrl']=intUtil[_0x3048('0x5c')](_0x12dc52[_0x3048('0x4a')]);_0x12dc52[_0x3048('0x43')]=intUtil['stripTrailingSlash'](_0x12dc52['remoteUri']);if(_0x127912&&_0x127912[_0x3048('0x5d')]&&_0x127912[_0x3048('0x5d')]!=='none'){logger[_0x3048('0x1f')]('[OUTBOUND]',_0x3048('0x5e'));_0x31070d['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x12dc52[_0x3048('0x4a')],_0x31070d[_0x3048('0x5f')],md5(_0x31070d[_0x3048('0x5f')]));}return getConnection(_0x12dc52)['then'](function(_0x1c355b){_0x406761=_0x1c355b;return getUser(_0x12dc52,_0x9aacc1['email'],_0x406761);})[_0x3048('0x21')](function(_0x381461){_0x54b555=_0x381461;return getEndUser(_0x12dc52,_0x23ba07,_0x31070d[_0x3048('0x60')],_0x31070d['destcalleridnum'],_0x406761);})['then'](function(_0x4d2c34){_0x43f76c=_0x4d2c34;return getTicket(_0x12dc52,_0x54b555,_0x43f76c,_0x23ba07,_0x31070d,_0x23ba07[_0x3048('0x4f')],_0x406761,'outbound');})[_0x3048('0x21')](function(_0x48fa34){_0x3a91cb=_0x48fa34;logger[_0x3048('0x1f')](_0x3048('0x61'),_0x3a91cb['id']);logger['info']('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x3a91cb['id'],_0x9aacc1['name'],_0x12dc52[_0x3048('0x35')]);switch(_0x12dc52['type']){case _0x3048('0x62'):emit(util[_0x3048('0x2e')](_0x3048('0x54'),_0x9aacc1[_0x3048('0x3e')]),_0x3048('0x52'),{'recordId':_0x3a91cb['id']});break;case'newTab':emit(util[_0x3048('0x2e')]('user:%s',_0x9aacc1['name']),'trigger:browser:url',{'uri':util[_0x3048('0x2e')]('%s/%s/e',_0x406761[_0x3048('0x56')],_0x3a91cb['id'])});break;default:logger[_0x3048('0x57')](_0x3048('0x63'),_0x3048('0x64'));}})[_0x3048('0x65')](function(_0x2bc425){logger[_0x3048('0x57')](_0x3048('0x63'),JSON[_0x3048('0x5a')](_0x2bc425));});};exports[_0x3048('0x66')]=function(_0xc61e27,_0x26263f,_0x2a2775,_0x2624d8,_0xdb51bc,_0x51d848){var _0x5a3209,_0x440cc8,_0x421178,_0x13d4af;_0x51d848[_0x3048('0x4a')]=intUtil['stripTrailingSlash'](_0x51d848[_0x3048('0x4a')]);_0x51d848['remoteUri']=intUtil[_0x3048('0x5c')](_0x51d848['remoteUri']);if(_0xdb51bc&&_0xdb51bc[_0x3048('0x4b')]){logger[_0x3048('0x1f')](_0x3048('0x67'),_0x3048('0x5e'));_0x26263f['recordingURL']=util[_0x3048('0x2e')](_0x3048('0x4c'),_0x51d848['serverUrl'],_0x26263f[_0x3048('0x5f')],md5(_0x26263f[_0x3048('0x5f')]));}else{_0x26263f[_0x3048('0x68')]='';}return getConnection(_0x51d848)[_0x3048('0x21')](function(_0x27c481){_0x13d4af=_0x27c481;if(!_[_0x3048('0x15')](_0x2624d8)){return getUser(_0x51d848,_0x2624d8['name'],_0x13d4af);}else{return getUser(_0x51d848,null,_0x13d4af);}})[_0x3048('0x21')](function(_0x7057c0){_0x5a3209=_0x7057c0;return getEndUser(_0x51d848,_0x2a2775,_0x26263f['calleridname'],_0x26263f[_0x3048('0x69')],_0x13d4af);})[_0x3048('0x21')](function(_0x4ee71d){_0x440cc8=_0x4ee71d;return getTicket(_0x51d848,_0x5a3209,_0x440cc8,_0x2a2775,_0x26263f,_0x2a2775[_0x3048('0x4f')],_0x13d4af);})[_0x3048('0x21')](function(_0x5bf4af){_0x421178=_0x5bf4af;logger[_0x3048('0x1f')](_0x3048('0x6a'),_0x421178['id']);logger[_0x3048('0x1f')](_0x3048('0x6b'),_0x51d848[_0x3048('0x35')]);})['catch'](function(_0x471fd2){logger[_0x3048('0x57')]('[ABANDONED]',JSON[_0x3048('0x5a')](_0x471fd2));});}; \ No newline at end of file +var _0xc0c4=['remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','user:%s','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','stringify','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','Salesforce\x20account\x20type\x20not\x20recognized','abandoned','[ABANDONED]','Recording\x20is\x20enabled!','lodash','moment','bluebird','jsforce','util','ioredis','./util','../../../../config/environment','salesforce','redis','defaults','socket.io-emitter','emit','ticketType','Task','assign','getString','Subjects','Descriptions','WhoId','Case','isNil','validateEmail','sobject','User','find','execute','then','length','Email','info','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Contact','Lead','contact','lead','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','format','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','upperFirst','create','type','string','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','concat','securityToken','Connection'];(function(_0x39aedf,_0x2f5df8){var _0x39356c=function(_0x1411c9){while(--_0x1411c9){_0x39aedf['push'](_0x39aedf['shift']());}};_0x39356c(++_0x2f5df8);}(_0xc0c4,0x97));var _0x4c0c=function(_0x11000e,_0x5853e1){_0x11000e=_0x11000e-0x0;var _0x217f44=_0xc0c4[_0x11000e];return _0x217f44;};'use strict';var _=require(_0x4c0c('0x0'));var rp=require('request-promise');var moment=require(_0x4c0c('0x1'));var BPromise=require(_0x4c0c('0x2'));var md5=require('md5');var jsforce=require(_0x4c0c('0x3'));var util=require(_0x4c0c('0x4'));var Redis=require(_0x4c0c('0x5'));var intUtil=require(_0x4c0c('0x6'));var config=require(_0x4c0c('0x7'));var logger=require('../../../../config/logger')(_0x4c0c('0x8'));config[_0x4c0c('0x9')]=_[_0x4c0c('0xa')](config[_0x4c0c('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x4c0c('0xb'))(new Redis(config[_0x4c0c('0x9')]));function emit(_0xf25834,_0x3931d2,_0x26d0a8){io['to'](_0xf25834)[_0x4c0c('0xc')](_0x3931d2,_0x26d0a8);}function getTicket(_0x36f854,_0x373882,_0x33e46d,_0x3e8545,_0x12fdb2,_0x18fc54,_0xabe82a,_0x4da086){var _0x1a357a={};if(_0x3e8545[_0x4c0c('0xd')]===_0x4c0c('0xe')){_0x1a357a=Object[_0x4c0c('0xf')]({},{'OwnerId':_0x373882['id'],'ActivityDate':moment['utc'](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x4c0c('0x10')](_0x3e8545[_0x4c0c('0x11')],_0x12fdb2,'\x20'),'Description':intUtil[_0x4c0c('0x10')](_0x3e8545[_0x4c0c('0x12')],_0x12fdb2,'\x0a')},getCustomFields(_0x18fc54,_0x12fdb2));if(_0x33e46d){_0x1a357a[_0x4c0c('0x13')]=_0x33e46d['id'];}}else if(_0x3e8545['ticketType']===_0x4c0c('0x14')){_0x1a357a=Object[_0x4c0c('0xf')]({},{'OwnerId':_0x373882['id'],'Subject':intUtil[_0x4c0c('0x10')](_0x3e8545[_0x4c0c('0x11')],_0x12fdb2,'\x20'),'Description':intUtil[_0x4c0c('0x10')](_0x3e8545[_0x4c0c('0x12')],_0x12fdb2,'\x0a')},getCustomFields(_0x18fc54,_0x12fdb2));if(_0x33e46d){_0x1a357a['ContactId']=_0x33e46d['id'];}}return _0xabe82a['sobject'](_0x3e8545[_0x4c0c('0xd')])['create'](_0x1a357a);}function getUser(_0x32af71,_0x3c09ed,_0x2aefce){if(!_[_0x4c0c('0x15')](_0x3c09ed)&&intUtil[_0x4c0c('0x16')](_0x3c09ed)){var _0x52092c={'Email':_0x3c09ed};var _0x25dfa5={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2aefce[_0x4c0c('0x17')](_0x4c0c('0x18'))[_0x4c0c('0x19')](_0x52092c,_0x25dfa5)[_0x4c0c('0x1a')]()[_0x4c0c('0x1b')](function(_0x2ad9fe){if(_0x2ad9fe[_0x4c0c('0x1c')]){var _0x1a144f=_[_0x4c0c('0x19')](_0x2ad9fe,function(_0x5efa29){return _0x5efa29[_0x4c0c('0x1d')]===_0x3c09ed;});if(_0x1a144f){logger[_0x4c0c('0x1e')](_0x4c0c('0x1f'),_0x3c09ed);return BPromise[_0x4c0c('0x20')]({'id':_0x1a144f['Id'],'name':_0x1a144f[_0x4c0c('0x21')]});}}else{logger[_0x4c0c('0x1e')](_0x4c0c('0x22'),_0x3c09ed);return _0x2aefce[_0x4c0c('0x23')]()[_0x4c0c('0x1b')](function(_0x3aec10){return BPromise['resolve']({'id':_0x3aec10[_0x4c0c('0x24')],'name':_0x3aec10['display_name']});});}});}else{logger[_0x4c0c('0x1e')](_0x4c0c('0x22'),_0x3c09ed);return _0x2aefce[_0x4c0c('0x23')]()[_0x4c0c('0x1b')](function(_0x5ad4cf){return BPromise[_0x4c0c('0x20')]({'id':_0x5ad4cf[_0x4c0c('0x24')],'name':_0x5ad4cf['display_name']});});}}function getEndUser(_0x3de284,_0x450488,_0x3f0277,_0x52aa8e,_0x190776){var _0x281661={'Phone':_0x52aa8e};var _0x39da97={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x4c0c('0x20')]()[_0x4c0c('0x1b')](function(){if(_0x450488['ticketType']===_0x4c0c('0xe')){logger[_0x4c0c('0x1e')](_0x4c0c('0x25'),_0x52aa8e,_0x450488[_0x4c0c('0x26')]);switch(_0x450488[_0x4c0c('0x26')]){case _0x4c0c('0x27'):return _0x190776[_0x4c0c('0x17')](_0x4c0c('0x28'))[_0x4c0c('0x19')](_0x281661,_0x39da97)[_0x4c0c('0x1a')]()[_0x4c0c('0x1b')](function(_0x42eac6){if(_0x42eac6&&_0x42eac6['length']){return _0x42eac6;}else{return _0x190776[_0x4c0c('0x17')](_0x4c0c('0x29'))[_0x4c0c('0x19')](_0x281661,_0x39da97);}});case _0x4c0c('0x2a'):return _0x190776[_0x4c0c('0x17')](_0x4c0c('0x28'))['find'](_0x281661,_0x39da97)['execute']();case _0x4c0c('0x2b'):return _0x190776[_0x4c0c('0x17')](_0x4c0c('0x29'))['find'](_0x281661,_0x39da97);default:return null;}}else if(_0x450488['ticketType']===_0x4c0c('0x14')){logger['info'](_0x4c0c('0x25'),_0x52aa8e,'contact');return _0x190776[_0x4c0c('0x17')](_0x4c0c('0x28'))[_0x4c0c('0x19')](_0x281661,_0x39da97)[_0x4c0c('0x1a')]();}})['then'](function(_0x3ae280){if(_0x3ae280&&_0x3ae280['length']){var _0xcc51c0=_[_0x4c0c('0x19')](_0x3ae280,function(_0x477fe1){return _0x477fe1[_0x4c0c('0x2c')]===_0x52aa8e;});if(_0xcc51c0){return BPromise[_0x4c0c('0x20')]({'id':_0xcc51c0['Id'],'name':_0xcc51c0[_0x4c0c('0x21')],'phone':_0xcc51c0[_0x4c0c('0x2c')]});}}})[_0x4c0c('0x1b')](function(_0x3a4f7c){if(_0x3a4f7c){logger[_0x4c0c('0x1e')](_0x4c0c('0x2d'),_0x52aa8e);return BPromise['resolve'](_0x3a4f7c);}else{logger[_0x4c0c('0x1e')](_0x4c0c('0x2e'),_0x52aa8e);var _0x3dc3c4={'LastName':_0x3f0277!==_0x4c0c('0x2f')?_0x3f0277:util[_0x4c0c('0x30')](_0x4c0c('0x31'),_0x52aa8e),'Phone':_0x52aa8e};if(_0x450488[_0x4c0c('0x32')]){if(_0x450488[_0x4c0c('0x32')]===_0x4c0c('0x2a')){logger['info'](_0x4c0c('0x33'),_0x52aa8e,_0x450488[_0x4c0c('0x32')]);}else if(_0x450488[_0x4c0c('0x32')]===_0x4c0c('0x2b')&&_0x450488[_0x4c0c('0xd')]==='Task'){logger['info'](_0x4c0c('0x33'),_0x52aa8e,_0x450488['moduleCreate']);_0x3dc3c4[_0x4c0c('0x34')]='No\x20Company';}else{return null;}}return _0x190776[_0x4c0c('0x17')](_[_0x4c0c('0x35')](_0x450488[_0x4c0c('0x32')]))[_0x4c0c('0x36')](_0x3dc3c4);}});}function getCustomFields(_0x460b34,_0x5cdb4d){var _0x82dd57={};if(_0x460b34[_0x4c0c('0x1c')]>0x0){_['forEach'](_0x460b34,function(_0x2b2e61){if(_0x2b2e61[_0x4c0c('0x37')]===_0x4c0c('0x38')&&_0x2b2e61[_0x4c0c('0x39')]){_0x82dd57[_0x2b2e61['idField']]=_0x2b2e61[_0x4c0c('0x3a')][_0x4c0c('0x3b')]();}else if(_0x2b2e61[_0x4c0c('0x37')]===_0x4c0c('0x3c')&&_0x2b2e61['variableName']&&_0x2b2e61['idField']){_0x5cdb4d[_0x2b2e61[_0x4c0c('0x3d')]]&&(_0x82dd57[_0x2b2e61[_0x4c0c('0x39')]]=_0x5cdb4d[_0x2b2e61[_0x4c0c('0x3d')]][_0x4c0c('0x3b')]());}else if(_0x2b2e61[_0x4c0c('0x37')]===_0x4c0c('0x3e')&&_0x2b2e61[_0x4c0c('0x3f')]&&_0x2b2e61[_0x4c0c('0x3f')]['name']&&_0x2b2e61[_0x4c0c('0x39')]){_0x5cdb4d[_0x2b2e61[_0x4c0c('0x3f')][_0x4c0c('0x40')][_0x4c0c('0x41')]()]&&(_0x82dd57[_0x2b2e61[_0x4c0c('0x39')]]=_0x5cdb4d[_0x2b2e61[_0x4c0c('0x3f')][_0x4c0c('0x40')][_0x4c0c('0x41')]()][_0x4c0c('0x3b')]());}});}return _0x82dd57;}function getConnection(_0x4fe174){var _0x4274bc=_0x4fe174['password'][_0x4c0c('0x42')](_0x4fe174[_0x4c0c('0x43')]);var _0x4fd563=new jsforce[(_0x4c0c('0x44'))]({'oauth2':{'loginUrl':_0x4fe174[_0x4c0c('0x45')]||_0x4c0c('0x46'),'clientId':_0x4fe174[_0x4c0c('0x47')],'clientSecret':_0x4fe174[_0x4c0c('0x48')]}});return _0x4fd563[_0x4c0c('0x49')](_0x4fe174[_0x4c0c('0x4a')],_0x4274bc)[_0x4c0c('0x1b')](function(){logger[_0x4c0c('0x1e')](_0x4c0c('0x4b'));return _0x4fd563;});}exports['queue']=function(_0x5ad806,_0x29dfa9,_0xd85515,_0x100869,_0x18c09f,_0x2ebf21){var _0x3321b5,_0x276d0a,_0x3229b9,_0x5a65da;_0x2ebf21['serverUrl']=intUtil[_0x4c0c('0x4c')](_0x2ebf21[_0x4c0c('0x4d')]);_0x2ebf21['remoteUri']=intUtil[_0x4c0c('0x4c')](_0x2ebf21[_0x4c0c('0x45')]);if(_0x18c09f&&_0x18c09f[_0x4c0c('0x4e')]){logger['info'](_0x4c0c('0x4f'),'Recording\x20is\x20enabled!');_0x29dfa9[_0x4c0c('0x50')]=util[_0x4c0c('0x30')](_0x4c0c('0x51'),_0x2ebf21[_0x4c0c('0x4d')],_0x29dfa9[_0x4c0c('0x52')],md5(_0x29dfa9[_0x4c0c('0x52')]));}else{_0x29dfa9[_0x4c0c('0x50')]='';}return getConnection(_0x2ebf21)[_0x4c0c('0x1b')](function(_0x52be1f){_0x5a65da=_0x52be1f;return getUser(_0x2ebf21,_0x100869[_0x4c0c('0x53')],_0x5a65da);})[_0x4c0c('0x1b')](function(_0x3391ed){_0x3321b5=_0x3391ed;return getEndUser(_0x2ebf21,_0xd85515,_0x29dfa9[_0x4c0c('0x54')],_0x29dfa9[_0x4c0c('0x55')],_0x5a65da);})[_0x4c0c('0x1b')](function(_0x227584){_0x276d0a=_0x227584;return getTicket(_0x2ebf21,_0x3321b5,_0x276d0a,_0xd85515,_0x29dfa9,_0xd85515[_0x4c0c('0x56')],_0x5a65da,_0x4c0c('0x57'));})[_0x4c0c('0x1b')](function(_0x1f0a38){_0x3229b9=_0x1f0a38;logger['info'](_0x4c0c('0x58'),_0x3229b9['id']);logger[_0x4c0c('0x1e')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x3229b9['id'],_0x100869[_0x4c0c('0x40')],_0x2ebf21['type']);switch(_0x2ebf21[_0x4c0c('0x37')]){case _0x4c0c('0x59'):emit(util['format'](_0x4c0c('0x5a'),_0x100869['name']),'trigger:salesforce:display',{'recordId':_0x3229b9['id']});break;case _0x4c0c('0x5b'):emit(util[_0x4c0c('0x30')](_0x4c0c('0x5a'),_0x100869['name']),_0x4c0c('0x5c'),{'uri':util[_0x4c0c('0x30')](_0x4c0c('0x5d'),_0x5a65da[_0x4c0c('0x5e')],_0x3229b9['id'])});break;default:logger[_0x4c0c('0x5f')](_0x4c0c('0x60'));}})[_0x4c0c('0x61')](function(_0x2d13e1){logger[_0x4c0c('0x5f')](_0x4c0c('0x4f'),JSON[_0x4c0c('0x62')](_0x2d13e1));});};exports[_0x4c0c('0x63')]=function(_0x28f866,_0x46949b,_0x90318,_0x396b2e,_0x301ece,_0x31bbb7,_0x1562d0){var _0xf35304,_0x55e734,_0x24aa95,_0x3878b7;_0x31bbb7[_0x4c0c('0x4d')]=intUtil[_0x4c0c('0x4c')](_0x31bbb7[_0x4c0c('0x4d')]);_0x31bbb7[_0x4c0c('0x45')]=intUtil[_0x4c0c('0x4c')](_0x31bbb7[_0x4c0c('0x45')]);if(_0x1562d0&&_0x1562d0['recordingFormat']&&_0x1562d0[_0x4c0c('0x64')]!==_0x4c0c('0x65')){logger[_0x4c0c('0x1e')](_0x4c0c('0x66'),'Recording\x20is\x20enabled!');_0x46949b[_0x4c0c('0x50')]=util[_0x4c0c('0x30')](_0x4c0c('0x51'),_0x31bbb7[_0x4c0c('0x4d')],_0x46949b[_0x4c0c('0x52')],md5(_0x46949b['uniqueid']));}return getConnection(_0x31bbb7)[_0x4c0c('0x1b')](function(_0x3ad991){_0x3878b7=_0x3ad991;return getUser(_0x31bbb7,_0x396b2e[_0x4c0c('0x53')],_0x3878b7);})[_0x4c0c('0x1b')](function(_0x112001){_0xf35304=_0x112001;return getEndUser(_0x31bbb7,_0x90318,_0x46949b[_0x4c0c('0x67')],_0x46949b[_0x4c0c('0x68')],_0x3878b7);})['then'](function(_0x26ceb6){_0x55e734=_0x26ceb6;return getTicket(_0x31bbb7,_0xf35304,_0x55e734,_0x90318,_0x46949b,_0x90318[_0x4c0c('0x56')],_0x3878b7,_0x4c0c('0x63'));})[_0x4c0c('0x1b')](function(_0x1c1dc5){_0x24aa95=_0x1c1dc5;logger['info'](_0x4c0c('0x69'),_0x24aa95['id']);logger[_0x4c0c('0x1e')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x24aa95['id'],_0x396b2e[_0x4c0c('0x40')],_0x31bbb7['type']);switch(_0x31bbb7[_0x4c0c('0x37')]){case _0x4c0c('0x59'):emit(util[_0x4c0c('0x30')]('user:%s',_0x396b2e[_0x4c0c('0x40')]),'trigger:salesforce:display',{'recordId':_0x24aa95['id']});break;case'newTab':emit(util[_0x4c0c('0x30')](_0x4c0c('0x5a'),_0x396b2e[_0x4c0c('0x40')]),_0x4c0c('0x5c'),{'uri':util['format'](_0x4c0c('0x5d'),_0x3878b7[_0x4c0c('0x5e')],_0x24aa95['id'])});break;default:logger['error']('[OUTBOUND]',_0x4c0c('0x6a'));}})[_0x4c0c('0x61')](function(_0x59500a){logger[_0x4c0c('0x5f')](_0x4c0c('0x66'),JSON[_0x4c0c('0x62')](_0x59500a));});};exports[_0x4c0c('0x6b')]=function(_0x47f6ef,_0x811ec9,_0x2b93f9,_0x20fe90,_0x6a81c1,_0x37b88b){var _0x462a7d,_0xcee810,_0xc5a169,_0x1f126b;_0x37b88b[_0x4c0c('0x4d')]=intUtil['stripTrailingSlash'](_0x37b88b['serverUrl']);_0x37b88b[_0x4c0c('0x45')]=intUtil[_0x4c0c('0x4c')](_0x37b88b[_0x4c0c('0x45')]);if(_0x6a81c1&&_0x6a81c1[_0x4c0c('0x4e')]){logger[_0x4c0c('0x1e')](_0x4c0c('0x6c'),_0x4c0c('0x6d'));_0x811ec9['recordingURL']=util[_0x4c0c('0x30')](_0x4c0c('0x51'),_0x37b88b['serverUrl'],_0x811ec9[_0x4c0c('0x52')],md5(_0x811ec9[_0x4c0c('0x52')]));}else{_0x811ec9[_0x4c0c('0x50')]='';}return getConnection(_0x37b88b)[_0x4c0c('0x1b')](function(_0x405ea5){_0x1f126b=_0x405ea5;if(!_[_0x4c0c('0x15')](_0x20fe90)){return getUser(_0x37b88b,_0x20fe90[_0x4c0c('0x40')],_0x1f126b);}else{return getUser(_0x37b88b,null,_0x1f126b);}})[_0x4c0c('0x1b')](function(_0x325881){_0x462a7d=_0x325881;return getEndUser(_0x37b88b,_0x2b93f9,_0x811ec9[_0x4c0c('0x54')],_0x811ec9['calleridnum'],_0x1f126b);})[_0x4c0c('0x1b')](function(_0x18cc80){_0xcee810=_0x18cc80;return getTicket(_0x37b88b,_0x462a7d,_0xcee810,_0x2b93f9,_0x811ec9,_0x2b93f9[_0x4c0c('0x56')],_0x1f126b);})['then'](function(_0x1102c7){_0xc5a169=_0x1102c7;logger[_0x4c0c('0x1e')]('[ABANDONED]\x20Ticket\x20%s\x20created.',_0xc5a169['id']);logger[_0x4c0c('0x1e')]('[ABANDONED]\x20Integration\x20account\x20type\x20%s.',_0x37b88b[_0x4c0c('0x37')]);})[_0x4c0c('0x61')](function(_0x216f89){logger[_0x4c0c('0x5f')](_0x4c0c('0x6c'),JSON[_0x4c0c('0x62')](_0x216f89));});}; \ 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 d1307dc..6b21db0 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 _0xa9e0=['validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','userId','adminEmail','],\x20getUser\x20crm','catch','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','endUserNumber','true','System','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','length','forEach','type','customField','idField','content','toString','toLowerCase','variable','variableName','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema',']\x20getTicket\x20crm','label','Incident','ticketId','Incident\x20-\x20','ticketNumber','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','serverUrl','stripTrailingSlash','%s/api/now/table/','remoteUri','email','destcalleridnum','calleridnum','queue','abandoned','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','adminId','result','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','error','message'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';var _=require(_0x0a9e('0x0'));var Promise=require(_0x0a9e('0x1'));var rp=require(_0x0a9e('0x2'));var util=require('util');var md5=require('md5');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function getAdminUser(_0x5f41ea,_0x503809,_0xe42b77,_0x56465b,_0x52cace,_0x39753a){return new Promise(function(_0xf81284,_0x307b3e){var _0x3ab53f={'method':_0x0a9e('0xb'),'uri':_0x56465b+_0x0a9e('0xc')+'&'+_0x52cace+'&'+_0x39753a,'auth':_0x503809,'json':!![]};return rp(_0x3ab53f)['then'](function(_0x50dfb2){if(_0x50dfb2['result']['length']>0x0){_0xe42b77[_0x0a9e('0xd')]=_0x50dfb2[_0x0a9e('0xe')][0x0][_0x0a9e('0xf')];}logger[_0x0a9e('0x10')]('['+[_0x5f41ea[_0x0a9e('0x11')]()]+_0x0a9e('0x12'),_0xe42b77);_0xf81284(_0xe42b77);})['catch'](function(_0x4283ce){logger[_0x0a9e('0x13')]('['+[_0x5f41ea[_0x0a9e('0x11')]()]+']',_0x4283ce[_0x0a9e('0x14')]);_0x307b3e(_0x4283ce[_0x0a9e('0x14')]);});});}function getUser(_0x4d5611,_0x52a03d,_0x22dccb,_0x5d0880,_0x1985b6){return function(_0x519dfd){logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+'],\x20getUser\x20input\x20crm',_0x519dfd);return new Promise(function(_0x225616,_0x5a0a06){if(intUtil[_0x0a9e('0x15')](_0x519dfd[_0x0a9e('0x16')])){var _0x106033={'method':_0x0a9e('0xb'),'uri':_0x22dccb+_0x0a9e('0x17')+_0x519dfd[_0x0a9e('0x16')]+'&'+_0x5d0880+'&'+_0x1985b6,'auth':_0x52a03d,'json':!![]};logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+_0x0a9e('0x18'),_0x106033);return rp(_0x106033)[_0x0a9e('0x19')](function(_0x1c696a){logger[_0x0a9e('0x10')]('['+[_0x4d5611['toUpperCase']()]+_0x0a9e('0x1a'),_0x1c696a);if(_0x1c696a[_0x0a9e('0xe')]['length']>0x0&&String(_0x1c696a[_0x0a9e('0xe')][0x0]['active'])==='true'){_0x519dfd[_0x0a9e('0x1b')]=_0x1c696a[_0x0a9e('0xe')][0x0][_0x0a9e('0xf')];}else{_0x519dfd[_0x0a9e('0x1b')]=_0x519dfd['adminId'];_0x519dfd[_0x0a9e('0x16')]=_0x519dfd[_0x0a9e('0x1c')];}logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+_0x0a9e('0x1d'),_0x519dfd);_0x225616(_0x519dfd);})[_0x0a9e('0x1e')](function(_0x16b1ca){logger['error']('['+[_0x4d5611['toUpperCase']()]+']',_0x16b1ca[_0x0a9e('0x14')]);_0x5a0a06(_0x16b1ca[_0x0a9e('0x14')]);});}else{logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+']\x20using\x20admin\x20profile');_0x519dfd[_0x0a9e('0x1b')]=_0x519dfd['adminId'];_0x519dfd[_0x0a9e('0x16')]=_0x519dfd['adminEmail'];_0x225616(_0x519dfd);}});};}function createEndUser(_0x1dc186,_0x34dc65,_0x25fba9,_0x14433c,_0x140511){logger[_0x0a9e('0x10')]('['+[_0x1dc186[_0x0a9e('0x11')]()]+_0x0a9e('0x1f'),_0x25fba9);return new Promise(function(_0x5a101a,_0x3652a7){var _0x468813={'method':_0x0a9e('0x20'),'uri':_0x14433c+_0x0a9e('0x21')+_0x140511,'body':{'user_name':_0x25fba9['endUserNumber'],'roles':_0x0a9e('0x22'),'first_name':_0x25fba9[_0x0a9e('0x23')],'active':_0x0a9e('0x24'),'date_format':_0x0a9e('0x25'),'phone':_0x25fba9[_0x0a9e('0x23')]},'auth':_0x34dc65,'json':!![]};return rp(_0x468813)[_0x0a9e('0x19')](function(_0x296f41){logger[_0x0a9e('0x10')]('['+[_0x1dc186[_0x0a9e('0x11')]()]+'],\x20EndUser\x20schema',_0x296f41[_0x0a9e('0xe')]);_0x25fba9['endUserId']=_0x296f41[_0x0a9e('0xe')][_0x0a9e('0xf')];_0x5a101a(_0x25fba9);})[_0x0a9e('0x1e')](function(_0x33bdb7){logger[_0x0a9e('0x13')]('['+[_0x1dc186['toUpperCase']()]+']',_0x33bdb7[_0x0a9e('0x14')]);_0x3652a7(_0x33bdb7[_0x0a9e('0x14')]);});});}function getEndUser(_0x40cb85,_0x2da5c0,_0x2b45ea,_0x409319,_0x332d35){return function(_0x39e565){logger['info']('['+[_0x40cb85[_0x0a9e('0x11')]()]+'],\x20getEndUser\x20input\x20crm',_0x39e565);return new Promise(function(_0x2cc7a0,_0x14b13f){var _0x2b7e7f={'method':_0x0a9e('0xb'),'uri':_0x2b45ea+'sys_user?sysparm_query=phone%3D'+_0x39e565[_0x0a9e('0x23')]+'&'+_0x409319+'&'+_0x332d35,'auth':_0x2da5c0,'json':!![]};return rp(_0x2b7e7f)[_0x0a9e('0x19')](function(_0x1fa90d){if(_0x1fa90d[_0x0a9e('0xe')]['length']>0x0){_0x39e565['endUserId']=_0x1fa90d[_0x0a9e('0xe')][0x0]['sys_id'];logger[_0x0a9e('0x10')]('['+[_0x40cb85[_0x0a9e('0x11')]()]+_0x0a9e('0x26'),_0x39e565);_0x2cc7a0(_0x39e565);}else{return createEndUser(_0x40cb85,_0x2da5c0,_0x39e565,_0x2b45ea,_0x409319)[_0x0a9e('0x19')](function(_0x4f41ae){logger[_0x0a9e('0x10')]('['+[_0x40cb85[_0x0a9e('0x11')]()]+_0x0a9e('0x27'),_0x4f41ae);_0x2cc7a0(_0x4f41ae);});}})['catch'](function(_0x1dbf74){logger[_0x0a9e('0x13')]('['+[_0x40cb85[_0x0a9e('0x11')]()]+']',_0x1dbf74['message']);_0x14b13f(_0x1dbf74['message']);});});};}function getCustomFields(_0x11b61d,_0x40d766){var _0x5adda1={};if(_0x11b61d[_0x0a9e('0x28')]>0x0){_[_0x0a9e('0x29')](_0x11b61d,function(_0x2e1b3a){if(_0x2e1b3a[_0x0a9e('0x2a')]==='string'&&_0x2e1b3a['nameField']&&!_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')]['toLowerCase']()]=_0x2e1b3a[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x2e1b3a[_0x0a9e('0x2a')]==='string'&&_0x2e1b3a[_0x0a9e('0x2c')]&&_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')][_0x0a9e('0x2f')]()]=_0x2e1b3a[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x2e1b3a[_0x0a9e('0x2a')]===_0x0a9e('0x30')&&_0x2e1b3a[_0x0a9e('0x31')]&&_0x2e1b3a[_0x0a9e('0x2c')]&&_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')][_0x0a9e('0x2f')]()]=_0x40d766[_0x2e1b3a[_0x0a9e('0x31')]][_0x0a9e('0x2e')]();}else if(_0x2e1b3a['type']==='customVariable'&&_0x2e1b3a[_0x0a9e('0x32')]&&_0x2e1b3a[_0x0a9e('0x32')][_0x0a9e('0x33')]&&_0x2e1b3a[_0x0a9e('0x2c')]&&_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')][_0x0a9e('0x2f')]()]=_0x40d766[_0x2e1b3a[_0x0a9e('0x32')][_0x0a9e('0x33')][_0x0a9e('0x2f')]()][_0x0a9e('0x2e')]();}});}return _0x5adda1;}function getTicket(_0x35ed4a,_0x5026aa,_0x117c99,_0x138b8b,_0xdd268f,_0xfbd5ad){return function(_0x2e8caf){logger[_0x0a9e('0x10')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+_0x0a9e('0x34'),_0x2e8caf);return new Promise(function(_0x59afe8,_0x2e9d90){var _0x48fd45=_0x35ed4a[_0x0a9e('0x2f')]()===_0x0a9e('0x35')?_0x2e8caf[_0x0a9e('0x1b')]:_0x2e8caf['endUserId'];var _0x14bec2={'method':_0x0a9e('0x20'),'uri':_0x117c99+_0x0a9e('0x36')+'?'+_0xfbd5ad,'body':Object[_0x0a9e('0x37')]({},{'active':_0x0a9e('0x24'),'caller_id':_0x48fd45,'assigned_to':_0x2e8caf[_0x0a9e('0x1b')],'short_description':intUtil[_0x0a9e('0x38')](_0x138b8b['Subjects'],_0xdd268f,'\x20'),'description':intUtil[_0x0a9e('0x38')](_0x138b8b[_0x0a9e('0x39')],_0xdd268f,'\x0a')},getCustomFields(_0x138b8b[_0x0a9e('0x3a')],_0xdd268f)),'auth':_0x5026aa,'json':!![]};return rp(_0x14bec2)[_0x0a9e('0x19')](function(_0x409789){logger[_0x0a9e('0x10')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+_0x0a9e('0x3b'),_0x409789[_0x0a9e('0xe')]);_0x2e8caf['ticketId']=_0x409789[_0x0a9e('0xe')][_0x0a9e('0xf')];_0x2e8caf['ticketNumber']=_0x409789['result']['number'];logger[_0x0a9e('0x10')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+_0x0a9e('0x3c'),_0x2e8caf);_0x59afe8(_0x2e8caf);})[_0x0a9e('0x1e')](function(_0x61bb17){logger[_0x0a9e('0x13')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+']',_0x61bb17[_0x0a9e('0x14')]);_0x2e9d90(_0x61bb17['message']);});});};}function createRemoteTag(_0x4b1b9f,_0x53975a,_0x39d77d,_0x204173){return new Promise(function(_0x14d602,_0x5bb3ed){var _0x2b69d9={'method':_0x0a9e('0x20'),'uri':_0x39d77d+'label'+'?'+_0x204173,'body':{'short_description':_0x4b1b9f,'global':!![],'active':!![],'name':_0x4b1b9f},'auth':_0x53975a,'json':!![]};return rp(_0x2b69d9)['then'](function(_0x2ef381){var _0x59c6ff=_0x2ef381[_0x0a9e('0xe')]['sys_id'];_0x14d602(_0x59c6ff);});});}function getRemoteTag(_0x2e5e62,_0x3c20b2,_0x439340,_0x53613a,_0x2f82da){return new Promise(function(_0x1bf38a,_0x508b47){var _0x50f687={'method':_0x0a9e('0xb'),'uri':_0x439340+_0x0a9e('0x3d')+'?sysparm_query=name%3D'+_0x2e5e62+'&'+_0x53613a,'auth':_0x3c20b2,'json':!![]};return rp(_0x50f687)[_0x0a9e('0x19')](function(_0x5ce9ac){if(_0x5ce9ac[_0x0a9e('0xe')]['length']>0x0){var _0xe22ccc=_0x5ce9ac['result'][0x0]['sys_id'];_0x1bf38a(_0xe22ccc);}else{return createRemoteTag(_0x2e5e62,_0x3c20b2,_0x439340,_0x53613a)['then'](function(_0x2da03c){_0x1bf38a(_0x2da03c);});}});});}function assignTagToIncident(_0x47de4c,_0x2f7092,_0x65432,_0x3cfd00,_0x19b4df){return new Promise(function(_0x232830,_0x272738){var _0xd10662={'method':_0x0a9e('0x20'),'uri':_0x65432+'label_entry'+'?'+_0x19b4df,'body':{'label':_0x47de4c,'table':_0x0a9e('0x36'),'id_type':_0x0a9e('0x3e'),'table_key':_0x3cfd00[_0x0a9e('0x3f')],'title':_0x0a9e('0x40')+_0x3cfd00[_0x0a9e('0x41')],'id_display':_0x3cfd00[_0x0a9e('0x41')]},'auth':_0x2f7092,'json':!![]};return rp(_0xd10662)['then'](function(_0x956fbe){_0x232830();})[_0x0a9e('0x1e')](function(){_0x232830();});});}function manageTags(_0x5239ef,_0x3649cc,_0x5cc8fb,_0x20c668,_0x5ba1f9,_0x4b3c1a,_0x5674ee){return new Promise(function(_0x273cb5,_0x49d231){var _0x2244d6=[];_0x3649cc[_0x0a9e('0x29')](function(_0x261adb){_0x2244d6[_0x0a9e('0x42')](getRemoteTag(_0x261adb,_0x5cc8fb,_0x20c668,_0x4b3c1a,_0x5674ee));});return Promise[_0x0a9e('0x43')](_0x2244d6)[_0x0a9e('0x19')](function(_0x49eed0){if(_0x49eed0[_0x0a9e('0x28')]){logger['info']('['+[_0x5239ef[_0x0a9e('0x11')]()]+_0x0a9e('0x44'),_0x49eed0);var _0x51aaf7=[];_0x49eed0['forEach'](function(_0x453360){_0x51aaf7[_0x0a9e('0x42')](assignTagToIncident(_0x453360,_0x5cc8fb,_0x20c668,_0x5ba1f9,_0x4b3c1a));});return Promise[_0x0a9e('0x43')](_0x51aaf7)[_0x0a9e('0x19')](function(){_0x273cb5();})['catch'](function(){_0x273cb5();});}else{_0x273cb5();}});});}function getTags(_0x1d0dc8,_0xe05a5a,_0x54327c,_0x797b45,_0x17e88c,_0x88dcbf){return function(_0x409b29){return new Promise(function(_0x401837,_0x4d4a35){var _0x176840=[];var _0x2937e0=_0x797b45[_0x0a9e('0x45')];if(_0x2937e0&&_0x2937e0['length']>0x0){_0x176840=_[_0x0a9e('0x46')](_0x2937e0,'name');}if(_0x176840['length']>0x0){return manageTags(_0x1d0dc8,_0x176840,_0xe05a5a,_0x54327c,_0x409b29,_0x17e88c,_0x88dcbf)[_0x0a9e('0x19')](function(){_0x401837(_0x409b29);});}else{_0x401837(_0x409b29);}});};}function emit(_0x4556c5,_0x9375fb,_0x19c995){var _0x186f39=_0x0a9e('0x47')+_0x0a9e('0x48')+_0x0a9e('0x49')+_0x0a9e('0x4a');var _0x1cc4f3={'uri':_0x4556c5+_0x0a9e('0x4b')+_0x19c995+_0x186f39};io['to'](util[_0x0a9e('0x4c')](_0x0a9e('0x4d'),_0x9375fb))[_0x0a9e('0x4e')](_0x0a9e('0x4f'),_0x1cc4f3);}exports['cs']=function(_0x412a72,_0x2a28c0,_0x4257c9,_0x5150a4,_0x1b0b98,_0x295763,_0x243d12,_0x4edbb0){var _0x1148a1={};var _0x30944e={'user':_0x295763['username'],'pass':_0x295763[_0x0a9e('0x50')]};var _0x56e31e=_0x0a9e('0x51');var _0x427946=_0x0a9e('0x52');_0x295763['remoteUri']=intUtil['stripTrailingSlash'](_0x295763['remoteUri']);_0x295763[_0x0a9e('0x53')]=intUtil[_0x0a9e('0x54')](_0x295763[_0x0a9e('0x53')]);var _0x23a7d3=util[_0x0a9e('0x4c')](_0x0a9e('0x55'),_0x295763[_0x0a9e('0x56')]);_0x1148a1[_0x0a9e('0x16')]=!_['isNil'](_0x5150a4)?_0x5150a4[_0x0a9e('0x57')]:null;_0x1148a1[_0x0a9e('0x1c')]=_0x295763[_0x0a9e('0x57')];_0x1148a1['endUserNumber']=_0x4edbb0[_0x0a9e('0x2f')]()==='outbound'?_0x2a28c0[_0x0a9e('0x58')]:_0x2a28c0[_0x0a9e('0x59')];_0x1148a1['callDirection']=_0x4edbb0===_0x0a9e('0x5a')||_0x4edbb0===_0x0a9e('0x5b')?_0x0a9e('0x5a'):_0x0a9e('0x35');var _0x542ece=util[_0x0a9e('0x4c')](_0x0a9e('0x5c'),_0x295763[_0x0a9e('0x53')],_0x2a28c0[_0x0a9e('0x5d')],md5(_0x2a28c0['uniqueid']));if(_0x1b0b98&&_0x1b0b98[_0x0a9e('0x5e')]){logger[_0x0a9e('0x10')](_0x0a9e('0x5f'),_0x0a9e('0x60'));_0x2a28c0['recordingURL']=_0x542ece;}else if(_0x243d12&&_0x243d12[_0x0a9e('0x61')]&&_0x243d12[_0x0a9e('0x61')]!==_0x0a9e('0x62')){logger[_0x0a9e('0x10')](_0x0a9e('0x63'),_0x0a9e('0x60'));_0x2a28c0[_0x0a9e('0x64')]=_0x542ece;}else{_0x2a28c0[_0x0a9e('0x64')]='';}return getAdminUser(_0x4edbb0,_0x30944e,_0x1148a1,_0x23a7d3,_0x427946,_0x56e31e)[_0x0a9e('0x19')](getUser(_0x4edbb0,_0x30944e,_0x23a7d3,_0x427946,_0x56e31e))[_0x0a9e('0x19')](getEndUser(_0x4edbb0,_0x30944e,_0x23a7d3,_0x427946,_0x56e31e))[_0x0a9e('0x19')](getTicket(_0x4edbb0,_0x30944e,_0x23a7d3,_0x4257c9,_0x2a28c0,_0x427946))[_0x0a9e('0x19')](function(_0x25744a){logger[_0x0a9e('0x10')](util['format'](_0x0a9e('0x65'),_0x25744a[_0x0a9e('0x3f')]));logger[_0x0a9e('0x10')](util['format'](_0x0a9e('0x66'),_0x4edbb0));if(_0x4edbb0!==_0x0a9e('0x5b')){logger[_0x0a9e('0x10')]('['+[_0x4edbb0[_0x0a9e('0x11')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x295763['remoteUri'],_0x5150a4[_0x0a9e('0x33')],_0x25744a[_0x0a9e('0x3f')]);}})['catch'](function(_0x45108c){logger['error']('['+[_0x4edbb0[_0x0a9e('0x11')]()]+_0x0a9e('0x67'),util['inspect'](_0x45108c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xa9e0=['validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','userId','adminEmail','],\x20getUser\x20crm','catch','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','endUserNumber','true','System','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','length','forEach','type','customField','idField','content','toString','toLowerCase','variable','variableName','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema',']\x20getTicket\x20crm','label','Incident','ticketId','Incident\x20-\x20','ticketNumber','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','serverUrl','stripTrailingSlash','%s/api/now/table/','remoteUri','email','destcalleridnum','calleridnum','queue','abandoned','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','adminId','result','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','error','message'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0x0a9e('0x0'));var Promise=require(_0x0a9e('0x1'));var rp=require(_0x0a9e('0x2'));var util=require('util');var md5=require('md5');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function getAdminUser(_0x5f41ea,_0x503809,_0xe42b77,_0x56465b,_0x52cace,_0x39753a){return new Promise(function(_0xf81284,_0x307b3e){var _0x3ab53f={'method':_0x0a9e('0xb'),'uri':_0x56465b+_0x0a9e('0xc')+'&'+_0x52cace+'&'+_0x39753a,'auth':_0x503809,'json':!![]};return rp(_0x3ab53f)['then'](function(_0x50dfb2){if(_0x50dfb2['result']['length']>0x0){_0xe42b77[_0x0a9e('0xd')]=_0x50dfb2[_0x0a9e('0xe')][0x0][_0x0a9e('0xf')];}logger[_0x0a9e('0x10')]('['+[_0x5f41ea[_0x0a9e('0x11')]()]+_0x0a9e('0x12'),_0xe42b77);_0xf81284(_0xe42b77);})['catch'](function(_0x4283ce){logger[_0x0a9e('0x13')]('['+[_0x5f41ea[_0x0a9e('0x11')]()]+']',_0x4283ce[_0x0a9e('0x14')]);_0x307b3e(_0x4283ce[_0x0a9e('0x14')]);});});}function getUser(_0x4d5611,_0x52a03d,_0x22dccb,_0x5d0880,_0x1985b6){return function(_0x519dfd){logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+'],\x20getUser\x20input\x20crm',_0x519dfd);return new Promise(function(_0x225616,_0x5a0a06){if(intUtil[_0x0a9e('0x15')](_0x519dfd[_0x0a9e('0x16')])){var _0x106033={'method':_0x0a9e('0xb'),'uri':_0x22dccb+_0x0a9e('0x17')+_0x519dfd[_0x0a9e('0x16')]+'&'+_0x5d0880+'&'+_0x1985b6,'auth':_0x52a03d,'json':!![]};logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+_0x0a9e('0x18'),_0x106033);return rp(_0x106033)[_0x0a9e('0x19')](function(_0x1c696a){logger[_0x0a9e('0x10')]('['+[_0x4d5611['toUpperCase']()]+_0x0a9e('0x1a'),_0x1c696a);if(_0x1c696a[_0x0a9e('0xe')]['length']>0x0&&String(_0x1c696a[_0x0a9e('0xe')][0x0]['active'])==='true'){_0x519dfd[_0x0a9e('0x1b')]=_0x1c696a[_0x0a9e('0xe')][0x0][_0x0a9e('0xf')];}else{_0x519dfd[_0x0a9e('0x1b')]=_0x519dfd['adminId'];_0x519dfd[_0x0a9e('0x16')]=_0x519dfd[_0x0a9e('0x1c')];}logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+_0x0a9e('0x1d'),_0x519dfd);_0x225616(_0x519dfd);})[_0x0a9e('0x1e')](function(_0x16b1ca){logger['error']('['+[_0x4d5611['toUpperCase']()]+']',_0x16b1ca[_0x0a9e('0x14')]);_0x5a0a06(_0x16b1ca[_0x0a9e('0x14')]);});}else{logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+']\x20using\x20admin\x20profile');_0x519dfd[_0x0a9e('0x1b')]=_0x519dfd['adminId'];_0x519dfd[_0x0a9e('0x16')]=_0x519dfd['adminEmail'];_0x225616(_0x519dfd);}});};}function createEndUser(_0x1dc186,_0x34dc65,_0x25fba9,_0x14433c,_0x140511){logger[_0x0a9e('0x10')]('['+[_0x1dc186[_0x0a9e('0x11')]()]+_0x0a9e('0x1f'),_0x25fba9);return new Promise(function(_0x5a101a,_0x3652a7){var _0x468813={'method':_0x0a9e('0x20'),'uri':_0x14433c+_0x0a9e('0x21')+_0x140511,'body':{'user_name':_0x25fba9['endUserNumber'],'roles':_0x0a9e('0x22'),'first_name':_0x25fba9[_0x0a9e('0x23')],'active':_0x0a9e('0x24'),'date_format':_0x0a9e('0x25'),'phone':_0x25fba9[_0x0a9e('0x23')]},'auth':_0x34dc65,'json':!![]};return rp(_0x468813)[_0x0a9e('0x19')](function(_0x296f41){logger[_0x0a9e('0x10')]('['+[_0x1dc186[_0x0a9e('0x11')]()]+'],\x20EndUser\x20schema',_0x296f41[_0x0a9e('0xe')]);_0x25fba9['endUserId']=_0x296f41[_0x0a9e('0xe')][_0x0a9e('0xf')];_0x5a101a(_0x25fba9);})[_0x0a9e('0x1e')](function(_0x33bdb7){logger[_0x0a9e('0x13')]('['+[_0x1dc186['toUpperCase']()]+']',_0x33bdb7[_0x0a9e('0x14')]);_0x3652a7(_0x33bdb7[_0x0a9e('0x14')]);});});}function getEndUser(_0x40cb85,_0x2da5c0,_0x2b45ea,_0x409319,_0x332d35){return function(_0x39e565){logger['info']('['+[_0x40cb85[_0x0a9e('0x11')]()]+'],\x20getEndUser\x20input\x20crm',_0x39e565);return new Promise(function(_0x2cc7a0,_0x14b13f){var _0x2b7e7f={'method':_0x0a9e('0xb'),'uri':_0x2b45ea+'sys_user?sysparm_query=phone%3D'+_0x39e565[_0x0a9e('0x23')]+'&'+_0x409319+'&'+_0x332d35,'auth':_0x2da5c0,'json':!![]};return rp(_0x2b7e7f)[_0x0a9e('0x19')](function(_0x1fa90d){if(_0x1fa90d[_0x0a9e('0xe')]['length']>0x0){_0x39e565['endUserId']=_0x1fa90d[_0x0a9e('0xe')][0x0]['sys_id'];logger[_0x0a9e('0x10')]('['+[_0x40cb85[_0x0a9e('0x11')]()]+_0x0a9e('0x26'),_0x39e565);_0x2cc7a0(_0x39e565);}else{return createEndUser(_0x40cb85,_0x2da5c0,_0x39e565,_0x2b45ea,_0x409319)[_0x0a9e('0x19')](function(_0x4f41ae){logger[_0x0a9e('0x10')]('['+[_0x40cb85[_0x0a9e('0x11')]()]+_0x0a9e('0x27'),_0x4f41ae);_0x2cc7a0(_0x4f41ae);});}})['catch'](function(_0x1dbf74){logger[_0x0a9e('0x13')]('['+[_0x40cb85[_0x0a9e('0x11')]()]+']',_0x1dbf74['message']);_0x14b13f(_0x1dbf74['message']);});});};}function getCustomFields(_0x11b61d,_0x40d766){var _0x5adda1={};if(_0x11b61d[_0x0a9e('0x28')]>0x0){_[_0x0a9e('0x29')](_0x11b61d,function(_0x2e1b3a){if(_0x2e1b3a[_0x0a9e('0x2a')]==='string'&&_0x2e1b3a['nameField']&&!_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')]['toLowerCase']()]=_0x2e1b3a[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x2e1b3a[_0x0a9e('0x2a')]==='string'&&_0x2e1b3a[_0x0a9e('0x2c')]&&_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')][_0x0a9e('0x2f')]()]=_0x2e1b3a[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x2e1b3a[_0x0a9e('0x2a')]===_0x0a9e('0x30')&&_0x2e1b3a[_0x0a9e('0x31')]&&_0x2e1b3a[_0x0a9e('0x2c')]&&_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')][_0x0a9e('0x2f')]()]=_0x40d766[_0x2e1b3a[_0x0a9e('0x31')]][_0x0a9e('0x2e')]();}else if(_0x2e1b3a['type']==='customVariable'&&_0x2e1b3a[_0x0a9e('0x32')]&&_0x2e1b3a[_0x0a9e('0x32')][_0x0a9e('0x33')]&&_0x2e1b3a[_0x0a9e('0x2c')]&&_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')][_0x0a9e('0x2f')]()]=_0x40d766[_0x2e1b3a[_0x0a9e('0x32')][_0x0a9e('0x33')][_0x0a9e('0x2f')]()][_0x0a9e('0x2e')]();}});}return _0x5adda1;}function getTicket(_0x35ed4a,_0x5026aa,_0x117c99,_0x138b8b,_0xdd268f,_0xfbd5ad){return function(_0x2e8caf){logger[_0x0a9e('0x10')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+_0x0a9e('0x34'),_0x2e8caf);return new Promise(function(_0x59afe8,_0x2e9d90){var _0x48fd45=_0x35ed4a[_0x0a9e('0x2f')]()===_0x0a9e('0x35')?_0x2e8caf[_0x0a9e('0x1b')]:_0x2e8caf['endUserId'];var _0x14bec2={'method':_0x0a9e('0x20'),'uri':_0x117c99+_0x0a9e('0x36')+'?'+_0xfbd5ad,'body':Object[_0x0a9e('0x37')]({},{'active':_0x0a9e('0x24'),'caller_id':_0x48fd45,'assigned_to':_0x2e8caf[_0x0a9e('0x1b')],'short_description':intUtil[_0x0a9e('0x38')](_0x138b8b['Subjects'],_0xdd268f,'\x20'),'description':intUtil[_0x0a9e('0x38')](_0x138b8b[_0x0a9e('0x39')],_0xdd268f,'\x0a')},getCustomFields(_0x138b8b[_0x0a9e('0x3a')],_0xdd268f)),'auth':_0x5026aa,'json':!![]};return rp(_0x14bec2)[_0x0a9e('0x19')](function(_0x409789){logger[_0x0a9e('0x10')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+_0x0a9e('0x3b'),_0x409789[_0x0a9e('0xe')]);_0x2e8caf['ticketId']=_0x409789[_0x0a9e('0xe')][_0x0a9e('0xf')];_0x2e8caf['ticketNumber']=_0x409789['result']['number'];logger[_0x0a9e('0x10')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+_0x0a9e('0x3c'),_0x2e8caf);_0x59afe8(_0x2e8caf);})[_0x0a9e('0x1e')](function(_0x61bb17){logger[_0x0a9e('0x13')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+']',_0x61bb17[_0x0a9e('0x14')]);_0x2e9d90(_0x61bb17['message']);});});};}function createRemoteTag(_0x4b1b9f,_0x53975a,_0x39d77d,_0x204173){return new Promise(function(_0x14d602,_0x5bb3ed){var _0x2b69d9={'method':_0x0a9e('0x20'),'uri':_0x39d77d+'label'+'?'+_0x204173,'body':{'short_description':_0x4b1b9f,'global':!![],'active':!![],'name':_0x4b1b9f},'auth':_0x53975a,'json':!![]};return rp(_0x2b69d9)['then'](function(_0x2ef381){var _0x59c6ff=_0x2ef381[_0x0a9e('0xe')]['sys_id'];_0x14d602(_0x59c6ff);});});}function getRemoteTag(_0x2e5e62,_0x3c20b2,_0x439340,_0x53613a,_0x2f82da){return new Promise(function(_0x1bf38a,_0x508b47){var _0x50f687={'method':_0x0a9e('0xb'),'uri':_0x439340+_0x0a9e('0x3d')+'?sysparm_query=name%3D'+_0x2e5e62+'&'+_0x53613a,'auth':_0x3c20b2,'json':!![]};return rp(_0x50f687)[_0x0a9e('0x19')](function(_0x5ce9ac){if(_0x5ce9ac[_0x0a9e('0xe')]['length']>0x0){var _0xe22ccc=_0x5ce9ac['result'][0x0]['sys_id'];_0x1bf38a(_0xe22ccc);}else{return createRemoteTag(_0x2e5e62,_0x3c20b2,_0x439340,_0x53613a)['then'](function(_0x2da03c){_0x1bf38a(_0x2da03c);});}});});}function assignTagToIncident(_0x47de4c,_0x2f7092,_0x65432,_0x3cfd00,_0x19b4df){return new Promise(function(_0x232830,_0x272738){var _0xd10662={'method':_0x0a9e('0x20'),'uri':_0x65432+'label_entry'+'?'+_0x19b4df,'body':{'label':_0x47de4c,'table':_0x0a9e('0x36'),'id_type':_0x0a9e('0x3e'),'table_key':_0x3cfd00[_0x0a9e('0x3f')],'title':_0x0a9e('0x40')+_0x3cfd00[_0x0a9e('0x41')],'id_display':_0x3cfd00[_0x0a9e('0x41')]},'auth':_0x2f7092,'json':!![]};return rp(_0xd10662)['then'](function(_0x956fbe){_0x232830();})[_0x0a9e('0x1e')](function(){_0x232830();});});}function manageTags(_0x5239ef,_0x3649cc,_0x5cc8fb,_0x20c668,_0x5ba1f9,_0x4b3c1a,_0x5674ee){return new Promise(function(_0x273cb5,_0x49d231){var _0x2244d6=[];_0x3649cc[_0x0a9e('0x29')](function(_0x261adb){_0x2244d6[_0x0a9e('0x42')](getRemoteTag(_0x261adb,_0x5cc8fb,_0x20c668,_0x4b3c1a,_0x5674ee));});return Promise[_0x0a9e('0x43')](_0x2244d6)[_0x0a9e('0x19')](function(_0x49eed0){if(_0x49eed0[_0x0a9e('0x28')]){logger['info']('['+[_0x5239ef[_0x0a9e('0x11')]()]+_0x0a9e('0x44'),_0x49eed0);var _0x51aaf7=[];_0x49eed0['forEach'](function(_0x453360){_0x51aaf7[_0x0a9e('0x42')](assignTagToIncident(_0x453360,_0x5cc8fb,_0x20c668,_0x5ba1f9,_0x4b3c1a));});return Promise[_0x0a9e('0x43')](_0x51aaf7)[_0x0a9e('0x19')](function(){_0x273cb5();})['catch'](function(){_0x273cb5();});}else{_0x273cb5();}});});}function getTags(_0x1d0dc8,_0xe05a5a,_0x54327c,_0x797b45,_0x17e88c,_0x88dcbf){return function(_0x409b29){return new Promise(function(_0x401837,_0x4d4a35){var _0x176840=[];var _0x2937e0=_0x797b45[_0x0a9e('0x45')];if(_0x2937e0&&_0x2937e0['length']>0x0){_0x176840=_[_0x0a9e('0x46')](_0x2937e0,'name');}if(_0x176840['length']>0x0){return manageTags(_0x1d0dc8,_0x176840,_0xe05a5a,_0x54327c,_0x409b29,_0x17e88c,_0x88dcbf)[_0x0a9e('0x19')](function(){_0x401837(_0x409b29);});}else{_0x401837(_0x409b29);}});};}function emit(_0x4556c5,_0x9375fb,_0x19c995){var _0x186f39=_0x0a9e('0x47')+_0x0a9e('0x48')+_0x0a9e('0x49')+_0x0a9e('0x4a');var _0x1cc4f3={'uri':_0x4556c5+_0x0a9e('0x4b')+_0x19c995+_0x186f39};io['to'](util[_0x0a9e('0x4c')](_0x0a9e('0x4d'),_0x9375fb))[_0x0a9e('0x4e')](_0x0a9e('0x4f'),_0x1cc4f3);}exports['cs']=function(_0x412a72,_0x2a28c0,_0x4257c9,_0x5150a4,_0x1b0b98,_0x295763,_0x243d12,_0x4edbb0){var _0x1148a1={};var _0x30944e={'user':_0x295763['username'],'pass':_0x295763[_0x0a9e('0x50')]};var _0x56e31e=_0x0a9e('0x51');var _0x427946=_0x0a9e('0x52');_0x295763['remoteUri']=intUtil['stripTrailingSlash'](_0x295763['remoteUri']);_0x295763[_0x0a9e('0x53')]=intUtil[_0x0a9e('0x54')](_0x295763[_0x0a9e('0x53')]);var _0x23a7d3=util[_0x0a9e('0x4c')](_0x0a9e('0x55'),_0x295763[_0x0a9e('0x56')]);_0x1148a1[_0x0a9e('0x16')]=!_['isNil'](_0x5150a4)?_0x5150a4[_0x0a9e('0x57')]:null;_0x1148a1[_0x0a9e('0x1c')]=_0x295763[_0x0a9e('0x57')];_0x1148a1['endUserNumber']=_0x4edbb0[_0x0a9e('0x2f')]()==='outbound'?_0x2a28c0[_0x0a9e('0x58')]:_0x2a28c0[_0x0a9e('0x59')];_0x1148a1['callDirection']=_0x4edbb0===_0x0a9e('0x5a')||_0x4edbb0===_0x0a9e('0x5b')?_0x0a9e('0x5a'):_0x0a9e('0x35');var _0x542ece=util[_0x0a9e('0x4c')](_0x0a9e('0x5c'),_0x295763[_0x0a9e('0x53')],_0x2a28c0[_0x0a9e('0x5d')],md5(_0x2a28c0['uniqueid']));if(_0x1b0b98&&_0x1b0b98[_0x0a9e('0x5e')]){logger[_0x0a9e('0x10')](_0x0a9e('0x5f'),_0x0a9e('0x60'));_0x2a28c0['recordingURL']=_0x542ece;}else if(_0x243d12&&_0x243d12[_0x0a9e('0x61')]&&_0x243d12[_0x0a9e('0x61')]!==_0x0a9e('0x62')){logger[_0x0a9e('0x10')](_0x0a9e('0x63'),_0x0a9e('0x60'));_0x2a28c0[_0x0a9e('0x64')]=_0x542ece;}else{_0x2a28c0[_0x0a9e('0x64')]='';}return getAdminUser(_0x4edbb0,_0x30944e,_0x1148a1,_0x23a7d3,_0x427946,_0x56e31e)[_0x0a9e('0x19')](getUser(_0x4edbb0,_0x30944e,_0x23a7d3,_0x427946,_0x56e31e))[_0x0a9e('0x19')](getEndUser(_0x4edbb0,_0x30944e,_0x23a7d3,_0x427946,_0x56e31e))[_0x0a9e('0x19')](getTicket(_0x4edbb0,_0x30944e,_0x23a7d3,_0x4257c9,_0x2a28c0,_0x427946))[_0x0a9e('0x19')](function(_0x25744a){logger[_0x0a9e('0x10')](util['format'](_0x0a9e('0x65'),_0x25744a[_0x0a9e('0x3f')]));logger[_0x0a9e('0x10')](util['format'](_0x0a9e('0x66'),_0x4edbb0));if(_0x4edbb0!==_0x0a9e('0x5b')){logger[_0x0a9e('0x10')]('['+[_0x4edbb0[_0x0a9e('0x11')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x295763['remoteUri'],_0x5150a4[_0x0a9e('0x33')],_0x25744a[_0x0a9e('0x3f')]);}})['catch'](function(_0x45108c){logger['error']('['+[_0x4edbb0[_0x0a9e('0x11')]()]+_0x0a9e('0x67'),util['inspect'](_0x45108c,{'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 aa545f8..348dd1e 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 _0x131d=['Recording\x20is\x20enabled!','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','outbound','%s/service/v4_1/rest.php','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','trigger:browser:url','error','abandoned','[ABANDONED]','recordingURL','calleridname','Fields','lodash','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','POST','emit','Creating\x20new\x20ticket...','name','getString','Subjects','Descriptions','date_start','toISOString','slice','duration_minutes','parent_id','parent_type','parent_name','direction','length','forEach','push','variableName','set_entry','JSON','Calls','apiKey','base64','stringify','isNil','info','Employees','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','entry_list','name_value_list','user_name','Agent\x20found!','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','get_entry_list','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','then','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','Enduser\x20created.','merge','type','string','nameField','customField','toLowerCase','toString','idField','variable','custom_fields','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','stripTrailingSlash','serverUrl','uri','monitor_format','[QUEUE]'];(function(_0x22ed05,_0x36b420){var _0x597a3b=function(_0x2e4984){while(--_0x2e4984){_0x22ed05['push'](_0x22ed05['shift']());}};_0x597a3b(++_0x36b420);}(_0x131d,0x10a));var _0xd131=function(_0x5c8966,_0x7d7480){_0x5c8966=_0x5c8966-0x0;var _0x5675b0=_0x131d[_0x5c8966];return _0x5675b0;};'use strict';var _=require(_0xd131('0x0'));var rp=require(_0xd131('0x1'));var BPromise=require('bluebird');var md5=require(_0xd131('0x2'));var util=require(_0xd131('0x3'));var Redis=require(_0xd131('0x4'));var intUtil=require('./util');var config=require(_0xd131('0x5'));var logger=require(_0xd131('0x6'))('sugarcrm');config[_0xd131('0x7')]=_[_0xd131('0x8')](config[_0xd131('0x7')],{'host':_0xd131('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var def={'method':_0xd131('0xa'),'json':!![]};function emit(_0x2f277a,_0x13f9a2,_0x25cad2){io['to'](_0x2f277a)[_0xd131('0xb')](_0x13f9a2,_0x25cad2);}function getTicket(_0x4efd84,_0x5c9dbe,_0x1bdbd7,_0x5038fa,_0x2fc51a,_0x1104df,_0x495905,_0x56dad4){logger['info'](_0xd131('0xc'));var _0x278107=new Date();var _0x21823e=[{'name':_0xd131('0xd'),'value':intUtil[_0xd131('0xe')](_0x5038fa[_0xd131('0xf')],_0x2fc51a,'\x20')},{'name':'assigned_user_id','value':_0x5c9dbe['id']},{'name':'created_by','value':_0x5c9dbe['id']},{'name':'description','value':intUtil[_0xd131('0xe')](_0x5038fa[_0xd131('0x10')],_0x2fc51a,'\x0a')},{'name':_0xd131('0x11'),'value':_0x278107[_0xd131('0x12')]()[_0xd131('0x13')](0x0,0x13)['replace']('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0xd131('0x14'),'value':'15'},{'name':_0xd131('0x15'),'value':_0x1bdbd7['id']},{'name':_0xd131('0x16'),'value':'Contacts'},{'name':_0xd131('0x17'),'value':_0x1bdbd7[_0xd131('0xd')]},{'name':_0xd131('0x18'),'value':_0x56dad4}];if(_0x1104df[_0xd131('0x19')]){_[_0xd131('0x1a')](_0x1104df,function(_0x1897a7){if(_0x2fc51a[_0x1897a7['variableName']]){_0x21823e[_0xd131('0x1b')]({'name':_0x1897a7['idField'],'value':_0x2fc51a[_0x1897a7[_0xd131('0x1c')]]});}});}return request({'form':{'method':_0xd131('0x1d'),'input_type':'JSON','response_type':_0xd131('0x1e'),'rest_data':JSON['stringify']({'session':_0x495905['id'],'module_name':_0xd131('0x1f'),'name_value_list':_0x21823e})}});}function getAuth(_0x33ba90){return util['format']('Basic\x20%s',new Buffer(_0x33ba90[_0xd131('0x20')]+':X')['toString'](_0xd131('0x21')));}function getServerInfo(_0x4c002c){return request({'form':{'method':'get_server_info','input_type':_0xd131('0x1e'),'response_type':_0xd131('0x1e'),'rest_data':JSON[_0xd131('0x22')]({'session':_0x4c002c['id']})}});}function getUser(_0x24a5ed,_0x50aa87,_0x3f5a0f){if(!_[_0xd131('0x23')](_0x50aa87)){logger[_0xd131('0x24')]('Getting\x20agent\x20with\x20name',_0x50aa87);return request({'form':{'method':'get_entry_list','input_type':_0xd131('0x1e'),'response_type':'JSON','rest_data':JSON[_0xd131('0x22')]({'session':_0x3f5a0f['id'],'module_name':_0xd131('0x25'),'query':util[_0xd131('0x26')](_0xd131('0x27'),_0x50aa87),'order_by':'','offset':'0','select_fields':['id',_0xd131('0xd'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x3b85bb){if(_0x3b85bb['entry_list']['length']){var _0x2dd650=_['find'](_0x3b85bb[_0xd131('0x28')],function(_0x27612f){return _0x27612f[_0xd131('0x29')][_0xd131('0x2a')]['value']===_0x50aa87;});if(_0x2dd650){logger[_0xd131('0x24')](_0xd131('0x2b'));return BPromise[_0xd131('0x2c')]({'id':_0x2dd650[_0xd131('0x29')]['id'][_0xd131('0x2d')],'name':_0x2dd650[_0xd131('0x29')][_0xd131('0xd')]['value']});}}logger[_0xd131('0x24')](_0xd131('0x2e'));return BPromise['resolve']({'id':_0x3f5a0f[_0xd131('0x29')]['user_id'][_0xd131('0x2d')],'name':_0x3f5a0f[_0xd131('0x29')]['user_name'][_0xd131('0x2d')]});});}else{logger[_0xd131('0x24')](_0xd131('0x2f'));return BPromise['resolve']({'id':_0x3f5a0f[_0xd131('0x29')][_0xd131('0x30')][_0xd131('0x2d')],'name':_0x3f5a0f[_0xd131('0x29')]['user_name'][_0xd131('0x2d')]});}}function getEndUser(_0x1f6ba,_0xcf1d3,_0x91cd2e,_0x1b69f3){logger[_0xd131('0x24')](_0xd131('0x31'),_0x91cd2e);return request({'form':{'method':_0xd131('0x32'),'input_type':_0xd131('0x1e'),'response_type':_0xd131('0x1e'),'rest_data':JSON[_0xd131('0x22')]({'session':_0x1b69f3['id'],'module_name':_0xd131('0x33'),'query':util['format'](_0xd131('0x34'),_0x91cd2e),'order_by':'','offset':'0','select_fields':['id',_0xd131('0xd'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xd131('0x35')](function(_0x4d9d47){if(_0x4d9d47[_0xd131('0x28')][_0xd131('0x19')]){var _0x5a46aa=_['find'](_0x4d9d47[_0xd131('0x28')],function(_0x16f055){return _0x16f055[_0xd131('0x29')][_0xd131('0x36')]['value']===_0x91cd2e;});if(_0x5a46aa){logger[_0xd131('0x24')](_0xd131('0x37'));return BPromise[_0xd131('0x2c')]({'id':_0x5a46aa[_0xd131('0x29')]['id']['value'],'name':_0x5a46aa[_0xd131('0x29')]['name'][_0xd131('0x2d')],'phone':_0x5a46aa[_0xd131('0x29')][_0xd131('0x36')][_0xd131('0x2d')]});}}else{logger[_0xd131('0x24')](_0xd131('0x38'));return request({'form':{'method':_0xd131('0x1d'),'input_type':_0xd131('0x1e'),'response_type':'JSON','rest_data':JSON[_0xd131('0x22')]({'session':_0x1b69f3['id'],'module_name':_0xd131('0x33'),'name_value_list':[{'name':_0xd131('0x39'),'value':_0xcf1d3!==''?_0xcf1d3:util['format'](_0xd131('0x3a'),_0x91cd2e)},{'name':_0xd131('0x36'),'value':_0x91cd2e}]})}})[_0xd131('0x35')](function(_0x56b933){logger[_0xd131('0x24')](_0xd131('0x3b'));return BPromise[_0xd131('0x2c')]({'id':_0x56b933['id'],'name':_0x56b933[_0xd131('0x28')][_0xd131('0x39')][_0xd131('0x2d')],'phone':_0x56b933[_0xd131('0x28')]['phone_home'][_0xd131('0x2d')]});});}});}function request(_0xa2459b){logger['debug']('[HTTP]',JSON['stringify'](_0xa2459b));return rp(_[_0xd131('0x3c')](def,_0xa2459b));}function getTags(_0x4ebd8c,_0x1f3881){var _0x1d6a90=[];if(_0x4ebd8c&&_0x4ebd8c[_0xd131('0x19')]>0x0){_0x1d6a90=_['map'](_0x4ebd8c,_0x1f3881);}return _0x1d6a90;}function getCustomFields(_0x5f4e77,_0x36ac56){var _0x3af650=[];var _0x369dee={'custom_fields':[]};if(_0x5f4e77[_0xd131('0x19')]>0x0){_['forEach'](_0x5f4e77,function(_0x327e8b){if(_0x327e8b[_0xd131('0x3d')]===_0xd131('0x3e')&&_0x327e8b[_0xd131('0x3f')]&&!_0x327e8b[_0xd131('0x40')]){_0x369dee[_0x327e8b[_0xd131('0x3f')][_0xd131('0x41')]()]=_0x327e8b['content'][_0xd131('0x42')]();}else if(_0x327e8b[_0xd131('0x3d')]===_0xd131('0x3e')&&_0x327e8b[_0xd131('0x43')]&&_0x327e8b[_0xd131('0x40')]){_0x369dee['custom_fields'][_0xd131('0x1b')]({'id':_0x327e8b[_0xd131('0x43')],'value':_0x327e8b['content'][_0xd131('0x42')]()});}else if(_0x327e8b[_0xd131('0x3d')]===_0xd131('0x44')&&_0x327e8b[_0xd131('0x1c')]&&_0x327e8b[_0xd131('0x43')]&&_0x327e8b[_0xd131('0x40')]){_0x36ac56[_0x327e8b[_0xd131('0x1c')]]&&_0x369dee[_0xd131('0x45')][_0xd131('0x1b')]({'id':_0x327e8b[_0xd131('0x43')],'value':_0x36ac56[_0x327e8b['variableName']][_0xd131('0x42')]()});}else if(_0x327e8b[_0xd131('0x3d')]===_0xd131('0x46')&&_0x327e8b[_0xd131('0x47')]&&_0x327e8b[_0xd131('0x47')][_0xd131('0xd')]&&_0x327e8b[_0xd131('0x43')]&&_0x327e8b[_0xd131('0x40')]){_0x36ac56[_0x327e8b[_0xd131('0x47')][_0xd131('0xd')][_0xd131('0x41')]()]&&_0x369dee[_0xd131('0x45')][_0xd131('0x1b')]({'id':_0x327e8b['idField'],'value':_0x36ac56[_0x327e8b[_0xd131('0x47')]['name']['toLowerCase']()]['toString']()});}});}return _0x369dee;}function getConnection(_0x3947f8){return request({'method':_0xd131('0xa'),'form':{'method':_0xd131('0x48'),'input_type':_0xd131('0x1e'),'response_type':_0xd131('0x1e'),'rest_data':JSON[_0xd131('0x22')]({'user_auth':{'user_name':_0x3947f8[_0xd131('0x49')],'password':_0x3947f8[_0xd131('0x4a')],'encryption':_0xd131('0x4b')},'application':_0xd131('0x4c')})}})[_0xd131('0x35')](function(_0x13c19a){var _0x397a00=_0x13c19a;if(_0x397a00['id']){def['sessionID']=_0x397a00['id'];return BPromise[_0xd131('0x2c')](_0x397a00);}else{throw new Error(util[_0xd131('0x26')](_0xd131('0x4d'),_0x3947f8['id']));}});}function setRelationship(_0x5395aa,_0x43cdbc,_0x2aafdd,_0x2abcc6){return request({'form':{'method':'set_relationship','input_type':_0xd131('0x1e'),'response_type':'JSON','rest_data':JSON[_0xd131('0x22')]({'session':_0x5395aa['id'],'module_name':'Calls','module_id':_0x2aafdd['id'],'link_field_name':_0x2abcc6,'related_ids':[_0x43cdbc['id']]})}});}exports[_0xd131('0x4e')]=function(_0x314efe,_0x17fb16,_0x37b209,_0x5987e5,_0x1a845f,_0xeacd4){var _0x8afe14,_0x320f15,_0x25021e,_0xa3271d;_0xeacd4[_0xd131('0x4f')]=intUtil['stripTrailingSlash'](_0xeacd4[_0xd131('0x4f')]);_0xeacd4['serverUrl']=intUtil[_0xd131('0x50')](_0xeacd4[_0xd131('0x51')]);def[_0xd131('0x52')]=util[_0xd131('0x26')]('%s/service/v4_1/rest.php',_0xeacd4['remoteUri']);if(_0x1a845f&&_0x1a845f[_0xd131('0x53')]){logger['info'](_0xd131('0x54'),_0xd131('0x55'));_0x17fb16['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xeacd4['serverUrl'],_0x17fb16[_0xd131('0x56')],md5(_0x17fb16[_0xd131('0x56')]));}else{_0x17fb16['recordingURL']='';}return getConnection(_0xeacd4)[_0xd131('0x35')](function(_0x50b0df){_0xa3271d=_0x50b0df;return getUser(_0xeacd4,_0x5987e5['name'],_0xa3271d);})[_0xd131('0x35')](function(_0x1dbe65){_0x8afe14=_0x1dbe65;logger['info'](_0xd131('0x57'),_0x8afe14['id']);return getEndUser(_0xeacd4,_0x17fb16['calleridname'],_0x17fb16[_0xd131('0x58')],_0xa3271d);})[_0xd131('0x35')](function(_0x39677e){_0x320f15=_0x39677e;logger[_0xd131('0x24')](_0xd131('0x59'),_0x320f15['id']);return getTicket(_0xeacd4,_0x8afe14,_0x320f15,_0x37b209,_0x17fb16,_0x37b209['Fields'],_0xa3271d,_0xd131('0x5a'));})[_0xd131('0x35')](function(_0x4e17fe){_0x25021e=_0x4e17fe;logger['info'](_0xd131('0x5b'));logger[_0xd131('0x24')](_0xd131('0x5c'),_0x25021e['id']);return setRelationship(_0xa3271d,_0x8afe14,_0x25021e,_0xd131('0x5d'));})[_0xd131('0x35')](function(){return setRelationship(_0xa3271d,_0x320f15,_0x25021e,_0xd131('0x5e'));})[_0xd131('0x35')](function(){return getServerInfo(_0xa3271d);})[_0xd131('0x35')](function(_0x4a69b7){var _0xea5b41=parseInt(_0x4a69b7[_0xd131('0x5f')][_0xd131('0x60')](0x0));var _0x5db51a=util[_0xd131('0x26')](_0xd131('0x61'),_0xeacd4['remoteUri'],_0x25021e['id']);if(_0xea5b41>0x6){_0x5db51a=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0xeacd4[_0xd131('0x4f')],_0x25021e['id']);}logger[_0xd131('0x24')]('[QUEUE]',_0xd131('0x62'));emit(util[_0xd131('0x26')](_0xd131('0x63'),_0x5987e5[_0xd131('0xd')]),'trigger:browser:url',{'uri':_0x5db51a});})[_0xd131('0x64')](function(_0x2c50d4){logger['error']('[QUEUE]',JSON[_0xd131('0x22')](_0x2c50d4));});};exports[_0xd131('0x65')]=function(_0x228728,_0x2b9a42,_0x4bc541,_0xc7cb11,_0xb184ef,_0x2e32b2,_0x9dff18){var _0x207337,_0x546922,_0xd02ca8,_0xddd024;_0x2e32b2[_0xd131('0x4f')]=intUtil[_0xd131('0x50')](_0x2e32b2[_0xd131('0x4f')]);_0x2e32b2[_0xd131('0x51')]=intUtil[_0xd131('0x50')](_0x2e32b2[_0xd131('0x51')]);def[_0xd131('0x52')]=util[_0xd131('0x26')](_0xd131('0x66'),_0x2e32b2[_0xd131('0x4f')]);if(_0x9dff18&&_0x9dff18[_0xd131('0x67')]&&_0x9dff18['recordingFormat']!==_0xd131('0x68')){logger[_0xd131('0x24')](_0xd131('0x69'),_0xd131('0x55'));_0x2b9a42['recordingURL']=util[_0xd131('0x26')](_0xd131('0x6a'),_0x2e32b2[_0xd131('0x51')],_0x2b9a42[_0xd131('0x56')],md5(_0x2b9a42[_0xd131('0x56')]));}return getConnection(_0x2e32b2)[_0xd131('0x35')](function(_0x3fe469){_0xddd024=_0x3fe469;return getUser(_0x2e32b2,_0xc7cb11[_0xd131('0xd')],_0xddd024);})[_0xd131('0x35')](function(_0x17dbde){_0x207337=_0x17dbde;logger[_0xd131('0x24')](_0xd131('0x57'),_0x207337['id']);return getEndUser(_0x2e32b2,_0x2b9a42[_0xd131('0x6b')],_0x2b9a42[_0xd131('0x6c')],_0xddd024);})['then'](function(_0x4f0108){_0x546922=_0x4f0108;logger[_0xd131('0x24')](_0xd131('0x59'),_0x546922['id']);return getTicket(_0x2e32b2,_0x207337,_0x546922,_0x4bc541,_0x2b9a42,_0x4bc541['Fields'],_0xddd024,'Outbound');})[_0xd131('0x35')](function(_0x38cc89){_0xd02ca8=_0x38cc89;logger[_0xd131('0x24')]('Ticket\x20created!');logger['info'](_0xd131('0x5c'),_0xd02ca8['id']);return setRelationship(_0xddd024,_0x207337,_0xd02ca8,_0xd131('0x5d'));})['then'](function(){return setRelationship(_0xddd024,_0x546922,_0xd02ca8,_0xd131('0x5e'));})[_0xd131('0x35')](function(){return getServerInfo(_0xddd024);})[_0xd131('0x35')](function(_0x4fa41f){var _0x1dfa26=parseInt(_0x4fa41f[_0xd131('0x5f')][_0xd131('0x60')](0x0));var _0x43c0d1=util['format'](_0xd131('0x61'),_0x2e32b2[_0xd131('0x4f')],_0xd02ca8['id']);if(_0x1dfa26>0x6){_0x43c0d1=util['format'](_0xd131('0x6d'),_0x2e32b2['remoteUri'],_0xd02ca8['id']);}logger[_0xd131('0x24')](_0xd131('0x69'),_0xd131('0x62'));emit(util['format']('user:%s',_0xc7cb11[_0xd131('0xd')]),_0xd131('0x6e'),{'uri':_0x43c0d1});})[_0xd131('0x64')](function(_0x1697b8){logger[_0xd131('0x6f')](_0xd131('0x69'),JSON[_0xd131('0x22')](_0x1697b8));});};exports[_0xd131('0x70')]=function(_0x1b5c04,_0x3084b3,_0x3d9f2f,_0x45aebe,_0x4689d8,_0x7abdb8){var _0x53d6da,_0x21de73,_0x5321e4,_0x30b4e2;_0x7abdb8[_0xd131('0x4f')]=intUtil['stripTrailingSlash'](_0x7abdb8['remoteUri']);_0x7abdb8[_0xd131('0x51')]=intUtil[_0xd131('0x50')](_0x7abdb8[_0xd131('0x51')]);def[_0xd131('0x52')]=util[_0xd131('0x26')](_0xd131('0x66'),_0x7abdb8['remoteUri']);if(_0x4689d8&&_0x4689d8[_0xd131('0x53')]){logger[_0xd131('0x24')](_0xd131('0x71'),'Recording\x20is\x20enabled!');_0x3084b3[_0xd131('0x72')]=util[_0xd131('0x26')](_0xd131('0x6a'),_0x7abdb8[_0xd131('0x51')],_0x3084b3[_0xd131('0x56')],md5(_0x3084b3[_0xd131('0x56')]));}else{_0x3084b3['recordingURL']='';}return getConnection(_0x7abdb8)[_0xd131('0x35')](function(_0x59b6f2){_0x30b4e2=_0x59b6f2;if(!_[_0xd131('0x23')](_0x45aebe)){return getUser(_0x7abdb8,_0x45aebe[_0xd131('0xd')],_0x30b4e2);}else{return getUser(_0x7abdb8,null,_0x30b4e2);}})[_0xd131('0x35')](function(_0x2bdf47){_0x53d6da=_0x2bdf47;logger['info']('The\x20User\x20ID\x20is:',_0x53d6da['id']);return getEndUser(_0x7abdb8,_0x3084b3[_0xd131('0x73')],_0x3084b3[_0xd131('0x58')],_0x30b4e2);})['then'](function(_0x1e5d4c){_0x21de73=_0x1e5d4c;logger[_0xd131('0x24')](_0xd131('0x59'),_0x21de73['id']);return getTicket(_0x7abdb8,_0x53d6da,_0x21de73,_0x3d9f2f,_0x3084b3,_0x3d9f2f[_0xd131('0x74')],_0x30b4e2,_0xd131('0x5a'));})[_0xd131('0x35')](function(_0x19d9c9){_0x5321e4=_0x19d9c9;logger[_0xd131('0x24')]('Ticket\x20created!');logger[_0xd131('0x24')]('The\x20Ticket\x20ID\x20is:',_0x5321e4['id']);return setRelationship(_0x30b4e2,_0x53d6da,_0x5321e4,_0xd131('0x5d'));})[_0xd131('0x35')](function(){return setRelationship(_0x30b4e2,_0x21de73,_0x5321e4,_0xd131('0x5e'));})[_0xd131('0x35')](function(){return getServerInfo(_0x30b4e2);})['catch'](function(_0x5d9371){logger[_0xd131('0x6f')]('[ABANDONED]',JSON['stringify'](_0x5d9371));});}; \ No newline at end of file +var _0x69af=['contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','trigger:browser:url','error','[QUEUE]','outbound','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','abandoned','[ABANDONED]','The\x20User\x20ID\x20is:','Inbound','lodash','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','description','Descriptions','slice','replace','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','variableName','push','idField','set_entry','JSON','Calls','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','stringify','Employees','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','Enduser\x20created.','first_name','debug','[HTTP]','merge','type','string','nameField','customField','toLowerCase','custom_fields','content','variable','customVariable','Variable','login','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users'];(function(_0x3bb854,_0x2fa23e){var _0x2ea95e=function(_0x1a367f){while(--_0x1a367f){_0x3bb854['push'](_0x3bb854['shift']());}};_0x2ea95e(++_0x2fa23e);}(_0x69af,0x182));var _0xf69a=function(_0x4a925f,_0x3de657){_0x4a925f=_0x4a925f-0x0;var _0x327688=_0x69af[_0x4a925f];return _0x327688;};'use strict';var _=require(_0xf69a('0x0'));var rp=require('request-promise');var BPromise=require(_0xf69a('0x1'));var md5=require(_0xf69a('0x2'));var util=require(_0xf69a('0x3'));var Redis=require(_0xf69a('0x4'));var intUtil=require(_0xf69a('0x5'));var config=require(_0xf69a('0x6'));var logger=require(_0xf69a('0x7'))(_0xf69a('0x8'));config[_0xf69a('0x9')]=_['defaults'](config[_0xf69a('0x9')],{'host':_0xf69a('0xa'),'port':0x18eb});var io=require(_0xf69a('0xb'))(new Redis(config[_0xf69a('0x9')]));var def={'method':_0xf69a('0xc'),'json':!![]};function emit(_0x64b64e,_0x38e5ca,_0x230e1b){io['to'](_0x64b64e)[_0xf69a('0xd')](_0x38e5ca,_0x230e1b);}function getTicket(_0x1188c5,_0x89a981,_0x1cc996,_0x1ded3d,_0x23aa5f,_0x1ef90d,_0xed4b47,_0x532517){logger[_0xf69a('0xe')](_0xf69a('0xf'));var _0x472c95=new Date();var _0x150b13=[{'name':_0xf69a('0x10'),'value':intUtil[_0xf69a('0x11')](_0x1ded3d[_0xf69a('0x12')],_0x23aa5f,'\x20')},{'name':_0xf69a('0x13'),'value':_0x89a981['id']},{'name':'created_by','value':_0x89a981['id']},{'name':_0xf69a('0x14'),'value':intUtil[_0xf69a('0x11')](_0x1ded3d[_0xf69a('0x15')],_0x23aa5f,'\x0a')},{'name':'date_start','value':_0x472c95['toISOString']()[_0xf69a('0x16')](0x0,0x13)[_0xf69a('0x17')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0xf69a('0x18'),'value':'15'},{'name':_0xf69a('0x19'),'value':_0x1cc996['id']},{'name':_0xf69a('0x1a'),'value':_0xf69a('0x1b')},{'name':_0xf69a('0x1c'),'value':_0x1cc996[_0xf69a('0x10')]},{'name':_0xf69a('0x1d'),'value':_0x532517}];if(_0x1ef90d[_0xf69a('0x1e')]){_[_0xf69a('0x1f')](_0x1ef90d,function(_0x3aa925){if(_0x23aa5f[_0x3aa925[_0xf69a('0x20')]]){_0x150b13[_0xf69a('0x21')]({'name':_0x3aa925[_0xf69a('0x22')],'value':_0x23aa5f[_0x3aa925['variableName']]});}});}return request({'form':{'method':_0xf69a('0x23'),'input_type':_0xf69a('0x24'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0xed4b47['id'],'module_name':_0xf69a('0x25'),'name_value_list':_0x150b13})}});}function getAuth(_0x56fa90){return util['format'](_0xf69a('0x26'),new Buffer(_0x56fa90[_0xf69a('0x27')]+':X')[_0xf69a('0x28')](_0xf69a('0x29')));}function getServerInfo(_0x58953b){return request({'form':{'method':_0xf69a('0x2a'),'input_type':_0xf69a('0x24'),'response_type':_0xf69a('0x24'),'rest_data':JSON['stringify']({'session':_0x58953b['id']})}});}function getUser(_0x4c92b,_0x539a51,_0x3096c7){if(!_[_0xf69a('0x2b')](_0x539a51)){logger[_0xf69a('0xe')](_0xf69a('0x2c'),_0x539a51);return request({'form':{'method':_0xf69a('0x2d'),'input_type':'JSON','response_type':_0xf69a('0x24'),'rest_data':JSON[_0xf69a('0x2e')]({'session':_0x3096c7['id'],'module_name':_0xf69a('0x2f'),'query':util[_0xf69a('0x30')](_0xf69a('0x31'),_0x539a51),'order_by':'','offset':'0','select_fields':['id',_0xf69a('0x10'),_0xf69a('0x32')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf69a('0x33')](function(_0x59bb3c){if(_0x59bb3c[_0xf69a('0x34')][_0xf69a('0x1e')]){var _0x4a78f7=_['find'](_0x59bb3c[_0xf69a('0x34')],function(_0x196b7e){return _0x196b7e[_0xf69a('0x35')][_0xf69a('0x32')][_0xf69a('0x36')]===_0x539a51;});if(_0x4a78f7){logger[_0xf69a('0xe')](_0xf69a('0x37'));return BPromise[_0xf69a('0x38')]({'id':_0x4a78f7['name_value_list']['id'][_0xf69a('0x36')],'name':_0x4a78f7[_0xf69a('0x35')][_0xf69a('0x10')][_0xf69a('0x36')]});}}logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xf69a('0x38')]({'id':_0x3096c7['name_value_list']['user_id'][_0xf69a('0x36')],'name':_0x3096c7['name_value_list'][_0xf69a('0x32')][_0xf69a('0x36')]});});}else{logger[_0xf69a('0xe')](_0xf69a('0x39'));return BPromise[_0xf69a('0x38')]({'id':_0x3096c7[_0xf69a('0x35')]['user_id'][_0xf69a('0x36')],'name':_0x3096c7[_0xf69a('0x35')][_0xf69a('0x32')][_0xf69a('0x36')]});}}function getEndUser(_0x4d7153,_0x37a78b,_0x555a9e,_0x40e316){logger[_0xf69a('0xe')](_0xf69a('0x3a'),_0x555a9e);return request({'form':{'method':_0xf69a('0x2d'),'input_type':_0xf69a('0x24'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x40e316['id'],'module_name':_0xf69a('0x1b'),'query':util[_0xf69a('0x30')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x555a9e),'order_by':'','offset':'0','select_fields':['id',_0xf69a('0x10'),_0xf69a('0x3b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf69a('0x33')](function(_0x53f6d9){if(_0x53f6d9[_0xf69a('0x34')]['length']){var _0x53b49d=_['find'](_0x53f6d9['entry_list'],function(_0x388336){return _0x388336[_0xf69a('0x35')][_0xf69a('0x3b')]['value']===_0x555a9e;});if(_0x53b49d){logger[_0xf69a('0xe')](_0xf69a('0x3c'));return BPromise['resolve']({'id':_0x53b49d[_0xf69a('0x35')]['id'][_0xf69a('0x36')],'name':_0x53b49d[_0xf69a('0x35')][_0xf69a('0x10')][_0xf69a('0x36')],'phone':_0x53b49d['name_value_list'][_0xf69a('0x3b')][_0xf69a('0x36')]});}}else{logger[_0xf69a('0xe')](_0xf69a('0x3d'));return request({'form':{'method':_0xf69a('0x23'),'input_type':_0xf69a('0x24'),'response_type':_0xf69a('0x24'),'rest_data':JSON[_0xf69a('0x2e')]({'session':_0x40e316['id'],'module_name':_0xf69a('0x1b'),'name_value_list':[{'name':'first_name','value':_0x37a78b!==''?_0x37a78b:util['format'](_0xf69a('0x3e'),_0x555a9e)},{'name':_0xf69a('0x3b'),'value':_0x555a9e}]})}})[_0xf69a('0x33')](function(_0x2e8710){logger['info'](_0xf69a('0x3f'));return BPromise[_0xf69a('0x38')]({'id':_0x2e8710['id'],'name':_0x2e8710[_0xf69a('0x34')][_0xf69a('0x40')]['value'],'phone':_0x2e8710[_0xf69a('0x34')][_0xf69a('0x3b')][_0xf69a('0x36')]});});}});}function request(_0x3179b1){logger[_0xf69a('0x41')](_0xf69a('0x42'),JSON['stringify'](_0x3179b1));return rp(_[_0xf69a('0x43')](def,_0x3179b1));}function getTags(_0x3e5c41,_0x10736b){var _0x37aae6=[];if(_0x3e5c41&&_0x3e5c41[_0xf69a('0x1e')]>0x0){_0x37aae6=_['map'](_0x3e5c41,_0x10736b);}return _0x37aae6;}function getCustomFields(_0x2ba0c1,_0x286eec){var _0x2d75f0=[];var _0x50e8ed={'custom_fields':[]};if(_0x2ba0c1[_0xf69a('0x1e')]>0x0){_[_0xf69a('0x1f')](_0x2ba0c1,function(_0x4cf5b4){if(_0x4cf5b4[_0xf69a('0x44')]===_0xf69a('0x45')&&_0x4cf5b4[_0xf69a('0x46')]&&!_0x4cf5b4[_0xf69a('0x47')]){_0x50e8ed[_0x4cf5b4['nameField'][_0xf69a('0x48')]()]=_0x4cf5b4['content'][_0xf69a('0x28')]();}else if(_0x4cf5b4[_0xf69a('0x44')]===_0xf69a('0x45')&&_0x4cf5b4['idField']&&_0x4cf5b4[_0xf69a('0x47')]){_0x50e8ed[_0xf69a('0x49')][_0xf69a('0x21')]({'id':_0x4cf5b4['idField'],'value':_0x4cf5b4[_0xf69a('0x4a')][_0xf69a('0x28')]()});}else if(_0x4cf5b4['type']===_0xf69a('0x4b')&&_0x4cf5b4['variableName']&&_0x4cf5b4[_0xf69a('0x22')]&&_0x4cf5b4[_0xf69a('0x47')]){_0x286eec[_0x4cf5b4['variableName']]&&_0x50e8ed[_0xf69a('0x49')]['push']({'id':_0x4cf5b4['idField'],'value':_0x286eec[_0x4cf5b4['variableName']][_0xf69a('0x28')]()});}else if(_0x4cf5b4[_0xf69a('0x44')]===_0xf69a('0x4c')&&_0x4cf5b4[_0xf69a('0x4d')]&&_0x4cf5b4[_0xf69a('0x4d')][_0xf69a('0x10')]&&_0x4cf5b4[_0xf69a('0x22')]&&_0x4cf5b4[_0xf69a('0x47')]){_0x286eec[_0x4cf5b4[_0xf69a('0x4d')][_0xf69a('0x10')][_0xf69a('0x48')]()]&&_0x50e8ed['custom_fields'][_0xf69a('0x21')]({'id':_0x4cf5b4['idField'],'value':_0x286eec[_0x4cf5b4[_0xf69a('0x4d')][_0xf69a('0x10')][_0xf69a('0x48')]()][_0xf69a('0x28')]()});}});}return _0x50e8ed;}function getConnection(_0x50192f){return request({'method':'POST','form':{'method':_0xf69a('0x4e'),'input_type':_0xf69a('0x24'),'response_type':_0xf69a('0x24'),'rest_data':JSON[_0xf69a('0x2e')]({'user_auth':{'user_name':_0x50192f['username'],'password':_0x50192f[_0xf69a('0x4f')],'encryption':_0xf69a('0x50')},'application':_0xf69a('0x51')})}})[_0xf69a('0x33')](function(_0x54e009){var _0x5de29=_0x54e009;if(_0x5de29['id']){def[_0xf69a('0x52')]=_0x5de29['id'];return BPromise[_0xf69a('0x38')](_0x5de29);}else{throw new Error(util['format'](_0xf69a('0x53'),_0x50192f['id']));}});}function setRelationship(_0x3db39e,_0x4b2d4b,_0x530757,_0x37b984){return request({'form':{'method':_0xf69a('0x54'),'input_type':_0xf69a('0x24'),'response_type':'JSON','rest_data':JSON[_0xf69a('0x2e')]({'session':_0x3db39e['id'],'module_name':'Calls','module_id':_0x530757['id'],'link_field_name':_0x37b984,'related_ids':[_0x4b2d4b['id']]})}});}exports[_0xf69a('0x55')]=function(_0x23a2d0,_0x3a26fc,_0x498217,_0x5c4371,_0x37d5ab,_0x195fc4){var _0x29108b,_0x5642a6,_0x3d0af0,_0x2248b4;_0x195fc4[_0xf69a('0x56')]=intUtil[_0xf69a('0x57')](_0x195fc4[_0xf69a('0x56')]);_0x195fc4[_0xf69a('0x58')]=intUtil[_0xf69a('0x57')](_0x195fc4['serverUrl']);def[_0xf69a('0x59')]=util[_0xf69a('0x30')](_0xf69a('0x5a'),_0x195fc4['remoteUri']);if(_0x37d5ab&&_0x37d5ab[_0xf69a('0x5b')]){logger['info']('[QUEUE]',_0xf69a('0x5c'));_0x3a26fc[_0xf69a('0x5d')]=util[_0xf69a('0x30')](_0xf69a('0x5e'),_0x195fc4[_0xf69a('0x58')],_0x3a26fc[_0xf69a('0x5f')],md5(_0x3a26fc[_0xf69a('0x5f')]));}else{_0x3a26fc['recordingURL']='';}return getConnection(_0x195fc4)['then'](function(_0x117020){_0x2248b4=_0x117020;return getUser(_0x195fc4,_0x5c4371[_0xf69a('0x10')],_0x2248b4);})[_0xf69a('0x33')](function(_0x1e0ed1){_0x29108b=_0x1e0ed1;logger['info']('The\x20User\x20ID\x20is:',_0x29108b['id']);return getEndUser(_0x195fc4,_0x3a26fc[_0xf69a('0x60')],_0x3a26fc['calleridnum'],_0x2248b4);})[_0xf69a('0x33')](function(_0x2ea802){_0x5642a6=_0x2ea802;logger['info'](_0xf69a('0x61'),_0x5642a6['id']);return getTicket(_0x195fc4,_0x29108b,_0x5642a6,_0x498217,_0x3a26fc,_0x498217[_0xf69a('0x62')],_0x2248b4,'Inbound');})[_0xf69a('0x33')](function(_0x40448c){_0x3d0af0=_0x40448c;logger[_0xf69a('0xe')](_0xf69a('0x63'));logger['info'](_0xf69a('0x64'),_0x3d0af0['id']);return setRelationship(_0x2248b4,_0x29108b,_0x3d0af0,_0xf69a('0x65'));})[_0xf69a('0x33')](function(){return setRelationship(_0x2248b4,_0x5642a6,_0x3d0af0,_0xf69a('0x66'));})[_0xf69a('0x33')](function(){return getServerInfo(_0x2248b4);})[_0xf69a('0x33')](function(_0xee4000){var _0x2c7709=parseInt(_0xee4000[_0xf69a('0x67')][_0xf69a('0x68')](0x0));var _0x2b41fc=util['format'](_0xf69a('0x69'),_0x195fc4[_0xf69a('0x56')],_0x3d0af0['id']);if(_0x2c7709>0x6){_0x2b41fc=util[_0xf69a('0x30')](_0xf69a('0x6a'),_0x195fc4[_0xf69a('0x56')],_0x3d0af0['id']);}logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf69a('0x30')]('user:%s',_0x5c4371[_0xf69a('0x10')]),_0xf69a('0x6b'),{'uri':_0x2b41fc});})['catch'](function(_0x193edb){logger[_0xf69a('0x6c')](_0xf69a('0x6d'),JSON[_0xf69a('0x2e')](_0x193edb));});};exports[_0xf69a('0x6e')]=function(_0x366b82,_0x30060d,_0x12df07,_0x400e4e,_0xc7e526,_0x389ebb,_0x2be62d){var _0x16baaf,_0x2081e3,_0x180383,_0x1332cf;_0x389ebb['remoteUri']=intUtil['stripTrailingSlash'](_0x389ebb['remoteUri']);_0x389ebb['serverUrl']=intUtil[_0xf69a('0x57')](_0x389ebb[_0xf69a('0x58')]);def['uri']=util[_0xf69a('0x30')](_0xf69a('0x5a'),_0x389ebb[_0xf69a('0x56')]);if(_0x2be62d&&_0x2be62d[_0xf69a('0x6f')]&&_0x2be62d[_0xf69a('0x6f')]!=='none'){logger['info'](_0xf69a('0x70'),_0xf69a('0x5c'));_0x30060d[_0xf69a('0x5d')]=util[_0xf69a('0x30')](_0xf69a('0x5e'),_0x389ebb['serverUrl'],_0x30060d[_0xf69a('0x5f')],md5(_0x30060d[_0xf69a('0x5f')]));}return getConnection(_0x389ebb)['then'](function(_0x38f86f){_0x1332cf=_0x38f86f;return getUser(_0x389ebb,_0x400e4e[_0xf69a('0x10')],_0x1332cf);})[_0xf69a('0x33')](function(_0x1c6916){_0x16baaf=_0x1c6916;logger['info']('The\x20User\x20ID\x20is:',_0x16baaf['id']);return getEndUser(_0x389ebb,_0x30060d[_0xf69a('0x71')],_0x30060d[_0xf69a('0x72')],_0x1332cf);})[_0xf69a('0x33')](function(_0x5169af){_0x2081e3=_0x5169af;logger[_0xf69a('0xe')]('The\x20Enduser\x20ID\x20is:',_0x2081e3['id']);return getTicket(_0x389ebb,_0x16baaf,_0x2081e3,_0x12df07,_0x30060d,_0x12df07['Fields'],_0x1332cf,'Outbound');})[_0xf69a('0x33')](function(_0x39d0bc){_0x180383=_0x39d0bc;logger[_0xf69a('0xe')]('Ticket\x20created!');logger[_0xf69a('0xe')](_0xf69a('0x64'),_0x180383['id']);return setRelationship(_0x1332cf,_0x16baaf,_0x180383,_0xf69a('0x65'));})['then'](function(){return setRelationship(_0x1332cf,_0x2081e3,_0x180383,_0xf69a('0x66'));})['then'](function(){return getServerInfo(_0x1332cf);})['then'](function(_0x2e4a68){var _0x2b2bc4=parseInt(_0x2e4a68[_0xf69a('0x67')][_0xf69a('0x68')](0x0));var _0x3e051e=util[_0xf69a('0x30')](_0xf69a('0x69'),_0x389ebb[_0xf69a('0x56')],_0x180383['id']);if(_0x2b2bc4>0x6){_0x3e051e=util[_0xf69a('0x30')](_0xf69a('0x6a'),_0x389ebb[_0xf69a('0x56')],_0x180383['id']);}logger[_0xf69a('0xe')](_0xf69a('0x70'),_0xf69a('0x73'));emit(util[_0xf69a('0x30')](_0xf69a('0x74'),_0x400e4e[_0xf69a('0x10')]),_0xf69a('0x6b'),{'uri':_0x3e051e});})[_0xf69a('0x75')](function(_0x2bde81){logger[_0xf69a('0x6c')](_0xf69a('0x70'),JSON['stringify'](_0x2bde81));});};exports[_0xf69a('0x76')]=function(_0x394d0f,_0x16a15c,_0x4584ac,_0x12076d,_0x4b2a1b,_0x4e6bd5){var _0x520547,_0x15392c,_0x4c22fe,_0x3df3c8;_0x4e6bd5[_0xf69a('0x56')]=intUtil[_0xf69a('0x57')](_0x4e6bd5[_0xf69a('0x56')]);_0x4e6bd5[_0xf69a('0x58')]=intUtil[_0xf69a('0x57')](_0x4e6bd5['serverUrl']);def[_0xf69a('0x59')]=util[_0xf69a('0x30')]('%s/service/v4_1/rest.php',_0x4e6bd5['remoteUri']);if(_0x4b2a1b&&_0x4b2a1b[_0xf69a('0x5b')]){logger[_0xf69a('0xe')](_0xf69a('0x77'),'Recording\x20is\x20enabled!');_0x16a15c[_0xf69a('0x5d')]=util[_0xf69a('0x30')](_0xf69a('0x5e'),_0x4e6bd5[_0xf69a('0x58')],_0x16a15c[_0xf69a('0x5f')],md5(_0x16a15c[_0xf69a('0x5f')]));}else{_0x16a15c[_0xf69a('0x5d')]='';}return getConnection(_0x4e6bd5)[_0xf69a('0x33')](function(_0x325a52){_0x3df3c8=_0x325a52;if(!_[_0xf69a('0x2b')](_0x12076d)){return getUser(_0x4e6bd5,_0x12076d[_0xf69a('0x10')],_0x3df3c8);}else{return getUser(_0x4e6bd5,null,_0x3df3c8);}})['then'](function(_0x555e73){_0x520547=_0x555e73;logger[_0xf69a('0xe')](_0xf69a('0x78'),_0x520547['id']);return getEndUser(_0x4e6bd5,_0x16a15c[_0xf69a('0x60')],_0x16a15c['calleridnum'],_0x3df3c8);})[_0xf69a('0x33')](function(_0x2a9e89){_0x15392c=_0x2a9e89;logger[_0xf69a('0xe')](_0xf69a('0x61'),_0x15392c['id']);return getTicket(_0x4e6bd5,_0x520547,_0x15392c,_0x4584ac,_0x16a15c,_0x4584ac['Fields'],_0x3df3c8,_0xf69a('0x79'));})['then'](function(_0x1b2454){_0x4c22fe=_0x1b2454;logger[_0xf69a('0xe')]('Ticket\x20created!');logger[_0xf69a('0xe')](_0xf69a('0x64'),_0x4c22fe['id']);return setRelationship(_0x3df3c8,_0x520547,_0x4c22fe,'users');})['then'](function(){return setRelationship(_0x3df3c8,_0x15392c,_0x4c22fe,_0xf69a('0x66'));})[_0xf69a('0x33')](function(){return getServerInfo(_0x3df3c8);})['catch'](function(_0x3004f8){logger[_0xf69a('0x6c')](_0xf69a('0x77'),JSON['stringify'](_0x3004f8));});}; \ 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 3efadab..4534bac 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 _0xab05=['keyContent','variableName','format','customVariable','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length','sortBy','string','type','variable','push','toString','Variable','name','toLowerCase','keyValue','keyType','key','%s:\x20%s'];(function(_0x397c49,_0xfeec11){var _0x1369a5=function(_0x2489d6){while(--_0x2489d6){_0x397c49['push'](_0x397c49['shift']());}};_0x1369a5(++_0xfeec11);}(_0xab05,0x1a2));var _0x5ab0=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xab05[_0x24237f];return _0x48298e;};'use strict';var _=require(_0x5ab0('0x0'));var util=require(_0x5ab0('0x1'));exports[_0x5ab0('0x2')]=function(_0x56fdc8,_0x1df098,_0x467ad2){var _0x192bcd=[];if(_0x56fdc8[_0x5ab0('0x3')]>0x0){var _0x4de3f8=_[_0x5ab0('0x4')](_0x56fdc8,['id']);for(var _0x3ba3e9=0x0;_0x3ba3e9<_0x4de3f8['length'];_0x3ba3e9++){var _0x4cb5b9=_0x4de3f8[_0x3ba3e9];if(_0x4cb5b9['type']===_0x5ab0('0x5')){_0x192bcd['push'](_0x4cb5b9['content']);}else if(_0x4cb5b9[_0x5ab0('0x6')]===_0x5ab0('0x7')&&_0x4cb5b9['variableName']){_0x1df098[_0x4cb5b9['variableName']]&&_0x192bcd[_0x5ab0('0x8')](_0x1df098[_0x4cb5b9['variableName']][_0x5ab0('0x9')]());}else if(_0x4cb5b9[_0x5ab0('0x6')]==='customVariable'&&_0x4cb5b9[_0x5ab0('0xa')]&&_0x4cb5b9['Variable'][_0x5ab0('0xb')]){_0x1df098[_0x4cb5b9['Variable']['name']['toLowerCase']()]&&_0x192bcd['push'](_0x1df098[_0x4cb5b9['Variable'][_0x5ab0('0xb')][_0x5ab0('0xc')]()][_0x5ab0('0x9')]());}else if(_0x4cb5b9[_0x5ab0('0x6')]===_0x5ab0('0xd')){if(_0x4cb5b9[_0x5ab0('0xe')]===_0x5ab0('0x5')&&_0x4cb5b9[_0x5ab0('0xf')]){_0x192bcd[_0x5ab0('0x8')](util['format'](_0x5ab0('0x10'),_0x4cb5b9[_0x5ab0('0xf')],_0x4cb5b9[_0x5ab0('0x11')]));}else if(_0x4cb5b9[_0x5ab0('0xe')]===_0x5ab0('0x7')&&_0x4cb5b9[_0x5ab0('0x12')]&&_0x4cb5b9[_0x5ab0('0xf')]){_0x1df098[_0x4cb5b9[_0x5ab0('0x12')]]&&_0x192bcd[_0x5ab0('0x8')](util[_0x5ab0('0x13')](_0x5ab0('0x10'),_0x4cb5b9['key'],_0x1df098[_0x4cb5b9[_0x5ab0('0x12')]]));}else if(_0x4cb5b9['keyType']===_0x5ab0('0x14')&&_0x4cb5b9[_0x5ab0('0xa')]&&_0x4cb5b9[_0x5ab0('0xa')][_0x5ab0('0xb')]&&_0x4cb5b9['key']){_0x1df098[_0x4cb5b9[_0x5ab0('0xa')]['name'][_0x5ab0('0xc')]()]&&_0x192bcd['push'](util[_0x5ab0('0x13')](_0x5ab0('0x10'),_0x4cb5b9[_0x5ab0('0xf')],_0x1df098[_0x4cb5b9[_0x5ab0('0xa')][_0x5ab0('0xb')][_0x5ab0('0xc')]()]));}}}}return _0x192bcd[_0x5ab0('0x15')](_0x467ad2);};exports[_0x5ab0('0x16')]=function(_0x4133bd){var _0x1d7601=_0x4133bd[_0x5ab0('0x17')](-0x1);if(_0x1d7601==='/'){_0x4133bd=_0x4133bd[_0x5ab0('0x18')](0x0,_0x4133bd[_0x5ab0('0x19')](_0x1d7601));}return _0x4133bd;};exports[_0x5ab0('0x1a')]=function(_0x1df3dd){if(!_[_0x5ab0('0x1b')](_0x1df3dd)&&_0x1df3dd!==''){var _0x1c9433=/^(([^<>()\[\]\\.,;:\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 _0x1c9433[_0x5ab0('0x1c')](String(_0x1df3dd)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0x07c3=['join','stripTrailingSlash','substring','validateEmail','isNil','util','getString','length','type','string','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyType','key','format','%s:\x20%s'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x07c3,0xeb));var _0x307c=function(_0x289891,_0x49a0fa){_0x289891=_0x289891-0x0;var _0x31cf2e=_0x07c3[_0x289891];return _0x31cf2e;};'use strict';var _=require('lodash');var util=require(_0x307c('0x0'));exports[_0x307c('0x1')]=function(_0x1bbf8e,_0x392467,_0x20c91c){var _0x1eec0d=[];if(_0x1bbf8e[_0x307c('0x2')]>0x0){var _0x469519=_['sortBy'](_0x1bbf8e,['id']);for(var _0x5be162=0x0;_0x5be162<_0x469519[_0x307c('0x2')];_0x5be162++){var _0x51e874=_0x469519[_0x5be162];if(_0x51e874[_0x307c('0x3')]===_0x307c('0x4')){_0x1eec0d[_0x307c('0x5')](_0x51e874[_0x307c('0x6')]);}else if(_0x51e874[_0x307c('0x3')]===_0x307c('0x7')&&_0x51e874[_0x307c('0x8')]){_0x392467[_0x51e874[_0x307c('0x8')]]&&_0x1eec0d[_0x307c('0x5')](_0x392467[_0x51e874[_0x307c('0x8')]][_0x307c('0x9')]());}else if(_0x51e874[_0x307c('0x3')]===_0x307c('0xa')&&_0x51e874[_0x307c('0xb')]&&_0x51e874[_0x307c('0xb')][_0x307c('0xc')]){_0x392467[_0x51e874[_0x307c('0xb')][_0x307c('0xc')][_0x307c('0xd')]()]&&_0x1eec0d[_0x307c('0x5')](_0x392467[_0x51e874[_0x307c('0xb')][_0x307c('0xc')]['toLowerCase']()][_0x307c('0x9')]());}else if(_0x51e874[_0x307c('0x3')]==='keyValue'){if(_0x51e874[_0x307c('0xe')]===_0x307c('0x4')&&_0x51e874[_0x307c('0xf')]){_0x1eec0d['push'](util[_0x307c('0x10')](_0x307c('0x11'),_0x51e874[_0x307c('0xf')],_0x51e874['keyContent']));}else if(_0x51e874[_0x307c('0xe')]===_0x307c('0x7')&&_0x51e874[_0x307c('0x8')]&&_0x51e874[_0x307c('0xf')]){_0x392467[_0x51e874[_0x307c('0x8')]]&&_0x1eec0d[_0x307c('0x5')](util[_0x307c('0x10')]('%s:\x20%s',_0x51e874[_0x307c('0xf')],_0x392467[_0x51e874[_0x307c('0x8')]]));}else if(_0x51e874[_0x307c('0xe')]===_0x307c('0xa')&&_0x51e874[_0x307c('0xb')]&&_0x51e874[_0x307c('0xb')][_0x307c('0xc')]&&_0x51e874['key']){_0x392467[_0x51e874['Variable'][_0x307c('0xc')][_0x307c('0xd')]()]&&_0x1eec0d[_0x307c('0x5')](util[_0x307c('0x10')](_0x307c('0x11'),_0x51e874[_0x307c('0xf')],_0x392467[_0x51e874['Variable'][_0x307c('0xc')][_0x307c('0xd')]()]));}}}}return _0x1eec0d[_0x307c('0x12')](_0x20c91c);};exports[_0x307c('0x13')]=function(_0x2933c5){var _0x55545e=_0x2933c5['slice'](-0x1);if(_0x55545e==='/'){_0x2933c5=_0x2933c5[_0x307c('0x14')](0x0,_0x2933c5['lastIndexOf'](_0x55545e));}return _0x2933c5;};exports[_0x307c('0x15')]=function(_0x3645aa){if(!_[_0x307c('0x16')](_0x3645aa)&&_0x3645aa!==''){var _0x5c5096=/^(([^<>()\[\]\\.,;:\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 _0x5c5096['test'](String(_0x3645aa)['toLowerCase']());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 5982ff8..2109bc4 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 _0x55ca=['email','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','abandoned','[ABANDONED]','lodash','request-promise','ioredis','./util','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','type','string','idField','content','toString','customVariable','Variable','name','toLowerCase','info','merge','Normal','Open','Subjects','getString','POST','format','%s/webservice.php','remoteUri','username','then','success','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','stringify','error','catch','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;','Agent\x20found!','email1','last_name','userId','admin','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','getUser','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','lastname','phone','getEndUser','accessKey','getConnection','queue','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','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','trigger:browser:url','[QUEUE]','outbound','serverUrl','recordingFormat','none','[OUTBOUND]'];(function(_0x321e3,_0x5128b1){var _0x5c9d58=function(_0x3f2c9c){while(--_0x3f2c9c){_0x321e3['push'](_0x321e3['shift']());}};_0x5c9d58(++_0x5128b1);}(_0x55ca,0x126));var _0xa55c=function(_0x4eab61,_0x1a6e6d){_0x4eab61=_0x4eab61-0x0;var _0x342426=_0x55ca[_0x4eab61];return _0x342426;};'use strict';var _=require(_0xa55c('0x0'));var rp=require(_0xa55c('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require('util');var Redis=require(_0xa55c('0x2'));var intUtil=require(_0xa55c('0x3'));var config=require('../../../../config/environment');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));config[_0xa55c('0x6')]=_[_0xa55c('0x7')](config[_0xa55c('0x6')],{'host':_0xa55c('0x8'),'port':0x18eb});var io=require(_0xa55c('0x9'))(new Redis(config['redis']));function emit(_0x2121fd,_0x2537f0,_0x57e069){io['to'](_0x2121fd)[_0xa55c('0xa')](_0x2537f0,_0x57e069);}function getCustomFields(_0x290d28,_0x52a3bc){var _0x5849ad={};if(_0x290d28[_0xa55c('0xb')]>0x0){_[_0xa55c('0xc')](_0x290d28,function(_0x381d07){if(_0x381d07[_0xa55c('0xd')]===_0xa55c('0xe')&&_0x381d07[_0xa55c('0xf')]){_0x5849ad[_0x381d07[_0xa55c('0xf')]]=_0x381d07[_0xa55c('0x10')][_0xa55c('0x11')]();}else if(_0x381d07[_0xa55c('0xd')]==='variable'&&_0x381d07['variableName']&&_0x381d07[_0xa55c('0xf')]&&_0x52a3bc[_0x381d07['variableName']]){_0x5849ad[_0x381d07['idField']]=_0x52a3bc[_0x381d07['variableName']][_0xa55c('0x11')]();}else if(_0x381d07[_0xa55c('0xd')]===_0xa55c('0x12')&&_0x381d07[_0xa55c('0x13')]&&_0x381d07[_0xa55c('0x13')][_0xa55c('0x14')]&&_0x381d07['idField']&&_0x52a3bc[_0x381d07[_0xa55c('0x13')][_0xa55c('0x14')][_0xa55c('0x15')]()]){_0x5849ad[_0x381d07[_0xa55c('0xf')]]=_0x52a3bc[_0x381d07[_0xa55c('0x13')][_0xa55c('0x14')][_0xa55c('0x15')]()][_0xa55c('0x11')]();}});}return _0x5849ad;}function createTicket(_0x24783b,_0x4cee3c,_0x3d4c9e,_0x104a99,_0x461284,_0x358b61,_0x23a1ae){logger[_0xa55c('0x16')]('Creating\x20new\x20ticket...');var _0x5f5158=_[_0xa55c('0x17')]({'parent_id':'','assigned_user_id':_0x4cee3c['id'],'ticketpriorities':_0xa55c('0x18'),'ticketstatus':_0xa55c('0x19'),'ticket_title':intUtil['getString'](_0x104a99[_0xa55c('0x1a')],_0x461284,'\x20'),'description':intUtil[_0xa55c('0x1b')](_0x104a99['Descriptions'],_0x461284,'\x0a'),'contact_id':_0x3d4c9e['id']},getCustomFields(_0x358b61,_0x461284));var _0x187a87={'method':_0xa55c('0x1c'),'uri':util[_0xa55c('0x1d')](_0xa55c('0x1e'),_0x24783b[_0xa55c('0x1f')]),'form':{'operation':'create','username':_0x24783b[_0xa55c('0x20')],'sessionName':_0x23a1ae['sessionName'],'elementType':'HelpDesk','element':JSON['stringify'](_0x5f5158)},'json':!![]};return request(_0x187a87)[_0xa55c('0x21')](function(_0x54b038){if(_0x54b038[_0xa55c('0x22')]){return BPromise[_0xa55c('0x23')]({'id':_0x54b038[_0xa55c('0x24')]['id']});}else{throw new Error(util[_0xa55c('0x1d')](_0xa55c('0x25'),JSON[_0xa55c('0x26')](_0x54b038[_0xa55c('0x27')])));}})[_0xa55c('0x28')](function(_0x192df2){var _0x3cd152=_0x192df2[_0xa55c('0x29')]||0x1f4;logger['error'](_0xa55c('0x2a'),_0xa55c('0x2b'),_0x3cd152,JSON[_0xa55c('0x26')](_0x192df2));});}function getUser(_0x906caa,_0x5d940d,_0x1377b0){if(intUtil[_0xa55c('0x2c')](_0x5d940d)){logger[_0xa55c('0x16')](_0xa55c('0x2d'),_0x5d940d);return request({'method':_0xa55c('0x2e'),'uri':util[_0xa55c('0x1d')]('%s/webservice.php',_0x906caa[_0xa55c('0x1f')]),'qs':{'operation':'query','username':_0x906caa[_0xa55c('0x20')],'sessionName':_0x1377b0[_0xa55c('0x2f')],'query':util[_0xa55c('0x1d')](_0xa55c('0x30'),_0x5d940d)},'json':!![]})['then'](function(_0x3d28fb){if(_0x3d28fb[_0xa55c('0x22')]&&_0x3d28fb[_0xa55c('0x24')][_0xa55c('0xb')]){logger[_0xa55c('0x16')](_0xa55c('0x31'));return BPromise[_0xa55c('0x23')]({'id':_0x3d28fb[_0xa55c('0x24')][0x0]['id'],'email':_0x3d28fb[_0xa55c('0x24')][0x0][_0xa55c('0x32')],'name':_0x3d28fb[_0xa55c('0x24')][0x0]['first_name']+'\x20'+_0x3d28fb['result'][_0xa55c('0x33')]});}else{logger[_0xa55c('0x16')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xa55c('0x23')]({'id':_0x1377b0[_0xa55c('0x34')],'email':_0x906caa[_0xa55c('0x20')],'name':_0xa55c('0x35')});}})[_0xa55c('0x28')](function(_0x38ff96){var _0x3ce1b3=_0x38ff96[_0xa55c('0x29')]||0x1f4;logger[_0xa55c('0x27')]('[vTiger],\x20%s,\x20%s,\x20%s','getUser',_0x3ce1b3,JSON['stringify'](_0x38ff96));});}else{logger[_0xa55c('0x16')](_0xa55c('0x36'));return BPromise[_0xa55c('0x23')]({'id':_0x1377b0['userId'],'email':_0x906caa[_0xa55c('0x20')],'name':'admin'})[_0xa55c('0x28')](function(_0x4ad813){var _0x18c6f1=_0x4ad813[_0xa55c('0x29')]||0x1f4;logger[_0xa55c('0x27')]('[vTiger],\x20%s,\x20%s,\x20%s',_0xa55c('0x37'),_0x18c6f1,JSON[_0xa55c('0x26')](_0x4ad813));});}}function getEndUser(_0x47e93c,_0x6f9c4c,_0x194e78,_0x4d9083){logger['info'](_0xa55c('0x38'),_0x194e78);return request({'method':'GET','uri':util[_0xa55c('0x1d')](_0xa55c('0x1e'),_0x47e93c['remoteUri']),'qs':{'operation':'query','username':_0x47e93c['username'],'sessionName':_0x4d9083['sessionName'],'query':util[_0xa55c('0x1d')](_0xa55c('0x39'),_0x194e78,_0x194e78,_0x194e78,_0x194e78,_0x194e78)},'json':!![]})[_0xa55c('0x21')](function(_0x99c4f8){if(_0x99c4f8[_0xa55c('0x22')]&&_0x99c4f8['result'][_0xa55c('0xb')]){logger[_0xa55c('0x16')](_0xa55c('0x3a'));return BPromise[_0xa55c('0x23')]({'id':_0x99c4f8[_0xa55c('0x24')][0x0]['id'],'name':_0x99c4f8[_0xa55c('0x24')][0x0]['firstname']+'\x20'+_0x99c4f8[_0xa55c('0x24')][0x0]['lastname'],'phone':_0x194e78});}else{logger['info'](_0xa55c('0x3b'));return request({'method':_0xa55c('0x1c'),'uri':util['format'](_0xa55c('0x1e'),_0x47e93c['remoteUri']),'form':{'operation':'create','sessionName':_0x4d9083[_0xa55c('0x2f')],'elementType':_0xa55c('0x3c'),'element':JSON[_0xa55c('0x26')]({'lastname':_0x6f9c4c,'phone':_0x194e78,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x1b2708){logger[_0xa55c('0x16')]('Enduser\x20created.');return BPromise[_0xa55c('0x23')]({'id':_0x1b2708['result']['id'],'name':_0x1b2708[_0xa55c('0x24')][_0xa55c('0x3d')],'phone':_0x1b2708['result'][_0xa55c('0x3e')]});})[_0xa55c('0x28')](function(_0x5d834d){var _0x40c352=_0x5d834d[_0xa55c('0x29')]||0x1f4;logger[_0xa55c('0x27')]('[vTiger],\x20%s,\x20%s,\x20%s',_0xa55c('0x3f'),_0x40c352,JSON['stringify'](_0x5d834d));});}});}function getConnection(_0x2f9717){var _0x3a8af4=_0x2f9717[_0xa55c('0x20')];var _0x51d663=_0x2f9717[_0xa55c('0x40')];return request({'method':_0xa55c('0x2e'),'uri':util['format'](_0xa55c('0x1e'),_0x2f9717[_0xa55c('0x1f')]),'qs':{'operation':'getchallenge','username':_0x3a8af4},'json':!![]})[_0xa55c('0x21')](function(_0xd3fe78){if(_0xd3fe78['success']){return request({'method':_0xa55c('0x1c'),'uri':util[_0xa55c('0x1d')](_0xa55c('0x1e'),_0x2f9717[_0xa55c('0x1f')]),'form':{'operation':'login','username':_0x3a8af4,'accessKey':md5(_0xd3fe78[_0xa55c('0x24')]['token']+_0x51d663)},'json':!![]});}})[_0xa55c('0x21')](function(_0x213100){if(_0x213100[_0xa55c('0x22')]){return BPromise['resolve'](_0x213100[_0xa55c('0x24')]);}else{throw new Error(util[_0xa55c('0x1d')]('Account\x20%d\x20is\x20not\x20valid',_0x2f9717['id']));}})[_0xa55c('0x28')](function(_0x34de95){var _0x3822b7=_0x34de95[_0xa55c('0x29')]||0x1f4;logger[_0xa55c('0x27')](_0xa55c('0x2a'),_0xa55c('0x41'),_0x3822b7,JSON[_0xa55c('0x26')](_0x34de95));});}function request(_0x3c147b){logger[_0xa55c('0x16')]('[HTTP]',JSON[_0xa55c('0x26')](_0x3c147b));return rp(_0x3c147b);}exports[_0xa55c('0x42')]=function(_0x216de8,_0x4f73b6,_0x4c3095,_0x35bf0a,_0x4f5ecd,_0x21b760){var _0x4fa412,_0x2b6a0e,_0x228df4,_0x181802;_0x21b760[_0xa55c('0x1f')]=intUtil[_0xa55c('0x43')](_0x21b760['remoteUri']);if(_0x4f5ecd&&_0x4f5ecd[_0xa55c('0x44')]){logger[_0xa55c('0x16')]('[QUEUE]',_0xa55c('0x45'));_0x4f73b6[_0xa55c('0x46')]=util[_0xa55c('0x1d')](_0xa55c('0x47'),_0x21b760['serverUrl'],_0x4f73b6['uniqueid'],md5(_0x4f73b6[_0xa55c('0x48')]));}else{_0x4f73b6[_0xa55c('0x46')]='';}return getConnection(_0x21b760)[_0xa55c('0x21')](function(_0x44ac57){_0x181802=_0x44ac57;return getUser(_0x21b760,_0x35bf0a['email'],_0x181802);})[_0xa55c('0x21')](function(_0x5ce463){_0x4fa412=_0x5ce463;logger[_0xa55c('0x16')](_0xa55c('0x49'),_0x4fa412['id']);return getEndUser(_0x21b760,_0x4f73b6[_0xa55c('0x4a')],_0x4f73b6[_0xa55c('0x4b')],_0x181802);})[_0xa55c('0x21')](function(_0x53b2f7){_0x2b6a0e=_0x53b2f7;logger[_0xa55c('0x16')]('The\x20Enduser\x20ID\x20is:',_0x2b6a0e['id']);return createTicket(_0x21b760,_0x4fa412,_0x2b6a0e,_0x4c3095,_0x4f73b6,_0x4c3095[_0xa55c('0x4c')],_0x181802);})[_0xa55c('0x21')](function(_0x2cfe08){_0x228df4=_0x2cfe08;logger[_0xa55c('0x16')](_0xa55c('0x4d'));logger[_0xa55c('0x16')](_0xa55c('0x4e'),_0x228df4['id']);var _0x53e2be=util[_0xa55c('0x1d')](_0xa55c('0x4f'),_0x21b760[_0xa55c('0x1f')],_[_0xa55c('0x50')](_0x228df4['id'],'x')[0x1]);logger[_0xa55c('0x16')]('[QUEUE]',_0xa55c('0x51'));emit(util[_0xa55c('0x1d')](_0xa55c('0x52'),_0x35bf0a[_0xa55c('0x14')]),_0xa55c('0x53'),{'uri':_0x53e2be});})['catch'](function(_0xdd92c1){logger[_0xa55c('0x27')](_0xa55c('0x54'),JSON[_0xa55c('0x26')](_0xdd92c1));});};exports[_0xa55c('0x55')]=function(_0x480dfc,_0x419fc3,_0x4d94fc,_0x2e482a,_0x5e3a28,_0x3495a7,_0x5a8897){var _0x34edc5,_0x1333da,_0x21d6b4,_0x2f811e;_0x3495a7[_0xa55c('0x1f')]=intUtil[_0xa55c('0x43')](_0x3495a7[_0xa55c('0x1f')]);_0x3495a7[_0xa55c('0x56')]=intUtil[_0xa55c('0x43')](_0x3495a7[_0xa55c('0x56')]);if(_0x5a8897&&_0x5a8897['recordingFormat']&&_0x5a8897[_0xa55c('0x57')]!==_0xa55c('0x58')){logger['info'](_0xa55c('0x59'),_0xa55c('0x45'));_0x419fc3[_0xa55c('0x46')]=util[_0xa55c('0x1d')](_0xa55c('0x47'),_0x3495a7[_0xa55c('0x56')],_0x419fc3[_0xa55c('0x48')],md5(_0x419fc3[_0xa55c('0x48')]));}return getConnection(_0x3495a7)['then'](function(_0x1dfaf7){_0x2f811e=_0x1dfaf7;return getUser(_0x3495a7,_0x2e482a[_0xa55c('0x5a')],_0x2f811e);})[_0xa55c('0x21')](function(_0xd309a9){_0x34edc5=_0xd309a9;logger[_0xa55c('0x16')](_0xa55c('0x49'),_0x34edc5['id']);return getEndUser(_0x3495a7,_0x419fc3[_0xa55c('0x5b')],_0x419fc3[_0xa55c('0x5c')],_0x2f811e);})[_0xa55c('0x21')](function(_0x4a08ca){_0x1333da=_0x4a08ca;logger[_0xa55c('0x16')](_0xa55c('0x5d'),_0x1333da['id']);return createTicket(_0x3495a7,_0x34edc5,_0x1333da,_0x4d94fc,_0x419fc3,_0x4d94fc[_0xa55c('0x4c')],_0x2f811e);})[_0xa55c('0x21')](function(_0x3a269d){_0x21d6b4=_0x3a269d;logger[_0xa55c('0x16')](_0xa55c('0x4d'));logger[_0xa55c('0x16')](_0xa55c('0x4e'),_0x21d6b4['id']);var _0x3178a6=util[_0xa55c('0x1d')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x3495a7[_0xa55c('0x1f')],_['split'](_0x21d6b4['id'],'x')[0x1]);logger[_0xa55c('0x16')](_0xa55c('0x59'),_0xa55c('0x51'));emit(util['format']('user:%s',_0x2e482a[_0xa55c('0x14')]),_0xa55c('0x53'),{'uri':_0x3178a6});})[_0xa55c('0x28')](function(_0x42529f){logger['error'](_0xa55c('0x59'),JSON[_0xa55c('0x26')](_0x42529f));});};exports[_0xa55c('0x5e')]=function(_0x3a9910,_0x21fc9b,_0x500968,_0x4b090c,_0x3f7fca,_0x38689e){var _0x3f9d0a,_0x36ee32,_0x1af9d5,_0x4b2032;_0x38689e[_0xa55c('0x1f')]=intUtil[_0xa55c('0x43')](_0x38689e['remoteUri']);_0x38689e[_0xa55c('0x56')]=intUtil[_0xa55c('0x43')](_0x38689e[_0xa55c('0x56')]);if(_0x3f7fca&&_0x3f7fca['monitor_format']){logger[_0xa55c('0x16')](_0xa55c('0x5f'),_0xa55c('0x45'));_0x21fc9b[_0xa55c('0x46')]=util[_0xa55c('0x1d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x38689e[_0xa55c('0x56')],_0x21fc9b[_0xa55c('0x48')],md5(_0x21fc9b['uniqueid']));}else{_0x21fc9b['recordingURL']='';}return getConnection(_0x38689e)[_0xa55c('0x21')](function(_0x4e1cbd){_0x4b2032=_0x4e1cbd;return getUser(_0x38689e,'',_0x4b2032);})[_0xa55c('0x21')](function(_0x5ca0bc){_0x3f9d0a=_0x5ca0bc;logger[_0xa55c('0x16')](_0xa55c('0x49'),_0x3f9d0a['id']);return getEndUser(_0x38689e,_0x21fc9b[_0xa55c('0x4a')],_0x21fc9b[_0xa55c('0x4b')],_0x4b2032);})[_0xa55c('0x21')](function(_0xff7b1c){_0x36ee32=_0xff7b1c;logger[_0xa55c('0x16')]('The\x20Enduser\x20ID\x20is:',_0x36ee32['id']);return createTicket(_0x38689e,_0x3f9d0a,_0x36ee32,_0x500968,_0x21fc9b,_0x500968[_0xa55c('0x4c')],_0x4b2032);})[_0xa55c('0x21')](function(_0x21de68){_0x1af9d5=_0x21de68;logger[_0xa55c('0x16')]('Ticket\x20created!');logger[_0xa55c('0x16')](_0xa55c('0x4e'),_0x1af9d5['id']);})[_0xa55c('0x28')](function(_0x2298ac){logger['error']('[ABANDONED]',JSON[_0xa55c('0x26')](_0x2298ac));});}; \ No newline at end of file +var _0x34e8=['user:%s','trigger:browser:url','[QUEUE]','outbound','serverUrl','recordingFormat','[OUTBOUND]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','monitor_format','[ABANDONED]','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','emit','length','forEach','type','string','idField','content','toString','variable','variableName','customVariable','Variable','name','info','Creating\x20new\x20ticket...','merge','Open','getString','Descriptions','%s/webservice.php','remoteUri','username','sessionName','stringify','then','resolve','result','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','GET','format','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','admin','getUser','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','phone','accessKey','success','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','Recording\x20is\x20enabled!','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x34e8,0x12c));var _0x834e=function(_0x14c73d,_0x152e3d){_0x14c73d=_0x14c73d-0x0;var _0x49834f=_0x34e8[_0x14c73d];return _0x49834f;};'use strict';var _=require(_0x834e('0x0'));var rp=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var util=require('util');var Redis=require(_0x834e('0x4'));var intUtil=require(_0x834e('0x5'));var config=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_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')]));function emit(_0x3cc2e3,_0x3a3ef6,_0x2e69e2){io['to'](_0x3cc2e3)[_0x834e('0xc')](_0x3a3ef6,_0x2e69e2);}function getCustomFields(_0x23501c,_0x363786){var _0x1af45a={};if(_0x23501c[_0x834e('0xd')]>0x0){_[_0x834e('0xe')](_0x23501c,function(_0x1e41fe){if(_0x1e41fe[_0x834e('0xf')]===_0x834e('0x10')&&_0x1e41fe[_0x834e('0x11')]){_0x1af45a[_0x1e41fe[_0x834e('0x11')]]=_0x1e41fe[_0x834e('0x12')][_0x834e('0x13')]();}else if(_0x1e41fe['type']===_0x834e('0x14')&&_0x1e41fe[_0x834e('0x15')]&&_0x1e41fe['idField']&&_0x363786[_0x1e41fe[_0x834e('0x15')]]){_0x1af45a[_0x1e41fe[_0x834e('0x11')]]=_0x363786[_0x1e41fe[_0x834e('0x15')]][_0x834e('0x13')]();}else if(_0x1e41fe['type']===_0x834e('0x16')&&_0x1e41fe[_0x834e('0x17')]&&_0x1e41fe['Variable'][_0x834e('0x18')]&&_0x1e41fe['idField']&&_0x363786[_0x1e41fe[_0x834e('0x17')][_0x834e('0x18')]['toLowerCase']()]){_0x1af45a[_0x1e41fe[_0x834e('0x11')]]=_0x363786[_0x1e41fe[_0x834e('0x17')][_0x834e('0x18')]['toLowerCase']()][_0x834e('0x13')]();}});}return _0x1af45a;}function createTicket(_0x211e9a,_0x34e41a,_0xb993a1,_0x237947,_0x254677,_0x1dd214,_0x595515){logger[_0x834e('0x19')](_0x834e('0x1a'));var _0x113ff4=_[_0x834e('0x1b')]({'parent_id':'','assigned_user_id':_0x34e41a['id'],'ticketpriorities':'Normal','ticketstatus':_0x834e('0x1c'),'ticket_title':intUtil[_0x834e('0x1d')](_0x237947['Subjects'],_0x254677,'\x20'),'description':intUtil[_0x834e('0x1d')](_0x237947[_0x834e('0x1e')],_0x254677,'\x0a'),'contact_id':_0xb993a1['id']},getCustomFields(_0x1dd214,_0x254677));var _0x8d406e={'method':'POST','uri':util['format'](_0x834e('0x1f'),_0x211e9a[_0x834e('0x20')]),'form':{'operation':'create','username':_0x211e9a[_0x834e('0x21')],'sessionName':_0x595515[_0x834e('0x22')],'elementType':'HelpDesk','element':JSON[_0x834e('0x23')](_0x113ff4)},'json':!![]};return request(_0x8d406e)[_0x834e('0x24')](function(_0x338636){if(_0x338636['success']){return BPromise[_0x834e('0x25')]({'id':_0x338636[_0x834e('0x26')]['id']});}else{throw new Error(util['format']('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x834e('0x23')](_0x338636['error'])));}})[_0x834e('0x27')](function(_0x3f1b0b){var _0x3db026=_0x3f1b0b[_0x834e('0x28')]||0x1f4;logger[_0x834e('0x29')](_0x834e('0x2a'),'createTicket',_0x3db026,JSON['stringify'](_0x3f1b0b));});}function getUser(_0x4dc64a,_0x58c1d7,_0x2c7a8d){if(intUtil[_0x834e('0x2b')](_0x58c1d7)){logger[_0x834e('0x19')]('Getting\x20agent\x20with\x20email',_0x58c1d7);return request({'method':_0x834e('0x2c'),'uri':util[_0x834e('0x2d')](_0x834e('0x1f'),_0x4dc64a[_0x834e('0x20')]),'qs':{'operation':_0x834e('0x2e'),'username':_0x4dc64a[_0x834e('0x21')],'sessionName':_0x2c7a8d[_0x834e('0x22')],'query':util[_0x834e('0x2d')](_0x834e('0x2f'),_0x58c1d7)},'json':!![]})['then'](function(_0xef9ec2){if(_0xef9ec2['success']&&_0xef9ec2[_0x834e('0x26')][_0x834e('0xd')]){logger[_0x834e('0x19')](_0x834e('0x30'));return BPromise[_0x834e('0x25')]({'id':_0xef9ec2[_0x834e('0x26')][0x0]['id'],'email':_0xef9ec2[_0x834e('0x26')][0x0][_0x834e('0x31')],'name':_0xef9ec2[_0x834e('0x26')][0x0][_0x834e('0x32')]+'\x20'+_0xef9ec2['result'][_0x834e('0x33')]});}else{logger[_0x834e('0x19')](_0x834e('0x34'));return BPromise[_0x834e('0x25')]({'id':_0x2c7a8d['userId'],'email':_0x4dc64a[_0x834e('0x21')],'name':_0x834e('0x35')});}})['catch'](function(_0x496533){var _0x59385a=_0x496533[_0x834e('0x28')]||0x1f4;logger[_0x834e('0x29')](_0x834e('0x2a'),_0x834e('0x36'),_0x59385a,JSON[_0x834e('0x23')](_0x496533));});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x25')]({'id':_0x2c7a8d['userId'],'email':_0x4dc64a[_0x834e('0x21')],'name':_0x834e('0x35')})['catch'](function(_0x18ac3b){var _0x2f56c7=_0x18ac3b['statusCode']||0x1f4;logger['error'](_0x834e('0x2a'),_0x834e('0x36'),_0x2f56c7,JSON[_0x834e('0x23')](_0x18ac3b));});}}function getEndUser(_0x130c23,_0x3c49bd,_0x4ca43c,_0x1c5ed6){logger['info']('Searching\x20end\x20user\x20with\x20phone',_0x4ca43c);return request({'method':_0x834e('0x2c'),'uri':util['format'](_0x834e('0x1f'),_0x130c23[_0x834e('0x20')]),'qs':{'operation':_0x834e('0x2e'),'username':_0x130c23[_0x834e('0x21')],'sessionName':_0x1c5ed6[_0x834e('0x22')],'query':util['format'](_0x834e('0x37'),_0x4ca43c,_0x4ca43c,_0x4ca43c,_0x4ca43c,_0x4ca43c)},'json':!![]})[_0x834e('0x24')](function(_0x38f266){if(_0x38f266['success']&&_0x38f266[_0x834e('0x26')][_0x834e('0xd')]){logger['info'](_0x834e('0x38'));return BPromise['resolve']({'id':_0x38f266[_0x834e('0x26')][0x0]['id'],'name':_0x38f266[_0x834e('0x26')][0x0]['firstname']+'\x20'+_0x38f266['result'][0x0][_0x834e('0x39')],'phone':_0x4ca43c});}else{logger[_0x834e('0x19')](_0x834e('0x3a'));return request({'method':_0x834e('0x3b'),'uri':util[_0x834e('0x2d')](_0x834e('0x1f'),_0x130c23[_0x834e('0x20')]),'form':{'operation':'create','sessionName':_0x1c5ed6[_0x834e('0x22')],'elementType':'Contacts','element':JSON[_0x834e('0x23')]({'lastname':_0x3c49bd,'phone':_0x4ca43c,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x1df5b0){logger['info'](_0x834e('0x3c'));return BPromise[_0x834e('0x25')]({'id':_0x1df5b0['result']['id'],'name':_0x1df5b0[_0x834e('0x26')][_0x834e('0x39')],'phone':_0x1df5b0[_0x834e('0x26')][_0x834e('0x3d')]});})[_0x834e('0x27')](function(_0x1a7149){var _0xfa28da=_0x1a7149[_0x834e('0x28')]||0x1f4;logger[_0x834e('0x29')](_0x834e('0x2a'),'getEndUser',_0xfa28da,JSON[_0x834e('0x23')](_0x1a7149));});}});}function getConnection(_0x6fff27){var _0x47a8a9=_0x6fff27[_0x834e('0x21')];var _0x42fd90=_0x6fff27[_0x834e('0x3e')];return request({'method':_0x834e('0x2c'),'uri':util[_0x834e('0x2d')](_0x834e('0x1f'),_0x6fff27['remoteUri']),'qs':{'operation':'getchallenge','username':_0x47a8a9},'json':!![]})[_0x834e('0x24')](function(_0x1a5444){if(_0x1a5444[_0x834e('0x3f')]){return request({'method':_0x834e('0x3b'),'uri':util[_0x834e('0x2d')](_0x834e('0x1f'),_0x6fff27[_0x834e('0x20')]),'form':{'operation':_0x834e('0x40'),'username':_0x47a8a9,'accessKey':md5(_0x1a5444[_0x834e('0x26')][_0x834e('0x41')]+_0x42fd90)},'json':!![]});}})[_0x834e('0x24')](function(_0x385435){if(_0x385435[_0x834e('0x3f')]){return BPromise[_0x834e('0x25')](_0x385435[_0x834e('0x26')]);}else{throw new Error(util[_0x834e('0x2d')](_0x834e('0x42'),_0x6fff27['id']));}})[_0x834e('0x27')](function(_0x420841){var _0x1adf86=_0x420841['statusCode']||0x1f4;logger[_0x834e('0x29')](_0x834e('0x2a'),'getConnection',_0x1adf86,JSON[_0x834e('0x23')](_0x420841));});}function request(_0x3b0988){logger['info'](_0x834e('0x43'),JSON[_0x834e('0x23')](_0x3b0988));return rp(_0x3b0988);}exports[_0x834e('0x44')]=function(_0x35636e,_0x4288e4,_0xb77aab,_0x4549ba,_0x4a8b32,_0x1ad7fe){var _0x8bc6c6,_0x3e0550,_0x363675,_0x86ad2b;_0x1ad7fe[_0x834e('0x20')]=intUtil[_0x834e('0x45')](_0x1ad7fe[_0x834e('0x20')]);if(_0x4a8b32&&_0x4a8b32['monitor_format']){logger[_0x834e('0x19')]('[QUEUE]',_0x834e('0x46'));_0x4288e4['recordingURL']=util[_0x834e('0x2d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1ad7fe['serverUrl'],_0x4288e4[_0x834e('0x47')],md5(_0x4288e4[_0x834e('0x47')]));}else{_0x4288e4['recordingURL']='';}return getConnection(_0x1ad7fe)['then'](function(_0x2c8155){_0x86ad2b=_0x2c8155;return getUser(_0x1ad7fe,_0x4549ba[_0x834e('0x48')],_0x86ad2b);})[_0x834e('0x24')](function(_0x387365){_0x8bc6c6=_0x387365;logger[_0x834e('0x19')](_0x834e('0x49'),_0x8bc6c6['id']);return getEndUser(_0x1ad7fe,_0x4288e4[_0x834e('0x4a')],_0x4288e4[_0x834e('0x4b')],_0x86ad2b);})['then'](function(_0x142334){_0x3e0550=_0x142334;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x3e0550['id']);return createTicket(_0x1ad7fe,_0x8bc6c6,_0x3e0550,_0xb77aab,_0x4288e4,_0xb77aab[_0x834e('0x4c')],_0x86ad2b);})['then'](function(_0x3e58ef){_0x363675=_0x3e58ef;logger[_0x834e('0x19')]('Ticket\x20created!');logger[_0x834e('0x19')](_0x834e('0x4d'),_0x363675['id']);var _0x2de29a=util[_0x834e('0x2d')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x1ad7fe[_0x834e('0x20')],_[_0x834e('0x4e')](_0x363675['id'],'x')[0x1]);logger[_0x834e('0x19')]('[QUEUE]',_0x834e('0x4f'));emit(util[_0x834e('0x2d')](_0x834e('0x50'),_0x4549ba[_0x834e('0x18')]),_0x834e('0x51'),{'uri':_0x2de29a});})[_0x834e('0x27')](function(_0x3a1426){logger[_0x834e('0x29')](_0x834e('0x52'),JSON[_0x834e('0x23')](_0x3a1426));});};exports[_0x834e('0x53')]=function(_0x1dfa95,_0x1b7045,_0x1659c8,_0x460a7a,_0x17b8e3,_0x297cce,_0x14ed83){var _0x193a15,_0x3e3467,_0xed4081,_0x2cb233;_0x297cce['remoteUri']=intUtil[_0x834e('0x45')](_0x297cce[_0x834e('0x20')]);_0x297cce[_0x834e('0x54')]=intUtil[_0x834e('0x45')](_0x297cce['serverUrl']);if(_0x14ed83&&_0x14ed83[_0x834e('0x55')]&&_0x14ed83['recordingFormat']!=='none'){logger[_0x834e('0x19')](_0x834e('0x56'),_0x834e('0x46'));_0x1b7045[_0x834e('0x57')]=util[_0x834e('0x2d')](_0x834e('0x58'),_0x297cce[_0x834e('0x54')],_0x1b7045[_0x834e('0x47')],md5(_0x1b7045['uniqueid']));}return getConnection(_0x297cce)[_0x834e('0x24')](function(_0x5a99e6){_0x2cb233=_0x5a99e6;return getUser(_0x297cce,_0x460a7a[_0x834e('0x48')],_0x2cb233);})[_0x834e('0x24')](function(_0x514fe5){_0x193a15=_0x514fe5;logger['info'](_0x834e('0x49'),_0x193a15['id']);return getEndUser(_0x297cce,_0x1b7045[_0x834e('0x59')],_0x1b7045[_0x834e('0x5a')],_0x2cb233);})[_0x834e('0x24')](function(_0x2c41bd){_0x3e3467=_0x2c41bd;logger['info'](_0x834e('0x5b'),_0x3e3467['id']);return createTicket(_0x297cce,_0x193a15,_0x3e3467,_0x1659c8,_0x1b7045,_0x1659c8[_0x834e('0x4c')],_0x2cb233);})[_0x834e('0x24')](function(_0x228a60){_0xed4081=_0x228a60;logger[_0x834e('0x19')](_0x834e('0x5c'));logger[_0x834e('0x19')](_0x834e('0x4d'),_0xed4081['id']);var _0x376f72=util[_0x834e('0x2d')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x297cce[_0x834e('0x20')],_[_0x834e('0x4e')](_0xed4081['id'],'x')[0x1]);logger[_0x834e('0x19')](_0x834e('0x56'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x834e('0x2d')]('user:%s',_0x460a7a['name']),'trigger:browser:url',{'uri':_0x376f72});})[_0x834e('0x27')](function(_0x332d8f){logger['error'](_0x834e('0x56'),JSON[_0x834e('0x23')](_0x332d8f));});};exports['abandoned']=function(_0x353246,_0x18ccb2,_0x4b88e7,_0x5df169,_0x346be5,_0x2a42a3){var _0x8bc7d9,_0x44c909,_0x1d8e7,_0x493239;_0x2a42a3[_0x834e('0x20')]=intUtil['stripTrailingSlash'](_0x2a42a3[_0x834e('0x20')]);_0x2a42a3[_0x834e('0x54')]=intUtil[_0x834e('0x45')](_0x2a42a3['serverUrl']);if(_0x346be5&&_0x346be5[_0x834e('0x5d')]){logger[_0x834e('0x19')]('[ABANDONED]',_0x834e('0x46'));_0x18ccb2[_0x834e('0x57')]=util[_0x834e('0x2d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2a42a3[_0x834e('0x54')],_0x18ccb2[_0x834e('0x47')],md5(_0x18ccb2[_0x834e('0x47')]));}else{_0x18ccb2[_0x834e('0x57')]='';}return getConnection(_0x2a42a3)[_0x834e('0x24')](function(_0x29bfd7){_0x493239=_0x29bfd7;return getUser(_0x2a42a3,'',_0x493239);})[_0x834e('0x24')](function(_0x23b5d9){_0x8bc7d9=_0x23b5d9;logger[_0x834e('0x19')](_0x834e('0x49'),_0x8bc7d9['id']);return getEndUser(_0x2a42a3,_0x18ccb2['calleridname'],_0x18ccb2['calleridnum'],_0x493239);})['then'](function(_0x36ede9){_0x44c909=_0x36ede9;logger[_0x834e('0x19')](_0x834e('0x5b'),_0x44c909['id']);return createTicket(_0x2a42a3,_0x8bc7d9,_0x44c909,_0x4b88e7,_0x18ccb2,_0x4b88e7[_0x834e('0x4c')],_0x493239);})[_0x834e('0x24')](function(_0x5758fb){_0x1d8e7=_0x5758fb;logger['info'](_0x834e('0x5c'));logger[_0x834e('0x19')](_0x834e('0x4d'),_0x1d8e7['id']);})[_0x834e('0x27')](function(_0x40a705){logger['error'](_0x834e('0x5e'),JSON[_0x834e('0x23')](_0x40a705));});}; \ 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 072e7e9..cc728b5 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 _0x81bd=['Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','abandoned','[ABANDONED]','[ABANDONED]\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','zendesk','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','Tags','getString','Subjects','Descriptions','Fields','then','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','%s/users/me.json','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','filter','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','end-user','Enduser\x20created.','authType','username','password','token','%s/token:%s','Basic\x20%s','toString','base64','stringify','GET','map','forEach','type','nameField','customField','toLowerCase','content','idField','custom_fields','variable','variableName','push','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','error'];(function(_0x1e5f05,_0x593a33){var _0x404385=function(_0x465da3){while(--_0x465da3){_0x1e5f05['push'](_0x1e5f05['shift']());}};_0x404385(++_0x593a33);}(_0x81bd,0x7c));var _0xd81b=function(_0x360739,_0x2ec1b2){_0x360739=_0x360739-0x0;var _0x3e23a1=_0x81bd[_0x360739];return _0x3e23a1;};'use strict';var _=require(_0xd81b('0x0'));var rp=require(_0xd81b('0x1'));var md5=require(_0xd81b('0x2'));var util=require(_0xd81b('0x3'));var Redis=require(_0xd81b('0x4'));var intUtil=require(_0xd81b('0x5'));var config=require(_0xd81b('0x6'));var logger=require('../../../../config/logger')(_0xd81b('0x7'));config[_0xd81b('0x8')]=_[_0xd81b('0x9')](config['redis'],{'host':_0xd81b('0xa'),'port':0x18eb});var io=require(_0xd81b('0xb'))(new Redis(config[_0xd81b('0x8')]));function emit(_0x562084,_0x5e14e8,_0xa4cf97){io['to'](_0x562084)['emit'](_0x5e14e8,_0xa4cf97);}var headers={'Content-Type':_0xd81b('0xc'),'Accept':_0xd81b('0xc')};function getTicket(_0x3420a7,_0x86dab6,_0x17fba4,_0x1ff60f,_0x4391be){logger[_0xd81b('0xd')](_0xd81b('0xe'));return request({'uri':util[_0xd81b('0xf')](_0xd81b('0x10'),_0x3420a7[_0xd81b('0x11')]),'method':_0xd81b('0x12'),'body':{'ticket':_['merge']({'requester_id':_0x17fba4['id'],'submitter_id':_0x86dab6?_0x86dab6['id']:undefined,'assignee_id':_0x86dab6?_0x86dab6['id']:undefined,'tags':getTags(_0x1ff60f[_0xd81b('0x13')],'name'),'subject':intUtil[_0xd81b('0x14')](_0x1ff60f[_0xd81b('0x15')],_0x4391be,'\x20'),'description':intUtil['getString'](_0x1ff60f[_0xd81b('0x16')],_0x4391be,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x1ff60f[_0xd81b('0x16')],_0x4391be,'\x0a')}},getCustomFields(_0x1ff60f[_0xd81b('0x17')],_0x4391be))}})[_0xd81b('0x18')](function(_0x35cfc1){logger[_0xd81b('0xd')]('Ticket\x20created!');return _0x35cfc1[_0xd81b('0x19')];});}function getUser(_0x27b7a0,_0x5c2863){if(intUtil[_0xd81b('0x1a')](_0x5c2863)){logger[_0xd81b('0xd')](_0xd81b('0x1b'),_0x5c2863);return request({'uri':util[_0xd81b('0xf')](_0xd81b('0x1c'),_0x27b7a0[_0xd81b('0x11')]),'qs':{'query':util[_0xd81b('0xf')](_0xd81b('0x1d'),_0x5c2863)}})[_0xd81b('0x18')](function(_0x285164){if(_0x285164[_0xd81b('0x1e')]){logger[_0xd81b('0xd')](_0xd81b('0x1f'));return _[_0xd81b('0x20')](_0x285164[_0xd81b('0x21')],{'email':_0x5c2863,'role':_0xd81b('0x22')});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xd81b('0xf')](_0xd81b('0x23'),_0x27b7a0[_0xd81b('0x11')])})['then'](function(_0x19ed0e){logger[_0xd81b('0xd')]('Admin\x20account\x20selected.');return _0x19ed0e[_0xd81b('0x24')];});}});}else{logger[_0xd81b('0xd')](_0xd81b('0x25'));return request({'uri':util[_0xd81b('0xf')](_0xd81b('0x23'),_0x27b7a0[_0xd81b('0x11')])})[_0xd81b('0x18')](function(_0x5ecba9){logger[_0xd81b('0xd')](_0xd81b('0x26'));return _0x5ecba9[_0xd81b('0x24')];});}}function getEndUser(_0x1bf351,_0x596389,_0x28768f){logger[_0xd81b('0xd')](_0xd81b('0x27'),_0x28768f);return request({'uri':util[_0xd81b('0xf')](_0xd81b('0x1c'),_0x1bf351[_0xd81b('0x11')]),'qs':{'query':util[_0xd81b('0xf')](_0xd81b('0x28'),_0x28768f)}})[_0xd81b('0x18')](function(_0x483a3d){var _0x469cc4;if(_0x483a3d['results']['length']){_0x483a3d[_0xd81b('0x21')]=_[_0xd81b('0x29')](_0x483a3d['results'],{'suspended':![],'role':'end-user'});if(_0x483a3d[_0xd81b('0x21')][_0xd81b('0x2a')]){_0x469cc4=_[_0xd81b('0x2b')](_0x483a3d[_0xd81b('0x21')]);}}if(_0x469cc4){logger[_0xd81b('0xd')](_0xd81b('0x2c'));return _0x469cc4;}else{logger['info'](_0xd81b('0x2d'));return request({'uri':util[_0xd81b('0xf')]('%s/users.json',_0x1bf351['remoteUri']),'method':_0xd81b('0x12'),'body':{'user':{'role':_0xd81b('0x2e'),'name':util['format']('Caller\x20-\x20%s',_0x596389||_0x28768f),'phone':_0x28768f}}})['then'](function(_0x322991){logger[_0xd81b('0xd')](_0xd81b('0x2f'));return _0x322991[_0xd81b('0x24')];});}});}function getAuth(_0xa56339){var _0x12ee8f;if(_0xa56339[_0xd81b('0x30')]==='password'){_0x12ee8f=util[_0xd81b('0xf')]('%s:%s',_0xa56339[_0xd81b('0x31')],_0xa56339[_0xd81b('0x32')]);}else if(_0xa56339[_0xd81b('0x30')]===_0xd81b('0x33')){_0x12ee8f=util[_0xd81b('0xf')](_0xd81b('0x34'),_0xa56339[_0xd81b('0x31')],_0xa56339[_0xd81b('0x33')]);}return util[_0xd81b('0xf')](_0xd81b('0x35'),new Buffer(_0x12ee8f)[_0xd81b('0x36')](_0xd81b('0x37')));}function request(_0x346038){logger['debug']('[HTTP]',JSON[_0xd81b('0x38')](_0x346038));return rp(_[_0xd81b('0x9')](_0x346038,{'method':_0xd81b('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x59c066,_0x362ebc){var _0x37ba34=[];if(_0x59c066&&_0x59c066['length']>0x0){_0x37ba34=_[_0xd81b('0x3a')](_0x59c066,_0x362ebc);}return _0x37ba34;}function getCustomFields(_0xaa9e97,_0x512e39){var _0xed5272=[];var _0x5a48e8={'custom_fields':[]};if(_0xaa9e97[_0xd81b('0x2a')]>0x0){_[_0xd81b('0x3b')](_0xaa9e97,function(_0x203365){if(_0x203365[_0xd81b('0x3c')]==='string'&&_0x203365[_0xd81b('0x3d')]&&!_0x203365[_0xd81b('0x3e')]){_0x5a48e8[_0x203365[_0xd81b('0x3d')][_0xd81b('0x3f')]()]=_0x203365[_0xd81b('0x40')][_0xd81b('0x36')]();}else if(_0x203365[_0xd81b('0x3c')]==='string'&&_0x203365[_0xd81b('0x41')]&&_0x203365[_0xd81b('0x3e')]){_0x5a48e8[_0xd81b('0x42')]['push']({'id':_0x203365[_0xd81b('0x41')],'value':_0x203365[_0xd81b('0x40')][_0xd81b('0x36')]()});}else if(_0x203365[_0xd81b('0x3c')]===_0xd81b('0x43')&&_0x203365['variableName']&&_0x203365[_0xd81b('0x41')]&&_0x203365[_0xd81b('0x3e')]){_0x512e39[_0x203365[_0xd81b('0x44')]]&&_0x5a48e8[_0xd81b('0x42')][_0xd81b('0x45')]({'id':_0x203365[_0xd81b('0x41')],'value':_0x512e39[_0x203365[_0xd81b('0x44')]][_0xd81b('0x36')]()});}else if(_0x203365[_0xd81b('0x3c')]===_0xd81b('0x46')&&_0x203365[_0xd81b('0x47')]&&_0x203365['Variable'][_0xd81b('0x48')]&&_0x203365[_0xd81b('0x41')]&&_0x203365[_0xd81b('0x3e')]){_0x512e39[_0x203365[_0xd81b('0x47')][_0xd81b('0x48')][_0xd81b('0x3f')]()]&&_0x5a48e8[_0xd81b('0x42')][_0xd81b('0x45')]({'id':_0x203365['idField'],'value':_0x512e39[_0x203365['Variable'][_0xd81b('0x48')][_0xd81b('0x3f')]()][_0xd81b('0x36')]()});}});}return _0x5a48e8;}exports[_0xd81b('0x49')]=function(_0x1f5d84,_0x37031b,_0x334bd0,_0x2e44f3,_0x2fa588,_0xcfbbc2){var _0x41e2e6,_0x38e436;_0xcfbbc2['remoteUri']=intUtil[_0xd81b('0x4a')](_0xcfbbc2[_0xd81b('0x11')]);_0xcfbbc2[_0xd81b('0x4b')]=intUtil[_0xd81b('0x4a')](_0xcfbbc2[_0xd81b('0x4b')]);if(_0x2fa588&&_0x2fa588[_0xd81b('0x4c')]){logger[_0xd81b('0xd')](_0xd81b('0x4d'),_0xd81b('0x4e'));_0x37031b['recordingURL']=util[_0xd81b('0xf')](_0xd81b('0x4f'),_0xcfbbc2[_0xd81b('0x4b')],_0x37031b[_0xd81b('0x50')],md5(_0x37031b['uniqueid']));}else{_0x37031b[_0xd81b('0x51')]='';}headers[_0xd81b('0x52')]=getAuth(_0xcfbbc2);return getUser(_0xcfbbc2,_0x2e44f3[_0xd81b('0x53')])[_0xd81b('0x18')](function(_0x2699e6){_0x41e2e6=_0x2699e6;logger[_0xd81b('0xd')](_0xd81b('0x54'),_0x41e2e6['id']);return getEndUser(_0xcfbbc2,_0x37031b[_0xd81b('0x55')],_0x37031b[_0xd81b('0x56')]);})['then'](function(_0x534d10){_0x38e436=_0x534d10;logger[_0xd81b('0xd')](_0xd81b('0x57'),_0x38e436['id']);return getTicket(_0xcfbbc2,_0x41e2e6,_0x38e436,_0x334bd0,_0x37031b);})[_0xd81b('0x18')](function(_0x4da281){if(_0x4da281){logger[_0xd81b('0xd')](_0xd81b('0x58'),_0x4da281['id']);switch(_0xcfbbc2[_0xd81b('0x3c')]){case _0xd81b('0x59'):logger['info'](_0xd81b('0x4d'),_0xd81b('0x5a'));return request({'uri':util[_0xd81b('0xf')](_0xd81b('0x5b'),_0xcfbbc2[_0xd81b('0x11')],_0x41e2e6['id'],_0x4da281['id']),'method':'POST'});case _0xd81b('0x5c'):logger[_0xd81b('0xd')]('[QUEUE]',_0xd81b('0x5d'));emit(util[_0xd81b('0xf')](_0xd81b('0x5e'),_0x2e44f3[_0xd81b('0x48')]),_0xd81b('0x5f'),{'uri':util[_0xd81b('0xf')](_0xd81b('0x60'),_0xcfbbc2[_0xd81b('0x11')],_0x4da281['id'])});break;default:logger[_0xd81b('0x61')](_0xd81b('0x4d'),_0xd81b('0x62'));}}})['catch'](function(_0x285e82){logger['error'](_0xd81b('0x63'),util[_0xd81b('0x64')](_0x285e82,{'showHidden':!![],'depth':null}));});};exports[_0xd81b('0x65')]=function(_0x3c2a9f,_0x34d2a2,_0x1e9f73,_0x5c196a,_0x2d978d,_0xe0c9c6,_0x51f5a1){var _0x492f5f,_0x470d40;_0xe0c9c6['remoteUri']=intUtil[_0xd81b('0x4a')](_0xe0c9c6['remoteUri']);_0xe0c9c6[_0xd81b('0x4b')]=intUtil[_0xd81b('0x4a')](_0xe0c9c6[_0xd81b('0x4b')]);if(_0x51f5a1&&_0x51f5a1['recordingFormat']&&_0x51f5a1[_0xd81b('0x66')]!==_0xd81b('0x67')){logger['info'](_0xd81b('0x68'),_0xd81b('0x4e'));_0x34d2a2['recordingURL']=util[_0xd81b('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xe0c9c6[_0xd81b('0x4b')],_0x34d2a2[_0xd81b('0x50')],md5(_0x34d2a2[_0xd81b('0x50')]));}headers[_0xd81b('0x52')]=getAuth(_0xe0c9c6);return getUser(_0xe0c9c6,_0x5c196a[_0xd81b('0x53')])[_0xd81b('0x18')](function(_0x2f2afe){_0x492f5f=_0x2f2afe;logger[_0xd81b('0xd')](_0xd81b('0x54'),_0x492f5f['id']);return getEndUser(_0xe0c9c6,_0x34d2a2[_0xd81b('0x69')],_0x34d2a2['destcalleridnum']);})[_0xd81b('0x18')](function(_0x434434){_0x470d40=_0x434434;logger[_0xd81b('0xd')](_0xd81b('0x57'),_0x470d40['id']);return getTicket(_0xe0c9c6,_0x492f5f,_0x470d40,_0x1e9f73,_0x34d2a2);})[_0xd81b('0x18')](function(_0x15416a){if(_0x15416a){logger[_0xd81b('0xd')]('The\x20Ticket\x20ID\x20is:',_0x15416a['id']);switch(_0xe0c9c6['type']){case'integrationTab':logger[_0xd81b('0xd')](_0xd81b('0x68'),_0xd81b('0x5a'));return request({'uri':util[_0xd81b('0xf')](_0xd81b('0x5b'),_0xe0c9c6[_0xd81b('0x11')],_0x492f5f['id'],_0x15416a['id']),'method':_0xd81b('0x12')});case'newTab':logger[_0xd81b('0xd')](_0xd81b('0x68'),_0xd81b('0x5d'));emit(util[_0xd81b('0xf')](_0xd81b('0x5e'),_0x5c196a[_0xd81b('0x48')]),_0xd81b('0x5f'),{'uri':util['format'](_0xd81b('0x60'),_0xe0c9c6[_0xd81b('0x11')],_0x15416a['id'])});break;default:logger[_0xd81b('0x61')](_0xd81b('0x68'),_0xd81b('0x62'));}}})[_0xd81b('0x6a')](function(_0x1be43d){logger[_0xd81b('0x61')](_0xd81b('0x6b'),util[_0xd81b('0x64')](_0x1be43d,{'showHidden':!![],'depth':null}));});};exports[_0xd81b('0x6c')]=function(_0x43d40d,_0x5ea906,_0xc45841,_0x5358a6,_0x2e7141,_0x6fa974){var _0x414f40,_0xc3c117;_0x6fa974[_0xd81b('0x11')]=intUtil[_0xd81b('0x4a')](_0x6fa974[_0xd81b('0x11')]);_0x6fa974[_0xd81b('0x4b')]=intUtil[_0xd81b('0x4a')](_0x6fa974[_0xd81b('0x4b')]);if(_0x2e7141&&_0x2e7141['monitor_format']){logger[_0xd81b('0xd')](_0xd81b('0x6d'),_0xd81b('0x4e'));_0x5ea906[_0xd81b('0x51')]=util[_0xd81b('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x6fa974['serverUrl'],_0x5ea906[_0xd81b('0x50')],md5(_0x5ea906[_0xd81b('0x50')]));}else{_0x5ea906[_0xd81b('0x51')]='';}headers[_0xd81b('0x52')]=getAuth(_0x6fa974);return getUser(_0x6fa974)[_0xd81b('0x18')](function(_0x1a95d5){_0x414f40=_0x1a95d5;logger[_0xd81b('0xd')]('The\x20User\x20ID\x20is:',_0x414f40['id']);return getEndUser(_0x6fa974,_0x5ea906[_0xd81b('0x55')],_0x5ea906[_0xd81b('0x56')]);})[_0xd81b('0x18')](function(_0x1c6ec8){_0xc3c117=_0x1c6ec8;logger[_0xd81b('0xd')](_0xd81b('0x57'),_0xc3c117['id']);return getTicket(_0x6fa974,_0x414f40,_0xc3c117,_0xc45841,_0x5ea906);})[_0xd81b('0x18')](function(_0x185f28){if(_0x185f28){logger[_0xd81b('0xd')]('The\x20Ticket\x20ID\x20is:',_0x185f28['id']);}})[_0xd81b('0x6a')](function(_0x34d6dc){logger[_0xd81b('0x61')](_0xd81b('0x6e'),util[_0xd81b('0x64')](_0x34d6dc,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xd5ec=['agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Enduser\x20created.','authType','password','%s:%s','token','%s/token:%s','username','Basic\x20%s','toString','base64','[HTTP]','stringify','GET','map','forEach','type','string','nameField','customField','toLowerCase','content','idField','custom_fields','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','trigger:browser:url','%s/agent/tickets/%s','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','error','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','abandoned','[ABANDONED]','[ABANDONED]\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','POST','Tags','name','getString','Descriptions','Fields','then','info','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','format','%s/search.json','type:user\x20role:agent\x20email:%s','Agent\x20found!','results'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd5ec,0xb8));var _0xcd5e=function(_0x383356,_0x33d2f5){_0x383356=_0x383356-0x0;var _0x32ee5a=_0xd5ec[_0x383356];return _0x32ee5a;};'use strict';var _=require(_0xcd5e('0x0'));var rp=require(_0xcd5e('0x1'));var md5=require(_0xcd5e('0x2'));var util=require(_0xcd5e('0x3'));var Redis=require('ioredis');var intUtil=require(_0xcd5e('0x4'));var config=require(_0xcd5e('0x5'));var logger=require(_0xcd5e('0x6'))(_0xcd5e('0x7'));config[_0xcd5e('0x8')]=_[_0xcd5e('0x9')](config[_0xcd5e('0x8')],{'host':_0xcd5e('0xa'),'port':0x18eb});var io=require(_0xcd5e('0xb'))(new Redis(config[_0xcd5e('0x8')]));function emit(_0x111456,_0x4e90b7,_0x52ce05){io['to'](_0x111456)[_0xcd5e('0xc')](_0x4e90b7,_0x52ce05);}var headers={'Content-Type':_0xcd5e('0xd'),'Accept':_0xcd5e('0xd')};function getTicket(_0x4da8e3,_0x19d97f,_0x20ca0a,_0x281e7e,_0x3c04fc){logger['info'](_0xcd5e('0xe'));return request({'uri':util['format'](_0xcd5e('0xf'),_0x4da8e3[_0xcd5e('0x10')]),'method':_0xcd5e('0x11'),'body':{'ticket':_['merge']({'requester_id':_0x20ca0a['id'],'submitter_id':_0x19d97f?_0x19d97f['id']:undefined,'assignee_id':_0x19d97f?_0x19d97f['id']:undefined,'tags':getTags(_0x281e7e[_0xcd5e('0x12')],_0xcd5e('0x13')),'subject':intUtil[_0xcd5e('0x14')](_0x281e7e['Subjects'],_0x3c04fc,'\x20'),'description':intUtil[_0xcd5e('0x14')](_0x281e7e[_0xcd5e('0x15')],_0x3c04fc,'\x0a'),'comment':{'public':![],'body':intUtil[_0xcd5e('0x14')](_0x281e7e[_0xcd5e('0x15')],_0x3c04fc,'\x0a')}},getCustomFields(_0x281e7e[_0xcd5e('0x16')],_0x3c04fc))}})[_0xcd5e('0x17')](function(_0x5a17c8){logger[_0xcd5e('0x18')](_0xcd5e('0x19'));return _0x5a17c8[_0xcd5e('0x1a')];});}function getUser(_0x4fdb02,_0x493cb5){if(intUtil[_0xcd5e('0x1b')](_0x493cb5)){logger['info'](_0xcd5e('0x1c'),_0x493cb5);return request({'uri':util[_0xcd5e('0x1d')](_0xcd5e('0x1e'),_0x4fdb02[_0xcd5e('0x10')]),'qs':{'query':util[_0xcd5e('0x1d')](_0xcd5e('0x1f'),_0x493cb5)}})[_0xcd5e('0x17')](function(_0x315ee){if(_0x315ee['count']){logger[_0xcd5e('0x18')](_0xcd5e('0x20'));return _['find'](_0x315ee[_0xcd5e('0x21')],{'email':_0x493cb5,'role':_0xcd5e('0x22')});}else{logger[_0xcd5e('0x18')](_0xcd5e('0x23'));return request({'uri':util['format'](_0xcd5e('0x24'),_0x4fdb02[_0xcd5e('0x10')])})[_0xcd5e('0x17')](function(_0x49305e){logger['info'](_0xcd5e('0x25'));return _0x49305e[_0xcd5e('0x26')];});}});}else{logger[_0xcd5e('0x18')](_0xcd5e('0x23'));return request({'uri':util[_0xcd5e('0x1d')](_0xcd5e('0x24'),_0x4fdb02[_0xcd5e('0x10')])})['then'](function(_0x3a05f9){logger[_0xcd5e('0x18')](_0xcd5e('0x25'));return _0x3a05f9[_0xcd5e('0x26')];});}}function getEndUser(_0x57e339,_0x3053cf,_0x3706ed){logger[_0xcd5e('0x18')]('Searching\x20enduser\x20with\x20phone',_0x3706ed);return request({'uri':util[_0xcd5e('0x1d')](_0xcd5e('0x1e'),_0x57e339[_0xcd5e('0x10')]),'qs':{'query':util[_0xcd5e('0x1d')](_0xcd5e('0x27'),_0x3706ed)}})[_0xcd5e('0x17')](function(_0x572527){var _0x5a4539;if(_0x572527[_0xcd5e('0x21')][_0xcd5e('0x28')]){_0x572527[_0xcd5e('0x21')]=_[_0xcd5e('0x29')](_0x572527[_0xcd5e('0x21')],{'suspended':![],'role':_0xcd5e('0x2a')});if(_0x572527[_0xcd5e('0x21')][_0xcd5e('0x28')]){_0x5a4539=_[_0xcd5e('0x2b')](_0x572527['results']);}}if(_0x5a4539){logger['info']('Enduser\x20found!');return _0x5a4539;}else{logger[_0xcd5e('0x18')](_0xcd5e('0x2c'));return request({'uri':util['format'](_0xcd5e('0x2d'),_0x57e339['remoteUri']),'method':_0xcd5e('0x11'),'body':{'user':{'role':_0xcd5e('0x2a'),'name':util[_0xcd5e('0x1d')]('Caller\x20-\x20%s',_0x3053cf||_0x3706ed),'phone':_0x3706ed}}})[_0xcd5e('0x17')](function(_0x3c2d2b){logger[_0xcd5e('0x18')](_0xcd5e('0x2e'));return _0x3c2d2b[_0xcd5e('0x26')];});}});}function getAuth(_0x49f356){var _0x1538bf;if(_0x49f356[_0xcd5e('0x2f')]===_0xcd5e('0x30')){_0x1538bf=util[_0xcd5e('0x1d')](_0xcd5e('0x31'),_0x49f356['username'],_0x49f356[_0xcd5e('0x30')]);}else if(_0x49f356[_0xcd5e('0x2f')]===_0xcd5e('0x32')){_0x1538bf=util[_0xcd5e('0x1d')](_0xcd5e('0x33'),_0x49f356[_0xcd5e('0x34')],_0x49f356[_0xcd5e('0x32')]);}return util[_0xcd5e('0x1d')](_0xcd5e('0x35'),new Buffer(_0x1538bf)[_0xcd5e('0x36')](_0xcd5e('0x37')));}function request(_0x1af318){logger['debug'](_0xcd5e('0x38'),JSON[_0xcd5e('0x39')](_0x1af318));return rp(_[_0xcd5e('0x9')](_0x1af318,{'method':_0xcd5e('0x3a'),'headers':headers,'json':!![]}));}function getTags(_0x34e3b1,_0x39eea1){var _0xd427c5=[];if(_0x34e3b1&&_0x34e3b1[_0xcd5e('0x28')]>0x0){_0xd427c5=_[_0xcd5e('0x3b')](_0x34e3b1,_0x39eea1);}return _0xd427c5;}function getCustomFields(_0x20e108,_0x2980dd){var _0x3e01cb=[];var _0x1ddb57={'custom_fields':[]};if(_0x20e108[_0xcd5e('0x28')]>0x0){_[_0xcd5e('0x3c')](_0x20e108,function(_0x512266){if(_0x512266[_0xcd5e('0x3d')]===_0xcd5e('0x3e')&&_0x512266[_0xcd5e('0x3f')]&&!_0x512266[_0xcd5e('0x40')]){_0x1ddb57[_0x512266[_0xcd5e('0x3f')][_0xcd5e('0x41')]()]=_0x512266[_0xcd5e('0x42')][_0xcd5e('0x36')]();}else if(_0x512266[_0xcd5e('0x3d')]===_0xcd5e('0x3e')&&_0x512266[_0xcd5e('0x43')]&&_0x512266[_0xcd5e('0x40')]){_0x1ddb57[_0xcd5e('0x44')][_0xcd5e('0x45')]({'id':_0x512266[_0xcd5e('0x43')],'value':_0x512266['content']['toString']()});}else if(_0x512266[_0xcd5e('0x3d')]===_0xcd5e('0x46')&&_0x512266['variableName']&&_0x512266[_0xcd5e('0x43')]&&_0x512266[_0xcd5e('0x40')]){_0x2980dd[_0x512266['variableName']]&&_0x1ddb57['custom_fields'][_0xcd5e('0x45')]({'id':_0x512266[_0xcd5e('0x43')],'value':_0x2980dd[_0x512266[_0xcd5e('0x47')]][_0xcd5e('0x36')]()});}else if(_0x512266['type']===_0xcd5e('0x48')&&_0x512266[_0xcd5e('0x49')]&&_0x512266[_0xcd5e('0x49')][_0xcd5e('0x13')]&&_0x512266[_0xcd5e('0x43')]&&_0x512266[_0xcd5e('0x40')]){_0x2980dd[_0x512266['Variable'][_0xcd5e('0x13')][_0xcd5e('0x41')]()]&&_0x1ddb57[_0xcd5e('0x44')][_0xcd5e('0x45')]({'id':_0x512266[_0xcd5e('0x43')],'value':_0x2980dd[_0x512266['Variable'][_0xcd5e('0x13')][_0xcd5e('0x41')]()]['toString']()});}});}return _0x1ddb57;}exports[_0xcd5e('0x4a')]=function(_0x37b602,_0x16b417,_0x30e78b,_0x138510,_0xac1c07,_0xca5628){var _0x4968e9,_0x4d8436;_0xca5628[_0xcd5e('0x10')]=intUtil[_0xcd5e('0x4b')](_0xca5628['remoteUri']);_0xca5628[_0xcd5e('0x4c')]=intUtil[_0xcd5e('0x4b')](_0xca5628['serverUrl']);if(_0xac1c07&&_0xac1c07[_0xcd5e('0x4d')]){logger[_0xcd5e('0x18')](_0xcd5e('0x4e'),_0xcd5e('0x4f'));_0x16b417['recordingURL']=util['format'](_0xcd5e('0x50'),_0xca5628[_0xcd5e('0x4c')],_0x16b417[_0xcd5e('0x51')],md5(_0x16b417[_0xcd5e('0x51')]));}else{_0x16b417[_0xcd5e('0x52')]='';}headers[_0xcd5e('0x53')]=getAuth(_0xca5628);return getUser(_0xca5628,_0x138510[_0xcd5e('0x54')])['then'](function(_0x9a250e){_0x4968e9=_0x9a250e;logger[_0xcd5e('0x18')](_0xcd5e('0x55'),_0x4968e9['id']);return getEndUser(_0xca5628,_0x16b417[_0xcd5e('0x56')],_0x16b417[_0xcd5e('0x57')]);})[_0xcd5e('0x17')](function(_0x21816c){_0x4d8436=_0x21816c;logger['info'](_0xcd5e('0x58'),_0x4d8436['id']);return getTicket(_0xca5628,_0x4968e9,_0x4d8436,_0x30e78b,_0x16b417);})[_0xcd5e('0x17')](function(_0x57802f){if(_0x57802f){logger['info'](_0xcd5e('0x59'),_0x57802f['id']);switch(_0xca5628[_0xcd5e('0x3d')]){case _0xcd5e('0x5a'):logger[_0xcd5e('0x18')](_0xcd5e('0x4e'),_0xcd5e('0x5b'));return request({'uri':util[_0xcd5e('0x1d')](_0xcd5e('0x5c'),_0xca5628[_0xcd5e('0x10')],_0x4968e9['id'],_0x57802f['id']),'method':_0xcd5e('0x11')});case'newTab':logger[_0xcd5e('0x18')](_0xcd5e('0x4e'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x138510[_0xcd5e('0x13')]),_0xcd5e('0x5d'),{'uri':util['format'](_0xcd5e('0x5e'),_0xca5628[_0xcd5e('0x10')],_0x57802f['id'])});break;default:logger['error']('[QUEUE]',_0xcd5e('0x5f'));}}})['catch'](function(_0x3a3e58){logger['error'](_0xcd5e('0x60'),util[_0xcd5e('0x61')](_0x3a3e58,{'showHidden':!![],'depth':null}));});};exports[_0xcd5e('0x62')]=function(_0x4e5f0c,_0x3a23d5,_0x5a60d6,_0x7c74bb,_0x54babc,_0x6b946d,_0x3dd5c7){var _0x437f1e,_0x49089d;_0x6b946d[_0xcd5e('0x10')]=intUtil[_0xcd5e('0x4b')](_0x6b946d[_0xcd5e('0x10')]);_0x6b946d[_0xcd5e('0x4c')]=intUtil[_0xcd5e('0x4b')](_0x6b946d[_0xcd5e('0x4c')]);if(_0x3dd5c7&&_0x3dd5c7[_0xcd5e('0x63')]&&_0x3dd5c7[_0xcd5e('0x63')]!==_0xcd5e('0x64')){logger[_0xcd5e('0x18')](_0xcd5e('0x65'),_0xcd5e('0x4f'));_0x3a23d5[_0xcd5e('0x52')]=util[_0xcd5e('0x1d')](_0xcd5e('0x50'),_0x6b946d[_0xcd5e('0x4c')],_0x3a23d5[_0xcd5e('0x51')],md5(_0x3a23d5[_0xcd5e('0x51')]));}headers['Authorization']=getAuth(_0x6b946d);return getUser(_0x6b946d,_0x7c74bb[_0xcd5e('0x54')])['then'](function(_0x2b1cd4){_0x437f1e=_0x2b1cd4;logger[_0xcd5e('0x18')](_0xcd5e('0x55'),_0x437f1e['id']);return getEndUser(_0x6b946d,_0x3a23d5['destcalleridname'],_0x3a23d5['destcalleridnum']);})[_0xcd5e('0x17')](function(_0x28ea2e){_0x49089d=_0x28ea2e;logger[_0xcd5e('0x18')](_0xcd5e('0x58'),_0x49089d['id']);return getTicket(_0x6b946d,_0x437f1e,_0x49089d,_0x5a60d6,_0x3a23d5);})['then'](function(_0x5c1b79){if(_0x5c1b79){logger[_0xcd5e('0x18')](_0xcd5e('0x59'),_0x5c1b79['id']);switch(_0x6b946d[_0xcd5e('0x3d')]){case _0xcd5e('0x5a'):logger['info']('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xcd5e('0x1d')](_0xcd5e('0x5c'),_0x6b946d['remoteUri'],_0x437f1e['id'],_0x5c1b79['id']),'method':'POST'});case _0xcd5e('0x66'):logger[_0xcd5e('0x18')](_0xcd5e('0x65'),_0xcd5e('0x67'));emit(util[_0xcd5e('0x1d')]('user:%s',_0x7c74bb[_0xcd5e('0x13')]),_0xcd5e('0x5d'),{'uri':util[_0xcd5e('0x1d')]('%s/agent/tickets/%s',_0x6b946d[_0xcd5e('0x10')],_0x5c1b79['id'])});break;default:logger[_0xcd5e('0x68')](_0xcd5e('0x65'),_0xcd5e('0x5f'));}}})['catch'](function(_0x29e04e){logger['error'](_0xcd5e('0x69'),util[_0xcd5e('0x61')](_0x29e04e,{'showHidden':!![],'depth':null}));});};exports[_0xcd5e('0x6a')]=function(_0x29c888,_0x460318,_0x278235,_0x4bdbfd,_0x15174b,_0x10dd21){var _0x1e2c19,_0x339bfd;_0x10dd21[_0xcd5e('0x10')]=intUtil['stripTrailingSlash'](_0x10dd21['remoteUri']);_0x10dd21[_0xcd5e('0x4c')]=intUtil[_0xcd5e('0x4b')](_0x10dd21[_0xcd5e('0x4c')]);if(_0x15174b&&_0x15174b[_0xcd5e('0x4d')]){logger[_0xcd5e('0x18')](_0xcd5e('0x6b'),'Recording\x20is\x20enabled!');_0x460318[_0xcd5e('0x52')]=util[_0xcd5e('0x1d')](_0xcd5e('0x50'),_0x10dd21[_0xcd5e('0x4c')],_0x460318['uniqueid'],md5(_0x460318[_0xcd5e('0x51')]));}else{_0x460318[_0xcd5e('0x52')]='';}headers[_0xcd5e('0x53')]=getAuth(_0x10dd21);return getUser(_0x10dd21)['then'](function(_0x3f4097){_0x1e2c19=_0x3f4097;logger[_0xcd5e('0x18')](_0xcd5e('0x55'),_0x1e2c19['id']);return getEndUser(_0x10dd21,_0x460318['calleridname'],_0x460318[_0xcd5e('0x57')]);})['then'](function(_0x5e08ba){_0x339bfd=_0x5e08ba;logger[_0xcd5e('0x18')](_0xcd5e('0x58'),_0x339bfd['id']);return getTicket(_0x10dd21,_0x1e2c19,_0x339bfd,_0x278235,_0x460318);})[_0xcd5e('0x17')](function(_0x1810d0){if(_0x1810d0){logger[_0xcd5e('0x18')](_0xcd5e('0x59'),_0x1810d0['id']);}})['catch'](function(_0x18ecf4){logger['error'](_0xcd5e('0x6c'),util[_0xcd5e('0x61')](_0x18ecf4,{'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 70ff800..830e2a1 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 _0x836d=['host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','destcalleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','lodash','request-promise','md5','util','moment','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','debug','length','forEach','type','string','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','split','isNil','expires_in','access_token','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','refresh_token','then','add','seconds','catch','stack','info','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','email','Agent\x20found!','Using\x20the\x20admin\x20account!','findIndex','profile','Administrator','user','error','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','POST','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name','code','details','enduserType','moduleCreate','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','nothing','contact','lead','Creating\x20new\x20call...','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','Last_Name','What_Id','First_Name','$se_module','talktime','Call_Duration','utc','format','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','diff','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','outbound','starttime','Inbound','merge','Fields','/crm/v2/Calls','SUCCESS','Call\x20created!','err','queue'];(function(_0x1a07aa,_0x2edf38){var _0x22872c=function(_0x2fd13a){while(--_0x2fd13a){_0x1a07aa['push'](_0x1a07aa['shift']());}};_0x22872c(++_0x2edf38);}(_0x836d,0x147));var _0xd836=function(_0x313a2c,_0x43ecc7){_0x313a2c=_0x313a2c-0x0;var _0x3832ee=_0x836d[_0x313a2c];return _0x3832ee;};'use strict';var _=require(_0xd836('0x0'));var rp=require(_0xd836('0x1'));var md5=require(_0xd836('0x2'));var util=require(_0xd836('0x3'));var intUtil=require('./util');var moment=require(_0xd836('0x4'));var Redis=require(_0xd836('0x5'));var BPromise=require('bluebird');var config=require(_0xd836('0x6'));var logger=require(_0xd836('0x7'))('zoho');config[_0xd836('0x8')]=_[_0xd836('0x9')](config[_0xd836('0x8')],{'host':_0xd836('0xa'),'port':0x18eb});var io=require(_0xd836('0xb'))(new Redis(config[_0xd836('0x8')]));function emit(_0x17a4d4,_0x502c2f,_0x2a2621){io['to'](_0x17a4d4)[_0xd836('0xc')](_0x502c2f,_0x2a2621);}function request(_0x10c52d){logger[_0xd836('0xd')]('[HTTP]',JSON['stringify'](_0x10c52d));return rp(_0x10c52d);}function getCustomFields(_0x37ac9f,_0x23b28c){var _0x29b600={};if(_0x37ac9f[_0xd836('0xe')]>0x0){_[_0xd836('0xf')](_0x37ac9f,function(_0x11898b){if(_0x11898b[_0xd836('0x10')]===_0xd836('0x11')&&_0x11898b[_0xd836('0x12')]){_0x29b600[_0x11898b[_0xd836('0x12')]]=_0x11898b['content'][_0xd836('0x13')]();}else if(_0x11898b[_0xd836('0x10')]===_0xd836('0x14')&&_0x11898b[_0xd836('0x15')]&&_0x11898b[_0xd836('0x12')]&&_0x23b28c[_0x11898b[_0xd836('0x15')]]){_0x29b600[_0x11898b[_0xd836('0x12')]]=_0x23b28c[_0x11898b['variableName']][_0xd836('0x13')]();}else if(_0x11898b[_0xd836('0x10')]===_0xd836('0x16')&&_0x11898b[_0xd836('0x17')]&&_0x11898b[_0xd836('0x17')][_0xd836('0x18')]&&_0x11898b['idField']&&_0x23b28c[_0x11898b[_0xd836('0x17')][_0xd836('0x18')][_0xd836('0x19')]()]){_0x29b600[_0x11898b[_0xd836('0x12')]]=_0x23b28c[_0x11898b[_0xd836('0x17')][_0xd836('0x18')]['toLowerCase']()][_0xd836('0x13')]();}});}return _0x29b600;}function getName(_0x533bfc){if(_0x533bfc['indexOf']('\x20')>0x0){var _0x526fc5=_0x533bfc[_0xd836('0x1a')](/ (.+)/);if(_0x526fc5[0x1]){return _0x526fc5;}}return[_0x533bfc,_0x533bfc];}var accountsTokens={};function getAccessToken(_0x14a68d){return new Promise(function(_0xa9311f,_0x4a35fd){if(!_[_0xd836('0x1b')](accountsTokens[_0x14a68d['id']])&&!_['isNil'](accountsTokens[_0x14a68d['id']]['access_token'])){if(moment()['isBefore'](accountsTokens[_0x14a68d['id']][_0xd836('0x1c')])){_0xa9311f(accountsTokens[_0x14a68d['id']][_0xd836('0x1d')]);}}var _0x189c16;switch(_0x14a68d[_0xd836('0x1e')]){case'US':_0x189c16='https://accounts.zoho.com';break;case'AU':_0x189c16=_0xd836('0x1f');break;case'EU':_0x189c16=_0xd836('0x20');break;case'IN':_0x189c16=_0xd836('0x21');break;case'CN':_0x189c16=_0xd836('0x22');break;default:_0x189c16=_0xd836('0x20');break;}var _0x616d0f={'method':'POST','uri':_0x189c16+_0xd836('0x23'),'qs':{'refresh_token':_0x14a68d[_0xd836('0x24')],'client_id':_0x14a68d['clientId'],'client_secret':_0x14a68d['clientSecret'],'grant_type':_0xd836('0x25')},'json':!![]};return rp(_0x616d0f)[_0xd836('0x26')](function(_0x1ee720){accountsTokens[_0x14a68d['id']]={'access_token':_0x1ee720[_0xd836('0x1d')],'expires_in':moment()[_0xd836('0x27')](_0x1ee720[_0xd836('0x1c')],_0xd836('0x28'))};_0xa9311f(_0x1ee720['access_token']);})[_0xd836('0x29')](function(_0x72097b){logger['error']('Failing\x20creating\x20the\x20access_token',_0x72097b[_0xd836('0x2a')]);_0x4a35fd(_0x72097b);});});}function getUser(_0x4b8b3c,_0xc19357,_0x2c2754,_0x151f5c){logger[_0xd836('0x2b')](_0xd836('0x2c'));return request({'method':_0xd836('0x2d'),'uri':util['format'](_0xd836('0x2e'),_0xc19357),'qs':{'type':_0xd836('0x2f')},'headers':{'Authorization':_0xd836('0x30')+_0x4b8b3c},'json':!![]})[_0xd836('0x26')](function(_0x1b2621){if(_0x1b2621[_0xd836('0x31')]){var _0x4c436b=-0x1;if(_['isArrayLikeObject'](_0x1b2621[_0xd836('0x31')])){if(!_[_0xd836('0x1b')](_0x151f5c)){_0x4c436b=_['findIndex'](_0x1b2621['users'],function(_0x5e560b){return _0x5e560b[_0xd836('0x32')]===_0x151f5c;});}if(_0x4c436b>=0x0){logger['info'](_0xd836('0x33'));}else{logger['info'](_0xd836('0x34'));_0x4c436b=_[_0xd836('0x35')](_0x1b2621[_0xd836('0x31')],function(_0x3db856){return _0x3db856[_0xd836('0x36')][_0xd836('0x18')]==='Administrator';});}return _0x1b2621['users'][_0x4c436b];}else{if(_0x1b2621['user'][_0xd836('0x36')][_0xd836('0x18')]===_0xd836('0x37')){logger['info']('Using\x20the\x20admin\x20account!');user=_0x1b2621[_0xd836('0x38')];return user;}else{logger[_0xd836('0x39')](_0xd836('0x3a'),JSON[_0xd836('0x3b')](_0x1b2621));throw new Error(_0xd836('0x3c')+JSON['stringify'](_0x1b2621));}}}else{logger[_0xd836('0x39')]('The\x20failing\x20result\x20is',JSON[_0xd836('0x3b')](_0x1b2621));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xd836('0x3b')](_0x1b2621));}})['catch'](function(_0x1956e0){console[_0xd836('0x39')](_0x1956e0);});}function getZohoUser(_0x236cf9,_0x5e7bfa){return new BPromise(function(_0x335c2b,_0x53eb2e){request(_0x236cf9)[_0xd836('0x26')](function(_0x23c5e0){var _0x4c2b3c=null;if(_0x23c5e0){_0x4c2b3c=_0x23c5e0[_0xd836('0x3d')][0x0];_0x4c2b3c['enduserType']=_0x5e7bfa;}_0x335c2b(_0x4c2b3c);})[_0xd836('0x29')](function(_0x3f2f94){_0x53eb2e(_0x3f2f94);});});}function createEndUser(_0x19535e,_0x3a87b8,_0x5cb70e,_0x1981aa,_0x3e538f,_0x57309f){var _0x5cb70e=getName(_0x5cb70e);return request({'method':_0xd836('0x3e'),'uri':_0xd836('0x3f')+_0x3a87b8+_0xd836('0x40')+_[_0xd836('0x41')](_0x57309f['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x5cb70e[0x1],'First_Name':_0x5cb70e[0x0],'Phone':_0x1981aa,'Owner':{'name':!_[_0xd836('0x1b')](_0x3e538f[_0xd836('0x42')][_0xd836('0x18')])?_0x3e538f['role'][_0xd836('0x18')]:!_[_0xd836('0x1b')](_0x3e538f[_0xd836('0x43')])?_0x3e538f['first_name']+'\x20'+_0x3e538f[_0xd836('0x44')]:_0x3e538f[_0xd836('0x44')],'id':_0x3e538f['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x19535e},'json':!![]})[_0xd836('0x26')](function(_0x325eed){if(_0x325eed&&_0x325eed[_0xd836('0x3d')][0x0][_0xd836('0x45')]==='SUCCESS'){var _0x2d047d=_0x325eed[_0xd836('0x3d')][0x0][_0xd836('0x46')];_0x2d047d[_0xd836('0x47')]=_[_0xd836('0x41')](_0x57309f[_0xd836('0x48')])+'s';return _0x2d047d;}logger['error'](_0xd836('0x3a'),JSON[_0xd836('0x3b')](data));throw new Error(_0xd836('0x49')+JSON[_0xd836('0x3b')](data));})['catch'](function(_0x182dcc){console[_0xd836('0x4a')](_0xd836('0x4b'),_0x182dcc);});}function getEndUser(_0x5294c6,_0x36b52b,_0x784ade,_0x16dc7c,_0x246706,_0x368f2f,_0x3698e5){var _0x27f1a1={'method':_0xd836('0x2d'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x5294c6},'json':!![]};switch(_0x3698e5[_0xd836('0x4c')]){case _0xd836('0x4d'):_0x27f1a1[_0xd836('0x4e')]='https://www.zohoapis.'+_0x36b52b+_0xd836('0x4f')+_0x246706+'))';return getZohoUser(_0x27f1a1,_0xd836('0x50'))[_0xd836('0x26')](function(_0x74dac3){if(_0x74dac3)return _0x74dac3;_0x27f1a1[_0xd836('0x4e')]=_0xd836('0x3f')+_0x36b52b+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x246706+'))';return getZohoUser(_0x27f1a1,_0xd836('0x51'))[_0xd836('0x26')](function(_0x115104){if(_0x115104)return _0x115104;if(_0x3698e5['moduleCreate']!=_0xd836('0x52')){return createEndUser(_0x5294c6,_0x36b52b,_0x16dc7c,_0x246706,_0x368f2f,_0x3698e5);}else{return{};}});});break;case _0xd836('0x53'):_0x27f1a1[_0xd836('0x4e')]=_0xd836('0x3f')+_0x36b52b+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x246706+'))';return getZohoUser(_0x27f1a1,_0xd836('0x50'))['then'](function(_0x3f7740){if(_0x3f7740)return _0x3f7740;if(_0x3698e5['moduleCreate']!=_0xd836('0x52')){return createEndUser(_0x5294c6,_0x36b52b,_0x16dc7c,_0x246706,_0x368f2f,_0x3698e5);}else{return{};}});break;case _0xd836('0x54'):_0x27f1a1['uri']='https://www.zohoapis.'+_0x36b52b+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x246706+'))';return getZohoUser(_0x27f1a1,'Leads')['then'](function(_0x442aef){if(_0x442aef)return _0x442aef;if(_0x3698e5['moduleCreate']!=_0xd836('0x52')){return createEndUser(_0x5294c6,_0x36b52b,_0x16dc7c,_0x246706,_0x368f2f,_0x3698e5);}else{return{};}});break;}}function getCall(_0x2224e5,_0x1db6a1,_0x5a06ab,_0x334c81,_0x3f7a78,_0x5f29b3,_0x5e3ce6,_0x42ed0c){logger[_0xd836('0x2b')](_0xd836('0x55'));var _0x28c87f={};_0x28c87f['Owner']={'name':!_[_0xd836('0x1b')](_0x334c81[_0xd836('0x42')][_0xd836('0x18')])&&!_[_0xd836('0x1b')](_0x334c81[_0xd836('0x36')][_0xd836('0x18')])&&_0x334c81[_0xd836('0x36')][_0xd836('0x18')]===_0xd836('0x56')?_0x334c81[_0xd836('0x42')][_0xd836('0x18')]:!_[_0xd836('0x1b')](_0x334c81['first_name'])?_0x334c81[_0xd836('0x43')]+'\x20'+_0x334c81[_0xd836('0x44')]:_0x334c81[_0xd836('0x44')],'id':_0x334c81['id']};_0x28c87f[_0xd836('0x57')]=intUtil[_0xd836('0x58')](_0x5f29b3[_0xd836('0x59')],_0x5e3ce6,'\x20');_0x28c87f[_0xd836('0x5a')]=intUtil[_0xd836('0x58')](_0x5f29b3[_0xd836('0x5b')],_0x5e3ce6,'\x0a');if(_0x3f7a78['enduserType']===_0xd836('0x50')){_0x28c87f[_0xd836('0x5c')]={'name':!_['isNil'](_0x3f7a78[_0xd836('0x5d')])?_0x3f7a78[_0xd836('0x5d')]:!_[_0xd836('0x1b')](_0x3f7a78['First_Name'])?_0x3f7a78['First_Name']+'\x20'+_0x3f7a78['Last_Name']:_0x3f7a78[_0xd836('0x5e')],'id':_0x3f7a78['id']};}if(_0x3f7a78[_0xd836('0x47')]===_0xd836('0x51')){_0x28c87f[_0xd836('0x5f')]={'name':!_[_0xd836('0x1b')](_0x3f7a78[_0xd836('0x5d')])?_0x3f7a78[_0xd836('0x5d')]:!_['isNil'](_0x3f7a78[_0xd836('0x60')])?_0x3f7a78[_0xd836('0x60')]+'\x20'+_0x3f7a78[_0xd836('0x5e')]:_0x3f7a78['Last_Name'],'id':_0x3f7a78['id']};_0x28c87f[_0xd836('0x61')]=_['startCase'](_0x3f7a78[_0xd836('0x47')]);}if(_0x5e3ce6[_0xd836('0x62')]){_0x28c87f[_0xd836('0x63')]=moment[_0xd836('0x64')](parseInt(_0x5e3ce6[_0xd836('0x62')])*0x3e8)[_0xd836('0x65')](_0xd836('0x66'));}else if(_0x5e3ce6['answertime']&&_0x5e3ce6[_0xd836('0x67')]){_0x28c87f[_0xd836('0x63')]=moment[_0xd836('0x64')](moment(_0x5e3ce6['endtime'],_0xd836('0x68'))[_0xd836('0x69')](moment(_0x5e3ce6['starttime'],_0xd836('0x68'))))[_0xd836('0x65')](_0xd836('0x66'));}switch(_0x5e3ce6[_0xd836('0x6a')]){case _0xd836('0x6b'):_0x28c87f[_0xd836('0x6c')]=_0xd836('0x6d');break;case _0xd836('0x6e'):case _0xd836('0x6f'):_0x28c87f[_0xd836('0x6c')]=_0xd836('0x70');break;case _0xd836('0x71'):_0x28c87f['Call_Result']=_0xd836('0x72');break;case _0xd836('0x73'):_0x28c87f[_0xd836('0x6c')]='Abandoned';break;default:}_0x28c87f['Call_Start_Time']=(_0x42ed0c===_0xd836('0x74')?moment(_0x5e3ce6[_0xd836('0x75')])[_0xd836('0x65')](_0xd836('0x68')):moment(_0x5e3ce6['agentcalledAt'])[_0xd836('0x65')](_0xd836('0x68')))||moment()[_0xd836('0x65')](_0xd836('0x68'));_0x28c87f['Call_Type']=_0x42ed0c||_0xd836('0x76');_0x28c87f=_[_0xd836('0x77')](_0x28c87f,getCustomFields(_0x5f29b3[_0xd836('0x78')],_0x5e3ce6));return request({'method':_0xd836('0x3e'),'uri':_0xd836('0x3f')+_0x1db6a1+_0xd836('0x79'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x2224e5},'body':{'data':[_0x28c87f]},'json':!![]})[_0xd836('0x26')](function(_0x418aad){if(_0x418aad&&_0x418aad[_0xd836('0x3d')][0x0]['code']===_0xd836('0x7a')){logger[_0xd836('0x2b')](_0xd836('0x7b'));return{'id':_0x418aad[_0xd836('0x3d')][0x0][_0xd836('0x46')]['id']};}})['catch'](function(_0x36a8ff){logger[_0xd836('0x2b')](_0xd836('0x7c'),_0x36a8ff['stack']);console['log']('err',_0x36a8ff);});}exports[_0xd836('0x7d')]=function(_0x2525d5,_0x16620a,_0x5a5be5,_0x434669,_0x2fa66c,_0x2f60e4){var _0x35d631,_0x4e7097,_0x4e4e83;_0x2f60e4[_0xd836('0x7e')]=intUtil[_0xd836('0x7f')](_0x2f60e4['host']);_0x2f60e4[_0xd836('0x80')]=intUtil['stripTrailingSlash'](_0x2f60e4[_0xd836('0x80')]);if(_0x2fa66c&&_0x2fa66c[_0xd836('0x81')]){logger[_0xd836('0x2b')](_0xd836('0x82'),_0xd836('0x83'));_0x16620a[_0xd836('0x84')]=_0x2f60e4[_0xd836('0x80')]+_0xd836('0x85')+_0x16620a[_0xd836('0x86')]+_0xd836('0x87')+md5(_0x16620a[_0xd836('0x86')]);}else{_0x16620a[_0xd836('0x84')]='';}var _0x409f88=_0x2f60e4[_0xd836('0x7e')]===_0xd836('0x88')?'eu':_0xd836('0x89');return getAccessToken(_0x2f60e4)[_0xd836('0x26')](function(_0x5c4044){_0x4e4e83=_0x5c4044;return getUser(_0x4e4e83,_0x409f88,_0x2f60e4,_0x434669[_0xd836('0x32')]);})[_0xd836('0x26')](function(_0xfb44d9){_0x35d631=_0xfb44d9;logger[_0xd836('0x2b')](_0xd836('0x8a'),_0x35d631['id']);return getEndUser(_0x4e4e83,_0x409f88,_0x2f60e4,_0x16620a[_0xd836('0x8b')],_0x16620a[_0xd836('0x8c')],_0x35d631,_0x5a5be5);})[_0xd836('0x26')](function(_0x305e9c){_0x4e7097=_0x305e9c;return getCall(_0x4e4e83,_0x409f88,_0x2f60e4,_0x35d631,_0x4e7097,_0x5a5be5,_0x16620a,'Inbound');})[_0xd836('0x26')](function(_0x392e91){if(_0x392e91){logger[_0xd836('0x2b')](_0xd836('0x8d'),_0x392e91['id']);logger[_0xd836('0x2b')](_0xd836('0x82'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xd836('0x65')](_0xd836('0x8e'),_0x434669[_0xd836('0x18')]),_0xd836('0x8f'),{'uri':_0xd836('0x90')+_0x2f60e4[_0xd836('0x7e')]+_0xd836('0x91')+_0x392e91['id']});}})[_0xd836('0x29')](function(_0x42de8d){logger['error'](_0xd836('0x82'),JSON[_0xd836('0x3b')](_0x42de8d));});};exports[_0xd836('0x74')]=function(_0x37c736,_0x4876e6,_0x508313,_0x446a9d,_0x318694,_0x1b17c5,_0x32aaa4){var _0x1dd271,_0xb5f623,_0x28f970;_0x1b17c5['host']=intUtil[_0xd836('0x7f')](_0x1b17c5['host']);_0x1b17c5[_0xd836('0x80')]=intUtil['stripTrailingSlash'](_0x1b17c5[_0xd836('0x80')]);if(_0x32aaa4&&_0x32aaa4['recordingFormat']&&_0x32aaa4[_0xd836('0x92')]!==_0xd836('0x93')){logger['info'](_0xd836('0x94'),_0xd836('0x83'));_0x4876e6[_0xd836('0x84')]=_0x1b17c5['serverUrl']+'/api/voice/recordings/'+_0x4876e6[_0xd836('0x86')]+_0xd836('0x87')+md5(_0x4876e6[_0xd836('0x86')]);}var _0x561ea9=_0x1b17c5[_0xd836('0x7e')]===_0xd836('0x88')?'eu':_0xd836('0x89');return getAccessToken(_0x1b17c5)[_0xd836('0x26')](function(_0x2e9c88){_0x28f970=_0x2e9c88;return getUser(_0x28f970,_0x561ea9,_0x1b17c5,_0x446a9d[_0xd836('0x32')]);})[_0xd836('0x26')](function(_0x2d392a){_0x1dd271=_0x2d392a;logger[_0xd836('0x2b')](_0xd836('0x8a'),_0x1dd271['id']);return getEndUser(_0x28f970,_0x561ea9,_0x1b17c5,_0x4876e6['destcalleridname'],_0x4876e6[_0xd836('0x95')],_0x1dd271,_0x508313);})[_0xd836('0x26')](function(_0x5e0041){_0xb5f623=_0x5e0041;return getCall(_0x28f970,_0x561ea9,_0x1b17c5,_0x1dd271,_0xb5f623,_0x508313,_0x4876e6,'Outbound');})[_0xd836('0x26')](function(_0x5d4557){if(_0x5d4557){logger[_0xd836('0x2b')](_0xd836('0x8d'),_0x5d4557['id']);logger['info'](_0xd836('0x94'),_0xd836('0x96'));emit(util[_0xd836('0x65')](_0xd836('0x8e'),_0x446a9d[_0xd836('0x18')]),_0xd836('0x8f'),{'uri':'https://crm.'+_0x1b17c5[_0xd836('0x7e')]+'/crm/EntityInfo.do?module=Calls&id='+_0x5d4557['id']});}})['catch'](function(_0x4ba8f1){logger[_0xd836('0x39')](_0xd836('0x94'),JSON[_0xd836('0x3b')](_0x4ba8f1));});};exports[_0xd836('0x73')]=function(_0x32ec75,_0x276b8b,_0x437021,_0x14bded,_0x3833d2,_0x261eb1){var _0x527b6d,_0x35b5ca,_0x446908;_0x261eb1[_0xd836('0x7e')]=intUtil['stripTrailingSlash'](_0x261eb1[_0xd836('0x7e')]);_0x261eb1[_0xd836('0x80')]=intUtil['stripTrailingSlash'](_0x261eb1[_0xd836('0x80')]);if(_0x3833d2&&_0x3833d2[_0xd836('0x81')]){logger[_0xd836('0x2b')]('[ABANDONED]',_0xd836('0x83'));_0x276b8b[_0xd836('0x84')]=_0x261eb1[_0xd836('0x80')]+'/api/voice/recordings/'+_0x276b8b[_0xd836('0x86')]+'/downloads?type=uniqueid&token='+md5(_0x276b8b[_0xd836('0x86')]);}else{_0x276b8b[_0xd836('0x84')]='';}var _0x2e33e2=_0x261eb1[_0xd836('0x7e')]===_0xd836('0x88')?'eu':_0xd836('0x89');return getAccessToken(_0x261eb1)[_0xd836('0x26')](function(_0x315906){_0x446908=_0x315906;return getUser(_0x446908,_0x2e33e2,_0x261eb1);})[_0xd836('0x26')](function(_0x46a89f){_0x527b6d=_0x46a89f;logger[_0xd836('0x2b')](_0xd836('0x8a'),_0x527b6d['id']);return getEndUser(_0x446908,_0x2e33e2,_0x261eb1,_0x276b8b[_0xd836('0x8b')],_0x276b8b[_0xd836('0x8c')],_0x527b6d,_0x437021);})['then'](function(_0x2689e4){_0x35b5ca=_0x2689e4;return getCall(_0x446908,_0x2e33e2,_0x261eb1,_0x527b6d,_0x35b5ca,_0x437021,_0x276b8b,'Inbound');})['then'](function(_0x2b8fc2){if(_0x2b8fc2){logger[_0xd836('0x2b')](_0xd836('0x8d'),_0x2b8fc2['id']);}})['catch'](function(_0x152a73){logger[_0xd836('0x39')]('[ABANDONED]',JSON[_0xd836('0x3b')](_0x152a73));});}; \ No newline at end of file +var _0x385c=['clientSecret','refresh_token','then','add','expires_in','seconds','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','Zoho-oauthtoken\x20','isArrayLikeObject','findIndex','users','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','error','data','catch','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','enduserType','Error:\x20','log','CREATE\x20ERROR','contact_lead','uri','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','contact','nothing','lead','Leads','Creating\x20new\x20call...','Owner','administrator','getString','Subjects','Description','Descriptions','Who_Id','First_Name','Last_Name','What_Id','Full_Name','$se_module','talktime','Call_Duration','utc','format','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','starttime','Call_Result','connect','Answered','rejected','Rejected','Abandoned','Call_Start_Time','outbound','Call_Type','Inbound','Fields','/crm/v2/Calls','Call\x20created!','err','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridnum','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Outbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://crm.','[ABANDONED]','calleridname','The\x20Call\x20ID\x20is:','./util','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','type','string','idField','variableName','Variable','name','toLowerCase','isNil','access_token','isBefore','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','POST','refreshToken'];(function(_0x3824fb,_0x511e11){var _0x1ab1c3=function(_0x5ccc56){while(--_0x5ccc56){_0x3824fb['push'](_0x3824fb['shift']());}};_0x1ab1c3(++_0x511e11);}(_0x385c,0xff));var _0xc385=function(_0xb9002e,_0x31c3e2){_0xb9002e=_0xb9002e-0x0;var _0x376be4=_0x385c[_0xb9002e];return _0x376be4;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require('md5');var util=require('util');var intUtil=require(_0xc385('0x0'));var moment=require('moment');var Redis=require(_0xc385('0x1'));var BPromise=require('bluebird');var config=require(_0xc385('0x2'));var logger=require(_0xc385('0x3'))(_0xc385('0x4'));config[_0xc385('0x5')]=_['defaults'](config[_0xc385('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xc385('0x6'))(new Redis(config[_0xc385('0x5')]));function emit(_0x2bb187,_0x1864b0,_0x4f88a9){io['to'](_0x2bb187)[_0xc385('0x7')](_0x1864b0,_0x4f88a9);}function request(_0x21b9f4){logger[_0xc385('0x8')](_0xc385('0x9'),JSON[_0xc385('0xa')](_0x21b9f4));return rp(_0x21b9f4);}function getCustomFields(_0x11cdb7,_0x442f15){var _0x4b94bf={};if(_0x11cdb7[_0xc385('0xb')]>0x0){_[_0xc385('0xc')](_0x11cdb7,function(_0x39e25c){if(_0x39e25c[_0xc385('0xd')]===_0xc385('0xe')&&_0x39e25c[_0xc385('0xf')]){_0x4b94bf[_0x39e25c[_0xc385('0xf')]]=_0x39e25c['content']['toString']();}else if(_0x39e25c[_0xc385('0xd')]==='variable'&&_0x39e25c[_0xc385('0x10')]&&_0x39e25c[_0xc385('0xf')]&&_0x442f15[_0x39e25c[_0xc385('0x10')]]){_0x4b94bf[_0x39e25c[_0xc385('0xf')]]=_0x442f15[_0x39e25c[_0xc385('0x10')]]['toString']();}else if(_0x39e25c[_0xc385('0xd')]==='customVariable'&&_0x39e25c[_0xc385('0x11')]&&_0x39e25c[_0xc385('0x11')][_0xc385('0x12')]&&_0x39e25c[_0xc385('0xf')]&&_0x442f15[_0x39e25c[_0xc385('0x11')][_0xc385('0x12')][_0xc385('0x13')]()]){_0x4b94bf[_0x39e25c['idField']]=_0x442f15[_0x39e25c['Variable'][_0xc385('0x12')][_0xc385('0x13')]()]['toString']();}});}return _0x4b94bf;}function getName(_0xa5f3dc){if(_0xa5f3dc['indexOf']('\x20')>0x0){var _0x156725=_0xa5f3dc['split'](/ (.+)/);if(_0x156725[0x1]){return _0x156725;}}return[_0xa5f3dc,_0xa5f3dc];}var accountsTokens={};function getAccessToken(_0x3e4fcd){return new Promise(function(_0x55bc48,_0x38e222){if(!_[_0xc385('0x14')](accountsTokens[_0x3e4fcd['id']])&&!_[_0xc385('0x14')](accountsTokens[_0x3e4fcd['id']][_0xc385('0x15')])){if(moment()[_0xc385('0x16')](accountsTokens[_0x3e4fcd['id']]['expires_in'])){_0x55bc48(accountsTokens[_0x3e4fcd['id']][_0xc385('0x15')]);}}var _0x32c274;switch(_0x3e4fcd[_0xc385('0x17')]){case'US':_0x32c274=_0xc385('0x18');break;case'AU':_0x32c274=_0xc385('0x19');break;case'EU':_0x32c274=_0xc385('0x1a');break;case'IN':_0x32c274='https://accounts.zoho.in';break;case'CN':_0x32c274='https://accounts.zoho.com.cn';break;default:_0x32c274=_0xc385('0x1a');break;}var _0xa616b5={'method':_0xc385('0x1b'),'uri':_0x32c274+'/oauth/v2/token','qs':{'refresh_token':_0x3e4fcd[_0xc385('0x1c')],'client_id':_0x3e4fcd['clientId'],'client_secret':_0x3e4fcd[_0xc385('0x1d')],'grant_type':_0xc385('0x1e')},'json':!![]};return rp(_0xa616b5)[_0xc385('0x1f')](function(_0x58db22){accountsTokens[_0x3e4fcd['id']]={'access_token':_0x58db22[_0xc385('0x15')],'expires_in':moment()[_0xc385('0x20')](_0x58db22[_0xc385('0x21')],_0xc385('0x22'))};_0x55bc48(_0x58db22[_0xc385('0x15')]);})['catch'](function(_0x41907d){logger['error'](_0xc385('0x23'),_0x41907d[_0xc385('0x24')]);_0x38e222(_0x41907d);});});}function getUser(_0x4b1c5f,_0x248ef5,_0x34429b,_0xfb744d){logger[_0xc385('0x25')](_0xc385('0x26'));return request({'method':_0xc385('0x27'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/users',_0x248ef5),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0xc385('0x28')+_0x4b1c5f},'json':!![]})['then'](function(_0x4f8e9b){if(_0x4f8e9b['users']){var _0x2a17ce=-0x1;if(_[_0xc385('0x29')](_0x4f8e9b['users'])){if(!_['isNil'](_0xfb744d)){_0x2a17ce=_[_0xc385('0x2a')](_0x4f8e9b[_0xc385('0x2b')],function(_0x519843){return _0x519843[_0xc385('0x2c')]===_0xfb744d;});}if(_0x2a17ce>=0x0){logger[_0xc385('0x25')](_0xc385('0x2d'));}else{logger[_0xc385('0x25')](_0xc385('0x2e'));_0x2a17ce=_[_0xc385('0x2a')](_0x4f8e9b[_0xc385('0x2b')],function(_0x371e4f){return _0x371e4f[_0xc385('0x2f')][_0xc385('0x12')]===_0xc385('0x30');});}return _0x4f8e9b['users'][_0x2a17ce];}else{if(_0x4f8e9b['user'][_0xc385('0x2f')][_0xc385('0x12')]==='Administrator'){logger[_0xc385('0x25')](_0xc385('0x2e'));user=_0x4f8e9b[_0xc385('0x31')];return user;}else{logger['error'](_0xc385('0x32'),JSON[_0xc385('0xa')](_0x4f8e9b));throw new Error(_0xc385('0x33')+JSON['stringify'](_0x4f8e9b));}}}else{logger[_0xc385('0x34')](_0xc385('0x32'),JSON[_0xc385('0xa')](_0x4f8e9b));throw new Error(_0xc385('0x33')+JSON[_0xc385('0xa')](_0x4f8e9b));}})['catch'](function(_0x5730cb){console[_0xc385('0x34')](_0x5730cb);});}function getZohoUser(_0x17e0f7,_0x436bad){return new BPromise(function(_0x1736d7,_0x1fd526){request(_0x17e0f7)[_0xc385('0x1f')](function(_0x11f394){var _0x7ed657=null;if(_0x11f394){_0x7ed657=_0x11f394[_0xc385('0x35')][0x0];_0x7ed657['enduserType']=_0x436bad;}_0x1736d7(_0x7ed657);})[_0xc385('0x36')](function(_0x25ff0b){_0x1fd526(_0x25ff0b);});});}function createEndUser(_0x4df4c5,_0x51df6e,_0x1d71b5,_0x5eb94a,_0x3fdad0,_0x188ffc){var _0x1d71b5=getName(_0x1d71b5);return request({'method':_0xc385('0x1b'),'uri':'https://www.zohoapis.'+_0x51df6e+_0xc385('0x37')+_[_0xc385('0x38')](_0x188ffc[_0xc385('0x39')])+'s','body':{'data':[{'Last_Name':_0x1d71b5[0x1],'First_Name':_0x1d71b5[0x0],'Phone':_0x5eb94a,'Owner':{'name':!_['isNil'](_0x3fdad0[_0xc385('0x3a')][_0xc385('0x12')])?_0x3fdad0[_0xc385('0x3a')][_0xc385('0x12')]:!_[_0xc385('0x14')](_0x3fdad0['first_name'])?_0x3fdad0[_0xc385('0x3b')]+'\x20'+_0x3fdad0[_0xc385('0x3c')]:_0x3fdad0['last_name'],'id':_0x3fdad0['id']}}]},'headers':{'Authorization':_0xc385('0x28')+_0x4df4c5},'json':!![]})[_0xc385('0x1f')](function(_0x46f750){if(_0x46f750&&_0x46f750[_0xc385('0x35')][0x0][_0xc385('0x3d')]===_0xc385('0x3e')){var _0x5b68d7=_0x46f750[_0xc385('0x35')][0x0][_0xc385('0x3f')];_0x5b68d7[_0xc385('0x40')]=_[_0xc385('0x38')](_0x188ffc[_0xc385('0x39')])+'s';return _0x5b68d7;}logger[_0xc385('0x34')]('The\x20failing\x20result\x20is',JSON[_0xc385('0xa')](data));throw new Error(_0xc385('0x41')+JSON[_0xc385('0xa')](data));})[_0xc385('0x36')](function(_0x2e2bd5){console[_0xc385('0x42')](_0xc385('0x43'),_0x2e2bd5);});}function getEndUser(_0x204c8d,_0x5371bc,_0x4d3f80,_0x5045ec,_0x2141b3,_0x5afb44,_0x13a712){var _0x412076={'method':_0xc385('0x27'),'uri':'','headers':{'Authorization':_0xc385('0x28')+_0x204c8d},'json':!![]};switch(_0x13a712['moduleSearch']){case _0xc385('0x44'):_0x412076[_0xc385('0x45')]=_0xc385('0x46')+_0x5371bc+_0xc385('0x47')+_0x2141b3+'))';return getZohoUser(_0x412076,_0xc385('0x48'))[_0xc385('0x1f')](function(_0x3c08b1){if(_0x3c08b1)return _0x3c08b1;_0x412076[_0xc385('0x45')]=_0xc385('0x46')+_0x5371bc+_0xc385('0x49')+_0x2141b3+'))';return getZohoUser(_0x412076,'Leads')[_0xc385('0x1f')](function(_0x2b9311){if(_0x2b9311)return _0x2b9311;if(_0x13a712[_0xc385('0x39')]!='nothing'){return createEndUser(_0x204c8d,_0x5371bc,_0x5045ec,_0x2141b3,_0x5afb44,_0x13a712);}else{return{};}});});break;case _0xc385('0x4a'):_0x412076[_0xc385('0x45')]=_0xc385('0x46')+_0x5371bc+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x2141b3+'))';return getZohoUser(_0x412076,_0xc385('0x48'))[_0xc385('0x1f')](function(_0x6e8969){if(_0x6e8969)return _0x6e8969;if(_0x13a712['moduleCreate']!=_0xc385('0x4b')){return createEndUser(_0x204c8d,_0x5371bc,_0x5045ec,_0x2141b3,_0x5afb44,_0x13a712);}else{return{};}});break;case _0xc385('0x4c'):_0x412076[_0xc385('0x45')]=_0xc385('0x46')+_0x5371bc+_0xc385('0x49')+_0x2141b3+'))';return getZohoUser(_0x412076,_0xc385('0x4d'))[_0xc385('0x1f')](function(_0x4a87f9){if(_0x4a87f9)return _0x4a87f9;if(_0x13a712[_0xc385('0x39')]!=_0xc385('0x4b')){return createEndUser(_0x204c8d,_0x5371bc,_0x5045ec,_0x2141b3,_0x5afb44,_0x13a712);}else{return{};}});break;}}function getCall(_0x305b47,_0x1d3485,_0x1b1798,_0x38ae3c,_0x8f2728,_0x328668,_0x53456e,_0x3f900d){logger[_0xc385('0x25')](_0xc385('0x4e'));var _0x48ee05={};_0x48ee05[_0xc385('0x4f')]={'name':!_[_0xc385('0x14')](_0x38ae3c[_0xc385('0x3a')][_0xc385('0x12')])&&!_['isNil'](_0x38ae3c[_0xc385('0x2f')][_0xc385('0x12')])&&_0x38ae3c[_0xc385('0x2f')][_0xc385('0x12')]===_0xc385('0x50')?_0x38ae3c['role']['name']:!_[_0xc385('0x14')](_0x38ae3c[_0xc385('0x3b')])?_0x38ae3c[_0xc385('0x3b')]+'\x20'+_0x38ae3c[_0xc385('0x3c')]:_0x38ae3c[_0xc385('0x3c')],'id':_0x38ae3c['id']};_0x48ee05['Subject']=intUtil[_0xc385('0x51')](_0x328668[_0xc385('0x52')],_0x53456e,'\x20');_0x48ee05[_0xc385('0x53')]=intUtil[_0xc385('0x51')](_0x328668[_0xc385('0x54')],_0x53456e,'\x0a');if(_0x8f2728[_0xc385('0x40')]===_0xc385('0x48')){_0x48ee05[_0xc385('0x55')]={'name':!_[_0xc385('0x14')](_0x8f2728['Full_Name'])?_0x8f2728['Full_Name']:!_[_0xc385('0x14')](_0x8f2728[_0xc385('0x56')])?_0x8f2728[_0xc385('0x56')]+'\x20'+_0x8f2728[_0xc385('0x57')]:_0x8f2728[_0xc385('0x57')],'id':_0x8f2728['id']};}if(_0x8f2728[_0xc385('0x40')]===_0xc385('0x4d')){_0x48ee05[_0xc385('0x58')]={'name':!_['isNil'](_0x8f2728[_0xc385('0x59')])?_0x8f2728['Full_Name']:!_[_0xc385('0x14')](_0x8f2728[_0xc385('0x56')])?_0x8f2728[_0xc385('0x56')]+'\x20'+_0x8f2728['Last_Name']:_0x8f2728[_0xc385('0x57')],'id':_0x8f2728['id']};_0x48ee05[_0xc385('0x5a')]=_[_0xc385('0x38')](_0x8f2728[_0xc385('0x40')]);}if(_0x53456e[_0xc385('0x5b')]){_0x48ee05[_0xc385('0x5c')]=moment[_0xc385('0x5d')](parseInt(_0x53456e[_0xc385('0x5b')])*0x3e8)[_0xc385('0x5e')](_0xc385('0x5f'));}else if(_0x53456e[_0xc385('0x60')]&&_0x53456e[_0xc385('0x61')]){_0x48ee05[_0xc385('0x5c')]=moment[_0xc385('0x5d')](moment(_0x53456e[_0xc385('0x61')],_0xc385('0x62'))['diff'](moment(_0x53456e[_0xc385('0x63')],_0xc385('0x62'))))['format'](_0xc385('0x5f'));}switch(_0x53456e['lastevent']){case'called':_0x48ee05[_0xc385('0x64')]='Called';break;case'complete':case _0xc385('0x65'):_0x48ee05['Call_Result']=_0xc385('0x66');break;case _0xc385('0x67'):_0x48ee05[_0xc385('0x64')]=_0xc385('0x68');break;case'abandoned':_0x48ee05[_0xc385('0x64')]=_0xc385('0x69');break;default:}_0x48ee05[_0xc385('0x6a')]=(_0x3f900d===_0xc385('0x6b')?moment(_0x53456e[_0xc385('0x63')])['format'](_0xc385('0x62')):moment(_0x53456e['agentcalledAt'])[_0xc385('0x5e')](_0xc385('0x62')))||moment()[_0xc385('0x5e')](_0xc385('0x62'));_0x48ee05[_0xc385('0x6c')]=_0x3f900d||_0xc385('0x6d');_0x48ee05=_['merge'](_0x48ee05,getCustomFields(_0x328668[_0xc385('0x6e')],_0x53456e));return request({'method':_0xc385('0x1b'),'uri':_0xc385('0x46')+_0x1d3485+_0xc385('0x6f'),'headers':{'Authorization':_0xc385('0x28')+_0x305b47},'body':{'data':[_0x48ee05]},'json':!![]})['then'](function(_0x377a29){if(_0x377a29&&_0x377a29[_0xc385('0x35')][0x0][_0xc385('0x3d')]===_0xc385('0x3e')){logger['info'](_0xc385('0x70'));return{'id':_0x377a29[_0xc385('0x35')][0x0][_0xc385('0x3f')]['id']};}})[_0xc385('0x36')](function(_0xcbe7d3){logger[_0xc385('0x25')](_0xc385('0x71'),_0xcbe7d3['stack']);console[_0xc385('0x42')](_0xc385('0x71'),_0xcbe7d3);});}exports['queue']=function(_0x58d190,_0x2535c1,_0x3068ac,_0x1d475e,_0x5aebdb,_0x2b9acd){var _0x461d31,_0x1e8e65,_0x2f3d67;_0x2b9acd[_0xc385('0x72')]=intUtil[_0xc385('0x73')](_0x2b9acd['host']);_0x2b9acd[_0xc385('0x74')]=intUtil[_0xc385('0x73')](_0x2b9acd['serverUrl']);if(_0x5aebdb&&_0x5aebdb[_0xc385('0x75')]){logger[_0xc385('0x25')](_0xc385('0x76'),'Recording\x20is\x20enabled!');_0x2535c1[_0xc385('0x77')]=_0x2b9acd['serverUrl']+_0xc385('0x78')+_0x2535c1[_0xc385('0x79')]+_0xc385('0x7a')+md5(_0x2535c1[_0xc385('0x79')]);}else{_0x2535c1[_0xc385('0x77')]='';}var _0x1752d3=_0x2b9acd['host']===_0xc385('0x7b')?'eu':_0xc385('0x7c');return getAccessToken(_0x2b9acd)[_0xc385('0x1f')](function(_0x317e59){_0x2f3d67=_0x317e59;return getUser(_0x2f3d67,_0x1752d3,_0x2b9acd,_0x1d475e[_0xc385('0x2c')]);})[_0xc385('0x1f')](function(_0x3aee04){_0x461d31=_0x3aee04;logger['info'](_0xc385('0x7d'),_0x461d31['id']);return getEndUser(_0x2f3d67,_0x1752d3,_0x2b9acd,_0x2535c1['calleridname'],_0x2535c1[_0xc385('0x7e')],_0x461d31,_0x3068ac);})[_0xc385('0x1f')](function(_0x29ebce){_0x1e8e65=_0x29ebce;return getCall(_0x2f3d67,_0x1752d3,_0x2b9acd,_0x461d31,_0x1e8e65,_0x3068ac,_0x2535c1,'Inbound');})[_0xc385('0x1f')](function(_0x58325e){if(_0x58325e){logger[_0xc385('0x25')]('The\x20Call\x20ID\x20is:',_0x58325e['id']);logger[_0xc385('0x25')](_0xc385('0x76'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xc385('0x7f'),_0x1d475e[_0xc385('0x12')]),_0xc385('0x80'),{'uri':'https://crm.'+_0x2b9acd['host']+_0xc385('0x81')+_0x58325e['id']});}})[_0xc385('0x36')](function(_0x4149cf){logger['error'](_0xc385('0x76'),JSON[_0xc385('0xa')](_0x4149cf));});};exports[_0xc385('0x6b')]=function(_0x1c9838,_0x4008d3,_0x5a1616,_0x1f280c,_0x77f78,_0x1afc0d,_0xb5ebd2){var _0x185335,_0x14c50e,_0x3b3c2f;_0x1afc0d[_0xc385('0x72')]=intUtil['stripTrailingSlash'](_0x1afc0d[_0xc385('0x72')]);_0x1afc0d['serverUrl']=intUtil['stripTrailingSlash'](_0x1afc0d[_0xc385('0x74')]);if(_0xb5ebd2&&_0xb5ebd2[_0xc385('0x82')]&&_0xb5ebd2['recordingFormat']!==_0xc385('0x83')){logger[_0xc385('0x25')](_0xc385('0x84'),_0xc385('0x85'));_0x4008d3[_0xc385('0x77')]=_0x1afc0d[_0xc385('0x74')]+'/api/voice/recordings/'+_0x4008d3['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x4008d3[_0xc385('0x79')]);}var _0x3de327=_0x1afc0d['host']===_0xc385('0x7b')?'eu':_0xc385('0x7c');return getAccessToken(_0x1afc0d)['then'](function(_0x34a3aa){_0x3b3c2f=_0x34a3aa;return getUser(_0x3b3c2f,_0x3de327,_0x1afc0d,_0x1f280c[_0xc385('0x2c')]);})['then'](function(_0x528a51){_0x185335=_0x528a51;logger[_0xc385('0x25')](_0xc385('0x7d'),_0x185335['id']);return getEndUser(_0x3b3c2f,_0x3de327,_0x1afc0d,_0x4008d3[_0xc385('0x86')],_0x4008d3[_0xc385('0x87')],_0x185335,_0x5a1616);})[_0xc385('0x1f')](function(_0x2693fa){_0x14c50e=_0x2693fa;return getCall(_0x3b3c2f,_0x3de327,_0x1afc0d,_0x185335,_0x14c50e,_0x5a1616,_0x4008d3,_0xc385('0x88'));})[_0xc385('0x1f')](function(_0x396af7){if(_0x396af7){logger[_0xc385('0x25')]('The\x20Call\x20ID\x20is:',_0x396af7['id']);logger[_0xc385('0x25')](_0xc385('0x84'),_0xc385('0x89'));emit(util[_0xc385('0x5e')]('user:%s',_0x1f280c[_0xc385('0x12')]),_0xc385('0x80'),{'uri':_0xc385('0x8a')+_0x1afc0d[_0xc385('0x72')]+_0xc385('0x81')+_0x396af7['id']});}})[_0xc385('0x36')](function(_0x2f5143){logger['error'](_0xc385('0x84'),JSON[_0xc385('0xa')](_0x2f5143));});};exports['abandoned']=function(_0x16eca2,_0x392975,_0x477026,_0x59c666,_0x494b10,_0x28215c){var _0x44afb4,_0x5b2b67,_0x32f187;_0x28215c[_0xc385('0x72')]=intUtil[_0xc385('0x73')](_0x28215c[_0xc385('0x72')]);_0x28215c[_0xc385('0x74')]=intUtil[_0xc385('0x73')](_0x28215c[_0xc385('0x74')]);if(_0x494b10&&_0x494b10[_0xc385('0x75')]){logger['info'](_0xc385('0x8b'),_0xc385('0x85'));_0x392975['recordingURL']=_0x28215c[_0xc385('0x74')]+_0xc385('0x78')+_0x392975['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x392975['uniqueid']);}else{_0x392975['recordingURL']='';}var _0x4d28cc=_0x28215c[_0xc385('0x72')]===_0xc385('0x7b')?'eu':'com';return getAccessToken(_0x28215c)[_0xc385('0x1f')](function(_0x5d309e){_0x32f187=_0x5d309e;return getUser(_0x32f187,_0x4d28cc,_0x28215c);})[_0xc385('0x1f')](function(_0xd3f0e0){_0x44afb4=_0xd3f0e0;logger['info'](_0xc385('0x7d'),_0x44afb4['id']);return getEndUser(_0x32f187,_0x4d28cc,_0x28215c,_0x392975[_0xc385('0x8c')],_0x392975[_0xc385('0x7e')],_0x44afb4,_0x477026);})[_0xc385('0x1f')](function(_0x5afaab){_0x5b2b67=_0x5afaab;return getCall(_0x32f187,_0x4d28cc,_0x28215c,_0x44afb4,_0x5b2b67,_0x477026,_0x392975,'Inbound');})[_0xc385('0x1f')](function(_0x5047b6){if(_0x5047b6){logger['info'](_0xc385('0x8d'),_0x5047b6['id']);}})[_0xc385('0x36')](function(_0x585807){logger[_0xc385('0x34')](_0xc385('0x8b'),JSON[_0xc385('0xa')](_0x585807));});}; \ 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 4555d7e..31ae213 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(_0x189f04,_0x35bd3d){var _0x3dbf9d=function(_0x5c2dbe){while(--_0x5c2dbe){_0x189f04['push'](_0x189f04['shift']());}};_0x3dbf9d(++_0x35bd3d);}(_0x7a54,0x106));var _0x47a5=function(_0x234e35,_0xf5680e){_0x234e35=_0x234e35-0x0;var _0x170c0c=_0x7a54[_0x234e35];return _0x170c0c;};'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(_0x4db477,_0x1f327e){var _0x4edc81=function(_0x3ad2dc){while(--_0x3ad2dc){_0x4db477['push'](_0x4db477['shift']());}};_0x4edc81(++_0x1f327e);}(_0x7a54,0x106));var _0x47a5=function(_0x328059,_0x55f72f){_0x328059=_0x328059-0x0;var _0x262876=_0x7a54[_0x328059];return _0x262876;};'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 dfb1710..1b88382 100644 --- a/server/services/ami/trigger/urlforward/index.js +++ b/server/services/ami/trigger/urlforward/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['number','headers','data6','parse','error','stack','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','data1','statusCode','name','message','request-promise','lodash','mustache','../../../../config/logger','exec','toUpperCase','render','data5'];(function(_0x290adf,_0xf515ff){var _0x574426=function(_0x46a542){while(--_0x46a542){_0x290adf['push'](_0x290adf['shift']());}};_0x574426(++_0xf515ff);}(_0xb10b,0x12a));var _0xbb10=function(_0x13610a,_0x4f866c){_0x13610a=_0x13610a-0x0;var _0x150ecc=_0xb10b[_0x13610a];return _0x150ecc;};'use strict';var rp=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var Mustache=require(_0xbb10('0x2'));var logger=require(_0xbb10('0x3'))('trigger');exports[_0xbb10('0x4')]=function(_0x9bbed,_0x460981){var _0x22320e,_0x49baf4;var _0x312b72={'method':_0x9bbed['data1'][_0xbb10('0x5')](),'uri':Mustache[_0xbb10('0x6')](_0x9bbed['data2'],_0x460981),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x9bbed[_0xbb10('0x7')])===_0xbb10('0x8')&&parseInt(_0x9bbed[_0xbb10('0x7')])>=0x1&&parseInt(_0x9bbed[_0xbb10('0x7')])<=0xa?parseInt(_0x9bbed[_0xbb10('0x7')])*0x3e8:0x5*0x3e8};try{_0x312b72[_0xbb10('0x9')]=_0x9bbed[_0xbb10('0xa')]?JSON[_0xbb10('0xb')](Mustache['render'](_0x9bbed['data6'],_0x460981)):{};}catch(_0x20bd61){logger[_0xbb10('0xc')](_0x20bd61[_0xbb10('0xd')]);}switch(_0x9bbed['data1'][_0xbb10('0x5')]()){case'GET':case _0xbb10('0xe'):_0x22320e=null;_0x312b72['qs']=_0x460981;break;case _0xbb10('0xf'):case _0xbb10('0x10'):if(_0x9bbed[_0xbb10('0x11')]){try{_0x22320e=JSON[_0xbb10('0xb')](Mustache[_0xbb10('0x6')](_0x9bbed['data7'],_0x460981));_0x312b72[_0xbb10('0x12')]=_0x22320e;}catch(_0x42d7e4){logger[_0xbb10('0xc')](_0x42d7e4[_0xbb10('0xd')]);logger[_0xbb10('0xc')](_0xbb10('0x13'));}}else{_0x22320e=_0x460981;_0x312b72[_0xbb10('0x12')]=_0x22320e;}break;}logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x16'),_0x9bbed['data1'],_0x9bbed[_0xbb10('0x17')],JSON[_0xbb10('0x18')](_0x312b72)));rp(_0x312b72)[_0xbb10('0x19')](function(_0x42db98){_0x22320e=!_[_0xbb10('0x1a')](_0x22320e)?_0xbb10('0x1b')+_0x22320e:'';_0x49baf4=typeof _0x42db98[_0xbb10('0x12')]===_0xbb10('0x1c')?JSON[_0xbb10('0x18')](_0x42db98[_0xbb10('0x12')]):_0x42db98['body'];logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x1d'),_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x42db98[_0xbb10('0x1f')],_0x49baf4));})['catch'](function(_0x12f888){logger[_0xbb10('0xc')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x12f888[_0xbb10('0x1f')],_0x12f888[_0xbb10('0x20')],_0x12f888[_0xbb10('0x21')]));});}; \ No newline at end of file +var _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(_0x2e753d,_0x3068a0){var _0x234788=function(_0x185e66){while(--_0x185e66){_0x2e753d['push'](_0x2e753d['shift']());}};_0x234788(++_0x3068a0);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2f7cc0,_0xa7ddc9){_0x2f7cc0=_0x2f7cc0-0x0;var _0x42ac73=_0x5f2f[_0x2f7cc0];return _0x42ac73;};'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 00bae50..8c706c4 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 _0x9ade=['message','result','catch','jayson/promise','bluebird','client','Request','request','then','debug','rpc','routing','error'];(function(_0x1a7b96,_0x3dff24){var _0x396926=function(_0x3546b1){while(--_0x3546b1){_0x1a7b96['push'](_0x1a7b96['shift']());}};_0x396926(++_0x3dff24);}(_0x9ade,0x107));var _0xe9ad=function(_0x5d1d9f,_0x1ef696){_0x5d1d9f=_0x5d1d9f-0x0;var _0x2faa8e=_0x9ade[_0x5d1d9f];return _0x2faa8e;};'use strict';var jayson=require(_0xe9ad('0x0'));var BPromise=require(_0xe9ad('0x1'));var logger=require('../../config/logger')('routing');var client=jayson[_0xe9ad('0x2')]['http']({'port':0x2329});client[_0xe9ad('0x3')]=function(_0x38d722,_0x4d4ee0){return new BPromise(function(_0x52984f,_0x36e151){return client[_0xe9ad('0x4')](_0x38d722,_0x4d4ee0)[_0xe9ad('0x5')](function(_0x3e4092){logger[_0xe9ad('0x6')](_0xe9ad('0x7'),_0xe9ad('0x8'),_0x38d722,_0x4d4ee0,_0x3e4092);if(_0x3e4092[_0xe9ad('0x9')]){logger['error'](_0xe9ad('0x7'),_0xe9ad('0x8'),_0x38d722,_0x3e4092[_0xe9ad('0x9')][_0xe9ad('0xa')],_0x4d4ee0);return _0x36e151(_0x3e4092[_0xe9ad('0x9')][_0xe9ad('0xa')]);}else{return _0x52984f(_0x3e4092[_0xe9ad('0xb')]);}})[_0xe9ad('0xc')](function(_0x2d1ed2){logger[_0xe9ad('0x9')](_0xe9ad('0x7'),_0xe9ad('0x8'),_0x38d722,_0x2d1ed2,_0x4d4ee0);return _0x36e151(_0x2d1ed2);});});};module['exports']=client; \ No newline at end of file +var _0x295f=['Request','request','then','rpc','error','message','result','catch','exports','bluebird','../../config/logger','routing','http'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x295f,0x168));var _0xf295=function(_0x2509c1,_0x5ab7c1){_0x2509c1=_0x2509c1-0x0;var _0xb127db=_0x295f[_0x2509c1];return _0xb127db;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xf295('0x0'));var logger=require(_0xf295('0x1'))(_0xf295('0x2'));var client=jayson['client'][_0xf295('0x3')]({'port':0x2329});client[_0xf295('0x4')]=function(_0x59a1c5,_0x511ab5){return new BPromise(function(_0x269439,_0x21da99){return client[_0xf295('0x5')](_0x59a1c5,_0x511ab5)[_0xf295('0x6')](function(_0x36b69d){logger['debug'](_0xf295('0x7'),_0xf295('0x2'),_0x59a1c5,_0x511ab5,_0x36b69d);if(_0x36b69d[_0xf295('0x8')]){logger[_0xf295('0x8')](_0xf295('0x7'),_0xf295('0x2'),_0x59a1c5,_0x36b69d[_0xf295('0x8')][_0xf295('0x9')],_0x511ab5);return _0x21da99(_0x36b69d[_0xf295('0x8')][_0xf295('0x9')]);}else{return _0x269439(_0x36b69d[_0xf295('0xa')]);}})[_0xf295('0xb')](function(_0x5ae127){logger[_0xf295('0x8')](_0xf295('0x7'),'routing',_0x59a1c5,_0x5ae127,_0x511ab5);return _0x21da99(_0x5ae127);});});};module[_0xf295('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index d36069d..f105f9d 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 _0xfc76=['Setting','findOne','loginMailFrequency','catch','log','./server','./realtime','./lib/email','./rpc/mailAccount','../../mysqldb','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen'];(function(_0x7b4397,_0x50ab04){var _0x16de0b=function(_0x26a130){while(--_0x26a130){_0x7b4397['push'](_0x7b4397['shift']());}};_0x16de0b(++_0x50ab04);}(_0xfc76,0xb5));var _0x6fc7=function(_0x5de99d,_0x5f5180){_0x5de99d=_0x5de99d-0x0;var _0x2b36bd=_0xfc76[_0x5de99d];return _0x2b36bd;};'use strict';var BPromise=require('bluebird');var server=require(_0x6fc7('0x0'));var Realtime=require(_0x6fc7('0x1'));var EmailChannel=require(_0x6fc7('0x2'));var mailAccount=require(_0x6fc7('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x6fc7('0x4'))['db'];function initRealtime(){return BPromise['resolve']()[_0x6fc7('0x5')](mailAccount[_0x6fc7('0x6')]())['then'](realtime[_0x6fc7('0x7')]())['then'](function(){email[_0x6fc7('0x8')](realtime[_0x6fc7('0x9')]);return realtime;});}function main(){return server[_0x6fc7('0xa')](realtime,email)['then'](function(_0x21a64d){return initRealtime();})[_0x6fc7('0x5')](function(_0x347c00){return db[_0x6fc7('0xb')][_0x6fc7('0xc')]({'attributes':['id',_0x6fc7('0xd')],'raw':!![]});})['then'](function(_0xdddc47){return setInterval(initRealtime,_0xdddc47[_0x6fc7('0xd')]*0x3e8);})[_0x6fc7('0xe')](function(_0x20d043){console[_0x6fc7('0xf')](_0x20d043);});}main(); \ No newline at end of file +var _0x5697=['./rpc/mailAccount','initMailAccounts','listen','then','Setting','loginMailFrequency','catch','log','bluebird','./realtime','./lib/email'];(function(_0x4a94b1,_0x4f2518){var _0x20949f=function(_0x1c4aa6){while(--_0x1c4aa6){_0x4a94b1['push'](_0x4a94b1['shift']());}};_0x20949f(++_0x4f2518);}(_0x5697,0x1b5));var _0x7569=function(_0x559a80,_0x3d193d){_0x559a80=_0x559a80-0x0;var _0x42f555=_0x5697[_0x559a80];return _0x42f555;};'use strict';var BPromise=require(_0x7569('0x0'));var server=require('./server');var Realtime=require(_0x7569('0x1'));var EmailChannel=require(_0x7569('0x2'));var mailAccount=require(_0x7569('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require('../../mysqldb')['db'];function initRealtime(){return BPromise['resolve']()['then'](mailAccount['getMailAccounts']())['then'](realtime[_0x7569('0x4')]())['then'](function(){email['refresh'](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x7569('0x5')](realtime,email)[_0x7569('0x6')](function(_0x30b7e2){return initRealtime();})[_0x7569('0x6')](function(_0x3c0470){return db[_0x7569('0x7')]['findOne']({'attributes':['id',_0x7569('0x8')],'raw':!![]});})['then'](function(_0x9458b7){return setInterval(initRealtime,_0x9458b7[_0x7569('0x8')]*0x3e8);})[_0x7569('0x9')](function(_0xa4f75a){console[_0x7569('0xa')](_0xa4f75a);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 386d4e8..8f182dc 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 _0xf586=['handleImapBox','handleImapEmail','bind','handleImapEnd','error','handleImapError','isNil','disabled','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','notify','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','verifySmtp','Smtp','verify','verified','catch','exports','moment','bluebird','md5','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','Imap','status','messageStatus','total','stringify','hasOwnProperty','active','box'];(function(_0x2a56ad,_0x2b94bf){var _0x425175=function(_0x342f20){while(--_0x342f20){_0x2a56ad['push'](_0x2a56ad['shift']());}};_0x425175(++_0x2b94bf);}(_0xf586,0x15d));var _0x6f58=function(_0x55c8e3,_0x4addd4){_0x55c8e3=_0x55c8e3-0x0;var _0x7e6c2c=_0xf586[_0x55c8e3];return _0x7e6c2c;};'use strict';var _=require('lodash');var moment=require(_0x6f58('0x0'));var BPromise=require(_0x6f58('0x1'));var md5=require(_0x6f58('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x6f58('0x3'))(_0x6f58('0x4'));config[_0x6f58('0x5')]=_[_0x6f58('0x6')](config[_0x6f58('0x5')],{'host':_0x6f58('0x7'),'port':0x18eb});var io=require(_0x6f58('0x8'))(new Redis(config[_0x6f58('0x5')]));var EmailImap=require(_0x6f58('0x9'));var EmailSmtp=require(_0x6f58('0xa'));var mailAccount=require(_0x6f58('0xb'));var md5Accounts={};function EmailChannel(_0x59b6f3){logger[_0x6f58('0xc')](_0x6f58('0xd'));this[_0x6f58('0xe')]=_0x59b6f3[_0x6f58('0xe')];this[_0x6f58('0xf')]={};this[_0x6f58('0x10')]=new EmailSmtp();}EmailChannel[_0x6f58('0x11')][_0x6f58('0x12')]=function(_0x244879){var _0x30dce9=this[_0x6f58('0xe')][_0x244879];var _0x3c19a6={'id':_0x30dce9['id'],'name':_0x30dce9[_0x6f58('0x13')],'key':_0x30dce9[_0x6f58('0x14')],'active':_0x30dce9['active'],'Imap':{'status':_0x30dce9[_0x6f58('0x15')][_0x6f58('0x16')],'messageStatus':_0x30dce9['Imap'][_0x6f58('0x17')],'total':_0x30dce9[_0x6f58('0x15')][_0x6f58('0x18')]}};if(_['isNil'](md5Accounts[_0x244879])){md5Accounts[_0x244879]={};}var _0x4b26bd=md5(JSON[_0x6f58('0x19')](_0x3c19a6));if(md5Accounts[_0x244879]['md5']!==_0x4b26bd){md5Accounts[_0x244879]['md5']=_0x4b26bd;io[_0x6f58('0x12')]('mailAccount:update',_0x3c19a6);}};EmailChannel[_0x6f58('0x11')]['refresh']=function(_0x4e21a2){for(var _0x254fde in _0x4e21a2){if(_0x4e21a2[_0x6f58('0x1a')](_0x254fde)){if(_0x4e21a2[_0x254fde][_0x6f58('0x15')]&&_0x4e21a2[_0x254fde][_0x6f58('0x1b')]){var _0x2c980f=_0x4e21a2[_0x254fde]['Imap'];if(!this[_0x6f58('0xf')]['hasOwnProperty'](_0x2c980f['id'])){this[_0x6f58('0xf')][_0x2c980f['id']]=new EmailImap(_0x2c980f,_0x4e21a2[_0x254fde]['email']);this[_0x6f58('0xf')][_0x2c980f['id']]['on'](_0x6f58('0x1c'),this[_0x6f58('0x1d')]['bind'](this,_0x254fde));this[_0x6f58('0xf')][_0x2c980f['id']]['on'](_0x6f58('0x4'),this[_0x6f58('0x1e')][_0x6f58('0x1f')](this,_0x254fde));this['imapAccounts'][_0x2c980f['id']]['on']('end',this[_0x6f58('0x20')]['bind'](this,_0x254fde));this[_0x6f58('0xf')][_0x2c980f['id']]['on'](_0x6f58('0x21'),this[_0x6f58('0x22')][_0x6f58('0x1f')](this,_0x254fde));}}else{if(_[_0x6f58('0x23')](this[_0x6f58('0xe')][_0x254fde]['Imap'])){this['mailAccounts'][_0x254fde][_0x6f58('0x15')]={};}this[_0x6f58('0xe')][_0x254fde][_0x6f58('0x15')][_0x6f58('0x16')]=_0x6f58('0x24');this[_0x6f58('0xe')][_0x254fde][_0x6f58('0x15')]['messageStatus']='';this['emit'](_0x254fde);}}}};EmailChannel[_0x6f58('0x11')]['handleImapBox']=function(_0x36aca0,_0x4f6c9d){if(this[_0x6f58('0xe')][_0x36aca0]){this['mailAccounts'][_0x36aca0][_0x6f58('0x15')][_0x6f58('0x16')]='connected';this[_0x6f58('0xe')][_0x36aca0][_0x6f58('0x15')][_0x6f58('0x17')]=_0x4f6c9d[_0x6f58('0x13')];if(_0x4f6c9d[_0x6f58('0x25')]){this['mailAccounts'][_0x36aca0]['Imap']['total']=_0x4f6c9d['messages'][_0x6f58('0x18')];}return this[_0x6f58('0x12')](_0x36aca0);}};EmailChannel[_0x6f58('0x11')][_0x6f58('0x1e')]=function(_0x7f1b1a,_0x28af39){logger[_0x6f58('0xc')](_0x6f58('0x26'),_0x28af39[_0x6f58('0x27')],_0x28af39[_0x6f58('0x28')],_0x28af39['from'],_0x7f1b1a);if(this[_0x6f58('0xe')][_0x7f1b1a]){return mailAccount[_0x6f58('0x29')](_0x7f1b1a,_0x28af39)[_0x6f58('0x2a')](function(_0x372904){if(_0x372904){logger['info'](_0x6f58('0x2b'));}})['catch'](function(_0x4f03ac){logger[_0x6f58('0x21')](_0x6f58('0x2c'),JSON[_0x6f58('0x19')](_0x4f03ac));});}};EmailChannel['prototype'][_0x6f58('0x20')]=function(_0x11f8f5){if(this['mailAccounts'][_0x11f8f5]&&this[_0x6f58('0xe')][_0x11f8f5][_0x6f58('0x15')]){if(this[_0x6f58('0xf')][this[_0x6f58('0xe')][_0x11f8f5][_0x6f58('0x15')]['id']]){delete this[_0x6f58('0xf')][this['mailAccounts'][_0x11f8f5]['Imap']['id']];}this['mailAccounts'][_0x11f8f5]['Imap'][_0x6f58('0x2d')]=moment();this['emit'](_0x11f8f5);}};EmailChannel['prototype']['handleImapError']=function(_0x55b652,_0x5011f6){if(this[_0x6f58('0xe')][_0x55b652]){this[_0x6f58('0xe')][_0x55b652][_0x6f58('0x15')][_0x6f58('0x16')]='error';this[_0x6f58('0xe')][_0x55b652]['Imap'][_0x6f58('0x17')]=_0x5011f6;return this[_0x6f58('0x12')](_0x55b652);}};EmailChannel[_0x6f58('0x11')][_0x6f58('0x2e')]=function(_0x135923,_0x3e0491){return this[_0x6f58('0x10')][_0x6f58('0x2f')](_0x135923,_0x3e0491);};EmailChannel['prototype'][_0x6f58('0x30')]=function(_0x3b0e06){var _0x2e055e=this;if(this[_0x6f58('0xe')][_0x3b0e06['id']]){if(_[_0x6f58('0x23')](this['mailAccounts'][_0x3b0e06['id']][_0x6f58('0x31')])){this[_0x6f58('0xe')][_0x3b0e06['id']][_0x6f58('0x31')]={};}this[_0x6f58('0xe')][_0x3b0e06['id']][_0x6f58('0x31')][_0x6f58('0x2d')]=moment();return new BPromise(function(_0x1f5952,_0x8f3647){return _0x2e055e[_0x6f58('0x10')][_0x6f58('0x32')](_0x3b0e06)[_0x6f58('0x2a')](function(_0x4fb3c2){_0x2e055e[_0x6f58('0xe')][_0x3b0e06['id']][_0x6f58('0x31')]['status']=_0x6f58('0x33');_0x2e055e[_0x6f58('0xe')][_0x3b0e06['id']]['Smtp'][_0x6f58('0x17')]='';_0x2e055e[_0x6f58('0x12')](_0x3b0e06['id']);_0x1f5952(_0x4fb3c2);})[_0x6f58('0x34')](function(_0x188ec0){_0x2e055e[_0x6f58('0xe')][_0x3b0e06['id']]['Smtp'][_0x6f58('0x16')]=_0x6f58('0x21');_0x2e055e[_0x6f58('0xe')][_0x3b0e06['id']]['Smtp'][_0x6f58('0x17')]=_0x188ec0;_0x2e055e[_0x6f58('0x12')](_0x3b0e06['id']);_0x8f3647(_0x188ec0);});});}return this[_0x6f58('0x10')][_0x6f58('0x32')](_0x3b0e06);};module[_0x6f58('0x35')]=EmailChannel; \ No newline at end of file +var _0xc0f9=['info','mailAccounts','smtp','prototype','name','key','active','Imap','status','messageStatus','isNil','md5','emit','mailAccount:update','hasOwnProperty','imapAccounts','box','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','disabled','handleImapBox','connected','total','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','notify','catch','stringify','send','verifySmtp','Smtp','verify','verified','lodash','bluebird','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','socket.io-emitter','./imap','./smtp','../rpc/mailAccount'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc0f9,0x1f2));var _0x9c0f=function(_0x4ffa03,_0x363a82){_0x4ffa03=_0x4ffa03-0x0;var _0x30d661=_0xc0f9[_0x4ffa03];return _0x30d661;};'use strict';var _=require(_0x9c0f('0x0'));var moment=require('moment');var BPromise=require(_0x9c0f('0x1'));var md5=require('md5');var Redis=require(_0x9c0f('0x2'));var config=require(_0x9c0f('0x3'));var logger=require(_0x9c0f('0x4'))(_0x9c0f('0x5'));config[_0x9c0f('0x6')]=_[_0x9c0f('0x7')](config[_0x9c0f('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x9c0f('0x8'))(new Redis(config['redis']));var EmailImap=require(_0x9c0f('0x9'));var EmailSmtp=require(_0x9c0f('0xa'));var mailAccount=require(_0x9c0f('0xb'));var md5Accounts={};function EmailChannel(_0x16f921){logger[_0x9c0f('0xc')]('start\x20email\x20channel');this[_0x9c0f('0xd')]=_0x16f921[_0x9c0f('0xd')];this['imapAccounts']={};this[_0x9c0f('0xe')]=new EmailSmtp();}EmailChannel[_0x9c0f('0xf')]['emit']=function(_0x3bdeea){var _0x306cfd=this[_0x9c0f('0xd')][_0x3bdeea];var _0x1434f7={'id':_0x306cfd['id'],'name':_0x306cfd[_0x9c0f('0x10')],'key':_0x306cfd[_0x9c0f('0x11')],'active':_0x306cfd[_0x9c0f('0x12')],'Imap':{'status':_0x306cfd[_0x9c0f('0x13')][_0x9c0f('0x14')],'messageStatus':_0x306cfd[_0x9c0f('0x13')][_0x9c0f('0x15')],'total':_0x306cfd[_0x9c0f('0x13')]['total']}};if(_[_0x9c0f('0x16')](md5Accounts[_0x3bdeea])){md5Accounts[_0x3bdeea]={};}var _0x1d5699=md5(JSON['stringify'](_0x1434f7));if(md5Accounts[_0x3bdeea][_0x9c0f('0x17')]!==_0x1d5699){md5Accounts[_0x3bdeea][_0x9c0f('0x17')]=_0x1d5699;io[_0x9c0f('0x18')](_0x9c0f('0x19'),_0x1434f7);}};EmailChannel[_0x9c0f('0xf')]['refresh']=function(_0x517527){for(var _0x1e6adb in _0x517527){if(_0x517527[_0x9c0f('0x1a')](_0x1e6adb)){if(_0x517527[_0x1e6adb][_0x9c0f('0x13')]&&_0x517527[_0x1e6adb][_0x9c0f('0x12')]){var _0x553728=_0x517527[_0x1e6adb][_0x9c0f('0x13')];if(!this[_0x9c0f('0x1b')][_0x9c0f('0x1a')](_0x553728['id'])){this[_0x9c0f('0x1b')][_0x553728['id']]=new EmailImap(_0x553728,_0x517527[_0x1e6adb][_0x9c0f('0x5')]);this['imapAccounts'][_0x553728['id']]['on'](_0x9c0f('0x1c'),this['handleImapBox'][_0x9c0f('0x1d')](this,_0x1e6adb));this[_0x9c0f('0x1b')][_0x553728['id']]['on'](_0x9c0f('0x5'),this[_0x9c0f('0x1e')]['bind'](this,_0x1e6adb));this[_0x9c0f('0x1b')][_0x553728['id']]['on'](_0x9c0f('0x1f'),this[_0x9c0f('0x20')]['bind'](this,_0x1e6adb));this[_0x9c0f('0x1b')][_0x553728['id']]['on'](_0x9c0f('0x21'),this[_0x9c0f('0x22')]['bind'](this,_0x1e6adb));}}else{if(_[_0x9c0f('0x16')](this['mailAccounts'][_0x1e6adb]['Imap'])){this[_0x9c0f('0xd')][_0x1e6adb][_0x9c0f('0x13')]={};}this[_0x9c0f('0xd')][_0x1e6adb]['Imap'][_0x9c0f('0x14')]=_0x9c0f('0x23');this[_0x9c0f('0xd')][_0x1e6adb]['Imap'][_0x9c0f('0x15')]='';this[_0x9c0f('0x18')](_0x1e6adb);}}}};EmailChannel[_0x9c0f('0xf')][_0x9c0f('0x24')]=function(_0x29e9db,_0x2ef1ad){if(this[_0x9c0f('0xd')][_0x29e9db]){this[_0x9c0f('0xd')][_0x29e9db][_0x9c0f('0x13')]['status']=_0x9c0f('0x25');this['mailAccounts'][_0x29e9db][_0x9c0f('0x13')][_0x9c0f('0x15')]=_0x2ef1ad[_0x9c0f('0x10')];if(_0x2ef1ad['messages']){this[_0x9c0f('0xd')][_0x29e9db][_0x9c0f('0x13')][_0x9c0f('0x26')]=_0x2ef1ad[_0x9c0f('0x27')][_0x9c0f('0x26')];}return this[_0x9c0f('0x18')](_0x29e9db);}};EmailChannel[_0x9c0f('0xf')][_0x9c0f('0x1e')]=function(_0x2b53a1,_0x17afee){logger[_0x9c0f('0xc')](_0x9c0f('0x28'),_0x17afee[_0x9c0f('0x29')],_0x17afee['lastName'],_0x17afee[_0x9c0f('0x2a')],_0x2b53a1);if(this['mailAccounts'][_0x2b53a1]){return mailAccount[_0x9c0f('0x2b')](_0x2b53a1,_0x17afee)['then'](function(_0x561ab2){if(_0x561ab2){logger[_0x9c0f('0xc')]('Mail\x20accepted\x20from\x20routing');}})[_0x9c0f('0x2c')](function(_0x2bf9e0){logger[_0x9c0f('0x21')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x9c0f('0x2d')](_0x2bf9e0));});}};EmailChannel[_0x9c0f('0xf')][_0x9c0f('0x20')]=function(_0x2d4022){if(this[_0x9c0f('0xd')][_0x2d4022]&&this[_0x9c0f('0xd')][_0x2d4022]['Imap']){if(this[_0x9c0f('0x1b')][this[_0x9c0f('0xd')][_0x2d4022][_0x9c0f('0x13')]['id']]){delete this['imapAccounts'][this[_0x9c0f('0xd')][_0x2d4022][_0x9c0f('0x13')]['id']];}this[_0x9c0f('0xd')][_0x2d4022]['Imap']['lastSync']=moment();this['emit'](_0x2d4022);}};EmailChannel[_0x9c0f('0xf')][_0x9c0f('0x22')]=function(_0x5a8d5d,_0xe98230){if(this[_0x9c0f('0xd')][_0x5a8d5d]){this[_0x9c0f('0xd')][_0x5a8d5d][_0x9c0f('0x13')]['status']=_0x9c0f('0x21');this['mailAccounts'][_0x5a8d5d][_0x9c0f('0x13')][_0x9c0f('0x15')]=_0xe98230;return this['emit'](_0x5a8d5d);}};EmailChannel[_0x9c0f('0xf')]['sendMail']=function(_0x1f3145,_0x455ee6){return this['smtp'][_0x9c0f('0x2e')](_0x1f3145,_0x455ee6);};EmailChannel[_0x9c0f('0xf')][_0x9c0f('0x2f')]=function(_0x465aa3){var _0x1e49eb=this;if(this['mailAccounts'][_0x465aa3['id']]){if(_[_0x9c0f('0x16')](this[_0x9c0f('0xd')][_0x465aa3['id']][_0x9c0f('0x30')])){this['mailAccounts'][_0x465aa3['id']]['Smtp']={};}this[_0x9c0f('0xd')][_0x465aa3['id']][_0x9c0f('0x30')]['lastSync']=moment();return new BPromise(function(_0x436d1d,_0x4113c5){return _0x1e49eb[_0x9c0f('0xe')][_0x9c0f('0x31')](_0x465aa3)['then'](function(_0x2351f4){_0x1e49eb[_0x9c0f('0xd')][_0x465aa3['id']][_0x9c0f('0x30')]['status']=_0x9c0f('0x32');_0x1e49eb[_0x9c0f('0xd')][_0x465aa3['id']][_0x9c0f('0x30')][_0x9c0f('0x15')]='';_0x1e49eb[_0x9c0f('0x18')](_0x465aa3['id']);_0x436d1d(_0x2351f4);})['catch'](function(_0x596103){_0x1e49eb[_0x9c0f('0xd')][_0x465aa3['id']][_0x9c0f('0x30')][_0x9c0f('0x14')]=_0x9c0f('0x21');_0x1e49eb[_0x9c0f('0xd')][_0x465aa3['id']][_0x9c0f('0x30')][_0x9c0f('0x15')]=_0x596103;_0x1e49eb[_0x9c0f('0x18')](_0x465aa3['id']);_0x4113c5(_0x596103);});});}return this[_0x9c0f('0xe')]['verify'](_0x465aa3);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 74f863c..1da8717 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 _0x34b3=['account','once','ready','handleReady','bind','handleError','connect','connTimeout','authTimeout','user','password','host','port','tls','getHost','anonymous@xcally.com','prototype','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','handleReadUnseen','message','error','end','closeBox','handleFetchMessage','body','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleFetchEnd','handleFetchError','handleEnd','stringify','exports','path','util','imap','lodash','mailparser','simpleParser','iconv','events','./utils','../../../config/logger','email','mailbox','INBOX','getAccount'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x34b3,0xce));var _0x334b=function(_0x199b10,_0x3d0fb9){_0x199b10=_0x199b10-0x0;var _0x58b35b=_0x34b3[_0x199b10];return _0x58b35b;};'use strict';var fs=require('fs');var path=require(_0x334b('0x0'));var util=require(_0x334b('0x1'));var Imap=require(_0x334b('0x2'));var _=require(_0x334b('0x3'));var rs=require('randomstring');var simpleParser=require(_0x334b('0x4'))[_0x334b('0x5')];var Iconv=require(_0x334b('0x6'))['Iconv'];var EventEmitter=require(_0x334b('0x7'))['EventEmitter'];var utils=require(_0x334b('0x8'));var logger=require(_0x334b('0x9'))(_0x334b('0xa'));function EmailImap(_0x82fd36,_0x4fed9a){this[_0x334b('0xb')]=_0x334b('0xc');this['account']=this[_0x334b('0xd')](_0x82fd36,_0x4fed9a);this[_0x334b('0x2')]=new Imap(this[_0x334b('0xe')]);this[_0x334b('0x2')][_0x334b('0xf')](_0x334b('0x10'),this[_0x334b('0x11')]['bind'](this));this[_0x334b('0x2')][_0x334b('0xf')]('end',this['handleEnd'][_0x334b('0x12')](this));this[_0x334b('0x2')]['on']('error',this[_0x334b('0x13')]['bind'](this));this[_0x334b('0x2')][_0x334b('0x14')]();}util['inherits'](EmailImap,EventEmitter);EmailImap['prototype'][_0x334b('0xd')]=function(_0x20c799,_0x55b39e){var _0x30d9eb={'connTimeout':_0x20c799[_0x334b('0x15')]?_0x20c799['connTimeout']*0x3e8:0x2710,'authTimeout':_0x20c799[_0x334b('0x16')]?_0x20c799[_0x334b('0x16')]*0x3e8:0x1388};if(_['isNil'](_0x20c799['service'])){if(_0x20c799['authentication']){_0x30d9eb[_0x334b('0x17')]=_0x20c799[_0x334b('0x17')];_0x30d9eb[_0x334b('0x18')]=_0x20c799['password'];}_0x30d9eb[_0x334b('0x19')]=_0x20c799[_0x334b('0x19')];_0x30d9eb[_0x334b('0x1a')]=_0x20c799[_0x334b('0x1a')]||0x3e1;if(_0x20c799[_0x334b('0x1b')]){_0x30d9eb['tls']=!![];}else{_0x30d9eb[_0x334b('0x1b')]=![];_0x30d9eb['autotls']='required';}}else{_0x30d9eb[_0x334b('0x17')]=_0x20c799[_0x334b('0x17')];_0x30d9eb[_0x334b('0x18')]=_0x20c799[_0x334b('0x18')];_0x30d9eb[_0x334b('0x19')]=utils[_0x334b('0x1c')](_0x20c799['service']);_0x30d9eb[_0x334b('0x1a')]=0x3e1;_0x30d9eb[_0x334b('0x1b')]=!![];}_0x30d9eb[_0x334b('0xa')]=_0x55b39e||_0x20c799[_0x334b('0x17')]||_0x334b('0x1d');return _0x30d9eb;};EmailImap[_0x334b('0x1e')][_0x334b('0x11')]=function(){this[_0x334b('0x2')][_0x334b('0x1f')](this[_0x334b('0xb')],![],this[_0x334b('0x20')]['bind'](this));};EmailImap[_0x334b('0x1e')][_0x334b('0x20')]=function(_0x45decc,_0x4536fc){if(_0x45decc){this[_0x334b('0x13')](_0x45decc,!![]);}else{this[_0x334b('0x21')](_0x334b('0x22'),_0x4536fc);this[_0x334b('0x23')]();}};EmailImap[_0x334b('0x1e')][_0x334b('0x24')]=function(_0x479d0e){if(_0x479d0e){this[_0x334b('0x13')](_0x479d0e,!![]);}else{this[_0x334b('0x2')]['end']();}};EmailImap['prototype'][_0x334b('0x23')]=function(){this[_0x334b('0x2')][_0x334b('0x25')](['UNSEEN'],this[_0x334b('0x26')]['bind'](this));};EmailImap[_0x334b('0x1e')]['handleReadUnseen']=function(_0x4ee465,_0x3c476f){if(_0x4ee465){this[_0x334b('0x13')](_0x4ee465,!![]);}else{if(_0x3c476f['length']){try{var _0x2559ab=this[_0x334b('0x2')]['fetch'](_0x3c476f,{'bodies':'','markSeen':!![]});_0x2559ab['on'](_0x334b('0x27'),this['handleFetchMessage'][_0x334b('0x12')](this));_0x2559ab['once'](_0x334b('0x28'),this['handleFetchError']['bind'](this));_0x2559ab[_0x334b('0xf')](_0x334b('0x29'),this['handleFetchEnd'][_0x334b('0x12')](this));}catch(_0x4bf214){logger['error'](_0x4bf214);}}else{this[_0x334b('0x2')][_0x334b('0x2a')](!![],this[_0x334b('0x24')][_0x334b('0x12')](this));}}};EmailImap[_0x334b('0x1e')][_0x334b('0x2b')]=function(_0x47e7d7,_0x4a2166){_0x47e7d7['on'](_0x334b('0x2c'),this['handleMessageBody'][_0x334b('0x12')](this));_0x47e7d7['once'](_0x334b('0x2d'),this[_0x334b('0x2e')][_0x334b('0x12')](this));_0x47e7d7[_0x334b('0xf')]('end',this[_0x334b('0x2f')]['bind'](this));};EmailImap[_0x334b('0x1e')]['handleMessageBody']=function(_0x31a661,_0xed8e35){simpleParser(_0x31a661,{'Iconv':Iconv},this[_0x334b('0x30')][_0x334b('0x12')](this));};EmailImap[_0x334b('0x1e')][_0x334b('0x2e')]=function(_0xe58d37){};EmailImap['prototype'][_0x334b('0x2f')]=function(){};EmailImap['prototype'][_0x334b('0x30')]=function(_0x2832cb,_0x4ad702){if(_0x2832cb){logger['error'](_0x2832cb);}else{var _0x4efcfe=this;utils[_0x334b('0x31')](this[_0x334b('0xe')],_0x4ad702,function(_0x388811){_0x4efcfe['emit']('email',_0x388811);});}};EmailImap[_0x334b('0x1e')][_0x334b('0x32')]=function(){this[_0x334b('0x2')]['closeBox'](!![],this[_0x334b('0x24')][_0x334b('0x12')](this));};EmailImap[_0x334b('0x1e')][_0x334b('0x33')]=function(_0x4cc481){this['handleError'](_0x4cc481);this[_0x334b('0x2')][_0x334b('0x2a')](!![],this[_0x334b('0x24')][_0x334b('0x12')](this));};EmailImap[_0x334b('0x1e')][_0x334b('0x34')]=function(){this[_0x334b('0x21')]('end');};EmailImap[_0x334b('0x1e')]['handleError']=function(_0x1acf58,_0xd9544c){logger[_0x334b('0x28')]('handleError',this[_0x334b('0xe')]['email'],JSON[_0x334b('0x35')](_0x1acf58));var _0x5bf242='';if(_0x1acf58){if(_0x1acf58['textCode']){_0x5bf242=_0x1acf58['textCode'];}else{for(var _0x30574b in _0x1acf58){if(_0x1acf58['hasOwnProperty'](_0x30574b)){_0x5bf242+=_['upperFirst'](_0x30574b)+':\x20'+_0x1acf58[_0x30574b]+'\x0a';}}}}if(_0xd9544c){this[_0x334b('0x2')][_0x334b('0x29')]();}else{this[_0x334b('0x21')](_0x334b('0x28'),_0x5bf242);this['emit'](_0x334b('0x29'));}};module[_0x334b('0x36')]=EmailImap; \ No newline at end of file +var _0x7d91=['once','ready','handleReady','end','handleEnd','error','handleError','bind','connect','inherits','prototype','connTimeout','authTimeout','service','user','password','host','port','tls','email','anonymous@xcally.com','openBox','handleOpenBox','emit','search','UNSEEN','handleReadUnseen','fetch','message','handleFetchMessage','handleFetchError','closeBox','handleCloseBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleFetchEnd','stringify','textCode','upperFirst','util','imap','randomstring','iconv','Iconv','events','EventEmitter','../../../config/logger','mailbox','INBOX','account','getAccount'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7d91,0x17c));var _0x17d9=function(_0x1624f2,_0x4de405){_0x1624f2=_0x1624f2-0x0;var _0x8b4df8=_0x7d91[_0x1624f2];return _0x8b4df8;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x17d9('0x0'));var Imap=require(_0x17d9('0x1'));var _=require('lodash');var rs=require(_0x17d9('0x2'));var simpleParser=require('mailparser')['simpleParser'];var Iconv=require(_0x17d9('0x3'))[_0x17d9('0x4')];var EventEmitter=require(_0x17d9('0x5'))[_0x17d9('0x6')];var utils=require('./utils');var logger=require(_0x17d9('0x7'))('email');function EmailImap(_0x551a77,_0x22c4c4){this[_0x17d9('0x8')]=_0x17d9('0x9');this[_0x17d9('0xa')]=this[_0x17d9('0xb')](_0x551a77,_0x22c4c4);this['imap']=new Imap(this[_0x17d9('0xa')]);this[_0x17d9('0x1')][_0x17d9('0xc')](_0x17d9('0xd'),this[_0x17d9('0xe')]['bind'](this));this[_0x17d9('0x1')][_0x17d9('0xc')](_0x17d9('0xf'),this[_0x17d9('0x10')]['bind'](this));this[_0x17d9('0x1')]['on'](_0x17d9('0x11'),this[_0x17d9('0x12')][_0x17d9('0x13')](this));this[_0x17d9('0x1')][_0x17d9('0x14')]();}util[_0x17d9('0x15')](EmailImap,EventEmitter);EmailImap[_0x17d9('0x16')]['getAccount']=function(_0x52d69f,_0x5a0e90){var _0x153093={'connTimeout':_0x52d69f[_0x17d9('0x17')]?_0x52d69f['connTimeout']*0x3e8:0x2710,'authTimeout':_0x52d69f[_0x17d9('0x18')]?_0x52d69f[_0x17d9('0x18')]*0x3e8:0x1388};if(_['isNil'](_0x52d69f[_0x17d9('0x19')])){if(_0x52d69f['authentication']){_0x153093[_0x17d9('0x1a')]=_0x52d69f[_0x17d9('0x1a')];_0x153093[_0x17d9('0x1b')]=_0x52d69f[_0x17d9('0x1b')];}_0x153093[_0x17d9('0x1c')]=_0x52d69f[_0x17d9('0x1c')];_0x153093['port']=_0x52d69f[_0x17d9('0x1d')]||0x3e1;if(_0x52d69f['tls']){_0x153093[_0x17d9('0x1e')]=!![];}else{_0x153093[_0x17d9('0x1e')]=![];_0x153093['autotls']='required';}}else{_0x153093[_0x17d9('0x1a')]=_0x52d69f[_0x17d9('0x1a')];_0x153093[_0x17d9('0x1b')]=_0x52d69f[_0x17d9('0x1b')];_0x153093[_0x17d9('0x1c')]=utils['getHost'](_0x52d69f['service']);_0x153093[_0x17d9('0x1d')]=0x3e1;_0x153093['tls']=!![];}_0x153093[_0x17d9('0x1f')]=_0x5a0e90||_0x52d69f['user']||_0x17d9('0x20');return _0x153093;};EmailImap[_0x17d9('0x16')][_0x17d9('0xe')]=function(){this['imap'][_0x17d9('0x21')](this[_0x17d9('0x8')],![],this['handleOpenBox'][_0x17d9('0x13')](this));};EmailImap[_0x17d9('0x16')][_0x17d9('0x22')]=function(_0x1a47ba,_0x5f4171){if(_0x1a47ba){this[_0x17d9('0x12')](_0x1a47ba,!![]);}else{this[_0x17d9('0x23')]('box',_0x5f4171);this['readUnseen']();}};EmailImap[_0x17d9('0x16')]['handleCloseBox']=function(_0x37cc01){if(_0x37cc01){this[_0x17d9('0x12')](_0x37cc01,!![]);}else{this[_0x17d9('0x1')][_0x17d9('0xf')]();}};EmailImap[_0x17d9('0x16')]['readUnseen']=function(){this[_0x17d9('0x1')][_0x17d9('0x24')]([_0x17d9('0x25')],this[_0x17d9('0x26')][_0x17d9('0x13')](this));};EmailImap['prototype']['handleReadUnseen']=function(_0xc9c80,_0x13d21a){if(_0xc9c80){this[_0x17d9('0x12')](_0xc9c80,!![]);}else{if(_0x13d21a['length']){try{var _0x3b1be9=this[_0x17d9('0x1')][_0x17d9('0x27')](_0x13d21a,{'bodies':'','markSeen':!![]});_0x3b1be9['on'](_0x17d9('0x28'),this[_0x17d9('0x29')][_0x17d9('0x13')](this));_0x3b1be9['once'](_0x17d9('0x11'),this[_0x17d9('0x2a')][_0x17d9('0x13')](this));_0x3b1be9[_0x17d9('0xc')](_0x17d9('0xf'),this['handleFetchEnd']['bind'](this));}catch(_0x1df747){logger[_0x17d9('0x11')](_0x1df747);}}else{this[_0x17d9('0x1')][_0x17d9('0x2b')](!![],this[_0x17d9('0x2c')][_0x17d9('0x13')](this));}}};EmailImap[_0x17d9('0x16')][_0x17d9('0x29')]=function(_0x179916,_0x53bd8b){_0x179916['on'](_0x17d9('0x2d'),this[_0x17d9('0x2e')]['bind'](this));_0x179916[_0x17d9('0xc')](_0x17d9('0x2f'),this[_0x17d9('0x30')][_0x17d9('0x13')](this));_0x179916[_0x17d9('0xc')](_0x17d9('0xf'),this[_0x17d9('0x31')]['bind'](this));};EmailImap['prototype'][_0x17d9('0x2e')]=function(_0x292d2a,_0x1a6853){simpleParser(_0x292d2a,{'Iconv':Iconv},this[_0x17d9('0x32')]['bind'](this));};EmailImap[_0x17d9('0x16')][_0x17d9('0x30')]=function(_0x9007f1){};EmailImap[_0x17d9('0x16')][_0x17d9('0x31')]=function(){};EmailImap[_0x17d9('0x16')]['handleSimpleParser']=function(_0x3e885e,_0x596634){if(_0x3e885e){logger[_0x17d9('0x11')](_0x3e885e);}else{var _0x4d2e8c=this;utils[_0x17d9('0x33')](this[_0x17d9('0xa')],_0x596634,function(_0x236b32){_0x4d2e8c[_0x17d9('0x23')](_0x17d9('0x1f'),_0x236b32);});}};EmailImap[_0x17d9('0x16')][_0x17d9('0x34')]=function(){this[_0x17d9('0x1')][_0x17d9('0x2b')](!![],this[_0x17d9('0x2c')][_0x17d9('0x13')](this));};EmailImap['prototype'][_0x17d9('0x2a')]=function(_0x3db3b2){this[_0x17d9('0x12')](_0x3db3b2);this[_0x17d9('0x1')][_0x17d9('0x2b')](!![],this[_0x17d9('0x2c')][_0x17d9('0x13')](this));};EmailImap['prototype'][_0x17d9('0x10')]=function(){this[_0x17d9('0x23')]('end');};EmailImap[_0x17d9('0x16')][_0x17d9('0x12')]=function(_0x2a47fe,_0x4fcb84){logger[_0x17d9('0x11')](_0x17d9('0x12'),this[_0x17d9('0xa')][_0x17d9('0x1f')],JSON[_0x17d9('0x35')](_0x2a47fe));var _0x2e6c0b='';if(_0x2a47fe){if(_0x2a47fe[_0x17d9('0x36')]){_0x2e6c0b=_0x2a47fe[_0x17d9('0x36')];}else{for(var _0x258733 in _0x2a47fe){if(_0x2a47fe['hasOwnProperty'](_0x258733)){_0x2e6c0b+=_[_0x17d9('0x37')](_0x258733)+':\x20'+_0x2a47fe[_0x258733]+'\x0a';}}}}if(_0x4fcb84){this[_0x17d9('0x1')][_0x17d9('0xf')]();}else{this[_0x17d9('0x23')](_0x17d9('0x11'),_0x2e6c0b);this[_0x17d9('0x23')]('end');}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 604e136..3636161 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 _0xf62e=['toString','verify','createTransport','Not\x20verifired','exports','nodemailer','bluebird','nodemailer-plugin-inline-base64','prototype','send','use','compile'];(function(_0x2ae5c3,_0x52bd75){var _0x266d17=function(_0x5c9dc8){while(--_0x5c9dc8){_0x2ae5c3['push'](_0x2ae5c3['shift']());}};_0x266d17(++_0x52bd75);}(_0xf62e,0xe9));var _0xef62=function(_0x172f90,_0xa044a){_0x172f90=_0x172f90-0x0;var _0x216005=_0xf62e[_0x172f90];return _0x216005;};'use strict';var nodemailer=require(_0xef62('0x0'));var BPromise=require(_0xef62('0x1'));var inlineBase64=require(_0xef62('0x2'));function EmailSmtp(){}EmailSmtp[_0xef62('0x3')][_0xef62('0x4')]=function(_0x2e15ff,_0x14ce9a){return new BPromise(function(_0x1dda3e,_0x207d14){var _0x57a4e6=nodemailer['createTransport'](_0x2e15ff);_0x57a4e6[_0xef62('0x5')](_0xef62('0x6'),inlineBase64());_0x57a4e6['sendMail'](_0x14ce9a,function(_0x478203,_0x13dc76){if(_0x478203){_0x207d14(_0x478203[_0xef62('0x7')]());}else{_0x1dda3e(_0x13dc76);}});});};EmailSmtp[_0xef62('0x3')][_0xef62('0x8')]=function(_0x4ce37c){return new BPromise(function(_0x4657f1,_0x52ac70){var _0x328fde=nodemailer[_0xef62('0x9')](_0x4ce37c);_0x328fde['verify'](function(_0x2bbb38,_0x47ec1b){if(_0x2bbb38){_0x52ac70(_0x2bbb38[_0xef62('0x7')]());}else{if(_0x47ec1b){_0x4657f1(_0x47ec1b);}else{_0x52ac70(_0xef62('0xa'));}}});});};module[_0xef62('0xb')]=EmailSmtp; \ No newline at end of file +var _0xba29=['nodemailer','bluebird','nodemailer-plugin-inline-base64','send','createTransport','sendMail','verify','toString','Not\x20verifired','exports'];(function(_0x584b3e,_0x401737){var _0x5ac470=function(_0x4e4dea){while(--_0x4e4dea){_0x584b3e['push'](_0x584b3e['shift']());}};_0x5ac470(++_0x401737);}(_0xba29,0xaa));var _0x9ba2=function(_0x54c34c,_0x43a949){_0x54c34c=_0x54c34c-0x0;var _0x2f1b82=_0xba29[_0x54c34c];return _0x2f1b82;};'use strict';var nodemailer=require(_0x9ba2('0x0'));var BPromise=require(_0x9ba2('0x1'));var inlineBase64=require(_0x9ba2('0x2'));function EmailSmtp(){}EmailSmtp['prototype'][_0x9ba2('0x3')]=function(_0x273a0e,_0x27111a){return new BPromise(function(_0x13c6f0,_0x4bbbc9){var _0x158021=nodemailer[_0x9ba2('0x4')](_0x273a0e);_0x158021['use']('compile',inlineBase64());_0x158021[_0x9ba2('0x5')](_0x27111a,function(_0x181ece,_0x1c9716){if(_0x181ece){_0x4bbbc9(_0x181ece['toString']());}else{_0x13c6f0(_0x1c9716);}});});};EmailSmtp['prototype']['verify']=function(_0x4e8384){return new BPromise(function(_0x44c1f4,_0x11c539){var _0x583156=nodemailer['createTransport'](_0x4e8384);_0x583156[_0x9ba2('0x6')](function(_0x43bb49,_0xa01bde){if(_0x43bb49){_0x11c539(_0x43bb49[_0x9ba2('0x7')]());}else{if(_0xa01bde){_0x44c1f4(_0xa01bde);}else{_0x11c539(_0x9ba2('0x8'));}}});});};module[_0x9ba2('0x9')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 63a02e1..61ee8ba 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 _0xc0a7=['../../../config/environment','head','value','address','generate','@xcally.com','name','split','length','slice','join','Anonymous','pop','isEmpty','html','test','replace','body','textAsHtml','0x1?_0x154275[_0x7c0a('0x13')]():'';}return'';}function getMails(_0x13bd77,_0x44a3d7){var _0x37bfda='';for(var _0xb9895a=0x0;_0xb9895a<_0x44a3d7[_0x7c0a('0x9')][_0x7c0a('0xf')];_0xb9895a+=0x1){if(_0x44a3d7[_0x7c0a('0x9')][_0xb9895a][_0x7c0a('0xa')]!==_0x13bd77){if(!_[_0x7c0a('0x14')](_0x37bfda)){_0x37bfda+=',';}_0x37bfda+=_0x44a3d7[_0x7c0a('0x9')][_0xb9895a][_0x7c0a('0xd')]||_0x44a3d7[_0x7c0a('0x9')][_0xb9895a][_0x7c0a('0xa')]||'';_0x37bfda+='\x20<';_0x37bfda+=_0x44a3d7[_0x7c0a('0x9')][_0xb9895a]['address']?_0x44a3d7[_0x7c0a('0x9')][_0xb9895a][_0x7c0a('0xa')]:'anonymous'+random[_0x7c0a('0xb')](0x6)+_0x7c0a('0xc');_0x37bfda+='>';}}return _0x37bfda;}function parseEmail(_0x142218,_0x3f9fb5,_0x55a8e3){if(_0x3f9fb5[_0x7c0a('0x15')]){var _0x455bc6=/)<[^<]*)*<\/script>/gi;while(_0x455bc6[_0x7c0a('0x16')](_0x3f9fb5[_0x7c0a('0x15')])){_0x3f9fb5[_0x7c0a('0x15')]=_0x3f9fb5['html'][_0x7c0a('0x17')](_0x455bc6,'');}_0x55a8e3[_0x7c0a('0x18')]=_0x3f9fb5[_0x7c0a('0x15')];}else{_0x55a8e3[_0x7c0a('0x18')]=_0x3f9fb5[_0x7c0a('0x19')];}if(_0x55a8e3[_0x7c0a('0x18')]){_0x55a8e3[_0x7c0a('0x18')]=_0x55a8e3[_0x7c0a('0x18')][_0x7c0a('0x17')](/Empty\x20message

';if(_0x4129c9['Attachments']){for(var _0x85ae1a=0x0;_0x85ae1a<_0x4129c9[_0x7c0a('0x37')][_0x7c0a('0xf')];_0x85ae1a++){var _0x247054=_0x4129c9[_0x7c0a('0x37')][_0x85ae1a];_0x15351b[_0x7c0a('0x1c')][_0x7c0a('0x20')][_0x7c0a('0x29')]({'filename':_0x247054[_0x7c0a('0x38')],'content':new Buffer(_0x247054['Data'])});}}}_0x577791(parseEmail(_0x3e5f29,_0x4f3b71,_0x15351b));});}else{_0x4f3b71[_0x7c0a('0x15')]='

Empty\x20message

';_0x577791(parseEmail(_0x3e5f29,_0x4f3b71,_0x15351b));}}else{_0x577791(parseEmail(_0x3e5f29,_0x4f3b71,_0x15351b));}};exports['getHost']=function(_0x2adcff){switch(_0x2adcff){case _0x7c0a('0x39'):return'imap.gmail.com';case _0x7c0a('0x3a'):return _0x7c0a('0x3b');case _0x7c0a('0x3c'):return _0x7c0a('0x3d');case'outlook365':return _0x7c0a('0x3e');}return _0x7c0a('0x3f');}; \ No newline at end of file +var _0x3120=['Empty\x20message

','getHost','hotmail','imap-mail.outlook.com','outlook365','127.0.0.1','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','../../../config/environment','head','value','address','generate','@xcally.com','name','length','slice','join','Anonymous','split','anonymous','html','test','body','textAsHtml','replace'];(function(_0x3c7b63,_0xb89867){var _0x13a5e8=function(_0x1af52b){while(--_0x1af52b){_0x3c7b63['push'](_0x3c7b63['shift']());}};_0x13a5e8(++_0xb89867);}(_0x3120,0xef));var _0x0312=function(_0x35077f,_0x3ad6f9){_0x35077f=_0x35077f-0x0;var _0x40bd21=_0x3120[_0x35077f];return _0x40bd21;};'use strict';var _=require(_0x0312('0x0'));var moment=require(_0x0312('0x1'));var random=require(_0x0312('0x2'));var fs=require('fs');var path=require(_0x0312('0x3'));var util=require(_0x0312('0x4'));var tnef=require(_0x0312('0x5'));var logger=require(_0x0312('0x6'))('email');var config=require(_0x0312('0x7'));function getAddress(_0x5265bd){var _0x1d7589=_[_0x0312('0x8')](_0x5265bd[_0x0312('0x9')]);return _0x1d7589&&_0x1d7589[_0x0312('0xa')]?_0x1d7589[_0x0312('0xa')]:'anonymous'+random[_0x0312('0xb')](0x6)+_0x0312('0xc');}function getFirstName(_0x19eecd){var _0xf100fa=_[_0x0312('0x8')](_0x19eecd[_0x0312('0x9')]);if(_0xf100fa&&_0xf100fa['name']){var _0x5b41ad=_0xf100fa[_0x0312('0xd')]['split'](/\s+/);return _0x5b41ad[_0x0312('0xe')]?_0x5b41ad[_0x0312('0xf')](0x0,-0x1)[_0x0312('0x10')]('\x20'):_0xf100fa[_0x0312('0xd')];}return _0x0312('0x11');}function getLastName(_0x11cf22){var _0xe56b4e=_[_0x0312('0x8')](_0x11cf22['value']);if(_0xe56b4e&&_0xe56b4e[_0x0312('0xd')]){var _0x259e44=_0xe56b4e[_0x0312('0xd')][_0x0312('0x12')](/\s+/);return _0x259e44[_0x0312('0xe')]>0x1?_0x259e44['pop']():'';}return'';}function getMails(_0x921308,_0x38c202){var _0x1ff3b4='';for(var _0x4e2e72=0x0;_0x4e2e72<_0x38c202[_0x0312('0x9')][_0x0312('0xe')];_0x4e2e72+=0x1){if(_0x38c202[_0x0312('0x9')][_0x4e2e72][_0x0312('0xa')]!==_0x921308){if(!_['isEmpty'](_0x1ff3b4)){_0x1ff3b4+=',';}_0x1ff3b4+=_0x38c202['value'][_0x4e2e72][_0x0312('0xd')]||_0x38c202['value'][_0x4e2e72]['address']||'';_0x1ff3b4+='\x20<';_0x1ff3b4+=_0x38c202[_0x0312('0x9')][_0x4e2e72][_0x0312('0xa')]?_0x38c202[_0x0312('0x9')][_0x4e2e72][_0x0312('0xa')]:_0x0312('0x13')+random[_0x0312('0xb')](0x6)+_0x0312('0xc');_0x1ff3b4+='>';}}return _0x1ff3b4;}function parseEmail(_0x912e62,_0x423c78,_0x3c171e){if(_0x423c78[_0x0312('0x14')]){var _0x2e452b=/)<[^<]*)*<\/script>/gi;while(_0x2e452b[_0x0312('0x15')](_0x423c78[_0x0312('0x14')])){_0x423c78['html']=_0x423c78['html']['replace'](_0x2e452b,'');}_0x3c171e[_0x0312('0x16')]=_0x423c78[_0x0312('0x14')];}else{_0x3c171e['body']=_0x423c78[_0x0312('0x17')];}if(_0x3c171e['body']){_0x3c171e[_0x0312('0x16')]=_0x3c171e[_0x0312('0x16')][_0x0312('0x18')](/Empty\x20message

';if(_0x4697ab[_0x0312('0x39')]){for(var _0x5ee3b6=0x0;_0x5ee3b6<_0x4697ab[_0x0312('0x39')]['length'];_0x5ee3b6++){var _0x36ded0=_0x4697ab[_0x0312('0x39')][_0x5ee3b6];_0x551723['message'][_0x0312('0x1f')][_0x0312('0x3a')]({'filename':_0x36ded0[_0x0312('0x3b')],'content':new Buffer(_0x36ded0['Data'])});}}}_0x317f8f(parseEmail(_0x2cb5be,_0x107f7f,_0x551723));});}else{_0x107f7f[_0x0312('0x14')]=_0x0312('0x3c');_0x317f8f(parseEmail(_0x2cb5be,_0x107f7f,_0x551723));}}else{_0x317f8f(parseEmail(_0x2cb5be,_0x107f7f,_0x551723));}};exports[_0x0312('0x3d')]=function(_0x3292eb){switch(_0x3292eb){case'gmail':return'imap.gmail.com';case'yahoo':return'imap.mail.yahoo.com';case _0x0312('0x3e'):return _0x0312('0x3f');case _0x0312('0x40'):return'outlook.office365.com';}return _0x0312('0x41');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index a580753..24deaa0 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 _0x6410=['Imap','Smtp','exports','lodash','name','Service','key','SERV','active'];(function(_0x18546c,_0x4daf94){var _0x46ef43=function(_0x559377){while(--_0x559377){_0x18546c['push'](_0x18546c['shift']());}};_0x46ef43(++_0x4daf94);}(_0x6410,0x1ce));var _0x0641=function(_0x3ed95e,_0x2d2d13){_0x3ed95e=_0x3ed95e-0x0;var _0x4ab531=_0x6410[_0x3ed95e];return _0x4ab531;};'use strict';var _=require(_0x0641('0x0'));function MailAccount(_0x5d3144){this['id']=_0x5d3144['id']||0x0;this[_0x0641('0x1')]=_0x5d3144[_0x0641('0x1')]||_0x0641('0x2');this['key']=_0x5d3144[_0x0641('0x3')]||_0x0641('0x4');this[_0x0641('0x5')]=_0x5d3144[_0x0641('0x5')]||![];this[_0x0641('0x6')]=_0x5d3144['Imap']||[];this['Smtp']=_0x5d3144[_0x0641('0x7')]||[];}module[_0x0641('0x8')]=MailAccount; \ No newline at end of file +var _0xc55a=['Smtp','exports','lodash','name','key','SERV','active','Imap'];(function(_0xd2ba55,_0x21b25a){var _0x3f0763=function(_0x2e58d6){while(--_0x2e58d6){_0xd2ba55['push'](_0xd2ba55['shift']());}};_0x3f0763(++_0x21b25a);}(_0xc55a,0x132));var _0xac55=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0xc55a[_0x4b73a2];return _0x383c66;};'use strict';var _=require(_0xac55('0x0'));function MailAccount(_0x594a11){this['id']=_0x594a11['id']||0x0;this[_0xac55('0x1')]=_0x594a11[_0xac55('0x1')]||'Service';this[_0xac55('0x2')]=_0x594a11['key']||_0xac55('0x3');this[_0xac55('0x4')]=_0x594a11[_0xac55('0x4')]||![];this['Imap']=_0x594a11[_0xac55('0x5')]||[];this[_0xac55('0x6')]=_0x594a11[_0xac55('0x6')]||[];}module[_0xac55('0x7')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index db4e6b7..9f41a1d 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 _0x20ee=['mailAccounts','length','isUndefined','exports','../model/mailAccount','mapKeys','hasOwnProperty','prototype','mergeFromDatabase'];(function(_0x2a2cdf,_0x3f2801){var _0x5e8e12=function(_0x3cc5ef){while(--_0x3cc5ef){_0x2a2cdf['push'](_0x2a2cdf['shift']());}};_0x5e8e12(++_0x3f2801);}(_0x20ee,0x12d));var _0xe20e=function(_0xab3f9f,_0x19f868){_0xab3f9f=_0xab3f9f-0x0;var _0x25671d=_0x20ee[_0xab3f9f];return _0x25671d;};'use strict';var _=require('lodash');var MailAccount=require(_0xe20e('0x0'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x3e7197,_0x16da9d,_0x5c223a){var _0x580764=_[_0xe20e('0x1')](_0x3e7197,function(_0x1823e2,_0xa2269c){return _0x1823e2[_0x5c223a];});for(var _0x20ca61 in _0x16da9d){if(_0x16da9d[_0xe20e('0x2')](_0x20ca61)){if(!_0x580764[_0x20ca61]){delete _0x16da9d[_0x20ca61];}}}}Realtime[_0xe20e('0x3')][_0xe20e('0x4')]=function(_0x59d061,_0x472d8e){for(var _0x4a6bc0 in _0x472d8e){if(_0x59d061[_0xe20e('0x2')](_0x4a6bc0)){_0x59d061[_0x4a6bc0]=_0x472d8e[_0x4a6bc0];}}};Realtime[_0xe20e('0x3')]['initMailAccounts']=function(){var _0x183d27=this;return function(_0x5416cc){if(_0x5416cc){freeIsNotKey(_0x5416cc,_0x183d27[_0xe20e('0x5')],'id');for(var _0x167907=0x0,_0x22e784={},_0x14d96f={};_0x167907<_0x5416cc[_0xe20e('0x6')];_0x167907+=0x1){_0x22e784=_0x5416cc[_0x167907];if(_[_0xe20e('0x7')](_0x183d27[_0xe20e('0x5')][_0x22e784['id']])){_0x183d27[_0xe20e('0x5')][_0x22e784['id']]=new MailAccount(_0x22e784);}else{_['merge'](_0x183d27['mailAccounts'][_0x22e784['id']],_0x22e784);}}}return _0x183d27['mailAccounts'];};};module[_0xe20e('0x8')]=Realtime; \ No newline at end of file +var _0x8a7b=['length','isUndefined','merge','exports','lodash','mailAccounts','prototype','hasOwnProperty','initMailAccounts'];(function(_0x5c296c,_0x1d2332){var _0x716997=function(_0x389aca){while(--_0x389aca){_0x5c296c['push'](_0x5c296c['shift']());}};_0x716997(++_0x1d2332);}(_0x8a7b,0xca));var _0xb8a7=function(_0x516961,_0x35b1fc){_0x516961=_0x516961-0x0;var _0x4a70ce=_0x8a7b[_0x516961];return _0x4a70ce;};'use strict';var _=require(_0xb8a7('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0xb8a7('0x1')]={};};function freeIsNotKey(_0x53a61d,_0x431946,_0x1dc1e7){var _0x14f7fa=_['mapKeys'](_0x53a61d,function(_0x331593,_0x555d93){return _0x331593[_0x1dc1e7];});for(var _0x392313 in _0x431946){if(_0x431946['hasOwnProperty'](_0x392313)){if(!_0x14f7fa[_0x392313]){delete _0x431946[_0x392313];}}}}Realtime[_0xb8a7('0x2')]['mergeFromDatabase']=function(_0x248a6a,_0x6fa2fb){for(var _0xded3f in _0x6fa2fb){if(_0x248a6a[_0xb8a7('0x3')](_0xded3f)){_0x248a6a[_0xded3f]=_0x6fa2fb[_0xded3f];}}};Realtime['prototype'][_0xb8a7('0x4')]=function(){var _0x54f907=this;return function(_0x332212){if(_0x332212){freeIsNotKey(_0x332212,_0x54f907[_0xb8a7('0x1')],'id');for(var _0x3843a6=0x0,_0xce1ff4={},_0x14c258={};_0x3843a6<_0x332212[_0xb8a7('0x5')];_0x3843a6+=0x1){_0xce1ff4=_0x332212[_0x3843a6];if(_[_0xb8a7('0x6')](_0x54f907[_0xb8a7('0x1')][_0xce1ff4['id']])){_0x54f907['mailAccounts'][_0xce1ff4['id']]=new MailAccount(_0xce1ff4);}else{_[_0xb8a7('0x7')](_0x54f907[_0xb8a7('0x1')][_0xce1ff4['id']],_0xce1ff4);}}}return _0x54f907[_0xb8a7('0x1')];};};module[_0xb8a7('0x8')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index a571fa9..d8d3562 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 _0xafb9=['../client','getMailAccounts','Request','GetMailAccount','name','service','email','active','key','MailServerIn','MailServerOut','notify','NotifyMailAccount'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xafb9,0x68));var _0x9afb=function(_0x8d14b0,_0x3fb5de){_0x8d14b0=_0x8d14b0-0x0;var _0xe5676c=_0xafb9[_0x8d14b0];return _0xe5676c;};'use strict';var client=require(_0x9afb('0x0'));exports[_0x9afb('0x1')]=function(){return function(){return client[_0x9afb('0x2')](_0x9afb('0x3'),{'options':{'attributes':['id',_0x9afb('0x4'),_0x9afb('0x5'),_0x9afb('0x6'),_0x9afb('0x7'),_0x9afb('0x8'),'ListId','TemplateId'],'raw':![],'include':[{'model':_0x9afb('0x9'),'as':'Imap'},{'model':_0x9afb('0xa'),'as':'Smtp'}]},'log':'getMailAccount'});};};exports[_0x9afb('0xb')]=function(_0x1edf77,_0x20b8c1){return client['Request'](_0x9afb('0xc'),{'account':{'id':_0x1edf77},'body':_0x20b8c1,'log':_0x9afb('0xc')});}; \ No newline at end of file +var _0x1c88=['MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client','Request','GetMailAccount','name','active','key','ListId','TemplateId','MailServerIn','Imap'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x1c88,0x1a9));var _0x81c8=function(_0x50e593,_0x3ae998){_0x50e593=_0x50e593-0x0;var _0x3821d0=_0x1c88[_0x50e593];return _0x3821d0;};'use strict';var client=require(_0x81c8('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0x81c8('0x1')](_0x81c8('0x2'),{'options':{'attributes':['id',_0x81c8('0x3'),'service','email',_0x81c8('0x4'),_0x81c8('0x5'),_0x81c8('0x6'),_0x81c8('0x7')],'raw':![],'include':[{'model':_0x81c8('0x8'),'as':_0x81c8('0x9')},{'model':_0x81c8('0xa'),'as':_0x81c8('0xb')}]},'log':_0x81c8('0xc')});};};exports[_0x81c8('0xd')]=function(_0x191c40,_0x1ba4cb){return client[_0x81c8('0x1')]('NotifyMailAccount',{'account':{'id':_0x191c40},'body':_0x1ba4cb,'log':_0x81c8('0xe')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 0d3a407..6c4df59 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 _0x33d9=['error','stringify','127.0.0.1','RPC\x20listening\x20on\x20port:','jayson/promise','lodash','../../../config/logger','email','listen','sendMail','account','catch','verifySmtp','then','Verified','values','length','Imap','password','Smtp','pass','http'];(function(_0x56e1ac,_0x9a4e75){var _0x37263a=function(_0x1380a3){while(--_0x1380a3){_0x56e1ac['push'](_0x56e1ac['shift']());}};_0x37263a(++_0x9a4e75);}(_0x33d9,0x122));var _0x933d=function(_0x24073c,_0x54c619){_0x24073c=_0x24073c-0x0;var _0x5878b1=_0x33d9[_0x24073c];return _0x5878b1;};'use strict';var jayson=require(_0x933d('0x0'));var BPromise=require('bluebird');var _=require(_0x933d('0x1'));var logger=require(_0x933d('0x2'))(_0x933d('0x3'));exports[_0x933d('0x4')]=function(_0x5c8da0,_0x482fc1){return new BPromise(function(_0x5124ca,_0x108de1){var _0x2bb296={'SendMail':function(_0x5aa9e4){var _0x2b0458=this;return new Promise(function(_0x39e9d5,_0x176037){_0x482fc1[_0x933d('0x5')](_0x5aa9e4[_0x933d('0x6')],_0x5aa9e4['message'])['then'](function(_0x310315){_0x39e9d5({'code':0xc8,'message':_0x310315});})[_0x933d('0x7')](function(_0x3d7aaa){_0x176037(_0x2b0458['error'](0x1f4,_0x3d7aaa));});});},'VerifySmtp':function(_0x1295e3){var _0x14c9a3=this;return new Promise(function(_0x39bb41,_0x30ed7e){_0x482fc1[_0x933d('0x8')](_0x1295e3[_0x933d('0x6')])[_0x933d('0x9')](function(_0x3c5307){_0x39bb41({'code':0xc8,'message':_0x933d('0xa')});})[_0x933d('0x7')](function(_0x448824){_0x30ed7e(_0x14c9a3['error'](0x1f4,_0x448824));});});},'MailAccounts':function(_0x1f0a73){return new Promise(function(_0x45eb82,_0x5e5eb1){var _0x39b46f=_[_0x933d('0xb')](_0x5c8da0['mailAccounts']);for(var _0x57d023=0x0;_0x57d023<_0x39b46f[_0x933d('0xc')];_0x57d023+=0x1){if(_0x39b46f[_0x57d023][_0x933d('0xd')]&&_0x39b46f[_0x57d023][_0x933d('0xd')][_0x933d('0xe')]){delete _0x39b46f[_0x57d023][_0x933d('0xd')][_0x933d('0xe')];}if(_0x39b46f[_0x57d023][_0x933d('0xf')]&&_0x39b46f[_0x57d023]['Smtp'][_0x933d('0x10')]){delete _0x39b46f[_0x57d023]['Smtp']['pass'];}}_0x45eb82({'count':_0x39b46f[_0x933d('0xc')],'rows':_0x39b46f});});}};var _0x5cac20=jayson['server'](_0x2bb296)[_0x933d('0x11')]();_0x5cac20['on'](_0x933d('0x12'),function(_0x24591a){logger[_0x933d('0x12')](JSON[_0x933d('0x13')](_0x24591a));return _0x108de1(_0x24591a);});_0x5cac20[_0x933d('0x4')](0x232b,_0x933d('0x14'),function(){console['log']('Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232b);return _0x5124ca(_0x933d('0x15')+0x232b);});});}; \ No newline at end of file +var _0xfeee=['http','listen','127.0.0.1','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','bluebird','lodash','../../../config/logger','email','sendMail','account','message','then','verifySmtp','Verified','catch','error','values','Imap','password','Smtp','pass','server'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0xfeee,0x1e8));var _0xefee=function(_0x1d760b,_0x47f9fe){_0x1d760b=_0x1d760b-0x0;var _0x18fb17=_0xfeee[_0x1d760b];return _0x18fb17;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xefee('0x0'));var _=require(_0xefee('0x1'));var logger=require(_0xefee('0x2'))(_0xefee('0x3'));exports['listen']=function(_0x46cadb,_0x36994e){return new BPromise(function(_0x39e40a,_0x353773){var _0x56de6c={'SendMail':function(_0x5777c8){var _0x1455b1=this;return new Promise(function(_0x56ae5d,_0x250c20){_0x36994e[_0xefee('0x4')](_0x5777c8[_0xefee('0x5')],_0x5777c8[_0xefee('0x6')])[_0xefee('0x7')](function(_0x2e93f5){_0x56ae5d({'code':0xc8,'message':_0x2e93f5});})['catch'](function(_0x2391fc){_0x250c20(_0x1455b1['error'](0x1f4,_0x2391fc));});});},'VerifySmtp':function(_0x1ba145){var _0x5631a4=this;return new Promise(function(_0x54e114,_0x295a7b){_0x36994e[_0xefee('0x8')](_0x1ba145[_0xefee('0x5')])[_0xefee('0x7')](function(_0x1b8765){_0x54e114({'code':0xc8,'message':_0xefee('0x9')});})[_0xefee('0xa')](function(_0x329405){_0x295a7b(_0x5631a4[_0xefee('0xb')](0x1f4,_0x329405));});});},'MailAccounts':function(_0x89c3c8){return new Promise(function(_0x53f1a5,_0x5357c9){var _0x534df2=_[_0xefee('0xc')](_0x46cadb['mailAccounts']);for(var _0x271cdc=0x0;_0x271cdc<_0x534df2['length'];_0x271cdc+=0x1){if(_0x534df2[_0x271cdc][_0xefee('0xd')]&&_0x534df2[_0x271cdc][_0xefee('0xd')][_0xefee('0xe')]){delete _0x534df2[_0x271cdc][_0xefee('0xd')][_0xefee('0xe')];}if(_0x534df2[_0x271cdc][_0xefee('0xf')]&&_0x534df2[_0x271cdc][_0xefee('0xf')][_0xefee('0x10')]){delete _0x534df2[_0x271cdc][_0xefee('0xf')]['pass'];}}_0x53f1a5({'count':_0x534df2['length'],'rows':_0x534df2});});}};var _0x56cf4b=jayson[_0xefee('0x11')](_0x56de6c)[_0xefee('0x12')]();_0x56cf4b['on'](_0xefee('0xb'),function(_0x2a6cab){logger[_0xefee('0xb')](JSON['stringify'](_0x2a6cab));return _0x353773(_0x2a6cab);});_0x56cf4b[_0xefee('0x13')](0x232b,_0xefee('0x14'),function(){console['log'](_0xefee('0x15'),0x232b);return _0x39e40a(_0xefee('0x16')+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index 071f033..d638478 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 _0x8548=['once','log','Express\x20server\x20listening\x20on\x20port\x20%d!','port','exports','sticky-session','ioredis','timeout','listen','socket.io','websocket','polling','redis','defaults','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes'];(function(_0x128ed7,_0x5536a4){var _0x1fa198=function(_0x4210f6){while(--_0x4210f6){_0x128ed7['push'](_0x128ed7['shift']());}};_0x1fa198(++_0x5536a4);}(_0x8548,0x1e9));var _0x8854=function(_0x178a8d,_0x5a5bf9){_0x178a8d=_0x178a8d-0x0;var _0x4055b5=_0x8548[_0x178a8d];return _0x4055b5;};'use strict';var _=require('lodash');var http=require('http');var express=require('express');var sticky=require(_0x8854('0x0'));var Redis=require(_0x8854('0x1'));var config=require('../../config/environment');var app=express();var server=http['createServer'](app);server[_0x8854('0x2')]=0xdbba0;if(sticky[_0x8854('0x3')](server,config['port'])){var socketio=require(_0x8854('0x4'))(server,{'transports':[_0x8854('0x5'),_0x8854('0x6')]});config[_0x8854('0x7')]=_[_0x8854('0x8')](config[_0x8854('0x7')],{'host':_0x8854('0x9'),'port':0x18eb});socketio[_0x8854('0xa')](require(_0x8854('0xb'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x8854('0x7')])}));require(_0x8854('0xc'))[_0x8854('0xd')]();require(_0x8854('0xe'))[_0x8854('0xd')](socketio);require(_0x8854('0xf'))[_0x8854('0xd')](app);require(_0x8854('0x10'))['default'](app);}else{server[_0x8854('0x11')]('listening',function(){console[_0x8854('0x12')](_0x8854('0x13'),config[_0x8854('0x14')]);});}exports=module[_0x8854('0x15')]=app; \ No newline at end of file +var _0x083e=['sticky-session','ioredis','../../config/environment','timeout','listen','socket.io','websocket','polling','defaults','redis','localhost','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','express'];(function(_0x4eb8b5,_0x1c8793){var _0x5acd9c=function(_0x19f95e){while(--_0x19f95e){_0x4eb8b5['push'](_0x4eb8b5['shift']());}};_0x5acd9c(++_0x1c8793);}(_0x083e,0x166));var _0xe083=function(_0x405385,_0x56f573){_0x405385=_0x405385-0x0;var _0x43837b=_0x083e[_0x405385];return _0x43837b;};'use strict';var _=require(_0xe083('0x0'));var http=require('http');var express=require(_0xe083('0x1'));var sticky=require(_0xe083('0x2'));var Redis=require(_0xe083('0x3'));var config=require(_0xe083('0x4'));var app=express();var server=http['createServer'](app);server[_0xe083('0x5')]=0xdbba0;if(sticky[_0xe083('0x6')](server,config['port'])){var socketio=require(_0xe083('0x7'))(server,{'transports':[_0xe083('0x8'),_0xe083('0x9')]});config['redis']=_[_0xe083('0xa')](config[_0xe083('0xb')],{'host':_0xe083('0xc'),'port':0x18eb});socketio['adapter'](require(_0xe083('0xd'))({'pubClient':new Redis(config[_0xe083('0xb')]),'subClient':new Redis(config[_0xe083('0xb')])}));require(_0xe083('0xe'))[_0xe083('0xf')]();require(_0xe083('0x10'))[_0xe083('0xf')](socketio);require(_0xe083('0x11'))[_0xe083('0xf')](app);require(_0xe083('0x12'))[_0xe083('0xf')](app);}else{server[_0xe083('0x13')](_0xe083('0x14'),function(){console[_0xe083('0x15')](_0xe083('0x16'),config['port']);});}exports=module[_0xe083('0x17')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 1d80f71..bbccd2f 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 _0xf50b=['error','message','result','exports','jayson/promise','bluebird','routing','client','http','Request','request','then','debug','rpc'];(function(_0x53ece1,_0x284ef0){var _0x22196c=function(_0x2e039d){while(--_0x2e039d){_0x53ece1['push'](_0x53ece1['shift']());}};_0x22196c(++_0x284ef0);}(_0xf50b,0xc8));var _0xbf50=function(_0x4d3897,_0x11b8bc){_0x4d3897=_0x4d3897-0x0;var _0x430997=_0xf50b[_0x4d3897];return _0x430997;};'use strict';var jayson=require(_0xbf50('0x0'));var BPromise=require(_0xbf50('0x1'));var logger=require('../../config/logger')(_0xbf50('0x2'));var client=jayson[_0xbf50('0x3')][_0xbf50('0x4')]({'port':0x2329});client[_0xbf50('0x5')]=function(_0x5f0c1a,_0x32217d){return new BPromise(function(_0x4f5ba8,_0x36e4d6){return client[_0xbf50('0x6')](_0x5f0c1a,_0x32217d)[_0xbf50('0x7')](function(_0x117cc8){logger[_0xbf50('0x8')](_0xbf50('0x9'),_0xbf50('0x2'),_0x5f0c1a,_0x32217d,_0x117cc8);if(_0x117cc8['error']){logger[_0xbf50('0xa')](_0xbf50('0x9'),_0xbf50('0x2'),_0x5f0c1a,_0x117cc8['error']['message'],_0x32217d);return _0x36e4d6(_0x117cc8[_0xbf50('0xa')][_0xbf50('0xb')]);}else{return _0x4f5ba8(_0x117cc8[_0xbf50('0xc')]);}})['catch'](function(_0x39f9f4){logger[_0xbf50('0xa')](_0xbf50('0x9'),_0xbf50('0x2'),_0x5f0c1a,_0x39f9f4,_0x32217d);return _0x36e4d6(_0x39f9f4);});});};module[_0xbf50('0xd')]=client; \ No newline at end of file +var _0x8a28=['exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request','then','rpc','error','message','result'];(function(_0x246b1f,_0x27deaf){var _0x4e31f8=function(_0x3a9c66){while(--_0x3a9c66){_0x246b1f['push'](_0x246b1f['shift']());}};_0x4e31f8(++_0x27deaf);}(_0x8a28,0xfd));var _0x88a2=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x8a28[_0x1cfa0d];return _0xe33279;};'use strict';var jayson=require(_0x88a2('0x0'));var BPromise=require(_0x88a2('0x1'));var logger=require(_0x88a2('0x2'))(_0x88a2('0x3'));var client=jayson[_0x88a2('0x4')][_0x88a2('0x5')]({'port':0x2329});client[_0x88a2('0x6')]=function(_0x3fc89d,_0x5d5b92){return new BPromise(function(_0x2f482e,_0x238f2a){return client[_0x88a2('0x7')](_0x3fc89d,_0x5d5b92)[_0x88a2('0x8')](function(_0x29ce92){logger['debug'](_0x88a2('0x9'),'routing',_0x3fc89d,_0x5d5b92,_0x29ce92);if(_0x29ce92[_0x88a2('0xa')]){logger[_0x88a2('0xa')](_0x88a2('0x9'),_0x88a2('0x3'),_0x3fc89d,_0x29ce92[_0x88a2('0xa')][_0x88a2('0xb')],_0x5d5b92);return _0x238f2a(_0x29ce92[_0x88a2('0xa')][_0x88a2('0xb')]);}else{return _0x2f482e(_0x29ce92[_0x88a2('0xc')]);}})['catch'](function(_0x5b3d7f){logger[_0x88a2('0xa')](_0x88a2('0x9'),_0x88a2('0x3'),_0x3fc89d,_0x5b3d7f,_0x5d5b92);return _0x238f2a(_0x5b3d7f);});});};module[_0x88a2('0xd')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index c8d8a9b..456b3b2 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 _0x9aa4=['initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','initMailQueues','listen','catch','log','bluebird','./rpc/user','./rpc/openchannelQueue','./rpc/smsQueue','resolve','then','getAgents','initAgents'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9aa4,0x1ad));var _0x49aa=function(_0xdd1c50,_0x2c9586){_0xdd1c50=_0xdd1c50-0x0;var _0x54c37f=_0x9aa4[_0xdd1c50];return _0x54c37f;};'use strict';var BPromise=require(_0x49aa('0x0'));var server=require('./server');var Realtime=require('./realtime');var user=require(_0x49aa('0x1'));var interval=require('./rpc/interval');var openchannelQueue=require(_0x49aa('0x2'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0x49aa('0x3'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require('./rpc/faxQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0x49aa('0x4')]()[_0x49aa('0x5')](user[_0x49aa('0x6')]())['then'](realtime[_0x49aa('0x7')]())['then'](interval['getIntervals']())[_0x49aa('0x5')](realtime[_0x49aa('0x8')]())[_0x49aa('0x5')](openchannelQueue[_0x49aa('0x9')]())[_0x49aa('0x5')](realtime[_0x49aa('0xa')]())[_0x49aa('0x5')](chatQueue[_0x49aa('0xb')]())[_0x49aa('0x5')](realtime[_0x49aa('0xc')]())['then'](smsQueue[_0x49aa('0xd')]())['then'](realtime[_0x49aa('0xe')]())[_0x49aa('0x5')](mailQueue['getMailQueues']())[_0x49aa('0x5')](realtime[_0x49aa('0xf')]())[_0x49aa('0x5')](faxQueue['getFaxQueues']())[_0x49aa('0x5')](realtime['initFaxQueues']())[_0x49aa('0x5')](function(){return realtime;});}function main(){return server[_0x49aa('0x10')](realtime)[_0x49aa('0x5')](function(_0x59ff12){return initRealtime();})['then'](function(_0x3963b1){return setInterval(initRealtime,0x1388);})[_0x49aa('0x11')](function(_0x4d1295){console[_0x49aa('0x12')](_0x4d1295);});}main(); \ No newline at end of file +var _0xfea1=['bluebird','./server','./realtime','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/faxQueue','resolve','then','getIntervals','initIntervals','initOpenchannelQueues','initChatQueues','getSmsQueues','getMailQueues','initMailQueues','getFaxQueues','catch','log'];(function(_0x8bc276,_0x33ce4e){var _0x12d273=function(_0x3c6df9){while(--_0x3c6df9){_0x8bc276['push'](_0x8bc276['shift']());}};_0x12d273(++_0x33ce4e);}(_0xfea1,0x64));var _0x1fea=function(_0x2bf1d6,_0x410efd){_0x2bf1d6=_0x2bf1d6-0x0;var _0x1be08a=_0xfea1[_0x2bf1d6];return _0x1be08a;};'use strict';var BPromise=require(_0x1fea('0x0'));var server=require(_0x1fea('0x1'));var Realtime=require(_0x1fea('0x2'));var user=require('./rpc/user');var interval=require(_0x1fea('0x3'));var openchannelQueue=require(_0x1fea('0x4'));var chatQueue=require(_0x1fea('0x5'));var smsQueue=require(_0x1fea('0x6'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0x1fea('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x1fea('0x8')]()[_0x1fea('0x9')](user['getAgents']())[_0x1fea('0x9')](realtime['initAgents']())['then'](interval[_0x1fea('0xa')]())[_0x1fea('0x9')](realtime[_0x1fea('0xb')]())['then'](openchannelQueue['getOpenchannelQueues']())['then'](realtime[_0x1fea('0xc')]())[_0x1fea('0x9')](chatQueue['getChatQueues']())[_0x1fea('0x9')](realtime[_0x1fea('0xd')]())[_0x1fea('0x9')](smsQueue[_0x1fea('0xe')]())[_0x1fea('0x9')](realtime['initSmsQueues']())[_0x1fea('0x9')](mailQueue[_0x1fea('0xf')]())[_0x1fea('0x9')](realtime[_0x1fea('0x10')]())[_0x1fea('0x9')](faxQueue[_0x1fea('0x11')]())[_0x1fea('0x9')](realtime['initFaxQueues']())[_0x1fea('0x9')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x1fea('0x9')](function(_0x25cc91){return initRealtime();})['then'](function(_0xa894ec){return setInterval(initRealtime,0x1388);})[_0x1fea('0x12')](function(_0x1c708e){console[_0x1fea('0x13')](_0x1c708e);});}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 d2caaa1..83c7c6c 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 _0xda4a=['priority','toJSON','map','toString','isString','parse','object','exports','lodash','util','events','EventEmitter','init','ignoreFactChanges','prototype','rules','register','isArray','isObject','push','sync','activeRules','filter','isNil','orderBy','asc','execute','clone','consequence','ruleRef','name','index_','nextTick','call','next','isEqual','restart','length','condition','matchPath','findRules','matches','turn','prioritize'];(function(_0x3d9ab2,_0x2099c8){var _0x315dc2=function(_0x23747d){while(--_0x23747d){_0x3d9ab2['push'](_0x3d9ab2['shift']());}};_0x315dc2(++_0x2099c8);}(_0xda4a,0x168));var _0xada4=function(_0x57c1d5,_0x1b6c7d){_0x57c1d5=_0x57c1d5-0x0;var _0x2c836c=_0xda4a[_0x57c1d5];return _0x2c836c;};'use strict';var _=require(_0xada4('0x0'));var util=require(_0xada4('0x1'));var EventEmitter=require(_0xada4('0x2'))[_0xada4('0x3')];function RuleEngine(_0x300a53,_0x332103){this[_0xada4('0x4')]();if(!_['isNil'](_0x300a53)){this['register'](_0x300a53);}if(_0x332103){this[_0xada4('0x5')]=_0x332103[_0xada4('0x5')];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine[_0xada4('0x6')]['init']=function(_0x49cce8){this[_0xada4('0x7')]=[];this['activeRules']=[];};RuleEngine[_0xada4('0x6')][_0xada4('0x8')]=function(_0x597ba8){if(Array[_0xada4('0x9')](_0x597ba8)){this[_0xada4('0x7')]=this[_0xada4('0x7')]['concat'](_0x597ba8);}else if(_0x597ba8!==null&&_[_0xada4('0xa')](_0x597ba8)){this[_0xada4('0x7')][_0xada4('0xb')](_0x597ba8);}this['sync']();};RuleEngine[_0xada4('0x6')][_0xada4('0xc')]=function(){this[_0xada4('0xd')]=this[_0xada4('0x7')][_0xada4('0xe')](function(_0x7797a6){if(_[_0xada4('0xf')](_0x7797a6['on'])){_0x7797a6['on']=!![];}if(_0x7797a6['on']===!![]){return _0x7797a6;}});this[_0xada4('0xd')]=_[_0xada4('0x10')](this[_0xada4('0xd')],['p'],[_0xada4('0x11')]);};RuleEngine['prototype'][_0xada4('0x12')]=function(_0x4b678d,_0x201374){var _0x2bd5f1=![];_0x4b678d['result']=!![];var _0x13ca30=_[_0xada4('0x13')](_0x4b678d);var _0x425f95=_[_0xada4('0x13')](_0x4b678d);var _0x5070ea=this[_0xada4('0xd')];var _0x5409d9=[];var _0x5d4e1d=this[_0xada4('0x5')];(function FnRuleLoop(_0x278a87){var _0xa62285={'rules':function(){return _0x5070ea;},'rule':function(){return _0x5070ea[_0x278a87];},'when':function(_0x2175f1){if(_0x2175f1){var _0x58355a=_0x5070ea[_0x278a87][_0xada4('0x14')];_0x58355a[_0xada4('0x15')]=_0x5070ea[_0x278a87]['id']||_0x5070ea[_0x278a87][_0xada4('0x16')]||_0xada4('0x17')+_0x278a87;process[_0xada4('0x18')](function(){_0x5409d9[_0xada4('0xb')](_0x58355a[_0xada4('0x15')]);_0x58355a[_0xada4('0x19')](_0x13ca30,_0xa62285);});}else{process[_0xada4('0x18')](function(){_0xa62285[_0xada4('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x2bd5f1=!![];return FnRuleLoop(0x0);},'next':function(_0x3475fe){if(!_0x5d4e1d&&!_[_0xada4('0x1b')](_0x425f95,_0x13ca30)){_0x425f95=_[_0xada4('0x13')](_0x13ca30);process[_0xada4('0x18')](function(){_0xa62285[_0xada4('0x1c')]();});}else{process[_0xada4('0x18')](function(){if(_[_0xada4('0xf')](_0x3475fe)){return FnRuleLoop(_0x278a87+0x1);}else{return FnRuleLoop(_0x3475fe);}});}}};if(_0x278a87<_0x5070ea[_0xada4('0x1d')]&&_0x2bd5f1===![]){var _0x53486b=_0x5070ea[_0x278a87][_0xada4('0x1e')];_0x53486b[_0xada4('0x19')](_0x13ca30,_0xa62285);}else{process[_0xada4('0x18')](function(){_0x13ca30[_0xada4('0x1f')]=_0x5409d9;return _0x201374?_0x201374(_0x13ca30):_['noop']();});}}(0x0));};RuleEngine[_0xada4('0x6')][_0xada4('0x20')]=function(_0x170c8b){if(_['isNil'](_0x170c8b)){return this[_0xada4('0x7')];}else{var _0x4dfe42=_[_0xada4('0x21')](_0x170c8b);return _[_0xada4('0xe')](this['rules'],_0x4dfe42);}};RuleEngine[_0xada4('0x6')][_0xada4('0x22')]=function(_0x582634,_0x33ae59){var _0x1a632d=_0x582634==='on'||_0x582634==='ON'?!![]:![];var _0x241b5b=this[_0xada4('0x20')](_0x33ae59);for(var _0x4ffedd=0x0,_0x49a2e6=_0x241b5b[_0xada4('0x1d')];_0x4ffedd<_0x49a2e6;_0x4ffedd+=0x1){_0x241b5b[_0x4ffedd]['on']=_0x1a632d;}this[_0xada4('0xc')]();};RuleEngine[_0xada4('0x6')][_0xada4('0x23')]=function(_0x5381e6,_0x29eefe){_0x5381e6=parseInt(_0x5381e6,0xa);var _0x28feb8=this[_0xada4('0x20')](_0x29eefe);for(var _0x3c48bb=0x0,_0x476192=_0x28feb8['length'];_0x3c48bb<_0x476192;_0x3c48bb+=0x1){_0x28feb8[_0x3c48bb][_0xada4('0x24')]=_0x5381e6;}this['sync']();};RuleEngine['prototype'][_0xada4('0x25')]=function(){var _0x9ea0a2=this[_0xada4('0x7')];if(_0x9ea0a2 instanceof Array){_0x9ea0a2=_0x9ea0a2[_0xada4('0x26')](function(_0x4f79f4){_0x4f79f4[_0xada4('0x1e')]=_0x4f79f4['condition'][_0xada4('0x27')]();_0x4f79f4[_0xada4('0x14')]=_0x4f79f4[_0xada4('0x14')][_0xada4('0x27')]();return _0x4f79f4;});}else if(!_[_0xada4('0xf')](_0x9ea0a2)){_0x9ea0a2[_0xada4('0x1e')]=_0x9ea0a2[_0xada4('0x1e')][_0xada4('0x27')]();_0x9ea0a2['consequence']=_0x9ea0a2[_0xada4('0x14')]['toString']();}return _0x9ea0a2;};RuleEngine[_0xada4('0x6')]['fromJSON']=function(_0xf51642){this[_0xada4('0x4')]();if(_[_0xada4('0x28')](_0xf51642)){_0xf51642=JSON[_0xada4('0x29')](_0xf51642);}if(_0xf51642 instanceof Array){_0xf51642=_0xf51642['map'](function(_0x12cdfd){_0x12cdfd[_0xada4('0x1e')]=eval('('+_0x12cdfd[_0xada4('0x1e')]+')');_0x12cdfd[_0xada4('0x14')]=eval('('+_0x12cdfd[_0xada4('0x14')]+')');return _0x12cdfd;});}else if(_0xf51642!==null&&typeof _0xf51642==_0xada4('0x2a')){_0xf51642['condition']=eval('('+_0xf51642[_0xada4('0x1e')]+')');_0xf51642[_0xada4('0x14')]=eval('('+_0xf51642[_0xada4('0x14')]+')');}this['register'](_0xf51642);};module[_0xada4('0x2b')]=RuleEngine; \ No newline at end of file +var _0x8c91=['call','matchPath','noop','findRules','matches','priority','map','condition','toString','object','lodash','util','EventEmitter','init','isNil','ignoreFactChanges','inherits','prototype','rules','activeRules','register','concat','isObject','push','sync','filter','orderBy','asc','execute','clone','consequence','ruleRef','name','index_','nextTick','next','restart','length'];(function(_0x32f1cb,_0x4ecb17){var _0x4cde17=function(_0x56c003){while(--_0x56c003){_0x32f1cb['push'](_0x32f1cb['shift']());}};_0x4cde17(++_0x4ecb17);}(_0x8c91,0x1ac));var _0x18c9=function(_0x1a5a1d,_0x5ed242){_0x1a5a1d=_0x1a5a1d-0x0;var _0x46b983=_0x8c91[_0x1a5a1d];return _0x46b983;};'use strict';var _=require(_0x18c9('0x0'));var util=require(_0x18c9('0x1'));var EventEmitter=require('events')[_0x18c9('0x2')];function RuleEngine(_0x9afb,_0x29d301){this[_0x18c9('0x3')]();if(!_[_0x18c9('0x4')](_0x9afb)){this['register'](_0x9afb);}if(_0x29d301){this[_0x18c9('0x5')]=_0x29d301[_0x18c9('0x5')];}return this;}util[_0x18c9('0x6')](RuleEngine,EventEmitter);RuleEngine[_0x18c9('0x7')]['init']=function(_0x316df8){this[_0x18c9('0x8')]=[];this[_0x18c9('0x9')]=[];};RuleEngine[_0x18c9('0x7')][_0x18c9('0xa')]=function(_0x3b131f){if(Array['isArray'](_0x3b131f)){this[_0x18c9('0x8')]=this[_0x18c9('0x8')][_0x18c9('0xb')](_0x3b131f);}else if(_0x3b131f!==null&&_[_0x18c9('0xc')](_0x3b131f)){this[_0x18c9('0x8')][_0x18c9('0xd')](_0x3b131f);}this[_0x18c9('0xe')]();};RuleEngine[_0x18c9('0x7')]['sync']=function(){this[_0x18c9('0x9')]=this[_0x18c9('0x8')][_0x18c9('0xf')](function(_0x20c070){if(_[_0x18c9('0x4')](_0x20c070['on'])){_0x20c070['on']=!![];}if(_0x20c070['on']===!![]){return _0x20c070;}});this['activeRules']=_[_0x18c9('0x10')](this['activeRules'],['p'],[_0x18c9('0x11')]);};RuleEngine[_0x18c9('0x7')][_0x18c9('0x12')]=function(_0x1e0d7b,_0x2b97e3){var _0x5db46e=![];_0x1e0d7b['result']=!![];var _0x1b791e=_['clone'](_0x1e0d7b);var _0xa839b8=_[_0x18c9('0x13')](_0x1e0d7b);var _0x5af69f=this[_0x18c9('0x9')];var _0x34666e=[];var _0x2b78eb=this[_0x18c9('0x5')];(function FnRuleLoop(_0x1d14c9){var _0x1ba2ee={'rules':function(){return _0x5af69f;},'rule':function(){return _0x5af69f[_0x1d14c9];},'when':function(_0x42e2d9){if(_0x42e2d9){var _0x2fb6b9=_0x5af69f[_0x1d14c9][_0x18c9('0x14')];_0x2fb6b9[_0x18c9('0x15')]=_0x5af69f[_0x1d14c9]['id']||_0x5af69f[_0x1d14c9][_0x18c9('0x16')]||_0x18c9('0x17')+_0x1d14c9;process[_0x18c9('0x18')](function(){_0x34666e['push'](_0x2fb6b9[_0x18c9('0x15')]);_0x2fb6b9['call'](_0x1b791e,_0x1ba2ee);});}else{process['nextTick'](function(){_0x1ba2ee[_0x18c9('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5db46e=!![];return FnRuleLoop(0x0);},'next':function(_0x2dc063){if(!_0x2b78eb&&!_['isEqual'](_0xa839b8,_0x1b791e)){_0xa839b8=_[_0x18c9('0x13')](_0x1b791e);process[_0x18c9('0x18')](function(){_0x1ba2ee[_0x18c9('0x1a')]();});}else{process[_0x18c9('0x18')](function(){if(_[_0x18c9('0x4')](_0x2dc063)){return FnRuleLoop(_0x1d14c9+0x1);}else{return FnRuleLoop(_0x2dc063);}});}}};if(_0x1d14c9<_0x5af69f[_0x18c9('0x1b')]&&_0x5db46e===![]){var _0x356e20=_0x5af69f[_0x1d14c9]['condition'];_0x356e20[_0x18c9('0x1c')](_0x1b791e,_0x1ba2ee);}else{process[_0x18c9('0x18')](function(){_0x1b791e[_0x18c9('0x1d')]=_0x34666e;return _0x2b97e3?_0x2b97e3(_0x1b791e):_[_0x18c9('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0x18c9('0x1f')]=function(_0x5f1aa7){if(_[_0x18c9('0x4')](_0x5f1aa7)){return this[_0x18c9('0x8')];}else{var _0x522140=_[_0x18c9('0x20')](_0x5f1aa7);return _[_0x18c9('0xf')](this[_0x18c9('0x8')],_0x522140);}};RuleEngine[_0x18c9('0x7')]['turn']=function(_0x5c3dee,_0x3beeb7){var _0x58dfbc=_0x5c3dee==='on'||_0x5c3dee==='ON'?!![]:![];var _0x32596d=this[_0x18c9('0x1f')](_0x3beeb7);for(var _0x42c687=0x0,_0x181f0c=_0x32596d[_0x18c9('0x1b')];_0x42c687<_0x181f0c;_0x42c687+=0x1){_0x32596d[_0x42c687]['on']=_0x58dfbc;}this['sync']();};RuleEngine['prototype']['prioritize']=function(_0x1696f0,_0x8f9566){_0x1696f0=parseInt(_0x1696f0,0xa);var _0x5e5111=this[_0x18c9('0x1f')](_0x8f9566);for(var _0x2c24ef=0x0,_0x74e6de=_0x5e5111[_0x18c9('0x1b')];_0x2c24ef<_0x74e6de;_0x2c24ef+=0x1){_0x5e5111[_0x2c24ef][_0x18c9('0x21')]=_0x1696f0;}this[_0x18c9('0xe')]();};RuleEngine[_0x18c9('0x7')]['toJSON']=function(){var _0x4957ee=this['rules'];if(_0x4957ee instanceof Array){_0x4957ee=_0x4957ee[_0x18c9('0x22')](function(_0x583985){_0x583985[_0x18c9('0x23')]=_0x583985[_0x18c9('0x23')][_0x18c9('0x24')]();_0x583985['consequence']=_0x583985[_0x18c9('0x14')][_0x18c9('0x24')]();return _0x583985;});}else if(!_[_0x18c9('0x4')](_0x4957ee)){_0x4957ee[_0x18c9('0x23')]=_0x4957ee[_0x18c9('0x23')][_0x18c9('0x24')]();_0x4957ee[_0x18c9('0x14')]=_0x4957ee['consequence']['toString']();}return _0x4957ee;};RuleEngine[_0x18c9('0x7')]['fromJSON']=function(_0x14a43c){this[_0x18c9('0x3')]();if(_['isString'](_0x14a43c)){_0x14a43c=JSON['parse'](_0x14a43c);}if(_0x14a43c instanceof Array){_0x14a43c=_0x14a43c[_0x18c9('0x22')](function(_0x1fafae){_0x1fafae[_0x18c9('0x23')]=eval('('+_0x1fafae[_0x18c9('0x23')]+')');_0x1fafae[_0x18c9('0x14')]=eval('('+_0x1fafae[_0x18c9('0x14')]+')');return _0x1fafae;});}else if(_0x14a43c!==null&&typeof _0x14a43c==_0x18c9('0x25')){_0x14a43c[_0x18c9('0x23')]=eval('('+_0x14a43c[_0x18c9('0x23')]+')');_0x14a43c['consequence']=eval('('+_0x14a43c[_0x18c9('0x14')]+')');}this['register'](_0x14a43c);};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 1232c5c..2000bab 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(_0x4d548e,_0x386919){var _0x236737=function(_0x10c1db){while(--_0x10c1db){_0x4d548e['push'](_0x4d548e['shift']());}};_0x236737(++_0x386919);}(_0x814b,0x1a2));var _0xb814=function(_0x1ee5be,_0x5f46e3){_0x1ee5be=_0x1ee5be-0x0;var _0x177140=_0x814b[_0x1ee5be];return _0x177140;};'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(_0x448c24,_0x5229d1){var _0x3fbe06=function(_0x2c6f7b){while(--_0x2c6f7b){_0x448c24['push'](_0x448c24['shift']());}};_0x3fbe06(++_0x5229d1);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index a79f79d..1580c12 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 _0xa902=['openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','mail','openchannel','fax','length','Status','StatusTime','toNumber','format','chatCurrentCapacity','faxStatus','openchannelStatusTime','busy','stringify','emit','user:save','exports','lodash','moment','md5','ioredis','../../../config/environment','defaults','socket.io-emitter','redis','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','unknown','smsStatusTime','smsCapacity','smsCurrentCapacity'];(function(_0x4b688f,_0x4c60e6){var _0x5cfad2=function(_0x582e2b){while(--_0x582e2b){_0x4b688f['push'](_0x4b688f['shift']());}};_0x5cfad2(++_0x4c60e6);}(_0xa902,0x8d));var _0x2a90=function(_0x1fe0f6,_0x51a999){_0x1fe0f6=_0x1fe0f6-0x0;var _0x4ffa1e=_0xa902[_0x1fe0f6];return _0x4ffa1e;};'use strict';var _=require(_0x2a90('0x0'));var moment=require(_0x2a90('0x1'));var md5=require(_0x2a90('0x2'));var Redis=require(_0x2a90('0x3'));var config=require(_0x2a90('0x4'));config['redis']=_[_0x2a90('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x2a90('0x6'))(new Redis(config[_0x2a90('0x7')]));function Agent(_0x203ecf){this['id']=_0x203ecf['id']||0x0;this[_0x2a90('0x8')]=_0x203ecf[_0x2a90('0x8')]||'';this[_0x2a90('0x9')]=_0x203ecf['online']||!![];this[_0x2a90('0xa')]=_0x203ecf['voicePause']||![];this['chatPause']=_0x203ecf[_0x2a90('0xb')]||![];this[_0x2a90('0xc')]=_0x203ecf[_0x2a90('0xc')]||![];this[_0x2a90('0xd')]=_0x203ecf[_0x2a90('0xd')]||![];this['smsPause']=_0x203ecf[_0x2a90('0xe')]||![];this[_0x2a90('0xf')]=_0x203ecf[_0x2a90('0xf')]||![];this[_0x2a90('0x10')]='unknown';this[_0x2a90('0x11')]=0x0;this['chatCapacity']=_0x203ecf[_0x2a90('0x12')]||0x0;this['chatCurrentCapacity']=0x0;this[_0x2a90('0x13')]='unknown';this[_0x2a90('0x14')]=0x0;this[_0x2a90('0x15')]=_0x203ecf[_0x2a90('0x15')]||0x0;this['mailCurrentCapacity']=0x0;this['faxStatus']='unknown';this[_0x2a90('0x16')]=0x0;this[_0x2a90('0x17')]=_0x203ecf['faxCapacity']||0x0;this[_0x2a90('0x18')]=0x0;this[_0x2a90('0x19')]=_0x2a90('0x1a');this[_0x2a90('0x1b')]=0x0;this[_0x2a90('0x1c')]=_0x203ecf[_0x2a90('0x1c')]||0x0;this[_0x2a90('0x1d')]=0x0;this[_0x2a90('0x1e')]=_0x2a90('0x1a');this['openchannelStatusTime']=0x0;this[_0x2a90('0x1f')]=_0x203ecf[_0x2a90('0x1f')]||0x0;this[_0x2a90('0x20')]=0x0;this['busy']=![];this[_0x2a90('0x21')]=undefined;this[_0x2a90('0x2')]='';this[_0x2a90('0x22')]();}Agent[_0x2a90('0x23')][_0x2a90('0x24')]=function(_0x23d227){if(this[_0x23d227+_0x2a90('0x25')]>0x0){if(this[_0x23d227+_0x2a90('0x26')]>0x0&&this[_0x23d227+_0x2a90('0x25')]>=this[_0x23d227+_0x2a90('0x26')]){return _0x2a90('0x27');}else{return _0x2a90('0x28');}}else{return'idle';}};Agent[_0x2a90('0x23')][_0x2a90('0x22')]=function(){var _0x2955a9=[_0x2a90('0x29'),'chat',_0x2a90('0x2a'),_0x2a90('0x2b'),'sms'];for(var _0x1bcfd7=0x0;_0x1bcfd7<_0x2955a9[_0x2a90('0x2c')];_0x1bcfd7+=0x1){var _0x10a6dd=this[_0x2a90('0x24')](_0x2955a9[_0x1bcfd7]);if(this[_0x2955a9[_0x1bcfd7]+_0x2a90('0x2d')]!==_0x10a6dd){this[_0x2955a9[_0x1bcfd7]+_0x2a90('0x2e')]=_[_0x2a90('0x2f')](moment()[_0x2a90('0x30')]('x'));}this[_0x2955a9[_0x1bcfd7]+'Status']=_0x10a6dd;}var _0x27f883={'id':this['id'],'name':this[_0x2a90('0x8')],'online':this[_0x2a90('0x9')],'voicePause':this[_0x2a90('0xa')],'chatPause':this[_0x2a90('0xb')],'mailPause':this['mailPause'],'smsPause':this['smsPause'],'faxPause':this[_0x2a90('0xd')],'openchannelPause':this['openchannelPause'],'chatStatus':this['chatStatus'],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x2a90('0x12')],'chatCurrentCapacity':this[_0x2a90('0x31')],'mailStatus':this['mailStatus'],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x2a90('0x15')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x2a90('0x32')],'faxStatusTime':this[_0x2a90('0x16')],'faxCapacity':this[_0x2a90('0x17')],'faxCurrentCapacity':this[_0x2a90('0x18')],'smsStatus':this[_0x2a90('0x19')],'smsStatusTime':this[_0x2a90('0x1b')],'smsCapacity':this[_0x2a90('0x1c')],'smsCurrentCapacity':this['smsCurrentCapacity'],'openchannelStatus':this[_0x2a90('0x1e')],'openchannelStatusTime':this[_0x2a90('0x33')],'openchannelCapacity':this[_0x2a90('0x1f')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x2a90('0x34')],'busyQueue':this[_0x2a90('0x21')]};var _0xfbb545=md5(JSON[_0x2a90('0x35')](_0x27f883));if(this['md5']!==_0xfbb545){this[_0x2a90('0x2')]=_0xfbb545;io[_0x2a90('0x36')](_0x2a90('0x37'),_0x27f883);}};module[_0x2a90('0x38')]=Agent; \ No newline at end of file +var _0x153f=['localhost','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','working','idle','mail','chat','openchannel','fax','sms','length','Status','StatusTime','toNumber','format','chatStatusTime','faxStatus','smsCurrentCapacity','stringify','emit','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults'];(function(_0x1064bc,_0x206f12){var _0x5edc45=function(_0x5087bd){while(--_0x5087bd){_0x1064bc['push'](_0x1064bc['shift']());}};_0x5edc45(++_0x206f12);}(_0x153f,0x15b));var _0xf153=function(_0x2dadc1,_0x8028f3){_0x2dadc1=_0x2dadc1-0x0;var _0x45352c=_0x153f[_0x2dadc1];return _0x45352c;};'use strict';var _=require(_0xf153('0x0'));var moment=require(_0xf153('0x1'));var md5=require(_0xf153('0x2'));var Redis=require(_0xf153('0x3'));var config=require(_0xf153('0x4'));config[_0xf153('0x5')]=_[_0xf153('0x6')](config['redis'],{'host':_0xf153('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf153('0x5')]));function Agent(_0x2fcb1a){this['id']=_0x2fcb1a['id']||0x0;this[_0xf153('0x8')]=_0x2fcb1a[_0xf153('0x8')]||'';this[_0xf153('0x9')]=_0x2fcb1a['online']||!![];this[_0xf153('0xa')]=_0x2fcb1a[_0xf153('0xa')]||![];this[_0xf153('0xb')]=_0x2fcb1a[_0xf153('0xb')]||![];this[_0xf153('0xc')]=_0x2fcb1a[_0xf153('0xc')]||![];this[_0xf153('0xd')]=_0x2fcb1a[_0xf153('0xd')]||![];this[_0xf153('0xe')]=_0x2fcb1a[_0xf153('0xe')]||![];this['openchannelPause']=_0x2fcb1a[_0xf153('0xf')]||![];this[_0xf153('0x10')]=_0xf153('0x11');this['chatStatusTime']=0x0;this[_0xf153('0x12')]=_0x2fcb1a[_0xf153('0x12')]||0x0;this[_0xf153('0x13')]=0x0;this[_0xf153('0x14')]=_0xf153('0x11');this[_0xf153('0x15')]=0x0;this[_0xf153('0x16')]=_0x2fcb1a[_0xf153('0x16')]||0x0;this[_0xf153('0x17')]=0x0;this['faxStatus']=_0xf153('0x11');this[_0xf153('0x18')]=0x0;this[_0xf153('0x19')]=_0x2fcb1a[_0xf153('0x19')]||0x0;this[_0xf153('0x1a')]=0x0;this[_0xf153('0x1b')]=_0xf153('0x11');this[_0xf153('0x1c')]=0x0;this['smsCapacity']=_0x2fcb1a[_0xf153('0x1d')]||0x0;this['smsCurrentCapacity']=0x0;this[_0xf153('0x1e')]=_0xf153('0x11');this[_0xf153('0x1f')]=0x0;this[_0xf153('0x20')]=_0x2fcb1a['openchannelCapacity']||0x0;this[_0xf153('0x21')]=0x0;this[_0xf153('0x22')]=![];this[_0xf153('0x23')]=undefined;this[_0xf153('0x2')]='';this[_0xf153('0x24')]();}Agent[_0xf153('0x25')][_0xf153('0x26')]=function(_0x2db2c7){if(this[_0x2db2c7+_0xf153('0x27')]>0x0){if(this[_0x2db2c7+_0xf153('0x28')]>0x0&&this[_0x2db2c7+_0xf153('0x27')]>=this[_0x2db2c7+_0xf153('0x28')]){return'maxcapacity';}else{return _0xf153('0x29');}}else{return _0xf153('0x2a');}};Agent[_0xf153('0x25')][_0xf153('0x24')]=function(){var _0x5c9f44=[_0xf153('0x2b'),_0xf153('0x2c'),_0xf153('0x2d'),_0xf153('0x2e'),_0xf153('0x2f')];for(var _0x1570fc=0x0;_0x1570fc<_0x5c9f44[_0xf153('0x30')];_0x1570fc+=0x1){var _0x35cfe3=this[_0xf153('0x26')](_0x5c9f44[_0x1570fc]);if(this[_0x5c9f44[_0x1570fc]+_0xf153('0x31')]!==_0x35cfe3){this[_0x5c9f44[_0x1570fc]+_0xf153('0x32')]=_[_0xf153('0x33')](moment()[_0xf153('0x34')]('x'));}this[_0x5c9f44[_0x1570fc]+_0xf153('0x31')]=_0x35cfe3;}var _0x17f7a4={'id':this['id'],'name':this['name'],'online':this[_0xf153('0x9')],'voicePause':this[_0xf153('0xa')],'chatPause':this['chatPause'],'mailPause':this[_0xf153('0xc')],'smsPause':this[_0xf153('0xe')],'faxPause':this['faxPause'],'openchannelPause':this[_0xf153('0xf')],'chatStatus':this[_0xf153('0x10')],'chatStatusTime':this[_0xf153('0x35')],'chatCapacity':this[_0xf153('0x12')],'chatCurrentCapacity':this[_0xf153('0x13')],'mailStatus':this[_0xf153('0x14')],'mailStatusTime':this[_0xf153('0x15')],'mailCapacity':this[_0xf153('0x16')],'mailCurrentCapacity':this[_0xf153('0x17')],'faxStatus':this[_0xf153('0x36')],'faxStatusTime':this[_0xf153('0x18')],'faxCapacity':this[_0xf153('0x19')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0xf153('0x1b')],'smsStatusTime':this[_0xf153('0x1c')],'smsCapacity':this[_0xf153('0x1d')],'smsCurrentCapacity':this[_0xf153('0x37')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0xf153('0x20')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this['busy'],'busyQueue':this[_0xf153('0x23')]};var _0x4ab958=md5(JSON[_0xf153('0x38')](_0x17f7a4));if(this['md5']!==_0x4ab958){this[_0xf153('0x2')]=_0x4ab958;io[_0xf153('0x39')]('user:save',_0x17f7a4);}};module[_0xf153('0x3a')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 7099736..70bba26 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 _0x9f70=['beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','updateRealtime','loggedIn','length','online','chatPause','available','paused','format','emit','chat_queue:save','exports','md5','../../../config/environment','defaults','redis','localhost','name','timeout','strategy'];(function(_0x16e009,_0x2f3265){var _0x4aee81=function(_0x4dd271){while(--_0x4dd271){_0x16e009['push'](_0x16e009['shift']());}};_0x4aee81(++_0x2f3265);}(_0x9f70,0x7a));var _0x09f7=function(_0x311d03,_0x346bf1){_0x311d03=_0x311d03-0x0;var _0x2c932b=_0x9f70[_0x311d03];return _0x2c932b;};'use strict';var _=require('lodash');var md5=require(_0x09f7('0x0'));var util=require('util');var Redis=require('ioredis');var config=require(_0x09f7('0x1'));config['redis']=_[_0x09f7('0x2')](config[_0x09f7('0x3')],{'host':_0x09f7('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x09f7('0x3')]));function ChatQueue(_0x1f0bd1){this['id']=_0x1f0bd1['id']||0x0;this[_0x09f7('0x5')]=_0x1f0bd1[_0x09f7('0x5')]||'';this['timeout']=_0x1f0bd1[_0x09f7('0x6')]||0xa;this['strategy']=_0x1f0bd1[_0x09f7('0x7')]||_0x09f7('0x8');this[_0x09f7('0x9')]=_0x1f0bd1[_0x09f7('0x9')];this[_0x09f7('0xa')]={};this[_0x09f7('0xb')]=0x0;this[_0x09f7('0x0')]='';this['updateRouting']();this['updateRealtime']();}ChatQueue[_0x09f7('0xc')][_0x09f7('0xd')]=function(){var _0x26983e=this['mapAgentsId'][_0x09f7('0xe')];this[_0x09f7('0xa')]=_['map'](this[_0x09f7('0x9')],'id');this[_0x09f7('0xa')][_0x09f7('0xe')]=_0x26983e;};ChatQueue[_0x09f7('0xc')][_0x09f7('0xf')]=function(){this[_0x09f7('0x10')]=0x0;this['paused']=0x0;for(var _0x14841a=0x0;_0x14841a=0x0?this[_0x09f7('0x14')]:0x0;var _0x48bdd6={'id':this['id'],'available':this[_0x09f7('0x14')],'loggedIn':this[_0x09f7('0x10')],'name':this[_0x09f7('0x5')],'paused':this[_0x09f7('0x15')],'waiting':this[_0x09f7('0xb')]};var _0x2be969=md5(JSON['stringify'](_0x48bdd6));if(this[_0x09f7('0x0')]!==_0x2be969){this[_0x09f7('0x0')]=_0x2be969;io['to'](util[_0x09f7('0x16')]('chat:queue:%s',_0x48bdd6[_0x09f7('0x5')]))[_0x09f7('0x17')](_0x09f7('0x18'),_0x48bdd6);}};module[_0x09f7('0x19')]=ChatQueue; \ No newline at end of file +var _0xd76c=['md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','Agents','loggedIn','paused','length','online','available','stringify','format','chat:queue:%s','emit','exports','lodash'];(function(_0x5a972e,_0x2db978){var _0x37074e=function(_0x257651){while(--_0x257651){_0x5a972e['push'](_0x5a972e['shift']());}};_0x37074e(++_0x2db978);}(_0xd76c,0x195));var _0xcd76=function(_0x4ec9e3,_0x15fbf4){_0x4ec9e3=_0x4ec9e3-0x0;var _0x2883ce=_0xd76c[_0x4ec9e3];return _0x2883ce;};'use strict';var _=require(_0xcd76('0x0'));var md5=require(_0xcd76('0x1'));var util=require(_0xcd76('0x2'));var Redis=require(_0xcd76('0x3'));var config=require('../../../config/environment');config[_0xcd76('0x4')]=_[_0xcd76('0x5')](config[_0xcd76('0x4')],{'host':_0xcd76('0x6'),'port':0x18eb});var io=require(_0xcd76('0x7'))(new Redis(config[_0xcd76('0x4')]));function ChatQueue(_0x1bb250){this['id']=_0x1bb250['id']||0x0;this['name']=_0x1bb250[_0xcd76('0x8')]||'';this[_0xcd76('0x9')]=_0x1bb250[_0xcd76('0x9')]||0xa;this['strategy']=_0x1bb250[_0xcd76('0xa')]||'beepall';this['Agents']=_0x1bb250['Agents'];this[_0xcd76('0xb')]={};this[_0xcd76('0xc')]=0x0;this['md5']='';this[_0xcd76('0xd')]();this[_0xcd76('0xe')]();}ChatQueue[_0xcd76('0xf')]['updateRouting']=function(){var _0xe01446=this['mapAgentsId'][_0xcd76('0x10')];this[_0xcd76('0xb')]=_[_0xcd76('0x11')](this[_0xcd76('0x12')],'id');this[_0xcd76('0xb')][_0xcd76('0x10')]=_0xe01446;};ChatQueue[_0xcd76('0xf')][_0xcd76('0xe')]=function(){this[_0xcd76('0x13')]=0x0;this[_0xcd76('0x14')]=0x0;for(var _0x3daf46=0x0;_0x3daf46=0x0?this[_0xcd76('0x17')]:0x0;var _0x4801bf={'id':this['id'],'available':this[_0xcd76('0x17')],'loggedIn':this[_0xcd76('0x13')],'name':this['name'],'paused':this[_0xcd76('0x14')],'waiting':this[_0xcd76('0xc')]};var _0x501a00=md5(JSON[_0xcd76('0x18')](_0x4801bf));if(this[_0xcd76('0x1')]!==_0x501a00){this[_0xcd76('0x1')]=_0x501a00;io['to'](util[_0xcd76('0x19')](_0xcd76('0x1a'),_0x4801bf[_0xcd76('0x8')]))[_0xcd76('0x1b')]('chat_queue:save',_0x4801bf);}};module[_0xcd76('0x1c')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index b5fbf15..441bacd 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(_0x51fb56,_0x1323c3){var _0x56677d=function(_0x3973be){while(--_0x3973be){_0x51fb56['push'](_0x51fb56['shift']());}};_0x56677d(++_0x1323c3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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(_0x236f50,_0x291099){var _0x5501d7=function(_0x152fad){while(--_0x152fad){_0x236f50['push'](_0x236f50['shift']());}};_0x5501d7(++_0x291099);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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 e7ada00..e019fa8 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 _0xe24a=['Intervals','name'];(function(_0x2cde93,_0x2e61cf){var _0x3c50a0=function(_0x3c38cb){while(--_0x3c38cb){_0x2cde93['push'](_0x2cde93['shift']());}};_0x3c50a0(++_0x2e61cf);}(_0xe24a,0x151));var _0xae24=function(_0x44bb3c,_0x3bfb4b){_0x44bb3c=_0x44bb3c-0x0;var _0x541354=_0xe24a[_0x44bb3c];return _0x541354;};'use strict';function Interval(_0x57aff8){this['id']=_0x57aff8['id']||0x0;this[_0xae24('0x0')]=_0x57aff8[_0xae24('0x0')]||'';this[_0xae24('0x1')]=_0x57aff8['Intervals']||{};}module['exports']=Interval; \ No newline at end of file +var _0x3782=['name'];(function(_0x77eab6,_0x59ca63){var _0x1934d=function(_0x93a9da){while(--_0x93a9da){_0x77eab6['push'](_0x77eab6['shift']());}};_0x1934d(++_0x59ca63);}(_0x3782,0x1f0));var _0x2378=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3782[_0x321bb2];return _0x9c12ed;};'use strict';function Interval(_0x5dc524){this['id']=_0x5dc524['id']||0x0;this[_0x2378('0x0')]=_0x5dc524[_0x2378('0x0')]||'';this['Intervals']=_0x5dc524['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 de03de6..4deaf0e 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 _0xdd10=['util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','online','mailPause','paused','available','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5'];(function(_0x38d57a,_0xb3a46c){var _0x2eb3c5=function(_0x2e5e81){while(--_0x2e5e81){_0x38d57a['push'](_0x38d57a['shift']());}};_0x2eb3c5(++_0xb3a46c);}(_0xdd10,0x7e));var _0x0dd1=function(_0x54517f,_0x587e0c){_0x54517f=_0x54517f-0x0;var _0x72d745=_0xdd10[_0x54517f];return _0x72d745;};'use strict';var _=require(_0x0dd1('0x0'));var md5=require(_0x0dd1('0x1'));var util=require(_0x0dd1('0x2'));var Redis=require(_0x0dd1('0x3'));var config=require(_0x0dd1('0x4'));config[_0x0dd1('0x5')]=_[_0x0dd1('0x6')](config[_0x0dd1('0x5')],{'host':_0x0dd1('0x7'),'port':0x18eb});var io=require(_0x0dd1('0x8'))(new Redis(config[_0x0dd1('0x5')]));function MailQueue(_0x5e4c7e){this['id']=_0x5e4c7e['id']||0x0;this[_0x0dd1('0x9')]=_0x5e4c7e[_0x0dd1('0x9')]||'';this['timeout']=_0x5e4c7e[_0x0dd1('0xa')]||0xa;this[_0x0dd1('0xb')]=_0x5e4c7e[_0x0dd1('0xb')]||_0x0dd1('0xc');this['Agents']=_0x5e4c7e[_0x0dd1('0xd')];this[_0x0dd1('0xe')]={};this[_0x0dd1('0xf')]=0x0;this[_0x0dd1('0x1')]='';this[_0x0dd1('0x10')]();this[_0x0dd1('0x11')]();}MailQueue[_0x0dd1('0x12')][_0x0dd1('0x10')]=function(){var _0x1412ec=this[_0x0dd1('0xe')][_0x0dd1('0x13')];this[_0x0dd1('0xe')]=_[_0x0dd1('0x14')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x1412ec;};MailQueue['prototype'][_0x0dd1('0x11')]=function(){this[_0x0dd1('0x15')]=0x0;this['paused']=0x0;for(var _0x3c3b81=0x0;_0x3c3b81=0x0?this['available']:0x0;var _0x14f1ec={'id':this['id'],'available':this[_0x0dd1('0x1a')],'loggedIn':this['loggedIn'],'name':this[_0x0dd1('0x9')],'paused':this[_0x0dd1('0x19')],'waiting':this[_0x0dd1('0xf')]};var _0x419ed5=md5(JSON['stringify'](_0x14f1ec));if(this[_0x0dd1('0x1')]!==_0x419ed5){this[_0x0dd1('0x1')]=_0x419ed5;io['to'](util[_0x0dd1('0x1b')](_0x0dd1('0x1c'),_0x14f1ec[_0x0dd1('0x9')]))[_0x0dd1('0x1d')](_0x0dd1('0x1e'),_0x14f1ec);}};module[_0x0dd1('0x1f')]=MailQueue; \ No newline at end of file +var _0x50b4=['updateRealtime','prototype','_rr','length','online','loggedIn','mailPause','available','paused','waiting','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','md5','util','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting'];(function(_0x544f3d,_0x2e086e){var _0x2201b1=function(_0x5bf17b){while(--_0x5bf17b){_0x544f3d['push'](_0x544f3d['shift']());}};_0x2201b1(++_0x2e086e);}(_0x50b4,0x67));var _0x450b=function(_0x5abe06,_0x131a9b){_0x5abe06=_0x5abe06-0x0;var _0xf0f180=_0x50b4[_0x5abe06];return _0xf0f180;};'use strict';var _=require('lodash');var md5=require(_0x450b('0x0'));var util=require(_0x450b('0x1'));var Redis=require('ioredis');var config=require(_0x450b('0x2'));config[_0x450b('0x3')]=_[_0x450b('0x4')](config[_0x450b('0x3')],{'host':_0x450b('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x450b('0x3')]));function MailQueue(_0x4de76e){this['id']=_0x4de76e['id']||0x0;this[_0x450b('0x6')]=_0x4de76e[_0x450b('0x6')]||'';this[_0x450b('0x7')]=_0x4de76e[_0x450b('0x7')]||0xa;this[_0x450b('0x8')]=_0x4de76e[_0x450b('0x8')]||_0x450b('0x9');this[_0x450b('0xa')]=_0x4de76e[_0x450b('0xa')];this[_0x450b('0xb')]={};this['waiting']=0x0;this[_0x450b('0x0')]='';this[_0x450b('0xc')]();this[_0x450b('0xd')]();}MailQueue[_0x450b('0xe')]['updateRouting']=function(){var _0x2adb84=this[_0x450b('0xb')]['_rr'];this['mapAgentsId']=_['map'](this[_0x450b('0xa')],'id');this['mapAgentsId'][_0x450b('0xf')]=_0x2adb84;};MailQueue[_0x450b('0xe')]['updateRealtime']=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x5ed2be=0x0;_0x5ed2be=0x0?this[_0x450b('0x14')]:0x0;var _0x4e6cd9={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x450b('0x15')],'waiting':this[_0x450b('0x16')]};var _0x32b7b3=md5(JSON[_0x450b('0x17')](_0x4e6cd9));if(this[_0x450b('0x0')]!==_0x32b7b3){this[_0x450b('0x0')]=_0x32b7b3;io['to'](util[_0x450b('0x18')](_0x450b('0x19'),_0x4e6cd9['name']))[_0x450b('0x1a')](_0x450b('0x1b'),_0x4e6cd9);}};module[_0x450b('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 a152287..6390d7c 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 _0xc15c=['openchannel_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','paused','length','online','loggedIn','openchannelPause','available','waiting','openchannel:queue:%s','emit'];(function(_0x4ac39c,_0x423047){var _0x20154e=function(_0x49e390){while(--_0x49e390){_0x4ac39c['push'](_0x4ac39c['shift']());}};_0x20154e(++_0x423047);}(_0xc15c,0xb0));var _0xcc15=function(_0x1bf281,_0x25e967){_0x1bf281=_0x1bf281-0x0;var _0x249f63=_0xc15c[_0x1bf281];return _0x249f63;};'use strict';var _=require(_0xcc15('0x0'));var md5=require(_0xcc15('0x1'));var util=require(_0xcc15('0x2'));var Redis=require('ioredis');var config=require(_0xcc15('0x3'));config[_0xcc15('0x4')]=_[_0xcc15('0x5')](config[_0xcc15('0x4')],{'host':_0xcc15('0x6'),'port':0x18eb});var io=require(_0xcc15('0x7'))(new Redis(config[_0xcc15('0x4')]));function OpenchannelQueue(_0x2950f7){this['id']=_0x2950f7['id']||0x0;this[_0xcc15('0x8')]=_0x2950f7[_0xcc15('0x8')]||'';this[_0xcc15('0x9')]=_0x2950f7[_0xcc15('0x9')]||0xa;this[_0xcc15('0xa')]=_0x2950f7[_0xcc15('0xa')]||_0xcc15('0xb');this[_0xcc15('0xc')]=_0x2950f7[_0xcc15('0xc')];this[_0xcc15('0xd')]={};this['waiting']=0x0;this['md5']='';this[_0xcc15('0xe')]();this[_0xcc15('0xf')]();}OpenchannelQueue['prototype'][_0xcc15('0xe')]=function(){var _0x1e1e76=this['mapAgentsId']['_rr'];this[_0xcc15('0xd')]=_[_0xcc15('0x10')](this[_0xcc15('0xc')],'id');this['mapAgentsId'][_0xcc15('0x11')]=_0x1e1e76;};OpenchannelQueue['prototype']['updateRealtime']=function(){this['loggedIn']=0x0;this[_0xcc15('0x12')]=0x0;for(var _0x81bef3=0x0;_0x81bef3=0x0?this[_0xcc15('0x17')]:0x0;var _0x1bfa39={'id':this['id'],'available':this[_0xcc15('0x17')],'loggedIn':this[_0xcc15('0x15')],'name':this[_0xcc15('0x8')],'paused':this['paused'],'waiting':this[_0xcc15('0x18')]};var _0x2b92e3=md5(JSON['stringify'](_0x1bfa39));if(this['md5']!==_0x2b92e3){this[_0xcc15('0x1')]=_0x2b92e3;io['to'](util['format'](_0xcc15('0x19'),_0x1bfa39[_0xcc15('0x8')]))[_0xcc15('0x1a')](_0xcc15('0x1b'),_0x1bfa39);}};module[_0xcc15('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0x390b=['socket.io-emitter','redis','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','loggedIn','length','online','openchannelPause','paused','available','name','stringify','format','openchannel:queue:%s','exports','lodash','md5','util','ioredis','../../../config/environment'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x390b,0xf7));var _0xb390=function(_0x246c42,_0x251653){_0x246c42=_0x246c42-0x0;var _0x190b1d=_0x390b[_0x246c42];return _0x190b1d;};'use strict';var _=require(_0xb390('0x0'));var md5=require(_0xb390('0x1'));var util=require(_0xb390('0x2'));var Redis=require(_0xb390('0x3'));var config=require(_0xb390('0x4'));config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xb390('0x5'))(new Redis(config[_0xb390('0x6')]));function OpenchannelQueue(_0x2d8782){this['id']=_0x2d8782['id']||0x0;this['name']=_0x2d8782['name']||'';this['timeout']=_0x2d8782[_0xb390('0x7')]||0xa;this[_0xb390('0x8')]=_0x2d8782['strategy']||_0xb390('0x9');this[_0xb390('0xa')]=_0x2d8782[_0xb390('0xa')];this[_0xb390('0xb')]={};this[_0xb390('0xc')]=0x0;this['md5']='';this[_0xb390('0xd')]();this[_0xb390('0xe')]();}OpenchannelQueue[_0xb390('0xf')][_0xb390('0xd')]=function(){var _0x3dd523=this['mapAgentsId']['_rr'];this[_0xb390('0xb')]=_[_0xb390('0x10')](this[_0xb390('0xa')],'id');this[_0xb390('0xb')]['_rr']=_0x3dd523;};OpenchannelQueue['prototype'][_0xb390('0xe')]=function(){this[_0xb390('0x11')]=0x0;this['paused']=0x0;for(var _0x3b50ee=0x0;_0x3b50ee=0x0?this[_0xb390('0x16')]:0x0;var _0x5de504={'id':this['id'],'available':this[_0xb390('0x16')],'loggedIn':this[_0xb390('0x11')],'name':this[_0xb390('0x17')],'paused':this['paused'],'waiting':this['waiting']};var _0x5c6b9a=md5(JSON[_0xb390('0x18')](_0x5de504));if(this[_0xb390('0x1')]!==_0x5c6b9a){this[_0xb390('0x1')]=_0x5c6b9a;io['to'](util[_0xb390('0x19')](_0xb390('0x1a'),_0x5de504[_0xb390('0x17')]))['emit']('openchannel_queue:save',_0x5de504);}};module[_0xb390('0x1b')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 05d84c0..ce302ef 100644 --- a/server/services/routing/model/smsQueue.js +++ b/server/services/routing/model/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['prototype','_rr','map','online','loggedIn','smsPause','available','paused','stringify','format','sms:queue:%s','emit','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x465e1c,_0xdff365){var _0xb35dda=function(_0x496535){while(--_0x496535){_0x465e1c['push'](_0x465e1c['shift']());}};_0xb35dda(++_0xdff365);}(_0xe706,0xa3));var _0x6e70=function(_0x12b830,_0xd66540){_0x12b830=_0x12b830-0x0;var _0x261dc4=_0xe706[_0x12b830];return _0x261dc4;};'use strict';var _=require(_0x6e70('0x0'));var md5=require(_0x6e70('0x1'));var util=require(_0x6e70('0x2'));var Redis=require('ioredis');var config=require(_0x6e70('0x3'));config[_0x6e70('0x4')]=_[_0x6e70('0x5')](config[_0x6e70('0x4')],{'host':_0x6e70('0x6'),'port':0x18eb});var io=require(_0x6e70('0x7'))(new Redis(config[_0x6e70('0x4')]));function SmsQueue(_0x506db9){this['id']=_0x506db9['id']||0x0;this[_0x6e70('0x8')]=_0x506db9[_0x6e70('0x8')]||'';this[_0x6e70('0x9')]=_0x506db9[_0x6e70('0x9')]||0xa;this[_0x6e70('0xa')]=_0x506db9[_0x6e70('0xa')]||_0x6e70('0xb');this[_0x6e70('0xc')]=_0x506db9[_0x6e70('0xc')];this[_0x6e70('0xd')]={};this[_0x6e70('0xe')]=0x0;this[_0x6e70('0x1')]='';this[_0x6e70('0xf')]();this[_0x6e70('0x10')]();}SmsQueue[_0x6e70('0x11')][_0x6e70('0xf')]=function(){var _0x5b3d07=this['mapAgentsId'][_0x6e70('0x12')];this[_0x6e70('0xd')]=_[_0x6e70('0x13')](this[_0x6e70('0xc')],'id');this[_0x6e70('0xd')][_0x6e70('0x12')]=_0x5b3d07;};SmsQueue[_0x6e70('0x11')][_0x6e70('0x10')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x48bc72=0x0;_0x48bc72=0x0?this['available']:0x0;var _0x28a21f={'id':this['id'],'available':this[_0x6e70('0x17')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x6e70('0x18')],'waiting':this[_0x6e70('0xe')]};var _0x2368eb=md5(JSON[_0x6e70('0x19')](_0x28a21f));if(this[_0x6e70('0x1')]!==_0x2368eb){this[_0x6e70('0x1')]=_0x2368eb;io['to'](util[_0x6e70('0x1a')](_0x6e70('0x1b'),_0x28a21f[_0x6e70('0x8')]))[_0x6e70('0x1c')]('sms_queue:save',_0x28a21f);}};module[_0x6e70('0x1d')]=SmsQueue; \ No newline at end of file +var _0xb10b=['length','online','loggedIn','smsPause','available','stringify','format','sms:queue:%s','emit','sms_queue:save','lodash','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','prototype','updateRouting','_rr','map','updateRealtime','paused'];(function(_0x30033a,_0x5ce4a6){var _0x5e3518=function(_0x11494a){while(--_0x11494a){_0x30033a['push'](_0x30033a['shift']());}};_0x5e3518(++_0x5ce4a6);}(_0xb10b,0x12a));var _0xbb10=function(_0x4a94d0,_0x374e5d){_0x4a94d0=_0x4a94d0-0x0;var _0x50128a=_0xb10b[_0x4a94d0];return _0x50128a;};'use strict';var _=require(_0xbb10('0x0'));var md5=require('md5');var util=require(_0xbb10('0x1'));var Redis=require(_0xbb10('0x2'));var config=require(_0xbb10('0x3'));config['redis']=_[_0xbb10('0x4')](config[_0xbb10('0x5')],{'host':_0xbb10('0x6'),'port':0x18eb});var io=require(_0xbb10('0x7'))(new Redis(config[_0xbb10('0x5')]));function SmsQueue(_0x312b72){this['id']=_0x312b72['id']||0x0;this['name']=_0x312b72[_0xbb10('0x8')]||'';this[_0xbb10('0x9')]=_0x312b72['timeout']||0xa;this[_0xbb10('0xa')]=_0x312b72[_0xbb10('0xa')]||_0xbb10('0xb');this[_0xbb10('0xc')]=_0x312b72[_0xbb10('0xc')];this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]=0x0;this[_0xbb10('0xf')]='';this['updateRouting']();this['updateRealtime']();}SmsQueue[_0xbb10('0x10')][_0xbb10('0x11')]=function(){var _0xce64f3=this['mapAgentsId'][_0xbb10('0x12')];this['mapAgentsId']=_[_0xbb10('0x13')](this[_0xbb10('0xc')],'id');this[_0xbb10('0xd')][_0xbb10('0x12')]=_0xce64f3;};SmsQueue[_0xbb10('0x10')][_0xbb10('0x14')]=function(){this['loggedIn']=0x0;this[_0xbb10('0x15')]=0x0;for(var _0x42d7e4=0x0;_0x42d7e4=0x0?this[_0xbb10('0x1a')]:0x0;var _0x1682a4={'id':this['id'],'available':this[_0xbb10('0x1a')],'loggedIn':this[_0xbb10('0x18')],'name':this[_0xbb10('0x8')],'paused':this[_0xbb10('0x15')],'waiting':this['waiting']};var _0x5ff0cf=md5(JSON[_0xbb10('0x1b')](_0x1682a4));if(this[_0xbb10('0xf')]!==_0x5ff0cf){this[_0xbb10('0xf')]=_0x5ff0cf;io['to'](util[_0xbb10('0x1c')](_0xbb10('0x1d'),_0x1682a4['name']))[_0xbb10('0x1e')](_0xbb10('0x1f'),_0x1682a4);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index d5f0c79..628b14b 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 _0x3576=['exports','md5','util','ioredis','../../../config/environment','defaults','redis','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','paused','length','whatsappPause','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save'];(function(_0x5a42c2,_0x1b39f4){var _0x54ff4f=function(_0x3f9657){while(--_0x3f9657){_0x5a42c2['push'](_0x5a42c2['shift']());}};_0x54ff4f(++_0x1b39f4);}(_0x3576,0xe9));var _0x6357=function(_0x12d283,_0x4166aa){_0x12d283=_0x12d283-0x0;var _0x3b4321=_0x3576[_0x12d283];return _0x3b4321;};'use strict';var _=require('lodash');var md5=require(_0x6357('0x0'));var util=require(_0x6357('0x1'));var Redis=require(_0x6357('0x2'));var config=require(_0x6357('0x3'));config['redis']=_[_0x6357('0x4')](config[_0x6357('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x6357('0x6'))(new Redis(config['redis']));function WhatsappQueue(_0xeafaa7){this['id']=_0xeafaa7['id']||0x0;this[_0x6357('0x7')]=_0xeafaa7[_0x6357('0x7')]||'';this[_0x6357('0x8')]=_0xeafaa7[_0x6357('0x8')]||0xa;this[_0x6357('0x9')]=_0xeafaa7[_0x6357('0x9')]||'beepall';this['Agents']=_0xeafaa7[_0x6357('0xa')];this[_0x6357('0xb')]={};this[_0x6357('0xc')]=0x0;this[_0x6357('0x0')]='';this['updateRouting']();this[_0x6357('0xd')]();}WhatsappQueue[_0x6357('0xe')][_0x6357('0xf')]=function(){var _0x1b115d=this[_0x6357('0xb')][_0x6357('0x10')];this[_0x6357('0xb')]=_[_0x6357('0x11')](this[_0x6357('0xa')],'id');this['mapAgentsId'][_0x6357('0x10')]=_0x1b115d;};WhatsappQueue['prototype'][_0x6357('0xd')]=function(){this[_0x6357('0x12')]=0x0;this[_0x6357('0x13')]=0x0;for(var _0x579321=0x0;_0x579321=0x0?this[_0x6357('0x16')]:0x0;var _0x53f5df={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x6357('0x7')],'paused':this[_0x6357('0x13')],'waiting':this[_0x6357('0xc')]};var _0x21c248=md5(JSON[_0x6357('0x17')](_0x53f5df));if(this[_0x6357('0x0')]!==_0x21c248){this[_0x6357('0x0')]=_0x21c248;io['to'](util[_0x6357('0x18')](_0x6357('0x19'),_0x53f5df[_0x6357('0x7')]))[_0x6357('0x1a')](_0x6357('0x1b'),_0x53f5df);}};module[_0x6357('0x1c')]=WhatsappQueue; \ No newline at end of file +var _0x3339=['name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','paused','length','online','whatsappPause','available','md5','format','whatsapp:queue:%s','emit','whatsapp_queue:save','lodash','util','ioredis','redis','defaults','localhost','socket.io-emitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3339,0xcb));var _0x9333=function(_0x26037a,_0x108f0d){_0x26037a=_0x26037a-0x0;var _0x53d1d0=_0x3339[_0x26037a];return _0x53d1d0;};'use strict';var _=require(_0x9333('0x0'));var md5=require('md5');var util=require(_0x9333('0x1'));var Redis=require(_0x9333('0x2'));var config=require('../../../config/environment');config[_0x9333('0x3')]=_[_0x9333('0x4')](config[_0x9333('0x3')],{'host':_0x9333('0x5'),'port':0x18eb});var io=require(_0x9333('0x6'))(new Redis(config[_0x9333('0x3')]));function WhatsappQueue(_0x5690ea){this['id']=_0x5690ea['id']||0x0;this[_0x9333('0x7')]=_0x5690ea[_0x9333('0x7')]||'';this[_0x9333('0x8')]=_0x5690ea['timeout']||0xa;this['strategy']=_0x5690ea[_0x9333('0x9')]||_0x9333('0xa');this[_0x9333('0xb')]=_0x5690ea['Agents'];this[_0x9333('0xc')]={};this[_0x9333('0xd')]=0x0;this['md5']='';this[_0x9333('0xe')]();this['updateRealtime']();}WhatsappQueue[_0x9333('0xf')]['updateRouting']=function(){var _0x14efb0=this[_0x9333('0xc')][_0x9333('0x10')];this['mapAgentsId']=_[_0x9333('0x11')](this[_0x9333('0xb')],'id');this[_0x9333('0xc')][_0x9333('0x10')]=_0x14efb0;};WhatsappQueue[_0x9333('0xf')][_0x9333('0x12')]=function(){this[_0x9333('0x13')]=0x0;this[_0x9333('0x14')]=0x0;for(var _0x2e9506=0x0;_0x2e9506=0x0?this[_0x9333('0x18')]:0x0;var _0xd50aa7={'id':this['id'],'available':this[_0x9333('0x18')],'loggedIn':this[_0x9333('0x13')],'name':this[_0x9333('0x7')],'paused':this[_0x9333('0x14')],'waiting':this['waiting']};var _0x461cb2=md5(JSON['stringify'](_0xd50aa7));if(this['md5']!==_0x461cb2){this[_0x9333('0x19')]=_0x461cb2;io['to'](util[_0x9333('0x1a')](_0x9333('0x1b'),_0xd50aa7['name']))[_0x9333('0x1c')](_0x9333('0x1d'),_0xd50aa7);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 40413a0..0f45678 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 _0xafba=['../model/agent','../model/interval','../model/openchannelQueue','../model/smsQueue','../model/mailQueue','agents','openchannelQueues','smsQueues','mailQueues','faxQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','mapKeys','prototype','hasOwnProperty','length','isUndefined','initIntervals','intervals','mergeFromDatabase','initOpenchannelQueues','updateRouting','initChatQueues','chatQueues','updateRealtime','initSmsQueues','initFaxQueues','exports','util','lodash'];(function(_0x3453b3,_0x51c26d){var _0x15a7b3=function(_0x593bbc){while(--_0x593bbc){_0x3453b3['push'](_0x3453b3['shift']());}};_0x15a7b3(++_0x51c26d);}(_0xafba,0x17e));var _0xaafb=function(_0x163303,_0xa6b8f2){_0x163303=_0x163303-0x0;var _0x2cd29d=_0xafba[_0x163303];return _0x2cd29d;};'use strict';var BPromise=require('bluebird');var util=require(_0xaafb('0x0'));var _=require(_0xaafb('0x1'));var moment=require('moment');var Agent=require(_0xaafb('0x2'));var Interval=require(_0xaafb('0x3'));var OpenchannelQueue=require(_0xaafb('0x4'));var ChatQueue=require('../model/chatQueue');var SmsQueue=require(_0xaafb('0x5'));var MailQueue=require(_0xaafb('0x6'));var FaxQueue=require('../model/faxQueue');var Realtime=function(){this[_0xaafb('0x7')]={};this['intervals']={};this[_0xaafb('0x8')]={};this['chatQueues']={};this[_0xaafb('0x9')]={};this[_0xaafb('0xa')]={};this[_0xaafb('0xb')]={};this[_0xaafb('0xc')]={};this['mailQueuesWaitingInteractions']={};this[_0xaafb('0xd')]={};this[_0xaafb('0xe')]={};this[_0xaafb('0xf')]={};};function freeIsNotKey(_0x2ac987,_0x2e4e30,_0x3365d6){var _0x30ef22=_[_0xaafb('0x10')](_0x2ac987,function(_0x571ac4,_0x3f5460){return _0x571ac4[_0x3365d6];});for(var _0x58a5fd in _0x2e4e30){if(_0x2e4e30['hasOwnProperty'](_0x58a5fd)){if(!_0x30ef22[_0x58a5fd]){delete _0x2e4e30[_0x58a5fd];}}}}Realtime[_0xaafb('0x11')]['mergeFromDatabase']=function(_0x829860,_0x3ff4d3){for(var _0x2d013a in _0x3ff4d3){if(_0x829860[_0xaafb('0x12')](_0x2d013a)){_0x829860[_0x2d013a]=_0x3ff4d3[_0x2d013a];}}};Realtime[_0xaafb('0x11')]['initAgents']=function(){var _0x2b7949=this;return function(_0x10da67){if(_0x10da67){freeIsNotKey(_0x10da67,_0x2b7949[_0xaafb('0x7')],'id');for(var _0x1e27be=0x0,_0x342b13={},_0x160de5={};_0x1e27be<_0x10da67[_0xaafb('0x13')];_0x1e27be+=0x1){_0x342b13=_0x10da67[_0x1e27be];if(_[_0xaafb('0x14')](_0x2b7949[_0xaafb('0x7')][_0x342b13['id']])){_0x2b7949['agents'][_0x342b13['id']]=new Agent(_0x342b13);}else{_0x2b7949['mergeFromDatabase'](_0x2b7949['agents'][_0x342b13['id']],_0x342b13);}}}return _0x2b7949[_0xaafb('0x7')];};};Realtime[_0xaafb('0x11')][_0xaafb('0x15')]=function(){var _0x4d2f68=this;return function(_0x45f700){if(_0x45f700){freeIsNotKey(_0x45f700,_0x4d2f68['intervals'],'id');for(var _0x403d99=0x0,_0x318723={},_0x470b37={};_0x403d99<_0x45f700[_0xaafb('0x13')];_0x403d99+=0x1){_0x318723=_0x45f700[_0x403d99];if(_['isUndefined'](_0x4d2f68[_0xaafb('0x16')][_0x318723['id']])){_0x4d2f68[_0xaafb('0x16')][_0x318723['id']]=new Interval(_0x318723);}else{_0x4d2f68[_0xaafb('0x17')](_0x4d2f68['intervals'][_0x318723['id']],_0x318723);}}}return _0x4d2f68[_0xaafb('0x16')];};};Realtime[_0xaafb('0x11')][_0xaafb('0x18')]=function(){var _0x55abba=this;return function(_0x386725){if(_0x386725){freeIsNotKey(_0x386725,_0x55abba['openchannelQueues'],'id');for(var _0x469600=0x0,_0x4941f9={},_0x150066={};_0x469600<_0x386725[_0xaafb('0x13')];_0x469600+=0x1){_0x4941f9=_0x386725[_0x469600];if(_[_0xaafb('0x14')](_0x55abba[_0xaafb('0x8')][_0x4941f9['id']])){_0x55abba[_0xaafb('0x8')][_0x4941f9['id']]=new OpenchannelQueue(_0x4941f9);}else{_0x55abba[_0xaafb('0x17')](_0x55abba[_0xaafb('0x8')][_0x4941f9['id']],_0x4941f9);}_0x55abba[_0xaafb('0x8')][_0x4941f9['id']][_0xaafb('0x19')]();_0x55abba[_0xaafb('0x8')][_0x4941f9['id']]['updateRealtime']();}}return _0x55abba[_0xaafb('0x8')];};};Realtime[_0xaafb('0x11')][_0xaafb('0x1a')]=function(){var _0x3d4745=this;return function(_0x43f7a6){if(_0x43f7a6){freeIsNotKey(_0x43f7a6,_0x3d4745['chatQueues'],'id');for(var _0x4792f0=0x0,_0x439230={},_0x2c5c18={};_0x4792f0<_0x43f7a6[_0xaafb('0x13')];_0x4792f0+=0x1){_0x439230=_0x43f7a6[_0x4792f0];if(_[_0xaafb('0x14')](_0x3d4745[_0xaafb('0x1b')][_0x439230['id']])){_0x3d4745[_0xaafb('0x1b')][_0x439230['id']]=new ChatQueue(_0x439230);}else{_0x3d4745[_0xaafb('0x17')](_0x3d4745[_0xaafb('0x1b')][_0x439230['id']],_0x439230);}_0x3d4745[_0xaafb('0x1b')][_0x439230['id']]['updateRouting']();_0x3d4745['chatQueues'][_0x439230['id']][_0xaafb('0x1c')]();}}return _0x3d4745['chatQueues'];};};Realtime[_0xaafb('0x11')][_0xaafb('0x1d')]=function(){var _0x466b81=this;return function(_0x1e9820){if(_0x1e9820){freeIsNotKey(_0x1e9820,_0x466b81['smsQueues'],'id');for(var _0x8612d7=0x0,_0xe4da85={},_0xec1b1f={};_0x8612d7<_0x1e9820[_0xaafb('0x13')];_0x8612d7+=0x1){_0xe4da85=_0x1e9820[_0x8612d7];if(_[_0xaafb('0x14')](_0x466b81['smsQueues'][_0xe4da85['id']])){_0x466b81[_0xaafb('0x9')][_0xe4da85['id']]=new SmsQueue(_0xe4da85);}else{_0x466b81['mergeFromDatabase'](_0x466b81['smsQueues'][_0xe4da85['id']],_0xe4da85);}_0x466b81[_0xaafb('0x9')][_0xe4da85['id']][_0xaafb('0x19')]();_0x466b81[_0xaafb('0x9')][_0xe4da85['id']][_0xaafb('0x1c')]();}}return _0x466b81['smsQueues'];};};Realtime[_0xaafb('0x11')]['initMailQueues']=function(){var _0x54f6f1=this;return function(_0x4dcd08){if(_0x4dcd08){freeIsNotKey(_0x4dcd08,_0x54f6f1['mailQueues'],'id');for(var _0x5eb373=0x0,_0x23eb67={},_0x3948ef={};_0x5eb373<_0x4dcd08['length'];_0x5eb373+=0x1){_0x23eb67=_0x4dcd08[_0x5eb373];if(_[_0xaafb('0x14')](_0x54f6f1[_0xaafb('0xa')][_0x23eb67['id']])){_0x54f6f1[_0xaafb('0xa')][_0x23eb67['id']]=new MailQueue(_0x23eb67);}else{_0x54f6f1[_0xaafb('0x17')](_0x54f6f1['mailQueues'][_0x23eb67['id']],_0x23eb67);}_0x54f6f1[_0xaafb('0xa')][_0x23eb67['id']][_0xaafb('0x19')]();_0x54f6f1[_0xaafb('0xa')][_0x23eb67['id']][_0xaafb('0x1c')]();}}return _0x54f6f1[_0xaafb('0xa')];};};Realtime[_0xaafb('0x11')][_0xaafb('0x1e')]=function(){var _0x17eb6b=this;return function(_0x4be6f1){if(_0x4be6f1){freeIsNotKey(_0x4be6f1,_0x17eb6b['faxQueues'],'id');for(var _0x1f9879=0x0,_0x191ff6={},_0x18280f={};_0x1f9879<_0x4be6f1[_0xaafb('0x13')];_0x1f9879+=0x1){_0x191ff6=_0x4be6f1[_0x1f9879];if(_[_0xaafb('0x14')](_0x17eb6b[_0xaafb('0xb')][_0x191ff6['id']])){_0x17eb6b[_0xaafb('0xb')][_0x191ff6['id']]=new FaxQueue(_0x191ff6);}else{_0x17eb6b['mergeFromDatabase'](_0x17eb6b[_0xaafb('0xb')][_0x191ff6['id']],_0x191ff6);}_0x17eb6b[_0xaafb('0xb')][_0x191ff6['id']][_0xaafb('0x19')]();_0x17eb6b[_0xaafb('0xb')][_0x191ff6['id']]['updateRealtime']();}}return _0x17eb6b[_0xaafb('0xb')];};};module[_0xaafb('0x1f')]=Realtime; \ No newline at end of file +var _0xb9b5=['../model/agent','../model/interval','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','agents','intervals','openchannelQueues','smsQueues','mailQueues','faxQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','mapKeys','hasOwnProperty','mergeFromDatabase','length','isUndefined','prototype','initIntervals','initOpenchannelQueues','updateRouting','updateRealtime','initChatQueues','chatQueues','initMailQueues','initFaxQueues','exports','bluebird','util','lodash','moment'];(function(_0x3a55a1,_0x1b284d){var _0x5c605b=function(_0x55f48b){while(--_0x55f48b){_0x3a55a1['push'](_0x3a55a1['shift']());}};_0x5c605b(++_0x1b284d);}(_0xb9b5,0x1c3));var _0x5b9b=function(_0x3fd3a3,_0x36c863){_0x3fd3a3=_0x3fd3a3-0x0;var _0xa3e4d5=_0xb9b5[_0x3fd3a3];return _0xa3e4d5;};'use strict';var BPromise=require(_0x5b9b('0x0'));var util=require(_0x5b9b('0x1'));var _=require(_0x5b9b('0x2'));var moment=require(_0x5b9b('0x3'));var Agent=require(_0x5b9b('0x4'));var Interval=require(_0x5b9b('0x5'));var OpenchannelQueue=require(_0x5b9b('0x6'));var ChatQueue=require(_0x5b9b('0x7'));var SmsQueue=require(_0x5b9b('0x8'));var MailQueue=require(_0x5b9b('0x9'));var FaxQueue=require('../model/faxQueue');var Realtime=function(){this[_0x5b9b('0xa')]={};this[_0x5b9b('0xb')]={};this[_0x5b9b('0xc')]={};this['chatQueues']={};this[_0x5b9b('0xd')]={};this[_0x5b9b('0xe')]={};this[_0x5b9b('0xf')]={};this[_0x5b9b('0x10')]={};this[_0x5b9b('0x11')]={};this[_0x5b9b('0x12')]={};this['smsQueuesWaitingInteractions']={};this[_0x5b9b('0x13')]={};};function freeIsNotKey(_0x399252,_0x1ac64b,_0x412445){var _0x1b1ff1=_[_0x5b9b('0x14')](_0x399252,function(_0x57611c,_0x14150f){return _0x57611c[_0x412445];});for(var _0x16fa25 in _0x1ac64b){if(_0x1ac64b[_0x5b9b('0x15')](_0x16fa25)){if(!_0x1b1ff1[_0x16fa25]){delete _0x1ac64b[_0x16fa25];}}}}Realtime['prototype'][_0x5b9b('0x16')]=function(_0x2328b9,_0x1bd299){for(var _0x1b8b8c in _0x1bd299){if(_0x2328b9[_0x5b9b('0x15')](_0x1b8b8c)){_0x2328b9[_0x1b8b8c]=_0x1bd299[_0x1b8b8c];}}};Realtime['prototype']['initAgents']=function(){var _0x3f4268=this;return function(_0x120039){if(_0x120039){freeIsNotKey(_0x120039,_0x3f4268[_0x5b9b('0xa')],'id');for(var _0x168d7a=0x0,_0x31b1d1={},_0x2e3468={};_0x168d7a<_0x120039[_0x5b9b('0x17')];_0x168d7a+=0x1){_0x31b1d1=_0x120039[_0x168d7a];if(_[_0x5b9b('0x18')](_0x3f4268[_0x5b9b('0xa')][_0x31b1d1['id']])){_0x3f4268['agents'][_0x31b1d1['id']]=new Agent(_0x31b1d1);}else{_0x3f4268[_0x5b9b('0x16')](_0x3f4268['agents'][_0x31b1d1['id']],_0x31b1d1);}}}return _0x3f4268[_0x5b9b('0xa')];};};Realtime[_0x5b9b('0x19')][_0x5b9b('0x1a')]=function(){var _0x502337=this;return function(_0x28a869){if(_0x28a869){freeIsNotKey(_0x28a869,_0x502337[_0x5b9b('0xb')],'id');for(var _0x4b87d4=0x0,_0x43c8f5={},_0x6cbc2f={};_0x4b87d4<_0x28a869[_0x5b9b('0x17')];_0x4b87d4+=0x1){_0x43c8f5=_0x28a869[_0x4b87d4];if(_[_0x5b9b('0x18')](_0x502337[_0x5b9b('0xb')][_0x43c8f5['id']])){_0x502337[_0x5b9b('0xb')][_0x43c8f5['id']]=new Interval(_0x43c8f5);}else{_0x502337[_0x5b9b('0x16')](_0x502337[_0x5b9b('0xb')][_0x43c8f5['id']],_0x43c8f5);}}}return _0x502337[_0x5b9b('0xb')];};};Realtime[_0x5b9b('0x19')][_0x5b9b('0x1b')]=function(){var _0x3b238f=this;return function(_0x18fd42){if(_0x18fd42){freeIsNotKey(_0x18fd42,_0x3b238f[_0x5b9b('0xc')],'id');for(var _0x38aba1=0x0,_0x22f648={},_0x131e41={};_0x38aba1<_0x18fd42[_0x5b9b('0x17')];_0x38aba1+=0x1){_0x22f648=_0x18fd42[_0x38aba1];if(_[_0x5b9b('0x18')](_0x3b238f[_0x5b9b('0xc')][_0x22f648['id']])){_0x3b238f['openchannelQueues'][_0x22f648['id']]=new OpenchannelQueue(_0x22f648);}else{_0x3b238f[_0x5b9b('0x16')](_0x3b238f[_0x5b9b('0xc')][_0x22f648['id']],_0x22f648);}_0x3b238f['openchannelQueues'][_0x22f648['id']][_0x5b9b('0x1c')]();_0x3b238f[_0x5b9b('0xc')][_0x22f648['id']][_0x5b9b('0x1d')]();}}return _0x3b238f[_0x5b9b('0xc')];};};Realtime['prototype'][_0x5b9b('0x1e')]=function(){var _0x37ccbe=this;return function(_0x2816d8){if(_0x2816d8){freeIsNotKey(_0x2816d8,_0x37ccbe[_0x5b9b('0x1f')],'id');for(var _0x3281bb=0x0,_0x4617d1={},_0xa1bca1={};_0x3281bb<_0x2816d8[_0x5b9b('0x17')];_0x3281bb+=0x1){_0x4617d1=_0x2816d8[_0x3281bb];if(_[_0x5b9b('0x18')](_0x37ccbe[_0x5b9b('0x1f')][_0x4617d1['id']])){_0x37ccbe[_0x5b9b('0x1f')][_0x4617d1['id']]=new ChatQueue(_0x4617d1);}else{_0x37ccbe['mergeFromDatabase'](_0x37ccbe[_0x5b9b('0x1f')][_0x4617d1['id']],_0x4617d1);}_0x37ccbe[_0x5b9b('0x1f')][_0x4617d1['id']][_0x5b9b('0x1c')]();_0x37ccbe[_0x5b9b('0x1f')][_0x4617d1['id']]['updateRealtime']();}}return _0x37ccbe[_0x5b9b('0x1f')];};};Realtime[_0x5b9b('0x19')]['initSmsQueues']=function(){var _0x95a508=this;return function(_0x551b69){if(_0x551b69){freeIsNotKey(_0x551b69,_0x95a508[_0x5b9b('0xd')],'id');for(var _0x5defbe=0x0,_0x5279d1={},_0x5ea215={};_0x5defbe<_0x551b69[_0x5b9b('0x17')];_0x5defbe+=0x1){_0x5279d1=_0x551b69[_0x5defbe];if(_[_0x5b9b('0x18')](_0x95a508['smsQueues'][_0x5279d1['id']])){_0x95a508[_0x5b9b('0xd')][_0x5279d1['id']]=new SmsQueue(_0x5279d1);}else{_0x95a508[_0x5b9b('0x16')](_0x95a508[_0x5b9b('0xd')][_0x5279d1['id']],_0x5279d1);}_0x95a508[_0x5b9b('0xd')][_0x5279d1['id']][_0x5b9b('0x1c')]();_0x95a508[_0x5b9b('0xd')][_0x5279d1['id']][_0x5b9b('0x1d')]();}}return _0x95a508[_0x5b9b('0xd')];};};Realtime[_0x5b9b('0x19')][_0x5b9b('0x20')]=function(){var _0x1c6542=this;return function(_0x10404e){if(_0x10404e){freeIsNotKey(_0x10404e,_0x1c6542[_0x5b9b('0xe')],'id');for(var _0x53d105=0x0,_0x1d3930={},_0x7db1da={};_0x53d105<_0x10404e[_0x5b9b('0x17')];_0x53d105+=0x1){_0x1d3930=_0x10404e[_0x53d105];if(_[_0x5b9b('0x18')](_0x1c6542[_0x5b9b('0xe')][_0x1d3930['id']])){_0x1c6542[_0x5b9b('0xe')][_0x1d3930['id']]=new MailQueue(_0x1d3930);}else{_0x1c6542[_0x5b9b('0x16')](_0x1c6542['mailQueues'][_0x1d3930['id']],_0x1d3930);}_0x1c6542[_0x5b9b('0xe')][_0x1d3930['id']]['updateRouting']();_0x1c6542[_0x5b9b('0xe')][_0x1d3930['id']][_0x5b9b('0x1d')]();}}return _0x1c6542[_0x5b9b('0xe')];};};Realtime[_0x5b9b('0x19')][_0x5b9b('0x21')]=function(){var _0x174f28=this;return function(_0x106692){if(_0x106692){freeIsNotKey(_0x106692,_0x174f28[_0x5b9b('0xf')],'id');for(var _0x2551c9=0x0,_0x556b03={},_0x4a5bd1={};_0x2551c9<_0x106692['length'];_0x2551c9+=0x1){_0x556b03=_0x106692[_0x2551c9];if(_[_0x5b9b('0x18')](_0x174f28[_0x5b9b('0xf')][_0x556b03['id']])){_0x174f28[_0x5b9b('0xf')][_0x556b03['id']]=new FaxQueue(_0x556b03);}else{_0x174f28['mergeFromDatabase'](_0x174f28['faxQueues'][_0x556b03['id']],_0x556b03);}_0x174f28[_0x5b9b('0xf')][_0x556b03['id']]['updateRouting']();_0x174f28[_0x5b9b('0xf')][_0x556b03['id']][_0x5b9b('0x1d')]();}}return _0x174f28[_0x5b9b('0xf')];};};module[_0x5b9b('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 9b0048a..03d94e1 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 _0x85b8=['addTags','AddTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','updateChatInteraction'];(function(_0x1b68c1,_0x4d9611){var _0x24b0af=function(_0x1c1589){while(--_0x1c1589){_0x1b68c1['push'](_0x1b68c1['shift']());}};_0x24b0af(++_0x4d9611);}(_0x85b8,0x9c));var _0x885b=function(_0x227e24,_0x573dd6){_0x227e24=_0x227e24-0x0;var _0x2ccc99=_0x85b8[_0x227e24];return _0x2ccc99;};'use strict';var client=require(_0x885b('0x0'));exports[_0x885b('0x1')]=function(_0x17235a,_0x258d4e){return client[_0x885b('0x2')](_0x885b('0x3'),{'body':_0x258d4e,'options':{'where':{'id':_0x17235a}},'log':_0x885b('0x4')});};exports[_0x885b('0x5')]=function(_0x2425f4,_0x5c92f9){return client[_0x885b('0x2')](_0x885b('0x6'),{'body':_0x5c92f9,'options':{'where':{'id':_0x2425f4}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x75b9=['update','addTags','Request','addTagsToChatInteraction','../client'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x75b9,0x108));var _0x975b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x75b9[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x975b('0x0'));exports[_0x975b('0x1')]=function(_0x471947,_0x3d48fb){return client['Request']('UpdateChatInteraction',{'body':_0x3d48fb,'options':{'where':{'id':_0x471947}},'log':'updateChatInteraction'});};exports[_0x975b('0x2')]=function(_0x5ca52f,_0x5ba0d5){return client[_0x975b('0x3')]('AddTagsToChatInteraction',{'body':_0x5ba0d5,'options':{'where':{'id':_0x5ca52f}},'log':_0x975b('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 023e15b..9ac6e05 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 _0xd1fd=['create','Request','createChatMessage','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd1fd,0xe7));var _0xdd1f=function(_0x3233c3,_0x15e5fa){_0x3233c3=_0x3233c3-0x0;var _0x36029b=_0xd1fd[_0x3233c3];return _0x36029b;};'use strict';var client=require(_0xdd1f('0x0'));exports[_0xdd1f('0x1')]=function(_0xe027dd){return client[_0xdd1f('0x2')]('CreateChatMessage',{'body':_0xe027dd,'log':_0xdd1f('0x3')});}; \ No newline at end of file +var _0x619f=['CreateChatMessage','createChatMessage','../client','Request'];(function(_0x56be45,_0x10cd0e){var _0x1b75d3=function(_0x314616){while(--_0x314616){_0x56be45['push'](_0x56be45['shift']());}};_0x1b75d3(++_0x10cd0e);}(_0x619f,0x176));var _0xf619=function(_0x36bf94,_0x4f208b){_0x36bf94=_0x36bf94-0x0;var _0x472a7e=_0x619f[_0x36bf94];return _0x472a7e;};'use strict';var client=require(_0xf619('0x0'));exports['create']=function(_0x1fa64e){return client[_0xf619('0x1')](_0xf619('0x2'),{'body':_0x1fa64e,'log':_0xf619('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 8cfadb2..bee9a68 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 _0x61b2=['chatPause','../client','getChatQueues','GetChatQueue','strategy','online'];(function(_0x5afb61,_0xc2d4dd){var _0x4b2209=function(_0x27b24b){while(--_0x27b24b){_0x5afb61['push'](_0x5afb61['shift']());}};_0x4b2209(++_0xc2d4dd);}(_0x61b2,0x1bd));var _0x261b=function(_0x35e9d6,_0x35dffc){_0x35e9d6=_0x35e9d6-0x0;var _0x2f658f=_0x61b2[_0x35e9d6];return _0x2f658f;};'use strict';var client=require(_0x261b('0x0'));exports[_0x261b('0x1')]=function(){return function(){return client['Request'](_0x261b('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x261b('0x3')],'include':[{'model':'User','as':'Agents','attributes':['id','name',_0x261b('0x4'),_0x261b('0x5')]}]},'log':_0x261b('0x1')});};}; \ No newline at end of file +var _0xb13d=['strategy','Agents','chatPause','../client','getChatQueues','Request','GetChatQueue','name','timeout'];(function(_0x879195,_0x96d988){var _0xefa735=function(_0x58b74f){while(--_0x58b74f){_0x879195['push'](_0x879195['shift']());}};_0xefa735(++_0x96d988);}(_0xb13d,0x1e0));var _0xdb13=function(_0x4d661d,_0x323a83){_0x4d661d=_0x4d661d-0x0;var _0x4f7d4d=_0xb13d[_0x4d661d];return _0x4f7d4d;};'use strict';var client=require(_0xdb13('0x0'));exports[_0xdb13('0x1')]=function(){return function(){return client[_0xdb13('0x2')](_0xdb13('0x3'),{'options':{'raw':![],'attributes':['id',_0xdb13('0x4'),_0xdb13('0x5'),_0xdb13('0x6')],'include':[{'model':'User','as':_0xdb13('0x7'),'attributes':['id','name','online',_0xdb13('0x8')]}]},'log':_0xdb13('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index c04cccb..ff5fd0e 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 _0xd691=['create','CreateChatQueueReport','update','Request','UpdateChatQueueReport','DESC','../client'];(function(_0x513d18,_0x1843b7){var _0xef6d21=function(_0x3b39c5){while(--_0x3b39c5){_0x513d18['push'](_0x513d18['shift']());}};_0xef6d21(++_0x1843b7);}(_0xd691,0xe6));var _0x1d69=function(_0x51308d,_0x42cf02){_0x51308d=_0x51308d-0x0;var _0x37cde8=_0xd691[_0x51308d];return _0x37cde8;};'use strict';var client=require(_0x1d69('0x0'));exports[_0x1d69('0x1')]=function(_0x4738f2){return client['Request'](_0x1d69('0x2'),{'body':_0x4738f2,'log':_0x1d69('0x2')});};exports[_0x1d69('0x3')]=function(_0x3dc1c9,_0x1fbb5e){return client[_0x1d69('0x4')](_0x1d69('0x5'),{'body':_0x1fbb5e,'options':{'where':{'uniqueid':_0x3dc1c9},'order':[['id',_0x1d69('0x6')]],'limit':0x1},'log':_0x1d69('0x5')});}; \ No newline at end of file +var _0xbc82=['../client','CreateChatQueueReport','UpdateChatQueueReport'];(function(_0xff3357,_0x3b4152){var _0x16d529=function(_0x38d7f7){while(--_0x38d7f7){_0xff3357['push'](_0xff3357['shift']());}};_0x16d529(++_0x3b4152);}(_0xbc82,0x13e));var _0x2bc8=function(_0x4fd360,_0x435775){_0x4fd360=_0x4fd360-0x0;var _0x5c93d7=_0xbc82[_0x4fd360];return _0x5c93d7;};'use strict';var client=require(_0x2bc8('0x0'));exports['create']=function(_0x5cd5de){return client['Request'](_0x2bc8('0x1'),{'body':_0x5cd5de,'log':'CreateChatQueueReport'});};exports['update']=function(_0x1320a5,_0x5c8329){return client['Request'](_0x2bc8('0x2'),{'body':_0x5c8329,'options':{'where':{'uniqueid':_0x1320a5},'order':[['id','DESC']],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 84b909f..b9d1ec6 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 _0x1e3e=['UpdateFaxInteraction','updateFaxInteraction','addTagsToFaxInteraction','../client','update','Request'];(function(_0x50e40b,_0x338d17){var _0x2608b7=function(_0x4ded5e){while(--_0x4ded5e){_0x50e40b['push'](_0x50e40b['shift']());}};_0x2608b7(++_0x338d17);}(_0x1e3e,0x15f));var _0xe1e3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1e3e[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0xe1e3('0x0'));exports[_0xe1e3('0x1')]=function(_0x5cc255,_0x436a6b){return client[_0xe1e3('0x2')](_0xe1e3('0x3'),{'body':_0x436a6b,'options':{'where':{'id':_0x5cc255}},'log':_0xe1e3('0x4')});};exports['addTags']=function(_0x524da1,_0x18ea86){return client[_0xe1e3('0x2')]('AddTagsToFaxInteraction',{'body':_0x18ea86,'options':{'where':{'id':_0x524da1}},'log':_0xe1e3('0x5')});}; \ No newline at end of file +var _0x0a48=['update','UpdateFaxInteraction','addTags','Request','AddTagsToFaxInteraction'];(function(_0x45f6cb,_0x531af6){var _0x5b7f93=function(_0x1296ba){while(--_0x1296ba){_0x45f6cb['push'](_0x45f6cb['shift']());}};_0x5b7f93(++_0x531af6);}(_0x0a48,0x1ae));var _0x80a4=function(_0x51543d,_0x204989){_0x51543d=_0x51543d-0x0;var _0x4a62cb=_0x0a48[_0x51543d];return _0x4a62cb;};'use strict';var client=require('../client');exports[_0x80a4('0x0')]=function(_0x1e2bea,_0x372bc3){return client['Request'](_0x80a4('0x1'),{'body':_0x372bc3,'options':{'where':{'id':_0x1e2bea}},'log':'updateFaxInteraction'});};exports[_0x80a4('0x2')]=function(_0x2cc8d1,_0x5632fe){return client[_0x80a4('0x3')](_0x80a4('0x4'),{'body':_0x5632fe,'options':{'where':{'id':_0x2cc8d1}},'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 78a2b06..6bb4697 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 _0x4ed2=['CreateFaxMessage','createFaxMessage'];(function(_0x50df1b,_0x1f697c){var _0x35b890=function(_0x58b2cd){while(--_0x58b2cd){_0x50df1b['push'](_0x50df1b['shift']());}};_0x35b890(++_0x1f697c);}(_0x4ed2,0xfa));var _0x24ed=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4ed2[_0x20a584];return _0x4b41a8;};'use strict';var client=require('../client');exports['create']=function(_0x2a4929){return client['Request'](_0x24ed('0x0'),{'body':_0x2a4929,'log':_0x24ed('0x1')});}; \ No newline at end of file +var _0x1ae4=['CreateFaxMessage','../client','create','Request'];(function(_0x32f193,_0x612afc){var _0x5bb92e=function(_0x555645){while(--_0x555645){_0x32f193['push'](_0x32f193['shift']());}};_0x5bb92e(++_0x612afc);}(_0x1ae4,0xa9));var _0x41ae=function(_0x1d49d5,_0xed4ffd){_0x1d49d5=_0x1d49d5-0x0;var _0x1c7a31=_0x1ae4[_0x1d49d5];return _0x1c7a31;};'use strict';var client=require(_0x41ae('0x0'));exports[_0x41ae('0x1')]=function(_0x5c346c){return client[_0x41ae('0x2')](_0x41ae('0x3'),{'body':_0x5c346c,'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 6ada832..3fcd43f 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 _0xbde8=['online','Request','name','timeout','strategy','Agents'];(function(_0xfbdff6,_0x2af690){var _0x4cb9be=function(_0x4022d8){while(--_0x4022d8){_0xfbdff6['push'](_0xfbdff6['shift']());}};_0x4cb9be(++_0x2af690);}(_0xbde8,0xd9));var _0x8bde=function(_0x3598bb,_0x24befa){_0x3598bb=_0x3598bb-0x0;var _0x13c837=_0xbde8[_0x3598bb];return _0x13c837;};'use strict';var client=require('../client');exports['getFaxQueues']=function(){return function(){return client[_0x8bde('0x0')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x8bde('0x1'),_0x8bde('0x2'),_0x8bde('0x3')],'include':[{'model':'User','as':_0x8bde('0x4'),'attributes':['id',_0x8bde('0x1'),_0x8bde('0x5'),'faxPause']}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0x702f=['faxPause','../client','getFaxQueues','Request','GetFaxQueue','strategy','User','name','online'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x702f,0xf4));var _0xf702=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x702f[_0x2641f9];return _0x585741;};'use strict';var client=require(_0xf702('0x0'));exports[_0xf702('0x1')]=function(){return function(){return client[_0xf702('0x2')](_0xf702('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout',_0xf702('0x4')],'include':[{'model':_0xf702('0x5'),'as':'Agents','attributes':['id',_0xf702('0x6'),_0xf702('0x7'),_0xf702('0x8')]}]},'log':_0xf702('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 2a2920f..2761739 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 _0x29a3=['CreateFaxQueueReport','UpdateFaxQueueReport','DESC','../client','create','Request'];(function(_0x4eeee0,_0x5eaafb){var _0x20ad83=function(_0x1c7ffc){while(--_0x1c7ffc){_0x4eeee0['push'](_0x4eeee0['shift']());}};_0x20ad83(++_0x5eaafb);}(_0x29a3,0x141));var _0x329a=function(_0x381ddb,_0x414363){_0x381ddb=_0x381ddb-0x0;var _0x3d4ad3=_0x29a3[_0x381ddb];return _0x3d4ad3;};'use strict';var client=require(_0x329a('0x0'));exports[_0x329a('0x1')]=function(_0x58eedd){return client[_0x329a('0x2')](_0x329a('0x3'),{'body':_0x58eedd,'log':_0x329a('0x3')});};exports['update']=function(_0xde7233,_0x10a59c){return client[_0x329a('0x2')](_0x329a('0x4'),{'body':_0x10a59c,'options':{'where':{'uniqueid':_0xde7233},'order':[['id',_0x329a('0x5')]],'limit':0x1},'log':_0x329a('0x4')});}; \ No newline at end of file +var _0xcfee=['UpdateFaxQueueReport','../client','create','Request','CreateFaxQueueReport','update'];(function(_0x2d91f2,_0x4b56ae){var _0x1ba446=function(_0x1668e0){while(--_0x1668e0){_0x2d91f2['push'](_0x2d91f2['shift']());}};_0x1ba446(++_0x4b56ae);}(_0xcfee,0x10f));var _0xecfe=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xcfee[_0x413feb];return _0x40ee88;};'use strict';var client=require(_0xecfe('0x0'));exports[_0xecfe('0x1')]=function(_0xa09dce){return client[_0xecfe('0x2')](_0xecfe('0x3'),{'body':_0xa09dce,'log':_0xecfe('0x3')});};exports[_0xecfe('0x4')]=function(_0x47d510,_0x16c69b){return client[_0xecfe('0x2')](_0xecfe('0x5'),{'body':_0x16c69b,'options':{'where':{'uniqueid':_0x47d510},'order':[['id','DESC']],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index bb132e7..6e70d22 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 _0xaa5e=['name','Interval','Intervals','../client','getIntervals','GetInterval'];(function(_0x1c5a9e,_0x62bbe4){var _0x455dc3=function(_0x1dc9f9){while(--_0x1dc9f9){_0x1c5a9e['push'](_0x1c5a9e['shift']());}};_0x455dc3(++_0x62bbe4);}(_0xaa5e,0xa5));var _0xeaa5=function(_0x1deee7,_0x2ca553){_0x1deee7=_0x1deee7-0x0;var _0x1171e1=_0xaa5e[_0x1deee7];return _0x1171e1;};'use strict';var client=require(_0xeaa5('0x0'));exports[_0xeaa5('0x1')]=function(){return function(){return client['Request'](_0xeaa5('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xeaa5('0x3')],'include':[{'model':_0xeaa5('0x4'),'as':_0xeaa5('0x5'),'attributes':['id',_0xeaa5('0x3'),'interval']}]},'log':_0xeaa5('0x1')});};}; \ No newline at end of file +var _0x6599=['Interval','getIntervals','Request','GetInterval','name'];(function(_0x143062,_0x3eafd2){var _0x4ee38a=function(_0x1c4437){while(--_0x1c4437){_0x143062['push'](_0x143062['shift']());}};_0x4ee38a(++_0x3eafd2);}(_0x6599,0xb0));var _0x9659=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x6599[_0x42bdad];return _0x122626;};'use strict';var client=require('../client');exports[_0x9659('0x0')]=function(){return function(){return client[_0x9659('0x1')](_0x9659('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x9659('0x3')],'include':[{'model':_0x9659('0x4'),'as':'Intervals','attributes':['id',_0x9659('0x3'),'interval']}]},'log':_0x9659('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 96749a0..3db2fd1 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 _0x41a5=['Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update'];(function(_0x28678c,_0x2f1384){var _0x19a747=function(_0x1114c4){while(--_0x1114c4){_0x28678c['push'](_0x28678c['shift']());}};_0x19a747(++_0x2f1384);}(_0x41a5,0x1de));var _0x541a=function(_0x2cb09b,_0x42eb12){_0x2cb09b=_0x2cb09b-0x0;var _0x21c8cb=_0x41a5[_0x2cb09b];return _0x21c8cb;};'use strict';var client=require(_0x541a('0x0'));exports[_0x541a('0x1')]=function(_0x569f4e,_0x3a267f){return client[_0x541a('0x2')](_0x541a('0x3'),{'body':_0x3a267f,'options':{'where':{'id':_0x569f4e}},'log':_0x541a('0x4')});};exports[_0x541a('0x5')]=function(_0x88cdaf,_0x18bdc0){return client[_0x541a('0x2')](_0x541a('0x6'),{'body':_0x18bdc0,'options':{'where':{'id':_0x88cdaf}},'log':_0x541a('0x7')});}; \ No newline at end of file +var _0x78ed=['addTags','AddTagsToMailInteraction','addTagsToChatInteraction','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0x11065a,_0x8022d5){var _0xbf4add=function(_0x8f05){while(--_0x8f05){_0x11065a['push'](_0x11065a['shift']());}};_0xbf4add(++_0x8022d5);}(_0x78ed,0x15f));var _0xd78e=function(_0x20f7a7,_0x37e3ee){_0x20f7a7=_0x20f7a7-0x0;var _0x489372=_0x78ed[_0x20f7a7];return _0x489372;};'use strict';var client=require('../client');exports['update']=function(_0x77a831,_0x480ed7){return client[_0xd78e('0x0')](_0xd78e('0x1'),{'body':_0x480ed7,'options':{'where':{'id':_0x77a831}},'log':_0xd78e('0x2')});};exports[_0xd78e('0x3')]=function(_0x3905dd,_0x57b947){return client[_0xd78e('0x0')](_0xd78e('0x4'),{'body':_0x57b947,'options':{'where':{'id':_0x3905dd}},'log':_0xd78e('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 9564e8a..a39d7c9 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 _0x643a=['CreateMailMessage','createMailMessage','Request'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x643a,0xb9));var _0xa643=function(_0x12663e,_0x2e8f3a){_0x12663e=_0x12663e-0x0;var _0x88f979=_0x643a[_0x12663e];return _0x88f979;};'use strict';var client=require('../client');exports['create']=function(_0x21785f){return client[_0xa643('0x0')](_0xa643('0x1'),{'body':_0x21785f,'log':_0xa643('0x2')});}; \ No newline at end of file +var _0x4d42=['Request','CreateMailMessage','createMailMessage','../client'];(function(_0x237587,_0x5ca4cb){var _0x1ae730=function(_0x1d471e){while(--_0x1d471e){_0x237587['push'](_0x237587['shift']());}};_0x1ae730(++_0x5ca4cb);}(_0x4d42,0x1c3));var _0x24d4=function(_0x208c90,_0x42ab87){_0x208c90=_0x208c90-0x0;var _0x506f61=_0x4d42[_0x208c90];return _0x506f61;};'use strict';var client=require(_0x24d4('0x0'));exports['create']=function(_0xcf8369){return client[_0x24d4('0x1')](_0x24d4('0x2'),{'body':_0xcf8369,'log':_0x24d4('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index a911f26..bed4fa4 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 _0xd80c=['User','Agents','online','../client','getMailQueues','Request','GetMailQueue','name','timeout','strategy'];(function(_0x2886ac,_0x4b3fd1){var _0x419a99=function(_0x4c8301){while(--_0x4c8301){_0x2886ac['push'](_0x2886ac['shift']());}};_0x419a99(++_0x4b3fd1);}(_0xd80c,0x107));var _0xcd80=function(_0x3af418,_0x473792){_0x3af418=_0x3af418-0x0;var _0x48a045=_0xd80c[_0x3af418];return _0x48a045;};'use strict';var client=require(_0xcd80('0x0'));exports[_0xcd80('0x1')]=function(){return function(){return client[_0xcd80('0x2')](_0xcd80('0x3'),{'options':{'raw':![],'attributes':['id',_0xcd80('0x4'),_0xcd80('0x5'),_0xcd80('0x6')],'include':[{'model':_0xcd80('0x7'),'as':_0xcd80('0x8'),'attributes':['id',_0xcd80('0x4'),_0xcd80('0x9'),'mailPause']}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0x7cf9=['Agents','mailPause','../client','getMailQueues','Request','name','timeout','User'];(function(_0x1d4501,_0x61c755){var _0x537d5c=function(_0x5adf34){while(--_0x5adf34){_0x1d4501['push'](_0x1d4501['shift']());}};_0x537d5c(++_0x61c755);}(_0x7cf9,0x11a));var _0x97cf=function(_0x89bd89,_0x1e4f02){_0x89bd89=_0x89bd89-0x0;var _0x7a7566=_0x7cf9[_0x89bd89];return _0x7a7566;};'use strict';var client=require(_0x97cf('0x0'));exports[_0x97cf('0x1')]=function(){return function(){return client[_0x97cf('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x97cf('0x3'),_0x97cf('0x4'),'strategy'],'include':[{'model':_0x97cf('0x5'),'as':_0x97cf('0x6'),'attributes':['id',_0x97cf('0x3'),'online',_0x97cf('0x7')]}]},'log':_0x97cf('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 41b54b5..05e1cce 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 _0x616b=['DESC','create','Request','CreateMailQueueReport','UpdateMailQueueReport'];(function(_0xb2f445,_0x10a2ca){var _0x19da8c=function(_0x23c343){while(--_0x23c343){_0xb2f445['push'](_0xb2f445['shift']());}};_0x19da8c(++_0x10a2ca);}(_0x616b,0x18c));var _0xb616=function(_0x1b4002,_0x5b4094){_0x1b4002=_0x1b4002-0x0;var _0x1716f3=_0x616b[_0x1b4002];return _0x1716f3;};'use strict';var client=require('../client');exports[_0xb616('0x0')]=function(_0x1d3792){return client[_0xb616('0x1')](_0xb616('0x2'),{'body':_0x1d3792,'log':_0xb616('0x2')});};exports['update']=function(_0x12808f,_0x18e2b1){return client[_0xb616('0x1')](_0xb616('0x3'),{'body':_0x18e2b1,'options':{'where':{'uniqueid':_0x12808f},'order':[['id',_0xb616('0x4')]],'limit':0x1},'log':_0xb616('0x3')});}; \ No newline at end of file +var _0x9ff5=['update','UpdateMailQueueReport','DESC','../client','Request','CreateMailQueueReport'];(function(_0x46f628,_0x21cafe){var _0x466eba=function(_0x18310e){while(--_0x18310e){_0x46f628['push'](_0x46f628['shift']());}};_0x466eba(++_0x21cafe);}(_0x9ff5,0x12f));var _0x59ff=function(_0x589aee,_0x140a03){_0x589aee=_0x589aee-0x0;var _0x2f5ed4=_0x9ff5[_0x589aee];return _0x2f5ed4;};'use strict';var client=require(_0x59ff('0x0'));exports['create']=function(_0x4b2421){return client[_0x59ff('0x1')](_0x59ff('0x2'),{'body':_0x4b2421,'log':_0x59ff('0x2')});};exports[_0x59ff('0x3')]=function(_0x43cefb,_0x118c24){return client[_0x59ff('0x1')](_0x59ff('0x4'),{'body':_0x118c24,'options':{'where':{'uniqueid':_0x43cefb},'order':[['id',_0x59ff('0x5')]],'limit':0x1},'log':_0x59ff('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 6539173..b6e0a22 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 _0xfae7=['update','UpdateOpenchannelInteraction','updateOpenchannelInteraction','Request','addTagsToChatInteraction'];(function(_0x1bbc08,_0x444008){var _0x5d825b=function(_0x522920){while(--_0x522920){_0x1bbc08['push'](_0x1bbc08['shift']());}};_0x5d825b(++_0x444008);}(_0xfae7,0x91));var _0x7fae=function(_0x18fbfc,_0x57a9ca){_0x18fbfc=_0x18fbfc-0x0;var _0x9b4223=_0xfae7[_0x18fbfc];return _0x9b4223;};'use strict';var client=require('../client');exports[_0x7fae('0x0')]=function(_0x22c851,_0x3a51f6){return client['Request'](_0x7fae('0x1'),{'body':_0x3a51f6,'options':{'where':{'id':_0x22c851}},'log':_0x7fae('0x2')});};exports['addTags']=function(_0x30f32b,_0x4adc12){return client[_0x7fae('0x3')]('AddTagsToOpenchannelInteraction',{'body':_0x4adc12,'options':{'where':{'id':_0x30f32b}},'log':_0x7fae('0x4')});}; \ No newline at end of file +var _0x9efe=['AddTagsToOpenchannelInteraction','../client','update','Request','UpdateOpenchannelInteraction','addTags'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x9efe,0xcd));var _0xe9ef=function(_0x26ec1c,_0x274d1b){_0x26ec1c=_0x26ec1c-0x0;var _0x3759c0=_0x9efe[_0x26ec1c];return _0x3759c0;};'use strict';var client=require(_0xe9ef('0x0'));exports[_0xe9ef('0x1')]=function(_0x36ccab,_0x5082e9){return client[_0xe9ef('0x2')](_0xe9ef('0x3'),{'body':_0x5082e9,'options':{'where':{'id':_0x36ccab}},'log':'updateOpenchannelInteraction'});};exports[_0xe9ef('0x4')]=function(_0x565a60,_0x5c0a96){return client['Request'](_0xe9ef('0x5'),{'body':_0x5c0a96,'options':{'where':{'id':_0x565a60}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 37f3883..f66d415 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 _0xdace=['Request','CreateOpenchannelMessage','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdace,0xc5));var _0xedac=function(_0x4017b0,_0x4347db){_0x4017b0=_0x4017b0-0x0;var _0x5ed4f7=_0xdace[_0x4017b0];return _0x5ed4f7;};'use strict';var client=require(_0xedac('0x0'));exports['create']=function(_0x1c76b2){return client[_0xedac('0x1')](_0xedac('0x2'),{'body':_0x1c76b2,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0x34e8=['../client','create','Request','createOpenchannelMessage'];(function(_0xeabcde,_0x3b1765){var _0x253d84=function(_0x1a7b61){while(--_0x1a7b61){_0xeabcde['push'](_0xeabcde['shift']());}};_0x253d84(++_0x3b1765);}(_0x34e8,0x12c));var _0x834e=function(_0x3d737b,_0x1c9817){_0x3d737b=_0x3d737b-0x0;var _0x34910f=_0x34e8[_0x3d737b];return _0x34910f;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(_0x8b339){return client[_0x834e('0x2')]('CreateOpenchannelMessage',{'body':_0x8b339,'log':_0x834e('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 4aedfb5..f12448e 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 _0xd1f3=['strategy','User','Agents','openchannelPause','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout'];(function(_0x57b2ed,_0x5e9e07){var _0x49e09e=function(_0x44241b){while(--_0x44241b){_0x57b2ed['push'](_0x57b2ed['shift']());}};_0x49e09e(++_0x5e9e07);}(_0xd1f3,0x1bd));var _0x3d1f=function(_0x1e1d61,_0x4cb554){_0x1e1d61=_0x1e1d61-0x0;var _0x2e7a25=_0xd1f3[_0x1e1d61];return _0x2e7a25;};'use strict';var client=require('../client');exports[_0x3d1f('0x0')]=function(){return function(){return client[_0x3d1f('0x1')](_0x3d1f('0x2'),{'options':{'raw':![],'attributes':['id',_0x3d1f('0x3'),_0x3d1f('0x4'),_0x3d1f('0x5')],'include':[{'model':_0x3d1f('0x6'),'as':_0x3d1f('0x7'),'attributes':['id',_0x3d1f('0x3'),'online',_0x3d1f('0x8')]}]},'log':_0x3d1f('0x0')});};}; \ No newline at end of file +var _0xd3e4=['openchannelPause','../client','getOpenchannelQueues','GetOpenchannelQueue','name','strategy','User','Agents','online'];(function(_0x4fe165,_0x168e2f){var _0xa0e338=function(_0x3f3cf1){while(--_0x3f3cf1){_0x4fe165['push'](_0x4fe165['shift']());}};_0xa0e338(++_0x168e2f);}(_0xd3e4,0x9a));var _0x4d3e=function(_0x73ba1f,_0x588ccb){_0x73ba1f=_0x73ba1f-0x0;var _0x2e2725=_0xd3e4[_0x73ba1f];return _0x2e2725;};'use strict';var client=require(_0x4d3e('0x0'));exports[_0x4d3e('0x1')]=function(){return function(){return client['Request'](_0x4d3e('0x2'),{'options':{'raw':![],'attributes':['id',_0x4d3e('0x3'),'timeout',_0x4d3e('0x4')],'include':[{'model':_0x4d3e('0x5'),'as':_0x4d3e('0x6'),'attributes':['id',_0x4d3e('0x3'),_0x4d3e('0x7'),_0x4d3e('0x8')]}]},'log':_0x4d3e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 374b20f..0294555 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 _0x3c65=['Request','CreateOpenchannelQueueReport','DESC','UpdateOpenchannelQueueReport','../client','create'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x3c65,0xe8));var _0x53c6=function(_0x4cd21c,_0x35fa45){_0x4cd21c=_0x4cd21c-0x0;var _0x5d8e5e=_0x3c65[_0x4cd21c];return _0x5d8e5e;};'use strict';var client=require(_0x53c6('0x0'));exports[_0x53c6('0x1')]=function(_0xd36d18){return client[_0x53c6('0x2')]('CreateOpenchannelQueueReport',{'body':_0xd36d18,'log':_0x53c6('0x3')});};exports['update']=function(_0x5d4f9e,_0x37ea1f){return client[_0x53c6('0x2')]('UpdateOpenchannelQueueReport',{'body':_0x37ea1f,'options':{'where':{'uniqueid':_0x5d4f9e},'order':[['id',_0x53c6('0x4')]],'limit':0x1},'log':_0x53c6('0x5')});}; \ No newline at end of file +var _0xb095=['CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client','create'];(function(_0x5dd921,_0x4b9fdd){var _0x62b488=function(_0x4b87ab){while(--_0x4b87ab){_0x5dd921['push'](_0x5dd921['shift']());}};_0x62b488(++_0x4b9fdd);}(_0xb095,0x1d2));var _0x5b09=function(_0x4cea61,_0x54f6ac){_0x4cea61=_0x4cea61-0x0;var _0x4a6769=_0xb095[_0x4cea61];return _0x4a6769;};'use strict';var client=require(_0x5b09('0x0'));exports[_0x5b09('0x1')]=function(_0x37d59c){return client['Request']('CreateOpenchannelQueueReport',{'body':_0x37d59c,'log':_0x5b09('0x2')});};exports[_0x5b09('0x3')]=function(_0x121cc7,_0x3973be){return client['Request'](_0x5b09('0x4'),{'body':_0x3973be,'options':{'where':{'uniqueid':_0x121cc7},'order':[['id',_0x5b09('0x5')]],'limit':0x1},'log':_0x5b09('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index e7c4b0b..786438f 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 _0x441d=['UpdateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x441d,0x17e));var _0xd441=function(_0x3ea4c1,_0x190dfc){_0x3ea4c1=_0x3ea4c1-0x0;var _0x2f0442=_0x441d[_0x3ea4c1];return _0x2f0442;};'use strict';var client=require(_0xd441('0x0'));exports[_0xd441('0x1')]=function(_0x5b2df6,_0x40e11d){return client[_0xd441('0x2')](_0xd441('0x3'),{'body':_0x40e11d,'options':{'where':{'id':_0x5b2df6}},'log':'updateSmsInteraction'});};exports[_0xd441('0x4')]=function(_0x4824af,_0x41e1de){return client['Request'](_0xd441('0x5'),{'body':_0x41e1de,'options':{'where':{'id':_0x4824af}},'log':_0xd441('0x6')});}; \ No newline at end of file +var _0x083e=['Request','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','UpdateSmsInteraction','updateSmsInteraction','addTags'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x083e,0xc7));var _0xe083=function(_0xec034,_0x16c358){_0xec034=_0xec034-0x0;var _0x2c5a19=_0x083e[_0xec034];return _0x2c5a19;};'use strict';var client=require(_0xe083('0x0'));exports['update']=function(_0x596e35,_0x4d2698){return client['Request'](_0xe083('0x1'),{'body':_0x4d2698,'options':{'where':{'id':_0x596e35}},'log':_0xe083('0x2')});};exports[_0xe083('0x3')]=function(_0x298891,_0x41af8d){return client[_0xe083('0x4')](_0xe083('0x5'),{'body':_0x41af8d,'options':{'where':{'id':_0x298891}},'log':_0xe083('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index db82461..50b4a5b 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 _0x541f=['create','Request','CreateSmsMessage'];(function(_0x2b8026,_0x58e34e){var _0x2bb21f=function(_0x14f055){while(--_0x14f055){_0x2b8026['push'](_0x2b8026['shift']());}};_0x2bb21f(++_0x58e34e);}(_0x541f,0x1f2));var _0xf541=function(_0x44b3bd,_0x44c97d){_0x44b3bd=_0x44b3bd-0x0;var _0x1efc4a=_0x541f[_0x44b3bd];return _0x1efc4a;};'use strict';var client=require('../client');exports[_0xf541('0x0')]=function(_0x4fccdc){return client[_0xf541('0x1')](_0xf541('0x2'),{'body':_0x4fccdc,'log':'createSmsMessage'});}; \ No newline at end of file +var _0xbd76=['createSmsMessage','../client','create','Request','CreateSmsMessage'];(function(_0x27bb65,_0x46c5b1){var _0x4a91fb=function(_0x2f1eab){while(--_0x2f1eab){_0x27bb65['push'](_0x27bb65['shift']());}};_0x4a91fb(++_0x46c5b1);}(_0xbd76,0x105));var _0x6bd7=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xbd76[_0x126558];return _0x1f6d14;};'use strict';var client=require(_0x6bd7('0x0'));exports[_0x6bd7('0x1')]=function(_0x17a064){return client[_0x6bd7('0x2')](_0x6bd7('0x3'),{'body':_0x17a064,'log':_0x6bd7('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 181ca23..3bcadd4 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 _0x6aa1=['name','strategy','User','Agents','smsPause','getSmsQueues','Request'];(function(_0x1cb950,_0xc06e73){var _0x1bef44=function(_0x3a7760){while(--_0x3a7760){_0x1cb950['push'](_0x1cb950['shift']());}};_0x1bef44(++_0xc06e73);}(_0x6aa1,0x1da));var _0x16aa=function(_0x512955,_0x2fc85a){_0x512955=_0x512955-0x0;var _0x5f7a51=_0x6aa1[_0x512955];return _0x5f7a51;};'use strict';var client=require('../client');exports[_0x16aa('0x0')]=function(){return function(){return client[_0x16aa('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x16aa('0x2'),'timeout',_0x16aa('0x3')],'include':[{'model':_0x16aa('0x4'),'as':_0x16aa('0x5'),'attributes':['id','name','online',_0x16aa('0x6')]}]},'log':_0x16aa('0x0')});};}; \ No newline at end of file +var _0xdbb9=['name','strategy','User','Agents','online','smsPause','getSmsQueues','Request','GetSmsQueue'];(function(_0x5f368f,_0x20b6c9){var _0x56f5bd=function(_0x13c5c2){while(--_0x13c5c2){_0x5f368f['push'](_0x5f368f['shift']());}};_0x56f5bd(++_0x20b6c9);}(_0xdbb9,0xf9));var _0x9dbb=function(_0x1fddcd,_0x1251e2){_0x1fddcd=_0x1fddcd-0x0;var _0x130ec7=_0xdbb9[_0x1fddcd];return _0x130ec7;};'use strict';var client=require('../client');exports[_0x9dbb('0x0')]=function(){return function(){return client[_0x9dbb('0x1')](_0x9dbb('0x2'),{'options':{'raw':![],'attributes':['id',_0x9dbb('0x3'),'timeout',_0x9dbb('0x4')],'include':[{'model':_0x9dbb('0x5'),'as':_0x9dbb('0x6'),'attributes':['id',_0x9dbb('0x3'),_0x9dbb('0x7'),_0x9dbb('0x8')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 3d93bd7..d182eed 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 _0xf264=['UpdateSmsQueueReport','../client','create','Request','CreateSmsQueueReport','DESC'];(function(_0xc9d6ef,_0x8bf100){var _0x4792bc=function(_0x93c8cc){while(--_0x93c8cc){_0xc9d6ef['push'](_0xc9d6ef['shift']());}};_0x4792bc(++_0x8bf100);}(_0xf264,0xfd));var _0x4f26=function(_0x509bf1,_0x2333a6){_0x509bf1=_0x509bf1-0x0;var _0x3f9372=_0xf264[_0x509bf1];return _0x3f9372;};'use strict';var client=require(_0x4f26('0x0'));exports[_0x4f26('0x1')]=function(_0x130ae2){return client[_0x4f26('0x2')]('CreateSmsQueueReport',{'body':_0x130ae2,'log':_0x4f26('0x3')});};exports['update']=function(_0x752d4d,_0x4ef9bd){return client[_0x4f26('0x2')]('UpdateSmsQueueReport',{'body':_0x4ef9bd,'options':{'where':{'uniqueid':_0x752d4d},'order':[['id',_0x4f26('0x4')]],'limit':0x1},'log':_0x4f26('0x5')});}; \ No newline at end of file +var _0xc933=['CreateSmsQueueReport','update','UpdateSmsQueueReport','../client','create','Request'];(function(_0x34728a,_0x5abf7e){var _0x25c1dd=function(_0x33b555){while(--_0x33b555){_0x34728a['push'](_0x34728a['shift']());}};_0x25c1dd(++_0x5abf7e);}(_0xc933,0xf9));var _0x3c93=function(_0x2d2ae3,_0x21ae6d){_0x2d2ae3=_0x2d2ae3-0x0;var _0x8a5de2=_0xc933[_0x2d2ae3];return _0x8a5de2;};'use strict';var client=require(_0x3c93('0x0'));exports[_0x3c93('0x1')]=function(_0x24928e){return client[_0x3c93('0x2')](_0x3c93('0x3'),{'body':_0x24928e,'log':'CreateSmsQueueReport'});};exports[_0x3c93('0x4')]=function(_0x12d6ad,_0x20d680){return client[_0x3c93('0x2')](_0x3c93('0x5'),{'body':_0x20d680,'options':{'where':{'uniqueid':_0x12d6ad},'order':[['id','DESC']],'limit':0x1},'log':_0x3c93('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 2594fa2..8608735 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 _0x66e4=['online','pauseType','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatCapacity','mailCapacity','faxCapacity','smsCapacity','openchannelCapacity','getAgents','../client','Request','GetUser','agent','name'];(function(_0x5df4c6,_0x3962cc){var _0x1e2fda=function(_0x3cbaf5){while(--_0x3cbaf5){_0x5df4c6['push'](_0x5df4c6['shift']());}};_0x1e2fda(++_0x3962cc);}(_0x66e4,0x79));var _0x466e=function(_0x340423,_0xf6b930){_0x340423=_0x340423-0x0;var _0x5867f7=_0x66e4[_0x340423];return _0x5867f7;};'use strict';var client=require(_0x466e('0x0'));exports['getAgents']=function(){return function(){return client[_0x466e('0x1')](_0x466e('0x2'),{'options':{'raw':!![],'where':{'role':_0x466e('0x3')},'attributes':['id',_0x466e('0x4'),_0x466e('0x5'),_0x466e('0x6'),'lastPauseAt','voicePause',_0x466e('0x7'),_0x466e('0x8'),_0x466e('0x9'),_0x466e('0xa'),_0x466e('0xb'),_0x466e('0xc'),_0x466e('0xd'),_0x466e('0xe'),_0x466e('0xf'),_0x466e('0x10')]},'log':_0x466e('0x11')});};}; \ No newline at end of file +var _0x3f0b=['openchannelPause','chatCapacity','mailCapacity','faxCapacity','openchannelCapacity','../client','getAgents','Request','name','online','chatPause','mailPause','faxPause'];(function(_0x12aba8,_0x40a036){var _0x2aac66=function(_0x3e56b7){while(--_0x3e56b7){_0x12aba8['push'](_0x12aba8['shift']());}};_0x2aac66(++_0x40a036);}(_0x3f0b,0x18b));var _0xb3f0=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x3f0b[_0x36eaaa];return _0x461349;};'use strict';var client=require(_0xb3f0('0x0'));exports[_0xb3f0('0x1')]=function(){return function(){return client[_0xb3f0('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0xb3f0('0x3'),_0xb3f0('0x4'),'pauseType','lastPauseAt','voicePause',_0xb3f0('0x5'),_0xb3f0('0x6'),_0xb3f0('0x7'),'smsPause',_0xb3f0('0x8'),_0xb3f0('0x9'),_0xb3f0('0xa'),_0xb3f0('0xb'),'smsCapacity',_0xb3f0('0xc')]},'log':_0xb3f0('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index e707ee7..e5ab3fa 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 _0x639d=['addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','addTags'];(function(_0x2fcf18,_0x10009a){var _0x4c68cc=function(_0x444002){while(--_0x444002){_0x2fcf18['push'](_0x2fcf18['shift']());}};_0x4c68cc(++_0x10009a);}(_0x639d,0xbb));var _0xd639=function(_0x14fdea,_0x25baf1){_0x14fdea=_0x14fdea-0x0;var _0x3c1b5c=_0x639d[_0x14fdea];return _0x3c1b5c;};'use strict';var client=require(_0xd639('0x0'));exports[_0xd639('0x1')]=function(_0xd1f88b,_0x4987ad){return client[_0xd639('0x2')](_0xd639('0x3'),{'body':_0x4987ad,'options':{'where':{'id':_0xd1f88b}},'log':'updateWhatsappInteraction'});};exports[_0xd639('0x4')]=function(_0x588a30,_0x19b990){return client['Request']('AddTagsToWhatsappInteraction',{'body':_0x19b990,'options':{'where':{'id':_0x588a30}},'log':_0xd639('0x5')});}; \ No newline at end of file +var _0x47d6=['Request','AddTagsToWhatsappInteraction','../client','update','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags'];(function(_0x7293b4,_0x410974){var _0x37897c=function(_0x47e265){while(--_0x47e265){_0x7293b4['push'](_0x7293b4['shift']());}};_0x37897c(++_0x410974);}(_0x47d6,0x1de));var _0x647d=function(_0x597a29,_0x414329){_0x597a29=_0x597a29-0x0;var _0x30dcec=_0x47d6[_0x597a29];return _0x30dcec;};'use strict';var client=require(_0x647d('0x0'));exports[_0x647d('0x1')]=function(_0xaf144e,_0x549430){return client['Request'](_0x647d('0x2'),{'body':_0x549430,'options':{'where':{'id':_0xaf144e}},'log':_0x647d('0x3')});};exports[_0x647d('0x4')]=function(_0x583a19,_0x198584){return client[_0x647d('0x5')](_0x647d('0x6'),{'body':_0x198584,'options':{'where':{'id':_0x583a19}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index a1ccd65..575d92f 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 _0x33d6=['../client','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x18a7d4,_0xd93dea){var _0x55457a=function(_0x16df4a){while(--_0x16df4a){_0x18a7d4['push'](_0x18a7d4['shift']());}};_0x55457a(++_0xd93dea);}(_0x33d6,0x1da));var _0x633d=function(_0x344073,_0x443928){_0x344073=_0x344073-0x0;var _0x22aa0d=_0x33d6[_0x344073];return _0x22aa0d;};'use strict';var client=require(_0x633d('0x0'));exports['create']=function(_0x492941){return client['Request'](_0x633d('0x1'),{'body':_0x492941,'log':_0x633d('0x2')});}; \ No newline at end of file +var _0x2910=['Request','CreateWhatsappMessage','create'];(function(_0x131ffe,_0x2e53f3){var _0x278487=function(_0x208aa4){while(--_0x208aa4){_0x131ffe['push'](_0x131ffe['shift']());}};_0x278487(++_0x2e53f3);}(_0x2910,0x158));var _0x0291=function(_0x451f88,_0x5c061a){_0x451f88=_0x451f88-0x0;var _0x2cc2b7=_0x2910[_0x451f88];return _0x2cc2b7;};'use strict';var client=require('../client');exports[_0x0291('0x0')]=function(_0x38a6ed){return client[_0x0291('0x1')](_0x0291('0x2'),{'body':_0x38a6ed,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 652bc3b..8bb5456 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 _0x9d9b=['name','strategy','User','Agents','online','getWhatsappQueues','Request'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9d9b,0x1e1));var _0xb9d9=function(_0xfe3aed,_0x1558b2){_0xfe3aed=_0xfe3aed-0x0;var _0x8cbbc2=_0x9d9b[_0xfe3aed];return _0x8cbbc2;};'use strict';var client=require('../client');exports[_0xb9d9('0x0')]=function(){return function(){return client[_0xb9d9('0x1')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0xb9d9('0x2'),'timeout',_0xb9d9('0x3')],'include':[{'model':_0xb9d9('0x4'),'as':_0xb9d9('0x5'),'attributes':['id','name',_0xb9d9('0x6'),'whatsappPause']}]},'log':_0xb9d9('0x0')});};}; \ No newline at end of file +var _0x19e1=['User','name','online','../client','getWhatsappQueues','Request','GetWhatsappQueue','strategy'];(function(_0x5d2bd6,_0x377005){var _0x796b32=function(_0x40014c){while(--_0x40014c){_0x5d2bd6['push'](_0x5d2bd6['shift']());}};_0x796b32(++_0x377005);}(_0x19e1,0x163));var _0x119e=function(_0x3b594b,_0x5835c3){_0x3b594b=_0x3b594b-0x0;var _0x1ea5f8=_0x19e1[_0x3b594b];return _0x1ea5f8;};'use strict';var client=require(_0x119e('0x0'));exports[_0x119e('0x1')]=function(){return function(){return client[_0x119e('0x2')](_0x119e('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x119e('0x4')],'include':[{'model':_0x119e('0x5'),'as':'Agents','attributes':['id',_0x119e('0x6'),_0x119e('0x7'),'whatsappPause']}]},'log':_0x119e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 3e61f6d..bce7b7f 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 _0xb382=['Request','DESC','UpdateWhatsappQueueReport','create'];(function(_0x45e7ae,_0x14f90b){var _0x54aa5a=function(_0xe92e06){while(--_0xe92e06){_0x45e7ae['push'](_0x45e7ae['shift']());}};_0x54aa5a(++_0x14f90b);}(_0xb382,0x12f));var _0x2b38=function(_0x1addfc,_0x39af95){_0x1addfc=_0x1addfc-0x0;var _0x3611a0=_0xb382[_0x1addfc];return _0x3611a0;};'use strict';var client=require('../client');exports[_0x2b38('0x0')]=function(_0x3066ef){return client['Request']('CreateWhatsappQueueReport',{'body':_0x3066ef,'log':'CreateWhatsappQueueReport'});};exports['update']=function(_0x32b7dc,_0x447bef){return client[_0x2b38('0x1')]('UpdateWhatsappQueueReport',{'body':_0x447bef,'options':{'where':{'uniqueid':_0x32b7dc},'order':[['id',_0x2b38('0x2')]],'limit':0x1},'log':_0x2b38('0x3')});}; \ No newline at end of file +var _0x1462=['Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','create'];(function(_0x5520c7,_0xbee449){var _0x3b0590=function(_0x1bb4f9){while(--_0x1bb4f9){_0x5520c7['push'](_0x5520c7['shift']());}};_0x3b0590(++_0xbee449);}(_0x1462,0x143));var _0x2146=function(_0xc107be,_0x522cb3){_0xc107be=_0xc107be-0x0;var _0x4e13eb=_0x1462[_0xc107be];return _0x4e13eb;};'use strict';var client=require('../client');exports[_0x2146('0x0')]=function(_0x24cd4a){return client[_0x2146('0x1')]('CreateWhatsappQueueReport',{'body':_0x24cd4a,'log':_0x2146('0x2')});};exports[_0x2146('0x3')]=function(_0x1cfd9a,_0x26dc12){return client[_0x2146('0x1')](_0x2146('0x4'),{'body':_0x26dc12,'options':{'where':{'uniqueid':_0x1cfd9a},'order':[['id',_0x2146('0x5')]],'limit':0x1},'log':_0x2146('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 9942b38..da7209a 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 _0x7744=['stack','lodash','seq-queue','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','map','join','stop','find','agents','timeout','createQueue','atimeout','channel','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s'];(function(_0x4379bf,_0x19ac36){var _0x25d903=function(_0x26d363){while(--_0x26d363){_0x4379bf['push'](_0x4379bf['shift']());}};_0x25d903(++_0x19ac36);}(_0x7744,0x182));var _0x4774=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0x7744[_0x39e84d];return _0x1991bc;};'use strict';var schema=require('validate');var _=require(_0x4774('0x0'));var util=require('util');var seqqueue=require(_0x4774('0x1'));var logger=require('../../../../config/logger')(_0x4774('0x2'));var strategy=require(_0x4774('0x3'));var queue=schema({'name':{'type':_0x4774('0x4'),'required':!![],'message':_0x4774('0x5')},'timeout':{'type':_0x4774('0x6'),'message':_0x4774('0x7')}});function writeLog(_0x52a176,_0x1371d5,_0x34f01a){return logger['info'](util[_0x4774('0x8')](_0x4774('0x9'),_0x52a176,_0x1371d5[_0x4774('0xa')],_0x34f01a));}function handleFindAgent(_0x1472c3){return function(_0x1b26ad){return _0x1b26ad[_0x4774('0xa')][_0x4774('0xb')]()===_0x1472c3[_0x4774('0xb')]();};}exports[_0x4774('0xc')]=function(_0x466866,_0x2fe1e1,_0x2e0ddc,_0x56b99f){return function(_0x13de35){try{var _0x250da5={'name':_0x2fe1e1[0x0],'timeout':_0x2fe1e1[0x1]};var _0x4f358d=queue['validate'](_0x250da5,{'typecast':!![]});if(_0x4f358d[_0x4774('0xd')]){logger[_0x4774('0xe')]('[%s][AGENT]\x20%s',_0x466866,_[_0x4774('0xf')](_0x4f358d,'message')[_0x4774('0x10')](',\x20'));_0x13de35[_0x4774('0x11')]();}else{var _0x4712e5=_[_0x4774('0x12')](_0x2e0ddc[_0x4774('0x13')],handleFindAgent(_0x250da5['name']));if(_0x4712e5){var _0x33a204=(_0x250da5[_0x4774('0x14')]||0xa)*0x3e8;var _0x52e34b,_0x1c545a;var _0x169771=seqqueue[_0x4774('0x15')](_0x33a204);_0x169771['id']=_0x466866;_0x169771[_0x4774('0x16')]=_0x33a204;_0x169771[_0x4774('0x17')]=_0x56b99f[_0x4774('0x17')];writeLog(_0x466866,_0x4712e5,util['format']('START:%s',_0x33a204));_0x2e0ddc['rules'][_0x466866]['on'](_0x4774('0x18'),function(){logger[_0x4774('0x19')](_0x4774('0x1a'),_0x466866);clearTimeout(_0x1c545a);_0x1c545a=undefined;_0x169771[_0x4774('0x1b')]();if(_0x2e0ddc[_0x4774('0x1c')][_0x466866]){delete _0x2e0ddc[_0x4774('0x1c')][_0x466866];}_0x13de35[_0x4774('0x11')]();});_0x2e0ddc[_0x4774('0x1c')][_0x466866]['on'](_0x4774('0x1d'),function(){if(_0x2e0ddc[_0x4774('0x1c')][_0x466866]){delete _0x2e0ddc[_0x4774('0x1c')][_0x466866];}});_0x1c545a=setTimeout(function(){logger[_0x4774('0x19')](_0x4774('0x1e'),_0x466866);clearTimeout(_0x1c545a);_0x169771[_0x4774('0x1b')]();_0x13de35[_0x4774('0x1f')]();},_0x33a204);strategy[_0x4774('0x20')](_0x169771,_0x4712e5,_0x2e0ddc,_0x56b99f);}else{logger['error'](_0x4774('0x21'),_0x466866,_0x250da5[_0x4774('0xa')]);_0x13de35[_0x4774('0x11')]();}}}catch(_0x4773c9){console['log'](_0x4773c9);logger[_0x4774('0xe')]('[%s][QUEUE]\x20%s',_0x466866,_0x4773c9[_0x4774('0x22')]);_0x13de35[_0x4774('0x11')]();}};}; \ No newline at end of file +var _0x2ddd=['[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','lodash','util','seq-queue','../../../../config/logger','./strategy','string','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','validate','length','error','[%s][AGENT]\x20%s','map','stop','find','agents','timeout','createQueue','atimeout','START:%s','end','close','rules','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent'];(function(_0x57add2,_0x4f2b7d){var _0x4e3670=function(_0x3311b){while(--_0x3311b){_0x57add2['push'](_0x57add2['shift']());}};_0x4e3670(++_0x4f2b7d);}(_0x2ddd,0x19b));var _0xd2dd=function(_0x737a1f,_0x235fef){_0x737a1f=_0x737a1f-0x0;var _0x16eba1=_0x2ddd[_0x737a1f];return _0x16eba1;};'use strict';var schema=require('validate');var _=require(_0xd2dd('0x0'));var util=require(_0xd2dd('0x1'));var seqqueue=require(_0xd2dd('0x2'));var logger=require(_0xd2dd('0x3'))('routing');var strategy=require(_0xd2dd('0x4'));var queue=schema({'name':{'type':_0xd2dd('0x5'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xd2dd('0x6'),'message':_0xd2dd('0x7')}});function writeLog(_0x71432d,_0x3dd410,_0x139459){return logger[_0xd2dd('0x8')](util[_0xd2dd('0x9')](_0xd2dd('0xa'),_0x71432d,_0x3dd410[_0xd2dd('0xb')],_0x139459));}function handleFindAgent(_0x4be5bf){return function(_0x1c68e6){return _0x1c68e6[_0xd2dd('0xb')][_0xd2dd('0xc')]()===_0x4be5bf['toLowerCase']();};}exports[_0xd2dd('0xd')]=function(_0x578cb5,_0x13e539,_0x17ea26,_0x56e382){return function(_0x426c75){try{var _0x5abbe3={'name':_0x13e539[0x0],'timeout':_0x13e539[0x1]};var _0x19d87e=queue[_0xd2dd('0xe')](_0x5abbe3,{'typecast':!![]});if(_0x19d87e[_0xd2dd('0xf')]){logger[_0xd2dd('0x10')](_0xd2dd('0x11'),_0x578cb5,_[_0xd2dd('0x12')](_0x19d87e,'message')['join'](',\x20'));_0x426c75[_0xd2dd('0x13')]();}else{var _0x1b5d2a=_[_0xd2dd('0x14')](_0x17ea26[_0xd2dd('0x15')],handleFindAgent(_0x5abbe3[_0xd2dd('0xb')]));if(_0x1b5d2a){var _0x5a6ada=(_0x5abbe3[_0xd2dd('0x16')]||0xa)*0x3e8;var _0x152c9d,_0x339008;var _0x446816=seqqueue[_0xd2dd('0x17')](_0x5a6ada);_0x446816['id']=_0x578cb5;_0x446816[_0xd2dd('0x18')]=_0x5a6ada;_0x446816['channel']=_0x56e382['channel'];writeLog(_0x578cb5,_0x1b5d2a,util[_0xd2dd('0x9')](_0xd2dd('0x19'),_0x5a6ada));_0x17ea26['rules'][_0x578cb5]['on'](_0xd2dd('0x1a'),function(){logger[_0xd2dd('0x8')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x578cb5);clearTimeout(_0x339008);_0x339008=undefined;_0x446816[_0xd2dd('0x1b')]();if(_0x17ea26[_0xd2dd('0x1c')][_0x578cb5]){delete _0x17ea26[_0xd2dd('0x1c')][_0x578cb5];}_0x426c75[_0xd2dd('0x13')]();});_0x17ea26[_0xd2dd('0x1c')][_0x578cb5]['on'](_0xd2dd('0x1d'),function(){if(_0x17ea26['rules'][_0x578cb5]){delete _0x17ea26[_0xd2dd('0x1c')][_0x578cb5];}});_0x339008=setTimeout(function(){logger['info'](_0xd2dd('0x1e'),_0x578cb5);clearTimeout(_0x339008);_0x446816[_0xd2dd('0x1b')]();_0x426c75[_0xd2dd('0x1f')]();},_0x5a6ada);strategy[_0xd2dd('0x20')](_0x446816,_0x1b5d2a,_0x17ea26,_0x56e382);}else{logger[_0xd2dd('0x10')](_0xd2dd('0x21'),_0x578cb5,_0x5abbe3[_0xd2dd('0xb')]);_0x426c75['stop']();}}}catch(_0x3fd7fe){console[_0xd2dd('0x22')](_0x3fd7fe);logger['error'](_0xd2dd('0x23'),_0x578cb5,_0x3fd7fe[_0xd2dd('0x24')]);_0x426c75[_0xd2dd('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 7f5feef..f8e4b58 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 _0x4318=['contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','isEmpty','body','getMustacheRender','Message','create','then','catch','error','[%s][AMAZONLEX]\x20%s','stringify','finally','stop','LexRuntime','$LATEST','message','postText','amazonlex','dialogState','Failed','next','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x4318,0x7b));var _0x8431=function(_0x126052,_0x2f5a69){_0x126052=_0x126052-0x0;var _0x49bf1a=_0x4318[_0x126052];return _0x49bf1a;};'use strict';var _=require(_0x8431('0x0'));var moment=require(_0x8431('0x1'));var AWS=require(_0x8431('0x2'));var utils=require(_0x8431('0x3'));var logger=require(_0x8431('0x4'))(_0x8431('0x5'));var rpc={'chatMessage':require(_0x8431('0x6')),'openchannelMessage':require(_0x8431('0x7')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x8431('0x8')),'faxMessage':require(_0x8431('0x9'))};exports['consequence']=function(_0x2b30ba,_0x4d60e2){return function(_0x3dcff7){try{if(!_[_0x8431('0xa')](this[_0x8431('0xb')][_0x8431('0xc')])){logger[_0x8431('0xd')]('[%s][AMAZONLEX]\x20%s',_0x2b30ba,_0x8431('0xe'));return _0x3dcff7['next']();}var _0x51e397={'ContactId':this[_0x8431('0xf')]['id'],'sentAt':moment()[_0x8431('0x10')](_0x8431('0x11')),'direction':_0x8431('0x12')};var _0x2c00b7=this[_0x8431('0x13')];if(_0x2c00b7===_0x8431('0x14')){_0x51e397[_0x8431('0x15')]=this['account']['id'];}else{_0x51e397[_[_0x8431('0x16')](_0x2c00b7)+_0x8431('0x17')]=this[_0x8431('0x18')]['id'];}_0x51e397[_[_0x8431('0x16')](_0x2c00b7)+_0x8431('0x19')]=this[_0x8431('0xb')]['id'];if(this[_0x8431('0xb')]['created']){var _0x8d9b2c=_0x4d60e2[0x4];if(!_[_0x8431('0x1a')](_0x8d9b2c)){_0x51e397[_0x8431('0x1b')]=utils[_0x8431('0x1c')](_0x8d9b2c,this);return rpc[_0x2c00b7+_0x8431('0x1d')][_0x8431('0x1e')](_0x51e397)[_0x8431('0x1f')](function(_0x4eb8f5){logger[_0x8431('0xd')]('[%s][AMAZONLEX]\x20%s',_0x2b30ba,_0x51e397[_0x8431('0x1b')]);})[_0x8431('0x20')](function(_0xcb4a27){logger[_0x8431('0x21')](_0x8431('0x22'),_0x2b30ba,JSON[_0x8431('0x23')](_0xcb4a27));})[_0x8431('0x24')](function(){logger[_0x8431('0xd')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x2b30ba);_0x3dcff7['stop']();});}else{logger[_0x8431('0xd')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x2b30ba);_0x3dcff7[_0x8431('0x25')]();}}else{var _0x501128=this;var _0x1a0068=new AWS[(_0x8431('0x26'))]({'accessKeyId':_0x4d60e2[0x0],'secretAccessKey':_0x4d60e2[0x1],'region':_0x4d60e2[0x2]});var _0x268774={'botAlias':_0x8431('0x27'),'botName':_0x4d60e2[0x3],'inputText':this[_0x8431('0x28')]['body'],'userId':this['interaction']['id']['toString']()};_0x1a0068[_0x8431('0x29')](_0x268774,function(_0x33f79d,_0x5c06f7){if(_0x33f79d){logger[_0x8431('0x21')](_0x8431('0x22'),_0x2b30ba,_0x33f79d['message']);_0x3dcff7['next']();}else if(_0x5c06f7&&_0x5c06f7['message']){_0x501128[_0x8431('0x1b')][_0x8431('0x2a')]=_0x5c06f7;_0x51e397[_0x8431('0x1b')]=_0x5c06f7[_0x8431('0x28')];return rpc[_0x2c00b7+_0x8431('0x1d')]['create'](_0x51e397)[_0x8431('0x1f')](function(_0x39ad41){logger[_0x8431('0xd')](_0x8431('0x22'),_0x2b30ba,_0x51e397[_0x8431('0x1b')]);if(_0x5c06f7[_0x8431('0x2b')]==_0x8431('0x2c')){_0x3dcff7['next']();}else{_0x3dcff7[_0x8431('0x25')]();}})['catch'](function(_0x5880ab){logger['error'](_0x8431('0x22'),_0x2b30ba,JSON[_0x8431('0x23')](_0x5880ab));_0x3dcff7[_0x8431('0x2d')]();});}else{_0x3dcff7['next']();}});}}catch(_0x2c400c){logger['error'](_0x8431('0x22'),_0x2b30ba,JSON[_0x8431('0x23')](_0x2c400c));_0x3dcff7[_0x8431('0x25')]();}};}; \ No newline at end of file +var _0xc94c=['InteractionId','isEmpty','Message','create','then','[%s][AMAZONLEX]\x20%s','body','catch','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','message','toString','amazonlex','dialogState','Failed','next','stringify','error','lodash','./utils','../../../../config/logger','routing','../../rpc/smsMessage','interaction','UserId','info','YYYY-MM-DD\x20HH:mm:ss','chat','ChatWebsiteId','account','upperFirst','AccountId'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0xc94c,0x173));var _0xcc94=function(_0x26c8c8,_0x5bdf41){_0x26c8c8=_0x26c8c8-0x0;var _0x519e92=_0xc94c[_0x26c8c8];return _0x519e92;};'use strict';var _=require(_0xcc94('0x0'));var moment=require('moment');var AWS=require('aws-sdk');var utils=require(_0xcc94('0x1'));var logger=require(_0xcc94('0x2'))(_0xcc94('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xcc94('0x4')),'faxMessage':require('../../rpc/faxMessage')};exports['consequence']=function(_0x27c6d6,_0x44eabd){return function(_0x4fe34b){try{if(!_['isNil'](this[_0xcc94('0x5')][_0xcc94('0x6')])){logger[_0xcc94('0x7')]('[%s][AMAZONLEX]\x20%s',_0x27c6d6,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x4fe34b['next']();}var _0x4430c9={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0xcc94('0x8')),'direction':'out'};var _0x139ebc=this['channel'];if(_0x139ebc===_0xcc94('0x9')){_0x4430c9[_0xcc94('0xa')]=this[_0xcc94('0xb')]['id'];}else{_0x4430c9[_[_0xcc94('0xc')](_0x139ebc)+_0xcc94('0xd')]=this[_0xcc94('0xb')]['id'];}_0x4430c9[_['upperFirst'](_0x139ebc)+_0xcc94('0xe')]=this[_0xcc94('0x5')]['id'];if(this[_0xcc94('0x5')]['created']){var _0x32a731=_0x44eabd[0x4];if(!_[_0xcc94('0xf')](_0x32a731)){_0x4430c9['body']=utils['getMustacheRender'](_0x32a731,this);return rpc[_0x139ebc+_0xcc94('0x10')][_0xcc94('0x11')](_0x4430c9)[_0xcc94('0x12')](function(_0x1a7df1){logger[_0xcc94('0x7')](_0xcc94('0x13'),_0x27c6d6,_0x4430c9[_0xcc94('0x14')]);})[_0xcc94('0x15')](function(_0x434024){logger['error'](_0xcc94('0x13'),_0x27c6d6,JSON['stringify'](_0x434024));})[_0xcc94('0x16')](function(){logger[_0xcc94('0x7')](_0xcc94('0x17'),_0x27c6d6);_0x4fe34b[_0xcc94('0x18')]();});}else{logger['info'](_0xcc94('0x19'),_0x27c6d6);_0x4fe34b[_0xcc94('0x18')]();}}else{var _0x12f7c7=this;var _0x68902e=new AWS['LexRuntime']({'accessKeyId':_0x44eabd[0x0],'secretAccessKey':_0x44eabd[0x1],'region':_0x44eabd[0x2]});var _0x384e66={'botAlias':_0xcc94('0x1a'),'botName':_0x44eabd[0x3],'inputText':this[_0xcc94('0x1b')][_0xcc94('0x14')],'userId':this[_0xcc94('0x5')]['id'][_0xcc94('0x1c')]()};_0x68902e['postText'](_0x384e66,function(_0x39da31,_0x41619c){if(_0x39da31){logger['error'](_0xcc94('0x13'),_0x27c6d6,_0x39da31[_0xcc94('0x1b')]);_0x4fe34b['next']();}else if(_0x41619c&&_0x41619c[_0xcc94('0x1b')]){_0x12f7c7[_0xcc94('0x14')][_0xcc94('0x1d')]=_0x41619c;_0x4430c9[_0xcc94('0x14')]=_0x41619c[_0xcc94('0x1b')];return rpc[_0x139ebc+_0xcc94('0x10')][_0xcc94('0x11')](_0x4430c9)['then'](function(_0x4a188d){logger[_0xcc94('0x7')](_0xcc94('0x13'),_0x27c6d6,_0x4430c9[_0xcc94('0x14')]);if(_0x41619c[_0xcc94('0x1e')]==_0xcc94('0x1f')){_0x4fe34b[_0xcc94('0x20')]();}else{_0x4fe34b[_0xcc94('0x18')]();}})[_0xcc94('0x15')](function(_0x576e71){logger['error'](_0xcc94('0x13'),_0x27c6d6,JSON[_0xcc94('0x21')](_0x576e71));_0x4fe34b[_0xcc94('0x20')]();});}else{_0x4fe34b[_0xcc94('0x20')]();}});}}catch(_0x6bf9a2){logger[_0xcc94('0x22')](_0xcc94('0x13'),_0x27c6d6,JSON[_0xcc94('0x21')](_0x6bf9a2));_0x4fe34b[_0xcc94('0x18')]();}};}; \ 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 9b73fb8..47ca0ae 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 _0xd8b0=['upperFirst','AccountId','InteractionId','Message','service','Smtp','host','port','secure','pass','html','replace','','messageId','create','then','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','lodash','moment','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','interaction','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','next','channel','contact','YYYY-MM-DD\x20HH:mm:ss','out','message','from','phone','read','subject','startsWith','Re:','chat','ChatWebsiteId','account'];(function(_0xf01be4,_0x5848b7){var _0x33a958=function(_0x57dd2b){while(--_0x57dd2b){_0xf01be4['push'](_0xf01be4['shift']());}};_0x33a958(++_0x5848b7);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));var utils=require('./utils');var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x0d8b('0x2')),'openchannelMessage':require(_0x0d8b('0x3')),'mailMessage':require(_0x0d8b('0x4')),'smsMessage':require(_0x0d8b('0x5')),'faxMessage':require(_0x0d8b('0x6'))};var mailRpc=require('../../mailRpc');exports['consequence']=function(_0x3f8b6f,_0x227c63){return function(_0x39f43a){try{if(_0x227c63[0x0]==='1'&&(_['isNil'](this[_0x0d8b('0x7')][_0x0d8b('0x8')])||!this['interaction'][_0x0d8b('0x8')])){logger[_0x0d8b('0x9')](_0x0d8b('0xa'),_0x3f8b6f,_0x0d8b('0xb'));return _0x39f43a[_0x0d8b('0xc')]();}var _0x1cac62=this[_0x0d8b('0xd')];var _0x28f87c={'body':utils['getMustacheRender'](_0x227c63[0x1],this),'ContactId':this[_0x0d8b('0xe')]['id'],'sentAt':moment()['format'](_0x0d8b('0xf')),'direction':_0x0d8b('0x10')};if(this[_0x0d8b('0x11')]){_0x28f87c['to']=this[_0x0d8b('0x11')][_0x0d8b('0x12')]||'';_0x28f87c['cc']=this[_0x0d8b('0x11')]['cc']||'';_0x28f87c[_0x0d8b('0x12')]=this[_0x0d8b('0x11')]['to']||'';_0x28f87c[_0x0d8b('0x13')]=this[_0x0d8b('0x11')][_0x0d8b('0x13')]||'';_0x28f87c[_0x0d8b('0x14')]=!![];if(this[_0x0d8b('0x11')][_0x0d8b('0x15')]){_0x28f87c['subject']='';_0x28f87c[_0x0d8b('0x15')]+=_[_0x0d8b('0x16')](this[_0x0d8b('0x11')][_0x0d8b('0x15')],_0x0d8b('0x17'))?'':'Re:\x20';_0x28f87c[_0x0d8b('0x15')]+=this[_0x0d8b('0x11')][_0x0d8b('0x15')];}}if(this[_0x0d8b('0xd')]===_0x0d8b('0x18')){_0x28f87c[_0x0d8b('0x19')]=this[_0x0d8b('0x1a')]['id'];}else{_0x28f87c[_[_0x0d8b('0x1b')](this['channel'])+_0x0d8b('0x1c')]=this[_0x0d8b('0x1a')]['id'];}_0x28f87c[_[_0x0d8b('0x1b')](this[_0x0d8b('0xd')])+_0x0d8b('0x1d')]=this[_0x0d8b('0x7')]['id'];if(rpc[this[_0x0d8b('0xd')]+_0x0d8b('0x1e')]){if(this['channel']==='mail'){var _0x33fb87={'tls':{'rejectUnauthorized':![]}};if(this['account']['Smtp']['service']){_0x33fb87[_0x0d8b('0x1f')]=this[_0x0d8b('0x1a')][_0x0d8b('0x20')][_0x0d8b('0x1f')];}else{_0x33fb87[_0x0d8b('0x21')]=this[_0x0d8b('0x1a')][_0x0d8b('0x20')][_0x0d8b('0x21')];_0x33fb87[_0x0d8b('0x22')]=this['account'][_0x0d8b('0x20')][_0x0d8b('0x22')];_0x33fb87['secure']=this[_0x0d8b('0x1a')]['Smtp'][_0x0d8b('0x23')];}if(this[_0x0d8b('0x1a')][_0x0d8b('0x20')]['authentication']){_0x33fb87['auth']={'user':this[_0x0d8b('0x1a')][_0x0d8b('0x20')]['user'],'pass':this[_0x0d8b('0x1a')]['Smtp'][_0x0d8b('0x24')]};}_0x28f87c['inReplyTo']=this[_0x0d8b('0x11')]['messageId'];_0x28f87c[_0x0d8b('0x25')]=''+_[_0x0d8b('0x26')](_0x28f87c['body'],_0x0d8b('0x27'),_0x0d8b('0x28'))+_0x0d8b('0x29');return mailRpc['sendMailMessage'](_0x33fb87,_0x28f87c)['then'](function(_0x51cf32){logger[_0x0d8b('0x9')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x3f8b6f);_0x28f87c[_0x0d8b('0x2a')]=_0x51cf32['message']['messageId'];return rpc[_0x1cac62+_0x0d8b('0x1e')][_0x0d8b('0x2b')](_0x28f87c);})[_0x0d8b('0x2c')](function(_0xdeee5d){logger[_0x0d8b('0x9')](_0x0d8b('0xa'),_0x3f8b6f,JSON[_0x0d8b('0x2d')](_0xdeee5d));})[_0x0d8b('0x2e')](function(_0x553e03){logger[_0x0d8b('0x2f')](_0x0d8b('0x30'),_0x3f8b6f,JSON['stringify'](_0x553e03));})[_0x0d8b('0x31')](function(){_0x39f43a[_0x0d8b('0xc')]();});}else{return rpc[this[_0x0d8b('0xd')]+'Message'][_0x0d8b('0x2b')](_0x28f87c)[_0x0d8b('0x2c')](function(_0x206157){logger[_0x0d8b('0x9')](_0x0d8b('0xa'),_0x3f8b6f,_0x28f87c['body']);})[_0x0d8b('0x2e')](function(_0x1649fc){logger['error'](_0x0d8b('0xa'),_0x3f8b6f,JSON[_0x0d8b('0x2d')](_0x1649fc));})[_0x0d8b('0x31')](function(){_0x39f43a[_0x0d8b('0xc')]();});}}}catch(_0x373544){logger['error']('[%s][AUTOREPLY]\x20%s',_0x3f8b6f,JSON[_0x0d8b('0x2d')](_0x373544));_0x39f43a['stop']();}};}; \ No newline at end of file +var _0x0713=['authentication','auth','user','pass','inReplyTo','messageId','replace','body','','sendMailMessage','then','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','Message','[%s][AUTOREPLY]\x20%s','stop','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../mailRpc','consequence','isNil','interaction','created','info','Autoreply\x20already\x20sent','next','channel','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','message','phone','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','mail','Smtp','service','host','port','secure'];(function(_0x211a69,_0x3063af){var _0x271cf4=function(_0x42a614){while(--_0x42a614){_0x211a69['push'](_0x211a69['shift']());}};_0x271cf4(++_0x3063af);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var moment=require('moment');var utils=require(_0x3071('0x0'));var logger=require(_0x3071('0x1'))(_0x3071('0x2'));var rpc={'chatMessage':require(_0x3071('0x3')),'openchannelMessage':require(_0x3071('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x3071('0x5')),'faxMessage':require(_0x3071('0x6'))};var mailRpc=require(_0x3071('0x7'));exports[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return function(_0x1d3dd6){try{if(_0x41cf76[0x0]==='1'&&(_[_0x3071('0x9')](this[_0x3071('0xa')][_0x3071('0xb')])||!this[_0x3071('0xa')][_0x3071('0xb')])){logger[_0x3071('0xc')]('[%s][AUTOREPLY]\x20%s',_0xabd7b6,_0x3071('0xd'));return _0x1d3dd6[_0x3071('0xe')]();}var _0x937259=this[_0x3071('0xf')];var _0x1ce844={'body':utils['getMustacheRender'](_0x41cf76[0x1],this),'ContactId':this[_0x3071('0x10')]['id'],'sentAt':moment()[_0x3071('0x11')](_0x3071('0x12')),'direction':_0x3071('0x13')};if(this[_0x3071('0x14')]){_0x1ce844['to']=this['message']['from']||'';_0x1ce844['cc']=this[_0x3071('0x14')]['cc']||'';_0x1ce844['from']=this[_0x3071('0x14')]['to']||'';_0x1ce844[_0x3071('0x15')]=this['message'][_0x3071('0x15')]||'';_0x1ce844['read']=!![];if(this[_0x3071('0x14')][_0x3071('0x16')]){_0x1ce844[_0x3071('0x16')]='';_0x1ce844[_0x3071('0x16')]+=_[_0x3071('0x17')](this[_0x3071('0x14')][_0x3071('0x16')],_0x3071('0x18'))?'':_0x3071('0x19');_0x1ce844[_0x3071('0x16')]+=this['message'][_0x3071('0x16')];}}if(this[_0x3071('0xf')]===_0x3071('0x1a')){_0x1ce844[_0x3071('0x1b')]=this[_0x3071('0x1c')]['id'];}else{_0x1ce844[_[_0x3071('0x1d')](this[_0x3071('0xf')])+_0x3071('0x1e')]=this['account']['id'];}_0x1ce844[_[_0x3071('0x1d')](this[_0x3071('0xf')])+_0x3071('0x1f')]=this['interaction']['id'];if(rpc[this[_0x3071('0xf')]+'Message']){if(this[_0x3071('0xf')]===_0x3071('0x20')){var _0x3762d8={'tls':{'rejectUnauthorized':![]}};if(this[_0x3071('0x1c')][_0x3071('0x21')][_0x3071('0x22')]){_0x3762d8[_0x3071('0x22')]=this[_0x3071('0x1c')]['Smtp']['service'];}else{_0x3762d8[_0x3071('0x23')]=this[_0x3071('0x1c')][_0x3071('0x21')][_0x3071('0x23')];_0x3762d8[_0x3071('0x24')]=this[_0x3071('0x1c')][_0x3071('0x21')][_0x3071('0x24')];_0x3762d8[_0x3071('0x25')]=this['account'][_0x3071('0x21')][_0x3071('0x25')];}if(this[_0x3071('0x1c')]['Smtp'][_0x3071('0x26')]){_0x3762d8[_0x3071('0x27')]={'user':this[_0x3071('0x1c')][_0x3071('0x21')][_0x3071('0x28')],'pass':this[_0x3071('0x1c')][_0x3071('0x21')][_0x3071('0x29')]};}_0x1ce844[_0x3071('0x2a')]=this[_0x3071('0x14')][_0x3071('0x2b')];_0x1ce844['html']=''+_[_0x3071('0x2c')](_0x1ce844[_0x3071('0x2d')],_0x3071('0x2e'),_0x3071('0x2f'))+_0x3071('0x30');return mailRpc[_0x3071('0x31')](_0x3762d8,_0x1ce844)[_0x3071('0x32')](function(_0x1ccc41){logger['info']('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0xabd7b6);_0x1ce844['messageId']=_0x1ccc41[_0x3071('0x14')][_0x3071('0x2b')];return rpc[_0x937259+'Message'][_0x3071('0x33')](_0x1ce844);})[_0x3071('0x32')](function(_0x25250e){logger[_0x3071('0xc')]('[%s][AUTOREPLY]\x20%s',_0xabd7b6,JSON[_0x3071('0x34')](_0x25250e));})[_0x3071('0x35')](function(_0x602719){logger[_0x3071('0x36')](_0x3071('0x37'),_0xabd7b6,JSON[_0x3071('0x34')](_0x602719));})[_0x3071('0x38')](function(){_0x1d3dd6[_0x3071('0xe')]();});}else{return rpc[this['channel']+_0x3071('0x39')]['create'](_0x1ce844)['then'](function(_0x1a1a64){logger[_0x3071('0xc')]('[%s][AUTOREPLY]\x20%s',_0xabd7b6,_0x1ce844[_0x3071('0x2d')]);})[_0x3071('0x35')](function(_0x265d76){logger[_0x3071('0x36')](_0x3071('0x3a'),_0xabd7b6,JSON[_0x3071('0x34')](_0x265d76));})['finally'](function(){_0x1d3dd6[_0x3071('0xe')]();});}}}catch(_0xd7971f){logger['error'](_0x3071('0x3a'),_0xabd7b6,JSON['stringify'](_0xd7971f));_0x1d3dd6[_0x3071('0x3b')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 81a98a2..0abc3dc 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 _0x4fc2=['then','info','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','[%s][CLOSE]\x20%s','stringify','finally','stop','error','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction'];(function(_0xafd9c1,_0x219695){var _0x213e09=function(_0x12569c){while(--_0x12569c){_0xafd9c1['push'](_0xafd9c1['shift']());}};_0x213e09(++_0x219695);}(_0x4fc2,0x111));var _0x24fc=function(_0x57d13b,_0x52d8cb){_0x57d13b=_0x57d13b-0x0;var _0x467696=_0x4fc2[_0x57d13b];return _0x467696;};'use strict';var moment=require(_0x24fc('0x0'));var logger=require(_0x24fc('0x1'))(_0x24fc('0x2'));var rpc={'chatInteraction':require(_0x24fc('0x3')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x24fc('0x4')),'mailInteraction':require(_0x24fc('0x5')),'faxInteraction':require(_0x24fc('0x6'))};exports['consequence']=function(_0x126d90,_0x3772eb,_0x58dafc,_0x26fcc6){return function(_0x12d602){try{logger['info'](_0x24fc('0x7'),_0x126d90,_0x3772eb[0x0]);var _0x22a0c8={'closed':0x1,'closedAt':moment()[_0x24fc('0x8')](_0x24fc('0x9')),'closeReason':_0x24fc('0xa'),'disposition':_0x3772eb[0x0]};if(rpc[_0x26fcc6[_0x24fc('0xb')]+'Interaction']){rpc[_0x26fcc6[_0x24fc('0xb')]+_0x24fc('0xc')][_0x24fc('0xd')](_0x26fcc6[_0x24fc('0xe')]['id'],_0x22a0c8)[_0x24fc('0xf')](function(_0x2de64d){logger[_0x24fc('0x10')](_0x24fc('0x11'),_0x126d90,_0x26fcc6['interaction']['id']);})[_0x24fc('0x12')](function(_0x1cde5d){logger['error'](_0x24fc('0x13'),_0x126d90,JSON[_0x24fc('0x14')](_0x1cde5d));})[_0x24fc('0x15')](function(){_0x12d602[_0x24fc('0x16')]();});}}catch(_0x30f19b){logger[_0x24fc('0x17')]('[%s][CLOSE]\x20%s',_0x126d90,JSON[_0x24fc('0x14')](_0x30f19b));_0x12d602[_0x24fc('0x16')]();}};}; \ No newline at end of file +var _0x7366=['../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','Interaction','channel','interaction','catch','stringify','finally','stop','error','[%s][CLOSE]\x20%s','moment','../../../../config/logger','routing','../../rpc/chatInteraction'];(function(_0xc87d08,_0x59c9be){var _0x30a714=function(_0x437c0d){while(--_0x437c0d){_0xc87d08['push'](_0xc87d08['shift']());}};_0x30a714(++_0x59c9be);}(_0x7366,0x9d));var _0x6736=function(_0x134557,_0x19ea33){_0x134557=_0x134557-0x0;var _0x1ab4eb=_0x7366[_0x134557];return _0x1ab4eb;};'use strict';var moment=require(_0x6736('0x0'));var logger=require(_0x6736('0x1'))(_0x6736('0x2'));var rpc={'chatInteraction':require(_0x6736('0x3')),'openchannelInteraction':require(_0x6736('0x4')),'smsInteraction':require(_0x6736('0x5')),'mailInteraction':require(_0x6736('0x6')),'faxInteraction':require(_0x6736('0x7'))};exports[_0x6736('0x8')]=function(_0x5b72a8,_0xe9150b,_0x5ec475,_0x595d6f){return function(_0x54040b){try{logger[_0x6736('0x9')](_0x6736('0xa'),_0x5b72a8,_0xe9150b[0x0]);var _0x4f4944={'closed':0x1,'closedAt':moment()[_0x6736('0xb')](_0x6736('0xc')),'closeReason':_0x6736('0xd'),'disposition':_0xe9150b[0x0]};if(rpc[_0x595d6f['channel']+_0x6736('0xe')]){rpc[_0x595d6f[_0x6736('0xf')]+_0x6736('0xe')]['update'](_0x595d6f[_0x6736('0x10')]['id'],_0x4f4944)['then'](function(_0x2155c4){logger[_0x6736('0x9')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x5b72a8,_0x595d6f[_0x6736('0x10')]['id']);})[_0x6736('0x11')](function(_0x5d21f8){logger['error']('[%s][CLOSE]\x20%s',_0x5b72a8,JSON[_0x6736('0x12')](_0x5d21f8));})[_0x6736('0x13')](function(){_0x54040b[_0x6736('0x14')]();});}}catch(_0x43bcc7){logger[_0x6736('0x15')](_0x6736('0x16'),_0x5b72a8,JSON[_0x6736('0x12')](_0x43bcc7));_0x54040b[_0x6736('0x14')]();}};}; \ 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 bf4e203..3477d04 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 _0x23ce=['next','contact','format','out','chat','ChatWebsiteId','AccountId','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','create','then','info','catch','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','dialogflow','result','fulfillment','speech','Message','metadata','error','md5','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.'];(function(_0x4f1d02,_0x4a4694){var _0x52fda1=function(_0x4091fe){while(--_0x4091fe){_0x4f1d02['push'](_0x4f1d02['shift']());}};_0x52fda1(++_0x4a4694);}(_0x23ce,0x14c));var _0xe23c=function(_0x59c82d,_0x4b6440){_0x59c82d=_0x59c82d-0x0;var _0x53f0f0=_0x23ce[_0x59c82d];return _0x53f0f0;};'use strict';var _=require('lodash');var moment=require('moment');var apiai=require('apiai-promise');var md5=require(_0xe23c('0x0'));var utils=require(_0xe23c('0x1'));var logger=require(_0xe23c('0x2'))('routing');var rpc={'chatMessage':require(_0xe23c('0x3')),'openchannelMessage':require(_0xe23c('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xe23c('0x5'))};exports[_0xe23c('0x6')]=function(_0x20ddb8,_0x15ef74){return function(_0x24e748){try{if(!_[_0xe23c('0x7')](this[_0xe23c('0x8')][_0xe23c('0x9')])){logger['info'](_0xe23c('0xa'),_0x20ddb8,_0xe23c('0xb'));return _0x24e748[_0xe23c('0xc')]();}var _0x21d75c={'ContactId':this[_0xe23c('0xd')]['id'],'sentAt':moment()[_0xe23c('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xe23c('0xf')};var _0x29ddc7=this['channel'];if(_0x29ddc7===_0xe23c('0x10')){_0x21d75c[_0xe23c('0x11')]=this['account']['id'];}else{_0x21d75c[_['upperFirst'](_0x29ddc7)+_0xe23c('0x12')]=this[_0xe23c('0x13')]['id'];}_0x21d75c[_[_0xe23c('0x14')](_0x29ddc7)+_0xe23c('0x15')]=this[_0xe23c('0x8')]['id'];if(this[_0xe23c('0x8')][_0xe23c('0x16')]){var _0x5162ff=_0x15ef74[0x2];if(!_[_0xe23c('0x17')](_0x5162ff)){_0x21d75c[_0xe23c('0x18')]=utils[_0xe23c('0x19')](_0x5162ff,this);return rpc[_0x29ddc7+'Message'][_0xe23c('0x1a')](_0x21d75c)[_0xe23c('0x1b')](function(_0x3f37a0){logger[_0xe23c('0x1c')](_0xe23c('0xa'),_0x20ddb8,_0x21d75c[_0xe23c('0x18')]);})[_0xe23c('0x1d')](function(_0x316a77){logger['error'](_0xe23c('0xa'),_0x20ddb8,JSON[_0xe23c('0x1e')](_0x316a77));})[_0xe23c('0x1f')](function(){logger['info'](_0xe23c('0x20'),_0x20ddb8);_0x24e748[_0xe23c('0x21')]();});}else{logger[_0xe23c('0x1c')](_0xe23c('0x22'),_0x20ddb8);_0x24e748['stop']();}}else{var _0x449723=this;var _0x4e9200=apiai(_0x15ef74[0x0],{'language':_0x15ef74[0x1]||'en'});return _0x4e9200['textRequest'](this[_0xe23c('0x23')][_0xe23c('0x18')],{'sessionId':md5(this['interaction']['id'])})[_0xe23c('0x1b')](function(_0x3e2b68){_0x449723[_0xe23c('0x18')][_0xe23c('0x24')]=_0x3e2b68;_0x21d75c[_0xe23c('0x18')]=_0x3e2b68[_0xe23c('0x25')][_0xe23c('0x26')][_0xe23c('0x27')];return rpc[_0x29ddc7+_0xe23c('0x28')][_0xe23c('0x1a')](_0x21d75c)[_0xe23c('0x1b')](function(_0xa49f12){logger[_0xe23c('0x1c')]('[%s][DIALOGFLOW]\x20%s',_0x20ddb8,_0x21d75c[_0xe23c('0x18')]);if(_0x3e2b68[_0xe23c('0x25')][_0xe23c('0x29')]['endConversation']){_0x24e748[_0xe23c('0xc')]();}else{_0x24e748[_0xe23c('0x21')]();}})[_0xe23c('0x1d')](function(_0x3509c3){logger[_0xe23c('0x2a')](_0xe23c('0xa'),_0x20ddb8,JSON[_0xe23c('0x1e')](_0x3509c3));_0x24e748[_0xe23c('0xc')]();});})[_0xe23c('0x1d')](function(_0x5557d5){logger['error'](_0xe23c('0xa'),_0x20ddb8,_0x5557d5[_0xe23c('0x23')]);_0x24e748[_0xe23c('0xc')]();});}}catch(_0x45b098){logger[_0xe23c('0x2a')]('[%s][DIALOGFLOW]\x20%s',_0x20ddb8,JSON[_0xe23c('0x1e')](_0x45b098));_0x24e748['stop']();}};}; \ No newline at end of file +var _0xd871=['then','[%s][DIALOGFLOW]\x20%s','catch','error','finally','info','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','result','fulfillment','speech','create','metadata','endConversation','stop','stringify','lodash','moment','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','consequence','isNil','interaction','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','chat','account','upperFirst','InteractionId','isEmpty','body','Message'];(function(_0x3983bd,_0x510100){var _0x3575d3=function(_0x118bbd){while(--_0x118bbd){_0x3983bd['push'](_0x3983bd['shift']());}};_0x3575d3(++_0x510100);}(_0xd871,0x1f1));var _0x1d87=function(_0xf06844,_0x4dcba8){_0xf06844=_0xf06844-0x0;var _0x1e52e1=_0xd871[_0xf06844];return _0x1e52e1;};'use strict';var _=require(_0x1d87('0x0'));var moment=require(_0x1d87('0x1'));var apiai=require('apiai-promise');var md5=require('md5');var utils=require(_0x1d87('0x2'));var logger=require('../../../../config/logger')(_0x1d87('0x3'));var rpc={'chatMessage':require(_0x1d87('0x4')),'openchannelMessage':require(_0x1d87('0x5')),'mailMessage':require(_0x1d87('0x6')),'smsMessage':require(_0x1d87('0x7')),'faxMessage':require('../../rpc/faxMessage')};exports[_0x1d87('0x8')]=function(_0x64e9fd,_0x4778d6){return function(_0x22b273){try{if(!_[_0x1d87('0x9')](this[_0x1d87('0xa')]['UserId'])){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x64e9fd,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x22b273[_0x1d87('0xb')]();}var _0x495f90={'ContactId':this[_0x1d87('0xc')]['id'],'sentAt':moment()[_0x1d87('0xd')](_0x1d87('0xe')),'direction':_0x1d87('0xf')};var _0x389b45=this['channel'];if(_0x389b45===_0x1d87('0x10')){_0x495f90['ChatWebsiteId']=this[_0x1d87('0x11')]['id'];}else{_0x495f90[_[_0x1d87('0x12')](_0x389b45)+'AccountId']=this['account']['id'];}_0x495f90[_[_0x1d87('0x12')](_0x389b45)+_0x1d87('0x13')]=this[_0x1d87('0xa')]['id'];if(this[_0x1d87('0xa')]['created']){var _0x65251e=_0x4778d6[0x2];if(!_[_0x1d87('0x14')](_0x65251e)){_0x495f90[_0x1d87('0x15')]=utils['getMustacheRender'](_0x65251e,this);return rpc[_0x389b45+_0x1d87('0x16')]['create'](_0x495f90)[_0x1d87('0x17')](function(_0x3a9edc){logger['info'](_0x1d87('0x18'),_0x64e9fd,_0x495f90[_0x1d87('0x15')]);})[_0x1d87('0x19')](function(_0xa6f2f7){logger[_0x1d87('0x1a')](_0x1d87('0x18'),_0x64e9fd,JSON['stringify'](_0xa6f2f7));})[_0x1d87('0x1b')](function(){logger[_0x1d87('0x1c')](_0x1d87('0x1d'),_0x64e9fd);_0x22b273['stop']();});}else{logger['info'](_0x1d87('0x1e'),_0x64e9fd);_0x22b273['stop']();}}else{var _0x47b2ed=this;var _0x4b677f=apiai(_0x4778d6[0x0],{'language':_0x4778d6[0x1]||'en'});return _0x4b677f['textRequest'](this[_0x1d87('0x1f')][_0x1d87('0x15')],{'sessionId':md5(this[_0x1d87('0xa')]['id'])})[_0x1d87('0x17')](function(_0x346361){_0x47b2ed['body']['dialogflow']=_0x346361;_0x495f90['body']=_0x346361[_0x1d87('0x20')][_0x1d87('0x21')][_0x1d87('0x22')];return rpc[_0x389b45+_0x1d87('0x16')][_0x1d87('0x23')](_0x495f90)['then'](function(_0x3f894d){logger[_0x1d87('0x1c')]('[%s][DIALOGFLOW]\x20%s',_0x64e9fd,_0x495f90['body']);if(_0x346361['result'][_0x1d87('0x24')][_0x1d87('0x25')]){_0x22b273['next']();}else{_0x22b273[_0x1d87('0x26')]();}})[_0x1d87('0x19')](function(_0x1bca10){logger[_0x1d87('0x1a')](_0x1d87('0x18'),_0x64e9fd,JSON[_0x1d87('0x27')](_0x1bca10));_0x22b273['next']();});})[_0x1d87('0x19')](function(_0x4220b4){logger[_0x1d87('0x1a')](_0x1d87('0x18'),_0x64e9fd,_0x4220b4[_0x1d87('0x1f')]);_0x22b273[_0x1d87('0xb')]();});}}catch(_0x445d72){logger[_0x1d87('0x1a')](_0x1d87('0x18'),_0x64e9fd,JSON[_0x1d87('0x27')](_0x445d72));_0x22b273[_0x1d87('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 811f2ee..e5533d4 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 _0x1340=['number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','validate','length','[%s][GOTOIF]\x20%s','map','message','join','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','error','lodash','html-to-text','./utils','../../../../config/logger','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x1340,0x8b));var _0x0134=function(_0x57e41e,_0x4350b8){_0x57e41e=_0x57e41e-0x0;var _0xf0f7f=_0x1340[_0x57e41e];return _0xf0f7f;};'use strict';var schema=require('validate');var _=require(_0x0134('0x0'));var htmlToText=require(_0x0134('0x1'));var utils=require(_0x0134('0x2'));var logger=require(_0x0134('0x3'))(_0x0134('0x4'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x0134('0x5')},'priorityTrue':{'type':_0x0134('0x6'),'message':_0x0134('0x7')},'priorityFalse':{'type':'number','message':_0x0134('0x8')}});exports[_0x0134('0x9')]=function(_0x1661a2,_0x446f32){return function(_0x479aa5){try{var _0xf4ce68={'condition':htmlToText[_0x0134('0xa')](utils[_0x0134('0xb')](_0x446f32[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x446f32[0x1],'priorityFalse':_0x446f32[0x2]};var _0x57b5b9=gotoif[_0x0134('0xc')](_0xf4ce68,{'typecast':!![]});if(_0x57b5b9[_0x0134('0xd')]){logger['error'](_0x0134('0xe'),_0x1661a2,_[_0x0134('0xf')](_0x57b5b9,_0x0134('0x10'))[_0x0134('0x11')](',\x20'));_0x479aa5['stop']();}else{try{var _0xa48f2d=eval('('+_0xf4ce68['condition']+')');var _0x4f52f8=_0xa48f2d?_0xf4ce68['priorityTrue']:_0xf4ce68[_0x0134('0x12')];logger[_0x0134('0x13')](_0x0134('0x14'),_0x1661a2,_0xf4ce68[_0x0134('0x15')],_0xa48f2d,_0x4f52f8||_0x0134('0x16'));if(_0x4f52f8){var _0x16c801=_[_0x0134('0x17')](_0x479aa5[_0x0134('0x18')](),{'p':_0x4f52f8});if(_0x16c801>=0x0){logger[_0x0134('0x13')](_0x0134('0x19'),_0x1661a2,_0x4f52f8||_0x0134('0x16'),_0x16c801);_0x479aa5[_0x0134('0x16')](_0x16c801);}else{logger[_0x0134('0x13')](_0x0134('0x1a'),_0x1661a2,_0x4f52f8||_0x0134('0x16'));_0x479aa5[_0x0134('0x1b')]();}}else{_0x479aa5[_0x0134('0x16')]();}}catch(_0x1987df){logger[_0x0134('0x1c')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x1661a2,_0x1987df[_0x0134('0x10')]);_0x479aa5[_0x0134('0x1b')]();}}}catch(_0x31f083){logger[_0x0134('0x1c')](_0x0134('0xe'),_0x1661a2,JSON['stringify'](_0x31f083));_0x479aa5[_0x0134('0x1b')]();}};}; \ No newline at end of file +var _0x65f6=['lodash','html-to-text','./utils','../../../../config/logger','routing','string','priority\x20true\x20is\x20a\x20number','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','replace','length','[%s][GOTOIF]\x20%s','message','condition','priorityFalse','info','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','error','stringify','validate'];(function(_0x26da89,_0x264785){var _0xc95b7b=function(_0x230e5b){while(--_0x230e5b){_0x26da89['push'](_0x26da89['shift']());}};_0xc95b7b(++_0x264785);}(_0x65f6,0x11d));var _0x665f=function(_0x4227e8,_0x4103e1){_0x4227e8=_0x4227e8-0x0;var _0x47ebe7=_0x65f6[_0x4227e8];return _0x47ebe7;};'use strict';var schema=require(_0x665f('0x0'));var _=require(_0x665f('0x1'));var htmlToText=require(_0x665f('0x2'));var utils=require(_0x665f('0x3'));var logger=require(_0x665f('0x4'))(_0x665f('0x5'));var gotoif=schema({'condition':{'type':_0x665f('0x6'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':'number','message':_0x665f('0x7')},'priorityFalse':{'type':_0x665f('0x8'),'message':_0x665f('0x9')}});exports[_0x665f('0xa')]=function(_0x56c7ec,_0x1302e3){return function(_0x1d8e4f){try{var _0x7faa8a={'condition':htmlToText[_0x665f('0xb')](utils['getMustacheRender'](_0x1302e3[0x0],this),{'wordwrap':![]})[_0x665f('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x1302e3[0x1],'priorityFalse':_0x1302e3[0x2]};var _0x29b9d7=gotoif['validate'](_0x7faa8a,{'typecast':!![]});if(_0x29b9d7[_0x665f('0xd')]){logger['error'](_0x665f('0xe'),_0x56c7ec,_['map'](_0x29b9d7,_0x665f('0xf'))['join'](',\x20'));_0x1d8e4f['stop']();}else{try{var _0x284767=eval('('+_0x7faa8a[_0x665f('0x10')]+')');var _0x43bd9a=_0x284767?_0x7faa8a['priorityTrue']:_0x7faa8a[_0x665f('0x11')];logger[_0x665f('0x12')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x56c7ec,_0x7faa8a[_0x665f('0x10')],_0x284767,_0x43bd9a||_0x665f('0x13'));if(_0x43bd9a){var _0x148311=_[_0x665f('0x14')](_0x1d8e4f['rules'](),{'p':_0x43bd9a});if(_0x148311>=0x0){logger[_0x665f('0x12')](_0x665f('0x15'),_0x56c7ec,_0x43bd9a||_0x665f('0x13'),_0x148311);_0x1d8e4f[_0x665f('0x13')](_0x148311);}else{logger[_0x665f('0x12')](_0x665f('0x16'),_0x56c7ec,_0x43bd9a||'next');_0x1d8e4f[_0x665f('0x17')]();}}else{_0x1d8e4f[_0x665f('0x13')]();}}catch(_0x434199){logger[_0x665f('0x18')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x56c7ec,_0x434199['message']);_0x1d8e4f['stop']();}}}catch(_0x11da2d){logger[_0x665f('0x18')](_0x665f('0xe'),_0x56c7ec,JSON[_0x665f('0x19')](_0x11da2d));_0x1d8e4f['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 35538eb..dabafd3 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 _0x7cfe=['rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','[%s][GOTOP]\x20%s','stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','error','map','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x7cfe,0xf6));var _0xe7cf=function(_0x1e3dff,_0x5ae87e){_0x1e3dff=_0x1e3dff-0x0;var _0x5c0953=_0x7cfe[_0x1e3dff];return _0x5c0953;};'use strict';var schema=require(_0xe7cf('0x0'));var _=require(_0xe7cf('0x1'));var logger=require(_0xe7cf('0x2'))(_0xe7cf('0x3'));var gotop=schema({'priority':{'type':_0xe7cf('0x4'),'required':!![],'message':_0xe7cf('0x5')}});exports[_0xe7cf('0x6')]=function(_0x26d922,_0x2956a8){return function(_0x54cc39){try{var _0x1ffdb6={'priority':_0x2956a8[0x0]};var _0x2bfdac=gotop[_0xe7cf('0x0')](_0x1ffdb6,{'typecast':!![]});if(_0x2bfdac['length']){logger[_0xe7cf('0x7')]('[%s][GOTOP]\x20%s',_0x26d922,_[_0xe7cf('0x8')](_0x2bfdac,'message')[_0xe7cf('0x9')](',\x20'));_0x54cc39[_0xe7cf('0xa')]();}else{logger[_0xe7cf('0xb')](_0xe7cf('0xc'),_0x26d922,_0x1ffdb6['priority']);if(_0x1ffdb6[_0xe7cf('0xd')]){var _0x43fa00=_['findIndex'](_0x54cc39[_0xe7cf('0xe')](),{'p':_0x1ffdb6[_0xe7cf('0xd')]});if(_0x43fa00>=0x0){logger['info'](_0xe7cf('0xf'),_0x26d922,_0x1ffdb6[_0xe7cf('0xd')]||_0xe7cf('0x10'),_0x43fa00);_0x54cc39[_0xe7cf('0x10')](_0x43fa00);}else{logger['info'](_0xe7cf('0x11'),_0x26d922,_0x1ffdb6[_0xe7cf('0xd')]||_0xe7cf('0x10'));_0x54cc39[_0xe7cf('0xa')]();}}else{_0x54cc39[_0xe7cf('0x10')]();}}}catch(_0x567d70){logger['error'](_0xe7cf('0x12'),_0x26d922,JSON[_0xe7cf('0x13')](_0x567d70));_0x54cc39[_0xe7cf('0xa')]();}};}; \ No newline at end of file +var _0x9f69=['priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stringify','validate','../../../../config/logger','routing','number','consequence','error','[%s][GOTOP]\x20%s','map','message','stop','info'];(function(_0x2e04ef,_0x31a596){var _0x5722b0=function(_0x386fbd){while(--_0x386fbd){_0x2e04ef['push'](_0x2e04ef['shift']());}};_0x5722b0(++_0x31a596);}(_0x9f69,0xd2));var _0x99f6=function(_0x55e111,_0x391f5a){_0x55e111=_0x55e111-0x0;var _0x30d69c=_0x9f69[_0x55e111];return _0x30d69c;};'use strict';var schema=require(_0x99f6('0x0'));var _=require('lodash');var logger=require(_0x99f6('0x1'))(_0x99f6('0x2'));var gotop=schema({'priority':{'type':_0x99f6('0x3'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x99f6('0x4')]=function(_0xeeda17,_0x34587d){return function(_0x27b70d){try{var _0x3ebfd7={'priority':_0x34587d[0x0]};var _0x13848f=gotop[_0x99f6('0x0')](_0x3ebfd7,{'typecast':!![]});if(_0x13848f['length']){logger[_0x99f6('0x5')](_0x99f6('0x6'),_0xeeda17,_[_0x99f6('0x7')](_0x13848f,_0x99f6('0x8'))['join'](',\x20'));_0x27b70d[_0x99f6('0x9')]();}else{logger[_0x99f6('0xa')]('[%s][GOTOP]\x20priority\x20%s',_0xeeda17,_0x3ebfd7[_0x99f6('0xb')]);if(_0x3ebfd7[_0x99f6('0xb')]){var _0x3a9ccb=_[_0x99f6('0xc')](_0x27b70d[_0x99f6('0xd')](),{'p':_0x3ebfd7[_0x99f6('0xb')]});if(_0x3a9ccb>=0x0){logger['info'](_0x99f6('0xe'),_0xeeda17,_0x3ebfd7['priority']||_0x99f6('0xf'),_0x3a9ccb);_0x27b70d[_0x99f6('0xf')](_0x3a9ccb);}else{logger[_0x99f6('0xa')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0xeeda17,_0x3ebfd7[_0x99f6('0xb')]||_0x99f6('0xf'));_0x27b70d['stop']();}}else{_0x27b70d['next']();}}}catch(_0x117199){logger['error'](_0x99f6('0x6'),_0xeeda17,JSON[_0x99f6('0x10')](_0x117199));_0x27b70d[_0x99f6('0x9')]();}};}; \ 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 92f871e..b3546ab 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 _0xe14a=['upperFirst','channel','InteractionId','interaction','Message','create','info','body','next','catch','error','[%s][MESSAGE]\x20%s','stop','stringify','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','consequence','getMustacheRender','contact','ChatWebsiteId','account'];(function(_0x23b3e0,_0x802d57){var _0x122558=function(_0x30e430){while(--_0x30e430){_0x23b3e0['push'](_0x23b3e0['shift']());}};_0x122558(++_0x802d57);}(_0xe14a,0x1f4));var _0xae14=function(_0x360bac,_0x4a1e91){_0x360bac=_0x360bac-0x0;var _0x56acef=_0xe14a[_0x360bac];return _0x56acef;};'use strict';var _=require(_0xae14('0x0'));var utils=require(_0xae14('0x1'));var logger=require(_0xae14('0x2'))(_0xae14('0x3'));var rpc={'chatMessage':require(_0xae14('0x4')),'openchannelMessage':require(_0xae14('0x5')),'mailMessage':require(_0xae14('0x6')),'smsMessage':require(_0xae14('0x7')),'faxMessage':require('../../rpc/faxMessage')};exports[_0xae14('0x8')]=function(_0x91e580,_0x1d3482){return function(_0x4718b4){try{var _0x31437f={'body':utils[_0xae14('0x9')](_0x1d3482[0x0],this),'ContactId':this[_0xae14('0xa')]['id']};if(this['channel']==='chat'){_0x31437f[_0xae14('0xb')]=this[_0xae14('0xc')]['id'];}else{_0x31437f[_[_0xae14('0xd')](this[_0xae14('0xe')])+'AccountId']=this[_0xae14('0xc')]['id'];}_0x31437f[_[_0xae14('0xd')](this['channel'])+_0xae14('0xf')]=this[_0xae14('0x10')]['id'];if(rpc[this['channel']+_0xae14('0x11')]){return rpc[this[_0xae14('0xe')]+_0xae14('0x11')][_0xae14('0x12')](_0x31437f)['then'](function(_0x822899){logger[_0xae14('0x13')]('[%s][MESSAGE]\x20%s',_0x91e580,_0x31437f[_0xae14('0x14')]);_0x4718b4[_0xae14('0x15')]();})[_0xae14('0x16')](function(_0x2c1948){logger[_0xae14('0x17')](_0xae14('0x18'),_0x91e580,JSON['stringify'](_0x2c1948));_0x4718b4[_0xae14('0x19')]();});}}catch(_0xaca8f4){logger[_0xae14('0x17')](_0xae14('0x18'),_0x91e580,JSON[_0xae14('0x1a')](_0xaca8f4));_0x4718b4[_0xae14('0x19')]();}};}; \ No newline at end of file +var _0xd111=['../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','upperFirst','AccountId','account','interaction','create','body','next','catch','error','[%s][MESSAGE]\x20%s','stringify','stop','lodash','./utils'];(function(_0x3d2154,_0x66516f){var _0x3336f5=function(_0x100f35){while(--_0x100f35){_0x3d2154['push'](_0x3d2154['shift']());}};_0x3336f5(++_0x66516f);}(_0xd111,0x1c6));var _0x1d11=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd111[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1d11('0x0'));var utils=require(_0x1d11('0x1'));var logger=require(_0x1d11('0x2'))('routing');var rpc={'chatMessage':require(_0x1d11('0x3')),'openchannelMessage':require(_0x1d11('0x4')),'mailMessage':require(_0x1d11('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage')};exports[_0x1d11('0x6')]=function(_0x27a041,_0x50c7b8){return function(_0x3acf2a){try{var _0x152fb5={'body':utils[_0x1d11('0x7')](_0x50c7b8[0x0],this),'ContactId':this[_0x1d11('0x8')]['id']};if(this[_0x1d11('0x9')]===_0x1d11('0xa')){_0x152fb5[_0x1d11('0xb')]=this['account']['id'];}else{_0x152fb5[_[_0x1d11('0xc')](this[_0x1d11('0x9')])+_0x1d11('0xd')]=this[_0x1d11('0xe')]['id'];}_0x152fb5[_['upperFirst'](this['channel'])+'InteractionId']=this[_0x1d11('0xf')]['id'];if(rpc[this['channel']+'Message']){return rpc[this[_0x1d11('0x9')]+'Message'][_0x1d11('0x10')](_0x152fb5)['then'](function(_0x24c9cd){logger['info']('[%s][MESSAGE]\x20%s',_0x27a041,_0x152fb5[_0x1d11('0x11')]);_0x3acf2a[_0x1d11('0x12')]();})[_0x1d11('0x13')](function(_0x192806){logger[_0x1d11('0x14')](_0x1d11('0x15'),_0x27a041,JSON[_0x1d11('0x16')](_0x192806));_0x3acf2a[_0x1d11('0x17')]();});}}catch(_0x57759b){logger[_0x1d11('0x14')](_0x1d11('0x15'),_0x27a041,JSON[_0x1d11('0x16')](_0x57759b));_0x3acf2a[_0x1d11('0x17')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 7264947..b604ce9 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 _0xe332=['[%s][NOOP]\x20%s','stringify','stop','./utils','routing','consequence','info','getMustacheRender','next','error'];(function(_0xa5a920,_0x2d8772){var _0x596618=function(_0x5eab42){while(--_0x5eab42){_0xa5a920['push'](_0xa5a920['shift']());}};_0x596618(++_0x2d8772);}(_0xe332,0x161));var _0x2e33=function(_0x380a86,_0xef3cd4){_0x380a86=_0x380a86-0x0;var _0x4d472a=_0xe332[_0x380a86];return _0x4d472a;};'use strict';var utils=require(_0x2e33('0x0'));var logger=require('../../../../config/logger')(_0x2e33('0x1'));exports[_0x2e33('0x2')]=function(_0x175d84,_0x8f1dc6){return function(_0x519e80){try{logger[_0x2e33('0x3')]('[%s][NOOP]\x20%s',_0x175d84,utils[_0x2e33('0x4')](_0x8f1dc6[0x0],this));_0x519e80[_0x2e33('0x5')]();}catch(_0x5d892f){logger[_0x2e33('0x6')](_0x2e33('0x7'),_0x175d84,JSON[_0x2e33('0x8')](_0x5d892f));_0x519e80[_0x2e33('0x9')]();}};}; \ No newline at end of file +var _0x06b6=['stop','./utils','../../../../config/logger','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify'];(function(_0x18c1e2,_0x5b4682){var _0x5ed93c=function(_0x248153){while(--_0x248153){_0x18c1e2['push'](_0x18c1e2['shift']());}};_0x5ed93c(++_0x5b4682);}(_0x06b6,0xe7));var _0x606b=function(_0x14f83c,_0x509c7c){_0x14f83c=_0x14f83c-0x0;var _0x2de6d1=_0x06b6[_0x14f83c];return _0x2de6d1;};'use strict';var utils=require(_0x606b('0x0'));var logger=require(_0x606b('0x1'))('routing');exports[_0x606b('0x2')]=function(_0x1edfec,_0x36d4fc){return function(_0x5012ba){try{logger[_0x606b('0x3')](_0x606b('0x4'),_0x1edfec,utils[_0x606b('0x5')](_0x36d4fc[0x0],this));_0x5012ba[_0x606b('0x6')]();}catch(_0x122c0e){logger[_0x606b('0x7')](_0x606b('0x4'),_0x1edfec,JSON[_0x606b('0x8')](_0x122c0e));_0x5012ba[_0x606b('0x9')]();}};}; \ 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 cae5d1e..1a9a323 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 _0x9bde=['lodash','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','clone','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','body','contact','list','channel','QueueId','upperFirst','interaction','MessageId','message','chat','AccountId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','[%s][STOP:QUEUE][NAME:%s]','update','catch','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','toLowerCase','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','timeout','createQueue','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','next','strategy','rrmemory','beepall','log','stack'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0x9bde,0xe1));var _0xe9bd=function(_0x4e7920,_0x38951b){_0x4e7920=_0x4e7920-0x0;var _0x3382f3=_0x9bde[_0x4e7920];return _0x3382f3;};'use strict';var schema=require('validate');var _=require(_0xe9bd('0x0'));var util=require('util');var seqqueue=require(_0xe9bd('0x1'));var moment=require('moment');var Redis=require(_0xe9bd('0x2'));var config=require(_0xe9bd('0x3'));var logger=require(_0xe9bd('0x4'))(_0xe9bd('0x5'));var strategy=require(_0xe9bd('0x6'));config[_0xe9bd('0x7')]=_[_0xe9bd('0x8')](config['redis'],{'host':_0xe9bd('0x9'),'port':0x18eb});var io=require(_0xe9bd('0xa'))(new Redis(config[_0xe9bd('0x7')]));var attributes=['id',_0xe9bd('0xb'),_0xe9bd('0xc'),_0xe9bd('0xd'),_0xe9bd('0xe'),_0xe9bd('0xf')];function emit(_0x439abc,_0x45c7ba,_0x581602){io['to'](_0x439abc)['emit'](_0x45c7ba,_0x581602);}function emitChannelQueueInteraction(_0x3c8e95,_0x145521,_0x2601ac,_0x581ab9,_0x12c96e,_0x9eca50,_0x3339f9,_0x141587){var _0x5e022a=_[_0xe9bd('0x10')](_0x2601ac);_0x5e022a['queue_id']=_0x141587;_0x5e022a[_0xe9bd('0xd')]=_0x145521;_0x5e022a[_0xe9bd('0xc')]=_0x581ab9;_0x5e022a['id']=_0x12c96e;if(_0x9eca50){_0x3339f9[util[_0xe9bd('0x11')]('%sQueuesWaitingInteractions',_0x3c8e95)][_0x12c96e]=_['pick'](_0x5e022a,attributes);}else{delete _0x3339f9[util[_0xe9bd('0x11')](_0xe9bd('0x12'),_0x3c8e95)][_0x12c96e];}emit(util[_0xe9bd('0x11')](_0xe9bd('0x13'),_0x3c8e95,_0x145521),util[_0xe9bd('0x11')](_0xe9bd('0x14'),_0x3c8e95,_0x9eca50?_0xe9bd('0x15'):'remove'),_[_0xe9bd('0x16')](_0x5e022a,attributes));}var rpc={'openchannelQueueReport':require(_0xe9bd('0x17')),'mailQueueReport':require(_0xe9bd('0x18')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0xe9bd('0x19')),'faxQueueReport':require(_0xe9bd('0x1a'))};var queue=schema({'name':{'type':_0xe9bd('0x1b'),'required':!![],'message':_0xe9bd('0x1c')},'timeout':{'type':'number','message':_0xe9bd('0x1d')}});function startRouting(_0x50a5e8,_0xc6b661,_0x55b869,_0x26aa4a){if(_0x50a5e8&&_0xc6b661&&_0x55b869){_0xc6b661[_0xe9bd('0x1e')]+=0x1;var _0x134c4e={'uniqueid':_0x50a5e8,'from':_0x55b869[_0xe9bd('0x1f')]?_0x55b869[_0xe9bd('0x1f')][_0xe9bd('0xe')]:'','joinAt':moment()[_0xe9bd('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x55b869[_0xe9bd('0x20')]?_0x55b869[_0xe9bd('0x20')]['id']:null,'ListId':_0x55b869['list']?_0x55b869[_0xe9bd('0x21')]['id']:null};_0x134c4e[_['upperFirst'](_0x55b869[_0xe9bd('0x22')])+_0xe9bd('0x23')]=_0xc6b661['id']||null;_0x134c4e[_[_0xe9bd('0x24')](_0x55b869[_0xe9bd('0x22')])+'InteractionId']=_0x55b869[_0xe9bd('0x25')]?_0x55b869[_0xe9bd('0x25')]['id']:null;_0x134c4e[_[_0xe9bd('0x24')](_0x55b869[_0xe9bd('0x22')])+_0xe9bd('0x26')]=_0x55b869[_0xe9bd('0x27')]?_0x55b869[_0xe9bd('0x27')]['id']:null;_0x134c4e[_[_0xe9bd('0x24')](_0x55b869[_0xe9bd('0x22')])+(_0x55b869['channel']!==_0xe9bd('0x28')?_0xe9bd('0x29'):'WebsiteId')]=_0x55b869[_0xe9bd('0xc')]?_0x55b869[_0xe9bd('0xc')]['id']:null;logger[_0xe9bd('0x2a')](util[_0xe9bd('0x11')](_0xe9bd('0x2b'),_0x50a5e8,_0xc6b661[_0xe9bd('0x2c')]));emitChannelQueueInteraction(_0x55b869['channel'],_0xc6b661['name'],_0x134c4e,_0x55b869[_0xe9bd('0xc')]['name'],_0x55b869[_0xe9bd('0x27')]['id'],!![],_0x26aa4a,_0xc6b661['id']);if(rpc[_0x55b869[_0xe9bd('0x22')]+_0xe9bd('0x2d')]){return rpc[_0x55b869[_0xe9bd('0x22')]+_0xe9bd('0x2d')]['create'](_0x134c4e)['catch'](function(_0x7f2c5){logger[_0xe9bd('0x2e')](_0xe9bd('0x2f'));});}}}function stopRouting(_0x3081f3,_0xe2436,_0x1f0f9e,_0x3c31ee){if(_0x3081f3&&_0xe2436){_0xe2436[_0xe9bd('0x1e')]-=0x1;var _0x45703e={'leaveAt':moment()['format'](_0xe9bd('0x30')),'acceptAt':moment()[_0xe9bd('0x11')](_0xe9bd('0x30')),'reason':'accepted'};logger['info'](util[_0xe9bd('0x11')](_0xe9bd('0x31'),_0x3081f3,_0xe2436[_0xe9bd('0x2c')]));emitChannelQueueInteraction(_0x1f0f9e[_0xe9bd('0x22')],_0xe2436[_0xe9bd('0x2c')],_0x1f0f9e[_0xe9bd('0x1f')],_0x1f0f9e[_0xe9bd('0xc')][_0xe9bd('0x2c')],_0x1f0f9e[_0xe9bd('0x27')]['id'],![],_0x3c31ee,_0xe2436['id']);if(rpc[_0x1f0f9e[_0xe9bd('0x22')]+_0xe9bd('0x2d')]){return rpc[_0x1f0f9e[_0xe9bd('0x22')]+_0xe9bd('0x2d')][_0xe9bd('0x32')](_0x3081f3,_0x45703e)[_0xe9bd('0x33')](function(_0x8ff624){logger[_0xe9bd('0x2e')](_0xe9bd('0x34'));});}}}function endRouting(_0x4c689d,_0x3f3cf5,_0x32e764,_0x56b4a5){if(_0x4c689d&&_0x3f3cf5){_0x3f3cf5[_0xe9bd('0x1e')]-=0x1;var _0x264c87={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0xe9bd('0x11')](_0xe9bd('0x30')),'reason':'timeout'};logger[_0xe9bd('0x2a')](util[_0xe9bd('0x11')](_0xe9bd('0x35'),_0x4c689d,_0x3f3cf5['name']));emitChannelQueueInteraction(_0x32e764[_0xe9bd('0x22')],_0x3f3cf5['name'],_0x32e764[_0xe9bd('0x1f')],_0x32e764[_0xe9bd('0xc')][_0xe9bd('0x2c')],_0x32e764[_0xe9bd('0x27')]['id'],![],_0x56b4a5);if(rpc[_0x32e764['channel']+_0xe9bd('0x2d')]){return rpc[_0x32e764[_0xe9bd('0x22')]+_0xe9bd('0x2d')][_0xe9bd('0x32')](_0x4c689d,_0x264c87)[_0xe9bd('0x33')](function(_0x1e061d){logger[_0xe9bd('0x2e')](_0xe9bd('0x34'));});}}}function handleFindQueue(_0x2b5a71){return function(_0x1d5d93){return _0x1d5d93['name']['toLowerCase']()===_0x2b5a71[_0xe9bd('0x36')]();};}exports['consequence']=function(_0x4608a0,_0x340819,_0x41881a,_0x480797){return function(_0x1ba613){try{var _0x2923cf={'name':_0x340819[0x0],'timeout':_0x340819[0x1]};var _0x1a2d94=queue['validate'](_0x2923cf,{'typecast':!![]});if(_0x1a2d94[_0xe9bd('0x37')]){logger[_0xe9bd('0x2e')](_0xe9bd('0x38'),_0x4608a0,_[_0xe9bd('0x39')](_0x1a2d94,_0xe9bd('0x27'))[_0xe9bd('0x3a')](',\x20'));_0x1ba613[_0xe9bd('0x3b')]();}else{var _0x3c4482=_[_0xe9bd('0x3c')](_0x41881a[_0x480797[_0xe9bd('0x22')]+_0xe9bd('0x3d')],handleFindQueue(_0x2923cf[_0xe9bd('0x2c')]));if(_0x3c4482){startRouting(_0x4608a0,_0x3c4482,_0x480797,_0x41881a);var _0x2d4e62=(_0x3c4482[_0xe9bd('0x3e')]||0xa)*0x3e8;var _0x41da6e=(_0x2923cf['timeout']||0x14)*0x3e8;var _0x5a86fd,_0x283e67;if(_0x2d4e62>_0x41da6e){_0x41da6e=_0x2d4e62;}var _0x2ced7c=seqqueue[_0xe9bd('0x3f')](_0x2d4e62);_0x2ced7c['id']=_0x4608a0;_0x2ced7c['atimeout']=_0x2d4e62;_0x2ced7c['qtimeout']=_0x41da6e;_0x2ced7c[_0xe9bd('0x22')]=_0x480797[_0xe9bd('0x22')];_0x41881a[_0xe9bd('0x40')][_0x4608a0]['on'](_0xe9bd('0x41'),function(){logger[_0xe9bd('0x2a')](_0xe9bd('0x42'),_0x4608a0);stopRouting(_0x4608a0,_0x3c4482,_0x480797,_0x41881a);clearTimeout(_0x5a86fd);_0x5a86fd=undefined;_0x2ced7c[_0xe9bd('0x43')](!![]);if(_0x41881a['rules'][_0x4608a0]){delete _0x41881a[_0xe9bd('0x40')][_0x4608a0];}_0x1ba613['stop']();});_0x41881a[_0xe9bd('0x40')][_0x4608a0]['on'](_0xe9bd('0x44'),function(){if(_0x41881a[_0xe9bd('0x40')][_0x4608a0]){delete _0x41881a[_0xe9bd('0x40')][_0x4608a0];}});_0x5a86fd=setTimeout(function(){logger[_0xe9bd('0x2a')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x4608a0);endRouting(_0x4608a0,_0x3c4482,_0x480797,_0x41881a);clearTimeout(_0x5a86fd);_0x2ced7c[_0xe9bd('0x43')](!![]);_0x1ba613[_0xe9bd('0x45')]();},_0x41da6e);switch(_0x3c4482[_0xe9bd('0x46')]){case'rrmemory':strategy[_0xe9bd('0x47')](_0x2ced7c,_0x3c4482,_0x41881a,_0x480797);break;default:strategy[_0xe9bd('0x48')](_0x2ced7c,_0x3c4482,_0x41881a,_0x480797);}}else{logger[_0xe9bd('0x2e')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x4608a0,_0x2923cf[_0xe9bd('0x2c')]);_0x1ba613[_0xe9bd('0x3b')]();}}}catch(_0x2e634d){console[_0xe9bd('0x49')](_0x2e634d);logger[_0xe9bd('0x2e')]('[%s][QUEUE]\x20%s',_0x4608a0,_0x2e634d[_0xe9bd('0x4a')]);_0x1ba613['stop']();}};}; \ No newline at end of file +var _0x878f=['interaction','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','create','create\x20queue\x20report','waiting','accepted','[%s][STOP:QUEUE][NAME:%s]','QueueReport','catch','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','validate','length','error','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','socket.io-emitter','from','emit','queue_id','queue','account','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId'];(function(_0x1d89cf,_0x4aa07c){var _0x4f0adf=function(_0x1cc4d8){while(--_0x1cc4d8){_0x1d89cf['push'](_0x1d89cf['shift']());}};_0x4f0adf(++_0x4aa07c);}(_0x878f,0x173));var _0xf878=function(_0x3ddf3f,_0xfc9c8a){_0x3ddf3f=_0x3ddf3f-0x0;var _0x45ecc7=_0x878f[_0x3ddf3f];return _0x45ecc7;};'use strict';var schema=require('validate');var _=require(_0xf878('0x0'));var util=require(_0xf878('0x1'));var seqqueue=require(_0xf878('0x2'));var moment=require(_0xf878('0x3'));var Redis=require(_0xf878('0x4'));var config=require(_0xf878('0x5'));var logger=require(_0xf878('0x6'))(_0xf878('0x7'));var strategy=require(_0xf878('0x8'));config[_0xf878('0x9')]=_[_0xf878('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xf878('0xb'))(new Redis(config[_0xf878('0x9')]));var attributes=['id','queue_id','account','queue',_0xf878('0xc'),'joinAt'];function emit(_0x4a9d79,_0x307653,_0x2e6931){io['to'](_0x4a9d79)[_0xf878('0xd')](_0x307653,_0x2e6931);}function emitChannelQueueInteraction(_0x52edde,_0xb2863e,_0x1399a3,_0x531b9c,_0xdf76,_0x4f7e7f,_0x31d3d2,_0x97c396){var _0x339c9c=_['clone'](_0x1399a3);_0x339c9c[_0xf878('0xe')]=_0x97c396;_0x339c9c[_0xf878('0xf')]=_0xb2863e;_0x339c9c[_0xf878('0x10')]=_0x531b9c;_0x339c9c['id']=_0xdf76;if(_0x4f7e7f){_0x31d3d2[util['format'](_0xf878('0x11'),_0x52edde)][_0xdf76]=_[_0xf878('0x12')](_0x339c9c,attributes);}else{delete _0x31d3d2[util[_0xf878('0x13')]('%sQueuesWaitingInteractions',_0x52edde)][_0xdf76];}emit(util['format'](_0xf878('0x14'),_0x52edde,_0xb2863e),util[_0xf878('0x13')](_0xf878('0x15'),_0x52edde,_0x4f7e7f?_0xf878('0x16'):_0xf878('0x17')),_[_0xf878('0x12')](_0x339c9c,attributes));}var rpc={'openchannelQueueReport':require(_0xf878('0x18')),'mailQueueReport':require(_0xf878('0x19')),'chatQueueReport':require(_0xf878('0x1a')),'smsQueueReport':require(_0xf878('0x1b')),'faxQueueReport':require(_0xf878('0x1c'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0xf878('0x1d')},'timeout':{'type':_0xf878('0x1e'),'message':_0xf878('0x1f')}});function startRouting(_0x622ea8,_0x3714f6,_0x237d15,_0x17089c){if(_0x622ea8&&_0x3714f6&&_0x237d15){_0x3714f6['waiting']+=0x1;var _0x73f6bf={'uniqueid':_0x622ea8,'from':_0x237d15[_0xf878('0x20')]?_0x237d15[_0xf878('0x20')]['from']:'','joinAt':moment()[_0xf878('0x13')](_0xf878('0x21')),'ContactId':_0x237d15[_0xf878('0x22')]?_0x237d15[_0xf878('0x22')]['id']:null,'ListId':_0x237d15[_0xf878('0x23')]?_0x237d15[_0xf878('0x23')]['id']:null};_0x73f6bf[_[_0xf878('0x24')](_0x237d15[_0xf878('0x25')])+_0xf878('0x26')]=_0x3714f6['id']||null;_0x73f6bf[_[_0xf878('0x24')](_0x237d15[_0xf878('0x25')])+'InteractionId']=_0x237d15[_0xf878('0x27')]?_0x237d15['interaction']['id']:null;_0x73f6bf[_[_0xf878('0x24')](_0x237d15[_0xf878('0x25')])+_0xf878('0x28')]=_0x237d15[_0xf878('0x29')]?_0x237d15[_0xf878('0x29')]['id']:null;_0x73f6bf[_['upperFirst'](_0x237d15['channel'])+(_0x237d15['channel']!==_0xf878('0x2a')?_0xf878('0x2b'):_0xf878('0x2c'))]=_0x237d15['account']?_0x237d15[_0xf878('0x10')]['id']:null;logger[_0xf878('0x2d')](util[_0xf878('0x13')](_0xf878('0x2e'),_0x622ea8,_0x3714f6[_0xf878('0x2f')]));emitChannelQueueInteraction(_0x237d15['channel'],_0x3714f6['name'],_0x73f6bf,_0x237d15[_0xf878('0x10')][_0xf878('0x2f')],_0x237d15['message']['id'],!![],_0x17089c,_0x3714f6['id']);if(rpc[_0x237d15[_0xf878('0x25')]+'QueueReport']){return rpc[_0x237d15[_0xf878('0x25')]+'QueueReport'][_0xf878('0x30')](_0x73f6bf)['catch'](function(_0x2630fb){logger['error'](_0xf878('0x31'));});}}}function stopRouting(_0x2cadd3,_0x233a00,_0x1f5331,_0x27c53b){if(_0x2cadd3&&_0x233a00){_0x233a00[_0xf878('0x32')]-=0x1;var _0x5aed48={'leaveAt':moment()[_0xf878('0x13')](_0xf878('0x21')),'acceptAt':moment()[_0xf878('0x13')](_0xf878('0x21')),'reason':_0xf878('0x33')};logger['info'](util[_0xf878('0x13')](_0xf878('0x34'),_0x2cadd3,_0x233a00['name']));emitChannelQueueInteraction(_0x1f5331[_0xf878('0x25')],_0x233a00[_0xf878('0x2f')],_0x1f5331[_0xf878('0x20')],_0x1f5331[_0xf878('0x10')][_0xf878('0x2f')],_0x1f5331['message']['id'],![],_0x27c53b,_0x233a00['id']);if(rpc[_0x1f5331[_0xf878('0x25')]+_0xf878('0x35')]){return rpc[_0x1f5331[_0xf878('0x25')]+_0xf878('0x35')]['update'](_0x2cadd3,_0x5aed48)[_0xf878('0x36')](function(_0x5a6330){logger['error'](_0xf878('0x37'));});}}}function endRouting(_0x2c628e,_0x8b6230,_0x105416,_0x20f415){if(_0x2c628e&&_0x8b6230){_0x8b6230['waiting']-=0x1;var _0xc2d7ef={'leaveAt':moment()['format'](_0xf878('0x21')),'exitAt':moment()[_0xf878('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xf878('0x38')};logger[_0xf878('0x2d')](util['format'](_0xf878('0x39'),_0x2c628e,_0x8b6230[_0xf878('0x2f')]));emitChannelQueueInteraction(_0x105416['channel'],_0x8b6230[_0xf878('0x2f')],_0x105416[_0xf878('0x20')],_0x105416[_0xf878('0x10')][_0xf878('0x2f')],_0x105416[_0xf878('0x29')]['id'],![],_0x20f415);if(rpc[_0x105416[_0xf878('0x25')]+_0xf878('0x35')]){return rpc[_0x105416['channel']+_0xf878('0x35')][_0xf878('0x3a')](_0x2c628e,_0xc2d7ef)['catch'](function(_0x226e8b){logger['error']('update\x20queue\x20report');});}}}function handleFindQueue(_0x2ec109){return function(_0x379fc1){return _0x379fc1[_0xf878('0x2f')][_0xf878('0x3b')]()===_0x2ec109[_0xf878('0x3b')]();};}exports['consequence']=function(_0x3629c3,_0x4c4ae4,_0xb09736,_0x2801b0){return function(_0x4f6be1){try{var _0x5517c9={'name':_0x4c4ae4[0x0],'timeout':_0x4c4ae4[0x1]};var _0x180594=queue[_0xf878('0x3c')](_0x5517c9,{'typecast':!![]});if(_0x180594[_0xf878('0x3d')]){logger[_0xf878('0x3e')](_0xf878('0x3f'),_0x3629c3,_[_0xf878('0x40')](_0x180594,_0xf878('0x29'))[_0xf878('0x41')](',\x20'));_0x4f6be1[_0xf878('0x42')]();}else{var _0x5444eb=_[_0xf878('0x43')](_0xb09736[_0x2801b0[_0xf878('0x25')]+_0xf878('0x44')],handleFindQueue(_0x5517c9[_0xf878('0x2f')]));if(_0x5444eb){startRouting(_0x3629c3,_0x5444eb,_0x2801b0,_0xb09736);var _0x3714a6=(_0x5444eb[_0xf878('0x38')]||0xa)*0x3e8;var _0x47dbfa=(_0x5517c9[_0xf878('0x38')]||0x14)*0x3e8;var _0xf055ce,_0x1f57d0;if(_0x3714a6>_0x47dbfa){_0x47dbfa=_0x3714a6;}var _0xc49e70=seqqueue[_0xf878('0x45')](_0x3714a6);_0xc49e70['id']=_0x3629c3;_0xc49e70['atimeout']=_0x3714a6;_0xc49e70[_0xf878('0x46')]=_0x47dbfa;_0xc49e70[_0xf878('0x25')]=_0x2801b0[_0xf878('0x25')];_0xb09736[_0xf878('0x47')][_0x3629c3]['on']('end',function(){logger[_0xf878('0x2d')](_0xf878('0x48'),_0x3629c3);stopRouting(_0x3629c3,_0x5444eb,_0x2801b0,_0xb09736);clearTimeout(_0xf055ce);_0xf055ce=undefined;_0xc49e70[_0xf878('0x49')](!![]);if(_0xb09736['rules'][_0x3629c3]){delete _0xb09736['rules'][_0x3629c3];}_0x4f6be1[_0xf878('0x42')]();});_0xb09736['rules'][_0x3629c3]['on']('complete',function(){if(_0xb09736['rules'][_0x3629c3]){delete _0xb09736[_0xf878('0x47')][_0x3629c3];}});_0xf055ce=setTimeout(function(){logger['info'](_0xf878('0x4a'),_0x3629c3);endRouting(_0x3629c3,_0x5444eb,_0x2801b0,_0xb09736);clearTimeout(_0xf055ce);_0xc49e70[_0xf878('0x49')](!![]);_0x4f6be1[_0xf878('0x4b')]();},_0x47dbfa);switch(_0x5444eb[_0xf878('0x4c')]){case _0xf878('0x4d'):strategy[_0xf878('0x4d')](_0xc49e70,_0x5444eb,_0xb09736,_0x2801b0);break;default:strategy[_0xf878('0x4e')](_0xc49e70,_0x5444eb,_0xb09736,_0x2801b0);}}else{logger['error'](_0xf878('0x4f'),_0x3629c3,_0x5517c9[_0xf878('0x2f')]);_0x4f6be1[_0xf878('0x42')]();}}}catch(_0x227dd7){console[_0xf878('0x50')](_0x227dd7);logger['error']('[%s][QUEUE]\x20%s',_0x3629c3,_0x227dd7[_0xf878('0x51')]);_0x4f6be1[_0xf878('0x42')]();}};}; \ 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 1427897..fb7c1d3 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 _0xc66a=['drained','prototype','handleRun','info','[%s][AGENT]\x20try\x20with\x20%s','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busyQueue','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','busy','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','bind','handleTimeout','timeout'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xc66a,0x197));var _0xac66=function(_0x4725e1,_0x1a1442){_0x4725e1=_0x4725e1-0x0;var _0x1a717b=_0xc66a[_0x4725e1];return _0x1a717b;};'use strict';var _=require(_0xac66('0x0'));var uuid=require(_0xac66('0x1'));var util=require(_0xac66('0x2'));var logger=require(_0xac66('0x3'))(_0xac66('0x4'));var Agent=function(_0x18fbe8,_0x4c1699,_0x5cdce8,_0xfbd33e){this[_0xac66('0x5')]=uuid['v4']();this[_0xac66('0x6')]=_0x18fbe8;this[_0xac66('0x7')]=_0x4c1699;this[_0xac66('0x8')]=_0x5cdce8;this[_0xac66('0x4')]=_0xfbd33e;this[_0xac66('0x6')][_0xac66('0x9')](this['handleRun'][_0xac66('0xa')](this),this[_0xac66('0xb')]['bind'](this));this[_0xac66('0x6')]['on'](_0xac66('0xc'),this[_0xac66('0xb')][_0xac66('0xa')](this));this[_0xac66('0x6')]['on'](_0xac66('0xd'),this['handleDrained'][_0xac66('0xa')](this));};Agent[_0xac66('0xe')][_0xac66('0x9')]=function(){this[_0xac66('0x6')][_0xac66('0x9')](this[_0xac66('0xf')]['bind'](this),this[_0xac66('0xb')]['bind'](this));};Agent[_0xac66('0xe')]['handleDrained']=function(){this['handleTimeout'](!![]);};Agent[_0xac66('0xe')][_0xac66('0xf')]=function(_0x21b5ed){logger[_0xac66('0x10')](_0xac66('0x11'),this['squeue']['id'],this[_0xac66('0x7')]['id']);if(_['isNil'](this['realtime'][_0xac66('0x12')][this[_0xac66('0x7')]['id']])){logger[_0xac66('0x10')](_0xac66('0x13'),this[_0xac66('0x6')]['id'],this[_0xac66('0x7')]['id']);setTimeout(this['push'][_0xac66('0xa')](this),0x3e8);}else{if(this[_0xac66('0x4')][_0xac66('0x14')]||util[_0xac66('0x15')](this[_0xac66('0x6')]['id'],this['realtime'][_0xac66('0x12')][this['agent']['id']],this[_0xac66('0x6')][_0xac66('0x16')],![])){this[_0xac66('0x8')][_0xac66('0x12')][this[_0xac66('0x7')]['id']]['busy']=!![];this['realtime'][_0xac66('0x12')][this['agent']['id']][_0xac66('0x17')]=undefined;util[_0xac66('0x18')](this[_0xac66('0x5')],this[_0xac66('0x6')]['id'],this[_0xac66('0x8')]['agents'][this[_0xac66('0x7')]['id']],null,this[_0xac66('0x4')]);util[_0xac66('0x19')](this[_0xac66('0x6')]['id'],this[_0xac66('0x8')][_0xac66('0x12')][this[_0xac66('0x7')]['id']],_0xac66('0x1a')+(this[_0xac66('0x4')][_0xac66('0x14')]?_0xac66('0x1b'):''));}else{logger[_0xac66('0x10')](_0xac66('0x1c'),this[_0xac66('0x6')]['id'],this[_0xac66('0x7')]['id']);setTimeout(this[_0xac66('0x9')][_0xac66('0xa')](this),0x3e8);}}};Agent[_0xac66('0xe')][_0xac66('0xb')]=function(_0x4bd94f){if(_[_0xac66('0x1d')](this[_0xac66('0x8')]['agents'][this[_0xac66('0x7')]['id']])){return logger['info']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xac66('0x6')]['id'],this[_0xac66('0x7')]['id']);}else{logger['info'](_0xac66('0x1e'),this['squeue']['id'],this['agent']['id']);util['hideNotification'](this['notificationId'],this[_0xac66('0x6')]['id'],this['realtime'][_0xac66('0x12')][this['agent']['id']],null,this[_0xac66('0x4')]);this[_0xac66('0x8')][_0xac66('0x12')][this[_0xac66('0x7')]['id']][_0xac66('0x1f')]=![];this[_0xac66('0x8')]['agents'][this[_0xac66('0x7')]['id']][_0xac66('0x17')]=undefined;util[_0xac66('0x19')](this['squeue']['id'],this['realtime'][_0xac66('0x12')][this[_0xac66('0x7')]['id']],_0x4bd94f?_0xac66('0x20'):_0xac66('0x21'));}if(!_0x4bd94f){setTimeout(this[_0xac66('0x9')]['bind'](this),0x3e8);}};function agent(_0x2dbbc9,_0x1226e8,_0x2e6b4c,_0x3d4f59){return new Agent(_0x2dbbc9,_0x1226e8,_0x2e6b4c,_0x3d4f59);}module[_0xac66('0x22')]=agent; \ No newline at end of file +var _0x68ef=['[%s][AGENT]\x20timeout\x20with\x20%s','STOP','exports','lodash','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','handleTimeout','bind','timeout','drained','prototype','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','info','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','busy','busyQueue','writeLog','RINGING','forcedOwnership',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available'];(function(_0xe30235,_0x21f212){var _0x11da7f=function(_0x5e88f6){while(--_0x5e88f6){_0xe30235['push'](_0xe30235['shift']());}};_0x11da7f(++_0x21f212);}(_0x68ef,0x196));var _0xf68e=function(_0x190c5b,_0x50e7c1){_0x190c5b=_0x190c5b-0x0;var _0x1ef1bb=_0x68ef[_0x190c5b];return _0x1ef1bb;};'use strict';var _=require(_0xf68e('0x0'));var uuid=require('uuid');var util=require(_0xf68e('0x1'));var logger=require(_0xf68e('0x2'))(_0xf68e('0x3'));var Agent=function(_0x4e8672,_0x1d2af0,_0x352711,_0x44d760){this[_0xf68e('0x4')]=uuid['v4']();this[_0xf68e('0x5')]=_0x4e8672;this[_0xf68e('0x6')]=_0x1d2af0;this[_0xf68e('0x7')]=_0x352711;this[_0xf68e('0x3')]=_0x44d760;this[_0xf68e('0x5')][_0xf68e('0x8')](this[_0xf68e('0x9')]['bind'](this),this[_0xf68e('0xa')][_0xf68e('0xb')](this));this['squeue']['on'](_0xf68e('0xc'),this[_0xf68e('0xa')][_0xf68e('0xb')](this));this[_0xf68e('0x5')]['on'](_0xf68e('0xd'),this['handleDrained'][_0xf68e('0xb')](this));};Agent[_0xf68e('0xe')][_0xf68e('0x8')]=function(){this['squeue'][_0xf68e('0x8')](this['handleRun']['bind'](this),this[_0xf68e('0xa')][_0xf68e('0xb')](this));};Agent[_0xf68e('0xe')]['handleDrained']=function(){this[_0xf68e('0xa')](!![]);};Agent[_0xf68e('0xe')][_0xf68e('0x9')]=function(_0x5b6d57){logger['info'](_0xf68e('0xf'),this['squeue']['id'],this['agent']['id']);if(_[_0xf68e('0x10')](this[_0xf68e('0x7')][_0xf68e('0x11')][this[_0xf68e('0x6')]['id']])){logger[_0xf68e('0x12')](_0xf68e('0x13'),this[_0xf68e('0x5')]['id'],this['agent']['id']);setTimeout(this[_0xf68e('0x8')]['bind'](this),0x3e8);}else{if(this[_0xf68e('0x3')]['forcedOwnership']||util['isAgentAvailable'](this['squeue']['id'],this[_0xf68e('0x7')]['agents'][this['agent']['id']],this[_0xf68e('0x5')][_0xf68e('0x14')],![])){this[_0xf68e('0x7')][_0xf68e('0x11')][this[_0xf68e('0x6')]['id']][_0xf68e('0x15')]=!![];this[_0xf68e('0x7')][_0xf68e('0x11')][this[_0xf68e('0x6')]['id']][_0xf68e('0x16')]=undefined;util['showNotification'](this[_0xf68e('0x4')],this[_0xf68e('0x5')]['id'],this[_0xf68e('0x7')][_0xf68e('0x11')][this[_0xf68e('0x6')]['id']],null,this['routing']);util[_0xf68e('0x17')](this['squeue']['id'],this[_0xf68e('0x7')][_0xf68e('0x11')][this[_0xf68e('0x6')]['id']],_0xf68e('0x18')+(this[_0xf68e('0x3')][_0xf68e('0x19')]?_0xf68e('0x1a'):''));}else{logger[_0xf68e('0x12')](_0xf68e('0x1b'),this[_0xf68e('0x5')]['id'],this['agent']['id']);setTimeout(this['push'][_0xf68e('0xb')](this),0x3e8);}}};Agent[_0xf68e('0xe')][_0xf68e('0xa')]=function(_0x6b0254){if(_[_0xf68e('0x10')](this[_0xf68e('0x7')][_0xf68e('0x11')][this['agent']['id']])){return logger['info'](_0xf68e('0x13'),this[_0xf68e('0x5')]['id'],this['agent']['id']);}else{logger['info'](_0xf68e('0x1c'),this['squeue']['id'],this['agent']['id']);util['hideNotification'](this[_0xf68e('0x4')],this[_0xf68e('0x5')]['id'],this['realtime'][_0xf68e('0x11')][this[_0xf68e('0x6')]['id']],null,this['routing']);this[_0xf68e('0x7')]['agents'][this[_0xf68e('0x6')]['id']][_0xf68e('0x15')]=![];this[_0xf68e('0x7')]['agents'][this[_0xf68e('0x6')]['id']][_0xf68e('0x16')]=undefined;util[_0xf68e('0x17')](this[_0xf68e('0x5')]['id'],this[_0xf68e('0x7')][_0xf68e('0x11')][this[_0xf68e('0x6')]['id']],_0x6b0254?_0xf68e('0x1d'):'TIMEOUT');}if(!_0x6b0254){setTimeout(this[_0xf68e('0x8')][_0xf68e('0xb')](this),0x3e8);}};function agent(_0x56772e,_0x40631d,_0x53c8e3,_0x3d4ddf){return new Agent(_0x56772e,_0x40631d,_0x53c8e3,_0x3d4ddf);}module[_0xf68e('0x1e')]=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 e8ab9b4..91ee0f7 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 _0x9842=['handleDrained','prototype','isNil','Agents','length','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','agents','channel','RINGING','busy','name','showNotification','info','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','busyQueue','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','queue','realtime','push','handleRun','bind','handleTimeout','timeout','drained'];(function(_0x49a17d,_0x38066e){var _0x1810c0=function(_0x5ba6f8){while(--_0x5ba6f8){_0x49a17d['push'](_0x49a17d['shift']());}};_0x1810c0(++_0x38066e);}(_0x9842,0x1f2));var _0x2984=function(_0x20228c,_0x32a2d3){_0x20228c=_0x20228c-0x0;var _0x3569d9=_0x9842[_0x20228c];return _0x3569d9;};'use strict';var _=require('lodash');var uuid=require(_0x2984('0x0'));var util=require(_0x2984('0x1'));var logger=require(_0x2984('0x2'))(_0x2984('0x3'));var Beepall=function(_0x2f1a7a,_0x2d2aae,_0x3cb612,_0x50d245){this[_0x2984('0x4')]=uuid['v4']();this[_0x2984('0x5')]=_0x2f1a7a;this[_0x2984('0x6')]=_0x2d2aae;this[_0x2984('0x7')]=_0x3cb612;this[_0x2984('0x3')]=_0x50d245;this[_0x2984('0x5')][_0x2984('0x8')](this[_0x2984('0x9')][_0x2984('0xa')](this),this[_0x2984('0xb')]['bind'](this));this[_0x2984('0x5')]['on'](_0x2984('0xc'),this[_0x2984('0xb')]['bind'](this));this['squeue']['on'](_0x2984('0xd'),this[_0x2984('0xe')]['bind'](this));};Beepall[_0x2984('0xf')][_0x2984('0x8')]=function(){this[_0x2984('0x5')][_0x2984('0x8')](this['handleRun'][_0x2984('0xa')](this),this[_0x2984('0xb')][_0x2984('0xa')](this));};Beepall[_0x2984('0xf')]['handleDrained']=function(_0x5a06c4){this[_0x2984('0xb')](!![]);};Beepall['prototype'][_0x2984('0x9')]=function(_0x1720e8){var _0x55af75=!![];if(!_['isNil'](this[_0x2984('0x6')])&&!_[_0x2984('0x10')](this[_0x2984('0x6')]['Agents'])&&this[_0x2984('0x6')][_0x2984('0x11')]['length']>0x0){for(var _0x32353a=0x0,_0x55be61;_0x32353a0x0){for(var _0x18e096=0x0,_0x1a422f;_0x18e0960x0&&_0x1f0530[_0x1dc6ec+_0x899e('0x24')]>=_0x1f0530[_0x1dc6ec+'Capacity']){writeLog(_0x2466a3,_0x1f0530,_0x1dc6ec[_0x899e('0x25')]()+_0x899e('0x26'));return![];}}return!![];};exports['showNotification']=function(_0x4123cb,_0x44fada,_0x119c46,_0x155717,_0x3ee4a9){return sendNotification(!![],_0x4123cb,_0x44fada,_0x119c46,_0x155717,_0x3ee4a9);};exports['hideNotification']=function(_0x394ed2,_0xa21f65,_0x274d01,_0x219dab,_0x39d3ff){return sendNotification(![],_0x394ed2,_0xa21f65,_0x274d01,_0x219dab,_0x39d3ff);};exports[_0x899e('0x27')]=writeLog; \ No newline at end of file +var _0xf2f3=['mustache','../../../../../config/environment','../../../../../config/logger','routing','redis','localhost','socket.io-emitter','emit','format','name','user:save','split','account','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','user:%s','save','remove','info','isAgentAvailable','busy','BUSY','online','OFFLINE','PAUSE','hasOwnProperty','CurrentCapacity','Capacity','showNotification','writeLog','util','../utils'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf2f3,0x15d));var _0x3f2f=function(_0x179478,_0x5e01b5){_0x179478=_0x179478-0x0;var _0x5384dd=_0xf2f3[_0x179478];return _0x5384dd;};'use strict';var _=require('lodash');var util=require(_0x3f2f('0x0'));var utils=require(_0x3f2f('0x1'));var Mustache=require(_0x3f2f('0x2'));var Redis=require('ioredis');var config=require(_0x3f2f('0x3'));var logger=require(_0x3f2f('0x4'))(_0x3f2f('0x5'));config['redis']=_['defaults'](config[_0x3f2f('0x6')],{'host':_0x3f2f('0x7'),'port':0x18eb});var io=require(_0x3f2f('0x8'))(new Redis(config[_0x3f2f('0x6')]));function emit(_0xbcd687,_0x4650c5,_0x401c52){io['to'](_0xbcd687)[_0x3f2f('0x9')](_0x4650c5,_0x401c52);}function sendNotification(_0xc83ca3,_0x2c54f8,_0x191f5f,_0x438f59,_0x2e3ee3,_0x325b66){io['to'](util[_0x3f2f('0xa')]('user:%s',_0x438f59[_0x3f2f('0xb')]))[_0x3f2f('0x9')](_0x3f2f('0xc'),_0x438f59);var _0x548dd4=_0x325b66||{};var _0x376e78=_0x191f5f[_0x3f2f('0xd')]('.');var _0x5e6169={'uniqueid':_0x2c54f8,'channel':_0x376e78[0x0],'id':_0x376e78[0x1],'title':_0x376e78[0x0]+'\x20interaction','interactionId':_0x376e78[0x2],'queue':_0x2e3ee3?_0x2e3ee3[_0x3f2f('0xb')]:null,'sound':_0x548dd4['account']['notificationSound'],'shake':_0x548dd4[_0x3f2f('0xe')][_0x3f2f('0xf')]};try{if(!_0x548dd4[_0x3f2f('0x10')]){_0x548dd4['body']={};}if(_0x2e3ee3){_0x548dd4['body'][_0x3f2f('0x11')]=_0x2e3ee3;}else if(_0x548dd4[_0x3f2f('0x10')][_0x3f2f('0x11')]){delete _0x548dd4[_0x3f2f('0x10')][_0x3f2f('0x11')];}_0x5e6169[_0x3f2f('0x12')]=utils[_0x3f2f('0x13')](_0x548dd4['account'][_0x3f2f('0x14')],_0x548dd4);}catch(_0x3a8b51){_0x5e6169[_0x3f2f('0x12')]=_0x3f2f('0x15');logger[_0x3f2f('0x16')](util[_0x3f2f('0xa')](_0x3f2f('0x17'),_0x2c54f8,_0x3a8b51['message']));}io['to'](util[_0x3f2f('0xa')](_0x3f2f('0x18'),_0x438f59[_0x3f2f('0xb')]))['emit'](util[_0x3f2f('0xa')]('notification:%s',_0xc83ca3?_0x3f2f('0x19'):_0x3f2f('0x1a')),_0x5e6169);}function writeLog(_0x3e39b9,_0x123aed,_0x1c6840){return logger[_0x3f2f('0x1b')](util[_0x3f2f('0xa')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x3e39b9,_0x123aed[_0x3f2f('0xb')],_0x1c6840));}exports[_0x3f2f('0x1c')]=function(_0x525d7d,_0x335c59,_0x181226,_0x40920e){if(_0x335c59[_0x3f2f('0x1d')]){writeLog(_0x525d7d,_0x335c59,_0x3f2f('0x1e'));return![];}if(!_0x335c59[_0x3f2f('0x1f')]){writeLog(_0x525d7d,_0x335c59,_0x3f2f('0x20'));return![];}if(_0x335c59[_0x181226+'Pause']){writeLog(_0x525d7d,_0x335c59,_0x3f2f('0x21'));return![];}if(_0x40920e&&_0x335c59[_0x3f2f('0x22')](_0x181226+'Capacity')&&_0x335c59[_0x3f2f('0x22')](_0x181226+_0x3f2f('0x23'))){if(_0x335c59[_0x181226+_0x3f2f('0x24')]>0x0&&_0x335c59[_0x181226+'CurrentCapacity']>=_0x335c59[_0x181226+_0x3f2f('0x24')]){writeLog(_0x525d7d,_0x335c59,_0x181226['toUpperCase']()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x3f2f('0x25')]=function(_0x3bcc4f,_0x422763,_0x195c0d,_0x304cce,_0x57d989){return sendNotification(!![],_0x3bcc4f,_0x422763,_0x195c0d,_0x304cce,_0x57d989);};exports['hideNotification']=function(_0xb839b,_0x394251,_0x13195f,_0x449674,_0x1717a9){return sendNotification(![],_0xb839b,_0x394251,_0x13195f,_0x449674,_0x1717a9);};exports[_0x3f2f('0x26')]=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 9664128..c2bf3ba 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 _0x05ff=['[%s][SYSTEM]\x20%s','isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','consequence','length','error','map','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0x05ff,0x123));var _0xf05f=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x05ff[_0x6c993a];return _0x27f547;};'use strict';var schema=require(_0xf05f('0x0'));var sh=require(_0xf05f('0x1'));var _=require(_0xf05f('0x2'));var utils=require(_0xf05f('0x3'));var logger=require(_0xf05f('0x4'))(_0xf05f('0x5'));var system=schema({'command':{'type':_0xf05f('0x6'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xf05f('0x7')]=function(_0x28bfd0,_0x3cda21){return function(_0x1e2bfc){try{var _0x353ca8={'command':_0x3cda21[0x0]};var _0x4b7464=system['validate'](_0x353ca8,{'typecast':!![]});if(_0x4b7464[_0xf05f('0x8')]){logger[_0xf05f('0x9')]('[%s][SYSTEM]\x20%s',_0x28bfd0,_[_0xf05f('0xa')](_0x4b7464,'message')[_0xf05f('0xb')](',\x20'));logger[_0xf05f('0xc')](_0xf05f('0xd'),_0x28bfd0);_0x1e2bfc['next']();}else{var _0x2c59ff=this;var _0x2eb0f2=utils['getMustacheRender'](_0x3cda21[0x0],this);logger[_0xf05f('0xc')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x28bfd0,_0x2eb0f2);sh[_0xf05f('0xe')](_['trim'](_0x2eb0f2),function(_0x1e247a,_0x4be7eb){logger[_0xf05f('0xc')](_0xf05f('0xf'),_0x28bfd0,_0x1e247a);if(_0x1e247a==0x0){var _0x5ad24a=_0x4be7eb['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0xf05f('0x10')](_0x3cda21[0x1])||_['isEmpty'](_0x3cda21[0x1])){logger[_0xf05f('0xc')](_0xf05f('0x11'),_0x28bfd0);_0x2c59ff[_0xf05f('0x12')][_0x3cda21[0x1]]=_0x5ad24a;}else{logger[_0xf05f('0xc')](_0xf05f('0x13'),_0x28bfd0,_0x3cda21[0x1],_0x5ad24a);_0x2c59ff['body'][_0x3cda21[0x1]]=_0x5ad24a;}}_0x1e2bfc[_0xf05f('0x14')]();});}}catch(_0x3e7af4){logger[_0xf05f('0x9')](_0xf05f('0x15'),_0x28bfd0,_[_0xf05f('0x16')](_0x3e7af4)?JSON[_0xf05f('0x17')](_0x3e7af4):_0x3e7af4);logger[_0xf05f('0xc')](_0xf05f('0xd'),_0x28bfd0);_0x1e2bfc[_0xf05f('0x14')]();}};}; \ No newline at end of file +var _0x8d3a=['exec','info','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','lodash','./utils','../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][SYSTEM]\x20%s','message','next','[%s][SYSTEM]\x20commnad:\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8d3a,0xab));var _0xa8d3=function(_0x71458a,_0x517e81){_0x71458a=_0x71458a-0x0;var _0x1ca55a=_0x8d3a[_0x71458a];return _0x1ca55a;};'use strict';var schema=require(_0xa8d3('0x0'));var sh=require(_0xa8d3('0x1'));var _=require(_0xa8d3('0x2'));var utils=require(_0xa8d3('0x3'));var logger=require(_0xa8d3('0x4'))('routing');var system=schema({'command':{'type':_0xa8d3('0x5'),'required':!![],'message':_0xa8d3('0x6')}});exports[_0xa8d3('0x7')]=function(_0x1289bd,_0x3bf8d7){return function(_0x5ac18b){try{var _0x35ce88={'command':_0x3bf8d7[0x0]};var _0x3895ad=system[_0xa8d3('0x0')](_0x35ce88,{'typecast':!![]});if(_0x3895ad[_0xa8d3('0x8')]){logger['error'](_0xa8d3('0x9'),_0x1289bd,_['map'](_0x3895ad,_0xa8d3('0xa'))['join'](',\x20'));logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x1289bd);_0x5ac18b[_0xa8d3('0xb')]();}else{var _0x505623=this;var _0x187836=utils['getMustacheRender'](_0x3bf8d7[0x0],this);logger['info'](_0xa8d3('0xc'),_0x1289bd,_0x187836);sh[_0xa8d3('0xd')](_['trim'](_0x187836),function(_0x554e56,_0x1a4d21){logger[_0xa8d3('0xe')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x1289bd,_0x554e56);if(_0x554e56==0x0){var _0xa5125b=_0x1a4d21[_0xa8d3('0xf')](/(\r\n|\n|\r)/gm,'');if(_[_0xa8d3('0x10')](_0x3bf8d7[0x1])||_[_0xa8d3('0x11')](_0x3bf8d7[0x1])){logger[_0xa8d3('0xe')](_0xa8d3('0x12'),_0x1289bd);_0x505623[_0xa8d3('0x13')][_0x3bf8d7[0x1]]=_0xa5125b;}else{logger[_0xa8d3('0xe')](_0xa8d3('0x14'),_0x1289bd,_0x3bf8d7[0x1],_0xa5125b);_0x505623[_0xa8d3('0x13')][_0x3bf8d7[0x1]]=_0xa5125b;}}_0x5ac18b['next']();});}}catch(_0x1d5166){logger[_0xa8d3('0x15')](_0xa8d3('0x9'),_0x1289bd,_['isObject'](_0x1d5166)?JSON['stringify'](_0x1d5166):_0x1d5166);logger['info'](_0xa8d3('0x16'),_0x1289bd);_0x5ac18b[_0xa8d3('0xb')]();}};}; \ 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 4244dd7..3bc0962 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 _0x7a54=['finally','error','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','[%s][TAG]\x20%s','map','join','next','channel','Interaction','addTags','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next'];(function(_0x386df8,_0x4cb4b7){var _0x4da795=function(_0x437715){while(--_0x437715){_0x386df8['push'](_0x386df8['shift']());}};_0x4da795(++_0x4cb4b7);}(_0x7a54,0x106));var _0x47a5=function(_0x201299,_0x39f354){_0x201299=_0x201299-0x0;var _0x5f3fed=_0x7a54[_0x201299];return _0x5f3fed;};'use strict';var schema=require(_0x47a5('0x0'));var _=require(_0x47a5('0x1'));var rpc={'chatInteraction':require(_0x47a5('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x47a5('0x3')),'mailInteraction':require(_0x47a5('0x4')),'faxInteraction':require('../../rpc/faxInteraction')};var logger=require(_0x47a5('0x5'))(_0x47a5('0x6'));var tag=schema({'tag':{'type':_0x47a5('0x7'),'required':!![],'message':_0x47a5('0x8')}});exports[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629,_0x59199c,_0x343372){return function(_0x30e405){try{var _0x506eda={'tag':_0x3d5629[0x0]};var _0x194fb0=tag['validate'](_0x506eda,{'typecast':!![]});if(_0x194fb0['length']){logger['error'](_0x47a5('0xa'),_0x545a97,_[_0x47a5('0xb')](_0x194fb0,'message')[_0x47a5('0xc')](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x545a97);_0x30e405[_0x47a5('0xd')]();}else{var _0x69e4d4={'ids':[_0x3d5629[0x0]]};if(rpc[_0x343372[_0x47a5('0xe')]+_0x47a5('0xf')]){rpc[_0x343372[_0x47a5('0xe')]+_0x47a5('0xf')][_0x47a5('0x10')](_0x343372['interaction']['id'],_0x69e4d4)[_0x47a5('0x11')](function(_0x221b54){logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x545a97,_0x3d5629[0x1],_0x343372[_0x47a5('0xe')],_0x343372[_0x47a5('0x14')]['id']);})[_0x47a5('0x15')](function(_0x190faa){logger['error'](_0x47a5('0xa'),_0x545a97,JSON[_0x47a5('0x16')](_0x190faa));logger[_0x47a5('0x12')](_0x47a5('0x17'),_0x545a97);})[_0x47a5('0x18')](function(){_0x30e405['next']();});}}}catch(_0x549de3){logger[_0x47a5('0x19')]('[%s][TAG]\x20%s',_0x545a97,_['isObject'](_0x549de3)?JSON[_0x47a5('0x16')](_0x549de3):_0x549de3);logger[_0x47a5('0x12')](_0x47a5('0x17'),_0x545a97);_0x30e405[_0x47a5('0xd')]();}};}; \ No newline at end of file +var _0x9957=['join','info','next','Interaction','channel','addTags','interaction','then','catch','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','message'];(function(_0x26fa08,_0x2bfb58){var _0x40c774=function(_0x497e5d){while(--_0x497e5d){_0x26fa08['push'](_0x26fa08['shift']());}};_0x40c774(++_0x2bfb58);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var schema=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var rpc={'chatInteraction':require(_0x7995('0x2')),'openchannelInteraction':require(_0x7995('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x7995('0x4')),'faxInteraction':require(_0x7995('0x5'))};var logger=require(_0x7995('0x6'))(_0x7995('0x7'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x7995('0x8')}});exports[_0x7995('0x9')]=function(_0x137b6b,_0x219534,_0xbda126,_0x326741){return function(_0x4996ca){try{var _0x465276={'tag':_0x219534[0x0]};var _0x1cad37=tag['validate'](_0x465276,{'typecast':!![]});if(_0x1cad37[_0x7995('0xa')]){logger[_0x7995('0xb')](_0x7995('0xc'),_0x137b6b,_[_0x7995('0xd')](_0x1cad37,_0x7995('0xe'))[_0x7995('0xf')](',\x20'));logger[_0x7995('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x137b6b);_0x4996ca[_0x7995('0x11')]();}else{var _0x41c652={'ids':[_0x219534[0x0]]};if(rpc[_0x326741['channel']+_0x7995('0x12')]){rpc[_0x326741[_0x7995('0x13')]+_0x7995('0x12')][_0x7995('0x14')](_0x326741[_0x7995('0x15')]['id'],_0x41c652)[_0x7995('0x16')](function(_0x2bbe7a){logger['info']('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x137b6b,_0x219534[0x1],_0x326741[_0x7995('0x13')],_0x326741[_0x7995('0x15')]['id']);})[_0x7995('0x17')](function(_0x321ae8){logger[_0x7995('0xb')](_0x7995('0xc'),_0x137b6b,JSON[_0x7995('0x18')](_0x321ae8));logger[_0x7995('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x137b6b);})[_0x7995('0x19')](function(){_0x4996ca['next']();});}}}catch(_0x2f832e){logger[_0x7995('0xb')](_0x7995('0xc'),_0x137b6b,_[_0x7995('0x1a')](_0x2f832e)?JSON[_0x7995('0x18')](_0x2f832e):_0x2f832e);logger[_0x7995('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x137b6b);_0x4996ca['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 86c8682..6482a93 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 _0x7a59=['account','interaction','mustache','render','merge','body','message'];(function(_0xd0825d,_0x3d707b){var _0x300b58=function(_0x211ce3){while(--_0x211ce3){_0xd0825d['push'](_0xd0825d['shift']());}};_0x300b58(++_0x3d707b);}(_0x7a59,0x16e));var _0x97a5=function(_0x589aee,_0x140a03){_0x589aee=_0x589aee-0x0;var _0x2f5ed4=_0x7a59[_0x589aee];return _0x2f5ed4;};'use strict';var Mustache=require(_0x97a5('0x0'));var _=require('lodash');module['exports']={'getMustacheRender':function(_0x1f74cd,_0xe6f28a){return Mustache[_0x97a5('0x1')](_0x1f74cd,_[_0x97a5('0x2')](_0xe6f28a[_0x97a5('0x3')],{'contact':_0xe6f28a['contact'],'message':_0xe6f28a[_0x97a5('0x4')],'account':_0xe6f28a[_0x97a5('0x5')],'interaction':_0xe6f28a[_0x97a5('0x6')],'list':_0xe6f28a['list']}))||'';}}; \ No newline at end of file +var _0xbf83=['render','merge','message','account','interaction','list','mustache','exports'];(function(_0x1bd2a6,_0x45f0fc){var _0x525206=function(_0x3ae097){while(--_0x3ae097){_0x1bd2a6['push'](_0x1bd2a6['shift']());}};_0x525206(++_0x45f0fc);}(_0xbf83,0x11e));var _0x3bf8=function(_0xf5dc4a,_0x5445b0){_0xf5dc4a=_0xf5dc4a-0x0;var _0x556b7c=_0xbf83[_0xf5dc4a];return _0x556b7c;};'use strict';var Mustache=require(_0x3bf8('0x0'));var _=require('lodash');module[_0x3bf8('0x1')]={'getMustacheRender':function(_0x375502,_0x3cbf10){return Mustache[_0x3bf8('0x2')](_0x375502,_[_0x3bf8('0x3')](_0x3cbf10['body'],{'contact':_0x3cbf10['contact'],'message':_0x3cbf10[_0x3bf8('0x4')],'account':_0x3cbf10[_0x3bf8('0x5')],'interaction':_0x3cbf10[_0x3bf8('0x6')],'list':_0x3cbf10[_0x3bf8('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index c7da55e..aff388e 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 _0xc1c8=['Intervals','interval','listen','rules','channel','message','interaction','applications','isArray','length','existsSync','join','app','autoreply','split','push','slice','dialogflow','appdata','amazonlex','tag','TagId','%s:%s:%s','./interval','condition','./applications/','consequence','priority','Push\x20new\x20rule','on\x20interval','intervals','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','.js','execute','info','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','busy','busyQueue','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','chatQueues','available','loggedIn','paused','waiting','mailQueues','name','openchannelQueues','smsQueues','faxQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','server','http','log','lodash','util','jayson/promise','bluebird','uuid','../../../config/environment','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','IntervalId','isNil'];(function(_0x1e9424,_0x191cba){var _0x1bd96c=function(_0x5e952d){while(--_0x5e952d){_0x1e9424['push'](_0x1e9424['shift']());}};_0x1bd96c(++_0x191cba);}(_0xc1c8,0x160));var _0x8c1c=function(_0x502bcf,_0x2abf07){_0x502bcf=_0x502bcf-0x0;var _0x286c0f=_0xc1c8[_0x502bcf];return _0x286c0f;};'use strict';var _=require(_0x8c1c('0x0'));var util=require(_0x8c1c('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0x8c1c('0x2'));var BPromise=require(_0x8c1c('0x3'));var uuid=require(_0x8c1c('0x4'));var config=require(_0x8c1c('0x5'));var logger=require(_0x8c1c('0x6'))('routing');var rpc={'openchannelQueueReport':require(_0x8c1c('0x7'))};var rpc={'openchannelQueueReport':require(_0x8c1c('0x7')),'mailQueueReport':require(_0x8c1c('0x8')),'chatQueueReport':require(_0x8c1c('0x9')),'smsQueueReport':require(_0x8c1c('0xa')),'faxQueueReport':require(_0x8c1c('0xb'))};var RuleEngine=require(_0x8c1c('0xc'));function getId(_0x557c9a,_0x34f958,_0x3e384f){return util[_0x8c1c('0xd')]('%s.%s.%s',_0x557c9a,_0x34f958||0x0,_0x3e384f||0x0);}function getIntervals(_0x2170e6,_0x4521b9){var _0x53e332=[];if(!_['isNil'](_0x4521b9['IntervalId'])&&!_['isNil'](_0x2170e6[_0x4521b9[_0x8c1c('0xe')]])&&!_[_0x8c1c('0xf')](_0x2170e6[_0x4521b9['IntervalId']][_0x8c1c('0x10')])){_0x53e332=_['map'](_0x2170e6[_0x4521b9[_0x8c1c('0xe')]][_0x8c1c('0x10')],_0x8c1c('0x11'));}else if(!_[_0x8c1c('0xf')](_0x4521b9['interval'])){_0x53e332=[_0x4521b9[_0x8c1c('0x11')]];}return _0x53e332;}exports[_0x8c1c('0x12')]=function(_0x15a029){_0x15a029[_0x8c1c('0x13')]={};return new BPromise(function(_0xe687ac,_0x1e3d95){var _0x497b3e={'Start':function(_0x12efe8){var _0x9fc675=this;return new Promise(function(_0x16d9b3,_0x12252e){if(_0x12efe8){try{var _0x3f7b92=[];var _0x46cb0a=getId(_0x12efe8[_0x8c1c('0x14')],_0x12efe8[_0x8c1c('0x15')]?_0x12efe8[_0x8c1c('0x15')]['id']:0x0,_0x12efe8[_0x8c1c('0x16')]?_0x12efe8['interaction']['id']:0x0);if(_0x12efe8[_0x8c1c('0x17')]&&_[_0x8c1c('0x18')](_0x12efe8[_0x8c1c('0x17')])&&_0x12efe8[_0x8c1c('0x17')][_0x8c1c('0x19')]){for(var _0x3a35b1=0x0;_0x3a35b1<_0x12efe8[_0x8c1c('0x17')][_0x8c1c('0x19')];_0x3a35b1+=0x1){var _0x75d4d=_0x12efe8[_0x8c1c('0x17')][_0x3a35b1];if(fs[_0x8c1c('0x1a')](path[_0x8c1c('0x1b')](__dirname,_0x8c1c('0x17'),_0x75d4d['app']+'.js'))){var _0x1e71a9=[];switch(_0x75d4d[_0x8c1c('0x1c')]['toLowerCase']()){case _0x8c1c('0x1d'):var _0x5b71b8=_0x75d4d['appdata'][_0x8c1c('0x1e')](',');_0x1e71a9[_0x8c1c('0x1f')](_0x5b71b8[0x0]);_0x1e71a9[_0x8c1c('0x1f')](_0x5b71b8[_0x8c1c('0x20')](0x1,_0x5b71b8[_0x8c1c('0x19')])['join'](','));break;case _0x8c1c('0x21'):var _0x262b03=_0x75d4d[_0x8c1c('0x22')]['split'](',');_0x1e71a9[_0x8c1c('0x1f')](_0x262b03[0x0]);_0x1e71a9['push'](_0x262b03[0x1]);_0x1e71a9['push'](_0x262b03[_0x8c1c('0x20')](0x2,_0x262b03[_0x8c1c('0x19')])[_0x8c1c('0x1b')](','));break;case _0x8c1c('0x23'):var _0x3dbe2e=_0x75d4d[_0x8c1c('0x22')][_0x8c1c('0x1e')](',');_0x1e71a9[_0x8c1c('0x1f')](_0x3dbe2e[0x0]);_0x1e71a9[_0x8c1c('0x1f')](_0x3dbe2e[0x1]);_0x1e71a9[_0x8c1c('0x1f')](_0x3dbe2e[0x2]);_0x1e71a9[_0x8c1c('0x1f')](_0x3dbe2e[0x3]);_0x1e71a9[_0x8c1c('0x1f')](_0x3dbe2e[_0x8c1c('0x20')](0x4,_0x3dbe2e['length'])[_0x8c1c('0x1b')](','));break;case _0x8c1c('0x15'):_0x1e71a9[_0x8c1c('0x1f')](_0x75d4d[_0x8c1c('0x22')]);break;case _0x8c1c('0x24'):_0x1e71a9[_0x8c1c('0x1f')](_0x75d4d[_0x8c1c('0x25')]);_0x1e71a9['push'](_0x75d4d['appdata']);break;default:_0x1e71a9=_['isNil'](_0x75d4d[_0x8c1c('0x22')])?[]:_0x75d4d['appdata']['split'](',');}var _0x592e73={'id':util[_0x8c1c('0xd')](_0x8c1c('0x26'),_0x46cb0a,_0x75d4d['id'],_0x75d4d[_0x8c1c('0x1c')]),'condition':require(_0x8c1c('0x27'))[_0x8c1c('0x28')](_0x46cb0a,getIntervals(_0x15a029['intervals'],_0x75d4d),_0x15a029),'consequence':require(_0x8c1c('0x29')+_0x75d4d[_0x8c1c('0x1c')])[_0x8c1c('0x2a')](_0x46cb0a,_0x1e71a9,_0x15a029,_0x12efe8),'p':_0x75d4d[_0x8c1c('0x2b')]||0x0};logger['info'](_0x8c1c('0x2c'),_0x592e73['id'],_0x8c1c('0x2d'),getIntervals(_0x15a029[_0x8c1c('0x2e')],_0x75d4d)[_0x8c1c('0x1b')](_0x8c1c('0x2f')));_0x3f7b92[_0x8c1c('0x1f')](_0x592e73);}else{logger[_0x8c1c('0x30')](_0x8c1c('0x31'),path[_0x8c1c('0x1b')](__dirname,_0x8c1c('0x17'),_0x75d4d[_0x8c1c('0x1c')]+_0x8c1c('0x32')));}}_0x15a029['rules'][_0x46cb0a]=new RuleEngine(_0x3f7b92);_0x15a029[_0x8c1c('0x13')][_0x46cb0a][_0x8c1c('0x33')](_0x12efe8,function(_0x7e189d){logger[_0x8c1c('0x34')](_0x8c1c('0x35'),JSON[_0x8c1c('0x36')](_0x7e189d[_0x8c1c('0x37')]));if(_0x15a029[_0x8c1c('0x13')][_0x46cb0a]){_0x15a029[_0x8c1c('0x13')][_0x46cb0a][_0x8c1c('0x38')](_0x8c1c('0x39'));}});return _0x16d9b3({'code':0xc8,'message':_0x12efe8});}else{logger['info'](_0x8c1c('0x3a'));return _0x16d9b3({'code':0xc8,'message':_0x12efe8});}}catch(_0x9d371f){logger[_0x8c1c('0x30')](_0x9d371f[_0x8c1c('0x3b')]);return _0x12252e(_0x9fc675['error'](0x1f4,_0x9d371f));}}return _0x12252e('routing\x20is\x20empty');});},'AcceptMessage':function(_0x4356fc){var _0x522230=this;return new Promise(function(_0x2e83ef,_0x12ef2a){if(_0x4356fc[_0x8c1c('0x15')]&&_0x4356fc['message']['id']){try{var _0x3177b6=getId(_0x4356fc['channel'],_0x4356fc[_0x8c1c('0x15')]?_0x4356fc['message']['id']:0x0,_0x4356fc['interaction']?_0x4356fc[_0x8c1c('0x16')]['id']:0x0);if(_0x15a029['rules'][_0x3177b6]){_0x15a029['rules'][_0x3177b6][_0x8c1c('0x38')](_0x8c1c('0x3c'));if(rpc[_0x4356fc[_0x8c1c('0x14')]+'QueueReport']){rpc[_0x4356fc[_0x8c1c('0x14')]+_0x8c1c('0x3d')][_0x8c1c('0x3e')](_0x3177b6,{'UserId':_0x4356fc['message'][_0x8c1c('0x3f')]})[_0x8c1c('0x40')](function(_0x29f7d6){logger['error'](_0x8c1c('0x41'));});}}return _0x2e83ef({'code':0xc8,'message':_0x4356fc});}catch(_0xd608ce){logger['error'](_0xd608ce['stack']);return _0x12ef2a(_0x522230[_0x8c1c('0x30')](0x1f4,_0xd608ce));}}logger[_0x8c1c('0x30')]('message\x20is\x20empty');return _0x12ef2a(_0x522230[_0x8c1c('0x30')](0x1f4,_0x8c1c('0x42')));});},'RejectMessage':function(_0x4b74ed){var _0x414c6f=this;return new Promise(function(_0x27055f,_0x1c9fff){if(_0x4b74ed[_0x8c1c('0x43')]&&_0x4b74ed[_0x8c1c('0x43')]['id']){try{if(_0x15a029[_0x8c1c('0x44')][_0x4b74ed[_0x8c1c('0x43')]['id']]){_0x15a029['agents'][_0x4b74ed[_0x8c1c('0x43')]['id']][_0x8c1c('0x45')]=![];_0x15a029[_0x8c1c('0x44')][_0x4b74ed[_0x8c1c('0x43')]['id']][_0x8c1c('0x46')]=undefined;}return _0x27055f({'code':0xc8,'message':_0x4b74ed});}catch(_0x3b5777){logger[_0x8c1c('0x30')](_0x3b5777[_0x8c1c('0x3b')]);return _0x1c9fff(_0x414c6f[_0x8c1c('0x30')](0x1f4,_0x3b5777));}}logger[_0x8c1c('0x30')](_0x8c1c('0x42'));return _0x1c9fff(_0x414c6f['error'](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x1912de){var _0x5b0736=this;return new Promise(function(_0x106b3b,_0x1583b3){if(_0x1912de['channel']&&_0x1912de[_0x8c1c('0x16')]&&_0x1912de[_0x8c1c('0x16')]['id']){try{var _0xf6f2d2=getId(_0x1912de[_0x8c1c('0x14')],_0x1912de[_0x8c1c('0x15')]?_0x1912de[_0x8c1c('0x15')]['id']:0x0,_0x1912de[_0x8c1c('0x16')]?_0x1912de[_0x8c1c('0x16')]['id']:0x0);if(_0x15a029[_0x8c1c('0x13')][_0xf6f2d2]){_0x15a029['rules'][_0xf6f2d2][_0x8c1c('0x38')]('end');}return _0x106b3b({'code':0xc8,'message':_0x1912de});}catch(_0x4223b6){logger['error'](_0x4223b6[_0x8c1c('0x3b')]);return _0x1583b3(_0x5b0736[_0x8c1c('0x30')](0x1f4,_0x4223b6));}}logger['error'](_0x8c1c('0x42'));return _0x1583b3(_0x5b0736[_0x8c1c('0x30')](0x1f4,_0x8c1c('0x42')));});},'AgentCapacity':function(_0x1b3e0){var _0x5ceec1=this;return new Promise(function(_0x1f3ef8,_0x50de09){if(_0x15a029[_0x8c1c('0x44')][_0x8c1c('0x47')](_0x1b3e0['id'])){for(var _0x558579 in _0x1b3e0[_0x8c1c('0x48')]){if(_0x1b3e0['capacity'][_0x8c1c('0x47')](_0x558579)){if(_0x15a029[_0x8c1c('0x44')][_0x1b3e0['id']][_0x8c1c('0x47')](_0x558579+'CurrentCapacity')){_0x15a029[_0x8c1c('0x44')][_0x1b3e0['id']][_0x558579+_0x8c1c('0x49')]=parseInt(_0x1b3e0['capacity'][_0x558579],0xa);}}}_0x15a029[_0x8c1c('0x44')][_0x1b3e0['id']]['updateRealtime']();return _0x1f3ef8({'code':0xc8,'message':_0x15a029[_0x8c1c('0x44')][_0x1b3e0['id']]});}else{return _0x50de09(_0x5ceec1[_0x8c1c('0x30')](0x1f4,_0x8c1c('0x4a')));}});},'Agents':function(_0x3664c8){return new Promise(function(_0x85cee7,_0x45233b){var _0x3764a4=_[_0x8c1c('0x4b')](_0x15a029['agents']);_0x85cee7({'count':_0x3764a4['length'],'rows':_0x3764a4});});},'ChatQueues':function(_0x5397f0){return new Promise(function(_0x45fadd,_0x5811b8){var _0x1608c8=[];for(var _0x114b5b in _0x15a029[_0x8c1c('0x4c')]){if(_0x15a029[_0x8c1c('0x4c')][_0x8c1c('0x47')](_0x114b5b)){var _0x2cb75d=_0x15a029[_0x8c1c('0x4c')][_0x114b5b];var _0x46411b={'id':_0x2cb75d['id'],'available':_0x2cb75d[_0x8c1c('0x4d')],'loggedIn':_0x2cb75d[_0x8c1c('0x4e')],'name':_0x2cb75d['name'],'paused':_0x2cb75d[_0x8c1c('0x4f')],'waiting':_0x2cb75d[_0x8c1c('0x50')]};_0x1608c8[_0x8c1c('0x1f')](_0x46411b);}}_0x45fadd({'count':_0x1608c8[_0x8c1c('0x19')],'rows':_0x1608c8});});},'MailQueues':function(_0x4db53c){return new Promise(function(_0x14186c,_0x5bbcdc){var _0x5b8cf4=[];for(var _0x5915da in _0x15a029[_0x8c1c('0x51')]){if(_0x15a029[_0x8c1c('0x51')][_0x8c1c('0x47')](_0x5915da)){var _0x90fca8=_0x15a029[_0x8c1c('0x51')][_0x5915da];var _0xf3871f={'id':_0x90fca8['id'],'available':_0x90fca8[_0x8c1c('0x4d')],'loggedIn':_0x90fca8[_0x8c1c('0x4e')],'name':_0x90fca8[_0x8c1c('0x52')],'paused':_0x90fca8[_0x8c1c('0x4f')],'waiting':_0x90fca8['waiting']};_0x5b8cf4[_0x8c1c('0x1f')](_0xf3871f);}}_0x14186c({'count':_0x5b8cf4[_0x8c1c('0x19')],'rows':_0x5b8cf4});});},'OpenchannelQueues':function(_0x22d6a2){return new Promise(function(_0x2bbdba,_0x304ac8){var _0x58aaca=[];for(var _0x368d9e in _0x15a029[_0x8c1c('0x53')]){if(_0x15a029['openchannelQueues'][_0x8c1c('0x47')](_0x368d9e)){var _0x4fab3f=_0x15a029[_0x8c1c('0x53')][_0x368d9e];var _0x1289a0={'id':_0x4fab3f['id'],'available':_0x4fab3f[_0x8c1c('0x4d')],'loggedIn':_0x4fab3f[_0x8c1c('0x4e')],'name':_0x4fab3f[_0x8c1c('0x52')],'paused':_0x4fab3f['paused'],'waiting':_0x4fab3f[_0x8c1c('0x50')]};_0x58aaca[_0x8c1c('0x1f')](_0x1289a0);}}_0x2bbdba({'count':_0x58aaca[_0x8c1c('0x19')],'rows':_0x58aaca});});},'SmsQueues':function(_0x1b7608){return new Promise(function(_0xc52ec3,_0x2afa74){var _0x4feb10=[];for(var _0x319ed0 in _0x15a029[_0x8c1c('0x54')]){if(_0x15a029[_0x8c1c('0x54')]['hasOwnProperty'](_0x319ed0)){var _0x258595=_0x15a029[_0x8c1c('0x54')][_0x319ed0];var _0x3e68ee={'id':_0x258595['id'],'available':_0x258595[_0x8c1c('0x4d')],'loggedIn':_0x258595[_0x8c1c('0x4e')],'name':_0x258595[_0x8c1c('0x52')],'paused':_0x258595[_0x8c1c('0x4f')],'waiting':_0x258595[_0x8c1c('0x50')]};_0x4feb10[_0x8c1c('0x1f')](_0x3e68ee);}}_0xc52ec3({'count':_0x4feb10['length'],'rows':_0x4feb10});});},'FaxQueues':function(_0x27d95e){return new Promise(function(_0x11d9d1,_0xa24a5c){var _0x5e7ae9=[];for(var _0x1f28a4 in _0x15a029[_0x8c1c('0x55')]){if(_0x15a029[_0x8c1c('0x55')]['hasOwnProperty'](_0x1f28a4)){var _0xfa8ae5=_0x15a029[_0x8c1c('0x55')][_0x1f28a4];var _0xdca786={'id':_0xfa8ae5['id'],'available':_0xfa8ae5[_0x8c1c('0x4d')],'loggedIn':_0xfa8ae5[_0x8c1c('0x4e')],'name':_0xfa8ae5[_0x8c1c('0x52')],'paused':_0xfa8ae5[_0x8c1c('0x4f')],'waiting':_0xfa8ae5[_0x8c1c('0x50')]};_0x5e7ae9[_0x8c1c('0x1f')](_0xdca786);}}_0x11d9d1({'count':_0x5e7ae9[_0x8c1c('0x19')],'rows':_0x5e7ae9});});},'ChatQueuesWaitingInteractions':function(_0x1b4f36){return new Promise(function(_0x2bb0fc,_0x3da72f){var _0x4a4135=_[_0x8c1c('0x4b')](_0x15a029[_0x8c1c('0x56')]);_0x2bb0fc({'count':_0x4a4135['length'],'rows':_0x4a4135});});},'MailQueuesWaitingInteractions':function(_0x3009c4){return new Promise(function(_0x21c1b4,_0x32494f){var _0x52b37f=_[_0x8c1c('0x4b')](_0x15a029['mailQueuesWaitingInteractions']);_0x21c1b4({'count':_0x52b37f[_0x8c1c('0x19')],'rows':_0x52b37f});});},'OpenchannelQueuesWaitingInteractions':function(_0x1d5410){return new Promise(function(_0x246250,_0x23f3df){var _0x3d6d39=_[_0x8c1c('0x4b')](_0x15a029[_0x8c1c('0x57')]);_0x246250({'count':_0x3d6d39[_0x8c1c('0x19')],'rows':_0x3d6d39});});},'SmsQueuesWaitingInteractions':function(_0x564423){return new Promise(function(_0x5271a5,_0x480194){var _0x137081=_['values'](_0x15a029[_0x8c1c('0x58')]);_0x5271a5({'count':_0x137081['length'],'rows':_0x137081});});},'FaxQueuesWaitingInteractions':function(_0x30d1e8){return new Promise(function(_0x582fa7,_0x53d897){var _0xbfc8dc=_['values'](_0x15a029['faxQueuesWaitingInteractions']);_0x582fa7({'count':_0xbfc8dc[_0x8c1c('0x19')],'rows':_0xbfc8dc});});}};var _0x134d6c=jayson[_0x8c1c('0x59')](_0x497b3e)[_0x8c1c('0x5a')]();_0x134d6c['on'](_0x8c1c('0x30'),function(_0x5b90c4){logger['error'](JSON[_0x8c1c('0x36')](_0x5b90c4));return _0x1e3d95(_0x5b90c4);});_0x134d6c['listen'](0x232c,'127.0.0.1',function(){console[_0x8c1c('0x5b')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0xe687ac('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0x83c2=['CurrentCapacity','updateRealtime','values','chatQueues','name','paused','waiting','mailQueues','available','loggedIn','openchannelQueues','smsQueues','faxQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','path','jayson/promise','bluebird','uuid','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','IntervalId','isNil','map','Intervals','interval','listen','rules','channel','message','interaction','applications','isArray','length','app','.js','toLowerCase','autoreply','appdata','push','slice','join','split','amazonlex','tag','TagId','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','Push\x20new\x20rule','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','info','Applications\x20executed','stringify','complete','stack','routing\x20is\x20empty','emit','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','end','hasOwnProperty','capacity'];(function(_0x401e3d,_0x55ac65){var _0x2bbc4e=function(_0x275c96){while(--_0x275c96){_0x401e3d['push'](_0x401e3d['shift']());}};_0x2bbc4e(++_0x55ac65);}(_0x83c2,0x17d));var _0x283c=function(_0x5216e0,_0x4f8cb9){_0x5216e0=_0x5216e0-0x0;var _0x5b3f40=_0x83c2[_0x5216e0];return _0x5b3f40;};'use strict';var _=require('lodash');var util=require(_0x283c('0x0'));var path=require(_0x283c('0x1'));var fs=require('fs');var jayson=require(_0x283c('0x2'));var BPromise=require(_0x283c('0x3'));var uuid=require(_0x283c('0x4'));var config=require('../../../config/environment');var logger=require(_0x283c('0x5'))('routing');var rpc={'openchannelQueueReport':require(_0x283c('0x6'))};var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x283c('0x7')),'chatQueueReport':require(_0x283c('0x8')),'smsQueueReport':require(_0x283c('0x9')),'faxQueueReport':require(_0x283c('0xa'))};var RuleEngine=require(_0x283c('0xb'));function getId(_0x48c91a,_0x4fe540,_0x52f675){return util[_0x283c('0xc')](_0x283c('0xd'),_0x48c91a,_0x4fe540||0x0,_0x52f675||0x0);}function getIntervals(_0x233e1a,_0x46299e){var _0x5b6700=[];if(!_['isNil'](_0x46299e[_0x283c('0xe')])&&!_['isNil'](_0x233e1a[_0x46299e[_0x283c('0xe')]])&&!_[_0x283c('0xf')](_0x233e1a[_0x46299e[_0x283c('0xe')]]['Intervals'])){_0x5b6700=_[_0x283c('0x10')](_0x233e1a[_0x46299e['IntervalId']][_0x283c('0x11')],_0x283c('0x12'));}else if(!_['isNil'](_0x46299e['interval'])){_0x5b6700=[_0x46299e[_0x283c('0x12')]];}return _0x5b6700;}exports[_0x283c('0x13')]=function(_0x296bf5){_0x296bf5[_0x283c('0x14')]={};return new BPromise(function(_0x267632,_0x55d5b3){var _0x24fec0={'Start':function(_0x45bf62){var _0x1915db=this;return new Promise(function(_0x6a4518,_0x4eb6b6){if(_0x45bf62){try{var _0x178b40=[];var _0x4625d7=getId(_0x45bf62[_0x283c('0x15')],_0x45bf62[_0x283c('0x16')]?_0x45bf62[_0x283c('0x16')]['id']:0x0,_0x45bf62[_0x283c('0x17')]?_0x45bf62['interaction']['id']:0x0);if(_0x45bf62[_0x283c('0x18')]&&_[_0x283c('0x19')](_0x45bf62[_0x283c('0x18')])&&_0x45bf62[_0x283c('0x18')][_0x283c('0x1a')]){for(var _0x5140ce=0x0;_0x5140ce<_0x45bf62[_0x283c('0x18')]['length'];_0x5140ce+=0x1){var _0x2a3322=_0x45bf62[_0x283c('0x18')][_0x5140ce];if(fs['existsSync'](path['join'](__dirname,_0x283c('0x18'),_0x2a3322[_0x283c('0x1b')]+_0x283c('0x1c')))){var _0x38ad79=[];switch(_0x2a3322[_0x283c('0x1b')][_0x283c('0x1d')]()){case _0x283c('0x1e'):var _0x2cc01b=_0x2a3322[_0x283c('0x1f')]['split'](',');_0x38ad79[_0x283c('0x20')](_0x2cc01b[0x0]);_0x38ad79[_0x283c('0x20')](_0x2cc01b[_0x283c('0x21')](0x1,_0x2cc01b['length'])[_0x283c('0x22')](','));break;case'dialogflow':var _0x58ed91=_0x2a3322['appdata'][_0x283c('0x23')](',');_0x38ad79[_0x283c('0x20')](_0x58ed91[0x0]);_0x38ad79[_0x283c('0x20')](_0x58ed91[0x1]);_0x38ad79[_0x283c('0x20')](_0x58ed91[_0x283c('0x21')](0x2,_0x58ed91[_0x283c('0x1a')])[_0x283c('0x22')](','));break;case _0x283c('0x24'):var _0x2fe280=_0x2a3322[_0x283c('0x1f')][_0x283c('0x23')](',');_0x38ad79[_0x283c('0x20')](_0x2fe280[0x0]);_0x38ad79['push'](_0x2fe280[0x1]);_0x38ad79[_0x283c('0x20')](_0x2fe280[0x2]);_0x38ad79[_0x283c('0x20')](_0x2fe280[0x3]);_0x38ad79['push'](_0x2fe280[_0x283c('0x21')](0x4,_0x2fe280[_0x283c('0x1a')])[_0x283c('0x22')](','));break;case'message':_0x38ad79[_0x283c('0x20')](_0x2a3322[_0x283c('0x1f')]);break;case _0x283c('0x25'):_0x38ad79[_0x283c('0x20')](_0x2a3322[_0x283c('0x26')]);_0x38ad79[_0x283c('0x20')](_0x2a3322['appdata']);break;default:_0x38ad79=_[_0x283c('0xf')](_0x2a3322[_0x283c('0x1f')])?[]:_0x2a3322[_0x283c('0x1f')][_0x283c('0x23')](',');}var _0x5cc1df={'id':util['format'](_0x283c('0x27'),_0x4625d7,_0x2a3322['id'],_0x2a3322[_0x283c('0x1b')]),'condition':require(_0x283c('0x28'))[_0x283c('0x29')](_0x4625d7,getIntervals(_0x296bf5[_0x283c('0x2a')],_0x2a3322),_0x296bf5),'consequence':require(_0x283c('0x2b')+_0x2a3322[_0x283c('0x1b')])[_0x283c('0x2c')](_0x4625d7,_0x38ad79,_0x296bf5,_0x45bf62),'p':_0x2a3322[_0x283c('0x2d')]||0x0};logger['info'](_0x283c('0x2e'),_0x5cc1df['id'],'on\x20interval',getIntervals(_0x296bf5['intervals'],_0x2a3322)['join'](_0x283c('0x2f')));_0x178b40['push'](_0x5cc1df);}else{logger[_0x283c('0x30')](_0x283c('0x31'),path[_0x283c('0x22')](__dirname,_0x283c('0x18'),_0x2a3322[_0x283c('0x1b')]+_0x283c('0x1c')));}}_0x296bf5[_0x283c('0x14')][_0x4625d7]=new RuleEngine(_0x178b40);_0x296bf5[_0x283c('0x14')][_0x4625d7][_0x283c('0x32')](_0x45bf62,function(_0x4be646){logger[_0x283c('0x33')](_0x283c('0x34'),JSON[_0x283c('0x35')](_0x4be646['matchPath']));if(_0x296bf5[_0x283c('0x14')][_0x4625d7]){_0x296bf5[_0x283c('0x14')][_0x4625d7]['emit'](_0x283c('0x36'));}});return _0x6a4518({'code':0xc8,'message':_0x45bf62});}else{logger[_0x283c('0x33')]('No\x20applications\x20to\x20execute');return _0x6a4518({'code':0xc8,'message':_0x45bf62});}}catch(_0x463dfe){logger[_0x283c('0x30')](_0x463dfe[_0x283c('0x37')]);return _0x4eb6b6(_0x1915db['error'](0x1f4,_0x463dfe));}}return _0x4eb6b6(_0x283c('0x38'));});},'AcceptMessage':function(_0x3b3aa5){var _0x56f46b=this;return new Promise(function(_0x51dc81,_0x30c6e1){if(_0x3b3aa5['message']&&_0x3b3aa5[_0x283c('0x16')]['id']){try{var _0x4d6bae=getId(_0x3b3aa5['channel'],_0x3b3aa5[_0x283c('0x16')]?_0x3b3aa5[_0x283c('0x16')]['id']:0x0,_0x3b3aa5[_0x283c('0x17')]?_0x3b3aa5[_0x283c('0x17')]['id']:0x0);if(_0x296bf5[_0x283c('0x14')][_0x4d6bae]){_0x296bf5['rules'][_0x4d6bae][_0x283c('0x39')]('end');if(rpc[_0x3b3aa5[_0x283c('0x15')]+_0x283c('0x3a')]){rpc[_0x3b3aa5['channel']+_0x283c('0x3a')][_0x283c('0x3b')](_0x4d6bae,{'UserId':_0x3b3aa5[_0x283c('0x16')][_0x283c('0x3c')]})[_0x283c('0x3d')](function(_0x25549f){logger[_0x283c('0x30')](_0x283c('0x3e'));});}}return _0x51dc81({'code':0xc8,'message':_0x3b3aa5});}catch(_0xa26f09){logger[_0x283c('0x30')](_0xa26f09[_0x283c('0x37')]);return _0x30c6e1(_0x56f46b[_0x283c('0x30')](0x1f4,_0xa26f09));}}logger['error'](_0x283c('0x3f'));return _0x30c6e1(_0x56f46b[_0x283c('0x30')](0x1f4,_0x283c('0x3f')));});},'RejectMessage':function(_0x36f6b1){var _0x35e9f2=this;return new Promise(function(_0x48e96c,_0x1815a6){if(_0x36f6b1['agent']&&_0x36f6b1[_0x283c('0x40')]['id']){try{if(_0x296bf5[_0x283c('0x41')][_0x36f6b1[_0x283c('0x40')]['id']]){_0x296bf5[_0x283c('0x41')][_0x36f6b1[_0x283c('0x40')]['id']]['busy']=![];_0x296bf5[_0x283c('0x41')][_0x36f6b1[_0x283c('0x40')]['id']]['busyQueue']=undefined;}return _0x48e96c({'code':0xc8,'message':_0x36f6b1});}catch(_0x20f58e){logger[_0x283c('0x30')](_0x20f58e[_0x283c('0x37')]);return _0x1815a6(_0x35e9f2['error'](0x1f4,_0x20f58e));}}logger[_0x283c('0x30')](_0x283c('0x3f'));return _0x1815a6(_0x35e9f2[_0x283c('0x30')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x2b60c2){var _0x467dda=this;return new Promise(function(_0x40008a,_0x4d98e5){if(_0x2b60c2[_0x283c('0x15')]&&_0x2b60c2[_0x283c('0x17')]&&_0x2b60c2[_0x283c('0x17')]['id']){try{var _0x9b1282=getId(_0x2b60c2[_0x283c('0x15')],_0x2b60c2['message']?_0x2b60c2[_0x283c('0x16')]['id']:0x0,_0x2b60c2[_0x283c('0x17')]?_0x2b60c2[_0x283c('0x17')]['id']:0x0);if(_0x296bf5[_0x283c('0x14')][_0x9b1282]){_0x296bf5[_0x283c('0x14')][_0x9b1282][_0x283c('0x39')](_0x283c('0x42'));}return _0x40008a({'code':0xc8,'message':_0x2b60c2});}catch(_0xc900f8){logger[_0x283c('0x30')](_0xc900f8[_0x283c('0x37')]);return _0x4d98e5(_0x467dda[_0x283c('0x30')](0x1f4,_0xc900f8));}}logger[_0x283c('0x30')]('message\x20is\x20empty');return _0x4d98e5(_0x467dda[_0x283c('0x30')](0x1f4,_0x283c('0x3f')));});},'AgentCapacity':function(_0x4875a7){var _0x2ea77b=this;return new Promise(function(_0x28aeec,_0x51f63a){if(_0x296bf5['agents'][_0x283c('0x43')](_0x4875a7['id'])){for(var _0x340e1a in _0x4875a7[_0x283c('0x44')]){if(_0x4875a7[_0x283c('0x44')][_0x283c('0x43')](_0x340e1a)){if(_0x296bf5[_0x283c('0x41')][_0x4875a7['id']][_0x283c('0x43')](_0x340e1a+_0x283c('0x45'))){_0x296bf5[_0x283c('0x41')][_0x4875a7['id']][_0x340e1a+_0x283c('0x45')]=parseInt(_0x4875a7[_0x283c('0x44')][_0x340e1a],0xa);}}}_0x296bf5['agents'][_0x4875a7['id']][_0x283c('0x46')]();return _0x28aeec({'code':0xc8,'message':_0x296bf5['agents'][_0x4875a7['id']]});}else{return _0x51f63a(_0x2ea77b[_0x283c('0x30')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x23574d){return new Promise(function(_0x238474,_0x3a12ba){var _0x2c12f6=_[_0x283c('0x47')](_0x296bf5[_0x283c('0x41')]);_0x238474({'count':_0x2c12f6[_0x283c('0x1a')],'rows':_0x2c12f6});});},'ChatQueues':function(_0x1af169){return new Promise(function(_0x330c46,_0x427bef){var _0x5d97ab=[];for(var _0x54547b in _0x296bf5[_0x283c('0x48')]){if(_0x296bf5[_0x283c('0x48')]['hasOwnProperty'](_0x54547b)){var _0x175c39=_0x296bf5[_0x283c('0x48')][_0x54547b];var _0x32719e={'id':_0x175c39['id'],'available':_0x175c39['available'],'loggedIn':_0x175c39['loggedIn'],'name':_0x175c39[_0x283c('0x49')],'paused':_0x175c39[_0x283c('0x4a')],'waiting':_0x175c39[_0x283c('0x4b')]};_0x5d97ab[_0x283c('0x20')](_0x32719e);}}_0x330c46({'count':_0x5d97ab['length'],'rows':_0x5d97ab});});},'MailQueues':function(_0x596665){return new Promise(function(_0x1e48ba,_0x97613f){var _0x5a2476=[];for(var _0x4a39ee in _0x296bf5['mailQueues']){if(_0x296bf5[_0x283c('0x4c')][_0x283c('0x43')](_0x4a39ee)){var _0x2b0ca4=_0x296bf5[_0x283c('0x4c')][_0x4a39ee];var _0x3a4cb8={'id':_0x2b0ca4['id'],'available':_0x2b0ca4[_0x283c('0x4d')],'loggedIn':_0x2b0ca4[_0x283c('0x4e')],'name':_0x2b0ca4[_0x283c('0x49')],'paused':_0x2b0ca4['paused'],'waiting':_0x2b0ca4['waiting']};_0x5a2476[_0x283c('0x20')](_0x3a4cb8);}}_0x1e48ba({'count':_0x5a2476['length'],'rows':_0x5a2476});});},'OpenchannelQueues':function(_0x251411){return new Promise(function(_0x6bd953,_0x5b5784){var _0x2070c2=[];for(var _0x3b2068 in _0x296bf5[_0x283c('0x4f')]){if(_0x296bf5[_0x283c('0x4f')][_0x283c('0x43')](_0x3b2068)){var _0x4de7b6=_0x296bf5[_0x283c('0x4f')][_0x3b2068];var _0x32755e={'id':_0x4de7b6['id'],'available':_0x4de7b6[_0x283c('0x4d')],'loggedIn':_0x4de7b6['loggedIn'],'name':_0x4de7b6[_0x283c('0x49')],'paused':_0x4de7b6[_0x283c('0x4a')],'waiting':_0x4de7b6[_0x283c('0x4b')]};_0x2070c2[_0x283c('0x20')](_0x32755e);}}_0x6bd953({'count':_0x2070c2[_0x283c('0x1a')],'rows':_0x2070c2});});},'SmsQueues':function(_0xf74830){return new Promise(function(_0x30cd4d,_0x153cc8){var _0x222bcd=[];for(var _0x159191 in _0x296bf5['smsQueues']){if(_0x296bf5[_0x283c('0x50')][_0x283c('0x43')](_0x159191)){var _0x270b90=_0x296bf5['smsQueues'][_0x159191];var _0x3e1794={'id':_0x270b90['id'],'available':_0x270b90[_0x283c('0x4d')],'loggedIn':_0x270b90['loggedIn'],'name':_0x270b90['name'],'paused':_0x270b90[_0x283c('0x4a')],'waiting':_0x270b90[_0x283c('0x4b')]};_0x222bcd['push'](_0x3e1794);}}_0x30cd4d({'count':_0x222bcd[_0x283c('0x1a')],'rows':_0x222bcd});});},'FaxQueues':function(_0x1b7164){return new Promise(function(_0x14637f,_0x164fb2){var _0x5de3d5=[];for(var _0x4e4176 in _0x296bf5[_0x283c('0x51')]){if(_0x296bf5[_0x283c('0x51')][_0x283c('0x43')](_0x4e4176)){var _0x813d5=_0x296bf5['faxQueues'][_0x4e4176];var _0xb7244a={'id':_0x813d5['id'],'available':_0x813d5[_0x283c('0x4d')],'loggedIn':_0x813d5['loggedIn'],'name':_0x813d5['name'],'paused':_0x813d5[_0x283c('0x4a')],'waiting':_0x813d5[_0x283c('0x4b')]};_0x5de3d5[_0x283c('0x20')](_0xb7244a);}}_0x14637f({'count':_0x5de3d5[_0x283c('0x1a')],'rows':_0x5de3d5});});},'ChatQueuesWaitingInteractions':function(_0x694b39){return new Promise(function(_0x1a0b33,_0xa01ed6){var _0x1133f0=_[_0x283c('0x47')](_0x296bf5[_0x283c('0x52')]);_0x1a0b33({'count':_0x1133f0['length'],'rows':_0x1133f0});});},'MailQueuesWaitingInteractions':function(_0x3a6130){return new Promise(function(_0x4a09fe,_0x336e5e){var _0x3b7201=_[_0x283c('0x47')](_0x296bf5[_0x283c('0x53')]);_0x4a09fe({'count':_0x3b7201[_0x283c('0x1a')],'rows':_0x3b7201});});},'OpenchannelQueuesWaitingInteractions':function(_0x155fc5){return new Promise(function(_0x540caa,_0x236800){var _0x214386=_[_0x283c('0x47')](_0x296bf5[_0x283c('0x54')]);_0x540caa({'count':_0x214386[_0x283c('0x1a')],'rows':_0x214386});});},'SmsQueuesWaitingInteractions':function(_0x33db20){return new Promise(function(_0x28565d,_0x493e4e){var _0x3fd472=_[_0x283c('0x47')](_0x296bf5['smsQueuesWaitingInteractions']);_0x28565d({'count':_0x3fd472[_0x283c('0x1a')],'rows':_0x3fd472});});},'FaxQueuesWaitingInteractions':function(_0x4643f0){return new Promise(function(_0x327155,_0x5a9cb0){var _0xe8cf36=_[_0x283c('0x47')](_0x296bf5[_0x283c('0x55')]);_0x327155({'count':_0xe8cf36['length'],'rows':_0xe8cf36});});}};var _0x10896d=jayson['server'](_0x24fec0)['http']();_0x10896d['on'](_0x283c('0x30'),function(_0x25a188){logger[_0x283c('0x30')](JSON[_0x283c('0x35')](_0x25a188));return _0x55d5b3(_0x25a188);});_0x10896d[_0x283c('0x13')](0x232c,_0x283c('0x56'),function(){console[_0x283c('0x57')](_0x283c('0x58'),0x232c);return _0x267632(_0x283c('0x59')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 7e5382a..3986e13 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 _0xbc02=['catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','Command','format','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','log','\x20|\x20','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','request','then','error','message','result'];(function(_0x36cff7,_0x5cb048){var _0x21c697=function(_0x1aab10){while(--_0x1aab10){_0x36cff7['push'](_0x36cff7['shift']());}};_0x21c697(++_0x5cb048);}(_0xbc02,0x73));var _0x2bc0=function(_0x293e7a,_0x1792a2){_0x293e7a=_0x293e7a-0x0;var _0xb78342=_0xbc02[_0x293e7a];return _0xb78342;};'use strict';var util=require(_0x2bc0('0x0'));var BPromise=require(_0x2bc0('0x1'));var jayson=require(_0x2bc0('0x2'));var _=require(_0x2bc0('0x3'));var logger=require(_0x2bc0('0x4'))(_0x2bc0('0x5'));var client=jayson[_0x2bc0('0x6')][_0x2bc0('0x7')]({'port':0x232a});function request(_0x3d79ce,_0x3689ed){return new BPromise(function(_0x1441ea,_0x2425bd){return client[_0x2bc0('0x8')](_0x3d79ce,_0x3689ed)[_0x2bc0('0x9')](function(_0x235f61){if(_0x235f61[_0x2bc0('0xa')]){return _0x2425bd(_0x235f61[_0x2bc0('0xa')][_0x2bc0('0xb')]);}else{return _0x1441ea(_0x235f61[_0x2bc0('0xc')]);}})[_0x2bc0('0xd')](function(_0x228a0e){return _0x2425bd(_0x228a0e);});});}exports[_0x2bc0('0xe')]=function(_0x103d3e,_0x211365,_0x48a8dd){return function(_0x10b333){if(_0x48a8dd['rules']&&!_0x48a8dd[_0x2bc0('0xf')][_0x103d3e]){logger[_0x2bc0('0x10')](_0x2bc0('0x11'),_0x103d3e);return _0x10b333[_0x2bc0('0x12')]();}var _0x1c6343=[];for(var _0x357402=0x0;_0x357402<_0x211365[_0x2bc0('0x13')];_0x357402+=0x1){_0x1c6343['push'](request(_0x2bc0('0x14'),{'command':util[_0x2bc0('0x15')]('iftime\x20%s',_0x211365[_0x357402])})['then'](function(_0x512cef){return _0x512cef&&_0x512cef['message']&&_0x512cef[_0x2bc0('0xb')][_0x2bc0('0x16')](_0x2bc0('0x17'))>=0x0?!![]:![];})[_0x2bc0('0xd')](function(_0x9398ce){logger[_0x2bc0('0xa')](_0x2bc0('0x18'),_0x103d3e,_0x211365[_0x357402]);}));}BPromise[_0x2bc0('0x19')](_0x1c6343)['then'](function(_0x5839ad){var _0x3e91aa=_[_0x2bc0('0x1a')](_0x5839ad);logger['info'](_0x2bc0('0x1b'),_0x103d3e,_0x211365[_0x2bc0('0x1c')]('\x20|\x20'),_0x3e91aa);_0x10b333['when'](_0x3e91aa);})[_0x2bc0('0xd')](function(_0x1745f3){console[_0x2bc0('0x1d')](_0x1745f3);logger[_0x2bc0('0xa')](_0x2bc0('0x1b'),_0x103d3e,_0x211365[_0x2bc0('0x1c')](_0x2bc0('0x1e')),_0x1745f3[_0x2bc0('0x1f')]);_0x10b333[_0x2bc0('0x12')]();});};}; \ No newline at end of file +var _0x49b6=['[%s][INTERVAL]\x20%s','all','then','some','info','when','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','bluebird','jayson/promise','lodash','../../../config/logger','routing','request','error','message','catch','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','iftime\x20%s','true'];(function(_0x530db1,_0x2b9531){var _0x31c1f2=function(_0x1c77b3){while(--_0x1c77b3){_0x530db1['push'](_0x530db1['shift']());}};_0x31c1f2(++_0x2b9531);}(_0x49b6,0xaa));var _0x649b=function(_0x16270b,_0x4ff120){_0x16270b=_0x16270b-0x0;var _0x2cd122=_0x49b6[_0x16270b];return _0x2cd122;};'use strict';var util=require('util');var BPromise=require(_0x649b('0x0'));var jayson=require(_0x649b('0x1'));var _=require(_0x649b('0x2'));var logger=require(_0x649b('0x3'))(_0x649b('0x4'));var client=jayson['client']['http']({'port':0x232a});function request(_0xa68abb,_0x361d85){return new BPromise(function(_0x5848ff,_0x3bc09b){return client[_0x649b('0x5')](_0xa68abb,_0x361d85)['then'](function(_0x420cc9){if(_0x420cc9[_0x649b('0x6')]){return _0x3bc09b(_0x420cc9[_0x649b('0x6')][_0x649b('0x7')]);}else{return _0x5848ff(_0x420cc9['result']);}})[_0x649b('0x8')](function(_0x3b53e0){return _0x3bc09b(_0x3b53e0);});});}exports[_0x649b('0x9')]=function(_0x2ff518,_0x62413e,_0x23c58a){return function(_0x104b78){if(_0x23c58a[_0x649b('0xa')]&&!_0x23c58a[_0x649b('0xa')][_0x2ff518]){logger['info'](_0x649b('0xb'),_0x2ff518);return _0x104b78[_0x649b('0xc')]();}var _0x47e4c9=[];for(var _0x1b6d97=0x0;_0x1b6d97<_0x62413e[_0x649b('0xd')];_0x1b6d97+=0x1){_0x47e4c9[_0x649b('0xe')](request(_0x649b('0xf'),{'command':util[_0x649b('0x10')](_0x649b('0x11'),_0x62413e[_0x1b6d97])})['then'](function(_0x184b0f){return _0x184b0f&&_0x184b0f[_0x649b('0x7')]&&_0x184b0f[_0x649b('0x7')]['indexOf'](_0x649b('0x12'))>=0x0?!![]:![];})[_0x649b('0x8')](function(_0x175e54){logger['error'](_0x649b('0x13'),_0x2ff518,_0x62413e[_0x1b6d97]);}));}BPromise[_0x649b('0x14')](_0x47e4c9)[_0x649b('0x15')](function(_0x197350){var _0x3e675a=_[_0x649b('0x16')](_0x197350);logger[_0x649b('0x17')]('[%s][INTERVAL]\x20%s\x20%s',_0x2ff518,_0x62413e['join']('\x20|\x20'),_0x3e675a);_0x104b78[_0x649b('0x18')](_0x3e675a);})['catch'](function(_0x4badfb){console['log'](_0x4badfb);logger[_0x649b('0x6')](_0x649b('0x19'),_0x2ff518,_0x62413e['join'](_0x649b('0x1a')),_0x4badfb['stack']);_0x104b78[_0x649b('0xc')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index c10e218..2d30089 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 _0x45d8=['connectedlinenum','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','membername','agentcomplete','agentcompleteAt','agentconnectAt','complete','blindtransfer','transfer','transfereruniqueid','transfertype','blind','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','transferexten','agententerreason','transfereeuniqueid','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','diffTime','agent','lodash','util','./utils','info','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','channel','queue','calleridnum','lastevent','getVoiceQueueByName','then','type','agentacw','acwtime','acwTimeout','request','CreateVoiceAgentReport','uniqueid','destuniqueid','agentcalled','agentcalledAt','now','connectedlinename','error','stack','isNil','agentringnoanswer','timeout','holdtime','ringtime','queuecallerabandon','forIn','agentringnoanswerAt','reason','abandoned','talktime'];(function(_0xbc1a4b,_0x4dfbe4){var _0x108b87=function(_0x409062){while(--_0x409062){_0xbc1a4b['push'](_0xbc1a4b['shift']());}};_0x108b87(++_0x4dfbe4);}(_0x45d8,0x174));var _0x845d=function(_0x198d2a,_0x510eb7){_0x198d2a=_0x198d2a-0x0;var _0xfda34d=_0x45d8[_0x198d2a];return _0xfda34d;};'use strict';var _=require(_0x845d('0x0'));var util=require(_0x845d('0x1'));var utils=require(_0x845d('0x2'));var agents={};var transfers={};function writeDB(_0x257454,_0x2d79c4){utils[_0x845d('0x3')](util['format'](_0x845d('0x4'),_0x257454['uniqueid'],_0x257454[_0x845d('0x5')],_0x257454[_0x845d('0x6')],_0x257454['membername'],_0x257454['interface'],_0x257454[_0x845d('0x7')],_0x257454['connectedlinenum'],_0x257454[_0x845d('0x8')]));if(_0x257454[_0x845d('0x6')]){utils[_0x845d('0x9')](_0x257454[_0x845d('0x6')])[_0x845d('0xa')](function(_0x474281){if(_0x474281){_0x257454['type']=_0x474281[_0x845d('0xb')];_0x257454[_0x845d('0xc')]=_0x257454['agentcomplete']?_0x474281['acw']:![];_0x257454[_0x845d('0xd')]=_0x257454[_0x845d('0xc')]?_0x474281[_0x845d('0xe')]:0x0;}utils[_0x845d('0xf')](_0x845d('0x10'),_0x257454);});}else{utils['request'](_0x845d('0x10'),_0x257454);}if(_0x2d79c4){delete transfers[_0x257454[_0x845d('0x11')]];}else{delete agents[_0x257454[_0x845d('0x12')]];}}exports[_0x845d('0x13')]=function(_0x5dbb1a){try{agents[_0x5dbb1a['destuniqueid']]=_0x5dbb1a;agents[_0x5dbb1a[_0x845d('0x12')]][_0x845d('0x14')]=utils[_0x845d('0x15')]();agents[_0x5dbb1a['destuniqueid']][_0x845d('0x8')]='called';agents[_0x5dbb1a[_0x845d('0x12')]]['connectedlinenum']=null;agents[_0x5dbb1a[_0x845d('0x12')]][_0x845d('0x16')]=null;}catch(_0xbf78ce){utils[_0x845d('0x17')](_0xbf78ce[_0x845d('0x18')]);}};exports['agentringnoanswer']=function(_0x4ed4d7){try{if(!_[_0x845d('0x19')](agents[_0x4ed4d7[_0x845d('0x12')]])){agents[_0x4ed4d7[_0x845d('0x12')]][_0x845d('0x1a')]=!![];agents[_0x4ed4d7[_0x845d('0x12')]]['agentringnoanswerAt']=utils[_0x845d('0x15')]();agents[_0x4ed4d7[_0x845d('0x12')]][_0x845d('0x8')]=_0x845d('0x1b');agents[_0x4ed4d7[_0x845d('0x12')]]['reason']=_0x845d('0x1b');agents[_0x4ed4d7[_0x845d('0x12')]][_0x845d('0x1c')]=_0x4ed4d7[_0x845d('0x1d')]?parseInt(_0x4ed4d7[_0x845d('0x1d')])/0x3e8:0x0;agents[_0x4ed4d7[_0x845d('0x12')]]['talktime']=0x0;writeDB(agents[_0x4ed4d7[_0x845d('0x12')]]);}}catch(_0x2feec0){utils[_0x845d('0x17')](_0x2feec0['stack']);}};exports[_0x845d('0x1e')]=function(_0x7daf52){try{_[_0x845d('0x1f')](agents,function(_0x332e59,_0x358429){if(_0x332e59['uniqueid']==_0x7daf52[_0x845d('0x11')]){_0x332e59['agentringnoanswer']=!![];_0x332e59[_0x845d('0x20')]=utils[_0x845d('0x15')]();_0x332e59['lastevent']='abandoned';_0x332e59[_0x845d('0x21')]=_0x845d('0x22');_0x332e59[_0x845d('0x1c')]=_0x7daf52[_0x845d('0x1c')];_0x332e59[_0x845d('0x23')]=0x0;writeDB(_0x332e59);}});}catch(_0x5a1adb){utils[_0x845d('0x17')](_0x5a1adb[_0x845d('0x18')]);}};exports['agentconnect']=function(_0x48d4cd){try{if(agents[_0x48d4cd['destuniqueid']]){agents[_0x48d4cd[_0x845d('0x12')]]['agentconnectAt']=utils['now']();agents[_0x48d4cd[_0x845d('0x12')]][_0x845d('0x24')]=_0x48d4cd[_0x845d('0x24')];agents[_0x48d4cd['destuniqueid']][_0x845d('0x16')]=_0x48d4cd[_0x845d('0x16')];agents[_0x48d4cd[_0x845d('0x12')]]['holdtime']=_0x48d4cd[_0x845d('0x1d')];agents[_0x48d4cd['destuniqueid']][_0x845d('0x8')]=_0x845d('0x25');_[_0x845d('0x1f')](agents,function(_0x14c503,_0x142c0f){if(_0x14c503['destuniqueid']!=_0x48d4cd['destuniqueid']&&_0x14c503[_0x845d('0x11')]==_0x48d4cd[_0x845d('0x11')]){_0x14c503[_0x845d('0x23')]=0x0;_0x14c503[_0x845d('0x1c')]=_0x48d4cd['ringtime'];_0x14c503['agentringnoanswer']=!![];_0x14c503[_0x845d('0x20')]=utils['now']();_0x14c503[_0x845d('0x8')]='answered_elsewhere';_0x14c503[_0x845d('0x21')]=_0x845d('0x26');_0x14c503[_0x845d('0x27')]=_0x48d4cd['destuniqueid'];_0x14c503[_0x845d('0x28')]=_0x48d4cd[_0x845d('0x29')];writeDB(_0x14c503);}});}}catch(_0x4ade0d){utils[_0x845d('0x17')](_0x4ade0d[_0x845d('0x18')]);}};exports[_0x845d('0x2a')]=function(_0x22d62a){try{if(!_[_0x845d('0x19')](agents[_0x22d62a[_0x845d('0x12')]])){agents[_0x22d62a['destuniqueid']][_0x845d('0x2a')]=!![];agents[_0x22d62a['destuniqueid']][_0x845d('0x2b')]=utils[_0x845d('0x15')]();agents[_0x22d62a[_0x845d('0x12')]][_0x845d('0x23')]=utils['diffTime'](agents[_0x22d62a[_0x845d('0x12')]][_0x845d('0x2b')],agents[_0x22d62a[_0x845d('0x12')]][_0x845d('0x2c')]);agents[_0x22d62a[_0x845d('0x12')]][_0x845d('0x21')]=_0x22d62a[_0x845d('0x21')];agents[_0x22d62a['destuniqueid']]['lastevent']=_0x845d('0x2d');writeDB(agents[_0x22d62a['destuniqueid']]);}}catch(_0x53096d){utils[_0x845d('0x17')](_0x53096d[_0x845d('0x18')]);}};exports[_0x845d('0x2e')]=function(_0x2553ff){try{if(!_[_0x845d('0x19')](agents[_0x2553ff['transfereruniqueid']])){agents[_0x2553ff['transfereruniqueid']][_0x845d('0x2f')]=!![];agents[_0x2553ff[_0x845d('0x30')]][_0x845d('0x31')]=_0x845d('0x32');agents[_0x2553ff[_0x845d('0x30')]]['transferexten']=_0x2553ff['extension'];agents[_0x2553ff[_0x845d('0x30')]][_0x845d('0x33')]=agents[_0x2553ff[_0x845d('0x30')]][_0x845d('0x11')];}}catch(_0x34213b){utils[_0x845d('0x17')](_0x34213b[_0x845d('0x18')]);}};exports[_0x845d('0x34')]=function(_0x2d335c){try{if(_0x2d335c[_0x845d('0x35')]==_0x2d335c[_0x845d('0x36')]){if(!_[_0x845d('0x19')](agents[_0x2d335c[_0x845d('0x37')]])){agents[_0x2d335c[_0x845d('0x37')]]['transfer']=!![];agents[_0x2d335c[_0x845d('0x37')]][_0x845d('0x31')]=_0x845d('0x38');agents[_0x2d335c[_0x845d('0x37')]][_0x845d('0x39')]=_0x2d335c['origtransfererexten'];agents[_0x2d335c[_0x845d('0x37')]][_0x845d('0x33')]=_0x2d335c[_0x845d('0x35')];}if(_0x2d335c['transfereeuniqueid']&&agents[_0x2d335c['transfereeuniqueid']]){agents[_0x2d335c['transfereeuniqueid']][_0x845d('0x3a')]=0x1;transfers[_0x2d335c[_0x845d('0x3b')]]=_[_0x845d('0x3c')](agents[_0x2d335c[_0x845d('0x3b')]]);transfers[_0x2d335c[_0x845d('0x3b')]]['calleridnum']=agents[_0x2d335c[_0x845d('0x37')]][_0x845d('0x7')];transfers[_0x2d335c[_0x845d('0x3b')]][_0x845d('0x3d')]=agents[_0x2d335c[_0x845d('0x37')]]['calleridname'];transfers[_0x2d335c['transfereeuniqueid']]['agentcalledAt']=utils['now']();transfers[_0x2d335c[_0x845d('0x3b')]]['agentconnectAt']=utils['now']();transfers[_0x2d335c[_0x845d('0x3b')]]['holdtime']=0x0;transfers[_0x2d335c[_0x845d('0x3b')]][_0x845d('0x3a')]=0x2;}}else if(_0x2d335c['secondtransfereruniqueid']==_0x2d335c[_0x845d('0x3e')]){if(!_[_0x845d('0x19')](agents[_0x2d335c[_0x845d('0x35')]])){agents[_0x2d335c['origtransfereruniqueid']][_0x845d('0x2f')]=!![];agents[_0x2d335c[_0x845d('0x35')]]['transfertype']=_0x845d('0x38');agents[_0x2d335c[_0x845d('0x35')]]['transferexten']=_0x2d335c[_0x845d('0x3f')];agents[_0x2d335c[_0x845d('0x35')]][_0x845d('0x33')]=_0x2d335c[_0x845d('0x37')];}if(_0x2d335c[_0x845d('0x40')]&&agents[_0x2d335c[_0x845d('0x40')]]){agents[_0x2d335c[_0x845d('0x40')]][_0x845d('0x3a')]=0x1;transfers[_0x2d335c[_0x845d('0x40')]]=_['clone'](agents[_0x2d335c['transfertargetuniqueid']]);transfers[_0x2d335c[_0x845d('0x40')]][_0x845d('0x7')]=agents[_0x2d335c[_0x845d('0x35')]]['calleridnum'];transfers[_0x2d335c[_0x845d('0x40')]][_0x845d('0x3d')]=agents[_0x2d335c[_0x845d('0x35')]][_0x845d('0x3d')];transfers[_0x2d335c[_0x845d('0x40')]]['agentcalledAt']=utils[_0x845d('0x15')]();transfers[_0x2d335c['transfertargetuniqueid']][_0x845d('0x2c')]=utils[_0x845d('0x15')]();transfers[_0x2d335c[_0x845d('0x40')]][_0x845d('0x1c')]=0x0;transfers[_0x2d335c[_0x845d('0x40')]][_0x845d('0x3a')]=0x2;}}}catch(_0x30d52e){utils['error'](_0x30d52e[_0x845d('0x18')]);}};exports[_0x845d('0x41')]=function(_0x5ae159){try{if(transfers[_0x5ae159['uniqueid']]){transfers[_0x5ae159[_0x845d('0x11')]]['agentcomplete']=!![];transfers[_0x5ae159[_0x845d('0x11')]]['agentcompleteAt']=utils['now']();transfers[_0x5ae159[_0x845d('0x11')]][_0x845d('0x23')]=utils[_0x845d('0x42')](transfers[_0x5ae159[_0x845d('0x11')]][_0x845d('0x2b')],transfers[_0x5ae159[_0x845d('0x11')]][_0x845d('0x2c')]);transfers[_0x5ae159[_0x845d('0x11')]][_0x845d('0x21')]=_0x845d('0x43');transfers[_0x5ae159[_0x845d('0x11')]][_0x845d('0x8')]=_0x845d('0x2d');writeDB(transfers[_0x5ae159['uniqueid']],!![]);}if(agents[_0x5ae159[_0x845d('0x11')]]&&agents[_0x5ae159[_0x845d('0x11')]][_0x845d('0x2c')]){agents[_0x5ae159[_0x845d('0x11')]]['agentcomplete']=!![];agents[_0x5ae159[_0x845d('0x11')]]['agentcompleteAt']=utils['now']();agents[_0x5ae159[_0x845d('0x11')]][_0x845d('0x23')]=utils[_0x845d('0x42')](agents[_0x5ae159[_0x845d('0x11')]][_0x845d('0x2b')],agents[_0x5ae159[_0x845d('0x11')]][_0x845d('0x2c')]);agents[_0x5ae159[_0x845d('0x11')]][_0x845d('0x21')]=agents[_0x5ae159[_0x845d('0x11')]][_0x845d('0x2f')]?_0x845d('0x2f'):_0x845d('0x43');agents[_0x5ae159[_0x845d('0x11')]]['lastevent']='complete';writeDB(agents[_0x5ae159[_0x845d('0x11')]]);}}catch(_0x427f60){utils[_0x845d('0x17')](_0x427f60[_0x845d('0x18')]);}}; \ No newline at end of file +var _0xf567=['agententerreason','clone','ATTENDED','secondtransfererexten','transfertargetuniqueid','calleridname','hangup','agent','lodash','util','./utils','info','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','queue','interface','calleridnum','connectedlinenum','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','agentcalledAt','now','called','connectedlinename','stack','isNil','agentringnoanswer','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','error','forIn','abandoned','agentconnect','agentconnectAt','lastevent','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','membername','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','transferuniqueid','secondtransfereruniqueid','origtransfereruniqueid','transfereeuniqueid'];(function(_0x970c4,_0x512095){var _0x4d3ae5=function(_0x18391f){while(--_0x18391f){_0x970c4['push'](_0x970c4['shift']());}};_0x4d3ae5(++_0x512095);}(_0xf567,0x118));var _0x7f56=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xf567[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x7f56('0x0'));var util=require(_0x7f56('0x1'));var utils=require(_0x7f56('0x2'));var agents={};var transfers={};function writeDB(_0x543f60,_0x1cba45){utils[_0x7f56('0x3')](util['format'](_0x7f56('0x4'),_0x543f60[_0x7f56('0x5')],_0x543f60[_0x7f56('0x6')],_0x543f60[_0x7f56('0x7')],_0x543f60['membername'],_0x543f60[_0x7f56('0x8')],_0x543f60[_0x7f56('0x9')],_0x543f60[_0x7f56('0xa')],_0x543f60['lastevent']));if(_0x543f60[_0x7f56('0x7')]){utils[_0x7f56('0xb')](_0x543f60[_0x7f56('0x7')])[_0x7f56('0xc')](function(_0x3ac422){if(_0x3ac422){_0x543f60[_0x7f56('0xd')]=_0x3ac422[_0x7f56('0xd')];_0x543f60[_0x7f56('0xe')]=_0x543f60[_0x7f56('0xf')]?_0x3ac422[_0x7f56('0x10')]:![];_0x543f60[_0x7f56('0x11')]=_0x543f60[_0x7f56('0xe')]?_0x3ac422[_0x7f56('0x12')]:0x0;}utils[_0x7f56('0x13')](_0x7f56('0x14'),_0x543f60);});}else{utils[_0x7f56('0x13')](_0x7f56('0x14'),_0x543f60);}if(_0x1cba45){delete transfers[_0x543f60[_0x7f56('0x5')]];}else{delete agents[_0x543f60[_0x7f56('0x15')]];}}exports[_0x7f56('0x16')]=function(_0x1fefee){try{agents[_0x1fefee[_0x7f56('0x15')]]=_0x1fefee;agents[_0x1fefee['destuniqueid']][_0x7f56('0x17')]=utils[_0x7f56('0x18')]();agents[_0x1fefee[_0x7f56('0x15')]]['lastevent']=_0x7f56('0x19');agents[_0x1fefee[_0x7f56('0x15')]]['connectedlinenum']=null;agents[_0x1fefee[_0x7f56('0x15')]][_0x7f56('0x1a')]=null;}catch(_0x4ad41a){utils['error'](_0x4ad41a[_0x7f56('0x1b')]);}};exports['agentringnoanswer']=function(_0x415b6f){try{if(!_[_0x7f56('0x1c')](agents[_0x415b6f['destuniqueid']])){agents[_0x415b6f[_0x7f56('0x15')]][_0x7f56('0x1d')]=!![];agents[_0x415b6f[_0x7f56('0x15')]][_0x7f56('0x1e')]=utils[_0x7f56('0x18')]();agents[_0x415b6f[_0x7f56('0x15')]]['lastevent']=_0x7f56('0x1f');agents[_0x415b6f['destuniqueid']][_0x7f56('0x20')]='timeout';agents[_0x415b6f[_0x7f56('0x15')]][_0x7f56('0x21')]=_0x415b6f[_0x7f56('0x22')]?parseInt(_0x415b6f[_0x7f56('0x22')])/0x3e8:0x0;agents[_0x415b6f[_0x7f56('0x15')]][_0x7f56('0x23')]=0x0;writeDB(agents[_0x415b6f[_0x7f56('0x15')]]);}}catch(_0x3f54f8){utils[_0x7f56('0x24')](_0x3f54f8[_0x7f56('0x1b')]);}};exports['queuecallerabandon']=function(_0x19bc9f){try{_[_0x7f56('0x25')](agents,function(_0x2943fe,_0x3c8658){if(_0x2943fe[_0x7f56('0x5')]==_0x19bc9f[_0x7f56('0x5')]){_0x2943fe[_0x7f56('0x1d')]=!![];_0x2943fe['agentringnoanswerAt']=utils['now']();_0x2943fe['lastevent']=_0x7f56('0x26');_0x2943fe['reason']=_0x7f56('0x26');_0x2943fe[_0x7f56('0x21')]=_0x19bc9f[_0x7f56('0x21')];_0x2943fe['talktime']=0x0;writeDB(_0x2943fe);}});}catch(_0x236120){utils[_0x7f56('0x24')](_0x236120[_0x7f56('0x1b')]);}};exports[_0x7f56('0x27')]=function(_0x5ea887){try{if(agents[_0x5ea887[_0x7f56('0x15')]]){agents[_0x5ea887[_0x7f56('0x15')]][_0x7f56('0x28')]=utils['now']();agents[_0x5ea887[_0x7f56('0x15')]][_0x7f56('0xa')]=_0x5ea887['connectedlinenum'];agents[_0x5ea887['destuniqueid']]['connectedlinename']=_0x5ea887[_0x7f56('0x1a')];agents[_0x5ea887['destuniqueid']]['holdtime']=_0x5ea887[_0x7f56('0x22')];agents[_0x5ea887['destuniqueid']][_0x7f56('0x29')]=_0x7f56('0x2a');_[_0x7f56('0x25')](agents,function(_0x523805,_0x134cfb){if(_0x523805[_0x7f56('0x15')]!=_0x5ea887[_0x7f56('0x15')]&&_0x523805['uniqueid']==_0x5ea887[_0x7f56('0x5')]){_0x523805[_0x7f56('0x23')]=0x0;_0x523805[_0x7f56('0x21')]=_0x5ea887[_0x7f56('0x22')];_0x523805[_0x7f56('0x1d')]=!![];_0x523805[_0x7f56('0x1e')]=utils[_0x7f56('0x18')]();_0x523805[_0x7f56('0x29')]=_0x7f56('0x2b');_0x523805[_0x7f56('0x20')]=_0x7f56('0x2b');_0x523805[_0x7f56('0x2c')]=_0x5ea887['destuniqueid'];_0x523805['answeredelsewheremembername']=_0x5ea887[_0x7f56('0x2d')];writeDB(_0x523805);}});}}catch(_0x5f22b2){utils[_0x7f56('0x24')](_0x5f22b2[_0x7f56('0x1b')]);}};exports['agentcomplete']=function(_0x444c9b){try{if(!_[_0x7f56('0x1c')](agents[_0x444c9b['destuniqueid']])){agents[_0x444c9b[_0x7f56('0x15')]][_0x7f56('0xf')]=!![];agents[_0x444c9b['destuniqueid']][_0x7f56('0x2e')]=utils[_0x7f56('0x18')]();agents[_0x444c9b[_0x7f56('0x15')]]['talktime']=utils[_0x7f56('0x2f')](agents[_0x444c9b['destuniqueid']][_0x7f56('0x2e')],agents[_0x444c9b['destuniqueid']][_0x7f56('0x28')]);agents[_0x444c9b[_0x7f56('0x15')]]['reason']=_0x444c9b['reason'];agents[_0x444c9b['destuniqueid']][_0x7f56('0x29')]=_0x7f56('0x30');writeDB(agents[_0x444c9b['destuniqueid']]);}}catch(_0x471e8b){utils[_0x7f56('0x24')](_0x471e8b[_0x7f56('0x1b')]);}};exports[_0x7f56('0x31')]=function(_0x3aaf4d){try{if(!_[_0x7f56('0x1c')](agents[_0x3aaf4d[_0x7f56('0x32')]])){agents[_0x3aaf4d[_0x7f56('0x32')]][_0x7f56('0x33')]=!![];agents[_0x3aaf4d[_0x7f56('0x32')]][_0x7f56('0x34')]=_0x7f56('0x35');agents[_0x3aaf4d[_0x7f56('0x32')]][_0x7f56('0x36')]=_0x3aaf4d[_0x7f56('0x37')];agents[_0x3aaf4d[_0x7f56('0x32')]][_0x7f56('0x38')]=agents[_0x3aaf4d[_0x7f56('0x32')]][_0x7f56('0x5')];}}catch(_0xe02966){utils[_0x7f56('0x24')](_0xe02966[_0x7f56('0x1b')]);}};exports['attendedtransfer']=function(_0x2df274){try{if(_0x2df274['origtransfereruniqueid']==_0x2df274['origtransfererlinkedid']){if(!_[_0x7f56('0x1c')](agents[_0x2df274[_0x7f56('0x39')]])){agents[_0x2df274[_0x7f56('0x39')]][_0x7f56('0x33')]=!![];agents[_0x2df274[_0x7f56('0x39')]][_0x7f56('0x34')]='ATTENDED';agents[_0x2df274[_0x7f56('0x39')]][_0x7f56('0x36')]=_0x2df274['origtransfererexten'];agents[_0x2df274[_0x7f56('0x39')]][_0x7f56('0x38')]=_0x2df274[_0x7f56('0x3a')];}if(_0x2df274[_0x7f56('0x3b')]&&agents[_0x2df274[_0x7f56('0x3b')]]){agents[_0x2df274[_0x7f56('0x3b')]][_0x7f56('0x3c')]=0x1;transfers[_0x2df274[_0x7f56('0x3b')]]=_[_0x7f56('0x3d')](agents[_0x2df274[_0x7f56('0x3b')]]);transfers[_0x2df274[_0x7f56('0x3b')]]['calleridnum']=agents[_0x2df274['secondtransfereruniqueid']][_0x7f56('0x9')];transfers[_0x2df274[_0x7f56('0x3b')]]['calleridname']=agents[_0x2df274[_0x7f56('0x39')]]['calleridname'];transfers[_0x2df274[_0x7f56('0x3b')]][_0x7f56('0x17')]=utils[_0x7f56('0x18')]();transfers[_0x2df274['transfereeuniqueid']][_0x7f56('0x28')]=utils['now']();transfers[_0x2df274['transfereeuniqueid']][_0x7f56('0x21')]=0x0;transfers[_0x2df274[_0x7f56('0x3b')]]['agententerreason']=0x2;}}else if(_0x2df274[_0x7f56('0x39')]==_0x2df274['secondtransfererlinkedid']){if(!_[_0x7f56('0x1c')](agents[_0x2df274[_0x7f56('0x3a')]])){agents[_0x2df274[_0x7f56('0x3a')]][_0x7f56('0x33')]=!![];agents[_0x2df274['origtransfereruniqueid']][_0x7f56('0x34')]=_0x7f56('0x3e');agents[_0x2df274[_0x7f56('0x3a')]][_0x7f56('0x36')]=_0x2df274[_0x7f56('0x3f')];agents[_0x2df274[_0x7f56('0x3a')]][_0x7f56('0x38')]=_0x2df274[_0x7f56('0x39')];}if(_0x2df274[_0x7f56('0x40')]&&agents[_0x2df274['transfertargetuniqueid']]){agents[_0x2df274['transfertargetuniqueid']][_0x7f56('0x3c')]=0x1;transfers[_0x2df274['transfertargetuniqueid']]=_[_0x7f56('0x3d')](agents[_0x2df274[_0x7f56('0x40')]]);transfers[_0x2df274['transfertargetuniqueid']][_0x7f56('0x9')]=agents[_0x2df274[_0x7f56('0x3a')]]['calleridnum'];transfers[_0x2df274[_0x7f56('0x40')]][_0x7f56('0x41')]=agents[_0x2df274[_0x7f56('0x3a')]]['calleridname'];transfers[_0x2df274[_0x7f56('0x40')]][_0x7f56('0x17')]=utils[_0x7f56('0x18')]();transfers[_0x2df274[_0x7f56('0x40')]]['agentconnectAt']=utils[_0x7f56('0x18')]();transfers[_0x2df274['transfertargetuniqueid']][_0x7f56('0x21')]=0x0;transfers[_0x2df274[_0x7f56('0x40')]][_0x7f56('0x3c')]=0x2;}}}catch(_0x39de6e){utils[_0x7f56('0x24')](_0x39de6e[_0x7f56('0x1b')]);}};exports[_0x7f56('0x42')]=function(_0x250315){try{if(transfers[_0x250315[_0x7f56('0x5')]]){transfers[_0x250315[_0x7f56('0x5')]][_0x7f56('0xf')]=!![];transfers[_0x250315[_0x7f56('0x5')]][_0x7f56('0x2e')]=utils[_0x7f56('0x18')]();transfers[_0x250315[_0x7f56('0x5')]][_0x7f56('0x23')]=utils[_0x7f56('0x2f')](transfers[_0x250315[_0x7f56('0x5')]]['agentcompleteAt'],transfers[_0x250315[_0x7f56('0x5')]][_0x7f56('0x28')]);transfers[_0x250315['uniqueid']][_0x7f56('0x20')]='agent';transfers[_0x250315[_0x7f56('0x5')]]['lastevent']=_0x7f56('0x30');writeDB(transfers[_0x250315['uniqueid']],!![]);}if(agents[_0x250315[_0x7f56('0x5')]]&&agents[_0x250315[_0x7f56('0x5')]][_0x7f56('0x28')]){agents[_0x250315['uniqueid']][_0x7f56('0xf')]=!![];agents[_0x250315[_0x7f56('0x5')]][_0x7f56('0x2e')]=utils[_0x7f56('0x18')]();agents[_0x250315[_0x7f56('0x5')]][_0x7f56('0x23')]=utils[_0x7f56('0x2f')](agents[_0x250315[_0x7f56('0x5')]][_0x7f56('0x2e')],agents[_0x250315[_0x7f56('0x5')]][_0x7f56('0x28')]);agents[_0x250315[_0x7f56('0x5')]][_0x7f56('0x20')]=agents[_0x250315[_0x7f56('0x5')]][_0x7f56('0x33')]?_0x7f56('0x33'):_0x7f56('0x43');agents[_0x250315[_0x7f56('0x5')]][_0x7f56('0x29')]=_0x7f56('0x30');writeDB(agents[_0x250315[_0x7f56('0x5')]]);}}catch(_0xab66a7){utils[_0x7f56('0x24')](_0xab66a7[_0x7f56('0x1b')]);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index d5b6885..f2514af 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 _0xbe49=['info','format','CALL|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','accountcode','source','destination','callerid','getUserByInternal','then','request','newchannel','linkedid','OutgoingSpoolFailed','context','now','DOCUMENTATION','error','newstate','isNil','channelstate','systemanswertime','transfer','destinationchannel','answertime','toNumber','calleridname','calleridnum','duration','diffTime','endtime','starttime','billableseconds','stack','attendedtransfer','localtwolinkedid','transfereechannel','userfield','_attended','transfertargetchannel','musiconholdstart','musiconholdstartAt','musiconholdstop','varset','variable','xmd-originatecalleridnum','value','xmd-phone','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','lastdata','queue','xmd-contactid','xmd-cdrtype','type','outboundrouteid','sipcallid','newexten','toLowerCase','set','startsWith','appdata','cdr','split','substring','lastIndexOf','includes','hangup','noop','execif','application','lodash','util','FAILED','NO\x20ANSWER','ANSWERED','BUSY'];(function(_0x54c14d,_0x15affb){var _0x24dc77=function(_0x5001d8){while(--_0x5001d8){_0x54c14d['push'](_0x54c14d['shift']());}};_0x24dc77(++_0x15affb);}(_0xbe49,0x194));var _0x9be4=function(_0x59307e,_0x5c688a){_0x59307e=_0x59307e-0x0;var _0x570179=_0xbe49[_0x59307e];return _0x570179;};'use strict';var _=require(_0x9be4('0x0'));var util=require(_0x9be4('0x1'));var utils=require('./utils');var dispositions=['NO\x20ANSWER',_0x9be4('0x2'),_0x9be4('0x2'),_0x9be4('0x3'),_0x9be4('0x3'),'NO\x20ANSWER',_0x9be4('0x4'),_0x9be4('0x5'),_0x9be4('0x2'),_0x9be4('0x2'),_0x9be4('0x2')];var channels={};function writeDB(_0xee7ca0){utils[_0x9be4('0x6')](util[_0x9be4('0x7')](_0x9be4('0x8'),_0xee7ca0[_0x9be4('0x9')],_0xee7ca0[_0x9be4('0xa')],_0xee7ca0['type'],_0xee7ca0[_0x9be4('0xb')],_0xee7ca0[_0x9be4('0xc')],_0xee7ca0[_0x9be4('0xd')],_0xee7ca0[_0x9be4('0xe')],_0xee7ca0['disposition']));if(_0xee7ca0[_0x9be4('0xb')]){utils[_0x9be4('0xf')](_0xee7ca0['accountcode'])[_0x9be4('0x10')](function(_0x14b64c){if(_0x14b64c){_0xee7ca0['UserId']=_0x14b64c['id'];}utils[_0x9be4('0x11')]('CreateVoiceCallReport',_0xee7ca0);});}else{utils[_0x9be4('0x11')]('CreateVoiceCallReport',_0xee7ca0);}if(channels[_0xee7ca0['uniqueid']]){delete channels[_0xee7ca0[_0x9be4('0x9')]];}}exports[_0x9be4('0x12')]=function(_0x5816a0){try{if(_0x5816a0['uniqueid']==_0x5816a0[_0x9be4('0x13')]&&_0x5816a0[_0x9be4('0xa')]!=_0x9be4('0x14')){channels[_0x5816a0['uniqueid']]={'uniqueid':_0x5816a0['uniqueid'],'accountcode':_0x5816a0[_0x9be4('0xb')],'source':_0x5816a0['calleridnum'],'destination':_0x5816a0['exten'],'destinationcontext':_0x5816a0[_0x9be4('0x15')],'channel':_0x5816a0[_0x9be4('0xa')],'starttime':utils[_0x9be4('0x16')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x9be4('0x3'),'amaflags':_0x9be4('0x17')};}}catch(_0xcfe784){utils[_0x9be4('0x18')](_0xcfe784['stack']);}};exports[_0x9be4('0x19')]=function(_0x5a004){try{if(!_[_0x9be4('0x1a')](channels[_0x5a004[_0x9be4('0x9')]])&&_0x5a004[_0x9be4('0x1b')]==0x6){if(_[_0x9be4('0x1a')](channels[_0x5a004[_0x9be4('0x9')]][_0x9be4('0x1c')])){channels[_0x5a004[_0x9be4('0x9')]]['systemanswertime']=utils[_0x9be4('0x16')]();}}else if(!_['isNil'](channels[_0x5a004[_0x9be4('0x13')]])&&_0x5a004[_0x9be4('0x1b')]==0x6&&_0x5a004[_0x9be4('0x15')]!=_0x9be4('0x1d')){channels[_0x5a004[_0x9be4('0x13')]]['accountcode']=_0x5a004[_0x9be4('0xb')];channels[_0x5a004[_0x9be4('0x13')]][_0x9be4('0x1e')]=_0x5a004['channel'];if(_[_0x9be4('0x1a')](channels[_0x5a004[_0x9be4('0x13')]][_0x9be4('0x1f')])){channels[_0x5a004['linkedid']][_0x9be4('0x1f')]=utils['now']();}channels[_0x5a004[_0x9be4('0x13')]]['disposition']=dispositions[_[_0x9be4('0x20')](_0x5a004['channelstate'])]||'ANSWERED';}}catch(_0x4f8952){utils['error'](_0x4f8952['stack']);}};exports['hangup']=function(_0xfc7932){try{if(!_[_0x9be4('0x1a')](channels[_0xfc7932[_0x9be4('0x9')]])){if(_[_0x9be4('0x1a')](channels[_0xfc7932['uniqueid']]['callerid'])){channels[_0xfc7932[_0x9be4('0x9')]][_0x9be4('0xe')]=_0xfc7932[_0x9be4('0x21')]+'\x20<'+_0xfc7932[_0x9be4('0x22')]+'>';}channels[_0xfc7932[_0x9be4('0x9')]]['endtime']=utils[_0x9be4('0x16')]();channels[_0xfc7932[_0x9be4('0x9')]][_0x9be4('0x23')]=utils[_0x9be4('0x24')](channels[_0xfc7932['uniqueid']][_0x9be4('0x25')],channels[_0xfc7932[_0x9be4('0x9')]][_0x9be4('0x26')]);channels[_0xfc7932[_0x9be4('0x9')]][_0x9be4('0x27')]=channels[_0xfc7932[_0x9be4('0x9')]][_0x9be4('0x1f')]?utils[_0x9be4('0x24')](channels[_0xfc7932[_0x9be4('0x9')]][_0x9be4('0x25')],channels[_0xfc7932[_0x9be4('0x9')]][_0x9be4('0x1f')]):0x0;writeDB(channels[_0xfc7932['uniqueid']]);}}catch(_0x30c783){utils[_0x9be4('0x18')](_0x30c783[_0x9be4('0x28')]);}};exports[_0x9be4('0x29')]=function(_0x4574af){try{if(!_['isNil'](channels[_0x4574af[_0x9be4('0x2a')]])){if(channels[_0x4574af['localtwolinkedid']][_0x9be4('0xa')]==_0x4574af[_0x9be4('0x2b')]){channels[_0x4574af[_0x9be4('0x2a')]]['destinationchannel']=_0x4574af['secondtransfererchannel'];channels[_0x4574af[_0x9be4('0x2a')]][_0x9be4('0x2c')]=_0x9be4('0x2d');}else if(channels[_0x4574af[_0x9be4('0x2a')]][_0x9be4('0xa')]=_0x4574af[_0x9be4('0x2e')]){channels[_0x4574af[_0x9be4('0x2a')]][_0x9be4('0x1e')]=_0x4574af['origtransfererchannel'];channels[_0x4574af[_0x9be4('0x2a')]][_0x9be4('0x2c')]='_attended';}}}catch(_0xd6b0aa){utils[_0x9be4('0x18')](_0xd6b0aa[_0x9be4('0x28')]);}};exports[_0x9be4('0x2f')]=function(_0x5d09a9){try{if(!_[_0x9be4('0x1a')](channels[_0x5d09a9[_0x9be4('0x9')]])){channels[_0x5d09a9[_0x9be4('0x9')]][_0x9be4('0x30')]=utils['now']();}}catch(_0x4a4a7f){utils[_0x9be4('0x18')](_0x4a4a7f[_0x9be4('0x28')]);}};exports[_0x9be4('0x31')]=function(_0x33411e){try{if(!_[_0x9be4('0x1a')](channels[_0x33411e[_0x9be4('0x9')]])){if(!_[_0x9be4('0x1a')](channels[_0x33411e[_0x9be4('0x9')]][_0x9be4('0x30')])){channels[_0x33411e['uniqueid']]['mohtime']+=utils['diffTime'](utils[_0x9be4('0x16')](),channels[_0x33411e[_0x9be4('0x9')]][_0x9be4('0x30')]);delete channels[_0x33411e[_0x9be4('0x9')]][_0x9be4('0x30')];}}}catch(_0x53807a){utils[_0x9be4('0x18')](_0x53807a[_0x9be4('0x28')]);}};exports[_0x9be4('0x32')]=function(_0x22da1f){try{if(!_[_0x9be4('0x1a')](channels[_0x22da1f[_0x9be4('0x9')]])){if(!_['isNil'](_0x22da1f[_0x9be4('0x33')][_0x9be4('0x34')])){channels[_0x22da1f[_0x9be4('0x9')]][_0x9be4('0xc')]=_0x22da1f[_0x9be4('0x35')];}if(!_[_0x9be4('0x1a')](_0x22da1f[_0x9be4('0x33')][_0x9be4('0x36')])){channels[_0x22da1f['uniqueid']][_0x9be4('0xd')]=_0x22da1f[_0x9be4('0x35')];channels[_0x22da1f[_0x9be4('0x9')]][_0x9be4('0xe')]='\x22'+_0x22da1f[_0x9be4('0x35')]+_0x9be4('0x37')+_0x22da1f[_0x9be4('0x35')]+'>';}if(!_['isNil'](_0x22da1f['variable'][_0x9be4('0x38')])||!_['isNil'](_0x22da1f[_0x9be4('0x33')][_0x9be4('0x39')])){channels[_0x22da1f['uniqueid']][_0x9be4('0xe')]=_0x22da1f[_0x9be4('0x35')];}if(!_[_0x9be4('0x1a')](_0x22da1f[_0x9be4('0x33')][_0x9be4('0x3a')])||!_['isNil'](_0x22da1f[_0x9be4('0x33')][_0x9be4('0x3b')])){channels[_0x22da1f['uniqueid']][_0x9be4('0x3c')]='Queue';channels[_0x22da1f[_0x9be4('0x9')]][_0x9be4('0x3d')]=_0x22da1f[_0x9be4('0x35')];channels[_0x22da1f[_0x9be4('0x9')]][_0x9be4('0x3e')]=!![];}if(!_[_0x9be4('0x1a')](_0x22da1f[_0x9be4('0x33')][_0x9be4('0x3f')])){channels[_0x22da1f['uniqueid']]['ContactId']=_0x22da1f[_0x9be4('0x35')];}if(!_[_0x9be4('0x1a')](_0x22da1f[_0x9be4('0x33')][_0x9be4('0x40')])){channels[_0x22da1f[_0x9be4('0x9')]][_0x9be4('0x41')]=_0x22da1f[_0x9be4('0x35')];}if(!_[_0x9be4('0x1a')](_0x22da1f[_0x9be4('0x33')][_0x9be4('0x42')])){channels[_0x22da1f[_0x9be4('0x9')]]['routeid']=_0x22da1f[_0x9be4('0x35')];}if(!_[_0x9be4('0x1a')](_0x22da1f[_0x9be4('0x33')]['sipcallid'])){channels[_0x22da1f[_0x9be4('0x9')]][_0x9be4('0x43')]=_0x22da1f[_0x9be4('0x35')];}}}catch(_0x2013f7){utils[_0x9be4('0x18')](_0x2013f7[_0x9be4('0x28')]);}};exports[_0x9be4('0x44')]=function(_0x531db5){try{if(!_['isNil'](channels[_0x531db5[_0x9be4('0x9')]])){if(_0x531db5['application'][_0x9be4('0x45')]()==_0x9be4('0x46')&&_[_0x9be4('0x47')](_0x531db5[_0x9be4('0x48')][_0x9be4('0x45')](),_0x9be4('0x49'))){var _0x4bfc8e=_0x531db5[_0x9be4('0x48')][_0x9be4('0x4a')]('=');var _0x867da8=_0x4bfc8e[0x0][_0x9be4('0x4b')](_0x4bfc8e[0x0][_0x9be4('0x4c')]('(')+0x1,_0x4bfc8e[0x0]['lastIndexOf'](')'));var _0x4b57ad=_0x4bfc8e[0x1];channels[_0x531db5[_0x9be4('0x9')]][_0x867da8]=_0x4b57ad;}if(!_[_0x9be4('0x4d')]([_0x9be4('0x4e'),_0x9be4('0x4f'),_0x9be4('0x50'),'set','gotoif'],_0x531db5[_0x9be4('0x51')][_0x9be4('0x45')]())){channels[_0x531db5[_0x9be4('0x9')]][_0x9be4('0x3c')]=_0x531db5[_0x9be4('0x51')];channels[_0x531db5[_0x9be4('0x9')]][_0x9be4('0x3d')]=_0x531db5[_0x9be4('0x48')];}}}catch(_0x1885ad){utils[_0x9be4('0x18')](_0x1885ad['stack']);}}; \ No newline at end of file +var _0x91fc=['destination','callerid','disposition','getUserByInternal','then','UserId','CreateVoiceCallReport','request','newchannel','linkedid','calleridnum','exten','context','now','DOCUMENTATION','stack','newstate','isNil','channelstate','systemanswertime','transfer','answertime','toNumber','error','hangup','calleridname','duration','diffTime','endtime','billableseconds','attendedtransfer','transfereechannel','localtwolinkedid','destinationchannel','secondtransfererchannel','userfield','_attended','origtransfererchannel','musiconholdstart','musiconholdstartAt','mohtime','varset','variable','xmd-phone','value','\x22\x20<','xmd-callerid','xmd-queue','lastapplication','Queue','lastdata','queue','xmd-contactid','ContactId','xmd-cdrtype','sipcallid','newexten','set','startsWith','appdata','toLowerCase','cdr','split','lastIndexOf','includes','noop','gotoif','application','util','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','uniqueid','channel','type','accountcode','source'];(function(_0x350079,_0x510691){var _0x220852=function(_0x4e7d34){while(--_0x4e7d34){_0x350079['push'](_0x350079['shift']());}};_0x220852(++_0x510691);}(_0x91fc,0x134));var _0xc91f=function(_0x3d0870,_0x8e053c){_0x3d0870=_0x3d0870-0x0;var _0x3735bf=_0x91fc[_0x3d0870];return _0x3735bf;};'use strict';var _=require('lodash');var util=require(_0xc91f('0x0'));var utils=require('./utils');var dispositions=[_0xc91f('0x1'),_0xc91f('0x2'),_0xc91f('0x2'),_0xc91f('0x1'),'NO\x20ANSWER','NO\x20ANSWER',_0xc91f('0x3'),_0xc91f('0x4'),_0xc91f('0x2'),_0xc91f('0x2'),_0xc91f('0x2')];var channels={};function writeDB(_0x3a9d9e){utils[_0xc91f('0x5')](util[_0xc91f('0x6')]('CALL|%s|%s|%s|%s|%s|%s|%s|%s',_0x3a9d9e[_0xc91f('0x7')],_0x3a9d9e[_0xc91f('0x8')],_0x3a9d9e[_0xc91f('0x9')],_0x3a9d9e[_0xc91f('0xa')],_0x3a9d9e[_0xc91f('0xb')],_0x3a9d9e[_0xc91f('0xc')],_0x3a9d9e[_0xc91f('0xd')],_0x3a9d9e[_0xc91f('0xe')]));if(_0x3a9d9e[_0xc91f('0xa')]){utils[_0xc91f('0xf')](_0x3a9d9e[_0xc91f('0xa')])[_0xc91f('0x10')](function(_0x22b441){if(_0x22b441){_0x3a9d9e[_0xc91f('0x11')]=_0x22b441['id'];}utils['request'](_0xc91f('0x12'),_0x3a9d9e);});}else{utils[_0xc91f('0x13')](_0xc91f('0x12'),_0x3a9d9e);}if(channels[_0x3a9d9e[_0xc91f('0x7')]]){delete channels[_0x3a9d9e['uniqueid']];}}exports[_0xc91f('0x14')]=function(_0x469ef6){try{if(_0x469ef6[_0xc91f('0x7')]==_0x469ef6[_0xc91f('0x15')]&&_0x469ef6[_0xc91f('0x8')]!='OutgoingSpoolFailed'){channels[_0x469ef6[_0xc91f('0x7')]]={'uniqueid':_0x469ef6['uniqueid'],'accountcode':_0x469ef6[_0xc91f('0xa')],'source':_0x469ef6[_0xc91f('0x16')],'destination':_0x469ef6[_0xc91f('0x17')],'destinationcontext':_0x469ef6[_0xc91f('0x18')],'channel':_0x469ef6['channel'],'starttime':utils[_0xc91f('0x19')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0xc91f('0x1a')};}}catch(_0x4fc798){utils['error'](_0x4fc798[_0xc91f('0x1b')]);}};exports[_0xc91f('0x1c')]=function(_0x2e2703){try{if(!_[_0xc91f('0x1d')](channels[_0x2e2703[_0xc91f('0x7')]])&&_0x2e2703[_0xc91f('0x1e')]==0x6){if(_[_0xc91f('0x1d')](channels[_0x2e2703['uniqueid']][_0xc91f('0x1f')])){channels[_0x2e2703[_0xc91f('0x7')]]['systemanswertime']=utils[_0xc91f('0x19')]();}}else if(!_[_0xc91f('0x1d')](channels[_0x2e2703['linkedid']])&&_0x2e2703['channelstate']==0x6&&_0x2e2703[_0xc91f('0x18')]!=_0xc91f('0x20')){channels[_0x2e2703[_0xc91f('0x15')]][_0xc91f('0xa')]=_0x2e2703[_0xc91f('0xa')];channels[_0x2e2703[_0xc91f('0x15')]]['destinationchannel']=_0x2e2703[_0xc91f('0x8')];if(_['isNil'](channels[_0x2e2703[_0xc91f('0x15')]]['answertime'])){channels[_0x2e2703[_0xc91f('0x15')]][_0xc91f('0x21')]=utils['now']();}channels[_0x2e2703['linkedid']]['disposition']=dispositions[_[_0xc91f('0x22')](_0x2e2703['channelstate'])]||_0xc91f('0x3');}}catch(_0x4bc1a4){utils[_0xc91f('0x23')](_0x4bc1a4[_0xc91f('0x1b')]);}};exports[_0xc91f('0x24')]=function(_0x12fd23){try{if(!_[_0xc91f('0x1d')](channels[_0x12fd23['uniqueid']])){if(_[_0xc91f('0x1d')](channels[_0x12fd23[_0xc91f('0x7')]][_0xc91f('0xd')])){channels[_0x12fd23[_0xc91f('0x7')]][_0xc91f('0xd')]=_0x12fd23[_0xc91f('0x25')]+'\x20<'+_0x12fd23[_0xc91f('0x16')]+'>';}channels[_0x12fd23[_0xc91f('0x7')]]['endtime']=utils[_0xc91f('0x19')]();channels[_0x12fd23['uniqueid']][_0xc91f('0x26')]=utils[_0xc91f('0x27')](channels[_0x12fd23[_0xc91f('0x7')]][_0xc91f('0x28')],channels[_0x12fd23[_0xc91f('0x7')]]['starttime']);channels[_0x12fd23[_0xc91f('0x7')]][_0xc91f('0x29')]=channels[_0x12fd23[_0xc91f('0x7')]][_0xc91f('0x21')]?utils['diffTime'](channels[_0x12fd23[_0xc91f('0x7')]][_0xc91f('0x28')],channels[_0x12fd23[_0xc91f('0x7')]][_0xc91f('0x21')]):0x0;writeDB(channels[_0x12fd23['uniqueid']]);}}catch(_0x178f70){utils[_0xc91f('0x23')](_0x178f70[_0xc91f('0x1b')]);}};exports[_0xc91f('0x2a')]=function(_0x3bff2e){try{if(!_[_0xc91f('0x1d')](channels[_0x3bff2e['localtwolinkedid']])){if(channels[_0x3bff2e['localtwolinkedid']]['channel']==_0x3bff2e[_0xc91f('0x2b')]){channels[_0x3bff2e[_0xc91f('0x2c')]][_0xc91f('0x2d')]=_0x3bff2e[_0xc91f('0x2e')];channels[_0x3bff2e[_0xc91f('0x2c')]][_0xc91f('0x2f')]=_0xc91f('0x30');}else if(channels[_0x3bff2e[_0xc91f('0x2c')]]['channel']=_0x3bff2e['transfertargetchannel']){channels[_0x3bff2e[_0xc91f('0x2c')]][_0xc91f('0x2d')]=_0x3bff2e[_0xc91f('0x31')];channels[_0x3bff2e['localtwolinkedid']][_0xc91f('0x2f')]=_0xc91f('0x30');}}}catch(_0x571210){utils[_0xc91f('0x23')](_0x571210[_0xc91f('0x1b')]);}};exports[_0xc91f('0x32')]=function(_0x5b65ea){try{if(!_[_0xc91f('0x1d')](channels[_0x5b65ea[_0xc91f('0x7')]])){channels[_0x5b65ea[_0xc91f('0x7')]][_0xc91f('0x33')]=utils[_0xc91f('0x19')]();}}catch(_0x4bb9d5){utils['error'](_0x4bb9d5[_0xc91f('0x1b')]);}};exports['musiconholdstop']=function(_0x1e83b2){try{if(!_['isNil'](channels[_0x1e83b2[_0xc91f('0x7')]])){if(!_['isNil'](channels[_0x1e83b2['uniqueid']][_0xc91f('0x33')])){channels[_0x1e83b2[_0xc91f('0x7')]][_0xc91f('0x34')]+=utils['diffTime'](utils[_0xc91f('0x19')](),channels[_0x1e83b2[_0xc91f('0x7')]]['musiconholdstartAt']);delete channels[_0x1e83b2[_0xc91f('0x7')]][_0xc91f('0x33')];}}}catch(_0x43243b){utils[_0xc91f('0x23')](_0x43243b[_0xc91f('0x1b')]);}};exports[_0xc91f('0x35')]=function(_0x2a2f50){try{if(!_['isNil'](channels[_0x2a2f50[_0xc91f('0x7')]])){if(!_[_0xc91f('0x1d')](_0x2a2f50[_0xc91f('0x36')]['xmd-originatecalleridnum'])){channels[_0x2a2f50[_0xc91f('0x7')]][_0xc91f('0xb')]=_0x2a2f50['value'];}if(!_[_0xc91f('0x1d')](_0x2a2f50['variable'][_0xc91f('0x37')])){channels[_0x2a2f50[_0xc91f('0x7')]]['destination']=_0x2a2f50[_0xc91f('0x38')];channels[_0x2a2f50[_0xc91f('0x7')]][_0xc91f('0xd')]='\x22'+_0x2a2f50['value']+_0xc91f('0x39')+_0x2a2f50['value']+'>';}if(!_[_0xc91f('0x1d')](_0x2a2f50[_0xc91f('0x36')]['xmd-callerid-preview'])||!_['isNil'](_0x2a2f50['variable'][_0xc91f('0x3a')])){channels[_0x2a2f50[_0xc91f('0x7')]][_0xc91f('0xd')]=_0x2a2f50[_0xc91f('0x38')];}if(!_[_0xc91f('0x1d')](_0x2a2f50[_0xc91f('0x36')][_0xc91f('0x3b')])||!_['isNil'](_0x2a2f50['variable']['xmcs-queue'])){channels[_0x2a2f50[_0xc91f('0x7')]][_0xc91f('0x3c')]=_0xc91f('0x3d');channels[_0x2a2f50[_0xc91f('0x7')]][_0xc91f('0x3e')]=_0x2a2f50['value'];channels[_0x2a2f50[_0xc91f('0x7')]][_0xc91f('0x3f')]=!![];}if(!_['isNil'](_0x2a2f50[_0xc91f('0x36')][_0xc91f('0x40')])){channels[_0x2a2f50[_0xc91f('0x7')]][_0xc91f('0x41')]=_0x2a2f50[_0xc91f('0x38')];}if(!_[_0xc91f('0x1d')](_0x2a2f50['variable'][_0xc91f('0x42')])){channels[_0x2a2f50[_0xc91f('0x7')]][_0xc91f('0x9')]=_0x2a2f50[_0xc91f('0x38')];}if(!_[_0xc91f('0x1d')](_0x2a2f50['variable']['outboundrouteid'])){channels[_0x2a2f50[_0xc91f('0x7')]]['routeid']=_0x2a2f50[_0xc91f('0x38')];}if(!_[_0xc91f('0x1d')](_0x2a2f50[_0xc91f('0x36')][_0xc91f('0x43')])){channels[_0x2a2f50[_0xc91f('0x7')]]['sipcallid']=_0x2a2f50['value'];}}}catch(_0x14a03f){utils['error'](_0x14a03f[_0xc91f('0x1b')]);}};exports[_0xc91f('0x44')]=function(_0x38a2ed){try{if(!_[_0xc91f('0x1d')](channels[_0x38a2ed[_0xc91f('0x7')]])){if(_0x38a2ed['application']['toLowerCase']()==_0xc91f('0x45')&&_[_0xc91f('0x46')](_0x38a2ed[_0xc91f('0x47')][_0xc91f('0x48')](),_0xc91f('0x49'))){var _0x388ad9=_0x38a2ed['appdata'][_0xc91f('0x4a')]('=');var _0x5848b8=_0x388ad9[0x0]['substring'](_0x388ad9[0x0][_0xc91f('0x4b')]('(')+0x1,_0x388ad9[0x0][_0xc91f('0x4b')](')'));var _0x375839=_0x388ad9[0x1];channels[_0x38a2ed[_0xc91f('0x7')]][_0x5848b8]=_0x375839;}if(!_[_0xc91f('0x4c')]([_0xc91f('0x24'),_0xc91f('0x4d'),'execif',_0xc91f('0x45'),_0xc91f('0x4e')],_0x38a2ed[_0xc91f('0x4f')][_0xc91f('0x48')]())){channels[_0x38a2ed[_0xc91f('0x7')]][_0xc91f('0x3c')]=_0x38a2ed[_0xc91f('0x4f')];channels[_0x38a2ed[_0xc91f('0x7')]][_0xc91f('0x3e')]=_0x38a2ed['appdata'];}}}catch(_0x35490f){utils['error'](_0x35490f[_0xc91f('0x1b')]);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 13be5db..8047e6d 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 _0x3baf=['SHUTDOWN','fullybooted','FULLYBOOTED','error','close','./utils','lodash','connect','info','CONNECTED','shutdown'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0x3baf,0xf7));var _0xf3ba=function(_0x5f25f7,_0x5ae75f){_0x5f25f7=_0x5f25f7-0x0;var _0x30b621=_0x3baf[_0x5f25f7];return _0x30b621;};'use strict';var utils=require(_0xf3ba('0x0'));var _=require(_0xf3ba('0x1'));exports[_0xf3ba('0x2')]=function(){utils[_0xf3ba('0x3')](_0xf3ba('0x4'));};exports[_0xf3ba('0x5')]=function(){utils[_0xf3ba('0x3')](_0xf3ba('0x6'));};exports[_0xf3ba('0x7')]=function(){utils[_0xf3ba('0x3')](_0xf3ba('0x8'));};exports[_0xf3ba('0x9')]=function(_0x475268){utils[_0xf3ba('0x9')](_0x475268);};exports[_0xf3ba('0xa')]=function(){utils['info']('CLOSE');};exports['managerevent']=function(_0x32f810){}; \ No newline at end of file +var _0x3c6c=['SHUTDOWN','fullybooted','error','./utils','connect','info','CONNECTED','shutdown'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3c6c,0x7b));var _0xc3c6=function(_0x75bc72,_0x37bb81){_0x75bc72=_0x75bc72-0x0;var _0x2e6a16=_0x3c6c[_0x75bc72];return _0x2e6a16;};'use strict';var utils=require(_0xc3c6('0x0'));var _=require('lodash');exports[_0xc3c6('0x1')]=function(){utils[_0xc3c6('0x2')](_0xc3c6('0x3'));};exports[_0xc3c6('0x4')]=function(){utils[_0xc3c6('0x2')](_0xc3c6('0x5'));};exports[_0xc3c6('0x6')]=function(){utils[_0xc3c6('0x2')]('FULLYBOOTED');};exports[_0xc3c6('0x7')]=function(_0x4a2ca1){utils[_0xc3c6('0x7')](_0x4a2ca1);};exports['close']=function(){utils['info']('CLOSE');};exports['managerevent']=function(_0x4f39dd){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 91602c6..3c77190 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 _0x30fc=['assign','starttime','now','lastevent','called','error','dialend','isNil','answertime','connect','hangup','complete','duration','diffTime','endtime','billableseconds','lodash','util','info','DIAL|%s|%s|%s|%s|%s|%s','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','uniqueid','newexten','application','set','startsWith','appdata','toLowerCase','cdr(routeid)','split','varset','variable','outboundrouteid','stack'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x30fc,0xfa));var _0xc30f=function(_0x26dd05,_0x135f80){_0x26dd05=_0x26dd05-0x0;var _0x5da547=_0x30fc[_0x26dd05];return _0x5da547;};'use strict';var _=require(_0xc30f('0x0'));var util=require(_0xc30f('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x343657){utils[_0xc30f('0x2')](util['format'](_0xc30f('0x3'),_0x343657['uniqueid'],_0x343657['channel'],_0x343657[_0xc30f('0x4')],_0x343657[_0xc30f('0x5')],_0x343657[_0xc30f('0x6')],_0x343657[_0xc30f('0x7')]));utils[_0xc30f('0x8')](_0xc30f('0x9'),_0x343657);delete dials[_0x343657[_0xc30f('0xa')]];}exports[_0xc30f('0xb')]=function(_0x541b6c){try{if(_0x541b6c[_0xc30f('0xc')]['toLowerCase']()==_0xc30f('0xd')&&_[_0xc30f('0xe')](_0x541b6c[_0xc30f('0xf')][_0xc30f('0x10')](),_0xc30f('0x11'))){var _0xc3d1ad=_0x541b6c[_0xc30f('0xf')][_0xc30f('0x12')]('=');dials[_0x541b6c[_0xc30f('0xa')]]={'routeId':_0xc3d1ad[0x1]};}}catch(_0x5db6de){utils['error'](_0x5db6de['stack']);}};exports[_0xc30f('0x13')]=function(_0x368ddf){try{if(!_['isNil'](_0x368ddf[_0xc30f('0x14')][_0xc30f('0x15')])){dials[_0x368ddf['uniqueid']]={'routeId':_0x368ddf['value']};}}catch(_0x214c1f){utils['error'](_0x214c1f[_0xc30f('0x16')]);}};exports['dialbegin']=function(_0x2d2675){try{if(!_['isNil'](dials[_0x2d2675[_0xc30f('0xa')]])){dials[_0x2d2675[_0xc30f('0xa')]]=_[_0xc30f('0x17')](dials[_0x2d2675[_0xc30f('0xa')]],_0x2d2675);dials[_0x2d2675[_0xc30f('0xa')]][_0xc30f('0x18')]=utils[_0xc30f('0x19')]();dials[_0x2d2675[_0xc30f('0xa')]][_0xc30f('0x1a')]=_0xc30f('0x1b');}}catch(_0x43f13c){utils[_0xc30f('0x1c')](_0x43f13c[_0xc30f('0x16')]);}};exports[_0xc30f('0x1d')]=function(_0x3f9c4f){try{if(!_[_0xc30f('0x1e')](dials[_0x3f9c4f[_0xc30f('0xa')]])){dials[_0x3f9c4f[_0xc30f('0xa')]][_0xc30f('0x7')]=_0x3f9c4f['dialstatus'];if(_0x3f9c4f['dialstatus']=='ANSWER'){dials[_0x3f9c4f[_0xc30f('0xa')]]=_['assign'](dials[_0x3f9c4f[_0xc30f('0xa')]],_0x3f9c4f);dials[_0x3f9c4f[_0xc30f('0xa')]][_0xc30f('0x1f')]=utils['now']();dials[_0x3f9c4f[_0xc30f('0xa')]][_0xc30f('0x1a')]=_0xc30f('0x20');}}}catch(_0xd0830e){utils[_0xc30f('0x1c')](_0xd0830e[_0xc30f('0x16')]);}};exports[_0xc30f('0x21')]=function(_0x36a027){try{if(!_['isNil'](dials[_0x36a027['uniqueid']])){dials[_0x36a027['uniqueid']]=_[_0xc30f('0x17')](dials[_0x36a027[_0xc30f('0xa')]],{'endtime':utils[_0xc30f('0x19')](),'lastevent':_0xc30f('0x22')});dials[_0x36a027['uniqueid']][_0xc30f('0x23')]=utils[_0xc30f('0x24')](dials[_0x36a027[_0xc30f('0xa')]][_0xc30f('0x25')],dials[_0x36a027[_0xc30f('0xa')]]['starttime']);dials[_0x36a027['uniqueid']]['holdtime']=utils[_0xc30f('0x24')](dials[_0x36a027['uniqueid']][_0xc30f('0x1f')]||dials[_0x36a027['uniqueid']][_0xc30f('0x25')],dials[_0x36a027[_0xc30f('0xa')]]['starttime']);dials[_0x36a027[_0xc30f('0xa')]][_0xc30f('0x26')]=dials[_0x36a027[_0xc30f('0xa')]]['answertime']?utils['diffTime'](dials[_0x36a027[_0xc30f('0xa')]][_0xc30f('0x25')],dials[_0x36a027[_0xc30f('0xa')]][_0xc30f('0x1f')]):0x0;writeDB(dials[_0x36a027[_0xc30f('0xa')]]);}}catch(_0x2884ae){utils['error'](_0x2884ae[_0xc30f('0x16')]);}}; \ No newline at end of file +var _0x6b9d=['duration','diffTime','holdtime','endtime','lodash','util','./utils','info','format','DIAL|%s|%s|%s|%s|%s|%s','uniqueid','channel','dialstring','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','application','toLowerCase','set','startsWith','appdata','error','stack','isNil','variable','outboundrouteid','value','dialbegin','assign','starttime','lastevent','dialend','ANSWER','answertime','now','connect','hangup','complete'];(function(_0x2a5911,_0x2c17cf){var _0x579e83=function(_0x2750f6){while(--_0x2750f6){_0x2a5911['push'](_0x2a5911['shift']());}};_0x579e83(++_0x2c17cf);}(_0x6b9d,0x1e4));var _0xd6b9=function(_0x5b3b9b,_0x1c71b0){_0x5b3b9b=_0x5b3b9b-0x0;var _0x47c1d7=_0x6b9d[_0x5b3b9b];return _0x47c1d7;};'use strict';var _=require(_0xd6b9('0x0'));var util=require(_0xd6b9('0x1'));var utils=require(_0xd6b9('0x2'));var dials={};function writeDB(_0x431668){utils[_0xd6b9('0x3')](util[_0xd6b9('0x4')](_0xd6b9('0x5'),_0x431668[_0xd6b9('0x6')],_0x431668[_0xd6b9('0x7')],_0x431668[_0xd6b9('0x8')],_0x431668['calleridnum'],_0x431668[_0xd6b9('0x9')],_0x431668[_0xd6b9('0xa')]));utils[_0xd6b9('0xb')](_0xd6b9('0xc'),_0x431668);delete dials[_0x431668[_0xd6b9('0x6')]];}exports[_0xd6b9('0xd')]=function(_0x11214c){try{if(_0x11214c[_0xd6b9('0xe')][_0xd6b9('0xf')]()==_0xd6b9('0x10')&&_[_0xd6b9('0x11')](_0x11214c['appdata'][_0xd6b9('0xf')](),'cdr(routeid)')){var _0x12bd4f=_0x11214c[_0xd6b9('0x12')]['split']('=');dials[_0x11214c[_0xd6b9('0x6')]]={'routeId':_0x12bd4f[0x1]};}}catch(_0x3e5ec0){utils[_0xd6b9('0x13')](_0x3e5ec0[_0xd6b9('0x14')]);}};exports['varset']=function(_0x253b83){try{if(!_[_0xd6b9('0x15')](_0x253b83[_0xd6b9('0x16')][_0xd6b9('0x17')])){dials[_0x253b83[_0xd6b9('0x6')]]={'routeId':_0x253b83[_0xd6b9('0x18')]};}}catch(_0x525ed6){utils['error'](_0x525ed6['stack']);}};exports[_0xd6b9('0x19')]=function(_0xd3e051){try{if(!_[_0xd6b9('0x15')](dials[_0xd3e051['uniqueid']])){dials[_0xd3e051[_0xd6b9('0x6')]]=_[_0xd6b9('0x1a')](dials[_0xd3e051[_0xd6b9('0x6')]],_0xd3e051);dials[_0xd3e051[_0xd6b9('0x6')]][_0xd6b9('0x1b')]=utils['now']();dials[_0xd3e051['uniqueid']][_0xd6b9('0x1c')]='called';}}catch(_0x1c24d1){utils[_0xd6b9('0x13')](_0x1c24d1[_0xd6b9('0x14')]);}};exports[_0xd6b9('0x1d')]=function(_0x3e812d){try{if(!_['isNil'](dials[_0x3e812d[_0xd6b9('0x6')]])){dials[_0x3e812d['uniqueid']][_0xd6b9('0xa')]=_0x3e812d[_0xd6b9('0xa')];if(_0x3e812d[_0xd6b9('0xa')]==_0xd6b9('0x1e')){dials[_0x3e812d[_0xd6b9('0x6')]]=_['assign'](dials[_0x3e812d[_0xd6b9('0x6')]],_0x3e812d);dials[_0x3e812d['uniqueid']][_0xd6b9('0x1f')]=utils[_0xd6b9('0x20')]();dials[_0x3e812d[_0xd6b9('0x6')]]['lastevent']=_0xd6b9('0x21');}}}catch(_0x4028a1){utils['error'](_0x4028a1[_0xd6b9('0x14')]);}};exports[_0xd6b9('0x22')]=function(_0x24c924){try{if(!_[_0xd6b9('0x15')](dials[_0x24c924[_0xd6b9('0x6')]])){dials[_0x24c924[_0xd6b9('0x6')]]=_[_0xd6b9('0x1a')](dials[_0x24c924[_0xd6b9('0x6')]],{'endtime':utils[_0xd6b9('0x20')](),'lastevent':_0xd6b9('0x23')});dials[_0x24c924['uniqueid']][_0xd6b9('0x24')]=utils[_0xd6b9('0x25')](dials[_0x24c924[_0xd6b9('0x6')]]['endtime'],dials[_0x24c924[_0xd6b9('0x6')]][_0xd6b9('0x1b')]);dials[_0x24c924[_0xd6b9('0x6')]][_0xd6b9('0x26')]=utils[_0xd6b9('0x25')](dials[_0x24c924[_0xd6b9('0x6')]]['answertime']||dials[_0x24c924[_0xd6b9('0x6')]][_0xd6b9('0x27')],dials[_0x24c924[_0xd6b9('0x6')]][_0xd6b9('0x1b')]);dials[_0x24c924[_0xd6b9('0x6')]]['billableseconds']=dials[_0x24c924[_0xd6b9('0x6')]][_0xd6b9('0x1f')]?utils[_0xd6b9('0x25')](dials[_0x24c924[_0xd6b9('0x6')]][_0xd6b9('0x27')],dials[_0x24c924[_0xd6b9('0x6')]]['answertime']):0x0;writeDB(dials[_0x24c924[_0xd6b9('0x6')]]);}}catch(_0x310aa7){utils[_0xd6b9('0x13')](_0x310aa7['stack']);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 937488b..a287c7d 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 _0x6106=['disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','asterisk-manager','../../config/environment','./utils','asterisk','username','password','keepConnected','xdr'];(function(_0x47e8c9,_0x2e6edc){var _0x31ea20=function(_0x501ba0){while(--_0x501ba0){_0x47e8c9['push'](_0x47e8c9['shift']());}};_0x31ea20(++_0x2e6edc);}(_0x6106,0x11e));var _0x6610=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x6106[_0x5f0089];return _0x193892;};var AsteriskManager=require(_0x6610('0x0'));var config=require(_0x6610('0x1'));var utils=require(_0x6610('0x2'));var ami=new AsteriskManager(config[_0x6610('0x3')]['port'],config[_0x6610('0x3')]['ip'],config[_0x6610('0x3')][_0x6610('0x4')],config[_0x6610('0x3')][_0x6610('0x5')],!![]);ami[_0x6610('0x6')]();if(config[_0x6610('0x7')]&&config['xdr'][_0x6610('0x8')]){utils[_0x6610('0x9')](_0x6610('0xa'));}else{var agents=require(_0x6610('0xb'));var calls=require(_0x6610('0xc'));var queues=require(_0x6610('0xd'));var recordings=require(_0x6610('0xe'));var members=require('./members.controller');var dials=require(_0x6610('0xf'));var transfers=require(_0x6610('0x10'));var core=require(_0x6610('0x11'));ami['on'](_0x6610('0x12'),core[_0x6610('0x12')]);ami['on']('shutdown',core[_0x6610('0x13')]);ami['on']('fullybooted',core[_0x6610('0x14')]);ami['on'](_0x6610('0x15'),core[_0x6610('0x15')]);ami['on']('close',core[_0x6610('0x16')]);ami['on'](_0x6610('0x17'),core[_0x6610('0x17')]);ami['on']('devicestatechange',function(_0x43452c){try{members['devicestatechange'](_0x43452c);}catch(_0x63d399){utils[_0x6610('0x15')](_0x63d399);}});ami['on'](_0x6610('0x18'),function(_0x1c236b){try{agents[_0x6610('0x18')](_0x1c236b);}catch(_0x208f09){utils[_0x6610('0x15')](_0x208f09);}});ami['on'](_0x6610('0x19'),function(_0x576fd7){try{agents[_0x6610('0x19')](_0x576fd7);}catch(_0x305fe9){utils[_0x6610('0x15')](_0x305fe9);}});ami['on'](_0x6610('0x1a'),function(_0x5d45e2){try{agents[_0x6610('0x1a')](_0x5d45e2);queues[_0x6610('0x1a')](_0x5d45e2);}catch(_0x3617af){utils[_0x6610('0x15')](_0x3617af);}});ami['on'](_0x6610('0x1b'),function(_0x30f32a){try{agents[_0x6610('0x1b')](_0x30f32a);queues[_0x6610('0x1b')](_0x30f32a);members[_0x6610('0x1b')](_0x30f32a);}catch(_0x3ad125){utils[_0x6610('0x15')](_0x3ad125);}});ami['on'](_0x6610('0x1c'),function(_0x505ca7){try{agents[_0x6610('0x1c')](_0x505ca7);queues['queuecallerabandon'](_0x505ca7);}catch(_0x2cdc26){utils[_0x6610('0x15')](_0x2cdc26);}});ami['on'](_0x6610('0x1d'),function(_0x1b45ba){try{queues[_0x6610('0x1d')](_0x1b45ba);recordings[_0x6610('0x1d')](_0x1b45ba);}catch(_0x5f1fb1){utils[_0x6610('0x15')](_0x5f1fb1);}});ami['on']('queuecallerleave',function(_0x145647){try{queues[_0x6610('0x1e')](_0x145647);}catch(_0x73751a){utils[_0x6610('0x15')](_0x73751a);}});ami['on']('musiconholdstart',function(_0x3ec367){try{queues['musiconholdstart'](_0x3ec367);calls['musiconholdstart'](_0x3ec367);}catch(_0x5dd2e8){utils[_0x6610('0x15')](_0x5dd2e8);}});ami['on']('musiconholdstop',function(_0x820578){try{queues[_0x6610('0x1f')](_0x820578);calls[_0x6610('0x1f')](_0x820578);}catch(_0x3c2093){utils[_0x6610('0x15')](_0x3c2093);}});ami['on'](_0x6610('0x20'),function(_0x4e1d4e){try{calls[_0x6610('0x20')](_0x4e1d4e);recordings['newstate'](_0x4e1d4e);}catch(_0x5b0c22){utils[_0x6610('0x15')](_0x5b0c22);}});ami['on'](_0x6610('0x21'),function(_0x515e39){try{calls[_0x6610('0x21')](_0x515e39);recordings[_0x6610('0x21')](_0x515e39);dials[_0x6610('0x21')](_0x515e39);agents[_0x6610('0x21')](_0x515e39);queues['hangup'](_0x515e39);}catch(_0x3de3cc){utils[_0x6610('0x15')](_0x3de3cc);}});ami['on'](_0x6610('0x22'),function(_0x33cee9){try{members[_0x6610('0x22')](_0x33cee9);}catch(_0x348d24){utils[_0x6610('0x15')](_0x348d24);}});ami['on']('blindtransfer',function(_0x33e1cb){try{queues['blindtransfer'](_0x33e1cb);agents[_0x6610('0x23')](_0x33e1cb);transfers[_0x6610('0x23')](_0x33e1cb);}catch(_0xd91093){utils[_0x6610('0x15')](_0xd91093);}});ami['on']('attendedtransfer',function(_0x20260a){try{queues[_0x6610('0x24')](_0x20260a);transfers[_0x6610('0x24')](_0x20260a);agents[_0x6610('0x24')](_0x20260a);calls[_0x6610('0x24')](_0x20260a);}catch(_0x5149a8){utils['error'](_0x5149a8);}});ami['on'](_0x6610('0x25'),function(_0x5f5532){try{queues[_0x6610('0x25')](_0x5f5532);recordings['varset'](_0x5f5532);calls[_0x6610('0x25')](_0x5f5532);dials[_0x6610('0x25')](_0x5f5532);}catch(_0x1d6651){utils[_0x6610('0x15')](_0x1d6651);}});ami['on']('newexten',function(_0x452fd7){try{calls['newexten'](_0x452fd7);recordings[_0x6610('0x26')](_0x452fd7);dials[_0x6610('0x26')](_0x452fd7);}catch(_0x1dac99){utils[_0x6610('0x15')](_0x1dac99);}});ami['on'](_0x6610('0x27'),function(_0x5de026){try{calls['newchannel'](_0x5de026);recordings[_0x6610('0x27')](_0x5de026);}catch(_0x47688f){utils[_0x6610('0x15')](_0x47688f);}});ami['on'](_0x6610('0x28'),function(_0x2be399){try{dials[_0x6610('0x28')](_0x2be399);}catch(_0x3a2c2f){utils[_0x6610('0x15')](_0x3a2c2f);}});ami['on'](_0x6610('0x29'),function(_0x504031){try{dials[_0x6610('0x29')](_0x504031);}catch(_0x207da2){utils[_0x6610('0x15')](_0x207da2);}});} \ No newline at end of file +var _0x2ed3=['./calls.controller','./queues.controller','./recordings.controller','./dials.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','asterisk-manager','../../config/environment','./utils','asterisk','port','keepConnected','xdr','info','XDR\x20DISABLED','./agents.controller'];(function(_0x2d0b0b,_0x1b0097){var _0xd6f2d7=function(_0x2906dc){while(--_0x2906dc){_0x2d0b0b['push'](_0x2d0b0b['shift']());}};_0xd6f2d7(++_0x1b0097);}(_0x2ed3,0x96));var _0x32ed=function(_0x310504,_0x26ad95){_0x310504=_0x310504-0x0;var _0x5b36d0=_0x2ed3[_0x310504];return _0x5b36d0;};var AsteriskManager=require(_0x32ed('0x0'));var config=require(_0x32ed('0x1'));var utils=require(_0x32ed('0x2'));var ami=new AsteriskManager(config[_0x32ed('0x3')][_0x32ed('0x4')],config[_0x32ed('0x3')]['ip'],config['asterisk']['username'],config['asterisk']['password'],!![]);ami[_0x32ed('0x5')]();if(config[_0x32ed('0x6')]&&config[_0x32ed('0x6')]['disabled']){utils[_0x32ed('0x7')](_0x32ed('0x8'));}else{var agents=require(_0x32ed('0x9'));var calls=require(_0x32ed('0xa'));var queues=require(_0x32ed('0xb'));var recordings=require(_0x32ed('0xc'));var members=require('./members.controller');var dials=require(_0x32ed('0xd'));var transfers=require('./transfers.controller');var core=require(_0x32ed('0xe'));ami['on']('connect',core[_0x32ed('0xf')]);ami['on'](_0x32ed('0x10'),core[_0x32ed('0x10')]);ami['on'](_0x32ed('0x11'),core[_0x32ed('0x11')]);ami['on']('error',core[_0x32ed('0x12')]);ami['on'](_0x32ed('0x13'),core[_0x32ed('0x13')]);ami['on'](_0x32ed('0x14'),core['managerevent']);ami['on'](_0x32ed('0x15'),function(_0x13d9ca){try{members[_0x32ed('0x15')](_0x13d9ca);}catch(_0x1ff83a){utils[_0x32ed('0x12')](_0x1ff83a);}});ami['on'](_0x32ed('0x16'),function(_0x3afb39){try{agents[_0x32ed('0x16')](_0x3afb39);}catch(_0x3c953d){utils['error'](_0x3c953d);}});ami['on']('agentringnoanswer',function(_0x3e2d91){try{agents[_0x32ed('0x17')](_0x3e2d91);}catch(_0x520ebc){utils[_0x32ed('0x12')](_0x520ebc);}});ami['on'](_0x32ed('0x18'),function(_0x338d33){try{agents['agentconnect'](_0x338d33);queues[_0x32ed('0x18')](_0x338d33);}catch(_0x481236){utils['error'](_0x481236);}});ami['on'](_0x32ed('0x19'),function(_0x1c14af){try{agents[_0x32ed('0x19')](_0x1c14af);queues[_0x32ed('0x19')](_0x1c14af);members[_0x32ed('0x19')](_0x1c14af);}catch(_0x1bd6d8){utils[_0x32ed('0x12')](_0x1bd6d8);}});ami['on'](_0x32ed('0x1a'),function(_0x59533a){try{agents[_0x32ed('0x1a')](_0x59533a);queues[_0x32ed('0x1a')](_0x59533a);}catch(_0x4a4723){utils['error'](_0x4a4723);}});ami['on']('queuecallerjoin',function(_0x129c91){try{queues[_0x32ed('0x1b')](_0x129c91);recordings[_0x32ed('0x1b')](_0x129c91);}catch(_0x4ac492){utils['error'](_0x4ac492);}});ami['on'](_0x32ed('0x1c'),function(_0x1711aa){try{queues[_0x32ed('0x1c')](_0x1711aa);}catch(_0x584c40){utils[_0x32ed('0x12')](_0x584c40);}});ami['on'](_0x32ed('0x1d'),function(_0x248db6){try{queues['musiconholdstart'](_0x248db6);calls[_0x32ed('0x1d')](_0x248db6);}catch(_0x1be1ae){utils[_0x32ed('0x12')](_0x1be1ae);}});ami['on']('musiconholdstop',function(_0x1b045e){try{queues['musiconholdstop'](_0x1b045e);calls[_0x32ed('0x1e')](_0x1b045e);}catch(_0x42f08f){utils[_0x32ed('0x12')](_0x42f08f);}});ami['on'](_0x32ed('0x1f'),function(_0x9b42fa){try{calls[_0x32ed('0x1f')](_0x9b42fa);recordings[_0x32ed('0x1f')](_0x9b42fa);}catch(_0x5e8524){utils[_0x32ed('0x12')](_0x5e8524);}});ami['on'](_0x32ed('0x20'),function(_0x34656a){try{calls['hangup'](_0x34656a);recordings[_0x32ed('0x20')](_0x34656a);dials[_0x32ed('0x20')](_0x34656a);agents['hangup'](_0x34656a);queues[_0x32ed('0x20')](_0x34656a);}catch(_0x46f3be){utils[_0x32ed('0x12')](_0x46f3be);}});ami['on']('cdr',function(_0x45e824){try{members[_0x32ed('0x21')](_0x45e824);}catch(_0x314fac){utils['error'](_0x314fac);}});ami['on']('blindtransfer',function(_0x1a8fe6){try{queues[_0x32ed('0x22')](_0x1a8fe6);agents[_0x32ed('0x22')](_0x1a8fe6);transfers[_0x32ed('0x22')](_0x1a8fe6);}catch(_0x4064af){utils[_0x32ed('0x12')](_0x4064af);}});ami['on']('attendedtransfer',function(_0x2d1c60){try{queues['attendedtransfer'](_0x2d1c60);transfers['attendedtransfer'](_0x2d1c60);agents['attendedtransfer'](_0x2d1c60);calls[_0x32ed('0x23')](_0x2d1c60);}catch(_0x7df5f3){utils[_0x32ed('0x12')](_0x7df5f3);}});ami['on'](_0x32ed('0x24'),function(_0x5ccea8){try{queues[_0x32ed('0x24')](_0x5ccea8);recordings[_0x32ed('0x24')](_0x5ccea8);calls[_0x32ed('0x24')](_0x5ccea8);dials[_0x32ed('0x24')](_0x5ccea8);}catch(_0x392722){utils[_0x32ed('0x12')](_0x392722);}});ami['on'](_0x32ed('0x25'),function(_0x313257){try{calls[_0x32ed('0x25')](_0x313257);recordings[_0x32ed('0x25')](_0x313257);dials[_0x32ed('0x25')](_0x313257);}catch(_0x59c25e){utils[_0x32ed('0x12')](_0x59c25e);}});ami['on']('newchannel',function(_0x552604){try{calls[_0x32ed('0x26')](_0x552604);recordings[_0x32ed('0x26')](_0x552604);}catch(_0xfca002){utils[_0x32ed('0x12')](_0xfca002);}});ami['on'](_0x32ed('0x27'),function(_0x143b9b){try{dials[_0x32ed('0x27')](_0x143b9b);}catch(_0x1c817f){utils[_0x32ed('0x12')](_0x1c817f);}});ami['on']('dialend',function(_0x1a3292){try{dials['dialend'](_0x1a3292);}catch(_0x1eb370){utils['error'](_0x1eb370);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index cf70c60..3fb4024 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 _0x5001=['type','data3','uniqueid','destinationchannel','source','destination','util','./utils','Queue:','info','MEMBER|%s|%s|%s|%s|%s|%s','interface','channel','data2','membername','then','name','internal','request','CreateMemberReport','getUserByName','split','catch','some','startsWith','devicestatechange','state','INUSE','BUSY','device','voice','TALKING','now','agent','exitAt','duration','diffTime','enterAt','assign','queue','cdr','isNil','data1'];(function(_0x4099af,_0x1578bf){var _0x46e189=function(_0x5a7a18){while(--_0x5a7a18){_0x4099af['push'](_0x4099af['shift']());}};_0x46e189(++_0x1578bf);}(_0x5001,0xdd));var _0x1500=function(_0x2e3e07,_0x5ebda4){_0x2e3e07=_0x2e3e07-0x0;var _0x1d71b4=_0x5001[_0x2e3e07];return _0x1d71b4;};'use strict';var _=require('lodash');var util=require(_0x1500('0x0'));var utils=require(_0x1500('0x1'));var members={};var exclude=['Local/_attended@transfer',_0x1500('0x2')];function writeDB(_0x3be279){utils[_0x1500('0x3')](util['format'](_0x1500('0x4'),_0x3be279['uniqueid'],_0x3be279[_0x1500('0x5')],_0x3be279[_0x1500('0x6')],_0x3be279[_0x1500('0x7')],_0x3be279[_0x1500('0x8')],_0x3be279['type']));if(_0x3be279[_0x1500('0x5')]){utils['getUserByInterface'](_0x3be279['interface'])[_0x1500('0x9')](function(_0xfcb20c){if(_0xfcb20c){_0x3be279[_0x1500('0x8')]=_0xfcb20c[_0x1500('0xa')];_0x3be279[_0x1500('0xb')]=_0xfcb20c[_0x1500('0xb')];utils[_0x1500('0xc')](_0x1500('0xd'),_0x3be279);}else{utils[_0x1500('0xe')](_0x3be279['interface'][_0x1500('0xf')]('/')[0x1])['then'](function(_0x22913c){if(_0x22913c){_0x3be279[_0x1500('0x8')]=_0x22913c[_0x1500('0xa')];_0x3be279['internal']=_0x22913c[_0x1500('0xb')];utils[_0x1500('0xc')](_0x1500('0xd'),_0x3be279);}});}})[_0x1500('0x10')](function(_0x3ecc04){utils['error'](_0x3ecc04);});}delete members[_0x3be279['interface']];}function startsWith(_0x3032e8,_0xaaddc7){return _[_0x1500('0x11')](_0x3032e8,function(_0x5ba916){return _[_0x1500('0x12')](_0xaaddc7,_0x5ba916);});}exports[_0x1500('0x13')]=function(_0x408fdc){switch(_0x408fdc[_0x1500('0x14')]){case _0x1500('0x15'):case _0x1500('0x16'):if(!startsWith(exclude,_0x408fdc[_0x1500('0x17')])){members[_0x408fdc[_0x1500('0x17')]]={'channel':_0x1500('0x18'),'interface':_0x408fdc[_0x1500('0x17')],'type':_0x1500('0x19'),'enterAt':utils[_0x1500('0x1a')](),'role':_0x1500('0x1b')};}break;case'NOT_INUSE':if(!_['isNil'](members[_0x408fdc[_0x1500('0x17')]])){members[_0x408fdc['device']][_0x1500('0x1c')]=utils['now']();members[_0x408fdc[_0x1500('0x17')]][_0x1500('0x1d')]=utils[_0x1500('0x1e')](members[_0x408fdc[_0x1500('0x17')]][_0x1500('0x1c')],members[_0x408fdc[_0x1500('0x17')]][_0x1500('0x1f')]);if(members[_0x408fdc[_0x1500('0x17')]]['uniqueid']){writeDB(members[_0x408fdc[_0x1500('0x17')]]);}}default:break;}};exports['agentcomplete']=function(_0x2d2fdc){if(!_['isNil'](members[_0x2d2fdc[_0x1500('0x5')]])){members[_0x2d2fdc['interface']]=_[_0x1500('0x20')](members[_0x2d2fdc[_0x1500('0x5')]],{'data4':_0x2d2fdc[_0x1500('0x21')],'uniqueid':_0x2d2fdc['uniqueid']});}};exports[_0x1500('0x22')]=function(_0x5efb05){if(_0x5efb05[_0x1500('0x6')]){var _0x584b58=_0x5efb05[_0x1500('0x6')][_0x1500('0xf')]('-')[0x0];if(!_[_0x1500('0x23')](members[_0x584b58])){members[_0x584b58]=_[_0x1500('0x20')](members[_0x584b58],{'data1':members[_0x584b58][_0x1500('0x24')]||_0x5efb05[_0x1500('0x25')],'data2':members[_0x584b58][_0x1500('0x7')]||_0x5efb05['source'],'data3':members[_0x584b58][_0x1500('0x26')]||_0x5efb05['destination'],'uniqueid':members[_0x584b58][_0x1500('0x27')]||_0x5efb05[_0x1500('0x27')]});if(members[_0x584b58][_0x1500('0x1c')]){writeDB(members[_0x584b58]);}}}if(_0x5efb05[_0x1500('0x28')]){var _0x33b284=_0x5efb05['destinationchannel']['split']('-')[0x0];if(!_[_0x1500('0x23')](members[_0x33b284])){members[_0x33b284]=_[_0x1500('0x20')](members[_0x33b284],{'data1':members[_0x33b284][_0x1500('0x24')]||_0x5efb05[_0x1500('0x25')],'data2':members[_0x33b284][_0x1500('0x7')]||_0x5efb05[_0x1500('0x29')],'data3':members[_0x33b284][_0x1500('0x26')]||_0x5efb05[_0x1500('0x2a')],'uniqueid':members[_0x33b284]['uniqueid']||_0x5efb05[_0x1500('0x27')]});if(members[_0x33b284][_0x1500('0x1c')]){writeDB(members[_0x33b284]);}}}}; \ No newline at end of file +var _0x2b50=['then','catch','error','some','startsWith','devicestatechange','BUSY','device','voice','TALKING','now','agent','NOT_INUSE','isNil','duration','diffTime','exitAt','enterAt','agentcomplete','assign','queue','cdr','data1','source','data3','destinationchannel','destination','util','./utils','Local/_attended@transfer','Queue:','info','format','MEMBER|%s|%s|%s|%s|%s|%s','uniqueid','interface','channel','data2','membername','type','getUserByInterface','name','internal','request','CreateMemberReport','getUserByName','split'];(function(_0x25d5d1,_0x10540a){var _0xf38950=function(_0x5a39f5){while(--_0x5a39f5){_0x25d5d1['push'](_0x25d5d1['shift']());}};_0xf38950(++_0x10540a);}(_0x2b50,0x193));var _0x02b5=function(_0x2bb503,_0x231e43){_0x2bb503=_0x2bb503-0x0;var _0xf582ed=_0x2b50[_0x2bb503];return _0xf582ed;};'use strict';var _=require('lodash');var util=require(_0x02b5('0x0'));var utils=require(_0x02b5('0x1'));var members={};var exclude=[_0x02b5('0x2'),_0x02b5('0x3')];function writeDB(_0x10f0ca){utils[_0x02b5('0x4')](util[_0x02b5('0x5')](_0x02b5('0x6'),_0x10f0ca[_0x02b5('0x7')],_0x10f0ca[_0x02b5('0x8')],_0x10f0ca[_0x02b5('0x9')],_0x10f0ca[_0x02b5('0xa')],_0x10f0ca[_0x02b5('0xb')],_0x10f0ca[_0x02b5('0xc')]));if(_0x10f0ca[_0x02b5('0x8')]){utils[_0x02b5('0xd')](_0x10f0ca['interface'])['then'](function(_0x5b0439){if(_0x5b0439){_0x10f0ca[_0x02b5('0xb')]=_0x5b0439[_0x02b5('0xe')];_0x10f0ca['internal']=_0x5b0439[_0x02b5('0xf')];utils[_0x02b5('0x10')](_0x02b5('0x11'),_0x10f0ca);}else{utils[_0x02b5('0x12')](_0x10f0ca[_0x02b5('0x8')][_0x02b5('0x13')]('/')[0x1])[_0x02b5('0x14')](function(_0x236c0b){if(_0x236c0b){_0x10f0ca[_0x02b5('0xb')]=_0x236c0b[_0x02b5('0xe')];_0x10f0ca[_0x02b5('0xf')]=_0x236c0b[_0x02b5('0xf')];utils['request'](_0x02b5('0x11'),_0x10f0ca);}});}})[_0x02b5('0x15')](function(_0xd6a298){utils[_0x02b5('0x16')](_0xd6a298);});}delete members[_0x10f0ca[_0x02b5('0x8')]];}function startsWith(_0x1f1079,_0x3670ae){return _[_0x02b5('0x17')](_0x1f1079,function(_0x205bcb){return _[_0x02b5('0x18')](_0x3670ae,_0x205bcb);});}exports[_0x02b5('0x19')]=function(_0x5e59d6){switch(_0x5e59d6['state']){case'INUSE':case _0x02b5('0x1a'):if(!startsWith(exclude,_0x5e59d6[_0x02b5('0x1b')])){members[_0x5e59d6[_0x02b5('0x1b')]]={'channel':_0x02b5('0x1c'),'interface':_0x5e59d6[_0x02b5('0x1b')],'type':_0x02b5('0x1d'),'enterAt':utils[_0x02b5('0x1e')](),'role':_0x02b5('0x1f')};}break;case _0x02b5('0x20'):if(!_[_0x02b5('0x21')](members[_0x5e59d6['device']])){members[_0x5e59d6['device']]['exitAt']=utils[_0x02b5('0x1e')]();members[_0x5e59d6[_0x02b5('0x1b')]][_0x02b5('0x22')]=utils[_0x02b5('0x23')](members[_0x5e59d6['device']][_0x02b5('0x24')],members[_0x5e59d6[_0x02b5('0x1b')]][_0x02b5('0x25')]);if(members[_0x5e59d6[_0x02b5('0x1b')]][_0x02b5('0x7')]){writeDB(members[_0x5e59d6[_0x02b5('0x1b')]]);}}default:break;}};exports[_0x02b5('0x26')]=function(_0x207baf){if(!_['isNil'](members[_0x207baf[_0x02b5('0x8')]])){members[_0x207baf[_0x02b5('0x8')]]=_[_0x02b5('0x27')](members[_0x207baf[_0x02b5('0x8')]],{'data4':_0x207baf[_0x02b5('0x28')],'uniqueid':_0x207baf[_0x02b5('0x7')]});}};exports[_0x02b5('0x29')]=function(_0x1ad397){if(_0x1ad397[_0x02b5('0x9')]){var _0x37b2e2=_0x1ad397[_0x02b5('0x9')][_0x02b5('0x13')]('-')[0x0];if(!_[_0x02b5('0x21')](members[_0x37b2e2])){members[_0x37b2e2]=_[_0x02b5('0x27')](members[_0x37b2e2],{'data1':members[_0x37b2e2][_0x02b5('0x2a')]||_0x1ad397[_0x02b5('0xc')],'data2':members[_0x37b2e2][_0x02b5('0xa')]||_0x1ad397[_0x02b5('0x2b')],'data3':members[_0x37b2e2][_0x02b5('0x2c')]||_0x1ad397['destination'],'uniqueid':members[_0x37b2e2]['uniqueid']||_0x1ad397['uniqueid']});if(members[_0x37b2e2][_0x02b5('0x24')]){writeDB(members[_0x37b2e2]);}}}if(_0x1ad397['destinationchannel']){var _0x4dc58e=_0x1ad397[_0x02b5('0x2d')][_0x02b5('0x13')]('-')[0x0];if(!_[_0x02b5('0x21')](members[_0x4dc58e])){members[_0x4dc58e]=_['assign'](members[_0x4dc58e],{'data1':members[_0x4dc58e][_0x02b5('0x2a')]||_0x1ad397[_0x02b5('0xc')],'data2':members[_0x4dc58e][_0x02b5('0xa')]||_0x1ad397[_0x02b5('0x2b')],'data3':members[_0x4dc58e][_0x02b5('0x2c')]||_0x1ad397[_0x02b5('0x2e')],'uniqueid':members[_0x4dc58e][_0x02b5('0x7')]||_0x1ad397['uniqueid']});if(members[_0x4dc58e][_0x02b5('0x24')]){writeDB(members[_0x4dc58e]);}}}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 4be18be..30c0eeb 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 _0x5692=['origtransfererlinkedid','ATTENDED','secondtransfererlinkedid','transfereelinkedid','transfertargetuniqueid','calleridnum','calleridname','mohtime','secondtransfererexten','secondtransfereruniqueid','ATTENDEDTRANSFER','transfertargetlinkedid','clone','error','stack','musiconholdstart','musiconholdstartAt','musiconholdstop','lodash','util','./utils','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','queue','lastAssignedTo','accountcode','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','assign','position','hangup','isNil','queuecallerabandon','queuecallerexit','queuecallercompleteAt','now','queuecallerexitreason','COMPLETEDBYAGENT','queuecallerenterreason','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','queueposition','ABANDONED','queuecallerleave','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','connectedlinenum','connectedlinename','agentconnect','assigned','membername','queuecallercomplete','reason','transfer','TRANSFER','COMPLETEDBY','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','attendedtransfer','origtransfereruniqueid'];(function(_0x4e310b,_0x3d9fa2){var _0x2c3bc4=function(_0x14c59f){while(--_0x14c59f){_0x4e310b['push'](_0x4e310b['shift']());}};_0x2c3bc4(++_0x3d9fa2);}(_0x5692,0x19d));var _0x2569=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5692[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x2569('0x0'));var util=require(_0x2569('0x1'));var utils=require(_0x2569('0x2'));var queues={};function writeDB(_0x506f8d){utils['info'](util[_0x2569('0x3')](_0x2569('0x4'),_0x506f8d[_0x2569('0x5')],_0x506f8d[_0x2569('0x6')],_0x506f8d[_0x2569('0x7')],_0x506f8d[_0x2569('0x8')],_0x506f8d['calleridnum'],_0x506f8d[_0x2569('0x9')],_0x506f8d['queuecallerexitreason']));if(_0x506f8d[_0x2569('0x7')]){utils['getVoiceQueueByName'](_0x506f8d[_0x2569('0x7')])[_0x2569('0xa')](function(_0x27930a){if(_0x27930a){_0x506f8d[_0x2569('0xb')]=_0x27930a['type'];}utils[_0x2569('0xc')](_0x2569('0xd'),_0x506f8d);});}else{utils['request'](_0x2569('0xd'),_0x506f8d);}if(_0x506f8d[_0x2569('0xe')]){delete queues[_0x506f8d[_0x2569('0xe')]];}else{delete queues[_0x506f8d[_0x2569('0x5')]];}}exports[_0x2569('0xf')]=function(_0x4207d9){queues[_0x4207d9[_0x2569('0x5')]]=_[_0x2569('0x10')](_0x4207d9,{'originalposition':_0x4207d9[_0x2569('0x11')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});};exports[_0x2569('0x12')]=function(_0x2be40a){if(!_[_0x2569('0x13')](queues[_0x2be40a[_0x2569('0x5')]])){if(queues[_0x2be40a[_0x2569('0x5')]]['queuecallerleaveAt']){if(!queues[_0x2be40a[_0x2569('0x5')]][_0x2569('0x14')]&&!queues[_0x2be40a[_0x2569('0x5')]][_0x2569('0x15')]){queues[_0x2be40a['uniqueid']]['queuecallercomplete']=!![];queues[_0x2be40a[_0x2569('0x5')]][_0x2569('0x16')]=utils[_0x2569('0x17')]();queues[_0x2be40a[_0x2569('0x5')]][_0x2569('0x18')]=_0x2569('0x19');}writeDB(queues[_0x2be40a['uniqueid']]);}else{if(queues[_0x2be40a[_0x2569('0x5')]]['transfereduniqueid']){queues[queues[_0x2be40a[_0x2569('0x5')]][_0x2569('0xe')]]=queues[_0x2be40a[_0x2569('0x5')]];queues[queues[_0x2be40a[_0x2569('0x5')]]['transfereduniqueid']][_0x2569('0x1a')]=0x2;delete queues[_0x2be40a['uniqueid']];}}}};exports['varset']=function(_0x35e993){if(!_[_0x2569('0x13')](_0x35e993[_0x2569('0x1b')][_0x2569('0x1c')])&&_0x35e993[_0x2569('0x1d')][_0x2569('0x1e')]()!==_0x2569('0x1f')){if(!_[_0x2569('0x13')](queues[_0x35e993[_0x2569('0x5')]])){queues[_0x35e993[_0x2569('0x5')]][_0x2569('0x14')]=![];queues[_0x35e993['uniqueid']][_0x2569('0x20')]=null;queues[_0x35e993[_0x2569('0x5')]][_0x2569('0x15')]=!![];queues[_0x35e993[_0x2569('0x5')]][_0x2569('0x21')]=utils['now']();queues[_0x35e993['uniqueid']][_0x2569('0x18')]=_0x35e993['value'][_0x2569('0x1e')]();writeDB(queues[_0x35e993[_0x2569('0x5')]]);}}else if(!_[_0x2569('0x13')](_0x35e993[_0x2569('0x1b')][_0x2569('0x22')])){if(!_['isNil'](queues[_0x35e993[_0x2569('0x5')]])&&!queues[_0x35e993[_0x2569('0x5')]][_0x2569('0x14')]){queues[_0x35e993['uniqueid']]['queuecallerabandon']=![];queues[_0x35e993['uniqueid']]['queuecallerabandonAt']=null;queues[_0x35e993[_0x2569('0x5')]]['queuecallerexit']=!![];queues[_0x35e993['uniqueid']][_0x2569('0x21')]=utils[_0x2569('0x17')]();queues[_0x35e993[_0x2569('0x5')]][_0x2569('0x18')]='EXITWITHKEY';}}};exports['queuecallerabandon']=function(_0x3e1c6b){if(!_['isNil'](queues[_0x3e1c6b[_0x2569('0x5')]])){queues[_0x3e1c6b[_0x2569('0x5')]][_0x2569('0x15')]=![];queues[_0x3e1c6b['uniqueid']][_0x2569('0x21')]=null;queues[_0x3e1c6b[_0x2569('0x5')]]['queuecallerabandon']=!![];queues[_0x3e1c6b[_0x2569('0x5')]][_0x2569('0x20')]=utils[_0x2569('0x17')]();queues[_0x3e1c6b[_0x2569('0x5')]][_0x2569('0x18')]=_0x2569('0x23');}};exports[_0x2569('0x24')]=function(_0x35562b){if(!_[_0x2569('0x13')](queues[_0x35562b[_0x2569('0x5')]])){queues[_0x35562b[_0x2569('0x5')]]['queuecallerleave']=!![];queues[_0x35562b[_0x2569('0x5')]][_0x2569('0x25')]=utils[_0x2569('0x17')]();queues[_0x35562b[_0x2569('0x5')]][_0x2569('0x26')]=utils[_0x2569('0x27')](queues[_0x35562b['uniqueid']][_0x2569('0x25')],queues[_0x35562b[_0x2569('0x5')]][_0x2569('0x28')]);queues[_0x35562b[_0x2569('0x5')]][_0x2569('0x11')]=_0x35562b[_0x2569('0x11')];queues[_0x35562b['uniqueid']]['count']=_0x35562b['count'];queues[_0x35562b[_0x2569('0x5')]][_0x2569('0x29')]=_0x35562b[_0x2569('0x29')];queues[_0x35562b[_0x2569('0x5')]][_0x2569('0x2a')]=_0x35562b['connectedlinename'];}};exports[_0x2569('0x2b')]=function(_0xc956a6){if(!_[_0x2569('0x13')](queues[_0xc956a6['uniqueid']])){queues[_0xc956a6[_0x2569('0x5')]][_0x2569('0x14')]=![];queues[_0xc956a6[_0x2569('0x5')]][_0x2569('0x14')]=![];queues[_0xc956a6[_0x2569('0x5')]][_0x2569('0x20')]=null;queues[_0xc956a6[_0x2569('0x5')]][_0x2569('0x15')]=![];queues[_0xc956a6[_0x2569('0x5')]][_0x2569('0x18')]=null;queues[_0xc956a6[_0x2569('0x5')]][_0x2569('0x21')]=null;queues[_0xc956a6[_0x2569('0x5')]][_0x2569('0x2c')]=!![];queues[_0xc956a6[_0x2569('0x5')]]['accountcode']=_0xc956a6['destaccountcode'];queues[_0xc956a6[_0x2569('0x5')]][_0x2569('0x8')]=_0xc956a6[_0x2569('0x2d')];}};exports['agentcomplete']=function(_0x128e32){if(!_[_0x2569('0x13')](queues[_0x128e32[_0x2569('0x5')]])){if(queues[_0x128e32[_0x2569('0x5')]][_0x2569('0x25')]){queues[_0x128e32[_0x2569('0x5')]]['queuecallerabandon']=![];queues[_0x128e32[_0x2569('0x5')]][_0x2569('0x14')]=![];queues[_0x128e32['uniqueid']]['queuecallerabandonAt']=null;queues[_0x128e32['uniqueid']][_0x2569('0x15')]=![];queues[_0x128e32[_0x2569('0x5')]][_0x2569('0x21')]=null;queues[_0x128e32[_0x2569('0x5')]][_0x2569('0x2c')]=!![];queues[_0x128e32[_0x2569('0x5')]][_0x2569('0x8')]=_0x128e32[_0x2569('0x2d')];queues[_0x128e32[_0x2569('0x5')]][_0x2569('0x2e')]=!![];queues[_0x128e32[_0x2569('0x5')]][_0x2569('0x16')]=utils['now']();if(_0x128e32[_0x2569('0x2f')]==_0x2569('0x30')){if(!queues[_0x128e32['uniqueid']]['transfer']){queues[_0x128e32['uniqueid']][_0x2569('0x18')]=_0x2569('0x31');}}else{queues[_0x128e32[_0x2569('0x5')]]['queuecallerexitreason']=_0x2569('0x32')+_0x128e32['reason']['toUpperCase']();}writeDB(queues[_0x128e32[_0x2569('0x5')]]);}}};exports[_0x2569('0x33')]=function(_0xb2ff83){if(!_['isNil'](queues[_0xb2ff83['transfereeuniqueid']])){queues[_0xb2ff83[_0x2569('0x34')]][_0x2569('0x30')]=!![];queues[_0xb2ff83['transfereeuniqueid']][_0x2569('0x35')]=_0x2569('0x36');queues[_0xb2ff83[_0x2569('0x34')]][_0x2569('0x37')]=_0xb2ff83[_0x2569('0x38')];queues[_0xb2ff83[_0x2569('0x34')]][_0x2569('0x39')]=_0xb2ff83[_0x2569('0x34')];queues[_0xb2ff83[_0x2569('0x34')]][_0x2569('0x18')]=_0x2569('0x3a');}};exports[_0x2569('0x3b')]=function(_0x268bee){try{if(_0x268bee[_0x2569('0x3c')]==_0x268bee[_0x2569('0x3d')]){if(!_[_0x2569('0x13')](queues[_0x268bee['secondtransfererlinkedid']])){queues[_0x268bee['secondtransfererlinkedid']]['transfer']=!![];queues[_0x268bee['secondtransfererlinkedid']][_0x2569('0x35')]=_0x2569('0x3e');queues[_0x268bee[_0x2569('0x3f')]][_0x2569('0x37')]=_0x268bee['origtransfererexten'];queues[_0x268bee[_0x2569('0x3f')]][_0x2569('0x39')]=_0x268bee[_0x2569('0x3c')];queues[_0x268bee[_0x2569('0x3f')]][_0x2569('0x18')]='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x268bee[_0x2569('0x3d')]])){if(_0x268bee[_0x2569('0x40')]&&queues[_0x268bee[_0x2569('0x40')]]){queues[_0x268bee[_0x2569('0x40')]][_0x2569('0x1a')]=0x1;queues[_0x268bee[_0x2569('0x34')]]=_['clone'](queues[_0x268bee[_0x2569('0x40')]]);queues[_0x268bee[_0x2569('0x34')]][_0x2569('0xe')]=_0x268bee[_0x2569('0x41')];queues[_0x268bee[_0x2569('0x34')]][_0x2569('0x1a')]=0x2;queues[_0x268bee[_0x2569('0x34')]][_0x2569('0x42')]=queues[_0x268bee[_0x2569('0x3f')]]['calleridnum'];queues[_0x268bee[_0x2569('0x34')]][_0x2569('0x43')]=queues[_0x268bee['secondtransfererlinkedid']]['calleridname'];queues[_0x268bee[_0x2569('0x34')]][_0x2569('0x28')]=utils[_0x2569('0x17')]();queues[_0x268bee[_0x2569('0x34')]]['queuecallerleaveAt']=utils['now']();queues[_0x268bee['transfereeuniqueid']][_0x2569('0x26')]=0x0;queues[_0x268bee['transfereeuniqueid']][_0x2569('0x44')]=0x0;}else{queues[_0x268bee[_0x2569('0x3d')]][_0x2569('0xe')]=_0x268bee[_0x2569('0x3f')];}}}else if(_0x268bee['secondtransfereruniqueid']==_0x268bee[_0x2569('0x3f')]){if(!_[_0x2569('0x13')](queues[_0x268bee['origtransfererlinkedid']])){queues[_0x268bee['origtransfererlinkedid']][_0x2569('0x30')]=!![];queues[_0x268bee[_0x2569('0x3d')]]['transfertype']='ATTENDED';queues[_0x268bee[_0x2569('0x3d')]][_0x2569('0x37')]=_0x268bee[_0x2569('0x45')];queues[_0x268bee[_0x2569('0x3d')]][_0x2569('0x39')]=_0x268bee[_0x2569('0x46')];queues[_0x268bee[_0x2569('0x3d')]][_0x2569('0x18')]=_0x2569('0x47');}if(!_[_0x2569('0x13')](queues[_0x268bee['secondtransfererlinkedid']])){if(_0x268bee[_0x2569('0x48')]&&queues[_0x268bee[_0x2569('0x48')]]){queues[_0x268bee['transfertargetlinkedid']][_0x2569('0x1a')]=0x1;queues[_0x268bee[_0x2569('0x41')]]=_[_0x2569('0x49')](queues[_0x268bee[_0x2569('0x48')]]);queues[_0x268bee[_0x2569('0x41')]][_0x2569('0xe')]=_0x268bee[_0x2569('0x41')];queues[_0x268bee[_0x2569('0x41')]][_0x2569('0x1a')]=0x2;queues[_0x268bee[_0x2569('0x41')]][_0x2569('0x42')]=queues[_0x268bee[_0x2569('0x3d')]][_0x2569('0x42')];queues[_0x268bee[_0x2569('0x41')]]['calleridname']=queues[_0x268bee['origtransfererlinkedid']][_0x2569('0x43')];queues[_0x268bee['transfertargetuniqueid']]['queuecallerjoinAt']=utils[_0x2569('0x17')]();queues[_0x268bee['transfertargetuniqueid']][_0x2569('0x25')]=utils['now']();queues[_0x268bee['transfertargetuniqueid']]['holdtime']=0x0;queues[_0x268bee[_0x2569('0x41')]][_0x2569('0x44')]=0x0;}else{queues[_0x268bee['secondtransfererlinkedid']][_0x2569('0xe')]=_0x268bee[_0x2569('0x3d')];}}}}catch(_0x240803){utils[_0x2569('0x4a')](_0x240803[_0x2569('0x4b')]);}};exports[_0x2569('0x4c')]=function(_0x2eed66){if(!_[_0x2569('0x13')](queues[_0x2eed66['uniqueid']])){queues[_0x2eed66[_0x2569('0x5')]][_0x2569('0x4d')]=utils['now']();}};exports[_0x2569('0x4e')]=function(_0x56da34){if(!_[_0x2569('0x13')](queues[_0x56da34['uniqueid']])){if(!_[_0x2569('0x13')](queues[_0x56da34[_0x2569('0x5')]][_0x2569('0x4d')])){queues[_0x56da34[_0x2569('0x5')]][_0x2569('0x44')]+=utils['diffTime'](utils[_0x2569('0x17')](),queues[_0x56da34[_0x2569('0x5')]]['musiconholdstartAt']);delete queues[_0x56da34[_0x2569('0x5')]][_0x2569('0x4d')];}}}; \ No newline at end of file +var _0xce7e=['./utils','info','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','uniqueid','lastAssignedTo','calleridnum','queue','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','assign','position','hangup','queuecallerleaveAt','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','varset','isNil','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerexit','queuecallerexitAt','queuecallerexitreason','queueposition','now','EXITWITHKEY','queuecallerabandonAt','ABANDONED','queuecallerleave','holdtime','queuecallerjoinAt','count','connectedlinenum','connectedlinename','agentconnect','assigned','accountcode','destaccountcode','agentcomplete','membername','reason','transfer','TRANSFER','blindtransfer','transfereeuniqueid','transfertype','transferexten','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','queuecallerenterreason','calleridname','mohtime','secondtransfereruniqueid','ATTENDED','secondtransfererexten','transfertargetlinkedid','error','stack','musiconholdstart','musiconholdstartAt','lodash','util'];(function(_0x418473,_0x2f4ef1){var _0x3e85d4=function(_0x2aa789){while(--_0x2aa789){_0x418473['push'](_0x418473['shift']());}};_0x3e85d4(++_0x2f4ef1);}(_0xce7e,0x189));var _0xece7=function(_0x260d40,_0x12855a){_0x260d40=_0x260d40-0x0;var _0x4665ca=_0xce7e[_0x260d40];return _0x4665ca;};'use strict';var _=require(_0xece7('0x0'));var util=require(_0xece7('0x1'));var utils=require(_0xece7('0x2'));var queues={};function writeDB(_0x86a48b){utils[_0xece7('0x3')](util[_0xece7('0x4')](_0xece7('0x5'),_0x86a48b[_0xece7('0x6')],_0x86a48b['channel'],_0x86a48b['queue'],_0x86a48b[_0xece7('0x7')],_0x86a48b[_0xece7('0x8')],_0x86a48b['accountcode'],_0x86a48b['queuecallerexitreason']));if(_0x86a48b[_0xece7('0x9')]){utils[_0xece7('0xa')](_0x86a48b[_0xece7('0x9')])['then'](function(_0x2bce89){if(_0x2bce89){_0x86a48b['type']=_0x2bce89[_0xece7('0xb')];}utils[_0xece7('0xc')](_0xece7('0xd'),_0x86a48b);});}else{utils[_0xece7('0xc')](_0xece7('0xd'),_0x86a48b);}if(_0x86a48b['transfereduniqueid']){delete queues[_0x86a48b[_0xece7('0xe')]];}else{delete queues[_0x86a48b[_0xece7('0x6')]];}}exports['queuecallerjoin']=function(_0xd9e30e){queues[_0xd9e30e[_0xece7('0x6')]]=_[_0xece7('0xf')](_0xd9e30e,{'originalposition':_0xd9e30e[_0xece7('0x10')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});};exports[_0xece7('0x11')]=function(_0x21f0e3){if(!_['isNil'](queues[_0x21f0e3['uniqueid']])){if(queues[_0x21f0e3['uniqueid']][_0xece7('0x12')]){if(!queues[_0x21f0e3['uniqueid']][_0xece7('0x13')]&&!queues[_0x21f0e3['uniqueid']]['queuecallerexit']){queues[_0x21f0e3[_0xece7('0x6')]][_0xece7('0x14')]=!![];queues[_0x21f0e3[_0xece7('0x6')]][_0xece7('0x15')]=utils['now']();queues[_0x21f0e3[_0xece7('0x6')]]['queuecallerexitreason']=_0xece7('0x16');}writeDB(queues[_0x21f0e3[_0xece7('0x6')]]);}else{if(queues[_0x21f0e3[_0xece7('0x6')]][_0xece7('0xe')]){queues[queues[_0x21f0e3[_0xece7('0x6')]][_0xece7('0xe')]]=queues[_0x21f0e3[_0xece7('0x6')]];queues[queues[_0x21f0e3[_0xece7('0x6')]][_0xece7('0xe')]]['queuecallerenterreason']=0x2;delete queues[_0x21f0e3['uniqueid']];}}}};exports[_0xece7('0x17')]=function(_0x34fb53){if(!_[_0xece7('0x18')](_0x34fb53[_0xece7('0x19')][_0xece7('0x1a')])&&_0x34fb53[_0xece7('0x1b')][_0xece7('0x1c')]()!==_0xece7('0x1d')){if(!_['isNil'](queues[_0x34fb53[_0xece7('0x6')]])){queues[_0x34fb53[_0xece7('0x6')]][_0xece7('0x13')]=![];queues[_0x34fb53['uniqueid']]['queuecallerabandonAt']=null;queues[_0x34fb53[_0xece7('0x6')]][_0xece7('0x1e')]=!![];queues[_0x34fb53[_0xece7('0x6')]][_0xece7('0x1f')]=utils['now']();queues[_0x34fb53[_0xece7('0x6')]][_0xece7('0x20')]=_0x34fb53[_0xece7('0x1b')]['toUpperCase']();writeDB(queues[_0x34fb53[_0xece7('0x6')]]);}}else if(!_[_0xece7('0x18')](_0x34fb53[_0xece7('0x19')][_0xece7('0x21')])){if(!_[_0xece7('0x18')](queues[_0x34fb53[_0xece7('0x6')]])&&!queues[_0x34fb53[_0xece7('0x6')]]['queuecallerabandon']){queues[_0x34fb53[_0xece7('0x6')]][_0xece7('0x13')]=![];queues[_0x34fb53[_0xece7('0x6')]]['queuecallerabandonAt']=null;queues[_0x34fb53[_0xece7('0x6')]][_0xece7('0x1e')]=!![];queues[_0x34fb53[_0xece7('0x6')]]['queuecallerexitAt']=utils[_0xece7('0x22')]();queues[_0x34fb53['uniqueid']][_0xece7('0x20')]=_0xece7('0x23');}}};exports['queuecallerabandon']=function(_0x957568){if(!_[_0xece7('0x18')](queues[_0x957568[_0xece7('0x6')]])){queues[_0x957568[_0xece7('0x6')]][_0xece7('0x1e')]=![];queues[_0x957568[_0xece7('0x6')]][_0xece7('0x1f')]=null;queues[_0x957568['uniqueid']]['queuecallerabandon']=!![];queues[_0x957568[_0xece7('0x6')]][_0xece7('0x24')]=utils[_0xece7('0x22')]();queues[_0x957568[_0xece7('0x6')]][_0xece7('0x20')]=_0xece7('0x25');}};exports[_0xece7('0x26')]=function(_0x539dc9){if(!_[_0xece7('0x18')](queues[_0x539dc9[_0xece7('0x6')]])){queues[_0x539dc9[_0xece7('0x6')]]['queuecallerleave']=!![];queues[_0x539dc9[_0xece7('0x6')]][_0xece7('0x12')]=utils[_0xece7('0x22')]();queues[_0x539dc9[_0xece7('0x6')]][_0xece7('0x27')]=utils['diffTime'](queues[_0x539dc9['uniqueid']][_0xece7('0x12')],queues[_0x539dc9['uniqueid']][_0xece7('0x28')]);queues[_0x539dc9[_0xece7('0x6')]][_0xece7('0x10')]=_0x539dc9[_0xece7('0x10')];queues[_0x539dc9[_0xece7('0x6')]][_0xece7('0x29')]=_0x539dc9[_0xece7('0x29')];queues[_0x539dc9[_0xece7('0x6')]]['connectedlinenum']=_0x539dc9[_0xece7('0x2a')];queues[_0x539dc9['uniqueid']][_0xece7('0x2b')]=_0x539dc9[_0xece7('0x2b')];}};exports[_0xece7('0x2c')]=function(_0xa7f9e3){if(!_[_0xece7('0x18')](queues[_0xa7f9e3['uniqueid']])){queues[_0xa7f9e3['uniqueid']][_0xece7('0x13')]=![];queues[_0xa7f9e3[_0xece7('0x6')]][_0xece7('0x13')]=![];queues[_0xa7f9e3[_0xece7('0x6')]][_0xece7('0x24')]=null;queues[_0xa7f9e3['uniqueid']][_0xece7('0x1e')]=![];queues[_0xa7f9e3[_0xece7('0x6')]][_0xece7('0x20')]=null;queues[_0xa7f9e3[_0xece7('0x6')]]['queuecallerexitAt']=null;queues[_0xa7f9e3[_0xece7('0x6')]][_0xece7('0x2d')]=!![];queues[_0xa7f9e3['uniqueid']][_0xece7('0x2e')]=_0xa7f9e3[_0xece7('0x2f')];queues[_0xa7f9e3[_0xece7('0x6')]][_0xece7('0x7')]=_0xa7f9e3['membername'];}};exports[_0xece7('0x30')]=function(_0x33aef9){if(!_['isNil'](queues[_0x33aef9[_0xece7('0x6')]])){if(queues[_0x33aef9[_0xece7('0x6')]][_0xece7('0x12')]){queues[_0x33aef9['uniqueid']][_0xece7('0x13')]=![];queues[_0x33aef9[_0xece7('0x6')]][_0xece7('0x13')]=![];queues[_0x33aef9[_0xece7('0x6')]]['queuecallerabandonAt']=null;queues[_0x33aef9[_0xece7('0x6')]]['queuecallerexit']=![];queues[_0x33aef9[_0xece7('0x6')]]['queuecallerexitAt']=null;queues[_0x33aef9[_0xece7('0x6')]][_0xece7('0x2d')]=!![];queues[_0x33aef9['uniqueid']][_0xece7('0x7')]=_0x33aef9[_0xece7('0x31')];queues[_0x33aef9[_0xece7('0x6')]][_0xece7('0x14')]=!![];queues[_0x33aef9[_0xece7('0x6')]][_0xece7('0x15')]=utils[_0xece7('0x22')]();if(_0x33aef9[_0xece7('0x32')]==_0xece7('0x33')){if(!queues[_0x33aef9['uniqueid']][_0xece7('0x33')]){queues[_0x33aef9[_0xece7('0x6')]][_0xece7('0x20')]=_0xece7('0x34');}}else{queues[_0x33aef9['uniqueid']]['queuecallerexitreason']='COMPLETEDBY'+_0x33aef9['reason'][_0xece7('0x1c')]();}writeDB(queues[_0x33aef9[_0xece7('0x6')]]);}}};exports[_0xece7('0x35')]=function(_0x296939){if(!_[_0xece7('0x18')](queues[_0x296939[_0xece7('0x36')]])){queues[_0x296939[_0xece7('0x36')]][_0xece7('0x33')]=!![];queues[_0x296939[_0xece7('0x36')]][_0xece7('0x37')]='BLIND';queues[_0x296939[_0xece7('0x36')]][_0xece7('0x38')]=_0x296939[_0xece7('0x39')];queues[_0x296939[_0xece7('0x36')]][_0xece7('0x3a')]=_0x296939['transfereeuniqueid'];queues[_0x296939[_0xece7('0x36')]][_0xece7('0x20')]='BLINDTRANSFER';}};exports[_0xece7('0x3b')]=function(_0x1f8404){try{if(_0x1f8404[_0xece7('0x3c')]==_0x1f8404[_0xece7('0x3d')]){if(!_[_0xece7('0x18')](queues[_0x1f8404[_0xece7('0x3e')]])){queues[_0x1f8404[_0xece7('0x3e')]]['transfer']=!![];queues[_0x1f8404[_0xece7('0x3e')]]['transfertype']='ATTENDED';queues[_0x1f8404[_0xece7('0x3e')]][_0xece7('0x38')]=_0x1f8404[_0xece7('0x3f')];queues[_0x1f8404[_0xece7('0x3e')]][_0xece7('0x3a')]=_0x1f8404[_0xece7('0x3c')];queues[_0x1f8404[_0xece7('0x3e')]][_0xece7('0x20')]=_0xece7('0x40');}if(!_['isNil'](queues[_0x1f8404[_0xece7('0x3d')]])){if(_0x1f8404[_0xece7('0x41')]&&queues[_0x1f8404[_0xece7('0x41')]]){queues[_0x1f8404[_0xece7('0x41')]]['queuecallerenterreason']=0x1;queues[_0x1f8404['transfereeuniqueid']]=_[_0xece7('0x42')](queues[_0x1f8404['transfereelinkedid']]);queues[_0x1f8404[_0xece7('0x36')]]['transfereduniqueid']=_0x1f8404[_0xece7('0x43')];queues[_0x1f8404[_0xece7('0x36')]][_0xece7('0x44')]=0x2;queues[_0x1f8404[_0xece7('0x36')]][_0xece7('0x8')]=queues[_0x1f8404[_0xece7('0x3e')]][_0xece7('0x8')];queues[_0x1f8404[_0xece7('0x36')]][_0xece7('0x45')]=queues[_0x1f8404[_0xece7('0x3e')]][_0xece7('0x45')];queues[_0x1f8404[_0xece7('0x36')]][_0xece7('0x28')]=utils[_0xece7('0x22')]();queues[_0x1f8404['transfereeuniqueid']]['queuecallerleaveAt']=utils[_0xece7('0x22')]();queues[_0x1f8404[_0xece7('0x36')]]['holdtime']=0x0;queues[_0x1f8404[_0xece7('0x36')]][_0xece7('0x46')]=0x0;}else{queues[_0x1f8404['origtransfererlinkedid']]['transfereduniqueid']=_0x1f8404[_0xece7('0x3e')];}}}else if(_0x1f8404[_0xece7('0x47')]==_0x1f8404[_0xece7('0x3e')]){if(!_['isNil'](queues[_0x1f8404[_0xece7('0x3d')]])){queues[_0x1f8404[_0xece7('0x3d')]][_0xece7('0x33')]=!![];queues[_0x1f8404['origtransfererlinkedid']]['transfertype']=_0xece7('0x48');queues[_0x1f8404['origtransfererlinkedid']][_0xece7('0x38')]=_0x1f8404[_0xece7('0x49')];queues[_0x1f8404[_0xece7('0x3d')]][_0xece7('0x3a')]=_0x1f8404[_0xece7('0x47')];queues[_0x1f8404[_0xece7('0x3d')]][_0xece7('0x20')]='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x1f8404[_0xece7('0x3e')]])){if(_0x1f8404[_0xece7('0x4a')]&&queues[_0x1f8404['transfertargetlinkedid']]){queues[_0x1f8404[_0xece7('0x4a')]][_0xece7('0x44')]=0x1;queues[_0x1f8404[_0xece7('0x43')]]=_[_0xece7('0x42')](queues[_0x1f8404[_0xece7('0x4a')]]);queues[_0x1f8404[_0xece7('0x43')]][_0xece7('0xe')]=_0x1f8404[_0xece7('0x43')];queues[_0x1f8404[_0xece7('0x43')]][_0xece7('0x44')]=0x2;queues[_0x1f8404[_0xece7('0x43')]]['calleridnum']=queues[_0x1f8404['origtransfererlinkedid']][_0xece7('0x8')];queues[_0x1f8404[_0xece7('0x43')]][_0xece7('0x45')]=queues[_0x1f8404['origtransfererlinkedid']][_0xece7('0x45')];queues[_0x1f8404[_0xece7('0x43')]][_0xece7('0x28')]=utils[_0xece7('0x22')]();queues[_0x1f8404[_0xece7('0x43')]]['queuecallerleaveAt']=utils[_0xece7('0x22')]();queues[_0x1f8404[_0xece7('0x43')]][_0xece7('0x27')]=0x0;queues[_0x1f8404[_0xece7('0x43')]][_0xece7('0x46')]=0x0;}else{queues[_0x1f8404[_0xece7('0x3e')]][_0xece7('0xe')]=_0x1f8404[_0xece7('0x3d')];}}}}catch(_0x8b1c50){utils[_0xece7('0x4b')](_0x8b1c50[_0xece7('0x4c')]);}};exports[_0xece7('0x4d')]=function(_0x37ac60){if(!_['isNil'](queues[_0x37ac60[_0xece7('0x6')]])){queues[_0x37ac60[_0xece7('0x6')]][_0xece7('0x4e')]=utils[_0xece7('0x22')]();}};exports['musiconholdstop']=function(_0x3ed92f){if(!_[_0xece7('0x18')](queues[_0x3ed92f['uniqueid']])){if(!_[_0xece7('0x18')](queues[_0x3ed92f[_0xece7('0x6')]][_0xece7('0x4e')])){queues[_0x3ed92f['uniqueid']]['mohtime']+=utils['diffTime'](utils[_0xece7('0x22')](),queues[_0x3ed92f['uniqueid']]['musiconholdstartAt']);delete queues[_0x3ed92f[_0xece7('0x6')]][_0xece7('0x4e')];}}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 6bbf273..634f447 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 _0x34e8=['membername','name','UserId','CreateVoiceRecording','newchannel','uniqueid','linkedid','exten','context','channel','error','stack','newstate','isNil','channelstate','transfer','variable','mixmonitor_filename','value','.wav49','replace','.WAV','find','monitors','push','hangup','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','clone','newexten','application','toLowerCase','set','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','queue','lodash','./utils','debug','getUserByInternal','accountcode','then'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x34e8,0x12c));var _0x834e=function(_0x56f47a,_0x443728){_0x56f47a=_0x56f47a-0x0;var _0x5b222e=_0x34e8[_0x56f47a];return _0x5b222e;};'use strict';var _=require(_0x834e('0x0'));var utils=require(_0x834e('0x1'));var recordings={};function writeDB(_0x8b339){utils[_0x834e('0x2')](_0x8b339);if(_0x8b339['accountcode']){utils[_0x834e('0x3')](_0x8b339[_0x834e('0x4')])[_0x834e('0x5')](function(_0x31bf20){if(_0x31bf20){_0x8b339[_0x834e('0x6')]=_0x31bf20[_0x834e('0x7')];_0x8b339[_0x834e('0x8')]=_0x31bf20['id'];}utils['request'](_0x834e('0x9'),_0x8b339);});}else{utils['request'](_0x834e('0x9'),_0x8b339);}}exports[_0x834e('0xa')]=function(_0x3a3ef6){try{if(_0x3a3ef6[_0x834e('0xb')]==_0x3a3ef6[_0x834e('0xc')]){recordings[_0x3a3ef6[_0x834e('0xb')]]={'uniqueid':_0x3a3ef6[_0x834e('0xb')],'accountcode':_0x3a3ef6[_0x834e('0x4')],'exten':_0x3a3ef6[_0x834e('0xd')],'context':_0x3a3ef6[_0x834e('0xe')],'channel':_0x3a3ef6[_0x834e('0xf')],'monitors':[]};}}catch(_0x36e124){utils[_0x834e('0x10')](_0x36e124[_0x834e('0x11')]);}};exports[_0x834e('0x12')]=function(_0x1e00de){try{if(!_[_0x834e('0x13')](recordings[_0x1e00de['uniqueid']])&&_0x1e00de[_0x834e('0x14')]==0x6){}else if(!_[_0x834e('0x13')](recordings[_0x1e00de['linkedid']])&&_0x1e00de[_0x834e('0x14')]==0x6&&_0x1e00de[_0x834e('0xe')]!=_0x834e('0x15')){recordings[_0x1e00de[_0x834e('0xc')]]['accountcode']=_0x1e00de[_0x834e('0x4')];}}catch(_0x302cbd){utils['error'](_0x302cbd[_0x834e('0x11')]);}};exports['varset']=function(_0x38a8cd){try{if(!_[_0x834e('0x13')](_0x38a8cd['variable'])&&!_[_0x834e('0x13')](_0x38a8cd[_0x834e('0x16')][_0x834e('0x17')])){if(_['endsWith'](_0x38a8cd[_0x834e('0x18')],_0x834e('0x19'))){_0x38a8cd[_0x834e('0x18')]=_0x38a8cd[_0x834e('0x18')][_0x834e('0x1a')](_0x834e('0x19'),_0x834e('0x1b'));}if(recordings[_0x38a8cd['linkedid']]){var _0x2545b4=_[_0x834e('0x1c')](recordings[_0x38a8cd[_0x834e('0xc')]][_0x834e('0x1d')],{'value':_0x38a8cd['value']});if(_[_0x834e('0x13')](_0x2545b4)){recordings[_0x38a8cd[_0x834e('0xc')]]['monitors'][_0x834e('0x1e')]({'value':_0x38a8cd[_0x834e('0x18')]});}}}}catch(_0x8d406e){utils['error'](_0x8d406e['stack']);}};exports[_0x834e('0x1f')]=function(_0x34563b){try{if(!_['isNil'](recordings[_0x34563b[_0x834e('0xb')]])){recordings[_0x34563b[_0x834e('0xb')]]['calleridnum']=_0x34563b[_0x834e('0x20')];recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x21')]=_0x34563b['calleridname'];recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x22')]=_0x34563b['connectedlinenum'];recordings[_0x34563b['uniqueid']][_0x834e('0x23')]=_0x34563b['connectedlinename'];if(recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x24')]==_0x834e('0x25')&&recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x4')]){recordings[_0x34563b[_0x834e('0xb')]]['connectedlinenum']=recordings[_0x34563b['uniqueid']]['accountcode'];recordings[_0x34563b['uniqueid']][_0x834e('0x23')]='';}recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x1d')]['forEach'](_0xb5bc06=>{var _0x11f1ce=_[_0x834e('0x26')](recordings[_0x34563b[_0x834e('0xb')]]);_0x11f1ce[_0x834e('0x18')]=_0xb5bc06[_0x834e('0x18')];writeDB(_0x11f1ce);});delete recordings[_0x34563b[_0x834e('0xb')]];}}catch(_0xfaf716){utils[_0x834e('0x10')](_0xfaf716['stack']);}};exports[_0x834e('0x27')]=function(_0x5cad11){try{if(!_[_0x834e('0x13')](recordings[_0x5cad11[_0x834e('0xb')]])){if(_0x5cad11[_0x834e('0x28')][_0x834e('0x29')]()==_0x834e('0x2a')&&_[_0x834e('0x2b')](_0x5cad11[_0x834e('0x2c')][_0x834e('0x29')](),_0x834e('0x2d'))){var _0x12b2bc=_0x5cad11['appdata'][_0x834e('0x2e')]('=');var _0x2f408a=_0x12b2bc[0x0][_0x834e('0x2f')](_0x12b2bc[0x0][_0x834e('0x30')]('(')+0x1,_0x12b2bc[0x0]['lastIndexOf'](')'));var _0x3f88ad=_0x12b2bc[0x1];recordings[_0x5cad11[_0x834e('0xb')]][_0x2f408a]=_0x3f88ad;}}}catch(_0x4b12f5){utils['error'](_0x4b12f5['stack']);}};exports[_0x834e('0x31')]=function(_0x41bf4d){try{if(!_[_0x834e('0x13')](recordings[_0x41bf4d[_0x834e('0xb')]])){recordings[_0x41bf4d[_0x834e('0xb')]][_0x834e('0x32')]=_0x41bf4d['queue'];}}catch(_0x2c2d94){utils['error'](_0x2c2d94[_0x834e('0x11')]);}}; \ No newline at end of file +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(_0x4ed92f,_0x4f3a34){var _0x4e4ecb=function(_0x1c2748){while(--_0x1c2748){_0x4ed92f['push'](_0x4ed92f['shift']());}};_0x4e4ecb(++_0x4f3a34);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x337748,_0x402b05){_0x337748=_0x337748-0x0;var _0x3bb03f=_0xcb91[_0x337748];return _0x3bb03f;};'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 diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index fb35cea..cd3988a 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 _0xb56f=['type','request','blindtransfer','blind','error','assign','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfererlinkedid','origtransfererexten','attended','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetexten','transfertargetlinkedid','stack','lodash','util','./utils','info','format'];(function(_0x555b84,_0x52c991){var _0x131644=function(_0x123b69){while(--_0x123b69){_0x555b84['push'](_0x555b84['shift']());}};_0x131644(++_0x52c991);}(_0xb56f,0x113));var _0xfb56=function(_0x4fd3a7,_0xd0992e){_0x4fd3a7=_0x4fd3a7-0x0;var _0x1da1fc=_0xb56f[_0x4fd3a7];return _0x1da1fc;};'use strict';var _=require(_0xfb56('0x0'));var util=require(_0xfb56('0x1'));var utils=require(_0xfb56('0x2'));function writeDB(_0x57c96b){utils[_0xfb56('0x3')](util[_0xfb56('0x4')]('TRANSFER|%s',_0x57c96b[_0xfb56('0x5')]));utils[_0xfb56('0x6')]('CreateVoiceTransferReport',_0x57c96b);}exports[_0xfb56('0x7')]=function(_0x5ebbb1){try{_0x5ebbb1[_0xfb56('0x5')]=_0xfb56('0x8');writeDB(_0x5ebbb1);}catch(_0x226095){utils[_0xfb56('0x9')](_0x226095['stack']);}};exports['attendedtransfer']=function(_0xbcbe76){try{_0xbcbe76=_[_0xfb56('0xa')](_0xbcbe76,{'transfererchannel':_0xbcbe76[_0xfb56('0xb')],'transferercalleridnum':_0xbcbe76[_0xfb56('0xc')],'transferercalleridname':_0xbcbe76[_0xfb56('0xd')],'transfererconnectedlinenum':_0xbcbe76[_0xfb56('0xe')],'transfererconnectedlinename':_0xbcbe76[_0xfb56('0xf')],'transfereraccountcode':_0xbcbe76['origtransfereraccountcode'],'transferercontext':_0xbcbe76['secondtransferercontext'],'transfererexten':_0xbcbe76['secondtransfererexten'],'transfererlinkedid':_0xbcbe76[_0xfb56('0x10')],'context':_0xbcbe76['origtransferercontext'],'extension':_0xbcbe76[_0xfb56('0x11')],'type':_0xfb56('0x12')});if(_[_0xfb56('0x13')](_0xbcbe76[_0xfb56('0x14')])){_0xbcbe76=_['assign'](_0xbcbe76,{'transfereechannel':_0xbcbe76[_0xfb56('0x15')],'transfereecalleridnum':_0xbcbe76[_0xfb56('0x16')],'transfereecalleridname':_0xbcbe76[_0xfb56('0x17')],'transfereeconnectedlinenum':_0xbcbe76['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0xbcbe76[_0xfb56('0x18')],'transfereeaccountcode':_0xbcbe76['transfertargetaccountcode'],'transfereecontext':_0xbcbe76['transfertargetcontext'],'transfereeexten':_0xbcbe76[_0xfb56('0x19')],'transfereelinkedid':_0xbcbe76[_0xfb56('0x1a')]});}writeDB(_0xbcbe76);}catch(_0xc1e894){utils[_0xfb56('0x9')](_0xc1e894[_0xfb56('0x1b')]);}}; \ No newline at end of file +var _0x6548=['blind','error','stack','attendedtransfer','assign','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetlinkedid','lodash','info','format','CreateVoiceTransferReport','type'];(function(_0x41f688,_0x59b64b){var _0x1e7baf=function(_0x33e681){while(--_0x33e681){_0x41f688['push'](_0x41f688['shift']());}};_0x1e7baf(++_0x59b64b);}(_0x6548,0x133));var _0x8654=function(_0x4a42f0,_0x2da65d){_0x4a42f0=_0x4a42f0-0x0;var _0x3dc532=_0x6548[_0x4a42f0];return _0x3dc532;};'use strict';var _=require(_0x8654('0x0'));var util=require('util');var utils=require('./utils');function writeDB(_0x477fff){utils[_0x8654('0x1')](util[_0x8654('0x2')]('TRANSFER|%s',_0x477fff['type']));utils['request'](_0x8654('0x3'),_0x477fff);}exports['blindtransfer']=function(_0x2c300d){try{_0x2c300d[_0x8654('0x4')]=_0x8654('0x5');writeDB(_0x2c300d);}catch(_0x18efe2){utils[_0x8654('0x6')](_0x18efe2[_0x8654('0x7')]);}};exports[_0x8654('0x8')]=function(_0x4b44aa){try{_0x4b44aa=_[_0x8654('0x9')](_0x4b44aa,{'transfererchannel':_0x4b44aa[_0x8654('0xa')],'transferercalleridnum':_0x4b44aa['origtransferercalleridnum'],'transferercalleridname':_0x4b44aa[_0x8654('0xb')],'transfererconnectedlinenum':_0x4b44aa[_0x8654('0xc')],'transfererconnectedlinename':_0x4b44aa[_0x8654('0xd')],'transfereraccountcode':_0x4b44aa['origtransfereraccountcode'],'transferercontext':_0x4b44aa['secondtransferercontext'],'transfererexten':_0x4b44aa[_0x8654('0xe')],'transfererlinkedid':_0x4b44aa[_0x8654('0xf')],'context':_0x4b44aa[_0x8654('0x10')],'extension':_0x4b44aa[_0x8654('0x11')],'type':'attended'});if(_[_0x8654('0x12')](_0x4b44aa[_0x8654('0x13')])){_0x4b44aa=_[_0x8654('0x9')](_0x4b44aa,{'transfereechannel':_0x4b44aa['transfertargetchannel'],'transfereecalleridnum':_0x4b44aa[_0x8654('0x14')],'transfereecalleridname':_0x4b44aa['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x4b44aa[_0x8654('0x15')],'transfereeconnectedlinename':_0x4b44aa[_0x8654('0x16')],'transfereeaccountcode':_0x4b44aa['transfertargetaccountcode'],'transfereecontext':_0x4b44aa['transfertargetcontext'],'transfereeexten':_0x4b44aa['transfertargetexten'],'transfereelinkedid':_0x4b44aa[_0x8654('0x17')]});}writeDB(_0x4b44aa);}catch(_0x24bec4){utils[_0x8654('0x6')](_0x24bec4[_0x8654('0x7')]);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 7257dfb..8f40f42 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 _0x98ea=['GETVOICEQUEUEBYNAME|','addTime','add','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','seconds','format','diff','sumTime','now','isAfter','isBefore','jayson/promise','moment','bluebird','http','../../config/logger','xdr','info','debug','stringify','error','stack','request','then','catch','GetUser','name','interface','result','length','FOUND','getUserByInternal','getUserByInterface','getUserByName','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout'];(function(_0x958cdf,_0x57a848){var _0x231543=function(_0x351bda){while(--_0x351bda){_0x958cdf['push'](_0x958cdf['shift']());}};_0x231543(++_0x57a848);}(_0x98ea,0x103));var _0xa98e=function(_0x542607,_0x27c30e){_0x542607=_0x542607-0x0;var _0x111384=_0x98ea[_0x542607];return _0x111384;};'use strict';var jayson=require(_0xa98e('0x0'));var moment=require(_0xa98e('0x1'));var BPromise=require(_0xa98e('0x2'));var client=jayson['client'][_0xa98e('0x3')]({'port':0x2329});var logger=require(_0xa98e('0x4'))(_0xa98e('0x5'));exports[_0xa98e('0x6')]=function(_0x533983){logger['info'](_0x533983);};exports[_0xa98e('0x7')]=function(_0x2efc4c){logger[_0xa98e('0x7')](JSON[_0xa98e('0x8')](_0x2efc4c));};exports[_0xa98e('0x9')]=function(_0x52ccdc){logger[_0xa98e('0x9')](_0x52ccdc[_0xa98e('0xa')]);};exports[_0xa98e('0xb')]=function(_0x10d4ba,_0x3a6d57){return client['request'](_0x10d4ba,{'body':_0x3a6d57})[_0xa98e('0xc')](function(_0x3f640e){logger[_0xa98e('0x7')](JSON['stringify'](_0x3f640e));})[_0xa98e('0xd')](function(_0x23faba){logger[_0xa98e('0x9')](_0x23faba[_0xa98e('0xa')]);});};function getUser(_0x1243cc){return client[_0xa98e('0xb')](_0xa98e('0xe'),{'options':{'raw':!![],'attributes':['id','internal',_0xa98e('0xf'),_0xa98e('0x10')],'where':_0x1243cc,'limit':0x1}})['then'](function(_0x3fc5c7){logger[_0xa98e('0x6')]('GETUSER|'+JSON[_0xa98e('0x8')](_0x1243cc)+'|'+(_0x3fc5c7[_0xa98e('0x11')][_0xa98e('0x12')]?_0xa98e('0x13'):'NOTFOUND'));return _0x3fc5c7[_0xa98e('0x11')]['length']?_0x3fc5c7[_0xa98e('0x11')][0x0]:null;});}exports[_0xa98e('0x14')]=function(_0x36930b){return new BPromise(function(_0x42dc2e,_0x97c793){if(_0x36930b){return getUser({'internal':_0x36930b})[_0xa98e('0xc')](function(_0x12dcd4){return _0x42dc2e(_0x12dcd4);})[_0xa98e('0xd')](function(_0x59157f){logger[_0xa98e('0x9')](_0x59157f['stack']);return _0x42dc2e(null);});}else{return _0x42dc2e(null);}});};exports[_0xa98e('0x15')]=function(_0x391d32){return new BPromise(function(_0x24021a,_0x540bd7){if(_0x391d32){return getUser({'interface':_0x391d32})[_0xa98e('0xc')](function(_0x540a34){return _0x24021a(_0x540a34);})[_0xa98e('0xd')](function(_0x309c7f){logger[_0xa98e('0x9')](_0x309c7f[_0xa98e('0xa')]);return _0x24021a(null);});}else{return _0x24021a(null);}});};exports[_0xa98e('0x16')]=function(_0xd4c179){return new BPromise(function(_0x3838ff,_0x29009f){if(_0xd4c179){return getUser({'name':_0xd4c179})[_0xa98e('0xc')](function(_0x3277b0){return _0x3838ff(_0x3277b0);})[_0xa98e('0xd')](function(_0x1083bd){logger[_0xa98e('0x9')](_0x1083bd['stack']);return _0x3838ff(null);});}else{return _0x3838ff(null);}});};exports[_0xa98e('0x17')]=function(_0x447c6b){return new BPromise(function(_0x427108,_0x118ebd){if(_0x447c6b){return client[_0xa98e('0xb')](_0xa98e('0x18'),{'options':{'raw':!![],'attributes':['id',_0xa98e('0xf'),_0xa98e('0x19'),_0xa98e('0x1a'),_0xa98e('0x1b')],'where':{'name':_0x447c6b},'limit':0x1}})[_0xa98e('0xc')](function(_0x55ad69){logger[_0xa98e('0x6')](_0xa98e('0x1c')+_0x447c6b+'|'+(_0x55ad69['result']['length']?_0xa98e('0x13'):'NOTFOUND'));return _0x427108(_0x55ad69[_0xa98e('0x11')]['length']?_0x55ad69[_0xa98e('0x11')][0x0]:null);})[_0xa98e('0xd')](function(_0x4202bd){logger[_0xa98e('0x9')](_0x4202bd[_0xa98e('0xa')]);return _0x427108(null);});}else{return _0x427108(null);}});};exports[_0xa98e('0x1d')]=function(_0x2b67f1,_0x9728fb){return moment(_0x2b67f1)[_0xa98e('0x1e')](_0x9728fb,'seconds')['format'](_0xa98e('0x1f'));};exports[_0xa98e('0x20')]=function(_0x16e975,_0x575e92){return moment(_0x16e975)[_0xa98e('0x21')](_0x575e92,_0xa98e('0x22'))[_0xa98e('0x23')](_0xa98e('0x1f'));};exports['diffTime']=function(_0x32a1aa,_0x95ed1a){return moment(_0x32a1aa)[_0xa98e('0x24')](moment(_0x95ed1a),_0xa98e('0x22'));};exports[_0xa98e('0x25')]=function(_0x395448,_0x982dcc){return parseInt(_0x395448,0xa)+parseInt(_0x982dcc,0xa);};exports[_0xa98e('0x26')]=function(){return moment()['format'](_0xa98e('0x1f'));};exports[_0xa98e('0x27')]=function(_0x1f185f,_0x511b14){if(_0x511b14){return moment(_0x1f185f)['isAfter'](_0x511b14);}else{return!![];}};exports[_0xa98e('0x28')]=function(_0x3cf446,_0x488638){if(_0x488638){return moment(_0x3cf446)[_0xa98e('0x28')](_0x488638);}else if(_0x3cf446){return!![];}else{return![];}}; \ No newline at end of file +var _0xf125=['addTime','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','diff','sumTime','now','isAfter','isBefore','jayson/promise','moment','bluebird','client','http','../../config/logger','xdr','info','debug','error','stack','request','then','stringify','catch','GetUser','name','interface','result','NOTFOUND','length','getUserByInterface','getUserByName','type','acw','acwTimeout','GETVOICEQUEUEBYNAME|'];(function(_0xe1441d,_0x36fb8e){var _0x2ef242=function(_0x52bf2d){while(--_0x52bf2d){_0xe1441d['push'](_0xe1441d['shift']());}};_0x2ef242(++_0x36fb8e);}(_0xf125,0x10d));var _0x5f12=function(_0x1a7cb2,_0x47afc5){_0x1a7cb2=_0x1a7cb2-0x0;var _0x3f8438=_0xf125[_0x1a7cb2];return _0x3f8438;};'use strict';var jayson=require(_0x5f12('0x0'));var moment=require(_0x5f12('0x1'));var BPromise=require(_0x5f12('0x2'));var client=jayson[_0x5f12('0x3')][_0x5f12('0x4')]({'port':0x2329});var logger=require(_0x5f12('0x5'))(_0x5f12('0x6'));exports[_0x5f12('0x7')]=function(_0x3aa08f){logger[_0x5f12('0x7')](_0x3aa08f);};exports[_0x5f12('0x8')]=function(_0x1a4ea3){logger[_0x5f12('0x8')](JSON['stringify'](_0x1a4ea3));};exports[_0x5f12('0x9')]=function(_0x483774){logger[_0x5f12('0x9')](_0x483774[_0x5f12('0xa')]);};exports[_0x5f12('0xb')]=function(_0x4a8552,_0x4b63c8){return client['request'](_0x4a8552,{'body':_0x4b63c8})[_0x5f12('0xc')](function(_0x4ebb8a){logger[_0x5f12('0x8')](JSON[_0x5f12('0xd')](_0x4ebb8a));})[_0x5f12('0xe')](function(_0x35a204){logger[_0x5f12('0x9')](_0x35a204[_0x5f12('0xa')]);});};function getUser(_0x52b477){return client[_0x5f12('0xb')](_0x5f12('0xf'),{'options':{'raw':!![],'attributes':['id','internal',_0x5f12('0x10'),_0x5f12('0x11')],'where':_0x52b477,'limit':0x1}})[_0x5f12('0xc')](function(_0xae3f1a){logger['info']('GETUSER|'+JSON[_0x5f12('0xd')](_0x52b477)+'|'+(_0xae3f1a[_0x5f12('0x12')]['length']?'FOUND':_0x5f12('0x13')));return _0xae3f1a['result'][_0x5f12('0x14')]?_0xae3f1a['result'][0x0]:null;});}exports['getUserByInternal']=function(_0x4f8448){return new BPromise(function(_0x4eaf52,_0x1225da){if(_0x4f8448){return getUser({'internal':_0x4f8448})[_0x5f12('0xc')](function(_0x4cf212){return _0x4eaf52(_0x4cf212);})['catch'](function(_0x3aa205){logger[_0x5f12('0x9')](_0x3aa205[_0x5f12('0xa')]);return _0x4eaf52(null);});}else{return _0x4eaf52(null);}});};exports[_0x5f12('0x15')]=function(_0x238ba2){return new BPromise(function(_0x49dd99,_0x6f8b22){if(_0x238ba2){return getUser({'interface':_0x238ba2})[_0x5f12('0xc')](function(_0x52af0f){return _0x49dd99(_0x52af0f);})[_0x5f12('0xe')](function(_0x41298e){logger[_0x5f12('0x9')](_0x41298e[_0x5f12('0xa')]);return _0x49dd99(null);});}else{return _0x49dd99(null);}});};exports[_0x5f12('0x16')]=function(_0x486e4d){return new BPromise(function(_0x48b0ab,_0x26a1d7){if(_0x486e4d){return getUser({'name':_0x486e4d})[_0x5f12('0xc')](function(_0x5ea9f6){return _0x48b0ab(_0x5ea9f6);})['catch'](function(_0x1cf4e6){logger[_0x5f12('0x9')](_0x1cf4e6[_0x5f12('0xa')]);return _0x48b0ab(null);});}else{return _0x48b0ab(null);}});};exports['getVoiceQueueByName']=function(_0x3f7e72){return new BPromise(function(_0x2a4b57,_0x4d1540){if(_0x3f7e72){return client[_0x5f12('0xb')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x5f12('0x10'),_0x5f12('0x17'),_0x5f12('0x18'),_0x5f12('0x19')],'where':{'name':_0x3f7e72},'limit':0x1}})['then'](function(_0x135d80){logger['info'](_0x5f12('0x1a')+_0x3f7e72+'|'+(_0x135d80[_0x5f12('0x12')]['length']?'FOUND':_0x5f12('0x13')));return _0x2a4b57(_0x135d80[_0x5f12('0x12')][_0x5f12('0x14')]?_0x135d80[_0x5f12('0x12')][0x0]:null);})[_0x5f12('0xe')](function(_0x55288e){logger[_0x5f12('0x9')](_0x55288e[_0x5f12('0xa')]);return _0x2a4b57(null);});}else{return _0x2a4b57(null);}});};exports[_0x5f12('0x1b')]=function(_0xaafac4,_0x37e7de){return moment(_0xaafac4)['add'](_0x37e7de,_0x5f12('0x1c'))[_0x5f12('0x1d')](_0x5f12('0x1e'));};exports[_0x5f12('0x1f')]=function(_0x55510a,_0x706579){return moment(_0x55510a)['subtract'](_0x706579,'seconds')[_0x5f12('0x1d')](_0x5f12('0x1e'));};exports['diffTime']=function(_0x20b39b,_0x28f076){return moment(_0x20b39b)[_0x5f12('0x20')](moment(_0x28f076),_0x5f12('0x1c'));};exports[_0x5f12('0x21')]=function(_0x77c15e,_0x5ab1bc){return parseInt(_0x77c15e,0xa)+parseInt(_0x5ab1bc,0xa);};exports[_0x5f12('0x22')]=function(){return moment()[_0x5f12('0x1d')](_0x5f12('0x1e'));};exports[_0x5f12('0x23')]=function(_0x413c2f,_0x39f932){if(_0x39f932){return moment(_0x413c2f)[_0x5f12('0x23')](_0x39f932);}else{return!![];}};exports[_0x5f12('0x24')]=function(_0x15a46c,_0x4d2f41){if(_0x4d2f41){return moment(_0x15a46c)[_0x5f12('0x24')](_0x4d2f41);}else if(_0x15a46c){return!![];}else{return![];}}; \ No newline at end of file